@overdeck/desktop 0.45.22 → 0.45.24

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 (429) hide show
  1. package/drizzle/overdeck/0000_overdeck_init.sql +2 -0
  2. package/package.json +1 -1
  3. package/server/{acceptance-criteria-BH7ac_1G.js → acceptance-criteria-DDCnXF58.js} +5 -5
  4. package/server/{advancing-selfheal-cSvXNZLZ.js → advancing-selfheal-BVwW4qRn.js} +6 -6
  5. package/server/{agent-gc-Dj2gncak.js → agent-gc-CHcnvonI.js} +4 -4
  6. package/server/agent-state-Bc3tzUC8.js +3 -0
  7. package/server/{agent-state-service-DistflNn.js → agent-state-service-BsgWxZuB.js} +5 -5
  8. package/server/{agent-state-service-CsQ07Pxe.js → agent-state-service-D5UGKIJL.js} +1 -1
  9. package/server/{agents-DXdHmRTC.js → agents-EbI0zCJl.js} +4 -4
  10. package/server/agents-wi9NWzs2.js +3 -0
  11. package/server/{archive-planning-Cp_DC1j-.js → archive-planning-BZDgzoEj.js} +1 -1
  12. package/server/{archive-planning-BvDuWNMo.js → archive-planning-Du25Jtst.js} +30 -6
  13. package/server/{artifact-index-jobs-CDBFL4OU.js → artifact-index-jobs-CbEDfCDu.js} +2 -2
  14. package/server/assemble-J2ZZ2C15.js +339 -0
  15. package/server/{backlog-auto-trigger-DmA1IbYf.js → backlog-auto-trigger-2R2jog7n.js} +3 -3
  16. package/server/{behavior-CGj16clS.js → behavior-B3exJ42O.js} +2 -2
  17. package/server/{briefing-freshness-C12WgkaB.js → briefing-freshness-D1wzUIWv.js} +2 -2
  18. package/server/{build-info-BRpqQvNd.js → build-info-CZk_TITh.js} +1 -1
  19. package/server/{build-info-NU3KbXYw.js → build-info-Ie_D0_BT.js} +3 -3
  20. package/server/{checkpoint-manager-CTPjAmtH.js → checkpoint-manager-BI1Wxoku.js} +2 -2
  21. package/server/{checkpoint-manager-rOgT98WY.js → checkpoint-manager-DwbQoqrC.js} +1 -1
  22. package/server/checkpoint-worker.js +1 -1
  23. package/server/{checkpoints-B5jFNi2G.js → checkpoints-BJIs5QIA.js} +1 -1
  24. package/server/{checkpoints-BJum14fs.js → checkpoints-CQB1h765.js} +2 -2
  25. package/server/{claude-hooks-provision-BhwWK-TQ.js → claude-hooks-provision-8Ngo8TpT.js} +1 -1
  26. package/server/{claude-hooks-provision-D7p5WcKZ.js → claude-hooks-provision-D8GXF3_s.js} +2 -2
  27. package/server/{claude-permissions-nSFKH78M.js → claude-permissions-DNWEVV6z.js} +2 -2
  28. package/server/{claude-settings-overlay-BI_UIke0.js → claude-settings-overlay-CEdaqpWI.js} +2 -2
  29. package/server/{claude-settings-overlay-DHBwjS1X.js → claude-settings-overlay-DWy-Bb4Y.js} +1 -1
  30. package/server/cli-B86rejVV.js +3 -0
  31. package/server/{cli-CbKNkFE5.js → cli-RoOx5DUf.js} +9 -9
  32. package/server/{cliproxy-Brf_5MuG.js → cliproxy-C8a1vtTU.js} +2 -2
  33. package/server/{cliproxy-bONZDBbC.js → cliproxy-fHfIeiGd.js} +1 -1
  34. package/server/{close-issue-CxReRxIc.js → close-issue-DoOifFIK.js} +5 -5
  35. package/server/{closed-issue-reaper-CQ3kqha7.js → closed-issue-reaper-Bk3SU4RC.js} +9 -9
  36. package/server/{closed-issue-reaper-DXP2Xyv3.js → closed-issue-reaper-CktPXo8m.js} +1 -1
  37. package/server/{codex-CbmztVcc.js → codex-BZXGhUVB.js} +27 -8
  38. package/server/codex-GcHuUF-k.js +3 -0
  39. package/server/{codex-parser-jl8AeAmB.js → codex-parser-CFZ1_1Jl.js} +2 -2
  40. package/server/{config-q4Gvd8dq.js → config-BZ0sHTju.js} +2 -2
  41. package/server/{config-DeTsoZdR.js → config-CKxYiCmX.js} +2 -2
  42. package/server/{config-BJKocXKd.js → config-DzV30TOm.js} +1 -1
  43. package/server/{config-yaml-ig8Nwtiw.js → config-yaml-DySPNmKN.js} +77 -194
  44. package/server/{conflict-gate-CFqPVxEg.js → conflict-gate-BaCVrH-N.js} +3 -3
  45. package/server/{conflict-gate-CHU9K1vU.js → conflict-gate-BhAY7TUd.js} +1 -1
  46. package/server/context-layers-BrPmE__h.js +4 -0
  47. package/server/context-layers-igZ4FI4_.js +37 -0
  48. package/server/{control-settings-D_odMIaC.js → control-settings-BQp7_4uD.js} +4 -4
  49. package/server/{conversation-compaction-B6YSRLda.js → conversation-compaction-CgrR8YYp.js} +8 -8
  50. package/server/{conversation-compaction-CN4-5YYt.js → conversation-compaction-eQB5CkOe.js} +1 -1
  51. package/server/{conversation-service-Dq33SYEj.js → conversation-service-BLd3MYsG.js} +1 -1
  52. package/server/{conversation-service-C3avRVEr.js → conversation-service-DPJ71F33.js} +329 -19
  53. package/server/{conversations-bYpM9-kZ.js → conversations-6AfUfbwc.js} +5 -5
  54. package/server/{conversations-H9if0bCQ.js → conversations-CAsJF9kh.js} +1 -1
  55. package/server/{cost-Codk1pc2.js → cost-B2ddP6wq.js} +18 -2
  56. package/server/{cost-wH46-WsJ.js → cost-R-m6Yi-W.js} +3 -3
  57. package/server/{cost-sync-D_cre6WM.js → cost-sync-BsN6ER0n.js} +3 -3
  58. package/server/{dag-CJpgf9A3.js → dag-B1ucnjDU.js} +9 -9
  59. package/server/{dangerous-git-ops-D6AF-Hg_.js → dangerous-git-ops-BXqeWVSf.js} +1 -1
  60. package/server/dashboard-db-worker.js +7 -7
  61. package/server/{deacon-CkT_kznS.js → deacon-CU_cAYSR.js} +406 -607
  62. package/server/{deacon-B8HbQdqU.js → deacon-kiQrb4ZT.js} +3 -3
  63. package/server/{deacon-nudge-log-D6K9K-rE.js → deacon-nudge-log-6wVqAaqz.js} +3 -3
  64. package/server/{deacon-swarm-BryRr6AO.js → deacon-swarm-BXZZ1Z2-.js} +17 -17
  65. package/server/deacon-swarm-C-GwfjJy.js +2 -0
  66. package/server/deacon.js +8 -8
  67. package/server/{deploy-patrol-1IrZxicY.js → deploy-patrol-AiFoP8dw.js} +136 -19
  68. package/server/{deploy-window-wDf4UgHt.js → deploy-window-C3F-tihF.js} +77 -10
  69. package/server/{deploy-window-7ZYHh7Zp.js → deploy-window-DkZraDyj.js} +1 -1
  70. package/server/{dev-supervisor-C7p9kEpc.js → dev-supervisor-bcOWqdQE.js} +2 -2
  71. package/server/{devcontainer-renderer-CNmQy0pL.js → devcontainer-renderer-_d6XhyND.js} +3 -3
  72. package/server/dist-Bzy0y69j.js +3 -0
  73. package/server/{dist-D-Ed5yVw.js → dist-Cb_0uvpS.js} +1 -1
  74. package/server/{docker-BCZ89M9X.js → docker-DcMTFTUC.js} +2 -2
  75. package/server/{dod-DbJLYcHv.js → dod-C6n9RV3G.js} +1 -1
  76. package/server/{ensure-devcontainer-Cs6W9Yzj.js → ensure-devcontainer-BZgOhRo7.js} +1 -1
  77. package/server/{ensure-devcontainer-V5JWaAva.js → ensure-devcontainer-DNi-ono3.js} +4 -4
  78. package/server/{esm-shims-dTeNdq7X.js → esm-shims-OSHAYaS1.js} +1 -1
  79. package/server/{event-store-TnWdydfB.js → event-store-CQL6NeqB.js} +3 -3
  80. package/server/{event-store-CpBGsO6_.js → event-store-EV2cMiXj.js} +1 -1
  81. package/server/{events-Dsuv6qyB.js → events-BTdrdEq8.js} +1 -1
  82. package/server/{events-DSUdR-04.js → events-DTfAe4My.js} +3 -3
  83. package/server/{factory-BMrK4TrE.js → factory-CFibJuaw.js} +50 -13
  84. package/server/{feature-registry-population-B-CI9hgE.js → feature-registry-population-DKZFMbFt.js} +4 -4
  85. package/server/{feature-registry-storage-B972ph_A.js → feature-registry-storage-BdPuLcBX.js} +2 -2
  86. package/server/{features-Bc-Bmiye.js → features-ez2271oH.js} +2 -2
  87. package/server/{feedback-target-DZ-iAnAa.js → feedback-target-7mqqwrX6.js} +7 -7
  88. package/server/{feedback-target-DS6NUuSs.js → feedback-target-CoFDHiM8.js} +1 -1
  89. package/server/{feedback-writer-BXP6g75N.js → feedback-writer-CY5L1lB7.js} +6 -5
  90. package/server/{feedback-writer-Bx5z11mF.js → feedback-writer-D3a22RCd.js} +1 -1
  91. package/server/flywheel-DHrgCphM.js +1084 -0
  92. package/server/flywheel-DzGtWnJ1.js +477 -0
  93. package/server/flywheel-SVF02Jpq.js +2 -0
  94. package/server/{flywheel-merge-order-CTgHeg-W.js → flywheel-merge-order-UU0tiUld.js} +10 -9
  95. package/server/{flywheel-merge-order-CNKAY489.js → flywheel-merge-order-UUcsCDb6.js} +1 -1
  96. package/server/{forge-B1S_KZv4.js → forge-CNFnyqps.js} +2 -2
  97. package/server/forge-DXnS_YFH.js +2 -0
  98. package/server/{from-DpwQ-sc3.js → from-kNxT0bZC.js} +1 -1
  99. package/server/{fts-db-DmAcuCkV.js → fts-db-CE46vDkZ.js} +2 -2
  100. package/server/{fts-operations-7d_RkmWp.js → fts-operations-CqY6zl-i.js} +2 -2
  101. package/server/{git-utils-Cc3FHDKd.js → git-utils-CRw2zLPC.js} +68 -3
  102. package/server/git-utils-D0_yhCgF.js +3 -0
  103. package/server/{github-app-CDPtGF7J.js → github-app-C3QrAUd0.js} +27 -8
  104. package/server/{github-app-CU14oYzP.js → github-app-ClZ2lk8D.js} +1 -1
  105. package/server/{github-client-XjTJbBm7.js → github-client-BnIsSrEN.js} +2 -2
  106. package/server/{github-client-CwBZZ3t7.js → github-client-DfQYVUaw.js} +1 -1
  107. package/server/{github-pr-lookup-CFGeVhqv.js → github-pr-lookup-D16NGsSO.js} +2 -2
  108. package/server/{harness-binary-B2CTcD84.js → harness-binary-DPUi-Pv8.js} +32 -6
  109. package/server/{harness-resolve-D5FVQTmy.js → harness-resolve-3lNZkyT4.js} +18 -9
  110. package/server/{health-events-DREeevle.js → health-events-BBcTYQKU.js} +2 -2
  111. package/server/{health-events-C1whmd58.js → health-events-BDOHby5Q.js} +1 -1
  112. package/server/{hooks-yxRsjk-z.js → hooks-CKZgXlJb.js} +2 -2
  113. package/server/{hooks-B-HItBiS.js → hooks-DPVX1rwQ.js} +1 -1
  114. package/server/{hume-Dz_OymXE.js → hume-Cz8igP9E.js} +2 -2
  115. package/server/hume-ccTf4wTX.js +3 -0
  116. package/server/{idle-stack-reaper-DrCv0OAG.js → idle-stack-reaper-CuLF0j2H.js} +1 -1
  117. package/server/{idle-stack-reaper-Yf34xXxY.js → idle-stack-reaper-DDIRwxUY.js} +2 -2
  118. package/server/{in-flight-guard-BoWm66Kh.js → in-flight-guard-CAAkqPLu.js} +2 -2
  119. package/server/{infra-D4iNWMA5.js → infra-BEqFxlJc.js} +14 -4
  120. package/server/{injection-D7T75Pye.js → injection-C8aiVJrF.js} +191 -183
  121. package/server/{injection-BVNa4MQW.js → injection-CPUIqNhI.js} +1 -1
  122. package/server/{inspect-agent-BXCgNeZ4.js → inspect-agent-BLuJ1AkT.js} +137 -81
  123. package/server/inspect-agent-Brtz0URj.js +2 -0
  124. package/server/{internal-token-C9DdEOKY.js → internal-token-BrcU6qfe.js} +1 -1
  125. package/server/{internal-token-CXsfxslp.js → internal-token-s0-oKybJ.js} +2 -2
  126. package/server/{io-DQR9PMgS.js → io-C9kF1wtJ.js} +160 -184
  127. package/server/{issue-closed-DtmJM0D0.js → issue-closed-CDJk4pIp.js} +7 -7
  128. package/server/{issue-lifecycle-8PSS9Anq.js → issue-lifecycle-B8sZHVHh.js} +1 -1
  129. package/server/{issue-lifecycle-CeyW_HoD.js → issue-lifecycle-ojZAzDBP.js} +22 -22
  130. package/server/{issue-service-singleton-DBZabEl7.js → issue-service-singleton-BvJ09SaR.js} +1 -1
  131. package/server/{issue-service-singleton-D_RVYBuL.js → issue-service-singleton-Yx5DdmVJ.js} +8 -8
  132. package/server/{issues-pDW9VUNz.js → issues-BMmP_77e.js} +2 -2
  133. package/server/{jsonl-parser-C3HVNR5d.js → jsonl-parser-BXSlHwEh.js} +3 -3
  134. package/server/{label-cleanup-DPwiZlWo.js → label-cleanup-B0UJwnv5.js} +3 -3
  135. package/server/{label-reconciler-Df1ZduPH.js → label-reconciler-B4iOAjlC.js} +4 -4
  136. package/server/{launcher-generator-COgR2By1.js → launcher-generator-BBWG_SiS.js} +105 -10
  137. package/server/{lifecycle-io-taIb0PoH.js → lifecycle-io-BREGpnLk.js} +37 -37
  138. package/server/lifecycle-io-DPo7x11I.js +3 -0
  139. package/server/{lifecycle-CtPDcZ9u.js → lifecycle-xmBfK2GJ.js} +6 -6
  140. package/server/lifecycle-yPd___5E.js +121 -0
  141. package/server/{linear-client-DsFkIxee.js → linear-client-BsuUvkdA.js} +2 -2
  142. package/server/{linear-client-YwZMDIwQ.js → linear-client-CTskEeT_.js} +1 -1
  143. package/server/memory-fts-worker.js +1 -1
  144. package/server/{merge-BwsyNRJV.js → merge-B1DiziGU.js} +1 -1
  145. package/server/{merge-C1t-bspg.js → merge-CefQNAnq.js} +3 -3
  146. package/server/{merge-agent-DDiIjzk-.js → merge-agent-4WOWlSYA.js} +28 -28
  147. package/server/{merge-agent-B-SnXOoc.js → merge-agent-CKkgIBPB.js} +1 -1
  148. package/server/{merge-batch-Byt-QnEl.js → merge-batch-ClFn2T-y.js} +1 -1
  149. package/server/merge-ops-CR44oU9-.js +2 -0
  150. package/server/{merge-rebase-Cm6fXaZN.js → merge-rebase-BfaTyXsw.js} +2 -2
  151. package/server/merge-set-DJ8-UErs.js +83 -0
  152. package/server/{merge-set-6LEglm6o.js → merge-set-bUqbm3yc.js} +1 -1
  153. package/server/{merge-sync-B95_4in_.js → merge-sync-BJYeOODr.js} +1 -1
  154. package/server/{merge-sync-Do8_q32h.js → merge-sync-VPV28g0g.js} +2 -2
  155. package/server/{merge-train-CKana8EH.js → merge-train-CHopycP0.js} +3 -3
  156. package/server/{merge-train-deps-BgmqwIfA.js → merge-train-deps-D1cOZzy2.js} +4 -4
  157. package/server/{merge-verification-CqnUzGEK.js → merge-verification-BkaOqPsw.js} +4 -4
  158. package/server/{multipart-parser-tdOQDJ3o.js → multipart-parser-duPAfSBw.js} +2 -2
  159. package/server/{no-resume-mode-BWOSZjWd.js → no-resume-mode-Nw29vaFb.js} +11 -8
  160. package/server/node_modules/.package-lock.json +8 -8
  161. package/server/node_modules/@effect/platform-node/node_modules/@effect/platform-node-shared/package.json +3 -3
  162. package/server/node_modules/undici/README.md +5 -0
  163. package/server/node_modules/undici/docs/docs/api/Client.md +4 -0
  164. package/server/node_modules/undici/docs/docs/api/Dispatcher.md +6 -0
  165. package/server/node_modules/undici/docs/docs/api/Interceptors.md +59 -0
  166. package/server/node_modules/undici/docs/docs/api/MockAgent.md +27 -0
  167. package/server/node_modules/undici/docs/docs/api/MockPool.md +28 -1
  168. package/server/node_modules/undici/docs/docs/index.md +5 -0
  169. package/server/node_modules/undici/lib/core/request.js +1 -1
  170. package/server/node_modules/undici/lib/core/util.js +6 -1
  171. package/server/node_modules/undici/lib/dispatcher/agent.js +3 -3
  172. package/server/node_modules/undici/lib/dispatcher/client-h1.js +31 -6
  173. package/server/node_modules/undici/lib/dispatcher/client-h2.js +34 -43
  174. package/server/node_modules/undici/lib/handler/cache-handler.js +93 -5
  175. package/server/node_modules/undici/lib/handler/cache-revalidation-handler.js +10 -0
  176. package/server/node_modules/undici/lib/handler/redirect-handler.js +5 -2
  177. package/server/node_modules/undici/lib/handler/retry-handler.js +6 -4
  178. package/server/node_modules/undici/lib/interceptor/cache.js +21 -4
  179. package/server/node_modules/undici/lib/interceptor/decompress.js +4 -0
  180. package/server/node_modules/undici/lib/mock/mock-interceptor.js +25 -7
  181. package/server/node_modules/undici/lib/mock/mock-utils.js +39 -10
  182. package/server/node_modules/undici/lib/util/cache.js +49 -7
  183. package/server/node_modules/undici/lib/web/fetch/body.js +2 -1
  184. package/server/node_modules/undici/lib/web/fetch/response.js +1 -3
  185. package/server/node_modules/undici/package.json +2 -2
  186. package/server/node_modules/undici/types/client.d.ts +2 -2
  187. package/server/node_modules/undici/types/dispatcher.d.ts +3 -3
  188. package/server/node_modules/undici/types/mock-interceptor.d.ts +5 -1
  189. package/server/{orphan-proposed-reconciler-xklgvNA7.js → orphan-proposed-reconciler-BvKkWMJQ.js} +15 -13
  190. package/server/{orphan-proposed-reconciler-DSvsJ5M7.js → orphan-proposed-reconciler-CTSGcK8p.js} +1 -1
  191. package/server/package-lock.json +9 -9
  192. package/server/package.json +1 -1
  193. package/server/{pan-dir-DOcf6ug3.js → pan-dir-B0c3w0Ya.js} +78 -58
  194. package/server/{paths-DooHpt9p.js → paths-D-xWGHdh.js} +2 -2
  195. package/server/{pickup-CaskQ7j6.js → pickup-DUCLWrJY.js} +17 -16
  196. package/server/{pipeline-membership-1LGRjo-k.js → pipeline-membership-mY3GprlK.js} +186 -67
  197. package/server/{pipeline-notifier-CZsrU_nj.js → pipeline-notifier-BJr8gQX6.js} +1 -1
  198. package/server/{pipeline-notifier-B6FVsYF9.js → pipeline-notifier-BXkJzDC4.js} +2 -2
  199. package/server/{project-pipelines-CtNG_rvs.js → project-pipelines-C0MWUeCU.js} +2 -2
  200. package/server/project-repos-B6GycDh9.js +94 -0
  201. package/server/project-repos-DXKQsc_m.js +3 -0
  202. package/server/projects-vjjcmiN8.js +3 -0
  203. package/server/{prompts-EvhMeeHG.js → prompts-DxzFXuLl.js} +2 -2
  204. package/server/{providers-BDDPULlp.js → providers-qQAwGQDW.js} +7 -7
  205. package/server/{providers-DNSQqy2V.js → providers-u4Ga0jOr.js} +1 -1
  206. package/server/public/assets/{chunk-BO2N2NFS-sym_ufXe.js → chunk-BO2N2NFS-BamJdinX.js} +4 -4
  207. package/server/public/assets/{diagram-OG6HWLK6-CQJPBNBu.js → diagram-OG6HWLK6-DfOB8-w4.js} +1 -1
  208. package/server/public/assets/{dist-DukGS2YZ.js → dist-ByIuzMQW.js} +3 -3
  209. package/server/public/assets/{dist-Bio7THQU.js → dist-D7zYSEA6.js} +1 -1
  210. package/server/public/assets/{ganttDiagram-6RSMTGT7-D4lWwte3.js → ganttDiagram-6RSMTGT7-EdmRyXL3.js} +1 -1
  211. package/server/public/assets/{highlighted-body-OFNGDK62-CaLboCt5.js → highlighted-body-OFNGDK62-MerOfTX8.js} +1 -1
  212. package/server/public/assets/{index-Bwejq-5s.js → index-CWeMerGO.js} +147 -144
  213. package/server/public/assets/index-CenuJ3Cw.css +1 -0
  214. package/server/public/assets/{linear-qUWmMZ-c.js → linear-BBbArIcK.js} +1 -1
  215. package/server/public/assets/mermaid-GHXKKRXX-CpPWAFwE.js +1 -0
  216. package/server/public/assets/{pieDiagram-4H26LBE5-C4zYulEm.js → pieDiagram-4H26LBE5-BKIddiJN.js} +1 -1
  217. package/server/public/assets/{prod-C8VtLuWC.js → prod-B8vYiu52.js} +4 -4
  218. package/server/public/assets/{quadrantDiagram-W4KKPZXB-qP04zyZC.js → quadrantDiagram-W4KKPZXB-D6RtoULk.js} +1 -1
  219. package/server/public/assets/{sankeyDiagram-5OEKKPKP-eMPTX_cG.js → sankeyDiagram-5OEKKPKP-CLrCedZX.js} +1 -1
  220. package/server/public/assets/{xychartDiagram-2RQKCTM6-Dme1PIt6.js → xychartDiagram-2RQKCTM6-hznR8DYl.js} +1 -1
  221. package/server/public/index.html +2 -2
  222. package/server/{pull-requests-By_BteaL.js → pull-requests-7N8WKseP.js} +1 -1
  223. package/server/{pull-requests-8z2N1UOV.js → pull-requests-_lHueOHW.js} +13 -11
  224. package/server/{queries-ZABd5aXP.js → queries-CjNIf-Ub.js} +1200 -201
  225. package/server/{rally-i_goYmiA.js → rally-CyWT_lNO.js} +3 -3
  226. package/server/{rally-api-DqKqIMNR.js → rally-api-C8e_1JRi.js} +2 -2
  227. package/server/{rally-api-xHazRk0d.js → rally-api-ClOSd-Tt.js} +1 -1
  228. package/server/{rally-client-COYz1vYR.js → rally-client-lc-nokqr.js} +4 -4
  229. package/server/{rally-client-CGWEHaPd.js → rally-client-sgtVqzNU.js} +1 -1
  230. package/server/rally-zhhtXuDP.js +3 -0
  231. package/server/{reap-terminal-sessions-CaMkFOIH.js → reap-terminal-sessions-7KeHv1R1.js} +1 -1
  232. package/server/{reap-terminal-sessions-DG9eiMVz.js → reap-terminal-sessions-BtHPo6Xc.js} +1 -1
  233. package/server/rebuild-stack-CFvcBHsS.js +4 -0
  234. package/server/{rebuild-stack-JUm0jqYP.js → rebuild-stack-lwtsW0GO.js} +26 -35
  235. package/server/{reconstruct-cache-wU79aCee.js → reconstruct-cache-C3Ui7ojV.js} +6 -6
  236. package/server/record-CN0pj4_5.js +3 -0
  237. package/server/{record-update-D3N6WMFR.js → record-update-bLJxAXH4.js} +1 -1
  238. package/server/record-update-dE1Aw83j.js +310 -0
  239. package/server/{recovery-trip-DkzJSej9.js → recovery-trip-BvRWfUXM.js} +2 -2
  240. package/server/{release-engine-DMINVN8S.js → release-engine-Cx48W7z8.js} +5 -5
  241. package/server/{release-set-DeUSOEHy.js → release-set-CQfuN9-v.js} +3 -3
  242. package/server/{remote-b-c5bOce.js → remote-C_2hasl7.js} +3 -3
  243. package/server/{remote-Dr5kGYSZ.js → remote-ChgimyYa.js} +3 -3
  244. package/server/{remote-agents-Ct_WOyke.js → remote-agents-By1ige5O.js} +6 -6
  245. package/server/{remote-agents-D6O_zETW.js → remote-agents-CA3Ihlxj.js} +1 -1
  246. package/server/{remote-completion-Dca3hAaa.js → remote-completion-fVe9e_3u.js} +12 -12
  247. package/server/resume-BFv1PGpA.js +3 -0
  248. package/server/{review-agent-CThvgK2r.js → review-agent-CIGOQYBD.js} +29 -25
  249. package/server/{review-agent-CCum8sGe.js → review-agent-DNboMyW4.js} +1 -1
  250. package/server/{review-artifacts-CXywD0F2.js → review-artifacts-nRDPuMxd.js} +5 -5
  251. package/server/{review-context-OYfKUprb.js → review-context-2uj-YQ8J.js} +70 -26
  252. package/server/review-status-btEYlaxA.js +3 -0
  253. package/server/{review-status-enrichment-crNAtIpL.js → review-status-enrichment-Dci-ZwEt.js} +3 -3
  254. package/server/{review-status-DFRjDFef.js → review-status-kZj_KyCk.js} +77 -28
  255. package/server/{review-status-sync-DpAMD_WO.js → review-status-sync-BTOpxtTC.js} +10 -5
  256. package/server/{review-status-sync-D60PJWNL.js → review-status-sync-DSDK3OMy.js} +1 -1
  257. package/server/{review-verdict-feedback-CpUZl5aE.js → review-verdict-feedback-CCjVA7Uk.js} +6 -6
  258. package/server/{review-verdict-feedback-JImjut0z.js → review-verdict-feedback-CTd4QMBu.js} +1 -1
  259. package/server/{rollup-CZ02qgxk.js → rollup-BKQC7jp4.js} +1 -1
  260. package/server/{rollup-SyuF09e4.js → rollup-FGsKki9R.js} +8 -8
  261. package/server/{scanner-Br0Z5S6R.js → scanner-CnqEZeDy.js} +45 -14
  262. package/server/{sequence-io-fxU0DlwW.js → sequence-io-D909zgeH.js} +4 -4
  263. package/server/{sequencer-agent-B5YC5XVP.js → sequencer-agent-CzkcK6P5.js} +5 -5
  264. package/server/server.js +2961 -919
  265. package/server/{service-Bagb90KZ.js → service-CLeAoU6G.js} +55 -54
  266. package/server/{session-fork-BqQxd-V6.js → session-fork-CHI1XvL9.js} +2 -2
  267. package/server/{session-history-XdS0JKp3.js → session-history-BT3IvqhC.js} +4 -4
  268. package/server/settings-66A6uvIA.js +2 -0
  269. package/server/{settings-BNbocWOg.js → settings-BTMvpNFU.js} +3 -3
  270. package/server/{settings-uLc6DEYI.js → settings-C0zgxOGf.js} +2 -2
  271. package/server/{shadow-engineering-D4X_s3fA.js → shadow-engineering-BJfgm-hX.js} +2 -2
  272. package/server/{shadow-state-C_NkP-sa.js → shadow-state-7a-524T8.js} +2 -2
  273. package/server/{shadow-state-CbvsN3qG.js → shadow-state-DnDyjujH.js} +1 -1
  274. package/server/{shadow-utils-CYMRPeRT.js → shadow-utils-Db3oroFG.js} +2 -2
  275. package/server/{ship-log-__QtAFXG.js → ship-log-D9MlVzYU.js} +1 -1
  276. package/server/{smart-compaction-jdMkG1vo.js → smart-compaction-CV2ukKND.js} +1 -1
  277. package/server/{smart-compaction-CLZOWin1.js → smart-compaction-KCYScAU1.js} +7 -7
  278. package/server/{spawn-planning-session-D5OXo8pT.js → spawn-planning-session-DKpdFyOC.js} +35 -27
  279. package/server/{spawn-planning-session-8D6mE033.js → spawn-planning-session-qUC2VWu3.js} +1 -1
  280. package/server/{specialist-completion-CqmduO92.js → specialist-completion-Ky9wCDpb.js} +1 -1
  281. package/server/{specialist-context-CJ-QjFR-.js → specialist-context-Bn3dCGS2.js} +5 -5
  282. package/server/{specialist-handoff-logger-Dnjlwt7g.js → specialist-handoff-logger-CMEwYxa2.js} +2 -2
  283. package/server/{specialist-logs-CQnKzuZs.js → specialist-logs-C5p8G7tx.js} +3 -3
  284. package/server/{specialists-Bg9v4z3F.js → specialists-CC4r-c2s.js} +1015 -460
  285. package/server/{specialists-D0gGXMZx.js → specialists-CShuVGWT.js} +1 -1
  286. package/server/specialists-DM6bWjsi.js +3 -0
  287. package/server/{specialists-CwZHb5cb.js → specialists-jiuuyVkp.js} +66 -74
  288. package/server/specs-C8Wsn2XO.js +3 -0
  289. package/server/{src-BMMoA_ba.js → src-CXmtj0im.js} +6 -6
  290. package/server/{src-Bqdtd6po.js → src-CdmnTM2m.js} +5 -5
  291. package/server/{src-k039WVYY.js → src-DtcUOZCq.js} +112 -18
  292. package/server/stack-health-Bn3o8FBX.js +3 -0
  293. package/server/{stack-health-C-ifC7b0.js → stack-health-DxSdG9cW.js} +63 -9
  294. package/server/{stale-task-claims-L7pJkQFL.js → stale-task-claims-KJKxxiiQ.js} +4 -4
  295. package/server/{staleness-_Tr-GwdA.js → staleness-CT34nwr9.js} +1 -1
  296. package/server/{staleness-BID1BKdr.js → staleness-DPm7ClwA.js} +15 -3
  297. package/server/{state-home-CONQvZR0.js → state-home-Cn_Qu8IX.js} +96 -44
  298. package/server/{state-migrate-BeBW0KXA.js → state-migrate-BGg2ZaOt.js} +12 -3
  299. package/server/{stuck-remediation-CKnIryGT.js → stuck-remediation-DYuPRYYw.js} +307 -26
  300. package/server/{stuck-remediation-CsGD5Ksb.js → stuck-remediation-s9_2qfi6.js} +1 -1
  301. package/server/{substrate-bug-weights-service-CpIZILj9.js → substrate-bug-weights-service-B-FwCs5V.js} +3 -3
  302. package/server/{summary-fork-bX6ax6X7.js → summary-fork-D1RAk9rJ.js} +78 -12
  303. package/server/{summary-fork-agEMsPSo.js → summary-fork-DpcxN9tf.js} +2 -2
  304. package/server/supervisor/{injection-budget-C1iPirFS.js → injection-budget-Csw5tqfJ.js} +2 -41
  305. package/server/supervisor/pty-supervisor.js +2 -1
  306. package/server/supervisor/pty-token-x-ea28Us.js +43 -0
  307. package/server/supervisor-FTJAIsAK.js +2 -0
  308. package/server/{supervisor-Ctt4eRYz.js → supervisor-wM4ooB5O.js} +3 -3
  309. package/server/{swarm-readiness-DdmJVX7y.js → swarm-readiness-DlP_UjHq.js} +4 -4
  310. package/server/{system-prerequisites-DSXBvffY.js → system-prerequisites-DUDj1YHf.js} +56 -29
  311. package/server/{teardown-workspace-DDCf5n-a.js → teardown-workspace-DeTTImn-.js} +15 -15
  312. package/server/{test-agent-queue-BJZ9Nfcc.js → test-agent-queue-MbxX5vqq.js} +7 -7
  313. package/server/{test-verdict-Cp5tljlJ.js → test-verdict-bWYBtqBg.js} +1 -1
  314. package/server/{test-verdict-D_-sXIz_.js → test-verdict-gscuksPv.js} +1 -1
  315. package/server/{tldr-daemon-B8_oT5gx.js → tldr-daemon-BYFkts95.js} +1 -1
  316. package/server/{tldr-daemon-BQFmmFp0.js → tldr-daemon-C-69c3OI.js} +2 -2
  317. package/server/tmux-B6z7h_vZ.js +3 -0
  318. package/server/{tmux-L5LgvGLp.js → tmux-R7N7y-Mh.js} +76 -44
  319. package/server/{token-BkQLy4yS.js → token-BK6t8BIT.js} +2 -2
  320. package/server/token-util-DuPuNriz.js +3 -0
  321. package/server/{token-util-DI8sGlmF.js → token-util-DxXu-vd1.js} +1 -1
  322. package/server/{tracker-config-DdT-nUAM.js → tracker-config-G6latr8C.js} +2 -2
  323. package/server/{tracker-utils-DV3h1FYG.js → tracker-utils-B4ylXZQK.js} +1 -1
  324. package/server/{tracker-utils-CawsPSS2.js → tracker-utils-DHv5pSDT.js} +2 -2
  325. package/server/{traefik-connect-C6mJckNs.js → traefik-connect-Df2uXPsQ.js} +1 -1
  326. package/server/{tunnel-IdK1iTHx.js → tunnel-CDVKJpRv.js} +3 -3
  327. package/server/{tunnel-BIFl98rc.js → tunnel-DGdUkGoZ.js} +1 -1
  328. package/server/{types-7-GnJn0t.js → types-5M0lupud.js} +1 -1
  329. package/server/{uat-train-0Ujk8GCv.js → uat-train-B05BWkp-.js} +1 -1
  330. package/server/{uat-train-j0cPeMSj.js → uat-train-DDSrSoV1.js} +28 -28
  331. package/server/validate-IfDGkaVR.js +177 -0
  332. package/server/{validation-DcAgXTQp.js → validation-CC9OPqJZ.js} +1 -1
  333. package/server/{validation-CabEISJT.js → validation-Dw1pzDzr.js} +259 -9
  334. package/server/{verification-artifact-Ck1tefmz.js → verification-artifact-B3itKTxu.js} +1 -1
  335. package/server/{verification-artifact-BuTA1QbL.js → verification-artifact-TVFSz_q1.js} +1 -1
  336. package/server/{verification-runner-DlJezzef.js → verification-runner-BW4HOKAz.js} +1 -1
  337. package/server/{verification-runner-FiuAZ-H2.js → verification-runner-CkgX6EtI.js} +174 -124
  338. package/server/{vtt-parser-BnRsYzcz.js → vtt-parser-DYPbKcIJ.js} +1 -1
  339. package/server/{work-agent-prompt-DLthEPAq.js → work-agent-prompt-Du8Vh2aJ.js} +13 -13
  340. package/server/workflows-BQu4RFQ-.js +2 -0
  341. package/server/{workflows-BZNNYkGC.js → workflows-mbQzh6mQ.js} +39 -77
  342. package/server/{workspace-3IC-UkAi.js → workspace--8tnhDI0.js} +1 -1
  343. package/server/{workspace-D9ppycdg.js → workspace-BPUws1-_.js} +3 -3
  344. package/server/{workspace-config-Bigl_-Lk.js → workspace-config-CIVWZOQr.js} +1 -1
  345. package/server/{workspace-manager-ClkCIWTe.js → workspace-manager-CBhNdzE4.js} +76 -18
  346. package/server/workspace-manager-CWT55qeI.js +3 -0
  347. package/server/{workspace-metadata-BE0efUv_.js → workspace-metadata-BzHnwwX4.js} +1 -1
  348. package/server/{workspace-metadata-tiSRIWJP.js → workspace-metadata-_WygnyoX.js} +2 -2
  349. package/server/{workspaces-CFPcL0vl.js → workspaces-Do_9J0LQ.js} +309 -124
  350. package/sync-sources/agents/pan-inspect-agent.md +1 -1
  351. package/sync-sources/agents/pan-merge-agent.md +1 -1
  352. package/sync-sources/agents/pan-planning-agent.md +4 -4
  353. package/sync-sources/agents/pan-work-agent.md +1 -1
  354. package/sync-sources/dev-skills/pan-commit/SKILL.md +1 -1
  355. package/sync-sources/dev-skills/test-specialist-workflow/SKILL.md +1 -1
  356. package/sync-sources/hooks/record-cost-event.js +369 -75
  357. package/sync-sources/hooks/session-start-hook +7 -0
  358. package/sync-sources/hooks/work-agent-stop-hook +1 -1
  359. package/sync-sources/rules/per-bead-durability.md +1 -1
  360. package/sync-sources/rules/prd-authoring.md +1 -1
  361. package/sync-sources/skills/feature-work/SKILL.md +1 -1
  362. package/sync-sources/skills/okf/README.md +11 -3
  363. package/sync-sources/skills/okf/SKILL.md +12 -1
  364. package/sync-sources/skills/okf/docs/USAGE.md +15 -0
  365. package/sync-sources/skills/okf/references/overdeck.md +28 -0
  366. package/sync-sources/skills/pan/SKILL.md +2 -2
  367. package/sync-sources/skills/pan-admin-config/SKILL.md +1 -0
  368. package/sync-sources/skills/pan-approve/SKILL.md +1 -1
  369. package/sync-sources/skills/pan-close/SKILL.md +1 -1
  370. package/sync-sources/skills/pan-doctor/SKILL.md +1 -1
  371. package/sync-sources/skills/pan-flywheel/SKILL.md +18 -1
  372. package/sync-sources/skills/pan-knowledge/SKILL.md +10 -0
  373. package/sync-sources/skills/pan-new-project/SKILL.md +9 -11
  374. package/sync-sources/skills/pan-orders/SKILL.md +33 -0
  375. package/sync-sources/skills/pan-oversee/SKILL.md +5 -5
  376. package/sync-sources/skills/pan-plan/SKILL.md +6 -6
  377. package/sync-sources/skills/pan-quickstart/SKILL.md +1 -1
  378. package/sync-sources/skills/pan-recap/SKILL.md +2 -2
  379. package/sync-sources/skills/pan-review/SKILL.md +1 -1
  380. package/sync-sources/skills/pan-start/SKILL.md +7 -3
  381. package/sync-sources/skills/pan-swarm/SKILL.md +1 -1
  382. package/sync-sources/skills/pan-sync/SKILL.md +1 -1
  383. package/sync-sources/skills/pan-task/SKILL.md +2 -2
  384. package/sync-sources/skills/pan-wipe/SKILL.md +2 -2
  385. package/sync-sources/skills/pipeline-list/SKILL.md +1 -1
  386. package/sync-sources/skills/pipeline-status/SKILL.md +2 -2
  387. package/sync-sources/skills/plan/SKILL.md +11 -11
  388. package/sync-sources/skills/write-vbrief/SKILL.md +7 -282
  389. package/sync-sources/skills/write-xbrief/SKILL.md +295 -0
  390. package/sync-sources/templates/claude-md/sections/warnings.md +1 -1
  391. package/sync-sources/templates/traefik/dynamic/overdeck.yml.template +10 -0
  392. package/server/agent-state-Co5Sy2Fw.js +0 -3
  393. package/server/agents-DyHKlq1I.js +0 -3
  394. package/server/cli-BRORS9qY.js +0 -3
  395. package/server/codex-DNyiQDKW.js +0 -3
  396. package/server/context-layers-15gDOk20.js +0 -165
  397. package/server/context-layers-DlQKkHH2.js +0 -4
  398. package/server/deacon-swarm-CV54eNmU.js +0 -2
  399. package/server/dist-j64RzSrQ.js +0 -3
  400. package/server/flywheel-6WHU4O7A.js +0 -207
  401. package/server/flywheel-COR0mbRI.js +0 -522
  402. package/server/flywheel-Ctr5uuvo.js +0 -2
  403. package/server/forge-B0_opi-V.js +0 -2
  404. package/server/git-utils-CsKGnzFA.js +0 -3
  405. package/server/hume-BmhvfVbV.js +0 -3
  406. package/server/inspect-agent-Dq0z1k3H.js +0 -2
  407. package/server/layers-Cp1To4L8.js +0 -93
  408. package/server/lifecycle-io-DmY2qwCn.js +0 -3
  409. package/server/merge-blockers-BYjeXrVN.js +0 -41
  410. package/server/merge-ops-DwWCkSgo.js +0 -2
  411. package/server/merge-set-DiISXcC-.js +0 -139
  412. package/server/projects-BKkwpH6q.js +0 -3
  413. package/server/public/assets/index-Bdc4V9ba.css +0 -1
  414. package/server/public/assets/mermaid-GHXKKRXX-B5v_r7cI.js +0 -1
  415. package/server/rally-OSJXdiHK.js +0 -3
  416. package/server/rebuild-stack-CKjJAI8L.js +0 -3
  417. package/server/record-rwK-nKv_.js +0 -3
  418. package/server/record-update-Crz74r-6.js +0 -168
  419. package/server/resume-wZZsWtzz.js +0 -3
  420. package/server/review-status-Bnh-rdkY.js +0 -3
  421. package/server/settings-BlUsVaUc.js +0 -2
  422. package/server/specialists-Dqe6_HE5.js +0 -3
  423. package/server/specs-BhOKBzqk.js +0 -3
  424. package/server/stack-health-Bd06frFn.js +0 -3
  425. package/server/supervisor-COVHrBTg.js +0 -2
  426. package/server/tmux-BAvtac_u.js +0 -3
  427. package/server/token-util-BArZLN6w.js +0 -3
  428. package/server/workflows-C4mR0Reb.js +0 -2
  429. package/server/workspace-manager-B1WOfKvB.js +0 -3
