refactor: trim hooks local exports · openclaw/openclaw@4fd1b17
steipete
·
2026-05-02
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,8 +3,6 @@ import {
|
3 | 3 | evaluateRuntimeEligibility, |
4 | 4 | hasBinary, |
5 | 5 | isConfigPathTruthyWithDefaults, |
6 | | -resolveConfigPath, |
7 | | -resolveRuntimePlatform, |
8 | 6 | } from "../shared/config-eval.js"; |
9 | 7 | import { resolveHookConfig, resolveHookEnableState } from "./policy.js"; |
10 | 8 | import type { HookEligibilityContext, HookEntry } from "./types.js"; |
@@ -15,7 +13,7 @@ const DEFAULT_CONFIG_VALUES: Record<string, boolean> = {
|
15 | 13 | "workspace.dir": true, |
16 | 14 | }; |
17 | 15 | |
18 | | -export { hasBinary, resolveConfigPath, resolveRuntimePlatform }; |
| 16 | +export { hasBinary }; |
19 | 17 | |
20 | 18 | export function isConfigPathTruthy(config: OpenClawConfig | undefined, pathStr: string): boolean { |
21 | 19 | return isConfigPathTruthyWithDefaults(config, pathStr, DEFAULT_CONFIG_VALUES); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,7 @@ export const DEFAULT_GMAIL_SERVE_PORT = 8788;
|
14 | 14 | export const DEFAULT_GMAIL_SERVE_PATH = "/gmail-pubsub"; |
15 | 15 | export const DEFAULT_GMAIL_MAX_BYTES = 20_000; |
16 | 16 | export const DEFAULT_GMAIL_RENEW_MINUTES = 12 * 60; |
17 | | -export const DEFAULT_HOOKS_PATH = "/hooks"; |
| 17 | +const DEFAULT_HOOKS_PATH = "/hooks"; |
18 | 18 | const GMAIL_WATCH_SENSITIVE_FLAGS = new Set(["--token", "--hook-url", "--hook-token"]); |
19 | 19 | |
20 | 20 | export type GmailHookOverrides = { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ import { isPathInsideWithRealpath } from "../security/scan-paths.js";
|
13 | 13 | |
14 | 14 | const log = createSubsystemLogger("hooks"); |
15 | 15 | |
16 | | -export type PluginHookDirEntry = { |
| 16 | +type PluginHookDirEntry = { |
17 | 17 | dir: string; |
18 | 18 | pluginId: string; |
19 | 19 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,20 +4,20 @@ import type { HookEntry, HookSource } from "./types.js";
|
4 | 4 | |
5 | 5 | export type HookEnableStateReason = "disabled in config" | "workspace hook (disabled by default)"; |
6 | 6 | |
7 | | -export type HookEnableState = { |
| 7 | +type HookEnableState = { |
8 | 8 | enabled: boolean; |
9 | 9 | reason?: HookEnableStateReason; |
10 | 10 | }; |
11 | 11 | |
12 | | -export type HookSourcePolicy = { |
| 12 | +type HookSourcePolicy = { |
13 | 13 | precedence: number; |
14 | 14 | trustedLocalCode: boolean; |
15 | 15 | defaultEnableMode: "default-on" | "explicit-opt-in"; |
16 | 16 | canOverride: HookSource[]; |
17 | 17 | canBeOverriddenBy: HookSource[]; |
18 | 18 | }; |
19 | 19 | |
20 | | -export type HookResolutionCollision = { |
| 20 | +type HookResolutionCollision = { |
21 | 21 | name: string; |
22 | 22 | kept: HookEntry; |
23 | 23 | ignored: HookEntry; |
@@ -54,7 +54,7 @@ const HOOK_SOURCE_POLICIES: Record<HookSource, HookSourcePolicy> = {
|
54 | 54 | }, |
55 | 55 | }; |
56 | 56 | |
57 | | -export function getHookSourcePolicy(source: HookSource): HookSourcePolicy { |
| 57 | +function getHookSourcePolicy(source: HookSource): HookSourcePolicy { |
58 | 58 | return HOOK_SOURCE_POLICIES[source]; |
59 | 59 | } |
60 | 60 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -223,7 +223,7 @@ export function loadHookEntriesFromDir(params: {
|
223 | 223 | }); |
224 | 224 | } |
225 | 225 | |
226 | | -export function discoverWorkspaceHookEntries( |
| 226 | +function discoverWorkspaceHookEntries( |
227 | 227 | workspaceDir: string, |
228 | 228 | opts?: { |
229 | 229 | config?: OpenClawConfig; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。