@vtxmacro/cli 2026.9.50 → 2026.9.52
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 +5 -3
- package/bin/vtx-service-bootstrap.js +118 -49
- package/bin/vtx-service-launcher.js +1389 -0
- package/bin/vtx.js +487 -332
- package/package.json +1 -1
package/bin/vtx.js
CHANGED
|
@@ -77,7 +77,7 @@ var init_agent_cli_release = __esm({
|
|
|
77
77
|
"agent-cli-release.json"() {
|
|
78
78
|
agent_cli_release_default = {
|
|
79
79
|
package_name: "@vtxmacro/cli",
|
|
80
|
-
package_version: "2026.9.
|
|
80
|
+
package_version: "2026.9.52",
|
|
81
81
|
codex_package_name: "@openai/codex",
|
|
82
82
|
codex_version: "0.153.3",
|
|
83
83
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -17580,12 +17580,9 @@ var init_dist = __esm({
|
|
|
17580
17580
|
}
|
|
17581
17581
|
});
|
|
17582
17582
|
|
|
17583
|
-
// lib/inference-host/mcp-transport.ts
|
|
17584
|
-
import { readFileSync } from "node:fs";
|
|
17585
|
-
import { X509Certificate } from "node:crypto";
|
|
17583
|
+
// lib/inference-host/mcp-transport-config.ts
|
|
17586
17584
|
import { isIP } from "node:net";
|
|
17587
17585
|
import { isAbsolute, win32 } from "node:path";
|
|
17588
|
-
import { Agent, fetch as undiciFetch } from "undici";
|
|
17589
17586
|
function resolveInferenceMcpDirectTransport(env) {
|
|
17590
17587
|
const address = String(env.VTX_INFERENCE_HOST_MCP_CONNECT_ADDRESS || "").trim();
|
|
17591
17588
|
const caFile = String(env.VTX_INFERENCE_HOST_MCP_CA_FILE || "").trim();
|
|
@@ -17595,40 +17592,8 @@ function resolveInferenceMcpDirectTransport(env) {
|
|
|
17595
17592
|
}
|
|
17596
17593
|
return { address, caFile };
|
|
17597
17594
|
}
|
|
17598
|
-
|
|
17599
|
-
|
|
17600
|
-
const canonical = new URL(endpoint);
|
|
17601
|
-
if (canonical.protocol !== "https:" || canonical.username || canonical.password || canonical.pathname !== "/insights/mcp" || canonical.search || canonical.hash || isIP(canonical.hostname) || !isIP(direct.address)) {
|
|
17602
|
-
throw new Error("Direct inference MCP transport requires a canonical HTTPS MCP hostname.");
|
|
17603
|
-
}
|
|
17604
|
-
const ca = readFileSync(direct.caFile, "utf8");
|
|
17605
|
-
new X509Certificate(ca);
|
|
17606
|
-
const agent = new Agent({
|
|
17607
|
-
connect: {
|
|
17608
|
-
ca,
|
|
17609
|
-
rejectUnauthorized: true,
|
|
17610
|
-
servername: canonical.hostname,
|
|
17611
|
-
lookup: (_hostname, options, callback) => {
|
|
17612
|
-
const address = { address: direct.address, family: isIP(direct.address) };
|
|
17613
|
-
if (options.all) callback(null, [address]);
|
|
17614
|
-
else callback(null, address.address, address.family);
|
|
17615
|
-
}
|
|
17616
|
-
}
|
|
17617
|
-
});
|
|
17618
|
-
const dispatchFetch = fetchImpl === fetch ? undiciFetch : fetchImpl;
|
|
17619
|
-
const routedFetch = (input, init2) => {
|
|
17620
|
-
const url2 = new URL(input instanceof Request ? input.url : String(input));
|
|
17621
|
-
if (url2.href !== canonical.href) {
|
|
17622
|
-
return Promise.reject(new Error("Direct inference transport cannot send requests outside its MCP endpoint."));
|
|
17623
|
-
}
|
|
17624
|
-
return dispatchFetch(input, { ...init2, redirect: "error", dispatcher: agent });
|
|
17625
|
-
};
|
|
17626
|
-
return { fetch: routedFetch, route: "direct", close: async () => {
|
|
17627
|
-
await agent.destroy();
|
|
17628
|
-
} };
|
|
17629
|
-
}
|
|
17630
|
-
var init_mcp_transport = __esm({
|
|
17631
|
-
"lib/inference-host/mcp-transport.ts"() {
|
|
17595
|
+
var init_mcp_transport_config = __esm({
|
|
17596
|
+
"lib/inference-host/mcp-transport-config.ts"() {
|
|
17632
17597
|
"use strict";
|
|
17633
17598
|
init_define_VTX_EXO_POLICY();
|
|
17634
17599
|
init_define_VTX_GROK_POLICY();
|
|
@@ -17884,7 +17849,7 @@ async function syncInferenceDirectory(path, platform = process.platform) {
|
|
|
17884
17849
|
async function replaceAtomicInferencePrivateFile(temporaryPath, destinationPath, options = {}) {
|
|
17885
17850
|
const platform = options.platform ?? process.platform;
|
|
17886
17851
|
const renameFile = options.renameFile ?? rename;
|
|
17887
|
-
const sleep4 = options.sleep ?? ((milliseconds) => new Promise((
|
|
17852
|
+
const sleep4 = options.sleep ?? ((milliseconds) => new Promise((resolve13) => setTimeout(resolve13, milliseconds)));
|
|
17888
17853
|
const maxAttempts = Math.max(1, options.maxAttempts ?? 40);
|
|
17889
17854
|
const retryDelayMs = Math.max(0, options.retryDelayMs ?? 25);
|
|
17890
17855
|
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
@@ -18217,7 +18182,7 @@ var init_config = __esm({
|
|
|
18217
18182
|
init_define_VTX_GROK_POLICY();
|
|
18218
18183
|
init_define_VTX_PI_MODEL_POLICY();
|
|
18219
18184
|
init_dist();
|
|
18220
|
-
|
|
18185
|
+
init_mcp_transport_config();
|
|
18221
18186
|
loadInferenceReceiptDurabilityTimeoutMs = async () => {
|
|
18222
18187
|
let configured;
|
|
18223
18188
|
if (true) {
|
|
@@ -19001,7 +18966,7 @@ var init_credential_store = __esm({
|
|
|
19001
18966
|
}
|
|
19002
18967
|
return;
|
|
19003
18968
|
}
|
|
19004
|
-
await new Promise((
|
|
18969
|
+
await new Promise((resolve13) => {
|
|
19005
18970
|
const terminator = spawn2(
|
|
19006
18971
|
"taskkill.exe",
|
|
19007
18972
|
["/PID", String(pid), "/T", "/F"],
|
|
@@ -19019,21 +18984,21 @@ var init_credential_store = __esm({
|
|
|
19019
18984
|
const timer = setTimeout(() => {
|
|
19020
18985
|
terminator.kill("SIGKILL");
|
|
19021
18986
|
child.kill("SIGKILL");
|
|
19022
|
-
|
|
18987
|
+
resolve13();
|
|
19023
18988
|
}, CREDENTIAL_COMMAND_TERMINATION_TIMEOUT_MS);
|
|
19024
18989
|
terminator.once("error", () => {
|
|
19025
18990
|
clearTimeout(timer);
|
|
19026
18991
|
child.kill("SIGKILL");
|
|
19027
|
-
|
|
18992
|
+
resolve13();
|
|
19028
18993
|
});
|
|
19029
18994
|
terminator.once("close", () => {
|
|
19030
18995
|
clearTimeout(timer);
|
|
19031
18996
|
if (child.exitCode === null) child.kill("SIGKILL");
|
|
19032
|
-
|
|
18997
|
+
resolve13();
|
|
19033
18998
|
});
|
|
19034
18999
|
});
|
|
19035
19000
|
};
|
|
19036
|
-
runCredentialCommand = async (command, options) => await new Promise((
|
|
19001
|
+
runCredentialCommand = async (command, options) => await new Promise((resolve13, reject) => {
|
|
19037
19002
|
const timeoutMs = options.timeoutMs ?? DEFAULT_CREDENTIAL_COMMAND_TIMEOUT_MS;
|
|
19038
19003
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1) {
|
|
19039
19004
|
reject(new Error("OS credential command timeout must be a positive integer."));
|
|
@@ -19092,7 +19057,7 @@ var init_credential_store = __esm({
|
|
|
19092
19057
|
const transformedStdout = normalizedExitCode === 0 ? command.transformStdout?.(stdout) ?? stdout : stdout;
|
|
19093
19058
|
settled = true;
|
|
19094
19059
|
cleanup();
|
|
19095
|
-
|
|
19060
|
+
resolve13({
|
|
19096
19061
|
exitCode: normalizedExitCode,
|
|
19097
19062
|
stdout: transformedStdout
|
|
19098
19063
|
});
|
|
@@ -20249,11 +20214,11 @@ async function revokeInferenceCredential(options) {
|
|
|
20249
20214
|
}
|
|
20250
20215
|
}
|
|
20251
20216
|
async function listenLoopback(server) {
|
|
20252
|
-
await new Promise((
|
|
20217
|
+
await new Promise((resolve13, reject) => {
|
|
20253
20218
|
server.once("error", reject);
|
|
20254
20219
|
server.listen(0, CALLBACK_HOST, () => {
|
|
20255
20220
|
server.off("error", reject);
|
|
20256
|
-
|
|
20221
|
+
resolve13();
|
|
20257
20222
|
});
|
|
20258
20223
|
});
|
|
20259
20224
|
const address = server.address();
|
|
@@ -20264,7 +20229,7 @@ async function listenLoopback(server) {
|
|
|
20264
20229
|
}
|
|
20265
20230
|
async function closeServer(server) {
|
|
20266
20231
|
if (!server.listening) return;
|
|
20267
|
-
await new Promise((
|
|
20232
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
20268
20233
|
}
|
|
20269
20234
|
async function beginInferenceOAuthLogin(options) {
|
|
20270
20235
|
const loginTimeoutMs = options.timeoutMs ?? 6e5;
|
|
@@ -20320,7 +20285,7 @@ async function beginInferenceOAuthLogin(options) {
|
|
|
20320
20285
|
});
|
|
20321
20286
|
let settled = false;
|
|
20322
20287
|
let rejectCompletion;
|
|
20323
|
-
const completion = new Promise((
|
|
20288
|
+
const completion = new Promise((resolve13, reject) => {
|
|
20324
20289
|
rejectCompletion = reject;
|
|
20325
20290
|
handler = async (requestUrl, method, writeResponse) => {
|
|
20326
20291
|
if (settled) {
|
|
@@ -20395,7 +20360,7 @@ async function beginInferenceOAuthLogin(options) {
|
|
|
20395
20360
|
'<!doctype html><html><head><meta charset="utf-8"><title>VTX authorization complete</title></head><body><main><h1>VTX authorization complete</h1><p>The VTX CLI received your approval. You can close this tab and return to the terminal.</p></main></body></html>'
|
|
20396
20361
|
);
|
|
20397
20362
|
await closeServer(server);
|
|
20398
|
-
|
|
20363
|
+
resolve13({
|
|
20399
20364
|
accessToken: tokens.accessToken,
|
|
20400
20365
|
expiresIn: tokens.expiresIn,
|
|
20401
20366
|
credential,
|
|
@@ -20583,6 +20548,8 @@ var init_runtime_policy_generated = __esm({
|
|
|
20583
20548
|
service: {
|
|
20584
20549
|
update_check_interval_ms: 3e5,
|
|
20585
20550
|
update_registry_timeout_ms: 15e3,
|
|
20551
|
+
bootstrap_readiness_timeout_ms: 6e5,
|
|
20552
|
+
bootstrap_stop_timeout_ms: 1e4,
|
|
20586
20553
|
startup_max_attempts: 40,
|
|
20587
20554
|
startup_poll_interval_ms: 250,
|
|
20588
20555
|
restart_stable_uptime_ms: 6e4,
|
|
@@ -20667,6 +20634,53 @@ var init_runtime_policy_generated = __esm({
|
|
|
20667
20634
|
}
|
|
20668
20635
|
});
|
|
20669
20636
|
|
|
20637
|
+
// lib/inference-host/mcp-transport.ts
|
|
20638
|
+
import { readFileSync } from "node:fs";
|
|
20639
|
+
import { X509Certificate } from "node:crypto";
|
|
20640
|
+
import { isIP as isIP2 } from "node:net";
|
|
20641
|
+
import { Agent, fetch as undiciFetch } from "undici";
|
|
20642
|
+
function createInferenceMcpTransport(endpoint, direct, fetchImpl = fetch) {
|
|
20643
|
+
if (!direct) return { fetch: fetchImpl, route: "public", close: async () => void 0 };
|
|
20644
|
+
const canonical = new URL(endpoint);
|
|
20645
|
+
if (canonical.protocol !== "https:" || canonical.username || canonical.password || canonical.pathname !== "/insights/mcp" || canonical.search || canonical.hash || isIP2(canonical.hostname) || !isIP2(direct.address)) {
|
|
20646
|
+
throw new Error("Direct inference MCP transport requires a canonical HTTPS MCP hostname.");
|
|
20647
|
+
}
|
|
20648
|
+
const ca = readFileSync(direct.caFile, "utf8");
|
|
20649
|
+
new X509Certificate(ca);
|
|
20650
|
+
const agent = new Agent({
|
|
20651
|
+
connect: {
|
|
20652
|
+
ca,
|
|
20653
|
+
rejectUnauthorized: true,
|
|
20654
|
+
servername: canonical.hostname,
|
|
20655
|
+
lookup: (_hostname, options, callback) => {
|
|
20656
|
+
const address = { address: direct.address, family: isIP2(direct.address) };
|
|
20657
|
+
if (options.all) callback(null, [address]);
|
|
20658
|
+
else callback(null, address.address, address.family);
|
|
20659
|
+
}
|
|
20660
|
+
}
|
|
20661
|
+
});
|
|
20662
|
+
const dispatchFetch = fetchImpl === fetch ? undiciFetch : fetchImpl;
|
|
20663
|
+
const routedFetch = (input, init2) => {
|
|
20664
|
+
const url2 = new URL(input instanceof Request ? input.url : String(input));
|
|
20665
|
+
if (url2.href !== canonical.href) {
|
|
20666
|
+
return Promise.reject(new Error("Direct inference transport cannot send requests outside its MCP endpoint."));
|
|
20667
|
+
}
|
|
20668
|
+
return dispatchFetch(input, { ...init2, redirect: "error", dispatcher: agent });
|
|
20669
|
+
};
|
|
20670
|
+
return { fetch: routedFetch, route: "direct", close: async () => {
|
|
20671
|
+
await agent.destroy();
|
|
20672
|
+
} };
|
|
20673
|
+
}
|
|
20674
|
+
var init_mcp_transport = __esm({
|
|
20675
|
+
"lib/inference-host/mcp-transport.ts"() {
|
|
20676
|
+
"use strict";
|
|
20677
|
+
init_define_VTX_EXO_POLICY();
|
|
20678
|
+
init_define_VTX_GROK_POLICY();
|
|
20679
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
20680
|
+
init_mcp_transport_config();
|
|
20681
|
+
}
|
|
20682
|
+
});
|
|
20683
|
+
|
|
20670
20684
|
// lib/inference-host/mcp-client.ts
|
|
20671
20685
|
var EXTERNAL_INFERENCE_MCP_PROTOCOL_VERSION, EXTERNAL_INFERENCE_AUTOMATED_HOST_TOOLS, EXTERNAL_INFERENCE_OPERATIONAL_TOOLS, ClaimTiming, ExternalInferenceMcpError, DEFAULT_REQUEST_TIMEOUT_MS, MAX_RETRY_AFTER_MS, PUBLIC_TOOL_ERROR_PREFIX, parseRetryAfterMs, identifierSchema2, safeCodeSchema2, publicFailureCodeSchema, publicToolErrorSchema, structuredPublicToolErrorSchema, parsePublicToolError, hostMutationResultSchema, attemptStartResultSchema, agentConnectResultSchema, agentHeartbeatResultSchema, timestampSchema2, positiveGenerationSchema, jsonObjectSchema, agentAssignmentNextArgumentsSchema, agentDataCapabilityDescriptorSchema, agentAssignmentNextResultSchema, agentAssignmentHeartbeatArgumentsSchema, agentAssignmentHeartbeatResultSchema, agentDataCallArgumentsSchema, agentDataCallResultSchema, agentDecisionSubmitArgumentsSchema, agentDecisionSubmitResultSchema, agentDecisionStatusArgumentsSchema, agentDecisionStatusResultSchema, agentAssignmentReleaseArgumentsSchema, agentAssignmentReleaseResultSchema, jobCompletionResultSchema, jobFailureResultSchema, toolContracts, discoveryResultSchema, toolListResultSchema, inlineStructuredContentSchema, protocolMeta, parseJsonDocument, parseSseDocuments, parseResponseDocuments, exactOperationalInventory, exactJson, invalidBoundResult, verifyToolResult, ExternalInferenceMcpClient;
|
|
20672
20686
|
var init_mcp_client = __esm({
|
|
@@ -22492,51 +22506,51 @@ var require_uri_all = __commonJS({
|
|
|
22492
22506
|
}
|
|
22493
22507
|
return uriTokens.join("");
|
|
22494
22508
|
}
|
|
22495
|
-
function resolveComponents(base2,
|
|
22509
|
+
function resolveComponents(base2, relative4) {
|
|
22496
22510
|
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
22497
22511
|
var skipNormalization = arguments[3];
|
|
22498
22512
|
var target = {};
|
|
22499
22513
|
if (!skipNormalization) {
|
|
22500
22514
|
base2 = parse5(serialize(base2, options), options);
|
|
22501
|
-
|
|
22515
|
+
relative4 = parse5(serialize(relative4, options), options);
|
|
22502
22516
|
}
|
|
22503
22517
|
options = options || {};
|
|
22504
|
-
if (!options.tolerant &&
|
|
22505
|
-
target.scheme =
|
|
22506
|
-
target.userinfo =
|
|
22507
|
-
target.host =
|
|
22508
|
-
target.port =
|
|
22509
|
-
target.path = removeDotSegments(
|
|
22510
|
-
target.query =
|
|
22518
|
+
if (!options.tolerant && relative4.scheme) {
|
|
22519
|
+
target.scheme = relative4.scheme;
|
|
22520
|
+
target.userinfo = relative4.userinfo;
|
|
22521
|
+
target.host = relative4.host;
|
|
22522
|
+
target.port = relative4.port;
|
|
22523
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
22524
|
+
target.query = relative4.query;
|
|
22511
22525
|
} else {
|
|
22512
|
-
if (
|
|
22513
|
-
target.userinfo =
|
|
22514
|
-
target.host =
|
|
22515
|
-
target.port =
|
|
22516
|
-
target.path = removeDotSegments(
|
|
22517
|
-
target.query =
|
|
22526
|
+
if (relative4.userinfo !== void 0 || relative4.host !== void 0 || relative4.port !== void 0) {
|
|
22527
|
+
target.userinfo = relative4.userinfo;
|
|
22528
|
+
target.host = relative4.host;
|
|
22529
|
+
target.port = relative4.port;
|
|
22530
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
22531
|
+
target.query = relative4.query;
|
|
22518
22532
|
} else {
|
|
22519
|
-
if (!
|
|
22533
|
+
if (!relative4.path) {
|
|
22520
22534
|
target.path = base2.path;
|
|
22521
|
-
if (
|
|
22522
|
-
target.query =
|
|
22535
|
+
if (relative4.query !== void 0) {
|
|
22536
|
+
target.query = relative4.query;
|
|
22523
22537
|
} else {
|
|
22524
22538
|
target.query = base2.query;
|
|
22525
22539
|
}
|
|
22526
22540
|
} else {
|
|
22527
|
-
if (
|
|
22528
|
-
target.path = removeDotSegments(
|
|
22541
|
+
if (relative4.path.charAt(0) === "/") {
|
|
22542
|
+
target.path = removeDotSegments(relative4.path);
|
|
22529
22543
|
} else {
|
|
22530
22544
|
if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) {
|
|
22531
|
-
target.path = "/" +
|
|
22545
|
+
target.path = "/" + relative4.path;
|
|
22532
22546
|
} else if (!base2.path) {
|
|
22533
|
-
target.path =
|
|
22547
|
+
target.path = relative4.path;
|
|
22534
22548
|
} else {
|
|
22535
|
-
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) +
|
|
22549
|
+
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative4.path;
|
|
22536
22550
|
}
|
|
22537
22551
|
target.path = removeDotSegments(target.path);
|
|
22538
22552
|
}
|
|
22539
|
-
target.query =
|
|
22553
|
+
target.query = relative4.query;
|
|
22540
22554
|
}
|
|
22541
22555
|
target.userinfo = base2.userinfo;
|
|
22542
22556
|
target.host = base2.host;
|
|
@@ -22544,10 +22558,10 @@ var require_uri_all = __commonJS({
|
|
|
22544
22558
|
}
|
|
22545
22559
|
target.scheme = base2.scheme;
|
|
22546
22560
|
}
|
|
22547
|
-
target.fragment =
|
|
22561
|
+
target.fragment = relative4.fragment;
|
|
22548
22562
|
return target;
|
|
22549
22563
|
}
|
|
22550
|
-
function
|
|
22564
|
+
function resolve13(baseURI, relativeURI, options) {
|
|
22551
22565
|
var schemelessOptions = assign({ scheme: "null" }, options);
|
|
22552
22566
|
return serialize(resolveComponents(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
|
|
22553
22567
|
}
|
|
@@ -22812,7 +22826,7 @@ var require_uri_all = __commonJS({
|
|
|
22812
22826
|
exports2.removeDotSegments = removeDotSegments;
|
|
22813
22827
|
exports2.serialize = serialize;
|
|
22814
22828
|
exports2.resolveComponents = resolveComponents;
|
|
22815
|
-
exports2.resolve =
|
|
22829
|
+
exports2.resolve = resolve13;
|
|
22816
22830
|
exports2.normalize = normalize;
|
|
22817
22831
|
exports2.equal = equal;
|
|
22818
22832
|
exports2.escapeComponent = escapeComponent;
|
|
@@ -23183,18 +23197,18 @@ var require_resolve = __commonJS({
|
|
|
23183
23197
|
var util = require_util();
|
|
23184
23198
|
var SchemaObject = require_schema_obj();
|
|
23185
23199
|
var traverse = require_json_schema_traverse();
|
|
23186
|
-
module.exports =
|
|
23187
|
-
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
|
|
23193
|
-
function
|
|
23200
|
+
module.exports = resolve13;
|
|
23201
|
+
resolve13.normalizeId = normalizeId;
|
|
23202
|
+
resolve13.fullPath = getFullPath;
|
|
23203
|
+
resolve13.url = resolveUrl;
|
|
23204
|
+
resolve13.ids = resolveIds;
|
|
23205
|
+
resolve13.inlineRef = inlineRef;
|
|
23206
|
+
resolve13.schema = resolveSchema;
|
|
23207
|
+
function resolve13(compile, root, ref) {
|
|
23194
23208
|
var refVal = this._refs[ref];
|
|
23195
23209
|
if (typeof refVal == "string") {
|
|
23196
23210
|
if (this._refs[refVal]) refVal = this._refs[refVal];
|
|
23197
|
-
else return
|
|
23211
|
+
else return resolve13.call(this, compile, root, refVal);
|
|
23198
23212
|
}
|
|
23199
23213
|
refVal = refVal || this._schemas[ref];
|
|
23200
23214
|
if (refVal instanceof SchemaObject) {
|
|
@@ -23402,7 +23416,7 @@ var require_error_classes = __commonJS({
|
|
|
23402
23416
|
init_define_VTX_EXO_POLICY();
|
|
23403
23417
|
init_define_VTX_GROK_POLICY();
|
|
23404
23418
|
init_define_VTX_PI_MODEL_POLICY();
|
|
23405
|
-
var
|
|
23419
|
+
var resolve13 = require_resolve();
|
|
23406
23420
|
module.exports = {
|
|
23407
23421
|
Validation: errorSubclass(ValidationError),
|
|
23408
23422
|
MissingRef: errorSubclass(MissingRefError)
|
|
@@ -23417,8 +23431,8 @@ var require_error_classes = __commonJS({
|
|
|
23417
23431
|
};
|
|
23418
23432
|
function MissingRefError(baseId, ref, message) {
|
|
23419
23433
|
this.message = message || MissingRefError.message(baseId, ref);
|
|
23420
|
-
this.missingRef =
|
|
23421
|
-
this.missingSchema =
|
|
23434
|
+
this.missingRef = resolve13.url(baseId, ref);
|
|
23435
|
+
this.missingSchema = resolve13.normalizeId(resolve13.fullPath(this.missingRef));
|
|
23422
23436
|
}
|
|
23423
23437
|
function errorSubclass(Subclass) {
|
|
23424
23438
|
Subclass.prototype = Object.create(Error.prototype);
|
|
@@ -23955,7 +23969,7 @@ var require_compile = __commonJS({
|
|
|
23955
23969
|
init_define_VTX_EXO_POLICY();
|
|
23956
23970
|
init_define_VTX_GROK_POLICY();
|
|
23957
23971
|
init_define_VTX_PI_MODEL_POLICY();
|
|
23958
|
-
var
|
|
23972
|
+
var resolve13 = require_resolve();
|
|
23959
23973
|
var util = require_util();
|
|
23960
23974
|
var errorClasses = require_error_classes();
|
|
23961
23975
|
var stableStringify = require_fast_json_stable_stringify();
|
|
@@ -24017,7 +24031,7 @@ var require_compile = __commonJS({
|
|
|
24017
24031
|
RULES,
|
|
24018
24032
|
validate: validateGenerator,
|
|
24019
24033
|
util,
|
|
24020
|
-
resolve:
|
|
24034
|
+
resolve: resolve13,
|
|
24021
24035
|
resolveRef: resolveRef2,
|
|
24022
24036
|
usePattern,
|
|
24023
24037
|
useDefault,
|
|
@@ -24079,7 +24093,7 @@ var require_compile = __commonJS({
|
|
|
24079
24093
|
return validate;
|
|
24080
24094
|
}
|
|
24081
24095
|
function resolveRef2(baseId2, ref, isRoot) {
|
|
24082
|
-
ref =
|
|
24096
|
+
ref = resolve13.url(baseId2, ref);
|
|
24083
24097
|
var refIndex = refs[ref];
|
|
24084
24098
|
var _refVal, refCode;
|
|
24085
24099
|
if (refIndex !== void 0) {
|
|
@@ -24096,11 +24110,11 @@ var require_compile = __commonJS({
|
|
|
24096
24110
|
}
|
|
24097
24111
|
}
|
|
24098
24112
|
refCode = addLocalRef(ref);
|
|
24099
|
-
var v2 =
|
|
24113
|
+
var v2 = resolve13.call(self2, localCompile, root, ref);
|
|
24100
24114
|
if (v2 === void 0) {
|
|
24101
24115
|
var localSchema = localRefs && localRefs[ref];
|
|
24102
24116
|
if (localSchema) {
|
|
24103
|
-
v2 =
|
|
24117
|
+
v2 = resolve13.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self2, localSchema, root, localRefs, baseId2);
|
|
24104
24118
|
}
|
|
24105
24119
|
}
|
|
24106
24120
|
if (v2 === void 0) {
|
|
@@ -27816,7 +27830,7 @@ var require_ajv = __commonJS({
|
|
|
27816
27830
|
init_define_VTX_GROK_POLICY();
|
|
27817
27831
|
init_define_VTX_PI_MODEL_POLICY();
|
|
27818
27832
|
var compileSchema = require_compile();
|
|
27819
|
-
var
|
|
27833
|
+
var resolve13 = require_resolve();
|
|
27820
27834
|
var Cache = require_cache();
|
|
27821
27835
|
var SchemaObject = require_schema_obj();
|
|
27822
27836
|
var stableStringify = require_fast_json_stable_stringify();
|
|
@@ -27898,7 +27912,7 @@ var require_ajv = __commonJS({
|
|
|
27898
27912
|
var id2 = this._getId(schema);
|
|
27899
27913
|
if (id2 !== void 0 && typeof id2 != "string")
|
|
27900
27914
|
throw new Error("schema id must be string");
|
|
27901
|
-
key =
|
|
27915
|
+
key = resolve13.normalizeId(key || id2);
|
|
27902
27916
|
checkUnique(this, key);
|
|
27903
27917
|
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
|
|
27904
27918
|
return this;
|
|
@@ -27942,7 +27956,7 @@ var require_ajv = __commonJS({
|
|
|
27942
27956
|
}
|
|
27943
27957
|
}
|
|
27944
27958
|
function _getSchemaFragment(self2, ref) {
|
|
27945
|
-
var res =
|
|
27959
|
+
var res = resolve13.schema.call(self2, { schema: {} }, ref);
|
|
27946
27960
|
if (res) {
|
|
27947
27961
|
var schema = res.schema, root = res.root, baseId = res.baseId;
|
|
27948
27962
|
var v = compileSchema.call(self2, schema, root, void 0, baseId);
|
|
@@ -27958,7 +27972,7 @@ var require_ajv = __commonJS({
|
|
|
27958
27972
|
}
|
|
27959
27973
|
}
|
|
27960
27974
|
function _getSchemaObj(self2, keyRef) {
|
|
27961
|
-
keyRef =
|
|
27975
|
+
keyRef = resolve13.normalizeId(keyRef);
|
|
27962
27976
|
return self2._schemas[keyRef] || self2._refs[keyRef] || self2._fragments[keyRef];
|
|
27963
27977
|
}
|
|
27964
27978
|
function removeSchema(schemaKeyRef) {
|
|
@@ -27985,7 +27999,7 @@ var require_ajv = __commonJS({
|
|
|
27985
27999
|
this._cache.del(cacheKey);
|
|
27986
28000
|
var id2 = this._getId(schemaKeyRef);
|
|
27987
28001
|
if (id2) {
|
|
27988
|
-
id2 =
|
|
28002
|
+
id2 = resolve13.normalizeId(id2);
|
|
27989
28003
|
delete this._schemas[id2];
|
|
27990
28004
|
delete this._refs[id2];
|
|
27991
28005
|
}
|
|
@@ -28009,13 +28023,13 @@ var require_ajv = __commonJS({
|
|
|
28009
28023
|
var cached2 = this._cache.get(cacheKey);
|
|
28010
28024
|
if (cached2) return cached2;
|
|
28011
28025
|
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
|
|
28012
|
-
var id2 =
|
|
28026
|
+
var id2 = resolve13.normalizeId(this._getId(schema));
|
|
28013
28027
|
if (id2 && shouldAddSchema) checkUnique(this, id2);
|
|
28014
28028
|
var willValidate = this._opts.validateSchema !== false && !skipValidation;
|
|
28015
28029
|
var recursiveMeta;
|
|
28016
|
-
if (willValidate && !(recursiveMeta = id2 && id2 ==
|
|
28030
|
+
if (willValidate && !(recursiveMeta = id2 && id2 == resolve13.normalizeId(schema.$schema)))
|
|
28017
28031
|
this.validateSchema(schema, true);
|
|
28018
|
-
var localRefs =
|
|
28032
|
+
var localRefs = resolve13.ids.call(this, schema);
|
|
28019
28033
|
var schemaObj = new SchemaObject({
|
|
28020
28034
|
id: id2,
|
|
28021
28035
|
schema,
|
|
@@ -28599,7 +28613,7 @@ var init_codex_app_server = __esm({
|
|
|
28599
28613
|
};
|
|
28600
28614
|
};
|
|
28601
28615
|
killWindowsProcessTree = async (pid) => {
|
|
28602
|
-
await new Promise((
|
|
28616
|
+
await new Promise((resolve13, reject) => {
|
|
28603
28617
|
const child = spawn3(
|
|
28604
28618
|
"taskkill.exe",
|
|
28605
28619
|
["/PID", String(pid), "/T", "/F"],
|
|
@@ -28624,7 +28638,7 @@ var init_codex_app_server = __esm({
|
|
|
28624
28638
|
});
|
|
28625
28639
|
child.once("close", (code) => {
|
|
28626
28640
|
clearTimeout(timer);
|
|
28627
|
-
if (code === 0 || code === 128)
|
|
28641
|
+
if (code === 0 || code === 128) resolve13();
|
|
28628
28642
|
else reject(new Error("Windows Codex process-tree cleanup failed."));
|
|
28629
28643
|
});
|
|
28630
28644
|
});
|
|
@@ -28824,7 +28838,7 @@ child.once('close', async (code, signal) => {
|
|
|
28824
28838
|
const platform = options.platform ?? process.platform;
|
|
28825
28839
|
const renameFile = options.renameFile ?? rename2;
|
|
28826
28840
|
const removeFile = options.removeFile ?? ((path) => rm2(path, { force: true }));
|
|
28827
|
-
const sleep4 = options.sleep ?? ((milliseconds) => new Promise((
|
|
28841
|
+
const sleep4 = options.sleep ?? ((milliseconds) => new Promise((resolve13) => setTimeout(resolve13, milliseconds)));
|
|
28828
28842
|
const maxAttempts = Math.max(1, options.maxAttempts ?? 40);
|
|
28829
28843
|
const retryDelayMs = Math.max(0, options.retryDelayMs ?? 25);
|
|
28830
28844
|
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
@@ -28916,7 +28930,7 @@ child.once('close', async (code, signal) => {
|
|
|
28916
28930
|
throw new Error("Codex guardian terminated before app-server initialization.");
|
|
28917
28931
|
}
|
|
28918
28932
|
}
|
|
28919
|
-
await new Promise((
|
|
28933
|
+
await new Promise((resolve13) => setTimeout(resolve13, 25));
|
|
28920
28934
|
}
|
|
28921
28935
|
throw new Error(`Codex guardian ${expectedState} state was not confirmed.`);
|
|
28922
28936
|
};
|
|
@@ -29298,8 +29312,8 @@ child.once('close', async (code, signal) => {
|
|
|
29298
29312
|
dispatchOutcome: "not_dispatched"
|
|
29299
29313
|
});
|
|
29300
29314
|
}
|
|
29301
|
-
return await new Promise((
|
|
29302
|
-
const pending3 = { resolve:
|
|
29315
|
+
return await new Promise((resolve13, reject) => {
|
|
29316
|
+
const pending3 = { resolve: resolve13, reject, timer: null, abortCleanup: null };
|
|
29303
29317
|
pending3.timer = setTimeout(() => {
|
|
29304
29318
|
this.pending.delete(id2);
|
|
29305
29319
|
this.retireResponseId(id2, method);
|
|
@@ -29974,8 +29988,8 @@ child.once('close', async (code, signal) => {
|
|
|
29974
29988
|
const agentWebSearches = [];
|
|
29975
29989
|
let terminalResolve;
|
|
29976
29990
|
let terminalReject;
|
|
29977
|
-
const terminalPromise = new Promise((
|
|
29978
|
-
terminalResolve =
|
|
29991
|
+
const terminalPromise = new Promise((resolve13, reject) => {
|
|
29992
|
+
terminalResolve = resolve13;
|
|
29979
29993
|
terminalReject = reject;
|
|
29980
29994
|
});
|
|
29981
29995
|
void terminalPromise.catch(() => void 0);
|
|
@@ -30535,15 +30549,15 @@ child.once('close', async (code, signal) => {
|
|
|
30535
30549
|
).catch(() => void 0);
|
|
30536
30550
|
}
|
|
30537
30551
|
this.process.stdin.end();
|
|
30538
|
-
const exited = await new Promise((
|
|
30552
|
+
const exited = await new Promise((resolve13) => {
|
|
30539
30553
|
if (this.process.exitCode !== null) {
|
|
30540
|
-
|
|
30554
|
+
resolve13(true);
|
|
30541
30555
|
return;
|
|
30542
30556
|
}
|
|
30543
|
-
const timer = setTimeout(() =>
|
|
30557
|
+
const timer = setTimeout(() => resolve13(false), 5e3);
|
|
30544
30558
|
this.process.once("close", () => {
|
|
30545
30559
|
clearTimeout(timer);
|
|
30546
|
-
|
|
30560
|
+
resolve13(true);
|
|
30547
30561
|
});
|
|
30548
30562
|
});
|
|
30549
30563
|
if (exited) return;
|
|
@@ -30554,11 +30568,11 @@ child.once('close', async (code, signal) => {
|
|
|
30554
30568
|
else this.process.kill("SIGTERM");
|
|
30555
30569
|
} catch {
|
|
30556
30570
|
}
|
|
30557
|
-
const terminated = await new Promise((
|
|
30558
|
-
const timer = setTimeout(() =>
|
|
30571
|
+
const terminated = await new Promise((resolve13) => {
|
|
30572
|
+
const timer = setTimeout(() => resolve13(false), 1e3);
|
|
30559
30573
|
this.process.once("close", () => {
|
|
30560
30574
|
clearTimeout(timer);
|
|
30561
|
-
|
|
30575
|
+
resolve13(true);
|
|
30562
30576
|
});
|
|
30563
30577
|
});
|
|
30564
30578
|
if (!terminated) {
|
|
@@ -30568,15 +30582,15 @@ child.once('close', async (code, signal) => {
|
|
|
30568
30582
|
else this.process.kill("SIGKILL");
|
|
30569
30583
|
} catch {
|
|
30570
30584
|
}
|
|
30571
|
-
await new Promise((
|
|
30585
|
+
await new Promise((resolve13) => {
|
|
30572
30586
|
if (this.process.exitCode !== null) {
|
|
30573
|
-
|
|
30587
|
+
resolve13();
|
|
30574
30588
|
return;
|
|
30575
30589
|
}
|
|
30576
|
-
const timer = setTimeout(
|
|
30590
|
+
const timer = setTimeout(resolve13, 1e3);
|
|
30577
30591
|
this.process.once("close", () => {
|
|
30578
30592
|
clearTimeout(timer);
|
|
30579
|
-
|
|
30593
|
+
resolve13();
|
|
30580
30594
|
});
|
|
30581
30595
|
});
|
|
30582
30596
|
if (this.process.exitCode === null) {
|
|
@@ -31194,13 +31208,13 @@ var init_runner = __esm({
|
|
|
31194
31208
|
};
|
|
31195
31209
|
defaultSleep = async (milliseconds, signal) => {
|
|
31196
31210
|
if (signal?.aborted) throw abortError();
|
|
31197
|
-
await new Promise((
|
|
31211
|
+
await new Promise((resolve13, reject) => {
|
|
31198
31212
|
const finish = (callback) => {
|
|
31199
31213
|
signal?.removeEventListener("abort", onAbort);
|
|
31200
31214
|
callback();
|
|
31201
31215
|
};
|
|
31202
31216
|
const timer = setTimeout(
|
|
31203
|
-
() => finish(
|
|
31217
|
+
() => finish(resolve13),
|
|
31204
31218
|
Math.max(MIN_SLEEP_MS, milliseconds)
|
|
31205
31219
|
);
|
|
31206
31220
|
const onAbort = () => {
|
|
@@ -31226,9 +31240,9 @@ var init_runner = __esm({
|
|
|
31226
31240
|
let timer = null;
|
|
31227
31241
|
const settled = await Promise.race([
|
|
31228
31242
|
promise2.then(() => true, () => true),
|
|
31229
|
-
new Promise((
|
|
31243
|
+
new Promise((resolve13) => {
|
|
31230
31244
|
timer = setTimeout(
|
|
31231
|
-
() =>
|
|
31245
|
+
() => resolve13(false),
|
|
31232
31246
|
Math.max(MIN_SLEEP_MS, timeoutMs)
|
|
31233
31247
|
);
|
|
31234
31248
|
})
|
|
@@ -31803,8 +31817,8 @@ var init_runner = __esm({
|
|
|
31803
31817
|
};
|
|
31804
31818
|
let quiesceRequested = Boolean(this.options.quiesceSignal?.aborted);
|
|
31805
31819
|
let wakeQuiesce;
|
|
31806
|
-
const quiesceWake = new Promise((
|
|
31807
|
-
wakeQuiesce =
|
|
31820
|
+
const quiesceWake = new Promise((resolve13) => {
|
|
31821
|
+
wakeQuiesce = resolve13;
|
|
31808
31822
|
});
|
|
31809
31823
|
let drainRequested = false;
|
|
31810
31824
|
let drainReason = "stopped";
|
|
@@ -31827,8 +31841,8 @@ var init_runner = __esm({
|
|
|
31827
31841
|
let modelCatalogRefresh = null;
|
|
31828
31842
|
let providerRateLimitRefresh = null;
|
|
31829
31843
|
let wakeDrain;
|
|
31830
|
-
const drainSignal = new Promise((
|
|
31831
|
-
wakeDrain =
|
|
31844
|
+
const drainSignal = new Promise((resolve13) => {
|
|
31845
|
+
wakeDrain = resolve13;
|
|
31832
31846
|
});
|
|
31833
31847
|
const requestDrain = (reason) => {
|
|
31834
31848
|
const priority = (value) => {
|
|
@@ -31919,7 +31933,7 @@ var init_runner = __esm({
|
|
|
31919
31933
|
const metadata = await this.dependencies.discoverOAuth({
|
|
31920
31934
|
signal: this.options.signal
|
|
31921
31935
|
});
|
|
31922
|
-
let
|
|
31936
|
+
let access6 = null;
|
|
31923
31937
|
let accessExpiresAt = 0;
|
|
31924
31938
|
let refreshPromise = null;
|
|
31925
31939
|
const refreshAccessToken = async (requestOptions = {}) => {
|
|
@@ -31932,7 +31946,7 @@ var init_runner = __esm({
|
|
|
31932
31946
|
);
|
|
31933
31947
|
assertLocalCredentialIdentity(localState, refreshed.credential);
|
|
31934
31948
|
credential = refreshed.credential;
|
|
31935
|
-
|
|
31949
|
+
access6 = refreshed;
|
|
31936
31950
|
accessExpiresAt = now() + refreshed.expiresIn * 1e3;
|
|
31937
31951
|
return refreshed.accessToken;
|
|
31938
31952
|
})();
|
|
@@ -31945,10 +31959,10 @@ var init_runner = __esm({
|
|
|
31945
31959
|
await refreshAccessToken({ signal: this.options.signal });
|
|
31946
31960
|
const tokenSource = {
|
|
31947
31961
|
accessToken: async (requestOptions) => {
|
|
31948
|
-
if (!
|
|
31962
|
+
if (!access6 || accessExpiresAt - now() <= 5e3) {
|
|
31949
31963
|
return refreshAccessToken(requestOptions);
|
|
31950
31964
|
}
|
|
31951
|
-
return
|
|
31965
|
+
return access6.accessToken;
|
|
31952
31966
|
},
|
|
31953
31967
|
refreshAccessToken
|
|
31954
31968
|
};
|
|
@@ -32203,8 +32217,8 @@ var init_runner = __esm({
|
|
|
32203
32217
|
receipt = result2;
|
|
32204
32218
|
const revision = receiptRevision + 1;
|
|
32205
32219
|
receiptRevision = revision;
|
|
32206
|
-
const durable = new Promise((
|
|
32207
|
-
receiptDurabilityWaiters.push({ revision, resolve:
|
|
32220
|
+
const durable = new Promise((resolve13, reject) => {
|
|
32221
|
+
receiptDurabilityWaiters.push({ revision, resolve: resolve13, reject });
|
|
32208
32222
|
});
|
|
32209
32223
|
scheduleReceiptWriter();
|
|
32210
32224
|
await durable;
|
|
@@ -32320,8 +32334,8 @@ var init_runner = __esm({
|
|
|
32320
32334
|
const tool = receipt.registered ? "inference.host.advertise" : "inference.host.register";
|
|
32321
32335
|
let result2;
|
|
32322
32336
|
let releaseAdvertisementHandoff;
|
|
32323
|
-
const currentAdvertisementHandoff = new Promise((
|
|
32324
|
-
releaseAdvertisementHandoff =
|
|
32337
|
+
const currentAdvertisementHandoff = new Promise((resolve13) => {
|
|
32338
|
+
releaseAdvertisementHandoff = resolve13;
|
|
32325
32339
|
});
|
|
32326
32340
|
advertisementHandoff = currentAdvertisementHandoff;
|
|
32327
32341
|
try {
|
|
@@ -33538,8 +33552,8 @@ var init_runner = __esm({
|
|
|
33538
33552
|
let providerDispatchWatchdog = null;
|
|
33539
33553
|
let providerDispatchWatchdogExpired = false;
|
|
33540
33554
|
let resolveProviderDispatchWatchdog;
|
|
33541
|
-
const providerDispatchWatchdogSignal = new Promise((
|
|
33542
|
-
resolveProviderDispatchWatchdog =
|
|
33555
|
+
const providerDispatchWatchdogSignal = new Promise((resolve13) => {
|
|
33556
|
+
resolveProviderDispatchWatchdog = resolve13;
|
|
33543
33557
|
});
|
|
33544
33558
|
const clearProviderDispatchWatchdog = () => {
|
|
33545
33559
|
if (providerDispatchWatchdog !== null) clearTimeout(providerDispatchWatchdog);
|
|
@@ -33976,8 +33990,8 @@ var init_runner = __esm({
|
|
|
33976
33990
|
});
|
|
33977
33991
|
}
|
|
33978
33992
|
let resolveTerminalDispatchOutcome;
|
|
33979
|
-
const terminalDispatchOutcomeSignal = new Promise((
|
|
33980
|
-
resolveTerminalDispatchOutcome =
|
|
33993
|
+
const terminalDispatchOutcomeSignal = new Promise((resolve13) => {
|
|
33994
|
+
resolveTerminalDispatchOutcome = resolve13;
|
|
33981
33995
|
});
|
|
33982
33996
|
let terminalDispatchOutcomeObserved = false;
|
|
33983
33997
|
const adapterAttempt = this.dependencies.codexAdapter.runAttempt({
|
|
@@ -35281,7 +35295,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35281
35295
|
throw new Error("Host reauthorization was rejected; the previous host identity was preserved.");
|
|
35282
35296
|
}
|
|
35283
35297
|
let candidate = await store.readRecovery();
|
|
35284
|
-
let
|
|
35298
|
+
let access6 = options.authorizedAccess ?? null;
|
|
35285
35299
|
if (!candidate) {
|
|
35286
35300
|
if (transition) {
|
|
35287
35301
|
if (!transition.remote_committed || options.state.client_id !== transition.client_id) {
|
|
@@ -35307,7 +35321,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35307
35321
|
});
|
|
35308
35322
|
options.emitAuthorization(pending3.authorizationUrl);
|
|
35309
35323
|
try {
|
|
35310
|
-
|
|
35324
|
+
access6 = await pending3.completion;
|
|
35311
35325
|
} catch (error48) {
|
|
35312
35326
|
await pending3.cancel().catch(() => void 0);
|
|
35313
35327
|
throw error48;
|
|
@@ -35356,7 +35370,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35356
35370
|
return runStopped(() => reauthorizeInferenceHost({
|
|
35357
35371
|
...options,
|
|
35358
35372
|
withStoppedHost: void 0,
|
|
35359
|
-
authorizedAccess:
|
|
35373
|
+
authorizedAccess: access6 ?? void 0
|
|
35360
35374
|
}));
|
|
35361
35375
|
}
|
|
35362
35376
|
if (transition.service_prepare_pending) {
|
|
@@ -35365,8 +35379,8 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35365
35379
|
await save();
|
|
35366
35380
|
}
|
|
35367
35381
|
if (!transition.remote_committed) {
|
|
35368
|
-
if (!
|
|
35369
|
-
|
|
35382
|
+
if (!access6) {
|
|
35383
|
+
access6 = await refreshInferenceCredential({
|
|
35370
35384
|
metadata: await discoverInferenceOAuth(config2.apiUrl),
|
|
35371
35385
|
credential: candidate.credential,
|
|
35372
35386
|
store: stagedStore
|
|
@@ -35384,7 +35398,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35384
35398
|
});
|
|
35385
35399
|
let result2;
|
|
35386
35400
|
try {
|
|
35387
|
-
result2 = await register(
|
|
35401
|
+
result2 = await register(access6, transition.advertisement);
|
|
35388
35402
|
} catch (error48) {
|
|
35389
35403
|
if (error48 instanceof ExternalInferenceMcpError && error48.code === "tool_rejected" && !error48.retryable && !error48.definitivelyNotApplied) {
|
|
35390
35404
|
transition.remote_rejected = true;
|
|
@@ -35395,7 +35409,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35395
35409
|
if (!(error48 instanceof ExternalInferenceMcpError) || !error48.definitivelyNotApplied) throw error48;
|
|
35396
35410
|
transition.advertisement = freshAdvertisement();
|
|
35397
35411
|
await save();
|
|
35398
|
-
result2 = await register(
|
|
35412
|
+
result2 = await register(access6, transition.advertisement);
|
|
35399
35413
|
}
|
|
35400
35414
|
if (result2.host.host_id !== next.host_id || result2.host.host_generation !== next.host_generation || result2.host.key_generation !== next.key_generation || result2.host.advertisement_generation !== transition.advertisement.advertisement_generation) {
|
|
35401
35415
|
throw new Error("Inference host reauthorization returned a different host identity.");
|
|
@@ -35477,7 +35491,7 @@ async function createInferenceAgentMcpSession(options) {
|
|
|
35477
35491
|
options.fetchImpl,
|
|
35478
35492
|
{ signal: options.signal, timeoutMs: options.requestTimeoutMs }
|
|
35479
35493
|
);
|
|
35480
|
-
let
|
|
35494
|
+
let access6 = null;
|
|
35481
35495
|
let accessExpiresAt = 0;
|
|
35482
35496
|
let refreshPromise = null;
|
|
35483
35497
|
const refreshAccessToken = async (requestOptions = {}) => {
|
|
@@ -35494,7 +35508,7 @@ async function createInferenceAgentMcpSession(options) {
|
|
|
35494
35508
|
});
|
|
35495
35509
|
assertCredentialMatchesState(localState, refreshed.credential);
|
|
35496
35510
|
credential = refreshed.credential;
|
|
35497
|
-
|
|
35511
|
+
access6 = refreshed;
|
|
35498
35512
|
accessExpiresAt = Date.now() + refreshed.expiresIn * 1e3;
|
|
35499
35513
|
return refreshed.accessToken;
|
|
35500
35514
|
})();
|
|
@@ -35507,10 +35521,10 @@ async function createInferenceAgentMcpSession(options) {
|
|
|
35507
35521
|
await refreshAccessToken({ signal: options.signal });
|
|
35508
35522
|
const tokenSource = {
|
|
35509
35523
|
accessToken: async (requestOptions) => {
|
|
35510
|
-
if (!
|
|
35524
|
+
if (!access6 || accessExpiresAt - Date.now() <= 5e3) {
|
|
35511
35525
|
return refreshAccessToken(requestOptions);
|
|
35512
35526
|
}
|
|
35513
|
-
return
|
|
35527
|
+
return access6.accessToken;
|
|
35514
35528
|
},
|
|
35515
35529
|
refreshAccessToken
|
|
35516
35530
|
};
|
|
@@ -35598,7 +35612,7 @@ var init_codex_binary = __esm({
|
|
|
35598
35612
|
spec.binaryName
|
|
35599
35613
|
);
|
|
35600
35614
|
};
|
|
35601
|
-
readCodexVersion = async (binaryPath) => await new Promise((
|
|
35615
|
+
readCodexVersion = async (binaryPath) => await new Promise((resolve13, reject) => {
|
|
35602
35616
|
const child = spawn4(binaryPath, ["--version"], {
|
|
35603
35617
|
stdio: ["ignore", "pipe", "pipe"],
|
|
35604
35618
|
windowsHide: true,
|
|
@@ -35636,7 +35650,7 @@ var init_codex_binary = __esm({
|
|
|
35636
35650
|
reject(new Error("Codex version probe failed."));
|
|
35637
35651
|
return;
|
|
35638
35652
|
}
|
|
35639
|
-
|
|
35653
|
+
resolve13(stdout.trim());
|
|
35640
35654
|
});
|
|
35641
35655
|
});
|
|
35642
35656
|
verifyPinnedCodexBinary = async (candidatePath, dependencies = {}) => {
|
|
@@ -36545,7 +36559,7 @@ var init_codex_adapter = __esm({
|
|
|
36545
36559
|
durableSession.session.requireModelCapability(capabilities, modelName, reasoningEffort);
|
|
36546
36560
|
}
|
|
36547
36561
|
async waitForCapabilities(preflight, deadlineAtMs, signal) {
|
|
36548
|
-
return await new Promise((
|
|
36562
|
+
return await new Promise((resolve13, reject) => {
|
|
36549
36563
|
let settled = false;
|
|
36550
36564
|
const finish = (callback) => {
|
|
36551
36565
|
if (settled) return;
|
|
@@ -36572,7 +36586,7 @@ var init_codex_adapter = __esm({
|
|
|
36572
36586
|
return;
|
|
36573
36587
|
}
|
|
36574
36588
|
void preflight.then(
|
|
36575
|
-
(value) => finish(() =>
|
|
36589
|
+
(value) => finish(() => resolve13(value)),
|
|
36576
36590
|
(error48) => finish(() => reject(error48))
|
|
36577
36591
|
);
|
|
36578
36592
|
});
|
|
@@ -38198,9 +38212,9 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
38198
38212
|
response.end();
|
|
38199
38213
|
}
|
|
38200
38214
|
});
|
|
38201
|
-
await new Promise((
|
|
38215
|
+
await new Promise((resolve13, reject) => {
|
|
38202
38216
|
this.server.once("error", reject);
|
|
38203
|
-
this.server.listen(0, "127.0.0.1", () =>
|
|
38217
|
+
this.server.listen(0, "127.0.0.1", () => resolve13());
|
|
38204
38218
|
});
|
|
38205
38219
|
const address = this.server.address();
|
|
38206
38220
|
if (!address || typeof address === "string") throw new Error("deepseek_proxy_bind_failed");
|
|
@@ -38212,7 +38226,7 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
38212
38226
|
this.server = null;
|
|
38213
38227
|
this.urlValue = null;
|
|
38214
38228
|
if (!server) return;
|
|
38215
|
-
await new Promise((
|
|
38229
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
38216
38230
|
}
|
|
38217
38231
|
};
|
|
38218
38232
|
}
|
|
@@ -38750,11 +38764,11 @@ ${JSON.stringify(input.outputSchema)}`,
|
|
|
38750
38764
|
boundary.signal.throwIfAborted();
|
|
38751
38765
|
let checkpointReached = false;
|
|
38752
38766
|
let resolveCheckpoint;
|
|
38753
|
-
const checkpoint = new Promise((
|
|
38754
|
-
resolveCheckpoint =
|
|
38767
|
+
const checkpoint = new Promise((resolve13) => {
|
|
38768
|
+
resolveCheckpoint = resolve13;
|
|
38755
38769
|
});
|
|
38756
|
-
const dispatchGate = new Promise((
|
|
38757
|
-
releaseAgentDispatch =
|
|
38770
|
+
const dispatchGate = new Promise((resolve13) => {
|
|
38771
|
+
releaseAgentDispatch = resolve13;
|
|
38758
38772
|
});
|
|
38759
38773
|
ctx.on("llm/stream", (options, next) => {
|
|
38760
38774
|
if (String(options.sessionId ?? "") !== String(sessionId)) return next();
|
|
@@ -39635,7 +39649,7 @@ var init_grok_binary = __esm({
|
|
|
39635
39649
|
decompress = promisify(brotliDecompress);
|
|
39636
39650
|
pending = /* @__PURE__ */ new Map();
|
|
39637
39651
|
digest = (bytes3) => createHash7("sha256").update(bytes3).digest("hex");
|
|
39638
|
-
verifyVersion = async (path) => new Promise((
|
|
39652
|
+
verifyVersion = async (path) => new Promise((resolve13, reject) => {
|
|
39639
39653
|
const child = spawn6(path, ["--version"], {
|
|
39640
39654
|
stdio: ["ignore", "pipe", "ignore"],
|
|
39641
39655
|
windowsHide: true,
|
|
@@ -39662,7 +39676,7 @@ var init_grok_binary = __esm({
|
|
|
39662
39676
|
clearTimeout(timer);
|
|
39663
39677
|
if (code !== 0 || /^grok\s+(\S+)/u.exec(stdout.trim())?.[1] !== agent_cli_release_default.grok_version) {
|
|
39664
39678
|
reject(new Error("Grok runtime version does not match its release."));
|
|
39665
|
-
} else
|
|
39679
|
+
} else resolve13();
|
|
39666
39680
|
});
|
|
39667
39681
|
});
|
|
39668
39682
|
resolvePinnedGrokBinary = async (stateRoot) => {
|
|
@@ -39882,9 +39896,9 @@ var init_grok_transport_proxy = __esm({
|
|
|
39882
39896
|
this.server = createServer3((request, response) => {
|
|
39883
39897
|
void this.handle(request, response);
|
|
39884
39898
|
});
|
|
39885
|
-
await new Promise((
|
|
39899
|
+
await new Promise((resolve13, reject) => {
|
|
39886
39900
|
this.server.once("error", reject);
|
|
39887
|
-
this.server.listen(0, "127.0.0.1", () =>
|
|
39901
|
+
this.server.listen(0, "127.0.0.1", () => resolve13());
|
|
39888
39902
|
});
|
|
39889
39903
|
const address = this.server.address();
|
|
39890
39904
|
if (!address || typeof address === "string") throw new Error("grok_proxy_bind_failed");
|
|
@@ -40260,7 +40274,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
40260
40274
|
this.urlValue = null;
|
|
40261
40275
|
if (!server) return;
|
|
40262
40276
|
server.closeAllConnections();
|
|
40263
|
-
await new Promise((
|
|
40277
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
40264
40278
|
}
|
|
40265
40279
|
};
|
|
40266
40280
|
createGrokTransportProxy = async (options) => {
|
|
@@ -40441,11 +40455,11 @@ var init_grok_runtime = __esm({
|
|
|
40441
40455
|
this.child.kill();
|
|
40442
40456
|
}
|
|
40443
40457
|
});
|
|
40444
|
-
this.exit = new Promise((
|
|
40458
|
+
this.exit = new Promise((resolve13) => {
|
|
40445
40459
|
this.child.once("error", () => this.fail(new Error("grok_process_start_failed")));
|
|
40446
40460
|
this.child.once("close", () => {
|
|
40447
40461
|
this.fail(new Error("grok_process_closed"));
|
|
40448
|
-
|
|
40462
|
+
resolve13();
|
|
40449
40463
|
});
|
|
40450
40464
|
});
|
|
40451
40465
|
}
|
|
@@ -40465,8 +40479,8 @@ var init_grok_runtime = __esm({
|
|
|
40465
40479
|
let timer;
|
|
40466
40480
|
let abort;
|
|
40467
40481
|
try {
|
|
40468
|
-
return await new Promise((
|
|
40469
|
-
this.pending.set(id2, { resolve:
|
|
40482
|
+
return await new Promise((resolve13, reject) => {
|
|
40483
|
+
this.pending.set(id2, { resolve: resolve13, reject });
|
|
40470
40484
|
timer = setTimeout(() => reject(new Error("grok_deadline_exceeded")), Math.max(1, deadlineAtMs - Date.now()));
|
|
40471
40485
|
abort = () => reject(new Error("grok_cancelled"));
|
|
40472
40486
|
signal?.addEventListener("abort", abort, { once: true });
|
|
@@ -40540,9 +40554,9 @@ var init_grok_runtime = __esm({
|
|
|
40540
40554
|
response.writeHead(400).end();
|
|
40541
40555
|
}
|
|
40542
40556
|
});
|
|
40543
|
-
await new Promise((
|
|
40557
|
+
await new Promise((resolve13, reject) => {
|
|
40544
40558
|
server.once("error", reject);
|
|
40545
|
-
server.listen(0, "127.0.0.1",
|
|
40559
|
+
server.listen(0, "127.0.0.1", resolve13);
|
|
40546
40560
|
});
|
|
40547
40561
|
const address = server.address();
|
|
40548
40562
|
if (!address || typeof address === "string") throw new Error("grok_mcp_listen_failed");
|
|
@@ -40553,7 +40567,7 @@ var init_grok_runtime = __esm({
|
|
|
40553
40567
|
descriptor: { type: "http", name: "vtx", url: `http://127.0.0.1:${address.port}/${token}`, headers: [] },
|
|
40554
40568
|
close: async () => {
|
|
40555
40569
|
server.closeAllConnections();
|
|
40556
|
-
await new Promise((
|
|
40570
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
40557
40571
|
}
|
|
40558
40572
|
};
|
|
40559
40573
|
};
|
|
@@ -41279,7 +41293,7 @@ var init_grok_auth = __esm({
|
|
|
41279
41293
|
await prepareGrokHome(options.grokHome);
|
|
41280
41294
|
const binary = await resolvePinnedGrokBinary(options.stateRoot);
|
|
41281
41295
|
options.signal?.throwIfAborted();
|
|
41282
|
-
await new Promise((
|
|
41296
|
+
await new Promise((resolve13, reject) => {
|
|
41283
41297
|
const child = spawn8(binary.path, ["--no-auto-update", action, ...action === "login" ? ["--device-auth"] : []], {
|
|
41284
41298
|
cwd: options.grokHome,
|
|
41285
41299
|
env: grokRuntimeEnvironment(options.grokHome),
|
|
@@ -41341,7 +41355,7 @@ var init_grok_auth = __esm({
|
|
|
41341
41355
|
child.once("close", (code) => {
|
|
41342
41356
|
cleanup();
|
|
41343
41357
|
if (code !== 0 || failed || options.signal?.aborted) reject(new Error(`Grok ${action} did not complete. Run grok-${action} again.`));
|
|
41344
|
-
else
|
|
41358
|
+
else resolve13();
|
|
41345
41359
|
});
|
|
41346
41360
|
if (options.signal?.aborted) stop();
|
|
41347
41361
|
});
|
|
@@ -42349,6 +42363,74 @@ var init_durable_adapter = __esm({
|
|
|
42349
42363
|
}
|
|
42350
42364
|
});
|
|
42351
42365
|
|
|
42366
|
+
// lib/inference-host/service-launcher-state.ts
|
|
42367
|
+
import { access as access4, readFile as readFile9, rm as rm10 } from "node:fs/promises";
|
|
42368
|
+
import { dirname as dirname12, isAbsolute as isAbsolute5, join as join13, relative as relative3, resolve as resolve10 } from "node:path";
|
|
42369
|
+
var launcherSibling, within, launcherSelection, readLauncherSelection, readLauncherState, writeLauncherState, targetForSelection;
|
|
42370
|
+
var init_service_launcher_state = __esm({
|
|
42371
|
+
"lib/inference-host/service-launcher-state.ts"() {
|
|
42372
|
+
"use strict";
|
|
42373
|
+
init_define_VTX_EXO_POLICY();
|
|
42374
|
+
init_define_VTX_GROK_POLICY();
|
|
42375
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
42376
|
+
init_config();
|
|
42377
|
+
launcherSibling = (manifest, suffix) => {
|
|
42378
|
+
if (!manifest.endsWith(".service.json")) throw new Error("Invalid service manifest path.");
|
|
42379
|
+
return `${manifest.slice(0, -".service.json".length)}${suffix}`;
|
|
42380
|
+
};
|
|
42381
|
+
within = (parent, child) => {
|
|
42382
|
+
const part = relative3(resolve10(parent), resolve10(child));
|
|
42383
|
+
return Boolean(part) && !part.startsWith("..") && !isAbsolute5(part);
|
|
42384
|
+
};
|
|
42385
|
+
launcherSelection = (manifest, value) => {
|
|
42386
|
+
if (!value || typeof value !== "object") return null;
|
|
42387
|
+
const r = value;
|
|
42388
|
+
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" || !isAbsolute5(r.script) || /[\r\n\0]/u.test(r.script) || !within(launcherSibling(manifest, ".service-releases"), r.script)) return null;
|
|
42389
|
+
return r;
|
|
42390
|
+
};
|
|
42391
|
+
readLauncherSelection = async (manifest) => {
|
|
42392
|
+
try {
|
|
42393
|
+
return launcherSelection(manifest, JSON.parse(await readFile9(launcherSibling(manifest, ".service-release.json"), "utf8")));
|
|
42394
|
+
} catch (error48) {
|
|
42395
|
+
if (error48.code === "ENOENT") return null;
|
|
42396
|
+
throw error48;
|
|
42397
|
+
}
|
|
42398
|
+
};
|
|
42399
|
+
readLauncherState = async (manifest) => {
|
|
42400
|
+
let value;
|
|
42401
|
+
try {
|
|
42402
|
+
value = JSON.parse(await readFile9(launcherSibling(manifest, ".service-launcher.json"), "utf8"));
|
|
42403
|
+
} catch (error48) {
|
|
42404
|
+
if (error48.code === "ENOENT") return null;
|
|
42405
|
+
throw error48;
|
|
42406
|
+
}
|
|
42407
|
+
if (!value || typeof value !== "object") throw new Error("Invalid service launcher state.");
|
|
42408
|
+
const r = value;
|
|
42409
|
+
const target = (v) => {
|
|
42410
|
+
if (!v || typeof v !== "object") return false;
|
|
42411
|
+
const t = v;
|
|
42412
|
+
return typeof t.package_version === "string" && /^\d{4}\.\d{1,2}\.\d{1,3}$/u.test(t.package_version) && typeof t.script === "string" && isAbsolute5(t.script) && !/[\r\n\0]/u.test(t.script) && (within(launcherSibling(manifest, ".service-releases"), t.script) || resolve10(t.script) === resolve10(launcherSibling(manifest, ".service-bootstrap.previous.js"))) && (t.selection === null || (() => {
|
|
42413
|
+
const selected = launcherSelection(manifest, t.selection);
|
|
42414
|
+
return Boolean(selected && selected.package_version === t.package_version && (resolve10(t.script) === resolve10(join13(dirname12(selected.script), "vtx-service-bootstrap.js")) || resolve10(t.script) === resolve10(launcherSibling(manifest, ".service-bootstrap.previous.js"))));
|
|
42415
|
+
})());
|
|
42416
|
+
};
|
|
42417
|
+
if (r.schema_version !== "vtx_inference_service_launcher_v1" || !target(r.active) || r.previous !== null && !target(r.previous) || typeof r.pending !== "boolean") {
|
|
42418
|
+
throw new Error("Invalid service launcher recovery targets.");
|
|
42419
|
+
}
|
|
42420
|
+
return r;
|
|
42421
|
+
};
|
|
42422
|
+
writeLauncherState = async (manifest, state) => {
|
|
42423
|
+
await writeAtomicInferencePrivateFile(launcherSibling(manifest, ".service-launcher.json"), `${JSON.stringify(state)}
|
|
42424
|
+
`);
|
|
42425
|
+
};
|
|
42426
|
+
targetForSelection = async (selection) => {
|
|
42427
|
+
const script = join13(dirname12(selection.script), "vtx-service-bootstrap.js");
|
|
42428
|
+
await access4(script);
|
|
42429
|
+
return { package_version: selection.package_version, script, selection };
|
|
42430
|
+
};
|
|
42431
|
+
}
|
|
42432
|
+
});
|
|
42433
|
+
|
|
42352
42434
|
// lib/runtime-policy.generated.json with { type: 'json' }
|
|
42353
42435
|
var runtime_policy_generated_default2;
|
|
42354
42436
|
var init_runtime_policy_generated2 = __esm({
|
|
@@ -42444,6 +42526,8 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
42444
42526
|
service: {
|
|
42445
42527
|
update_check_interval_ms: 3e5,
|
|
42446
42528
|
update_registry_timeout_ms: 15e3,
|
|
42529
|
+
bootstrap_readiness_timeout_ms: 6e5,
|
|
42530
|
+
bootstrap_stop_timeout_ms: 1e4,
|
|
42447
42531
|
startup_max_attempts: 40,
|
|
42448
42532
|
startup_poll_interval_ms: 250,
|
|
42449
42533
|
restart_stable_uptime_ms: 6e4,
|
|
@@ -42532,16 +42616,17 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
42532
42616
|
import { spawn as spawn10 } from "node:child_process";
|
|
42533
42617
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
42534
42618
|
import { createWriteStream, readFileSync as readFileSync2 } from "node:fs";
|
|
42535
|
-
import { access as
|
|
42619
|
+
import { access as access5, chmod as chmod3, mkdir as mkdir3, readFile as readFile10, rm as rm11, writeFile as writeFile4 } from "node:fs/promises";
|
|
42536
42620
|
import { homedir as homedir2 } from "node:os";
|
|
42537
|
-
import { dirname as
|
|
42538
|
-
var SERVICE_NAME, SYSTEMD_UNIT, LAUNCHD_LABEL, SERVICE_COOPERATIVE_STOP_SECONDS, SERVICE_UPDATE_STARTUP_SECONDS, INFERENCE_HOST_SERVICE_DRAIN_COMMAND, INFERENCE_HOST_SERVICE_QUIESCE_COMMAND, InferenceHostBootstrapRestartRequiredError, inferenceHostServiceChildEnvironment, isWindowsSubsystemForLinux, inferenceHostServiceManifestPath, inferenceHostServiceDesiredPath, inferenceHostServiceLogPath, inferenceHostServiceRuntimePath, xmlEscape, plistEscape, systemdQuote, defaultRunCommand, managerName, assertRuntimeEnvironment, withoutConcurrencyLimit, assertServicePath, manifestGeneration, assertWorker, assertManifest, assertServiceRuntimeState, assertDesiredState, readInferenceHostServiceManifest, readManifestAcrossAtomicReplacement, readInferenceHostServiceRuntime, readRuntimeAcrossAtomicReplacement, readInferenceHostServiceDesired, readDesiredAcrossAtomicReplacement, writeDesired, runtimeEnvironment, serviceBootstrapArguments, windowsOwnedCommandLine, vbScriptString, windowsServiceLauncher, windowsTaskXml, systemdUnit, launchAgentPlist, sameWorker, sameServiceDefinition, sameWorkerSet, InferenceHostServiceManager, appendServiceLog, spawnInferenceHostServiceChild, runInferenceHostServiceSupervisor;
|
|
42621
|
+
import { dirname as dirname13, join as join14, resolve as resolve11 } from "node:path";
|
|
42622
|
+
var SERVICE_NAME, SYSTEMD_UNIT, LAUNCHD_LABEL, SERVICE_COOPERATIVE_STOP_SECONDS, SERVICE_UPDATE_STARTUP_SECONDS, INFERENCE_HOST_SERVICE_DRAIN_COMMAND, INFERENCE_HOST_SERVICE_QUIESCE_COMMAND, InferenceHostBootstrapRestartRequiredError, inferenceHostServiceChildEnvironment, isWindowsSubsystemForLinux, inferenceHostServiceManifestPath, inferenceHostServiceDesiredPath, inferenceHostServiceLogPath, inferenceHostServiceRuntimePath, xmlEscape, plistEscape, systemdQuote, defaultRunCommand, probeInferenceHostLauncher, managerName, assertRuntimeEnvironment, withoutConcurrencyLimit, assertServicePath, manifestGeneration, assertWorker, assertManifest, assertServiceRuntimeState, assertDesiredState, readInferenceHostServiceManifest, readManifestAcrossAtomicReplacement, readInferenceHostServiceRuntime, readRuntimeAcrossAtomicReplacement, readInferenceHostServiceDesired, readDesiredAcrossAtomicReplacement, writeDesired, runtimeEnvironment, serviceBootstrapArguments, windowsOwnedCommandLine, vbScriptString, windowsServiceLauncher, windowsTaskXml, systemdUnit, launchAgentPlist, sameWorker, sameServiceDefinition, sameWorkerSet, InferenceHostServiceManager, appendServiceLog, spawnInferenceHostServiceChild, runInferenceHostServiceSupervisor;
|
|
42539
42623
|
var init_service = __esm({
|
|
42540
42624
|
"lib/inference-host/service.ts"() {
|
|
42541
42625
|
"use strict";
|
|
42542
42626
|
init_define_VTX_EXO_POLICY();
|
|
42543
42627
|
init_define_VTX_GROK_POLICY();
|
|
42544
42628
|
init_define_VTX_PI_MODEL_POLICY();
|
|
42629
|
+
init_service_launcher_state();
|
|
42545
42630
|
init_agent_cli_release();
|
|
42546
42631
|
init_runtime_policy_generated2();
|
|
42547
42632
|
init_durable_adapter();
|
|
@@ -42607,6 +42692,18 @@ var init_service = __esm({
|
|
|
42607
42692
|
stderr: Buffer.concat(stderr).toString("utf8")
|
|
42608
42693
|
}));
|
|
42609
42694
|
});
|
|
42695
|
+
probeInferenceHostLauncher = async (executable, destination, bytes3, runCommand = defaultRunCommand) => {
|
|
42696
|
+
const probe = `${destination}.${randomUUID9()}.probe.js`;
|
|
42697
|
+
try {
|
|
42698
|
+
await writeAtomicInferencePrivateFile(probe, bytes3);
|
|
42699
|
+
const result2 = await runCommand(executable, [probe]);
|
|
42700
|
+
if (result2.exitCode !== 1 || result2.stdout.trim() || result2.stderr.trim() !== "Internal service manifest and lock paths are required.") {
|
|
42701
|
+
throw new Error("Copied service launcher failed its isolated startup check.");
|
|
42702
|
+
}
|
|
42703
|
+
} finally {
|
|
42704
|
+
await rm11(probe, { force: true });
|
|
42705
|
+
}
|
|
42706
|
+
};
|
|
42610
42707
|
managerName = (platform) => {
|
|
42611
42708
|
if (platform === "win32") return "windows-task-scheduler";
|
|
42612
42709
|
if (platform === "darwin") return "launch-agent";
|
|
@@ -42947,10 +43044,10 @@ WantedBy=default.target
|
|
|
42947
43044
|
this.config = config2;
|
|
42948
43045
|
this.platform = dependencies.platform ?? process.platform;
|
|
42949
43046
|
this.home = dependencies.homedir ?? homedir2();
|
|
42950
|
-
this.executable =
|
|
42951
|
-
this.script =
|
|
42952
|
-
this.bootstrapScript =
|
|
42953
|
-
dependencies.bootstrapScript ??
|
|
43047
|
+
this.executable = resolve11(dependencies.executable ?? process.execPath);
|
|
43048
|
+
this.script = resolve11(dependencies.script ?? process.argv[1] ?? "");
|
|
43049
|
+
this.bootstrapScript = resolve11(
|
|
43050
|
+
dependencies.bootstrapScript ?? join14(dirname13(this.script), "vtx-service-launcher.js")
|
|
42954
43051
|
);
|
|
42955
43052
|
this.username = dependencies.username ?? ([process.env.USERDOMAIN, process.env.USERNAME].filter(Boolean).join("\\") || process.env.USER || "");
|
|
42956
43053
|
this.windowsDirectory = (dependencies.windowsDirectory ?? process.env.SystemRoot ?? process.env.WINDIR ?? "C:\\Windows").replace(/[\\/]+$/u, "");
|
|
@@ -43036,16 +43133,16 @@ WantedBy=default.target
|
|
|
43036
43133
|
}
|
|
43037
43134
|
definitionPath() {
|
|
43038
43135
|
if (this.platform === "win32") return `${this.config.supervisorStatePath}.service-task.xml`;
|
|
43039
|
-
if (this.platform === "darwin") return
|
|
43040
|
-
return
|
|
43136
|
+
if (this.platform === "darwin") return join14(this.home, "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
|
|
43137
|
+
return join14(this.home, ".config", "systemd", "user", SYSTEMD_UNIT);
|
|
43041
43138
|
}
|
|
43042
43139
|
windowsLauncherPath() {
|
|
43043
43140
|
return `${this.config.supervisorStatePath}.service-launcher.vbs`;
|
|
43044
43141
|
}
|
|
43045
43142
|
async hasBootstrapDefinition() {
|
|
43046
43143
|
try {
|
|
43047
|
-
await
|
|
43048
|
-
const definition = await
|
|
43144
|
+
await access5(this.serviceBootstrapPath());
|
|
43145
|
+
const definition = await readFile10(
|
|
43049
43146
|
this.platform === "win32" ? this.windowsLauncherPath() : this.definitionPath(),
|
|
43050
43147
|
"utf8"
|
|
43051
43148
|
);
|
|
@@ -43175,24 +43272,36 @@ ${result2.stderr}`)) {
|
|
|
43175
43272
|
);
|
|
43176
43273
|
}
|
|
43177
43274
|
async registerManifestUnlocked(manifest, desiredRunning, targetInstanceName) {
|
|
43178
|
-
await
|
|
43275
|
+
await access5(this.bootstrapScript);
|
|
43179
43276
|
const args = serviceBootstrapArguments(
|
|
43180
43277
|
this.serviceBootstrapPath(),
|
|
43181
43278
|
this.manifestPath(),
|
|
43182
43279
|
this.serviceBootstrapLockPath()
|
|
43183
43280
|
);
|
|
43184
43281
|
const definition = this.platform === "win32" ? windowsTaskXml(this.windowsLauncherPath(), this.windowsDirectory, this.username) : this.platform === "darwin" ? launchAgentPlist(manifest.executable, args, manifest.log_path) : systemdUnit(manifest.executable, args);
|
|
43282
|
+
const existingRecovery = await readLauncherState(this.manifestPath());
|
|
43185
43283
|
let managerInstallAttempted = false;
|
|
43186
43284
|
try {
|
|
43187
43285
|
await writeAtomicInferencePrivateFile(this.manifestPath(), `${JSON.stringify(manifest, null, 2)}
|
|
43188
43286
|
`);
|
|
43189
43287
|
await writeDesired(this.desiredPath(), desiredRunning, this.now());
|
|
43190
|
-
await
|
|
43191
|
-
|
|
43192
|
-
await
|
|
43193
|
-
|
|
43288
|
+
const launcherBytes = await readFile10(this.bootstrapScript, "utf8");
|
|
43289
|
+
if (this.bootstrapScript.endsWith("vtx-service-launcher.js") && !existingRecovery) {
|
|
43290
|
+
await probeInferenceHostLauncher(manifest.executable, this.serviceBootstrapPath(), launcherBytes, this.runCommand);
|
|
43291
|
+
const core = launcherSibling(this.manifestPath(), ".service-bootstrap.previous.js");
|
|
43292
|
+
const coreBytes = await readFile10(join14(dirname13(this.bootstrapScript), "vtx-service-bootstrap.js"), "utf8");
|
|
43293
|
+
await probeInferenceHostLauncher(manifest.executable, core, coreBytes, this.runCommand);
|
|
43294
|
+
await writeAtomicInferencePrivateFile(core, coreBytes);
|
|
43295
|
+
await writeLauncherState(this.manifestPath(), {
|
|
43296
|
+
schema_version: "vtx_inference_service_launcher_v1",
|
|
43297
|
+
active: { package_version: agent_cli_release_default.package_version, script: core, selection: null },
|
|
43298
|
+
previous: null,
|
|
43299
|
+
pending: false
|
|
43300
|
+
});
|
|
43301
|
+
}
|
|
43302
|
+
if (!existingRecovery) await writeAtomicInferencePrivateFile(this.serviceBootstrapPath(), launcherBytes);
|
|
43194
43303
|
await chmod3(this.serviceBootstrapPath(), 448);
|
|
43195
|
-
await mkdir3(
|
|
43304
|
+
await mkdir3(dirname13(this.definitionPath()), { recursive: true, mode: 448 });
|
|
43196
43305
|
if (this.platform === "win32") {
|
|
43197
43306
|
await writeAtomicInferencePrivateFile(
|
|
43198
43307
|
this.windowsLauncherPath(),
|
|
@@ -43245,14 +43354,17 @@ ${cleanup.stderr}`)) {
|
|
|
43245
43354
|
);
|
|
43246
43355
|
}
|
|
43247
43356
|
}
|
|
43248
|
-
await
|
|
43357
|
+
await rm11(this.definitionPath(), { force: true }).catch(() => void 0);
|
|
43249
43358
|
if (this.platform === "win32") {
|
|
43250
|
-
await
|
|
43359
|
+
await rm11(this.windowsLauncherPath(), { force: true }).catch(() => void 0);
|
|
43360
|
+
}
|
|
43361
|
+
await rm11(this.manifestPath(), { force: true }).catch(() => void 0);
|
|
43362
|
+
await rm11(this.desiredPath(), { force: true }).catch(() => void 0);
|
|
43363
|
+
await rm11(this.runtimePath(), { force: true }).catch(() => void 0);
|
|
43364
|
+
if (!existingRecovery) await rm11(this.serviceBootstrapPath(), { force: true }).catch(() => void 0);
|
|
43365
|
+
for (const suffix of [".service-launcher.json", ".service-bootstrap.previous.js"]) {
|
|
43366
|
+
if (!existingRecovery) await rm11(launcherSibling(this.manifestPath(), suffix), { force: true }).catch(() => void 0);
|
|
43251
43367
|
}
|
|
43252
|
-
await rm10(this.manifestPath(), { force: true }).catch(() => void 0);
|
|
43253
|
-
await rm10(this.desiredPath(), { force: true }).catch(() => void 0);
|
|
43254
|
-
await rm10(this.runtimePath(), { force: true }).catch(() => void 0);
|
|
43255
|
-
await rm10(this.serviceBootstrapPath(), { force: true }).catch(() => void 0);
|
|
43256
43368
|
if (this.platform === "linux") {
|
|
43257
43369
|
await this.runCommand("systemctl", ["--user", "daemon-reload"]).catch(() => void 0);
|
|
43258
43370
|
}
|
|
@@ -43312,7 +43424,7 @@ ${cleanup.stderr}`)) {
|
|
|
43312
43424
|
}
|
|
43313
43425
|
if (previous) {
|
|
43314
43426
|
try {
|
|
43315
|
-
await this.uninstallUnlocked();
|
|
43427
|
+
await this.uninstallUnlocked(true);
|
|
43316
43428
|
} catch (error48) {
|
|
43317
43429
|
throw new Error(
|
|
43318
43430
|
"Inference-host service reconfiguration could not stop the previous supervisor; its desired state was restored.",
|
|
@@ -43378,15 +43490,15 @@ ${cleanup.stderr}`)) {
|
|
|
43378
43490
|
}
|
|
43379
43491
|
if (this.config.credentialFilePath && otherWorkers.some((worker) => {
|
|
43380
43492
|
const otherPath = worker.runtime_environment.VTX_INFERENCE_HOST_CREDENTIAL_FILE;
|
|
43381
|
-
return otherPath &&
|
|
43493
|
+
return otherPath && resolve11(otherPath) === resolve11(this.config.credentialFilePath);
|
|
43382
43494
|
})) {
|
|
43383
43495
|
throw new Error(
|
|
43384
43496
|
"Each inference-host instance must use a different private credential file."
|
|
43385
43497
|
);
|
|
43386
43498
|
}
|
|
43387
|
-
await
|
|
43388
|
-
await
|
|
43389
|
-
await
|
|
43499
|
+
await access5(this.executable);
|
|
43500
|
+
await access5(this.script);
|
|
43501
|
+
await access5(this.bootstrapScript);
|
|
43390
43502
|
const maxConcurrency = options.maxConcurrency ?? null;
|
|
43391
43503
|
const workers = [
|
|
43392
43504
|
...existing?.workers.filter((worker) => worker.instance_name !== this.config.instanceName) ?? [],
|
|
@@ -43596,7 +43708,7 @@ ${result2.stderr}`)) {
|
|
|
43596
43708
|
const manifest = await readInferenceHostServiceManifest(this.manifestPath());
|
|
43597
43709
|
const path = manifest?.log_path ?? this.logPath();
|
|
43598
43710
|
try {
|
|
43599
|
-
const contents = await
|
|
43711
|
+
const contents = await readFile10(path, "utf8");
|
|
43600
43712
|
const logLines = contents.trimEnd().split(/\r?\n/u);
|
|
43601
43713
|
const filtered = instanceName ? logLines.filter((line) => {
|
|
43602
43714
|
try {
|
|
@@ -43635,7 +43747,7 @@ ${result2.stderr}`)) {
|
|
|
43635
43747
|
async uninstall() {
|
|
43636
43748
|
return await this.withControlLock(async () => await this.uninstallUnlocked());
|
|
43637
43749
|
}
|
|
43638
|
-
async uninstallUnlocked() {
|
|
43750
|
+
async uninstallUnlocked(preserveRecovery = false) {
|
|
43639
43751
|
const manifest = await readInferenceHostServiceManifest(this.manifestPath());
|
|
43640
43752
|
if (!manifest) throw new Error("Inference-host service is not installed.");
|
|
43641
43753
|
const current = await this.status();
|
|
@@ -43649,16 +43761,21 @@ ${result2.stderr}`)) {
|
|
|
43649
43761
|
${result2.stderr}`)) {
|
|
43650
43762
|
throw new Error(`Background service uninstall failed: ${result2.stderr.trim()}`);
|
|
43651
43763
|
}
|
|
43652
|
-
await
|
|
43653
|
-
if (this.platform === "win32") await
|
|
43764
|
+
await rm11(this.definitionPath(), { force: true });
|
|
43765
|
+
if (this.platform === "win32") await rm11(this.windowsLauncherPath(), { force: true });
|
|
43654
43766
|
if (this.platform === "linux") await this.runCommand("systemctl", ["--user", "daemon-reload"]);
|
|
43655
|
-
await
|
|
43656
|
-
await
|
|
43657
|
-
await
|
|
43658
|
-
|
|
43659
|
-
|
|
43660
|
-
|
|
43661
|
-
|
|
43767
|
+
await rm11(this.manifestPath(), { force: true });
|
|
43768
|
+
await rm11(this.desiredPath(), { force: true });
|
|
43769
|
+
await rm11(this.runtimePath(), { force: true });
|
|
43770
|
+
if (!preserveRecovery) {
|
|
43771
|
+
await rm11(this.serviceBootstrapPath(), { force: true });
|
|
43772
|
+
for (const suffix of [".service-launcher.json", ".service-bootstrap.previous.js"]) {
|
|
43773
|
+
await rm11(launcherSibling(this.manifestPath(), suffix), { force: true });
|
|
43774
|
+
}
|
|
43775
|
+
await rm11(this.serviceReleasePath(), { force: true });
|
|
43776
|
+
await rm11(this.serviceReleaseRejectionPath(), { force: true });
|
|
43777
|
+
await rm11(this.serviceReleasesPath(), { recursive: true, force: true });
|
|
43778
|
+
}
|
|
43662
43779
|
return {
|
|
43663
43780
|
installed: false,
|
|
43664
43781
|
desired_running: false,
|
|
@@ -43672,7 +43789,7 @@ ${result2.stderr}`)) {
|
|
|
43672
43789
|
}
|
|
43673
43790
|
};
|
|
43674
43791
|
appendServiceLog = async (path, event, fields = {}) => {
|
|
43675
|
-
await mkdir3(
|
|
43792
|
+
await mkdir3(dirname13(path), { recursive: true, mode: 448 });
|
|
43676
43793
|
const stream = createWriteStream(path, { flags: "a", mode: 384 });
|
|
43677
43794
|
await new Promise((resolvePromise, reject) => {
|
|
43678
43795
|
stream.once("error", reject);
|
|
@@ -43801,7 +43918,7 @@ ${result2.stderr}`)) {
|
|
|
43801
43918
|
runInferenceHostServiceSupervisor = async (manifestPath, options = {}) => {
|
|
43802
43919
|
const storedInitialManifest = await readInferenceHostServiceManifest(manifestPath);
|
|
43803
43920
|
if (!storedInitialManifest) throw new Error("Inference-host service manifest is missing.");
|
|
43804
|
-
const serviceScript = options.serviceScript ?
|
|
43921
|
+
const serviceScript = options.serviceScript ? resolve11(options.serviceScript) : null;
|
|
43805
43922
|
const withServiceScript = (manifest) => serviceScript ? { ...manifest, script: serviceScript } : manifest;
|
|
43806
43923
|
const initialManifest = withServiceScript(storedInitialManifest);
|
|
43807
43924
|
const desiredPath = manifestPath.replace(/\.service\.json$/u, ".service-desired.json");
|
|
@@ -43811,6 +43928,21 @@ ${result2.stderr}`)) {
|
|
|
43811
43928
|
const quiesceSignal = options.quiesceSignal ? AbortSignal.any([options.quiesceSignal, migrationQuiesce.signal]) : migrationQuiesce.signal;
|
|
43812
43929
|
let bootstrapRestartRequired = false;
|
|
43813
43930
|
let bootstrapMigrationErrorReported = false;
|
|
43931
|
+
const priorSelection = await readLauncherSelection(manifestPath);
|
|
43932
|
+
const parentBootstrapVersion = options.bootstrapVersion ?? process.env.VTX_INFERENCE_HOST_BOOTSTRAP_VERSION;
|
|
43933
|
+
if (serviceScript && options.controlLockPath && parentBootstrapVersion && parentBootstrapVersion !== agent_cli_release_default.package_version && process.env.VTX_INFERENCE_HOST_LAUNCHER_PROTOCOL !== "1" && !await readLauncherState(manifestPath) && priorSelection?.package_version === parentBootstrapVersion) {
|
|
43934
|
+
const previousCore = launcherSibling(manifestPath, ".service-bootstrap.previous.js");
|
|
43935
|
+
await writeAtomicInferencePrivateFile(
|
|
43936
|
+
previousCore,
|
|
43937
|
+
await readFile10(launcherSibling(manifestPath, ".service-bootstrap.js"), "utf8")
|
|
43938
|
+
);
|
|
43939
|
+
await writeLauncherState(manifestPath, {
|
|
43940
|
+
schema_version: "vtx_inference_service_launcher_v1",
|
|
43941
|
+
active: { package_version: parentBootstrapVersion, script: previousCore, selection: priorSelection },
|
|
43942
|
+
previous: null,
|
|
43943
|
+
pending: false
|
|
43944
|
+
});
|
|
43945
|
+
}
|
|
43814
43946
|
const migrateSelectedBootstrap = async () => {
|
|
43815
43947
|
if (!serviceScript || !options.controlLockPath || bootstrapRestartRequired || (options.bootstrapVersion ?? process.env.VTX_INFERENCE_HOST_BOOTSTRAP_VERSION) === agent_cli_release_default.package_version || quiesceSignal.aborted || signal.aborted) return;
|
|
43816
43948
|
let controlLock;
|
|
@@ -43823,16 +43955,25 @@ ${result2.stderr}`)) {
|
|
|
43823
43955
|
try {
|
|
43824
43956
|
const current = await readManifestAcrossAtomicReplacement(manifestPath);
|
|
43825
43957
|
if (!current || current.generation !== appliedManifest.generation || !await readDesiredAcrossAtomicReplacement(desiredPath) || signal.aborted) return;
|
|
43826
|
-
|
|
43827
|
-
|
|
43828
|
-
|
|
43829
|
-
|
|
43830
|
-
|
|
43831
|
-
|
|
43958
|
+
const selected = await readLauncherSelection(manifestPath);
|
|
43959
|
+
if (!selected || selected.package_version !== agent_cli_release_default.package_version || resolve11(selected.script) !== serviceScript) return;
|
|
43960
|
+
if (process.env.VTX_INFERENCE_HOST_LAUNCHER_PROTOCOL !== "1") {
|
|
43961
|
+
const launcherPath = launcherSibling(manifestPath, ".service-bootstrap.js");
|
|
43962
|
+
const bytes3 = await readFile10(join14(dirname13(serviceScript), "vtx-service-launcher.js"), "utf8");
|
|
43963
|
+
await (options.probeLauncher ?? probeInferenceHostLauncher)(current.executable, launcherPath, bytes3);
|
|
43964
|
+
const existing = await readLauncherState(manifestPath);
|
|
43965
|
+
if (!existing) throw new Error("Previous private service release is unavailable; refusing unsafe launcher migration.");
|
|
43966
|
+
const previous = existing.active.package_version === selected.package_version ? existing.previous : existing.active;
|
|
43967
|
+
if (!previous) throw new Error("Previous service launcher recovery target is unavailable.");
|
|
43968
|
+
await writeLauncherState(manifestPath, {
|
|
43969
|
+
schema_version: "vtx_inference_service_launcher_v1",
|
|
43970
|
+
active: await targetForSelection(selected),
|
|
43971
|
+
previous,
|
|
43972
|
+
pending: false
|
|
43973
|
+
});
|
|
43974
|
+
if (!await readDesiredAcrossAtomicReplacement(desiredPath) || signal.aborted) return;
|
|
43975
|
+
await writeAtomicInferencePrivateFile(launcherPath, bytes3);
|
|
43832
43976
|
}
|
|
43833
|
-
if (selected.schema_version !== "vtx_inference_service_release_v1" || selected.package_name !== "@vtxmacro/cli" || selected.package_version !== agent_cli_release_default.package_version || typeof selected.script !== "string" || resolve10(selected.script) !== serviceScript) return;
|
|
43834
|
-
const bytes3 = await readFile9(join13(dirname12(serviceScript), "vtx-service-bootstrap.js"), "utf8");
|
|
43835
|
-
await writeAtomicInferencePrivateFile(manifestPath.replace(/\.service\.json$/u, ".service-bootstrap.js"), bytes3);
|
|
43836
43977
|
bootstrapRestartRequired = true;
|
|
43837
43978
|
migrationQuiesce.abort();
|
|
43838
43979
|
} finally {
|
|
@@ -44098,9 +44239,9 @@ __export(cli_exports, {
|
|
|
44098
44239
|
});
|
|
44099
44240
|
import { createHash as createHash12, randomUUID as randomUUID10 } from "node:crypto";
|
|
44100
44241
|
import { spawn as spawn11 } from "node:child_process";
|
|
44101
|
-
import { lstat as lstat9, realpath as realpath8, rm as
|
|
44242
|
+
import { lstat as lstat9, realpath as realpath8, rm as rm12 } from "node:fs/promises";
|
|
44102
44243
|
import { hostname as osHostname } from "node:os";
|
|
44103
|
-
import { join as
|
|
44244
|
+
import { join as join15, resolve as resolve12 } from "node:path";
|
|
44104
44245
|
async function runInferenceHostCli(argv2, env = process.env, dependencies = {}) {
|
|
44105
44246
|
const warnings = [];
|
|
44106
44247
|
try {
|
|
@@ -44488,7 +44629,7 @@ Durable service:
|
|
|
44488
44629
|
if (!raw?.trim()) throw new Error(`${argument} requires a value.`);
|
|
44489
44630
|
if (argument === "--adapter") adapter = raw.trim();
|
|
44490
44631
|
if (argument === "--provider") providerId = raw.trim();
|
|
44491
|
-
if (argument === "--exo-root") exoRoot =
|
|
44632
|
+
if (argument === "--exo-root") exoRoot = resolve12(raw.trim());
|
|
44492
44633
|
if (argument === "--model") modelId = raw.trim();
|
|
44493
44634
|
if (argument === "--model-label") modelLabel = raw.trim();
|
|
44494
44635
|
if (argument === "--effort") reasoningEffort = raw.trim();
|
|
@@ -44504,7 +44645,7 @@ Durable service:
|
|
|
44504
44645
|
throw new Error("--lines must be an integer from 1 through 10000.");
|
|
44505
44646
|
}
|
|
44506
44647
|
}
|
|
44507
|
-
if (argument === "--service-manifest") serviceManifestPath =
|
|
44648
|
+
if (argument === "--service-manifest") serviceManifestPath = resolve12(raw.trim());
|
|
44508
44649
|
if (argument === "--instance") {
|
|
44509
44650
|
instanceName = raw.trim();
|
|
44510
44651
|
instanceExplicit = true;
|
|
@@ -44597,10 +44738,24 @@ Durable service:
|
|
|
44597
44738
|
quiesce?.();
|
|
44598
44739
|
}
|
|
44599
44740
|
};
|
|
44741
|
+
let parentLost = false;
|
|
44742
|
+
const onParentLost = () => {
|
|
44743
|
+
if (parentLost) return;
|
|
44744
|
+
parentLost = true;
|
|
44745
|
+
if (quiesce) quiesce();
|
|
44746
|
+
else abort();
|
|
44747
|
+
};
|
|
44600
44748
|
input.on("data", onControlInput);
|
|
44749
|
+
input.on("end", onParentLost);
|
|
44750
|
+
input.on("close", onParentLost);
|
|
44751
|
+
input.on("error", onParentLost);
|
|
44601
44752
|
input.resume();
|
|
44753
|
+
if (input.readableEnded || input.destroyed) onParentLost();
|
|
44602
44754
|
return () => {
|
|
44603
44755
|
input.off("data", onControlInput);
|
|
44756
|
+
input.off("end", onParentLost);
|
|
44757
|
+
input.off("close", onParentLost);
|
|
44758
|
+
input.off("error", onParentLost);
|
|
44604
44759
|
input.pause();
|
|
44605
44760
|
};
|
|
44606
44761
|
};
|
|
@@ -44702,11 +44857,11 @@ Durable service:
|
|
|
44702
44857
|
return raw !== null;
|
|
44703
44858
|
};
|
|
44704
44859
|
inspectCodexAuthentication = async (config2) => {
|
|
44705
|
-
const path =
|
|
44860
|
+
const path = join15(config2.codexHomePath, "auth.json");
|
|
44706
44861
|
try {
|
|
44707
44862
|
const before = await lstat9(path);
|
|
44708
44863
|
const canonical = await realpath8(path);
|
|
44709
|
-
const isPrivate = before.isFile() && !before.isSymbolicLink() && canonical ===
|
|
44864
|
+
const isPrivate = before.isFile() && !before.isSymbolicLink() && canonical === resolve12(path) && before.size <= 8 * 1024 * 1024 && (process.platform === "win32" || (before.mode & 63) === 0 && (typeof process.getuid !== "function" || before.uid === process.getuid()));
|
|
44710
44865
|
return { present: true, private: isPrivate };
|
|
44711
44866
|
} catch (error48) {
|
|
44712
44867
|
if (error48.code === "ENOENT") {
|
|
@@ -44723,7 +44878,7 @@ Durable service:
|
|
|
44723
44878
|
runtimeReceiptPath(config2),
|
|
44724
44879
|
"Inference host runtime receipt file"
|
|
44725
44880
|
);
|
|
44726
|
-
await
|
|
44881
|
+
await rm12(codexGuardianReceiptRoot(config2), { recursive: true, force: true });
|
|
44727
44882
|
await clearInferencePrivateFile(
|
|
44728
44883
|
codexRecoveryPath(config2),
|
|
44729
44884
|
"Codex attempt recovery file"
|
|
@@ -45031,20 +45186,20 @@ Waiting for approval...
|
|
|
45031
45186
|
} catch {
|
|
45032
45187
|
}
|
|
45033
45188
|
}
|
|
45034
|
-
let
|
|
45189
|
+
let access6;
|
|
45035
45190
|
try {
|
|
45036
|
-
|
|
45191
|
+
access6 = await pending3.completion;
|
|
45037
45192
|
} catch (error48) {
|
|
45038
45193
|
await pending3.cancel().catch(() => void 0);
|
|
45039
45194
|
throw error48;
|
|
45040
45195
|
}
|
|
45041
45196
|
const state = {
|
|
45042
45197
|
schema_version: 1,
|
|
45043
|
-
issuer:
|
|
45044
|
-
client_id:
|
|
45045
|
-
host_id:
|
|
45198
|
+
issuer: access6.credential.issuer,
|
|
45199
|
+
client_id: access6.credential.client_id,
|
|
45200
|
+
host_id: access6.credential.host_id,
|
|
45046
45201
|
host_generation: 1,
|
|
45047
|
-
key_generation:
|
|
45202
|
+
key_generation: access6.credential.key_generation
|
|
45048
45203
|
};
|
|
45049
45204
|
try {
|
|
45050
45205
|
await writeInferenceHostLocalState(config2.statePath, state);
|
|
@@ -45054,7 +45209,7 @@ Waiting for approval...
|
|
|
45054
45209
|
const metadata = await (dependencies.discoverOAuth ?? discoverInferenceOAuth)(config2.apiUrl);
|
|
45055
45210
|
await (dependencies.revokeCredential ?? revokeInferenceCredential)({
|
|
45056
45211
|
metadata,
|
|
45057
|
-
credential:
|
|
45212
|
+
credential: access6.credential,
|
|
45058
45213
|
store
|
|
45059
45214
|
});
|
|
45060
45215
|
remoteCleanupConfirmed = true;
|
|
@@ -45066,8 +45221,8 @@ Waiting for approval...
|
|
|
45066
45221
|
{ cause: stateError }
|
|
45067
45222
|
);
|
|
45068
45223
|
}
|
|
45069
|
-
await store.writeRecovery(
|
|
45070
|
-
await store.remove(
|
|
45224
|
+
await store.writeRecovery(access6.accountKey, access6.credential);
|
|
45225
|
+
await store.remove(access6.accountKey).catch(() => void 0);
|
|
45071
45226
|
}
|
|
45072
45227
|
if (!remoteCleanupConfirmed) {
|
|
45073
45228
|
throw new Error(
|
|
@@ -45972,7 +46127,7 @@ Waiting for approval...
|
|
|
45972
46127
|
const session = await agentSession(config2, dependencies, warnings);
|
|
45973
46128
|
const now = dependencies.now ?? (() => /* @__PURE__ */ new Date());
|
|
45974
46129
|
const sleep4 = dependencies.sleep ?? (async (milliseconds) => {
|
|
45975
|
-
await new Promise((
|
|
46130
|
+
await new Promise((resolve13) => setTimeout(resolve13, milliseconds));
|
|
45976
46131
|
});
|
|
45977
46132
|
const stopAt = now().getTime() + parsed.waitSeconds * 1e3;
|
|
45978
46133
|
let state = await readInferenceForegroundAgentControlState(config2.statePath) ?? foregroundAgentControlState(session.localState.host_id, now().toISOString());
|
|
@@ -46509,7 +46664,7 @@ Waiting for approval...
|
|
|
46509
46664
|
}
|
|
46510
46665
|
if (parsed.once && !commandLock) break;
|
|
46511
46666
|
await (dependencies.sleep ?? (async (milliseconds) => {
|
|
46512
|
-
await new Promise((
|
|
46667
|
+
await new Promise((resolve13) => setTimeout(resolve13, milliseconds));
|
|
46513
46668
|
}))(retryDelayMs);
|
|
46514
46669
|
}
|
|
46515
46670
|
return {
|
|
@@ -46538,7 +46693,7 @@ Waiting for approval...
|
|
|
46538
46693
|
const session = await agentSession(config2, dependencies, warnings);
|
|
46539
46694
|
const now = dependencies.now ?? (() => /* @__PURE__ */ new Date());
|
|
46540
46695
|
const sleep4 = dependencies.sleep ?? (async (milliseconds) => {
|
|
46541
|
-
await new Promise((
|
|
46696
|
+
await new Promise((resolve13) => setTimeout(resolve13, milliseconds));
|
|
46542
46697
|
});
|
|
46543
46698
|
const stopAt = now().getTime() + parsed.waitSeconds * 1e3;
|
|
46544
46699
|
while (true) {
|
|
@@ -46855,7 +47010,7 @@ Waiting for approval...
|
|
|
46855
47010
|
) || new Set(record5.cleanup_confirmed_attempt_ids).size !== record5.cleanup_confirmed_attempt_ids.length || [...record5.cleanup_confirmed_attempt_ids].sort().join("\0") !== record5.cleanup_confirmed_attempt_ids.join("\0") || typeof record5.started_at !== "string" || !Number.isFinite(Date.parse(record5.started_at)) || new Date(record5.started_at).toISOString() !== record5.started_at) {
|
|
46856
47011
|
throw new Error("Inference-host service recovery transaction is invalid.");
|
|
46857
47012
|
}
|
|
46858
|
-
if (
|
|
47013
|
+
if (resolve12(record5.recovery_backup_path) !== resolve12(recoveryBackupPath(config2, record5.transaction_id))) {
|
|
46859
47014
|
throw new Error("Inference-host service recovery backup path is invalid.");
|
|
46860
47015
|
}
|
|
46861
47016
|
return record5;
|
|
@@ -47106,7 +47261,7 @@ Waiting for approval...
|
|
|
47106
47261
|
serviceRecoveryTransactionPath(config2),
|
|
47107
47262
|
"Inference-host service recovery transaction"
|
|
47108
47263
|
);
|
|
47109
|
-
await
|
|
47264
|
+
await rm12(backupPath, { force: true });
|
|
47110
47265
|
}
|
|
47111
47266
|
}
|
|
47112
47267
|
} finally {
|
|
@@ -47136,7 +47291,7 @@ Waiting for approval...
|
|
|
47136
47291
|
{
|
|
47137
47292
|
signal: cancellation.signal,
|
|
47138
47293
|
quiesceSignal: cancellation.quiesceSignal,
|
|
47139
|
-
serviceScript:
|
|
47294
|
+
serviceScript: resolve12(process.argv[1] ?? ""),
|
|
47140
47295
|
controlLockPath: `${supervisorConfig.supervisorProcessLockPath}.service-control`
|
|
47141
47296
|
}
|
|
47142
47297
|
);
|
|
@@ -47362,7 +47517,7 @@ Waiting for approval...
|
|
|
47362
47517
|
...selectedEnv,
|
|
47363
47518
|
...retainedEnvironment
|
|
47364
47519
|
});
|
|
47365
|
-
if (
|
|
47520
|
+
if (resolve12(installedConfig.statePath) !== resolve12(baseConfig.statePath)) {
|
|
47366
47521
|
throw new Error(
|
|
47367
47522
|
"Installed inference-host service manifest does not match the requested local state path."
|
|
47368
47523
|
);
|
|
@@ -47381,11 +47536,11 @@ Waiting for approval...
|
|
|
47381
47536
|
});
|
|
47382
47537
|
|
|
47383
47538
|
// lib/agent-core/config.ts
|
|
47384
|
-
import { mkdir as mkdir5, readFile as
|
|
47385
|
-
import { dirname as
|
|
47539
|
+
import { mkdir as mkdir5, readFile as readFile11, rm as rm13, writeFile as writeFile5 } from "node:fs/promises";
|
|
47540
|
+
import { dirname as dirname14, join as join16 } from "node:path";
|
|
47386
47541
|
import { homedir as homedir3 } from "node:os";
|
|
47387
47542
|
function defaultBaseDir() {
|
|
47388
|
-
return
|
|
47543
|
+
return join16(homedir3(), ".vtx");
|
|
47389
47544
|
}
|
|
47390
47545
|
function resolveAgentCliConfig(env = process.env) {
|
|
47391
47546
|
const baseDir = String(env.VTX_HOME || "").trim() || defaultBaseDir();
|
|
@@ -47393,8 +47548,8 @@ function resolveAgentCliConfig(env = process.env) {
|
|
|
47393
47548
|
const parsedProfile = rawProfile ? Number(rawProfile) : NaN;
|
|
47394
47549
|
return {
|
|
47395
47550
|
apiUrl: String(env.VTX_API_URL || "http://localhost:8000").replace(/\/+$/, ""),
|
|
47396
|
-
tokenPath: String(env.VTX_TOKEN_PATH || "").trim() ||
|
|
47397
|
-
statePath: String(env.VTX_RUNTIME_STATE_PATH || "").trim() ||
|
|
47551
|
+
tokenPath: String(env.VTX_TOKEN_PATH || "").trim() || join16(baseDir, "token.json"),
|
|
47552
|
+
statePath: String(env.VTX_RUNTIME_STATE_PATH || "").trim() || join16(baseDir, "runtime-state.json"),
|
|
47398
47553
|
runtimeDeviceId: String(env.VTX_RUNTIME_DEVICE_ID || "").trim() || null,
|
|
47399
47554
|
activeProfileId: Number.isFinite(parsedProfile) && parsedProfile > 0 ? parsedProfile : null,
|
|
47400
47555
|
outputJson: String(env.VTX_OUTPUT || "").trim().toLowerCase() === "json"
|
|
@@ -47402,7 +47557,7 @@ function resolveAgentCliConfig(env = process.env) {
|
|
|
47402
47557
|
}
|
|
47403
47558
|
async function readStoredAgentAuth(path) {
|
|
47404
47559
|
try {
|
|
47405
|
-
const raw = await
|
|
47560
|
+
const raw = await readFile11(path, "utf8");
|
|
47406
47561
|
if (!raw.trim()) {
|
|
47407
47562
|
throw new Error(`VTX token file is empty at ${path}. Run "vtx auth login" or remove the file and retry.`);
|
|
47408
47563
|
}
|
|
@@ -47420,16 +47575,16 @@ async function readStoredAgentAuth(path) {
|
|
|
47420
47575
|
}
|
|
47421
47576
|
}
|
|
47422
47577
|
async function writeStoredAgentAuth(path, auth) {
|
|
47423
|
-
await mkdir5(
|
|
47578
|
+
await mkdir5(dirname14(path), { recursive: true });
|
|
47424
47579
|
await writeFile5(path, `${JSON.stringify(auth, null, 2)}
|
|
47425
47580
|
`, { encoding: "utf8", mode: 384 });
|
|
47426
47581
|
}
|
|
47427
47582
|
async function clearStoredAgentAuth(path) {
|
|
47428
|
-
await
|
|
47583
|
+
await rm13(path, { force: true });
|
|
47429
47584
|
}
|
|
47430
47585
|
async function readRuntimeState(path) {
|
|
47431
47586
|
try {
|
|
47432
|
-
const raw = await
|
|
47587
|
+
const raw = await readFile11(path, "utf8");
|
|
47433
47588
|
const parsed = JSON.parse(raw);
|
|
47434
47589
|
const profileId = Number(parsed.profileId);
|
|
47435
47590
|
const runtimeSessionId = String(parsed.runtimeSessionId || "").trim();
|
|
@@ -47455,12 +47610,12 @@ async function readRuntimeState(path) {
|
|
|
47455
47610
|
}
|
|
47456
47611
|
}
|
|
47457
47612
|
async function writeRuntimeState(path, state) {
|
|
47458
|
-
await mkdir5(
|
|
47613
|
+
await mkdir5(dirname14(path), { recursive: true });
|
|
47459
47614
|
await writeFile5(path, `${JSON.stringify(state, null, 2)}
|
|
47460
47615
|
`, { encoding: "utf8", mode: 384 });
|
|
47461
47616
|
}
|
|
47462
47617
|
async function clearRuntimeState(path) {
|
|
47463
|
-
await
|
|
47618
|
+
await rm13(path, { force: true });
|
|
47464
47619
|
}
|
|
47465
47620
|
var init_config2 = __esm({
|
|
47466
47621
|
"lib/agent-core/config.ts"() {
|
|
@@ -47902,7 +48057,7 @@ import {
|
|
|
47902
48057
|
writeFileSync
|
|
47903
48058
|
} from "node:fs";
|
|
47904
48059
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
47905
|
-
import { dirname as
|
|
48060
|
+
import { dirname as dirname15 } from "node:path";
|
|
47906
48061
|
var parseStoredValues, FileBackedProtectionStorage, clientRuntimeProtectionStatePath;
|
|
47907
48062
|
var init_protection_storage = __esm({
|
|
47908
48063
|
"lib/agent-core/protection-storage.ts"() {
|
|
@@ -47958,7 +48113,7 @@ var init_protection_storage = __esm({
|
|
|
47958
48113
|
}
|
|
47959
48114
|
}
|
|
47960
48115
|
writeValues(values) {
|
|
47961
|
-
mkdirSync(
|
|
48116
|
+
mkdirSync(dirname15(this.path), { recursive: true, mode: 448 });
|
|
47962
48117
|
const serialized = `${JSON.stringify(values)}
|
|
47963
48118
|
`;
|
|
47964
48119
|
const temporaryPath = `${this.path}.${process.pid}.${randomUUID12()}.tmp`;
|
|
@@ -48411,7 +48566,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48411
48566
|
checkAbort = (signal) => {
|
|
48412
48567
|
if (signal?.aborted) throw abortError2(signal);
|
|
48413
48568
|
};
|
|
48414
|
-
wait = (ms, signal) => new Promise((
|
|
48569
|
+
wait = (ms, signal) => new Promise((resolve13, reject) => {
|
|
48415
48570
|
checkAbort(signal);
|
|
48416
48571
|
const aborted2 = () => {
|
|
48417
48572
|
clearTimeout(timer);
|
|
@@ -48419,7 +48574,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48419
48574
|
};
|
|
48420
48575
|
const timer = setTimeout(() => {
|
|
48421
48576
|
signal?.removeEventListener("abort", aborted2);
|
|
48422
|
-
|
|
48577
|
+
resolve13();
|
|
48423
48578
|
}, Math.min(ms, 2147483647));
|
|
48424
48579
|
signal?.addEventListener("abort", aborted2, { once: true });
|
|
48425
48580
|
});
|
|
@@ -48527,7 +48682,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48527
48682
|
if (existing && Date.now() - existing.fetchedAtMs >= 0 && Date.now() - existing.fetchedAtMs < ttlSeconds * 500) return existing;
|
|
48528
48683
|
const running = pending2.get(key);
|
|
48529
48684
|
if (!running) break;
|
|
48530
|
-
await new Promise((
|
|
48685
|
+
await new Promise((resolve13, reject) => {
|
|
48531
48686
|
const aborted2 = () => {
|
|
48532
48687
|
options.signal?.removeEventListener("abort", aborted2);
|
|
48533
48688
|
reject(abortError2(options.signal));
|
|
@@ -48535,15 +48690,15 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48535
48690
|
options.signal?.addEventListener("abort", aborted2, { once: true });
|
|
48536
48691
|
running.then(() => {
|
|
48537
48692
|
options.signal?.removeEventListener("abort", aborted2);
|
|
48538
|
-
|
|
48693
|
+
resolve13();
|
|
48539
48694
|
});
|
|
48540
48695
|
});
|
|
48541
48696
|
checkAbort(options.signal);
|
|
48542
48697
|
}
|
|
48543
48698
|
}
|
|
48544
48699
|
let settled;
|
|
48545
|
-
if (ttlSeconds) pending2.set(key, new Promise((
|
|
48546
|
-
settled =
|
|
48700
|
+
if (ttlSeconds) pending2.set(key, new Promise((resolve13) => {
|
|
48701
|
+
settled = resolve13;
|
|
48547
48702
|
}));
|
|
48548
48703
|
try {
|
|
48549
48704
|
const reservedKey = JSON.stringify(body);
|
|
@@ -50135,12 +50290,12 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
50135
50290
|
if (signal.aborted) {
|
|
50136
50291
|
throw createAbortError(abortMessage);
|
|
50137
50292
|
}
|
|
50138
|
-
return new Promise((
|
|
50293
|
+
return new Promise((resolve13, reject) => {
|
|
50139
50294
|
const onAbort = () => {
|
|
50140
50295
|
reject(createAbortError(abortMessage));
|
|
50141
50296
|
};
|
|
50142
50297
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
50143
|
-
promise2.then(
|
|
50298
|
+
promise2.then(resolve13, reject).finally(() => {
|
|
50144
50299
|
signal.removeEventListener("abort", onAbort);
|
|
50145
50300
|
});
|
|
50146
50301
|
});
|
|
@@ -51473,7 +51628,7 @@ var init_shared = __esm({
|
|
|
51473
51628
|
}
|
|
51474
51629
|
};
|
|
51475
51630
|
API_URL = getApiUrl();
|
|
51476
|
-
sleep2 = (ms) => new Promise((
|
|
51631
|
+
sleep2 = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
|
|
51477
51632
|
AUTH_BOOTSTRAP_GET_MAX_ATTEMPTS = runtime_policy_generated_default.ui.auth_bootstrap_retry.max_attempts;
|
|
51478
51633
|
AUTH_BOOTSTRAP_RETRY_JITTER_MS = runtime_policy_generated_default.ui.auth_bootstrap_retry.jitter_milliseconds;
|
|
51479
51634
|
parseRetryAfterMs2 = (value) => {
|
|
@@ -52632,7 +52787,7 @@ var init_api2 = __esm({
|
|
|
52632
52787
|
if (signal.aborted) {
|
|
52633
52788
|
throw signal.reason ?? new DOMException("Runtime lease recovery aborted.", "AbortError");
|
|
52634
52789
|
}
|
|
52635
|
-
return await new Promise((
|
|
52790
|
+
return await new Promise((resolve13, reject) => {
|
|
52636
52791
|
let settled = false;
|
|
52637
52792
|
const finish = (callback) => {
|
|
52638
52793
|
if (settled) {
|
|
@@ -52647,7 +52802,7 @@ var init_api2 = __esm({
|
|
|
52647
52802
|
));
|
|
52648
52803
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
52649
52804
|
recovery.promise.then(
|
|
52650
|
-
(token) => finish(() =>
|
|
52805
|
+
(token) => finish(() => resolve13(token)),
|
|
52651
52806
|
(error48) => finish(() => reject(error48))
|
|
52652
52807
|
);
|
|
52653
52808
|
});
|
|
@@ -52859,8 +53014,8 @@ var init_exchange_mutation_fence = __esm({
|
|
|
52859
53014
|
return operation();
|
|
52860
53015
|
}
|
|
52861
53016
|
let markSettled;
|
|
52862
|
-
const settlement = new Promise((
|
|
52863
|
-
markSettled =
|
|
53017
|
+
const settlement = new Promise((resolve13) => {
|
|
53018
|
+
markSettled = resolve13;
|
|
52864
53019
|
});
|
|
52865
53020
|
const activeSettlements = activeSettlementsByScope.get(normalizedScope) ?? /* @__PURE__ */ new Set();
|
|
52866
53021
|
activeSettlements.add(settlement);
|
|
@@ -53864,7 +54019,7 @@ function createGetUrl(options) {
|
|
|
53864
54019
|
request.write(Buffer.from(body));
|
|
53865
54020
|
}
|
|
53866
54021
|
request.end();
|
|
53867
|
-
return new Promise((
|
|
54022
|
+
return new Promise((resolve13, reject) => {
|
|
53868
54023
|
if (signal) {
|
|
53869
54024
|
signal.addListener(() => {
|
|
53870
54025
|
if (abort) {
|
|
@@ -53910,7 +54065,7 @@ function createGetUrl(options) {
|
|
|
53910
54065
|
if (headers2["content-encoding"] === "gzip" && body2) {
|
|
53911
54066
|
body2 = getBytes(gunzipSync2(body2));
|
|
53912
54067
|
}
|
|
53913
|
-
|
|
54068
|
+
resolve13({ statusCode, statusMessage, headers: headers2, body: body2 });
|
|
53914
54069
|
} catch (error48) {
|
|
53915
54070
|
reject(makeError("bad response data", "SERVER_ERROR", {
|
|
53916
54071
|
request: req,
|
|
@@ -53986,7 +54141,7 @@ function unpercent(value) {
|
|
|
53986
54141
|
}));
|
|
53987
54142
|
}
|
|
53988
54143
|
function wait2(delay2) {
|
|
53989
|
-
return new Promise((
|
|
54144
|
+
return new Promise((resolve13) => setTimeout(resolve13, delay2));
|
|
53990
54145
|
}
|
|
53991
54146
|
var MAX_ATTEMPTS, SLOT_INTERVAL, defaultGetUrlFunc, reData, reIpfs, locked, Gateways, fetchSignals, FetchCancelSignal, FetchRequest, FetchResponse;
|
|
53992
54147
|
var init_fetch = __esm({
|
|
@@ -67778,7 +67933,7 @@ var init_provider = __esm({
|
|
|
67778
67933
|
return null;
|
|
67779
67934
|
}
|
|
67780
67935
|
}
|
|
67781
|
-
const waiter = new Promise((
|
|
67936
|
+
const waiter = new Promise((resolve13, reject) => {
|
|
67782
67937
|
const cancellers = [];
|
|
67783
67938
|
const cancel = () => {
|
|
67784
67939
|
cancellers.forEach((c) => c());
|
|
@@ -67799,7 +67954,7 @@ var init_provider = __esm({
|
|
|
67799
67954
|
if (await receipt2.confirmations() >= confirms) {
|
|
67800
67955
|
cancel();
|
|
67801
67956
|
try {
|
|
67802
|
-
|
|
67957
|
+
resolve13(checkReceipt(receipt2));
|
|
67803
67958
|
} catch (error48) {
|
|
67804
67959
|
reject(error48);
|
|
67805
67960
|
}
|
|
@@ -68724,12 +68879,12 @@ var init_contract = __esm({
|
|
|
68724
68879
|
}
|
|
68725
68880
|
const provider = getProvider(this.runner);
|
|
68726
68881
|
assert2(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" });
|
|
68727
|
-
return new Promise((
|
|
68882
|
+
return new Promise((resolve13, reject) => {
|
|
68728
68883
|
const checkCode = async () => {
|
|
68729
68884
|
try {
|
|
68730
68885
|
const code2 = await this.getDeployedCode();
|
|
68731
68886
|
if (code2 != null) {
|
|
68732
|
-
return
|
|
68887
|
+
return resolve13(this);
|
|
68733
68888
|
}
|
|
68734
68889
|
provider.once("block", checkCode);
|
|
68735
68890
|
} catch (error48) {
|
|
@@ -71081,7 +71236,7 @@ var init_abstract_provider = __esm({
|
|
|
71081
71236
|
return t.toLowerCase();
|
|
71082
71237
|
});
|
|
71083
71238
|
const blockHash = "blockHash" in filter ? filter.blockHash : void 0;
|
|
71084
|
-
const
|
|
71239
|
+
const resolve13 = (_address, fromBlock2, toBlock2) => {
|
|
71085
71240
|
let address2 = void 0;
|
|
71086
71241
|
switch (_address.length) {
|
|
71087
71242
|
case 0:
|
|
@@ -71136,10 +71291,10 @@ var init_abstract_provider = __esm({
|
|
|
71136
71291
|
}
|
|
71137
71292
|
if (address.filter((a) => typeof a !== "string").length || fromBlock != null && typeof fromBlock !== "string" || toBlock != null && typeof toBlock !== "string") {
|
|
71138
71293
|
return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result2) => {
|
|
71139
|
-
return
|
|
71294
|
+
return resolve13(result2[0], result2[1], result2[2]);
|
|
71140
71295
|
});
|
|
71141
71296
|
}
|
|
71142
|
-
return
|
|
71297
|
+
return resolve13(address, fromBlock, toBlock);
|
|
71143
71298
|
}
|
|
71144
71299
|
/**
|
|
71145
71300
|
* Returns or resolves to a transaction for %%request%%, resolving
|
|
@@ -71513,14 +71668,14 @@ var init_abstract_provider = __esm({
|
|
|
71513
71668
|
if (confirms === 0) {
|
|
71514
71669
|
return this.getTransactionReceipt(hash4);
|
|
71515
71670
|
}
|
|
71516
|
-
return new Promise(async (
|
|
71671
|
+
return new Promise(async (resolve13, reject) => {
|
|
71517
71672
|
let timer = null;
|
|
71518
71673
|
const listener = (async (blockNumber) => {
|
|
71519
71674
|
try {
|
|
71520
71675
|
const receipt = await this.getTransactionReceipt(hash4);
|
|
71521
71676
|
if (receipt != null) {
|
|
71522
71677
|
if (blockNumber - receipt.blockNumber + 1 >= confirms) {
|
|
71523
|
-
|
|
71678
|
+
resolve13(receipt);
|
|
71524
71679
|
if (timer) {
|
|
71525
71680
|
clearTimeout(timer);
|
|
71526
71681
|
timer = null;
|
|
@@ -72291,8 +72446,8 @@ function deepCopy(value) {
|
|
|
72291
72446
|
throw new Error(`should not happen: ${value} (${typeof value})`);
|
|
72292
72447
|
}
|
|
72293
72448
|
function stall(duration3) {
|
|
72294
|
-
return new Promise((
|
|
72295
|
-
setTimeout(
|
|
72449
|
+
return new Promise((resolve13) => {
|
|
72450
|
+
setTimeout(resolve13, duration3);
|
|
72296
72451
|
});
|
|
72297
72452
|
}
|
|
72298
72453
|
function getLowerCase(value) {
|
|
@@ -72432,14 +72587,14 @@ var init_provider_jsonrpc = __esm({
|
|
|
72432
72587
|
async sendTransaction(tx) {
|
|
72433
72588
|
const blockNumber = await this.provider.getBlockNumber();
|
|
72434
72589
|
const hash4 = await this.sendUncheckedTransaction(tx);
|
|
72435
|
-
return await new Promise((
|
|
72590
|
+
return await new Promise((resolve13, reject) => {
|
|
72436
72591
|
const timeouts = [1e3, 100];
|
|
72437
72592
|
let invalids = 0;
|
|
72438
72593
|
const checkTx = async () => {
|
|
72439
72594
|
try {
|
|
72440
72595
|
const tx2 = await this.provider.getTransaction(hash4);
|
|
72441
72596
|
if (tx2 != null) {
|
|
72442
|
-
|
|
72597
|
+
resolve13(tx2.replaceableTransaction(blockNumber));
|
|
72443
72598
|
return;
|
|
72444
72599
|
}
|
|
72445
72600
|
} catch (error48) {
|
|
@@ -72556,7 +72711,7 @@ var init_provider_jsonrpc = __esm({
|
|
|
72556
72711
|
try {
|
|
72557
72712
|
const result2 = await this._send(payload);
|
|
72558
72713
|
this.emit("debug", { action: "receiveRpcResult", result: result2 });
|
|
72559
|
-
for (const { resolve:
|
|
72714
|
+
for (const { resolve: resolve13, reject, payload: payload2 } of batch) {
|
|
72560
72715
|
if (this.destroyed) {
|
|
72561
72716
|
reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload2.method }));
|
|
72562
72717
|
continue;
|
|
@@ -72575,7 +72730,7 @@ var init_provider_jsonrpc = __esm({
|
|
|
72575
72730
|
reject(this.getRpcError(payload2, resp));
|
|
72576
72731
|
continue;
|
|
72577
72732
|
}
|
|
72578
|
-
|
|
72733
|
+
resolve13(resp.result);
|
|
72579
72734
|
}
|
|
72580
72735
|
} catch (error48) {
|
|
72581
72736
|
this.emit("debug", { action: "receiveRpcError", error: error48 });
|
|
@@ -72596,11 +72751,11 @@ var init_provider_jsonrpc = __esm({
|
|
|
72596
72751
|
this.#network = null;
|
|
72597
72752
|
this.#pendingDetectNetwork = null;
|
|
72598
72753
|
{
|
|
72599
|
-
let
|
|
72754
|
+
let resolve13 = null;
|
|
72600
72755
|
const promise2 = new Promise((_resolve) => {
|
|
72601
|
-
|
|
72756
|
+
resolve13 = _resolve;
|
|
72602
72757
|
});
|
|
72603
|
-
this.#notReady = { promise: promise2, resolve:
|
|
72758
|
+
this.#notReady = { promise: promise2, resolve: resolve13 };
|
|
72604
72759
|
}
|
|
72605
72760
|
const staticNetwork = this._getOption("staticNetwork");
|
|
72606
72761
|
if (typeof staticNetwork === "boolean") {
|
|
@@ -73013,9 +73168,9 @@ var init_provider_jsonrpc = __esm({
|
|
|
73013
73168
|
return Promise.reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method }));
|
|
73014
73169
|
}
|
|
73015
73170
|
const id2 = this.#nextId++;
|
|
73016
|
-
const promise2 = new Promise((
|
|
73171
|
+
const promise2 = new Promise((resolve13, reject) => {
|
|
73017
73172
|
this.#payloads.push({
|
|
73018
|
-
resolve:
|
|
73173
|
+
resolve: resolve13,
|
|
73019
73174
|
reject,
|
|
73020
73175
|
payload: { method, params, id: id2, jsonrpc: "2.0" }
|
|
73021
73176
|
});
|
|
@@ -77973,8 +78128,8 @@ var init_provider_socket = __esm({
|
|
|
77973
78128
|
}
|
|
77974
78129
|
async _send(payload) {
|
|
77975
78130
|
assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload);
|
|
77976
|
-
const promise2 = new Promise((
|
|
77977
|
-
this.#callbacks.set(payload.id, { payload, resolve:
|
|
78131
|
+
const promise2 = new Promise((resolve13, reject) => {
|
|
78132
|
+
this.#callbacks.set(payload.id, { payload, resolve: resolve13, reject });
|
|
77978
78133
|
});
|
|
77979
78134
|
await this._waitUntilReady();
|
|
77980
78135
|
await this._write(JSON.stringify(payload));
|
|
@@ -78380,8 +78535,8 @@ function shuffle(array2) {
|
|
|
78380
78535
|
}
|
|
78381
78536
|
}
|
|
78382
78537
|
function stall2(duration3) {
|
|
78383
|
-
return new Promise((
|
|
78384
|
-
setTimeout(
|
|
78538
|
+
return new Promise((resolve13) => {
|
|
78539
|
+
setTimeout(resolve13, duration3);
|
|
78385
78540
|
});
|
|
78386
78541
|
}
|
|
78387
78542
|
function getTime3() {
|
|
@@ -79263,7 +79418,7 @@ var init_provider_browser = __esm({
|
|
|
79263
79418
|
if (timeout === 0) {
|
|
79264
79419
|
return null;
|
|
79265
79420
|
}
|
|
79266
|
-
return await new Promise((
|
|
79421
|
+
return await new Promise((resolve13, reject) => {
|
|
79267
79422
|
let found = [];
|
|
79268
79423
|
const addProvider = (event) => {
|
|
79269
79424
|
found.push(event.detail);
|
|
@@ -79277,9 +79432,9 @@ var init_provider_browser = __esm({
|
|
|
79277
79432
|
if (options && options.filter) {
|
|
79278
79433
|
const filtered = options.filter(found.map((i) => Object.assign({}, i.info)));
|
|
79279
79434
|
if (filtered == null) {
|
|
79280
|
-
|
|
79435
|
+
resolve13(null);
|
|
79281
79436
|
} else if (filtered instanceof _BrowserProvider) {
|
|
79282
|
-
|
|
79437
|
+
resolve13(filtered);
|
|
79283
79438
|
} else {
|
|
79284
79439
|
let match = null;
|
|
79285
79440
|
if (filtered.uuid) {
|
|
@@ -79288,7 +79443,7 @@ var init_provider_browser = __esm({
|
|
|
79288
79443
|
}
|
|
79289
79444
|
if (match) {
|
|
79290
79445
|
const { provider, info } = match;
|
|
79291
|
-
|
|
79446
|
+
resolve13(new _BrowserProvider(provider, void 0, {
|
|
79292
79447
|
providerInfo: info
|
|
79293
79448
|
}));
|
|
79294
79449
|
} else {
|
|
@@ -79299,12 +79454,12 @@ var init_provider_browser = __esm({
|
|
|
79299
79454
|
}
|
|
79300
79455
|
} else {
|
|
79301
79456
|
const { provider, info } = found[0];
|
|
79302
|
-
|
|
79457
|
+
resolve13(new _BrowserProvider(provider, void 0, {
|
|
79303
79458
|
providerInfo: info
|
|
79304
79459
|
}));
|
|
79305
79460
|
}
|
|
79306
79461
|
} else {
|
|
79307
|
-
|
|
79462
|
+
resolve13(null);
|
|
79308
79463
|
}
|
|
79309
79464
|
context.removeEventListener("eip6963:announceProvider", addProvider);
|
|
79310
79465
|
};
|
|
@@ -80718,9 +80873,9 @@ function decryptKeystoreJsonSync(json2, _password) {
|
|
|
80718
80873
|
return getAccount(data4, key);
|
|
80719
80874
|
}
|
|
80720
80875
|
function stall3(duration3) {
|
|
80721
|
-
return new Promise((
|
|
80876
|
+
return new Promise((resolve13) => {
|
|
80722
80877
|
setTimeout(() => {
|
|
80723
|
-
|
|
80878
|
+
resolve13();
|
|
80724
80879
|
}, duration3);
|
|
80725
80880
|
});
|
|
80726
80881
|
}
|
|
@@ -81349,9 +81504,9 @@ var init_json_crowdsale = __esm({
|
|
|
81349
81504
|
|
|
81350
81505
|
// node_modules/ethers/lib.esm/wallet/wallet.js
|
|
81351
81506
|
function stall4(duration3) {
|
|
81352
|
-
return new Promise((
|
|
81507
|
+
return new Promise((resolve13) => {
|
|
81353
81508
|
setTimeout(() => {
|
|
81354
|
-
|
|
81509
|
+
resolve13();
|
|
81355
81510
|
}, duration3);
|
|
81356
81511
|
});
|
|
81357
81512
|
}
|
|
@@ -85297,14 +85452,14 @@ var init_hyperliquid_client = __esm({
|
|
|
85297
85452
|
if (input.signal?.aborted) {
|
|
85298
85453
|
throw input.signal.reason instanceof Error ? input.signal.reason : settlementError;
|
|
85299
85454
|
}
|
|
85300
|
-
await new Promise((
|
|
85455
|
+
await new Promise((resolve13) => {
|
|
85301
85456
|
let settled = false;
|
|
85302
85457
|
const finish = () => {
|
|
85303
85458
|
if (settled) return;
|
|
85304
85459
|
settled = true;
|
|
85305
85460
|
globalThis.clearTimeout(timeoutId);
|
|
85306
85461
|
input.signal?.removeEventListener("abort", finish);
|
|
85307
|
-
|
|
85462
|
+
resolve13();
|
|
85308
85463
|
};
|
|
85309
85464
|
const timeoutId = globalThis.setTimeout(finish, 1e3);
|
|
85310
85465
|
input.signal?.addEventListener("abort", finish, { once: true });
|
|
@@ -85335,12 +85490,12 @@ var init_hyperliquid_client = __esm({
|
|
|
85335
85490
|
captureController.signal,
|
|
85336
85491
|
...durableMutationAuthorityArgs(durableMutation)
|
|
85337
85492
|
).then(() => void 0).catch(() => void 0);
|
|
85338
|
-
const captureDeadline = new Promise((
|
|
85493
|
+
const captureDeadline = new Promise((resolve13) => {
|
|
85339
85494
|
captureTimeout = globalThis.setTimeout(() => {
|
|
85340
85495
|
captureController.abort(
|
|
85341
85496
|
new DOMException("Execution attempt capture timed out.", "TimeoutError")
|
|
85342
85497
|
);
|
|
85343
|
-
|
|
85498
|
+
resolve13();
|
|
85344
85499
|
}, remainingBudgetMs);
|
|
85345
85500
|
});
|
|
85346
85501
|
await Promise.race([captureRequest, captureDeadline]);
|
|
@@ -85844,7 +85999,7 @@ var init_vault = __esm({
|
|
|
85844
85999
|
}
|
|
85845
86000
|
return output3.buffer.slice(output3.byteOffset, output3.byteOffset + output3.byteLength);
|
|
85846
86001
|
};
|
|
85847
|
-
openVaultDb = async () => new Promise((
|
|
86002
|
+
openVaultDb = async () => new Promise((resolve13, reject) => {
|
|
85848
86003
|
const request = indexedDB.open(VAULT_DB_NAME, VAULT_DB_VERSION);
|
|
85849
86004
|
request.onerror = () => reject(request.error ?? new Error("Failed to open client vault database."));
|
|
85850
86005
|
request.onupgradeneeded = () => {
|
|
@@ -85853,7 +86008,7 @@ var init_vault = __esm({
|
|
|
85853
86008
|
database.createObjectStore(VAULT_KEY_STORE);
|
|
85854
86009
|
}
|
|
85855
86010
|
};
|
|
85856
|
-
request.onsuccess = () =>
|
|
86011
|
+
request.onsuccess = () => resolve13(request.result);
|
|
85857
86012
|
});
|
|
85858
86013
|
withVaultStore = async (mode, fn) => {
|
|
85859
86014
|
const database = await openVaultDb();
|
|
@@ -85861,8 +86016,8 @@ var init_vault = __esm({
|
|
|
85861
86016
|
const transaction = database.transaction(VAULT_KEY_STORE, mode);
|
|
85862
86017
|
const store = transaction.objectStore(VAULT_KEY_STORE);
|
|
85863
86018
|
const result2 = await fn(store);
|
|
85864
|
-
await new Promise((
|
|
85865
|
-
transaction.oncomplete = () =>
|
|
86019
|
+
await new Promise((resolve13, reject) => {
|
|
86020
|
+
transaction.oncomplete = () => resolve13();
|
|
85866
86021
|
transaction.onerror = () => reject(transaction.error ?? new Error("Client vault transaction failed."));
|
|
85867
86022
|
transaction.onabort = () => reject(transaction.error ?? new Error("Client vault transaction aborted."));
|
|
85868
86023
|
});
|
|
@@ -85877,9 +86032,9 @@ var init_vault = __esm({
|
|
|
85877
86032
|
}
|
|
85878
86033
|
return withVaultStore("readonly", async (store) => {
|
|
85879
86034
|
const request = store.get(profileId);
|
|
85880
|
-
return await new Promise((
|
|
86035
|
+
return await new Promise((resolve13, reject) => {
|
|
85881
86036
|
request.onerror = () => reject(request.error ?? new Error("Failed to read client vault key."));
|
|
85882
|
-
request.onsuccess = () =>
|
|
86037
|
+
request.onsuccess = () => resolve13(request.result ?? null);
|
|
85883
86038
|
});
|
|
85884
86039
|
});
|
|
85885
86040
|
};
|
|
@@ -85901,9 +86056,9 @@ var init_vault = __esm({
|
|
|
85901
86056
|
);
|
|
85902
86057
|
await withVaultStore("readwrite", async (store) => {
|
|
85903
86058
|
const request = store.put(createdKey, profileId);
|
|
85904
|
-
await new Promise((
|
|
86059
|
+
await new Promise((resolve13, reject) => {
|
|
85905
86060
|
request.onerror = () => reject(request.error ?? new Error("Failed to persist client vault key."));
|
|
85906
|
-
request.onsuccess = () =>
|
|
86061
|
+
request.onsuccess = () => resolve13();
|
|
85907
86062
|
});
|
|
85908
86063
|
});
|
|
85909
86064
|
return createdKey;
|
|
@@ -85914,9 +86069,9 @@ var init_vault = __esm({
|
|
|
85914
86069
|
}
|
|
85915
86070
|
await withVaultStore("readwrite", async (store) => {
|
|
85916
86071
|
const request = store.delete(profileId);
|
|
85917
|
-
await new Promise((
|
|
86072
|
+
await new Promise((resolve13, reject) => {
|
|
85918
86073
|
request.onerror = () => reject(request.error ?? new Error("Failed to remove client vault key."));
|
|
85919
|
-
request.onsuccess = () =>
|
|
86074
|
+
request.onsuccess = () => resolve13();
|
|
85920
86075
|
});
|
|
85921
86076
|
});
|
|
85922
86077
|
};
|
|
@@ -90677,10 +90832,10 @@ var init_runtime_execution = __esm({
|
|
|
90677
90832
|
}
|
|
90678
90833
|
};
|
|
90679
90834
|
sleep3 = async (ms, signal) => {
|
|
90680
|
-
await new Promise((
|
|
90835
|
+
await new Promise((resolve13, reject) => {
|
|
90681
90836
|
const timer = setTimeout(() => {
|
|
90682
90837
|
cleanup();
|
|
90683
|
-
|
|
90838
|
+
resolve13(void 0);
|
|
90684
90839
|
}, ms);
|
|
90685
90840
|
const cleanup = () => {
|
|
90686
90841
|
clearTimeout(timer);
|
|
@@ -94080,7 +94235,7 @@ Global options:
|
|
|
94080
94235
|
"alibaba_cloud_model_studio_api_key",
|
|
94081
94236
|
"lightning_api_key"
|
|
94082
94237
|
]);
|
|
94083
|
-
delay = (ms) => new Promise((
|
|
94238
|
+
delay = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
|
|
94084
94239
|
}
|
|
94085
94240
|
});
|
|
94086
94241
|
|