@tekmidian/pai 1.0.0 → 1.0.2

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 (218) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +67 -5
  3. package/dist/aibroker-client-BxzeEHPF.mjs +3 -0
  4. package/dist/{aibroker-client-CXEYBzbf.mjs → aibroker-client-CQPGqLxL.mjs} +1 -1
  5. package/dist/atomic-file-BorMa4T3.mjs +21 -0
  6. package/dist/{auto-route-D5SXrMpB.mjs → auto-route-B4azPk4l.mjs} +3 -3
  7. package/dist/auto-route-BjoMHKyI.mjs +11 -0
  8. package/dist/budget-Dod6rnA9.mjs +15 -0
  9. package/dist/{caller-identity-CVTuiLSs.mjs → caller-identity-yLFb7CKq.mjs} +6 -5
  10. package/dist/{capacity-DaXrVj3J.mjs → capacity-DEveQdFV.mjs} +3 -3
  11. package/dist/{chain-BcQlIlEd.mjs → chain-D-yvET_y.mjs} +5 -5
  12. package/dist/cli/index.mjs +1621 -357
  13. package/dist/cockpit-actions-BWunx3rY.mjs +20 -0
  14. package/dist/{cockpit-actions-ODmt8yF9.mjs → cockpit-actions-C8GlTzts.mjs} +84 -42
  15. package/dist/cockpit-memory-vTlFWV7F.mjs +20 -0
  16. package/dist/{config-BSXKyeJ1.mjs → config-Bu1_vbY8.mjs} +42 -3
  17. package/dist/{config-B955yYmo.mjs → config-Cxi-aBf4.mjs} +2 -2
  18. package/dist/{config-TaWmdTLx.mjs → config-DtENJ6cL.mjs} +1 -1
  19. package/dist/{config-D5chi2LO.mjs → config-XpZWOYOG.mjs} +2 -2
  20. package/dist/{controls-BGkK_Bdi.mjs → controls-BcKFHeG1.mjs} +37 -22
  21. package/dist/daemon/index.mjs +43 -42
  22. package/dist/{daemon-CorGh6Ub.mjs → daemon-ColVHwGZ.mjs} +103 -55
  23. package/dist/daemon-N7WhYi6I.mjs +45 -0
  24. package/dist/daemon-mcp/index.mjs +40 -39
  25. package/dist/{define-DGFu-sCf.mjs → define-CjJsmq-6.mjs} +1 -1
  26. package/dist/{detect-C1d5cUkT.mjs → detect-9CZNO0yf.mjs} +2 -2
  27. package/dist/detect-D1ziFFfA.mjs +10 -0
  28. package/dist/{embed-pass-CeQD8kRE.mjs → embed-pass-DIWjA68P.mjs} +5 -5
  29. package/dist/{embedding-gate-BHuBsgHD.mjs → embedding-gate-6rZrWRXa.mjs} +5 -5
  30. package/dist/{embedding-gate-Z7CJSOJk.mjs → embedding-gate-Cnk4YCyX.mjs} +3 -3
  31. package/dist/{embeddings-D4t6L-EH.mjs → embeddings-BVq3esBF.mjs} +1 -1
  32. package/dist/{embeddings-OF9Pt4by.mjs → embeddings-CIkJBKd-.mjs} +1 -1
  33. package/dist/{endreason-x1KOSrcO.mjs → endreason-C577xIQz.mjs} +7 -6
  34. package/dist/{env-DArqGq-Z.mjs → env-BE8mrsxr.mjs} +1 -1
  35. package/dist/factory-Bsib-qDG.mjs +9 -0
  36. package/dist/{factory-BtjbQ0np.mjs → factory-DjAAsqr_.mjs} +15 -13
  37. package/dist/{fallback-BIyEpPsQ.mjs → fallback-DFlItw1Z.mjs} +5 -5
  38. package/dist/{fmt-age-BiSHrTKN.mjs → fmt-age-ByDkvkoU.mjs} +1 -1
  39. package/dist/{health-C6jZWvRG.mjs → health-Dnym-qcT.mjs} +4 -4
  40. package/dist/{helpers-DFmYRCOa.mjs → helpers-BD6V-p9w.mjs} +2 -2
  41. package/dist/helpers-CMGjy_0N.mjs +10 -0
  42. package/dist/{helpers-CJpb_MNB.mjs → helpers-CRuBUas3.mjs} +87 -38
  43. package/dist/hooks/capture-all-events.mjs +52 -11
  44. package/dist/hooks/capture-session-summary.mjs +64 -47
  45. package/dist/hooks/capture-tool-output.mjs +49 -8
  46. package/dist/hooks/context-compression-hook.mjs +30 -10
  47. package/dist/hooks/initialize-session.mjs +1 -0
  48. package/dist/hooks/load-core-context.mjs +1 -1
  49. package/dist/hooks/load-project-context.mjs +32 -29
  50. package/dist/hooks/security-validator.mjs +45 -13
  51. package/dist/hooks/stop-hook.mjs +54 -16
  52. package/dist/hooks/supervision-banner.mjs +9 -0
  53. package/dist/hooks/sync-todo-to-md.mjs +147 -113
  54. package/dist/hooks/worker-edit-repair.mjs +2 -1
  55. package/dist/hooks/worker-guard.mjs +40 -16
  56. package/dist/hooks/worker-note.mjs +12 -5
  57. package/dist/hooks/worker-path-repair.mjs +1 -1
  58. package/dist/hooks/worker-pool-host.mjs +214 -116
  59. package/dist/hooks/worker-status-line.mjs +195 -114
  60. package/dist/index.d.mts +18 -0
  61. package/dist/index.mjs +12 -12
  62. package/dist/{indexer-backend-BM2CUSu8.mjs → indexer-backend-_a6UNhXJ.mjs} +149 -96
  63. package/dist/{ipc-client-BMqWw_gv.mjs → ipc-client-CaiGJnSM.mjs} +1 -1
  64. package/dist/{ipc-client-YYDD6zzU.mjs → ipc-client-ZRmDKd5Z.mjs} +1 -1
  65. package/dist/kill-tree-BG7dRVtp.mjs +10 -0
  66. package/dist/{kill-tree-BjYz5BxK.mjs → kill-tree-EWYaEk5v.mjs} +8 -8
  67. package/dist/{launch-CLp0OJxV.mjs → launch-CXVlZjHt.mjs} +8 -8
  68. package/dist/{launch-DgqQdAjI.mjs → launch-Jh5NVeNe.mjs} +3 -3
  69. package/dist/local-candidate-DLdwQt0s.mjs +112 -0
  70. package/dist/local-instances-DOxSgT_L.mjs +210 -0
  71. package/dist/local-instances-ZeRkkuS5.mjs +6 -0
  72. package/dist/{local-tiers-DPZYqv9m.mjs → local-tiers-BE4jGaMa.mjs} +2 -2
  73. package/dist/{local-tiers-DnBIAkbK.mjs → local-tiers-DNMI5W86.mjs} +3 -3
  74. package/dist/{main-config-ops-C0SflOWk.mjs → main-config-ops-BEMpuhDz.mjs} +3 -3
  75. package/dist/{main-resolver-DVPpSWVy.mjs → main-resolver-3Ns1HPmS.mjs} +18 -17
  76. package/dist/{migrate-BUJHadA8.mjs → migrate-DrA_OwlZ.mjs} +45 -14
  77. package/dist/min-max-DrSRUaWQ.mjs +16 -0
  78. package/dist/{model-inventory-Dasber3S.mjs → model-inventory-BFVSNFT3.mjs} +13 -12
  79. package/dist/{models-add-Bt7aUHDs.mjs → models-add-BtB3Se6f.mjs} +39 -38
  80. package/dist/operator-BTqvTIc8.mjs +7 -0
  81. package/dist/{operator-DZxcP-g8.mjs → operator-CyuB3aVw.mjs} +3 -3
  82. package/dist/{pai-marker-kIYuNt3c.mjs → pai-marker-DurzIbw8.mjs} +7 -6
  83. package/dist/{pane-audit-OGYrOAik.mjs → pane-audit-BQytYa60.mjs} +7 -7
  84. package/dist/{paths-DoRuFc60.mjs → paths-CFHTloSe.mjs} +3 -3
  85. package/dist/{paths-DoIyRnhx.mjs → paths-CHifubDh.mjs} +3 -3
  86. package/dist/{planner-DLGOYlVb.mjs → planner-BM27GBfC.mjs} +31 -30
  87. package/dist/{pool-CZ5MZaXg.mjs → pool-BRvoOkv6.mjs} +3 -3
  88. package/dist/{pool-cli-BxNSPzzY.mjs → pool-cli-B_YR8_Gl.mjs} +5 -5
  89. package/dist/{pool-cli-CbJfl37y.mjs → pool-cli-DkZTAlSW.mjs} +6 -6
  90. package/dist/postgres-BdBNkL_l.mjs +7 -0
  91. package/dist/{postgres-CDnd_k5f.mjs → postgres-C6ti4haA.mjs} +55 -34
  92. package/dist/{project-setup-DM4npnL3.mjs → project-setup-CfpApz5o.mjs} +131 -74
  93. package/dist/providers-BeDiVEb-.mjs +16 -0
  94. package/dist/{providers-UsKtLcUR.mjs → providers-CblTFrhz.mjs} +6 -6
  95. package/dist/{query-feedback-I-txSnld.mjs → query-feedback-BRfPtqki.mjs} +2 -2
  96. package/dist/registrable-C7b6givx.mjs +9 -0
  97. package/dist/{registrable-LrRIVYQc.mjs → registrable-Uzgmfyhz.mjs} +4 -4
  98. package/dist/render-Cc2j5QG9.mjs +13 -0
  99. package/dist/{render-BDbb4CF-.mjs → render-CwIrgxLi.mjs} +8 -8
  100. package/dist/{reranker-B4r4vykM.mjs → reranker-8g6xMwP7.mjs} +1 -1
  101. package/dist/{reranker-DxxMCtA0.mjs → reranker-CqCbpGnX.mjs} +1 -1
  102. package/dist/{root-BMeJuHOb.mjs → root-BWy0c2Lq.mjs} +11 -11
  103. package/dist/root-wC_6Fx0B.mjs +36 -0
  104. package/dist/route-table-B7zpoypi.mjs +15 -0
  105. package/dist/{router-L8Nu-OHF.mjs → router-CQSc3lk3.mjs} +17 -7
  106. package/dist/{router-D6Ec6Fid.mjs → router-DwHJRgG9.mjs} +1 -1
  107. package/dist/{routing-CUyiglfu.mjs → routing-BAAST9vT.mjs} +27 -308
  108. package/dist/{routing-ZuGlc0ge.mjs → routing-CENt4HH1.mjs} +13 -12
  109. package/dist/{run-ulAi5dFD.mjs → run-6Q9kCPem.mjs} +35 -33
  110. package/dist/{scan-B7I0gPe-.mjs → scan-ZQWm-_se.mjs} +6 -6
  111. package/dist/{local-candidate-jOjTNlOL.mjs → scheduler-CtUyWJ3O.mjs} +7 -109
  112. package/dist/scheduler-dmHXoRvm.mjs +3 -0
  113. package/dist/{scope-D5VSQxe4.mjs → scope-D-h6F6DN.mjs} +4 -4
  114. package/dist/{search-CPoE0830.mjs → search-RSyeQqj1.mjs} +18 -18
  115. package/dist/session-Bok2PqRS.mjs +35 -0
  116. package/dist/{session-CNXF6DLP.mjs → session-DVUExUnX.mjs} +55 -31
  117. package/dist/session-scan-BJI_ZO8M.mjs +9 -0
  118. package/dist/{session-scan-BDLEc4w1.mjs → session-scan-W-gbwJHM.mjs} +6 -6
  119. package/dist/{sources-CjhUKKtO.mjs → sources-ESUkZaWv.mjs} +1 -1
  120. package/dist/{status-DYydKQUI.mjs → status-Dm4dYciN.mjs} +4 -4
  121. package/dist/{status-CvVi9cDf.mjs → status-ggJ7lgVg.mjs} +17 -9
  122. package/dist/{stop-words-SdSL1WKH.mjs → stop-words-DSEYQdNe.mjs} +1 -1
  123. package/dist/{test-isolation-CoDeOVXb.mjs → test-isolation-lqSmYxr0.mjs} +1 -1
  124. package/dist/{timeouts-OwEONmc8.mjs → timeouts-1MLooEBB.mjs} +1 -1
  125. package/dist/{tool-errors-AeRQuG3Y.mjs → tool-errors-7E13StWd.mjs} +4 -3
  126. package/dist/{tool-errors-R5E0fCgf.mjs → tool-errors-CJWODvlo.mjs} +6 -6
  127. package/dist/{viewer-DtWj5Vti.mjs → viewer-DcpJwGKE.mjs} +15 -15
  128. package/dist/viewer-MWBVJP3u.mjs +22 -0
  129. package/dist/{wait-BMUR-U-U.mjs → wait-ByV0OyMZ.mjs} +3 -3
  130. package/dist/{worker-config-BLqa1yiD.mjs → worker-config-BDYNxbYz.mjs} +294 -92
  131. package/dist/worker-config-gmAq_-rI.mjs +41 -0
  132. package/dist/{workers-config-DEI9lrV4.mjs → workers-config-f8KrkY4L.mjs} +2 -2
  133. package/dist/{worktree-zmRf556h.mjs → worktree-CrnOqTBW.mjs} +37 -7
  134. package/dist/{zettelkasten-nigq7fqs.mjs → zettelkasten-B_rRRRvD.mjs} +5 -5
  135. package/dist/{zettelkasten-Cr_Xj0mG.mjs → zettelkasten-BzMm8REH.mjs} +29 -19
  136. package/docs/README.md +2 -0
  137. package/docs/cockpit.md +10 -4
  138. package/docs/commands/README.md +4 -4
  139. package/docs/commands/backup.md +2 -0
  140. package/docs/commands/install.md +29 -4
  141. package/docs/commands/providers.md +1 -1
  142. package/docs/commands/restore.md +4 -0
  143. package/docs/commands/setup.md +29 -4
  144. package/docs/commands/worker.md +1 -1
  145. package/docs/config.md +2 -0
  146. package/docs/features.md +299 -0
  147. package/docs/images/architecture.drawio +51 -0
  148. package/docs/images/architecture.svg +3 -0
  149. package/docs/images/cockpit-01-system-tokens.jpg +0 -0
  150. package/docs/images/cockpit-02-totals-cache.jpg +0 -0
  151. package/docs/images/cockpit-03-local-servers-models-pool.jpg +0 -0
  152. package/docs/images/cockpit-04-workers-memory.jpg +0 -0
  153. package/docs/images/cockpit-05-performance.jpg +0 -0
  154. package/docs/images/cockpit-06-runs-speed-routing.jpg +0 -0
  155. package/docs/images/cockpit-07-settings-registry.jpg +0 -0
  156. package/docs/install/index.md +29 -0
  157. package/docs/three-tier-coding.md +1 -1
  158. package/gemini-extension.json +1 -1
  159. package/package.json +1 -5
  160. package/pai-plugin.json +1 -1
  161. package/plugins/context-preservation/plugin.json +1 -1
  162. package/plugins/core/plugin.json +1 -1
  163. package/plugins/core/skills/setup/SKILL.md +41 -9
  164. package/plugins/creative/plugin.json +1 -1
  165. package/plugins/observability/plugin.json +1 -1
  166. package/plugins/productivity/plugin.json +1 -1
  167. package/plugins/semantic-search/plugin.json +1 -1
  168. package/plugins/ui/plugin.json +1 -1
  169. package/plugins/zettelkasten/plugin.json +1 -1
  170. package/src/hooks/session-autosave.sh +8 -1
  171. package/src/hooks/session-stop.sh +8 -1
  172. package/src/hooks/ts/capture-all-events.ts +7 -12
  173. package/src/hooks/ts/lib/context-fill.ts +2 -1
  174. package/src/hooks/ts/lib/path-repair.ts +1 -1
  175. package/src/hooks/ts/lib/project-utils/notify.ts +1 -0
  176. package/src/hooks/ts/lib/project-utils/session-notes.ts +23 -6
  177. package/src/hooks/ts/lib/raw-capture.ts +36 -0
  178. package/src/hooks/ts/lib/session-summary.ts +129 -0
  179. package/src/hooks/ts/lib/todo-sync.ts +120 -0
  180. package/src/hooks/ts/lib/worker-git-guard.ts +1 -1
  181. package/src/hooks/ts/post-tool-use/capture-tool-output.ts +6 -10
  182. package/src/hooks/ts/post-tool-use/sync-todo-to-md.ts +5 -105
  183. package/src/hooks/ts/pre-compact/context-compression-hook.ts +1 -1
  184. package/src/hooks/ts/pre-tool-use/security-validator.ts +35 -14
  185. package/src/hooks/ts/session-end/capture-session-summary.ts +20 -128
  186. package/src/hooks/ts/session-start/load-core-context.ts +3 -3
  187. package/src/hooks/ts/session-start/load-project-context.ts +18 -22
  188. package/src/hooks/ts/stop/stop-hook.ts +13 -5
  189. package/src/hooks/ztk-auto.sh +7 -2
  190. package/dist/aibroker-client-JjE74jo0.mjs +0 -3
  191. package/dist/auto-route-BRk8NEFv.mjs +0 -11
  192. package/dist/budget-DuhQ2zzG.mjs +0 -14
  193. package/dist/cockpit-actions-DcQ-ucU8.mjs +0 -19
  194. package/dist/cockpit-memory-KV45PPO2.mjs +0 -19
  195. package/dist/daemon-C7yt_ptC.mjs +0 -44
  196. package/dist/detect-DRUkmHnb.mjs +0 -10
  197. package/dist/factory-DAGG9_n8.mjs +0 -9
  198. package/dist/helpers-DPJEHPq6.mjs +0 -10
  199. package/dist/kill-tree-LV0Q7Mte.mjs +0 -10
  200. package/dist/operator-CfL0HiBK.mjs +0 -7
  201. package/dist/postgres-DgqWyqhN.mjs +0 -7
  202. package/dist/providers-CTu2s1z2.mjs +0 -15
  203. package/dist/registrable-D9aNZOTh.mjs +0 -9
  204. package/dist/render-BSfVlYHj.mjs +0 -13
  205. package/dist/root-xI9DqVIe.mjs +0 -35
  206. package/dist/route-table-HjvnLVEU.mjs +0 -14
  207. package/dist/session-BJHzmUg2.mjs +0 -34
  208. package/dist/session-scan-YORKE1NO.mjs +0 -9
  209. package/dist/viewer-B8709jDN.mjs +0 -22
  210. package/dist/worker-config-D8tRuvo7.mjs +0 -40
  211. package/docs/images/cockpit-limits-routing.jpg +0 -0
  212. package/docs/images/cockpit-models.jpg +0 -0
  213. package/docs/images/cockpit-usage.jpg +0 -0
  214. package/docs/images/cockpit-workers-system.jpg +0 -0
  215. package/scripts/build-docs.mjs +0 -41
  216. package/scripts/build-hooks.mjs +0 -311
  217. package/scripts/build-skill-stubs.mjs +0 -216
  218. package/scripts/copy-defaults.mjs +0 -46
