@vtxmacro/cli 2026.9.34 → 2026.9.35
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 +52 -11
- 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.35",
|
|
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, effective_model_aliases: { "grok-4.5": ["grok-4.5-build"] } };
|
|
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.35",
|
|
81
81
|
codex_package_name: "@openai/codex",
|
|
82
82
|
codex_version: "0.153.3",
|
|
83
83
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -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, loadGrokPolicy;
|
|
34487
|
+
var validateGrokPolicy, grokAllowedEffectiveModels, loadGrokPolicy;
|
|
34488
34488
|
var init_grok_policy = __esm({
|
|
34489
34489
|
"lib/inference-host/grok-policy.ts"() {
|
|
34490
34490
|
"use strict";
|
|
@@ -34502,12 +34502,26 @@ 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
|
+
));
|
|
34505
34517
|
return Object.freeze({
|
|
34506
34518
|
subscription_proxy_base_url: url2.href,
|
|
34507
34519
|
maximum_transport_request_bytes: Number(policy.maximum_transport_request_bytes),
|
|
34508
|
-
maximum_transport_response_bytes: Number(policy.maximum_transport_response_bytes)
|
|
34520
|
+
maximum_transport_response_bytes: Number(policy.maximum_transport_response_bytes),
|
|
34521
|
+
effective_model_aliases: effectiveModelAliases
|
|
34509
34522
|
});
|
|
34510
34523
|
};
|
|
34524
|
+
grokAllowedEffectiveModels = (policy, requested) => Object.freeze([requested, ...Object.hasOwn(policy.effective_model_aliases, requested) ? policy.effective_model_aliases[requested] : []]);
|
|
34511
34525
|
loadGrokPolicy = async () => {
|
|
34512
34526
|
if (typeof define_VTX_GROK_POLICY_default !== "undefined") return validateGrokPolicy(define_VTX_GROK_POLICY_default);
|
|
34513
34527
|
const config2 = parse3(await readFile6(resolve5(dirname7(fileURLToPath(import.meta.url)), "../../../config.toml"), "utf8"));
|
|
@@ -34560,6 +34574,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
34560
34574
|
this.requestFingerprints = /* @__PURE__ */ new Set();
|
|
34561
34575
|
this.pending = false;
|
|
34562
34576
|
this.closed = false;
|
|
34577
|
+
this.observedModel = null;
|
|
34563
34578
|
this.dispatched = false;
|
|
34564
34579
|
this.responded = false;
|
|
34565
34580
|
this.failureCode = null;
|
|
@@ -34568,6 +34583,10 @@ var init_grok_transport_proxy = __esm({
|
|
|
34568
34583
|
this.toolValidationFailure = null;
|
|
34569
34584
|
this.responseIdentityFailure = null;
|
|
34570
34585
|
const upstream = new URL(options.upstreamBaseUrl);
|
|
34586
|
+
const models = options.allowedEffectiveModels ?? [options.requestedModel];
|
|
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
|
+
}
|
|
34571
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");
|
|
34572
34591
|
}
|
|
34573
34592
|
get baseUrl() {
|
|
@@ -34741,6 +34760,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
34741
34760
|
this.checkDispatch();
|
|
34742
34761
|
this.options.onProviderDispatch?.();
|
|
34743
34762
|
this.checkDispatch();
|
|
34763
|
+
this.observedModel = null;
|
|
34744
34764
|
this.dispatched = true;
|
|
34745
34765
|
}
|
|
34746
34766
|
const upstream = await (this.options.fetchImpl ?? fetch)(
|
|
@@ -34838,10 +34858,13 @@ var init_grok_transport_proxy = __esm({
|
|
|
34838
34858
|
const event = record3(JSON.parse(data4));
|
|
34839
34859
|
const native = route === "/responses" ? record3(event.response) : event;
|
|
34840
34860
|
if (native.id !== void 0 || native.model !== void 0) {
|
|
34841
|
-
if (typeof native.id !== "string" || !native.id ||
|
|
34861
|
+
if (typeof native.id !== "string" || !native.id || !(this.options.allowedEffectiveModels ?? [this.options.requestedModel]).includes(native.model) || id2 && native.id !== id2) {
|
|
34842
34862
|
const idPresent = typeof native.id === "string" && native.id.length > 0;
|
|
34843
34863
|
const modelPresent = typeof native.model === "string" && native.model.length > 0;
|
|
34844
34864
|
const modelMatches = native.model === this.options.requestedModel;
|
|
34865
|
+
if (idPresent && !modelMatches && id2 && native.id !== id2 && (this.options.allowedEffectiveModels ?? [this.options.requestedModel]).includes(native.model)) {
|
|
34866
|
+
throw new Error("grok_provider_response_id_changed");
|
|
34867
|
+
}
|
|
34845
34868
|
const eventType = route === "/responses" ? event.type : event.object;
|
|
34846
34869
|
this.responseIdentityFailure = grokResponseIdentityDiagnosticSchema.parse({
|
|
34847
34870
|
schema_version: "external_inference_grok_response_identity_v1",
|
|
@@ -34860,8 +34883,10 @@ var init_grok_transport_proxy = __esm({
|
|
|
34860
34883
|
}
|
|
34861
34884
|
throw new Error("grok_provider_identity_mismatch");
|
|
34862
34885
|
}
|
|
34886
|
+
if (model && native.model !== model) throw new Error("grok_provider_model_changed");
|
|
34863
34887
|
id2 = native.id;
|
|
34864
34888
|
model = String(native.model);
|
|
34889
|
+
this.observedModel = model;
|
|
34865
34890
|
}
|
|
34866
34891
|
const responseEffort = native.reasoning_effort ?? record3(native.reasoning).effort;
|
|
34867
34892
|
if (responseEffort != null && effort(responseEffort) !== effort(this.options.requestedReasoningEffort)) {
|
|
@@ -35518,11 +35543,11 @@ var init_grok_adapter = __esm({
|
|
|
35518
35543
|
isDefault: state.currentModelId === model.modelId
|
|
35519
35544
|
}];
|
|
35520
35545
|
});
|
|
35521
|
-
grokPromptUsage = (value, expectedModel) => {
|
|
35546
|
+
grokPromptUsage = (value, expectedModel, allowedEffectiveModels = [expectedModel]) => {
|
|
35522
35547
|
const usage = grokObject(value);
|
|
35523
35548
|
if (usage.usageIsIncomplete === true) throw new Error("grok_usage_incomplete");
|
|
35524
35549
|
const models = Object.keys(grokObject(usage.modelUsage));
|
|
35525
|
-
if (models.length !== 1 || models[0]
|
|
35550
|
+
if (models.length !== 1 || !allowedEffectiveModels.includes(models[0])) throw new Error("grok_effective_model_mismatch");
|
|
35526
35551
|
const inputTokens = integer2(usage.inputTokens, "input_tokens");
|
|
35527
35552
|
const outputTokens = integer2(usage.outputTokens, "output_tokens");
|
|
35528
35553
|
const cachedInputTokens = integer2(usage.cachedReadTokens, "cached_input_tokens");
|
|
@@ -35627,7 +35652,11 @@ var init_grok_adapter = __esm({
|
|
|
35627
35652
|
throw new Error("grok_subscription_auth_unavailable");
|
|
35628
35653
|
}
|
|
35629
35654
|
const state = unwrap(await session.request("_x.ai/models/list", {}, deadline, signal));
|
|
35630
|
-
const
|
|
35655
|
+
const policy = this.options.policy ?? await loadGrokPolicy();
|
|
35656
|
+
const capabilities = grokModelCapabilities(state).map((capability) => ({
|
|
35657
|
+
...capability,
|
|
35658
|
+
allowedEffectiveModels: grokAllowedEffectiveModels(policy, capability.model)
|
|
35659
|
+
}));
|
|
35631
35660
|
if (!capabilities.length) throw new Error("grok_model_catalog_empty");
|
|
35632
35661
|
const identity = typeof auth.principalId === "string" && auth.principalId ? auth.principalId : typeof auth.email === "string" && auth.email ? auth.email.toLowerCase() : null;
|
|
35633
35662
|
if (!identity) throw new Error("grok_account_identity_required");
|
|
@@ -35672,6 +35701,7 @@ var init_grok_adapter = __esm({
|
|
|
35672
35701
|
const startedAt = Date.now();
|
|
35673
35702
|
const binary = await this.binary();
|
|
35674
35703
|
const policy = this.options.policy ?? await loadGrokPolicy();
|
|
35704
|
+
const allowedEffectiveModels = grokAllowedEffectiveModels(policy, input.requestedModel);
|
|
35675
35705
|
input.signal.throwIfAborted();
|
|
35676
35706
|
const workspace = agent?.durableThread ? await validateGrokOwnedThread(this.stateOptions, agent.durableThread) : await createGrokOwnedWorkspace(this.stateOptions, agent ? "agent" : "attempt");
|
|
35677
35707
|
let mcp = null;
|
|
@@ -35681,6 +35711,7 @@ var init_grok_adapter = __esm({
|
|
|
35681
35711
|
let retained = Boolean(agent?.durableThread);
|
|
35682
35712
|
let thought = "";
|
|
35683
35713
|
let firstToken = null;
|
|
35714
|
+
let activeThread = null;
|
|
35684
35715
|
try {
|
|
35685
35716
|
input.signal.throwIfAborted();
|
|
35686
35717
|
const evidence = [];
|
|
@@ -35707,6 +35738,12 @@ var init_grok_adapter = __esm({
|
|
|
35707
35738
|
} }
|
|
35708
35739
|
] : [];
|
|
35709
35740
|
mcp = agent ? await createGrokToolServer({ tools, signal: input.signal, execute: async (name, args) => {
|
|
35741
|
+
const observedModel = proxy?.observedModel;
|
|
35742
|
+
if (!activeThread || !observedModel) throw new Error("grok_tool_provenance_missing");
|
|
35743
|
+
if (activeThread.effectiveModel !== observedModel) {
|
|
35744
|
+
activeThread = { ...activeThread, effectiveModel: observedModel };
|
|
35745
|
+
await agent.onThreadReady?.(activeThread);
|
|
35746
|
+
}
|
|
35710
35747
|
const callId = randomUUID5();
|
|
35711
35748
|
const tool = name;
|
|
35712
35749
|
const result3 = await agent.executeTool({ callId, tool, arguments: args });
|
|
@@ -35720,6 +35757,7 @@ var init_grok_adapter = __esm({
|
|
|
35720
35757
|
expectedSystemPrompt: input.systemPrompt,
|
|
35721
35758
|
requestedModel: input.requestedModel,
|
|
35722
35759
|
requestedReasoningEffort: input.requestedReasoningEffort,
|
|
35760
|
+
allowedEffectiveModels,
|
|
35723
35761
|
allowedToolNames: agent ? ["search_tool", "use_tool"] : [],
|
|
35724
35762
|
deadlineAtMs: input.deadlineAtMs,
|
|
35725
35763
|
providerDispatchNotAfterMs: provider?.providerDispatchNotAfterMs,
|
|
@@ -35790,6 +35828,7 @@ var init_grok_adapter = __esm({
|
|
|
35790
35828
|
effectiveModel: input.requestedModel,
|
|
35791
35829
|
effectiveReasoningEffort: input.requestedReasoningEffort
|
|
35792
35830
|
};
|
|
35831
|
+
activeThread = thread;
|
|
35793
35832
|
if (agent) {
|
|
35794
35833
|
await agent.onThreadReady?.(thread);
|
|
35795
35834
|
retained = true;
|
|
@@ -35814,15 +35853,17 @@ var init_grok_adapter = __esm({
|
|
|
35814
35853
|
if (meta3.structuredOutputError || meta3.structuredOutput === void 0) throw new Error("grok_structured_output_missing");
|
|
35815
35854
|
const text = JSON.stringify(meta3.structuredOutput);
|
|
35816
35855
|
if (Buffer.byteLength(text) > 3e5) throw new Error("grok_result_too_large");
|
|
35817
|
-
const usage = grokPromptUsage(meta3.usage, input.requestedModel);
|
|
35856
|
+
const usage = grokPromptUsage(meta3.usage, input.requestedModel, allowedEffectiveModels);
|
|
35818
35857
|
const actualModel = Object.keys(grokObject(grokObject(meta3.usage).modelUsage))[0];
|
|
35819
35858
|
if (!proxy.dispatched || !proxy.responded || proxy.terminalFailure) throw new Error(proxy.failureCode ?? "grok_transport_receipt_missing");
|
|
35820
35859
|
const receipts = proxy.receipts;
|
|
35821
35860
|
if (!receipts.length || proxy.pendingRequest || receipts.some((receipt) => receipt.model !== actualModel || receipt.requestedReasoningEffort !== input.requestedReasoningEffort || receipt.input === null || receipt.output === null || receipt.cachedInput === null) || receipts.reduce((sum, receipt) => sum + receipt.input, 0) !== usage.inputTokens || receipts.reduce((sum, receipt) => sum + receipt.output, 0) !== usage.outputTokens || receipts.reduce((sum, receipt) => sum + receipt.cachedInput, 0) !== usage.cachedInputTokens || integer2(grokObject(meta3.usage).modelCalls, "model_calls") !== receipts.length) {
|
|
35822
35861
|
throw new Error("grok_transport_usage_mismatch");
|
|
35823
35862
|
}
|
|
35863
|
+
const effectiveThread = { ...thread, effectiveModel: actualModel };
|
|
35864
|
+
if (agent && activeThread.effectiveModel !== actualModel) await agent.onThreadReady?.(effectiveThread);
|
|
35824
35865
|
provider?.onTerminalDispatchOutcome?.("confirmed_dispatched");
|
|
35825
|
-
return { thread, turn: {
|
|
35866
|
+
return { thread: effectiveThread, turn: {
|
|
35826
35867
|
text,
|
|
35827
35868
|
reasoningContent: thought || null,
|
|
35828
35869
|
reasoningSummary: null,
|
|
@@ -37400,7 +37441,7 @@ var init_runner = __esm({
|
|
|
37400
37441
|
supported_control_modes: [...supportedControlModes],
|
|
37401
37442
|
allowed_model_identities: [{
|
|
37402
37443
|
requested_model: capability.model,
|
|
37403
|
-
effective_models: [capability.model]
|
|
37444
|
+
effective_models: [...capability.allowedEffectiveModels ?? [capability.model]]
|
|
37404
37445
|
}],
|
|
37405
37446
|
structured_output: structuredOutput,
|
|
37406
37447
|
same_attempt_recovery: sameAttemptRecovery,
|