@tekmidian/pai 1.0.5 → 1.0.7

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 (247) 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-CAlZ5p-h.mjs +11 -0
  5. package/dist/{auto-route-DUYr57rs.mjs → auto-route-PDOAYszN.mjs} +2 -2
  6. package/dist/budget-BXmsSBLI.mjs +15 -0
  7. package/dist/{caller-identity-Bim8JT-D.mjs → caller-identity-DPDSrZE2.mjs} +4 -4
  8. package/dist/{capacity-CsZMkVyg.mjs → capacity-CThSydrd.mjs} +82 -10
  9. package/dist/{chain-Dzz6xcKH.mjs → chain-BvdKqRiZ.mjs} +5 -5
  10. package/dist/cli/index.mjs +2175 -284
  11. package/dist/{cockpit-actions-BTA1njMO.mjs → cockpit-actions-BgdKB9G3.mjs} +26 -26
  12. package/dist/{cockpit-actions-BgsiNcUY.mjs → cockpit-actions-DNl0rKfW.mjs} +18 -18
  13. package/dist/cockpit-memory-CqLPjcWe.mjs +20 -0
  14. package/dist/config/defaults/config.yaml +24 -1
  15. package/dist/config/defaults/workers.yaml +2 -0
  16. package/dist/{config-h5qK3fst.mjs → config-C2dd2SXS.mjs} +2 -2
  17. package/dist/{config-CST2uq1v.mjs → config-DGV64YJa.mjs} +11 -3
  18. package/dist/{config-Dv3t7xnT.mjs → config-DHgPx3ER.mjs} +1 -1
  19. package/dist/{config-DYbyEe4-.mjs → config-SlZ-Z52i.mjs} +3 -2
  20. package/dist/{controls-OiVVbe-f.mjs → controls-ByrcupcA.mjs} +59 -66
  21. package/dist/daemon/index.mjs +40 -40
  22. package/dist/{daemon-C1dycZ3W.mjs → daemon-BjgJyJMP.mjs} +79 -31
  23. package/dist/daemon-iymy18Ie.mjs +46 -0
  24. package/dist/daemon-mcp/index.mjs +49 -38
  25. package/dist/detect-C8nFP-kR.mjs +10 -0
  26. package/dist/{detect-CHuxFrLy.mjs → detect-DLjeYwnt.mjs} +2 -2
  27. package/dist/{embed-pass-DtVF2fOV.mjs → embed-pass-DdTMn4DH.mjs} +5 -5
  28. package/dist/{embedding-gate-B98PK_wz.mjs → embedding-gate-BVQvUmox.mjs} +2 -2
  29. package/dist/{embedding-gate-CTAk8STe.mjs → embedding-gate-iq0oQEkF.mjs} +3 -3
  30. package/dist/{endreason-BqyyU7BH.mjs → endreason-BjPom527.mjs} +4 -4
  31. package/dist/{factory-BV0MQA3T.mjs → factory-CYwa0jYj.mjs} +6 -6
  32. package/dist/factory-DFwez99M.mjs +9 -0
  33. package/dist/{fallback-Bj2cyVk_.mjs → fallback-CQ8_CuVu.mjs} +9 -231
  34. package/dist/{health-kufVIf6i.mjs → health-Bb2U4PNK.mjs} +5 -5
  35. package/dist/{helpers-CvbYEKoD.mjs → helpers-Dj2nY56t.mjs} +2 -2
  36. package/dist/{helpers-WV8tdQHM.mjs → helpers-DyHKAwrW.mjs} +6 -6
  37. package/dist/hooks/block-sleep-poll.mjs +9 -0
  38. package/dist/hooks/capture-all-events.mjs +99 -3
  39. package/dist/hooks/capture-tool-output.mjs +99 -3
  40. package/dist/hooks/handoff-link.mjs +159 -0
  41. package/dist/hooks/load-project-context.mjs +10 -1
  42. package/dist/hooks/local-model-hint.mjs +9 -0
  43. package/dist/hooks/route-agents-to-worker.mjs +9 -0
  44. package/dist/hooks/security-validator.mjs +940 -92
  45. package/dist/hooks/supervision-banner.mjs +219 -48
  46. package/dist/hooks/worker-edit-repair.mjs +9 -0
  47. package/dist/hooks/worker-guard.mjs +97 -1
  48. package/dist/hooks/worker-note.mjs +108 -3
  49. package/dist/hooks/worker-pool-host.mjs +1670 -315
  50. package/dist/hooks/worker-proxy.mjs +9 -0
  51. package/dist/hooks/worker-status-line.mjs +251 -70
  52. package/dist/hooks/worker-supervision.mjs +9 -0
  53. package/dist/hooks/worker-tool-name-repair.mjs +9 -0
  54. package/dist/index.mjs +9 -9
  55. package/dist/{ipc-client-CnYEF31R.mjs → ipc-client-CmagIFLh.mjs} +2 -2
  56. package/dist/{ipc-client-DN7EvoVo.mjs → ipc-client-DmbSIBUK.mjs} +1 -1
  57. package/dist/kill-tree-BlPw1vaU.mjs +10 -0
  58. package/dist/{kill-tree-CcpsRLCZ.mjs → kill-tree-DTmiEb3T.mjs} +8 -8
  59. package/dist/{launch-DpQPZGsT.mjs → launch-CV6oPHI2.mjs} +3 -3
  60. package/dist/{launch-UPQBoW2q.mjs → launch-Dy8qQnSD.mjs} +3 -3
  61. package/dist/{indexer-backend-B2vtFl38.mjs → lessons-CdmqZD0G.mjs} +262 -43
  62. package/dist/{local-candidate-Cp_bw4kK.mjs → local-candidate-C2FGhf54.mjs} +3 -3
  63. package/dist/{local-instances-bdCNNSsL.mjs → local-instances-DhF4_sV2.mjs} +2 -2
  64. package/dist/{local-instances-B-c-CxzP.mjs → local-instances-GgXydQ2P.mjs} +4 -4
  65. package/dist/{local-tiers-BtdEEe5n.mjs → local-tiers-CqwGUcEn.mjs} +3 -3
  66. package/dist/{local-tiers-OBqAAfOg.mjs → local-tiers-X_dQfI4Q.mjs} +3 -3
  67. package/dist/{main-config-ops-BYsK3BxM.mjs → main-config-ops-C_fkINDv.mjs} +3 -3
  68. package/dist/{main-resolver-CAC3xfZM.mjs → main-resolver-CN_sfG1R.mjs} +18 -18
  69. package/dist/{migrate-DrA_OwlZ.mjs → migrate-C2z1YmWC.mjs} +2 -2
  70. package/dist/{model-inventory-BuTpi9a6.mjs → model-inventory-BYNrSTaY.mjs} +13 -13
  71. package/dist/{models-add-CJx2YAwh.mjs → models-add-Dc7VXmcu.mjs} +38 -38
  72. package/dist/operator-IrLbk8hy.mjs +7 -0
  73. package/dist/{operator-DrwWItVt.mjs → operator-lRGvYr3D.mjs} +2 -2
  74. package/dist/{pai-marker-DLKJ9Yr5.mjs → pai-marker-kA0iM7rP.mjs} +2 -2
  75. package/dist/{pane-audit-wv9UkyCe.mjs → pane-audit-DUuilP1V.mjs} +13 -23
  76. package/dist/{paths-DS5VQKoR.mjs → paths-BwfwHOvN.mjs} +4 -4
  77. package/dist/{paths-DBd78I7Z.mjs → paths-CKGYM0Lb.mjs} +3 -3
  78. package/dist/{planner-K0mFrCpL.mjs → planner-BDHVUkIM.mjs} +29 -29
  79. package/dist/{pool-BZ94nFuq.mjs → pool-CFeHGX7q.mjs} +2 -2
  80. package/dist/{pool-cli-BjYQDfx6.mjs → pool-cli-Bj2TeA-d.mjs} +6 -6
  81. package/dist/{pool-cli-B1eKySeN.mjs → pool-cli-DOLgPgOM.mjs} +5 -5
  82. package/dist/{postgres-CBHY5PIi.mjs → postgres-B1B80bcj.mjs} +3 -3
  83. package/dist/{postgres-C-T5OWer.mjs → postgres-BL5oBBgY.mjs} +3 -3
  84. package/dist/{project-setup-pIPHZaXf.mjs → project-setup-i5D0xkTn.mjs} +24 -25
  85. package/dist/{providers-Dzx5GAUI.mjs → providers-BC2Myo_O.mjs} +6 -6
  86. package/dist/providers-C-mnlH1b.mjs +16 -0
  87. package/dist/{query-feedback-DN52N9C5.mjs → query-feedback-BWl2HRwN.mjs} +2 -2
  88. package/dist/registrable-Ct0DKNKS.mjs +9 -0
  89. package/dist/{registrable-CXBBpUcz.mjs → registrable-D_4qXCnq.mjs} +4 -4
  90. package/dist/render-CbifCwTb.mjs +2350 -0
  91. package/dist/render-FB4Fv_fi.mjs +13 -0
  92. package/dist/root-80ESg6b7.mjs +36 -0
  93. package/dist/{root-bG48WVpW.mjs → root-B-ZYiEgi.mjs} +10 -10
  94. package/dist/route-table-DcBZCuco.mjs +15 -0
  95. package/dist/{router-CQSc3lk3.mjs → router-D2476pOp.mjs} +2 -2
  96. package/dist/{router-DwHJRgG9.mjs → router-ghujlEFb.mjs} +1 -1
  97. package/dist/{routing-BlD_tKjW.mjs → routing-CF0wlR-_.mjs} +15 -15
  98. package/dist/{routing-D27jxj9x.mjs → routing-CJ8ioPl2.mjs} +13 -13
  99. package/dist/{run-AZVwceiU.mjs → run-CAjfKBQV.mjs} +74 -31
  100. package/dist/{runtime-paths-WsO9sJFc.mjs → runtime-paths-twfV23YL.mjs} +2 -2
  101. package/dist/{scan-C3uotg_f.mjs → scan-ew8M6tTH.mjs} +7 -7
  102. package/dist/{scope-D8HK6vU7.mjs → scope-BRcaPw5D.mjs} +4 -4
  103. package/dist/session-BmQsXF_a.mjs +35 -0
  104. package/dist/{session-BAfypQb9.mjs → session-C1JnDXvP.mjs} +28 -28
  105. package/dist/session-scan-DWCUKhDM.mjs +9 -0
  106. package/dist/{session-scan-BmnjSReu.mjs → session-scan-DihMibI-.mjs} +6 -6
  107. package/dist/{session-usage-oycSdiD3.mjs → session-usage-BRIWFYPS.mjs} +3 -3
  108. package/dist/status-Bj4yVKj0.mjs +6 -0
  109. package/dist/{status-COtzewKV.mjs → status-DTMT5lyn.mjs} +9 -5
  110. package/dist/{tool-errors-DXJ70-sr.mjs → tool-errors-BOW2n882.mjs} +2 -2
  111. package/dist/{tool-errors-B2LnIqR0.mjs → tool-errors-jNJj3Gzm.mjs} +6 -6
  112. package/dist/{viewer-BgGRqXfD.mjs → viewer-4BU8w_gK.mjs} +16 -14
  113. package/dist/viewer-D3VEdqhC.mjs +22 -0
  114. package/dist/{wait-ChpHKJZV.mjs → wait-BindDA5w.mjs} +3 -3
  115. package/dist/{worker-config-DgdT0iTB.mjs → worker-config-CdPmb4_2.mjs} +54 -103
  116. package/dist/worker-config-CfV2dgSb.mjs +42 -0
  117. package/dist/{workers-config-BhZBrR-Q.mjs → workers-config-2VipVOYk.mjs} +2 -2
  118. package/dist/{worktree-BY--Rgmy.mjs → worktree-7ZS3RBf8.mjs} +175 -9
  119. package/dist/{zettelkasten-BHVx5zj-.mjs → zettelkasten-BH8AdNh8.mjs} +4 -4
  120. package/dist/{zettelkasten-LoH9RBiN.mjs → zettelkasten-FFhQFESJ.mjs} +2 -2
  121. package/docs/commands/README.md +32 -2
  122. package/docs/commands/audit.md +34 -3
  123. package/docs/commands/backup.md +1 -1
  124. package/docs/commands/build.md +4 -4
  125. package/docs/commands/cd.md +1 -1
  126. package/docs/commands/clear-names.md +1 -1
  127. package/docs/commands/cockpit.md +1 -1
  128. package/docs/commands/config.md +1 -1
  129. package/docs/commands/daemon.md +1 -1
  130. package/docs/commands/db.md +1 -1
  131. package/docs/commands/doc.md +1 -1
  132. package/docs/commands/end.md +1 -1
  133. package/docs/commands/find.md +1 -1
  134. package/docs/commands/git.md +110 -0
  135. package/docs/commands/handoff.md +70 -0
  136. package/docs/commands/harness.md +74 -0
  137. package/docs/commands/help.md +1 -1
  138. package/docs/commands/home.md +1 -1
  139. package/docs/commands/hooks-db.md +1 -1
  140. package/docs/commands/identity.md +1 -1
  141. package/docs/commands/install.md +1 -1
  142. package/docs/commands/issue.md +1 -1
  143. package/docs/commands/kg.md +1 -1
  144. package/docs/commands/launch.md +1 -1
  145. package/docs/commands/lessons.md +201 -0
  146. package/docs/commands/list.md +1 -1
  147. package/docs/commands/ls.md +1 -1
  148. package/docs/commands/mcp.md +1 -1
  149. package/docs/commands/memory.md +1 -1
  150. package/docs/commands/models.md +1 -1
  151. package/docs/commands/more.md +1 -1
  152. package/docs/commands/new.md +1 -1
  153. package/docs/commands/notes.md +1 -1
  154. package/docs/commands/notify.md +1 -1
  155. package/docs/commands/observation.md +1 -1
  156. package/docs/commands/obsidian.md +1 -1
  157. package/docs/commands/open.md +1 -1
  158. package/docs/commands/pane.md +1 -1
  159. package/docs/commands/pause.md +1 -1
  160. package/docs/commands/plan.md +1 -1
  161. package/docs/commands/project.md +1 -1
  162. package/docs/commands/projects.md +1 -1
  163. package/docs/commands/providers.md +1 -1
  164. package/docs/commands/queue.md +1 -1
  165. package/docs/commands/registry.md +1 -1
  166. package/docs/commands/reload.md +1 -1
  167. package/docs/commands/rename.md +1 -1
  168. package/docs/commands/restore.md +1 -1
  169. package/docs/commands/resume.md +1 -1
  170. package/docs/commands/router.md +1 -1
  171. package/docs/commands/rules.md +70 -0
  172. package/docs/commands/session.md +1 -1
  173. package/docs/commands/sessions.md +1 -1
  174. package/docs/commands/setup.md +1 -1
  175. package/docs/commands/setups.md +1 -1
  176. package/docs/commands/shell-init.md +1 -1
  177. package/docs/commands/skill.md +1 -1
  178. package/docs/commands/task.md +1 -1
  179. package/docs/commands/tasks.md +1 -1
  180. package/docs/commands/topic.md +1 -1
  181. package/docs/commands/update.md +1 -1
  182. package/docs/commands/worker.md +1 -1
  183. package/docs/commands/zettel.md +1 -1
  184. package/docs/concepts/panes.md +3 -2
  185. package/gemini-extension.json +1 -1
  186. package/package.json +2 -2
  187. package/pai-plugin.json +1 -1
  188. package/plugins/context-preservation/plugin.json +1 -1
  189. package/plugins/core/plugin.json +1 -1
  190. package/plugins/creative/plugin.json +1 -1
  191. package/plugins/observability/plugin.json +1 -1
  192. package/plugins/productivity/plugin.json +1 -1
  193. package/plugins/semantic-search/plugin.json +1 -1
  194. package/plugins/ui/plugin.json +1 -1
  195. package/plugins/zettelkasten/plugin.json +1 -1
  196. package/src/hooks/ts/lib/loop-guard.ts +3 -5
  197. package/src/hooks/ts/lib/rules/builtin/base64-decode-to-shell.rule.yaml +15 -0
  198. package/src/hooks/ts/lib/rules/builtin/chmod-world-writable.rule.yaml +13 -0
  199. package/src/hooks/ts/lib/rules/builtin/chmod-zero.rule.yaml +13 -0
  200. package/src/hooks/ts/lib/rules/builtin/credential-file-read.rule.yaml +13 -0
  201. package/src/hooks/ts/lib/rules/builtin/credential-read-then-network.rule.yaml +29 -0
  202. package/src/hooks/ts/lib/rules/builtin/crontab-persistence.rule.yaml +10 -0
  203. package/src/hooks/ts/lib/rules/builtin/curl-piped-to-shell.rule.yaml +22 -0
  204. package/src/hooks/ts/lib/rules/builtin/download-then-execute.rule.yaml +30 -0
  205. package/src/hooks/ts/lib/rules/builtin/find-root-delete.rule.yaml +14 -0
  206. package/src/hooks/ts/lib/rules/builtin/git-push-force.rule.yaml +24 -0
  207. package/src/hooks/ts/lib/rules/builtin/git-push-plus-refspec.rule.yaml +12 -0
  208. package/src/hooks/ts/lib/rules/builtin/git-reset-hard.rule.yaml +12 -0
  209. package/src/hooks/ts/lib/rules/builtin/injection-then-tool.rule.yaml +30 -0
  210. package/src/hooks/ts/lib/rules/builtin/instruction-override-disregard.rule.yaml +14 -0
  211. package/src/hooks/ts/lib/rules/builtin/instruction-override-ignore.rule.yaml +13 -0
  212. package/src/hooks/ts/lib/rules/builtin/launchagents-write-persistence.rule.yaml +12 -0
  213. package/src/hooks/ts/lib/rules/builtin/launchctl-load-persistence.rule.yaml +10 -0
  214. package/src/hooks/ts/lib/rules/builtin/reverse-shell-dev-tcp.rule.yaml +14 -0
  215. package/src/hooks/ts/lib/rules/builtin/reverse-shell-interactive-bash.rule.yaml +12 -0
  216. package/src/hooks/ts/lib/rules/builtin/rm-recursive-parent.rule.yaml +13 -0
  217. package/src/hooks/ts/lib/rules/builtin/rm-recursive-relative.rule.yaml +12 -0
  218. package/src/hooks/ts/lib/rules/builtin/rm-recursive-root.rule.yaml +27 -0
  219. package/src/hooks/ts/lib/rules/builtin/rm-trailing-tilde.rule.yaml +12 -0
  220. package/src/hooks/ts/lib/rules/builtin/sudoers-nopasswd.rule.yaml +15 -0
  221. package/src/hooks/ts/lib/rules/builtin.generated.ts +557 -0
  222. package/src/hooks/ts/lib/rules/eval.ts +76 -0
  223. package/src/hooks/ts/lib/rules/lint.ts +108 -0
  224. package/src/hooks/ts/lib/rules/load.ts +264 -0
  225. package/src/hooks/ts/lib/rules/types.ts +58 -0
  226. package/src/hooks/ts/pre-tool-use/security-validator.ts +35 -96
  227. package/src/hooks/ts/user-prompt/handoff-link.ts +34 -0
  228. package/dist/aibroker-client-BxzeEHPF.mjs +0 -3
  229. package/dist/auto-route-DWYK_0i0.mjs +0 -11
  230. package/dist/budget-DX-VIWGf.mjs +0 -15
  231. package/dist/cockpit-memory-DIrNs4xr.mjs +0 -20
  232. package/dist/daemon-ieo0lnpq.mjs +0 -46
  233. package/dist/detect-C0ZBXqDL.mjs +0 -10
  234. package/dist/factory-DeASMV7Z.mjs +0 -9
  235. package/dist/kill-tree-CXZ0WfVf.mjs +0 -10
  236. package/dist/operator-Bpxq_WB5.mjs +0 -7
  237. package/dist/providers-QJzpaNhX.mjs +0 -16
  238. package/dist/registrable-Drn8wIDO.mjs +0 -9
  239. package/dist/render-C4KR8qQ8.mjs +0 -13
  240. package/dist/render-Cz3BWIBO.mjs +0 -903
  241. package/dist/root-Bfb1zgwE.mjs +0 -36
  242. package/dist/route-table-ZVMNBsy7.mjs +0 -15
  243. package/dist/session-BcnhepLZ.mjs +0 -35
  244. package/dist/session-scan-CqUQdCac.mjs +0 -9
  245. package/dist/status-D_SWmOlH.mjs +0 -6
  246. package/dist/viewer-CbGN2Ri4.mjs +0 -22
  247. 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.7",
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-DGV64YJa.mjs";
2
+ import "./config-SlZ-Z52i.mjs";
3
+ import "./paths-BwfwHOvN.mjs";
4
+ import "./worktree-7ZS3RBf8.mjs";
5
+ import "./status-DTMT5lyn.mjs";
6
+ import "./pool-CFeHGX7q.mjs";
7
+ import "./registrable-D_4qXCnq.mjs";
8
+ import "./pai-marker-kA0iM7rP.mjs";
9
+ import { n as formatAutoRouteJson, t as autoRoute } from "./auto-route-PDOAYszN.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-kA0iM7rP.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-PDOAYszN.mjs.map
@@ -0,0 +1,15 @@
1
+ import "./config-DGV64YJa.mjs";
2
+ import "./config-SlZ-Z52i.mjs";
3
+ import "./paths-BwfwHOvN.mjs";
4
+ import "./status-DTMT5lyn.mjs";
5
+ import "./scope-BRcaPw5D.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-CF0wlR-_.mjs";
7
+ import "./tool-errors-BOW2n882.mjs";
8
+ import "./wait-BindDA5w.mjs";
9
+ import "./local-tiers-CqwGUcEn.mjs";
10
+ import "./caller-identity-DPDSrZE2.mjs";
11
+ import "./capacity-CThSydrd.mjs";
12
+ import "./local-instances-DhF4_sV2.mjs";
13
+ import "./local-candidate-C2FGhf54.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-BRcaPw5D.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-DPDSrZE2.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-DGV64YJa.mjs";
2
+ import { O as reconcileStatuses, g as isLive, s as alive, v as loadStatus, w as ownsPid, y as loadStatuses } from "./status-DTMT5lyn.mjs";
3
+ import { D as fmtElapsed } from "./wait-BindDA5w.mjs";
3
4
  import { mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
5
  import { join } from "node:path";
5
6
 
@@ -195,9 +196,22 @@ function providerCap(config, provider) {
195
196
  /** Queue key of a session's `max_parallel` gate (a provider name never contains "~"). */
196
197
  const sessionScopeKey = (name) => `session~${name}`;
197
198
  const queueDir = (logDir, provider) => join(logDir, "queue", provider.replace(/[^\w.~-]/g, "_"));
199
+ /** Write a ticket atomically (temp + rename): a poller never reads it half-written. The ".tmp" suffix keeps it out of the listing. */
200
+ function writeTicket(path, text) {
201
+ const tmp = `${path}.${process.pid}.tmp`;
202
+ writeFileSync(tmp, text);
203
+ renameSync(tmp, path);
204
+ }
198
205
  const entryText = (e) => `${e.pid}${e.front ? " front" : ""}${e.rank === void 0 ? "" : ` ${e.rank}`}${e.since === void 0 ? "" : ` @${e.since}`}`;
206
+ /** A ticket deleted (its run stopped) or written unparsably between the listing and this read is absent, not an error. */
199
207
  function readEntry(dir, id) {
200
- const [p, ...marks] = readFileSync(join(dir, id), "utf8").trim().split(/\s+/);
208
+ let text;
209
+ try {
210
+ text = readFileSync(join(dir, id), "utf8");
211
+ } catch {
212
+ return null;
213
+ }
214
+ const [p, ...marks] = text.trim().split(/\s+/);
201
215
  const rank = marks.map(Number).find((n) => Number.isInteger(n));
202
216
  const at = marks.find((m) => m.startsWith("@"));
203
217
  const since = at ? Number(at.slice(1)) : NaN;
@@ -290,7 +304,9 @@ function liveEntries(logDir, provider, isAlive) {
290
304
  const out = [];
291
305
  for (const id of names.sort()) {
292
306
  const e = readEntry(dir, id);
293
- if (Number.isInteger(e.pid) && e.pid > 0 && isAlive(e.pid)) out.push(e);
307
+ if (!e) continue;
308
+ if (!Number.isInteger(e.pid) || e.pid <= 0) continue;
309
+ if (isAlive(e.pid)) out.push(e);
294
310
  else rmSync(join(dir, id), { force: true });
295
311
  }
296
312
  const group = (e) => e.front ? 0 : 1;
@@ -310,7 +326,7 @@ function liveQueue(logDir, provider, isAlive = alive, statuses, now, agingMs) {
310
326
  function setFront(logDir, provider, id, isAlive = alive) {
311
327
  const e = liveEntries(logDir, provider, isAlive).find((x) => x.id === id);
312
328
  if (!e) return false;
313
- if (!e.front) writeFileSync(join(queueDir(logDir, provider), id), entryText({
329
+ if (!e.front) writeTicket(join(queueDir(logDir, provider), id), entryText({
314
330
  ...e,
315
331
  front: true,
316
332
  rank: void 0
@@ -326,7 +342,7 @@ function moveUp(logDir, provider, id, isAlive = alive) {
326
342
  ...order[i],
327
343
  front: order[i - 1].front
328
344
  }, order[i - 1]];
329
- order.forEach((e, rank) => writeFileSync(join(queueDir(logDir, provider), e.id), entryText({
345
+ order.forEach((e, rank) => writeTicket(join(queueDir(logDir, provider), e.id), entryText({
330
346
  ...e,
331
347
  rank
332
348
  })));
@@ -348,7 +364,7 @@ function moveTo(logDir, provider, id, position, isAlive = alive) {
348
364
  ...e,
349
365
  front: near ? near.front : e.front
350
366
  });
351
- order.forEach((x, rank) => writeFileSync(join(queueDir(logDir, provider), x.id), entryText({
367
+ order.forEach((x, rank) => writeTicket(join(queueDir(logDir, provider), x.id), entryText({
352
368
  ...x,
353
369
  rank
354
370
  })));
@@ -406,6 +422,47 @@ function queuedText(q) {
406
422
  const hhmm = `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
407
423
  return `queued on ${q.provider}: position ${q.position} of ${q.queued}${q.behind ? `, behind ${q.behind}` : ""} — waiting since ${hhmm}`;
408
424
  }
425
+ /** The pane's queue line, refreshed in place: "queued on gyro-m · position 2 of 5 · waiting 2m10s · <label>". */
426
+ function queuedPaneLine(q) {
427
+ const parts = [
428
+ `queued on ${q.provider}`,
429
+ `position ${q.position} of ${q.queued}`,
430
+ `waiting ${fmtElapsed(q.elapsedSec)}`
431
+ ];
432
+ if (q.behind) parts.push(`behind ${q.behind}`);
433
+ if (q.label) parts.push(q.label.replace(/[\x00-\x1f\x7f-\x9f]/g, ""));
434
+ return parts.join(" · ");
435
+ }
436
+ /**
437
+ * The pane's queue file: <pane-exec dir>/<id>.queued, written while the run
438
+ * waits for a slot and removed when the command starts, so a pane opened
439
+ * before the queue shows its place in line instead of sitting empty. The
440
+ * wrapper (`pai pane exec`) prints it in place until the start frame arrives;
441
+ * a missing or malformed file is simply no queue line.
442
+ */
443
+ function queuedFilePath(dir, id) {
444
+ return join(dir, `${id}.queued`);
445
+ }
446
+ function readQueued(dir, id) {
447
+ try {
448
+ const q = JSON.parse(readFileSync(queuedFilePath(dir, id), "utf8"));
449
+ if (typeof q.provider !== "string" || !Number.isInteger(q.position) || !Number.isInteger(q.queued) || !Number.isInteger(q.elapsedSec)) return null;
450
+ return q;
451
+ } catch {
452
+ return null;
453
+ }
454
+ }
455
+ /** Write atomically (rename), so the wrapper's poll never reads a half-written file. */
456
+ function writeQueued(dir, id, q) {
457
+ mkdirSync(dir, { recursive: true });
458
+ const path = queuedFilePath(dir, id);
459
+ const tmp = `${path}.${process.pid}.tmp`;
460
+ writeFileSync(tmp, JSON.stringify(q), "utf8");
461
+ renameSync(tmp, path);
462
+ }
463
+ function removeQueued(dir, id) {
464
+ rmSync(queuedFilePath(dir, id), { force: true });
465
+ }
409
466
  /** 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
467
  async function capacityGate(o) {
411
468
  const cfg = capacityOf(o.config);
@@ -423,7 +480,7 @@ async function capacityGate(o) {
423
480
  mkdirSync(dir, { recursive: true });
424
481
  const entry = join(dir, self.id);
425
482
  const t0 = now();
426
- writeFileSync(entry, `${self.pid ?? process.pid}${o.priority === "front" ? " front" : ""} @${t0}`);
483
+ writeTicket(entry, `${self.pid ?? process.pid}${o.priority === "front" ? " front" : ""} @${t0}`);
427
484
  const check = () => {
428
485
  const loaded = load(logDir);
429
486
  const queue = liveQueue(logDir, queueKey, isAlive, loaded, now(), cfg.agingMs);
@@ -457,10 +514,23 @@ async function capacityGate(o) {
457
514
  };
458
515
  };
459
516
  o.log?.(info().line);
517
+ const queued = (q) => {
518
+ try {
519
+ o.onQueued?.(q);
520
+ } catch {}
521
+ };
460
522
  let lastBeat = t0;
461
523
  let alarmed = false;
524
+ const paneQueued = (i) => ({
525
+ provider: i.provider,
526
+ position: i.position,
527
+ queued: i.queued,
528
+ elapsedSec: i.elapsedSec,
529
+ ...c.behind ? { behind: c.behind } : {}
530
+ });
462
531
  try {
463
532
  o.onWait?.(info());
533
+ queued(paneQueued(info()));
464
534
  for (let n = 0;; n++) {
465
535
  await sleep(backoffMs(n));
466
536
  const fresh = o.capOf?.();
@@ -468,6 +538,7 @@ async function capacityGate(o) {
468
538
  c = check();
469
539
  if (c.position === 1 && c.holding < cap) break;
470
540
  o.onWait?.(info());
541
+ queued(paneQueued(info()));
471
542
  if (!alarmed && o.onAlarm && now() - t0 >= (o.alarmMs ?? cfg.maxTotalWaitMs)) {
472
543
  alarmed = true;
473
544
  o.onAlarm(info());
@@ -482,6 +553,7 @@ async function capacityGate(o) {
482
553
  }
483
554
  const waitedSec = Math.round((now() - t0) / 100) / 10;
484
555
  o.onWait?.(null);
556
+ queued(null);
485
557
  o.log?.(`waited ${waitedSec}s for a ${label} slot`);
486
558
  return {
487
559
  waitedSec,
@@ -490,5 +562,5 @@ async function capacityGate(o) {
490
562
  }
491
563
 
492
564
  //#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
565
+ 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 };
566
+ //# sourceMappingURL=capacity-CThSydrd.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-DGV64YJa.mjs";
2
+ import { i as ledgerPath, u as workersLogDir } from "./paths-BwfwHOvN.mjs";
3
+ import { S as newWorkerId, et as isFlagToken, rt as shortText } from "./status-DTMT5lyn.mjs";
4
+ import { t as runWorker } from "./run-CAjfKBQV.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-BvdKqRiZ.mjs.map