export interface ProcessIdentity { readonly pid: number; readonly processStartIdentity: string; readonly bootIdentity: string | null; readonly executable: string; readonly hostname: string; } export type ProcessInspection = { readonly kind: "live"; readonly identity: ProcessIdentity; } | { readonly kind: "absent"; } | { readonly kind: "unknown"; readonly diagnostic: string; }; export interface ProcessIdentityInspector { current(): Promise; inspect(pid: number): Promise; } export interface WorkflowLeaseOwnerV1 { readonly schema: 1; readonly kind: "supervisor" | "worker-session"; readonly stage: "active" | "reserved"; readonly generation: string; readonly workspaceId: string; readonly resourceId: string; readonly runId: string | null; readonly workerId: string | null; readonly attemptId: string | null; readonly workerAttemptGeneration: string | null; readonly supervisorGeneration: string | null; readonly sessionPath: string | null; readonly pid: number; readonly processStartIdentity: string; readonly bootIdentity: string | null; readonly executable: string; readonly hostname: string; readonly createdAt: string; } export interface WorkflowLeaseManagerOptions { readonly namespaceDirectory: string; readonly workspaceId: string; readonly inspector: ProcessIdentityInspector; readonly randomUUID?: () => string; readonly now?: () => Date; readonly guardWaitMs?: number; } export interface AcquireWorkerSessionInput { readonly sessionPath: string; readonly runId: string; readonly workerId: string; readonly attemptId: string; readonly workerAttemptGeneration: string; readonly supervisorGeneration: string; readonly processIdentity: ProcessIdentity; } export type WorkflowLeaseRefusalReason = "remote-owner" | "unverifiable-owner" | "corrupt-owner" | "lifecycle-busy" | "lifecycle-unverifiable"; export type WorkflowLeaseAcquireResult = { readonly kind: "acquired"; readonly owner: WorkflowLeaseOwnerV1; readonly reclaimed?: { readonly owner: WorkflowLeaseOwnerV1; readonly quarantinePath: string; }; } | { readonly kind: "held"; readonly owner: WorkflowLeaseOwnerV1; } | { readonly kind: "refused"; readonly reason: WorkflowLeaseRefusalReason; readonly diagnostic: string; }; export type WorkflowLeaseReleaseResult = { readonly kind: "released"; } | { readonly kind: "not-owner"; readonly owner?: WorkflowLeaseOwnerV1; } | { readonly kind: "refused"; readonly diagnostic: string; }; export type WorkflowLeaseProjection = { readonly kind: "empty"; } | { readonly kind: "owned"; readonly owner: WorkflowLeaseOwnerV1; } | { readonly kind: "corrupt"; readonly diagnostic: string; }; export interface WorkerSessionLeaseDiagnostic { readonly resourceId: string; readonly path: string; readonly projection: WorkflowLeaseProjection; } export declare class WorkflowLeaseFenceError extends Error { constructor(message: string); } export declare class WorkflowLeaseManager { #private; constructor(options: WorkflowLeaseManagerOptions); acquireSupervisor(): Promise; releaseSupervisor(generation: string): Promise; withCurrentSupervisor(generation: string, operation: () => Promise): Promise; inspectSupervisor(): Promise; acquireWorkerSession(input: AcquireWorkerSessionInput): Promise; reserveWorkerSession(input: Omit): Promise; activateWorkerSession(input: { readonly sessionPath: string; readonly generation: string; readonly supervisorGeneration: string; readonly workerAttemptGeneration: string; readonly processIdentity: ProcessIdentity; }): Promise; releaseWorkerSession(input: { readonly sessionPath: string; readonly generation: string; readonly supervisorGeneration: string; }): Promise; inspectWorkerSession(sessionPath: string): Promise; diagnoseWorkerSessionLeases(): Promise; } export declare function parseWorkflowLeaseOwnerV1(value: unknown): WorkflowLeaseOwnerV1; //# sourceMappingURL=workflow-lease.d.ts.map