@namzu/cli 51.0.1 → 51.2.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 (451) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-OKCSCFH2.js → acp-HCVLUS7I.js} +125 -72
  4. package/dist/chunks/acp-HCVLUS7I.js.map +6 -0
  5. package/dist/chunks/{activity-command-SJGXPUYE.js → activity-command-I3OMRZ2T.js} +13 -13
  6. package/dist/chunks/{add-H4FUTHAQ.js → add-A65AU46H.js} +90 -24
  7. package/dist/chunks/add-A65AU46H.js.map +6 -0
  8. package/dist/chunks/{agent-U4YLYJ4N.js → agent-3A66KRCM.js} +40 -38
  9. package/dist/chunks/agent-session-LJZO5VIZ.js +71 -0
  10. package/dist/chunks/{archive-O236ZKWI.js → archive-IWWDLSAO.js} +11 -11
  11. package/dist/chunks/{bin-main-YS3HF46K.js → bin-main-CRX2U7A6.js} +9 -9
  12. package/dist/chunks/{binding-SS7YOEIZ.js → binding-4AMPOED7.js} +3 -3
  13. package/dist/chunks/{browser-OA2KB5Z2.js → browser-SAS7YPVD.js} +7 -7
  14. package/dist/chunks/{chat-EBNDAIRO.js → chat-ANHTX7D5.js} +16 -16
  15. package/dist/chunks/{chunk-F3QD24YN.js → chunk-2HB47MDS.js} +70 -41
  16. package/dist/chunks/chunk-2HB47MDS.js.map +6 -0
  17. package/dist/chunks/{chunk-YGLJBR4L.js → chunk-3D52GNVJ.js} +4 -4
  18. package/dist/chunks/{chunk-BPZQYXLI.js → chunk-3MJ3YKNV.js} +5 -5
  19. package/dist/chunks/chunk-3YM3IWPW.js +221 -0
  20. package/dist/chunks/chunk-3YM3IWPW.js.map +6 -0
  21. package/dist/chunks/{chunk-KN3FKKYY.js → chunk-45Z4OPC6.js} +3 -3
  22. package/dist/chunks/{chunk-MTY3SZOT.js → chunk-52YXYXRG.js} +2 -2
  23. package/dist/chunks/{chunk-XMYFIXCP.js → chunk-56ZS6OTK.js} +4 -4
  24. package/dist/chunks/{chunk-KUVGN7VF.js → chunk-57QGQNRI.js} +2 -2
  25. package/dist/chunks/{chunk-HXWIEKOB.js → chunk-5TPQGNYN.js} +4 -4
  26. package/dist/chunks/{chunk-WCMXLFUB.js → chunk-5U42MB6F.js} +10 -10
  27. package/dist/chunks/{chunk-LMLCGIQR.js → chunk-5YMIK3VP.js} +3 -3
  28. package/dist/chunks/{chunk-ZIUKLIUS.js → chunk-6CKU4TCF.js} +8 -3
  29. package/dist/chunks/chunk-6CKU4TCF.js.map +6 -0
  30. package/dist/chunks/{chunk-Y5D6542Z.js → chunk-6I4V7I5M.js} +2 -2
  31. package/dist/chunks/{chunk-R6ZDPAEV.js → chunk-6MI4Q5QQ.js} +4 -4
  32. package/dist/chunks/{chunk-JHLJJDNJ.js → chunk-6S4L4SAU.js} +7 -7
  33. package/dist/chunks/{chunk-UBOE47YI.js → chunk-AGC67H4M.js} +4 -4
  34. package/dist/chunks/{chunk-WD45OZPT.js → chunk-ALXE3SUZ.js} +3 -3
  35. package/dist/chunks/{chunk-4HGQJYDZ.js → chunk-ANVIYMV6.js} +3 -3
  36. package/dist/chunks/chunk-BBTPD3DU.js +19 -0
  37. package/dist/chunks/chunk-BBTPD3DU.js.map +6 -0
  38. package/dist/chunks/{chunk-HAIXGRRS.js → chunk-BC3IZXTY.js} +2 -2
  39. package/dist/chunks/{chunk-7J3IMJKF.js → chunk-BN32BPU6.js} +2 -2
  40. package/dist/chunks/chunk-BUP54TBX.js +214 -0
  41. package/dist/chunks/chunk-BUP54TBX.js.map +6 -0
  42. package/dist/chunks/chunk-CYCUJOAD.js +313 -0
  43. package/dist/chunks/chunk-CYCUJOAD.js.map +6 -0
  44. package/dist/chunks/{chunk-HDBTTV2S.js → chunk-DLVHJFXI.js} +2 -2
  45. package/dist/chunks/{chunk-CIHHPULI.js → chunk-DNOI4BL2.js} +2 -2
  46. package/dist/chunks/{chunk-PWNFXNFK.js → chunk-DOPHHI6C.js} +3 -65
  47. package/dist/chunks/chunk-DOPHHI6C.js.map +6 -0
  48. package/dist/chunks/{chunk-UNQYPFDZ.js → chunk-E5OETSRN.js} +6 -6
  49. package/dist/chunks/{chunk-YM5DH66D.js → chunk-E7IXVEOQ.js} +3 -3
  50. package/dist/chunks/{chunk-GUZEB3KN.js → chunk-FKQOGEKL.js} +3 -3
  51. package/dist/chunks/{chunk-JEEF7UIH.js → chunk-FLPT7I7I.js} +4 -4
  52. package/dist/chunks/{chunk-QY4UUQQT.js → chunk-FMAUDMYL.js} +12 -12
  53. package/dist/chunks/{chunk-TQG7WZI5.js → chunk-FSS72QJP.js} +2 -2
  54. package/dist/chunks/{chunk-YMWHDGCW.js → chunk-FTMONTUX.js} +3 -1
  55. package/dist/chunks/chunk-FTMONTUX.js.map +6 -0
  56. package/dist/chunks/chunk-G4N43E6M.js +62 -0
  57. package/dist/chunks/chunk-G4N43E6M.js.map +6 -0
  58. package/dist/chunks/{chunk-OLI35PTE.js → chunk-H56PLZHW.js} +2 -2
  59. package/dist/chunks/{chunk-2E3ALKOF.js → chunk-HHLWXGOG.js} +3 -3
  60. package/dist/chunks/{chunk-VVMRXGQ6.js → chunk-HQ4WFN7B.js} +4649 -2177
  61. package/dist/chunks/chunk-HQ4WFN7B.js.map +6 -0
  62. package/dist/chunks/{chunk-P52PAWBP.js → chunk-HXPRWMLH.js} +4 -4
  63. package/dist/chunks/{tui-L4BRR4H5.js → chunk-ILPXZDTW.js} +699 -1390
  64. package/dist/chunks/chunk-ILPXZDTW.js.map +6 -0
  65. package/dist/chunks/{chunk-FA2ZVSEU.js → chunk-IPTWZUSV.js} +2 -2
  66. package/dist/chunks/{chunk-LLR7GHVU.js → chunk-ITY5SBAS.js} +2 -2
  67. package/dist/chunks/{chunk-TXP6SOA7.js → chunk-JR6EFL7G.js} +5 -4
  68. package/dist/chunks/chunk-JR6EFL7G.js.map +6 -0
  69. package/dist/chunks/{chunk-JVIS6M37.js → chunk-JUN4VUC6.js} +64 -224
  70. package/dist/chunks/chunk-JUN4VUC6.js.map +6 -0
  71. package/dist/chunks/{chunk-22PMPEFX.js → chunk-K52DES57.js} +3 -3
  72. package/dist/chunks/chunk-KD6WL3W7.js +10 -0
  73. package/dist/chunks/chunk-KD6WL3W7.js.map +6 -0
  74. package/dist/chunks/{chunk-BK5AJ7TL.js → chunk-KJ7Q3BC3.js} +2 -2
  75. package/dist/chunks/{chunk-F7ECNFNX.js → chunk-KJVRHBMX.js} +9 -4
  76. package/dist/chunks/chunk-KJVRHBMX.js.map +6 -0
  77. package/dist/chunks/{chunk-MV2T5HFQ.js → chunk-KZHMLRKY.js} +4 -4
  78. package/dist/chunks/{chunk-FSPBJ5VF.js → chunk-LAXSPXNP.js} +4 -3
  79. package/dist/chunks/{chunk-FSPBJ5VF.js.map → chunk-LAXSPXNP.js.map} +1 -1
  80. package/dist/chunks/{chunk-D3ITBQ7T.js → chunk-LGH2T6KL.js} +2 -2
  81. package/dist/chunks/{chunk-3XIWMQLP.js → chunk-LQJ3TB5E.js} +10 -10
  82. package/dist/chunks/{chunk-6GITBOHO.js → chunk-LYPEV765.js} +2 -2
  83. package/dist/chunks/chunk-LYUY2FK2.js +141 -0
  84. package/dist/chunks/chunk-LYUY2FK2.js.map +6 -0
  85. package/dist/chunks/{chunk-O53H43CX.js → chunk-M44I7P3H.js} +2 -2
  86. package/dist/chunks/{chunk-MOGE5ZMI.js → chunk-NAWIOVUH.js} +3 -3
  87. package/dist/chunks/{chunk-ZNC5BEFK.js → chunk-NGE7TNCY.js} +2 -2
  88. package/dist/chunks/{chunk-AJHNH4WR.js → chunk-NXJQTDVT.js} +121 -90
  89. package/dist/chunks/chunk-NXJQTDVT.js.map +6 -0
  90. package/dist/chunks/{chunk-NWIOFCDB.js → chunk-NY3I4WL7.js} +217 -372
  91. package/dist/chunks/chunk-NY3I4WL7.js.map +6 -0
  92. package/dist/chunks/{chunk-JABCT4RQ.js → chunk-OEKCCZ7I.js} +5 -5
  93. package/dist/chunks/{chunk-HFY2647W.js → chunk-OG2MLME3.js} +2 -1
  94. package/dist/chunks/{chunk-HFY2647W.js.map → chunk-OG2MLME3.js.map} +1 -1
  95. package/dist/chunks/{chunk-DWFJETFP.js → chunk-OL5SKFPM.js} +4 -4
  96. package/dist/chunks/{chunk-V4WSIY32.js → chunk-OMP25UWR.js} +6 -2
  97. package/dist/chunks/chunk-OMP25UWR.js.map +6 -0
  98. package/dist/chunks/{chunk-VLE4DKQR.js → chunk-P53E77KS.js} +3 -3
  99. package/dist/chunks/{chunk-PV4TEEGI.js → chunk-PI6KC5CD.js} +5 -5
  100. package/dist/chunks/{chunk-O62YM5KA.js → chunk-Q5DW33F4.js} +2 -2
  101. package/dist/chunks/{chunk-V5DDXBVW.js → chunk-QS65X7D6.js} +4 -4
  102. package/dist/chunks/{chunk-P5OZ7YN6.js → chunk-QZ4V25KD.js} +8 -3
  103. package/dist/chunks/chunk-QZ4V25KD.js.map +6 -0
  104. package/dist/chunks/chunk-RCLTSI6G.js +102 -0
  105. package/dist/chunks/chunk-RCLTSI6G.js.map +6 -0
  106. package/dist/chunks/{chunk-WEUXBFYG.js → chunk-RDWVNVZS.js} +51 -93
  107. package/dist/chunks/chunk-RDWVNVZS.js.map +6 -0
  108. package/dist/chunks/{chunk-PKGMZRUT.js → chunk-SMX5YHRV.js} +2 -2
  109. package/dist/chunks/{chunk-R6P5H47N.js → chunk-SQWFNFEX.js} +3 -3
  110. package/dist/chunks/{chunk-RTDE5QSZ.js → chunk-SR75L2R5.js} +4 -4
  111. package/dist/chunks/{chunk-FUVWMCRY.js → chunk-T5X3GYBF.js} +2 -2
  112. package/dist/chunks/{chunk-YY6RFZ2L.js → chunk-TJSGSC2W.js} +9 -9
  113. package/dist/chunks/{chunk-O7J6EFVD.js → chunk-TTXZK3BR.js} +3 -3
  114. package/dist/chunks/{chunk-77RA2AU7.js → chunk-U7AQ4OQJ.js} +4 -3
  115. package/dist/chunks/{chunk-635U2FDK.js → chunk-UPSI724V.js} +3 -3
  116. package/dist/chunks/{chunk-56SPZGFT.js → chunk-V23HHK5D.js} +3 -3
  117. package/dist/chunks/{chunk-C5P7OAML.js → chunk-VQHVH7X2.js} +3 -3
  118. package/dist/chunks/{chunk-HARFWJBQ.js → chunk-WJ4YRFPQ.js} +2 -2
  119. package/dist/chunks/{chunk-DFFTGAS7.js → chunk-WJXVNXJZ.js} +22 -22
  120. package/dist/chunks/{chunk-PR2EE4G4.js → chunk-WOX4KI7C.js} +3 -3
  121. package/dist/chunks/{chunk-CDDXHKSP.js → chunk-X3L6N5RM.js} +36 -11
  122. package/dist/chunks/{chunk-CDDXHKSP.js.map → chunk-X3L6N5RM.js.map} +1 -1
  123. package/dist/chunks/{chunk-ONVXBWB5.js → chunk-XFMGW2C5.js} +2 -2
  124. package/dist/chunks/{chunk-RTFC2VXR.js → chunk-XPCRLKFO.js} +7 -6
  125. package/dist/chunks/{chunk-MEZUNP2E.js → chunk-XYT53O3Z.js} +2 -2
  126. package/dist/chunks/{chunk-EB7AS2K4.js → chunk-YSV633T5.js} +10 -10
  127. package/dist/chunks/{chunk-PN2UBL2H.js → chunk-ZXFEHB7N.js} +2 -2
  128. package/dist/chunks/{cli-runtime-5GEVVA3K.js → cli-runtime-5UE6P2QW.js} +20 -17
  129. package/dist/chunks/cli-runtime-5UE6P2QW.js.map +6 -0
  130. package/dist/chunks/{commands-Y37MKMRJ.js → commands-IOHIM2PX.js} +6 -6
  131. package/dist/chunks/{computer-UE2AN7NW.js → computer-ZWTWBY67.js} +2 -2
  132. package/dist/chunks/cost-MYSYQTT3.js +755 -0
  133. package/dist/chunks/cost-MYSYQTT3.js.map +6 -0
  134. package/dist/chunks/{crash-report-S6W5DXCO.js → crash-report-WLLGI2U4.js} +6 -6
  135. package/dist/chunks/day-CU5J7UAK.js +22 -0
  136. package/dist/chunks/{dist-YO357DAD.js → dist-33QU2MGT.js} +2 -2
  137. package/dist/chunks/{dist-5E47CZZT.js → dist-6G55RC27.js} +2 -2
  138. package/dist/chunks/{dist-HCI4L6AO.js → dist-CFPNJCLJ.js} +2 -2
  139. package/dist/chunks/{dist-3FVIUYVA.js → dist-E2PF4PGO.js} +2 -2
  140. package/dist/chunks/{dist-4ATGJMUC.js → dist-FZYKXUR4.js} +2 -2
  141. package/dist/chunks/{dist-2RVY7QOH.js → dist-IXAUMLZH.js} +2 -2
  142. package/dist/chunks/{dist-DODOSCTW.js → dist-MBVPANQB.js} +106 -2
  143. package/dist/chunks/{dist-IPQPISKD.js → dist-PKKDBDSA.js} +2 -2
  144. package/dist/chunks/{doctor-EZEJEK6B.js → doctor-BXRPVVKL.js} +20 -20
  145. package/dist/chunks/{drain-VVEMLN3L.js → drain-EWKGL77B.js} +10 -10
  146. package/dist/chunks/{entry-CZ63UJYN.js → entry-XPXHELKT.js} +6 -6
  147. package/dist/chunks/eval-OLNNJGUO.js +351 -0
  148. package/dist/chunks/eval-OLNNJGUO.js.map +6 -0
  149. package/dist/chunks/{exec-DYAFXHZM.js → exec-XNMHHHTZ.js} +81 -53
  150. package/dist/chunks/exec-XNMHHHTZ.js.map +6 -0
  151. package/dist/chunks/{github-VCUDZDGI.js → github-FQAXV2KP.js} +2 -2
  152. package/dist/chunks/{home-UVU2HRDB.js → home-T4ZVXIEX.js} +3 -3
  153. package/dist/chunks/{host-Q3YNLTNL.js → host-LQ6V4NJS.js} +10 -10
  154. package/dist/chunks/{host-queries-Z4BSL457.js → host-queries-LEPTBKZK.js} +15 -15
  155. package/dist/chunks/{learn-SAZ3JOK3.js → learn-WOZKPYR4.js} +12 -12
  156. package/dist/chunks/{learn-builtin-SQ2BTDFH.js → learn-builtin-BVJFZF4R.js} +15 -15
  157. package/dist/chunks/{lifecycle-24A5HH4I.js → lifecycle-KKIDSRJV.js} +34 -33
  158. package/dist/chunks/{list-HAI55KLQ.js → list-ZWIXNGJV.js} +27 -17
  159. package/dist/chunks/list-ZWIXNGJV.js.map +6 -0
  160. package/dist/chunks/{live-EIQ666TU.js → live-4GQNVGPU.js} +18 -18
  161. package/dist/chunks/{login-YJ6L7KSY.js → login-MBXPJW6F.js} +14 -14
  162. package/dist/chunks/{logs-RWGXFRMN.js → logs-7GVMBYAQ.js} +6 -6
  163. package/dist/chunks/{mcp-DO454555.js → mcp-45UUEZMF.js} +24 -24
  164. package/dist/chunks/{message-command-AJOTC3UK.js → message-command-YVAI3SLS.js} +48 -46
  165. package/dist/chunks/message-command-YVAI3SLS.js.map +6 -0
  166. package/dist/chunks/{open-LEAR5UBX.js → open-UG6VAHDW.js} +8 -8
  167. package/dist/chunks/{operator-tools-AHP32F2J.js → operator-tools-M4SMIAYS.js} +13 -13
  168. package/dist/chunks/{output-schema-YDKTNTMM.js → output-schema-MZ6X4WQ2.js} +3 -3
  169. package/dist/chunks/{pal-XPZD6PAO.js → pal-R4RSZP2U.js} +17 -17
  170. package/dist/chunks/{peers-MRKWY3MG.js → peers-6TIMGPGR.js} +8 -8
  171. package/dist/chunks/{peers-NLUBD4IW.js → peers-T5SXNFYU.js} +6 -6
  172. package/dist/chunks/plugin-SAQJPDKX.js +1043 -0
  173. package/dist/chunks/plugin-SAQJPDKX.js.map +6 -0
  174. package/dist/chunks/{providers-QPESWN6K.js → providers-CPHEQZCV.js} +11 -11
  175. package/dist/chunks/{pty-BDOOEOCB.js → pty-YAFV4ZA6.js} +3 -3
  176. package/dist/chunks/render-QFCCPEEL.js +14 -0
  177. package/dist/chunks/resume-GZGHY4UR.js +23 -0
  178. package/dist/chunks/{resume-command-KIXKOEM3.js → resume-command-WJH7SKYB.js} +5 -5
  179. package/dist/chunks/{schedule-6BKCRYAT.js → schedule-I7ZNWSN3.js} +15 -10
  180. package/dist/chunks/schedule-I7ZNWSN3.js.map +6 -0
  181. package/dist/chunks/{service-ENTDZAVD.js → service-ZRXXXJW7.js} +34 -33
  182. package/dist/chunks/service-ZRXXXJW7.js.map +6 -0
  183. package/dist/chunks/{skills-MG2BRTPV.js → skills-RIJBOCKN.js} +9 -9
  184. package/dist/chunks/{start-check-7WYNSBON.js → start-check-5DQL76YU.js} +2 -2
  185. package/dist/chunks/{startup-failure-EWWYKPVE.js → startup-failure-7KMOAOXE.js} +2 -2
  186. package/dist/chunks/{state-6UVY4EHA.js → state-QNSG3QWY.js} +3 -3
  187. package/dist/chunks/{store-OKK7A6ZE.js → store-7NXFZTW7.js} +6 -6
  188. package/dist/chunks/{store-UFUDXZG6.js → store-IDSNTJRG.js} +10 -10
  189. package/dist/chunks/{store-ASWK7TVD.js → store-NE2I4H7E.js} +3 -3
  190. package/dist/chunks/store-NE2I4H7E.js.map +6 -0
  191. package/dist/chunks/{store-XU4PITDA.js → store-TY2ZO2EP.js} +4 -4
  192. package/dist/chunks/store-TY2ZO2EP.js.map +6 -0
  193. package/dist/chunks/tui-DLUH6HQ4.js +1034 -0
  194. package/dist/chunks/tui-DLUH6HQ4.js.map +6 -0
  195. package/dist/chunks/{upgrade-IJFMAW3T.js → upgrade-UZTPAIDF.js} +8 -8
  196. package/dist/chunks/watch-AAZHSSIE.js +982 -0
  197. package/dist/chunks/watch-AAZHSSIE.js.map +6 -0
  198. package/dist/chunks/{workspaces-KVFY66IC.js → workspaces-KLYC5537.js} +16 -16
  199. package/dist/chunks/{worktree-7JTMEYRX.js → worktree-4PKAJ7LT.js} +13 -13
  200. package/dist/cli.d.ts.map +1 -1
  201. package/dist/commands/acp.d.ts +20 -1
  202. package/dist/commands/acp.d.ts.map +1 -1
  203. package/dist/commands/cost.d.ts +26 -0
  204. package/dist/commands/cost.d.ts.map +1 -0
  205. package/dist/commands/desktop-host.d.ts.map +1 -1
  206. package/dist/commands/eval.d.ts.map +1 -1
  207. package/dist/commands/exec-flags.d.ts +2 -0
  208. package/dist/commands/exec-flags.d.ts.map +1 -1
  209. package/dist/commands/exec-json.d.ts.map +1 -1
  210. package/dist/commands/exec.d.ts.map +1 -1
  211. package/dist/commands/manifest.d.ts +3 -0
  212. package/dist/commands/manifest.d.ts.map +1 -1
  213. package/dist/commands/plugin.d.ts +18 -0
  214. package/dist/commands/plugin.d.ts.map +1 -0
  215. package/dist/commands/schedule.d.ts.map +1 -1
  216. package/dist/commands/watch.d.ts +41 -0
  217. package/dist/commands/watch.d.ts.map +1 -0
  218. package/dist/config/load.d.ts.map +1 -1
  219. package/dist/config/schema.d.ts +25 -0
  220. package/dist/config/schema.d.ts.map +1 -1
  221. package/dist/config/settings-descriptors.d.ts.map +1 -1
  222. package/dist/config/turn-guards.d.ts +5 -2
  223. package/dist/config/turn-guards.d.ts.map +1 -1
  224. package/dist/desktop-contract.d.ts +21 -0
  225. package/dist/desktop-contract.d.ts.map +1 -0
  226. package/dist/exit-codes.d.ts +9 -1
  227. package/dist/exit-codes.d.ts.map +1 -1
  228. package/dist/index.d.ts +1 -0
  229. package/dist/index.d.ts.map +1 -1
  230. package/dist/index.js +37 -33
  231. package/dist/integrations/auto-update/install-kind.d.ts.map +1 -1
  232. package/dist/integrations/plugins/check-hint.d.ts +5 -0
  233. package/dist/integrations/plugins/check-hint.d.ts.map +1 -0
  234. package/dist/integrations/plugins/files.d.ts +17 -0
  235. package/dist/integrations/plugins/files.d.ts.map +1 -1
  236. package/dist/integrations/plugins/validate.d.ts +75 -0
  237. package/dist/integrations/plugins/validate.d.ts.map +1 -0
  238. package/dist/integrations/sessions/session-watch.d.ts +127 -0
  239. package/dist/integrations/sessions/session-watch.d.ts.map +1 -0
  240. package/dist/integrations/sessions/watch-view.d.ts +73 -0
  241. package/dist/integrations/sessions/watch-view.d.ts.map +1 -0
  242. package/dist/integrations/sessions/watch-wait.d.ts +32 -0
  243. package/dist/integrations/sessions/watch-wait.d.ts.map +1 -0
  244. package/dist/integrations/spend/day.d.ts +26 -0
  245. package/dist/integrations/spend/day.d.ts.map +1 -0
  246. package/dist/integrations/spend/fold.d.ts +136 -0
  247. package/dist/integrations/spend/fold.d.ts.map +1 -0
  248. package/dist/integrations/spend/ledger.d.ts +74 -0
  249. package/dist/integrations/spend/ledger.d.ts.map +1 -0
  250. package/dist/integrations/spend/render.d.ts +6 -0
  251. package/dist/integrations/spend/render.d.ts.map +1 -0
  252. package/dist/integrations/spend/report.d.ts +110 -0
  253. package/dist/integrations/spend/report.d.ts.map +1 -0
  254. package/dist/integrations/telemetry/otlp-export.d.ts +3 -0
  255. package/dist/integrations/telemetry/otlp-export.d.ts.map +1 -1
  256. package/dist/schedule/build.d.ts +12 -0
  257. package/dist/schedule/build.d.ts.map +1 -1
  258. package/dist/schedule/changes.d.ts.map +1 -1
  259. package/dist/schedule/commands/add.d.ts +1 -1
  260. package/dist/schedule/commands/add.d.ts.map +1 -1
  261. package/dist/schedule/commands/list.d.ts +2 -0
  262. package/dist/schedule/commands/list.d.ts.map +1 -1
  263. package/dist/schedule/daemon/daemon.d.ts.map +1 -1
  264. package/dist/schedule/daemon/notify.d.ts +7 -2
  265. package/dist/schedule/daemon/notify.d.ts.map +1 -1
  266. package/dist/schedule/delivery.d.ts.map +1 -1
  267. package/dist/schedule/fire/calls.d.ts +2 -0
  268. package/dist/schedule/fire/calls.d.ts.map +1 -1
  269. package/dist/schedule/fire/fire.d.ts +3 -0
  270. package/dist/schedule/fire/fire.d.ts.map +1 -1
  271. package/dist/schedule/fire/run-script.d.ts +4 -0
  272. package/dist/schedule/fire/run-script.d.ts.map +1 -1
  273. package/dist/schedule/fire/unattended-note.d.ts +5 -0
  274. package/dist/schedule/fire/unattended-note.d.ts.map +1 -1
  275. package/dist/schedule/gate.d.ts +73 -0
  276. package/dist/schedule/gate.d.ts.map +1 -0
  277. package/dist/schedule/store/jobs.d.ts +2 -2
  278. package/dist/schedule/store/jobs.d.ts.map +1 -1
  279. package/dist/schedule/types.d.ts +60 -1
  280. package/dist/schedule/types.d.ts.map +1 -1
  281. package/dist/tui/App.d.ts.map +1 -1
  282. package/dist/tui/Markdown.d.ts +5 -1
  283. package/dist/tui/Markdown.d.ts.map +1 -1
  284. package/dist/tui/ScheduleReviewOverlay.d.ts.map +1 -1
  285. package/dist/tui/agent.d.ts +14 -1
  286. package/dist/tui/agent.d.ts.map +1 -1
  287. package/dist/tui/fullscreen/markdown-rows.d.ts.map +1 -1
  288. package/dist/tui/markdown-structure.d.ts +24 -0
  289. package/dist/tui/markdown-structure.d.ts.map +1 -0
  290. package/dist/tui/markdownParser.d.ts +11 -0
  291. package/dist/tui/markdownParser.d.ts.map +1 -1
  292. package/dist/tui/outcome-line.d.ts +29 -1
  293. package/dist/tui/outcome-line.d.ts.map +1 -1
  294. package/dist/tui/restored-rows.d.ts +8 -1
  295. package/dist/tui/restored-rows.d.ts.map +1 -1
  296. package/dist/tui/schedule/host-commands.d.ts.map +1 -1
  297. package/dist/tui/schedule/source-deliveries.d.ts.map +1 -1
  298. package/dist/tui/schedule/tool-host.d.ts.map +1 -1
  299. package/dist/tui/slashCommands.d.ts +5 -0
  300. package/dist/tui/slashCommands.d.ts.map +1 -1
  301. package/dist/tui/tool-end-rows.d.ts +1 -1
  302. package/dist/tui/tool-end-rows.d.ts.map +1 -1
  303. package/dist/tui/types.d.ts +5 -1
  304. package/dist/tui/types.d.ts.map +1 -1
  305. package/dist/user-commands/store.d.ts +14 -0
  306. package/dist/user-commands/store.d.ts.map +1 -1
  307. package/package.json +5 -5
  308. package/skills/schedule-task/SKILL.md +8 -0
  309. package/dist/chunks/acp-OKCSCFH2.js.map +0 -6
  310. package/dist/chunks/add-H4FUTHAQ.js.map +0 -6
  311. package/dist/chunks/agent-session-YNUAPMAL.js +0 -69
  312. package/dist/chunks/chunk-AJHNH4WR.js.map +0 -6
  313. package/dist/chunks/chunk-F3QD24YN.js.map +0 -6
  314. package/dist/chunks/chunk-F7ECNFNX.js.map +0 -6
  315. package/dist/chunks/chunk-JVIS6M37.js.map +0 -6
  316. package/dist/chunks/chunk-NWIOFCDB.js.map +0 -6
  317. package/dist/chunks/chunk-P5OZ7YN6.js.map +0 -6
  318. package/dist/chunks/chunk-PWNFXNFK.js.map +0 -6
  319. package/dist/chunks/chunk-TXP6SOA7.js.map +0 -6
  320. package/dist/chunks/chunk-V4WSIY32.js.map +0 -6
  321. package/dist/chunks/chunk-VVMRXGQ6.js.map +0 -6
  322. package/dist/chunks/chunk-WEUXBFYG.js.map +0 -6
  323. package/dist/chunks/chunk-YMWHDGCW.js.map +0 -6
  324. package/dist/chunks/chunk-ZIUKLIUS.js.map +0 -6
  325. package/dist/chunks/cli-runtime-5GEVVA3K.js.map +0 -6
  326. package/dist/chunks/eval-ZOF3EXZS.js +0 -187
  327. package/dist/chunks/eval-ZOF3EXZS.js.map +0 -6
  328. package/dist/chunks/exec-DYAFXHZM.js.map +0 -6
  329. package/dist/chunks/list-HAI55KLQ.js.map +0 -6
  330. package/dist/chunks/message-command-AJOTC3UK.js.map +0 -6
  331. package/dist/chunks/resume-ZS3VS5OQ.js +0 -23
  332. package/dist/chunks/schedule-6BKCRYAT.js.map +0 -6
  333. package/dist/chunks/service-ENTDZAVD.js.map +0 -6
  334. package/dist/chunks/tui-L4BRR4H5.js.map +0 -6
  335. /package/dist/chunks/{activity-command-SJGXPUYE.js.map → activity-command-I3OMRZ2T.js.map} +0 -0
  336. /package/dist/chunks/{agent-U4YLYJ4N.js.map → agent-3A66KRCM.js.map} +0 -0
  337. /package/dist/chunks/{agent-session-YNUAPMAL.js.map → agent-session-LJZO5VIZ.js.map} +0 -0
  338. /package/dist/chunks/{archive-O236ZKWI.js.map → archive-IWWDLSAO.js.map} +0 -0
  339. /package/dist/chunks/{bin-main-YS3HF46K.js.map → bin-main-CRX2U7A6.js.map} +0 -0
  340. /package/dist/chunks/{binding-SS7YOEIZ.js.map → binding-4AMPOED7.js.map} +0 -0
  341. /package/dist/chunks/{browser-OA2KB5Z2.js.map → browser-SAS7YPVD.js.map} +0 -0
  342. /package/dist/chunks/{chat-EBNDAIRO.js.map → chat-ANHTX7D5.js.map} +0 -0
  343. /package/dist/chunks/{chunk-YGLJBR4L.js.map → chunk-3D52GNVJ.js.map} +0 -0
  344. /package/dist/chunks/{chunk-BPZQYXLI.js.map → chunk-3MJ3YKNV.js.map} +0 -0
  345. /package/dist/chunks/{chunk-KN3FKKYY.js.map → chunk-45Z4OPC6.js.map} +0 -0
  346. /package/dist/chunks/{chunk-MTY3SZOT.js.map → chunk-52YXYXRG.js.map} +0 -0
  347. /package/dist/chunks/{chunk-XMYFIXCP.js.map → chunk-56ZS6OTK.js.map} +0 -0
  348. /package/dist/chunks/{chunk-KUVGN7VF.js.map → chunk-57QGQNRI.js.map} +0 -0
  349. /package/dist/chunks/{chunk-HXWIEKOB.js.map → chunk-5TPQGNYN.js.map} +0 -0
  350. /package/dist/chunks/{chunk-WCMXLFUB.js.map → chunk-5U42MB6F.js.map} +0 -0
  351. /package/dist/chunks/{chunk-LMLCGIQR.js.map → chunk-5YMIK3VP.js.map} +0 -0
  352. /package/dist/chunks/{chunk-Y5D6542Z.js.map → chunk-6I4V7I5M.js.map} +0 -0
  353. /package/dist/chunks/{chunk-R6ZDPAEV.js.map → chunk-6MI4Q5QQ.js.map} +0 -0
  354. /package/dist/chunks/{chunk-JHLJJDNJ.js.map → chunk-6S4L4SAU.js.map} +0 -0
  355. /package/dist/chunks/{chunk-UBOE47YI.js.map → chunk-AGC67H4M.js.map} +0 -0
  356. /package/dist/chunks/{chunk-WD45OZPT.js.map → chunk-ALXE3SUZ.js.map} +0 -0
  357. /package/dist/chunks/{chunk-4HGQJYDZ.js.map → chunk-ANVIYMV6.js.map} +0 -0
  358. /package/dist/chunks/{chunk-HAIXGRRS.js.map → chunk-BC3IZXTY.js.map} +0 -0
  359. /package/dist/chunks/{chunk-7J3IMJKF.js.map → chunk-BN32BPU6.js.map} +0 -0
  360. /package/dist/chunks/{chunk-HDBTTV2S.js.map → chunk-DLVHJFXI.js.map} +0 -0
  361. /package/dist/chunks/{chunk-CIHHPULI.js.map → chunk-DNOI4BL2.js.map} +0 -0
  362. /package/dist/chunks/{chunk-UNQYPFDZ.js.map → chunk-E5OETSRN.js.map} +0 -0
  363. /package/dist/chunks/{chunk-YM5DH66D.js.map → chunk-E7IXVEOQ.js.map} +0 -0
  364. /package/dist/chunks/{chunk-GUZEB3KN.js.map → chunk-FKQOGEKL.js.map} +0 -0
  365. /package/dist/chunks/{chunk-JEEF7UIH.js.map → chunk-FLPT7I7I.js.map} +0 -0
  366. /package/dist/chunks/{chunk-QY4UUQQT.js.map → chunk-FMAUDMYL.js.map} +0 -0
  367. /package/dist/chunks/{chunk-TQG7WZI5.js.map → chunk-FSS72QJP.js.map} +0 -0
  368. /package/dist/chunks/{chunk-OLI35PTE.js.map → chunk-H56PLZHW.js.map} +0 -0
  369. /package/dist/chunks/{chunk-2E3ALKOF.js.map → chunk-HHLWXGOG.js.map} +0 -0
  370. /package/dist/chunks/{chunk-P52PAWBP.js.map → chunk-HXPRWMLH.js.map} +0 -0
  371. /package/dist/chunks/{chunk-FA2ZVSEU.js.map → chunk-IPTWZUSV.js.map} +0 -0
  372. /package/dist/chunks/{chunk-LLR7GHVU.js.map → chunk-ITY5SBAS.js.map} +0 -0
  373. /package/dist/chunks/{chunk-22PMPEFX.js.map → chunk-K52DES57.js.map} +0 -0
  374. /package/dist/chunks/{chunk-BK5AJ7TL.js.map → chunk-KJ7Q3BC3.js.map} +0 -0
  375. /package/dist/chunks/{chunk-MV2T5HFQ.js.map → chunk-KZHMLRKY.js.map} +0 -0
  376. /package/dist/chunks/{chunk-D3ITBQ7T.js.map → chunk-LGH2T6KL.js.map} +0 -0
  377. /package/dist/chunks/{chunk-3XIWMQLP.js.map → chunk-LQJ3TB5E.js.map} +0 -0
  378. /package/dist/chunks/{chunk-6GITBOHO.js.map → chunk-LYPEV765.js.map} +0 -0
  379. /package/dist/chunks/{chunk-O53H43CX.js.map → chunk-M44I7P3H.js.map} +0 -0
  380. /package/dist/chunks/{chunk-MOGE5ZMI.js.map → chunk-NAWIOVUH.js.map} +0 -0
  381. /package/dist/chunks/{chunk-ZNC5BEFK.js.map → chunk-NGE7TNCY.js.map} +0 -0
  382. /package/dist/chunks/{chunk-JABCT4RQ.js.map → chunk-OEKCCZ7I.js.map} +0 -0
  383. /package/dist/chunks/{chunk-DWFJETFP.js.map → chunk-OL5SKFPM.js.map} +0 -0
  384. /package/dist/chunks/{chunk-VLE4DKQR.js.map → chunk-P53E77KS.js.map} +0 -0
  385. /package/dist/chunks/{chunk-PV4TEEGI.js.map → chunk-PI6KC5CD.js.map} +0 -0
  386. /package/dist/chunks/{chunk-O62YM5KA.js.map → chunk-Q5DW33F4.js.map} +0 -0
  387. /package/dist/chunks/{chunk-V5DDXBVW.js.map → chunk-QS65X7D6.js.map} +0 -0
  388. /package/dist/chunks/{chunk-PKGMZRUT.js.map → chunk-SMX5YHRV.js.map} +0 -0
  389. /package/dist/chunks/{chunk-R6P5H47N.js.map → chunk-SQWFNFEX.js.map} +0 -0
  390. /package/dist/chunks/{chunk-RTDE5QSZ.js.map → chunk-SR75L2R5.js.map} +0 -0
  391. /package/dist/chunks/{chunk-FUVWMCRY.js.map → chunk-T5X3GYBF.js.map} +0 -0
  392. /package/dist/chunks/{chunk-YY6RFZ2L.js.map → chunk-TJSGSC2W.js.map} +0 -0
  393. /package/dist/chunks/{chunk-O7J6EFVD.js.map → chunk-TTXZK3BR.js.map} +0 -0
  394. /package/dist/chunks/{chunk-77RA2AU7.js.map → chunk-U7AQ4OQJ.js.map} +0 -0
  395. /package/dist/chunks/{chunk-635U2FDK.js.map → chunk-UPSI724V.js.map} +0 -0
  396. /package/dist/chunks/{chunk-56SPZGFT.js.map → chunk-V23HHK5D.js.map} +0 -0
  397. /package/dist/chunks/{chunk-C5P7OAML.js.map → chunk-VQHVH7X2.js.map} +0 -0
  398. /package/dist/chunks/{chunk-HARFWJBQ.js.map → chunk-WJ4YRFPQ.js.map} +0 -0
  399. /package/dist/chunks/{chunk-DFFTGAS7.js.map → chunk-WJXVNXJZ.js.map} +0 -0
  400. /package/dist/chunks/{chunk-PR2EE4G4.js.map → chunk-WOX4KI7C.js.map} +0 -0
  401. /package/dist/chunks/{chunk-ONVXBWB5.js.map → chunk-XFMGW2C5.js.map} +0 -0
  402. /package/dist/chunks/{chunk-RTFC2VXR.js.map → chunk-XPCRLKFO.js.map} +0 -0
  403. /package/dist/chunks/{chunk-MEZUNP2E.js.map → chunk-XYT53O3Z.js.map} +0 -0
  404. /package/dist/chunks/{chunk-EB7AS2K4.js.map → chunk-YSV633T5.js.map} +0 -0
  405. /package/dist/chunks/{chunk-PN2UBL2H.js.map → chunk-ZXFEHB7N.js.map} +0 -0
  406. /package/dist/chunks/{commands-Y37MKMRJ.js.map → commands-IOHIM2PX.js.map} +0 -0
  407. /package/dist/chunks/{computer-UE2AN7NW.js.map → computer-ZWTWBY67.js.map} +0 -0
  408. /package/dist/chunks/{crash-report-S6W5DXCO.js.map → crash-report-WLLGI2U4.js.map} +0 -0
  409. /package/dist/chunks/{dist-DODOSCTW.js.map → day-CU5J7UAK.js.map} +0 -0
  410. /package/dist/chunks/{dist-YO357DAD.js.map → dist-33QU2MGT.js.map} +0 -0
  411. /package/dist/chunks/{dist-5E47CZZT.js.map → dist-6G55RC27.js.map} +0 -0
  412. /package/dist/chunks/{dist-HCI4L6AO.js.map → dist-CFPNJCLJ.js.map} +0 -0
  413. /package/dist/chunks/{dist-3FVIUYVA.js.map → dist-E2PF4PGO.js.map} +0 -0
  414. /package/dist/chunks/{dist-4ATGJMUC.js.map → dist-FZYKXUR4.js.map} +0 -0
  415. /package/dist/chunks/{dist-2RVY7QOH.js.map → dist-IXAUMLZH.js.map} +0 -0
  416. /package/dist/chunks/{doctor-EZEJEK6B.js.map → dist-MBVPANQB.js.map} +0 -0
  417. /package/dist/chunks/{dist-IPQPISKD.js.map → dist-PKKDBDSA.js.map} +0 -0
  418. /package/dist/chunks/{home-UVU2HRDB.js.map → doctor-BXRPVVKL.js.map} +0 -0
  419. /package/dist/chunks/{drain-VVEMLN3L.js.map → drain-EWKGL77B.js.map} +0 -0
  420. /package/dist/chunks/{entry-CZ63UJYN.js.map → entry-XPXHELKT.js.map} +0 -0
  421. /package/dist/chunks/{github-VCUDZDGI.js.map → github-FQAXV2KP.js.map} +0 -0
  422. /package/dist/chunks/{host-Q3YNLTNL.js.map → home-T4ZVXIEX.js.map} +0 -0
  423. /package/dist/chunks/{lifecycle-24A5HH4I.js.map → host-LQ6V4NJS.js.map} +0 -0
  424. /package/dist/chunks/{host-queries-Z4BSL457.js.map → host-queries-LEPTBKZK.js.map} +0 -0
  425. /package/dist/chunks/{learn-SAZ3JOK3.js.map → learn-WOZKPYR4.js.map} +0 -0
  426. /package/dist/chunks/{learn-builtin-SQ2BTDFH.js.map → learn-builtin-BVJFZF4R.js.map} +0 -0
  427. /package/dist/chunks/{live-EIQ666TU.js.map → lifecycle-KKIDSRJV.js.map} +0 -0
  428. /package/dist/chunks/{login-YJ6L7KSY.js.map → live-4GQNVGPU.js.map} +0 -0
  429. /package/dist/chunks/{open-LEAR5UBX.js.map → login-MBXPJW6F.js.map} +0 -0
  430. /package/dist/chunks/{logs-RWGXFRMN.js.map → logs-7GVMBYAQ.js.map} +0 -0
  431. /package/dist/chunks/{mcp-DO454555.js.map → mcp-45UUEZMF.js.map} +0 -0
  432. /package/dist/chunks/{output-schema-YDKTNTMM.js.map → open-UG6VAHDW.js.map} +0 -0
  433. /package/dist/chunks/{operator-tools-AHP32F2J.js.map → operator-tools-M4SMIAYS.js.map} +0 -0
  434. /package/dist/chunks/{peers-NLUBD4IW.js.map → output-schema-MZ6X4WQ2.js.map} +0 -0
  435. /package/dist/chunks/{pal-XPZD6PAO.js.map → pal-R4RSZP2U.js.map} +0 -0
  436. /package/dist/chunks/{peers-MRKWY3MG.js.map → peers-6TIMGPGR.js.map} +0 -0
  437. /package/dist/chunks/{providers-QPESWN6K.js.map → peers-T5SXNFYU.js.map} +0 -0
  438. /package/dist/chunks/{pty-BDOOEOCB.js.map → providers-CPHEQZCV.js.map} +0 -0
  439. /package/dist/chunks/{resume-ZS3VS5OQ.js.map → pty-YAFV4ZA6.js.map} +0 -0
  440. /package/dist/chunks/{resume-command-KIXKOEM3.js.map → render-QFCCPEEL.js.map} +0 -0
  441. /package/dist/chunks/{start-check-7WYNSBON.js.map → resume-GZGHY4UR.js.map} +0 -0
  442. /package/dist/chunks/{store-ASWK7TVD.js.map → resume-command-WJH7SKYB.js.map} +0 -0
  443. /package/dist/chunks/{skills-MG2BRTPV.js.map → skills-RIJBOCKN.js.map} +0 -0
  444. /package/dist/chunks/{store-OKK7A6ZE.js.map → start-check-5DQL76YU.js.map} +0 -0
  445. /package/dist/chunks/{startup-failure-EWWYKPVE.js.map → startup-failure-7KMOAOXE.js.map} +0 -0
  446. /package/dist/chunks/{state-6UVY4EHA.js.map → state-QNSG3QWY.js.map} +0 -0
  447. /package/dist/chunks/{store-UFUDXZG6.js.map → store-7NXFZTW7.js.map} +0 -0
  448. /package/dist/chunks/{store-XU4PITDA.js.map → store-IDSNTJRG.js.map} +0 -0
  449. /package/dist/chunks/{upgrade-IJFMAW3T.js.map → upgrade-UZTPAIDF.js.map} +0 -0
  450. /package/dist/chunks/{workspaces-KVFY66IC.js.map → workspaces-KLYC5537.js.map} +0 -0
  451. /package/dist/chunks/{worktree-7JTMEYRX.js.map → worktree-4PKAJ7LT.js.map} +0 -0
