@tekmidian/pai 1.0.5 → 1.0.6

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 (239) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/{aibroker-client-CQPGqLxL.mjs → aibroker-client-CXsyC7A8.mjs} +2 -2
  3. package/dist/aibroker-client-ChB7gSxV.mjs +3 -0
  4. package/dist/auto-route-Bc8xP6TQ.mjs +11 -0
  5. package/dist/{auto-route-DUYr57rs.mjs → auto-route-YaEGVrFl.mjs} +2 -2
  6. package/dist/budget-DEiebT2A.mjs +15 -0
  7. package/dist/{caller-identity-Bim8JT-D.mjs → caller-identity-C6Nc96iM.mjs} +4 -4
  8. package/dist/{capacity-CsZMkVyg.mjs → capacity-B2PgKAg4.mjs} +65 -5
  9. package/dist/{chain-Dzz6xcKH.mjs → chain-CtK49-Ma.mjs} +5 -5
  10. package/dist/cli/index.mjs +2102 -282
  11. package/dist/{cockpit-actions-BgsiNcUY.mjs → cockpit-actions-C73mJAJ8.mjs} +18 -18
  12. package/dist/{cockpit-actions-BTA1njMO.mjs → cockpit-actions-D1OPP6Es.mjs} +26 -26
  13. package/dist/cockpit-memory-CLHZD64W.mjs +20 -0
  14. package/dist/config/defaults/config.yaml +18 -1
  15. package/dist/{config-CST2uq1v.mjs → config-Bz8pAU5Q.mjs} +3 -3
  16. package/dist/{config-Dv3t7xnT.mjs → config-DHgPx3ER.mjs} +1 -1
  17. package/dist/{config-h5qK3fst.mjs → config-DLmyEK2q.mjs} +2 -2
  18. package/dist/{config-DYbyEe4-.mjs → config-SlZ-Z52i.mjs} +3 -2
  19. package/dist/{controls-OiVVbe-f.mjs → controls-rIItFeIJ.mjs} +59 -66
  20. package/dist/daemon/index.mjs +40 -40
  21. package/dist/daemon-176qA79N.mjs +46 -0
  22. package/dist/{daemon-C1dycZ3W.mjs → daemon-SoUvPUOf.mjs} +79 -31
  23. package/dist/daemon-mcp/index.mjs +49 -38
  24. package/dist/detect-C8nFP-kR.mjs +10 -0
  25. package/dist/{detect-CHuxFrLy.mjs → detect-DLjeYwnt.mjs} +2 -2
  26. package/dist/{embed-pass-DtVF2fOV.mjs → embed-pass-CN1D8MXl.mjs} +5 -5
  27. package/dist/{embedding-gate-B98PK_wz.mjs → embedding-gate-BVQvUmox.mjs} +2 -2
  28. package/dist/{embedding-gate-CTAk8STe.mjs → embedding-gate-iq0oQEkF.mjs} +3 -3
  29. package/dist/{endreason-BqyyU7BH.mjs → endreason-C2-hYK0_.mjs} +4 -4
  30. package/dist/{factory-BV0MQA3T.mjs → factory-CYwa0jYj.mjs} +6 -6
  31. package/dist/factory-DFwez99M.mjs +9 -0
  32. package/dist/{fallback-Bj2cyVk_.mjs → fallback-CwPSCrX8.mjs} +9 -231
  33. package/dist/{health-kufVIf6i.mjs → health-D0mUAVdw.mjs} +5 -5
  34. package/dist/{helpers-CvbYEKoD.mjs → helpers-Dj2nY56t.mjs} +2 -2
  35. package/dist/{helpers-WV8tdQHM.mjs → helpers-DyHKAwrW.mjs} +6 -6
  36. package/dist/hooks/capture-all-events.mjs +68 -3
  37. package/dist/hooks/capture-tool-output.mjs +68 -3
  38. package/dist/hooks/handoff-link.mjs +128 -0
  39. package/dist/hooks/load-project-context.mjs +1 -1
  40. package/dist/hooks/security-validator.mjs +840 -88
  41. package/dist/hooks/supervision-banner.mjs +186 -48
  42. package/dist/hooks/worker-guard.mjs +57 -1
  43. package/dist/hooks/worker-note.mjs +68 -3
  44. package/dist/hooks/worker-pool-host.mjs +1417 -224
  45. package/dist/hooks/worker-status-line.mjs +209 -70
  46. package/dist/index.mjs +9 -9
  47. package/dist/{ipc-client-CnYEF31R.mjs → ipc-client-CmagIFLh.mjs} +2 -2
  48. package/dist/{ipc-client-DN7EvoVo.mjs → ipc-client-DmbSIBUK.mjs} +1 -1
  49. package/dist/{kill-tree-CcpsRLCZ.mjs → kill-tree-DPiMscaY.mjs} +8 -8
  50. package/dist/kill-tree-Dxei6qlR.mjs +10 -0
  51. package/dist/{launch-UPQBoW2q.mjs → launch-BZT3JDoZ.mjs} +3 -3
  52. package/dist/{launch-DpQPZGsT.mjs → launch-Bn2Zf90h.mjs} +3 -3
  53. package/dist/{indexer-backend-B2vtFl38.mjs → lessons-CFVU0cwA.mjs} +262 -43
  54. package/dist/{local-candidate-Cp_bw4kK.mjs → local-candidate-DFd4pp-w.mjs} +3 -3
  55. package/dist/{local-instances-bdCNNSsL.mjs → local-instances-DhF4_sV2.mjs} +2 -2
  56. package/dist/{local-instances-B-c-CxzP.mjs → local-instances-KTh8IeOT.mjs} +4 -4
  57. package/dist/{local-tiers-BtdEEe5n.mjs → local-tiers-CqwGUcEn.mjs} +3 -3
  58. package/dist/{local-tiers-OBqAAfOg.mjs → local-tiers-DSlIYvvm.mjs} +3 -3
  59. package/dist/{main-config-ops-BYsK3BxM.mjs → main-config-ops-rda08BCD.mjs} +3 -3
  60. package/dist/{main-resolver-CAC3xfZM.mjs → main-resolver-BKwI0I6H.mjs} +18 -18
  61. package/dist/{migrate-DrA_OwlZ.mjs → migrate-C2z1YmWC.mjs} +2 -2
  62. package/dist/{model-inventory-BuTpi9a6.mjs → model-inventory-BXv15B0d.mjs} +13 -13
  63. package/dist/{models-add-CJx2YAwh.mjs → models-add-5yXTyz3g.mjs} +38 -38
  64. package/dist/operator-Bmv5tiHQ.mjs +7 -0
  65. package/dist/{operator-DrwWItVt.mjs → operator-Br6GeswF.mjs} +2 -2
  66. package/dist/{pai-marker-DLKJ9Yr5.mjs → pai-marker-D6OoVbM_.mjs} +2 -2
  67. package/dist/{pane-audit-wv9UkyCe.mjs → pane-audit-DLYy9-4g.mjs} +13 -23
  68. package/dist/{paths-DS5VQKoR.mjs → paths-CypxFTfn.mjs} +4 -4
  69. package/dist/{paths-DBd78I7Z.mjs → paths-DIOwNcj-.mjs} +3 -3
  70. package/dist/{planner-K0mFrCpL.mjs → planner-BzZ_2lc-.mjs} +29 -29
  71. package/dist/{pool-BZ94nFuq.mjs → pool-9EsbKD-U.mjs} +2 -2
  72. package/dist/{pool-cli-BjYQDfx6.mjs → pool-cli-Cy5mlycP.mjs} +6 -6
  73. package/dist/{pool-cli-B1eKySeN.mjs → pool-cli-Db0uDwB9.mjs} +5 -5
  74. package/dist/{postgres-CBHY5PIi.mjs → postgres-B1B80bcj.mjs} +3 -3
  75. package/dist/{postgres-C-T5OWer.mjs → postgres-BL5oBBgY.mjs} +3 -3
  76. package/dist/{project-setup-pIPHZaXf.mjs → project-setup-DHxdJjEc.mjs} +24 -25
  77. package/dist/providers-BH6hQYbU.mjs +16 -0
  78. package/dist/{providers-Dzx5GAUI.mjs → providers-BNV7CzC-.mjs} +6 -6
  79. package/dist/{query-feedback-DN52N9C5.mjs → query-feedback-BWl2HRwN.mjs} +2 -2
  80. package/dist/registrable-BwFiqazy.mjs +9 -0
  81. package/dist/{registrable-CXBBpUcz.mjs → registrable-Dxs4oKIj.mjs} +4 -4
  82. package/dist/render-DVGXpfaT.mjs +13 -0
  83. package/dist/render-jPpMrudf.mjs +2240 -0
  84. package/dist/root-C8cxhdn9.mjs +36 -0
  85. package/dist/{root-bG48WVpW.mjs → root-DmOzMeSv.mjs} +10 -10
  86. package/dist/route-table-COAmc1nB.mjs +15 -0
  87. package/dist/{router-CQSc3lk3.mjs → router-D2476pOp.mjs} +2 -2
  88. package/dist/{router-DwHJRgG9.mjs → router-ghujlEFb.mjs} +1 -1
  89. package/dist/{routing-D27jxj9x.mjs → routing-B_cg1_Xx.mjs} +13 -13
  90. package/dist/{routing-BlD_tKjW.mjs → routing-aJKMIagQ.mjs} +15 -15
  91. package/dist/{run-AZVwceiU.mjs → run-DE9Q0ldN.mjs} +47 -31
  92. package/dist/{runtime-paths-WsO9sJFc.mjs → runtime-paths-twfV23YL.mjs} +2 -2
  93. package/dist/{scan-C3uotg_f.mjs → scan-CNMcltOX.mjs} +7 -7
  94. package/dist/{scope-D8HK6vU7.mjs → scope-BTWstJ1B.mjs} +4 -4
  95. package/dist/session-DgZifjLx.mjs +35 -0
  96. package/dist/{session-BAfypQb9.mjs → session-HBYOABWU.mjs} +28 -28
  97. package/dist/session-scan-BZxnYN1v.mjs +9 -0
  98. package/dist/{session-scan-BmnjSReu.mjs → session-scan-CX3MKCNg.mjs} +6 -6
  99. package/dist/{session-usage-oycSdiD3.mjs → session-usage-CCmPFFa6.mjs} +3 -3
  100. package/dist/{status-COtzewKV.mjs → status-Cecau8Ps.mjs} +9 -5
  101. package/dist/status-D52xC_i0.mjs +6 -0
  102. package/dist/{tool-errors-DXJ70-sr.mjs → tool-errors-BFw1gv-z.mjs} +2 -2
  103. package/dist/{tool-errors-B2LnIqR0.mjs → tool-errors-COM2JGEr.mjs} +6 -6
  104. package/dist/viewer-Ce-Xa9L3.mjs +22 -0
  105. package/dist/{viewer-BgGRqXfD.mjs → viewer-DvBg6N22.mjs} +16 -14
  106. package/dist/{wait-ChpHKJZV.mjs → wait-C5iWILj_.mjs} +3 -3
  107. package/dist/worker-config-BmcJ9R0U.mjs +42 -0
  108. package/dist/{worker-config-DgdT0iTB.mjs → worker-config-DkONNk_H.mjs} +54 -103
  109. package/dist/{workers-config-BhZBrR-Q.mjs → workers-config-DwzrtdYu.mjs} +2 -2
  110. package/dist/{worktree-BY--Rgmy.mjs → worktree-O_kU6Q3y.mjs} +164 -8
  111. package/dist/{zettelkasten-BHVx5zj-.mjs → zettelkasten-BH8AdNh8.mjs} +4 -4
  112. package/dist/{zettelkasten-LoH9RBiN.mjs → zettelkasten-FFhQFESJ.mjs} +2 -2
  113. package/docs/commands/README.md +32 -2
  114. package/docs/commands/audit.md +34 -3
  115. package/docs/commands/backup.md +1 -1
  116. package/docs/commands/build.md +4 -4
  117. package/docs/commands/cd.md +1 -1
  118. package/docs/commands/clear-names.md +1 -1
  119. package/docs/commands/cockpit.md +1 -1
  120. package/docs/commands/config.md +1 -1
  121. package/docs/commands/daemon.md +1 -1
  122. package/docs/commands/db.md +1 -1
  123. package/docs/commands/doc.md +1 -1
  124. package/docs/commands/end.md +1 -1
  125. package/docs/commands/find.md +1 -1
  126. package/docs/commands/git.md +110 -0
  127. package/docs/commands/handoff.md +70 -0
  128. package/docs/commands/harness.md +74 -0
  129. package/docs/commands/help.md +1 -1
  130. package/docs/commands/home.md +1 -1
  131. package/docs/commands/hooks-db.md +1 -1
  132. package/docs/commands/identity.md +1 -1
  133. package/docs/commands/install.md +1 -1
  134. package/docs/commands/issue.md +1 -1
  135. package/docs/commands/kg.md +1 -1
  136. package/docs/commands/launch.md +1 -1
  137. package/docs/commands/lessons.md +201 -0
  138. package/docs/commands/list.md +1 -1
  139. package/docs/commands/ls.md +1 -1
  140. package/docs/commands/mcp.md +1 -1
  141. package/docs/commands/memory.md +1 -1
  142. package/docs/commands/models.md +1 -1
  143. package/docs/commands/more.md +1 -1
  144. package/docs/commands/new.md +1 -1
  145. package/docs/commands/notes.md +1 -1
  146. package/docs/commands/notify.md +1 -1
  147. package/docs/commands/observation.md +1 -1
  148. package/docs/commands/obsidian.md +1 -1
  149. package/docs/commands/open.md +1 -1
  150. package/docs/commands/pane.md +1 -1
  151. package/docs/commands/pause.md +1 -1
  152. package/docs/commands/plan.md +1 -1
  153. package/docs/commands/project.md +1 -1
  154. package/docs/commands/projects.md +1 -1
  155. package/docs/commands/providers.md +1 -1
  156. package/docs/commands/queue.md +1 -1
  157. package/docs/commands/registry.md +1 -1
  158. package/docs/commands/reload.md +1 -1
  159. package/docs/commands/rename.md +1 -1
  160. package/docs/commands/restore.md +1 -1
  161. package/docs/commands/resume.md +1 -1
  162. package/docs/commands/router.md +1 -1
  163. package/docs/commands/rules.md +70 -0
  164. package/docs/commands/session.md +1 -1
  165. package/docs/commands/sessions.md +1 -1
  166. package/docs/commands/setup.md +1 -1
  167. package/docs/commands/setups.md +1 -1
  168. package/docs/commands/shell-init.md +1 -1
  169. package/docs/commands/skill.md +1 -1
  170. package/docs/commands/task.md +1 -1
  171. package/docs/commands/tasks.md +1 -1
  172. package/docs/commands/topic.md +1 -1
  173. package/docs/commands/update.md +1 -1
  174. package/docs/commands/worker.md +1 -1
  175. package/docs/commands/zettel.md +1 -1
  176. package/docs/concepts/panes.md +3 -2
  177. package/gemini-extension.json +1 -1
  178. package/package.json +2 -2
  179. package/pai-plugin.json +1 -1
  180. package/plugins/context-preservation/plugin.json +1 -1
  181. package/plugins/core/plugin.json +1 -1
  182. package/plugins/creative/plugin.json +1 -1
  183. package/plugins/observability/plugin.json +1 -1
  184. package/plugins/productivity/plugin.json +1 -1
  185. package/plugins/semantic-search/plugin.json +1 -1
  186. package/plugins/ui/plugin.json +1 -1
  187. package/plugins/zettelkasten/plugin.json +1 -1
  188. package/src/hooks/ts/lib/loop-guard.ts +3 -5
  189. package/src/hooks/ts/lib/rules/builtin/base64-decode-to-shell.rule.yaml +13 -0
  190. package/src/hooks/ts/lib/rules/builtin/chmod-world-writable.rule.yaml +13 -0
  191. package/src/hooks/ts/lib/rules/builtin/chmod-zero.rule.yaml +11 -0
  192. package/src/hooks/ts/lib/rules/builtin/credential-file-read.rule.yaml +13 -0
  193. package/src/hooks/ts/lib/rules/builtin/credential-read-then-network.rule.yaml +29 -0
  194. package/src/hooks/ts/lib/rules/builtin/crontab-persistence.rule.yaml +10 -0
  195. package/src/hooks/ts/lib/rules/builtin/curl-piped-to-shell.rule.yaml +15 -0
  196. package/src/hooks/ts/lib/rules/builtin/download-then-execute.rule.yaml +30 -0
  197. package/src/hooks/ts/lib/rules/builtin/find-root-delete.rule.yaml +11 -0
  198. package/src/hooks/ts/lib/rules/builtin/git-push-force.rule.yaml +24 -0
  199. package/src/hooks/ts/lib/rules/builtin/git-push-plus-refspec.rule.yaml +12 -0
  200. package/src/hooks/ts/lib/rules/builtin/git-reset-hard.rule.yaml +12 -0
  201. package/src/hooks/ts/lib/rules/builtin/injection-then-tool.rule.yaml +30 -0
  202. package/src/hooks/ts/lib/rules/builtin/instruction-override-disregard.rule.yaml +12 -0
  203. package/src/hooks/ts/lib/rules/builtin/instruction-override-ignore.rule.yaml +13 -0
  204. package/src/hooks/ts/lib/rules/builtin/launchagents-write-persistence.rule.yaml +12 -0
  205. package/src/hooks/ts/lib/rules/builtin/launchctl-load-persistence.rule.yaml +10 -0
  206. package/src/hooks/ts/lib/rules/builtin/reverse-shell-dev-tcp.rule.yaml +11 -0
  207. package/src/hooks/ts/lib/rules/builtin/reverse-shell-interactive-bash.rule.yaml +11 -0
  208. package/src/hooks/ts/lib/rules/builtin/rm-recursive-parent.rule.yaml +11 -0
  209. package/src/hooks/ts/lib/rules/builtin/rm-recursive-relative.rule.yaml +11 -0
  210. package/src/hooks/ts/lib/rules/builtin/rm-recursive-root.rule.yaml +24 -0
  211. package/src/hooks/ts/lib/rules/builtin/rm-trailing-tilde.rule.yaml +11 -0
  212. package/src/hooks/ts/lib/rules/builtin/sudoers-nopasswd.rule.yaml +15 -0
  213. package/src/hooks/ts/lib/rules/builtin.generated.ts +530 -0
  214. package/src/hooks/ts/lib/rules/eval.ts +74 -0
  215. package/src/hooks/ts/lib/rules/lint.ts +102 -0
  216. package/src/hooks/ts/lib/rules/load.ts +229 -0
  217. package/src/hooks/ts/lib/rules/types.ts +56 -0
  218. package/src/hooks/ts/pre-tool-use/security-validator.ts +27 -96
  219. package/src/hooks/ts/user-prompt/handoff-link.ts +34 -0
  220. package/dist/aibroker-client-BxzeEHPF.mjs +0 -3
  221. package/dist/auto-route-DWYK_0i0.mjs +0 -11
  222. package/dist/budget-DX-VIWGf.mjs +0 -15
  223. package/dist/cockpit-memory-DIrNs4xr.mjs +0 -20
  224. package/dist/daemon-ieo0lnpq.mjs +0 -46
  225. package/dist/detect-C0ZBXqDL.mjs +0 -10
  226. package/dist/factory-DeASMV7Z.mjs +0 -9
  227. package/dist/kill-tree-CXZ0WfVf.mjs +0 -10
  228. package/dist/operator-Bpxq_WB5.mjs +0 -7
  229. package/dist/providers-QJzpaNhX.mjs +0 -16
  230. package/dist/registrable-Drn8wIDO.mjs +0 -9
  231. package/dist/render-C4KR8qQ8.mjs +0 -13
  232. package/dist/render-Cz3BWIBO.mjs +0 -903
  233. package/dist/root-Bfb1zgwE.mjs +0 -36
  234. package/dist/route-table-ZVMNBsy7.mjs +0 -15
  235. package/dist/session-BcnhepLZ.mjs +0 -35
  236. package/dist/session-scan-CqUQdCac.mjs +0 -9
  237. package/dist/status-D_SWmOlH.mjs +0 -6
  238. package/dist/viewer-CbGN2Ri4.mjs +0 -22
  239. package/dist/worker-config-D1KVAMp4.mjs +0 -42
