@vtxmacro/cli 2026.8.34 → 2026.8.36

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 +266 -93
  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.34",
41
+ package_version: "2026.8.36",
42
42
  codex_package_name: "@openai/codex",
43
43
  codex_version: "0.147.0",
44
44
  platforms: {
@@ -16619,66 +16619,86 @@ async function acquireInferenceHostProcessLock(path, dependencies = {}) {
16619
16619
  }
16620
16620
  };
16621
16621
  }
16622
- var INFERENCE_CREDENTIAL_NAMESPACE, MAX_INFERENCE_PRIVATE_FILE_BYTES, WINDOWS_PRIVATE_ACL_SCRIPT, windowsPrivateAclInvocation, runWindowsPrivateAcl, windowsAclCache, windowsAclIdentity, aclCacheKey, secureWindowsPrivatePath, invalidateWindowsAclCache, rebindHardenedWindowsAclAfterRename, rebindHardenedWindowsDirectoryAfterOwnedMutation, isDefaultWindowsPrivatePath, secureExistingWindowsPath, linuxProcessIdentity, windowsProcessIdentity, darwinProcessIdentity, runSmallIdentityCommand, cachedSystemBootIdentity, readInferenceSystemBootIdentity, defaultProcessIdentity, defaultCurrentProcessIdentity, processLockObservationCache, inferenceProcessIdentitiesMatch, DEFAULT_INFERENCE_HOST_INSTANCE, SAFE_INFERENCE_HOST_INSTANCE, requireNamedInstancePath, credentialStoreIdentity;
16622
+ var INFERENCE_CREDENTIAL_NAMESPACE, MAX_INFERENCE_PRIVATE_FILE_BYTES, WINDOWS_PRIVATE_ACL_BROKER_SCRIPT, windowsPrivateAclBrokerInvocation, WindowsPrivateAclBroker, defaultWindowsPrivateAclBroker, runWindowsPrivateAcl, windowsAclCache, windowsAclIdentity, aclCacheKey, secureWindowsPrivatePath, invalidateWindowsAclCache, rebindHardenedWindowsAclAfterRename, rebindHardenedWindowsDirectoryAfterOwnedMutation, isDefaultWindowsPrivatePath, secureExistingWindowsPath, linuxProcessIdentity, windowsProcessIdentity, darwinProcessIdentity, runSmallIdentityCommand, cachedSystemBootIdentity, readInferenceSystemBootIdentity, defaultProcessIdentity, defaultCurrentProcessIdentity, processLockObservationCache, inferenceProcessIdentitiesMatch, DEFAULT_INFERENCE_HOST_INSTANCE, SAFE_INFERENCE_HOST_INSTANCE, requireNamedInstancePath, credentialStoreIdentity;
16623
16623
  var init_config = __esm({
16624
16624
  "lib/inference-host/config.ts"() {
16625
16625
  "use strict";
16626
16626
  INFERENCE_CREDENTIAL_NAMESPACE = "vtxmacro-insights-inference";
16627
16627
  MAX_INFERENCE_PRIVATE_FILE_BYTES = 16 * 1024 * 1024;
16628
- WINDOWS_PRIVATE_ACL_SCRIPT = `$ErrorActionPreference='Stop'
16629
- $path=[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:VTX_PRIVATE_PATH_B64))
16630
- $kind=$env:VTX_PRIVATE_PATH_KIND
16631
- $mode=$env:VTX_PRIVATE_ACL_MODE
16632
- if(-not (Test-Path -LiteralPath $path)) { [Console]::Out.Write('missing'); exit 3 }
16633
- $current=[Security.Principal.WindowsIdentity]::GetCurrent().User
16634
- $system=New-Object Security.Principal.SecurityIdentifier('S-1-5-18')
16635
- $admins=New-Object Security.Principal.SecurityIdentifier('S-1-5-32-544')
16636
- $allowed=@($current.Value,$system.Value,$admins.Value)
16637
- if($mode -eq 'harden') {
16638
- $acl=Get-Acl -LiteralPath $path
16639
- $existingOwner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
16640
- if($existingOwner -ne $current.Value) { throw 'private ACL owner is invalid' }
16641
- $acl.SetAccessRuleProtection($true,$false)
16642
- foreach($existingRule in @($acl.Access)) {
16643
- [void]$acl.RemoveAccessRuleSpecific($existingRule)
16644
- }
16645
- $inherit=if($kind -eq 'directory') {
16646
- [Security.AccessControl.InheritanceFlags]'ContainerInherit,ObjectInherit'
16647
- } else { [Security.AccessControl.InheritanceFlags]::None }
16648
- foreach($sid in @($current,$system,$admins)) {
16649
- $rule=New-Object Security.AccessControl.FileSystemAccessRule(
16650
- $sid,
16651
- [Security.AccessControl.FileSystemRights]::FullControl,
16652
- $inherit,
16653
- [Security.AccessControl.PropagationFlags]::None,
16654
- [Security.AccessControl.AccessControlType]::Allow
16655
- )
16656
- [void]$acl.AddAccessRule($rule)
16657
- }
16658
- (Get-Item -LiteralPath $path).SetAccessControl($acl)
16659
- }
16660
- $actual=Get-Acl -LiteralPath $path
16661
- $owner=(New-Object Security.Principal.NTAccount($actual.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
16662
- if($owner -ne $current.Value) { throw 'private ACL owner is invalid' }
16663
- if($mode -eq 'verify-owner') { [Console]::Out.Write('ok'); exit 0 }
16664
- if(-not $actual.AreAccessRulesProtected) { throw 'private ACL inheritance is invalid' }
16665
- $userFull=$false
16666
- foreach($rule in $actual.Access) {
16667
- $sid=$rule.IdentityReference.Translate([Security.Principal.SecurityIdentifier]).Value
16668
- if($rule.IsInherited -or $allowed -notcontains $sid -or $rule.AccessControlType -ne [Security.AccessControl.AccessControlType]::Allow) {
16669
- throw 'private ACL contains an unauthorized access rule'
16670
- }
16671
- if($sid -eq $current.Value -and (($rule.FileSystemRights -band [Security.AccessControl.FileSystemRights]::FullControl) -eq [Security.AccessControl.FileSystemRights]::FullControl)) { $userFull=$true }
16672
- }
16673
- if(-not $userFull) { throw 'private ACL does not grant the current user full control' }
16674
- [Console]::Out.Write('ok')`;
16675
- windowsPrivateAclInvocation = (path, kind, mode) => ({
16628
+ WINDOWS_PRIVATE_ACL_BROKER_SCRIPT = `$ErrorActionPreference='Stop'
16629
+ $ProgressPreference='SilentlyContinue'
16630
+ while(($line=[Console]::In.ReadLine()) -ne $null) {
16631
+ $requestId=$null
16632
+ try {
16633
+ if($line.Length -lt 2 -or $line.Length -gt 65536) { throw 'invalid request size' }
16634
+ $request=$line | ConvertFrom-Json
16635
+ $names=@($request.PSObject.Properties.Name | Sort-Object)
16636
+ if(($names -join ',') -ne 'id,kind,mode,path_b64') { throw 'invalid request shape' }
16637
+ if($request.id -isnot [long] -and $request.id -isnot [int]) { throw 'invalid request id' }
16638
+ $requestId=[long]$request.id
16639
+ if($requestId -lt 1) { throw 'invalid request id' }
16640
+ $kind=[string]$request.kind
16641
+ $mode=[string]$request.mode
16642
+ if($kind -ne 'directory' -and $kind -ne 'file') { throw 'invalid path kind' }
16643
+ if($mode -ne 'harden' -and $mode -ne 'verify' -and $mode -ne 'verify-owner') { throw 'invalid ACL mode' }
16644
+ $path=[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String([string]$request.path_b64))
16645
+ if([string]::IsNullOrWhiteSpace($path) -or $path.Length -gt 32767 -or $path.Contains([char]0)) { throw 'invalid path' }
16646
+ if(-not (Test-Path -LiteralPath $path)) {
16647
+ [Console]::Out.WriteLine((@{id=$requestId;status='missing'} | ConvertTo-Json -Compress))
16648
+ continue
16649
+ }
16650
+ $current=[Security.Principal.WindowsIdentity]::GetCurrent().User
16651
+ $system=New-Object Security.Principal.SecurityIdentifier('S-1-5-18')
16652
+ $admins=New-Object Security.Principal.SecurityIdentifier('S-1-5-32-544')
16653
+ $allowed=@($current.Value,$system.Value,$admins.Value)
16654
+ if($mode -eq 'harden') {
16655
+ $acl=Get-Acl -LiteralPath $path
16656
+ $existingOwner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
16657
+ if($existingOwner -ne $current.Value) { throw 'private ACL owner is invalid' }
16658
+ $acl.SetAccessRuleProtection($true,$false)
16659
+ foreach($existingRule in @($acl.Access)) { [void]$acl.RemoveAccessRuleSpecific($existingRule) }
16660
+ $inherit=if($kind -eq 'directory') {
16661
+ [Security.AccessControl.InheritanceFlags]'ContainerInherit,ObjectInherit'
16662
+ } else { [Security.AccessControl.InheritanceFlags]::None }
16663
+ foreach($sid in @($current,$system,$admins)) {
16664
+ $rule=New-Object Security.AccessControl.FileSystemAccessRule(
16665
+ $sid,
16666
+ [Security.AccessControl.FileSystemRights]::FullControl,
16667
+ $inherit,
16668
+ [Security.AccessControl.PropagationFlags]::None,
16669
+ [Security.AccessControl.AccessControlType]::Allow
16670
+ )
16671
+ [void]$acl.AddAccessRule($rule)
16672
+ }
16673
+ (Get-Item -LiteralPath $path).SetAccessControl($acl)
16674
+ }
16675
+ $actual=Get-Acl -LiteralPath $path
16676
+ $owner=(New-Object Security.Principal.NTAccount($actual.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
16677
+ if($owner -ne $current.Value) { throw 'private ACL owner is invalid' }
16678
+ if($mode -ne 'verify-owner') {
16679
+ if(-not $actual.AreAccessRulesProtected) { throw 'private ACL inheritance is invalid' }
16680
+ $userFull=$false
16681
+ foreach($rule in $actual.Access) {
16682
+ $sid=$rule.IdentityReference.Translate([Security.Principal.SecurityIdentifier]).Value
16683
+ if($rule.IsInherited -or $allowed -notcontains $sid -or $rule.AccessControlType -ne [Security.AccessControl.AccessControlType]::Allow) {
16684
+ throw 'private ACL contains an unauthorized access rule'
16685
+ }
16686
+ if($sid -eq $current.Value -and (($rule.FileSystemRights -band [Security.AccessControl.FileSystemRights]::FullControl) -eq [Security.AccessControl.FileSystemRights]::FullControl)) { $userFull=$true }
16687
+ }
16688
+ if(-not $userFull) { throw 'private ACL does not grant the current user full control' }
16689
+ }
16690
+ [Console]::Out.WriteLine((@{id=$requestId;status='ok'} | ConvertTo-Json -Compress))
16691
+ } catch {
16692
+ [Console]::Out.WriteLine((@{id=$requestId;status='error'} | ConvertTo-Json -Compress))
16693
+ }
16694
+ }`;
16695
+ windowsPrivateAclBrokerInvocation = () => ({
16676
16696
  args: [
16677
16697
  "-NoLogo",
16678
16698
  "-NoProfile",
16679
16699
  "-NonInteractive",
16680
16700
  "-EncodedCommand",
16681
- Buffer.from(WINDOWS_PRIVATE_ACL_SCRIPT, "utf16le").toString("base64")
16701
+ Buffer.from(WINDOWS_PRIVATE_ACL_BROKER_SCRIPT, "utf16le").toString("base64")
16682
16702
  ],
16683
16703
  env: {
16684
16704
  NODE_ENV: process.env.NODE_ENV,
@@ -16688,49 +16708,169 @@ if(-not $userFull) { throw 'private ACL does not grant the current user full con
16688
16708
  PATHEXT: process.env.PATHEXT,
16689
16709
  PSModulePath: process.env.PSModulePath,
16690
16710
  TEMP: process.env.TEMP,
16691
- TMP: process.env.TMP,
16692
- VTX_PRIVATE_PATH_B64: Buffer.from(path, "utf8").toString("base64"),
16693
- VTX_PRIVATE_PATH_KIND: kind,
16694
- VTX_PRIVATE_ACL_MODE: mode
16711
+ TMP: process.env.TMP
16695
16712
  }
16696
16713
  });
16697
- runWindowsPrivateAcl = async (path, kind, mode) => await new Promise((resolvePromise, reject) => {
16698
- const invocation = windowsPrivateAclInvocation(path, kind, mode);
16699
- const child = spawn("powershell.exe", [...invocation.args], {
16700
- env: invocation.env,
16701
- windowsHide: true,
16702
- stdio: ["ignore", "pipe", "pipe"]
16703
- });
16704
- const stdout = [];
16705
- const stderr = [];
16706
- let settled = false;
16707
- const timer = setTimeout(() => child.kill("SIGKILL"), 15e3);
16708
- child.stdout.on("data", (chunk) => stdout.push(Buffer.from(chunk)));
16709
- child.stderr.on("data", (chunk) => stderr.push(Buffer.from(chunk)));
16710
- const settle = (error48) => {
16711
- if (settled) return;
16712
- settled = true;
16713
- clearTimeout(timer);
16714
- if (error48) reject(error48);
16715
- else resolvePromise();
16716
- };
16717
- child.once("error", (error48) => settle(error48));
16718
- child.once("exit", (code) => {
16719
- const output3 = Buffer.concat(stdout).toString("utf8").trim();
16720
- if (code === 0 && output3 === "ok") {
16721
- settle();
16714
+ WindowsPrivateAclBroker = class {
16715
+ constructor(dependencies = {}) {
16716
+ this.child = null;
16717
+ this.requestSequence = 0;
16718
+ this.queue = Promise.resolve();
16719
+ this.pending = null;
16720
+ this.outputBuffer = "";
16721
+ this.idleTimer = null;
16722
+ this.run = async (path, kind, mode) => {
16723
+ const operation = this.queue.then(
16724
+ () => this.dispatch(path, kind, mode),
16725
+ () => this.dispatch(path, kind, mode)
16726
+ );
16727
+ this.queue = operation.then(() => void 0, () => void 0);
16728
+ await operation;
16729
+ };
16730
+ this.requestTimeoutMs = dependencies.requestTimeoutMs ?? 15e3;
16731
+ this.idleShutdownMs = dependencies.idleShutdownMs ?? 3e4;
16732
+ this.spawnProcess = dependencies.spawnProcess ?? (() => {
16733
+ const invocation = windowsPrivateAclBrokerInvocation();
16734
+ return spawn("powershell.exe", [...invocation.args], {
16735
+ env: invocation.env,
16736
+ windowsHide: true,
16737
+ stdio: ["pipe", "pipe", "pipe"]
16738
+ });
16739
+ });
16740
+ }
16741
+ scheduleIdleShutdown() {
16742
+ if (this.idleTimer) clearTimeout(this.idleTimer);
16743
+ this.idleTimer = setTimeout(() => {
16744
+ this.idleTimer = null;
16745
+ const child = this.child;
16746
+ if (!child || this.pending) return;
16747
+ this.child = null;
16748
+ this.outputBuffer = "";
16749
+ child.stdin.end();
16750
+ const force = setTimeout(() => child.kill("SIGKILL"), 1e3);
16751
+ force.unref();
16752
+ child.once("exit", () => clearTimeout(force));
16753
+ }, this.idleShutdownMs);
16754
+ this.idleTimer.unref();
16755
+ }
16756
+ failChild(child, error48) {
16757
+ if (this.child !== child) return;
16758
+ this.child = null;
16759
+ this.outputBuffer = "";
16760
+ if (this.idleTimer) {
16761
+ clearTimeout(this.idleTimer);
16762
+ this.idleTimer = null;
16763
+ }
16764
+ const pending = this.pending;
16765
+ this.pending = null;
16766
+ if (pending) {
16767
+ clearTimeout(pending.timer);
16768
+ pending.reject(error48);
16769
+ }
16770
+ child.kill("SIGKILL");
16771
+ }
16772
+ acceptLine(child, line) {
16773
+ const pending = this.pending;
16774
+ if (!pending || !line || line.length > 4096) {
16775
+ this.failChild(child, new Error("Windows private ACL broker returned malformed output."));
16776
+ return;
16777
+ }
16778
+ let response;
16779
+ try {
16780
+ const parsed = JSON.parse(line);
16781
+ if (Object.keys(parsed).sort().join("\0") !== "id\0status" || parsed.id !== pending.id || !["ok", "missing", "error"].includes(String(parsed.status))) throw new Error("invalid response");
16782
+ response = parsed;
16783
+ } catch {
16784
+ this.failChild(child, new Error("Windows private ACL broker returned malformed output."));
16722
16785
  return;
16723
16786
  }
16724
- const detail = Buffer.concat(stderr).toString("utf8").trim();
16725
- if (code === 3 && output3 === "missing" || /GetAcl_PathNotFound|Cannot find path .* because it does not exist/iu.test(detail)) {
16787
+ this.pending = null;
16788
+ clearTimeout(pending.timer);
16789
+ if (response.status === "ok") {
16790
+ pending.resolve();
16791
+ } else if (response.status === "missing") {
16726
16792
  const error48 = new Error("Windows private path no longer exists.");
16727
16793
  error48.code = "ENOENT";
16728
- settle(error48);
16729
- return;
16794
+ pending.reject(error48);
16795
+ } else {
16796
+ pending.reject(new Error(`Windows private ACL ${pending.mode} failed.`));
16730
16797
  }
16731
- settle(new Error(`Windows private ACL ${mode} failed${detail ? `: ${detail}` : "."}`));
16732
- });
16733
- });
16798
+ this.scheduleIdleShutdown();
16799
+ }
16800
+ ensureChild() {
16801
+ if (this.child && this.child.exitCode === null && !this.child.killed) return this.child;
16802
+ const child = this.spawnProcess();
16803
+ this.child = child;
16804
+ this.outputBuffer = "";
16805
+ child.stdout.setEncoding("utf8");
16806
+ child.stdout.on("data", (chunk) => {
16807
+ if (this.child !== child) return;
16808
+ this.outputBuffer += chunk;
16809
+ if (this.outputBuffer.length > 65536) {
16810
+ this.failChild(child, new Error("Windows private ACL broker exceeded its output limit."));
16811
+ return;
16812
+ }
16813
+ while (this.child === child) {
16814
+ const newline = this.outputBuffer.indexOf("\n");
16815
+ if (newline < 0) break;
16816
+ const line = this.outputBuffer.slice(0, newline).trim();
16817
+ this.outputBuffer = this.outputBuffer.slice(newline + 1);
16818
+ this.acceptLine(child, line);
16819
+ }
16820
+ });
16821
+ child.stderr.on("data", () => void 0);
16822
+ child.once("error", () => {
16823
+ this.failChild(child, new Error("Windows private ACL broker failed to start."));
16824
+ });
16825
+ child.once("exit", () => {
16826
+ this.failChild(child, new Error("Windows private ACL broker exited before confirmation."));
16827
+ });
16828
+ child.unref();
16829
+ for (const stream of [child.stdin, child.stdout, child.stderr]) {
16830
+ stream.unref?.();
16831
+ }
16832
+ return child;
16833
+ }
16834
+ async dispatch(path, kind, mode) {
16835
+ if (this.idleTimer) {
16836
+ clearTimeout(this.idleTimer);
16837
+ this.idleTimer = null;
16838
+ }
16839
+ const id2 = ++this.requestSequence;
16840
+ const request = `${JSON.stringify({
16841
+ id: id2,
16842
+ kind,
16843
+ mode,
16844
+ path_b64: Buffer.from(path, "utf8").toString("base64")
16845
+ })}
16846
+ `;
16847
+ if (Buffer.byteLength(request, "utf8") > 65536) {
16848
+ throw new Error("Windows private ACL broker request exceeds its input limit.");
16849
+ }
16850
+ const child = this.ensureChild();
16851
+ await new Promise((resolvePromise, reject) => {
16852
+ const timer = setTimeout(() => {
16853
+ this.failChild(child, new Error("Windows private ACL broker request timed out."));
16854
+ }, this.requestTimeoutMs);
16855
+ this.pending = { id: id2, mode, resolve: resolvePromise, reject, timer };
16856
+ child.stdin.write(request, "utf8", (error48) => {
16857
+ if (error48) {
16858
+ this.failChild(child, new Error("Windows private ACL broker request failed."));
16859
+ }
16860
+ });
16861
+ });
16862
+ }
16863
+ close() {
16864
+ if (this.idleTimer) clearTimeout(this.idleTimer);
16865
+ this.idleTimer = null;
16866
+ const child = this.child;
16867
+ this.child = null;
16868
+ this.outputBuffer = "";
16869
+ if (child) child.stdin.end();
16870
+ }
16871
+ };
16872
+ defaultWindowsPrivateAclBroker = new WindowsPrivateAclBroker();
16873
+ runWindowsPrivateAcl = async (path, kind, mode) => await defaultWindowsPrivateAclBroker.run(path, kind, mode);
16734
16874
  windowsAclCache = /* @__PURE__ */ new Map();
16735
16875
  windowsAclIdentity = async (path) => {
16736
16876
  const metadata = await lstat(path, { bigint: true });
@@ -29880,6 +30020,7 @@ var init_runner = __esm({
29880
30020
  now()
29881
30021
  )
29882
30022
  });
30023
+ const recoveryQueue = [];
29883
30024
  const launchClaim = (claim, recovery, claimRequest) => {
29884
30025
  if (!recovery) {
29885
30026
  claimed += 1;
@@ -29901,6 +30042,7 @@ var init_runner = __esm({
29901
30042
  pendingClaimPromotions = Math.max(0, pendingClaimPromotions - 1);
29902
30043
  };
29903
30044
  if (claimRequest) pendingClaimPromotions += 1;
30045
+ let retryRecovery = null;
29904
30046
  const promise2 = this.executeClaim({
29905
30047
  claim,
29906
30048
  attemptId,
@@ -29960,7 +30102,16 @@ var init_runner = __esm({
29960
30102
  onClaimPersisted: settleClaimPromotion
29961
30103
  }).then((outcome) => {
29962
30104
  if (outcome === "completed") completed += 1;
29963
- else failed += 1;
30105
+ else if (outcome === "failed") failed += 1;
30106
+ else {
30107
+ const recovery2 = receipt.attempts[attemptId];
30108
+ if (recovery2?.phase !== "claimed") {
30109
+ throw new InferenceHostRecoveryRequiredError(
30110
+ "The retryable pre-dispatch attempt receipt is unavailable."
30111
+ );
30112
+ }
30113
+ retryRecovery = recovery2;
30114
+ }
29964
30115
  }).catch((error48) => {
29965
30116
  failed += 1;
29966
30117
  requestDrain(controlPlaneFatal(error48) ? "authority_lost" : "attempt_terminal_unconfirmed");
@@ -29968,6 +30119,14 @@ var init_runner = __esm({
29968
30119
  settleClaimPromotion();
29969
30120
  active.delete(attemptId);
29970
30121
  attemptControllers.delete(attemptId);
30122
+ if (retryRecovery) {
30123
+ recoveryQueue.push(retryRecovery);
30124
+ emitDiagnostic("attempt_start_retry_scheduled", {
30125
+ job_id: claim.job_id,
30126
+ attempt_id: attemptId,
30127
+ active_attempts: active.size
30128
+ });
30129
+ }
29971
30130
  });
29972
30131
  active.set(attemptId, promise2);
29973
30132
  emitDiagnostic("attempt_started", {
@@ -29986,7 +30145,6 @@ var init_runner = __esm({
29986
30145
  receipt = { ...receipt, attempts, updated_at: isoAt(now()) };
29987
30146
  await this.persistReceipt(receipt, now);
29988
30147
  };
29989
- const recoveryQueue = [];
29990
30148
  for (const recovery of Object.values({ ...receipt.attempts })) {
29991
30149
  if (recovery.phase === "terminal_pending") {
29992
30150
  try {
@@ -30362,7 +30520,17 @@ var init_runner = __esm({
30362
30520
  await removeAttempt();
30363
30521
  return "failed";
30364
30522
  }
30365
- throw error48;
30523
+ if (signal.aborted) throw error48;
30524
+ if (controlPlaneFatal(error48)) throw error48;
30525
+ const remainingMs = Math.max(
30526
+ MIN_SLEEP_MS,
30527
+ attemptDeadlineAtMs - now() - MIN_CLAIM_START_WINDOW_MS
30528
+ );
30529
+ await options.sleep(
30530
+ Math.min(remoteRetryAfterMs(error48, 1e3), remainingMs),
30531
+ signal
30532
+ );
30533
+ return "retry_claimed";
30366
30534
  }
30367
30535
  assertStartResult(startRequest, startResult);
30368
30536
  await updateAttempt({ phase: "started" });
@@ -30426,6 +30594,11 @@ var init_runner = __esm({
30426
30594
  heartbeatFailure = error48;
30427
30595
  attemptAbort.abort();
30428
30596
  });
30597
+ const stopHeartbeat = async () => {
30598
+ heartbeatStopped = true;
30599
+ attemptAbort.abort();
30600
+ await heartbeatLoop;
30601
+ };
30429
30602
  try {
30430
30603
  this.validateImmutableSelection(jobInput);
30431
30604
  const outputContract = parseOutputContract(jobInput);
@@ -30584,6 +30757,7 @@ var init_runner = __esm({
30584
30757
  { cause: error48 }
30585
30758
  );
30586
30759
  }
30760
+ await stopHeartbeat();
30587
30761
  await removeAttempt();
30588
30762
  options.onAttemptOutcome?.({
30589
30763
  outcome: "completed",
@@ -30688,6 +30862,7 @@ var init_runner = __esm({
30688
30862
  { cause: terminalError }
30689
30863
  );
30690
30864
  }
30865
+ await stopHeartbeat();
30691
30866
  await removeAttempt();
30692
30867
  options.onAttemptOutcome?.({
30693
30868
  outcome: "failed",
@@ -30701,10 +30876,8 @@ var init_runner = __esm({
30701
30876
  });
30702
30877
  return "failed";
30703
30878
  } finally {
30704
- heartbeatStopped = true;
30705
- attemptAbort.abort();
30706
30879
  signal.removeEventListener("abort", relayAbort);
30707
- await heartbeatLoop;
30880
+ await stopHeartbeat();
30708
30881
  }
30709
30882
  }
30710
30883
  validateImmutableSelection(jobInput) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.8.34",
3
+ "version": "2026.8.36",
4
4
  "description": "VTX Macro CLI, MCP server, and durable subscription inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",