@vtxmacro/cli 2026.9.31 → 2026.9.32

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.
@@ -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.31",
19
+ package_version: "2026.9.32",
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.31",
80
+ package_version: "2026.9.32",
81
81
  codex_package_name: "@openai/codex",
82
82
  codex_version: "0.153.3",
83
83
  copilot_sdk_package_name: "@github/copilot-sdk",
@@ -14722,7 +14722,7 @@ var init_zod = __esm({
14722
14722
  });
14723
14723
 
14724
14724
  // lib/external-inference-contract.ts
14725
- var EXTERNAL_INFERENCE_CONTRACT_VERSION, EXTERNAL_INFERENCE_CONTROLLER_SCHEMA_VERSION, EXTERNAL_INFERENCE_CONTROLLER_SCHEMA_VERSION_V2, EXTERNAL_INFERENCE_ADVERTISEMENT_SCHEMA_VERSION, EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION, EXTERNAL_INFERENCE_COMPRESSED_INPUT_ENVELOPE_SCHEMA_VERSION, EXTERNAL_INFERENCE_JOB_INPUT_SCHEMA_VERSION, LEGACY_EXTERNAL_INFERENCE_JOB_INPUT_SCHEMA_VERSION, EXTERNAL_INFERENCE_USAGE_SCHEMA_VERSION, EXTERNAL_INFERENCE_INPUT_HASH_DOMAIN, MAX_EXTERNAL_INFERENCE_STATUS_HOSTS, MAX_PROFILE_EXTERNAL_INFERENCE_FALLBACKS_PER_LANE, MAX_GENERATION, MAX_SAFE_INTEGER, MAX_PROMPT_BYTES, MAX_IMMUTABLE_JOB_INPUT_BYTES, MAX_CANDIDATE_PLAINTEXT_BYTES, MAX_CIPHERTEXT_CHARS, SHA256_INITIAL_STATE, SHA256_ROUND_CONSTANTS, rotateRight, sha256BytesHex, sha256Utf8Hex, computeImmutableJobInputSha256, identifierSchema, operationIdentifierSchema, sha256HexSchema, generationSchema, zeroBasedGenerationSchema, nonNegativeSafeIntegerSchema, positiveSafeIntegerSchema, sqlIntegerTokenCountSchema, timestampSchema, safeCodeSchema, processExitCodeSchema, externalInferenceAdapterIdSchema, reasoningEffortSchema, modelNameSchema, displayNameSchema, authenticatedAccountEmailSchema, protocolVersionSchema, base64UrlAlphabet, isCanonicalBase64Url, base64Url32BytesSchema, base64UrlNonceSchema, base64UrlCiphertextSchema, claimHandleSchema, boundedJsonTextSchema, boundedPromptTextSchema, laneSchema, botModeSchema, executionModeSchema, responseModeSchema, controlModeSchema, dispatchOutcomeSchema, responseOutcomeSchema, nativeModelControllerSchema, legacyExternalAgentModelControllerSchema, externalAgentModelControllerSchema, boundExternalAgentModelControllerSchema, externalAgentUnboundControllerSchema, externalAgentUnboundControllerV2Schema, orderedFallbackHostIdsSchema, externalInferenceFallbackHostIdsSchema, liveModelControllerSchema, snapshotModelControllerSchema, modelIdentityMappingSchema, advertisedModelSchema, hostAdvertisementSchema, envelopeAadSchema, validateEnvelopeAad, commonEnvelopeShape, sealedKeyWrapEnvelopeSchema, sealedInputEnvelopeSchema, sealedCandidateEnvelopeSchema, sealedEnvelopeSchema, screenerCandidateRuntimeBindingSchema, screenerClientLeaseBindingSchema, screenerRuntimeBindingSchema, serverRuntimeBindingSchema, clientRuntimeBindingSchema, runtimeBindingSchema, immutableJobInputSchema, canonicalizeJsonValue, serializeImmutableJobInput, reportedTokenUsageSchema, unavailableTokenUsageSchema, tokenUsageSchema, agentTurnReceiptSchema, agentConnectRequestSchema, agentNextRequestSchema, agentHeartbeatRequestSchema, emptyAgentNextResultSchema, claimedAgentNextResultSchema, agentNextResultSchema, agentCompleteRequestSchema, agentFailRequestSchema, requestedModelSelectionSchema, completedModelProvenanceSchema, attemptModelProvenanceSchema, providerWeeklyQuotaReadSchema, hostHeartbeatRequestSchema, jobClaimRequestBaseShape, jobClaimRequestSchema, emptyJobClaimSchema, claimedJobSchema, claimedDispatchIntentSchema, batchedJobClaimSchema, timedBatchedJobClaimSchema, jobClaimResultSchema, attemptStartRequestSchema, jobHeartbeatRequestSchema, continueHeartbeatDirectiveSchema, cancelHeartbeatDirectiveSchema, jobHeartbeatResultSchema, adapterOutcomeEvidenceSchema, completionBaseShape, validateCompletion, providerResponseCompletionSchema, decisionCandidateCompletionSchema, jobCompleteRequestSchema, codexProcessExitDiagnosticsSchema, jobFailRequestSchema, jobCancelRequestSchema, jobCancellationReceiptSchema, jobDeliveryRequestSchema, deliveryBaseShape, validateDeliveryCandidate, providerResponseDeliverySchema, decisionCandidateDeliverySchema, jobDeliveryResultSchema, jobConsumptionRequestSchema, jobConsumptionReceiptSchema, jobStateSchema, jobStatusReadSchema, hostStatusReadSchema, controllerBindingStatusReadSchema, queueStatusReadSchema, outcomeStatusReadSchema, externalInferenceVolumeWindowReadSchema, externalInferenceFailureCountReadSchema, externalInferenceHostDiagnosticsReadSchema, externalInferenceProfileActivityReadSchema, externalInferenceStatusReadSchema, nativeResearchEvidenceSourceSchema, externalAgentResearchEvidenceSourceSchema, researchEvidenceSourceSchema, reportedResearchTokenUsageSchema, unavailableResearchTokenUsageSchema, researchTokenUsageSchema, externalInferenceProductLineageBaseShape, traderExternalInferenceProductLineageSchema, decisionChatExternalInferenceProductLineageSchema, screenerExternalInferenceProductLineageSchema, externalInferenceProductLineageSchema, normalProductLinkageSchema, evidenceMaterializationMarkerSchema, deliveredExternalAgentSourceIdentitySchema, deliveredRequestEvidenceSchema, researchEvidenceBaseShape, researchEvidenceBaseSchema, validateExactUtf8, validateResearchEvidence, providerResponseResearchEvidenceSchema, decisionCandidateResearchEvidenceSchema, researchEvidenceSchema;
14725
+ var EXTERNAL_INFERENCE_CONTRACT_VERSION, EXTERNAL_INFERENCE_CONTROLLER_SCHEMA_VERSION, EXTERNAL_INFERENCE_CONTROLLER_SCHEMA_VERSION_V2, EXTERNAL_INFERENCE_ADVERTISEMENT_SCHEMA_VERSION, EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION, EXTERNAL_INFERENCE_COMPRESSED_INPUT_ENVELOPE_SCHEMA_VERSION, EXTERNAL_INFERENCE_JOB_INPUT_SCHEMA_VERSION, LEGACY_EXTERNAL_INFERENCE_JOB_INPUT_SCHEMA_VERSION, EXTERNAL_INFERENCE_USAGE_SCHEMA_VERSION, EXTERNAL_INFERENCE_INPUT_HASH_DOMAIN, MAX_EXTERNAL_INFERENCE_STATUS_HOSTS, MAX_PROFILE_EXTERNAL_INFERENCE_FALLBACKS_PER_LANE, MAX_GENERATION, MAX_SAFE_INTEGER, MAX_PROMPT_BYTES, MAX_IMMUTABLE_JOB_INPUT_BYTES, MAX_CANDIDATE_PLAINTEXT_BYTES, MAX_CIPHERTEXT_CHARS, SHA256_INITIAL_STATE, SHA256_ROUND_CONSTANTS, rotateRight, sha256BytesHex, sha256Utf8Hex, computeImmutableJobInputSha256, identifierSchema, operationIdentifierSchema, sha256HexSchema, generationSchema, zeroBasedGenerationSchema, nonNegativeSafeIntegerSchema, positiveSafeIntegerSchema, sqlIntegerTokenCountSchema, timestampSchema, safeCodeSchema, processExitCodeSchema, externalInferenceAdapterIdSchema, reasoningEffortSchema, modelNameSchema, displayNameSchema, authenticatedAccountEmailSchema, protocolVersionSchema, base64UrlAlphabet, isCanonicalBase64Url, base64Url32BytesSchema, base64UrlNonceSchema, base64UrlCiphertextSchema, claimHandleSchema, boundedJsonTextSchema, boundedPromptTextSchema, laneSchema, botModeSchema, executionModeSchema, responseModeSchema, controlModeSchema, dispatchOutcomeSchema, responseOutcomeSchema, nativeModelControllerSchema, legacyExternalAgentModelControllerSchema, externalAgentModelControllerSchema, boundExternalAgentModelControllerSchema, externalAgentUnboundControllerSchema, externalAgentUnboundControllerV2Schema, orderedFallbackHostIdsSchema, externalInferenceFallbackHostIdsSchema, liveModelControllerSchema, snapshotModelControllerSchema, modelIdentityMappingSchema, advertisedModelSchema, hostAdvertisementSchema, envelopeAadSchema, validateEnvelopeAad, commonEnvelopeShape, sealedKeyWrapEnvelopeSchema, sealedInputEnvelopeSchema, sealedCandidateEnvelopeSchema, sealedEnvelopeSchema, screenerCandidateRuntimeBindingSchema, screenerClientLeaseBindingSchema, screenerRuntimeBindingSchema, serverRuntimeBindingSchema, clientRuntimeBindingSchema, runtimeBindingSchema, immutableJobInputSchema, canonicalizeJsonValue, serializeImmutableJobInput, reportedTokenUsageSchema, unavailableTokenUsageSchema, tokenUsageSchema, grokToolValidationDiagnosticSchema, agentTurnReceiptSchema, agentConnectRequestSchema, agentNextRequestSchema, agentHeartbeatRequestSchema, emptyAgentNextResultSchema, claimedAgentNextResultSchema, agentNextResultSchema, agentCompleteRequestSchema, agentFailRequestSchema, requestedModelSelectionSchema, completedModelProvenanceSchema, attemptModelProvenanceSchema, providerWeeklyQuotaReadSchema, hostHeartbeatRequestSchema, jobClaimRequestBaseShape, jobClaimRequestSchema, emptyJobClaimSchema, claimedJobSchema, claimedDispatchIntentSchema, batchedJobClaimSchema, timedBatchedJobClaimSchema, jobClaimResultSchema, attemptStartRequestSchema, jobHeartbeatRequestSchema, continueHeartbeatDirectiveSchema, cancelHeartbeatDirectiveSchema, jobHeartbeatResultSchema, adapterOutcomeEvidenceSchema, completionBaseShape, validateCompletion, providerResponseCompletionSchema, decisionCandidateCompletionSchema, jobCompleteRequestSchema, codexProcessExitDiagnosticsSchema, jobFailRequestSchema, jobCancelRequestSchema, jobCancellationReceiptSchema, jobDeliveryRequestSchema, deliveryBaseShape, validateDeliveryCandidate, providerResponseDeliverySchema, decisionCandidateDeliverySchema, jobDeliveryResultSchema, jobConsumptionRequestSchema, jobConsumptionReceiptSchema, jobStateSchema, jobStatusReadSchema, hostStatusReadSchema, controllerBindingStatusReadSchema, queueStatusReadSchema, outcomeStatusReadSchema, externalInferenceVolumeWindowReadSchema, externalInferenceFailureCountReadSchema, externalInferenceHostDiagnosticsReadSchema, externalInferenceProfileActivityReadSchema, externalInferenceStatusReadSchema, nativeResearchEvidenceSourceSchema, externalAgentResearchEvidenceSourceSchema, researchEvidenceSourceSchema, reportedResearchTokenUsageSchema, unavailableResearchTokenUsageSchema, researchTokenUsageSchema, externalInferenceProductLineageBaseShape, traderExternalInferenceProductLineageSchema, decisionChatExternalInferenceProductLineageSchema, screenerExternalInferenceProductLineageSchema, externalInferenceProductLineageSchema, normalProductLinkageSchema, evidenceMaterializationMarkerSchema, deliveredExternalAgentSourceIdentitySchema, deliveredRequestEvidenceSchema, researchEvidenceBaseShape, researchEvidenceBaseSchema, validateExactUtf8, validateResearchEvidence, providerResponseResearchEvidenceSchema, decisionCandidateResearchEvidenceSchema, researchEvidenceSchema;
14726
14726
  var init_external_inference_contract = __esm({
14727
14727
  "lib/external-inference-contract.ts"() {
14728
14728
  "use strict";
@@ -15490,9 +15490,37 @@ var init_external_inference_contract = __esm({
15490
15490
  reportedTokenUsageSchema,
15491
15491
  unavailableTokenUsageSchema
15492
15492
  ]);
15493
+ grokToolValidationDiagnosticSchema = external_exports.strictObject({
15494
+ schema_version: external_exports.literal("external_inference_grok_tool_validation_v1"),
15495
+ reason: external_exports.enum(["invalid_tools", "invalid_type", "missing_name", "unexpected_tools"]),
15496
+ route: external_exports.enum(["/responses", "/chat/completions"]),
15497
+ tools_shape: external_exports.enum(["undefined", "null", "array", "object", "string", "number", "boolean", "bigint", "symbol", "function"]),
15498
+ tool_count: nonNegativeSafeIntegerSchema.nullable(),
15499
+ expected_tool_count: nonNegativeSafeIntegerSchema,
15500
+ tools: external_exports.array(external_exports.strictObject({
15501
+ type: external_exports.enum(["function", "web_search", "web_search_preview", "file_search", "computer_use", "missing", "invalid", "redacted"]),
15502
+ name: external_exports.enum(["search_tool", "use_tool", "bash", "read_file", "write_file", "edit_file", "web_search", "vtx_get_data", "vtx_submit_decision", "vtx_decision_status", "missing", "invalid", "redacted"]),
15503
+ type_sha256: sha256HexSchema.nullable(),
15504
+ name_sha256: sha256HexSchema.nullable()
15505
+ }).refine(
15506
+ (tool) => tool.type === "redacted" === (tool.type_sha256 !== null) && tool.name === "redacted" === (tool.name_sha256 !== null),
15507
+ { message: "Only redacted tool identifiers require hashes." }
15508
+ )).max(8),
15509
+ tools_truncated: external_exports.boolean(),
15510
+ prior_dispatch: external_exports.boolean(),
15511
+ completed_response_count: nonNegativeSafeIntegerSchema
15512
+ }).refine(
15513
+ (value) => value.tools_shape === "array" ? value.tool_count !== null && value.tools.length === Math.min(value.tool_count, 8) && value.tools_truncated === value.tool_count > 8 : value.tool_count === null && value.tools.length === 0 && !value.tools_truncated,
15514
+ { message: "Grok tool diagnostic counts must match the observed shape." }
15515
+ ).refine(
15516
+ (value) => value.prior_dispatch || value.completed_response_count === 0,
15517
+ { message: "Completed responses require prior dispatch." }
15518
+ );
15493
15519
  agentTurnReceiptSchema = external_exports.strictObject({
15494
15520
  terminal_status: external_exports.enum(["completed", "failed"]),
15495
15521
  failure_code: safeCodeSchema.nullable(),
15522
+ grok_tool_validation: grokToolValidationDiagnosticSchema.optional(),
15523
+ dispatch_outcome: external_exports.enum(["not_dispatched", "outcome_unknown"]).optional(),
15496
15524
  turn_id: external_exports.string().uuid(),
15497
15525
  agent_run_id: identifierSchema,
15498
15526
  requested_model: modelNameSchema,
@@ -15509,6 +15537,9 @@ var init_external_inference_contract = __esm({
15509
15537
  { message: "Agent decision operation IDs must be unique." }
15510
15538
  )
15511
15539
  }).refine(
15540
+ (value) => value.grok_tool_validation === void 0 ? value.dispatch_outcome === void 0 : value.terminal_status === "failed" && value.failure_code === `grok_tool_isolation_${value.grok_tool_validation.reason}` && value.dispatch_outcome === (value.grok_tool_validation.prior_dispatch ? "outcome_unknown" : "not_dispatched") && value.effective_model === null && value.effective_reasoning_effort === null && value.adapter_request_id === null && value.adapter_response_id === null && value.usage.availability === "unavailable",
15541
+ { message: "Grok diagnostics must match the failed Agent turn and dispatch outcome." }
15542
+ ).refine(
15512
15543
  (value) => value.terminal_status === "failed" ? value.failure_code !== null : value.failure_code === null && value.effective_model !== null && value.effective_reasoning_effort !== null && value.adapter_response_id !== null,
15513
15544
  { message: "Agent terminal evidence is incomplete." }
15514
15545
  ).refine((value) => Date.parse(value.completed_at) >= Date.parse(value.started_at), {
@@ -16006,6 +16037,7 @@ var init_external_inference_contract = __esm({
16006
16037
  adapter_result_ready_at: timestampSchema.optional(),
16007
16038
  provider_dispatch_freshness_remaining_ms: nonNegativeSafeIntegerSchema.nullable().optional(),
16008
16039
  process_exit: codexProcessExitDiagnosticsSchema.nullable().optional(),
16040
+ grok_tool_validation: grokToolValidationDiagnosticSchema.optional(),
16009
16041
  membership_disposition: external_exports.enum([
16010
16042
  "retry_same_host",
16011
16043
  "cascade_cooldown",
@@ -16015,6 +16047,9 @@ var init_external_inference_contract = __esm({
16015
16047
  ]).optional(),
16016
16048
  failed_at: timestampSchema
16017
16049
  }).superRefine((value, context) => {
16050
+ if (value.grok_tool_validation !== void 0 && (value.failure_code !== `grok_tool_isolation_${value.grok_tool_validation.reason}` || value.outcome.dispatch_outcome !== (value.grok_tool_validation.prior_dispatch ? "outcome_unknown" : "not_dispatched"))) {
16051
+ context.addIssue({ code: "custom", message: "Grok diagnostics must match the failure and dispatch outcome.", path: ["grok_tool_validation"] });
16052
+ }
16018
16053
  if (value.provider_retry_at != null !== (value.provider_retry_source != null)) {
16019
16054
  context.addIssue({ code: "custom", message: "provider retry deadline and source must be provided together", path: ["provider_retry_at"] });
16020
16055
  }
@@ -19940,6 +19975,19 @@ var init_mcp_client = __esm({
19940
19975
  #requestId = 0;
19941
19976
  #initialized = false;
19942
19977
  #providerQuotaRecoverySupported = false;
19978
+ #grokToolValidationTools = /* @__PURE__ */ new Set();
19979
+ supportsGrokToolValidationDiagnostics(tool) {
19980
+ return this.#grokToolValidationTools.has(tool);
19981
+ }
19982
+ async refreshGrokToolValidationSupport(tool, options = {}) {
19983
+ if (this.supportsGrokToolValidationDiagnostics(tool)) return true;
19984
+ try {
19985
+ await this.initialize(options);
19986
+ } catch {
19987
+ return false;
19988
+ }
19989
+ return this.supportsGrokToolValidationDiagnostics(tool);
19990
+ }
19943
19991
  supportsProviderQuotaRecovery() {
19944
19992
  return this.#providerQuotaRecoverySupported;
19945
19993
  }
@@ -19997,6 +20045,27 @@ var init_mcp_client = __esm({
19997
20045
  "inference.host.heartbeat",
19998
20046
  ["provider_quota_recovery"]
19999
20047
  ) && advertisesFields("inference.job.fail", ["provider_retry_at", "provider_retry_source"]);
20048
+ this.#grokToolValidationTools.clear();
20049
+ if (advertisesFields("inference.job.fail", ["grok_tool_validation"])) {
20050
+ this.#grokToolValidationTools.add("inference.job.fail");
20051
+ }
20052
+ const heartbeatSchema = listed.tools.find(
20053
+ (tool) => tool.name === "inference.agent.assignment.heartbeat"
20054
+ )?.inputSchema;
20055
+ const advertisesDiagnosticReceipt = (value, depth = 0) => {
20056
+ if (depth > 4 || !value || typeof value !== "object" || Array.isArray(value)) return false;
20057
+ const node = value;
20058
+ const properties = node.properties;
20059
+ if (properties && typeof properties === "object" && Object.hasOwn(properties, "grok_tool_validation") && Object.hasOwn(properties, "dispatch_outcome")) return true;
20060
+ if (typeof node.$ref === "string" && /^#\/\$defs\/[^/]+$/u.test(node.$ref)) {
20061
+ const definition = node.$ref.slice("#/$defs/".length).replace(/~1/gu, "/").replace(/~0/gu, "~");
20062
+ return advertisesDiagnosticReceipt(heartbeatSchema?.$defs?.[definition], depth + 1);
20063
+ }
20064
+ return Array.isArray(node.anyOf) && node.anyOf.some((branch) => advertisesDiagnosticReceipt(branch, depth + 1));
20065
+ };
20066
+ if (advertisesDiagnosticReceipt(heartbeatSchema?.properties?.turn_receipt)) {
20067
+ this.#grokToolValidationTools.add("inference.agent.assignment.heartbeat");
20068
+ }
20000
20069
  this.#initialized = true;
20001
20070
  }
20002
20071
  async callTool(name, argumentsValue, options = {}) {
@@ -21596,6 +21665,7 @@ var init_codex_app_server = __esm({
21596
21665
  this.terminalEvidence = options.terminalEvidence ?? null;
21597
21666
  this.rateLimits = options.rateLimits ?? null;
21598
21667
  this.processExit = options.processExit ?? null;
21668
+ this.grokToolValidation = options.grokToolValidation ?? null;
21599
21669
  }
21600
21670
  };
21601
21671
  objectOrNull = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -34414,6 +34484,7 @@ var init_grok_transport_proxy = __esm({
34414
34484
  init_define_VTX_EXO_POLICY();
34415
34485
  init_define_VTX_GROK_POLICY();
34416
34486
  init_define_VTX_PI_MODEL_POLICY();
34487
+ init_external_inference_contract();
34417
34488
  diagnosticNames = /* @__PURE__ */ new Set([
34418
34489
  "search_tool",
34419
34490
  "use_tool",
@@ -34491,7 +34562,8 @@ var init_grok_transport_proxy = __esm({
34491
34562
  }
34492
34563
  rejectTools(reason, payload, route) {
34493
34564
  const tools = Array.isArray(payload.tools) ? payload.tools : null;
34494
- const diagnostic = {
34565
+ const diagnostic = grokToolValidationDiagnosticSchema.parse({
34566
+ schema_version: "external_inference_grok_tool_validation_v1",
34495
34567
  reason,
34496
34568
  route,
34497
34569
  tools_shape: tools ? "array" : payload.tools === null ? "null" : typeof payload.tools,
@@ -34506,7 +34578,7 @@ var init_grok_transport_proxy = __esm({
34506
34578
  tools_truncated: (tools?.length ?? 0) > 8,
34507
34579
  prior_dispatch: this.dispatched,
34508
34580
  completed_response_count: this.receiptValues.length
34509
- };
34581
+ });
34510
34582
  this.toolValidationFailure ??= diagnostic;
34511
34583
  try {
34512
34584
  this.options.onToolValidationFailure?.(diagnostic);
@@ -35708,7 +35780,8 @@ var init_grok_adapter = __esm({
35708
35780
  code: proxy?.failureCode ?? proxy?.terminalFailure?.code ?? (error48 instanceof Error && /^grok_[a-z0-9_]+$/u.test(error48.message) ? error48.message : "grok_adapter_failure"),
35709
35781
  httpStatusCode: proxy?.rejectionStatus,
35710
35782
  retryable: false,
35711
- dispatchOutcome: outcome
35783
+ dispatchOutcome: outcome,
35784
+ grokToolValidation: proxy?.toolValidationFailure ?? null
35712
35785
  });
35713
35786
  } finally {
35714
35787
  try {
@@ -37210,8 +37283,8 @@ var init_runner = __esm({
37210
37283
  init_mcp_client();
37211
37284
  init_config();
37212
37285
  init_oauth();
37213
- terminalFailureRequiresManualRecovery = (error48) => error48.terminalEvidence !== null && !error48.retryable && error48.category !== "auth" && !["quota_exceeded", "codex_rate_limited", "provider_rate_limited"].includes(error48.code);
37214
- canReplayFencedAgentTerminal = (state, fence) => state?.schema_version === "vtx_inference_agent_runtime_v3" && state.adapter_id === fence.adapter_id && state.host_id === fence.host_id && state.assignment.assignment_id === fence.assignment_id && state.pending_turn?.terminal_receipt?.terminal_status === "failed" && state.pending_turn.terminal_receipt.failure_code === fence.failure_code && fence.dispatch_outcome !== "outcome_unknown";
37286
+ terminalFailureRequiresManualRecovery = (error48) => (error48.terminalEvidence !== null || error48.grokToolValidation != null) && !error48.retryable && error48.category !== "auth" && !["quota_exceeded", "codex_rate_limited", "provider_rate_limited"].includes(error48.code);
37287
+ canReplayFencedAgentTerminal = (state, fence) => state?.schema_version === "vtx_inference_agent_runtime_v3" && state.adapter_id === fence.adapter_id && state.host_id === fence.host_id && state.assignment.assignment_id === fence.assignment_id && state.pending_turn?.terminal_receipt?.terminal_status === "failed" && state.pending_turn.terminal_receipt.failure_code === fence.failure_code && (fence.dispatch_outcome !== "outcome_unknown" || state.pending_turn.terminal_receipt.grok_tool_validation?.prior_dispatch === true && state.pending_turn.terminal_receipt.dispatch_outcome === "outcome_unknown");
37215
37288
  RUNTIME_RECEIPT_SCHEMA_VERSION = "vtx_inference_host_runtime_v1";
37216
37289
  ATTEMPT_RECEIPT_SCHEMA_VERSION = "vtx_inference_attempt_receipt_v1";
37217
37290
  CLAIM_DISPATCH_BATCH_SIZE = 16;
@@ -38221,7 +38294,14 @@ var init_runner = __esm({
38221
38294
  cooldown_until: retryAtMs === null ? null : isoAt(retryAtMs)
38222
38295
  }
38223
38296
  );
38224
- if (this.options.once || retryAtMs === null) return;
38297
+ if (this.options.once) return;
38298
+ if (retryAtMs === null) {
38299
+ const retained = await readInferenceAgentRuntimeState(agentRuntimeSettings.statePath);
38300
+ const fence = await readInferenceAgentFailureFence(agentRuntimeSettings.statePath);
38301
+ if (!fence || !canReplayFencedAgentTerminal(retained, fence)) return;
38302
+ await sleep4(1e3, agentIdleSignal).catch(() => void 0);
38303
+ continue;
38304
+ }
38225
38305
  try {
38226
38306
  await sleep4(Math.max(MIN_SLEEP_MS, retryAtMs - now()), agentIdleSignal);
38227
38307
  } catch {
@@ -40376,6 +40456,11 @@ var init_runner = __esm({
40376
40456
  failure2.code
40377
40457
  ]);
40378
40458
  const canReportEffective = dispatchOutcome !== "not_dispatched";
40459
+ const grokDiagnostic = heartbeatFailure === void 0 && effectiveError instanceof CodexAppServerError && effectiveError.grokToolValidation !== null && failure2.code === `grok_tool_isolation_${effectiveError.grokToolValidation.reason}` && dispatchOutcome === (effectiveError.grokToolValidation.prior_dispatch ? "outcome_unknown" : "not_dispatched") ? effectiveError.grokToolValidation : null;
40460
+ const sendGrokDiagnostic = grokDiagnostic !== null && (mcp.supportsGrokToolValidationDiagnostics?.("inference.job.fail") === true || await mcp.refreshGrokToolValidationSupport?.("inference.job.fail", {
40461
+ signal,
40462
+ deadlineAtMs: Date.parse(jobInput.evidence_expires_at)
40463
+ }) === true);
40379
40464
  const failureRequest = jobFailRequestSchema.parse({
40380
40465
  schema_version: "external_inference_job_fail_v1",
40381
40466
  contract_version: EXTERNAL_INFERENCE_CONTRACT_VERSION,
@@ -40416,6 +40501,7 @@ var init_runner = __esm({
40416
40501
  ...adapterResultReadyAt === null ? {} : { adapter_result_ready_at: adapterResultReadyAt },
40417
40502
  provider_dispatch_freshness_remaining_ms: providerDispatchFreshnessRemainingMs,
40418
40503
  ...processExit ? { process_exit: processExit } : {},
40504
+ ...sendGrokDiagnostic ? { grok_tool_validation: grokDiagnostic } : {},
40419
40505
  membership_disposition: membershipFailureDisposition({
40420
40506
  ...failure2,
40421
40507
  dispatchOutcome
@@ -40487,6 +40573,7 @@ var init_runner = __esm({
40487
40573
  }
40488
40574
  };
40489
40575
  createInferenceAgentControlClient = (mcp) => ({
40576
+ supportsGrokToolValidationDiagnostics: async (options = {}) => mcp.supportsGrokToolValidationDiagnostics?.("inference.agent.assignment.heartbeat") === true || await mcp.refreshGrokToolValidationSupport?.("inference.agent.assignment.heartbeat", options) === true,
40490
40577
  nextAssignment: async (request, options) => {
40491
40578
  const result2 = await mcp.callTool("inference.agent.assignment.next", {
40492
40579
  ...request,
@@ -40730,6 +40817,12 @@ var init_runner = __esm({
40730
40817
  if (terminal.terminal_receipt.terminal_status === "failed") {
40731
40818
  state = { ...state, pending_turn: null, updated_at: nowIso() };
40732
40819
  await writeInferenceAgentRuntimeState(this.options.statePath, state);
40820
+ if (terminal.terminal_receipt.dispatch_outcome === "outcome_unknown") {
40821
+ throw new InferenceHostRunnerError(
40822
+ "agent_terminal_failure_fenced",
40823
+ "The diagnostic receipt was acknowledged; upstream outcome remains unknown and model redispatch is fenced."
40824
+ );
40825
+ }
40733
40826
  await this.releaseForHostStop(terminal.terminal_receipt.failure_code ?? "provider_failure");
40734
40827
  return this.now() + (this.options.idlePollMs ?? 5e3);
40735
40828
  }
@@ -41026,11 +41119,12 @@ var init_runner = __esm({
41026
41119
  await writeInferenceAgentRuntimeState(this.options.statePath, state);
41027
41120
  return nextWakeAtMs;
41028
41121
  } catch (error48) {
41029
- if (error48 instanceof CodexAppServerError && error48.dispatchOutcome === "not_dispatched" && error48.terminalEvidence === null) {
41122
+ const diagnostic = error48 instanceof CodexAppServerError && error48.grokToolValidation && error48.code === `grok_tool_isolation_${error48.grokToolValidation.reason}` && error48.dispatchOutcome === (error48.grokToolValidation.prior_dispatch ? "outcome_unknown" : "not_dispatched") && await this.options.controlClient.supportsGrokToolValidationDiagnostics?.({}) === true ? error48.grokToolValidation : null;
41123
+ if (error48 instanceof CodexAppServerError && error48.dispatchOutcome === "not_dispatched" && error48.terminalEvidence === null && !diagnostic) {
41030
41124
  state = { ...state, pending_turn: null, updated_at: nowIso() };
41031
41125
  await writeInferenceAgentRuntimeState(this.options.statePath, state);
41032
41126
  }
41033
- if (state.pending_turn && !state.pending_turn.terminal_receipt && error48 instanceof CodexAppServerError && (error48.terminalEvidence !== null || error48.dispatchOutcome === "confirmed_dispatched" && ["provider_rate_limited", "codex_rate_limited", "quota_exceeded"].includes(error48.code))) {
41127
+ if (state.pending_turn && !state.pending_turn.terminal_receipt && error48 instanceof CodexAppServerError && (diagnostic != null || error48.terminalEvidence !== null || error48.dispatchOutcome === "confirmed_dispatched" && ["provider_rate_limited", "codex_rate_limited", "quota_exceeded"].includes(error48.code))) {
41034
41128
  state = { ...state, pending_turn: {
41035
41129
  ...state.pending_turn,
41036
41130
  terminal_receipt: {
@@ -41039,19 +41133,23 @@ var init_runner = __esm({
41039
41133
  turn_id: state.pending_turn.turn_id,
41040
41134
  agent_run_id: state.thread?.threadId ?? state.pending_turn.turn_id,
41041
41135
  requested_model: assignment.model_id,
41042
- effective_model: error48.terminalEvidence?.effectiveModel ?? null,
41136
+ effective_model: diagnostic ? null : error48.terminalEvidence?.effectiveModel ?? null,
41043
41137
  requested_reasoning_effort: assignment.reasoning_effort,
41044
- effective_reasoning_effort: error48.terminalEvidence?.effectiveReasoningEffort ?? null,
41138
+ effective_reasoning_effort: diagnostic ? null : error48.terminalEvidence?.effectiveReasoningEffort ?? null,
41045
41139
  started_at: state.pending_turn.started_at,
41046
41140
  completed_at: nowIso(),
41047
- adapter_request_id: error48.terminalEvidence?.adapterRequestId ?? null,
41048
- adapter_response_id: error48.terminalEvidence?.adapterResponseId ?? null,
41049
- usage: error48.usage ? reportedTokenUsage(error48.usage, this.options.adapterId) : {
41141
+ adapter_request_id: diagnostic ? null : error48.terminalEvidence?.adapterRequestId ?? null,
41142
+ adapter_response_id: diagnostic ? null : error48.terminalEvidence?.adapterResponseId ?? null,
41143
+ usage: !diagnostic && error48.usage ? reportedTokenUsage(error48.usage, this.options.adapterId) : {
41050
41144
  schema_version: EXTERNAL_INFERENCE_USAGE_SCHEMA_VERSION,
41051
41145
  availability: "unavailable",
41052
41146
  reason_code: "terminal_usage_unavailable"
41053
41147
  },
41054
- decision_operation_ids: [...state.pending_turn.decision_operation_ids]
41148
+ decision_operation_ids: [...state.pending_turn.decision_operation_ids],
41149
+ ...diagnostic ? {
41150
+ grok_tool_validation: diagnostic,
41151
+ dispatch_outcome: error48.dispatchOutcome === "not_dispatched" ? "not_dispatched" : "outcome_unknown"
41152
+ } : {}
41055
41153
  }
41056
41154
  }, updated_at: nowIso() };
41057
41155
  if (terminalFailureRequiresManualRecovery(error48)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.9.31",
3
+ "version": "2026.9.32",
4
4
  "description": "VTX Macro CLI, MCP server, and durable external inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",