@vtxmacro/cli 2026.9.6 → 2026.9.7

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.7",
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.7",
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_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";
@@ -15363,8 +15363,7 @@ var init_external_inference_contract = __esm({
15363
15363
  provider_weekly_quota: providerWeeklyQuotaReadSchema.nullable().optional(),
15364
15364
  observed_at: timestampSchema
15365
15365
  });
15366
- jobClaimRequestSchema = external_exports.strictObject({
15367
- schema_version: external_exports.literal("external_inference_job_claim_v1"),
15366
+ jobClaimRequestBaseShape = {
15368
15367
  contract_version: external_exports.literal(EXTERNAL_INFERENCE_CONTRACT_VERSION),
15369
15368
  host_id: identifierSchema,
15370
15369
  host_generation: generationSchema,
@@ -15372,7 +15371,23 @@ var init_external_inference_contract = __esm({
15372
15371
  key_generation: generationSchema,
15373
15372
  claim_request_id: operationIdentifierSchema,
15374
15373
  requested_at: timestampSchema
15375
- });
15374
+ };
15375
+ jobClaimRequestSchema = external_exports.discriminatedUnion("schema_version", [
15376
+ external_exports.strictObject({
15377
+ schema_version: external_exports.literal("external_inference_job_claim_v1"),
15378
+ ...jobClaimRequestBaseShape
15379
+ }),
15380
+ external_exports.strictObject({
15381
+ schema_version: external_exports.literal("external_inference_job_claim_v2"),
15382
+ ...jobClaimRequestBaseShape,
15383
+ maximum_jobs: external_exports.number().int().min(1).max(32)
15384
+ }),
15385
+ external_exports.strictObject({
15386
+ schema_version: external_exports.literal("external_inference_job_claim_v3"),
15387
+ ...jobClaimRequestBaseShape,
15388
+ maximum_jobs: external_exports.number().int().min(1).max(32)
15389
+ })
15390
+ ]);
15376
15391
  emptyJobClaimSchema = external_exports.strictObject({
15377
15392
  schema_version: external_exports.literal("external_inference_job_claim_result_v1"),
15378
15393
  claim_state: external_exports.literal("empty"),
@@ -15415,9 +15430,32 @@ var init_external_inference_contract = __esm({
15415
15430
  context.addIssue({ code: "custom", message: "claim lease cannot exceed the immutable deadline", path: ["lease_expires_at"] });
15416
15431
  }
15417
15432
  });
15418
- jobClaimResultSchema = external_exports.discriminatedUnion("claim_state", [
15433
+ claimedDispatchIntentSchema = external_exports.strictObject({
15434
+ claim: claimedJobSchema,
15435
+ attempt_id: identifierSchema,
15436
+ started_at: timestampSchema,
15437
+ provider_dispatch_freshness_remaining_ms: nonNegativeSafeIntegerSchema
15438
+ });
15439
+ batchedJobClaimSchema = external_exports.strictObject({
15440
+ schema_version: external_exports.literal("external_inference_job_claim_result_v2"),
15441
+ claim_state: external_exports.literal("batch"),
15442
+ claim_request_id: operationIdentifierSchema,
15443
+ claims: external_exports.array(claimedDispatchIntentSchema).max(32),
15444
+ retry_after_ms: nonNegativeSafeIntegerSchema
15445
+ });
15446
+ timedBatchedJobClaimSchema = external_exports.strictObject({
15447
+ schema_version: external_exports.literal("external_inference_job_claim_result_v3"),
15448
+ claim_state: external_exports.literal("batch"),
15449
+ claim_request_id: operationIdentifierSchema,
15450
+ claims: external_exports.array(claimedDispatchIntentSchema).max(32),
15451
+ retry_after_ms: nonNegativeSafeIntegerSchema,
15452
+ server_processing_ms: nonNegativeSafeIntegerSchema
15453
+ });
15454
+ jobClaimResultSchema = external_exports.union([
15419
15455
  emptyJobClaimSchema,
15420
- claimedJobSchema
15456
+ claimedJobSchema,
15457
+ batchedJobClaimSchema,
15458
+ timedBatchedJobClaimSchema
15421
15459
  ]);
15422
15460
  attemptStartRequestSchema = external_exports.strictObject({
15423
15461
  schema_version: external_exports.literal("external_inference_attempt_start_v1"),
@@ -18689,6 +18727,19 @@ var init_mcp_client = __esm({
18689
18727
  if (name === "inference.job.claim") {
18690
18728
  if (result2.claim_request_id !== request.claim_request_id) invalidBoundResult(name);
18691
18729
  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);
18730
+ if (result2.claim_state === "batch") {
18731
+ 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) {
18732
+ invalidBoundResult(name);
18733
+ }
18734
+ const jobIds = /* @__PURE__ */ new Set();
18735
+ const attemptIds = /* @__PURE__ */ new Set();
18736
+ for (const item of result2.claims) {
18737
+ const claim = item.claim;
18738
+ 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);
18739
+ jobIds.add(claim.job_id);
18740
+ attemptIds.add(item.attempt_id);
18741
+ }
18742
+ }
18692
18743
  return;
18693
18744
  }
18694
18745
  if (name === "inference.job.start") {
@@ -32508,7 +32559,7 @@ function createDefaultInferenceHostRunnerDependencies(options) {
32508
32559
  envelopePublicKey: options.envelopePublicKey
32509
32560
  };
32510
32561
  }
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;
32562
+ 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
32563
  var init_runner = __esm({
32513
32564
  "lib/inference-host/runner.ts"() {
32514
32565
  "use strict";
@@ -32523,6 +32574,7 @@ var init_runner = __esm({
32523
32574
  init_oauth();
32524
32575
  RUNTIME_RECEIPT_SCHEMA_VERSION = "vtx_inference_host_runtime_v1";
32525
32576
  ATTEMPT_RECEIPT_SCHEMA_VERSION = "vtx_inference_attempt_receipt_v1";
32577
+ CLAIM_DISPATCH_BATCH_SIZE = 16;
32526
32578
  DEFAULT_ADVERTISEMENT_TTL_MS = 12e4;
32527
32579
  DEFAULT_ADVERTISEMENT_REFRESH_LEAD_MS = 3e4;
32528
32580
  DEFAULT_HOST_HEARTBEAT_MS = 3e3;
@@ -33808,28 +33860,47 @@ var init_runner = __esm({
33808
33860
  let nextClaimAt = Math.max(now(), providerRetryAtMs ?? 0);
33809
33861
  let pendingClaimPromotions = 0;
33810
33862
  let onceClaimed = false;
33863
+ let batchClaimVersion = 3;
33811
33864
  const preparePendingClaim = (current) => {
33812
33865
  if (current.pending_claim_request) return current;
33813
33866
  const claimSequence = current.claim_sequence + 1;
33814
33867
  const requestedAt = now();
33868
+ const claimRequestBase = {
33869
+ contract_version: EXTERNAL_INFERENCE_CONTRACT_VERSION,
33870
+ host_id: localState.host_id,
33871
+ host_generation: localState.host_generation,
33872
+ advertisement_generation: current.advertisement_generation,
33873
+ key_generation: localState.key_generation,
33874
+ claim_request_id: stableOperationId("claim", [
33875
+ localState.host_id,
33876
+ localState.host_generation,
33877
+ current.advertisement_generation,
33878
+ claimSequence
33879
+ ]),
33880
+ requested_at: isoAt(requestedAt)
33881
+ };
33882
+ const pendingClaimRequest = batchClaimVersion === 3 ? {
33883
+ schema_version: "external_inference_job_claim_v3",
33884
+ ...claimRequestBase,
33885
+ maximum_jobs: Math.min(
33886
+ this.options.once ? 1 : CLAIM_DISPATCH_BATCH_SIZE,
33887
+ settings.maxConcurrency === null ? CLAIM_DISPATCH_BATCH_SIZE : Math.max(1, settings.maxConcurrency - active.size)
33888
+ )
33889
+ } : batchClaimVersion === 2 ? {
33890
+ schema_version: "external_inference_job_claim_v2",
33891
+ ...claimRequestBase,
33892
+ maximum_jobs: Math.min(
33893
+ this.options.once ? 1 : CLAIM_DISPATCH_BATCH_SIZE,
33894
+ settings.maxConcurrency === null ? CLAIM_DISPATCH_BATCH_SIZE : Math.max(1, settings.maxConcurrency - active.size)
33895
+ )
33896
+ } : {
33897
+ schema_version: "external_inference_job_claim_v1",
33898
+ ...claimRequestBase
33899
+ };
33815
33900
  return {
33816
33901
  ...current,
33817
33902
  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
- },
33903
+ pending_claim_request: pendingClaimRequest,
33833
33904
  updated_at: isoAt(requestedAt)
33834
33905
  };
33835
33906
  };
@@ -33948,8 +34019,8 @@ var init_runner = __esm({
33948
34019
  });
33949
34020
  const recoveryQueue = [];
33950
34021
  const attemptStartRetryCounts = /* @__PURE__ */ new Map();
33951
- const launchClaim = (claim, recovery, claimRequest) => {
33952
- if (!recovery) {
34022
+ const launchClaim = (claim, recovery, claimRequest, prestarted) => {
34023
+ if (!recovery || prestarted) {
33953
34024
  claimed += 1;
33954
34025
  onceClaimed = true;
33955
34026
  }
@@ -34048,6 +34119,7 @@ var init_runner = __esm({
34048
34119
  },
34049
34120
  resumeReceipt: recovery,
34050
34121
  claimRequest,
34122
+ prestarted,
34051
34123
  onClaimPersisted: settleClaimPromotion,
34052
34124
  rolloverClaimRequest: (current) => {
34053
34125
  if (drainRequested || this.options.once || settings.maxConcurrency !== null && active.size + 1 >= settings.maxConcurrency) return current;
@@ -34251,6 +34323,7 @@ var init_runner = __esm({
34251
34323
  }
34252
34324
  const request = receipt.pending_claim_request;
34253
34325
  let claim;
34326
+ const claimCallStartedAtMs = now();
34254
34327
  try {
34255
34328
  claim = await mcp.callTool(
34256
34329
  "inference.job.claim",
@@ -34259,7 +34332,48 @@ var init_runner = __esm({
34259
34332
  );
34260
34333
  assertClaimResult(request, claim);
34261
34334
  } catch (error48) {
34262
- if (!this.options.signal?.aborted && controlPlaneFatal(error48)) {
34335
+ if (!this.options.signal?.aborted && request.schema_version === "external_inference_job_claim_v3" && error48 instanceof ExternalInferenceMcpError && error48.serverFailureCode === "schema_validation") {
34336
+ batchClaimVersion = 2;
34337
+ await mutateReceipt((current) => ({
34338
+ ...current,
34339
+ pending_claim_request: current.pending_claim_request?.claim_request_id === request.claim_request_id ? {
34340
+ schema_version: "external_inference_job_claim_v2",
34341
+ contract_version: request.contract_version,
34342
+ host_id: request.host_id,
34343
+ host_generation: request.host_generation,
34344
+ advertisement_generation: request.advertisement_generation,
34345
+ key_generation: request.key_generation,
34346
+ claim_request_id: stableOperationId("claim-fallback-v2", [
34347
+ request.claim_request_id
34348
+ ]),
34349
+ requested_at: isoAt(now()),
34350
+ maximum_jobs: request.maximum_jobs
34351
+ } : current.pending_claim_request,
34352
+ updated_at: isoAt(now())
34353
+ }));
34354
+ nextClaimAt = now();
34355
+ continue;
34356
+ } else if (!this.options.signal?.aborted && request.schema_version === "external_inference_job_claim_v2" && error48 instanceof ExternalInferenceMcpError && error48.serverFailureCode === "schema_validation") {
34357
+ batchClaimVersion = 1;
34358
+ await mutateReceipt((current) => ({
34359
+ ...current,
34360
+ pending_claim_request: current.pending_claim_request?.claim_request_id === request.claim_request_id ? {
34361
+ schema_version: "external_inference_job_claim_v1",
34362
+ contract_version: request.contract_version,
34363
+ host_id: request.host_id,
34364
+ host_generation: request.host_generation,
34365
+ advertisement_generation: request.advertisement_generation,
34366
+ key_generation: request.key_generation,
34367
+ claim_request_id: stableOperationId("claim-fallback-v1", [
34368
+ request.claim_request_id
34369
+ ]),
34370
+ requested_at: isoAt(now())
34371
+ } : current.pending_claim_request,
34372
+ updated_at: isoAt(now())
34373
+ }));
34374
+ nextClaimAt = now();
34375
+ continue;
34376
+ } else if (!this.options.signal?.aborted && controlPlaneFatal(error48)) {
34263
34377
  requestDrain("authority_lost");
34264
34378
  } else if (!this.options.signal?.aborted && error48 instanceof ExternalInferenceMcpError && error48.code === "claim_replay_obsolete") {
34265
34379
  await mutateReceipt((current) => ({
@@ -34291,6 +34405,109 @@ var init_runner = __esm({
34291
34405
  }
34292
34406
  break;
34293
34407
  }
34408
+ const claimResponseReceivedAtMs = now();
34409
+ const claimCallRoundTripMs = Math.max(
34410
+ 0,
34411
+ claimResponseReceivedAtMs - claimCallStartedAtMs
34412
+ );
34413
+ if (claim.claim_state === "batch") {
34414
+ if (request.schema_version === "external_inference_job_claim_v1") {
34415
+ runnerIdentityMismatch("Batched job claim");
34416
+ }
34417
+ const maximumJobs = "maximum_jobs" in request ? request.maximum_jobs : runnerIdentityMismatch("Batched job claim");
34418
+ const expectedBatchResultVersion = request.schema_version === "external_inference_job_claim_v3" ? "external_inference_job_claim_result_v3" : "external_inference_job_claim_result_v2";
34419
+ if (claim.schema_version !== expectedBatchResultVersion || claim.claims.length > maximumJobs) runnerIdentityMismatch("Batched job claim");
34420
+ const claimTransportResidualMs = Math.max(
34421
+ 0,
34422
+ claimCallRoundTripMs - (claim.schema_version === "external_inference_job_claim_result_v3" ? claim.server_processing_ms : 0)
34423
+ );
34424
+ if (claim.claims.length === 0) {
34425
+ await mutateReceipt((current) => ({
34426
+ ...current,
34427
+ pending_claim_request: current.pending_claim_request?.claim_request_id === request.claim_request_id ? null : current.pending_claim_request,
34428
+ updated_at: isoAt(now())
34429
+ }));
34430
+ nextClaimAt = now() + Math.max(MIN_SLEEP_MS, claim.retry_after_ms);
34431
+ if (this.options.once) requestDrain("once_empty");
34432
+ break;
34433
+ }
34434
+ const decryptClaim = this.dependencies.decryptClaim ?? decryptExternalInferenceClaim;
34435
+ const prepared = claim.claims.map((item) => {
34436
+ const claimedJob = item.claim;
34437
+ 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");
34438
+ const { jobInput } = decryptClaim(
34439
+ credential.x25519_private_key,
34440
+ claimedJob
34441
+ );
34442
+ const expectedAttemptId = stableOperationId("attempt", [
34443
+ claimedJob.host_id,
34444
+ claimedJob.job_id,
34445
+ claimedJob.claim_generation,
34446
+ claimedJob.attempt_index,
34447
+ claimedJob.input_sha256
34448
+ ]);
34449
+ if (item.attempt_id !== expectedAttemptId) {
34450
+ runnerIdentityMismatch("Batched attempt");
34451
+ }
34452
+ const startRequest = buildAttemptStartRequest(
34453
+ claimedJob,
34454
+ item.attempt_id,
34455
+ item.started_at
34456
+ );
34457
+ return validateAttemptReceipt({
34458
+ schema_version: ATTEMPT_RECEIPT_SCHEMA_VERSION,
34459
+ attempt_id: item.attempt_id,
34460
+ job_id: claimedJob.job_id,
34461
+ profile_id: jobInput.profile_id,
34462
+ input_sha256: jobInput.input_sha256,
34463
+ claim_generation: claimedJob.claim_generation,
34464
+ attempt_index: claimedJob.attempt_index,
34465
+ phase: "claimed",
34466
+ dispatch_outcome: "not_dispatched",
34467
+ terminal_operation_id: null,
34468
+ job_heartbeat_sequence: 0,
34469
+ claim: claimedJob,
34470
+ start_request: startRequest,
34471
+ terminal_request: null,
34472
+ updated_at: isoAt(now())
34473
+ });
34474
+ });
34475
+ const shouldRollover = !this.options.once && (settings.maxConcurrency === null || active.size + prepared.length < settings.maxConcurrency);
34476
+ await mutateReceipt((current) => {
34477
+ if (current.pending_claim_request?.claim_request_id !== request.claim_request_id) runnerIdentityMismatch("Batched claim receipt");
34478
+ const attempts = { ...current.attempts };
34479
+ for (const attempt of prepared) {
34480
+ if (attempts[attempt.attempt_id]) {
34481
+ runnerIdentityMismatch("Batched attempt receipt");
34482
+ }
34483
+ attempts[attempt.attempt_id] = attempt;
34484
+ }
34485
+ const promoted = {
34486
+ ...current,
34487
+ pending_claim_request: null,
34488
+ attempts,
34489
+ updated_at: isoAt(now())
34490
+ };
34491
+ return shouldRollover ? preparePendingClaim(promoted) : promoted;
34492
+ });
34493
+ for (let index = 0; index < prepared.length; index += 1) {
34494
+ const item = claim.claims[index];
34495
+ launchClaim(item.claim, prepared[index], void 0, {
34496
+ result: {
34497
+ job_id: item.claim.job_id,
34498
+ attempt_id: item.attempt_id,
34499
+ attempt_index: item.claim.attempt_index,
34500
+ state: "dispatch_intent",
34501
+ provider_dispatch_freshness_remaining_ms: item.provider_dispatch_freshness_remaining_ms
34502
+ },
34503
+ roundTripMs: claimTransportResidualMs,
34504
+ claimResponseReceivedAtMs
34505
+ });
34506
+ }
34507
+ if (this.options.once) requestDrain("once_complete");
34508
+ 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);
34509
+ continue;
34510
+ }
34294
34511
  if (claim.claim_state === "empty") {
34295
34512
  await mutateReceipt((current) => ({
34296
34513
  ...current,
@@ -34536,69 +34753,75 @@ var init_runner = __esm({
34536
34753
  let startResult;
34537
34754
  const startCallStartedAtMs = now();
34538
34755
  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) => {
34756
+ if (options.prestarted) {
34757
+ startResult = options.prestarted.result;
34545
34758
  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"
34759
+ startRoundTripMs = Math.max(0, options.prestarted.roundTripMs);
34760
+ } else {
34761
+ const claimPromotionPromise = options.resumeReceipt ? Promise.resolve() : persistAttempt({ phase: "claimed" }, true);
34762
+ const startCallPromise = retryExact(() => mcp.callTool(
34763
+ "inference.job.start",
34764
+ startRequest,
34765
+ { signal, deadlineAtMs: attemptDeadlineAtMs }
34766
+ ), { signal, deadlineAtMs: attemptDeadlineAtMs }).then((result2) => {
34767
+ startCallCompletedAtMs = now();
34768
+ return result2;
34769
+ });
34770
+ const [startOutcome, claimPromotionOutcome] = await Promise.allSettled([
34771
+ startCallPromise,
34772
+ claimPromotionPromise
34773
+ ]);
34774
+ if (claimPromotionOutcome.status === "rejected") {
34775
+ throw claimPromotionOutcome.reason;
34776
+ }
34777
+ if (startOutcome.status === "rejected") {
34778
+ const error48 = startOutcome.reason;
34779
+ if (error48 instanceof ExternalInferenceMcpError && error48.serverFailureCode === "server_account_context_expired_before_provider_dispatch") {
34780
+ await removeAttempt();
34781
+ options.onAttemptOutcome?.({
34782
+ outcome: "freshness_rejected_before_provider_dispatch",
34783
+ failure_category: "freshness",
34784
+ failure_code: error48.serverFailureCode,
34785
+ dispatch_outcome: "not_dispatched"
34786
+ });
34787
+ return "failed";
34788
+ }
34789
+ if (attemptDeadlineAtMs <= now() + MIN_CLAIM_START_WINDOW_MS) {
34790
+ await removeAttempt();
34791
+ return "failed";
34792
+ }
34793
+ if (signal.aborted) throw error48;
34794
+ if (controlPlaneFatal(error48)) throw error48;
34795
+ const remainingMs = Math.max(
34796
+ MIN_SLEEP_MS,
34797
+ attemptDeadlineAtMs - now() - MIN_CLAIM_START_WINDOW_MS
34798
+ );
34799
+ const retryCount = Math.min(
34800
+ Math.max(1, options.startRetryCount),
34801
+ Number.MAX_SAFE_INTEGER
34802
+ );
34803
+ const retryDelayMs = Math.min(
34804
+ remoteRetryAfterMs(error48, attemptStartRetryFallbackMs(retryCount)),
34805
+ remainingMs
34806
+ );
34807
+ const rawErrorCode = error48 && typeof error48 === "object" && "code" in error48 ? String(error48.code) : "start_acknowledgement_failed";
34808
+ options.onAttemptStartRetry?.({
34809
+ failure_stage: "job_start_acknowledgement",
34810
+ error_code: safeFailureCode(rawErrorCode, "start_acknowledgement_failed"),
34811
+ http_status_code: error48 instanceof ExternalInferenceMcpError ? error48.httpStatusCode : null,
34812
+ retryable: retryableRemoteError(error48),
34813
+ definitively_not_applied: Boolean(
34814
+ error48 && typeof error48 === "object" && "definitivelyNotApplied" in error48 && error48.definitivelyNotApplied === true
34815
+ ),
34816
+ retry_after_ms: error48 instanceof ExternalInferenceMcpError ? error48.retryAfterMs : null,
34817
+ retry_count: retryCount,
34818
+ next_delay_ms: retryDelayMs
34564
34819
  });
34565
- return "failed";
34566
- }
34567
- if (attemptDeadlineAtMs <= now() + MIN_CLAIM_START_WINDOW_MS) {
34568
- await removeAttempt();
34569
- return "failed";
34820
+ await options.sleep(retryDelayMs, signal);
34821
+ return "retry_claimed";
34570
34822
  }
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";
34823
+ startResult = startOutcome.value;
34600
34824
  }
34601
- startResult = startOutcome.value;
34602
34825
  assertStartResult(startRequest, startResult);
34603
34826
  if (serverProviderDispatchDeadlineMs !== void 0) {
34604
34827
  const serverRemaining = startResult.provider_dispatch_freshness_remaining_ms;
@@ -34608,13 +34831,16 @@ var init_runner = __esm({
34608
34831
  "The Server provider-dispatch freshness receipt is unavailable."
34609
34832
  );
34610
34833
  }
34611
- startRoundTripMs = Math.max(0, startCallCompletedAtMs - startCallStartedAtMs);
34834
+ if (!options.prestarted) {
34835
+ startRoundTripMs = Math.max(0, startCallCompletedAtMs - startCallStartedAtMs);
34836
+ }
34612
34837
  serverReportedFreshnessRemainingMs = Number(serverRemaining);
34613
34838
  const conservativeRemainingMs = Math.max(
34614
34839
  0,
34615
34840
  serverReportedFreshnessRemainingMs - startRoundTripMs
34616
34841
  );
34617
- providerDispatchNotAfterMs = startCallCompletedAtMs + conservativeRemainingMs;
34842
+ const freshnessAnchorAtMs = options.prestarted ? options.prestarted.claimResponseReceivedAtMs : startCallCompletedAtMs;
34843
+ providerDispatchNotAfterMs = freshnessAnchorAtMs + conservativeRemainingMs;
34618
34844
  }
34619
34845
  }
34620
34846
  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.7",
4
4
  "description": "VTX Macro CLI, MCP server, and durable external inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",