@cotal-ai/workspace 0.11.6 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,506 @@
1
+ /** Version 1 lives in `<project>/.cotal/maintenance/v1`; the lock is shared across versions. */
2
+ export declare const MAINTENANCE_JOURNAL_VERSION: 1;
3
+ export declare const MAINTENANCE_RESUME_DOCUMENT_VERSION: 1;
4
+ export declare const MAX_MAINTENANCE_RESUME_BYTES: number;
5
+ export type MaintenanceAuthMode = "auth" | "open" | "user";
6
+ export type OwnerStatus = "alive" | "dead" | "unknown";
7
+ export interface StoreIdentity {
8
+ readonly path: string;
9
+ /** Decimal strings preserve the full `bigint` values returned by `stat`. */
10
+ readonly dev: string;
11
+ readonly ino: string;
12
+ /** Random marker persisted inside the store, so inode reuse cannot impersonate the old store. */
13
+ readonly generation: string;
14
+ }
15
+ export interface ProcessOwner {
16
+ readonly pid: number;
17
+ readonly host: string;
18
+ readonly startedAt: string;
19
+ readonly id: string;
20
+ }
21
+ export interface MaintenanceRecourse {
22
+ readonly action: "retry" | "inspect" | "rollback" | "repair" | "cleanup";
23
+ readonly description: string;
24
+ readonly command?: string;
25
+ readonly paths?: readonly string[];
26
+ }
27
+ export type MaintenanceErrorCode = "invalid-path" | "path-exists" | "path-missing" | "identity-mismatch" | "ambiguous-filesystem-state" | "journal-missing" | "journal-corrupt" | "journal-version" | "invalid-transition" | "lock-held" | "lock-owner-ambiguous" | "lock-lost" | "claim-live" | "claim-owner-ambiguous" | "claim-not-expired" | "cleanup-incomplete" | "rollback-forbidden" | "cleanup-forbidden" | "cleanup-complete" | "resume-missing" | "resume-mismatch" | "resume-invalid" | "resume-too-large" | "listener-proof-invalid" | "listener-proof-missing" | "listener-proof-mismatch" | "listener-owner-alive" | "listener-owner-dead" | "listener-owner-ambiguous" | "activation-evidence-invalid";
28
+ export interface MaintenanceErrorDetails {
29
+ readonly root?: string;
30
+ readonly attemptId?: string;
31
+ readonly paths?: readonly string[];
32
+ readonly expected?: StoreIdentity;
33
+ readonly actual?: StoreIdentity;
34
+ readonly recourse: readonly MaintenanceRecourse[];
35
+ }
36
+ /** Stable code and structured recourse are the consumer contract; `message` is diagnostic text. */
37
+ export declare class MaintenanceError extends Error {
38
+ readonly brand = "cotal:workspace:maintenance-error";
39
+ readonly code: MaintenanceErrorCode;
40
+ readonly details: MaintenanceErrorDetails;
41
+ constructor(code: MaintenanceErrorCode, message: string, details: MaintenanceErrorDetails);
42
+ }
43
+ export declare function isMaintenanceError(error: unknown): error is MaintenanceError;
44
+ interface JournalBase {
45
+ readonly version: typeof MAINTENANCE_JOURNAL_VERSION;
46
+ readonly revision: number;
47
+ readonly updatedAt: string;
48
+ readonly space: string;
49
+ readonly mode: MaintenanceAuthMode;
50
+ readonly source: StoreIdentity;
51
+ readonly resume: MaintenanceResumeDescriptor;
52
+ readonly cut: MaintenanceCutContext;
53
+ }
54
+ interface CompletedJournalBase extends JournalBase {
55
+ readonly cutCompletion: MaintenanceCutCompletionEvidence;
56
+ }
57
+ export interface MaintenanceCutContext {
58
+ readonly attemptId: string;
59
+ readonly intentAt: string;
60
+ readonly launch: {
61
+ readonly server: string;
62
+ readonly [key: string]: JsonValue;
63
+ };
64
+ }
65
+ export interface MaintenanceCutCompletionEvidence {
66
+ readonly attemptId: string;
67
+ readonly observedAt: string;
68
+ readonly managerCommit: {
69
+ readonly operation: "commitPreservation";
70
+ readonly attemptId: string;
71
+ readonly state: "preserved";
72
+ };
73
+ readonly stopped: {
74
+ readonly manager: true;
75
+ readonly broker: true;
76
+ readonly localProcesses: true;
77
+ };
78
+ readonly listener: {
79
+ readonly endpoint: string;
80
+ readonly unreachable: true;
81
+ };
82
+ }
83
+ export interface MaintenanceCutIntentRecord extends JournalBase {
84
+ readonly state: "cut-intent";
85
+ }
86
+ /** Durable proof the manager committed preservation, written BEFORE any process stop so a crash
87
+ * between manager commit and the final ready promotion recovers without a live manager. */
88
+ export interface MaintenanceCutCommittedRecord extends JournalBase {
89
+ readonly state: "cut-committed";
90
+ readonly managerCommittedAt: string;
91
+ readonly managerCommit: MaintenanceCutCompletionEvidence["managerCommit"];
92
+ }
93
+ export interface MaintenanceReadyRecord extends CompletedJournalBase {
94
+ readonly state: "ready";
95
+ }
96
+ /** One filesystem tree or file owned by a single maintenance attempt. A slot journaled BEFORE the
97
+ * path is created carries no inode ("pending"); it is upgraded with the exact dev/ino immediately
98
+ * after creation, so recovery can never delete a replacement. */
99
+ export interface AttemptOwnedPath {
100
+ readonly label: "clone" | "destination" | "staging" | "quarantine" | "sanitized" | "config";
101
+ readonly path: string;
102
+ readonly dev?: string;
103
+ readonly ino?: string;
104
+ }
105
+ export interface MaintenanceClaim {
106
+ readonly attemptId: string;
107
+ readonly deadline: string;
108
+ readonly coordinator: ProcessOwner;
109
+ readonly owners: readonly ProcessOwner[];
110
+ readonly ownedPaths?: readonly AttemptOwnedPath[];
111
+ }
112
+ /** Liveness claim covering the whole pre-commit restore window. Concurrent commands refuse while
113
+ * it is live; recovery requires the deadline elapsed and every recorded owner proven dead. */
114
+ export interface RestoreClaim {
115
+ readonly deadline: string;
116
+ readonly coordinator: ProcessOwner;
117
+ readonly owners: readonly ProcessOwner[];
118
+ }
119
+ export type RestoreClaimAssessment = "live" | "stale" | "ambiguous";
120
+ export interface MaintenanceClaimedRecord extends CompletedJournalBase {
121
+ readonly state: "claimed";
122
+ readonly claim: MaintenanceClaim;
123
+ }
124
+ export type RestorePhase = "move-pending" | "source-moved" | "source-retained" | "disaster-source-missing";
125
+ export interface PreviousSource {
126
+ /** A fallback is a renamed source; retained means an alternate-target restore left it in place. */
127
+ readonly kind: "fallback" | "retained";
128
+ readonly identity: StoreIdentity;
129
+ }
130
+ export interface CleanupProgress {
131
+ /** Only `attempt-target` is attempt-owned. `previous-source` requires the explicit cleanup API. */
132
+ readonly kind: "attempt-target" | "previous-source";
133
+ readonly status: "pending" | "complete";
134
+ readonly originalPath: string;
135
+ readonly tombPath: string;
136
+ readonly identity: StoreIdentity;
137
+ }
138
+ export interface RestoreContext {
139
+ readonly attemptId: string;
140
+ readonly method: "same-path" | "alternate" | "disaster";
141
+ readonly targetPath: string;
142
+ readonly fallbackPath?: string;
143
+ readonly previousSource?: PreviousSource;
144
+ readonly target?: StoreIdentity;
145
+ readonly cleanup?: CleanupProgress;
146
+ /** Attempt-owned working trees (staging, quarantine, sanitized) journaled before use so crash
147
+ * recovery deletes exactly these inodes and nothing else. */
148
+ readonly ownedPaths?: readonly AttemptOwnedPath[];
149
+ }
150
+ export interface RestoreReadyRecord extends CompletedJournalBase {
151
+ readonly state: "restore-ready";
152
+ readonly phase: RestorePhase;
153
+ readonly restore: RestoreContext;
154
+ readonly claim: RestoreClaim;
155
+ }
156
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
157
+ readonly [key: string]: JsonValue;
158
+ };
159
+ /** Manager-independent preservation payload. Callers own both JSON-safe shapes. */
160
+ export interface MaintenanceResumeDocument<Inventory extends JsonValue = JsonValue, Launch extends JsonValue = JsonValue> {
161
+ readonly version: typeof MAINTENANCE_RESUME_DOCUMENT_VERSION;
162
+ readonly inventory: Inventory;
163
+ readonly launch: Launch;
164
+ }
165
+ /** Content-addressed descriptor persisted in every maintenance journal state. */
166
+ export interface MaintenanceResumeDescriptor {
167
+ readonly version: typeof MAINTENANCE_RESUME_DOCUMENT_VERSION;
168
+ readonly file: "resume.json";
169
+ readonly bytes: number;
170
+ readonly sha256: string;
171
+ }
172
+ /** Bounded, non-secret identity of the normal listener spawned for one restore attempt. */
173
+ export interface RestoreListenerProof {
174
+ readonly attemptId: string;
175
+ readonly serverName: string;
176
+ readonly serverNonce: string;
177
+ readonly processOwner: ProcessOwner;
178
+ readonly serverEndpoint: string;
179
+ readonly target: StoreIdentity;
180
+ }
181
+ /** Durable invalidation of one dead listener identity for this unchanged restore attempt. */
182
+ export interface RestoreListenerReplacement {
183
+ readonly generation: number;
184
+ readonly replacedAt: string;
185
+ readonly proof: RestoreListenerProof;
186
+ }
187
+ export interface ReplaceDeadRestoreListenerOptions {
188
+ readonly ownerStatus?: (owner: ProcessOwner) => OwnerStatus;
189
+ }
190
+ export interface ManagerCommitEvidence {
191
+ readonly attemptId: string;
192
+ readonly state: "awaitingFinalize";
193
+ readonly durableCommitToken: string;
194
+ }
195
+ export interface ManagerFinalizeEvidence {
196
+ readonly attemptId: string;
197
+ readonly state: "active";
198
+ readonly durableCommitToken: string;
199
+ }
200
+ export interface RestoreActivationEvidence {
201
+ readonly attemptId: string;
202
+ readonly listenerReady: true;
203
+ readonly observedAt: string;
204
+ readonly managerCommit: ManagerCommitEvidence;
205
+ readonly managerFinalize: ManagerFinalizeEvidence;
206
+ }
207
+ export interface CommitIntentRecord extends CompletedJournalBase {
208
+ readonly state: "commit-intent";
209
+ readonly restore: RestoreContext & {
210
+ readonly target: StoreIdentity;
211
+ };
212
+ readonly launch: {
213
+ readonly [key: string]: JsonValue;
214
+ };
215
+ readonly listenerProof?: RestoreListenerProof;
216
+ readonly listenerReplacements?: readonly RestoreListenerReplacement[];
217
+ }
218
+ export interface RestoreManagerCommittedRecord extends CompletedJournalBase {
219
+ readonly state: "manager-committed";
220
+ readonly restore: RestoreContext & {
221
+ readonly target: StoreIdentity;
222
+ };
223
+ readonly launch: {
224
+ readonly [key: string]: JsonValue;
225
+ };
226
+ readonly listenerProof: RestoreListenerProof;
227
+ readonly listenerReplacements?: readonly RestoreListenerReplacement[];
228
+ readonly managerCommittedAt: string;
229
+ readonly managerCommit: ManagerCommitEvidence;
230
+ }
231
+ export interface RestoreActiveRecord extends CompletedJournalBase {
232
+ readonly state: "active";
233
+ readonly restore: RestoreContext & {
234
+ readonly target: StoreIdentity;
235
+ };
236
+ readonly launch: {
237
+ readonly [key: string]: JsonValue;
238
+ };
239
+ readonly listenerProof?: RestoreListenerProof;
240
+ readonly listenerReplacements?: readonly RestoreListenerReplacement[];
241
+ readonly managerCommittedAt: string;
242
+ readonly managerCommit: ManagerCommitEvidence;
243
+ readonly activeAt: string;
244
+ readonly details: RestoreActivationEvidence;
245
+ }
246
+ export interface RestoreDegradedRecord extends CompletedJournalBase {
247
+ readonly state: "degraded";
248
+ readonly restore: RestoreContext & {
249
+ readonly target: StoreIdentity;
250
+ };
251
+ readonly launch: {
252
+ readonly [key: string]: JsonValue;
253
+ };
254
+ readonly listenerProof?: RestoreListenerProof;
255
+ readonly listenerReplacements?: readonly RestoreListenerReplacement[];
256
+ /** Present when degradation followed manager commitment, including after finalization. */
257
+ readonly managerCommittedAt?: string;
258
+ readonly managerCommit?: ManagerCommitEvidence;
259
+ /** Present when degradation followed finalization; such a listener is not replaceable here. */
260
+ readonly activeAt?: string;
261
+ readonly details?: RestoreActivationEvidence;
262
+ readonly degradedAt: string;
263
+ readonly reason: string;
264
+ readonly recourse: readonly MaintenanceRecourse[];
265
+ }
266
+ /** Fsynced launch inputs for resuming the unchanged ready source through the normal listener. */
267
+ export interface OrdinaryResumeContext {
268
+ readonly attemptId: string;
269
+ readonly intentAt: string;
270
+ readonly launch: {
271
+ readonly [key: string]: JsonValue;
272
+ };
273
+ }
274
+ export interface OrdinaryResumeActivationEvidence {
275
+ readonly operation: "resumePreserved";
276
+ readonly attemptId: string;
277
+ readonly state: "awaitingCommit";
278
+ readonly observedAt: string;
279
+ }
280
+ /** Exact bound listener identity + retired-listener history shared by every resume phase. The
281
+ * proof's `target` is the preserved SOURCE store identity for an ordinary resume. */
282
+ interface OrdinaryResumeListenerState {
283
+ readonly listenerProof?: RestoreListenerProof;
284
+ readonly listenerReplacements?: readonly RestoreListenerReplacement[];
285
+ }
286
+ export interface OrdinaryResumeIntentRecord extends CompletedJournalBase, OrdinaryResumeListenerState {
287
+ readonly state: "resume-intent";
288
+ readonly ordinaryResume: OrdinaryResumeContext;
289
+ }
290
+ export interface OrdinaryResumeActiveRecord extends CompletedJournalBase, OrdinaryResumeListenerState {
291
+ readonly state: "resume-active";
292
+ readonly ordinaryResume: OrdinaryResumeContext;
293
+ readonly activeAt: string;
294
+ /** Caller-supplied proof/result data for listener readiness and same-principal activation. */
295
+ readonly activation: OrdinaryResumeActivationEvidence;
296
+ }
297
+ export interface OrdinaryResumeCommittedRecord extends CompletedJournalBase, OrdinaryResumeListenerState {
298
+ readonly state: "resume-committed";
299
+ readonly ordinaryResume: OrdinaryResumeContext;
300
+ readonly activeAt: string;
301
+ readonly activation: OrdinaryResumeActivationEvidence;
302
+ readonly managerCommittedAt: string;
303
+ readonly managerCommit: ManagerCommitEvidence;
304
+ }
305
+ export interface OrdinaryResumeDegradedRecord extends CompletedJournalBase, OrdinaryResumeListenerState {
306
+ readonly state: "resume-degraded";
307
+ readonly ordinaryResume: OrdinaryResumeContext;
308
+ readonly activeAt?: string;
309
+ readonly activation?: OrdinaryResumeActivationEvidence;
310
+ readonly managerCommittedAt?: string;
311
+ readonly managerCommit?: ManagerCommitEvidence;
312
+ readonly degradedAt: string;
313
+ readonly reason: string;
314
+ readonly recourse: readonly MaintenanceRecourse[];
315
+ }
316
+ /** Terminal, still-durable proof that activation succeeded and journal consumption is now safe. */
317
+ export interface OrdinaryResumeRetiredRecord extends CompletedJournalBase, OrdinaryResumeListenerState {
318
+ readonly state: "resume-retired";
319
+ readonly ordinaryResume: OrdinaryResumeContext;
320
+ readonly activeAt: string;
321
+ readonly activation: OrdinaryResumeActivationEvidence;
322
+ readonly managerCommittedAt: string;
323
+ readonly managerCommit: ManagerCommitEvidence;
324
+ readonly retiredAt: string;
325
+ readonly retirement: ManagerFinalizeEvidence;
326
+ }
327
+ export type OrdinaryResumeRecord = OrdinaryResumeIntentRecord | OrdinaryResumeActiveRecord | OrdinaryResumeCommittedRecord | OrdinaryResumeDegradedRecord | OrdinaryResumeRetiredRecord;
328
+ export type MaintenanceJournal = MaintenanceCutIntentRecord | MaintenanceCutCommittedRecord | MaintenanceReadyRecord | MaintenanceClaimedRecord | RestoreReadyRecord | CommitIntentRecord | RestoreManagerCommittedRecord | RestoreActiveRecord | RestoreDegradedRecord | OrdinaryResumeRecord;
329
+ export interface MaintenancePaths {
330
+ readonly root: string;
331
+ readonly cotalDir: string;
332
+ readonly maintenanceDir: string;
333
+ readonly versionDir: string;
334
+ readonly journal: string;
335
+ readonly resume: string;
336
+ readonly prepareIntent: string;
337
+ readonly lock: string;
338
+ readonly reaper: string;
339
+ }
340
+ export interface MaintenanceLock {
341
+ readonly root: string;
342
+ readonly path: string;
343
+ readonly token: string;
344
+ readonly owner: ProcessOwner;
345
+ }
346
+ export interface AcquireMaintenanceLockOptions {
347
+ readonly owner?: ProcessOwner;
348
+ readonly ownerStatus?: (owner: ProcessOwner) => OwnerStatus;
349
+ }
350
+ export declare function maintenancePaths(root: string): MaintenancePaths;
351
+ /** Read an already-bound store identity. Missing generation is a replacement ambiguity, not absence. */
352
+ export declare function readStoreIdentity(path: string): StoreIdentity;
353
+ /** Bind a stopped source or attempt-owned target to a non-reusable generation marker. */
354
+ export declare function ensureStoreIdentity(path: string): StoreIdentity;
355
+ export declare function sameStoreIdentity(a: StoreIdentity, b: StoreIdentity): boolean;
356
+ export declare function assertStoreIdentity(expected: StoreIdentity): StoreIdentity;
357
+ export declare function localProcessOwnerStatus(owner: ProcessOwner): OwnerStatus;
358
+ export declare function acquireMaintenanceLock(root: string, options?: AcquireMaintenanceLockOptions): MaintenanceLock;
359
+ export declare function releaseMaintenanceLock(lock: MaintenanceLock): void;
360
+ export declare function withMaintenanceLock<T>(root: string, operation: (lock: MaintenanceLock) => T, options?: AcquireMaintenanceLockOptions): T;
361
+ /** Atomically persist the bounded private resume inventory and launch provenance before publishing ready. */
362
+ export declare function writeMaintenanceResumeDocument<Inventory extends JsonValue, Launch extends JsonValue>(lock: MaintenanceLock, document: MaintenanceResumeDocument<Inventory, Launch>): MaintenanceResumeDescriptor;
363
+ /** Read exactly the fixed resume file after size, mode, SHA-256, version, and JSON-shape verification. */
364
+ export declare function readMaintenanceResumeDocument<Inventory extends JsonValue = JsonValue, Launch extends JsonValue = JsonValue>(root: string, descriptor: MaintenanceResumeDescriptor): MaintenanceResumeDocument<Inventory, Launch>;
365
+ export declare function readMaintenanceJournal(root: string): MaintenanceJournal | undefined;
366
+ /** Attempt binding persisted BEFORE the manager is fenced, so a crash between manager preparation
367
+ * and the cut-intent journal write can retry with the exact attempt the manager already holds. */
368
+ export interface PreservationPrepareIntent {
369
+ readonly attemptId: string;
370
+ readonly space: string;
371
+ readonly mode: MaintenanceAuthMode;
372
+ readonly server: string;
373
+ readonly storeDir: string;
374
+ }
375
+ export declare function writePreservationPrepareIntent(lock: MaintenanceLock, intent: PreservationPrepareIntent): void;
376
+ export declare function readPreservationPrepareIntent(root: string): PreservationPrepareIntent | undefined;
377
+ export declare function clearPreservationPrepareIntent(lock: MaintenanceLock): void;
378
+ /** Persist source identity and launch provenance before manager commitment or any process stop. */
379
+ export declare function beginMaintenanceCut(lock: MaintenanceLock, input: {
380
+ readonly attemptId: string;
381
+ readonly space: string;
382
+ readonly mode: MaintenanceAuthMode;
383
+ readonly sourcePath: string;
384
+ readonly resume: MaintenanceResumeDescriptor;
385
+ readonly launch: {
386
+ readonly server: string;
387
+ readonly [key: string]: JsonValue;
388
+ };
389
+ }): MaintenanceCutIntentRecord;
390
+ /** Abandon an uncommitted cut: before `cut-committed`, no suppression is durable and no process was
391
+ * stopped by the cut, so the intent may be safely abandoned instead of wedging on lost manager
392
+ * memory. The content-addressed resume document is left in place for inspection. */
393
+ export declare function abortMaintenanceCut(lock: MaintenanceLock): MaintenanceCutIntentRecord;
394
+ /** Fsync the manager's preservation commitment BEFORE any process stop, so a crash between manager
395
+ * commit and the ready promotion recovers idempotently without requiring a live manager. */
396
+ export declare function recordPreservationManagerCommit(lock: MaintenanceLock, managerCommit: MaintenanceCutCompletionEvidence["managerCommit"]): MaintenanceCutCommittedRecord;
397
+ /** Promote only the exact durable cut after all stopped/unreachable evidence has been supplied. */
398
+ export declare function completeMaintenanceCut(lock: MaintenanceLock, evidence: MaintenanceCutCompletionEvidence): MaintenanceReadyRecord;
399
+ export declare function claimMaintenanceReady(lock: MaintenanceLock, claim: MaintenanceClaim): MaintenanceClaimedRecord;
400
+ /** Merge broker/watchdog owners and attempt-owned slots into the live claim. A slot journaled
401
+ * before its path exists ("pending") is upgraded in place once the exact inode is known. */
402
+ export declare function recordMaintenanceClaimResources(lock: MaintenanceLock, input: {
403
+ readonly owners?: readonly ProcessOwner[];
404
+ readonly ownedPaths?: readonly AttemptOwnedPath[];
405
+ }): MaintenanceClaimedRecord;
406
+ export declare function releaseMaintenanceClaim(lock: MaintenanceLock, attemptId: string): MaintenanceReadyRecord;
407
+ export declare function recoverStaleMaintenanceClaim(lock: MaintenanceLock, options?: {
408
+ readonly now?: Date;
409
+ readonly ownerStatus?: (owner: ProcessOwner) => OwnerStatus;
410
+ }): MaintenanceReadyRecord;
411
+ /**
412
+ * Fsync normal-listener launch provenance before exposure. A crash after this transition is
413
+ * intentionally ambiguous: callers must inspect/recover forward or record `resume-degraded`.
414
+ */
415
+ export declare function beginOrdinaryResume(lock: MaintenanceLock, input: {
416
+ readonly attemptId: string;
417
+ readonly launch: {
418
+ readonly [key: string]: JsonValue;
419
+ };
420
+ }): OrdinaryResumeIntentRecord;
421
+ /** Fsync the exact ordinary-resume listener identity after spawn and before activation. The
422
+ * proof's target is the preserved SOURCE store. */
423
+ export declare function bindOrdinaryResumeListener(lock: MaintenanceLock, proof: RestoreListenerProof): OrdinaryResumeIntentRecord | OrdinaryResumeDegradedRecord;
424
+ /** Retire one exactly bound, provably dead resume listener before a fresh proof may be bound. A
425
+ * manager-committed resume never replaces its listener: the durable token is bound to it. */
426
+ export declare function replaceDeadOrdinaryResumeListener(lock: MaintenanceLock, proof: RestoreListenerProof, options?: ReplaceDeadRestoreListenerOptions): OrdinaryResumeIntentRecord | OrdinaryResumeActiveRecord | OrdinaryResumeDegradedRecord;
427
+ /** Record that the normal listener is ready and retained principals were activated successfully. */
428
+ export declare function markOrdinaryResumeActive(lock: MaintenanceLock, activation: OrdinaryResumeActivationEvidence): OrdinaryResumeActiveRecord;
429
+ /** Preserve an ambiguous or failed post-intent result without rolling back or deleting any bytes. */
430
+ export declare function markOrdinaryResumeDegraded(lock: MaintenanceLock, reason: string, recourse: readonly MaintenanceRecourse[]): OrdinaryResumeDegradedRecord;
431
+ /** Fsync the manager's suppression-retaining commit token before requesting finalization. */
432
+ export declare function recordOrdinaryResumeManagerCommit(lock: MaintenanceLock, evidence: ManagerCommitEvidence): OrdinaryResumeCommittedRecord;
433
+ /** Durably authorize journal consumption only after exact token-bound manager finalization. */
434
+ export declare function retireOrdinaryResume(lock: MaintenanceLock, retirement: ManagerFinalizeEvidence): OrdinaryResumeRetiredRecord;
435
+ /**
436
+ * Consume only a durable retired marker. The source store and content-addressed resume document are
437
+ * deliberately left untouched; a crash leaves either `resume-retired` or an absent journal.
438
+ */
439
+ export declare function consumeRetiredMaintenance(lock: MaintenanceLock): OrdinaryResumeRetiredRecord;
440
+ export interface RestoreClaimInput {
441
+ readonly deadline: string;
442
+ readonly coordinator?: ProcessOwner;
443
+ readonly ownedPaths?: readonly AttemptOwnedPath[];
444
+ }
445
+ /** Assess the recorded pre-commit liveness claim. `live` while the deadline has not elapsed or any
446
+ * recorded owner is alive; `stale` only when the deadline elapsed AND every owner is proven dead. */
447
+ export declare function assessRestoreClaim(record: RestoreReadyRecord, options?: {
448
+ readonly now?: Date;
449
+ readonly ownerStatus?: (owner: ProcessOwner) => OwnerStatus;
450
+ }): RestoreClaimAssessment;
451
+ /** Append broker/watchdog owners and attempt-owned working trees to the live restore attempt so
452
+ * recovery can refuse while they live and delete exactly these inodes once they are proven dead. */
453
+ export declare function recordRestoreAttemptResources(lock: MaintenanceLock, input: {
454
+ readonly owners?: readonly ProcessOwner[];
455
+ readonly ownedPaths?: readonly AttemptOwnedPath[];
456
+ }): RestoreReadyRecord;
457
+ export declare function prepareSamePathRestore(lock: MaintenanceLock, input: {
458
+ readonly attemptId: string;
459
+ readonly targetPath: string;
460
+ readonly fallbackPath: string;
461
+ readonly claim: RestoreClaimInput;
462
+ }): RestoreReadyRecord;
463
+ export declare function interpretPendingStoreMove(record: RestoreReadyRecord): "not-moved" | "moved";
464
+ /**
465
+ * Move the stopped source after interpreting either crash side. This is a cooperative filesystem
466
+ * transition: the caller must first prove every broker and other non-Cotal store user has exited.
467
+ * The maintenance lock excludes Cotal peers; it is not a shared-store lock for raw processes.
468
+ */
469
+ export declare function moveSamePathRestoreSource(lock: MaintenanceLock): RestoreReadyRecord;
470
+ export declare function prepareAlternateRestore(lock: MaintenanceLock, input: {
471
+ readonly attemptId: string;
472
+ readonly targetPath: string;
473
+ readonly claim: RestoreClaimInput;
474
+ }): RestoreReadyRecord;
475
+ export declare function prepareMissingSourceRestore(lock: MaintenanceLock, input: {
476
+ readonly attemptId: string;
477
+ readonly targetPath: string;
478
+ readonly claim: RestoreClaimInput;
479
+ }): RestoreReadyRecord;
480
+ export declare function bindRestoreTarget(lock: MaintenanceLock): RestoreReadyRecord;
481
+ export declare function writeRestoreCommitIntent(lock: MaintenanceLock, launch: {
482
+ readonly [key: string]: JsonValue;
483
+ }): CommitIntentRecord;
484
+ /** Fsync the exact normal listener identity after spawn and before activation is published. */
485
+ export declare function bindRestoreListener(lock: MaintenanceLock, proof: RestoreListenerProof): CommitIntentRecord;
486
+ /**
487
+ * Retire one exactly bound, provably dead listener without changing the restore attempt. The
488
+ * atomic journal transition clears the current proof before another listener may be spawned.
489
+ */
490
+ export declare function replaceDeadRestoreListener(lock: MaintenanceLock, proof: RestoreListenerProof, options?: ReplaceDeadRestoreListenerOptions): CommitIntentRecord;
491
+ /** Fsync the manager's suppression-retaining commit token before requesting finalization. */
492
+ export declare function recordRestoreManagerCommit(lock: MaintenanceLock, proof: RestoreListenerProof, evidence: ManagerCommitEvidence): RestoreManagerCommittedRecord;
493
+ export declare function markRestoreActive(lock: MaintenanceLock, proof: RestoreListenerProof, evidence: ManagerFinalizeEvidence): RestoreActiveRecord;
494
+ export declare function markRestoreDegraded(lock: MaintenanceLock, reason: string, recourse: readonly MaintenanceRecourse[]): RestoreDegradedRecord;
495
+ /** Recover forward only by re-presenting the exact bound listener plus fresh readiness evidence. */
496
+ export declare function repairRestoreDegradedToActive(lock: MaintenanceLock, proof: RestoreListenerProof, evidence: ManagerFinalizeEvidence): RestoreActiveRecord;
497
+ export interface RollbackRestoreOptions {
498
+ /** Exact live-claim coordinator identity: the owning coordinator rolling back its own attempt. */
499
+ readonly asCoordinator?: ProcessOwner;
500
+ readonly now?: Date;
501
+ readonly ownerStatus?: (owner: ProcessOwner) => OwnerStatus;
502
+ }
503
+ export declare function rollbackRestore(lock: MaintenanceLock, options?: RollbackRestoreOptions): MaintenanceReadyRecord;
504
+ export declare function cleanupRestoreFallback(lock: MaintenanceLock, attemptId: string): RestoreActiveRecord;
505
+ export {};
506
+ //# sourceMappingURL=maintenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maintenance.d.ts","sourceRoot":"","sources":["../src/maintenance.ts"],"names":[],"mappings":"AAyBA,gGAAgG;AAChG,eAAO,MAAM,2BAA2B,EAAG,CAAU,CAAC;AACtD,eAAO,MAAM,mCAAmC,EAAG,CAAU,CAAC;AAC9D,eAAO,MAAM,4BAA4B,QAAc,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAA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