import type { OrgDaemon } from './daemon.js'; import type { RunningOrg } from './daemon-types.js'; import { type RespawnInput, type RespawnReceipt, type RoleSlot, validateRespawnInput } from './role-slot.js'; import type { OrgDef } from './types.js'; /** What differs between the tools that replace a role's session: org_respawn_role * (crash recovery, counted by max_role_respawns) and org_compact_role / org_clear_role * (context resets, counted by their own per-role cap — role-reset.ts). */ export interface ReplaceMode { tool: string; /** Audit reasons are `role--started|cancelled|failed|rollback-failed`. */ kind: 'respawn' | 'reset'; validate: (raw: unknown) => ReturnType; cap: (def: OrgDef) => number; used: (slot: RoleSlot) => number; /** Add (or, with a negative delta, give back) attempts on the mode's own counter. */ bump: (slot: RoleSlot, delta: number) => void; limitError: (roleId: string, used: number, cap: number) => string; /** Runs after every synchronous check and before an attempt is consumed, holding the * role's replacement lock. Refuses with an error, or supplies the new session's briefing * (empty: none is sent). */ prepare?: (ctx: { daemon: OrgDaemon; running: RunningOrg; slot: RoleSlot; input: RespawnInput; callerId: string; }) => Promise<{ ok: true; briefing: string; } | { ok: false; error: string; }>; } export declare const RESPAWN_MODE: ReplaceMode; /** org_respawn_role's daemon-owned implementation. */ export declare function respawnRole(daemon: OrgDaemon, name: string, callerId: string, rawInput: unknown): Promise; /** The shared replacement algorithm. See the design doc's "Replacement * algorithm" (13 steps) — this function's body follows those steps in * order, numbered in comments. */ export declare function replaceRole(daemon: OrgDaemon, name: string, callerId: string, mode: ReplaceMode, rawInput: unknown): Promise; //# sourceMappingURL=role-respawn.d.ts.map