@tekmidian/pai 1.0.4 → 1.0.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.
Files changed (137) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/{auto-route-21GdHL70.mjs → auto-route-DUYr57rs.mjs} +2 -2
  3. package/dist/auto-route-DWYK_0i0.mjs +11 -0
  4. package/dist/budget-DX-VIWGf.mjs +15 -0
  5. package/dist/{caller-identity-yLFb7CKq.mjs → caller-identity-Bim8JT-D.mjs} +3 -3
  6. package/dist/{capacity-DEveQdFV.mjs → capacity-CsZMkVyg.mjs} +7 -4
  7. package/dist/{chain-D7PFur8Y.mjs → chain-Dzz6xcKH.mjs} +5 -5
  8. package/dist/cli/index.mjs +107 -91
  9. package/dist/{cockpit-actions-OodH_vx_.mjs → cockpit-actions-BTA1njMO.mjs} +27 -23
  10. package/dist/{cockpit-actions-BfRMr2sm.mjs → cockpit-actions-BgsiNcUY.mjs} +17 -17
  11. package/dist/cockpit-memory-DIrNs4xr.mjs +20 -0
  12. package/dist/config/defaults/config.yaml +3 -0
  13. package/dist/{config-XpZWOYOG.mjs → config-CST2uq1v.mjs} +29 -4
  14. package/dist/{config-Bu1_vbY8.mjs → config-DYbyEe4-.mjs} +2 -2
  15. package/dist/{config-DtENJ6cL.mjs → config-Dv3t7xnT.mjs} +1 -1
  16. package/dist/config-h5qK3fst.mjs +4 -0
  17. package/dist/{controls-JLm6g0yP.mjs → controls-OiVVbe-f.mjs} +15 -15
  18. package/dist/daemon/index.mjs +37 -36
  19. package/dist/{daemon-nXanenDM.mjs → daemon-C1dycZ3W.mjs} +28 -26
  20. package/dist/daemon-ieo0lnpq.mjs +46 -0
  21. package/dist/daemon-mcp/index.mjs +34 -34
  22. package/dist/detect-C0ZBXqDL.mjs +10 -0
  23. package/dist/{detect-BLKsUOgG.mjs → detect-CHuxFrLy.mjs} +2 -2
  24. package/dist/{embed-pass-e64AwDCa.mjs → embed-pass-DtVF2fOV.mjs} +4 -4
  25. package/dist/{embedding-gate-Cnk4YCyX.mjs → embedding-gate-B98PK_wz.mjs} +2 -2
  26. package/dist/{embedding-gate-6rZrWRXa.mjs → embedding-gate-CTAk8STe.mjs} +2 -2
  27. package/dist/{endreason-BC-v05H_.mjs → endreason-BqyyU7BH.mjs} +4 -4
  28. package/dist/{factory-B7nv75rC.mjs → factory-BV0MQA3T.mjs} +4 -4
  29. package/dist/{factory-Bs9imVMq.mjs → factory-DeASMV7Z.mjs} +4 -4
  30. package/dist/{fallback-CBWpp2F2.mjs → fallback-Bj2cyVk_.mjs} +6 -6
  31. package/dist/{health-C4FQmkJn.mjs → health-kufVIf6i.mjs} +4 -4
  32. package/dist/{helpers-DSNK_1KP.mjs → helpers-CvbYEKoD.mjs} +2 -2
  33. package/dist/{helpers-Dz7mjTSw.mjs → helpers-WV8tdQHM.mjs} +5 -5
  34. package/dist/hooks/block-sleep-poll.mjs +1 -1
  35. package/dist/hooks/load-project-context.mjs +7 -7
  36. package/dist/hooks/local-model-hint.mjs +1 -1
  37. package/dist/hooks/route-agents-to-worker.mjs +1 -1
  38. package/dist/hooks/security-validator.mjs +2 -2
  39. package/dist/hooks/worker-edit-repair.mjs +2 -2
  40. package/dist/hooks/worker-guard.mjs +8 -8
  41. package/dist/hooks/worker-note.mjs +2 -2
  42. package/dist/hooks/worker-pool-host.mjs +106 -46
  43. package/dist/hooks/worker-proxy.mjs +1 -1
  44. package/dist/hooks/worker-status-line.mjs +16 -16
  45. package/dist/hooks/worker-supervision.mjs +1 -1
  46. package/dist/hooks/worker-tool-name-repair.mjs +2 -2
  47. package/dist/index.mjs +8 -8
  48. package/dist/{indexer-backend-BdjeL4P8.mjs → indexer-backend-B2vtFl38.mjs} +13 -13
  49. package/dist/kill-tree-CXZ0WfVf.mjs +10 -0
  50. package/dist/{kill-tree-DleMNZX3.mjs → kill-tree-CcpsRLCZ.mjs} +7 -7
  51. package/dist/{launch-Di7N-J5X.mjs → launch-DpQPZGsT.mjs} +3 -3
  52. package/dist/{launch-DlZTKE3u.mjs → launch-UPQBoW2q.mjs} +3 -3
  53. package/dist/{local-candidate-DLdwQt0s.mjs → local-candidate-Cp_bw4kK.mjs} +3 -3
  54. package/dist/{local-instances-ZeRkkuS5.mjs → local-instances-B-c-CxzP.mjs} +4 -4
  55. package/dist/{local-instances-DOxSgT_L.mjs → local-instances-bdCNNSsL.mjs} +2 -2
  56. package/dist/{local-tiers-BE4jGaMa.mjs → local-tiers-BtdEEe5n.mjs} +2 -2
  57. package/dist/{local-tiers-DNMI5W86.mjs → local-tiers-OBqAAfOg.mjs} +3 -3
  58. package/dist/{main-config-ops-kTXR8Pyv.mjs → main-config-ops-BYsK3BxM.mjs} +3 -3
  59. package/dist/{main-resolver-yp_puSSb.mjs → main-resolver-CAC3xfZM.mjs} +17 -17
  60. package/dist/{model-inventory-h6Z9fN_o.mjs → model-inventory-BuTpi9a6.mjs} +13 -13
  61. package/dist/{models-add-TVni3A7V.mjs → models-add-CJx2YAwh.mjs} +36 -35
  62. package/dist/operator-Bpxq_WB5.mjs +7 -0
  63. package/dist/{operator-CyuB3aVw.mjs → operator-DrwWItVt.mjs} +2 -2
  64. package/dist/{pai-marker-BcZyJguM.mjs → pai-marker-DLKJ9Yr5.mjs} +2 -2
  65. package/dist/{pane-audit-Lqy9N_Ki.mjs → pane-audit-wv9UkyCe.mjs} +8 -8
  66. package/dist/{paths-CFHTloSe.mjs → paths-DBd78I7Z.mjs} +3 -3
  67. package/dist/{paths-CHifubDh.mjs → paths-DS5VQKoR.mjs} +3 -3
  68. package/dist/{planner-j77ndkBf.mjs → planner-K0mFrCpL.mjs} +28 -28
  69. package/dist/{pool-Dh-q3iJi.mjs → pool-BZ94nFuq.mjs} +2 -2
  70. package/dist/{pool-cli-BggU8GRp.mjs → pool-cli-B1eKySeN.mjs} +5 -5
  71. package/dist/{pool-cli-DQ6OzRy2.mjs → pool-cli-BjYQDfx6.mjs} +6 -6
  72. package/dist/{postgres-DNIOQijl.mjs → postgres-C-T5OWer.mjs} +3 -3
  73. package/dist/{postgres-BK4FP9Zg.mjs → postgres-CBHY5PIi.mjs} +3 -3
  74. package/dist/{project-setup-CBRtFFh0.mjs → project-setup-pIPHZaXf.mjs} +24 -24
  75. package/dist/{providers-C9QC0TtO.mjs → providers-Dzx5GAUI.mjs} +6 -6
  76. package/dist/providers-QJzpaNhX.mjs +16 -0
  77. package/dist/{registrable-DpyTtajg.mjs → registrable-CXBBpUcz.mjs} +4 -4
  78. package/dist/registrable-Drn8wIDO.mjs +9 -0
  79. package/dist/render-C4KR8qQ8.mjs +13 -0
  80. package/dist/{render-C84BqQRC.mjs → render-Cz3BWIBO.mjs} +8 -8
  81. package/dist/root-Bfb1zgwE.mjs +36 -0
  82. package/dist/{root-C4oXlXS_.mjs → root-bG48WVpW.mjs} +10 -10
  83. package/dist/route-table-ZVMNBsy7.mjs +15 -0
  84. package/dist/{routing-DmkheCRH.mjs → routing-BlD_tKjW.mjs} +15 -15
  85. package/dist/{routing-f2zulGwD.mjs → routing-D27jxj9x.mjs} +13 -13
  86. package/dist/{run-BwZKBJZZ.mjs → run-AZVwceiU.mjs} +35 -27
  87. package/dist/{scan-BBGvU5EB.mjs → scan-C3uotg_f.mjs} +5 -5
  88. package/dist/{scope-D-h6F6DN.mjs → scope-D8HK6vU7.mjs} +4 -4
  89. package/dist/{session-Dn5OJXlg.mjs → session-BAfypQb9.mjs} +26 -26
  90. package/dist/session-BcnhepLZ.mjs +35 -0
  91. package/dist/{session-scan-DUn10MBd.mjs → session-scan-BmnjSReu.mjs} +5 -5
  92. package/dist/session-scan-CqUQdCac.mjs +9 -0
  93. package/dist/{session-usage-CPvXvSkw.mjs → session-usage-oycSdiD3.mjs} +117 -2
  94. package/dist/{status-ggJ7lgVg.mjs → status-COtzewKV.mjs} +3 -3
  95. package/dist/{status-Dm4dYciN.mjs → status-D_SWmOlH.mjs} +4 -4
  96. package/dist/{tool-errors-CJWODvlo.mjs → tool-errors-B2LnIqR0.mjs} +6 -6
  97. package/dist/{tool-errors-7E13StWd.mjs → tool-errors-DXJ70-sr.mjs} +2 -2
  98. package/dist/{viewer-wfKnvnrI.mjs → viewer-BgGRqXfD.mjs} +14 -14
  99. package/dist/viewer-CbGN2Ri4.mjs +22 -0
  100. package/dist/{wait-ByV0OyMZ.mjs → wait-ChpHKJZV.mjs} +3 -3
  101. package/dist/worker-config-D1KVAMp4.mjs +42 -0
  102. package/dist/{worker-config-eY5Qy4vl.mjs → worker-config-DgdT0iTB.mjs} +139 -33
  103. package/dist/workers-config-BhZBrR-Q.mjs +4 -0
  104. package/dist/{worktree-CRs2gyg0.mjs → worktree-BY--Rgmy.mjs} +5 -5
  105. package/dist/{zettelkasten-tpCRBYvH.mjs → zettelkasten-BHVx5zj-.mjs} +3 -3
  106. package/dist/{zettelkasten-_h_tUm2T.mjs → zettelkasten-LoH9RBiN.mjs} +2 -2
  107. package/docs/commands/README.md +1 -0
  108. package/docs/commands/config.md +20 -0
  109. package/gemini-extension.json +1 -1
  110. package/package.json +1 -1
  111. package/pai-plugin.json +1 -1
  112. package/plugins/context-preservation/plugin.json +1 -1
  113. package/plugins/core/plugin.json +1 -1
  114. package/plugins/creative/plugin.json +1 -1
  115. package/plugins/observability/plugin.json +1 -1
  116. package/plugins/productivity/plugin.json +1 -1
  117. package/plugins/semantic-search/plugin.json +1 -1
  118. package/plugins/ui/plugin.json +1 -1
  119. package/plugins/zettelkasten/plugin.json +1 -1
  120. package/dist/auto-route-C3S2W3Bc.mjs +0 -11
  121. package/dist/budget-BrloTOZW.mjs +0 -15
  122. package/dist/cockpit-memory-teG9M8bG.mjs +0 -20
  123. package/dist/config-Cxi-aBf4.mjs +0 -4
  124. package/dist/daemon-DeYImF1F.mjs +0 -45
  125. package/dist/detect-Rrimh0xc.mjs +0 -10
  126. package/dist/kill-tree-SV6hrIa3.mjs +0 -10
  127. package/dist/operator-BTqvTIc8.mjs +0 -7
  128. package/dist/providers-FvCLzFge.mjs +0 -16
  129. package/dist/registrable-BzH4TObg.mjs +0 -9
  130. package/dist/render-B35bQTE-.mjs +0 -13
  131. package/dist/root-DD1xx_Vu.mjs +0 -36
  132. package/dist/route-table-FEfDuhIV.mjs +0 -15
  133. package/dist/session-BAhtXdxj.mjs +0 -35
  134. package/dist/session-scan-B57dNuA4.mjs +0 -9
  135. package/dist/viewer-DEySE4c_.mjs +0 -22
  136. package/dist/worker-config-CO5FXLAT.mjs +0 -41
  137. package/dist/workers-config-f8KrkY4L.mjs +0 -4
