From 236bd42bb36c54db2c3b1d4a54d78654d8aaaa66 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 22:48:21 +0100 Subject: [PATCH] refactor: trim gateway hook exports --- src/gateway/hooks-mapping.ts | 10 +++++----- src/gateway/hooks.ts | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gateway/hooks-mapping.ts b/src/gateway/hooks-mapping.ts index a7647bd94c7..2e1ddafa18a 100644 --- a/src/gateway/hooks-mapping.ts +++ b/src/gateway/hooks-mapping.ts @@ -27,19 +27,19 @@ export type HookMappingResolved = { transform?: HookMappingTransformResolved; }; -export type HookMappingTransformResolved = { +type HookMappingTransformResolved = { modulePath: string; exportName?: string; }; -export type HookMappingContext = { +type HookMappingContext = { payload: Record; headers: Record; url: URL; path: string; }; -export type HookAction = +type HookAction = | { kind: "wake"; text: string; @@ -62,9 +62,9 @@ export type HookAction = timeoutSeconds?: number; }; -export type HookSessionKeyTemplateSource = "static" | "templated"; +type HookSessionKeyTemplateSource = "static" | "templated"; -export type HookMappingResult = +type HookMappingResult = | { ok: true; action: HookAction } | { ok: true; action: null; skipped: true } | { ok: false; error: string }; diff --git a/src/gateway/hooks.ts b/src/gateway/hooks.ts index ad49191dd63..fc226e50c61 100644 --- a/src/gateway/hooks.ts +++ b/src/gateway/hooks.ts @@ -32,19 +32,19 @@ export type HooksConfigResolved = { sessionPolicy: HookSessionPolicyResolved; }; -export type HookAgentPolicyResolved = { +type HookAgentPolicyResolved = { defaultAgentId: string; knownAgentIds: Set; allowedAgentIds?: Set; }; -export type HookSessionPolicyResolved = { +type HookSessionPolicyResolved = { defaultSessionKey?: string; allowRequestSessionKey: boolean; allowedSessionKeyPrefixes?: string[]; }; -export type HookSessionKeySource = "request" | "mapping-static" | "mapping-templated"; +type HookSessionKeySource = "request" | "mapping-static" | "mapping-templated"; export function resolveHooksConfig(cfg: OpenClawConfig): HooksConfigResolved | null { if (cfg.hooks?.enabled !== true) { @@ -210,7 +210,7 @@ export function normalizeWakePayload( return { ok: true, value: { text: normalizedText, mode } }; } -export type HookAgentPayload = { +type HookAgentPayload = { message: string; name: string; agentId?: string; @@ -312,7 +312,7 @@ export function isHookAgentAllowed( } export const getHookAgentPolicyError = () => "agentId is not allowed by hooks.allowedAgentIds"; -export const getHookSessionKeyRequestPolicyError = () => +const getHookSessionKeyRequestPolicyError = () => "sessionKey is disabled for externally supplied hook payload values; set hooks.allowRequestSessionKey=true to enable"; export const getHookSessionKeyPrefixError = (prefixes: string[]) => `sessionKey must start with one of: ${prefixes.join(", ")}`;