@band-app/server 0.13.0 → 0.14.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 (168) hide show
  1. package/dist/client/assets/{DockviewTerminalContainer-CLlvqDbZ.js → DockviewTerminalContainer-CjLCp0Ep.js} +2 -2
  2. package/dist/client/assets/{TerminalPanel-BE9r8rEY.js → TerminalPanel-Cu7fEaGN.js} +1 -1
  3. package/dist/client/assets/{_basePickBy-Dh2WFRMd.js → _basePickBy-CQtQtDdV.js} +1 -1
  4. package/dist/client/assets/{_baseUniq-2BIwN7J1.js → _baseUniq-D4iUo06T.js} +1 -1
  5. package/dist/client/assets/{arc-Wsw6SggN.js → arc-Bk8y2eXC.js} +1 -1
  6. package/dist/client/assets/{architectureDiagram-VXUJARFQ-XSuarAoX.js → architectureDiagram-VXUJARFQ-nOygF9m2.js} +1 -1
  7. package/dist/client/assets/{blockDiagram-VD42YOAC-DSc5TOI1.js → blockDiagram-VD42YOAC-CZ4Nt28v.js} +1 -1
  8. package/dist/client/assets/{c4Diagram-YG6GDRKO-DLlwzfnX.js → c4Diagram-YG6GDRKO-C31ZTlu2.js} +1 -1
  9. package/dist/client/assets/channel-BgmjEVPj.js +1 -0
  10. package/dist/client/assets/{chunk-4BX2VUAB-CWduv96U.js → chunk-4BX2VUAB-GjIrL7gq.js} +1 -1
  11. package/dist/client/assets/{chunk-55IACEB6-D9A39zkK.js → chunk-55IACEB6-Dd6rfkjS.js} +1 -1
  12. package/dist/client/assets/{chunk-B4BG7PRW-CUMptYWA.js → chunk-B4BG7PRW-Dzfqlv3x.js} +1 -1
  13. package/dist/client/assets/{chunk-DI55MBZ5-DIwkyxaQ.js → chunk-DI55MBZ5-CP20GTKI.js} +1 -1
  14. package/dist/client/assets/{chunk-FMBD7UC4-D8F2lei-.js → chunk-FMBD7UC4-BjMT67vC.js} +1 -1
  15. package/dist/client/assets/{chunk-QN33PNHL-C83_AULb.js → chunk-QN33PNHL-DjTHrDYb.js} +1 -1
  16. package/dist/client/assets/{chunk-QZHKN3VN-Dtw-3_KI.js → chunk-QZHKN3VN-DaZKkfet.js} +1 -1
  17. package/dist/client/assets/{chunk-TZMSLE5B-Cg9TlQ9E.js → chunk-TZMSLE5B-C-s0f3Nv.js} +1 -1
  18. package/dist/client/assets/classDiagram-2ON5EDUG-BKsagNLe.js +1 -0
  19. package/dist/client/assets/classDiagram-v2-WZHVMYZB-BKsagNLe.js +1 -0
  20. package/dist/client/assets/clone-CBcd3GIz.js +1 -0
  21. package/dist/client/assets/{cose-bilkent-S5V4N54A-Drnoe6yO.js → cose-bilkent-S5V4N54A-DWG1ghIg.js} +1 -1
  22. package/dist/client/assets/{dagre-6UL2VRFP-BgY7fnyf.js → dagre-6UL2VRFP-D5Xahd1k.js} +1 -1
  23. package/dist/client/assets/{diagram-PSM6KHXK-bmxBt_Q-.js → diagram-PSM6KHXK-DB5Yj4_A.js} +1 -1
  24. package/dist/client/assets/{diagram-QEK2KX5R-DGUqlb8j.js → diagram-QEK2KX5R-CaI4Qm9S.js} +1 -1
  25. package/dist/client/assets/{diagram-S2PKOQOG-DxXpOhvW.js → diagram-S2PKOQOG-Bc8uBUs8.js} +1 -1
  26. package/dist/client/assets/{erDiagram-Q2GNP2WA-eZBtaSzD.js → erDiagram-Q2GNP2WA-BEdcnVfH.js} +1 -1
  27. package/dist/client/assets/{flowDiagram-NV44I4VS-Dfwd3PGB.js → flowDiagram-NV44I4VS-CP1RMYLo.js} +1 -1
  28. package/dist/client/assets/{ganttDiagram-JELNMOA3-BAMeSthd.js → ganttDiagram-JELNMOA3-DybSY1zy.js} +1 -1
  29. package/dist/client/assets/{gitGraphDiagram-V2S2FVAM-Dts_Yrpu.js → gitGraphDiagram-V2S2FVAM-B1zM9cMa.js} +1 -1
  30. package/dist/client/assets/{graph-BuNOEI6L.js → graph-CPZWfRvB.js} +1 -1
  31. package/dist/client/assets/{highlighted-body-B3W2YXNL-Btj0UZe1.js → highlighted-body-B3W2YXNL-Bugc5R-I.js} +1 -1
  32. package/dist/client/assets/{index-cErwJT25.js → index-BGq7dGXw.js} +1 -1
  33. package/dist/client/assets/{index-CF7iJtA6.js → index-BKUORVg0.js} +1 -1
  34. package/dist/client/assets/{index-DOb48mtv.js → index-BQkn45ME.js} +1 -1
  35. package/dist/client/assets/{index-DR-TpUg3.js → index-BSZ6dtOY.js} +1 -1
  36. package/dist/client/assets/{index-xEL9mxnj.js → index-BSvAdzfH.js} +1 -1
  37. package/dist/client/assets/{index-DaorCZSP.js → index-Bu-ZuLPi.js} +1 -1
  38. package/dist/client/assets/{index-sMR7WunY.js → index-BydRuBb_.js} +1 -1
  39. package/dist/client/assets/{index-JytYW91Z.js → index-CYD8Chzm.js} +1 -1
  40. package/dist/client/assets/{index-gv6bT0S4.js → index-CijlrIEA.js} +1 -1
  41. package/dist/client/assets/{index-Vaa1H_pP.js → index-Cm01-0la.js} +1 -1
  42. package/dist/client/assets/{index-tIReXko0.js → index-CrF4PAiW.js} +1 -1
  43. package/dist/client/assets/{index-BFyseSVV.js → index-D4U4UdW8.js} +1 -1
  44. package/dist/client/assets/{index-Ktl6P-nc.js → index-D5BWxHiy.js} +1 -1
  45. package/dist/client/assets/{index-Bmhh2EB_.js → index-DEVawlAU.js} +1 -1
  46. package/dist/client/assets/{index-Qm_HbX1-.js → index-SP7EGmTJ.js} +1 -1
  47. package/dist/client/assets/{index-g5xXrehm.js → index-X_vPvtM3.js} +1 -1
  48. package/dist/client/assets/{index-D7TqJ9RF.js → index-mOXvCPx7.js} +1 -1
  49. package/dist/client/assets/{index-B4xvdE9X.js → index-vP2I9_aT.js} +1 -1
  50. package/dist/client/assets/{infoDiagram-HS3SLOUP-ygUopIDr.js → infoDiagram-HS3SLOUP-BCk158Sc.js} +1 -1
  51. package/dist/client/assets/{journeyDiagram-XKPGCS4Q-C7fCACOj.js → journeyDiagram-XKPGCS4Q-Dmw405Jr.js} +1 -1
  52. package/dist/client/assets/{kanban-definition-3W4ZIXB7-4jf7Ztsb.js → kanban-definition-3W4ZIXB7-DqNJB_Z3.js} +1 -1
  53. package/dist/client/assets/{layout-DBEGDIe2.js → layout-ODCofYfe.js} +1 -1
  54. package/dist/client/assets/{linear-2Gp1gLY9.js → linear-CHYpf9oZ.js} +1 -1
  55. package/dist/client/assets/{main-CzHZzsmJ.js → main-81Q8XW4n.js} +296 -289
  56. package/dist/client/assets/main-DYrDxnSM.css +1 -0
  57. package/dist/client/assets/{mindmap-definition-VGOIOE7T-CiziEudd.js → mindmap-definition-VGOIOE7T-DD4Ndh7U.js} +1 -1
  58. package/dist/client/assets/{pieDiagram-ADFJNKIX-DTFtaGug.js → pieDiagram-ADFJNKIX-C9vB0eMW.js} +1 -1
  59. package/dist/client/assets/{quadrantDiagram-AYHSOK5B-fbALF3fd.js → quadrantDiagram-AYHSOK5B-DKJimp3K.js} +1 -1
  60. package/dist/client/assets/{requirementDiagram-UZGBJVZJ-CRl9BPyr.js → requirementDiagram-UZGBJVZJ-_AjYejyE.js} +1 -1
  61. package/dist/client/assets/{sankeyDiagram-TZEHDZUN-RgshY6u-.js → sankeyDiagram-TZEHDZUN-BN_ggjKc.js} +1 -1
  62. package/dist/client/assets/{sequenceDiagram-WL72ISMW-BbgPIX0Q.js → sequenceDiagram-WL72ISMW-Ck-zlUdD.js} +1 -1
  63. package/dist/client/assets/{square-terminal-DCU0c-OS.js → square-terminal-DVejknjY.js} +1 -1
  64. package/dist/client/assets/{stateDiagram-FKZM4ZOC-feRu8oRh.js → stateDiagram-FKZM4ZOC-Ccmp8_yK.js} +1 -1
  65. package/dist/client/assets/stateDiagram-v2-4FDKWEC3-Cgq8vGxD.js +1 -0
  66. package/dist/client/assets/{timeline-definition-IT6M3QCI-BqWKbKID.js → timeline-definition-IT6M3QCI-Bm5sYZxz.js} +1 -1
  67. package/dist/client/assets/{treemap-GDKQZRPO-D0xFOnga.js → treemap-GDKQZRPO-C6oEKt2u.js} +1 -1
  68. package/dist/client/assets/{useSessionListContext-PZqsgbdH.js → useSessionListContext-l-QdtVht.js} +1 -1
  69. package/dist/client/assets/{workspace._workspaceId-djkhDM0B.js → workspace._workspaceId-BPktlGJd.js} +1 -1
  70. package/dist/client/assets/{workspace._workspaceId.changes-InUdTCW0.js → workspace._workspaceId.changes-DNu9WOV2.js} +1 -1
  71. package/dist/client/assets/workspace._workspaceId.code-DP6cBpn1.js +1 -0
  72. package/dist/client/assets/{workspace._workspaceId.code._-iCOKNXeZ.js → workspace._workspaceId.code._-BHhCSQ0w.js} +1 -1
  73. package/dist/client/assets/{workspace._workspaceId.code.index-DMKkXryF.js → workspace._workspaceId.code.index-0y_GQ6sP.js} +1 -1
  74. package/dist/client/assets/{workspace._workspaceId.index-BZyamHNS.js → workspace._workspaceId.index-CtrlsI9z.js} +1 -1
  75. package/dist/client/assets/{workspace._workspaceId.terminal-4F7quTy3.js → workspace._workspaceId.terminal-DsvwvNc_.js} +2 -2
  76. package/dist/client/assets/{xychartDiagram-PRI3JC2R-DicPcjot.js → xychartDiagram-PRI3JC2R-ru_cdw1P.js} +1 -1
  77. package/dist/server/assets/{DockviewTerminalContainer-BBQnIZa3.js → DockviewTerminalContainer-DVUKt_HJ.js} +3 -3
  78. package/dist/server/assets/{TerminalPanel-B1dKqOMK.js → TerminalPanel-hEaDQqdo.js} +1 -1
  79. package/dist/server/assets/{_basePickBy-BoCJVKe_.js → _basePickBy-Nag5vQgo.js} +2 -2
  80. package/dist/server/assets/{_baseUniq-DCXNOsnI.js → _baseUniq-BcTT1Srn.js} +1 -1
  81. package/dist/server/assets/{_tanstack-start-manifest_v-2CeISY5W.js → _tanstack-start-manifest_v-D0rpEWOW.js} +1 -1
  82. package/dist/server/assets/{arc-BFMEbbxV.js → arc-CDj2zIqg.js} +1 -1
  83. package/dist/server/assets/{architecture-7HQA4BMR-4b2GJppC.js → architecture-7HQA4BMR-7A5zOnYc.js} +6 -6
  84. package/dist/server/assets/{architectureDiagram-VXUJARFQ-iVW_FQ4S.js → architectureDiagram-VXUJARFQ--uDzxMk3.js} +6 -6
  85. package/dist/server/assets/{blockDiagram-VD42YOAC-D1iPUb9l.js → blockDiagram-VD42YOAC-DAc1UHQ6.js} +6 -6
  86. package/dist/server/assets/{c4Diagram-YG6GDRKO-DI4Ztwr3.js → c4Diagram-YG6GDRKO-ByeFZAO1.js} +2 -2
  87. package/dist/server/assets/{channel-VwPrL84U.js → channel-B6u30R-7.js} +1 -1
  88. package/dist/server/assets/{chunk-4BX2VUAB-B9WFGVXO.js → chunk-4BX2VUAB-X_mApFBH.js} +1 -1
  89. package/dist/server/assets/{chunk-55IACEB6-cnFKsxmn.js → chunk-55IACEB6-DMO5XJKd.js} +1 -1
  90. package/dist/server/assets/{chunk-B4BG7PRW-DVIhTopX.js → chunk-B4BG7PRW-Da7HlBM1.js} +4 -4
  91. package/dist/server/assets/{chunk-DI55MBZ5-a2cj65b-.js → chunk-DI55MBZ5-DuioLWo-.js} +3 -3
  92. package/dist/server/assets/{chunk-FMBD7UC4-D79uNYe4.js → chunk-FMBD7UC4-BhKTk6rW.js} +1 -1
  93. package/dist/server/assets/{chunk-QN33PNHL-BDbkmWdo.js → chunk-QN33PNHL-BgZXw9n5.js} +1 -1
  94. package/dist/server/assets/{chunk-QZHKN3VN-CIC4C0nk.js → chunk-QZHKN3VN-DHuwppPm.js} +1 -1
  95. package/dist/server/assets/{chunk-TZMSLE5B-BQBr1RGS.js → chunk-TZMSLE5B-w8fhHHwn.js} +1 -1
  96. package/dist/server/assets/{classDiagram-v2-WZHVMYZB-CtbqESgu.js → classDiagram-2ON5EDUG-BZf5qvSp.js} +5 -5
  97. package/dist/server/assets/{classDiagram-2ON5EDUG-CtbqESgu.js → classDiagram-v2-WZHVMYZB-BZf5qvSp.js} +5 -5
  98. package/dist/server/assets/{clone-Bnbf9Iqg.js → clone-CjoEs-v-.js} +1 -1
  99. package/dist/server/assets/{cose-bilkent-S5V4N54A-DQl5SFk6.js → cose-bilkent-S5V4N54A-BNk0NAbB.js} +1 -1
  100. package/dist/server/assets/{dagre-6UL2VRFP-DWcFImvS.js → dagre-6UL2VRFP-C0_F8CHc.js} +6 -6
  101. package/dist/server/assets/{diagram-PSM6KHXK-CAIVqsc3.js → diagram-PSM6KHXK-LARMaMiS.js} +7 -7
  102. package/dist/server/assets/{diagram-QEK2KX5R-Dc8wo9c1.js → diagram-QEK2KX5R-jKvozWzw.js} +6 -6
  103. package/dist/server/assets/{diagram-S2PKOQOG-ZNcpDFrx.js → diagram-S2PKOQOG-5a2K9q2r.js} +6 -6
  104. package/dist/server/assets/{erDiagram-Q2GNP2WA-BYLAWy_j.js → erDiagram-Q2GNP2WA-DPxBpQns.js} +4 -4
  105. package/dist/server/assets/{flowDiagram-NV44I4VS-CzcX8svk.js → flowDiagram-NV44I4VS-CX3XZT5Y.js} +5 -5
  106. package/dist/server/assets/{ganttDiagram-JELNMOA3-Dxwzox2R.js → ganttDiagram-JELNMOA3-BmjiDolw.js} +2 -2
  107. package/dist/server/assets/{gitGraph-G5XIXVHT-LK8-a2sz.js → gitGraph-G5XIXVHT-BxG8jjGU.js} +6 -6
  108. package/dist/server/assets/{gitGraphDiagram-V2S2FVAM-DlgLrJB0.js → gitGraphDiagram-V2S2FVAM-ChLdCg6Z.js} +7 -7
  109. package/dist/server/assets/{graph-BXmxFNFp.js → graph-Bx5JUzop.js} +2 -2
  110. package/dist/server/assets/{highlighted-body-B3W2YXNL-DsSe47sR.js → highlighted-body-B3W2YXNL-DDkviWDm.js} +1 -1
  111. package/dist/server/assets/{index-BSojqZdf.js → index-BBCpeEJl.js} +2 -2
  112. package/dist/server/assets/{index-Do1Nx4aA.js → index-BKnmhk3u.js} +1 -1
  113. package/dist/server/assets/{index-BsoOL_wq.js → index-BP-Fy_Ud.js} +2 -2
  114. package/dist/server/assets/{index-oC76KgvT.js → index-Bb41VJM3.js} +4 -4
  115. package/dist/server/assets/{index-CnLND4um.js → index-BnAK5zRH.js} +1 -1
  116. package/dist/server/assets/{index-B-LK0PYZ.js → index-BoT6zVKn.js} +2 -2
  117. package/dist/server/assets/{index-DdVNSMNY.js → index-C4USpn2y.js} +2 -2
  118. package/dist/server/assets/{index-CVjIVbLj.js → index-CDCloCld.js} +2 -2
  119. package/dist/server/assets/{index-DM2r-vGW.js → index-CLsI0TMm.js} +2 -2
  120. package/dist/server/assets/{index-CWtvbkAQ.js → index-Cuuby6oP.js} +3 -3
  121. package/dist/server/assets/{index-BbjwIyTa.js → index-DO3wKBul.js} +5 -5
  122. package/dist/server/assets/{index-BrkgyCV3.js → index-DSGH2NU6.js} +2 -2
  123. package/dist/server/assets/{index-CXycOokw.js → index-DTkAyV2J.js} +2 -2
  124. package/dist/server/assets/{index-CaaOSPL7.js → index-DjhMY50H.js} +3 -3
  125. package/dist/server/assets/{index-nKutdysv.js → index-Dp74K7A4.js} +2 -2
  126. package/dist/server/assets/{index-5upQdcP2.js → index-DrrqcbHg.js} +2 -2
  127. package/dist/server/assets/{index-4YgzFKOD.js → index-Duvita0E.js} +5 -5
  128. package/dist/server/assets/{index-BdNVOcCL.js → index-OEnZTnkb.js} +2 -2
  129. package/dist/server/assets/{info-VBDWY6EO-CM7NSJD8.js → info-VBDWY6EO-6bfVBBeD.js} +6 -6
  130. package/dist/server/assets/{infoDiagram-HS3SLOUP-QMxyRHM5.js → infoDiagram-HS3SLOUP-B1v9HmWX.js} +5 -5
  131. package/dist/server/assets/{journeyDiagram-XKPGCS4Q-BoA6PlCZ.js → journeyDiagram-XKPGCS4Q-Cb26EUwI.js} +4 -4
  132. package/dist/server/assets/{kanban-definition-3W4ZIXB7-r6KtKaEH.js → kanban-definition-3W4ZIXB7-Cv4GaETC.js} +2 -2
  133. package/dist/server/assets/{layout-D3Do3Tbk.js → layout-CQJCngSZ.js} +4 -4
  134. package/dist/server/assets/{linear-CC2CX22M.js → linear-Civ7P345.js} +1 -1
  135. package/dist/server/assets/{mermaid-3ZIDBTTL-De3B4GT2.js → mermaid-3ZIDBTTL-EBg4-fWO.js} +1 -1
  136. package/dist/server/assets/{mermaid-parser.core-BNbfHMQU.js → mermaid-parser.core-2e_OlBPy.js} +11 -11
  137. package/dist/server/assets/{mindmap-definition-VGOIOE7T-BZA0jx43.js → mindmap-definition-VGOIOE7T-uP_bqLZ-.js} +3 -3
  138. package/dist/server/assets/{packet-DYOGHKS2-FVoQy92R.js → packet-DYOGHKS2-C9RhEbus.js} +6 -6
  139. package/dist/server/assets/{pie-VRWISCQL-BGUPFoed.js → pie-VRWISCQL-DXIjmNyN.js} +6 -6
  140. package/dist/server/assets/{pieDiagram-ADFJNKIX-6xe9bPcx.js → pieDiagram-ADFJNKIX-C2Qp43pf.js} +7 -7
  141. package/dist/server/assets/{quadrantDiagram-AYHSOK5B-DrjB4XQc.js → quadrantDiagram-AYHSOK5B-C9I9kDB1.js} +2 -2
  142. package/dist/server/assets/{radar-ZZBFDIW7-BioEa_Uy.js → radar-ZZBFDIW7-CEz6u4b9.js} +6 -6
  143. package/dist/server/assets/{requirementDiagram-UZGBJVZJ-BQUraj5G.js → requirementDiagram-UZGBJVZJ-DmCcKz-Y.js} +3 -3
  144. package/dist/server/assets/{router-Ch9bBOlF.js → router-BlHVACji.js} +76500 -75903
  145. package/dist/server/assets/{sankeyDiagram-TZEHDZUN-qdkVPLba.js → sankeyDiagram-TZEHDZUN-DM2H1xi3.js} +1 -1
  146. package/dist/server/assets/{sequenceDiagram-WL72ISMW-Bh5Gu2_v.js → sequenceDiagram-WL72ISMW-DWDQKCiq.js} +3 -3
  147. package/dist/server/assets/{square-terminal-DVnlJfcM.js → square-terminal-CCwkUkGX.js} +1 -1
  148. package/dist/server/assets/{stateDiagram-FKZM4ZOC-BUasl40g.js → stateDiagram-FKZM4ZOC-_4Khdh4I.js} +8 -8
  149. package/dist/server/assets/{stateDiagram-v2-4FDKWEC3-BL56MbOT.js → stateDiagram-v2-4FDKWEC3-Cos-pE9j.js} +4 -4
  150. package/dist/server/assets/{timeline-definition-IT6M3QCI-oGfd7fF8.js → timeline-definition-IT6M3QCI-DeLSZGNq.js} +2 -2
  151. package/dist/server/assets/{treemap-GDKQZRPO-CELUCxyO.js → treemap-GDKQZRPO-LKeqy604.js} +6 -6
  152. package/dist/server/assets/{workspace._workspaceId-DhJMpGAq.js → workspace._workspaceId-C0PMWq41.js} +2 -2
  153. package/dist/server/assets/{workspace._workspaceId.changes-5-0MP0m5.js → workspace._workspaceId.changes-CzyqOgM_.js} +1 -1
  154. package/dist/server/assets/{workspace._workspaceId.code._-BFbAz_ei.js → workspace._workspaceId.code._-QG2CLJod.js} +1 -1
  155. package/dist/server/assets/{workspace._workspaceId.code.index-BepZ481b.js → workspace._workspaceId.code.index-CVy3VzQK.js} +1 -1
  156. package/dist/server/assets/{workspace._workspaceId.index-Cp3_jFDn.js → workspace._workspaceId.index-LBt-0JYY.js} +1 -1
  157. package/dist/server/assets/{workspace._workspaceId.terminal-B5beQDh_.js → workspace._workspaceId.terminal-jMK4pgOD.js} +2 -2
  158. package/dist/server/assets/{xychartDiagram-PRI3JC2R-qDOKCR8M.js → xychartDiagram-PRI3JC2R-DHrKht9t.js} +2 -2
  159. package/dist/server/server.js +2 -2
  160. package/dist/start-server.mjs +665 -596
  161. package/package.json +7 -5
  162. package/dist/client/assets/channel-C5uboiOE.js +0 -1
  163. package/dist/client/assets/classDiagram-2ON5EDUG-CbG2RU7R.js +0 -1
  164. package/dist/client/assets/classDiagram-v2-WZHVMYZB-CbG2RU7R.js +0 -1
  165. package/dist/client/assets/clone-vDxxg1dv.js +0 -1
  166. package/dist/client/assets/main-4FaYQ5DQ.css +0 -1
  167. package/dist/client/assets/stateDiagram-v2-4FDKWEC3-By7mP9TH.js +0 -1
  168. package/dist/client/assets/workspace._workspaceId.code-B2HMVWnI.js +0 -1
