@vtxmacro/cli 2026.9.4 → 2026.9.5

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.5",
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.5",
51
51
  codex_package_name: "@openai/codex",
52
52
  codex_version: "0.147.0",
53
53
  copilot_sdk_package_name: "@github/copilot-sdk",
@@ -33526,16 +33526,53 @@ var init_runner = __esm({
33526
33526
  updated_at: isoAt(now())
33527
33527
  };
33528
33528
  await this.persistReceipt(receipt, now);
33529
- let receiptMutationChain = Promise.resolve();
33529
+ let receiptRevision = 0;
33530
+ let persistedReceiptRevision = 0;
33531
+ let receiptWriter = null;
33532
+ let receiptWriterFailed = false;
33533
+ let receiptWriteFailure;
33534
+ const receiptDurabilityWaiters = [];
33535
+ const scheduleReceiptWriter = () => {
33536
+ if (receiptWriter || receiptWriterFailed) return;
33537
+ receiptWriter = (async () => {
33538
+ try {
33539
+ while (persistedReceiptRevision < receiptRevision) {
33540
+ const targetRevision = receiptRevision;
33541
+ const snapshot = receipt;
33542
+ await this.persistReceipt(snapshot, now);
33543
+ persistedReceiptRevision = targetRevision;
33544
+ for (let index = receiptDurabilityWaiters.length - 1; index >= 0; index -= 1) {
33545
+ const waiter = receiptDurabilityWaiters[index];
33546
+ if (waiter.revision > persistedReceiptRevision) continue;
33547
+ receiptDurabilityWaiters.splice(index, 1);
33548
+ waiter.resolve();
33549
+ }
33550
+ }
33551
+ } catch (error48) {
33552
+ receiptWriterFailed = true;
33553
+ receiptWriteFailure = error48;
33554
+ for (const waiter of receiptDurabilityWaiters.splice(0)) {
33555
+ waiter.reject(error48);
33556
+ }
33557
+ } finally {
33558
+ receiptWriter = null;
33559
+ if (!receiptWriterFailed && persistedReceiptRevision < receiptRevision) {
33560
+ scheduleReceiptWriter();
33561
+ }
33562
+ }
33563
+ })();
33564
+ };
33530
33565
  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);
33566
+ if (receiptWriterFailed) throw receiptWriteFailure;
33567
+ const result2 = mutation(receipt);
33568
+ receipt = result2;
33569
+ const revision = receiptRevision + 1;
33570
+ receiptRevision = revision;
33571
+ const durable = new Promise((resolve6, reject) => {
33572
+ receiptDurabilityWaiters.push({ revision, resolve: resolve6, reject });
33536
33573
  });
33537
- receiptMutationChain = operation;
33538
- await operation;
33574
+ scheduleReceiptWriter();
33575
+ await durable;
33539
33576
  return result2;
33540
33577
  };
33541
33578
  const envelopePublicKey = await this.dependencies.envelopePublicKey(credential);
