import { type AttemptBrokerInstance, type ControllerCutBinding, type ControllerRole, type ControllerStartedMember, type JsonValue, type MaintenanceJournal, type MaintenanceLock, type ServiceAdapterAttempt } from "@cotal-ai/workspace"; import { type StackJournal } from "./stack-journal.js"; /** Stack and maintenance journal coupling, checked on every read under the maintenance lock. Before * an attempt the stack journal records the cut's own operation. An attempt's operation is the one * its maintenance journal names: a crash between the two writes leaves the completed preserve * recorded, and only that is advanced to the attempt's operation. */ export declare function assertControllerCoupling(root: string, cut: ControllerCutBinding, server: string, sourcePath: string, attempt?: { stackOperationId: string; attemptId: string; }): StackJournal; /** Eligibility for the start of a resume or restore: every cut member is still the * stopped record at its cut launch request, its process gone, its receipt equal to the journal row, * and its saved definition at the expected revision. */ export declare function assertControllerResumeEligible(space: string, cut: ControllerCutBinding, stops: readonly { role: ControllerRole; receipt: { requestId: string; }; }[], expectedBrokerRevision: string): void; /** The controller binding a new resume or restore journals: a fresh stack operation, no starts. */ export declare function newControllerAttemptLaunch(): { custody: "controller"; controller: { stackOperationId: string; started: []; }; }; /** Journal the controller resume intent. The attempt's launch carries only journal-derived values. * The stack journal follows through {@link assertControllerCoupling}. */ export declare function beginControllerResume(lock: MaintenanceLock, attemptId: string, launch: { server: string; storeDir: string; maxFileStore?: number; runtime: string; detached: boolean; serverName: string; serverNonce: string; acceptedStaleCheckpoints?: JsonValue; }): void; export interface ControllerAttempt { record: MaintenanceJournal; cut: ControllerCutBinding; started: readonly ControllerStartedMember[]; attemptId: string; stackOperationId: string; /** A restore, as opposed to an ordinary resume. */ restore: boolean; /** The manager committed this attempt; only the manager may be relaunched from here. */ committed: boolean; /** The cut's broker record is retired, so this attempt's broker is a new instance. */ brokerRequired: boolean; /** That new instance, once journaled. */ broker?: AttemptBrokerInstance; } /** The current journal's resume or restore binding, re-read under the lock. */ export declare function currentControllerAttempt(root: string): ControllerAttempt; /** Start or adopt one member by its start decision, before manager commitment. Returns its * live launch request. */ export declare function startControllerMember(lock: MaintenanceLock, root: string, space: string, role: ControllerRole, attempt?: ServiceAdapterAttempt): Promise; /** Resume every non-manager member in order; the manager follows the broker's listener proof. */ export declare function startControllerMembers(lock: MaintenanceLock, root: string, space: string, serverName: string): Promise; /** The manager's attempt before commitment. It carries no commit token. */ export declare function managerResumeAttempt(root: string): ServiceAdapterAttempt; /** Bind the broker's controller listener proof. A resume names its started row; a * restore names the cut's broker instance at its new launch request, whose row this attempt also * journaled. The instance record must be running at that launch request with that process. */ export declare function bindControllerBroker(lock: MaintenanceLock, root: string, space: string, launch: { server: string; serverName: string; serverNonce: string; }): void; /** After manager commitment: a live manager of this attempt is kept. One whose newest start row * ran, at that launch request, whose exact process is proven gone with its own stop receipt, is * relaunched once with the journal's commit token as a protected file, the row journaled before * the start. Anything else holds. */ export declare function relaunchCommittedManager(lock: MaintenanceLock, root: string, space: string): Promise; /** Every cut member, or every one but `except`, must be live at the launch this attempt recorded. */ export declare function assertControllerMembersLive(root: string, space: string, except?: ControllerRole): void; /** The live broker instance and process of this attempt, read before activation: the stack journal * names it once the attempt settles, and a restore receipt reports its process. */ export declare function controllerAttemptBrokerInstance(root: string, space: string): { instanceId: string; pid: number; }; /** Settle the stack journal's resume or restore operation. A completed attempt that started a new * broker instance records it as the stack's broker, so the next preserve cuts that instance, and a * completed restore records its target as the stack's store. */ export declare function settleControllerResume(root: string, phase: StackJournal["operation"]["phase"], completed?: { brokerInstanceId?: string; storeDir?: string; }): void; //# sourceMappingURL=controller-resume.d.ts.map