@@ -3181,7 +3181,7 @@ var require_stream = __commonJS({
3181
3181
  };
3182
3182
  duplex._final = function(callback) {
3183
3183
  if (ws.readyState === ws.CONNECTING) {
3184
- ws.once("open", function open2() {
3184
+ ws.once("open", function open3() {
3185
3185
  duplex._final(callback);
3186
3186
  });
3187
3187
  return;
@@ -3202,7 +3202,7 @@ var require_stream = __commonJS({
3202
3202
  };
3203
3203
  duplex._write = function(chunk, encoding, callback) {
3204
3204
  if (ws.readyState === ws.CONNECTING) {
3205
- ws.once("open", function open2() {
3205
+ ws.once("open", function open3() {
3206
3206
  duplex._write(chunk, encoding, callback);
3207
3207
  });
3208
3208
  return;
@@ -6070,7 +6070,7 @@ var require_transport = __commonJS({
6070
6070
  "use strict";
6071
6071
  var { createRequire: createRequire2 } = __require("module");
6072
6072
  var getCallers = require_caller();
6073
- var { join: join25, isAbsolute, sep: sep3 } = __require("node:path");
6073
+ var { join: join25, isAbsolute: isAbsolute3, sep: sep3 } = __require("node:path");
6074
6074
  var sleep2 = require_atomic_sleep();
6075
6075
  var onExit = require_on_exit_leak_free();
6076
6076
  var ThreadStream = require_thread_stream();
@@ -6169,7 +6169,7 @@ var require_transport = __commonJS({
6169
6169
  return buildStream(fixTarget(target), options2, worker, sync);
6170
6170
  function fixTarget(origin) {
6171
6171
  origin = bundlerOverrides[origin] || origin;
6172
- if (isAbsolute(origin) || origin.indexOf("file://") === 0) {
6172
+ if (isAbsolute3(origin) || origin.indexOf("file://") === 0) {
6173
6173
  return origin;
6174
6174
  }
6175
6175
  if (origin === "pino/file") {
@@ -30908,205 +30908,6 @@ var init_cursor_cli = __esm({
30908
30908
  }
30909
30909
  });
30910
30910
 
30911
- // ../../packages/coding-agent/src/adapters/openai-codex.ts
30912
- var openai_codex_exports = {};
30913
- __export(openai_codex_exports, {
30914
- OPENAI_CODEX_DEFAULT_BINARY: () => OPENAI_CODEX_DEFAULT_BINARY,
30915
- OpenAICodexAdapter: () => OpenAICodexAdapter,
30916
- getOpenAICodexInstallSkillsDir: () => getOpenAICodexInstallSkillsDir
30917
- });
30918
- import { homedir as homedir2 } from "node:os";
30919
- import { join as join5 } from "node:path";
30920
- function getOpenAICodexInstallSkillsDir(home = homedir2()) {
30921
- const codexHome = process.env.CODEX_HOME || join5(home, ".codex");
30922
- return join5(codexHome, "skills");
30923
- }
30924
- function discoverCodexSkills(workspaceDir) {
30925
- const globalSkillsDir = join5(CODEX_HOME, "skills");
30926
- const systemSkillsDir = join5(CODEX_HOME, "skills", ".system");
30927
- const projectSkillsDir = join5(workspaceDir, ".codex", "skills");
30928
- const systemSkills = readSkillsFromDir(systemSkillsDir);
30929
- const globalSkills = readSkillsFromDir(globalSkillsDir);
30930
- const projectSkills = readSkillsFromDir(projectSkillsDir);
30931
- const skillMap = /* @__PURE__ */ new Map();
30932
- for (const skill of systemSkills) {
30933
- skillMap.set(skill.name, skill);
30934
- }
30935
- for (const skill of globalSkills) {
30936
- skillMap.set(skill.name, skill);
30937
- }
30938
- for (const skill of projectSkills) {
30939
- skillMap.set(skill.name, skill);
30940
- }
30941
- return Array.from(skillMap.values()).sort((a6, b10) => a6.name.localeCompare(b10.name));
30942
- }
30943
- function parseInput(args) {
30944
- if (typeof args === "string") {
30945
- try {
30946
- return JSON.parse(args);
30947
- } catch {
30948
- return { raw: args };
30949
- }
30950
- }
30951
- if (typeof args === "object" && args !== null) {
30952
- return args;
30953
- }
30954
- return {};
30955
- }
30956
- var log4, OpenAICodexAdapter, CODEX_HOME, OPENAI_CODEX_DEFAULT_BINARY;
30957
- var init_openai_codex = __esm({
30958
- "../../packages/coding-agent/src/adapters/openai-codex.ts"() {
30959
- init_src();
30960
- init_skills();
30961
- log4 = createLogger("coding-agent:openai-codex");
30962
- OpenAICodexAdapter = class {
30963
- name = "OpenAI Codex";
30964
- supportedFeatures = {
30965
- costTracking: true,
30966
- sessionListing: false
30967
- };
30968
- workspaceDir;
30969
- maxTurns;
30970
- model;
30971
- sandboxMode;
30972
- activeIterator = null;
30973
- constructor(config2) {
30974
- this.workspaceDir = config2.workspaceDir;
30975
- this.maxTurns = config2.maxTurns;
30976
- this.model = config2.options.model ?? "codex-mini";
30977
- this.sandboxMode = config2.options.sandboxMode ?? "docker";
30978
- }
30979
- abort() {
30980
- if (this.activeIterator) {
30981
- log4.info("aborting active codex stream");
30982
- this.activeIterator.return?.(void 0);
30983
- this.activeIterator = null;
30984
- }
30985
- }
30986
- async *runSession(prompt, sessionId, options2) {
30987
- const effectiveMaxTurns = options2?.maxTurns ?? this.maxTurns;
30988
- const effectiveModel = options2?.model ?? this.model;
30989
- log4.info(
30990
- {
30991
- prompt: prompt.slice(0, 100),
30992
- sessionId,
30993
- model: effectiveModel,
30994
- cwd: this.workspaceDir,
30995
- maxTurns: effectiveMaxTurns
30996
- },
30997
- "runSession starting"
30998
- );
30999
- const moduleName = ["@openai", "codex-sdk"].join("/");
31000
- const sdk = await import(moduleName);
31001
- const codex = new sdk.Codex({ model: effectiveModel });
31002
- const startMs = Date.now();
31003
- let turnCount = 0;
31004
- const thread = sessionId ? codex.resumeThread(sessionId) : codex.startThread();
31005
- const stream = thread.runStreamed(prompt, {
31006
- cwd: this.workspaceDir,
31007
- maxTurns: effectiveMaxTurns,
31008
- sandbox: this.sandboxMode
31009
- });
31010
- const iterator = stream[Symbol.asyncIterator]();
31011
- this.activeIterator = iterator;
31012
- try {
31013
- for await (const event of { [Symbol.asyncIterator]: () => iterator }) {
31014
- const type = event.type;
31015
- log4.debug({ eventType: type }, "codex event");
31016
- switch (type) {
31017
- case "thread.started": {
31018
- yield {
31019
- type: "session-start",
31020
- sessionId: String(event.thread_id ?? sessionId ?? "")
31021
- };
31022
- break;
31023
- }
31024
- case "agent_message": {
31025
- const text4 = event.content;
31026
- if (text4) {
31027
- yield { type: "text-delta", text: text4 };
31028
- }
31029
- break;
31030
- }
31031
- case "item.started": {
31032
- const item = event.item;
31033
- if (item?.type === "function_call") {
31034
- turnCount++;
31035
- yield {
31036
- type: "tool-use",
31037
- toolCallId: String(item.call_id ?? crypto.randomUUID()),
31038
- toolName: String(item.name ?? "unknown"),
31039
- input: parseInput(item.arguments)
31040
- };
31041
- }
31042
- break;
31043
- }
31044
- case "item.completed": {
31045
- const item = event.item;
31046
- if (item?.type === "function_call_output" || item?.type === "function_call") {
31047
- yield {
31048
- type: "tool-result",
31049
- toolCallId: String(item.call_id ?? crypto.randomUUID()),
31050
- output: String(item.output ?? ""),
31051
- isError: false
31052
- };
31053
- }
31054
- break;
31055
- }
31056
- case "turn.completed": {
31057
- yield {
31058
- type: "session-result",
31059
- success: true,
31060
- sessionId: String(event.thread_id ?? sessionId ?? ""),
31061
- durationMs: Date.now() - startMs,
31062
- numTurns: turnCount,
31063
- costUsd: event.usage_usd ?? 0,
31064
- errors: []
31065
- };
31066
- break;
31067
- }
31068
- case "turn.failed": {
31069
- yield {
31070
- type: "session-result",
31071
- success: false,
31072
- sessionId: String(event.thread_id ?? sessionId ?? ""),
31073
- durationMs: Date.now() - startMs,
31074
- numTurns: turnCount,
31075
- costUsd: 0,
31076
- errors: [String(event.error ?? "Codex turn failed")]
31077
- };
31078
- break;
31079
- }
31080
- }
31081
- }
31082
- log4.info("codex stream done");
31083
- } catch (err) {
31084
- log4.error({ err }, "codex error");
31085
- throw err;
31086
- } finally {
31087
- this.activeIterator = null;
31088
- }
31089
- }
31090
- async listSkills() {
31091
- return discoverCodexSkills(this.workspaceDir);
31092
- }
31093
- listModels() {
31094
- return [
31095
- {
31096
- id: "codex-mini",
31097
- name: "Codex Mini",
31098
- description: "Fast and efficient",
31099
- contextWindow: 2e5
31100
- },
31101
- { id: "o4-mini", name: "o4-mini", contextWindow: 2e5 }
31102
- ];
31103
- }
31104
- };
31105
- CODEX_HOME = process.env.CODEX_HOME || join5(homedir2(), ".codex");
31106
- OPENAI_CODEX_DEFAULT_BINARY = "codex";
31107
- }
31108
- });
31109
-
31110
30911
  // ../../node_modules/.pnpm/@openai+codex-sdk@0.128.0/node_modules/@openai/codex-sdk/dist/index.js
31111
30912
  import { promises as fs2 } from "fs";
31112
30913
  import os from "os";
@@ -31579,8 +31380,8 @@ __export(codex_exports, {
31579
31380
  import { execFileSync } from "node:child_process";
31580
31381
  import { createReadStream as createReadStream2 } from "node:fs";
31581
31382
  import { readdir, stat as stat2 } from "node:fs/promises";
31582
- import { homedir as homedir3 } from "node:os";
31583
- import { join as join6 } from "node:path";
31383
+ import { homedir as homedir2 } from "node:os";
31384
+ import { join as join5 } from "node:path";
31584
31385
  import { createInterface } from "node:readline";
31585
31386
  function lruSet2(map2, key, value, cap) {
31586
31387
  if (map2.has(key)) map2.delete(key);
@@ -31599,14 +31400,14 @@ function resolveCodexBinary() {
31599
31400
  return void 0;
31600
31401
  }
31601
31402
  }
31602
- function getCodexInstallSkillsDir(home = homedir3()) {
31603
- const codexHome = process.env.CODEX_HOME || join6(home, ".codex");
31604
- return join6(codexHome, "skills");
31403
+ function getCodexInstallSkillsDir(home = homedir2()) {
31404
+ const codexHome = process.env.CODEX_HOME || join5(home, ".codex");
31405
+ return join5(codexHome, "skills");
31605
31406
  }
31606
- function discoverCodexSkills2(workspaceDir) {
31607
- const globalSkillsDir = join6(CODEX_HOME2, "skills");
31608
- const systemSkillsDir = join6(CODEX_HOME2, "skills", ".system");
31609
- const projectSkillsDir = join6(workspaceDir, ".codex", "skills");
31407
+ function discoverCodexSkills(workspaceDir) {
31408
+ const globalSkillsDir = join5(CODEX_HOME, "skills");
31409
+ const systemSkillsDir = join5(CODEX_HOME, "skills", ".system");
31410
+ const projectSkillsDir = join5(workspaceDir, ".codex", "skills");
31610
31411
  const systemSkills = readSkillsFromDir(systemSkillsDir);
31611
31412
  const globalSkills = readSkillsFromDir(globalSkillsDir);
31612
31413
  const projectSkills = readSkillsFromDir(projectSkillsDir);
@@ -31622,7 +31423,7 @@ function discoverCodexSkills2(workspaceDir) {
31622
31423
  }
31623
31424
  return Array.from(skillMap.values()).sort((a6, b10) => a6.name.localeCompare(b10.name));
31624
31425
  }
31625
- function parseInput2(args) {
31426
+ function parseInput(args) {
31626
31427
  if (typeof args === "string") {
31627
31428
  try {
31628
31429
  return JSON.parse(args);
@@ -31672,7 +31473,7 @@ function* handleItemStarted(item, toolNames) {
31672
31473
  type: "tool-use",
31673
31474
  toolCallId: item.id,
31674
31475
  toolName: name24,
31675
- input: parseInput2(item.arguments)
31476
+ input: parseInput(item.arguments)
31676
31477
  };
31677
31478
  break;
31678
31479
  }
@@ -31799,7 +31600,7 @@ async function findSessionFiles() {
31799
31600
  return;
31800
31601
  }
31801
31602
  for (const entry of entries) {
31802
- const full = join6(dir, entry);
31603
+ const full = join5(dir, entry);
31803
31604
  const s6 = await stat2(full).catch(() => null);
31804
31605
  if (!s6) continue;
31805
31606
  if (s6.isDirectory()) {
@@ -31853,7 +31654,7 @@ async function readCodexSessions() {
31853
31654
  });
31854
31655
  }
31855
31656
  } catch (err) {
31856
- log5.debug({ err, file: file2 }, "failed to parse codex session file");
31657
+ log4.debug({ err, file: file2 }, "failed to parse codex session file");
31857
31658
  }
31858
31659
  }
31859
31660
  return sessions;
@@ -31941,13 +31742,13 @@ async function readCodexSessionMessages(sessionId, options2) {
31941
31742
  const slice = hasMore ? collected.slice(0, requested) : collected;
31942
31743
  return { messages: slice, hasMore, firstOffset: offset4 };
31943
31744
  }
31944
- var log5, cumulativeUsageBySession2, MAX_CUMULATIVE_SESSIONS2, CodexAdapter, CODEX_CTX, CODEX_MODELS, CODEX_DEFAULT_BINARY, CODEX_HOME2, SESSIONS_DIR;
31745
+ var log4, cumulativeUsageBySession2, MAX_CUMULATIVE_SESSIONS2, CodexAdapter, CODEX_CTX, CODEX_MODELS, CODEX_DEFAULT_BINARY, CODEX_HOME, SESSIONS_DIR;
31945
31746
  var init_codex = __esm({
31946
31747
  "../../packages/coding-agent/src/adapters/codex.ts"() {
31947
31748
  init_src();
31948
31749
  init_dist2();
31949
31750
  init_skills();
31950
- log5 = createLogger("coding-agent:codex");
31751
+ log4 = createLogger("coding-agent:codex");
31951
31752
  cumulativeUsageBySession2 = /* @__PURE__ */ new Map();
31952
31753
  MAX_CUMULATIVE_SESSIONS2 = 500;
31953
31754
  CodexAdapter = class {
@@ -31969,7 +31770,7 @@ var init_codex = __esm({
31969
31770
  }
31970
31771
  abort() {
31971
31772
  if (this.activeIterator) {
31972
- log5.info("aborting active codex stream");
31773
+ log4.info("aborting active codex stream");
31973
31774
  this.activeIterator.return?.(void 0);
31974
31775
  this.activeIterator = null;
31975
31776
  }
@@ -31980,7 +31781,7 @@ var init_codex = __esm({
31980
31781
  const knownModelIds = new Set(CODEX_MODELS.map((m11) => m11.id));
31981
31782
  const effectiveModel = requestedModel && knownModelIds.has(requestedModel) ? requestedModel : void 0;
31982
31783
  const mode = options2?.mode ?? "edit";
31983
- log5.info(
31784
+ log4.info(
31984
31785
  {
31985
31786
  prompt: prompt.slice(0, 100),
31986
31787
  sessionId,
@@ -32046,17 +31847,17 @@ var init_codex = __esm({
32046
31847
  persistCumulative();
32047
31848
  };
32048
31849
  const runStreamedStartMs = Date.now();
32049
- log5.info("calling thread.runStreamed");
31850
+ log4.info("calling thread.runStreamed");
32050
31851
  let result;
32051
31852
  try {
32052
31853
  result = await thread.runStreamed(prompt);
32053
- log5.info(
31854
+ log4.info(
32054
31855
  { elapsedMs: Date.now() - runStreamedStartMs },
32055
31856
  "thread.runStreamed returned successfully"
32056
31857
  );
32057
31858
  } catch (err) {
32058
31859
  const msg = err instanceof Error ? err.message : String(err);
32059
- log5.error({ err, cwd: this.workspaceDir, model: effectiveModel }, "codex runStreamed failed");
31860
+ log4.error({ err, cwd: this.workspaceDir, model: effectiveModel }, "codex runStreamed failed");
32060
31861
  yield { type: "error", message: msg };
32061
31862
  yield {
32062
31863
  type: "session-result",
@@ -32077,13 +31878,13 @@ var init_codex = __esm({
32077
31878
  let lastTurnError = null;
32078
31879
  try {
32079
31880
  for await (const event of { [Symbol.asyncIterator]: () => iterator }) {
32080
- log5.debug({ eventType: event.type }, "codex event");
31881
+ log4.debug({ eventType: event.type }, "codex event");
32081
31882
  switch (event.type) {
32082
31883
  // ── Session lifecycle ──────────────────────────────────────────
32083
31884
  case "thread.started": {
32084
31885
  const resolvedSid = event.thread_id ?? sessionId ?? "";
32085
31886
  adoptSessionId(resolvedSid);
32086
- log5.info(
31887
+ log4.info(
32087
31888
  { threadId: event.thread_id, sessionIdParam: sessionId, actualSessionId },
32088
31889
  "codex thread.started"
32089
31890
  );
@@ -32127,7 +31928,7 @@ var init_codex = __esm({
32127
31928
  totalOutputTokens += outputTokens;
32128
31929
  totalReasoningOutputTokens += reasoningOutputTokens;
32129
31930
  persistCumulative();
32130
- log5.debug(
31931
+ log4.debug(
32131
31932
  {
32132
31933
  inputTokens,
32133
31934
  outputTokens,
@@ -32167,7 +31968,7 @@ var init_codex = __esm({
32167
31968
  }
32168
31969
  }
32169
31970
  }
32170
- log5.info(
31971
+ log4.info(
32171
31972
  {
32172
31973
  turnCount,
32173
31974
  totalInputTokens,
@@ -32191,7 +31992,7 @@ var init_codex = __esm({
32191
31992
  }
32192
31993
  } catch (err) {
32193
31994
  const msg = err instanceof Error ? err.message : String(err);
32194
- log5.error({ err, cwd: this.workspaceDir }, "codex stream error");
31995
+ log4.error({ err, cwd: this.workspaceDir }, "codex stream error");
32195
31996
  yield { type: "error", message: msg };
32196
31997
  yield {
32197
31998
  type: "session-result",
@@ -32207,7 +32008,7 @@ var init_codex = __esm({
32207
32008
  }
32208
32009
  }
32209
32010
  async listSkills() {
32210
- return discoverCodexSkills2(this.workspaceDir);
32011
+ return discoverCodexSkills(this.workspaceDir);
32211
32012
  }
32212
32013
  listModes() {
32213
32014
  return [
@@ -32219,12 +32020,12 @@ var init_codex = __esm({
32219
32020
  return CODEX_MODELS;
32220
32021
  }
32221
32022
  async listSessions(dir) {
32222
- log5.info({ dir }, "listSessions");
32023
+ log4.info({ dir }, "listSessions");
32223
32024
  const sessions = await readCodexSessions();
32224
32025
  return sessions.filter((s6) => s6.cwd === dir).sort((a6, b10) => b10.lastModified - a6.lastModified);
32225
32026
  }
32226
32027
  async getSessionMessages(sessionId, dir, options2) {
32227
- log5.info({ sessionId, dir, ...options2 }, "getSessionMessages");
32028
+ log4.info({ sessionId, dir, ...options2 }, "getSessionMessages");
32228
32029
  return readCodexSessionMessages(sessionId, options2);
32229
32030
  }
32230
32031
  };
@@ -32262,8 +32063,8 @@ var init_codex = __esm({
32262
32063
  }
32263
32064
  ];
32264
32065
  CODEX_DEFAULT_BINARY = "codex";
32265
- CODEX_HOME2 = process.env.CODEX_HOME || join6(homedir3(), ".codex");
32266
- SESSIONS_DIR = join6(CODEX_HOME2, "sessions");
32066
+ CODEX_HOME = process.env.CODEX_HOME || join5(homedir2(), ".codex");
32067
+ SESSIONS_DIR = join5(CODEX_HOME, "sessions");
32267
32068
  }
32268
32069
  });
32269
32070
 
@@ -32275,15 +32076,15 @@ __export(gemini_cli_exports, {
32275
32076
  getGeminiCliInstallSkillsDir: () => getGeminiCliInstallSkillsDir
32276
32077
  });
32277
32078
  import { spawn as spawn3 } from "node:child_process";
32278
- import { homedir as homedir4 } from "node:os";
32279
- import { join as join7 } from "node:path";
32079
+ import { homedir as homedir3 } from "node:os";
32080
+ import { join as join6 } from "node:path";
32280
32081
  import { createInterface as createInterface2 } from "node:readline";
32281
- function getGeminiCliInstallSkillsDir(home = homedir4()) {
32282
- return join7(home, ".gemini", "skills");
32082
+ function getGeminiCliInstallSkillsDir(home = homedir3()) {
32083
+ return join6(home, ".gemini", "skills");
32283
32084
  }
32284
32085
  function discoverGeminiSkills(workspaceDir) {
32285
- const globalSkillsDir = join7(homedir4(), ".gemini", "skills");
32286
- const projectSkillsDir = join7(workspaceDir, ".gemini", "skills");
32086
+ const globalSkillsDir = join6(homedir3(), ".gemini", "skills");
32087
+ const projectSkillsDir = join6(workspaceDir, ".gemini", "skills");
32287
32088
  const globalSkills = readSkillsFromDir(globalSkillsDir);
32288
32089
  const projectSkills = readSkillsFromDir(projectSkillsDir);
32289
32090
  const skillMap = /* @__PURE__ */ new Map();
@@ -32295,12 +32096,12 @@ function discoverGeminiSkills(workspaceDir) {
32295
32096
  }
32296
32097
  return Array.from(skillMap.values()).sort((a6, b10) => a6.name.localeCompare(b10.name));
32297
32098
  }
32298
- var log6, GeminiCliAdapter, GEMINI_CLI_DEFAULT_BINARY;
32099
+ var log5, GeminiCliAdapter, GEMINI_CLI_DEFAULT_BINARY;
32299
32100
  var init_gemini_cli = __esm({
32300
32101
  "../../packages/coding-agent/src/adapters/gemini-cli.ts"() {
32301
32102
  init_src();
32302
32103
  init_skills();
32303
- log6 = createLogger("coding-agent:gemini-cli");
32104
+ log5 = createLogger("coding-agent:gemini-cli");
32304
32105
  GeminiCliAdapter = class {
32305
32106
  name = "Gemini CLI";
32306
32107
  supportedFeatures = {
@@ -32320,7 +32121,7 @@ var init_gemini_cli = __esm({
32320
32121
  }
32321
32122
  abort() {
32322
32123
  if (this.activeChild) {
32323
- log6.info("aborting active gemini process");
32124
+ log5.info("aborting active gemini process");
32324
32125
  this.activeChild.kill();
32325
32126
  this.activeChild = null;
32326
32127
  }
@@ -32330,7 +32131,7 @@ var init_gemini_cli = __esm({
32330
32131
  const requestedModel = options2?.model ?? this.model;
32331
32132
  const knownGeminiModels = new Set(this.listModels().map((m11) => m11.id));
32332
32133
  const effectiveModel = requestedModel && knownGeminiModels.has(requestedModel) ? requestedModel : void 0;
32333
- log6.info(
32134
+ log5.info(
32334
32135
  {
32335
32136
  prompt: prompt.slice(0, 100),
32336
32137
  model: effectiveModel,
@@ -32353,7 +32154,7 @@ var init_gemini_cli = __esm({
32353
32154
  let spawnError = null;
32354
32155
  child.on("error", (err) => {
32355
32156
  spawnError = err;
32356
- log6.error({ err, executable: this.executablePath }, "gemini spawn error");
32157
+ log5.error({ err, executable: this.executablePath }, "gemini spawn error");
32357
32158
  });
32358
32159
  const startMs = Date.now();
32359
32160
  let turnCount = 0;
@@ -32367,11 +32168,11 @@ var init_gemini_cli = __esm({
32367
32168
  try {
32368
32169
  parsed = JSON.parse(line2);
32369
32170
  } catch {
32370
- log6.warn({ line: line2 }, "failed to parse NDJSON line");
32171
+ log5.warn({ line: line2 }, "failed to parse NDJSON line");
32371
32172
  continue;
32372
32173
  }
32373
32174
  const type = parsed.type;
32374
- log6.debug({ eventType: type }, "gemini event");
32175
+ log5.debug({ eventType: type }, "gemini event");
32375
32176
  switch (type) {
32376
32177
  case "message": {
32377
32178
  const text4 = parsed.text;
@@ -32437,11 +32238,11 @@ var init_gemini_cli = __esm({
32437
32238
  errors: [errMsg]
32438
32239
  };
32439
32240
  } else if (exitCode !== 0) {
32440
- log6.warn({ exitCode }, "gemini process exited with non-zero code");
32241
+ log5.warn({ exitCode }, "gemini process exited with non-zero code");
32441
32242
  }
32442
- log6.info("gemini stream done");
32243
+ log5.info("gemini stream done");
32443
32244
  } catch (err) {
32444
- log6.error({ err }, "gemini error");
32245
+ log5.error({ err }, "gemini error");
32445
32246
  child.kill();
32446
32247
  throw err;
32447
32248
  } finally {
@@ -32480,8 +32281,8 @@ __export(opencode_exports, {
32480
32281
  getOpenCodeInstallSkillsDir: () => getOpenCodeInstallSkillsDir
32481
32282
  });
32482
32283
  import { execFile, spawn as spawn4 } from "node:child_process";
32483
- import { homedir as homedir5 } from "node:os";
32484
- import { join as join8 } from "node:path";
32284
+ import { homedir as homedir4 } from "node:os";
32285
+ import { join as join7 } from "node:path";
32485
32286
  import { createInterface as createInterface3 } from "node:readline";
32486
32287
  function fetchOpenCodeModels(executablePath) {
32487
32288
  return new Promise((resolve8, reject) => {
@@ -32575,7 +32376,7 @@ async function fetchOpenCodeSessionMessages(executablePath, sessionId, options2)
32575
32376
  try {
32576
32377
  session = JSON.parse(raw.slice(jsonStart));
32577
32378
  } catch {
32578
- log7.warn({ sessionId }, "failed to parse exported session");
32379
+ log6.warn({ sessionId }, "failed to parse exported session");
32579
32380
  return { messages: [], hasMore: false, firstOffset: 0 };
32580
32381
  }
32581
32382
  const tail = options2?.tail;
@@ -32643,20 +32444,20 @@ async function fetchOpenCodeSessionMessages(executablePath, sessionId, options2)
32643
32444
  const slice = hasMore ? collected.slice(0, requested) : collected;
32644
32445
  return { messages: slice, hasMore, firstOffset: offset4 };
32645
32446
  }
32646
- function getOpenCodeInstallSkillsDir(home = homedir5()) {
32647
- return join8(home, ".config", "opencode", "skills");
32447
+ function getOpenCodeInstallSkillsDir(home = homedir4()) {
32448
+ return join7(home, ".config", "opencode", "skills");
32648
32449
  }
32649
32450
  function discoverOpenCodeSkills(workspaceDir) {
32650
- const home = homedir5();
32451
+ const home = homedir4();
32651
32452
  const dirs = [
32652
32453
  // Global (lowest priority first)
32653
- join8(home, ".agents", "skills"),
32654
- join8(home, ".claude", "skills"),
32655
- join8(home, ".config", "opencode", "skills"),
32454
+ join7(home, ".agents", "skills"),
32455
+ join7(home, ".claude", "skills"),
32456
+ join7(home, ".config", "opencode", "skills"),
32656
32457
  // Project-level (overrides global)
32657
- join8(workspaceDir, ".agents", "skills"),
32658
- join8(workspaceDir, ".claude", "skills"),
32659
- join8(workspaceDir, ".opencode", "skills")
32458
+ join7(workspaceDir, ".agents", "skills"),
32459
+ join7(workspaceDir, ".claude", "skills"),
32460
+ join7(workspaceDir, ".opencode", "skills")
32660
32461
  ];
32661
32462
  const skillMap = /* @__PURE__ */ new Map();
32662
32463
  for (const dir of dirs) {
@@ -32666,12 +32467,12 @@ function discoverOpenCodeSkills(workspaceDir) {
32666
32467
  }
32667
32468
  return Array.from(skillMap.values()).sort((a6, b10) => a6.name.localeCompare(b10.name));
32668
32469
  }
32669
- var log7, OpenCodeAdapter, DEFAULT_MODELS, OPENCODE_DEFAULT_BINARY;
32470
+ var log6, OpenCodeAdapter, DEFAULT_MODELS, OPENCODE_DEFAULT_BINARY;
32670
32471
  var init_opencode = __esm({
32671
32472
  "../../packages/coding-agent/src/adapters/opencode.ts"() {
32672
32473
  init_src();
32673
32474
  init_skills();
32674
- log7 = createLogger("coding-agent:opencode");
32475
+ log6 = createLogger("coding-agent:opencode");
32675
32476
  OpenCodeAdapter = class {
32676
32477
  name = "OpenCode";
32677
32478
  supportedFeatures = {
@@ -32690,7 +32491,7 @@ var init_opencode = __esm({
32690
32491
  }
32691
32492
  abort() {
32692
32493
  if (this.activeChild) {
32693
- log7.info("aborting active opencode process");
32494
+ log6.info("aborting active opencode process");
32694
32495
  this.activeChild.kill();
32695
32496
  this.activeChild = null;
32696
32497
  }
@@ -32699,7 +32500,7 @@ var init_opencode = __esm({
32699
32500
  const requestedModel = options2?.model ?? this.model;
32700
32501
  const knownModelIds = new Set((this.cachedModels ?? DEFAULT_MODELS).map((m11) => m11.id));
32701
32502
  const effectiveModel = requestedModel && knownModelIds.has(requestedModel) ? requestedModel : void 0;
32702
- log7.info(
32503
+ log6.info(
32703
32504
  {
32704
32505
  prompt: prompt.slice(0, 100),
32705
32506
  model: effectiveModel,
@@ -32735,7 +32536,7 @@ var init_opencode = __esm({
32735
32536
  this.activeChild = child;
32736
32537
  child.on("error", (err) => {
32737
32538
  spawnError = err;
32738
- log7.error({ err, executable: this.executablePath }, "opencode spawn error");
32539
+ log6.error({ err, executable: this.executablePath }, "opencode spawn error");
32739
32540
  });
32740
32541
  const stderrChunks = [];
32741
32542
  child.stderr.on("data", (chunk) => {
@@ -32752,12 +32553,12 @@ var init_opencode = __esm({
32752
32553
  try {
32753
32554
  parsed = JSON.parse(line2);
32754
32555
  } catch {
32755
- log7.warn({ line: line2 }, "failed to parse NDJSON line");
32556
+ log6.warn({ line: line2 }, "failed to parse NDJSON line");
32756
32557
  continue;
32757
32558
  }
32758
32559
  const eventType = parsed.type;
32759
32560
  const part = parsed.part;
32760
- log7.debug({ eventType }, "opencode event");
32561
+ log6.debug({ eventType }, "opencode event");
32761
32562
  switch (eventType) {
32762
32563
  case "text": {
32763
32564
  const text4 = part?.text;
@@ -32793,7 +32594,7 @@ var init_opencode = __esm({
32793
32594
  const errMsg = String(
32794
32595
  parsed.message ?? parsed.error ?? part?.text ?? part?.message ?? ""
32795
32596
  );
32796
- log7.error({ event: parsed }, "opencode error event");
32597
+ log6.error({ event: parsed }, "opencode error event");
32797
32598
  yield {
32798
32599
  type: "error",
32799
32600
  message: errMsg || `OpenCode error (raw: ${JSON.stringify(parsed)})`
@@ -32805,14 +32606,14 @@ var init_opencode = __esm({
32805
32606
  lastExitCode = await exitCodePromise;
32806
32607
  lastStderr = stderrChunks.join("");
32807
32608
  if (!gotOutput && effectiveSessionId && attempt < maxAttempts) {
32808
- log7.warn(
32609
+ log6.warn(
32809
32610
  { sessionId: effectiveSessionId, exitCode: lastExitCode, stderr: lastStderr },
32810
32611
  "opencode produced no output with session ID, retrying without session"
32811
32612
  );
32812
32613
  effectiveSessionId = void 0;
32813
32614
  }
32814
32615
  } catch (err) {
32815
- log7.error({ err }, "opencode error");
32616
+ log6.error({ err }, "opencode error");
32816
32617
  child.kill();
32817
32618
  throw err;
32818
32619
  } finally {
@@ -32829,20 +32630,20 @@ var init_opencode = __esm({
32829
32630
  };
32830
32631
  }
32831
32632
  if (lastExitCode !== 0) {
32832
- log7.warn({ exitCode: lastExitCode }, "opencode process exited with non-zero code");
32633
+ log6.warn({ exitCode: lastExitCode }, "opencode process exited with non-zero code");
32833
32634
  }
32834
32635
  let resolvedSessionId = generatedSessionId;
32835
32636
  if (!sessionId) {
32836
32637
  try {
32837
32638
  const sessions = await fetchOpenCodeSessions(this.executablePath, this.workspaceDir);
32838
32639
  const sorted = sessions.sort((a6, b10) => b10.updated - a6.updated);
32839
- log7.info(
32640
+ log6.info(
32840
32641
  { placeholder: generatedSessionId, sessionCount: sessions.length },
32841
32642
  "resolving OpenCode session ID"
32842
32643
  );
32843
32644
  if (sorted.length > 0 && sorted[0].id) {
32844
32645
  resolvedSessionId = sorted[0].id;
32845
- log7.info(
32646
+ log6.info(
32846
32647
  { placeholder: generatedSessionId, resolved: resolvedSessionId },
32847
32648
  "resolved real OpenCode session ID"
32848
32649
  );
@@ -32852,13 +32653,13 @@ var init_opencode = __esm({
32852
32653
  resolvedSessionId
32853
32654
  };
32854
32655
  } else {
32855
- log7.warn(
32656
+ log6.warn(
32856
32657
  { placeholder: generatedSessionId, workspaceDir: this.workspaceDir },
32857
32658
  "could NOT resolve real OpenCode session ID \u2014 no matching sessions found"
32858
32659
  );
32859
32660
  }
32860
32661
  } catch (err) {
32861
- log7.warn({ err }, "failed to resolve real OpenCode session ID");
32662
+ log6.warn({ err }, "failed to resolve real OpenCode session ID");
32862
32663
  }
32863
32664
  }
32864
32665
  const success2 = lastExitCode === 0 && gotOutput && !spawnError;
@@ -32881,7 +32682,7 @@ var init_opencode = __esm({
32881
32682
  costUsd: 0,
32882
32683
  errors
32883
32684
  };
32884
- log7.info("opencode stream done");
32685
+ log6.info("opencode stream done");
32885
32686
  }
32886
32687
  async listSkills() {
32887
32688
  return discoverOpenCodeSkills(this.workspaceDir);
@@ -32897,13 +32698,13 @@ var init_opencode = __esm({
32897
32698
  return models;
32898
32699
  }
32899
32700
  } catch (err) {
32900
- log7.warn({ err }, "failed to fetch models from opencode CLI, using defaults");
32701
+ log6.warn({ err }, "failed to fetch models from opencode CLI, using defaults");
32901
32702
  }
32902
32703
  return DEFAULT_MODELS;
32903
32704
  }
32904
32705
  async listSessions(dir) {
32905
32706
  const sessions = await fetchOpenCodeSessions(this.executablePath, dir);
32906
- log7.info({ dir, count: sessions.length }, "listSessions");
32707
+ log6.info({ dir, count: sessions.length }, "listSessions");
32907
32708
  return sessions.map((s6) => ({
32908
32709
  sessionId: s6.id,
32909
32710
  summary: s6.title || "Untitled session",
@@ -32912,7 +32713,7 @@ var init_opencode = __esm({
32912
32713
  })).sort((a6, b10) => b10.lastModified - a6.lastModified);
32913
32714
  }
32914
32715
  async getSessionMessages(sessionId, _dir, options2) {
32915
- log7.info({ sessionId, ...options2 }, "getSessionMessages");
32716
+ log6.info({ sessionId, ...options2 }, "getSessionMessages");
32916
32717
  return fetchOpenCodeSessionMessages(this.executablePath, sessionId, options2);
32917
32718
  }
32918
32719
  };
@@ -61792,14 +61593,14 @@ function composeSets(setA, setB, mkSet = false) {
61792
61593
  let sections = [];
61793
61594
  let insert2 = mkSet ? [] : null;
61794
61595
  let a6 = new SectionIter(setA), b10 = new SectionIter(setB);
61795
- for (let open2 = false; ; ) {
61596
+ for (let open3 = false; ; ) {
61796
61597
  if (a6.done && b10.done) {
61797
61598
  return insert2 ? ChangeSet.createSet(sections, insert2) : ChangeDesc.create(sections);
61798
61599
  } else if (a6.ins == 0) {
61799
- addSection(sections, a6.len, 0, open2);
61600
+ addSection(sections, a6.len, 0, open3);
61800
61601
  a6.next();
61801
61602
  } else if (b10.len == 0 && !b10.done) {
61802
- addSection(sections, 0, b10.ins, open2);
61603
+ addSection(sections, 0, b10.ins, open3);
61803
61604
  if (insert2)
61804
61605
  addInsert(insert2, sections, b10.text);
61805
61606
  b10.next();
@@ -61809,19 +61610,19 @@ function composeSets(setA, setB, mkSet = false) {
61809
61610
  let len = Math.min(a6.len2, b10.len), sectionLen = sections.length;
61810
61611
  if (a6.ins == -1) {
61811
61612
  let insB = b10.ins == -1 ? -1 : b10.off ? 0 : b10.ins;
61812
- addSection(sections, len, insB, open2);
61613
+ addSection(sections, len, insB, open3);
61813
61614
  if (insert2 && insB)
61814
61615
  addInsert(insert2, sections, b10.text);
61815
61616
  } else if (b10.ins == -1) {
61816
- addSection(sections, a6.off ? 0 : a6.len, len, open2);
61617
+ addSection(sections, a6.off ? 0 : a6.len, len, open3);
61817
61618
  if (insert2)
61818
61619
  addInsert(insert2, sections, a6.textBit(len));
61819
61620
  } else {
61820
- addSection(sections, a6.off ? 0 : a6.len, b10.off ? 0 : b10.ins, open2);
61621
+ addSection(sections, a6.off ? 0 : a6.len, b10.off ? 0 : b10.ins, open3);
61821
61622
  if (insert2 && !b10.off)
61822
61623
  addInsert(insert2, sections, b10.text);
61823
61624
  }
61824
- open2 = (a6.ins > len || b10.ins >= 0 && b10.len > len) && (open2 || sections.length > sectionLen);
61625
+ open3 = (a6.ins > len || b10.ins >= 0 && b10.len > len) && (open3 || sections.length > sectionLen);
61825
61626
  a6.forward2(len);
61826
61627
  b10.forward(len);
61827
61628
  }
@@ -62387,9 +62188,9 @@ var init_dist3 = __esm({
62387
62188
  line2++;
62388
62189
  }
62389
62190
  }
62390
- decompose(from, to, target, open2) {
62191
+ decompose(from, to, target, open3) {
62391
62192
  let text4 = from <= 0 && to >= this.length ? this : new _TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));
62392
- if (open2 & 1) {
62193
+ if (open3 & 1) {
62393
62194
  let prev = target.pop();
62394
62195
  let joined = appendText(text4.text, prev.text.slice(), 0, text4.length);
62395
62196
  if (joined.length <= 32) {
@@ -62466,11 +62267,11 @@ var init_dist3 = __esm({
62466
62267
  line2 = endLine + 1;
62467
62268
  }
62468
62269
  }
62469
- decompose(from, to, target, open2) {
62270
+ decompose(from, to, target, open3) {
62470
62271
  for (let i2 = 0, pos = 0; pos <= to && i2 < this.children.length; i2++) {
62471
62272
  let child = this.children[i2], end = pos + child.length;
62472
62273
  if (from <= end && to >= pos) {
62473
- let childOpen = open2 & ((pos <= from ? 1 : 0) | (end >= to ? 2 : 0));
62274
+ let childOpen = open3 & ((pos <= from ? 1 : 0) | (end >= to ? 2 : 0));
62474
62275
  if (pos >= from && end <= to && !childOpen)
62475
62276
  target.push(child);
62476
62277
  else
@@ -64943,10 +64744,10 @@ var init_dist3 = __esm({
64943
64744
  return active.reverse();
64944
64745
  }
64945
64746
  openEnd(to) {
64946
- let open2 = 0;
64747
+ let open3 = 0;
64947
64748
  for (let i2 = this.activeTo.length - 1; i2 >= 0 && this.activeTo[i2] > to; i2--)
64948
- open2++;
64949
- return open2;
64749
+ open3++;
64750
+ return open3;
64950
64751
  }
64951
64752
  };
64952
64753
  }
@@ -65930,14 +65731,14 @@ function getIsolatedRanges(view, line2) {
65930
65731
  RangeSet.spans(sets, line2.from, line2.to, {
65931
65732
  point() {
65932
65733
  },
65933
- span(fromDoc, toDoc, active, open2) {
65734
+ span(fromDoc, toDoc, active, open3) {
65934
65735
  let from = fromDoc - line2.from, to = toDoc - line2.from;
65935
65736
  let level = result;
65936
- for (let i2 = active.length - 1; i2 >= 0; i2--, open2--) {
65737
+ for (let i2 = active.length - 1; i2 >= 0; i2--, open3--) {
65937
65738
  let direction = active[i2].spec.bidiIsolate, update;
65938
65739
  if (direction == null)
65939
65740
  direction = autoDirection(line2.text, from, to);
65940
- if (open2 > 0 && level.length && (update = level[level.length - 1]).to == from && update.direction == direction) {
65741
+ if (open3 > 0 && level.length && (update = level[level.length - 1]).to == from && update.direction == direction) {
65941
65742
  update.to = to;
65942
65743
  level = update.inner;
65943
65744
  } else {
@@ -89261,7 +89062,7 @@ var require_dist5 = __commonJS({
89261
89062
  // start-server.ts
89262
89063
  import { appendFileSync as appendFileSync2, createReadStream as createReadStream3, mkdirSync as mkdirSync8, readFileSync as readFileSync9, statSync as statSync7 } from "node:fs";
89263
89064
  import { createServer } from "node:http";
89264
- import { basename as basename2, join as join24, resolve as resolve7 } from "node:path";
89065
+ import { basename as basename3, join as join24, resolve as resolve7 } from "node:path";
89265
89066
 
89266
89067
  // ../../node_modules/.pnpm/@trpc+server@11.12.0_typescript@5.9.3/node_modules/@trpc/server/dist/codes-DagpWZLc.mjs
89267
89068
  function mergeWithoutOverrides(obj1, ...objs) {
@@ -108431,8 +108232,8 @@ init_src();
108431
108232
 
108432
108233
  // src/lib/agent-pool.ts
108433
108234
  import { readFileSync as readFileSync5 } from "node:fs";
108434
- import { homedir as homedir8 } from "node:os";
108435
- import { join as join13 } from "node:path";
108235
+ import { homedir as homedir7 } from "node:os";
108236
+ import { join as join12 } from "node:path";
108436
108237
 
108437
108238
  // ../../packages/coding-agent/src/config.ts
108438
108239
  init_zod();
@@ -108461,15 +108262,6 @@ var cursorCliConfigSchema = external_exports2.object({
108461
108262
  model: external_exports2.string().default("auto")
108462
108263
  }).default({})
108463
108264
  });
108464
- var openaiCodexConfigSchema = external_exports2.object({
108465
- type: external_exports2.literal("openai-codex"),
108466
- workspaceDir: external_exports2.string().default(process.cwd()),
108467
- maxTurns: external_exports2.number().int().positive().default(3),
108468
- options: external_exports2.object({
108469
- model: external_exports2.string().optional(),
108470
- sandboxMode: external_exports2.enum(["docker", "firecracker"]).optional()
108471
- }).default({})
108472
- });
108473
108265
  var codexConfigSchema = external_exports2.object({
108474
108266
  type: external_exports2.literal("codex"),
108475
108267
  workspaceDir: external_exports2.string().default(process.cwd()),
@@ -108500,7 +108292,6 @@ var opencodeConfigSchema = external_exports2.object({
108500
108292
  var codingAgentConfigSchema = external_exports2.discriminatedUnion("type", [
108501
108293
  claudeCodeConfigSchema,
108502
108294
  cursorCliConfigSchema,
108503
- openaiCodexConfigSchema,
108504
108295
  codexConfigSchema,
108505
108296
  geminiCliConfigSchema,
108506
108297
  opencodeConfigSchema
@@ -108517,10 +108308,6 @@ async function createCodingAgent(config2) {
108517
108308
  const { CursorCliAdapter: CursorCliAdapter2 } = await Promise.resolve().then(() => (init_cursor_cli(), cursor_cli_exports));
108518
108309
  return new CursorCliAdapter2(config2);
108519
108310
  }
108520
- case "openai-codex": {
108521
- const { OpenAICodexAdapter: OpenAICodexAdapter2 } = await Promise.resolve().then(() => (init_openai_codex(), openai_codex_exports));
108522
- return new OpenAICodexAdapter2(config2);
108523
- }
108524
108311
  case "codex": {
108525
108312
  const { CodexAdapter: CodexAdapter2 } = await Promise.resolve().then(() => (init_codex(), codex_exports));
108526
108313
  return new CodexAdapter2(config2);
@@ -108539,9 +108326,9 @@ async function createCodingAgent(config2) {
108539
108326
  }
108540
108327
 
108541
108328
  // ../../packages/coding-agent/src/install-skills.ts
108542
- import { homedir as homedir6 } from "node:os";
108543
- import { join as join9 } from "node:path";
108544
- async function getInstallSkillsDir(type, home = homedir6()) {
108329
+ import { homedir as homedir5 } from "node:os";
108330
+ import { join as join8 } from "node:path";
108331
+ async function getInstallSkillsDir(type, home = homedir5()) {
108545
108332
  switch (type) {
108546
108333
  case "claude-code": {
108547
108334
  const { getClaudeCodeInstallSkillsDir: getClaudeCodeInstallSkillsDir2 } = await Promise.resolve().then(() => (init_claude_code(), claude_code_exports));
@@ -108551,10 +108338,6 @@ async function getInstallSkillsDir(type, home = homedir6()) {
108551
108338
  const { getCodexInstallSkillsDir: getCodexInstallSkillsDir2 } = await Promise.resolve().then(() => (init_codex(), codex_exports));
108552
108339
  return getCodexInstallSkillsDir2(home);
108553
108340
  }
108554
- case "openai-codex": {
108555
- const { getOpenAICodexInstallSkillsDir: getOpenAICodexInstallSkillsDir2 } = await Promise.resolve().then(() => (init_openai_codex(), openai_codex_exports));
108556
- return getOpenAICodexInstallSkillsDir2(home);
108557
- }
108558
108341
  case "gemini-cli": {
108559
108342
  const { getGeminiCliInstallSkillsDir: getGeminiCliInstallSkillsDir2 } = await Promise.resolve().then(() => (init_gemini_cli(), gemini_cli_exports));
108560
108343
  return getGeminiCliInstallSkillsDir2(home);
@@ -108567,27 +108350,20 @@ async function getInstallSkillsDir(type, home = homedir6()) {
108567
108350
  return null;
108568
108351
  }
108569
108352
  }
108570
- function getSharedSkillsDir(home = homedir6()) {
108571
- return join9(home, ".agents", "skills");
108353
+ function getSharedSkillsDir(home = homedir5()) {
108354
+ return join8(home, ".agents", "skills");
108572
108355
  }
108573
- var SUPPORTED_AGENT_TYPES = [
108574
- "claude-code",
108575
- "codex",
108576
- "openai-codex",
108577
- "gemini-cli",
108578
- "opencode"
108579
- ];
108580
- function getAgentConfigDir(type, home = homedir6()) {
108356
+ var SUPPORTED_AGENT_TYPES = ["claude-code", "codex", "gemini-cli", "opencode"];
108357
+ function getAgentConfigDir(type, home = homedir5()) {
108581
108358
  switch (type) {
108582
108359
  case "claude-code":
108583
- return join9(home, ".claude");
108360
+ return join8(home, ".claude");
108584
108361
  case "codex":
108585
- case "openai-codex":
108586
- return process.env.CODEX_HOME || join9(home, ".codex");
108362
+ return process.env.CODEX_HOME || join8(home, ".codex");
108587
108363
  case "gemini-cli":
108588
- return join9(home, ".gemini");
108364
+ return join8(home, ".gemini");
108589
108365
  case "opencode":
108590
- return join9(home, ".config", "opencode");
108366
+ return join8(home, ".config", "opencode");
108591
108367
  default:
108592
108368
  return null;
108593
108369
  }
@@ -108599,8 +108375,8 @@ init_src();
108599
108375
  // src/lib/state.ts
108600
108376
  import { randomBytes } from "node:crypto";
108601
108377
  import { mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync } from "node:fs";
108602
- import { homedir as homedir7 } from "node:os";
108603
- import { dirname, join as join12 } from "node:path";
108378
+ import { homedir as homedir6 } from "node:os";
108379
+ import { dirname, join as join11 } from "node:path";
108604
108380
 
108605
108381
  // ../../node_modules/.pnpm/@radix-ui+react-visually-hidden@1.2.3_@types+react-dom@19.2.3_@types+react@19.2.14__@ty_fa89646d7248b32d1762bf88948f6339/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
108606
108382
  var React4 = __toESM(require_react(), 1);
@@ -109722,7 +109498,7 @@ var Dialog = (props) => {
109722
109498
  } = props;
109723
109499
  const triggerRef = React18.useRef(null);
109724
109500
  const contentRef = React18.useRef(null);
109725
- const [open2, setOpen] = useControllableState({
109501
+ const [open3, setOpen] = useControllableState({
109726
109502
  prop: openProp,
109727
109503
  defaultProp: defaultOpen ?? false,
109728
109504
  onChange: onOpenChange,
@@ -109737,7 +109513,7 @@ var Dialog = (props) => {
109737
109513
  contentId: useId(),
109738
109514
  titleId: useId(),
109739
109515
  descriptionId: useId(),
109740
- open: open2,
109516
+ open: open3,
109741
109517
  onOpenChange: setOpen,
109742
109518
  onOpenToggle: React18.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
109743
109519
  modal,
@@ -109965,8 +109741,8 @@ var DialogClose = React18.forwardRef(
109965
109741
  }
109966
109742
  );
109967
109743
  DialogClose.displayName = CLOSE_NAME;
109968
- function getState(open2) {
109969
- return open2 ? "open" : "closed";
109744
+ function getState(open3) {
109745
+ return open3 ? "open" : "closed";
109970
109746
  }
109971
109747
  var TITLE_WARNING_NAME = "DialogTitleWarning";
109972
109748
  var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
@@ -111798,7 +111574,7 @@ function useFloating(options2) {
111798
111574
  } = {},
111799
111575
  transform: transform2 = true,
111800
111576
  whileElementsMounted,
111801
- open: open2
111577
+ open: open3
111802
111578
  } = options2;
111803
111579
  const [data, setData] = React20.useState({
111804
111580
  x: 0,
@@ -111834,7 +111610,7 @@ function useFloating(options2) {
111834
111610
  const hasWhileElementsMounted = whileElementsMounted != null;
111835
111611
  const whileElementsMountedRef = useLatestRef(whileElementsMounted);
111836
111612
  const platformRef = useLatestRef(platform3);
111837
- const openRef = useLatestRef(open2);
111613
+ const openRef = useLatestRef(open3);
111838
111614
  const update = React20.useCallback(() => {
111839
111615
  if (!referenceRef.current || !floatingRef.current) {
111840
111616
  return;
@@ -111865,14 +111641,14 @@ function useFloating(options2) {
111865
111641
  });
111866
111642
  }, [latestMiddleware, placement, strategy, platformRef, openRef]);
111867
111643
  index(() => {
111868
- if (open2 === false && dataRef.current.isPositioned) {
111644
+ if (open3 === false && dataRef.current.isPositioned) {
111869
111645
  dataRef.current.isPositioned = false;
111870
111646
  setData((data2) => ({
111871
111647
  ...data2,
111872
111648
  isPositioned: false
111873
111649
  }));
111874
111650
  }
111875
- }, [open2]);
111651
+ }, [open3]);
111876
111652
  const isMountedRef = React20.useRef(false);
111877
111653
  index(() => {
111878
111654
  isMountedRef.current = true;
@@ -112556,7 +112332,7 @@ var useRovingFocusGroupScope = createRovingFocusGroupScope();
112556
112332
  var [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);
112557
112333
  var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);
112558
112334
  var Menu = (props) => {
112559
- const { __scopeMenu, open: open2 = false, children, dir, onOpenChange, modal = true } = props;
112335
+ const { __scopeMenu, open: open3 = false, children, dir, onOpenChange, modal = true } = props;
112560
112336
  const popperScope = usePopperScope(__scopeMenu);
112561
112337
  const [content2, setContent] = React27.useState(null);
112562
112338
  const isUsingKeyboardRef = React27.useRef(false);
@@ -112580,7 +112356,7 @@ var Menu = (props) => {
112580
112356
  MenuProvider,
112581
112357
  {
112582
112358
  scope: __scopeMenu,
112583
- open: open2,
112359
+ open: open3,
112584
112360
  onOpenChange: handleOpenChange,
112585
112361
  content: content2,
112586
112362
  onContentChange: setContent,
@@ -113090,7 +112866,7 @@ MenuArrow.displayName = ARROW_NAME2;
113090
112866
  var SUB_NAME = "MenuSub";
113091
112867
  var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);
113092
112868
  var MenuSub = (props) => {
113093
- const { __scopeMenu, children, open: open2 = false, onOpenChange } = props;
112869
+ const { __scopeMenu, children, open: open3 = false, onOpenChange } = props;
113094
112870
  const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
113095
112871
  const popperScope = usePopperScope(__scopeMenu);
113096
112872
  const [trigger, setTrigger] = React27.useState(null);
@@ -113104,7 +112880,7 @@ var MenuSub = (props) => {
113104
112880
  MenuProvider,
113105
112881
  {
113106
112882
  scope: __scopeMenu,
113107
- open: open2,
112883
+ open: open3,
113108
112884
  onOpenChange: handleOpenChange,
113109
112885
  content: content2,
113110
112886
  onContentChange: setContent,
@@ -113272,8 +113048,8 @@ var MenuSubContent = React27.forwardRef(
113272
113048
  }
113273
113049
  );
113274
113050
  MenuSubContent.displayName = SUB_CONTENT_NAME;
113275
- function getOpenState(open2) {
113276
- return open2 ? "open" : "closed";
113051
+ function getOpenState(open3) {
113052
+ return open3 ? "open" : "closed";
113277
113053
  }
113278
113054
  function isIndeterminate(checked) {
113279
113055
  return checked === "indeterminate";
@@ -113354,7 +113130,7 @@ var useMenuScope = createMenuScope();
113354
113130
  var [ContextMenuProvider, useContextMenuContext] = createContextMenuContext(CONTEXT_MENU_NAME);
113355
113131
  var ContextMenu = (props) => {
113356
113132
  const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = props;
113357
- const [open2, setOpen] = React28.useState(false);
113133
+ const [open3, setOpen] = React28.useState(false);
113358
113134
  const menuScope = useMenuScope(__scopeContextMenu);
113359
113135
  const handleOpenChangeProp = useCallbackRef(onOpenChange);
113360
113136
  const handleOpenChange = React28.useCallback(
@@ -113368,7 +113144,7 @@ var ContextMenu = (props) => {
113368
113144
  ContextMenuProvider,
113369
113145
  {
113370
113146
  scope: __scopeContextMenu,
113371
- open: open2,
113147
+ open: open3,
113372
113148
  onOpenChange: handleOpenChange,
113373
113149
  modal,
113374
113150
  children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -113376,7 +113152,7 @@ var ContextMenu = (props) => {
113376
113152
  {
113377
113153
  ...menuScope,
113378
113154
  dir,
113379
- open: open2,
113155
+ open: open3,
113380
113156
  onOpenChange: handleOpenChange,
113381
113157
  modal,
113382
113158
  children
@@ -113563,13 +113339,13 @@ var SUB_NAME2 = "ContextMenuSub";
113563
113339
  var ContextMenuSub = (props) => {
113564
113340
  const { __scopeContextMenu, children, onOpenChange, open: openProp, defaultOpen } = props;
113565
113341
  const menuScope = useMenuScope(__scopeContextMenu);
113566
- const [open2, setOpen] = useControllableState({
113342
+ const [open3, setOpen] = useControllableState({
113567
113343
  prop: openProp,
113568
113344
  defaultProp: defaultOpen ?? false,
113569
113345
  onChange: onOpenChange,
113570
113346
  caller: SUB_NAME2
113571
113347
  });
113572
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Sub, { ...menuScope, open: open2, onOpenChange: setOpen, children });
113348
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Sub, { ...menuScope, open: open3, onOpenChange: setOpen, children });
113573
113349
  };
113574
113350
  ContextMenuSub.displayName = SUB_NAME2;
113575
113351
  var SUB_TRIGGER_NAME2 = "ContextMenuSubTrigger";
@@ -113713,7 +113489,7 @@ var Tooltip = (props) => {
113713
113489
  const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
113714
113490
  const delayDuration = delayDurationProp ?? providerContext.delayDuration;
113715
113491
  const wasOpenDelayedRef = React29.useRef(false);
113716
- const [open2, setOpen] = useControllableState({
113492
+ const [open3, setOpen] = useControllableState({
113717
113493
  prop: openProp,
113718
113494
  defaultProp: defaultOpen ?? false,
113719
113495
  onChange: (open22) => {
@@ -113728,8 +113504,8 @@ var Tooltip = (props) => {
113728
113504
  caller: TOOLTIP_NAME
113729
113505
  });
113730
113506
  const stateAttribute = React29.useMemo(() => {
113731
- return open2 ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
113732
- }, [open2]);
113507
+ return open3 ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
113508
+ }, [open3]);
113733
113509
  const handleOpen = React29.useCallback(() => {
113734
113510
  window.clearTimeout(openTimerRef.current);
113735
113511
  openTimerRef.current = 0;
@@ -113762,7 +113538,7 @@ var Tooltip = (props) => {
113762
113538
  {
113763
113539
  scope: __scopeTooltip,
113764
113540
  contentId,
113765
- open: open2,
113541
+ open: open3,
113766
113542
  stateAttribute,
113767
113543
  trigger,
113768
113544
  onTriggerChange: setTrigger,
@@ -120779,13 +120555,13 @@ var filenameIconMap = {
120779
120555
  };
120780
120556
  function getFileIcon(filename) {
120781
120557
  const lower = filename.toLowerCase();
120782
- const basename3 = lower.split("/").pop() ?? lower;
120783
- if (filenameIconMap[basename3]) {
120784
- return filenameIconMap[basename3];
120558
+ const basename4 = lower.split("/").pop() ?? lower;
120559
+ if (filenameIconMap[basename4]) {
120560
+ return filenameIconMap[basename4];
120785
120561
  }
120786
- const dotIndex = basename3.lastIndexOf(".");
120562
+ const dotIndex = basename4.lastIndexOf(".");
120787
120563
  if (dotIndex !== -1) {
120788
- const ext = basename3.slice(dotIndex + 1);
120564
+ const ext = basename4.slice(dotIndex + 1);
120789
120565
  if (extensionIconMap[ext]) {
120790
120566
  return extensionIconMap[ext];
120791
120567
  }
@@ -121231,8 +121007,8 @@ function TreeNode2({
121231
121007
  ) : /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
121232
121008
  ContextMenu2,
121233
121009
  {
121234
- onOpenChange: (open2) => {
121235
- if (open2) onSelectRow(entryPath, isDir ? "directory" : "file");
121010
+ onOpenChange: (open3) => {
121011
+ if (open3) onSelectRow(entryPath, isDir ? "directory" : "file");
121236
121012
  },
121237
121013
  children: [
121238
121014
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ContextMenuTrigger2, { asChild: true, children: button }),
@@ -121859,8 +121635,8 @@ var FileBrowser = (0, import_react31.forwardRef)(function FileBrowser2({
121859
121635
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
121860
121636
  ContextMenu2,
121861
121637
  {
121862
- onOpenChange: (open2) => {
121863
- if (open2) clearTreeSelection();
121638
+ onOpenChange: (open3) => {
121639
+ if (open3) clearTreeSelection();
121864
121640
  },
121865
121641
  children: [
121866
121642
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ContextMenuTrigger2, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "min-h-0 flex-1 overflow-y-auto py-1 pl-px", children: [
@@ -121952,8 +121728,8 @@ var FileBrowser = (0, import_react31.forwardRef)(function FileBrowser2({
121952
121728
  Dialog2,
121953
121729
  {
121954
121730
  open: pendingDelete !== null,
121955
- onOpenChange: (open2) => {
121956
- if (!open2) cancelDelete();
121731
+ onOpenChange: (open3) => {
121732
+ if (!open3) cancelDelete();
121957
121733
  },
121958
121734
  children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(DialogContent2, { className: "sm:max-w-[425px]", onClick: (e2) => e2.stopPropagation(), children: [
121959
121735
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(DialogHeader, { children: [
@@ -126109,7 +125885,7 @@ function getTableAsAliasSQL(table) {
126109
125885
 
126110
125886
  // src/lib/db/connection.ts
126111
125887
  import { mkdirSync as mkdirSync2 } from "node:fs";
126112
- import { join as join11 } from "node:path";
125888
+ import { join as join10 } from "node:path";
126113
125889
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
126114
125890
 
126115
125891
  // ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.1_@opentelemetry+api@1.9.0_@types+better-sqlite3@7.6.13_better-sql_95478898f63cc8c3fbbd0c5f8c1e464f/node_modules/drizzle-orm/pg-core/foreign-keys.js
@@ -131783,13 +131559,13 @@ function drizzle(...params) {
131783
131559
  // ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.1_@opentelemetry+api@1.9.0_@types+better-sqlite3@7.6.13_better-sql_95478898f63cc8c3fbbd0c5f8c1e464f/node_modules/drizzle-orm/migrator.js
131784
131560
  import crypto2 from "node:crypto";
131785
131561
  import fs3, { existsSync as existsSync3, readdirSync as readdirSync5 } from "node:fs";
131786
- import { join as join10 } from "node:path";
131562
+ import { join as join9 } from "node:path";
131787
131563
  function readMigrationFiles(config2) {
131788
131564
  if (fs3.existsSync(`${config2.migrationsFolder}/meta/_journal.json`)) throw Error('We detected that you have old drizzle-kit migration folders. You must upgrade drizzle-kit and run "drizzle-kit up"');
131789
131565
  const migrationFolderTo = config2.migrationsFolder;
131790
131566
  const migrationQueries = [];
131791
131567
  const migrations = readdirSync5(migrationFolderTo).map((subdir) => ({
131792
- path: join10(migrationFolderTo, subdir, "migration.sql"),
131568
+ path: join9(migrationFolderTo, subdir, "migration.sql"),
131793
131569
  name: subdir
131794
131570
  })).filter((it) => existsSync3(it.path));
131795
131571
  migrations.sort((a6, b10) => a6.name.localeCompare(b10.name));
@@ -131924,14 +131700,14 @@ var browserHistory = sqliteTable(
131924
131700
  );
131925
131701
 
131926
131702
  // src/lib/db/connection.ts
131927
- var migrationsFolder = join11(import.meta.dirname, "migrations");
131703
+ var migrationsFolder = join10(import.meta.dirname, "migrations");
131928
131704
  var _db = null;
131929
131705
  var _sqlite = null;
131930
131706
  function getDb() {
131931
131707
  if (_db) return _db;
131932
131708
  const home = bandHome();
131933
131709
  mkdirSync2(home, { recursive: true });
131934
- const dbPath = join11(home, "band.db");
131710
+ const dbPath = join10(home, "band.db");
131935
131711
  _sqlite = new DatabaseSync2(dbPath);
131936
131712
  _sqlite.exec("PRAGMA journal_mode = WAL");
131937
131713
  _sqlite.exec("PRAGMA foreign_keys = ON");
@@ -131950,7 +131726,7 @@ function closeDb() {
131950
131726
  // src/lib/state.ts
131951
131727
  function bandHome() {
131952
131728
  if (process.env.BAND_HOME) return process.env.BAND_HOME;
131953
- return join12(homedir7(), ".band");
131729
+ return join11(homedir6(), ".band");
131954
131730
  }
131955
131731
  function loadState() {
131956
131732
  const db2 = getDb();
@@ -132004,7 +131780,7 @@ function saveState(state2) {
132004
131780
  });
132005
131781
  }
132006
131782
  function settingsFile() {
132007
- return join12(bandHome(), "settings.json");
131783
+ return join11(bandHome(), "settings.json");
132008
131784
  }
132009
131785
  function loadSettings() {
132010
131786
  try {
@@ -132054,7 +131830,7 @@ function getOrCreateToken() {
132054
131830
  }
132055
131831
  function worktreesDir() {
132056
131832
  const settings = loadSettings();
132057
- return settings.worktreesDir ?? join12(bandHome(), "worktrees");
131833
+ return settings.worktreesDir ?? join11(bandHome(), "worktrees");
132058
131834
  }
132059
131835
  function loadCurrentStatuses() {
132060
131836
  const db2 = getDb();
@@ -132148,7 +131924,7 @@ function deleteBranchStatus(workspaceId) {
132148
131924
  }
132149
131925
 
132150
131926
  // src/lib/agent-pool.ts
132151
- var log8 = createLogger("agent-pool");
131927
+ var log7 = createLogger("agent-pool");
132152
131928
  var POOL_KEY = Symbol.for("band.agent-pool.v2");
132153
131929
  var PENDING_KEY = Symbol.for("band.agent-pool.pending");
132154
131930
  var g2 = globalThis;
@@ -132158,7 +131934,7 @@ var pool = g2[POOL_KEY];
132158
131934
  var pending = g2[PENDING_KEY];
132159
131935
  function loadClaudeSettingsModel() {
132160
131936
  try {
132161
- const data = readFileSync5(join13(homedir8(), ".claude", "settings.json"), "utf-8");
131937
+ const data = readFileSync5(join12(homedir7(), ".claude", "settings.json"), "utf-8");
132162
131938
  const parsed = JSON.parse(data);
132163
131939
  return typeof parsed.model === "string" ? parsed.model : void 0;
132164
131940
  } catch {
@@ -132177,7 +131953,7 @@ function getAgentConfig(worktreePath, agentId) {
132177
131953
  type: agentDef.type,
132178
131954
  workspaceDir: worktreePath,
132179
131955
  maxTurns: 100,
132180
- additionalDirectories: [join13(bandHome(), "uploads"), join13(bandHome(), "shared")],
131956
+ additionalDirectories: [join12(bandHome(), "uploads"), join12(bandHome(), "shared")],
132181
131957
  options: {
132182
131958
  executablePath: agentDef.command,
132183
131959
  model,
@@ -132193,7 +131969,7 @@ function getAgent(chatId) {
132193
131969
  return pool.get(chatId)?.agent;
132194
131970
  }
132195
131971
  function removeAgent(chatId) {
132196
- log8.info({ chatId }, "removing agent from pool");
131972
+ log7.info({ chatId }, "removing agent from pool");
132197
131973
  return pool.delete(chatId);
132198
131974
  }
132199
131975
  async function getOrCreateAgent(chatId, worktreePath, agentId) {
@@ -132201,7 +131977,7 @@ async function getOrCreateAgent(chatId, worktreePath, agentId) {
132201
131977
  if (existing) {
132202
131978
  const requestedDefId = resolveAgentDefId(agentId);
132203
131979
  if (existing.agentDefId !== requestedDefId) {
132204
- log8.info(
131980
+ log7.info(
132205
131981
  { chatId, cached: existing.agentDefId, requested: requestedDefId },
132206
131982
  "cached agent definition mismatch, replacing"
132207
131983
  );
@@ -132215,7 +131991,7 @@ async function getOrCreateAgent(chatId, worktreePath, agentId) {
132215
131991
  return inFlight.promise;
132216
131992
  }
132217
131993
  const config2 = getAgentConfig(worktreePath, agentId);
132218
- log8.info({ chatId, type: config2.type, defId, cwd: worktreePath }, "creating agent");
131994
+ log7.info({ chatId, type: config2.type, defId, cwd: worktreePath }, "creating agent");
132219
131995
  const promise2 = createCodingAgent(config2).then(
132220
131996
  (agent) => {
132221
131997
  pool.set(chatId, { agent, agentDefId: defId });
@@ -132494,7 +132270,7 @@ function removeChatFromLayout(workspaceId, chatId) {
132494
132270
  // src/lib/git.ts
132495
132271
  import { execFile as execFile2 } from "node:child_process";
132496
132272
  import { readFile, stat as stat3 } from "node:fs/promises";
132497
- import { join as join14 } from "node:path";
132273
+ import { join as join13 } from "node:path";
132498
132274
  function parseGitRemoteUrl(url2) {
132499
132275
  const sshMatch = url2.match(/^[\w.-]+@([^:]+):([^/]+)\/(.+?)(?:\.git)?$/);
132500
132276
  if (sshMatch) {
@@ -132604,7 +132380,7 @@ async function listWorktrees(repoPath) {
132604
132380
  return worktrees2;
132605
132381
  }
132606
132382
  async function resolveDetachedBranch(worktreePath) {
132607
- const dotGit = join14(worktreePath, ".git");
132383
+ const dotGit = join13(worktreePath, ".git");
132608
132384
  let gitdir;
132609
132385
  try {
132610
132386
  const st = await stat3(dotGit);
@@ -132621,7 +132397,7 @@ async function resolveDetachedBranch(worktreePath) {
132621
132397
  }
132622
132398
  for (const rebaseDir of ["rebase-merge", "rebase-apply"]) {
132623
132399
  try {
132624
- const headName = await readFile(join14(gitdir, rebaseDir, "head-name"), "utf-8");
132400
+ const headName = await readFile(join13(gitdir, rebaseDir, "head-name"), "utf-8");
132625
132401
  const name24 = headName.trim();
132626
132402
  return name24.startsWith("refs/heads/") ? name24.slice("refs/heads/".length) : name24;
132627
132403
  } catch {
@@ -133065,10 +132841,10 @@ import { spawn as spawn5 } from "node:child_process";
133065
132841
 
133066
132842
  // src/lib/project-config.ts
133067
132843
  import { existsSync as existsSync4, readFileSync as readFileSync6 } from "node:fs";
133068
- import { join as join15 } from "node:path";
132844
+ import { join as join14 } from "node:path";
133069
132845
  function loadProjectConfig(worktreePath, projectPath) {
133070
132846
  for (const base2 of [worktreePath, projectPath]) {
133071
- const configPath = join15(base2, ".band", "config.json");
132847
+ const configPath = join14(base2, ".band", "config.json");
133072
132848
  if (existsSync4(configPath)) {
133073
132849
  try {
133074
132850
  return JSON.parse(readFileSync6(configPath, "utf-8"));
@@ -133188,7 +132964,7 @@ function subscribe(listener) {
133188
132964
  }
133189
132965
 
133190
132966
  // src/lib/chat-manager.ts
133191
- var log9 = createLogger("chat-manager");
132967
+ var log8 = createLogger("chat-manager");
133192
132968
  var PANEL_TYPE = "chat";
133193
132969
  var chatSessions = /* @__PURE__ */ new Map();
133194
132970
  var workspaceChats = /* @__PURE__ */ new Map();
@@ -133259,7 +133035,7 @@ function createChat(workspaceId, options2) {
133259
133035
  addToIndex(session);
133260
133036
  addChatToLayout(workspaceId, session.id, { title: session.name });
133261
133037
  emit({ kind: "chat-created", workspaceId, chatId: session.id });
133262
- log9.info({ chatId: session.id, workspaceId, agent: session.agent }, "chat pane created");
133038
+ log8.info({ chatId: session.id, workspaceId, agent: session.agent }, "chat pane created");
133263
133039
  return session;
133264
133040
  }
133265
133041
  function getChat(chatId) {
@@ -133288,7 +133064,7 @@ function updateChat(chatId, updates) {
133288
133064
  state: serializeState(session),
133289
133065
  updatedAt: Date.now()
133290
133066
  });
133291
- log9.info({ chatId, updates }, "chat pane updated");
133067
+ log8.info({ chatId, updates }, "chat pane updated");
133292
133068
  return session;
133293
133069
  }
133294
133070
  function updateChatStatus(chatId, status) {
@@ -133340,7 +133116,7 @@ function removeChat(chatId) {
133340
133116
  removeChatFromLayout(session.workspaceId, chatId);
133341
133117
  removeFromIndex(chatId);
133342
133118
  emit({ kind: "chat-removed", workspaceId: session.workspaceId, chatId });
133343
- log9.info({ chatId, workspaceId: session.workspaceId }, "chat pane removed");
133119
+ log8.info({ chatId, workspaceId: session.workspaceId }, "chat pane removed");
133344
133120
  return true;
133345
133121
  }
133346
133122
  function removeWorkspaceChats(workspaceId) {
@@ -133352,7 +133128,7 @@ function removeWorkspaceChats(workspaceId) {
133352
133128
  }
133353
133129
  deletePanelStatesForWorkspace(workspaceId, PANEL_TYPE);
133354
133130
  workspaceChats.delete(workspaceId);
133355
- log9.info({ workspaceId }, "all chat panes removed for workspace");
133131
+ log8.info({ workspaceId }, "all chat panes removed for workspace");
133356
133132
  }
133357
133133
  function loadChatsFromDb() {
133358
133134
  _initialized = true;
@@ -133380,7 +133156,7 @@ function loadChatsFromDb() {
133380
133156
  addToIndex(session);
133381
133157
  }
133382
133158
  if (rows.length > 0) {
133383
- log9.info({ count: rows.length }, "loaded chat panes from database");
133159
+ log8.info({ count: rows.length }, "loaded chat panes from database");
133384
133160
  }
133385
133161
  return rows.length;
133386
133162
  }
@@ -133495,7 +133271,7 @@ function clearQueuedMessages(chatId) {
133495
133271
  // src/lib/task-runner.ts
133496
133272
  init_src();
133497
133273
  import { mkdirSync as mkdirSync4, readdirSync as readdirSync6 } from "node:fs";
133498
- import { join as join17 } from "node:path";
133274
+ import { join as join16 } from "node:path";
133499
133275
 
133500
133276
  // src/lib/mime-types.ts
133501
133277
  import { extname } from "node:path";
@@ -133560,7 +133336,7 @@ function hasPendingInputForWorkspace(workspaceId) {
133560
133336
 
133561
133337
  // src/lib/task-store.ts
133562
133338
  init_src();
133563
- var log10 = createLogger("task-store");
133339
+ var log9 = createLogger("task-store");
133564
133340
  function generateTaskId() {
133565
133341
  return `tsk_${Date.now()}`;
133566
133342
  }
@@ -133633,7 +133409,7 @@ function cleanupStaleTasks() {
133633
133409
  const result = db2.update(tasks).set({ status: "failed", completedAt: now }).where(eq2(tasks.status, "running")).run();
133634
133410
  const count3 = result.changes;
133635
133411
  if (count3 > 0) {
133636
- log10.info({ count: count3 }, "cleaned up stale tasks on startup");
133412
+ log9.info({ count: count3 }, "cleaned up stale tasks on startup");
133637
133413
  }
133638
133414
  return count3;
133639
133415
  }
@@ -133670,7 +133446,7 @@ function pruneOldTasks(retentionMs = TASK_RETENTION_MS) {
133670
133446
  const cutoff = Date.now() - retentionMs;
133671
133447
  const count3 = deleteTasksOlderThan(cutoff);
133672
133448
  if (count3 > 0) {
133673
- log10.info({ count: count3, retentionMs }, "pruned tasks older than retention window");
133449
+ log9.info({ count: count3, retentionMs }, "pruned tasks older than retention window");
133674
133450
  }
133675
133451
  return count3;
133676
133452
  }
@@ -133681,13 +133457,13 @@ function startTaskPruneScheduler(options2 = {}) {
133681
133457
  try {
133682
133458
  pruneOldTasks(retentionMs);
133683
133459
  } catch (err) {
133684
- log10.error({ err }, "initial task prune on boot failed");
133460
+ log9.error({ err }, "initial task prune on boot failed");
133685
133461
  }
133686
133462
  const timer = setInterval(() => {
133687
133463
  try {
133688
133464
  pruneOldTasks(retentionMs);
133689
133465
  } catch (err) {
133690
- log10.error({ err }, "scheduled task prune failed");
133466
+ log9.error({ err }, "scheduled task prune failed");
133691
133467
  }
133692
133468
  }, intervalMs);
133693
133469
  timer.unref();
@@ -133730,9 +133506,9 @@ function rowToRecord(row) {
133730
133506
 
133731
133507
  // src/lib/upload-utils.ts
133732
133508
  import { mkdir, writeFile } from "node:fs/promises";
133733
- import { join as join16 } from "node:path";
133509
+ import { join as join15 } from "node:path";
133734
133510
  async function saveUploadedFilesDetailed(fileParts) {
133735
- const uploadDir = join16(bandHome(), "uploads");
133511
+ const uploadDir = join15(bandHome(), "uploads");
133736
133512
  await mkdir(uploadDir, { recursive: true });
133737
133513
  const baseTimestamp = Date.now();
133738
133514
  const saved = [];
@@ -133744,7 +133520,7 @@ async function saveUploadedFilesDetailed(fileParts) {
133744
133520
  const filename = part.filename || `file-${baseTimestamp}`;
133745
133521
  const safeOriginal = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
133746
133522
  const storedName = `${baseTimestamp}-${i2}-${safeOriginal}`;
133747
- const filePath = join16(uploadDir, storedName);
133523
+ const filePath = join15(uploadDir, storedName);
133748
133524
  await writeFile(filePath, buffer);
133749
133525
  saved.push({
133750
133526
  path: filePath,
@@ -133774,7 +133550,7 @@ function resolveWorkspace(workspaceId) {
133774
133550
  }
133775
133551
 
133776
133552
  // src/lib/task-runner.ts
133777
- var log11 = createLogger("task-runner");
133553
+ var log10 = createLogger("task-runner");
133778
133554
  function listFiles(dir) {
133779
133555
  try {
133780
133556
  return new Set(readdirSync6(dir));
@@ -133833,7 +133609,7 @@ function persistTask(task) {
133833
133609
  chatId: task.chatId
133834
133610
  });
133835
133611
  } catch (err) {
133836
- log11.warn({ err, taskId: task.taskRecordId }, "failed to persist task");
133612
+ log10.warn({ err, taskId: task.taskRecordId }, "failed to persist task");
133837
133613
  }
133838
133614
  }
133839
133615
  function broadcast(chatId, chunk) {
@@ -133857,7 +133633,7 @@ function broadcast(chatId, chunk) {
133857
133633
  }
133858
133634
  const subs = listeners2.get(chatId);
133859
133635
  if (!subs || subs.size === 0) {
133860
- log11.warn({ chatId, chunkType: chunk.type }, "broadcast: no listeners");
133636
+ log10.warn({ chatId, chunkType: chunk.type }, "broadcast: no listeners");
133861
133637
  return;
133862
133638
  }
133863
133639
  for (const listener of subs) {
@@ -133908,7 +133684,7 @@ function submitTask(options2) {
133908
133684
  tasks2.set(chatId, task);
133909
133685
  persistTask(task);
133910
133686
  runTask(chatId, task).catch((err) => {
133911
- log11.error({ chatId, err }, "task execution failed");
133687
+ log10.error({ chatId, err }, "task execution failed");
133912
133688
  if (task.status === "running") {
133913
133689
  task.status = "failed";
133914
133690
  task.completedAt = Date.now();
@@ -133942,7 +133718,7 @@ function abortTask(chatId) {
133942
133718
  updateChatStatus(chatId, "idle");
133943
133719
  const updated = upsertWorkspaceStatus(task.workspaceId, { status: "waiting" });
133944
133720
  emit({ kind: "update", status: updated });
133945
- log11.info({ chatId }, "task aborted by user");
133721
+ log10.info({ chatId }, "task aborted by user");
133946
133722
  return true;
133947
133723
  }
133948
133724
  function cancelTask(taskId) {
@@ -133962,7 +133738,7 @@ function cancelTask(taskId) {
133962
133738
  updateChatStatus(chatId, "idle");
133963
133739
  const updated = upsertWorkspaceStatus(task.workspaceId, { status: "waiting" });
133964
133740
  emit({ kind: "update", status: updated });
133965
- log11.info({ chatId, taskId }, "task cancelled (was running in-memory)");
133741
+ log10.info({ chatId, taskId }, "task cancelled (was running in-memory)");
133966
133742
  return { cancelled: true, workspaceId: task.workspaceId };
133967
133743
  }
133968
133744
  }
@@ -133970,7 +133746,7 @@ function cancelTask(taskId) {
133970
133746
  if (record2) {
133971
133747
  const updated = upsertWorkspaceStatus(record2.workspaceId, { status: "waiting" });
133972
133748
  emit({ kind: "update", status: updated });
133973
- log11.info({ taskId, workspaceId: record2.workspaceId }, "orphaned task cancelled");
133749
+ log10.info({ taskId, workspaceId: record2.workspaceId }, "orphaned task cancelled");
133974
133750
  return { cancelled: true, workspaceId: record2.workspaceId };
133975
133751
  }
133976
133752
  return { cancelled: false };
@@ -133990,7 +133766,7 @@ async function runTask(chatId, task) {
133990
133766
  const taskAgentId = task.codingAgentId;
133991
133767
  const resolvedAgentId = taskAgentId ?? chatSession?.agent;
133992
133768
  const needsReplace = taskAgentId && taskAgentId !== chatSession?.agent;
133993
- log11.info(
133769
+ log10.info(
133994
133770
  { chatId, taskAgentId, chatAgent: chatSession?.agent, resolvedAgentId, needsReplace },
133995
133771
  "resolving agent for task"
133996
133772
  );
@@ -133998,7 +133774,7 @@ async function runTask(chatId, task) {
133998
133774
  updateChatStatus(chatId, "running");
133999
133775
  const working = upsertWorkspaceStatus(task.workspaceId, { status: "working" });
134000
133776
  emit({ kind: "update", status: working });
134001
- const sharedDir = join17(bandHome(), "shared", task.workspaceId);
133777
+ const sharedDir = join16(bandHome(), "shared", task.workspaceId);
134002
133778
  mkdirSync4(sharedDir, { recursive: true });
134003
133779
  const INTERACTIVE_TOOLS = /* @__PURE__ */ new Set(["AskUserQuestion", "ExitPlanMode"]);
134004
133780
  let textPartId = "";
@@ -134039,7 +133815,7 @@ async function runTask(chatId, task) {
134039
133815
  [File sharing: to send a file to the user, write or copy it to ${sharedDir}/ and it will appear as a downloadable file card in the chat.]`;
134040
133816
  const effectivePrompt = task.sessionId ? task.agentPrompt : task.agentPrompt + fileSharingHint;
134041
133817
  for await (const event of agent.runSession(effectivePrompt, task.sessionId, sessionOptions)) {
134042
- log11.info({ chatId, eventType: event.type }, "task event");
133818
+ log10.info({ chatId, eventType: event.type }, "task event");
134043
133819
  switch (event.type) {
134044
133820
  case "session-start": {
134045
133821
  task.sessionId = event.sessionId;
@@ -134220,7 +133996,7 @@ async function runTask(chatId, task) {
134220
133996
  break;
134221
133997
  }
134222
133998
  case "session-id-resolved": {
134223
- log11.info(
133999
+ log10.info(
134224
134000
  { chatId, previous: event.previousSessionId, resolved: event.resolvedSessionId },
134225
134001
  "session ID resolved"
134226
134002
  );
@@ -134315,7 +134091,7 @@ ${queued.text}`;
134315
134091
  });
134316
134092
  autoStarted = true;
134317
134093
  } catch (err) {
134318
- log11.warn({ chatId, err }, "failed to auto-start queued task");
134094
+ log10.warn({ chatId, err }, "failed to auto-start queued task");
134319
134095
  }
134320
134096
  }
134321
134097
  }
@@ -134415,7 +134191,7 @@ function getSessionEventsAfter(sessionId, afterEventId) {
134415
134191
  }
134416
134192
 
134417
134193
  // src/api/task-stream.ts
134418
- var log12 = createLogger("task-stream");
134194
+ var log11 = createLogger("task-stream");
134419
134195
  var INTERNAL_CHUNK_TYPES = /* @__PURE__ */ new Set(["user-message"]);
134420
134196
  function toUIChunk(chunk) {
134421
134197
  if (INTERNAL_CHUNK_TYPES.has(chunk.type)) return null;
@@ -134470,7 +134246,7 @@ function streamTask(res, chatId, sessionId, afterEventId) {
134470
134246
  const buf = getSessionBuffer(task.sessionId);
134471
134247
  if (buf && buf.events.length > 0) {
134472
134248
  const taskStartEventId = task.firstEventId ?? Number.POSITIVE_INFINITY;
134473
- log12.info(
134249
+ log11.info(
134474
134250
  {
134475
134251
  chatId,
134476
134252
  sessionId: task.sessionId,
@@ -134494,7 +134270,7 @@ function streamTask(res, chatId, sessionId, afterEventId) {
134494
134270
  }
134495
134271
  }
134496
134272
  if (queue.length === 0 && !caughtUp && (!task || task.status !== "running")) {
134497
- log12.warn(
134273
+ log11.warn(
134498
134274
  { chatId, taskStatus: task?.status, queueLen: queue.length },
134499
134275
  "task-stream: no running task and no events \u2014 closing stream early"
134500
134276
  );
@@ -134592,7 +134368,7 @@ ${prompt}`;
134592
134368
  }
134593
134369
  throw err;
134594
134370
  }
134595
- log12.info({ chatId, workspaceId }, "task-stream: POST \u2014 task submitted, opening SSE stream");
134371
+ log11.info({ chatId, workspaceId }, "task-stream: POST \u2014 task submitted, opening SSE stream");
134596
134372
  streamTask(res, chatId, sessionId, void 0);
134597
134373
  }
134598
134374
  function handleGet(req, res, chatId) {
@@ -134606,13 +134382,13 @@ function handleGet(req, res, chatId) {
134606
134382
  res.end();
134607
134383
  return;
134608
134384
  }
134609
- log12.info({ chatId, sessionId, afterEventId }, "task-stream: GET \u2014 reconnecting to active stream");
134385
+ log11.info({ chatId, sessionId, afterEventId }, "task-stream: GET \u2014 reconnecting to active stream");
134610
134386
  streamTask(res, chatId, sessionId ?? task.sessionId, afterEventId);
134611
134387
  }
134612
134388
  function handleTaskStream(req, res, chatId) {
134613
134389
  if (req.method === "POST") {
134614
134390
  handlePost(req, res, chatId).catch((err) => {
134615
- log12.error({ chatId, err }, "task-stream: POST handler error");
134391
+ log11.error({ chatId, err }, "task-stream: POST handler error");
134616
134392
  if (!res.headersSent) {
134617
134393
  res.writeHead(500, { "Content-Type": "application/json" });
134618
134394
  res.end(JSON.stringify({ error: "Internal server error" }));
@@ -134657,7 +134433,7 @@ function removeBrowserFromLayout(workspaceId, browserId) {
134657
134433
  }
134658
134434
 
134659
134435
  // src/lib/browser-manager.ts
134660
- var log13 = createLogger("browser-manager");
134436
+ var log12 = createLogger("browser-manager");
134661
134437
  var PANEL_TYPE2 = "browser";
134662
134438
  var browserTabs = /* @__PURE__ */ new Map();
134663
134439
  var workspaceBrowsers = /* @__PURE__ */ new Map();
@@ -134718,7 +134494,7 @@ function createBrowser(workspaceId, options2) {
134718
134494
  title: tab.name,
134719
134495
  initialUrl: tab.url || void 0
134720
134496
  });
134721
- log13.info({ browserId: tab.id, workspaceId, url: tab.url }, "browser tab created");
134497
+ log12.info({ browserId: tab.id, workspaceId, url: tab.url }, "browser tab created");
134722
134498
  return tab;
134723
134499
  }
134724
134500
  function getBrowser(browserId) {
@@ -134745,7 +134521,7 @@ function updateBrowser(browserId, updates) {
134745
134521
  state: serializeState2(tab),
134746
134522
  updatedAt: Date.now()
134747
134523
  });
134748
- log13.info({ browserId, updates }, "browser tab updated");
134524
+ log12.info({ browserId, updates }, "browser tab updated");
134749
134525
  return tab;
134750
134526
  }
134751
134527
  function updateBrowserUrl(browserId, url2) {
@@ -134762,7 +134538,7 @@ function removeBrowser(browserId) {
134762
134538
  if (!tab) return false;
134763
134539
  deletePanelState(browserId);
134764
134540
  removeFromIndex2(browserId);
134765
- log13.info({ browserId, workspaceId: tab.workspaceId }, "browser tab removed");
134541
+ log12.info({ browserId, workspaceId: tab.workspaceId }, "browser tab removed");
134766
134542
  return true;
134767
134543
  }
134768
134544
  function removeWorkspaceBrowsers(workspaceId) {
@@ -134773,7 +134549,7 @@ function removeWorkspaceBrowsers(workspaceId) {
134773
134549
  }
134774
134550
  deletePanelStatesForWorkspace(workspaceId, PANEL_TYPE2);
134775
134551
  workspaceBrowsers.delete(workspaceId);
134776
- log13.info({ workspaceId }, "all browser tabs removed for workspace");
134552
+ log12.info({ workspaceId }, "all browser tabs removed for workspace");
134777
134553
  }
134778
134554
  function loadBrowsersFromDb() {
134779
134555
  _initialized2 = true;
@@ -134796,13 +134572,13 @@ function loadBrowsersFromDb() {
134796
134572
  addToIndex2(tab);
134797
134573
  }
134798
134574
  if (rows.length > 0) {
134799
- log13.info({ count: rows.length }, "loaded browser tabs from database");
134575
+ log12.info({ count: rows.length }, "loaded browser tabs from database");
134800
134576
  }
134801
134577
  return rows.length;
134802
134578
  }
134803
134579
 
134804
134580
  // src/lib/browser-host.ts
134805
- var log14 = createLogger("browser-host");
134581
+ var log13 = createLogger("browser-host");
134806
134582
  var DESKTOP_CDP_HOST = "127.0.0.1";
134807
134583
  var DESKTOP_CDP_PORT = 9223;
134808
134584
  var globalAny = globalThis;
@@ -134853,7 +134629,7 @@ async function ensureCdpTargetId(bandTabId) {
134853
134629
  reject: rejectFn,
134854
134630
  timeoutId
134855
134631
  });
134856
- log14.info(
134632
+ log13.info(
134857
134633
  "ensureCdpTargetId emitting ensureView for %s (url=%s, listeners=%d)",
134858
134634
  bandTabId,
134859
134635
  tab.url,
@@ -134867,13 +134643,13 @@ async function ensureCdpTargetId(bandTabId) {
134867
134643
  url: tab.url
134868
134644
  });
134869
134645
  } catch (err) {
134870
- log14.warn("ensureView listener threw: %s", err instanceof Error ? err.message : err);
134646
+ log13.warn("ensureView listener threw: %s", err instanceof Error ? err.message : err);
134871
134647
  }
134872
134648
  }
134873
134649
  return promise2;
134874
134650
  }
134875
134651
  function resolveTargetReady(bandTabId, cdpTargetId) {
134876
- log14.info("resolveTargetReady %s \u2192 %s", bandTabId, cdpTargetId);
134652
+ log13.info("resolveTargetReady %s \u2192 %s", bandTabId, cdpTargetId);
134877
134653
  targetIdByBandTabId.set(bandTabId, cdpTargetId);
134878
134654
  const pending2 = pendingEnsures.get(bandTabId);
134879
134655
  if (pending2) {
@@ -134883,7 +134659,7 @@ function resolveTargetReady(bandTabId, cdpTargetId) {
134883
134659
  }
134884
134660
  }
134885
134661
  function markTargetDestroyed(bandTabId) {
134886
- log14.info("markTargetDestroyed %s", bandTabId);
134662
+ log13.info("markTargetDestroyed %s", bandTabId);
134887
134663
  targetIdByBandTabId.delete(bandTabId);
134888
134664
  const pending2 = pendingEnsures.get(bandTabId);
134889
134665
  if (pending2) {
@@ -134894,10 +134670,10 @@ function markTargetDestroyed(bandTabId) {
134894
134670
  }
134895
134671
  function onEnsureView(listener) {
134896
134672
  ensureListeners.add(listener);
134897
- log14.info("onEnsureView subscriber added (total=%d)", ensureListeners.size);
134673
+ log13.info("onEnsureView subscriber added (total=%d)", ensureListeners.size);
134898
134674
  return () => {
134899
134675
  ensureListeners.delete(listener);
134900
- log14.info("onEnsureView subscriber removed (total=%d)", ensureListeners.size);
134676
+ log13.info("onEnsureView subscriber removed (total=%d)", ensureListeners.size);
134901
134677
  if (ensureListeners.size === 0) {
134902
134678
  for (const [bandTabId, pending2] of pendingEnsures) {
134903
134679
  clearTimeout(pending2.timeoutId);
@@ -134914,7 +134690,7 @@ function isDesktopHostConnected() {
134914
134690
 
134915
134691
  // src/lib/cdp-proxy.ts
134916
134692
  init_src();
134917
- var log15 = createLogger("cdp-proxy");
134693
+ var log14 = createLogger("cdp-proxy");
134918
134694
  async function handleCdpConnection(ws, req) {
134919
134695
  const url2 = new URL(req.url ?? "", `http://${req.headers.host}`);
134920
134696
  const bandTabId = url2.searchParams.get("bandTabId");
@@ -134937,17 +134713,17 @@ async function handleCdpConnection(ws, req) {
134937
134713
  cdpTargetId = await ensureCdpTargetId(bandTabId);
134938
134714
  } catch (err) {
134939
134715
  const message = err instanceof Error ? err.message : String(err);
134940
- log15.debug("ensureCdpTargetId failed for %s: %s", bandTabId, message);
134716
+ log14.debug("ensureCdpTargetId failed for %s: %s", bandTabId, message);
134941
134717
  if (ws.readyState === ws.OPEN) {
134942
134718
  ws.close(4001, message.slice(0, 123));
134943
134719
  }
134944
134720
  return;
134945
134721
  }
134946
134722
  const upstreamUrl = `ws://${DESKTOP_CDP_HOST}:${DESKTOP_CDP_PORT}/devtools/page/${encodeURIComponent(cdpTargetId)}`;
134947
- log15.info("CDP proxy connecting bandTabId=%s upstream=%s", bandTabId, upstreamUrl);
134723
+ log14.info("CDP proxy connecting bandTabId=%s upstream=%s", bandTabId, upstreamUrl);
134948
134724
  upstream = new wrapper_default(upstreamUrl);
134949
134725
  upstream.on("open", () => {
134950
- log15.info("CDP upstream open bandTabId=%s pending=%d", bandTabId, pending2.length);
134726
+ log14.info("CDP upstream open bandTabId=%s pending=%d", bandTabId, pending2.length);
134951
134727
  for (const msg of pending2) {
134952
134728
  upstream?.send(msg);
134953
134729
  }
@@ -134959,20 +134735,20 @@ async function handleCdpConnection(ws, req) {
134959
134735
  }
134960
134736
  });
134961
134737
  upstream.on("error", (err) => {
134962
- log15.warn("CDP upstream error bandTabId=%s: %s", bandTabId, err.message);
134738
+ log14.warn("CDP upstream error bandTabId=%s: %s", bandTabId, err.message);
134963
134739
  markTargetDestroyed(bandTabId);
134964
134740
  if (ws.readyState === ws.OPEN) {
134965
134741
  ws.close(4001, `Desktop CDP error: ${err.message}`.slice(0, 123));
134966
134742
  }
134967
134743
  });
134968
134744
  upstream.on("close", (code) => {
134969
- log15.info("CDP upstream closed bandTabId=%s code=%d", bandTabId, code);
134745
+ log14.info("CDP upstream closed bandTabId=%s code=%d", bandTabId, code);
134970
134746
  if (ws.readyState === ws.OPEN) {
134971
134747
  ws.close(1e3, "Upstream closed");
134972
134748
  }
134973
134749
  });
134974
134750
  ws.on("close", () => {
134975
- log15.debug("CDP client closed bandTabId=%s", bandTabId);
134751
+ log14.debug("CDP client closed bandTabId=%s", bandTabId);
134976
134752
  if (upstream && (upstream.readyState === wrapper_default.OPEN || upstream.readyState === wrapper_default.CONNECTING)) {
134977
134753
  try {
134978
134754
  upstream.close();
@@ -134981,7 +134757,7 @@ async function handleCdpConnection(ws, req) {
134981
134757
  }
134982
134758
  });
134983
134759
  ws.on("error", (err) => {
134984
- log15.debug("CDP client error bandTabId=%s: %s", bandTabId, err.message);
134760
+ log14.debug("CDP client error bandTabId=%s: %s", bandTabId, err.message);
134985
134761
  try {
134986
134762
  upstream?.close();
134987
134763
  } catch {
@@ -134991,7 +134767,7 @@ async function handleCdpConnection(ws, req) {
134991
134767
 
134992
134768
  // src/lib/cdp-targets.ts
134993
134769
  init_src();
134994
- var log16 = createLogger("cdp-targets");
134770
+ var log15 = createLogger("cdp-targets");
134995
134771
  var CdpUnreachableError = class extends Error {
134996
134772
  constructor(message) {
134997
134773
  super(message);
@@ -135047,7 +134823,7 @@ async function captureSnapshot(bandTabId) {
135047
134823
  });
135048
134824
  ws.on("error", (err) => {
135049
134825
  clearTimeout(timeout);
135050
- log16.debug("captureSnapshot ws error for tab %s: %s", bandTabId, err.message);
134826
+ log15.debug("captureSnapshot ws error for tab %s: %s", bandTabId, err.message);
135051
134827
  markTargetDestroyed(bandTabId);
135052
134828
  settle(new CdpUnreachableError(err.message));
135053
134829
  });
@@ -135767,7 +135543,7 @@ function rowToDefinition(row) {
135767
135543
  }
135768
135544
 
135769
135545
  // src/lib/cronjob-scheduler.ts
135770
- var log17 = createLogger("cronjob-scheduler");
135546
+ var log16 = createLogger("cronjob-scheduler");
135771
135547
  var SCHEDULER_KEY = Symbol.for("band.cronjob-scheduler");
135772
135548
  var g14 = globalThis;
135773
135549
  if (!g14[SCHEDULER_KEY]) {
@@ -135787,16 +135563,16 @@ function scheduleJob(job, fileKey) {
135787
135563
  try {
135788
135564
  const cronInstance = new E2(job.cronExpression, () => {
135789
135565
  executeCronjob(job, fileKey).catch((err) => {
135790
- log17.error({ jobId: job.id, err }, "unhandled error in cronjob execution");
135566
+ log16.error({ jobId: job.id, err }, "unhandled error in cronjob execution");
135791
135567
  });
135792
135568
  });
135793
135569
  state.jobs.set(job.id, cronInstance);
135794
- log17.info(
135570
+ log16.info(
135795
135571
  { jobId: job.id, name: job.name, cron: job.cronExpression, scope: job.scope },
135796
135572
  "scheduled cronjob"
135797
135573
  );
135798
135574
  } catch (err) {
135799
- log17.error(
135575
+ log16.error(
135800
135576
  { jobId: job.id, cronExpression: job.cronExpression, err },
135801
135577
  "invalid cron expression, skipping job"
135802
135578
  );
@@ -135810,24 +135586,24 @@ async function executeCronjob(job, fileKey) {
135810
135586
  const appState = loadState();
135811
135587
  const project = appState.projects.find((p6) => p6.name === fileKey);
135812
135588
  if (!project) {
135813
- log17.warn({ jobId: job.id, fileKey }, "project not found for cronjob, skipping");
135589
+ log16.warn({ jobId: job.id, fileKey }, "project not found for cronjob, skipping");
135814
135590
  updateLastRun(job.id, "failed");
135815
135591
  return;
135816
135592
  }
135817
135593
  workspaceId = toWorkspaceId(project.name, project.defaultBranch);
135818
135594
  }
135819
- log17.info({ jobId: job.id, name: job.name, workspaceId }, "executing cronjob");
135595
+ log16.info({ jobId: job.id, name: job.name, workspaceId }, "executing cronjob");
135820
135596
  try {
135821
135597
  const chat = getOrCreateDefaultChat(workspaceId);
135822
135598
  submitTask({ workspaceId, chatId: chat.id, prompt: job.prompt });
135823
135599
  updateLastRun(job.id, "completed");
135824
135600
  } catch (err) {
135825
135601
  if (err instanceof TaskConflictError) {
135826
- log17.info({ jobId: job.id, workspaceId }, "task already running, skipping cronjob execution");
135602
+ log16.info({ jobId: job.id, workspaceId }, "task already running, skipping cronjob execution");
135827
135603
  updateLastRun(job.id, "skipped");
135828
135604
  return;
135829
135605
  }
135830
- log17.error({ jobId: job.id, err }, "cronjob execution failed");
135606
+ log16.error({ jobId: job.id, err }, "cronjob execution failed");
135831
135607
  updateLastRun(job.id, "failed");
135832
135608
  }
135833
135609
  }
@@ -135836,7 +135612,7 @@ function updateLastRun(jobId, status) {
135836
135612
  const db2 = getDb();
135837
135613
  db2.update(cronjobs).set({ lastRunAt: (/* @__PURE__ */ new Date()).toISOString(), lastRunStatus: status }).where(eq2(cronjobs.id, jobId)).run();
135838
135614
  } catch (err) {
135839
- log17.warn({ jobId, err }, "failed to update lastRun on cronjob");
135615
+ log16.warn({ jobId, err }, "failed to update lastRun on cronjob");
135840
135616
  }
135841
135617
  }
135842
135618
  function loadAndScheduleAll() {
@@ -135847,13 +135623,13 @@ function loadAndScheduleAll() {
135847
135623
  for (const job of listAllCronjobs()) {
135848
135624
  scheduleJob(job, job.fileKey);
135849
135625
  }
135850
- log17.info({ count: state.jobs.size }, "loaded cronjob schedules");
135626
+ log16.info({ count: state.jobs.size }, "loaded cronjob schedules");
135851
135627
  }
135852
135628
  function startCronjobScheduler() {
135853
135629
  if (state.started) return;
135854
135630
  state.started = true;
135855
135631
  loadAndScheduleAll();
135856
- log17.info("cronjob scheduler started");
135632
+ log16.info("cronjob scheduler started");
135857
135633
  }
135858
135634
  function stopCronjobScheduler() {
135859
135635
  for (const [, cron] of state.jobs) {
@@ -135861,7 +135637,7 @@ function stopCronjobScheduler() {
135861
135637
  }
135862
135638
  state.jobs.clear();
135863
135639
  state.started = false;
135864
- log17.info("cronjob scheduler stopped");
135640
+ log16.info("cronjob scheduler stopped");
135865
135641
  }
135866
135642
  function reloadSchedules() {
135867
135643
  if (!state.started) return;
@@ -135874,7 +135650,7 @@ function stopJobsForKey(key) {
135874
135650
  if (cron) {
135875
135651
  cron.stop();
135876
135652
  state.jobs.delete(job.id);
135877
- log17.info({ jobId: job.id, key }, "stopped cronjob");
135653
+ log16.info({ jobId: job.id, key }, "stopped cronjob");
135878
135654
  }
135879
135655
  }
135880
135656
  }
@@ -135887,7 +135663,7 @@ function runMigrations() {
135887
135663
  // src/lib/lsp-manager.ts
135888
135664
  init_src();
135889
135665
  import { spawn as spawn6 } from "node:child_process";
135890
- import { dirname as dirname2, join as join18, resolve as resolve4 } from "node:path";
135666
+ import { dirname as dirname2, join as join17, resolve as resolve4 } from "node:path";
135891
135667
  import { fileURLToPath } from "node:url";
135892
135668
 
135893
135669
  // src/lib/process-utils.ts
@@ -135940,7 +135716,7 @@ async function checkPrereqs() {
135940
135716
 
135941
135717
  // src/lib/lsp-manager.ts
135942
135718
  var __dirname2 = dirname2(fileURLToPath(import.meta.url));
135943
- var log18 = createLogger("lsp");
135719
+ var log17 = createLogger("lsp");
135944
135720
  var LANG_SERVER_CONFIG = {
135945
135721
  typescript: { command: "typescript-language-server", args: ["--stdio"] }
135946
135722
  };
@@ -135965,10 +135741,10 @@ async function getOrSpawnServer(workspaceId, lang) {
135965
135741
  const cwd = workspace.worktree.path;
135966
135742
  const appBin = resolve4(__dirname2, "../../node_modules/.bin");
135967
135743
  const bundledBin = resolve4(__dirname2, "node_modules/.bin");
135968
- const workspaceBin = join18(cwd, "node_modules/.bin");
135744
+ const workspaceBin = join17(cwd, "node_modules/.bin");
135969
135745
  const pathSep = process.platform === "win32" ? ";" : ":";
135970
135746
  const combinedPath = [bundledBin, appBin, workspaceBin, resolvedPath].join(pathSep);
135971
- log18.debug("Spawning %s language server in %s for workspace %s", lang, cwd, workspaceId);
135747
+ log17.debug("Spawning %s language server in %s for workspace %s", lang, cwd, workspaceId);
135972
135748
  const child = spawn6(config2.command, config2.args, {
135973
135749
  cwd,
135974
135750
  stdio: ["pipe", "pipe", "pipe"],
@@ -135996,15 +135772,15 @@ async function getOrSpawnServer(workspaceId, lang) {
135996
135772
  }
135997
135773
  ids.add(serverId);
135998
135774
  child.on("exit", (code) => {
135999
- log18.debug("Language server exited: %s (code %s)", serverId, String(code));
135775
+ log17.debug("Language server exited: %s (code %s)", serverId, String(code));
136000
135776
  removeSession();
136001
135777
  });
136002
135778
  child.on("error", (err) => {
136003
- log18.error("Language server error: %s \u2014 %s", serverId, err.message);
135779
+ log17.error("Language server error: %s \u2014 %s", serverId, err.message);
136004
135780
  removeSession();
136005
135781
  });
136006
135782
  child.stderr?.on("data", (chunk) => {
136007
- log18.debug("LSP stderr [%s]: %s", serverId, chunk.toString().trimEnd());
135783
+ log17.debug("LSP stderr [%s]: %s", serverId, chunk.toString().trimEnd());
136008
135784
  });
136009
135785
  await new Promise((resolve8, reject) => {
136010
135786
  child.once("spawn", resolve8);
@@ -136034,7 +135810,7 @@ function killAllServers() {
136034
135810
 
136035
135811
  // src/lib/lsp-proxy.ts
136036
135812
  init_src();
136037
- var log19 = createLogger("lsp-proxy");
135813
+ var log18 = createLogger("lsp-proxy");
136038
135814
  function frameMessage(json4) {
136039
135815
  const body = Buffer.from(json4, "utf-8");
136040
135816
  const header = `Content-Length: ${body.byteLength}\r
@@ -136052,7 +135828,7 @@ function createFrameParser(onMessage) {
136052
135828
  const headerStr = buffer.subarray(0, separatorIdx).toString("ascii");
136053
135829
  const match = headerStr.match(/Content-Length:\s*(\d+)/i);
136054
135830
  if (!match) {
136055
- log19.warn("Malformed LSP header: %s", headerStr);
135831
+ log18.warn("Malformed LSP header: %s", headerStr);
136056
135832
  buffer = buffer.subarray(separatorIdx + 4);
136057
135833
  continue;
136058
135834
  }
@@ -136085,7 +135861,7 @@ async function handleLspConnection(ws, req) {
136085
135861
  session = await getOrSpawnServer(workspaceId, lang);
136086
135862
  } catch (err) {
136087
135863
  const message = err instanceof Error ? err.message : String(err);
136088
- log19.error(
135864
+ log18.error(
136089
135865
  "Failed to spawn %s language server for workspace %s: %s",
136090
135866
  lang,
136091
135867
  workspaceId,
@@ -136099,12 +135875,12 @@ async function handleLspConnection(ws, req) {
136099
135875
  ws.close(4002, "Language server stdio not available");
136100
135876
  return;
136101
135877
  }
136102
- log19.debug("LSP client connected: %s/%s", workspaceId, lang);
135878
+ log18.debug("LSP client connected: %s/%s", workspaceId, lang);
136103
135879
  const pendingRequests = /* @__PURE__ */ new Map();
136104
135880
  const retriedIds = /* @__PURE__ */ new Set();
136105
135881
  const RETRY_DELAY_MS = 2e3;
136106
135882
  const parseFrame = createFrameParser((json4) => {
136107
- log19.debug(
135883
+ log18.debug(
136108
135884
  "LSP stdout [%s/%s]: %s",
136109
135885
  workspaceId,
136110
135886
  lang,
@@ -136116,7 +135892,7 @@ async function handleLspConnection(ws, req) {
136116
135892
  const originalRequest = pendingRequests.get(msg.id);
136117
135893
  retriedIds.add(msg.id);
136118
135894
  pendingRequests.delete(msg.id);
136119
- log19.debug(
135895
+ log18.debug(
136120
135896
  "LSP retrying request %d after 'No Project' error [%s/%s]",
136121
135897
  msg.id,
136122
135898
  workspaceId,
@@ -136138,14 +135914,14 @@ async function handleLspConnection(ws, req) {
136138
135914
  const onStdoutData = (chunk) => parseFrame(chunk);
136139
135915
  lspProcess.stdout.on("data", onStdoutData);
136140
135916
  const onExit = (code) => {
136141
- log19.debug("LSP server exited (code %s), closing WebSocket", String(code));
135917
+ log18.debug("LSP server exited (code %s), closing WebSocket", String(code));
136142
135918
  if (ws.readyState === ws.OPEN) {
136143
135919
  ws.close(1e3, "Language server exited");
136144
135920
  }
136145
135921
  };
136146
135922
  lspProcess.on("exit", onExit);
136147
135923
  function forwardToStdin(json4) {
136148
- log19.debug(
135924
+ log18.debug(
136149
135925
  "LSP stdin [%s/%s]: %s",
136150
135926
  workspaceId,
136151
135927
  lang,
@@ -136172,7 +135948,7 @@ async function handleLspConnection(ws, req) {
136172
135948
  ws.on("close", () => {
136173
135949
  lspProcess.stdout?.off("data", onStdoutData);
136174
135950
  lspProcess.off("exit", onExit);
136175
- log19.debug("LSP client disconnected: %s/%s (server kept alive)", workspaceId, lang);
135951
+ log18.debug("LSP client disconnected: %s/%s (server kept alive)", workspaceId, lang);
136176
135952
  });
136177
135953
  }
136178
135954
 
@@ -136182,20 +135958,21 @@ init_src();
136182
135958
  // src/lib/cli.ts
136183
135959
  import { accessSync, constants, lstatSync as lstatSync2, realpathSync as realpathSync2, symlinkSync as symlinkSync2, unlinkSync as unlinkSync2 } from "node:fs";
136184
135960
  import { platform as platform2 } from "node:os";
136185
- import { dirname as dirname3, join as join19, resolve as resolve5 } from "node:path";
135961
+ import { dirname as dirname3, join as join18, resolve as resolve5 } from "node:path";
136186
135962
  var SYMLINK_PATH = "/usr/local/bin/band";
136187
- function findCliBinary() {
135963
+ function findCliBinaryAt(opts) {
135964
+ const { cwd, dirname: dirname8 } = opts;
136188
135965
  const appsStrategies = [
136189
135966
  // cwd = apps/web/ (Vite dev and production server)
136190
- resolve5(process.cwd(), ".."),
135967
+ resolve5(cwd, ".."),
136191
135968
  // cwd = project root (fallback)
136192
- resolve5(process.cwd(), "apps"),
135969
+ resolve5(cwd, "apps"),
136193
135970
  // From this source file (apps/web/src/lib/ → apps/)
136194
- resolve5(import.meta.dirname, "..", "..", "..")
135971
+ resolve5(dirname8, "..", "..", "..")
136195
135972
  ];
136196
135973
  for (const appsDir of appsStrategies) {
136197
135974
  for (const profile of ["release", "debug"]) {
136198
- const p6 = join19(appsDir, "cli", "target", profile, "band");
135975
+ const p6 = join18(appsDir, "cli", "target", profile, "band");
136199
135976
  try {
136200
135977
  lstatSync2(p6);
136201
135978
  return p6;
@@ -136205,10 +135982,11 @@ function findCliBinary() {
136205
135982
  }
136206
135983
  const exe = platform2() === "win32" ? "band.exe" : "band";
136207
135984
  const electronCandidates = [
136208
- // From cwd (<Resources>/web/dist) → <Resources>/binaries/band
136209
- resolve5(process.cwd(), "..", "..", "binaries", exe),
136210
- // From the bundled dist file (<Resources>/web/dist/...) → <Resources>/binaries/band
136211
- resolve5(import.meta.dirname, "..", "..", "..", "binaries", exe)
135985
+ // From cwd (<Resources>/web) → <Resources>/binaries/band
135986
+ resolve5(cwd, "..", "binaries", exe),
135987
+ // From the bundled dist file (<Resources>/web/dist/start-server.mjs)
135988
+ // <Resources>/binaries/band
135989
+ resolve5(dirname8, "..", "..", "binaries", exe)
136212
135990
  ];
136213
135991
  for (const p6 of electronCandidates) {
136214
135992
  try {
@@ -136219,6 +135997,9 @@ function findCliBinary() {
136219
135997
  }
136220
135998
  return null;
136221
135999
  }
136000
+ function findCliBinary() {
136001
+ return findCliBinaryAt({ cwd: process.cwd(), dirname: import.meta.dirname });
136002
+ }
136222
136003
  async function checkCli() {
136223
136004
  try {
136224
136005
  const stat5 = lstatSync2(SYMLINK_PATH);
@@ -136231,8 +136012,8 @@ async function checkCli() {
136231
136012
  } catch {
136232
136013
  return "NotInstalled";
136233
136014
  }
136234
- const isCargoBuild = target.includes(join19("apps", "cli", "target"));
136235
- const isElectronSidecar = target.endsWith(join19("binaries", "band"));
136015
+ const isCargoBuild = target.includes(join18("apps", "cli", "target"));
136016
+ const isElectronSidecar = target.endsWith(join18("binaries", "band"));
136236
136017
  if (isCargoBuild || isElectronSidecar) {
136237
136018
  return "Installed";
136238
136019
  }
@@ -136265,12 +136046,18 @@ function isDirWritable(dir) {
136265
136046
  return false;
136266
136047
  }
136267
136048
  }
136049
+ function noBinaryError(env = process.env) {
136050
+ if (env.BAND_PACKAGED === "1") {
136051
+ return new Error("Bundled CLI binary missing - try reinstalling Band");
136052
+ }
136053
+ return new Error(
136054
+ "Could not find band CLI binary. Build it first with: cargo build --release -p band-cli"
136055
+ );
136056
+ }
136268
136057
  async function installCli(_opts = {}) {
136269
136058
  const binaryPath = findCliBinary();
136270
136059
  if (!binaryPath) {
136271
- throw new Error(
136272
- "Could not find band CLI binary. Build it first with: cargo build --release -p band-cli"
136273
- );
136060
+ throw noBinaryError();
136274
136061
  }
136275
136062
  const dir = dirname3(SYMLINK_PATH);
136276
136063
  if (isDirWritable(dir)) {
@@ -136310,8 +136097,8 @@ import {
136310
136097
  symlinkSync as symlinkSync3,
136311
136098
  writeFileSync as writeFileSync2
136312
136099
  } from "node:fs";
136313
- import { homedir as homedir9, tmpdir } from "node:os";
136314
- import { dirname as dirname4, join as join20 } from "node:path";
136100
+ import { homedir as homedir8, tmpdir } from "node:os";
136101
+ import { dirname as dirname4, join as join19 } from "node:path";
136315
136102
  var BAND_SKILL_NAMES = [
136316
136103
  "band",
136317
136104
  "band-chat",
@@ -136321,7 +136108,7 @@ var BAND_SKILL_NAMES = [
136321
136108
  "band-loop"
136322
136109
  ];
136323
136110
  var SKILL_FILE = "SKILL.md";
136324
- async function resolveSkillTargets(home = homedir9()) {
136111
+ async function resolveSkillTargets(home = homedir8()) {
136325
136112
  const seen = /* @__PURE__ */ new Set();
136326
136113
  const out = [];
136327
136114
  for (const type of SUPPORTED_AGENT_TYPES) {
@@ -136378,7 +136165,7 @@ async function installSkills(opts = {}) {
136378
136165
  conflicts: [],
136379
136166
  skipped: []
136380
136167
  };
136381
- const home = opts.home ?? homedir9();
136168
+ const home = opts.home ?? homedir8();
136382
136169
  const sharedDir = getSharedSkillsDir(home);
136383
136170
  const targets = await resolveSkillTargets(home);
136384
136171
  const bandPath = await findBandBinary();
@@ -136387,16 +136174,16 @@ async function installSkills(opts = {}) {
136387
136174
  "Skipping CLI skills sync \u2014 band binary not found (no symlink, not on PATH, no bundled sidecar)"
136388
136175
  );
136389
136176
  for (const name24 of BAND_SKILL_NAMES) {
136390
- result.skipped.push(join20(sharedDir, name24, SKILL_FILE));
136177
+ result.skipped.push(join19(sharedDir, name24, SKILL_FILE));
136391
136178
  }
136392
136179
  return result;
136393
136180
  }
136394
- const stagingDir = mkdtempSync(join20(tmpdir(), "band-skills-"));
136181
+ const stagingDir = mkdtempSync(join19(tmpdir(), "band-skills-"));
136395
136182
  try {
136396
136183
  await generateSkills(bandPath, stagingDir);
136397
136184
  for (const name24 of BAND_SKILL_NAMES) {
136398
- const sourcePath = join20(stagingDir, name24, SKILL_FILE);
136399
- const destPath = join20(sharedDir, name24, SKILL_FILE);
136185
+ const sourcePath = join19(stagingDir, name24, SKILL_FILE);
136186
+ const destPath = join19(sharedDir, name24, SKILL_FILE);
136400
136187
  if (!existsSync5(sourcePath)) {
136401
136188
  opts.log?.warn("Generated skill missing from staging dir: %s (skipping)", sourcePath);
136402
136189
  result.skipped.push(destPath);
@@ -136443,8 +136230,8 @@ async function installSkills(opts = {}) {
136443
136230
  }
136444
136231
  for (const target of targets) {
136445
136232
  for (const name24 of BAND_SKILL_NAMES) {
136446
- const shared2 = join20(sharedDir, name24);
136447
- const link2 = join20(target.skillsDir, name24);
136233
+ const shared2 = join19(sharedDir, name24);
136234
+ const link2 = join19(target.skillsDir, name24);
136448
136235
  if (!existsSync5(shared2)) {
136449
136236
  result.skipped.push(link2);
136450
136237
  continue;
@@ -136563,11 +136350,11 @@ function readlinkSafe(p6) {
136563
136350
 
136564
136351
  // src/lib/hooks.ts
136565
136352
  import { mkdirSync as mkdirSync6, readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "node:fs";
136566
- import { homedir as homedir10 } from "node:os";
136567
- import { dirname as dirname5, join as join21 } from "node:path";
136353
+ import { homedir as homedir9 } from "node:os";
136354
+ import { dirname as dirname5, join as join20 } from "node:path";
136568
136355
  var HOOK_EVENTS = ["PreToolUse", "PermissionRequest", "UserPromptSubmit", "PostToolUse", "Stop"];
136569
136356
  function claudeSettingsPath() {
136570
- return join21(homedir10(), ".claude", "settings.json");
136357
+ return join20(homedir9(), ".claude", "settings.json");
136571
136358
  }
136572
136359
  function loadClaudeSettings() {
136573
136360
  try {
@@ -136657,7 +136444,7 @@ async function installHooks() {
136657
136444
  }
136658
136445
 
136659
136446
  // src/lib/setup.ts
136660
- var log20 = createLogger("setup");
136447
+ var log19 = createLogger("setup");
136661
136448
  var AGENT_CHECKS = [
136662
136449
  { id: "claude-code", type: "claude-code", label: "Claude Code", binary: "claude" },
136663
136450
  { id: "codex", type: "codex", label: "Codex", binary: "codex" },
@@ -136675,22 +136462,22 @@ async function ensureCliInstalled() {
136675
136462
  try {
136676
136463
  cliStatus = await checkCli();
136677
136464
  } catch (err) {
136678
- log20.warn("Could not check CLI status: %s", err instanceof Error ? err.message : String(err));
136465
+ log19.warn("Could not check CLI status: %s", err instanceof Error ? err.message : String(err));
136679
136466
  return;
136680
136467
  }
136681
136468
  if (cliStatus === "Installed") {
136682
136469
  return;
136683
136470
  }
136684
136471
  if (cliStatus !== "NotInstalled") {
136685
- log20.warn("CLI not auto-installed (status: %s)", cliStatus);
136472
+ log19.warn("CLI not auto-installed (status: %s)", cliStatus);
136686
136473
  return;
136687
136474
  }
136688
- log20.info("Installing band CLI...");
136475
+ log19.info("Installing band CLI...");
136689
136476
  try {
136690
136477
  await installCli();
136691
- log20.info("CLI installed to /usr/local/bin/band");
136478
+ log19.info("CLI installed to /usr/local/bin/band");
136692
136479
  } catch (err) {
136693
- log20.warn("CLI installation failed: %s", err instanceof Error ? err.message : String(err));
136480
+ log19.warn("CLI installation failed: %s", err instanceof Error ? err.message : String(err));
136694
136481
  }
136695
136482
  }
136696
136483
  async function ensureDefaultCodingAgents() {
@@ -136699,17 +136486,17 @@ async function ensureDefaultCodingAgents() {
136699
136486
  if (Array.isArray(existing) && existing.length > 0) {
136700
136487
  return;
136701
136488
  }
136702
- log20.info("Detecting installed coding agents...");
136489
+ log19.info("Detecting installed coding agents...");
136703
136490
  const detected = [];
136704
136491
  for (const check2 of AGENT_CHECKS) {
136705
136492
  const path3 = await whichBinary(check2.binary);
136706
136493
  if (path3) {
136707
- log20.info("Detected coding agent: %s (%s)", check2.id, path3);
136494
+ log19.info("Detected coding agent: %s (%s)", check2.id, path3);
136708
136495
  detected.push({ id: check2.id, type: check2.type, label: check2.label });
136709
136496
  }
136710
136497
  }
136711
136498
  if (detected.length === 0) {
136712
- log20.info("No coding agent CLIs detected on PATH");
136499
+ log19.info("No coding agent CLIs detected on PATH");
136713
136500
  return;
136714
136501
  }
136715
136502
  const current = loadSettings();
@@ -136718,7 +136505,7 @@ async function ensureDefaultCodingAgents() {
136718
136505
  current.defaultCodingAgent = detected[0].id;
136719
136506
  }
136720
136507
  saveSettings(current);
136721
- log20.info("Enabled %d coding agent(s); default = %s", detected.length, current.defaultCodingAgent);
136508
+ log19.info("Enabled %d coding agent(s); default = %s", detected.length, current.defaultCodingAgent);
136722
136509
  }
136723
136510
  function ensureNotificationDefaults() {
136724
136511
  const settings = loadSettings();
@@ -136730,7 +136517,7 @@ function ensureNotificationDefaults() {
136730
136517
  ...settings,
136731
136518
  notifications: { ...notifications, soundOnNeedsAttention: true }
136732
136519
  });
136733
- log20.info("Set default notifications.soundOnNeedsAttention = true");
136520
+ log19.info("Set default notifications.soundOnNeedsAttention = true");
136734
136521
  }
136735
136522
  async function ensureClaudeHooks() {
136736
136523
  try {
@@ -136739,9 +136526,9 @@ async function ensureClaudeHooks() {
136739
136526
  return;
136740
136527
  }
136741
136528
  await installHooks();
136742
- log20.info("Installed Claude Code hooks");
136529
+ log19.info("Installed Claude Code hooks");
136743
136530
  } catch (err) {
136744
- log20.warn(
136531
+ log19.warn(
136745
136532
  "Failed to install Claude Code hooks: %s",
136746
136533
  err instanceof Error ? err.message : String(err)
136747
136534
  );
@@ -136749,11 +136536,11 @@ async function ensureClaudeHooks() {
136749
136536
  }
136750
136537
  async function ensureSkillsInstalled() {
136751
136538
  try {
136752
- const result = await installSkills({ log: log20 });
136539
+ const result = await installSkills({ log: log19 });
136753
136540
  const wrote = result.written.length + result.updated.length;
136754
136541
  const linkChange = result.linked.length;
136755
136542
  if (wrote > 0 || linkChange > 0 || result.conflicts.length > 0) {
136756
- log20.info(
136543
+ log19.info(
136757
136544
  "Synced CLI skills (shared: %d written, %d updated, %d unchanged; symlinks: %d created, %d already-linked, %d conflicts, %d skipped)",
136758
136545
  result.written.length,
136759
136546
  result.updated.length,
@@ -136765,14 +136552,14 @@ async function ensureSkillsInstalled() {
136765
136552
  );
136766
136553
  }
136767
136554
  } catch (err) {
136768
- log20.warn("Failed to sync CLI skills: %s", err instanceof Error ? err.message : String(err));
136555
+ log19.warn("Failed to sync CLI skills: %s", err instanceof Error ? err.message : String(err));
136769
136556
  }
136770
136557
  }
136771
136558
 
136772
136559
  // src/lib/terminal-manager.ts
136773
136560
  init_src();
136774
136561
  import { existsSync as existsSync6 } from "node:fs";
136775
- import { join as join22 } from "node:path";
136562
+ import { join as join21 } from "node:path";
136776
136563
 
136777
136564
  // src/lib/terminal-layout-manager.ts
136778
136565
  var manager3 = new DockviewLayoutManager("terminal_layout");
@@ -136799,7 +136586,7 @@ function removeTerminalFromLayout(workspaceId, terminalId) {
136799
136586
  }
136800
136587
 
136801
136588
  // src/lib/terminal-manager.ts
136802
- var log21 = createLogger("terminal");
136589
+ var log20 = createLogger("terminal");
136803
136590
  var MAX_SCROLLBACK_SIZE = 1e5;
136804
136591
  var terminals = /* @__PURE__ */ new Map();
136805
136592
  var workspaceTerminals = /* @__PURE__ */ new Map();
@@ -136828,13 +136615,13 @@ async function spawnTerminal(workspaceId, terminalId, options2) {
136828
136615
  const workspaceRoot = workspace.worktree.path;
136829
136616
  let cwd = workspaceRoot;
136830
136617
  if (options2?.cwd) {
136831
- const resolved = join22(workspaceRoot, options2.cwd);
136618
+ const resolved = join21(workspaceRoot, options2.cwd);
136832
136619
  if (!resolved.startsWith(workspaceRoot)) {
136833
- log21.warn("Ignoring cwd %s \u2014 resolves outside workspace root %s", options2.cwd, workspaceRoot);
136620
+ log20.warn("Ignoring cwd %s \u2014 resolves outside workspace root %s", options2.cwd, workspaceRoot);
136834
136621
  } else if (existsSync6(resolved)) {
136835
136622
  cwd = resolved;
136836
136623
  } else {
136837
- log21.warn("Ignoring cwd %s \u2014 directory does not exist", options2.cwd);
136624
+ log20.warn("Ignoring cwd %s \u2014 directory does not exist", options2.cwd);
136838
136625
  }
136839
136626
  }
136840
136627
  if (!existsSync6(cwd)) {
@@ -136843,7 +136630,7 @@ async function spawnTerminal(workspaceId, terminalId, options2) {
136843
136630
  if (!existsSync6(shell)) {
136844
136631
  throw new Error(`Shell not found: ${shell}`);
136845
136632
  }
136846
- log21.debug(
136633
+ log20.debug(
136847
136634
  "Spawning shell %s in %s for terminal %s (PATH=%s)",
136848
136635
  shell,
136849
136636
  cwd,
@@ -136862,7 +136649,7 @@ async function spawnTerminal(workspaceId, terminalId, options2) {
136862
136649
  });
136863
136650
  } catch (err) {
136864
136651
  const msg = err instanceof Error ? err.message : String(err);
136865
- log21.error("pty.spawn failed: %s (shell=%s, cwd=%s)", msg, shell, cwd);
136652
+ log20.error("pty.spawn failed: %s (shell=%s, cwd=%s)", msg, shell, cwd);
136866
136653
  throw err;
136867
136654
  }
136868
136655
  const session = { pty: ptyProcess, scrollback: "", workspaceId };
@@ -136898,7 +136685,7 @@ async function spawnTerminal(workspaceId, terminalId, options2) {
136898
136685
  }
136899
136686
  });
136900
136687
  ptyProcess.onExit(() => {
136901
- log21.debug("Terminal exited: %s (workspace %s)", terminalId, workspaceId);
136688
+ log20.debug("Terminal exited: %s (workspace %s)", terminalId, workspaceId);
136902
136689
  terminals.delete(terminalId);
136903
136690
  outputListeners.delete(terminalId);
136904
136691
  const set2 = workspaceTerminals.get(workspaceId);
@@ -137006,7 +136793,7 @@ function killAllTerminals() {
137006
136793
 
137007
136794
  // src/lib/terminal-ws.ts
137008
136795
  init_src();
137009
- var log22 = createLogger("terminal-ws");
136796
+ var log21 = createLogger("terminal-ws");
137010
136797
  async function handleTerminalConnection(ws, req) {
137011
136798
  const url2 = new URL(req.url, `http://${req.headers.host}`);
137012
136799
  const workspaceId = url2.searchParams.get("workspaceId");
@@ -137047,7 +136834,7 @@ async function handleTerminalConnection(ws, req) {
137047
136834
  session = await spawnTerminal(workspaceId, terminalId, spawnOpts);
137048
136835
  } catch (err) {
137049
136836
  const msg = err instanceof Error ? err.message : String(err);
137050
- log22.error("Failed to spawn terminal %s for workspace %s: %s", terminalId, workspaceId, msg);
136837
+ log21.error("Failed to spawn terminal %s for workspace %s: %s", terminalId, workspaceId, msg);
137051
136838
  ws.close(4001, msg);
137052
136839
  return;
137053
136840
  }
@@ -137061,7 +136848,7 @@ async function handleTerminalConnection(ws, req) {
137061
136848
  });
137062
136849
  }
137063
136850
  function attachSession(ws, terminalId, workspaceId, session, isNew) {
137064
- log22.debug(
136851
+ log21.debug(
137065
136852
  "Terminal %s: %s (workspace %s)",
137066
136853
  isNew ? "connected" : "reconnected",
137067
136854
  terminalId,
@@ -137090,7 +136877,7 @@ function attachSession(ws, terminalId, workspaceId, session, isNew) {
137090
136877
  }, 3e3);
137091
136878
  const exitDisposable = session.pty.onExit(({ exitCode }) => {
137092
136879
  clearInterval(processInterval);
137093
- log22.debug("PTY exited with code %d for terminal %s", exitCode, terminalId);
136880
+ log21.debug("PTY exited with code %d for terminal %s", exitCode, terminalId);
137094
136881
  if (ws.readyState === ws.OPEN) {
137095
136882
  ws.close(1e3, "Terminal exited");
137096
136883
  }
@@ -137102,7 +136889,7 @@ function attachSession(ws, terminalId, workspaceId, session, isNew) {
137102
136889
  clearInterval(processInterval);
137103
136890
  dataDisposable.dispose();
137104
136891
  exitDisposable.dispose();
137105
- log22.debug("Terminal disconnected: %s (PTY kept alive)", terminalId);
136892
+ log21.debug("Terminal disconnected: %s (PTY kept alive)", terminalId);
137106
136893
  });
137107
136894
  }
137108
136895
  function handleMessage(ws, terminalId, session, message) {
@@ -137140,7 +136927,7 @@ function getToken() {
137140
136927
  }
137141
136928
 
137142
136929
  // src/lib/tunnel.ts
137143
- var log23 = createLogger("tunnel");
136930
+ var log22 = createLogger("tunnel");
137144
136931
  var tunnelProcess = null;
137145
136932
  var tunnelUrl = null;
137146
136933
  var startInProgress = null;
@@ -137154,7 +136941,7 @@ function appendToken(baseUrl, token) {
137154
136941
  }
137155
136942
  function spawnTunnel(options2, resolvedPath) {
137156
136943
  const args = ["tunnel", "--config", "/dev/null", "--url", `http://localhost:${options2.port}`];
137157
- log23.debug("spawning cloudflared %s", args.join(" "));
136944
+ log22.debug("spawning cloudflared %s", args.join(" "));
137158
136945
  return new Promise((resolve8, reject) => {
137159
136946
  const child = spawn7("cloudflared", args, {
137160
136947
  env: { ...process.env, PATH: resolvedPath },
@@ -137168,12 +136955,12 @@ function spawnTunnel(options2, resolvedPath) {
137168
136955
  for (const line2 of text4.split("\n")) {
137169
136956
  const trimmed = line2.trim();
137170
136957
  if (!trimmed) continue;
137171
- log23.debug("output: %s", trimmed);
136958
+ log22.debug("output: %s", trimmed);
137172
136959
  const url2 = extractUrl(trimmed);
137173
136960
  if (url2) {
137174
136961
  const token = getToken();
137175
136962
  tunnelUrl = appendToken(url2, token);
137176
- log23.debug("detected URL: %s", tunnelUrl);
136963
+ log22.debug("detected URL: %s", tunnelUrl);
137177
136964
  emit({ kind: "tunnel-url", url: tunnelUrl });
137178
136965
  if (!settled) {
137179
136966
  settled = true;
@@ -137188,7 +136975,7 @@ function spawnTunnel(options2, resolvedPath) {
137188
136975
  handleOutput(data);
137189
136976
  });
137190
136977
  child.on("error", (err) => {
137191
- log23.debug("process error: %s", err.message);
136978
+ log22.debug("process error: %s", err.message);
137192
136979
  tunnelProcess = null;
137193
136980
  tunnelUrl = null;
137194
136981
  emit({ kind: "tunnel-error", error: err.message });
@@ -137198,7 +136985,7 @@ function spawnTunnel(options2, resolvedPath) {
137198
136985
  }
137199
136986
  });
137200
136987
  child.on("exit", (code) => {
137201
- log23.debug("process exited with code: %d", code ?? -1);
136988
+ log22.debug("process exited with code: %d", code ?? -1);
137202
136989
  const wasRunning = tunnelProcess !== null && settled;
137203
136990
  tunnelProcess = null;
137204
136991
  tunnelUrl = null;
@@ -137220,7 +137007,7 @@ function spawnTunnel(options2, resolvedPath) {
137220
137007
  });
137221
137008
  setTimeout(() => {
137222
137009
  if (!settled) {
137223
- log23.debug("30s timeout reached, resolving without URL");
137010
+ log22.debug("30s timeout reached, resolving without URL");
137224
137011
  settled = true;
137225
137012
  resolve8();
137226
137013
  }
@@ -137229,12 +137016,12 @@ function spawnTunnel(options2, resolvedPath) {
137229
137016
  }
137230
137017
  async function startTunnel(options2) {
137231
137018
  if (startInProgress) {
137232
- log23.debug("startTunnel: start already in progress, waiting...");
137019
+ log22.debug("startTunnel: start already in progress, waiting...");
137233
137020
  await startInProgress;
137234
137021
  return;
137235
137022
  }
137236
137023
  if (tunnelProcess) {
137237
- log23.debug("startTunnel: already running, re-emitting URL");
137024
+ log22.debug("startTunnel: already running, re-emitting URL");
137238
137025
  if (tunnelUrl) {
137239
137026
  emit({ kind: "tunnel-url", url: tunnelUrl });
137240
137027
  }
@@ -144158,13 +143945,14 @@ function createContext8() {
144158
143945
  }
144159
143946
 
144160
143947
  // src/trpc/router.ts
144161
- import { execFile as execFile5, execFileSync as execFileSync2 } from "node:child_process";
143948
+ import { execFile as execFile5, execFileSync as execFileSync2, spawn as spawn8 } from "node:child_process";
144162
143949
  import { randomUUID as randomUUID2 } from "node:crypto";
144163
- import { existsSync as existsSync7, mkdirSync as mkdirSync7, unlinkSync as unlinkSync3 } from "node:fs";
144164
- import { cp, mkdir as mkdir2, readdir as readdir2, readFile as readFile2, rename, rm, stat as stat4, writeFile as writeFile2 } from "node:fs/promises";
144165
- import { basename, dirname as dirname6, extname as extname2, join as join23, resolve as resolve6, sep as sep2 } from "node:path";
143950
+ import { existsSync as existsSync8, constants as fsConstants, mkdirSync as mkdirSync7, unlinkSync as unlinkSync3 } from "node:fs";
143951
+ import { cp, mkdir as mkdir2, open as open2, readdir as readdir2, readFile as readFile2, rename, rm, stat as stat4, writeFile as writeFile2 } from "node:fs/promises";
143952
+ import { basename as basename2, dirname as dirname7, extname as extname2, isAbsolute as isAbsolute2, join as join23, resolve as resolve6, sep as sep2 } from "node:path";
144166
143953
  import { promisify } from "node:util";
144167
143954
  init_src();
143955
+ import { rgPath } from "@vscode/ripgrep";
144168
143956
  init_zod();
144169
143957
 
144170
143958
  // src/lib/browser-history-store.ts
@@ -144264,7 +144052,7 @@ function clearHistory(workspaceId, range, now = Date.now()) {
144264
144052
 
144265
144053
  // src/lib/chat-session-summary.ts
144266
144054
  init_src();
144267
- var log24 = createLogger("chat-session-summary");
144055
+ var log23 = createLogger("chat-session-summary");
144268
144056
  var REFRESH_KEY = Symbol.for("band.chat-session-summary.refresh");
144269
144057
  var g15 = globalThis;
144270
144058
  if (!g15[REFRESH_KEY]) g15[REFRESH_KEY] = /* @__PURE__ */ new Map();
@@ -144294,7 +144082,7 @@ async function ensureActiveSessionSummary(chatId, worktreePath) {
144294
144082
  });
144295
144083
  return getChat(chatId);
144296
144084
  } catch (err) {
144297
- log24.warn({ chatId, err }, "ensureActiveSessionSummary failed");
144085
+ log23.warn({ chatId, err }, "ensureActiveSessionSummary failed");
144298
144086
  return chat;
144299
144087
  }
144300
144088
  }
@@ -144331,7 +144119,7 @@ async function doRefresh(chatId, worktreePath) {
144331
144119
  lastModified: latest.lastModified
144332
144120
  });
144333
144121
  } catch (err) {
144334
- log24.warn({ chatId, err }, "active session refresh failed");
144122
+ log23.warn({ chatId, err }, "active session refresh failed");
144335
144123
  }
144336
144124
  }
144337
144125
 
@@ -144639,6 +144427,103 @@ function subscribeToFileChanges(workspaceId, listener) {
144639
144427
  };
144640
144428
  }
144641
144429
 
144430
+ // src/lib/formatter.ts
144431
+ init_src();
144432
+ import { existsSync as existsSync7, realpathSync as realpathSync4 } from "node:fs";
144433
+ import { basename, dirname as dirname6, isAbsolute, join as join22, resolve as resolvePath } from "node:path";
144434
+ import prettier from "prettier";
144435
+ var log24 = createLogger("formatter");
144436
+ var FormatterError = class extends Error {
144437
+ code;
144438
+ detail;
144439
+ constructor(code, message, detail) {
144440
+ super(message);
144441
+ this.name = "FormatterError";
144442
+ this.code = code;
144443
+ this.detail = detail;
144444
+ }
144445
+ };
144446
+ async function formatFile(worktreePath, filePath, content2, options2 = {}) {
144447
+ const absFile = isAbsolute(filePath) ? filePath : resolvePath(worktreePath, filePath);
144448
+ if (!isInsideWorktree(absFile, worktreePath)) {
144449
+ throw new FormatterError(
144450
+ "FILE_NOT_IN_WORKTREE",
144451
+ `File ${absFile} is outside the worktree ${worktreePath}`
144452
+ );
144453
+ }
144454
+ const start = Date.now();
144455
+ prettier.clearConfigCache();
144456
+ const ignorePath = resolvePath(worktreePath, ".prettierignore");
144457
+ const info = await prettier.getFileInfo(absFile, {
144458
+ resolveConfig: true,
144459
+ ignorePath: existsSync7(ignorePath) ? ignorePath : void 0
144460
+ });
144461
+ if (info.ignored) {
144462
+ return {
144463
+ skipped: true,
144464
+ file: absFile,
144465
+ reason: `Ignored by .prettierignore`,
144466
+ durationMs: Date.now() - start
144467
+ };
144468
+ }
144469
+ if (info.inferredParser === null) {
144470
+ return {
144471
+ skipped: true,
144472
+ file: absFile,
144473
+ reason: `Prettier has no parser for ${absFile}`,
144474
+ durationMs: Date.now() - start
144475
+ };
144476
+ }
144477
+ const config2 = options2.configOverride !== void 0 ? options2.configOverride : await prettier.resolveConfig(absFile);
144478
+ let formatted;
144479
+ try {
144480
+ formatted = await prettier.format(content2, {
144481
+ ...config2 ?? {},
144482
+ filepath: absFile
144483
+ });
144484
+ } catch (err) {
144485
+ const message = err instanceof Error ? err.message : String(err);
144486
+ throw new FormatterError("PRETTIER_FAILED", message);
144487
+ }
144488
+ const changed = formatted !== content2;
144489
+ if (changed) {
144490
+ log24.info(
144491
+ "Formatted %s with parser=%s (%d bytes in)",
144492
+ absFile,
144493
+ info.inferredParser,
144494
+ content2.length
144495
+ );
144496
+ }
144497
+ return {
144498
+ skipped: false,
144499
+ file: absFile,
144500
+ parser: info.inferredParser,
144501
+ formatted,
144502
+ changed,
144503
+ durationMs: Date.now() - start
144504
+ };
144505
+ }
144506
+ function isInsideWorktree(absFile, worktreePath) {
144507
+ let realFile;
144508
+ try {
144509
+ realFile = realpathSync4(absFile);
144510
+ } catch {
144511
+ try {
144512
+ realFile = join22(realpathSync4(dirname6(absFile)), basename(absFile));
144513
+ } catch {
144514
+ realFile = absFile;
144515
+ }
144516
+ }
144517
+ let realWorktree;
144518
+ try {
144519
+ realWorktree = realpathSync4(worktreePath);
144520
+ } catch {
144521
+ realWorktree = worktreePath;
144522
+ }
144523
+ const normalized = realWorktree.endsWith("/") ? realWorktree : `${realWorktree}/`;
144524
+ return realFile === realWorktree || realFile.startsWith(normalized);
144525
+ }
144526
+
144642
144527
  // src/lib/fuzzy-score.ts
144643
144528
  var SCORE_MATCH = 1;
144644
144529
  var BONUS_CONSECUTIVE = 8;
@@ -144828,7 +144713,7 @@ var projectsRouter = t2.router({
144828
144713
  }),
144829
144714
  checkPath: publicProcedure.input(external_exports2.object({ path: external_exports2.string() })).query(({ input }) => {
144830
144715
  const resolvedPath = resolve6(input.path);
144831
- const isGitRepo = existsSync7(join23(resolvedPath, ".git"));
144716
+ const isGitRepo = existsSync8(join23(resolvedPath, ".git"));
144832
144717
  return { isGitRepo };
144833
144718
  }),
144834
144719
  gitInit: publicProcedure.input(external_exports2.object({ path: external_exports2.string() })).mutation(async ({ input }) => {
@@ -144837,7 +144722,7 @@ var projectsRouter = t2.router({
144837
144722
  }),
144838
144723
  add: publicProcedure.input(external_exports2.object({ path: external_exports2.string(), label: external_exports2.string().optional() })).mutation(async ({ input }) => {
144839
144724
  const state2 = loadState();
144840
- const name24 = basename(input.path);
144725
+ const name24 = basename2(input.path);
144841
144726
  if (state2.projects.some((p6) => p6.name === name24)) {
144842
144727
  throw new Error(`Project "${name24}" already registered`);
144843
144728
  }
@@ -145132,7 +145017,7 @@ var workspacesRouter = t2.router({
145132
145017
  }),
145133
145018
  runScript: publicProcedure.input(external_exports2.object({ path: external_exports2.string(), scriptType: external_exports2.string() })).mutation(({ input }) => {
145134
145019
  const scriptPath = join23(input.path, ".band", input.scriptType);
145135
- if (!existsSync7(scriptPath)) {
145020
+ if (!existsSync8(scriptPath)) {
145136
145021
  throw new Error(`Script "${input.scriptType}" not found`);
145137
145022
  }
145138
145023
  return new Promise((resolve8, reject) => {
@@ -145286,6 +145171,54 @@ var workspaceRouter = t2.router({
145286
145171
  const config2 = loadWorkspaceTerminalConfig(workspace.worktree.path, workspace.project.path);
145287
145172
  return { config: config2 };
145288
145173
  }),
145174
+ /**
145175
+ * Format the supplied `content` using Prettier as if it were the file at
145176
+ * `filePath` inside `workspaceId`. The procedure is pure — it does not
145177
+ * read or write the file on disk. The client passes in the live editor
145178
+ * buffer and applies the returned `formatted` string back to the editor.
145179
+ * Persistence is the caller's responsibility via `workspace.saveFile`.
145180
+ *
145181
+ * Returns `{ skipped: true, reason }` when Prettier has no parser for
145182
+ * the file's extension (or it's covered by `.prettierignore`). Editors
145183
+ * fire this off Cmd+Shift+F without checking the file type first, so a
145184
+ * soft skip is the right outcome for unsupported files rather than a
145185
+ * surfaced error.
145186
+ *
145187
+ * Auth: enforced at the transport layer (the `band_token` cookie gates
145188
+ * the WebSocket upgrade and HTTP requests in start-server.ts) — same
145189
+ * pattern as the rest of `workspaceRouter`.
145190
+ */
145191
+ formatFile: publicProcedure.input(
145192
+ external_exports2.object({
145193
+ workspaceId: external_exports2.string(),
145194
+ filePath: external_exports2.string().min(1),
145195
+ // 1 MB ceiling — covers every realistic source file (the largest
145196
+ // human-authored .ts in the world is well under 500 KB) and stops a
145197
+ // pathological caller from blocking the event loop with a multi-MB
145198
+ // string while Prettier churns on it.
145199
+ content: external_exports2.string().max(1e6)
145200
+ })
145201
+ ).mutation(async ({ input }) => {
145202
+ const workspace = resolveWorkspace(input.workspaceId);
145203
+ if (!workspace) {
145204
+ throw new TRPCError({
145205
+ code: "NOT_FOUND",
145206
+ message: `Workspace ${input.workspaceId} not found`
145207
+ });
145208
+ }
145209
+ try {
145210
+ return await formatFile(workspace.worktree.path, input.filePath, input.content);
145211
+ } catch (err) {
145212
+ if (err instanceof FormatterError) {
145213
+ throw new TRPCError({
145214
+ code: "BAD_REQUEST",
145215
+ message: err.message,
145216
+ cause: err
145217
+ });
145218
+ }
145219
+ throw err;
145220
+ }
145221
+ }),
145289
145222
  /**
145290
145223
  * Subscribe to external file-system changes inside a single workspace.
145291
145224
  * The watcher is started on demand for that workspace and torn down when
@@ -145787,11 +145720,11 @@ var workspaceRouter = t2.router({
145787
145720
  if (!target.startsWith(root) || target === root) {
145788
145721
  throw new Error("Invalid path");
145789
145722
  }
145790
- if (existsSync7(target)) {
145723
+ if (existsSync8(target)) {
145791
145724
  throw new Error("A file or directory already exists at this path");
145792
145725
  }
145793
- const parent = dirname6(target);
145794
- if (!existsSync7(parent)) {
145726
+ const parent = dirname7(target);
145727
+ if (!existsSync8(parent)) {
145795
145728
  throw new Error("Parent directory does not exist");
145796
145729
  }
145797
145730
  const parentStat = await stat4(parent);
@@ -145816,11 +145749,11 @@ var workspaceRouter = t2.router({
145816
145749
  if (!target.startsWith(root) || target === root) {
145817
145750
  throw new Error("Invalid path");
145818
145751
  }
145819
- if (existsSync7(target)) {
145752
+ if (existsSync8(target)) {
145820
145753
  throw new Error("A file or directory already exists at this path");
145821
145754
  }
145822
- const parent = dirname6(target);
145823
- if (!existsSync7(parent)) {
145755
+ const parent = dirname7(target);
145756
+ if (!existsSync8(parent)) {
145824
145757
  throw new Error("Parent directory does not exist");
145825
145758
  }
145826
145759
  const parentStat = await stat4(parent);
@@ -145895,11 +145828,11 @@ var workspaceRouter = t2.router({
145895
145828
  } catch {
145896
145829
  throw new Error("Source path does not exist");
145897
145830
  }
145898
- if (existsSync7(toTarget)) {
145831
+ if (existsSync8(toTarget)) {
145899
145832
  throw new Error("A file or directory already exists at the destination");
145900
145833
  }
145901
- const toParent = dirname6(toTarget);
145902
- if (!existsSync7(toParent)) {
145834
+ const toParent = dirname7(toTarget);
145835
+ if (!existsSync8(toParent)) {
145903
145836
  throw new Error("Destination parent directory does not exist");
145904
145837
  }
145905
145838
  const toParentStat = await stat4(toParent);
@@ -145949,11 +145882,11 @@ var workspaceRouter = t2.router({
145949
145882
  if (entryStat.isDirectory() && toTarget.startsWith(fromTarget + sep2)) {
145950
145883
  throw new Error("Cannot copy a directory into itself");
145951
145884
  }
145952
- if (existsSync7(toTarget)) {
145885
+ if (existsSync8(toTarget)) {
145953
145886
  throw new Error("A file or directory already exists at the destination");
145954
145887
  }
145955
- const toParent = dirname6(toTarget);
145956
- if (!existsSync7(toParent)) {
145888
+ const toParent = dirname7(toTarget);
145889
+ if (!existsSync8(toParent)) {
145957
145890
  throw new Error("Destination parent directory does not exist");
145958
145891
  }
145959
145892
  const toParentStat = await stat4(toParent);
@@ -146012,35 +145945,81 @@ var workspaceRouter = t2.router({
146012
145945
  throw new Error("Workspace not found");
146013
145946
  }
146014
145947
  const cwd = workspace.worktree.path;
146015
- const args = ["grep", "-n", "--no-color", "-I"];
146016
- if (input.regex) {
146017
- args.push("-E");
146018
- } else {
146019
- args.push("-F");
146020
- }
146021
- if (!input.caseSensitive) args.push("-i");
146022
- if (input.wholeWord) args.push("-w");
146023
- args.push("--", input.query);
146024
- let output;
146025
- try {
146026
- output = await execGit(args, cwd);
146027
- } catch {
146028
- return { results: [] };
146029
- }
146030
- const lines = output.trim().split("\n").filter(Boolean);
146031
- const results = [];
146032
- for (const raw of lines) {
146033
- if (results.length >= input.limit) break;
146034
- const colonIdx1 = raw.indexOf(":");
146035
- if (colonIdx1 === -1) continue;
146036
- const colonIdx2 = raw.indexOf(":", colonIdx1 + 1);
146037
- if (colonIdx2 === -1) continue;
146038
- const file2 = raw.slice(0, colonIdx1);
146039
- const line2 = Number.parseInt(raw.slice(colonIdx1 + 1, colonIdx2), 10);
146040
- const content2 = raw.slice(colonIdx2 + 1);
146041
- results.push({ file: file2, line: line2, content: content2 });
146042
- }
146043
- return { results };
145948
+ const args = [];
145949
+ if (!input.caseSensitive) args.push("--ignore-case");
145950
+ if (input.wholeWord) args.push("--word-regexp");
145951
+ if (!input.regex) args.push("--fixed-strings");
145952
+ args.push("--json");
145953
+ args.push("--", input.query, "./");
145954
+ return await new Promise((resolvePromise, rejectPromise) => {
145955
+ const results = [];
145956
+ const child = spawn8(rgPath, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
145957
+ let stdoutBuf = "";
145958
+ let stderrBuf = "";
145959
+ let settled = false;
145960
+ let killed = false;
145961
+ const finish = (value) => {
145962
+ if (settled) return;
145963
+ settled = true;
145964
+ resolvePromise({ results: value });
145965
+ };
145966
+ const fail = (err) => {
145967
+ if (settled) return;
145968
+ settled = true;
145969
+ rejectPromise(err);
145970
+ };
145971
+ child.stdout.setEncoding("utf-8");
145972
+ child.stdout.on("data", (chunk) => {
145973
+ if (settled) return;
145974
+ stdoutBuf += chunk;
145975
+ while (true) {
145976
+ const nlIdx = stdoutBuf.indexOf("\n");
145977
+ if (nlIdx === -1) break;
145978
+ const line2 = stdoutBuf.slice(0, nlIdx);
145979
+ stdoutBuf = stdoutBuf.slice(nlIdx + 1);
145980
+ if (!line2) continue;
145981
+ let event;
145982
+ try {
145983
+ event = JSON.parse(line2);
145984
+ } catch {
145985
+ continue;
145986
+ }
145987
+ if (event.type !== "match") continue;
145988
+ const data = event.data;
145989
+ if (!data) continue;
145990
+ const rawFile = data.path?.text;
145991
+ const lineNumber = data.line_number;
145992
+ const rawContent = data.lines?.text;
145993
+ if (!rawFile || typeof lineNumber !== "number" || rawContent === void 0) {
145994
+ continue;
145995
+ }
145996
+ const file2 = rawFile.startsWith("./") ? rawFile.slice(2) : rawFile;
145997
+ const content2 = rawContent.endsWith("\n") ? rawContent.slice(0, -1) : rawContent;
145998
+ results.push({ file: file2, line: lineNumber, content: content2 });
145999
+ if (results.length >= input.limit) {
146000
+ killed = true;
146001
+ child.kill("SIGTERM");
146002
+ finish(results);
146003
+ return;
146004
+ }
146005
+ }
146006
+ });
146007
+ child.stderr.setEncoding("utf-8");
146008
+ child.stderr.on("data", (chunk) => {
146009
+ stderrBuf += chunk;
146010
+ });
146011
+ child.on("error", (err) => {
146012
+ fail(err);
146013
+ });
146014
+ child.on("close", (code) => {
146015
+ if (settled) return;
146016
+ if (code === 0 || code === 1 || killed) {
146017
+ finish(results);
146018
+ } else {
146019
+ fail(new Error(`ripgrep exited with code ${code}: ${stderrBuf.trim()}`));
146020
+ }
146021
+ });
146022
+ });
146044
146023
  }),
146045
146024
  switchAgent: publicProcedure.input(
146046
146025
  external_exports2.object({
@@ -146066,6 +146045,95 @@ var workspaceRouter = t2.router({
146066
146045
  return { ok: true };
146067
146046
  })
146068
146047
  });
146048
+ function mapFsError(err) {
146049
+ const code = err.code;
146050
+ if (code === "ENOENT") return new Error("File not found");
146051
+ if (code === "ELOOP") return new Error("Symbolic links are not allowed");
146052
+ if (code === "EACCES" || code === "EPERM") return new Error("Permission denied");
146053
+ if (code === "EISDIR") return new Error("Cannot operate on a directory");
146054
+ return err;
146055
+ }
146056
+ var hostRouter = t2.router({
146057
+ readFile: publicProcedure.input(external_exports2.object({ absolutePath: external_exports2.string().min(1) })).query(async ({ input }) => {
146058
+ const target = input.absolutePath;
146059
+ if (!isAbsolute2(target)) {
146060
+ throw new Error("Absolute path required");
146061
+ }
146062
+ let fh;
146063
+ try {
146064
+ fh = await open2(target, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW);
146065
+ } catch (err) {
146066
+ throw mapFsError(err);
146067
+ }
146068
+ try {
146069
+ const stats = await fh.stat();
146070
+ if (stats.isDirectory()) {
146071
+ throw new Error("Cannot operate on a directory");
146072
+ }
146073
+ if (!stats.isFile()) {
146074
+ throw new Error("Not a regular file");
146075
+ }
146076
+ const size4 = stats.size;
146077
+ if (size4 > MAX_FILE_SIZE) {
146078
+ return { tooLarge: true, size: size4 };
146079
+ }
146080
+ const sampleLen = Math.min(8192, size4);
146081
+ const sample = Buffer.alloc(sampleLen);
146082
+ if (sampleLen > 0) {
146083
+ await fh.read(sample, 0, sampleLen, 0);
146084
+ if (sample.includes(0)) {
146085
+ return { binary: true, size: size4 };
146086
+ }
146087
+ }
146088
+ const buffer = await fh.readFile();
146089
+ const ext = extname2(target).toLowerCase();
146090
+ const language2 = LANG_MAP[ext];
146091
+ return {
146092
+ content: buffer.toString("utf-8"),
146093
+ size: size4,
146094
+ language: language2
146095
+ };
146096
+ } finally {
146097
+ await fh.close();
146098
+ }
146099
+ }),
146100
+ saveFile: publicProcedure.input(
146101
+ external_exports2.object({
146102
+ absolutePath: external_exports2.string().min(1),
146103
+ // Match the read-side cap so a misbehaving client can't fill
146104
+ // disk via the save endpoint while the read endpoint refuses
146105
+ // anything that wide.
146106
+ content: external_exports2.string().max(MAX_FILE_SIZE)
146107
+ })
146108
+ ).mutation(async ({ input }) => {
146109
+ const target = input.absolutePath;
146110
+ if (!isAbsolute2(target)) {
146111
+ throw new Error("Absolute path required");
146112
+ }
146113
+ let fh;
146114
+ try {
146115
+ fh = await open2(
146116
+ target,
146117
+ fsConstants.O_WRONLY | fsConstants.O_TRUNC | fsConstants.O_NOFOLLOW
146118
+ );
146119
+ } catch (err) {
146120
+ throw mapFsError(err);
146121
+ }
146122
+ try {
146123
+ const stats = await fh.stat();
146124
+ if (stats.isDirectory()) {
146125
+ throw new Error("Cannot operate on a directory");
146126
+ }
146127
+ if (!stats.isFile()) {
146128
+ throw new Error("Not a regular file");
146129
+ }
146130
+ await fh.writeFile(input.content, "utf-8");
146131
+ } finally {
146132
+ await fh.close();
146133
+ }
146134
+ return { ok: true };
146135
+ })
146136
+ });
146069
146137
  var tunnelRouter = t2.router({
146070
146138
  status: publicProcedure.query(() => {
146071
146139
  return getTunnelStatus();
@@ -147265,6 +147333,7 @@ var appRouter = t2.router({
147265
147333
  hooks: hooksRouter,
147266
147334
  cli: cliRouter,
147267
147335
  workspace: workspaceRouter,
147336
+ host: hostRouter,
147268
147337
  tunnel: tunnelRouter,
147269
147338
  prereqs: prereqsRouter,
147270
147339
  tasks: tasksRouter,
@@ -147440,7 +147509,7 @@ openApiDoc.servers = [{ url: "/trpc" }];
147440
147509
  var openApiSpec = JSON.stringify(openApiDoc, null, 2);
147441
147510
  var scalarHtml = getScalarHtml("/api/openapi.json");
147442
147511
  function serveStaticFile(res, root, subdir, rawFilename) {
147443
- const filename = basename2(decodeURIComponent(rawFilename));
147512
+ const filename = basename3(decodeURIComponent(rawFilename));
147444
147513
  if (!filename || filename.includes("..")) {
147445
147514
  res.writeHead(400);
147446
147515
  res.end("Bad request");
@@ -147477,7 +147546,7 @@ function serveWorkspaceFile(res, workspaceId, rawPath) {
147477
147546
  }
147478
147547
  try {
147479
147548
  const fileStat = statSync7(target);
147480
- const contentType = mimeTypeFromFilename(basename2(target));
147549
+ const contentType = mimeTypeFromFilename(basename3(target));
147481
147550
  res.writeHead(200, {
147482
147551
  "Content-Type": contentType,
147483
147552
  "Content-Length": fileStat.size.toString(),
@@ -147516,7 +147585,7 @@ async function main() {
147516
147585
  res.end("Bad request");
147517
147586
  return;
147518
147587
  }
147519
- const partition = basename2(decodeURIComponent(rest.slice(0, slashIdx)));
147588
+ const partition = basename3(decodeURIComponent(rest.slice(0, slashIdx)));
147520
147589
  if (!partition || partition === ".." || partition === ".") {
147521
147590
  res.writeHead(400);
147522
147591
  res.end("Bad request");