/** * executeAction — main entrypoint for the deploy module (Sprint 20). * * Execution sequence: * 0. Validate action shape (inverse required) — throws BEFORE any I/O. * 1. Authoritative classification via classifyCommand() — overrides agent's self-declaration. * 2. Log proposed action to actions.jsonl for audit. * 3. If risky: gate via Tier 2 checkpoint (or auto-approve with warning if allowAutopilotRiskyActions). * 4. Write ChangeEntry with status='pending' BEFORE execution. * 5. Execute via injected seam. * 6. Write ChangeEntry with terminal status ('executed' | 'failed') AFTER execution. * * Critical invariants: * - ChangeEntry is ALWAYS written (even on crash) once execution starts. * - inverse.description is REQUIRED and validated up-front (Zod + explicit guard). * - The agent's self-declared classification is a HINT; classifyCommand() is authoritative. * - allowAutopilotRiskyActions=true skips interactive approval but NOT the audit trail. */ import { type ProposedAction, type ExecutorSeam } from "./types.js"; import { type RiskyActionConfig } from "./resolve.js"; export interface ExecuteActionDeps { /** Override for tests. Default = execa wrapper (defaultExecutor). */ executor?: ExecutorSeam; /** Override for tests to capture stderr warnings. Default = process.stderr.write. */ writeWarn?: (msg: string) => void; /** Override for tests — injectable clock. Default = () => new Date(). */ now?: () => Date; } export interface ExecuteActionResult { status: "executed" | "failed" | "aborted"; reason?: "checkpoint_rejected" | "precondition_failed" | "missing_inverse" | "postcondition_failed"; durationMs: number; error?: string; } /** * Execute a single proposed action under the deploy discipline. * * @param action - The proposed action (agent's self-classified). * @param incidentId - Incident ID for audit trail writes. * @param projectRoot - Root path for incident artifact writes. * @param config - Pipeline config (controls allowAutopilotRiskyActions + mechanism resolution). * @param deps - Optional injection overrides (executor, writeWarn, now). */ export declare function executeAction(action: ProposedAction, incidentId: string, projectRoot: string, config: RiskyActionConfig | undefined, deps?: ExecuteActionDeps): Promise; //# sourceMappingURL=execute.d.ts.map