@namzu/cli 38.1.1 → 38.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 (347) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/checkpoints/store.d.ts +4 -4
  4. package/dist/checkpoints/store.d.ts.map +1 -1
  5. package/dist/chunks/{acp-GBQKP3SQ.js → acp-JU4DX3RK.js} +36 -36
  6. package/dist/chunks/{activity-command-6CVS5DZI.js → activity-command-TERANSMO.js} +11 -11
  7. package/dist/chunks/{add-VVRTXHDQ.js → add-MZ6KIHY3.js} +16 -16
  8. package/dist/chunks/{agent-UZHYPLYW.js → agent-JZFFS4IP.js} +29 -27
  9. package/dist/chunks/agent-session-YS3JWF6Z.js +52 -0
  10. package/dist/chunks/{archive-YWLKZACK.js → archive-SXYHKL3H.js} +9 -9
  11. package/dist/chunks/{bin-main-LVQFA6PZ.js → bin-main-TFKZQ7NF.js} +3 -3
  12. package/dist/chunks/{browser-HD24O6AL.js → browser-3U3YBKL6.js} +6 -6
  13. package/dist/chunks/{chat-VOBGMUI3.js → chat-37QA7HHN.js} +14 -14
  14. package/dist/chunks/{chunk-42GHVPZE.js → chunk-2SVXX5QK.js} +5 -5
  15. package/dist/chunks/{chunk-6GJXAHUO.js → chunk-2T7TZDUE.js} +2 -2
  16. package/dist/chunks/{chunk-2UBCLXGV.js → chunk-2UT6U22B.js} +2 -2
  17. package/dist/chunks/{chunk-SDABAQVK.js → chunk-2UUBILYI.js} +4 -4
  18. package/dist/chunks/chunk-2WHVZCLT.js +118 -0
  19. package/dist/chunks/chunk-2WHVZCLT.js.map +6 -0
  20. package/dist/chunks/{chunk-XXBN2OWW.js → chunk-3NIZKJJG.js} +2 -2
  21. package/dist/chunks/{chunk-HQ37JKI2.js → chunk-3PBSWF6X.js} +3 -3
  22. package/dist/chunks/{chunk-52E6DDZD.js → chunk-5G3VKTLZ.js} +2 -2
  23. package/dist/chunks/{chunk-MDEIMYQU.js → chunk-5PDW6VPO.js} +20 -83
  24. package/dist/chunks/chunk-5PDW6VPO.js.map +6 -0
  25. package/dist/chunks/{chunk-BGM3PULY.js → chunk-6A7P3I3N.js} +38 -31
  26. package/dist/chunks/{chunk-BGM3PULY.js.map → chunk-6A7P3I3N.js.map} +1 -1
  27. package/dist/chunks/{chunk-G6QXPPH3.js → chunk-7MLTWXEW.js} +2 -2
  28. package/dist/chunks/{chunk-YUX6OJOD.js → chunk-7O4X4GYL.js} +7 -7
  29. package/dist/chunks/{chunk-7M3YW2NF.js → chunk-7S5UB6DX.js} +6 -6
  30. package/dist/chunks/{chunk-XM3W7NMM.js → chunk-A64X23MU.js} +811 -276
  31. package/dist/chunks/chunk-A64X23MU.js.map +6 -0
  32. package/dist/chunks/{chunk-42CAONYE.js → chunk-AHVF22PV.js} +26 -11
  33. package/dist/chunks/chunk-AHVF22PV.js.map +6 -0
  34. package/dist/chunks/{chunk-US5ZFPAU.js → chunk-AXCOWIIH.js} +2 -7
  35. package/dist/chunks/{chunk-US5ZFPAU.js.map → chunk-AXCOWIIH.js.map} +1 -1
  36. package/dist/chunks/{chunk-JFZF3FQ2.js → chunk-B5344NIV.js} +3 -3
  37. package/dist/chunks/{chunk-XBCEWEQN.js → chunk-CDZT7WGY.js} +3 -3
  38. package/dist/chunks/{chunk-XNY2DD22.js → chunk-CK4TOW2N.js} +2 -2
  39. package/dist/chunks/{chunk-YE2PFKVU.js → chunk-CLIP7QVU.js} +3 -3
  40. package/dist/chunks/{chunk-HAJ7UV4Y.js → chunk-D5SIC3SF.js} +9 -9
  41. package/dist/chunks/{chunk-NR6YON2Q.js → chunk-DQICYFIG.js} +2 -2
  42. package/dist/chunks/{chunk-AEB7KCO6.js → chunk-EKMOETAY.js} +2 -2
  43. package/dist/chunks/{chunk-6ARSJBCV.js → chunk-EUHPTASG.js} +2 -2
  44. package/dist/chunks/{chunk-YBZMF6LC.js → chunk-FI7TIM5P.js} +2 -2
  45. package/dist/chunks/{chunk-OUTFB7EJ.js → chunk-FMJCN6JZ.js} +7 -5
  46. package/dist/chunks/chunk-FMJCN6JZ.js.map +6 -0
  47. package/dist/chunks/{chunk-5BZSCNGR.js → chunk-FOGCQUIH.js} +59 -140
  48. package/dist/chunks/chunk-FOGCQUIH.js.map +6 -0
  49. package/dist/chunks/{chunk-GXE2VIGI.js → chunk-GTXD263T.js} +2 -2
  50. package/dist/chunks/{chunk-5DJ5YIHY.js → chunk-HOOY63EB.js} +13 -13
  51. package/dist/chunks/{chunk-P7OXZHTL.js → chunk-ICBHR27I.js} +12 -12
  52. package/dist/chunks/{chunk-GIBXNY7Z.js → chunk-IG4O4UAL.js} +2 -2
  53. package/dist/chunks/{chunk-YA4IH46E.js → chunk-JN6M424Z.js} +4 -4
  54. package/dist/chunks/{chunk-MKPICNP7.js → chunk-KG2YA6TI.js} +3 -3
  55. package/dist/chunks/{chunk-65Y4XRJ7.js → chunk-KONWJQLM.js} +3 -3
  56. package/dist/chunks/{chunk-IP36P4KT.js → chunk-KUNQW3N3.js} +4 -4
  57. package/dist/chunks/{chunk-TDDCRQZZ.js → chunk-LBPM46OY.js} +2 -2
  58. package/dist/chunks/{chunk-WTF2RVKD.js → chunk-LC5VGZO2.js} +2 -2
  59. package/dist/chunks/{chunk-ALNCCKDI.js → chunk-LH6J5QQ7.js} +2 -2
  60. package/dist/chunks/{chunk-WXMFE5SS.js → chunk-LLZ32DHS.js} +494 -224
  61. package/dist/chunks/chunk-LLZ32DHS.js.map +6 -0
  62. package/dist/chunks/{chunk-MSNMI4KG.js → chunk-LPYWPRIF.js} +4 -4
  63. package/dist/chunks/{chunk-FDAOPSRK.js → chunk-M2EJQU3F.js} +4 -4
  64. package/dist/chunks/{chunk-UASN4SLO.js → chunk-N57QO3AA.js} +2 -2
  65. package/dist/chunks/{chunk-54BF5YUB.js → chunk-OA5772RG.js} +4 -4
  66. package/dist/chunks/{chunk-DTMONWML.js → chunk-PETRJVXF.js} +4 -4
  67. package/dist/chunks/{chunk-6N6HLU4F.js → chunk-Q6SF7T77.js} +3 -3
  68. package/dist/chunks/{chunk-AMT74CY7.js → chunk-S5U4BG57.js} +51 -20
  69. package/dist/chunks/chunk-S5U4BG57.js.map +6 -0
  70. package/dist/chunks/{chunk-Q3IWEW4F.js → chunk-TNTP3CNT.js} +25 -19
  71. package/dist/chunks/chunk-TNTP3CNT.js.map +6 -0
  72. package/dist/chunks/{chunk-MW3PKVXY.js → chunk-U75JG2RT.js} +2 -2
  73. package/dist/chunks/{chunk-H3LH5GZ5.js → chunk-UQZNYNX7.js} +2 -2
  74. package/dist/chunks/{chunk-LWXTAX2V.js → chunk-V2VHVH5S.js} +18 -8
  75. package/dist/chunks/chunk-V2VHVH5S.js.map +6 -0
  76. package/dist/chunks/{chunk-ZAUFSEHS.js → chunk-VFBIR3UC.js} +4 -4
  77. package/dist/chunks/{chunk-FHDYGPGC.js → chunk-WLHI2QSC.js} +3 -3
  78. package/dist/chunks/{chunk-VXHYLNLR.js → chunk-XEOZYKPJ.js} +3 -3
  79. package/dist/chunks/{chunk-J7RNZR6A.js → chunk-XIURI2PQ.js} +7 -7
  80. package/dist/chunks/{chunk-W47OQU6P.js → chunk-XKEMUEI5.js} +2 -2
  81. package/dist/chunks/{chunk-WWGLUAHZ.js → chunk-XNHYUV6G.js} +2 -2
  82. package/dist/chunks/{chunk-BSBFGZLW.js → chunk-Z4LTK3HY.js} +4 -4
  83. package/dist/chunks/{chunk-LQFMXCHI.js → chunk-Z56MZ7UW.js} +4 -4
  84. package/dist/chunks/{chunk-7LMPS6TV.js → chunk-ZJHOWWXZ.js} +12 -12
  85. package/dist/chunks/{chunk-XNOORMEP.js → chunk-ZJMUPGWD.js} +8 -8
  86. package/dist/chunks/{cli-runtime-53GYDVBD.js → cli-runtime-PRG53LL6.js} +18 -12
  87. package/dist/chunks/cli-runtime-PRG53LL6.js.map +6 -0
  88. package/dist/chunks/{commands-X2P7B7M6.js → commands-QMF4AHAY.js} +5 -5
  89. package/dist/chunks/{crash-report-YKKJEHWY.js → crash-report-BSZ6SUOF.js} +7 -7
  90. package/dist/chunks/{dist-ADL22Y3L.js → dist-56CMMYUT.js} +48 -5
  91. package/dist/chunks/dist-56CMMYUT.js.map +6 -0
  92. package/dist/chunks/{dist-TTCX7GFK.js → dist-GNI4DIHI.js} +2 -2
  93. package/dist/chunks/{dist-E24W5SI7.js → dist-HRWBXBF3.js} +2 -2
  94. package/dist/chunks/{dist-TYCOBKDT.js → dist-JDUOF4K7.js} +2 -2
  95. package/dist/chunks/{dist-EO3WQFRN.js → dist-MYWLKPXK.js} +2 -2
  96. package/dist/chunks/{dist-KP5U4QDN.js → dist-QSOTJL6Z.js} +2 -2
  97. package/dist/chunks/{dist-6ABVUWX5.js → dist-SO6XBKFN.js} +2 -2
  98. package/dist/chunks/{dist-5KZ4SS57.js → dist-XDA5OMB2.js} +2 -2
  99. package/dist/chunks/{doctor-QTMSOOEO.js → doctor-5MS7V3JB.js} +8 -8
  100. package/dist/chunks/{drain-FWONJITS.js → drain-YGGEC4UE.js} +10 -10
  101. package/dist/chunks/{eval-GQTJX6WI.js → eval-GWP6MISH.js} +2 -2
  102. package/dist/chunks/{exec-A5BM63JW.js → exec-YDIFQY7C.js} +27 -26
  103. package/dist/chunks/exec-YDIFQY7C.js.map +6 -0
  104. package/dist/chunks/{home-QAEAKEUG.js → home-IZ2H7PM3.js} +3 -3
  105. package/dist/chunks/{host-queries-NY6FDVNU.js → host-queries-UCVJBJXU.js} +14 -14
  106. package/dist/chunks/{lifecycle-EJQ57UR7.js → lifecycle-U52Z5ZMZ.js} +24 -24
  107. package/dist/chunks/{list-P5KDSX7R.js → list-SVKI2XOL.js} +12 -12
  108. package/dist/chunks/{login-PQAWB3YL.js → login-MNDG4XIT.js} +8 -8
  109. package/dist/chunks/{logs-PYWTK275.js → logs-M7RCXYPY.js} +4 -4
  110. package/dist/chunks/{mcp-QJRY437O.js → mcp-KEQMYKDA.js} +17 -17
  111. package/dist/chunks/{message-command-RGUNGNNC.js → message-command-FZ6VEUK5.js} +33 -33
  112. package/dist/chunks/{operator-tools-UH4SJXQJ.js → operator-tools-C57ZIYRG.js} +12 -12
  113. package/dist/chunks/{output-schema-BN6UL2BB.js → output-schema-IYQRSIUA.js} +3 -3
  114. package/dist/chunks/{pal-NAJGPRTW.js → pal-NXMTLY6Z.js} +11 -11
  115. package/dist/chunks/{providers-VTT4SK6S.js → providers-TZBRQDXE.js} +6 -6
  116. package/dist/chunks/{resident-AQYBL2GF.js → resident-DBIZBLOV.js} +21 -21
  117. package/dist/chunks/resume-GG6RMJXQ.js +22 -0
  118. package/dist/chunks/{resume-command-AOT7YZT5.js → resume-command-36S3HXPO.js} +4 -4
  119. package/dist/chunks/{schedule-WYFFJI6G.js → schedule-UR54S44B.js} +8 -8
  120. package/dist/chunks/{service-HAMHYSEA.js → service-VMXEAJCI.js} +23 -23
  121. package/dist/chunks/session-step-VJCHKPWD.js +29 -0
  122. package/dist/chunks/{skills-5TJTJEDG.js → skills-RXYS26H3.js} +8 -8
  123. package/dist/chunks/{state-ABEFSCFQ.js → state-NS47IVWW.js} +2 -2
  124. package/dist/chunks/{store-BL5L6BOI.js → store-3U2GZAZS.js} +9 -9
  125. package/dist/chunks/{store-WBED64YS.js → store-GNFHH2LZ.js} +4 -4
  126. package/dist/chunks/{store-UKFFPFLI.js → store-TO65IAIZ.js} +6 -6
  127. package/dist/chunks/{tui-EWFJ5CEO.js → tui-STU5UZBC.js} +2919 -1550
  128. package/dist/chunks/tui-STU5UZBC.js.map +6 -0
  129. package/dist/chunks/{upgrade-2HP3BTOT.js → upgrade-USIXROFG.js} +2 -2
  130. package/dist/chunks/{worktree-PNFBTACG.js → worktree-AYI5VJ5H.js} +11 -11
  131. package/dist/cli.d.ts.map +1 -1
  132. package/dist/config/composer-triggers.d.ts +1 -1
  133. package/dist/config/composer-triggers.d.ts.map +1 -1
  134. package/dist/config/schema.d.ts +2 -2
  135. package/dist/config/schema.d.ts.map +1 -1
  136. package/dist/index.js +13 -13
  137. package/dist/integrations/notifications/approval.d.ts +36 -0
  138. package/dist/integrations/notifications/approval.d.ts.map +1 -0
  139. package/dist/integrations/resident/runner-worker.js +18 -18
  140. package/dist/integrations/sessions/journal-trail.d.ts +6 -0
  141. package/dist/integrations/sessions/journal-trail.d.ts.map +1 -0
  142. package/dist/integrations/sessions/store.d.ts.map +1 -1
  143. package/dist/integrations/subagents/activity.d.ts.map +1 -1
  144. package/dist/integrations/subagents/failure-text.d.ts +13 -0
  145. package/dist/integrations/subagents/failure-text.d.ts.map +1 -0
  146. package/dist/integrations/subagents/runtime.d.ts +2 -0
  147. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  148. package/dist/integrations/trust/folder-grants.d.ts +20 -0
  149. package/dist/integrations/trust/folder-grants.d.ts.map +1 -0
  150. package/dist/integrations/workflows/host.d.ts +7 -0
  151. package/dist/integrations/workflows/host.d.ts.map +1 -1
  152. package/dist/integrations/workflows/notice.d.ts.map +1 -1
  153. package/dist/integrations/workflows/offering.d.ts +12 -4
  154. package/dist/integrations/workflows/offering.d.ts.map +1 -1
  155. package/dist/permissions/consent-prompt.d.ts.map +1 -1
  156. package/dist/tui/AgentExplorer.d.ts +14 -6
  157. package/dist/tui/AgentExplorer.d.ts.map +1 -1
  158. package/dist/tui/App.d.ts +13 -2
  159. package/dist/tui/App.d.ts.map +1 -1
  160. package/dist/tui/BackgroundJobsPanel.d.ts.map +1 -1
  161. package/dist/tui/BrandHeader.d.ts +2 -0
  162. package/dist/tui/BrandHeader.d.ts.map +1 -1
  163. package/dist/tui/ChoicePicker.d.ts +8 -1
  164. package/dist/tui/ChoicePicker.d.ts.map +1 -1
  165. package/dist/tui/Composer.d.ts +5 -1
  166. package/dist/tui/Composer.d.ts.map +1 -1
  167. package/dist/tui/LiveActivity.d.ts +8 -3
  168. package/dist/tui/LiveActivity.d.ts.map +1 -1
  169. package/dist/tui/PermissionOverlay.d.ts.map +1 -1
  170. package/dist/tui/ResumePicker.d.ts.map +1 -1
  171. package/dist/tui/StatusBar.d.ts +17 -5
  172. package/dist/tui/StatusBar.d.ts.map +1 -1
  173. package/dist/tui/Transcript.d.ts +4 -2
  174. package/dist/tui/Transcript.d.ts.map +1 -1
  175. package/dist/tui/TrustPrompt.d.ts +11 -1
  176. package/dist/tui/TrustPrompt.d.ts.map +1 -1
  177. package/dist/tui/agent-stop-all.d.ts +25 -0
  178. package/dist/tui/agent-stop-all.d.ts.map +1 -0
  179. package/dist/tui/agent-transcript-rows.d.ts +6 -4
  180. package/dist/tui/agent-transcript-rows.d.ts.map +1 -1
  181. package/dist/tui/agent.d.ts +35 -1
  182. package/dist/tui/agent.d.ts.map +1 -1
  183. package/dist/tui/browser-notices.d.ts +3 -3
  184. package/dist/tui/browser-notices.d.ts.map +1 -1
  185. package/dist/tui/compaction-rows.d.ts +51 -0
  186. package/dist/tui/compaction-rows.d.ts.map +1 -0
  187. package/dist/tui/diff-rows.d.ts +29 -0
  188. package/dist/tui/diff-rows.d.ts.map +1 -0
  189. package/dist/tui/display-path.d.ts +10 -0
  190. package/dist/tui/display-path.d.ts.map +1 -0
  191. package/dist/tui/exit-hint.d.ts +3 -0
  192. package/dist/tui/exit-hint.d.ts.map +1 -0
  193. package/dist/tui/job-exit-row.d.ts +1 -1
  194. package/dist/tui/job-exit-row.d.ts.map +1 -1
  195. package/dist/tui/markdown-wrap.d.ts.map +1 -1
  196. package/dist/tui/pause-clock.d.ts +15 -0
  197. package/dist/tui/pause-clock.d.ts.map +1 -0
  198. package/dist/tui/permission-review.d.ts +6 -0
  199. package/dist/tui/permission-review.d.ts.map +1 -1
  200. package/dist/tui/plain-interruption.d.ts +9 -1
  201. package/dist/tui/plain-interruption.d.ts.map +1 -1
  202. package/dist/tui/restored-rows.d.ts +83 -0
  203. package/dist/tui/restored-rows.d.ts.map +1 -0
  204. package/dist/tui/schedule/source-deliveries.d.ts +8 -1
  205. package/dist/tui/schedule/source-deliveries.d.ts.map +1 -1
  206. package/dist/tui/shell-cell.d.ts.map +1 -1
  207. package/dist/tui/shell-escape.d.ts +4 -1
  208. package/dist/tui/shell-escape.d.ts.map +1 -1
  209. package/dist/tui/slashCommands.d.ts +6 -0
  210. package/dist/tui/slashCommands.d.ts.map +1 -1
  211. package/dist/tui/stall-colour.d.ts +20 -0
  212. package/dist/tui/stall-colour.d.ts.map +1 -0
  213. package/dist/tui/system-rows.d.ts +77 -0
  214. package/dist/tui/system-rows.d.ts.map +1 -0
  215. package/dist/tui/tidy-tool-output.d.ts +2 -14
  216. package/dist/tui/tidy-tool-output.d.ts.map +1 -1
  217. package/dist/tui/tool-end-rows.d.ts +53 -0
  218. package/dist/tui/tool-end-rows.d.ts.map +1 -0
  219. package/dist/tui/triggers/context-text.d.ts.map +1 -1
  220. package/dist/tui/triggers/copy.d.ts +9 -2
  221. package/dist/tui/triggers/copy.d.ts.map +1 -1
  222. package/dist/tui/triggers/detect.d.ts.map +1 -1
  223. package/dist/tui/triggers/registry.d.ts +1 -1
  224. package/dist/tui/triggers/registry.d.ts.map +1 -1
  225. package/dist/tui/triggers/setting.d.ts.map +1 -1
  226. package/dist/tui/truncation.d.ts +27 -0
  227. package/dist/tui/truncation.d.ts.map +1 -0
  228. package/dist/tui/turn-interruption.d.ts +2 -0
  229. package/dist/tui/turn-interruption.d.ts.map +1 -1
  230. package/dist/tui/types.d.ts +14 -1
  231. package/dist/tui/types.d.ts.map +1 -1
  232. package/dist/tui/units.d.ts +17 -1
  233. package/dist/tui/units.d.ts.map +1 -1
  234. package/dist/tui/web-activity.d.ts.map +1 -1
  235. package/dist/tui/workspace-diff.d.ts +20 -0
  236. package/dist/tui/workspace-diff.d.ts.map +1 -1
  237. package/package.json +5 -5
  238. package/dist/chunks/agent-session-CQ52CRGK.js +0 -52
  239. package/dist/chunks/chunk-42CAONYE.js.map +0 -6
  240. package/dist/chunks/chunk-5BZSCNGR.js.map +0 -6
  241. package/dist/chunks/chunk-AMT74CY7.js.map +0 -6
  242. package/dist/chunks/chunk-LWXTAX2V.js.map +0 -6
  243. package/dist/chunks/chunk-MDEIMYQU.js.map +0 -6
  244. package/dist/chunks/chunk-OUTFB7EJ.js.map +0 -6
  245. package/dist/chunks/chunk-Q3IWEW4F.js.map +0 -6
  246. package/dist/chunks/chunk-WXMFE5SS.js.map +0 -6
  247. package/dist/chunks/chunk-XM3W7NMM.js.map +0 -6
  248. package/dist/chunks/cli-runtime-53GYDVBD.js.map +0 -6
  249. package/dist/chunks/dist-ADL22Y3L.js.map +0 -6
  250. package/dist/chunks/exec-A5BM63JW.js.map +0 -6
  251. package/dist/chunks/resume-KV2D6FK4.js +0 -22
  252. package/dist/chunks/session-step-QNH35CYJ.js +0 -29
  253. package/dist/chunks/tui-EWFJ5CEO.js.map +0 -6
  254. /package/dist/chunks/{acp-GBQKP3SQ.js.map → acp-JU4DX3RK.js.map} +0 -0
  255. /package/dist/chunks/{activity-command-6CVS5DZI.js.map → activity-command-TERANSMO.js.map} +0 -0
  256. /package/dist/chunks/{add-VVRTXHDQ.js.map → add-MZ6KIHY3.js.map} +0 -0
  257. /package/dist/chunks/{agent-UZHYPLYW.js.map → agent-JZFFS4IP.js.map} +0 -0
  258. /package/dist/chunks/{agent-session-CQ52CRGK.js.map → agent-session-YS3JWF6Z.js.map} +0 -0
  259. /package/dist/chunks/{archive-YWLKZACK.js.map → archive-SXYHKL3H.js.map} +0 -0
  260. /package/dist/chunks/{bin-main-LVQFA6PZ.js.map → bin-main-TFKZQ7NF.js.map} +0 -0
  261. /package/dist/chunks/{browser-HD24O6AL.js.map → browser-3U3YBKL6.js.map} +0 -0
  262. /package/dist/chunks/{chat-VOBGMUI3.js.map → chat-37QA7HHN.js.map} +0 -0
  263. /package/dist/chunks/{chunk-42GHVPZE.js.map → chunk-2SVXX5QK.js.map} +0 -0
  264. /package/dist/chunks/{chunk-6GJXAHUO.js.map → chunk-2T7TZDUE.js.map} +0 -0
  265. /package/dist/chunks/{chunk-2UBCLXGV.js.map → chunk-2UT6U22B.js.map} +0 -0
  266. /package/dist/chunks/{chunk-SDABAQVK.js.map → chunk-2UUBILYI.js.map} +0 -0
  267. /package/dist/chunks/{chunk-XXBN2OWW.js.map → chunk-3NIZKJJG.js.map} +0 -0
  268. /package/dist/chunks/{chunk-HQ37JKI2.js.map → chunk-3PBSWF6X.js.map} +0 -0
  269. /package/dist/chunks/{chunk-52E6DDZD.js.map → chunk-5G3VKTLZ.js.map} +0 -0
  270. /package/dist/chunks/{chunk-G6QXPPH3.js.map → chunk-7MLTWXEW.js.map} +0 -0
  271. /package/dist/chunks/{chunk-YUX6OJOD.js.map → chunk-7O4X4GYL.js.map} +0 -0
  272. /package/dist/chunks/{chunk-7M3YW2NF.js.map → chunk-7S5UB6DX.js.map} +0 -0
  273. /package/dist/chunks/{chunk-JFZF3FQ2.js.map → chunk-B5344NIV.js.map} +0 -0
  274. /package/dist/chunks/{chunk-XBCEWEQN.js.map → chunk-CDZT7WGY.js.map} +0 -0
  275. /package/dist/chunks/{chunk-XNY2DD22.js.map → chunk-CK4TOW2N.js.map} +0 -0
  276. /package/dist/chunks/{chunk-YE2PFKVU.js.map → chunk-CLIP7QVU.js.map} +0 -0
  277. /package/dist/chunks/{chunk-HAJ7UV4Y.js.map → chunk-D5SIC3SF.js.map} +0 -0
  278. /package/dist/chunks/{chunk-NR6YON2Q.js.map → chunk-DQICYFIG.js.map} +0 -0
  279. /package/dist/chunks/{chunk-AEB7KCO6.js.map → chunk-EKMOETAY.js.map} +0 -0
  280. /package/dist/chunks/{chunk-6ARSJBCV.js.map → chunk-EUHPTASG.js.map} +0 -0
  281. /package/dist/chunks/{chunk-YBZMF6LC.js.map → chunk-FI7TIM5P.js.map} +0 -0
  282. /package/dist/chunks/{chunk-GXE2VIGI.js.map → chunk-GTXD263T.js.map} +0 -0
  283. /package/dist/chunks/{chunk-5DJ5YIHY.js.map → chunk-HOOY63EB.js.map} +0 -0
  284. /package/dist/chunks/{chunk-P7OXZHTL.js.map → chunk-ICBHR27I.js.map} +0 -0
  285. /package/dist/chunks/{chunk-GIBXNY7Z.js.map → chunk-IG4O4UAL.js.map} +0 -0
  286. /package/dist/chunks/{chunk-YA4IH46E.js.map → chunk-JN6M424Z.js.map} +0 -0
  287. /package/dist/chunks/{chunk-MKPICNP7.js.map → chunk-KG2YA6TI.js.map} +0 -0
  288. /package/dist/chunks/{chunk-65Y4XRJ7.js.map → chunk-KONWJQLM.js.map} +0 -0
  289. /package/dist/chunks/{chunk-IP36P4KT.js.map → chunk-KUNQW3N3.js.map} +0 -0
  290. /package/dist/chunks/{chunk-TDDCRQZZ.js.map → chunk-LBPM46OY.js.map} +0 -0
  291. /package/dist/chunks/{chunk-WTF2RVKD.js.map → chunk-LC5VGZO2.js.map} +0 -0
  292. /package/dist/chunks/{chunk-ALNCCKDI.js.map → chunk-LH6J5QQ7.js.map} +0 -0
  293. /package/dist/chunks/{chunk-MSNMI4KG.js.map → chunk-LPYWPRIF.js.map} +0 -0
  294. /package/dist/chunks/{chunk-FDAOPSRK.js.map → chunk-M2EJQU3F.js.map} +0 -0
  295. /package/dist/chunks/{chunk-UASN4SLO.js.map → chunk-N57QO3AA.js.map} +0 -0
  296. /package/dist/chunks/{chunk-54BF5YUB.js.map → chunk-OA5772RG.js.map} +0 -0
  297. /package/dist/chunks/{chunk-DTMONWML.js.map → chunk-PETRJVXF.js.map} +0 -0
  298. /package/dist/chunks/{chunk-6N6HLU4F.js.map → chunk-Q6SF7T77.js.map} +0 -0
  299. /package/dist/chunks/{chunk-MW3PKVXY.js.map → chunk-U75JG2RT.js.map} +0 -0
  300. /package/dist/chunks/{chunk-H3LH5GZ5.js.map → chunk-UQZNYNX7.js.map} +0 -0
  301. /package/dist/chunks/{chunk-ZAUFSEHS.js.map → chunk-VFBIR3UC.js.map} +0 -0
  302. /package/dist/chunks/{chunk-FHDYGPGC.js.map → chunk-WLHI2QSC.js.map} +0 -0
  303. /package/dist/chunks/{chunk-VXHYLNLR.js.map → chunk-XEOZYKPJ.js.map} +0 -0
  304. /package/dist/chunks/{chunk-J7RNZR6A.js.map → chunk-XIURI2PQ.js.map} +0 -0
  305. /package/dist/chunks/{chunk-W47OQU6P.js.map → chunk-XKEMUEI5.js.map} +0 -0
  306. /package/dist/chunks/{chunk-WWGLUAHZ.js.map → chunk-XNHYUV6G.js.map} +0 -0
  307. /package/dist/chunks/{chunk-BSBFGZLW.js.map → chunk-Z4LTK3HY.js.map} +0 -0
  308. /package/dist/chunks/{chunk-LQFMXCHI.js.map → chunk-Z56MZ7UW.js.map} +0 -0
  309. /package/dist/chunks/{chunk-7LMPS6TV.js.map → chunk-ZJHOWWXZ.js.map} +0 -0
  310. /package/dist/chunks/{chunk-XNOORMEP.js.map → chunk-ZJMUPGWD.js.map} +0 -0
  311. /package/dist/chunks/{commands-X2P7B7M6.js.map → commands-QMF4AHAY.js.map} +0 -0
  312. /package/dist/chunks/{crash-report-YKKJEHWY.js.map → crash-report-BSZ6SUOF.js.map} +0 -0
  313. /package/dist/chunks/{dist-TTCX7GFK.js.map → dist-GNI4DIHI.js.map} +0 -0
  314. /package/dist/chunks/{dist-E24W5SI7.js.map → dist-HRWBXBF3.js.map} +0 -0
  315. /package/dist/chunks/{dist-TYCOBKDT.js.map → dist-JDUOF4K7.js.map} +0 -0
  316. /package/dist/chunks/{dist-EO3WQFRN.js.map → dist-MYWLKPXK.js.map} +0 -0
  317. /package/dist/chunks/{dist-KP5U4QDN.js.map → dist-QSOTJL6Z.js.map} +0 -0
  318. /package/dist/chunks/{dist-6ABVUWX5.js.map → dist-SO6XBKFN.js.map} +0 -0
  319. /package/dist/chunks/{dist-5KZ4SS57.js.map → dist-XDA5OMB2.js.map} +0 -0
  320. /package/dist/chunks/{doctor-QTMSOOEO.js.map → doctor-5MS7V3JB.js.map} +0 -0
  321. /package/dist/chunks/{drain-FWONJITS.js.map → drain-YGGEC4UE.js.map} +0 -0
  322. /package/dist/chunks/{eval-GQTJX6WI.js.map → eval-GWP6MISH.js.map} +0 -0
  323. /package/dist/chunks/{home-QAEAKEUG.js.map → home-IZ2H7PM3.js.map} +0 -0
  324. /package/dist/chunks/{host-queries-NY6FDVNU.js.map → host-queries-UCVJBJXU.js.map} +0 -0
  325. /package/dist/chunks/{lifecycle-EJQ57UR7.js.map → lifecycle-U52Z5ZMZ.js.map} +0 -0
  326. /package/dist/chunks/{list-P5KDSX7R.js.map → list-SVKI2XOL.js.map} +0 -0
  327. /package/dist/chunks/{login-PQAWB3YL.js.map → login-MNDG4XIT.js.map} +0 -0
  328. /package/dist/chunks/{logs-PYWTK275.js.map → logs-M7RCXYPY.js.map} +0 -0
  329. /package/dist/chunks/{mcp-QJRY437O.js.map → mcp-KEQMYKDA.js.map} +0 -0
  330. /package/dist/chunks/{message-command-RGUNGNNC.js.map → message-command-FZ6VEUK5.js.map} +0 -0
  331. /package/dist/chunks/{operator-tools-UH4SJXQJ.js.map → operator-tools-C57ZIYRG.js.map} +0 -0
  332. /package/dist/chunks/{output-schema-BN6UL2BB.js.map → output-schema-IYQRSIUA.js.map} +0 -0
  333. /package/dist/chunks/{pal-NAJGPRTW.js.map → pal-NXMTLY6Z.js.map} +0 -0
  334. /package/dist/chunks/{providers-VTT4SK6S.js.map → providers-TZBRQDXE.js.map} +0 -0
  335. /package/dist/chunks/{resident-AQYBL2GF.js.map → resident-DBIZBLOV.js.map} +0 -0
  336. /package/dist/chunks/{resume-KV2D6FK4.js.map → resume-GG6RMJXQ.js.map} +0 -0
  337. /package/dist/chunks/{resume-command-AOT7YZT5.js.map → resume-command-36S3HXPO.js.map} +0 -0
  338. /package/dist/chunks/{schedule-WYFFJI6G.js.map → schedule-UR54S44B.js.map} +0 -0
  339. /package/dist/chunks/{service-HAMHYSEA.js.map → service-VMXEAJCI.js.map} +0 -0
  340. /package/dist/chunks/{session-step-QNH35CYJ.js.map → session-step-VJCHKPWD.js.map} +0 -0
  341. /package/dist/chunks/{skills-5TJTJEDG.js.map → skills-RXYS26H3.js.map} +0 -0
  342. /package/dist/chunks/{state-ABEFSCFQ.js.map → state-NS47IVWW.js.map} +0 -0
  343. /package/dist/chunks/{store-BL5L6BOI.js.map → store-3U2GZAZS.js.map} +0 -0
  344. /package/dist/chunks/{store-UKFFPFLI.js.map → store-GNFHH2LZ.js.map} +0 -0
  345. /package/dist/chunks/{store-WBED64YS.js.map → store-TO65IAIZ.js.map} +0 -0
  346. /package/dist/chunks/{upgrade-2HP3BTOT.js.map → upgrade-USIXROFG.js.map} +0 -0
  347. /package/dist/chunks/{worktree-PNFBTACG.js.map → worktree-AYI5VJ5H.js.map} +0 -0
