Skip to content
Français

AgentHookHandler

  • onRequired
    string
    Native event name; determines the event payload and permitted response.
  • nameRequired
    string
    Optional diagnostic name; defaults to the native event name.
  • timeoutMsRequired
    number
    Positive callback or command deadline in milliseconds; defaults to 30000, at most 600000. Native event time limits still apply.
  • commandOptional
    HookCommand | undefined
    Executable invoked inside the sandbox with native JSON on stdin. Stdout, stderr and exit status retain the CLI’s native meaning. Mutually exclusive with run.
  • matcherOptional
    string | undefined
    Native matcher, interpreted by the selected CLI. Omit it to receive every occurrence supported by that event.
  • runRequired
    (event: unknown, context: AgentHookContext) => Promise<string>
    Host callback receiving the native event, a borrowed sandbox and cancellation signal. Return nothing to preserve native behavior; return only decisions supported by this event. Mutually exclusive with command.
export interface AgentHookHandler {
  readonly on: string;
  readonly name: string;
  readonly timeoutMs: number;
  readonly command?: HookCommand;
  readonly matcher?: string;
  run(event: unknown, context: AgentHookContext): Promise<string>;
}