UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

34 lines (33 loc) • 1.25 kB
import { n as resolveHookEnableState, t as resolveHookConfig } from "./policy-9WWlcycM.mjs"; import { n as hasBinary, r as isConfigPathTruthyWithDefaults, t as evaluateRuntimeEligibility } from "./config-eval-nIkprN5m.mjs"; //#region src/hooks/config.ts const DEFAULT_CONFIG_VALUES = { "browser.enabled": true, "browser.evaluateEnabled": true, "workspace.dir": true }; /** Evaluate a config path with hook-specific defaults for legacy runtime requirements. */ function isHookConfigPathTruthy(e, t) { return isConfigPathTruthyWithDefaults(e, t, DEFAULT_CONFIG_VALUES); } function isHookEnvSatisfied(e, t) { return Boolean(process.env[e]?.trim() || t?.env?.[e]?.trim()); } function shouldIncludeHook(e) { const { entry: t, config: n } = e; const r = resolveHookConfig(n, t.metadata?.hookKey ?? t.hook.name); if (!resolveHookEnableState({ entry: t, hookConfig: r }).enabled) return false; return evaluateRuntimeEligibility({ os: t.metadata?.os, always: t.metadata?.always, requires: t.metadata?.requires, hasBin: hasBinary, hasEnv: (e) => isHookEnvSatisfied(e, r), isConfigPathTruthy: (e) => isHookConfigPathTruthy(n, e) }); } //#endregion export { isHookEnvSatisfied as n, shouldIncludeHook as r, isHookConfigPathTruthy as t };