@vtxmacro/cli 2026.9.6 → 2026.9.8

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.6",
19
+ package_version: "2026.9.8",
20
20
  codex_package_name: "@openai/codex",
21
21
  codex_version: "0.147.0",
22
22
  copilot_sdk_package_name: "@github/copilot-sdk",
package/bin/vtx.js CHANGED
@@ -47,7 +47,7 @@ var init_agent_cli_release = __esm({
47
47
  "agent-cli-release.json"() {
48
48
  agent_cli_release_default = {
49
49
  package_name: "@vtxmacro/cli",
50
- package_version: "2026.9.6",
50
+ package_version: "2026.9.8",
51
51
  codex_package_name: "@openai/codex",
52
52
  codex_version: "0.147.0",
53
53
  copilot_sdk_package_name: "@github/copilot-sdk",
@@ -14442,7 +14442,7 @@ var init_zod = __esm({
14442
14442
  });
14443
14443
 
14444
14444
  // lib/external-inference-contract.ts
14445
- 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_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, agentConnectRequestSchema, agentNextRequestSchema, agentHeartbeatRequestSchema, emptyAgentNextResultSchema, claimedAgentNextResultSchema, agentNextResultSchema, agentCompleteRequestSchema, agentFailRequestSchema, requestedModelSelectionSchema, completedModelProvenanceSchema, attemptModelProvenanceSchema, providerWeeklyQuotaReadSchema, hostHeartbeatRequestSchema, jobClaimRequestSchema, emptyJobClaimSchema, claimedJobSchema, 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;
14445
+ 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, 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;
14446
14446
  var init_external_inference_contract = __esm({
14447
14447
  "lib/external-inference-contract.ts"() {
14448
14448
  "use strict";
@@ -14452,6 +14452,7 @@ var init_external_inference_contract = __esm({
14452
14452
  EXTERNAL_INFERENCE_CONTROLLER_SCHEMA_VERSION_V2 = "external_inference_controller_v2";
14453
14453
  EXTERNAL_INFERENCE_ADVERTISEMENT_SCHEMA_VERSION = "external_inference_advertisement_v1";
14454
14454
  EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION = "external_inference_envelope_v1";
14455
+ EXTERNAL_INFERENCE_COMPRESSED_INPUT_ENVELOPE_SCHEMA_VERSION = "external_inference_input_envelope_v2";
14455
14456
  EXTERNAL_INFERENCE_JOB_INPUT_SCHEMA_VERSION = "external_inference_job_input_v2";
14456
14457
  LEGACY_EXTERNAL_INFERENCE_JOB_INPUT_SCHEMA_VERSION = "external_inference_job_input_v1";
14457
14458
  EXTERNAL_INFERENCE_USAGE_SCHEMA_VERSION = "external_inference_usage_v1";
@@ -14858,7 +14859,10 @@ var init_external_inference_contract = __esm({
14858
14859
  }
14859
14860
  });
14860
14861
  envelopeAadSchema = external_exports.strictObject({
14861
- envelope_version: external_exports.literal(EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION),
14862
+ envelope_version: external_exports.union([
14863
+ external_exports.literal(EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION),
14864
+ external_exports.literal(EXTERNAL_INFERENCE_COMPRESSED_INPUT_ENVELOPE_SCHEMA_VERSION)
14865
+ ]),
14862
14866
  suite: external_exports.literal("X25519-HKDF-SHA256-AES256GCM"),
14863
14867
  direction: external_exports.enum(["wrap", "input", "candidate"]),
14864
14868
  job_id: identifierSchema,
@@ -14871,6 +14875,9 @@ var init_external_inference_contract = __esm({
14871
14875
  plaintext_sha256: sha256HexSchema
14872
14876
  });
14873
14877
  validateEnvelopeAad = (value, context, attemptRequired) => {
14878
+ if (value.aad.envelope_version !== value.schema_version) {
14879
+ context.addIssue({ code: "custom", message: "envelope schema version must match AAD envelope version", path: ["aad", "envelope_version"] });
14880
+ }
14874
14881
  if (value.aad.direction !== value.direction) {
14875
14882
  context.addIssue({ code: "custom", message: "envelope direction must match AAD direction", path: ["aad", "direction"] });
14876
14883
  }
@@ -14900,7 +14907,10 @@ var init_external_inference_contract = __esm({
14900
14907
  }
14901
14908
  };
14902
14909
  commonEnvelopeShape = {
14903
- schema_version: external_exports.literal(EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION),
14910
+ schema_version: external_exports.union([
14911
+ external_exports.literal(EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION),
14912
+ external_exports.literal(EXTERNAL_INFERENCE_COMPRESSED_INPUT_ENVELOPE_SCHEMA_VERSION)
14913
+ ]),
14904
14914
  suite: external_exports.literal("X25519-HKDF-SHA256-AES256GCM"),
14905
14915
  key_generation: generationSchema,
14906
14916
  nonce: base64UrlNonceSchema,
@@ -14911,6 +14921,7 @@ var init_external_inference_contract = __esm({
14911
14921
  };
14912
14922
  sealedKeyWrapEnvelopeSchema = external_exports.strictObject({
14913
14923
  ...commonEnvelopeShape,
14924
+ schema_version: external_exports.literal(EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION),
14914
14925
  direction: external_exports.literal("wrap"),
14915
14926
  ephemeral_public_key: base64Url32BytesSchema
14916
14927
  }).superRefine((value, context) => validateEnvelopeAad(value, context, false));
@@ -14920,6 +14931,7 @@ var init_external_inference_contract = __esm({
14920
14931
  }).superRefine((value, context) => validateEnvelopeAad(value, context, false));
14921
14932
  sealedCandidateEnvelopeSchema = external_exports.strictObject({
14922
14933
  ...commonEnvelopeShape,
14934
+ schema_version: external_exports.literal(EXTERNAL_INFERENCE_ENVELOPE_SCHEMA_VERSION),
14923
14935
  direction: external_exports.literal("candidate")
14924
14936
  }).superRefine((value, context) => validateEnvelopeAad(value, context, true));
14925
14937
  sealedEnvelopeSchema = external_exports.discriminatedUnion("direction", [
@@ -15363,8 +15375,7 @@ var init_external_inference_contract = __esm({
15363
15375
  provider_weekly_quota: providerWeeklyQuotaReadSchema.nullable().optional(),
15364
15376
  observed_at: timestampSchema
15365
15377
  });
15366
- jobClaimRequestSchema = external_exports.strictObject({
15367
- schema_version: external_exports.literal("external_inference_job_claim_v1"),
15378
+ jobClaimRequestBaseShape = {
15368
15379
  contract_version: external_exports.literal(EXTERNAL_INFERENCE_CONTRACT_VERSION),
15369
15380
  host_id: identifierSchema,
15370
15381
  host_generation: generationSchema,
@@ -15372,7 +15383,23 @@ var init_external_inference_contract = __esm({
15372
15383
  key_generation: generationSchema,
15373
15384
  claim_request_id: operationIdentifierSchema,
15374
15385
  requested_at: timestampSchema
15375
- });
15386
+ };
15387
+ jobClaimRequestSchema = external_exports.discriminatedUnion("schema_version", [
15388
+ external_exports.strictObject({
15389
+ schema_version: external_exports.literal("external_inference_job_claim_v1"),
15390
+ ...jobClaimRequestBaseShape
15391
+ }),
15392
+ external_exports.strictObject({
15393
+ schema_version: external_exports.literal("external_inference_job_claim_v2"),
15394
+ ...jobClaimRequestBaseShape,
15395
+ maximum_jobs: external_exports.number().int().min(1).max(32)
15396
+ }),
15397
+ external_exports.strictObject({
15398
+ schema_version: external_exports.literal("external_inference_job_claim_v3"),
15399
+ ...jobClaimRequestBaseShape,
15400
+ maximum_jobs: external_exports.number().int().min(1).max(32)
15401
+ })
15402
+ ]);
15376
15403
  emptyJobClaimSchema = external_exports.strictObject({
15377
15404
  schema_version: external_exports.literal("external_inference_job_claim_result_v1"),
15378
15405
  claim_state: external_exports.literal("empty"),
@@ -15415,9 +15442,32 @@ var init_external_inference_contract = __esm({
15415
15442
  context.addIssue({ code: "custom", message: "claim lease cannot exceed the immutable deadline", path: ["lease_expires_at"] });
15416
15443
  }
15417
15444
  });
15418
- jobClaimResultSchema = external_exports.discriminatedUnion("claim_state", [
15445
+ claimedDispatchIntentSchema = external_exports.strictObject({
15446
+ claim: claimedJobSchema,
15447
+ attempt_id: identifierSchema,
15448
+ started_at: timestampSchema,
15449
+ provider_dispatch_freshness_remaining_ms: nonNegativeSafeIntegerSchema
15450
+ });
15451
+ batchedJobClaimSchema = external_exports.strictObject({
15452
+ schema_version: external_exports.literal("external_inference_job_claim_result_v2"),
15453
+ claim_state: external_exports.literal("batch"),
15454
+ claim_request_id: operationIdentifierSchema,
15455
+ claims: external_exports.array(claimedDispatchIntentSchema).max(32),
15456
+ retry_after_ms: nonNegativeSafeIntegerSchema
15457
+ });
15458
+ timedBatchedJobClaimSchema = external_exports.strictObject({
15459
+ schema_version: external_exports.literal("external_inference_job_claim_result_v3"),
15460
+ claim_state: external_exports.literal("batch"),
15461
+ claim_request_id: operationIdentifierSchema,
15462
+ claims: external_exports.array(claimedDispatchIntentSchema).max(32),
15463
+ retry_after_ms: nonNegativeSafeIntegerSchema,
15464
+ server_processing_ms: nonNegativeSafeIntegerSchema
15465
+ });
15466
+ jobClaimResultSchema = external_exports.union([
15419
15467
  emptyJobClaimSchema,
15420
- claimedJobSchema
15468
+ claimedJobSchema,
15469
+ batchedJobClaimSchema,
15470
+ timedBatchedJobClaimSchema
15421
15471
  ]);
15422
15472
  attemptStartRequestSchema = external_exports.strictObject({
15423
15473
  schema_version: external_exports.literal("external_inference_attempt_start_v1"),
@@ -18689,6 +18739,19 @@ var init_mcp_client = __esm({
18689
18739
  if (name === "inference.job.claim") {
18690
18740
  if (result2.claim_request_id !== request.claim_request_id) invalidBoundResult(name);
18691
18741
  if (result2.claim_state === "claimed" && (result2.host_id !== request.host_id || result2.host_generation !== request.host_generation || result2.advertisement_generation > request.advertisement_generation || result2.key_generation !== request.key_generation)) invalidBoundResult(name);
18742
+ if (result2.claim_state === "batch") {
18743
+ if (request.schema_version !== "external_inference_job_claim_v2" && request.schema_version !== "external_inference_job_claim_v3" || result2.schema_version !== (request.schema_version === "external_inference_job_claim_v3" ? "external_inference_job_claim_result_v3" : "external_inference_job_claim_result_v2") || result2.claims.length > request.maximum_jobs) {
18744
+ invalidBoundResult(name);
18745
+ }
18746
+ const jobIds = /* @__PURE__ */ new Set();
18747
+ const attemptIds = /* @__PURE__ */ new Set();
18748
+ for (const item of result2.claims) {
18749
+ const claim = item.claim;
18750
+ if (claim.host_id !== request.host_id || claim.host_generation !== request.host_generation || claim.advertisement_generation > request.advertisement_generation || claim.key_generation !== request.key_generation || jobIds.has(claim.job_id) || attemptIds.has(item.attempt_id)) invalidBoundResult(name);
18751
+ jobIds.add(claim.job_id);
18752
+ attemptIds.add(item.attempt_id);
18753
+ }
18754
+ }
18692
18755
  return;
18693
18756
  }
18694
18757
  if (name === "inference.job.start") {
@@ -25929,6 +25992,7 @@ import {
25929
25992
  hkdfSync,
25930
25993
  randomBytes as randomBytes5
25931
25994
  } from "node:crypto";
25995
+ import { gunzipSync } from "node:zlib";
25932
25996
  var ENVELOPE_SUITE, JOB_KEY_PAYLOAD_SCHEMA_VERSION, WRAP_HKDF_INFO, PAYLOAD_HKDF_INFO, X25519_PKCS8_PREFIX, X25519_SPKI_PREFIX, ExternalInferenceEnvelopeError, canonicalize, canonicalEnvelopeAadBytes, externalInferenceSha256, decodeCanonicalBase64Url, rawPrivateKey, rawPublicKey, rawPublicBytes, aesGcmDecrypt, aesGcmEncrypt, assertIdentity, validatePlaintext, generateExternalInferenceEnvelopeKeyPair, externalInferenceEnvelopePublicKey, deriveKey, deriveExternalInferencePayloadKey, unwrapExternalInferenceJobKey, decryptExternalInferenceJobInput, decryptExternalInferenceClaim, sealExternalInferenceCandidate;
25933
25997
  var init_crypto = __esm({
25934
25998
  "lib/inference-host/crypto.ts"() {
@@ -26121,12 +26185,27 @@ var init_crypto = __esm({
26121
26185
  );
26122
26186
  }
26123
26187
  const aadBytes = canonicalEnvelopeAadBytes(envelope.aad);
26124
- const plaintext = aesGcmDecrypt(
26188
+ const encodedPlaintext = aesGcmDecrypt(
26125
26189
  deriveExternalInferencePayloadKey(jobKey, envelope.aad),
26126
26190
  decodeCanonicalBase64Url(envelope.nonce, "External inference envelope nonce", 12),
26127
26191
  decodeCanonicalBase64Url(envelope.ciphertext, "External inference envelope ciphertext"),
26128
26192
  aadBytes
26129
26193
  );
26194
+ let plaintext;
26195
+ if (envelope.schema_version === EXTERNAL_INFERENCE_COMPRESSED_INPUT_ENVELOPE_SCHEMA_VERSION) {
26196
+ try {
26197
+ plaintext = gunzipSync(encodedPlaintext, {
26198
+ maxOutputLength: envelope.plaintext_bytes
26199
+ });
26200
+ } catch {
26201
+ throw new ExternalInferenceEnvelopeError(
26202
+ "invalid_job_input",
26203
+ "External inference compressed immutable input is invalid."
26204
+ );
26205
+ }
26206
+ } else {
26207
+ plaintext = encodedPlaintext;
26208
+ }
26130
26209
  validatePlaintext(plaintext, envelope.plaintext_bytes, envelope.plaintext_sha256);
26131
26210
  let rawJob;
26132
26211
  try {
@@ -32508,7 +32587,7 @@ function createDefaultInferenceHostRunnerDependencies(options) {
32508
32587
  envelopePublicKey: options.envelopePublicKey
32509
32588
  };
32510
32589
  }
32511
- var import_ajv, RUNTIME_RECEIPT_SCHEMA_VERSION, ATTEMPT_RECEIPT_SCHEMA_VERSION, DEFAULT_ADVERTISEMENT_TTL_MS, DEFAULT_ADVERTISEMENT_REFRESH_LEAD_MS, DEFAULT_HOST_HEARTBEAT_MS, DEFAULT_PROVIDER_RATE_LIMIT_REFRESH_MS, DEFAULT_ATTEMPT_HEARTBEAT_MS, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_REMOTE_RETRY_LIMIT, MIN_SLEEP_MS, MIN_HOST_HEARTBEAT_GAP_DIAGNOSTIC_MS, HOST_HEARTBEAT_GAP_DIAGNOSTIC_FACTOR, DEFAULT_CODEX_ACCOUNT_COOLDOWN_MS, DEFAULT_AGENT_RATE_LIMIT_COOLDOWN_MS, DEFAULT_AGENT_QUOTA_COOLDOWN_MS, DEFAULT_AGENT_TRANSIENT_COOLDOWN_MS, MIN_CLAIM_START_WINDOW_MS, MAX_ATTEMPT_START_RETRY_DELAY_MS, UNBOUNDED_AVAILABLE_SLOTS, buildInferenceAdvertisedModels, summarizeInferenceHostRuntimeRecovery, FileInferenceHostRuntimeReceiptStore, InferenceHostRecoveryRequiredError, InferenceHostRunnerError, defaultSleep, abortError, settlesWithin, defaultRegisterSignalHandlers, safeInteger, exactObjectKeys, validIso, validateAttemptReceipt, validateRuntimeReceipt, sha256, stableOperationId, buildAttemptStartRequest, isoAt, providerWeeklyQuotaFromRateLimits, finitePositiveOption, validateRunnerOptions, assertLocalCredentialIdentity, retryableRemoteError, remoteRetryAfterMs, controlPlaneFatal, defaultValidateOutput, objectRecord, positiveUtf8ByteLimit, assertCompilableOutputSchema, parseOutputContract, serverProviderDispatchNotAfterMs, membershipFailureDisposition, safeFailureCode, publicServerFailureCode, attemptStartRetryFallbackMs, exactJson2, runnerIdentityMismatch, assertAdvertisementResult, assertHostHeartbeatResult, assertClaimResult, assertStartResult, assertJobHeartbeatResult, assertTerminalResult, isDefinitiveCompletionEvidenceExpiry, classifyFailure, ambiguousHeartbeatTransport, reportedTokenUsage, reportedUsage, InferenceHostRunner, createInferenceAgentControlClient, INFERENCE_AGENT_SYSTEM_PROMPT, INFERENCE_AGENT_WAKE_SCHEMA, parseInferenceAgentWake, InferenceAgentRuntime;
32590
+ var import_ajv, RUNTIME_RECEIPT_SCHEMA_VERSION, ATTEMPT_RECEIPT_SCHEMA_VERSION, CLAIM_DISPATCH_BATCH_SIZE, DEFAULT_ADVERTISEMENT_TTL_MS, DEFAULT_ADVERTISEMENT_REFRESH_LEAD_MS, DEFAULT_HOST_HEARTBEAT_MS, DEFAULT_PROVIDER_RATE_LIMIT_REFRESH_MS, DEFAULT_ATTEMPT_HEARTBEAT_MS, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_REMOTE_RETRY_LIMIT, MIN_SLEEP_MS, MIN_HOST_HEARTBEAT_GAP_DIAGNOSTIC_MS, HOST_HEARTBEAT_GAP_DIAGNOSTIC_FACTOR, DEFAULT_CODEX_ACCOUNT_COOLDOWN_MS, DEFAULT_AGENT_RATE_LIMIT_COOLDOWN_MS, DEFAULT_AGENT_QUOTA_COOLDOWN_MS, DEFAULT_AGENT_TRANSIENT_COOLDOWN_MS, MIN_CLAIM_START_WINDOW_MS, MAX_ATTEMPT_START_RETRY_DELAY_MS, UNBOUNDED_AVAILABLE_SLOTS, buildInferenceAdvertisedModels, summarizeInferenceHostRuntimeRecovery, FileInferenceHostRuntimeReceiptStore, InferenceHostRecoveryRequiredError, InferenceHostRunnerError, defaultSleep, abortError, settlesWithin, defaultRegisterSignalHandlers, safeInteger, exactObjectKeys, validIso, validateAttemptReceipt, validateRuntimeReceipt, sha256, stableOperationId, buildAttemptStartRequest, isoAt, providerWeeklyQuotaFromRateLimits, finitePositiveOption, validateRunnerOptions, assertLocalCredentialIdentity, retryableRemoteError, remoteRetryAfterMs, controlPlaneFatal, defaultValidateOutput, objectRecord, positiveUtf8ByteLimit, assertCompilableOutputSchema, parseOutputContract, serverProviderDispatchNotAfterMs, membershipFailureDisposition, safeFailureCode, publicServerFailureCode, attemptStartRetryFallbackMs, exactJson2, runnerIdentityMismatch, assertAdvertisementResult, assertHostHeartbeatResult, assertClaimResult, assertStartResult, assertJobHeartbeatResult, assertTerminalResult, isDefinitiveCompletionEvidenceExpiry, classifyFailure, ambiguousHeartbeatTransport, reportedTokenUsage, reportedUsage, InferenceHostRunner, createInferenceAgentControlClient, INFERENCE_AGENT_SYSTEM_PROMPT, INFERENCE_AGENT_WAKE_SCHEMA, parseInferenceAgentWake, InferenceAgentRuntime;
32512
32591
  var init_runner = __esm({
32513
32592
  "lib/inference-host/runner.ts"() {
32514
32593
  "use strict";
@@ -32523,6 +32602,7 @@ var init_runner = __esm({
32523
32602
  init_oauth();
32524
32603
  RUNTIME_RECEIPT_SCHEMA_VERSION = "vtx_inference_host_runtime_v1";
32525
32604
  ATTEMPT_RECEIPT_SCHEMA_VERSION = "vtx_inference_attempt_receipt_v1";
32605
+ CLAIM_DISPATCH_BATCH_SIZE = 16;
32526
32606
  DEFAULT_ADVERTISEMENT_TTL_MS = 12e4;
32527
32607
  DEFAULT_ADVERTISEMENT_REFRESH_LEAD_MS = 3e4;
32528
32608
  DEFAULT_HOST_HEARTBEAT_MS = 3e3;
@@ -33808,28 +33888,47 @@ var init_runner = __esm({
33808
33888
  let nextClaimAt = Math.max(now(), providerRetryAtMs ?? 0);
33809
33889
  let pendingClaimPromotions = 0;
33810
33890
  let onceClaimed = false;
33891
+ let batchClaimVersion = 3;
33811
33892
  const preparePendingClaim = (current) => {
33812
33893
  if (current.pending_claim_request) return current;
33813
33894
  const claimSequence = current.claim_sequence + 1;
33814
33895
  const requestedAt = now();
33896
+ const claimRequestBase = {
33897
+ contract_version: EXTERNAL_INFERENCE_CONTRACT_VERSION,
33898
+ host_id: localState.host_id,
33899
+ host_generation: localState.host_generation,
33900
+ advertisement_generation: current.advertisement_generation,
33901
+ key_generation: localState.key_generation,
33902
+ claim_request_id: stableOperationId("claim", [
33903
+ localState.host_id,
33904
+ localState.host_generation,
33905
+ current.advertisement_generation,
33906
+ claimSequence
33907
+ ]),
33908
+ requested_at: isoAt(requestedAt)
33909
+ };
33910
+ const pendingClaimRequest = batchClaimVersion === 3 ? {
33911
+ schema_version: "external_inference_job_claim_v3",
33912
+ ...claimRequestBase,
33913
+ maximum_jobs: Math.min(
33914
+ this.options.once ? 1 : CLAIM_DISPATCH_BATCH_SIZE,
33915
+ settings.maxConcurrency === null ? CLAIM_DISPATCH_BATCH_SIZE : Math.max(1, settings.maxConcurrency - active.size)
33916
+ )
33917
+ } : batchClaimVersion === 2 ? {
33918
+ schema_version: "external_inference_job_claim_v2",
33919
+ ...claimRequestBase,
33920
+ maximum_jobs: Math.min(
33921
+ this.options.once ? 1 : CLAIM_DISPATCH_BATCH_SIZE,
33922
+ settings.maxConcurrency === null ? CLAIM_DISPATCH_BATCH_SIZE : Math.max(1, settings.maxConcurrency - active.size)
33923
+ )
33924
+ } : {
33925
+ schema_version: "external_inference_job_claim_v1",
33926
+ ...claimRequestBase
33927
+ };
33815
33928
  return {
33816
33929
  ...current,
33817
33930
  claim_sequence: claimSequence,
33818
- pending_claim_request: {
33819
- schema_version: "external_inference_job_claim_v1",
33820
- contract_version: EXTERNAL_INFERENCE_CONTRACT_VERSION,
33821
- host_id: localState.host_id,
33822
- host_generation: localState.host_generation,
33823
- advertisement_generation: current.advertisement_generation,
33824
- key_generation: localState.key_generation,
33825
- claim_request_id: stableOperationId("claim", [
33826
- localState.host_id,
33827
- localState.host_generation,
33828
- current.advertisement_generation,
33829
- claimSequence
33830
- ]),
33831
- requested_at: isoAt(requestedAt)
33832
- },
33931
+ pending_claim_request: pendingClaimRequest,
33833
33932
  updated_at: isoAt(requestedAt)
33834
33933
  };
33835
33934
  };
@@ -33948,8 +34047,8 @@ var init_runner = __esm({
33948
34047
  });
33949
34048
  const recoveryQueue = [];
33950
34049
  const attemptStartRetryCounts = /* @__PURE__ */ new Map();
33951
- const launchClaim = (claim, recovery, claimRequest) => {
33952
- if (!recovery) {
34050
+ const launchClaim = (claim, recovery, claimRequest, prestarted) => {
34051
+ if (!recovery || prestarted) {
33953
34052
  claimed += 1;
33954
34053
  onceClaimed = true;
33955
34054
  }
@@ -34048,6 +34147,7 @@ var init_runner = __esm({
34048
34147
  },
34049
34148
  resumeReceipt: recovery,
34050
34149
  claimRequest,
34150
+ prestarted,
34051
34151
  onClaimPersisted: settleClaimPromotion,
34052
34152
  rolloverClaimRequest: (current) => {
34053
34153
  if (drainRequested || this.options.once || settings.maxConcurrency !== null && active.size + 1 >= settings.maxConcurrency) return current;
@@ -34251,6 +34351,7 @@ var init_runner = __esm({
34251
34351
  }
34252
34352
  const request = receipt.pending_claim_request;
34253
34353
  let claim;
34354
+ const claimCallStartedAtMs = now();
34254
34355
  try {
34255
34356
  claim = await mcp.callTool(
34256
34357
  "inference.job.claim",
@@ -34259,7 +34360,48 @@ var init_runner = __esm({
34259
34360
  );
34260
34361
  assertClaimResult(request, claim);
34261
34362
  } catch (error48) {
34262
- if (!this.options.signal?.aborted && controlPlaneFatal(error48)) {
34363
+ if (!this.options.signal?.aborted && request.schema_version === "external_inference_job_claim_v3" && error48 instanceof ExternalInferenceMcpError && error48.serverFailureCode === "schema_validation") {
34364
+ batchClaimVersion = 2;
34365
+ await mutateReceipt((current) => ({
34366
+ ...current,
34367
+ pending_claim_request: current.pending_claim_request?.claim_request_id === request.claim_request_id ? {
34368
+ schema_version: "external_inference_job_claim_v2",
34369
+ contract_version: request.contract_version,
34370
+ host_id: request.host_id,
34371
+ host_generation: request.host_generation,
34372
+ advertisement_generation: request.advertisement_generation,
34373
+ key_generation: request.key_generation,
34374
+ claim_request_id: stableOperationId("claim-fallback-v2", [
34375
+ request.claim_request_id
34376
+ ]),
34377
+ requested_at: isoAt(now()),
34378
+ maximum_jobs: request.maximum_jobs
34379
+ } : current.pending_claim_request,
34380
+ updated_at: isoAt(now())
34381
+ }));
34382
+ nextClaimAt = now();
34383
+ continue;
34384
+ } else if (!this.options.signal?.aborted && request.schema_version === "external_inference_job_claim_v2" && error48 instanceof ExternalInferenceMcpError && error48.serverFailureCode === "schema_validation") {
34385
+ batchClaimVersion = 1;
34386
+ await mutateReceipt((current) => ({
34387
+ ...current,
34388
+ pending_claim_request: current.pending_claim_request?.claim_request_id === request.claim_request_id ? {
34389
+ schema_version: "external_inference_job_claim_v1",
34390
+ contract_version: request.contract_version,
34391
+ host_id: request.host_id,
34392
+ host_generation: request.host_generation,
34393
+ advertisement_generation: request.advertisement_generation,
34394
+ key_generation: request.key_generation,
34395
+ claim_request_id: stableOperationId("claim-fallback-v1", [
34396
+ request.claim_request_id
34397
+ ]),
34398
+ requested_at: isoAt(now())
34399
+ } : current.pending_claim_request,
34400
+ updated_at: isoAt(now())
34401
+ }));
34402
+ nextClaimAt = now();
34403
+ continue;
34404
+ } else if (!this.options.signal?.aborted && controlPlaneFatal(error48)) {
34263
34405
  requestDrain("authority_lost");
34264
34406
  } else if (!this.options.signal?.aborted && error48 instanceof ExternalInferenceMcpError && error48.code === "claim_replay_obsolete") {
34265
34407
  await mutateReceipt((current) => ({
@@ -34291,6 +34433,109 @@ var init_runner = __esm({
34291
34433
  }
34292
34434
  break;
34293
34435
  }
34436
+ const claimResponseReceivedAtMs = now();
34437
+ const claimCallRoundTripMs = Math.max(
34438
+ 0,
34439
+ claimResponseReceivedAtMs - claimCallStartedAtMs
34440
+ );
34441
+ if (claim.claim_state === "batch") {
34442
+ if (request.schema_version === "external_inference_job_claim_v1") {
34443
+ runnerIdentityMismatch("Batched job claim");
34444
+ }
34445
+ const maximumJobs = "maximum_jobs" in request ? request.maximum_jobs : runnerIdentityMismatch("Batched job claim");
34446
+ const expectedBatchResultVersion = request.schema_version === "external_inference_job_claim_v3" ? "external_inference_job_claim_result_v3" : "external_inference_job_claim_result_v2";
34447
+ if (claim.schema_version !== expectedBatchResultVersion || claim.claims.length > maximumJobs) runnerIdentityMismatch("Batched job claim");
34448
+ const claimTransportResidualMs = Math.max(
34449
+ 0,
34450
+ claimCallRoundTripMs - (claim.schema_version === "external_inference_job_claim_result_v3" ? claim.server_processing_ms : 0)
34451
+ );
34452
+ if (claim.claims.length === 0) {
34453
+ await mutateReceipt((current) => ({
34454
+ ...current,
34455
+ pending_claim_request: current.pending_claim_request?.claim_request_id === request.claim_request_id ? null : current.pending_claim_request,
34456
+ updated_at: isoAt(now())
34457
+ }));
34458
+ nextClaimAt = now() + Math.max(MIN_SLEEP_MS, claim.retry_after_ms);
34459
+ if (this.options.once) requestDrain("once_empty");
34460
+ break;
34461
+ }
34462
+ const decryptClaim = this.dependencies.decryptClaim ?? decryptExternalInferenceClaim;
34463
+ const prepared = claim.claims.map((item) => {
34464
+ const claimedJob = item.claim;
34465
+ if (claimedJob.host_id !== localState.host_id || claimedJob.host_generation !== localState.host_generation || claimedJob.advertisement_generation > receipt.advertisement_generation || claimedJob.key_generation !== localState.key_generation) runnerIdentityMismatch("Batched job claim");
34466
+ const { jobInput } = decryptClaim(
34467
+ credential.x25519_private_key,
34468
+ claimedJob
34469
+ );
34470
+ const expectedAttemptId = stableOperationId("attempt", [
34471
+ claimedJob.host_id,
34472
+ claimedJob.job_id,
34473
+ claimedJob.claim_generation,
34474
+ claimedJob.attempt_index,
34475
+ claimedJob.input_sha256
34476
+ ]);
34477
+ if (item.attempt_id !== expectedAttemptId) {
34478
+ runnerIdentityMismatch("Batched attempt");
34479
+ }
34480
+ const startRequest = buildAttemptStartRequest(
34481
+ claimedJob,
34482
+ item.attempt_id,
34483
+ item.started_at
34484
+ );
34485
+ return validateAttemptReceipt({
34486
+ schema_version: ATTEMPT_RECEIPT_SCHEMA_VERSION,
34487
+ attempt_id: item.attempt_id,
34488
+ job_id: claimedJob.job_id,
34489
+ profile_id: jobInput.profile_id,
34490
+ input_sha256: jobInput.input_sha256,
34491
+ claim_generation: claimedJob.claim_generation,
34492
+ attempt_index: claimedJob.attempt_index,
34493
+ phase: "claimed",
34494
+ dispatch_outcome: "not_dispatched",
34495
+ terminal_operation_id: null,
34496
+ job_heartbeat_sequence: 0,
34497
+ claim: claimedJob,
34498
+ start_request: startRequest,
34499
+ terminal_request: null,
34500
+ updated_at: isoAt(now())
34501
+ });
34502
+ });
34503
+ const shouldRollover = !this.options.once && (settings.maxConcurrency === null || active.size + prepared.length < settings.maxConcurrency);
34504
+ await mutateReceipt((current) => {
34505
+ if (current.pending_claim_request?.claim_request_id !== request.claim_request_id) runnerIdentityMismatch("Batched claim receipt");
34506
+ const attempts = { ...current.attempts };
34507
+ for (const attempt of prepared) {
34508
+ if (attempts[attempt.attempt_id]) {
34509
+ runnerIdentityMismatch("Batched attempt receipt");
34510
+ }
34511
+ attempts[attempt.attempt_id] = attempt;
34512
+ }
34513
+ const promoted = {
34514
+ ...current,
34515
+ pending_claim_request: null,
34516
+ attempts,
34517
+ updated_at: isoAt(now())
34518
+ };
34519
+ return shouldRollover ? preparePendingClaim(promoted) : promoted;
34520
+ });
34521
+ for (let index = 0; index < prepared.length; index += 1) {
34522
+ const item = claim.claims[index];
34523
+ launchClaim(item.claim, prepared[index], void 0, {
34524
+ result: {
34525
+ job_id: item.claim.job_id,
34526
+ attempt_id: item.attempt_id,
34527
+ attempt_index: item.claim.attempt_index,
34528
+ state: "dispatch_intent",
34529
+ provider_dispatch_freshness_remaining_ms: item.provider_dispatch_freshness_remaining_ms
34530
+ },
34531
+ roundTripMs: claimTransportResidualMs,
34532
+ claimResponseReceivedAtMs
34533
+ });
34534
+ }
34535
+ if (this.options.once) requestDrain("once_complete");
34536
+ nextClaimAt = claim.claims.length >= (request.schema_version !== "external_inference_job_claim_v1" ? request.maximum_jobs : CLAIM_DISPATCH_BATCH_SIZE) ? now() : now() + Math.max(MIN_SLEEP_MS, claim.retry_after_ms);
34537
+ continue;
34538
+ }
34294
34539
  if (claim.claim_state === "empty") {
34295
34540
  await mutateReceipt((current) => ({
34296
34541
  ...current,
@@ -34536,69 +34781,75 @@ var init_runner = __esm({
34536
34781
  let startResult;
34537
34782
  const startCallStartedAtMs = now();
34538
34783
  let startCallCompletedAtMs = startCallStartedAtMs;
34539
- const claimPromotionPromise = options.resumeReceipt ? Promise.resolve() : persistAttempt({ phase: "claimed" }, true);
34540
- const startCallPromise = retryExact(() => mcp.callTool(
34541
- "inference.job.start",
34542
- startRequest,
34543
- { signal, deadlineAtMs: attemptDeadlineAtMs }
34544
- ), { signal, deadlineAtMs: attemptDeadlineAtMs }).then((result2) => {
34784
+ if (options.prestarted) {
34785
+ startResult = options.prestarted.result;
34545
34786
  startCallCompletedAtMs = now();
34546
- return result2;
34547
- });
34548
- const [startOutcome, claimPromotionOutcome] = await Promise.allSettled([
34549
- startCallPromise,
34550
- claimPromotionPromise
34551
- ]);
34552
- if (claimPromotionOutcome.status === "rejected") {
34553
- throw claimPromotionOutcome.reason;
34554
- }
34555
- if (startOutcome.status === "rejected") {
34556
- const error48 = startOutcome.reason;
34557
- if (error48 instanceof ExternalInferenceMcpError && error48.serverFailureCode === "server_account_context_expired_before_provider_dispatch") {
34558
- await removeAttempt();
34559
- options.onAttemptOutcome?.({
34560
- outcome: "freshness_rejected_before_provider_dispatch",
34561
- failure_category: "freshness",
34562
- failure_code: error48.serverFailureCode,
34563
- dispatch_outcome: "not_dispatched"
34787
+ startRoundTripMs = Math.max(0, options.prestarted.roundTripMs);
34788
+ } else {
34789
+ const claimPromotionPromise = options.resumeReceipt ? Promise.resolve() : persistAttempt({ phase: "claimed" }, true);
34790
+ const startCallPromise = retryExact(() => mcp.callTool(
34791
+ "inference.job.start",
34792
+ startRequest,
34793
+ { signal, deadlineAtMs: attemptDeadlineAtMs }
34794
+ ), { signal, deadlineAtMs: attemptDeadlineAtMs }).then((result2) => {
34795
+ startCallCompletedAtMs = now();
34796
+ return result2;
34797
+ });
34798
+ const [startOutcome, claimPromotionOutcome] = await Promise.allSettled([
34799
+ startCallPromise,
34800
+ claimPromotionPromise
34801
+ ]);
34802
+ if (claimPromotionOutcome.status === "rejected") {
34803
+ throw claimPromotionOutcome.reason;
34804
+ }
34805
+ if (startOutcome.status === "rejected") {
34806
+ const error48 = startOutcome.reason;
34807
+ if (error48 instanceof ExternalInferenceMcpError && error48.serverFailureCode === "server_account_context_expired_before_provider_dispatch") {
34808
+ await removeAttempt();
34809
+ options.onAttemptOutcome?.({
34810
+ outcome: "freshness_rejected_before_provider_dispatch",
34811
+ failure_category: "freshness",
34812
+ failure_code: error48.serverFailureCode,
34813
+ dispatch_outcome: "not_dispatched"
34814
+ });
34815
+ return "failed";
34816
+ }
34817
+ if (attemptDeadlineAtMs <= now() + MIN_CLAIM_START_WINDOW_MS) {
34818
+ await removeAttempt();
34819
+ return "failed";
34820
+ }
34821
+ if (signal.aborted) throw error48;
34822
+ if (controlPlaneFatal(error48)) throw error48;
34823
+ const remainingMs = Math.max(
34824
+ MIN_SLEEP_MS,
34825
+ attemptDeadlineAtMs - now() - MIN_CLAIM_START_WINDOW_MS
34826
+ );
34827
+ const retryCount = Math.min(
34828
+ Math.max(1, options.startRetryCount),
34829
+ Number.MAX_SAFE_INTEGER
34830
+ );
34831
+ const retryDelayMs = Math.min(
34832
+ remoteRetryAfterMs(error48, attemptStartRetryFallbackMs(retryCount)),
34833
+ remainingMs
34834
+ );
34835
+ const rawErrorCode = error48 && typeof error48 === "object" && "code" in error48 ? String(error48.code) : "start_acknowledgement_failed";
34836
+ options.onAttemptStartRetry?.({
34837
+ failure_stage: "job_start_acknowledgement",
34838
+ error_code: safeFailureCode(rawErrorCode, "start_acknowledgement_failed"),
34839
+ http_status_code: error48 instanceof ExternalInferenceMcpError ? error48.httpStatusCode : null,
34840
+ retryable: retryableRemoteError(error48),
34841
+ definitively_not_applied: Boolean(
34842
+ error48 && typeof error48 === "object" && "definitivelyNotApplied" in error48 && error48.definitivelyNotApplied === true
34843
+ ),
34844
+ retry_after_ms: error48 instanceof ExternalInferenceMcpError ? error48.retryAfterMs : null,
34845
+ retry_count: retryCount,
34846
+ next_delay_ms: retryDelayMs
34564
34847
  });
34565
- return "failed";
34848
+ await options.sleep(retryDelayMs, signal);
34849
+ return "retry_claimed";
34566
34850
  }
34567
- if (attemptDeadlineAtMs <= now() + MIN_CLAIM_START_WINDOW_MS) {
34568
- await removeAttempt();
34569
- return "failed";
34570
- }
34571
- if (signal.aborted) throw error48;
34572
- if (controlPlaneFatal(error48)) throw error48;
34573
- const remainingMs = Math.max(
34574
- MIN_SLEEP_MS,
34575
- attemptDeadlineAtMs - now() - MIN_CLAIM_START_WINDOW_MS
34576
- );
34577
- const retryCount = Math.min(
34578
- Math.max(1, options.startRetryCount),
34579
- Number.MAX_SAFE_INTEGER
34580
- );
34581
- const retryDelayMs = Math.min(
34582
- remoteRetryAfterMs(error48, attemptStartRetryFallbackMs(retryCount)),
34583
- remainingMs
34584
- );
34585
- const rawErrorCode = error48 && typeof error48 === "object" && "code" in error48 ? String(error48.code) : "start_acknowledgement_failed";
34586
- options.onAttemptStartRetry?.({
34587
- failure_stage: "job_start_acknowledgement",
34588
- error_code: safeFailureCode(rawErrorCode, "start_acknowledgement_failed"),
34589
- http_status_code: error48 instanceof ExternalInferenceMcpError ? error48.httpStatusCode : null,
34590
- retryable: retryableRemoteError(error48),
34591
- definitively_not_applied: Boolean(
34592
- error48 && typeof error48 === "object" && "definitivelyNotApplied" in error48 && error48.definitivelyNotApplied === true
34593
- ),
34594
- retry_after_ms: error48 instanceof ExternalInferenceMcpError ? error48.retryAfterMs : null,
34595
- retry_count: retryCount,
34596
- next_delay_ms: retryDelayMs
34597
- });
34598
- await options.sleep(retryDelayMs, signal);
34599
- return "retry_claimed";
34851
+ startResult = startOutcome.value;
34600
34852
  }
34601
- startResult = startOutcome.value;
34602
34853
  assertStartResult(startRequest, startResult);
34603
34854
  if (serverProviderDispatchDeadlineMs !== void 0) {
34604
34855
  const serverRemaining = startResult.provider_dispatch_freshness_remaining_ms;
@@ -34608,13 +34859,16 @@ var init_runner = __esm({
34608
34859
  "The Server provider-dispatch freshness receipt is unavailable."
34609
34860
  );
34610
34861
  }
34611
- startRoundTripMs = Math.max(0, startCallCompletedAtMs - startCallStartedAtMs);
34862
+ if (!options.prestarted) {
34863
+ startRoundTripMs = Math.max(0, startCallCompletedAtMs - startCallStartedAtMs);
34864
+ }
34612
34865
  serverReportedFreshnessRemainingMs = Number(serverRemaining);
34613
34866
  const conservativeRemainingMs = Math.max(
34614
34867
  0,
34615
34868
  serverReportedFreshnessRemainingMs - startRoundTripMs
34616
34869
  );
34617
- providerDispatchNotAfterMs = startCallCompletedAtMs + conservativeRemainingMs;
34870
+ const freshnessAnchorAtMs = options.prestarted ? options.prestarted.claimResponseReceivedAtMs : startCallCompletedAtMs;
34871
+ providerDispatchNotAfterMs = freshnessAnchorAtMs + conservativeRemainingMs;
34618
34872
  }
34619
34873
  }
34620
34874
  if (attemptReceipt.phase !== "dispatched") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.9.6",
3
+ "version": "2026.9.8",
4
4
  "description": "VTX Macro CLI, MCP server, and durable external inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",