@@ -1,48 +1,49 @@
1
1
  import { n as __esmMin, o as __toESM } from "./rolldown-runtime-DNCzzKnI.js";
2
- import { B as getProviderEnvSync, Bt as resolveProjectForIssue, C as TIERED_EXECUTION_DIFFICULTIES, D as resolveTieredExecutionEnabled, Fn as getProjectSwarmHotspots, G as setupCredentialFileAuthSync, H as init_providers, Hn as init_projects, Ht as writeAgentHarnessModelSync, In as getProjectSync, K as ensureOpenAICompatibleProxyRunning, L as clearCredentialFileAuthSync, Lt as readIssueRecordForWorkspaceSync, Mr as AGENTS_DIR, Nn as getIssuePrefix, Nt as init_record, O as resolveTieredExecutionEnabledForIssue, R as getBuiltInDefaultHarness, Rt as readIssueRecordSync, S as DEFAULT_TIERED_EXECUTION_CONFIG, T as init_tier_table, V as getProviderForModelSync, Xr as encodeClaudeProjectDir, _r as require_dist, ci as sessionFilePath, dt as fnv1a32, et as init_roles, f as loadConfigSync, fr as init_issue_id, ft as init_percent, hr as resolveBareNumericIdSync, ii as init_paths, it as getModelCapabilitySync, jr as init_errors, kn as findProjectByPathSync, l as isClaudeCodeChannelsMcpEnabled, lt as resolveModelIdSync, nr as resolveProjectFromIssueSync, oi as packageRoot, ot as hasModelCapabilitySync, q as init_openai_compatible_proxy, ri as getOverdeckHome, si as resolveOhmypiExtensionPath, st as init_model_capabilities, t as init_config_yaml, tt as resolveModel, u as isTldrEnabledSync, ut as fmix32, xn as shouldCommitLegacyWorkspaceArtifacts, xr as FsError, yn as init_state_read_home, yr as ClaudeCredentialParseError } from "./config-yaml-ig8Nwtiw.js";
2
+ import { B as getProviderEnvSync, Br as getOverdeckHome, C as TIERED_EXECUTION_DIFFICULTIES, D as resolveTieredExecutionEnabled, Ft as resolveProjectForIssue, G as setupCredentialFileAuthSync, Gr as sessionFilePath, H as init_providers, Hr as isDevMode, It as writeAgentHarnessModelSync, K as ensureOpenAICompatibleProxyRunning, L as clearCredentialFileAuthSync, Mt as readIssueRecordForWorkspaceSync, Nr as encodeClaudeProjectDir, Nt as readIssueRecordSync, O as resolveTieredExecutionEnabledForIssue, Ot as init_record, Qn as resolveBareNumericIdSync, R as getBuiltInDefaultHarness, S as DEFAULT_TIERED_EXECUTION_CONFIG, T as init_tier_table, Tn as init_projects, Ur as packageRoot, V as getProviderForModelSync, Vr as init_paths, Wr as resolveOhmypiExtensionPath, Yn as init_issue_id, dt as fnv1a32, er as require_dist, et as init_roles, f as loadConfigSync, fn as findProjectByPathSync, ft as init_percent, gn as getIssuePrefix, hr as AGENTS_DIR, in as shouldCommitLegacyWorkspaceArtifacts, ir as FsError, it as getModelCapabilitySync, l as isClaudeCodeChannelsMcpEnabled, lt as resolveModelIdSync, mr as init_errors, nn as init_state_read_home, nr as ClaudeCredentialParseError, ot as hasModelCapabilitySync, q as init_openai_compatible_proxy, st as init_model_capabilities, t as init_config_yaml, tt as resolveModel, u as isTldrEnabledSync, ut as fmix32, vn as getProjectSwarmHotspots, yn as getProjectSync, zn as resolveProjectFromIssueSync } from "./config-yaml-DySPNmKN.js";
3
3
  import { a as init_activity_logger, n as emitActivityEntrySync, r as emitActivityTtsSync } from "./activity-logger-DDlOIAML.js";
4
- import { d as getOverdeckDatabaseSync, f as init_infra } from "./infra-D4iNWMA5.js";
5
- import { B as sendRawKeystroke, D as killSession, E as isPaneDead, H as sessionExistsSync, J as BLANKED_PROVIDER_ENV, L as sendEscapeKeyAsync, M as listSessions, N as listSessionsSync, O as killSessionSync, R as sendKeys, U as setOption, V as sessionExists, Z as init_child_env, a as capturePaneSync, c as createSessionSync, i as capturePane, k as listPaneValues, m as exactPaneTarget, s as createSession, w as init_tmux } from "./tmux-L5LgvGLp.js";
6
- import { a as init_event_store, i as initEventStore } from "./event-store-TnWdydfB.js";
7
- import { a as OHMYPI_BEHAVIOR, o as getHarnessBehavior } from "./src-k039WVYY.js";
8
- import { D as saveOverdeckAgentStateSync, E as listOverdeckAgentStatesSync, T as init_agent_state_sync, c as init_review_status, m as resetPipelineVerdictsForWorkStartSync, w as getOverdeckAgentStateSync } from "./review-status-DFRjDFef.js";
9
- import { i as countAgentsByStatus, o as init_agents$1 } from "./agents-DXdHmRTC.js";
10
- import { n as ensureSessionContextBriefingFile, r as init_briefing_freshness } from "./briefing-freshness-C12WgkaB.js";
11
- import { o as getPricingSync, s as init_cost } from "./cost-Codk1pc2.js";
12
- import { _ as init_tier_metrics, g as estimateFeedDeliveryTokens, v as recordTierFeedDelivery } from "./cost-sync-D_cre6WM.js";
13
- import { a as persistCurrentSessionId, d as isAgentStateServiceInProcess, i as logLauncherSessionPinned, l as getRuntimeSnapshot, n as createFreshSessionIdentity, o as init_persistent_logger, r as init_session_history, s as logAgentLifecycleSync, u as init_agent_runtime_mirror } from "./session-history-XdS0JKp3.js";
14
- import { t as init_behavior } from "./behavior-CGj16clS.js";
15
- import { i as ensureInternalTokenSync, s as init_internal_token, t as INTERNAL_TOKEN_HEADER } from "./internal-token-CXsfxslp.js";
4
+ import { d as getOverdeckDatabaseSync, f as init_infra } from "./infra-BEqFxlJc.js";
5
+ import { $ as init_child_env, A as listPaneValues, D as killSession, E as isPaneDead, H as sessionExists, O as killSessionSync, P as listSessionsSync, R as sendEscapeKeyAsync, U as sessionExistsSync, V as sendRawKeystroke, W as setOption, X as BLANKED_PROVIDER_ENV, a as capturePaneSync, c as createSessionSync, i as capturePane, m as exactPaneTarget, s as createSession, w as init_tmux, z as sendKeys } from "./tmux-R7N7y-Mh.js";
6
+ import { a as init_event_store, i as initEventStore } from "./event-store-CQL6NeqB.js";
7
+ import { a as OHMYPI_BEHAVIOR, o as getHarnessBehavior } from "./src-DtcUOZCq.js";
8
+ import { D as listOverdeckAgentStatesSync, E as init_agent_state_sync, O as saveOverdeckAgentStateSync, T as getOverdeckAgentStateSync, h as resetPipelineVerdictsForWorkStartSync, l as init_review_status } from "./review-status-kZj_KyCk.js";
9
+ import { i as countAgentsByStatus, o as init_agents$1 } from "./agents-EbI0zCJl.js";
10
+ import { n as ensureSessionContextBriefingFile, r as init_briefing_freshness } from "./briefing-freshness-D1wzUIWv.js";
11
+ import { o as getPricingSync, s as init_cost } from "./cost-B2ddP6wq.js";
12
+ import { _ as init_tier_metrics, g as estimateFeedDeliveryTokens, v as recordTierFeedDelivery } from "./cost-sync-BsN6ER0n.js";
13
+ import { a as persistCurrentSessionId, d as isAgentStateServiceInProcess, i as logLauncherSessionPinned, l as getRuntimeSnapshot, n as createFreshSessionIdentity, o as init_persistent_logger, r as init_session_history, s as logAgentLifecycleSync, u as init_agent_runtime_mirror } from "./session-history-BT3IvqhC.js";
14
+ import { t as init_behavior } from "./behavior-B3exJ42O.js";
15
+ import { i as ensureInternalTokenSync, s as init_internal_token, t as INTERNAL_TOKEN_HEADER } from "./internal-token-s0-oKybJ.js";
16
16
  import { i as readReviewStatusMap, n as init_review_status_source, r as isRoleTerminal } from "./review-status-source-CxuEjLGg.js";
