@vtxmacro/cli 2026.9.24 → 2026.9.25
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 +142 -73
- 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.25",
|
|
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
|
@@ -69,7 +69,7 @@ var init_agent_cli_release = __esm({
|
|
|
69
69
|
"agent-cli-release.json"() {
|
|
70
70
|
agent_cli_release_default = {
|
|
71
71
|
package_name: "@vtxmacro/cli",
|
|
72
|
-
package_version: "2026.9.
|
|
72
|
+
package_version: "2026.9.25",
|
|
73
73
|
codex_package_name: "@openai/codex",
|
|
74
74
|
codex_version: "0.153.3",
|
|
75
75
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -19221,7 +19221,7 @@ ${body}`;
|
|
|
19221
19221
|
});
|
|
19222
19222
|
|
|
19223
19223
|
// lib/inference-host/mcp-client.ts
|
|
19224
|
-
var EXTERNAL_INFERENCE_MCP_PROTOCOL_VERSION, EXTERNAL_INFERENCE_AUTOMATED_HOST_TOOLS, EXTERNAL_INFERENCE_OPERATIONAL_TOOLS, ExternalInferenceMcpError, DEFAULT_REQUEST_TIMEOUT_MS, MAX_RETRY_AFTER_MS, PUBLIC_TOOL_ERROR_PREFIX, parseRetryAfterMs, identifierSchema2, safeCodeSchema2, publicFailureCodeSchema, publicToolErrorSchema, structuredPublicToolErrorSchema, parsePublicToolError, hostMutationResultSchema, attemptStartResultSchema, agentConnectResultSchema, agentHeartbeatResultSchema, timestampSchema2, positiveGenerationSchema, jsonObjectSchema, agentAssignmentNextArgumentsSchema, agentDataCapabilityDescriptorSchema, agentAssignmentNextResultSchema, agentAssignmentHeartbeatArgumentsSchema, agentAssignmentHeartbeatResultSchema, agentDataCallArgumentsSchema, agentDataCallResultSchema, agentDecisionSubmitArgumentsSchema, agentDecisionSubmitResultSchema, agentDecisionStatusArgumentsSchema, agentDecisionStatusResultSchema, agentAssignmentReleaseArgumentsSchema, agentAssignmentReleaseResultSchema, jobCompletionResultSchema, jobFailureResultSchema, toolContracts, discoveryResultSchema, toolListResultSchema, inlineStructuredContentSchema, protocolMeta, parseJsonDocument, parseSseDocuments, parseResponseDocuments, exactOperationalInventory, exactJson, invalidBoundResult, verifyToolResult, ExternalInferenceMcpClient;
|
|
19224
|
+
var EXTERNAL_INFERENCE_MCP_PROTOCOL_VERSION, EXTERNAL_INFERENCE_AUTOMATED_HOST_TOOLS, EXTERNAL_INFERENCE_OPERATIONAL_TOOLS, ClaimTiming, ExternalInferenceMcpError, DEFAULT_REQUEST_TIMEOUT_MS, MAX_RETRY_AFTER_MS, PUBLIC_TOOL_ERROR_PREFIX, parseRetryAfterMs, identifierSchema2, safeCodeSchema2, publicFailureCodeSchema, publicToolErrorSchema, structuredPublicToolErrorSchema, parsePublicToolError, hostMutationResultSchema, attemptStartResultSchema, agentConnectResultSchema, agentHeartbeatResultSchema, timestampSchema2, positiveGenerationSchema, jsonObjectSchema, agentAssignmentNextArgumentsSchema, agentDataCapabilityDescriptorSchema, agentAssignmentNextResultSchema, agentAssignmentHeartbeatArgumentsSchema, agentAssignmentHeartbeatResultSchema, agentDataCallArgumentsSchema, agentDataCallResultSchema, agentDecisionSubmitArgumentsSchema, agentDecisionSubmitResultSchema, agentDecisionStatusArgumentsSchema, agentDecisionStatusResultSchema, agentAssignmentReleaseArgumentsSchema, agentAssignmentReleaseResultSchema, jobCompletionResultSchema, jobFailureResultSchema, toolContracts, discoveryResultSchema, toolListResultSchema, inlineStructuredContentSchema, protocolMeta, parseJsonDocument, parseSseDocuments, parseResponseDocuments, exactOperationalInventory, exactJson, invalidBoundResult, verifyToolResult, ExternalInferenceMcpClient;
|
|
19225
19225
|
var init_mcp_client = __esm({
|
|
19226
19226
|
"lib/inference-host/mcp-client.ts"() {
|
|
19227
19227
|
"use strict";
|
|
@@ -19254,6 +19254,42 @@ var init_mcp_client = __esm({
|
|
|
19254
19254
|
"inference.agent.complete",
|
|
19255
19255
|
"inference.agent.fail"
|
|
19256
19256
|
];
|
|
19257
|
+
ClaimTiming = class {
|
|
19258
|
+
constructor() {
|
|
19259
|
+
this.startedAt = performance.now();
|
|
19260
|
+
this.changedAt = this.startedAt;
|
|
19261
|
+
this.phase = "other_ms";
|
|
19262
|
+
this.finished = false;
|
|
19263
|
+
this.elapsed = {
|
|
19264
|
+
token_lookup_ms: 0,
|
|
19265
|
+
fetch_headers_ms: 0,
|
|
19266
|
+
body_reception_ms: 0,
|
|
19267
|
+
response_parse_ms: 0,
|
|
19268
|
+
response_validation_ms: 0,
|
|
19269
|
+
other_ms: 0
|
|
19270
|
+
};
|
|
19271
|
+
this.transportAttempts = 0;
|
|
19272
|
+
this.tokenRefreshes = 0;
|
|
19273
|
+
}
|
|
19274
|
+
enter(phase) {
|
|
19275
|
+
if (this.finished) return;
|
|
19276
|
+
const at = performance.now();
|
|
19277
|
+
this.elapsed[this.phase] += Math.max(0, at - this.changedAt);
|
|
19278
|
+
this.changedAt = at;
|
|
19279
|
+
this.phase = phase;
|
|
19280
|
+
}
|
|
19281
|
+
finish(outcome) {
|
|
19282
|
+
this.enter("other_ms");
|
|
19283
|
+
this.finished = true;
|
|
19284
|
+
return Object.freeze({
|
|
19285
|
+
...this.elapsed,
|
|
19286
|
+
total_ms: Math.max(0, this.changedAt - this.startedAt),
|
|
19287
|
+
transport_attempts: this.transportAttempts,
|
|
19288
|
+
token_refreshes: this.tokenRefreshes,
|
|
19289
|
+
outcome
|
|
19290
|
+
});
|
|
19291
|
+
}
|
|
19292
|
+
};
|
|
19257
19293
|
ExternalInferenceMcpError = class extends Error {
|
|
19258
19294
|
constructor(code, message, options = {}) {
|
|
19259
19295
|
super(message, { cause: options.cause });
|
|
@@ -19662,9 +19698,11 @@ var init_mcp_client = __esm({
|
|
|
19662
19698
|
}
|
|
19663
19699
|
return documents;
|
|
19664
19700
|
};
|
|
19665
|
-
parseResponseDocuments = async (response) => {
|
|
19701
|
+
parseResponseDocuments = async (response, timing) => {
|
|
19666
19702
|
const contentType = String(response.headers.get("content-type") || "").split(";", 1)[0].trim().toLowerCase();
|
|
19703
|
+
timing?.enter("body_reception_ms");
|
|
19667
19704
|
const body = await response.text();
|
|
19705
|
+
timing?.enter("response_parse_ms");
|
|
19668
19706
|
if (contentType === "application/json") return [parseJsonDocument(body)];
|
|
19669
19707
|
if (contentType === "text/event-stream") return parseSseDocuments(body);
|
|
19670
19708
|
throw new ExternalInferenceMcpError(
|
|
@@ -19852,75 +19890,90 @@ var init_mcp_client = __esm({
|
|
|
19852
19890
|
this.#initialized = true;
|
|
19853
19891
|
}
|
|
19854
19892
|
async callTool(name, argumentsValue, options = {}) {
|
|
19855
|
-
|
|
19856
|
-
|
|
19857
|
-
|
|
19858
|
-
|
|
19859
|
-
|
|
19860
|
-
|
|
19861
|
-
|
|
19862
|
-
|
|
19863
|
-
|
|
19864
|
-
|
|
19865
|
-
|
|
19866
|
-
|
|
19867
|
-
|
|
19868
|
-
|
|
19869
|
-
|
|
19870
|
-
|
|
19871
|
-
|
|
19872
|
-
type: external_exports.string(),
|
|
19873
|
-
text: external_exports.string().optional()
|
|
19874
|
-
}).passthrough()).optional(),
|
|
19875
|
-
structuredContent: external_exports.unknown()
|
|
19876
|
-
}).passthrough().parse(rawResult);
|
|
19877
|
-
if (callResult.isError === true) {
|
|
19878
|
-
const errorText = (callResult.content ?? []).filter((block) => block.type === "text").map((block) => block.text ?? "").join("\n");
|
|
19879
|
-
const structuredPublicToolError = structuredPublicToolErrorSchema.safeParse(
|
|
19880
|
-
callResult.structuredContent
|
|
19881
|
-
);
|
|
19882
|
-
const structuredDocument = callResult.structuredContent !== null && typeof callResult.structuredContent === "object" && !Array.isArray(callResult.structuredContent) ? callResult.structuredContent : null;
|
|
19883
|
-
const hasStructuredPublicToolErrorMarker = structuredDocument?.schema_version === "vtx_insights_tool_error_v1";
|
|
19884
|
-
const publicToolError = structuredPublicToolError.success ? structuredPublicToolError.data : hasStructuredPublicToolErrorMarker ? null : parsePublicToolError(errorText);
|
|
19885
|
-
const hasPublicToolErrorMarker = hasStructuredPublicToolErrorMarker || errorText.includes(PUBLIC_TOOL_ERROR_PREFIX);
|
|
19886
|
-
const completionEvidenceExpired = name === "inference.job.complete" && (publicToolError ? publicToolError.failure_code === "completion_evidence_expired" && publicToolError.phase === "validation" && publicToolError.retryable === false && publicToolError.terminal_before_execution === true : !hasPublicToolErrorMarker && errorText.includes("External inference completion evidence window expired"));
|
|
19887
|
-
const hostNotClaimable = name === "inference.job.claim" && publicToolError?.failure_code === "host_not_claimable" && publicToolError.phase === "admission" && publicToolError.retryable === true && publicToolError.terminal_before_execution === true;
|
|
19888
|
-
const definitivelyNotApplied = name === "inference.agent.decision.submit" && publicToolError?.phase === "validation" && publicToolError.retryable === false && publicToolError.terminal_before_execution === true && (publicToolError.failure_code === "agent_decision_schema_invalid" || publicToolError.failure_code === "invalid_arguments" && publicToolError.reason_code === "schema_validation") || (name === "inference.host.register" || name === "inference.host.advertise") && (errorText.includes("Advertisement time is outside the allowed clock skew.") || errorText.includes("Advertisement is already expired.")) || (name === "inference.agent.next" || name === "inference.agent.heartbeat") && (errorText.includes("Advertisement time is outside the allowed clock skew.") || errorText.includes("Advertisement is already expired.") || errorText.includes("Heartbeat time is outside the allowed clock skew.")) || name === "inference.host.heartbeat" && errorText.includes("Heartbeat time is outside the allowed clock skew.") || name === "inference.job.claim" && (errorText.includes(
|
|
19889
|
-
"External inference claim request was not applied before its generation became stale"
|
|
19890
|
-
) || errorText.includes("External inference host advertisement is expired or superseded")) || name === "inference.job.complete" && completionEvidenceExpired;
|
|
19891
|
-
const retryableInfrastructureRejection = EXTERNAL_INFERENCE_AUTOMATED_HOST_TOOLS.includes(name) && (errorText.includes("External inference polling is at its configured concurrency limit") || errorText.includes("The Insights action reached the response timeout") || errorText.includes("Insights capability failed without exposing private runtime details"));
|
|
19892
|
-
const retryableClaimRejection = name === "inference.job.claim" && !definitivelyNotApplied && (retryableInfrastructureRejection || hostNotClaimable || errorText.includes("External inference host is not live enough to claim work") || errorText.includes("External inference host request generation is stale") || errorText.includes("External inference claim runtime fence is stale"));
|
|
19893
|
-
const retryableHeartbeatClockSkew = name === "inference.host.heartbeat" && definitivelyNotApplied;
|
|
19894
|
-
const retryableAdvertisementClockSkew = (name === "inference.host.register" || name === "inference.host.advertise") && definitivelyNotApplied;
|
|
19895
|
-
const staleHostHeartbeatGeneration = name === "inference.host.heartbeat" && errorText.includes("Heartbeat generations do not match the current host authority.");
|
|
19896
|
-
const obsoleteClaimReplay = name === "inference.job.claim" && errorText.includes(
|
|
19897
|
-
"External inference claim replay is no longer dispatchable"
|
|
19893
|
+
const timing = name === "inference.job.claim" && options.onClaimTiming ? new ClaimTiming() : void 0;
|
|
19894
|
+
let outcome = "failure";
|
|
19895
|
+
try {
|
|
19896
|
+
if (!this.#initialized) {
|
|
19897
|
+
throw new ExternalInferenceMcpError(
|
|
19898
|
+
"not_initialized",
|
|
19899
|
+
"Insights MCP inventory must be verified before calling an inference operation."
|
|
19900
|
+
);
|
|
19901
|
+
}
|
|
19902
|
+
const contract = toolContracts[name];
|
|
19903
|
+
const argumentsDocument = contract.arguments.parse(argumentsValue);
|
|
19904
|
+
const rawResult = await this.#request(
|
|
19905
|
+
"tools/call",
|
|
19906
|
+
{ name, arguments: argumentsDocument },
|
|
19907
|
+
name,
|
|
19908
|
+
options,
|
|
19909
|
+
timing
|
|
19898
19910
|
);
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
|
|
19902
|
-
{
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
+
timing?.enter("response_validation_ms");
|
|
19912
|
+
const callResult = external_exports.object({
|
|
19913
|
+
isError: external_exports.boolean().optional(),
|
|
19914
|
+
content: external_exports.array(external_exports.object({
|
|
19915
|
+
type: external_exports.string(),
|
|
19916
|
+
text: external_exports.string().optional()
|
|
19917
|
+
}).passthrough()).optional(),
|
|
19918
|
+
structuredContent: external_exports.unknown()
|
|
19919
|
+
}).passthrough().parse(rawResult);
|
|
19920
|
+
if (callResult.isError === true) {
|
|
19921
|
+
const errorText = (callResult.content ?? []).filter((block) => block.type === "text").map((block) => block.text ?? "").join("\n");
|
|
19922
|
+
const structuredPublicToolError = structuredPublicToolErrorSchema.safeParse(
|
|
19923
|
+
callResult.structuredContent
|
|
19924
|
+
);
|
|
19925
|
+
const structuredDocument = callResult.structuredContent !== null && typeof callResult.structuredContent === "object" && !Array.isArray(callResult.structuredContent) ? callResult.structuredContent : null;
|
|
19926
|
+
const hasStructuredPublicToolErrorMarker = structuredDocument?.schema_version === "vtx_insights_tool_error_v1";
|
|
19927
|
+
const publicToolError = structuredPublicToolError.success ? structuredPublicToolError.data : hasStructuredPublicToolErrorMarker ? null : parsePublicToolError(errorText);
|
|
19928
|
+
const hasPublicToolErrorMarker = hasStructuredPublicToolErrorMarker || errorText.includes(PUBLIC_TOOL_ERROR_PREFIX);
|
|
19929
|
+
const completionEvidenceExpired = name === "inference.job.complete" && (publicToolError ? publicToolError.failure_code === "completion_evidence_expired" && publicToolError.phase === "validation" && publicToolError.retryable === false && publicToolError.terminal_before_execution === true : !hasPublicToolErrorMarker && errorText.includes("External inference completion evidence window expired"));
|
|
19930
|
+
const hostNotClaimable = name === "inference.job.claim" && publicToolError?.failure_code === "host_not_claimable" && publicToolError.phase === "admission" && publicToolError.retryable === true && publicToolError.terminal_before_execution === true;
|
|
19931
|
+
const definitivelyNotApplied = name === "inference.agent.decision.submit" && publicToolError?.phase === "validation" && publicToolError.retryable === false && publicToolError.terminal_before_execution === true && (publicToolError.failure_code === "agent_decision_schema_invalid" || publicToolError.failure_code === "invalid_arguments" && publicToolError.reason_code === "schema_validation") || (name === "inference.host.register" || name === "inference.host.advertise") && (errorText.includes("Advertisement time is outside the allowed clock skew.") || errorText.includes("Advertisement is already expired.")) || (name === "inference.agent.next" || name === "inference.agent.heartbeat") && (errorText.includes("Advertisement time is outside the allowed clock skew.") || errorText.includes("Advertisement is already expired.") || errorText.includes("Heartbeat time is outside the allowed clock skew.")) || name === "inference.host.heartbeat" && errorText.includes("Heartbeat time is outside the allowed clock skew.") || name === "inference.job.claim" && (errorText.includes(
|
|
19932
|
+
"External inference claim request was not applied before its generation became stale"
|
|
19933
|
+
) || errorText.includes("External inference host advertisement is expired or superseded")) || name === "inference.job.complete" && completionEvidenceExpired;
|
|
19934
|
+
const retryableInfrastructureRejection = EXTERNAL_INFERENCE_AUTOMATED_HOST_TOOLS.includes(name) && (errorText.includes("External inference polling is at its configured concurrency limit") || errorText.includes("The Insights action reached the response timeout") || errorText.includes("Insights capability failed without exposing private runtime details"));
|
|
19935
|
+
const retryableClaimRejection = name === "inference.job.claim" && !definitivelyNotApplied && (retryableInfrastructureRejection || hostNotClaimable || errorText.includes("External inference host is not live enough to claim work") || errorText.includes("External inference host request generation is stale") || errorText.includes("External inference claim runtime fence is stale"));
|
|
19936
|
+
const retryableHeartbeatClockSkew = name === "inference.host.heartbeat" && definitivelyNotApplied;
|
|
19937
|
+
const retryableAdvertisementClockSkew = (name === "inference.host.register" || name === "inference.host.advertise") && definitivelyNotApplied;
|
|
19938
|
+
const staleHostHeartbeatGeneration = name === "inference.host.heartbeat" && errorText.includes("Heartbeat generations do not match the current host authority.");
|
|
19939
|
+
const obsoleteClaimReplay = name === "inference.job.claim" && errorText.includes(
|
|
19940
|
+
"External inference claim replay is no longer dispatchable"
|
|
19941
|
+
);
|
|
19942
|
+
throw new ExternalInferenceMcpError(
|
|
19943
|
+
completionEvidenceExpired ? "completion_evidence_expired" : staleHostHeartbeatGeneration ? "generation_stale" : obsoleteClaimReplay ? "claim_replay_obsolete" : "tool_rejected",
|
|
19944
|
+
`Insights MCP rejected ${name}.`,
|
|
19945
|
+
{
|
|
19946
|
+
definitivelyNotApplied: definitivelyNotApplied || staleHostHeartbeatGeneration,
|
|
19947
|
+
// Claim polling is an idempotent control-plane operation. During an
|
|
19948
|
+
// API rotation the MCP server can return a tool error after the
|
|
19949
|
+
// request reached the application boundary, so retain and replay
|
|
19950
|
+
// the exact request unless the server proves it was not applied.
|
|
19951
|
+
retryable: retryableInfrastructureRejection || retryableClaimRejection || retryableHeartbeatClockSkew || retryableAdvertisementClockSkew,
|
|
19952
|
+
serverFailureCode: publicToolError?.failure_code ?? null,
|
|
19953
|
+
retryAfterMs: hostNotClaimable ? publicToolError?.retry_after_ms ?? null : null
|
|
19954
|
+
}
|
|
19955
|
+
);
|
|
19956
|
+
}
|
|
19957
|
+
const structured = inlineStructuredContentSchema.parse(callResult.structuredContent);
|
|
19958
|
+
if (structured.capability !== name) {
|
|
19959
|
+
throw new ExternalInferenceMcpError(
|
|
19960
|
+
"invalid_response",
|
|
19961
|
+
"Insights MCP returned a result for a different capability."
|
|
19962
|
+
);
|
|
19963
|
+
}
|
|
19964
|
+
const result2 = contract.result.parse(structured.result);
|
|
19965
|
+
verifyToolResult(name, argumentsDocument, result2);
|
|
19966
|
+
outcome = "success";
|
|
19967
|
+
return result2;
|
|
19968
|
+
} finally {
|
|
19969
|
+
if (timing) {
|
|
19970
|
+
const receipt = timing.finish(outcome);
|
|
19971
|
+
try {
|
|
19972
|
+
void Promise.resolve(options.onClaimTiming?.(receipt)).catch(() => void 0);
|
|
19973
|
+
} catch {
|
|
19911
19974
|
}
|
|
19912
|
-
|
|
19913
|
-
}
|
|
19914
|
-
const structured = inlineStructuredContentSchema.parse(callResult.structuredContent);
|
|
19915
|
-
if (structured.capability !== name) {
|
|
19916
|
-
throw new ExternalInferenceMcpError(
|
|
19917
|
-
"invalid_response",
|
|
19918
|
-
"Insights MCP returned a result for a different capability."
|
|
19919
|
-
);
|
|
19975
|
+
}
|
|
19920
19976
|
}
|
|
19921
|
-
const result2 = contract.result.parse(structured.result);
|
|
19922
|
-
verifyToolResult(name, argumentsDocument, result2);
|
|
19923
|
-
return result2;
|
|
19924
19977
|
}
|
|
19925
19978
|
async #token(refresh, options) {
|
|
19926
19979
|
try {
|
|
@@ -19944,7 +19997,7 @@ var init_mcp_client = __esm({
|
|
|
19944
19997
|
);
|
|
19945
19998
|
}
|
|
19946
19999
|
}
|
|
19947
|
-
async #request(method, params, name, options = {}) {
|
|
20000
|
+
async #request(method, params, name, options = {}, timing) {
|
|
19948
20001
|
const timeoutMs = options.timeoutMs ?? this.#requestTimeoutMs;
|
|
19949
20002
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1) {
|
|
19950
20003
|
throw new ExternalInferenceMcpError(
|
|
@@ -19968,22 +20021,32 @@ var init_mcp_client = __esm({
|
|
|
19968
20021
|
_meta: protocolMeta(this.#clientName, this.#clientVersion)
|
|
19969
20022
|
}
|
|
19970
20023
|
};
|
|
20024
|
+
timing?.enter("token_lookup_ms");
|
|
20025
|
+
const token = await this.#token(false, boundedOptions);
|
|
20026
|
+
timing?.enter("fetch_headers_ms");
|
|
20027
|
+
if (timing) timing.transportAttempts += 1;
|
|
19971
20028
|
let response = await this.#send(
|
|
19972
20029
|
method,
|
|
19973
20030
|
name,
|
|
19974
20031
|
body,
|
|
19975
|
-
|
|
20032
|
+
token,
|
|
19976
20033
|
boundedOptions
|
|
19977
20034
|
);
|
|
19978
20035
|
if (response.status === 401 && this.#tokenSource.refreshAccessToken) {
|
|
20036
|
+
timing?.enter("token_lookup_ms");
|
|
20037
|
+
if (timing) timing.tokenRefreshes += 1;
|
|
20038
|
+
const refreshedToken = await this.#token(true, boundedOptions);
|
|
20039
|
+
timing?.enter("fetch_headers_ms");
|
|
20040
|
+
if (timing) timing.transportAttempts += 1;
|
|
19979
20041
|
response = await this.#send(
|
|
19980
20042
|
method,
|
|
19981
20043
|
name,
|
|
19982
20044
|
body,
|
|
19983
|
-
|
|
20045
|
+
refreshedToken,
|
|
19984
20046
|
boundedOptions
|
|
19985
20047
|
);
|
|
19986
20048
|
}
|
|
20049
|
+
timing?.enter("other_ms");
|
|
19987
20050
|
if (!response.ok) {
|
|
19988
20051
|
const httpStatusCode = response.status;
|
|
19989
20052
|
const retryAfterMs = parseRetryAfterMs(response);
|
|
@@ -19998,7 +20061,7 @@ var init_mcp_client = __esm({
|
|
|
19998
20061
|
let documents;
|
|
19999
20062
|
try {
|
|
20000
20063
|
documents = await this.#bounded(
|
|
20001
|
-
parseResponseDocuments(response),
|
|
20064
|
+
parseResponseDocuments(response, timing),
|
|
20002
20065
|
boundedOptions,
|
|
20003
20066
|
"request_timeout"
|
|
20004
20067
|
);
|
|
@@ -20006,6 +20069,7 @@ var init_mcp_client = __esm({
|
|
|
20006
20069
|
await response.body?.cancel().catch(() => void 0);
|
|
20007
20070
|
throw error48;
|
|
20008
20071
|
}
|
|
20072
|
+
timing?.enter("response_validation_ms");
|
|
20009
20073
|
const document2 = documents.find((candidate) => candidate.id === requestId);
|
|
20010
20074
|
if (!document2 || document2.jsonrpc !== "2.0") {
|
|
20011
20075
|
throw new ExternalInferenceMcpError(
|
|
@@ -37396,6 +37460,7 @@ var init_runner = __esm({
|
|
|
37396
37460
|
const request = receipt.pending_claim_request;
|
|
37397
37461
|
if (request === claimPreparation.unsent && Date.parse(receipt.advertisement_expires_at ?? "") <= now()) break;
|
|
37398
37462
|
let claim;
|
|
37463
|
+
let claimTiming;
|
|
37399
37464
|
const claimCallStartedAtMs = now();
|
|
37400
37465
|
try {
|
|
37401
37466
|
claimOpportunities += 1;
|
|
@@ -37405,6 +37470,9 @@ var init_runner = __esm({
|
|
|
37405
37470
|
request,
|
|
37406
37471
|
{
|
|
37407
37472
|
signal: this.options.signal,
|
|
37473
|
+
onClaimTiming: (timing) => {
|
|
37474
|
+
claimTiming = timing;
|
|
37475
|
+
},
|
|
37408
37476
|
...yieldRenewalToClaim ? { deadlineAtMs: expiresAt } : {}
|
|
37409
37477
|
}
|
|
37410
37478
|
);
|
|
@@ -37506,6 +37574,7 @@ var init_runner = __esm({
|
|
|
37506
37574
|
claimCallRoundTripMs - (claim.schema_version === "external_inference_job_claim_result_v3" ? claim.server_processing_ms : 0)
|
|
37507
37575
|
);
|
|
37508
37576
|
emitDiagnostic("claim_batch_received", {
|
|
37577
|
+
...claimTiming ? { client_timing: claimTiming } : {},
|
|
37509
37578
|
claim_count: claim.claims.length,
|
|
37510
37579
|
round_trip_ms: claimCallRoundTripMs,
|
|
37511
37580
|
server_processing_ms: claim.schema_version === "external_inference_job_claim_result_v3" ? claim.server_processing_ms : null,
|