@vtxmacro/cli 2026.9.33 → 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 +155 -29
- 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",
|
|
@@ -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, 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;
|
|
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, grokResponseIdentityDiagnosticSchema, 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";
|
|
@@ -15516,10 +15516,25 @@ var init_external_inference_contract = __esm({
|
|
|
15516
15516
|
(value) => value.prior_dispatch || value.completed_response_count === 0,
|
|
15517
15517
|
{ message: "Completed responses require prior dispatch." }
|
|
15518
15518
|
);
|
|
15519
|
+
grokResponseIdentityDiagnosticSchema = external_exports.strictObject({
|
|
15520
|
+
schema_version: external_exports.literal("external_inference_grok_response_identity_v1"),
|
|
15521
|
+
reason: external_exports.enum(["invalid_id", "model_mismatch", "changed_id"]),
|
|
15522
|
+
route: external_exports.enum(["/responses", "/chat/completions"]),
|
|
15523
|
+
response_event: external_exports.enum(["response.created", "response.in_progress", "response.completed", "chat.completion.chunk", "other"]),
|
|
15524
|
+
id_present: external_exports.boolean(),
|
|
15525
|
+
id_matches_previous: external_exports.boolean().nullable(),
|
|
15526
|
+
model_present: external_exports.boolean(),
|
|
15527
|
+
model_matches_requested: external_exports.boolean(),
|
|
15528
|
+
model_sha256: sha256HexSchema.nullable()
|
|
15529
|
+
}).refine(
|
|
15530
|
+
(value) => value.model_present === (value.model_sha256 !== null) && (!value.model_matches_requested || value.model_present) && (value.id_matches_previous !== true || value.id_present) && (value.reason === "invalid_id" ? !value.id_present : value.reason === "model_mismatch" ? value.id_present && !value.model_matches_requested : value.id_present && value.model_matches_requested && value.id_matches_previous === false),
|
|
15531
|
+
{ message: "Grok response identity observations must match their rejection reason." }
|
|
15532
|
+
);
|
|
15519
15533
|
agentTurnReceiptSchema = external_exports.strictObject({
|
|
15520
15534
|
terminal_status: external_exports.enum(["completed", "failed"]),
|
|
15521
15535
|
failure_code: safeCodeSchema.nullable(),
|
|
15522
15536
|
grok_tool_validation: grokToolValidationDiagnosticSchema.optional(),
|
|
15537
|
+
grok_response_identity: grokResponseIdentityDiagnosticSchema.optional(),
|
|
15523
15538
|
dispatch_outcome: external_exports.enum(["not_dispatched", "outcome_unknown"]).optional(),
|
|
15524
15539
|
turn_id: external_exports.string().uuid(),
|
|
15525
15540
|
agent_run_id: identifierSchema,
|
|
@@ -15537,8 +15552,11 @@ var init_external_inference_contract = __esm({
|
|
|
15537
15552
|
{ message: "Agent decision operation IDs must be unique." }
|
|
15538
15553
|
)
|
|
15539
15554
|
}).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",
|
|
15555
|
+
(value) => value.grok_tool_validation === void 0 ? value.grok_response_identity !== void 0 || value.dispatch_outcome === void 0 : value.grok_response_identity === 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
15556
|
{ message: "Grok diagnostics must match the failed Agent turn and dispatch outcome." }
|
|
15557
|
+
).refine(
|
|
15558
|
+
(value) => value.grok_response_identity === void 0 || value.terminal_status === "failed" && value.failure_code === "grok_provider_identity_mismatch" && value.dispatch_outcome === "outcome_unknown" && value.grok_tool_validation === void 0 && value.effective_model === null && value.effective_reasoning_effort === null && value.adapter_request_id === null && value.adapter_response_id === null && value.usage.availability === "unavailable",
|
|
15559
|
+
{ message: "Grok response identity diagnostics require an unaccepted dispatched Agent turn." }
|
|
15542
15560
|
).refine(
|
|
15543
15561
|
(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,
|
|
15544
15562
|
{ message: "Agent terminal evidence is incomplete." }
|
|
@@ -16038,6 +16056,7 @@ var init_external_inference_contract = __esm({
|
|
|
16038
16056
|
provider_dispatch_freshness_remaining_ms: nonNegativeSafeIntegerSchema.nullable().optional(),
|
|
16039
16057
|
process_exit: codexProcessExitDiagnosticsSchema.nullable().optional(),
|
|
16040
16058
|
grok_tool_validation: grokToolValidationDiagnosticSchema.optional(),
|
|
16059
|
+
grok_response_identity: grokResponseIdentityDiagnosticSchema.optional(),
|
|
16041
16060
|
membership_disposition: external_exports.enum([
|
|
16042
16061
|
"retry_same_host",
|
|
16043
16062
|
"cascade_cooldown",
|
|
@@ -16047,6 +16066,9 @@ var init_external_inference_contract = __esm({
|
|
|
16047
16066
|
]).optional(),
|
|
16048
16067
|
failed_at: timestampSchema
|
|
16049
16068
|
}).superRefine((value, context) => {
|
|
16069
|
+
if (value.grok_response_identity !== void 0 && (value.failure_code !== "grok_provider_identity_mismatch" || value.outcome.dispatch_outcome !== "outcome_unknown" || value.grok_tool_validation !== void 0)) {
|
|
16070
|
+
context.addIssue({ code: "custom", message: "Grok response identity diagnostics require an unaccepted dispatched attempt.", path: ["grok_response_identity"] });
|
|
16071
|
+
}
|
|
16050
16072
|
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
16073
|
context.addIssue({ code: "custom", message: "Grok diagnostics must match the failure and dispatch outcome.", path: ["grok_tool_validation"] });
|
|
16052
16074
|
}
|
|
@@ -19976,6 +19998,7 @@ var init_mcp_client = __esm({
|
|
|
19976
19998
|
#initialized = false;
|
|
19977
19999
|
#providerQuotaRecoverySupported = false;
|
|
19978
20000
|
#grokToolValidationTools = /* @__PURE__ */ new Set();
|
|
20001
|
+
#grokResponseIdentityTools = /* @__PURE__ */ new Set();
|
|
19979
20002
|
supportsGrokToolValidationDiagnostics(tool) {
|
|
19980
20003
|
return this.#grokToolValidationTools.has(tool);
|
|
19981
20004
|
}
|
|
@@ -19988,6 +20011,18 @@ var init_mcp_client = __esm({
|
|
|
19988
20011
|
}
|
|
19989
20012
|
return this.supportsGrokToolValidationDiagnostics(tool);
|
|
19990
20013
|
}
|
|
20014
|
+
supportsGrokResponseIdentityDiagnostics(tool) {
|
|
20015
|
+
return this.#grokResponseIdentityTools.has(tool);
|
|
20016
|
+
}
|
|
20017
|
+
async refreshGrokResponseIdentitySupport(tool, options = {}) {
|
|
20018
|
+
if (this.supportsGrokResponseIdentityDiagnostics(tool)) return true;
|
|
20019
|
+
try {
|
|
20020
|
+
await this.initialize(options);
|
|
20021
|
+
} catch {
|
|
20022
|
+
return false;
|
|
20023
|
+
}
|
|
20024
|
+
return this.supportsGrokResponseIdentityDiagnostics(tool);
|
|
20025
|
+
}
|
|
19991
20026
|
supportsProviderQuotaRecovery() {
|
|
19992
20027
|
return this.#providerQuotaRecoverySupported;
|
|
19993
20028
|
}
|
|
@@ -20052,20 +20087,27 @@ var init_mcp_client = __esm({
|
|
|
20052
20087
|
const heartbeatSchema = listed.tools.find(
|
|
20053
20088
|
(tool) => tool.name === "inference.agent.assignment.heartbeat"
|
|
20054
20089
|
)?.inputSchema;
|
|
20055
|
-
const advertisesDiagnosticReceipt = (value, depth = 0) => {
|
|
20090
|
+
const advertisesDiagnosticReceipt = (value, field, depth = 0) => {
|
|
20056
20091
|
if (depth > 4 || !value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
20057
20092
|
const node = value;
|
|
20058
20093
|
const properties = node.properties;
|
|
20059
|
-
if (properties && typeof properties === "object" && Object.hasOwn(properties,
|
|
20094
|
+
if (properties && typeof properties === "object" && Object.hasOwn(properties, field) && Object.hasOwn(properties, "dispatch_outcome")) return true;
|
|
20060
20095
|
if (typeof node.$ref === "string" && /^#\/\$defs\/[^/]+$/u.test(node.$ref)) {
|
|
20061
20096
|
const definition = node.$ref.slice("#/$defs/".length).replace(/~1/gu, "/").replace(/~0/gu, "~");
|
|
20062
|
-
return advertisesDiagnosticReceipt(heartbeatSchema?.$defs?.[definition], depth + 1);
|
|
20097
|
+
return advertisesDiagnosticReceipt(heartbeatSchema?.$defs?.[definition], field, depth + 1);
|
|
20063
20098
|
}
|
|
20064
|
-
return Array.isArray(node.anyOf) && node.anyOf.some((branch) => advertisesDiagnosticReceipt(branch, depth + 1));
|
|
20099
|
+
return Array.isArray(node.anyOf) && node.anyOf.some((branch) => advertisesDiagnosticReceipt(branch, field, depth + 1));
|
|
20065
20100
|
};
|
|
20066
|
-
if (advertisesDiagnosticReceipt(heartbeatSchema?.properties?.turn_receipt)) {
|
|
20101
|
+
if (advertisesDiagnosticReceipt(heartbeatSchema?.properties?.turn_receipt, "grok_tool_validation")) {
|
|
20067
20102
|
this.#grokToolValidationTools.add("inference.agent.assignment.heartbeat");
|
|
20068
20103
|
}
|
|
20104
|
+
this.#grokResponseIdentityTools.clear();
|
|
20105
|
+
if (advertisesFields("inference.job.fail", ["grok_response_identity"])) {
|
|
20106
|
+
this.#grokResponseIdentityTools.add("inference.job.fail");
|
|
20107
|
+
}
|
|
20108
|
+
if (advertisesDiagnosticReceipt(heartbeatSchema?.properties?.turn_receipt, "grok_response_identity")) {
|
|
20109
|
+
this.#grokResponseIdentityTools.add("inference.agent.assignment.heartbeat");
|
|
20110
|
+
}
|
|
20069
20111
|
this.#initialized = true;
|
|
20070
20112
|
}
|
|
20071
20113
|
async callTool(name, argumentsValue, options = {}) {
|
|
@@ -21666,6 +21708,7 @@ var init_codex_app_server = __esm({
|
|
|
21666
21708
|
this.rateLimits = options.rateLimits ?? null;
|
|
21667
21709
|
this.processExit = options.processExit ?? null;
|
|
21668
21710
|
this.grokToolValidation = options.grokToolValidation ?? null;
|
|
21711
|
+
this.grokResponseIdentity = options.grokResponseIdentity ?? null;
|
|
21669
21712
|
}
|
|
21670
21713
|
};
|
|
21671
21714
|
objectOrNull = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -34441,7 +34484,7 @@ var init_grok_binary = __esm({
|
|
|
34441
34484
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
34442
34485
|
import { dirname as dirname7, resolve as resolve5 } from "node:path";
|
|
34443
34486
|
import { fileURLToPath } from "node:url";
|
|
34444
|
-
var validateGrokPolicy, loadGrokPolicy;
|
|
34487
|
+
var validateGrokPolicy, grokAllowedEffectiveModels, loadGrokPolicy;
|
|
34445
34488
|
var init_grok_policy = __esm({
|
|
34446
34489
|
"lib/inference-host/grok-policy.ts"() {
|
|
34447
34490
|
"use strict";
|
|
@@ -34459,12 +34502,26 @@ var init_grok_policy = __esm({
|
|
|
34459
34502
|
throw new Error("Grok transport bounds are missing or invalid.");
|
|
34460
34503
|
}
|
|
34461
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
|
+
));
|
|
34462
34517
|
return Object.freeze({
|
|
34463
34518
|
subscription_proxy_base_url: url2.href,
|
|
34464
34519
|
maximum_transport_request_bytes: Number(policy.maximum_transport_request_bytes),
|
|
34465
|
-
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
|
|
34466
34522
|
});
|
|
34467
34523
|
};
|
|
34524
|
+
grokAllowedEffectiveModels = (policy, requested) => Object.freeze([requested, ...Object.hasOwn(policy.effective_model_aliases, requested) ? policy.effective_model_aliases[requested] : []]);
|
|
34468
34525
|
loadGrokPolicy = async () => {
|
|
34469
34526
|
if (typeof define_VTX_GROK_POLICY_default !== "undefined") return validateGrokPolicy(define_VTX_GROK_POLICY_default);
|
|
34470
34527
|
const config2 = parse3(await readFile6(resolve5(dirname7(fileURLToPath(import.meta.url)), "../../../config.toml"), "utf8"));
|
|
@@ -34517,13 +34574,19 @@ var init_grok_transport_proxy = __esm({
|
|
|
34517
34574
|
this.requestFingerprints = /* @__PURE__ */ new Set();
|
|
34518
34575
|
this.pending = false;
|
|
34519
34576
|
this.closed = false;
|
|
34577
|
+
this.observedModel = null;
|
|
34520
34578
|
this.dispatched = false;
|
|
34521
34579
|
this.responded = false;
|
|
34522
34580
|
this.failureCode = null;
|
|
34523
34581
|
this.rejectionStatus = null;
|
|
34524
34582
|
this.terminalFailure = null;
|
|
34525
34583
|
this.toolValidationFailure = null;
|
|
34584
|
+
this.responseIdentityFailure = null;
|
|
34526
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
|
+
}
|
|
34527
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");
|
|
34528
34591
|
}
|
|
34529
34592
|
get baseUrl() {
|
|
@@ -34697,6 +34760,7 @@ var init_grok_transport_proxy = __esm({
|
|
|
34697
34760
|
this.checkDispatch();
|
|
34698
34761
|
this.options.onProviderDispatch?.();
|
|
34699
34762
|
this.checkDispatch();
|
|
34763
|
+
this.observedModel = null;
|
|
34700
34764
|
this.dispatched = true;
|
|
34701
34765
|
}
|
|
34702
34766
|
const upstream = await (this.options.fetchImpl ?? fetch)(
|
|
@@ -34794,9 +34858,35 @@ var init_grok_transport_proxy = __esm({
|
|
|
34794
34858
|
const event = record3(JSON.parse(data4));
|
|
34795
34859
|
const native = route === "/responses" ? record3(event.response) : event;
|
|
34796
34860
|
if (native.id !== void 0 || native.model !== void 0) {
|
|
34797
|
-
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) {
|
|
34862
|
+
const idPresent = typeof native.id === "string" && native.id.length > 0;
|
|
34863
|
+
const modelPresent = typeof native.model === "string" && native.model.length > 0;
|
|
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
|
+
}
|
|
34868
|
+
const eventType = route === "/responses" ? event.type : event.object;
|
|
34869
|
+
this.responseIdentityFailure = grokResponseIdentityDiagnosticSchema.parse({
|
|
34870
|
+
schema_version: "external_inference_grok_response_identity_v1",
|
|
34871
|
+
reason: !idPresent ? "invalid_id" : !modelMatches ? "model_mismatch" : "changed_id",
|
|
34872
|
+
route,
|
|
34873
|
+
response_event: ["response.created", "response.in_progress", "response.completed", "chat.completion.chunk"].includes(String(eventType)) ? eventType : "other",
|
|
34874
|
+
id_present: idPresent,
|
|
34875
|
+
id_matches_previous: id2 ? native.id === id2 : null,
|
|
34876
|
+
model_present: modelPresent,
|
|
34877
|
+
model_matches_requested: modelMatches,
|
|
34878
|
+
model_sha256: modelPresent ? createHash6("sha256").update(native.model).digest("hex") : null
|
|
34879
|
+
});
|
|
34880
|
+
try {
|
|
34881
|
+
this.options.onResponseIdentityFailure?.(this.responseIdentityFailure);
|
|
34882
|
+
} catch {
|
|
34883
|
+
}
|
|
34884
|
+
throw new Error("grok_provider_identity_mismatch");
|
|
34885
|
+
}
|
|
34886
|
+
if (model && native.model !== model) throw new Error("grok_provider_model_changed");
|
|
34798
34887
|
id2 = native.id;
|
|
34799
34888
|
model = String(native.model);
|
|
34889
|
+
this.observedModel = model;
|
|
34800
34890
|
}
|
|
34801
34891
|
const responseEffort = native.reasoning_effort ?? record3(native.reasoning).effort;
|
|
34802
34892
|
if (responseEffort != null && effort(responseEffort) !== effort(this.options.requestedReasoningEffort)) {
|
|
@@ -35453,11 +35543,11 @@ var init_grok_adapter = __esm({
|
|
|
35453
35543
|
isDefault: state.currentModelId === model.modelId
|
|
35454
35544
|
}];
|
|
35455
35545
|
});
|
|
35456
|
-
grokPromptUsage = (value, expectedModel) => {
|
|
35546
|
+
grokPromptUsage = (value, expectedModel, allowedEffectiveModels = [expectedModel]) => {
|
|
35457
35547
|
const usage = grokObject(value);
|
|
35458
35548
|
if (usage.usageIsIncomplete === true) throw new Error("grok_usage_incomplete");
|
|
35459
35549
|
const models = Object.keys(grokObject(usage.modelUsage));
|
|
35460
|
-
if (models.length !== 1 || models[0]
|
|
35550
|
+
if (models.length !== 1 || !allowedEffectiveModels.includes(models[0])) throw new Error("grok_effective_model_mismatch");
|
|
35461
35551
|
const inputTokens = integer2(usage.inputTokens, "input_tokens");
|
|
35462
35552
|
const outputTokens = integer2(usage.outputTokens, "output_tokens");
|
|
35463
35553
|
const cachedInputTokens = integer2(usage.cachedReadTokens, "cached_input_tokens");
|
|
@@ -35562,7 +35652,11 @@ var init_grok_adapter = __esm({
|
|
|
35562
35652
|
throw new Error("grok_subscription_auth_unavailable");
|
|
35563
35653
|
}
|
|
35564
35654
|
const state = unwrap(await session.request("_x.ai/models/list", {}, deadline, signal));
|
|
35565
|
-
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
|
+
}));
|
|
35566
35660
|
if (!capabilities.length) throw new Error("grok_model_catalog_empty");
|
|
35567
35661
|
const identity = typeof auth.principalId === "string" && auth.principalId ? auth.principalId : typeof auth.email === "string" && auth.email ? auth.email.toLowerCase() : null;
|
|
35568
35662
|
if (!identity) throw new Error("grok_account_identity_required");
|
|
@@ -35607,6 +35701,7 @@ var init_grok_adapter = __esm({
|
|
|
35607
35701
|
const startedAt = Date.now();
|
|
35608
35702
|
const binary = await this.binary();
|
|
35609
35703
|
const policy = this.options.policy ?? await loadGrokPolicy();
|
|
35704
|
+
const allowedEffectiveModels = grokAllowedEffectiveModels(policy, input.requestedModel);
|
|
35610
35705
|
input.signal.throwIfAborted();
|
|
35611
35706
|
const workspace = agent?.durableThread ? await validateGrokOwnedThread(this.stateOptions, agent.durableThread) : await createGrokOwnedWorkspace(this.stateOptions, agent ? "agent" : "attempt");
|
|
35612
35707
|
let mcp = null;
|
|
@@ -35616,6 +35711,7 @@ var init_grok_adapter = __esm({
|
|
|
35616
35711
|
let retained = Boolean(agent?.durableThread);
|
|
35617
35712
|
let thought = "";
|
|
35618
35713
|
let firstToken = null;
|
|
35714
|
+
let activeThread = null;
|
|
35619
35715
|
try {
|
|
35620
35716
|
input.signal.throwIfAborted();
|
|
35621
35717
|
const evidence = [];
|
|
@@ -35642,6 +35738,12 @@ var init_grok_adapter = __esm({
|
|
|
35642
35738
|
} }
|
|
35643
35739
|
] : [];
|
|
35644
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
|
+
}
|
|
35645
35747
|
const callId = randomUUID5();
|
|
35646
35748
|
const tool = name;
|
|
35647
35749
|
const result3 = await agent.executeTool({ callId, tool, arguments: args });
|
|
@@ -35655,12 +35757,19 @@ var init_grok_adapter = __esm({
|
|
|
35655
35757
|
expectedSystemPrompt: input.systemPrompt,
|
|
35656
35758
|
requestedModel: input.requestedModel,
|
|
35657
35759
|
requestedReasoningEffort: input.requestedReasoningEffort,
|
|
35760
|
+
allowedEffectiveModels,
|
|
35658
35761
|
allowedToolNames: agent ? ["search_tool", "use_tool"] : [],
|
|
35659
35762
|
deadlineAtMs: input.deadlineAtMs,
|
|
35660
35763
|
providerDispatchNotAfterMs: provider?.providerDispatchNotAfterMs,
|
|
35661
35764
|
onProviderDispatch: provider?.onProviderDispatch,
|
|
35662
35765
|
signal: input.signal,
|
|
35663
35766
|
fetchImpl: this.options.fetchImpl,
|
|
35767
|
+
onResponseIdentityFailure: (diagnostic) => this.options.emitDiagnosticEvent?.({
|
|
35768
|
+
event: "grok_response_identity_failed",
|
|
35769
|
+
attempt_id: provider?.attemptId ?? null,
|
|
35770
|
+
control_mode: provider ? "provider" : "agent",
|
|
35771
|
+
...diagnostic
|
|
35772
|
+
}),
|
|
35664
35773
|
onToolValidationFailure: (diagnostic) => this.options.emitDiagnosticEvent?.({
|
|
35665
35774
|
event: "grok_tool_validation_failed",
|
|
35666
35775
|
attempt_id: provider?.attemptId ?? null,
|
|
@@ -35719,6 +35828,7 @@ var init_grok_adapter = __esm({
|
|
|
35719
35828
|
effectiveModel: input.requestedModel,
|
|
35720
35829
|
effectiveReasoningEffort: input.requestedReasoningEffort
|
|
35721
35830
|
};
|
|
35831
|
+
activeThread = thread;
|
|
35722
35832
|
if (agent) {
|
|
35723
35833
|
await agent.onThreadReady?.(thread);
|
|
35724
35834
|
retained = true;
|
|
@@ -35743,15 +35853,17 @@ var init_grok_adapter = __esm({
|
|
|
35743
35853
|
if (meta3.structuredOutputError || meta3.structuredOutput === void 0) throw new Error("grok_structured_output_missing");
|
|
35744
35854
|
const text = JSON.stringify(meta3.structuredOutput);
|
|
35745
35855
|
if (Buffer.byteLength(text) > 3e5) throw new Error("grok_result_too_large");
|
|
35746
|
-
const usage = grokPromptUsage(meta3.usage, input.requestedModel);
|
|
35856
|
+
const usage = grokPromptUsage(meta3.usage, input.requestedModel, allowedEffectiveModels);
|
|
35747
35857
|
const actualModel = Object.keys(grokObject(grokObject(meta3.usage).modelUsage))[0];
|
|
35748
35858
|
if (!proxy.dispatched || !proxy.responded || proxy.terminalFailure) throw new Error(proxy.failureCode ?? "grok_transport_receipt_missing");
|
|
35749
35859
|
const receipts = proxy.receipts;
|
|
35750
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) {
|
|
35751
35861
|
throw new Error("grok_transport_usage_mismatch");
|
|
35752
35862
|
}
|
|
35863
|
+
const effectiveThread = { ...thread, effectiveModel: actualModel };
|
|
35864
|
+
if (agent && activeThread.effectiveModel !== actualModel) await agent.onThreadReady?.(effectiveThread);
|
|
35753
35865
|
provider?.onTerminalDispatchOutcome?.("confirmed_dispatched");
|
|
35754
|
-
return { thread, turn: {
|
|
35866
|
+
return { thread: effectiveThread, turn: {
|
|
35755
35867
|
text,
|
|
35756
35868
|
reasoningContent: thought || null,
|
|
35757
35869
|
reasoningSummary: null,
|
|
@@ -35785,7 +35897,8 @@ var init_grok_adapter = __esm({
|
|
|
35785
35897
|
httpStatusCode: proxy?.rejectionStatus,
|
|
35786
35898
|
retryable: false,
|
|
35787
35899
|
dispatchOutcome: outcome,
|
|
35788
|
-
grokToolValidation: proxy?.toolValidationFailure ?? null
|
|
35900
|
+
grokToolValidation: proxy?.toolValidationFailure ?? null,
|
|
35901
|
+
grokResponseIdentity: proxy?.responseIdentityFailure ?? null
|
|
35789
35902
|
});
|
|
35790
35903
|
} finally {
|
|
35791
35904
|
try {
|
|
@@ -37287,8 +37400,8 @@ var init_runner = __esm({
|
|
|
37287
37400
|
init_mcp_client();
|
|
37288
37401
|
init_config();
|
|
37289
37402
|
init_oauth();
|
|
37290
|
-
terminalFailureRequiresManualRecovery = (error48) => (error48.terminalEvidence !== null || error48.grokToolValidation != null) && !error48.retryable && error48.category !== "auth" && !["quota_exceeded", "codex_rate_limited", "provider_rate_limited"].includes(error48.code);
|
|
37291
|
-
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");
|
|
37403
|
+
terminalFailureRequiresManualRecovery = (error48) => (error48.terminalEvidence !== null || error48.grokToolValidation != null || error48.grokResponseIdentity != null) && !error48.retryable && error48.category !== "auth" && !["quota_exceeded", "codex_rate_limited", "provider_rate_limited"].includes(error48.code);
|
|
37404
|
+
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.grok_response_identity != null) && state.pending_turn.terminal_receipt.dispatch_outcome === "outcome_unknown");
|
|
37292
37405
|
RUNTIME_RECEIPT_SCHEMA_VERSION = "vtx_inference_host_runtime_v1";
|
|
37293
37406
|
ATTEMPT_RECEIPT_SCHEMA_VERSION = "vtx_inference_attempt_receipt_v1";
|
|
37294
37407
|
CLAIM_DISPATCH_BATCH_SIZE = 16;
|
|
@@ -37328,7 +37441,7 @@ var init_runner = __esm({
|
|
|
37328
37441
|
supported_control_modes: [...supportedControlModes],
|
|
37329
37442
|
allowed_model_identities: [{
|
|
37330
37443
|
requested_model: capability.model,
|
|
37331
|
-
effective_models: [capability.model]
|
|
37444
|
+
effective_models: [...capability.allowedEffectiveModels ?? [capability.model]]
|
|
37332
37445
|
}],
|
|
37333
37446
|
structured_output: structuredOutput,
|
|
37334
37447
|
same_attempt_recovery: sameAttemptRecovery,
|
|
@@ -40465,6 +40578,11 @@ var init_runner = __esm({
|
|
|
40465
40578
|
signal,
|
|
40466
40579
|
deadlineAtMs: Date.parse(jobInput.evidence_expires_at)
|
|
40467
40580
|
}) === true);
|
|
40581
|
+
const identityDiagnostic = heartbeatFailure === void 0 && effectiveError instanceof CodexAppServerError && failure2.code === "grok_provider_identity_mismatch" && dispatchOutcome === "outcome_unknown" ? effectiveError.grokResponseIdentity ?? null : null;
|
|
40582
|
+
const sendIdentityDiagnostic = identityDiagnostic !== null && (mcp.supportsGrokResponseIdentityDiagnostics?.("inference.job.fail") === true || await mcp.refreshGrokResponseIdentitySupport?.("inference.job.fail", {
|
|
40583
|
+
signal,
|
|
40584
|
+
deadlineAtMs: Date.parse(jobInput.evidence_expires_at)
|
|
40585
|
+
}) === true);
|
|
40468
40586
|
const failureRequest = jobFailRequestSchema.parse({
|
|
40469
40587
|
schema_version: "external_inference_job_fail_v1",
|
|
40470
40588
|
contract_version: EXTERNAL_INFERENCE_CONTRACT_VERSION,
|
|
@@ -40506,6 +40624,7 @@ var init_runner = __esm({
|
|
|
40506
40624
|
provider_dispatch_freshness_remaining_ms: providerDispatchFreshnessRemainingMs,
|
|
40507
40625
|
...processExit ? { process_exit: processExit } : {},
|
|
40508
40626
|
...sendGrokDiagnostic ? { grok_tool_validation: grokDiagnostic } : {},
|
|
40627
|
+
...sendIdentityDiagnostic ? { grok_response_identity: identityDiagnostic } : {},
|
|
40509
40628
|
membership_disposition: membershipFailureDisposition({
|
|
40510
40629
|
...failure2,
|
|
40511
40630
|
dispatchOutcome
|
|
@@ -40577,6 +40696,7 @@ var init_runner = __esm({
|
|
|
40577
40696
|
}
|
|
40578
40697
|
};
|
|
40579
40698
|
createInferenceAgentControlClient = (mcp) => ({
|
|
40699
|
+
supportsGrokResponseIdentityDiagnostics: async (options = {}) => mcp.supportsGrokResponseIdentityDiagnostics?.("inference.agent.assignment.heartbeat") === true || await mcp.refreshGrokResponseIdentitySupport?.("inference.agent.assignment.heartbeat", options) === true,
|
|
40580
40700
|
supportsGrokToolValidationDiagnostics: async (options = {}) => mcp.supportsGrokToolValidationDiagnostics?.("inference.agent.assignment.heartbeat") === true || await mcp.refreshGrokToolValidationSupport?.("inference.agent.assignment.heartbeat", options) === true,
|
|
40581
40701
|
nextAssignment: async (request, options) => {
|
|
40582
40702
|
const result2 = await mcp.callTool("inference.agent.assignment.next", {
|
|
@@ -41124,11 +41244,13 @@ var init_runner = __esm({
|
|
|
41124
41244
|
return nextWakeAtMs;
|
|
41125
41245
|
} catch (error48) {
|
|
41126
41246
|
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;
|
|
41127
|
-
|
|
41247
|
+
const identityDiagnostic = error48 instanceof CodexAppServerError && error48.grokResponseIdentity && error48.code === "grok_provider_identity_mismatch" && error48.dispatchOutcome === "outcome_unknown" && await this.options.controlClient.supportsGrokResponseIdentityDiagnostics?.({}) === true ? error48.grokResponseIdentity : null;
|
|
41248
|
+
const hasDiagnostic = diagnostic != null || identityDiagnostic != null;
|
|
41249
|
+
if (error48 instanceof CodexAppServerError && error48.dispatchOutcome === "not_dispatched" && error48.terminalEvidence === null && !hasDiagnostic) {
|
|
41128
41250
|
state = { ...state, pending_turn: null, updated_at: nowIso() };
|
|
41129
41251
|
await writeInferenceAgentRuntimeState(this.options.statePath, state);
|
|
41130
41252
|
}
|
|
41131
|
-
if (state.pending_turn && !state.pending_turn.terminal_receipt && error48 instanceof CodexAppServerError && (
|
|
41253
|
+
if (state.pending_turn && !state.pending_turn.terminal_receipt && error48 instanceof CodexAppServerError && (hasDiagnostic || error48.terminalEvidence !== null || error48.dispatchOutcome === "confirmed_dispatched" && ["provider_rate_limited", "codex_rate_limited", "quota_exceeded"].includes(error48.code))) {
|
|
41132
41254
|
state = { ...state, pending_turn: {
|
|
41133
41255
|
...state.pending_turn,
|
|
41134
41256
|
terminal_receipt: {
|
|
@@ -41137,19 +41259,23 @@ var init_runner = __esm({
|
|
|
41137
41259
|
turn_id: state.pending_turn.turn_id,
|
|
41138
41260
|
agent_run_id: state.thread?.threadId ?? state.pending_turn.turn_id,
|
|
41139
41261
|
requested_model: assignment.model_id,
|
|
41140
|
-
effective_model:
|
|
41262
|
+
effective_model: hasDiagnostic ? null : error48.terminalEvidence?.effectiveModel ?? null,
|
|
41141
41263
|
requested_reasoning_effort: assignment.reasoning_effort,
|
|
41142
|
-
effective_reasoning_effort:
|
|
41264
|
+
effective_reasoning_effort: hasDiagnostic ? null : error48.terminalEvidence?.effectiveReasoningEffort ?? null,
|
|
41143
41265
|
started_at: state.pending_turn.started_at,
|
|
41144
41266
|
completed_at: nowIso(),
|
|
41145
|
-
adapter_request_id:
|
|
41146
|
-
adapter_response_id:
|
|
41147
|
-
usage: !
|
|
41267
|
+
adapter_request_id: hasDiagnostic ? null : error48.terminalEvidence?.adapterRequestId ?? null,
|
|
41268
|
+
adapter_response_id: hasDiagnostic ? null : error48.terminalEvidence?.adapterResponseId ?? null,
|
|
41269
|
+
usage: !hasDiagnostic && error48.usage ? reportedTokenUsage(error48.usage, this.options.adapterId) : {
|
|
41148
41270
|
schema_version: EXTERNAL_INFERENCE_USAGE_SCHEMA_VERSION,
|
|
41149
41271
|
availability: "unavailable",
|
|
41150
41272
|
reason_code: "terminal_usage_unavailable"
|
|
41151
41273
|
},
|
|
41152
41274
|
decision_operation_ids: [...state.pending_turn.decision_operation_ids],
|
|
41275
|
+
...identityDiagnostic ? {
|
|
41276
|
+
grok_response_identity: identityDiagnostic,
|
|
41277
|
+
dispatch_outcome: "outcome_unknown"
|
|
41278
|
+
} : {},
|
|
41153
41279
|
...diagnostic ? {
|
|
41154
41280
|
grok_tool_validation: diagnostic,
|
|
41155
41281
|
dispatch_outcome: error48.dispatchOutcome === "not_dispatched" ? "not_dispatched" : "outcome_unknown"
|
|
@@ -44615,7 +44741,7 @@ Waiting for approval...
|
|
|
44615
44741
|
process.stdout.write(text);
|
|
44616
44742
|
}))(`${JSON.stringify(event)}
|
|
44617
44743
|
`) : adapterId === "codex" || adapterId === "grok-build" ? (event) => {
|
|
44618
|
-
if (!["codex_app_server_closed", "codex_app_server_session_started", "grok_tool_validation_failed"].includes(
|
|
44744
|
+
if (!["codex_app_server_closed", "codex_app_server_session_started", "grok_tool_validation_failed", "grok_response_identity_failed"].includes(
|
|
44619
44745
|
String(event.event ?? "")
|
|
44620
44746
|
)) return;
|
|
44621
44747
|
(dependencies.emitStderr ?? ((text) => {
|