@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
package/dist/index.d.mts CHANGED
@@ -532,6 +532,24 @@ interface SearchOptions {
532
532
  /** Minimum BM25 score threshold (FTS5 scores are negative; 0.0 means no filter). */
533
533
  minScore?: number;
534
534
  }
535
+ /**
536
+ * Convert a free-text query into an FTS5 query string.
537
+ *
538
+ * Strategy:
539
+ * 1. Tokenise by whitespace and punctuation
540
+ * 2. Remove stop words and tokens shorter than 2 characters
541
+ * 3. Double-quote each remaining token (exact word form)
542
+ * 4. Join with OR so that any matching token returns a result
543
+ *
544
+ * Using OR instead of AND is critical for multi-word queries: the words rarely
545
+ * all appear in the same chunk, so AND would return zero results. FTS5 BM25
546
+ * scoring naturally ranks chunks where more terms match higher, so the most
547
+ * relevant chunks still surface at the top.
548
+ *
549
+ * Example: "Acme interview follow-up Alice"
550
+ * → `"acme" OR "interview" OR "follow" OR "alice"`
551
+ * → chunks matching any term, ranked by how many terms match
552
+ */
535
553
  declare function buildFtsQuery(query: string): string;
536
554
  /**
537
555
  * Populate the projectSlug field on search results by looking up project IDs
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  import "./utils-J2b9y8PC.mjs";
2
- import { a as slugify, i as parseSessionFilename, n as decodeEncodedDir, r as migrateFromJson } from "./migrate-BUJHadA8.mjs";
3
- import "./config-D5chi2LO.mjs";
4
- import "./config-BSXKyeJ1.mjs";
5
- import "./paths-DoIyRnhx.mjs";
6
- import "./worktree-zmRf556h.mjs";
7
- import "./status-CvVi9cDf.mjs";
8
- import "./pool-CZ5MZaXg.mjs";
9
- import "./registrable-LrRIVYQc.mjs";
10
- import { n as ensurePaiMarker, r as readPaiMarker, t as discoverPaiMarkers } from "./pai-marker-kIYuNt3c.mjs";
11
- import { d as estimateTokens, l as buildOutline, p as parseHeadings, r as detectTier, u as chunkMarkdown } from "./helpers-CJpb_MNB.mjs";
12
- import { i as populateSlugs, n as buildFtsQuery } from "./search-CPoE0830.mjs";
13
- import { n as rerankResults, t as configureRerankerModel } from "./reranker-DxxMCtA0.mjs";
2
+ import { a as slugify, i as parseSessionFilename, n as decodeEncodedDir, r as migrateFromJson } from "./migrate-DrA_OwlZ.mjs";
3
+ import "./config-XpZWOYOG.mjs";
4
+ import "./config-Bu1_vbY8.mjs";
5
+ import "./paths-CHifubDh.mjs";
6
+ import "./worktree-CrnOqTBW.mjs";
7
+ import "./status-ggJ7lgVg.mjs";
8
+ import "./pool-BRvoOkv6.mjs";
9
+ import "./registrable-Uzgmfyhz.mjs";
10
+ import { n as ensurePaiMarker, r as readPaiMarker, t as discoverPaiMarkers } from "./pai-marker-DurzIbw8.mjs";
11
+ import { d as estimateTokens, l as buildOutline, p as parseHeadings, r as detectTier, u as chunkMarkdown } from "./helpers-CRuBUas3.mjs";
12
+ import { i as populateSlugs, n as buildFtsQuery } from "./search-RSyeQqj1.mjs";
13
+ import { n as rerankResults, t as configureRerankerModel } from "./reranker-CqCbpGnX.mjs";
14
14
 
15
15
  export { buildFtsQuery, buildOutline, chunkMarkdown, configureRerankerModel, decodeEncodedDir, detectTier, discoverPaiMarkers, ensurePaiMarker, estimateTokens, migrateFromJson, parseHeadings, parseSessionFilename, populateSlugs, readPaiMarker, rerankResults, slugify };
@@ -1,21 +1,22 @@
1
1
  import { _ as resolvePaiFile, a as paiCacheDir, d as defaultPaiHomeDir, f as legacyConfigDir, g as paiHomePath, i as daemonPidPath, l as claudeHomeDir, m as migratePaiFile, u as claudeProjectsDir } from "./runtime-paths-WsO9sJFc.mjs";
2
- import { N as resolveModelCapability, d as defaultWorkersConfig, j as readWorkersSection, wt as appendLedger } from "./config-D5chi2LO.mjs";
3
- import { O as writeJsonAtomic, c as loadConfig, f as readMainConfigRaw, n as CONFIG_FILE, p as writeMainConfigRaw } from "./config-BSXKyeJ1.mjs";
4
- import { n as ensureNoMcpConfig, u as workersLogDir } from "./paths-DoIyRnhx.mjs";
5
- import { w as worktreesDir } from "./worktree-zmRf556h.mjs";
6
- import { B as loadStatusConfig, W as writeContinueToForge } from "./status-CvVi9cDf.mjs";
7
- import { i as itermUuid, l as sessionMapPath } from "./scope-D5VSQxe4.mjs";
8
- import { _ as resolveTarget, mt as loopbackRouterChoice, ut as buildRunEnv } from "./routing-CUyiglfu.mjs";
9
- import { i as getRegistryBackend, r as createStorageBackend } from "./factory-BtjbQ0np.mjs";
10
- import { c as ensureProxyRunning, l as proxyPort } from "./launch-DgqQdAjI.mjs";
11
- import { n as fetchLiveSessions, r as sendToSession } from "./aibroker-client-CXEYBzbf.mjs";
12
- import { E as probeRouter, z as recordSystemJobStart } from "./run-ulAi5dFD.mjs";
13
- import { bt as psTableOrNull } from "./controls-BGkK_Bdi.mjs";
2
+ import { t as writeFileAtomic } from "./atomic-file-BorMa4T3.mjs";
3
+ import { N as resolveModelCapability, d as defaultWorkersConfig, j as readWorkersSection, wt as appendLedger } from "./config-XpZWOYOG.mjs";
4
+ import { O as writeJsonAtomic, c as loadConfig, f as readMainConfigRaw, n as CONFIG_FILE, p as writeMainConfigRaw } from "./config-Bu1_vbY8.mjs";
5
+ import { n as ensureNoMcpConfig, u as workersLogDir } from "./paths-CHifubDh.mjs";
6
+ import { w as worktreesDir } from "./worktree-CrnOqTBW.mjs";
7
+ import { B as loadStatusConfig, W as writeContinueToForge } from "./status-ggJ7lgVg.mjs";
8
+ import { i as itermUuid, l as sessionMapPath } from "./scope-D-h6F6DN.mjs";
9
+ import { _ as resolveTarget, mt as loopbackRouterChoice, ut as buildRunEnv } from "./routing-BAAST9vT.mjs";
10
+ import { i as getRegistryBackend, r as createStorageBackend } from "./factory-DjAAsqr_.mjs";
11
+ import { c as ensureProxyRunning, l as proxyPort } from "./launch-Jh5NVeNe.mjs";
12
+ import { n as fetchLiveSessions, r as sendToSession } from "./aibroker-client-CQPGqLxL.mjs";
13
+ import { E as probeRouter, z as recordSystemJobStart } from "./run-6Q9kCPem.mjs";
14
+ import { bt as psTableOrNull } from "./controls-BcKFHeG1.mjs";
14
15
  import { createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
16
+ import { randomUUID } from "node:crypto";
15
17
  import { basename, delimiter, dirname, join } from "node:path";
16
18
  import { homedir, setPriority, userInfo } from "node:os";
17
19
  import { spawn, spawnSync } from "node:child_process";
18
- import { randomUUID } from "node:crypto";
19
20
  import { createInterface } from "node:readline";
20
21
  import { copyFileSync as copyFileSync$1, existsSync as existsSync$1, linkSync as linkSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, renameSync as renameSync$1, writeFileSync as writeFileSync$1 } from "fs";
21
22
  import { basename as basename$1, join as join$1, resolve as resolve$1 } from "path";
@@ -2156,6 +2157,10 @@ function findTodoPath(cwd) {
2156
2157
  * Session note creation, editing, checkpointing, renaming, and finalization.
2157
2158
  */
