@evomap/evolver-proxy 2.0.0-beta.2 → 2.0.0-beta.22
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/bin/evolver-llm-proxy.js +0 -0
- package/dist/bin/evolver-proxy.d.ts +105 -7
- package/dist/bin/evolver-proxy.js +877 -121
- package/dist/daemon/atpConsent.js +5 -2
- package/dist/daemon/collaborationFacade.js +26 -16
- package/dist/daemon/proxyDaemon.d.ts +65 -0
- package/dist/daemon/proxyDaemon.js +1384 -29
- package/dist/daemon/publishRecallVerifier.d.ts +114 -0
- package/dist/daemon/publishRecallVerifier.js +495 -0
- package/dist/daemon/selectHub.js +5 -3
- package/dist/daemon/systemdNotifier.d.ts +48 -0
- package/dist/daemon/systemdNotifier.js +163 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/lifecycle/claimNudge.d.ts +20 -0
- package/dist/lifecycle/claimNudge.js +124 -0
- package/dist/lifecycle/legacyNodeId.d.ts +11 -13
- package/dist/lifecycle/legacyNodeId.js +35 -20
- package/dist/lifecycle/manager.d.ts +4 -0
- package/dist/lifecycle/manager.js +15 -2
- package/dist/llm/server.js +24 -4
- package/dist/llm/traceControl.js +1 -1
- package/dist/llm/upstream.d.ts +5 -1
- package/dist/llm/upstream.js +72 -2
- package/dist/private/accountAssetCompatibility.d.ts +29 -0
- package/dist/private/accountAssetCompatibility.js +196 -0
- package/dist/private/adapterLoader.d.ts +21 -1
- package/dist/private/adapterLoader.js +242 -7
- package/dist/private/nodeCredentialStore.d.ts +23 -0
- package/dist/private/nodeCredentialStore.js +210 -0
- package/dist/router/messagesRoute.js +9 -3
- package/dist/router/providerRoutes.js +7 -3
- package/dist/selfUpdate/bootstrap.d.ts +162 -0
- package/dist/selfUpdate/bootstrap.js +3524 -0
- package/dist/selfUpdate/bootstrapReadiness.d.ts +9 -0
- package/dist/selfUpdate/bootstrapReadiness.js +153 -0
- package/dist/selfUpdate/builtinKey.d.ts +4 -0
- package/dist/selfUpdate/builtinKey.js +16 -0
- package/dist/selfUpdate/controllerLifecycleAuthority.d.ts +45 -0
- package/dist/selfUpdate/controllerLifecycleAuthority.js +61 -0
- package/dist/selfUpdate/executor.d.ts +27 -11
- package/dist/selfUpdate/executor.js +233 -58
- package/dist/selfUpdate/failureCodes.d.ts +10 -0
- package/dist/selfUpdate/failureCodes.js +13 -0
- package/dist/selfUpdate/index.d.ts +5 -1
- package/dist/selfUpdate/index.js +5 -1
- package/dist/selfUpdate/lastUpdate.d.ts +3 -1
- package/dist/selfUpdate/lastUpdate.js +37 -6
- package/dist/selfUpdate/migration.d.ts +158 -0
- package/dist/selfUpdate/migration.js +2672 -0
- package/dist/selfUpdate/policy.d.ts +19 -2
- package/dist/selfUpdate/policy.js +76 -2
- package/dist/selfUpdate/recoveryChildStartGate.d.ts +29 -0
- package/dist/selfUpdate/recoveryChildStartGate.js +319 -0
- package/dist/selfUpdate/releaseBinary.d.ts +13 -0
- package/dist/selfUpdate/releaseBinary.js +93 -10
- package/dist/selfUpdate/transaction.d.ts +117 -0
- package/dist/selfUpdate/transaction.js +1322 -0
- package/dist/selfUpdate/unixController.d.ts +23 -0
- package/dist/selfUpdate/unixController.js +514 -0
- package/dist/selfUpdate/version.d.ts +6 -2
- package/dist/selfUpdate/version.js +5 -3
- package/dist/selfUpdate/windowsController.d.ts +35 -0
- package/dist/selfUpdate/windowsController.js +655 -0
- package/dist/selfUpdate/windowsUpdater.d.ts +104 -0
- package/dist/selfUpdate/windowsUpdater.js +882 -0
- package/dist/sync/engine.d.ts +12 -0
- package/dist/sync/engine.js +255 -64
- package/package.json +10 -3
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { type spawn } from 'node:child_process';
|
|
2
|
+
import { ops } from '@evomap/evolver-core';
|
|
3
|
+
import type { DownloadResult, ForceUpdateDirective } from './executor.js';
|
|
4
|
+
import { type ReleaseBinaryOptions } from './releaseBinary.js';
|
|
5
|
+
import { type StagedBinaryProbe } from './transaction.js';
|
|
6
|
+
type DownloadedArtifact = ops.DownloadedArtifact;
|
|
7
|
+
type VerifyResult = ops.VerifyResult;
|
|
8
|
+
type FetchFn = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
9
|
+
/** Minimal stat shape migration needs (symlink guard + regular-file check). */
|
|
10
|
+
interface MigrationFileStat {
|
|
11
|
+
isFile(): boolean;
|
|
12
|
+
isSymbolicLink(): boolean;
|
|
13
|
+
isDirectory?(): boolean;
|
|
14
|
+
size?: number;
|
|
15
|
+
}
|
|
16
|
+
interface MigrationTargetIdentity {
|
|
17
|
+
path: string;
|
|
18
|
+
device: string;
|
|
19
|
+
inode: string;
|
|
20
|
+
size: number;
|
|
21
|
+
linkCount: 1;
|
|
22
|
+
mtimeNs: string;
|
|
23
|
+
ctimeNs: string;
|
|
24
|
+
sha256: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Registration is delegated to the same transaction runner used by ordinary first-run
|
|
28
|
+
* bootstrap. The absolute deadlines are part of this request so an adapter cannot silently
|
|
29
|
+
* restart either observation budget during registration and reconciliation.
|
|
30
|
+
*/
|
|
31
|
+
export interface MigrationRegistrationRequest {
|
|
32
|
+
env: NodeJS.ProcessEnv;
|
|
33
|
+
platform: NodeJS.Platform;
|
|
34
|
+
version: string;
|
|
35
|
+
startedAtMs: number;
|
|
36
|
+
transactionDeadlineMs: number;
|
|
37
|
+
parentDeadlineMs: number;
|
|
38
|
+
transactionBudgetMs: number;
|
|
39
|
+
timeoutMs: number;
|
|
40
|
+
/** Exact signed target identity the runner must revalidate before spawning the child. */
|
|
41
|
+
targetIdentity: Readonly<MigrationTargetIdentity>;
|
|
42
|
+
/** Sealed verifier over the original identity/dependencies; call immediately before spawn. */
|
|
43
|
+
revalidateTarget: () => Promise<void>;
|
|
44
|
+
/** Sealed durable-intent verifier; call immediately before target revalidation and spawn. */
|
|
45
|
+
assertRegistrationIntentCurrent: () => Promise<void>;
|
|
46
|
+
execPath: string;
|
|
47
|
+
exists?: (path: string) => boolean;
|
|
48
|
+
readFile?: (path: string) => string;
|
|
49
|
+
writeFile?: (path: string, content: string) => void;
|
|
50
|
+
spawnFn?: typeof spawn;
|
|
51
|
+
}
|
|
52
|
+
interface MigrationRegistrationOutcome {
|
|
53
|
+
ok: boolean;
|
|
54
|
+
reason: string;
|
|
55
|
+
detail?: string;
|
|
56
|
+
/** The runner could not prove child/process-tree ownership or a clean rollback. */
|
|
57
|
+
requiresForegroundExit?: true;
|
|
58
|
+
}
|
|
59
|
+
export type MigrationRegistrationRunner = (request: MigrationRegistrationRequest) => Promise<MigrationRegistrationOutcome>;
|
|
60
|
+
export interface MigrationOptions {
|
|
61
|
+
/** Arch override for release asset resolution (defaults to process.arch). */
|
|
62
|
+
arch?: NodeJS.Architecture;
|
|
63
|
+
exists?: (path: string) => boolean;
|
|
64
|
+
/** Sync text read (bootstrap.ts mirror); used for container detection. */
|
|
65
|
+
readFile?: (path: string) => string;
|
|
66
|
+
/** Sync text write seam for attempt markers and canonical migration state. */
|
|
67
|
+
writeFile?: (path: string, content: string) => void;
|
|
68
|
+
/** Async binary read of the staged artifact (install copy). */
|
|
69
|
+
readBinary?: (path: string) => Promise<Buffer>;
|
|
70
|
+
/** Async binary write with mode (install tmp copy). */
|
|
71
|
+
writeBinary?: (path: string, content: Buffer, mode: number) => Promise<void>;
|
|
72
|
+
/** Recursive mkdir with mode (install dest dir). */
|
|
73
|
+
mkdir?: (path: string, mode: number) => Promise<void>;
|
|
74
|
+
/** Force/recursive removal (staged tmp dir, leftover tmp copies). */
|
|
75
|
+
rm?: (path: string) => Promise<void>;
|
|
76
|
+
/** Owner-verified installed target removal after a proven clean registration rollback. */
|
|
77
|
+
unlink?: (path: string) => Promise<void>;
|
|
78
|
+
/** Remove a transaction-created empty bin directory after clean rollback. */
|
|
79
|
+
rmdir?: (path: string) => Promise<void>;
|
|
80
|
+
chmod?: (path: string, mode: number) => Promise<void>;
|
|
81
|
+
/** Flush staged executable data/metadata before namespace publication. */
|
|
82
|
+
syncFile?: (path: string) => Promise<void>;
|
|
83
|
+
/** Flush target namespace mutations; Windows may use a documented no-op fallback. */
|
|
84
|
+
syncDirectory?: (path: string) => Promise<void>;
|
|
85
|
+
/** lstat-shaped stat for the staged-artifact symlink guard. */
|
|
86
|
+
stat?: (path: string) => Promise<MigrationFileStat>;
|
|
87
|
+
/** Atomic no-replace publication seam. */
|
|
88
|
+
link?: (from: string, to: string) => Promise<void>;
|
|
89
|
+
/** Atomic same-directory move used by exact rollback quarantine. */
|
|
90
|
+
rename?: (from: string, to: string) => Promise<void>;
|
|
91
|
+
fetchFn?: FetchFn;
|
|
92
|
+
/** Probe used by the default preflight (real execution of `--version` / `proxy --help`). */
|
|
93
|
+
probe?: StagedBinaryProbe;
|
|
94
|
+
spawnFn?: typeof spawn;
|
|
95
|
+
now?: number;
|
|
96
|
+
/** Clock used to bind the registration runner to absolute deadlines. */
|
|
97
|
+
clock?: () => number;
|
|
98
|
+
execPath?: string;
|
|
99
|
+
/** Effective uid (tests / platforms without process.getuid). */
|
|
100
|
+
uid?: number | undefined;
|
|
101
|
+
/** Parent register timeout; must exceed transactionBudgetMs. */
|
|
102
|
+
timeoutMs?: number;
|
|
103
|
+
/** Child transaction budget; defaults to MIGRATION_REGISTER_TRANSACTION_BUDGET_MS. */
|
|
104
|
+
transactionBudgetMs?: number;
|
|
105
|
+
/** Durable reconciliation + process-tree-contained registration runner. */
|
|
106
|
+
registrationRunner?: MigrationRegistrationRunner;
|
|
107
|
+
/** Test seam for platform ownership/ACL validation; production uses strict host checks. */
|
|
108
|
+
assertDirectoryTrust?: (directory: string) => void | Promise<void>;
|
|
109
|
+
/** Test seam for executable ownership/ACL validation; production uses strict host checks. */
|
|
110
|
+
assertFileTrust?: (path: string) => void | Promise<void>;
|
|
111
|
+
/** Sync test seam for canonical state-directory ownership/ACL validation. */
|
|
112
|
+
assertStateDirectoryTrust?: (directory: string) => void;
|
|
113
|
+
/** Sync test seam for canonical state-file ownership/ACL validation. */
|
|
114
|
+
assertStateFileTrust?: (path: string) => void;
|
|
115
|
+
/** High-level seam: download leg (defaults to downloadGithubReleaseArtifact). */
|
|
116
|
+
downloadFn?: (targetVersion: string, directive: ForceUpdateDirective, opts: ReleaseBinaryOptions) => Promise<DownloadResult>;
|
|
117
|
+
/** High-level seam: manifest verification (defaults to ops.verifySelectedManifestArtifact). */
|
|
118
|
+
verifyFn?: (manifest: unknown, downloaded: readonly DownloadedArtifact[], publicKey: string) => VerifyResult;
|
|
119
|
+
/** High-level seam: preflight (defaults to preflightManagedStagedBinary with options.probe). */
|
|
120
|
+
preflightFn?: (targetPath: string, expectedVersion: string) => Promise<void>;
|
|
121
|
+
}
|
|
122
|
+
export interface MigrationResult {
|
|
123
|
+
outcome: 'migrated' | 'skipped' | 'failed';
|
|
124
|
+
/**
|
|
125
|
+
* Structured reason: 'migrated' / 'disabled' / 'root_user' / 'ci_environment' /
|
|
126
|
+
* 'container_environment' / 'cooldown' / 'unsupported_platform' /
|
|
127
|
+
* 'invalid_version_override' / 'version_unresolvable' /
|
|
128
|
+
* 'migration_download_failed:<detail>' / 'migration_verify_failed:<reason>' /
|
|
129
|
+
* 'migration_install_failed:<detail>' / 'migration_register_failed:<detail>' /
|
|
130
|
+
* 'migration_register_timeout'.
|
|
131
|
+
*/
|
|
132
|
+
reason: string;
|
|
133
|
+
destPath?: string;
|
|
134
|
+
/** Registration ownership is ambiguous, so the foreground proxy must not continue. */
|
|
135
|
+
requiresForegroundExit?: true;
|
|
136
|
+
/** Operator-facing message (short phrase for skipped/failed; full line for migrated). */
|
|
137
|
+
message: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Migration install home — mirrors the CLI-side lifecyclePaths home resolution
|
|
141
|
+
* (kept dependency-free across packages): EVOLVER_HOME ?? EVOMAP_HOME ?? ~/.evomap.
|
|
142
|
+
*/
|
|
143
|
+
export declare function resolveMigrationHome(env: NodeJS.ProcessEnv): string;
|
|
144
|
+
/** Migration install path for this platform: <home>/bin/<releaseAssetName>. Throws on unsupported platforms. */
|
|
145
|
+
export declare function resolveMigrationDestPath(env: NodeJS.ProcessEnv, platform?: NodeJS.Platform, arch?: NodeJS.Architecture): string;
|
|
146
|
+
/**
|
|
147
|
+
* Resolve the migration target version: EVOLVER_BOOTSTRAP_MIGRATION_VERSION override
|
|
148
|
+
* (normalized through the self-update version contract) wins, else the current package
|
|
149
|
+
* version. Returns undefined when nothing normalizes to a concrete semver.
|
|
150
|
+
*/
|
|
151
|
+
export declare function resolveMigrationVersion(env: NodeJS.ProcessEnv): string | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* One-time migration of the npm/JS install shape to the standalone release binary.
|
|
154
|
+
* Never throws: every failure/skip becomes a structured MigrationResult. Only a proven clean
|
|
155
|
+
* failure may continue degraded; ambiguous registration ownership requires foreground exit.
|
|
156
|
+
*/
|
|
157
|
+
export declare function migrateToStandaloneBinary(env: NodeJS.ProcessEnv, platform?: NodeJS.Platform, options?: MigrationOptions): Promise<MigrationResult>;
|
|
158
|
+
export {};
|