17
- import { m as readWorkspacePlanSync, o as init_io } from "./io-DQR9PMgS.js";
18
- import { c as bridgeGeminiAuthToCliproxy, d as getCliproxyAuthDir, g as getCliproxyLogPath, l as decodeJwtPayload$1, p as getCliproxyClientEnv, s as bridgeCodexAuthToCliproxySync, v as init_cliproxy } from "./cliproxy-Brf_5MuG.js";
19
- import { L as normalizeHarness, R as reactivateConversationForSpawn, S as getConversationByName, k as init_conversations, y as createConversation } from "./conversations-bYpM9-kZ.js";
20
- import { n as recordFeatureRegistryLifecycle, t as init_feature_registry_population } from "./feature-registry-population-B-CI9hgE.js";
21
- import { a as readCavemanVariant, n as init_workspace } from "./workspace-D9ppycdg.js";
22
- import { a as requireModelOverrideSync, i as normalizeModelOverrideSync, n as init_launcher_generator, o as shellQuoteModelIdSync, r as init_model_validation, t as generateLauncherScriptSync } from "./launcher-generator-COgR2By1.js";
23
- import { a as init_claude_permissions, r as getClaudePermissionFlagsStringSync } from "./claude-permissions-nSFKH78M.js";
24
- import { h as workspaceContextFile, o as init_layers } from "./layers-Cp1To4L8.js";
25
- import { a as extractThreadIdFromRollout, c as initCodexHome, l as init_codex, o as findLatestRollout } from "./codex-CbmztVcc.js";
26
- import { n as init_harness_binary, r as prepareHarnessLaunch } from "./harness-binary-B2CTcD84.js";
27
- import { f as init_config, m as loadConfigSync$1 } from "./config-q4Gvd8dq.js";
28
- import { a as getFlywheelActiveRunIdSync, s as init_control_settings } from "./control-settings-D_odMIaC.js";
29
- import { n as createTrackerFromConfig, r as init_factory, t as createTracker } from "./factory-BMrK4TrE.js";
30
- import { a as init_stack_health, i as getWorkspaceStackHealth } from "./stack-health-C-ifC7b0.js";
31
- import { i as createActiveSlice, l as init_dag, o as getDispatchableItems, s as groupItemsByWave } from "./dag-CJpgf9A3.js";
32
- import { c as generateFixedPointPromptSync, f as initHookSync, n as checkHookSync, p as init_hooks } from "./hooks-yxRsjk-z.js";
33
- import { n as resolveHarness, t as init_harness_resolve } from "./harness-resolve-D5FVQTmy.js";
34
- import { a as loadCloisterConfigSync, r as init_config$1 } from "./config-DeTsoZdR.js";
35
- import { t as init_reap_terminal_sessions } from "./reap-terminal-sessions-DG9eiMVz.js";
36
- import { c as isStateMigrated, o as init_state_home } from "./state-home-CONQvZR0.js";
37
- import { n as provisionClaudeHooks, t as init_claude_hooks_provision } from "./claude-hooks-provision-D7p5WcKZ.js";
38
- import { a as init_lifecycle_io, t as appendContinueSessionEntryForIssue } from "./lifecycle-io-taIb0PoH.js";
39
- import { r as init_swarm_readiness, t as analyzeSwarmReadiness } from "./swarm-readiness-DdmJVX7y.js";
17
+ import { m as readWorkspacePlanSync, o as init_io } from "./io-C9kF1wtJ.js";
18
+ import { c as bridgeGeminiAuthToCliproxy, d as getCliproxyAuthDir, g as getCliproxyLogPath, l as decodeJwtPayload$1, p as getCliproxyClientEnv, s as bridgeCodexAuthToCliproxySync, v as init_cliproxy } from "./cliproxy-C8a1vtTU.js";
19
+ import { L as normalizeHarness, R as reactivateConversationForSpawn, S as getConversationByName, k as init_conversations, y as createConversation } from "./conversations-6AfUfbwc.js";
20
+ import { n as recordFeatureRegistryLifecycle, t as init_feature_registry_population } from "./feature-registry-population-DKZFMbFt.js";
21
+ import { a as readCavemanVariant, n as init_workspace } from "./workspace-BPUws1-_.js";
22
+ import { a as normalizeModelOverrideSync, i as init_model_validation, n as init_launcher_generator, o as requireModelOverrideSync, s as shellQuoteModelIdSync, t as generateLauncherScriptSync } from "./launcher-generator-BBWG_SiS.js";
23
+ import { a as init_claude_permissions, r as getClaudePermissionFlagsStringSync } from "./claude-permissions-DNWEVV6z.js";
24
+ import { E as init_layers, I as workspaceContextFile, P as resolveWorkspaceContextFile, c as init_render, i as workspaceContextWithoutProjectLayer, l as renderGlobalLayer, r as init_assemble, u as renderProjectLayer, v as init_harness, y as renderForHarness } from "./assemble-J2ZZ2C15.js";
25
+ import { a as extractThreadIdFromRollout, c as initCodexHome, l as init_codex, o as findLatestRollout } from "./codex-BZXGhUVB.js";
26
+ import { i as prepareHarnessLaunch, r as init_harness_binary } from "./harness-binary-DPUi-Pv8.js";
27
+ import { f as init_config, m as loadConfigSync$1 } from "./config-BZ0sHTju.js";
28
+ import { a as getFlywheelActiveRunIdSync, s as init_control_settings } from "./control-settings-BQp7_4uD.js";
29
+ import { n as createTrackerFromConfig, r as init_factory, t as createTracker } from "./factory-CFibJuaw.js";
30
+ import { a as getWorkspaceStackHealth, s as init_stack_health } from "./stack-health-DxSdG9cW.js";
31
+ import { i as createActiveSlice, l as init_dag, o as getDispatchableItems, s as groupItemsByWave } from "./dag-B1ucnjDU.js";
32
+ import { c as generateFixedPointPromptSync, f as initHookSync, n as checkHookSync, p as init_hooks } from "./hooks-CKZgXlJb.js";
33
+ import { n as resolveHarness, t as init_harness_resolve } from "./harness-resolve-3lNZkyT4.js";
34
+ import { a as loadCloisterConfigSync, r as init_config$1 } from "./config-CKxYiCmX.js";
35
+ import { t as init_reap_terminal_sessions } from "./reap-terminal-sessions-BtHPo6Xc.js";
36
+ import { c as isStateMigrated, o as init_state_home } from "./state-home-Cn_Qu8IX.js";
37
+ import { n as provisionClaudeHooks, t as init_claude_hooks_provision } from "./claude-hooks-provision-D8GXF3_s.js";
38
+ import { a as init_lifecycle_io, t as appendContinueSessionEntryForIssue } from "./lifecycle-io-BREGpnLk.js";
39
+ import { i as init_git_utils, o as renderWorkspaceGitShowPromise } from "./git-utils-CRw2zLPC.js";
40
+ import { r as init_swarm_readiness, t as analyzeSwarmReadiness } from "./swarm-readiness-DlP_UjHq.js";
40
41
  import { dirname, join, relative } from "node:path";
41
42
  import { Data, Duration, Effect, FileSystem } from "effect";
42
- import { appendFileSync, existsSync, mkdirSync, readFileSync, statSync, statfsSync, unlinkSync, writeFileSync } from "fs";
43
+ import { appendFileSync, existsSync, mkdirSync, readFileSync, rmSync, statSync, statfsSync, unlinkSync, writeFileSync } from "fs";
43
44
  import { basename as basename$1, dirname as dirname$1, join as join$1, resolve as resolve$1 } from "path";
44
45
  import { homedir } from "os";
45
- import "node:os";
46
+ import { cpus as cpus$1, loadavg as loadavg$1, platform as platform$1, totalmem as totalmem$1 } from "node:os";
46
47
  import { chmodSync as chmodSync$1, closeSync as closeSync$1, constants, cpSync, createReadStream as createReadStream$1, existsSync as existsSync$1, mkdirSync as mkdirSync$1, openSync as openSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, renameSync as renameSync$1, rmSync as rmSync$1, statSync as statSync$1, unlinkSync as unlinkSync$1, writeFileSync as writeFileSync$1, writeSync } from "node:fs";
47
48
  import { chmod, mkdir, readFile, stat as stat$1, writeFile } from "node:fs/promises";
48
49
  import { randomUUID } from "crypto";
@@ -1299,7 +1300,7 @@ function getAgentStateFilePath(agentId) {
1299
1300
  * PAN-1985: wipe agent state directories for an issue, optionally scoped to
1300
1301
  * a role prefix. Used by the restart-fresh and review-restart paths to clean
1301
1302
  * state before respawning — the new agent then reads `.pan/continue.json`,
1302
- * the vBRIEF, the beads, and the branch to pick up where the prior run left
1303
+ * the xBRIEF, the beads, and the branch to pick up where the prior run left
1303
1304
  * off. Refuses to run against an empty or unsafe id.
1304
1305
  *
1305
1306
  * - `rolePrefix` omitted: wipes only the work agent dir (`agent-<id>`).
@@ -1712,7 +1713,7 @@ function markAgentRunning(state, options) {
1712
1713
  assertAgentCanTransitionToRunning(state);
1713
1714
  const oldStatus = state.status;
1714
1715
  state.status = "running";
1715
- state.lastActivity = (/* @__PURE__ */ new Date()).toISOString();
1716
+ if (state.harness !== "codex") state.lastActivity = (/* @__PURE__ */ new Date()).toISOString();
1716
1717
  if (options?.preserveFailureTracking !== true) clearFailureTrackingFields(state);
1717
1718
  delete state.stoppedAt;
1718
1719
  delete state.stoppedByUser;
@@ -1827,6 +1828,33 @@ var init_agent_state = __esmMin((() => {
1827
1828
  function buildDefaultResumeContinueMessage(issueId) {
1828
1829
  return `You are resuming work on ${issueId}. Read .pan/continue.json for context and pick up where you left off — do not wait for further instructions.`;
1829
1830
  }
1831
+ /** Completed marker check: the agent dir's own markers, or the workspace's. */
1832
+ function hasCompletionMarkerForAgent(state) {
1833
+ const agentDir = getAgentDir(state.id);
1834
+ if (existsSync(join$1(agentDir, "completed")) || existsSync(join$1(agentDir, "completed.processed"))) return true;
1835
+ const workspace = state.workspace;
1836
+ if (workspace && (existsSync(join$1(workspace, ".pan", "completed")) || existsSync(join$1(workspace, ".pan", "completed.processed")))) return true;
1837
+ return false;
1838
+ }
1839
+ /**
1840
+ * PAN-2974 (root cause B): the resume kickoff is phase-aware. Telling an agent
1841
+ * whose work was already handed off (completed marker) to "pick up where you
1842
+ * left off — do not wait for further instructions" makes it re-drive pipeline
1843
+ * stages on its own authority — 2026-07-21 MIN-882: a post-reboot resume
1844
+ * re-ran verification, restored config, and fired `pan review request` /
1845
+ * `pan review restart` while the operator was mid-UAT on finished work.
1846
+ * A handed-off agent gets a PASSIVE restore instead; only agents that crashed
1847
+ * mid-implementation get the aggressive kickoff.
1848
+ */
1849
+ function buildResumeContinueMessage(state) {
1850
+ const issueId = state.issueId;
1851
+ if (hasCompletionMarkerForAgent(state)) return [
1852
+ `Your session for ${issueId} was restored after a restart.`,
1853
+ `The work was already handed off — a completed marker exists. Do NOT re-drive pipeline stages (review, test, verify, merge) on your own authority.`,
1854
+ `Stay available for the operator and act only on new instructions.`
1855
+ ].join(" ");
1856
+ return buildDefaultResumeContinueMessage(issueId);
1857
+ }
1830
1858
  async function buildResumeMessageForAgent(state, fallbackMessage, callerMessage) {
1831
1859
  if (state.role !== "work" || state.kickoffDelivered !== false) return {
1832
1860
  message: callerMessage ?? fallbackMessage,
@@ -2415,18 +2443,28 @@ async function getProviderEnvForModel(model) {
2415
2443
  }
2416
2444
  throw new Error(`No API key configured for ${provider.displayName}. Configure it in Settings before using model "${model}".`);
2417
2445
  }
2418
- function getClaudeCodeAutoCompactWindowForModel(model) {
2419
- if (getProviderForModelSync(model).name === "anthropic") return void 0;
2446
+ function getClaudeCodeContextPolicyForModel(model) {
2447
+ if (getProviderForModelSync(model).name === "anthropic") return {};
2420
2448
  const resolvedModel = resolveModelIdSync(model);
2421
- if (!hasModelCapabilitySync(resolvedModel)) return void 0;
2422
- return getModelCapabilitySync(resolvedModel).contextWindow;
2449
+ if (GPT_56_MODELS.has(resolvedModel)) return {
2450
+ autoCompactWindow: GPT_56_CODEX_CLIENT_CONTEXT_WINDOW,
2451
+ maxContextTokens: GPT_56_CODEX_CLIENT_CONTEXT_WINDOW
2452
+ };
2453
+ if (!hasModelCapabilitySync(resolvedModel)) return {};
2454
+ const contextWindow = getModelCapabilitySync(resolvedModel).contextWindow;
2455
+ if (KIMI_K3_MODELS.has(resolvedModel)) return {
2456
+ autoCompactWindow: contextWindow,
2457
+ maxContextTokens: contextWindow
2458
+ };
2459
+ return { autoCompactWindow: contextWindow };
2423
2460
  }
2424
2461
  async function getProviderExportsForModel(model) {
2425
2462
  const envVars = await getProviderEnvForModel(model);
2426
2463
  const unsetLines = PROVIDER_ENV_KEYS.map((key) => `unset ${key}`);
2427
- const autoCompactWindow = getClaudeCodeAutoCompactWindowForModel(model);
2464
+ const contextPolicy = getClaudeCodeContextPolicyForModel(model);
2428
2465
  const exportLines = Object.entries(envVars).map(([k, v]) => `export ${k}="${v.replace(/"/g, "\\\"")}"`);
2429
- if (autoCompactWindow !== void 0) exportLines.push(`export CLAUDE_CODE_AUTO_COMPACT_WINDOW="${autoCompactWindow}"`);
2466
+ if (contextPolicy.maxContextTokens !== void 0) exportLines.push(`export CLAUDE_CODE_MAX_CONTEXT_TOKENS="${contextPolicy.maxContextTokens}"`);
2467
+ if (contextPolicy.autoCompactWindow !== void 0) exportLines.push(`export CLAUDE_CODE_AUTO_COMPACT_WINDOW="${contextPolicy.autoCompactWindow}"`);
2430
2468
  return [...unsetLines, ...exportLines].join("\n") + "\n";
2431
2469
  }
2432
2470
  /**
@@ -2448,11 +2486,12 @@ async function buildSpawnEnvForModel(model, baseEnv = process.env) {
2448
2486
  sanitized[k] = v;
2449
2487
  }
2450
2488
  const providerEnv = await getProviderEnvForModel(model);
2451
- const autoCompactWindow = getClaudeCodeAutoCompactWindowForModel(model);
2489
+ const contextPolicy = getClaudeCodeContextPolicyForModel(model);
2452
2490
  return {
2453
2491
  ...sanitized,
2454
2492
  ...providerEnv,
2455
- ...autoCompactWindow !== void 0 ? { CLAUDE_CODE_AUTO_COMPACT_WINDOW: String(autoCompactWindow) } : {}
2493
+ ...contextPolicy.maxContextTokens !== void 0 ? { CLAUDE_CODE_MAX_CONTEXT_TOKENS: String(contextPolicy.maxContextTokens) } : {},
2494
+ ...contextPolicy.autoCompactWindow !== void 0 ? { CLAUDE_CODE_AUTO_COMPACT_WINDOW: String(contextPolicy.autoCompactWindow) } : {}
2456
2495
  };
2457
2496
  }
2458
2497
  /**
@@ -2492,7 +2531,7 @@ function determineModel(options = {}) {
2492
2531
  if ((options.role ?? "work") === "work" && !modelOverride && WORK_AGENT_BROKEN_MODELS.has(resolved)) throw new Error(`Resolved work model "${resolved}" is known-broken for work agents. Set roles.work.model to a working model in config.yaml, or pass an explicit --model override.`);
2493
2532
  return resolved;
2494
2533
  }
2495
- var CLI_PROXY_MODEL_ALIASES, PROVIDER_ENV_KEYS, WORK_AGENT_BROKEN_MODELS;
2534
+ var CLI_PROXY_MODEL_ALIASES, PROVIDER_ENV_KEYS, GPT_56_CODEX_CLIENT_CONTEXT_WINDOW, GPT_56_MODELS, KIMI_K3_MODELS, WORK_AGENT_BROKEN_MODELS;
2496
2535
  var init_provider_env = __esmMin((() => {
2497
2536
  init_config_yaml();
2498
2537
  init_workspace();
@@ -2517,6 +2556,7 @@ var init_provider_env = __esmMin((() => {
2517
2556
  "ANTHROPIC_SMALL_FAST_MODEL",
2518
2557
  "CLAUDE_CODE_SUBAGENT_MODEL",
2519
2558
  "CLAUDE_CODE_AUTO_COMPACT_WINDOW",
2559
+ "CLAUDE_CODE_MAX_CONTEXT_TOKENS",
2520
2560
  "OPENAI_API_KEY",
2521
2561
  "GEMINI_API_KEY",
2522
2562
  "API_TIMEOUT_MS",
@@ -2529,6 +2569,13 @@ var init_provider_env = __esmMin((() => {
2529
2569
  "NOUS_API_KEY",
2530
2570
  "DASHSCOPE_API_KEY"
2531
2571
  ];
2572
+ GPT_56_CODEX_CLIENT_CONTEXT_WINDOW = 372e3;
2573
+ GPT_56_MODELS = new Set([
2574
+ "gpt-5.6-sol",
2575
+ "gpt-5.6-terra",
2576
+ "gpt-5.6-luna"
2577
+ ]);
2578
+ KIMI_K3_MODELS = new Set(["k3", "k3[1m]"]);
2532
2579
  WORK_AGENT_BROKEN_MODELS = /* @__PURE__ */ new Set([]);
2533
2580
  }));
2534
2581
  //#endregion
@@ -2637,6 +2684,34 @@ var init_claude_auth = __esmMin((() => {
2637
2684
  });
2638
2685
  }));
2639
2686
  //#endregion
2687
+ //#region ../../lib/acp/context.ts
2688
+ function materializeAcpContextFile(agentDir, workspace) {
2689
+ const sections = [renderGlobalLayer("acp", isDevMode())];
2690
+ const project = findProjectByPathSync(workspace);
2691
+ if (project) sections.push(renderProjectLayer(project.path, "acp"));
2692
+ const workspaceFile = resolveWorkspaceContextFile(workspace);
2693
+ if (existsSync$1(workspaceFile)) {
2694
+ const workspaceContent = readFileSync$1(workspaceFile, "utf8");
2695
+ const workspaceOnly = project ? workspaceContextWithoutProjectLayer(workspaceContent) : workspaceContent;
2696
+ sections.push(renderForHarness(workspaceOnly, "acp").trim());
2697
+ }
2698
+ const content = sections.filter((section) => section.trim().length > 0).join(SECTION_SEPARATOR);
2699
+ const contextPath = join(agentDir, "acp-context.md");
2700
+ mkdirSync$1(dirname(contextPath), { recursive: true });
2701
+ writeFileSync$1(contextPath, `${content.trim()}\n`, { mode: 384 });
2702
+ return contextPath;
2703
+ }
2704
+ var SECTION_SEPARATOR;
2705
+ var init_context = __esmMin((() => {
2706
+ init_assemble();
2707
+ init_harness();
2708
+ init_layers();
2709
+ init_render();
2710
+ init_paths();
2711
+ init_projects();
2712
+ SECTION_SEPARATOR = "\n\n---\n\n";
2713
+ }));
2714
+ //#endregion
2640
2715
  //#region ../../lib/runtimes/ohmypi-fifo.ts
2641
2716
  /**
2642
2717
  * oh-my-pi (omp) RPC named-pipe lifecycle (PAN-1989).
@@ -2796,6 +2871,8 @@ async function writeLauncherScriptAtomic(launcherScript, content) {
2796
2871
  await rename$1(tmp, launcherScript);
2797
2872
  }
2798
2873
  async function claudeSystemPromptFiles(workspace, harness) {
2874
+ const behavior = getHarnessBehavior(harness);
2875
+ if (behavior.contextLayerKind === "acp") return [];
2799
2876
  const files = [];
2800
2877
  const contextFile = workspaceContextFile(workspace);
2801
2878
  try {
@@ -2805,14 +2882,13 @@ async function claudeSystemPromptFiles(workspace, harness) {
2805
2882
  if (!isNodeNotFound(error)) throw error;
2806
2883
  }
2807
2884
  files.push(await ensureSessionContextBriefingFile());
2808
- const behavior = getHarnessBehavior(harness);
2809
2885
  if (behavior.contextLayerKind === "pi") {
2810
- const { piGlobalContextFile } = await import("./context-layers-DlQKkHH2.js");
2886
+ const { piGlobalContextFile } = await import("./context-layers-BrPmE__h.js");
2811
2887
  const globalFile = piGlobalContextFile();
2812
2888
  if (existsSync(globalFile)) files.unshift(globalFile);
2813
2889
  }
2814
2890
  if (behavior.contextLayerKind === "codex") {
2815
- const { codexGlobalContextFile } = await import("./context-layers-DlQKkHH2.js");
2891
+ const { codexGlobalContextFile } = await import("./context-layers-BrPmE__h.js");
2816
2892
  const globalFile = codexGlobalContextFile();
2817
2893
  if (existsSync(globalFile)) files.unshift(globalFile);
2818
2894
  }
@@ -2868,6 +2944,18 @@ async function getOhmypiLauncherFields(agentId, model) {
2868
2944
  model
2869
2945
  };
2870
2946
  }
2947
+ function getAcpLauncherFields(agentId, model, workspace, binaryPath, _role) {
2948
+ return {
2949
+ harness: "acp",
2950
+ acpAgentId: agentId,
2951
+ acpProvider: getProviderForModelSync(model).name,
2952
+ acpWorkspace: workspace,
2953
+ acpBinaryPath: binaryPath,
2954
+ acpContextFile: materializeAcpContextFile(getAgentDir(agentId), workspace),
2955
+ model,
2956
+ unsetProviderEnv: true
2957
+ };
2958
+ }
2871
2959
  function getCodexLauncherFields(agentId, model, workspacePath, role) {
2872
2960
  const codexHome = join$1(homedir(), ".overdeck", "agents", agentId, "codex-home");
2873
2961
  const codexConfig = loadConfigSync().config.codex;
@@ -3029,12 +3117,45 @@ async function waitForCodexAppServerReady(agentId, timeoutSec = 30, deps = {}) {
3029
3117
  const detail = lastError ? ` Last status error: ${lastError}` : ` Last state: ${lastState}.`;
3030
3118
  throw new Error(`Timed out waiting for Codex app-server readiness for ${agentId}.${detail}`);
3031
3119
  }
3120
+ async function waitForAcpHostReady(agentId, timeoutSec = 30, deps = {}) {
3121
+ const now = deps.now ?? (() => Date.now());
3122
+ const sleep = deps.sleep ?? ((ms) => new Promise((resolveSleep) => setTimeout(resolveSleep, ms)));
3123
+ const sessionExistsForAgent = deps.sessionExists ?? (async (id) => Effect.runPromise(sessionExists(id)));
3124
+ const readText = deps.readText ?? ((path) => readFileSync(path, "utf8"));
3125
+ const pathExists = deps.pathExists ?? existsSync;
3126
+ const agentDir = getAgentDir(agentId);
3127
+ const sessionIdPath = join$1(agentDir, "acp-session-id");
3128
+ const errorPath = join$1(agentDir, "acp-launch-error");
3129
+ const tokenPath = join$1(agentDir, "acp-token");
3130
+ const socketPath = join$1(getOverdeckHome(), "sockets", `acp-${agentId}.sock`);
3131
+ const deadline = now() + timeoutSec * 1e3;
3132
+ while (now() < deadline) {
3133
+ if (pathExists(errorPath)) {
3134
+ const launchError = readText(errorPath).trim();
3135
+ if (launchError) throw new Error(`ACP host ${agentId} failed to start: ${launchError}`);
3136
+ }
3137
+ if (!await sessionExistsForAgent(agentId)) throw new Error(`ACP host session ${agentId} exited before readiness.`);
3138
+ try {
3139
+ const sessionId = readText(sessionIdPath).trim();
3140
+ const token = readText(tokenPath).trim();
3141
+ if (sessionId && token && pathExists(socketPath)) return;
3142
+ } catch (error) {
3143
+ if (!isNodeNotFound(error)) throw error;
3144
+ }
3145
+ await sleep(500);
3146
+ }
3147
+ throw new Error(`Timed out waiting for ACP host readiness for ${agentId}.`);
3148
+ }
3032
3149
  async function waitForPromptReady(agentId, harness, timeoutSec = 30) {
3033
3150
  const readinessKind = harness === "codex" && loadConfigSync().config.codex?.transport !== "tui" ? "codex-app-server-ready" : getHarnessBehavior(harness).readinessKind;
3034
3151
  if (readinessKind === "codex-app-server-ready") {
3035
3152
  await waitForCodexAppServerReady(agentId, timeoutSec);
3036
3153
  return true;
3037
3154
  }
3155
+ if (readinessKind === "acp-host-ready") {
3156
+ await waitForAcpHostReady(agentId, timeoutSec);
3157
+ return true;
3158
+ }
3038
3159
  if (readinessKind === "codex-tui-prompt") return waitForCodexTuiReady(agentId, timeoutSec);
3039
3160
  return waitForReadySignal(agentId, timeoutSec);
3040
3161
  }
@@ -3062,7 +3183,7 @@ async function injectPiPromptTimeMemory(agentId, prompt) {
3062
3183
  agentRole: agentState.role ?? "work",
3063
3184
  agentHarness: agentState.harness ?? "claude-code"
3064
3185
  };
3065
- const { injectPromptTimeMemory } = await import("./injection-BVNa4MQW.js");
3186
+ const { injectPromptTimeMemory } = await import("./injection-CPUIqNhI.js");
3066
3187
  const result = await injectPromptTimeMemory({
3067
3188
  prompt,
3068
3189
  identity,
@@ -3096,7 +3217,7 @@ async function injectPiConversationMemory(opts, prompt) {
3096
3217
  agentRole: "work",
3097
3218
  agentHarness: "ohmypi"
3098
3219
  };
3099
- const { injectPromptTimeMemory } = await import("./injection-BVNa4MQW.js");
3220
+ const { injectPromptTimeMemory } = await import("./injection-CPUIqNhI.js");
3100
3221
  const result = await injectPromptTimeMemory({
3101
3222
  prompt,
3102
3223
  identity,
@@ -3157,6 +3278,7 @@ async function getAgentRuntimeBaseCommand(model, agentName, agentDefinition, har
3157
3278
  const behavior = getHarnessBehavior(harness);
3158
3279
  if (behavior.launchCommandKind === "ohmypi-rpc") return `omp --mode rpc --model ${quotedModel}`;
3159
3280
  if (behavior.launchCommandKind === "codex-work-tui") return `codex`;
3281
+ if (behavior.launchCommandKind === "acp-host") return "acp-host";
3160
3282
  if (process.env.OVERDECK_TEST_HARNESS_COMMAND) return process.env.OVERDECK_TEST_HARNESS_COMMAND;
3161
3283
  const provider = getProviderForModelSync(validatedModel);
3162
3284
  const nameFlag = agentName ? ` --name ${agentName}` : "";
@@ -3254,6 +3376,7 @@ async function getRoleRuntimeBaseCommand(model, agentName, role, harness = "clau
3254
3376
  return `omp --mode rpc --model ${quotedModel}`;
3255
3377
  }
3256
3378
  if (behavior.launchCommandKind === "codex-work-tui") return `codex`;
3379
+ if (behavior.launchCommandKind === "acp-host") return "acp-host";
3257
3380
  if (process.env.OVERDECK_TEST_HARNESS_COMMAND) return process.env.OVERDECK_TEST_HARNESS_COMMAND;
3258
3381
  const provider = getProviderForModelSync(validatedModel);
3259
3382
  const requestedDefinitionPath = roleAgentDefinitionPath(role, subRole);
@@ -3278,6 +3401,7 @@ var init_runtime_command = __esmMin((() => {
3278
3401
  init_briefing_freshness();
3279
3402
  init_claude_auth();
3280
3403
  init_layers();
3404
+ init_context();
3281
3405
  init_behavior();
3282
3406
  init_codex();
3283
3407
  init_ohmypi_fifo();
@@ -3517,7 +3641,7 @@ function resolveSlotTierSpawnParams(baseWorkspace, slotItemId, explicitModel, sp
3517
3641
  /**
3518
3642
  * Tiered-execution model resolution for the single work-agent path.
3519
3643
  * Auto-start and non-swarm issues still run one foreground work agent, but
3520
- * the first dispatchable vBRIEF item is the same scheduling unit the agent is
3644
+ * the first dispatchable xBRIEF item is the same scheduling unit the agent is
3521
3645
  * about to execute. If tiered execution is enabled for the issue, route that
3522
3646
  * agent through the item's resolved tier; otherwise leave role-default model
3523
3647
  * resolution untouched.
@@ -3620,20 +3744,25 @@ async function transitionIssueToInReview(issueId, workspacePath) {
3620
3744
  async function buildAgentLaunchConfig(opts) {
3621
3745
  const model = requireModelOverrideSync(opts.model);
3622
3746
  try {
3623
- const { injectOverdeckInfraDeny } = await import("./claude-settings-overlay-DHBwjS1X.js");
3747
+ const { injectOverdeckInfraDeny } = await import("./claude-settings-overlay-DWy-Bb4Y.js");
3624
3748
  await Effect.runPromise(injectOverdeckInfraDeny(opts.workspace));
3625
3749
  } catch (err) {
3626
3750
  console.warn(`[agents] injectOverdeckInfraDeny failed for ${opts.agentId} (non-fatal): ${err instanceof Error ? err.message : err}`);
3627
3751
  }
3628
- const providerEnv = await getProviderEnvForModel(model);
3629
- const provider = getProviderForModelSync(model);
3630
- if (provider.authType === "credential-file") setupCredentialFileAuthSync(provider, opts.workspace);
3631
- else clearCredentialFileAuthSync(opts.workspace);
3632
- const providerExports = await getProviderExportsForModel(model);
3633
- const launchRole = opts.isPlanning ? "plan" : opts.role;
3634
3752
  const behavior = getHarnessBehavior(opts.harness);
3753
+ const isAcp = behavior.launchCommandKind === "acp-host";
3754
+ const providerEnv = isAcp ? {} : await getProviderEnvForModel(model);
3755
+ if (!isAcp) {
3756
+ const provider = getProviderForModelSync(model);
3757
+ if (provider.authType === "credential-file") setupCredentialFileAuthSync(provider, opts.workspace);
3758
+ else clearCredentialFileAuthSync(opts.workspace);
3759
+ }
3760
+ const providerExports = isAcp ? void 0 : await getProviderExportsForModel(model);
3761
+ const launchRole = opts.isPlanning ? "plan" : opts.role;
3635
3762
  const piLauncherFields = behavior.usesRpcFifo ? await getOhmypiLauncherFields(opts.agentId, model) : {};
3636
3763
  const codexLauncherFields = behavior.usesCodexHome ? getCodexLauncherFields(opts.agentId, model, opts.workspace, launchRole) : {};
3764
+ if (isAcp && !opts.harnessBinaryPath) throw new Error("ACP launch requires the executable path resolved by preflight");
3765
+ const acpLauncherFields = isAcp ? getAcpLauncherFields(opts.agentId, model, opts.workspace, opts.harnessBinaryPath, launchRole) : {};
3637
3766
  if (opts.spawnMode === "resume" && opts.resumeSessionId) return {
3638
3767
  launcherContent: generateLauncherScriptSync({
3639
3768
  role: launchRole,
@@ -3644,7 +3773,7 @@ async function buildAgentLaunchConfig(opts) {
3644
3773
  providerExports,
3645
3774
  baseCommand: behavior.launchCommandKind !== "claude-code" ? await getAgentRuntimeBaseCommand(model, opts.agentId, launchRole, opts.harness) : `claude ${getClaudePermissionFlagsStringSync()}${roleSystemPromptInjectionSync(roleAgentDefinitionPath(launchRole))}`,
3646
3775
  resumeSessionId: opts.resumeSessionId,
3647
- model: behavior.launchCommandKind !== "claude-code" || providerExports.includes("ANTHROPIC_BASE_URL") ? model : void 0,
3776
+ model: behavior.launchCommandKind !== "claude-code" || providerExports?.includes("ANTHROPIC_BASE_URL") ? model : void 0,
3648
3777
  extraArgs: behavior.launchCommandKind !== "claude-code" ? void 0 : `--name ${opts.agentId}`,
3649
3778
  appendSystemPromptFiles: await claudeSystemPromptFiles(opts.workspace, opts.harness),
3650
3779
  extraEnvExports: opts.extraEnvExports,
@@ -3652,7 +3781,8 @@ async function buildAgentLaunchConfig(opts) {
3652
3781
  supervisorScriptPath: opts.supervisorScriptPath,
3653
3782
  promptInline: opts.promptInline,
3654
3783
  ...piLauncherFields,
3655
- ...codexLauncherFields
3784
+ ...codexLauncherFields,
3785
+ ...acpLauncherFields
3656
3786
  }),
3657
3787
  providerEnv
3658
3788
  };
@@ -3676,6 +3806,7 @@ async function buildAgentLaunchConfig(opts) {
3676
3806
  promptInline: opts.promptInline,
3677
3807
  ...piLauncherFields,
3678
3808
  ...codexLauncherFields,
3809
+ ...acpLauncherFields,
3679
3810
  ...opts.channelsBridgeMcpConfig ? {
3680
3811
  channelsBridgeMcpConfig: opts.channelsBridgeMcpConfig,
3681
3812
  channelsBridgeServerName: opts.channelsBridgeServerName ?? "overdeck-bridge"
@@ -3701,7 +3832,7 @@ async function retrieveSpawnTimeMemoryContext(input) {
3701
3832
  agentRole: input.role,
3702
3833
  agentHarness: input.harness
3703
3834
  };
3704
- const { injectPromptTimeMemory } = await import("./injection-BVNa4MQW.js");
3835
+ const { injectPromptTimeMemory } = await import("./injection-CPUIqNhI.js");
3705
3836
  return (await injectPromptTimeMemory({
3706
3837
  prompt: input.prompt,
3707
3838
  identity,
@@ -3792,7 +3923,7 @@ async function assertWorkspaceStackHealthyForSpawn(issueId, role, allowHost = fa
3792
3923
  record.attempts += 1;
3793
3924
  spawnStackRebuildState.set(normalizedIssue, record);
3794
3925
  console.log(`[agents] Workspace stack for ${normalizedIssue} unhealthy (${details}) — rebuilding before spawn (attempt ${record.attempts}/${SPAWN_STACK_REBUILD_MAX_ATTEMPTS})`);
3795
- const { rebuildWorkspaceStack } = await import("./rebuild-stack-CKjJAI8L.js");
3926
+ const { rebuildWorkspaceStack } = await import("./rebuild-stack-CFvcBHsS.js");
3796
3927
  const result = await Effect.runPromise(rebuildWorkspaceStack(issueId, { onProgress: (m) => console.log(`[agents] ${normalizedIssue} stack rebuild: ${m}`) })).catch((err) => ({
3797
3928
  success: false,
3798
3929
  error: err instanceof Error ? err.message : String(err)
@@ -4179,22 +4310,27 @@ async function appendChannelDeliveryLog(agentId, entry) {
4179
4310
  await (await import("fs/promises")).appendFile(join$1(dir, `bridge-${agentId}.log`), `${line}\n`, "utf-8");
4180
4311
  } catch {}
4181
4312
  }
4182
- function readAppServerTokenSync(agentId) {
4313
+ function readSocketTokenSync(agentId, filename) {
4183
4314
  try {
4184
- const tokenPath = join$1(overdeckHomeForSockets(), "agents", agentId, "appserver-token");
4315
+ const tokenPath = join$1(overdeckHomeForSockets(), "agents", agentId, filename);
4185
4316
  if (!existsSync(tokenPath)) return null;
4186
4317
  return readFileSync(tokenPath, "utf-8").trim() || null;
4187
4318
  } catch {
4188
4319
  return null;
4189
4320
  }
4190
4321
  }
4322
+ function readAppServerTokenSync(agentId) {
4323
+ return readSocketTokenSync(agentId, "appserver-token");
4324
+ }
4325
+ function readAcpTokenSync(agentId) {
4326
+ return readSocketTokenSync(agentId, "acp-token");
4327
+ }
4191
4328
  /**
4192
4329
  * POST a JSON body to a Unix-domain socket using node:net + a hand-rolled
4193
4330
  * minimal HTTP/1.1 request. Resolves on a 200-class response, rejects on any
4194
- * error including socket-not-found, connection refused, write timeout, or
4195
- * non-2xx status. Kept tiny on purpose: this is a hot path, only one caller,
4196
- * and the whole point of a fallback to tmux is that we do not need a robust
4197
- * HTTP client here.
4331
+ * error including socket-not-found, connection refused, an optional client
4332
+ * timeout, or non-2xx status. Kept tiny on purpose because this is a hot path
4333
+ * and these local protocol hosts need only a narrow HTTP client.
4198
4334
  */
4199
4335
  async function postUnixSocketJson(socketPath, body, timeoutMs, token, tokenHeader = BRIDGE_TOKEN_HEADER) {
4200
4336
  const payload = JSON.stringify(body);
@@ -4245,10 +4381,12 @@ async function postUnixSocketJson(socketPath, body, timeoutMs, token, tokenHeade
4245
4381
  finishErr(/* @__PURE__ */ new Error(`socket POST: status ${status}: ${responseBody.slice(0, 100)}`));
4246
4382
  });
4247
4383
  });
