@tekmidian/pai 1.0.4 → 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 (248) 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-21GdHL70.mjs → auto-route-YaEGVrFl.mjs} +2 -2
  6. package/dist/budget-DEiebT2A.mjs +15 -0
  7. package/dist/{caller-identity-yLFb7CKq.mjs → caller-identity-C6Nc96iM.mjs} +4 -4
  8. package/dist/{capacity-DEveQdFV.mjs → capacity-B2PgKAg4.mjs} +69 -6
  9. package/dist/{chain-D7PFur8Y.mjs → chain-CtK49-Ma.mjs} +5 -5
  10. package/dist/cli/index.mjs +2126 -290
  11. package/dist/{cockpit-actions-BfRMr2sm.mjs → cockpit-actions-C73mJAJ8.mjs} +18 -18
  12. package/dist/{cockpit-actions-OodH_vx_.mjs → cockpit-actions-D1OPP6Es.mjs} +30 -26
  13. package/dist/cockpit-memory-CLHZD64W.mjs +20 -0
  14. package/dist/config/defaults/config.yaml +21 -1
  15. package/dist/{config-XpZWOYOG.mjs → config-Bz8pAU5Q.mjs} +30 -5
  16. package/dist/{config-DtENJ6cL.mjs → config-DHgPx3ER.mjs} +1 -1
  17. package/dist/config-DLmyEK2q.mjs +4 -0
  18. package/dist/{config-Bu1_vbY8.mjs → config-SlZ-Z52i.mjs} +4 -3
  19. package/dist/{controls-JLm6g0yP.mjs → controls-rIItFeIJ.mjs} +59 -66
  20. package/dist/daemon/index.mjs +40 -39
  21. package/dist/daemon-176qA79N.mjs +46 -0
  22. package/dist/{daemon-nXanenDM.mjs → daemon-SoUvPUOf.mjs} +80 -30
  23. package/dist/daemon-mcp/index.mjs +49 -38
  24. package/dist/detect-C8nFP-kR.mjs +10 -0
  25. package/dist/{detect-BLKsUOgG.mjs → detect-DLjeYwnt.mjs} +2 -2
  26. package/dist/{embed-pass-e64AwDCa.mjs → embed-pass-CN1D8MXl.mjs} +5 -5
  27. package/dist/{embedding-gate-Cnk4YCyX.mjs → embedding-gate-BVQvUmox.mjs} +2 -2
  28. package/dist/{embedding-gate-6rZrWRXa.mjs → embedding-gate-iq0oQEkF.mjs} +3 -3
  29. package/dist/{endreason-BC-v05H_.mjs → endreason-C2-hYK0_.mjs} +4 -4
  30. package/dist/{factory-B7nv75rC.mjs → factory-CYwa0jYj.mjs} +6 -6
  31. package/dist/factory-DFwez99M.mjs +9 -0
  32. package/dist/{fallback-CBWpp2F2.mjs → fallback-CwPSCrX8.mjs} +9 -231
  33. package/dist/{health-C4FQmkJn.mjs → health-D0mUAVdw.mjs} +5 -5
  34. package/dist/{helpers-DSNK_1KP.mjs → helpers-Dj2nY56t.mjs} +2 -2
  35. package/dist/{helpers-Dz7mjTSw.mjs → helpers-DyHKAwrW.mjs} +6 -6
  36. package/dist/hooks/block-sleep-poll.mjs +1 -1
  37. package/dist/hooks/capture-all-events.mjs +68 -3
  38. package/dist/hooks/capture-tool-output.mjs +68 -3
  39. package/dist/hooks/handoff-link.mjs +128 -0
  40. package/dist/hooks/load-project-context.mjs +8 -8
  41. package/dist/hooks/local-model-hint.mjs +1 -1
  42. package/dist/hooks/route-agents-to-worker.mjs +1 -1
  43. package/dist/hooks/security-validator.mjs +842 -90
  44. package/dist/hooks/supervision-banner.mjs +186 -48
  45. package/dist/hooks/worker-edit-repair.mjs +2 -2
  46. package/dist/hooks/worker-guard.mjs +65 -9
  47. package/dist/hooks/worker-note.mjs +70 -5
  48. package/dist/hooks/worker-pool-host.mjs +1518 -265
  49. package/dist/hooks/worker-proxy.mjs +1 -1
  50. package/dist/hooks/worker-status-line.mjs +225 -86
  51. package/dist/hooks/worker-supervision.mjs +1 -1
  52. package/dist/hooks/worker-tool-name-repair.mjs +2 -2
  53. package/dist/index.mjs +9 -9
  54. package/dist/{ipc-client-CnYEF31R.mjs → ipc-client-CmagIFLh.mjs} +2 -2
  55. package/dist/{ipc-client-DN7EvoVo.mjs → ipc-client-DmbSIBUK.mjs} +1 -1
  56. package/dist/{kill-tree-DleMNZX3.mjs → kill-tree-DPiMscaY.mjs} +8 -8
  57. package/dist/kill-tree-Dxei6qlR.mjs +10 -0
  58. package/dist/{launch-DlZTKE3u.mjs → launch-BZT3JDoZ.mjs} +3 -3
  59. package/dist/{launch-Di7N-J5X.mjs → launch-Bn2Zf90h.mjs} +3 -3
  60. package/dist/{indexer-backend-BdjeL4P8.mjs → lessons-CFVU0cwA.mjs} +262 -43
  61. package/dist/{local-candidate-DLdwQt0s.mjs → local-candidate-DFd4pp-w.mjs} +3 -3
  62. package/dist/{local-instances-DOxSgT_L.mjs → local-instances-DhF4_sV2.mjs} +2 -2
  63. package/dist/{local-instances-ZeRkkuS5.mjs → local-instances-KTh8IeOT.mjs} +4 -4
  64. package/dist/{local-tiers-BE4jGaMa.mjs → local-tiers-CqwGUcEn.mjs} +3 -3
  65. package/dist/{local-tiers-DNMI5W86.mjs → local-tiers-DSlIYvvm.mjs} +3 -3
  66. package/dist/{main-config-ops-kTXR8Pyv.mjs → main-config-ops-rda08BCD.mjs} +3 -3
  67. package/dist/{main-resolver-yp_puSSb.mjs → main-resolver-BKwI0I6H.mjs} +18 -18
  68. package/dist/{migrate-DrA_OwlZ.mjs → migrate-C2z1YmWC.mjs} +2 -2
  69. package/dist/{model-inventory-h6Z9fN_o.mjs → model-inventory-BXv15B0d.mjs} +13 -13
  70. package/dist/{models-add-TVni3A7V.mjs → models-add-5yXTyz3g.mjs} +38 -37
  71. package/dist/operator-Bmv5tiHQ.mjs +7 -0
  72. package/dist/{operator-CyuB3aVw.mjs → operator-Br6GeswF.mjs} +2 -2
  73. package/dist/{pai-marker-BcZyJguM.mjs → pai-marker-D6OoVbM_.mjs} +2 -2
  74. package/dist/{pane-audit-Lqy9N_Ki.mjs → pane-audit-DLYy9-4g.mjs} +13 -23
  75. package/dist/{paths-CHifubDh.mjs → paths-CypxFTfn.mjs} +4 -4
  76. package/dist/{paths-CFHTloSe.mjs → paths-DIOwNcj-.mjs} +3 -3
  77. package/dist/{planner-j77ndkBf.mjs → planner-BzZ_2lc-.mjs} +29 -29
  78. package/dist/{pool-Dh-q3iJi.mjs → pool-9EsbKD-U.mjs} +2 -2
  79. package/dist/{pool-cli-DQ6OzRy2.mjs → pool-cli-Cy5mlycP.mjs} +6 -6
  80. package/dist/{pool-cli-BggU8GRp.mjs → pool-cli-Db0uDwB9.mjs} +5 -5
  81. package/dist/{postgres-BK4FP9Zg.mjs → postgres-B1B80bcj.mjs} +3 -3
  82. package/dist/{postgres-DNIOQijl.mjs → postgres-BL5oBBgY.mjs} +3 -3
  83. package/dist/{project-setup-CBRtFFh0.mjs → project-setup-DHxdJjEc.mjs} +24 -25
  84. package/dist/providers-BH6hQYbU.mjs +16 -0
  85. package/dist/{providers-C9QC0TtO.mjs → providers-BNV7CzC-.mjs} +6 -6
  86. package/dist/{query-feedback-DN52N9C5.mjs → query-feedback-BWl2HRwN.mjs} +2 -2
  87. package/dist/registrable-BwFiqazy.mjs +9 -0
  88. package/dist/{registrable-DpyTtajg.mjs → registrable-Dxs4oKIj.mjs} +4 -4
  89. package/dist/render-DVGXpfaT.mjs +13 -0
  90. package/dist/render-jPpMrudf.mjs +2240 -0
  91. package/dist/root-C8cxhdn9.mjs +36 -0
  92. package/dist/{root-C4oXlXS_.mjs → root-DmOzMeSv.mjs} +10 -10
  93. package/dist/route-table-COAmc1nB.mjs +15 -0
  94. package/dist/{router-CQSc3lk3.mjs → router-D2476pOp.mjs} +2 -2
  95. package/dist/{router-DwHJRgG9.mjs → router-ghujlEFb.mjs} +1 -1
  96. package/dist/{routing-f2zulGwD.mjs → routing-B_cg1_Xx.mjs} +13 -13
  97. package/dist/{routing-DmkheCRH.mjs → routing-aJKMIagQ.mjs} +16 -16
  98. package/dist/{run-BwZKBJZZ.mjs → run-DE9Q0ldN.mjs} +55 -31
  99. package/dist/{runtime-paths-WsO9sJFc.mjs → runtime-paths-twfV23YL.mjs} +2 -2
  100. package/dist/{scan-BBGvU5EB.mjs → scan-CNMcltOX.mjs} +7 -7
  101. package/dist/{scope-D-h6F6DN.mjs → scope-BTWstJ1B.mjs} +4 -4
  102. package/dist/session-DgZifjLx.mjs +35 -0
  103. package/dist/{session-Dn5OJXlg.mjs → session-HBYOABWU.mjs} +28 -28
  104. package/dist/session-scan-BZxnYN1v.mjs +9 -0
  105. package/dist/{session-scan-DUn10MBd.mjs → session-scan-CX3MKCNg.mjs} +6 -6
  106. package/dist/{session-usage-CPvXvSkw.mjs → session-usage-CCmPFFa6.mjs} +117 -2
  107. package/dist/{status-ggJ7lgVg.mjs → status-Cecau8Ps.mjs} +9 -5
  108. package/dist/status-D52xC_i0.mjs +6 -0
  109. package/dist/{tool-errors-7E13StWd.mjs → tool-errors-BFw1gv-z.mjs} +2 -2
  110. package/dist/{tool-errors-CJWODvlo.mjs → tool-errors-COM2JGEr.mjs} +6 -6
  111. package/dist/viewer-Ce-Xa9L3.mjs +22 -0
  112. package/dist/{viewer-wfKnvnrI.mjs → viewer-DvBg6N22.mjs} +16 -14
  113. package/dist/{wait-ByV0OyMZ.mjs → wait-C5iWILj_.mjs} +3 -3
  114. package/dist/worker-config-BmcJ9R0U.mjs +42 -0
  115. package/dist/{worker-config-eY5Qy4vl.mjs → worker-config-DkONNk_H.mjs} +164 -107
  116. package/dist/workers-config-DwzrtdYu.mjs +4 -0
  117. package/dist/{worktree-CRs2gyg0.mjs → worktree-O_kU6Q3y.mjs} +164 -8
  118. package/dist/{zettelkasten-tpCRBYvH.mjs → zettelkasten-BH8AdNh8.mjs} +4 -4
  119. package/dist/{zettelkasten-_h_tUm2T.mjs → zettelkasten-FFhQFESJ.mjs} +2 -2
  120. package/docs/commands/README.md +33 -2
  121. package/docs/commands/audit.md +34 -3
  122. package/docs/commands/backup.md +1 -1
  123. package/docs/commands/build.md +4 -4
  124. package/docs/commands/cd.md +1 -1
  125. package/docs/commands/clear-names.md +1 -1
  126. package/docs/commands/cockpit.md +1 -1
  127. package/docs/commands/config.md +21 -1
  128. package/docs/commands/daemon.md +1 -1
  129. package/docs/commands/db.md +1 -1
  130. package/docs/commands/doc.md +1 -1
  131. package/docs/commands/end.md +1 -1
  132. package/docs/commands/find.md +1 -1
  133. package/docs/commands/git.md +110 -0
  134. package/docs/commands/handoff.md +70 -0
  135. package/docs/commands/harness.md +74 -0
  136. package/docs/commands/help.md +1 -1
  137. package/docs/commands/home.md +1 -1
  138. package/docs/commands/hooks-db.md +1 -1
  139. package/docs/commands/identity.md +1 -1
  140. package/docs/commands/install.md +1 -1
  141. package/docs/commands/issue.md +1 -1
  142. package/docs/commands/kg.md +1 -1
  143. package/docs/commands/launch.md +1 -1
  144. package/docs/commands/lessons.md +201 -0
  145. package/docs/commands/list.md +1 -1
  146. package/docs/commands/ls.md +1 -1
  147. package/docs/commands/mcp.md +1 -1
  148. package/docs/commands/memory.md +1 -1
  149. package/docs/commands/models.md +1 -1
  150. package/docs/commands/more.md +1 -1
  151. package/docs/commands/new.md +1 -1
  152. package/docs/commands/notes.md +1 -1
  153. package/docs/commands/notify.md +1 -1
  154. package/docs/commands/observation.md +1 -1
  155. package/docs/commands/obsidian.md +1 -1
  156. package/docs/commands/open.md +1 -1
  157. package/docs/commands/pane.md +1 -1
  158. package/docs/commands/pause.md +1 -1
  159. package/docs/commands/plan.md +1 -1
  160. package/docs/commands/project.md +1 -1
  161. package/docs/commands/projects.md +1 -1
  162. package/docs/commands/providers.md +1 -1
  163. package/docs/commands/queue.md +1 -1
  164. package/docs/commands/registry.md +1 -1
  165. package/docs/commands/reload.md +1 -1
  166. package/docs/commands/rename.md +1 -1
  167. package/docs/commands/restore.md +1 -1
  168. package/docs/commands/resume.md +1 -1
  169. package/docs/commands/router.md +1 -1
  170. package/docs/commands/rules.md +70 -0
  171. package/docs/commands/session.md +1 -1
  172. package/docs/commands/sessions.md +1 -1
  173. package/docs/commands/setup.md +1 -1
  174. package/docs/commands/setups.md +1 -1
  175. package/docs/commands/shell-init.md +1 -1
  176. package/docs/commands/skill.md +1 -1
  177. package/docs/commands/task.md +1 -1
  178. package/docs/commands/tasks.md +1 -1
  179. package/docs/commands/topic.md +1 -1
  180. package/docs/commands/update.md +1 -1
  181. package/docs/commands/worker.md +1 -1
  182. package/docs/commands/zettel.md +1 -1
  183. package/docs/concepts/panes.md +3 -2
  184. package/gemini-extension.json +1 -1
  185. package/package.json +2 -2
  186. package/pai-plugin.json +1 -1
  187. package/plugins/context-preservation/plugin.json +1 -1
  188. package/plugins/core/plugin.json +1 -1
  189. package/plugins/creative/plugin.json +1 -1
  190. package/plugins/observability/plugin.json +1 -1
  191. package/plugins/productivity/plugin.json +1 -1
  192. package/plugins/semantic-search/plugin.json +1 -1
  193. package/plugins/ui/plugin.json +1 -1
  194. package/plugins/zettelkasten/plugin.json +1 -1
  195. package/src/hooks/ts/lib/loop-guard.ts +3 -5
  196. package/src/hooks/ts/lib/rules/builtin/base64-decode-to-shell.rule.yaml +13 -0
  197. package/src/hooks/ts/lib/rules/builtin/chmod-world-writable.rule.yaml +13 -0
  198. package/src/hooks/ts/lib/rules/builtin/chmod-zero.rule.yaml +11 -0
  199. package/src/hooks/ts/lib/rules/builtin/credential-file-read.rule.yaml +13 -0
  200. package/src/hooks/ts/lib/rules/builtin/credential-read-then-network.rule.yaml +29 -0
  201. package/src/hooks/ts/lib/rules/builtin/crontab-persistence.rule.yaml +10 -0
  202. package/src/hooks/ts/lib/rules/builtin/curl-piped-to-shell.rule.yaml +15 -0
  203. package/src/hooks/ts/lib/rules/builtin/download-then-execute.rule.yaml +30 -0
  204. package/src/hooks/ts/lib/rules/builtin/find-root-delete.rule.yaml +11 -0
  205. package/src/hooks/ts/lib/rules/builtin/git-push-force.rule.yaml +24 -0
  206. package/src/hooks/ts/lib/rules/builtin/git-push-plus-refspec.rule.yaml +12 -0
  207. package/src/hooks/ts/lib/rules/builtin/git-reset-hard.rule.yaml +12 -0
  208. package/src/hooks/ts/lib/rules/builtin/injection-then-tool.rule.yaml +30 -0
  209. package/src/hooks/ts/lib/rules/builtin/instruction-override-disregard.rule.yaml +12 -0
  210. package/src/hooks/ts/lib/rules/builtin/instruction-override-ignore.rule.yaml +13 -0
  211. package/src/hooks/ts/lib/rules/builtin/launchagents-write-persistence.rule.yaml +12 -0
  212. package/src/hooks/ts/lib/rules/builtin/launchctl-load-persistence.rule.yaml +10 -0
  213. package/src/hooks/ts/lib/rules/builtin/reverse-shell-dev-tcp.rule.yaml +11 -0
  214. package/src/hooks/ts/lib/rules/builtin/reverse-shell-interactive-bash.rule.yaml +11 -0
  215. package/src/hooks/ts/lib/rules/builtin/rm-recursive-parent.rule.yaml +11 -0
  216. package/src/hooks/ts/lib/rules/builtin/rm-recursive-relative.rule.yaml +11 -0
  217. package/src/hooks/ts/lib/rules/builtin/rm-recursive-root.rule.yaml +24 -0
  218. package/src/hooks/ts/lib/rules/builtin/rm-trailing-tilde.rule.yaml +11 -0
  219. package/src/hooks/ts/lib/rules/builtin/sudoers-nopasswd.rule.yaml +15 -0
  220. package/src/hooks/ts/lib/rules/builtin.generated.ts +530 -0
  221. package/src/hooks/ts/lib/rules/eval.ts +74 -0
  222. package/src/hooks/ts/lib/rules/lint.ts +102 -0
  223. package/src/hooks/ts/lib/rules/load.ts +229 -0
  224. package/src/hooks/ts/lib/rules/types.ts +56 -0
  225. package/src/hooks/ts/pre-tool-use/security-validator.ts +27 -96
  226. package/src/hooks/ts/user-prompt/handoff-link.ts +34 -0
  227. package/dist/aibroker-client-BxzeEHPF.mjs +0 -3
  228. package/dist/auto-route-C3S2W3Bc.mjs +0 -11
  229. package/dist/budget-BrloTOZW.mjs +0 -15
  230. package/dist/cockpit-memory-teG9M8bG.mjs +0 -20
  231. package/dist/config-Cxi-aBf4.mjs +0 -4
  232. package/dist/daemon-DeYImF1F.mjs +0 -45
  233. package/dist/detect-Rrimh0xc.mjs +0 -10
  234. package/dist/factory-Bs9imVMq.mjs +0 -9
  235. package/dist/kill-tree-SV6hrIa3.mjs +0 -10
  236. package/dist/operator-BTqvTIc8.mjs +0 -7
  237. package/dist/providers-FvCLzFge.mjs +0 -16
  238. package/dist/registrable-BzH4TObg.mjs +0 -9
  239. package/dist/render-B35bQTE-.mjs +0 -13
  240. package/dist/render-C84BqQRC.mjs +0 -903
  241. package/dist/root-DD1xx_Vu.mjs +0 -36
  242. package/dist/route-table-FEfDuhIV.mjs +0 -15
  243. package/dist/session-BAhtXdxj.mjs +0 -35
  244. package/dist/session-scan-B57dNuA4.mjs +0 -9
  245. package/dist/status-Dm4dYciN.mjs +0 -6
  246. package/dist/viewer-DEySE4c_.mjs +0 -22
  247. package/dist/worker-config-CO5FXLAT.mjs +0 -41
  248. package/dist/workers-config-f8KrkY4L.mjs +0 -4
