@vtxmacro/cli 2026.9.17 → 2026.9.18

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.17",
19
+ package_version: "2026.9.18",
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.17",
72
+ package_version: "2026.9.18",
73
73
  codex_package_name: "@openai/codex",
74
74
  codex_version: "0.153.3",
75
75
  copilot_sdk_package_name: "@github/copilot-sdk",
@@ -19254,7 +19254,8 @@ var init_mcp_client = __esm({
19254
19254
  failure_code: publicFailureCodeSchema,
19255
19255
  phase: safeCodeSchema2,
19256
19256
  retryable: external_exports.boolean(),
19257
- terminal_before_execution: external_exports.boolean()
19257
+ terminal_before_execution: external_exports.boolean(),
19258
+ retry_after_ms: external_exports.number().int().nonnegative().max(MAX_RETRY_AFTER_MS).optional()
19258
19259
  }).passthrough();
19259
19260
  structuredPublicToolErrorSchema = publicToolErrorSchema.extend({
19260
19261
  schema_version: external_exports.literal("vtx_insights_tool_error_v1")
@@ -19845,11 +19846,12 @@ var init_mcp_client = __esm({
19845
19846
  const publicToolError = structuredPublicToolError.success ? structuredPublicToolError.data : hasStructuredPublicToolErrorMarker ? null : parsePublicToolError(errorText);
19846
19847
  const hasPublicToolErrorMarker = hasStructuredPublicToolErrorMarker || errorText.includes(PUBLIC_TOOL_ERROR_PREFIX);
19847
19848
  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"));
19849
+ const hostNotClaimable = name === "inference.job.claim" && publicToolError?.failure_code === "host_not_claimable" && publicToolError.phase === "admission" && publicToolError.retryable === true && publicToolError.terminal_before_execution === true;
19848
19850
  const definitivelyNotApplied = (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(
19849
19851
  "External inference claim request was not applied before its generation became stale"
19850
19852
  ) || errorText.includes("External inference host advertisement is expired or superseded")) || name === "inference.job.complete" && completionEvidenceExpired;
19851
19853
  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"));
19852
- const retryableClaimRejection = name === "inference.job.claim" && !definitivelyNotApplied && (retryableInfrastructureRejection || 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"));
19854
+ 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"));
19853
19855
  const retryableHeartbeatClockSkew = name === "inference.host.heartbeat" && definitivelyNotApplied;
19854
19856
  const retryableAdvertisementClockSkew = (name === "inference.host.register" || name === "inference.host.advertise") && definitivelyNotApplied;
19855
19857
  const staleHostHeartbeatGeneration = name === "inference.host.heartbeat" && errorText.includes("Heartbeat generations do not match the current host authority.");
@@ -19866,7 +19868,8 @@ var init_mcp_client = __esm({
19866
19868
  // request reached the application boundary, so retain and replay
19867
19869
  // the exact request unless the server proves it was not applied.
19868
19870
  retryable: retryableInfrastructureRejection || retryableClaimRejection || retryableHeartbeatClockSkew || retryableAdvertisementClockSkew,
19869
- serverFailureCode: publicToolError?.failure_code ?? null
19871
+ serverFailureCode: publicToolError?.failure_code ?? null,
19872
+ retryAfterMs: hostNotClaimable ? publicToolError?.retry_after_ms ?? null : null
19870
19873
  }
19871
19874
  );
19872
19875
  }
@@ -24692,6 +24695,7 @@ var init_codex_adapter = __esm({
24692
24695
  const promise2 = this.executeAttempt(input);
24693
24696
  this.inFlightAttempts.set(input.attemptId, {
24694
24697
  inputSha256: input.inputSha256,
24698
+ deadlineAtMs: input.deadlineAtMs,
24695
24699
  promise: promise2
24696
24700
  });
24697
24701
  void promise2.then(async () => {
@@ -24715,6 +24719,25 @@ var init_codex_adapter = __esm({
24715
24719
  retryable: false
24716
24720
  });
24717
24721
  }
24722
+ const activeAttempt = this.inFlightAttempts.get(attemptId);
24723
+ if (activeAttempt) {
24724
+ let timer;
24725
+ try {
24726
+ await Promise.race([
24727
+ activeAttempt.promise.catch(() => void 0),
24728
+ new Promise((_resolve, reject) => {
24729
+ timer = setTimeout(() => reject(new CodexAppServerError({
24730
+ message: "Codex cancelled setup did not settle before its immutable deadline.",
24731
+ category: "adapter",
24732
+ code: "attempt_cleanup_unconfirmed",
24733
+ retryable: false
24734
+ })), Math.max(1, Math.min(2147483647, activeAttempt.deadlineAtMs - Date.now())));
24735
+ })
24736
+ ]);
24737
+ } finally {
24738
+ if (timer !== void 0) clearTimeout(timer);
24739
+ }
24740
+ }
24718
24741
  const activeCleanup = this.attemptCleanups.get(attemptId);
24719
24742
  if (activeCleanup) {
24720
24743
  try {
@@ -24886,6 +24909,12 @@ var init_codex_adapter = __esm({
24886
24909
  let completedResult = null;
24887
24910
  let caughtError = null;
24888
24911
  let sessionInvalidationError = null;
24912
+ let turnEntered = false;
24913
+ const reportSetupCancellation = () => {
24914
+ if (!turnEntered) input.onTerminalDispatchOutcome?.("not_dispatched");
24915
+ };
24916
+ input.signal?.addEventListener("abort", reportSetupCancellation, { once: true });
24917
+ if (input.signal?.aborted) reportSetupCancellation();
24889
24918
  try {
24890
24919
  resources = await (this.dependencies.createAttemptResources ?? ((attemptId) => createIsolatedCodexAttemptResources(
24891
24920
  attemptId,
@@ -24946,6 +24975,8 @@ var init_codex_adapter = __esm({
24946
24975
  };
24947
24976
  latestCheckpoint = baseCheckpoint;
24948
24977
  await recoveryHooks?.save(baseCheckpoint);
24978
+ assertAttemptActive(input.deadlineAtMs, input.signal);
24979
+ turnEntered = true;
24949
24980
  const result2 = await session.executeTurn({
24950
24981
  thread,
24951
24982
  workspacePath: resources.workspacePath,
@@ -25063,6 +25094,7 @@ var init_codex_adapter = __esm({
25063
25094
  }
25064
25095
  throw classified;
25065
25096
  } finally {
25097
+ input.signal?.removeEventListener("abort", reportSetupCancellation);
25066
25098
  sessionLease?.activeAttemptIds.delete(input.attemptId);
25067
25099
  const cleanup = async () => {
25068
25100
  let cleanupError = sessionInvalidationError;
@@ -36370,6 +36402,7 @@ var init_runner = __esm({
36370
36402
  const scheduleReceiptWriter = () => {
36371
36403
  if (receiptWriter || receiptWriterFailed) return;
36372
36404
  receiptWriter = (async () => {
36405
+ await Promise.resolve();
36373
36406
  try {
36374
36407
  while (persistedReceiptRevision < receiptRevision) {
36375
36408
  const targetRevision = receiptRevision;
@@ -36595,6 +36628,7 @@ var init_runner = __esm({
36595
36628
  };
36596
36629
  }
36597
36630
  };
36631
+ let claimAvailabilityBackoff = null;
36598
36632
  const hostHeartbeat = async (status, requestOptions = {
36599
36633
  signal: this.options.signal
36600
36634
  }, retryRemote = true, allowOfflineProjection = false, definitiveReseedAttempt = 0, advertisementGeneration = receipt.advertisement_generation) => {
@@ -36659,6 +36693,9 @@ var init_runner = __esm({
36659
36693
  );
36660
36694
  throw error48;
36661
36695
  }
36696
+ if (claimAvailabilityBackoff !== null && result2.host.status === "online" && request.provider_quota_recovery != null && Date.parse(request.provider_quota_recovery.observed_at) >= claimAvailabilityBackoff.rejectedAtMs) {
36697
+ claimAvailabilityBackoff = null;
36698
+ }
36662
36699
  };
36663
36700
  await hostHeartbeat("healthy");
36664
36701
  let lastHostHeartbeatSucceededAt = now();
@@ -36951,13 +36988,15 @@ var init_runner = __esm({
36951
36988
  });
36952
36989
  },
36953
36990
  onProviderDispatchWatchdog: (observation) => {
36954
- providerDispatchWatchdogDrainRequested = true;
36955
36991
  emitDiagnostic("provider_dispatch_watchdog_expired", {
36956
36992
  ...observation,
36957
36993
  job_id: claim.job_id,
36958
36994
  attempt_id: attemptId,
36959
36995
  active_attempts: active.size
36960
36996
  });
36997
+ },
36998
+ onProviderDispatchRecoveryRequired: () => {
36999
+ providerDispatchWatchdogDrainRequested = true;
36961
37000
  requestDrain("provider_dispatch_watchdog_expired");
36962
37001
  },
36963
37002
  startRetryCount: nextStartRetryCount,
@@ -37245,7 +37284,12 @@ var init_runner = __esm({
37245
37284
  const recovery = recoveryQueue.shift();
37246
37285
  launchClaim(recovery.claim, recovery);
37247
37286
  }
37248
- while (!drainRequested && recoveryQueue.length === 0 && (!this.options.once || !onceClaimed) && (settings.maxConcurrency === null || active.size < settings.maxConcurrency) && pendingClaimPromotions === 0 && now() >= Math.max(nextClaimAt, providerRetryAtMs ?? 0, providerFailureRetryAtMs)) {
37287
+ while (!drainRequested && recoveryQueue.length === 0 && (!this.options.once || !onceClaimed) && (settings.maxConcurrency === null || active.size < settings.maxConcurrency) && pendingClaimPromotions === 0 && now() >= Math.max(
37288
+ nextClaimAt,
37289
+ claimAvailabilityBackoff?.untilMs ?? 0,
37290
+ providerRetryAtMs ?? 0,
37291
+ providerFailureRetryAtMs
37292
+ )) {
37249
37293
  if (!receipt.pending_claim_request) {
37250
37294
  await mutateReceipt(preparePendingClaim);
37251
37295
  }
@@ -37327,7 +37371,13 @@ var init_runner = __esm({
37327
37371
  requestDrain("claim_failed");
37328
37372
  }
37329
37373
  } else if (!this.options.signal?.aborted && retryableRemoteError(error48)) {
37330
- nextClaimAt = now() + remoteRetryAfterMs(error48, 1e3);
37374
+ const rejectedAtMs = now();
37375
+ const retryAtMs = rejectedAtMs + remoteRetryAfterMs(error48, 1e3);
37376
+ if (error48 instanceof ExternalInferenceMcpError && error48.serverFailureCode === "host_not_claimable") {
37377
+ claimAvailabilityBackoff = { untilMs: retryAtMs, rejectedAtMs };
37378
+ } else {
37379
+ nextClaimAt = retryAtMs;
37380
+ }
37331
37381
  } else if (!this.options.signal?.aborted) {
37332
37382
  requestDrain("claim_failed");
37333
37383
  }
@@ -37465,7 +37515,12 @@ var init_runner = __esm({
37465
37515
  if (drainRequested) break;
37466
37516
  const advertisementDueAt = nextAdvertisementAttemptAt > now() ? nextAdvertisementAttemptAt : receipt.advertisement_expires_at ? Date.parse(receipt.advertisement_expires_at) - settings.advertisementRefreshLeadMs : now() + MIN_SLEEP_MS;
37467
37517
  const wakeAt = Math.min(
37468
- Math.max(nextClaimAt, providerRetryAtMs ?? 0, providerFailureRetryAtMs),
37518
+ Math.max(
37519
+ nextClaimAt,
37520
+ claimAvailabilityBackoff?.untilMs ?? 0,
37521
+ providerRetryAtMs ?? 0,
37522
+ providerFailureRetryAtMs
37523
+ ),
37469
37524
  nextProviderRateLimitRefreshAt,
37470
37525
  now() + settings.hostHeartbeatMs,
37471
37526
  Math.max(now() + MIN_SLEEP_MS, advertisementDueAt)
@@ -37846,10 +37901,6 @@ var init_runner = __esm({
37846
37901
  options.prestarted.claimResponseReceivedAtMs,
37847
37902
  options.prestarted.roundTripMs
37848
37903
  );
37849
- if (options.prestarted.receiptDurability) {
37850
- reportPreProviderStage("receipt_persistence");
37851
- await awaitPreProviderDurability(options.prestarted.receiptDurability);
37852
- }
37853
37904
  } else {
37854
37905
  reportPreProviderStage("receipt_persistence");
37855
37906
  const claimPromotionPromise = options.resumeReceipt ? Promise.resolve() : awaitPreProviderDurability(
@@ -37933,10 +37984,13 @@ var init_runner = __esm({
37933
37984
  const providerDispatchable = inputValidationError === void 0 && outputContract !== null;
37934
37985
  reportPreProviderStage("receipt_persistence");
37935
37986
  await awaitPreProviderDurability(
37936
- persistAttempt({
37937
- phase: providerDispatchable ? "dispatched" : "started",
37938
- dispatch_outcome: providerDispatchable ? "outcome_unknown" : "not_dispatched"
37939
- })
37987
+ Promise.all([
37988
+ persistAttempt({
37989
+ phase: providerDispatchable ? "dispatched" : "started",
37990
+ dispatch_outcome: providerDispatchable ? "outcome_unknown" : "not_dispatched"
37991
+ }),
37992
+ options.prestarted?.receiptDurability
37993
+ ])
37940
37994
  );
37941
37995
  }
37942
37996
  reportPreProviderStage("thread_setup");
@@ -37944,6 +37998,7 @@ var init_runner = __esm({
37944
37998
  clearProviderDispatchWatchdog();
37945
37999
  signal.removeEventListener("abort", relayAbort);
37946
38000
  if (providerDispatchWatchdogExpired) {
38001
+ options.onProviderDispatchRecoveryRequired?.();
37947
38002
  return terminalizeProviderDispatchWatchdog();
37948
38003
  }
37949
38004
  throw error48;
@@ -38091,6 +38146,7 @@ var init_runner = __esm({
38091
38146
  dispatchOutcome: "not_dispatched"
38092
38147
  });
38093
38148
  }
38149
+ options.onProviderDispatchRecoveryRequired?.();
38094
38150
  throw new CodexAppServerError({
38095
38151
  message: "Provider dispatch could not be excluded after the freshness watchdog expired.",
38096
38152
  category: "timeout",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.9.17",
3
+ "version": "2026.9.18",
4
4
  "description": "VTX Macro CLI, MCP server, and durable external inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",