@vtxmacro/cli 2026.9.30 → 2026.9.31
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 +80 -15
- 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.31",
|
|
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
|
@@ -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.31",
|
|
81
81
|
codex_package_name: "@openai/codex",
|
|
82
82
|
codex_version: "0.153.3",
|
|
83
83
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -34407,13 +34407,30 @@ var init_grok_policy = __esm({
|
|
|
34407
34407
|
import { createServer as createServer3 } from "node:http";
|
|
34408
34408
|
import { createHash as createHash6, randomBytes as randomBytes5 } from "node:crypto";
|
|
34409
34409
|
import { once } from "node:events";
|
|
34410
|
-
var record3, count2, effort, safeCode2, GrokTransportProxy, createGrokTransportProxy;
|
|
34410
|
+
var diagnosticNames, diagnosticTypes, diagnosticIdentifier, record3, count2, effort, safeCode2, GrokTransportProxy, createGrokTransportProxy;
|
|
34411
34411
|
var init_grok_transport_proxy = __esm({
|
|
34412
34412
|
"lib/inference-host/grok-transport-proxy.ts"() {
|
|
34413
34413
|
"use strict";
|
|
34414
34414
|
init_define_VTX_EXO_POLICY();
|
|
34415
34415
|
init_define_VTX_GROK_POLICY();
|
|
34416
34416
|
init_define_VTX_PI_MODEL_POLICY();
|
|
34417
|
+
diagnosticNames = /* @__PURE__ */ new Set([
|
|
34418
|
+
"search_tool",
|
|
34419
|
+
"use_tool",
|
|
34420
|
+
"bash",
|
|
34421
|
+
"read_file",
|
|
34422
|
+
"write_file",
|
|
34423
|
+
"edit_file",
|
|
34424
|
+
"web_search",
|
|
34425
|
+
"vtx_get_data",
|
|
34426
|
+
"vtx_submit_decision",
|
|
34427
|
+
"vtx_decision_status"
|
|
34428
|
+
]);
|
|
34429
|
+
diagnosticTypes = /* @__PURE__ */ new Set(["function", "web_search", "web_search_preview", "file_search", "computer_use"]);
|
|
34430
|
+
diagnosticIdentifier = (value, known) => {
|
|
34431
|
+
if (typeof value !== "string") return { label: value == null ? "missing" : "invalid", sha256: null };
|
|
34432
|
+
return known.has(value) ? { label: value, sha256: null } : { label: "redacted", sha256: createHash6("sha256").update(value).digest("hex") };
|
|
34433
|
+
};
|
|
34417
34434
|
record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
34418
34435
|
count2 = (value) => Number.isSafeInteger(value) && Number(value) >= 0 ? Number(value) : null;
|
|
34419
34436
|
effort = (value) => value == null ? "none" : String(value).toLowerCase();
|
|
@@ -34434,6 +34451,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
34434
34451
|
this.failureCode = null;
|
|
34435
34452
|
this.rejectionStatus = null;
|
|
34436
34453
|
this.terminalFailure = null;
|
|
34454
|
+
this.toolValidationFailure = null;
|
|
34437
34455
|
const upstream = new URL(options.upstreamBaseUrl);
|
|
34438
34456
|
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");
|
|
34439
34457
|
}
|
|
@@ -34471,6 +34489,31 @@ var init_grok_transport_proxy = __esm({
|
|
|
34471
34489
|
throw new Error("server_account_context_expired_before_provider_dispatch");
|
|
34472
34490
|
}
|
|
34473
34491
|
}
|
|
34492
|
+
rejectTools(reason, payload, route) {
|
|
34493
|
+
const tools = Array.isArray(payload.tools) ? payload.tools : null;
|
|
34494
|
+
const diagnostic = {
|
|
34495
|
+
reason,
|
|
34496
|
+
route,
|
|
34497
|
+
tools_shape: tools ? "array" : payload.tools === null ? "null" : typeof payload.tools,
|
|
34498
|
+
tool_count: tools?.length ?? null,
|
|
34499
|
+
expected_tool_count: this.options.allowedToolNames.length,
|
|
34500
|
+
tools: (tools ?? []).slice(0, 8).map((value) => {
|
|
34501
|
+
const tool = record3(value);
|
|
34502
|
+
const type = diagnosticIdentifier(tool.type, diagnosticTypes);
|
|
34503
|
+
const name = diagnosticIdentifier(route === "/responses" ? tool.name : record3(tool.function).name, diagnosticNames);
|
|
34504
|
+
return { type: type.label, name: name.label, type_sha256: type.sha256, name_sha256: name.sha256 };
|
|
34505
|
+
}),
|
|
34506
|
+
tools_truncated: (tools?.length ?? 0) > 8,
|
|
34507
|
+
prior_dispatch: this.dispatched,
|
|
34508
|
+
completed_response_count: this.receiptValues.length
|
|
34509
|
+
};
|
|
34510
|
+
this.toolValidationFailure ??= diagnostic;
|
|
34511
|
+
try {
|
|
34512
|
+
this.options.onToolValidationFailure?.(diagnostic);
|
|
34513
|
+
} catch {
|
|
34514
|
+
}
|
|
34515
|
+
throw new Error(`grok_tool_isolation_${reason}`);
|
|
34516
|
+
}
|
|
34474
34517
|
validatePayload(payload, route) {
|
|
34475
34518
|
const requestedEffort = route === "/responses" ? record3(payload.reasoning).effort : payload.reasoning_effort;
|
|
34476
34519
|
if (payload.model !== this.options.requestedModel || effort(requestedEffort) !== effort(this.options.requestedReasoningEffort)) {
|
|
@@ -34482,17 +34525,17 @@ var init_grok_transport_proxy = __esm({
|
|
|
34482
34525
|
if (instructions.length !== 1 || instructions[0].role !== "system" || instructions[0].content !== this.options.expectedSystemPrompt || route === "/responses" && payload.instructions != null) {
|
|
34483
34526
|
throw new Error("grok_system_prompt_mismatch");
|
|
34484
34527
|
}
|
|
34485
|
-
if (payload.tools != null && !Array.isArray(payload.tools))
|
|
34528
|
+
if (payload.tools != null && !Array.isArray(payload.tools)) this.rejectTools("invalid_tools", payload, route);
|
|
34486
34529
|
const tools = payload.tools ?? [];
|
|
34487
34530
|
const names2 = tools.map((value) => {
|
|
34488
34531
|
const tool = record3(value);
|
|
34489
|
-
if (tool.type !== "function")
|
|
34532
|
+
if (tool.type !== "function") this.rejectTools("invalid_type", payload, route);
|
|
34490
34533
|
const name = route === "/responses" ? tool.name : record3(tool.function).name;
|
|
34491
|
-
if (typeof name !== "string")
|
|
34534
|
+
if (typeof name !== "string") this.rejectTools("missing_name", payload, route);
|
|
34492
34535
|
return name;
|
|
34493
34536
|
});
|
|
34494
34537
|
if (names2.sort().join("\0") !== [...this.options.allowedToolNames].sort().join("\0")) {
|
|
34495
|
-
|
|
34538
|
+
this.rejectTools("unexpected_tools", payload, route);
|
|
34496
34539
|
}
|
|
34497
34540
|
}
|
|
34498
34541
|
async handle(request, response) {
|
|
@@ -34622,8 +34665,15 @@ var init_grok_transport_proxy = __esm({
|
|
|
34622
34665
|
if (!this.dispatched) this.pending = false;
|
|
34623
34666
|
}
|
|
34624
34667
|
controller.abort();
|
|
34625
|
-
if (!response.headersSent)
|
|
34626
|
-
|
|
34668
|
+
if (!response.headersSent) {
|
|
34669
|
+
const localValidation = inference && this.toolValidationFailure !== null;
|
|
34670
|
+
response.writeHead(localValidation ? 400 : 502, { "x-should-retry": "false", "content-type": "application/json" });
|
|
34671
|
+
response.end(localValidation ? JSON.stringify({ error: {
|
|
34672
|
+
type: "vtx_host_validation_error",
|
|
34673
|
+
code: this.failureCode,
|
|
34674
|
+
message: "VTX blocked this Grok Build request locally because its tools did not match the allowed tool contract."
|
|
34675
|
+
} }) : void 0);
|
|
34676
|
+
} else response.end();
|
|
34627
34677
|
} finally {
|
|
34628
34678
|
clearTimeout(timer);
|
|
34629
34679
|
this.options.signal?.removeEventListener("abort", abort);
|
|
@@ -35534,7 +35584,13 @@ var init_grok_adapter = __esm({
|
|
|
35534
35584
|
providerDispatchNotAfterMs: provider?.providerDispatchNotAfterMs,
|
|
35535
35585
|
onProviderDispatch: provider?.onProviderDispatch,
|
|
35536
35586
|
signal: input.signal,
|
|
35537
|
-
fetchImpl: this.options.fetchImpl
|
|
35587
|
+
fetchImpl: this.options.fetchImpl,
|
|
35588
|
+
onToolValidationFailure: (diagnostic) => this.options.emitDiagnosticEvent?.({
|
|
35589
|
+
event: "grok_tool_validation_failed",
|
|
35590
|
+
attempt_id: provider?.attemptId ?? null,
|
|
35591
|
+
control_mode: provider ? "provider" : "agent",
|
|
35592
|
+
...diagnostic
|
|
35593
|
+
})
|
|
35538
35594
|
});
|
|
35539
35595
|
input.signal.throwIfAborted();
|
|
35540
35596
|
session = new GrokAcpSession({
|
|
@@ -35647,7 +35703,7 @@ var init_grok_adapter = __esm({
|
|
|
35647
35703
|
provider?.onTerminalDispatchOutcome?.(outcome);
|
|
35648
35704
|
if (error48 instanceof CodexAppServerError) throw error48;
|
|
35649
35705
|
throw new CodexAppServerError({
|
|
35650
|
-
message: "Grok Build could not complete the inference contract.",
|
|
35706
|
+
message: proxy?.toolValidationFailure ? "VTX blocked an outgoing Grok Build request locally because its tools did not match the allowed tool contract." : "Grok Build could not complete the inference contract.",
|
|
35651
35707
|
category: input.signal?.aborted ? "cancelled" : Date.now() >= input.deadlineAtMs ? "timeout" : proxy?.rejectionStatus === 401 || proxy?.rejectionStatus === 403 ? "auth" : "adapter",
|
|
35652
35708
|
code: proxy?.failureCode ?? proxy?.terminalFailure?.code ?? (error48 instanceof Error && /^grok_[a-z0-9_]+$/u.test(error48.message) ? error48.message : "grok_adapter_failure"),
|
|
35653
35709
|
httpStatusCode: proxy?.rejectionStatus,
|
|
@@ -43609,8 +43665,8 @@ Durable service:
|
|
|
43609
43665
|
quiesceSignal: options.quiesceSignal
|
|
43610
43666
|
}).run();
|
|
43611
43667
|
};
|
|
43612
|
-
preparePortableDurableAdapter = async (adapterId, config2, signal) => {
|
|
43613
|
-
const adapter = adapterId === "copilot" ? new CopilotSubscriptionAdapter() : adapterId === "grok-build" ? new GrokBuildAdapter({ stateRoot: `${config2.statePath}.grok`, grokHome: `${config2.statePath}.grok-home
|
|
43668
|
+
preparePortableDurableAdapter = async (adapterId, config2, signal, emitDiagnosticEvent) => {
|
|
43669
|
+
const adapter = adapterId === "copilot" ? new CopilotSubscriptionAdapter() : adapterId === "grok-build" ? new GrokBuildAdapter({ stateRoot: `${config2.statePath}.grok`, grokHome: `${config2.statePath}.grok-home`, emitDiagnosticEvent }) : adapterId === "pi" ? new PiAdapter({
|
|
43614
43670
|
credentialStore: createPiCredentialStore(config2),
|
|
43615
43671
|
stateRoot: `${config2.statePath}.pi`,
|
|
43616
43672
|
qualifiedModels: await loadPiModelPolicy()
|
|
@@ -44456,8 +44512,8 @@ Waiting for approval...
|
|
|
44456
44512
|
const emitDiagnosticEvent = parsed.json ? (event) => (dependencies.emitStdout ?? ((text) => {
|
|
44457
44513
|
process.stdout.write(text);
|
|
44458
44514
|
}))(`${JSON.stringify(event)}
|
|
44459
|
-
`) : adapterId === "codex" ? (event) => {
|
|
44460
|
-
if (!["codex_app_server_closed", "codex_app_server_session_started"].includes(
|
|
44515
|
+
`) : adapterId === "codex" || adapterId === "grok-build" ? (event) => {
|
|
44516
|
+
if (!["codex_app_server_closed", "codex_app_server_session_started", "grok_tool_validation_failed"].includes(
|
|
44461
44517
|
String(event.event ?? "")
|
|
44462
44518
|
)) return;
|
|
44463
44519
|
(dependencies.emitStderr ?? ((text) => {
|
|
@@ -44466,7 +44522,16 @@ Waiting for approval...
|
|
|
44466
44522
|
`);
|
|
44467
44523
|
} : void 0;
|
|
44468
44524
|
if (adapterId !== "codex") {
|
|
44469
|
-
const
|
|
44525
|
+
const diagnosticState = await readInferenceHostLocalState(config2.statePath);
|
|
44526
|
+
const emitPortableDiagnostic = (event) => emitDiagnosticEvent?.({
|
|
44527
|
+
...event,
|
|
44528
|
+
schema_version: "vtx_inference_host_diagnostic_v1",
|
|
44529
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
44530
|
+
instance_name: config2.instanceName,
|
|
44531
|
+
host_id: diagnosticState?.host_id ?? null,
|
|
44532
|
+
host_runtime_version: INFERENCE_HOST_CLI_VERSION
|
|
44533
|
+
});
|
|
44534
|
+
const prepared = adapterId === "exo" ? await (dependencies.prepareExoAdapter ?? prepareExoAdapter)(config2, parsed.exoRoot, cancellation.signal) : await (dependencies.prepareDurableAdapter ?? preparePortableDurableAdapter)(adapterId, config2, cancellation.signal, emitPortableDiagnostic);
|
|
44470
44535
|
const summary = await (dependencies.runPortableDurableAdapter ?? defaultRunPortableDurableAdapter)({
|
|
44471
44536
|
config: config2,
|
|
44472
44537
|
credentialStore: store,
|