@@ -8852,13 +8852,15 @@ __export(config_exports, {
8852
8852
  providerCostTier: () => providerCostTier,
8853
8853
  providerKeyPath: () => providerKeyPath,
8854
8854
  providerQuotaSkipAt: () => providerQuotaSkipAt,
8855
+ readWorkersCached: () => readWorkersCached,
8855
8856
  readWorkersSection: () => readWorkersSection,
8856
8857
  resolveCapability: () => resolveCapability,
8857
8858
  resolveModelCapability: () => resolveModelCapability,
8858
8859
  resolveProviderKey: () => resolveProviderKey,
8860
+ workersConfigStamp: () => workersConfigStamp,
8859
8861
  writeWorkersSection: () => writeWorkersSection
8860
8862
  });
8861
- import { existsSync as existsSync8, readFileSync as readFileSync8 } from "node:fs";
8863
+ import { existsSync as existsSync8, readFileSync as readFileSync8, statSync as statSync2 } from "node:fs";
8862
8864
  function nativeAnthropicModels() {
8863
8865
  const d = shippedWorkersDefaults();
8864
8866
  const providers = d.providers;
@@ -9742,6 +9744,22 @@ function readWorkersSection(path = paiConfigFilePath(), onWarn = (msg) => proces
9742
9744
  onWarn(`legacy routing migrated into the tier lists: ${[...folded, ...moved].join(", ")} (pai worker route)`);
9743
9745
  return { raw, workers };
9744
9746
  }
9747
+ function mtimeOf(path) {
9748
+ try {
9749
+ return statSync2(path).mtimeMs;
9750
+ } catch {
9751
+ return 0;
9752
+ }
9753
+ }
9754
+ function workersConfigStamp(path = paiConfigFilePath()) {
9755
+ return `${path}:${mtimeOf(path)}:${mtimeOf(workersYamlPath())}`;
9756
+ }
9757
+ function readWorkersCached(path = paiConfigFilePath()) {
9758
+ const key = workersConfigStamp(path);
9759
+ if (cachedWorkers?.key !== key) cachedWorkers = { key, workers: readWorkersSection(path, () => {
9760
+ }).workers };
9761
+ return cachedWorkers.workers;
9762
+ }
9745
9763
  function writeWorkersSection(raw, workers, path = CONFIG_FILE) {
9746
9764
  const yamlPath = workersYamlPath();
9747
9765
  const usingYaml = existsSync8(yamlPath);
@@ -9879,7 +9897,7 @@ function escalationCloud() {
9879
9897
  return DEFAULT_ESCALATE.cloud;
9880
9898
  }
9881
9899
  }
9882
- var ANTHROPIC_NATIVE, DEFAULT_POOL_PORT, MODEL_TIERS, DEFAULT_COST_TIER, PROVIDER_TAGS, WORKER_CLASSES, MODEL_CAPABILITIES, CAPABILITY_NAME_RE, WorkersConfigError;
9900
+ var ANTHROPIC_NATIVE, DEFAULT_POOL_PORT, MODEL_TIERS, DEFAULT_COST_TIER, PROVIDER_TAGS, WORKER_CLASSES, MODEL_CAPABILITIES, CAPABILITY_NAME_RE, WorkersConfigError, cachedWorkers;
9883
9901
  var init_config3 = __esm({
9884
9902
  "src/workers/config.ts"() {
9885
9903
  "use strict";
@@ -9919,6 +9937,7 @@ var init_config3 = __esm({
9919
9937
  CAPABILITY_NAME_RE = /^[a-z][a-z0-9-]*$/;
9920
9938
  WorkersConfigError = class extends Error {
9921
9939
  };
9940
+ cachedWorkers = null;
9922
9941
  }
9923
9942
  });
9924
9943
 
@@ -10104,7 +10123,7 @@ var init_input_side_tokens = __esm({
10104
10123
  });
10105
10124
 
10106
10125
  // src/workers/pool.ts
10107
- import { existsSync as existsSync11, mkdirSync as mkdirSync7, appendFileSync as appendFileSync2, readFileSync as readFileSync10, writeFileSync as writeFileSync6, statSync as statSync2, unlinkSync as unlinkSync3 } from "node:fs";
10126
+ import { existsSync as existsSync11, mkdirSync as mkdirSync7, appendFileSync as appendFileSync2, readFileSync as readFileSync10, writeFileSync as writeFileSync6, statSync as statSync3, unlinkSync as unlinkSync3 } from "node:fs";
10108
10127
  import { request as httpRequest } from "node:http";
10109
10128
  import { dirname as dirname9, join as join10 } from "node:path";
10110
10129
  function poolSettings(config) {
@@ -10149,7 +10168,7 @@ function clearReloadMarker(logDir2) {
10149
10168
  }
10150
10169
  function reloadInProgress(logDir2, maxAgeMs = 3e4) {
10151
10170
  try {
10152
- return Date.now() - statSync2(poolReloadMarkerPath(logDir2)).mtimeMs < maxAgeMs;
10171
+ return Date.now() - statSync3(poolReloadMarkerPath(logDir2)).mtimeMs < maxAgeMs;
10153
10172
  } catch {
10154
10173
  return false;
10155
10174
  }
@@ -10817,7 +10836,7 @@ var init_render_decision = __esm({
10817
10836
  // src/workers/preamble.ts
10818
10837
  import { execFileSync as execFileSync3 } from "node:child_process";
10819
10838
  import { createHash } from "node:crypto";
10820
- import { existsSync as existsSync12, readFileSync as readFileSync11, statSync as statSync3 } from "node:fs";
10839
+ import { existsSync as existsSync12, readFileSync as readFileSync11, statSync as statSync4 } from "node:fs";
10821
10840
  import { join as join11 } from "node:path";
10822
10841
  function projectRoot(cwd) {
10823
10842
  try {
@@ -10833,7 +10852,7 @@ function projectRoot(cwd) {
10833
10852
  function loadPreamble(cwd) {
10834
10853
  const path = join11(projectRoot(cwd), PREAMBLE_REL);
10835
10854
  if (!existsSync12(path)) return { preamble: null };
10836
- const size = statSync3(path).size;
10855
+ const size = statSync4(path).size;
10837
10856
  if (size > PREAMBLE_MAX_BYTES) {
10838
10857
  return { refused: `${path} is ${size} bytes, over the ${PREAMBLE_MAX_BYTES} byte limit \u2014 shorten it` };
10839
10858
  }
@@ -11022,7 +11041,7 @@ import {
11022
11041
  readdirSync as readdirSync2,
11023
11042
  renameSync as renameSync5,
11024
11043
  rmSync,
11025
- statSync as statSync4,
11044
+ statSync as statSync5,
11026
11045
  writeFileSync as writeFileSync7
11027
11046
  } from "node:fs";
11028
11047
  import { join as join13 } from "node:path";
@@ -11282,7 +11301,7 @@ var init_wait_on = __esm({
11282
11301
 
11283
11302
  // src/workers/report.ts
11284
11303
  import { execFileSync as execFileSync7 } from "node:child_process";
11285
- import { statSync as statSync5 } from "node:fs";
11304
+ import { statSync as statSync6 } from "node:fs";
11286
11305
  import { isAbsolute, relative, resolve as resolve4 } from "node:path";
11287
11306
  function ag2ReportBlock() {
11288
11307
  const spec = ag2Spec();
@@ -11449,7 +11468,7 @@ function verifyReportChanges(changed, cwd, startMs) {
11449
11468
  const abs = isAbsolute(raw) ? raw : resolve4(cwd, raw);
11450
11469
  let mtimeMs;
11451
11470
  try {
11452
- mtimeMs = statSync5(abs).mtimeMs;
11471
+ mtimeMs = statSync6(abs).mtimeMs;
11453
11472
  } catch {
11454
11473
  mtimeMs = null;
11455
11474
  }
@@ -11565,7 +11584,7 @@ var init_wait = __esm({
11565
11584
  });
11566
11585
 
11567
11586
  // src/workers/tool-errors.ts
11568
- import { appendFileSync as appendFileSync3, existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync14, statSync as statSync6, openSync, readSync, closeSync } from "node:fs";
11587
+ import { appendFileSync as appendFileSync3, existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync14, statSync as statSync7, openSync, readSync, closeSync } from "node:fs";
11569
11588
  import { join as join14 } from "node:path";
11570
11589
  function wrongCaseTool(raw) {
11571
11590
  const name = raw.match(/No such tool available:?\s*(\S+)/i)?.[1]?.replace(/[.,;:"'`]+$/, "");
@@ -11671,7 +11690,7 @@ function readToolErrors(logDir2, sinceMs = 0) {
11671
11690
  const path = toolErrorsPath(logDir2);
11672
11691
  if (!existsSync15(path)) return [];
11673
11692
  let text;
11674
- const size = statSync6(path).size;
11693
+ const size = statSync7(path).size;
11675
11694
  if (size > TAIL_BYTES) {
11676
11695
  const fd = openSync(path, "r");
11677
11696
  const buf = Buffer.alloc(TAIL_BYTES);
@@ -11992,7 +12011,7 @@ var init_config4 = __esm({
11992
12011
  });
11993
12012
 
11994
12013
  // src/builds/queue.ts
11995
- import { existsSync as existsSync17, mkdirSync as mkdirSync10, readdirSync as readdirSync4, readFileSync as readFileSync16, renameSync as renameSync6, rmSync as rmSync2, rmdirSync, statSync as statSync7, writeFileSync as writeFileSync8 } from "node:fs";
12014
+ import { existsSync as existsSync17, mkdirSync as mkdirSync10, readdirSync as readdirSync4, readFileSync as readFileSync16, renameSync as renameSync6, rmSync as rmSync2, rmdirSync, statSync as statSync8, writeFileSync as writeFileSync8 } from "node:fs";
11996
12015
  import { join as join16 } from "node:path";
11997
12016
  function buildsDir(env = process.env) {
11998
12017
  if (env.PAI_BUILD_DIR) return env.PAI_BUILD_DIR;
@@ -12004,13 +12023,13 @@ function breakStaleMutex(m, staleMs = 5e3) {
12004
12023
  mkdirSync10(guard);
12005
12024
  } catch {
12006
12025
  try {
12007
- if (Date.now() - statSync7(guard).mtimeMs > staleMs) rmdirSync(guard);
12026
+ if (Date.now() - statSync8(guard).mtimeMs > staleMs) rmdirSync(guard);
12008
12027
  } catch {
12009
12028
  }
12010
12029
  return;
12011
12030
  }
12012
12031
  try {
12013
- if (Date.now() - statSync7(m).mtimeMs > staleMs) rmdirSync(m);
12032
+ if (Date.now() - statSync8(m).mtimeMs > staleMs) rmdirSync(m);
12014
12033
  } catch {
12015
12034
  } finally {
12016
12035
  try {
@@ -12349,7 +12368,8 @@ function queuedText(q) {
12349
12368
  async function capacityGate(o) {
12350
12369
  const cfg = capacityOf(o.config);
12351
12370
  if (o.disabled || !cfg.enabled || o.cap === void 0 || o.cap <= 0) return null;
12352
- const { logDir: logDir2, self, cap } = o;
12371
+ const { logDir: logDir2, self } = o;
12372
+ let cap = o.cap;
12353
12373
  const load2 = o.load ?? ((dir2) => (reconcileStatuses(dir2, /* @__PURE__ */ new Date(), 0), loadStatuses(dir2)));
12354
12374
  const now = o.now ?? Date.now;
12355
12375
  const isAlive = o.isAlive ?? alive;
@@ -12398,6 +12418,8 @@ async function capacityGate(o) {
12398
12418
  o.onWait?.(info());
12399
12419
  for (let n = 0; ; n++) {
12400
12420
  await sleep(backoffMs(n));
12421
+ const fresh = o.capOf?.();
12422
+ if (fresh !== void 0 && fresh > 0) cap = fresh;
12401
12423
  c = check();
12402
12424
  if (c.position === 1 && c.holding < cap) break;
12403
12425
  o.onWait?.(info());
@@ -20438,7 +20460,7 @@ var init_retry = __esm({
20438
20460
  });
20439
20461
 
20440
20462
  // src/memory/indexer/async.ts
20441
- import { readFileSync as readFileSync29, statSync as statSync8, existsSync as existsSync29 } from "node:fs";
20463
+ import { readFileSync as readFileSync29, statSync as statSync9, existsSync as existsSync29 } from "node:fs";
20442
20464
  import { join as join26, relative as relative2, basename as basename4 } from "node:path";
20443
20465
  async function indexFileWithBackend(backend, projectId, rootPath, relativePath, source, tier, pathPrefix = "") {
20444
20466
  const absPath = join26(rootPath, relativePath);
@@ -20447,7 +20469,7 @@ async function indexFileWithBackend(backend, projectId, rootPath, relativePath,
20447
20469
  let stat;
20448
20470
  try {
20449
20471
  content = readFileSync29(absPath, "utf8");
20450
- stat = statSync8(absPath);
20472
+ stat = statSync9(absPath);
20451
20473
  } catch {
20452
20474
  return false;
20453
20475
  }
@@ -23325,7 +23347,7 @@ var init_federation_db = __esm({
23325
23347
  });
23326
23348
 
23327
23349
  // src/storage/sqlite/indexer.ts
23328
- import { readFileSync as readFileSync31, statSync as statSync9, existsSync as existsSync30 } from "node:fs";
23350
+ import { readFileSync as readFileSync31, statSync as statSync10, existsSync as existsSync30 } from "node:fs";
23329
23351
  import { join as join28, relative as relative3, basename as basename5 } from "node:path";
23330
23352
  function indexFile(db, projectId, rootPath, relativePath, source, tier) {
23331
23353
  const absPath = join28(rootPath, relativePath);
@@ -23333,7 +23355,7 @@ function indexFile(db, projectId, rootPath, relativePath, source, tier) {
23333
23355
  let stat;
23334
23356
  try {
23335
23357
  content = readFileSync31(absPath, "utf8");
23336
- stat = statSync9(absPath);
23358
+ stat = statSync10(absPath);
23337
23359
  } catch {
23338
23360
  return false;
23339
23361
  }
@@ -26649,7 +26671,7 @@ var init_detect = __esm({
26649
26671
 
26650
26672
  // src/cli/lib/utils.ts
26651
26673
  import { resolve as resolve6, basename as basename6, join as join30 } from "node:path";
26652
- import { mkdirSync as mkdirSync21, existsSync as existsSync31, writeFileSync as writeFileSync18, readdirSync as readdirSync8, statSync as statSync10 } from "node:fs";
26674
+ import { mkdirSync as mkdirSync21, existsSync as existsSync31, writeFileSync as writeFileSync18, readdirSync as readdirSync8, statSync as statSync11 } from "node:fs";
26653
26675
  function encIndex(entries) {
26654
26676
  let idx = indexes.get(entries);
26655
26677
  if (!idx) {
@@ -26698,7 +26720,7 @@ function smartDecodeDir(encoded, listings) {
26698
26720
  return nextPath;
26699
26721
  }
26700
26722
  try {
26701
- if (statSync10(nextPath).isDirectory()) {
26723
+ if (statSync11(nextPath).isDirectory()) {
26702
26724
  current2 = nextPath;
26703
26725
  remaining = nextRemaining;
26704
26726
  matched = true;
@@ -26796,7 +26818,7 @@ __export(session_scan_exports, {
26796
26818
  });
26797
26819
  import {
26798
26820
  readdirSync as readdirSync10,
26799
- statSync as statSync11,
26821
+ statSync as statSync12,
26800
26822
  readFileSync as readFileSync33,
26801
26823
  openSync as openSync3,
26802
26824
  readSync as readSync3,
@@ -26903,7 +26925,7 @@ function flushScanCache(prune) {
26903
26925
  function parseTopLevel(filePath) {
26904
26926
  let st;
26905
26927
  try {
26906
- st = statSync11(filePath);
26928
+ st = statSync12(filePath);
26907
26929
  } catch {
26908
26930
  return { systemLines: 0, size: 0, mtime: 0 };
26909
26931
  }
@@ -26975,7 +26997,7 @@ function resolveFriendlyName(p) {
26975
26997
  function parseTranscript(filePath) {
26976
26998
  let mtime = 0;
26977
26999
  try {
26978
- const st = statSync11(filePath);
27000
+ const st = statSync12(filePath);
26979
27001
  mtime = st.mtimeMs;
26980
27002
  const hit = loadScanCache().tr[filePath];
26981
27003
  if (hit && hit.m === st.mtimeMs && hit.s === st.size) {
@@ -27071,7 +27093,7 @@ async function scanSessions(opts = {}) {
27071
27093
  for (const encodedDir of encodedDirs) {
27072
27094
  const projectDir = join32(CLAUDE_PROJECTS_DIR, encodedDir);
27073
27095
  try {
27074
- if (!statSync11(projectDir).isDirectory()) continue;
27096
+ if (!statSync12(projectDir).isDirectory()) continue;
27075
27097
  } catch {
27076
27098
  continue;
27077
27099
  }
@@ -27333,7 +27355,7 @@ function scanFilesystemForUuidPrefix(prefix) {
27333
27355
  for (const encodedDir of encodedDirs) {
27334
27356
  const projectDir = join32(CLAUDE_PROJECTS_DIR, encodedDir);
27335
27357
  try {
27336
- if (!statSync11(projectDir).isDirectory()) continue;
27358
+ if (!statSync12(projectDir).isDirectory()) continue;
27337
27359
  } catch {
27338
27360
  continue;
27339
27361
  }
@@ -27762,7 +27784,7 @@ var init_router2 = __esm({
27762
27784
  });
27763
27785
 
27764
27786
  // src/workers/settings-file.ts
27765
- import { chmodSync as chmodSync5, existsSync as existsSync34, mkdirSync as mkdirSync23, readdirSync as readdirSync11, rmSync as rmSync6, statSync as statSync12, writeFileSync as writeFileSync21 } from "node:fs";
27787
+ import { chmodSync as chmodSync5, existsSync as existsSync34, mkdirSync as mkdirSync23, readdirSync as readdirSync11, rmSync as rmSync6, statSync as statSync13, writeFileSync as writeFileSync21 } from "node:fs";
27766
27788
  import { join as join34 } from "node:path";
27767
27789
  import { createHash as createHash5 } from "node:crypto";
27768
27790
  function writePrivateFile(path, text) {
@@ -27807,7 +27829,7 @@ var init_settings_file = __esm({
27807
27829
  });
27808
27830
 
27809
27831
  // src/workers/run-env.ts
27810
- import { chmodSync as chmodSync6, existsSync as existsSync35, mkdirSync as mkdirSync24, mkdtempSync, readdirSync as readdirSync12, readFileSync as readFileSync35, rmSync as rmSync7, statSync as statSync13, writeFileSync as writeFileSync22 } from "node:fs";
27832
+ import { chmodSync as chmodSync6, existsSync as existsSync35, mkdirSync as mkdirSync24, mkdtempSync, readdirSync as readdirSync12, readFileSync as readFileSync35, rmSync as rmSync7, statSync as statSync14, writeFileSync as writeFileSync22 } from "node:fs";
27811
27833
  import { tmpdir } from "node:os";
27812
27834
  import { delimiter, join as join35 } from "node:path";
27813
27835
  function workerShell(env) {
@@ -27822,7 +27844,7 @@ function pinWorkersYamlCopy(env, root = WORKER_CONFIG_COPY_ROOT) {
27822
27844
  for (const d of readdirSync12(root)) {
27823
27845
  const dp = join35(root, d);
27824
27846
  try {
27825
- if (Date.now() - statSync13(dp).mtimeMs > COPY_MAX_AGE_MS) rmSync7(dp, { recursive: true, force: true });
27847
+ if (Date.now() - statSync14(dp).mtimeMs > COPY_MAX_AGE_MS) rmSync7(dp, { recursive: true, force: true });
27826
27848
  } catch {
27827
27849
  }
27828
27850
  }
@@ -28656,7 +28678,7 @@ var init_scratch = __esm({
28656
28678
  });
28657
28679
 
28658
28680
  // src/workers/pending.ts
28659
- import { existsSync as existsSync43, readFileSync as readFileSync42, statSync as statSync14 } from "node:fs";
28681
+ import { existsSync as existsSync43, readFileSync as readFileSync42, statSync as statSync15 } from "node:fs";
28660
28682
  import { join as join42 } from "node:path";
28661
28683
  function invalidatePendingCache(logDir2, repoRoot) {
28662
28684
  const file = join42(logDir2, "pending-cache.json");
@@ -28693,7 +28715,7 @@ var init_pending = __esm({
28693
28715
 
28694
28716
  // src/workers/worktree.ts
28695
28717
  import { execFile as execFile2, execFileSync as execFileSync11, spawnSync as spawnSync3 } from "node:child_process";
28696
- import { existsSync as existsSync44, lstatSync, mkdirSync as mkdirSync28, readFileSync as readFileSync43, mkdtempSync as mkdtempSync2, writeFileSync as writeFileSync23, readdirSync as readdirSync13, readlinkSync, realpathSync as realpathSync2, rmSync as rmSync9, statSync as statSync15 } from "node:fs";
28718
+ import { existsSync as existsSync44, lstatSync, mkdirSync as mkdirSync28, readFileSync as readFileSync43, mkdtempSync as mkdtempSync2, writeFileSync as writeFileSync23, readdirSync as readdirSync13, readlinkSync, realpathSync as realpathSync2, rmSync as rmSync9, statSync as statSync16 } from "node:fs";
28697
28719
  import { basename as basename8, dirname as dirname22, isAbsolute as isAbsolute2, join as join43, resolve as resolve7, sep as sep2 } from "node:path";
28698
28720
  import { tmpdir as tmpdir3, platform } from "node:os";
28699
28721
  function isSlotWorktree(dir) {
@@ -29959,7 +29981,7 @@ function gcWorktrees(logDir2, olderThanHours = 24, dryRun = false, now = Date.no
29959
29981
  if (!tree || !existsSync44(tree.dir) || isLive(st) || isSlotWorktree(tree.dir) || landed.has(realpathOr(tree.dir))) continue;
29960
29982
  let end = 0;
29961
29983
  try {
29962
- end = Math.floor(statSync15(statusPath(logDir2, st.id)).mtimeMs);
29984
+ end = Math.floor(statSync16(statusPath(logDir2, st.id)).mtimeMs);
29963
29985
  } catch {
29964
29986
  continue;
29965
29987
  }
@@ -29995,7 +30017,7 @@ function gcWorktrees(logDir2, olderThanHours = 24, dryRun = false, now = Date.no
29995
30017
  if (!tree || st.merged || st.archived || isLive(st) || !isSlotWorktree(tree.dir)) continue;
29996
30018
  let end = 0;
29997
30019
  try {
29998
- end = Math.floor(statSync15(statusPath(logDir2, st.id)).mtimeMs);
30020
+ end = Math.floor(statSync16(statusPath(logDir2, st.id)).mtimeMs);
29999
30021
  } catch {
30000
30022
  continue;
30001
30023
  }
@@ -30007,7 +30029,7 @@ function gcWorktrees(logDir2, olderThanHours = 24, dryRun = false, now = Date.no
30007
30029
  const dir = join43(root, ent.name);
30008
30030
  if (!ent.isDirectory() || owned.has(resolve7(dir)) || isSlotWorktree(dir) || ent.name.startsWith("spare-") || landed.has(realpathOr(dir))) continue;
30009
30031
  try {
30010
- if (Math.floor(statSync15(dir).mtimeMs) > cutoff) continue;
30032
+ if (Math.floor(statSync16(dir).mtimeMs) > cutoff) continue;
30011
30033
  } catch {
30012
30034
  continue;
30013
30035
  }
@@ -30036,7 +30058,7 @@ function gcWorktrees(logDir2, olderThanHours = 24, dryRun = false, now = Date.no
30036
30058
  function gcWorktreesThrottled(logDir2, everyMin = 60, now = Date.now(), opts = {}) {
30037
30059
  const stamp = join43(logDir2, GC_STAMP);
30038
30060
  try {
30039
- if (now - statSync15(stamp).mtimeMs < everyMin * 6e4) return null;
30061
+ if (now - statSync16(stamp).mtimeMs < everyMin * 6e4) return null;
30040
30062
  } catch {
30041
30063
  }
30042
30064
  mkdirSync28(logDir2, { recursive: true });
@@ -30608,7 +30630,7 @@ var init_reap = __esm({
30608
30630
  });
30609
30631
 
30610
30632
  // src/workers/active-time.ts
30611
- import { mkdirSync as mkdirSync29, readFileSync as readFileSync45, statSync as statSync16, writeFileSync as writeFileSync24 } from "node:fs";
30633
+ import { mkdirSync as mkdirSync29, readFileSync as readFileSync45, statSync as statSync17, writeFileSync as writeFileSync24 } from "node:fs";
30612
30634
  import { join as join46 } from "node:path";
30613
30635
  function read(logDir2, id) {
30614
30636
  try {
@@ -30625,7 +30647,7 @@ function buildWaitMs(logDir2, id, now = Date.now()) {
30625
30647
  function routerAcct(logDir2, id) {
30626
30648
  const p = join46(logDir2, "router-sched.json");
30627
30649
  try {
30628
- const mtimeMs = statSync16(p).mtimeMs;
30650
+ const mtimeMs = statSync17(p).mtimeMs;
30629
30651
  let c = schedCache.get(p);
30630
30652
  if (!c || c.mtimeMs !== mtimeMs) {
30631
30653
  const j = JSON.parse(readFileSync45(p, "utf8"));
@@ -34123,7 +34145,7 @@ var init_local_idle = __esm({
34123
34145
  });
34124
34146
 
34125
34147
  // src/workers/pool-host-run.ts
34126
- import { existsSync as existsSync51, mkdirSync as mkdirSync36, openSync as openSync5, renameSync as renameSync19, statSync as statSync17 } from "node:fs";
34148
+ import { existsSync as existsSync51, mkdirSync as mkdirSync36, openSync as openSync5, renameSync as renameSync19, statSync as statSync18 } from "node:fs";
34127
34149
  import { join as join51 } from "node:path";
34128
34150
  function poolHostLogPath(logDir2) {
34129
34151
  return join51(poolDir(logDir2), "host.log");
@@ -34132,7 +34154,7 @@ function openHostLog(logDir2, capBytes = LOG_CAP_BYTES) {
34132
34154
  mkdirSync36(poolDir(logDir2), { recursive: true });
34133
34155
  const path = poolHostLogPath(logDir2);
34134
34156
  try {
34135
- if (existsSync51(path) && statSync17(path).size > capBytes) renameSync19(path, `${path}.1`);
34157
+ if (existsSync51(path) && statSync18(path).size > capBytes) renameSync19(path, `${path}.1`);
34136
34158
  } catch {
34137
34159
  }
34138
34160
  return openSync5(path, "a");
@@ -34186,7 +34208,7 @@ var init_pool_host_run = __esm({
34186
34208
 
34187
34209
  // src/workers/pool-cli.ts
34188
34210
  import { spawn as spawn7 } from "node:child_process";
34189
- import { closeSync as closeSync4, existsSync as existsSync52, mkdirSync as mkdirSync37, statSync as statSync18, unlinkSync as unlinkSync11, writeFileSync as writeFileSync31, readFileSync as readFileSync52 } from "node:fs";
34211
+ import { closeSync as closeSync4, existsSync as existsSync52, mkdirSync as mkdirSync37, statSync as statSync19, unlinkSync as unlinkSync11, writeFileSync as writeFileSync31, readFileSync as readFileSync52 } from "node:fs";
34190
34212
  import { dirname as dirname26, join as join52 } from "node:path";
34191
34213
  import { fileURLToPath as fileURLToPath5 } from "node:url";
34192
34214
  function standalonePoolHostPath() {
@@ -34475,6 +34497,15 @@ async function runGates(a, wid, status) {
34475
34497
  logDir: logDir2,
34476
34498
  self: { id: wid, provider: target.providerName },
34477
34499
  cap: admitCap(target.provider.maxConcurrent, target.provider.conversationSlots, isLocalProvider(target.provider.baseUrl)),
34500
+ // a saved config change reaches a run that is already waiting
34501
+ capOf: () => {
34502
+ try {
34503
+ const p = readWorkersCached().providers[target.providerName] ?? target.provider;
34504
+ return admitCap(p.maxConcurrent, p.conversationSlots, isLocalProvider(p.baseUrl), capacityOf(config.capacity));
34505
+ } catch {
34506
+ return void 0;
34507
+ }
34508
+ },
34478
34509
  config: config.capacity,
34479
34510
  disabled: a.noQueue,
34480
34511
  priority: a.priority,
@@ -36320,7 +36351,7 @@ import { createServer as createServer3 } from "node:http";
36320
36351
  import { spawn as spawn9 } from "node:child_process";
36321
36352
  import { basename as basename9, dirname as dirname28, join as join57 } from "node:path";
36322
36353
  import { createInterface as createInterface3 } from "node:readline";
36323
- import { openSync as openSync8, closeSync as closeSync7, writeSync as writeSync3, mkdirSync as mkdirSync41, statSync as statSync19, readSync as readSync4, readFileSync as readFileSync55, existsSync as existsSync56, rmSync as rmSync11 } from "node:fs";
36354
+ import { openSync as openSync8, closeSync as closeSync7, writeSync as writeSync3, mkdirSync as mkdirSync41, statSync as statSync20, readSync as readSync4, readFileSync as readFileSync55, existsSync as existsSync56, rmSync as rmSync11 } from "node:fs";
36324
36355
 
36325
36356
  // src/workers/slots.ts
36326
36357
  init_pai_home();
@@ -36593,7 +36624,7 @@ var PoolSlotSession = class {
36593
36624
  };
36594
36625
  function routerUsageTail(file) {
36595
36626
  try {
36596
- const size = statSync19(file).size;
36627
+ const size = statSync20(file).size;
36597
36628
  const len = Math.min(size, 4e5);
36598
36629
  const buf = Buffer.alloc(len);
36599
36630
  const fd = openSync8(file, "r");
@@ -36634,7 +36665,27 @@ function sendJson(res, status, body) {
36634
36665
  function createPoolHost(opts = {}) {
36635
36666
  const { workers: config } = opts.config ? { workers: opts.config } : readWorkersSection();
36636
36667
  const logDir2 = opts.logDir ?? workersLogDir(config);
36637
- const settings = poolSettings(config);
36668
+ let settings = poolSettings(config);
36669
+ const configStamp = opts.configStamp ?? (opts.config ? null : () => workersConfigStamp());
36670
+ const readConfig = opts.readConfig ?? (() => readWorkersSection(void 0, () => {
36671
+ }).workers);
36672
+ let seenStamp = configStamp ? configStamp() : "";
36673
+ let lastStampCheck = 0;
36674
+ const reloadSettings = (force = false) => {
36675
+ if (!configStamp) return false;
36676
+ const t = now().getTime();
36677
+ if (!force && t - lastStampCheck < 5e3) return false;
36678
+ lastStampCheck = t;
36679
+ const stamp = configStamp();
36680
+ if (stamp === seenStamp) return false;
36681
+ seenStamp = stamp;
36682
+ try {
36683
+ settings = poolSettings(readConfig());
36684
+ return true;
36685
+ } catch {
36686
+ return false;
36687
+ }
36688
+ };
36638
36689
  const port2 = opts.port ?? poolPort(config);
36639
36690
  const spawner = opts.spawner ?? realSpawner;
36640
36691
  const routerOn = opts.routerEnabled ?? loadConfig().router.enabled;
@@ -36661,7 +36712,7 @@ function createPoolHost(opts = {}) {
36661
36712
  };
36662
36713
  const fileMtime = opts.fileMtime ?? ((p) => {
36663
36714
  try {
36664
- return statSync19(p).mtimeMs;
36715
+ return statSync20(p).mtimeMs;
36665
36716
  } catch {
36666
36717
  return null;
36667
36718
  }
@@ -36777,6 +36828,7 @@ function createPoolHost(opts = {}) {
36777
36828
  };
36778
36829
  const acquire = async (providerName, provider, model, cwd, shared) => {
36779
36830
  const key = slotKey(providerName, model, cwd);
36831
+ reloadSettings();
36780
36832
  reapSlots();
36781
36833
  const pick = pickSlot(
36782
36834
  [...slots.values()].map((s) => s.record),
@@ -36797,6 +36849,7 @@ function createPoolHost(opts = {}) {
36797
36849
  };
36798
36850
  const claimed = /* @__PURE__ */ new Set();
36799
36851
  const acquireSlotWorktree = async (providerName, provider, model, repo, wid, shared) => {
36852
+ reloadSettings();
36800
36853
  for (let n = 1; n <= settings.maxSlots; n++) {
36801
36854
  if (!slotServesRepo(logDir2, providerName, n, repo)) continue;
36802
36855
  const dir = slotPath(logDir2, providerName, n);
@@ -37393,6 +37446,7 @@ function createPoolHost(opts = {}) {
37393
37446
  await new Promise((resolve12) => server.close(() => resolve12()));
37394
37447
  };
37395
37448
  const reapSlots = () => {
37449
+ reloadSettings();
37396
37450
  let n = 0;
37397
37451
  for (const [k, s] of slots) {
37398
37452
  if (slotShouldReap(s.record, now().getTime(), settings.idleSecs)) {
@@ -37467,11 +37521,15 @@ function createPoolHost(opts = {}) {
37467
37521
  const timer = setInterval(() => void checkReload(), 3e4);
37468
37522
  timer.unref?.();
37469
37523
  }
37470
- if (!opts.noReaper && settings.idleSecs > 0) {
37524
+ if (!opts.noReaper) {
37525
+ const timer = setInterval(() => reloadSettings(), 5e3);
37526
+ timer.unref?.();
37527
+ }
37528
+ if (!opts.noReaper) {
37471
37529
  const timer = setInterval(reapSlots, 3e4);
37472
37530
  timer.unref?.();
37473
37531
  }
37474
- if (!opts.noReaper && settings.idleKillSec > 0) {
37532
+ if (!opts.noReaper) {
37475
37533
  const timer = setInterval(() => {
37476
37534
  reapSpares();
37477
37535
  refreshSpares();
@@ -37527,6 +37585,8 @@ function createPoolHost(opts = {}) {
37527
37585
  runTask,
37528
37586
  shutdown,
37529
37587
  reapSlots,
37588
+ settings: () => settings,
37589
+ reloadSettings,
37530
37590
  reapSpares,
37531
37591
  refreshSpares,
37532
37592
  checkReload,
@@ -7408,7 +7408,7 @@ function parseEscalate(v, bad2) {
7408
7408
  }
7409
7409
 
7410
7410
  // src/workers/config.ts
7411
- import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
7411
+ import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
7412
7412
 
7413
7413
  // src/daemon/config.ts
7414
7414
  import { homedir as homedir2, userInfo } from "node:os";
@@ -8322,7 +8322,7 @@ var init_loopback = __esm({
8322
8322
  });
8323
8323
 
8324
8324
  // src/workers/config.ts
8325
- import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
8325
+ import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
8326
8326
  function nativeAnthropicModels() {
8327
8327
  const d = shippedWorkersDefaults();
8328
8328
  const providers = d.providers;
@@ -9452,7 +9452,7 @@ import {
9452
9452
  readdirSync as readdirSync2,
9453
9453
  renameSync as renameSync4,
9454
9454
  rmSync,
9455
- statSync as statSync2,
9455
+ statSync as statSync3,
9456
9456
  writeFileSync as writeFileSync3
9457
9457
  } from "node:fs";
9458
9458
  import { join as join8 } from "node:path";
@@ -9763,7 +9763,7 @@ var init_pool = __esm({
9763
9763
 
9764
9764
  // src/workers/worktree.ts
9765
9765
  import { execFile, execFileSync as execFileSync5, spawnSync as spawnSync2 } from "node:child_process";
9766
- import { existsSync as existsSync10, lstatSync, mkdirSync as mkdirSync6, readFileSync as readFileSync10, mkdtempSync, writeFileSync as writeFileSync6, readdirSync as readdirSync3, readlinkSync, realpathSync, rmSync as rmSync3, statSync as statSync3 } from "node:fs";
9766
+ import { existsSync as existsSync10, lstatSync, mkdirSync as mkdirSync6, readFileSync as readFileSync10, mkdtempSync, writeFileSync as writeFileSync6, readdirSync as readdirSync3, readlinkSync, realpathSync, rmSync as rmSync3, statSync as statSync4 } from "node:fs";
9767
9767
  function runGit(cwd2, args, env, timeout = 3e4) {
9768
9768
  try {
9769
9769
  return execFileSync5("git", ["-C", cwd2, ...args], {
@@ -9832,7 +9832,7 @@ var init_fmt_age = __esm({
9832
9832
  });
9833
9833
 
9834
9834
  // src/workers/pending.ts
9835
- import { existsSync as existsSync11, readFileSync as readFileSync11, statSync as statSync4 } from "node:fs";
9835
+ import { existsSync as existsSync11, readFileSync as readFileSync11, statSync as statSync5 } from "node:fs";
9836
9836
  import { join as join10 } from "node:path";
9837
9837
  function toplevel(dir) {
9838
9838
  try {
@@ -9864,7 +9864,7 @@ function pendingResults(logDir, repoRoot, now = Date.now()) {
9864
9864
  if (!commits && !dirty) continue;
9865
9865
  let ageMs = 0;
9866
9866
  try {
9867
- ageMs = Math.max(0, now - statSync4(statusPath(logDir, st.id)).mtimeMs);
9867
+ ageMs = Math.max(0, now - statSync5(statusPath(logDir, st.id)).mtimeMs);
9868
9868
  } catch {
9869
9869
  }
9870
9870
  out.push({ id: st.id, label: st.label, repo, ageMs, age: fmtAge(ageMs, { dayAfterHours: 48 }), commits, dirty });
@@ -17545,7 +17545,7 @@ var init_retry = __esm({
17545
17545
  });
17546
17546
 
17547
17547
  // src/memory/indexer/async.ts
17548
- import { readFileSync as readFileSync15, statSync as statSync5, existsSync as existsSync16 } from "node:fs";
17548
+ import { readFileSync as readFileSync15, statSync as statSync6, existsSync as existsSync16 } from "node:fs";
17549
17549
  import { join as join14, relative, basename as basename4 } from "node:path";
17550
17550
  async function indexFileWithBackend(backend, projectId, rootPath, relativePath, source, tier, pathPrefix = "") {
17551
17551
  const absPath = join14(rootPath, relativePath);
@@ -17554,7 +17554,7 @@ async function indexFileWithBackend(backend, projectId, rootPath, relativePath,
17554
17554
  let stat;
17555
17555
  try {
17556
17556
  content = readFileSync15(absPath, "utf8");
17557
- stat = statSync5(absPath);
17557
+ stat = statSync6(absPath);
17558
17558
  } catch {
17559
17559
  return false;
17560
17560
  }
@@ -20432,7 +20432,7 @@ var init_federation_db = __esm({
20432
20432
  });
20433
20433
 
20434
20434
  // src/storage/sqlite/indexer.ts
20435
- import { readFileSync as readFileSync17, statSync as statSync6, existsSync as existsSync17 } from "node:fs";
20435
+ import { readFileSync as readFileSync17, statSync as statSync7, existsSync as existsSync17 } from "node:fs";
20436
20436
  import { join as join16, relative as relative2, basename as basename5 } from "node:path";
20437
20437
  function indexFile(db, projectId, rootPath, relativePath, source, tier) {
20438
20438
  const absPath = join16(rootPath, relativePath);
@@ -20440,7 +20440,7 @@ function indexFile(db, projectId, rootPath, relativePath, source, tier) {
20440
20440
  let stat;
20441
20441
  try {
20442
20442
  content = readFileSync17(absPath, "utf8");
20443
- stat = statSync6(absPath);
20443
+ stat = statSync7(absPath);
20444
20444
  } catch {
20445
20445
  return false;
20446
20446
  }
@@ -23756,7 +23756,7 @@ var init_detect = __esm({
23756
23756
 
23757
23757
  // src/cli/lib/utils.ts
23758
23758
  import { resolve as resolve3, basename as basename6, join as join18 } from "node:path";
23759
- import { mkdirSync as mkdirSync11, existsSync as existsSync18, writeFileSync as writeFileSync9, readdirSync as readdirSync6, statSync as statSync7 } from "node:fs";
23759
+ import { mkdirSync as mkdirSync11, existsSync as existsSync18, writeFileSync as writeFileSync9, readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
23760
23760
  function encIndex(entries) {
23761
23761
  let idx = indexes.get(entries);
23762
23762
  if (!idx) {
@@ -23805,7 +23805,7 @@ function smartDecodeDir(encoded, listings) {
23805
23805
  return nextPath;
23806
23806
  }
23807
23807
  try {
23808
- if (statSync7(nextPath).isDirectory()) {
23808
+ if (statSync8(nextPath).isDirectory()) {
23809
23809
  current2 = nextPath;
23810
23810
  remaining = nextRemaining;
23811
23811
  matched = true;
@@ -23888,7 +23888,7 @@ __export(session_scan_exports, {
23888
23888
  });
23889
23889
  import {
23890
23890
  readdirSync as readdirSync8,
23891
- statSync as statSync8,
23891
+ statSync as statSync9,
23892
23892
  readFileSync as readFileSync19,
23893
23893
  openSync as openSync2,
23894
23894
  readSync,
@@ -23995,7 +23995,7 @@ function flushScanCache(prune) {
23995
23995
  function parseTopLevel(filePath) {
23996
23996
  let st;
23997
23997
  try {
23998
- st = statSync8(filePath);
23998
+ st = statSync9(filePath);
23999
23999
  } catch {
24000
24000
  return { systemLines: 0, size: 0, mtime: 0 };
24001
24001
  }
@@ -24067,7 +24067,7 @@ function resolveFriendlyName(p) {
24067
24067
  function parseTranscript(filePath) {
24068
24068
  let mtime = 0;
24069
24069
  try {
24070
- const st = statSync8(filePath);
24070
+ const st = statSync9(filePath);
24071
24071
  mtime = st.mtimeMs;
24072
24072
  const hit = loadScanCache().tr[filePath];
24073
24073
  if (hit && hit.m === st.mtimeMs && hit.s === st.size) {
@@ -24163,7 +24163,7 @@ async function scanSessions(opts = {}) {
24163
24163
  for (const encodedDir of encodedDirs) {
24164
24164
  const projectDir = join20(CLAUDE_PROJECTS_DIR, encodedDir);
24165
24165
  try {
24166
- if (!statSync8(projectDir).isDirectory()) continue;
24166
+ if (!statSync9(projectDir).isDirectory()) continue;
24167
24167
  } catch {
24168
24168
  continue;
24169
24169
  }
@@ -24425,7 +24425,7 @@ function scanFilesystemForUuidPrefix(prefix) {
24425
24425
  for (const encodedDir of encodedDirs) {
24426
24426
  const projectDir = join20(CLAUDE_PROJECTS_DIR, encodedDir);
24427
24427
  try {
24428
- if (!statSync8(projectDir).isDirectory()) continue;
24428
+ if (!statSync9(projectDir).isDirectory()) continue;
24429
24429
  } catch {
24430
24430
  continue;
24431
24431
  }
@@ -7415,7 +7415,7 @@ function parseEscalate(v, bad2) {
7415
7415
  }
7416
7416
 
7417
7417
  // src/workers/config.ts
7418
- import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
7418
+ import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
7419
7419
 
7420
7420
  // src/daemon/config.ts
7421
7421
  import { homedir as homedir2, userInfo } from "node:os";