@namzu/cli 39.2.1 → 40.0.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 (416) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/checkpoints/manifest.d.ts +7 -0
  4. package/dist/checkpoints/manifest.d.ts.map +1 -1
  5. package/dist/checkpoints/rewind-stats.d.ts +31 -0
  6. package/dist/checkpoints/rewind-stats.d.ts.map +1 -0
  7. package/dist/checkpoints/store.d.ts +24 -3
  8. package/dist/checkpoints/store.d.ts.map +1 -1
  9. package/dist/chunks/{acp-VDM66X7T.js → acp-E7XNZWFV.js} +40 -39
  10. package/dist/chunks/acp-E7XNZWFV.js.map +6 -0
  11. package/dist/chunks/{activity-command-23DPNYXT.js → activity-command-QANVT2PA.js} +13 -12
  12. package/dist/chunks/activity-command-QANVT2PA.js.map +6 -0
  13. package/dist/chunks/{add-Y2UMHBTC.js → add-VDRMBSNZ.js} +19 -17
  14. package/dist/chunks/add-VDRMBSNZ.js.map +6 -0
  15. package/dist/chunks/{agent-LCCOMK5H.js → agent-PPQJZWBO.js} +31 -30
  16. package/dist/chunks/agent-session-PISYPFO2.js +54 -0
  17. package/dist/chunks/{archive-YUZ62G7R.js → archive-SH4IG6KC.js} +11 -10
  18. package/dist/chunks/archive-SH4IG6KC.js.map +6 -0
  19. package/dist/chunks/{bin-main-LFPYUV3K.js → bin-main-D45Q7FMM.js} +5 -4
  20. package/dist/chunks/bin-main-D45Q7FMM.js.map +6 -0
  21. package/dist/chunks/{browser-X6UIDIQQ.js → browser-EUFWHKYD.js} +6 -6
  22. package/dist/chunks/{chat-EMEYQKRR.js → chat-QDWGHEEL.js} +14 -14
  23. package/dist/chunks/{chunk-E6LQB5Z7.js → chunk-2I3Z65TV.js} +13 -13
  24. package/dist/chunks/{chunk-W6JEZMOJ.js → chunk-4HUZHYCY.js} +4 -4
  25. package/dist/chunks/{chunk-XNQI4ZDH.js → chunk-53GEER6F.js} +3 -3
  26. package/dist/chunks/{chunk-HHOTJDZW.js → chunk-5HSG2XFD.js} +2 -2
  27. package/dist/chunks/{chunk-V6UEMLTT.js → chunk-6PAE7AWD.js} +2 -2
  28. package/dist/chunks/{chunk-HLIXL5RK.js → chunk-6UDJ3PVE.js} +7 -7
  29. package/dist/chunks/{chunk-M2PQMMDW.js → chunk-73G5WDGM.js} +3 -3
  30. package/dist/chunks/{chunk-MCXVRO4B.js → chunk-7M6IZGAK.js} +58 -12
  31. package/dist/chunks/chunk-7M6IZGAK.js.map +6 -0
  32. package/dist/chunks/{chunk-2PH7EQQP.js → chunk-AHPIP5IE.js} +2 -2
  33. package/dist/chunks/{chunk-LS7PT6RY.js → chunk-AQL5A442.js} +10 -4
  34. package/dist/chunks/{chunk-LS7PT6RY.js.map → chunk-AQL5A442.js.map} +1 -1
  35. package/dist/chunks/{chunk-N3JNFZOW.js → chunk-AUFSSABF.js} +3 -3
  36. package/dist/chunks/{chunk-BPDKRVGW.js → chunk-BJNHDKU6.js} +2 -2
  37. package/dist/chunks/{chunk-QENCNE7Q.js → chunk-BQ7PN64G.js} +10 -10
  38. package/dist/chunks/{chunk-QENCNE7Q.js.map → chunk-BQ7PN64G.js.map} +1 -1
  39. package/dist/chunks/{chunk-T64F5OER.js → chunk-BZ4U5L7N.js} +9 -9
  40. package/dist/chunks/{chunk-FXMJ5NVM.js → chunk-BZJNXGWW.js} +5 -5
  41. package/dist/chunks/{chunk-HBTPB6ON.js → chunk-C3APHRQB.js} +2 -2
  42. package/dist/chunks/{chunk-A34Y6ZPM.js → chunk-C3ZJQLUX.js} +2 -2
  43. package/dist/chunks/{chunk-B2GM4GON.js → chunk-C723P7SP.js} +6 -6
  44. package/dist/chunks/{chunk-OPIC6ZIL.js → chunk-D63T5UQN.js} +561 -32
  45. package/dist/chunks/chunk-D63T5UQN.js.map +6 -0
  46. package/dist/chunks/{chunk-5NVONQBW.js → chunk-DGV5W2BU.js} +3 -3
  47. package/dist/chunks/{chunk-AP4B5Z3D.js → chunk-DWSATEAY.js} +2 -2
  48. package/dist/chunks/{chunk-45GT626R.js → chunk-EKFNDKPO.js} +3 -3
  49. package/dist/chunks/{chunk-KONYGNG6.js → chunk-EUBCYTOK.js} +3 -152
  50. package/dist/chunks/chunk-EUBCYTOK.js.map +6 -0
  51. package/dist/chunks/{chunk-IVZB7YKX.js → chunk-FBY4LGL7.js} +3 -3
  52. package/dist/chunks/chunk-G6LK7V7F.js +440 -0
  53. package/dist/chunks/chunk-G6LK7V7F.js.map +6 -0
  54. package/dist/chunks/{chunk-HWM73622.js → chunk-GDVYFXOR.js} +12 -12
  55. package/dist/chunks/{chunk-WNVYEZUQ.js → chunk-GTWNJ7GL.js} +4 -4
  56. package/dist/chunks/{chunk-2L3JDLC5.js → chunk-HBDBVQ3R.js} +12 -12
  57. package/dist/chunks/{chunk-3MT5KLBF.js → chunk-HLYTSH5W.js} +2 -2
  58. package/dist/chunks/{chunk-A25FQQTW.js → chunk-HPLVGTBH.js} +2 -2
  59. package/dist/chunks/{chunk-EGP3MB37.js → chunk-I7LUF577.js} +11 -5
  60. package/dist/chunks/chunk-I7LUF577.js.map +6 -0
  61. package/dist/chunks/{chunk-B4DC7NC7.js → chunk-IAL3F2OI.js} +8 -8
  62. package/dist/chunks/{chunk-JEHKZEIB.js → chunk-ILTHOMHL.js} +4 -4
  63. package/dist/chunks/{chunk-EEDZOGV4.js → chunk-IYUW2RAA.js} +27 -2
  64. package/dist/chunks/chunk-IYUW2RAA.js.map +6 -0
  65. package/dist/chunks/{chunk-TACSPIUK.js → chunk-JAHVXTO4.js} +2 -2
  66. package/dist/chunks/{chunk-BZIUFNYR.js → chunk-KKYIGLKI.js} +4 -4
  67. package/dist/chunks/{chunk-7WUSJ454.js → chunk-KOYEUNX7.js} +4 -4
  68. package/dist/chunks/{chunk-OT5X76XI.js → chunk-KWRJTEV5.js} +3 -3
  69. package/dist/chunks/{chunk-XJT5DL3I.js → chunk-L2GX4GAQ.js} +2 -2
  70. package/dist/chunks/{chunk-M3TJHQF7.js → chunk-LFI6O7WL.js} +5 -5
  71. package/dist/chunks/{chunk-ISN4VZCX.js → chunk-LM3W6AEK.js} +2 -2
  72. package/dist/chunks/{chunk-IYPP6HSK.js → chunk-O2B3B2TM.js} +1 -6
  73. package/dist/chunks/chunk-O2B3B2TM.js.map +6 -0
  74. package/dist/chunks/{chunk-DNHHMNVG.js → chunk-O3L5C2WT.js} +2 -2
  75. package/dist/chunks/{chunk-EXVGLN6V.js → chunk-PXKXXNFU.js} +2 -2
  76. package/dist/chunks/{chunk-MIM4YRP2.js → chunk-QPEGCKRA.js} +2 -2
  77. package/dist/chunks/{chunk-OVG3QY7U.js → chunk-R7XQP4PZ.js} +3 -3
  78. package/dist/chunks/{chunk-ESMVELWA.js → chunk-RAS4ZA5C.js} +5 -5
  79. package/dist/chunks/chunk-RLMKDLGK.js +3604 -0
  80. package/dist/chunks/chunk-RLMKDLGK.js.map +6 -0
  81. package/dist/chunks/{chunk-PV4ZAFVQ.js → chunk-RVNLS4BN.js} +2 -2
  82. package/dist/chunks/{chunk-QR5YS5QW.js → chunk-RVSGU3JS.js} +2 -2
  83. package/dist/chunks/{chunk-JII5GOH2.js → chunk-SOE4Q55L.js} +2 -2
  84. package/dist/chunks/{chunk-7OXYUJSY.js → chunk-SUDXOGE6.js} +29 -29
  85. package/dist/chunks/{chunk-NUJCTZOM.js → chunk-T6INV7EZ.js} +7 -7
  86. package/dist/chunks/{chunk-37YQDLHZ.js → chunk-TTDBVPB2.js} +4238 -3639
  87. package/dist/chunks/chunk-TTDBVPB2.js.map +6 -0
  88. package/dist/chunks/{chunk-MEHYOYTW.js → chunk-U5KONGAN.js} +3 -3
  89. package/dist/chunks/{chunk-KS5X3GMX.js → chunk-U5PL5D27.js} +3 -3
  90. package/dist/chunks/{chunk-AXCOWIIH.js → chunk-U5UV2YRE.js} +2 -139
  91. package/dist/chunks/chunk-U5UV2YRE.js.map +6 -0
  92. package/dist/chunks/{chunk-YIFOFVWM.js → chunk-WYULBUCG.js} +4 -4
  93. package/dist/chunks/{chunk-ONKQPPSY.js → chunk-X54VNEWE.js} +2 -2
  94. package/dist/chunks/{chunk-YZOR7643.js → chunk-XDGIOXTU.js} +156 -3
  95. package/dist/chunks/chunk-XDGIOXTU.js.map +6 -0
  96. package/dist/chunks/{chunk-FKSIOYXA.js → chunk-XLGTH7JD.js} +4 -4
  97. package/dist/chunks/chunk-XPS3W7FC.js +147 -0
  98. package/dist/chunks/chunk-XPS3W7FC.js.map +6 -0
  99. package/dist/chunks/chunk-XSCT3DLE.js +161 -0
  100. package/dist/chunks/chunk-XSCT3DLE.js.map +6 -0
  101. package/dist/chunks/{chunk-363DTX3M.js → chunk-YTEGBYGL.js} +4 -4
  102. package/dist/chunks/{chunk-7C6DG66T.js → chunk-ZPIHARMI.js} +4 -4
  103. package/dist/chunks/{cli-runtime-XHGO7QSK.js → cli-runtime-YD7OZGEU.js} +16 -14
  104. package/dist/chunks/cli-runtime-YD7OZGEU.js.map +6 -0
  105. package/dist/chunks/{commands-GDF5OOXO.js → commands-5P4RLRXG.js} +5 -5
  106. package/dist/chunks/{crash-report-N7ZQ2UB4.js → crash-report-F5G32A7S.js} +9 -8
  107. package/dist/chunks/{dist-547VSBMV.js → dist-6O3HSFZP.js} +2 -2
  108. package/dist/chunks/{dist-IJ3AAED4.js → dist-7B6PZO7C.js} +2 -2
  109. package/dist/chunks/{dist-MZNKQTW4.js → dist-DFLFYX3A.js} +2 -2
  110. package/dist/chunks/{dist-36LBIFJ6.js → dist-SX66KAH4.js} +2 -2
  111. package/dist/chunks/{dist-T2NJ6SVO.js → dist-WB355CNL.js} +44 -16
  112. package/dist/chunks/dist-WB355CNL.js.map +6 -0
  113. package/dist/chunks/{dist-TCILCQPG.js → dist-Y6SGSSMO.js} +2 -2
  114. package/dist/chunks/{dist-TCIDRGW5.js → dist-ZAGIMP7N.js} +2 -2
  115. package/dist/chunks/{doctor-T7SC3VSE.js → doctor-2AOB47IO.js} +8 -8
  116. package/dist/chunks/{drain-OA5MO7SQ.js → drain-M6AGCMJX.js} +10 -10
  117. package/dist/chunks/{eval-D5Q2WZ7S.js → eval-YHY3VO7B.js} +2 -2
  118. package/dist/chunks/{exec-MG5S7OJN.js → exec-KCISQ4M7.js} +33 -28
  119. package/dist/chunks/exec-KCISQ4M7.js.map +6 -0
  120. package/dist/chunks/{home-Z7L4BJTW.js → home-AC5LQKDR.js} +3 -3
  121. package/dist/chunks/{host-queries-LL56A6NY.js → host-queries-YQVRKUWC.js} +14 -14
  122. package/dist/chunks/{lifecycle-TCRLU6B5.js → lifecycle-CQXCTLAZ.js} +28 -26
  123. package/dist/chunks/{list-RBOLXDHG.js → list-LNKKJZSZ.js} +16 -14
  124. package/dist/chunks/list-LNKKJZSZ.js.map +6 -0
  125. package/dist/chunks/{login-RZCJNDAJ.js → login-YA652CIL.js} +8 -8
  126. package/dist/chunks/{logs-KDEGF3FA.js → logs-2PREHSOD.js} +4 -4
  127. package/dist/chunks/{mcp-7L7NYLKG.js → mcp-WJB2UVQW.js} +21 -19
  128. package/dist/chunks/mcp-WJB2UVQW.js.map +6 -0
  129. package/dist/chunks/{message-command-NTLYNKUW.js → message-command-IXUASFZO.js} +37 -36
  130. package/dist/chunks/message-command-IXUASFZO.js.map +6 -0
  131. package/dist/chunks/{operator-tools-DXU6UK4S.js → operator-tools-QOZZZVEC.js} +12 -12
  132. package/dist/chunks/{output-schema-UMOAOTW2.js → output-schema-JTPOC3NL.js} +3 -3
  133. package/dist/chunks/{pal-FDOF3S5J.js → pal-FNSNP47Q.js} +13 -12
  134. package/dist/chunks/pal-FNSNP47Q.js.map +6 -0
  135. package/dist/chunks/{providers-HOY5QHWL.js → providers-M5HWW7DH.js} +6 -6
  136. package/dist/chunks/{resident-XIM5KNNX.js → resident-R2RCAHYR.js} +24 -22
  137. package/dist/chunks/resident-R2RCAHYR.js.map +6 -0
  138. package/dist/chunks/resume-UKK4HVCO.js +22 -0
  139. package/dist/chunks/{resume-command-DIVGMVMA.js → resume-command-LPN33FIF.js} +6 -5
  140. package/dist/chunks/{schedule-YRHGK6CD.js → schedule-J2IY3SVE.js} +8 -8
  141. package/dist/chunks/{service-DRXVEYFA.js → service-LEAVOYGP.js} +27 -25
  142. package/dist/chunks/service-LEAVOYGP.js.map +6 -0
  143. package/dist/chunks/session-step-2B46NVE7.js +30 -0
  144. package/dist/chunks/{skills-C5ZXOJEA.js → skills-X2V3TNTK.js} +10 -9
  145. package/dist/chunks/skills-X2V3TNTK.js.map +6 -0
  146. package/dist/chunks/{state-BVKWZF6F.js → state-VDTYWZ5S.js} +4 -3
  147. package/dist/chunks/state-VDTYWZ5S.js.map +6 -0
  148. package/dist/chunks/{store-GKY55UEV.js → store-C27Q22UV.js} +4 -4
  149. package/dist/chunks/{store-ZXFXXY4S.js → store-DRPRQLDD.js} +9 -9
  150. package/dist/chunks/{store-A4VHV4I2.js → store-S4QRR5DH.js} +6 -6
  151. package/dist/chunks/{tui-PY2FQXVO.js → tui-RU6CRMLX.js} +13396 -11956
  152. package/dist/chunks/tui-RU6CRMLX.js.map +6 -0
  153. package/dist/chunks/{upgrade-WSBGA3FW.js → upgrade-I2GMLDWZ.js} +3 -4
  154. package/dist/chunks/upgrade-I2GMLDWZ.js.map +6 -0
  155. package/dist/chunks/{worktree-HLE7PBLL.js → worktree-F632OJNE.js} +13 -12
  156. package/dist/chunks/worktree-F632OJNE.js.map +6 -0
  157. package/dist/config/load.d.ts +6 -1
  158. package/dist/config/load.d.ts.map +1 -1
  159. package/dist/config/schema.d.ts +45 -0
  160. package/dist/config/schema.d.ts.map +1 -1
  161. package/dist/config/user-config.d.ts.map +1 -1
  162. package/dist/index.js +16 -14
  163. package/dist/integrations/compaction/idle-compaction.d.ts +84 -0
  164. package/dist/integrations/compaction/idle-compaction.d.ts.map +1 -0
  165. package/dist/integrations/providers/prompt-cache-ttl.d.ts +14 -0
  166. package/dist/integrations/providers/prompt-cache-ttl.d.ts.map +1 -0
  167. package/dist/integrations/resident/runner-worker.js +20 -19
  168. package/dist/integrations/resident/runner-worker.js.map +1 -1
  169. package/dist/integrations/sessions/recap.d.ts +56 -0
  170. package/dist/integrations/sessions/recap.d.ts.map +1 -0
  171. package/dist/integrations/sessions/store.d.ts +7 -1
  172. package/dist/integrations/sessions/store.d.ts.map +1 -1
  173. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  174. package/dist/memory/typed.d.ts +11 -0
  175. package/dist/memory/typed.d.ts.map +1 -1
  176. package/dist/tui/App.d.ts +17 -1
  177. package/dist/tui/App.d.ts.map +1 -1
  178. package/dist/tui/BrandHeader.d.ts.map +1 -1
  179. package/dist/tui/Checklist.d.ts +2 -0
  180. package/dist/tui/Checklist.d.ts.map +1 -1
  181. package/dist/tui/ChoicePicker.d.ts +4 -1
  182. package/dist/tui/ChoicePicker.d.ts.map +1 -1
  183. package/dist/tui/Composer.d.ts +15 -3
  184. package/dist/tui/Composer.d.ts.map +1 -1
  185. package/dist/tui/ComposerFrame.d.ts.map +1 -1
  186. package/dist/tui/ContextGridRow.d.ts +6 -0
  187. package/dist/tui/ContextGridRow.d.ts.map +1 -0
  188. package/dist/tui/LiveActivity.d.ts +9 -1
  189. package/dist/tui/LiveActivity.d.ts.map +1 -1
  190. package/dist/tui/Markdown.d.ts.map +1 -1
  191. package/dist/tui/ReadSearchGroup.d.ts +14 -0
  192. package/dist/tui/ReadSearchGroup.d.ts.map +1 -0
  193. package/dist/tui/RewindPicker.d.ts +14 -0
  194. package/dist/tui/RewindPicker.d.ts.map +1 -0
  195. package/dist/tui/StatusBar.d.ts +31 -12
  196. package/dist/tui/StatusBar.d.ts.map +1 -1
  197. package/dist/tui/ThemeSample.d.ts +5 -0
  198. package/dist/tui/ThemeSample.d.ts.map +1 -0
  199. package/dist/tui/Transcript.d.ts +13 -0
  200. package/dist/tui/Transcript.d.ts.map +1 -1
  201. package/dist/tui/TranscriptScreen.d.ts +24 -0
  202. package/dist/tui/TranscriptScreen.d.ts.map +1 -0
  203. package/dist/tui/agent-transcript-rows.d.ts.map +1 -1
  204. package/dist/tui/agent-view-commands.d.ts.map +1 -1
  205. package/dist/tui/agent.d.ts +62 -1
  206. package/dist/tui/agent.d.ts.map +1 -1
  207. package/dist/tui/away-recap.d.ts +73 -0
  208. package/dist/tui/away-recap.d.ts.map +1 -0
  209. package/dist/tui/context-grid.d.ts +121 -0
  210. package/dist/tui/context-grid.d.ts.map +1 -0
  211. package/dist/tui/context-meter.d.ts +9 -0
  212. package/dist/tui/context-meter.d.ts.map +1 -1
  213. package/dist/tui/context-usage.d.ts +70 -0
  214. package/dist/tui/context-usage.d.ts.map +1 -0
  215. package/dist/tui/diff-view.d.ts +1 -1
  216. package/dist/tui/edit-prompts.d.ts.map +1 -1
  217. package/dist/tui/focus-reporting.d.ts +45 -0
  218. package/dist/tui/focus-reporting.d.ts.map +1 -0
  219. package/dist/tui/group-rows.d.ts +10 -0
  220. package/dist/tui/group-rows.d.ts.map +1 -0
  221. package/dist/tui/index.d.ts.map +1 -1
  222. package/dist/tui/live-window.d.ts +5 -8
  223. package/dist/tui/live-window.d.ts.map +1 -1
  224. package/dist/tui/logo.d.ts +0 -1
  225. package/dist/tui/logo.d.ts.map +1 -1
  226. package/dist/tui/motion.d.ts +14 -0
  227. package/dist/tui/motion.d.ts.map +1 -0
  228. package/dist/tui/next-task.d.ts +11 -0
  229. package/dist/tui/next-task.d.ts.map +1 -0
  230. package/dist/tui/notifications.d.ts +69 -0
  231. package/dist/tui/notifications.d.ts.map +1 -0
  232. package/dist/tui/plain-interruption.d.ts +1 -1
  233. package/dist/tui/plain-interruption.d.ts.map +1 -1
  234. package/dist/tui/read-search-group.d.ts +97 -0
  235. package/dist/tui/read-search-group.d.ts.map +1 -0
  236. package/dist/tui/recap-setting.d.ts +36 -0
  237. package/dist/tui/recap-setting.d.ts.map +1 -0
  238. package/dist/tui/recap-turns.d.ts +13 -0
  239. package/dist/tui/recap-turns.d.ts.map +1 -0
  240. package/dist/tui/restored-rows.d.ts.map +1 -1
  241. package/dist/tui/rewind.d.ts +142 -0
  242. package/dist/tui/rewind.d.ts.map +1 -0
  243. package/dist/tui/slashCommands.d.ts +45 -0
  244. package/dist/tui/slashCommands.d.ts.map +1 -1
  245. package/dist/tui/spinner-tips-setting.d.ts +10 -0
  246. package/dist/tui/spinner-tips-setting.d.ts.map +1 -0
  247. package/dist/tui/spinner-tips.d.ts +39 -0
  248. package/dist/tui/spinner-tips.d.ts.map +1 -0
  249. package/dist/tui/stale-history-retry.d.ts +17 -0
  250. package/dist/tui/stale-history-retry.d.ts.map +1 -0
  251. package/dist/tui/system-rows.d.ts +4 -0
  252. package/dist/tui/system-rows.d.ts.map +1 -1
  253. package/dist/tui/terminal-display.d.ts +7 -0
  254. package/dist/tui/terminal-display.d.ts.map +1 -1
  255. package/dist/tui/terminal-focus.d.ts +29 -0
  256. package/dist/tui/terminal-focus.d.ts.map +1 -0
  257. package/dist/tui/terminal-title.d.ts +19 -0
  258. package/dist/tui/terminal-title.d.ts.map +1 -1
  259. package/dist/tui/theme-command.d.ts +20 -0
  260. package/dist/tui/theme-command.d.ts.map +1 -0
  261. package/dist/tui/theme-detect.d.ts +41 -0
  262. package/dist/tui/theme-detect.d.ts.map +1 -0
  263. package/dist/tui/theme-launch.d.ts +16 -0
  264. package/dist/tui/theme-launch.d.ts.map +1 -0
  265. package/dist/tui/theme-palettes.d.ts +121 -0
  266. package/dist/tui/theme-palettes.d.ts.map +1 -0
  267. package/dist/tui/theme-store.d.ts +35 -0
  268. package/dist/tui/theme-store.d.ts.map +1 -0
  269. package/dist/tui/theme.d.ts +35 -64
  270. package/dist/tui/theme.d.ts.map +1 -1
  271. package/dist/tui/tidy-tool-output.d.ts +17 -0
  272. package/dist/tui/tidy-tool-output.d.ts.map +1 -1
  273. package/dist/tui/tip-history.d.ts +25 -0
  274. package/dist/tui/tip-history.d.ts.map +1 -0
  275. package/dist/tui/title-frame.d.ts +7 -0
  276. package/dist/tui/title-frame.d.ts.map +1 -0
  277. package/dist/tui/tool-end-rows.d.ts +4 -1
  278. package/dist/tui/tool-end-rows.d.ts.map +1 -1
  279. package/dist/tui/tool-failure-text.d.ts.map +1 -1
  280. package/dist/tui/transcript-screen.d.ts +31 -0
  281. package/dist/tui/transcript-screen.d.ts.map +1 -0
  282. package/dist/tui/transcript-scroll.d.ts.map +1 -1
  283. package/dist/tui/types.d.ts +26 -1
  284. package/dist/tui/types.d.ts.map +1 -1
  285. package/dist/tui/update-notice.d.ts +12 -0
  286. package/dist/tui/update-notice.d.ts.map +1 -0
  287. package/dist/tui/use-idle-compaction.d.ts +29 -0
  288. package/dist/tui/use-idle-compaction.d.ts.map +1 -0
  289. package/dist/tui/use-spinner-tip.d.ts +23 -0
  290. package/dist/tui/use-spinner-tip.d.ts.map +1 -0
  291. package/dist/tui/useNotifications.d.ts +14 -0
  292. package/dist/tui/useNotifications.d.ts.map +1 -0
  293. package/dist/tui/useReadSearchGroup.d.ts +21 -0
  294. package/dist/tui/useReadSearchGroup.d.ts.map +1 -0
  295. package/package.json +6 -6
  296. package/dist/chunks/acp-VDM66X7T.js.map +0 -6
  297. package/dist/chunks/activity-command-23DPNYXT.js.map +0 -6
  298. package/dist/chunks/add-Y2UMHBTC.js.map +0 -6
  299. package/dist/chunks/agent-session-6ZFR55NO.js +0 -53
  300. package/dist/chunks/archive-YUZ62G7R.js.map +0 -6
  301. package/dist/chunks/bin-main-LFPYUV3K.js.map +0 -6
  302. package/dist/chunks/chunk-37YQDLHZ.js.map +0 -6
  303. package/dist/chunks/chunk-6YFMOYKD.js +0 -1796
  304. package/dist/chunks/chunk-6YFMOYKD.js.map +0 -6
  305. package/dist/chunks/chunk-AURV7PCK.js +0 -111
  306. package/dist/chunks/chunk-AURV7PCK.js.map +0 -6
  307. package/dist/chunks/chunk-AXCOWIIH.js.map +0 -6
  308. package/dist/chunks/chunk-CDYUGK7F.js +0 -70
  309. package/dist/chunks/chunk-CDYUGK7F.js.map +0 -6
  310. package/dist/chunks/chunk-EEDZOGV4.js.map +0 -6
  311. package/dist/chunks/chunk-EGP3MB37.js.map +0 -6
  312. package/dist/chunks/chunk-IYPP6HSK.js.map +0 -6
  313. package/dist/chunks/chunk-KONYGNG6.js.map +0 -6
  314. package/dist/chunks/chunk-MCXVRO4B.js.map +0 -6
  315. package/dist/chunks/chunk-OPIC6ZIL.js.map +0 -6
  316. package/dist/chunks/chunk-YZOR7643.js.map +0 -6
  317. package/dist/chunks/cli-runtime-XHGO7QSK.js.map +0 -6
  318. package/dist/chunks/dist-T2NJ6SVO.js.map +0 -6
  319. package/dist/chunks/exec-MG5S7OJN.js.map +0 -6
  320. package/dist/chunks/list-RBOLXDHG.js.map +0 -6
  321. package/dist/chunks/mcp-7L7NYLKG.js.map +0 -6
  322. package/dist/chunks/message-command-NTLYNKUW.js.map +0 -6
  323. package/dist/chunks/pal-FDOF3S5J.js.map +0 -6
  324. package/dist/chunks/resident-XIM5KNNX.js.map +0 -6
  325. package/dist/chunks/resume-3OP5GB7S.js +0 -22
  326. package/dist/chunks/service-DRXVEYFA.js.map +0 -6
  327. package/dist/chunks/session-step-ZD3D55SM.js +0 -29
  328. package/dist/chunks/skills-C5ZXOJEA.js.map +0 -6
  329. package/dist/chunks/state-BVKWZF6F.js.map +0 -6
  330. package/dist/chunks/tui-PY2FQXVO.js.map +0 -6
  331. package/dist/chunks/upgrade-WSBGA3FW.js.map +0 -6
  332. package/dist/chunks/worktree-HLE7PBLL.js.map +0 -6
  333. package/dist/tui/EditPromptPicker.d.ts +0 -8
  334. package/dist/tui/EditPromptPicker.d.ts.map +0 -1
  335. package/dist/tui/ToolOutputViewer.d.ts +0 -11
  336. package/dist/tui/ToolOutputViewer.d.ts.map +0 -1
  337. /package/dist/chunks/{agent-LCCOMK5H.js.map → agent-PPQJZWBO.js.map} +0 -0
  338. /package/dist/chunks/{agent-session-6ZFR55NO.js.map → agent-session-PISYPFO2.js.map} +0 -0
  339. /package/dist/chunks/{browser-X6UIDIQQ.js.map → browser-EUFWHKYD.js.map} +0 -0
  340. /package/dist/chunks/{chat-EMEYQKRR.js.map → chat-QDWGHEEL.js.map} +0 -0
  341. /package/dist/chunks/{chunk-E6LQB5Z7.js.map → chunk-2I3Z65TV.js.map} +0 -0
  342. /package/dist/chunks/{chunk-W6JEZMOJ.js.map → chunk-4HUZHYCY.js.map} +0 -0
  343. /package/dist/chunks/{chunk-XNQI4ZDH.js.map → chunk-53GEER6F.js.map} +0 -0
  344. /package/dist/chunks/{chunk-HHOTJDZW.js.map → chunk-5HSG2XFD.js.map} +0 -0
  345. /package/dist/chunks/{chunk-V6UEMLTT.js.map → chunk-6PAE7AWD.js.map} +0 -0
  346. /package/dist/chunks/{chunk-HLIXL5RK.js.map → chunk-6UDJ3PVE.js.map} +0 -0
  347. /package/dist/chunks/{chunk-M2PQMMDW.js.map → chunk-73G5WDGM.js.map} +0 -0
  348. /package/dist/chunks/{chunk-2PH7EQQP.js.map → chunk-AHPIP5IE.js.map} +0 -0
  349. /package/dist/chunks/{chunk-N3JNFZOW.js.map → chunk-AUFSSABF.js.map} +0 -0
  350. /package/dist/chunks/{chunk-BPDKRVGW.js.map → chunk-BJNHDKU6.js.map} +0 -0
  351. /package/dist/chunks/{chunk-T64F5OER.js.map → chunk-BZ4U5L7N.js.map} +0 -0
  352. /package/dist/chunks/{chunk-FXMJ5NVM.js.map → chunk-BZJNXGWW.js.map} +0 -0
  353. /package/dist/chunks/{chunk-HBTPB6ON.js.map → chunk-C3APHRQB.js.map} +0 -0
  354. /package/dist/chunks/{chunk-A34Y6ZPM.js.map → chunk-C3ZJQLUX.js.map} +0 -0
  355. /package/dist/chunks/{chunk-B2GM4GON.js.map → chunk-C723P7SP.js.map} +0 -0
  356. /package/dist/chunks/{chunk-5NVONQBW.js.map → chunk-DGV5W2BU.js.map} +0 -0
  357. /package/dist/chunks/{chunk-AP4B5Z3D.js.map → chunk-DWSATEAY.js.map} +0 -0
  358. /package/dist/chunks/{chunk-45GT626R.js.map → chunk-EKFNDKPO.js.map} +0 -0
  359. /package/dist/chunks/{chunk-IVZB7YKX.js.map → chunk-FBY4LGL7.js.map} +0 -0
  360. /package/dist/chunks/{chunk-HWM73622.js.map → chunk-GDVYFXOR.js.map} +0 -0
  361. /package/dist/chunks/{chunk-WNVYEZUQ.js.map → chunk-GTWNJ7GL.js.map} +0 -0
  362. /package/dist/chunks/{chunk-2L3JDLC5.js.map → chunk-HBDBVQ3R.js.map} +0 -0
  363. /package/dist/chunks/{chunk-3MT5KLBF.js.map → chunk-HLYTSH5W.js.map} +0 -0
  364. /package/dist/chunks/{chunk-A25FQQTW.js.map → chunk-HPLVGTBH.js.map} +0 -0
  365. /package/dist/chunks/{chunk-B4DC7NC7.js.map → chunk-IAL3F2OI.js.map} +0 -0
  366. /package/dist/chunks/{chunk-JEHKZEIB.js.map → chunk-ILTHOMHL.js.map} +0 -0
  367. /package/dist/chunks/{chunk-TACSPIUK.js.map → chunk-JAHVXTO4.js.map} +0 -0
  368. /package/dist/chunks/{chunk-BZIUFNYR.js.map → chunk-KKYIGLKI.js.map} +0 -0
  369. /package/dist/chunks/{chunk-7WUSJ454.js.map → chunk-KOYEUNX7.js.map} +0 -0
  370. /package/dist/chunks/{chunk-OT5X76XI.js.map → chunk-KWRJTEV5.js.map} +0 -0
  371. /package/dist/chunks/{chunk-XJT5DL3I.js.map → chunk-L2GX4GAQ.js.map} +0 -0
  372. /package/dist/chunks/{chunk-M3TJHQF7.js.map → chunk-LFI6O7WL.js.map} +0 -0
  373. /package/dist/chunks/{chunk-ISN4VZCX.js.map → chunk-LM3W6AEK.js.map} +0 -0
  374. /package/dist/chunks/{chunk-DNHHMNVG.js.map → chunk-O3L5C2WT.js.map} +0 -0
  375. /package/dist/chunks/{chunk-EXVGLN6V.js.map → chunk-PXKXXNFU.js.map} +0 -0
  376. /package/dist/chunks/{chunk-MIM4YRP2.js.map → chunk-QPEGCKRA.js.map} +0 -0
  377. /package/dist/chunks/{chunk-OVG3QY7U.js.map → chunk-R7XQP4PZ.js.map} +0 -0
  378. /package/dist/chunks/{chunk-ESMVELWA.js.map → chunk-RAS4ZA5C.js.map} +0 -0
  379. /package/dist/chunks/{chunk-PV4ZAFVQ.js.map → chunk-RVNLS4BN.js.map} +0 -0
  380. /package/dist/chunks/{chunk-QR5YS5QW.js.map → chunk-RVSGU3JS.js.map} +0 -0
  381. /package/dist/chunks/{chunk-JII5GOH2.js.map → chunk-SOE4Q55L.js.map} +0 -0
  382. /package/dist/chunks/{chunk-7OXYUJSY.js.map → chunk-SUDXOGE6.js.map} +0 -0
  383. /package/dist/chunks/{chunk-NUJCTZOM.js.map → chunk-T6INV7EZ.js.map} +0 -0
  384. /package/dist/chunks/{chunk-MEHYOYTW.js.map → chunk-U5KONGAN.js.map} +0 -0
  385. /package/dist/chunks/{chunk-KS5X3GMX.js.map → chunk-U5PL5D27.js.map} +0 -0
  386. /package/dist/chunks/{chunk-YIFOFVWM.js.map → chunk-WYULBUCG.js.map} +0 -0
  387. /package/dist/chunks/{chunk-ONKQPPSY.js.map → chunk-X54VNEWE.js.map} +0 -0
  388. /package/dist/chunks/{chunk-FKSIOYXA.js.map → chunk-XLGTH7JD.js.map} +0 -0
  389. /package/dist/chunks/{chunk-363DTX3M.js.map → chunk-YTEGBYGL.js.map} +0 -0
  390. /package/dist/chunks/{chunk-7C6DG66T.js.map → chunk-ZPIHARMI.js.map} +0 -0
  391. /package/dist/chunks/{commands-GDF5OOXO.js.map → commands-5P4RLRXG.js.map} +0 -0
  392. /package/dist/chunks/{crash-report-N7ZQ2UB4.js.map → crash-report-F5G32A7S.js.map} +0 -0
  393. /package/dist/chunks/{dist-547VSBMV.js.map → dist-6O3HSFZP.js.map} +0 -0
  394. /package/dist/chunks/{dist-IJ3AAED4.js.map → dist-7B6PZO7C.js.map} +0 -0
  395. /package/dist/chunks/{dist-MZNKQTW4.js.map → dist-DFLFYX3A.js.map} +0 -0
  396. /package/dist/chunks/{dist-36LBIFJ6.js.map → dist-SX66KAH4.js.map} +0 -0
  397. /package/dist/chunks/{dist-TCILCQPG.js.map → dist-Y6SGSSMO.js.map} +0 -0
  398. /package/dist/chunks/{dist-TCIDRGW5.js.map → dist-ZAGIMP7N.js.map} +0 -0
  399. /package/dist/chunks/{doctor-T7SC3VSE.js.map → doctor-2AOB47IO.js.map} +0 -0
  400. /package/dist/chunks/{drain-OA5MO7SQ.js.map → drain-M6AGCMJX.js.map} +0 -0
  401. /package/dist/chunks/{eval-D5Q2WZ7S.js.map → eval-YHY3VO7B.js.map} +0 -0
  402. /package/dist/chunks/{home-Z7L4BJTW.js.map → home-AC5LQKDR.js.map} +0 -0
  403. /package/dist/chunks/{host-queries-LL56A6NY.js.map → host-queries-YQVRKUWC.js.map} +0 -0
  404. /package/dist/chunks/{lifecycle-TCRLU6B5.js.map → lifecycle-CQXCTLAZ.js.map} +0 -0
  405. /package/dist/chunks/{login-RZCJNDAJ.js.map → login-YA652CIL.js.map} +0 -0
  406. /package/dist/chunks/{logs-KDEGF3FA.js.map → logs-2PREHSOD.js.map} +0 -0
  407. /package/dist/chunks/{operator-tools-DXU6UK4S.js.map → operator-tools-QOZZZVEC.js.map} +0 -0
  408. /package/dist/chunks/{output-schema-UMOAOTW2.js.map → output-schema-JTPOC3NL.js.map} +0 -0
  409. /package/dist/chunks/{providers-HOY5QHWL.js.map → providers-M5HWW7DH.js.map} +0 -0
  410. /package/dist/chunks/{resume-3OP5GB7S.js.map → resume-UKK4HVCO.js.map} +0 -0
  411. /package/dist/chunks/{resume-command-DIVGMVMA.js.map → resume-command-LPN33FIF.js.map} +0 -0
  412. /package/dist/chunks/{schedule-YRHGK6CD.js.map → schedule-J2IY3SVE.js.map} +0 -0
  413. /package/dist/chunks/{session-step-ZD3D55SM.js.map → session-step-2B46NVE7.js.map} +0 -0
  414. /package/dist/chunks/{store-A4VHV4I2.js.map → store-C27Q22UV.js.map} +0 -0
  415. /package/dist/chunks/{store-GKY55UEV.js.map → store-DRPRQLDD.js.map} +0 -0
  416. /package/dist/chunks/{store-ZXFXXY4S.js.map → store-S4QRR5DH.js.map} +0 -0
