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