@@ -1,23 +1,23 @@
1
1
  import { createRequire as __namzuCreateRequire } from 'node:module';
2
2
  const require = __namzuCreateRequire(import.meta.url);
3
- import {
4
- NAMZU_COMPACT_WORDMARK,
5
- NAMZU_WORDMARK,
6
- NAMZU_WORDMARK_MIN_WIDTH
7
- } from "./chunk-27R3OTVS.js";
8
3
  import {
9
4
  changesBlock,
10
5
  changesSinceConfirmed,
11
6
  confirmationView,
12
7
  describeChanges,
13
8
  permissionsChanged
14
- } from "./chunk-ZIUKLIUS.js";
9
+ } from "./chunk-6CKU4TCF.js";
15
10
  import {
16
11
  visibleScheduleMessage
17
12
  } from "./chunk-NADQQMMG.js";
18
13
  import {
19
14
  selectDesktopBackend
20
- } from "./chunk-FA2ZVSEU.js";
15
+ } from "./chunk-IPTWZUSV.js";
16
+ import {
17
+ NAMZU_COMPACT_WORDMARK,
18
+ NAMZU_WORDMARK,
19
+ NAMZU_WORDMARK_MIN_WIDTH
20
+ } from "./chunk-27R3OTVS.js";
21
21
  import {
22
22
  TURN_LIMIT_FIELDS,
23
23
  ThemeEpochContext,
@@ -27,7 +27,6 @@ import {
27
27
  commitReviewPrompt,
28
28
  contextCleanupLines,
29
29
  describeReducedMotion,
30
- discoverUserCommands,
31
30
  hostCommandNames,
32
31
  imagePasteKeyName,
33
32
  isAction,
@@ -47,18 +46,13 @@ import {
47
46
  saveTheme,
48
47
  savedThemeSetting,
49
48
  setThemePreview,
50
- setThemeSetting,
51
49
  shownTheme,
52
50
  slashTiming,
53
51
  toolServerRow,
54
52
  turnLimitCommands,
55
53
  useThemeEpoch,
56
54
  useThemeSubscription
57
- } from "./chunk-JVIS6M37.js";
58
- import {
59
- handleTerminationSignals
60
- } from "./chunk-6GITBOHO.js";
61
- import "./chunk-R66H2G5R.js";
55
+ } from "./chunk-JUN4VUC6.js";
62
56
  import {
63
57
  describeAllCredentialsLogout,
64
58
  describeApiKeyLogout,
@@ -68,37 +62,19 @@ import {
68
62
  describeProviderLogout
69
63
  } from "./chunk-MDK4RMBQ.js";
70
64
  import {
71
- applyProviderFlags
72
- } from "./chunk-P5OZ7YN6.js";
73
- import {
74
- reportCrash
75
- } from "./chunk-7J3IMJKF.js";
65
+ discoverUserCommands
66
+ } from "./chunk-BUP54TBX.js";
76
67
  import {
77
- BYPASS_CONSENT_BODY,
78
- BYPASS_CONSENT_TITLE,
79
- acknowledgeBypass,
80
- hasAcknowledgedBypass
81
- } from "./chunk-PN2UBL2H.js";
82
- import {
83
- applyFallbackFlag,
84
- capChoiceLines,
85
- choiceDisplayText,
86
- choiceDisplayWidth,
87
- eraseLastChoiceGrapheme,
88
- truncateAtSeparator,
89
- truncateChoiceText,
90
- wrapBalancedText,
91
- wrapChoiceText
92
- } from "./chunk-B5AIMVRI.js";
68
+ applyProviderFlags
69
+ } from "./chunk-QZ4V25KD.js";
93
70
  import {
94
71
  settleAnsweredPark
95
- } from "./chunk-3XIWMQLP.js";
96
- import "./chunk-GWQEMJFS.js";
72
+ } from "./chunk-LQJ3TB5E.js";
97
73
  import {
98
74
  DELIVERY_READ_LIMIT,
99
75
  readSourceDeliveryPage,
100
76
  takeSuppressedCount
101
- } from "./chunk-AJHNH4WR.js";
77
+ } from "./chunk-NXJQTDVT.js";
102
78
  import {
103
79
  DEFAULT_MAX_ITERATIONS,
104
80
  DEFAULT_TIMEOUT_MS,
@@ -108,40 +84,54 @@ import {
108
84
  confirmJob,
109
85
  editedJob,
110
86
  previewLines,
111
- runsPerDay,
112
- scriptShellUnavailableReason,
113
- verifyScheduledScript
114
- } from "./chunk-WEUXBFYG.js";
87
+ runsPerDay
88
+ } from "./chunk-RDWVNVZS.js";
115
89
  import {
116
90
  callsCount
117
- } from "./chunk-HFY2647W.js";
118
- import "./chunk-LLR7GHVU.js";
91
+ } from "./chunk-OG2MLME3.js";
92
+ import {
93
+ gateLines,
94
+ gateRefusal,
95
+ scriptShellUnavailableReason,
96
+ verifyScheduledScript
97
+ } from "./chunk-CYCUJOAD.js";
119
98
  import {
120
99
  allowsCommands,
121
100
  compileJobPolicy,
122
101
  compileScriptCheckPolicy,
123
102
  isPresetName
124
- } from "./chunk-P52PAWBP.js";
125
- import "./chunk-XEUQN4JC.js";
103
+ } from "./chunk-HXPRWMLH.js";
126
104
  import {
127
- formatResumeShellCommand,
128
105
  parkedRunWords,
129
106
  resumeCommand
130
- } from "./chunk-22PMPEFX.js";
107
+ } from "./chunk-K52DES57.js";
131
108
  import {
132
109
  appendHistory,
133
110
  nextFireOf,
134
111
  readHistory,
135
112
  readState
136
- } from "./chunk-56SPZGFT.js";
113
+ } from "./chunk-V23HHK5D.js";
137
114
  import {
138
115
  callEndpoint,
139
116
  readEndpoint
140
117
  } from "./chunk-6YG7D7U4.js";
141
118
  import {
142
- backgroundFromColorFgBg,
143
- queryTerminalBackground
144
- } from "./chunk-6ULKBT6P.js";
119
+ BYPASS_CONSENT_BODY,
120
+ BYPASS_CONSENT_TITLE,
121
+ acknowledgeBypass,
122
+ hasAcknowledgedBypass
123
+ } from "./chunk-ZXFEHB7N.js";
124
+ import {
125
+ applyFallbackFlag,
126
+ capChoiceLines,
127
+ choiceDisplayText,
128
+ choiceDisplayWidth,
129
+ eraseLastChoiceGrapheme,
130
+ truncateAtSeparator,
131
+ truncateChoiceText,
132
+ wrapBalancedText,
133
+ wrapChoiceText
134
+ } from "./chunk-B5AIMVRI.js";
145
135
  import {
146
136
  CLIPBOARD_KILL_SWITCH,
147
137
  ClickCounter,
@@ -150,69 +140,62 @@ import {
150
140
  createClipboardCopier,
151
141
  describeCopy,
152
142
  hostSlot,
153
- hostedByHost,
154
143
  lineAt,
155
144
  orderRange,
156
145
  snapRange,
157
- wordAt,
158
- workspacesSignal
159
- } from "./chunk-MTY3SZOT.js";
146
+ wordAt
147
+ } from "./chunk-52YXYXRG.js";
160
148
  import {
161
149
  motionAllowed,
162
150
  reducedMotion,
163
151
  require_react,
164
- setReducedMotion,
165
152
  useReducedMotion
166
153
  } from "./chunk-HREK4V2O.js";
167
- import {
168
- MOUSE_OFF,
169
- mouseOn,
170
- resolveMouseMode,
171
- writeLaunchMouseReset
172
- } from "./chunk-DH4X2E6M.js";
173
154
  import {
174
155
  buildPeerTools,
175
156
  openLivePeers,
176
157
  peerMailLabel,
177
158
  peerMailMessage
178
- } from "./chunk-GUZEB3KN.js";
159
+ } from "./chunk-FKQOGEKL.js";
179
160
  import {
180
161
  AUTO_CHOICE_ID,
181
- NOTHING_TOLD,
182
162
  PR_NONE,
183
163
  PrPoller,
184
164
  conversationMarkdown,
185
165
  hasBothGroups,
186
166
  isAutoChoice,
187
167
  modelStep,
188
- outcomeNotice,
189
168
  rawDetail,
190
169
  rowSection,
191
170
  sectionHeading,
192
171
  withAutoChoice,
193
172
  writeConversationExport
194
- } from "./chunk-PWNFXNFK.js";
173
+ } from "./chunk-DOPHHI6C.js";
195
174
  import {
196
175
  tuiPalDefinition,
197
176
  tuiPalEnvironment,
198
177
  tuiPalOwner,
199
178
  tuiPalPreferences
200
- } from "./chunk-BPZQYXLI.js";
179
+ } from "./chunk-3MJ3YKNV.js";
201
180
  import {
202
181
  isModelOnlyContext,
203
182
  runtimeContextLabel
204
183
  } from "./chunk-JETLWXUE.js";
184
+ import {
185
+ NOTHING_TOLD,
186
+ claimMismatchLine,
187
+ goalEndingLine,
188
+ handedBackLines,
189
+ outcomeNotice
190
+ } from "./chunk-RCLTSI6G.js";
205
191
  import {
206
192
  deleteUserConfigValue,
207
193
  setUserConfigValue
208
- } from "./chunk-YM5DH66D.js";
209
- import "./chunk-WD45OZPT.js";
210
- import "./chunk-WCMXLFUB.js";
211
- import "./chunk-UNQYPFDZ.js";
194
+ } from "./chunk-E7IXVEOQ.js";
212
195
  import {
213
196
  claimPalConversation,
214
197
  listPalConversations
215
- } from "./chunk-DWFJETFP.js";
198
+ } from "./chunk-OL5SKFPM.js";
216
199
  import {
217
200
  CLICK_EXPAND_HINT,
218
201
  CLICK_FOLD_HINT,
@@ -322,12 +305,19 @@ import {
322
305
  webLiveStatus,
323
306
  webSettledLine,
324
307
  withDebugDetail
325
- } from "./chunk-NWIOFCDB.js";
308
+ } from "./chunk-NY3I4WL7.js";
326
309
  import {
327
310
  openManagedWorktrees,
328
311
  worktreeOpenHint
329
- } from "./chunk-YGLJBR4L.js";
330
- import "./chunk-77RA2AU7.js";
312
+ } from "./chunk-3D52GNVJ.js";
313
+ import {
314
+ MCP_OUTPUT_CHARS,
315
+ boundedMcpText,
316
+ validatePromptArguments
317
+ } from "./chunk-KZHMLRKY.js";
318
+ import {
319
+ openInBrowser
320
+ } from "./chunk-T5X3GYBF.js";
331
321
  import {
332
322
  SAVE_SKILL_TOOL_NAME,
333
323
  SKILL_CREATOR_SKILL,
@@ -351,28 +341,17 @@ import {
351
341
  runTokens,
352
342
  sandboxRunsShellUnasked,
353
343
  settledElapsed
354
- } from "./chunk-F7ECNFNX.js";
355
- import "./chunk-KN3FKKYY.js";
356
- import "./chunk-RTDE5QSZ.js";
357
- import {
358
- MCP_OUTPUT_CHARS,
359
- boundedMcpText,
360
- validatePromptArguments
361
- } from "./chunk-MV2T5HFQ.js";
344
+ } from "./chunk-KJVRHBMX.js";
362
345
  import {
363
- openInBrowser
364
- } from "./chunk-FUVWMCRY.js";
346
+ describeBrowserStatus
347
+ } from "./chunk-WHODOMXA.js";
365
348
  import {
366
349
  describePlainInterruption,
367
350
  describeProviderWait,
368
351
  describeProviderWaitClock,
369
352
  isSelfMending,
370
353
  isSpentAllowance
371
- } from "./chunk-O7J6EFVD.js";
372
- import "./chunk-XMYFIXCP.js";
373
- import {
374
- describeBrowserStatus
375
- } from "./chunk-WHODOMXA.js";
354
+ } from "./chunk-TTXZK3BR.js";
376
355
  import {
377
356
  PAUSED_TURN_LINES,
378
357
  currentTimeLine,
@@ -381,7 +360,14 @@ import {
381
360
  handoffContinuationNote,
382
361
  refusalDetail,
383
362
  retryAfterMs
384
- } from "./chunk-V4WSIY32.js";
363
+ } from "./chunk-OMP25UWR.js";
364
+ import {
365
+ autoAvailable,
366
+ nextCycleMode,
367
+ permissionModeDescription,
368
+ permissionModeLabel,
369
+ permissionModeName
370
+ } from "./chunk-6I4V7I5M.js";
385
371
  import {
386
372
  MAY_BE_LIMITED_WINDOW_MS,
387
373
  accountProductName,
@@ -395,13 +381,6 @@ import {
395
381
  theme,
396
382
  tokenColor
397
383
  } from "./chunk-2IPDTDB3.js";
398
- import {
399
- autoAvailable,
400
- nextCycleMode,
401
- permissionModeDescription,
402
- permissionModeLabel,
403
- permissionModeName
404
- } from "./chunk-Y5D6542Z.js";
405
384
  import {
406
385
  expandTabs,
407
386
  scriptText,
@@ -414,25 +393,23 @@ import {
414
393
  loadSkillBody,
415
394
  renderSkillRoster,
416
395
  skillTierLabel
417
- } from "./chunk-MOGE5ZMI.js";
418
- import "./chunk-ZWA2JRJV.js";
419
- import "./chunk-NUGPLXVK.js";
396
+ } from "./chunk-NAWIOVUH.js";
420
397
  import {
421
398
  beginSubscriptionLogin,
422
399
  parsePastedInput
423
- } from "./chunk-JABCT4RQ.js";
400
+ } from "./chunk-OEKCCZ7I.js";
424
401
  import {
425
402
  apiKeyLogoutWord,
426
403
  isApiKeyLogoutTarget
427
- } from "./chunk-VLE4DKQR.js";
404
+ } from "./chunk-P53E77KS.js";
428
405
  import {
429
406
  API_KEY_ACCOUNT_PROVIDERS,
430
407
  openCliAccounts,
431
408
  storedAccountSignedIn
432
- } from "./chunk-PV4TEEGI.js";
409
+ } from "./chunk-PI6KC5CD.js";
433
410
  import {
434
411
  beginCodexDeviceLogin
435
- } from "./chunk-JEEF7UIH.js";
412
+ } from "./chunk-FLPT7I7I.js";
436
413
  import {
437
414
  ConversationIndexRefreshError,
438
415
  activeConversationTurn,
@@ -462,29 +439,25 @@ import {
462
439
  typedTextOf,
463
440
  unansweredReviewPark,
464
441
  unarchiveConversation
465
- } from "./chunk-RTFC2VXR.js";
466
- import "./chunk-C5P7OAML.js";
467
- import "./chunk-JQIBPPOL.js";
468
- import "./chunk-HXWIEKOB.js";
442
+ } from "./chunk-XPCRLKFO.js";
469
443
  import {
470
444
  isTrusted,
471
445
  trustDir
472
- } from "./chunk-ONVXBWB5.js";
446
+ } from "./chunk-XFMGW2C5.js";
473
447
  import {
474
448
  bindAccount,
475
449
  findAccountByName,
476
450
  isDefaultAccountId
477
- } from "./chunk-HAIXGRRS.js";
451
+ } from "./chunk-BC3IZXTY.js";
478
452
  import {
479
453
  startAutoUpdate
480
- } from "./chunk-PR2EE4G4.js";
481
- import {
482
- resolveNpmInvocation
483
- } from "./chunk-FSPBJ5VF.js";
454
+ } from "./chunk-WOX4KI7C.js";
484
455
  import {
485
456
  readManifest
486
457
  } from "./chunk-AK2U3N2A.js";
