mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:10:43 +00:00
refactor: trim hooks local exports
This commit is contained in:
@@ -3,8 +3,6 @@ import {
|
||||
evaluateRuntimeEligibility,
|
||||
hasBinary,
|
||||
isConfigPathTruthyWithDefaults,
|
||||
resolveConfigPath,
|
||||
resolveRuntimePlatform,
|
||||
} from "../shared/config-eval.js";
|
||||
import { resolveHookConfig, resolveHookEnableState } from "./policy.js";
|
||||
import type { HookEligibilityContext, HookEntry } from "./types.js";
|
||||
@@ -15,7 +13,7 @@ const DEFAULT_CONFIG_VALUES: Record<string, boolean> = {
|
||||
"workspace.dir": true,
|
||||
};
|
||||
|
||||
export { hasBinary, resolveConfigPath, resolveRuntimePlatform };
|
||||
export { hasBinary };
|
||||
|
||||
export function isConfigPathTruthy(config: OpenClawConfig | undefined, pathStr: string): boolean {
|
||||
return isConfigPathTruthyWithDefaults(config, pathStr, DEFAULT_CONFIG_VALUES);
|
||||
|
||||
@@ -14,7 +14,7 @@ export const DEFAULT_GMAIL_SERVE_PORT = 8788;
|
||||
export const DEFAULT_GMAIL_SERVE_PATH = "/gmail-pubsub";
|
||||
export const DEFAULT_GMAIL_MAX_BYTES = 20_000;
|
||||
export const DEFAULT_GMAIL_RENEW_MINUTES = 12 * 60;
|
||||
export const DEFAULT_HOOKS_PATH = "/hooks";
|
||||
const DEFAULT_HOOKS_PATH = "/hooks";
|
||||
const GMAIL_WATCH_SENSITIVE_FLAGS = new Set(["--token", "--hook-url", "--hook-token"]);
|
||||
|
||||
export type GmailHookOverrides = {
|
||||
|
||||
@@ -13,7 +13,7 @@ import { isPathInsideWithRealpath } from "../security/scan-paths.js";
|
||||
|
||||
const log = createSubsystemLogger("hooks");
|
||||
|
||||
export type PluginHookDirEntry = {
|
||||
type PluginHookDirEntry = {
|
||||
dir: string;
|
||||
pluginId: string;
|
||||
};
|
||||
|
||||
@@ -4,12 +4,12 @@ import type { HookEntry, HookSource } from "./types.js";
|
||||
|
||||
export type HookEnableStateReason = "disabled in config" | "workspace hook (disabled by default)";
|
||||
|
||||
export type HookEnableState = {
|
||||
type HookEnableState = {
|
||||
enabled: boolean;
|
||||
reason?: HookEnableStateReason;
|
||||
};
|
||||
|
||||
export type HookSourcePolicy = {
|
||||
type HookSourcePolicy = {
|
||||
precedence: number;
|
||||
trustedLocalCode: boolean;
|
||||
defaultEnableMode: "default-on" | "explicit-opt-in";
|
||||
@@ -17,7 +17,7 @@ export type HookSourcePolicy = {
|
||||
canBeOverriddenBy: HookSource[];
|
||||
};
|
||||
|
||||
export type HookResolutionCollision = {
|
||||
type HookResolutionCollision = {
|
||||
name: string;
|
||||
kept: HookEntry;
|
||||
ignored: HookEntry;
|
||||
@@ -54,7 +54,7 @@ const HOOK_SOURCE_POLICIES: Record<HookSource, HookSourcePolicy> = {
|
||||
},
|
||||
};
|
||||
|
||||
export function getHookSourcePolicy(source: HookSource): HookSourcePolicy {
|
||||
function getHookSourcePolicy(source: HookSource): HookSourcePolicy {
|
||||
return HOOK_SOURCE_POLICIES[source];
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ export function loadHookEntriesFromDir(params: {
|
||||
});
|
||||
}
|
||||
|
||||
export function discoverWorkspaceHookEntries(
|
||||
function discoverWorkspaceHookEntries(
|
||||
workspaceDir: string,
|
||||
opts?: {
|
||||
config?: OpenClawConfig;
|
||||
|
||||
Reference in New Issue
Block a user