@@ -1,21 +1,24 @@
1
1
  import { g as paiHomePath, h as paiHomeDir } from "./runtime-paths-WsO9sJFc.mjs";
2
- import { A as providerQuotaSkipAt, F as writeWorkersSection, L as isLoopbackHostname, M as resolveCapability, N as resolveModelCapability, O as providerCostTier, P as resolveProviderKey, R as isLoopbackUrl$1, at as MAX_ROUTE_MODELS, b as nativeOrchestratorModel, c as WorkersConfigError, ct as entryProvider, dt as migrateSessionRoutes, ft as parseEntry, j as readWorkersSection, lt as findTier, m as isLocalProvider, mt as targetList, p as getProviderOrNative, pt as sessionTier, s as WORKER_CLASSES, st as classRoute, t as ANTHROPIC_NATIVE, tt as workersYamlPath, u as classModelCapability, ut as listForPolicy, vt as stripModelVariant, y as nativeAnthropicProvider, z as loopbackUrl$1 } from "./config-D5chi2LO.mjs";
3
- import { c as loadConfig, f as readMainConfigRaw } from "./config-BSXKyeJ1.mjs";
4
- import { s as routingStatePath, u as workersLogDir } from "./paths-DoIyRnhx.mjs";
5
- import { g as isLive, v as loadStatus, y as loadStatuses } from "./status-CvVi9cDf.mjs";
6
- import { o as resolveSession, p as currentWorkerId, t as AIBROKER_REGISTRY } from "./scope-D5VSQxe4.mjs";
7
- import { x as recordToolError } from "./tool-errors-AeRQuG3Y.mjs";
8
- import { _ as readLocalConfig, d as installedModelDirs, h as parseServers, p as logPathFor, v as resolveModelPath } from "./local-tiers-DPZYqv9m.mjs";
9
- import { c as listBuildsSync, i as buildsDir, t as callerIdentity } from "./caller-identity-CVTuiLSs.mjs";
10
- import { f as schedEnabled, g as sharedScheduler, l as newPrefill, n as tierProviderNames, o as readLocalStatus, r as LOCAL_STATUS_REFRESH_MS, s as writeLocalStatus, t as isLocalCandidate } from "./local-candidate-jOjTNlOL.mjs";
11
- import { i as effectiveCap } from "./capacity-DaXrVj3J.mjs";
12
- import { t as LOCAL_PROBE_TIMEOUT_MS } from "./timeouts-OwEONmc8.mjs";
2
+ import { t as writeFileAtomic } from "./atomic-file-BorMa4T3.mjs";
3
+ import { A as providerQuotaSkipAt, F as writeWorkersSection, L as isLoopbackHostname, M as resolveCapability, N as resolveModelCapability, O as providerCostTier, P as resolveProviderKey, R as isLoopbackUrl$1, at as MAX_ROUTE_MODELS, b as nativeOrchestratorModel, c as WorkersConfigError, ct as entryProvider, dt as migrateSessionRoutes, ft as parseEntry, j as readWorkersSection, lt as findTier, m as isLocalProvider, mt as targetList, p as getProviderOrNative, pt as sessionTier, s as WORKER_CLASSES, st as classRoute, t as ANTHROPIC_NATIVE, tt as workersYamlPath, u as classModelCapability, ut as listForPolicy, vt as stripModelVariant, y as nativeAnthropicProvider, z as loopbackUrl$1 } from "./config-XpZWOYOG.mjs";
4
+ import { c as loadConfig, f as readMainConfigRaw } from "./config-Bu1_vbY8.mjs";
5
+ import { s as routingStatePath, u as workersLogDir } from "./paths-CHifubDh.mjs";
6
+ import { g as isLive, v as loadStatus, y as loadStatuses } from "./status-ggJ7lgVg.mjs";
7
+ import { o as resolveSession, p as currentWorkerId, t as AIBROKER_REGISTRY } from "./scope-D-h6F6DN.mjs";
8
+ import { x as recordToolError } from "./tool-errors-7E13StWd.mjs";
9
+ import { _ as readLocalConfig, d as installedModelDirs, p as logPathFor } from "./local-tiers-BE4jGaMa.mjs";
10
+ import { a as buildsDir, l as listBuildsSync, t as callerIdentity } from "./caller-identity-yLFb7CKq.mjs";
11
+ import { a as newPrefill, c as schedEnabled, f as sharedScheduler } from "./scheduler-CtUyWJ3O.mjs";
12
+ import { i as effectiveCap } from "./capacity-DEveQdFV.mjs";
13
+ import { i as instanceNumber, l as readInstances, r as instanceEngineKey, s as pickInstance, t as endpointRegistry, u as readLiveInstances } from "./local-instances-DOxSgT_L.mjs";
14
+ import { c as writeLocalStatus, n as tierProviderNames, r as LOCAL_STATUS_REFRESH_MS, s as readLocalStatus, t as isLocalCandidate } from "./local-candidate-DLdwQt0s.mjs";
15
+ import { t as LOCAL_PROBE_TIMEOUT_MS } from "./timeouts-1MLooEBB.mjs";
13
16
  import { appendFileSync, chmodSync, closeSync, existsSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
17
+ import { createHash } from "node:crypto";
14
18
  import { delimiter, dirname, join } from "node:path";
15
19
  import { homedir, tmpdir } from "node:os";
16
20
  import { execFile, execFileSync, spawnSync } from "node:child_process";
17
21
  import { parse, stringify } from "yaml";
18
- import { createHash } from "node:crypto";
19
22
  import http from "node:http";
20
23
  import https from "node:https";
21
24
  import net from "node:net";
@@ -23,21 +26,6 @@ import zlib from "node:zlib";
23
26
  import { Transform } from "node:stream";
24
27
  import { StringDecoder } from "node:string_decoder";
25
28
 
26
- //#region src/config/atomic-file.ts
27
- /** Write text to a temp file and rename it over `path`: a crash mid-write leaves the old file intact. */
28
- function writeFileAtomic(path, text) {
29
- mkdirSync(dirname(path), { recursive: true });
30
- const tmp = `${path}.${process.pid}.tmp`;
31
- try {
32
- writeFileSync(tmp, text, "utf8");
33
- renameSync(tmp, path);
34
- } catch (e) {
35
- rmSync(tmp, { force: true });
36
- throw e;
37
- }
38
- }
39
-
40
- //#endregion
41
29
  //#region src/router/usage.ts
42
30
  /**
43
31
  * usage.ts — per-request token and cache accounting for the router.
@@ -254,82 +242,10 @@ function readUsage(file = usageLogFile()) {
254
242
  }
255
243
  return rows;
256
244
  }
257
- function parseLines(text, into) {
258
- for (const l of text.split("\n")) {
259
- if (!l) continue;
260
- try {
261
- into.push(JSON.parse(l));
262
- } catch {}
263
- }
264
- }
265
- /** Parsed log per file: rows up to byte `end` (a line boundary), the file identity they came from. */
266
- const usageCache = /* @__PURE__ */ new Map();
267
- /** The longest range the cockpit shows; older rows are dropped from the cache. */
268
- const USAGE_CACHE_WINDOW_MS = 7 * 864e5;
269
- const USAGE_HEAD_BYTES = 4096;
270
245
  /** Row arrays known to hold their rows in time order (the cached log, while every appended row is not older than the one before). */
271
246
  const timeOrdered = /* @__PURE__ */ new WeakSet();
272
247
  const isTimeOrdered = (rows) => timeOrdered.has(rows);
273
248
  const markTimeOrdered = (rows) => void timeOrdered.add(rows);
274
- /**
275
- * readUsage for the cockpit's polls and range clicks: the log is append-only, so the rows parsed
276
- * last time stay and only the bytes after them are read. A truncated or replaced file is re-read
277
- * whole; replacement is detected by inode, shrinking, or a changed first 4 KB (an in-place rewrite
278
- * that grows). Rows older than the 7 d range window are dropped. The returned array is shared —
279
- * callers must not mutate it.
280
- */
281
- function readUsageCached(file = usageLogFile(), now = Date.now()) {
282
- if (!existsSync(file)) {
283
- usageCache.delete(file);
284
- return [];
285
- }
286
- const fd = openSync(file, "r");
287
- try {
288
- const st = fstatSync(fd);
289
- let c = usageCache.get(file);
290
- const headLen = Math.min(USAGE_HEAD_BYTES, st.size);
291
- const headBuf = Buffer.alloc(headLen);
292
- readSync(fd, headBuf, 0, headLen, 0);
293
- const head = headBuf.toString("latin1");
294
- if (c && (c.ino !== st.ino || st.size < c.end || !head.startsWith(c.head))) c = void 0;
295
- if (!c) {
296
- c = {
297
- ino: st.ino,
298
- end: 0,
299
- rows: [],
300
- lastMs: 0,
301
- head: ""
302
- };
303
- timeOrdered.add(c.rows);
304
- }
305
- if (st.size > c.end) {
306
- const buf = Buffer.alloc(st.size - c.end);
307
- const n = readSync(fd, buf, 0, buf.length, c.end);
308
- let chunk = buf.subarray(0, n);
309
- const nl = chunk.lastIndexOf(10);
310
- chunk = nl < 0 ? chunk.subarray(0, 0) : chunk.subarray(0, nl + 1);
311
- const from = c.rows.length;
312
- parseLines(chunk.toString("utf8"), c.rows);
313
- for (let i = from; i < c.rows.length; i++) {
314
- const t = Date.parse(c.rows[i].ts);
315
- if (t < c.lastMs) timeOrdered.delete(c.rows);
316
- else if (t >= 0) c.lastMs = t;
317
- }
318
- c.end += chunk.length;
319
- if (c.head.length < USAGE_HEAD_BYTES) c.head = head.slice(0, Math.min(c.end, USAGE_HEAD_BYTES));
320
- const cutoff = now - USAGE_CACHE_WINDOW_MS;
321
- if (c.rows.length && Date.parse(c.rows[0].ts) < cutoff - 864e5) {
322
- const kept = c.rows.filter((r) => !(Date.parse(r.ts) < cutoff));
323
- c.rows.length = 0;
324
- for (const r of kept) c.rows.push(r);
325
- }
326
- }
327
- usageCache.set(file, c);
328
- return c.rows;
329
- } finally {
330
- closeSync(fd);
331
- }
332
- }
333
249
  function parseSince(s) {
334
250
  const m = /^(\d+)\s*([smhd])$/.exec(s.trim());
335
251
  if (!m) throw new Error(`bad --since "${s}" (use e.g. 30m, 1h, 2d)`);
@@ -1126,209 +1042,6 @@ function setParkConfigSource(src) {
1126
1042
  parkCfg = src;
1127
1043
  }
1128
1044
 
1129
- //#endregion
1130
- //#region src/workers/local-instances.ts
1131
- /**
1132
- * local-instances.ts — the running instances of local models.
1133
- *
1134
- * An instance is one server process of a catalogue model (a `local_tiers:`
1135
- * entry) on its own port. The source of truth is the running processes
1136
- * (`parseServers`); `<logDir>/local-instances.json` adds what ps cannot know
1137
- * (start time, log, failure). Processes win: `reconcileInstances` drops a row
1138
- * whose pid is gone and adopts a catalogue server that has no row.
1139
- */
1140
- const localInstancesPath = (logDir) => join(logDir, "local-instances.json");
1141
- /** Is the process alive (signal 0; EPERM means it exists under another user). */
1142
- function pidAlive(pid) {
1143
- try {
1144
- process.kill(pid, 0);
1145
- return true;
1146
- } catch (e) {
1147
- return e.code === "EPERM";
1148
- }
1149
- }
1150
- function readInstances(logDir) {
1151
- const path = localInstancesPath(logDir);
1152
- if (!existsSync(path)) return [];
1153
- try {
1154
- const j = JSON.parse(readFileSync(path, "utf8"));
1155
- return Array.isArray(j) ? j.filter((r) => r && typeof r.id === "string" && typeof r.model === "string") : [];
1156
- } catch {
1157
- return [];
1158
- }
1159
- }
1160
- /** The recorded rows minus managed ones whose process is gone (killed outside PAI); failed rows stay until dismissed. Readers that report or route use this; writers read the raw file. */
1161
- function readLiveInstances(logDir) {
1162
- return readInstances(logDir).filter((r) => !(r.origin === "managed" && r.state !== "failed" && r.pid && !pidAlive(r.pid)));
1163
- }
1164
- /** Atomic write (tmp + rename). */
1165
- function writeInstances(logDir, rows) {
1166
- const path = localInstancesPath(logDir);
1167
- mkdirSync(dirname(path), { recursive: true });
1168
- const tmp = `${path}.${process.pid}.tmp`;
1169
- writeFileSync(tmp, JSON.stringify(rows) + "\n", "utf8");
1170
- renameSync(tmp, path);
1171
- }
1172
- /** Router / scheduler engine key: n=1 keeps the bare provider name, later copies are `<provider>#<n>`. */
1173
- function engineKey(provider, n) {
1174
- return n <= 1 ? provider : `${provider}#${n}`;
1175
- }
1176
- /** The n of an instance id `<model>#<n>` (1 when it carries none). */
1177
- function instanceNumber(id) {
1178
- const m = /#(\d+)$/.exec(id);
1179
- return m ? Number(m[1]) : 1;
1180
- }
1181
- function instanceEngineKey(i) {
1182
- return engineKey(i.provider, instanceNumber(i.id));
1183
- }
1184
- /** vllm-mlx servers on a port no tier names (a second copy): the tier is the one whose model path the command serves. */
1185
- function vllmByModelPath(psOut, cfg, selfPid, byPath) {
1186
- const out = [];
1187
- for (const line of psOut.split("\n")) {
1188
- const m = /^\s*(\d+)\s+(\d+)\s+(.*)$/.exec(line);
1189
- if (!m || Number(m[1]) === selfPid) continue;
1190
- const cmd = m[3];
1191
- const sv = /\bserve\s+(\S+)/.exec(cmd);
1192
- const pm = /--port\s+(\d+)/.exec(cmd);
1193
- if (!sv || !pm || !cmd.includes(cfg.launcher.processMatch)) continue;
1194
- const tier = byPath.get(sv[1]);
1195
- if (!tier) continue;
1196
- out.push({
1197
- pid: Number(m[1]),
1198
- rssKb: Number(m[2]),
1199
- port: Number(pm[1]),
1200
- tier,
1201
- provider: cfg.tiers[tier].provider
1202
- });
1203
- }
1204
- return out;
1205
- }
1206
- /** Servers of catalogue models, one per (model, port): the engine child of a Strata server is folded into its server. */
1207
- function instancesFromProcesses(psOut, cfg, listeners = {}, selfPid = process.pid) {
1208
- const seen = /* @__PURE__ */ new Set();
1209
- const out = [];
1210
- const byPath = /* @__PURE__ */ new Map();
1211
- for (const t of Object.values(cfg.tiers)) if (t.engine === "vllm-mlx") byPath.set(resolveModelPath(t.model), t.tier);
1212
- for (const s of [...parseServers(psOut, cfg, selfPid, listeners), ...vllmByModelPath(psOut, cfg, selfPid, byPath)]) {
1213
- if (!s.tier || s.port === null) continue;
1214
- const key = `${s.tier}:${s.port}`;
1215
- if (seen.has(key)) continue;
1216
- seen.add(key);
1217
- out.push(s);
1218
- }
1219
- return out;
1220
- }
1221
- /**
1222
- * Join state rows with the live servers. A row follows its pid, else its
1223
- * port; a live server without a row is adopted as `ready` under the smallest
1224
- * free `<model>#<n>`. Rows with no live server are dropped, except `failed`
1225
- * ones (kept until the next start dismisses them).
1226
- */
1227
- function reconcileInstances(rows, servers, cfg, now = Date.now()) {
1228
- const out = [];
1229
- const used = /* @__PURE__ */ new Set();
1230
- const claimed = /* @__PURE__ */ new Set();
1231
- for (const r of rows) {
1232
- if (r.origin === "registered") continue;
1233
- if (r.state === "failed") {
1234
- out.push(r);
1235
- used.add(r.id);
1236
- continue;
1237
- }
1238
- const s = servers.find((x) => !claimed.has(x) && x.tier === r.model && (x.pid === r.pid || x.port === r.port));
1239
- if (!s) continue;
1240
- claimed.add(s);
1241
- out.push({
1242
- ...r,
1243
- pid: s.pid,
1244
- port: s.port ?? r.port
1245
- });
1246
- used.add(r.id);
1247
- }
1248
- for (const s of servers) {
1249
- if (claimed.has(s) || !s.tier || s.port === null) continue;
1250
- const tier = cfg.tiers[s.tier];
1251
- if (!tier) continue;
1252
- let n = 1;
1253
- while (used.has(`${s.tier}#${n}`)) n++;
1254
- const id = `${s.tier}#${n}`;
1255
- used.add(id);
1256
- out.push({
1257
- id,
1258
- model: s.tier,
1259
- provider: tier.provider,
1260
- url: `http://127.0.0.1:${s.port}`,
1261
- origin: "managed",
1262
- port: s.port,
1263
- pid: s.pid,
1264
- state: "ready",
1265
- startedAt: now,
1266
- log: ""
1267
- });
1268
- }
1269
- return out.sort((a, b) => a.model.localeCompare(b.model) || instanceNumber(a.id) - instanceNumber(b.id));
1270
- }
1271
- /**
1272
- * Endpoints declared in workers.yaml `providers:` with a url that no catalogue
1273
- * model launches: no pid, health is a probe (state `ready` until one says
1274
- * otherwise). Loopback or another machine alike.
1275
- */
1276
- function registeredInstances(providers, cfg) {
1277
- const launched = new Set(Object.values(cfg.tiers).map((t) => t.provider));
1278
- const out = [];
1279
- for (const [name, p] of Object.entries(providers)) {
1280
- if (!p.url || launched.has(name)) continue;
1281
- const port = /:(\d+)(?:\/|$)/.exec(p.url)?.[1];
1282
- out.push({
1283
- id: name,
1284
- model: name,
1285
- provider: name,
1286
- url: p.url.replace(/\/+$/, ""),
1287
- origin: "registered",
1288
- port: port ? Number(port) : 0,
1289
- state: "ready",
1290
- startedAt: 0,
1291
- log: "",
1292
- ...p.characteristics ? { characteristics: p.characteristics } : {}
1293
- });
1294
- }
1295
- return out;
1296
- }
1297
- const rrCounters = /* @__PURE__ */ new Map();
1298
- /**
1299
- * The instance (of `running`, already one provider's; `model` keys the round-robin) to send the next request to: the ready one with the
1300
- * fewest requests in flight (`busy` by engine key); ties go round-robin per
1301
- * model. Null when none is ready.
1302
- */
1303
- function pickInstance(model, running, busy) {
1304
- const ready = running.filter((i) => i.state === "ready");
1305
- if (!ready.length) return null;
1306
- const load = ready.map((i) => busy(instanceEngineKey(i)));
1307
- const min = Math.min(...load);
1308
- const tied = ready.filter((_, k) => load[k] === min);
1309
- const n = rrCounters.get(model) ?? 0;
1310
- rrCounters.set(model, n + 1);
1311
- return tied[n % tied.length];
1312
- }
1313
- /**
1314
- * The endpoint registry: managed instances plus the enabled providers that
1315
- * declare `characteristics` (a url alone is a cloud or local provider, not a
1316
- * registered endpoint). A managed instance wins over a registered one of the
1317
- * same id.
1318
- */
1319
- function endpointRegistry(managed, providers, cfg) {
1320
- const declared = {};
1321
- for (const [name, p] of Object.entries(providers)) {
1322
- if (p.enabled === false || !p.characteristics) continue;
1323
- declared[name] = {
1324
- url: p.baseUrl,
1325
- characteristics: p.characteristics
1326
- };
1327
- }
1328
- const ids = new Set(managed.map((i) => i.id));
1329
- return [...managed, ...registeredInstances(declared, cfg).filter((i) => !ids.has(i.id))];
1330
- }
1331
-
1332
1045
  //#endregion
1333
1046
  //#region src/workers/served-models.ts
1334
1047
  /**
@@ -1951,7 +1664,7 @@ function currentSessionName(env = process.env) {
1951
1664
  */
1952
1665
  async function registryProjectName(cwd) {
1953
1666
  try {
1954
- const { detectProject } = await import("./detect-DRUkmHnb.mjs");
1667
+ const { detectProject } = await import("./detect-D1ziFFfA.mjs");
1955
1668
  return (await detectProject(cwd))?.display_name || void 0;
1956
1669
  } catch {
1957
1670
  return;
@@ -1977,7 +1690,7 @@ async function detectSessionName(env = process.env, deps = {}) {
1977
1690
  let name;
1978
1691
  const registry = deps.registryPath ?? AIBROKER_REGISTRY;
1979
1692
  const claudeId = env.CLAUDE_CODE_SESSION_ID?.trim();
1980
- const { loadBrokerNames, transcriptCustomTitle } = await import("./session-scan-YORKE1NO.mjs");
1693
+ const { loadBrokerNames, transcriptCustomTitle } = await import("./session-scan-BJI_ZO8M.mjs");
1981
1694
  name = resolveSession(env.ITERM_SESSION_ID ?? "", registry)?.name ?? (claudeId ? loadBrokerNames(registry, deps.mapPath).get(claudeId) ?? transcriptCustomTitle(claudeId, deps.projectsDir) : void 0) ?? await (deps.projectName ?? registryProjectName)(cwd);
1982
1695
  cached = {
1983
1696
  key,
@@ -3573,6 +3286,13 @@ function pinWorkersYamlCopy(env, root = WORKER_CONFIG_COPY_ROOT) {
3573
3286
  env.PAI_WORKERS_YAML = copy;
3574
3287
  } catch {}
3575
3288
  }
3289
+ /** Caller's env minus ANTHROPIC_API_KEY: a spawned claude must bill the
3290
+ * subscription, never an API key left in the user's shell. */
3291
+ function nativeLaunchEnv() {
3292
+ const env = { ...process.env };
3293
+ delete env.ANTHROPIC_API_KEY;
3294
+ return env;
3295
+ }
3576
3296
  /**
3577
3297
  * Environment for a run through `provider`. Caller's env minus the Anthropic
3578
3298
  * key. `routerEnabled` routes the run through the local model router instead
@@ -3581,8 +3301,7 @@ function pinWorkersYamlCopy(env, root = WORKER_CONFIG_COPY_ROOT) {
3581
3301
  * PAI_WORKER_ORCHESTRATOR=1 makes the edit gate deny code edits.
3582
3302
  */
3583
3303
  function buildRunEnv(provider, headless, proxyUrl, providerName, routerEnabled, orchestrate) {
3584
- const env = { ...process.env };
3585
- delete env.ANTHROPIC_API_KEY;
3304
+ const env = nativeLaunchEnv();
3586
3305
  if (headless) {
3587
3306
  for (const k of SESSION_IDENTITY_VARS) delete env[k];
3588
3307
  for (const k of HEADLESS_STRIP_VARS) delete env[k];
@@ -6188,5 +5907,5 @@ function resolveCapabilityRun(config, capability) {
6188
5907
  }
6189
5908
 
6190
5909
  //#endregion
6191
- export { parseFootprint as $, parseSince as $n, onBattery as $t, budgetSkipReason as A, setupProfile as An, applyPolicyToRoutes as At, MODEL_INVENTORY_MAX_AGE_MS as B, reconcileInstances as Bn, routeText as Bt, detectSessionProvider as C, allSetups as Cn, writePrivateFile as Ct, budgetExceeded as D, loadSaved as Dn, isTailnetOrLocalName as Dt, budgetCache as E, httpModelsCheck as En, routerPort as Et, LimitsCache as F, instanceEngineKey as Fn, parseSelector as Ft, fmtMem as G, recordDuration as Gn, setSessionRoute as Gt, ProbeHold as H, parkConfigFrom as Hn, sessionRoutesPatch as Ht, buildSpeed as I, instanceNumber as In, resolveSelector as It, inventoryRows as J, appendUsage as Jn, POLICY_MODES as Jt, fmtMemMapped as K, aggregate as Kn, tierFlow as Kt, percentile as L, instancesFromProcesses as Ln, resolveSessionArg as Lt, budgetWall as M, setupsPath as Mn, configuredLocal as Mt, fetchBudgetReading as N, shortModel as Nn, entryLabel as Nt, budgetFresh as O, orchestratorLabel as On, loopbackRefusal as Ot, pickBudgetWindow as P, workersLabel as Pn, flowText as Pt, modelLabel as Q, markTimeOrdered as Qn, findLocal as Qt, DOWN_AFTER_MISSES as R, readInstances as Rn, routeChoices as Rt, applySessionProviderEnv as S, PORT_TIMEOUT_MS as Sn, removeRunSettings as St, BudgetCache as T, findSetup as Tn, routerHandler as Tt, computeInventory as U, setParkConfigSource as Un, sessionStartTarget as Ut, MODEL_INVENTORY_REFRESH_MS as V, writeInstances as Vn, servingChip as Vt, currentInventory as W, sharedParker as Wn, setRoute as Wt, liveDeps as X, formatStats as Xn, committedFallThrough as Xt, inventoryText as Y, formatSessionStats as Yn, clearPolicy as Yt, modelKind as Z, isTimeOrdered as Zn, fallThroughReason as Zt, resolveTarget as _, probeLoopback as _n, pinnedSettings as _t, clearCooldown as a, BATCH_ENV as an, readInventoryInput as at, SESSION_PROVIDER_ENV as b, resolveRunnerProvider as bn, routeVerdictLine as bt, exclusionReason as c, profilesPath as cn, writeInventory as ct, probeQuota as d, LOCAL_MECHANISM_LINE as dn, claudeCommand as dt, parseDuration as en, readUsage as er, parseSizeMb as et, quotaExceeded as f, NoLocalServerError as fn, claudeSettingsExtra as ft, resolveCapabilityRun as g, pickLocal as gn, nativeRoutePreflight as gt, recordBudgetCooldowns as h, localTierOrder as hn, nativeLaunchSettingsArgs as ht, capabilityForRun as i, detectSessionName as in, writeFileAtomic as ir, readInventory as it, budgetUntilLabel as j, setupWorkersLabel as jn, clearSessionRoute as jt, budgetFull as k, saveSetup as kn, TIGHT_PERCENT as kt, isQuotaFailure as l, readProfiles as ln, addSchedulingHeaders as lt, readRoutingState as m, localProviderForDelegation as mn, loopbackRouterChoice as mt, NoProviderError as n, routeRun as nn, splitBySessionKind as nr, processTreeMemory as nt, cooldownRemaining as o, SESSION_NAME_ENV as on, readModelLabels as ot, quotaSkipThreshold as p, currentLocalStatus as pn, isLoopbackProvider as pt, inventoryPath as q, aggregateBySession as qn, validateRoute as qt, autoOrder as r, writePolicy as rn, usageLogFile as rr, processTreeRssMb as rt, entryModel as s, getProfile as sn, startInventoryRefresh as st, BUDGET_COOLDOWN_MIN as t, readPolicy as tn, readUsageCached as tr, parseTable as tt, nextAutoProvider as u, updateProfile as un, buildRunEnv as ut, setCooldown as v, providerHostPort as vn, pinnedSettingsArgs as vt, BUDGET_TTL_MS as w, downLocalProviders as wn, duplicateModelIds as wt, SESSION_WORKER_PROVIDER_ENV as x, startLocalStatusRefresh as xn, gcSettingsFiles as xt, writeRoutingState as y, resolveLocalProvider as yn, routeLoopbackViaRouter as yt, INVENTORY_HEADERS as z, readLiveInstances as zn, routeRows as zt };
6192
- //# sourceMappingURL=routing-CUyiglfu.mjs.map
5910
+ export { parseFootprint as $, findLocal as $t, budgetSkipReason as A, saveSetup as An, TIGHT_PERCENT as At, MODEL_INVENTORY_MAX_AGE_MS as B, aggregate as Bn, routeRows as Bt, detectSessionProvider as C, PORT_TIMEOUT_MS as Cn, removeRunSettings as Ct, budgetExceeded as D, httpModelsCheck as Dn, routerPort as Dt, budgetCache as E, findSetup as En, routerHandler as Et, LimitsCache as F, workersLabel as Fn, flowText as Ft, fmtMem as G, isTimeOrdered as Gn, setRoute as Gt, ProbeHold as H, appendUsage as Hn, servingChip as Ht, buildSpeed as I, parkConfigFrom as In, parseSelector as It, inventoryRows as J, readUsage as Jn, validateRoute as Jt, fmtMemMapped as K, markTimeOrdered as Kn, setSessionRoute as Kt, percentile as L, setParkConfigSource as Ln, resolveSelector as Lt, budgetWall as M, setupWorkersLabel as Mn, clearSessionRoute as Mt, fetchBudgetReading as N, setupsPath as Nn, configuredLocal as Nt, budgetFresh as O, loadSaved as On, isTailnetOrLocalName as Ot, pickBudgetWindow as P, shortModel as Pn, entryLabel as Pt, modelLabel as Q, fallThroughReason as Qt, DOWN_AFTER_MISSES as R, sharedParker as Rn, resolveSessionArg as Rt, applySessionProviderEnv as S, startLocalStatusRefresh as Sn, gcSettingsFiles as St, BudgetCache as T, downLocalProviders as Tn, duplicateModelIds as Tt, computeInventory as U, formatSessionStats as Un, sessionRoutesPatch as Ut, MODEL_INVENTORY_REFRESH_MS as V, aggregateBySession as Vn, routeText as Vt, currentInventory as W, formatStats as Wn, sessionStartTarget as Wt, liveDeps as X, usageLogFile as Xn, clearPolicy as Xt, inventoryText as Y, splitBySessionKind as Yn, POLICY_MODES as Yt, modelKind as Z, committedFallThrough as Zt, resolveTarget as _, pickLocal as _n, nativeRoutePreflight as _t, clearCooldown as a, detectSessionName as an, readInventoryInput as at, SESSION_PROVIDER_ENV as b, resolveLocalProvider as bn, routeLoopbackViaRouter as bt, exclusionReason as c, getProfile as cn, writeInventory as ct, probeQuota as d, updateProfile as dn, claudeCommand as dt, onBattery as en, parseSizeMb as et, quotaExceeded as f, LOCAL_MECHANISM_LINE as fn, claudeSettingsExtra as ft, resolveCapabilityRun as g, localTierOrder as gn, nativeLaunchSettingsArgs as gt, recordBudgetCooldowns as h, localProviderForDelegation as hn, nativeLaunchEnv as ht, capabilityForRun as i, writePolicy as in, readInventory as it, budgetUntilLabel as j, setupProfile as jn, applyPolicyToRoutes as jt, budgetFull as k, orchestratorLabel as kn, loopbackRefusal as kt, isQuotaFailure as l, profilesPath as ln, addSchedulingHeaders as lt, readRoutingState as m, currentLocalStatus as mn, loopbackRouterChoice as mt, NoProviderError as n, readPolicy as nn, processTreeMemory as nt, cooldownRemaining as o, BATCH_ENV as on, readModelLabels as ot, quotaSkipThreshold as p, NoLocalServerError as pn, isLoopbackProvider as pt, inventoryPath as q, parseSince as qn, tierFlow as qt, autoOrder as r, routeRun as rn, processTreeRssMb as rt, entryModel as s, SESSION_NAME_ENV as sn, startInventoryRefresh as st, BUDGET_COOLDOWN_MIN as t, parseDuration as tn, parseTable as tt, nextAutoProvider as u, readProfiles as un, buildRunEnv as ut, setCooldown as v, probeLoopback as vn, pinnedSettings as vt, BUDGET_TTL_MS as w, allSetups as wn, writePrivateFile as wt, SESSION_WORKER_PROVIDER_ENV as x, resolveRunnerProvider as xn, routeVerdictLine as xt, writeRoutingState as y, providerHostPort as yn, pinnedSettingsArgs as yt, INVENTORY_HEADERS as z, recordDuration as zn, routeChoices as zt };
5911
+ //# sourceMappingURL=routing-BAAST9vT.mjs.map
@@ -1,14 +1,15 @@
1
- import "./config-D5chi2LO.mjs";
2
- import "./config-BSXKyeJ1.mjs";
3
- import "./paths-DoIyRnhx.mjs";
4
- import "./status-CvVi9cDf.mjs";
5
- import "./scope-D5VSQxe4.mjs";
6
- import { _ as resolveTarget, a as clearCooldown, c as exclusionReason, d as probeQuota, f as quotaExceeded, g as resolveCapabilityRun, h as recordBudgetCooldowns, i as capabilityForRun, l as isQuotaFailure, m as readRoutingState, n as NoProviderError, o as cooldownRemaining, p as quotaSkipThreshold, r as autoOrder, s as entryModel, t as BUDGET_COOLDOWN_MIN, u as nextAutoProvider, v as setCooldown, y as writeRoutingState } from "./routing-CUyiglfu.mjs";
7
- import "./tool-errors-AeRQuG3Y.mjs";
8
- import "./wait-BMUR-U-U.mjs";
9
- import "./local-tiers-DPZYqv9m.mjs";
10
- import "./caller-identity-CVTuiLSs.mjs";
11
- import "./local-candidate-jOjTNlOL.mjs";
12
- import "./capacity-DaXrVj3J.mjs";
1
+ import "./config-XpZWOYOG.mjs";
2
+ import "./config-Bu1_vbY8.mjs";
3
+ import "./paths-CHifubDh.mjs";
4
+ import "./status-ggJ7lgVg.mjs";
5
+ import "./scope-D-h6F6DN.mjs";
6
+ import { _ as resolveTarget, a as clearCooldown, c as exclusionReason, d as probeQuota, f as quotaExceeded, g as resolveCapabilityRun, h as recordBudgetCooldowns, i as capabilityForRun, l as isQuotaFailure, m as readRoutingState, n as NoProviderError, o as cooldownRemaining, p as quotaSkipThreshold, r as autoOrder, s as entryModel, t as BUDGET_COOLDOWN_MIN, u as nextAutoProvider, v as setCooldown, y as writeRoutingState } from "./routing-BAAST9vT.mjs";
7
+ import "./tool-errors-7E13StWd.mjs";
8
+ import "./wait-ByV0OyMZ.mjs";
9
+ import "./local-tiers-BE4jGaMa.mjs";
10
+ import "./caller-identity-yLFb7CKq.mjs";
11
+ import "./capacity-DEveQdFV.mjs";
12
+ import "./local-instances-DOxSgT_L.mjs";
13
+ import "./local-candidate-DLdwQt0s.mjs";
13
14
 
14
15
  export { BUDGET_COOLDOWN_MIN, NoProviderError, autoOrder, capabilityForRun, clearCooldown, cooldownRemaining, entryModel, exclusionReason, isQuotaFailure, nextAutoProvider, probeQuota, quotaExceeded, quotaSkipThreshold, readRoutingState, recordBudgetCooldowns, resolveCapabilityRun, resolveTarget, setCooldown, writeRoutingState };
@@ -1,33 +1,34 @@
1
1
  import { g as paiHomePath, l as claudeHomeDir } from "./runtime-paths-WsO9sJFc.mjs";
2
- import { Ct as withSummary, I as LOOPBACK_HOST, N as resolveModelCapability, P as resolveProviderKey, St as sessionNote, bt as ledgerEscalate, c as WorkersConfigError, f as escalationCloud, ft as parseEntry, gt as certainContextWindow, h as isModelCapability, j as readWorkersSection, k as providerKeyPath, l as assertProviderRunnable, m as isLocalProvider, ot as applyRouteOverrides, p as getProviderOrNative, t as ANTHROPIC_NATIVE, tt as workersYamlPath, u as classModelCapability, v as nativeAnthropicModels, wt as appendLedger, xt as planEscalation } from "./config-D5chi2LO.mjs";
3
- import { _ as effectiveWorkersYamlRaw } from "./config-BSXKyeJ1.mjs";
4
- import { i as ledgerPath, n as ensureNoMcpConfig, r as eventsPath, u as workersLogDir } from "./paths-DoIyRnhx.mjs";
5
- import { A as applyScratchEnv, C as worktreeWanted, S as worktreeSystemPrompt, _ as ownedTree, a as archiveEmptyResult, f as gcWorktreesThrottled, h as markResumed, i as adoptTree, j as scratchPromptLine, o as commitLines, p as inPlaceSystemPrompt, r as addWorktree, t as GATE_MARK, v as recordWorktree, w as worktreesDir, x as worktreeRefusesStart, y as salvageOnExit } from "./worktree-zmRf556h.mjs";
6
- import { C as nowStamp, D as pidAlive, E as parseSleepSecs, J as loadPreamble, Q as appendSystemPromptArgs, S as newWorkerId, X as preambleLine, Y as preambleBlock, Z as projectRoot, a as UNLABELED, d as describeTool, g as isLive, k as saveStatus, nt as shortText, rt as stripPromptValues, tt as parseRunnerArgs, v as loadStatus, x as markStartFailed, y as loadStatuses } from "./status-CvVi9cDf.mjs";
7
- import { D as readMcpServers, E as mcpServersFromToolGrants, O as writeMcpConfig, S as inputSideTokens, T as grantsChrome, d as poolIneligibleReason, g as postTaskToPool, h as poolSettings, n as SLOT_TOOLS, r as UNIT_MARKER, t as SHARED_MARKER, w as expandMcpNames, y as reloadInProgress } from "./pool-CZ5MZaXg.mjs";
8
- import { i as itermUuid, o as resolveSession, s as resolveSpawnerSession } from "./scope-D5VSQxe4.mjs";
9
- import { Ct as writePrivateFile, E as budgetCache, En as httpModelsCheck, Et as routerPort, S as applySessionProviderEnv, Sn as PORT_TIMEOUT_MS, St as removeRunSettings, Xt as committedFallThrough, Zt as fallThroughReason, _ as resolveTarget, _n as probeLoopback, _t as pinnedSettings, an as BATCH_ENV, bn as resolveRunnerProvider, dn as LOCAL_MECHANISM_LINE, dt as claudeCommand, fn as NoLocalServerError, ft as claudeSettingsExtra, g as resolveCapabilityRun, h as recordBudgetCooldowns, i as capabilityForRun, in as detectSessionName, k as budgetFull, l as isQuotaFailure, lt as addSchedulingHeaders, n as NoProviderError, nn as routeRun, o as cooldownRemaining, pt as isLoopbackProvider, r as autoOrder, sn as getProfile, u as nextAutoProvider, ut as buildRunEnv, v as setCooldown, vn as providerHostPort, x as SESSION_WORKER_PROVIDER_ENV, yn as resolveLocalProvider, yt as routeLoopbackViaRouter } from "./routing-CUyiglfu.mjs";
10
- import { b as readToolErrors, h as harnessToolErrorTexts, p as grantedToolNames, x as recordToolError } from "./tool-errors-AeRQuG3Y.mjs";
11
- import { _ as workerContractPrompt, b as killProcessTree, c as checkProof, d as parseWorkerReport, f as promptTrailer, g as verifyReportChanges, h as verifyFailNote, l as newUntracked, m as untrackedPaths, o as AG2_REASK_TEXT, s as OPERATOR_MARK, u as noteTokenSentence, v as repairAndValidateAg2, x as processTree, y as validateAg2 } from "./wait-BMUR-U-U.mjs";
12
- import { i as buildsDir, u as releaseBuildsOf } from "./caller-identity-CVTuiLSs.mjs";
13
- import { n as tierProviderNames, t as isLocalCandidate } from "./local-candidate-jOjTNlOL.mjs";
14
- import { c as queuedText, d as resolveCap, h as staggerGate, m as recordWarmup, n as capacityGate, p as sessionScopeKey, t as admitCap } from "./capacity-DaXrVj3J.mjs";
15
- import { t as LOCAL_PROBE_TIMEOUT_MS } from "./timeouts-OwEONmc8.mjs";
16
- import { i as getRegistryBackend } from "./factory-BtjbQ0np.mjs";
17
- import { c as ensureProxyRunning, i as detectCurrentModel, l as proxyPort } from "./launch-DgqQdAjI.mjs";
18
- import { A as tail, Et as openOwnedPane, Kt as isHandoffMessage, Q as NoTerminalError, Wt as deliverHandoff, Xt as localFailures, _ as troublePolicy, _t as paneTitle, at as headlessAllowed, d as aibrokerMessenger, f as detachRun, h as originFromEnv, ht as resolveHostSession, it as followCommand, m as markRunDone, mt as realPaneOps, nt as closePaneForWorker, o as ownerOf, p as eventLine, r as returnControlsIfHeld, ut as openVerifiedPane, v as appendRunLog, z as gatePhaseName } from "./controls-BGkK_Bdi.mjs";
19
- import { i as endFields, o as parentInfo, r as decideEndReason } from "./endreason-x1KOSrcO.mjs";
20
- import { A as resolveLimit, E as armDeadline, F as checkOrphanedChildren, I as isWorkerId, L as launchParent, M as blockedMsOf, O as deadlinePromptLine, P as assertChildAllowed, T as recordDenial, k as extendLimit, w as parseDenialText } from "./render-BDbb4CF-.mjs";
21
- import { t as createOperatorServer } from "./operator-DZxcP-g8.mjs";
22
- import { i as killTree } from "./kill-tree-BjYz5BxK.mjs";
23
- import { r as ensurePoolHost } from "./pool-cli-BxNSPzzY.mjs";
2
+ import { Ct as withSummary, I as LOOPBACK_HOST, N as resolveModelCapability, P as resolveProviderKey, St as sessionNote, bt as ledgerEscalate, c as WorkersConfigError, f as escalationCloud, ft as parseEntry, gt as certainContextWindow, h as isModelCapability, j as readWorkersSection, k as providerKeyPath, l as assertProviderRunnable, m as isLocalProvider, ot as applyRouteOverrides, p as getProviderOrNative, t as ANTHROPIC_NATIVE, tt as workersYamlPath, u as classModelCapability, v as nativeAnthropicModels, wt as appendLedger, xt as planEscalation } from "./config-XpZWOYOG.mjs";
3
+ import { _ as effectiveWorkersYamlRaw } from "./config-Bu1_vbY8.mjs";
4
+ import { i as ledgerPath, n as ensureNoMcpConfig, r as eventsPath, u as workersLogDir } from "./paths-CHifubDh.mjs";
5
+ import { A as applyScratchEnv, C as worktreeWanted, S as worktreeSystemPrompt, _ as ownedTree, a as archiveEmptyResult, f as gcWorktreesThrottled, h as markResumed, i as adoptTree, j as scratchPromptLine, o as commitLines, p as inPlaceSystemPrompt, r as addWorktree, t as GATE_MARK, v as recordWorktree, w as worktreesDir, x as worktreeRefusesStart, y as salvageOnExit } from "./worktree-CrnOqTBW.mjs";
6
+ import { C as nowStamp, D as pidAlive, E as parseSleepSecs, J as loadPreamble, Q as appendSystemPromptArgs, S as newWorkerId, X as preambleLine, Y as preambleBlock, Z as projectRoot, a as UNLABELED, d as describeTool, g as isLive, k as saveStatus, nt as shortText, rt as stripPromptValues, tt as parseRunnerArgs, v as loadStatus, x as markStartFailed, y as loadStatuses } from "./status-ggJ7lgVg.mjs";
7
+ import { D as readMcpServers, E as mcpServersFromToolGrants, O as writeMcpConfig, S as inputSideTokens, T as grantsChrome, d as poolIneligibleReason, g as postTaskToPool, h as poolSettings, n as SLOT_TOOLS, r as UNIT_MARKER, t as SHARED_MARKER, w as expandMcpNames, y as reloadInProgress } from "./pool-BRvoOkv6.mjs";
8
+ import { i as itermUuid, o as resolveSession, s as resolveSpawnerSession } from "./scope-D-h6F6DN.mjs";
9
+ import { Cn as PORT_TIMEOUT_MS, Ct as removeRunSettings, Dn as httpModelsCheck, Dt as routerPort, E as budgetCache, Qt as fallThroughReason, S as applySessionProviderEnv, Zt as committedFallThrough, _ as resolveTarget, an as detectSessionName, bn as resolveLocalProvider, bt as routeLoopbackViaRouter, cn as getProfile, dt as claudeCommand, fn as LOCAL_MECHANISM_LINE, ft as claudeSettingsExtra, g as resolveCapabilityRun, h as recordBudgetCooldowns, i as capabilityForRun, k as budgetFull, l as isQuotaFailure, lt as addSchedulingHeaders, n as NoProviderError, o as cooldownRemaining, on as BATCH_ENV, pn as NoLocalServerError, pt as isLoopbackProvider, r as autoOrder, rn as routeRun, u as nextAutoProvider, ut as buildRunEnv, v as setCooldown, vn as probeLoopback, vt as pinnedSettings, wt as writePrivateFile, x as SESSION_WORKER_PROVIDER_ENV, xn as resolveRunnerProvider, yn as providerHostPort } from "./routing-BAAST9vT.mjs";
10
+ import { t as maxOf } from "./min-max-DrSRUaWQ.mjs";
11
+ import { b as readToolErrors, h as harnessToolErrorTexts, p as grantedToolNames, x as recordToolError } from "./tool-errors-7E13StWd.mjs";
12
+ import { _ as workerContractPrompt, b as killProcessTree, c as checkProof, d as parseWorkerReport, f as promptTrailer, g as verifyReportChanges, h as verifyFailNote, l as newUntracked, m as untrackedPaths, o as AG2_REASK_TEXT, s as OPERATOR_MARK, u as noteTokenSentence, v as repairAndValidateAg2, x as processTree, y as validateAg2 } from "./wait-ByV0OyMZ.mjs";
13
+ import { a as buildsDir, d as releaseBuildsOf } from "./caller-identity-yLFb7CKq.mjs";
14
+ import { c as queuedText, d as resolveCap, h as staggerGate, m as recordWarmup, n as capacityGate, p as sessionScopeKey, t as admitCap } from "./capacity-DEveQdFV.mjs";
15
+ import { n as tierProviderNames, t as isLocalCandidate } from "./local-candidate-DLdwQt0s.mjs";
16
+ import { t as LOCAL_PROBE_TIMEOUT_MS } from "./timeouts-1MLooEBB.mjs";
17
+ import { i as getRegistryBackend } from "./factory-DjAAsqr_.mjs";
18
+ import { c as ensureProxyRunning, i as detectCurrentModel, l as proxyPort } from "./launch-Jh5NVeNe.mjs";
19
+ import { A as tail, Et as openOwnedPane, Kt as isHandoffMessage, Q as NoTerminalError, Wt as deliverHandoff, Xt as localFailures, _ as troublePolicy, _t as paneTitle, at as headlessAllowed, d as aibrokerMessenger, f as detachRun, h as originFromEnv, ht as resolveHostSession, it as followCommand, m as markRunDone, mt as realPaneOps, nt as closePaneForWorker, o as ownerOf, p as eventLine, r as returnControlsIfHeld, ut as openVerifiedPane, v as appendRunLog, z as gatePhaseName } from "./controls-BcKFHeG1.mjs";
20
+ import { i as endFields, o as parentInfo, r as decideEndReason } from "./endreason-C577xIQz.mjs";
21
+ import { A as resolveLimit, E as armDeadline, F as checkOrphanedChildren, I as isWorkerId, L as launchParent, M as blockedMsOf, O as deadlinePromptLine, P as assertChildAllowed, T as recordDenial, k as extendLimit, w as parseDenialText } from "./render-CwIrgxLi.mjs";
22
+ import { t as createOperatorServer } from "./operator-CyuB3aVw.mjs";
23
+ import { i as killTree } from "./kill-tree-EWYaEk5v.mjs";
24
+ import { r as ensurePoolHost } from "./pool-cli-B_YR8_Gl.mjs";
24
25
  import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, realpathSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
26
+ import { createHash, randomBytes } from "node:crypto";
25
27
  import { dirname, join, resolve, sep } from "node:path";
26
28
  import { tmpdir } from "node:os";
27
29
  import { execFileSync, spawn } from "node:child_process";
28
30
  import { fileURLToPath } from "node:url";
29
31
  import { parse } from "yaml";
30
- import { createHash, randomBytes } from "node:crypto";
31
32
  import { connect } from "node:net";
32
33
  import { createInterface } from "node:readline";
33
34
 
@@ -1284,7 +1285,7 @@ async function tryEscalate(a, wid, st, report, resultText, commits, failureWhy,
1284
1285
  notifySession: async (text) => {
1285
1286
  const target = st.session?.id || st.session?.name || st.sessionKey;
1286
1287
  if (!target) return;
1287
- const { sendToSession } = await import("./aibroker-client-JjE74jo0.mjs");
1288
+ const { sendToSession } = await import("./aibroker-client-BxzeEHPF.mjs");
1288
1289
  await sendToSession(target, text, void 0, { noReply: true });
1289
1290
  }
1290
1291
  });
@@ -1521,7 +1522,6 @@ function adoptInitModel(status, e) {
1521
1522
  function shouldRetryReport(validation, noReportRetry, hasSession) {
1522
1523
  return !validation.ok && validation.validator === "aibroker" && !noReportRetry && hasSession;
1523
1524
  }
1524
- /** Context window announced by the init event, when the endpoint sends one. */
1525
1525
  /**
1526
1526
  * An empty model response: the model "answered" without producing anything —
1527
1527
  * no tool ran and the result text is empty. A local model can stop at once with an empty reply;
@@ -1544,6 +1544,7 @@ function runSucceeded(headless, rc, resultEvent) {
1544
1544
  if (!headless) return true;
1545
1545
  return resultEvent !== null && !resultEvent.is_error;
1546
1546
  }
1547
+ /** Context window announced by the init event, when the endpoint sends one. */
1547
1548
  function initContextWindow(e) {
1548
1549
  if (typeof e.context_window === "number" && e.context_window > 0) return e.context_window;
1549
1550
  if (e.model_info && typeof e.model_info.context_window === "number" && e.model_info.context_window > 0) return e.model_info.context_window;
@@ -2449,8 +2450,9 @@ function computeSimilarity(s1, s2) {
2449
2450
  const s2Reversed = s2.split("").reverse().join("");
2450
2451
  for (let i = 0; i < minLength; i++) if (s1Reversed[i] === s2Reversed[i]) suffixLength++;
2451
2452
  else break;
2453
+ const overlapCap = minLength - prefixLength;
2452
2454
  const totalLength = Math.max(s1.length, s2.length);
2453
- return totalLength > 0 ? (prefixLength + suffixLength) / totalLength : 0;
2455
+ return (prefixLength + Math.min(suffixLength, overlapCap)) / totalLength;
2454
2456
  }
2455
2457
  function isEditAssistError(errorText) {
2456
2458
  return errorText.includes("No changes to make: old_string and new_string are exactly the same") || errorText.includes("String to replace not found in file");
@@ -2839,7 +2841,7 @@ function renderUsage(rep, opts) {
2839
2841
  ...body,
2840
2842
  ...totals
2841
2843
  ];
2842
- const w = head.map((_, i) => Math.max(...all.map((r) => r[i].length)));
2844
+ const w = head.map((_, i) => maxOf(all.map((r) => r[i].length)));
2843
2845
  const textCols = 2;
2844
2846
  const fmt = (r) => r.map((c, i) => i < textCols ? c.padEnd(w[i]) : c.padStart(w[i])).join(" ");
2845
2847
  return [
@@ -3410,10 +3412,10 @@ function resolveWorkers(args, ctx) {
3410
3412
  /** The live context: config, this session's profile, fresh budget readings (warmed best effort) and recorded cooldowns. */
3411
3413
  async function liveResolveCtx(env = process.env, warm = true) {
3412
3414
  const [{ readWorkersSection }, { budgetCache }, { readRoutingState }, { workersLogDir }] = await Promise.all([
3413
- import("./config-B955yYmo.mjs"),
3414
- import("./budget-DuhQ2zzG.mjs"),
3415
- import("./routing-ZuGlc0ge.mjs"),
3416
- import("./paths-DoRuFc60.mjs")
3415
+ import("./config-Cxi-aBf4.mjs"),
3416
+ import("./budget-Dod6rnA9.mjs"),
3417
+ import("./routing-CENt4HH1.mjs"),
3418
+ import("./paths-CFHTloSe.mjs")
3417
3419
  ]);
3418
3420
  const { workers } = readWorkersSection();
3419
3421
  const profile = getProfile(await detectSessionName(env));
@@ -4880,7 +4882,7 @@ async function runWorker(opts) {
4880
4882
  if (gc?.length) process.stderr.write(`pai worker: archived ${gc.length} leftover worktree(s) (pai worker gc)\n`);
4881
4883
  } catch {}
4882
4884
  if (opts.className === "plan" && !opts._planner) {
4883
- const { runPlanner } = await import("./planner-DLGOYlVb.mjs");
4885
+ const { runPlanner } = await import("./planner-BM27GBfC.mjs");
4884
4886
  return runPlanner(opts);
4885
4887
  }
4886
4888
  const parent = launchParent(opts.parent);
@@ -5104,4 +5106,4 @@ setRunWorker(runWorker);
5104
5106
 
5105
5107
  //#endregion
5106
5108
  export { routerPidFile as A, usageContextTokens as B, workerUsage as C, routerHandoverFile as D, probeRouter as E, startHandover as F, testProvider as H, paneWaiver as I, launchPane as L, routerSwapArgs as M, runRouterTick as N, routerIsStale as O, spawnRouter as P, noTerminalReasons as R, usageJson as S, projectLaunchConfig as T, endProcesses as U, printResult as V, findWorktreeOrphans as W, stopLaunchedWorkers as _, resolveWorkers as a, renderUsage as b, reportOriginWithHost as c, capture as d, dirtyPaths as f, realRunnerDeps as g, realCommitsAhead as h, liveResolveCtx as i, routerRunningPid as j, routerLogFile as k, runMessenger as l, mergeBranch as m, LocalProviderRefusedError as n, sessionWorkersLine as o, launchWorker as p, PoolRefusedError as r, finishDetached as s, runWorker as t, startDetached as u, parseWhen as v, pinNotices as w, transcriptUsage as x, priceTableText as y, recordSystemJobStart as z };
5107
- //# sourceMappingURL=run-ulAi5dFD.mjs.map
5109
+ //# sourceMappingURL=run-6Q9kCPem.mjs.map
@@ -1,10 +1,10 @@
1
1
  import { _ as warn, c as ok, i as err, n as dim, r as encodeDir, s as now, t as bold } from "./utils-J2b9y8PC.mjs";
2
2
  import { _ as resolvePaiFile, d as defaultPaiHomeDir, g as paiHomePath, m as migratePaiFile, u as claudeProjectsDir$1 } from "./runtime-paths-WsO9sJFc.mjs";
3
- import { a as slugify, i as parseSessionFilename, n as decodeEncodedDir, t as buildEncodedDirMap } from "./migrate-BUJHadA8.mjs";
4
- import { D as readJsonStrict, O as writeJsonAtomic, o as expandHome } from "./config-BSXKyeJ1.mjs";
5
- import { a as unregistrableReason, o as workerWorktreesRoot, r as pruneWorktreeProjects } from "./registrable-LrRIVYQc.mjs";
6
- import { n as ensurePaiMarker, t as discoverPaiMarkers } from "./pai-marker-kIYuNt3c.mjs";
7
- import { i as getRegistryBackend } from "./factory-BtjbQ0np.mjs";
3
+ import { a as slugify, i as parseSessionFilename, n as decodeEncodedDir, t as buildEncodedDirMap } from "./migrate-DrA_OwlZ.mjs";
4
+ import { D as readJsonStrict, O as writeJsonAtomic, o as expandHome } from "./config-Bu1_vbY8.mjs";
5
+ import { a as unregistrableReason, o as workerWorktreesRoot, r as pruneWorktreeProjects } from "./registrable-Uzgmfyhz.mjs";
6
+ import { n as ensurePaiMarker, t as discoverPaiMarkers } from "./pai-marker-DurzIbw8.mjs";
7
+ import { i as getRegistryBackend } from "./factory-DjAAsqr_.mjs";
8
8
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
9
9
  import { basename, join, resolve } from "node:path";
10
10
  import { homedir } from "node:os";
@@ -718,4 +718,4 @@ async function cmdScan(opts = {}) {
718
718
 
719
719
  //#endregion
720
720
  export { resolveHome as a, upsertSession as c, scanTranscriptFolders as d, transcriptFiles as f, performScan as i, claudeProjectsDir as l, loadScanConfig as n, saveScanConfig as o, migrateScanConfig as r, upsertProject as s, cmdScan as t, findMovedProjects as u };
721
- //# sourceMappingURL=scan-B7I0gPe-.mjs.map
721
+ //# sourceMappingURL=scan-ZQWm-_se.mjs.map