export declare const HOOK_EVENTS: readonly ["topic.new", "thread.reply", "outbound.send", "outbound.reply", "schedule.fired", "session.start", "session.exit", "session.idle", "session.requires_attention"]; export type HookEvent = typeof HOOK_EVENTS[number]; export type HookFilter = { chatId?: string | string[]; senderOpenId?: string | string[]; sender_open_id?: string | string[]; }; export type HookConfig = { event: HookEvent; command: string; timeoutMs?: number; filter?: HookFilter; redact?: { fullContentEvents?: HookEvent[]; }; }; export type HookPayload = Record & { event: HookEvent; chatId?: string; senderOpenId?: string; sender_open_id?: string; }; /** Frozen authority for a read-isolated post-provider hook. Every value comes * from the original protected claim/attestation; forwarding must not rediscover * a daemon or reread a rotating capability after the fence. */ export interface ManagedHookOrigin { ipcPort: number; sessionId: string; capability: string; turnId: string; dispatchAttempt?: number; } export interface EmitHookEventOptions { managedOrigin?: ManagedHookOrigin; } export type ParsedHookCommand = { file: string; args: string[]; }; export type HookRunResult = { ok: boolean; code?: number | null; signal?: NodeJS.Signals | null; timedOut?: boolean; error?: string; }; export declare function loadHookConfigs(opts?: { dataDir?: string; env?: Pick; }): HookConfig[]; export declare function prepareHookPayload(hook: HookConfig, rawPayload: HookPayload): HookPayload; export declare function parseHookCommand(command: string): ParsedHookCommand; export declare function filterMatches(filter: HookFilter | undefined, payload: HookPayload): boolean; export declare function emitHookEvent(event: HookEvent, body?: Record, options?: EmitHookEventOptions): void; /** * Daemon-side emit: always run hooks in-process, never forward. The * /api/hooks/emit handler MUST use this instead of emitHookEvent — re-entering * the CLI gate there means a daemon that accidentally carries session-scoped * env (e.g. `botmux restart` issued from inside a botmux session: pm2 * startOrRestart injects the caller's environment into the restarted daemon) * would POST every event back to itself in an infinite loop — one core pegged * and hundreds of self-connections on the IPC port, with nothing in the logs. */ export declare function emitHookEventLocal(event: HookEvent, body?: Record): void; export declare function runHookCommandForTest(hook: HookConfig, payload: HookPayload): Promise; /** * CLI-side: hand off hook emission to the daemon so timeout enforcement and * process-group cleanup work. Best-effort — daemon unreachable / 4xx / 5xx * just log and drop, hooks are best-effort by contract. */ export declare function forwardEmitToDaemon(event: HookEvent, payload: HookPayload, larkAppId: string, managedOrigin?: ManagedHookOrigin): Promise; //# sourceMappingURL=hook-runner.d.ts.map