/** * OpenClaw Gateway Integration Types * * Defines types for the OpenClaw gateway waker system. * Each hook event can be mapped to a gateway with a pre-defined instruction. */ /** Hook events that can trigger OpenClaw gateway calls */ export type OpenClawHookEvent = "session-start" | "session-end" | "pre-tool-use" | "post-tool-use" | "stop" | "keyword-detector" | "ask-user-question"; /** HTTP gateway configuration (default when type is absent or "http") */ export interface OpenClawHttpGatewayConfig { /** Gateway type discriminator (optional for backward compat) */ type?: "http"; /** Gateway endpoint URL (HTTPS required, HTTP allowed for localhost) */ url: string; /** Optional custom headers (e.g., Authorization) */ headers?: Record; /** HTTP method (default: POST) */ method?: "POST" | "PUT"; /** Per-request timeout in ms (default: 10000) */ timeout?: number; } /** CLI command gateway configuration */ export interface OpenClawCommandGatewayConfig { /** Gateway type discriminator */ type: "command"; /** Command template with {{variable}} placeholders. * Variables are shell-escaped automatically before interpolation. */ command: string; /** Per-command timeout in ms (default: 10000) */ timeout?: number; } /** Gateway configuration — HTTP or CLI command */ export type OpenClawGatewayConfig = OpenClawHttpGatewayConfig | OpenClawCommandGatewayConfig; /** Per-hook-event mapping to a gateway + instruction */ export interface OpenClawHookMapping { /** Name of the gateway (key in gateways object) */ gateway: string; /** Instruction template with {{variable}} placeholders */ instruction: string; /** Whether this hook-event mapping is active */ enabled: boolean; } /** Top-level config schema for omc_config.openclaw.json */ export interface OpenClawConfig { /** Global enable/disable */ enabled: boolean; /** Named gateway endpoints */ gateways: Record; /** Hook-event to gateway+instruction mappings */ hooks: Partial>; } /** Normalized signal kinds for downstream routing */ export type OpenClawSignalKind = "session" | "tool" | "test" | "pull-request" | "question" | "keyword"; /** Supported lifecycle phases for normalized signals */ export type OpenClawSignalPhase = "started" | "finished" | "failed" | "idle" | "detected" | "requested"; /** Relative priority for downstream routing */ export type OpenClawSignalPriority = "high" | "low"; /** Canonical normalized signal routed alongside the raw hook event */ export interface OpenClawSignal { /** Routing family */ kind: OpenClawSignalKind; /** Stable logical signal name */ name: string; /** Lifecycle phase */ phase: OpenClawSignalPhase; /** Canonical route key for native/HTTP consumers */ routeKey: string; /** High-priority signals are lifecycle/test/PR/question events */ priority: OpenClawSignalPriority; /** Tool name when relevant */ toolName?: string; /** Safe command string when routing depends on the invoked Bash command */ command?: string; /** Normalized test runner when the signal represents a test command */ testRunner?: string; /** PR URL extracted from gh pr create output */ prUrl?: string; /** Short summary for routing/debugging */ summary?: string; } /** Payload sent to an OpenClaw gateway */ export interface OpenClawPayload { /** The hook event that triggered this call */ event: OpenClawHookEvent; /** Interpolated instruction text */ instruction: string; /** ISO timestamp */ timestamp: string; /** Session identifier (if available) */ sessionId?: string; /** Project directory path */ projectPath?: string; /** Project basename */ projectName?: string; /** Tmux session name (if running inside tmux) */ tmuxSession?: string; /** Recent tmux pane output (for stop/session-end events) */ tmuxTail?: string; /** Reply channel name (from OPENCLAW_REPLY_CHANNEL env var) */ channel?: string; /** Reply target (user/bot) from OPENCLAW_REPLY_TARGET env var */ to?: string; /** Reply thread ID from OPENCLAW_REPLY_THREAD env var */ threadId?: string; /** Normalized routing signal derived from the raw hook event */ signal: OpenClawSignal; /** Context data from the hook (whitelisted fields only) */ context: OpenClawContext; } /** * Context data passed from the hook to OpenClaw for template interpolation. * * All fields are explicitly enumerated (no index signature) to prevent * accidental leakage of sensitive data into gateway payloads. */ export interface OpenClawContext { sessionId?: string; projectPath?: string; tmuxSession?: string; toolName?: string; /** Internal-only raw tool input used to derive normalized signals; never forwarded in payload.context */ toolInput?: unknown; /** Internal-only raw tool output used to derive normalized signals; never forwarded in payload.context */ toolOutput?: unknown; prompt?: string; contextSummary?: string; reason?: string; question?: string; /** Recent tmux pane output (captured automatically for stop/session-end events) */ tmuxTail?: string; /** Reply channel name from OPENCLAW_REPLY_CHANNEL env var */ replyChannel?: string; /** Reply target (user/bot) from OPENCLAW_REPLY_TARGET env var */ replyTarget?: string; /** Reply thread ID from OPENCLAW_REPLY_THREAD env var */ replyThread?: string; } /** Result of a gateway wake attempt */ export interface OpenClawResult { /** Gateway name */ gateway: string; /** Whether the call succeeded */ success: boolean; /** Error message if failed */ error?: string; /** HTTP status code if available */ statusCode?: number; } //# sourceMappingURL=types.d.ts.map