@@ -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.4",
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-BcZyJguM.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-21GdHL70.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-Bu1_vbY8.mjs";
3
- import { i as itermUuid } from "./scope-D-h6F6DN.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-yLFb7CKq.mjs.map
374
+ //# sourceMappingURL=caller-identity-C6Nc96iM.mjs.map
@@ -1,5 +1,6 @@
1
- import { m as isLocalProvider } from "./config-XpZWOYOG.mjs";
2
- import { O as reconcileStatuses, g as isLive, s as alive, v as loadStatus, w as ownsPid, y as loadStatuses } from "./status-ggJ7lgVg.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,11 +415,53 @@ 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);
412
462
  if (o.disabled || !cfg.enabled || o.cap === void 0 || o.cap <= 0) return null;
413
- const { logDir, self, cap } = o;
463
+ const { logDir, self } = o;
464
+ let cap = o.cap;
414
465
  const load = o.load ?? ((dir) => (reconcileStatuses(dir, /* @__PURE__ */ new Date(), 0), loadStatuses(dir)));
415
466
  const now = o.now ?? Date.now;
416
467
  const isAlive = o.isAlive ?? alive;
@@ -458,13 +509,24 @@ async function capacityGate(o) {
458
509
  o.log?.(info().line);
459
510
  let lastBeat = t0;
460
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
+ });
461
519
  try {
462
520
  o.onWait?.(info());
521
+ o.onQueued?.(paneQueued(info()));
463
522
  for (let n = 0;; n++) {
464
523
  await sleep(backoffMs(n));
524
+ const fresh = o.capOf?.();
525
+ if (fresh !== void 0 && fresh > 0) cap = fresh;
465
526
  c = check();
466
527
  if (c.position === 1 && c.holding < cap) break;
467
528
  o.onWait?.(info());
529
+ o.onQueued?.(paneQueued(info()));
468
530
  if (!alarmed && o.onAlarm && now() - t0 >= (o.alarmMs ?? cfg.maxTotalWaitMs)) {
469
531
  alarmed = true;
470
532
  o.onAlarm(info());
@@ -479,6 +541,7 @@ async function capacityGate(o) {
479
541
  }
480
542
  const waitedSec = Math.round((now() - t0) / 100) / 10;
481
543
  o.onWait?.(null);
544
+ o.onQueued?.(null);
482
545
  o.log?.(`waited ${waitedSec}s for a ${label} slot`);
483
546
  return {
484
547
  waitedSec,
@@ -487,5 +550,5 @@ async function capacityGate(o) {
487
550
  }
488
551
 
489
552
  //#endregion
490
- 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 };
491
- //# sourceMappingURL=capacity-DEveQdFV.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 { j as readWorkersSection, wt as appendLedger } from "./config-XpZWOYOG.mjs";
2
- import { i as ledgerPath, u as workersLogDir } from "./paths-CHifubDh.mjs";
3
- import { $ as isFlagToken, S as newWorkerId, nt as shortText } from "./status-ggJ7lgVg.mjs";
4
- import { t as runWorker } from "./run-BwZKBJZZ.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-D7PFur8Y.mjs.map
166
+ //# sourceMappingURL=chain-CtK49-Ma.mjs.map