@overdeck/desktop 0.45.23 → 0.46.0

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 (549) hide show
  1. package/drizzle/overdeck/0000_overdeck_init.sql +34 -0
  2. package/package.json +1 -1
  3. package/server/{acceptance-criteria-DOA0KgXx.js → acceptance-criteria-CCwFGICj.js} +2 -2
  4. package/server/activity-logger-CMthG6Vd.js +3 -0
  5. package/server/{activity-logger-DDlOIAML.js → activity-logger-CyteR4JO.js} +24 -13
  6. package/server/{advancing-selfheal-BBu6DSNm.js → advancing-selfheal-De1L-Sb4.js} +6 -6
  7. package/server/{agent-gc-BV1q_2EV.js → agent-gc-CBULruzm.js} +5 -5
  8. package/server/agent-state-VQk8fY9F.js +3 -0
  9. package/server/{agent-state-service-HoK8U4jW.js → agent-state-service-BlnSkRFA.js} +5 -5
  10. package/server/{agent-state-service-CnzFKSAQ.js → agent-state-service-hZpxIw1E.js} +1 -1
  11. package/server/agents-BKKkxKgK.js +3 -0
  12. package/server/{agents-B4Bjbkfv.js → agents-C5rWYhb6.js} +4 -4
  13. package/server/archive-planning-0FJ6Xd3b.js +2 -0
  14. package/server/{archive-planning-DYrYojxl.js → archive-planning-C0lAbNB_.js} +16 -24
  15. package/server/{artifact-index-jobs-C-xy7Z5v.js → artifact-index-jobs-ug6ZxIP5.js} +2 -2
  16. package/server/assemble-DnffNpOo.js +339 -0
  17. package/server/{backlog-auto-trigger-GtG71X8H.js → backlog-auto-trigger-Dh-i9PQf.js} +3 -3
  18. package/server/{behavior-B_-4EKF3.js → behavior-CfIg6pKp.js} +2 -2
  19. package/server/bridge-pool-patrol-CUFmjVDN.js +136 -0
  20. package/server/{briefing-freshness-DWdW7vUm.js → briefing-freshness-DHmCSLar.js} +2 -2
  21. package/server/{build-info-DgTqZkL5.js → build-info-BP160gU7.js} +1 -1
  22. package/server/{build-info-BT096lEl.js → build-info-CuFfxZxp.js} +5 -3
  23. package/server/{checkpoint-manager-DDqcGyu8.js → checkpoint-manager-DEWD82qK.js} +2 -2
  24. package/server/{checkpoint-manager-B7Bt29J0.js → checkpoint-manager-Dxh0FYsv.js} +1 -1
  25. package/server/checkpoint-worker.js +1 -1
  26. package/server/{checkpoints-C-AXLfYT.js → checkpoints-CZvbtLnr.js} +2 -2
  27. package/server/{checkpoints-CpgCjAlN.js → checkpoints-DMTgXuLG.js} +1 -1
  28. package/server/{claude-hooks-provision-C8wdRnN1.js → claude-hooks-provision-CN-xo-do.js} +1 -1
  29. package/server/{claude-hooks-provision-but-_qGY.js → claude-hooks-provision-fvy4RD2b.js} +13 -2
  30. package/server/{claude-permissions-H_5wHQZQ.js → claude-permissions-CN0cSCPp.js} +2 -2
  31. package/server/{claude-settings-overlay-CbSz0Dvb.js → claude-settings-overlay-CJn35FHQ.js} +2 -2
  32. package/server/{claude-settings-overlay-BTENVmYf.js → claude-settings-overlay-Dabi9slj.js} +1 -1
  33. package/server/cli-DmXETsw-.js +3 -0
  34. package/server/{cli-vBeXbPrq.js → cli-oCWYA1pE.js} +9 -9
  35. package/server/{cliproxy-Bgb2XCqi.js → cliproxy-C8mB3KuB.js} +2 -2
  36. package/server/{cliproxy-DW0V86F8.js → cliproxy-PGwTX_o8.js} +1 -1
  37. package/server/{close-issue-Dn_4c4G8.js → close-issue-D5MF5GqF.js} +5 -5
  38. package/server/{closed-issue-reaper-CWpY2uBw.js → closed-issue-reaper-CJ24u0Zt.js} +1 -1
  39. package/server/{closed-issue-reaper-hANY_ehE.js → closed-issue-reaper-Cltx86x5.js} +37 -16
  40. package/server/{codex-Dg7Is5yb.js → codex-BdEsUFWh.js} +1 -1
  41. package/server/{codex-TmSi-yTv.js → codex-Drlf5Xhf.js} +37 -8
  42. package/server/{codex-parser-C4gSH-IR.js → codex-parser-DpB89Vqa.js} +2 -2
  43. package/server/compaction-continuation-K2AxQX4H.js +200 -0
  44. package/server/{config-DjLOdbgT.js → config-B2IMcBxx.js} +4 -3
  45. package/server/{config-DUIhMN_T.js → config-DV-grfQc.js} +1 -1
  46. package/server/{config-CCvjQf27.js → config-Dr3pW6w6.js} +2 -2
  47. package/server/{config-yaml-DvyMuOle.js → config-yaml-CmOPzmBb.js} +290 -22
  48. package/server/{conflict-gate-CmrYpa47.js → conflict-gate-B9cN3SBi.js} +4 -4
  49. package/server/{conflict-gate-BSJkNTdp.js → conflict-gate-Dh754uyA.js} +1 -1
  50. package/server/context-layers-D6LZo3l1.js +4 -0
  51. package/server/context-layers-dR5YxHYB.js +37 -0
  52. package/server/{control-settings-aP1ANIlI.js → control-settings-C7DUehE1.js} +49 -19
  53. package/server/{conversation-compaction-CNbTLB86.js → conversation-compaction-BoqdDXWF.js} +8 -8
  54. package/server/{conversation-compaction-DiG5zWQq.js → conversation-compaction-Dj4FAKoZ.js} +1 -1
  55. package/server/{conversation-service-Du-MTNpJ.js → conversation-service-5aCnq1zR.js} +331 -20
  56. package/server/conversation-service-BCxl4f8Z.js +3 -0
  57. package/server/{conversations-DbOs1e9Q.js → conversations-BUpYsOZg.js} +5 -5
  58. package/server/{conversations-6mPANqvL.js → conversations-C34dyIb9.js} +1 -1
  59. package/server/{cost-Ca0YTWDw.js → cost-Bgcub5kW.js} +12 -2
  60. package/server/{cost-CW4WSe72.js → cost-CvxRrucd.js} +3 -3
  61. package/server/{cost-sync-C0VdGme1.js → cost-sync-Dv3LUaNW.js} +3 -3
  62. package/server/{dag-CdOjJVDT.js → dag-ombYYt4s.js} +2 -2
  63. package/server/{dangerous-git-ops-CT-IypG3.js → dangerous-git-ops-BcJPC5Rr.js} +1 -1
  64. package/server/dashboard-db-worker.js +7 -7
  65. package/server/deacon-DrXqT9LQ.js +4 -0
  66. package/server/{deacon-pRnyD5w9.js → deacon-hi9KLPLT.js} +2998 -2659
  67. package/server/{deacon-nudge-log-Bjg8U4Y9.js → deacon-nudge-log-BNBebzeL.js} +3 -3
  68. package/server/deacon-pending-lifecycle-Cpk0k7Hi.js +33 -0
  69. package/server/{deacon-swarm-DftYRDo8.js → deacon-swarm-DBxUaO-A.js} +13 -13
  70. package/server/deacon-swarm-I2JfX5Tg.js +2 -0
  71. package/server/deacon.js +14 -19
  72. package/server/dead-end-trip-CQcP70ND.js +13 -0
  73. package/server/delivery-Da0zEMY4.js +3 -0
  74. package/server/{deploy-patrol-Bjsho_ha.js → deploy-patrol-Df-Tmaq0.js} +69 -18
  75. package/server/deploy-queue-9SrhZR63.js +3 -0
  76. package/server/deploy-queue-UjKGYsDe.js +169 -0
  77. package/server/deploy-window-jOiPRHL0.js +3 -0
  78. package/server/{deploy-window-DeP_OIRk.js → deploy-window-rpqpWqHA.js} +40 -16
  79. package/server/{dev-supervisor-BpMoHlkR.js → dev-supervisor-CC46Ig8q.js} +2 -2
  80. package/server/{devcontainer-renderer-CtUgrVKW.js → devcontainer-renderer-68CSCRnu.js} +3 -3
  81. package/server/{dist-DyRx4cI7.js → dist-CJy72uEg.js} +1 -1
  82. package/server/dist-DSlxIU1H.js +3 -0
  83. package/server/{dist-src-BSoS7mkd.js → dist-src-Bik83hFi.js} +1 -1
  84. package/server/docker-BMVTSFL5.js +3 -0
  85. package/server/{docker-BK7HIcBj.js → docker-Dam7mbIB.js} +2 -2
  86. package/server/{dod-BrSfUHm0.js → dod-Dar-yheg.js} +8 -4
  87. package/server/durable-review-pipeline-CGZ5QBxh.js +17 -0
  88. package/server/durable-review-pipeline-jpgCJZFp.js +3 -0
  89. package/server/{ensure-devcontainer-DseivYEy.js → ensure-devcontainer-B057YA81.js} +4 -4
  90. package/server/{ensure-devcontainer-DRqaAkBR.js → ensure-devcontainer-C98V8yW-.js} +1 -1
  91. package/server/{esm-shims-CbI3BVkl.js → esm-shims-Br9BPdkR.js} +1 -1
  92. package/server/{event-store-Cr5PQwFC.js → event-store-ELqkVOn0.js} +1 -1
  93. package/server/{event-store-tdiY5eDZ.js → event-store-zY5MJHgF.js} +23 -4
  94. package/server/{events-CvvGK6LT.js → events-D6pyqhzM.js} +1 -1
  95. package/server/{events-CC1dgUpx.js → events-D9PR1IC0.js} +3 -3
  96. package/server/{factory-CynerjXO.js → factory-CRoOpGsF.js} +5 -5
  97. package/server/{feature-registry-population-B0pmAz0a.js → feature-registry-population--YUXU999.js} +4 -4
  98. package/server/{feature-registry-storage-_wUBRD3J.js → feature-registry-storage-BORBTo0y.js} +2 -2
  99. package/server/{features-Dhxz-wLc.js → features--nFkJY8v.js} +2 -2
  100. package/server/{feedback-target-iygZwmMc.js → feedback-target-C0ZzyHvU.js} +1 -1
  101. package/server/{feedback-target-CPS15Vte.js → feedback-target-Dt9BsapX.js} +8 -8
  102. package/server/{feedback-writer-C9b6ccN1.js → feedback-writer-BG0RUZiu.js} +5 -5
  103. package/server/{feedback-writer-qmiMbqTZ.js → feedback-writer-D1fm-5Z8.js} +1 -1
  104. package/server/flywheel-BekukH4i.js +2 -0
  105. package/server/flywheel-BiT3odRb.js +1092 -0
  106. package/server/flywheel-CLVB55Be.js +478 -0
  107. package/server/flywheel-merge-order-BJv1DZz1.js +462 -0
  108. package/server/flywheel-merge-order-BKw9o6ku.js +2 -0
  109. package/server/forge-CZbSg6Ds.js +383 -0
  110. package/server/forge-DK3blQb_.js +3 -0
  111. package/server/{from-CJ_aH5jD.js → from-D_4_dk7i.js} +1 -1
  112. package/server/{fts-db-CKgg0VKg.js → fts-db-BeOomFa-.js} +2 -2
  113. package/server/{fts-operations-BrL_VTRr.js → fts-operations-BdewJ_g9.js} +2 -2
  114. package/server/git-utils-CI6cwyyC.js +3 -0
  115. package/server/{git-utils-BVa07a4a.js → git-utils-ameCgDdy.js} +93 -3
  116. package/server/{github-app-CMBdIFBQ.js → github-app-CQ1Lo6LA.js} +19 -8
  117. package/server/{github-app-CPfoFAdV.js → github-app-DtAsvwzK.js} +1 -1
  118. package/server/{github-client--XVlDpwM.js → github-client-BfyDxuRN.js} +2 -2
  119. package/server/{github-client-B4QsdE-X.js → github-client-Cj0yl_07.js} +1 -1
  120. package/server/github-pr-lookup-BDq6Wznz.js +58 -0
  121. package/server/{harness-binary-CVio2m-u.js → harness-binary-DqkftwTb.js} +32 -6
  122. package/server/{harness-resolve-qHJBhy3Z.js → harness-resolve-CqMqM1Mb.js} +18 -9
  123. package/server/{health-events-C9B8y1Hm.js → health-events-CazRxJUS.js} +2 -2
  124. package/server/{health-events-CpfvuVmm.js → health-events-_xfTaOUs.js} +1 -1
  125. package/server/{hooks-DUXw8A0-.js → hooks-BO3QT1sn.js} +2 -2
  126. package/server/{hooks-ltecuFqZ.js → hooks-BnJsxlSq.js} +1 -1
  127. package/server/{hume-BEq0bUDg.js → hume-CDYJxqx-.js} +2 -2
  128. package/server/hume-Dq--7rOQ.js +3 -0
  129. package/server/{idle-stack-reaper-D7w9t3fE.js → idle-stack-reaper-BYqERdkE.js} +1 -1
  130. package/server/{idle-stack-reaper-w1ISSlhs.js → idle-stack-reaper-CnGx_PO_.js} +99 -6
  131. package/server/in-flight-guard-Bq3epG58.js +45 -0
  132. package/server/{infra-CzaSOgul.js → infra-BjuxvjdS.js} +80 -5
  133. package/server/{injection-oNZeoDhL.js → injection-DZxlV2al.js} +1 -1
  134. package/server/{injection-DZ0PfYa4.js → injection-UCf8EsjX.js} +191 -183
  135. package/server/{inspect-agent-DJKLWcVT.js → inspect-agent-6kylZnrm.js} +139 -82
  136. package/server/inspect-agent-BVwDrVrz.js +2 -0
  137. package/server/{internal-token-Bb4XeV2x.js → internal-token-DvMTQSOS.js} +2 -2
  138. package/server/{internal-token-DXdfprGr.js → internal-token-M9omeXM1.js} +1 -1
  139. package/server/{io-B3_AHDfr.js → io-VHvc0Ssp.js} +43 -26
  140. package/server/{issue-closed-zhdvQicO.js → issue-closed-B6KJkmHZ.js} +7 -7
  141. package/server/{issue-lifecycle-Dy4vd0Oa.js → issue-lifecycle-9gk3fnXN.js} +1 -1
  142. package/server/{issue-lifecycle-CreaCkjW.js → issue-lifecycle-C4Zj0WmE.js} +34 -28
  143. package/server/{issue-service-singleton-B5ushCvE.js → issue-service-singleton-DmCh7EHj.js} +10 -10
  144. package/server/{issue-service-singleton-DabvBWUp.js → issue-service-singleton-PMx8F1jr.js} +1 -1
  145. package/server/{issues-B6ToV6x1.js → issues-CgnQ1OGQ.js} +2 -2
  146. package/server/{jsonl-parser-Dhflo1SH.js → jsonl-parser-DJOH_O-w.js} +5 -4
  147. package/server/{label-cleanup-BKPJm4Hv.js → label-cleanup-Dv7AV_R1.js} +3 -3
  148. package/server/{label-reconciler-DdWbHEBu.js → label-reconciler--F85rufp.js} +4 -4
  149. package/server/{lifecycle-DfeyBDwA.js → lifecycle-CTdOWYMi.js} +2 -2
  150. package/server/{lifecycle-sycO16hj.js → lifecycle-DDN8ApVY.js} +6 -7
  151. package/server/{lifecycle-io-D8iNBcux.js → lifecycle-io-D-lGdzK3.js} +5 -5
  152. package/server/{lifecycle-io-Bsnr2K4F.js → lifecycle-io-D_zTLvP1.js} +1 -1
  153. package/server/{linear-client-D4zqMnX7.js → linear-client-BQU36QqE.js} +2 -2
  154. package/server/{linear-client-DqhDQO9k.js → linear-client-CY4O_Tu3.js} +1 -1
  155. package/server/linear-mcp-auth-BnU4TYfY.js +280 -0
  156. package/server/linear-mcp-auth-NYBq_oHZ.js +2 -0
  157. package/server/memory-fts-worker.js +1 -1
  158. package/server/{merge-C_ZEhbqI.js → merge-Bpx4jjht.js} +13 -11
  159. package/server/{merge-agent-XrB80vfT.js → merge-agent-DdMVSV2Y.js} +233 -83
  160. package/server/{merge-agent-BQM3a8z5.js → merge-agent-DrXa1CpW.js} +1 -1
  161. package/server/{merge-batch-Bwoyr8Je.js → merge-batch-C5q1c1GX.js} +1 -1
  162. package/server/merge-completeness-BMm8tMyZ.js +277 -0
  163. package/server/merge-completeness-D0ljXbk3.js +3 -0
  164. package/server/{merge-DK23JEdS.js → merge-idOG--29.js} +1 -1
  165. package/server/merge-ops-DdpTiEMt.js +2 -0
  166. package/server/merge-rebase-DGQpYJU3.js +2 -0
  167. package/server/{merge-rebase-C1KIVr0s.js → merge-rebase-xLnMlw5h.js} +3 -3
  168. package/server/merge-set-DH7ot3yz.js +89 -0
  169. package/server/merge-set-DzsOTBg5.js +3 -0
  170. package/server/{merge-sync-DZ9dojJn.js → merge-sync-CQ-LgZ1_.js} +406 -153
  171. package/server/merge-sync-Ca7F5JnQ.js +3 -0
  172. package/server/{merge-train-DxDfBTjr.js → merge-train-DTEMyIu4.js} +18 -8
  173. package/server/{merge-train-deps-CyYQUksx.js → merge-train-deps-CNPJzepw.js} +4 -4
  174. package/server/merge-verification-x3JO8Dtz.js +220 -0
  175. package/server/merged-docker-cleanup-worker-CTpC27Bs.js +107 -0
  176. package/server/merged-docker-cleanup-worker-Cdi9apm-.js +3 -0
  177. package/server/{multipart-parser-Dt8YPN5S.js → multipart-parser-IMSBfePV.js} +2 -2
  178. package/server/{no-resume-mode-Cx3K0hHi.js → no-resume-mode-C5ULAXwO.js} +1 -1
  179. package/server/node_modules/.package-lock.json +27 -27
  180. package/server/node_modules/@effect/platform-node/node_modules/@effect/platform-node-shared/package.json +3 -3
  181. package/server/node_modules/@google-cloud/common/package.json +2 -2
  182. package/server/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  183. package/server/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +1 -1
  184. package/server/node_modules/gaxios/package.json +1 -1
  185. package/server/node_modules/google-auth-library/build/src/auth/googleauth.js +24 -19
  186. package/server/node_modules/google-auth-library/package.json +1 -1
  187. package/server/node_modules/google-gax/build/protos/google/api/auth.proto +2 -1
  188. package/server/node_modules/google-gax/build/protos/google/api/backend.proto +12 -1
  189. package/server/node_modules/google-gax/build/protos/google/api/billing.proto +1 -1
  190. package/server/node_modules/google-gax/build/protos/google/api/client.proto +165 -53
  191. package/server/node_modules/google-gax/build/protos/google/api/cloudquotas/v1/resources.proto +1 -1
  192. package/server/node_modules/google-gax/build/protos/google/api/cloudquotas/v1beta/quota_adjuster_settings.proto +7 -3
  193. package/server/node_modules/google-gax/build/protos/google/api/cloudquotas/v1beta/resources.proto +1 -1
  194. package/server/node_modules/google-gax/build/protos/google/api/config_change.proto +1 -1
  195. package/server/node_modules/google-gax/build/protos/google/api/context.proto +1 -1
  196. package/server/node_modules/google-gax/build/protos/google/api/control.proto +3 -3
  197. package/server/node_modules/google-gax/build/protos/google/api/distribution.proto +1 -1
  198. package/server/node_modules/google-gax/build/protos/google/api/documentation.proto +1 -1
  199. package/server/node_modules/google-gax/build/protos/google/api/endpoint.proto +1 -1
  200. package/server/node_modules/google-gax/build/protos/google/api/error_reason.proto +186 -1
  201. package/server/node_modules/google-gax/build/protos/google/api/expr/v1alpha1/checked.proto +31 -3
  202. package/server/node_modules/google-gax/build/protos/google/api/expr/v1alpha1/eval.proto +8 -9
  203. package/server/node_modules/google-gax/build/protos/google/api/expr/v1alpha1/explain.proto +1 -2
  204. package/server/node_modules/google-gax/build/protos/google/api/expr/v1alpha1/syntax.proto +20 -22
  205. package/server/node_modules/google-gax/build/protos/google/api/expr/v1alpha1/value.proto +2 -3
  206. package/server/node_modules/google-gax/build/protos/google/api/field_behavior.proto +1 -1
  207. package/server/node_modules/google-gax/build/protos/google/api/field_info.proto +1 -1
  208. package/server/node_modules/google-gax/build/protos/google/api/http.proto +1 -1
  209. package/server/node_modules/google-gax/build/protos/google/api/httpbody.proto +1 -1
  210. package/server/node_modules/google-gax/build/protos/google/api/label.proto +1 -1
  211. package/server/node_modules/google-gax/build/protos/google/api/launch_stage.proto +1 -1
  212. package/server/node_modules/google-gax/build/protos/google/api/log.proto +1 -1
  213. package/server/node_modules/google-gax/build/protos/google/api/logging.proto +1 -1
  214. package/server/node_modules/google-gax/build/protos/google/api/metric.proto +1 -1
  215. package/server/node_modules/google-gax/build/protos/google/api/monitored_resource.proto +1 -1
  216. package/server/node_modules/google-gax/build/protos/google/api/monitoring.proto +1 -1
  217. package/server/node_modules/google-gax/build/protos/google/api/policy.proto +1 -1
  218. package/server/node_modules/google-gax/build/protos/google/api/quota.proto +1 -1
  219. package/server/node_modules/google-gax/build/protos/google/api/resource.proto +1 -1
  220. package/server/node_modules/google-gax/build/protos/google/api/routing.proto +8 -4
  221. package/server/node_modules/google-gax/build/protos/google/api/service.proto +2 -3
  222. package/server/node_modules/google-gax/build/protos/google/api/source_info.proto +1 -1
  223. package/server/node_modules/google-gax/build/protos/google/api/system_parameter.proto +1 -1
  224. package/server/node_modules/google-gax/build/protos/google/api/usage.proto +7 -27
  225. package/server/node_modules/google-gax/build/protos/google/api/visibility.proto +1 -1
  226. package/server/node_modules/google-gax/build/protos/google/longrunning/operations.proto +20 -1
  227. package/server/node_modules/google-gax/build/protos/google/protobuf/any.proto +52 -108
  228. package/server/node_modules/google-gax/build/protos/google/protobuf/compiler/ruby/ruby_generated_code.proto +2 -0
  229. package/server/node_modules/google-gax/build/protos/google/protobuf/cpp_features.proto +21 -1
  230. package/server/node_modules/google-gax/build/protos/google/protobuf/cpp_file_options.proto +24 -0
  231. package/server/node_modules/google-gax/build/protos/google/protobuf/cpp_options.proto +15 -0
  232. package/server/node_modules/google-gax/build/protos/google/protobuf/descriptor.proto +118 -30
  233. package/server/node_modules/google-gax/build/protos/google/protobuf/field_mask.proto +16 -18
  234. package/server/node_modules/google-gax/build/protos/google/protobuf/internal_options.proto +8 -1
  235. package/server/node_modules/google-gax/build/protos/google/protobuf/json/json_enumval_custom_string.proto +26 -0
  236. package/server/node_modules/google-gax/build/protos/google/protobuf/json_enumvalue_options.proto +29 -0
  237. package/server/node_modules/google-gax/build/protos/google/protobuf/json_options.proto +14 -0
  238. package/server/node_modules/google-gax/build/protos/google/protobuf/struct.proto +38 -22
  239. package/server/node_modules/google-gax/build/protos/google/protobuf/test_protos/forced_micro_string.proto +3 -0
  240. package/server/node_modules/google-gax/build/protos/google/protobuf/test_protos/repeated_field_proxy_import_message.proto +14 -0
  241. package/server/node_modules/google-gax/build/protos/google/protobuf/timestamp.proto +9 -8
  242. package/server/node_modules/google-gax/build/protos/google/protobuf/util/json_format_proto3.proto +18 -0
  243. package/server/node_modules/google-gax/build/protos/google/rpc/code.proto +1 -1
  244. package/server/node_modules/google-gax/build/protos/google/rpc/context/attribute_context.proto +7 -2
  245. package/server/node_modules/google-gax/build/protos/google/rpc/context/audit_context.proto +1 -1
  246. package/server/node_modules/google-gax/build/protos/google/rpc/error_details.proto +5 -5
  247. package/server/node_modules/google-gax/build/protos/google/rpc/http.proto +1 -1
  248. package/server/node_modules/google-gax/build/protos/google/rpc/status.proto +1 -2
  249. package/server/node_modules/google-gax/build/protos/google/type/calendar_period.proto +1 -1
  250. package/server/node_modules/google-gax/build/protos/google/type/color.proto +9 -10
  251. package/server/node_modules/google-gax/build/protos/google/type/date.proto +11 -9
  252. package/server/node_modules/google-gax/build/protos/google/type/datetime.proto +17 -17
  253. package/server/node_modules/google-gax/build/protos/google/type/dayofweek.proto +1 -1
  254. package/server/node_modules/google-gax/build/protos/google/type/decimal.proto +11 -13
  255. package/server/node_modules/google-gax/build/protos/google/type/expr.proto +1 -1
  256. package/server/node_modules/google-gax/build/protos/google/type/fraction.proto +1 -1
  257. package/server/node_modules/google-gax/build/protos/google/type/interval.proto +1 -2
  258. package/server/node_modules/google-gax/build/protos/google/type/latlng.proto +4 -5
  259. package/server/node_modules/google-gax/build/protos/google/type/localized_text.proto +3 -3
  260. package/server/node_modules/google-gax/build/protos/google/type/money.proto +1 -2
  261. package/server/node_modules/google-gax/build/protos/google/type/month.proto +1 -1
  262. package/server/node_modules/google-gax/build/protos/google/type/phone_number.proto +20 -15
  263. package/server/node_modules/google-gax/build/protos/google/type/postal_address.proto +39 -39
  264. package/server/node_modules/google-gax/build/protos/google/type/quaternion.proto +4 -4
  265. package/server/node_modules/google-gax/build/protos/google/type/timeofday.proto +11 -8
  266. package/server/node_modules/google-gax/package.json +5 -5
  267. package/server/node_modules/retry-request/package.json +4 -4
  268. package/server/node_modules/teeny-request/package.json +5 -5
  269. package/server/node_modules/undici/README.md +5 -0
  270. package/server/node_modules/undici/docs/docs/api/Client.md +4 -0
  271. package/server/node_modules/undici/docs/docs/api/Dispatcher.md +6 -0
  272. package/server/node_modules/undici/docs/docs/api/Interceptors.md +59 -0
  273. package/server/node_modules/undici/docs/docs/api/MockAgent.md +27 -0
  274. package/server/node_modules/undici/docs/docs/api/MockPool.md +28 -1
  275. package/server/node_modules/undici/docs/docs/index.md +5 -0
  276. package/server/node_modules/undici/lib/cache/memory-cache-store.js +54 -9
  277. package/server/node_modules/undici/lib/cache/sqlite-cache-store.js +7 -1
  278. package/server/node_modules/undici/lib/core/request.js +13 -2
  279. package/server/node_modules/undici/lib/core/util.js +6 -1
  280. package/server/node_modules/undici/lib/dispatcher/agent.js +3 -3
  281. package/server/node_modules/undici/lib/dispatcher/client-h1.js +42 -8
  282. package/server/node_modules/undici/lib/dispatcher/client-h2.js +34 -43
  283. package/server/node_modules/undici/lib/global.js +36 -16
  284. package/server/node_modules/undici/lib/handler/cache-handler.js +269 -61
  285. package/server/node_modules/undici/lib/handler/cache-revalidation-handler.js +13 -3
  286. package/server/node_modules/undici/lib/handler/redirect-handler.js +5 -2
  287. package/server/node_modules/undici/lib/handler/retry-handler.js +30 -4
  288. package/server/node_modules/undici/lib/interceptor/cache.js +159 -52
  289. package/server/node_modules/undici/lib/interceptor/decompress.js +9 -2
  290. package/server/node_modules/undici/lib/mock/mock-interceptor.js +25 -7
  291. package/server/node_modules/undici/lib/mock/mock-utils.js +39 -10
  292. package/server/node_modules/undici/lib/util/cache.js +372 -68
  293. package/server/node_modules/undici/lib/util/date.js +23 -6
  294. package/server/node_modules/undici/lib/web/cookies/util.js +78 -8
  295. package/server/node_modules/undici/lib/web/fetch/body.js +2 -1
  296. package/server/node_modules/undici/lib/web/fetch/response.js +1 -3
  297. package/server/node_modules/undici/package.json +2 -2
  298. package/server/node_modules/undici/types/client.d.ts +2 -2
  299. package/server/node_modules/undici/types/dispatcher.d.ts +3 -3
  300. package/server/node_modules/undici/types/mock-interceptor.d.ts +5 -1
  301. package/server/{orphan-proposed-reconciler-BTkDrl4R.js → orphan-proposed-reconciler-CWmOdM9-.js} +1 -1
  302. package/server/{orphan-proposed-reconciler-neK8dHQk.js → orphan-proposed-reconciler-Dg6U4ADZ.js} +24 -15
  303. package/server/package-lock.json +28 -28
  304. package/server/package.json +1 -1
  305. package/server/{pan-dir-DeVUgwA7.js → pan-dir-ubraCiUg.js} +24 -10
  306. package/server/{paths-_zEts6wc.js → paths-cXmOwSbh.js} +2 -2
  307. package/server/pending-lifecycle-claim-DEteYdS9.js +110 -0
  308. package/server/{pickup-Dd0Znxxy.js → pickup-D8xtG1J2.js} +17 -16
  309. package/server/pipeline-membership-BGSvkT2M.js +3 -0
  310. package/server/pipeline-membership-CrAPLYtf.js +57 -0
  311. package/server/{pipeline-membership-0HaEGDlH.js → pipeline-membership-gather-CET40frr.js} +177 -109
  312. package/server/pipeline-membership-gather-DTfcgxLl.js +3 -0
  313. package/server/{pipeline-notifier-D0ykk59O.js → pipeline-notifier-BuQ0e4hF.js} +2 -2
  314. package/server/{pipeline-notifier-6iCJplFZ.js → pipeline-notifier-ImNXknf0.js} +1 -1
  315. package/server/post-merge-lifecycle-worker-DbO10pum.js +50 -0
  316. package/server/{project-pipelines-2sK1apsO.js → project-pipelines-Bim6bThI.js} +2 -2
  317. package/server/project-repos-C0nuoBGv.js +98 -0
  318. package/server/project-repos-CRE6Ykow.js +3 -0
  319. package/server/projects-B03Wr-xc.js +3 -0
  320. package/server/{prompts-Dp4Tpk39.js → prompts-BEx08AIu.js} +2 -2
  321. package/server/{providers-DKkBXhxU.js → providers-D7IluJe0.js} +1 -1
  322. package/server/{providers-DV7ec8l7.js → providers-evXhiQeg.js} +7 -7
  323. package/server/public/assets/{chunk-BO2N2NFS-CltymLRg.js → chunk-BO2N2NFS-D1s4-Sqp.js} +4 -4
  324. package/server/public/assets/{diagram-OG6HWLK6-D2f6pjgA.js → diagram-OG6HWLK6-1gdMoSF7.js} +1 -1
  325. package/server/public/assets/{dist-BWR4qFiV.js → dist-CxAOHbil.js} +1 -1
  326. package/server/public/assets/{dist-DEmlBBNQ.js → dist-DqDRYW6P.js} +3 -3
  327. package/server/public/assets/{ganttDiagram-6RSMTGT7-DnfiViPK.js → ganttDiagram-6RSMTGT7-BYex-Ec7.js} +1 -1
  328. package/server/public/assets/{highlighted-body-OFNGDK62-B8Wrmj9H.js → highlighted-body-OFNGDK62-DlVkiG0S.js} +1 -1
  329. package/server/public/assets/index-Cc7cnFC4.css +1 -0
  330. package/server/public/assets/index-K0hAYCgV.js +807 -0
  331. package/server/public/assets/{linear-C9zFQpkX.js → linear-B4cuEFmO.js} +1 -1
  332. package/server/public/assets/mermaid-GHXKKRXX-DyDHFXHV.js +1 -0
  333. package/server/public/assets/{pieDiagram-4H26LBE5-lR8H7Yjd.js → pieDiagram-4H26LBE5-CBHNBIJQ.js} +1 -1
  334. package/server/public/assets/{prod-B1jCQihw.js → prod-CN2nHBvX.js} +4 -4
  335. package/server/public/assets/{quadrantDiagram-W4KKPZXB-CVQ2guem.js → quadrantDiagram-W4KKPZXB-Bom87VOQ.js} +1 -1
  336. package/server/public/assets/{sankeyDiagram-5OEKKPKP-eD1RB4gm.js → sankeyDiagram-5OEKKPKP-UrBeyLxk.js} +1 -1
  337. package/server/public/assets/{xychartDiagram-2RQKCTM6-ChEC6dQn.js → xychartDiagram-2RQKCTM6-DhkbrIxR.js} +1 -1
  338. package/server/public/index.html +2 -2
  339. package/server/{pull-requests--Ib2jTgy.js → pull-requests-Cv7LxzUN.js} +1 -1
  340. package/server/{pull-requests-CXIhdCYD.js → pull-requests-DHWiKxo7.js} +19 -10
  341. package/server/{queries-6d7Cdtm7.js → queries-DHJm7bTd.js} +1134 -203
  342. package/server/{rally-B708-nZn.js → rally-B71M9f4o.js} +3 -3
  343. package/server/rally-YDjU513q.js +3 -0
  344. package/server/{rally-api-yjQ0TfHd.js → rally-api-D5uXN08-.js} +1 -1
  345. package/server/{rally-api-nY0ZANw3.js → rally-api-Dkqmok65.js} +2 -2
  346. package/server/{rally-client-B1EJhfV0.js → rally-client-Bfqm6XI4.js} +4 -4
  347. package/server/{rally-client-CULK2XAY.js → rally-client-CxsA6ExK.js} +1 -1
  348. package/server/{reap-terminal-sessions-MWnqdLCJ.js → reap-terminal-sessions-BQ23nriz.js} +2 -2
  349. package/server/{reap-terminal-sessions-N3BTkmX_.js → reap-terminal-sessions-CvmwaqKv.js} +2 -2
  350. package/server/{rebuild-stack-Dp4eLkt4.js → rebuild-stack-0EEYReVZ.js} +36 -36
  351. package/server/rebuild-stack-qeRqHZxH.js +4 -0
  352. package/server/{reconstruct-cache-uWbZfjms.js → reconstruct-cache-BbYFsqLa.js} +7 -6
  353. package/server/record-CtroO946.js +3 -0
  354. package/server/record-update-DH6dLJID.js +3 -0
  355. package/server/{record-update-Dq0t2uBG.js → record-update-Z0QCxmMp.js} +124 -34
  356. package/server/{recovery-trip-BJtIQuag.js → recovery-trip-eJe26h-f.js} +2 -2
  357. package/server/{release-engine-DZpmGGzb.js → release-engine-lPUp-MTd.js} +5 -5
  358. package/server/{release-set-hnXd_kga.js → release-set-BwGeyZKX.js} +3 -3
  359. package/server/{remote-Br-ZWVIP.js → remote-BCd02Es1.js} +3 -3
  360. package/server/{remote-4tiENDaI.js → remote-CVGUhXMV.js} +3 -3
  361. package/server/{remote-agents-CRCg1L4H.js → remote-agents-C1bssi41.js} +2 -2
  362. package/server/{remote-agents-nmty1mLu.js → remote-agents-C_VxssLU.js} +300 -46
  363. package/server/{remote-completion-BbWNd10K.js → remote-completion-DAB0P706.js} +12 -12
  364. package/server/resume-u9byntrq.js +3 -0
  365. package/server/{review-agent-DJRO8EG8.js → review-agent-CD4RCI0Y.js} +1 -1
  366. package/server/{review-agent-sKkE1FEL.js → review-agent-CHhI66UP.js} +61 -44
  367. package/server/{review-artifacts-BLbSC4ke.js → review-artifacts-DSMRIfuJ.js} +7 -6
  368. package/server/{review-context-BgX3lcCx.js → review-context-oFuBbiEE.js} +69 -25
  369. package/server/{in-flight-guard-aQ1IxeI3.js → review-convoy-liveness-CpzrcJ5F.js} +3 -44
  370. package/server/review-status-BZH8h-6W.js +3 -0
  371. package/server/review-status-emit-CUExtHd5.js +50 -0
  372. package/server/{review-status-enrichment-tbOn_A_u.js → review-status-enrichment-QV_hQkgS.js} +4 -4
  373. package/server/{review-status-source-CxuEjLGg.js → review-status-source-CpvJnvnQ.js} +24 -3
  374. package/server/review-status-source-ylw5QZUR.js +3 -0
  375. package/server/{review-status-sync-BhSQ0d0l.js → review-status-sync-483sujRo.js} +10 -5
  376. package/server/{review-status-sync-To3-iS-N.js → review-status-sync-NaWvI9Xf.js} +1 -1
  377. package/server/review-status-yljtTd-q.js +7521 -0
  378. package/server/{review-verdict-feedback-C1Kg8n7t.js → review-verdict-feedback-BPDn4li_.js} +1 -1
  379. package/server/{review-verdict-feedback-CTRNtzXO.js → review-verdict-feedback-CELeUinh.js} +48 -8
  380. package/server/{rollup-WA0VD-Rr.js → rollup-DTNvelz9.js} +8 -8
  381. package/server/{rollup-B53Y81xK.js → rollup-DYZfq1c4.js} +1 -1
  382. package/server/{scanner-D2743cp8.js → scanner-CV35oSn4.js} +42 -14
  383. package/server/{sequence-io-Cg0zYj_E.js → sequence-io-DF_8iuhV.js} +4 -4
  384. package/server/{sequencer-agent-BGY8gjg-.js → sequencer-agent-B2WeCtGi.js} +5 -5
  385. package/server/server.js +3899 -672
  386. package/server/{service-DCpB_SGd.js → service-Br9rpBNA.js} +83 -65
  387. package/server/{session-fork-BQ8_6H32.js → session-fork-D0LY152N.js} +2 -2
  388. package/server/{session-history-CVZDpS3c.js → session-history-BUyK29eq.js} +4 -4
  389. package/server/{settings-BZ5m1UCl.js → settings-Bse1Pdcj.js} +3 -3
  390. package/server/settings-CdvIF84R.js +2 -0
  391. package/server/{settings-ylxwqwQG.js → settings-CvVGqNEs.js} +3 -2
  392. package/server/{shadow-engineering-BlxG6Xye.js → shadow-engineering-BWLa8ODz.js} +2 -2
  393. package/server/{shadow-state-Dh-HzF2J.js → shadow-state-B4fpKxOO.js} +2 -2
  394. package/server/{shadow-state-C2_epgx2.js → shadow-state-FV6PHfEW.js} +1 -1
  395. package/server/{shadow-utils-4bvjn9b3.js → shadow-utils-D7asqxOZ.js} +2 -2
  396. package/server/{ship-log-ClSMIzZX.js → ship-log-xplJ8t75.js} +1 -1
  397. package/server/{smart-compaction-CHIxLr_d.js → smart-compaction-CPp2Ykf6.js} +1 -1
  398. package/server/{smart-compaction-r4pHQBIr.js → smart-compaction-D3U_79f-.js} +8 -7
  399. package/server/{spawn-planning-session-KC_UduxD.js → spawn-planning-session-1nFi3gfk.js} +1 -1
  400. package/server/{spawn-planning-session-DWAorh2B.js → spawn-planning-session-DGfZ5B8D.js} +30 -23
  401. package/server/{specialist-completion-BXhav38U.js → specialist-completion-Br48eiDP.js} +1 -1
  402. package/server/{specialist-context-DtrYvGJ-.js → specialist-context-cVbGnTa3.js} +5 -5
  403. package/server/{specialist-handoff-logger-C45ouoZ6.js → specialist-handoff-logger-DK-GTz4s.js} +2 -2
  404. package/server/{specialist-logs-DJ3RzKxW.js → specialist-logs-Cl5-hqT8.js} +3 -3
  405. package/server/{specialists-JVO00bs7.js → specialists-CNfYO3G2.js} +1634 -457
  406. package/server/{specialists-DyFeedjn.js → specialists-Cicieuzu.js} +21 -19
  407. package/server/{specialists-D5fRZXmN.js → specialists-JHsdU3pA.js} +1 -1
  408. package/server/{specialists-DVj0hvaL.js → specialists-Tdezg_6N.js} +1 -1
  409. package/server/specs-Bt7WJDoC.js +3 -0
  410. package/server/src-CRmCHlma.js +11408 -0
  411. package/server/{src-CG9mCkP6.js → src-Ck028hjO.js} +6 -6
  412. package/server/{src-CMTQGyCK.js → src-UWcGe0Ix.js} +5 -5
  413. package/server/stack-health-CJLMrLBl.js +3 -0
  414. package/server/{stack-health-puygdaMd.js → stack-health-DqSqx0zv.js} +68 -12
  415. package/server/{stale-task-claims-BbFwCTb0.js → stale-task-claims-CYFOUNlT.js} +4 -4
  416. package/server/{staleness-Cbl_w4Bw.js → staleness-BQ-0gMYK.js} +1 -1
  417. package/server/{staleness-Bpy41ngS.js → staleness-D47CUJok.js} +1 -1
  418. package/server/{state-home-CIGjwNfJ.js → state-home-BYV7qZTW.js} +2 -2
  419. package/server/{state-mapping-BL_-3Yt8.js → state-mapping-BVldLhBf.js} +1 -1
  420. package/server/{state-migrate-Dkzaxvny.js → state-migrate-CvvBtS0Y.js} +4 -4
  421. package/server/{stuck-remediation-sY_MHHgQ.js → stuck-remediation-Wt0UVvu1.js} +1 -1
  422. package/server/{stuck-remediation-CzEov_fq.js → stuck-remediation-mkLC6G_t.js} +360 -26
  423. package/server/{substrate-bug-weights-service-BH66lhm7.js → substrate-bug-weights-service-XfLAKnmK.js} +3 -3
  424. package/server/{summary-fork-D8bXjCr7.js → summary-fork-CD7GOts0.js} +2 -2
  425. package/server/{summary-fork-DHhJIsAL.js → summary-fork-xiXBnWG9.js} +78 -12
  426. package/server/supervisor/{injection-budget-C1iPirFS.js → injection-budget-B5SbvDx2.js} +2 -41
  427. package/server/supervisor/{paths-DehGY2Fj.js → paths-K3noE4N_.js} +1 -1
  428. package/server/supervisor/pty-supervisor.js +49 -2
  429. package/server/supervisor/pty-token-B7lp0ElT.js +43 -0
  430. package/server/{supervisor-BO-Zk_h-.js → supervisor-DL788vos.js} +3 -3
  431. package/server/supervisor-UWiQNK-y.js +2 -0
  432. package/server/{swarm-readiness-CQ_fwUWF.js → swarm-readiness-BV14DF5N.js} +3 -3
  433. package/server/{system-prerequisites-Bza0ffAh.js → system-prerequisites-pdWG6ZQs.js} +56 -29
  434. package/server/{teardown-workspace-CEgauF4U.js → teardown-workspace-l2F4_zim.js} +15 -16
  435. package/server/{test-agent-queue-DXDt0Xa-.js → test-agent-queue-qakFIIGz.js} +6 -6
  436. package/server/{test-verdict-CmUBK5cT.js → test-verdict-BJYDggMm.js} +1 -1
  437. package/server/{test-verdict-DFjjIHR5.js → test-verdict-Gw-btEfb.js} +1 -1
  438. package/server/{tldr-daemon-DL566HbH.js → tldr-daemon-BKOYB616.js} +1 -1
  439. package/server/{tldr-daemon-BDtLOIlO.js → tldr-daemon-CBaWkV9k.js} +2 -2
  440. package/server/{tmux-ftABRAmc.js → tmux-B1Wbxz5o.js} +3 -3
  441. package/server/{tmux-DoThH6aj.js → tmux-DQ6jB76i.js} +1 -1
  442. package/server/tmux-dedup-DbN6MGzM.js +892 -0
  443. package/server/{token-CsOhvw42.js → token-Cxbk023d.js} +2 -2
  444. package/server/{token-util-CTmczIfW.js → token-util-CLq2MmQt.js} +1 -1
  445. package/server/token-util-zlz9U0ki.js +3 -0
  446. package/server/{tracker-config-B4itFzDo.js → tracker-config-DZ8Zn2nQ.js} +2 -2
  447. package/server/{tracker-utils-tnxxqROg.js → tracker-utils-L0FKtjq2.js} +3 -3
  448. package/server/{traefik-connect-m73vGebA.js → traefik-connect-bNX6jKkb.js} +1 -1
  449. package/server/{tunnel-B2vxjx_b.js → tunnel-BAm1XgjG.js} +3 -3
  450. package/server/{tunnel-Cgj-IGIl.js → tunnel-CjSnHdTc.js} +1 -1
  451. package/server/{types-BBNjPcqU.js → types-q67TYYg5.js} +1 -1
  452. package/server/uat-promote-verification-CKB9ZrKC.js +92 -0
  453. package/server/uat-train-Cu-4nvbf.js +2 -0
  454. package/server/uat-train-D5UjcyAa.js +0 -0
  455. package/server/validate-Cxsx5Uz1.js +179 -0
  456. package/server/{validation-CIi6pnI2.js → validation-DEaTZafj.js} +1 -1
  457. package/server/{validation-B5JxoPUS.js → validation-VZgJxmqc.js} +4 -4
  458. package/server/{verification-artifact-C-lIHfUa.js → verification-artifact-C85cRTc_.js} +1 -1
  459. package/server/{verification-artifact-BcnIbigL.js → verification-artifact-g3yuxQDL.js} +1 -1
  460. package/server/{verification-runner-CDj4lD4t.js → verification-runner-DlZI8yhw.js} +1 -1
  461. package/server/{verification-runner-Br0S_Ous.js → verification-runner-KDZIsBj4.js} +114 -107
  462. package/server/{vtt-parser-DKpNNW5i.js → vtt-parser-Jr94BF3Y.js} +1 -1
  463. package/server/{work-agent-prompt-Yb2bd3Fq.js → work-agent-prompt-C-vuP3_J.js} +20 -9
  464. package/server/workflows-CHrx_hcW.js +2 -0
  465. package/server/{workflows-C9WmILql.js → workflows-D0oip4eV.js} +161 -78
  466. package/server/{workspace-DuUdndHe.js → workspace-BqFg__wH.js} +1 -1
  467. package/server/{workspace-BVl4rihN.js → workspace-C0fH3aek.js} +3 -3
  468. package/server/workspace-anchor-drift-B4gMRHl4.js +3 -0
  469. package/server/workspace-anchor-drift-CZKofakh.js +224 -0
  470. package/server/{workspace-config-cEGcO6UT.js → workspace-config-B123aZl-.js} +1 -1
  471. package/server/workspace-manager-CDTKjjdU.js +3 -0
  472. package/server/{workspace-manager-hLUv3ADC.js → workspace-manager-CwO-Hek7.js} +206 -116
  473. package/server/{workspace-metadata-CskwzzhL.js → workspace-metadata-CQv00QwK.js} +2 -2
  474. package/server/{workspace-metadata-DNpMixRq.js → workspace-metadata-D4M8BM4W.js} +1 -1
  475. package/server/{workspaces-hWvy9eKs.js → workspaces-j1e_6aAT.js} +736 -290
  476. package/sync-sources/dev-skills/pan-dashboard-restart/SKILL.md +34 -10
  477. package/sync-sources/hooks/linear-mcp-auth-hook +97 -0
  478. package/sync-sources/hooks/record-cost-event.js +6 -4
  479. package/sync-sources/rules/ask-user-question-self-contained.md +9 -0
  480. package/sync-sources/skills/okf/README.md +11 -3
  481. package/sync-sources/skills/okf/SKILL.md +12 -1
  482. package/sync-sources/skills/okf/docs/USAGE.md +15 -0
  483. package/sync-sources/skills/okf/references/overdeck.md +28 -0
  484. package/sync-sources/skills/pan-close/SKILL.md +5 -3
  485. package/sync-sources/skills/pan-flywheel/SKILL.md +18 -1
  486. package/sync-sources/skills/pan-knowledge/SKILL.md +10 -0
  487. package/sync-sources/skills/pan-orders/SKILL.md +33 -0
  488. package/sync-sources/skills/pan-peer-review/SKILL.md +195 -0
  489. package/sync-sources/skills/pan-reload/SKILL.md +3 -3
  490. package/sync-sources/skills/pan-restart/SKILL.md +5 -4
  491. package/sync-sources/skills/pan-review/SKILL.md +7 -1
  492. package/sync-sources/skills/pan-start/SKILL.md +4 -0
  493. package/sync-sources/skills/pan-sync-main/SKILL.md +9 -8
  494. package/sync-sources/skills/pipeline-status/SKILL.md +10 -1
  495. package/sync-sources/skills/workspace-add-repo/SKILL.md +16 -1
  496. package/sync-sources/templates/traefik/dynamic/overdeck.yml.template +10 -0
  497. package/server/activity-logger-OEUBdfZ8.js +0 -3
  498. package/server/agent-state-Bg0lhqwj.js +0 -3
  499. package/server/agents-FlIgQ3ql.js +0 -3
  500. package/server/archive-planning-zkJb3BeM.js +0 -3
  501. package/server/cli-BsVIHwzC.js +0 -3
  502. package/server/context-layers-B3Nt58jl.js +0 -4
  503. package/server/context-layers-ZYFcWiyc.js +0 -165
  504. package/server/conversation-service-Up7FEzIC.js +0 -3
  505. package/server/deacon-DYSEJb48.js +0 -4
  506. package/server/deacon-swarm-9jRLS5Ke.js +0 -2
  507. package/server/deploy-window-CM6W1-c6.js +0 -3
  508. package/server/dist-Bd3vn0Hw.js +0 -3
  509. package/server/flywheel-DMCUzDWg.js +0 -2
  510. package/server/flywheel-DSSpWmqF.js +0 -522
  511. package/server/flywheel-DcBkQvgE.js +0 -207
  512. package/server/flywheel-merge-order-C-6zRLvM.js +0 -2
  513. package/server/flywheel-merge-order-DxbQKE1d.js +0 -244
  514. package/server/forge-B-ZWyTRm.js +0 -2
  515. package/server/forge-Ch9gCFod.js +0 -270
  516. package/server/git-utils-Dry_Ka_D.js +0 -3
  517. package/server/github-pr-lookup-BRbDW-qk.js +0 -44
  518. package/server/hume-B_DbflNM.js +0 -3
  519. package/server/inspect-agent-ch-F-5Ci.js +0 -2
  520. package/server/launcher-generator-CHVm7bGT.js +0 -379
  521. package/server/layers-DzxSTGNA.js +0 -93
  522. package/server/merge-blockers-BsFjGrQ8.js +0 -41
  523. package/server/merge-ops-DlB1IM0Y.js +0 -2
  524. package/server/merge-set-DLz0MkGT.js +0 -139
  525. package/server/merge-set-DnSYdBEp.js +0 -3
  526. package/server/merge-sync-SSv3E-pl.js +0 -3
  527. package/server/merge-verification-CSizH3HY.js +0 -124
  528. package/server/projects-9SkRpES9.js +0 -3
  529. package/server/public/assets/index-CUr1xv8w.css +0 -1
  530. package/server/public/assets/index-CsSuZQBI.js +0 -802
  531. package/server/public/assets/mermaid-GHXKKRXX-BUAB8hqt.js +0 -1
  532. package/server/rally-njs_mJrt.js +0 -3
  533. package/server/rebuild-stack-kA7XngID.js +0 -3
  534. package/server/record-t6V-3Dcj.js +0 -3
  535. package/server/record-update-DACtKh6_.js +0 -3
  536. package/server/resume-CcKqnTvE.js +0 -3
  537. package/server/review-status-A7quS5KJ.js +0 -1454
  538. package/server/review-status-C6n6-9f_.js +0 -3
  539. package/server/settings-D0OSwos5.js +0 -2
  540. package/server/specs-nN45DG2X.js +0 -3
  541. package/server/src-U7_kTPEE.js +0 -4733
  542. package/server/stack-health-Df0YEZKa.js +0 -3
  543. package/server/supervisor-BPy-o1A8.js +0 -2
  544. package/server/token-util-DrHg8abn.js +0 -3
  545. package/server/tracker-utils-BePq_oj-.js +0 -3
  546. package/server/uat-train-CuEn0t9M.js +0 -2152
  547. package/server/uat-train-cKfM-_WW.js +0 -2
  548. package/server/workflows-D90rMOya.js +0 -2
  549. package/server/workspace-manager-ZTdJAy9M.js +0 -3