2158
2159
  /** Get or create the YYYY/MM subdirectory for the current month inside notesDir. */
2160
+ /** Local YYYY-MM-DD, consistent with the month directory. */
2161
+ function localDateString(now = /* @__PURE__ */ new Date()) {
2162
+ return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
2163
+ }
2159
2164
  function getMonthDir(notesDir) {
2160
2165
  const now = /* @__PURE__ */ new Date();
2161
2166
  const monthDir = join$1(notesDir, String(now.getFullYear()), String(now.getMonth() + 1).padStart(2, "0"));
@@ -2208,7 +2213,7 @@ function getCurrentNotePath(notesDir) {
2208
2213
  */
2209
2214
  function createSessionNote(notesDir, description) {
2210
2215
  const noteNumber = getNextNoteNumber(notesDir);
2211
- const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
2216
+ const date = localDateString();
2212
2217
  const monthDir = getMonthDir(notesDir);
2213
2218
  const filename = `${noteNumber} - ${date} - New Session.md`;
2214
2219
  const filepath = join$1(monthDir, filename);
@@ -2245,7 +2250,7 @@ function appendCheckpoint(notePath, checkpoint) {
2245
2250
  if (!existsSync$1(parentDir)) mkdirSync$1(parentDir, { recursive: true });
2246
2251
  const noteFilename = basename$1(notePath);
2247
2252
  const numberMatch = noteFilename.match(/^(\d+)/);
2248
- writeFileSync$1(notePath, `# Session ${numberMatch ? numberMatch[1] : "0000"}: Recovered\n\n**Date:** ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}\n**Status:** In Progress\n\n---\n\n## Work Done\n\n<!-- PAI will add completed work here during session -->\n\n---\n\n## Next Steps\n\n<!-- To be filled at session end -->\n\n---\n\n**Tags:** #Session\n`);
2253
+ writeFileSync$1(notePath, `# Session ${numberMatch ? numberMatch[1] : "0000"}: Recovered\n\n**Date:** ${localDateString()}\n**Status:** In Progress\n\n---\n\n## Work Done\n\n<!-- PAI will add completed work here during session -->\n\n---\n\n## Next Steps\n\n<!-- To be filled at session end -->\n\n---\n\n**Tags:** #Session\n`);
2249
2254
  console.error(`Recreated session note: ${noteFilename}`);
2250
2255
  } catch (err) {
2251
2256
  console.error(`Failed to recreate note: ${err}`);
@@ -2357,9 +2362,16 @@ function renameSessionNote(notePath, meaningfulName) {
2357
2362
  if (!match) return notePath;
2358
2363
  const [, noteNumber, date] = match;
2359
2364
  const titleCaseName = meaningfulName.replace(/[\/\\:\0]/g, " ").split(/[\s_-]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ").trim();
2360
- const newFilename = `${noteNumber.padStart(4, "0")} - ${date} - ${titleCaseName}.md`;
2361
- const newPath = join$1(dir, newFilename);
2365
+ const paddedNumber = noteNumber.padStart(4, "0");
2366
+ let newFilename = `${paddedNumber} - ${date} - ${titleCaseName}.md`;
2367
+ let newPath = join$1(dir, newFilename);
2362
2368
  if (newFilename === oldFilename) return notePath;
2369
+ if (existsSync$1(newPath)) {
2370
+ let n = 2;
2371
+ while (existsSync$1(join$1(dir, `${paiNumberedBase(paddedNumber, date, titleCaseName)} (${n}).md`))) n++;
2372
+ newFilename = `${paiNumberedBase(paddedNumber, date, titleCaseName)} (${n}).md`;
2373
+ newPath = join$1(dir, newFilename);
2374
+ }
2363
2375
  try {
2364
2376
  renameSync$1(notePath, newPath);
2365
2377
  console.error(`Renamed note: ${oldFilename} → ${newFilename}`);
@@ -2369,6 +2381,9 @@ function renameSessionNote(notePath, meaningfulName) {
2369
2381
  return notePath;
2370
2382
  }
2371
2383
  }
2384
+ function paiNumberedBase(num, date, name) {
2385
+ return `${num} - ${date} - ${name}`;
2386
+ }
2372
2387
  /**
2373
2388
  * Finalize session note — mark as complete, add summary, rename with meaningful name.
2374
2389
  * IDEMPOTENT: subsequent calls are no-ops if already finalized.
@@ -2387,10 +2402,10 @@ function finalizeSessionNote(notePath, summary) {
2387
2402
  content = content.replace("**Status:** In Progress", "**Status:** Completed");
2388
2403
  if (!content.includes("**Completed:**")) {
2389
2404
  const completionTime = (/* @__PURE__ */ new Date()).toISOString();
2390
- content = content.replace("---\n\n## Work Done", `**Completed:** ${completionTime}\n\n---\n\n## Work Done`);
2405
+ content = content.replace("---\n\n## Work Done", () => `**Completed:** ${completionTime}\n\n---\n\n## Work Done`);
2391
2406
  }
2392
2407
  const nextStepsMatch = content.match(/## Next Steps\n\n(<!-- .*? -->)/);
2393
- if (nextStepsMatch) content = content.replace(nextStepsMatch[0], `## Next Steps\n\n${summary || "Session completed."}`);
2408
+ if (nextStepsMatch) content = content.replace(nextStepsMatch[0], () => `## Next Steps\n\n${summary || "Session completed."}`);
2394
2409
  writeFileSync$1(notePath, content);
2395
2410
  console.error(`Session note finalized: ${basename$1(notePath)}`);
2396
2411
  const meaningfulName = extractMeaningfulName(content, summary);
@@ -2768,6 +2783,8 @@ function findClaudeBinary() {
2768
2783
  } catch {}
2769
2784
  return "claude";
2770
2785
  }
2786
+ const KILL_GRACE_MS = 3e3;
2787
+ const MAX_STDOUT_BYTES = 8 * 1024 * 1024;
2771
2788
  /**
2772
2789
  * Spawn the claude CLI with a prompt on stdin and return stdout.
2773
2790
  *
@@ -2793,6 +2810,8 @@ async function spawnClaude(prompt, tier = "sonnet") {
2793
2810
  recordSystemJobStart("kg-extraction");
2794
2811
  return new Promise((resolve) => {
2795
2812
  let timer = null;
2813
+ let killTimer = null;
2814
+ let settled = false;
2796
2815
  const child = spawn(claudeBin, plan.args, {
2797
2816
  env: plan.env,
2798
2817
  stdio: [
@@ -2801,39 +2820,64 @@ async function spawnClaude(prompt, tier = "sonnet") {
2801
2820
  "pipe"
2802
2821
  ]
2803
2822
  });
2823
+ const finish = (value) => {
2824
+ if (settled) return;
2825
+ settled = true;
2826
+ if (timer) {
2827
+ clearTimeout(timer);
2828
+ timer = null;
2829
+ }
2830
+ resolve(value);
2831
+ };
2832
+ const terminate = () => {
2833
+ child.kill("SIGTERM");
2834
+ killTimer = setTimeout(() => {
2835
+ child.kill("SIGKILL");
2836
+ }, KILL_GRACE_MS);
2837
+ killTimer.unref();
2838
+ };
2804
2839
  let stdout = "";
2840
+ let stdoutBytes = 0;
2805
2841
  let stderr = "";
2806
2842
  child.stdout.on("data", (chunk) => {
2843
+ if (settled) return;
2844
+ stdoutBytes += chunk.length;
2845
+ if (stdoutBytes > MAX_STDOUT_BYTES) {
2846
+ process.stderr.write(`[kg-extraction] ${plan.model} stdout exceeded ${MAX_STDOUT_BYTES} bytes — killing process.\n`);
2847
+ stdout = "";
2848
+ finish(null);
2849
+ terminate();
2850
+ return;
2851
+ }
2807
2852
  stdout += chunk.toString();
2808
2853
  });
2809
2854
  child.stderr.on("data", (chunk) => {
2810
- stderr += chunk.toString();
2855
+ if (stderr.length < 4096) stderr += chunk.toString();
2856
+ });
2857
+ child.stdin.on("error", (err) => {
2858
+ process.stderr.write(`[kg-extraction] ${plan.model} stdin error: ${err.message}\n`);
2811
2859
  });
2812
2860
  child.on("error", (err) => {
2813
- if (timer) {
2814
- clearTimeout(timer);
2815
- timer = null;
2816
- }
2817
2861
  process.stderr.write(`[kg-extraction] ${plan.model} spawn error: ${err.message}\n`);
2818
- resolve(null);
2862
+ finish(null);
2819
2863
  });
2820
2864
  child.on("close", (code) => {
2821
- if (timer) {
2822
- clearTimeout(timer);
2823
- timer = null;
2865
+ if (killTimer) {
2866
+ clearTimeout(killTimer);
2867
+ killTimer = null;
2824
2868
  }
2869
+ if (settled) return;
2825
2870
  if (code !== 0) {
2826
2871
  process.stderr.write(`[kg-extraction] ${plan.model} exited ${code}: ${stderr.slice(0, 300)}\n`);
2827
- resolve(null);
2828
- } else resolve(stdout.trim() || null);
2872
+ finish(null);
2873
+ } else finish(stdout.trim() || null);
2829
2874
  });
2830
2875
  timer = setTimeout(() => {
2831
2876
  process.stderr.write(`[kg-extraction] ${plan.model} timed out — killing process.\n`);
2832
- child.kill("SIGTERM");
2833
- resolve(null);
2877
+ finish(null);
2878
+ terminate();
2834
2879
  }, plan.timeoutMs);
2835
- child.stdin.write(prompt);
2836
- child.stdin.end();
2880
+ child.stdin.end(prompt);
2837
2881
  });
2838
2882
  }
2839
2883
  /**
@@ -3992,8 +4036,9 @@ function enqueueCoalesced(params, windowMs, now = Date.now()) {
3992
4036
  * Walks `Notes/YYYY/MM/*.md` for each registered project, runs the same
3993
4037
  * extractor that the session-summary-worker uses on every NEW summary, and
3994
4038
  * stores triples in Postgres. Idempotent: a state file at
3995
- * ~/.config/pai/kg-backfill-state.json records which note paths have been
3996
- * processed so re-runs skip them.
4039
+ * <pai home>/kg-backfill-state.json records which note paths have been
4040
+ * processed so re-runs skip them. Failed extractions are recorded with a
4041
+ * retry-after time so a note the extractor rejects is not retried every run.
3997
4042
  *
3998
4043
  * Even without the state file the operation is safe — extractAndStoreTriples
3999
4044
  * uses supersession logic so re-extracting a note never produces duplicates.
@@ -4007,6 +4052,8 @@ function statePath() {
4007
4052
  function migrateKgBackfillState(opts = {}) {
4008
4053
  return migratePaiFile(paiHomePath("kg-backfill-state.json"), [oldStateFile()], opts);
4009
4054
  }
4055
+ /** How long a note whose extraction failed is left alone. */
4056
+ const FAILED_RETRY_MS = 1440 * 60 * 1e3;
4010
4057
  function loadState() {
4011
4058
  try {
4012
4059
  const file = statePath();
@@ -4022,7 +4069,7 @@ function saveState(state) {
4022
4069
  const file = paiHomePath("kg-backfill-state.json");
4023
4070
  const dir = dirname(file);
4024
4071
  if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
4025
- writeFileSync(file, JSON.stringify(state, null, 2), "utf-8");
4072
+ writeFileAtomic(file, JSON.stringify(state, null, 2));
4026
4073
  } catch (e) {
4027
4074
  process.stderr.write(`[kg-backfill] failed to save state: ${e}\n`);
4028
4075
  }
@@ -4081,67 +4128,73 @@ async function backfillKgFromNotes(options = {}) {
4081
4128
  if (config.storageBackend !== "postgres") throw new Error(`kg backfill requires the Postgres backend. Set "storageBackend": "postgres" in ${CONFIG_FILE}.`);
4082
4129
  const backend = await createStorageBackend(config);
4083
4130
  if (!backend.supportsPostgresFeatures) throw new Error("Postgres backend unavailable — fell back to SQLite. Cannot backfill KG.");
4084
- const registry = await getRegistryBackend();
4085
- let projects;
4086
- if (options.projectSlug) {
4087
- const row = await registry.getProjectBySlug(options.projectSlug);
4088
- if (!row) throw new Error(`Project not found: ${options.projectSlug}`);
4089
- projects = [row];
4090
- } else projects = await registry.listProjects({
4091
- status: "active",
4092
- orderBy: "slug"
4093
- });
4094
- const state = loadState();
4095
- const work = [];
4096
- for (const project of projects) {
4097
- const notes = findProjectNotes(project);
4098
- for (const notePath of notes) {
4099
- if (state.processed[notePath]) continue;
4100
- work.push({
4101
- project,
4102
- notePath
4103
- });
4104
- }
4105
- }
4106
- const total = options.limit ? Math.min(options.limit, work.length) : work.length;
4107
- for (let i = 0; i < total; i++) {
4108
- const { project, notePath } = work[i];
4109
- options.onProgress?.(i + 1, total, notePath);
4110
- if (options.dryRun) {
4111
- result.notes_processed++;
4112
- continue;
4113
- }
4114
- let noteContent;
4115
- try {
4116
- noteContent = readFileSync(notePath, "utf-8");
4117
- } catch (e) {
4118
- process.stderr.write(`[kg-backfill] read failed ${notePath}: ${e}\n`);
4119
- result.errors++;
4120
- continue;
4131
+ try {
4132
+ const registry = await getRegistryBackend();
4133
+ let projects;
4134
+ if (options.projectSlug) {
4135
+ const row = await registry.getProjectBySlug(options.projectSlug);
4136
+ if (!row) throw new Error(`Project not found: ${options.projectSlug}`);
4137
+ projects = [row];
4138
+ } else projects = await registry.listProjects({
4139
+ status: "active",
4140
+ orderBy: "slug"
4141
+ });
4142
+ const state = loadState();
4143
+ const work = [];
4144
+ for (const project of projects) {
4145
+ const notes = findProjectNotes(project);
4146
+ for (const notePath of notes) {
4147
+ if (state.processed[notePath]) continue;
4148
+ if ((state.failedRetryAfter?.[notePath] ?? 0) > Date.now()) continue;
4149
+ work.push({
4150
+ project,
4151
+ notePath
4152
+ });
4153
+ }
4121
4154
  }
4122
- try {
4123
- const stats = await extractAndStoreTriples$1(backend, {
4124
- summaryText: noteContent,
4125
- projectSlug: project.slug,
4126
- projectId: project.id,
4127
- sessionId: `backfill:${notePath}`,
4128
- gitLog: "",
4129
- model: "sonnet"
4130
- });
4131
- result.notes_processed++;
4132
- result.triples_extracted += stats.extracted;
4133
- result.triples_added += stats.added;
4134
- result.triples_superseded += stats.superseded;
4135
- state.processed[notePath] = (/* @__PURE__ */ new Date()).toISOString();
4136
- if ((i + 1) % 5 === 0) saveState(state);
4137
- } catch (e) {
4138
- process.stderr.write(`[kg-backfill] extract failed ${notePath}: ${e}\n`);
4139
- result.errors++;
4155
+ const total = options.limit ? Math.min(options.limit, work.length) : work.length;
4156
+ for (let i = 0; i < total; i++) {
4157
+ const { project, notePath } = work[i];
4158
+ options.onProgress?.(i + 1, total, notePath);
4159
+ if (options.dryRun) {
4160
+ result.notes_processed++;
4161
+ continue;
4162
+ }
4163
+ let noteContent;
4164
+ try {
4165
+ noteContent = readFileSync(notePath, "utf-8");
4166
+ } catch (e) {
4167
+ process.stderr.write(`[kg-backfill] read failed ${notePath}: ${e}\n`);
4168
+ result.errors++;
4169
+ continue;
4170
+ }
4171
+ try {
4172
+ const stats = await extractAndStoreTriples$1(backend, {
4173
+ summaryText: noteContent,
4174
+ projectSlug: project.slug,
4175
+ projectId: project.id,
4176
+ sessionId: `backfill:${notePath}`,
4177
+ gitLog: "",
4178
+ model: "sonnet"
4179
+ });
4180
+ result.notes_processed++;
4181
+ result.triples_extracted += stats.extracted;
4182
+ result.triples_added += stats.added;
4183
+ result.triples_superseded += stats.superseded;
4184
+ state.processed[notePath] = (/* @__PURE__ */ new Date()).toISOString();
4185
+ if (state.failedRetryAfter) delete state.failedRetryAfter[notePath];
4186
+ if ((i + 1) % 5 === 0) saveState(state);
4187
+ } catch (e) {
4188
+ process.stderr.write(`[kg-backfill] extract failed ${notePath}: ${e}\n`);
4189
+ result.errors++;
4190
+ (state.failedRetryAfter ??= {})[notePath] = Date.now() + FAILED_RETRY_MS;
4191
+ }
4140
4192
  }
4193
+ if (!options.dryRun) saveState(state);
4194
+ return result;
4195
+ } finally {
4196
+ await backend.close();
4141
4197
  }
4142
- if (!options.dryRun) saveState(state);
4143
- await backend.close();
4144
- return result;
4145
4198
  }
4146
4199
 
4147
4200
  //#endregion
@@ -4289,4 +4342,4 @@ function reexecBackground() {
4289
4342
 
4290
4343
  //#endregion
4291
4344
  export { setStartTime as $, indexSchedulerTimer as A, readQuiet as At, setDaemonConfig as B, appendCheckpointToNote as Bt, migrateSummaryCooldowns as C, runSessionKeepaliveTick as Ct, embedInProgress as D, deferIfQuiet as Dt, daemonConfig as E, totalUsageTokens as Et, lastVaultIndexTime as F, removeDaemonPidfile as Ft, setLastEmbedPass as G, restartRouter as Gt, setEmbedSchedulerTimer as H, findLatestNote as Ht, notificationConfig as I, resolveDaemonPid as It, setLastIndexTime as J, setLastEmbedTime as K, passFailures as L, writeDaemonPidfile as Lt, lastEmbedTime as M, startQuietWatcher as Mt, lastIndexPass as N, writeQuiet as Nt, embedSchedulerTimer as O, describeQuiet as Ot, lastIndexTime as P, LAUNCHD_LABEL as Pt, setShutdownRequested as Q, registryBackend as R, readContextHandoverCache as Rt, handleSessionSummary as S, loadSessionKeepaliveState as St, cacheKeepaliveTimer as T, parseSessionUsage as Tt, setIndexInProgress as U, findNotesDir$1 as Ut, setEmbedInProgress as V, applyContinue as Vt, setIndexSchedulerTimer as W, readBodyFile as Wt, setNotificationConfig as X, setLastVaultIndexTime as Y, setRegistryBackend as Z, markFailed as _, buildWakeupContext as _t, runPassChild as a, vaultIndexInProgress as at, findLatestJsonl as b, reapJob as bt, NonRetryableError as c, addWorkToSessionNote as ct, enqueue as d, getCurrentNotePath as dt, setStorageBackend as et, enqueueCoalesced as f, archiveSessionFilesToSessionsDir as ft, markCompleted as g, vaultIndexEnabled as gt, loadQueue as h, obsidianEnabled as ht, reexecBackground as i, storageBackend as it, lastEmbedPass as j, registerQuietRunner as jt, indexInProgress as k, nextOccurrence as kt, cleanup as l, appendCheckpoint as lt, hasPendingOrProcessingOfType as m, OBSIDIAN_DISABLED_MESSAGE as mt, buildPassCommand as n, shutdownRequested as nt, backfillKgFromNotes as o, sessionIdFromTranscript as ot, getStats as p, findNotesDir as pt, setLastIndexPass as q, cliEntry as r, startTime as rt, migrateKgBackfillState as s, updateTodoContinue as st, PassSpawnError as t, setVaultIndexInProgress as tt, dequeue as u, finalizeSessionNote as ut, migrateWorkQueue as v, migrateIdentityFile as vt, spawnSummarizer as w, sessionKeepaliveLedgerSummary as wt, getGitContext as x, sweepOrphans as xt, contentToText as y, jobPaths as yt, setCacheKeepaliveTimer as z, writeContextHandoverCache as zt };
4292
- //# sourceMappingURL=indexer-backend-BM2CUSu8.mjs.map
4345
+ //# sourceMappingURL=indexer-backend-_a6UNhXJ.mjs.map
@@ -155,4 +155,4 @@ var PaiClient = class {
155
155
 
156
156
  //#endregion
157
157
  export { PaiClient as n, IPC_SOCKET_PATH as t };
158
- //# sourceMappingURL=ipc-client-BMqWw_gv.mjs.map
158
+ //# sourceMappingURL=ipc-client-CaiGJnSM.mjs.map
@@ -1,3 +1,3 @@
1
- import { n as PaiClient, t as IPC_SOCKET_PATH } from "./ipc-client-BMqWw_gv.mjs";
1
+ import { n as PaiClient, t as IPC_SOCKET_PATH } from "./ipc-client-CaiGJnSM.mjs";
2
2
 
3
3
  export { IPC_SOCKET_PATH, PaiClient };
@@ -0,0 +1,10 @@
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 "./caller-identity-yLFb7CKq.mjs";
7
+ import "./endreason-C577xIQz.mjs";
8
+ import { i as killTree, n as isOwner, r as killRefusal, t as descendantsLeavesFirst } from "./kill-tree-EWYaEk5v.mjs";
9
+
10
+ export { killTree };
@@ -1,9 +1,9 @@
1
- import { wt as appendLedger } from "./config-D5chi2LO.mjs";
2
- import { i as ledgerPath } from "./paths-DoIyRnhx.mjs";
3
- import { D as pidAlive, P as waitForTerminalStatus, k as saveStatus, v as loadStatus, w as ownsPid, y as loadStatuses } from "./status-CvVi9cDf.mjs";
4
- import { i as itermUuid } from "./scope-D5VSQxe4.mjs";
5
- import { i as buildsDir, t as callerIdentity, u as releaseBuildsOf } from "./caller-identity-CVTuiLSs.mjs";
6
- import { n as callerDescription, s as requestKill, t as appendStopEvent } from "./endreason-x1KOSrcO.mjs";
1
+ import { wt as appendLedger } from "./config-XpZWOYOG.mjs";
2
+ import { i as ledgerPath } from "./paths-CHifubDh.mjs";
3
+ import { D as pidAlive, P as waitForTerminalStatus, k as saveStatus, v as loadStatus, w as ownsPid, y as loadStatuses } from "./status-ggJ7lgVg.mjs";
4
+ import { i as itermUuid } from "./scope-D-h6F6DN.mjs";
5
+ import { a as buildsDir, d as releaseBuildsOf, t as callerIdentity } from "./caller-identity-yLFb7CKq.mjs";
6
+ import { n as callerDescription, s as requestKill, t as appendStopEvent } from "./endreason-C577xIQz.mjs";
7
7
  import { readFileSync } from "node:fs";
8
8
  import { join } from "node:path";
9
9
  import { homedir } from "node:os";
@@ -25,7 +25,7 @@ const defaultDeps = () => ({
25
25
  waitTerminal: (dir, id) => waitForTerminalStatus(dir, id),
26
26
  request: (dir, ledger, id, forced, by, reason) => requestKill(dir, ledger, id, by ?? callerDescription(), forced === true, reason),
27
27
  notifyOwner: async (session, text) => {
28
- const { sendToSession } = await import("./aibroker-client-JjE74jo0.mjs");
28
+ const { sendToSession } = await import("./aibroker-client-BxzeEHPF.mjs");
29
29
  await sendToSession(session, text, void 0, { noReply: true });
30
30
  },
31
31
  graceMs: 1e3
@@ -257,4 +257,4 @@ async function killTree(logDir, id, opts = {}) {
257
257
 
258
258
  //#endregion
259
259
  export { killTree as i, isOwner as n, killRefusal as r, descendantsLeavesFirst as t };
260
- //# sourceMappingURL=kill-tree-BjYz5BxK.mjs.map
260
+ //# sourceMappingURL=kill-tree-EWYaEk5v.mjs.map
@@ -1,6 +1,6 @@
1
1
  import { i as err } from "./utils-J2b9y8PC.mjs";
2
- import { j as readWorkersSection, t as ANTHROPIC_NATIVE, vt as stripModelVariant } from "./config-D5chi2LO.mjs";
3
- import { b as SESSION_PROVIDER_ENV, bt as routeVerdictLine, dt as claudeCommand, gt as nativeRoutePreflight, ht as nativeLaunchSettingsArgs, ut as buildRunEnv, vt as pinnedSettingsArgs } from "./routing-CUyiglfu.mjs";
2
+ import { j as readWorkersSection, t as ANTHROPIC_NATIVE, vt as stripModelVariant } from "./config-XpZWOYOG.mjs";
3
+ import { _t as nativeRoutePreflight, b as SESSION_PROVIDER_ENV, dt as claudeCommand, gt as nativeLaunchSettingsArgs, ht as nativeLaunchEnv, ut as buildRunEnv, xt as routeVerdictLine, yt as pinnedSettingsArgs } from "./routing-BAAST9vT.mjs";
4
4
  import { closeSync, copyFileSync, existsSync, fstatSync, linkSync, openSync, readSync, realpathSync } from "node:fs";
5
5
  import { join } from "node:path";
6
6
  import chalk from "chalk";
@@ -228,7 +228,7 @@ function probeResume(uuid, cwd, home) {
228
228
  ], {
229
229
  cwd,
230
230
  timeout: 3e4,
231
- env: process.env,
231
+ env: nativeLaunchEnv(),
232
232
  stdio: [
233
233
  "ignore",
234
234
  "ignore",
@@ -617,7 +617,7 @@ function launchInDir(dir, name, opts = {}) {
617
617
  ], opts.dryRun), {
618
618
  cwd,
619
619
  stdio: "inherit",
620
- env: process.env
620
+ env: nativeLaunchEnv()
621
621
  });
622
622
  if (result.error) {
623
623
  console.error(err(`Failed to launch pai launch: ${result.error.message}`));
@@ -665,7 +665,7 @@ function launchInDir(dir, name, opts = {}) {
665
665
  const result = spawnSync("pai", workerRunArgv(name, cwd), {
666
666
  cwd,
667
667
  stdio: "inherit",
668
- env: process.env
668
+ env: nativeLaunchEnv()
669
669
  });
670
670
  if (result.error) {
671
671
  console.error(err(`Failed to launch pai worker run: ${result.error.message}`));
@@ -685,7 +685,7 @@ function launchInDir(dir, name, opts = {}) {
685
685
  ], {
686
686
  cwd,
687
687
  stdio: "inherit",
688
- env: process.env
688
+ env: nativeLaunchEnv()
689
689
  });
690
690
  if (result.error) {
691
691
  console.error(err(`Failed to launch claude: ${result.error.message}`));
@@ -720,7 +720,7 @@ function launchInDir(dir, name, opts = {}) {
720
720
  ], {
721
721
  cwd,
722
722
  stdio: "inherit",
723
- env: process.env
723
+ env: nativeLaunchEnv()
724
724
  });
725
725
  if (result.error) {
726
726
  console.error(err(`Failed to launch claude: ${result.error.message}`));
@@ -740,4 +740,4 @@ function launchInDir(dir, name, opts = {}) {
740
740
 
741
741
  //#endregion
742
742
  export { providerResumePlan as a, resumeOfferBlock as c, printExitDir as d, probeResume as i, resumeRouteFor as l, launchInDir as n, restoreTopLevel as o, launchPrompt as r, resumeArgvText as s, hasConversation as t, transcriptModelFor as u };
743
- //# sourceMappingURL=launch-CLp0OJxV.mjs.map
743
+ //# sourceMappingURL=launch-CXVlZjHt.mjs.map
@@ -1,5 +1,5 @@
1
- import { I as LOOPBACK_HOST, _ as maskKey, a as MODEL_CAPABILITIES, b as nativeOrchestratorModel, c as WorkersConfigError, j as readWorkersSection, p as getProviderOrNative, t as ANTHROPIC_NATIVE, y as nativeAnthropicProvider } from "./config-D5chi2LO.mjs";
2
- import { b as SESSION_PROVIDER_ENV, gt as nativeRoutePreflight, ut as buildRunEnv, vt as pinnedSettingsArgs } from "./routing-CUyiglfu.mjs";
1
+ import { I as LOOPBACK_HOST, _ as maskKey, a as MODEL_CAPABILITIES, b as nativeOrchestratorModel, c as WorkersConfigError, j as readWorkersSection, p as getProviderOrNative, t as ANTHROPIC_NATIVE, y as nativeAnthropicProvider } from "./config-XpZWOYOG.mjs";
2
+ import { _t as nativeRoutePreflight, b as SESSION_PROVIDER_ENV, ut as buildRunEnv, yt as pinnedSettingsArgs } from "./routing-BAAST9vT.mjs";
3
3
  import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
4
4
  import { dirname, join } from "node:path";
5
5
  import { spawn } from "node:child_process";
@@ -258,4 +258,4 @@ function maskLaunchEnv(env) {
258
258
 
259
259
  //#endregion
260
260
  export { detectCurrentProviderName as a, ensureProxyRunning as c, detectCurrentModel as i, proxyPort as l, buildLaunchPlan as n, launchableProviderNames as o, buildLaunchRows as r, maskLaunchEnv as s, LaunchError as t, stopProxy as u };
261
- //# sourceMappingURL=launch-DgqQdAjI.mjs.map
261
+ //# sourceMappingURL=launch-Jh5NVeNe.mjs.map