@@ -33763,6 +33800,31 @@ var init_runner = __esm({
33763
33800
  let nextClaimAt = Math.max(now(), providerRetryAtMs ?? 0);
33764
33801
  let pendingClaimPromotions = 0;
33765
33802
  let onceClaimed = false;
33803
+ const preparePendingClaim = (current) => {
33804
+ if (current.pending_claim_request) return current;
33805
+ const claimSequence = current.claim_sequence + 1;
33806
+ const requestedAt = now();
33807
+ return {
33808
+ ...current,
33809
+ claim_sequence: claimSequence,
33810
+ pending_claim_request: {
33811
+ schema_version: "external_inference_job_claim_v1",
33812
+ contract_version: EXTERNAL_INFERENCE_CONTRACT_VERSION,
33813
+ host_id: localState.host_id,
33814
+ host_generation: localState.host_generation,
33815
+ advertisement_generation: current.advertisement_generation,
33816
+ key_generation: localState.key_generation,
33817
+ claim_request_id: stableOperationId("claim", [
33818
+ localState.host_id,
33819
+ localState.host_generation,
33820
+ current.advertisement_generation,
33821
+ claimSequence
33822
+ ]),
33823
+ requested_at: isoAt(requestedAt)
33824
+ },
33825
+ updated_at: isoAt(requestedAt)
33826
+ };
33827
+ };
33766
33828
  const hostHeartbeatAbort = new AbortController();
33767
33829
  stopHostHeartbeatLoop = () => hostHeartbeatAbort.abort();
33768
33830
  let nextHostHeartbeatAt = now() + settings.hostHeartbeatMs;
@@ -33978,7 +34040,11 @@ var init_runner = __esm({
33978
34040
  },
33979
34041
  resumeReceipt: recovery,
33980
34042
  claimRequest,
33981
- onClaimPersisted: settleClaimPromotion
34043
+ onClaimPersisted: settleClaimPromotion,
34044
+ rolloverClaimRequest: (current) => {
34045
+ if (drainRequested || this.options.once || settings.maxConcurrency !== null && active.size + 1 >= settings.maxConcurrency) return current;
34046
+ return preparePendingClaim(current);
34047
+ }
33982
34048
  }).then((outcome) => {
33983
34049
  if (outcome === "completed") {
33984
34050
  attemptStartRetryCounts.delete(attemptId);
@@ -34173,31 +34239,7 @@ var init_runner = __esm({
34173
34239
  }
34174
34240
  while (!drainRequested && recoveryQueue.length === 0 && (!this.options.once || !onceClaimed) && (settings.maxConcurrency === null || active.size < settings.maxConcurrency) && pendingClaimPromotions === 0 && now() >= nextClaimAt) {
34175
34241
  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
- });
34242
+ await mutateReceipt(preparePendingClaim);
34201
34243
  }
34202
34244
  const request = receipt.pending_claim_request;
34203
34245
  let claim;
@@ -34405,14 +34447,52 @@ var init_runner = __esm({
34405
34447
  updated_at: isoAt(now())
34406
34448
  });
34407
34449
  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
- }));
34450
+ await options.updateReceipt((current) => {
34451
+ const retiresClaimRequest = Boolean(
34452
+ clearPendingClaim && options.claimRequest && current.pending_claim_request?.claim_request_id === options.claimRequest.claim_request_id
34453
+ );
34454
+ const promoted = {
34455
+ ...current,
34456
+ pending_claim_request: retiresClaimRequest ? null : current.pending_claim_request ?? null,
34457
+ attempts: { ...current.attempts, [attemptId]: nextAttemptReceipt },
34458
+ updated_at: isoAt(now())
34459
+ };
34460
+ return retiresClaimRequest && options.rolloverClaimRequest ? options.rolloverClaimRequest(promoted) : promoted;
34461
+ });
34414
34462
  if (clearPendingClaim) options.onClaimPersisted?.();
34415
34463
  };
34464
+ const persistAttemptHeartbeat = async (sequence) => {
34465
+ attemptReceipt = validateAttemptReceipt({
34466
+ ...attemptReceipt,
34467
+ job_heartbeat_sequence: Math.max(
34468
+ attemptReceipt.job_heartbeat_sequence,
34469
+ sequence
34470
+ ),
34471
+ updated_at: isoAt(now())
34472
+ });
34473
+ let persisted = false;
34474
+ await options.updateReceipt((current) => {
34475
+ const currentAttempt = current.attempts[attemptId];
34476
+ if (!currentAttempt || currentAttempt.job_id !== attemptReceipt.job_id || currentAttempt.claim_generation !== attemptReceipt.claim_generation || currentAttempt.input_sha256 !== attemptReceipt.input_sha256) return current;
34477
+ persisted = true;
34478
+ return {
34479
+ ...current,
34480
+ attempts: {
34481
+ ...current.attempts,
34482
+ [attemptId]: validateAttemptReceipt({
34483
+ ...currentAttempt,
34484
+ job_heartbeat_sequence: Math.max(
34485
+ currentAttempt.job_heartbeat_sequence,
34486
+ sequence
34487
+ ),
34488
+ updated_at: isoAt(now())
34489
+ })
34490
+ },
34491
+ updated_at: isoAt(now())
34492
+ };
34493
+ });
34494
+ return persisted;
34495
+ };
34416
34496
  const removeAttempt = async () => {
34417
34497
  await options.updateReceipt((current) => {
34418
34498
  const attempts = { ...current.attempts };
@@ -34565,7 +34645,7 @@ var init_runner = __esm({
34565
34645
  sequence,
34566
34646
  observed_at: isoAt(now())
34567
34647
  };
34568
- await persistAttempt({ job_heartbeat_sequence: sequence });
34648
+ if (!await persistAttemptHeartbeat(sequence)) return;
34569
34649
  const heartbeatDeadlineAtMs = Date.parse(claim.deadline_at);
34570
34650
  const directive = await retryExact(
34571
34651
  () => mcp.callTool(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.9.4",
3
+ "version": "2026.9.5",
4
4
  "description": "VTX Macro CLI, MCP server, and durable external inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",