4248
- timeout = setTimeout(() => {
4249
- req.destroy(/* @__PURE__ */ new Error("socket POST timeout"));
4250
- }, timeoutMs);
4251
- timeout.unref?.();
4384
+ if (timeoutMs !== void 0) {
4385
+ timeout = setTimeout(() => {
4386
+ req.destroy(/* @__PURE__ */ new Error("socket POST timeout"));
4387
+ }, timeoutMs);
4388
+ timeout.unref?.();
4389
+ }
4252
4390
  req.on("error", (err) => {
4253
4391
  finishErr(err);
4254
4392
  });
@@ -4258,8 +4396,9 @@ async function postUnixSocketJson(socketPath, body, timeoutMs, token, tokenHeade
4258
4396
  }
4259
4397
  /**
4260
4398
  * Single delivery primitive for orchestrator-to-work-agent messages. Auto mode
4261
- * tries the PTY supervisor socket, then legacy Channels MCP, then tmux. Explicit
4262
- * socket methods are strict and throw instead of falling back.
4399
+ * tries persistent protocol hosts, the PTY supervisor socket, legacy Channels
4400
+ * MCP, then tmux. Explicit socket methods and ACP targets are strict: ACP prompts
4401
+ * cannot fall back to terminal injection because only session/prompt reaches the agent.
4263
4402
  */
