@tekmidian/pai 1.0.0 → 1.0.3

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 (219) 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-B7Yu6Uam.mjs} +3 -3
  7. package/dist/auto-route-CjjQqU1o.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-7n9Gx56r.mjs} +5 -5
  12. package/dist/cli/index.mjs +1628 -370
  13. package/dist/{cockpit-actions-ODmt8yF9.mjs → cockpit-actions-BBHeyEZI.mjs} +84 -42
  14. package/dist/cockpit-actions-DR9X514g.mjs +20 -0
  15. package/dist/cockpit-memory--dnShXBA.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-CPoeudou.mjs} +37 -22
  21. package/dist/daemon/index.mjs +43 -42
  22. package/dist/daemon-DKdBNKfa.mjs +45 -0
  23. package/dist/{daemon-CorGh6Ub.mjs → daemon-DPAo6WTa.mjs} +103 -55
  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 +329 -231
  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-Cll7le4P.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-C1QIc1DA.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-BcZyJguM.mjs} +7 -6
  83. package/dist/{pane-audit-OGYrOAik.mjs → pane-audit-DKQt71s4.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-BmFACdLa.mjs} +31 -30
  87. package/dist/{pool-CZ5MZaXg.mjs → pool-Dh-q3iJi.mjs} +45 -6
  88. package/dist/{pool-cli-BxNSPzzY.mjs → pool-cli-BggU8GRp.mjs} +5 -5
  89. package/dist/{pool-cli-CbJfl37y.mjs → pool-cli-DQ6OzRy2.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-jvfONJTQ.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-BzH4TObg.mjs +9 -0
  97. package/dist/{registrable-LrRIVYQc.mjs → registrable-DpyTtajg.mjs} +4 -4
  98. package/dist/{render-BDbb4CF-.mjs → render-BYmQkuLd.mjs} +8 -8
  99. package/dist/render-CoMvwMPs.mjs +13 -0
  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-FtJsxYnm.mjs +36 -0
  103. package/dist/{root-BMeJuHOb.mjs → root-Xglu0OPD.mjs} +11 -11
  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-CSC7mgPf.mjs} +35 -33
  110. package/dist/{scan-B7I0gPe-.mjs → scan-C_Y5W9py.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-CNXF6DLP.mjs → session-8iqQDkqb.mjs} +55 -31
  116. package/dist/session-BeqAbNPd.mjs +35 -0
  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-CqozWW39.mjs +22 -0
  128. package/dist/{viewer-DtWj5Vti.mjs → viewer-mDXUNHNy.mjs} +15 -15
  129. package/dist/{wait-BMUR-U-U.mjs → wait-ByV0OyMZ.mjs} +3 -3
  130. package/dist/{worker-config-BLqa1yiD.mjs → worker-config-CJhEMk19.mjs} +294 -92
  131. package/dist/worker-config-DESkIjMF.mjs +41 -0
  132. package/dist/{workers-config-DEI9lrV4.mjs → workers-config-f8KrkY4L.mjs} +2 -2
  133. package/dist/{worktree-zmRf556h.mjs → worktree-CRs2gyg0.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.png +0 -0
  149. package/docs/images/architecture.svg +3 -0
  150. package/docs/images/cockpit-01-system-tokens.jpg +0 -0
  151. package/docs/images/cockpit-02-totals-cache.jpg +0 -0
  152. package/docs/images/cockpit-03-local-servers-models-pool.jpg +0 -0
  153. package/docs/images/cockpit-04-workers-memory.jpg +0 -0
  154. package/docs/images/cockpit-05-performance.jpg +0 -0
  155. package/docs/images/cockpit-06-runs-speed-routing.jpg +0 -0
  156. package/docs/images/cockpit-07-settings-registry.jpg +0 -0
  157. package/docs/install/index.md +29 -0
  158. package/docs/three-tier-coding.md +1 -1
  159. package/gemini-extension.json +1 -1
  160. package/package.json +1 -5
  161. package/pai-plugin.json +1 -1
  162. package/plugins/context-preservation/plugin.json +1 -1
  163. package/plugins/core/plugin.json +1 -1
  164. package/plugins/core/skills/setup/SKILL.md +41 -9
  165. package/plugins/creative/plugin.json +1 -1
  166. package/plugins/observability/plugin.json +1 -1
  167. package/plugins/productivity/plugin.json +1 -1
  168. package/plugins/semantic-search/plugin.json +1 -1
  169. package/plugins/ui/plugin.json +1 -1
  170. package/plugins/zettelkasten/plugin.json +1 -1
  171. package/src/hooks/session-autosave.sh +8 -1
  172. package/src/hooks/session-stop.sh +8 -1
  173. package/src/hooks/ts/capture-all-events.ts +7 -12
  174. package/src/hooks/ts/lib/context-fill.ts +2 -1
  175. package/src/hooks/ts/lib/path-repair.ts +1 -1
  176. package/src/hooks/ts/lib/project-utils/notify.ts +1 -0
  177. package/src/hooks/ts/lib/project-utils/session-notes.ts +23 -6
  178. package/src/hooks/ts/lib/raw-capture.ts +36 -0
  179. package/src/hooks/ts/lib/session-summary.ts +129 -0
  180. package/src/hooks/ts/lib/todo-sync.ts +120 -0
  181. package/src/hooks/ts/lib/worker-git-guard.ts +1 -1
  182. package/src/hooks/ts/post-tool-use/capture-tool-output.ts +6 -10
  183. package/src/hooks/ts/post-tool-use/sync-todo-to-md.ts +5 -105
  184. package/src/hooks/ts/pre-compact/context-compression-hook.ts +1 -1
  185. package/src/hooks/ts/pre-tool-use/security-validator.ts +35 -14
  186. package/src/hooks/ts/session-end/capture-session-summary.ts +20 -128
  187. package/src/hooks/ts/session-start/load-core-context.ts +3 -3
  188. package/src/hooks/ts/session-start/load-project-context.ts +18 -22
  189. package/src/hooks/ts/stop/stop-hook.ts +13 -5
  190. package/src/hooks/ztk-auto.sh +7 -2
  191. package/dist/aibroker-client-JjE74jo0.mjs +0 -3
  192. package/dist/auto-route-BRk8NEFv.mjs +0 -11
  193. package/dist/budget-DuhQ2zzG.mjs +0 -14
  194. package/dist/cockpit-actions-DcQ-ucU8.mjs +0 -19
  195. package/dist/cockpit-memory-KV45PPO2.mjs +0 -19
  196. package/dist/daemon-C7yt_ptC.mjs +0 -44
  197. package/dist/detect-DRUkmHnb.mjs +0 -10
  198. package/dist/factory-DAGG9_n8.mjs +0 -9
  199. package/dist/helpers-DPJEHPq6.mjs +0 -10
  200. package/dist/kill-tree-LV0Q7Mte.mjs +0 -10
  201. package/dist/operator-CfL0HiBK.mjs +0 -7
  202. package/dist/postgres-DgqWyqhN.mjs +0 -7
  203. package/dist/providers-CTu2s1z2.mjs +0 -15
  204. package/dist/registrable-D9aNZOTh.mjs +0 -9
  205. package/dist/render-BSfVlYHj.mjs +0 -13
  206. package/dist/root-xI9DqVIe.mjs +0 -35
  207. package/dist/route-table-HjvnLVEU.mjs +0 -14
  208. package/dist/session-BJHzmUg2.mjs +0 -34
  209. package/dist/session-scan-YORKE1NO.mjs +0 -9
  210. package/dist/viewer-B8709jDN.mjs +0 -22
  211. package/dist/worker-config-D8tRuvo7.mjs +0 -40
  212. package/docs/images/cockpit-limits-routing.jpg +0 -0
  213. package/docs/images/cockpit-models.jpg +0 -0
  214. package/docs/images/cockpit-usage.jpg +0 -0
  215. package/docs/images/cockpit-workers-system.jpg +0 -0
  216. package/scripts/build-docs.mjs +0 -41
  217. package/scripts/build-hooks.mjs +0 -311
  218. package/scripts/build-skill-stubs.mjs +0 -216
  219. package/scripts/copy-defaults.mjs +0 -46
@@ -1,32 +1,33 @@
1
1
  import { c as ok, i as err, n as dim } from "./utils-J2b9y8PC.mjs";
2
2
  import { g as paiHomePath, l as claudeHomeDir } from "./runtime-paths-WsO9sJFc.mjs";
3
- import { X as readMergeVerify, c as WorkersConfigError, f as escalationCloud, h as isModelCapability, j as readWorkersSection, m as isLocalProvider, p as getProviderOrNative, t as ANTHROPIC_NATIVE } from "./config-D5chi2LO.mjs";
4
- import { i as ledgerPath, r as eventsPath, u as workersLogDir } from "./paths-DoIyRnhx.mjs";
5
- import { D as formatPending, O as pendingGate, b as verifyWorker, c as formatKnowledge, d as gcWorktrees, g as mergeWorker, k as pendingResults, m as leftoverWorktrees, s as discardWorker, u as gcPoolWorktrees } from "./worktree-zmRf556h.mjs";
6
- import { B as loadStatusConfig, C as nowStamp, F as ForgeError, H as setClaim, I as PROJECT_CONFIG_REL, K as PREAMBLE_MAX_BYTES, R as listClaims, V as parseStatusConfig, W as writeContinueToForge, Z as projectRoot, a as UNLABELED, et as longInlinePromptHint, g as isLive, j as setWorkerNote, k as saveStatus, o as ageOf, q as PREAMBLE_REL, s as alive, tt as parseRunnerArgs, v as loadStatus, w as ownsPid, y as loadStatuses, z as listStale } from "./status-CvVi9cDf.mjs";
7
- import { p as currentWorkerId } from "./scope-D5VSQxe4.mjs";
8
- import { C as detectSessionProvider, _n as probeLoopback, an as BATCH_ENV, bn as resolveRunnerProvider, dn as LOCAL_MECHANISM_LINE, in as detectSessionName, pt as isLoopbackProvider, xt as gcSettingsFiles, yn as resolveLocalProvider } from "./routing-CUyiglfu.mjs";
9
- import { C as statusMarker, S as realDeps, T as waitOn, a as runWait, w as statusQueue } from "./wait-BMUR-U-U.mjs";
10
- import { n as tierProviderNames, t as isLocalCandidate } from "./local-candidate-jOjTNlOL.mjs";
11
- import { a as liveQueue, f as sessionOf, l as reorderQueue, o as providerCap, s as queueRows, t as admitCap } from "./capacity-DaXrVj3J.mjs";
12
- import { n as OPT, t as CliError } from "./define-DGFu-sCf.mjs";
13
- import { c as resolveFromModule } from "./postgres-CDnd_k5f.mjs";
14
- import { C as workerUsage, S as usageJson, U as endProcesses, W as findWorktreeOrphans, _ as stopLaunchedWorkers, a as resolveWorkers, b as renderUsage, d as capture, h as realCommitsAhead, i as liveResolveCtx, m as mergeBranch, n as LocalProviderRefusedError, p as launchWorker, r as PoolRefusedError, t as runWorker, v as parseWhen } from "./run-ulAi5dFD.mjs";
15
- import { $ as checkPaneForWorker, A as tail, Gt as handoffFromInside, H as planLogTail, J as queueLockPath, Jt as LOCAL_FAILURE_LIMIT, N as filesOverlap, R as followPlanLog, W as planRunEnded, Xt as localFailures, Yt as classifyRoute, Z as withRunLock, Zt as routeLine, c as setMuted, ct as openFollowPane, et as closeEndedPanes, ft as paneBackend, gt as workerEnded, ht as resolveHostSession, lt as openPaneForWorker, pt as paneMayClose, st as loadRegistry, yt as psTable } from "./controls-BGkK_Bdi.mjs";
16
- import { R as parentFromEnv } from "./render-BDbb4CF-.mjs";
17
- import { r as sayToWorker } from "./operator-DZxcP-g8.mjs";
18
- import { i as killTree } from "./kill-tree-BjYz5BxK.mjs";
19
- import { t as runChain } from "./chain-BcQlIlEd.mjs";
20
- import { c as followPaneRun, i as listItermTabs, l as isPaneRunId, o as renderPaneAudit, s as runningProcs, t as auditPanes, u as loadPaneRunStatus } from "./pane-audit-OGYrOAik.mjs";
21
- import { a as followTailOutput, d as psOutput, f as replayOutput, m as statusLineOutput, o as followWorkers } from "./viewer-DtWj5Vti.mjs";
22
- import { _ as unsetCapabilityPreference, a as describeCapabilities, c as modelPrefsText, d as setCapabilityPreference, h as setProviderModel, o as describeModels, u as resolveProviderName } from "./providers-UsKtLcUR.mjs";
23
- import { appendFileSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
3
+ import { X as readMergeVerify, c as WorkersConfigError, f as escalationCloud, h as isModelCapability, j as readWorkersSection, m as isLocalProvider, p as getProviderOrNative, t as ANTHROPIC_NATIVE } from "./config-XpZWOYOG.mjs";
4
+ import { i as ledgerPath, r as eventsPath, u as workersLogDir } from "./paths-CHifubDh.mjs";
5
+ import { D as formatPending, O as pendingGate, b as verifyWorker, c as formatKnowledge, d as gcWorktrees, g as mergeWorker, k as pendingResults, m as leftoverWorktrees, s as discardWorker, u as gcPoolWorktrees } from "./worktree-CRs2gyg0.mjs";
6
+ import { B as loadStatusConfig, C as nowStamp, F as ForgeError, H as setClaim, I as PROJECT_CONFIG_REL, K as PREAMBLE_MAX_BYTES, R as listClaims, V as parseStatusConfig, W as writeContinueToForge, Z as projectRoot, a as UNLABELED, et as longInlinePromptHint, g as isLive, j as setWorkerNote, k as saveStatus, o as ageOf, q as PREAMBLE_REL, s as alive, tt as parseRunnerArgs, v as loadStatus, w as ownsPid, y as loadStatuses, z as listStale } from "./status-ggJ7lgVg.mjs";
7
+ import { p as currentWorkerId } from "./scope-D-h6F6DN.mjs";
8
+ import { C as detectSessionProvider, St as gcSettingsFiles, an as detectSessionName, bn as resolveLocalProvider, fn as LOCAL_MECHANISM_LINE, on as BATCH_ENV, pt as isLoopbackProvider, vn as probeLoopback, xn as resolveRunnerProvider } from "./routing-BAAST9vT.mjs";
9
+ import { C as statusMarker, S as realDeps, T as waitOn, a as runWait, w as statusQueue } from "./wait-ByV0OyMZ.mjs";
10
+ import { n as breakStaleMutex } from "./caller-identity-yLFb7CKq.mjs";
11
+ import { a as liveQueue, f as sessionOf, l as reorderQueue, o as providerCap, s as queueRows, t as admitCap } from "./capacity-DEveQdFV.mjs";
12
+ import { n as tierProviderNames, t as isLocalCandidate } from "./local-candidate-DLdwQt0s.mjs";
13
+ import { n as OPT, t as CliError } from "./define-CjJsmq-6.mjs";
14
+ import { c as resolveFromModule } from "./postgres-C6ti4haA.mjs";
15
+ import { C as workerUsage, S as usageJson, U as endProcesses, W as findWorktreeOrphans, _ as stopLaunchedWorkers, a as resolveWorkers, b as renderUsage, d as capture, h as realCommitsAhead, i as liveResolveCtx, m as mergeBranch, n as LocalProviderRefusedError, p as launchWorker, r as PoolRefusedError, t as runWorker, v as parseWhen } from "./run-CSC7mgPf.mjs";
16
+ import { $ as checkPaneForWorker, A as tail, Gt as handoffFromInside, H as planLogTail, J as queueLockPath, Jt as LOCAL_FAILURE_LIMIT, N as filesOverlap, R as followPlanLog, W as planRunEnded, Xt as localFailures, Yt as classifyRoute, Z as withRunLock, Zt as routeLine, c as setMuted, ct as openFollowPane, et as closeEndedPanes, ft as paneBackend, gt as workerEnded, ht as resolveHostSession, lt as openPaneForWorker, pt as paneMayClose, st as loadRegistry, yt as psTable } from "./controls-CPoeudou.mjs";
17
+ import { R as parentFromEnv } from "./render-BYmQkuLd.mjs";
18
+ import { r as sayToWorker } from "./operator-CyuB3aVw.mjs";
19
+ import { i as killTree } from "./kill-tree-EWYaEk5v.mjs";
20
+ import { t as runChain } from "./chain-7n9Gx56r.mjs";
21
+ import { c as followPaneRun, i as listItermTabs, l as isPaneRunId, o as renderPaneAudit, s as runningProcs, t as auditPanes, u as loadPaneRunStatus } from "./pane-audit-DKQt71s4.mjs";
22
+ import { a as followTailOutput, d as psOutput, f as replayOutput, m as statusLineOutput, o as followWorkers } from "./viewer-mDXUNHNy.mjs";
23
+ import { _ as unsetCapabilityPreference, a as describeCapabilities, c as modelPrefsText, d as setCapabilityPreference, h as setProviderModel, o as describeModels, u as resolveProviderName } from "./providers-CblTFrhz.mjs";
24
+ import { appendFileSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, rmdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
25
+ import { createHash, randomBytes } from "node:crypto";
24
26
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
25
27
  import { tmpdir } from "node:os";
26
28
  import { execFileSync, spawn } from "node:child_process";
27
29
  import { fileURLToPath } from "node:url";
28
30
  import { parse } from "yaml";
29
- import { createHash } from "node:crypto";
30
31
 
31
32
  //#region src/workers/specfile.ts
32
33
  /**
@@ -393,10 +394,25 @@ function renderHelpReport(entries) {
393
394
  lines.push("", [...perScope].map(([s, n]) => `${s}: ${n} call${n === 1 ? "" : "s"}`).join("; "));
394
395
  return lines.join("\n");
395
396
  }
397
+ /** Paths from `git status --porcelain -z`: NUL-separated, unquoted; a rename entry is followed by its source path. */
398
+ function parsePorcelainZ(out) {
399
+ const parts = out.split("\0").filter(Boolean);
400
+ const files = [];
401
+ for (let i = 0; i < parts.length; i++) {
402
+ const e = parts[i];
403
+ files.push(e.slice(3));
404
+ if (e[0] === "R" || e[0] === "C" || e[1] === "R" || e[1] === "C") i++;
405
+ }
406
+ return files;
407
+ }
396
408
  /** Real changed-file lister: git porcelain paths, empty outside git. */
397
409
  function gitChangedFiles(cwd) {
398
410
  try {
399
- return execFileSync("git", ["status", "--porcelain"], {
411
+ return parsePorcelainZ(execFileSync("git", [
412
+ "status",
413
+ "--porcelain",
414
+ "-z"
415
+ ], {
400
416
  cwd,
401
417
  encoding: "utf8",
402
418
  stdio: [
@@ -404,7 +420,7 @@ function gitChangedFiles(cwd) {
404
420
  "pipe",
405
421
  "ignore"
406
422
  ]
407
- }).split("\n").filter(Boolean).map((l) => l.slice(3));
423
+ }));
408
424
  } catch {
409
425
  return [];
410
426
  }
@@ -575,20 +591,24 @@ async function runProbed(o) {
575
591
  ]
576
592
  });
577
593
  let last = Date.now();
578
- let probed = false;
594
+ let probing = false;
595
+ let announcedIdle = false;
579
596
  let spun = false;
580
597
  let pending = Promise.resolve();
581
598
  child.stdout.on("data", (d) => (last = Date.now(), out(d.toString())));
582
599
  child.stderr.on("data", (d) => (last = Date.now(), err(d.toString())));
583
600
  const timer = setInterval(() => {
584
- if (probed || Date.now() - last < idle * 1e3 || !child.pid) return;
585
- probed = true;
601
+ if (probing || spun || Date.now() - last < idle * 1e3 || !child.pid) return;
602
+ probing = true;
586
603
  const pids = nodeDescendants(child.pid);
587
604
  for (const p of pids) writeFileSync(join(o.reportDir, `probe-${p}`), "");
588
605
  pending = collectFrames(o.reportDir, pids, 3e3).then((frames) => {
589
606
  for (const p of pids) rmQuiet(join(o.reportDir, `probe-${p}`));
590
- err(`\n${diagnose(frames, o.cwd, idle)}\n`);
591
- if (frames.some((f) => userFrames(f, o.cwd).length > 0)) {
607
+ const stuck = frames.some((f) => userFrames(f, o.cwd).length > 0);
608
+ if (stuck || !announcedIdle) err(`\n${diagnose(frames, o.cwd, idle)}\n`);
609
+ announcedIdle = true;
610
+ probing = false;
611
+ if (stuck) {
592
612
  spun = true;
593
613
  for (const p of [...pids, child.pid]) killQuiet(p, "SIGTERM");
594
614
  setTimeout(() => pids.forEach((p) => killQuiet(p, "SIGKILL")), 2e3).unref();
@@ -1666,7 +1686,7 @@ const errorsCommand = {
1666
1686
  examples: ["pai worker errors", "pai worker errors --since 2h"],
1667
1687
  seeAlso: ["pai worker log"],
1668
1688
  run: (ctx) => guard("pai worker errors --since 24h", async () => {
1669
- const { errorsTable, groupToolErrors, parseSince, readToolErrors } = await import("./tool-errors-R5E0fCgf.mjs");
1689
+ const { errorsTable, groupToolErrors, parseSince, readToolErrors } = await import("./tool-errors-CJWODvlo.mjs");
1670
1690
  const since = str(ctx.opts.since) ?? "24h";
1671
1691
  const ms = parseSince(since);
1672
1692
  if (ms === null) throw new Error(`bad --since "${since}" (use 30m, 2h, 1d)`);
@@ -2564,29 +2584,59 @@ var QueueStore = class {
2564
2584
  this.path = path;
2565
2585
  this.now = now;
2566
2586
  }
2587
+ /** A missing file is an empty queue; anything unreadable is refused so the next write cannot replace it. */
2567
2588
  read() {
2568
2589
  if (!existsSync(this.path)) return {
2569
2590
  next: 1,
2570
2591
  items: []
2571
2592
  };
2593
+ let s;
2572
2594
  try {
2573
- const s = JSON.parse(readFileSync(this.path, "utf8"));
2574
- return {
2575
- next: s.next ?? s.items.length + 1,
2576
- items: s.items ?? []
2577
- };
2578
- } catch {
2579
- return {
2580
- next: 1,
2581
- items: []
2582
- };
2595
+ s = JSON.parse(readFileSync(this.path, "utf8"));
2596
+ if (!s || !Array.isArray(s.items)) throw new Error("no items array");
2597
+ } catch (e) {
2598
+ throw new Error(`queue file ${this.path} is unreadable (${e.message}); fix or remove it by hand, it was left untouched`);
2583
2599
  }
2600
+ return {
2601
+ next: s.next ?? s.items.length + 1,
2602
+ items: s.items
2603
+ };
2584
2604
  }
2585
2605
  write(s) {
2586
2606
  mkdirSync(dirname(this.path), { recursive: true });
2587
- const tmp = `${this.path}.tmp`;
2588
- writeFileSync(tmp, JSON.stringify(s, null, 2) + "\n", "utf8");
2589
- renameSync(tmp, this.path);
2607
+ const tmp = `${this.path}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
2608
+ try {
2609
+ writeFileSync(tmp, JSON.stringify(s, null, 2) + "\n", "utf8");
2610
+ renameSync(tmp, this.path);
2611
+ } catch (e) {
2612
+ rmSync(tmp, { force: true });
2613
+ throw e;
2614
+ }
2615
+ }
2616
+ /** The one mutation path: read, apply `fn`, write, all under a cross-process mkdir lock. */
2617
+ mutate(fn) {
2618
+ mkdirSync(dirname(this.path), { recursive: true });
2619
+ const m = `${this.path}.mutex`;
2620
+ const t0 = Date.now();
2621
+ for (;;) try {
2622
+ mkdirSync(m);
2623
+ break;
2624
+ } catch (e) {
2625
+ if (e.code !== "EEXIST") throw e;
2626
+ breakStaleMutex(m, 1e4);
2627
+ if (Date.now() - t0 > 3e4) throw new Error(`queue file ${this.path} is locked by another process`);
2628
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 5 + Math.floor(Math.random() * 15));
2629
+ }
2630
+ try {
2631
+ const s = this.read();
2632
+ const r = fn(s);
2633
+ this.write(s);
2634
+ return r;
2635
+ } finally {
2636
+ try {
2637
+ rmdirSync(m);
2638
+ } catch {}
2639
+ }
2590
2640
  }
2591
2641
  list() {
2592
2642
  return this.read().items;
@@ -2595,34 +2645,34 @@ var QueueStore = class {
2595
2645
  return this.list().find((i) => i.id === id);
2596
2646
  }
2597
2647
  add(text, repo, opts = {}) {
2598
- const s = this.read();
2599
- const item = {
2600
- id: `q${s.next}`,
2601
- text: text.trim(),
2602
- repo,
2603
- files: opts.files ?? [],
2604
- ...opts.image ? { image: opts.image } : {},
2605
- created: new Date(this.now()).toISOString(),
2606
- state: "pending",
2607
- rounds: 0,
2608
- notes: []
2609
- };
2610
- s.next++;
2611
- s.items.push(item);
2612
- this.write(s);
2613
- return item;
2648
+ return this.mutate((s) => {
2649
+ const item = {
2650
+ id: `q${s.next}`,
2651
+ text: text.trim(),
2652
+ repo,
2653
+ files: opts.files ?? [],
2654
+ ...opts.image ? { image: opts.image } : {},
2655
+ created: new Date(this.now()).toISOString(),
2656
+ state: "pending",
2657
+ rounds: 0,
2658
+ notes: []
2659
+ };
2660
+ s.next++;
2661
+ s.items.push(item);
2662
+ return item;
2663
+ });
2614
2664
  }
2615
2665
  /** Apply `patch` to one item; throws on an unknown id. */
2616
2666
  update(id, patch) {
2617
- const s = this.read();
2618
- const i = s.items.findIndex((x) => x.id === id);
2619
- if (i < 0) throw new Error(`no queue item ${id}`);
2620
- s.items[i] = {
2621
- ...s.items[i],
2622
- ...patch
2623
- };
2624
- this.write(s);
2625
- return s.items[i];
2667
+ return this.mutate((s) => {
2668
+ const i = s.items.findIndex((x) => x.id === id);
2669
+ if (i < 0) throw new Error(`no queue item ${id}`);
2670
+ s.items[i] = {
2671
+ ...s.items[i],
2672
+ ...patch
2673
+ };
2674
+ return s.items[i];
2675
+ });
2626
2676
  }
2627
2677
  };
2628
2678
  const ALLOWED = {
@@ -2943,13 +2993,20 @@ async function acceptItems(store, settings, ids, deps) {
2943
2993
  * plan runner's launchWorker / mergeBranch; git and shell calls run as children.
2944
2994
  */
2945
2995
  function realQueueDeps(logDir, repo) {
2946
- const dir = mkdtempSync(join(tmpdir(), "pai-queue-"));
2947
2996
  const git = async (repo, ...a) => (await capture("git", a, repo)).out;
2948
2997
  return {
2949
2998
  async startWorker(req) {
2950
- const specFile = join(dir, `${req.itemId}-${req.attempt}.txt`);
2951
- writeFileSync(specFile, req.spec, "utf8");
2952
- return launchWorker(req, specFile, repo, logDir);
2999
+ const dir = mkdtempSync(join(tmpdir(), "pai-queue-"));
3000
+ try {
3001
+ const specFile = join(dir, `${req.itemId}-${req.attempt}.txt`);
3002
+ writeFileSync(specFile, req.spec, "utf8");
3003
+ return await launchWorker(req, specFile, repo, logDir);
3004
+ } finally {
3005
+ rmSync(dir, {
3006
+ recursive: true,
3007
+ force: true
3008
+ });
3009
+ }
2953
3010
  },
2954
3011
  async inspect(repo, id) {
2955
3012
  const base = (await git(repo, "merge-base", "HEAD", `worker/${id}`)).trim();
@@ -3175,7 +3232,7 @@ async function projectChecks(cwd, d = {}) {
3175
3232
  }
3176
3233
  async function realDaemonStart() {
3177
3234
  try {
3178
- const [{ PaiClient }, { loadConfig }] = await Promise.all([import("./ipc-client-YYDD6zzU.mjs"), import("./config-TaWmdTLx.mjs")]);
3235
+ const [{ PaiClient }, { loadConfig }] = await Promise.all([import("./ipc-client-ZRmDKd5Z.mjs"), import("./config-DtENJ6cL.mjs")]);
3179
3236
  const s = await new PaiClient(loadConfig().socketPath).status();
3180
3237
  return Date.now() - Number(s.uptime) * 1e3;
3181
3238
  } catch {
@@ -3192,4 +3249,4 @@ function realBuildTime() {
3192
3249
 
3193
3250
  //#endregion
3194
3251
  export { schedulerLines as C, resolveSpecPath as E, withTarget as S, readSpecPrompt as T, issueClaims as _, branchDiff as a, workerCommand as b, runQueue as c, loadSettings as d, move as f, issueClaim as g, renderReview as h, projectChecks as i, QueueStore as l, renderList as m, initProject as n, realQueueDeps as o, queueStatePath as p, isGitProject as r, acceptItems as s, formatCheck as t, again as u, issueStale as v, schedulerView as w, resolveTarget as x, providerCaps as y };
3195
- //# sourceMappingURL=project-setup-DM4npnL3.mjs.map
3252
+ //# sourceMappingURL=project-setup-jvfONJTQ.mjs.map
@@ -0,0 +1,16 @@
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 "./routing-BAAST9vT.mjs";
7
+ import "./tool-errors-7E13StWd.mjs";
8
+ import "./wait-ByV0OyMZ.mjs";
9
+ import "./local-tiers-BE4jGaMa.mjs";
10
+ import "./caller-identity-yLFb7CKq.mjs";
11
+ import "./capacity-DEveQdFV.mjs";
12
+ import "./local-instances-DOxSgT_L.mjs";
13
+ import "./local-candidate-DLdwQt0s.mjs";
14
+ import { _ as unsetCapabilityPreference, a as describeCapabilities, b as useProvider, c as modelPrefsText, d as setCapabilityPreference, f as setClass, g as setWorkersEnabled, h as setProviderModel, i as describeCap, l as removeProvider, m as setProviderEnabled, n as capText, o as describeModels, p as setProviderCap, r as classTargetText, s as describeProviders, t as addProvider, u as resolveProviderName, v as unsetClass, y as updateProvider } from "./providers-CblTFrhz.mjs";
15
+
16
+ export { setProviderEnabled, useProvider };
@@ -1,8 +1,8 @@
1
- import { F as writeWorkersSection, M as resolveCapability, O as providerCostTier, _ as maskKey, a as MODEL_CAPABILITIES, c as WorkersConfigError, d as defaultWorkersConfig, g as keysDir, h as isModelCapability, j as readWorkersSection, o as PROVIDER_TAGS, p as getProviderOrNative, t as ANTHROPIC_NATIVE, tt as workersYamlPath, y as nativeAnthropicProvider } from "./config-D5chi2LO.mjs";
2
- import { n as CONFIG_FILE, o as expandHome, s as homeRel } from "./config-BSXKyeJ1.mjs";
3
- import { u as workersLogDir } from "./paths-DoIyRnhx.mjs";
4
- import { a as clearCooldown, d as probeQuota, dn as LOCAL_MECHANISM_LINE, p as quotaSkipThreshold, pt as isLoopbackProvider } from "./routing-CUyiglfu.mjs";
5
- import { d as resolveCap, t as admitCap } from "./capacity-DaXrVj3J.mjs";
1
+ import { F as writeWorkersSection, M as resolveCapability, O as providerCostTier, _ as maskKey, a as MODEL_CAPABILITIES, c as WorkersConfigError, d as defaultWorkersConfig, g as keysDir, h as isModelCapability, j as readWorkersSection, o as PROVIDER_TAGS, p as getProviderOrNative, t as ANTHROPIC_NATIVE, tt as workersYamlPath, y as nativeAnthropicProvider } from "./config-XpZWOYOG.mjs";
2
+ import { n as CONFIG_FILE, o as expandHome, s as homeRel } from "./config-Bu1_vbY8.mjs";
3
+ import { u as workersLogDir } from "./paths-CHifubDh.mjs";
4
+ import { a as clearCooldown, d as probeQuota, fn as LOCAL_MECHANISM_LINE, p as quotaSkipThreshold, pt as isLoopbackProvider } from "./routing-BAAST9vT.mjs";
5
+ import { d as resolveCap, t as admitCap } from "./capacity-DEveQdFV.mjs";
6
6
  import { chmodSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
7
7
 
8
8
  //#region src/workers/providers.ts
@@ -387,4 +387,4 @@ function describeCapabilities(workers) {
387
387
 
388
388
  //#endregion
389
389
  export { unsetCapabilityPreference as _, describeCapabilities as a, useProvider as b, modelPrefsText as c, setCapabilityPreference as d, setClass as f, setWorkersEnabled as g, setProviderModel as h, describeCap as i, removeProvider as l, setProviderEnabled as m, capText as n, describeModels as o, setProviderCap as p, classTargetText as r, describeProviders as s, addProvider as t, resolveProviderName as u, unsetClass as v, updateProvider as y };
390
- //# sourceMappingURL=providers-UsKtLcUR.mjs.map
390
+ //# sourceMappingURL=providers-CblTFrhz.mjs.map
@@ -53,7 +53,7 @@ function saveQueryResult(record) {
53
53
  if (existsSync(filepath)) return filepath;
54
54
  writeFileSync(filepath, [
55
55
  "---",
56
- `query: "${record.query.replace(/"/g, "\\\"")}"`,
56
+ `query: ${JSON.stringify(record.query)}`,
57
57
  `timestamp: ${new Date(record.timestamp).toISOString()}`,
58
58
  `source: ${record.source}`,
59
59
  `result_count: ${record.resultCount}`,
@@ -85,4 +85,4 @@ function saveQueryResult(record) {
85
85
 
86
86
  //#endregion
87
87
  export { queriesDirPath as n, saveQueryResult as r, migrateQueriesDir as t };
88
- //# sourceMappingURL=query-feedback-I-txSnld.mjs.map
88
+ //# sourceMappingURL=query-feedback-BRfPtqki.mjs.map
@@ -0,0 +1,9 @@
1
+ import "./config-XpZWOYOG.mjs";
2
+ import "./config-Bu1_vbY8.mjs";
3
+ import "./paths-CHifubDh.mjs";
4
+ import "./worktree-CRs2gyg0.mjs";
5
+ import "./status-ggJ7lgVg.mjs";
6
+ import "./pool-Dh-q3iJi.mjs";
7
+ import { a as unregistrableReason, i as reportUnregistrable, n as mainRepoOf, o as workerWorktreesRoot, r as pruneWorktreeProjects, s as worktreeReason, t as isLinkedWorktree } from "./registrable-DpyTtajg.mjs";
8
+
9
+ export { reportUnregistrable };
@@ -1,6 +1,6 @@
1
- import { j as readWorkersSection } from "./config-D5chi2LO.mjs";
2
- import { u as workersLogDir } from "./paths-DoIyRnhx.mjs";
3
- import { w as worktreesDir } from "./worktree-zmRf556h.mjs";
1
+ import { j as readWorkersSection } from "./config-XpZWOYOG.mjs";
2
+ import { u as workersLogDir } from "./paths-CHifubDh.mjs";
3
+ import { w as worktreesDir } from "./worktree-CRs2gyg0.mjs";
4
4
  import { existsSync, readFileSync, statSync } from "node:fs";
5
5
  import { dirname, resolve, sep } from "node:path";
6
6
 
@@ -140,4 +140,4 @@ async function reportUnregistrable(backend, worktreesRoot = workerWorktreesRoot(
140
140
 
141
141
  //#endregion
142
142
  export { unregistrableReason as a, reportUnregistrable as i, mainRepoOf as n, workerWorktreesRoot as o, pruneWorktreeProjects as r, worktreeReason as s, isLinkedWorktree as t };
143
- //# sourceMappingURL=registrable-LrRIVYQc.mjs.map
143
+ //# sourceMappingURL=registrable-DpyTtajg.mjs.map
@@ -1,10 +1,10 @@
1
- import { j as readWorkersSection, p as getProviderOrNative, t as ANTHROPIC_NATIVE, v as nativeAnthropicModels } from "./config-D5chi2LO.mjs";
2
- import { _ as ownedTree } from "./worktree-zmRf556h.mjs";
3
- import { a as UNLABELED, c as contextFooter, f as elapsedOf, g as isLive, h as isChatPane, k as saveStatus, l as contextLabel, nt as shortText, o as ageOf, u as contextPercent, v as loadStatus, y as loadStatuses } from "./status-CvVi9cDf.mjs";
4
- import { p as currentWorkerId, u as sessionTag } from "./scope-D5VSQxe4.mjs";
5
- import { A as waitOnCallLine, E as detachedLine, M as waitingLine, d as parseWorkerReport, j as waitOnResultLine, k as realWaitDeps, n as bashExitCode, p as renderReport, t as WAIT_EXIT_STILL_RUNNING } from "./wait-BMUR-U-U.mjs";
6
- import { c as queuedText, f as sessionOf } from "./capacity-DaXrVj3J.mjs";
7
- import { a as endLabel } from "./endreason-x1KOSrcO.mjs";
1
+ import { j as readWorkersSection, p as getProviderOrNative, t as ANTHROPIC_NATIVE, v as nativeAnthropicModels } from "./config-XpZWOYOG.mjs";
2
+ import { _ as ownedTree } from "./worktree-CRs2gyg0.mjs";
3
+ import { a as UNLABELED, c as contextFooter, f as elapsedOf, g as isLive, h as isChatPane, k as saveStatus, l as contextLabel, nt as shortText, o as ageOf, u as contextPercent, v as loadStatus, y as loadStatuses } from "./status-ggJ7lgVg.mjs";
4
+ import { p as currentWorkerId, u as sessionTag } from "./scope-D-h6F6DN.mjs";
5
+ import { A as waitOnCallLine, E as detachedLine, M as waitingLine, d as parseWorkerReport, j as waitOnResultLine, k as realWaitDeps, n as bashExitCode, p as renderReport, t as WAIT_EXIT_STILL_RUNNING } from "./wait-ByV0OyMZ.mjs";
6
+ import { c as queuedText, f as sessionOf } from "./capacity-DEveQdFV.mjs";
7
+ import { a as endLabel } from "./endreason-C577xIQz.mjs";
8
8
  import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
9
9
  import { basename, join, relative } from "node:path";
10
10
 
@@ -900,4 +900,4 @@ function paneRunStatusRow(label, startedMs, now = /* @__PURE__ */ new Date()) {
900
900
 
901
901
  //#endregion
902
902
  export { resolveLimit as A, denialLines as C, deadlineLabel as D, armDeadline as E, checkOrphanedChildren as F, isWorkerId as I, launchParent as L, blockedMsOf as M, endBuildWait as N, deadlinePromptLine as O, assertChildAllowed as P, parentFromEnv as R, warmupText as S, recordDenial as T, renderTable as _, fullLines as a, tickerTool as b, headerLine as c, paneRunStatusRow as d, paneStatusRow as f, renderStatusLine as g, renderEvent as h, dayOf as i, beginBuildWait as j, extendLimit as k, intentOf as l, relPath as m, clockOf as n, goalOf as o, providerTag as p, contextMeter as r, gutterFor as s, blankBetween as t, makeColor as u, shortModel as v, parseDenialText as w, unifiedDiffLines as x, tickerText as y };
903
- //# sourceMappingURL=render-BDbb4CF-.mjs.map
903
+ //# sourceMappingURL=render-BYmQkuLd.mjs.map
@@ -0,0 +1,13 @@
1
+ import "./config-XpZWOYOG.mjs";
2
+ import "./config-Bu1_vbY8.mjs";
3
+ import "./paths-CHifubDh.mjs";
4
+ import "./worktree-CRs2gyg0.mjs";
5
+ import "./status-ggJ7lgVg.mjs";
6
+ import "./pool-Dh-q3iJi.mjs";
7
+ import "./scope-D-h6F6DN.mjs";
8
+ import { D as fmtElapsed } from "./wait-ByV0OyMZ.mjs";
9
+ import "./capacity-DEveQdFV.mjs";
10
+ import "./endreason-C577xIQz.mjs";
11
+ import { S as warmupText, _ as renderTable, a as fullLines, b as tickerTool, c as headerLine, d as paneRunStatusRow, f as paneStatusRow, g as renderStatusLine, h as renderEvent, i as dayOf, l as intentOf, m as relPath, n as clockOf, o as goalOf, p as providerTag, r as contextMeter, s as gutterFor, t as blankBetween, u as makeColor, v as shortModel, x as unifiedDiffLines, y as tickerText } from "./render-BYmQkuLd.mjs";
12
+
13
+ export { makeColor };
@@ -1,3 +1,3 @@
1
- import { n as rerankResults, t as configureRerankerModel } from "./reranker-DxxMCtA0.mjs";
1
+ import { n as rerankResults, t as configureRerankerModel } from "./reranker-CqCbpGnX.mjs";
2
2
 
3
3
  export { rerankResults };
@@ -62,4 +62,4 @@ async function rerankResults(query, results, opts) {
62
62
 
63
63
  //#endregion
64
64
  export { rerankResults as n, configureRerankerModel as t };
65
- //# sourceMappingURL=reranker-DxxMCtA0.mjs.map
65
+ //# sourceMappingURL=reranker-CqCbpGnX.mjs.map
@@ -0,0 +1,36 @@
1
+ import "./utils-J2b9y8PC.mjs";
2
+ import "./migrate-DrA_OwlZ.mjs";
3
+ import "./config-XpZWOYOG.mjs";
4
+ import "./config-Bu1_vbY8.mjs";
5
+ import "./paths-CHifubDh.mjs";
6
+ import "./worktree-CRs2gyg0.mjs";
7
+ import "./status-ggJ7lgVg.mjs";
8
+ import "./pool-Dh-q3iJi.mjs";
9
+ import "./registrable-DpyTtajg.mjs";
10
+ import "./pai-marker-BcZyJguM.mjs";
11
+ import "./helpers-CRuBUas3.mjs";
12
+ import "./scope-D-h6F6DN.mjs";
13
+ import "./routing-BAAST9vT.mjs";
14
+ import "./tool-errors-7E13StWd.mjs";
15
+ import "./wait-ByV0OyMZ.mjs";
16
+ import "./local-tiers-BE4jGaMa.mjs";
17
+ import "./caller-identity-yLFb7CKq.mjs";
18
+ import "./capacity-DEveQdFV.mjs";
19
+ import "./local-instances-DOxSgT_L.mjs";
20
+ import "./local-candidate-DLdwQt0s.mjs";
21
+ import "./factory-DjAAsqr_.mjs";
22
+ import "./postgres-C6ti4haA.mjs";
23
+ import "./embedding-gate-6rZrWRXa.mjs";
24
+ import "./embeddings-BVq3esBF.mjs";
25
+ import "./router-CQSc3lk3.mjs";
26
+ import "./detect-9CZNO0yf.mjs";
27
+ import "./helpers-BD6V-p9w.mjs";
28
+ import "./scan-C_Y5W9py.mjs";
29
+ import "./session-8iqQDkqb.mjs";
30
+ import "./launch-Jh5NVeNe.mjs";
31
+ import "./health-Dnym-qcT.mjs";
32
+ import "./launch-CXVlZjHt.mjs";
33
+ import { _ as setupsTable, a as lastSetup, b as truncate, c as localState, d as pickerOpts, f as plainTable, g as runRoot, h as runNewWith, i as lastOnLabel, l as matchRows, m as rootCommand, n as ago, o as launchKey, p as resolveSetup, r as finishCd, s as launchScreen, t as CANCELLED, u as pickerLayout, v as startSession, y as systemTerm } from "./root-Xglu0OPD.mjs";
34
+ import "./session-scan-W-gbwJHM.mjs";
35
+
36
+ export { runNewWith };
@@ -1,12 +1,12 @@
1
- import { b as nativeOrchestratorModel, j as readWorkersSection, p as getProviderOrNative, t as ANTHROPIC_NATIVE } from "./config-D5chi2LO.mjs";
2
- import { u as workersLogDir } from "./paths-DoIyRnhx.mjs";
3
- import { d as terminalHasName } from "./scope-D5VSQxe4.mjs";
4
- import { An as setupProfile, Cn as allSetups, Dn as loadSaved, En as httpModelsCheck, Nn as shortModel, On as orchestratorLabel, Pn as workersLabel, Tn as findSetup, jn as setupWorkersLabel, o as cooldownRemaining, on as SESSION_NAME_ENV, sn as getProfile, un as updateProfile, wn as downLocalProviders, x as SESSION_WORKER_PROVIDER_ENV, yn as resolveLocalProvider } from "./routing-CUyiglfu.mjs";
5
- import { n as OPT, t as CliError } from "./define-DGFu-sCf.mjs";
6
- import { C as assertAvailable, D as execHarness, E as dryRunText, O as looksLikePath, T as buildHarness, k as prepareDir, r as collectView, w as modelFor } from "./session-CNXF6DLP.mjs";
7
- import { o as launchableProviderNames, t as LaunchError } from "./launch-DgqQdAjI.mjs";
8
- import { a as colorEnabled, f as renderTable, n as readBudget, o as makeStyle, p as suggest, t as providerHealth } from "./health-C6jZWvRG.mjs";
9
- import { i as probeResume } from "./launch-CLp0OJxV.mjs";
1
+ import { b as nativeOrchestratorModel, j as readWorkersSection, p as getProviderOrNative, t as ANTHROPIC_NATIVE } from "./config-XpZWOYOG.mjs";
2
+ import { u as workersLogDir } from "./paths-CHifubDh.mjs";
3
+ import { d as terminalHasName } from "./scope-D-h6F6DN.mjs";
4
+ import { Dn as httpModelsCheck, En as findSetup, Fn as workersLabel, Mn as setupWorkersLabel, On as loadSaved, Pn as shortModel, Tn as downLocalProviders, bn as resolveLocalProvider, cn as getProfile, dn as updateProfile, jn as setupProfile, kn as orchestratorLabel, o as cooldownRemaining, sn as SESSION_NAME_ENV, wn as allSetups, x as SESSION_WORKER_PROVIDER_ENV } from "./routing-BAAST9vT.mjs";
5
+ import { n as OPT, t as CliError } from "./define-CjJsmq-6.mjs";
6
+ import { C as assertAvailable, D as execHarness, E as dryRunText, O as looksLikePath, T as buildHarness, k as prepareDir, r as collectView, w as modelFor } from "./session-8iqQDkqb.mjs";
7
+ import { o as launchableProviderNames, t as LaunchError } from "./launch-Jh5NVeNe.mjs";
8
+ import { a as colorEnabled, f as renderTable, n as readBudget, o as makeStyle, p as suggest, t as providerHealth } from "./health-Dnym-qcT.mjs";
9
+ import { i as probeResume } from "./launch-CXVlZjHt.mjs";
10
10
  import { writeFileSync } from "node:fs";
11
11
  import { basename } from "node:path";
12
12
  import { emitKeypressEvents } from "node:readline";
@@ -683,7 +683,7 @@ async function runRoot(args, term = systemTerm()) {
683
683
  with: args.with,
684
684
  dryRun: args.dryRun
685
685
  }, term);
686
- return (await import("./session-BJHzmUg2.mjs")).runNewDefault({
686
+ return (await import("./session-BeqAbNPd.mjs")).runNewDefault({
687
687
  dir: args.name,
688
688
  dryRun: args.dryRun
689
689
  });
@@ -791,4 +791,4 @@ const rootCommand = {
791
791
 
792
792
  //#endregion
793
793
  export { setupsTable as _, lastSetup as a, truncate as b, localState as c, pickerOpts as d, plainTable as f, runRoot as g, runNewWith as h, lastOnLabel as i, matchRows as l, rootCommand as m, ago as n, launchKey as o, resolveSetup as p, finishCd as r, launchScreen as s, CANCELLED as t, pickerLayout as u, startSession as v, systemTerm as y };
794
- //# sourceMappingURL=root-BMeJuHOb.mjs.map
794
+ //# sourceMappingURL=root-Xglu0OPD.mjs.map
@@ -0,0 +1,15 @@
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 { At as TIGHT_PERCENT, Bt as routeRows, Ft as flowText, Gt as setRoute, Ht as servingChip, It as parseSelector, Jt as validateRoute, Kt as setSessionRoute, Lt as resolveSelector, Mt as clearSessionRoute, Nt as configuredLocal, Pt as entryLabel, Rt as resolveSessionArg, Ut as sessionRoutesPatch, Vt as routeText, Wt as sessionStartTarget, jt as applyPolicyToRoutes, qt as tierFlow, zt as routeChoices } from "./routing-BAAST9vT.mjs";
7
+ import "./tool-errors-7E13StWd.mjs";
8
+ import "./wait-ByV0OyMZ.mjs";
9
+ import "./local-tiers-BE4jGaMa.mjs";
10
+ import "./caller-identity-yLFb7CKq.mjs";
11
+ import "./capacity-DEveQdFV.mjs";
12
+ import "./local-instances-DOxSgT_L.mjs";
13
+ import "./local-candidate-DLdwQt0s.mjs";
14
+
15
+ export { setRoute };
@@ -1,7 +1,7 @@
1
1
  import { n as aibrokerSocketPath } from "./runtime-paths-WsO9sJFc.mjs";
2
- import { n as isTestRunner } from "./test-isolation-CoDeOVXb.mjs";
3
- import { spawn } from "node:child_process";
2
+ import { n as isTestRunner } from "./test-isolation-lqSmYxr0.mjs";
4
3
  import { randomUUID } from "node:crypto";
4
+ import { spawn } from "node:child_process";
5
5
  import { connect } from "node:net";
6
6
 
7
7
  //#region src/notifications/providers/ntfy.ts
@@ -12,7 +12,7 @@ var NtfyProvider = class {
12
12
  if (!cfg.enabled || !cfg.url) return false;
13
13
  try {
14
14
  const headers = { "Content-Type": "text/plain; charset=utf-8" };
15
- if (payload.title) headers["Title"] = payload.title;
15
+ if (payload.title) headers["Title"] = /^[\x20-\x7e]*$/.test(payload.title) ? payload.title : `=?UTF-8?B?${Buffer.from(payload.title, "utf8").toString("base64")}?=`;
16
16
  if (cfg.priority && cfg.priority !== "default") headers["Priority"] = cfg.priority;
17
17
  return (await fetch(cfg.url, {
18
18
  method: "POST",
@@ -135,10 +135,20 @@ var MacOsProvider = class {
135
135
  if (!config.channels.macos.enabled) return false;
136
136
  if (process.platform !== "darwin") return false;
137
137
  try {
138
- const safeTitle = (payload.title ?? "PAI").replace(/'/g, "\\'");
139
- const script = `display notification "${payload.message.replace(/'/g, "\\'")}" with title "${safeTitle}"`;
138
+ const title = payload.title ?? "PAI";
139
+ const args = [
140
+ "-e",
141
+ "on run argv",
142
+ "-e",
143
+ "display notification (item 1 of argv) with title (item 2 of argv)",
144
+ "-e",
145
+ "end run",
146
+ "--",
147
+ payload.message,
148
+ title
149
+ ];
140
150
  return new Promise((resolve) => {
141
- const child = spawn("osascript", ["-e", script], {
151
+ const child = spawn("osascript", args, {
142
152
  detached: true,
143
153
  stdio: "ignore"
144
154
  });
@@ -268,4 +278,4 @@ async function routeNotification(payload, config) {
268
278
 
269
279
  //#endregion
270
280
  export { routeNotification as n, recordedNotifications as t };
271
- //# sourceMappingURL=router-L8Nu-OHF.mjs.map
281
+ //# sourceMappingURL=router-CQSc3lk3.mjs.map
@@ -1,3 +1,3 @@
1
- import { n as routeNotification, t as recordedNotifications } from "./router-L8Nu-OHF.mjs";
1
+ import { n as routeNotification, t as recordedNotifications } from "./router-CQSc3lk3.mjs";
2
2
 
3
3
  export { routeNotification };