/** * Action execution extracted from runtime.ts. * * The original runtime ran a long `if ("command" in action) ... if ("tool" * in action) ...` cascade. This module preserves the exact per-action * behaviour but routes dispatch through a Record-keyed table indexed by * the discriminator key on `HookAction`. Adding a new action variant now * means adding one entry to `ACTION_HANDLERS` and one branch to * `getActionType`/`getActionDetails`. * * Every handler returns a `HookExecutionResult`. Only `confirm` can * surface `blocked: true`; the rest swallow handler errors to avoid * pinning the dispatch loop on a misconfigured action. */ import type { AsyncLocalStorage } from "node:async_hooks"; import type { HookExecutionResult, RuntimeActionContext } from "../runtime.js"; import { type SessionStateStore } from "../session-state.js"; import type { BashExecutionRequest, BashHookResult } from "../bash-types.js"; import type { HookAction, HookEvent, HookRunIn, HostAdapter, HostDeliveryResult } from "../types.js"; type ExecuteBashHook = (request: BashExecutionRequest) => Promise; export declare function executeAction(action: HookAction, runIn: HookRunIn, host: HostAdapter, projectDir: string, state: SessionStateStore, runBashHook: ExecuteBashHook, event: HookEvent, sessionID: string, context: RuntimeActionContext, sourceFilePath: string, hookId: string, actionRecursionGuards: AsyncLocalStorage>): Promise; export declare function resolveActionSessionID(state: SessionStateStore, host: HostAdapter, sessionID: string, runIn: HookRunIn): Promise; export declare function resolveParentSessionID(host: HostAdapter, sessionID: string): Promise; export declare function getActionType(action: HookAction): string; export declare function getActionDetails(action: HookAction): Record; export declare function getStatusSlotKey(hookId: string, _sourceFilePath: string): string; export declare function logHookFailure(event: HookEvent, filePath: string, error: unknown): void; export declare function normalizeHostDeliveryResult(result: void | HostDeliveryResult | undefined): HostDeliveryResult; export declare function isHostDiedError(error: unknown): boolean; export declare function abortSession(host: HostAdapter, sessionID: string): Promise; export {};