@@ -1832,7 +1832,7 @@ function formatSystemEvent(event, options = {}) {
1832
1832
  renderedBody
1833
1833
  ]);
1834
1834
  const closingTag = `</system-event-${nonce}>`;
1835
- const lines2 = [
1835
+ const lines = [
1836
1836
  `<system-event-${nonce} kind="${escapeAttribute2(event.kind)}" id="${escapeAttribute2(event.id)}" status="${escapeAttribute2(event.status)}">`,
1837
1837
  SYSTEM_EVENT_HEADER,
1838
1838
  nonceClosureStatement(closingTag),
@@ -1844,7 +1844,7 @@ function formatSystemEvent(event, options = {}) {
1844
1844
  renderedBody,
1845
1845
  closingTag
1846
1846
  ];
1847
- return lines2.join("\n");
1847
+ return lines.join("\n");
1848
1848
  }
1849
1849
  __name(formatSystemEvent, "formatSystemEvent");
1850
1850
 
@@ -1937,7 +1937,7 @@ function createMonitorStream(options) {
1937
1937
  const clearTimer = options.clearTimer ?? ((handle) => clearTimeout(handle));
1938
1938
  let closed = false;
1939
1939
  let partial = "";
1940
- let lines2 = [];
1940
+ let lines = [];
1941
1941
  let timer;
1942
1942
  let timerArmed = false;
1943
1943
  let tokens = MONITOR_BUCKET_CAPACITY;
@@ -1993,10 +1993,10 @@ function createMonitorStream(options) {
1993
1993
  clearTimer(timer);
1994
1994
  timerArmed = false;
1995
1995
  }
1996
- if (lines2.length === 0)
1996
+ if (lines.length === 0)
1997
1997
  return;
1998
- let batch = lines2.join("\n");
1999
- lines2 = [];
1998
+ let batch = lines.join("\n");
1999
+ lines = [];
2000
2000
  if (batch.length > MONITOR_BATCH_MAX_CHARS) {
2001
2001
  batch = batch.slice(0, MONITOR_BATCH_MAX_CHARS) + BATCH_TRUNCATED;
2002
2002
  }
@@ -2006,7 +2006,7 @@ function createMonitorStream(options) {
2006
2006
  const line = raw.trim();
2007
2007
  if (line.length === 0)
2008
2008
  return;
2009
- lines2.push(line.length > MONITOR_LINE_MAX_CHARS ? line.slice(0, MONITOR_LINE_MAX_CHARS) + LINE_TRUNCATED : line);
2009
+ lines.push(line.length > MONITOR_LINE_MAX_CHARS ? line.slice(0, MONITOR_LINE_MAX_CHARS) + LINE_TRUNCATED : line);
2010
2010
  if (!timerArmed) {
2011
2011
  timerArmed = true;
2012
2012
  timer = setTimer(() => {
@@ -2022,7 +2022,7 @@ function createMonitorStream(options) {
2022
2022
  clearTimer(timer);
2023
2023
  timerArmed = false;
2024
2024
  }
2025
- lines2 = [];
2025
+ lines = [];
2026
2026
  partial = "";
2027
2027
  }, "stop");
2028
2028
  return {
@@ -12928,7 +12928,8 @@ var EPHEMERAL_EVENT_TYPES = /* @__PURE__ */ new Set([
12928
12928
  "tool_input_delta",
12929
12929
  "reasoning_delta",
12930
12930
  "tool_progress",
12931
- "monitor_event"
12931
+ "monitor_event",
12932
+ "compaction_started"
12932
12933
  ]);
12933
12934
  function isEphemeralEvent(event) {
12934
12935
  return EPHEMERAL_EVENT_TYPES.has(event.type);
@@ -13339,6 +13340,7 @@ var SESSION_EVENT_TYPE_TABLE = {
13339
13340
  approval_policy_changed: true,
13340
13341
  request_envelope: true,
13341
13342
  iteration_completed: true,
13343
+ compaction_started: true,
13342
13344
  compaction_shed: true,
13343
13345
  compaction_completed: true,
13344
13346
  compaction_tool_results_cleared: true,
@@ -14721,6 +14723,7 @@ var BOUNDARY_TYPES = /* @__PURE__ */ new Set([
14721
14723
  "log_repaired"
14722
14724
  ]);
14723
14725
  var PREVIEW_CHARS = 2e3;
14726
+ var COMPACTION_SPILL_ABOVE_BYTES = 256 * 1024;
14724
14727
  var ZERO_USAGE = {
14725
14728
  promptTokens: 0,
14726
14729
  completionTokens: 0,
@@ -14750,6 +14753,7 @@ var SessionLogCore = class {
14750
14753
  #spills;
14751
14754
  #now;
14752
14755
  #spillAbove;
14756
+ #compactionSpillAbove;
14753
14757
  #structuredResultSpilling;
14754
14758
  #sync;
14755
14759
  #mutex = new Mutex();
@@ -14773,6 +14777,7 @@ var SessionLogCore = class {
14773
14777
  this.#structuredResultSpilling = options.structuredResultSpilling ?? false;
14774
14778
  this.#now = options.now ?? Date.now;
14775
14779
  this.#spillAbove = Math.min(options.spillAboveBytes ?? SESSION_RECORD_MAX_BYTES, SESSION_RECORD_MAX_BYTES);
14780
+ this.#compactionSpillAbove = Math.min(options.compactionSpillAboveBytes ?? COMPACTION_SPILL_ABOVE_BYTES, this.#spillAbove);
14776
14781
  this.#sync = options.sync ?? "boundaries";
14777
14782
  }
14778
14783
  // ── state ──
@@ -15014,7 +15019,8 @@ var SessionLogCore = class {
15014
15019
  return candidate;
15015
15020
  const size = Buffer.byteLength(`${JSON.stringify(candidate)}
15016
15021
  `, "utf8");
15017
- if (size <= this.#spillAbove)
15022
+ const spillAbove = type === "compaction" ? this.#compactionSpillAbove : this.#spillAbove;
15023
+ if (size <= spillAbove)
15018
15024
  return candidate;
15019
15025
  if (type === "turn_completed") {
15020
15026
  if (typeof candidate.result !== "string")
@@ -15164,10 +15170,10 @@ async function* walkSessionLog(medium, options) {
15164
15170
  let anchorSeen = false;
15165
15171
  let stopped = false;
15166
15172
  outer: for await (const chunk of medium.stream(start)) {
15167
- let lines2;
15173
+ let lines;
15168
15174
  try {
15169
- lines2 = splitter.push(chunk);
15170
- for (const { line, offset } of lines2) {
15175
+ lines = splitter.push(chunk);
15176
+ for (const { line, offset } of lines) {
15171
15177
  let entry;
15172
15178
  try {
15173
15179
  entry = chain.accept(line, offset);
@@ -15325,6 +15331,7 @@ var DiskSessionLog = class _DiskSessionLog extends SessionLogCore {
15325
15331
  spills: new DiskSpillStore(options.sessionDir, options.now),
15326
15332
  now: options.now,
15327
15333
  spillAboveBytes: options.spillAboveBytes,
15334
+ compactionSpillAboveBytes: options.compactionSpillAboveBytes,
15328
15335
  structuredResultSpilling: options.structuredResultSpilling,
15329
15336
  sync: options.sync
15330
15337
  });
@@ -15412,6 +15419,7 @@ var InMemorySessionLog = class _InMemorySessionLog extends SessionLogCore {
15412
15419
  spills,
15413
15420
  now: options.now,
15414
15421
  spillAboveBytes: options.spillAboveBytes,
15422
+ compactionSpillAboveBytes: options.compactionSpillAboveBytes,
15415
15423
  structuredResultSpilling: options.structuredResultSpilling,
15416
15424
  sync: "none"
15417
15425
  });
@@ -15538,23 +15546,23 @@ function renderSkillsSection(skills) {
15538
15546
  if (forModel.length === 0)
15539
15547
  return null;
15540
15548
  const available = forModel.map((s) => {
15541
- const lines2 = [
15549
+ const lines = [
15542
15550
  "<skill>",
15543
15551
  `<name>${s.metadata.name}</name>`,
15544
15552
  `<description>${s.metadata.description.trim()}</description>`,
15545
15553
  `<location>${s.dirPath}/SKILL.md</location>`
15546
15554
  ];
15547
15555
  if (s.metadata.compatibility) {
15548
- lines2.push(`<compatibility>${s.metadata.compatibility}</compatibility>`);
15556
+ lines.push(`<compatibility>${s.metadata.compatibility}</compatibility>`);
15549
15557
  }
15550
15558
  if (s.metadata.license) {
15551
- lines2.push(`<license>${s.metadata.license}</license>`);
15559
+ lines.push(`<license>${s.metadata.license}</license>`);
15552
15560
  }
15553
15561
  if (s.metadata.allowedTools) {
15554
- lines2.push(`<pre_approved_tools>${s.metadata.allowedTools}</pre_approved_tools>`);
15562
+ lines.push(`<pre_approved_tools>${s.metadata.allowedTools}</pre_approved_tools>`);
15555
15563
  }
15556
- lines2.push("</skill>");
15557
- return lines2.join("\n");
15564
+ lines.push("</skill>");
15565
+ return lines.join("\n");
15558
15566
  }).join("\n");
15559
15567
  const loadedSkills = forModel.filter((s) => s.body);
15560
15568
  const sections = [
@@ -15586,23 +15594,23 @@ ${skillSections.join("\n\n")}`);
15586
15594
  }
15587
15595
  __name(renderSkillsSection, "renderSkillsSection");
15588
15596
  function renderOutputDiscipline(discipline) {
15589
- const lines2 = [];
15597
+ const lines = [];
15590
15598
  if (discipline.betweenToolCalls === "silent") {
15591
- lines2.push("- Emit zero words between tool calls. Call tools back-to-back with no narration.");
15599
+ lines.push("- Emit zero words between tool calls. Call tools back-to-back with no narration.");
15592
15600
  } else {
15593
- lines2.push("- Emit minimal text between tool calls. Keep inter-tool narration to a single short sentence.");
15601
+ lines.push("- Emit minimal text between tool calls. Keep inter-tool narration to a single short sentence.");
15594
15602
  }
15595
15603
  if (discipline.suppressInnerMonologue) {
15596
- lines2.push("- Do not output inner monologue, reasoning traces, or planning text between turns.");
15604
+ lines.push("- Do not output inner monologue, reasoning traces, or planning text between turns.");
15597
15605
  }
15598
15606
  if (discipline.finalResponse?.singleFileMaxWords) {
15599
- lines2.push(`- Final response for single-file changes: ${discipline.finalResponse.singleFileMaxWords} words maximum. Describe the why, not the what.`);
15607
+ lines.push(`- Final response for single-file changes: ${discipline.finalResponse.singleFileMaxWords} words maximum. Describe the why, not the what.`);
15600
15608
  }
15601
15609
  if (discipline.finalResponse?.multiFileMaxWords) {
15602
- lines2.push(`- Final response for multi-file changes: ${discipline.finalResponse.multiFileMaxWords} words maximum. Summarize intent and scope.`);
15610
+ lines.push(`- Final response for multi-file changes: ${discipline.finalResponse.multiFileMaxWords} words maximum. Summarize intent and scope.`);
15603
15611
  }
15604
15612
  return `## Output Discipline
15605
- ${lines2.join("\n")}`;
15613
+ ${lines.join("\n")}`;
15606
15614
  }
15607
15615
  __name(renderOutputDiscipline, "renderOutputDiscipline");
15608
15616
 
@@ -17769,13 +17777,13 @@ function describeRequiredInput(schema) {
17769
17777
  if (required.length === 0)
17770
17778
  return "No required parameters known.";
17771
17779
  const props = json2.properties ?? {};
17772
- const lines2 = required.map((name2) => {
17780
+ const lines = required.map((name2) => {
17773
17781
  const def = props[name2] ?? {};
17774
17782
  const type = def.type ?? "value";
17775
17783
  const desc = def.description ? ` \u2014 ${def.description}` : "";
17776
17784
  return `${name2}: ${type}${desc}`;
17777
17785
  });
17778
- return `Required: ${lines2.join(", ")}.`;
17786
+ return `Required: ${lines.join(", ")}.`;
17779
17787
  } catch {
17780
17788
  return "Could not introspect required parameters.";
17781
17789
  }
@@ -18172,7 +18180,7 @@ Additional note from the user: "${freeText}"`;
18172
18180
  __name(describeSingle, "describeSingle");
18173
18181
  var labelOf = /* @__PURE__ */ __name((item) => item.header ?? item.question, "labelOf");
18174
18182
  function describeBatch(answers) {
18175
- const lines2 = answers.map((answer) => {
18183
+ const lines = answers.map((answer) => {
18176
18184
  const { item, selected, freeText } = answer;
18177
18185
  if (selected.length > 0) {
18178
18186
  const joined3 = selected.map((s) => `"${s.label}"`).join(", ");
@@ -18185,7 +18193,7 @@ function describeBatch(answers) {
18185
18193
  const answered = answers.filter(isAnswered).length;
18186
18194
  return {
18187
18195
  output: `The user answered ${answered} of ${answers.length} questions:
18188
- ${lines2.join("\n")}`,
18196
+ ${lines.join("\n")}`,
18189
18197
  data: {
18190
18198
  questions: answers.map(({ item }) => ({
18191
18199
  questionId: item.id,
@@ -22772,9 +22780,9 @@ function renderEntry(entry) {
22772
22780
  return JSON.stringify(body).replaceAll("<", "\\u003c");
22773
22781
  }
22774
22782
  __name(renderEntry, "renderEntry");
22775
- function renderedLength(lines2) {
22783
+ function renderedLength(lines) {
22776
22784
  let total = 0;
22777
- for (const line of lines2)
22785
+ for (const line of lines)
22778
22786
  total += line.length + 1;
22779
22787
  return total;
22780
22788
  }
@@ -22954,7 +22962,7 @@ function createAutoReviewClassifier(options) {
22954
22962
  excludeCallIds: /* @__PURE__ */ new Set([request.call.id]),
22955
22963
  ...options.maxEntryChars !== void 0 ? { maxEntryChars: options.maxEntryChars } : {}
22956
22964
  });
22957
- const lines2 = entries2.map(renderEntry);
22965
+ const lines = entries2.map(renderEntry);
22958
22966
  const projected = projectAction(request.call.name, request.call.input, request.tools, ACTION_CHARS);
22959
22967
  if (projected.truncated) {
22960
22968
  return blocked(started, 0, "unreadable", "the action is too long for the safety check to read in full, so it was not run");
@@ -22964,10 +22972,10 @@ function createAutoReviewClassifier(options) {
22964
22972
  name: request.call.name,
22965
22973
  input: projected.text
22966
22974
  });
22967
- if (renderedLength(lines2) + action.length > maxChars2)
22975
+ if (renderedLength(lines) + action.length > maxChars2)
22968
22976
  return { verdict: "too_long" };
22969
22977
  const body = `<transcript>
22970
- ${lines2.join("\n")}
22978
+ ${lines.join("\n")}
22971
22979
  </transcript>
22972
22980
 
22973
22981
  The action under review:
@@ -25613,15 +25621,15 @@ function applyOne(content, input) {
25613
25621
  __name(applyOne, "applyOne");
25614
25622
  function applyLineInsert(content, input) {
25615
25623
  const hasTrailingNewline = content.endsWith("\n");
25616
- const lines2 = content.split("\n");
25624
+ const lines = content.split("\n");
25617
25625
  if (hasTrailingNewline)
25618
- lines2.pop();
25619
- const line = input.insertLine === "end" ? lines2.length : Math.min(Math.max(input.insertLine, 0), lines2.length);
25626
+ lines.pop();
25627
+ const line = input.insertLine === "end" ? lines.length : Math.min(Math.max(input.insertLine, 0), lines.length);
25620
25628
  const inserted = input.newString.endsWith("\n") ? input.newString.slice(0, -1).split("\n") : input.newString.split("\n");
25621
- lines2.splice(line, 0, ...inserted);
25629
+ lines.splice(line, 0, ...inserted);
25622
25630
  return {
25623
25631
  success: true,
25624
- content: `${lines2.join("\n")}${hasTrailingNewline ? "\n" : ""}`,
25632
+ content: `${lines.join("\n")}${hasTrailingNewline ? "\n" : ""}`,
25625
25633
  replacements: 1
25626
25634
  };
25627
25635
  }
@@ -25798,6 +25806,478 @@ function jsonStringEscapes(where) {
25798
25806
  }
25799
25807
  __name(jsonStringEscapes, "jsonStringEscapes");
25800
25808
 
25809
+ // ../../node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/diff/base.js
25810
+ var Diff = class {
25811
+ static {
25812
+ __name(this, "Diff");
25813
+ }
25814
+ diff(oldStr, newStr, options = {}) {
25815
+ let callback;
25816
+ if (typeof options === "function") {
25817
+ callback = options;
25818
+ options = {};
25819
+ } else if ("callback" in options) {
25820
+ callback = options.callback;
25821
+ }
25822
+ const oldString = this.castInput(oldStr, options);
25823
+ const newString = this.castInput(newStr, options);
25824
+ const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
25825
+ const newTokens = this.removeEmpty(this.tokenize(newString, options));
25826
+ return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
25827
+ }
25828
+ diffWithOptionsObj(oldTokens, newTokens, options, callback) {
25829
+ var _a2;
25830
+ const done = /* @__PURE__ */ __name((value) => {
25831
+ value = this.postProcess(value, options);
25832
+ if (callback) {
25833
+ setTimeout(function() {
25834
+ callback(value);
25835
+ }, 0);
25836
+ return void 0;
25837
+ } else {
25838
+ return value;
25839
+ }
25840
+ }, "done");
25841
+ const newLen = newTokens.length, oldLen = oldTokens.length;
25842
+ let editLength = 1;
25843
+ let maxEditLength = newLen + oldLen;
25844
+ if (options.maxEditLength != null) {
25845
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
25846
+ }
25847
+ const maxExecutionTime = (_a2 = options.timeout) !== null && _a2 !== void 0 ? _a2 : Infinity;
25848
+ const abortAfterTimestamp = Date.now() + maxExecutionTime;
25849
+ const bestPath = [{ oldPos: -1, lastComponent: void 0 }];
25850
+ let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
25851
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
25852
+ return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
25853
+ }
25854
+ let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
25855
+ const execEditLength = /* @__PURE__ */ __name(() => {
25856
+ for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
25857
+ let basePath;
25858
+ const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
25859
+ if (removePath) {
25860
+ bestPath[diagonalPath - 1] = void 0;
25861
+ }
25862
+ let canAdd = false;
25863
+ if (addPath) {
25864
+ const addPathNewPos = addPath.oldPos - diagonalPath;
25865
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
25866
+ }
25867
+ const canRemove = removePath && removePath.oldPos + 1 < oldLen;
25868
+ if (!canAdd && !canRemove) {
25869
+ bestPath[diagonalPath] = void 0;
25870
+ continue;
25871
+ }
25872
+ if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
25873
+ basePath = this.addToPath(addPath, true, false, 0, options);
25874
+ } else {
25875
+ basePath = this.addToPath(removePath, false, true, 1, options);
25876
+ }
25877
+ newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
25878
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
25879
+ return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
25880
+ } else {
25881
+ bestPath[diagonalPath] = basePath;
25882
+ if (basePath.oldPos + 1 >= oldLen) {
25883
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
25884
+ }
25885
+ if (newPos + 1 >= newLen) {
25886
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
25887
+ }
25888
+ }
25889
+ }
25890
+ editLength++;
25891
+ }, "execEditLength");
25892
+ if (callback) {
25893
+ (/* @__PURE__ */ __name(function exec() {
25894
+ setTimeout(function() {
25895
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
25896
+ return callback(void 0);
25897
+ }
25898
+ if (!execEditLength()) {
25899
+ exec();
25900
+ }
25901
+ }, 0);
25902
+ }, "exec"))();
25903
+ } else {
25904
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
25905
+ const ret = execEditLength();
25906
+ if (ret) {
25907
+ return ret;
25908
+ }
25909
+ }
25910
+ }
25911
+ }
25912
+ addToPath(path2, added, removed, oldPosInc, options) {
25913
+ const last = path2.lastComponent;
25914
+ if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
25915
+ return {
25916
+ oldPos: path2.oldPos + oldPosInc,
25917
+ lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
25918
+ };
25919
+ } else {
25920
+ return {
25921
+ oldPos: path2.oldPos + oldPosInc,
25922
+ lastComponent: { count: 1, added, removed, previousComponent: last }
25923
+ };
25924
+ }
25925
+ }
25926
+ extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
25927
+ const newLen = newTokens.length, oldLen = oldTokens.length;
25928
+ let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
25929
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
25930
+ newPos++;
25931
+ oldPos++;
25932
+ commonCount++;
25933
+ if (options.oneChangePerToken) {
25934
+ basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
25935
+ }
25936
+ }
25937
+ if (commonCount && !options.oneChangePerToken) {
25938
+ basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
25939
+ }
25940
+ basePath.oldPos = oldPos;
25941
+ return newPos;
25942
+ }
25943
+ equals(left, right, options) {
25944
+ if (options.comparator) {
25945
+ return options.comparator(left, right);
25946
+ } else {
25947
+ return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
25948
+ }
25949
+ }
25950
+ removeEmpty(array) {
25951
+ const ret = [];
25952
+ for (let i = 0; i < array.length; i++) {
25953
+ if (array[i]) {
25954
+ ret.push(array[i]);
25955
+ }
25956
+ }
25957
+ return ret;
25958
+ }
25959
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
25960
+ castInput(value, options) {
25961
+ return value;
25962
+ }
25963
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
25964
+ tokenize(value, options) {
25965
+ return Array.from(value);
25966
+ }
25967
+ join(chars) {
25968
+ return chars.join("");
25969
+ }
25970
+ postProcess(changeObjects, options) {
25971
+ return changeObjects;
25972
+ }
25973
+ get useLongestToken() {
25974
+ return false;
25975
+ }
25976
+ buildValues(lastComponent, newTokens, oldTokens) {
25977
+ const components = [];
25978
+ let nextComponent;
25979
+ while (lastComponent) {
25980
+ components.push(lastComponent);
25981
+ nextComponent = lastComponent.previousComponent;
25982
+ delete lastComponent.previousComponent;
25983
+ lastComponent = nextComponent;
25984
+ }
25985
+ components.reverse();
25986
+ const componentLen = components.length;
25987
+ let componentPos = 0, newPos = 0, oldPos = 0;
25988
+ for (; componentPos < componentLen; componentPos++) {
25989
+ const component = components[componentPos];
25990
+ if (!component.removed) {
25991
+ if (!component.added && this.useLongestToken) {
25992
+ let value = newTokens.slice(newPos, newPos + component.count);
25993
+ value = value.map(function(value2, i) {
25994
+ const oldValue = oldTokens[oldPos + i];
25995
+ return oldValue.length > value2.length ? oldValue : value2;
25996
+ });
25997
+ component.value = this.join(value);
25998
+ } else {
25999
+ component.value = this.join(newTokens.slice(newPos, newPos + component.count));
26000
+ }
26001
+ newPos += component.count;
26002
+ if (!component.added) {
26003
+ oldPos += component.count;
26004
+ }
26005
+ } else {
26006
+ component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
26007
+ oldPos += component.count;
26008
+ }
26009
+ }
26010
+ return components;
26011
+ }
26012
+ };
26013
+
26014
+ // ../../node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/diff/line.js
26015
+ var LineDiff = class extends Diff {
26016
+ static {
26017
+ __name(this, "LineDiff");
26018
+ }
26019
+ constructor() {
26020
+ super(...arguments);
26021
+ this.tokenize = tokenize;
26022
+ }
26023
+ equals(left, right, options) {
26024
+ if (options.ignoreWhitespace) {
26025
+ if (!options.newlineIsToken || !left.includes("\n")) {
26026
+ left = left.trim();
26027
+ }
26028
+ if (!options.newlineIsToken || !right.includes("\n")) {
26029
+ right = right.trim();
26030
+ }
26031
+ } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
26032
+ if (left.endsWith("\n")) {
26033
+ left = left.slice(0, -1);
26034
+ }
26035
+ if (right.endsWith("\n")) {
26036
+ right = right.slice(0, -1);
26037
+ }
26038
+ }
26039
+ return super.equals(left, right, options);
26040
+ }
26041
+ };
26042
+ var lineDiff = new LineDiff();
26043
+ function diffLines(oldStr, newStr, options) {
26044
+ return lineDiff.diff(oldStr, newStr, options);
26045
+ }
26046
+ __name(diffLines, "diffLines");
26047
+ function tokenize(value, options) {
26048
+ if (options.stripTrailingCr) {
26049
+ value = value.replace(/\r\n/g, "\n");
26050
+ }
26051
+ const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
26052
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
26053
+ linesAndNewlines.pop();
26054
+ }
26055
+ for (let i = 0; i < linesAndNewlines.length; i++) {
26056
+ const line = linesAndNewlines[i];
26057
+ if (i % 2 && !options.newlineIsToken) {
26058
+ retLines[retLines.length - 1] += line;
26059
+ } else {
26060
+ retLines.push(line);
26061
+ }
26062
+ }
26063
+ return retLines;
26064
+ }
26065
+ __name(tokenize, "tokenize");
26066
+
26067
+ // ../../node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/patch/create.js
26068
+ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
26069
+ let optionsObj;
26070
+ if (!options) {
26071
+ optionsObj = {};
26072
+ } else if (typeof options === "function") {
26073
+ optionsObj = { callback: options };
26074
+ } else {
26075
+ optionsObj = options;
26076
+ }
26077
+ if (typeof optionsObj.context === "undefined") {
26078
+ optionsObj.context = 4;
26079
+ }
26080
+ const context2 = optionsObj.context;
26081
+ if (optionsObj.newlineIsToken) {
26082
+ throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
26083
+ }
26084
+ if (!optionsObj.callback) {
26085
+ return diffLinesResultToPatch(diffLines(oldStr, newStr, optionsObj));
26086
+ } else {
26087
+ const { callback } = optionsObj;
26088
+ diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: /* @__PURE__ */ __name((diff) => {
26089
+ const patch = diffLinesResultToPatch(diff);
26090
+ callback(patch);
26091
+ }, "callback") }));
26092
+ }
26093
+ function diffLinesResultToPatch(diff) {
26094
+ if (!diff) {
26095
+ return;
26096
+ }
26097
+ diff.push({ value: "", lines: [] });
26098
+ function contextLines(lines) {
26099
+ return lines.map(function(entry) {
26100
+ return " " + entry;
26101
+ });
26102
+ }
26103
+ __name(contextLines, "contextLines");
26104
+ const hunks2 = [];
26105
+ let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
26106
+ for (let i = 0; i < diff.length; i++) {
26107
+ const current = diff[i], lines = current.lines || splitLines(current.value);
26108
+ current.lines = lines;
26109
+ if (current.added || current.removed) {
26110
+ if (!oldRangeStart) {
26111
+ const prev = diff[i - 1];
26112
+ oldRangeStart = oldLine;
26113
+ newRangeStart = newLine;
26114
+ if (prev) {
26115
+ curRange = context2 > 0 ? contextLines(prev.lines.slice(-context2)) : [];
26116
+ oldRangeStart -= curRange.length;
26117
+ newRangeStart -= curRange.length;
26118
+ }
26119
+ }
26120
+ for (const line of lines) {
26121
+ curRange.push((current.added ? "+" : "-") + line);
26122
+ }
26123
+ if (current.added) {
26124
+ newLine += lines.length;
26125
+ } else {
26126
+ oldLine += lines.length;
26127
+ }
26128
+ } else {
26129
+ if (oldRangeStart) {
26130
+ if (lines.length <= context2 * 2 && i < diff.length - 2) {
26131
+ for (const line of contextLines(lines)) {
26132
+ curRange.push(line);
26133
+ }
26134
+ } else {
26135
+ const contextSize = Math.min(lines.length, context2);
26136
+ for (const line of contextLines(lines.slice(0, contextSize))) {
26137
+ curRange.push(line);
26138
+ }
26139
+ const hunk = {
26140
+ oldStart: oldRangeStart,
26141
+ oldLines: oldLine - oldRangeStart + contextSize,
26142
+ newStart: newRangeStart,
26143
+ newLines: newLine - newRangeStart + contextSize,
26144
+ lines: curRange
26145
+ };
26146
+ hunks2.push(hunk);
26147
+ oldRangeStart = 0;
26148
+ newRangeStart = 0;
26149
+ curRange = [];
26150
+ }
26151
+ }
26152
+ oldLine += lines.length;
26153
+ newLine += lines.length;
26154
+ }
26155
+ }
26156
+ for (const hunk of hunks2) {
26157
+ for (let i = 0; i < hunk.lines.length; i++) {
26158
+ if (hunk.lines[i].endsWith("\n")) {
26159
+ hunk.lines[i] = hunk.lines[i].slice(0, -1);
26160
+ } else {
26161
+ hunk.lines.splice(i + 1, 0, "\");
26162
+ i++;
26163
+ }
26164
+ }
26165
+ }
26166
+ return {
26167
+ oldFileName,
26168
+ newFileName,
26169
+ oldHeader,
26170
+ newHeader,
26171
+ hunks: hunks2
26172
+ };
26173
+ }
26174
+ __name(diffLinesResultToPatch, "diffLinesResultToPatch");
26175
+ }
26176
+ __name(structuredPatch, "structuredPatch");
26177
+ function splitLines(text9) {
26178
+ const hasTrailingNl = text9.endsWith("\n");
26179
+ const result = text9.split("\n").map((line) => line + "\n");
26180
+ if (hasTrailingNl) {
26181
+ result.pop();
26182
+ } else {
26183
+ result.push(result.pop().slice(0, -1));
26184
+ }
26185
+ return result;
26186
+ }
26187
+ __name(splitLines, "splitLines");
26188
+
26189
+ // ../sdk/dist/tools/builtins/line-diff.js
26190
+ var CONTEXT_LINES = 3;
26191
+ var DIFF_TIMEOUT_MS = 5e3;
26192
+ var MAX_CARRIED_DIFF_LINES = 400;
26193
+ var MAX_CARRIED_LINE_CHARS = 500;
26194
+ function cutRow(row) {
26195
+ if (row.length <= MAX_CARRIED_LINE_CHARS)
26196
+ return row;
26197
+ const cut = row.slice(0, MAX_CARRIED_LINE_CHARS - 1).replace(/[\uD800-\uDBFF]$/, "");
26198
+ return `${cut}\u2026`;
26199
+ }
26200
+ __name(cutRow, "cutRow");
26201
+ function splitKeepingTerminators(text9) {
26202
+ return text9.length === 0 ? [] : text9.match(/[^\n]*\n|[^\n]+$/g) ?? [];
26203
+ }
26204
+ __name(splitKeepingTerminators, "splitKeepingTerminators");
26205
+ function coarseDiff(before, after) {
26206
+ const a = splitKeepingTerminators(before);
26207
+ const b = splitKeepingTerminators(after);
26208
+ let head2 = 0;
26209
+ while (head2 < a.length && head2 < b.length && a[head2] === b[head2])
26210
+ head2++;
26211
+ let tail = 0;
26212
+ while (tail < a.length - head2 && tail < b.length - head2 && a[a.length - 1 - tail] === b[b.length - 1 - tail])
26213
+ tail++;
26214
+ const removed = a.slice(head2, a.length - tail);
26215
+ const added = b.slice(head2, b.length - tail);
26216
+ const rows = [
26217
+ ...removed.map((line) => `-${line.replace(/\n$/, "")}`),
26218
+ ...added.map((line) => `+${line.replace(/\n$/, "")}`)
26219
+ ];
26220
+ const kept = rows.slice(0, MAX_CARRIED_DIFF_LINES).map(cutRow);
26221
+ return {
26222
+ added: added.length,
26223
+ removed: removed.length,
26224
+ hunks: rows.length === 0 ? [] : [
26225
+ {
26226
+ oldStart: head2 + 1,
26227
+ oldLines: removed.length,
26228
+ newStart: head2 + 1,
26229
+ newLines: added.length,
26230
+ lines: kept
26231
+ }
26232
+ ],
26233
+ truncated: rows.length > kept.length
26234
+ };
26235
+ }
26236
+ __name(coarseDiff, "coarseDiff");
26237
+ function lineDiff2(before, after) {
26238
+ if (before === after)
26239
+ return { added: 0, removed: 0, hunks: [], truncated: false };
26240
+ const patch = structuredPatch("a", "a", before, after, void 0, void 0, {
26241
+ context: CONTEXT_LINES,
26242
+ timeout: DIFF_TIMEOUT_MS
26243
+ });
26244
+ if (patch === void 0)
26245
+ return coarseDiff(before, after);
26246
+ let added = 0;
26247
+ let removed = 0;
26248
+ let budget = MAX_CARRIED_DIFF_LINES;
26249
+ let truncated = false;
26250
+ const hunks2 = [];
26251
+ for (const hunk of patch.hunks) {
26252
+ const rows = [];
26253
+ for (const row of hunk.lines) {
26254
+ if (row.startsWith("\\"))
26255
+ continue;
26256
+ if (row.startsWith("+"))
26257
+ added++;
26258
+ else if (row.startsWith("-"))
26259
+ removed++;
26260
+ if (budget > 0) {
26261
+ rows.push(cutRow(row));
26262
+ budget--;
26263
+ } else {
26264
+ truncated = true;
26265
+ }
26266
+ }
26267
+ if (rows.length > 0) {
26268
+ hunks2.push({
26269
+ oldStart: hunk.oldStart,
26270
+ oldLines: hunk.oldLines,
26271
+ newStart: hunk.newStart,
26272
+ newLines: hunk.newLines,
26273
+ lines: rows
26274
+ });
26275
+ }
26276
+ }
26277
+ return { added, removed, hunks: hunks2, truncated };
26278
+ }
26279
+ __name(lineDiff2, "lineDiff");
26280
+
25801
26281
  // ../sdk/dist/tools/builtins/edit.js
25802
26282
  var inputSchema3 = external_exports.object({
25803
26283
  path: external_exports.string().refine((value) => value.trim().length > 0, "Path must not be empty.").describe("Path to the file to edit. Must not be empty."),
@@ -25994,6 +26474,22 @@ function admitAgainstRead(context2, key5, content, operations) {
25994
26474
  }
25995
26475
  __name(admitAgainstRead, "admitAgainstRead");
25996
26476
  var EDIT_SHAPES = 'Three shapes. Replace: {"path":"file.md","old_string":"exact unique text","new_string":"replacement text"} (optional "replace_all": true). Insert: {"path":"file.md","insertLine":"end","new_string":"text to add"} where insertLine is a non-negative line number or "end". Batch: {"path":"file.md","edits":[{"old_string":"a","new_string":"b"},{"old_string":"c","new_string":"d"}]} applied in order, all or nothing. Exactly one of old_string, insertLine or edits \u2014 a call carrying more than one of them is refused rather than resolved.';
26477
+ function editFacts(path2, replacements, before, after) {
26478
+ const diff = lineDiff2(before, after);
26479
+ return {
26480
+ diff,
26481
+ facts: {
26482
+ kind: "edit",
26483
+ path: path2,
26484
+ replacements,
26485
+ added: diff.added,
26486
+ removed: diff.removed,
26487
+ ...diff.hunks.length > 0 ? { hunks: diff.hunks } : {},
26488
+ ...diff.truncated ? { hunksTruncated: true } : {}
26489
+ }
26490
+ };
26491
+ }
26492
+ __name(editFacts, "editFacts");
25997
26493
  var EditTool = defineTool({
25998
26494
  name: "edit",
25999
26495
  description: 'Makes targeted edits to a file using exact string find-and-replace or line insertion. THIS IS THE PREFERRED WAY TO MODIFY AN EXISTING FILE \u2014 never reach for `write` to change a file that already exists, because `write` overwrites the whole body and discards earlier work on partial failure. `edit` keeps the rest of the file byte-for-byte intact and is recoverable: if a single edit fails (old_string/oldStr ambiguous, broader restructuring needed), follow up with another `edit` instead of re-emitting the entire file via `write`. The old_string/oldStr must be unique in the file unless replace_all is true. For insertions, pass insertLine plus new_string/newStr; use insertLine: "end" to extend a file at the end. Self-budget new_string/newStr under 12000 characters before emitting the tool call; use repeated bounded edits for long sections. Preserves file formatting and indentation. To make several changes to ONE file that only make sense together, send them as `edits`: a list of {old_string, new_string} applied in order and committed as one write \u2014 if any of them does not apply, nothing is written and the reply names which one, so the file is never left half-changed.',
@@ -26099,19 +26595,16 @@ var EditTool = defineTool({
26099
26595
  }
26100
26596
  await context2.sandbox.writeFile(parsed.data.path, result2.content);
26101
26597
  recordEditedContent(context2, parsed.data.path, result2.content);
26598
+ const changed2 = editFacts(parsed.data.path, result2.replacements, content2, result2.content);
26102
26599
  return {
26103
26600
  success: true,
26104
- output: `Edited ${parsed.data.path}: ${result2.replacements} replacement(s) [sandboxed]`,
26601
+ output: `Edited ${parsed.data.path}: ${result2.replacements} replacement(s) (+${changed2.diff.added} -${changed2.diff.removed}) [sandboxed]`,
26105
26602
  data: {
26106
26603
  path: parsed.data.path,
26107
26604
  replacements: result2.replacements,
26108
26605
  sandboxed: true
26109
26606
  },
26110
- facts: {
26111
- kind: "edit",
26112
- path: parsed.data.path,
26113
- replacements: result2.replacements
26114
- }
26607
+ facts: changed2.facts
26115
26608
  };
26116
26609
  }
26117
26610
  const hostPath = filePath;
@@ -26124,15 +26617,12 @@ var EditTool = defineTool({
26124
26617
  return { success: false, output: "", error: result.error };
26125
26618
  await atomicWriteFile2(hostPath, result.content);
26126
26619
  recordEditedContent(context2, hostPath, result.content);
26620
+ const changed = editFacts(hostPath, result.replacements, content, result.content);
26127
26621
  return {
26128
26622
  success: true,
26129
- output: `Edited ${hostPath}: ${result.replacements} replacement(s)`,
26623
+ output: `Edited ${hostPath}: ${result.replacements} replacement(s) (+${changed.diff.added} -${changed.diff.removed})`,
26130
26624
  data: { path: hostPath, replacements: result.replacements },
26131
- facts: {
26132
- kind: "edit",
26133
- path: hostPath,
26134
- replacements: result.replacements
26135
- }
26625
+ facts: changed.facts
26136
26626
  };
26137
26627
  });
26138
26628
  }
@@ -26168,13 +26658,13 @@ function clipTail(text9, max) {
26168
26658
  __name(clipTail, "clipTail");
26169
26659
  function windowText(text9, totalBytes = Buffer.byteLength(text9, "utf8")) {
26170
26660
  const body = text9.endsWith("\n") ? text9.slice(0, -1) : text9;
26171
- const lines2 = body.length === 0 ? [] : body.split("\n");
26172
- const totalLines = lines2.length;
26661
+ const lines = body.length === 0 ? [] : body.split("\n");
26662
+ const totalLines = lines.length;
26173
26663
  if (totalLines <= WINDOW_HEAD_LINES + WINDOW_TAIL_LINES && body.length <= WINDOW_HALF_CHARS * 2) {
26174
26664
  return { head: body, totalLines, totalBytes };
26175
26665
  }
26176
- const headLines = lines2.slice(0, WINDOW_HEAD_LINES);
26177
- const tailLines = totalLines > WINDOW_HEAD_LINES ? lines2.slice(Math.max(WINDOW_HEAD_LINES, totalLines - WINDOW_TAIL_LINES)) : [];
26666
+ const headLines = lines.slice(0, WINDOW_HEAD_LINES);
26667
+ const tailLines = totalLines > WINDOW_HEAD_LINES ? lines.slice(Math.max(WINDOW_HEAD_LINES, totalLines - WINDOW_TAIL_LINES)) : [];
26178
26668
  const head2 = clipHead(headLines.join("\n"), WINDOW_HALF_CHARS);
26179
26669
  const tail = clipTail(tailLines.join("\n"), WINDOW_HALF_CHARS);
26180
26670
  const omittedLines = totalLines - headLines.length - tailLines.length;
@@ -26211,15 +26701,15 @@ __name(looksBinary, "looksBinary");
26211
26701
  // ../sdk/dist/tools/builtins/read-render.js
26212
26702
  var DEFAULT_READ_LINES = 2e3;
26213
26703
  function renderNumberedRead(content, input) {
26214
- const lines2 = content.split("\n");
26215
- const { start, end } = resolveReadWindow(input, lines2.length);
26216
- const selected = lines2.slice(start, end);
26704
+ const lines = content.split("\n");
26705
+ const { start, end } = resolveReadWindow(input, lines.length);
26706
+ const selected = lines.slice(start, end);
26217
26707
  const numbered2 = selected.map((line, i) => `${start + i + 1} ${line}`).join("\n");
26218
26708
  return {
26219
- output: numbered2 + partialViewNotice(start, selected.length, lines2.length),
26220
- totalLines: lines2.length,
26709
+ output: numbered2 + partialViewNotice(start, selected.length, lines.length),
26710
+ totalLines: lines.length,
26221
26711
  returnedLines: selected.length,
26222
- partial: selected.length < lines2.length
26712
+ partial: selected.length < lines.length
26223
26713
  };
26224
26714
  }
26225
26715
  __name(renderNumberedRead, "renderNumberedRead");
@@ -26281,9 +26771,9 @@ function renderCappedRead(content, byteLength, input, options) {
26281
26771
  message: `File content (${humanBytes(byteLength)}) exceeds the maximum allowed size (${humanBytes(maxBytes)}). Use offset and limit to read part of it, or search for what you need instead of reading all of it.${hint}`
26282
26772
  };
26283
26773
  }
26284
- const lines2 = content.split("\n");
26285
- const { start, end } = resolveReadWindow(input, lines2.length);
26286
- const selected = lines2.slice(start, end);
26774
+ const lines = content.split("\n");
26775
+ const { start, end } = resolveReadWindow(input, lines.length);
26776
+ const selected = lines.slice(start, end);
26287
26777
  const selectedText = selected.join("\n");
26288
26778
  const selectedBytes = Buffer.byteLength(selectedText, "utf8");
26289
26779
  if (selectedBytes > maxTokens * SELECTED_BYTES_PER_TOKEN) {
@@ -26305,7 +26795,7 @@ function renderCappedRead(content, byteLength, input, options) {
26305
26795
  }
26306
26796
  return {
26307
26797
  ok: true,
26308
- rendered: trimFirstPage(selected, lines2.length, selectedText, tokens, maxTokens, options.path)
26798
+ rendered: trimFirstPage(selected, lines.length, selectedText, tokens, maxTokens, options.path)
26309
26799
  };
26310
26800
  }
26311
26801
  __name(renderCappedRead, "renderCappedRead");
@@ -26351,8 +26841,8 @@ function trimFirstPage(selected, totalLines, selectedText, tokens, maxTokens, pa
26351
26841
  };
26352
26842
  }
26353
26843
  __name(trimFirstPage, "trimFirstPage");
26354
- function numbered(lines2) {
26355
- return lines2.map((line, i) => `${i + 1} ${line}`).join("\n");
26844
+ function numbered(lines) {
26845
+ return lines.map((line, i) => `${i + 1} ${line}`).join("\n");
26356
26846
  }
26357
26847
  __name(numbered, "numbered");
26358
26848
 
@@ -26569,33 +27059,19 @@ import { dirname as dirname9 } from "node:path";
26569
27059
 
26570
27060
  // ../sdk/dist/tools/builtins/file-write-result.js
26571
27061
  import { createHash as createHash8 } from "node:crypto";
26572
- function lines(text9) {
26573
- if (text9 === "")
26574
- return [];
26575
- const result = text9.split("\n");
26576
- if (result.at(-1) === "")
26577
- result.pop();
26578
- return result;
27062
+ function previewSide(hunks2, changed) {
27063
+ return hunks2.flatMap((hunk) => hunk.lines).filter((row) => row.startsWith(" ") || row.startsWith(changed)).map((row) => `${row.slice(1)}
27064
+ `).join("");
26579
27065
  }
26580
- __name(lines, "lines");
27066
+ __name(previewSide, "previewSide");
26581
27067
  function fileWriteResult(path2, before, after, sandboxed = false) {
26582
27068
  const operation = before === null ? "write" : before === void 0 ? "create" : before === after ? "unchanged" : "replace";
26583
- const oldLines = lines(before ?? "");
26584
- const newLines = lines(after);
26585
- let start = 0;
26586
- let end = 0;
26587
- if (typeof before === "string") {
26588
- while (start < oldLines.length && start < newLines.length && oldLines[start] === newLines[start])
26589
- start++;
26590
- while (end < oldLines.length - start && end < newLines.length - start && oldLines[oldLines.length - end - 1] === newLines[newLines.length - end - 1])
26591
- end++;
26592
- }
26593
- const removed = oldLines.slice(start, oldLines.length - end);
26594
- const added = newLines.slice(start, newLines.length - end);
27069
+ const diff = lineDiff2(typeof before === "string" ? before : "", after);
27070
+ const known = before !== null;
26595
27071
  const bytes = Buffer.byteLength(after, "utf8");
26596
27072
  const label5 = operation === "create" ? "Created" : operation === "replace" ? "Updated" : operation === "unchanged" ? "Unchanged" : "Wrote";
26597
27073
  const newlineChanged = typeof before === "string" && before.endsWith("\n") !== after.endsWith("\n");
26598
- const summary2 = `${label5} ${path2}${before === null ? "" : ` (+${added.length} -${removed.length})`}${newlineChanged ? " \xB7 final newline changed" : ""}`;
27074
+ const summary2 = `${label5} ${path2}${before === null ? "" : ` (+${diff.added} -${diff.removed})`}${newlineChanged ? " \xB7 final newline changed" : ""}`;
26599
27075
  return {
26600
27076
  success: true,
26601
27077
  output: `${summary2} \xB7 ${bytes} bytes`,
@@ -26604,7 +27080,12 @@ function fileWriteResult(path2, before, after, sandboxed = false) {
26604
27080
  path: path2,
26605
27081
  operation: operation === "create" ? "created" : operation === "replace" ? "updated" : operation === "unchanged" ? "unchanged" : "wrote",
26606
27082
  bytes,
26607
- ...before === null ? {} : { added: added.length, removed: removed.length }
27083
+ ...known ? {
27084
+ added: diff.added,
27085
+ removed: diff.removed,
27086
+ ...diff.hunks.length > 0 ? { hunks: diff.hunks } : {},
27087
+ ...diff.truncated ? { hunksTruncated: true } : {}
27088
+ } : {}
26608
27089
  },
26609
27090
  data: {
26610
27091
  path: path2,
@@ -26614,15 +27095,13 @@ function fileWriteResult(path2, before, after, sandboxed = false) {
26614
27095
  operation,
26615
27096
  ...before === null ? {} : {
26616
27097
  preview: {
26617
- before: removed.length ? `${removed.join("\n")}
26618
- ` : "",
26619
- after: added.length ? `${added.join("\n")}
26620
- ` : ""
27098
+ before: previewSide(diff.hunks, "-"),
27099
+ after: previewSide(diff.hunks, "+")
26621
27100
  }
26622
27101
  },
26623
27102
  bytes,
26624
27103
  sha256: createHash8("sha256").update(after, "utf8").digest("hex"),
26625
- ...before === null ? {} : { added: added.length, removed: removed.length, newlineChanged }
27104
+ ...before === null ? {} : { added: diff.added, removed: diff.removed, newlineChanged }
26626
27105
  }
26627
27106
  }
26628
27107
  };
@@ -27092,24 +27571,24 @@ function observeRead(history, call2, claims, withBody, budget) {
27092
27571
  }
27093
27572
  __name(observeRead, "observeRead");
27094
27573
  function wholeFileRenderUnits(body, window2) {
27095
- const lines2 = countLines(body);
27096
- const { start, end } = resolveReadWindow(window2, lines2);
27097
- if (start !== 0 || end < lines2)
27574
+ const lines = countLines(body);
27575
+ const { start, end } = resolveReadWindow(window2, lines);
27576
+ if (start !== 0 || end < lines)
27098
27577
  return void 0;
27099
- return body.length + lines2 + lineNumberUnits(lines2);
27578
+ return body.length + lines + lineNumberUnits(lines);
27100
27579
  }
27101
27580
  __name(wholeFileRenderUnits, "wholeFileRenderUnits");
27102
27581
  function countLines(body) {
27103
- let lines2 = 1;
27582
+ let lines = 1;
27104
27583
  for (let at = body.indexOf("\n"); at !== -1; at = body.indexOf("\n", at + 1))
27105
- lines2++;
27106
- return lines2;
27584
+ lines++;
27585
+ return lines;
27107
27586
  }
27108
27587
  __name(countLines, "countLines");
27109
- function lineNumberUnits(lines2) {
27588
+ function lineNumberUnits(lines) {
27110
27589
  let units = 0;
27111
- for (let width = 1, first = 1; first <= lines2; width++, first *= 10)
27112
- units += (Math.min(lines2, first * 10 - 1) - first + 1) * width;
27590
+ for (let width = 1, first = 1; first <= lines; width++, first *= 10)
27591
+ units += (Math.min(lines, first * 10 - 1) - first + 1) * width;
27113
27592
  return units;
27114
27593
  }
27115
27594
  __name(lineNumberUnits, "lineNumberUnits");
@@ -29472,51 +29951,51 @@ function renderPlan(plan) {
29472
29951
  }
29473
29952
  __name(renderPlan, "renderPlan");
29474
29953
  function renderFiles(files) {
29475
- const lines2 = [];
29954
+ const lines = [];
29476
29955
  for (const [, slot] of files) {
29477
- lines2.push(`- \`${slot.path}\``);
29956
+ lines.push(`- \`${slot.path}\``);
29478
29957
  for (const action of slot.actions) {
29479
29958
  if (action.type === "delete") {
29480
- lines2.push(" - deleted");
29959
+ lines.push(" - deleted");
29481
29960
  } else {
29482
29961
  const desc = "detail" in action ? action.detail : action.summary;
29483
- lines2.push(` - ${action.type}: ${desc ?? ""}`);
29962
+ lines.push(` - ${action.type}: ${desc ?? ""}`);
29484
29963
  }
29485
29964
  }
29486
29965
  }
29487
- return lines2.join("\n");
29966
+ return lines.join("\n");
29488
29967
  }
29489
29968
  __name(renderFiles, "renderFiles");
29490
29969
  function renderList(items, evictedCount = 0) {
29491
- const lines2 = items.map((item) => `- ${item}`);
29970
+ const lines = items.map((item) => `- ${item}`);
29492
29971
  if (evictedCount > 0) {
29493
29972
  const noun = evictedCount === 1 ? "entry" : "entries";
29494
- lines2.push(`- _(${evictedCount} ${noun} dropped to stay within the state budget)_`);
29973
+ lines.push(`- _(${evictedCount} ${noun} dropped to stay within the state budget)_`);
29495
29974
  }
29496
- return lines2.join("\n");
29975
+ return lines.join("\n");
29497
29976
  }
29498
29977
  __name(renderList, "renderList");
29499
29978
  function renderToolResults(results, evictedCount = 0) {
29500
- const lines2 = results.map((r) => `- **${r.tool}**: ${r.summary}`);
29979
+ const lines = results.map((r) => `- **${r.tool}**: ${r.summary}`);
29501
29980
  if (evictedCount > 0) {
29502
29981
  const noun = evictedCount === 1 ? "result" : "results";
29503
- lines2.push(`- _(${evictedCount} earlier tool ${noun} dropped to stay within the state budget)_`);
29982
+ lines.push(`- _(${evictedCount} earlier tool ${noun} dropped to stay within the state budget)_`);
29504
29983
  }
29505
- return lines2.join("\n");
29984
+ return lines.join("\n");
29506
29985
  }
29507
29986
  __name(renderToolResults, "renderToolResults");
29508
29987
  function renderPins(state) {
29509
29988
  const pins = state.pins ? [...state.pins.values()] : [];
29510
29989
  if (pins.length === 0)
29511
29990
  return null;
29512
- const lines2 = pins.map((p) => `- **${p.key}**: ${p.text} _(${p.source})_`);
29991
+ const lines = pins.map((p) => `- **${p.key}**: ${p.text} _(${p.source})_`);
29513
29992
  const dropped = state.evicted.pins ?? 0;
29514
29993
  if (dropped > 0) {
29515
- lines2.push(`- _(${dropped} older ${dropped === 1 ? "pin" : "pins"} dropped to stay within the pin budget)_`);
29994
+ lines.push(`- _(${dropped} older ${dropped === 1 ? "pin" : "pins"} dropped to stay within the pin budget)_`);
29516
29995
  }
29517
29996
  return `${SECTION_HEADERS.pins}
29518
29997
 
29519
- ${lines2.join("\n")}`;
29998
+ ${lines.join("\n")}`;
29520
29999
  }
29521
30000
  __name(renderPins, "renderPins");
29522
30001
  function serializeState(state) {
@@ -30868,24 +31347,23 @@ var TurnRecorder = class {
30868
31347
  const durable = next.filter((entry) => !entry.transient);
30869
31348
  const recordedOrder = new Map(this.#view.filter((entry) => entry.id).map((entry, index) => [entry.id, index]));
30870
31349
  const first = durable.findIndex((entry) => entry.id !== void 0);
30871
- let last = -1;
30872
- for (let i = durable.length - 1; i >= 0; i--) {
30873
- if (durable[i]?.id !== void 0) {
30874
- last = i;
30875
- break;
31350
+ let runEnd = first < 0 ? 0 : first + 1;
31351
+ if (first >= 0) {
31352
+ let prev = recordedOrder.get(durable[first]?.id) ?? -1;
31353
+ for (let i = first + 1; i < durable.length; i++) {
31354
+ const id3 = durable[i]?.id;
31355
+ if (id3 === void 0)
31356
+ break;
31357
+ const order = recordedOrder.get(id3) ?? -1;
31358
+ if (order <= prev)
31359
+ break;
31360
+ prev = order;
31361
+ runEnd = i + 1;
30876
31362
  }
30877
31363
  }
30878
- const middle = first < 0 ? [] : durable.slice(first, last + 1);
30879
- let ordered = middle.every((entry) => entry.id !== void 0);
30880
- for (let i = 1; ordered && i < middle.length; i++) {
30881
- const before = recordedOrder.get(middle[i - 1]?.id) ?? -1;
30882
- const after = recordedOrder.get(middle[i]?.id) ?? -1;
30883
- if (after <= before)
30884
- ordered = false;
30885
- }
30886
- const summaryEntries = !ordered ? durable : first < 0 ? durable : durable.slice(0, first);
30887
- const keptEntries = ordered ? middle : [];
30888
- const tailEntries = ordered && first >= 0 ? durable.slice(last + 1) : [];
31364
+ const summaryEntries = first < 0 ? [] : durable.slice(0, first);
31365
+ const keptEntries = first < 0 ? [] : durable.slice(first, runEnd);
31366
+ const tailEntries = durable.slice(first < 0 ? 0 : runEnd);
30889
31367
  for (const entry of summaryEntries) {
30890
31368
  entry.id = void 0;
30891
31369
  this.#ids.delete(entry.message);
@@ -30912,6 +31390,8 @@ var TurnRecorder = class {
30912
31390
  }).catch(() => void 0);
30913
31391
  for (const entry of tailEntries) {
30914
31392
  const message = entry.message;
31393
+ this.#ids.delete(message);
31394
+ this.#recorded.delete(message);
30915
31395
  const id3 = this.#idFor(message);
30916
31396
  entry.id = id3;
30917
31397
  void this.#enqueue(() => this.#append({
@@ -31361,7 +31841,7 @@ function buildAdvisoryTools(opts) {
31361
31841
  async execute() {
31362
31842
  const advisors = advisoryCtx.registry.listAll();
31363
31843
  const budget = advisoryCtx.getBudgetStatus();
31364
- const lines2 = advisors.map((a) => {
31844
+ const lines = advisors.map((a) => {
31365
31845
  const domains = a.domains && a.domains.length > 0 ? a.domains.join(", ") : "general";
31366
31846
  return `- ${a.id}: ${a.name} [domains: ${domains}]`;
31367
31847
  });
@@ -31369,7 +31849,7 @@ function buildAdvisoryTools(opts) {
31369
31849
  return {
31370
31850
  success: true,
31371
31851
  output: advisors.length === 0 ? "No advisors configured." : `${advisors.length} advisor(s) available:
31372
- ${lines2.join("\n")}
31852
+ ${lines.join("\n")}
31373
31853
 
31374
31854
  ${budgetLine}`,
31375
31855
  data: {
@@ -33955,7 +34435,7 @@ ${partial.content}`;
33955
34435
  attributes: { agent: handle.agentId, task: handle.taskId },
33956
34436
  provenance: `This is the output of the delegated agent "${handle.agentId}", not this agent's own work.`
33957
34437
  }, neutralizeNotificationDelimiter(shown)) : "(the task produced no output)";
33958
- const lines2 = [
34438
+ const lines = [
33959
34439
  `task_id: ${handle.taskId}`,
33960
34440
  `agent: ${handle.agentId}`,
33961
34441
  `state: ${handle.state}`,
@@ -33976,7 +34456,7 @@ ${partial.content}`;
33976
34456
  ...overLimit ? [`\u2026 truncated. Call wait_for_task with task_id "${handle.taskId}" for the full output.`] : []
33977
34457
  ];
33978
34458
  return `<task-notification>
33979
- ${lines2.join("\n")}
34459
+ ${lines.join("\n")}
33980
34460
  </task-notification>`;
33981
34461
  });
33982
34462
  const preamble = handles.length === 1 ? "A task you launched has finished. This is its result \u2014 you were not waiting on it, so it arrives here rather than as a tool result." : `${handles.length} tasks you launched have finished. These are their results \u2014 you were not waiting on them, so they arrive here rather than as tool results.`;
@@ -34866,7 +35346,7 @@ function splitIdentifier(raw) {
34866
35346
  return parts.length > 1 ? parts : [];
34867
35347
  }
34868
35348
  __name(splitIdentifier, "splitIdentifier");
34869
- function tokenize(text9) {
35349
+ function tokenize2(text9) {
34870
35350
  const out = [];
34871
35351
  for (const match2 of text9.matchAll(WORD)) {
34872
35352
  const raw = match2[0].replace(/^[.\-/\\:]+|[.\-/\\:]+$/g, "");
@@ -34894,7 +35374,7 @@ function tokenize(text9) {
34894
35374
  }
34895
35375
  return out;
34896
35376
  }
34897
- __name(tokenize, "tokenize");
35377
+ __name(tokenize2, "tokenize");
34898
35378
  function termFrequencies(tokens) {
34899
35379
  const tf = /* @__PURE__ */ new Map();
34900
35380
  for (const token of tokens)
@@ -34907,7 +35387,7 @@ __name(termFrequencies, "termFrequencies");
34907
35387
  var K1 = 1.2;
34908
35388
  var B = 0.75;
34909
35389
  function indexDocument(text9) {
34910
- const tokens = tokenize(text9);
35390
+ const tokens = tokenize2(text9);
34911
35391
  return { tf: termFrequencies(tokens), length: tokens.length };
34912
35392
  }
34913
35393
  __name(indexDocument, "indexDocument");
@@ -35045,10 +35525,10 @@ function scoreMessages(messages, options) {
35045
35525
  const n = messages.length;
35046
35526
  const texts = messages.map(messageText);
35047
35527
  const richContent = messages.map(hasRichContent);
35048
- const tokenLists = texts.map(tokenize);
35528
+ const tokenLists = texts.map(tokenize2);
35049
35529
  const documents = texts.map(indexDocument);
35050
35530
  const index = buildIndex(documents);
35051
- const goalTokens = tokenize(options.goal);
35531
+ const goalTokens = tokenize2(options.goal);
35052
35532
  const rawRelevance = documents.map((doc) => bm25Score(index, doc, goalTokens));
35053
35533
  const maxRelevance = Math.max(0, ...rawRelevance.filter((_, i) => {
35054
35534
  const m = messages[i];
@@ -36409,6 +36889,14 @@ async function runCompactionCheckInner(ctx, pass, options) {
36409
36889
  });
36410
36890
  }
36411
36891
  }
36892
+ await ctx.emitEvent?.({
36893
+ type: "compaction_started",
36894
+ turnId: ctx.recorder.turnId,
36895
+ iteration: ctx.recorder.currentIteration,
36896
+ reason: pass.reason,
36897
+ tokensBefore: estimatedTokens,
36898
+ contextWindowTokens: budget
36899
+ });
36412
36900
  const reducer = ctx.contextReducer ?? (config.strategy === "sliding-window" ? createSlidingWindowReducer() : void 0);
36413
36901
  if (reducer) {
36414
36902
  if (!options?.force && await stopOnRefill(ctx))
@@ -46152,35 +46640,35 @@ __name(assertTurnMayStart, "assertTurnMayStart");
46152
46640
  // ../sdk/dist/runtime/query/prompt.js
46153
46641
  function buildEnvContext(workingDirectory, config) {
46154
46642
  const { runtimeContext, tools, allowedTools } = config;
46155
- const lines2 = [
46643
+ const lines = [
46156
46644
  `<env>
46157
46645
  Working directory: ${workingDirectory}
46158
46646
  ${config.sandboxed ? "Host platform" : "Platform"}: ${process.platform}`
46159
46647
  ];
46160
46648
  if (runtimeContext?.label) {
46161
- lines2.push(`Runtime: ${runtimeContext.label}`);
46649
+ lines.push(`Runtime: ${runtimeContext.label}`);
46162
46650
  }
46163
46651
  if (runtimeContext?.outputDirectory) {
46164
- lines2.push(`Output directory: ${runtimeContext.outputDirectory}`);
46652
+ lines.push(`Output directory: ${runtimeContext.outputDirectory}`);
46165
46653
  }
46166
46654
  if (runtimeContext?.outputFileMarker) {
46167
- lines2.push(`Output file marker: ${runtimeContext.outputFileMarker}`);
46655
+ lines.push(`Output file marker: ${runtimeContext.outputFileMarker}`);
46168
46656
  }
46169
46657
  if (runtimeContext?.notes?.length) {
46170
- lines2.push("Runtime notes:");
46658
+ lines.push("Runtime notes:");
46171
46659
  for (const note of runtimeContext.notes) {
46172
- lines2.push(`- ${note}`);
46660
+ lines.push(`- ${note}`);
46173
46661
  }
46174
46662
  }
46175
- lines2.push(`</env>
46663
+ lines.push(`</env>
46176
46664
 
46177
46665
  Resolve relative paths against the working directory above; use supplied absolute paths as given.`);
46178
46666
  if (hasFilesystemTools(tools, allowedTools)) {
46179
- lines2.push("When file contents are needed, read known file paths directly. Discover unknown paths with available filesystem tools using targeted directories and patterns.");
46667
+ lines.push("When file contents are needed, read known file paths directly. Discover unknown paths with available filesystem tools using targeted directories and patterns.");
46180
46668
  const canGlob = tools.has("glob") && (!allowedTools || allowedTools.includes("glob")) && tools.availability("glob") === "active";
46181
- lines2.push(canGlob ? "For an immediate directory overview, use glob with pattern '*' or an available directory listing tool. Use '**' only when recursive discovery is needed." : "For an immediate directory overview, use an available directory listing tool.", "Keep discovery within the task's scope; do not recursively inventory unrelated home directories or cache trees.");
46669
+ lines.push(canGlob ? "For an immediate directory overview, use glob with pattern '*' or an available directory listing tool. Use '**' only when recursive discovery is needed." : "For an immediate directory overview, use an available directory listing tool.", "Keep discovery within the task's scope; do not recursively inventory unrelated home directories or cache trees.");
46182
46670
  }
46183
- return lines2.join("\n");
46671
+ return lines.join("\n");
46184
46672
  }
46185
46673
  __name(buildEnvContext, "buildEnvContext");
46186
46674
  function hasFilesystemTools(tools, allowedTools) {
@@ -46198,18 +46686,18 @@ function hasFilesystemTools(tools, allowedTools) {
46198
46686
  }
46199
46687
  __name(hasFilesystemTools, "hasFilesystemTools");
46200
46688
  function buildShellContext(config) {
46201
- const lines2 = [];
46689
+ const lines = [];
46202
46690
  for (const name2 of config.allowedTools ?? config.tools.listNames()) {
46203
46691
  const tool = config.tools.get(name2);
46204
46692
  if (!tool?.commandArgument || !tool.commandDialect || config.tools.availability(name2) !== "active")
46205
46693
  continue;
46206
46694
  const dialect = tool.commandDialect({ sandboxed: config.sandboxed === true });
46207
46695
  const gitBash = !config.sandboxed && dialect === "bash" && isWindowsBash();
46208
- lines2.push(`Execution shell for ${name2}: ${dialect}${config.sandboxed ? " (sandbox guest)" : gitBash ? " (Git Bash on Windows, host)" : " (host)"}.`);
46696
+ lines.push(`Execution shell for ${name2}: ${dialect}${config.sandboxed ? " (sandbox guest)" : gitBash ? " (Git Bash on Windows, host)" : " (host)"}.`);
46209
46697
  if (dialect === "cmd")
46210
- lines2.push("Use native Windows CMD command syntax. Single quotes do not quote arguments; backslashes do not escape shell operators. PowerShell syntax requires explicitly invoking PowerShell. Command-specific automatic permission grants are unavailable; an exact-call review may be required.");
46698
+ lines.push("Use native Windows CMD command syntax. Single quotes do not quote arguments; backslashes do not escape shell operators. PowerShell syntax requires explicitly invoking PowerShell. Command-specific automatic permission grants are unavailable; an exact-call review may be required.");
46211
46699
  }
46212
- return lines2.length > 0 ? lines2.join("\n") : void 0;
46700
+ return lines.length > 0 ? lines.join("\n") : void 0;
46213
46701
  }
46214
46702
  __name(buildShellContext, "buildShellContext");
46215
46703
  var PromptBuilder = class {
@@ -47124,11 +47612,11 @@ function normalizeLine(line) {
47124
47612
  return line.replace(/^\s*\d+[\s:.|)]+/, "").replace(/\d+/g, "N");
47125
47613
  }
47126
47614
  __name(normalizeLine, "normalizeLine");
47127
- function collapseRepeated(lines2) {
47615
+ function collapseRepeated(lines) {
47128
47616
  const result = [];
47129
47617
  let prevNorm = "";
47130
47618
  let repeatCount = 0;
47131
- for (const line of lines2) {
47619
+ for (const line of lines) {
47132
47620
  const norm = normalizeLine(line);
47133
47621
  if (norm === prevNorm && norm.trim().length > 0) {
47134
47622
  repeatCount++;
@@ -47152,14 +47640,14 @@ function compressShellOutputFull(raw, options) {
47152
47640
  const minReduction = options?.minReductionPercent ?? DEFAULT_MIN_REDUCTION;
47153
47641
  const maxStackFrames = options?.maxStackFrames ?? DEFAULT_MAX_STACK_FRAMES;
47154
47642
  const maxPassLines = options?.maxPassLines ?? DEFAULT_MAX_PASS_LINES;
47155
- const lines2 = raw.split("\n");
47156
- if (lines2.length < minLines) {
47643
+ const lines = raw.split("\n");
47644
+ if (lines.length < minLines) {
47157
47645
  return { text: raw, original: null };
47158
47646
  }
47159
47647
  const pass1 = [];
47160
47648
  let stackCount = 0;
47161
47649
  let passCount = 0;
47162
- for (const line of lines2) {
47650
+ for (const line of lines) {
47163
47651
  if (NOISE_RE.test(line)) {
47164
47652
  continue;
47165
47653
  }
@@ -53614,7 +54102,7 @@ function createMemoryRecallStep(options) {
53614
54102
  const terms2 = [
53615
54103
  .../* @__PURE__ */ new Set([
53616
54104
  ...anchors,
53617
- ...tokenize(options.identifierGrounding === true ? query2.slice(-4e3).normalize("NFKC") : query2.slice(-4e3))
54105
+ ...tokenize2(options.identifierGrounding === true ? query2.slice(-4e3).normalize("NFKC") : query2.slice(-4e3))
53618
54106
  ])
53619
54107
  ].filter((term) => term.length > 1 && !GLUE.has(term)).slice(0, 32);
53620
54108
  if (terms2.length === 0 || charBudget <= HEADER.length)
@@ -55587,13 +56075,13 @@ function parseValue(raw, file, line) {
55587
56075
  __name(parseValue, "parseValue");
55588
56076
  function parseMemoryFile(raw, file) {
55589
56077
  const text9 = raw.startsWith("\uFEFF") ? raw.slice(1) : raw;
55590
- const lines2 = text9.split("\n");
55591
- if (!FENCE.test((lines2[0] ?? "").replace(/\r$/, ""))) {
56078
+ const lines = text9.split("\n");
56079
+ if (!FENCE.test((lines[0] ?? "").replace(/\r$/, ""))) {
55592
56080
  throw new MemoryFileFormatError(file, "a memory file must start with a --- frontmatter fence", 1);
55593
56081
  }
55594
56082
  let closing = -1;
55595
- for (let i = 1; i < lines2.length; i++) {
55596
- if (FENCE.test((lines2[i] ?? "").replace(/\r$/, ""))) {
56083
+ for (let i = 1; i < lines.length; i++) {
56084
+ if (FENCE.test((lines[i] ?? "").replace(/\r$/, ""))) {
55597
56085
  closing = i;
55598
56086
  break;
55599
56087
  }
@@ -55611,7 +56099,7 @@ function parseMemoryFile(raw, file) {
55611
56099
  }, "closeList");
55612
56100
  for (let i = 1; i < closing; i++) {
55613
56101
  const lineNumber = i + 1;
55614
- const line = (lines2[i] ?? "").replace(/\r$/, "");
56102
+ const line = (lines[i] ?? "").replace(/\r$/, "");
55615
56103
  if (!line.trim() || line.trimStart().startsWith("#"))
55616
56104
  continue;
55617
56105
  const item = ITEM_LINE.exec(line);
@@ -55645,7 +56133,7 @@ function parseMemoryFile(raw, file) {
55645
56133
  values.set(typedKey, parseValue(rawValue, file, lineNumber));
55646
56134
  }
55647
56135
  closeList();
55648
- let body = lines2.slice(closing + 1).join("\n");
56136
+ let body = lines.slice(closing + 1).join("\n");
55649
56137
  body = body.replace(/^\r?\n/, "").replace(/\r?\n$/, "");
55650
56138
  return { values, body };
55651
56139
  }
@@ -55663,9 +56151,9 @@ function formatValue(value) {
55663
56151
  }
55664
56152
  __name(formatValue, "formatValue");
55665
56153
  function formatMemoryFile(fields2, body) {
55666
- const lines2 = ["---"];
56154
+ const lines = ["---"];
55667
56155
  const put = /* @__PURE__ */ __name((key5, value) => {
55668
- lines2.push(`${key5}: ${formatValue(value)}`);
56156
+ lines.push(`${key5}: ${formatValue(value)}`);
55669
56157
  }, "put");
55670
56158
  put("name", fields2.name);
55671
56159
  put("description", fields2.description);
@@ -55674,7 +56162,7 @@ function formatMemoryFile(fields2, body) {
55674
56162
  put("createdAt", new Date(fields2.createdAt).toISOString());
55675
56163
  put("updatedAt", new Date(fields2.updatedAt).toISOString());
55676
56164
  if (fields2.tags.length > 0)
55677
- lines2.push(`tags: ${JSON.stringify(fields2.tags)}`);
56165
+ lines.push(`tags: ${JSON.stringify(fields2.tags)}`);
55678
56166
  put("id", fields2.id);
55679
56167
  if (fields2.title !== fields2.name)
55680
56168
  put("title", fields2.title);
@@ -55683,9 +56171,9 @@ function formatMemoryFile(fields2, body) {
55683
56171
  if (fields2.format !== "markdown")
55684
56172
  put("format", fields2.format);
55685
56173
  if (fields2.metadata !== void 0)
55686
- lines2.push(`metadata: ${JSON.stringify(fields2.metadata)}`);
55687
- lines2.push("---", "", body);
55688
- return `${lines2.join("\n")}${body.endsWith("\r") ? "\r\n" : "\n"}`;
56174
+ lines.push(`metadata: ${JSON.stringify(fields2.metadata)}`);
56175
+ lines.push("---", "", body);
56176
+ return `${lines.join("\n")}${body.endsWith("\r") ? "\r\n" : "\n"}`;
55689
56177
  }
55690
56178
  __name(formatMemoryFile, "formatMemoryFile");
55691
56179
 
@@ -60055,9 +60543,9 @@ var StdioTransport = class {
60055
60543
  return this.connected;
60056
60544
  }
60057
60545
  processBuffer() {
60058
- const lines2 = this.buffer.split("\n");
60059
- this.buffer = lines2.pop() ?? "";
60060
- for (const line of lines2) {
60546
+ const lines = this.buffer.split("\n");
60547
+ this.buffer = lines.pop() ?? "";
60548
+ for (const line of lines) {
60061
60549
  const trimmed = line.trim();
60062
60550
  if (!trimmed)
60063
60551
  continue;
@@ -60806,11 +61294,11 @@ function parseSseMessages(raw) {
60806
61294
  const messages = [];
60807
61295
  let lastEventId;
60808
61296
  for (const event of events) {
60809
- const lines2 = event.split("\n");
60810
- const idLines = lines2.filter((line) => line.startsWith("id:")).map((line) => line.slice("id:".length).trim());
61297
+ const lines = event.split("\n");
61298
+ const idLines = lines.filter((line) => line.startsWith("id:")).map((line) => line.slice("id:".length).trim());
60811
61299
  if (idLines.length > 0)
60812
61300
  lastEventId = idLines.at(-1);
60813
- const dataLines = lines2.filter((line) => line.startsWith("data:")).map((line) => line.slice("data:".length).trimStart());
61301
+ const dataLines = lines.filter((line) => line.startsWith("data:")).map((line) => line.slice("data:".length).trimStart());
60814
61302
  if (dataLines.length === 0)
60815
61303
  continue;
60816
61304
  const data = dataLines.join("\n").trim();
@@ -61253,7 +61741,7 @@ async function resolveMcpEra(input) {
61253
61741
  __name(resolveMcpEra, "resolveMcpEra");
61254
61742
 
61255
61743
  // ../sdk/dist/version.js
61256
- var VERSION2 = "52.6.0";
61744
+ var VERSION2 = "52.7.0";
61257
61745
 
61258
61746
  // ../sdk/dist/connector/mcp/client.js
61259
61747
  var MAX_LIST_PAGES = 100;
@@ -62843,18 +63331,18 @@ var MCPToolDiscovery = class {
62843
63331
 
62844
63332
  // ../sdk/dist/connector/mcp/prompt-adapter.js
62845
63333
  function renderPromptMessages(serverName, promptName, messages, description) {
62846
- const lines2 = [];
63334
+ const lines = [];
62847
63335
  if (description)
62848
- lines2.push(description, "");
63336
+ lines.push(description, "");
62849
63337
  for (const message of messages) {
62850
63338
  const body = message.content.type === "text" ? message.content.text : message.content.type === "resource" ? message.content.resource.text ?? `[resource ${message.content.resource.uri}]` : `[${message.content.type}]`;
62851
- lines2.push(`[${message.role}] ${body}`, "");
63339
+ lines.push(`[${message.role}] ${body}`, "");
62852
63340
  }
62853
63341
  return wrapUntrusted({
62854
63342
  kind: "mcp-prompt",
62855
63343
  attributes: { server: serverName, name: promptName },
62856
63344
  provenance: "This is content the named server composed, not this agent."
62857
- }, lines2.join("\n").trimEnd());
63345
+ }, lines.join("\n").trimEnd());
62858
63346
  }
62859
63347
  __name(renderPromptMessages, "renderPromptMessages");
62860
63348
  function argumentSchema(prompt) {
@@ -64138,7 +64626,7 @@ function derivedUncertainty(report) {
64138
64626
  }
64139
64627
  __name(derivedUncertainty, "derivedUncertainty");
64140
64628
  function formatReport(report) {
64141
- const lines2 = [
64629
+ const lines = [
64142
64630
  `${report.name}: ${report.passed}/${report.cases.length} passed (mean ${report.mean.toFixed(2)}) in ${report.durationMs}ms`,
64143
64631
  // On its own line and always printed, including when the interval is
64144
64632
  // undefined. A mean printed alone is the thing that has been
@@ -64150,41 +64638,41 @@ function formatReport(report) {
64150
64638
  ""
64151
64639
  ];
64152
64640
  if (report.inconclusive > 0) {
64153
- lines2.push(` ${report.inconclusive} case${report.inconclusive === 1 ? "" : "s"} could not be judged \u2014 the numbers below cover the rest`, "");
64641
+ lines.push(` ${report.inconclusive} case${report.inconclusive === 1 ? "" : "s"} could not be judged \u2014 the numbers below cover the rest`, "");
64154
64642
  }
64155
64643
  for (const [name2, mean] of Object.entries(report.byScorer)) {
64156
- lines2.push(` ${name2}: ${mean.toFixed(2)}`);
64644
+ lines.push(` ${name2}: ${mean.toFixed(2)}`);
64157
64645
  }
64158
64646
  const failures = report.cases.filter((c) => c.status === "failed");
64159
64647
  if (failures.length > 0) {
64160
- lines2.push("", "Failures:");
64648
+ lines.push("", "Failures:");
64161
64649
  for (const failure2 of failures) {
64162
- lines2.push(` \u2717 ${failure2.case} (${failure2.mean.toFixed(2)})`);
64650
+ lines.push(` \u2717 ${failure2.case} (${failure2.mean.toFixed(2)})`);
64163
64651
  if (failure2.failedGates && failure2.failedGates.length > 0) {
64164
- lines2.push(` gate missed: ${failure2.failedGates.join(", ")}`);
64652
+ lines.push(` gate missed: ${failure2.failedGates.join(", ")}`);
64165
64653
  }
64166
64654
  for (const [name2, score] of Object.entries(failure2.scores)) {
64167
64655
  if (score.unavailable === true) {
64168
- lines2.push(` ${name2}: not judged \u2014 ${score.reason}`);
64656
+ lines.push(` ${name2}: not judged \u2014 ${score.reason}`);
64169
64657
  } else if (score.score < 1) {
64170
- lines2.push(` ${name2}: ${score.reason}`);
64658
+ lines.push(` ${name2}: ${score.reason}`);
64171
64659
  }
64172
64660
  }
64173
64661
  if (failure2.turn.error)
64174
- lines2.push(` error: ${failure2.turn.error}`);
64662
+ lines.push(` error: ${failure2.turn.error}`);
64175
64663
  }
64176
64664
  }
64177
64665
  const unjudged = report.cases.filter((c) => c.status === "inconclusive");
64178
64666
  if (unjudged.length > 0) {
64179
- lines2.push("", "Not judged:");
64667
+ lines.push("", "Not judged:");
64180
64668
  for (const item of unjudged) {
64181
- lines2.push(` ? ${item.case}`);
64669
+ lines.push(` ? ${item.case}`);
64182
64670
  for (const [name2, score] of Object.entries(item.scores)) {
64183
- lines2.push(` ${name2}: ${score.reason}`);
64671
+ lines.push(` ${name2}: ${score.reason}`);
64184
64672
  }
64185
64673
  }
64186
64674
  }
64187
- return lines2.join("\n");
64675
+ return lines.join("\n");
64188
64676
  }
64189
64677
  __name(formatReport, "formatReport");
64190
64678
 
@@ -68979,8 +69467,8 @@ var WorkerCodeRuntime = class {
68979
69467
  calls
68980
69468
  };
68981
69469
  }
68982
- const appendOutput = /* @__PURE__ */ __name((lines2) => {
68983
- for (const line of lines2) {
69470
+ const appendOutput = /* @__PURE__ */ __name((lines) => {
69471
+ for (const line of lines) {
68984
69472
  if (truncated)
68985
69473
  return;
68986
69474
  const next = printCount === 0 ? line : `${output}
@@ -69688,7 +70176,12 @@ var PRELUDE_SOURCE = String.raw`(function (config) {
69688
70176
  throw new TypeError('parallel(thunks): item ' + (p + 1) + ' must be a function (wrap the work as () => agent(...)), got ' + kind(thunks[p]));
69689
70177
  }
69690
70178
  }
69691
- return Promise.all(thunks.map(function (t) { return t(); }));
70179
+ return Promise.all(thunks.map(function (t, n) {
70180
+ return Promise.resolve().then(t).catch(function (e) {
70181
+ log('parallel item ' + (n + 1) + ' failed: ' + clean(e && e.message ? e.message : e, 300));
70182
+ return null;
70183
+ });
70184
+ }));
69692
70185
  }
69693
70186
  async function pipeline(items) {
69694
70187
  if (!Array.isArray(items)) {
@@ -69703,7 +70196,12 @@ var PRELUDE_SOURCE = String.raw`(function (config) {
69703
70196
  return Promise.all(items.map(async function (item, index) {
69704
70197
  var value = item;
69705
70198
  for (var i = 0; i < stages.length; i++) {
69706
- value = await stages[i](value, index, item);
70199
+ try {
70200
+ value = await stages[i](value, index, item);
70201
+ } catch (e) {
70202
+ log('pipeline item ' + (index + 1) + ' stopped at stage ' + (i + 1) + ': ' + clean(e && e.message ? e.message : e, 300));
70203
+ return null;
70204
+ }
69707
70205
  if (value === null || value === undefined) return null;
69708
70206
  }
69709
70207
  return value;
@@ -78122,11 +78620,11 @@ __name(isStrictDescendant, "isStrictDescendant");
78122
78620
  function parseWorktreeList(stdout, worktreePath) {
78123
78621
  const blocks = stdout.split(/\n\n+/);
78124
78622
  for (const block of blocks) {
78125
- const lines2 = block.split("\n").filter((l) => l.length > 0);
78623
+ const lines = block.split("\n").filter((l) => l.length > 0);
78126
78624
  let path2;
78127
78625
  let head2;
78128
78626
  let branch;
78129
- for (const line of lines2) {
78627
+ for (const line of lines) {
78130
78628
  if (line.startsWith("worktree "))
78131
78629
  path2 = line.slice("worktree ".length);
78132
78630
  else if (line.startsWith("HEAD "))
@@ -86270,17 +86768,17 @@ var CodeAnalysisTool = defineTool({
86270
86768
  });
86271
86769
  return render3(result, (value) => {
86272
86770
  const f = value.files;
86273
- const lines2 = [
86771
+ const lines = [
86274
86772
  `Indexed ${value.root}: ${f.indexed} files (${f.parsed} parsed, ${f.unchanged} unchanged, ${f.removed} removed, ${f.skipped} skipped, ${f.withParseErrors} with parse errors) in ${value.durationMs} ms.`,
86275
86773
  `${value.functions} functions, ${value.strings} string literals, ${value.calls} calls. ${value.persisted ? "Cached on disk." : "Held in memory only; it is gone when this process exits."}`
86276
86774
  ];
86277
86775
  if (value.truncated)
86278
- lines2.push(value.truncated);
86776
+ lines.push(value.truncated);
86279
86777
  const reasons = Object.entries(value.skippedReasons);
86280
86778
  if (reasons.length > 0) {
86281
- lines2.push(`Skipped: ${reasons.map(([why, n]) => `${n} ${why}`).join(", ")}.`);
86779
+ lines.push(`Skipped: ${reasons.map(([why, n]) => `${n} ${why}`).join(", ")}.`);
86282
86780
  }
86283
- return lines2;
86781
+ return lines;
86284
86782
  });
86285
86783
  }
86286
86784
  case "find_literal": {
@@ -86315,13 +86813,13 @@ var CodeAnalysisTool = defineTool({
86315
86813
  value.inClass !== void 0 ? `${place} is in the body of class ${value.inClass}, outside every method; not inside any function.` : `${place} is not inside any function.`
86316
86814
  ];
86317
86815
  }
86318
- const lines2 = [describeFunction(value.function, root)];
86816
+ const lines = [describeFunction(value.function, root)];
86319
86817
  if (value.parents.length > 0) {
86320
- lines2.push(`parents: ${value.parents.map(shortFunction).join(" < ")}`);
86818
+ lines.push(`parents: ${value.parents.map(shortFunction).join(" < ")}`);
86321
86819
  }
86322
86820
  if (value.source)
86323
- lines2.push(...sourceLines(value.source));
86324
- return lines2;
86821
+ lines.push(...sourceLines(value.source));
86822
+ return lines;
86325
86823
  });
86326
86824
  }
86327
86825
  case "function_source": {
@@ -86445,8 +86943,8 @@ function relativeTo(root, path2) {
86445
86943
  }
86446
86944
  __name(relativeTo, "relativeTo");
86447
86945
  function shortFunction(fn) {
86448
- const lines2 = fn.endLine === fn.line ? `L${fn.line}` : `L${fn.line}-${fn.endLine}`;
86449
- return `${fn.qualifiedName ?? fn.name ?? "(anonymous)"}#${fn.id} ${lines2}`;
86946
+ const lines = fn.endLine === fn.line ? `L${fn.line}` : `L${fn.line}-${fn.endLine}`;
86947
+ return `${fn.qualifiedName ?? fn.name ?? "(anonymous)"}#${fn.id} ${lines}`;
86450
86948
  }
86451
86949
  __name(shortFunction, "shortFunction");
86452
86950
  function describeFunction(fn, root) {
@@ -86464,21 +86962,21 @@ function describeEdge(edge) {
86464
86962
  }
86465
86963
  __name(describeEdge, "describeEdge");
86466
86964
  function sourceLines(slice) {
86467
- const lines2 = ["--- source ---", slice.text];
86965
+ const lines = ["--- source ---", slice.text];
86468
86966
  if (slice.truncated) {
86469
- lines2.push(slice.window ? `--- cut: showing ${slice.text.length} of ${slice.chars} characters, the function's first ${slice.window.headerChars} and the part around the position; raise max_chars to see more ---` : `--- cut: showing ${slice.text.length} of ${slice.chars} characters; raise max_chars to see more ---`);
86967
+ lines.push(slice.window ? `--- cut: showing ${slice.text.length} of ${slice.chars} characters, the function's first ${slice.window.headerChars} and the part around the position; raise max_chars to see more ---` : `--- cut: showing ${slice.text.length} of ${slice.chars} characters; raise max_chars to see more ---`);
86470
86968
  }
86471
- return lines2;
86969
+ return lines;
86472
86970
  }
86473
86971
  __name(sourceLines, "sourceLines");
86474
86972
  function evidenceLines(evidence) {
86475
- const lines2 = [];
86973
+ const lines = [];
86476
86974
  if (evidence.observed.length > 0)
86477
- lines2.push(`observed: ${evidence.observed.join("; ")}`);
86975
+ lines.push(`observed: ${evidence.observed.join("; ")}`);
86478
86976
  if (evidence.inferred.length > 0)
86479
- lines2.push(`inferred: ${evidence.inferred.join("; ")}`);
86480
- lines2.push(evidence.coverage.status === "complete" ? "coverage: complete" : `coverage: partial - ${evidence.coverage.reasons.join("; ")}`);
86481
- return lines2;
86977
+ lines.push(`inferred: ${evidence.inferred.join("; ")}`);
86978
+ lines.push(evidence.coverage.status === "complete" ? "coverage: complete" : `coverage: partial - ${evidence.coverage.reasons.join("; ")}`);
86979
+ return lines;
86482
86980
  }
86483
86981
  __name(evidenceLines, "evidenceLines");
86484
86982
  function render3(result, body, data) {
@@ -86504,18 +87002,18 @@ function renderPage(result, line, fileOf) {
86504
87002
  if (page.items.length === 0) {
86505
87003
  return [page.total === 0 ? "No results." : "No results on this page."];
86506
87004
  }
86507
- const lines2 = [];
87005
+ const lines = [];
86508
87006
  let current;
86509
87007
  for (const item of page.items) {
86510
87008
  const file = fileOf?.(item);
86511
87009
  if (file !== void 0 && file !== current) {
86512
- lines2.push(file);
87010
+ lines.push(file);
86513
87011
  current = file;
86514
87012
  }
86515
- lines2.push(file === void 0 ? line(item) : ` ${line(item)}`);
87013
+ lines.push(file === void 0 ? line(item) : ` ${line(item)}`);
86516
87014
  }
86517
- lines2.push(page.nextCursor !== void 0 ? `-- ${page.items.length} of ${page.total} shown. next cursor: ${page.nextCursor}` : `-- ${page.items.length} of ${page.total} shown. last page.`);
86518
- return lines2;
87015
+ lines.push(page.nextCursor !== void 0 ? `-- ${page.items.length} of ${page.total} shown. next cursor: ${page.nextCursor}` : `-- ${page.items.length} of ${page.total} shown. last page.`);
87016
+ return lines;
86519
87017
  }, (page) => ({
86520
87018
  total: page.total,
86521
87019
  count: page.items.length,
@@ -87082,15 +87580,15 @@ function grantNotice(allowed, grant, canGrant) {
87082
87580
 
87083
87581
  [This skill lists allowed-tools (${allowed.join(", ")}), but this host applies no pre-approval, so those calls are reviewed as usual. ${unchanged}]`;
87084
87582
  }
87085
- const lines2 = [];
87086
- lines2.push(grant.granted.length > 0 ? `Pre-approved for the rest of this turn: ${grant.granted.join(", ")}. Deny and ask rules, plan and strict mode, and review of destructive calls still apply.` : "Nothing in allowed-tools could be pre-approved.");
87583
+ const lines = [];
87584
+ lines.push(grant.granted.length > 0 ? `Pre-approved for the rest of this turn: ${grant.granted.join(", ")}. Deny and ask rules, plan and strict mode, and review of destructive calls still apply.` : "Nothing in allowed-tools could be pre-approved.");
87087
87585
  for (const { entry, reason: reason2 } of grant.ignored) {
87088
- lines2.push(`Ignored allowed-tools entry "${entry}": ${reason2}.`);
87586
+ lines.push(`Ignored allowed-tools entry "${entry}": ${reason2}.`);
87089
87587
  }
87090
- lines2.push(unchanged);
87588
+ lines.push(unchanged);
87091
87589
  return `
87092
87590
 
87093
- [${lines2.join(" ")}]`;
87591
+ [${lines.join(" ")}]`;
87094
87592
  }
87095
87593
  __name(grantNotice, "grantNotice");
87096
87594
 
@@ -88380,38 +88878,38 @@ function buildDescription(host, caps, settings) {
88380
88878
  const available = availableActions(host, caps);
88381
88879
  const unavailable3 = unavailableHostActions(host, caps);
88382
88880
  const intro = hostActionAvailable(caps, "screenshot") ? `Controls the user's desktop on a ${caps.displayServer} host: screenshots, mouse and keyboard, for GUI tasks.` : windowCaptureAvailable(host, caps) ? `Controls named windows on a ${caps.displayServer} host: window screenshots, mouse and keyboard, for GUI tasks.` : available.length > 0 ? `Offers the available computer controls on a ${caps.displayServer} host.` : `Computer control is unavailable on this ${caps.displayServer} host; this tool reports the limitation.`;
88383
- const lines2 = [intro, `Available actions: ${available.join("; ") || "none"}.`];
88881
+ const lines = [intro, `Available actions: ${available.join("; ") || "none"}.`];
88384
88882
  if (unavailable3.length > 0) {
88385
- lines2.push(caps.unavailableReason ? `Unavailable on this host: ${unavailable3.join(", ")} \u2014 ${caps.unavailableReason} Do not retry; tell the user.` : `Unavailable on this host: ${unavailable3.join(", ")}.`);
88883
+ lines.push(caps.unavailableReason ? `Unavailable on this host: ${unavailable3.join(", ")} \u2014 ${caps.unavailableReason} Do not retry; tell the user.` : `Unavailable on this host: ${unavailable3.join(", ")}.`);
88386
88884
  }
88387
88885
  if (!available.includes("screenshot"))
88388
- return finish(lines2, caps, available);
88389
- lines2.push('Coordinates: every x/y you send is a pixel of the most recent screenshot this tool returned \u2014 origin at its top-left, x to the right, y down \u2014 never a screen pixel. Each screenshot states its id and size (for example "s3: 1456x819"); stay inside it. Display screenshots map onto the display. To aim at an earlier display screenshot, pass its id as screenshot_id.', "Take a screenshot before your first click.");
88886
+ return finish(lines, caps, available);
88887
+ lines.push('Coordinates: every x/y you send is a pixel of the most recent screenshot this tool returned \u2014 origin at its top-left, x to the right, y down \u2014 never a screen pixel. Each screenshot states its id and size (for example "s3: 1456x819"); stay inside it. Display screenshots map onto the display. To aim at an earlier display screenshot, pass its id as screenshot_id.', "Take a screenshot before your first click.");
88390
88888
  if (settings.screenshotAfterActions)
88391
- lines2.push(`After any action that changes something, the tool waits ${settings.settleMs} ms and returns a new screenshot \u2014 do not call screenshot again after acting.`);
88392
- lines2.push("zoom returns a closer, sharper view of region {x, y, width, height} of the screenshot; your coordinates still refer to the screenshot, not to the zoomed image.", `wait pauses for ms milliseconds (at most ${settings.maxWaitMs} per call, a batch's waits together) and then shows the screen.`);
88889
+ lines.push(`After any action that changes something, the tool waits ${settings.settleMs} ms and returns a new screenshot \u2014 do not call screenshot again after acting.`);
88890
+ lines.push("zoom returns a closer, sharper view of region {x, y, width, height} of the screenshot; your coordinates still refer to the screenshot, not to the zoomed image.", `wait pauses for ms milliseconds (at most ${settings.maxWaitMs} per call, a batch's waits together) and then shows the screen.`);
88393
88891
  if (available.includes("batch"))
88394
- lines2.push(`batch: {"type":"batch","actions":[...]} runs up to ${settings.maxBatchActions} actions in order, stops at the first one that fails, and returns one screenshot at the end. Every call costs a model round trip of several seconds, so put the steps you can already predict into one batch (click a field, type, press ENTER) rather than one call each \u2014 but end the batch at any step that should bring up a new window, and look before typing into it. A batch cannot contain screenshot${available.includes("ui_snapshot") ? ", zoom or ui_snapshot" : " or zoom"}.`);
88892
+ lines.push(`batch: {"type":"batch","actions":[...]} runs up to ${settings.maxBatchActions} actions in order, stops at the first one that fails, and returns one screenshot at the end. Every call costs a model round trip of several seconds, so put the steps you can already predict into one batch (click a field, type, press ENTER) rather than one call each \u2014 but end the batch at any step that should bring up a new window, and look before typing into it. A batch cannot contain screenshot${available.includes("ui_snapshot") ? ", zoom or ui_snapshot" : " or zoom"}.`);
88395
88893
  if (caps.displayServer === "win32" && available.includes("key") && available.includes("type_text"))
88396
- lines2.push("To start a Windows program, a shell command (Start-Process notepad, or cmd.exe /c start calc) is surest when you have a shell tool. The Start menu searches by display names in the system language, and ENTER on a name it does not find opens a web search in the browser.");
88894
+ lines.push("To start a Windows program, a shell command (Start-Process notepad, or cmd.exe /c start calc) is surest when you have a shell tool. The Start menu searches by display names in the system language, and ENTER on a name it does not find opens a web search in the browser.");
88397
88895
  if (available.includes("list_windows"))
88398
- lines2.push("list_windows names the open windows with their ids; focus_window brings one to the front.");
88896
+ lines.push("list_windows names the open windows with their ids; focus_window brings one to the front.");
88399
88897
  if (windowCaptureAvailable(host, caps))
88400
- lines2.push(`When the user names an application or window, ${available.includes("list_windows") ? "use list_windows then screenshot {window_id}" : "use screenshot {window_id} with a host-provided window id"} to capture pixels for that window. Its x/y are pixels of that window image; clicks, drags, typing and keys target that window. Window pointer input uses background delivery only; if a click or drag is refused, inspect a fresh image before any other action. ${caps.windowScroll === false ? `Window pixel scrolling is unavailable on this host; for a browser page use key PAGE_DOWN or ARROW_DOWN with delivery_mode:"foreground"${hostActionAvailable(caps, "screenshot") ? ", or deliberately take a display screenshot for display scrolling" : ""}. ` : ""}To type into a browser field, first mouse_click its point in the window image, then type_text with delivery_mode:"foreground" if background text is unavailable. This may briefly bring the verified window to the front. For browser shortcuts such as CTRL+L, use key with delivery_mode:"foreground". A stale or moved window is refused; take a fresh window screenshot. ${hostActionAvailable(caps, "screenshot") ? "Plain screenshot still shows the display. " : "screenshot requires window_id on this host. "}Browser permission bubbles outside the window may be absent. If the window image is blank or shows another window, do not click it; focus the target and capture it again.`);
88898
+ lines.push(`When the user names an application or window, ${available.includes("list_windows") ? "use list_windows then screenshot {window_id}" : "use screenshot {window_id} with a host-provided window id"} to capture pixels for that window. Its x/y are pixels of that window image; clicks, drags, typing and keys target that window. Window pointer input uses background delivery only; if a click or drag is refused, inspect a fresh image before any other action. ${caps.windowScroll === false ? `Window pixel scrolling is unavailable on this host; for a browser page use key PAGE_DOWN or ARROW_DOWN with delivery_mode:"foreground"${hostActionAvailable(caps, "screenshot") ? ", or deliberately take a display screenshot for display scrolling" : ""}. ` : ""}To type into a browser field, first mouse_click its point in the window image, then type_text with delivery_mode:"foreground" if background text is unavailable. This may briefly bring the verified window to the front. For browser shortcuts such as CTRL+L, use key with delivery_mode:"foreground". A stale or moved window is refused; take a fresh window screenshot. ${hostActionAvailable(caps, "screenshot") ? "Plain screenshot still shows the display. " : "screenshot requires window_id on this host. "}Browser permission bubbles outside the window may be absent. If the window image is blank or shows another window, do not click it; focus the target and capture it again.`);
88401
88899
  if (available.includes("ui_snapshot"))
88402
- lines2.push(`ui_snapshot {window_id} reads a window's controls (its accessibility tree) as text, each control you can act on with a ref such as e12; without window_id it reads the window in front. ui_act {ref, action, value} acts on one control: invoke (press a button, open a menu item), set_value (replace a field's text with value), toggle, select, expand, collapse. Prefer ui_act to clicking pixels when the control is in the tree: it does not depend on coordinates or on which window is in front, and a batch of ui_act steps (for example pressing several buttons) runs in one call. Refs are valid only until the next ui_snapshot; take a new one after the window changes.`);
88403
- lines2.push(windowCaptureAvailable(host, caps) ? "After a display screenshot, typing and keys go to whichever window has focus: confirm on that screenshot that the right window is in front before type_text or key. After a named-window screenshot, input targets the captured window." : "Typing and keys go to whichever window has focus: confirm on a screenshot that the right window is in front before type_text or key.");
88900
+ lines.push(`ui_snapshot {window_id} reads a window's controls (its accessibility tree) as text, each control you can act on with a ref such as e12; without window_id it reads the window in front. ui_act {ref, action, value} acts on one control: invoke (press a button, open a menu item), set_value (replace a field's text with value), toggle, select, expand, collapse. Prefer ui_act to clicking pixels when the control is in the tree: it does not depend on coordinates or on which window is in front, and a batch of ui_act steps (for example pressing several buttons) runs in one call. Refs are valid only until the next ui_snapshot; take a new one after the window changes.`);
88901
+ lines.push(windowCaptureAvailable(host, caps) ? "After a display screenshot, typing and keys go to whichever window has focus: confirm on that screenshot that the right window is in front before type_text or key. After a named-window screenshot, input targets the captured window." : "Typing and keys go to whichever window has focus: confirm on a screenshot that the right window is in front before type_text or key.");
88404
88902
  if (available.includes("list_windows"))
88405
- lines2.push("type_text and key are refused while a terminal window is in front \u2014 usually the one running this agent, or the user\u2019s own; bring the window you mean to the front first (focus_window, or click it).");
88406
- return finish(lines2, caps, available);
88903
+ lines.push("type_text and key are refused while a terminal window is in front \u2014 usually the one running this agent, or the user\u2019s own; bring the window you mean to the front first (focus_window, or click it).");
88904
+ return finish(lines, caps, available);
88407
88905
  }
88408
88906
  __name(buildDescription, "buildDescription");
88409
- function finish(lines2, caps, available) {
88907
+ function finish(lines, caps, available) {
88410
88908
  if (caps.mouseClickButtons && available.includes("mouse_click"))
88411
- lines2.push(`Click buttons: ${caps.mouseClickButtons.join(", ") || "none"}.`);
88909
+ lines.push(`Click buttons: ${caps.mouseClickButtons.join(", ") || "none"}.`);
88412
88910
  if (caps.mouseDragButtons && available.includes("mouse_drag"))
88413
- lines2.push(`Drag buttons: ${caps.mouseDragButtons.join(", ") || "none"}.`);
88414
- return lines2.join(" ");
88911
+ lines.push(`Drag buttons: ${caps.mouseDragButtons.join(", ") || "none"}.`);
88912
+ return lines.join(" ");
88415
88913
  }
88416
88914
  __name(finish, "finish");
88417
88915
  function pointModelSchema(description) {
@@ -88986,7 +89484,7 @@ function createComputerUseTool(host, options = {}) {
88986
89484
  const refs = /* @__PURE__ */ new Map();
88987
89485
  const latest = frames.latest();
88988
89486
  const frame = latest?.window ? void 0 : latest;
88989
- const lines2 = [];
89487
+ const lines = [];
88990
89488
  let chars = 0;
88991
89489
  let shown = 0;
88992
89490
  let total = 0;
@@ -89002,7 +89500,7 @@ function createComputerUseTool(host, options = {}) {
89002
89500
  if (chars + line.length + 1 > MAX_UI_SNAPSHOT_CHARS) {
89003
89501
  cut = true;
89004
89502
  } else {
89005
- lines2.push(line);
89503
+ lines.push(line);
89006
89504
  chars += line.length + 1;
89007
89505
  shown += 1;
89008
89506
  if (ref) {
@@ -89029,7 +89527,7 @@ function createComputerUseTool(host, options = {}) {
89029
89527
  ...snapshot.app !== void 0 ? [`Application ${quotedText(snapshot.app)}`] : [],
89030
89528
  ...snapshot.title !== void 0 && snapshot.title !== snapshot.root.name ? [`Window title ${quotedText(snapshot.title)}`] : []
89031
89529
  ];
89032
- const body = [...about, ...lines2].join("\n");
89530
+ const body = [...about, ...lines].join("\n");
89033
89531
  const footer = cut || snapshot.truncated ? [
89034
89532
  cut ? `The tree was cut at ${MAX_UI_SNAPSHOT_CHARS} characters after ${shown} of ${total} controls. Read a smaller window, or use a screenshot for the rest.` : "The host stopped reading the tree before it ended; controls further down are missing. Use a screenshot for the rest."
89035
89533
  ] : [];
@@ -89081,7 +89579,7 @@ function createComputerUseTool(host, options = {}) {
89081
89579
  return "no windows are open";
89082
89580
  const latest = frames.latest();
89083
89581
  const frame = latest?.window ? void 0 : latest;
89084
- const lines2 = windows.slice(0, MAX_LISTED_WINDOWS).map((window2) => {
89582
+ const lines = windows.slice(0, MAX_LISTED_WINDOWS).map((window2) => {
89085
89583
  const where = frame ? (() => {
89086
89584
  const rect = window2.minimized ? null : desktopRectOnImage(frame, window2.bounds);
89087
89585
  return rect ? `at ${pointLabel(rect)} ${rect.width}x${rect.height} in ${frame.id}` : window2.minimized ? "minimized" : `not on the display of ${frame.id}`;
@@ -89099,7 +89597,7 @@ function createComputerUseTool(host, options = {}) {
89099
89597
  ${wrapUntrusted({
89100
89598
  kind: "desktop-windows",
89101
89599
  provenance: "The open windows on the user's desktop, as the host listed them. Titles are whatever each application shows, which can include text anyone wrote."
89102
- }, [...lines2, ...more].join("\n"))}`;
89600
+ }, [...lines, ...more].join("\n"))}`;
89103
89601
  }, "listWindows");
89104
89602
  const describeFrame = /* @__PURE__ */ __name((frame) => {
89105
89603
  if (frame.window) {
@@ -89734,12 +90232,12 @@ var GrepTool = defineTool({
89734
90232
  unreadableFiles++;
89735
90233
  continue;
89736
90234
  }
89737
- const lines2 = content.split("\n");
90235
+ const lines = content.split("\n");
89738
90236
  let fileMatches = 0;
89739
90237
  const relPath = sandbox ? `./${relativePosix(sandbox.rootDir, filePath)}` : `./${relative9(context2.workingDirectory, join44(lexicalRoot, relative9(root, filePath))).split(sep13).join("/")}`;
89740
- for (let i = 0; i < lines2.length; i++) {
90238
+ for (let i = 0; i < lines.length; i++) {
89741
90239
  context2.abortSignal?.throwIfAborted();
89742
- const line = lines2[i] ?? "";
90240
+ const line = lines[i] ?? "";
89743
90241
  regex.lastIndex = 0;
89744
90242
  if (!regex.test(line))
89745
90243
  continue;
@@ -89753,13 +90251,13 @@ var GrepTool = defineTool({
89753
90251
  continue;
89754
90252
  if (input.context_lines > 0) {
89755
90253
  const start = Math.max(0, i - input.context_lines);
89756
- const end = Math.min(lines2.length - 1, i + input.context_lines);
90254
+ const end = Math.min(lines.length - 1, i + input.context_lines);
89757
90255
  if (results.length > 0) {
89758
90256
  results.push("--");
89759
90257
  }
89760
90258
  for (let j = start; j <= end; j++) {
89761
90259
  const prefix = j === i ? ":" : "-";
89762
- const text9 = lines2[j] ?? "";
90260
+ const text9 = lines[j] ?? "";
89763
90261
  results.push(`${relPath}${prefix}${j + 1}${prefix}${clipLine(text9, j === i ? "matching" : "context")}`);
89764
90262
  }
89765
90263
  } else {
@@ -90298,11 +90796,11 @@ var VerifyOutputsTool = defineTool({
90298
90796
  failed: failed.length,
90299
90797
  min_bytes: minBytes
90300
90798
  };
90301
- const lines2 = results.map((r) => r.ok ? `- OK ${r.path}${typeof r.size_bytes === "number" ? ` (${r.size_bytes}B)` : ""}` : `- FAIL ${r.path} \u2014 ${r.error ?? (r.exists ? `size ${r.size_bytes ?? 0}B < min ${minBytes}B` : "missing")}`);
90799
+ const lines = results.map((r) => r.ok ? `- OK ${r.path}${typeof r.size_bytes === "number" ? ` (${r.size_bytes}B)` : ""}` : `- FAIL ${r.path} \u2014 ${r.error ?? (r.exists ? `size ${r.size_bytes ?? 0}B < min ${minBytes}B` : "missing")}`);
90302
90800
  const header = `Verify outputs: ${passed}/${results.length} passed (min ${minBytes}B)`;
90303
90801
  return {
90304
90802
  success: failed.length === 0,
90305
- output: [header, "", ...lines2].join("\n"),
90803
+ output: [header, "", ...lines].join("\n"),
90306
90804
  error: failed.length > 0 ? `${failed.length} of ${results.length} expected outputs failed verification` : void 0,
90307
90805
  data: { results, summary: summary2 }
90308
90806
  };
@@ -91014,13 +91512,13 @@ function renderSnapshot(snapshot, maxChars2) {
91014
91512
  text9 = text9.slice(0, maxChars2);
91015
91513
  cut = true;
91016
91514
  }
91017
- const lines2 = [formatBrowserPageHeader(snapshot.page), wrapPageText(snapshot.page, text9)];
91515
+ const lines = [formatBrowserPageHeader(snapshot.page), wrapPageText(snapshot.page, text9)];
91018
91516
  if (snapshot.nextCursor !== void 0) {
91019
- lines2.push(`More of this page follows: call browser with action "snapshot" and cursor ${JSON.stringify(snapshot.nextCursor)}.`);
91517
+ lines.push(`More of this page follows: call browser with action "snapshot" and cursor ${JSON.stringify(snapshot.nextCursor)}.`);
91020
91518
  } else if (cut) {
91021
- lines2.push(`The snapshot was cut at ${maxChars2} characters. Take a snapshot of one region with ref to see the rest.`);
91519
+ lines.push(`The snapshot was cut at ${maxChars2} characters. Take a snapshot of one region with ref to see the rest.`);
91022
91520
  }
91023
- return lines2.join("\n");
91521
+ return lines.join("\n");
91024
91522
  }
91025
91523
  __name(renderSnapshot, "renderSnapshot");
91026
91524
  function hostMessage(message) {
@@ -91628,13 +92126,13 @@ function defineSearchMemoryTool(search) {
91628
92126
  };
91629
92127
  }
91630
92128
  const now = Date.now();
91631
- const lines2 = result.entries.map((e, i) => {
92129
+ const lines = result.entries.map((e, i) => {
91632
92130
  const kind = [e.name, e.type, describeMemoryAge(e.updatedAt, now)].filter(Boolean).join(", ");
91633
92131
  return `${i + 1}. [${e.id}] ${e.title} (${kind}) \u2014 ${e.description ?? e.summary}${e.tags.length > 0 ? ` [${e.tags.join(", ")}]` : ""}`;
91634
92132
  });
91635
92133
  const output = result.totalCount > result.entries.length ? `Found ${result.totalCount} memories${page} (showing ${result.entries.length}):
91636
- ${lines2.join("\n")}${continuation}` : `Found ${result.totalCount} memories${page}:
91637
- ${lines2.join("\n")}${continuation}`;
92134
+ ${lines.join("\n")}${continuation}` : `Found ${result.totalCount} memories${page}:
92135
+ ${lines.join("\n")}${continuation}`;
91638
92136
  return {
91639
92137
  success: true,
91640
92138
  output,
@@ -92058,8 +92556,8 @@ async function list(host, input) {
92058
92556
  }
92059
92557
  if (jobs.length === 0)
92060
92558
  return { success: true, output: "No scheduled jobs.", data: { jobs: [] } };
92061
- const lines2 = jobs.map((j) => `${j.name} \xB7 ${j.state} \xB7 ${j.schedule}${j.nextFireAt ? ` \xB7 next ${j.nextFireAt}` : ""}${j.lastStatus ? ` \xB7 last ${j.lastStatus}` : ""} \xB7 ${j.folder}${j.inSessionFolder ? " (this folder)" : ""}`);
92062
- return { success: true, output: lines2.join("\n"), data: { jobs } };
92559
+ const lines = jobs.map((j) => `${j.name} \xB7 ${j.state} \xB7 ${j.schedule}${j.nextFireAt ? ` \xB7 next ${j.nextFireAt}` : ""}${j.lastStatus ? ` \xB7 last ${j.lastStatus}` : ""} \xB7 ${j.folder}${j.inSessionFolder ? " (this folder)" : ""}`);
92560
+ return { success: true, output: lines.join("\n"), data: { jobs } };
92063
92561
  }
92064
92562
  __name(list, "list");
92065
92563
  var CHANGEABLE = [
@@ -92391,6 +92889,37 @@ function pick2(entries2) {
92391
92889
  return out;
92392
92890
  }
92393
92891
  __name(pick2, "pick");
92892
+ var MAX_HUNKS = 100;
92893
+ var MAX_HUNK_ROWS = 400;
92894
+ var MAX_ROW_CHARS = 600;
92895
+ function hunks(value) {
92896
+ if (!Array.isArray(value) || value.length > MAX_HUNKS)
92897
+ return void 0;
92898
+ const out = [];
92899
+ let rows = 0;
92900
+ for (const entry of value) {
92901
+ if (!isRecord4(entry) || !Array.isArray(entry.lines))
92902
+ return void 0;
92903
+ const oldStart = count6(entry.oldStart);
92904
+ const oldLines = count6(entry.oldLines);
92905
+ const newStart = count6(entry.newStart);
92906
+ const newLines = count6(entry.newLines);
92907
+ if (oldStart === void 0 || oldLines === void 0 || newStart === void 0 || newLines === void 0)
92908
+ return void 0;
92909
+ rows += entry.lines.length;
92910
+ if (rows > MAX_HUNK_ROWS)
92911
+ return void 0;
92912
+ const lines = [];
92913
+ for (const row of entry.lines) {
92914
+ if (typeof row !== "string" || row.length > MAX_ROW_CHARS || !(row.startsWith(" ") || row.startsWith("+") || row.startsWith("-")))
92915
+ return void 0;
92916
+ lines.push(row);
92917
+ }
92918
+ out.push({ oldStart, oldLines, newStart, newLines, lines });
92919
+ }
92920
+ return out.length > 0 ? out : void 0;
92921
+ }
92922
+ __name(hunks, "hunks");
92394
92923
  function admitToolFacts(value) {
92395
92924
  if (!isRecord4(value))
92396
92925
  return void 0;
@@ -92449,7 +92978,11 @@ function admitToolFacts(value) {
92449
92978
  return pick2({
92450
92979
  kind: "edit",
92451
92980
  path: text8(value.path),
92452
- replacements: count6(value.replacements)
92981
+ replacements: count6(value.replacements),
92982
+ added: count6(value.added),
92983
+ removed: count6(value.removed),
92984
+ hunks: hunks(value.hunks),
92985
+ hunksTruncated: flag(value.hunksTruncated)
92453
92986
  });
92454
92987
  case "write": {
92455
92988
  const path2 = text8(value.path);
@@ -92462,7 +92995,9 @@ function admitToolFacts(value) {
92462
92995
  operation,
92463
92996
  bytes: count6(value.bytes),
92464
92997
  added: count6(value.added),
92465
- removed: count6(value.removed)
92998
+ removed: count6(value.removed),
92999
+ hunks: hunks(value.hunks),
93000
+ hunksTruncated: flag(value.hunksTruncated)
92466
93001
  });
92467
93002
  }
92468
93003
  case "failure": {
@@ -92902,4 +93437,4 @@ export {
92902
93437
  buildResidentToolEvidenceTools,
92903
93438
  createPalMessagingTools
92904
93439
  };
92905
- //# sourceMappingURL=chunk-XM3W7NMM.js.map
93440
+ //# sourceMappingURL=chunk-A64X23MU.js.map