@vtxmacro/cli 2026.8.21 → 2026.8.22

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.
Files changed (2) hide show
  1. package/bin/vtx.js +108 -47
  2. package/package.json +1 -1
package/bin/vtx.js CHANGED
@@ -38,7 +38,7 @@ var init_agent_cli_release = __esm({
38
38
  "agent-cli-release.json"() {
39
39
  agent_cli_release_default = {
40
40
  package_name: "@vtxmacro/cli",
41
- package_version: "2026.8.21",
41
+ package_version: "2026.8.22",
42
42
  codex_package_name: "@openai/codex",
43
43
  codex_version: "0.147.0",
44
44
  platforms: {
@@ -21308,6 +21308,7 @@ var init_codex_adapter = __esm({
21308
21308
  CodexSubscriptionAdapter = class {
21309
21309
  constructor(dependencies = {}) {
21310
21310
  this.inFlightAttempts = /* @__PURE__ */ new Map();
21311
+ this.attemptCleanups = /* @__PURE__ */ new Map();
21311
21312
  this.durableSession = null;
21312
21313
  this.durableSessionStart = null;
21313
21314
  this.closing = false;
@@ -21430,15 +21431,21 @@ var init_codex_adapter = __esm({
21430
21431
  }
21431
21432
  return active.promise;
21432
21433
  }
21433
- const promise2 = this.executeAttempt(input).finally(() => {
21434
- if (this.inFlightAttempts.get(input.attemptId)?.promise === promise2) {
21435
- this.inFlightAttempts.delete(input.attemptId);
21436
- }
21437
- });
21434
+ const promise2 = this.executeAttempt(input);
21438
21435
  this.inFlightAttempts.set(input.attemptId, {
21439
21436
  inputSha256: input.inputSha256,
21440
21437
  promise: promise2
21441
21438
  });
21439
+ void promise2.then(async () => {
21440
+ await this.attemptCleanups.get(input.attemptId)?.catch(() => void 0);
21441
+ if (this.inFlightAttempts.get(input.attemptId)?.promise === promise2) {
21442
+ this.inFlightAttempts.delete(input.attemptId);
21443
+ }
21444
+ }, () => {
21445
+ if (this.inFlightAttempts.get(input.attemptId)?.promise === promise2) {
21446
+ this.inFlightAttempts.delete(input.attemptId);
21447
+ }
21448
+ }).catch(() => void 0);
21442
21449
  return promise2;
21443
21450
  }
21444
21451
  async acknowledgeAttempt(attemptId) {
@@ -21450,8 +21457,27 @@ var init_codex_adapter = __esm({
21450
21457
  retryable: false
21451
21458
  });
21452
21459
  }
21460
+ const activeCleanup = this.attemptCleanups.get(attemptId);
21461
+ if (activeCleanup) {
21462
+ try {
21463
+ await activeCleanup;
21464
+ } catch (error48) {
21465
+ throw new CodexAppServerError({
21466
+ message: "Codex attempt cleanup could not be confirmed.",
21467
+ category: "adapter",
21468
+ code: "attempt_cleanup_unconfirmed",
21469
+ retryable: false,
21470
+ cause: error48
21471
+ });
21472
+ }
21473
+ }
21453
21474
  const recoveryHooks = this.dependencies.recoveryHooks;
21454
- if (!recoveryHooks) return;
21475
+ if (!recoveryHooks) {
21476
+ if (activeCleanup && this.attemptCleanups.get(attemptId) === activeCleanup) {
21477
+ this.attemptCleanups.delete(attemptId);
21478
+ }
21479
+ return;
21480
+ }
21455
21481
  const checkpoint = await recoveryHooks.load(attemptId);
21456
21482
  if (checkpoint && !checkpoint.cleanupConfirmed) {
21457
21483
  throw new CodexAppServerError({
@@ -21479,6 +21505,9 @@ var init_codex_adapter = __esm({
21479
21505
  }
21480
21506
  }
21481
21507
  await recoveryHooks.clear(attemptId);
21508
+ if (activeCleanup && this.attemptCleanups.get(attemptId) === activeCleanup) {
21509
+ this.attemptCleanups.delete(attemptId);
21510
+ }
21482
21511
  }
21483
21512
  async close() {
21484
21513
  if (!this.adapterClosePromise) {
@@ -21497,8 +21526,29 @@ var init_codex_adapter = __esm({
21497
21526
  await Promise.allSettled(
21498
21527
  [...this.inFlightAttempts.values()].map((attempt) => attempt.promise)
21499
21528
  );
21529
+ await Promise.allSettled(
21530
+ [...this.attemptCleanups.values()]
21531
+ );
21532
+ let unconfirmedReceiptPaths = /* @__PURE__ */ new Set();
21533
+ const recoveryHooks = this.dependencies.recoveryHooks;
21534
+ if (recoveryHooks) {
21535
+ if (!recoveryHooks.loadAll) {
21536
+ unconfirmedReceiptPaths = null;
21537
+ } else {
21538
+ try {
21539
+ const checkpoints = await recoveryHooks.loadAll();
21540
+ unconfirmedReceiptPaths = new Set(
21541
+ Object.values(checkpoints).filter((checkpoint) => !checkpoint.cleanupConfirmed && checkpoint.processReceiptPath !== null).map((checkpoint) => resolve3(checkpoint.processReceiptPath))
21542
+ );
21543
+ } catch {
21544
+ unconfirmedReceiptPaths = null;
21545
+ }
21546
+ }
21547
+ }
21500
21548
  for (const session of sessions) {
21501
- if (session.processReceiptPath) await rm3(session.processReceiptPath, { force: true });
21549
+ if (session.processReceiptPath && unconfirmedReceiptPaths !== null && !unconfirmedReceiptPaths.has(resolve3(session.processReceiptPath))) {
21550
+ await rm3(session.processReceiptPath, { force: true });
21551
+ }
21502
21552
  }
21503
21553
  })();
21504
21554
  }
@@ -21651,8 +21701,6 @@ var init_codex_adapter = __esm({
21651
21701
  terminal: { kind: "completed", result: result2 }
21652
21702
  };
21653
21703
  await recoveryHooks?.save(latestCheckpoint);
21654
- await session.deleteThread(thread.threadId);
21655
- threadId = null;
21656
21704
  return result2;
21657
21705
  } catch (error48) {
21658
21706
  caughtError = error48;
@@ -21732,50 +21780,63 @@ var init_codex_adapter = __esm({
21732
21780
  }
21733
21781
  throw classified;
21734
21782
  } finally {
21735
- let cleanupError = sessionInvalidationError;
21736
- if (session && threadId) {
21737
- try {
21738
- await session.deleteThread(threadId);
21739
- } catch (error48) {
21740
- cleanupError = error48;
21783
+ const cleanup = async () => {
21784
+ let cleanupError = sessionInvalidationError;
21785
+ if (session && threadId) {
21786
+ try {
21787
+ await session.deleteThread(threadId);
21788
+ } catch (error48) {
21789
+ cleanupError = error48;
21790
+ }
21741
21791
  }
21742
- }
21743
- if (sessionLease && cleanupError) {
21744
- try {
21745
- await this.invalidateDurableSession(sessionLease);
21746
- } catch (error48) {
21747
- cleanupError ??= error48;
21792
+ if (sessionLease && cleanupError) {
21793
+ try {
21794
+ await this.invalidateDurableSession(sessionLease);
21795
+ } catch (error48) {
21796
+ cleanupError ??= error48;
21797
+ }
21748
21798
  }
21749
- }
21750
- if (resources && cleanupError === null) {
21751
- try {
21752
- await resources.cleanup();
21753
- } catch (error48) {
21754
- cleanupError = error48;
21799
+ if (resources && cleanupError === null) {
21800
+ try {
21801
+ await resources.cleanup();
21802
+ } catch (error48) {
21803
+ cleanupError = error48;
21804
+ }
21755
21805
  }
21756
- }
21757
- if (latestCheckpoint && recoveryHooks && cleanupError === null) {
21758
- latestCheckpoint = {
21759
- ...latestCheckpoint,
21760
- processState: latestCheckpoint.processToken ? sessionLease?.terminated ? "terminated" : "running" : "unmanaged",
21761
- cleanupConfirmed: true
21762
- };
21806
+ if (latestCheckpoint && recoveryHooks && cleanupError === null) {
21807
+ latestCheckpoint = {
21808
+ ...latestCheckpoint,
21809
+ processState: latestCheckpoint.processToken ? sessionLease?.terminated ? "terminated" : "running" : "unmanaged",
21810
+ cleanupConfirmed: true
21811
+ };
21812
+ try {
21813
+ await recoveryHooks.save(latestCheckpoint);
21814
+ } catch (error48) {
21815
+ cleanupError = error48;
21816
+ }
21817
+ }
21818
+ if (cleanupError) {
21819
+ throw new CodexAppServerError({
21820
+ message: "Codex attempt cleanup could not be confirmed.",
21821
+ category: "adapter",
21822
+ code: "attempt_cleanup_unconfirmed",
21823
+ retryable: false,
21824
+ dispatchOutcome: currentDispatchOutcome,
21825
+ cause: cleanupError
21826
+ });
21827
+ }
21828
+ };
21829
+ if (completedResult && caughtError === null) {
21830
+ const cleanupPromise = cleanup();
21831
+ void cleanupPromise.catch(() => void 0);
21832
+ this.attemptCleanups.set(input.attemptId, cleanupPromise);
21833
+ } else {
21763
21834
  try {
21764
- await recoveryHooks.save(latestCheckpoint);
21835
+ await cleanup();
21765
21836
  } catch (error48) {
21766
- cleanupError = error48;
21837
+ if (caughtError === null) throw error48;
21767
21838
  }
21768
21839
  }
21769
- if (cleanupError && caughtError === null) {
21770
- throw new CodexAppServerError({
21771
- message: "Codex attempt cleanup could not be confirmed.",
21772
- category: "adapter",
21773
- code: "attempt_cleanup_unconfirmed",
21774
- retryable: false,
21775
- dispatchOutcome: currentDispatchOutcome,
21776
- cause: cleanupError
21777
- });
21778
- }
21779
21840
  }
21780
21841
  }
21781
21842
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.8.21",
3
+ "version": "2026.8.22",
4
4
  "description": "VTX Macro CLI, MCP server, and durable subscription inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",