@vtxmacro/cli 2026.10.5 → 2026.10.7
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/README.md +10 -0
- package/bin/vtx-mcp.js +3268 -759
- package/bin/vtx-service-bootstrap.js +387 -379
- package/bin/vtx-service-launcher.js +55 -0
- package/bin/vtx.js +17927 -16686
- package/package.json +1 -1
|
@@ -1,121 +1,20 @@
|
|
|
1
1
|
import { createRequire as __vtxCreateRequire } from 'node:module'; const require = __vtxCreateRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// lib/inference-host/service-bootstrap.ts
|
|
4
|
-
import { spawn as
|
|
5
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
4
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
6
5
|
import {
|
|
7
|
-
access as
|
|
8
|
-
appendFile,
|
|
9
|
-
mkdir as
|
|
10
|
-
readFile as
|
|
11
|
-
readdir as
|
|
12
|
-
|
|
13
|
-
rm as rm3
|
|
6
|
+
access as access3,
|
|
7
|
+
appendFile as appendFile2,
|
|
8
|
+
mkdir as mkdir3,
|
|
9
|
+
readFile as readFile4,
|
|
10
|
+
readdir as readdir3,
|
|
11
|
+
rm as rm4
|
|
14
12
|
} from "node:fs/promises";
|
|
15
|
-
import { dirname as
|
|
13
|
+
import { dirname as dirname4, relative as relative4, resolve as resolve4 } from "node:path";
|
|
16
14
|
import { fileURLToPath } from "node:url";
|
|
17
15
|
|
|
18
16
|
// agent-cli-release.json
|
|
19
|
-
var agent_cli_release_default = {
|
|
20
|
-
package_name: "@vtxmacro/cli",
|
|
21
|
-
package_version: "2026.10.5",
|
|
22
|
-
codex_package_name: "@openai/codex",
|
|
23
|
-
codex_version: "0.155.0",
|
|
24
|
-
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
25
|
-
copilot_sdk_version: "1.0.0-beta.8",
|
|
26
|
-
copilot_cli_package_name: "@github/copilot",
|
|
27
|
-
copilot_cli_version: "1.0.80",
|
|
28
|
-
deepseek_harness_version: "0.1.1-rc.2",
|
|
29
|
-
deepseek_harness_packages: [
|
|
30
|
-
"@deepseek-ai/dsh-agent",
|
|
31
|
-
"@deepseek-ai/dsh-agent-instructions",
|
|
32
|
-
"@deepseek-ai/dsh-agent-loop",
|
|
33
|
-
"@deepseek-ai/dsh-agent-spine-demo",
|
|
34
|
-
"@deepseek-ai/dsh-anonymous-user-id",
|
|
35
|
-
"@deepseek-ai/dsh-atomic-write",
|
|
36
|
-
"@deepseek-ai/dsh-attachment",
|
|
37
|
-
"@deepseek-ai/dsh-brand",
|
|
38
|
-
"@deepseek-ai/dsh-code-runtime",
|
|
39
|
-
"@deepseek-ai/dsh-credentials",
|
|
40
|
-
"@deepseek-ai/dsh-fs",
|
|
41
|
-
"@deepseek-ai/dsh-goal",
|
|
42
|
-
"@deepseek-ai/dsh-goal-round-driver",
|
|
43
|
-
"@deepseek-ai/dsh-home-paths",
|
|
44
|
-
"@deepseek-ai/dsh-invariants",
|
|
45
|
-
"@deepseek-ai/dsh-jobs",
|
|
46
|
-
"@deepseek-ai/dsh-jobs-local",
|
|
47
|
-
"@deepseek-ai/dsh-launch-environment",
|
|
48
|
-
"@deepseek-ai/dsh-llm",
|
|
49
|
-
"@deepseek-ai/dsh-llm-deepseek",
|
|
50
|
-
"@deepseek-ai/dsh-llm-retry",
|
|
51
|
-
"@deepseek-ai/dsh-output-retention",
|
|
52
|
-
"@deepseek-ai/dsh-sandbox",
|
|
53
|
-
"@deepseek-ai/dsh-sandbox-policy",
|
|
54
|
-
"@deepseek-ai/dsh-scope",
|
|
55
|
-
"@deepseek-ai/dsh-session",
|
|
56
|
-
"@deepseek-ai/dsh-session-checkpoint-policy",
|
|
57
|
-
"@deepseek-ai/dsh-session-persistence",
|
|
58
|
-
"@deepseek-ai/dsh-session-persistence-jsonl",
|
|
59
|
-
"@deepseek-ai/dsh-session-projection",
|
|
60
|
-
"@deepseek-ai/dsh-session-title",
|
|
61
|
-
"@deepseek-ai/dsh-settings",
|
|
62
|
-
"@deepseek-ai/dsh-shell",
|
|
63
|
-
"@deepseek-ai/dsh-shell-env",
|
|
64
|
-
"@deepseek-ai/dsh-skill",
|
|
65
|
-
"@deepseek-ai/dsh-skill-filesystem",
|
|
66
|
-
"@deepseek-ai/dsh-subprocess",
|
|
67
|
-
"@deepseek-ai/dsh-system-prompt",
|
|
68
|
-
"@deepseek-ai/dsh-timeout",
|
|
69
|
-
"@deepseek-ai/dsh-tool-bash",
|
|
70
|
-
"@deepseek-ai/dsh-tool-goal",
|
|
71
|
-
"@deepseek-ai/dsh-tool-jobs",
|
|
72
|
-
"@deepseek-ai/dsh-tool-skill",
|
|
73
|
-
"@deepseek-ai/dsh-tools",
|
|
74
|
-
"@deepseek-ai/dsh-typert-protocol",
|
|
75
|
-
"@deepseek-ai/dsh-user-approval"
|
|
76
|
-
],
|
|
77
|
-
deepseek_cordis_package_name: "@deepseek-ai/cordis",
|
|
78
|
-
deepseek_cordis_version: "4.0.1",
|
|
79
|
-
deepseek_support_packages: {
|
|
80
|
-
"@deepseek-ai/cordis-plugin-timer": "1.1.3"
|
|
81
|
-
},
|
|
82
|
-
platforms: {
|
|
83
|
-
"linux-x64": {
|
|
84
|
-
package_name: "@openai/codex-linux-x64",
|
|
85
|
-
target: "x86_64-unknown-linux-musl",
|
|
86
|
-
binary_name: "codex",
|
|
87
|
-
sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501"
|
|
88
|
-
},
|
|
89
|
-
"win32-x64": {
|
|
90
|
-
package_name: "@openai/codex-win32-x64",
|
|
91
|
-
target: "x86_64-pc-windows-msvc",
|
|
92
|
-
binary_name: "codex.exe",
|
|
93
|
-
sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
pi_coding_agent_package_name: "@earendil-works/pi-coding-agent",
|
|
97
|
-
pi_ai_package_name: "@earendil-works/pi-ai",
|
|
98
|
-
pi_version: "0.85.1",
|
|
99
|
-
pi_support_packages: [
|
|
100
|
-
"@earendil-works/pi-agent-core",
|
|
101
|
-
"@earendil-works/pi-telemetry",
|
|
102
|
-
"@earendil-works/pi-tui",
|
|
103
|
-
"@earendil-works/chord"
|
|
104
|
-
],
|
|
105
|
-
grok_version: "1.0.30",
|
|
106
|
-
grok_platforms: {
|
|
107
|
-
"linux-x64": {
|
|
108
|
-
package_name: "@xai-official/grok-linux-x64",
|
|
109
|
-
binary_name: "grok",
|
|
110
|
-
sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54"
|
|
111
|
-
},
|
|
112
|
-
"win32-x64": {
|
|
113
|
-
package_name: "@xai-official/grok-win32-x64",
|
|
114
|
-
binary_name: "grok.exe",
|
|
115
|
-
sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867"
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
};
|
|
17
|
+
var agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.7", codex_package_name: "@openai/codex", codex_version: "0.155.0", copilot_sdk_package_name: "@github/copilot-sdk", copilot_sdk_version: "1.0.0-beta.8", copilot_cli_package_name: "@github/copilot", copilot_cli_version: "1.0.80", deepseek_harness_version: "0.1.1-rc.2", deepseek_harness_packages: ["@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-loop", "@deepseek-ai/dsh-agent-spine-demo", "@deepseek-ai/dsh-anonymous-user-id", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-attachment", "@deepseek-ai/dsh-brand", "@deepseek-ai/dsh-code-runtime", "@deepseek-ai/dsh-credentials", "@deepseek-ai/dsh-fs", "@deepseek-ai/dsh-goal", "@deepseek-ai/dsh-goal-round-driver", "@deepseek-ai/dsh-home-paths", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-jobs", "@deepseek-ai/dsh-jobs-local", "@deepseek-ai/dsh-launch-environment", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-deepseek", "@deepseek-ai/dsh-llm-retry", "@deepseek-ai/dsh-output-retention", "@deepseek-ai/dsh-sandbox", "@deepseek-ai/dsh-sandbox-policy", "@deepseek-ai/dsh-scope", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-session-checkpoint-policy", "@deepseek-ai/dsh-session-persistence", "@deepseek-ai/dsh-session-persistence-jsonl", "@deepseek-ai/dsh-session-projection", "@deepseek-ai/dsh-session-title", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-shell", "@deepseek-ai/dsh-shell-env", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-skill-filesystem", "@deepseek-ai/dsh-subprocess", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-timeout", "@deepseek-ai/dsh-tool-bash", "@deepseek-ai/dsh-tool-goal", "@deepseek-ai/dsh-tool-jobs", "@deepseek-ai/dsh-tool-skill", "@deepseek-ai/dsh-tools", "@deepseek-ai/dsh-typert-protocol", "@deepseek-ai/dsh-user-approval"], deepseek_cordis_package_name: "@deepseek-ai/cordis", deepseek_cordis_version: "4.0.1", deepseek_support_packages: { "@deepseek-ai/cordis-plugin-timer": "1.1.3" }, platforms: { "linux-x64": { package_name: "@openai/codex-linux-x64", target: "x86_64-unknown-linux-musl", binary_name: "codex", sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501" }, "win32-x64": { package_name: "@openai/codex-win32-x64", target: "x86_64-pc-windows-msvc", binary_name: "codex.exe", sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b" } }, pi_coding_agent_package_name: "@earendil-works/pi-coding-agent", pi_ai_package_name: "@earendil-works/pi-ai", pi_version: "0.85.1", pi_support_packages: ["@earendil-works/pi-agent-core", "@earendil-works/pi-telemetry", "@earendil-works/pi-tui", "@earendil-works/chord"], grok_version: "1.0.30", grok_platforms: { "linux-x64": { package_name: "@xai-official/grok-linux-x64", binary_name: "grok", sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54" }, "win32-x64": { package_name: "@xai-official/grok-win32-x64", binary_name: "grok.exe", sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867" } } };
|
|
119
18
|
|
|
120
19
|
// lib/runtime-policy.generated.json
|
|
121
20
|
var runtime_policy_generated_default = {
|
|
@@ -213,6 +112,17 @@ var runtime_policy_generated_default = {
|
|
|
213
112
|
history_evidence: {
|
|
214
113
|
device_rounds_per_beat: 6,
|
|
215
114
|
device_retry_seconds: 60
|
|
115
|
+
},
|
|
116
|
+
panel_reads: {
|
|
117
|
+
device_open_orders_reuse_seconds: 2
|
|
118
|
+
},
|
|
119
|
+
account_stream: {
|
|
120
|
+
fill_forward_interval_ms: 1e3,
|
|
121
|
+
fill_forward_max_pending: 500
|
|
122
|
+
},
|
|
123
|
+
hyperliquid_snapshot: {
|
|
124
|
+
max_fills_per_execution: 20,
|
|
125
|
+
max_fill_payload_bytes: 32768
|
|
216
126
|
}
|
|
217
127
|
},
|
|
218
128
|
server_runtime: {
|
|
@@ -227,6 +137,23 @@ var runtime_policy_generated_default = {
|
|
|
227
137
|
client_presence_http_timeout_milliseconds: 5e3
|
|
228
138
|
}
|
|
229
139
|
}
|
|
140
|
+
},
|
|
141
|
+
history_reads: {
|
|
142
|
+
max_requests_per_read: 64,
|
|
143
|
+
history_start_ms: 16409952e5,
|
|
144
|
+
device_read_deadline_seconds: 180,
|
|
145
|
+
device_recent_window_hours: 24
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
agent_cli: {
|
|
149
|
+
update_check_interval_ms: 144e5,
|
|
150
|
+
update_check_timeout_ms: 5e3,
|
|
151
|
+
stage_timeout_ms: 6e5,
|
|
152
|
+
startup_ready_timeout_ms: 12e4
|
|
153
|
+
},
|
|
154
|
+
leaderboard: {
|
|
155
|
+
device_portfolio: {
|
|
156
|
+
device_retry_seconds: 300
|
|
230
157
|
}
|
|
231
158
|
},
|
|
232
159
|
external_inference: {
|
|
@@ -250,6 +177,9 @@ var runtime_policy_generated_default = {
|
|
|
250
177
|
runtime_watchdog: {
|
|
251
178
|
ping_interval_milliseconds: 15e3,
|
|
252
179
|
telemetry_interval_milliseconds: 3e5
|
|
180
|
+
},
|
|
181
|
+
updates: {
|
|
182
|
+
auto_check_interval_seconds: 21600
|
|
253
183
|
}
|
|
254
184
|
},
|
|
255
185
|
screener: {
|
|
@@ -272,6 +202,8 @@ var runtime_policy_generated_default = {
|
|
|
272
202
|
client_public_read_budget: {
|
|
273
203
|
max_weight: 1200,
|
|
274
204
|
window_seconds: 60,
|
|
205
|
+
ui_max_weight_percent: 75,
|
|
206
|
+
background_max_weight_percent: 50,
|
|
275
207
|
cooldown_seconds: 60,
|
|
276
208
|
metadata_ttl_seconds: 300,
|
|
277
209
|
user_fees_ttl_seconds: 300,
|
|
@@ -343,14 +275,38 @@ var runtime_policy_generated_default = {
|
|
|
343
275
|
trading_analysis: 4,
|
|
344
276
|
ui: 5,
|
|
345
277
|
background: 6
|
|
278
|
+
},
|
|
279
|
+
account_stream_backoff: {
|
|
280
|
+
initial_seconds: 1,
|
|
281
|
+
max_seconds: 15,
|
|
282
|
+
multiplier: 2,
|
|
283
|
+
jitter_seconds: 2,
|
|
284
|
+
reset_after_seconds: 60
|
|
285
|
+
},
|
|
286
|
+
websocket: {
|
|
287
|
+
ping_interval_seconds: 20,
|
|
288
|
+
account_open_timeout_seconds: 10
|
|
346
289
|
}
|
|
290
|
+
},
|
|
291
|
+
cache: {
|
|
292
|
+
order_history_ttl_seconds: 30,
|
|
293
|
+
twap_history_ttl_seconds: 30,
|
|
294
|
+
twap_fills_ttl_seconds: 30,
|
|
295
|
+
funding_history_ttl_seconds: 300
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
data_sync: {
|
|
299
|
+
trade_chain_history: {
|
|
300
|
+
range_page_limit: 500
|
|
347
301
|
}
|
|
348
302
|
}
|
|
349
303
|
};
|
|
350
304
|
|
|
351
|
-
// lib/
|
|
352
|
-
import {
|
|
353
|
-
import {
|
|
305
|
+
// lib/cli-release/updater.ts
|
|
306
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
307
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
308
|
+
import { access, appendFile, chmod, lstat as lstat2, mkdir as mkdir2, readFile as readFile2, readdir as readdir2, realpath as realpath2, rename as rename2, rm as rm2 } from "node:fs/promises";
|
|
309
|
+
import { dirname as dirname2, isAbsolute as isAbsolute2, join as join2, relative as relative2, resolve as resolve2, win32 as windowsPath2 } from "node:path";
|
|
354
310
|
|
|
355
311
|
// lib/inference-host/config.ts
|
|
356
312
|
import { randomBytes } from "node:crypto";
|
|
@@ -980,7 +936,7 @@ var WINDOWS_PRIVATE_FILE_REPLACE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
980
936
|
async function replaceAtomicInferencePrivateFile(temporaryPath, destinationPath, options = {}) {
|
|
981
937
|
const platform = options.platform ?? process.platform;
|
|
982
938
|
const renameFile = options.renameFile ?? rename;
|
|
983
|
-
const sleep = options.sleep ?? ((milliseconds) => new Promise((
|
|
939
|
+
const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve5) => setTimeout(resolve5, milliseconds)));
|
|
984
940
|
const maxAttempts = Math.max(1, options.maxAttempts ?? 40);
|
|
985
941
|
const retryDelayMs = Math.max(0, options.retryDelayMs ?? 25);
|
|
986
942
|
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
@@ -1386,118 +1342,22 @@ async function acquireInferenceHostProcessLock(path, dependencies = {}) {
|
|
|
1386
1342
|
};
|
|
1387
1343
|
}
|
|
1388
1344
|
|
|
1389
|
-
// lib/
|
|
1390
|
-
var
|
|
1391
|
-
if (!manifest.endsWith(".service.json")) throw new Error("Invalid service manifest path.");
|
|
1392
|
-
return `${manifest.slice(0, -".service.json".length)}${suffix}`;
|
|
1393
|
-
};
|
|
1394
|
-
var within = (parent, child) => {
|
|
1395
|
-
const part = relative2(resolve2(parent), resolve2(child));
|
|
1396
|
-
return Boolean(part) && !part.startsWith("..") && !isAbsolute2(part);
|
|
1397
|
-
};
|
|
1398
|
-
var launcherSelection = (manifest, value) => {
|
|
1399
|
-
if (!value || typeof value !== "object") return null;
|
|
1400
|
-
const r = value;
|
|
1401
|
-
if (r.schema_version !== "vtx_inference_service_release_v1" || r.package_name !== "@vtxmacro/cli" || typeof r.package_version !== "string" || !/^\d{4}\.\d{1,2}\.\d{1,3}$/u.test(r.package_version) || typeof r.integrity !== "string" || typeof r.selected_at !== "string" || !Number.isFinite(Date.parse(r.selected_at)) || typeof r.script !== "string" || !isAbsolute2(r.script) || /[\r\n\0]/u.test(r.script) || !within(launcherSibling(manifest, ".service-releases"), r.script)) return null;
|
|
1402
|
-
return r;
|
|
1403
|
-
};
|
|
1404
|
-
var readLauncherState = async (manifest) => {
|
|
1405
|
-
let value;
|
|
1406
|
-
try {
|
|
1407
|
-
value = JSON.parse(await readFile2(launcherSibling(manifest, ".service-launcher.json"), "utf8"));
|
|
1408
|
-
} catch (error) {
|
|
1409
|
-
if (error.code === "ENOENT") return null;
|
|
1410
|
-
throw error;
|
|
1411
|
-
}
|
|
1412
|
-
if (!value || typeof value !== "object") throw new Error("Invalid service launcher state.");
|
|
1413
|
-
const r = value;
|
|
1414
|
-
const target = (v) => {
|
|
1415
|
-
if (!v || typeof v !== "object") return false;
|
|
1416
|
-
const t = v;
|
|
1417
|
-
return typeof t.package_version === "string" && /^\d{4}\.\d{1,2}\.\d{1,3}$/u.test(t.package_version) && typeof t.script === "string" && isAbsolute2(t.script) && !/[\r\n\0]/u.test(t.script) && (within(launcherSibling(manifest, ".service-releases"), t.script) || resolve2(t.script) === resolve2(launcherSibling(manifest, ".service-bootstrap.previous.js"))) && (t.selection === null || (() => {
|
|
1418
|
-
const selected = launcherSelection(manifest, t.selection);
|
|
1419
|
-
return Boolean(selected && selected.package_version === t.package_version && (resolve2(t.script) === resolve2(join2(dirname2(selected.script), "vtx-service-bootstrap.js")) || resolve2(t.script) === resolve2(launcherSibling(manifest, ".service-bootstrap.previous.js"))));
|
|
1420
|
-
})());
|
|
1421
|
-
};
|
|
1422
|
-
if (r.schema_version !== "vtx_inference_service_launcher_v1" || !target(r.active) || r.previous !== null && !target(r.previous) || typeof r.pending !== "boolean") {
|
|
1423
|
-
throw new Error("Invalid service launcher recovery targets.");
|
|
1424
|
-
}
|
|
1425
|
-
return r;
|
|
1426
|
-
};
|
|
1427
|
-
|
|
1428
|
-
// lib/inference-host/service-bootstrap.ts
|
|
1345
|
+
// lib/cli-release/updater.ts
|
|
1346
|
+
var CLI_PACKAGE_NAME = "@vtxmacro/cli";
|
|
1429
1347
|
var OFFICIAL_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
1430
|
-
var
|
|
1431
|
-
var
|
|
1432
|
-
var UPDATE_RETRY_MS = 2e3;
|
|
1433
|
-
var CANDIDATE_READINESS_TIMEOUT_MS = runtime_policy_generated_default.external_inference.service.bootstrap_readiness_timeout_ms;
|
|
1434
|
-
var SERVICE_DRAIN_COMMAND = "vtx-inference-host-service-drain-v1";
|
|
1435
|
-
var SERVICE_QUIESCE_COMMAND = "vtx-inference-host-service-quiesce-v1";
|
|
1436
|
-
var safePath = (value, label) => {
|
|
1437
|
-
if (typeof value !== "string" || !value || /[\r\n\0]/u.test(value)) {
|
|
1438
|
-
throw new Error(`Inference-host bootstrap ${label} is invalid.`);
|
|
1439
|
-
}
|
|
1440
|
-
return resolve3(value);
|
|
1441
|
-
};
|
|
1442
|
-
var parseManifest = (value) => {
|
|
1443
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1444
|
-
throw new Error("Inference-host bootstrap manifest is invalid.");
|
|
1445
|
-
}
|
|
1446
|
-
const record = value;
|
|
1447
|
-
if (!["vtx_inference_service_v1", "vtx_inference_service_v2", "vtx_inference_service_v3"].includes(String(record.schema_version))) {
|
|
1448
|
-
throw new Error("Inference-host bootstrap manifest version is unsupported.");
|
|
1449
|
-
}
|
|
1450
|
-
return {
|
|
1451
|
-
generation: typeof record.generation === "string" && record.generation ? record.generation : `legacy:${String(record.installed_at ?? "")}`,
|
|
1452
|
-
executable: safePath(record.executable, "executable"),
|
|
1453
|
-
script: safePath(record.script, "script"),
|
|
1454
|
-
log_path: safePath(record.log_path, "log path"),
|
|
1455
|
-
worker_names: Array.isArray(record.workers) ? record.workers.map((worker) => {
|
|
1456
|
-
if (!worker || typeof worker !== "object" || Array.isArray(worker)) {
|
|
1457
|
-
throw new Error("Inference-host bootstrap worker is invalid.");
|
|
1458
|
-
}
|
|
1459
|
-
const instanceName = worker.instance_name;
|
|
1460
|
-
if (typeof instanceName !== "string" || !instanceName) {
|
|
1461
|
-
throw new Error("Inference-host bootstrap worker is invalid.");
|
|
1462
|
-
}
|
|
1463
|
-
return instanceName;
|
|
1464
|
-
}).sort() : ["default"]
|
|
1465
|
-
};
|
|
1466
|
-
};
|
|
1467
|
-
var serviceSiblingPath = (manifestPath, suffix) => {
|
|
1468
|
-
if (!manifestPath.endsWith(".service.json")) {
|
|
1469
|
-
throw new Error("Inference-host bootstrap manifest path is invalid.");
|
|
1470
|
-
}
|
|
1471
|
-
return `${manifestPath.slice(0, -".service.json".length)}${suffix}`;
|
|
1472
|
-
};
|
|
1473
|
-
var desiredPathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-desired.json");
|
|
1474
|
-
var selectionPathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-release.json");
|
|
1475
|
-
var releasesPathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-releases");
|
|
1476
|
-
var rejectionPathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-release-rejection.json");
|
|
1477
|
-
var runtimePathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-runtime.json");
|
|
1478
|
-
var readDesired = async (manifestPath) => {
|
|
1479
|
-
const value = JSON.parse(await readFile3(desiredPathFor(manifestPath), "utf8"));
|
|
1480
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1481
|
-
throw new Error("Inference-host bootstrap desired state is invalid.");
|
|
1482
|
-
}
|
|
1483
|
-
const record = value;
|
|
1484
|
-
if (record.schema_version !== "vtx_inference_service_desired_v1" || typeof record.desired_running !== "boolean") {
|
|
1485
|
-
throw new Error("Inference-host bootstrap desired state is invalid.");
|
|
1486
|
-
}
|
|
1487
|
-
return record.desired_running;
|
|
1488
|
-
};
|
|
1489
|
-
var parseVersion = (value) => {
|
|
1348
|
+
var CLI_UPDATE_COMMAND = `npm install -g ${CLI_PACKAGE_NAME}@latest`;
|
|
1349
|
+
var parseCliReleaseVersion = (value) => {
|
|
1490
1350
|
const match = /^(\d{4})\.(\d{1,2})\.(\d{1,3})$/u.exec(value);
|
|
1491
1351
|
if (!match) return null;
|
|
1492
1352
|
const values = match.slice(1).map(Number);
|
|
1493
1353
|
if (values.some((entry) => !Number.isSafeInteger(entry) || entry < 0)) return null;
|
|
1494
1354
|
return values;
|
|
1495
1355
|
};
|
|
1496
|
-
var
|
|
1497
|
-
const leftParts =
|
|
1498
|
-
const rightParts =
|
|
1356
|
+
var compareCliReleaseVersions = (left, right) => {
|
|
1357
|
+
const leftParts = parseCliReleaseVersion(left);
|
|
1358
|
+
const rightParts = parseCliReleaseVersion(right);
|
|
1499
1359
|
if (!leftParts || !rightParts) {
|
|
1500
|
-
throw new Error("
|
|
1360
|
+
throw new Error("CLI release version is invalid.");
|
|
1501
1361
|
}
|
|
1502
1362
|
for (let index = 0; index < leftParts.length; index += 1) {
|
|
1503
1363
|
const difference = leftParts[index] - rightParts[index];
|
|
@@ -1506,45 +1366,14 @@ var compareInferenceHostReleaseVersions = (left, right) => {
|
|
|
1506
1366
|
return 0;
|
|
1507
1367
|
};
|
|
1508
1368
|
var isPathWithin = (parent, child) => {
|
|
1509
|
-
const childRelative =
|
|
1510
|
-
return childRelative !== "" && !childRelative.startsWith("..") && !
|
|
1369
|
+
const childRelative = relative2(resolve2(parent), resolve2(child));
|
|
1370
|
+
return childRelative !== "" && !childRelative.startsWith("..") && !isAbsolute2(childRelative);
|
|
1511
1371
|
};
|
|
1512
|
-
var
|
|
1513
|
-
try {
|
|
1514
|
-
const value = JSON.parse(await readFile3(selectionPathFor(manifestPath), "utf8"));
|
|
1515
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1516
|
-
const record = value;
|
|
1517
|
-
const script = safePath(record.script, "selected script");
|
|
1518
|
-
if (record.schema_version !== "vtx_inference_service_release_v1" || record.package_name !== PACKAGE_NAME || typeof record.package_version !== "string" || !parseVersion(record.package_version) || typeof record.integrity !== "string" || typeof record.selected_at !== "string" || !Number.isFinite(Date.parse(record.selected_at)) || !isPathWithin(releasesPathFor(manifestPath), script)) return null;
|
|
1519
|
-
await access2(script);
|
|
1520
|
-
return record;
|
|
1521
|
-
} catch (error) {
|
|
1522
|
-
if (error.code === "ENOENT") return null;
|
|
1523
|
-
return null;
|
|
1524
|
-
}
|
|
1525
|
-
};
|
|
1526
|
-
var parseRejection = async (manifestPath) => {
|
|
1527
|
-
try {
|
|
1528
|
-
const value = JSON.parse(await readFile3(rejectionPathFor(manifestPath), "utf8"));
|
|
1529
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1530
|
-
const record = value;
|
|
1531
|
-
if (record.schema_version !== "vtx_inference_service_release_rejection_v1" || typeof record.package_version !== "string" || !parseVersion(record.package_version) || typeof record.rejected_at !== "string" || !Number.isFinite(Date.parse(record.rejected_at)) || typeof record.reason !== "string" || !/^[a-z0-9_]{1,96}$/u.test(record.reason)) return null;
|
|
1532
|
-
return record;
|
|
1533
|
-
} catch {
|
|
1534
|
-
return null;
|
|
1535
|
-
}
|
|
1536
|
-
};
|
|
1537
|
-
var writeRejection = async (manifestPath, rejection) => {
|
|
1538
|
-
await writeAtomicInferencePrivateFile(
|
|
1539
|
-
rejectionPathFor(manifestPath),
|
|
1540
|
-
`${JSON.stringify(rejection, null, 2)}
|
|
1541
|
-
`
|
|
1542
|
-
);
|
|
1543
|
-
};
|
|
1544
|
-
var defaultRunCommand = async (command, args) => await new Promise((resolvePromise) => {
|
|
1372
|
+
var defaultRunCliCommand = async (command, args, options = {}) => await new Promise((resolvePromise) => {
|
|
1545
1373
|
const child = spawn2(command, [...args], {
|
|
1546
1374
|
windowsHide: true,
|
|
1547
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
1375
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1376
|
+
...options.signal ? { signal: options.signal, killSignal: "SIGKILL" } : {}
|
|
1548
1377
|
});
|
|
1549
1378
|
const stdout = [];
|
|
1550
1379
|
const stderr = [];
|
|
@@ -1563,8 +1392,8 @@ var defaultRunCommand = async (command, args) => await new Promise((resolvePromi
|
|
|
1563
1392
|
stderr: Buffer.concat(stderr).toString("utf8")
|
|
1564
1393
|
}));
|
|
1565
1394
|
});
|
|
1566
|
-
var
|
|
1567
|
-
if (platform !== "win32") return await runCommand(
|
|
1395
|
+
var runCliReleaseNpmCommand = async (executable, args, platform = process.platform, runCommand = defaultRunCliCommand) => {
|
|
1396
|
+
if (platform !== "win32") return await runCommand(join2(dirname2(executable), "npm"), args);
|
|
1568
1397
|
const npmScript = windowsPath2.join(
|
|
1569
1398
|
windowsPath2.dirname(executable),
|
|
1570
1399
|
"node_modules",
|
|
@@ -1574,48 +1403,12 @@ var runInferenceHostBootstrapNpmCommand = async (executable, args, platform = pr
|
|
|
1574
1403
|
);
|
|
1575
1404
|
return await runCommand(executable, [npmScript, ...args]);
|
|
1576
1405
|
};
|
|
1577
|
-
var
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1580
|
-
env: {
|
|
1581
|
-
...process.env,
|
|
1582
|
-
VTX_INFERENCE_HOST_SERVICE_CHILD: "1",
|
|
1583
|
-
VTX_INFERENCE_HOST_BOOTSTRAP_VERSION: agent_cli_release_default.package_version
|
|
1584
|
-
},
|
|
1585
|
-
stdio: ["pipe", "inherit", "inherit"]
|
|
1586
|
-
});
|
|
1587
|
-
const completion = new Promise((resolvePromise, reject) => {
|
|
1588
|
-
child.once("error", reject);
|
|
1589
|
-
child.once("exit", (code) => resolvePromise(code ?? 1));
|
|
1590
|
-
});
|
|
1591
|
-
child.stdin.on("error", () => {
|
|
1592
|
-
});
|
|
1593
|
-
return {
|
|
1594
|
-
completion,
|
|
1595
|
-
requestDrain: () => {
|
|
1596
|
-
child.stdin.write(`${SERVICE_DRAIN_COMMAND}
|
|
1597
|
-
`);
|
|
1598
|
-
},
|
|
1599
|
-
requestQuiesce: () => {
|
|
1600
|
-
child.stdin.write(`${SERVICE_QUIESCE_COMMAND}
|
|
1601
|
-
`);
|
|
1602
|
-
}
|
|
1603
|
-
};
|
|
1604
|
-
};
|
|
1605
|
-
var appendBootstrapLog = async (path, event, fields = {}) => {
|
|
1606
|
-
await mkdir2(dirname3(path), { recursive: true, mode: 448 });
|
|
1607
|
-
await appendFile(
|
|
1608
|
-
path,
|
|
1609
|
-
`${JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), event, ...fields })}
|
|
1610
|
-
`,
|
|
1611
|
-
{ encoding: "utf8", mode: 384 }
|
|
1612
|
-
);
|
|
1613
|
-
};
|
|
1614
|
-
var fetchLatestRelease = async (fetchImpl, signal) => {
|
|
1615
|
-
const response = await fetchImpl(`${OFFICIAL_NPM_REGISTRY}/%40vtxmacro%2Fcli/latest`, {
|
|
1406
|
+
var fetchLatestCliRelease = async (fetchImpl, options) => {
|
|
1407
|
+
const registry = (options.registry ?? OFFICIAL_NPM_REGISTRY).replace(/\/+$/u, "");
|
|
1408
|
+
const response = await fetchImpl(`${registry}/%40vtxmacro%2Fcli/latest`, {
|
|
1616
1409
|
signal: AbortSignal.any([
|
|
1617
|
-
AbortSignal.timeout(
|
|
1618
|
-
...signal ? [signal] : []
|
|
1410
|
+
AbortSignal.timeout(options.timeoutMs),
|
|
1411
|
+
...options.signal ? [options.signal] : []
|
|
1619
1412
|
])
|
|
1620
1413
|
});
|
|
1621
1414
|
if (!response.ok) throw new Error("registry_request_failed");
|
|
@@ -1625,52 +1418,36 @@ var fetchLatestRelease = async (fetchImpl, signal) => {
|
|
|
1625
1418
|
}
|
|
1626
1419
|
const record = value;
|
|
1627
1420
|
const distribution = record.dist;
|
|
1628
|
-
if (record.name !==
|
|
1421
|
+
if (record.name !== CLI_PACKAGE_NAME || typeof record.version !== "string" || !parseCliReleaseVersion(record.version) || !distribution || typeof distribution !== "object" || Array.isArray(distribution) || typeof distribution.integrity !== "string") throw new Error("registry_metadata_invalid");
|
|
1629
1422
|
return {
|
|
1630
1423
|
version: record.version,
|
|
1631
1424
|
integrity: distribution.integrity
|
|
1632
1425
|
};
|
|
1633
1426
|
};
|
|
1634
|
-
var
|
|
1427
|
+
var verifyCliReleaseIntegrity = async (tarballPath, integrity) => {
|
|
1635
1428
|
const candidates = integrity.split(/\s+/u).map((entry) => {
|
|
1636
1429
|
const separator = entry.indexOf("-");
|
|
1637
1430
|
return separator > 0 ? { algorithm: entry.slice(0, separator), digest: entry.slice(separator + 1) } : null;
|
|
1638
1431
|
}).filter((entry) => entry !== null);
|
|
1639
1432
|
const supported = ["sha512", "sha384", "sha256"].map((algorithm) => candidates.find((candidate) => candidate.algorithm === algorithm)).find(Boolean);
|
|
1640
1433
|
if (!supported) throw new Error("release_integrity_unsupported");
|
|
1641
|
-
const actual = createHash(supported.algorithm).update(await
|
|
1434
|
+
const actual = createHash(supported.algorithm).update(await readFile2(tarballPath)).digest("base64");
|
|
1642
1435
|
if (actual !== supported.digest) throw new Error("release_integrity_mismatch");
|
|
1643
1436
|
};
|
|
1644
|
-
var
|
|
1645
|
-
|
|
1646
|
-
selectionPathFor(manifestPath),
|
|
1647
|
-
`${JSON.stringify(selection, null, 2)}
|
|
1648
|
-
`
|
|
1649
|
-
);
|
|
1650
|
-
};
|
|
1651
|
-
var verifyInstalledRelease = async (prefix, targetVersion, executable, platform, runCommand) => {
|
|
1652
|
-
const rootResult = await runInferenceHostBootstrapNpmCommand(
|
|
1653
|
-
executable,
|
|
1654
|
-
["root", "--global", "--prefix", prefix],
|
|
1655
|
-
platform,
|
|
1656
|
-
runCommand
|
|
1657
|
-
);
|
|
1658
|
-
if (rootResult.exitCode !== 0 || !rootResult.stdout.trim()) {
|
|
1659
|
-
throw new Error("release_install_invalid");
|
|
1660
|
-
}
|
|
1661
|
-
const packagePath = resolve3(rootResult.stdout.trim(), PACKAGE_NAME);
|
|
1437
|
+
var verifyInstalledCliRelease = async (prefix, targetVersion, executable, platform, runCommand) => {
|
|
1438
|
+
const packagePath = platform === "win32" ? windowsPath2.join(prefix, "node_modules", "@vtxmacro", "cli") : join2(prefix, "lib", "node_modules", "@vtxmacro", "cli");
|
|
1662
1439
|
if (!isPathWithin(prefix, packagePath)) throw new Error("release_install_invalid");
|
|
1663
|
-
const packageJson = JSON.parse(await
|
|
1440
|
+
const packageJson = JSON.parse(await readFile2(join2(packagePath, "package.json"), "utf8"));
|
|
1664
1441
|
if (!packageJson || typeof packageJson !== "object" || Array.isArray(packageJson)) {
|
|
1665
1442
|
throw new Error("release_install_invalid");
|
|
1666
1443
|
}
|
|
1667
1444
|
const packageRecord = packageJson;
|
|
1668
1445
|
const bin = packageRecord.bin;
|
|
1669
1446
|
const binPath = bin && typeof bin === "object" && !Array.isArray(bin) ? bin.vtx : null;
|
|
1670
|
-
if (packageRecord.name !==
|
|
1671
|
-
const script =
|
|
1447
|
+
if (packageRecord.name !== CLI_PACKAGE_NAME || packageRecord.version !== targetVersion || typeof binPath !== "string") throw new Error("release_install_invalid");
|
|
1448
|
+
const script = resolve2(packagePath, binPath);
|
|
1672
1449
|
if (!isPathWithin(packagePath, script)) throw new Error("release_install_invalid");
|
|
1673
|
-
await
|
|
1450
|
+
await access(script);
|
|
1674
1451
|
const verified = await runCommand(executable, [script, "--version"]);
|
|
1675
1452
|
if (verified.exitCode !== 0 || verified.stdout.trim() !== targetVersion) {
|
|
1676
1453
|
throw new Error("release_version_verification_failed");
|
|
@@ -1681,48 +1458,79 @@ var cleanupInterruptedReleaseStaging = async (releasesPath) => {
|
|
|
1681
1458
|
const entries = await readdir2(releasesPath, { withFileTypes: true });
|
|
1682
1459
|
for (const entry of entries) {
|
|
1683
1460
|
if (entry.isDirectory() && /^\.(?:staging|download)-\d{4}\.\d{1,2}\.\d{1,3}-[0-9a-f-]{36}$/u.test(entry.name)) {
|
|
1684
|
-
await
|
|
1461
|
+
await rm2(resolve2(releasesPath, entry.name), { recursive: true, force: true });
|
|
1685
1462
|
}
|
|
1686
1463
|
}
|
|
1687
1464
|
};
|
|
1688
|
-
var
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1465
|
+
var ensureUpdaterPrivateDirectory = async (path, root, dependencies = {}) => {
|
|
1466
|
+
const platform = dependencies.platform ?? process.platform;
|
|
1467
|
+
if (platform !== "win32" && (resolve2(path) === resolve2(root) || isPathWithin(root, path))) {
|
|
1468
|
+
const existing = await lstat2(path).catch(() => null);
|
|
1469
|
+
if (existing && existing.isDirectory() && !existing.isSymbolicLink() && (existing.mode & 63) !== 0 && (typeof process.getuid !== "function" || existing.uid === process.getuid())) {
|
|
1470
|
+
await chmod(path, 448);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
await ensureInferencePrivateDirectory(path, { ...dependencies, defaultRoot: root });
|
|
1474
|
+
};
|
|
1475
|
+
var stageCliRelease = async (input) => {
|
|
1476
|
+
const { releasesPath, target, executable, platform } = input;
|
|
1477
|
+
const registry = input.registry ?? OFFICIAL_NPM_REGISTRY;
|
|
1478
|
+
const deadline = new AbortController();
|
|
1479
|
+
let reason = "release_stage_timeout";
|
|
1480
|
+
const timer = setTimeout(() => deadline.abort(), input.timeoutMs);
|
|
1481
|
+
const onCancel = () => {
|
|
1482
|
+
reason = "release_stage_cancelled";
|
|
1483
|
+
deadline.abort();
|
|
1484
|
+
};
|
|
1485
|
+
if (input.signal?.aborted) onCancel();
|
|
1486
|
+
input.signal?.addEventListener("abort", onCancel, { once: true });
|
|
1487
|
+
const timedOut = () => new Error(reason);
|
|
1488
|
+
const runCommand = async (command, args) => {
|
|
1489
|
+
if (deadline.signal.aborted) throw timedOut();
|
|
1490
|
+
return await new Promise((resolveCommand, rejectCommand) => {
|
|
1491
|
+
const onAbort = () => rejectCommand(timedOut());
|
|
1492
|
+
deadline.signal.addEventListener("abort", onAbort, { once: true });
|
|
1493
|
+
input.runCommand(command, args, { signal: deadline.signal }).then(resolveCommand, rejectCommand).finally(() => deadline.signal.removeEventListener("abort", onAbort));
|
|
1494
|
+
});
|
|
1495
|
+
};
|
|
1496
|
+
try {
|
|
1497
|
+
return await stageCliReleaseWithin({ ...input, registry, runCommand });
|
|
1498
|
+
} finally {
|
|
1499
|
+
clearTimeout(timer);
|
|
1500
|
+
input.signal?.removeEventListener("abort", onCancel);
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
var stageCliReleaseWithin = async (input) => {
|
|
1504
|
+
const { releasesPath, target, executable, platform, runCommand, registry } = input;
|
|
1505
|
+
const finalPath = join2(releasesPath, target.version);
|
|
1506
|
+
const stagingPath = join2(releasesPath, `.staging-${target.version}-${randomUUID()}`);
|
|
1507
|
+
const downloadPath = join2(releasesPath, `.download-${target.version}-${randomUUID()}`);
|
|
1508
|
+
await ensureUpdaterPrivateDirectory(input.privateRoot, input.privateRoot, { platform });
|
|
1509
|
+
await ensureUpdaterPrivateDirectory(releasesPath, input.privateRoot, { platform });
|
|
1694
1510
|
await cleanupInterruptedReleaseStaging(releasesPath);
|
|
1695
1511
|
try {
|
|
1696
|
-
await
|
|
1697
|
-
const existingScript = await
|
|
1512
|
+
await access(finalPath);
|
|
1513
|
+
const existingScript = await verifyInstalledCliRelease(
|
|
1698
1514
|
finalPath,
|
|
1699
1515
|
target.version,
|
|
1700
1516
|
executable,
|
|
1701
1517
|
platform,
|
|
1702
1518
|
runCommand
|
|
1703
1519
|
);
|
|
1704
|
-
|
|
1705
|
-
schema_version: "vtx_inference_service_release_v1",
|
|
1706
|
-
package_name: PACKAGE_NAME,
|
|
1707
|
-
package_version: target.version,
|
|
1708
|
-
integrity: target.integrity,
|
|
1709
|
-
script: existingScript,
|
|
1710
|
-
selected_at: now().toISOString()
|
|
1711
|
-
};
|
|
1712
|
-
return existingSelection;
|
|
1520
|
+
return { package_version: target.version, integrity: target.integrity, script: existingScript };
|
|
1713
1521
|
} catch (error) {
|
|
1714
1522
|
if (error.code !== "ENOENT") throw error;
|
|
1715
1523
|
}
|
|
1716
1524
|
await mkdir2(stagingPath, { recursive: true, mode: 448 });
|
|
1717
1525
|
await mkdir2(downloadPath, { recursive: true, mode: 448 });
|
|
1718
1526
|
try {
|
|
1719
|
-
const packed = await
|
|
1527
|
+
const packed = await runCliReleaseNpmCommand(executable, [
|
|
1720
1528
|
"pack",
|
|
1721
|
-
`${
|
|
1529
|
+
`${CLI_PACKAGE_NAME}@${target.version}`,
|
|
1722
1530
|
"--pack-destination",
|
|
1723
1531
|
downloadPath,
|
|
1724
1532
|
"--registry",
|
|
1725
|
-
|
|
1533
|
+
registry,
|
|
1726
1534
|
"--json"
|
|
1727
1535
|
], platform, runCommand);
|
|
1728
1536
|
if (packed.exitCode !== 0) throw new Error("release_download_failed");
|
|
@@ -1733,12 +1541,12 @@ var stageRelease = async (manifestPath, target, executable, platform, runCommand
|
|
|
1733
1541
|
} catch {
|
|
1734
1542
|
throw new Error("release_download_invalid");
|
|
1735
1543
|
}
|
|
1736
|
-
const tarballPath =
|
|
1544
|
+
const tarballPath = resolve2(downloadPath, filename);
|
|
1737
1545
|
if (!filename || !isPathWithin(downloadPath, tarballPath)) {
|
|
1738
1546
|
throw new Error("release_download_invalid");
|
|
1739
1547
|
}
|
|
1740
|
-
await
|
|
1741
|
-
const installed = await
|
|
1548
|
+
await verifyCliReleaseIntegrity(tarballPath, target.integrity);
|
|
1549
|
+
const installed = await runCliReleaseNpmCommand(executable, [
|
|
1742
1550
|
"install",
|
|
1743
1551
|
"--global",
|
|
1744
1552
|
"--prefix",
|
|
@@ -1747,10 +1555,10 @@ var stageRelease = async (manifestPath, target, executable, platform, runCommand
|
|
|
1747
1555
|
"--no-audit",
|
|
1748
1556
|
"--no-fund",
|
|
1749
1557
|
"--registry",
|
|
1750
|
-
|
|
1558
|
+
registry
|
|
1751
1559
|
], platform, runCommand);
|
|
1752
1560
|
if (installed.exitCode !== 0) throw new Error("release_install_failed");
|
|
1753
|
-
const stagedScript = await
|
|
1561
|
+
const stagedScript = await verifyInstalledCliRelease(
|
|
1754
1562
|
stagingPath,
|
|
1755
1563
|
target.version,
|
|
1756
1564
|
executable,
|
|
@@ -1760,23 +1568,224 @@ var stageRelease = async (manifestPath, target, executable, platform, runCommand
|
|
|
1760
1568
|
try {
|
|
1761
1569
|
await rename2(stagingPath, finalPath);
|
|
1762
1570
|
} catch (error) {
|
|
1763
|
-
if (error.code
|
|
1571
|
+
if (!["EEXIST", "ENOTEMPTY"].includes(String(error.code))) throw error;
|
|
1764
1572
|
throw new Error("release_path_already_exists");
|
|
1765
1573
|
}
|
|
1766
|
-
|
|
1767
|
-
const selection = {
|
|
1768
|
-
schema_version: "vtx_inference_service_release_v1",
|
|
1769
|
-
package_name: PACKAGE_NAME,
|
|
1574
|
+
return {
|
|
1770
1575
|
package_version: target.version,
|
|
1771
1576
|
integrity: target.integrity,
|
|
1772
|
-
script:
|
|
1773
|
-
selected_at: now().toISOString()
|
|
1577
|
+
script: resolve2(finalPath, relative2(stagingPath, stagedScript))
|
|
1774
1578
|
};
|
|
1775
|
-
return selection;
|
|
1776
1579
|
} finally {
|
|
1777
|
-
await
|
|
1778
|
-
await
|
|
1580
|
+
await rm2(stagingPath, { recursive: true, force: true }).catch(() => void 0);
|
|
1581
|
+
await rm2(downloadPath, { recursive: true, force: true }).catch(() => void 0);
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
var readCliReleaseRejection = async (path) => {
|
|
1585
|
+
try {
|
|
1586
|
+
const value = JSON.parse(await readFile2(path, "utf8"));
|
|
1587
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1588
|
+
const record = value;
|
|
1589
|
+
if (record.schema_version !== "vtx_inference_service_release_rejection_v1" || typeof record.package_version !== "string" || !parseCliReleaseVersion(record.package_version) || typeof record.rejected_at !== "string" || !Number.isFinite(Date.parse(record.rejected_at)) || typeof record.reason !== "string" || !/^[a-z0-9_]{1,96}$/u.test(record.reason)) return null;
|
|
1590
|
+
return record;
|
|
1591
|
+
} catch {
|
|
1592
|
+
return null;
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
var writeCliReleaseRejection = async (path, rejection, privateRoot) => {
|
|
1596
|
+
if (privateRoot) await ensureUpdaterPrivateDirectory(privateRoot, privateRoot);
|
|
1597
|
+
await writeAtomicInferencePrivateFile(
|
|
1598
|
+
path,
|
|
1599
|
+
`${JSON.stringify(rejection, null, 2)}
|
|
1600
|
+
`,
|
|
1601
|
+
privateRoot ? { defaultRoot: privateRoot } : {}
|
|
1602
|
+
);
|
|
1603
|
+
};
|
|
1604
|
+
|
|
1605
|
+
// lib/inference-host/service-launcher-state.ts
|
|
1606
|
+
import { access as access2, readFile as readFile3, rm as rm3 } from "node:fs/promises";
|
|
1607
|
+
import { dirname as dirname3, isAbsolute as isAbsolute3, join as join3, relative as relative3, resolve as resolve3 } from "node:path";
|
|
1608
|
+
var launcherSibling = (manifest, suffix) => {
|
|
1609
|
+
if (!manifest.endsWith(".service.json")) throw new Error("Invalid service manifest path.");
|
|
1610
|
+
return `${manifest.slice(0, -".service.json".length)}${suffix}`;
|
|
1611
|
+
};
|
|
1612
|
+
var within = (parent, child) => {
|
|
1613
|
+
const part = relative3(resolve3(parent), resolve3(child));
|
|
1614
|
+
return Boolean(part) && !part.startsWith("..") && !isAbsolute3(part);
|
|
1615
|
+
};
|
|
1616
|
+
var launcherSelection = (manifest, value) => {
|
|
1617
|
+
if (!value || typeof value !== "object") return null;
|
|
1618
|
+
const r = value;
|
|
1619
|
+
if (r.schema_version !== "vtx_inference_service_release_v1" || r.package_name !== "@vtxmacro/cli" || typeof r.package_version !== "string" || !/^\d{4}\.\d{1,2}\.\d{1,3}$/u.test(r.package_version) || typeof r.integrity !== "string" || typeof r.selected_at !== "string" || !Number.isFinite(Date.parse(r.selected_at)) || typeof r.script !== "string" || !isAbsolute3(r.script) || /[\r\n\0]/u.test(r.script) || !within(launcherSibling(manifest, ".service-releases"), r.script)) return null;
|
|
1620
|
+
return r;
|
|
1621
|
+
};
|
|
1622
|
+
var readLauncherState = async (manifest) => {
|
|
1623
|
+
let value;
|
|
1624
|
+
try {
|
|
1625
|
+
value = JSON.parse(await readFile3(launcherSibling(manifest, ".service-launcher.json"), "utf8"));
|
|
1626
|
+
} catch (error) {
|
|
1627
|
+
if (error.code === "ENOENT") return null;
|
|
1628
|
+
throw error;
|
|
1629
|
+
}
|
|
1630
|
+
if (!value || typeof value !== "object") throw new Error("Invalid service launcher state.");
|
|
1631
|
+
const r = value;
|
|
1632
|
+
const target = (v) => {
|
|
1633
|
+
if (!v || typeof v !== "object") return false;
|
|
1634
|
+
const t = v;
|
|
1635
|
+
return typeof t.package_version === "string" && /^\d{4}\.\d{1,2}\.\d{1,3}$/u.test(t.package_version) && typeof t.script === "string" && isAbsolute3(t.script) && !/[\r\n\0]/u.test(t.script) && (within(launcherSibling(manifest, ".service-releases"), t.script) || resolve3(t.script) === resolve3(launcherSibling(manifest, ".service-bootstrap.previous.js"))) && (t.selection === null || (() => {
|
|
1636
|
+
const selected = launcherSelection(manifest, t.selection);
|
|
1637
|
+
return Boolean(selected && selected.package_version === t.package_version && (resolve3(t.script) === resolve3(join3(dirname3(selected.script), "vtx-service-bootstrap.js")) || resolve3(t.script) === resolve3(launcherSibling(manifest, ".service-bootstrap.previous.js"))));
|
|
1638
|
+
})());
|
|
1639
|
+
};
|
|
1640
|
+
if (r.schema_version !== "vtx_inference_service_launcher_v1" || !target(r.active) || r.previous !== null && !target(r.previous) || typeof r.pending !== "boolean") {
|
|
1641
|
+
throw new Error("Invalid service launcher recovery targets.");
|
|
1642
|
+
}
|
|
1643
|
+
return r;
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
// lib/inference-host/service-bootstrap.ts
|
|
1647
|
+
var UPDATE_ATTEMPTS = 3;
|
|
1648
|
+
var UPDATE_RETRY_MS = 2e3;
|
|
1649
|
+
var CANDIDATE_READINESS_TIMEOUT_MS = runtime_policy_generated_default.external_inference.service.bootstrap_readiness_timeout_ms;
|
|
1650
|
+
var SERVICE_DRAIN_COMMAND = "vtx-inference-host-service-drain-v1";
|
|
1651
|
+
var SERVICE_QUIESCE_COMMAND = "vtx-inference-host-service-quiesce-v1";
|
|
1652
|
+
var safePath = (value, label) => {
|
|
1653
|
+
if (typeof value !== "string" || !value || /[\r\n\0]/u.test(value)) {
|
|
1654
|
+
throw new Error(`Inference-host bootstrap ${label} is invalid.`);
|
|
1655
|
+
}
|
|
1656
|
+
return resolve4(value);
|
|
1657
|
+
};
|
|
1658
|
+
var parseManifest = (value) => {
|
|
1659
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1660
|
+
throw new Error("Inference-host bootstrap manifest is invalid.");
|
|
1661
|
+
}
|
|
1662
|
+
const record = value;
|
|
1663
|
+
if (!["vtx_inference_service_v1", "vtx_inference_service_v2", "vtx_inference_service_v3"].includes(String(record.schema_version))) {
|
|
1664
|
+
throw new Error("Inference-host bootstrap manifest version is unsupported.");
|
|
1665
|
+
}
|
|
1666
|
+
return {
|
|
1667
|
+
generation: typeof record.generation === "string" && record.generation ? record.generation : `legacy:${String(record.installed_at ?? "")}`,
|
|
1668
|
+
executable: safePath(record.executable, "executable"),
|
|
1669
|
+
script: safePath(record.script, "script"),
|
|
1670
|
+
log_path: safePath(record.log_path, "log path"),
|
|
1671
|
+
worker_names: Array.isArray(record.workers) ? record.workers.map((worker) => {
|
|
1672
|
+
if (!worker || typeof worker !== "object" || Array.isArray(worker)) {
|
|
1673
|
+
throw new Error("Inference-host bootstrap worker is invalid.");
|
|
1674
|
+
}
|
|
1675
|
+
const instanceName = worker.instance_name;
|
|
1676
|
+
if (typeof instanceName !== "string" || !instanceName) {
|
|
1677
|
+
throw new Error("Inference-host bootstrap worker is invalid.");
|
|
1678
|
+
}
|
|
1679
|
+
return instanceName;
|
|
1680
|
+
}).sort() : ["default"]
|
|
1681
|
+
};
|
|
1682
|
+
};
|
|
1683
|
+
var serviceSiblingPath = (manifestPath, suffix) => {
|
|
1684
|
+
if (!manifestPath.endsWith(".service.json")) {
|
|
1685
|
+
throw new Error("Inference-host bootstrap manifest path is invalid.");
|
|
1779
1686
|
}
|
|
1687
|
+
return `${manifestPath.slice(0, -".service.json".length)}${suffix}`;
|
|
1688
|
+
};
|
|
1689
|
+
var desiredPathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-desired.json");
|
|
1690
|
+
var selectionPathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-release.json");
|
|
1691
|
+
var releasesPathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-releases");
|
|
1692
|
+
var rejectionPathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-release-rejection.json");
|
|
1693
|
+
var runtimePathFor = (manifestPath) => serviceSiblingPath(manifestPath, ".service-runtime.json");
|
|
1694
|
+
var readDesired = async (manifestPath) => {
|
|
1695
|
+
const value = JSON.parse(await readFile4(desiredPathFor(manifestPath), "utf8"));
|
|
1696
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1697
|
+
throw new Error("Inference-host bootstrap desired state is invalid.");
|
|
1698
|
+
}
|
|
1699
|
+
const record = value;
|
|
1700
|
+
if (record.schema_version !== "vtx_inference_service_desired_v1" || typeof record.desired_running !== "boolean") {
|
|
1701
|
+
throw new Error("Inference-host bootstrap desired state is invalid.");
|
|
1702
|
+
}
|
|
1703
|
+
return record.desired_running;
|
|
1704
|
+
};
|
|
1705
|
+
var parseSelection = async (manifestPath) => {
|
|
1706
|
+
try {
|
|
1707
|
+
const value = JSON.parse(await readFile4(selectionPathFor(manifestPath), "utf8"));
|
|
1708
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1709
|
+
const record = value;
|
|
1710
|
+
const script = safePath(record.script, "selected script");
|
|
1711
|
+
if (record.schema_version !== "vtx_inference_service_release_v1" || record.package_name !== CLI_PACKAGE_NAME || typeof record.package_version !== "string" || !parseCliReleaseVersion(record.package_version) || typeof record.integrity !== "string" || typeof record.selected_at !== "string" || !Number.isFinite(Date.parse(record.selected_at)) || !isPathWithin(releasesPathFor(manifestPath), script)) return null;
|
|
1712
|
+
await access3(script);
|
|
1713
|
+
return record;
|
|
1714
|
+
} catch (error) {
|
|
1715
|
+
if (error.code === "ENOENT") return null;
|
|
1716
|
+
return null;
|
|
1717
|
+
}
|
|
1718
|
+
};
|
|
1719
|
+
var parseRejection = async (manifestPath) => await readCliReleaseRejection(rejectionPathFor(manifestPath));
|
|
1720
|
+
var writeRejection = async (manifestPath, rejection) => {
|
|
1721
|
+
await writeCliReleaseRejection(rejectionPathFor(manifestPath), rejection);
|
|
1722
|
+
};
|
|
1723
|
+
var defaultRunSupervisor = (executable, args) => {
|
|
1724
|
+
const child = spawn3(executable, [...args], {
|
|
1725
|
+
windowsHide: true,
|
|
1726
|
+
env: {
|
|
1727
|
+
...process.env,
|
|
1728
|
+
VTX_INFERENCE_HOST_SERVICE_CHILD: "1",
|
|
1729
|
+
VTX_INFERENCE_HOST_BOOTSTRAP_VERSION: agent_cli_release_default.package_version
|
|
1730
|
+
},
|
|
1731
|
+
stdio: ["pipe", "inherit", "inherit"]
|
|
1732
|
+
});
|
|
1733
|
+
const completion = new Promise((resolvePromise, reject) => {
|
|
1734
|
+
child.once("error", reject);
|
|
1735
|
+
child.once("exit", (code) => resolvePromise(code ?? 1));
|
|
1736
|
+
});
|
|
1737
|
+
child.stdin.on("error", () => {
|
|
1738
|
+
});
|
|
1739
|
+
return {
|
|
1740
|
+
completion,
|
|
1741
|
+
requestDrain: () => {
|
|
1742
|
+
child.stdin.write(`${SERVICE_DRAIN_COMMAND}
|
|
1743
|
+
`);
|
|
1744
|
+
},
|
|
1745
|
+
requestQuiesce: () => {
|
|
1746
|
+
child.stdin.write(`${SERVICE_QUIESCE_COMMAND}
|
|
1747
|
+
`);
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
};
|
|
1751
|
+
var appendBootstrapLog = async (path, event, fields = {}) => {
|
|
1752
|
+
await mkdir3(dirname4(path), { recursive: true, mode: 448 });
|
|
1753
|
+
await appendFile2(
|
|
1754
|
+
path,
|
|
1755
|
+
`${JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), event, ...fields })}
|
|
1756
|
+
`,
|
|
1757
|
+
{ encoding: "utf8", mode: 384 }
|
|
1758
|
+
);
|
|
1759
|
+
};
|
|
1760
|
+
var fetchLatestRelease = async (fetchImpl, signal) => await fetchLatestCliRelease(fetchImpl, {
|
|
1761
|
+
timeoutMs: runtime_policy_generated_default.external_inference.service.update_registry_timeout_ms,
|
|
1762
|
+
signal
|
|
1763
|
+
});
|
|
1764
|
+
var atomicWriteSelection = async (manifestPath, selection) => {
|
|
1765
|
+
await writeAtomicInferencePrivateFile(
|
|
1766
|
+
selectionPathFor(manifestPath),
|
|
1767
|
+
`${JSON.stringify(selection, null, 2)}
|
|
1768
|
+
`
|
|
1769
|
+
);
|
|
1770
|
+
};
|
|
1771
|
+
var stageRelease = async (manifestPath, target, executable, platform, runCommand, now) => {
|
|
1772
|
+
const staged = await stageCliRelease({
|
|
1773
|
+
releasesPath: releasesPathFor(manifestPath),
|
|
1774
|
+
target,
|
|
1775
|
+
executable,
|
|
1776
|
+
platform,
|
|
1777
|
+
runCommand,
|
|
1778
|
+
privateRoot: dirname4(manifestPath),
|
|
1779
|
+
timeoutMs: runtime_policy_generated_default.agent_cli.stage_timeout_ms
|
|
1780
|
+
});
|
|
1781
|
+
return {
|
|
1782
|
+
schema_version: "vtx_inference_service_release_v1",
|
|
1783
|
+
package_name: CLI_PACKAGE_NAME,
|
|
1784
|
+
package_version: staged.package_version,
|
|
1785
|
+
integrity: staged.integrity,
|
|
1786
|
+
script: staged.script,
|
|
1787
|
+
selected_at: now().toISOString()
|
|
1788
|
+
};
|
|
1780
1789
|
};
|
|
1781
1790
|
var updateSelection = async (manifestPath, manifest, dependencies) => {
|
|
1782
1791
|
const active = await parseSelection(manifestPath);
|
|
@@ -1795,7 +1804,7 @@ var updateSelection = async (manifestPath, manifest, dependencies) => {
|
|
|
1795
1804
|
}
|
|
1796
1805
|
if (!latest) throw lastError ?? new Error("registry_request_failed");
|
|
1797
1806
|
const installedVersion = active?.package_version ?? agent_cli_release_default.package_version;
|
|
1798
|
-
if (
|
|
1807
|
+
if (compareCliReleaseVersions(latest.version, installedVersion) < 0) {
|
|
1799
1808
|
return { active, candidate: null };
|
|
1800
1809
|
}
|
|
1801
1810
|
if (active && latest.version === active.package_version) {
|
|
@@ -1821,8 +1830,8 @@ var waitForCandidateReadiness = async (manifestPath, candidate, signal, timeoutM
|
|
|
1821
1830
|
while (!signal.aborted && Date.now() < deadline) {
|
|
1822
1831
|
if (!await readDesired(manifestPath)) return "aborted";
|
|
1823
1832
|
try {
|
|
1824
|
-
const currentManifest = parseManifest(JSON.parse(await
|
|
1825
|
-
const value = JSON.parse(await
|
|
1833
|
+
const currentManifest = parseManifest(JSON.parse(await readFile4(manifestPath, "utf8")));
|
|
1834
|
+
const value = JSON.parse(await readFile4(runtimePathFor(manifestPath), "utf8"));
|
|
1826
1835
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1827
1836
|
const runtime = value;
|
|
1828
1837
|
const workers = Array.isArray(runtime.workers) ? runtime.workers : [];
|
|
@@ -1841,20 +1850,20 @@ var prunePrivateReleases = async (manifestPath, keep) => {
|
|
|
1841
1850
|
const recovery = await readLauncherState(manifestPath);
|
|
1842
1851
|
const retained = [...keep, recovery?.active.selection ?? null, recovery?.previous?.selection ?? null];
|
|
1843
1852
|
const keepPaths = new Set(
|
|
1844
|
-
retained.filter((item) => item !== null).map((item) =>
|
|
1853
|
+
retained.filter((item) => item !== null).map((item) => resolve4(item.script)).filter((script) => isPathWithin(releasesPath, script)).map((script) => resolve4(releasesPath, relative4(releasesPath, script).split(/[\\/]/u)[0]))
|
|
1845
1854
|
);
|
|
1846
1855
|
let entries;
|
|
1847
1856
|
try {
|
|
1848
|
-
entries = await
|
|
1857
|
+
entries = await readdir3(releasesPath, { withFileTypes: true });
|
|
1849
1858
|
} catch (error) {
|
|
1850
1859
|
if (error.code === "ENOENT") return;
|
|
1851
1860
|
throw error;
|
|
1852
1861
|
}
|
|
1853
1862
|
for (const entry of entries) {
|
|
1854
|
-
if (!entry.isDirectory() || !
|
|
1855
|
-
const releasePath =
|
|
1863
|
+
if (!entry.isDirectory() || !parseCliReleaseVersion(entry.name)) continue;
|
|
1864
|
+
const releasePath = resolve4(releasesPath, entry.name);
|
|
1856
1865
|
if (!keepPaths.has(releasePath)) {
|
|
1857
|
-
await
|
|
1866
|
+
await rm4(releasePath, { recursive: true, force: true });
|
|
1858
1867
|
}
|
|
1859
1868
|
}
|
|
1860
1869
|
};
|
|
@@ -1879,7 +1888,7 @@ var waitForUpdateCheck = async (milliseconds, signal) => {
|
|
|
1879
1888
|
});
|
|
1880
1889
|
};
|
|
1881
1890
|
var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies = {}, lockPathValue) => {
|
|
1882
|
-
const manifestPath =
|
|
1891
|
+
const manifestPath = resolve4(manifestPathValue);
|
|
1883
1892
|
const lockPath = safePath(
|
|
1884
1893
|
lockPathValue ?? serviceSiblingPath(manifestPath, ".service-bootstrap.lock"),
|
|
1885
1894
|
"lock path"
|
|
@@ -1904,7 +1913,7 @@ var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies =
|
|
|
1904
1913
|
process.on("SIGINT", stop);
|
|
1905
1914
|
if (dependencies.signal?.aborted) stop();
|
|
1906
1915
|
try {
|
|
1907
|
-
let manifest = parseManifest(JSON.parse(await
|
|
1916
|
+
let manifest = parseManifest(JSON.parse(await readFile4(manifestPath, "utf8")));
|
|
1908
1917
|
const shouldRun = async () => !lifetime.signal.aborted && await readDesired(manifestPath);
|
|
1909
1918
|
if (!await shouldRun()) {
|
|
1910
1919
|
await appendBootstrapLog(manifest.log_path, "service_bootstrap_stopped");
|
|
@@ -1919,12 +1928,12 @@ var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies =
|
|
|
1919
1928
|
fetch: dependencies.fetch ?? fetch,
|
|
1920
1929
|
now,
|
|
1921
1930
|
platform: dependencies.platform ?? process.platform,
|
|
1922
|
-
runCommand: dependencies.runCommand ??
|
|
1931
|
+
runCommand: dependencies.runCommand ?? defaultRunCliCommand,
|
|
1923
1932
|
sleep,
|
|
1924
1933
|
signal: lifetime.signal
|
|
1925
1934
|
};
|
|
1926
1935
|
const checkUpdate = async () => {
|
|
1927
|
-
manifest = parseManifest(JSON.parse(await
|
|
1936
|
+
manifest = parseManifest(JSON.parse(await readFile4(manifestPath, "utf8")));
|
|
1928
1937
|
const active = await parseSelection(manifestPath);
|
|
1929
1938
|
try {
|
|
1930
1939
|
return await updateSelection(manifestPath, manifest, updateDependencies);
|
|
@@ -1937,10 +1946,10 @@ var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies =
|
|
|
1937
1946
|
};
|
|
1938
1947
|
let launchedAt = now().toISOString();
|
|
1939
1948
|
const launch = async (selection) => {
|
|
1940
|
-
manifest = parseManifest(JSON.parse(await
|
|
1949
|
+
manifest = parseManifest(JSON.parse(await readFile4(manifestPath, "utf8")));
|
|
1941
1950
|
const script = selection?.script ?? manifest.script;
|
|
1942
|
-
await
|
|
1943
|
-
await
|
|
1951
|
+
await access3(manifest.executable);
|
|
1952
|
+
await access3(script);
|
|
1944
1953
|
if (!await shouldRun()) return null;
|
|
1945
1954
|
await appendBootstrapLog(manifest.log_path, "service_bootstrap_launch", {
|
|
1946
1955
|
package_version: selection?.package_version ?? agent_cli_release_default.package_version
|
|
@@ -1954,7 +1963,7 @@ var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies =
|
|
|
1954
1963
|
while (await shouldRun()) {
|
|
1955
1964
|
if (updatePlan.candidate) {
|
|
1956
1965
|
const candidate = { ...updatePlan.candidate, selected_at: now().toISOString() };
|
|
1957
|
-
await
|
|
1966
|
+
await rm4(runtimePathFor(manifestPath), { force: true });
|
|
1958
1967
|
await appendBootstrapLog(manifest.log_path, "service_release_candidate_started", {
|
|
1959
1968
|
package_version: candidate.package_version
|
|
1960
1969
|
});
|
|
@@ -1980,7 +1989,7 @@ var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies =
|
|
|
1980
1989
|
]);
|
|
1981
1990
|
if (first.kind === "ready" && await shouldRun()) {
|
|
1982
1991
|
await atomicWriteSelection(manifestPath, candidate);
|
|
1983
|
-
await
|
|
1992
|
+
await rm4(rejectionPathFor(manifestPath), { force: true }).catch(() => void 0);
|
|
1984
1993
|
await prunePrivateReleases(manifestPath, [candidate, updatePlan.active]).catch(
|
|
1985
1994
|
async () => await appendBootstrapLog(
|
|
1986
1995
|
manifest.log_path,
|
|
@@ -2041,7 +2050,7 @@ var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies =
|
|
|
2041
2050
|
void waitForCandidateReadiness(manifestPath, {
|
|
2042
2051
|
...updatePlan.active ?? {
|
|
2043
2052
|
schema_version: "vtx_inference_service_release_v1",
|
|
2044
|
-
package_name:
|
|
2053
|
+
package_name: CLI_PACKAGE_NAME,
|
|
2045
2054
|
package_version: agent_cli_release_default.package_version,
|
|
2046
2055
|
integrity: "",
|
|
2047
2056
|
script: manifest.script
|
|
@@ -2126,7 +2135,7 @@ var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies =
|
|
|
2126
2135
|
await lock.release();
|
|
2127
2136
|
}
|
|
2128
2137
|
};
|
|
2129
|
-
var invokedPath = process.argv[1] ?
|
|
2138
|
+
var invokedPath = process.argv[1] ? resolve4(process.argv[1]) : "";
|
|
2130
2139
|
if (invokedPath === fileURLToPath(import.meta.url)) {
|
|
2131
2140
|
const manifestIndex = process.argv.indexOf("--service-manifest");
|
|
2132
2141
|
const lockIndex = process.argv.indexOf("--service-lock");
|
|
@@ -2144,8 +2153,7 @@ if (invokedPath === fileURLToPath(import.meta.url)) {
|
|
|
2144
2153
|
}
|
|
2145
2154
|
}
|
|
2146
2155
|
export {
|
|
2147
|
-
|
|
2148
|
-
runInferenceHostBootstrapNpmCommand,
|
|
2156
|
+
runCliReleaseNpmCommand,
|
|
2149
2157
|
runInferenceHostServiceBootstrap
|
|
2150
2158
|
};
|
|
2151
2159
|
/*! Bundled license information:
|