import type { AgentMessage } from './agent-runner.js'; import type { OrgBus } from './bus.js'; /** A Bash result that is bubblewrap's own error, not the command's: the OS * sandbox failed to start (2.16.0 release run: 31 of these, and a QA role * that silently lost Bash for ~7 minutes). A new runner process builds a new * sandbox, so ending the process is the recovery. Only a setup failure that * is the whole result counts — after the tool's own "Exit code N" line — so * a command that runs bwrap itself and prints its errors among other output * (2.16.2 release run: "bwrap: : No such file or directory" in a reaper * repro) is the command's output, not a fault. */ export declare function isSandboxFault(m: Pick): boolean; /** #331: a tool result that is the runner's tool-permission channel failing, * not the tool: the CLI could not ask the SDK host whether the call may run, * because the stdio stream it asks over is closed. Every later org tool, * Read, and Bash call that needs a decision fails the same way, while Bash * allowed by a static rule keeps working (2.16.1 release run). The stream * never reopens in that process, so ending it is the recovery. */ export declare function isChannelFault(m: Pick): boolean; export type ProcessFault = 'sandbox' | 'channel'; /** Consecutive faulted Bash results in one process before it is ended. */ export declare const SANDBOX_FAULTS_BEFORE_RESTART = 2; /** Process restarts per task session and fault kind before the coordinator * is told instead. */ export declare const MAX_SANDBOX_RESTARTS = 2; /** Thrown out of the session's message loop to end the runner process. */ export declare class ProcessFaultError extends Error { readonly sessionId: string | undefined; readonly kind: ProcessFault; constructor(sessionId: string | undefined, kind?: ProcessFault); } interface Surface { bus: OrgBus; roleId: string; /** Who hears about it once restarts are spent (the role's reports_to). */ coordinator?: string; deliver: (from: string, to: string, subject: string, body: string) => Promise; } /** Per role session loop: counts restarts per session key (task) and kind. */ export declare class FaultRestarts { private readonly s; private used; private surfaced; constructor(s: Surface); /** One runner process's watcher for `key`. */ watch(key: string): { observe(m: AgentMessage, sessionId: string | undefined): void; }; /** Called once the process is gone: records the restart and returns the * message the restarted session opens with. */ restarted(key: string, kind?: ProcessFault): string; private surface; } export {}; //# sourceMappingURL=sandbox-fault.d.ts.map