/** * Canonical lifecycle vocabulary for harness plugins. * * Each harness exposes a different set of hook event names (Claude Code's * `PreToolUse`, Gemini's `BeforeTool`, OpenCode's `tool.execute.before`, * …). Mapping them onto a shared phase set lets the plugin code reason * about *what is happening* without first remembering *which harness * we're in*. Activity logs, docs, and tests all reference the same set of * phases. * * Phases split into three buckets: * * - **Session / agent lifecycle.** `session.start`, `session.stop`, * `compaction`. The session begins or ends, or the harness compacts * context. Plugins authenticate here (start) and may flush state * (stop). * * - **User-facing interactions.** `user.prompt`, `user.interaction`, * `permission.ask`. The harness is communicating with the human: * they typed a prompt, the harness is surfacing a confirmation, * the harness is asking whether to allow a tool. These are *logged* * but never gated by a tool permission check — the user is the * final decision-maker. (`permission.ask` does consult Ory to * inform the harness's UI, but the call is advisory.) * * - **Tool execution.** `tool.before`, `tool.after`, `tool.failure`, * `subagent.start`, `subagent.stop`. The agent is reaching into an * external system (or spawning a child agent that will). These are * the only phases that run a true `use` permission gate. * * `passthrough` is the explicit "nothing to do here" bucket — the * harness fired an event we don't model, and we record an audit event * and return. */ export type LifecyclePhase = "session.start" | "session.stop" | "user.prompt" | "user.interaction" | "permission.ask" | "tool.before" | "tool.after" | "tool.failure" | "subagent.start" | "subagent.stop" | "compaction" | "passthrough"; /** * Per-harness map from the harness's native event name to a canonical * {@link LifecyclePhase}. Event names that don't appear here resolve to * `passthrough` via {@link classifyLifecycle}. */ export declare const HARNESS_LIFECYCLE_MAP: Record>; /** * Resolve a harness event name to its canonical {@link LifecyclePhase}. * Unknown harnesses or unknown event names both yield `passthrough`. */ export declare function classifyLifecycle(harness: string, event: string): LifecyclePhase; /** * Phases that surface to the human (prompts, confirmations, notifications, * advisory permission asks). Tool-call permission gates must never fire * on these — the user is the decision-maker. */ export declare const USER_FACING_PHASES: ReadonlySet; /** * Phases that represent actual tool execution against external systems. * Only these run a real `use` permission check. */ export declare const TOOL_EXECUTION_PHASES: ReadonlySet; export declare function isUserFacingPhase(phase: LifecyclePhase): boolean; export declare function isToolExecutionPhase(phase: LifecyclePhase): boolean;