@vtxmacro/cli 2026.9.4 → 2026.9.6

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.4",
19
+ package_version: "2026.9.6",
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.4",
50
+ package_version: "2026.9.6",
51
51
  codex_package_name: "@openai/codex",
52
52
  codex_version: "0.147.0",
53
53
  copilot_sdk_package_name: "@github/copilot-sdk",
@@ -15501,6 +15501,8 @@ var init_external_inference_contract = __esm({
15501
15501
  outcome: adapterOutcomeEvidenceSchema,
15502
15502
  latency_ms: nonNegativeSafeIntegerSchema,
15503
15503
  time_to_first_token_ms: nonNegativeSafeIntegerSchema.nullable(),
15504
+ provider_dispatched_at: timestampSchema.optional(),
15505
+ adapter_result_ready_at: timestampSchema.optional(),
15504
15506
  provider_dispatch_freshness_remaining_ms: nonNegativeSafeIntegerSchema.nullable().optional(),
15505
15507
  finish_reason: safeCodeSchema.nullable(),
15506
15508
  refusal_status: external_exports.enum(["none", "refused", "blocked", "unknown"]),
@@ -15616,6 +15618,8 @@ var init_external_inference_contract = __esm({
15616
15618
  failure_category: safeCodeSchema,
15617
15619
  failure_code: safeCodeSchema,
15618
15620
  retryable: external_exports.boolean(),
15621
+ provider_dispatched_at: timestampSchema.optional(),
15622
+ adapter_result_ready_at: timestampSchema.optional(),
15619
15623
  provider_dispatch_freshness_remaining_ms: nonNegativeSafeIntegerSchema.nullable().optional(),
15620
15624
  process_exit: codexProcessExitDiagnosticsSchema.nullable().optional(),
15621
15625
  membership_disposition: external_exports.enum([
@@ -15651,6 +15655,9 @@ var init_external_inference_contract = __esm({
15651
15655
  if (value.usage?.availability === "reported") {
15652
15656
  context.addIssue({ code: "custom", message: "not-dispatched failures cannot report token usage", path: ["usage"] });
15653
15657
  }
15658
+ if (value.provider_dispatched_at !== void 0 || value.adapter_result_ready_at !== void 0) {
15659
+ context.addIssue({ code: "custom", message: "not-dispatched failures cannot report provider stages", path: ["provider_dispatched_at"] });
15660
+ }
15654
15661
  }
15655
15662
  });
15656
15663
  jobCancelRequestSchema = external_exports.strictObject({
@@ -33297,6 +33304,7 @@ var init_runner = __esm({
33297
33304
  instance_name: this.options.instanceName ?? "default",
33298
33305
  host_id: localState.host_id,
33299
33306
  display_name: this.options.displayName,
33307
+ host_runtime_version: settings.hostRuntimeVersion,
33300
33308
  ...fields
33301
33309
  });
33302
33310
  } catch {
@@ -33526,16 +33534,53 @@ var init_runner = __esm({
33526
33534
  updated_at: isoAt(now())
33527
33535
  };
33528
33536
  await this.persistReceipt(receipt, now);
33529
- let receiptMutationChain = Promise.resolve();
33537
+ let receiptRevision = 0;
33538
+ let persistedReceiptRevision = 0;
33539
+ let receiptWriter = null;
33540
+ let receiptWriterFailed = false;
33541
+ let receiptWriteFailure;
33542
+ const receiptDurabilityWaiters = [];
33543
+ const scheduleReceiptWriter = () => {
33544
+ if (receiptWriter || receiptWriterFailed) return;
33545
+ receiptWriter = (async () => {
33546
+ try {
33547
+ while (persistedReceiptRevision < receiptRevision) {
33548
+ const targetRevision = receiptRevision;
33549
+ const snapshot = receipt;
33550
+ await this.persistReceipt(snapshot, now);
33551
+ persistedReceiptRevision = targetRevision;
33552
+ for (let index = receiptDurabilityWaiters.length - 1; index >= 0; index -= 1) {
33553
+ const waiter = receiptDurabilityWaiters[index];
33554
+ if (waiter.revision > persistedReceiptRevision) continue;
33555
+ receiptDurabilityWaiters.splice(index, 1);
33556
+ waiter.resolve();
33557
+ }
33558
+ }
33559
+ } catch (error48) {
33560
+ receiptWriterFailed = true;
33561
+ receiptWriteFailure = error48;
33562
+ for (const waiter of receiptDurabilityWaiters.splice(0)) {
33563
+ waiter.reject(error48);
33564
+ }
33565
+ } finally {
33566
+ receiptWriter = null;
33567
+ if (!receiptWriterFailed && persistedReceiptRevision < receiptRevision) {
33568
+ scheduleReceiptWriter();
33569
+ }
33570
+ }
33571
+ })();
33572
+ };
33530
33573
  const mutateReceipt = async (mutation) => {
33531
- let result2;
33532
- const operation = receiptMutationChain.then(async () => {
33533
- result2 = mutation(receipt);
33534
- receipt = result2;
33535
- await this.persistReceipt(receipt, now);
33574
+ if (receiptWriterFailed) throw receiptWriteFailure;
33575
+ const result2 = mutation(receipt);
33576
+ receipt = result2;
33577
+ const revision = receiptRevision + 1;
33578
+ receiptRevision = revision;
33579
+ const durable = new Promise((resolve6, reject) => {
33580
+ receiptDurabilityWaiters.push({ revision, resolve: resolve6, reject });
33536
33581
  });
33537
- receiptMutationChain = operation;
33538
- await operation;
33582
+ scheduleReceiptWriter();
33583
+ await durable;
33539
33584
  return result2;
33540
33585
  };
33541
33586
  const envelopePublicKey = await this.dependencies.envelopePublicKey(credential);
@@ -33763,6 +33808,31 @@ var init_runner = __esm({
33763
33808
  let nextClaimAt = Math.max(now(), providerRetryAtMs ?? 0);
33764
33809
  let pendingClaimPromotions = 0;
33765
33810
  let onceClaimed = false;
33811
+ const preparePendingClaim = (current) => {
33812
+ if (current.pending_claim_request) return current;
33813
+ const claimSequence = current.claim_sequence + 1;
33814
+ const requestedAt = now();
33815
+ return {
33816
+ ...current,
33817
+ 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
+ },
33833
+ updated_at: isoAt(requestedAt)
33834
+ };
33835
+ };
33766
33836
  const hostHeartbeatAbort = new AbortController();
33767
33837
  stopHostHeartbeatLoop = () => hostHeartbeatAbort.abort();
33768
33838
  let nextHostHeartbeatAt = now() + settings.hostHeartbeatMs;
@@ -33978,7 +34048,11 @@ var init_runner = __esm({
33978
34048
  },
33979
34049
  resumeReceipt: recovery,
33980
34050
  claimRequest,
33981
- onClaimPersisted: settleClaimPromotion
34051
+ onClaimPersisted: settleClaimPromotion,
34052
+ rolloverClaimRequest: (current) => {
34053
+ if (drainRequested || this.options.once || settings.maxConcurrency !== null && active.size + 1 >= settings.maxConcurrency) return current;
34054
+ return preparePendingClaim(current);
34055
+ }
33982
34056
  }).then((outcome) => {
33983
34057
  if (outcome === "completed") {
33984
34058
  attemptStartRetryCounts.delete(attemptId);
@@ -34173,31 +34247,7 @@ var init_runner = __esm({
34173
34247
  }
34174
34248
  while (!drainRequested && recoveryQueue.length === 0 && (!this.options.once || !onceClaimed) && (settings.maxConcurrency === null || active.size < settings.maxConcurrency) && pendingClaimPromotions === 0 && now() >= nextClaimAt) {
34175
34249
  if (!receipt.pending_claim_request) {
34176
- await mutateReceipt((current) => {
34177
- if (current.pending_claim_request) return current;
34178
- const claimSequence = current.claim_sequence + 1;
34179
- const pendingClaimRequest = {
34180
- schema_version: "external_inference_job_claim_v1",
34181
- contract_version: EXTERNAL_INFERENCE_CONTRACT_VERSION,
34182
- host_id: localState.host_id,
34183
- host_generation: localState.host_generation,
34184
- advertisement_generation: current.advertisement_generation,
34185
- key_generation: localState.key_generation,
34186
- claim_request_id: stableOperationId("claim", [
34187
- localState.host_id,
34188
- localState.host_generation,
34189
- current.advertisement_generation,
34190
- claimSequence
34191
- ]),
34192
- requested_at: isoAt(now())
34193
- };
34194
- return {
34195
- ...current,
34196
- claim_sequence: claimSequence,
34197
- pending_claim_request: pendingClaimRequest,
34198
- updated_at: isoAt(now())
34199
- };
34200
- });
34250
+ await mutateReceipt(preparePendingClaim);
34201
34251
  }
34202
34252
  const request = receipt.pending_claim_request;
34203
34253
  let claim;
@@ -34374,6 +34424,8 @@ var init_runner = __esm({
34374
34424
  let providerDispatchNotAfterMs = serverProviderDispatchDeadlineMs === void 0 ? void 0 : now() - 1;
34375
34425
  let serverReportedFreshnessRemainingMs = null;
34376
34426
  let startRoundTripMs = 0;
34427
+ let providerDispatchedAt = null;
34428
+ let adapterResultReadyAt = null;
34377
34429
  let providerDispatchFreshnessRemainingMs = null;
34378
34430
  const startRequest = options.resumeReceipt?.start_request ?? buildAttemptStartRequest(claim, attemptId, isoAt(now()));
34379
34431
  let attemptReceipt = options.resumeReceipt ? validateAttemptReceipt(options.resumeReceipt) : {
@@ -34405,14 +34457,52 @@ var init_runner = __esm({
34405
34457
  updated_at: isoAt(now())
34406
34458
  });
34407
34459
  attemptReceipt = nextAttemptReceipt;
34408
- await options.updateReceipt((current) => ({
34409
- ...current,
34410
- pending_claim_request: clearPendingClaim && options.claimRequest && current.pending_claim_request?.claim_request_id === options.claimRequest.claim_request_id ? null : current.pending_claim_request ?? null,
34411
- attempts: { ...current.attempts, [attemptId]: nextAttemptReceipt },
34412
- updated_at: isoAt(now())
34413
- }));
34460
+ await options.updateReceipt((current) => {
34461
+ const retiresClaimRequest = Boolean(
34462
+ clearPendingClaim && options.claimRequest && current.pending_claim_request?.claim_request_id === options.claimRequest.claim_request_id
34463
+ );
34464
+ const promoted = {
34465
+ ...current,
34466
+ pending_claim_request: retiresClaimRequest ? null : current.pending_claim_request ?? null,
34467
+ attempts: { ...current.attempts, [attemptId]: nextAttemptReceipt },
34468
+ updated_at: isoAt(now())
34469
+ };
34470
+ return retiresClaimRequest && options.rolloverClaimRequest ? options.rolloverClaimRequest(promoted) : promoted;
34471
+ });
34414
34472
  if (clearPendingClaim) options.onClaimPersisted?.();
34415
34473
  };
34474
+ const persistAttemptHeartbeat = async (sequence) => {
34475
+ attemptReceipt = validateAttemptReceipt({
34476
+ ...attemptReceipt,
34477
+ job_heartbeat_sequence: Math.max(
34478
+ attemptReceipt.job_heartbeat_sequence,
34479
+ sequence
34480
+ ),
34481
+ updated_at: isoAt(now())
34482
+ });
34483
+ let persisted = false;
34484
+ await options.updateReceipt((current) => {
34485
+ const currentAttempt = current.attempts[attemptId];
34486
+ if (!currentAttempt || currentAttempt.job_id !== attemptReceipt.job_id || currentAttempt.claim_generation !== attemptReceipt.claim_generation || currentAttempt.input_sha256 !== attemptReceipt.input_sha256) return current;
34487
+ persisted = true;
34488
+ return {
34489
+ ...current,
34490
+ attempts: {
34491
+ ...current.attempts,
34492
+ [attemptId]: validateAttemptReceipt({
34493
+ ...currentAttempt,
34494
+ job_heartbeat_sequence: Math.max(
34495
+ currentAttempt.job_heartbeat_sequence,
34496
+ sequence
34497
+ ),
34498
+ updated_at: isoAt(now())
34499
+ })
34500
+ },
34501
+ updated_at: isoAt(now())
34502
+ };
34503
+ });
34504
+ return persisted;
34505
+ };
34416
34506
  const removeAttempt = async () => {
34417
34507
  await options.updateReceipt((current) => {
34418
34508
  const attempts = { ...current.attempts };
@@ -34565,7 +34655,7 @@ var init_runner = __esm({
34565
34655
  sequence,
34566
34656
  observed_at: isoAt(now())
34567
34657
  };
34568
- await persistAttempt({ job_heartbeat_sequence: sequence });
34658
+ if (!await persistAttemptHeartbeat(sequence)) return;
34569
34659
  const heartbeatDeadlineAtMs = Date.parse(claim.deadline_at);
34570
34660
  const directive = await retryExact(
34571
34661
  () => mcp.callTool(
@@ -34625,22 +34715,24 @@ var init_runner = __esm({
34625
34715
  requestedReasoningEffort: jobInput.requested_reasoning_effort,
34626
34716
  deadlineAtMs: Date.parse(jobInput.deadline_at),
34627
34717
  ...providerDispatchNotAfterMs === void 0 ? {} : { providerDispatchNotAfterMs },
34628
- ...providerDispatchNotAfterMs === void 0 ? {} : {
34629
- onProviderDispatch: () => {
34630
- providerDispatchFreshnessRemainingMs = Math.max(
34631
- 0,
34632
- providerDispatchNotAfterMs - now()
34633
- );
34634
- options.onProviderDispatch?.({
34635
- cycle_id: jobInput.runtime_binding?.cycle_id ?? "unavailable",
34636
- freshness_remaining_ms: providerDispatchFreshnessRemainingMs,
34637
- server_reported_remaining_ms: serverReportedFreshnessRemainingMs ?? 0,
34638
- start_round_trip_ms: startRoundTripMs
34639
- });
34640
- }
34718
+ onProviderDispatch: () => {
34719
+ const dispatchedAtMs = now();
34720
+ providerDispatchedAt ??= isoAt(dispatchedAtMs);
34721
+ if (providerDispatchNotAfterMs === void 0) return;
34722
+ providerDispatchFreshnessRemainingMs = Math.max(
34723
+ 0,
34724
+ providerDispatchNotAfterMs - dispatchedAtMs
34725
+ );
34726
+ options.onProviderDispatch?.({
34727
+ cycle_id: jobInput.runtime_binding?.cycle_id ?? "unavailable",
34728
+ freshness_remaining_ms: providerDispatchFreshnessRemainingMs,
34729
+ server_reported_remaining_ms: serverReportedFreshnessRemainingMs ?? 0,
34730
+ start_round_trip_ms: startRoundTripMs
34731
+ });
34641
34732
  },
34642
34733
  signal: attemptAbort.signal
34643
34734
  });
34735
+ adapterResultReadyAt = isoAt(now());
34644
34736
  await persistAttempt({
34645
34737
  phase: "dispatched",
34646
34738
  dispatch_outcome: "confirmed_dispatched"
@@ -34747,6 +34839,8 @@ var init_runner = __esm({
34747
34839
  },
34748
34840
  latency_ms: adapterResult.latencyMs,
34749
34841
  time_to_first_token_ms: adapterResult.timeToFirstTokenMs,
34842
+ ...providerDispatchedAt === null ? {} : { provider_dispatched_at: providerDispatchedAt },
34843
+ ...adapterResultReadyAt === null ? {} : { adapter_result_ready_at: adapterResultReadyAt },
34750
34844
  provider_dispatch_freshness_remaining_ms: providerDispatchFreshnessRemainingMs,
34751
34845
  finish_reason: finishReason,
34752
34846
  refusal_status: refusalStatus,
@@ -34877,6 +34971,8 @@ var init_runner = __esm({
34877
34971
  failure_category: failure.category,
34878
34972
  failure_code: failure.code,
34879
34973
  retryable: failure.retryable,
34974
+ ...providerDispatchedAt === null ? {} : { provider_dispatched_at: providerDispatchedAt },
34975
+ ...adapterResultReadyAt === null ? {} : { adapter_result_ready_at: adapterResultReadyAt },
34880
34976
  provider_dispatch_freshness_remaining_ms: providerDispatchFreshnessRemainingMs,
34881
34977
  ...processExit ? { process_exit: processExit } : {},
34882
34978
  membership_disposition: membershipFailureDisposition({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.9.4",
3
+ "version": "2026.9.6",
4
4
  "description": "VTX Macro CLI, MCP server, and durable external inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",