@@ -12853,7 +12853,9 @@ var TokenUsageSchema = external_exports.object({
12853
12853
  totalTokens: count,
12854
12854
  cachedTokens: count,
12855
12855
  cacheWriteTokens: count,
12856
- reasoningTokens: count.optional()
12856
+ reasoningTokens: count.optional(),
12857
+ cacheTtlMs: count.optional(),
12858
+ cacheWriteTtlTokens: external_exports.object({ fiveMin: count.optional(), oneHour: count.optional() }).strict().optional()
12857
12859
  }).strict();
12858
12860
  var CostInfoSchema = external_exports.object({
12859
12861
  inputCostPer1M: external_exports.number().nonnegative().optional(),
@@ -13248,7 +13250,7 @@ var DecisionExpiredRecordSchema = inTurn("decision_expired", {
13248
13250
  var CompactionRecordSchema = recordSchema("compaction", {
13249
13251
  compactionId: text2.min(1),
13250
13252
  strategy: text2.min(1),
13251
- trigger: external_exports.enum(["auto", "manual"]),
13253
+ trigger: external_exports.enum(["auto", "manual", "idle"]),
13252
13254
  replacesSeqRange: external_exports.tuple([positive, positive]),
13253
13255
  summary: external_exports.union([external_exports.array(messageBody), spill]),
13254
13256
  keptMessageIds: external_exports.array(messageId2),
@@ -17806,7 +17808,12 @@ ${entries2}
17806
17808
  "namzu.registry.errors": errorMessage,
17807
17809
  "namzu.registry.empty": isEmptyInput
17808
17810
  });
17809
- return { success: false, output: "", error: enrichedMessage };
17811
+ return {
17812
+ success: false,
17813
+ output: "",
17814
+ error: enrichedMessage,
17815
+ facts: { kind: "failure", reason: "invalid_arguments" }
17816
+ };
17810
17817
  }
17811
17818
  };
17812
17819
  function toolSpanIdentity(context2) {
@@ -22299,6 +22306,8 @@ function accumulateTokenUsage(current, addition) {
22299
22306
  // and a turn mixing a reporting driver with a silent one would read as
22300
22307
  // though the silent turns did no thinking.
22301
22308
  ...current.reasoningTokens !== void 0 || addition.reasoningTokens !== void 0 ? { reasoningTokens: (current.reasoningTokens ?? 0) + (addition.reasoningTokens ?? 0) } : {}
22309
+ // `cacheTtlMs` and `cacheWriteTtlTokens` are per-call facts and are
22310
+ // deliberately not carried into a sum.
22302
22311
  };
22303
22312
  }
22304
22313
  __name(accumulateTokenUsage, "accumulateTokenUsage");
@@ -22320,7 +22329,10 @@ function mergeTokenUsage(current, next) {
22320
22329
  totalTokens: Math.max(current.totalTokens, next.totalTokens, promptTokens + completionTokens),
22321
22330
  cachedTokens: Math.max(current.cachedTokens, next.cachedTokens),
22322
22331
  cacheWriteTokens: Math.max(current.cacheWriteTokens, next.cacheWriteTokens),
22323
- ...current.reasoningTokens !== void 0 || next.reasoningTokens !== void 0 ? { reasoningTokens: Math.max(current.reasoningTokens ?? 0, next.reasoningTokens ?? 0) } : {}
22332
+ ...current.reasoningTokens !== void 0 || next.reasoningTokens !== void 0 ? { reasoningTokens: Math.max(current.reasoningTokens ?? 0, next.reasoningTokens ?? 0) } : {},
22333
+ // Frames of one call describe the same cache: the latest report wins.
22334
+ ...next.cacheTtlMs !== void 0 || current.cacheTtlMs !== void 0 ? { cacheTtlMs: next.cacheTtlMs ?? current.cacheTtlMs } : {},
22335
+ ...next.cacheWriteTtlTokens !== void 0 || current.cacheWriteTtlTokens !== void 0 ? { cacheWriteTtlTokens: next.cacheWriteTtlTokens ?? current.cacheWriteTtlTokens } : {}
22324
22336
  };
22325
22337
  }
22326
22338
  __name(mergeTokenUsage, "mergeTokenUsage");
@@ -25320,6 +25332,10 @@ function estimateMessageTokens(message) {
25320
25332
  return Math.ceil(chars / CHARS_PER_TOKEN) + rich;
25321
25333
  }
25322
25334
  __name(estimateMessageTokens, "estimateMessageTokens");
25335
+ function estimateTextTokens(text9) {
25336
+ return Math.ceil(text9.length / CHARS_PER_TOKEN);
25337
+ }
25338
+ __name(estimateTextTokens, "estimateTextTokens");
25323
25339
  function estimateMessagesTokens(messages) {
25324
25340
  return messages.reduce((total, message) => total + estimateMessageTokens(message), 0);
25325
25341
  }
@@ -25679,7 +25695,8 @@ function applyEdit(content, operations) {
25679
25695
  if (!result.success) {
25680
25696
  return {
25681
25697
  success: false,
25682
- error: framedError(result.error, index, operations.length)
25698
+ error: framedError(result.error, index, operations.length),
25699
+ ...result.reason ? { reason: result.reason } : {}
25683
25700
  };
25684
25701
  }
25685
25702
  current = result.content;
@@ -25700,6 +25717,7 @@ function applyOne(content, input) {
25700
25717
  if (resolved2 === null) {
25701
25718
  return {
25702
25719
  success: false,
25720
+ reason: "text_not_found",
25703
25721
  error: "old_string/oldStr not found in file. Make sure the string matches exactly, including whitespace and indentation."
25704
25722
  };
25705
25723
  }
@@ -25727,6 +25745,7 @@ function applyOne(content, input) {
25727
25745
  const secondLine = content.slice(0, secondIndex).split("\n").length;
25728
25746
  return {
25729
25747
  success: false,
25748
+ reason: "not_unique",
25730
25749
  error: `old_string/oldStr is not unique \u2014 found at lines ${lineNumber} and ${secondLine}. Provide more surrounding context to make it unique, or use replace_all: true.`
25731
25750
  };
25732
25751
  }
@@ -26869,7 +26888,12 @@ __name(recordDrift, "recordDrift");
26869
26888
  function admitAgainstRead(context2, key5, content, operations) {
26870
26889
  const tracker = context2.fileReadTracker;
26871
26890
  if (tracker && !tracker.hasRead(key5)) {
26872
- return { success: false, output: "", error: unreadFileError(key5, "edit") };
26891
+ return {
26892
+ success: false,
26893
+ output: "",
26894
+ error: unreadFileError(key5, "edit"),
26895
+ facts: { kind: "failure", reason: "not_read", subject: key5 }
26896
+ };
26873
26897
  }
26874
26898
  const seen = tracker?.fingerprint?.(key5);
26875
26899
  const applied = applyEdit(content, operations);
@@ -26877,7 +26901,12 @@ function admitAgainstRead(context2, key5, content, operations) {
26877
26901
  const recoverable = applied.success && operations.every((o) => o.operation === "replace");
26878
26902
  if (!recoverable) {
26879
26903
  recordDrift(context2, key5);
26880
- return { success: false, output: "", error: staleFileError(key5) };
26904
+ return {
26905
+ success: false,
26906
+ output: "",
26907
+ error: staleFileError(key5),
26908
+ facts: { kind: "failure", reason: "changed_on_disk", subject: key5 }
26909
+ };
26881
26910
  }
26882
26911
  }
26883
26912
  return { success: true, result: applied };
@@ -26900,6 +26929,15 @@ function editFacts(path2, replacements, before, after) {
26900
26929
  };
26901
26930
  }
26902
26931
  __name(editFacts, "editFacts");
26932
+ function refusedEdit(result, path2) {
26933
+ return {
26934
+ success: false,
26935
+ output: "",
26936
+ error: result.error,
26937
+ ...result.reason ? { facts: { kind: "failure", reason: result.reason, subject: path2 } } : {}
26938
+ };
26939
+ }
26940
+ __name(refusedEdit, "refusedEdit");
26903
26941
  var EditTool = defineTool({
26904
26942
  name: "edit",
26905
26943
  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.',
@@ -27000,9 +27038,8 @@ var EditTool = defineTool({
27000
27038
  if (!admitted2.success)
27001
27039
  return admitted2;
27002
27040
  const result2 = admitted2.result;
27003
- if (!result2.success) {
27004
- return { success: false, output: "", error: result2.error };
27005
- }
27041
+ if (!result2.success)
27042
+ return refusedEdit(result2, parsed.data.path);
27006
27043
  await context2.sandbox.writeFile(parsed.data.path, result2.content);
27007
27044
  recordEditedContent(context2, parsed.data.path, result2.content);
27008
27045
  const changed2 = editFacts(parsed.data.path, result2.replacements, content2, result2.content);
@@ -27024,7 +27061,7 @@ var EditTool = defineTool({
27024
27061
  return admitted;
27025
27062
  const result = admitted.result;
27026
27063
  if (!result.success)
27027
- return { success: false, output: "", error: result.error };
27064
+ return refusedEdit(result, hostPath);
27028
27065
  await atomicWriteFile2(hostPath, result.content);
27029
27066
  recordEditedContent(context2, hostPath, result.content);
27030
27067
  const changed = editFacts(hostPath, result.replacements, content, result.content);
@@ -27674,7 +27711,7 @@ function enforceReadBeforeOverwrite(context2, key5) {
27674
27711
  success: false,
27675
27712
  output: "",
27676
27713
  error: `${key5} already exists. Use the \`read\` tool on it first in this conversation, then call \`write\` again \u2014 or prefer \`edit\` for a targeted change.`,
27677
- facts: { kind: "failure", reason: "already_exists", subject: key5 }
27714
+ facts: { kind: "failure", reason: "not_read", subject: key5 }
27678
27715
  };
27679
27716
  }
27680
27717
  __name(enforceReadBeforeOverwrite, "enforceReadBeforeOverwrite");
@@ -27685,7 +27722,12 @@ function enforceFreshOverwrite(context2, key5, currentContent) {
27685
27722
  const observed = context2.fileReadTracker?.fingerprint?.(key5);
27686
27723
  if (observed !== void 0 && observed !== fingerprintContent(currentContent)) {
27687
27724
  context2.fileReadTracker?.recordDriftObserved?.(key5);
27688
- return { success: false, output: "", error: staleFileError(key5, "write") };
27725
+ return {
27726
+ success: false,
27727
+ output: "",
27728
+ error: staleFileError(key5, "write"),
27729
+ facts: { kind: "failure", reason: "changed_on_disk", subject: key5 }
27730
+ };
27689
27731
  }
27690
27732
  return null;
27691
27733
  }
@@ -41408,6 +41450,12 @@ var IterationOrchestrator = class {
41408
41450
  usage: recorder.tokenUsage,
41409
41451
  budget: recorder.budget?.summary(),
41410
41452
  cost: recorder.costInfo,
41453
+ ...response.usage.cacheTtlMs !== void 0 ? {
41454
+ cache: {
41455
+ ttlMs: response.usage.cacheTtlMs,
41456
+ touched: response.usage.cachedTokens + response.usage.cacheWriteTokens > 0
41457
+ }
41458
+ } : {},
41411
41459
  ...contextFigures
41412
41460
  });
41413
41461
  const assistantMsg = withStreamedMessageIdentity(createAssistantMessage(
@@ -46236,7 +46284,8 @@ function usageAtLeast(current, previous) {
46236
46284
  return true;
46237
46285
  if (current === void 0)
46238
46286
  return false;
46239
- return Object.entries(previous).every(([field2, amount]) => typeof amount !== "number" || (current[field2] ?? 0) >= amount);
46287
+ return Object.entries(previous).every(([field2, amount]) => typeof amount !== "number" || field2 === "cacheTtlMs" || // `cacheTtlMs` is a per-call lifetime, not a running count: it has no order.
46288
+ (current[field2] ?? 0) >= amount);
46240
46289
  }
46241
46290
  __name(usageAtLeast, "usageAtLeast");
46242
46291
 
@@ -48370,7 +48419,10 @@ async function prepareDirectCall(host, toolCall, providerInput = true) {
48370
48419
  input: parsed,
48371
48420
  message,
48372
48421
  isError: true,
48373
- ...providerInput && !repairUsed && preparation.inputFailure ? { inputFailure: preparation.inputFailure } : {}
48422
+ ...providerInput && !repairUsed && preparation.inputFailure ? { inputFailure: preparation.inputFailure } : {},
48423
+ // The registry's typed reason (e.g. invalid arguments) is what a
48424
+ // host keys its short label on; the message alone is wording.
48425
+ ...preparation.result.facts ? { facts: preparation.result.facts } : {}
48374
48426
  };
48375
48427
  }
48376
48428
  const preOutcome = await runPreToolHook(host, toolName, preparation.prepared.input);
@@ -54074,10 +54126,69 @@ async function compactNow(input) {
54074
54126
  });
54075
54127
  }
54076
54128
  __name(compactNow, "compactNow");
54129
+ async function compactRegion(input) {
54130
+ admitManualCompaction(input);
54131
+ const { messages, start, end } = input;
54132
+ if (!Number.isInteger(start) || !Number.isInteger(end) || start < 0 || end > messages.length) {
54133
+ throw new NamzuError({
54134
+ code: "invalid_config",
54135
+ message: `compactRegion: [${start}, ${end}) is not a range inside a history of ${messages.length} messages.`,
54136
+ details: { start, end, length: messages.length },
54137
+ retryable: false
54138
+ });
54139
+ }
54140
+ if (end - start < 1)
54141
+ return null;
54142
+ for (const [label5, index] of [
54143
+ ["start", start],
54144
+ ["end", end]
54145
+ ]) {
54146
+ if (findSafeTrimIndex(messages, index) !== index) {
54147
+ throw new NamzuError({
54148
+ code: "invalid_config",
54149
+ message: `compactRegion: ${label5} index ${index} splits a tool_use/tool_result pair. Move it to a boundary between turns.`,
54150
+ details: { [label5]: index, start, end },
54151
+ retryable: false
54152
+ });
54153
+ }
54154
+ }
54155
+ const retained = findRetainedIndices(messages);
54156
+ const retainedSelected = messages.slice(start, end).filter((_, offset) => retained.has(start + offset));
54157
+ if (end - start - retainedSelected.length - 1 < 1)
54158
+ return null;
54159
+ const manager = new WorkingStateManager(input.config);
54160
+ populateWorkingState(manager, messages.slice(start, end), input.config);
54161
+ let usage = { ...EMPTY_TOKEN_USAGE };
54162
+ const body = await buildVerifiedSummary(manager, messages.slice(start, end), input.provider, input.config, (reported) => {
54163
+ usage = accumulateTokenUsage(usage, reported);
54164
+ }, input.model ?? "", {
54165
+ signal: input.signal,
54166
+ streamIdleTimeoutMs: input.streamIdleTimeoutMs,
54167
+ instructions: input.instructions
54168
+ });
54169
+ const summary2 = { ...buildCompactionMessage(body, input.recoveryNote), retain: true };
54170
+ const out = [...messages.slice(0, start), summary2, ...retainedSelected, ...messages.slice(end)];
54171
+ const dangling = findDanglingMessages(out);
54172
+ if (!dangling.isValid) {
54173
+ throw new NamzuError({
54174
+ code: "invalid_config",
54175
+ message: `compactRegion: summarising [${start}, ${end}) would leave an unmatched tool result. Widen the span to cover the whole exchange.`,
54176
+ details: { start, end },
54177
+ retryable: false
54178
+ });
54179
+ }
54180
+ return publishManualCompaction(input, {
54181
+ messages: out,
54182
+ shed: messages.length - out.length,
54183
+ summary: summary2,
54184
+ usage
54185
+ });
54186
+ }
54187
+ __name(compactRegion, "compactRegion");
54077
54188
 
54078
54189
  // ../sdk/dist/runtime/query/compact-session.js
54079
54190
  async function compactSession(params) {
54080
- const { sessionId: sessionId5, locator = {}, ...input } = params;
54191
+ const { sessionId: sessionId5, locator = {}, trigger = "manual", ...input } = params;
54081
54192
  const log = await locateSessionLog(sessionId5, locator);
54082
54193
  return withSessionLease(log, locator.lease, async (lease) => {
54083
54194
  const active = await log.activeTurn({ lease });
@@ -54105,7 +54216,7 @@ async function compactSession(params) {
54105
54216
  type: "compaction",
54106
54217
  compactionId: generateMessageId(),
54107
54218
  strategy: input.config.strategy,
54108
- trigger: "manual",
54219
+ trigger,
54109
54220
  replacesSeqRange: [1, head2.pointer.seq],
54110
54221
  summary: summary2,
54111
54222
  keptMessageIds,
@@ -54116,6 +54227,66 @@ async function compactSession(params) {
54116
54227
  });
54117
54228
  }
54118
54229
  __name(compactSession, "compactSession");
54230
+ async function compactSessionRange(params) {
54231
+ const { sessionId: sessionId5, locator = {}, from, until, ...input } = params;
54232
+ const log = await locateSessionLog(sessionId5, locator);
54233
+ return withSessionLease(log, locator.lease, async (lease) => {
54234
+ const active = await log.activeTurn({ lease });
54235
+ if (active) {
54236
+ throw new TurnInProgressError({ sessionId: sessionId5, activeTurnId: active.turnId, state: active.state });
54237
+ }
54238
+ const history = await readFoldedHistory(log);
54239
+ const position = /* @__PURE__ */ __name((id3, fallback) => {
54240
+ if (id3 === void 0)
54241
+ return fallback;
54242
+ const at = history.findIndex((entry) => entry.messageId === id3);
54243
+ if (at < 0) {
54244
+ throw new NamzuError({
54245
+ code: "not_found",
54246
+ message: `Message ${id3} is not in session ${sessionId5}'s current context; it may already have been summarised.`,
54247
+ details: { sessionId: sessionId5, messageId: id3 }
54248
+ });
54249
+ }
54250
+ return at;
54251
+ }, "position");
54252
+ const start = position(from, 0);
54253
+ const end = position(until, history.length);
54254
+ const ids = /* @__PURE__ */ new Map();
54255
+ for (const entry of history)
54256
+ if (entry.messageId)
54257
+ ids.set(entry.message, entry.messageId);
54258
+ const result = await compactRegion({
54259
+ ...input,
54260
+ messages: history.map((entry) => entry.message),
54261
+ start,
54262
+ end
54263
+ });
54264
+ if (!result)
54265
+ return null;
54266
+ const head2 = await log.head();
54267
+ if (!head2) {
54268
+ throw new NamzuError({
54269
+ code: "not_found",
54270
+ message: `Session ${sessionId5} has an empty log; there is nothing to compact.`,
54271
+ details: { sessionId: sessionId5 }
54272
+ });
54273
+ }
54274
+ const { summary: summary2, keptMessageIds } = compactionShape(result.messages, ids);
54275
+ await log.append(lease, {
54276
+ type: "compaction",
54277
+ compactionId: generateMessageId(),
54278
+ strategy: input.config.strategy,
54279
+ trigger: "manual",
54280
+ replacesSeqRange: [1, head2.pointer.seq],
54281
+ summary: summary2,
54282
+ keptMessageIds,
54283
+ tokensBefore: 0,
54284
+ tokensAfter: 0
54285
+ });
54286
+ return result;
54287
+ });
54288
+ }
54289
+ __name(compactSessionRange, "compactSessionRange");
54119
54290
  function compactionShape(messages, ids) {
54120
54291
  const order = new Map([...ids.values()].map((id3, index) => [id3, index]));
54121
54292
  const first = messages.findIndex((message) => ids.has(message));
@@ -62255,7 +62426,7 @@ async function resolveMcpEra(input) {
62255
62426
  __name(resolveMcpEra, "resolveMcpEra");
62256
62427
 
62257
62428
  // ../sdk/dist/version.js
62258
- var VERSION2 = "53.2.2";
62429
+ var VERSION2 = "54.0.0";
62259
62430
 
62260
62431
  // ../sdk/dist/connector/mcp/client.js
62261
62432
  var MAX_LIST_PAGES = 100;
@@ -65942,6 +66113,131 @@ function createResidentStepContext(options) {
65942
66113
  }
65943
66114
  __name(createResidentStepContext, "createResidentStepContext");
65944
66115
 
66116
+ // ../sdk/dist/compaction/context-breakdown.js
66117
+ var CONTEXT_CATEGORY_ORDER = [
66118
+ "system-prompt",
66119
+ "system-tools",
66120
+ "mcp-tools",
66121
+ "mcp-instructions",
66122
+ "agents",
66123
+ "memory",
66124
+ "skills",
66125
+ "messages"
66126
+ ];
66127
+ var NAMES = {
66128
+ "system-prompt": "System prompt",
66129
+ "system-tools": "System tools",
66130
+ "mcp-tools": "MCP tools",
66131
+ "mcp-instructions": "MCP server instructions",
66132
+ agents: "Custom agents",
66133
+ memory: "Memory files",
66134
+ skills: "Skills",
66135
+ messages: "Messages"
66136
+ };
66137
+ function describeToolCatalogTokens(tools) {
66138
+ return tools.map((tool) => {
66139
+ let length = 0;
66140
+ try {
66141
+ length = JSON.stringify(tool).length;
66142
+ } catch {
66143
+ }
66144
+ return { name: tool.function.name, tokens: Math.ceil(length / CHARS_PER_TOKEN) };
66145
+ });
66146
+ }
66147
+ __name(describeToolCatalogTokens, "describeToolCatalogTokens");
66148
+ function nonNegative(value) {
66149
+ return value !== void 0 && Number.isFinite(value) && value > 0 ? Math.round(value) : 0;
66150
+ }
66151
+ __name(nonNegative, "nonNegative");
66152
+ function bufferFor(input) {
66153
+ if (input.autoCompact) {
66154
+ if (input.windowSource === "auto")
66155
+ return 0;
66156
+ const reserve = Math.min(input.maxOutputTokens !== void 0 && input.maxOutputTokens > 0 ? input.maxOutputTokens : TRIGGER_OUTPUT_RESERVE_CAP_TOKENS, TRIGGER_OUTPUT_RESERVE_CAP_TOKENS);
66157
+ return reserve + TRIGGER_BUFFER_TOKENS;
66158
+ }
66159
+ return COMPACT_BUFFER_TOKENS;
66160
+ }
66161
+ __name(bufferFor, "bufferFor");
66162
+ var COMPACT_BUFFER_TOKENS = 3e3;
66163
+ function tokensOfContent(message) {
66164
+ return estimateMessageTokens(message);
66165
+ }
66166
+ __name(tokensOfContent, "tokensOfContent");
66167
+ function breakdownMessages(messages) {
66168
+ const toolCallsByType = {};
66169
+ const toolResultsByType = {};
66170
+ const nameOfCall = /* @__PURE__ */ new Map();
66171
+ let assistantTokens = 0;
66172
+ let userTokens = 0;
66173
+ for (const message of messages) {
66174
+ if (message.role === "assistant") {
66175
+ let calls = 0;
66176
+ for (const call2 of message.toolCalls ?? []) {
66177
+ nameOfCall.set(call2.id, call2.function.name);
66178
+ const tokens = estimateTextTokens(call2.function.name + call2.function.arguments);
66179
+ toolCallsByType[call2.function.name] = (toolCallsByType[call2.function.name] ?? 0) + tokens;
66180
+ calls += tokens;
66181
+ }
66182
+ assistantTokens += Math.max(0, tokensOfContent(message) - calls);
66183
+ } else if (message.role === "tool") {
66184
+ const name2 = nameOfCall.get(message.toolCallId) ?? "unknown";
66185
+ toolResultsByType[name2] = (toolResultsByType[name2] ?? 0) + tokensOfContent(message);
66186
+ } else if (message.role === "user") {
66187
+ userTokens += tokensOfContent(message);
66188
+ }
66189
+ }
66190
+ return { toolCallsByType, toolResultsByType, assistantTokens, userTokens };
66191
+ }
66192
+ __name(breakdownMessages, "breakdownMessages");
66193
+ function analyzeContextUsage(input) {
66194
+ const windowTokens = Math.max(0, Math.round(input.windowTokens));
66195
+ const fixed = {
66196
+ "system-prompt": nonNegative(input.systemPromptTokens),
66197
+ "system-tools": nonNegative(input.systemToolTokens),
66198
+ "mcp-tools": nonNegative(input.mcpToolTokens),
66199
+ "mcp-instructions": nonNegative(input.mcpInstructionTokens),
66200
+ agents: nonNegative(input.agentTokens),
66201
+ memory: nonNegative(input.memoryTokens),
66202
+ skills: nonNegative(input.skillTokens),
66203
+ messages: 0
66204
+ };
66205
+ const fixedTotal = Object.values(fixed).reduce((sum, tokens) => sum + tokens, 0);
66206
+ const messages = input.messages ?? [];
66207
+ const bufferTokens = Math.min(bufferFor(input), windowTokens);
66208
+ const measured2 = nonNegative(input.contextTokens);
66209
+ const rawMessages = measured2 > 0 ? Math.max(0, measured2 - fixedTotal) : messages.reduce((sum, message) => sum + tokensOfContent(message), 0);
66210
+ fixed.messages = Math.min(rawMessages, Math.max(0, windowTokens - fixedTotal - bufferTokens));
66211
+ const totalTokens = measured2 > 0 ? Math.max(measured2, fixedTotal) : fixedTotal + rawMessages;
66212
+ const used = fixedTotal + fixed.messages;
66213
+ const categories = [];
66214
+ for (const id3 of CONTEXT_CATEGORY_ORDER) {
66215
+ if (fixed[id3] > 0)
66216
+ categories.push({ id: id3, name: NAMES[id3], tokens: fixed[id3], kind: "used" });
66217
+ }
66218
+ const free = Math.max(0, windowTokens - used - bufferTokens);
66219
+ if (bufferTokens > 0) {
66220
+ categories.push({
66221
+ id: "buffer",
66222
+ name: input.autoCompact ? "Autocompact buffer" : "Compact buffer",
66223
+ tokens: bufferTokens,
66224
+ kind: "buffer"
66225
+ });
66226
+ }
66227
+ categories.push({ id: "free", name: "Free space", tokens: free, kind: "free" });
66228
+ return {
66229
+ categories,
66230
+ windowTokens,
66231
+ totalTokens,
66232
+ percentage: windowTokens > 0 ? Math.round(totalTokens / windowTokens * 100) : 0,
66233
+ bufferTokens,
66234
+ autoCompact: input.autoCompact,
66235
+ overflowTokens: Math.max(0, totalTokens - windowTokens),
66236
+ messageBreakdown: breakdownMessages(messages)
66237
+ };
66238
+ }
66239
+ __name(analyzeContextUsage, "analyzeContextUsage");
66240
+
65945
66241
  // ../sdk/dist/manager/resident/store.js
65946
66242
  import { createHash as createHash24, randomUUID as randomUUID6 } from "node:crypto";
65947
66243
  var text5 = external_exports.string().trim().min(1).max(8e3);
@@ -71746,6 +72042,50 @@ function isReminderMessage(message) {
71746
72042
  }
71747
72043
  __name(isReminderMessage, "isReminderMessage");
71748
72044
 
72045
+ // ../sdk/dist/runtime/cache-clock.js
72046
+ var CacheClock = class {
72047
+ static {
72048
+ __name(this, "CacheClock");
72049
+ }
72050
+ #state = null;
72051
+ /** Record a finished call. `usage` is that call's own usage, not a turn total. */
72052
+ record(usage, at) {
72053
+ if (usage.cacheTtlMs === void 0 || !(usage.cacheTtlMs > 0)) {
72054
+ this.#state = null;
72055
+ return;
72056
+ }
72057
+ const touched = usage.cachedTokens + usage.cacheWriteTokens > 0;
72058
+ this.#state = {
72059
+ lastActivityAt: at,
72060
+ ttlMs: usage.cacheTtlMs,
72061
+ expiresAt: touched ? at + usage.cacheTtlMs : null
72062
+ };
72063
+ }
72064
+ /** Forget everything (the conversation was replaced or its context rewritten). */
72065
+ reset() {
72066
+ this.#state = null;
72067
+ }
72068
+ get state() {
72069
+ return this.#state;
72070
+ }
72071
+ /** Whether the cache is still alive at `now`. False when unknown. */
72072
+ warm(now) {
72073
+ const state = this.#state;
72074
+ return state !== null && state.expiresAt !== null && now < state.expiresAt;
72075
+ }
72076
+ /**
72077
+ * The moment `fraction` of the cache's remaining life since the last
72078
+ * activity has passed: `lastActivityAt + (expiresAt - lastActivityAt) * fraction`.
72079
+ * `null` when the expiry is unknown.
72080
+ */
72081
+ dueAt(fraction) {
72082
+ const state = this.#state;
72083
+ if (state === null || state.expiresAt === null)
72084
+ return null;
72085
+ return state.lastActivityAt + (state.expiresAt - state.lastActivityAt) * fraction;
72086
+ }
72087
+ };
72088
+
71749
72089
  // ../sdk/dist/agents/forward-options.js
71750
72090
  function pickRoutedOptions(options, routes, destination) {
71751
72091
  const picked = {};
@@ -86792,6 +87132,172 @@ function isReadOnlyCommandLine(line, dialect = "bash") {
86792
87132
  }
86793
87133
  __name(isReadOnlyCommandLine, "isReadOnlyCommandLine");
86794
87134
 
87135
+ // ../sdk/dist/tools/builtins/exit-semantics.js
87136
+ var MAX_COMMAND_CHARS = 1e4;
87137
+ var PLAIN_FAILURE = { isError: true };
87138
+ function split(command) {
87139
+ const segments = [];
87140
+ const separators = [];
87141
+ let current = "";
87142
+ let pending2 = "";
87143
+ let quote = null;
87144
+ const push = /* @__PURE__ */ __name(() => {
87145
+ segments.push(current);
87146
+ separators.push(pending2);
87147
+ current = "";
87148
+ }, "push");
87149
+ for (let i = 0; i < command.length; i++) {
87150
+ const ch = command.charAt(i);
87151
+ const next = command.charAt(i + 1);
87152
+ if (quote === "'") {
87153
+ if (ch === "'")
87154
+ quote = null;
87155
+ current += ch;
87156
+ continue;
87157
+ }
87158
+ if (ch === "\\") {
87159
+ current += ch + next;
87160
+ i += 1;
87161
+ continue;
87162
+ }
87163
+ if (ch === "`") {
87164
+ const end = command.indexOf("`", i + 1);
87165
+ if (end === -1)
87166
+ return void 0;
87167
+ current += command.slice(i, end + 1);
87168
+ i = end;
87169
+ continue;
87170
+ }
87171
+ if (ch === "$" && (next === "(" || next === "{")) {
87172
+ const close = next === "(" ? ")" : "}";
87173
+ let depth = 0;
87174
+ let j = i + 1;
87175
+ for (; j < command.length; j++) {
87176
+ const c = command.charAt(j);
87177
+ if (c === next)
87178
+ depth += 1;
87179
+ else if (c === close && --depth === 0)
87180
+ break;
87181
+ }
87182
+ if (j >= command.length)
87183
+ return void 0;
87184
+ current += command.slice(i, j + 1);
87185
+ i = j;
87186
+ continue;
87187
+ }
87188
+ if (quote === '"') {
87189
+ if (ch === '"')
87190
+ quote = null;
87191
+ current += ch;
87192
+ continue;
87193
+ }
87194
+ if (ch === '"' || ch === "'") {
87195
+ quote = ch;
87196
+ current += ch;
87197
+ continue;
87198
+ }
87199
+ if (ch === "(" || ch === ")")
87200
+ return void 0;
87201
+ if (ch === "<" && next === "<" && command.charAt(i + 2) !== "<")
87202
+ return void 0;
87203
+ if (ch === ">" && next === "&") {
87204
+ current += ch + next;
87205
+ i += 1;
87206
+ continue;
87207
+ }
87208
+ if (ch === "&" && command.charAt(i - 1) === ">") {
87209
+ current += ch;
87210
+ continue;
87211
+ }
87212
+ if (ch === "|" || ch === "&" || ch === ";" || ch === "\n") {
87213
+ let sep14 = ch;
87214
+ if ((ch === "|" || ch === "&") && next === ch) {
87215
+ sep14 = ch + ch;
87216
+ i += 1;
87217
+ } else if (ch === "|" && next === "&") {
87218
+ sep14 = "|&";
87219
+ i += 1;
87220
+ }
87221
+ push();
87222
+ pending2 = sep14 === "\n" ? ";" : sep14;
87223
+ continue;
87224
+ }
87225
+ current += ch;
87226
+ }
87227
+ if (quote !== null)
87228
+ return void 0;
87229
+ push();
87230
+ const kept = [];
87231
+ const keptSeparators = [];
87232
+ segments.forEach((segment2, index) => {
87233
+ if (segment2.trim().length === 0)
87234
+ return;
87235
+ kept.push(segment2.trim());
87236
+ keptSeparators.push(separators[index] ?? "");
87237
+ });
87238
+ return kept.length === 0 ? void 0 : { segments: kept, separators: keptSeparators };
87239
+ }
87240
+ __name(split, "split");
87241
+ function followsAndChain(parsed) {
87242
+ let index = parsed.segments.length - 1;
87243
+ while (index > 0 && (parsed.separators[index] === "|" || parsed.separators[index] === "|&")) {
87244
+ index -= 1;
87245
+ }
87246
+ return parsed.separators[index] === "&&";
87247
+ }
87248
+ __name(followsAndChain, "followsAndChain");
87249
+ var NO_MATCHES = "No matches found";
87250
+ var SEARCH_WORDS = /* @__PURE__ */ new Set(["grep", "rg", "egrep", "fgrep"]);
87251
+ function gitSubcommand(words) {
87252
+ if (words[0] !== "git")
87253
+ return void 0;
87254
+ for (let i = 1; i < words.length; i++) {
87255
+ const word2 = words[i];
87256
+ if (word2.startsWith("-")) {
87257
+ if (word2 === "-C" || word2 === "-c")
87258
+ i += 1;
87259
+ continue;
87260
+ }
87261
+ return word2;
87262
+ }
87263
+ return void 0;
87264
+ }
87265
+ __name(gitSubcommand, "gitSubcommand");
87266
+ function questionNote(command) {
87267
+ const words = command.trim().split(/\s+/);
87268
+ const first = words[0] ?? "";
87269
+ if (first === "git") {
87270
+ const sub = gitSubcommand(words);
87271
+ if (sub === "diff")
87272
+ return "Files differ";
87273
+ if (sub === "grep")
87274
+ return NO_MATCHES;
87275
+ return void 0;
87276
+ }
87277
+ if (SEARCH_WORDS.has(first))
87278
+ return NO_MATCHES;
87279
+ if (first === "find")
87280
+ return "Some directories were inaccessible";
87281
+ if (first === "diff")
87282
+ return "Files differ";
87283
+ if (first === "test" || first === "[")
87284
+ return "Condition is false";
87285
+ return void 0;
87286
+ }
87287
+ __name(questionNote, "questionNote");
87288
+ function judgeExit(command, exitCode) {
87289
+ if (exitCode === 0)
87290
+ return { isError: false };
87291
+ if (exitCode !== 1 || command.length > MAX_COMMAND_CHARS)
87292
+ return PLAIN_FAILURE;
87293
+ const parsed = split(command);
87294
+ if (!parsed || followsAndChain(parsed))
87295
+ return PLAIN_FAILURE;
87296
+ const note = questionNote(parsed.segments[parsed.segments.length - 1]);
87297
+ return note === void 0 ? PLAIN_FAILURE : { isError: false, note };
87298
+ }
87299
+ __name(judgeExit, "judgeExit");
87300
+
86795
87301
  // ../sdk/dist/tools/builtins/bash.js
86796
87302
  var DEFAULT_BASH_TIMEOUT_MS = readPositiveIntEnv("NAMZU_BASH_TIMEOUT_MS", 2 * 60 * 1e3);
86797
87303
  var DEFAULT_BASH_MAX_BUFFER_BYTES = readPositiveIntEnv("NAMZU_BASH_MAX_BUFFER_BYTES", 100 * 1024 * 1024);
@@ -87200,20 +87706,24 @@ ${result.stdout}` : "",
87200
87706
  ${result.stderr}` : "",
87201
87707
  clipped2.length > 0 ? `[${clipped2.join(" and ")} was truncated by the sandbox output cap. The omitted output is unavailable in this result. Use a saved artifact or a read-only observation; do not repeat a state-changing action to recover its output.]` : ""
87202
87708
  ].filter(Boolean).join("\n\n");
87709
+ const judged = result.timedOut ? void 0 : judgeExit(input.command, result.exitCode);
87710
+ const answered = judged !== void 0 && !judged.isError;
87203
87711
  return {
87204
- success: !result.timedOut && result.exitCode === 0,
87712
+ success: answered,
87205
87713
  output: output || "(no output)",
87206
87714
  data: {
87207
87715
  exitCode: result.exitCode,
87716
+ ...judged?.note ? { exitNote: judged.note } : {},
87208
87717
  sandboxed: true,
87209
87718
  timedOut: result.timedOut,
87210
87719
  stdoutTruncated: result.stdoutTruncated ?? false,
87211
87720
  stderrTruncated: result.stderrTruncated ?? false
87212
87721
  },
87213
- error: result.timedOut ? `Command timed out after ${input.timeout}ms. Any captured output before the deadline is above.` : result.exitCode !== 0 ? `Command exited with code ${result.exitCode}` : void 0,
87722
+ error: result.timedOut ? `Command timed out after ${input.timeout}ms. Any captured output before the deadline is above.` : !answered ? `Command exited with code ${result.exitCode}` : void 0,
87214
87723
  facts: commandFacts({
87215
87724
  command: input.command,
87216
87725
  exitCode: result.exitCode,
87726
+ ...judged?.note ? { exitNote: judged.note } : {},
87217
87727
  timedOut: result.timedOut,
87218
87728
  stdout: result.stdout,
87219
87729
  stderr: result.stderr
@@ -87282,26 +87792,30 @@ ${result.stderr}` : "",
87282
87792
  failure2.stdoutTruncated ? "stdout" : "",
87283
87793
  failure2.stderrTruncated ? "stderr" : ""
87284
87794
  ].filter(Boolean);
87795
+ const judged = !timedOut && exitCode !== void 0 ? judgeExit(input.command, exitCode) : void 0;
87796
+ const answered = judged !== void 0 && !judged.isError;
87285
87797
  const output = [
87286
87798
  formatShellOutput(failure2.stdout, failure2.stderr),
87287
87799
  clipped2.length > 0 ? `[${clipped2.join(" and ")} ${clipped2.length === 1 ? "was" : "were"} truncated by the host output cap. The omitted output is unavailable in this result.]` : "",
87288
- describeWithheldEnv(inherited.dropped)
87800
+ answered ? "" : describeWithheldEnv(inherited.dropped)
87289
87801
  ].filter(Boolean).join("\n\n");
87290
87802
  return {
87291
- success: false,
87803
+ success: answered,
87292
87804
  output: output || "(no output)",
87293
87805
  data: {
87294
87806
  ...exitCode !== void 0 ? { exitCode } : {},
87807
+ ...judged?.note ? { exitNote: judged.note } : {},
87295
87808
  ...leaveSandbox ? { sandboxed: false, sandboxEscape: true } : {},
87296
87809
  timedOut,
87297
87810
  stdoutTruncated: failure2.stdoutTruncated ?? false,
87298
87811
  stderrTruncated: failure2.stderrTruncated ?? false,
87299
87812
  ...failure2.signal ? { signal: failure2.signal } : {}
87300
87813
  },
87301
- error: timedOut ? `Command timed out after ${input.timeout}ms. Any output it produced before the deadline is above.` : exitCode !== void 0 ? `Command exited with code ${exitCode}` : `Command failed: ${failure2.message}`,
87814
+ error: answered ? void 0 : timedOut ? `Command timed out after ${input.timeout}ms. Any output it produced before the deadline is above.` : exitCode !== void 0 ? `Command exited with code ${exitCode}` : `Command failed: ${failure2.message}`,
87302
87815
  facts: commandFacts({
87303
87816
  command: input.command,
87304
87817
  ...exitCode !== void 0 ? { exitCode } : {},
87818
+ ...judged?.note ? { exitNote: judged.note } : {},
87305
87819
  timedOut,
87306
87820
  ...failure2.signal ? { signal: failure2.signal } : {},
87307
87821
  stdout: failure2.stdout ?? "",
@@ -87323,6 +87837,7 @@ function commandFacts(input) {
87323
87837
  kind: "command",
87324
87838
  command: input.command,
87325
87839
  ...input.exitCode !== void 0 ? { exitCode: input.exitCode } : {},
87840
+ ...input.exitNote ? { exitNote: input.exitNote } : {},
87326
87841
  ...input.timedOut ? { timedOut: true } : {},
87327
87842
  ...input.signal ? { signal: input.signal } : {},
87328
87843
  ...input.stdout && !outBinary ? { stdout: windowText(input.stdout, outBytes) } : {},
@@ -92526,7 +93041,7 @@ __name(createBrowserTools, "createBrowserTools");
92526
93041
  function buildDeleteMemoryTool(store) {
92527
93042
  return defineTool({
92528
93043
  name: "delete_memory",
92529
- description: "Permanently delete a stored memory by ID. Use update_memory with status archived when the record should remain available for inspection. Deletion does not erase past conversation transcripts. Pass the revision from read_memory when available to refuse a stale deletion.",
93044
+ description: "Permanently remove a memory by ID, for one that should not be kept at all. Use update_memory with status archived when the record should stay available to inspect. Past conversation transcripts are not changed. Pass the revision from read_memory when available, so a deletion of a memory that changed since you read it is refused. Returns a confirmation.",
92530
93045
  inputSchema: external_exports.object({
92531
93046
  id: external_exports.string().describe("Memory ID to permanently delete"),
92532
93047
  revision: external_exports.string().min(1).optional().describe("Opaque revision from read_memory; refuse deletion if the record changed")
@@ -92594,7 +93109,7 @@ __name(resolveMemoryReference, "resolveMemoryReference");
92594
93109
  function buildReadMemoryTool(store) {
92595
93110
  return defineTool({
92596
93111
  name: "read_memory",
92597
- description: "Read the full content of a specific memory by its ID or its name. For a text or Markdown memory the result ends with how old the memory is and resolves any [[name]] links it contains.",
93112
+ description: "Read one memory in full by its ID or its name. Use it when the index or a search shows that a memory bears on the task. Returns the memory text; a text or Markdown memory ends with how old it is and the memories its [[name]] links point to.",
92598
93113
  inputSchema: external_exports.object({
92599
93114
  id: external_exports.string().describe("Opaque memory ID returned by a memory search or save, or the memory name from the index")
92600
93115
  }),
@@ -92714,11 +93229,12 @@ function buildSaveMemoryTool(store) {
92714
93229
  return defineTool({
92715
93230
  name: "save_memory",
92716
93231
  description: [
92717
- "Save a new memory for future sessions: something true now that a later session could not work out from the code, the git history or the files themselves. Do not save what those already say.",
92718
- "Choose a type: user (who the user is and how they like to work), feedback (a rule the user gave about how to work), project (a fact or decision about the work), reference (where to look for something).",
93232
+ "Save one memory for later sessions in this project: a single fact that the code, the history and the docs do not already hold.",
93233
+ "Choose a type: user (who the person is and how they like to work), feedback (a rule they gave about how to work), project (a fact or decision about the work), reference (where to look for something).",
92719
93234
  'For feedback and project memories, write the rule or fact first, then a line starting "Why:" and a line starting "How to apply:".',
92720
93235
  "Link a related memory by writing [[its-name]] in the content.",
92721
- "If a memory on this already exists, use update_memory instead: a name another memory holds is refused."
93236
+ "The name must be new: a name another memory holds is refused, and the reply points to update_memory.",
93237
+ "Returns the saved memory's id and name."
92722
93238
  ].join(" "),
92723
93239
  inputSchema: external_exports.object({
92724
93240
  title: external_exports.string().min(1).describe("Short descriptive title"),
@@ -92787,7 +93303,7 @@ var MAX_MEMORY_SCAN = 256;
92787
93303
  function defineSearchMemoryTool(search) {
92788
93304
  return defineTool({
92789
93305
  name: "search_memory",
92790
- description: "Search active stored memories by relevant words or tags. The built-in stores rank matches in names, titles, descriptions, summaries and full content. Built-in search examines at most 256 recent candidates per call; if incomplete, continue with the returned scan_offset. Use read_memory for evidence. Set status to archived to inspect obsolete records.",
93306
+ description: "Find stored memories by words or tags. Use it when the topic is not in the index, before saving (to see whether a memory already covers it), and to reach what earlier turns recorded on their own. Matches are ranked across names, titles, descriptions, summaries and content; one call examines at most 256 recent candidates, and an incomplete result returns a scan_offset to continue from. Set status to archived to look at retired memories. Returns a numbered list with each memory's id, title, type and description; open one with read_memory.",
92791
93307
  inputSchema: external_exports.object({
92792
93308
  query: external_exports.string().optional().describe("Relevant words or identifiers to search"),
92793
93309
  tags: external_exports.array(external_exports.string()).optional().describe("Filter by tags (all must match)"),
@@ -92860,7 +93376,7 @@ __name(buildStoreSearchMemoryTool, "buildStoreSearchMemoryTool");
92860
93376
  function buildUpdateMemoryTool(store) {
92861
93377
  return defineTool({
92862
93378
  name: "update_memory",
92863
- description: "Correct an existing memory in place, or archive an obsolete claim so it is no longer recalled. Prefer this to saving a second memory about the same thing. Identify it by the ID from search_memory or by its name from the memory index; current evidence should determine corrections. Pass the revision from read_memory when available to refuse a stale correction.",
93379
+ description: "Correct a memory in place, or archive one that is no longer true so it stops being recalled. Use it when a memory on the same topic already exists, which keeps the store free of duplicates, and when current evidence shows a memory is wrong. Identify the memory by the ID from search_memory or by its name from the index. Pass the revision from read_memory when available, so a change made since you read it is refused instead of overwritten. Returns the memory as it now stands.",
92864
93380
  inputSchema: external_exports.object({
92865
93381
  id: external_exports.string().describe("Memory ID, or the memory name from the index, to correct or archive"),
92866
93382
  revision: external_exports.string().min(1).optional().describe("Opaque revision from read_memory; refuse the update if the record changed"),
@@ -93559,7 +94075,12 @@ var FAILURE_REASONS = [
93559
94075
  "needs_administrator",
93560
94076
  "unknown_tool",
93561
94077
  "timed_out",
93562
- "invalid_input"
94078
+ "invalid_input",
94079
+ "not_read",
94080
+ "changed_on_disk",
94081
+ "text_not_found",
94082
+ "not_unique",
94083
+ "invalid_arguments"
93563
94084
  ];
93564
94085
  var WRITE_OPERATIONS = ["created", "updated", "unchanged", "wrote"];
93565
94086
  var MAX_TEXT = 2e3;
@@ -93628,6 +94149,7 @@ function admitToolFacts(value) {
93628
94149
  kind: "command",
93629
94150
  command: text8(value.command),
93630
94151
  exitCode: typeof value.exitCode === "number" && Number.isSafeInteger(value.exitCode) ? value.exitCode : void 0,
94152
+ exitNote: text8(value.exitNote),
93631
94153
  timedOut: flag(value.timedOut),
93632
94154
  signal: text8(value.signal),
93633
94155
  binary: isRecord4(value.binary) && count6(value.binary.bytes) !== void 0 ? { bytes: count6(value.binary.bytes) } : void 0,
@@ -93924,6 +94446,7 @@ export {
93924
94446
  PromptContributionRegistry,
93925
94447
  resolveProviderCapabilities,
93926
94448
  modelReadsImages,
94449
+ estimateTextTokens,
93927
94450
  SearchToolsTool,
93928
94451
  isTerminalTaskStatus,
93929
94452
  selectTaskContext,
@@ -93980,6 +94503,7 @@ export {
93980
94503
  DiskSessionCheckpointStore,
93981
94504
  createFileReadTracker,
93982
94505
  diffWords,
94506
+ diffLines,
93983
94507
  structuredPatch,
93984
94508
  dryRunEdit,
93985
94509
  seedObservationLedger,
@@ -93991,8 +94515,11 @@ export {
93991
94515
  resumeSession,
93992
94516
  openSessionIndex,
93993
94517
  abandonTurn,
94518
+ CacheClock,
93994
94519
  compactNow,
94520
+ compactRegion,
93995
94521
  compactSession,
94522
+ compactSessionRange,
93996
94523
  DEFAULT_GATE_MAX_RETRIES,
93997
94524
  createCommandGate,
93998
94525
  createMemoryPromoter,
@@ -94066,6 +94593,8 @@ export {
94066
94593
  createResidentStepContributions,
94067
94594
  createResidentStepContext,
94068
94595
  loadPty,
94596
+ describeToolCatalogTokens,
94597
+ analyzeContextUsage,
94069
94598
  ResidentConflictError,
94070
94599
  DiskResidentAgenda,
94071
94600
  inspectResidentConsumption,
@@ -94141,4 +94670,4 @@ export {
94141
94670
  buildResidentToolEvidenceTools,
94142
94671
  createPalMessagingTools
94143
94672
  };
94144
- //# sourceMappingURL=chunk-OPIC6ZIL.js.map
94673
+ //# sourceMappingURL=chunk-D63T5UQN.js.map