487
- import "./chunk-R6P5H47N.js";
458
+ import {
459
+ resolveNpmInvocation
460
+ } from "./chunk-LAXSPXNP.js";
488
461
  import {
489
462
  ScheduleConflictError,
490
463
  confirmationHolds,
@@ -493,28 +466,25 @@ import {
493
466
  findJob,
494
467
  listJobs,
495
468
  updateJob
496
- } from "./chunk-TXP6SOA7.js";
469
+ } from "./chunk-JR6EFL7G.js";
497
470
  import {
498
471
  schedulePaths
499
472
  } from "./chunk-A22MBIYU.js";
500
473
  import {
501
474
  writeJsonAtomic
502
475
  } from "./chunk-OEW7CJKK.js";
503
- import "./chunk-EDOJTQQU.js";
504
476
  import {
505
477
  pinTrustedProjectPath,
506
478
  resolveTrustedProjectContext
507
479
  } from "./chunk-CHIEVVQ2.js";
508
- import "./chunk-HE7WUOX2.js";
509
- import {
510
- debugRequested
511
- } from "./chunk-GNBMKISG.js";
512
480
  import {
513
481
  describeCacheLifetime,
514
482
  promptCacheTtl,
515
483
  providerOffersCacheLifetime
516
- } from "./chunk-LMLCGIQR.js";
517
- import "./chunk-OH6TB27S.js";
484
+ } from "./chunk-5YMIK3VP.js";
485
+ import {
486
+ debugRequested
487
+ } from "./chunk-GNBMKISG.js";
518
488
  import {
519
489
  COMPOSER_TRIGGER_DEFAULTS,
520
490
  COMPOSER_TRIGGER_IDS,
@@ -544,19 +514,11 @@ import {
544
514
  saveDecisionKey,
545
515
  shouldOfferDecisionSetup,
546
516
  writeConnection
547
- } from "./chunk-CDDXHKSP.js";
548
- import "./chunk-KONYGNG6.js";
549
- import "./chunk-LCGXWCVU.js";
550
- import "./chunk-4HGQJYDZ.js";
551
- import {
552
- contextLogging,
553
- installCliLogging
554
- } from "./chunk-MEZUNP2E.js";
517
+ } from "./chunk-X3L6N5RM.js";
555
518
  import {
556
519
  PROJECT_MCP_FILE,
557
520
  parseMcpServerFile
558
521
  } from "./chunk-SIG7WHBU.js";
