@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
package/dist/lifecycle.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
+
import { bootstrap as coreBootstrap, util as coreUtil } from '@evomap/evolver-core';
|
|
3
|
+
import { type BootstrapTransactionJournal, type BootstrapArtifactIdentity, type LegacyBootstrapMarkerRead } from './lifecycleBootstrapTransaction.js';
|
|
4
|
+
export declare function selectExistingPosixCommand(candidates: readonly string[], exists?: (path: string) => boolean): string;
|
|
2
5
|
export type ServiceTarget = 'launchd' | 'systemd' | 'windows';
|
|
3
6
|
export interface DaemonCommand {
|
|
4
7
|
command: string;
|
|
@@ -24,21 +27,32 @@ export interface LifecycleStatus {
|
|
|
24
27
|
healthy?: boolean;
|
|
25
28
|
reason?: string;
|
|
26
29
|
logFile?: string;
|
|
30
|
+
startedAt?: string;
|
|
31
|
+
url?: string;
|
|
27
32
|
}
|
|
28
33
|
export interface LifecycleResult {
|
|
29
34
|
status: string;
|
|
35
|
+
/** Durable transaction identity for bootstrap success results. */
|
|
36
|
+
transactionId?: string;
|
|
30
37
|
pid?: number;
|
|
31
38
|
pids?: number[];
|
|
32
39
|
healthy?: boolean;
|
|
33
40
|
reason?: string;
|
|
34
41
|
logFile?: string;
|
|
35
42
|
files?: string[];
|
|
43
|
+
/** Verified legacy companion files intentionally preserved and never removed. */
|
|
44
|
+
preservedFiles?: string[];
|
|
36
45
|
service?: string;
|
|
37
46
|
autoexecHome?: string;
|
|
38
47
|
actions?: string[];
|
|
48
|
+
/** Files whose absent pre-state is owned by a first-run bootstrap transaction. */
|
|
49
|
+
bootstrapArtifacts?: string[];
|
|
50
|
+
/** Expected bytes recorded before a first-run bootstrap mutates the filesystem. */
|
|
51
|
+
bootstrapArtifactIdentities?: Record<string, BootstrapArtifactIdentity>;
|
|
39
52
|
}
|
|
40
|
-
type UnixRecoveryControllerModule = Pick<typeof import('@evomap/evolver-proxy'), 'provisionStableUnixRecoveryController' | 'stableUnixRecoveryControllerPathForTarget' | 'UNIX_RECOVERY_CONTROLLER_ARG'
|
|
53
|
+
type UnixRecoveryControllerModule = Pick<typeof import('@evomap/evolver-proxy'), 'provisionStableUnixRecoveryController' | 'stableUnixRecoveryControllerPathForTarget' | 'UNIX_RECOVERY_CONTROLLER_ARG'> & Partial<Pick<typeof import('@evomap/evolver-proxy'), 'provisionStableWindowsRecoveryController'>>;
|
|
41
54
|
type LoadUnixRecoveryController = () => Promise<UnixRecoveryControllerModule>;
|
|
55
|
+
type InspectDurableSelfUpdate = typeof import('@evomap/evolver-proxy')['inspectDurableSelfUpdate'];
|
|
42
56
|
interface RunLifecycleDeps {
|
|
43
57
|
argv1?: string;
|
|
44
58
|
env?: NodeJS.ProcessEnv;
|
|
@@ -50,13 +64,31 @@ interface RunLifecycleDeps {
|
|
|
50
64
|
}
|
|
51
65
|
export interface BootstrapServiceDeps {
|
|
52
66
|
platform?: NodeJS.Platform;
|
|
53
|
-
run?: (command: string, args: readonly string[]) => ServiceControlResult;
|
|
67
|
+
run?: (command: string, args: readonly string[], timeoutMs?: number) => ServiceControlResult;
|
|
54
68
|
uid?: number;
|
|
55
|
-
|
|
69
|
+
now?: () => number;
|
|
70
|
+
lock?: {
|
|
71
|
+
maxTries?: number;
|
|
72
|
+
waitMs?: number;
|
|
73
|
+
};
|
|
74
|
+
health?: (paths: LifecyclePaths, env: NodeJS.ProcessEnv) => Promise<LifecycleStatus>;
|
|
75
|
+
readiness?: (stateDir: string) => coreBootstrap.LifecycleBootstrapReadiness | undefined;
|
|
76
|
+
readinessOwnerProcessStatus?: (owner: Pick<coreUtil.FileLockOwnerRecord, 'pid' | 'processStartIdentity'>) => coreUtil.FileLockOwnerProcessStatus;
|
|
77
|
+
healthTimeoutMs?: number;
|
|
78
|
+
install?: (target: ServiceTarget, flags: Record<string, string | true>, env: NodeJS.ProcessEnv, argv1: string | undefined, loadUnixRecoveryController?: LoadUnixRecoveryController, options?: InstallServiceOptions) => Promise<LifecycleResult>;
|
|
79
|
+
writeMarker?: (path: string, marker: coreBootstrap.LifecycleBootstrapMarker) => void;
|
|
80
|
+
inspectSelfUpdate?: InspectDurableSelfUpdate;
|
|
56
81
|
}
|
|
57
82
|
interface ServiceControlResult {
|
|
58
83
|
status: number | null;
|
|
59
84
|
error?: unknown;
|
|
85
|
+
stdout?: string;
|
|
86
|
+
}
|
|
87
|
+
interface InstallServiceOptions {
|
|
88
|
+
exclusive?: boolean;
|
|
89
|
+
transactionId?: string;
|
|
90
|
+
onArtifactPublished?: (path: string, claimPath: string) => void;
|
|
91
|
+
assertOwner?: () => void;
|
|
60
92
|
}
|
|
61
93
|
export interface RemoveAutoexecServiceDeps {
|
|
62
94
|
paths?: Partial<Record<ServiceTarget, string>>;
|
|
@@ -104,6 +136,7 @@ export declare function renderSystemdUnit(opts?: {
|
|
|
104
136
|
lifecycleStateDir?: string;
|
|
105
137
|
selfUpdateStateDir?: string;
|
|
106
138
|
selfUpdateTarget?: string;
|
|
139
|
+
bootstrapTransactionId?: string;
|
|
107
140
|
}): string;
|
|
108
141
|
export declare function renderAutoexecSystemdUnit(opts: {
|
|
109
142
|
envFile?: string;
|
|
@@ -123,6 +156,7 @@ export declare function renderLaunchdPlist(opts?: {
|
|
|
123
156
|
label?: string;
|
|
124
157
|
logName?: string;
|
|
125
158
|
selfUpdateSupervisor?: boolean;
|
|
159
|
+
bootstrapTransactionId?: string;
|
|
126
160
|
}): string;
|
|
127
161
|
export declare function renderAutoexecLaunchdPlist(opts: {
|
|
128
162
|
envFile?: string;
|
|
@@ -130,14 +164,26 @@ export declare function renderAutoexecLaunchdPlist(opts: {
|
|
|
130
164
|
programArguments: readonly string[];
|
|
131
165
|
logDir?: string;
|
|
132
166
|
}): string;
|
|
133
|
-
|
|
167
|
+
interface WindowsInstallerDefaults {
|
|
134
168
|
evolverBin?: string;
|
|
135
169
|
nodePath?: string;
|
|
136
170
|
proxyBin?: string;
|
|
137
171
|
envFile?: string;
|
|
138
172
|
lifecycleStateDir?: string;
|
|
139
173
|
selfUpdateStateDir?: string;
|
|
140
|
-
|
|
174
|
+
bootstrapTransactionId?: string;
|
|
175
|
+
wscriptPath?: string;
|
|
176
|
+
}
|
|
177
|
+
interface LegacyWindowsInstallerProof {
|
|
178
|
+
family: 'v907' | 'v918';
|
|
179
|
+
defaults: WindowsInstallerDefaults;
|
|
180
|
+
}
|
|
181
|
+
declare function parseLegacyWindowsInstallerDefaults(source: string): LegacyWindowsInstallerProof;
|
|
182
|
+
export declare const _parseLegacyWindowsInstallerDefaultsForTest: typeof parseLegacyWindowsInstallerDefaults;
|
|
183
|
+
declare function renderWindowsProxyLauncherBytes(defaults: WindowsInstallerDefaults): Buffer;
|
|
184
|
+
declare function renderLegacyWindowsProxyLauncherBytes(proof: LegacyWindowsInstallerProof): Buffer;
|
|
185
|
+
export declare const _renderWindowsProxyLauncherBytesForTest: typeof renderWindowsProxyLauncherBytes;
|
|
186
|
+
export declare function renderWindowsInstaller(defaults?: WindowsInstallerDefaults): string;
|
|
141
187
|
export declare function renderWindowsAutoexecInstaller(defaults?: {
|
|
142
188
|
evolverBin?: string;
|
|
143
189
|
nodePath?: string;
|
|
@@ -145,7 +191,51 @@ export declare function renderWindowsAutoexecInstaller(defaults?: {
|
|
|
145
191
|
envFile?: string;
|
|
146
192
|
autoexecHome?: string;
|
|
147
193
|
workingDirectory?: string;
|
|
194
|
+
wscriptPath?: string;
|
|
195
|
+
}): string;
|
|
196
|
+
export declare const _renderLegacyWindowsProxyLauncherBytesForTest: typeof renderLegacyWindowsProxyLauncherBytes;
|
|
197
|
+
declare function renderFrozenLegacySystemdUnit(opts: {
|
|
198
|
+
envFile?: string;
|
|
199
|
+
workingDirectory?: string;
|
|
200
|
+
execStart: string;
|
|
201
|
+
lifecycleStateDir?: string;
|
|
202
|
+
selfUpdateStateDir?: string;
|
|
203
|
+
selfUpdateTarget?: string;
|
|
148
204
|
}): string;
|
|
205
|
+
declare function renderFrozenLegacyLaunchdPlist(opts: {
|
|
206
|
+
envFile?: string;
|
|
207
|
+
workingDirectory: string;
|
|
208
|
+
programArguments: readonly string[];
|
|
209
|
+
logDir: string;
|
|
210
|
+
lifecycleStateDir?: string;
|
|
211
|
+
selfUpdateStateDir?: string;
|
|
212
|
+
selfUpdateTarget?: string;
|
|
213
|
+
}): string;
|
|
214
|
+
export declare const _renderFrozenLegacySystemdUnitForTest: typeof renderFrozenLegacySystemdUnit;
|
|
215
|
+
export declare const _renderFrozenLegacyLaunchdPlistForTest: typeof renderFrozenLegacyLaunchdPlist;
|
|
216
|
+
declare function legacyBootstrapArtifactPlan(legacy: LegacyBootstrapMarkerRead, planned: LifecycleResult, target: ServiceTarget, env: NodeJS.ProcessEnv, stateDir: string, legacyWindowsLauncherPath?: string, allowAbsentWindowsManager?: boolean, requireStateRootProof?: boolean, uid?: number): {
|
|
217
|
+
paths: string[];
|
|
218
|
+
expected: Record<string, BootstrapArtifactIdentity>;
|
|
219
|
+
preserved: coreBootstrap.LifecycleBootstrapMarker['artifacts'];
|
|
220
|
+
legacyStateRootProof?: coreBootstrap.LifecycleBootstrapLegacyStateRootProof;
|
|
221
|
+
};
|
|
222
|
+
export declare const _planLegacyBootstrapArtifactsForTest: typeof legacyBootstrapArtifactPlan;
|
|
223
|
+
declare function windowsTaskProbeCommand(): string;
|
|
224
|
+
export declare const _windowsTaskProbeCommandForTest: typeof windowsTaskProbeCommand;
|
|
225
|
+
declare function probeLegacyWindowsLauncherPath(run: (command: string, args: readonly string[], timeoutMs?: number) => ServiceControlResult, timeoutMs: number, expectedEnabled?: boolean): string;
|
|
226
|
+
export declare const _probeLegacyWindowsLauncherPathForTest: typeof probeLegacyWindowsLauncherPath;
|
|
227
|
+
export declare function validateSystemdBootstrapManagerBinding(journal: Pick<BootstrapTransactionJournal, 'transactionId' | 'managerBinding'>, unit: string, stdout: string, requireRunning?: boolean): number | undefined;
|
|
228
|
+
export declare function validateLaunchdBootstrapManagerBinding(journal: Pick<BootstrapTransactionJournal, 'transactionId' | 'managerBinding'>, plist: string, stdout: string, requireRunning?: boolean): number | undefined;
|
|
229
|
+
interface WindowsBootstrapLauncherBinding {
|
|
230
|
+
mode: 'controller' | 'direct';
|
|
231
|
+
proxyExecutable: string;
|
|
232
|
+
proxyScript?: string;
|
|
233
|
+
controllerExecutable?: string;
|
|
234
|
+
lifecycleStateDir?: string;
|
|
235
|
+
selfUpdateStateDir?: string;
|
|
236
|
+
}
|
|
237
|
+
export declare function parseWindowsBootstrapLauncherBinding(journal: Pick<BootstrapTransactionJournal, 'transactionId' | 'managerBinding' | 'artifacts'>, bytes: Buffer): WindowsBootstrapLauncherBinding;
|
|
238
|
+
export declare function bootstrapReadinessMatchesManager(journal: Pick<BootstrapTransactionJournal, 'target' | 'managerBinding' | 'artifacts'>, readiness: coreBootstrap.LifecycleBootstrapReadiness, managerPid: number | undefined): boolean;
|
|
149
239
|
export declare function removeAutoexecService(target: ServiceTarget, dryRun: boolean, deps?: RemoveAutoexecServiceDeps): LifecycleResult;
|
|
150
240
|
export declare function resolveDaemonCommand(env: NodeJS.ProcessEnv, execPath?: string, argv1?: string | undefined): DaemonCommand;
|
|
151
241
|
export declare function resolveSelfUpdatingExecutable(execPath: string, argv1: string | undefined): DaemonCommand | undefined;
|