@@ -0,0 +1,1092 @@
1
+ import { a as __toCommonJS } from "./rolldown-runtime-DNCzzKnI.js";
2
+ import { Cn as resolveStateReadHomeSync, Gn as init_projects, Mn as findProjectByPathSync, Rn as getProjectSwarmHotspots, Sn as init_state_read_home, cn as flushAutoCommits, ln as init_auto_commit, un as queueAutoCommit } from "./config-yaml-CmOPzmBb.js";
3
+ import { C as FlywheelStatus, S as FlywheelRunId, d as OrderBook, f as OrderBookIndexEntry, t as init_src } from "./src-CRmCHlma.js";
4
+ import { f as init_review_status, u as getReviewStatusSync } from "./review-status-yljtTd-q.js";
5
+ import { a as countAgentsByStatusRole, o as init_agents } from "./agents-C5rWYhb6.js";
6
+ import { $n as getAgentDir, b as init_agents$1, dt as spawnRun, pt as stopAgent } from "./queries-DHJm7bTd.js";
7
+ import { n as init_issue_service_singleton, r as issue_service_singleton_exports } from "./issue-service-singleton-DmCh7EHj.js";
8
+ import { o as getInternalTokenSync, s as init_internal_token, t as INTERNAL_TOKEN_HEADER } from "./internal-token-DvMTQSOS.js";
9
+ import { S as setFlywheelGloballyPaused, b as setFlywheelActiveRunId, d as isFlywheelAutoPickupBacklog, f as isFlywheelGloballyPaused, i as getFlywheelActiveRunId, p as isFlywheelRequireUatBeforeMerge, s as init_control_settings } from "./control-settings-C7DUehE1.js";
10
+ import { n as parseSequenceMd, t as init_sequence_io } from "./sequence-io-DF_8iuhV.js";
11
+ import { l as computeCohort, m as init_pickup, n as LEGACY_PARKED_LABELS } from "./pickup-D8xtG1J2.js";
12
+ import { a as computePredictedConflictSignals, l as pickFromSequence, o as declaredIssueFootprint } from "./flywheel-merge-order-BJv1DZz1.js";
13
+ import { a as gatherProjectLensSignals, s as init_pipeline_membership_gather } from "./pipeline-membership-gather-CET40frr.js";
14
+ import { n as init_pipeline_membership, r as resolvePipelineMembership } from "./pipeline-membership-CrAPLYtf.js";
15
+ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
16
+ import { Effect, Schema } from "effect";
17
+ import { homedir } from "node:os";
18
+ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
19
+ import { mkdir, readFile, readdir, realpath, rename, stat as stat$1, writeFile } from "node:fs/promises";
20
+ import { exec } from "node:child_process";
21
+ import { promisify } from "node:util";
22
+ //#region ../../lib/orders/types.ts
23
+ init_projects();
24
+ init_state_read_home();
25
+ init_auto_commit();
26
+ init_internal_token();
27
+ init_review_status();
28
+ init_agents$1();
29
+ init_sequence_io();
30
+ init_pickup();
31
+ init_src();
32
+ const decodeOrderBook = Schema.decodeUnknownSync(OrderBook);
33
+ function parseOrderBookJson(value) {
34
+ try {
35
+ return {
36
+ ok: true,
37
+ book: decodeOrderBook(value)
38
+ };
39
+ } catch (error) {
40
+ return {
41
+ ok: false,
42
+ error: `Invalid order book: ${error instanceof Error ? error.message : String(error)}`
43
+ };
44
+ }
45
+ }
46
+ //#endregion
47
+ //#region ../../lib/orders/io.ts
48
+ init_src();
49
+ const BOOK_ID_PATTERN = /^\d{4}-\d{2}-\d{2}-[a-z0-9]+(?:-[a-z0-9]+)*$/;
50
+ const decodeIndex = Schema.decodeUnknownSync(Schema.Array(OrderBookIndexEntry));
51
+ function ordersDirectory(stateRoot) {
52
+ return join(stateRoot, "orders");
53
+ }
54
+ function orderBookPath(stateRoot, bookId) {
55
+ if (!BOOK_ID_PATTERN.test(bookId)) throw new Error(`Invalid order book id: ${bookId}`);
56
+ return join(ordersDirectory(stateRoot), `${bookId}.json`);
57
+ }
58
+ function orderBookIndexPath(stateRoot) {
59
+ return join(ordersDirectory(stateRoot), "index.json");
60
+ }
61
+ function backlogSequencePath(stateRoot) {
62
+ return join(stateRoot, "backlog", "sequence.md");
63
+ }
64
+ function readOrderBook(stateRoot, bookId) {
65
+ const path = orderBookPath(stateRoot, bookId);
66
+ if (!existsSync(path)) return null;
67
+ let value;
68
+ try {
69
+ value = JSON.parse(readFileSync(path, "utf8"));
70
+ } catch (error) {
71
+ throw new Error(`Could not parse order book ${bookId}: ${error instanceof Error ? error.message : String(error)}`);
72
+ }
73
+ const parsed = parseOrderBookJson(value);
74
+ if (!parsed.ok) throw new Error(`Could not parse order book ${bookId}: ${parsed.error}`);
75
+ if (parsed.book.id !== bookId) throw new Error(`Order book ${bookId} contains mismatched id ${parsed.book.id}`);
76
+ return parsed.book;
77
+ }
78
+ function readOrderBookIndex(stateRoot) {
79
+ const path = orderBookIndexPath(stateRoot);
80
+ if (!existsSync(path)) return [];
81
+ try {
82
+ return decodeIndex(JSON.parse(readFileSync(path, "utf8")));
83
+ } catch (error) {
84
+ throw new Error(`Could not parse order book index: ${error instanceof Error ? error.message : String(error)}`);
85
+ }
86
+ }
87
+ function listOrderBookIds(stateRoot) {
88
+ const indexed = readOrderBookIndex(stateRoot).map((entry) => entry.id);
89
+ if (indexed.length > 0 || !existsSync(ordersDirectory(stateRoot))) return [...indexed];
90
+ return readdirSync(ordersDirectory(stateRoot)).filter((name) => name !== "index.json" && name.endsWith(".json")).map((name) => name.slice(0, -5)).filter((id) => BOOK_ID_PATTERN.test(id)).sort();
91
+ }
92
+ function preserveOperatorOwnedState(prior, next) {
93
+ if (!prior) return next;
94
+ if (prior.id !== next.id) throw new Error(`Order book id is immutable: ${prior.id} cannot become ${next.id}`);
95
+ const priorItems = new Map(prior.items.map((item) => [item.issue.toUpperCase(), item]));
96
+ const items = next.items.map((item) => {
97
+ const existing = priorItems.get(item.issue.toUpperCase());
98
+ if (!existing) return item;
99
+ return {
100
+ ...item,
101
+ addedAt: existing.addedAt,
102
+ addedBy: existing.addedBy
103
+ };
104
+ });
105
+ return {
106
+ ...next,
107
+ createdAt: prior.createdAt,
108
+ items
109
+ };
110
+ }
111
+ function indexEntry(book) {
112
+ return {
113
+ id: book.id,
114
+ name: book.name,
115
+ status: book.status,
116
+ runId: book.runId,
117
+ updatedAt: book.updatedAt
118
+ };
119
+ }
120
+ /**
121
+ * Physical state-store primitive used only by the orders writer. Domain callers
122
+ * must mutate order books through writer.ts so the book and queue stay aligned.
123
+ */
124
+ async function writeOrderBookState(stateRoot, nextBook, queueOrder) {
125
+ const book = preserveOperatorOwnedState(readOrderBook(stateRoot, nextBook.id), nextBook);
126
+ const bookPath = orderBookPath(stateRoot, book.id);
127
+ const indexPath = orderBookIndexPath(stateRoot);
128
+ const existingIndex = [...readOrderBookIndex(stateRoot)];
129
+ const byId = new Map(existingIndex.map((entry) => [entry.id, entry]));
130
+ byId.set(book.id, indexEntry(book));
131
+ const ids = [...queueOrder ?? existingIndex.map((entry) => entry.id)];
132
+ if (!ids.includes(book.id)) ids.push(book.id);
133
+ for (const entry of existingIndex) if (!ids.includes(entry.id)) ids.push(entry.id);
134
+ const index = ids.map((id) => byId.get(id)).filter((entry) => Boolean(entry));
135
+ mkdirSync(dirname(bookPath), { recursive: true });
136
+ writeFileSync(bookPath, `${JSON.stringify(book, null, 2)}\n`, "utf8");
137
+ writeFileSync(indexPath, `${JSON.stringify(index, null, 2)}\n`, "utf8");
138
+ queueAutoCommit({
139
+ projectRoot: stateRoot,
140
+ repoRoot: stateRoot,
141
+ paths: [bookPath, indexPath],
142
+ subject: `chore(state): update order book ${book.id}`
143
+ });
144
+ const flushed = await Effect.runPromise(flushAutoCommits(stateRoot));
145
+ if (flushed.errored || flushed.pushed === false) throw new Error(`Failed to persist order book ${book.id}: ${flushed.reason ?? "state commit failed"}`);
146
+ return book;
147
+ }
148
+ //#endregion
149
+ //#region ../../lib/orders/resolver.ts
150
+ const COMPLETE_STATUS = "complete";
151
+ function labelNames(issue) {
152
+ return (Array.isArray(issue.labels) ? issue.labels : []).map((label) => typeof label === "string" ? label : typeof label === "object" && label !== null && typeof label.name === "string" ? label.name : "").filter(Boolean).map((label) => label.toLowerCase());
153
+ }
154
+ function issueIdentifier(issue) {
155
+ for (const key of [
156
+ "identifier",
157
+ "issueId",
158
+ "id"
159
+ ]) {
160
+ const value = issue[key];
161
+ if (typeof value === "string" && value) return value.toUpperCase();
162
+ }
163
+ return "";
164
+ }
165
+ function issueIsClosed(issue) {
166
+ return [
167
+ issue.canonicalStatus,
168
+ issue.status,
169
+ issue.state
170
+ ].map((value) => typeof value === "string" ? value.toLowerCase().replace(/[ -]/g, "_") : "").some((value) => [
171
+ "done",
172
+ "completed",
173
+ "closed",
174
+ "canceled",
175
+ "cancelled"
176
+ ].includes(value));
177
+ }
178
+ const liveOrderIssueLookup = (issueIds) => {
179
+ const wanted = new Set(issueIds.map((id) => id.toUpperCase()));
180
+ const result = /* @__PURE__ */ new Map();
181
+ try {
182
+ const { getSharedIssueService } = (init_issue_service_singleton(), __toCommonJS(issue_service_singleton_exports));
183
+ const issues = getSharedIssueService().getIssues({
184
+ cycle: "all",
185
+ includeCompleted: true
186
+ });
187
+ for (const issue of issues) {
188
+ const id = issueIdentifier(issue);
189
+ if (!wanted.has(id)) continue;
190
+ const labels = labelNames(issue);
191
+ const closed = issueIsClosed(issue);
192
+ result.set(id, {
193
+ issue: id,
194
+ open: !closed,
195
+ parked: labels.includes("parked") || LEGACY_PARKED_LABELS.some((label) => labels.includes(label))
196
+ });
197
+ }
198
+ } catch {}
199
+ return result;
200
+ };
201
+ /** The sole order-book read door. */
202
+ function listBooks(stateRoot) {
203
+ return listOrderBookIds(stateRoot).map((id) => {
204
+ const book = readOrderBook(stateRoot, id);
205
+ if (!book) throw new Error(`Order book index references missing book ${id}`);
206
+ return book;
207
+ });
208
+ }
209
+ function getBook(stateRoot, bookId) {
210
+ return readOrderBook(stateRoot, bookId);
211
+ }
212
+ function membership(stateRoot) {
213
+ const result = /* @__PURE__ */ new Map();
214
+ for (const book of listBooks(stateRoot)) {
215
+ if (book.status === COMPLETE_STATUS) continue;
216
+ for (const item of book.items) {
217
+ const issue = item.issue.toUpperCase();
218
+ const existing = result.get(issue);
219
+ if (existing && existing !== book.id) throw new Error(`Issue ${issue} belongs to multiple non-complete order books: ${existing}, ${book.id}`);
220
+ result.set(issue, book.id);
221
+ }
222
+ }
223
+ return result;
224
+ }
225
+ function backlogCandidates(stateRoot, limit) {
226
+ if (limit <= 0) return [];
227
+ const path = backlogSequencePath(stateRoot);
228
+ if (!existsSync(path)) return [];
229
+ const parsed = parseSequenceMd(readFileSync(path, "utf8"));
230
+ if (!parsed.ok) throw new Error(`Could not parse backlog sequence: ${parsed.error}`);
231
+ const assigned = membership(stateRoot);
232
+ return [...parsed.doc.nodes].sort((a, b) => a.rank - b.rank).filter((node) => !assigned.has(node.issue.toUpperCase())).slice(0, limit);
233
+ }
234
+ function computeBookProgress(book, issueLookup = liveOrderIssueLookup) {
235
+ const state = issueLookup(book.items.map((item) => item.issue));
236
+ const items = book.items.map((item) => {
237
+ const issue = state.get(item.issue.toUpperCase());
238
+ const closed = issue ? !issue.open : false;
239
+ const parked = issue?.parked ?? false;
240
+ return {
241
+ issue: item.issue,
242
+ lane: item.lane,
243
+ order: item.order,
244
+ closed,
245
+ parked,
246
+ terminal: closed || parked
247
+ };
248
+ });
249
+ return {
250
+ bookId: book.id,
251
+ total: items.length,
252
+ landed: items.filter((item) => item.closed).length,
253
+ items,
254
+ drained: items.every((item) => item.terminal)
255
+ };
256
+ }
257
+ //#endregion
258
+ //#region ../../lib/orders/writer.ts
259
+ init_agents();
260
+ init_control_settings();
261
+ function timestamp(value) {
262
+ return value ?? (/* @__PURE__ */ new Date()).toISOString();
263
+ }
264
+ function requireBook(stateRoot, bookId) {
265
+ const book = getBook(stateRoot, bookId);
266
+ if (!book) throw new Error(`Order book not found: ${bookId}`);
267
+ return book;
268
+ }
269
+ function normalizeLaneOrder(items) {
270
+ const laneA = items.filter((item) => item.lane === "A").sort((a, b) => a.order - b.order);
271
+ const laneB = items.filter((item) => item.lane === "B").sort((a, b) => a.order - b.order);
272
+ return [...laneA.map((item, index) => ({
273
+ ...item,
274
+ order: index + 1
275
+ })), ...laneB.map((item, index) => ({
276
+ ...item,
277
+ order: index + 1
278
+ }))];
279
+ }
280
+ function updated(book, changes, at) {
281
+ return {
282
+ ...book,
283
+ ...changes,
284
+ id: book.id,
285
+ createdAt: book.createdAt,
286
+ updatedAt: timestamp(at)
287
+ };
288
+ }
289
+ /** The sole order-book write door. */
290
+ async function createBook(stateRoot, input) {
291
+ if (getBook(stateRoot, input.id)) throw new Error(`Order book already exists: ${input.id}`);
292
+ const at = timestamp(input.createdAt);
293
+ const settings = {
294
+ laneAConcurrency: input.settings?.laneAConcurrency ?? 1,
295
+ briefOverlay: input.settings?.briefOverlay,
296
+ posture: input.settings?.posture ?? "open",
297
+ postureSetAt: input.settings?.postureSetAt,
298
+ postureSetBy: input.settings?.postureSetBy,
299
+ postureReason: input.settings?.postureReason
300
+ };
301
+ if (!Number.isInteger(settings.laneAConcurrency) || settings.laneAConcurrency < 1) throw new Error("laneAConcurrency must be a positive integer");
302
+ return writeOrderBookState(stateRoot, {
303
+ id: input.id,
304
+ name: input.name,
305
+ status: "draft",
306
+ settings,
307
+ items: [],
308
+ createdAt: at,
309
+ updatedAt: at
310
+ });
311
+ }
312
+ async function renameBook(stateRoot, bookId, name, at) {
313
+ if (!name.trim()) throw new Error("Order book name cannot be empty");
314
+ return writeOrderBookState(stateRoot, updated(requireBook(stateRoot, bookId), { name: name.trim() }, at));
315
+ }
316
+ async function addItems(stateRoot, bookId, items, actor, at) {
317
+ const book = requireBook(stateRoot, bookId);
318
+ const existing = new Set(book.items.map((item) => item.issue.toUpperCase()));
319
+ const assigned = membership(stateRoot);
320
+ const addedAt = timestamp(at);
321
+ const additions = [];
322
+ for (const item of items) {
323
+ const issue = item.issue.toUpperCase();
324
+ if (existing.has(issue) || additions.some((candidate) => candidate.issue.toUpperCase() === issue)) throw new Error(`Issue ${issue} is already in order book ${bookId}`);
325
+ const otherBook = assigned.get(issue);
326
+ if (otherBook && otherBook !== bookId) throw new Error(`Issue ${issue} already belongs to non-complete order book ${otherBook}`);
327
+ additions.push({
328
+ ...item,
329
+ issue,
330
+ prereqs: item.prereqs.map((prereq) => prereq.toUpperCase()),
331
+ addedAt: item.addedAt ?? addedAt,
332
+ addedBy: item.addedBy ?? actor
333
+ });
334
+ }
335
+ return writeOrderBookState(stateRoot, updated(book, { items: normalizeLaneOrder([...book.items, ...additions]) }, at));
336
+ }
337
+ async function removeItem(stateRoot, bookId, issueId, at) {
338
+ const book = requireBook(stateRoot, bookId);
339
+ const issue = issueId.toUpperCase();
340
+ if (!book.items.some((item) => item.issue.toUpperCase() === issue)) throw new Error(`Issue ${issue} is not in order book ${bookId}`);
341
+ return writeOrderBookState(stateRoot, updated(book, { items: normalizeLaneOrder(book.items.filter((item) => item.issue.toUpperCase() !== issue)) }, at));
342
+ }
343
+ async function moveItem(stateRoot, bookId, issueId, lane, order, at) {
344
+ const book = requireBook(stateRoot, bookId);
345
+ const issue = issueId.toUpperCase();
346
+ const moving = book.items.find((item) => item.issue.toUpperCase() === issue);
347
+ if (!moving) throw new Error(`Issue ${issue} is not in order book ${bookId}`);
348
+ if (!Number.isInteger(order) || order < 1) throw new Error("Order must be a positive integer");
349
+ const remaining = book.items.filter((item) => item !== moving);
350
+ const targetLane = remaining.filter((item) => item.lane === lane).sort((a, b) => a.order - b.order);
351
+ targetLane.splice(Math.min(order - 1, targetLane.length), 0, {
352
+ ...moving,
353
+ lane,
354
+ order
355
+ });
356
+ const otherLane = remaining.filter((item) => item.lane !== lane).sort((a, b) => a.order - b.order);
357
+ return writeOrderBookState(stateRoot, updated(book, { items: normalizeLaneOrder([...targetLane, ...otherLane]) }, at));
358
+ }
359
+ async function setItemRequirements(stateRoot, bookId, issueId, requirements, at) {
360
+ const book = requireBook(stateRoot, bookId);
361
+ const issue = issueId.toUpperCase();
362
+ let found = false;
363
+ const items = book.items.map((item) => {
364
+ if (item.issue.toUpperCase() !== issue) return item;
365
+ found = true;
366
+ return {
367
+ ...item,
368
+ prereqs: requirements.prereqs === void 0 ? item.prereqs : [...new Set(requirements.prereqs.map((prereq) => prereq.toUpperCase()))],
369
+ reVerify: requirements.reVerify ?? item.reVerify,
370
+ planAtPickup: requirements.planAtPickup ?? item.planAtPickup
371
+ };
372
+ });
373
+ if (!found) throw new Error(`Issue ${issue} is not in order book ${bookId}`);
374
+ return writeOrderBookState(stateRoot, updated(book, { items }, at));
375
+ }
376
+ async function setSettings(stateRoot, bookId, settings, at) {
377
+ const book = requireBook(stateRoot, bookId);
378
+ const next = {
379
+ ...book.settings,
380
+ ...settings
381
+ };
382
+ if (!Number.isInteger(next.laneAConcurrency) || next.laneAConcurrency < 1) throw new Error("laneAConcurrency must be a positive integer");
383
+ return writeOrderBookState(stateRoot, updated(book, { settings: next }, at));
384
+ }
385
+ async function setStatus(stateRoot, bookId, status, options = {}) {
386
+ const book = requireBook(stateRoot, bookId);
387
+ if (status === "running") {
388
+ const running = listBooks(stateRoot).find((candidate) => candidate.status === "running" && candidate.id !== bookId);
389
+ if (running) throw new Error(`Order book ${running.id} is already running`);
390
+ }
391
+ return writeOrderBookState(stateRoot, updated(book, {
392
+ status,
393
+ runId: options.runId === void 0 ? book.runId : options.runId ?? void 0
394
+ }, options.at));
395
+ }
396
+ async function advanceQueue(stateRoot, completedBookId, at) {
397
+ if (requireBook(stateRoot, completedBookId).status !== "complete") await setStatus(stateRoot, completedBookId, "complete", { at });
398
+ const order = readOrderBookIndex(stateRoot).map((entry) => entry.id);
399
+ for (const id of order) {
400
+ const book = getBook(stateRoot, id);
401
+ if (book?.status === "ready") return book;
402
+ }
403
+ return null;
404
+ }
405
+ //#endregion
406
+ //#region services/flywheel-run-state.ts
407
+ init_src();
408
+ const decodeFlywheelStatus = Schema.decodeUnknownSync(FlywheelStatus);
409
+ const decodeFlywheelRunId$1 = Schema.decodeUnknownSync(FlywheelRunId);
410
+ const RUN_ID_PATTERN = /^RUN-(\d+)$/;
411
+ const DEFAULT_RUNS_LIMIT = 20;
412
+ const MAX_RUNS_LIMIT = 100;
413
+ const RUN_SUMMARY_CONCURRENCY = 4;
414
+ const flywheelStatusListeners = /* @__PURE__ */ new Set();
415
+ function subscribeLatestFlywheelStatus(listener) {
416
+ flywheelStatusListeners.add(listener);
417
+ return () => {
418
+ flywheelStatusListeners.delete(listener);
419
+ };
420
+ }
421
+ function publishLatestFlywheelStatus(status) {
422
+ for (const listener of flywheelStatusListeners) listener(status);
423
+ }
424
+ function publishFlywheelStatusCleared() {
425
+ publishLatestFlywheelStatus(null);
426
+ }
427
+ function parseFlywheelRunId(runId) {
428
+ return decodeFlywheelRunId$1(runId);
429
+ }
430
+ function isFlywheelRunId(runId) {
431
+ return RUN_ID_PATTERN.test(runId);
432
+ }
433
+ function runNumber(runId) {
434
+ const match = RUN_ID_PATTERN.exec(runId);
435
+ return match ? Number(match[1]) : 0;
436
+ }
437
+ function normalizeLimit(limit) {
438
+ if (limit === void 0) return DEFAULT_RUNS_LIMIT;
439
+ if (!Number.isFinite(limit) || limit <= 0) return DEFAULT_RUNS_LIMIT;
440
+ return Math.min(Math.floor(limit), MAX_RUNS_LIMIT);
441
+ }
442
+ async function mapWithConcurrency(items, concurrency, mapper) {
443
+ const results = new Array(items.length);
444
+ let index = 0;
445
+ await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, async () => {
446
+ while (index < items.length) {
447
+ const current = index;
448
+ index += 1;
449
+ results[current] = await mapper(items[current]);
450
+ }
451
+ }));
452
+ return results;
453
+ }
454
+ function getFlywheelHome(options = {}) {
455
+ return join(options.overdeckHome ?? process.env["OVERDECK_HOME"] ?? join(homedir(), ".overdeck"), "flywheel");
456
+ }
457
+ function getFlywheelRunsDir(options = {}) {
458
+ return join(getFlywheelHome(options), "runs");
459
+ }
460
+ function getFlywheelRunDir(runId, options = {}) {
461
+ return join(getFlywheelRunsDir(options), parseFlywheelRunId(runId));
462
+ }
463
+ /** Persist the run's cohort (issue ids) at run start. */
464
+ function saveRunCohort(runId, issueIds, options = {}) {
465
+ const dir = getFlywheelRunDir(runId, options);
466
+ mkdirSync(dir, { recursive: true });
467
+ writeFileSync(join(dir, "cohort.json"), JSON.stringify({
468
+ issueIds: [...issueIds],
469
+ snapshotAt: (/* @__PURE__ */ new Date()).toISOString()
470
+ }, null, 2), "utf-8");
471
+ }
472
+ async function nextFlywheelRunId(options = {}) {
473
+ const runsDir = getFlywheelRunsDir(options);
474
+ await mkdir(runsDir, { recursive: true });
475
+ return parseFlywheelRunId(`RUN-${(await readdir(runsDir, { withFileTypes: true })).reduce((max, entry) => {
476
+ if (!entry.isDirectory()) return max;
477
+ const match = RUN_ID_PATTERN.exec(entry.name);
478
+ if (!match) return max;
479
+ return Math.max(max, Number(match[1]));
480
+ }, 0) + 1}`);
481
+ }
482
+ async function writeJsonAtomic(path, payload) {
483
+ const tmpPath = join(dirname(path), `.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);
484
+ await mkdir(dirname(path), { recursive: true });
485
+ await writeFile(tmpPath, `${JSON.stringify(payload, null, 2)}\n`, "utf8");
486
+ await rename(tmpPath, path);
487
+ return path;
488
+ }
489
+ function enrichFlywheelStatusWithOrders(status, book, progress) {
490
+ const terminalPipelineStatuses = new Set([
491
+ "failed",
492
+ "merged",
493
+ "parked"
494
+ ]);
495
+ const inFlight = new Set(status.activePipeline.filter((item) => !terminalPipelineStatuses.has(item.status)).map((item) => item.issueId.toUpperCase()));
496
+ const laneAInFlight = book.items.filter((item) => item.lane === "A" && inFlight.has(item.issue.toUpperCase())).sort((left, right) => left.order - right.order).map((item) => item.issue);
497
+ const laneBInFlight = book.items.filter((item) => item.lane === "B" && inFlight.has(item.issue.toUpperCase())).sort((left, right) => left.order - right.order)[0]?.issue;
498
+ return {
499
+ ...status,
500
+ orders: {
501
+ bookId: book.id,
502
+ bookName: book.name,
503
+ landed: progress.landed,
504
+ total: progress.total,
505
+ laneAInFlight,
506
+ ...laneBInFlight ? { laneBInFlight } : {},
507
+ drained: progress.drained
508
+ }
509
+ };
510
+ }
511
+ async function mechanicallyEnrichOrdersStatus(status, options) {
512
+ const launch = await readFlywheelLaunchMetadata(status.runId, options);
513
+ const { scope: _claimedScope, ...unscoped } = status;
514
+ const scoped = launch?.scope ? {
515
+ ...unscoped,
516
+ scope: launch.scope
517
+ } : unscoped;
518
+ if (!launch?.orders) {
519
+ const { orders: _untrustedOrders, ...booklessStatus } = scoped;
520
+ return booklessStatus;
521
+ }
522
+ const stateRoot = options.orderStateRoot?.(launch.workspace) ?? (() => {
523
+ const project = findProjectByPathSync(launch.workspace);
524
+ if (!project) throw new Error(`No configured project contains orders-bound Flywheel workspace ${launch.workspace}`);
525
+ return resolveStateReadHomeSync(project).root;
526
+ })();
527
+ const book = (options.getOrderBook ?? getBook)(stateRoot, launch.orders.bookId);
528
+ if (!book) throw new Error(`Flywheel run ${status.runId} references missing order book ${launch.orders.bookId}`);
529
+ const progress = (options.computeOrderProgress ?? computeBookProgress)(book);
530
+ if (progress.drained && book.status === "running") await (options.setOrderStatus ?? setStatus)(stateRoot, book.id, "drained", { runId: book.runId });
531
+ return enrichFlywheelStatusWithOrders(scoped, book, progress);
532
+ }
533
+ async function writeLatestFlywheelStatus(status, options = {}) {
534
+ const enriched = await mechanicallyEnrichOrdersStatus(status, options);
535
+ const latestPath = join(getFlywheelRunDir(status.runId, options), "latest.json");
536
+ await writeJsonAtomic(latestPath, enriched);
537
+ publishLatestFlywheelStatus(enriched);
538
+ return latestPath;
539
+ }
540
+ function decodeLaunchMetadata(payload) {
541
+ if (typeof payload !== "object" || payload === null) throw new Error("Invalid Flywheel launch metadata");
542
+ const record = payload;
543
+ if (record.version !== 1) throw new Error("Invalid Flywheel launch metadata version");
544
+ for (const key of [
545
+ "runId",
546
+ "workspace",
547
+ "briefPath",
548
+ "briefDisplayPath"
549
+ ]) if (typeof record[key] !== "string" || !record[key]) throw new Error(`Invalid Flywheel launch metadata: ${key}`);
550
+ if (record.briefOverlayPath !== void 0 && (typeof record.briefOverlayPath !== "string" || !record.briefOverlayPath)) throw new Error("Invalid Flywheel launch metadata: briefOverlayPath");
551
+ if (record.orders !== void 0) {
552
+ const orders = record.orders;
553
+ if (!orders || typeof orders !== "object" || typeof orders.bookId !== "string" || !orders.bookId) throw new Error("Invalid Flywheel launch metadata: orders.bookId");
554
+ }
555
+ if (record.scope !== void 0 && record.scope !== "pan-only" && record.scope !== "all-tracked-projects") throw new Error("Invalid Flywheel launch metadata: scope");
556
+ return record;
557
+ }
558
+ async function writeFlywheelLaunchMetadata(metadata, options = {}) {
559
+ const runId = parseFlywheelRunId(metadata.runId);
560
+ return writeJsonAtomic(join(getFlywheelRunDir(runId, options), "launch.json"), {
561
+ ...metadata,
562
+ runId
563
+ });
564
+ }
565
+ async function readFlywheelLaunchMetadata(runId, options = {}) {
566
+ const launchPath = join(getFlywheelRunDir(runId, options), "launch.json");
567
+ try {
568
+ return decodeLaunchMetadata(JSON.parse(await readFile(launchPath, "utf8")));
569
+ } catch (error) {
570
+ if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) === "ENOENT") return null;
571
+ throw error;
572
+ }
573
+ }
574
+ async function readLatestFlywheelStatus(runId, options = {}) {
575
+ const latestPath = join(getFlywheelRunDir(runId, options), "latest.json");
576
+ try {
577
+ return decodeFlywheelStatus(JSON.parse(await readFile(latestPath, "utf8")));
578
+ } catch (error) {
579
+ if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) === "ENOENT") return null;
580
+ throw error;
581
+ }
582
+ }
583
+ async function fileExists(path) {
584
+ try {
585
+ return (await stat$1(path)).isFile();
586
+ } catch (error) {
587
+ if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) === "ENOENT") return false;
588
+ throw error;
589
+ }
590
+ }
591
+ async function deriveRunStatus(runDir, runId, activeRunId) {
592
+ if (await fileExists(join(runDir, "aborted.json"))) return "aborted";
593
+ if (await fileExists(join(runDir, "report.md"))) return "complete";
594
+ if (activeRunId !== runId) return "aborted";
595
+ return isFlywheelGloballyPaused() ? "paused" : "running";
596
+ }
597
+ async function summarizeRun(runId, options, activeRunId) {
598
+ const runDir = getFlywheelRunDir(runId, options);
599
+ const latest = await readLatestFlywheelStatus(runId, options);
600
+ const status = await deriveRunStatus(runDir, runId, activeRunId);
601
+ return {
602
+ id: runId,
603
+ startedAt: latest?.startedAt ?? "",
604
+ status
605
+ };
606
+ }
607
+ async function readCurrentLatestFlywheelStatus(options = {}) {
608
+ const activeRunId = options.activeRunId === void 0 ? getFlywheelActiveRunId() : options.activeRunId;
609
+ if (!activeRunId || !isFlywheelRunId(activeRunId)) return null;
610
+ const activeRun = await getFlywheelRunDetail(activeRunId, options);
611
+ return activeRun?.status === "running" || activeRun?.status === "paused" ? activeRun.latest : null;
612
+ }
613
+ function selectLatestRunIds(entries, limit) {
614
+ const selected = [];
615
+ for (const entry of entries) {
616
+ if (!entry.isDirectory() || !isFlywheelRunId(entry.name)) continue;
617
+ selected.push(entry.name);
618
+ selected.sort((a, b) => runNumber(b) - runNumber(a));
619
+ if (selected.length > limit) selected.length = limit;
620
+ }
621
+ return selected;
622
+ }
623
+ async function listFlywheelRuns(options = {}) {
624
+ const runsDir = getFlywheelRunsDir(options);
625
+ let entries;
626
+ try {
627
+ entries = await readdir(runsDir, { withFileTypes: true });
628
+ } catch (error) {
629
+ if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) === "ENOENT") return [];
630
+ throw error;
631
+ }
632
+ const runIds = selectLatestRunIds(entries, normalizeLimit(options.limit));
633
+ const activeRunId = getFlywheelActiveRunId();
634
+ return (await mapWithConcurrency(runIds, RUN_SUMMARY_CONCURRENCY, (runId) => summarizeRun(runId, options, activeRunId))).sort((a, b) => b.startedAt.localeCompare(a.startedAt));
635
+ }
636
+ /**
637
+ * PAN-1528/PAN-1908: overlay the flywheel capacity gauge from the indexed
638
+ * agents table. This status path must not enumerate state.json files.
639
+ */
640
+ async function countLiveWorkAgents(_options = {}) {
641
+ return countAgentsByStatusRole("running", "work");
642
+ }
643
+ function withLiveAgentsActive(latest, liveCount) {
644
+ if (latest.system.agentsActive === liveCount) return latest;
645
+ return {
646
+ ...latest,
647
+ system: {
648
+ ...latest.system,
649
+ agentsActive: liveCount
650
+ }
651
+ };
652
+ }
653
+ async function getFlywheelRunDetail(runId, options = {}) {
654
+ const runDir = getFlywheelRunDir(runId, options);
655
+ const latest = await readLatestFlywheelStatus(runId, options);
656
+ if (!latest) return null;
657
+ const status = await deriveRunStatus(runDir, runId, options.activeRunId !== void 0 ? options.activeRunId : getFlywheelActiveRunId());
658
+ const reportPath = join(runDir, "report.md");
659
+ const openedPrPath = join(runDir, "opened-pr.json");
660
+ const liveCount = await countLiveWorkAgents(options);
661
+ return {
662
+ id: runId,
663
+ startedAt: latest.startedAt,
664
+ status,
665
+ latest: withLiveAgentsActive(latest, liveCount),
666
+ ...latest.orders ? { orders: latest.orders } : {},
667
+ ...latest.scope ? { scope: latest.scope } : {},
668
+ paths: {
669
+ latest: join(runDir, "latest.json"),
670
+ ...await fileExists(reportPath) ? { report: reportPath } : {},
671
+ ...await fileExists(openedPrPath) ? { openedPr: openedPrPath } : {}
672
+ }
673
+ };
674
+ }
675
+ function clearFlywheelGate() {
676
+ setFlywheelActiveRunId(null);
677
+ setFlywheelGloballyPaused(false);
678
+ publishFlywheelStatusCleared();
679
+ }
680
+ async function resolveLiveFlywheelRunId(options = {}) {
681
+ const candidate = getFlywheelActiveRunId();
682
+ if (!candidate) return null;
683
+ if (!isFlywheelRunId(candidate)) {
684
+ clearFlywheelGate();
685
+ return null;
686
+ }
687
+ if (!await readLatestFlywheelStatus(candidate, options)) {
688
+ clearFlywheelGate();
689
+ return null;
690
+ }
691
+ const status = await deriveRunStatus(getFlywheelRunDir(candidate, options), candidate, candidate);
692
+ if (status === "complete" || status === "aborted") {
693
+ clearFlywheelGate();
694
+ return null;
695
+ }
696
+ return candidate;
697
+ }
698
+ async function abortFlywheelRun(runId, options = {}) {
699
+ const parsed = parseFlywheelRunId(runId);
700
+ await writeJsonAtomic(join(getFlywheelRunDir(parsed, options), "aborted.json"), {
701
+ runId: parsed,
702
+ abortedAt: (/* @__PURE__ */ new Date()).toISOString()
703
+ });
704
+ if (getFlywheelActiveRunId() === parsed) clearFlywheelGate();
705
+ }
706
+ //#endregion
707
+ //#region ../../lib/flywheel-start.ts
708
+ const execAsync = promisify(exec);
709
+ function isInsideRoot(projectRoot, candidate) {
710
+ const relativePath = relative(projectRoot, candidate);
711
+ return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute(relativePath);
712
+ }
713
+ function resolveFlywheelStartBriefPath(cwd, requestedPath) {
714
+ const rawPath = requestedPath?.trim() || "docs/flywheel-brief.md";
715
+ if (rawPath.includes("\0")) throw new Error("Brief path is invalid");
716
+ const root = resolve(cwd);
717
+ const absolutePath = isAbsolute(rawPath) ? resolve(rawPath) : resolve(root, rawPath);
718
+ if (!isInsideRoot(root, absolutePath)) throw new Error("Brief path must stay inside the project root");
719
+ const normalizedRoot = root.endsWith(sep) ? root : `${root}${sep}`;
720
+ const displayPath = absolutePath === root ? "." : relative(root, absolutePath);
721
+ return {
722
+ absolutePath,
723
+ displayPath: absolutePath.startsWith(normalizedRoot) ? displayPath : absolutePath
724
+ };
725
+ }
726
+ async function assertExistingPathInsideRoot(projectRoot, candidate) {
727
+ const [realRoot, realCandidate] = await Promise.all([realpath(projectRoot), realpath(candidate)]);
728
+ if (!isInsideRoot(realRoot, realCandidate)) throw new Error("Brief path must stay inside the project root");
729
+ }
730
+ async function requireFlywheelBrief(cwd, requestedPath) {
731
+ const resolved = resolveFlywheelStartBriefPath(cwd, requestedPath);
732
+ try {
733
+ await assertExistingPathInsideRoot(cwd, resolved.absolutePath);
734
+ await readFile(resolved.absolutePath, "utf8");
735
+ return resolved;
736
+ } catch (error) {
737
+ if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) === "ENOENT") throw new Error(`Flywheel brief not found: ${resolved.displayPath}`);
738
+ throw error;
739
+ }
740
+ }
741
+ /**
742
+ * The flywheel is a project-scoped singleton: it must run from the PRIMARY
743
+ * worktree root, never a linked feature worktree. Every worktree contains
744
+ * docs/flywheel-brief.md, so the brief check alone cannot catch a caller whose
745
+ * shell happens to sit inside a workspaces/feature-* checkout, and an
746
+ * orchestrator spawned there operates inside a live work agent's worktree.
747
+ * A linked worktree is
748
+ * detected by `git rev-parse --git-common-dir` resolving to the primary's
749
+ * .git directory; outside a repo (or on failure) the cwd is kept and the
750
+ * brief check reports its own error.
751
+ */
752
+ async function resolvePrimaryWorktreeRoot(cwd) {
753
+ try {
754
+ const { stdout } = await execAsync("git rev-parse --path-format=absolute --git-common-dir", {
755
+ cwd,
756
+ timeout: 5e3
757
+ });
758
+ const commonDir = stdout.trim();
759
+ if (commonDir.endsWith(`${sep}.git`)) return dirname(commonDir);
760
+ return cwd;
761
+ } catch {
762
+ return cwd;
763
+ }
764
+ }
765
+ //#endregion
766
+ //#region ../../lib/backlog/lookups.ts
767
+ /**
768
+ * Build the {@link ClassifyLookups} the shared pickup module needs from live project
769
+ * state: labels (in-memory issue service), planned (readable xBRIEF spec), and
770
+ * in-pipeline (review status / live workspace). Shared by the dashboard forecast
771
+ * route and the Flywheel run-cohort snapshot so both classify issues identically
772
+ * (PAN-2006 single source of truth). The issue service is lazy-required to avoid a
773
+ * static lib → dashboard layering edge.
774
+ */
775
+ function buildClassifyLookups(projectRoot, opts = {}) {
776
+ const labelsByIssue = /* @__PURE__ */ new Map();
777
+ if (!opts?.labels) try {
778
+ const { getSharedIssueService } = (init_issue_service_singleton(), __toCommonJS(issue_service_singleton_exports));
779
+ for (const issue of getSharedIssueService().getIssues()) {
780
+ const id = typeof issue["identifier"] === "string" ? issue["identifier"].toUpperCase() : "";
781
+ if (!id) continue;
782
+ const names = (Array.isArray(issue["labels"]) ? issue["labels"] : []).map((l) => typeof l === "string" ? l : l?.name ?? "").filter((s) => Boolean(s));
783
+ labelsByIssue.set(id, names);
784
+ }
785
+ } catch {}
786
+ const specsDir = join(projectRoot, ".pan", "specs");
787
+ const specIssues = /* @__PURE__ */ new Set();
788
+ if (existsSync(specsDir)) for (const f of readdirSync(specsDir)) {
789
+ const m = /^[\d-]+-([A-Z]+-\d+)-/i.exec(f);
790
+ if (m) specIssues.add(m[1].toUpperCase());
791
+ }
792
+ const workspacesDir = join(projectRoot, "workspaces");
793
+ return {
794
+ labels: opts?.labels ?? ((id) => labelsByIssue.get(id.toUpperCase()) ?? []),
795
+ isPlanned: (id) => {
796
+ const u = id.toUpperCase();
797
+ return specIssues.has(u);
798
+ },
799
+ isInPipeline: (id) => {
800
+ const rs = getReviewStatusSync(id.toUpperCase());
801
+ return rs !== null && rs.reviewStatus !== "pending" || existsSync(join(workspacesDir, `feature-${id.toLowerCase()}`));
802
+ }
803
+ };
804
+ }
805
+ //#endregion
806
+ //#region ../../lib/cloister/flywheel.ts
807
+ init_sequence_io();
808
+ init_projects();
809
+ init_state_read_home();
810
+ init_control_settings();
811
+ init_pickup();
812
+ init_pipeline_membership_gather();
813
+ init_pipeline_membership();
814
+ const FLYWHEEL_ORCHESTRATOR_AGENT_ID = "flywheel-orchestrator";
815
+ function isIssueInResolvedPipeline(issueId, memberships) {
816
+ return memberships.some((membership) => membership.issueId.toUpperCase() === issueId.toUpperCase() && membership.inPipeline);
817
+ }
818
+ async function activeOrderBookIssues(projectRoot, runId, deps = {}) {
819
+ const activeRunId = runId ?? (deps.activeRunId ?? getFlywheelActiveRunId)();
820
+ if (!activeRunId) return /* @__PURE__ */ new Set();
821
+ const bookId = (await (deps.readLaunch ?? readFlywheelLaunchMetadata)(activeRunId))?.orders?.bookId;
822
+ if (!bookId) return /* @__PURE__ */ new Set();
823
+ const stateRoot = deps.stateRoot?.(projectRoot) ?? (() => {
824
+ const project = findProjectByPathSync(projectRoot);
825
+ return project ? resolveStateReadHomeSync(project).root : null;
826
+ })();
827
+ if (!stateRoot) return /* @__PURE__ */ new Set();
828
+ const book = (deps.getBook ?? getBook)(stateRoot, bookId);
829
+ return new Set(book?.items.map((item) => item.issue.toUpperCase()) ?? []);
830
+ }
831
+ const FlywheelRunIdSchema = Schema.String.check(Schema.isPattern(/^RUN-\d+$/));
832
+ const decodeFlywheelRunId = Schema.decodeUnknownSync(FlywheelRunIdSchema);
833
+ function parseRunId(runId) {
834
+ return decodeFlywheelRunId(runId);
835
+ }
836
+ function defaultFlywheelRunId() {
837
+ return parseRunId(`RUN-${Date.now()}`);
838
+ }
839
+ function internalDashboardOrigin() {
840
+ const port = Number.parseInt(process.env["API_PORT"] ?? process.env["PORT"] ?? "3011", 10);
841
+ return process.env["OVERDECK_INTERNAL_DASHBOARD_URL"] ?? `http://127.0.0.1:${port}`;
842
+ }
843
+ async function fetchIssueRowsFromDashboard() {
844
+ const dashboardOrigin = internalDashboardOrigin();
845
+ const token = getInternalTokenSync();
846
+ if (!token) {
847
+ console.error("[flywheel] Cannot load issue metadata: internal dashboard token is unavailable");
848
+ return [];
849
+ }
850
+ try {
851
+ const response = await fetch(new URL("/api/issues?cycle=all&includeCompleted=true", dashboardOrigin), { headers: {
852
+ [INTERNAL_TOKEN_HEADER]: token,
853
+ origin: dashboardOrigin
854
+ } });
855
+ if (!response.ok) {
856
+ console.error(`[flywheel] Cannot load issue metadata from dashboard: HTTP ${response.status}`);
857
+ return [];
858
+ }
859
+ const body = await response.json();
860
+ if (!Array.isArray(body)) {
861
+ console.error("[flywheel] Cannot load issue metadata from dashboard: response was not an array");
862
+ return [];
863
+ }
864
+ return body;
865
+ } catch (error) {
866
+ console.error("[flywheel] Cannot load issue metadata from dashboard:", error);
867
+ return [];
868
+ }
869
+ }
870
+ async function flywheelRunConfigurationSection(options, runId) {
871
+ const configLines = [
872
+ options.harness ? `Harness: ${options.harness}` : void 0,
873
+ options.effort ? `Effort: ${options.effort}` : void 0,
874
+ options.minAgents ? `Min concurrent agents (target): ${options.minAgents}` : void 0,
875
+ options.maxAgents ? `Max concurrent agents (ceiling): ${options.maxAgents}` : void 0,
876
+ options.scope ? `Scope: ${options.scope}` : void 0,
877
+ typeof options.autoPickupBacklog === "boolean" ? `Auto-pickup backlog: ${options.autoPickupBacklog}` : void 0,
878
+ typeof options.requireUatBeforeMerge === "boolean" ? `Require UAT before merge: ${options.requireUatBeforeMerge}` : void 0
879
+ ].filter(Boolean).join("\n");
880
+ let sequenceSection = "";
881
+ const projectRoot = process.cwd();
882
+ const orderBookIssues = await activeOrderBookIssues(projectRoot, runId);
883
+ if (options.autoPickupBacklog || orderBookIssues.size > 0) {
884
+ const seqPath = join(projectRoot, ".pan", "backlog", "sequence.md");
885
+ if (existsSync(seqPath)) try {
886
+ const parsed = parseSequenceMd(readFileSync(seqPath, "utf-8"));
887
+ if (parsed.ok) {
888
+ const getIssueRows = async () => fetchIssueRowsFromDashboard();
889
+ const issueRowMap = new Map((await getIssueRows()).map((i) => [i.ref ?? i.identifier ?? "", i]));
890
+ const issueLabelsLookup = (issueId) => issueRowMap.get(issueId)?.labels ?? [];
891
+ const AUTHORIZED_AUTHORS = new Set(["eltmon", "panopticon-agent[bot]"]);
892
+ const isAuthorizedIssue = (issueId) => {
893
+ const row = issueRowMap.get(issueId);
894
+ if (!row) return false;
895
+ if (row.author && AUTHORIZED_AUTHORS.has(row.author)) return true;
896
+ return (typeof row.assignee === "string" ? row.assignee : row.assignee?.name) === "eltmon";
897
+ };
898
+ const specsDir = join(projectRoot, ".pan", "specs");
899
+ const issuesWithSpecs = /* @__PURE__ */ new Set();
900
+ const declaredFootprints = [];
901
+ if (existsSync(specsDir)) for (const f of readdirSync(specsDir)) {
902
+ const match = /^[\d-]+-([A-Z]+-\d+)-/i.exec(f);
903
+ if (!match) continue;
904
+ const issueId = match[1].toUpperCase();
905
+ issuesWithSpecs.add(issueId);
906
+ try {
907
+ const doc = JSON.parse(readFileSync(join(specsDir, f), "utf-8"));
908
+ declaredFootprints.push(declaredIssueFootprint(issueId, doc));
909
+ } catch {}
910
+ }
911
+ const projectConfig = findProjectByPathSync(projectRoot);
912
+ const predictedConflictSignals = computePredictedConflictSignals(declaredFootprints, { hotspots: getProjectSwarmHotspots(projectConfig) });
913
+ const isReadyOrHasPrd = (issueId) => {
914
+ const id = issueId.toUpperCase();
915
+ if (issuesWithSpecs.has(id)) return true;
916
+ return existsSync(join(projectRoot, ".pan", "drafts", `${id}.md`));
917
+ };
918
+ const membershipAvailable = Boolean(projectConfig?.github_repo);
919
+ const memberships = projectConfig?.github_repo ? (await gatherProjectLensSignals(projectConfig)).map(resolvePipelineMembership) : [];
920
+ const isInPipeline = (issueId) => membershipAvailable ? isIssueInResolvedPipeline(issueId, memberships) : true;
921
+ const top10 = parsed.doc.nodes.slice(0, 10).map((n) => ` #${n.rank} ${n.issue}: ${n.why.slice(0, 100)} [gate:${n.gate}]`);
922
+ const nextPick = pickFromSequence(parsed.doc.nodes, {
923
+ issueLabels: issueLabelsLookup,
924
+ isAuthorizedIssue,
925
+ isReadyOrHasPrd,
926
+ isInPipeline,
927
+ requireReady: true,
928
+ autoPickupBacklog: options.autoPickupBacklog,
929
+ activeBookMembership: orderBookIssues,
930
+ predictedConflictSignals
931
+ });
932
+ let nextLine;
933
+ let pickInstruction;
934
+ if (!membershipAvailable) {
935
+ nextLine = "MEMBERSHIP UNAVAILABLE: project has no GitHub repository; auto-pickup is disabled";
936
+ pickInstruction = "\n\nIMPORTANT: Canonical pipeline membership is unavailable for this project. Do NOT auto-start backlog work; surface the missing github_repo configuration to the operator.";
937
+ } else if (!nextPick) {
938
+ nextLine = "No eligible issue found in sequence — fall back to normal priority";
939
+ pickInstruction = "";
940
+ } else if (nextPick.planning === "interactive") {
941
+ nextLine = `NEEDS OPERATOR ACTION: ${nextPick.issueId} (rank ${nextPick.rank}) has planning=interactive — do NOT auto-start; operator must run 'pan plan ${nextPick.issueId}'`;
942
+ pickInstruction = `\n\nIMPORTANT: auto_pickup_backlog=true. The top-ranked issue requires interactive planning and MUST NOT be auto-started. Surface it to the operator for manual 'pan plan' invocation instead of auto-picking it.`;
943
+ } else {
944
+ const conflictSuffix = typeof nextPick.predictedConflictCount === "number" ? `, predictedConflicts=${nextPick.predictedConflictCount}${nextPick.predictedConflictsWith?.length ? ` with ${nextPick.predictedConflictsWith.join(", ")}` : ""}` : "";
945
+ nextLine = `MUST start next: ${nextPick.issueId} (rank ${nextPick.rank}, planning=${nextPick.planning}${conflictSuffix})`;
946
+ pickInstruction = `\n\nIMPORTANT: auto_pickup_backlog=true. You MUST pick the "MUST start next" issue above as your next startup target. Do NOT apply your own P0-P3/oldest-first ranking while a sequence is available.`;
947
+ }
948
+ sequenceSection = `\n\nBacklog sequence (${parsed.doc.nodes.length} issues ranked):\n${top10.join("\n")}\n${nextLine}${pickInstruction}`;
949
+ }
950
+ } catch {}
951
+ }
952
+ return (configLines ? `\n\nRun configuration:\n${configLines}` : "") + sequenceSection;
953
+ }
954
+ async function defaultFlywheelPrompt(runId, options, briefContent) {
955
+ return `FLYWHEEL ORCHESTRATOR TASK for ${runId}:
956
+
957
+ Run the Fix-All Flywheel loop. Keep status snapshots current, coordinate Overdeck roles through the normal pipeline surfaces, respect the configured run scope and agent cap, and wait for explicit lifecycle instructions when the run is paused or complete.${await flywheelRunConfigurationSection(options, runId)}${options.briefPath ? `\n\nBrief path: ${options.briefPath}\n\n${briefContent ?? ""}` : ""}`;
958
+ }
959
+ function getLocalFlywheelRunDir(runId) {
960
+ return join(process.env.OVERDECK_HOME ?? join(homedir(), ".overdeck"), "flywheel", "runs", runId);
961
+ }
962
+ async function saveResumeSessionId(runId, sessionId) {
963
+ const runDir = getLocalFlywheelRunDir(runId);
964
+ await mkdir(runDir, { recursive: true });
965
+ await writeFile(join(runDir, "resume-session.json"), JSON.stringify({
966
+ sessionId,
967
+ pausedAt: (/* @__PURE__ */ new Date()).toISOString()
968
+ }), "utf-8");
969
+ }
970
+ async function loadResumeSessionId(runId) {
971
+ try {
972
+ const raw = await readFile(join(getLocalFlywheelRunDir(runId), "resume-session.json"), "utf-8");
973
+ const parsed = JSON.parse(raw);
974
+ return typeof parsed.sessionId === "string" ? parsed.sessionId : null;
975
+ } catch {
976
+ return null;
977
+ }
978
+ }
979
+ function isFlywheelDevcontainerRuntime(env = process.env) {
980
+ const disabledDeacon = env.OVERDECK_DISABLE_DEACON?.toLowerCase();
981
+ if (disabledDeacon === "1" || disabledDeacon === "true") return true;
982
+ const hostname = env.HOSTNAME?.toLowerCase() ?? "";
983
+ return hostname.includes("devcontainer") || hostname.startsWith("api-feature-") || hostname.startsWith("workspace-");
984
+ }
985
+ /**
986
+ * Resume prompt. PAN-2006 FR-8: re-attach the standing brief on resume so its
987
+ * directives (pipeline-unblock override, never-block, red-main-first) survive a
988
+ * resume + context compaction — the pre-PAN-2006 resume prompt only pointed at
989
+ * FLYWHEEL-STATE.md and a long-running orchestrator could drift off-brief.
990
+ */
991
+ function buildFlywheelResumePrompt(configSection, briefContent) {
992
+ return `FLYWHEEL RESUME: You were paused by the operator. Resume the tick loop from your prior state. Check \`docs/FLYWHEEL-STATE.md\` and the latest status snapshot for context.${configSection}${briefContent ? `\n\n--- Standing brief (re-read it — it governs pickup, unblocking, and never-block) ---\n\n${briefContent}` : ""}`;
993
+ }
994
+ function withOrderBookBriefOverlay(briefContent, overlayPath, overlayContent) {
995
+ if (!overlayContent) return briefContent;
996
+ const standard = briefContent?.trimEnd() ?? "";
997
+ const overlay = `--- Order-book brief overlay${overlayPath ? `: ${overlayPath}` : ""} ---\n\n${overlayContent.trim()}`;
998
+ return standard ? `${standard}\n\n${overlay}` : overlay;
999
+ }
1000
+ async function spawnFlywheelAgent(runId, options = {}) {
1001
+ const workspace = options.workspace ?? process.cwd();
1002
+ const briefPath = options.briefPath ?? join(workspace, "docs", "flywheel-brief.md");
1003
+ let briefOverlayPath = options.briefOverlayPath;
1004
+ let briefOverlayContent = options.briefOverlayContent;
1005
+ if (briefOverlayPath && briefOverlayContent === void 0) {
1006
+ const resolvedOverlay = await requireFlywheelBrief(workspace, briefOverlayPath);
1007
+ briefOverlayPath = resolvedOverlay.displayPath;
1008
+ briefOverlayContent = await readFile(resolvedOverlay.absolutePath, "utf8");
1009
+ }
1010
+ const briefContent = withOrderBookBriefOverlay(await readFile(briefPath, "utf8").catch(() => void 0), briefOverlayPath, briefOverlayContent);
1011
+ return spawnRun(runId, "flywheel", {
1012
+ agentId: FLYWHEEL_ORCHESTRATOR_AGENT_ID,
1013
+ workspace,
1014
+ prompt: options.resumeSessionId ? buildFlywheelResumePrompt(await flywheelRunConfigurationSection(options, runId), briefContent) : options.prompt ?? await defaultFlywheelPrompt(runId, {
1015
+ ...options,
1016
+ briefPath
1017
+ }, briefContent),
1018
+ model: options.model,
1019
+ harness: options.harness,
1020
+ effort: options.effort,
1021
+ allowHost: true,
1022
+ registerConversation: true,
1023
+ resumeSessionId: options.resumeSessionId,
1024
+ flywheelRunId: runId
1025
+ });
1026
+ }
1027
+ function withFlywheelAutonomyOptions(options) {
1028
+ return {
1029
+ ...options,
1030
+ autoPickupBacklog: options.autoPickupBacklog ?? isFlywheelAutoPickupBacklog(),
1031
+ requireUatBeforeMerge: options.requireUatBeforeMerge ?? isFlywheelRequireUatBeforeMerge()
1032
+ };
1033
+ }
1034
+ async function spawnFlywheel(options = {}) {
1035
+ if (isFlywheelDevcontainerRuntime(options.env)) throw new Error("Refusing to spawn flywheel-orchestrator inside a workspace devcontainer");
1036
+ const activeRunId = await resolveLiveFlywheelRunId();
1037
+ if (activeRunId) throw new Error(`Flywheel run ${activeRunId} is already active; pause, resume, or report it before starting another run`);
1038
+ const runId = options.runId ? parseRunId(options.runId) : defaultFlywheelRunId();
1039
+ const agent = await spawnFlywheelAgent(runId, withFlywheelAutonomyOptions(options));
1040
+ setFlywheelActiveRunId(runId);
1041
+ setFlywheelGloballyPaused(false);
1042
+ try {
1043
+ const workspace = options.workspace ?? process.cwd();
1044
+ const seqPath = join(workspace, ".pan", "backlog", "sequence.md");
1045
+ if (existsSync(seqPath)) {
1046
+ const parsed = parseSequenceMd(readFileSync(seqPath, "utf-8"));
1047
+ if (parsed.ok) saveRunCohort(runId, computeCohort(parsed.doc.nodes, buildClassifyLookups(workspace), options.maxAgents ?? 5, options.autoPickupBacklog ?? isFlywheelAutoPickupBacklog(), await activeOrderBookIssues(workspace, runId)));
1048
+ }
1049
+ } catch {}
1050
+ return agent;
1051
+ }
1052
+ async function abortSpawnedFlywheel(runId) {
1053
+ try {
1054
+ await Effect.runPromise(stopAgent(FLYWHEEL_ORCHESTRATOR_AGENT_ID));
1055
+ } finally {
1056
+ await abortFlywheelRun(runId);
1057
+ }
1058
+ }
1059
+ async function pauseFlywheel() {
1060
+ const activeRunId = getFlywheelActiveRunId();
1061
+ if (activeRunId) try {
1062
+ const sessionId = (await readFile(join(getAgentDir(FLYWHEEL_ORCHESTRATOR_AGENT_ID), "session.id"), "utf-8")).trim();
1063
+ if (sessionId) await saveResumeSessionId(activeRunId, sessionId);
1064
+ } catch {}
1065
+ setFlywheelGloballyPaused(true);
1066
+ await Effect.runPromise(stopAgent(FLYWHEEL_ORCHESTRATOR_AGENT_ID));
1067
+ return { activeRunId };
1068
+ }
1069
+ async function resumeFlywheel(options = {}) {
1070
+ if (isFlywheelDevcontainerRuntime(options.env)) throw new Error("Refusing to resume flywheel-orchestrator inside a workspace devcontainer");
1071
+ const activeRunId = getFlywheelActiveRunId();
1072
+ if (!activeRunId) throw new Error("No active flywheel run to resume");
1073
+ const runId = parseRunId(activeRunId);
1074
+ const resumeSessionId = options.resumeSessionId ?? await loadResumeSessionId(runId) ?? void 0;
1075
+ const launch = await readFlywheelLaunchMetadata(runId);
1076
+ const agent = await spawnFlywheelAgent(runId, withFlywheelAutonomyOptions({
1077
+ ...options,
1078
+ workspace: options.workspace ?? launch?.workspace,
1079
+ briefPath: options.briefPath ?? launch?.briefPath,
1080
+ briefOverlayPath: options.briefOverlayPath ?? launch?.briefOverlayPath,
1081
+ resumeSessionId
1082
+ }));
1083
+ setFlywheelGloballyPaused(false);
1084
+ return {
1085
+ activeRunId,
1086
+ agent
1087
+ };
1088
+ }
1089
+ //#endregion
1090
+ export { advanceQueue as A, getBook as B, readCurrentLatestFlywheelStatus as C, writeFlywheelLaunchMetadata as D, subscribeLatestFlywheelStatus as E, setItemRequirements as F, liveOrderIssueLookup as H, setSettings as I, setStatus as L, moveItem as M, removeItem as N, writeLatestFlywheelStatus as O, renameBook as P, backlogCandidates as R, nextFlywheelRunId as S, resolveLiveFlywheelRunId as T, listBooks as V, clearFlywheelGate as _, isFlywheelDevcontainerRuntime as a, isFlywheelRunId as b, pauseFlywheel as c, spawnFlywheel as d, spawnFlywheelAgent as f, abortFlywheelRun as g, resolvePrimaryWorktreeRoot as h, buildFlywheelResumePrompt as i, createBook as j, addItems as k, resumeFlywheel as l, requireFlywheelBrief as m, abortSpawnedFlywheel as n, isIssueInResolvedPipeline as o, buildClassifyLookups as p, activeOrderBookIssues as r, loadResumeSessionId as s, FLYWHEEL_ORCHESTRATOR_AGENT_ID as t, saveResumeSessionId as u, getFlywheelRunDetail as v, readFlywheelLaunchMetadata as w, listFlywheelRuns as x, getFlywheelRunDir as y, computeBookProgress as z };
1091
+
1092
+ //# sourceMappingURL=flywheel-BiT3odRb.js.map