@vtxmacro/cli 2026.9.51 → 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 -44
- package/bin/vtx-service-launcher.js +1389 -0
- package/bin/vtx.js +436 -293
- 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",
|
|
@@ -17849,7 +17849,7 @@ async function syncInferenceDirectory(path, platform = process.platform) {
|
|
|
17849
17849
|
async function replaceAtomicInferencePrivateFile(temporaryPath, destinationPath, options = {}) {
|
|
17850
17850
|
const platform = options.platform ?? process.platform;
|
|
17851
17851
|
const renameFile = options.renameFile ?? rename;
|
|
17852
|
-
const sleep4 = options.sleep ?? ((milliseconds) => new Promise((
|
|
17852
|
+
const sleep4 = options.sleep ?? ((milliseconds) => new Promise((resolve13) => setTimeout(resolve13, milliseconds)));
|
|
17853
17853
|
const maxAttempts = Math.max(1, options.maxAttempts ?? 40);
|
|
17854
17854
|
const retryDelayMs = Math.max(0, options.retryDelayMs ?? 25);
|
|
17855
17855
|
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
@@ -18966,7 +18966,7 @@ var init_credential_store = __esm({
|
|
|
18966
18966
|
}
|
|
18967
18967
|
return;
|
|
18968
18968
|
}
|
|
18969
|
-
await new Promise((
|
|
18969
|
+
await new Promise((resolve13) => {
|
|
18970
18970
|
const terminator = spawn2(
|
|
18971
18971
|
"taskkill.exe",
|
|
18972
18972
|
["/PID", String(pid), "/T", "/F"],
|
|
@@ -18984,21 +18984,21 @@ var init_credential_store = __esm({
|
|
|
18984
18984
|
const timer = setTimeout(() => {
|
|
18985
18985
|
terminator.kill("SIGKILL");
|
|
18986
18986
|
child.kill("SIGKILL");
|
|
18987
|
-
|
|
18987
|
+
resolve13();
|
|
18988
18988
|
}, CREDENTIAL_COMMAND_TERMINATION_TIMEOUT_MS);
|
|
18989
18989
|
terminator.once("error", () => {
|
|
18990
18990
|
clearTimeout(timer);
|
|
18991
18991
|
child.kill("SIGKILL");
|
|
18992
|
-
|
|
18992
|
+
resolve13();
|
|
18993
18993
|
});
|
|
18994
18994
|
terminator.once("close", () => {
|
|
18995
18995
|
clearTimeout(timer);
|
|
18996
18996
|
if (child.exitCode === null) child.kill("SIGKILL");
|
|
18997
|
-
|
|
18997
|
+
resolve13();
|
|
18998
18998
|
});
|
|
18999
18999
|
});
|
|
19000
19000
|
};
|
|
19001
|
-
runCredentialCommand = async (command, options) => await new Promise((
|
|
19001
|
+
runCredentialCommand = async (command, options) => await new Promise((resolve13, reject) => {
|
|
19002
19002
|
const timeoutMs = options.timeoutMs ?? DEFAULT_CREDENTIAL_COMMAND_TIMEOUT_MS;
|
|
19003
19003
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1) {
|
|
19004
19004
|
reject(new Error("OS credential command timeout must be a positive integer."));
|
|
@@ -19057,7 +19057,7 @@ var init_credential_store = __esm({
|
|
|
19057
19057
|
const transformedStdout = normalizedExitCode === 0 ? command.transformStdout?.(stdout) ?? stdout : stdout;
|
|
19058
19058
|
settled = true;
|
|
19059
19059
|
cleanup();
|
|
19060
|
-
|
|
19060
|
+
resolve13({
|
|
19061
19061
|
exitCode: normalizedExitCode,
|
|
19062
19062
|
stdout: transformedStdout
|
|
19063
19063
|
});
|
|
@@ -20214,11 +20214,11 @@ async function revokeInferenceCredential(options) {
|
|
|
20214
20214
|
}
|
|
20215
20215
|
}
|
|
20216
20216
|
async function listenLoopback(server) {
|
|
20217
|
-
await new Promise((
|
|
20217
|
+
await new Promise((resolve13, reject) => {
|
|
20218
20218
|
server.once("error", reject);
|
|
20219
20219
|
server.listen(0, CALLBACK_HOST, () => {
|
|
20220
20220
|
server.off("error", reject);
|
|
20221
|
-
|
|
20221
|
+
resolve13();
|
|
20222
20222
|
});
|
|
20223
20223
|
});
|
|
20224
20224
|
const address = server.address();
|
|
@@ -20229,7 +20229,7 @@ async function listenLoopback(server) {
|
|
|
20229
20229
|
}
|
|
20230
20230
|
async function closeServer(server) {
|
|
20231
20231
|
if (!server.listening) return;
|
|
20232
|
-
await new Promise((
|
|
20232
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
20233
20233
|
}
|
|
20234
20234
|
async function beginInferenceOAuthLogin(options) {
|
|
20235
20235
|
const loginTimeoutMs = options.timeoutMs ?? 6e5;
|
|
@@ -20285,7 +20285,7 @@ async function beginInferenceOAuthLogin(options) {
|
|
|
20285
20285
|
});
|
|
20286
20286
|
let settled = false;
|
|
20287
20287
|
let rejectCompletion;
|
|
20288
|
-
const completion = new Promise((
|
|
20288
|
+
const completion = new Promise((resolve13, reject) => {
|
|
20289
20289
|
rejectCompletion = reject;
|
|
20290
20290
|
handler = async (requestUrl, method, writeResponse) => {
|
|
20291
20291
|
if (settled) {
|
|
@@ -20360,7 +20360,7 @@ async function beginInferenceOAuthLogin(options) {
|
|
|
20360
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>'
|
|
20361
20361
|
);
|
|
20362
20362
|
await closeServer(server);
|
|
20363
|
-
|
|
20363
|
+
resolve13({
|
|
20364
20364
|
accessToken: tokens.accessToken,
|
|
20365
20365
|
expiresIn: tokens.expiresIn,
|
|
20366
20366
|
credential,
|
|
@@ -20548,6 +20548,8 @@ var init_runtime_policy_generated = __esm({
|
|
|
20548
20548
|
service: {
|
|
20549
20549
|
update_check_interval_ms: 3e5,
|
|
20550
20550
|
update_registry_timeout_ms: 15e3,
|
|
20551
|
+
bootstrap_readiness_timeout_ms: 6e5,
|
|
20552
|
+
bootstrap_stop_timeout_ms: 1e4,
|
|
20551
20553
|
startup_max_attempts: 40,
|
|
20552
20554
|
startup_poll_interval_ms: 250,
|
|
20553
20555
|
restart_stable_uptime_ms: 6e4,
|
|
@@ -22504,51 +22506,51 @@ var require_uri_all = __commonJS({
|
|
|
22504
22506
|
}
|
|
22505
22507
|
return uriTokens.join("");
|
|
22506
22508
|
}
|
|
22507
|
-
function resolveComponents(base2,
|
|
22509
|
+
function resolveComponents(base2, relative4) {
|
|
22508
22510
|
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
22509
22511
|
var skipNormalization = arguments[3];
|
|
22510
22512
|
var target = {};
|
|
22511
22513
|
if (!skipNormalization) {
|
|
22512
22514
|
base2 = parse5(serialize(base2, options), options);
|
|
22513
|
-
|
|
22515
|
+
relative4 = parse5(serialize(relative4, options), options);
|
|
22514
22516
|
}
|
|
22515
22517
|
options = options || {};
|
|
22516
|
-
if (!options.tolerant &&
|
|
22517
|
-
target.scheme =
|
|
22518
|
-
target.userinfo =
|
|
22519
|
-
target.host =
|
|
22520
|
-
target.port =
|
|
22521
|
-
target.path = removeDotSegments(
|
|
22522
|
-
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;
|
|
22523
22525
|
} else {
|
|
22524
|
-
if (
|
|
22525
|
-
target.userinfo =
|
|
22526
|
-
target.host =
|
|
22527
|
-
target.port =
|
|
22528
|
-
target.path = removeDotSegments(
|
|
22529
|
-
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;
|
|
22530
22532
|
} else {
|
|
22531
|
-
if (!
|
|
22533
|
+
if (!relative4.path) {
|
|
22532
22534
|
target.path = base2.path;
|
|
22533
|
-
if (
|
|
22534
|
-
target.query =
|
|
22535
|
+
if (relative4.query !== void 0) {
|
|
22536
|
+
target.query = relative4.query;
|
|
22535
22537
|
} else {
|
|
22536
22538
|
target.query = base2.query;
|
|
22537
22539
|
}
|
|
22538
22540
|
} else {
|
|
22539
|
-
if (
|
|
22540
|
-
target.path = removeDotSegments(
|
|
22541
|
+
if (relative4.path.charAt(0) === "/") {
|
|
22542
|
+
target.path = removeDotSegments(relative4.path);
|
|
22541
22543
|
} else {
|
|
22542
22544
|
if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) {
|
|
22543
|
-
target.path = "/" +
|
|
22545
|
+
target.path = "/" + relative4.path;
|
|
22544
22546
|
} else if (!base2.path) {
|
|
22545
|
-
target.path =
|
|
22547
|
+
target.path = relative4.path;
|
|
22546
22548
|
} else {
|
|
22547
|
-
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) +
|
|
22549
|
+
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative4.path;
|
|
22548
22550
|
}
|
|
22549
22551
|
target.path = removeDotSegments(target.path);
|
|
22550
22552
|
}
|
|
22551
|
-
target.query =
|
|
22553
|
+
target.query = relative4.query;
|
|
22552
22554
|
}
|
|
22553
22555
|
target.userinfo = base2.userinfo;
|
|
22554
22556
|
target.host = base2.host;
|
|
@@ -22556,10 +22558,10 @@ var require_uri_all = __commonJS({
|
|
|
22556
22558
|
}
|
|
22557
22559
|
target.scheme = base2.scheme;
|
|
22558
22560
|
}
|
|
22559
|
-
target.fragment =
|
|
22561
|
+
target.fragment = relative4.fragment;
|
|
22560
22562
|
return target;
|
|
22561
22563
|
}
|
|
22562
|
-
function
|
|
22564
|
+
function resolve13(baseURI, relativeURI, options) {
|
|
22563
22565
|
var schemelessOptions = assign({ scheme: "null" }, options);
|
|
22564
22566
|
return serialize(resolveComponents(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
|
|
22565
22567
|
}
|
|
@@ -22824,7 +22826,7 @@ var require_uri_all = __commonJS({
|
|
|
22824
22826
|
exports2.removeDotSegments = removeDotSegments;
|
|
22825
22827
|
exports2.serialize = serialize;
|
|
22826
22828
|
exports2.resolveComponents = resolveComponents;
|
|
22827
|
-
exports2.resolve =
|
|
22829
|
+
exports2.resolve = resolve13;
|
|
22828
22830
|
exports2.normalize = normalize;
|
|
22829
22831
|
exports2.equal = equal;
|
|
22830
22832
|
exports2.escapeComponent = escapeComponent;
|
|
@@ -23195,18 +23197,18 @@ var require_resolve = __commonJS({
|
|
|
23195
23197
|
var util = require_util();
|
|
23196
23198
|
var SchemaObject = require_schema_obj();
|
|
23197
23199
|
var traverse = require_json_schema_traverse();
|
|
23198
|
-
module.exports =
|
|
23199
|
-
|
|
23200
|
-
|
|
23201
|
-
|
|
23202
|
-
|
|
23203
|
-
|
|
23204
|
-
|
|
23205
|
-
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) {
|
|
23206
23208
|
var refVal = this._refs[ref];
|
|
23207
23209
|
if (typeof refVal == "string") {
|
|
23208
23210
|
if (this._refs[refVal]) refVal = this._refs[refVal];
|
|
23209
|
-
else return
|
|
23211
|
+
else return resolve13.call(this, compile, root, refVal);
|
|
23210
23212
|
}
|
|
23211
23213
|
refVal = refVal || this._schemas[ref];
|
|
23212
23214
|
if (refVal instanceof SchemaObject) {
|
|
@@ -23414,7 +23416,7 @@ var require_error_classes = __commonJS({
|
|
|
23414
23416
|
init_define_VTX_EXO_POLICY();
|
|
23415
23417
|
init_define_VTX_GROK_POLICY();
|
|
23416
23418
|
init_define_VTX_PI_MODEL_POLICY();
|
|
23417
|
-
var
|
|
23419
|
+
var resolve13 = require_resolve();
|
|
23418
23420
|
module.exports = {
|
|
23419
23421
|
Validation: errorSubclass(ValidationError),
|
|
23420
23422
|
MissingRef: errorSubclass(MissingRefError)
|
|
@@ -23429,8 +23431,8 @@ var require_error_classes = __commonJS({
|
|
|
23429
23431
|
};
|
|
23430
23432
|
function MissingRefError(baseId, ref, message) {
|
|
23431
23433
|
this.message = message || MissingRefError.message(baseId, ref);
|
|
23432
|
-
this.missingRef =
|
|
23433
|
-
this.missingSchema =
|
|
23434
|
+
this.missingRef = resolve13.url(baseId, ref);
|
|
23435
|
+
this.missingSchema = resolve13.normalizeId(resolve13.fullPath(this.missingRef));
|
|
23434
23436
|
}
|
|
23435
23437
|
function errorSubclass(Subclass) {
|
|
23436
23438
|
Subclass.prototype = Object.create(Error.prototype);
|
|
@@ -23967,7 +23969,7 @@ var require_compile = __commonJS({
|
|
|
23967
23969
|
init_define_VTX_EXO_POLICY();
|
|
23968
23970
|
init_define_VTX_GROK_POLICY();
|
|
23969
23971
|
init_define_VTX_PI_MODEL_POLICY();
|
|
23970
|
-
var
|
|
23972
|
+
var resolve13 = require_resolve();
|
|
23971
23973
|
var util = require_util();
|
|
23972
23974
|
var errorClasses = require_error_classes();
|
|
23973
23975
|
var stableStringify = require_fast_json_stable_stringify();
|
|
@@ -24029,7 +24031,7 @@ var require_compile = __commonJS({
|
|
|
24029
24031
|
RULES,
|
|
24030
24032
|
validate: validateGenerator,
|
|
24031
24033
|
util,
|
|
24032
|
-
resolve:
|
|
24034
|
+
resolve: resolve13,
|
|
24033
24035
|
resolveRef: resolveRef2,
|
|
24034
24036
|
usePattern,
|
|
24035
24037
|
useDefault,
|
|
@@ -24091,7 +24093,7 @@ var require_compile = __commonJS({
|
|
|
24091
24093
|
return validate;
|
|
24092
24094
|
}
|
|
24093
24095
|
function resolveRef2(baseId2, ref, isRoot) {
|
|
24094
|
-
ref =
|
|
24096
|
+
ref = resolve13.url(baseId2, ref);
|
|
24095
24097
|
var refIndex = refs[ref];
|
|
24096
24098
|
var _refVal, refCode;
|
|
24097
24099
|
if (refIndex !== void 0) {
|
|
@@ -24108,11 +24110,11 @@ var require_compile = __commonJS({
|
|
|
24108
24110
|
}
|
|
24109
24111
|
}
|
|
24110
24112
|
refCode = addLocalRef(ref);
|
|
24111
|
-
var v2 =
|
|
24113
|
+
var v2 = resolve13.call(self2, localCompile, root, ref);
|
|
24112
24114
|
if (v2 === void 0) {
|
|
24113
24115
|
var localSchema = localRefs && localRefs[ref];
|
|
24114
24116
|
if (localSchema) {
|
|
24115
|
-
v2 =
|
|
24117
|
+
v2 = resolve13.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self2, localSchema, root, localRefs, baseId2);
|
|
24116
24118
|
}
|
|
24117
24119
|
}
|
|
24118
24120
|
if (v2 === void 0) {
|
|
@@ -27828,7 +27830,7 @@ var require_ajv = __commonJS({
|
|
|
27828
27830
|
init_define_VTX_GROK_POLICY();
|
|
27829
27831
|
init_define_VTX_PI_MODEL_POLICY();
|
|
27830
27832
|
var compileSchema = require_compile();
|
|
27831
|
-
var
|
|
27833
|
+
var resolve13 = require_resolve();
|
|
27832
27834
|
var Cache = require_cache();
|
|
27833
27835
|
var SchemaObject = require_schema_obj();
|
|
27834
27836
|
var stableStringify = require_fast_json_stable_stringify();
|
|
@@ -27910,7 +27912,7 @@ var require_ajv = __commonJS({
|
|
|
27910
27912
|
var id2 = this._getId(schema);
|
|
27911
27913
|
if (id2 !== void 0 && typeof id2 != "string")
|
|
27912
27914
|
throw new Error("schema id must be string");
|
|
27913
|
-
key =
|
|
27915
|
+
key = resolve13.normalizeId(key || id2);
|
|
27914
27916
|
checkUnique(this, key);
|
|
27915
27917
|
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
|
|
27916
27918
|
return this;
|
|
@@ -27954,7 +27956,7 @@ var require_ajv = __commonJS({
|
|
|
27954
27956
|
}
|
|
27955
27957
|
}
|
|
27956
27958
|
function _getSchemaFragment(self2, ref) {
|
|
27957
|
-
var res =
|
|
27959
|
+
var res = resolve13.schema.call(self2, { schema: {} }, ref);
|
|
27958
27960
|
if (res) {
|
|
27959
27961
|
var schema = res.schema, root = res.root, baseId = res.baseId;
|
|
27960
27962
|
var v = compileSchema.call(self2, schema, root, void 0, baseId);
|
|
@@ -27970,7 +27972,7 @@ var require_ajv = __commonJS({
|
|
|
27970
27972
|
}
|
|
27971
27973
|
}
|
|
27972
27974
|
function _getSchemaObj(self2, keyRef) {
|
|
27973
|
-
keyRef =
|
|
27975
|
+
keyRef = resolve13.normalizeId(keyRef);
|
|
27974
27976
|
return self2._schemas[keyRef] || self2._refs[keyRef] || self2._fragments[keyRef];
|
|
27975
27977
|
}
|
|
27976
27978
|
function removeSchema(schemaKeyRef) {
|
|
@@ -27997,7 +27999,7 @@ var require_ajv = __commonJS({
|
|
|
27997
27999
|
this._cache.del(cacheKey);
|
|
27998
28000
|
var id2 = this._getId(schemaKeyRef);
|
|
27999
28001
|
if (id2) {
|
|
28000
|
-
id2 =
|
|
28002
|
+
id2 = resolve13.normalizeId(id2);
|
|
28001
28003
|
delete this._schemas[id2];
|
|
28002
28004
|
delete this._refs[id2];
|
|
28003
28005
|
}
|
|
@@ -28021,13 +28023,13 @@ var require_ajv = __commonJS({
|
|
|
28021
28023
|
var cached2 = this._cache.get(cacheKey);
|
|
28022
28024
|
if (cached2) return cached2;
|
|
28023
28025
|
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
|
|
28024
|
-
var id2 =
|
|
28026
|
+
var id2 = resolve13.normalizeId(this._getId(schema));
|
|
28025
28027
|
if (id2 && shouldAddSchema) checkUnique(this, id2);
|
|
28026
28028
|
var willValidate = this._opts.validateSchema !== false && !skipValidation;
|
|
28027
28029
|
var recursiveMeta;
|
|
28028
|
-
if (willValidate && !(recursiveMeta = id2 && id2 ==
|
|
28030
|
+
if (willValidate && !(recursiveMeta = id2 && id2 == resolve13.normalizeId(schema.$schema)))
|
|
28029
28031
|
this.validateSchema(schema, true);
|
|
28030
|
-
var localRefs =
|
|
28032
|
+
var localRefs = resolve13.ids.call(this, schema);
|
|
28031
28033
|
var schemaObj = new SchemaObject({
|
|
28032
28034
|
id: id2,
|
|
28033
28035
|
schema,
|
|
@@ -28611,7 +28613,7 @@ var init_codex_app_server = __esm({
|
|
|
28611
28613
|
};
|
|
28612
28614
|
};
|
|
28613
28615
|
killWindowsProcessTree = async (pid) => {
|
|
28614
|
-
await new Promise((
|
|
28616
|
+
await new Promise((resolve13, reject) => {
|
|
28615
28617
|
const child = spawn3(
|
|
28616
28618
|
"taskkill.exe",
|
|
28617
28619
|
["/PID", String(pid), "/T", "/F"],
|
|
@@ -28636,7 +28638,7 @@ var init_codex_app_server = __esm({
|
|
|
28636
28638
|
});
|
|
28637
28639
|
child.once("close", (code) => {
|
|
28638
28640
|
clearTimeout(timer);
|
|
28639
|
-
if (code === 0 || code === 128)
|
|
28641
|
+
if (code === 0 || code === 128) resolve13();
|
|
28640
28642
|
else reject(new Error("Windows Codex process-tree cleanup failed."));
|
|
28641
28643
|
});
|
|
28642
28644
|
});
|
|
@@ -28836,7 +28838,7 @@ child.once('close', async (code, signal) => {
|
|
|
28836
28838
|
const platform = options.platform ?? process.platform;
|
|
28837
28839
|
const renameFile = options.renameFile ?? rename2;
|
|
28838
28840
|
const removeFile = options.removeFile ?? ((path) => rm2(path, { force: true }));
|
|
28839
|
-
const sleep4 = options.sleep ?? ((milliseconds) => new Promise((
|
|
28841
|
+
const sleep4 = options.sleep ?? ((milliseconds) => new Promise((resolve13) => setTimeout(resolve13, milliseconds)));
|
|
28840
28842
|
const maxAttempts = Math.max(1, options.maxAttempts ?? 40);
|
|
28841
28843
|
const retryDelayMs = Math.max(0, options.retryDelayMs ?? 25);
|
|
28842
28844
|
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
@@ -28928,7 +28930,7 @@ child.once('close', async (code, signal) => {
|
|
|
28928
28930
|
throw new Error("Codex guardian terminated before app-server initialization.");
|
|
28929
28931
|
}
|
|
28930
28932
|
}
|
|
28931
|
-
await new Promise((
|
|
28933
|
+
await new Promise((resolve13) => setTimeout(resolve13, 25));
|
|
28932
28934
|
}
|
|
28933
28935
|
throw new Error(`Codex guardian ${expectedState} state was not confirmed.`);
|
|
28934
28936
|
};
|
|
@@ -29310,8 +29312,8 @@ child.once('close', async (code, signal) => {
|
|
|
29310
29312
|
dispatchOutcome: "not_dispatched"
|
|
29311
29313
|
});
|
|
29312
29314
|
}
|
|
29313
|
-
return await new Promise((
|
|
29314
|
-
const pending3 = { resolve:
|
|
29315
|
+
return await new Promise((resolve13, reject) => {
|
|
29316
|
+
const pending3 = { resolve: resolve13, reject, timer: null, abortCleanup: null };
|
|
29315
29317
|
pending3.timer = setTimeout(() => {
|
|
29316
29318
|
this.pending.delete(id2);
|
|
29317
29319
|
this.retireResponseId(id2, method);
|
|
@@ -29986,8 +29988,8 @@ child.once('close', async (code, signal) => {
|
|
|
29986
29988
|
const agentWebSearches = [];
|
|
29987
29989
|
let terminalResolve;
|
|
29988
29990
|
let terminalReject;
|
|
29989
|
-
const terminalPromise = new Promise((
|
|
29990
|
-
terminalResolve =
|
|
29991
|
+
const terminalPromise = new Promise((resolve13, reject) => {
|
|
29992
|
+
terminalResolve = resolve13;
|
|
29991
29993
|
terminalReject = reject;
|
|
29992
29994
|
});
|
|
29993
29995
|
void terminalPromise.catch(() => void 0);
|
|
@@ -30547,15 +30549,15 @@ child.once('close', async (code, signal) => {
|
|
|
30547
30549
|
).catch(() => void 0);
|
|
30548
30550
|
}
|
|
30549
30551
|
this.process.stdin.end();
|
|
30550
|
-
const exited = await new Promise((
|
|
30552
|
+
const exited = await new Promise((resolve13) => {
|
|
30551
30553
|
if (this.process.exitCode !== null) {
|
|
30552
|
-
|
|
30554
|
+
resolve13(true);
|
|
30553
30555
|
return;
|
|
30554
30556
|
}
|
|
30555
|
-
const timer = setTimeout(() =>
|
|
30557
|
+
const timer = setTimeout(() => resolve13(false), 5e3);
|
|
30556
30558
|
this.process.once("close", () => {
|
|
30557
30559
|
clearTimeout(timer);
|
|
30558
|
-
|
|
30560
|
+
resolve13(true);
|
|
30559
30561
|
});
|
|
30560
30562
|
});
|
|
30561
30563
|
if (exited) return;
|
|
@@ -30566,11 +30568,11 @@ child.once('close', async (code, signal) => {
|
|
|
30566
30568
|
else this.process.kill("SIGTERM");
|
|
30567
30569
|
} catch {
|
|
30568
30570
|
}
|
|
30569
|
-
const terminated = await new Promise((
|
|
30570
|
-
const timer = setTimeout(() =>
|
|
30571
|
+
const terminated = await new Promise((resolve13) => {
|
|
30572
|
+
const timer = setTimeout(() => resolve13(false), 1e3);
|
|
30571
30573
|
this.process.once("close", () => {
|
|
30572
30574
|
clearTimeout(timer);
|
|
30573
|
-
|
|
30575
|
+
resolve13(true);
|
|
30574
30576
|
});
|
|
30575
30577
|
});
|
|
30576
30578
|
if (!terminated) {
|
|
@@ -30580,15 +30582,15 @@ child.once('close', async (code, signal) => {
|
|
|
30580
30582
|
else this.process.kill("SIGKILL");
|
|
30581
30583
|
} catch {
|
|
30582
30584
|
}
|
|
30583
|
-
await new Promise((
|
|
30585
|
+
await new Promise((resolve13) => {
|
|
30584
30586
|
if (this.process.exitCode !== null) {
|
|
30585
|
-
|
|
30587
|
+
resolve13();
|
|
30586
30588
|
return;
|
|
30587
30589
|
}
|
|
30588
|
-
const timer = setTimeout(
|
|
30590
|
+
const timer = setTimeout(resolve13, 1e3);
|
|
30589
30591
|
this.process.once("close", () => {
|
|
30590
30592
|
clearTimeout(timer);
|
|
30591
|
-
|
|
30593
|
+
resolve13();
|
|
30592
30594
|
});
|
|
30593
30595
|
});
|
|
30594
30596
|
if (this.process.exitCode === null) {
|
|
@@ -31206,13 +31208,13 @@ var init_runner = __esm({
|
|
|
31206
31208
|
};
|
|
31207
31209
|
defaultSleep = async (milliseconds, signal) => {
|
|
31208
31210
|
if (signal?.aborted) throw abortError();
|
|
31209
|
-
await new Promise((
|
|
31211
|
+
await new Promise((resolve13, reject) => {
|
|
31210
31212
|
const finish = (callback) => {
|
|
31211
31213
|
signal?.removeEventListener("abort", onAbort);
|
|
31212
31214
|
callback();
|
|
31213
31215
|
};
|
|
31214
31216
|
const timer = setTimeout(
|
|
31215
|
-
() => finish(
|
|
31217
|
+
() => finish(resolve13),
|
|
31216
31218
|
Math.max(MIN_SLEEP_MS, milliseconds)
|
|
31217
31219
|
);
|
|
31218
31220
|
const onAbort = () => {
|
|
@@ -31238,9 +31240,9 @@ var init_runner = __esm({
|
|
|
31238
31240
|
let timer = null;
|
|
31239
31241
|
const settled = await Promise.race([
|
|
31240
31242
|
promise2.then(() => true, () => true),
|
|
31241
|
-
new Promise((
|
|
31243
|
+
new Promise((resolve13) => {
|
|
31242
31244
|
timer = setTimeout(
|
|
31243
|
-
() =>
|
|
31245
|
+
() => resolve13(false),
|
|
31244
31246
|
Math.max(MIN_SLEEP_MS, timeoutMs)
|
|
31245
31247
|
);
|
|
31246
31248
|
})
|
|
@@ -31815,8 +31817,8 @@ var init_runner = __esm({
|
|
|
31815
31817
|
};
|
|
31816
31818
|
let quiesceRequested = Boolean(this.options.quiesceSignal?.aborted);
|
|
31817
31819
|
let wakeQuiesce;
|
|
31818
|
-
const quiesceWake = new Promise((
|
|
31819
|
-
wakeQuiesce =
|
|
31820
|
+
const quiesceWake = new Promise((resolve13) => {
|
|
31821
|
+
wakeQuiesce = resolve13;
|
|
31820
31822
|
});
|
|
31821
31823
|
let drainRequested = false;
|
|
31822
31824
|
let drainReason = "stopped";
|
|
@@ -31839,8 +31841,8 @@ var init_runner = __esm({
|
|
|
31839
31841
|
let modelCatalogRefresh = null;
|
|
31840
31842
|
let providerRateLimitRefresh = null;
|
|
31841
31843
|
let wakeDrain;
|
|
31842
|
-
const drainSignal = new Promise((
|
|
31843
|
-
wakeDrain =
|
|
31844
|
+
const drainSignal = new Promise((resolve13) => {
|
|
31845
|
+
wakeDrain = resolve13;
|
|
31844
31846
|
});
|
|
31845
31847
|
const requestDrain = (reason) => {
|
|
31846
31848
|
const priority = (value) => {
|
|
@@ -31931,7 +31933,7 @@ var init_runner = __esm({
|
|
|
31931
31933
|
const metadata = await this.dependencies.discoverOAuth({
|
|
31932
31934
|
signal: this.options.signal
|
|
31933
31935
|
});
|
|
31934
|
-
let
|
|
31936
|
+
let access6 = null;
|
|
31935
31937
|
let accessExpiresAt = 0;
|
|
31936
31938
|
let refreshPromise = null;
|
|
31937
31939
|
const refreshAccessToken = async (requestOptions = {}) => {
|
|
@@ -31944,7 +31946,7 @@ var init_runner = __esm({
|
|
|
31944
31946
|
);
|
|
31945
31947
|
assertLocalCredentialIdentity(localState, refreshed.credential);
|
|
31946
31948
|
credential = refreshed.credential;
|
|
31947
|
-
|
|
31949
|
+
access6 = refreshed;
|
|
31948
31950
|
accessExpiresAt = now() + refreshed.expiresIn * 1e3;
|
|
31949
31951
|
return refreshed.accessToken;
|
|
31950
31952
|
})();
|
|
@@ -31957,10 +31959,10 @@ var init_runner = __esm({
|
|
|
31957
31959
|
await refreshAccessToken({ signal: this.options.signal });
|
|
31958
31960
|
const tokenSource = {
|
|
31959
31961
|
accessToken: async (requestOptions) => {
|
|
31960
|
-
if (!
|
|
31962
|
+
if (!access6 || accessExpiresAt - now() <= 5e3) {
|
|
31961
31963
|
return refreshAccessToken(requestOptions);
|
|
31962
31964
|
}
|
|
31963
|
-
return
|
|
31965
|
+
return access6.accessToken;
|
|
31964
31966
|
},
|
|
31965
31967
|
refreshAccessToken
|
|
31966
31968
|
};
|
|
@@ -32215,8 +32217,8 @@ var init_runner = __esm({
|
|
|
32215
32217
|
receipt = result2;
|
|
32216
32218
|
const revision = receiptRevision + 1;
|
|
32217
32219
|
receiptRevision = revision;
|
|
32218
|
-
const durable = new Promise((
|
|
32219
|
-
receiptDurabilityWaiters.push({ revision, resolve:
|
|
32220
|
+
const durable = new Promise((resolve13, reject) => {
|
|
32221
|
+
receiptDurabilityWaiters.push({ revision, resolve: resolve13, reject });
|
|
32220
32222
|
});
|
|
32221
32223
|
scheduleReceiptWriter();
|
|
32222
32224
|
await durable;
|
|
@@ -32332,8 +32334,8 @@ var init_runner = __esm({
|
|
|
32332
32334
|
const tool = receipt.registered ? "inference.host.advertise" : "inference.host.register";
|
|
32333
32335
|
let result2;
|
|
32334
32336
|
let releaseAdvertisementHandoff;
|
|
32335
|
-
const currentAdvertisementHandoff = new Promise((
|
|
32336
|
-
releaseAdvertisementHandoff =
|
|
32337
|
+
const currentAdvertisementHandoff = new Promise((resolve13) => {
|
|
32338
|
+
releaseAdvertisementHandoff = resolve13;
|
|
32337
32339
|
});
|
|
32338
32340
|
advertisementHandoff = currentAdvertisementHandoff;
|
|
32339
32341
|
try {
|
|
@@ -33550,8 +33552,8 @@ var init_runner = __esm({
|
|
|
33550
33552
|
let providerDispatchWatchdog = null;
|
|
33551
33553
|
let providerDispatchWatchdogExpired = false;
|
|
33552
33554
|
let resolveProviderDispatchWatchdog;
|
|
33553
|
-
const providerDispatchWatchdogSignal = new Promise((
|
|
33554
|
-
resolveProviderDispatchWatchdog =
|
|
33555
|
+
const providerDispatchWatchdogSignal = new Promise((resolve13) => {
|
|
33556
|
+
resolveProviderDispatchWatchdog = resolve13;
|
|
33555
33557
|
});
|
|
33556
33558
|
const clearProviderDispatchWatchdog = () => {
|
|
33557
33559
|
if (providerDispatchWatchdog !== null) clearTimeout(providerDispatchWatchdog);
|
|
@@ -33988,8 +33990,8 @@ var init_runner = __esm({
|
|
|
33988
33990
|
});
|
|
33989
33991
|
}
|
|
33990
33992
|
let resolveTerminalDispatchOutcome;
|
|
33991
|
-
const terminalDispatchOutcomeSignal = new Promise((
|
|
33992
|
-
resolveTerminalDispatchOutcome =
|
|
33993
|
+
const terminalDispatchOutcomeSignal = new Promise((resolve13) => {
|
|
33994
|
+
resolveTerminalDispatchOutcome = resolve13;
|
|
33993
33995
|
});
|
|
33994
33996
|
let terminalDispatchOutcomeObserved = false;
|
|
33995
33997
|
const adapterAttempt = this.dependencies.codexAdapter.runAttempt({
|
|
@@ -35293,7 +35295,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35293
35295
|
throw new Error("Host reauthorization was rejected; the previous host identity was preserved.");
|
|
35294
35296
|
}
|
|
35295
35297
|
let candidate = await store.readRecovery();
|
|
35296
|
-
let
|
|
35298
|
+
let access6 = options.authorizedAccess ?? null;
|
|
35297
35299
|
if (!candidate) {
|
|
35298
35300
|
if (transition) {
|
|
35299
35301
|
if (!transition.remote_committed || options.state.client_id !== transition.client_id) {
|
|
@@ -35319,7 +35321,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35319
35321
|
});
|
|
35320
35322
|
options.emitAuthorization(pending3.authorizationUrl);
|
|
35321
35323
|
try {
|
|
35322
|
-
|
|
35324
|
+
access6 = await pending3.completion;
|
|
35323
35325
|
} catch (error48) {
|
|
35324
35326
|
await pending3.cancel().catch(() => void 0);
|
|
35325
35327
|
throw error48;
|
|
@@ -35368,7 +35370,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35368
35370
|
return runStopped(() => reauthorizeInferenceHost({
|
|
35369
35371
|
...options,
|
|
35370
35372
|
withStoppedHost: void 0,
|
|
35371
|
-
authorizedAccess:
|
|
35373
|
+
authorizedAccess: access6 ?? void 0
|
|
35372
35374
|
}));
|
|
35373
35375
|
}
|
|
35374
35376
|
if (transition.service_prepare_pending) {
|
|
@@ -35377,8 +35379,8 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35377
35379
|
await save();
|
|
35378
35380
|
}
|
|
35379
35381
|
if (!transition.remote_committed) {
|
|
35380
|
-
if (!
|
|
35381
|
-
|
|
35382
|
+
if (!access6) {
|
|
35383
|
+
access6 = await refreshInferenceCredential({
|
|
35382
35384
|
metadata: await discoverInferenceOAuth(config2.apiUrl),
|
|
35383
35385
|
credential: candidate.credential,
|
|
35384
35386
|
store: stagedStore
|
|
@@ -35396,7 +35398,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35396
35398
|
});
|
|
35397
35399
|
let result2;
|
|
35398
35400
|
try {
|
|
35399
|
-
result2 = await register(
|
|
35401
|
+
result2 = await register(access6, transition.advertisement);
|
|
35400
35402
|
} catch (error48) {
|
|
35401
35403
|
if (error48 instanceof ExternalInferenceMcpError && error48.code === "tool_rejected" && !error48.retryable && !error48.definitivelyNotApplied) {
|
|
35402
35404
|
transition.remote_rejected = true;
|
|
@@ -35407,7 +35409,7 @@ async function reauthorizeInferenceHost(options) {
|
|
|
35407
35409
|
if (!(error48 instanceof ExternalInferenceMcpError) || !error48.definitivelyNotApplied) throw error48;
|
|
35408
35410
|
transition.advertisement = freshAdvertisement();
|
|
35409
35411
|
await save();
|
|
35410
|
-
result2 = await register(
|
|
35412
|
+
result2 = await register(access6, transition.advertisement);
|
|
35411
35413
|
}
|
|
35412
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) {
|
|
35413
35415
|
throw new Error("Inference host reauthorization returned a different host identity.");
|
|
@@ -35489,7 +35491,7 @@ async function createInferenceAgentMcpSession(options) {
|
|
|
35489
35491
|
options.fetchImpl,
|
|
35490
35492
|
{ signal: options.signal, timeoutMs: options.requestTimeoutMs }
|
|
35491
35493
|
);
|
|
35492
|
-
let
|
|
35494
|
+
let access6 = null;
|
|
35493
35495
|
let accessExpiresAt = 0;
|
|
35494
35496
|
let refreshPromise = null;
|
|
35495
35497
|
const refreshAccessToken = async (requestOptions = {}) => {
|
|
@@ -35506,7 +35508,7 @@ async function createInferenceAgentMcpSession(options) {
|
|
|
35506
35508
|
});
|
|
35507
35509
|
assertCredentialMatchesState(localState, refreshed.credential);
|
|
35508
35510
|
credential = refreshed.credential;
|
|
35509
|
-
|
|
35511
|
+
access6 = refreshed;
|
|
35510
35512
|
accessExpiresAt = Date.now() + refreshed.expiresIn * 1e3;
|
|
35511
35513
|
return refreshed.accessToken;
|
|
35512
35514
|
})();
|
|
@@ -35519,10 +35521,10 @@ async function createInferenceAgentMcpSession(options) {
|
|
|
35519
35521
|
await refreshAccessToken({ signal: options.signal });
|
|
35520
35522
|
const tokenSource = {
|
|
35521
35523
|
accessToken: async (requestOptions) => {
|
|
35522
|
-
if (!
|
|
35524
|
+
if (!access6 || accessExpiresAt - Date.now() <= 5e3) {
|
|
35523
35525
|
return refreshAccessToken(requestOptions);
|
|
35524
35526
|
}
|
|
35525
|
-
return
|
|
35527
|
+
return access6.accessToken;
|
|
35526
35528
|
},
|
|
35527
35529
|
refreshAccessToken
|
|
35528
35530
|
};
|
|
@@ -35610,7 +35612,7 @@ var init_codex_binary = __esm({
|
|
|
35610
35612
|
spec.binaryName
|
|
35611
35613
|
);
|
|
35612
35614
|
};
|
|
35613
|
-
readCodexVersion = async (binaryPath) => await new Promise((
|
|
35615
|
+
readCodexVersion = async (binaryPath) => await new Promise((resolve13, reject) => {
|
|
35614
35616
|
const child = spawn4(binaryPath, ["--version"], {
|
|
35615
35617
|
stdio: ["ignore", "pipe", "pipe"],
|
|
35616
35618
|
windowsHide: true,
|
|
@@ -35648,7 +35650,7 @@ var init_codex_binary = __esm({
|
|
|
35648
35650
|
reject(new Error("Codex version probe failed."));
|
|
35649
35651
|
return;
|
|
35650
35652
|
}
|
|
35651
|
-
|
|
35653
|
+
resolve13(stdout.trim());
|
|
35652
35654
|
});
|
|
35653
35655
|
});
|
|
35654
35656
|
verifyPinnedCodexBinary = async (candidatePath, dependencies = {}) => {
|
|
@@ -36557,7 +36559,7 @@ var init_codex_adapter = __esm({
|
|
|
36557
36559
|
durableSession.session.requireModelCapability(capabilities, modelName, reasoningEffort);
|
|
36558
36560
|
}
|
|
36559
36561
|
async waitForCapabilities(preflight, deadlineAtMs, signal) {
|
|
36560
|
-
return await new Promise((
|
|
36562
|
+
return await new Promise((resolve13, reject) => {
|
|
36561
36563
|
let settled = false;
|
|
36562
36564
|
const finish = (callback) => {
|
|
36563
36565
|
if (settled) return;
|
|
@@ -36584,7 +36586,7 @@ var init_codex_adapter = __esm({
|
|
|
36584
36586
|
return;
|
|
36585
36587
|
}
|
|
36586
36588
|
void preflight.then(
|
|
36587
|
-
(value) => finish(() =>
|
|
36589
|
+
(value) => finish(() => resolve13(value)),
|
|
36588
36590
|
(error48) => finish(() => reject(error48))
|
|
36589
36591
|
);
|
|
36590
36592
|
});
|
|
@@ -38210,9 +38212,9 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
38210
38212
|
response.end();
|
|
38211
38213
|
}
|
|
38212
38214
|
});
|
|
38213
|
-
await new Promise((
|
|
38215
|
+
await new Promise((resolve13, reject) => {
|
|
38214
38216
|
this.server.once("error", reject);
|
|
38215
|
-
this.server.listen(0, "127.0.0.1", () =>
|
|
38217
|
+
this.server.listen(0, "127.0.0.1", () => resolve13());
|
|
38216
38218
|
});
|
|
38217
38219
|
const address = this.server.address();
|
|
38218
38220
|
if (!address || typeof address === "string") throw new Error("deepseek_proxy_bind_failed");
|
|
@@ -38224,7 +38226,7 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
38224
38226
|
this.server = null;
|
|
38225
38227
|
this.urlValue = null;
|
|
38226
38228
|
if (!server) return;
|
|
38227
|
-
await new Promise((
|
|
38229
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
38228
38230
|
}
|
|
38229
38231
|
};
|
|
38230
38232
|
}
|
|
@@ -38762,11 +38764,11 @@ ${JSON.stringify(input.outputSchema)}`,
|
|
|
38762
38764
|
boundary.signal.throwIfAborted();
|
|
38763
38765
|
let checkpointReached = false;
|
|
38764
38766
|
let resolveCheckpoint;
|
|
38765
|
-
const checkpoint = new Promise((
|
|
38766
|
-
resolveCheckpoint =
|
|
38767
|
+
const checkpoint = new Promise((resolve13) => {
|
|
38768
|
+
resolveCheckpoint = resolve13;
|
|
38767
38769
|
});
|
|
38768
|
-
const dispatchGate = new Promise((
|
|
38769
|
-
releaseAgentDispatch =
|
|
38770
|
+
const dispatchGate = new Promise((resolve13) => {
|
|
38771
|
+
releaseAgentDispatch = resolve13;
|
|
38770
38772
|
});
|
|
38771
38773
|
ctx.on("llm/stream", (options, next) => {
|
|
38772
38774
|
if (String(options.sessionId ?? "") !== String(sessionId)) return next();
|
|
@@ -39647,7 +39649,7 @@ var init_grok_binary = __esm({
|
|
|
39647
39649
|
decompress = promisify(brotliDecompress);
|
|
39648
39650
|
pending = /* @__PURE__ */ new Map();
|
|
39649
39651
|
digest = (bytes3) => createHash7("sha256").update(bytes3).digest("hex");
|
|
39650
|
-
verifyVersion = async (path) => new Promise((
|
|
39652
|
+
verifyVersion = async (path) => new Promise((resolve13, reject) => {
|
|
39651
39653
|
const child = spawn6(path, ["--version"], {
|
|
39652
39654
|
stdio: ["ignore", "pipe", "ignore"],
|
|
39653
39655
|
windowsHide: true,
|
|
@@ -39674,7 +39676,7 @@ var init_grok_binary = __esm({
|
|
|
39674
39676
|
clearTimeout(timer);
|
|
39675
39677
|
if (code !== 0 || /^grok\s+(\S+)/u.exec(stdout.trim())?.[1] !== agent_cli_release_default.grok_version) {
|
|
39676
39678
|
reject(new Error("Grok runtime version does not match its release."));
|
|
39677
|
-
} else
|
|
39679
|
+
} else resolve13();
|
|
39678
39680
|
});
|
|
39679
39681
|
});
|
|
39680
39682
|
resolvePinnedGrokBinary = async (stateRoot) => {
|
|
@@ -39894,9 +39896,9 @@ var init_grok_transport_proxy = __esm({
|
|
|
39894
39896
|
this.server = createServer3((request, response) => {
|
|
39895
39897
|
void this.handle(request, response);
|
|
39896
39898
|
});
|
|
39897
|
-
await new Promise((
|
|
39899
|
+
await new Promise((resolve13, reject) => {
|
|
39898
39900
|
this.server.once("error", reject);
|
|
39899
|
-
this.server.listen(0, "127.0.0.1", () =>
|
|
39901
|
+
this.server.listen(0, "127.0.0.1", () => resolve13());
|
|
39900
39902
|
});
|
|
39901
39903
|
const address = this.server.address();
|
|
39902
39904
|
if (!address || typeof address === "string") throw new Error("grok_proxy_bind_failed");
|
|
@@ -40272,7 +40274,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
40272
40274
|
this.urlValue = null;
|
|
40273
40275
|
if (!server) return;
|
|
40274
40276
|
server.closeAllConnections();
|
|
40275
|
-
await new Promise((
|
|
40277
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
40276
40278
|
}
|
|
40277
40279
|
};
|
|
40278
40280
|
createGrokTransportProxy = async (options) => {
|
|
@@ -40453,11 +40455,11 @@ var init_grok_runtime = __esm({
|
|
|
40453
40455
|
this.child.kill();
|
|
40454
40456
|
}
|
|
40455
40457
|
});
|
|
40456
|
-
this.exit = new Promise((
|
|
40458
|
+
this.exit = new Promise((resolve13) => {
|
|
40457
40459
|
this.child.once("error", () => this.fail(new Error("grok_process_start_failed")));
|
|
40458
40460
|
this.child.once("close", () => {
|
|
40459
40461
|
this.fail(new Error("grok_process_closed"));
|
|
40460
|
-
|
|
40462
|
+
resolve13();
|
|
40461
40463
|
});
|
|
40462
40464
|
});
|
|
40463
40465
|
}
|
|
@@ -40477,8 +40479,8 @@ var init_grok_runtime = __esm({
|
|
|
40477
40479
|
let timer;
|
|
40478
40480
|
let abort;
|
|
40479
40481
|
try {
|
|
40480
|
-
return await new Promise((
|
|
40481
|
-
this.pending.set(id2, { resolve:
|
|
40482
|
+
return await new Promise((resolve13, reject) => {
|
|
40483
|
+
this.pending.set(id2, { resolve: resolve13, reject });
|
|
40482
40484
|
timer = setTimeout(() => reject(new Error("grok_deadline_exceeded")), Math.max(1, deadlineAtMs - Date.now()));
|
|
40483
40485
|
abort = () => reject(new Error("grok_cancelled"));
|
|
40484
40486
|
signal?.addEventListener("abort", abort, { once: true });
|
|
@@ -40552,9 +40554,9 @@ var init_grok_runtime = __esm({
|
|
|
40552
40554
|
response.writeHead(400).end();
|
|
40553
40555
|
}
|
|
40554
40556
|
});
|
|
40555
|
-
await new Promise((
|
|
40557
|
+
await new Promise((resolve13, reject) => {
|
|
40556
40558
|
server.once("error", reject);
|
|
40557
|
-
server.listen(0, "127.0.0.1",
|
|
40559
|
+
server.listen(0, "127.0.0.1", resolve13);
|
|
40558
40560
|
});
|
|
40559
40561
|
const address = server.address();
|
|
40560
40562
|
if (!address || typeof address === "string") throw new Error("grok_mcp_listen_failed");
|
|
@@ -40565,7 +40567,7 @@ var init_grok_runtime = __esm({
|
|
|
40565
40567
|
descriptor: { type: "http", name: "vtx", url: `http://127.0.0.1:${address.port}/${token}`, headers: [] },
|
|
40566
40568
|
close: async () => {
|
|
40567
40569
|
server.closeAllConnections();
|
|
40568
|
-
await new Promise((
|
|
40570
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
40569
40571
|
}
|
|
40570
40572
|
};
|
|
40571
40573
|
};
|
|
@@ -41291,7 +41293,7 @@ var init_grok_auth = __esm({
|
|
|
41291
41293
|
await prepareGrokHome(options.grokHome);
|
|
41292
41294
|
const binary = await resolvePinnedGrokBinary(options.stateRoot);
|
|
41293
41295
|
options.signal?.throwIfAborted();
|
|
41294
|
-
await new Promise((
|
|
41296
|
+
await new Promise((resolve13, reject) => {
|
|
41295
41297
|
const child = spawn8(binary.path, ["--no-auto-update", action, ...action === "login" ? ["--device-auth"] : []], {
|
|
41296
41298
|
cwd: options.grokHome,
|
|
41297
41299
|
env: grokRuntimeEnvironment(options.grokHome),
|
|
@@ -41353,7 +41355,7 @@ var init_grok_auth = __esm({
|
|
|
41353
41355
|
child.once("close", (code) => {
|
|
41354
41356
|
cleanup();
|
|
41355
41357
|
if (code !== 0 || failed || options.signal?.aborted) reject(new Error(`Grok ${action} did not complete. Run grok-${action} again.`));
|
|
41356
|
-
else
|
|
41358
|
+
else resolve13();
|
|
41357
41359
|
});
|
|
41358
41360
|
if (options.signal?.aborted) stop();
|
|
41359
41361
|
});
|
|
@@ -42361,6 +42363,74 @@ var init_durable_adapter = __esm({
|
|
|
42361
42363
|
}
|
|
42362
42364
|
});
|
|
42363
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
|
+
|
|
42364
42434
|
// lib/runtime-policy.generated.json with { type: 'json' }
|
|
42365
42435
|
var runtime_policy_generated_default2;
|
|
42366
42436
|
var init_runtime_policy_generated2 = __esm({
|
|
@@ -42456,6 +42526,8 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
42456
42526
|
service: {
|
|
42457
42527
|
update_check_interval_ms: 3e5,
|
|
42458
42528
|
update_registry_timeout_ms: 15e3,
|
|
42529
|
+
bootstrap_readiness_timeout_ms: 6e5,
|
|
42530
|
+
bootstrap_stop_timeout_ms: 1e4,
|
|
42459
42531
|
startup_max_attempts: 40,
|
|
42460
42532
|
startup_poll_interval_ms: 250,
|
|
42461
42533
|
restart_stable_uptime_ms: 6e4,
|
|
@@ -42544,16 +42616,17 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
42544
42616
|
import { spawn as spawn10 } from "node:child_process";
|
|
42545
42617
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
42546
42618
|
import { createWriteStream, readFileSync as readFileSync2 } from "node:fs";
|
|
42547
|
-
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";
|
|
42548
42620
|
import { homedir as homedir2 } from "node:os";
|
|
42549
|
-
import { dirname as
|
|
42550
|
-
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;
|
|
42551
42623
|
var init_service = __esm({
|
|
42552
42624
|
"lib/inference-host/service.ts"() {
|
|
42553
42625
|
"use strict";
|
|
42554
42626
|
init_define_VTX_EXO_POLICY();
|
|
42555
42627
|
init_define_VTX_GROK_POLICY();
|
|
42556
42628
|
init_define_VTX_PI_MODEL_POLICY();
|
|
42629
|
+
init_service_launcher_state();
|
|
42557
42630
|
init_agent_cli_release();
|
|
42558
42631
|
init_runtime_policy_generated2();
|
|
42559
42632
|
init_durable_adapter();
|
|
@@ -42619,6 +42692,18 @@ var init_service = __esm({
|
|
|
42619
42692
|
stderr: Buffer.concat(stderr).toString("utf8")
|
|
42620
42693
|
}));
|
|
42621
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
|
+
};
|
|
42622
42707
|
managerName = (platform) => {
|
|
42623
42708
|
if (platform === "win32") return "windows-task-scheduler";
|
|
42624
42709
|
if (platform === "darwin") return "launch-agent";
|
|
@@ -42959,10 +43044,10 @@ WantedBy=default.target
|
|
|
42959
43044
|
this.config = config2;
|
|
42960
43045
|
this.platform = dependencies.platform ?? process.platform;
|
|
42961
43046
|
this.home = dependencies.homedir ?? homedir2();
|
|
42962
|
-
this.executable =
|
|
42963
|
-
this.script =
|
|
42964
|
-
this.bootstrapScript =
|
|
42965
|
-
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")
|
|
42966
43051
|
);
|
|
42967
43052
|
this.username = dependencies.username ?? ([process.env.USERDOMAIN, process.env.USERNAME].filter(Boolean).join("\\") || process.env.USER || "");
|
|
42968
43053
|
this.windowsDirectory = (dependencies.windowsDirectory ?? process.env.SystemRoot ?? process.env.WINDIR ?? "C:\\Windows").replace(/[\\/]+$/u, "");
|
|
@@ -43048,16 +43133,16 @@ WantedBy=default.target
|
|
|
43048
43133
|
}
|
|
43049
43134
|
definitionPath() {
|
|
43050
43135
|
if (this.platform === "win32") return `${this.config.supervisorStatePath}.service-task.xml`;
|
|
43051
|
-
if (this.platform === "darwin") return
|
|
43052
|
-
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);
|
|
43053
43138
|
}
|
|
43054
43139
|
windowsLauncherPath() {
|
|
43055
43140
|
return `${this.config.supervisorStatePath}.service-launcher.vbs`;
|
|
43056
43141
|
}
|
|
43057
43142
|
async hasBootstrapDefinition() {
|
|
43058
43143
|
try {
|
|
43059
|
-
await
|
|
43060
|
-
const definition = await
|
|
43144
|
+
await access5(this.serviceBootstrapPath());
|
|
43145
|
+
const definition = await readFile10(
|
|
43061
43146
|
this.platform === "win32" ? this.windowsLauncherPath() : this.definitionPath(),
|
|
43062
43147
|
"utf8"
|
|
43063
43148
|
);
|
|
@@ -43187,24 +43272,36 @@ ${result2.stderr}`)) {
|
|
|
43187
43272
|
);
|
|
43188
43273
|
}
|
|
43189
43274
|
async registerManifestUnlocked(manifest, desiredRunning, targetInstanceName) {
|
|
43190
|
-
await
|
|
43275
|
+
await access5(this.bootstrapScript);
|
|
43191
43276
|
const args = serviceBootstrapArguments(
|
|
43192
43277
|
this.serviceBootstrapPath(),
|
|
43193
43278
|
this.manifestPath(),
|
|
43194
43279
|
this.serviceBootstrapLockPath()
|
|
43195
43280
|
);
|
|
43196
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());
|
|
43197
43283
|
let managerInstallAttempted = false;
|
|
43198
43284
|
try {
|
|
43199
43285
|
await writeAtomicInferencePrivateFile(this.manifestPath(), `${JSON.stringify(manifest, null, 2)}
|
|
43200
43286
|
`);
|
|
43201
43287
|
await writeDesired(this.desiredPath(), desiredRunning, this.now());
|
|
43202
|
-
await
|
|
43203
|
-
|
|
43204
|
-
await
|
|
43205
|
-
|
|
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);
|
|
43206
43303
|
await chmod3(this.serviceBootstrapPath(), 448);
|
|
43207
|
-
await mkdir3(
|
|
43304
|
+
await mkdir3(dirname13(this.definitionPath()), { recursive: true, mode: 448 });
|
|
43208
43305
|
if (this.platform === "win32") {
|
|
43209
43306
|
await writeAtomicInferencePrivateFile(
|
|
43210
43307
|
this.windowsLauncherPath(),
|
|
@@ -43257,14 +43354,17 @@ ${cleanup.stderr}`)) {
|
|
|
43257
43354
|
);
|
|
43258
43355
|
}
|
|
43259
43356
|
}
|
|
43260
|
-
await
|
|
43357
|
+
await rm11(this.definitionPath(), { force: true }).catch(() => void 0);
|
|
43261
43358
|
if (this.platform === "win32") {
|
|
43262
|
-
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);
|
|
43263
43367
|
}
|
|
43264
|
-
await rm10(this.manifestPath(), { force: true }).catch(() => void 0);
|
|
43265
|
-
await rm10(this.desiredPath(), { force: true }).catch(() => void 0);
|
|
43266
|
-
await rm10(this.runtimePath(), { force: true }).catch(() => void 0);
|
|
43267
|
-
await rm10(this.serviceBootstrapPath(), { force: true }).catch(() => void 0);
|
|
43268
43368
|
if (this.platform === "linux") {
|
|
43269
43369
|
await this.runCommand("systemctl", ["--user", "daemon-reload"]).catch(() => void 0);
|
|
43270
43370
|
}
|
|
@@ -43324,7 +43424,7 @@ ${cleanup.stderr}`)) {
|
|
|
43324
43424
|
}
|
|
43325
43425
|
if (previous) {
|
|
43326
43426
|
try {
|
|
43327
|
-
await this.uninstallUnlocked();
|
|
43427
|
+
await this.uninstallUnlocked(true);
|
|
43328
43428
|
} catch (error48) {
|
|
43329
43429
|
throw new Error(
|
|
43330
43430
|
"Inference-host service reconfiguration could not stop the previous supervisor; its desired state was restored.",
|
|
@@ -43390,15 +43490,15 @@ ${cleanup.stderr}`)) {
|
|
|
43390
43490
|
}
|
|
43391
43491
|
if (this.config.credentialFilePath && otherWorkers.some((worker) => {
|
|
43392
43492
|
const otherPath = worker.runtime_environment.VTX_INFERENCE_HOST_CREDENTIAL_FILE;
|
|
43393
|
-
return otherPath &&
|
|
43493
|
+
return otherPath && resolve11(otherPath) === resolve11(this.config.credentialFilePath);
|
|
43394
43494
|
})) {
|
|
43395
43495
|
throw new Error(
|
|
43396
43496
|
"Each inference-host instance must use a different private credential file."
|
|
43397
43497
|
);
|
|
43398
43498
|
}
|
|
43399
|
-
await
|
|
43400
|
-
await
|
|
43401
|
-
await
|
|
43499
|
+
await access5(this.executable);
|
|
43500
|
+
await access5(this.script);
|
|
43501
|
+
await access5(this.bootstrapScript);
|
|
43402
43502
|
const maxConcurrency = options.maxConcurrency ?? null;
|
|
43403
43503
|
const workers = [
|
|
43404
43504
|
...existing?.workers.filter((worker) => worker.instance_name !== this.config.instanceName) ?? [],
|
|
@@ -43608,7 +43708,7 @@ ${result2.stderr}`)) {
|
|
|
43608
43708
|
const manifest = await readInferenceHostServiceManifest(this.manifestPath());
|
|
43609
43709
|
const path = manifest?.log_path ?? this.logPath();
|
|
43610
43710
|
try {
|
|
43611
|
-
const contents = await
|
|
43711
|
+
const contents = await readFile10(path, "utf8");
|
|
43612
43712
|
const logLines = contents.trimEnd().split(/\r?\n/u);
|
|
43613
43713
|
const filtered = instanceName ? logLines.filter((line) => {
|
|
43614
43714
|
try {
|
|
@@ -43647,7 +43747,7 @@ ${result2.stderr}`)) {
|
|
|
43647
43747
|
async uninstall() {
|
|
43648
43748
|
return await this.withControlLock(async () => await this.uninstallUnlocked());
|
|
43649
43749
|
}
|
|
43650
|
-
async uninstallUnlocked() {
|
|
43750
|
+
async uninstallUnlocked(preserveRecovery = false) {
|
|
43651
43751
|
const manifest = await readInferenceHostServiceManifest(this.manifestPath());
|
|
43652
43752
|
if (!manifest) throw new Error("Inference-host service is not installed.");
|
|
43653
43753
|
const current = await this.status();
|
|
@@ -43661,16 +43761,21 @@ ${result2.stderr}`)) {
|
|
|
43661
43761
|
${result2.stderr}`)) {
|
|
43662
43762
|
throw new Error(`Background service uninstall failed: ${result2.stderr.trim()}`);
|
|
43663
43763
|
}
|
|
43664
|
-
await
|
|
43665
|
-
if (this.platform === "win32") await
|
|
43764
|
+
await rm11(this.definitionPath(), { force: true });
|
|
43765
|
+
if (this.platform === "win32") await rm11(this.windowsLauncherPath(), { force: true });
|
|
43666
43766
|
if (this.platform === "linux") await this.runCommand("systemctl", ["--user", "daemon-reload"]);
|
|
43667
|
-
await
|
|
43668
|
-
await
|
|
43669
|
-
await
|
|
43670
|
-
|
|
43671
|
-
|
|
43672
|
-
|
|
43673
|
-
|
|
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
|
+
}
|
|
43674
43779
|
return {
|
|
43675
43780
|
installed: false,
|
|
43676
43781
|
desired_running: false,
|
|
@@ -43684,7 +43789,7 @@ ${result2.stderr}`)) {
|
|
|
43684
43789
|
}
|
|
43685
43790
|
};
|
|
43686
43791
|
appendServiceLog = async (path, event, fields = {}) => {
|
|
43687
|
-
await mkdir3(
|
|
43792
|
+
await mkdir3(dirname13(path), { recursive: true, mode: 448 });
|
|
43688
43793
|
const stream = createWriteStream(path, { flags: "a", mode: 384 });
|
|
43689
43794
|
await new Promise((resolvePromise, reject) => {
|
|
43690
43795
|
stream.once("error", reject);
|
|
@@ -43813,7 +43918,7 @@ ${result2.stderr}`)) {
|
|
|
43813
43918
|
runInferenceHostServiceSupervisor = async (manifestPath, options = {}) => {
|
|
43814
43919
|
const storedInitialManifest = await readInferenceHostServiceManifest(manifestPath);
|
|
43815
43920
|
if (!storedInitialManifest) throw new Error("Inference-host service manifest is missing.");
|
|
43816
|
-
const serviceScript = options.serviceScript ?
|
|
43921
|
+
const serviceScript = options.serviceScript ? resolve11(options.serviceScript) : null;
|
|
43817
43922
|
const withServiceScript = (manifest) => serviceScript ? { ...manifest, script: serviceScript } : manifest;
|
|
43818
43923
|
const initialManifest = withServiceScript(storedInitialManifest);
|
|
43819
43924
|
const desiredPath = manifestPath.replace(/\.service\.json$/u, ".service-desired.json");
|
|
@@ -43823,6 +43928,21 @@ ${result2.stderr}`)) {
|
|
|
43823
43928
|
const quiesceSignal = options.quiesceSignal ? AbortSignal.any([options.quiesceSignal, migrationQuiesce.signal]) : migrationQuiesce.signal;
|
|
43824
43929
|
let bootstrapRestartRequired = false;
|
|
43825
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
|
+
}
|
|
43826
43946
|
const migrateSelectedBootstrap = async () => {
|
|
43827
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;
|
|
43828
43948
|
let controlLock;
|
|
@@ -43835,16 +43955,25 @@ ${result2.stderr}`)) {
|
|
|
43835
43955
|
try {
|
|
43836
43956
|
const current = await readManifestAcrossAtomicReplacement(manifestPath);
|
|
43837
43957
|
if (!current || current.generation !== appliedManifest.generation || !await readDesiredAcrossAtomicReplacement(desiredPath) || signal.aborted) return;
|
|
43838
|
-
|
|
43839
|
-
|
|
43840
|
-
|
|
43841
|
-
|
|
43842
|
-
|
|
43843
|
-
|
|
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);
|
|
43844
43976
|
}
|
|
43845
|
-
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;
|
|
43846
|
-
const bytes3 = await readFile9(join13(dirname12(serviceScript), "vtx-service-bootstrap.js"), "utf8");
|
|
43847
|
-
await writeAtomicInferencePrivateFile(manifestPath.replace(/\.service\.json$/u, ".service-bootstrap.js"), bytes3);
|
|
43848
43977
|
bootstrapRestartRequired = true;
|
|
43849
43978
|
migrationQuiesce.abort();
|
|
43850
43979
|
} finally {
|
|
@@ -44110,9 +44239,9 @@ __export(cli_exports, {
|
|
|
44110
44239
|
});
|
|
44111
44240
|
import { createHash as createHash12, randomUUID as randomUUID10 } from "node:crypto";
|
|
44112
44241
|
import { spawn as spawn11 } from "node:child_process";
|
|
44113
|
-
import { lstat as lstat9, realpath as realpath8, rm as
|
|
44242
|
+
import { lstat as lstat9, realpath as realpath8, rm as rm12 } from "node:fs/promises";
|
|
44114
44243
|
import { hostname as osHostname } from "node:os";
|
|
44115
|
-
import { join as
|
|
44244
|
+
import { join as join15, resolve as resolve12 } from "node:path";
|
|
44116
44245
|
async function runInferenceHostCli(argv2, env = process.env, dependencies = {}) {
|
|
44117
44246
|
const warnings = [];
|
|
44118
44247
|
try {
|
|
@@ -44500,7 +44629,7 @@ Durable service:
|
|
|
44500
44629
|
if (!raw?.trim()) throw new Error(`${argument} requires a value.`);
|
|
44501
44630
|
if (argument === "--adapter") adapter = raw.trim();
|
|
44502
44631
|
if (argument === "--provider") providerId = raw.trim();
|
|
44503
|
-
if (argument === "--exo-root") exoRoot =
|
|
44632
|
+
if (argument === "--exo-root") exoRoot = resolve12(raw.trim());
|
|
44504
44633
|
if (argument === "--model") modelId = raw.trim();
|
|
44505
44634
|
if (argument === "--model-label") modelLabel = raw.trim();
|
|
44506
44635
|
if (argument === "--effort") reasoningEffort = raw.trim();
|
|
@@ -44516,7 +44645,7 @@ Durable service:
|
|
|
44516
44645
|
throw new Error("--lines must be an integer from 1 through 10000.");
|
|
44517
44646
|
}
|
|
44518
44647
|
}
|
|
44519
|
-
if (argument === "--service-manifest") serviceManifestPath =
|
|
44648
|
+
if (argument === "--service-manifest") serviceManifestPath = resolve12(raw.trim());
|
|
44520
44649
|
if (argument === "--instance") {
|
|
44521
44650
|
instanceName = raw.trim();
|
|
44522
44651
|
instanceExplicit = true;
|
|
@@ -44609,10 +44738,24 @@ Durable service:
|
|
|
44609
44738
|
quiesce?.();
|
|
44610
44739
|
}
|
|
44611
44740
|
};
|
|
44741
|
+
let parentLost = false;
|
|
44742
|
+
const onParentLost = () => {
|
|
44743
|
+
if (parentLost) return;
|
|
44744
|
+
parentLost = true;
|
|
44745
|
+
if (quiesce) quiesce();
|
|
44746
|
+
else abort();
|
|
44747
|
+
};
|
|
44612
44748
|
input.on("data", onControlInput);
|
|
44749
|
+
input.on("end", onParentLost);
|
|
44750
|
+
input.on("close", onParentLost);
|
|
44751
|
+
input.on("error", onParentLost);
|
|
44613
44752
|
input.resume();
|
|
44753
|
+
if (input.readableEnded || input.destroyed) onParentLost();
|
|
44614
44754
|
return () => {
|
|
44615
44755
|
input.off("data", onControlInput);
|
|
44756
|
+
input.off("end", onParentLost);
|
|
44757
|
+
input.off("close", onParentLost);
|
|
44758
|
+
input.off("error", onParentLost);
|
|
44616
44759
|
input.pause();
|
|
44617
44760
|
};
|
|
44618
44761
|
};
|
|
@@ -44714,11 +44857,11 @@ Durable service:
|
|
|
44714
44857
|
return raw !== null;
|
|
44715
44858
|
};
|
|
44716
44859
|
inspectCodexAuthentication = async (config2) => {
|
|
44717
|
-
const path =
|
|
44860
|
+
const path = join15(config2.codexHomePath, "auth.json");
|
|
44718
44861
|
try {
|
|
44719
44862
|
const before = await lstat9(path);
|
|
44720
44863
|
const canonical = await realpath8(path);
|
|
44721
|
-
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()));
|
|
44722
44865
|
return { present: true, private: isPrivate };
|
|
44723
44866
|
} catch (error48) {
|
|
44724
44867
|
if (error48.code === "ENOENT") {
|
|
@@ -44735,7 +44878,7 @@ Durable service:
|
|
|
44735
44878
|
runtimeReceiptPath(config2),
|
|
44736
44879
|
"Inference host runtime receipt file"
|
|
44737
44880
|
);
|
|
44738
|
-
await
|
|
44881
|
+
await rm12(codexGuardianReceiptRoot(config2), { recursive: true, force: true });
|
|
44739
44882
|
await clearInferencePrivateFile(
|
|
44740
44883
|
codexRecoveryPath(config2),
|
|
44741
44884
|
"Codex attempt recovery file"
|
|
@@ -45043,20 +45186,20 @@ Waiting for approval...
|
|
|
45043
45186
|
} catch {
|
|
45044
45187
|
}
|
|
45045
45188
|
}
|
|
45046
|
-
let
|
|
45189
|
+
let access6;
|
|
45047
45190
|
try {
|
|
45048
|
-
|
|
45191
|
+
access6 = await pending3.completion;
|
|
45049
45192
|
} catch (error48) {
|
|
45050
45193
|
await pending3.cancel().catch(() => void 0);
|
|
45051
45194
|
throw error48;
|
|
45052
45195
|
}
|
|
45053
45196
|
const state = {
|
|
45054
45197
|
schema_version: 1,
|
|
45055
|
-
issuer:
|
|
45056
|
-
client_id:
|
|
45057
|
-
host_id:
|
|
45198
|
+
issuer: access6.credential.issuer,
|
|
45199
|
+
client_id: access6.credential.client_id,
|
|
45200
|
+
host_id: access6.credential.host_id,
|
|
45058
45201
|
host_generation: 1,
|
|
45059
|
-
key_generation:
|
|
45202
|
+
key_generation: access6.credential.key_generation
|
|
45060
45203
|
};
|
|
45061
45204
|
try {
|
|
45062
45205
|
await writeInferenceHostLocalState(config2.statePath, state);
|
|
@@ -45066,7 +45209,7 @@ Waiting for approval...
|
|
|
45066
45209
|
const metadata = await (dependencies.discoverOAuth ?? discoverInferenceOAuth)(config2.apiUrl);
|
|
45067
45210
|
await (dependencies.revokeCredential ?? revokeInferenceCredential)({
|
|
45068
45211
|
metadata,
|
|
45069
|
-
credential:
|
|
45212
|
+
credential: access6.credential,
|
|
45070
45213
|
store
|
|
45071
45214
|
});
|
|
45072
45215
|
remoteCleanupConfirmed = true;
|
|
@@ -45078,8 +45221,8 @@ Waiting for approval...
|
|
|
45078
45221
|
{ cause: stateError }
|
|
45079
45222
|
);
|
|
45080
45223
|
}
|
|
45081
|
-
await store.writeRecovery(
|
|
45082
|
-
await store.remove(
|
|
45224
|
+
await store.writeRecovery(access6.accountKey, access6.credential);
|
|
45225
|
+
await store.remove(access6.accountKey).catch(() => void 0);
|
|
45083
45226
|
}
|
|
45084
45227
|
if (!remoteCleanupConfirmed) {
|
|
45085
45228
|
throw new Error(
|
|
@@ -45984,7 +46127,7 @@ Waiting for approval...
|
|
|
45984
46127
|
const session = await agentSession(config2, dependencies, warnings);
|
|
45985
46128
|
const now = dependencies.now ?? (() => /* @__PURE__ */ new Date());
|
|
45986
46129
|
const sleep4 = dependencies.sleep ?? (async (milliseconds) => {
|
|
45987
|
-
await new Promise((
|
|
46130
|
+
await new Promise((resolve13) => setTimeout(resolve13, milliseconds));
|
|
45988
46131
|
});
|
|
45989
46132
|
const stopAt = now().getTime() + parsed.waitSeconds * 1e3;
|
|
45990
46133
|
let state = await readInferenceForegroundAgentControlState(config2.statePath) ?? foregroundAgentControlState(session.localState.host_id, now().toISOString());
|
|
@@ -46521,7 +46664,7 @@ Waiting for approval...
|
|
|
46521
46664
|
}
|
|
46522
46665
|
if (parsed.once && !commandLock) break;
|
|
46523
46666
|
await (dependencies.sleep ?? (async (milliseconds) => {
|
|
46524
|
-
await new Promise((
|
|
46667
|
+
await new Promise((resolve13) => setTimeout(resolve13, milliseconds));
|
|
46525
46668
|
}))(retryDelayMs);
|
|
46526
46669
|
}
|
|
46527
46670
|
return {
|
|
@@ -46550,7 +46693,7 @@ Waiting for approval...
|
|
|
46550
46693
|
const session = await agentSession(config2, dependencies, warnings);
|
|
46551
46694
|
const now = dependencies.now ?? (() => /* @__PURE__ */ new Date());
|
|
46552
46695
|
const sleep4 = dependencies.sleep ?? (async (milliseconds) => {
|
|
46553
|
-
await new Promise((
|
|
46696
|
+
await new Promise((resolve13) => setTimeout(resolve13, milliseconds));
|
|
46554
46697
|
});
|
|
46555
46698
|
const stopAt = now().getTime() + parsed.waitSeconds * 1e3;
|
|
46556
46699
|
while (true) {
|
|
@@ -46867,7 +47010,7 @@ Waiting for approval...
|
|
|
46867
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) {
|
|
46868
47011
|
throw new Error("Inference-host service recovery transaction is invalid.");
|
|
46869
47012
|
}
|
|
46870
|
-
if (
|
|
47013
|
+
if (resolve12(record5.recovery_backup_path) !== resolve12(recoveryBackupPath(config2, record5.transaction_id))) {
|
|
46871
47014
|
throw new Error("Inference-host service recovery backup path is invalid.");
|
|
46872
47015
|
}
|
|
46873
47016
|
return record5;
|
|
@@ -47118,7 +47261,7 @@ Waiting for approval...
|
|
|
47118
47261
|
serviceRecoveryTransactionPath(config2),
|
|
47119
47262
|
"Inference-host service recovery transaction"
|
|
47120
47263
|
);
|
|
47121
|
-
await
|
|
47264
|
+
await rm12(backupPath, { force: true });
|
|
47122
47265
|
}
|
|
47123
47266
|
}
|
|
47124
47267
|
} finally {
|
|
@@ -47148,7 +47291,7 @@ Waiting for approval...
|
|
|
47148
47291
|
{
|
|
47149
47292
|
signal: cancellation.signal,
|
|
47150
47293
|
quiesceSignal: cancellation.quiesceSignal,
|
|
47151
|
-
serviceScript:
|
|
47294
|
+
serviceScript: resolve12(process.argv[1] ?? ""),
|
|
47152
47295
|
controlLockPath: `${supervisorConfig.supervisorProcessLockPath}.service-control`
|
|
47153
47296
|
}
|
|
47154
47297
|
);
|
|
@@ -47374,7 +47517,7 @@ Waiting for approval...
|
|
|
47374
47517
|
...selectedEnv,
|
|
47375
47518
|
...retainedEnvironment
|
|
47376
47519
|
});
|
|
47377
|
-
if (
|
|
47520
|
+
if (resolve12(installedConfig.statePath) !== resolve12(baseConfig.statePath)) {
|
|
47378
47521
|
throw new Error(
|
|
47379
47522
|
"Installed inference-host service manifest does not match the requested local state path."
|
|
47380
47523
|
);
|
|
@@ -47393,11 +47536,11 @@ Waiting for approval...
|
|
|
47393
47536
|
});
|
|
47394
47537
|
|
|
47395
47538
|
// lib/agent-core/config.ts
|
|
47396
|
-
import { mkdir as mkdir5, readFile as
|
|
47397
|
-
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";
|
|
47398
47541
|
import { homedir as homedir3 } from "node:os";
|
|
47399
47542
|
function defaultBaseDir() {
|
|
47400
|
-
return
|
|
47543
|
+
return join16(homedir3(), ".vtx");
|
|
47401
47544
|
}
|
|
47402
47545
|
function resolveAgentCliConfig(env = process.env) {
|
|
47403
47546
|
const baseDir = String(env.VTX_HOME || "").trim() || defaultBaseDir();
|
|
@@ -47405,8 +47548,8 @@ function resolveAgentCliConfig(env = process.env) {
|
|
|
47405
47548
|
const parsedProfile = rawProfile ? Number(rawProfile) : NaN;
|
|
47406
47549
|
return {
|
|
47407
47550
|
apiUrl: String(env.VTX_API_URL || "http://localhost:8000").replace(/\/+$/, ""),
|
|
47408
|
-
tokenPath: String(env.VTX_TOKEN_PATH || "").trim() ||
|
|
47409
|
-
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"),
|
|
47410
47553
|
runtimeDeviceId: String(env.VTX_RUNTIME_DEVICE_ID || "").trim() || null,
|
|
47411
47554
|
activeProfileId: Number.isFinite(parsedProfile) && parsedProfile > 0 ? parsedProfile : null,
|
|
47412
47555
|
outputJson: String(env.VTX_OUTPUT || "").trim().toLowerCase() === "json"
|
|
@@ -47414,7 +47557,7 @@ function resolveAgentCliConfig(env = process.env) {
|
|
|
47414
47557
|
}
|
|
47415
47558
|
async function readStoredAgentAuth(path) {
|
|
47416
47559
|
try {
|
|
47417
|
-
const raw = await
|
|
47560
|
+
const raw = await readFile11(path, "utf8");
|
|
47418
47561
|
if (!raw.trim()) {
|
|
47419
47562
|
throw new Error(`VTX token file is empty at ${path}. Run "vtx auth login" or remove the file and retry.`);
|
|
47420
47563
|
}
|
|
@@ -47432,16 +47575,16 @@ async function readStoredAgentAuth(path) {
|
|
|
47432
47575
|
}
|
|
47433
47576
|
}
|
|
47434
47577
|
async function writeStoredAgentAuth(path, auth) {
|
|
47435
|
-
await mkdir5(
|
|
47578
|
+
await mkdir5(dirname14(path), { recursive: true });
|
|
47436
47579
|
await writeFile5(path, `${JSON.stringify(auth, null, 2)}
|
|
47437
47580
|
`, { encoding: "utf8", mode: 384 });
|
|
47438
47581
|
}
|
|
47439
47582
|
async function clearStoredAgentAuth(path) {
|
|
47440
|
-
await
|
|
47583
|
+
await rm13(path, { force: true });
|
|
47441
47584
|
}
|
|
47442
47585
|
async function readRuntimeState(path) {
|
|
47443
47586
|
try {
|
|
47444
|
-
const raw = await
|
|
47587
|
+
const raw = await readFile11(path, "utf8");
|
|
47445
47588
|
const parsed = JSON.parse(raw);
|
|
47446
47589
|
const profileId = Number(parsed.profileId);
|
|
47447
47590
|
const runtimeSessionId = String(parsed.runtimeSessionId || "").trim();
|
|
@@ -47467,12 +47610,12 @@ async function readRuntimeState(path) {
|
|
|
47467
47610
|
}
|
|
47468
47611
|
}
|
|
47469
47612
|
async function writeRuntimeState(path, state) {
|
|
47470
|
-
await mkdir5(
|
|
47613
|
+
await mkdir5(dirname14(path), { recursive: true });
|
|
47471
47614
|
await writeFile5(path, `${JSON.stringify(state, null, 2)}
|
|
47472
47615
|
`, { encoding: "utf8", mode: 384 });
|
|
47473
47616
|
}
|
|
47474
47617
|
async function clearRuntimeState(path) {
|
|
47475
|
-
await
|
|
47618
|
+
await rm13(path, { force: true });
|
|
47476
47619
|
}
|
|
47477
47620
|
var init_config2 = __esm({
|
|
47478
47621
|
"lib/agent-core/config.ts"() {
|
|
@@ -47914,7 +48057,7 @@ import {
|
|
|
47914
48057
|
writeFileSync
|
|
47915
48058
|
} from "node:fs";
|
|
47916
48059
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
47917
|
-
import { dirname as
|
|
48060
|
+
import { dirname as dirname15 } from "node:path";
|
|
47918
48061
|
var parseStoredValues, FileBackedProtectionStorage, clientRuntimeProtectionStatePath;
|
|
47919
48062
|
var init_protection_storage = __esm({
|
|
47920
48063
|
"lib/agent-core/protection-storage.ts"() {
|
|
@@ -47970,7 +48113,7 @@ var init_protection_storage = __esm({
|
|
|
47970
48113
|
}
|
|
47971
48114
|
}
|
|
47972
48115
|
writeValues(values) {
|
|
47973
|
-
mkdirSync(
|
|
48116
|
+
mkdirSync(dirname15(this.path), { recursive: true, mode: 448 });
|
|
47974
48117
|
const serialized = `${JSON.stringify(values)}
|
|
47975
48118
|
`;
|
|
47976
48119
|
const temporaryPath = `${this.path}.${process.pid}.${randomUUID12()}.tmp`;
|
|
@@ -48423,7 +48566,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48423
48566
|
checkAbort = (signal) => {
|
|
48424
48567
|
if (signal?.aborted) throw abortError2(signal);
|
|
48425
48568
|
};
|
|
48426
|
-
wait = (ms, signal) => new Promise((
|
|
48569
|
+
wait = (ms, signal) => new Promise((resolve13, reject) => {
|
|
48427
48570
|
checkAbort(signal);
|
|
48428
48571
|
const aborted2 = () => {
|
|
48429
48572
|
clearTimeout(timer);
|
|
@@ -48431,7 +48574,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48431
48574
|
};
|
|
48432
48575
|
const timer = setTimeout(() => {
|
|
48433
48576
|
signal?.removeEventListener("abort", aborted2);
|
|
48434
|
-
|
|
48577
|
+
resolve13();
|
|
48435
48578
|
}, Math.min(ms, 2147483647));
|
|
48436
48579
|
signal?.addEventListener("abort", aborted2, { once: true });
|
|
48437
48580
|
});
|
|
@@ -48539,7 +48682,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48539
48682
|
if (existing && Date.now() - existing.fetchedAtMs >= 0 && Date.now() - existing.fetchedAtMs < ttlSeconds * 500) return existing;
|
|
48540
48683
|
const running = pending2.get(key);
|
|
48541
48684
|
if (!running) break;
|
|
48542
|
-
await new Promise((
|
|
48685
|
+
await new Promise((resolve13, reject) => {
|
|
48543
48686
|
const aborted2 = () => {
|
|
48544
48687
|
options.signal?.removeEventListener("abort", aborted2);
|
|
48545
48688
|
reject(abortError2(options.signal));
|
|
@@ -48547,15 +48690,15 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48547
48690
|
options.signal?.addEventListener("abort", aborted2, { once: true });
|
|
48548
48691
|
running.then(() => {
|
|
48549
48692
|
options.signal?.removeEventListener("abort", aborted2);
|
|
48550
|
-
|
|
48693
|
+
resolve13();
|
|
48551
48694
|
});
|
|
48552
48695
|
});
|
|
48553
48696
|
checkAbort(options.signal);
|
|
48554
48697
|
}
|
|
48555
48698
|
}
|
|
48556
48699
|
let settled;
|
|
48557
|
-
if (ttlSeconds) pending2.set(key, new Promise((
|
|
48558
|
-
settled =
|
|
48700
|
+
if (ttlSeconds) pending2.set(key, new Promise((resolve13) => {
|
|
48701
|
+
settled = resolve13;
|
|
48559
48702
|
}));
|
|
48560
48703
|
try {
|
|
48561
48704
|
const reservedKey = JSON.stringify(body);
|
|
@@ -50147,12 +50290,12 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
50147
50290
|
if (signal.aborted) {
|
|
50148
50291
|
throw createAbortError(abortMessage);
|
|
50149
50292
|
}
|
|
50150
|
-
return new Promise((
|
|
50293
|
+
return new Promise((resolve13, reject) => {
|
|
50151
50294
|
const onAbort = () => {
|
|
50152
50295
|
reject(createAbortError(abortMessage));
|
|
50153
50296
|
};
|
|
50154
50297
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
50155
|
-
promise2.then(
|
|
50298
|
+
promise2.then(resolve13, reject).finally(() => {
|
|
50156
50299
|
signal.removeEventListener("abort", onAbort);
|
|
50157
50300
|
});
|
|
50158
50301
|
});
|
|
@@ -51485,7 +51628,7 @@ var init_shared = __esm({
|
|
|
51485
51628
|
}
|
|
51486
51629
|
};
|
|
51487
51630
|
API_URL = getApiUrl();
|
|
51488
|
-
sleep2 = (ms) => new Promise((
|
|
51631
|
+
sleep2 = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
|
|
51489
51632
|
AUTH_BOOTSTRAP_GET_MAX_ATTEMPTS = runtime_policy_generated_default.ui.auth_bootstrap_retry.max_attempts;
|
|
51490
51633
|
AUTH_BOOTSTRAP_RETRY_JITTER_MS = runtime_policy_generated_default.ui.auth_bootstrap_retry.jitter_milliseconds;
|
|
51491
51634
|
parseRetryAfterMs2 = (value) => {
|
|
@@ -52644,7 +52787,7 @@ var init_api2 = __esm({
|
|
|
52644
52787
|
if (signal.aborted) {
|
|
52645
52788
|
throw signal.reason ?? new DOMException("Runtime lease recovery aborted.", "AbortError");
|
|
52646
52789
|
}
|
|
52647
|
-
return await new Promise((
|
|
52790
|
+
return await new Promise((resolve13, reject) => {
|
|
52648
52791
|
let settled = false;
|
|
52649
52792
|
const finish = (callback) => {
|
|
52650
52793
|
if (settled) {
|
|
@@ -52659,7 +52802,7 @@ var init_api2 = __esm({
|
|
|
52659
52802
|
));
|
|
52660
52803
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
52661
52804
|
recovery.promise.then(
|
|
52662
|
-
(token) => finish(() =>
|
|
52805
|
+
(token) => finish(() => resolve13(token)),
|
|
52663
52806
|
(error48) => finish(() => reject(error48))
|
|
52664
52807
|
);
|
|
52665
52808
|
});
|
|
@@ -52871,8 +53014,8 @@ var init_exchange_mutation_fence = __esm({
|
|
|
52871
53014
|
return operation();
|
|
52872
53015
|
}
|
|
52873
53016
|
let markSettled;
|
|
52874
|
-
const settlement = new Promise((
|
|
52875
|
-
markSettled =
|
|
53017
|
+
const settlement = new Promise((resolve13) => {
|
|
53018
|
+
markSettled = resolve13;
|
|
52876
53019
|
});
|
|
52877
53020
|
const activeSettlements = activeSettlementsByScope.get(normalizedScope) ?? /* @__PURE__ */ new Set();
|
|
52878
53021
|
activeSettlements.add(settlement);
|
|
@@ -53876,7 +54019,7 @@ function createGetUrl(options) {
|
|
|
53876
54019
|
request.write(Buffer.from(body));
|
|
53877
54020
|
}
|
|
53878
54021
|
request.end();
|
|
53879
|
-
return new Promise((
|
|
54022
|
+
return new Promise((resolve13, reject) => {
|
|
53880
54023
|
if (signal) {
|
|
53881
54024
|
signal.addListener(() => {
|
|
53882
54025
|
if (abort) {
|
|
@@ -53922,7 +54065,7 @@ function createGetUrl(options) {
|
|
|
53922
54065
|
if (headers2["content-encoding"] === "gzip" && body2) {
|
|
53923
54066
|
body2 = getBytes(gunzipSync2(body2));
|
|
53924
54067
|
}
|
|
53925
|
-
|
|
54068
|
+
resolve13({ statusCode, statusMessage, headers: headers2, body: body2 });
|
|
53926
54069
|
} catch (error48) {
|
|
53927
54070
|
reject(makeError("bad response data", "SERVER_ERROR", {
|
|
53928
54071
|
request: req,
|
|
@@ -53998,7 +54141,7 @@ function unpercent(value) {
|
|
|
53998
54141
|
}));
|
|
53999
54142
|
}
|
|
54000
54143
|
function wait2(delay2) {
|
|
54001
|
-
return new Promise((
|
|
54144
|
+
return new Promise((resolve13) => setTimeout(resolve13, delay2));
|
|
54002
54145
|
}
|
|
54003
54146
|
var MAX_ATTEMPTS, SLOT_INTERVAL, defaultGetUrlFunc, reData, reIpfs, locked, Gateways, fetchSignals, FetchCancelSignal, FetchRequest, FetchResponse;
|
|
54004
54147
|
var init_fetch = __esm({
|
|
@@ -67790,7 +67933,7 @@ var init_provider = __esm({
|
|
|
67790
67933
|
return null;
|
|
67791
67934
|
}
|
|
67792
67935
|
}
|
|
67793
|
-
const waiter = new Promise((
|
|
67936
|
+
const waiter = new Promise((resolve13, reject) => {
|
|
67794
67937
|
const cancellers = [];
|
|
67795
67938
|
const cancel = () => {
|
|
67796
67939
|
cancellers.forEach((c) => c());
|
|
@@ -67811,7 +67954,7 @@ var init_provider = __esm({
|
|
|
67811
67954
|
if (await receipt2.confirmations() >= confirms) {
|
|
67812
67955
|
cancel();
|
|
67813
67956
|
try {
|
|
67814
|
-
|
|
67957
|
+
resolve13(checkReceipt(receipt2));
|
|
67815
67958
|
} catch (error48) {
|
|
67816
67959
|
reject(error48);
|
|
67817
67960
|
}
|
|
@@ -68736,12 +68879,12 @@ var init_contract = __esm({
|
|
|
68736
68879
|
}
|
|
68737
68880
|
const provider = getProvider(this.runner);
|
|
68738
68881
|
assert2(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" });
|
|
68739
|
-
return new Promise((
|
|
68882
|
+
return new Promise((resolve13, reject) => {
|
|
68740
68883
|
const checkCode = async () => {
|
|
68741
68884
|
try {
|
|
68742
68885
|
const code2 = await this.getDeployedCode();
|
|
68743
68886
|
if (code2 != null) {
|
|
68744
|
-
return
|
|
68887
|
+
return resolve13(this);
|
|
68745
68888
|
}
|
|
68746
68889
|
provider.once("block", checkCode);
|
|
68747
68890
|
} catch (error48) {
|
|
@@ -71093,7 +71236,7 @@ var init_abstract_provider = __esm({
|
|
|
71093
71236
|
return t.toLowerCase();
|
|
71094
71237
|
});
|
|
71095
71238
|
const blockHash = "blockHash" in filter ? filter.blockHash : void 0;
|
|
71096
|
-
const
|
|
71239
|
+
const resolve13 = (_address, fromBlock2, toBlock2) => {
|
|
71097
71240
|
let address2 = void 0;
|
|
71098
71241
|
switch (_address.length) {
|
|
71099
71242
|
case 0:
|
|
@@ -71148,10 +71291,10 @@ var init_abstract_provider = __esm({
|
|
|
71148
71291
|
}
|
|
71149
71292
|
if (address.filter((a) => typeof a !== "string").length || fromBlock != null && typeof fromBlock !== "string" || toBlock != null && typeof toBlock !== "string") {
|
|
71150
71293
|
return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result2) => {
|
|
71151
|
-
return
|
|
71294
|
+
return resolve13(result2[0], result2[1], result2[2]);
|
|
71152
71295
|
});
|
|
71153
71296
|
}
|
|
71154
|
-
return
|
|
71297
|
+
return resolve13(address, fromBlock, toBlock);
|
|
71155
71298
|
}
|
|
71156
71299
|
/**
|
|
71157
71300
|
* Returns or resolves to a transaction for %%request%%, resolving
|
|
@@ -71525,14 +71668,14 @@ var init_abstract_provider = __esm({
|
|
|
71525
71668
|
if (confirms === 0) {
|
|
71526
71669
|
return this.getTransactionReceipt(hash4);
|
|
71527
71670
|
}
|
|
71528
|
-
return new Promise(async (
|
|
71671
|
+
return new Promise(async (resolve13, reject) => {
|
|
71529
71672
|
let timer = null;
|
|
71530
71673
|
const listener = (async (blockNumber) => {
|
|
71531
71674
|
try {
|
|
71532
71675
|
const receipt = await this.getTransactionReceipt(hash4);
|
|
71533
71676
|
if (receipt != null) {
|
|
71534
71677
|
if (blockNumber - receipt.blockNumber + 1 >= confirms) {
|
|
71535
|
-
|
|
71678
|
+
resolve13(receipt);
|
|
71536
71679
|
if (timer) {
|
|
71537
71680
|
clearTimeout(timer);
|
|
71538
71681
|
timer = null;
|
|
@@ -72303,8 +72446,8 @@ function deepCopy(value) {
|
|
|
72303
72446
|
throw new Error(`should not happen: ${value} (${typeof value})`);
|
|
72304
72447
|
}
|
|
72305
72448
|
function stall(duration3) {
|
|
72306
|
-
return new Promise((
|
|
72307
|
-
setTimeout(
|
|
72449
|
+
return new Promise((resolve13) => {
|
|
72450
|
+
setTimeout(resolve13, duration3);
|
|
72308
72451
|
});
|
|
72309
72452
|
}
|
|
72310
72453
|
function getLowerCase(value) {
|
|
@@ -72444,14 +72587,14 @@ var init_provider_jsonrpc = __esm({
|
|
|
72444
72587
|
async sendTransaction(tx) {
|
|
72445
72588
|
const blockNumber = await this.provider.getBlockNumber();
|
|
72446
72589
|
const hash4 = await this.sendUncheckedTransaction(tx);
|
|
72447
|
-
return await new Promise((
|
|
72590
|
+
return await new Promise((resolve13, reject) => {
|
|
72448
72591
|
const timeouts = [1e3, 100];
|
|
72449
72592
|
let invalids = 0;
|
|
72450
72593
|
const checkTx = async () => {
|
|
72451
72594
|
try {
|
|
72452
72595
|
const tx2 = await this.provider.getTransaction(hash4);
|
|
72453
72596
|
if (tx2 != null) {
|
|
72454
|
-
|
|
72597
|
+
resolve13(tx2.replaceableTransaction(blockNumber));
|
|
72455
72598
|
return;
|
|
72456
72599
|
}
|
|
72457
72600
|
} catch (error48) {
|
|
@@ -72568,7 +72711,7 @@ var init_provider_jsonrpc = __esm({
|
|
|
72568
72711
|
try {
|
|
72569
72712
|
const result2 = await this._send(payload);
|
|
72570
72713
|
this.emit("debug", { action: "receiveRpcResult", result: result2 });
|
|
72571
|
-
for (const { resolve:
|
|
72714
|
+
for (const { resolve: resolve13, reject, payload: payload2 } of batch) {
|
|
72572
72715
|
if (this.destroyed) {
|
|
72573
72716
|
reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload2.method }));
|
|
72574
72717
|
continue;
|
|
@@ -72587,7 +72730,7 @@ var init_provider_jsonrpc = __esm({
|
|
|
72587
72730
|
reject(this.getRpcError(payload2, resp));
|
|
72588
72731
|
continue;
|
|
72589
72732
|
}
|
|
72590
|
-
|
|
72733
|
+
resolve13(resp.result);
|
|
72591
72734
|
}
|
|
72592
72735
|
} catch (error48) {
|
|
72593
72736
|
this.emit("debug", { action: "receiveRpcError", error: error48 });
|
|
@@ -72608,11 +72751,11 @@ var init_provider_jsonrpc = __esm({
|
|
|
72608
72751
|
this.#network = null;
|
|
72609
72752
|
this.#pendingDetectNetwork = null;
|
|
72610
72753
|
{
|
|
72611
|
-
let
|
|
72754
|
+
let resolve13 = null;
|
|
72612
72755
|
const promise2 = new Promise((_resolve) => {
|
|
72613
|
-
|
|
72756
|
+
resolve13 = _resolve;
|
|
72614
72757
|
});
|
|
72615
|
-
this.#notReady = { promise: promise2, resolve:
|
|
72758
|
+
this.#notReady = { promise: promise2, resolve: resolve13 };
|
|
72616
72759
|
}
|
|
72617
72760
|
const staticNetwork = this._getOption("staticNetwork");
|
|
72618
72761
|
if (typeof staticNetwork === "boolean") {
|
|
@@ -73025,9 +73168,9 @@ var init_provider_jsonrpc = __esm({
|
|
|
73025
73168
|
return Promise.reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method }));
|
|
73026
73169
|
}
|
|
73027
73170
|
const id2 = this.#nextId++;
|
|
73028
|
-
const promise2 = new Promise((
|
|
73171
|
+
const promise2 = new Promise((resolve13, reject) => {
|
|
73029
73172
|
this.#payloads.push({
|
|
73030
|
-
resolve:
|
|
73173
|
+
resolve: resolve13,
|
|
73031
73174
|
reject,
|
|
73032
73175
|
payload: { method, params, id: id2, jsonrpc: "2.0" }
|
|
73033
73176
|
});
|
|
@@ -77985,8 +78128,8 @@ var init_provider_socket = __esm({
|
|
|
77985
78128
|
}
|
|
77986
78129
|
async _send(payload) {
|
|
77987
78130
|
assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload);
|
|
77988
|
-
const promise2 = new Promise((
|
|
77989
|
-
this.#callbacks.set(payload.id, { payload, resolve:
|
|
78131
|
+
const promise2 = new Promise((resolve13, reject) => {
|
|
78132
|
+
this.#callbacks.set(payload.id, { payload, resolve: resolve13, reject });
|
|
77990
78133
|
});
|
|
77991
78134
|
await this._waitUntilReady();
|
|
77992
78135
|
await this._write(JSON.stringify(payload));
|
|
@@ -78392,8 +78535,8 @@ function shuffle(array2) {
|
|
|
78392
78535
|
}
|
|
78393
78536
|
}
|
|
78394
78537
|
function stall2(duration3) {
|
|
78395
|
-
return new Promise((
|
|
78396
|
-
setTimeout(
|
|
78538
|
+
return new Promise((resolve13) => {
|
|
78539
|
+
setTimeout(resolve13, duration3);
|
|
78397
78540
|
});
|
|
78398
78541
|
}
|
|
78399
78542
|
function getTime3() {
|
|
@@ -79275,7 +79418,7 @@ var init_provider_browser = __esm({
|
|
|
79275
79418
|
if (timeout === 0) {
|
|
79276
79419
|
return null;
|
|
79277
79420
|
}
|
|
79278
|
-
return await new Promise((
|
|
79421
|
+
return await new Promise((resolve13, reject) => {
|
|
79279
79422
|
let found = [];
|
|
79280
79423
|
const addProvider = (event) => {
|
|
79281
79424
|
found.push(event.detail);
|
|
@@ -79289,9 +79432,9 @@ var init_provider_browser = __esm({
|
|
|
79289
79432
|
if (options && options.filter) {
|
|
79290
79433
|
const filtered = options.filter(found.map((i) => Object.assign({}, i.info)));
|
|
79291
79434
|
if (filtered == null) {
|
|
79292
|
-
|
|
79435
|
+
resolve13(null);
|
|
79293
79436
|
} else if (filtered instanceof _BrowserProvider) {
|
|
79294
|
-
|
|
79437
|
+
resolve13(filtered);
|
|
79295
79438
|
} else {
|
|
79296
79439
|
let match = null;
|
|
79297
79440
|
if (filtered.uuid) {
|
|
@@ -79300,7 +79443,7 @@ var init_provider_browser = __esm({
|
|
|
79300
79443
|
}
|
|
79301
79444
|
if (match) {
|
|
79302
79445
|
const { provider, info } = match;
|
|
79303
|
-
|
|
79446
|
+
resolve13(new _BrowserProvider(provider, void 0, {
|
|
79304
79447
|
providerInfo: info
|
|
79305
79448
|
}));
|
|
79306
79449
|
} else {
|
|
@@ -79311,12 +79454,12 @@ var init_provider_browser = __esm({
|
|
|
79311
79454
|
}
|
|
79312
79455
|
} else {
|
|
79313
79456
|
const { provider, info } = found[0];
|
|
79314
|
-
|
|
79457
|
+
resolve13(new _BrowserProvider(provider, void 0, {
|
|
79315
79458
|
providerInfo: info
|
|
79316
79459
|
}));
|
|
79317
79460
|
}
|
|
79318
79461
|
} else {
|
|
79319
|
-
|
|
79462
|
+
resolve13(null);
|
|
79320
79463
|
}
|
|
79321
79464
|
context.removeEventListener("eip6963:announceProvider", addProvider);
|
|
79322
79465
|
};
|
|
@@ -80730,9 +80873,9 @@ function decryptKeystoreJsonSync(json2, _password) {
|
|
|
80730
80873
|
return getAccount(data4, key);
|
|
80731
80874
|
}
|
|
80732
80875
|
function stall3(duration3) {
|
|
80733
|
-
return new Promise((
|
|
80876
|
+
return new Promise((resolve13) => {
|
|
80734
80877
|
setTimeout(() => {
|
|
80735
|
-
|
|
80878
|
+
resolve13();
|
|
80736
80879
|
}, duration3);
|
|
80737
80880
|
});
|
|
80738
80881
|
}
|
|
@@ -81361,9 +81504,9 @@ var init_json_crowdsale = __esm({
|
|
|
81361
81504
|
|
|
81362
81505
|
// node_modules/ethers/lib.esm/wallet/wallet.js
|
|
81363
81506
|
function stall4(duration3) {
|
|
81364
|
-
return new Promise((
|
|
81507
|
+
return new Promise((resolve13) => {
|
|
81365
81508
|
setTimeout(() => {
|
|
81366
|
-
|
|
81509
|
+
resolve13();
|
|
81367
81510
|
}, duration3);
|
|
81368
81511
|
});
|
|
81369
81512
|
}
|
|
@@ -85309,14 +85452,14 @@ var init_hyperliquid_client = __esm({
|
|
|
85309
85452
|
if (input.signal?.aborted) {
|
|
85310
85453
|
throw input.signal.reason instanceof Error ? input.signal.reason : settlementError;
|
|
85311
85454
|
}
|
|
85312
|
-
await new Promise((
|
|
85455
|
+
await new Promise((resolve13) => {
|
|
85313
85456
|
let settled = false;
|
|
85314
85457
|
const finish = () => {
|
|
85315
85458
|
if (settled) return;
|
|
85316
85459
|
settled = true;
|
|
85317
85460
|
globalThis.clearTimeout(timeoutId);
|
|
85318
85461
|
input.signal?.removeEventListener("abort", finish);
|
|
85319
|
-
|
|
85462
|
+
resolve13();
|
|
85320
85463
|
};
|
|
85321
85464
|
const timeoutId = globalThis.setTimeout(finish, 1e3);
|
|
85322
85465
|
input.signal?.addEventListener("abort", finish, { once: true });
|
|
@@ -85347,12 +85490,12 @@ var init_hyperliquid_client = __esm({
|
|
|
85347
85490
|
captureController.signal,
|
|
85348
85491
|
...durableMutationAuthorityArgs(durableMutation)
|
|
85349
85492
|
).then(() => void 0).catch(() => void 0);
|
|
85350
|
-
const captureDeadline = new Promise((
|
|
85493
|
+
const captureDeadline = new Promise((resolve13) => {
|
|
85351
85494
|
captureTimeout = globalThis.setTimeout(() => {
|
|
85352
85495
|
captureController.abort(
|
|
85353
85496
|
new DOMException("Execution attempt capture timed out.", "TimeoutError")
|
|
85354
85497
|
);
|
|
85355
|
-
|
|
85498
|
+
resolve13();
|
|
85356
85499
|
}, remainingBudgetMs);
|
|
85357
85500
|
});
|
|
85358
85501
|
await Promise.race([captureRequest, captureDeadline]);
|
|
@@ -85856,7 +85999,7 @@ var init_vault = __esm({
|
|
|
85856
85999
|
}
|
|
85857
86000
|
return output3.buffer.slice(output3.byteOffset, output3.byteOffset + output3.byteLength);
|
|
85858
86001
|
};
|
|
85859
|
-
openVaultDb = async () => new Promise((
|
|
86002
|
+
openVaultDb = async () => new Promise((resolve13, reject) => {
|
|
85860
86003
|
const request = indexedDB.open(VAULT_DB_NAME, VAULT_DB_VERSION);
|
|
85861
86004
|
request.onerror = () => reject(request.error ?? new Error("Failed to open client vault database."));
|
|
85862
86005
|
request.onupgradeneeded = () => {
|
|
@@ -85865,7 +86008,7 @@ var init_vault = __esm({
|
|
|
85865
86008
|
database.createObjectStore(VAULT_KEY_STORE);
|
|
85866
86009
|
}
|
|
85867
86010
|
};
|
|
85868
|
-
request.onsuccess = () =>
|
|
86011
|
+
request.onsuccess = () => resolve13(request.result);
|
|
85869
86012
|
});
|
|
85870
86013
|
withVaultStore = async (mode, fn) => {
|
|
85871
86014
|
const database = await openVaultDb();
|
|
@@ -85873,8 +86016,8 @@ var init_vault = __esm({
|
|
|
85873
86016
|
const transaction = database.transaction(VAULT_KEY_STORE, mode);
|
|
85874
86017
|
const store = transaction.objectStore(VAULT_KEY_STORE);
|
|
85875
86018
|
const result2 = await fn(store);
|
|
85876
|
-
await new Promise((
|
|
85877
|
-
transaction.oncomplete = () =>
|
|
86019
|
+
await new Promise((resolve13, reject) => {
|
|
86020
|
+
transaction.oncomplete = () => resolve13();
|
|
85878
86021
|
transaction.onerror = () => reject(transaction.error ?? new Error("Client vault transaction failed."));
|
|
85879
86022
|
transaction.onabort = () => reject(transaction.error ?? new Error("Client vault transaction aborted."));
|
|
85880
86023
|
});
|
|
@@ -85889,9 +86032,9 @@ var init_vault = __esm({
|
|
|
85889
86032
|
}
|
|
85890
86033
|
return withVaultStore("readonly", async (store) => {
|
|
85891
86034
|
const request = store.get(profileId);
|
|
85892
|
-
return await new Promise((
|
|
86035
|
+
return await new Promise((resolve13, reject) => {
|
|
85893
86036
|
request.onerror = () => reject(request.error ?? new Error("Failed to read client vault key."));
|
|
85894
|
-
request.onsuccess = () =>
|
|
86037
|
+
request.onsuccess = () => resolve13(request.result ?? null);
|
|
85895
86038
|
});
|
|
85896
86039
|
});
|
|
85897
86040
|
};
|
|
@@ -85913,9 +86056,9 @@ var init_vault = __esm({
|
|
|
85913
86056
|
);
|
|
85914
86057
|
await withVaultStore("readwrite", async (store) => {
|
|
85915
86058
|
const request = store.put(createdKey, profileId);
|
|
85916
|
-
await new Promise((
|
|
86059
|
+
await new Promise((resolve13, reject) => {
|
|
85917
86060
|
request.onerror = () => reject(request.error ?? new Error("Failed to persist client vault key."));
|
|
85918
|
-
request.onsuccess = () =>
|
|
86061
|
+
request.onsuccess = () => resolve13();
|
|
85919
86062
|
});
|
|
85920
86063
|
});
|
|
85921
86064
|
return createdKey;
|
|
@@ -85926,9 +86069,9 @@ var init_vault = __esm({
|
|
|
85926
86069
|
}
|
|
85927
86070
|
await withVaultStore("readwrite", async (store) => {
|
|
85928
86071
|
const request = store.delete(profileId);
|
|
85929
|
-
await new Promise((
|
|
86072
|
+
await new Promise((resolve13, reject) => {
|
|
85930
86073
|
request.onerror = () => reject(request.error ?? new Error("Failed to remove client vault key."));
|
|
85931
|
-
request.onsuccess = () =>
|
|
86074
|
+
request.onsuccess = () => resolve13();
|
|
85932
86075
|
});
|
|
85933
86076
|
});
|
|
85934
86077
|
};
|
|
@@ -90689,10 +90832,10 @@ var init_runtime_execution = __esm({
|
|
|
90689
90832
|
}
|
|
90690
90833
|
};
|
|
90691
90834
|
sleep3 = async (ms, signal) => {
|
|
90692
|
-
await new Promise((
|
|
90835
|
+
await new Promise((resolve13, reject) => {
|
|
90693
90836
|
const timer = setTimeout(() => {
|
|
90694
90837
|
cleanup();
|
|
90695
|
-
|
|
90838
|
+
resolve13(void 0);
|
|
90696
90839
|
}, ms);
|
|
90697
90840
|
const cleanup = () => {
|
|
90698
90841
|
clearTimeout(timer);
|
|
@@ -94092,7 +94235,7 @@ Global options:
|
|
|
94092
94235
|
"alibaba_cloud_model_studio_api_key",
|
|
94093
94236
|
"lightning_api_key"
|
|
94094
94237
|
]);
|
|
94095
|
-
delay = (ms) => new Promise((
|
|
94238
|
+
delay = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
|
|
94096
94239
|
}
|
|
94097
94240
|
});
|
|
94098
94241
|
|