@vtxmacro/cli 2026.9.35 → 2026.9.37
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/bin/vtx-service-bootstrap.js +1 -1
- package/bin/vtx.js +205 -108
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ import { fileURLToPath } from "node:url";
|
|
|
16
16
|
// agent-cli-release.json
|
|
17
17
|
var agent_cli_release_default = {
|
|
18
18
|
package_name: "@vtxmacro/cli",
|
|
19
|
-
package_version: "2026.9.
|
|
19
|
+
package_version: "2026.9.37",
|
|
20
20
|
codex_package_name: "@openai/codex",
|
|
21
21
|
codex_version: "0.153.3",
|
|
22
22
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
package/bin/vtx.js
CHANGED
|
@@ -59,7 +59,7 @@ var init_define_VTX_EXO_POLICY = __esm({
|
|
|
59
59
|
var define_VTX_GROK_POLICY_default;
|
|
60
60
|
var init_define_VTX_GROK_POLICY = __esm({
|
|
61
61
|
"<define:__VTX_GROK_POLICY__>"() {
|
|
62
|
-
define_VTX_GROK_POLICY_default = { subscription_proxy_base_url: "https://cli-chat-proxy.grok.com/v1", maximum_transport_request_bytes: 8388608, maximum_transport_response_bytes: 8388608
|
|
62
|
+
define_VTX_GROK_POLICY_default = { subscription_proxy_base_url: "https://cli-chat-proxy.grok.com/v1", maximum_transport_request_bytes: 8388608, maximum_transport_response_bytes: 8388608 };
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
|
|
@@ -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.37",
|
|
81
81
|
codex_package_name: "@openai/codex",
|
|
82
82
|
codex_version: "0.153.3",
|
|
83
83
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -389,9 +389,9 @@ function floatSafeRemainder(val, step) {
|
|
|
389
389
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
390
390
|
return valInt % stepInt / 10 ** decCount;
|
|
391
391
|
}
|
|
392
|
-
function defineLazy(
|
|
392
|
+
function defineLazy(object6, key, getter) {
|
|
393
393
|
let value = void 0;
|
|
394
|
-
Object.defineProperty(
|
|
394
|
+
Object.defineProperty(object6, key, {
|
|
395
395
|
get() {
|
|
396
396
|
if (value === EVALUATING) {
|
|
397
397
|
return void 0;
|
|
@@ -403,7 +403,7 @@ function defineLazy(object5, key, getter) {
|
|
|
403
403
|
return value;
|
|
404
404
|
},
|
|
405
405
|
set(v) {
|
|
406
|
-
Object.defineProperty(
|
|
406
|
+
Object.defineProperty(object6, key, {
|
|
407
407
|
value: v
|
|
408
408
|
// configurable: true,
|
|
409
409
|
});
|
|
@@ -18654,28 +18654,28 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
18654
18654
|
return await cachedSystemBootIdentity;
|
|
18655
18655
|
}
|
|
18656
18656
|
const read = async () => {
|
|
18657
|
-
let
|
|
18657
|
+
let identity2 = null;
|
|
18658
18658
|
if (platform === "linux") {
|
|
18659
18659
|
try {
|
|
18660
|
-
|
|
18660
|
+
identity2 = (await readFile("/proc/sys/kernel/random/boot_id", "utf8")).trim();
|
|
18661
18661
|
} catch {
|
|
18662
|
-
|
|
18662
|
+
identity2 = null;
|
|
18663
18663
|
}
|
|
18664
18664
|
} else if (platform === "win32") {
|
|
18665
18665
|
const invocation = windowsBootIdentityInvocation();
|
|
18666
|
-
|
|
18666
|
+
identity2 = await runSmallIdentityCommand(
|
|
18667
18667
|
"powershell.exe",
|
|
18668
18668
|
invocation.args,
|
|
18669
18669
|
invocation.env,
|
|
18670
18670
|
invocation.timeoutMs
|
|
18671
18671
|
);
|
|
18672
18672
|
} else if (platform === "darwin") {
|
|
18673
|
-
|
|
18673
|
+
identity2 = await runSmallIdentityCommand("sysctl", ["-n", "kern.boottime"], void 0);
|
|
18674
18674
|
}
|
|
18675
|
-
if (!
|
|
18675
|
+
if (!identity2 || /[\r\n\0]/u.test(identity2)) {
|
|
18676
18676
|
throw new Error("Inference host could not establish the current system boot identity.");
|
|
18677
18677
|
}
|
|
18678
|
-
return `${platform}:${
|
|
18678
|
+
return `${platform}:${identity2}`;
|
|
18679
18679
|
};
|
|
18680
18680
|
const pending2 = read();
|
|
18681
18681
|
if (platform === process.platform) cachedSystemBootIdentity = pending2;
|
|
@@ -18693,9 +18693,9 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
18693
18693
|
return null;
|
|
18694
18694
|
};
|
|
18695
18695
|
defaultCurrentProcessIdentity = async () => {
|
|
18696
|
-
const
|
|
18697
|
-
if (!
|
|
18698
|
-
return
|
|
18696
|
+
const identity2 = await defaultProcessIdentity(process.pid);
|
|
18697
|
+
if (!identity2) throw new Error("Inference host could not establish its process-start identity.");
|
|
18698
|
+
return identity2;
|
|
18699
18699
|
};
|
|
18700
18700
|
processLockObservationCache = /* @__PURE__ */ new Map();
|
|
18701
18701
|
inferenceProcessIdentitiesMatch = (stored, observed) => stored === observed;
|
|
@@ -18829,19 +18829,19 @@ function validateInferenceHostCredential(value) {
|
|
|
18829
18829
|
updated_at: updatedAt
|
|
18830
18830
|
};
|
|
18831
18831
|
}
|
|
18832
|
-
function inferenceCredentialAccountKey(
|
|
18833
|
-
const issuer = canonicalUrl(
|
|
18834
|
-
if (!
|
|
18832
|
+
function inferenceCredentialAccountKey(identity2) {
|
|
18833
|
+
const issuer = canonicalUrl(identity2.issuer, "Inference OAuth issuer");
|
|
18834
|
+
if (!identity2.clientId || identity2.clientId.length > 512) {
|
|
18835
18835
|
throw new Error("Inference OAuth client ID is invalid.");
|
|
18836
18836
|
}
|
|
18837
|
-
if (!SAFE_IDENTIFIER.test(
|
|
18837
|
+
if (!SAFE_IDENTIFIER.test(identity2.hostId)) {
|
|
18838
18838
|
throw new Error("Inference host ID is invalid.");
|
|
18839
18839
|
}
|
|
18840
18840
|
return createHash("sha256").update(
|
|
18841
18841
|
JSON.stringify({
|
|
18842
18842
|
issuer,
|
|
18843
|
-
client_id:
|
|
18844
|
-
host_id:
|
|
18843
|
+
client_id: identity2.clientId,
|
|
18844
|
+
host_id: identity2.hostId
|
|
18845
18845
|
}),
|
|
18846
18846
|
"utf8"
|
|
18847
18847
|
).digest("hex");
|
|
@@ -34484,7 +34484,7 @@ var init_grok_binary = __esm({
|
|
|
34484
34484
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
34485
34485
|
import { dirname as dirname7, resolve as resolve5 } from "node:path";
|
|
34486
34486
|
import { fileURLToPath } from "node:url";
|
|
34487
|
-
var validateGrokPolicy,
|
|
34487
|
+
var validateGrokPolicy, loadGrokPolicy;
|
|
34488
34488
|
var init_grok_policy = __esm({
|
|
34489
34489
|
"lib/inference-host/grok-policy.ts"() {
|
|
34490
34490
|
"use strict";
|
|
@@ -34502,26 +34502,12 @@ var init_grok_policy = __esm({
|
|
|
34502
34502
|
throw new Error("Grok transport bounds are missing or invalid.");
|
|
34503
34503
|
}
|
|
34504
34504
|
}
|
|
34505
|
-
const aliases = policy.effective_model_aliases;
|
|
34506
|
-
if (!aliases || typeof aliases !== "object" || Array.isArray(aliases) || ![Object.prototype, null].includes(Object.getPrototypeOf(aliases)) || Object.keys(aliases).length > 64) throw new Error("Grok effective model aliases are missing or invalid.");
|
|
34507
|
-
const validModel = (model) => typeof model === "string" && model.length > 0 && model.length <= 256 && model.trim() === model && !/[\u0000-\u001f\u007f]/u.test(model);
|
|
34508
|
-
const entries = Object.entries(aliases);
|
|
34509
|
-
for (const [requested, effective] of entries) {
|
|
34510
|
-
if (!validModel(requested) || !Array.isArray(effective) || effective.length < 1 || effective.length > 15 || !effective.every(validModel) || new Set(effective).size !== effective.length || effective.includes(requested)) {
|
|
34511
|
-
throw new Error("Grok effective model aliases are missing or invalid.");
|
|
34512
|
-
}
|
|
34513
|
-
}
|
|
34514
|
-
const effectiveModelAliases = Object.freeze(Object.fromEntries(
|
|
34515
|
-
entries.map(([requested, effective]) => [requested, Object.freeze([...effective])])
|
|
34516
|
-
));
|
|
34517
34505
|
return Object.freeze({
|
|
34518
34506
|
subscription_proxy_base_url: url2.href,
|
|
34519
34507
|
maximum_transport_request_bytes: Number(policy.maximum_transport_request_bytes),
|
|
34520
|
-
maximum_transport_response_bytes: Number(policy.maximum_transport_response_bytes)
|
|
34521
|
-
effective_model_aliases: effectiveModelAliases
|
|
34508
|
+
maximum_transport_response_bytes: Number(policy.maximum_transport_response_bytes)
|
|
34522
34509
|
});
|
|
34523
34510
|
};
|
|
34524
|
-
grokAllowedEffectiveModels = (policy, requested) => Object.freeze([requested, ...Object.hasOwn(policy.effective_model_aliases, requested) ? policy.effective_model_aliases[requested] : []]);
|
|
34525
34511
|
loadGrokPolicy = async () => {
|
|
34526
34512
|
if (typeof define_VTX_GROK_POLICY_default !== "undefined") return validateGrokPolicy(define_VTX_GROK_POLICY_default);
|
|
34527
34513
|
const config2 = parse3(await readFile6(resolve5(dirname7(fileURLToPath(import.meta.url)), "../../../config.toml"), "utf8"));
|
|
@@ -34530,6 +34516,46 @@ var init_grok_policy = __esm({
|
|
|
34530
34516
|
}
|
|
34531
34517
|
});
|
|
34532
34518
|
|
|
34519
|
+
// lib/inference-host/grok-model-catalog.ts
|
|
34520
|
+
var object3, identity, parseGrokModelCatalog;
|
|
34521
|
+
var init_grok_model_catalog = __esm({
|
|
34522
|
+
"lib/inference-host/grok-model-catalog.ts"() {
|
|
34523
|
+
"use strict";
|
|
34524
|
+
init_define_VTX_EXO_POLICY();
|
|
34525
|
+
init_define_VTX_GROK_POLICY();
|
|
34526
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
34527
|
+
object3 = (value) => {
|
|
34528
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("grok_model_catalog_invalid");
|
|
34529
|
+
return value;
|
|
34530
|
+
};
|
|
34531
|
+
identity = (value) => {
|
|
34532
|
+
if (value == null) return void 0;
|
|
34533
|
+
if (typeof value !== "string" || !value || value !== value.trim() || value.length > 256 || /[\u0000-\u001f\u007f]/u.test(value)) throw new Error("grok_model_catalog_identity_invalid");
|
|
34534
|
+
return value;
|
|
34535
|
+
};
|
|
34536
|
+
parseGrokModelCatalog = (value) => {
|
|
34537
|
+
const data4 = object3(value).data;
|
|
34538
|
+
if (!Array.isArray(data4)) throw new Error("grok_model_catalog_invalid");
|
|
34539
|
+
const result2 = /* @__PURE__ */ new Map();
|
|
34540
|
+
for (const raw of data4) {
|
|
34541
|
+
const row = object3(raw);
|
|
34542
|
+
const meta3 = row._meta == null ? {} : object3(row._meta);
|
|
34543
|
+
const id2 = identity(row.id);
|
|
34544
|
+
const transportModel = identity(row.model) ?? identity(row.modelId) ?? id2 ?? identity(meta3.model) ?? identity(meta3.modelId);
|
|
34545
|
+
if (!transportModel) throw new Error("grok_model_catalog_identity_missing");
|
|
34546
|
+
const selector = id2 ?? transportModel;
|
|
34547
|
+
if (result2.has(selector)) throw new Error("grok_model_catalog_identity_ambiguous");
|
|
34548
|
+
result2.set(selector, Object.freeze({
|
|
34549
|
+
selector,
|
|
34550
|
+
transportModel,
|
|
34551
|
+
allowedEffectiveModels: Object.freeze([.../* @__PURE__ */ new Set([selector, transportModel])])
|
|
34552
|
+
}));
|
|
34553
|
+
}
|
|
34554
|
+
return result2;
|
|
34555
|
+
};
|
|
34556
|
+
}
|
|
34557
|
+
});
|
|
34558
|
+
|
|
34533
34559
|
// lib/inference-host/grok-transport-proxy.ts
|
|
34534
34560
|
import { createServer as createServer3 } from "node:http";
|
|
34535
34561
|
import { createHash as createHash6, randomBytes as randomBytes5 } from "node:crypto";
|
|
@@ -34541,6 +34567,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
34541
34567
|
init_define_VTX_EXO_POLICY();
|
|
34542
34568
|
init_define_VTX_GROK_POLICY();
|
|
34543
34569
|
init_define_VTX_PI_MODEL_POLICY();
|
|
34570
|
+
init_grok_model_catalog();
|
|
34544
34571
|
init_external_inference_contract();
|
|
34545
34572
|
diagnosticNames = /* @__PURE__ */ new Set([
|
|
34546
34573
|
"search_tool",
|
|
@@ -34574,6 +34601,8 @@ var init_grok_transport_proxy = __esm({
|
|
|
34574
34601
|
this.requestFingerprints = /* @__PURE__ */ new Set();
|
|
34575
34602
|
this.pending = false;
|
|
34576
34603
|
this.closed = false;
|
|
34604
|
+
this.catalogValue = null;
|
|
34605
|
+
this.boundIdentity = null;
|
|
34577
34606
|
this.observedModel = null;
|
|
34578
34607
|
this.dispatched = false;
|
|
34579
34608
|
this.responded = false;
|
|
@@ -34583,11 +34612,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
34583
34612
|
this.toolValidationFailure = null;
|
|
34584
34613
|
this.responseIdentityFailure = null;
|
|
34585
34614
|
const upstream = new URL(options.upstreamBaseUrl);
|
|
34586
|
-
|
|
34587
|
-
if (!models.includes(options.requestedModel) || models.length > 16 || new Set(models).size !== models.length || models.some((model) => typeof model !== "string" || !model.trim())) {
|
|
34588
|
-
throw new Error("grok_proxy_invalid_configuration");
|
|
34589
|
-
}
|
|
34590
|
-
if (upstream.protocol !== "https:" || upstream.username || upstream.password || upstream.search || upstream.hash || !options.requestedModel || typeof options.expectedSystemPrompt !== "string" || !Number.isSafeInteger(options.deadlineAtMs) || options.providerDispatchNotAfterMs !== void 0 && !Number.isSafeInteger(options.providerDispatchNotAfterMs) || !Number.isSafeInteger(options.maxRequestBytes) || options.maxRequestBytes < 1 || !Number.isSafeInteger(options.maxResponseBytes) || options.maxResponseBytes < 1 || new Set(options.allowedToolNames).size !== options.allowedToolNames.length || options.allowedToolNames.some((name) => !name)) throw new Error("grok_proxy_invalid_configuration");
|
|
34615
|
+
if (upstream.protocol !== "https:" || upstream.username || upstream.password || upstream.search || upstream.hash || !options.metadataOnly && !options.requestedModel || typeof options.expectedSystemPrompt !== "string" || !Number.isSafeInteger(options.deadlineAtMs) || options.providerDispatchNotAfterMs !== void 0 && !Number.isSafeInteger(options.providerDispatchNotAfterMs) || !Number.isSafeInteger(options.maxRequestBytes) || options.maxRequestBytes < 1 || !Number.isSafeInteger(options.maxResponseBytes) || options.maxResponseBytes < 1 || new Set(options.allowedToolNames).size !== options.allowedToolNames.length || options.allowedToolNames.some((name) => !name)) throw new Error("grok_proxy_invalid_configuration");
|
|
34591
34616
|
}
|
|
34592
34617
|
get baseUrl() {
|
|
34593
34618
|
if (!this.urlValue) throw new Error("grok_proxy_not_started");
|
|
@@ -34602,6 +34627,18 @@ var init_grok_transport_proxy = __esm({
|
|
|
34602
34627
|
get pendingRequest() {
|
|
34603
34628
|
return this.pending;
|
|
34604
34629
|
}
|
|
34630
|
+
get modelCatalog() {
|
|
34631
|
+
return this.catalogValue ? new Map(this.catalogValue) : null;
|
|
34632
|
+
}
|
|
34633
|
+
bindModelIdentity(selector, frozenProviderAllowance) {
|
|
34634
|
+
if (this.options.metadataOnly || this.boundIdentity || this.pending || this.dispatched || this.closed || selector !== this.options.requestedModel) throw new Error("grok_model_identity_binding_invalid");
|
|
34635
|
+
const identity2 = this.catalogValue?.get(selector);
|
|
34636
|
+
if (!identity2) throw new Error("grok_model_catalog_identity_missing");
|
|
34637
|
+
const allowed = identity2.allowedEffectiveModels.filter((model) => !frozenProviderAllowance || frozenProviderAllowance.includes(model));
|
|
34638
|
+
if (!allowed.includes(identity2.transportModel)) throw new Error("grok_model_catalog_identity_changed");
|
|
34639
|
+
this.boundIdentity = Object.freeze({ ...identity2, allowedEffectiveModels: Object.freeze(allowed) });
|
|
34640
|
+
return this.boundIdentity;
|
|
34641
|
+
}
|
|
34605
34642
|
async start() {
|
|
34606
34643
|
if (this.server) return;
|
|
34607
34644
|
if (this.closed) throw new Error("grok_proxy_closed");
|
|
@@ -34651,7 +34688,8 @@ var init_grok_transport_proxy = __esm({
|
|
|
34651
34688
|
}
|
|
34652
34689
|
validatePayload(payload, route) {
|
|
34653
34690
|
const requestedEffort = route === "/responses" ? record3(payload.reasoning).effort : payload.reasoning_effort;
|
|
34654
|
-
if (
|
|
34691
|
+
if (!this.boundIdentity) throw new Error("grok_model_identity_not_bound");
|
|
34692
|
+
if (payload.model !== this.boundIdentity.transportModel || effort(requestedEffort) !== effort(this.options.requestedReasoningEffort)) {
|
|
34655
34693
|
throw new Error("grok_outbound_model_or_effort_mismatch");
|
|
34656
34694
|
}
|
|
34657
34695
|
if (payload.stream !== true) throw new Error("grok_streaming_required");
|
|
@@ -34704,6 +34742,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
34704
34742
|
if (!authorization?.startsWith("Bearer ") || authorization.length <= 7) throw new Error("grok_proxy_auth_required");
|
|
34705
34743
|
let body;
|
|
34706
34744
|
if (inference) {
|
|
34745
|
+
if (this.options.metadataOnly) throw new Error("grok_metadata_only");
|
|
34707
34746
|
if (this.pending || this.failureCode || this.terminalFailure || this.rejectionStatus) {
|
|
34708
34747
|
throw new Error("grok_redispatch_blocked");
|
|
34709
34748
|
}
|
|
@@ -34754,7 +34793,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
34754
34793
|
if (typeof value === "string") headers.set(name, value);
|
|
34755
34794
|
}
|
|
34756
34795
|
if (inference) {
|
|
34757
|
-
if (headers.has("x-grok-model-override") && headers.get("x-grok-model-override") !== this.
|
|
34796
|
+
if (headers.has("x-grok-model-override") && headers.get("x-grok-model-override") !== this.boundIdentity.transportModel) {
|
|
34758
34797
|
throw new Error("grok_outbound_model_or_effort_mismatch");
|
|
34759
34798
|
}
|
|
34760
34799
|
this.checkDispatch();
|
|
@@ -34792,6 +34831,29 @@ var init_grok_transport_proxy = __esm({
|
|
|
34792
34831
|
const value = upstream.headers.get(name);
|
|
34793
34832
|
if (value) responseHeaders[name] = value;
|
|
34794
34833
|
}
|
|
34834
|
+
if (metadata && route === "/models") {
|
|
34835
|
+
const chunks = [];
|
|
34836
|
+
let bytes3 = 0;
|
|
34837
|
+
const reader = upstream.body.getReader();
|
|
34838
|
+
try {
|
|
34839
|
+
for (; ; ) {
|
|
34840
|
+
if (controller.signal.aborted) throw new Error("grok_proxy_cancelled");
|
|
34841
|
+
const part = await reader.read();
|
|
34842
|
+
if (part.done) break;
|
|
34843
|
+
bytes3 += part.value.byteLength;
|
|
34844
|
+
if (bytes3 > this.options.maxResponseBytes) throw new Error("grok_response_too_large");
|
|
34845
|
+
chunks.push(part.value);
|
|
34846
|
+
}
|
|
34847
|
+
} finally {
|
|
34848
|
+
await reader.cancel().catch(() => void 0);
|
|
34849
|
+
}
|
|
34850
|
+
const catalogBytes = Buffer.concat(chunks);
|
|
34851
|
+
const catalog = parseGrokModelCatalog(JSON.parse(catalogBytes.toString("utf8")));
|
|
34852
|
+
if (!this.boundIdentity) this.catalogValue = catalog;
|
|
34853
|
+
response.writeHead(upstream.status, responseHeaders);
|
|
34854
|
+
response.end(catalogBytes);
|
|
34855
|
+
return;
|
|
34856
|
+
}
|
|
34795
34857
|
response.writeHead(upstream.status, responseHeaders);
|
|
34796
34858
|
await this.forward(upstream, response, inference ? route : null, controller.signal);
|
|
34797
34859
|
response.end();
|
|
@@ -34858,11 +34920,11 @@ var init_grok_transport_proxy = __esm({
|
|
|
34858
34920
|
const event = record3(JSON.parse(data4));
|
|
34859
34921
|
const native = route === "/responses" ? record3(event.response) : event;
|
|
34860
34922
|
if (native.id !== void 0 || native.model !== void 0) {
|
|
34861
|
-
if (typeof native.id !== "string" || !native.id || !
|
|
34923
|
+
if (typeof native.id !== "string" || !native.id || !this.boundIdentity.allowedEffectiveModels.includes(native.model) || id2 && native.id !== id2) {
|
|
34862
34924
|
const idPresent = typeof native.id === "string" && native.id.length > 0;
|
|
34863
34925
|
const modelPresent = typeof native.model === "string" && native.model.length > 0;
|
|
34864
34926
|
const modelMatches = native.model === this.options.requestedModel;
|
|
34865
|
-
if (idPresent && !modelMatches && id2 && native.id !== id2 &&
|
|
34927
|
+
if (idPresent && !modelMatches && id2 && native.id !== id2 && this.boundIdentity.allowedEffectiveModels.includes(native.model)) {
|
|
34866
34928
|
throw new Error("grok_provider_response_id_changed");
|
|
34867
34929
|
}
|
|
34868
34930
|
const eventType = route === "/responses" ? event.type : event.object;
|
|
@@ -35641,29 +35703,49 @@ var init_grok_adapter = __esm({
|
|
|
35641
35703
|
signal.throwIfAborted();
|
|
35642
35704
|
const workspace = await createGrokOwnedWorkspace(this.stateOptions, "preflight");
|
|
35643
35705
|
let session = null;
|
|
35706
|
+
let proxy = null;
|
|
35644
35707
|
try {
|
|
35645
35708
|
signal.throwIfAborted();
|
|
35646
|
-
session = new GrokAcpSession({ binaryPath: binary.path, grokHome: this.grokHome, cwd: workspace });
|
|
35647
|
-
this.active.add(session);
|
|
35648
35709
|
const deadline = Date.now() + 3e4;
|
|
35710
|
+
const policy = this.options.policy ?? await loadGrokPolicy();
|
|
35711
|
+
proxy = await createGrokTransportProxy({
|
|
35712
|
+
upstreamBaseUrl: policy.subscription_proxy_base_url,
|
|
35713
|
+
maxRequestBytes: policy.maximum_transport_request_bytes,
|
|
35714
|
+
maxResponseBytes: policy.maximum_transport_response_bytes,
|
|
35715
|
+
metadataOnly: true,
|
|
35716
|
+
requestedModel: "",
|
|
35717
|
+
requestedReasoningEffort: "none",
|
|
35718
|
+
expectedSystemPrompt: "",
|
|
35719
|
+
allowedToolNames: [],
|
|
35720
|
+
deadlineAtMs: deadline,
|
|
35721
|
+
signal,
|
|
35722
|
+
fetchImpl: this.options.fetchImpl
|
|
35723
|
+
});
|
|
35724
|
+
session = new GrokAcpSession({
|
|
35725
|
+
binaryPath: binary.path,
|
|
35726
|
+
grokHome: this.grokHome,
|
|
35727
|
+
cwd: workspace,
|
|
35728
|
+
config: { endpoints: { cli_chat_proxy_base_url: proxy.baseUrl } }
|
|
35729
|
+
});
|
|
35730
|
+
this.active.add(session);
|
|
35649
35731
|
await this.initialize(session, "VTX inference host capability discovery.", deadline, signal);
|
|
35650
35732
|
const auth = unwrap(await session.request("_x.ai/auth/info", {}, deadline, signal));
|
|
35651
35733
|
if (auth.methodId !== "cached_token" || auth.userBlockedReason || list(auth.teamBlockedReasons).length) {
|
|
35652
35734
|
throw new Error("grok_subscription_auth_unavailable");
|
|
35653
35735
|
}
|
|
35654
35736
|
const state = unwrap(await session.request("_x.ai/models/list", {}, deadline, signal));
|
|
35655
|
-
const
|
|
35656
|
-
|
|
35657
|
-
|
|
35658
|
-
allowedEffectiveModels:
|
|
35659
|
-
})
|
|
35737
|
+
const capabilities = grokModelCapabilities(state).map((capability) => {
|
|
35738
|
+
const identity3 = proxy.modelCatalog?.get(capability.model);
|
|
35739
|
+
if (!identity3) throw new Error("grok_model_catalog_identity_missing");
|
|
35740
|
+
return { ...capability, allowedEffectiveModels: identity3.allowedEffectiveModels };
|
|
35741
|
+
});
|
|
35660
35742
|
if (!capabilities.length) throw new Error("grok_model_catalog_empty");
|
|
35661
|
-
const
|
|
35662
|
-
if (!
|
|
35743
|
+
const identity2 = typeof auth.principalId === "string" && auth.principalId ? auth.principalId : typeof auth.email === "string" && auth.email ? auth.email.toLowerCase() : null;
|
|
35744
|
+
if (!identity2) throw new Error("grok_account_identity_required");
|
|
35663
35745
|
return {
|
|
35664
35746
|
adapterId: "grok-build",
|
|
35665
35747
|
runtimeVersion: binary.version,
|
|
35666
|
-
authenticatedAccountIdentity:
|
|
35748
|
+
authenticatedAccountIdentity: identity2,
|
|
35667
35749
|
authenticatedAccountEmail: typeof auth.email === "string" ? auth.email : null,
|
|
35668
35750
|
authenticatedAccountPlan: null,
|
|
35669
35751
|
modelCapabilities: capabilities,
|
|
@@ -35676,7 +35758,11 @@ var init_grok_adapter = __esm({
|
|
|
35676
35758
|
await session?.close();
|
|
35677
35759
|
} finally {
|
|
35678
35760
|
if (session) this.active.delete(session);
|
|
35679
|
-
|
|
35761
|
+
try {
|
|
35762
|
+
await proxy?.close();
|
|
35763
|
+
} finally {
|
|
35764
|
+
await releaseGrokOwnedWorkspace(this.stateOptions, workspace);
|
|
35765
|
+
}
|
|
35680
35766
|
}
|
|
35681
35767
|
}
|
|
35682
35768
|
}
|
|
@@ -35701,7 +35787,6 @@ var init_grok_adapter = __esm({
|
|
|
35701
35787
|
const startedAt = Date.now();
|
|
35702
35788
|
const binary = await this.binary();
|
|
35703
35789
|
const policy = this.options.policy ?? await loadGrokPolicy();
|
|
35704
|
-
const allowedEffectiveModels = grokAllowedEffectiveModels(policy, input.requestedModel);
|
|
35705
35790
|
input.signal.throwIfAborted();
|
|
35706
35791
|
const workspace = agent?.durableThread ? await validateGrokOwnedThread(this.stateOptions, agent.durableThread) : await createGrokOwnedWorkspace(this.stateOptions, agent ? "agent" : "attempt");
|
|
35707
35792
|
let mcp = null;
|
|
@@ -35757,7 +35842,6 @@ var init_grok_adapter = __esm({
|
|
|
35757
35842
|
expectedSystemPrompt: input.systemPrompt,
|
|
35758
35843
|
requestedModel: input.requestedModel,
|
|
35759
35844
|
requestedReasoningEffort: input.requestedReasoningEffort,
|
|
35760
|
-
allowedEffectiveModels,
|
|
35761
35845
|
allowedToolNames: agent ? ["search_tool", "use_tool"] : [],
|
|
35762
35846
|
deadlineAtMs: input.deadlineAtMs,
|
|
35763
35847
|
providerDispatchNotAfterMs: provider?.providerDispatchNotAfterMs,
|
|
@@ -35795,6 +35879,8 @@ var init_grok_adapter = __esm({
|
|
|
35795
35879
|
const catalog = unwrap(await session.request("_x.ai/models/list", {}, input.deadlineAtMs, input.signal));
|
|
35796
35880
|
const selectedCapability = grokModelCapabilities(catalog).find((entry) => entry.model === input.requestedModel);
|
|
35797
35881
|
if (!selectedCapability?.supportedReasoningEfforts.includes(input.requestedReasoningEffort)) throw new Error("grok_model_selection_unavailable");
|
|
35882
|
+
if (provider && !provider.allowedEffectiveModels) throw new Error("grok_model_identity_contract_missing");
|
|
35883
|
+
const { allowedEffectiveModels, transportModel } = proxy.bindModelIdentity(input.requestedModel, provider?.allowedEffectiveModels);
|
|
35798
35884
|
const metadata = {
|
|
35799
35885
|
systemPromptOverride: input.systemPrompt,
|
|
35800
35886
|
agentProfile: agentProfile(Boolean(agent)),
|
|
@@ -35821,6 +35907,14 @@ var init_grok_adapter = __esm({
|
|
|
35821
35907
|
_meta: metadata
|
|
35822
35908
|
}, input.deadlineAtMs, input.signal);
|
|
35823
35909
|
}
|
|
35910
|
+
if (transportModel !== input.requestedModel) {
|
|
35911
|
+
created = await session.request("session/load", {
|
|
35912
|
+
sessionId,
|
|
35913
|
+
cwd: workspace,
|
|
35914
|
+
mcpServers: mcp ? [mcp.descriptor] : [],
|
|
35915
|
+
_meta: metadata
|
|
35916
|
+
}, input.deadlineAtMs, input.signal);
|
|
35917
|
+
}
|
|
35824
35918
|
assertSelection(created, input.requestedModel, input.requestedReasoningEffort);
|
|
35825
35919
|
const thread = {
|
|
35826
35920
|
threadId: sessionId,
|
|
@@ -36024,7 +36118,7 @@ import { createServer as createServer5 } from "node:http";
|
|
|
36024
36118
|
import { access as access3, lstat as lstat8, readdir as readdir4, realpath as realpath7, rm as rm9 } from "node:fs/promises";
|
|
36025
36119
|
import { basename as basename4, dirname as dirname9, join as join12, resolve as resolve7 } from "node:path";
|
|
36026
36120
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
36027
|
-
var import_ajv2, failure,
|
|
36121
|
+
var import_ajv2, failure, object4, receiptUsage, assertOwnedRuntime, cleanupExoOwnedState, ExoForegroundAdapter;
|
|
36028
36122
|
var init_exo_adapter = __esm({
|
|
36029
36123
|
"lib/inference-host/exo-adapter.ts"() {
|
|
36030
36124
|
"use strict";
|
|
@@ -36042,9 +36136,9 @@ var init_exo_adapter = __esm({
|
|
|
36042
36136
|
retryable: false,
|
|
36043
36137
|
dispatchOutcome: dispatched ? "outcome_unknown" : "not_dispatched"
|
|
36044
36138
|
});
|
|
36045
|
-
|
|
36139
|
+
object4 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
36046
36140
|
receiptUsage = (value) => {
|
|
36047
|
-
const usage =
|
|
36141
|
+
const usage = object4(value);
|
|
36048
36142
|
for (const key of ["inputTokens", "cachedInputTokens", "outputTokens", "reasoningOutputTokens", "totalTokens"]) {
|
|
36049
36143
|
if (!Number.isSafeInteger(usage[key]) || Number(usage[key]) < 0) return null;
|
|
36050
36144
|
}
|
|
@@ -36063,7 +36157,7 @@ var init_exo_adapter = __esm({
|
|
|
36063
36157
|
const info = await lstat8(root);
|
|
36064
36158
|
if (!info.isDirectory() || info.isSymbolicLink() || await realpath7(root) !== root) throw failure("exo_state_not_owned");
|
|
36065
36159
|
const raw = await readInferencePrivateFile(join12(root, "vtx-owner.json"), "Exo state owner");
|
|
36066
|
-
const owner2 = raw === null ? {} :
|
|
36160
|
+
const owner2 = raw === null ? {} : object4(JSON.parse(raw));
|
|
36067
36161
|
if (owner2.adapter !== "exo" || owner2.id !== id2 || owner2.root !== root) throw failure("exo_state_not_owned");
|
|
36068
36162
|
};
|
|
36069
36163
|
cleanupExoOwnedState = async (stateRoot) => {
|
|
@@ -36265,7 +36359,7 @@ var init_exo_adapter = __esm({
|
|
|
36265
36359
|
raw += String(chunk);
|
|
36266
36360
|
if (Buffer.byteLength(raw) > 2e6) throw failure("exo_bridge_input_too_large");
|
|
36267
36361
|
}
|
|
36268
|
-
const body =
|
|
36362
|
+
const body = object4(JSON.parse(raw));
|
|
36269
36363
|
if (terminal || workerFailure) throw failure("exo_turn_already_finished");
|
|
36270
36364
|
if (request.url === "/dispatch") {
|
|
36271
36365
|
if (body.model !== providerModel || body.reasoningEffort !== input.requestedReasoningEffort) throw failure("exo_dispatch_identity_mismatch");
|
|
@@ -36282,7 +36376,7 @@ var init_exo_adapter = __esm({
|
|
|
36282
36376
|
if (!agent || !dispatched || toolBusy || typeof body.callId !== "string" || toolIds.has(body.callId) || !CODEX_AGENT_DYNAMIC_TOOLS.includes(body.tool) || body.effectiveModel !== input.requestedModel || body.effectiveReasoningEffort !== input.requestedReasoningEffort) throw failure("exo_tool_not_authorized");
|
|
36283
36377
|
toolBusy = true;
|
|
36284
36378
|
toolIds.add(body.callId);
|
|
36285
|
-
const call = { callId: body.callId, tool: body.tool, arguments:
|
|
36379
|
+
const call = { callId: body.callId, tool: body.tool, arguments: object4(body.arguments) };
|
|
36286
36380
|
try {
|
|
36287
36381
|
let result2;
|
|
36288
36382
|
try {
|
|
@@ -36500,11 +36594,11 @@ var init_exo_credential_store = __esm({
|
|
|
36500
36594
|
}
|
|
36501
36595
|
const provider = validateProvider(record4.provider);
|
|
36502
36596
|
const apiKey = validateApiKey(record4.api_key);
|
|
36503
|
-
const
|
|
36504
|
-
if (record4.schema_version !== 1 || record4.adapter !== "exo" || record4.identity !==
|
|
36597
|
+
const identity2 = credentialIdentity(provider, apiKey);
|
|
36598
|
+
if (record4.schema_version !== 1 || record4.adapter !== "exo" || record4.identity !== identity2 || Object.keys(record4).sort().join(",") !== "adapter,api_key,identity,provider,schema_version") {
|
|
36505
36599
|
throw new Error("Stored Exo credential failed validation.");
|
|
36506
36600
|
}
|
|
36507
|
-
return { provider, apiKey, identity };
|
|
36601
|
+
return { provider, apiKey, identity: identity2 };
|
|
36508
36602
|
};
|
|
36509
36603
|
serializeCredential = (provider, apiKey) => {
|
|
36510
36604
|
const validated = validateApiKey(apiKey);
|
|
@@ -36698,11 +36792,11 @@ var init_pi_credential_store = __esm({
|
|
|
36698
36792
|
const record4 = value;
|
|
36699
36793
|
const provider = validateProvider2(String(record4.provider ?? ""));
|
|
36700
36794
|
const apiKey = validateApiKey2(String(record4.api_key ?? ""));
|
|
36701
|
-
const
|
|
36702
|
-
if (record4.schema_version !== 1 || record4.adapter !== "pi" || record4.identity !==
|
|
36795
|
+
const identity2 = credentialIdentity2(provider, apiKey);
|
|
36796
|
+
if (record4.schema_version !== 1 || record4.adapter !== "pi" || record4.identity !== identity2 || Object.keys(record4).sort().join(",") !== "adapter,api_key,identity,provider,schema_version") {
|
|
36703
36797
|
throw new Error("Stored Pi credential failed validation.");
|
|
36704
36798
|
}
|
|
36705
|
-
return { provider, apiKey, identity };
|
|
36799
|
+
return { provider, apiKey, identity: identity2 };
|
|
36706
36800
|
};
|
|
36707
36801
|
serializeCredential2 = (provider, apiKey) => {
|
|
36708
36802
|
const validated = validateApiKey2(apiKey);
|
|
@@ -36854,11 +36948,11 @@ var init_deepseek_credential_store = __esm({
|
|
|
36854
36948
|
}
|
|
36855
36949
|
const record4 = value;
|
|
36856
36950
|
const apiKey = validateApiKey3(String(record4.api_key ?? ""));
|
|
36857
|
-
const
|
|
36858
|
-
if (record4.schema_version !== 1 || record4.adapter !== "deepseek-harness" || record4.identity !==
|
|
36951
|
+
const identity2 = credentialIdentity3(apiKey);
|
|
36952
|
+
if (record4.schema_version !== 1 || record4.adapter !== "deepseek-harness" || record4.identity !== identity2 || Object.keys(record4).sort().join(",") !== "adapter,api_key,identity,schema_version") {
|
|
36859
36953
|
throw new Error("Stored DeepSeek Harness credential failed validation.");
|
|
36860
36954
|
}
|
|
36861
|
-
return { apiKey, identity };
|
|
36955
|
+
return { apiKey, identity: identity2 };
|
|
36862
36956
|
};
|
|
36863
36957
|
serializeCredential3 = (apiKey) => {
|
|
36864
36958
|
const validated = validateApiKey3(apiKey);
|
|
@@ -37112,8 +37206,8 @@ var init_crypto = __esm({
|
|
|
37112
37206
|
cipher.setAAD(aad);
|
|
37113
37207
|
return Buffer.concat([cipher.update(plaintext), cipher.final(), cipher.getAuthTag()]);
|
|
37114
37208
|
};
|
|
37115
|
-
assertIdentity = (aad,
|
|
37116
|
-
if (aad.job_id !==
|
|
37209
|
+
assertIdentity = (aad, identity2) => {
|
|
37210
|
+
if (aad.job_id !== identity2.job_id || aad.host_id !== identity2.host_id || aad.host_generation !== identity2.host_generation || aad.key_generation !== identity2.key_generation || aad.claim_generation !== identity2.claim_generation) {
|
|
37117
37211
|
throw new ExternalInferenceEnvelopeError(
|
|
37118
37212
|
"identity_mismatch",
|
|
37119
37213
|
"External inference envelope identity is invalid."
|
|
@@ -37270,7 +37364,7 @@ var init_crypto = __esm({
|
|
|
37270
37364
|
"External inference claim does not contain a job."
|
|
37271
37365
|
);
|
|
37272
37366
|
}
|
|
37273
|
-
const
|
|
37367
|
+
const identity2 = {
|
|
37274
37368
|
job_id: claim.job_id,
|
|
37275
37369
|
host_id: claim.host_id,
|
|
37276
37370
|
host_generation: claim.host_generation,
|
|
@@ -37280,9 +37374,9 @@ var init_crypto = __esm({
|
|
|
37280
37374
|
const jobKey = unwrapExternalInferenceJobKey(
|
|
37281
37375
|
hostPrivateKey,
|
|
37282
37376
|
claim.sealed_job_key,
|
|
37283
|
-
|
|
37377
|
+
identity2
|
|
37284
37378
|
);
|
|
37285
|
-
const jobInput = decryptExternalInferenceJobInput(jobKey, claim.sealed_input,
|
|
37379
|
+
const jobInput = decryptExternalInferenceJobInput(jobKey, claim.sealed_input, identity2);
|
|
37286
37380
|
if (jobInput.advertisement_generation !== claim.advertisement_generation || jobInput.controller_generation !== claim.controller_generation || jobInput.input_sha256 !== claim.input_sha256 || jobInput.requested_model !== claim.requested_model || jobInput.requested_reasoning_effort !== claim.requested_reasoning_effort || jobInput.response_mode !== claim.response_mode || jobInput.output_schema_version !== claim.output_schema_version) {
|
|
37287
37381
|
throw new ExternalInferenceEnvelopeError(
|
|
37288
37382
|
"identity_mismatch",
|
|
@@ -40295,6 +40389,9 @@ var init_runner = __esm({
|
|
|
40295
40389
|
userPrompt: jobInput.user_prompt,
|
|
40296
40390
|
outputSchemaJson: outputContract.adapterSchemaJson,
|
|
40297
40391
|
requestedModel: jobInput.requested_model,
|
|
40392
|
+
allowedEffectiveModels: jobInput.allowed_model_identities.find(
|
|
40393
|
+
(mapping2) => mapping2.requested_model === jobInput.requested_model
|
|
40394
|
+
)?.effective_models,
|
|
40298
40395
|
requestedReasoningEffort: jobInput.requested_reasoning_effort,
|
|
40299
40396
|
deadlineAtMs: Date.parse(jobInput.deadline_at),
|
|
40300
40397
|
...providerDispatchNotAfterMs === void 0 ? {} : { providerDispatchNotAfterMs },
|
|
@@ -42083,8 +42180,8 @@ WantedBy=default.target
|
|
|
42083
42180
|
}
|
|
42084
42181
|
}
|
|
42085
42182
|
windowsTaskName() {
|
|
42086
|
-
const
|
|
42087
|
-
return `VTX Macro Inference Host (${
|
|
42183
|
+
const identity2 = this.username.replaceAll(/[^A-Za-z0-9_.@-]+/gu, "_").slice(-80) || "current-user";
|
|
42184
|
+
return `VTX Macro Inference Host (${identity2})`;
|
|
42088
42185
|
}
|
|
42089
42186
|
windowsPowerShell(script) {
|
|
42090
42187
|
return [
|
|
@@ -46307,16 +46404,16 @@ Waiting for approval...
|
|
|
46307
46404
|
hasExplicitCredentialStoreConfiguration = (env) => Boolean(
|
|
46308
46405
|
String(env.VTX_INFERENCE_HOST_CREDENTIAL_STORE || "").trim() || String(env.VTX_INFERENCE_HOST_CREDENTIAL_FILE || "").trim()
|
|
46309
46406
|
);
|
|
46310
|
-
credentialEnvironmentForIdentity = (
|
|
46311
|
-
if (
|
|
46312
|
-
const path =
|
|
46407
|
+
credentialEnvironmentForIdentity = (identity2) => {
|
|
46408
|
+
if (identity2.startsWith("file:")) {
|
|
46409
|
+
const path = identity2.slice("file:".length);
|
|
46313
46410
|
if (!path) throw new Error("Inference host credential store identity is invalid.");
|
|
46314
46411
|
return {
|
|
46315
46412
|
VTX_INFERENCE_HOST_CREDENTIAL_STORE: "file",
|
|
46316
46413
|
VTX_INFERENCE_HOST_CREDENTIAL_FILE: path
|
|
46317
46414
|
};
|
|
46318
46415
|
}
|
|
46319
|
-
if (
|
|
46416
|
+
if (identity2.startsWith("os:")) {
|
|
46320
46417
|
return {
|
|
46321
46418
|
VTX_INFERENCE_HOST_CREDENTIAL_STORE: "os",
|
|
46322
46419
|
VTX_INFERENCE_HOST_CREDENTIAL_FILE: void 0
|
|
@@ -54116,10 +54213,10 @@ function arrayifyInteger(value) {
|
|
|
54116
54213
|
}
|
|
54117
54214
|
return result2;
|
|
54118
54215
|
}
|
|
54119
|
-
function _encode2(
|
|
54120
|
-
if (Array.isArray(
|
|
54216
|
+
function _encode2(object6) {
|
|
54217
|
+
if (Array.isArray(object6)) {
|
|
54121
54218
|
let payload = [];
|
|
54122
|
-
|
|
54219
|
+
object6.forEach(function(child) {
|
|
54123
54220
|
payload = payload.concat(_encode2(child));
|
|
54124
54221
|
});
|
|
54125
54222
|
if (payload.length <= 55) {
|
|
@@ -54130,7 +54227,7 @@ function _encode2(object5) {
|
|
|
54130
54227
|
length2.unshift(247 + length2.length);
|
|
54131
54228
|
return length2.concat(payload);
|
|
54132
54229
|
}
|
|
54133
|
-
const data4 = Array.prototype.slice.call(getBytes(
|
|
54230
|
+
const data4 = Array.prototype.slice.call(getBytes(object6, "object"));
|
|
54134
54231
|
if (data4.length === 1 && data4[0] <= 127) {
|
|
54135
54232
|
return data4;
|
|
54136
54233
|
} else if (data4.length <= 55) {
|
|
@@ -54141,9 +54238,9 @@ function _encode2(object5) {
|
|
|
54141
54238
|
length.unshift(183 + length.length);
|
|
54142
54239
|
return length.concat(data4);
|
|
54143
54240
|
}
|
|
54144
|
-
function encodeRlp(
|
|
54241
|
+
function encodeRlp(object6) {
|
|
54145
54242
|
let result2 = "0x";
|
|
54146
|
-
for (const v of _encode2(
|
|
54243
|
+
for (const v of _encode2(object6)) {
|
|
54147
54244
|
result2 += nibbles[v >> 4];
|
|
54148
54245
|
result2 += nibbles[v & 15];
|
|
54149
54246
|
}
|
|
@@ -54291,15 +54388,15 @@ function toObject(names2, items, deep) {
|
|
|
54291
54388
|
}
|
|
54292
54389
|
function checkResultErrors(result2) {
|
|
54293
54390
|
const errors = [];
|
|
54294
|
-
const checkErrors = function(path,
|
|
54295
|
-
if (!Array.isArray(
|
|
54391
|
+
const checkErrors = function(path, object6) {
|
|
54392
|
+
if (!Array.isArray(object6)) {
|
|
54296
54393
|
return;
|
|
54297
54394
|
}
|
|
54298
|
-
for (let key in
|
|
54395
|
+
for (let key in object6) {
|
|
54299
54396
|
const childPath = path.slice();
|
|
54300
54397
|
childPath.push(key);
|
|
54301
54398
|
try {
|
|
54302
|
-
checkErrors(childPath,
|
|
54399
|
+
checkErrors(childPath, object6[key]);
|
|
54303
54400
|
} catch (error48) {
|
|
54304
54401
|
errors.push({ path: childPath, error: error48 });
|
|
54305
54402
|
}
|
|
@@ -56549,15 +56646,15 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
56549
56646
|
};
|
|
56550
56647
|
return genUntil;
|
|
56551
56648
|
}
|
|
56552
|
-
function validateObject(
|
|
56649
|
+
function validateObject(object6, validators, optValidators = {}) {
|
|
56553
56650
|
const checkField = (fieldName, type, isOptional) => {
|
|
56554
56651
|
const checkVal = validatorFns[type];
|
|
56555
56652
|
if (typeof checkVal !== "function")
|
|
56556
56653
|
throw new Error(`Invalid validator "${type}", expected function`);
|
|
56557
|
-
const val =
|
|
56654
|
+
const val = object6[fieldName];
|
|
56558
56655
|
if (isOptional && val === void 0)
|
|
56559
56656
|
return;
|
|
56560
|
-
if (!checkVal(val,
|
|
56657
|
+
if (!checkVal(val, object6)) {
|
|
56561
56658
|
throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);
|
|
56562
56659
|
}
|
|
56563
56660
|
};
|
|
@@ -56565,7 +56662,7 @@ function validateObject(object5, validators, optValidators = {}) {
|
|
|
56565
56662
|
checkField(fieldName, type, false);
|
|
56566
56663
|
for (const [fieldName, type] of Object.entries(optValidators))
|
|
56567
56664
|
checkField(fieldName, type, true);
|
|
56568
|
-
return
|
|
56665
|
+
return object6;
|
|
56569
56666
|
}
|
|
56570
56667
|
var _0n2, _1n2, _2n2, u8a3, hexes, bitSet, bitMask, u8n, u8fr, validatorFns;
|
|
56571
56668
|
var init_utils4 = __esm({
|
|
@@ -56592,7 +56689,7 @@ var init_utils4 = __esm({
|
|
|
56592
56689
|
stringOrUint8Array: (val) => typeof val === "string" || val instanceof Uint8Array,
|
|
56593
56690
|
isSafeInteger: (val) => Number.isSafeInteger(val),
|
|
56594
56691
|
array: (val) => Array.isArray(val),
|
|
56595
|
-
field: (val,
|
|
56692
|
+
field: (val, object6) => object6.Fp.isValid(val),
|
|
56596
56693
|
hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
|
|
56597
56694
|
};
|
|
56598
56695
|
}
|
|
@@ -68330,7 +68427,7 @@ function arrayOf(format, allowNull2) {
|
|
|
68330
68427
|
return array2.map((i) => format(i));
|
|
68331
68428
|
});
|
|
68332
68429
|
}
|
|
68333
|
-
function
|
|
68430
|
+
function object5(format, altNames) {
|
|
68334
68431
|
return ((value) => {
|
|
68335
68432
|
const result2 = {};
|
|
68336
68433
|
for (const key in format) {
|
|
@@ -68398,7 +68495,7 @@ function formatTransactionResponse(value) {
|
|
|
68398
68495
|
if (value.to && getBigInt(value.to) === BN_011) {
|
|
68399
68496
|
value.to = "0x0000000000000000000000000000000000000000";
|
|
68400
68497
|
}
|
|
68401
|
-
const result2 =
|
|
68498
|
+
const result2 = object5({
|
|
68402
68499
|
hash: formatHash,
|
|
68403
68500
|
// Some nodes do not return this, usually test nodes (like Ganache)
|
|
68404
68501
|
index: allowNull(getNumber, void 0),
|
|
@@ -68484,7 +68581,7 @@ var init_format = __esm({
|
|
|
68484
68581
|
init_transaction2();
|
|
68485
68582
|
init_utils();
|
|
68486
68583
|
BN_011 = BigInt(0);
|
|
68487
|
-
_formatLog =
|
|
68584
|
+
_formatLog = object5({
|
|
68488
68585
|
address: getAddress,
|
|
68489
68586
|
blockHash: formatHash,
|
|
68490
68587
|
blockNumber: getNumber,
|
|
@@ -68497,7 +68594,7 @@ var init_format = __esm({
|
|
|
68497
68594
|
}, {
|
|
68498
68595
|
index: ["logIndex"]
|
|
68499
68596
|
});
|
|
68500
|
-
_formatBlock =
|
|
68597
|
+
_formatBlock = object5({
|
|
68501
68598
|
hash: allowNull(formatHash),
|
|
68502
68599
|
parentHash: formatHash,
|
|
68503
68600
|
parentBeaconBlockRoot: allowNull(formatHash, null),
|
|
@@ -68518,7 +68615,7 @@ var init_format = __esm({
|
|
|
68518
68615
|
}, {
|
|
68519
68616
|
prevRandao: ["mixHash"]
|
|
68520
68617
|
});
|
|
68521
|
-
_formatReceiptLog =
|
|
68618
|
+
_formatReceiptLog = object5({
|
|
68522
68619
|
transactionIndex: getNumber,
|
|
68523
68620
|
blockNumber: getNumber,
|
|
68524
68621
|
transactionHash: formatHash,
|
|
@@ -68530,7 +68627,7 @@ var init_format = __esm({
|
|
|
68530
68627
|
}, {
|
|
68531
68628
|
index: ["logIndex"]
|
|
68532
68629
|
});
|
|
68533
|
-
_formatTransactionReceipt =
|
|
68630
|
+
_formatTransactionReceipt = object5({
|
|
68534
68631
|
to: allowNull(getAddress, null),
|
|
68535
68632
|
from: allowNull(getAddress, null),
|
|
68536
68633
|
contractAddress: allowNull(getAddress, null),
|
|
@@ -79336,13 +79433,13 @@ function getPassword(password) {
|
|
|
79336
79433
|
}
|
|
79337
79434
|
return getBytesCopy(password);
|
|
79338
79435
|
}
|
|
79339
|
-
function spelunk(
|
|
79436
|
+
function spelunk(object6, _path) {
|
|
79340
79437
|
const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);
|
|
79341
79438
|
assertArgument(match != null, "invalid path", "path", _path);
|
|
79342
79439
|
const path = match[1];
|
|
79343
79440
|
const type = match[3];
|
|
79344
79441
|
const reqd = match[4] === "!";
|
|
79345
|
-
let cur =
|
|
79442
|
+
let cur = object6;
|
|
79346
79443
|
for (const comp of path.toLowerCase().split(".")) {
|
|
79347
79444
|
if (Array.isArray(cur)) {
|
|
79348
79445
|
if (!comp.match(/^[0-9]+$/)) {
|