559
- import "./chunk-LVVD32KJ.js";
560
522
  import {
561
523
  displayPath,
562
524
  formatSize,
@@ -568,20 +530,16 @@ import {
568
530
  import {
569
531
  THEME_CHOICES
570
532
  } from "./chunk-QLDUL46Z.js";
571
- import "./chunk-WMEZTDLT.js";
572
533
  import {
573
534
  isFullWidth,
574
535
  isWide,
575
536
  stringWidth,
576
537
  stripAnsi
577
538
  } from "./chunk-U5UV2YRE.js";
578
- import {
579
- EXIT_INTERNAL_ERROR
580
- } from "./chunk-YMWHDGCW.js";
581
539
  import {
582
540
  primaryProvider,
583
541
  writePreferences
584
- } from "./chunk-QY4UUQQT.js";
542
+ } from "./chunk-FMAUDMYL.js";
585
543
  import {
586
544
  automaticChoice,
587
545
  automaticKind,
@@ -590,8 +548,7 @@ import {
590
548
  discoverProviders,
591
549
  hasApiCredential,
592
550
  signedInSubscriptionProviders
593
- } from "./chunk-R6ZDPAEV.js";
594
- import "./chunk-4QIWRKJO.js";
551
+ } from "./chunk-6MI4Q5QQ.js";
595
552
  import {
596
553
  ALL_PROVIDER_IDS,
597
554
  PROVIDER_REGISTRY,
@@ -599,15 +556,10 @@ import {
599
556
  providerEntriesOfVendor,
600
557
  unsupportedProviderMessage
601
558
  } from "./chunk-G6YSAHKC.js";
602
- import "./chunk-KTPFUCRU.js";
603
- import "./chunk-RI2KAZJO.js";
604
559
  import {
605
560
  isAnthropicOAuthToken,
606
561
  readCodexCredentialFile
607
- } from "./chunk-TQG7WZI5.js";
608
- import "./chunk-O62YM5KA.js";
609
- import "./chunk-O53H43CX.js";
610
- import "./chunk-JORONMD3.js";
562
+ } from "./chunk-FSS72QJP.js";
611
563
  import {
612
564
  apiKeysPath,
613
565
  clearAllStoredApiKeys,
@@ -625,10 +577,10 @@ import {
625
577
  readStoredSubscriptionCredential,
626
578
  writeStoredApiKey,
627
579
  writeStoredGeminiApiKey
628
- } from "./chunk-D3ITBQ7T.js";
580
+ } from "./chunk-LGH2T6KL.js";
629
581
  import {
630
582
  namzuHomePath
631
- } from "./chunk-ZNC5BEFK.js";
583
+ } from "./chunk-NGE7TNCY.js";
632
584
  import {
633
585
  ACCEPT_EDITS_TOOLS,
634
586
  AccountRegistryError,
@@ -638,6 +590,8 @@ import {
638
590
  DiskMessageFeedbackStore,
639
591
  DiskSessionLog,
640
592
  GoalRoundLimitError,
593
+ HAND_BACK_RECEIPT,
594
+ HAND_BACK_TOOL_NAME,
641
595
  HostCommandRegistry,
642
596
  MONITOR_TOOL_NAME,
643
597
  NOOP_LOGGER,
@@ -652,6 +606,7 @@ import {
652
606
  asSessionId,
653
607
  buildScheduleTools,
654
608
  buildSessionLoopTools,
609
+ compareAnswerToOutcome,
655
610
  createAssistantMessage,
656
611
  createRuntimeContextMessage,
657
612
  createTempDir,
@@ -667,15 +622,14 @@ import {
667
622
  hostTimeZone,
668
623
  installedCommandShellForDialect,
669
624
  isCompactionMessage,
670
- jsonLinesSink,
671
625
  kernelHostCommands,
672
626
  mustAskPerson,
673
627
  nextFireTime,
674
628
  parseAccountId,
629
+ parseHandBack,
675
630
  parseScheduleSpec,
676
631
  parseTurnOutcome,
677
632
  parseWorkflowMeta,
678
- prettySink,
679
633
  resolveBoundAccount,
680
634
  resolveNamzuHome,
681
635
  resolveTriggerThreshold,
@@ -685,7 +639,7 @@ import {
685
639
  validateTimeZone,
686
640
  wakeBudgetFromEnv,
687
641
  wrapUntrusted
688
- } from "./chunk-VVMRXGQ6.js";
642
+ } from "./chunk-HQ4WFN7B.js";
689
643
  import {
690
644
  __commonJS,
691
645
  __export,
@@ -2563,8 +2517,8 @@ var require_react_reconciler_production = __commonJS({
2563
2517
  currentEntangledActionThenable = {
2564
2518
  status: "pending",
2565
2519
  value: void 0,
2566
- then: /* @__PURE__ */ __name(function(resolve10) {
2567
- entangledListeners.push(resolve10);
2520
+ then: /* @__PURE__ */ __name(function(resolve9) {
2521
+ entangledListeners.push(resolve9);
2568
2522
  }, "then")
2569
2523
  };
2570
2524
  }
@@ -2589,8 +2543,8 @@ var require_react_reconciler_production = __commonJS({
2589
2543
  status: "pending",
2590
2544
  value: null,
2591
2545
  reason: null,
2592
- then: /* @__PURE__ */ __name(function(resolve10) {
2593
- listeners.push(resolve10);
2546
+ then: /* @__PURE__ */ __name(function(resolve9) {
2547
+ listeners.push(resolve9);
2594
2548
  }, "then")
2595
2549
  };
2596
2550
  thenable.then(
@@ -9234,14 +9188,14 @@ var require_react_reconciler_production = __commonJS({
9234
9188
  __name(markRetryLaneIfNotHydrated, "markRetryLaneIfNotHydrated");
9235
9189
  var exports2 = {};
9236
9190
  "use strict";
9237
- var React12 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
9191
+ var React11 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
9238
9192
  /* @__PURE__ */ Symbol.for("react.scope");
9239
9193
  var REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity");
9240
9194
  /* @__PURE__ */ Symbol.for("react.legacy_hidden");
9241
9195
  /* @__PURE__ */ Symbol.for("react.tracing_marker");
9242
9196
  var REACT_MEMO_CACHE_SENTINEL = /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel");
9243
9197
  /* @__PURE__ */ Symbol.for("react.view_transition");
9244
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React12.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
9198
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React11.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
9245
9199
  $$$config.cloneMutableInstance;
9246
9200
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
9247
9201
  $$$config.cloneMutableTextInstance;
@@ -12631,8 +12585,8 @@ var require_react_reconciler_development = __commonJS({
12631
12585
  currentEntangledActionThenable = {
12632
12586
  status: "pending",
12633
12587
  value: void 0,
12634
- then: /* @__PURE__ */ __name(function(resolve10) {
12635
- entangledListeners.push(resolve10);
12588
+ then: /* @__PURE__ */ __name(function(resolve9) {
12589
+ entangledListeners.push(resolve9);
12636
12590
  }, "then")
12637
12591
  };
12638
12592
  }
@@ -12657,8 +12611,8 @@ var require_react_reconciler_development = __commonJS({
12657
12611
  status: "pending",
12658
12612
  value: null,
12659
12613
  reason: null,
12660
- then: /* @__PURE__ */ __name(function(resolve10) {
12661
- listeners.push(resolve10);
12614
+ then: /* @__PURE__ */ __name(function(resolve9) {
12615
+ listeners.push(resolve9);
12662
12616
  }, "then")
12663
12617
  };
12664
12618
  thenable.then(
@@ -22347,14 +22301,14 @@ var require_react_reconciler_development = __commonJS({
22347
22301
  __name(getCurrentFiberForDevTools, "getCurrentFiberForDevTools");
22348
22302
  var exports2 = {};
22349
22303
  "use strict";
22350
- var React12 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
22304
+ var React11 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
22351
22305
  /* @__PURE__ */ Symbol.for("react.scope");
22352
22306
  var REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity");
22353
22307
  /* @__PURE__ */ Symbol.for("react.legacy_hidden");
22354
22308
  /* @__PURE__ */ Symbol.for("react.tracing_marker");
22355
22309
  var REACT_MEMO_CACHE_SENTINEL = /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel");
22356
22310
  /* @__PURE__ */ Symbol.for("react.view_transition");
22357
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React12.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
22311
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React11.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
22358
22312
  $$$config.cloneMutableInstance;
22359
22313
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
22360
22314
  $$$config.cloneMutableTextInstance;
@@ -24904,18 +24858,18 @@ var require_react_jsx_runtime_development = __commonJS({
24904
24858
  return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
24905
24859
  }
24906
24860
  __name(isValidElement, "isValidElement");
24907
- var React12 = require_react(), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = React12.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
24861
+ var React11 = require_react(), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = React11.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
24908
24862
  return null;
24909
24863
  };
24910
- React12 = {
24864
+ React11 = {
24911
24865
  react_stack_bottom_frame: /* @__PURE__ */ __name(function(callStackForError) {
24912
24866
  return callStackForError();
24913
24867
  }, "react_stack_bottom_frame")
24914
24868
  };
24915
24869
  var specialPropKeyWarningShown;
24916
24870
  var didWarnAboutElementRef = {};
24917
- var unknownOwnerDebugStack = React12.react_stack_bottom_frame.bind(
24918
- React12,
24871
+ var unknownOwnerDebugStack = React11.react_stack_bottom_frame.bind(
24872
+ React11,
24919
24873
  UnknownOwner
24920
24874
  )();
24921
24875
  var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
@@ -24959,9 +24913,6 @@ var require_jsx_runtime = __commonJS({
24959
24913
  }
24960
24914
  });
24961
24915
 
24962
- // src/tui/index.tsx
24963
- import { resolve as resolve9 } from "node:path";
24964
-
24965
24916
  // ../../node_modules/.pnpm/ink@7.0.3_@types+react@19.2.15_react@19.2.6/node_modules/ink/build/render.js
24966
24917
  import { Stream } from "node:stream";
24967
24918
  import process13 from "node:process";
@@ -32599,8 +32550,8 @@ var kittyModifiers = {
32599
32550
  var noop = /* @__PURE__ */ __name(() => {
32600
32551
  }, "noop");
32601
32552
  var textEncoder = new TextEncoder();
32602
- var yieldImmediate = /* @__PURE__ */ __name(async () => new Promise((resolve10) => {
32603
- setImmediate(resolve10);
32553
+ var yieldImmediate = /* @__PURE__ */ __name(async () => new Promise((resolve9) => {
32554
+ setImmediate(resolve9);
32604
32555
  }), "yieldImmediate");
32605
32556
  var kittyQueryEscapeByte = 27;
32606
32557
  var kittyQueryOpenBracketByte = 91;
@@ -32808,8 +32759,8 @@ var Ink = class {
32808
32759
  };
32809
32760
  }
32810
32761
  this.initKittyKeyboard();
32811
- this.exitPromise = new Promise((resolve10, reject) => {
32812
- this.resolveExitPromise = resolve10;
32762
+ this.exitPromise = new Promise((resolve9, reject) => {
32763
+ this.resolveExitPromise = resolve9;
32813
32764
  this.rejectExitPromise = reject;
32814
32765
  });
32815
32766
  void this.exitPromise.catch(noop);
@@ -33106,9 +33057,9 @@ var Ink = class {
33106
33057
  settleThrottle(this.throttledOnRender, canWriteToStdout);
33107
33058
  settleThrottle(this.throttledLog, canWriteToStdout);
33108
33059
  if (canWriteToStdout && hasWritableState) {
33109
- await new Promise((resolve10) => {
33060
+ await new Promise((resolve9) => {
33110
33061
  this.options.stdout.write("", () => {
33111
- resolve10();
33062
+ resolve9();
33112
33063
  });
33113
33064
  });
33114
33065
  return;
@@ -33175,8 +33126,8 @@ var Ink = class {
33175
33126
  async awaitNextRender() {
33176
33127
  if (!this.nextRenderCommit) {
33177
33128
  let resolveRender;
33178
- const promise = new Promise((resolve10) => {
33179
- resolveRender = resolve10;
33129
+ const promise = new Promise((resolve9) => {
33130
+ resolveRender = resolve9;
33180
33131
  });
33181
33132
  this.nextRenderCommit = { promise, resolve: resolveRender };
33182
33133
  }
@@ -34097,8 +34048,43 @@ var measureElement = /* @__PURE__ */ __name((node) => ({
34097
34048
  }), "measureElement");
34098
34049
  var measure_element_default = measureElement;
34099
34050
 
34100
- // src/tui/index.tsx
34101
- var import_react63 = __toESM(require_react(), 1);
34051
+ // src/tui/terminal-focus.ts
34052
+ var import_react34 = __toESM(require_react(), 1);
34053
+ function createTerminalFocus(now = Date.now) {
34054
+ let state = "unknown";
34055
+ let gainedAt = 0;
34056
+ const listeners = /* @__PURE__ */ new Set();
34057
+ const emit = /* @__PURE__ */ __name(() => {
34058
+ for (const listener of [...listeners]) listener();
34059
+ }, "emit");
34060
+ const set = /* @__PURE__ */ __name((focused) => {
34061
+ if (focused) gainedAt = now();
34062
+ if (!focused && state === "blurred") return;
34063
+ state = focused ? "focused" : "blurred";
34064
+ emit();
34065
+ }, "set");
34066
+ return {
34067
+ state: /* @__PURE__ */ __name(() => state, "state"),
34068
+ isFocused: /* @__PURE__ */ __name(() => state !== "blurred", "isFocused"),
34069
+ gainedAt: /* @__PURE__ */ __name(() => gainedAt, "gainedAt"),
34070
+ set,
34071
+ noteInput: /* @__PURE__ */ __name(() => {
34072
+ if (state === "blurred") set(true);
34073
+ }, "noteInput"),
34074
+ subscribe: /* @__PURE__ */ __name((listener) => {
34075
+ listeners.add(listener);
34076
+ return () => {
34077
+ listeners.delete(listener);
34078
+ };
34079
+ }, "subscribe")
34080
+ };
34081
+ }
34082
+ __name(createTerminalFocus, "createTerminalFocus");
34083
+ var terminalFocus = createTerminalFocus();
34084
+ function useTerminalFocused(store = terminalFocus) {
34085
+ return (0, import_react34.useSyncExternalStore)(store.subscribe, store.isFocused, store.isFocused);
34086
+ }
34087
+ __name(useTerminalFocused, "useTerminalFocused");
34102
34088
 
34103
34089
  // src/tui/App.tsx
34104
34090
  import { existsSync as existsSync4, rmSync as rmSync2 } from "node:fs";
@@ -34172,7 +34158,7 @@ function goalRoundHeadline(round, max) {
34172
34158
  __name(goalRoundHeadline, "goalRoundHeadline");
34173
34159
 
34174
34160
  // src/tui/AgentExplorer.tsx
34175
- var import_react34 = __toESM(require_react(), 1);
34161
+ var import_react35 = __toESM(require_react(), 1);
34176
34162
 
34177
34163
  // src/tui/key-hints.ts
34178
34164
  function boxedHintWidth(columns) {
@@ -34557,22 +34543,22 @@ function workflowRowVariants(workflow, now) {
34557
34543
  const spent = workflow.tokens === void 0 ? void 0 : formatCompactCount(workflow.tokens);
34558
34544
  const tokens = spent && `\u2193 ${spent} tokens`;
34559
34545
  const warning = workflow.large ? LARGE_WORKFLOW_WARNING : void 0;
34560
- const join13 = /* @__PURE__ */ __name((parts) => parts.filter((part) => part !== void 0).join(" \xB7 "), "join");
34546
+ const join11 = /* @__PURE__ */ __name((parts) => parts.filter((part) => part !== void 0).join(" \xB7 "), "join");
34561
34547
  const [wide, ...narrower] = WORKFLOW_BAR_WIDTHS;
34562
34548
  const few = WORKFLOW_BAR_WIDTHS[WORKFLOW_BAR_WIDTHS.length - 1];
34563
34549
  const variants = [
34564
34550
  ...railPhaseTexts(workflow.runningPhases).map((phases) => ({
34565
34551
  barWidth: wide,
34566
- text: join13([count2, elapsed2, tokens, warning, phases])
34552
+ text: join11([count2, elapsed2, tokens, warning, phases])
34567
34553
  })),
34568
- { barWidth: wide, text: join13([count2, elapsed2, tokens, warning]) },
34554
+ { barWidth: wide, text: join11([count2, elapsed2, tokens, warning]) },
34569
34555
  ...narrower.map((barWidth) => ({
34570
34556
  barWidth,
34571
- text: join13([count2, elapsed2, tokens, warning])
34557
+ text: join11([count2, elapsed2, tokens, warning])
34572
34558
  })),
34573
- { barWidth: few, text: join13([count2, elapsed2, warning]) },
34574
- { barWidth: few, text: join13([count2, elapsed2]) },
34575
- { barWidth: 0, text: join13([count2, elapsed2]) },
34559
+ { barWidth: few, text: join11([count2, elapsed2, warning]) },
34560
+ { barWidth: few, text: join11([count2, elapsed2]) },
34561
+ { barWidth: 0, text: join11([count2, elapsed2]) },
34576
34562
  { barWidth: 0, text: count2 }
34577
34563
  ];
34578
34564
  return variants.filter(
@@ -35140,7 +35126,7 @@ function WorkflowDetail({
35140
35126
  const index = phaseWindow.start + offset;
35141
35127
  const active = index === selectedPhaseIndex;
35142
35128
  const glyph = phaseGlyph(item, index);
35143
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react34.Fragment, { children: [
35129
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react35.Fragment, { children: [
35144
35130
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
35145
35131
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: theme.accent.assistant, children: active ? "\u276F" : " " }) }),
35146
35132
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { width: 3, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: glyph.color, children: glyph.text }) }),
@@ -35798,8 +35784,8 @@ function rowColor(row2) {
35798
35784
  }
35799
35785
  __name(rowColor, "rowColor");
35800
35786
  function useLiveNow(active) {
35801
- const [now, setNow] = (0, import_react34.useState)(() => Date.now());
35802
- (0, import_react34.useEffect)(() => {
35787
+ const [now, setNow] = (0, import_react35.useState)(() => Date.now());
35788
+ (0, import_react35.useEffect)(() => {
35803
35789
  if (!active) return;
35804
35790
  const timer = setInterval(() => setNow(Date.now()), 1e3);
35805
35791
  timer.unref?.();
@@ -35810,7 +35796,7 @@ function useLiveNow(active) {
35810
35796
  __name(useLiveNow, "useLiveNow");
35811
35797
 
35812
35798
  // src/tui/LiveActivity.tsx
35813
- var import_react36 = __toESM(require_react(), 1);
35799
+ var import_react37 = __toESM(require_react(), 1);
35814
35800
 
35815
35801
  // src/tui/foreground-handoff.ts
35816
35802
  function backgroundHint(env3 = process.env) {
@@ -36028,7 +36014,7 @@ function blendTowardStall(base, amount) {
36028
36014
  __name(blendTowardStall, "blendTowardStall");
36029
36015
 
36030
36016
  // src/tui/thinking-label.ts
36031
- var import_react35 = __toESM(require_react(), 1);
36017
+ var import_react36 = __toESM(require_react(), 1);
36032
36018
  var STILL_AFTER_MS = 1e4;
36033
36019
  var MORE_AFTER_MS = 2e4;
36034
36020
  var SOME_MORE_AFTER_MS = 3e4;
@@ -36047,11 +36033,11 @@ function thoughtForLabel(ms) {
36047
36033
  }
36048
36034
  __name(thoughtForLabel, "thoughtForLabel");
36049
36035
  function useThinkingRow(reasoning, active) {
36050
- const state = (0, import_react35.useRef)({
36036
+ const state = (0, import_react36.useRef)({
36051
36037
  start: null,
36052
36038
  settled: null
36053
36039
  });
36054
- const [, redraw] = (0, import_react35.useState)(0);
36040
+ const [, redraw] = (0, import_react36.useState)(0);
36055
36041
  const now = Date.now();
36056
36042
  const s = state.current;
36057
36043
  if (!active) {
@@ -36066,7 +36052,7 @@ function useThinkingRow(reasoning, active) {
36066
36052
  }
36067
36053
  if (s.settled !== null && now >= s.settled.until) s.settled = null;
36068
36054
  const until = s.settled?.until ?? null;
36069
- (0, import_react35.useEffect)(() => {
36055
+ (0, import_react36.useEffect)(() => {
36070
36056
  if (until === null) return;
36071
36057
  const timer = setTimeout(() => redraw((n) => n + 1), Math.max(0, until - Date.now()));
36072
36058
  return () => clearTimeout(timer);
@@ -36081,8 +36067,8 @@ __name(useThinkingRow, "useThinkingRow");
36081
36067
  // src/tui/LiveActivity.tsx
36082
36068
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
36083
36069
  function useSecondTick(active) {
36084
- const [, setTick] = (0, import_react36.useState)(0);
36085
- (0, import_react36.useEffect)(() => {
36070
+ const [, setTick] = (0, import_react37.useState)(0);
36071
+ (0, import_react37.useEffect)(() => {
36086
36072
  if (!active) return;
36087
36073
  const timer = setInterval(() => setTick((n) => n + 1), 1e3);
36088
36074
  return () => clearInterval(timer);
@@ -36111,8 +36097,8 @@ function LiveActivity({
36111
36097
  useReducedMotion();
36112
36098
  const motion = animate && stdout.isTTY === true && !screenReader && motionAllowed();
36113
36099
  const active = activeTools.length > 0 || working;
36114
- const startedAtRef = (0, import_react36.useRef)(null);
36115
- const pausedRef = (0, import_react36.useRef)({ total: 0, since: null });
36100
+ const startedAtRef = (0, import_react37.useRef)(null);
36101
+ const pausedRef = (0, import_react37.useRef)({ total: 0, since: null });
36116
36102
  if (active && startedAtRef.current === null) {
36117
36103
  startedAtRef.current = Date.now();
36118
36104
  pausedRef.current = { total: 0, since: null };
@@ -36125,7 +36111,7 @@ function LiveActivity({
36125
36111
  pausedRef.current.since = null;
36126
36112
  }
36127
36113
  useSecondTick(waitNotice?.retryAt !== void 0);
36128
- const progressRef = (0, import_react36.useRef)({
36114
+ const progressRef = (0, import_react37.useRef)({
36129
36115
  key: "",
36130
36116
  at: Date.now(),
36131
36117
  stall: 0,
@@ -37903,7 +37889,7 @@ function BackgroundJobsPanel({
37903
37889
  __name(BackgroundJobsPanel, "BackgroundJobsPanel");
37904
37890
 
37905
37891
  // src/tui/ProviderSetup.tsx
37906
- var import_react37 = __toESM(require_react(), 1);
37892
+ var import_react38 = __toESM(require_react(), 1);
37907
37893
 
37908
37894
  // src/integrations/providers/setup.ts
37909
37895
  import { execFile, spawn } from "node:child_process";
@@ -37964,7 +37950,7 @@ function versionFromProbe(output) {
37964
37950
  __name(versionFromProbe, "versionFromProbe");
37965
37951
  function runSetupCommand(command, args, options) {
37966
37952
  options.signal.throwIfAborted();
37967
- return new Promise((resolve10, reject) => {
37953
+ return new Promise((resolve9, reject) => {
37968
37954
  const invocation = resolveNpmInvocation(command, args);
37969
37955
  const child = spawn(invocation.executable, [...invocation.args], {
37970
37956
  cwd: options.cwd,
@@ -38035,7 +38021,7 @@ function runSetupCommand(command, args, options) {
38035
38021
  options.signal.removeEventListener("abort", stop);
38036
38022
  void (stopCompletion ?? Promise.resolve()).then(() => {
38037
38023
  if (stopError) reject(stopError);
38038
- else resolve10({ code: stopped ? null : code, output, missing });
38024
+ else resolve9({ code: stopped ? null : code, output, missing });
38039
38025
  });
38040
38026
  }, "finish");
38041
38027
  child.on("error", (error) => {
@@ -38125,19 +38111,19 @@ function ProviderSetup({
38125
38111
  onConnect
38126
38112
  }) {
38127
38113
  const terminal = use_window_size_default();
38128
- const [rows, setRows] = (0, import_react37.useState)([]);
38129
- const [selected, setSelected] = (0, import_react37.useState)(0);
38130
- const [confirm, setConfirm] = (0, import_react37.useState)(false);
38131
- const [busy, setBusy] = (0, import_react37.useState)(true);
38132
- const [output, setOutput] = (0, import_react37.useState)("Checking installations and credential sources\u2026");
38133
- const lifetime2 = (0, import_react37.useRef)(null);
38134
- const operation = (0, import_react37.useRef)(null);
38114
+ const [rows, setRows] = (0, import_react38.useState)([]);
38115
+ const [selected, setSelected] = (0, import_react38.useState)(0);
38116
+ const [confirm, setConfirm] = (0, import_react38.useState)(false);
38117
+ const [busy, setBusy] = (0, import_react38.useState)(true);
38118
+ const [output, setOutput] = (0, import_react38.useState)("Checking installations and credential sources\u2026");
38119
+ const lifetime2 = (0, import_react38.useRef)(null);
38120
+ const operation = (0, import_react38.useRef)(null);
38135
38121
  const refresh = /* @__PURE__ */ __name(async (signal) => {
38136
38122
  const detected = await discoverProviders({ skipProbes: true });
38137
38123
  const next = await probeHarnesses(detected, cwd2, signal);
38138
38124
  if (!signal.aborted) setRows(next);
38139
38125
  }, "refresh");
38140
- (0, import_react37.useEffect)(() => {
38126
+ (0, import_react38.useEffect)(() => {
38141
38127
  const controller = new AbortController();
38142
38128
  lifetime2.current = controller;
38143
38129
  void refresh(controller.signal).then(() => {
@@ -38273,16 +38259,18 @@ function ProviderSetup({
38273
38259
  __name(ProviderSetup, "ProviderSetup");
38274
38260
 
38275
38261
  // src/tui/TranscriptScreen.tsx
38276
- var import_react41 = __toESM(require_react(), 1);
38262
+ var import_react42 = __toESM(require_react(), 1);
38277
38263
 
38278
38264
  // src/tui/Markdown.tsx
38279
- var import_react38 = __toESM(require_react(), 1);
38265
+ var import_react39 = __toESM(require_react(), 1);
38280
38266
 
38281
38267
  // src/tui/markdownParser.ts
38282
38268
  var FENCE = /^```(\w*)\s*$/;
38283
38269
  var HEADING = /^(#{1,6})\s+(.+?)\s*#*$/;
38284
38270
  var BULLET = /^(\s*)([-*+]|\d+[.)])\s+(.+)$/;
38285
- var BLOCKQUOTE = /^\s{0,3}>/;
38271
+ var BLOCKQUOTE = /^\s*>/;
38272
+ var QUOTE_MARK = /^\s*>[ \t]?/;
38273
+ var RULE = /^\s*(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/;
38286
38274
  var TABLE_ROW = /^\s*\|.*\|\s*$/;
38287
38275
  var TABLE_SEP = /^\s*\|?[\s:|-]*-[\s:|-]*\|?\s*$/;
38288
38276
  function tableCells(line) {
@@ -38305,10 +38293,12 @@ function continuesTable(line) {
38305
38293
  return line.includes("|") && line.trim().length > 0 && !FENCE.test(line) && !HEADING.test(line) && !BULLET.test(line) && !BLOCKQUOTE.test(line);
38306
38294
  }
38307
38295
  __name(continuesTable, "continuesTable");
38308
- function classify(line, next) {
38296
+ function classify(line, next, terminated) {
38309
38297
  if (FENCE.test(line)) return "code";
38310
38298
  if (TABLE_ROW.test(line) && next !== void 0 && TABLE_SEP.test(next)) return "table";
38311
38299
  if (HEADING.test(line)) return "heading";
38300
+ if (terminated && RULE.test(line)) return "rule";
38301
+ if (BLOCKQUOTE.test(line)) return "quote";
38312
38302
  if (BULLET.test(line)) return "bullet";
38313
38303
  if (line.trim().length === 0) return "blank";
38314
38304
  return "text";
@@ -38320,7 +38310,7 @@ function scanBlocks(src) {
38320
38310
  let i = 0;
38321
38311
  while (i < lines2.length) {
38322
38312
  const line = lines2[i] ?? "";
38323
- switch (classify(line, lines2[i + 1])) {
38313
+ switch (classify(line, lines2[i + 1], i < lines2.length - 1)) {
38324
38314
  case "blank":
38325
38315
  i++;
38326
38316
  break;
@@ -38339,6 +38329,18 @@ function scanBlocks(src) {
38339
38329
  i = end;
38340
38330
  break;
38341
38331
  }
38332
+ case "quote": {
38333
+ let end = i;
38334
+ while (end < lines2.length && BLOCKQUOTE.test(lines2[end] ?? "")) end++;
38335
+ segments.push(lines2.slice(i, end).join("\n"));
38336
+ i = end;
38337
+ break;
38338
+ }
38339
+ case "rule":
38340
+ segments.push(`${line}
38341
+ `);
38342
+ i++;
38343
+ break;
38342
38344
  case "heading":
38343
38345
  case "bullet":
38344
38346
  segments.push(line);
@@ -38346,7 +38348,8 @@ function scanBlocks(src) {
38346
38348
  break;
38347
38349
  default: {
38348
38350
  let end = i;
38349
- while (end < lines2.length && classify(lines2[end] ?? "", lines2[end + 1]) === "text") end++;
38351
+ while (end < lines2.length && classify(lines2[end] ?? "", lines2[end + 1], end < lines2.length - 1) === "text")
38352
+ end++;
38350
38353
  segments.push(lines2.slice(i, end).join("\n"));
38351
38354
  i = end;
38352
38355
  break;
@@ -38359,7 +38362,7 @@ __name(scanBlocks, "scanBlocks");
38359
38362
  function parseBlock(raw) {
38360
38363
  const lines2 = raw.split("\n");
38361
38364
  const first = lines2[0] ?? "";
38362
- switch (classify(first, lines2[1])) {
38365
+ switch (classify(first, lines2[1], lines2.length > 1)) {
38363
38366
  case "code": {
38364
38367
  const lang = FENCE.exec(first)?.[1];
38365
38368
  const closed = FENCE.test(lines2[lines2.length - 1] ?? "");
@@ -38382,6 +38385,13 @@ function parseBlock(raw) {
38382
38385
  const heading = HEADING.exec(first);
38383
38386
  return { type: "heading", level: heading?.[1]?.length ?? 1, text: heading?.[2] ?? "" };
38384
38387
  }
38388
+ case "rule":
38389
+ return { type: "rule" };
38390
+ case "quote":
38391
+ return {
38392
+ type: "quote",
38393
+ blocks: parseMarkdown(lines2.map((l) => l.replace(QUOTE_MARK, "")).join("\n"))
38394
+ };
38385
38395
  case "bullet": {
38386
38396
  const bullet = BULLET.exec(first);
38387
38397
  const rawMarker = bullet?.[2] ?? "-";
@@ -38456,6 +38466,22 @@ function createBlockCache() {
38456
38466
  }
38457
38467
  __name(createBlockCache, "createBlockCache");
38458
38468
 
38469
+ // src/tui/markdown-structure.ts
38470
+ function headingStyle(level) {
38471
+ if (level <= 1) return { color: "accent", underline: true };
38472
+ if (level === 2) return { color: "accent", underline: false };
38473
+ if (level === 3) return { color: "body", underline: false };
38474
+ return { color: "muted", underline: false };
38475
+ }
38476
+ __name(headingStyle, "headingStyle");
38477
+ var QUOTE_BAR = "\u2502";
38478
+ var QUOTE_BAR_WIDTH = stringWidth(QUOTE_BAR) + 1;
38479
+ var RULE_MAX = 40;
38480
+ function ruleWidth(width) {
38481
+ return Math.max(1, Math.min(RULE_MAX, width));
38482
+ }
38483
+ __name(ruleWidth, "ruleWidth");
38484
+
38459
38485
  // src/tui/terminal-hyperlinks.ts
38460
38486
  import { isAbsolute } from "node:path";
38461
38487
  import { pathToFileURL } from "node:url";
@@ -38790,16 +38816,26 @@ __name(tableHeight, "tableHeight");
38790
38816
 
38791
38817
  // src/tui/Markdown.tsx
38792
38818
  var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
38793
- var ContentWidth = (0, import_react38.createContext)(76);
38819
+ var ContentWidth = (0, import_react39.createContext)(76);
38794
38820
  function useContentWidth() {
38795
- return Math.max(10, (0, import_react38.useContext)(ContentWidth));
38821
+ return Math.max(10, (0, import_react39.useContext)(ContentWidth));
38796
38822
  }
38797
38823
  __name(useContentWidth, "useContentWidth");
38798
38824
  function Markdown({ text, color = theme.text.primary, hyperlinks = false }) {
38799
- const cache3 = (0, import_react38.useRef)(void 0);
38825
+ const cache3 = (0, import_react39.useRef)(void 0);
38800
38826
  cache3.current ??= createBlockCache();
38801
38827
  const blocks = cache3.current.parse(terminalDisplayText(text));
38802
38828
  const width = useContentWidth();
38829
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BlockList, { blocks, color, hyperlinks, width });
38830
+ }
38831
+ __name(Markdown, "Markdown");
38832
+ function BlockList({
38833
+ blocks,
38834
+ color,
38835
+ hyperlinks,
38836
+ width,
38837
+ italic = false
38838
+ }) {
38803
38839
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexDirection: "column", children: blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38804
38840
  BlockView,
38805
38841
  {
@@ -38807,32 +38843,62 @@ function Markdown({ text, color = theme.text.primary, hyperlinks = false }) {
38807
38843
  prev: blocks[i - 1],
38808
38844
  color,
38809
38845
  hyperlinks,
38810
- width
38846
+ width,
38847
+ italic
38811
38848
  },
38812
38849
  `b-${i}`
38813
38850
  )) });
38814
38851
  }
38815
- __name(Markdown, "Markdown");
38816
- var BlockView = (0, import_react38.memo)(/* @__PURE__ */ __name(function BlockView2({
38852
+ __name(BlockList, "BlockList");
38853
+ var BlockView = (0, import_react39.memo)(/* @__PURE__ */ __name(function BlockView2({
38817
38854
  block,
38818
38855
  prev,
38819
38856
  color,
38820
38857
  hyperlinks,
38821
- width
38858
+ width,
38859
+ italic
38822
38860
  }) {
38823
38861
  useThemeEpoch();
38824
38862
  const gap = !prev || block.type === "bullet" && prev.type === "bullet" ? 0 : 1;
38825
38863
  switch (block.type) {
38826
- case "heading":
38827
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: gap, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, color: block.level <= 2 ? theme.accent.user : color, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38864
+ case "heading": {
38865
+ const style = headingStyle(block.level);
38866
+ const headingColor = style.color === "accent" ? theme.accent.user : style.color === "muted" ? theme.text.muted : color;
38867
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: gap, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, underline: style.underline, italic, color: headingColor, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38828
38868
  WrappedInline,
38829
38869
  {
38830
38870
  source: block.text,
38831
38871
  width,
38832
- color,
38872
+ color: headingColor,
38833
38873
  hyperlinks
38834
38874
  }
38835
38875
  ) }) });
38876
+ }
38877
+ case "rule":
38878
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: gap, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: theme.border.default, children: "\u2500".repeat(ruleWidth(width)) }) });
38879
+ case "quote":
38880
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38881
+ Box_default,
38882
+ {
38883
+ marginTop: gap,
38884
+ borderStyle: "single",
38885
+ borderColor: theme.border.default,
38886
+ borderTop: false,
38887
+ borderBottom: false,
38888
+ borderRight: false,
38889
+ paddingLeft: QUOTE_BAR_WIDTH - 1,
38890
+ children: block.blocks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38891
+ BlockList,
38892
+ {
38893
+ blocks: block.blocks,
38894
+ color,
38895
+ hyperlinks,
38896
+ width: width - QUOTE_BAR_WIDTH,
38897
+ italic: true
38898
+ }
38899
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: " " })
38900
+ }
38901
+ );
38836
38902
  case "bullet": {
38837
38903
  const marker = block.ordered ? `${block.marker}.` : block.marker;
38838
38904
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: gap, flexDirection: "row", children: [
@@ -38840,7 +38906,7 @@ var BlockView = (0, import_react38.memo)(/* @__PURE__ */ __name(function BlockVi
38840
38906
  marker,
38841
38907
  " "
38842
38908
  ] }) }),
38843
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color, wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38909
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color, italic, wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38844
38910
  WrappedInline,
38845
38911
  {
38846
38912
  source: block.text,
@@ -38859,7 +38925,7 @@ var BlockView = (0, import_react38.memo)(/* @__PURE__ */ __name(function BlockVi
38859
38925
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: theme.status.ok, children: line.length > 0 ? line : " " }, `c-${i}`)
38860
38926
  )) });
38861
38927
  default:
38862
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: gap, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color, wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38928
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: gap, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color, italic, wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38863
38929
  WrappedInline,
38864
38930
  {
38865
38931
  source: block.text,
@@ -38917,7 +38983,7 @@ function WrappedSpans({
38917
38983
  const lines2 = wrapSpans(spans, width);
38918
38984
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: lines2.map((line, i) => (
38919
38985
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional.
38920
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react38.Fragment, { children: [
38986
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react39.Fragment, { children: [
38921
38987
  line.map((span, j) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
38922
38988
  SpanView,
38923
38989
  {
@@ -38951,7 +39017,7 @@ function SpanView({
38951
39017
  __name(SpanView, "SpanView");
38952
39018
 
38953
39019
  // src/tui/Transcript.tsx
38954
- var import_react40 = __toESM(require_react(), 1);
39020
+ var import_react41 = __toESM(require_react(), 1);
38955
39021
 
38956
39022
  // src/tui/user-text-view.ts
38957
39023
  var USER_TEXT_LIMIT = 1e4;
@@ -39425,7 +39491,7 @@ function ContextGridRow({ view }) {
39425
39491
  __name(ContextGridRow, "ContextGridRow");
39426
39492
 
39427
39493
  // src/tui/ReadSearchGroup.tsx
39428
- var import_react39 = __toESM(require_react(), 1);
39494
+ var import_react40 = __toESM(require_react(), 1);
39429
39495
  var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
39430
39496
  function ReadSearchGroup({
39431
39497
  message,
@@ -39439,9 +39505,9 @@ function ReadSearchGroup({
39439
39505
  const screenReader = use_is_screen_reader_enabled_default();
39440
39506
  const motion = live && stdout.isTTY === true && !screenReader && motionAllowed();
39441
39507
  const { frame } = useAnimation({ isActive: motion, interval: 300 });
39442
- const [, setTick] = (0, import_react39.useState)(0);
39508
+ const [, setTick] = (0, import_react40.useState)(0);
39443
39509
  const queued = live && state?.hintQueued !== void 0 ? state.hintShownAt : void 0;
39444
- (0, import_react39.useEffect)(() => {
39510
+ (0, import_react40.useEffect)(() => {
39445
39511
  if (queued === void 0) return;
39446
39512
  const timer = setTimeout(
39447
39513
  () => setTick((n) => n + 1),
@@ -39832,7 +39898,7 @@ function Transcript({
39832
39898
  ] }) });
39833
39899
  }
39834
39900
  __name(Transcript, "Transcript");
39835
- var LiveRow = (0, import_react40.memo)(MessageRow);
39901
+ var LiveRow = (0, import_react41.memo)(MessageRow);
39836
39902
  function RawMessageRow({
39837
39903
  message,
39838
39904
  prev
@@ -40278,17 +40344,17 @@ function TranscriptScreen({
40278
40344
  hyperlinks = false,
40279
40345
  onClose
40280
40346
  }) {
40281
- const [showAll, setShowAll] = (0, import_react41.useState)(false);
40282
- const [offset, setOffset] = (0, import_react41.useState)(0);
40283
- const [contentRows, setContentRows] = (0, import_react41.useState)(0);
40284
- const content = (0, import_react41.useRef)(null);
40347
+ const [showAll, setShowAll] = (0, import_react42.useState)(false);
40348
+ const [offset, setOffset] = (0, import_react42.useState)(0);
40349
+ const [contentRows, setContentRows] = (0, import_react42.useState)(0);
40350
+ const content = (0, import_react42.useRef)(null);
40285
40351
  const height = Math.max(3, rows - FOOTER_ROWS - SCREEN_SLACK);
40286
40352
  const maxOffset = Math.max(0, contentRows - height);
40287
40353
  const at = Math.min(Math.max(pendingAt ?? messages.length, 0), messages.length);
40288
40354
  const ordered = pending ? [...messages.slice(0, at), pending, ...messages.slice(at)] : messages;
40289
40355
  const { hiddenCount, shown } = screenWindow(ordered, showAll);
40290
40356
  const divider = screenDivider(hiddenCount, showAll);
40291
- (0, import_react41.useEffect)(() => {
40357
+ (0, import_react42.useEffect)(() => {
40292
40358
  if (content.current) {
40293
40359
  const measured = measure_element_default(content.current).height;
40294
40360
  if (measured !== contentRows) setContentRows(measured);
@@ -42100,7 +42166,7 @@ function ChoicePicker({
42100
42166
  __name(ChoicePicker, "ChoicePicker");
42101
42167
 
42102
42168
  // src/tui/Composer.tsx
42103
- var import_react42 = __toESM(require_react(), 1);
42169
+ var import_react43 = __toESM(require_react(), 1);
42104
42170
 
42105
42171
  // src/integrations/clipboard/image-paths.ts
42106
42172
  import { readFile, stat } from "node:fs/promises";
@@ -42436,9 +42502,9 @@ var MAX_CLIPBOARD_BYTES = 64 * 1024 * 1024;
42436
42502
  var TOOL_TIMEOUT_MS = 3e3;
42437
42503
  var POWERSHELL_TIMEOUT_MS = 1e4;
42438
42504
  var CLIPBOARD_PROGRAMS = /(?:^|[\\/])(?:xclip|wl-paste|pbpaste|osascript|powershell(?:\.exe)?)$/i;
42439
- var runCommand = /* @__PURE__ */ __name((file, args, options) => new Promise((resolve10) => {
42505
+ var runCommand = /* @__PURE__ */ __name((file, args, options) => new Promise((resolve9) => {
42440
42506
  if (process.env[CLIPBOARD_KILL_SWITCH] === "1" && CLIPBOARD_PROGRAMS.test(file)) {
42441
- resolve10({ code: null, stdout: Buffer.alloc(0), timedOut: false, spawnFailed: true });
42507
+ resolve9({ code: null, stdout: Buffer.alloc(0), timedOut: false, spawnFailed: true });
42442
42508
  return;
42443
42509
  }
42444
42510
  const chunks = [];
@@ -42449,13 +42515,13 @@ var runCommand = /* @__PURE__ */ __name((file, args, options) => new Promise((re
42449
42515
  if (settled2) return;
42450
42516
  settled2 = true;
42451
42517
  clearTimeout(timer);
42452
- resolve10({ ...result, stdout: Buffer.concat(chunks), timedOut });
42518
+ resolve9({ ...result, stdout: Buffer.concat(chunks), timedOut });
42453
42519
  }, "finish");
42454
42520
  let child;
42455
42521
  try {
42456
42522
  child = spawn3(file, [...args], { stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
42457
42523
  } catch {
42458
- resolve10({ code: null, stdout: Buffer.alloc(0), timedOut: false, spawnFailed: true });
42524
+ resolve9({ code: null, stdout: Buffer.alloc(0), timedOut: false, spawnFailed: true });
42459
42525
  return;
42460
42526
  }
42461
42527
  const timer = setTimeout(() => {
@@ -44576,40 +44642,40 @@ function Composer({
44576
44642
  turnActive = false
44577
44643
  }) {
44578
44644
  const terminal = use_window_size_default();
44579
- const [value, setValueState] = (0, import_react42.useState)("");
44580
- const leftGestureRef = (0, import_react42.useRef)(new LeftGesture());
44581
- const valueRef = (0, import_react42.useRef)("");
44582
- const [cursor, setCursorState] = (0, import_react42.useState)(0);
44583
- const cursorRef = (0, import_react42.useRef)(0);
44584
- const [, setHistoryIndexState] = (0, import_react42.useState)(-1);
44585
- const historyIndexRef = (0, import_react42.useRef)(-1);
44586
- const historyDraftRef = (0, import_react42.useRef)(null);
44587
- const spansRef = (0, import_react42.useRef)([]);
44588
- const overridesRef = (0, import_react42.useRef)([]);
44589
- const [triggerVersion, setTriggerVersion] = (0, import_react42.useState)(0);
44590
- const [historySearch, setHistorySearchState] = (0, import_react42.useState)(null);
44591
- const historySearchRef = (0, import_react42.useRef)(null);
44592
- const verticalColumnRef = (0, import_react42.useRef)(null);
44593
- const killBufferRef = (0, import_react42.useRef)("");
44594
- const [selected, setSelected] = (0, import_react42.useState)(0);
44595
- const selectedRef = (0, import_react42.useRef)(0);
44596
- const pasteStoreRef = (0, import_react42.useRef)(/* @__PURE__ */ new Map());
44597
- const nextPasteIdRef = (0, import_react42.useRef)(1);
44598
- const [queuedHintEpisode, setQueuedHintEpisode] = (0, import_react42.useState)(() => ({
44645
+ const [value, setValueState] = (0, import_react43.useState)("");
44646
+ const leftGestureRef = (0, import_react43.useRef)(new LeftGesture());
44647
+ const valueRef = (0, import_react43.useRef)("");
44648
+ const [cursor, setCursorState] = (0, import_react43.useState)(0);
44649
+ const cursorRef = (0, import_react43.useRef)(0);
44650
+ const [, setHistoryIndexState] = (0, import_react43.useState)(-1);
44651
+ const historyIndexRef = (0, import_react43.useRef)(-1);
44652
+ const historyDraftRef = (0, import_react43.useRef)(null);
44653
+ const spansRef = (0, import_react43.useRef)([]);
44654
+ const overridesRef = (0, import_react43.useRef)([]);
44655
+ const [triggerVersion, setTriggerVersion] = (0, import_react43.useState)(0);
44656
+ const [historySearch, setHistorySearchState] = (0, import_react43.useState)(null);
44657
+ const historySearchRef = (0, import_react43.useRef)(null);
44658
+ const verticalColumnRef = (0, import_react43.useRef)(null);
44659
+ const killBufferRef = (0, import_react43.useRef)("");
44660
+ const [selected, setSelected] = (0, import_react43.useState)(0);
44661
+ const selectedRef = (0, import_react43.useRef)(0);
44662
+ const pasteStoreRef = (0, import_react43.useRef)(/* @__PURE__ */ new Map());
44663
+ const nextPasteIdRef = (0, import_react43.useRef)(1);
44664
+ const [queuedHintEpisode, setQueuedHintEpisode] = (0, import_react43.useState)(() => ({
44599
44665
  active: false,
44600
44666
  show: false,
44601
44667
  count: queuedHintCount?.read() ?? 0
44602
44668
  }));
44603
- const clearPastes = (0, import_react42.useCallback)(() => {
44669
+ const clearPastes = (0, import_react43.useCallback)(() => {
44604
44670
  pasteStoreRef.current = /* @__PURE__ */ new Map();
44605
44671
  nextPasteIdRef.current = 1;
44606
44672
  }, []);
44607
- const [attachments, setAttachments] = (0, import_react42.useState)([]);
44608
- const attachmentsRef = (0, import_react42.useRef)([]);
44609
- const attachmentIdsRef = (0, import_react42.useRef)(/* @__PURE__ */ new WeakMap());
44610
- const attachmentHighRef = (0, import_react42.useRef)(attachmentFloor);
44611
- const attachmentFloorRef = (0, import_react42.useRef)(attachmentFloor);
44612
- const idFor = (0, import_react42.useCallback)((attachment) => {
44673
+ const [attachments, setAttachments] = (0, import_react43.useState)([]);
44674
+ const attachmentsRef = (0, import_react43.useRef)([]);
44675
+ const attachmentIdsRef = (0, import_react43.useRef)(/* @__PURE__ */ new WeakMap());
44676
+ const attachmentHighRef = (0, import_react43.useRef)(attachmentFloor);
44677
+ const attachmentFloorRef = (0, import_react43.useRef)(attachmentFloor);
44678
+ const idFor = (0, import_react43.useCallback)((attachment) => {
44613
44679
  let id = attachmentIdsRef.current.get(attachment);
44614
44680
  if (id === void 0) {
44615
44681
  id = Math.max(attachmentHighRef.current, attachmentFloorRef.current) + 1;
@@ -44618,7 +44684,7 @@ function Composer({
44618
44684
  }
44619
44685
  return id;
44620
44686
  }, []);
44621
- (0, import_react42.useLayoutEffect)(() => {
44687
+ (0, import_react43.useLayoutEffect)(() => {
44622
44688
  const before = attachmentFloorRef.current;
44623
44689
  attachmentFloorRef.current = attachmentFloor;
44624
44690
  if (attachmentFloor >= before) {
@@ -44632,7 +44698,7 @@ function Composer({
44632
44698
  }
44633
44699
  attachmentHighRef.current = high;
44634
44700
  }, [attachmentFloor]);
44635
- const replaceAttachments = (0, import_react42.useCallback)(
44701
+ const replaceAttachments = (0, import_react43.useCallback)(
44636
44702
  (next) => {
44637
44703
  const resolved = typeof next === "function" ? next(attachmentsRef.current) : next;
44638
44704
  attachmentsRef.current = resolved;
@@ -44640,43 +44706,43 @@ function Composer({
44640
44706
  },
44641
44707
  []
44642
44708
  );
44643
- const editPreviousTimerRef = (0, import_react42.useRef)(null);
44644
- const setEditPreviousArmed = (0, import_react42.useCallback)((armed2) => {
44709
+ const editPreviousTimerRef = (0, import_react43.useRef)(null);
44710
+ const setEditPreviousArmed = (0, import_react43.useCallback)((armed2) => {
44645
44711
  if (editPreviousTimerRef.current) clearTimeout(editPreviousTimerRef.current);
44646
44712
  editPreviousTimerRef.current = armed2 ? setTimeout(() => {
44647
44713
  editPreviousTimerRef.current = null;
44648
44714
  }, REWIND_DOUBLE_ESC_MS) : null;
44649
44715
  }, []);
44650
- const clearArmRef = (0, import_react42.useRef)(null);
44651
- const disarmClear = (0, import_react42.useCallback)(() => {
44716
+ const clearArmRef = (0, import_react43.useRef)(null);
44717
+ const disarmClear = (0, import_react43.useCallback)(() => {
44652
44718
  if (clearArmRef.current === null) return;
44653
44719
  clearTimeout(clearArmRef.current);
44654
44720
  clearArmRef.current = null;
44655
44721
  onFooterNoticeRemove?.(ESC_CLEAR_KEY);
44656
44722
  }, [onFooterNoticeRemove]);
44657
- (0, import_react42.useEffect)(
44723
+ (0, import_react43.useEffect)(
44658
44724
  () => () => {
44659
44725
  if (editPreviousTimerRef.current) clearTimeout(editPreviousTimerRef.current);
44660
44726
  if (clearArmRef.current !== null) clearTimeout(clearArmRef.current);
44661
44727
  },
44662
44728
  []
44663
44729
  );
44664
- const restoredTokenRef = (0, import_react42.useRef)(null);
44665
- const draftPresenceRef = (0, import_react42.useRef)(false);
44666
- (0, import_react42.useEffect)(() => {
44730
+ const restoredTokenRef = (0, import_react43.useRef)(null);
44731
+ const draftPresenceRef = (0, import_react43.useRef)(false);
44732
+ (0, import_react43.useEffect)(() => {
44667
44733
  onDraftChange?.({
44668
44734
  text: expandChips(value, pasteStoreRef.current),
44669
44735
  ...attachments.length ? { attachments } : {}
44670
44736
  });
44671
44737
  }, [attachments, onDraftChange, value]);
44672
- (0, import_react42.useEffect)(() => {
44738
+ (0, import_react43.useEffect)(() => {
44673
44739
  const current = valueRef.current;
44674
44740
  const kept = attachmentsRef.current.filter(
44675
44741
  (attachment) => current.includes(chipFor(attachment, idFor(attachment)))
44676
44742
  );
44677
44743
  if (kept.length !== attachmentsRef.current.length) replaceAttachments(kept);
44678
44744
  }, [idFor, replaceAttachments, value]);
44679
- (0, import_react42.useEffect)(() => {
44745
+ (0, import_react43.useEffect)(() => {
44680
44746
  const hasDraft = value.trim().length > 0 || attachments.length > 0;
44681
44747
  if (hasDraft === draftPresenceRef.current) return;
44682
44748
  draftPresenceRef.current = hasDraft;
@@ -44714,7 +44780,7 @@ function Composer({
44714
44780
  );
44715
44781
  const menuTextWidth = Math.max(1, (terminal.columns ?? 80) - 6);
44716
44782
  const descriptionWidth = Math.max(8, menuTextWidth - commandColumnWidth - 1);
44717
- const setBuffer = (0, import_react42.useCallback)(
44783
+ const setBuffer = (0, import_react43.useCallback)(
44718
44784
  (nextValue, nextCursor = nextValue.length, origin = "recalled", spans) => {
44719
44785
  if (valueRef.current.length > 0 && nextValue.length === 0)
44720
44786
  leftGestureRef.current.noteEmptied();
@@ -44728,15 +44794,15 @@ function Composer({
44728
44794
  },
44729
44795
  []
44730
44796
  );
44731
- const setHistoryIndex = (0, import_react42.useCallback)((next) => {
44797
+ const setHistoryIndex = (0, import_react43.useCallback)((next) => {
44732
44798
  historyIndexRef.current = next;
44733
44799
  setHistoryIndexState(next);
44734
44800
  }, []);
44735
- const setHistorySearch = (0, import_react42.useCallback)((next) => {
44801
+ const setHistorySearch = (0, import_react43.useCallback)((next) => {
44736
44802
  historySearchRef.current = next;
44737
44803
  setHistorySearchState(next);
44738
44804
  }, []);
44739
- const setSelectedIndex = (0, import_react42.useCallback)((next) => {
44805
+ const setSelectedIndex = (0, import_react43.useCallback)((next) => {
44740
44806
  const resolved = typeof next === "function" ? next(selectedRef.current) : next;
44741
44807
  selectedRef.current = resolved;
44742
44808
  setSelected(resolved);
@@ -44765,7 +44831,7 @@ function Composer({
44765
44831
  else if (nearest.state === "suggested") setOverride(nearest, "armed");
44766
44832
  else setOverride(nearest, "dropped");
44767
44833
  }, "toggleNearestTrigger");
44768
- const chipsNow = (0, import_react42.useCallback)(
44834
+ const chipsNow = (0, import_react43.useCallback)(
44769
44835
  () => chipRanges(valueRef.current, {
44770
44836
  attachments: new Set(
44771
44837
  attachmentsRef.current.map((attachment) => chipFor(attachment, idFor(attachment)))
@@ -44780,9 +44846,9 @@ function Composer({
44780
44846
  setCursorState(at);
44781
44847
  }, "placeCursor");
44782
44848
  const wholeRange = /* @__PURE__ */ __name((start, end) => widenOverChips(chipsNow(), start, end), "wholeRange");
44783
- const undoRef = (0, import_react42.useRef)(createUndoStack());
44784
- const stashRef = (0, import_react42.useRef)(null);
44785
- const recordUndo = (0, import_react42.useCallback)((after, typed) => {
44849
+ const undoRef = (0, import_react43.useRef)(createUndoStack());
44850
+ const stashRef = (0, import_react43.useRef)(null);
44851
+ const recordUndo = (0, import_react43.useCallback)((after, typed) => {
44786
44852
  undoRef.current.record(
44787
44853
  {
44788
44854
  value: valueRef.current,
@@ -44794,7 +44860,7 @@ function Composer({
44794
44860
  typed
44795
44861
  );
44796
44862
  }, []);
44797
- const editBuffer = (0, import_react42.useCallback)(
44863
+ const editBuffer = (0, import_react43.useCallback)(
44798
44864
  (initialValue, initialCursor = initialValue.length, origin = "typed") => {
44799
44865
  let nextValue = initialValue;
44800
44866
  let nextCursor = initialCursor;
@@ -44830,7 +44896,7 @@ function Composer({
44830
44896
  },
44831
44897
  [chipsNow, recordUndo, setBuffer, setHistoryIndex, setHistorySearch]
44832
44898
  );
44833
- const reset = (0, import_react42.useCallback)(() => {
44899
+ const reset = (0, import_react43.useCallback)(() => {
44834
44900
  undoRef.current.clear();
44835
44901
  verticalColumnRef.current = null;
44836
44902
  historyDraftRef.current = null;
@@ -44851,8 +44917,8 @@ function Composer({
44851
44917
  setHistorySearch,
44852
44918
  setSelectedIndex
44853
44919
  ]);
44854
- const sendNowChordRef = (0, import_react42.useRef)(false);
44855
- const restoreDraft = (0, import_react42.useCallback)(
44920
+ const sendNowChordRef = (0, import_react43.useRef)(false);
44921
+ const restoreDraft = (0, import_react43.useCallback)(
44856
44922
  (draft) => {
44857
44923
  let restoredText = draft.text;
44858
44924
  const restoredAttachments = draft.attachments ? [...draft.attachments] : [];
@@ -44903,7 +44969,7 @@ function Composer({
44903
44969
  triggers
44904
44970
  ]
44905
44971
  );
44906
- (0, import_react42.useLayoutEffect)(() => {
44972
+ (0, import_react43.useLayoutEffect)(() => {
44907
44973
  if (!draftToRestore || restoredTokenRef.current === draftToRestore.token) return;
44908
44974
  restoredTokenRef.current = draftToRestore.token;
44909
44975
  restoreDraft(draftToRestore);
@@ -44942,10 +45008,10 @@ function Composer({
44942
45008
  replaceAttachments((p) => [...p, ...images]);
44943
45009
  editBuffer(value2, position, "pasted");
44944
45010
  }, "attachImages");
44945
- const imageReadRef = (0, import_react42.useRef)(false);
44946
- const deferredEnterRef = (0, import_react42.useRef)(null);
44947
- const keyHandlerRef = (0, import_react42.useRef)(null);
44948
- const lastEmptyPasteRef = (0, import_react42.useRef)(0);
45011
+ const imageReadRef = (0, import_react43.useRef)(false);
45012
+ const deferredEnterRef = (0, import_react43.useRef)(null);
45013
+ const keyHandlerRef = (0, import_react43.useRef)(null);
45014
+ const lastEmptyPasteRef = (0, import_react43.useRef)(0);
44949
45015
  const finishImageRead = /* @__PURE__ */ __name(() => {
44950
45016
  imageReadRef.current = false;
44951
45017
  const deferred = deferredEnterRef.current;
@@ -45629,7 +45695,7 @@ function Composer({
45629
45695
  const queuedHintWanted = (!disabled || railFocused) && value.length === 0 && queuedEdit?.available === true;
45630
45696
  const settledEpisode = nextQueuedHintEpisode(queuedHintEpisode, queuedHintWanted);
45631
45697
  if (settledEpisode !== queuedHintEpisode) setQueuedHintEpisode(settledEpisode);
45632
- (0, import_react42.useEffect)(() => {
45698
+ (0, import_react43.useEffect)(() => {
45633
45699
  if (queuedHintEpisode.active && queuedHintEpisode.show)
45634
45700
  queuedHintCount?.write(queuedHintEpisode.count);
45635
45701
  }, [queuedHintEpisode, queuedHintCount]);
@@ -45771,7 +45837,7 @@ function isDocumentLike(attachment) {
45771
45837
  __name(isDocumentLike, "isDocumentLike");
45772
45838
 
45773
45839
  // src/tui/ComposerFrame.tsx
45774
- var import_react43 = __toESM(require_react(), 1);
45840
+ var import_react44 = __toESM(require_react(), 1);
45775
45841
  var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
45776
45842
  var HYPERMODE_GLOW_MS = 880;
45777
45843
  function ComposerFrame({
@@ -45790,13 +45856,13 @@ function ComposerFrame({
45790
45856
  const showMode = mode !== void 0 && frameColumns >= mode.length + 5;
45791
45857
  const ruleColumns = Math.max(1, frameColumns - (showMode ? mode.length + 3 : 0));
45792
45858
  const motion = animate && stdout.isTTY === true && !screenReader && showMode && motionAllowed();
45793
- const [igniting, setIgniting] = (0, import_react43.useState)(false);
45794
- const previousActivation = (0, import_react43.useRef)(activation);
45859
+ const [igniting, setIgniting] = (0, import_react44.useState)(false);
45860
+ const previousActivation = (0, import_react44.useRef)(activation);
45795
45861
  const { time, reset } = useAnimation({
45796
45862
  isActive: igniting && motion && !hidden,
45797
45863
  interval: 80
45798
45864
  });
45799
- (0, import_react43.useEffect)(() => {
45865
+ (0, import_react44.useEffect)(() => {
45800
45866
  if (previousActivation.current === activation) return;
45801
45867
  previousActivation.current = activation;
45802
45868
  if (motion && !hidden) {
@@ -45804,7 +45870,7 @@ function ComposerFrame({
45804
45870
  setIgniting(true);
45805
45871
  } else setIgniting(false);
45806
45872
  }, [activation, hidden, motion, reset]);
45807
- (0, import_react43.useEffect)(() => {
45873
+ (0, import_react44.useEffect)(() => {
45808
45874
  if (igniting && (time >= HYPERMODE_GLOW_MS || !motion || hidden)) setIgniting(false);
45809
45875
  }, [hidden, igniting, motion, time]);
45810
45876
  const glowTime = igniting && motion && !hidden && time < HYPERMODE_GLOW_MS ? time : void 0;
@@ -46570,7 +46636,7 @@ function PermissionOverlay({
46570
46636
  __name(PermissionOverlay, "PermissionOverlay");
46571
46637
 
46572
46638
  // src/tui/Picker.tsx
46573
- var import_react45 = __toESM(require_react(), 1);
46639
+ var import_react46 = __toESM(require_react(), 1);
46574
46640
 
46575
46641
  // src/tui/credential-entry.ts
46576
46642
  function classifyCredential(entry, key) {
@@ -46761,11 +46827,11 @@ function initialProviderRow(rows, currentProvider, keyEntryFor) {
46761
46827
  __name(initialProviderRow, "initialProviderRow");
46762
46828
 
46763
46829
  // src/tui/use-selection-index.ts
46764
- var import_react44 = __toESM(require_react(), 1);
46830
+ var import_react45 = __toESM(require_react(), 1);
46765
46831
  function useSelectionIndex(initial) {
46766
- const [selection, setSelectionState] = (0, import_react44.useState)(initial);
46767
- const selectionRef = (0, import_react44.useRef)(initial);
46768
- const setSelection = (0, import_react44.useCallback)((next) => {
46832
+ const [selection, setSelectionState] = (0, import_react45.useState)(initial);
46833
+ const selectionRef = (0, import_react45.useRef)(initial);
46834
+ const setSelection = (0, import_react45.useCallback)((next) => {
46769
46835
  const resolved = typeof next === "function" ? next(selectionRef.current) : next;
46770
46836
  selectionRef.current = resolved;
46771
46837
  setSelectionState(resolved);
@@ -46870,14 +46936,14 @@ function Picker({
46870
46936
  notice,
46871
46937
  cancelExits = false
46872
46938
  }) {
46873
- const operationGenerationRef = (0, import_react45.useRef)(0);
46874
- const operationRef = (0, import_react45.useRef)(null);
46875
- const invalidateOperation = (0, import_react45.useCallback)(() => {
46939
+ const operationGenerationRef = (0, import_react46.useRef)(0);
46940
+ const operationRef = (0, import_react46.useRef)(null);
46941
+ const invalidateOperation = (0, import_react46.useCallback)(() => {
46876
46942
  operationGenerationRef.current += 1;
46877
46943
  operationRef.current?.controller.abort(new Error("The picker operation was cancelled."));
46878
46944
  operationRef.current = null;
46879
46945
  }, []);
46880
- const beginOperation = (0, import_react45.useCallback)(() => {
46946
+ const beginOperation = (0, import_react46.useCallback)(() => {
46881
46947
  invalidateOperation();
46882
46948
  const operation = {
46883
46949
  generation: operationGenerationRef.current,
@@ -46886,17 +46952,17 @@ function Picker({
46886
46952
  operationRef.current = operation;
46887
46953
  return operation;
46888
46954
  }, [invalidateOperation]);
46889
- const ownsOperation = (0, import_react45.useCallback)(
46955
+ const ownsOperation = (0, import_react46.useCallback)(
46890
46956
  (operation) => operationRef.current === operation && operationGenerationRef.current === operation.generation && !operation.controller.signal.aborted,
46891
46957
  []
46892
46958
  );
46893
- const finishOperation = (0, import_react45.useCallback)(
46959
+ const finishOperation = (0, import_react46.useCallback)(
46894
46960
  (operation) => {
46895
46961
  if (operationRef.current === operation) operationRef.current = null;
46896
46962
  },
46897
46963
  []
46898
46964
  );
46899
- (0, import_react45.useEffect)(() => invalidateOperation, [invalidateOperation]);
46965
+ (0, import_react46.useEffect)(() => invalidateOperation, [invalidateOperation]);
46900
46966
  const rows = providerListRows(detected, selectionKind !== "signed-in-subscription");
46901
46967
  const keyEntryOffered = onCredential !== void 0 && selectionKind !== "signed-in-subscription";
46902
46968
  const initialSelection = initialView === "subscriptions" ? 0 : initialProviderRow(rows, currentProvider, keyEntryFor);
@@ -46908,20 +46974,20 @@ function Picker({
46908
46974
  const terminal = use_window_size_default();
46909
46975
  const contentWidth = pickerContentWidth(terminal.columns ?? 80);
46910
46976
  const noticeLines = notice ? wrapChoiceText(notice, contentWidth).length : 0;
46911
- const [errorHint, setErrorHint] = (0, import_react45.useState)(null);
46912
- const [modelQuery, setModelQuery] = (0, import_react45.useState)(null);
46913
- const modelQueryRef = (0, import_react45.useRef)(null);
46914
- const [modelPhase, setModelPhase] = (0, import_react45.useState)(null);
46915
- const [loginPhase, setLoginPhase] = (0, import_react45.useState)(initialView === "subscriptions");
46916
- (0, import_react45.useEffect)(() => {
46977
+ const [errorHint, setErrorHint] = (0, import_react46.useState)(null);
46978
+ const [modelQuery, setModelQuery] = (0, import_react46.useState)(null);
46979
+ const modelQueryRef = (0, import_react46.useRef)(null);
46980
+ const [modelPhase, setModelPhase] = (0, import_react46.useState)(null);
46981
+ const [loginPhase, setLoginPhase] = (0, import_react46.useState)(initialView === "subscriptions");
46982
+ (0, import_react46.useEffect)(() => {
46917
46983
  setLoginPhase(initialView === "subscriptions");
46918
46984
  if (initialView !== "models") setModelPhase(null);
46919
46985
  }, [initialView]);
46920
- const [loginEntry, setLoginEntry] = (0, import_react45.useState)(null);
46921
- const [keyEntry, setKeyEntry] = (0, import_react45.useState)(null);
46922
- const [pathVendor, setPathVendor] = (0, import_react45.useState)(null);
46986
+ const [loginEntry, setLoginEntry] = (0, import_react46.useState)(null);
46987
+ const [keyEntry, setKeyEntry] = (0, import_react46.useState)(null);
46988
+ const [pathVendor, setPathVendor] = (0, import_react46.useState)(null);
46923
46989
  const pathRow = pathVendor === null ? null : rows.find((row2) => row2.vendor === pathVendor) ?? null;
46924
- const openModels = (0, import_react45.useCallback)(
46990
+ const openModels = (0, import_react46.useCallback)(
46925
46991
  (current, returnToProviders = true) => {
46926
46992
  const operation = beginOperation();
46927
46993
  modelQueryRef.current = null;
@@ -46971,8 +47037,8 @@ function Picker({
46971
47037
  setCursor
46972
47038
  ]
46973
47039
  );
46974
- const initialModelsOpened = (0, import_react45.useRef)(false);
46975
- (0, import_react45.useEffect)(() => {
47040
+ const initialModelsOpened = (0, import_react46.useRef)(false);
47041
+ (0, import_react46.useEffect)(() => {
46976
47042
  if (initialView !== "models" || initialModelsOpened.current) return;
46977
47043
  initialModelsOpened.current = true;
46978
47044
  const current = detected.find((provider) => provider.entry.id === currentProvider);
@@ -47851,7 +47917,7 @@ function ProviderSetupRows({
47851
47917
  const index = visible.start + offset;
47852
47918
  const heading = firstUndetected !== -1 && (index === firstUndetected || offset === 0 && index > firstUndetected) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box_default, { marginTop: offset === 0 ? 0 : 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: theme.text.muted, children: NOT_DETECTED_HEADING }) }, "heading") : null;
47853
47919
  const detected = row2.detected.length > 0;
47854
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react45.Fragment, { children: [
47920
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react46.Fragment, { children: [
47855
47921
  heading,
47856
47922
  detected ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
47857
47923
  DetectedVendorRow,
@@ -48147,7 +48213,7 @@ function describeSource(d) {
48147
48213
  __name(describeSource, "describeSource");
48148
48214
 
48149
48215
  // src/tui/PlanApprovalOverlay.tsx
48150
- var import_react46 = __toESM(require_react(), 1);
48216
+ var import_react47 = __toESM(require_react(), 1);
48151
48217
 
48152
48218
  // src/tui/consent-timing.ts
48153
48219
  var APPROVAL_SETTLE_MS = 350;
@@ -48174,10 +48240,10 @@ function PlanApprovalOverlay({
48174
48240
  }) {
48175
48241
  const choices2 = planApprovalRows(request.bypassAvailable);
48176
48242
  const textRow = choices2.length - 1;
48177
- const [cursor, setCursor] = (0, import_react46.useState)(0);
48178
- const [text, setText] = (0, import_react46.useState)("");
48179
- const [offset, setOffset] = (0, import_react46.useState)(0);
48180
- const shownAt = (0, import_react46.useRef)(now());
48243
+ const [cursor, setCursor] = (0, import_react47.useState)(0);
48244
+ const [text, setText] = (0, import_react47.useState)("");
48245
+ const [offset, setOffset] = (0, import_react47.useState)(0);
48246
+ const shownAt = (0, import_react47.useRef)(now());
48181
48247
  const pageRows2 = planPageRows(terminalRows);
48182
48248
  const planRows = permissionReviewRows(request.plan.trimEnd(), columns);
48183
48249
  const maxOffset = Math.max(0, planRows.length - pageRows2);
@@ -48324,7 +48390,7 @@ function PlanApprovalOverlay({
48324
48390
  __name(PlanApprovalOverlay, "PlanApprovalOverlay");
48325
48391
 
48326
48392
  // src/tui/QuestionDialog.tsx
48327
- var import_react47 = __toESM(require_react(), 1);
48393
+ var import_react48 = __toESM(require_react(), 1);
48328
48394
 
48329
48395
  // src/tui/question-dialog.ts
48330
48396
  function dialogQuestions(question) {
@@ -48401,7 +48467,7 @@ function QuestionDialog({ question, columns, onAnswer }) {
48401
48467
  const count2 = items.length;
48402
48468
  const lone = count2 === 1;
48403
48469
  const width = Math.max(10, (columns ?? terminal.columns ?? 80) - 4);
48404
- const state = (0, import_react47.useRef)({
48470
+ const state = (0, import_react48.useRef)({
48405
48471
  tab: 0,
48406
48472
  cursors: items.map(() => 0),
48407
48473
  picked: items.map(() => []),
@@ -48409,8 +48475,8 @@ function QuestionDialog({ question, columns, onAnswer }) {
48409
48475
  typing: null,
48410
48476
  reviewCursor: 0
48411
48477
  });
48412
- const [, redraw] = (0, import_react47.useState)(0);
48413
- const done = (0, import_react47.useRef)(false);
48478
+ const [, redraw] = (0, import_react48.useState)(0);
48479
+ const done = (0, import_react48.useRef)(false);
48414
48480
  const s = state.current;
48415
48481
  const picks = /* @__PURE__ */ __name(() => ({ picked: s.picked, text: s.text }), "picks");
48416
48482
  const finish = /* @__PURE__ */ __name((answer, summary2 = []) => {
@@ -49249,7 +49315,7 @@ function RewindConfirm({ rows, state, options, now }) {
49249
49315
  __name(RewindConfirm, "RewindConfirm");
49250
49316
 
49251
49317
  // src/tui/SaveSkillOverlay.tsx
49252
- var import_react48 = __toESM(require_react(), 1);
49318
+ var import_react49 = __toESM(require_react(), 1);
49253
49319
  var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
49254
49320
  var SAVE_SKILL_CHOICES = [
49255
49321
  { answer: "user", label: "Save to user" },
@@ -49287,8 +49353,8 @@ function targetLines(target, cwd2, suggested) {
49287
49353
  __name(targetLines, "targetLines");
49288
49354
  function SaveSkillOverlay({ request, cwd: cwd2, columns, rows, onAnswer }) {
49289
49355
  const width = Math.max(20, (columns ?? 80) - 4);
49290
- const [selected, setSelected] = (0, import_react48.useState)(SAVE_SKILL_CHOICES.length - 1);
49291
- const [offset, setOffset] = (0, import_react48.useState)(0);
49356
+ const [selected, setSelected] = (0, import_react49.useState)(SAVE_SKILL_CHOICES.length - 1);
49357
+ const [offset, setOffset] = (0, import_react49.useState)(0);
49292
49358
  const header = [
49293
49359
  `Save skill "${request.draft.name}"? PROPOSED BY THE MODEL \u2014 a skill is read by every later conversation that loads it.`,
49294
49360
  `Origin ${request.draft.origin}`,
@@ -49377,7 +49443,7 @@ function SaveSkillOverlay({ request, cwd: cwd2, columns, rows, onAnswer }) {
49377
49443
  __name(SaveSkillOverlay, "SaveSkillOverlay");
49378
49444
 
49379
49445
  // src/tui/ScheduleReviewOverlay.tsx
49380
- var import_react49 = __toESM(require_react(), 1);
49446
+ var import_react50 = __toESM(require_react(), 1);
49381
49447
  var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
49382
49448
  function choices(action) {
49383
49449
  return action === "create" ? [
@@ -49417,6 +49483,9 @@ function scheduleReviewSummary(request) {
49417
49483
  `Tokens ${preview3.budget.tokenBudget === 0 ? "No token limit per run" : `Up to ${preview3.budget.tokenBudget.toLocaleString("en-US")} per run`}`
49418
49484
  ],
49419
49485
  ...preview3.script?.report === "json-v1" ? ["Script report JSON v1: quiet/changed; optional scheduler state."] : [],
49486
+ ...preview3.gate ? [
49487
+ "Gate A command runs before every run on your computer as you; the model is called only when it exits 0 and prints something. Read it below."
49488
+ ] : [],
49420
49489
  ...preview3.networkAccess ? ["Network This run can reach the network."] : [],
49421
49490
  ...preview3.notifyOnFinish === false ? ["Notices Generic success notices off; failures still notify."] : [],
49422
49491
  ...request.permissionsChange ? ["Permissions change from the next run."] : [],
@@ -49456,6 +49525,7 @@ function compactSummary(request) {
49456
49525
  preview3.workspace === "none" ? "Host script \xB7 private no-project workspace; host authority" : "Host script \xB7 folder is cwd, not a write boundary"
49457
49526
  ] : [`When ${preview3.schedule}`],
49458
49527
  ...script ? ["Shell checks only; interpreter code needs review"] : [],
49528
+ ...preview3.gate ? ["Gate command runs first on your computer; read it below"] : [],
49459
49529
  ...preview3.script?.report === "json-v1" ? ["JSON v1 report \xB7 quiet/changed"] : [],
49460
49530
  `${preview3.networkAccess ? "Network access \xB7 " : ""}${warningCount} warning${warningCount === 1 ? "" : "s"} \xB7 read details`
49461
49531
  ];
@@ -49469,9 +49539,9 @@ function ScheduleReviewOverlay({
49469
49539
  }) {
49470
49540
  const width = Math.max(20, (columns ?? 80) - 4);
49471
49541
  const options = choices(request.action);
49472
- const [selected, setSelected] = (0, import_react49.useState)(0);
49473
- const [offset, setOffset] = (0, import_react49.useState)(0);
49474
- const [reachedEnd, setReachedEnd] = (0, import_react49.useState)(false);
49542
+ const [selected, setSelected] = (0, import_react50.useState)(0);
49543
+ const [offset, setOffset] = (0, import_react50.useState)(0);
49544
+ const [reachedEnd, setReachedEnd] = (0, import_react50.useState)(false);
49475
49545
  const terminalRows = rows ?? 24;
49476
49546
  const canReview = terminalRows >= 14 && (columns ?? 80) >= 60;
49477
49547
  const summary2 = scheduleReviewSummary(request);
@@ -49481,7 +49551,7 @@ function ScheduleReviewOverlay({
49481
49551
  text: truncateChoiceText(terminalDisplayText(line), width),
49482
49552
  continued: false
49483
49553
  }));
49484
- const body = (0, import_react49.useMemo)(() => wrapExact(request.fullText, width - 2), [request.fullText, width]);
49554
+ const body = (0, import_react50.useMemo)(() => wrapExact(request.fullText, width - 2), [request.fullText, width]);
49485
49555
  const chrome = summaryRows.length + 5;
49486
49556
  const window2 = Math.max(1, terminalRows - chrome);
49487
49557
  const last = Math.max(0, body.length - window2);
@@ -49966,7 +50036,7 @@ function TaskList({ tasks, expanded = false }) {
49966
50036
  __name(TaskList, "TaskList");
49967
50037
 
49968
50038
  // src/tui/TextPrompt.tsx
49969
- var import_react50 = __toESM(require_react(), 1);
50039
+ var import_react51 = __toESM(require_react(), 1);
49970
50040
  var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
49971
50041
  var graphemeSegmenter2 = new Intl.Segmenter(void 0, {
49972
50042
  granularity: "grapheme"
@@ -50057,19 +50127,19 @@ function TextPrompt({
50057
50127
  const terminal = use_window_size_default();
50058
50128
  const contentWidth = Math.max(1, (columns ?? terminal.columns ?? 80) - 4);
50059
50129
  const inputWidth = Math.max(1, contentWidth - 2);
50060
- const [value, setValueState] = (0, import_react50.useState)(initialValue);
50061
- const valueRef = (0, import_react50.useRef)(initialValue);
50062
- const [cursor, setCursorState] = (0, import_react50.useState)(initialValue.length);
50063
- const cursorRef = (0, import_react50.useRef)(initialValue.length);
50064
- const [notice, setNotice] = (0, import_react50.useState)(null);
50065
- const setBuffer = (0, import_react50.useCallback)((next, nextCursor = next.length) => {
50130
+ const [value, setValueState] = (0, import_react51.useState)(initialValue);
50131
+ const valueRef = (0, import_react51.useRef)(initialValue);
50132
+ const [cursor, setCursorState] = (0, import_react51.useState)(initialValue.length);
50133
+ const cursorRef = (0, import_react51.useRef)(initialValue.length);
50134
+ const [notice, setNotice] = (0, import_react51.useState)(null);
50135
+ const setBuffer = (0, import_react51.useCallback)((next, nextCursor = next.length) => {
50066
50136
  valueRef.current = next;
50067
50137
  cursorRef.current = nextCursor;
50068
50138
  setValueState(next);
50069
50139
  setCursorState(nextCursor);
50070
50140
  setNotice(null);
50071
50141
  }, []);
50072
- const setCursor = (0, import_react50.useCallback)((next) => {
50142
+ const setCursor = (0, import_react51.useCallback)((next) => {
50073
50143
  cursorRef.current = next;
50074
50144
  setCursorState(next);
50075
50145
  }, []);
@@ -50217,7 +50287,7 @@ function ThemeSample({ width }) {
50217
50287
  __name(ThemeSample, "ThemeSample");
50218
50288
 
50219
50289
  // src/tui/TranscriptScrollView.tsx
50220
- var import_react51 = __toESM(require_react(), 1);
50290
+ var import_react52 = __toESM(require_react(), 1);
50221
50291
 
50222
50292
  // src/tui/transcript-scroll.ts
50223
50293
  var GUTTER = 2;
@@ -50386,13 +50456,13 @@ function TranscriptScrollView({
50386
50456
  columns,
50387
50457
  onClose
50388
50458
  }) {
50389
- const rows = (0, import_react51.useMemo)(
50459
+ const rows = (0, import_react52.useMemo)(
50390
50460
  () => transcriptScrollRows(messages, pending, pendingAt, columns),
50391
50461
  [messages, pending, pendingAt, columns]
50392
50462
  );
50393
- const [state, setState] = (0, import_react51.useState)(() => openScroll(rows, height));
50463
+ const [state, setState] = (0, import_react52.useState)(() => openScroll(rows, height));
50394
50464
  const view = state === null ? "latest" : syncScroll(state, rows, height);
50395
- (0, import_react51.useEffect)(() => {
50465
+ (0, import_react52.useEffect)(() => {
50396
50466
  if (view === "latest") {
50397
50467
  onClose();
50398
50468
  return;
@@ -51762,7 +51832,7 @@ __name(editDraftInExternalEditor, "editDraftInExternalEditor");
51762
51832
  async function runEditorProcess(command, draftPath, options) {
51763
51833
  const executable = command[0];
51764
51834
  if (!executable) throw new ExternalEditorError("the editor command is empty");
51765
- await new Promise((resolve10, reject) => {
51835
+ await new Promise((resolve9, reject) => {
51766
51836
  let settled2 = false;
51767
51837
  const settle = /* @__PURE__ */ __name((action) => {
51768
51838
  if (settled2) return;
@@ -51789,7 +51859,7 @@ async function runEditorProcess(command, draftPath, options) {
51789
51859
  child.once(
51790
51860
  "exit",
51791
51861
  (code, signal) => settle(() => {
51792
- if (code === 0) resolve10();
51862
+ if (code === 0) resolve9();
51793
51863
  else if (signal) reject(new ExternalEditorError(`the editor stopped on signal ${signal}`));
51794
51864
  else reject(new ExternalEditorError(`the editor exited with status ${code ?? "unknown"}`));
51795
51865
  })
@@ -51808,7 +51878,7 @@ async function fastModeBlocker(providerId, model, now = Date.now(), otherHost =
51808
51878
  return `Fast mode is offered on the vendor's own endpoint only, and requests here go to ${otherHost}.`;
51809
51879
  }
51810
51880
  if (!model) return "Fast mode needs a model; pick one with /model.";
51811
- const { resolveFastModeVerdict } = await import("./dist-IPQPISKD.js");
51881
+ const { resolveFastModeVerdict } = await import("./dist-PKKDBDSA.js");
51812
51882
  const verdict = resolveFastModeVerdict(model, now);
51813
51883
  return verdict.ok ? void 0 : verdict.reason;
51814
51884
  }
@@ -51831,7 +51901,7 @@ function fastDroppedMessage(reason) {
51831
51901
  __name(fastDroppedMessage, "fastDroppedMessage");
51832
51902
 
51833
51903
  // src/tui/fullscreen/FullscreenTranscript.tsx
51834
- var import_react53 = __toESM(require_react(), 1);
51904
+ var import_react54 = __toESM(require_react(), 1);
51835
51905
 
51836
51906
  // src/tui/fullscreen/joiners.ts
51837
51907
  var BLANK = /^\s$/u;
@@ -51858,7 +51928,7 @@ function wrapJoiners(source, rows) {
51858
51928
  __name(wrapJoiners, "wrapJoiners");
51859
51929
 
51860
51930
  // src/tui/fullscreen/markdown-rows.ts
51861
- var import_react52 = __toESM(require_react(), 1);
51931
+ var import_react53 = __toESM(require_react(), 1);
51862
51932
 
51863
51933
  // src/tui/fullscreen/rows.ts
51864
51934
  function plainRow(row2, joins = null) {
@@ -51919,22 +51989,42 @@ __name(wrappedRows, "wrappedRows");
51919
51989
  function codeLine2(line, width) {
51920
51990
  if (stringWidth(line) <= width) return [line];
51921
51991
  const drawn = render_to_string_default(
51922
- (0, import_react52.createElement)(Box_default, { width }, (0, import_react52.createElement)(Text, { wrap: "wrap" }, line)),
51992
+ (0, import_react53.createElement)(Box_default, { width }, (0, import_react53.createElement)(Text, { wrap: "wrap" }, line)),
51923
51993
  { columns: width }
51924
51994
  );
51925
51995
  return drawn.split("\n");
51926
51996
  }
51927
51997
  __name(codeLine2, "codeLine");
51928
- function blockRows(block, width, color) {
51998
+ function blockRows(block, width, color, italic) {
51999
+ const prose = /* @__PURE__ */ __name((s) => italic ? { ...s, italic: true } : s, "prose");
51929
52000
  switch (block.type) {
51930
52001
  case "heading": {
51931
- const { lines: lines2, joins } = wrappedRows(block.text, width, color, (s) => ({ ...s, bold: true }));
52002
+ const style = headingStyle(block.level);
52003
+ const headingColor = style.color === "accent" ? theme.accent.user : style.color === "muted" ? theme.text.muted : color;
52004
+ const { lines: lines2, joins } = wrappedRows(
52005
+ block.text,
52006
+ width,
52007
+ headingColor,
52008
+ (s) => prose({ ...s, bold: true, ...style.underline ? { underline: true } : {} })
52009
+ );
51932
52010
  return lines2.map((line, i) => row(line, joins[i] ?? null));
51933
52011
  }
52012
+ case "rule":
52013
+ return [row([{ text: "\u2500".repeat(ruleWidth(width)), color: theme.border.default }])];
52014
+ case "quote": {
52015
+ const inner = block.blocks.length > 0 ? blocksRows(block.blocks, width - QUOTE_BAR_WIDTH, color, true) : [row([])];
52016
+ return inner.map(
52017
+ (r) => row(
52018
+ [{ text: QUOTE_BAR, color: theme.border.default }, { text: " " }, ...r.spans],
52019
+ r.joins,
52020
+ r.lead + QUOTE_BAR_WIDTH
52021
+ )
52022
+ );
52023
+ }
51934
52024
  case "bullet": {
51935
52025
  const marker = block.ordered ? `${block.marker}.` : block.marker;
51936
52026
  const lead = marker.length + 1;
51937
- const { lines: lines2, joins } = wrappedRows(block.text, width - lead, color, (s) => s);
52027
+ const { lines: lines2, joins } = wrappedRows(block.text, width - lead, color, prose);
51938
52028
  return lines2.map(
51939
52029
  (line, i) => row(
51940
52030
  [
@@ -51962,23 +52052,26 @@ function blockRows(block, width, color) {
51962
52052
  );
51963
52053
  });
51964
52054
  default: {
51965
- const { lines: lines2, joins } = wrappedRows(block.text, width, color, (s) => s);
52055
+ const { lines: lines2, joins } = wrappedRows(block.text, width, color, prose);
51966
52056
  return lines2.map((line, i) => row(line, joins[i] ?? null));
51967
52057
  }
51968
52058
  }
51969
52059
  }
51970
52060
  __name(blockRows, "blockRows");
51971
- function markdownRows(text, width, color) {
51972
- const blocks = parseMarkdown(terminalDisplayText(text));
52061
+ function blocksRows(blocks, width, color, italic) {
51973
52062
  const rows = [];
51974
52063
  blocks.forEach((block, i) => {
51975
52064
  const prev = blocks[i - 1];
51976
52065
  const gap = !prev || block.type === "bullet" && prev.type === "bullet" ? 0 : 1;
51977
52066
  if (gap) rows.push(row([]));
51978
- rows.push(...blockRows(block, width, color));
52067
+ rows.push(...blockRows(block, width, color, italic));
51979
52068
  });
51980
52069
  return rows;
51981
52070
  }
52071
+ __name(blocksRows, "blocksRows");
52072
+ function markdownRows(text, width, color) {
52073
+ return blocksRows(parseMarkdown(terminalDisplayText(text)), width, color, false);
52074
+ }
51982
52075
  __name(markdownRows, "markdownRows");
51983
52076
 
51984
52077
  // src/tui/fullscreen/viewport.ts
@@ -52534,16 +52627,16 @@ function FullscreenTranscript({
52534
52627
  control,
52535
52628
  noteMs
52536
52629
  }) {
52537
- const cache3 = (0, import_react53.useRef)(createLayoutCache()).current;
52630
+ const cache3 = (0, import_react54.useRef)(createLayoutCache()).current;
52538
52631
  const epoch = useThemeEpoch();
52539
52632
  const click = subscribePointer !== void 0;
52540
- const [open, setOpen] = (0, import_react53.useState)(() => /* @__PURE__ */ new Set());
52541
- const openRef = (0, import_react53.useRef)(open);
52542
- const { rows, index } = (0, import_react53.useMemo)(
52633
+ const [open, setOpen] = (0, import_react54.useState)(() => /* @__PURE__ */ new Set());
52634
+ const openRef = (0, import_react54.useRef)(open);
52635
+ const { rows, index } = (0, import_react54.useMemo)(
52543
52636
  () => layoutTranscript(messages, pending, pendingAt, columns, cache3, { click, open }),
52544
52637
  [messages, pending, pendingAt, columns, cache3, epoch, click, open]
52545
52638
  );
52546
- (0, import_react53.useEffect)(() => {
52639
+ (0, import_react54.useEffect)(() => {
52547
52640
  if (open.size === 0) return;
52548
52641
  const present = new Set(index.ids);
52549
52642
  const kept = [...open].filter((id) => present.has(id));
@@ -52552,10 +52645,10 @@ function FullscreenTranscript({
52552
52645
  openRef.current = next;
52553
52646
  setOpen(next);
52554
52647
  }, [open, index]);
52555
- const [view, setView] = (0, import_react53.useState)(FOLLOWING);
52556
- const boxRef = (0, import_react53.useRef)(null);
52557
- const roomRef = (0, import_react53.useRef)(maxRows);
52558
- const room = (0, import_react53.useCallback)(() => {
52648
+ const [view, setView] = (0, import_react54.useState)(FOLLOWING);
52649
+ const boxRef = (0, import_react54.useRef)(null);
52650
+ const roomRef = (0, import_react54.useRef)(maxRows);
52651
+ const room = (0, import_react54.useCallback)(() => {
52559
52652
  const node = boxRef.current;
52560
52653
  if (node) {
52561
52654
  const measured = measure_element_default(node).height;
@@ -52564,32 +52657,32 @@ function FullscreenTranscript({
52564
52657
  return Math.max(1, Math.min(roomRef.current, maxRows) - 1);
52565
52658
  }, [maxRows]);
52566
52659
  const synced = syncView(view, index, Math.max(1, roomRef.current - 1));
52567
- (0, import_react53.useEffect)(() => {
52660
+ (0, import_react54.useEffect)(() => {
52568
52661
  if (synced !== view) setView(synced);
52569
52662
  }, [synced, view]);
52570
- const latest = (0, import_react53.useRef)({ synced, index, rows, messages, pending, pendingAt, columns });
52663
+ const latest = (0, import_react54.useRef)({ synced, index, rows, messages, pending, pendingAt, columns });
52571
52664
  latest.current = { synced, index, rows, messages, pending, pendingAt, columns };
52572
- const scroll = (0, import_react53.useCallback)(
52665
+ const scroll = (0, import_react54.useCallback)(
52573
52666
  (move) => {
52574
52667
  const { synced: state, index: now } = latest.current;
52575
52668
  setView(moveView(state, move, now, room()));
52576
52669
  },
52577
52670
  [room]
52578
52671
  );
52579
- (0, import_react53.useEffect)(
52672
+ (0, import_react54.useEffect)(
52580
52673
  () => subscribeWheel((direction) => scroll(direction === "up" ? "line-up" : "line-down")),
52581
52674
  [subscribeWheel, scroll]
52582
52675
  );
52583
52676
  const textWidth = Math.max(1, columns - GUTTER2);
52584
- const [selection, setSelection] = (0, import_react53.useState)(null);
52585
- const selectionRef = (0, import_react53.useRef)(null);
52586
- const updateSelection = (0, import_react53.useCallback)((next) => {
52677
+ const [selection, setSelection] = (0, import_react54.useState)(null);
52678
+ const selectionRef = (0, import_react54.useRef)(null);
52679
+ const updateSelection = (0, import_react54.useCallback)((next) => {
52587
52680
  selectionRef.current = next;
52588
52681
  setSelection(next);
52589
52682
  }, []);
52590
- const [note, setNote] = (0, import_react53.useState)(null);
52591
- const noteTimer = (0, import_react53.useRef)(null);
52592
- const showNote = (0, import_react53.useCallback)(
52683
+ const [note, setNote] = (0, import_react54.useState)(null);
52684
+ const noteTimer = (0, import_react54.useRef)(null);
52685
+ const showNote = (0, import_react54.useCallback)(
52593
52686
  (report) => {
52594
52687
  setNote(report);
52595
52688
  if (noteTimer.current) clearTimeout(noteTimer.current);
@@ -52603,19 +52696,19 @@ function FullscreenTranscript({
52603
52696
  },
52604
52697
  [noteMs]
52605
52698
  );
52606
- (0, import_react53.useEffect)(
52699
+ (0, import_react54.useEffect)(
52607
52700
  () => () => {
52608
52701
  if (noteTimer.current) clearTimeout(noteTimer.current);
52609
52702
  },
52610
52703
  []
52611
52704
  );
52612
- const widthRef = (0, import_react53.useRef)(textWidth);
52613
- (0, import_react53.useEffect)(() => {
52705
+ const widthRef = (0, import_react54.useRef)(textWidth);
52706
+ (0, import_react54.useEffect)(() => {
52614
52707
  if (widthRef.current === textWidth) return;
52615
52708
  widthRef.current = textWidth;
52616
52709
  if (selectionRef.current) updateSelection(null);
52617
52710
  }, [textWidth, updateSelection]);
52618
- const copySelection = (0, import_react53.useCallback)(
52711
+ const copySelection = (0, import_react54.useCallback)(
52619
52712
  (dragging) => {
52620
52713
  const { rows: now } = latest.current;
52621
52714
  const text = selectedText(now, textWidth, dragging.selection);
@@ -52627,8 +52720,8 @@ function FullscreenTranscript({
52627
52720
  },
52628
52721
  [copy, showNote, textWidth, updateSelection]
52629
52722
  );
52630
- const clicks = (0, import_react53.useRef)(new ClickCounter(() => Date.now(), DOUBLE_CLICK_MS)).current;
52631
- const geometryRef = (0, import_react53.useRef)({
52723
+ const clicks = (0, import_react54.useRef)(new ClickCounter(() => Date.now(), DOUBLE_CLICK_MS)).current;
52724
+ const geometryRef = (0, import_react54.useRef)({
52632
52725
  top: 1,
52633
52726
  height: maxRows,
52634
52727
  from: 0,
@@ -52637,7 +52730,7 @@ function FullscreenTranscript({
52637
52730
  left: 1 + SCREEN_PADDING + GUTTER2,
52638
52731
  cols: textWidth
52639
52732
  });
52640
- const toggleAt = (0, import_react53.useCallback)(
52733
+ const toggleAt = (0, import_react54.useCallback)(
52641
52734
  (line) => {
52642
52735
  const now = latest.current;
52643
52736
  const { id, offset } = anchorAt(now.index, line);
@@ -52659,7 +52752,7 @@ function FullscreenTranscript({
52659
52752
  },
52660
52753
  [cache3, click, room]
52661
52754
  );
52662
- const pointer = (0, import_react53.useCallback)(
52755
+ const pointer = (0, import_react54.useCallback)(
52663
52756
  (report) => {
52664
52757
  const node = boxRef.current;
52665
52758
  const geometry = {
@@ -52714,19 +52807,19 @@ function FullscreenTranscript({
52714
52807
  },
52715
52808
  [clicks, click, copyOnSelect, copySelection, scroll, showNote, toggleAt, updateSelection]
52716
52809
  );
52717
- (0, import_react53.useEffect)(
52810
+ (0, import_react54.useEffect)(
52718
52811
  () => subscribePointer ? subscribePointer(pointer) : void 0,
52719
52812
  [subscribePointer, pointer]
52720
52813
  );
52721
- const [search, setSearch] = (0, import_react53.useState)(null);
52722
- const searchRef = (0, import_react53.useRef)(null);
52723
- const savedView = (0, import_react53.useRef)(FOLLOWING);
52724
- const matches = (0, import_react53.useMemo)(
52814
+ const [search, setSearch] = (0, import_react54.useState)(null);
52815
+ const searchRef = (0, import_react54.useRef)(null);
52816
+ const savedView = (0, import_react54.useRef)(FOLLOWING);
52817
+ const matches = (0, import_react54.useMemo)(
52725
52818
  () => search ? findMatches(rows, search.query) : [],
52726
52819
  [rows, search]
52727
52820
  );
52728
52821
  const currentIndex = search?.cursor ? matches.findIndex((m) => m.row === search.cursor?.row && m.from === search.cursor?.from) : -1;
52729
- const updateSearch = (0, import_react53.useCallback)(
52822
+ const updateSearch = (0, import_react54.useCallback)(
52730
52823
  (next) => {
52731
52824
  const was = searchRef.current !== null;
52732
52825
  searchRef.current = next;
@@ -52735,7 +52828,7 @@ function FullscreenTranscript({
52735
52828
  },
52736
52829
  [onSearchChange]
52737
52830
  );
52738
- const goTo = (0, import_react53.useCallback)(
52831
+ const goTo = (0, import_react54.useCallback)(
52739
52832
  (match) => {
52740
52833
  if (!match) return;
52741
52834
  const { synced: state, index: now } = latest.current;
@@ -52743,15 +52836,15 @@ function FullscreenTranscript({
52743
52836
  },
52744
52837
  [room]
52745
52838
  );
52746
- const openSearch = (0, import_react53.useCallback)(() => {
52839
+ const openSearch = (0, import_react54.useCallback)(() => {
52747
52840
  savedView.current = latest.current.synced;
52748
52841
  updateSearch({ query: "", cursor: null });
52749
52842
  }, [updateSearch]);
52750
- const closeSearch = (0, import_react53.useCallback)(() => {
52843
+ const closeSearch = (0, import_react54.useCallback)(() => {
52751
52844
  setView(savedView.current.follow ? FOLLOWING : savedView.current);
52752
52845
  updateSearch(null);
52753
52846
  }, [updateSearch]);
52754
- (0, import_react53.useEffect)(() => {
52847
+ (0, import_react54.useEffect)(() => {
52755
52848
  control.current = {
52756
52849
  scroll,
52757
52850
  takeEscape: /* @__PURE__ */ __name(() => {
@@ -52778,7 +52871,7 @@ function FullscreenTranscript({
52778
52871
  control.current = null;
52779
52872
  };
52780
52873
  }, [control, scroll, closeSearch, updateSelection, copyOnSelect, copySelection]);
52781
- (0, import_react53.useEffect)(() => {
52874
+ (0, import_react54.useEffect)(() => {
52782
52875
  if (!keysActive && searchRef.current) closeSearch();
52783
52876
  }, [keysActive, closeSearch]);
52784
52877
  use_input_default(
@@ -53392,11 +53485,11 @@ var AskQueue = class {
53392
53485
  enqueue(value, options = {}) {
53393
53486
  const signal = options.signal;
53394
53487
  if (signal?.aborted) return Promise.resolve(CLOSED_QUESTION);
53395
- return new Promise((resolve10) => {
53488
+ return new Promise((resolve9) => {
53396
53489
  const onAbort = /* @__PURE__ */ __name(() => this.#close(ask, CLOSED_QUESTION), "onAbort");
53397
53490
  const ask = {
53398
53491
  value,
53399
- resolve: resolve10,
53492
+ resolve: resolve9,
53400
53493
  background: options.background === true,
53401
53494
  detach: /* @__PURE__ */ __name(() => signal?.removeEventListener("abort", onAbort), "detach")
53402
53495
  };
@@ -54415,7 +54508,7 @@ async function listScheduleJobs(ctx) {
54415
54508
  const tz = job.schedule.kind === "cron" ? job.schedule.tz : hostTimeZone();
54416
54509
  const state = readState(paths, job.id);
54417
54510
  const mark = state.activeRun?.status === "awaiting-approval" ? state.activeRun.handoff ? ` [${parkedRunWords(state.activeRun)}]` : " [waiting for your approval]" : job.state === "pending-confirmation" ? " [needs confirmation]" : job.state === "active" && !confirmationHolds(job) ? " [on hold: changed outside namzu]" : state.activeRun?.status === "running" ? " [running]" : "";
54418
- const kind = job.runKind === "script" ? " [script, 0 tokens]" : job.runKind === "script+agent" ? " [script+agent]" : "";
54511
+ const kind = job.runKind === "script" ? " [script, 0 tokens]" : job.runKind === "script+agent" ? " [script+agent]" : job.gate ? " [gate]" : "";
54419
54512
  lines2.push(
54420
54513
  `${job.name} [${job.state}]${kind}${mark}
54421
54514
  ${describeSchedule(job.schedule, { tz })} \xB7 next ${when(nextFireOf(job, state), tz)}${state.lastRun ? ` \xB7 last ${state.lastRun.status}${callsCount(state.lastRun) ? ` (${callsCount(state.lastRun)})` : ""} ${when(state.lastRun.endedAt, tz)}` : ""}
@@ -54487,6 +54580,11 @@ async function confirmInTui(ctx, job, verb) {
54487
54580
  return "cancel";
54488
54581
  }
54489
54582
  }
54583
+ const gateProblem = gateRefusal(job, layers, paths.home);
54584
+ if (gateProblem) {
54585
+ say(`${gateProblem.charAt(0).toUpperCase()}${gateProblem.slice(1)}`);
54586
+ return "cancel";
54587
+ }
54490
54588
  const scriptSection = runKind !== "agent" && job.script ? [
54491
54589
  `${runKind === "script" ? "Script" : "Wake-gate script"} (exactly as it will run, ${job.script.shell}; shell commands checked against the scheduled-run floor and deny rules)`,
54492
54590
  ...job.script.body.split("\n").map((line) => ` \u2502 ${line}`),
@@ -54501,6 +54599,7 @@ async function confirmInTui(ctx, job, verb) {
54501
54599
  ...previewLines(job, policy, now),
54502
54600
  ...changesBlock(changesSinceConfirmed(readHistory(paths, job.id))),
54503
54601
  ...scriptSection,
54602
+ ...job.gate ? gateLines(job.gate) : [],
54504
54603
  ...runKind === "script" ? [] : [
54505
54604
  runKind === "script+agent" ? "Prompt (used only when the wake-gate says wake: true)" : "Prompt",
54506
54605
  ...job.prompt.split("\n").map((l) => ` \u2502 ${l}`)
@@ -54525,6 +54624,7 @@ async function confirmInTui(ctx, job, verb) {
54525
54624
  prompt: job.prompt,
54526
54625
  ...hasScript ? { runKind } : {},
54527
54626
  ...job.script ? { script: job.script } : {},
54627
+ ...job.gate ? { gate: job.gate } : {},
54528
54628
  schedule: describeSchedule(job.schedule, { tz }),
54529
54629
  nextFireTimes: upcomingFireTimes(job.schedule, now, 3).map((fire) => fire.toISOString()),
54530
54630
  rules: policy.lines,
@@ -55202,6 +55302,10 @@ function confirmationBody(p, findings, lines2) {
55202
55302
  ] : [],
55203
55303
  p.runKind === "script" ? "Runs exactly as shown; code passed to another interpreter is not parsed by the shell checker and must be reviewed here" : "Runs exactly as shown; code passed to another interpreter is not parsed by the shell checker, and the permission set governs the agent phase"
55204
55304
  ] : [];
55305
+ const gateSection = p.gate ? [
55306
+ `Gate (set by the operator, run before every run, exactly as it will run, ${p.gate.shell}, up to ${p.gate.timeoutMs / 1e3} s; the model is called only if it exits 0 and prints something)`,
55307
+ ...p.gate.command.split("\n").map((l) => ` \u2502 ${l}`)
55308
+ ] : [];
55205
55309
  const promptSection = p.prompt.trim() ? [
55206
55310
  p.runKind === "script+agent" ? "Prompt (used only when the wake-gate says wake: true)" : "Prompt (exactly as the run will read it)",
55207
55311
  ...p.prompt.split("\n").map((l) => ` \u2502 ${l}`)
@@ -55212,6 +55316,7 @@ function confirmationBody(p, findings, lines2) {
55212
55316
  ...p.warnings.filter((w) => !(p.networkAccess && w === "This run can reach the network.")).map((w) => `Warning ${w}`),
55213
55317
  ...findings.map((f) => `Warning ${f}`),
55214
55318
  ...scriptSection,
55319
+ ...gateSection,
55215
55320
  ...promptSection
55216
55321
  ];
55217
55322
  }
@@ -55296,6 +55401,10 @@ function updateRequest(current, changes, cwd2, fallbackModel) {
55296
55401
  ...runKind ? { runKind } : {},
55297
55402
  ...script ? { script } : {},
55298
55403
  ...runKind === "script+agent" && current.wakeGate ? { wakeGate: current.wakeGate } : {},
55404
+ // The tool never sets or changes a gate; the job's own is carried
55405
+ // through unchanged, so an update that touches nothing else keeps it
55406
+ // (and `buildJob` refuses a kind change that would strand it).
55407
+ ...current.gate ? { gate: current.gate } : {},
55299
55408
  permissions,
55300
55409
  budget: { ...current.budget, ...changes.budget ?? {} },
55301
55410
  ...runKind === "script" ? {} : current.model ? {
@@ -55380,11 +55489,14 @@ function createScheduleToolHost(ui) {
55380
55489
  );
55381
55490
  }
55382
55491
  }
55492
+ const gateProblem = gateRefusal(job, layers, ui.home());
55493
+ if (gateProblem)
55494
+ throw new Error(`${gateProblem.charAt(0).toUpperCase()}${gateProblem.slice(1)}`);
55383
55495
  const roots = [ui.cwd(), ...ui.extraRoots()];
55384
55496
  const outside = job.workspace !== "none" && !roots.some((root) => within(root, job.folder.canonical));
55385
55497
  const perDay = runsPerDay(job.schedule, now);
55386
55498
  const hasScriptPhase = job.runKind === "script" || job.runKind === "script+agent";
55387
- const networkCapable = policy.network || job.permissions.execution === "host" && (hasScriptPhase || allowsCommands(job.permissions));
55499
+ const networkCapable = policy.network || job.permissions.execution === "host" && (hasScriptPhase || job.gate !== void 0 || allowsCommands(job.permissions));
55388
55500
  const warnings = [
55389
55501
  ...outside ? ["The folder is outside this conversation\u2019s working directory and added directories."] : [],
55390
55502
  ...networkCapable ? ["This run can reach the network."] : [],
@@ -55402,6 +55514,7 @@ function createScheduleToolHost(ui) {
55402
55514
  prompt: job.prompt,
55403
55515
  ...job.runKind && job.runKind !== "agent" ? { runKind: job.runKind } : {},
55404
55516
  ...job.script ? { script: job.script } : {},
55517
+ ...job.gate ? { gate: job.gate } : {},
55405
55518
  schedule: describeSchedule(job.schedule, {
55406
55519
  tz: job.schedule.kind === "cron" ? job.schedule.tz : hostTimeZone()
55407
55520
  }),
@@ -55921,10 +56034,13 @@ var DELIVERY_OUTCOME = {
55921
56034
  "timed-out": "failed",
55922
56035
  "blocked-config": "failed",
55923
56036
  "check-failed": "failed",
56037
+ "needs-a-person": "failed",
55924
56038
  "awaiting-approval": "stopped",
55925
56039
  "approval-expired": "stopped",
55926
56040
  interrupted: "stopped",
55927
- cancelled: "stopped"
56041
+ cancelled: "stopped",
56042
+ // Never delivered (a skipped run has nothing to say); listed for the type.
56043
+ skipped: "stopped"
55928
56044
  };
55929
56045
  var RUN_ENDINGS = {
55930
56046
  completed: END_WORDS.finished,
@@ -55935,7 +56051,9 @@ var RUN_ENDINGS = {
55935
56051
  "timed-out": "timed out",
55936
56052
  "blocked-config": "could not start because its settings need attention",
55937
56053
  cancelled: `was ${END_WORDS.stopped}`,
55938
- "check-failed": "failed its check"
56054
+ "check-failed": "failed its check",
56055
+ skipped: "was skipped by its gate",
56056
+ "needs-a-person": "needs a person: the model handed the task back"
55939
56057
  };
55940
56058
  function deliveryLevel(status) {
55941
56059
  return endLevel(DELIVERY_OUTCOME[status] ?? "stopped");
@@ -56538,7 +56656,7 @@ function keepAccountKeyForStartup(provider, apiKey, baseUrl, home) {
56538
56656
  __name(keepAccountKeyForStartup, "keepAccountKeyForStartup");
56539
56657
 
56540
56658
  // src/tui/use-spinner-tip.ts
56541
- var import_react54 = __toESM(require_react(), 1);
56659
+ var import_react55 = __toESM(require_react(), 1);
56542
56660
 
56543
56661
  // src/tui/spinner-tips.ts
56544
56662
  var NEVER = /* @__PURE__ */ __name((command, from) => (ctx) => ctx.used(command) === 0 && ctx.launch >= from, "NEVER");
@@ -56700,12 +56818,12 @@ __name(pickTip, "pickTip");
56700
56818
 
56701
56819
  // src/tui/use-spinner-tip.ts
56702
56820
  function useSpinnerTip(input) {
56703
- const [tip, setTip] = (0, import_react54.useState)(void 0);
56704
- const wasBusy = (0, import_react54.useRef)(false);
56705
- const failed = (0, import_react54.useRef)(/* @__PURE__ */ new Set());
56706
- const latest = (0, import_react54.useRef)(input);
56821
+ const [tip, setTip] = (0, import_react55.useState)(void 0);
56822
+ const wasBusy = (0, import_react55.useRef)(false);
56823
+ const failed = (0, import_react55.useRef)(/* @__PURE__ */ new Set());
56824
+ const latest = (0, import_react55.useRef)(input);
56707
56825
  latest.current = input;
56708
- (0, import_react54.useEffect)(() => {
56826
+ (0, import_react55.useEffect)(() => {
56709
56827
  if (!input.enabled) {
56710
56828
  setTip(void 0);
56711
56829
  return;
@@ -57227,13 +57345,13 @@ function isExampleFile(path) {
57227
57345
  }
57228
57346
  __name(isExampleFile, "isExampleFile");
57229
57347
  function frequentlyModifiedFile(cwd2, signal) {
57230
- return new Promise((resolve10) => {
57348
+ return new Promise((resolve9) => {
57231
57349
  execFile3(
57232
57350
  "git",
57233
57351
  ["log", "--name-only", "--pretty=format:", "-n", "200"],
57234
57352
  { cwd: cwd2, signal, maxBuffer: 4 * 1024 * 1024, timeout: 5e3 },
57235
57353
  (error, stdout) => {
57236
- if (error) return resolve10(void 0);
57354
+ if (error) return resolve9(void 0);
57237
57355
  const counts2 = /* @__PURE__ */ new Map();
57238
57356
  for (const line of stdout.split("\n")) {
57239
57357
  const path = line.trim();
@@ -57247,7 +57365,7 @@ function frequentlyModifiedFile(cwd2, signal) {
57247
57365
  bestCount = count2;
57248
57366
  }
57249
57367
  }
57250
- resolve10(best);
57368
+ resolve9(best);
57251
57369
  }
57252
57370
  );
57253
57371
  });
@@ -57366,7 +57484,7 @@ function usedMemoriesOf(raw) {
57366
57484
  return out;
57367
57485
  }
57368
57486
  __name(usedMemoriesOf, "usedMemoriesOf");
57369
- function trailFromRecords(records) {
57487
+ function trailFromRecords(records, options) {
57370
57488
  if (!records || records.length === 0) return NO_TRAIL;
57371
57489
  const calls = /* @__PURE__ */ new Map();
57372
57490
  const turns = /* @__PURE__ */ new Map();
@@ -57457,7 +57575,13 @@ function trailFromRecords(records) {
57457
57575
  const index = agents?.indexOf(false) ?? -1;
57458
57576
  if (agents && index >= 0) agents[index] = true;
57459
57577
  }
57460
- return { calls, turns, turnOfMessage, recalled };
57578
+ return {
57579
+ calls,
57580
+ turns,
57581
+ turnOfMessage,
57582
+ recalled,
57583
+ ...options?.liveTurnId !== void 0 ? { liveTurnId: options.liveTurnId } : {}
57584
+ };
57461
57585
  }
57462
57586
  __name(trailFromRecords, "trailFromRecords");
57463
57587
  function parseInput(call) {
@@ -57566,6 +57690,9 @@ function restoredToolRows(turnId, call, results, trail, presenter, cwd2) {
57566
57690
  const interrupted = saved?.end === void 0 && (!message || text.startsWith(INTERRUPTED_RESULT));
57567
57691
  const start = startOf(started);
57568
57692
  if (interrupted) {
57693
+ if (turnId !== void 0 && trail.liveTurnId === turnId) {
57694
+ return [{ role: "tool", content: start.label, glyph: "\u25CB", pending: true }];
57695
+ }
57569
57696
  const journaled = turnId !== void 0 && trail.turns.get(turnId)?.journaled === true;
57570
57697
  return saved?.start === void 0 && (saved?.asked === true || journaled) ? notRunRows(start.label, saved?.asked === true) : interruptedRows(start.label);
57571
57698
  }
@@ -57604,20 +57731,52 @@ function createRestoredTurnWriter(messages, nextId, options) {
57604
57731
  const shownMemories = /* @__PURE__ */ new Set();
57605
57732
  const atTurn = /* @__PURE__ */ __name((turnId) => trail.turns.get(turnId)?.startedAt ?? Date.now(), "atTurn");
57606
57733
  let telling = options.telling ?? NOTHING_TOLD;
57607
- const outcomeRow = /* @__PURE__ */ __name((turn) => {
57608
- if (turn.completed !== true) return void 0;
57734
+ const answers = /* @__PURE__ */ new Map();
57735
+ const handedBack = /* @__PURE__ */ new Map();
57736
+ let chain;
57737
+ const noteAnswer = /* @__PURE__ */ __name((message, turnId) => {
57738
+ if (message.role !== "assistant" || !turnId) {
57739
+ chain = void 0;
57740
+ return;
57741
+ }
57742
+ const text = typeof message.content === "string" ? message.content : "";
57743
+ chain = chain && chain.turnId === turnId ? { turnId, text: chain.text + text } : { turnId, text };
57744
+ answers.set(turnId, chain.text);
57745
+ }, "noteAnswer");
57746
+ const outcomeRows = /* @__PURE__ */ __name((turnId, turn) => {
57747
+ if (turn.completed !== true) return [];
57609
57748
  const said = outcomeNotice(turn.outcome, telling, options.cannotTellReason);
57610
57749
  telling = said.telling;
57611
- if (!said.line) return void 0;
57612
57750
  const style = systemRowStyle("notice");
57613
- return {
57751
+ const notice = /* @__PURE__ */ __name((content) => ({
57614
57752
  id: nextId(),
57615
57753
  role: "system",
57616
- content: said.line,
57754
+ content,
57617
57755
  glyph: style.glyph,
57618
57756
  glyphColor: style.color
57619
- };
57620
- }, "outcomeRow");
57757
+ }), "notice");
57758
+ const rows = [];
57759
+ if (said.line) rows.push(notice(said.line));
57760
+ const answer = answers.get(turnId);
57761
+ const handBack = handedBack.get(turnId);
57762
+ const claim = claimMismatchLine(
57763
+ answer !== void 0 && handBack === void 0 ? compareAnswerToOutcome(answer, turn.outcome) : void 0
57764
+ );
57765
+ if (claim) rows.push(notice(claim));
57766
+ const handed = handedBackLines(handBack);
57767
+ if (handed) {
57768
+ const warning = systemRowStyle("warning");
57769
+ rows.push({
57770
+ id: nextId(),
57771
+ role: "system",
57772
+ content: handed.line,
57773
+ glyph: warning.glyph,
57774
+ glyphColor: warning.color
57775
+ });
57776
+ for (const line of handed.model) rows.push(notice(line));
57777
+ }
57778
+ return rows;
57779
+ }, "outcomeRows");
57621
57780
  const closing = /* @__PURE__ */ __name((turnId) => {
57622
57781
  if (!turnId) return [];
57623
57782
  const turn = trail.turns.get(turnId);
@@ -57625,8 +57784,7 @@ function createRestoredTurnWriter(messages, nextId, options) {
57625
57784
  const rows = [];
57626
57785
  if (turn.stopReason === "cancelled" && turn.cancelCause === "user") {
57627
57786
  rows.push({ id: nextId(), role: "system", content: "Interrupted." });
57628
- const said2 = outcomeRow(turn);
57629
- if (said2) rows.push(said2);
57787
+ rows.push(...outcomeRows(turnId, turn));
57630
57788
  return rows;
57631
57789
  }
57632
57790
  const notice = describeTurnStop(
@@ -57634,8 +57792,7 @@ function createRestoredTurnWriter(messages, nextId, options) {
57634
57792
  turn.budget
57635
57793
  );
57636
57794
  if (notice) rows.push({ id: nextId(), role: "system", content: notice, glyph: "\u25A0" });
57637
- const said = outcomeRow(turn);
57638
- if (said) rows.push(said);
57795
+ rows.push(...outcomeRows(turnId, turn));
57639
57796
  const completed = turn.stopReason === void 0 || turn.stopReason === "end_turn";
57640
57797
  if (turn.startedAt !== void 0 && turn.endedAt !== void 0) {
57641
57798
  const stand = turn.agents.map(
@@ -57661,6 +57818,12 @@ function createRestoredTurnWriter(messages, nextId, options) {
57661
57818
  let launched = false;
57662
57819
  for (const call of message.toolCalls) {
57663
57820
  if (call.function.name.toLowerCase() === "agent") launched = true;
57821
+ if (turnId && call.function.name === HAND_BACK_TOOL_NAME) {
57822
+ const said = results.get(call.id);
57823
+ const read = parseHandBack(call.function.arguments);
57824
+ if (read && typeof said?.content === "string" && said.content.startsWith(HAND_BACK_RECEIPT))
57825
+ handedBack.set(turnId, read);
57826
+ }
57664
57827
  for (const row2 of restoredToolRows(
57665
57828
  turnId,
57666
57829
  call,
@@ -57696,6 +57859,7 @@ function createRestoredTurnWriter(messages, nextId, options) {
57696
57859
  },
57697
57860
  enter(message) {
57698
57861
  const turnId = message.id ? trail.turnOfMessage.get(message.id) : void 0;
57862
+ noteAnswer(message, turnId);
57699
57863
  if (!turnId || turnId === current) return [];
57700
57864
  const before = closing(current);
57701
57865
  current = turnId;
@@ -57956,7 +58120,7 @@ function StatusLineRows({
57956
58120
  __name(StatusLineRows, "StatusLineRows");
57957
58121
 
57958
58122
  // src/tui/status-line/useStatusLine.ts
57959
- var import_react55 = __toESM(require_react(), 1);
58123
+ var import_react56 = __toESM(require_react(), 1);
57960
58124
 
57961
58125
  // src/tui/status-line/controller.ts
57962
58126
  var STATUS_LINE_DEBOUNCE_MS = 300;
@@ -58126,8 +58290,8 @@ import { spawn as spawn5 } from "node:child_process";
58126
58290
  var STATUS_LINE_TIMEOUT_MS = 6e5;
58127
58291
  var MAX_OUTPUT_BYTES = 64 * 1024;
58128
58292
  function runStatusLineCommand(options) {
58129
- return new Promise((resolve10) => {
58130
- if (options.signal.aborted) return resolve10(void 0);
58293
+ return new Promise((resolve9) => {
58294
+ if (options.signal.aborted) return resolve9(void 0);
58131
58295
  const run4 = options.spawnImpl ?? spawn5;
58132
58296
  let child;
58133
58297
  try {
@@ -58143,7 +58307,7 @@ function runStatusLineCommand(options) {
58143
58307
  detached: process.platform !== "win32"
58144
58308
  });
58145
58309
  } catch {
58146
- return resolve10(void 0);
58310
+ return resolve9(void 0);
58147
58311
  }
58148
58312
  let out = "";
58149
58313
  let settled2 = false;
@@ -58152,7 +58316,7 @@ function runStatusLineCommand(options) {
58152
58316
  settled2 = true;
58153
58317
  clearTimeout(timer);
58154
58318
  options.signal.removeEventListener("abort", onAbort);
58155
- resolve10(value);
58319
+ resolve9(value);
58156
58320
  }, "finish");
58157
58321
  const kill = /* @__PURE__ */ __name(() => {
58158
58322
  try {
@@ -58231,10 +58395,10 @@ __name(readWorkspaceGit, "readWorkspaceGit");
58231
58395
 
58232
58396
  // src/tui/status-line/useStatusLine.ts
58233
58397
  function useStatusLine(options) {
58234
- const [text, setText] = (0, import_react55.useState)(void 0);
58235
- const latest = (0, import_react55.useRef)(options);
58398
+ const [text, setText] = (0, import_react56.useState)(void 0);
58399
+ const latest = (0, import_react56.useRef)(options);
58236
58400
  latest.current = options;
58237
- const controllerRef = (0, import_react55.useRef)(null);
58401
+ const controllerRef = (0, import_react56.useRef)(null);
58238
58402
  if (controllerRef.current === null) {
58239
58403
  controllerRef.current = new StatusLineController({
58240
58404
  onText: setText,
@@ -58259,13 +58423,13 @@ function useStatusLine(options) {
58259
58423
  }
58260
58424
  const command = options.enabled ? options.config?.command : void 0;
58261
58425
  const refresh = options.config?.refreshInterval;
58262
- (0, import_react55.useEffect)(() => {
58426
+ (0, import_react56.useEffect)(() => {
58263
58427
  controllerRef.current?.update(
58264
58428
  command === void 0 ? null : { command, refreshIntervalSeconds: refresh },
58265
58429
  options.triggers
58266
58430
  );
58267
58431
  }, [command, refresh, ...options.triggers]);
58268
- (0, import_react55.useEffect)(() => () => controllerRef.current?.stop(), []);
58432
+ (0, import_react56.useEffect)(() => () => controllerRef.current?.stop(), []);
58269
58433
  return command === void 0 ? void 0 : text;
58270
58434
  }
58271
58435
  __name(useStatusLine, "useStatusLine");
@@ -58349,44 +58513,6 @@ function backticksBalanced(text) {
58349
58513
  }
58350
58514
  __name(backticksBalanced, "backticksBalanced");
58351
58515
 
58352
- // src/tui/terminal-focus.ts
58353
- var import_react56 = __toESM(require_react(), 1);
58354
- function createTerminalFocus(now = Date.now) {
58355
- let state = "unknown";
58356
- let gainedAt = 0;
58357
- const listeners = /* @__PURE__ */ new Set();
58358
- const emit = /* @__PURE__ */ __name(() => {
58359
- for (const listener of [...listeners]) listener();
58360
- }, "emit");
58361
- const set = /* @__PURE__ */ __name((focused) => {
58362
- if (focused) gainedAt = now();
58363
- if (!focused && state === "blurred") return;
58364
- state = focused ? "focused" : "blurred";
58365
- emit();
58366
- }, "set");
58367
- return {
58368
- state: /* @__PURE__ */ __name(() => state, "state"),
58369
- isFocused: /* @__PURE__ */ __name(() => state !== "blurred", "isFocused"),
58370
- gainedAt: /* @__PURE__ */ __name(() => gainedAt, "gainedAt"),
58371
- set,
58372
- noteInput: /* @__PURE__ */ __name(() => {
58373
- if (state === "blurred") set(true);
58374
- }, "noteInput"),
58375
- subscribe: /* @__PURE__ */ __name((listener) => {
58376
- listeners.add(listener);
58377
- return () => {
58378
- listeners.delete(listener);
58379
- };
58380
- }, "subscribe")
58381
- };
58382
- }
58383
- __name(createTerminalFocus, "createTerminalFocus");
58384
- var terminalFocus = createTerminalFocus();
58385
- function useTerminalFocused(store = terminalFocus) {
58386
- return (0, import_react56.useSyncExternalStore)(store.subscribe, store.isFocused, store.isFocused);
58387
- }
58388
- __name(useTerminalFocused, "useTerminalFocused");
58389
-
58390
58516
  // src/tui/terminal-title.ts
58391
58517
  var DEFAULT_TERMINAL_TITLE = "Namzu";
58392
58518
  var IDLE_TITLE_GLYPH = "\u2733";
@@ -59296,10 +59422,10 @@ function AppBody({
59296
59422
  const resolveQuestion = (0, import_react62.useCallback)((answer) => {
59297
59423
  const pending = questionRef.current;
59298
59424
  if (!pending?.resolve) return;
59299
- const resolve10 = pending.resolve;
59425
+ const resolve9 = pending.resolve;
59300
59426
  pending.resolve = null;
59301
59427
  questionRef.current = null;
59302
- resolve10(answer);
59428
+ resolve9(answer);
59303
59429
  }, []);
59304
59430
  const [permissionReviewOffset, setPermissionReviewOffsetState] = (0, import_react62.useState)(0);
59305
59431
  const permissionReviewOffsetRef = (0, import_react62.useRef)(0);
@@ -60287,9 +60413,9 @@ ${blocks.join("\n\n")}`;
60287
60413
  cwd: /* @__PURE__ */ __name(() => ctxRef.current.cwd, "cwd"),
60288
60414
  config: /* @__PURE__ */ __name(() => ctxRef.current.skills, "config"),
60289
60415
  sessionId: /* @__PURE__ */ __name(() => conversationMaterializedRef.current ? scopeRef.current?.sessionId : void 0, "sessionId"),
60290
- confirm: /* @__PURE__ */ __name((request, signal) => new Promise((resolve10) => {
60416
+ confirm: /* @__PURE__ */ __name((request, signal) => new Promise((resolve9) => {
60291
60417
  if (signal?.aborted) {
60292
- resolve10("cancel");
60418
+ resolve9("cancel");
60293
60419
  return;
60294
60420
  }
60295
60421
  const entry = {
@@ -60299,7 +60425,7 @@ ${blocks.join("\n\n")}`;
60299
60425
  queueMicrotask(() => {
60300
60426
  if (saveSkillPromptRef.current === entry) setSaveSkillPrompt(null);
60301
60427
  });
60302
- resolve10(answer);
60428
+ resolve9(answer);
60303
60429
  }, "resolve")
60304
60430
  };
60305
60431
  const onAbort = /* @__PURE__ */ __name(() => entry.resolve("cancel"), "onAbort");
@@ -60320,7 +60446,7 @@ ${blocks.join("\n\n")}`;
60320
60446
  const closing = Promise.all([session?.close(), peersRef.current?.close()]);
60321
60447
  const bounded = Promise.race([
60322
60448
  closing,
60323
- new Promise((resolve10) => setTimeout(resolve10, SESSION_CLOSE_ON_EXIT_MS).unref?.())
60449
+ new Promise((resolve9) => setTimeout(resolve9, SESSION_CLOSE_ON_EXIT_MS).unref?.())
60324
60450
  ]);
60325
60451
  void bounded.catch(() => void 0).then(() => beforeExit?.()).catch(() => void 0).finally(() => exit());
60326
60452
  }, [beforeExit, cancelPendingModelSwitch, exit, session]);
@@ -60464,13 +60590,13 @@ ${blocks.join("\n\n")}`;
60464
60590
  if (externalEditorRequestRef.current) {
60465
60591
  return Promise.reject(new Error("an external editor is already open"));
60466
60592
  }
60467
- return new Promise((resolve10, reject) => {
60593
+ return new Promise((resolve9, reject) => {
60468
60594
  const request = {
60469
60595
  token: {},
60470
60596
  seed,
60471
60597
  ...pressed !== void 0 ? { pressed } : {},
60472
60598
  controller: new AbortController(),
60473
- resolve: resolve10,
60599
+ resolve: resolve9,
60474
60600
  reject
60475
60601
  };
60476
60602
  externalEditorRequestRef.current = request;
@@ -60484,7 +60610,7 @@ ${blocks.join("\n\n")}`;
60484
60610
  if (!request || externalEditorStartedRef.current === request.token) return;
60485
60611
  externalEditorStartedRef.current = request.token;
60486
60612
  void (async () => {
60487
- await new Promise((resolve10) => setImmediate(resolve10));
60613
+ await new Promise((resolve9) => setImmediate(resolve9));
60488
60614
  if (request.controller.signal.aborted) return;
60489
60615
  if (stdout.isTTY) writeStdout(fullscreenOn ? "\x1B[?1049l\x1B[2J\x1B[H" : "\x1B[2J\x1B[H");
60490
60616
  let edited;
@@ -62419,8 +62545,10 @@ ${blocks.join("\n\n")}`;
62419
62545
  ...activeCtx.appendSystem ? { appendSystem: activeCtx.appendSystem } : {},
62420
62546
  ...sessionsRef.current ? {
62421
62547
  sessionGoals: sessionsRef.current.goals,
62548
+ ...activeCtx.goal?.confirmedBy ? { goalConfirmedBy: activeCtx.goal.confirmedBy } : {},
62422
62549
  conversationSessions: sessionsRef.current
62423
62550
  } : {},
62551
+ ...activeCtx.handBack?.enabled === true ? { handBack: true } : {},
62424
62552
  ...activeCtx.mcpServers ? { mcpServers: activeCtx.mcpServers } : {},
62425
62553
  // The composer is ready at once; each server's tools join as it connects.
62426
62554
  toolServers: "background",
@@ -63452,6 +63580,37 @@ ${blocks.join("\n\n")}`;
63452
63580
  },
63453
63581
  [openResumePicker]
63454
63582
  );
63583
+ const spendRunningRef = (0, import_react62.useRef)(false);
63584
+ const showSpendInSession = (0, import_react62.useCallback)(
63585
+ async (days) => {
63586
+ if (spendRunningRef.current) {
63587
+ pushMessage("system", "The spend view is already being read.");
63588
+ return;
63589
+ }
63590
+ spendRunningRef.current = true;
63591
+ const progressId = pushMessage("system", "Reading spend\u2026");
63592
+ try {
63593
+ const [{ buildCostReport }, { renderSpend }, { systemClock }, { resolveNamzuHome: resolveNamzuHome2 }] = await Promise.all([
63594
+ import("./cost-MYSYQTT3.js"),
63595
+ import("./render-QFCCPEEL.js"),
63596
+ import("./day-CU5J7UAK.js"),
63597
+ import("./home-T4ZVXIEX.js")
63598
+ ]);
63599
+ const report = await buildCostReport(days, {
63600
+ home: resolveNamzuHome2(),
63601
+ clock: systemClock()
63602
+ });
63603
+ setMessages((rows) => rows.filter((row2) => row2.id !== progressId));
63604
+ pushMessage("system", renderSpend(report));
63605
+ } catch (err) {
63606
+ setMessages((rows) => rows.filter((row2) => row2.id !== progressId));
63607
+ pushSystem("error", explainFailure(err, "Could not read the spend."));
63608
+ } finally {
63609
+ spendRunningRef.current = false;
63610
+ }
63611
+ },
63612
+ [pushMessage, pushSystem]
63613
+ );
63455
63614
  const doctorRunningRef = (0, import_react62.useRef)(false);
63456
63615
  const runDoctorInSession = (0, import_react62.useCallback)(async () => {
63457
63616
  if (doctorRunningRef.current) {
@@ -63461,7 +63620,7 @@ ${blocks.join("\n\n")}`;
63461
63620
  doctorRunningRef.current = true;
63462
63621
  const progressId = pushMessage("system", "Checking\u2026");
63463
63622
  try {
63464
- const { runLiveDoctor } = await import("./live-EIQ666TU.js");
63623
+ const { runLiveDoctor } = await import("./live-4GQNVGPU.js");
63465
63624
  const { describePlainDoctor } = await import("./plain-report-XVPBQDLE.js");
63466
63625
  const report = await runLiveDoctor({
63467
63626
  ...ctxRef.current.telemetry ? { telemetry: ctxRef.current.telemetry } : {}
@@ -64909,13 +65068,13 @@ ${plain(err)}`
64909
65068
  [announceApproval]
64910
65069
  );
64911
65070
  const askQuestion = (0, import_react62.useCallback)(
64912
- (question, signal) => new Promise((resolve10) => {
65071
+ (question, signal) => new Promise((resolve9) => {
64913
65072
  if (signal?.aborted) {
64914
- resolve10({ kind: "abort" });
65073
+ resolve9({ kind: "abort" });
64915
65074
  return;
64916
65075
  }
64917
65076
  closeLiveReply();
64918
- questionRef.current = { question, resolve: resolve10 };
65077
+ questionRef.current = { question, resolve: resolve9 };
64919
65078
  if (needsQuestionDialog(question)) {
64920
65079
  questionDialogTokenRef.current += 1;
64921
65080
  const entry = { token: questionDialogTokenRef.current, question };
@@ -64975,9 +65134,9 @@ ${plain(err)}`
64975
65134
  ]
64976
65135
  );
64977
65136
  const askPlanApproval = (0, import_react62.useCallback)(
64978
- (request, signal) => new Promise((resolve10) => {
65137
+ (request, signal) => new Promise((resolve9) => {
64979
65138
  if (signal?.aborted) {
64980
- resolve10({ kind: "keep-planning" });
65139
+ resolve9({ kind: "keep-planning" });
64981
65140
  return;
64982
65141
  }
64983
65142
  closeLiveReply();
@@ -65002,7 +65161,7 @@ ${plain(err)}`
65002
65161
  } else if (answer.feedback) {
65003
65162
  pushMessage("system", `Changes asked for \xB7 ${answer.feedback}`);
65004
65163
  }
65005
- resolve10(answer);
65164
+ resolve9(answer);
65006
65165
  }, "finish");
65007
65166
  const entry = { request, resolve: finish };
65008
65167
  const onAbort = /* @__PURE__ */ __name(() => finish({ kind: "keep-planning" }), "onAbort");
@@ -65075,9 +65234,9 @@ ${plain(err)}`
65075
65234
  [activeSkills, appLifetime.signal, handleAutoModeLimit, onPermission, session]
65076
65235
  );
65077
65236
  const reviewSchedule = (0, import_react62.useCallback)(
65078
- (request, signal) => new Promise((resolve10) => {
65237
+ (request, signal) => new Promise((resolve9) => {
65079
65238
  if (signal?.aborted) {
65080
- resolve10("cancel");
65239
+ resolve9("cancel");
65081
65240
  return;
65082
65241
  }
65083
65242
  closeLiveReply();
@@ -65093,7 +65252,7 @@ ${plain(err)}`
65093
65252
  queueMicrotask(() => {
65094
65253
  if (scheduleReviewPromptRef.current === entry) setScheduleReviewPrompt(null);
65095
65254
  });
65096
- resolve10(answer);
65255
+ resolve9(answer);
65097
65256
  }, "resolve")
65098
65257
  };
65099
65258
  const onAbort = /* @__PURE__ */ __name(() => entry.resolve("cancel"), "onAbort");
@@ -65624,6 +65783,19 @@ ${plain(err)}`
65624
65783
  );
65625
65784
  outcomeToldRef.current.telling = said.telling;
65626
65785
  if (said.line) pushSystem("notice", said.line);
65786
+ const claimLine = claimMismatchLine(event.claimMismatch);
65787
+ if (claimLine) pushSystem("notice", claimLine);
65788
+ const handed = handedBackLines(event.handedBack);
65789
+ if (handed) {
65790
+ pushSystem("warning", handed.line);
65791
+ for (const line of handed.model) pushSystem("notice", line);
65792
+ }
65793
+ const goalLine = goalEndingLine(event.goalEnding);
65794
+ if (goalLine)
65795
+ pushSystem(
65796
+ event.goalEnding?.ending === "not-confirmed" ? "warning" : "notice",
65797
+ goalLine
65798
+ );
65627
65799
  if (st.startedAt !== void 0) {
65628
65800
  const since = st.startedAt;
65629
65801
  const delegated = subagentsRef.current.filter(
@@ -66028,14 +66200,14 @@ ${jobLines.map(([, line]) => `- ${line}`).join("\n")}`] : []
66028
66200
  waitForOperator(signal) {
66029
66201
  if (signal.aborted) return Promise.reject(signal.reason);
66030
66202
  if (inboxOpen && inboxEntries.length > 0) return Promise.resolve();
66031
- return new Promise((resolve10, reject) => {
66203
+ return new Promise((resolve9, reject) => {
66032
66204
  const cleanup = /* @__PURE__ */ __name(() => {
66033
66205
  operatorWaiters.delete(wake);
66034
66206
  signal.removeEventListener("abort", abort);
66035
66207
  }, "cleanup");
66036
66208
  const wake = /* @__PURE__ */ __name(() => {
66037
66209
  cleanup();
66038
- resolve10();
66210
+ resolve9();
66039
66211
  }, "wake");
66040
66212
  const abort = /* @__PURE__ */ __name(() => {
66041
66213
  cleanup();
@@ -66049,14 +66221,14 @@ ${jobLines.map(([, line]) => `- ${line}`).join("\n")}`] : []
66049
66221
  if (signal.aborted) return Promise.reject(signal.reason);
66050
66222
  if (!inboxOpen || inboxEntries.length > 0 || wakeLedgerRef.current.hasUnsnapshottedDirectChild(wakeSnapshot) || peersRef.current?.enabled && peersRef.current.pending > 0)
66051
66223
  return Promise.resolve();
66052
- return new Promise((resolve10, reject) => {
66224
+ return new Promise((resolve9, reject) => {
66053
66225
  const cleanup = /* @__PURE__ */ __name(() => {
66054
66226
  inputWaiters.delete(wake);
66055
66227
  signal.removeEventListener("abort", abort);
66056
66228
  }, "cleanup");
66057
66229
  const wake = /* @__PURE__ */ __name(() => {
66058
66230
  cleanup();
66059
- resolve10();
66231
+ resolve9();
66060
66232
  }, "wake");
66061
66233
  const abort = /* @__PURE__ */ __name(() => {
66062
66234
  cleanup();
@@ -67611,6 +67783,10 @@ ${peersList.map((peer) => `${peer.self ? "This terminal" : peer.title} [${peer.r
67611
67783
  void runDoctorInSession();
67612
67784
  return;
67613
67785
  }
67786
+ case "spend": {
67787
+ void showSpendInSession(slash.days);
67788
+ return;
67789
+ }
67614
67790
  case "tasks": {
67615
67791
  if (!session) {
67616
67792
  pushMessage("system", "Background tasks are available once the conversation starts.");
@@ -68461,7 +68637,8 @@ ${plugins.map((plugin) => {
68461
68637
  store: durableSessions.goals,
68462
68638
  sessionId: sessionScope.sessionId,
68463
68639
  tenantId: durableSessions.tenantId,
68464
- activation: goalActivation
68640
+ activation: goalActivation,
68641
+ ...ctxRef.current.goal?.confirmedBy ? { defaultConfirmedBy: ctxRef.current.goal.confirmedBy } : {}
68465
68642
  }
68466
68643
  } : {}
68467
68644
  })
@@ -71586,881 +71763,13 @@ function summaryDetail(summary2) {
71586
71763
  }
71587
71764
  __name(summaryDetail, "summaryDetail");
71588
71765
 
71589
- // src/tui/console-input.ts
71590
- import { closeSync as closeSync2, openSync as openSync2 } from "node:fs";
71591
- import { ReadStream } from "node:tty";
71592
- var CONSOLE_INPUT_DEVICE = String.raw`\\.\CONIN$`;
71593
- function openConsoleInput(streams = process, platform2 = process.platform, io = {
71594
- open: /* @__PURE__ */ __name((path) => openSync2(path, "r+"), "open"),
71595
- close: closeSync2,
71596
- stream: /* @__PURE__ */ __name((fd) => new ReadStream(fd), "stream")
71597
- }) {
71598
- if (platform2 !== "win32" || streams.stdin.isTTY === true || streams.stdout.isTTY !== true)
71599
- return void 0;
71600
- let fd;
71601
- try {
71602
- fd = io.open(CONSOLE_INPUT_DEVICE);
71603
- } catch {
71604
- return void 0;
71605
- }
71606
- try {
71607
- const stream2 = io.stream(fd);
71608
- return { stream: stream2, release: /* @__PURE__ */ __name(() => stream2.destroy(), "release") };
71609
- } catch {
71610
- try {
71611
- io.close(fd);
71612
- } catch {
71613
- }
71614
- return void 0;
71615
- }
71616
- }
71617
- __name(openConsoleInput, "openConsoleInput");
71618
-
71619
- // src/tui/exit-summary.ts
71620
- function publicCommand(command) {
71621
- return command && command.length === 1 ? command : ["namzu"];
71622
- }
71623
- __name(publicCommand, "publicCommand");
71624
- function formatTuiExitSummary(summary2, invocation = {}, platform2 = process.platform) {
71625
- if (!summary2?.conversationId) return "";
71626
- const palId = summary2.palId ?? invocation.palId;
71627
- const args = [
71628
- ...publicCommand(invocation.command),
71629
- ...palId ? ["pal", "chat", palId, "--resume", summary2.conversationId] : ["resume", summary2.conversationId]
71630
- ];
71631
- const cwd2 = !palId && invocation.cwd && invocation.cwd !== process.cwd() ? invocation.cwd : void 0;
71632
- const command = formatResumeShellCommand(args, { platform: platform2, cwd: cwd2 });
71633
- if (platform2 === "win32") {
71634
- return `
71635
- To resume this conversation, run in PowerShell:
71636
- ${command}
71637
- `;
71638
- }
71639
- return `
71640
- To resume this conversation, run:
71641
- ${command}
71642
- `;
71643
- }
71644
- __name(formatTuiExitSummary, "formatTuiExitSummary");
71645
-
71646
- // src/tui/focus-reporting.ts
71647
- var FOCUS_REPORTING_ENABLE = "\x1B[?1004h";
71648
- var FOCUS_REPORTING_DISABLE = "\x1B[?1004l";
71649
- var FOCUS_IN = "\x1B[I";
71650
- var FOCUS_OUT = "\x1B[O";
71651
- function stripFocusReports(chunk) {
71652
- if (!chunk.includes("\x1B[")) return { text: chunk, events: [] };
71653
- const events = [];
71654
- let text = "";
71655
- let from = 0;
71656
- for (let i = 0; i < chunk.length - 2; i += 1) {
71657
- if (chunk.charCodeAt(i) !== 27) continue;
71658
- const token = chunk.slice(i, i + 3);
71659
- if (token !== FOCUS_IN && token !== FOCUS_OUT) continue;
71660
- text += chunk.slice(from, i);
71661
- events.push(token === FOCUS_IN ? "in" : "out");
71662
- from = i + 3;
71663
- i += 2;
71664
- }
71665
- return { text: text + chunk.slice(from), events };
71666
- }
71667
- __name(stripFocusReports, "stripFocusReports");
71668
- function installFocusReporting(stdin, stdout, onFocus) {
71669
- if (stdin.isTTY !== true || stdout.isTTY !== true || typeof stdin.setRawMode !== "function") {
71670
- return () => void 0;
71671
- }
71672
- const originalRead = stdin.read;
71673
- const originalSetRawMode = stdin.setRawMode;
71674
- let enabled = false;
71675
- const write = /* @__PURE__ */ __name((text) => {
71676
- try {
71677
- stdout.write(text);
71678
- } catch {
71679
- }
71680
- }, "write");
71681
- stdin.read = /* @__PURE__ */ __name(function patchedRead(...args) {
71682
- const chunk = originalRead.apply(this, args);
71683
- if (typeof chunk !== "string") return chunk;
71684
- const stripped = stripFocusReports(chunk);
71685
- for (const event of stripped.events) onFocus(event === "in");
71686
- return stripped.text;
71687
- }, "patchedRead");
71688
- stdin.setRawMode = /* @__PURE__ */ __name(function patchedSetRawMode(mode) {
71689
- const result = originalSetRawMode.call(this, mode);
71690
- if (mode && !enabled) {
71691
- enabled = true;
71692
- write(FOCUS_REPORTING_ENABLE);
71693
- } else if (!mode && enabled) {
71694
- enabled = false;
71695
- write(FOCUS_REPORTING_DISABLE);
71696
- }
71697
- return result;
71698
- }, "patchedSetRawMode");
71699
- let removed = false;
71700
- return () => {
71701
- if (removed) return;
71702
- removed = true;
71703
- stdin.read = originalRead;
71704
- stdin.setRawMode = originalSetRawMode;
71705
- enabled = false;
71706
- write(FOCUS_REPORTING_DISABLE);
71707
- };
71708
- }
71709
- __name(installFocusReporting, "installFocusReporting");
71710
-
71711
- // src/tui/fullscreen/mode.ts
71712
- var OFF = /* @__PURE__ */ new Set(["", "0", "false", "no", "off"]);
71713
- function fullscreenFromEnv(env3) {
71714
- const raw = env3.NAMZU_FULLSCREEN;
71715
- if (raw === void 0) return void 0;
71716
- return !OFF.has(raw.trim().toLowerCase());
71717
- }
71718
- __name(fullscreenFromEnv, "fullscreenFromEnv");
71719
- function resolveFullscreen(world) {
71720
- if (!world.interactive || world.hosted) return false;
71721
- return fullscreenFromEnv(world.env) ?? world.setting ?? false;
71722
- }
71723
- __name(resolveFullscreen, "resolveFullscreen");
71724
-
71725
- // src/tui/fullscreen/mouse-wheel.ts
71726
- var REPORT = /\u001b\[<(\d+);(\d+);(\d+)([Mm])/g;
71727
- var UNFINISHED = /\u001b\[<[\d;]*$/;
71728
- function wheelOf(code) {
71729
- if ((code & 64) === 0) return null;
71730
- return (code & 3) === 0 ? "up" : (code & 3) === 1 ? "down" : null;
71731
- }
71732
- __name(wheelOf, "wheelOf");
71733
- function pointerOf(code, x, y, kind) {
71734
- if ((code & 3) !== 0 || (code & 64) !== 0) return null;
71735
- if (kind === "m") return { kind: "release", x, y };
71736
- return { kind: (code & 32) !== 0 ? "drag" : "press", x, y };
71737
- }
71738
- __name(pointerOf, "pointerOf");
71739
- function createMouseFilter() {
71740
- let held = "";
71741
- return {
71742
- feed(chunk) {
71743
- const input = held + chunk;
71744
- held = "";
71745
- if (!input.includes("\x1B[<")) return { text: input, wheel: [], pointer: [] };
71746
- const wheel = [];
71747
- const pointer = [];
71748
- let text = input.replace(REPORT, (_all, code, x, y, kind) => {
71749
- const direction = kind === "M" ? wheelOf(Number(code)) : null;
71750
- if (direction) wheel.push(direction);
71751
- else {
71752
- const report = pointerOf(Number(code), Number(x), Number(y), kind);
71753
- if (report) pointer.push(report);
71754
- }
71755
- return "";
71756
- });
71757
- const tail2 = UNFINISHED.exec(text);
71758
- if (tail2) {
71759
- held = tail2[0];
71760
- text = text.slice(0, tail2.index);
71761
- }
71762
- return { text, wheel, pointer };
71763
- }
71764
- };
71765
- }
71766
- __name(createMouseFilter, "createMouseFilter");
71767
- function installMouseWheel(stdin, stdout, onWheel, onPointer) {
71768
- if (stdin.isTTY !== true || stdout.isTTY !== true) return () => void 0;
71769
- const filter = createMouseFilter();
71770
- const originalRead = stdin.read;
71771
- const write = /* @__PURE__ */ __name((text) => {
71772
- try {
71773
- stdout.write(text);
71774
- } catch {
71775
- }
71776
- }, "write");
71777
- stdin.read = /* @__PURE__ */ __name(function patchedRead(...args) {
71778
- const chunk = originalRead.apply(this, args);
71779
- if (typeof chunk !== "string") return chunk;
71780
- const filtered = filter.feed(chunk);
71781
- for (const direction of filtered.wheel) onWheel(direction);
71782
- if (onPointer) for (const report of filtered.pointer) onPointer(report);
71783
- return filtered.text;
71784
- }, "patchedRead");
71785
- write(mouseOn(onPointer ? "full" : "scroll"));
71786
- let removed = false;
71787
- return () => {
71788
- if (removed) return;
71789
- removed = true;
71790
- stdin.read = originalRead;
71791
- write(MOUSE_OFF);
71792
- };
71793
- }
71794
- __name(installMouseWheel, "installMouseWheel");
71795
- var FULLSCREEN_PANIC_RESET = `${MOUSE_OFF}\x1B[?2004l\x1B[?25h`;
71796
-
71797
- // src/tui/hint-counts.ts
71798
- import { randomUUID } from "node:crypto";
71799
- import { mkdirSync as mkdirSync5, readFileSync as readFileSync8, renameSync as renameSync4, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "node:fs";
71800
- import { dirname as dirname2, join as join11 } from "node:path";
71801
- var FILE_MODE = 384;
71802
- var DIR_MODE = 448;
71803
- function hintCountsPath(home) {
71804
- return join11(namzuHomePath(home), "hint-counts.json");
71805
- }
71806
- __name(hintCountsPath, "hintCountsPath");
71807
- function readAll(path) {
71808
- try {
71809
- const parsed = JSON.parse(readFileSync8(path, "utf8"));
71810
- if (typeof parsed !== "object" || parsed === null) return {};
71811
- const counts2 = {};
71812
- for (const [key, value] of Object.entries(parsed)) {
71813
- if (typeof value === "number" && Number.isInteger(value) && value >= 0) counts2[key] = value;
71814
- }
71815
- return counts2;
71816
- } catch {
71817
- return {};
71818
- }
71819
- }
71820
- __name(readAll, "readAll");
71821
- function readHintCount(name, home) {
71822
- return readAll(hintCountsPath(home))[name] ?? 0;
71823
- }
71824
- __name(readHintCount, "readHintCount");
71825
- function writeHintCount(name, count2, home) {
71826
- const path = hintCountsPath(home);
71827
- const temp = `${path}.${randomUUID()}.tmp`;
71828
- try {
71829
- mkdirSync5(dirname2(path), { recursive: true, mode: DIR_MODE });
71830
- writeFileSync4(temp, `${JSON.stringify({ ...readAll(path), [name]: count2 }, null, 2)}
71831
- `, {
71832
- mode: FILE_MODE
71833
- });
71834
- renameSync4(temp, path);
71835
- } catch {
71836
- rmSync3(temp, { force: true });
71837
- }
71838
- }
71839
- __name(writeHintCount, "writeHintCount");
71840
- function fileQueuedHintCount(home) {
71841
- return {
71842
- read: /* @__PURE__ */ __name(() => readHintCount("queuedMessagesHint", home), "read"),
71843
- write: /* @__PURE__ */ __name((count2) => writeHintCount("queuedMessagesHint", count2, home), "write")
71844
- };
71845
- }
71846
- __name(fileQueuedHintCount, "fileQueuedHintCount");
71847
-
71848
- // src/tui/log-pane.tsx
71849
- var RING_CAPACITY = 512;
71850
- function createRingBufferSink(capacity) {
71851
- const buffer = [];
71852
- return {
71853
- emit(record3) {
71854
- buffer.push(record3);
71855
- if (buffer.length > capacity) buffer.shift();
71856
- },
71857
- drain() {
71858
- return buffer.splice(0, buffer.length);
71859
- }
71860
- };
71861
- }
71862
- __name(createRingBufferSink, "createRingBufferSink");
71863
- function installTuiLogSink(logging) {
71864
- const resolved = contextLogging({ logging });
71865
- const ring = createRingBufferSink(RING_CAPACITY);
71866
- installCliLogging(ring, resolved.level);
71867
- let settled2 = false;
71868
- const detach = /* @__PURE__ */ __name(() => {
71869
- process.removeListener("uncaughtException", onFatal);
71870
- process.removeListener("unhandledRejection", onFatal);
71871
- }, "detach");
71872
- const collectDiagnostics = /* @__PURE__ */ __name(() => {
71873
- if (settled2) return "";
71874
- settled2 = true;
71875
- detach();
71876
- let text = "";
71877
- const sink = {
71878
- write: /* @__PURE__ */ __name((chunk) => {
71879
- text += String(chunk);
71880
- return true;
71881
- }, "write")
71882
- };
71883
- const out = resolved.format === "json" ? jsonLinesSink(sink) : prettySink(sink);
71884
- for (const record3 of ring.drain()) out.emit(record3);
71885
- return text;
71886
- }, "collectDiagnostics");
71887
- const flush = /* @__PURE__ */ __name(() => {
71888
- if (settled2) return;
71889
- settled2 = true;
71890
- detach();
71891
- const out = resolved.format === "json" ? jsonLinesSink(process.stderr) : prettySink(process.stderr);
71892
- for (const record3 of ring.drain()) out.emit(record3);
71893
- }, "flush");
71894
- const close = /* @__PURE__ */ __name(() => {
71895
- if (settled2) return;
71896
- settled2 = true;
71897
- detach();
71898
- ring.drain();
71899
- }, "close");
71900
- const onFatal = /* @__PURE__ */ __name((err) => {
71901
- const diagnostics = collectDiagnostics();
71902
- process.stderr.write(reportCrash(err, { extra: diagnostics }));
71903
- process.exit(EXIT_INTERNAL_ERROR);
71904
- }, "onFatal");
71905
- process.once("uncaughtException", onFatal);
71906
- process.once("unhandledRejection", onFatal);
71907
- return { close, flush };
71908
- }
71909
- __name(installTuiLogSink, "installTuiLogSink");
71910
-
71911
- // src/tui/output-size-watch.ts
71912
- var SIZE_WATCH_INTERVAL_MS = 250;
71913
- function watchOutputSize(output, platform2 = process.platform, timers = { setInterval, clearInterval }) {
71914
- if (platform2 !== "win32" || output.isTTY !== true) return void 0;
71915
- if (typeof output._refreshSize !== "function") return void 0;
71916
- const handle = timers.setInterval(() => {
71917
- try {
71918
- output._refreshSize?.();
71919
- } catch {
71920
- }
71921
- }, SIZE_WATCH_INTERVAL_MS);
71922
- handle?.unref?.();
71923
- return () => timers.clearInterval(handle);
71924
- }
71925
- __name(watchOutputSize, "watchOutputSize");
71926
-
71927
- // src/tui/paste-marker-guard.ts
71928
- var ESC4 = "\x1B";
71929
- var MARKERS = [`${ESC4}[200~`, `${ESC4}[201~`];
71930
- var SHARED_PREFIX_MS = 200;
71931
- var MARKER_PREFIX_MS = 2e3;
71932
- function heldTailLength(text) {
71933
- const longest = Math.min(text.length, MARKERS[0].length - 1);
71934
- for (let length = longest; length >= 2; length -= 1) {
71935
- const tail2 = text.slice(-length);
71936
- if (MARKERS.some((marker) => marker.startsWith(tail2))) return length;
71937
- }
71938
- return 0;
71939
- }
71940
- __name(heldTailLength, "heldTailLength");
71941
- function createPasteMarkerGuard(onRelease) {
71942
- let held = "";
71943
- let ready = "";
71944
- let timer;
71945
- const stop = /* @__PURE__ */ __name(() => {
71946
- if (timer === void 0) return;
71947
- clearTimeout(timer);
71948
- timer = void 0;
71949
- }, "stop");
71950
- return {
71951
- read(chunk) {
71952
- if (chunk === null) {
71953
- const out2 = ready;
71954
- ready = "";
71955
- return out2 === "" ? null : out2;
71956
- }
71957
- stop();
71958
- const input = ready + held + chunk;
71959
- ready = "";
71960
- held = "";
71961
- const keep = heldTailLength(input);
71962
- if (keep > 0) {
71963
- held = input.slice(input.length - keep);
71964
- const bound = keep >= 4 ? MARKER_PREFIX_MS : SHARED_PREFIX_MS;
71965
- timer = setTimeout(() => {
71966
- timer = void 0;
71967
- ready = held;
71968
- held = "";
71969
- onRelease();
71970
- }, bound);
71971
- }
71972
- const out = input.slice(0, input.length - keep);
71973
- return out === "" ? null : out;
71974
- },
71975
- dispose() {
71976
- stop();
71977
- }
71978
- };
71979
- }
71980
- __name(createPasteMarkerGuard, "createPasteMarkerGuard");
71981
- function installPasteMarkerGuard(stdin) {
71982
- const originalRead = stdin.read;
71983
- const guard = createPasteMarkerGuard(() => stdin.emit("readable"));
71984
- stdin.read = /* @__PURE__ */ __name(function patchedRead(...args) {
71985
- for (; ; ) {
71986
- const chunk = originalRead.apply(this, args);
71987
- if (chunk !== null && typeof chunk !== "string") return chunk;
71988
- const passed = guard.read(chunk);
71989
- if (passed !== null || chunk === null) return passed;
71990
- }
71991
- }, "patchedRead");
71992
- let removed = false;
71993
- return () => {
71994
- if (removed) return;
71995
- removed = true;
71996
- guard.dispose();
71997
- stdin.read = originalRead;
71998
- };
71999
- }
72000
- __name(installPasteMarkerGuard, "installPasteMarkerGuard");
72001
-
72002
- // src/tui/render-mode.ts
72003
- function liveRenderOption(stdout, input, inputIsConsole) {
72004
- return stdout.isTTY === true && (input.isTTY === true || inputIsConsole) ? { interactive: true } : {};
72005
- }
72006
- __name(liveRenderOption, "liveRenderOption");
72007
-
72008
- // src/tui/theme-launch.ts
72009
- var BACKGROUND_QUERY_WAIT_MS = 250;
72010
- function applyLaunchTheme(tui, streams, env3 = process.env) {
72011
- setReducedMotion(tui?.reducedMotion === true);
72012
- const setting = tui?.theme ?? "dark";
72013
- if (setting !== "auto") {
72014
- setThemeSetting(setting, { env: env3 });
72015
- return void 0;
72016
- }
72017
- const settle = /* @__PURE__ */ __name((reported) => {
72018
- const answer = reported ?? backgroundFromColorFgBg(env3.COLORFGBG);
72019
- setThemeSetting("auto", { env: env3, ...answer ? { reported: answer } : {} });
72020
- }, "settle");
72021
- if (!streams) {
72022
- settle(void 0);
72023
- return void 0;
72024
- }
72025
- return askTerminal(streams).then(settle);
72026
- }
72027
- __name(applyLaunchTheme, "applyLaunchTheme");
72028
- async function askTerminal(streams) {
72029
- let timer;
72030
- const giveUp = new Promise((resolve10) => {
72031
- timer = setTimeout(resolve10, BACKGROUND_QUERY_WAIT_MS);
72032
- });
72033
- try {
72034
- return await queryTerminalBackground(streams, giveUp);
72035
- } finally {
72036
- clearTimeout(timer);
72037
- }
72038
- }
72039
- __name(askTerminal, "askTerminal");
72040
-
72041
- // src/tui/tip-history.ts
72042
- import { randomUUID as randomUUID2 } from "node:crypto";
72043
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync9, renameSync as renameSync5, rmSync as rmSync4, writeFileSync as writeFileSync5 } from "node:fs";
72044
- import { dirname as dirname3, join as join12 } from "node:path";
72045
- var FILE_MODE2 = 384;
72046
- var DIR_MODE2 = 448;
72047
- var EMPTY_TIP_HISTORY = { launches: 0, shown: {}, used: {} };
72048
- function tipHistoryPath(home) {
72049
- return join12(namzuHomePath(home), "tip-history.json");
72050
- }
72051
- __name(tipHistoryPath, "tipHistoryPath");
72052
- function wholeNumber(value) {
72053
- return typeof value === "number" && Number.isInteger(value) && value >= 0;
72054
- }
72055
- __name(wholeNumber, "wholeNumber");
72056
- function readTipHistory(path) {
72057
- try {
72058
- const parsed = JSON.parse(readFileSync9(path, "utf8"));
72059
- if (typeof parsed !== "object" || parsed === null) return EMPTY_TIP_HISTORY;
72060
- const raw = parsed;
72061
- const shown = {};
72062
- if (typeof raw.shown === "object" && raw.shown !== null) {
72063
- for (const [id, entry] of Object.entries(raw.shown)) {
72064
- const e = entry;
72065
- if (e && wholeNumber(e.lastLaunch) && wholeNumber(e.total))
72066
- shown[id] = { lastLaunch: e.lastLaunch, total: e.total };
72067
- }
72068
- }
72069
- const used = {};
72070
- if (typeof raw.used === "object" && raw.used !== null) {
72071
- for (const [name, count2] of Object.entries(raw.used))
72072
- if (wholeNumber(count2)) used[name] = count2;
72073
- }
72074
- return { launches: wholeNumber(raw.launches) ? raw.launches : 0, shown, used };
72075
- } catch {
72076
- return EMPTY_TIP_HISTORY;
72077
- }
72078
- }
72079
- __name(readTipHistory, "readTipHistory");
72080
- function writeTipHistory(path, history) {
72081
- const temp = `${path}.${randomUUID2()}.tmp`;
72082
- try {
72083
- mkdirSync6(dirname3(path), { recursive: true, mode: DIR_MODE2 });
72084
- writeFileSync5(temp, `${JSON.stringify(history, null, 2)}
72085
- `, { mode: FILE_MODE2 });
72086
- renameSync5(temp, path);
72087
- } catch {
72088
- try {
72089
- rmSync4(temp, { force: true });
72090
- } catch {
72091
- }
72092
- }
72093
- }
72094
- __name(writeTipHistory, "writeTipHistory");
72095
- function fileTipHistory(home) {
72096
- const path = tipHistoryPath(home);
72097
- const update = /* @__PURE__ */ __name((change) => writeTipHistory(path, change(readTipHistory(path))), "update");
72098
- return {
72099
- read: /* @__PURE__ */ __name(() => readTipHistory(path), "read"),
72100
- recordLaunch: /* @__PURE__ */ __name(() => update((h) => ({ ...h, launches: h.launches + 1 })), "recordLaunch"),
72101
- // Idempotent within a launch: a tip counts once per start, however often it is picked.
72102
- recordShown: /* @__PURE__ */ __name((id) => update(
72103
- (h) => h.shown[id]?.lastLaunch === h.launches ? h : {
72104
- ...h,
72105
- shown: {
72106
- ...h.shown,
72107
- [id]: { lastLaunch: h.launches, total: (h.shown[id]?.total ?? 0) + 1 }
72108
- }
72109
- }
72110
- ), "recordShown"),
72111
- recordUse: /* @__PURE__ */ __name((command) => update((h) => ({ ...h, used: { ...h.used, [command]: (h.used[command] ?? 0) + 1 } })), "recordUse")
72112
- };
72113
- }
72114
- __name(fileTipHistory, "fileTipHistory");
72115
-
72116
- // src/tui/zoom/leave.ts
72117
- async function leaveWorkspacesBounded(options) {
72118
- let wanted = true;
72119
- let timer;
72120
- const hand = /* @__PURE__ */ __name(async () => {
72121
- if (await options.release(() => wanted)) {
72122
- if (wanted) await options.flush();
72123
- }
72124
- }, "hand");
72125
- try {
72126
- await Promise.race([
72127
- hand().catch(() => void 0),
72128
- new Promise((resolve10) => {
72129
- timer = setTimeout(resolve10, options.limitMs);
72130
- })
72131
- ]);
72132
- } finally {
72133
- wanted = false;
72134
- clearTimeout(timer);
72135
- }
72136
- }
72137
- __name(leaveWorkspacesBounded, "leaveWorkspacesBounded");
72138
-
72139
- // src/tui/zoom/proxy.ts
72140
- import { EventEmitter as EventEmitter3 } from "node:events";
72141
- var HIDE = "\x1B[?25l";
72142
- var SHOW = "\x1B[?25h";
72143
- var PASTE_ON = "\x1B[?2004h";
72144
- var PASTE_OFF = "\x1B[?2004l";
72145
- var RESIZE = "resize";
72146
- function createTerminalProxy(realOut, realIn) {
72147
- let zoomed = null;
72148
- let keyHandler = null;
72149
- const realResizes = /* @__PURE__ */ new Set();
72150
- const injected = [];
72151
- let announced = false;
72152
- let cursorHidden = false;
72153
- let bracketedPaste = false;
72154
- const resizes = new EventEmitter3();
72155
- let subscribed = false;
72156
- const noteModes = /* @__PURE__ */ __name((chunk) => {
72157
- if (typeof chunk !== "string") return;
72158
- if (chunk.includes("\x1B[?25")) {
72159
- const hide = chunk.lastIndexOf(HIDE);
72160
- const show2 = chunk.lastIndexOf(SHOW);
72161
- if (hide !== show2) cursorHidden = hide > show2;
72162
- }
72163
- if (chunk.includes("\x1B[?2004")) {
72164
- const on = chunk.lastIndexOf(PASTE_ON);
72165
- const off = chunk.lastIndexOf(PASTE_OFF);
72166
- if (on !== off) bracketedPaste = on > off;
72167
- }
72168
- }, "noteModes");
72169
- const subscribe = /* @__PURE__ */ __name(() => {
72170
- if (subscribed) return;
72171
- subscribed = true;
72172
- realOut.on(RESIZE, () => {
72173
- if (zoomed) for (const listener of [...realResizes]) listener();
72174
- else resizes.emit(RESIZE);
72175
- });
72176
- }, "subscribe");
72177
- const out = new Proxy(realOut, {
72178
- get(target, prop) {
72179
- if (prop === "write") {
72180
- return (chunk, ...rest) => {
72181
- noteModes(chunk);
72182
- if (zoomed === null)
72183
- return Reflect.apply(target.write, target, [chunk, ...rest]);
72184
- zoomed.write(typeof chunk === "string" ? chunk : String(chunk));
72185
- const done = rest.find((r) => typeof r === "function");
72186
- done?.();
72187
- return true;
72188
- };
72189
- }
72190
- if (prop === "columns") return zoomed ? zoomed.columns : target.columns;
72191
- if (prop === "rows") return zoomed ? zoomed.rows : target.rows;
72192
- if (prop === "getWindowSize") {
72193
- return () => zoomed ? [zoomed.columns, zoomed.rows] : target.getWindowSize();
72194
- }
72195
- if (prop === "on" || prop === "addListener" || prop === "once" || prop === "off" || prop === "removeListener") {
72196
- return (event, listener) => {
72197
- if (event !== RESIZE) {
72198
- Reflect.apply(target[prop], target, [event, listener]);
72199
- return out;
72200
- }
72201
- subscribe();
72202
- resizes[prop](event, listener);
72203
- return out;
72204
- };
72205
- }
72206
- const value = Reflect.get(target, prop, target);
72207
- return typeof value === "function" ? value.bind(target) : value;
72208
- }
72209
- });
72210
- const inn = new Proxy(realIn, {
72211
- get(target, prop) {
72212
- if (prop === "read") {
72213
- return (...args) => {
72214
- for (; ; ) {
72215
- const next = injected.shift();
72216
- if (next !== void 0) return next;
72217
- const chunk = Reflect.apply(target.read, target, args);
72218
- if (typeof chunk !== "string") return chunk;
72219
- if (zoomed !== null && keyHandler !== null) {
72220
- const kept = keyHandler(chunk);
72221
- if (kept !== null) return kept;
72222
- continue;
72223
- }
72224
- return chunk;
72225
- }
72226
- };
72227
- }
72228
- const value = Reflect.get(target, prop, target);
72229
- return typeof value === "function" ? value.bind(target) : value;
72230
- }
72231
- });
72232
- return {
72233
- stdout: out,
72234
- stdin: inn,
72235
- get mode() {
72236
- return zoomed ? "zoomed" : "direct";
72237
- },
72238
- get cursorHidden() {
72239
- return cursorHidden;
72240
- },
72241
- get bracketedPaste() {
72242
- return bracketedPaste;
72243
- },
72244
- enterZoomed(output, onKey) {
72245
- zoomed = output;
72246
- keyHandler = onKey;
72247
- resizes.emit(RESIZE);
72248
- },
72249
- leaveZoomed() {
72250
- zoomed = null;
72251
- keyHandler = null;
72252
- resizes.emit(RESIZE);
72253
- },
72254
- resizeZoomed(columns, rows) {
72255
- if (!zoomed) return;
72256
- zoomed.columns = columns;
72257
- zoomed.rows = rows;
72258
- resizes.emit(RESIZE);
72259
- },
72260
- onRealResize(listener) {
72261
- realResizes.add(listener);
72262
- subscribe();
72263
- return () => {
72264
- realResizes.delete(listener);
72265
- };
72266
- },
72267
- inject(chunk) {
72268
- injected.push(chunk);
72269
- if (announced) return;
72270
- announced = true;
72271
- queueMicrotask(() => {
72272
- announced = false;
72273
- if (injected.length > 0) realIn.emit("readable");
72274
- });
72275
- }
72276
- };
72277
- }
72278
- __name(createTerminalProxy, "createTerminalProxy");
72279
-
72280
- // src/tui/index.tsx
72281
- var LEAVE_WORKSPACES_MS = 2e3;
72282
- async function launchTui(ctx, options = {}) {
72283
- const invocation = {
72284
- cwd: resolve9(ctx.cwd),
72285
- command: options.resumeCommand,
72286
- ...ctx.palId ? { palId: ctx.palId } : {}
72287
- };
72288
- const logs = installTuiLogSink(ctx.logging);
72289
- const tipHistory = fileTipHistory();
72290
- tipHistory.recordLaunch();
72291
- let exitSummary = null;
72292
- writeLaunchMouseReset(process.stdout, hostedByHost(process.env, process.ppid));
72293
- const fullscreen = resolveFullscreen({
72294
- env: process.env,
72295
- ...ctx.tui?.fullscreen !== void 0 ? { setting: ctx.tui.fullscreen } : {},
72296
- interactive: process.stdout.isTTY === true && process.stdin.isTTY === true,
72297
- hosted: hostedByHost(process.env, process.ppid)
72298
- });
72299
- if (process.stdout.isTTY && !fullscreen) {
72300
- process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
72301
- }
72302
- const termination = handleTerminationSignals();
72303
- const consoleInput = openConsoleInput();
72304
- const stopSizeWatch = watchOutputSize(process.stdout);
72305
- const themeReady = applyLaunchTheme(
72306
- ctx.tui,
72307
- consoleInput === void 0 ? { input: process.stdin, output: process.stdout } : void 0
72308
- );
72309
- if (themeReady) await themeReady;
72310
- const inputStream = consoleInput?.stream ?? process.stdin;
72311
- const stopPasteMarkerGuard = installPasteMarkerGuard(inputStream);
72312
- const stopFocusReporting = installFocusReporting(
72313
- inputStream,
72314
- process.stdout,
72315
- (focused) => terminalFocus.set(focused)
72316
- );
72317
- const hosted = hostedByHost(process.env, process.ppid);
72318
- const proxy = !hosted && !fullscreen && consoleInput === void 0 && process.platform !== "win32" && process.stdout.isTTY === true && inputStream.isTTY === true ? createTerminalProxy(process.stdout, inputStream) : null;
72319
- const terminationExit = { current: null };
72320
- const repaint = { current: null };
72321
- const workspaces = {
72322
- current: null
72323
- };
72324
- const workspacesEntry = /* @__PURE__ */ __name(() => {
72325
- workspaces.current ??= import("./entry-CZ63UJYN.js").then(
72326
- (m) => m.createWorkspacesEntry({
72327
- proxy,
72328
- realOut: process.stdout,
72329
- env: process.env,
72330
- cwd: process.cwd(),
72331
- entry: process.argv[1],
72332
- prefixSetting: ctx.tui?.workspacesPrefix ?? ctx.tui?.spacesPrefix,
72333
- ...ctx.tui?.mouse !== void 0 ? { mouseSetting: ctx.tui.mouse } : {},
72334
- ...ctx.tui?.copyOnSelect !== void 0 ? { copyOnSelect: ctx.tui.copyOnSelect } : {},
72335
- requestExit: /* @__PURE__ */ __name(() => terminationExit.current ? terminationExit.current() : instance.unmount(), "requestExit"),
72336
- repaint: /* @__PURE__ */ __name(() => repaint.current?.(), "repaint")
72337
- })
72338
- );
72339
- return workspaces.current;
72340
- }, "workspacesEntry");
72341
- const onOpenWorkspaces = hosted ? () => {
72342
- process.stdout.write(workspacesSignal("zoom-out"));
72343
- return Promise.resolve(true);
72344
- } : proxy !== null ? async () => {
72345
- try {
72346
- return await (await workspacesEntry()).open();
72347
- } catch {
72348
- return false;
72349
- }
72350
- } : void 0;
72351
- const onConfirmExit = !hosted && proxy !== null ? async () => {
72352
- try {
72353
- return workspaces.current === null ? true : await (await workspaces.current).confirmExit();
72354
- } catch {
72355
- return true;
72356
- }
72357
- } : void 0;
72358
- const beforeExit = !hosted && proxy !== null ? async () => {
72359
- if (workspaces.current === null) return;
72360
- await leaveWorkspacesBounded({
72361
- release: /* @__PURE__ */ __name((stillWanted) => workspaces.current.then(
72362
- (entry) => entry.release(stillWanted)
72363
- ), "release"),
72364
- flush: /* @__PURE__ */ __name(() => instance.waitUntilRenderFlush(), "flush"),
72365
- limitMs: LEAVE_WORKSPACES_MS
72366
- });
72367
- } : void 0;
72368
- let terminatedBy = null;
72369
- const wheelListeners = /* @__PURE__ */ new Set();
72370
- const pointerListeners = /* @__PURE__ */ new Set();
72371
- const selectable = fullscreen && resolveMouseMode(process.env, ctx.tui?.mouse) === "full";
72372
- const fullscreenHost = fullscreen ? {
72373
- ...selectable ? {
72374
- subscribePointer: /* @__PURE__ */ __name((listener) => {
72375
- pointerListeners.add(listener);
72376
- return () => {
72377
- pointerListeners.delete(listener);
72378
- };
72379
- }, "subscribePointer")
72380
- } : {},
72381
- ...ctx.tui?.copyOnSelect !== void 0 ? { copyOnSelect: ctx.tui.copyOnSelect } : {},
72382
- subscribeWheel: /* @__PURE__ */ __name((listener) => {
72383
- wheelListeners.add(listener);
72384
- return () => {
72385
- wheelListeners.delete(listener);
72386
- };
72387
- }, "subscribeWheel")
72388
- } : void 0;
72389
- const instance = render_default(
72390
- import_react63.default.createElement(App2, {
72391
- ctx,
72392
- onExitSummary: /* @__PURE__ */ __name((summary2) => {
72393
- exitSummary = summary2;
72394
- }, "onExitSummary"),
72395
- terminationExit,
72396
- repaint,
72397
- ...fullscreenHost ? { fullscreen: fullscreenHost } : {},
72398
- ...onOpenWorkspaces ? { onOpenWorkspaces } : {},
72399
- ...onConfirmExit ? { onConfirmExit } : {},
72400
- ...beforeExit ? { beforeExit } : {},
72401
- examplePrompts: true,
72402
- decisionSetup: {},
72403
- queuedHintCount: fileQueuedHintCount(),
72404
- tipHistory
72405
- }),
72406
- {
72407
- stdout: proxy?.stdout ?? process.stdout,
72408
- stderr: process.stderr,
72409
- stdin: proxy?.stdin ?? inputStream,
72410
- exitOnCtrlC: false,
72411
- // A CI marker in the environment must not blank a real terminal (see render-mode.ts).
72412
- ...liveRenderOption(process.stdout, process.stdin, consoleInput !== void 0),
72413
- // Ink enters the alternate screen here and leaves it on every way out
72414
- // (unmount, a signal, a crash). It repaints only the lines that changed.
72415
- ...fullscreen ? { alternateScreen: true, incrementalRendering: true } : {},
72416
- kittyKeyboard: {
72417
- mode: "auto",
72418
- flags: ["disambiguateEscapeCodes"]
72419
- }
72420
- }
72421
- );
72422
- const stopWheel = fullscreen ? installMouseWheel(
72423
- inputStream,
72424
- process.stdout,
72425
- (direction) => {
72426
- for (const listener of wheelListeners) listener(direction);
72427
- },
72428
- selectable ? (report) => {
72429
- for (const listener of pointerListeners) listener(report);
72430
- } : void 0
72431
- ) : void 0;
72432
- const panicReset = fullscreen ? () => process.stdout.write(FULLSCREEN_PANIC_RESET) : void 0;
72433
- if (panicReset) process.on("exit", panicReset);
72434
- termination.onTerminate(async (signal) => {
72435
- terminatedBy = signal;
72436
- if (signal === "SIGHUP") {
72437
- process.stdout.on("error", () => void 0);
72438
- process.stderr.on("error", () => void 0);
72439
- }
72440
- if (terminationExit.current) terminationExit.current();
72441
- else instance.unmount();
72442
- await instance.waitUntilExit();
72443
- if (workspaces.current !== null) await (await workspaces.current).shutdown();
72444
- });
72445
- try {
72446
- await instance.waitUntilExit();
72447
- } finally {
72448
- if (workspaces.current !== null) await (await workspaces.current).shutdown();
72449
- termination.dispose();
72450
- stopSizeWatch?.();
72451
- stopFocusReporting();
72452
- stopWheel?.();
72453
- stopPasteMarkerGuard();
72454
- if (panicReset) process.off("exit", panicReset);
72455
- consoleInput?.release();
72456
- logs.close();
72457
- const summary2 = terminatedBy === "SIGHUP" ? "" : formatTuiExitSummary(exitSummary, invocation);
72458
- if (summary2.length > 0) process.stdout.write(summary2);
72459
- }
72460
- }
72461
- __name(launchTui, "launchTui");
72462
71766
  export {
72463
- launchTui
71767
+ render_default,
71768
+ glyphForRole,
71769
+ terminalFocus,
71770
+ trailFromRecords,
71771
+ projectConversation,
71772
+ App2 as App
72464
71773
  };
72465
71774
  /*! Bundled license information:
72466
71775
 
@@ -72552,4 +71861,4 @@ react/cjs/react-jsx-runtime.development.js:
72552
71861
  * LICENSE file in the root directory of this source tree.
72553
71862
  *)
72554
71863
  */
72555
- //# sourceMappingURL=tui-L4BRR4H5.js.map
71864
+ //# sourceMappingURL=chunk-ILPXZDTW.js.map