@@ -2,7 +2,7 @@
2
2
  "name": "pai",
3
3
  "displayName": "PAI Knowledge OS",
4
4
  "description": "Personal AI Infrastructure — persistent memory, session continuity, and knowledge graph for Claude Code",
5
- "version": "1.0.5",
5
+ "version": "1.0.6",
6
6
  "author": {
7
7
  "name": "Matthias Nott"
8
8
  },
@@ -1,4 +1,4 @@
1
- import { n as aibrokerSocketPath } from "./runtime-paths-WsO9sJFc.mjs";
1
+ import { n as aibrokerSocketPath } from "./runtime-paths-twfV23YL.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { connect } from "node:net";
4
4
 
@@ -177,4 +177,4 @@ async function switchToSession(target, opts = {}) {
177
177
 
178
178
  //#endregion
179
179
  export { switchToSession as i, fetchLiveSessions as n, sendToSession as r, callAiBroker as t };
180
- //# sourceMappingURL=aibroker-client-CQPGqLxL.mjs.map
180
+ //# sourceMappingURL=aibroker-client-CXsyC7A8.mjs.map
@@ -0,0 +1,3 @@
1
+ import { i as switchToSession, n as fetchLiveSessions, r as sendToSession, t as callAiBroker } from "./aibroker-client-CXsyC7A8.mjs";
2
+
3
+ export { callAiBroker, sendToSession };
@@ -0,0 +1,11 @@
1
+ import "./config-Bz8pAU5Q.mjs";
2
+ import "./config-SlZ-Z52i.mjs";
3
+ import "./paths-CypxFTfn.mjs";
4
+ import "./worktree-O_kU6Q3y.mjs";
5
+ import "./status-Cecau8Ps.mjs";
6
+ import "./pool-9EsbKD-U.mjs";
7
+ import "./registrable-Dxs4oKIj.mjs";
8
+ import "./pai-marker-D6OoVbM_.mjs";
9
+ import { n as formatAutoRouteJson, t as autoRoute } from "./auto-route-YaEGVrFl.mjs";
10
+
11
+ export { autoRoute, formatAutoRouteJson };
@@ -1,4 +1,4 @@
1
- import { r as readPaiMarker } from "./pai-marker-DLKJ9Yr5.mjs";
1
+ import { r as readPaiMarker } from "./pai-marker-D6OoVbM_.mjs";
2
2
  import { i as populateSlugs } from "./search-RSyeQqj1.mjs";
3
3
  import { existsSync } from "node:fs";
4
4
  import { dirname, resolve } from "node:path";
@@ -158,4 +158,4 @@ function formatAutoRouteJson(result) {
158
158
 
159
159
  //#endregion
160
160
  export { formatAutoRouteJson as n, detectTopicShift as r, autoRoute as t };
161
- //# sourceMappingURL=auto-route-DUYr57rs.mjs.map
161
+ //# sourceMappingURL=auto-route-YaEGVrFl.mjs.map
@@ -0,0 +1,15 @@
1
+ import "./config-Bz8pAU5Q.mjs";
2
+ import "./config-SlZ-Z52i.mjs";
3
+ import "./paths-CypxFTfn.mjs";
4
+ import "./status-Cecau8Ps.mjs";
5
+ import "./scope-BTWstJ1B.mjs";
6
+ import { A as budgetSkipReason, D as budgetExceeded, E as budgetCache, M as budgetWall, N as fetchBudgetReading, O as budgetFresh, P as pickBudgetWindow, T as BudgetCache, j as budgetUntilLabel, k as budgetFull, w as BUDGET_TTL_MS } from "./routing-aJKMIagQ.mjs";
7
+ import "./tool-errors-BFw1gv-z.mjs";
8
+ import "./wait-C5iWILj_.mjs";
9
+ import "./local-tiers-CqwGUcEn.mjs";
10
+ import "./caller-identity-C6Nc96iM.mjs";
11
+ import "./capacity-B2PgKAg4.mjs";
12
+ import "./local-instances-DhF4_sV2.mjs";
13
+ import "./local-candidate-DFd4pp-w.mjs";
14
+
15
+ export { BUDGET_TTL_MS, BudgetCache, budgetCache, budgetExceeded, budgetFresh, budgetFull, budgetSkipReason, budgetUntilLabel, budgetWall, fetchBudgetReading, pickBudgetWindow };
@@ -1,6 +1,6 @@
1
- import { g as paiHomePath, l as claudeHomeDir } from "./runtime-paths-WsO9sJFc.mjs";
2
- import { f as readMainConfigRaw } from "./config-DYbyEe4-.mjs";
3
- import { i as itermUuid } from "./scope-D8HK6vU7.mjs";
1
+ import { _ as paiHomePath, l as claudeHomeDir } from "./runtime-paths-twfV23YL.mjs";
2
+ import { f as readMainConfigRaw } from "./config-SlZ-Z52i.mjs";
3
+ import { i as itermUuid } from "./scope-BTWstJ1B.mjs";
4
4
  import { n as minOf } from "./min-max-DrSRUaWQ.mjs";
5
5
  import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, rmdirSync, statSync, writeFileSync } from "node:fs";
6
6
  import { join } from "node:path";
@@ -371,4 +371,4 @@ function callerIdentity(env = process.env, deps = {}) {
371
371
 
372
372
  //#endregion
373
373
  export { buildSlots as _, buildsDir as a, stallMinutes as b, listBuilds as c, releaseBuildsOf as d, removeTicket as f, waitReason as g, tryStart as h, buildNext as i, listBuildsSync as l, ticketKind as m, breakStaleMutex as n, enqueue as o, renderBuildQueue as p, buildLogPath as r, getTicket as s, callerIdentity as t, patchTicket as u, poolSlots as v, testSlots as x, slotsFor as y };
374
- //# sourceMappingURL=caller-identity-Bim8JT-D.mjs.map
374
+ //# sourceMappingURL=caller-identity-C6Nc96iM.mjs.map
@@ -1,5 +1,6 @@
1
- import { m as isLocalProvider } from "./config-CST2uq1v.mjs";
2
- import { O as reconcileStatuses, g as isLive, s as alive, v as loadStatus, w as ownsPid, y as loadStatuses } from "./status-COtzewKV.mjs";
1
+ import { m as isLocalProvider } from "./config-Bz8pAU5Q.mjs";
2
+ import { O as reconcileStatuses, g as isLive, s as alive, v as loadStatus, w as ownsPid, y as loadStatuses } from "./status-Cecau8Ps.mjs";
3
+ import { D as fmtElapsed } from "./wait-C5iWILj_.mjs";
3
4
  import { mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
5
  import { join } from "node:path";
5
6
 
@@ -196,8 +197,15 @@ function providerCap(config, provider) {
196
197
  const sessionScopeKey = (name) => `session~${name}`;
197
198
  const queueDir = (logDir, provider) => join(logDir, "queue", provider.replace(/[^\w.~-]/g, "_"));
198
199
  const entryText = (e) => `${e.pid}${e.front ? " front" : ""}${e.rank === void 0 ? "" : ` ${e.rank}`}${e.since === void 0 ? "" : ` @${e.since}`}`;
200
+ /** A ticket deleted (its run stopped) or written unparsably between the listing and this read is absent, not an error. */
199
201
  function readEntry(dir, id) {
200
- const [p, ...marks] = readFileSync(join(dir, id), "utf8").trim().split(/\s+/);
202
+ let text;
203
+ try {
204
+ text = readFileSync(join(dir, id), "utf8");
205
+ } catch {
206
+ return null;
207
+ }
208
+ const [p, ...marks] = text.trim().split(/\s+/);
201
209
  const rank = marks.map(Number).find((n) => Number.isInteger(n));
202
210
  const at = marks.find((m) => m.startsWith("@"));
203
211
  const since = at ? Number(at.slice(1)) : NaN;
@@ -290,6 +298,7 @@ function liveEntries(logDir, provider, isAlive) {
290
298
  const out = [];
291
299
  for (const id of names.sort()) {
292
300
  const e = readEntry(dir, id);
301
+ if (!e) continue;
293
302
  if (Number.isInteger(e.pid) && e.pid > 0 && isAlive(e.pid)) out.push(e);
294
303
  else rmSync(join(dir, id), { force: true });
295
304
  }
@@ -406,6 +415,47 @@ function queuedText(q) {
406
415
  const hhmm = `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
407
416
  return `queued on ${q.provider}: position ${q.position} of ${q.queued}${q.behind ? `, behind ${q.behind}` : ""} — waiting since ${hhmm}`;
408
417
  }
418
+ /** The pane's queue line, refreshed in place: "queued on gyro-m · position 2 of 5 · waiting 2m10s · <label>". */
419
+ function queuedPaneLine(q) {
420
+ const parts = [
421
+ `queued on ${q.provider}`,
422
+ `position ${q.position} of ${q.queued}`,
423
+ `waiting ${fmtElapsed(q.elapsedSec)}`
424
+ ];
425
+ if (q.behind) parts.push(`behind ${q.behind}`);
426
+ if (q.label) parts.push(q.label);
427
+ return parts.join(" · ");
428
+ }
429
+ /**
430
+ * The pane's queue file: <pane-exec dir>/<id>.queued, written while the run
431
+ * waits for a slot and removed when the command starts, so a pane opened
432
+ * before the queue shows its place in line instead of sitting empty. The
433
+ * wrapper (`pai pane exec`) prints it in place until the start frame arrives;
434
+ * a missing or malformed file is simply no queue line.
435
+ */
436
+ function queuedFilePath(dir, id) {
437
+ return join(dir, `${id}.queued`);
438
+ }
439
+ function readQueued(dir, id) {
440
+ try {
441
+ const q = JSON.parse(readFileSync(queuedFilePath(dir, id), "utf8"));
442
+ if (typeof q.provider !== "string" || !Number.isInteger(q.position) || !Number.isInteger(q.queued) || !Number.isInteger(q.elapsedSec)) return null;
443
+ return q;
444
+ } catch {
445
+ return null;
446
+ }
447
+ }
448
+ /** Write atomically (rename), so the wrapper's poll never reads a half-written file. */
449
+ function writeQueued(dir, id, q) {
450
+ mkdirSync(dir, { recursive: true });
451
+ const path = queuedFilePath(dir, id);
452
+ const tmp = `${path}.${process.pid}.tmp`;
453
+ writeFileSync(tmp, JSON.stringify(q), "utf8");
454
+ renameSync(tmp, path);
455
+ }
456
+ function removeQueued(dir, id) {
457
+ rmSync(queuedFilePath(dir, id), { force: true });
458
+ }
409
459
  /** Resolves once fewer than `cap` other runs hold a slot on the provider and this run heads the queue; null when it never had to wait. */
410
460
  async function capacityGate(o) {
411
461
  const cfg = capacityOf(o.config);
@@ -459,8 +509,16 @@ async function capacityGate(o) {
459
509
  o.log?.(info().line);
460
510
  let lastBeat = t0;
461
511
  let alarmed = false;
512
+ const paneQueued = (i) => ({
513
+ provider: i.provider,
514
+ position: i.position,
515
+ queued: i.queued,
516
+ elapsedSec: i.elapsedSec,
517
+ ...c.behind ? { behind: c.behind } : {}
518
+ });
462
519
  try {
463
520
  o.onWait?.(info());
521
+ o.onQueued?.(paneQueued(info()));
464
522
  for (let n = 0;; n++) {
465
523
  await sleep(backoffMs(n));
466
524
  const fresh = o.capOf?.();
@@ -468,6 +526,7 @@ async function capacityGate(o) {
468
526
  c = check();
469
527
  if (c.position === 1 && c.holding < cap) break;
470
528
  o.onWait?.(info());
529
+ o.onQueued?.(paneQueued(info()));
471
530
  if (!alarmed && o.onAlarm && now() - t0 >= (o.alarmMs ?? cfg.maxTotalWaitMs)) {
472
531
  alarmed = true;
473
532
  o.onAlarm(info());
@@ -482,6 +541,7 @@ async function capacityGate(o) {
482
541
  }
483
542
  const waitedSec = Math.round((now() - t0) / 100) / 10;
484
543
  o.onWait?.(null);
544
+ o.onQueued?.(null);
485
545
  o.log?.(`waited ${waitedSec}s for a ${label} slot`);
486
546
  return {
487
547
  waitedSec,
@@ -490,5 +550,5 @@ async function capacityGate(o) {
490
550
  }
491
551
 
492
552
  //#endregion
493
- export { liveQueue as a, queuedText as c, resolveCap as d, sessionOf as f, staggerGate as h, effectiveCap as i, reorderQueue as l, recordWarmup as m, capacityGate as n, providerCap as o, sessionScopeKey as p, capacityOf as r, queueRows as s, admitCap as t, reorderQueueTo as u };
494
- //# sourceMappingURL=capacity-CsZMkVyg.mjs.map
553
+ export { sessionScopeKey as _, liveQueue as a, staggerGate as b, queuedFilePath as c, readQueued as d, removeQueued as f, sessionOf as g, resolveCap as h, effectiveCap as i, queuedPaneLine as l, reorderQueueTo as m, capacityGate as n, providerCap as o, reorderQueue as p, capacityOf as r, queueRows as s, admitCap as t, queuedText as u, writeQueued as v, recordWarmup as y };
554
+ //# sourceMappingURL=capacity-B2PgKAg4.mjs.map
@@ -1,7 +1,7 @@
1
- import { Et as appendLedger, M as readWorkersSection } from "./config-CST2uq1v.mjs";
2
- import { i as ledgerPath, u as workersLogDir } from "./paths-DS5VQKoR.mjs";
3
- import { $ as isFlagToken, S as newWorkerId, nt as shortText } from "./status-COtzewKV.mjs";
4
- import { t as runWorker } from "./run-AZVwceiU.mjs";
1
+ import { Et as appendLedger, M as readWorkersSection } from "./config-Bz8pAU5Q.mjs";
2
+ import { i as ledgerPath, u as workersLogDir } from "./paths-CypxFTfn.mjs";
3
+ import { S as newWorkerId, et as isFlagToken, rt as shortText } from "./status-Cecau8Ps.mjs";
4
+ import { t as runWorker } from "./run-DE9Q0ldN.mjs";
5
5
  import { existsSync, mkdirSync, readFileSync } from "node:fs";
6
6
  import { join } from "node:path";
7
7
 
@@ -163,4 +163,4 @@ async function runChain(opts, deps = {}) {
163
163
 
164
164
  //#endregion
165
165
  export { swapPromptArg as n, runChain as t };
166
- //# sourceMappingURL=chain-Dzz6xcKH.mjs.map
166
+ //# sourceMappingURL=chain-CtK49-Ma.mjs.map