4264
4403
  async function deliverAgentMessage(agentId, message, caller = "unknown", deliveryMethod) {
4265
4404
  const normalizedId = normalizeAgentId(agentId);
@@ -4273,6 +4412,8 @@ async function deliverAgentMessage(agentId, message, caller = "unknown", deliver
4273
4412
  } catch {
4274
4413
  resolvedMethod ??= "auto";
4275
4414
  }
4415
+ const isAcpTarget = state?.harness === "acp";
4416
+ if (isAcpTarget && resolvedMethod !== "auto") throw new Error(`MessageDeliveryFailed: ACP delivery failed for ${normalizedId} (${caller}): ACP requires authenticated host RPC delivery`);
4276
4417
  if (resolvedMethod === "tmux") {
4277
4418
  await assertTmuxTargetCanReceive(normalizedId, caller);
4278
4419
  await Effect.runPromise(sendKeys(normalizedId, message));
@@ -4282,7 +4423,7 @@ async function deliverAgentMessage(agentId, message, caller = "unknown", deliver
4282
4423
  };
4283
4424
  }
4284
4425
  let appServerFailure;
4285
- if (resolvedMethod === "auto") {
4426
+ if (resolvedMethod === "auto" && !isAcpTarget) {
4286
4427
  const appServerSocketPath = join$1(overdeckHomeForSockets(), "sockets", `appserver-${normalizedId}.sock`);
4287
4428
  if (existsSync(appServerSocketPath)) {
4288
4429
  const appServerToken = readAppServerTokenSync(normalizedId);
@@ -4308,6 +4449,39 @@ async function deliverAgentMessage(agentId, message, caller = "unknown", deliver
4308
4449
  }
4309
4450
  }
4310
4451
  }
4452
+ let acpFailure;
4453
+ if (resolvedMethod === "auto") {
4454
+ const acpSocketPath = join$1(overdeckHomeForSockets(), "sockets", `acp-${normalizedId}.sock`);
4455
+ const acpSocketExists = existsSync(acpSocketPath);
4456
+ if (isAcpTarget || acpSocketExists) {
4457
+ const acpToken = readAcpTokenSync(normalizedId);
4458
+ if (!acpSocketExists) acpFailure = "socket-missing";
4459
+ else if (!acpToken) acpFailure = "acp-token-missing";
4460
+ else try {
4461
+ await postUnixSocketJson(acpSocketPath, {
4462
+ op: "message",
4463
+ content: message,
4464
+ meta: { caller }
4465
+ }, 8e3, acpToken);
4466
+ await appendChannelDeliveryLog(normalizedId, {
4467
+ path: "acp",
4468
+ caller
4469
+ });
4470
+ return {
4471
+ ok: true,
4472
+ path: "acp"
4473
+ };
4474
+ } catch (err) {
4475
+ acpFailure = `socket-post-failed: ${err instanceof Error ? err.message : String(err)}`;
4476
+ }
4477
+ await appendChannelDeliveryLog(normalizedId, {
4478
+ path: "acp",
4479
+ reason: acpFailure,
4480
+ caller
4481
+ });
4482
+ throw new Error(`MessageDeliveryFailed: ACP delivery failed for ${normalizedId} (${caller}): ${acpFailure}`);
4483
+ }
4484
+ }
4311
4485
  let supervisorFailure;
4312
4486
  if (resolvedMethod === "auto" || resolvedMethod === "supervisor") {
4313
4487
  const supervisorSocketPath = join$1(overdeckHomeForSockets(), "sockets", `pty-${normalizedId}.sock`);
@@ -4364,6 +4538,7 @@ async function deliverAgentMessage(agentId, message, caller = "unknown", deliver
4364
4538
  reason: channelFailure,
4365
4539
  caller,
4366
4540
  ...appServerFailure ? { appServer: appServerFailure } : {},
4541
+ ...acpFailure ? { acp: acpFailure } : {},
4367
4542
  ...supervisorFailure ? { "pty-supervisor": supervisorFailure } : {},
4368
4543
  ...channelFailure ? { channels: channelFailure } : {}
4369
4544
  });
@@ -4896,6 +5071,12 @@ function stopAgentSync(agentId) {
4896
5071
  killSessionSync(normalizedId);
4897
5072
  }
4898
5073
  killLauncherProcessSync(normalizedId);
5074
+ try {
5075
+ rmSync(join$1(AGENTS_DIR, normalizedId, "git-guard"), {
5076
+ recursive: true,
5077
+ force: true
5078
+ });
5079
+ } catch {}
4899
5080
  const state = getAgentStateSync(normalizedId);
4900
5081
  if (state) {
4901
5082
  if (!state.id) state.id = normalizedId;
@@ -4950,6 +5131,14 @@ var init_termination = __esmMin((() => {
4950
5131
  throw cause;
4951
5132
  }
4952
5133
  }).pipe(Effect.catch(() => Effect.void));
5134
+ yield* Effect.promise(async () => {
5135
+ try {
5136
+ await rm$1(join$1(AGENTS_DIR, normalizedId, "git-guard"), {
5137
+ recursive: true,
5138
+ force: true
5139
+ });
5140
+ } catch {}
5141
+ });
4953
5142
  const state = yield* getAgentState(normalizedId);
4954
5143
  if (state) {
4955
5144
  if (!state.id) state.id = normalizedId;
@@ -5035,18 +5224,18 @@ async function spawnRun(issueId, role, options = {}) {
5035
5224
  let reapWarmIdle = false;
5036
5225
  const advancing = role === "review" || role === "test" || role === "ship";
5037
5226
  try {
5038
- const { isPaneDead } = await import("./tmux-BAvtac_u.js");
5227
+ const { isPaneDead } = await import("./tmux-B6z7h_vZ.js");
5039
5228
  if (await Effect.runPromise(isPaneDead(agentId))) reapWarmIdle = true;
5040
5229
  else if (advancing) {
5041
- const { getReviewStatusSync } = await import("./review-status-Bnh-rdkY.js");
5042
- const { isRoleTerminal } = await import("./reap-terminal-sessions-CaMkFOIH.js");
5230
+ const { getReviewStatusSync } = await import("./review-status-btEYlaxA.js");
5231
+ const { isRoleTerminal } = await import("./reap-terminal-sessions-7KeHv1R1.js");
5043
5232
  const status = getReviewStatusSync(issueId);
5044
5233
  reapWarmIdle = !!status && isRoleTerminal(role, status);
5045
5234
  }
5046
5235
  } catch {}
5047
5236
  if (!reapWarmIdle) throw new Error(`Role run ${agentId} already running. Use 'pan tell' to message it.`);
5048
5237
  console.log(`[spawn] ${agentId} is warm-idle from the previous cycle — reaping it for the new ${role} dispatch (PAN-2579)`);
5049
- const { killSession } = await import("./tmux-BAvtac_u.js");
5238
+ const { killSession } = await import("./tmux-B6z7h_vZ.js");
5050
5239
  await Effect.runPromise(killSession(agentId)).catch(() => {});
5051
5240
  }
5052
5241
  await assertWorkspaceStackHealthyForSpawn(issueId, role, options.allowHost, workspace);
@@ -5056,11 +5245,12 @@ async function spawnRun(issueId, role, options = {}) {
5056
5245
  role,
5057
5246
  model: selectedModel
5058
5247
  });
5248
+ const isAcp = getHarnessBehavior(resolvedHarness).launchCommandKind === "acp-host";
5059
5249
  const harnessLaunch = await prepareHarnessLaunch(resolvedHarness);
5060
5250
  assertCodexNativeAuthForSpawn(resolvedHarness, listAgentStates());
5061
5251
  await ensureLifecycleHooksBeforeLaunch(agentId, resolvedHarness);
5062
5252
  if (getProviderForModelSync(selectedModel).name === "openai" && await getProviderAuthMode(selectedModel) === "subscription") {
5063
- const { isCliproxyRunning } = await import("./cliproxy-bONZDBbC.js");
5253
+ const { isCliproxyRunning } = await import("./cliproxy-fHfIeiGd.js");
5064
5254
  if (!await Effect.runPromise(isCliproxyRunning())) throw new Error("CLIProxyAPI sidecar is not running. GPT subscription role runs route through a local cliproxy process managed by `pan up`. Run `pan up` (or restart the dashboard) before spawning a GPT role run.");
5065
5255
  }
5066
5256
  const state = {
@@ -5073,7 +5263,7 @@ async function spawnRun(issueId, role, options = {}) {
5073
5263
  modelSpawnKey,
5074
5264
  status: "starting",
5075
5265
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5076
- costSoFar: 0,
5266
+ ...resolvedHarness === "codex" ? {} : { costSoFar: 0 },
5077
5267
  hostOverride: options.allowHost || void 0,
5078
5268
  slotIndex: options.slotIndex,
5079
5269
  slotItemId: options.slotItemId
@@ -5083,6 +5273,7 @@ async function spawnRun(issueId, role, options = {}) {
5083
5273
  const shouldDeliverPromptViaTmux = shouldRegisterConversation && resolvedHarness === "claude-code";
5084
5274
  const shouldDeliverPromptViaPi = shouldRegisterConversation && resolvedHarness === "ohmypi";
5085
5275
  const shouldDeliverPromptViaCodexTui = shouldRegisterConversation && resolvedHarness === "codex";
5276
+ const shouldDeliverPromptViaAcp = resolvedHarness === "acp";
5086
5277
  const prompt = options.prompt ? await withSpawnTimeMemoryContext({
5087
5278
  prompt: options.prompt,
5088
5279
  issueId,
@@ -5093,26 +5284,29 @@ async function spawnRun(issueId, role, options = {}) {
5093
5284
  }) : "";
5094
5285
  let promptFile;
5095
5286
  const tracksKickoffDelivery = role === "flywheel";
5096
- if (prompt && (tracksKickoffDelivery || !shouldDeliverPromptViaTmux && !shouldDeliverPromptViaPi && !shouldDeliverPromptViaCodexTui)) {
5287
+ if (prompt && !shouldDeliverPromptViaAcp && (tracksKickoffDelivery || !shouldDeliverPromptViaTmux && !shouldDeliverPromptViaPi && !shouldDeliverPromptViaCodexTui)) {
5097
5288
  promptFile = join$1(getAgentDir(agentId), "initial-prompt.md");
5098
5289
  await writeFile$1(promptFile, prompt);
5099
- if (tracksKickoffDelivery) {
5100
- state.kickoffDelivered = false;
5101
- await Effect.runPromise(saveAgentState(state));
5102
- }
5103
5290
  }
5104
- const provider = getProviderForModelSync(selectedModel);
5105
- if (provider.authType === "credential-file") setupCredentialFileAuthSync(provider, workspace);
5106
- else clearCredentialFileAuthSync(workspace);
5107
- const providerExports = await getProviderExportsForModel(selectedModel);
5108
- const providerEnv = await getProviderEnvForModel(selectedModel);
5291
+ if (prompt && tracksKickoffDelivery) {
5292
+ state.kickoffDelivered = false;
5293
+ await Effect.runPromise(saveAgentState(state));
5294
+ }
5295
+ if (!isAcp) {
5296
+ const provider = getProviderForModelSync(selectedModel);
5297
+ if (provider.authType === "credential-file") setupCredentialFileAuthSync(provider, workspace);
5298
+ else clearCredentialFileAuthSync(workspace);
5299
+ }
5300
+ const providerExports = isAcp ? void 0 : await getProviderExportsForModel(selectedModel);
5301
+ const providerEnv = isAcp ? {} : await getProviderEnvForModel(selectedModel);
5109
5302
  const piLauncherFields = resolvedHarness === "ohmypi" ? await getOhmypiLauncherFields(agentId, selectedModel) : {};
5110
5303
  const codexLauncherFields = resolvedHarness === "codex" ? getCodexLauncherFields(agentId, selectedModel, workspace, role) : {};
5304
+ const acpLauncherFields = isAcp ? getAcpLauncherFields(agentId, selectedModel, workspace, harnessLaunch.binaryPath, role) : {};
5111
5305
  let sessionId;
5112
5306
  let rawSessionId;
5113
5307
  if (shouldRegisterConversation) {
5114
- rawSessionId = options.resumeSessionId ?? randomUUID();
5115
- try {
5308
+ rawSessionId = isAcp ? options.resumeSessionId : options.resumeSessionId ?? randomUUID();
5309
+ if (!isAcp && rawSessionId) try {
5116
5310
  const agentDir = getAgentDir(agentId);
5117
5311
  await mkdir$1(agentDir, { recursive: true });
5118
5312
  await writeFile$1(join$1(agentDir, "session.id"), rawSessionId, "utf-8");
@@ -5165,14 +5359,15 @@ async function spawnRun(issueId, role, options = {}) {
5165
5359
  reviewSignal: void 0,
5166
5360
  trapHup: void 0,
5167
5361
  ...piLauncherFields,
5168
- ...codexLauncherFields
5362
+ ...codexLauncherFields,
5363
+ ...acpLauncherFields
5169
5364
  });
5170
5365
  const launcherScript = join$1(getAgentDir(agentId), "launcher.sh");
5171
5366
  await writeLauncherScriptAtomic(launcherScript, launcherContent);
5172
5367
  const claudeCmd = `bash ${launcherScript}`;
5173
5368
  console.log(`[claude-invoke] purpose=role-run | role=${role} | model=${state.model} | source=agents.ts:spawnRun | session=${agentId} | command="${claudeCmd}"`);
5174
5369
  try {
5175
- const { preTrustDirectory } = await import("./workspace-manager-B1WOfKvB.js");
5370
+ const { preTrustDirectory } = await import("./workspace-manager-CWT55qeI.js");
5176
5371
  preTrustDirectory(workspace);
5177
5372
  } catch {}
5178
5373
  clearReadySignal(agentId);
@@ -5197,7 +5392,22 @@ async function spawnRun(issueId, role, options = {}) {
5197
5392
  await Effect.runPromise(setOption(agentId, "destroy-unattached", "off"));
5198
5393
  await Effect.runPromise(setOption(exactPaneTarget(agentId), "remain-on-exit", "on"));
5199
5394
  if (prompt) {
5200
- if (shouldDeliverPromptViaPi) try {
5395
+ if (shouldDeliverPromptViaAcp) try {
5396
+ await waitForPromptReady(agentId, resolvedHarness, 30);
5397
+ const delivery = await deliverAgentMessage(agentId, prompt, "spawnRun:initial-prompt");
5398
+ if (!delivery.ok) throw new Error(delivery.failure ?? `ACP delivery returned ok=false via ${delivery.path}`);
5399
+ if (tracksKickoffDelivery) {
5400
+ state.kickoffDelivered = true;
5401
+ await Effect.runPromise(saveAgentState(state));
5402
+ }
5403
+ } catch (err) {
5404
+ const message = err instanceof Error ? err.message : String(err);
5405
+ console.error(`[${agentId}] ACP prompt delivery failed:`, message);
5406
+ if (tracksKickoffDelivery) await recordKickoffDeliveryFailure(state, issueId, role);
5407
+ await Effect.runPromise(stopAgent(agentId));
5408
+ throw new Error(`Agent ${agentId} kickoff delivery failed: ${message}`);
5409
+ }
5410
+ else if (shouldDeliverPromptViaPi) try {
5201
5411
  await writeOhmypiAgentPrompt(agentId, prompt);
5202
5412
  if (tracksKickoffDelivery) {
5203
5413
  state.kickoffDelivered = true;
@@ -5242,7 +5452,7 @@ async function spawnAgent(options) {
5242
5452
  if (await Effect.runPromise(sessionExists(agentId))) throw new Error(`Agent ${agentId} already running. Use 'pan tell' to message it.`);
5243
5453
  await assertWorkspaceStackHealthyForSpawn(options.issueId, role, options.allowHost, options.workspace);
5244
5454
  initHookSync(agentId);
5245
- if (role !== "strike" && role !== "knowledge" && options.slotItemId === void 0 && !readWorkspacePlanSync(options.workspace)) throw new Error(`The required vBRIEF checklist for ${options.issueId} is missing or unreadable. Run planning before spawning a work agent.`);
5455
+ if (role !== "strike" && role !== "knowledge" && options.slotItemId === void 0 && !readWorkspacePlanSync(options.workspace)) throw new Error(`The required xBRIEF checklist for ${options.issueId} is missing or unreadable. Run planning before spawning a work agent.`);
5246
5456
  const modelSpawnKey = `${role}:${options.issueId}`;
5247
5457
  const singleTierParams = role === "work" && options.slotItemId === void 0 && options.slotIndex === void 0 ? resolveSingleWorkTierSpawnParams(options.workspace, options.model, modelSpawnKey) : {};
5248
5458
  const selectedModel = determineModel({
@@ -5252,7 +5462,7 @@ async function spawnAgent(options) {
5252
5462
  });
5253
5463
  console.log(`[DEBUG] Selected model: ${selectedModel}`);
5254
5464
  if (getProviderForModelSync(selectedModel).name === "openai" && await getProviderAuthMode(selectedModel) === "subscription") {
5255
- const { isCliproxyRunning } = await import("./cliproxy-bONZDBbC.js");
5465
+ const { isCliproxyRunning } = await import("./cliproxy-fHfIeiGd.js");
5256
5466
  if (!await Effect.runPromise(isCliproxyRunning())) throw new Error("CLIProxyAPI sidecar is not running. GPT subscription agents route through a local cliproxy process managed by `pan up`. Run `pan up` (or restart the dashboard) before spawning a GPT agent.");
5257
5467
  }
5258
5468
  const resolvedHarness = await resolveHarness({
@@ -5260,6 +5470,7 @@ async function spawnAgent(options) {
5260
5470
  role,
5261
5471
  model: selectedModel
5262
5472
  });
5473
+ const isAcp = getHarnessBehavior(resolvedHarness).launchCommandKind === "acp-host";
5263
5474
  const harnessLaunch = await prepareHarnessLaunch(resolvedHarness);
5264
5475
  assertCodexNativeAuthForSpawn(resolvedHarness, listAgentStates());
5265
5476
  await ensureLifecycleHooksBeforeLaunch(agentId, resolvedHarness);
@@ -5273,7 +5484,7 @@ async function spawnAgent(options) {
5273
5484
  modelSpawnKey,
5274
5485
  status: "starting",
5275
5486
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5276
- costSoFar: 0,
5487
+ ...resolvedHarness === "codex" ? {} : { costSoFar: 0 },
5277
5488
  hostOverride: options.allowHost || void 0,
5278
5489
  sessionId: createFreshSessionIdentity(agentId, resolvedHarness)
5279
5490
  };
@@ -5282,7 +5493,7 @@ async function spawnAgent(options) {
5282
5493
  if (role === "work") {
5283
5494
  try {
5284
5495
  if (resetPipelineVerdictsForWorkStartSync(options.issueId)) {
5285
- const { resetPostMergeState } = await import("./merge-agent-B-SnXOoc.js");
5496
+ const { resetPostMergeState } = await import("./merge-agent-CKkgIBPB.js");
5286
5497
  resetPostMergeState(options.issueId);
5287
5498
  }
5288
5499
  } catch (err) {
@@ -5293,7 +5504,7 @@ async function spawnAgent(options) {
5293
5504
  });
5294
5505
  }
5295
5506
  if (role === "work") try {
5296
- const { writeStoryFeatureContext } = await import("./work-agent-prompt-DLthEPAq.js");
5507
+ const { writeStoryFeatureContext } = await import("./work-agent-prompt-Du8Vh2aJ.js");
5297
5508
  await writeStoryFeatureContext(options.workspace, options.issueId);
5298
5509
  } catch (ctxErr) {
5299
5510
  console.warn(`[agents] Could not write story feature context for ${options.issueId}: ${ctxErr.message}`);
@@ -5332,17 +5543,15 @@ async function spawnAgent(options) {
5332
5543
  });
5333
5544
  const promptFile = join$1(getAgentDir(agentId), "initial-prompt.md");
5334
5545
  const tracksKickoffDelivery = role === "work" || role === "strike";
5335
- if (prompt) {
5336
- await writeFile$1(promptFile, prompt);
5337
- if (tracksKickoffDelivery) {
5338
- state.kickoffDelivered = false;
5339
- saveAgentStateSync(state);
5340
- }
5546
+ if (prompt && !isAcp) await writeFile$1(promptFile, prompt);
5547
+ if (prompt && tracksKickoffDelivery) {
5548
+ state.kickoffDelivered = false;
5549
+ saveAgentStateSync(state);
5341
5550
  }
5342
5551
  try {
5343
5552
  const venvPath = join$1(options.workspace, ".venv");
5344
5553
  if (isTldrEnabledSync() && existsSync(venvPath)) {
5345
- const { getTldrDaemonServiceSync } = await import("./tldr-daemon-B8_oT5gx.js");
5554
+ const { getTldrDaemonServiceSync } = await import("./tldr-daemon-BYFkts95.js");
5346
5555
  const tldrService = getTldrDaemonServiceSync(options.workspace, venvPath);
5347
5556
  if (!(await tldrService.getStatus()).running) {
5348
5557
  await tldrService.start(true);
@@ -5372,6 +5581,7 @@ async function spawnAgent(options) {
5372
5581
  useSupervisor: supervisorLaunch.useSupervisor,
5373
5582
  supervisorScriptPath: supervisorLaunch.supervisorScriptPath,
5374
5583
  harness: state.harness ?? "claude-code",
5584
+ harnessBinaryPath: harnessLaunch.binaryPath,
5375
5585
  sessionId: state.sessionId,
5376
5586
  extraEnvExports: [harnessLaunch.pathExport, ...flywheelEnvExports(flywheelEnv)],
5377
5587
  effort: options.effort
@@ -5382,13 +5592,13 @@ async function spawnAgent(options) {
5382
5592
  const claudeCmd = `bash ${launcherScript}`;
5383
5593
  console.log(`[claude-invoke] purpose=work-agent | model=${state.model} | source=agents.ts:spawnAgent | session=${agentId} | command="${claudeCmd}"`);
5384
5594
  try {
5385
- const { preTrustDirectory } = await import("./workspace-manager-B1WOfKvB.js");
5595
+ const { preTrustDirectory } = await import("./workspace-manager-CWT55qeI.js");
5386
5596
  preTrustDirectory(options.workspace);
5387
5597
  } catch {}
5388
5598
  try {
5389
- const { isGitHubAppConfigured, generateInstallationToken, configureWorkspaceForBot } = await import("./github-app-CU14oYzP.js");
5599
+ const { isGitHubAppConfigured, generateInstallationToken, configureWorkspaceForBot } = await import("./github-app-ClZ2lk8D.js");
5390
5600
  if (isGitHubAppConfigured()) {
5391
- const { findProjectByPathSync } = await import("./projects-BKkwpH6q.js");
5601
+ const { findProjectByPathSync } = await import("./projects-vjjcmiN8.js");
5392
5602
  const ghRepo = findProjectByPathSync(resolve$1(options.workspace, "..", ".."))?.github_repo;
5393
5603
  if (ghRepo) {
5394
5604
  const [owner, repo] = ghRepo.split("/");
@@ -5418,7 +5628,22 @@ async function spawnAgent(options) {
5418
5628
  sessionHarness: resolvedHarness
5419
5629
  });
5420
5630
  const dismissChannelsDialogPromise = channelsBridgeMcpConfig ? dismissDevChannelsDialog(agentId).catch(() => void 0) : null;
5421
- if (prompt && resolvedHarness === "ohmypi") try {
5631
+ if (prompt && isAcp) try {
5632
+ await waitForPromptReady(agentId, resolvedHarness, 30);
5633
+ const delivery = await deliverAgentMessage(agentId, prompt, "spawnAgent:initial-prompt");
5634
+ if (!delivery.ok) throw new Error(delivery.failure ?? `ACP delivery returned ok=false via ${delivery.path}`);
5635
+ if (tracksKickoffDelivery) {
5636
+ state.kickoffDelivered = true;
5637
+ saveAgentStateSync(state);
5638
+ }
5639
+ } catch (err) {
5640
+ const message = err instanceof Error ? err.message : String(err);
5641
+ console.error(`[${agentId}] ACP prompt delivery failed:`, message);
5642
+ if (tracksKickoffDelivery) await recordKickoffDeliveryFailure(state, options.issueId, role);
5643
+ await Effect.runPromise(stopAgent(agentId));
5644
+ throw new Error(`Agent ${agentId} kickoff delivery failed: ${message}`);
5645
+ }
5646
+ else if (prompt && resolvedHarness === "ohmypi") try {
5422
5647
  await writeOhmypiAgentPrompt(agentId, prompt);
5423
5648
  if (tracksKickoffDelivery) {
5424
5649
  state.kickoffDelivered = true;
@@ -5451,7 +5676,7 @@ async function spawnAgent(options) {
5451
5676
  const codexHomeForAgent = join$1(homedir(), ".overdeck", "agents", agentId, "codex-home");
5452
5677
  (async () => {
5453
5678
  try {
5454
- const { waitForCodexRollout, extractThreadIdFromRollout, writeThreadId } = await import("./codex-DNyiQDKW.js");
5679
+ const { waitForCodexRollout, extractThreadIdFromRollout, writeThreadId } = await import("./codex-GcHuUF-k.js");
5455
5680
  const rollout = await waitForCodexRollout(codexHomeForAgent, 12e4);
5456
5681
  if (rollout) {
5457
5682
  const threadId = extractThreadIdFromRollout(rollout);
@@ -5488,7 +5713,7 @@ function assertRegisteredSlotCap(issueId, configuredCap) {
5488
5713
  }
5489
5714
  function buildRegisteredSlotPrompt(issueId, baseWorkspace, slot, extraPrompt) {
5490
5715
  const doc = readWorkspacePlanSync(baseWorkspace);
5491
- if (!doc) throw new Error(`Registered slot spawn for ${issueId} requires a readable vBRIEF plan in ${baseWorkspace}.`);
5716
+ if (!doc) throw new Error(`Registered slot spawn for ${issueId} requires a readable xBRIEF plan in ${baseWorkspace}.`);
5492
5717
  const slice = createActiveSlice(doc, {
5493
5718
  issueId: issueId.toUpperCase(),
5494
5719
  itemId: slot.slotItemId,
@@ -5503,7 +5728,7 @@ function buildRegisteredSlotPrompt(issueId, baseWorkspace, slot, extraPrompt) {
5503
5728
  `Branch: ${slot.branch}`,
5504
5729
  `Workspace: ${slot.workspace}`,
5505
5730
  "",
5506
- "You are a registered slot work agent. Implement only the target vBRIEF item below, keep changes scoped to that item, and do not merge this slot branch yourself.",
5731
+ "You are a registered slot work agent. Implement only the target xBRIEF item below, keep changes scoped to that item, and do not merge this slot branch yourself.",
5507
5732
  "",
5508
5733
  slice.prompt
5509
5734
  ];
@@ -6079,6 +6304,11 @@ function pickFreshestExistingSessionIdSync(agentId, candidates) {
6079
6304
  function getLatestSessionIdSync(agentId) {
6080
6305
  const codexThreadId = resolveCodexThreadIdSync(agentId);
6081
6306
  if (codexThreadId) return codexThreadId;
6307
+ const agentState = getAgentStateSync(agentId);
6308
+ if (agentState?.harness && getHarnessBehavior(agentState.harness).sessionIdSource === "acp-session-id") try {
6309
+ const acpSessionId = readFileSync(join$1(getAgentDir(agentId), "acp-session-id"), "utf-8").trim();
6310
+ if (acpSessionId) return acpSessionId;
6311
+ } catch {}
6082
6312
  const fromSessionFile = getSessionId(agentId);
6083
6313
  if (fromSessionFile) return fromSessionFile;
6084
6314
  const sessionsFile = join$1(getAgentDir(agentId), "sessions.json");
@@ -6100,7 +6330,6 @@ function getLatestSessionIdSync(agentId) {
6100
6330
  if (threadId) return threadId;
6101
6331
  }
6102
6332
  } catch {}
6103
- const agentState = getAgentStateSync(agentId);
6104
6333
  if (agentState?.harness && getHarnessBehavior(agentState.harness).sessionIdSource === "transcript-jsonl") {
6105
6334
  const ohmypiSessionId = resolveLatestOhmypiSessionId(agentId);
6106
6335
  if (ohmypiSessionId) return ohmypiSessionId;
@@ -6181,6 +6410,10 @@ function queueAgentMail(agentId, message, pendingTurnEndDelivery = false) {
6181
6410
  mkdirSync(mailDir, { recursive: true });
6182
6411
  writeFileSync(join$1(mailDir, `${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}${pendingTurnEndDelivery ? ".pending" : ""}.md`), `# Message\n\n${message}\n`);
6183
6412
  }
6413
+ function resolveAgentDeliveryMethod(state) {
6414
+ if (state?.harness === "acp") return "auto";
6415
+ return resilientDeliveryMethod(state?.deliveryMethod);
6416
+ }
6184
6417
  function claimCodexIdleTurn(agentId) {
6185
6418
  try {
6186
6419
  unlinkSync(join$1(getAgentDir(agentId), "turn-completed"));
@@ -6225,7 +6458,11 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6225
6458
  queueAgentMail(normalizedId, message);
6226
6459
  logAgentLifecycleSync(normalizedId, `messageAgent queued mail without resume: ${gateBlockReason}`);
6227
6460
  console.log(`[agents] Queued message for ${normalizedId}; ${gateBlockReason}`);
6228
- return;
6461
+ return {
6462
+ delivered: false,
6463
+ queuedToMail: true,
6464
+ reason: gateBlockReason
6465
+ };
6229
6466
  }
6230
6467
  if (getAgentRuntimeStateSync(normalizedId)?.state === "suspended") {
6231
6468
  const suspendedGate = decideMessageGate();
@@ -6234,15 +6471,22 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6234
6471
  queueAgentMail(normalizedId, message);
6235
6472
  logAgentLifecycleSync(normalizedId, `messageAgent queued mail without resume: ${gateBlockReason}`);
6236
6473
  console.log(`[agents] Queued message for ${normalizedId}; ${gateBlockReason}`);
6237
- return;
6474
+ return {
6475
+ delivered: false,
6476
+ queuedToMail: true,
6477
+ reason: gateBlockReason
6478
+ };
6238
6479
  }
6239
6480
  console.log(`[agents] Auto-resuming suspended agent ${normalizedId} to deliver message`);
6240
- const { resumeAgent } = await import("./agents-DyHKlq1I.js");
6481
+ const { resumeAgent } = await import("./agents-wi9NWzs2.js");
6241
6482
  const result = await resumeAgent(normalizedId, message);
6242
6483
  if (!result.success) throw new Error(`Failed to auto-resume agent: ${result.error}`);
6243
6484
  if (result.messageDelivered === false) throw new Error(`Agent resumed but ready signal did not fire — message not delivered. Feedback is in the mail queue.`);
6244
6485
  await appendTellInterventionForUserSource(normalizedId, caller);
6245
- return;
6486
+ return {
6487
+ delivered: true,
6488
+ queuedToMail: false
6489
+ };
6246
6490
  }
6247
6491
  if (agentState && agentState.status === "stopped") {
6248
6492
  const stoppedGate = decideMessageGate();
@@ -6251,16 +6495,23 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6251
6495
  queueAgentMail(normalizedId, message);
6252
6496
  logAgentLifecycleSync(normalizedId, `messageAgent queued mail without resume: ${gateBlockReason}`);
6253
6497
  console.log(`[agents] Queued message for ${normalizedId}; ${gateBlockReason}`);
6254
- return;
6498
+ return {
6499
+ delivered: false,
6500
+ queuedToMail: true,
6501
+ reason: gateBlockReason
6502
+ };
6255
6503
  }
6256
6504
  console.log(`[agents] Auto-resuming stopped agent ${normalizedId} to deliver feedback (session exists: ${await Effect.runPromise(sessionExists(normalizedId))})`);
6257
- const { resumeAgent } = await import("./agents-DyHKlq1I.js");
6505
+ const { resumeAgent } = await import("./agents-wi9NWzs2.js");
6258
6506
  const resumeResult = await resumeAgent(normalizedId, message);
6259
6507
  queueAgentMail(normalizedId, message);
6260
6508
  if (resumeResult.success && resumeResult.messageDelivered !== false) {
6261
6509
  await appendTellInterventionForUserSource(normalizedId, caller);
6262
6510
  console.log(`[agents] Resumed ${normalizedId} and delivered feedback`);
6263
- return;
6511
+ return {
6512
+ delivered: true,
6513
+ queuedToMail: true
6514
+ };
6264
6515
  }
6265
6516
  if (!resumeResult.success) console.warn(`[agents] Resume failed for ${normalizedId}: ${resumeResult.error} — falling back to fresh launch`);
6266
6517
  else console.warn(`[agents] Resume succeeded for ${normalizedId} but message not delivered (ready signal timed out) — falling back to fresh launch`);
@@ -6273,7 +6524,11 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6273
6524
  message: `${normalizedId}: ${stopMsg}`,
6274
6525
  issueId: agentState.issueId
6275
6526
  });
6276
- return;
6527
+ return {
6528
+ delivered: false,
6529
+ queuedToMail: true,
6530
+ reason: stopMsg
6531
+ };
6277
6532
  }
6278
6533
  const providerEnv = agentState.model ? await getProviderEnvForModel(agentState.model) : {};
6279
6534
  if (agentState.model) {
@@ -6291,7 +6546,7 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6291
6546
  const resumeModel = agentState.model || "claude-sonnet-4-6";
6292
6547
  const fallbackHarness = agentState.harness ?? "claude-code";
6293
6548
  const harnessLaunch = await prepareHarnessLaunch(fallbackHarness);
6294
- const { assertWorkspaceStackHealthyForSpawn } = await import("./agents-DyHKlq1I.js");
6549
+ const { assertWorkspaceStackHealthyForSpawn } = await import("./agents-wi9NWzs2.js");
6295
6550
  await assertWorkspaceStackHealthyForSpawn(agentState.issueId || normalizedId.replace(/^agent-/, "").toUpperCase(), resumeRole, agentState.hostOverride === true, agentState.workspace);
6296
6551
  const fallbackPiFields = fallbackHarness === "ohmypi" ? await getOhmypiLauncherFields(normalizedId, resumeModel) : {};
6297
6552
  const fallbackCodexFields = fallbackHarness === "codex" ? getCodexLauncherFields(normalizedId, resumeModel, agentState.workspace, resumeRole) : {};
@@ -6322,7 +6577,10 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6322
6577
  saveAgentStateSync(agentState);
6323
6578
  const ready = await waitForPromptReady(normalizedId, fallbackHarness, 30);
6324
6579
  const resumeMessage = await buildResumeMessageForAgent(agentState, `You are resuming work on ${agentState.issueId}. Check .pan/feedback/ for specialist feedback that arrived while you were stopped, then continue working.\n\n${message}`, message);
6580
+ let delivered = false;
6581
+ let reason;
6325
6582
  if (resumeMessage.error) {
6583
+ reason = resumeMessage.error;
6326
6584
  console.error(`[agents] Fallback-restarted ${normalizedId} but ${resumeMessage.error}`);
6327
6585
  emitActivityEntrySync({
6328
6586
  source: "work-agent",
@@ -6331,7 +6589,6 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6331
6589
  issueId: agentState.issueId
6332
6590
  });
6333
6591
  } else if (ready && resumeMessage.message) {
6334
- let delivered = false;
6335
6592
  if (fallbackHarness === "claude-code") {
6336
6593
  const fallbackSessionId = getLatestSessionIdSync(normalizedId);
6337
6594
  if (fallbackSessionId) {
@@ -6341,28 +6598,48 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6341
6598
  sessionId: fallbackSessionId,
6342
6599
  message: resumeMessage.message,
6343
6600
  caller: "resumeAgent:resume-prompt",
6344
- deliveryMethod: resilientDeliveryMethod(agentState.deliveryMethod)
6601
+ deliveryMethod: resolveAgentDeliveryMethod(agentState)
6345
6602
  });
6346
6603
  delivered = delivery.delivered;
6347
- if (!delivery.delivered) console.error(`[agents] Fallback resume prompt did not land after ${delivery.attempts} delivery attempts`);
6348
- } else console.error(`[agents] Fallback-restarted ${normalizedId} but no session id was recorded — feedback in mail queue`);
6349
- } else delivered = (await deliverAgentMessage(normalizedId, resumeMessage.message, "resumeAgent:resume-prompt", resilientDeliveryMethod(agentState.deliveryMethod))).ok;
6604
+ if (!delivery.delivered) {
6605
+ reason = `resume prompt did not land after ${delivery.attempts} delivery attempts`;
6606
+ console.error(`[agents] Fallback resume prompt did not land after ${delivery.attempts} delivery attempts`);
6607
+ }
6608
+ } else {
6609
+ reason = "no session id was recorded";
6610
+ console.error(`[agents] Fallback-restarted ${normalizedId} but no session id was recorded — feedback in mail queue`);
6611
+ }
6612
+ } else {
6613
+ const delivery = await deliverAgentMessage(normalizedId, resumeMessage.message, "resumeAgent:resume-prompt", resolveAgentDeliveryMethod(agentState));
6614
+ delivered = delivery.ok;
6615
+ if (!delivery.ok) reason = "resume prompt delivery failed";
6616
+ }
6350
6617
  if (delivered) {
6351
6618
  if (resumeMessage.redeliveringKickoff) markKickoffRedelivered(agentState);
6352
6619
  await appendTellInterventionForUserSource(normalizedId, caller);
6353
6620
  console.log(`[agents] Fallback-restarted ${normalizedId} and delivered feedback`);
6354
6621
  }
6355
- } else console.warn(`[agents] Fallback-restarted ${normalizedId} but ready signal not detected — feedback in mail queue`);
6356
- return;
6622
+ } else {
6623
+ reason = "ready signal not detected";
6624
+ console.warn(`[agents] Fallback-restarted ${normalizedId} but ready signal not detected — feedback in mail queue`);
6625
+ }
6626
+ return {
6627
+ delivered,
6628
+ queuedToMail: true,
6629
+ ...reason ? { reason } : {}
6630
+ };
6357
6631
  }
6358
- const { loadRemoteAgentState, sendToRemoteAgent } = await import("./remote-agents-D6O_zETW.js");
6632
+ const { loadRemoteAgentState, sendToRemoteAgent } = await import("./remote-agents-CA3Ihlxj.js");
6359
6633
  const remoteState = loadRemoteAgentState(normalizedId);
6360
6634
  if (remoteState && remoteState.vmName) {
6361
6635
  console.log(`[agents] Sending message to remote agent ${normalizedId} on ${remoteState.vmName}`);
6362
6636
  await sendToRemoteAgent(normalizedId, remoteState.vmName, message);
6363
6637
  queueAgentMail(normalizedId, message);
6364
6638
  await appendTellInterventionForUserSource(normalizedId, caller);
6365
- return;
6639
+ return {
6640
+ delivered: true,
6641
+ queuedToMail: true
6642
+ };
6366
6643
  }
6367
6644
  const expectedHarness = agentState?.harness ?? "claude-code";
6368
6645
  let appServerState;
@@ -6375,31 +6652,46 @@ async function messageAgent(agentId, message, caller = "internal", opts = {}) {
6375
6652
  logAgentLifecycleSync(normalizedId, "messageAgent queued mail for codex turn-end delivery: agent busy");
6376
6653
  console.log(`[agents] Queued message for ${normalizedId}; codex agent is mid-turn`);
6377
6654
  await appendTellInterventionForUserSource(normalizedId, caller);
6378
- return;
6655
+ return {
6656
+ delivered: true,
6657
+ queuedToMail: true,
6658
+ reason: "queued for turn-end delivery"
6659
+ };
6379
6660
  }
6380
- const deliveryMethod = resilientDeliveryMethod(agentState?.deliveryMethod);
6381
- await deliverAgentMessage(normalizedId, message, `messageAgent:${caller}`, deliveryMethod);
6661
+ const deliveryMethod = resolveAgentDeliveryMethod(agentState);
6662
+ const delivery = await deliverAgentMessage(normalizedId, message, `messageAgent:${caller}`, deliveryMethod);
6382
6663
  queueAgentMail(normalizedId, message);
6383
6664
  await appendTellInterventionForUserSource(normalizedId, caller);
6384
- return;
6665
+ return {
6666
+ delivered: delivery.ok,
6667
+ queuedToMail: true
6668
+ };
6385
6669
  }
6386
6670
  if (!await Effect.runPromise(sessionExists(normalizedId))) throw new Error(`Agent ${normalizedId} not running`);
6387
6671
  const panePids = await Effect.runPromise(listPaneValues(normalizedId, "#{pane_pid}"));
6388
6672
  if (panePids.length > 0 && !await hasAgentRuntimeInSubtree(panePids[0], expectedHarness)) {
6389
6673
  console.warn(`[agents] ${normalizedId} tmux session is a zombie (no ${expectedHarness} runtime) — attempting resume`);
6390
- const { resumeAgent } = await import("./agents-DyHKlq1I.js");
6674
+ const { resumeAgent } = await import("./agents-wi9NWzs2.js");
6391
6675
  const resumeResult = await resumeAgent(normalizedId, message);
6392
6676
  if (resumeResult.success) {
6393
- if (resumeResult.messageDelivered !== false) await appendTellInterventionForUserSource(normalizedId, caller);
6394
- return;
6677
+ const delivered = resumeResult.messageDelivered !== false;
6678
+ if (delivered) await appendTellInterventionForUserSource(normalizedId, caller);
6679
+ return {
6680
+ delivered,
6681
+ queuedToMail: false
6682
+ };
6395
6683
  }
6396
6684
  throw new Error(`Agent ${normalizedId} session is dead and resume failed: ${resumeResult.error}`);
6397
6685
  }
6398
6686
  if (!await waitForAgentIdle(normalizedId, 5e3)) console.warn(`[agents] ${normalizedId} not at idle prompt after 5s — sending message anyway`);
6399
- const deliveryMethod = resilientDeliveryMethod(agentState?.deliveryMethod);
6400
- await deliverAgentMessage(normalizedId, message, `messageAgent:${caller}`, deliveryMethod);
6687
+ const deliveryMethod = resolveAgentDeliveryMethod(agentState);
6688
+ const delivery = await deliverAgentMessage(normalizedId, message, `messageAgent:${caller}`, deliveryMethod);
6401
6689
  queueAgentMail(normalizedId, message);
6402
6690
  await appendTellInterventionForUserSource(normalizedId, caller);
6691
+ return {
6692
+ delivered: delivery.ok,
6693
+ queuedToMail: true
6694
+ };
6403
6695
  }
6404
6696
  var USER_MESSAGE_INTERVENTION_SOURCES;
6405
6697
  var init_messaging = __esmMin((() => {
@@ -6468,6 +6760,54 @@ var init_context_overflow = __esmMin((() => {
6468
6760
  ];
6469
6761
  }));
6470
6762
  //#endregion
6763
+ //#region ../../lib/agents/session-pointers.ts
6764
+ /**
6765
+ * Clear every mutable pointer that can make a later launch resume an old
6766
+ * session. Claude JSONL transcripts live outside the agent directory and are
6767
+ * deliberately never touched.
6768
+ */
6769
+ async function clearAgentSessionPointers(agentId) {
6770
+ const agentDir = getAgentDir(agentId);
6771
+ const cleared = [];
6772
+ for (const name of [
6773
+ "session.id",
6774
+ "sessions.json",
6775
+ "codex-thread-id",
6776
+ "launcher.sh"
6777
+ ]) {
6778
+ const path = join(agentDir, name);
6779
+ if (!existsSync$1(path)) continue;
6780
+ unlinkSync$1(path);
6781
+ cleared.push(name);
6782
+ }
6783
+ const runtimeFile = join(agentDir, "runtime.json");
6784
+ if (existsSync$1(runtimeFile)) try {
6785
+ const runtime = JSON.parse(readFileSync$1(runtimeFile, "utf-8"));
6786
+ if (Object.prototype.hasOwnProperty.call(runtime, "claudeSessionId")) {
6787
+ delete runtime.claudeSessionId;
6788
+ writeFileSync$1(runtimeFile, JSON.stringify(runtime, null, 2));
6789
+ cleared.push("runtime.json:claudeSessionId");
6790
+ }
6791
+ } catch {}
6792
+ const state = getAgentStateSync(agentId);
6793
+ if (state?.sessionId) {
6794
+ delete state.sessionId;
6795
+ saveAgentStateSync(state);
6796
+ cleared.push("agents.session_id");
6797
+ }
6798
+ await Effect.runPromise(emitAgentEvent(agentId, {
6799
+ kind: "model_set",
6800
+ model: state?.model ?? "unknown",
6801
+ claudeSessionId: null
6802
+ }));
6803
+ cleared.push("runtime.claudeSessionId");
6804
+ return { cleared };
6805
+ }
6806
+ var init_session_pointers = __esmMin((() => {
6807
+ init_agent_runtime();
6808
+ init_agent_state();
6809
+ }));
6810
+ //#endregion
6471
6811
  //#region ../../lib/agents/resume.ts
6472
6812
  /**
6473
6813
  * Resume a suspended agent (PAN-80)
@@ -6500,7 +6840,7 @@ async function buildCompactRecoverySeed(agentId) {
6500
6840
  if (agentState?.workspace && sessionId) {
6501
6841
  const sessionFile = sessionFilePath(agentState.workspace, sessionId);
6502
6842
  try {
6503
- const [{ getConversationCompactionSettings }, { generateSmartSummary }] = await Promise.all([import("./conversation-compaction-CN4-5YYt.js"), import("./smart-compaction-jdMkG1vo.js")]);
6843
+ const [{ getConversationCompactionSettings }, { generateSmartSummary }] = await Promise.all([import("./conversation-compaction-eQB5CkOe.js"), import("./smart-compaction-CV2ukKND.js")]);
6504
6844
  const settings = getConversationCompactionSettings();
6505
6845
  summary = (await Effect.runPromise(generateSmartSummary({
6506
6846
  jsonlPath: sessionFile,
@@ -6511,7 +6851,7 @@ async function buildCompactRecoverySeed(agentId) {
6511
6851
  } catch (err) {
6512
6852
  logAgentLifecycleSync(normalizedId, `compact-recovery smart summary failed (${err instanceof Error ? err.message : String(err)}); trying heuristic fallback`);
6513
6853
  try {
6514
- const { generateFallbackSummary } = await import("./summary-fork-agEMsPSo.js");
6854
+ const { generateFallbackSummary } = await import("./summary-fork-DpcxN9tf.js");
6515
6855
  summary = await Effect.runPromise(generateFallbackSummary(sessionFile));
6516
6856
  } catch (fallbackErr) {
6517
6857
  logAgentLifecycleSync(normalizedId, `compact-recovery fallback summary failed (${fallbackErr instanceof Error ? fallbackErr.message : String(fallbackErr)}); seeding with reseed instructions only`);
@@ -6543,7 +6883,7 @@ async function resumeAgent(agentId, message, opts) {
6543
6883
  if (gateDecision.decision === "proceed" && gateDecision.warning) logAgentLifecycleSync(normalizedId, `resumeAgent: ${gateDecision.warning}`);
6544
6884
  if (bypassTroubledGate) logAgentLifecycleSync(normalizedId, `resumeAgent: bypassing troubled gate for explicit compact recovery (${gateBlock?.reason})`);
6545
6885
  const hasWorkspace = !!agentState?.workspace && existsSync(agentState.workspace);
6546
- const isPlaceholder = !!agentState && agentState.status === "starting" && typeof agentState.model === "string" && agentState.model.startsWith("pending-");
6886
+ const isPlaceholder = !!agentState && typeof agentState.model === "string" && agentState.model.startsWith("pending-");
6547
6887
  const allowedRuntimeStates = ["suspended", "idle"];
6548
6888
  const allowedAgentStatuses = ["stopped", "completed"];
6549
6889
  const isRunningOrStarting = agentState?.status === "running" || agentState?.status === "starting";
@@ -6636,7 +6976,13 @@ async function resumeAgent(agentId, message, opts) {
6636
6976
  if (legacyHarnessMigrated) resumeDriftReasons.push(`legacy harness ${priorHarness}→${effectiveHarness} (PAN-1797 re-default)`);
6637
6977
  const piDeadRecovery = effectiveHarness === "ohmypi" && !piProcessWasAlive && !compactSeed && resumeDriftReasons.length === 0;
6638
6978
  if (piDeadRecovery) logAgentLifecycleSync(normalizedId, "resumeAgent: dead ohmypi process — fresh-launching for recovery instead of omp --resume (PAN-2009)");
6639
- const shouldResumeSavedSession = !compactSeed && resumeDriftReasons.length === 0 && !piDeadRecovery;
6979
+ const expectedClaudeJsonl = sessionFilePath(agentState.workspace, sessionId);
6980
+ const claudeJsonlMissingRecovery = effectiveHarness === "claude-code" && !compactSeed && resumeDriftReasons.length === 0 && !existsSync(expectedClaudeJsonl);
6981
+ if (claudeJsonlMissingRecovery) {
6982
+ logAgentLifecycleSync(normalizedId, `resumeAgent: saved Claude transcript is missing at ${expectedClaudeJsonl} — clearing stale pointers and fresh-launching (PAN-2895)`);
6983
+ await clearAgentSessionPointers(normalizedId);
6984
+ }
6985
+ const shouldResumeSavedSession = !compactSeed && resumeDriftReasons.length === 0 && !piDeadRecovery && !claudeJsonlMissingRecovery;
6640
6986
  if (sessionRotationRefused({
6641
6987
  compactSeed: Boolean(compactSeed),
6642
6988
  driftReasons: resumeDriftReasons,
@@ -6657,12 +7003,14 @@ async function resumeAgent(agentId, message, opts) {
6657
7003
  }
6658
7004
  const freshSessionId = !shouldResumeSavedSession && effectiveHarness === "claude-code" ? randomUUID() : void 0;
6659
7005
  if (resumeDriftReasons.length > 0) logAgentLifecycleSync(normalizedId, `resumeAgent: starting fresh session instead of --resume because session origin drifted (${resumeDriftReasons.join(", ")})`);
6660
- if (freshSessionId) saveSessionId(normalizedId, freshSessionId);
6661
- else if (!shouldResumeSavedSession) try {
7006
+ if (freshSessionId) {
7007
+ saveSessionId(normalizedId, freshSessionId);
7008
+ agentState.sessionId = freshSessionId;
7009
+ } else if (!shouldResumeSavedSession) try {
6662
7010
  unlinkSync(join$1(getAgentDir(normalizedId), "session.id"));
6663
7011
  } catch {}
6664
7012
  const issueId = agentState.issueId || normalizedId.replace(/^agent-/, "").toUpperCase();
6665
- const defaultResumeMessage = buildDefaultResumeContinueMessage(issueId);
7013
+ const defaultResumeMessage = buildResumeContinueMessage(agentState);
6666
7014
  const resumeMessage = compactSeed ? {
6667
7015
  message: message ? `${compactSeed}\n\n${message}` : compactSeed,
6668
7016
  redeliveringKickoff: false
@@ -6696,6 +7044,7 @@ async function resumeAgent(agentId, message, opts) {
6696
7044
  } : {},
6697
7045
  sessionId: freshSessionId,
6698
7046
  harness: effectiveHarness,
7047
+ harnessBinaryPath: harnessLaunch.binaryPath,
6699
7048
  useSupervisor: supervisorLaunch.useSupervisor,
6700
7049
  supervisorScriptPath: supervisorLaunch.supervisorScriptPath,
6701
7050
  extraEnvExports: [harnessLaunch.pathExport]
@@ -6711,6 +7060,11 @@ async function resumeAgent(agentId, message, opts) {
6711
7060
  CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION: "false",
6712
7061
  ...providerEnv
6713
7062
  } }));
7063
+ if (freshSessionId) await saveAgentRuntimeState(normalizedId, {
7064
+ claudeSessionId: freshSessionId,
7065
+ sessionModel: model,
7066
+ sessionHarness: effectiveHarness
7067
+ });
6714
7068
  let messageDelivered = false;
6715
7069
  if (effectiveHarness === "ohmypi") try {
6716
7070
  await writeOhmypiAgentPrompt(normalizedId, effectiveMessage);
@@ -6720,7 +7074,18 @@ async function resumeAgent(agentId, message, opts) {
6720
7074
  const msg = err instanceof Error ? err.message : String(err);
6721
7075
  console.error(`[resumeAgent] ohmypi prompt delivery failed: ${msg}`);
6722
7076
  }
6723
- else if (effectiveHarness === "codex") {
7077
+ else if (effectiveHarness === "acp") {
7078
+ const delivery = await deliverInitialPromptWithRetry(normalizedId, effectiveMessage, "resumeAgent:acp-continue");
7079
+ messageDelivered = delivery.ok;
7080
+ if (delivery.ok && resumeMessage.redeliveringKickoff) markKickoffRedelivered(agentState);
7081
+ if (!delivery.ok) {
7082
+ await Effect.runPromise(killSession(normalizedId));
7083
+ return {
7084
+ success: false,
7085
+ error: `ACP continue prompt did not land: ${delivery.failure ?? "unknown failure"}`
7086
+ };
7087
+ }
7088
+ } else if (effectiveHarness === "codex") {
6724
7089
  const delivery = await deliverInitialPromptWithRetry(normalizedId, effectiveMessage, "resumeAgent:codex-continue", resilientDeliveryMethod(agentState.deliveryMethod));
6725
7090
  messageDelivered = delivery.ok;
6726
7091
  if (delivery.ok && resumeMessage.redeliveringKickoff) markKickoffRedelivered(agentState);
@@ -6749,6 +7114,9 @@ async function resumeAgent(agentId, message, opts) {
6749
7114
  } else if (piDeadRecovery) {
6750
7115
  console.log(`[agents] Respawned ${normalizedId} fresh because the prior Pi process was dead (archived session ${sessionId})`);
6751
7116
  logAgentLifecycleSync(normalizedId, `resumeAgent SUCCESS: fresh respawn after dead Pi process (archived sessionId=${sessionId}), messageDelivered=${messageDelivered}`);
7117
+ } else if (claudeJsonlMissingRecovery) {
7118
+ console.log(`[agents] Respawned ${normalizedId} fresh because the saved Claude transcript was missing (stale session ${sessionId}${freshSessionId ? `, new session ${freshSessionId}` : ""})`);
7119
+ logAgentLifecycleSync(normalizedId, `resumeAgent SUCCESS: fresh respawn after missing Claude JSONL (stale sessionId=${sessionId}${freshSessionId ? `, newSessionId=${freshSessionId}` : ""}), messageDelivered=${messageDelivered}`);
6752
7120
  } else if (!shouldResumeSavedSession) {
6753
7121
  console.log(`[agents] Respawned ${normalizedId} fresh because session origin drifted (archived session ${sessionId}${freshSessionId ? `, new session ${freshSessionId}` : ""})`);
6754
7122
  logAgentLifecycleSync(normalizedId, `resumeAgent SUCCESS: fresh respawn after origin drift (archived sessionId=${sessionId}${freshSessionId ? `, newSessionId=${freshSessionId}` : ""}), messageDelivered=${messageDelivered}`);
@@ -6831,6 +7199,7 @@ var init_resume = __esmMin((() => {
6831
7199
  init_tmux();
6832
7200
  init_agent_state();
6833
7201
  init_activity();
7202
+ init_session_pointers();
6834
7203
  init_delivery();
6835
7204
  init_identity();
6836
7205
  init_runtime_state();
@@ -6866,7 +7235,7 @@ var init_graceful_restart = __esmMin((() => {
6866
7235
  //#endregion
6867
7236
  //#region ../../lib/agents/recovery.ts
6868
7237
  function resolveRecoveryResumeSessionId(agentId, harness) {
6869
- if (harness !== "codex") return void 0;
7238
+ if (harness !== "codex" && harness !== "acp") return void 0;
6870
7239
  return getLatestSessionIdSync(agentId) ?? void 0;
6871
7240
  }
6872
7241
  async function restartAgent(agentId, opts = {}) {
@@ -6926,6 +7295,7 @@ async function restartAgent(agentId, opts = {}) {
6926
7295
  role: agentState.role,
6927
7296
  isPlanning: agentState.role === "plan",
6928
7297
  harness: effectiveHarness,
7298
+ harnessBinaryPath: harnessLaunch.binaryPath,
6929
7299
  useSupervisor: supervisorLaunch.useSupervisor,
6930
7300
  supervisorScriptPath: supervisorLaunch.supervisorScriptPath,
6931
7301
  extraEnvExports: [harnessLaunch.pathExport]
@@ -6943,18 +7313,20 @@ async function restartAgent(agentId, opts = {}) {
6943
7313
  GIT_SEQUENCE_EDITOR: "false",
6944
7314
  ...providerEnv
6945
7315
  } }));
6946
- const prompt = message || `You are resuming work on ${agentState.issueId}. Read .pan/continue.json for context and pick up where you left off.`;
7316
+ const prompt = message || buildResumeContinueMessage(agentState);
6947
7317
  if (effectiveHarness === "ohmypi") try {
6948
7318
  await writeOhmypiAgentPrompt(normalizedId, prompt);
6949
7319
  } catch (err) {
6950
7320
  const msg = err instanceof Error ? err.message : String(err);
6951
7321
  console.error(`[restartAgent] ohmypi prompt delivery failed for ${normalizedId}: ${msg}`);
6952
7322
  }
6953
- else if (await waitForPromptReady(normalizedId, effectiveHarness, 30)) {
7323
+ else {
7324
+ if (!await waitForPromptReady(normalizedId, effectiveHarness, 30)) throw new Error(`${getHarnessBehavior(effectiveHarness).displayName} did not become ready within 30s for ${normalizedId}`);
6954
7325
  await new Promise((r) => setTimeout(r, 500));
6955
- if (effectiveHarness === "codex") await deliverAgentMessage(normalizedId, prompt, "restartAgent:continue-prompt", resilientDeliveryMethod(agentState.deliveryMethod));
6956
- else await Effect.runPromise(sendKeys(normalizedId, prompt));
6957
- } else console.error(`[restartAgent] ${effectiveHarness === "codex" ? "Codex" : "Claude"} did not become ready within 30s for ${normalizedId}`);
7326
+ if (effectiveHarness === "codex" || effectiveHarness === "acp") {
7327
+ if (!(await deliverAgentMessage(normalizedId, prompt, "restartAgent:continue-prompt", effectiveHarness === "codex" ? resilientDeliveryMethod(agentState.deliveryMethod) : void 0)).ok) throw new Error(`${getHarnessBehavior(effectiveHarness).displayName} continue prompt delivery failed`);
7328
+ } else await Effect.runPromise(sendKeys(normalizedId, prompt));
7329
+ }
6958
7330
  markAgentRunning(agentState);
6959
7331
  saveAgentStateSync(agentState);
6960
7332
  await saveAgentRuntimeState(normalizedId, {
@@ -6965,6 +7337,7 @@ async function restartAgent(agentId, opts = {}) {
6965
7337
  return { success: true };
6966
7338
  } catch (error) {
6967
7339
  const msg = error instanceof Error ? error.message : String(error);
7340
+ await Effect.runPromise(stopAgent(normalizedId)).catch(() => void 0);
6968
7341
  logAgentLifecycleSync(normalizedId, `restartAgent FAILED: ${msg}`);
6969
7342
  return {
6970
7343
  success: false,
@@ -7067,6 +7440,7 @@ async function recoverAgent(agentId, opts = {}) {
7067
7440
  role: recoveryRole,
7068
7441
  isPlanning: recoveryRole === "plan",
7069
7442
  harness: "ohmypi",
7443
+ harnessBinaryPath: harnessLaunch.binaryPath,
7070
7444
  extraEnvExports: [harnessLaunch.pathExport]
7071
7445
  });
7072
7446
  const launcherScript = join$1(getAgentDir(normalizedId), "launcher.sh");
@@ -7090,6 +7464,42 @@ async function recoverAgent(agentId, opts = {}) {
7090
7464
  logAgentLifecycleSync(normalizedId, `recoverAgent SUCCESS: recoveryCount=${health.recoveryCount} (ohmypi)`);
7091
7465
  return state;
7092
7466
  }
7467
+ if (recoveryHarness === "acp") {
7468
+ const resumeSessionId = resolveRecoveryResumeSessionId(normalizedId, recoveryHarness);
7469
+ const { launcherContent, providerEnv: acpProviderEnv } = await buildAgentLaunchConfig({
7470
+ agentId: normalizedId,
7471
+ model: state.model,
7472
+ workspace: state.workspace,
7473
+ role: recoveryRole,
7474
+ isPlanning: recoveryRole === "plan",
7475
+ ...resumeSessionId ? {
7476
+ spawnMode: "resume",
7477
+ resumeSessionId
7478
+ } : {},
7479
+ harness: "acp",
7480
+ harnessBinaryPath: harnessLaunch.binaryPath,
7481
+ extraEnvExports: [harnessLaunch.pathExport]
7482
+ });
7483
+ const launcherScript = join$1(getAgentDir(normalizedId), "launcher.sh");
7484
+ await writeLauncherScriptAtomic(launcherScript, launcherContent);
7485
+ await Effect.runPromise(createSession(normalizedId, state.workspace, `bash ${launcherScript}`, { env: {
7486
+ ...BLANKED_PROVIDER_ENV,
7487
+ OVERDECK_AGENT_ID: normalizedId,
7488
+ OVERDECK_ISSUE_ID: state.issueId || "",
7489
+ OVERDECK_SESSION_TYPE: recoveryRole,
7490
+ CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION: "false",
7491
+ ...acpProviderEnv
7492
+ } }));
7493
+ const delivery = await deliverInitialPromptWithRetry(normalizedId, recoveryPrompt, "recoverAgent:acp-recovery-prompt");
7494
+ if (!delivery.ok) {
7495
+ await Effect.runPromise(stopAgent(normalizedId));
7496
+ throw new Error(`ACP recovery prompt delivery failed for ${normalizedId}: ${delivery.failure ?? "unknown failure"}`);
7497
+ }
7498
+ markAgentRunning(state);
7499
+ saveAgentStateSync(state);
7500
+ logAgentLifecycleSync(normalizedId, `recoverAgent SUCCESS: recoveryCount=${health.recoveryCount} (acp)`);
7501
+ return state;
7502
+ }
7093
7503
  const recoveryCodexFields = recoveryHarness === "codex" ? getCodexLauncherFields(normalizedId, state.model, state.workspace, recoveryRole) : {};
7094
7504
  const recoveryLauncherContent = generateLauncherScriptSync({
7095
7505
  role: recoveryRole,
@@ -7141,7 +7551,7 @@ function generateRecoveryPrompt(state) {
7141
7551
  `- Started: ${state.startedAt}`,
7142
7552
  "",
7143
7553
  "## Recovery Steps",
7144
- "1. Check the vBRIEF task state: `pan task show " + state.issueId + " <item-id>`",
7554
+ "1. Check the xBRIEF task state: `pan task show " + state.issueId + " <item-id>`",
7145
7555
  "2. Review recent git commits: `git log --oneline -10`",
7146
7556
  "3. Check hook for pending work: `pan admin fpp check`",
7147
7557
  "4. Resume from last known state",
@@ -7191,6 +7601,7 @@ var init_recovery = __esmMin((() => {
7191
7601
  init_persistent_logger();
7192
7602
  init_providers();
7193
7603
  init_conversations();
7604
+ init_behavior();
7194
7605
  init_tmux();
7195
7606
  init_agent_state();
7196
7607
  init_delivery();
@@ -7441,7 +7852,7 @@ var init_tier_escalation = __esmMin((() => {
7441
7852
  * not to respond, so per-event output cost stays ~0 (NFR-1).
7442
7853
  */
7443
7854
  async function runGitShow$1(workspace, sha, args = []) {
7444
- const { stdout } = await execFileAsync$2("git", [
7855
+ const { stdout } = await execFileAsync$5("git", [
7445
7856
  "show",
7446
7857
  sha,
7447
7858
  ...args
@@ -7462,11 +7873,11 @@ async function renderCommitFeedDiff(workspace, sha, feedConfig = DEFAULT_FEED_CO
7462
7873
  ".",
7463
7874
  ...feedConfig.exclude.map((glob) => `:(exclude)${glob}`)
7464
7875
  ] : [];
7465
- const diff = await gitShow(workspace, sha, pathspecArgs);
7876
+ const diff = await renderWorkspaceGitShowPromise(deps.issueId, workspace, sha, pathspecArgs, gitShow);
7466
7877
  const maxBytes = feedConfig.max_diff_bytes;
7467
7878
  if (maxBytes === null || Buffer.byteLength(diff, "utf-8") <= maxBytes) return diff;
7468
7879
  return [
7469
- (await gitShow(workspace, sha, ["--stat", ...pathspecArgs])).trimEnd(),
7880
+ (await renderWorkspaceGitShowPromise(deps.issueId, workspace, sha, ["--stat", ...pathspecArgs], gitShow)).trimEnd(),
7470
7881
  "",
7471
7882
  `[tiered_execution.feed.max_diff_bytes truncated commit diff: ${Buffer.byteLength(diff, "utf-8")} bytes exceeded ${maxBytes} bytes]`,
7472
7883
  ""
@@ -7508,7 +7919,10 @@ function composeCommitFeedMessage(sha, itemTitle, diff, callout) {
7508
7919
  async function broadcastCommit(options) {
7509
7920
  const feedConfig = options.feedConfig ?? DEFAULT_FEED_CONFIG;
7510
7921
  if (shouldSkipFeedSubject(options.commitSubject ?? options.itemTitle, feedConfig)) return [];
7511
- const renderDiff = options.renderDiff ?? (options.gitShow ? (workspace, sha) => options.gitShow(workspace, sha) : renderCommitFeedDiff);
7922
+ const renderDiff = options.renderDiff ?? ((workspace, sha, config) => renderCommitFeedDiff(workspace, sha, config, {
7923
+ issueId: options.issueId,
7924
+ gitShow: options.gitShow ? (repoPath, repoSha) => options.gitShow(repoPath, repoSha) : void 0
7925
+ }));
7512
7926
  const deliver = options.deliver ?? deliverAgentMessage;
7513
7927
  const recordDelivery = options.recordDelivery ?? recordTierFeedDelivery;
7514
7928
  const now = options.now ?? (() => /* @__PURE__ */ new Date());
@@ -7555,12 +7969,13 @@ async function broadcastCommit(options) {
7555
7969
  }
7556
7970
  return deliveries;
7557
7971
  }
7558
- var execFileAsync$2, DEFAULT_FEED_CONFIG;
7972
+ var execFileAsync$5, DEFAULT_FEED_CONFIG;
7559
7973
  var init_tier_feed = __esmMin((() => {
7974
+ init_git_utils();
7560
7975
  init_delivery();
7561
7976
  init_tier_metrics();
7562
7977
  init_tier_table();
7563
- execFileAsync$2 = promisify(execFile);
7978
+ execFileAsync$5 = promisify(execFile);
7564
7979
  DEFAULT_FEED_CONFIG = DEFAULT_TIERED_EXECUTION_CONFIG.feed;
7565
7980
  }));
7566
7981
  //#endregion
@@ -7680,7 +8095,7 @@ function childItems(item) {
7680
8095
  return item.items ?? item.subItems ?? [];
7681
8096
  }
7682
8097
  /**
7683
- * Pull the bead's acceptance-criterion titles from its vBRIEF child items
8098
+ * Pull the bead's acceptance-criterion titles from its xBRIEF child items
7684
8099
  * (child metadata.kind === 'acceptance_criterion').
7685
8100
  */
7686
8101
  function extractAcceptanceCriteria(item) {
@@ -7774,23 +8189,29 @@ Rules:
7774
8189
  - Do not use any other endpoint or side channel for the verdict.
7775
8190
  - Only review this commit against this bead's acceptance criteria — compile, lint, and tests are the verification gate's job, and code style is the review convoy's job.`;
7776
8191
  }
7777
- async function getCommitDiff(workspacePath, sha) {
7778
- const { stdout } = await execFileAsync$1("git", ["show", sha], {
7779
- cwd: workspacePath,
7780
- encoding: "utf-8",
7781
- maxBuffer: 10 * 1024 * 1024
8192
+ async function getCommitDiff(issueId, workspacePath, sha) {
8193
+ return renderWorkspaceGitShowPromise(issueId, workspacePath, sha, [], async (repoPath, repoSha, args) => {
8194
+ const { stdout } = await execFileAsync$4("git", [
8195
+ "show",
8196
+ repoSha,
8197
+ ...args
8198
+ ], {
8199
+ cwd: repoPath,
8200
+ encoding: "utf-8",
8201
+ maxBuffer: 10 * 1024 * 1024
8202
+ });
8203
+ return stdout;
7782
8204
  });
7783
- return stdout;
7784
8205
  }
7785
8206
  /**
7786
8207
  * Deliver one subscribed commit to the standing supervisor for review:
7787
- * resolve the diff, pull the bead's acceptance criteria from its vBRIEF item
8208
+ * resolve the diff, pull the bead's acceptance criteria from its xBRIEF item
7788
8209
  * (plus traced FR text when metadata.traces is present and a PRD draft was
7789
8210
  * provided), and send the composed review request via deliverAgentMessage.
7790
8211
  */
7791
8212
  async function deliverCommitForReview(options) {
7792
8213
  const deliver = options.deps?.deliver ?? deliverAgentMessage;
7793
- const diff = await (options.deps?.getDiff ?? getCommitDiff)(options.workspacePath, options.sha);
8214
+ const diff = await (options.deps?.getDiff ?? ((workspacePath, sha) => getCommitDiff(options.issueId, workspacePath, sha)))(options.workspacePath, options.sha);
7794
8215
  const traces = Array.isArray(options.item.metadata?.traces) ? options.item.metadata.traces : [];
7795
8216
  const frText = options.prdMarkdown && traces.length > 0 ? extractTracedFrText(options.prdMarkdown, traces) : void 0;
7796
8217
  const message = buildSupervisorReviewMessage({
@@ -7805,13 +8226,14 @@ async function deliverCommitForReview(options) {
7805
8226
  });
7806
8227
  return deliver(options.supervisorAgentId, message, "tier-supervisor:verdict");
7807
8228
  }
7808
- var SUPERVISOR_SUB_ROLE, execFileAsync$1;
8229
+ var SUPERVISOR_SUB_ROLE, execFileAsync$4;
7809
8230
  var init_tier_supervisor = __esmMin((() => {
8231
+ init_git_utils();
7810
8232
  init_delivery();
7811
8233
  init_spawn_prep();
7812
8234
  init_spawn();
7813
8235
  SUPERVISOR_SUB_ROLE = "supervisor";
7814
- execFileAsync$1 = promisify(execFile);
8236
+ execFileAsync$4 = promisify(execFile);
7815
8237
  }));
7816
8238
  //#endregion
7817
8239
  //#region ../../lib/agents/tier-replay.ts
@@ -7821,7 +8243,7 @@ var init_tier_supervisor = __esmMin((() => {
7821
8243
  * from `git log <base>..HEAD`, oldest commit first.
7822
8244
  */
7823
8245
  async function replayStandingAgent(target, options = {}) {
7824
- const deps = replayDeps(options.deps);
8246
+ const deps = replayDeps(options.deps, target.issueId);
7825
8247
  const replayTarget = target.kind === "tier" ? {
7826
8248
  ...target,
7827
8249
  ...resolveReplaySlot(target, deps)
@@ -7846,7 +8268,7 @@ async function replayCrashedStandingAgent(target, options = {}) {
7846
8268
  */
7847
8269
  async function compactAtTierRunBoundary(options) {
7848
8270
  if (!shouldReplayCompactAtTierRunBoundary(options.compaction)) return null;
7849
- const deps = replayDeps(options.deps);
8271
+ const deps = replayDeps(options.deps, options.target.issueId);
7850
8272
  const rerouted = resolveReroutedReplayTarget(options.target);
7851
8273
  if (!rerouted) {
7852
8274
  if (options.target.agentId) await deps.stop(options.target.agentId);
@@ -7991,7 +8413,7 @@ async function loadReplayCommits(workspace, base, feedConfig, deps) {
7991
8413
  return commits;
7992
8414
  }
7993
8415
  async function runGitLog(workspace, base) {
7994
- const { stdout } = await execFileAsync("git", [
8416
+ const { stdout } = await execFileAsync$3("git", [
7995
8417
  "log",
7996
8418
  "--reverse",
7997
8419
  "--format=%H%x00%s",
@@ -8009,27 +8431,34 @@ async function runGitLog(workspace, base) {
8009
8431
  };
8010
8432
  }).filter((entry) => entry.sha.trim().length > 0);
8011
8433
  }
8012
- async function runGitShow(workspace, sha) {
8013
- const { stdout } = await execFileAsync("git", ["show", sha], {
8014
- cwd: workspace,
8015
- encoding: "utf-8",
8016
- maxBuffer: 16 * 1024 * 1024
8434
+ async function runGitShow(issueId, workspace, sha) {
8435
+ return renderWorkspaceGitShowPromise(issueId, workspace, sha, [], async (repoPath, repoSha, args) => {
8436
+ const { stdout } = await execFileAsync$3("git", [
8437
+ "show",
8438
+ repoSha,
8439
+ ...args
8440
+ ], {
8441
+ cwd: repoPath,
8442
+ encoding: "utf-8",
8443
+ maxBuffer: 16 * 1024 * 1024
8444
+ });
8445
+ return stdout;
8017
8446
  });
8018
- return stdout;
8019
8447
  }
8020
- function replayDeps(deps = {}) {
8448
+ function replayDeps(deps = {}, issueId) {
8021
8449
  return {
8022
8450
  spawn: deps.spawn ?? spawnRun,
8023
8451
  deliver: deps.deliver ?? deliverAgentMessage,
8024
8452
  stop: deps.stop ?? stopAgent,
8025
8453
  gitLog: deps.gitLog ?? runGitLog,
8026
- gitShow: deps.gitShow ?? runGitShow,
8027
- renderDiff: deps.renderDiff ?? (deps.gitShow ? (workspace, sha) => deps.gitShow(workspace, sha) : renderCommitFeedDiff),
8454
+ gitShow: deps.gitShow ?? ((workspace, sha) => runGitShow(issueId, workspace, sha)),
8455
+ renderDiff: deps.renderDiff ?? (deps.gitShow ? (workspace, sha) => deps.gitShow(workspace, sha) : (workspace, sha, feedConfig) => renderCommitFeedDiff(workspace, sha, feedConfig, { issueId })),
8028
8456
  listSlotOwnership: deps.listSlotOwnership ?? listSlotOwnership
8029
8457
  };
8030
8458
  }
8031
- var execFileAsync, DEFAULT_REPLAY_THRESHOLD;
8459
+ var execFileAsync$3, DEFAULT_REPLAY_THRESHOLD;
8032
8460
  var init_tier_replay = __esmMin((() => {
8461
+ init_git_utils();
8033
8462
  init_model_capabilities();
8034
8463
  init_delivery();
8035
8464
  init_spawn();
@@ -8040,7 +8469,7 @@ var init_tier_replay = __esmMin((() => {
8040
8469
  init_tier_supervisor();
8041
8470
  init_tier_table();
8042
8471
  init_termination();
8043
- execFileAsync = promisify(execFile);
8472
+ execFileAsync$3 = promisify(execFile);
8044
8473
  DEFAULT_REPLAY_THRESHOLD = .5;
8045
8474
  }));
8046
8475
  //#endregion
@@ -8064,16 +8493,585 @@ var init_agents = __esmMin((() => {
8064
8493
  init_tier_replay();
8065
8494
  }));
8066
8495
  //#endregion
8496
+ //#region ../../lib/system-health/types.ts
8497
+ function available(value) {
8498
+ return {
8499
+ status: "available",
8500
+ value
8501
+ };
8502
+ }
8503
+ function unavailable(reason) {
8504
+ return {
8505
+ status: "unavailable",
8506
+ reason
8507
+ };
8508
+ }
8509
+ var init_types = __esmMin((() => {}));
8510
+ //#endregion
8511
+ //#region ../../lib/system-health/darwin.ts
8512
+ function parseDarwinMemoryPressure(content) {
8513
+ for (const pattern of [/System-wide memory free percentage:\s*([\d.]+)\s*%/i, /System-wide memory free percentage\s*=\s*([\d.]+)\s*%?/i]) {
8514
+ const match = content.match(pattern);
8515
+ if (!match) continue;
8516
+ const value = Number(match[1]);
8517
+ if (Number.isFinite(value) && value >= 0 && value <= 100) return value;
8518
+ }
8519
+ return null;
8520
+ }
8521
+ function parseDarwinVmStat(content) {
8522
+ const pageSizeMatch = content.match(/page size of\s+(\d+)\s+bytes/i);
8523
+ if (!pageSizeMatch) return null;
8524
+ const pageSizeBytes = Number(pageSizeMatch[1]);
8525
+ if (!Number.isFinite(pageSizeBytes) || pageSizeBytes <= 0) return null;
8526
+ const pages = /* @__PURE__ */ new Map();
8527
+ for (const line of content.split("\n")) {
8528
+ const match = line.match(/^([^:]+):\s+(\d+)\.?$/);
8529
+ if (!match) continue;
8530
+ const value = Number(match[2]);
8531
+ if (Number.isFinite(value)) pages.set(match[1].trim(), value);
8532
+ }
8533
+ const availablePageNames = [
8534
+ "Pages free",
8535
+ "Pages inactive",
8536
+ "Pages speculative"
8537
+ ];
8538
+ const availablePages = availablePageNames.every((name) => pages.has(name)) ? availablePageNames.reduce((sum, name) => sum + pages.get(name), 0) : void 0;
8539
+ const swapIn = pages.get("Swapins");
8540
+ const swapOut = pages.get("Swapouts");
8541
+ return {
8542
+ pageSizeBytes,
8543
+ availableMemoryBytes: availablePages == null ? void 0 : availablePages * pageSizeBytes,
8544
+ swap: swapIn == null || swapOut == null ? void 0 : {
8545
+ pagesIn: swapIn,
8546
+ pagesOut: swapOut
8547
+ }
8548
+ };
8549
+ }
8550
+ function unitBytes(value, unit) {
8551
+ const parsed = Number(value);
8552
+ if (!Number.isFinite(parsed) || parsed < 0) return null;
8553
+ const multiplier = unit.toUpperCase() === "G" ? 1024 ** 3 : unit.toUpperCase() === "K" ? 1024 : MIB;
8554
+ return Math.round(parsed * multiplier);
8555
+ }
8556
+ function parseDarwinSwapUsage(content) {
8557
+ const total = content.match(/total\s*=\s*([\d.]+)([KMG])/i);
8558
+ const used = content.match(/used\s*=\s*([\d.]+)([KMG])/i);
8559
+ const free = content.match(/free\s*=\s*([\d.]+)([KMG])/i);
8560
+ if (!total || !used || !free) return null;
8561
+ const totalBytes = unitBytes(total[1], total[2]);
8562
+ const usedBytes = unitBytes(used[1], used[2]);
8563
+ const freeBytes = unitBytes(free[1], free[2]);
8564
+ return totalBytes == null || usedBytes == null || freeBytes == null ? null : {
8565
+ totalBytes,
8566
+ usedBytes,
8567
+ freeBytes
8568
+ };
8569
+ }
8570
+ function aggregateDarwinCpuCounters(cpuInfo) {
8571
+ if (cpuInfo.length === 0) return null;
8572
+ let idle = 0;
8573
+ let total = 0;
8574
+ for (const cpu of cpuInfo) {
8575
+ const values = Object.values(cpu.times);
8576
+ if (values.some((value) => !Number.isFinite(value) || value < 0)) return null;
8577
+ idle += cpu.times.idle;
8578
+ total += values.reduce((sum, value) => sum + value, 0);
8579
+ }
8580
+ return {
8581
+ idle,
8582
+ total
8583
+ };
8584
+ }
8585
+ function computeCpuPercent$1(current, previous) {
8586
+ if (!previous) return unavailable("A previous CPU time sample is required.");
8587
+ const totalDelta = current.total - previous.total;
8588
+ const idleDelta = current.idle - previous.idle;
8589
+ if (totalDelta <= 0 || idleDelta < 0 || idleDelta > totalDelta) return unavailable("CPU times did not advance monotonically.");
8590
+ return available(Math.round((totalDelta - idleDelta) / totalDelta * 1e3) / 10);
8591
+ }
8592
+ function computeSwapActivity(current, previous, elapsedMs, pageSizeBytes) {
8593
+ if (!previous) return unavailable("A previous swap counter sample is required.");
8594
+ const pages = current.pagesIn - previous.pagesIn + current.pagesOut - previous.pagesOut;
8595
+ if (pages < 0 || elapsedMs <= 0) return unavailable("Swap counters or sample timing were invalid.");
8596
+ return available(Math.round(pages * pageSizeBytes * 6e4 / elapsedMs));
8597
+ }
8598
+ function percent$1(part, total) {
8599
+ if (total <= 0) return 0;
8600
+ return Math.round(part / total * 1e3) / 10;
8601
+ }
8602
+ async function command(adapters, executable, args) {
8603
+ try {
8604
+ return await adapters.execFile(executable, args, COMMAND_TIMEOUT_MS);
8605
+ } catch {
8606
+ return null;
8607
+ }
8608
+ }
8609
+ function createDarwinHostHealthCollector(adapters = defaultAdapters$1) {
8610
+ return {
8611
+ platform: "darwin",
8612
+ async sample(previous) {
8613
+ const sampledAtMs = adapters.now();
8614
+ const [pressureOutput, vmStatOutput, swapOutput] = await Promise.all([
8615
+ command(adapters, "memory_pressure", ["-Q"]),
8616
+ command(adapters, "vm_stat", []),
8617
+ command(adapters, "sysctl", ["-n", "vm.swapusage"])
8618
+ ]);
8619
+ const pressureFreePercent = pressureOutput == null ? null : parseDarwinMemoryPressure(pressureOutput);
8620
+ const vmStat = vmStatOutput == null ? null : parseDarwinVmStat(vmStatOutput);
8621
+ const swapUsage = swapOutput == null ? null : parseDarwinSwapUsage(swapOutput);
8622
+ const cpuInfo = adapters.cpus();
8623
+ const cpuCounters = aggregateDarwinCpuCounters(cpuInfo);
8624
+ const totalMemoryBytes = adapters.totalMemoryBytes();
8625
+ const availableMemoryBytes = pressureFreePercent != null ? Math.round(totalMemoryBytes * pressureFreePercent / 100) : vmStat?.availableMemoryBytes ?? null;
8626
+ const usedMemoryBytes = Number.isFinite(totalMemoryBytes) && availableMemoryBytes != null ? Math.max(totalMemoryBytes - availableMemoryBytes, 0) : null;
8627
+ const loadAverage1m = adapters.loadAverage1m();
8628
+ const elapsedMs = previous ? sampledAtMs - previous.sampledAtMs : 0;
8629
+ return {
8630
+ platform: "darwin",
8631
+ sampledAtMs,
8632
+ cpuPercent: cpuCounters ? computeCpuPercent$1(cpuCounters, previous?.counters.cpu) : unavailable("macOS CPU times are unavailable."),
8633
+ loadAverage1m: Number.isFinite(loadAverage1m) && loadAverage1m >= 0 ? available(loadAverage1m) : unavailable("The one-minute load average is unavailable."),
8634
+ loadPerCore1m: Number.isFinite(loadAverage1m) && loadAverage1m >= 0 && cpuInfo.length > 0 ? available(Math.round(loadAverage1m / cpuInfo.length * 100) / 100) : unavailable("Load average or CPU core count is unavailable."),
8635
+ totalMemoryBytes: Number.isFinite(totalMemoryBytes) && totalMemoryBytes > 0 ? available(totalMemoryBytes) : unavailable("Total memory is unavailable."),
8636
+ usedMemoryBytes: usedMemoryBytes == null ? unavailable("Used memory cannot be derived.") : available(usedMemoryBytes),
8637
+ availableMemoryBytes: availableMemoryBytes == null ? unavailable("Available memory is unavailable.") : available(availableMemoryBytes),
8638
+ memoryUsedPercent: usedMemoryBytes == null ? unavailable("Memory utilization cannot be derived.") : available(percent$1(usedMemoryBytes, totalMemoryBytes)),
8639
+ memoryPressureSomeAvg10: unavailable("macOS does not expose Linux memory PSI."),
8640
+ memoryPressureFullAvg10: unavailable("macOS does not expose Linux memory PSI."),
8641
+ memoryPressureFreePercent: pressureFreePercent == null ? unavailable("memory_pressure did not report a recognized free percentage.") : available(pressureFreePercent),
8642
+ swapTotalBytes: swapUsage ? available(swapUsage.totalBytes) : unavailable("vm.swapusage is unavailable."),
8643
+ swapUsedBytes: swapUsage ? available(swapUsage.usedBytes) : unavailable("vm.swapusage is unavailable."),
8644
+ swapUsedPercent: swapUsage ? available(percent$1(swapUsage.usedBytes, swapUsage.totalBytes)) : unavailable("vm.swapusage is unavailable."),
8645
+ swapActivityBytesPerMinute: vmStat?.swap ? computeSwapActivity(vmStat.swap, previous?.counters.swap, elapsedMs, vmStat.pageSizeBytes) : unavailable("vm_stat swap activity counters are unavailable."),
8646
+ committedMemoryBytes: unavailable("macOS does not expose Linux Committed_AS."),
8647
+ commitLimitBytes: unavailable("macOS does not expose Linux CommitLimit."),
8648
+ virtualCommitmentPercent: unavailable("macOS virtual commitment is unavailable."),
8649
+ counters: {
8650
+ cpu: cpuCounters,
8651
+ swap: vmStat?.swap ?? null
8652
+ }
8653
+ };
8654
+ }
8655
+ };
8656
+ }
8657
+ var execFileAsync$2, COMMAND_TIMEOUT_MS, MIB, DARWIN_MEMORY_PRESSURE_DEFAULTS, defaultAdapters$1;
8658
+ var init_darwin = __esmMin((() => {
8659
+ init_types();
8660
+ execFileAsync$2 = promisify(execFile);
8661
+ COMMAND_TIMEOUT_MS = 5e3;
8662
+ MIB = 1024 ** 2;
8663
+ DARWIN_MEMORY_PRESSURE_DEFAULTS = Object.freeze({
8664
+ warningFreePercent: 10,
8665
+ criticalFreePercent: 5,
8666
+ swapActivityWarningBytesPerMinute: 64 * MIB,
8667
+ swapActivityCriticalBytesPerMinute: 256 * MIB
8668
+ });
8669
+ defaultAdapters$1 = {
8670
+ execFile: async (command, args, timeoutMs) => {
8671
+ const { stdout } = await execFileAsync$2(command, [...args], {
8672
+ encoding: "utf-8",
8673
+ timeout: timeoutMs
8674
+ });
8675
+ return stdout;
8676
+ },
8677
+ cpus: cpus$1,
8678
+ loadAverage1m: () => loadavg$1()[0] ?? 0,
8679
+ totalMemoryBytes: totalmem$1,
8680
+ now: () => Date.now()
8681
+ };
8682
+ }));
8683
+ //#endregion
8684
+ //#region ../../lib/system-health/linux.ts
8685
+ function parseMemInfo(content) {
8686
+ const values = /* @__PURE__ */ new Map();
8687
+ for (const line of content.split("\n")) {
8688
+ const match = line.match(/^(\w+):\s+(\d+)\s+kB$/);
8689
+ if (!match) continue;
8690
+ const value = Number(match[2]);
8691
+ if (Number.isFinite(value)) values.set(match[1], value * KB);
8692
+ }
8693
+ return {
8694
+ memTotalBytes: values.get("MemTotal"),
8695
+ memAvailableBytes: values.get("MemAvailable"),
8696
+ swapTotalBytes: values.get("SwapTotal"),
8697
+ swapFreeBytes: values.get("SwapFree"),
8698
+ committedMemoryBytes: values.get("Committed_AS"),
8699
+ commitLimitBytes: values.get("CommitLimit")
8700
+ };
8701
+ }
8702
+ function parseProcStat(content) {
8703
+ const lines = content.split("\n");
8704
+ const cpuLine = lines.find((line) => line.startsWith("cpu "));
8705
+ if (!cpuLine) return null;
8706
+ const values = cpuLine.trim().split(/\s+/).slice(1).map(Number);
8707
+ if (values.length < 4 || values.some((value) => !Number.isFinite(value))) return null;
8708
+ const idle = values[3] + (values[4] ?? 0);
8709
+ const total = values.reduce((sum, value) => sum + value, 0);
8710
+ const coreCount = lines.filter((line) => /^cpu\d+\s/.test(line)).length;
8711
+ if (total < 0 || idle < 0) return null;
8712
+ return {
8713
+ cpu: {
8714
+ idle,
8715
+ total
8716
+ },
8717
+ coreCount: Math.max(coreCount, 1)
8718
+ };
8719
+ }
8720
+ function parseMemoryPressure(content) {
8721
+ const result = {};
8722
+ for (const line of content.split("\n")) {
8723
+ const match = line.match(/^(some|full)\s+.*\bavg10=([^\s]+)/);
8724
+ if (!match) continue;
8725
+ const value = Number(match[2]);
8726
+ if (!Number.isFinite(value) || value < 0) continue;
8727
+ if (match[1] === "some") result.someAvg10 = value;
8728
+ if (match[1] === "full") result.fullAvg10 = value;
8729
+ }
8730
+ return result;
8731
+ }
8732
+ function parseVmstat(content) {
8733
+ let pagesIn = null;
8734
+ let pagesOut = null;
8735
+ for (const line of content.split("\n")) {
8736
+ const match = line.match(/^(pswpin|pswpout)\s+(\d+)$/);
8737
+ if (!match) continue;
8738
+ const value = Number(match[2]);
8739
+ if (!Number.isFinite(value)) continue;
8740
+ if (match[1] === "pswpin") pagesIn = value;
8741
+ if (match[1] === "pswpout") pagesOut = value;
8742
+ }
8743
+ return pagesIn == null || pagesOut == null ? null : {
8744
+ pagesIn,
8745
+ pagesOut
8746
+ };
8747
+ }
8748
+ function parseLoadAverage(content) {
8749
+ const value = Number(content.trim().split(/\s+/)[0]);
8750
+ return Number.isFinite(value) && value >= 0 ? value : null;
8751
+ }
8752
+ function computeCpuPercent(current, previous) {
8753
+ if (!previous) return unavailable("A previous CPU counter sample is required.");
8754
+ const totalDelta = current.total - previous.total;
8755
+ const idleDelta = current.idle - previous.idle;
8756
+ if (totalDelta <= 0 || idleDelta < 0 || idleDelta > totalDelta) return unavailable("CPU counters did not advance monotonically.");
8757
+ return available(Math.round((totalDelta - idleDelta) / totalDelta * 1e3) / 10);
8758
+ }
8759
+ function computeSwapActivityBytesPerMinute(current, previous, elapsedMs, pageSizeBytes) {
8760
+ if (!previous) return unavailable("A previous swap counter sample is required.");
8761
+ const pageDelta = current.pagesIn - previous.pagesIn + current.pagesOut - previous.pagesOut;
8762
+ if (pageDelta < 0 || elapsedMs <= 0 || !Number.isFinite(pageSizeBytes) || pageSizeBytes <= 0) return unavailable("Swap counters or sample timing were invalid.");
8763
+ return available(Math.round(pageDelta * pageSizeBytes * 6e4 / elapsedMs));
8764
+ }
8765
+ async function readParsed(adapters, path, parse) {
8766
+ try {
8767
+ return parse(await adapters.readFile(path));
8768
+ } catch {
8769
+ return null;
8770
+ }
8771
+ }
8772
+ function percent(part, total) {
8773
+ if (total <= 0) return 0;
8774
+ return Math.round(part / total * 1e3) / 10;
8775
+ }
8776
+ function createLinuxHostHealthCollector(adapters = defaultAdapters) {
8777
+ return {
8778
+ platform: "linux",
8779
+ async sample(previous) {
8780
+ const sampledAtMs = adapters.now();
8781
+ const [memInfo, procStat, pressure, vmstat, loadAverage, pageSizeBytes] = await Promise.all([
8782
+ readParsed(adapters, "/proc/meminfo", parseMemInfo),
8783
+ readParsed(adapters, "/proc/stat", parseProcStat),
8784
+ readParsed(adapters, "/proc/pressure/memory", parseMemoryPressure),
8785
+ readParsed(adapters, "/proc/vmstat", parseVmstat),
8786
+ readParsed(adapters, "/proc/loadavg", parseLoadAverage),
8787
+ adapters.readPageSizeBytes().catch(() => null)
8788
+ ]);
8789
+ const totalMemoryBytes = memInfo?.memTotalBytes;
8790
+ const availableMemoryBytes = memInfo?.memAvailableBytes;
8791
+ const usedMemoryBytes = totalMemoryBytes != null && availableMemoryBytes != null ? Math.max(totalMemoryBytes - availableMemoryBytes, 0) : null;
8792
+ const swapTotalBytes = memInfo?.swapTotalBytes;
8793
+ const swapFreeBytes = memInfo?.swapFreeBytes;
8794
+ const swapUsedBytes = swapTotalBytes != null && swapFreeBytes != null ? Math.max(swapTotalBytes - swapFreeBytes, 0) : null;
8795
+ const committedMemoryBytes = memInfo?.committedMemoryBytes;
8796
+ const commitLimitBytes = memInfo?.commitLimitBytes;
8797
+ const cpuCounters = procStat?.cpu ?? null;
8798
+ const swapCounters = vmstat ?? null;
8799
+ const elapsedMs = previous ? sampledAtMs - previous.sampledAtMs : 0;
8800
+ return {
8801
+ platform: "linux",
8802
+ sampledAtMs,
8803
+ cpuPercent: cpuCounters ? computeCpuPercent(cpuCounters, previous?.counters.cpu) : unavailable("The aggregate CPU counters are unavailable."),
8804
+ loadAverage1m: loadAverage == null ? unavailable("The one-minute load average is unavailable.") : available(loadAverage),
8805
+ loadPerCore1m: loadAverage == null || !procStat ? unavailable("Load average or CPU core count is unavailable.") : available(Math.round(loadAverage / procStat.coreCount * 100) / 100),
8806
+ totalMemoryBytes: totalMemoryBytes == null ? unavailable("MemTotal is unavailable.") : available(totalMemoryBytes),
8807
+ usedMemoryBytes: usedMemoryBytes == null ? unavailable("Used memory cannot be derived without MemTotal and MemAvailable.") : available(usedMemoryBytes),
8808
+ availableMemoryBytes: availableMemoryBytes == null ? unavailable("MemAvailable is unavailable.") : available(availableMemoryBytes),
8809
+ memoryUsedPercent: usedMemoryBytes == null || totalMemoryBytes == null ? unavailable("Memory utilization cannot be derived.") : available(percent(usedMemoryBytes, totalMemoryBytes)),
8810
+ memoryPressureSomeAvg10: pressure?.someAvg10 == null ? unavailable("Linux memory PSI some.avg10 is unavailable.") : available(pressure.someAvg10),
8811
+ memoryPressureFullAvg10: pressure?.fullAvg10 == null ? unavailable("Linux memory PSI full.avg10 is unavailable.") : available(pressure.fullAvg10),
8812
+ memoryPressureFreePercent: unavailable("Linux reports memory pressure through PSI."),
8813
+ swapTotalBytes: swapTotalBytes == null ? unavailable("SwapTotal is unavailable.") : available(swapTotalBytes),
8814
+ swapUsedBytes: swapUsedBytes == null ? unavailable("Swap usage cannot be derived without SwapTotal and SwapFree.") : available(swapUsedBytes),
8815
+ swapUsedPercent: swapUsedBytes == null || swapTotalBytes == null ? unavailable("Swap utilization cannot be derived.") : available(percent(swapUsedBytes, swapTotalBytes)),
8816
+ swapActivityBytesPerMinute: swapCounters && pageSizeBytes != null ? computeSwapActivityBytesPerMinute(swapCounters, previous?.counters.swap, elapsedMs, pageSizeBytes) : unavailable("Linux swap activity counters are unavailable."),
8817
+ committedMemoryBytes: committedMemoryBytes == null ? unavailable("Committed_AS is unavailable.") : available(committedMemoryBytes),
8818
+ commitLimitBytes: commitLimitBytes == null ? unavailable("CommitLimit is unavailable.") : available(commitLimitBytes),
8819
+ virtualCommitmentPercent: committedMemoryBytes == null || commitLimitBytes == null ? unavailable("Virtual commitment cannot be derived.") : available(percent(committedMemoryBytes, commitLimitBytes)),
8820
+ counters: {
8821
+ cpu: cpuCounters,
8822
+ swap: swapCounters
8823
+ }
8824
+ };
8825
+ }
8826
+ };
8827
+ }
8828
+ var execFileAsync$1, KB, LINUX_MEMORY_PRESSURE_DEFAULTS, defaultAdapters;
8829
+ var init_linux = __esmMin((() => {
8830
+ init_types();
8831
+ execFileAsync$1 = promisify(execFile);
8832
+ KB = 1024;
8833
+ LINUX_MEMORY_PRESSURE_DEFAULTS = Object.freeze({
8834
+ someWarningAvg10: 5,
8835
+ fullCriticalAvg10: 1,
8836
+ swapActivityWarningBytesPerMinute: 64 * 1024 ** 2,
8837
+ swapActivityCriticalBytesPerMinute: 256 * 1024 ** 2
8838
+ });
8839
+ defaultAdapters = {
8840
+ readFile: (path) => readFile(path, "utf-8"),
8841
+ readPageSizeBytes: async () => {
8842
+ const { stdout } = await execFileAsync$1("getconf", ["PAGESIZE"], {
8843
+ encoding: "utf-8",
8844
+ timeout: 5e3
8845
+ });
8846
+ const value = Number(stdout.trim());
8847
+ if (!Number.isFinite(value) || value <= 0) throw new Error("getconf returned an invalid page size");
8848
+ return value;
8849
+ },
8850
+ now: () => Date.now()
8851
+ };
8852
+ }));
8853
+ //#endregion
8854
+ //#region ../../lib/system-health/collector.ts
8855
+ /**
8856
+ * Selects the platform host-health collector. Linux and macOS expose native
8857
+ * current-pressure signals; unsupported platforms return unavailable signals
8858
+ * so callers never mistake missing measurements for measured zeroes.
8859
+ */
8860
+ function buildProcessTreeIndex(rows) {
8861
+ const childrenByParent = /* @__PURE__ */ new Map();
8862
+ for (const row of rows) {
8863
+ const children = childrenByParent.get(row.ppid);
8864
+ if (children) children.push(row.pid);
8865
+ else childrenByParent.set(row.ppid, [row.pid]);
8866
+ }
8867
+ return { childrenByParent };
8868
+ }
8869
+ function collectDescendantPids(rootPid, index) {
8870
+ const descendants = /* @__PURE__ */ new Set();
8871
+ const queue = [rootPid];
8872
+ while (queue.length > 0) {
8873
+ const pid = queue.shift();
8874
+ if (pid == null || descendants.has(pid)) continue;
8875
+ descendants.add(pid);
8876
+ queue.push(...index.childrenByParent.get(pid) ?? []);
8877
+ }
8878
+ return descendants;
8879
+ }
8880
+ function createUnsupportedCollector(platform = "unsupported") {
8881
+ const signal = () => unavailable("Host health collection is unsupported on this platform.");
8882
+ return {
8883
+ platform,
8884
+ async sample() {
8885
+ return {
8886
+ platform,
8887
+ sampledAtMs: Date.now(),
8888
+ cpuPercent: signal(),
8889
+ loadAverage1m: signal(),
8890
+ loadPerCore1m: signal(),
8891
+ totalMemoryBytes: signal(),
8892
+ usedMemoryBytes: signal(),
8893
+ availableMemoryBytes: signal(),
8894
+ memoryUsedPercent: signal(),
8895
+ memoryPressureSomeAvg10: signal(),
8896
+ memoryPressureFullAvg10: signal(),
8897
+ memoryPressureFreePercent: signal(),
8898
+ swapTotalBytes: signal(),
8899
+ swapUsedBytes: signal(),
8900
+ swapUsedPercent: signal(),
8901
+ swapActivityBytesPerMinute: signal(),
8902
+ committedMemoryBytes: signal(),
8903
+ commitLimitBytes: signal(),
8904
+ virtualCommitmentPercent: signal(),
8905
+ counters: {
8906
+ cpu: null,
8907
+ swap: null
8908
+ }
8909
+ };
8910
+ }
8911
+ };
8912
+ }
8913
+ function createHostHealthCollector(selection = {}) {
8914
+ const platform = selection.platform ?? platform$1();
8915
+ if (platform === "linux") return selection.linux ?? createLinuxHostHealthCollector();
8916
+ if (platform === "darwin") return selection.darwin ?? createDarwinHostHealthCollector();
8917
+ return createUnsupportedCollector();
8918
+ }
8919
+ var init_collector = __esmMin((() => {
8920
+ init_darwin();
8921
+ init_linux();
8922
+ init_types();
8923
+ }));
8924
+ //#endregion
8925
+ //#region ../../lib/runtime-census.ts
8926
+ function parseRuntimeProcessTable(output) {
8927
+ return output.split("\n").flatMap((line) => {
8928
+ const match = line.trim().match(/^(\d+)\s+(\d+)\s+([0-9.]+)\s+(\d+)\s+(\S+)(?:\s+(.*))?$/);
8929
+ if (!match) return [];
8930
+ const pid = Number(match[1]);
8931
+ const ppid = Number(match[2]);
8932
+ const cpuPercent = Number(match[3]);
8933
+ const rssKb = Number(match[4]);
8934
+ if (![
8935
+ pid,
8936
+ ppid,
8937
+ cpuPercent,
8938
+ rssKb
8939
+ ].every(Number.isFinite)) return [];
8940
+ return [{
8941
+ pid,
8942
+ ppid,
8943
+ cpuPercent,
8944
+ rssBytes: rssKb * 1024,
8945
+ comm: match[5] ?? "",
8946
+ command: match[6] ?? match[5] ?? ""
8947
+ }];
8948
+ });
8949
+ }
8950
+ async function readRuntimeProcessTable() {
8951
+ const { stdout } = await execFileAsync("ps", ["-eo", "pid=,ppid=,pcpu=,rss=,comm=,args="], {
8952
+ encoding: "utf8",
8953
+ timeout: 1e4
8954
+ });
8955
+ return parseRuntimeProcessTable(String(stdout));
8956
+ }
8957
+ function buildRuntimeCensus(panes, processes, sampledAt, options) {
8958
+ const panesBySession = /* @__PURE__ */ new Map();
8959
+ for (const pane of panes) {
8960
+ const sessionPanes = panesBySession.get(pane.sessionName);
8961
+ if (sessionPanes) sessionPanes.push(pane);
8962
+ else panesBySession.set(pane.sessionName, [pane]);
8963
+ }
8964
+ const processesByPid = new Map(processes.map((process) => [process.pid, process]));
8965
+ return {
8966
+ sampledAt,
8967
+ available: options.tmuxAvailable,
8968
+ tmuxAvailable: options.tmuxAvailable,
8969
+ processAvailable: options.processAvailable,
8970
+ stale: options.stale ?? false,
8971
+ error: options.error ?? null,
8972
+ panes,
8973
+ sessionNames: new Set(panesBySession.keys()),
8974
+ panesBySession,
8975
+ processesByPid,
8976
+ processTree: buildProcessTreeIndex(processes)
8977
+ };
8978
+ }
8979
+ function createRuntimeCensusService(deps) {
8980
+ const now = deps.now ?? Date.now;
8981
+ const ttlMs = deps.ttlMs ?? 3e3;
8982
+ let snapshot = null;
8983
+ let inFlight = null;
8984
+ const refresh = () => {
8985
+ if (inFlight) return inFlight;
8986
+ inFlight = Promise.allSettled([deps.listPanes(), deps.readProcesses()]).then(([panesResult, processesResult]) => {
8987
+ const errors = [];
8988
+ if (panesResult.status === "rejected") errors.push(panesResult.reason instanceof Error ? panesResult.reason.message : String(panesResult.reason));
8989
+ if (processesResult.status === "rejected") errors.push(processesResult.reason instanceof Error ? processesResult.reason.message : String(processesResult.reason));
8990
+ snapshot = buildRuntimeCensus(panesResult.status === "fulfilled" ? panesResult.value : snapshot?.panes ?? [], processesResult.status === "fulfilled" ? processesResult.value : [...snapshot?.processesByPid.values() ?? []], now(), {
8991
+ tmuxAvailable: panesResult.status === "fulfilled",
8992
+ processAvailable: processesResult.status === "fulfilled",
8993
+ stale: errors.length > 0,
8994
+ error: errors.length > 0 ? errors.join("; ") : null
8995
+ });
8996
+ return snapshot;
8997
+ }).finally(() => {
8998
+ inFlight = null;
8999
+ });
9000
+ return inFlight;
9001
+ };
9002
+ return {
9003
+ get(options) {
9004
+ if (!options?.fresh && snapshot && now() - snapshot.sampledAt < ttlMs) return Promise.resolve(snapshot);
9005
+ return refresh();
9006
+ },
9007
+ peek() {
9008
+ return snapshot;
9009
+ },
9010
+ reset() {
9011
+ snapshot = null;
9012
+ inFlight = null;
9013
+ }
9014
+ };
9015
+ }
9016
+ function getRuntimeCensus(options) {
9017
+ return runtimeCensusService.get(options);
9018
+ }
9019
+ function refreshRuntimeCensus() {
9020
+ return runtimeCensusService.get({ fresh: true });
9021
+ }
9022
+ function getRuntimeCensusSnapshot() {
9023
+ return runtimeCensusService.peek();
9024
+ }
9025
+ function panePidsForSession(census, sessionName) {
9026
+ return (census.panesBySession.get(sessionName) ?? []).map((pane) => pane.panePid);
9027
+ }
9028
+ function descendantPidsForSession(census, sessionName) {
9029
+ const descendants = /* @__PURE__ */ new Set();
9030
+ for (const panePid of panePidsForSession(census, sessionName)) for (const pid of collectDescendantPids(panePid, census.processTree)) descendants.add(pid);
9031
+ return descendants;
9032
+ }
9033
+ function runtimeCensusHasHarnessProcess(census, sessionName) {
9034
+ if (!census.tmuxAvailable || !census.processAvailable) return true;
9035
+ const panePids = panePidsForSession(census, sessionName);
9036
+ if (panePids.length === 0) return false;
9037
+ for (const panePid of panePids) for (const pid of collectDescendantPids(panePid, census.processTree)) {
9038
+ const comm = census.processesByPid.get(pid)?.comm;
9039
+ if (comm && !KEEPALIVE_FOREGROUND_COMMANDS.has(comm)) return true;
9040
+ }
9041
+ return false;
9042
+ }
9043
+ var execFileAsync, KEEPALIVE_FOREGROUND_COMMANDS, runtimeCensusService;
9044
+ var init_runtime_census = __esmMin((() => {
9045
+ init_collector();
9046
+ execFileAsync = promisify(execFile);
9047
+ KEEPALIVE_FOREGROUND_COMMANDS = new Set([
9048
+ "sleep",
9049
+ "bash",
9050
+ "sh",
9051
+ "dash",
9052
+ "zsh",
9053
+ "ash"
9054
+ ]);
9055
+ runtimeCensusService = createRuntimeCensusService({
9056
+ listPanes: async () => {
9057
+ const { listAllPaneRecords } = await import("./tmux-B6z7h_vZ.js");
9058
+ return Effect.runPromise(listAllPaneRecords());
9059
+ },
9060
+ readProcesses: readRuntimeProcessTable
9061
+ });
9062
+ }));
9063
+ //#endregion
8067
9064
  //#region ../../lib/agents/queries.ts
8068
9065
  function listRunningAgentsSync() {
8069
- const tmuxSessions = listSessionsSync();
8070
- const tmuxNames = new Set(tmuxSessions.map((s) => s.name));
9066
+ const census = getRuntimeCensusSnapshot();
9067
+ const tmuxNames = census ? census.sessionNames : new Set(listSessionsSync().map((session) => session.name));
9068
+ const tmuxUnavailable = census?.tmuxAvailable === false;
8071
9069
  return listOverdeckAgentStatesSync().map((state) => {
8072
9070
  const normalizedId = normalizeAgentId(state.id);
8073
9071
  return {
8074
9072
  ...state,
8075
9073
  id: normalizedId,
8076
- tmuxActive: tmuxNames.has(normalizedId)
9074
+ tmuxActive: tmuxUnavailable || tmuxNames.has(normalizedId)
8077
9075
  };
8078
9076
  });
8079
9077
  }
@@ -8192,23 +9190,24 @@ var listRunningAgents;
8192
9190
  var init_queries = __esmMin((() => {
8193
9191
  init_agents();
8194
9192
  init_tmux();
9193
+ init_runtime_census();
8195
9194
  init_paths();
8196
9195
  init_agent_rollback_state();
8197
9196
  init_agent_state_sync();
8198
9197
  listRunningAgents = () => Effect.gen(function* () {
8199
- const tmuxSessions = yield* listSessions();
8200
- const tmuxNames = new Set(tmuxSessions.map((s) => s.name));
9198
+ const runtimeCensus = yield* Effect.promise(() => getRuntimeCensus());
9199
+ const tmuxNames = runtimeCensus.sessionNames;
8201
9200
  return listOverdeckAgentStatesSync().map((state) => {
8202
9201
  const normalizedId = normalizeAgentId(state.id);
8203
9202
  return {
8204
9203
  ...state,
8205
9204
  id: normalizedId,
8206
- tmuxActive: tmuxNames.has(normalizedId)
9205
+ tmuxActive: !runtimeCensus.tmuxAvailable || tmuxNames.has(normalizedId)
8207
9206
  };
8208
9207
  });
8209
9208
  });
8210
9209
  }));
8211
9210
  //#endregion
8212
- export { stopAgent as $, init_pty_token as $n, init_ohmypi_fifo as $t, buildCompactRecoverySeed as A, getAgentStateFilePath as An, init_spawn_prep as At, appendActivity as B, recordAgentFailure as Bn, OHMYPI_AGENT_READY_TIMEOUT_SECONDS as Bt, init_slot_reconcile as C, clearAgentTroubled as Cn, probeTranscriptSince as Ct, detectCrashedAgents as D, getAgentDir as Dn, assertWorkspaceStackHealthyForSpawn as Dt, autoRecoverAgents as E, decideResumeGate as En, writeBridgeTokenSync as Et, isContextOverflowTail as F, isRole as Fn, providerDefaultHarnessSync as Ft, init_activity as G, saveAgentStateSync as Gn, getProviderAuthMode as Gt, getLatestSessionId as H, recordStartupSessionExit as Hn, getAgentRuntimeBaseCommand as Ht, init_messaging as I, markAgentRunning as In, resolveImplicitStaffing as It, init_ohmypi as J, setAgentYieldedSync as Jn, injectPiConversationMemory as Jt, saveSessionId as K, setAgentPaused as Kn, getRoleRuntimeBaseCommand as Kt, messageAgent as L, markAgentRunningState as Ln, resolveStaffing as Lt, resumeAgent as M, init_agent_state as Mn, transitionIssueToInProgress as Mt, init_context_overflow as N, isAgentPaused as Nn, transitionIssueToInReview as Nt, recoverAgent as O, getAgentResumeGateBlockReason as On, buildAgentLaunchConfig as Ot, isContextOverflowError as P, isAgentTroubled as Pn, init_staffing as Pt, init_termination as Q, readAgentHarnessModelRecordSync as Qn, piFifoPaths as Qt, init_operator_interventions as R, markAgentStoppedState as Rn, init_resolve_tier as Rt, init_tier_escalation as S, clearAgentPausedSync as Sn, init_transcript_landing as St, reconcileSlotState as T, clearYieldForResumeSync as Tn, init_bridge_token as Tt, getLatestSessionIdSync as U, resetAgentFailureCount as Un, getCodexLauncherFields as Ut, getActivity as V, recordAgentFailureSync as Vn, describeOhmypiSpawnFailure as Vt, getSessionId as W, saveAgentState as Wn, getOhmypiLauncherFields as Wt, spawnAgent as X, writeAgentStateJsonSync as Xn, waitForPromptReady as Xt, init_spawn as Y, wipeAgentStateDirs as Yn, roleAgentDefinitionPath as Yt, spawnRun as Z, init_agent_record_sync as Zn, init_pi_fifo as Zt, spawnTierSupervisor as _, writeChannelsBridgeMcpConfig as _n, init_codex_auth as _r, deliverAgentPermissionDecision as _t, listRunningAgentsSync as a, determineModel as an, normalizeAgentId as ar, getConcurrencyLimits as at, init_tier_feed as b, __testInternals as bn, parseOhmypiSessionCostResultSync as br, setAgentDeliveryMethod as bt, compactAtTierRunBoundary as c, getProviderTmuxFlags as cn, waitForReadySignal as cr, releaseSwarmSlot as ct, replayStandingAgent as d, getOpenAIAuthStatus as dn, init_runtime_state as dr, tryReserveSwarmSlot as dt, ohmypiFifoPaths as en, writePtyToken as er, stopAgentSync as et, shouldReplayCompactAtTierRunBoundary as f, init_openai_auth as fn, saveAgentRuntimeState as fr, workResumeSlotsAvailable as ft, shouldSupervise as g, dismissDevChannelsDialog as gn, checkCodexAuthStatus as gr, deliverAgentMessage as gt, loadPrdDraft as h, decideSupervisorForWorkAgent as hn, applyCodexAuthBurnFlag as hr, setCachedMemoryVerdict as ht, listRunningAgents as i, buildSpawnEnvForModel as in, isQualifiedAgentId as ir, emergencyBrake as it, init_resume as j, getAgentStateSync as jn, retrieveSpawnTimeMemoryContext as jt, restartAgent as k, getAgentState as kn, defaultRunWorkspace as kt, contextWindowForModel as l, init_provider_health as ln, getAgentRuntimeState as lr, resetPatrolDispatchBudget as lt, init_tier_supervisor as m, decideChannelsForWorkAgent as mn, init_agent_runtime as mr, init_memory_verdict_cache as mt, init_queries as n, init_claude_auth as nn, resolvePtySupervisorScriptPath as nr, countRunningSwarmSlotsForIssue as nt, warnOnBareNumericIssueIds as o, getProviderEnvForModel as on, resolveAgentTargetSync as or, init_concurrency as ot, deliverCommitForReview as p, buildDefaultResumeContinueMessage as pn, getAgentRuntimeSnapshot as pr, getCachedMemoryVerdict as pt, createOhmypiRuntimeSync as q, setAgentPausedSync as qn, init_runtime_command as qt, listAgentStates as r, buildCavemanExports as rn, clearReadySignal as rr, describeRunningAgents as rt, init_agents as s, getProviderExportsForModel as sn, waitForAgentIdle as sr, releaseAdvancingSlot as st, dropLegacyAgentStatesMissingRoleAsync as t, getClaudeAuthStatus as tn, init_pty_supervisor_locate as tr, countRunningAgents as tt, replayCrashedStandingAgent as u, validateProviderHealth as un, getAgentRuntimeStateSync as ur, tryReserveAdvancingSlot as ut, supervisorAgentId as v, GOVERNOR_SLOT_PAUSE_REASON_PREFIX as vn, paneShowsCodexAuthBurn as vr, deliverInitialPromptWithRetry as vt, listSlotAssignments as w, clearAgentTroubledSync as wn, BRIDGE_TOKEN_HEADER as wt, decideEscalation as x, clearAgentPaused as xn, captureTranscriptUserRecordSnapshot as xt, broadcastCommit as y, SESSION_EXITED_BEFORE_KICKOFF as yn, init_ohmypi_parser as yr, deliverResumeMessageWithTranscriptConfirmation as yt, operatorInterventionEvent as z, markAgentTroubled as zn, resolveTier as zt };
9211
+ export { appendActivity as $, isRole as $n, OHMYPI_AGENT_READY_TIMEOUT_SECONDS as $t, spawnTierSupervisor as A, buildDefaultResumeContinueMessage as An, saveAgentRuntimeState as Ar, deliverAgentPermissionDecision as At, detectCrashedAgents as B, clearAgentPausedSync as Bn, assertWorkspaceStackHealthyForSpawn as Bt, replayCrashedStandingAgent as C, getProviderEnvForModel as Cn, normalizeAgentId as Cr, tryReserveAdvancingSlot as Ct, init_tier_supervisor as D, validateProviderHealth as Dn, getAgentRuntimeState as Dr, init_memory_verdict_cache as Dt, deliverCommitForReview as E, init_provider_health as En, waitForReadySignal as Er, getCachedMemoryVerdict as Et, init_tier_escalation as F, writeChannelsBridgeMcpConfig as Fn, init_codex_auth as Fr, init_transcript_landing as Ft, resumeAgent as G, getAgentDir as Gn, transitionIssueToInProgress as Gt, restartAgent as H, clearAgentTroubledSync as Hn, defaultRunWorkspace as Ht, init_slot_reconcile as I, GOVERNOR_SLOT_PAUSE_REASON_PREFIX as In, paneShowsCodexAuthBurn as Ir, probeTranscriptSince as It, isContextOverflowTail as J, getAgentStateFilePath as Jn, providerDefaultHarnessSync as Jt, init_context_overflow as K, getAgentResumeGateBlockReason as Kn, transitionIssueToInReview as Kt, listSlotAssignments as L, SESSION_EXITED_BEFORE_KICKOFF as Ln, init_ohmypi_parser as Lr, BRIDGE_TOKEN_HEADER as Lt, broadcastCommit as M, decideChannelsForWorkAgent as Mn, init_agent_runtime as Mr, deliverResumeMessageWithTranscriptConfirmation as Mt, init_tier_feed as N, decideSupervisorForWorkAgent as Nn, applyCodexAuthBurnFlag as Nr, setAgentDeliveryMethod as Nt, loadPrdDraft as O, getOpenAIAuthStatus as On, getAgentRuntimeStateSync as Or, setCachedMemoryVerdict as Ot, decideEscalation as P, dismissDevChannelsDialog as Pn, checkCodexAuthStatus as Pr, captureTranscriptUserRecordSnapshot as Pt, operatorInterventionEvent as Q, isAgentTroubled as Qn, resolveTier as Qt, reconcileSlotState as R, __testInternals as Rn, parseOhmypiSessionCostResultSync as Rr, init_bridge_token as Rt, contextWindowForModel as S, determineModel as Sn, isQualifiedAgentId as Sr, resetPatrolDispatchBudget as St, shouldReplayCompactAtTierRunBoundary as T, getProviderTmuxFlags as Tn, waitForAgentIdle as Tr, workResumeSlotsAvailable as Tt, buildCompactRecoverySeed as U, clearYieldForResumeSync as Un, init_spawn_prep as Ut, recoverAgent as V, clearAgentTroubled as Vn, buildAgentLaunchConfig as Vt, init_resume as W, decideResumeGate as Wn, retrieveSpawnTimeMemoryContext as Wt, messageAgent as X, init_agent_state as Xn, resolveStaffing as Xt, init_messaging as Y, getAgentStateSync as Yn, resolveImplicitStaffing as Yt, init_operator_interventions as Z, isAgentPaused as Zn, init_resolve_tier as Zt, init_linux as _, materializeAcpContextFile as _n, init_pty_token as _r, emergencyBrake as _t, listRunningAgentsSync as a, getProviderAuthMode as an, recordAgentFailureSync as ar, saveSessionId as at, init_agents as b, buildCavemanExports as bn, resolvePtySupervisorScriptPath as br, releaseAdvancingSlot as bt, getRuntimeCensus as c, injectPiConversationMemory as cn, saveAgentState as cr, init_spawn as ct, panePidsForSession as d, waitForPromptReady as dn, setAgentPausedSync as dr, init_termination as dt, describeOhmypiSpawnFailure as en, markAgentRunning as er, getActivity as et, refreshRuntimeCensus as f, init_pi_fifo as fn, setAgentYieldedSync as fr, stopAgent as ft, LINUX_MEMORY_PRESSURE_DEFAULTS as g, init_context as gn, readAgentHarnessModelRecordSync as gr, describeRunningAgents as gt, init_collector as h, ohmypiFifoPaths as hn, init_agent_record_sync as hr, countRunningSwarmSlotsForIssue as ht, listRunningAgents as i, getOhmypiLauncherFields as in, recordAgentFailure as ir, init_activity as it, supervisorAgentId as j, buildResumeContinueMessage as jn, getAgentRuntimeSnapshot as jr, deliverInitialPromptWithRetry as jt, shouldSupervise as k, init_openai_auth as kn, init_runtime_state as kr, deliverAgentMessage as kt, getRuntimeCensusSnapshot as l, roleAgentDefinitionPath as ln, saveAgentStateSync as lr, spawnAgent as lt, createHostHealthCollector as m, init_ohmypi_fifo as mn, writeAgentStateJsonSync as mr, countRunningAgents as mt, init_queries as n, getAgentRuntimeBaseCommand as nn, markAgentStoppedState as nr, getLatestSessionIdSync as nt, warnOnBareNumericIssueIds as o, getRoleRuntimeBaseCommand as on, recordStartupSessionExit as or, createOhmypiRuntimeSync as ot, runtimeCensusHasHarnessProcess as p, piFifoPaths as pn, wipeAgentStateDirs as pr, stopAgentSync as pt, isContextOverflowError as q, getAgentState as qn, init_staffing as qt, listAgentStates as r, getCodexLauncherFields as rn, markAgentTroubled as rr, getSessionId as rt, descendantPidsForSession as s, init_runtime_command as sn, resetAgentFailureCount as sr, init_ohmypi as st, dropLegacyAgentStatesMissingRoleAsync as t, getAcpLauncherFields as tn, markAgentRunningState as tr, getLatestSessionId as tt, init_runtime_census as u, waitForAcpHostReady as un, setAgentPaused as ur, spawnRun as ut, DARWIN_MEMORY_PRESSURE_DEFAULTS as v, getClaudeAuthStatus as vn, writePtyToken as vr, getConcurrencyLimits as vt, replayStandingAgent as w, getProviderExportsForModel as wn, resolveAgentTargetSync as wr, tryReserveSwarmSlot as wt, compactAtTierRunBoundary as x, buildSpawnEnvForModel as xn, clearReadySignal as xr, releaseSwarmSlot as xt, init_darwin as y, init_claude_auth as yn, init_pty_supervisor_locate as yr, init_concurrency as yt, autoRecoverAgents as z, clearAgentPaused as zn, writeBridgeTokenSync as zt };
8213
9212
 
8214
- //# sourceMappingURL=queries-ZABd5aXP.js.map
9213
+ //# sourceMappingURL=queries-CjNIf-Ub.js.map