@evomap/evolver-cli 2.0.2 → 2.0.8
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.
- package/dist/lifecycle.d.ts +95 -5
- package/dist/lifecycle.js +4099 -241
- package/dist/lifecycleBootstrapTransaction.d.ts +235 -0
- package/dist/lifecycleBootstrapTransaction.js +2182 -0
- package/dist/reuse.d.ts +1 -1
- package/dist/reuse.js +145 -97
- package/dist/sync.d.ts +1 -1
- package/dist/sync.js +761 -174
- package/package.json +7 -7
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { bootstrap as coreBootstrap, util } from '@evomap/evolver-core';
|
|
2
|
+
import type { ServiceTarget } from './lifecycle.js';
|
|
3
|
+
export declare const BOOTSTRAP_JOURNAL_FILE = "bootstrap-transaction.json";
|
|
4
|
+
export declare const BOOTSTRAP_LOCK_FILE = "bootstrap-owner.lock";
|
|
5
|
+
export declare const BOOTSTRAP_SUCCESS_FILE = "bootstrap.json";
|
|
6
|
+
declare const BOOTSTRAP_JOURNAL_SCHEMA = "evolver.lifecycle-bootstrap-transaction.v1";
|
|
7
|
+
export declare const LEGACY_BOOTSTRAP_REMOVAL_OPERATION = "legacy-v907-remove";
|
|
8
|
+
declare const LEGACY_BOOTSTRAP_ABSENT_MANAGER_BINDING = "legacy-v907-absent";
|
|
9
|
+
type BootstrapJournalStage = 'prepared' | 'installing' | 'installed' | 'activating' | 'activated' | 'committing' | 'committed' | 'rollback_pending' | 'rolled_back';
|
|
10
|
+
export interface BootstrapArtifactIdentity {
|
|
11
|
+
size: number;
|
|
12
|
+
sha256: string;
|
|
13
|
+
device?: string;
|
|
14
|
+
inode?: string;
|
|
15
|
+
}
|
|
16
|
+
type BootstrapArtifactClaimOwnership = {
|
|
17
|
+
phase: 'armed';
|
|
18
|
+
} | {
|
|
19
|
+
phase: 'created';
|
|
20
|
+
device: string;
|
|
21
|
+
inode: string;
|
|
22
|
+
};
|
|
23
|
+
export interface BootstrapJournalArtifact {
|
|
24
|
+
path: string;
|
|
25
|
+
claimPath: string;
|
|
26
|
+
rollbackPath: string;
|
|
27
|
+
before: 'absent' | 'legacy_owned';
|
|
28
|
+
identity?: BootstrapArtifactIdentity;
|
|
29
|
+
claimOwnership?: BootstrapArtifactClaimOwnership;
|
|
30
|
+
}
|
|
31
|
+
type BootstrapPreservedArtifact = coreBootstrap.LifecycleBootstrapMarker['artifacts'][number];
|
|
32
|
+
type BootstrapTransactionManagerBinding = {
|
|
33
|
+
artifactPath: string;
|
|
34
|
+
kind?: coreBootstrap.LifecycleBootstrapManagerBindingKind;
|
|
35
|
+
} | {
|
|
36
|
+
kind: typeof LEGACY_BOOTSTRAP_ABSENT_MANAGER_BINDING;
|
|
37
|
+
state: 'absent';
|
|
38
|
+
};
|
|
39
|
+
export type BootstrapCanonicalStateKind = 'marker' | 'readiness';
|
|
40
|
+
export interface BootstrapCanonicalQuarantine {
|
|
41
|
+
kind: BootstrapCanonicalStateKind;
|
|
42
|
+
sourcePath: string;
|
|
43
|
+
quarantinePath: string;
|
|
44
|
+
identity: BootstrapArtifactIdentity & {
|
|
45
|
+
device: string;
|
|
46
|
+
inode: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface BootstrapTransactionJournal {
|
|
50
|
+
schema: typeof BOOTSTRAP_JOURNAL_SCHEMA;
|
|
51
|
+
transactionId: string;
|
|
52
|
+
owner: util.FileLockOwnerRecord & {
|
|
53
|
+
acquiredAt: string;
|
|
54
|
+
};
|
|
55
|
+
target: ServiceTarget;
|
|
56
|
+
service: string;
|
|
57
|
+
managerBefore: 'absent' | 'present' | 'disabled';
|
|
58
|
+
managerBinding: BootstrapTransactionManagerBinding;
|
|
59
|
+
operation?: typeof LEGACY_BOOTSTRAP_REMOVAL_OPERATION;
|
|
60
|
+
stage: BootstrapJournalStage;
|
|
61
|
+
deadlineMs: number;
|
|
62
|
+
artifacts: BootstrapJournalArtifact[];
|
|
63
|
+
preservedArtifacts?: BootstrapPreservedArtifact[];
|
|
64
|
+
successMarkerIdentity?: Pick<BootstrapArtifactIdentity, 'size' | 'sha256'>;
|
|
65
|
+
canonicalQuarantine?: BootstrapCanonicalQuarantine[];
|
|
66
|
+
managerDetached?: boolean;
|
|
67
|
+
artifactsRestored?: boolean;
|
|
68
|
+
activationStarted?: boolean;
|
|
69
|
+
terminalAction?: 'remove_committed';
|
|
70
|
+
lastError?: string;
|
|
71
|
+
updatedAt: string;
|
|
72
|
+
}
|
|
73
|
+
export interface BootstrapOwnerLock {
|
|
74
|
+
path: string;
|
|
75
|
+
owner: util.FileLockOwnerRecord;
|
|
76
|
+
assertOwned(): void;
|
|
77
|
+
release(): void;
|
|
78
|
+
}
|
|
79
|
+
interface WindowsAclCheck {
|
|
80
|
+
path: string;
|
|
81
|
+
parentOnly: boolean;
|
|
82
|
+
ownerCurrentOnly?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** Test-only ACL dependency seam. Production callers never configure this override. */
|
|
85
|
+
export declare function _setBootstrapWindowsAclTrustForTest(assertion: ((checks: readonly WindowsAclCheck[]) => void) | undefined): void;
|
|
86
|
+
interface BoundedRegularTextReadOptions {
|
|
87
|
+
platform?: NodeJS.Platform;
|
|
88
|
+
assertWindowsAcl?: (path: string) => void;
|
|
89
|
+
afterAclCheck?: () => void;
|
|
90
|
+
afterRead?: () => void;
|
|
91
|
+
requireOwnerOnly?: boolean;
|
|
92
|
+
}
|
|
93
|
+
export declare function _readBoundedRegularTextForTest(path: string, maxBytes: number, label: string, options: BoundedRegularTextReadOptions): string;
|
|
94
|
+
export declare function writeDurableText(path: string, content: string, mode?: number): void;
|
|
95
|
+
export interface BootstrapArtifactPublication {
|
|
96
|
+
claimPath: string;
|
|
97
|
+
/** Invoked once after the fully staged claim is durably bound, then again after final publication. */
|
|
98
|
+
onPublished(path: string, claimPath: string): void;
|
|
99
|
+
}
|
|
100
|
+
export declare function writeDurableTextExclusive(path: string, content: string, mode?: number, publication?: BootstrapArtifactPublication): void;
|
|
101
|
+
export declare function writeDurableBytesExclusive(path: string, content: Uint8Array, mode?: number, publication?: BootstrapArtifactPublication): void;
|
|
102
|
+
export declare function writeDurableJsonExclusive(path: string, value: unknown, mode?: number): void;
|
|
103
|
+
export declare function removeDurableFile(path: string): void;
|
|
104
|
+
export declare function acquireBootstrapOwnerLock(stateDir: string, options?: {
|
|
105
|
+
maxTries?: number;
|
|
106
|
+
waitMs?: number;
|
|
107
|
+
}): BootstrapOwnerLock;
|
|
108
|
+
export declare function acquireBootstrapReadinessLock(stateDir: string, options?: {
|
|
109
|
+
maxTries?: number;
|
|
110
|
+
waitMs?: number;
|
|
111
|
+
}): BootstrapOwnerLock;
|
|
112
|
+
export declare function createBootstrapJournal(input: {
|
|
113
|
+
owner: util.FileLockOwnerRecord;
|
|
114
|
+
transactionId?: string;
|
|
115
|
+
target: ServiceTarget;
|
|
116
|
+
service: string;
|
|
117
|
+
deadlineMs: number;
|
|
118
|
+
artifactPaths: readonly string[];
|
|
119
|
+
artifactIdentities: Readonly<Record<string, BootstrapArtifactIdentity>>;
|
|
120
|
+
managerArtifactPath: string;
|
|
121
|
+
now?: number;
|
|
122
|
+
}): BootstrapTransactionJournal;
|
|
123
|
+
export declare function bootstrapJournalFromMarker(marker: coreBootstrap.LifecycleBootstrapMarker, owner: util.FileLockOwnerRecord, deadlineMs: number, now?: number): BootstrapTransactionJournal;
|
|
124
|
+
export declare function bootstrapJournalManagerArtifactPath(journal: Pick<BootstrapTransactionJournal, 'managerBinding'>): string;
|
|
125
|
+
export declare function createLegacyBootstrapRemovalJournal(input: {
|
|
126
|
+
owner: util.FileLockOwnerRecord;
|
|
127
|
+
target: ServiceTarget;
|
|
128
|
+
service: string;
|
|
129
|
+
deadlineMs: number;
|
|
130
|
+
managerState: 'absent' | 'present' | 'disabled';
|
|
131
|
+
managerArtifactPath?: string;
|
|
132
|
+
artifacts: coreBootstrap.LifecycleBootstrapMarker['artifacts'];
|
|
133
|
+
preservedArtifacts?: coreBootstrap.LifecycleBootstrapMarker['artifacts'];
|
|
134
|
+
now?: number;
|
|
135
|
+
}): BootstrapTransactionJournal;
|
|
136
|
+
export declare function bootstrapArtifactClaimPath(path: string, transactionId: string): string;
|
|
137
|
+
export declare function bootstrapArtifactRollbackPath(path: string, transactionId: string): string;
|
|
138
|
+
export declare function updateBootstrapJournal(journal: BootstrapTransactionJournal, patch: Partial<Omit<BootstrapTransactionJournal, 'schema' | 'transactionId' | 'owner' | 'target' | 'service' | 'managerBefore' | 'managerBinding' | 'artifacts' | 'canonicalQuarantine'>>, now?: number): BootstrapTransactionJournal;
|
|
139
|
+
export declare function bootstrapJournalPath(stateDir: string): string;
|
|
140
|
+
export declare function bootstrapMarkerPath(stateDir: string): string;
|
|
141
|
+
export declare function bootstrapReadinessPath(stateDir: string): string;
|
|
142
|
+
export declare function bootstrapManualTransitionPath(stateDir: string): string;
|
|
143
|
+
/**
|
|
144
|
+
* Validate the parent's active registration token while the caller owns bootstrap-owner.lock.
|
|
145
|
+
* Absence, a terminal receipt, or any malformed/untrusted presentation blocks before mutation.
|
|
146
|
+
*/
|
|
147
|
+
export declare function assertActiveBootstrapRegistrationIntentToken(stateDir: string, tokenValue: unknown): coreBootstrap.LifecycleBootstrapRegistrationIntent;
|
|
148
|
+
export declare function readBootstrapManualTransition(stateDir: string): coreBootstrap.LifecycleBootstrapManualTransition | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Persist the operator's remove -> explicit install handoff before any committed
|
|
151
|
+
* manager or artifact mutation. A matching tombstone is an idempotent retry.
|
|
152
|
+
*/
|
|
153
|
+
export declare function ensureBootstrapManualTransition(stateDir: string, source: {
|
|
154
|
+
transactionId: string;
|
|
155
|
+
target: ServiceTarget;
|
|
156
|
+
service: string;
|
|
157
|
+
}, now?: number): coreBootstrap.LifecycleBootstrapManualTransition;
|
|
158
|
+
export declare function removeBootstrapManualTransition(stateDir: string, transitionId: string): void;
|
|
159
|
+
export declare function writeBootstrapJournal(stateDir: string, journal: BootstrapTransactionJournal): void;
|
|
160
|
+
export declare function removeBootstrapJournal(stateDir: string): void;
|
|
161
|
+
export declare function parseBootstrapJournal(value: unknown): BootstrapTransactionJournal | undefined;
|
|
162
|
+
export declare function readBootstrapJournal(stateDir: string): BootstrapTransactionJournal | undefined;
|
|
163
|
+
export declare function readBootstrapMarker(stateDir: string): coreBootstrap.LifecycleBootstrapMarker | undefined;
|
|
164
|
+
export interface LegacyBootstrapMarkerRead {
|
|
165
|
+
marker: coreBootstrap.LegacyLifecycleBootstrapMarker;
|
|
166
|
+
raw: string;
|
|
167
|
+
identity: BootstrapArtifactIdentity & {
|
|
168
|
+
device: string;
|
|
169
|
+
inode: string;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export declare function readLegacyBootstrapMarker(stateDir: string): LegacyBootstrapMarkerRead | undefined;
|
|
173
|
+
export interface LegacyBootstrapAdoptionHooks {
|
|
174
|
+
assertOwner?: () => void;
|
|
175
|
+
beforeQuarantine?: (journal: BootstrapTransactionJournal) => void;
|
|
176
|
+
afterQuarantine?: () => void;
|
|
177
|
+
beforePublish?: (journal: BootstrapTransactionJournal) => void | Promise<void>;
|
|
178
|
+
afterPublish?: () => void;
|
|
179
|
+
beforeFinalize?: () => void;
|
|
180
|
+
}
|
|
181
|
+
/** Adopt an exact legacy marker through the durable canonical-state transaction. */
|
|
182
|
+
export declare function adoptLegacyBootstrapMarker(stateDir: string, expectedLegacy: LegacyBootstrapMarkerRead, marker: coreBootstrap.LifecycleBootstrapMarker, initialJournal: BootstrapTransactionJournal, now?: () => number, hooks?: LegacyBootstrapAdoptionHooks): Promise<void>;
|
|
183
|
+
export declare function readBootstrapReadiness(stateDir: string): coreBootstrap.LifecycleBootstrapReadiness | undefined;
|
|
184
|
+
export declare function removeBootstrapReadiness(stateDir: string, transactionId: string, beforeMutation?: () => void): void;
|
|
185
|
+
export declare function assertTrustedArtifactParent(path: string, platform: NodeJS.Platform, uid?: number): void;
|
|
186
|
+
export declare function assertPlannedArtifactsAbsent(paths: readonly string[], platform: NodeJS.Platform, uid?: number): void;
|
|
187
|
+
export declare function assertBootstrapTransactionClaimsAbsent(journal: BootstrapTransactionJournal): void;
|
|
188
|
+
interface BootstrapArtifactLeafStat {
|
|
189
|
+
nlink: bigint;
|
|
190
|
+
uid: bigint;
|
|
191
|
+
mode: bigint;
|
|
192
|
+
}
|
|
193
|
+
export type BootstrapArtifactReadRole = 'transaction' | 'owned' | 'preserved';
|
|
194
|
+
declare function assertTrustedBootstrapArtifactLeaf(stat: BootstrapArtifactLeafStat, platform: NodeJS.Platform, uid: bigint | undefined, path: string, role: BootstrapArtifactReadRole): void;
|
|
195
|
+
export declare const _assertTrustedBootstrapArtifactLeafForTest: typeof assertTrustedBootstrapArtifactLeaf;
|
|
196
|
+
export declare function readBootstrapArtifactFile(path: string, maxBytes?: number, hooks?: {
|
|
197
|
+
afterRead?: () => void;
|
|
198
|
+
role?: BootstrapArtifactReadRole;
|
|
199
|
+
}): {
|
|
200
|
+
bytes: Buffer;
|
|
201
|
+
identity: BootstrapArtifactIdentity & {
|
|
202
|
+
device: string;
|
|
203
|
+
inode: string;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
export declare function bootstrapArtifactIdentityForBytes(bytes: Uint8Array): BootstrapArtifactIdentity;
|
|
207
|
+
export declare function bootstrapArtifactContentIdentityForFile(path: string): BootstrapArtifactIdentity;
|
|
208
|
+
export declare function bootstrapArtifactIdentityForFile(path: string): BootstrapArtifactIdentity & {
|
|
209
|
+
device: string;
|
|
210
|
+
inode: string;
|
|
211
|
+
};
|
|
212
|
+
export declare function planBootstrapCanonicalQuarantine(stateDir: string, journal: BootstrapTransactionJournal, kinds: readonly BootstrapCanonicalStateKind[]): BootstrapTransactionJournal;
|
|
213
|
+
export declare function applyBootstrapCanonicalQuarantine(stateDir: string, journal: BootstrapTransactionJournal, beforeMutation?: () => void): void;
|
|
214
|
+
export declare function restoreBootstrapCanonicalQuarantine(stateDir: string, journal: BootstrapTransactionJournal, hooks?: {
|
|
215
|
+
beforeMove?: (entry: Readonly<BootstrapCanonicalQuarantine>) => void;
|
|
216
|
+
afterMove?: (entry: Readonly<BootstrapCanonicalQuarantine>) => void;
|
|
217
|
+
}): void;
|
|
218
|
+
export declare function finalizeBootstrapCanonicalQuarantine(stateDir: string, journal: BootstrapTransactionJournal, hooks?: {
|
|
219
|
+
beforeMove?: (entry: Readonly<BootstrapCanonicalQuarantine>) => void;
|
|
220
|
+
afterMove?: (entry: Readonly<BootstrapCanonicalQuarantine>) => void;
|
|
221
|
+
beforeDelete?: (entry: Readonly<BootstrapCanonicalQuarantine>) => void;
|
|
222
|
+
}): void;
|
|
223
|
+
export declare function recordPublishedBootstrapArtifact(journal: BootstrapTransactionJournal, path: string, claimPath: string, persistClaimOwnership: (journal: BootstrapTransactionJournal) => void): BootstrapTransactionJournal;
|
|
224
|
+
export declare function captureBootstrapArtifactIdentities(journal: BootstrapTransactionJournal, requirePresent?: boolean): BootstrapTransactionJournal;
|
|
225
|
+
export declare function removeOwnedBootstrapArtifacts(journal: BootstrapTransactionJournal, hooks?: {
|
|
226
|
+
beforeStagingQuarantine?: (artifact: Readonly<BootstrapJournalArtifact>) => void;
|
|
227
|
+
afterStagingQuarantine?: (artifact: Readonly<BootstrapJournalArtifact>) => void;
|
|
228
|
+
beforeStagingDelete?: (artifact: Readonly<BootstrapJournalArtifact>) => void;
|
|
229
|
+
beforeQuarantine?: (artifact: Readonly<BootstrapJournalArtifact>) => void;
|
|
230
|
+
afterQuarantine?: (artifact: Readonly<BootstrapJournalArtifact>) => void;
|
|
231
|
+
beforeQuarantineDelete?: (artifact: Readonly<BootstrapJournalArtifact>) => void;
|
|
232
|
+
beforeClaimQuarantine?: (artifact: Readonly<BootstrapJournalArtifact>) => void;
|
|
233
|
+
beforeClaimQuarantineDelete?: (artifact: Readonly<BootstrapJournalArtifact>) => void;
|
|
234
|
+
}): void;
|
|
235
|
+
export {};
|