@namzu/cli 39.0.0 → 39.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 (236) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-NZITIX4C.js → acp-OOJ6EBDV.js} +35 -35
  4. package/dist/chunks/{activity-command-NKOTZ5FK.js → activity-command-H7YPFJXX.js} +11 -11
  5. package/dist/chunks/{add-AONYUNXG.js → add-E46I4MLS.js} +15 -15
  6. package/dist/chunks/{agent-YPKFE66C.js → agent-A3IFU43K.js} +26 -26
  7. package/dist/chunks/agent-session-V7NDZWPF.js +53 -0
  8. package/dist/chunks/{archive-SUE5OUZZ.js → archive-FWKUN3JD.js} +9 -9
  9. package/dist/chunks/{bin-main-55PUHGTA.js → bin-main-YOWKMTAT.js} +3 -3
  10. package/dist/chunks/{browser-HYPSUDAZ.js → browser-ZISCIIZG.js} +6 -6
  11. package/dist/chunks/{chat-6OULID33.js → chat-JNYLC4XC.js} +14 -14
  12. package/dist/chunks/{chunk-E3HCZYGN.js → chunk-2SPJH5HF.js} +3 -3
  13. package/dist/chunks/{chunk-ID334ALD.js → chunk-2ZRQG2PH.js} +28 -28
  14. package/dist/chunks/{chunk-DFA5OB46.js → chunk-52NW6KXV.js} +4 -4
  15. package/dist/chunks/{chunk-IAYIUJMI.js → chunk-5ED3H3C7.js} +2 -2
  16. package/dist/chunks/{chunk-OLOTFDTU.js → chunk-5WZ63LBF.js} +2 -2
  17. package/dist/chunks/{chunk-263WNQB4.js → chunk-5Y3XJ2QD.js} +9 -9
  18. package/dist/chunks/{chunk-FBNKKDIY.js → chunk-62GB6STC.js} +4 -4
  19. package/dist/chunks/{chunk-W27ZDC4R.js → chunk-65L26A6S.js} +4 -4
  20. package/dist/chunks/{chunk-2VMMTC2V.js → chunk-6E2F73CY.js} +2 -2
  21. package/dist/chunks/{chunk-RB36O3CE.js → chunk-7T6O6HZO.js} +2 -2
  22. package/dist/chunks/{chunk-EA6SWPO4.js → chunk-A2PPMNCN.js} +4 -4
  23. package/dist/chunks/{chunk-N3FI7O4U.js → chunk-AJMJHLWZ.js} +2 -2
  24. package/dist/chunks/{chunk-UBOPUGDN.js → chunk-ARILZQYC.js} +5 -5
  25. package/dist/chunks/{chunk-MCNEFI5Q.js → chunk-AWDFNOGP.js} +2 -2
  26. package/dist/chunks/{chunk-OXJEMOBQ.js → chunk-AZCFI7C6.js} +671 -149
  27. package/dist/chunks/chunk-AZCFI7C6.js.map +6 -0
  28. package/dist/chunks/{chunk-GU5YARBU.js → chunk-BD7DGINR.js} +4 -4
  29. package/dist/chunks/{chunk-EUU4TDTH.js → chunk-BTSYFCBK.js} +2 -2
  30. package/dist/chunks/{chunk-3JB5NDB4.js → chunk-BVUYBGWV.js} +6 -6
  31. package/dist/chunks/{chunk-5CGH647C.js → chunk-COI6QKBD.js} +5 -5
  32. package/dist/chunks/{chunk-TJTRVZFN.js → chunk-CWFDC3IX.js} +2 -2
  33. package/dist/chunks/{chunk-XJ4IUCH6.js → chunk-D24BFQ2R.js} +13 -13
  34. package/dist/chunks/{chunk-7YXHOSHD.js → chunk-D57LFZYV.js} +3 -3
  35. package/dist/chunks/{chunk-CL5TCY4F.js → chunk-DEYB7GQW.js} +2 -2
  36. package/dist/chunks/{chunk-AZ3YHVFA.js → chunk-DJCBJ4D2.js} +2 -2
  37. package/dist/chunks/{chunk-B2357ETN.js → chunk-DK6MIKJ5.js} +7 -7
  38. package/dist/chunks/{chunk-N72DH6D5.js → chunk-DQIPEDOM.js} +2 -2
  39. package/dist/chunks/{chunk-SBPCN24X.js → chunk-EWD65LWA.js} +2 -2
  40. package/dist/chunks/{chunk-NLKIBRXJ.js → chunk-FCM3BH55.js} +3 -3
  41. package/dist/chunks/{chunk-47TGPZWD.js → chunk-FEANPQH4.js} +3 -3
  42. package/dist/chunks/{chunk-HU35YAIZ.js → chunk-FZZU6FGO.js} +2 -2
  43. package/dist/chunks/{chunk-233DQVSC.js → chunk-J3JUC6J6.js} +6 -6
  44. package/dist/chunks/{chunk-UZCA37QE.js → chunk-JBI7VU5W.js} +2 -2
  45. package/dist/chunks/{chunk-Z7XA4Y43.js → chunk-JC37Z4C2.js} +3 -3
  46. package/dist/chunks/{chunk-4K2NRXHJ.js → chunk-JPWIGZJ4.js} +2 -2
  47. package/dist/chunks/{chunk-UIDLXA2K.js → chunk-K2WHGUA7.js} +2 -2
  48. package/dist/chunks/{chunk-7EASYULO.js → chunk-KG5YQMJ7.js} +8 -8
  49. package/dist/chunks/{chunk-UTMGJDC3.js → chunk-KVYTZCCO.js} +2 -2
  50. package/dist/chunks/{chunk-FQZFVLJB.js → chunk-KYEHKRUB.js} +4 -4
  51. package/dist/chunks/{chunk-II57E2QW.js → chunk-L4M6ZSF6.js} +4 -4
  52. package/dist/chunks/{chunk-UUUNXKL3.js → chunk-LNANLHGE.js} +3 -3
  53. package/dist/chunks/{chunk-CUOWARJI.js → chunk-MD7SYK6K.js} +2 -2
  54. package/dist/chunks/{chunk-YKEPC6NH.js → chunk-OIRKBC2L.js} +3 -3
  55. package/dist/chunks/{chunk-3OAGXDRM.js → chunk-P5GCOEET.js} +4 -4
  56. package/dist/chunks/{chunk-2WQFRVVQ.js → chunk-Q733LA67.js} +4 -4
  57. package/dist/chunks/{chunk-2KKF45DQ.js → chunk-QGU3QOXI.js} +2 -2
  58. package/dist/chunks/{chunk-QNF6COCY.js → chunk-RGCA3YZA.js} +2 -2
  59. package/dist/chunks/{chunk-RQBT4RVE.js → chunk-RKMGVFLZ.js} +657 -308
  60. package/dist/chunks/chunk-RKMGVFLZ.js.map +6 -0
  61. package/dist/chunks/{chunk-T75ITEN6.js → chunk-S7HFDW5W.js} +3 -3
  62. package/dist/chunks/{chunk-BEFTUDYP.js → chunk-SN4RRU3A.js} +7 -7
  63. package/dist/chunks/{chunk-SIK62TDI.js → chunk-TAWI7GF2.js} +2 -2
  64. package/dist/chunks/{chunk-CZEU2JYJ.js → chunk-TQ2PH66J.js} +3 -3
  65. package/dist/chunks/{chunk-LFVQSMJG.js → chunk-U4A4C4GE.js} +4 -4
  66. package/dist/chunks/{chunk-XEHLRJXR.js → chunk-UJ7NTALX.js} +12 -12
  67. package/dist/chunks/{chunk-HV77F4SF.js → chunk-VPDXH3ZZ.js} +3 -3
  68. package/dist/chunks/{chunk-HI2KXIGA.js → chunk-XJMHPZGJ.js} +3 -3
  69. package/dist/chunks/{chunk-74U3P65Q.js → chunk-XRLM7PL2.js} +12 -12
  70. package/dist/chunks/{chunk-P2Y4LUPJ.js → chunk-YN5PDLFB.js} +2 -2
  71. package/dist/chunks/{chunk-QO5JUKFG.js → chunk-ZGL3HYDE.js} +2 -2
  72. package/dist/chunks/{cli-runtime-G3FHYTCI.js → cli-runtime-KFHNZS4M.js} +10 -10
  73. package/dist/chunks/{commands-TIRZH2TK.js → commands-7FSE67S7.js} +5 -5
  74. package/dist/chunks/{crash-report-E4J7KQ32.js → crash-report-5S6I2H4P.js} +6 -6
  75. package/dist/chunks/{dist-CVDGKJEI.js → dist-2QEEO2BO.js} +2 -2
  76. package/dist/chunks/{dist-2U6NNEPY.js → dist-BMP4NVQA.js} +2 -2
  77. package/dist/chunks/{dist-QHKTYYMX.js → dist-EC2S5MA6.js} +2 -2
  78. package/dist/chunks/{dist-YX7Q3EJR.js → dist-KGS4QDJL.js} +2 -2
  79. package/dist/chunks/{dist-MKQZKCB4.js → dist-MLM3PBXB.js} +2 -2
  80. package/dist/chunks/{dist-2IUQEIEI.js → dist-VMJECBAZ.js} +2 -2
  81. package/dist/chunks/{dist-QCKKBLDW.js → dist-ZHD7MSXC.js} +2 -2
  82. package/dist/chunks/{doctor-ASXICRC5.js → doctor-P67RCEDL.js} +8 -8
  83. package/dist/chunks/{drain-CGS3KBU3.js → drain-GXTL5M2V.js} +10 -10
  84. package/dist/chunks/{eval-XWC3UCFI.js → eval-TGCAUXM6.js} +2 -2
  85. package/dist/chunks/{exec-FOUQBA6I.js → exec-KGTWE4LA.js} +25 -25
  86. package/dist/chunks/{home-76YLI2M6.js → home-PZO47UU7.js} +3 -3
  87. package/dist/chunks/{host-queries-ODUQHYBN.js → host-queries-QOFBCKMJ.js} +14 -14
  88. package/dist/chunks/{lifecycle-JN43XQSS.js → lifecycle-DPH2KOCH.js} +23 -23
  89. package/dist/chunks/{list-TC7TYJDR.js → list-ILFBHQS7.js} +11 -11
  90. package/dist/chunks/{login-CTC6CAM4.js → login-EUEB5HLK.js} +8 -8
  91. package/dist/chunks/{logs-2NGJFIQI.js → logs-F2II4CCT.js} +4 -4
  92. package/dist/chunks/{mcp-BPH7KWZ6.js → mcp-KPJ7KVE4.js} +16 -16
  93. package/dist/chunks/{message-command-A4XU7QQQ.js → message-command-I3J5NA35.js} +32 -32
  94. package/dist/chunks/{operator-tools-6RYAHVSL.js → operator-tools-2SI6AFFF.js} +12 -12
  95. package/dist/chunks/{output-schema-GSWZHKSI.js → output-schema-PJNYSOO5.js} +3 -3
  96. package/dist/chunks/{pal-4QXXG42H.js → pal-7ILZQGYB.js} +11 -11
  97. package/dist/chunks/{providers-6PIIF3WR.js → providers-MD4HAS6J.js} +6 -6
  98. package/dist/chunks/{resident-UP7W6MV6.js → resident-HVI3YGHH.js} +20 -20
  99. package/dist/chunks/resume-R2OYMKYY.js +22 -0
  100. package/dist/chunks/{resume-command-2RFT7AGW.js → resume-command-EVY3VMMM.js} +4 -4
  101. package/dist/chunks/{schedule-FZISVF6A.js → schedule-QCGOB5T2.js} +8 -8
  102. package/dist/chunks/{service-4WADXOUI.js → service-MVQA56RE.js} +22 -22
  103. package/dist/chunks/session-step-XAOTLL4U.js +29 -0
  104. package/dist/chunks/{skills-BJQGVQ23.js → skills-MTR3YGWW.js} +8 -8
  105. package/dist/chunks/{state-2KKVQPZ2.js → state-5GSLSGR2.js} +2 -2
  106. package/dist/chunks/{store-YFTJ24WU.js → store-P2I5OF2S.js} +4 -4
  107. package/dist/chunks/{store-LO4SSRYI.js → store-SQUUV4YQ.js} +9 -9
  108. package/dist/chunks/{store-TKJKR5NM.js → store-UMSGE2UE.js} +6 -6
  109. package/dist/chunks/{tui-HA3JIVON.js → tui-5EKXXN5S.js} +270 -88
  110. package/dist/chunks/{tui-HA3JIVON.js.map → tui-5EKXXN5S.js.map} +2 -2
  111. package/dist/chunks/{upgrade-3QLPPCII.js → upgrade-OZE2Z2OV.js} +2 -2
  112. package/dist/chunks/{worktree-3HYAYSGW.js → worktree-452AXJPV.js} +11 -11
  113. package/dist/index.js +12 -12
  114. package/dist/integrations/resident/runner-worker.js +18 -18
  115. package/dist/integrations/sessions/conversation-search.d.ts +10 -1
  116. package/dist/integrations/sessions/conversation-search.d.ts.map +1 -1
  117. package/dist/integrations/subagents/runtime.d.ts +3 -1
  118. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  119. package/dist/integrations/subagents/saved-agents.d.ts +7 -5
  120. package/dist/integrations/subagents/saved-agents.d.ts.map +1 -1
  121. package/dist/tui/App.d.ts.map +1 -1
  122. package/dist/tui/PermissionOverlay.d.ts +9 -2
  123. package/dist/tui/PermissionOverlay.d.ts.map +1 -1
  124. package/dist/tui/agent.d.ts.map +1 -1
  125. package/dist/tui/permission-review.d.ts +75 -18
  126. package/dist/tui/permission-review.d.ts.map +1 -1
  127. package/package.json +8 -8
  128. package/dist/chunks/agent-session-HFOLAFFL.js +0 -53
  129. package/dist/chunks/chunk-OXJEMOBQ.js.map +0 -6
  130. package/dist/chunks/chunk-RQBT4RVE.js.map +0 -6
  131. package/dist/chunks/resume-GJHTPMJS.js +0 -22
  132. package/dist/chunks/session-step-FX6B4TSE.js +0 -29
  133. /package/dist/chunks/{acp-NZITIX4C.js.map → acp-OOJ6EBDV.js.map} +0 -0
  134. /package/dist/chunks/{activity-command-NKOTZ5FK.js.map → activity-command-H7YPFJXX.js.map} +0 -0
  135. /package/dist/chunks/{add-AONYUNXG.js.map → add-E46I4MLS.js.map} +0 -0
  136. /package/dist/chunks/{agent-YPKFE66C.js.map → agent-A3IFU43K.js.map} +0 -0
  137. /package/dist/chunks/{agent-session-HFOLAFFL.js.map → agent-session-V7NDZWPF.js.map} +0 -0
  138. /package/dist/chunks/{archive-SUE5OUZZ.js.map → archive-FWKUN3JD.js.map} +0 -0
  139. /package/dist/chunks/{bin-main-55PUHGTA.js.map → bin-main-YOWKMTAT.js.map} +0 -0
  140. /package/dist/chunks/{browser-HYPSUDAZ.js.map → browser-ZISCIIZG.js.map} +0 -0
  141. /package/dist/chunks/{chat-6OULID33.js.map → chat-JNYLC4XC.js.map} +0 -0
  142. /package/dist/chunks/{chunk-E3HCZYGN.js.map → chunk-2SPJH5HF.js.map} +0 -0
  143. /package/dist/chunks/{chunk-ID334ALD.js.map → chunk-2ZRQG2PH.js.map} +0 -0
  144. /package/dist/chunks/{chunk-DFA5OB46.js.map → chunk-52NW6KXV.js.map} +0 -0
  145. /package/dist/chunks/{chunk-IAYIUJMI.js.map → chunk-5ED3H3C7.js.map} +0 -0
  146. /package/dist/chunks/{chunk-OLOTFDTU.js.map → chunk-5WZ63LBF.js.map} +0 -0
  147. /package/dist/chunks/{chunk-263WNQB4.js.map → chunk-5Y3XJ2QD.js.map} +0 -0
  148. /package/dist/chunks/{chunk-FBNKKDIY.js.map → chunk-62GB6STC.js.map} +0 -0
  149. /package/dist/chunks/{chunk-W27ZDC4R.js.map → chunk-65L26A6S.js.map} +0 -0
  150. /package/dist/chunks/{chunk-2VMMTC2V.js.map → chunk-6E2F73CY.js.map} +0 -0
  151. /package/dist/chunks/{chunk-RB36O3CE.js.map → chunk-7T6O6HZO.js.map} +0 -0
  152. /package/dist/chunks/{chunk-EA6SWPO4.js.map → chunk-A2PPMNCN.js.map} +0 -0
  153. /package/dist/chunks/{chunk-N3FI7O4U.js.map → chunk-AJMJHLWZ.js.map} +0 -0
  154. /package/dist/chunks/{chunk-UBOPUGDN.js.map → chunk-ARILZQYC.js.map} +0 -0
  155. /package/dist/chunks/{chunk-MCNEFI5Q.js.map → chunk-AWDFNOGP.js.map} +0 -0
  156. /package/dist/chunks/{chunk-GU5YARBU.js.map → chunk-BD7DGINR.js.map} +0 -0
  157. /package/dist/chunks/{chunk-EUU4TDTH.js.map → chunk-BTSYFCBK.js.map} +0 -0
  158. /package/dist/chunks/{chunk-3JB5NDB4.js.map → chunk-BVUYBGWV.js.map} +0 -0
  159. /package/dist/chunks/{chunk-5CGH647C.js.map → chunk-COI6QKBD.js.map} +0 -0
  160. /package/dist/chunks/{chunk-TJTRVZFN.js.map → chunk-CWFDC3IX.js.map} +0 -0
  161. /package/dist/chunks/{chunk-XJ4IUCH6.js.map → chunk-D24BFQ2R.js.map} +0 -0
  162. /package/dist/chunks/{chunk-7YXHOSHD.js.map → chunk-D57LFZYV.js.map} +0 -0
  163. /package/dist/chunks/{chunk-CL5TCY4F.js.map → chunk-DEYB7GQW.js.map} +0 -0
  164. /package/dist/chunks/{chunk-AZ3YHVFA.js.map → chunk-DJCBJ4D2.js.map} +0 -0
  165. /package/dist/chunks/{chunk-B2357ETN.js.map → chunk-DK6MIKJ5.js.map} +0 -0
  166. /package/dist/chunks/{chunk-N72DH6D5.js.map → chunk-DQIPEDOM.js.map} +0 -0
  167. /package/dist/chunks/{chunk-SBPCN24X.js.map → chunk-EWD65LWA.js.map} +0 -0
  168. /package/dist/chunks/{chunk-NLKIBRXJ.js.map → chunk-FCM3BH55.js.map} +0 -0
  169. /package/dist/chunks/{chunk-47TGPZWD.js.map → chunk-FEANPQH4.js.map} +0 -0
  170. /package/dist/chunks/{chunk-HU35YAIZ.js.map → chunk-FZZU6FGO.js.map} +0 -0
  171. /package/dist/chunks/{chunk-233DQVSC.js.map → chunk-J3JUC6J6.js.map} +0 -0
  172. /package/dist/chunks/{chunk-UZCA37QE.js.map → chunk-JBI7VU5W.js.map} +0 -0
  173. /package/dist/chunks/{chunk-Z7XA4Y43.js.map → chunk-JC37Z4C2.js.map} +0 -0
  174. /package/dist/chunks/{chunk-4K2NRXHJ.js.map → chunk-JPWIGZJ4.js.map} +0 -0
  175. /package/dist/chunks/{chunk-UIDLXA2K.js.map → chunk-K2WHGUA7.js.map} +0 -0
  176. /package/dist/chunks/{chunk-7EASYULO.js.map → chunk-KG5YQMJ7.js.map} +0 -0
  177. /package/dist/chunks/{chunk-UTMGJDC3.js.map → chunk-KVYTZCCO.js.map} +0 -0
  178. /package/dist/chunks/{chunk-FQZFVLJB.js.map → chunk-KYEHKRUB.js.map} +0 -0
  179. /package/dist/chunks/{chunk-II57E2QW.js.map → chunk-L4M6ZSF6.js.map} +0 -0
  180. /package/dist/chunks/{chunk-UUUNXKL3.js.map → chunk-LNANLHGE.js.map} +0 -0
  181. /package/dist/chunks/{chunk-CUOWARJI.js.map → chunk-MD7SYK6K.js.map} +0 -0
  182. /package/dist/chunks/{chunk-YKEPC6NH.js.map → chunk-OIRKBC2L.js.map} +0 -0
  183. /package/dist/chunks/{chunk-3OAGXDRM.js.map → chunk-P5GCOEET.js.map} +0 -0
  184. /package/dist/chunks/{chunk-2WQFRVVQ.js.map → chunk-Q733LA67.js.map} +0 -0
  185. /package/dist/chunks/{chunk-2KKF45DQ.js.map → chunk-QGU3QOXI.js.map} +0 -0
  186. /package/dist/chunks/{chunk-QNF6COCY.js.map → chunk-RGCA3YZA.js.map} +0 -0
  187. /package/dist/chunks/{chunk-T75ITEN6.js.map → chunk-S7HFDW5W.js.map} +0 -0
  188. /package/dist/chunks/{chunk-BEFTUDYP.js.map → chunk-SN4RRU3A.js.map} +0 -0
  189. /package/dist/chunks/{chunk-SIK62TDI.js.map → chunk-TAWI7GF2.js.map} +0 -0
  190. /package/dist/chunks/{chunk-CZEU2JYJ.js.map → chunk-TQ2PH66J.js.map} +0 -0
  191. /package/dist/chunks/{chunk-LFVQSMJG.js.map → chunk-U4A4C4GE.js.map} +0 -0
  192. /package/dist/chunks/{chunk-XEHLRJXR.js.map → chunk-UJ7NTALX.js.map} +0 -0
  193. /package/dist/chunks/{chunk-HV77F4SF.js.map → chunk-VPDXH3ZZ.js.map} +0 -0
  194. /package/dist/chunks/{chunk-HI2KXIGA.js.map → chunk-XJMHPZGJ.js.map} +0 -0
  195. /package/dist/chunks/{chunk-74U3P65Q.js.map → chunk-XRLM7PL2.js.map} +0 -0
  196. /package/dist/chunks/{chunk-P2Y4LUPJ.js.map → chunk-YN5PDLFB.js.map} +0 -0
  197. /package/dist/chunks/{chunk-QO5JUKFG.js.map → chunk-ZGL3HYDE.js.map} +0 -0
  198. /package/dist/chunks/{cli-runtime-G3FHYTCI.js.map → cli-runtime-KFHNZS4M.js.map} +0 -0
  199. /package/dist/chunks/{commands-TIRZH2TK.js.map → commands-7FSE67S7.js.map} +0 -0
  200. /package/dist/chunks/{crash-report-E4J7KQ32.js.map → crash-report-5S6I2H4P.js.map} +0 -0
  201. /package/dist/chunks/{dist-CVDGKJEI.js.map → dist-2QEEO2BO.js.map} +0 -0
  202. /package/dist/chunks/{dist-2U6NNEPY.js.map → dist-BMP4NVQA.js.map} +0 -0
  203. /package/dist/chunks/{dist-QHKTYYMX.js.map → dist-EC2S5MA6.js.map} +0 -0
  204. /package/dist/chunks/{dist-YX7Q3EJR.js.map → dist-KGS4QDJL.js.map} +0 -0
  205. /package/dist/chunks/{dist-MKQZKCB4.js.map → dist-MLM3PBXB.js.map} +0 -0
  206. /package/dist/chunks/{dist-2IUQEIEI.js.map → dist-VMJECBAZ.js.map} +0 -0
  207. /package/dist/chunks/{dist-QCKKBLDW.js.map → dist-ZHD7MSXC.js.map} +0 -0
  208. /package/dist/chunks/{doctor-ASXICRC5.js.map → doctor-P67RCEDL.js.map} +0 -0
  209. /package/dist/chunks/{drain-CGS3KBU3.js.map → drain-GXTL5M2V.js.map} +0 -0
  210. /package/dist/chunks/{eval-XWC3UCFI.js.map → eval-TGCAUXM6.js.map} +0 -0
  211. /package/dist/chunks/{exec-FOUQBA6I.js.map → exec-KGTWE4LA.js.map} +0 -0
  212. /package/dist/chunks/{home-76YLI2M6.js.map → home-PZO47UU7.js.map} +0 -0
  213. /package/dist/chunks/{host-queries-ODUQHYBN.js.map → host-queries-QOFBCKMJ.js.map} +0 -0
  214. /package/dist/chunks/{lifecycle-JN43XQSS.js.map → lifecycle-DPH2KOCH.js.map} +0 -0
  215. /package/dist/chunks/{list-TC7TYJDR.js.map → list-ILFBHQS7.js.map} +0 -0
  216. /package/dist/chunks/{login-CTC6CAM4.js.map → login-EUEB5HLK.js.map} +0 -0
  217. /package/dist/chunks/{logs-2NGJFIQI.js.map → logs-F2II4CCT.js.map} +0 -0
  218. /package/dist/chunks/{mcp-BPH7KWZ6.js.map → mcp-KPJ7KVE4.js.map} +0 -0
  219. /package/dist/chunks/{message-command-A4XU7QQQ.js.map → message-command-I3J5NA35.js.map} +0 -0
  220. /package/dist/chunks/{operator-tools-6RYAHVSL.js.map → operator-tools-2SI6AFFF.js.map} +0 -0
  221. /package/dist/chunks/{output-schema-GSWZHKSI.js.map → output-schema-PJNYSOO5.js.map} +0 -0
  222. /package/dist/chunks/{pal-4QXXG42H.js.map → pal-7ILZQGYB.js.map} +0 -0
  223. /package/dist/chunks/{providers-6PIIF3WR.js.map → providers-MD4HAS6J.js.map} +0 -0
  224. /package/dist/chunks/{resident-UP7W6MV6.js.map → resident-HVI3YGHH.js.map} +0 -0
  225. /package/dist/chunks/{resume-GJHTPMJS.js.map → resume-R2OYMKYY.js.map} +0 -0
  226. /package/dist/chunks/{resume-command-2RFT7AGW.js.map → resume-command-EVY3VMMM.js.map} +0 -0
  227. /package/dist/chunks/{schedule-FZISVF6A.js.map → schedule-QCGOB5T2.js.map} +0 -0
  228. /package/dist/chunks/{service-4WADXOUI.js.map → service-MVQA56RE.js.map} +0 -0
  229. /package/dist/chunks/{session-step-FX6B4TSE.js.map → session-step-XAOTLL4U.js.map} +0 -0
  230. /package/dist/chunks/{skills-BJQGVQ23.js.map → skills-MTR3YGWW.js.map} +0 -0
  231. /package/dist/chunks/{state-2KKVQPZ2.js.map → state-5GSLSGR2.js.map} +0 -0
  232. /package/dist/chunks/{store-LO4SSRYI.js.map → store-P2I5OF2S.js.map} +0 -0
  233. /package/dist/chunks/{store-TKJKR5NM.js.map → store-SQUUV4YQ.js.map} +0 -0
  234. /package/dist/chunks/{store-YFTJ24WU.js.map → store-UMSGE2UE.js.map} +0 -0
  235. /package/dist/chunks/{upgrade-3QLPPCII.js.map → upgrade-OZE2Z2OV.js.map} +0 -0
  236. /package/dist/chunks/{worktree-3HYAYSGW.js.map → worktree-452AXJPV.js.map} +0 -0
@@ -641,8 +641,8 @@ function windowsEnv(env, name2) {
641
641
  }
642
642
  __name(windowsEnv, "windowsEnv");
643
643
  function insideDirectory(path2, directory) {
644
- const relative10 = win32.relative(directory, path2);
645
- return relative10 === "" || !relative10.startsWith("..") && !win32.isAbsolute(relative10);
644
+ const relative11 = win32.relative(directory, path2);
645
+ return relative11 === "" || !relative11.startsWith("..") && !win32.isAbsolute(relative11);
646
646
  }
647
647
  __name(insideDirectory, "insideDirectory");
648
648
  function findGitBash(probe2) {
@@ -1366,13 +1366,13 @@ var GuardedFetchProvider = class {
1366
1366
  operation.throwIfStopped();
1367
1367
  return url;
1368
1368
  }
1369
- const resolve27 = this.config.resolve ?? (async (name2) => (await lookup(name2, { all: true })).map((r) => r.address));
1369
+ const resolve28 = this.config.resolve ?? (async (name2) => (await lookup(name2, { all: true })).map((r) => r.address));
1370
1370
  let addresses;
1371
1371
  if (isIP(hostname)) {
1372
1372
  addresses = [hostname];
1373
1373
  } else {
1374
1374
  try {
1375
- addresses = await operation.run(() => resolve27(hostname, operation.signal));
1375
+ addresses = await operation.run(() => resolve28(hostname, operation.signal));
1376
1376
  } catch (err) {
1377
1377
  operation.throwIfStopped();
1378
1378
  throw new WebFetchRefusedError(`Refused "${hostname}" \u2014 it could not be resolved (${err instanceof Error ? err.message : String(err)}), so nothing here can say where it points.`, { url: rawUrl, reason: "private-address" });
@@ -6392,9 +6392,9 @@ async function vetWebSocketTarget(raw, options = {}) {
6392
6392
  if (literal !== 0) {
6393
6393
  addresses = [hostname];
6394
6394
  } else {
6395
- const resolve27 = options.resolve ?? (async (name2) => (await dnsLookup(name2, { all: true })).map((r) => r.address));
6395
+ const resolve28 = options.resolve ?? (async (name2) => (await dnsLookup(name2, { all: true })).map((r) => r.address));
6396
6396
  try {
6397
- addresses = await resolve27(hostname);
6397
+ addresses = await resolve28(hostname);
6398
6398
  } catch (err) {
6399
6399
  throw new WebSocketRefusedError(`Refused "${hostname}": it could not be resolved (${err instanceof Error ? err.message : String(err)}), so nothing here can say where it points.`);
6400
6400
  }
@@ -6820,8 +6820,8 @@ var BackgroundJobRegistry = class {
6820
6820
  };
6821
6821
  let startError;
6822
6822
  let settleStarted;
6823
- const startedPromise = new Promise((resolve27) => {
6824
- settleStarted = /* @__PURE__ */ __name(() => resolve27(startError === void 0 ? {} : { error: startError }), "settleStarted");
6823
+ const startedPromise = new Promise((resolve28) => {
6824
+ settleStarted = /* @__PURE__ */ __name(() => resolve28(startError === void 0 ? {} : { error: startError }), "settleStarted");
6825
6825
  });
6826
6826
  if (params.spawn || child.pid !== void 0)
6827
6827
  settleStarted();
@@ -6867,7 +6867,7 @@ var BackgroundJobRegistry = class {
6867
6867
  outputChunks: [],
6868
6868
  outputObservers: /* @__PURE__ */ new Set(),
6869
6869
  started: startedPromise,
6870
- exit: new Promise((resolve27) => {
6870
+ exit: new Promise((resolve28) => {
6871
6871
  let spawned = child.pid !== void 0;
6872
6872
  let failedToSpawn = false;
6873
6873
  let finalized = false;
@@ -6885,7 +6885,7 @@ var BackgroundJobRegistry = class {
6885
6885
  ...code === null ? {} : { exitCode: code },
6886
6886
  ...signal ? { signal } : {}
6887
6887
  };
6888
- resolve27();
6888
+ resolve28();
6889
6889
  for (const observer of entry.outputObservers)
6890
6890
  observer();
6891
6891
  if (entry.monitor) {
@@ -7058,7 +7058,7 @@ var BackgroundJobRegistry = class {
7058
7058
  const signal = opts.signal;
7059
7059
  if (signal.aborted)
7060
7060
  return Promise.reject(signal.reason);
7061
- return new Promise((resolve27, reject2) => {
7061
+ return new Promise((resolve28, reject2) => {
7062
7062
  let disposeAbort = /* @__PURE__ */ __name(() => {
7063
7063
  }, "disposeAbort");
7064
7064
  const unsubscribe = this.onExit((job) => {
@@ -7066,7 +7066,7 @@ var BackgroundJobRegistry = class {
7066
7066
  return;
7067
7067
  unsubscribe();
7068
7068
  disposeAbort();
7069
- resolve27(job);
7069
+ resolve28(job);
7070
7070
  });
7071
7071
  disposeAbort = subscribeToAbort(signal, () => {
7072
7072
  unsubscribe();
@@ -7163,7 +7163,7 @@ var BackgroundJobRegistry = class {
7163
7163
  throw new BackgroundJobOutputWaitLimitError({ owner, limit: globalLimit, scope: "registry" });
7164
7164
  this.outputWaiters++;
7165
7165
  this.outputWaitersByOwner.set(owner, ownerCount + 1);
7166
- return new Promise((resolve27) => {
7166
+ return new Promise((resolve28) => {
7167
7167
  const startedAt = Date.now();
7168
7168
  let settled = false;
7169
7169
  let disposeAbort = /* @__PURE__ */ __name(() => {
@@ -7183,7 +7183,7 @@ var BackgroundJobRegistry = class {
7183
7183
  this.outputWaitersByOwner.delete(owner);
7184
7184
  else
7185
7185
  this.outputWaitersByOwner.set(owner, remaining);
7186
- resolve27(result);
7186
+ resolve28(result);
7187
7187
  }, "finish");
7188
7188
  const timeout = /* @__PURE__ */ __name((cause) => {
7189
7189
  read();
@@ -9604,7 +9604,7 @@ async function renameWithRetry(from, to) {
9604
9604
  const code = err.code ?? "";
9605
9605
  if (!CONTENDED.has(code) || attempt >= RENAME_ATTEMPTS)
9606
9606
  throw err;
9607
- await new Promise((resolve27) => setTimeout(resolve27, attempt));
9607
+ await new Promise((resolve28) => setTimeout(resolve28, attempt));
9608
9608
  }
9609
9609
  }
9610
9610
  }
@@ -12572,8 +12572,8 @@ async function releaseHeldSessionLeases(options = {}) {
12572
12572
  }, () => {
12573
12573
  })));
12574
12574
  let timer;
12575
- const deadline = new Promise((resolve27) => {
12576
- timer = setTimeout(resolve27, options.timeoutMs ?? 2e3);
12575
+ const deadline = new Promise((resolve28) => {
12576
+ timer = setTimeout(resolve28, options.timeoutMs ?? 2e3);
12577
12577
  });
12578
12578
  await Promise.race([all, deadline]);
12579
12579
  clearTimeout(timer);
@@ -13591,7 +13591,18 @@ var ChildSessionMetaSchema = external_exports.object({
13591
13591
  description: text2,
13592
13592
  status: turnExecutionStatus,
13593
13593
  createdAt: isoUtc,
13594
- endedAt: isoUtc.optional()
13594
+ endedAt: isoUtc.optional(),
13595
+ /**
13596
+ * What a later process needs to continue this child from its saved log:
13597
+ * the filesystem policy it ran under and a small host-defined profile
13598
+ * (which agent to rebuild, which model). Absent on children saved before
13599
+ * this field existed and on children whose host recorded no profile; those
13600
+ * cannot be continued from disk.
13601
+ */
13602
+ continuation: external_exports.object({
13603
+ workspace: external_exports.enum(["shared", "isolated"]),
13604
+ profile: external_exports.record(external_exports.string().min(1).max(64), external_exports.string().max(256)).refine((value) => Object.keys(value).length <= 16, "At most 16 profile entries")
13605
+ }).strict().optional()
13595
13606
  }).strict();
13596
13607
  var SessionLeaseDocumentSchema = external_exports.object({
13597
13608
  v: external_exports.literal(1),
@@ -14273,7 +14284,7 @@ async function renameWithRetry2(from, to) {
14273
14284
  const code = err.code ?? "";
14274
14285
  if (!CONTENDED2.has(code) || attempt >= RENAME_ATTEMPTS2)
14275
14286
  throw err;
14276
- await new Promise((resolve27) => setTimeout(resolve27, attempt));
14287
+ await new Promise((resolve28) => setTimeout(resolve28, attempt));
14277
14288
  }
14278
14289
  }
14279
14290
  }
@@ -14696,6 +14707,61 @@ var InMemorySessionLeaseStore = class {
14696
14707
  }
14697
14708
  };
14698
14709
 
14710
+ // ../sdk/dist/store/session-log/spilled-input.js
14711
+ var SPILLED_INPUT_KEY = "$spilledInput";
14712
+ var INPUT_PREVIEW_CHARS = 200;
14713
+ function spilledInput(ref, json2) {
14714
+ return { [SPILLED_INPUT_KEY]: ref, preview: json2.slice(0, INPUT_PREVIEW_CHARS) };
14715
+ }
14716
+ __name(spilledInput, "spilledInput");
14717
+ function isSpilledInput(value) {
14718
+ return typeof value === "object" && value !== null && SPILLED_INPUT_KEY in value && typeof value[SPILLED_INPUT_KEY] === "object";
14719
+ }
14720
+ __name(isSpilledInput, "isSpilledInput");
14721
+ function callSlots(calls) {
14722
+ if (!Array.isArray(calls))
14723
+ return [];
14724
+ const slots = [];
14725
+ for (const call2 of calls) {
14726
+ if (typeof call2 === "object" && call2 !== null && "input" in call2) {
14727
+ slots.push({ holder: call2, key: "input" });
14728
+ }
14729
+ }
14730
+ return slots;
14731
+ }
14732
+ __name(callSlots, "callSlots");
14733
+ var TOOL_INPUT_RECORD_TYPES = /* @__PURE__ */ new Set([
14734
+ "tool_review_requested",
14735
+ "decision_requested",
14736
+ "tool_executing",
14737
+ "tool_input_completed"
14738
+ ]);
14739
+ function toolInputSlots(record3) {
14740
+ switch (record3.type) {
14741
+ case "tool_review_requested":
14742
+ return callSlots(record3.toolCalls);
14743
+ case "decision_requested": {
14744
+ const request = record3.request;
14745
+ return request ? callSlots(request.toolCalls) : [];
14746
+ }
14747
+ case "tool_executing":
14748
+ case "tool_input_completed":
14749
+ return "input" in record3 ? [{ holder: record3, key: "input" }] : [];
14750
+ default:
14751
+ return [];
14752
+ }
14753
+ }
14754
+ __name(toolInputSlots, "toolInputSlots");
14755
+ async function restoreSpilledRequestInputs(request, read) {
14756
+ for (const { holder, key: key5 } of callSlots(request.toolCalls)) {
14757
+ const value = holder[key5];
14758
+ if (isSpilledInput(value))
14759
+ holder[key5] = JSON.parse(await read(value[SPILLED_INPUT_KEY]));
14760
+ }
14761
+ return request;
14762
+ }
14763
+ __name(restoreSpilledRequestInputs, "restoreSpilledRequestInputs");
14764
+
14699
14765
  // ../sdk/dist/store/session-log/core.js
14700
14766
  var InvalidSessionRecordError = class extends Error {
14701
14767
  static {
@@ -15015,6 +15081,9 @@ var SessionLogCore = class {
15015
15081
  async #spillIfLarge(original) {
15016
15082
  const candidate = this.#structuredResultSpilling ? await this.#spillStructuredResults(original) : original;
15017
15083
  const type = candidate.type;
15084
+ if (typeof type === "string" && TOOL_INPUT_RECORD_TYPES.has(type)) {
15085
+ return this.#spillToolInputs(candidate);
15086
+ }
15018
15087
  if (type !== "message" && type !== "message_replaced" && type !== "compaction" && type !== "turn_completed")
15019
15088
  return candidate;
15020
15089
  const size = Buffer.byteLength(`${JSON.stringify(candidate)}
@@ -15048,6 +15117,30 @@ var SessionLogCore = class {
15048
15117
  };
15049
15118
  return { ...candidate, content: preview2, spill: ref };
15050
15119
  }
15120
+ /**
15121
+ * A record that carries tool inputs and would not fit a line: each large
15122
+ * input goes to `tool-results/` and the record keeps a stand-in, so the
15123
+ * person is still asked and the call is still restored on resume.
15124
+ */
15125
+ async #spillToolInputs(candidate) {
15126
+ const sizeOf = /* @__PURE__ */ __name((record3) => Buffer.byteLength(`${JSON.stringify(record3)}
15127
+ `, "utf8"), "sizeOf");
15128
+ if (sizeOf(candidate) <= this.#spillAbove)
15129
+ return candidate;
15130
+ const copy = structuredClone(candidate);
15131
+ const slots = toolInputSlots(copy);
15132
+ const bodies = slots.map(({ holder, key: key5 }) => JSON.stringify(holder[key5]) ?? "null");
15133
+ const order = slots.map((_, i) => i).sort((a, b) => bodies[b].length - bodies[a].length);
15134
+ for (const index of order) {
15135
+ const slot = slots[index];
15136
+ const body = bodies[index];
15137
+ const ref = await this.#spills.write(`input:${String(candidate.id)}:${index}`, "text", body);
15138
+ slot.holder[slot.key] = spilledInput(ref, body);
15139
+ if (sizeOf(copy) <= this.#spillAbove)
15140
+ break;
15141
+ }
15142
+ return copy;
15143
+ }
15051
15144
  async #spillStructuredResults(candidate) {
15052
15145
  const hasCandidate = candidate.type === "tool_completed" && candidate.structuredResultJson !== void 0;
15053
15146
  const settlement = candidate.type === "turn_completed" ? candidate.settlement : void 0;
@@ -16528,25 +16621,28 @@ function buildTaskTools(taskStore, scope) {
16528
16621
  }
16529
16622
  __name(buildTaskTools, "buildTaskTools");
16530
16623
 
16531
- // ../sdk/dist/types/permission/index.js
16532
- var PLAN_MODE_REFUSAL = "Refused: plan mode is read-only. Explore with the reading tools, then present the plan as your reply \u2014 what you would change, in which files, and in what order. The user will switch out of plan mode to have it carried out.";
16533
-
16534
16624
  // ../sdk/dist/compaction/summary.js
16535
16625
  var COMPACTION_HEADER = "[COMPACTED CONTEXT] The following is a structured summary of the conversation so far.";
16536
16626
  function isCompactionMessage(content) {
16537
16627
  return typeof content === "string" && content.startsWith(COMPACTION_HEADER);
16538
16628
  }
16539
16629
  __name(isCompactionMessage, "isCompactionMessage");
16540
- function buildCompactionMessage(body) {
16630
+ var COMPACTION_RECOVERY_NOTE = "Earlier output was cut from this summary. To get exact earlier text, call search_conversation, then read_conversation.";
16631
+ function buildCompactionMessage(body, recoveryNote) {
16541
16632
  return {
16542
16633
  ...createSystemMessage(`${COMPACTION_HEADER}
16543
16634
 
16544
- ${body}`),
16635
+ ${body}${recoveryNote ? `
16636
+
16637
+ ${recoveryNote}` : ""}`),
16545
16638
  source: { type: "compaction-summary" }
16546
16639
  };
16547
16640
  }
16548
16641
  __name(buildCompactionMessage, "buildCompactionMessage");
16549
16642
 
16643
+ // ../sdk/dist/types/permission/index.js
16644
+ var PLAN_MODE_REFUSAL = "Refused: plan mode is read-only. Explore with the reading tools, then present the plan as your reply \u2014 what you would change, in which files, and in what order. The user will switch out of plan mode to have it carried out.";
16645
+
16550
16646
  // ../sdk/dist/provider/strict-schema.js
16551
16647
  var NO_CONDITIONALS = "strict mode has no conditional schemas; flatten the object";
16552
16648
  var NO_NUMERIC_BOUNDS = "numeric bounds are not in the subset; enforce at execution";
@@ -22548,14 +22644,14 @@ __name(backoffProportional, "backoffProportional");
22548
22644
  function sleep(ms, signal) {
22549
22645
  if (ms <= 0)
22550
22646
  return Promise.resolve();
22551
- return new Promise((resolve27, reject2) => {
22647
+ return new Promise((resolve28, reject2) => {
22552
22648
  if (signal?.aborted) {
22553
22649
  reject2(signal.reason);
22554
22650
  return;
22555
22651
  }
22556
22652
  const timer = setTimeout(() => {
22557
22653
  signal?.removeEventListener("abort", onAbort);
22558
- resolve27();
22654
+ resolve28();
22559
22655
  }, ms);
22560
22656
  const onAbort = /* @__PURE__ */ __name(() => {
22561
22657
  clearTimeout(timer);
@@ -23289,11 +23385,11 @@ __name(checkRemoval, "checkRemoval");
23289
23385
  var GLOB_TAIL = /[\\/]\.?\*$/;
23290
23386
  function checkTarget(program, args, spelled, word2, scope) {
23291
23387
  const expanded = expandTilde(spelled, scope.home);
23292
- const relative10 = !isAbsolute3(expanded);
23388
+ const relative11 = !isAbsolute3(expanded);
23293
23389
  if (expandsAtRuntime(word2) && /[$`]/.test(expanded)) {
23294
23390
  return void 0;
23295
23391
  }
23296
- const absolute = relative10 ? resolve2(scope.cwd, expanded) : resolve2(expanded);
23392
+ const absolute = relative11 ? resolve2(scope.cwd, expanded) : resolve2(expanded);
23297
23393
  let settled = absolute;
23298
23394
  for (let previous = ""; previous !== settled; ) {
23299
23395
  previous = settled;
@@ -23303,18 +23399,18 @@ function checkTarget(program, args, spelled, word2, scope) {
23303
23399
  }
23304
23400
  const globbed = settled !== absolute;
23305
23401
  const original = expanded;
23306
- if (scope.changesDirectory && globbed && relative10 && GLOB_TAIL.test(absolute)) {
23402
+ if (scope.changesDirectory && globbed && relative11 && GLOB_TAIL.test(absolute)) {
23307
23403
  return `${program} ${spelled}: a relative glob after a cd cannot be resolved before the line runs`;
23308
23404
  }
23309
23405
  let below = settled;
23310
- if (relative10) {
23406
+ if (relative11) {
23311
23407
  const prefix = scope.cwd.endsWith(sep3) ? scope.cwd : scope.cwd + sep3;
23312
23408
  if (settled.startsWith(prefix))
23313
23409
  below = settled.slice(prefix.length);
23314
23410
  else if (settled === scope.cwd)
23315
23411
  below = "";
23316
23412
  }
23317
- if (globbed && (hasParentAfterName(original) || original.startsWith("~") || /^[\\/]{2}/.test(original) || relative10 && /(^|[\\/])\.\.([\\/]|$)/.test(original) && GLOB_TAIL.test(absolute) || program === "rmdir" && GLOB_TAIL.test(absolute) && args.some((a) => /^--p/.test(a.value) || /^-[a-z]*p/.test(a.value)) || relative10 && /\*[\\/]+$/.test(original) && GLOB_TAIL.test(absolute))) {
23413
+ if (globbed && (hasParentAfterName(original) || original.startsWith("~") || /^[\\/]{2}/.test(original) || relative11 && /(^|[\\/])\.\.([\\/]|$)/.test(original) && GLOB_TAIL.test(absolute) || program === "rmdir" && GLOB_TAIL.test(absolute) && args.some((a) => /^--p/.test(a.value) || /^-[a-z]*p/.test(a.value)) || relative11 && /\*[\\/]+$/.test(original) && GLOB_TAIL.test(absolute))) {
23318
23414
  return `${program} ${spelled}: the target cannot be resolved to a directory before the line runs`;
23319
23415
  }
23320
23416
  if (!globbed || !/[*?[]/.test(below)) {
@@ -23335,8 +23431,8 @@ function checkTarget(program, args, spelled, word2, scope) {
23335
23431
  if (globbed && GLOB_TAIL.test(absolute)) {
23336
23432
  const segments = /* @__PURE__ */ __name((value) => value.split(/[\\/]+/).filter((s) => s !== "" && s !== ".").length, "segments");
23337
23433
  const crossed = segments(absolute) - segments(settled);
23338
- const inside = below.split(/[\\/]+/).filter((s) => /[*?[]/.test(s)).length;
23339
- if (crossed + inside > 1) {
23434
+ const inside2 = below.split(/[\\/]+/).filter((s) => /[*?[]/.test(s)).length;
23435
+ if (crossed + inside2 > 1) {
23340
23436
  return `${program} ${spelled}: the glob crosses directories that cannot be listed before the line runs`;
23341
23437
  }
23342
23438
  }
@@ -24710,7 +24806,7 @@ function createFileReadTracker() {
24710
24806
  __name(createFileReadTracker, "createFileReadTracker");
24711
24807
 
24712
24808
  // ../sdk/dist/runtime/query/file-evidence-replay.js
24713
- import { resolve as resolve6 } from "node:path";
24809
+ import { resolve as resolve7 } from "node:path";
24714
24810
 
24715
24811
  // ../sdk/dist/constants/limits.js
24716
24812
  var ZERO_COST2 = {
@@ -24889,6 +24985,30 @@ var DEFAULT_MAX_TOOL_OUTPUT_CHARS = 4e4;
24889
24985
  var DEFAULT_MAX_TOOL_OUTPUT_CHARS_PER_MESSAGE = 2e5;
24890
24986
  var MESSAGE_BUDGET_PREVIEW_CHARS = 2e3;
24891
24987
  var SPILL_MARKER = "The full output was written to:";
24988
+ var RETAINED_OUTPUT_NOTE = "This path identifies retained output, not the original input.";
24989
+ var REPLAY_WARNING = "A fresh observation of the original input cannot recover its earlier contents. If recovery is unavailable, report the missing detail; do not replay the original action.";
24990
+ function describeRetainedOutputRecovery(routes) {
24991
+ const read = routes?.read === true;
24992
+ const conversation = routes?.conversation === true;
24993
+ const how = [
24994
+ read ? "To read more of it, open this file with the read tool (offset and limit)." : "",
24995
+ conversation ? read ? "For anything else from earlier in this conversation, call search_conversation with a phrase from it, then read_conversation with the seq and part it returns." : "To read more of it, call search_conversation with a phrase from it, then read_conversation with the seq and part it returns. The path is not a workspace file, so read and grep cannot open it." : ""
24996
+ ].filter(Boolean);
24997
+ if (how.length === 0)
24998
+ return `${RETAINED_OUTPUT_NOTE} Use the host-authorized retained-output recovery tools when available; the path does not grant filesystem access. ${REPLAY_WARNING}`;
24999
+ return [RETAINED_OUTPUT_NOTE, ...how, REPLAY_WARNING].join(" ");
25000
+ }
25001
+ __name(describeRetainedOutputRecovery, "describeRetainedOutputRecovery");
25002
+ function retainedOutputPointer(text9) {
25003
+ const lines = text9.split(/\r\n|\r|\n/);
25004
+ const at = lines.findIndex((line) => line.startsWith(SPILL_MARKER));
25005
+ if (at < 0)
25006
+ return void 0;
25007
+ const next = lines[at + 1];
25008
+ return next?.startsWith(RETAINED_OUTPUT_NOTE) ? `${lines[at]}
25009
+ ${next}` : lines[at];
25010
+ }
25011
+ __name(retainedOutputPointer, "retainedOutputPointer");
24892
25012
  var HEAD_SHARE = 0.75;
24893
25013
  function safeHead(text9, maxChars2) {
24894
25014
  let end = Math.min(text9.length, Math.max(0, maxChars2));
@@ -24918,7 +25038,7 @@ function boundedPreview(output, maxChars2, toolName, recovery) {
24918
25038
  ""
24919
25039
  ].join("\n");
24920
25040
  const compactMiddle = "\n[... omitted ...]\n";
24921
- const spillLine = recovery.split("\n").find((line) => line.startsWith(SPILL_MARKER));
25041
+ const spillLine = recovery.split(/\r\n|\r|\n/).find((line) => line.startsWith(SPILL_MARKER));
24922
25042
  const compactRecovery = spillLine ? `${compactMiddle}${spillLine}
24923
25043
  ` : compactMiddle;
24924
25044
  const middle = detailedMiddle.length < maxChars2 ? detailedMiddle : compactRecovery.length < maxChars2 ? compactRecovery : compactMiddle;
@@ -24970,10 +25090,7 @@ function applyToolOutputBudget(opts) {
24970
25090
  }
24971
25091
  const retained = opts.spillDir ? spill2(opts.spillDir, opts.toolUseId, output, opts.onError) : void 0;
24972
25092
  const spillPath = retained?.path;
24973
- const recovery = spillPath ? [
24974
- `${SPILL_MARKER} ${spillPath}`,
24975
- "This path identifies retained output, not the original input. Use the host-authorized retained-output recovery tools when available; the path does not grant filesystem access. A fresh observation of the original input cannot recover its earlier contents. If recovery is unavailable, report the missing detail; do not replay the original action."
24976
- ].join("\n") : "The full output was not retained. Use a saved artifact or a read-only observation; do not repeat a state-changing action to recover its output.";
25093
+ const recovery = spillPath ? [`${SPILL_MARKER} ${spillPath}`, describeRetainedOutputRecovery(opts.recoveryRoutes)].join("\n") : "The full output was not retained. Use a saved artifact or a read-only observation; do not repeat a state-changing action to recover its output.";
24977
25094
  const requestedPreview = opts.retainedPreviewChars;
24978
25095
  const previewLimit = retained?.integrity && requestedPreview !== void 0 && Number.isFinite(requestedPreview) && requestedPreview > 0 ? Math.min(limit, Math.floor(requestedPreview)) : limit;
24979
25096
  const previewTextBudget = Math.max(0, previewLimit - notice.length - (notice && output ? 2 : 0));
@@ -25032,7 +25149,6 @@ function spill2(dir, toolUseId3, content, onError) {
25032
25149
  }
25033
25150
  }
25034
25151
  __name(spill2, "spill");
25035
- var SPILL_LINE = new RegExp(`^${SPILL_MARKER} .+$`, "m");
25036
25152
  function fitResultsToMessageBudget(items, opts) {
25037
25153
  const replaced = /* @__PURE__ */ new Map();
25038
25154
  if (!Number.isFinite(opts.maxChars) || opts.maxChars <= 0)
@@ -25055,7 +25171,7 @@ function fitResultsToMessageBudget(items, opts) {
25055
25171
  }
25056
25172
  __name(fitResultsToMessageBudget, "fitResultsToMessageBudget");
25057
25173
  function previewForMessageBudget(item, opts) {
25058
- const spilledAt = SPILL_LINE.exec(item.output)?.[0];
25174
+ const spilledAt = retainedOutputPointer(item.output);
25059
25175
  if (spilledAt !== void 0) {
25060
25176
  const output = [
25061
25177
  safeHead(item.output, MESSAGE_BUDGET_PREVIEW_CHARS / 2),
@@ -25066,7 +25182,7 @@ function previewForMessageBudget(item, opts) {
25066
25182
  return {
25067
25183
  output,
25068
25184
  originalLength: item.output.length,
25069
- spillPath: spilledAt.slice(SPILL_MARKER.length + 1)
25185
+ spillPath: spilledAt.split("\n")[0].slice(SPILL_MARKER.length + 1)
25070
25186
  };
25071
25187
  }
25072
25188
  const budgeted = applyToolOutputBudget({
@@ -25076,6 +25192,7 @@ function previewForMessageBudget(item, opts) {
25076
25192
  output: item.output,
25077
25193
  maxChars: MESSAGE_BUDGET_PREVIEW_CHARS,
25078
25194
  spillDir: opts.spillDir,
25195
+ ...opts.recoveryRoutes ? { recoveryRoutes: opts.recoveryRoutes } : {},
25079
25196
  ...opts.onError ? { onError: opts.onError } : {}
25080
25197
  });
25081
25198
  return {
@@ -25219,9 +25336,10 @@ function clearedPlaceholder(content, toolName, size) {
25219
25336
  const parts = [
25220
25337
  `${CLEARED_PREFIX} ${toolName} returned ${size.toLocaleString("en-US")} characters, cleared to reclaim context.`
25221
25338
  ];
25222
- const spillLine = text9.split("\n").find((line) => line.startsWith(SPILL_MARKER));
25223
- if (spillLine) {
25224
- parts.push(spillLine, "Read a window of it with `read` (offset/limit) or search it with `grep`.");
25339
+ const pointer2 = retainedOutputPointer(text9);
25340
+ if (pointer2) {
25341
+ parts.push(pointer2.includes("\n") ? pointer2 : `${pointer2}
25342
+ ${describeRetainedOutputRecovery()}`);
25225
25343
  } else {
25226
25344
  parts.push("Full result unavailable here. Recover from a saved artifact or a read-only observation; do not repeat a state-changing action to recover its output.");
25227
25345
  }
@@ -25784,8 +25902,8 @@ async function withFileMutationLock(key5, operation) {
25784
25902
  const previous = mutationTails.get(key5) ?? Promise.resolve();
25785
25903
  let release = /* @__PURE__ */ __name(() => {
25786
25904
  }, "release");
25787
- const current = new Promise((resolve27) => {
25788
- release = resolve27;
25905
+ const current = new Promise((resolve28) => {
25906
+ release = resolve28;
25789
25907
  });
25790
25908
  const tail = previous.then(() => current);
25791
25909
  mutationTails.set(key5, tail);
@@ -26922,7 +27040,38 @@ var EditTool = defineTool({
26922
27040
 
26923
27041
  // ../sdk/dist/tools/builtins/read-file.js
26924
27042
  import { readFile as readFile7, stat as stat4 } from "node:fs/promises";
26925
- import { extname } from "node:path";
27043
+ import { extname as extname2 } from "node:path";
27044
+
27045
+ // ../sdk/dist/tools/retained-output.js
27046
+ import { lstat as lstat2, realpath as realpath4 } from "node:fs/promises";
27047
+ import { dirname as dirname9, extname, isAbsolute as isAbsolute6, relative as relative3, resolve as resolve6 } from "node:path";
27048
+ function inside(root, path2) {
27049
+ const rel = relative3(root, path2);
27050
+ return rel !== "" && !rel.startsWith("..") && !isAbsolute6(rel);
27051
+ }
27052
+ __name(inside, "inside");
27053
+ async function resolveRetainedOutput(directory, candidate) {
27054
+ if (!directory || !candidate || !isAbsolute6(candidate) || candidate.includes("\0"))
27055
+ return void 0;
27056
+ try {
27057
+ const base3 = await realpath4(directory);
27058
+ const lexical = resolve6(candidate);
27059
+ if (extname(lexical).toLowerCase() !== ".txt")
27060
+ return void 0;
27061
+ if (!inside(resolve6(directory), lexical) && !inside(base3, lexical))
27062
+ return void 0;
27063
+ const stat15 = await lstat2(lexical);
27064
+ if (stat15.isSymbolicLink() || !stat15.isFile() || stat15.nlink !== 1)
27065
+ return void 0;
27066
+ const real = await realpath4(lexical);
27067
+ if (!inside(base3, real) || dirname9(real) === real)
27068
+ return void 0;
27069
+ return real;
27070
+ } catch {
27071
+ return void 0;
27072
+ }
27073
+ }
27074
+ __name(resolveRetainedOutput, "resolveRetainedOutput");
26926
27075
 
26927
27076
  // ../sdk/dist/tools/text-window.js
26928
27077
  var WINDOW_HEAD_LINES = 80;
@@ -27182,7 +27331,8 @@ var ReadFileTool = defineTool({
27182
27331
  };
27183
27332
  },
27184
27333
  async execute(input, context2) {
27185
- if (context2.sandbox) {
27334
+ const retained = await resolveRetainedOutput(context2.retainedOutputDirectory, input.path);
27335
+ if (context2.sandbox && retained === void 0) {
27186
27336
  const buffer2 = await context2.sandbox.readFile(input.path);
27187
27337
  const binaryGuidance2 = describeStructuredBinaryRead(input.path, buffer2);
27188
27338
  if (binaryGuidance2) {
@@ -27221,7 +27371,7 @@ var ReadFileTool = defineTool({
27221
27371
  facts: readFacts(input.path, buffer2, content2, rendered2)
27222
27372
  };
27223
27373
  }
27224
- const filePath = await resolveWithinAnyReal(toolRoots(context2), input.path);
27374
+ const filePath = retained ?? await resolveWithinAnyReal(toolRoots(context2), input.path);
27225
27375
  if (input.readRange === void 0 && input.limit === void 0) {
27226
27376
  const { size } = await stat4(filePath);
27227
27377
  const early = renderCappedRead("", size, input, capOptions(input, context2));
@@ -27269,7 +27419,7 @@ function capOptions(input, context2) {
27269
27419
  const tokens = Number(context2.env?.NAMZU_FILE_READ_MAX_OUTPUT_TOKENS);
27270
27420
  return {
27271
27421
  path: input.path,
27272
- ext: extname(input.path).toLowerCase(),
27422
+ ext: extname2(input.path).toLowerCase(),
27273
27423
  ...input.allow_large === true ? { allowLarge: true } : {},
27274
27424
  ...Number.isFinite(tokens) && tokens > 0 ? { caps: { maxTokens: tokens } } : {}
27275
27425
  };
@@ -27310,7 +27460,7 @@ function recordObservedRead(context2, key5, content, rendered) {
27310
27460
  }
27311
27461
  __name(recordObservedRead, "recordObservedRead");
27312
27462
  function describeStructuredBinaryRead(path2, buffer) {
27313
- const ext2 = extname(path2).toLowerCase();
27463
+ const ext2 = extname2(path2).toLowerCase();
27314
27464
  const image = buffer.subarray(0, 8).equals(Buffer.from("89504e470d0a1a0a", "hex")) ? "PNG" : buffer[0] === 255 && buffer[1] === 216 ? "JPEG" : buffer.toString("ascii", 0, 4) === "RIFF" && buffer.toString("ascii", 8, 12) === "WEBP" ? "WebP" : null;
27315
27465
  if (image) {
27316
27466
  return [
@@ -27347,7 +27497,7 @@ __name(buildStructuredBinaryGuidance, "buildStructuredBinaryGuidance");
27347
27497
 
27348
27498
  // ../sdk/dist/tools/builtins/write-file.js
27349
27499
  import { mkdir as mkdir8, readFile as readFile8 } from "node:fs/promises";
27350
- import { dirname as dirname9 } from "node:path";
27500
+ import { dirname as dirname10 } from "node:path";
27351
27501
 
27352
27502
  // ../sdk/dist/tools/builtins/file-write-result.js
27353
27503
  import { createHash as createHash8 } from "node:crypto";
@@ -27508,7 +27658,7 @@ var WriteFileTool = defineTool({
27508
27658
  if (guard)
27509
27659
  return guard;
27510
27660
  }
27511
- await mkdir8(dirname9(hostPath), { recursive: true });
27661
+ await mkdir8(dirname10(hostPath), { recursive: true });
27512
27662
  await atomicWriteFile2(hostPath, content);
27513
27663
  context2.fileReadTracker?.recordRead(hostPath, content, context2.toolUseId);
27514
27664
  return fileWriteResult(hostPath, current, content);
@@ -27643,7 +27793,7 @@ function parseArguments2(call2) {
27643
27793
  }
27644
27794
  __name(parseArguments2, "parseArguments");
27645
27795
  function lexicalFileKeys(workingDirectory, sandboxed) {
27646
- return (path2) => sandboxed ? path2 : resolve6(workingDirectory, path2);
27796
+ return (path2) => sandboxed ? path2 : resolve7(workingDirectory, path2);
27647
27797
  }
27648
27798
  __name(lexicalFileKeys, "lexicalFileKeys");
27649
27799
  function indexVisibleHistory(messages, keyOf) {
@@ -30588,7 +30738,7 @@ var RUNTIME_DEFAULTS = RuntimeConfigSchema.parse({});
30588
30738
 
30589
30739
  // ../sdk/dist/manager/agent/child-session.js
30590
30740
  import { mkdir as mkdir9, readFile as readFile9 } from "node:fs/promises";
30591
- import { dirname as dirname10 } from "node:path";
30741
+ import { dirname as dirname11 } from "node:path";
30592
30742
  async function childSessionEnded(childLog) {
30593
30743
  let ended = null;
30594
30744
  for await (const { record: record3 } of childLog.read({ mode: "tolerant" })) {
@@ -30620,7 +30770,7 @@ async function writeChildSessionMeta(path2, meta) {
30620
30770
  if (current !== null && (current.sessionId !== next.sessionId || current.parentSessionId !== next.parentSessionId || current.parentTurnId !== next.parentTurnId)) {
30621
30771
  throw new ChildSessionMetaOwnerError(`${path2} describes child session ${current.sessionId} of ${current.parentSessionId}; refusing to overwrite it with ${next.sessionId} of ${next.parentSessionId}.`);
30622
30772
  }
30623
- await mkdir9(dirname10(path2), { recursive: true, mode: 448 });
30773
+ await mkdir9(dirname11(path2), { recursive: true, mode: 448 });
30624
30774
  await atomicWriteFile(path2, `${JSON.stringify(next)}
30625
30775
  `, { mode: 384 });
30626
30776
  }
@@ -32519,12 +32669,12 @@ var AwaitedJobs = class {
32519
32669
  return Promise.resolve();
32520
32670
  if (this.outstanding.size === 0 && this.monitors.size === 0)
32521
32671
  return Promise.resolve();
32522
- return new Promise((resolve27) => {
32672
+ return new Promise((resolve28) => {
32523
32673
  const finish2 = /* @__PURE__ */ __name(() => {
32524
32674
  clearTimeout(timer);
32525
32675
  this.arrivals.delete(finish2);
32526
32676
  signal?.removeEventListener("abort", finish2);
32527
- resolve27();
32677
+ resolve28();
32528
32678
  }, "finish");
32529
32679
  const timer = setTimeout(finish2, timeoutMs);
32530
32680
  timer.unref?.();
@@ -33281,7 +33431,8 @@ async function readParks(log, options = {}) {
33281
33431
  decisionId: r.decisionId,
33282
33432
  turnId: r.turnId,
33283
33433
  checkpointId: r.checkpointId,
33284
- request: r.request,
33434
+ // A call input too large for a line was spilled; put it back.
33435
+ request: await restoreSpilledRequestInputs(structuredClone(r.request), (ref) => log.readSpill(ref)),
33285
33436
  parkedAt: Date.parse(r.ts),
33286
33437
  ...r.deadlineAt !== void 0 ? { deadlineAt: Date.parse(r.deadlineAt) } : {}
33287
33438
  });
@@ -34533,12 +34684,12 @@ var CompletionInbox = class {
34533
34684
  return Promise.resolve();
34534
34685
  if (!this.hasPendingWork)
34535
34686
  return Promise.resolve();
34536
- return new Promise((resolve27) => {
34687
+ return new Promise((resolve28) => {
34537
34688
  const finish2 = /* @__PURE__ */ __name(() => {
34538
34689
  clearTimeout(timer);
34539
34690
  this.arrivals.delete(finish2);
34540
34691
  signal?.removeEventListener("abort", finish2);
34541
- resolve27();
34692
+ resolve28();
34542
34693
  }, "finish");
34543
34694
  const timer = setTimeout(finish2, timeoutMs);
34544
34695
  timer.unref?.();
@@ -34663,11 +34814,11 @@ ${JSON.stringify({ tasks: tasks2, omitted: this.ours.size - ids.length })}`;
34663
34814
  });
34664
34815
  if (settlements.length === 0)
34665
34816
  return this.drain();
34666
- await new Promise((resolve27) => {
34817
+ await new Promise((resolve28) => {
34667
34818
  const finish2 = /* @__PURE__ */ __name(() => {
34668
34819
  signal?.removeEventListener("abort", finish2);
34669
34820
  this.drains.delete(finish2);
34670
- resolve27();
34821
+ resolve28();
34671
34822
  }, "finish");
34672
34823
  this.drains.add(finish2);
34673
34824
  signal?.addEventListener("abort", finish2, { once: true });
@@ -37361,7 +37512,8 @@ async function runCompactionCheckInner(ctx, pass, options) {
37361
37512
  } else {
37362
37513
  compactedContent = serializeState(manager.getState());
37363
37514
  }
37364
- const compactionMessage = buildCompactionMessage(compactedContent);
37515
+ const mounted = new Set(ctx.tools?.listNames?.() ?? []);
37516
+ const compactionMessage = buildCompactionMessage(compactedContent, mounted.has("search_conversation") && mounted.has("read_conversation") ? COMPACTION_RECOVERY_NOTE : void 0);
37365
37517
  const preservedSystem = systemMessages.filter((m) => !isCompactionMessage(typeof m.content === "string" ? m.content : null) || m.retain === true);
37366
37518
  const retained = findRetainedIndices(messages);
37367
37519
  const retainedOlder = retained.size === 0 ? [] : messages.slice(systemMessages.length, keepStart).filter((_, offset) => retained.has(systemMessages.length + offset));
@@ -37612,14 +37764,14 @@ async function awaitDecisionDurably(ctx, checkpoint, request) {
37612
37764
  }, "record");
37613
37765
  let parkTimer;
37614
37766
  let recording = false;
37615
- const recordIfSlow = new Promise((resolve27) => {
37767
+ const recordIfSlow = new Promise((resolve28) => {
37616
37768
  parkTimer = setTimeout(() => {
37617
37769
  if (settled) {
37618
- resolve27();
37770
+ resolve28();
37619
37771
  return;
37620
37772
  }
37621
37773
  recording = true;
37622
- record3().then(resolve27, resolve27);
37774
+ record3().then(resolve28, resolve28);
37623
37775
  }, delay2);
37624
37776
  });
37625
37777
  try {
@@ -37669,13 +37821,13 @@ async function awaitDecisionOrAbort(ctx, request) {
37669
37821
  };
37670
37822
  if (signal.aborted)
37671
37823
  return abortDecision;
37672
- return new Promise((resolve27) => {
37824
+ return new Promise((resolve28) => {
37673
37825
  let settled = false;
37674
37826
  const onAbort = /* @__PURE__ */ __name(() => {
37675
37827
  if (settled)
37676
37828
  return;
37677
37829
  settled = true;
37678
- resolve27(abortDecision);
37830
+ resolve28(abortDecision);
37679
37831
  }, "onAbort");
37680
37832
  signal.addEventListener("abort", onAbort, { once: true });
37681
37833
  Promise.resolve(ctx.resumeHandler(request, resumeContext)).then((decision2) => {
@@ -37683,13 +37835,13 @@ async function awaitDecisionOrAbort(ctx, request) {
37683
37835
  return;
37684
37836
  settled = true;
37685
37837
  signal.removeEventListener("abort", onAbort);
37686
- resolve27(decision2);
37838
+ resolve28(decision2);
37687
37839
  }, (err) => {
37688
37840
  if (settled)
37689
37841
  return;
37690
37842
  settled = true;
37691
37843
  signal.removeEventListener("abort", onAbort);
37692
- resolve27({
37844
+ resolve28({
37693
37845
  action: "abort",
37694
37846
  reason: err instanceof Error ? err.message : "resume handler failed"
37695
37847
  });
@@ -37892,7 +38044,7 @@ __name(runPlanGate, "runPlanGate");
37892
38044
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
37893
38045
  async function awaitProjectInstructionCallback(signal, start) {
37894
38046
  signal.throwIfAborted();
37895
- return new Promise((resolve27, reject2) => {
38047
+ return new Promise((resolve28, reject2) => {
37896
38048
  let settled = false;
37897
38049
  const cleanup = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "cleanup");
37898
38050
  const rejectOnce = /* @__PURE__ */ __name((reason2) => {
@@ -37907,7 +38059,7 @@ async function awaitProjectInstructionCallback(signal, start) {
37907
38059
  return;
37908
38060
  settled = true;
37909
38061
  cleanup();
37910
- resolve27(value);
38062
+ resolve28(value);
37911
38063
  }, "resolveOnce");
37912
38064
  const onAbort = /* @__PURE__ */ __name(() => rejectOnce(signal.reason), "onAbort");
37913
38065
  signal.addEventListener("abort", onAbort, { once: true });
@@ -38341,8 +38493,8 @@ async function* runToolReview(ctx, response, iterationNum) {
38341
38493
  }
38342
38494
  const wakeup = /* @__PURE__ */ __name(() => {
38343
38495
  let notify;
38344
- const promise = new Promise((resolve27) => {
38345
- notify = resolve27;
38496
+ const promise = new Promise((resolve28) => {
38497
+ notify = resolve28;
38346
38498
  });
38347
38499
  return { promise, notify };
38348
38500
  }, "wakeup");
@@ -42909,7 +43061,7 @@ async function awaitStoreRead(signal, start) {
42909
43061
  if (!signal)
42910
43062
  return await start();
42911
43063
  signal.throwIfAborted();
42912
- return new Promise((resolve27, reject2) => {
43064
+ return new Promise((resolve28, reject2) => {
42913
43065
  let settled = false;
42914
43066
  const cleanup = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "cleanup");
42915
43067
  const rejectOnce = /* @__PURE__ */ __name((reason2) => {
@@ -42924,7 +43076,7 @@ async function awaitStoreRead(signal, start) {
42924
43076
  return;
42925
43077
  settled = true;
42926
43078
  cleanup();
42927
- resolve27(value);
43079
+ resolve28(value);
42928
43080
  }, "resolveOnce");
42929
43081
  const onAbort = /* @__PURE__ */ __name(() => rejectOnce(signal.reason), "onAbort");
42930
43082
  signal.addEventListener("abort", onAbort, { once: true });
@@ -43765,8 +43917,8 @@ var ProbeRegistry = class {
43765
43917
  var probe = new ProbeRegistry();
43766
43918
 
43767
43919
  // ../sdk/dist/store/evidence/disk.js
43768
- import { lstat as lstat3 } from "node:fs/promises";
43769
- import { resolve as resolve7 } from "node:path";
43920
+ import { lstat as lstat4 } from "node:fs/promises";
43921
+ import { resolve as resolve8 } from "node:path";
43770
43922
 
43771
43923
  // ../sdk/dist/store/evidence/index-page.js
43772
43924
  import { createHash as createHash15, createHmac, timingSafeEqual } from "node:crypto";
@@ -44127,7 +44279,7 @@ function excludesSuccessfulTool(entry, names) {
44127
44279
  __name(excludesSuccessfulTool, "excludesSuccessfulTool");
44128
44280
 
44129
44281
  // ../sdk/dist/store/evidence/source-text.js
44130
- import { lstat as lstat2 } from "node:fs/promises";
44282
+ import { lstat as lstat3 } from "node:fs/promises";
44131
44283
  import { join as join14 } from "node:path";
44132
44284
 
44133
44285
  // ../sdk/dist/utils/evidence-time.js
@@ -44251,7 +44403,7 @@ async function sourceText(pointer2, sessionDir, budget, { event, parts }) {
44251
44403
  throw new Error("Retained output bytes changed.");
44252
44404
  pieces.push(bytes);
44253
44405
  }
44254
- if (stamp2(before) !== stamp2(await file.stat()) || stamp2(before) !== stamp2(await lstat2(path2)))
44406
+ if (stamp2(before) !== stamp2(await file.stat()) || stamp2(before) !== stamp2(await lstat3(path2)))
44255
44407
  throw new Error("Retained output changed during read.");
44256
44408
  const all = Buffer.concat(pieces);
44257
44409
  const ownedStart = (chunk - first) * EVIDENCE_CHUNK_BYTES;
@@ -44279,15 +44431,33 @@ async function sourceText(pointer2, sessionDir, budget, { event, parts }) {
44279
44431
  };
44280
44432
  }
44281
44433
  __name(sourceText, "sourceText");
44434
+ var SessionEvidenceOffsetError = class extends Error {
44435
+ static {
44436
+ __name(this, "SessionEvidenceOffsetError");
44437
+ }
44438
+ code;
44439
+ totalBytes;
44440
+ scannedBytes;
44441
+ constructor(code, message, totalBytes, scannedBytes) {
44442
+ super(message);
44443
+ this.code = code;
44444
+ this.totalBytes = totalBytes;
44445
+ this.scannedBytes = scannedBytes;
44446
+ this.name = "SessionEvidenceOffsetError";
44447
+ }
44448
+ };
44282
44449
  async function readTextPage(source, scope, offset, budget) {
44283
44450
  const entry = source.entry;
44284
44451
  if (offset > source.bytes)
44285
- throw new Error("Offset exceeds retained text.");
44452
+ throw new SessionEvidenceOffsetError("past_end", "Offset exceeds retained text.", source.bytes, budget.bytes);
44286
44453
  const chunk = entry.spill ? Math.min(Math.floor(offset / EVIDENCE_CHUNK_BYTES), source.chunks - 1) : 0;
44287
44454
  const window2 = await source.window(chunk);
44455
+ const splits = /* @__PURE__ */ __name(() => new SessionEvidenceOffsetError("inside_character", "Offset splits a UTF-8 character.", source.bytes, budget.bytes), "splits");
44288
44456
  if (offset < window2.offset)
44289
- throw new Error("Offset splits a UTF-8 character.");
44457
+ throw splits();
44290
44458
  const bytes = window2.bytes.subarray(offset - window2.offset);
44459
+ if (bytes.length && ((bytes[0] ?? 0) & 192) === 128)
44460
+ throw splits();
44291
44461
  let text9 = decode(utf8Page(bytes, 24e3));
44292
44462
  if (text9.length > 6e3) {
44293
44463
  let end = 6e3;
@@ -44443,7 +44613,7 @@ function createSource(options, mode, anchor) {
44443
44613
  const consistency = external_exports.enum(["closed", "snapshot"]).parse(options.consistency ?? "closed");
44444
44614
  const maxReadBytes = external_exports.number().int().min(1024 * 1024).max(PAGE_BYTES).parse(options.maxReadBytes ?? PAGE_BYTES);
44445
44615
  const scope = Object.freeze(scopeSchema.parse(options.scope));
44446
- const logPath = resolve7(options.logPath);
44616
+ const logPath = resolve8(options.logPath);
44447
44617
  if (!logPath.endsWith(".jsonl"))
44448
44618
  throw new Error("A session log path ends in .jsonl.");
44449
44619
  const sessionDir = logPath.slice(0, -".jsonl".length);
@@ -44473,14 +44643,14 @@ function createSource(options, mode, anchor) {
44473
44643
  throw new Error("Evidence scope has an active turn; it is not closed.");
44474
44644
  }
44475
44645
  const anchorKey = anchor ? await verifyAnchor(handle, anchor) : void 0;
44476
- const sourceKey = digest2(`session-v1:${consistency}:${mode}:${scopeKey}:${anchorKey ?? stamp2(before)}`);
44646
+ const sourceKey = digest2(`session-v1:${consistency}:${mode}:${scopeKey}:${fileIdentity(before)}`);
44477
44647
  const seal = evidenceSeal(state.first, sourceKey);
44478
44648
  const value = await action(handle, size, seal, sourceKey, budget, !state.closed);
44479
44649
  signal?.throwIfAborted();
44480
44650
  if (anchor) {
44481
44651
  if (await verifyAnchor(handle, anchor) !== anchorKey)
44482
44652
  throw new Error("Evidence source changed during retrieval.");
44483
- } else if (stamp2(before) !== stamp2(await handle.stat()) || stamp2(before) !== stamp2(await lstat3(logPath))) {
44653
+ } else if (stamp2(before) !== stamp2(await handle.stat()) || stamp2(before) !== stamp2(await lstat4(logPath))) {
44484
44654
  throw new Error("Evidence source changed during retrieval.");
44485
44655
  }
44486
44656
  return value;
@@ -44678,6 +44848,10 @@ function createSource(options, mode, anchor) {
44678
44848
  });
44679
44849
  }
44680
44850
  __name(createSource, "createSource");
44851
+ function fileIdentity(stats) {
44852
+ return Number(stats.ino) === 0 ? `${stats.dev}:0:${stats.birthtimeMs}` : `${stats.dev}:${stats.ino}`;
44853
+ }
44854
+ __name(fileIdentity, "fileIdentity");
44681
44855
  async function verifyAnchor(handle, anchor) {
44682
44856
  const bytes = await readBytes(handle, anchor.offset, anchor.length, {
44683
44857
  bytes: 0,
@@ -44728,8 +44902,8 @@ var EventTranslator = class {
44728
44902
  async withLogLock(operation) {
44729
44903
  const previous = this.appendChain;
44730
44904
  let release;
44731
- this.appendChain = new Promise((resolve27) => {
44732
- release = resolve27;
44905
+ this.appendChain = new Promise((resolve28) => {
44906
+ release = resolve28;
44733
44907
  });
44734
44908
  try {
44735
44909
  await previous;
@@ -45124,11 +45298,11 @@ async function teardownSandbox(sandbox, timeoutMs) {
45124
45298
  return await operation;
45125
45299
  let timer;
45126
45300
  let timedOut;
45127
- const deadline = new Promise((resolve27) => {
45301
+ const deadline = new Promise((resolve28) => {
45128
45302
  timer = setTimeout(() => {
45129
45303
  timedOut = teardownTimeoutError(timeoutMs);
45130
45304
  controller.abort(timedOut);
45131
- resolve27({ kind: "timed_out", error: timedOut });
45305
+ resolve28({ kind: "timed_out", error: timedOut });
45132
45306
  }, timeoutMs);
45133
45307
  });
45134
45308
  try {
@@ -45156,20 +45330,20 @@ async function acquireSandbox(options) {
45156
45330
  let timeoutError2;
45157
45331
  let timer;
45158
45332
  let onAbort;
45159
- const aborted = new Promise((resolve27) => {
45333
+ const aborted = new Promise((resolve28) => {
45160
45334
  onAbort = /* @__PURE__ */ __name(() => {
45161
45335
  operationController.abort(runSignal.reason);
45162
- resolve27({ kind: "cancelled" });
45336
+ resolve28({ kind: "cancelled" });
45163
45337
  }, "onAbort");
45164
45338
  runSignal.addEventListener("abort", onAbort, { once: true });
45165
45339
  });
45166
- const timedOut = new Promise((resolve27) => {
45340
+ const timedOut = new Promise((resolve28) => {
45167
45341
  if (options.timeoutMs === Number.POSITIVE_INFINITY)
45168
45342
  return;
45169
45343
  timer = setTimeout(() => {
45170
45344
  timeoutError2 = acquisitionTimeoutError(options.timeoutMs);
45171
45345
  operationController.abort(timeoutError2);
45172
- resolve27({ kind: "timed_out", error: timeoutError2 });
45346
+ resolve28({ kind: "timed_out", error: timeoutError2 });
45173
45347
  }, options.timeoutMs);
45174
45348
  });
45175
45349
  if (runSignal.aborted) {
@@ -45218,8 +45392,8 @@ async function acquireSandbox(options) {
45218
45392
  __name(acquireSandbox, "acquireSandbox");
45219
45393
 
45220
45394
  // ../sdk/dist/runtime/query/session-storage.js
45221
- import { readdir as readdir4, realpath as realpath4 } from "node:fs/promises";
45222
- import { basename as basename6, dirname as dirname12, join as join15, resolve as resolve8 } from "node:path";
45395
+ import { readdir as readdir4, realpath as realpath5 } from "node:fs/promises";
45396
+ import { basename as basename6, dirname as dirname13, join as join15, resolve as resolve9 } from "node:path";
45223
45397
 
45224
45398
  // ../sdk/dist/store/budget/ledger.js
45225
45399
  var SESSION_TOKEN_BUDGET_VERSION = 2;
@@ -45909,7 +46083,7 @@ var SessionTokenBudget = class _SessionTokenBudget {
45909
46083
 
45910
46084
  // ../sdk/dist/store/budget/disk.js
45911
46085
  import { mkdir as mkdir10, readFile as readFile10, rename as rename4, unlink as unlink8, writeFile as writeFile4 } from "node:fs/promises";
45912
- import { dirname as dirname11 } from "node:path";
46086
+ import { dirname as dirname12 } from "node:path";
45913
46087
  var DiskSessionTokenBudgetStore = class {
45914
46088
  static {
45915
46089
  __name(this, "DiskSessionTokenBudgetStore");
@@ -45937,7 +46111,7 @@ var DiskSessionTokenBudgetStore = class {
45937
46111
  const existing = await this.#read(path2, checkedScope);
45938
46112
  if (existing)
45939
46113
  assertSameRoot(existing, checked2);
45940
- await mkdir10(dirname11(path2), { recursive: true, mode: 448 });
46114
+ await mkdir10(dirname12(path2), { recursive: true, mode: 448 });
45941
46115
  const temporary = temporaryPathFor(path2);
45942
46116
  try {
45943
46117
  await writeFile4(temporary, `${JSON.stringify(checked2)}
@@ -46113,15 +46287,15 @@ async function placeInLayout(paths2, log) {
46113
46287
  }
46114
46288
  __name(placeInLayout, "placeInLayout");
46115
46289
  async function canonicalPath(path2) {
46116
- let existing = resolve8(path2);
46290
+ let existing = resolve9(path2);
46117
46291
  let remainder = "";
46118
46292
  for (; ; ) {
46119
- const found = await realpath4(existing).catch(() => void 0);
46293
+ const found = await realpath5(existing).catch(() => void 0);
46120
46294
  if (found !== void 0)
46121
46295
  return remainder ? join15(found, remainder) : found;
46122
- const parent = dirname12(existing);
46296
+ const parent = dirname13(existing);
46123
46297
  if (parent === existing)
46124
- return resolve8(path2);
46298
+ return resolve9(path2);
46125
46299
  remainder = remainder ? join15(basename6(existing), remainder) : basename6(existing);
46126
46300
  existing = parent;
46127
46301
  }
@@ -46350,8 +46524,8 @@ var ToolCallBudget = class {
46350
46524
  signal.throwIfAborted();
46351
46525
  const previous = this.chain;
46352
46526
  let release;
46353
- this.chain = new Promise((resolve27) => {
46354
- release = resolve27;
46527
+ this.chain = new Promise((resolve28) => {
46528
+ release = resolve28;
46355
46529
  });
46356
46530
  try {
46357
46531
  await previous;
@@ -46426,8 +46600,8 @@ async function resolveProviderContextWindow(provider, model, signal, timeoutMs,
46426
46600
  const resolverSignal = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
46427
46601
  const interrupted = /* @__PURE__ */ Symbol("provider-context-window-interrupted");
46428
46602
  let onAbort;
46429
- const interruption = new Promise((resolve27) => {
46430
- onAbort = /* @__PURE__ */ __name(() => resolve27(interrupted), "onAbort");
46603
+ const interruption = new Promise((resolve28) => {
46604
+ onAbort = /* @__PURE__ */ __name(() => resolve28(interrupted), "onAbort");
46431
46605
  resolverSignal.addEventListener("abort", onAbort, { once: true });
46432
46606
  });
46433
46607
  const deadlineMs = timeoutMs === 0 ? 5e3 : Math.min(Math.max(0, timeoutMs), 2147483647);
@@ -48923,6 +49097,14 @@ var ToolExecutor = class {
48923
49097
  static {
48924
49098
  __name(this, "ToolExecutor");
48925
49099
  }
49100
+ /** The recovery routes this turn actually has, so a pointer never names a missing tool. */
49101
+ recoveryRoutes() {
49102
+ const tools = this.config.tools;
49103
+ return {
49104
+ read: tools.get("read") !== void 0,
49105
+ conversation: tools.get("search_conversation") !== void 0 && tools.get("read_conversation") !== void 0
49106
+ };
49107
+ }
48926
49108
  outputDirectory() {
48927
49109
  return typeof this.config.toolOutputDir === "function" ? this.config.toolOutputDir() : this.config.toolOutputDir;
48928
49110
  }
@@ -49266,7 +49448,8 @@ var ToolExecutor = class {
49266
49448
  if (this.config.outsideRootAccess === "review" && !sandboxed && tool.pathArgument !== void 0) {
49267
49449
  const value = input[tool.pathArgument];
49268
49450
  if (typeof value === "string") {
49269
- const outside = await pathOutsideRoots(toolRoots(this.config), value);
49451
+ const retained = tool.name === "read" && await resolveRetainedOutput(this.outputDirectory(), value);
49452
+ const outside = retained ? void 0 : await pathOutsideRoots(toolRoots(this.config), value);
49270
49453
  if (outside !== void 0)
49271
49454
  outsidePaths = [outside];
49272
49455
  }
@@ -49579,6 +49762,7 @@ var ToolExecutor = class {
49579
49762
  })), {
49580
49763
  maxChars: maxChars2,
49581
49764
  spillDir: this.outputDirectory(),
49765
+ recoveryRoutes: this.recoveryRoutes(),
49582
49766
  onError: /* @__PURE__ */ __name((message) => this.log.warn("Failed to retain a tool output replaced for the message budget", {
49583
49767
  [NAMZU.TURN_ID]: this.config.turnId,
49584
49768
  "exception.message": message
@@ -49783,6 +49967,7 @@ var ToolExecutor = class {
49783
49967
  maxChars: this.config.maxToolOutputChars ?? DEFAULT_MAX_TOOL_OUTPUT_CHARS,
49784
49968
  retainedPreviewChars: this.config.retainedToolPreviewChars,
49785
49969
  spillDir: this.outputDirectory(),
49970
+ recoveryRoutes: this.recoveryRoutes(),
49786
49971
  onError: /* @__PURE__ */ __name((message) => this.log.warn("Failed to spill oversized nested tool output", {
49787
49972
  [NAMZU.TURN_ID]: this.config.turnId,
49788
49973
  [GENAI.TOOL_NAME]: name2,
@@ -49859,6 +50044,7 @@ var ToolExecutor = class {
49859
50044
  turnId: this.config.turnId,
49860
50045
  workingDirectory: this.config.workingDirectory,
49861
50046
  ...this.config.additionalDirectories?.length ? { additionalDirectories: this.config.additionalDirectories } : {},
50047
+ ...this.outputDirectory() ? { retainedOutputDirectory: this.outputDirectory() } : {},
49862
50048
  abortSignal: this.config.abortSignal,
49863
50049
  env: this.config.env,
49864
50050
  log: /* @__PURE__ */ __name((level, message) => this.log[level](message), "log"),
@@ -50124,6 +50310,7 @@ var ToolExecutor = class {
50124
50310
  maxChars: maxToolOutputChars,
50125
50311
  retainedPreviewChars: this.config.retainedToolPreviewChars,
50126
50312
  spillDir: this.outputDirectory(),
50313
+ recoveryRoutes: this.recoveryRoutes(),
50127
50314
  onError: /* @__PURE__ */ __name((message) => this.log.warn("Failed to retain original tool output", {
50128
50315
  [NAMZU.TURN_ID]: this.config.turnId,
50129
50316
  [GENAI.TOOL_NAME]: toolName,
@@ -50288,21 +50475,21 @@ ${note}`;
50288
50475
  let invocationOpen = true;
50289
50476
  const nestedDispatches = /* @__PURE__ */ new Set();
50290
50477
  try {
50291
- const expired = Number.isFinite(timeoutMs) && timeoutMs > 0 ? new Promise((resolve27) => {
50478
+ const expired = Number.isFinite(timeoutMs) && timeoutMs > 0 ? new Promise((resolve28) => {
50292
50479
  timer = setTimeout(() => {
50293
50480
  timedOut = true;
50294
50481
  controller.abort(new Error(`Tool "${toolName}" exceeded ${timeoutMs}ms`));
50295
- resolve27("timeout");
50482
+ resolve28("timeout");
50296
50483
  }, timeoutMs);
50297
50484
  }) : void 0;
50298
- const aborted = new Promise((resolve27) => {
50485
+ const aborted = new Promise((resolve28) => {
50299
50486
  if (controller.signal.aborted && !timedOut) {
50300
- resolve27("aborted");
50487
+ resolve28("aborted");
50301
50488
  return;
50302
50489
  }
50303
50490
  controller.signal.addEventListener("abort", () => {
50304
50491
  if (!timedOut)
50305
- resolve27("aborted");
50492
+ resolve28("aborted");
50306
50493
  }, { once: true });
50307
50494
  });
50308
50495
  const inheritedDispatch = toolContext.dispatchTool;
@@ -50789,6 +50976,7 @@ ${note}`;
50789
50976
  // A tool may return different host and model text. They must
50790
50977
  // never compete for the same exclusive spill filename.
50791
50978
  spillDir: this.outputDirectory() ? join16(this.outputDirectory(), "content") : void 0,
50979
+ recoveryRoutes: this.recoveryRoutes(),
50792
50980
  onError: /* @__PURE__ */ __name((message) => this.log.warn("Failed to spill oversized model tool content", {
50793
50981
  [NAMZU.TURN_ID]: this.config.turnId,
50794
50982
  [GENAI.TOOL_NAME]: toolName,
@@ -50843,8 +51031,8 @@ var Semaphore = class {
50843
51031
  this.available--;
50844
51032
  return Promise.resolve();
50845
51033
  }
50846
- return new Promise((resolve27) => {
50847
- this.waiters.push(resolve27);
51034
+ return new Promise((resolve28) => {
51035
+ this.waiters.push(resolve28);
50848
51036
  });
50849
51037
  }
50850
51038
  release() {
@@ -53233,7 +53421,7 @@ var ScanSessionIndex = class _ScanSessionIndex extends SessionIndexBase {
53233
53421
  // ../sdk/dist/store/session-index/sqlite.js
53234
53422
  import { mkdir as mkdir11, readdir as readdir6, rename as rename5, rm, stat as stat6 } from "node:fs/promises";
53235
53423
  import { createRequire } from "node:module";
53236
- import { basename as basename7, dirname as dirname13, join as join18 } from "node:path";
53424
+ import { basename as basename7, dirname as dirname14, join as join18 } from "node:path";
53237
53425
  var SESSION_INDEX_VERSION = 1;
53238
53426
  var sqliteModule;
53239
53427
  function loadSqlite() {
@@ -53424,7 +53612,7 @@ async function modifiedAt(path2) {
53424
53612
  }
53425
53613
  __name(modifiedAt, "modifiedAt");
53426
53614
  async function sweepAbandonedRebuilds(path2) {
53427
- const directory = dirname13(path2);
53615
+ const directory = dirname14(path2);
53428
53616
  const prefix = `${basename7(path2)}.tmp-`;
53429
53617
  let names;
53430
53618
  try {
@@ -53555,7 +53743,7 @@ var SqliteSessionIndex = class _SqliteSessionIndex extends SessionIndexBase {
53555
53743
  /** See {@link rebuildSqliteSessionIndex}. */
53556
53744
  static async rebuild(options) {
53557
53745
  const { DatabaseSync } = requireSqlite();
53558
- await mkdir11(dirname13(options.path), { recursive: true });
53746
+ await mkdir11(dirname14(options.path), { recursive: true });
53559
53747
  await sweepAbandonedRebuilds(options.path);
53560
53748
  const temporary = `${options.path}.tmp-${process.pid}-${uuidv7()}`;
53561
53749
  try {
@@ -53806,8 +53994,8 @@ function preservedSystemFloor(systemMessages) {
53806
53994
  return systemMessages.filter((m) => !isCompactionMessage(typeof m.content === "string" ? m.content : null) || m.retain === true);
53807
53995
  }
53808
53996
  __name(preservedSystemFloor, "preservedSystemFloor");
53809
- function splice(preservedSystem, summaryBody, retainedOlder, recentMessages) {
53810
- const summary2 = { ...buildCompactionMessage(summaryBody), retain: true };
53997
+ function splice(preservedSystem, summaryBody, retainedOlder, recentMessages, recoveryNote) {
53998
+ const summary2 = { ...buildCompactionMessage(summaryBody, recoveryNote), retain: true };
53811
53999
  return { messages: [...preservedSystem, summary2, ...retainedOlder, ...recentMessages], summary: summary2 };
53812
54000
  }
53813
54001
  __name(splice, "splice");
@@ -53867,7 +54055,7 @@ async function compactNow(input) {
53867
54055
  streamIdleTimeoutMs: input.streamIdleTimeoutMs,
53868
54056
  instructions: input.instructions
53869
54057
  });
53870
- const { messages, summary: summary2 } = splice(preservedSystem, body, retainedOlder, plan.recentMessages);
54058
+ const { messages, summary: summary2 } = splice(preservedSystem, body, retainedOlder, plan.recentMessages, input.recoveryNote);
53871
54059
  return publishManualCompaction(input, {
53872
54060
  messages,
53873
54061
  shed: input.messages.length - messages.length,
@@ -54524,7 +54712,7 @@ __name(createMemoryRecallStep, "createMemoryRecallStep");
54524
54712
  // ../sdk/dist/execution/local.js
54525
54713
  import { spawn } from "node:child_process";
54526
54714
  import { existsSync as existsSync3 } from "node:fs";
54527
- import { resolve as resolve9 } from "node:path";
54715
+ import { resolve as resolve10 } from "node:path";
54528
54716
 
54529
54717
  // ../sdk/dist/execution/base.js
54530
54718
  var InitializationSupersededError = class extends Error {
@@ -54815,7 +55003,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
54815
55003
  constructor(options) {
54816
55004
  super(options.log);
54817
55005
  this.id = options.id;
54818
- this.cwd = resolve9(options.cwd);
55006
+ this.cwd = resolve10(options.cwd);
54819
55007
  this.fsAccess = options.fsAccess ?? true;
54820
55008
  this.envVars = options.envVars ?? {};
54821
55009
  this.capabilities = options.capabilities ?? ["filesystem", "process", "shell"];
@@ -54851,7 +55039,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
54851
55039
  return this.cwd;
54852
55040
  }
54853
55041
  setCwd(newCwd) {
54854
- const resolved2 = resolve9(newCwd);
55042
+ const resolved2 = resolve10(newCwd);
54855
55043
  if (!existsSync3(resolved2)) {
54856
55044
  throw new Error(`Working directory does not exist: ${resolved2}`);
54857
55045
  }
@@ -54861,7 +55049,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
54861
55049
  return this.fsAccess;
54862
55050
  }
54863
55051
  resolvePath(relativePath) {
54864
- return resolve9(this.cwd, relativePath);
55052
+ return resolve10(this.cwd, relativePath);
54865
55053
  }
54866
55054
  getEnvVar(key5) {
54867
55055
  return this.envVars[key5] ?? process.env[key5];
@@ -54889,7 +55077,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
54889
55077
  durationMs: 0
54890
55078
  };
54891
55079
  }
54892
- const cwd = options?.cwd ? resolve9(this.cwd, options.cwd) : this.cwd;
55080
+ const cwd = options?.cwd ? resolve10(this.cwd, options.cwd) : this.cwd;
54893
55081
  const env = { ...process.env, ...this.envVars, ...options?.env };
54894
55082
  const timeoutMs = options?.timeoutMs ?? LOCAL_COMMAND_DEFAULT_TIMEOUT_MS;
54895
55083
  if (!Number.isInteger(timeoutMs) || timeoutMs < 0) {
@@ -55020,9 +55208,9 @@ var LocalExecutionContext = class extends BaseExecutionContext {
55020
55208
 
55021
55209
  // ../sdk/dist/turn/workspace-fingerprint.js
55022
55210
  import { createHash as createHash17 } from "node:crypto";
55023
- import { lstat as lstat4, readFile as readFile11, readlink } from "node:fs/promises";
55211
+ import { lstat as lstat5, readFile as readFile11, readlink } from "node:fs/promises";
55024
55212
  import { join as join20 } from "node:path";
55025
- var NODE_FS = { lstat: lstat4, readlink, readFile: readFile11 };
55213
+ var NODE_FS = { lstat: lstat5, readlink, readFile: readFile11 };
55026
55214
  var FINGERPRINT_MAX_BYTES = 4 * 1024 * 1024;
55027
55215
  var FINGERPRINT_TIMEOUT_MS = 2e4;
55028
55216
  async function untrackedEntry(cwd, rel, fs) {
@@ -55949,15 +56137,15 @@ var DiskTaskStore = class {
55949
56137
  break;
55950
56138
  await existing.catch(() => void 0);
55951
56139
  }
55952
- let resolve27;
56140
+ let resolve28;
55953
56141
  const lock = new Promise((r) => {
55954
- resolve27 = r;
56142
+ resolve28 = r;
55955
56143
  });
55956
56144
  this.locks.set(taskId, lock);
55957
56145
  try {
55958
56146
  return await fn();
55959
56147
  } finally {
55960
- resolve27?.();
56148
+ resolve28?.();
55961
56149
  if (this.locks.get(taskId) === lock) {
55962
56150
  this.locks.delete(taskId);
55963
56151
  }
@@ -56277,8 +56465,8 @@ var DiskTaskStore = class {
56277
56465
 
56278
56466
  // ../sdk/dist/store/memory/markdown.js
56279
56467
  import { createHash as createHash20 } from "node:crypto";
56280
- import { lstat as lstat6, mkdir as mkdir13, readFile as readFile14, readdir as readdir8, realpath as realpath5, rename as rename6, unlink as unlink11 } from "node:fs/promises";
56281
- import { dirname as dirname14, join as join24, resolve as resolve10 } from "node:path";
56468
+ import { lstat as lstat7, mkdir as mkdir13, readFile as readFile14, readdir as readdir8, realpath as realpath6, rename as rename6, unlink as unlink11 } from "node:fs/promises";
56469
+ import { dirname as dirname15, join as join24, resolve as resolve11 } from "node:path";
56282
56470
 
56283
56471
  // ../sdk/dist/store/memory/index-file.js
56284
56472
  var MEMORY_INDEX_MAX_LINES = 200;
@@ -56495,7 +56683,7 @@ __name(formatMemoryFile, "formatMemoryFile");
56495
56683
 
56496
56684
  // ../sdk/dist/store/memory/operation-lock.js
56497
56685
  import { randomUUID as randomUUID4 } from "node:crypto";
56498
- import { lstat as lstat5, open as open9, readFile as readFile13, unlink as unlink10 } from "node:fs/promises";
56686
+ import { lstat as lstat6, open as open9, readFile as readFile13, unlink as unlink10 } from "node:fs/promises";
56499
56687
  import { setTimeout as delay } from "node:timers/promises";
56500
56688
  var DEFAULT_MEMORY_LOCK_TIMEOUT_MS = 1e4;
56501
56689
  function validateMemoryLockTimeout(timeoutMs) {
@@ -56531,7 +56719,7 @@ async function acquireMemoryOperationLock(path2, timeoutMs) {
56531
56719
  } catch (error) {
56532
56720
  if (error.code !== "EEXIST")
56533
56721
  throw error;
56534
- const existing = await lstat5(path2).catch((statError) => {
56722
+ const existing = await lstat6(path2).catch((statError) => {
56535
56723
  if (statError.code === "ENOENT")
56536
56724
  return void 0;
56537
56725
  throw statError;
@@ -56558,7 +56746,7 @@ async function acquireMemoryOperationLock(path2, timeoutMs) {
56558
56746
  await handle.sync();
56559
56747
  } catch (error) {
56560
56748
  await handle.close();
56561
- const current = await lstat5(path2).catch(() => void 0);
56749
+ const current = await lstat6(path2).catch(() => void 0);
56562
56750
  if (current?.dev === identity.dev && current.ino === identity.ino) {
56563
56751
  await unlink10(path2).catch(() => void 0);
56564
56752
  }
@@ -56566,7 +56754,7 @@ async function acquireMemoryOperationLock(path2, timeoutMs) {
56566
56754
  }
56567
56755
  await handle.close();
56568
56756
  return async () => {
56569
- const current = await lstat5(path2);
56757
+ const current = await lstat6(path2);
56570
56758
  if (!current.isFile() || current.isSymbolicLink() || current.dev !== identity.dev || current.ino !== identity.ino || await readFile13(path2, "utf8") !== owner) {
56571
56759
  throw lockError(path2, "the lock owner changed before release", timeoutMs);
56572
56760
  }
@@ -56852,7 +57040,7 @@ var MarkdownMemoryStore = class {
56852
57040
  lockTimeoutMs;
56853
57041
  canonical;
56854
57042
  constructor(config) {
56855
- this.directory = resolve10(config.directory);
57043
+ this.directory = resolve11(config.directory);
56856
57044
  this.log = resolveLogger(config.logger).child({
56857
57045
  [SCOPE_ATTRIBUTE]: "store/memory/markdown"
56858
57046
  });
@@ -56867,14 +57055,14 @@ var MarkdownMemoryStore = class {
56867
57055
  if (this.canonical)
56868
57056
  return this.canonical;
56869
57057
  await mkdir13(this.directory, { recursive: true, mode: DIRECTORY_MODE });
56870
- this.canonical = await realpath5(this.directory);
57058
+ this.canonical = await realpath6(this.directory);
56871
57059
  return this.canonical;
56872
57060
  }
56873
57061
  memoryPath(dir, name2) {
56874
57062
  if (!isMemoryName(name2))
56875
57063
  invalidFile(join24(dir, `${name2}.md`), "name is not a memory name");
56876
- const path2 = resolve10(entryPath(dir, name2, ".md"));
56877
- if (dirname14(path2) !== dir)
57064
+ const path2 = resolve11(entryPath(dir, name2, ".md"));
57065
+ if (dirname15(path2) !== dir)
56878
57066
  invalidFile(path2, "resolved path escapes the memory directory");
56879
57067
  return path2;
56880
57068
  }
@@ -56890,7 +57078,7 @@ var MarkdownMemoryStore = class {
56890
57078
  if (!fileName2.endsWith(".md") || fileName2 === MEMORY_INDEX_FILE)
56891
57079
  continue;
56892
57080
  const path2 = join24(dir, fileName2);
56893
- const stat15 = await lstat6(path2).catch((error) => {
57081
+ const stat15 = await lstat7(path2).catch((error) => {
56894
57082
  if (error.code === "ENOENT")
56895
57083
  return void 0;
56896
57084
  throw error;
@@ -56953,7 +57141,7 @@ var MarkdownMemoryStore = class {
56953
57141
  }
56954
57142
  async setAside(path2) {
56955
57143
  let target = `${path2}${SUPERSEDED_SUFFIX}`;
56956
- const taken = /* @__PURE__ */ __name((candidate) => lstat6(candidate).then(() => true, () => false), "taken");
57144
+ const taken = /* @__PURE__ */ __name((candidate) => lstat7(candidate).then(() => true, () => false), "taken");
56957
57145
  for (let n = 2; await taken(target); n++)
56958
57146
  target = `${path2}${SUPERSEDED_SUFFIX}-${n}`;
56959
57147
  await rename6(path2, target);
@@ -57246,8 +57434,8 @@ ${text9 ? `${text9}
57246
57434
  };
57247
57435
 
57248
57436
  // ../sdk/dist/store/memory/disk.js
57249
- import { mkdir as mkdir14, realpath as realpath6, unlink as unlink12 } from "node:fs/promises";
57250
- import { dirname as dirname15, join as join25, resolve as resolve11 } from "node:path";
57437
+ import { mkdir as mkdir14, realpath as realpath7, unlink as unlink12 } from "node:fs/promises";
57438
+ import { dirname as dirname16, join as join25, resolve as resolve12 } from "node:path";
57251
57439
  var SCHEMA5 = defineSchema({ kind: "memory-store", current: 1, migrations: {} });
57252
57440
  function invalidIndex(reason2, details = {}) {
57253
57441
  throw new NamzuError({
@@ -57363,7 +57551,7 @@ var DiskMemoryStore = class {
57363
57551
  records = new DiskRecordStore(SCHEMA5);
57364
57552
  indexRecords = new DiskRecordStore(SCHEMA5);
57365
57553
  constructor(config) {
57366
- this.baseDir = config.directory === void 0 ? join25(config.baseDir, "memory") : resolve11(config.directory);
57554
+ this.baseDir = config.directory === void 0 ? join25(config.baseDir, "memory") : resolve12(config.directory);
57367
57555
  this.log = resolveLogger(config.logger).child({ [SCOPE_ATTRIBUTE]: "store/memory/disk" });
57368
57556
  this.lockTimeoutMs = config.lockTimeoutMs ?? DEFAULT_MEMORY_LOCK_TIMEOUT_MS;
57369
57557
  validateMemoryLockTimeout(this.lockTimeoutMs);
@@ -57376,10 +57564,10 @@ var DiskMemoryStore = class {
57376
57564
  return this.location;
57377
57565
  await mkdir14(this.contentDir, { recursive: true });
57378
57566
  const [canonicalBaseDir, canonicalContentDir] = await Promise.all([
57379
- realpath6(this.baseDir),
57380
- realpath6(this.contentDir)
57567
+ realpath7(this.baseDir),
57568
+ realpath7(this.contentDir)
57381
57569
  ]);
57382
- if (dirname15(canonicalContentDir) !== canonicalBaseDir) {
57570
+ if (dirname16(canonicalContentDir) !== canonicalBaseDir) {
57383
57571
  invalidIndex("the content directory resolves outside the memory store");
57384
57572
  }
57385
57573
  this.location = {
@@ -57390,8 +57578,8 @@ var DiskMemoryStore = class {
57390
57578
  }
57391
57579
  contentPath(location, id3) {
57392
57580
  assertStorageMemoryId(id3, (reason2) => invalidContent(id3, reason2, { field: "id" }));
57393
- const path2 = resolve11(entryPath(location.contentDir, id3, ".json"));
57394
- if (dirname15(path2) !== location.contentDir) {
57581
+ const path2 = resolve12(entryPath(location.contentDir, id3, ".json"));
57582
+ if (dirname16(path2) !== location.contentDir) {
57395
57583
  invalidContent(id3, "resolved path escapes the content directory", { field: "id" });
57396
57584
  }
57397
57585
  return path2;
@@ -57415,7 +57603,7 @@ var DiskMemoryStore = class {
57415
57603
  }
57416
57604
  async withAuthoritativeIndex(operation) {
57417
57605
  const location = await this.storageLocation();
57418
- const release = await acquireMemoryOperationLock(join25(dirname15(location.indexPath), "operation.lock"), this.lockTimeoutMs);
57606
+ const release = await acquireMemoryOperationLock(join25(dirname16(location.indexPath), "operation.lock"), this.lockTimeoutMs);
57419
57607
  try {
57420
57608
  await this.reloadIndex(location);
57421
57609
  return await operation(location);
@@ -60396,7 +60584,7 @@ var MockLLMProvider = class {
60396
60584
  async delay() {
60397
60585
  if (this.responseDelayMs <= 0)
60398
60586
  return;
60399
- await new Promise((resolve27) => setTimeout(resolve27, this.responseDelayMs));
60587
+ await new Promise((resolve28) => setTimeout(resolve28, this.responseDelayMs));
60400
60588
  }
60401
60589
  /**
60402
60590
  * The turn to play. A script shorter than the turn repeats its last
@@ -60774,7 +60962,7 @@ var StdioTransport = class {
60774
60962
  this.exitPending = false;
60775
60963
  return;
60776
60964
  }
60777
- await new Promise((resolve27) => {
60965
+ await new Promise((resolve28) => {
60778
60966
  let settled = false;
60779
60967
  const finish2 = /* @__PURE__ */ __name(() => {
60780
60968
  if (settled)
@@ -60782,7 +60970,7 @@ var StdioTransport = class {
60782
60970
  settled = true;
60783
60971
  clearTimeout(escalate);
60784
60972
  clearTimeout(giveUp);
60785
- resolve27();
60973
+ resolve28();
60786
60974
  }, "finish");
60787
60975
  child.once("close", finish2);
60788
60976
  child.once("error", finish2);
@@ -62057,7 +62245,7 @@ async function resolveMcpEra(input) {
62057
62245
  __name(resolveMcpEra, "resolveMcpEra");
62058
62246
 
62059
62247
  // ../sdk/dist/version.js
62060
- var VERSION2 = "53.0.0";
62248
+ var VERSION2 = "53.2.0";
62061
62249
 
62062
62250
  // ../sdk/dist/connector/mcp/client.js
62063
62251
  var MAX_LIST_PAGES = 100;
@@ -62381,7 +62569,7 @@ var MCPClient = class {
62381
62569
  capabilities: this.config.capabilities ?? {}
62382
62570
  });
62383
62571
  const controller = new AbortController();
62384
- return new Promise((resolve27) => {
62572
+ return new Promise((resolve28) => {
62385
62573
  let settled = false;
62386
62574
  const finish2 = /* @__PURE__ */ __name((answer) => {
62387
62575
  if (settled)
@@ -62390,7 +62578,7 @@ var MCPClient = class {
62390
62578
  clearTimeout(timer);
62391
62579
  if (this.pendingRequests.get(id3) === entry)
62392
62580
  this.pendingRequests.delete(id3);
62393
- resolve27(answer);
62581
+ resolve28(answer);
62394
62582
  }, "finish");
62395
62583
  const entry = {
62396
62584
  resolve: /* @__PURE__ */ __name((value) => finish2({ kind: "result", result: value }), "resolve"),
@@ -62964,8 +63152,8 @@ var MCPClient = class {
62964
63152
  let settled = false;
62965
63153
  let resolvePublic;
62966
63154
  let rejectPublic;
62967
- const result = new Promise((resolve27, reject2) => {
62968
- resolvePublic = resolve27;
63155
+ const result = new Promise((resolve28, reject2) => {
63156
+ resolvePublic = resolve28;
62969
63157
  rejectPublic = reject2;
62970
63158
  });
62971
63159
  const entry = {
@@ -63809,14 +63997,14 @@ var MCPReconnectSupervisor = class {
63809
63997
  });
63810
63998
  }
63811
63999
  wait(ms) {
63812
- return new Promise((resolve27) => {
64000
+ return new Promise((resolve28) => {
63813
64001
  const finish2 = /* @__PURE__ */ __name(() => {
63814
64002
  if (this.timer)
63815
64003
  clearTimeout(this.timer);
63816
64004
  this.timer = void 0;
63817
64005
  if (this.finishWait === finish2)
63818
64006
  this.finishWait = void 0;
63819
- resolve27();
64007
+ resolve28();
63820
64008
  }, "finish");
63821
64009
  this.finishWait = finish2;
63822
64010
  this.timer = setTimeout(finish2, ms);
@@ -64116,7 +64304,7 @@ async function mcpToolset(client, options = {}) {
64116
64304
  __name(mcpToolset, "mcpToolset");
64117
64305
 
64118
64306
  // ../sdk/dist/bridge/acp/server.js
64119
- import { isAbsolute as isAbsolute6 } from "node:path";
64307
+ import { isAbsolute as isAbsolute7 } from "node:path";
64120
64308
 
64121
64309
  // ../sdk/dist/constants/acp/index.js
64122
64310
  var ACP_PROTOCOL_VERSION = 1;
@@ -64447,7 +64635,7 @@ var ACPServer = class {
64447
64635
  request(method, params, signal) {
64448
64636
  this.requestSeq += 1;
64449
64637
  const id3 = `agent_${this.requestSeq}`;
64450
- return new Promise((resolve27, reject2) => {
64638
+ return new Promise((resolve28, reject2) => {
64451
64639
  const finish2 = /* @__PURE__ */ __name(() => {
64452
64640
  if (this.pending.get(id3) !== entry)
64453
64641
  return false;
@@ -64462,7 +64650,7 @@ var ACPServer = class {
64462
64650
  const entry = {
64463
64651
  resolve: /* @__PURE__ */ __name((value) => {
64464
64652
  if (finish2())
64465
- resolve27(value);
64653
+ resolve28(value);
64466
64654
  }, "resolve"),
64467
64655
  reject: /* @__PURE__ */ __name((error) => {
64468
64656
  if (finish2())
@@ -64609,7 +64797,7 @@ var ACPServer = class {
64609
64797
  }
64610
64798
  requireAbsoluteCwd(cwd) {
64611
64799
  const resolved2 = cwd ?? process.cwd();
64612
- if (!isAbsolute6(resolved2)) {
64800
+ if (!isAbsolute7(resolved2)) {
64613
64801
  throw new AcpError(ACP_ERROR_CODES.INVALID_PARAMS, `ACP session cwd must be an absolute path; received ${JSON.stringify(resolved2)}.`);
64614
64802
  }
64615
64803
  return resolved2;
@@ -66808,7 +66996,7 @@ __name(createResidentEvidenceRecallStep, "createResidentEvidenceRecallStep");
66808
66996
  // ../sdk/dist/pals/store.js
66809
66997
  import { randomUUID as randomUUID7 } from "node:crypto";
66810
66998
  import { chmodSync, closeSync, fsyncSync, linkSync, lstatSync as lstatSync3, mkdirSync as mkdirSync3, openSync, readFileSync, readdirSync, realpathSync as realpathSync3, unlinkSync, writeSync } from "node:fs";
66811
- import { dirname as dirname16, isAbsolute as isAbsolute7, join as join27, relative as relative3, resolve as resolve12, sep as sep6 } from "node:path";
66999
+ import { dirname as dirname17, isAbsolute as isAbsolute8, join as join27, relative as relative4, resolve as resolve13, sep as sep6 } from "node:path";
66812
67000
  var ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
66813
67001
  var REVISION_FILE = /^[1-9][0-9]*\.json$/u;
66814
67002
  var PalConflictError = class extends Error {
@@ -66829,7 +67017,7 @@ function palId(id3) {
66829
67017
  }
66830
67018
  __name(palId, "palId");
66831
67019
  function homePath(home) {
66832
- const path2 = resolve12(home);
67020
+ const path2 = resolve13(home);
66833
67021
  mkdirSync3(path2, { recursive: true, mode: 448 });
66834
67022
  const entry = lstatSync3(path2);
66835
67023
  if (!entry.isDirectory() || entry.isSymbolicLink())
@@ -66841,8 +67029,8 @@ function homePath(home) {
66841
67029
  }
66842
67030
  __name(homePath, "homePath");
66843
67031
  function contained(path2, root) {
66844
- const rel = relative3(root, path2);
66845
- return rel === "" || !isAbsolute7(rel) && rel !== ".." && !rel.startsWith(`..${sep6}`);
67032
+ const rel = relative4(root, path2);
67033
+ return rel === "" || !isAbsolute8(rel) && rel !== ".." && !rel.startsWith(`..${sep6}`);
66846
67034
  }
66847
67035
  __name(contained, "contained");
66848
67036
  function paths(home, workspaceRoot, id3) {
@@ -67076,7 +67264,7 @@ var DiskPalStore = class {
67076
67264
  }
67077
67265
  /** Exact validated host control directory; never an execution-computer claim. */
67078
67266
  atWorkspace(cwd) {
67079
- const lexical = resolve12(cwd);
67267
+ const lexical = resolve13(cwd);
67080
67268
  const canonical2 = realpathSync3(lexical);
67081
67269
  const lexicalReserved = contained(lexical, this.workspaceRoot);
67082
67270
  const canonicalReserved = contained(canonical2, this.workspaceRoot);
@@ -67084,7 +67272,7 @@ var DiskPalStore = class {
67084
67272
  return null;
67085
67273
  if (lexical !== canonical2)
67086
67274
  throw new Error("Pal workspace is a symlink alias.");
67087
- const rel = relative3(this.workspaceRoot, canonical2);
67275
+ const rel = relative4(this.workspaceRoot, canonical2);
67088
67276
  if (!ID.test(rel))
67089
67277
  throw new Error("Reserved Pal control directories cannot run ordinary host sessions. Open the exact Pal workspace.");
67090
67278
  const pal = this.get(rel);
@@ -67100,7 +67288,7 @@ function assertDirectory(path2) {
67100
67288
  }
67101
67289
  __name(assertDirectory, "assertDirectory");
67102
67290
  function publishExclusive(path2, value) {
67103
- const temporary = join27(dirname16(path2), `.pal-${randomUUID7()}.tmp`);
67291
+ const temporary = join27(dirname17(path2), `.pal-${randomUUID7()}.tmp`);
67104
67292
  const fd = openSync(temporary, "wx", 384);
67105
67293
  try {
67106
67294
  writeSync(fd, `${JSON.stringify(value)}
@@ -68593,10 +68781,10 @@ var ExternalHarnessSession = class {
68593
68781
  }
68594
68782
  }
68595
68783
  makeActive(turnId6, operationId, startedAt) {
68596
- let resolve27;
68784
+ let resolve28;
68597
68785
  let reject2;
68598
68786
  const done = new Promise((yes, no) => {
68599
- resolve27 = yes;
68787
+ resolve28 = yes;
68600
68788
  reject2 = no;
68601
68789
  });
68602
68790
  void done.catch(() => void 0);
@@ -68606,7 +68794,7 @@ var ExternalHarnessSession = class {
68606
68794
  startedAt,
68607
68795
  items: /* @__PURE__ */ new Map(),
68608
68796
  reviews: /* @__PURE__ */ new Map(),
68609
- resolve: resolve27,
68797
+ resolve: resolve28,
68610
68798
  reject: reject2,
68611
68799
  done
68612
68800
  };
@@ -69817,7 +70005,7 @@ ${line}`;
69817
70005
  stdout: true,
69818
70006
  stderr: true
69819
70007
  });
69820
- return await new Promise((resolve27) => {
70008
+ return await new Promise((resolve28) => {
69821
70009
  let settled = false;
69822
70010
  let terminal;
69823
70011
  const inFlight = /* @__PURE__ */ new Set();
@@ -69832,7 +70020,7 @@ ${line}`;
69832
70020
  clearTimeout(deadline);
69833
70021
  options.signal?.removeEventListener("abort", onAbort);
69834
70022
  void worker.terminate();
69835
- resolve27({ ...result, calls: [...calls] });
70023
+ resolve28({ ...result, calls: [...calls] });
69836
70024
  }, "finish");
69837
70025
  const finishTerminalWhenHostCallsSettle = /* @__PURE__ */ __name(() => {
69838
70026
  if (terminal && inFlight.size === 0)
@@ -71261,8 +71449,8 @@ ${body}`,
71261
71449
  let timer;
71262
71450
  await Promise.race([
71263
71451
  Promise.allSettled([...inFlight]),
71264
- new Promise((resolve27) => {
71265
- timer = setTimeout(resolve27, grace);
71452
+ new Promise((resolve28) => {
71453
+ timer = setTimeout(resolve28, grace);
71266
71454
  })
71267
71455
  ]);
71268
71456
  clearTimeout(timer);
@@ -72114,6 +72302,7 @@ var LocalTaskScheduler = class {
72114
72302
  {
72115
72303
  agentId: options.agentId,
72116
72304
  ...options.resumeSessionId ? { resumeSessionId: options.resumeSessionId } : {},
72305
+ ...options.continuationProfile ? { continuationProfile: options.continuationProfile } : {},
72117
72306
  beforeStart: options.beforeStart,
72118
72307
  ...options.workspace ? { workspace: options.workspace } : {},
72119
72308
  ...options.planId ? { planId: options.planId } : {},
@@ -72315,6 +72504,11 @@ var LocalTaskScheduler = class {
72315
72504
  async continueTask(taskId, message) {
72316
72505
  await this.agentManager.continueTask(taskId, message);
72317
72506
  }
72507
+ async restoreChild(options) {
72508
+ if (!this.agentManager.restoreChildConversation)
72509
+ return { status: "refused", reason: "no-layout" };
72510
+ return this.agentManager.restoreChildConversation(options, this.taskContext);
72511
+ }
72318
72512
  cancelTask(taskId, cause) {
72319
72513
  this.agentManager.cancel(taskId, cause);
72320
72514
  }
@@ -72612,9 +72806,9 @@ var PluginRegistry = class extends ManagedRegistry {
72612
72806
  };
72613
72807
 
72614
72808
  // ../sdk/dist/plugin/loader.js
72615
- import { lstat as lstat7, readFile as readFile16, readdir as readdir10, realpath as realpath7 } from "node:fs/promises";
72809
+ import { lstat as lstat8, readFile as readFile16, readdir as readdir10, realpath as realpath8 } from "node:fs/promises";
72616
72810
  import { homedir as homedir4, platform } from "node:os";
72617
- import { join as join30, resolve as resolve13 } from "node:path";
72811
+ import { join as join30, resolve as resolve14 } from "node:path";
72618
72812
 
72619
72813
  // ../sdk/dist/types/plugin/index.js
72620
72814
  var RENAMED_PLUGIN_HOOK_EVENTS = {
@@ -72680,7 +72874,7 @@ async function discoverPlugins(parentDir, log) {
72680
72874
  const logger = resolveLogger(log).child({ [SCOPE_ATTRIBUTE]: "plugin/loader" });
72681
72875
  const dirs = [];
72682
72876
  try {
72683
- const parent = await lstat7(parentDir);
72877
+ const parent = await lstat8(parentDir);
72684
72878
  if (parent.isSymbolicLink() || !parent.isDirectory()) {
72685
72879
  logger.warn("Refusing a non-regular plugins directory", {
72686
72880
  "namzu.plugin.parent_dir": parentDir
@@ -72692,7 +72886,7 @@ async function discoverPlugins(parentDir, log) {
72692
72886
  if (entry.startsWith(".") || entry.startsWith("_"))
72693
72887
  continue;
72694
72888
  const fullPath = join30(parentDir, entry);
72695
- const s = await lstat7(fullPath);
72889
+ const s = await lstat8(fullPath);
72696
72890
  if (s.isSymbolicLink()) {
72697
72891
  logger.warn("Refusing a symlinked plugin directory", { "namzu.plugin.path": fullPath });
72698
72892
  continue;
@@ -72701,7 +72895,7 @@ async function discoverPlugins(parentDir, log) {
72701
72895
  continue;
72702
72896
  const manifestPath = join30(fullPath, PLUGIN_MANIFEST_FILENAME);
72703
72897
  try {
72704
- const manifest = await lstat7(manifestPath);
72898
+ const manifest = await lstat8(manifestPath);
72705
72899
  if (manifest.isSymbolicLink() || !manifest.isFile()) {
72706
72900
  logger.warn("Refusing a non-regular plugin manifest", {
72707
72901
  "namzu.plugin.path": fullPath,
@@ -72720,12 +72914,12 @@ async function discoverPlugins(parentDir, log) {
72720
72914
  }
72721
72915
  __name(discoverPlugins, "discoverPlugins");
72722
72916
  async function loadPluginManifest(pluginDir, capabilities2 = {}) {
72723
- const root = await lstat7(pluginDir);
72917
+ const root = await lstat8(pluginDir);
72724
72918
  if (root.isSymbolicLink() || !root.isDirectory()) {
72725
72919
  throw new Error(`Plugin root must be a regular directory: ${pluginDir}`);
72726
72920
  }
72727
72921
  const manifestPath = join30(pluginDir, PLUGIN_MANIFEST_FILENAME);
72728
- const manifestEntry = await lstat7(manifestPath);
72922
+ const manifestEntry = await lstat8(manifestPath);
72729
72923
  if (manifestEntry.isSymbolicLink() || !manifestEntry.isFile()) {
72730
72924
  throw new Error(`Plugin manifest must be a regular file, not a symlink: ${manifestPath}`);
72731
72925
  }
@@ -72795,9 +72989,9 @@ async function samePhysicalDirectory(left, right) {
72795
72989
  const canonical2 = /* @__PURE__ */ __name(async (path2) => {
72796
72990
  let value;
72797
72991
  try {
72798
- value = await realpath7(path2);
72992
+ value = await realpath8(path2);
72799
72993
  } catch {
72800
- value = resolve13(path2);
72994
+ value = resolve14(path2);
72801
72995
  }
72802
72996
  return platform() === "win32" ? value.toLocaleLowerCase("en-US") : value;
72803
72997
  }, "canonical");
@@ -73754,7 +73948,7 @@ function runShellHook(entry, input, signal) {
73754
73948
  });
73755
73949
  const toolPath = pathOf(input.toolInput);
73756
73950
  const { NAMZU_TURN_ID: _inheritedTurnId, ...inherited } = process.env;
73757
- return new Promise((resolve27) => {
73951
+ return new Promise((resolve28) => {
73758
73952
  let child;
73759
73953
  try {
73760
73954
  child = spawnHostShell(entry.command, {
@@ -73781,7 +73975,7 @@ function runShellHook(entry, input, signal) {
73781
73975
  ...process.platform === "win32" ? {} : { shell: { path: "sh", dialect: "sh", source: "sh" } }
73782
73976
  });
73783
73977
  } catch (error) {
73784
- resolve27({
73978
+ resolve28({
73785
73979
  exitCode: null,
73786
73980
  timedOut: false,
73787
73981
  stdout: "",
@@ -73807,7 +74001,7 @@ function runShellHook(entry, input, signal) {
73807
74001
  settled = true;
73808
74002
  clearTimeout(timer);
73809
74003
  signal?.removeEventListener("abort", onAbort);
73810
- resolve27(outcome);
74004
+ resolve28(outcome);
73811
74005
  }, "finish");
73812
74006
  const killTree2 = /* @__PURE__ */ __name(() => {
73813
74007
  if (child.pid !== void 0 && process.platform !== "win32") {
@@ -74358,8 +74552,8 @@ function summarizeBlocking(sessions) {
74358
74552
  __name(summarizeBlocking, "summarizeBlocking");
74359
74553
 
74360
74554
  // ../sdk/dist/manager/agent/lifecycle.js
74361
- import { realpath as realpath8, rm as rm2, stat as stat10 } from "node:fs/promises";
74362
- import { isAbsolute as isAbsolute8, relative as relative4, resolve as resolve14, sep as sep7 } from "node:path";
74555
+ import { realpath as realpath9, rm as rm2, stat as stat10 } from "node:fs/promises";
74556
+ import { isAbsolute as isAbsolute9, relative as relative5, resolve as resolve15, sep as sep7 } from "node:path";
74363
74557
 
74364
74558
  // ../sdk/dist/session/handoff/capacity.js
74365
74559
  var DelegationCapacityExceeded = class extends Error {
@@ -74450,14 +74644,14 @@ function mergeEnv(base3, override) {
74450
74644
  __name(mergeEnv, "mergeEnv");
74451
74645
  async function requireIsolatedWorktreePath(ref, callerCwd, subdirectory) {
74452
74646
  const meta = ref?.meta;
74453
- if (typeof ref?.id !== "string" || ref.id.length === 0 || meta?.backend !== "git-worktree" || typeof meta.repoRoot !== "string" || !isAbsolute8(meta.repoRoot) || typeof meta.branch !== "string" || meta.branch.length === 0 || typeof meta.worktreePath !== "string" || !isAbsolute8(meta.worktreePath) || resolve14(meta.worktreePath) === resolve14(callerCwd ?? process.cwd())) {
74647
+ if (typeof ref?.id !== "string" || ref.id.length === 0 || meta?.backend !== "git-worktree" || typeof meta.repoRoot !== "string" || !isAbsolute9(meta.repoRoot) || typeof meta.branch !== "string" || meta.branch.length === 0 || typeof meta.worktreePath !== "string" || !isAbsolute9(meta.worktreePath) || resolve15(meta.worktreePath) === resolve15(callerCwd ?? process.cwd())) {
74454
74648
  throw new Error("Isolated git-worktree driver returned an invalid workspace ref or path");
74455
74649
  }
74456
74650
  let physicalPaths;
74457
74651
  try {
74458
74652
  physicalPaths = await Promise.all([
74459
- realpath8(meta.worktreePath),
74460
- realpath8(resolve14(callerCwd ?? process.cwd()))
74653
+ realpath9(meta.worktreePath),
74654
+ realpath9(resolve15(callerCwd ?? process.cwd()))
74461
74655
  ]);
74462
74656
  if (!(await stat10(physicalPaths[0])).isDirectory()) {
74463
74657
  throw new Error("The worktree path is not a directory");
@@ -74472,25 +74666,25 @@ async function requireIsolatedWorktreePath(ref, callerCwd, subdirectory) {
74472
74666
  }
74473
74667
  if (subdirectory === void 0)
74474
74668
  return meta.worktreePath;
74475
- if (typeof subdirectory !== "string" || subdirectory.length === 0 || isAbsolute8(subdirectory)) {
74669
+ if (typeof subdirectory !== "string" || subdirectory.length === 0 || isAbsolute9(subdirectory)) {
74476
74670
  throw new Error("Isolated workspace subdirectory must be a nonempty relative path");
74477
74671
  }
74478
- const lexicalChild = resolve14(meta.worktreePath, subdirectory);
74479
- const lexicalRelative = relative4(resolve14(meta.worktreePath), lexicalChild);
74480
- if (isAbsolute8(lexicalRelative) || lexicalRelative === ".." || lexicalRelative.startsWith(`..${sep7}`)) {
74672
+ const lexicalChild = resolve15(meta.worktreePath, subdirectory);
74673
+ const lexicalRelative = relative5(resolve15(meta.worktreePath), lexicalChild);
74674
+ if (isAbsolute9(lexicalRelative) || lexicalRelative === ".." || lexicalRelative.startsWith(`..${sep7}`)) {
74481
74675
  throw new Error("Isolated workspace subdirectory escapes the worktree");
74482
74676
  }
74483
74677
  let physicalChild;
74484
74678
  try {
74485
- physicalChild = await realpath8(lexicalChild);
74679
+ physicalChild = await realpath9(lexicalChild);
74486
74680
  if (!(await stat10(physicalChild)).isDirectory()) {
74487
74681
  throw new Error("The selected worktree path is not a directory");
74488
74682
  }
74489
74683
  } catch (cause) {
74490
74684
  throw new Error("Isolated workspace subdirectory is missing or not a directory", { cause });
74491
74685
  }
74492
- const physicalRelative = relative4(physicalPaths[0], physicalChild);
74493
- if (physicalRelative === "" || isAbsolute8(physicalRelative) || physicalRelative === ".." || physicalRelative.startsWith(`..${sep7}`)) {
74686
+ const physicalRelative = relative5(physicalPaths[0], physicalChild);
74687
+ if (physicalRelative === "" || isAbsolute9(physicalRelative) || physicalRelative === ".." || physicalRelative.startsWith(`..${sep7}`)) {
74494
74688
  throw new Error("Isolated workspace subdirectory resolves outside its worktree");
74495
74689
  }
74496
74690
  return physicalChild;
@@ -75125,7 +75319,8 @@ var AgentManager = class {
75125
75319
  agentType: placement.agentType,
75126
75320
  description: placement.description,
75127
75321
  status: "running",
75128
- createdAt: placement.createdAt
75322
+ createdAt: placement.createdAt,
75323
+ ...placement.continuation ? { continuation: placement.continuation } : {}
75129
75324
  };
75130
75325
  }
75131
75326
  /**
@@ -75176,7 +75371,13 @@ var AgentManager = class {
75176
75371
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
75177
75372
  toolCallId: spawnToolCallId(taskId),
75178
75373
  agentType: options.agentId,
75179
- description: describeSpawn(options)
75374
+ description: describeSpawn(options),
75375
+ ...options.continuationProfile ? {
75376
+ continuation: {
75377
+ workspace: options.workspace?.mode === "isolated" ? "isolated" : "shared",
75378
+ profile: { ...options.continuationProfile }
75379
+ }
75380
+ } : {}
75180
75381
  };
75181
75382
  await writeChildSessionMeta(spawnRecord.placement.metaPath, this.childMeta(spawnRecord));
75182
75383
  return DiskSessionLog.at(paths2, {
@@ -75278,9 +75479,9 @@ var AgentManager = class {
75278
75479
  if (isTerminalAgentTaskState(agentTask.state)) {
75279
75480
  return Promise.resolve();
75280
75481
  }
75281
- return new Promise((resolve27) => {
75482
+ return new Promise((resolve28) => {
75282
75483
  const existing = this.completionCallbacks.get(taskId) ?? [];
75283
- existing.push(resolve27);
75484
+ existing.push(resolve28);
75284
75485
  this.completionCallbacks.set(taskId, existing);
75285
75486
  });
75286
75487
  }
@@ -75487,11 +75688,156 @@ var AgentManager = class {
75487
75688
  origin,
75488
75689
  topicId: context2.topicId,
75489
75690
  projectId: context2.projectId,
75490
- cwd: resolve14(options.input.workingDirectory ?? process.cwd()),
75691
+ cwd: resolve15(options.input.workingDirectory ?? process.cwd()),
75491
75692
  log,
75492
75693
  activeSubSessionId: origin.subSessionId
75493
75694
  });
75494
75695
  }
75696
+ /**
75697
+ * Make a child saved by an earlier process continuable again.
75698
+ *
75699
+ * Reads the child's meta document and log from the project layout under the
75700
+ * invoking parent, checks they describe a settled, shared-workspace child of
75701
+ * this very parent session, then re-creates the in-memory session and edge
75702
+ * and the retained conversation that {@link provisionContinuation} requires.
75703
+ * It runs nothing; the caller continues the child with `sendMessage` and
75704
+ * `resumeSessionId`, so the invoking turn's authority, limits and review
75705
+ * channel apply exactly as for a child that finished in this process.
75706
+ */
75707
+ async restoreChildConversation(options, context2) {
75708
+ const refuse3 = /* @__PURE__ */ __name((reason2) => ({
75709
+ status: "refused",
75710
+ reason: reason2
75711
+ }), "refuse");
75712
+ const id3 = options.childSessionId;
75713
+ const retained = this.childConversations.get(id3);
75714
+ if (retained?.activeSubSessionId)
75715
+ return refuse3("running");
75716
+ const paths2 = context2.childStorage?.kind === "disk" ? context2.childStorage.paths : this.deps.paths;
75717
+ if (!paths2)
75718
+ return refuse3("no-layout");
75719
+ const store = this.deps.sessionStore;
75720
+ if (store.supportsInvocationSummaries !== true || store.supportsOwnerVersionCas !== true)
75721
+ return refuse3("not-resumable");
75722
+ const ancestry = await store.getAncestry(context2.sessionId, context2.tenantId);
75723
+ const parentLocator = {
75724
+ sessionId: context2.sessionId,
75725
+ ancestors: ancestry.slice(0, -1)
75726
+ };
75727
+ let meta;
75728
+ try {
75729
+ meta = await readChildSessionMeta(paths2.subagentMeta(parentLocator, id3));
75730
+ } catch {
75731
+ return refuse3("not-saved");
75732
+ }
75733
+ if (!meta)
75734
+ return refuse3("not-saved");
75735
+ if (meta.sessionId !== id3 || meta.parentSessionId !== context2.sessionId)
75736
+ return refuse3("foreign");
75737
+ const continuation = meta.continuation;
75738
+ if (!continuation || continuation.workspace !== "shared")
75739
+ return refuse3("not-resumable");
75740
+ const agentId = options.agentFor(continuation.profile);
75741
+ if (agentId === void 0 || !this.registry.has(agentId))
75742
+ return refuse3("not-resumable");
75743
+ const log = retained?.log ?? DiskSessionLog.at(paths2, { sessionId: id3, ancestors: ancestry });
75744
+ const ended = await childSessionEnded(log);
75745
+ if (!ended)
75746
+ return refuse3("unsettled");
75747
+ if (ended.status === "cancelled" || meta.status === "cancelled")
75748
+ return refuse3("stopped");
75749
+ const started = await log.head();
75750
+ if (started === null)
75751
+ return refuse3("unsettled");
75752
+ for await (const { record: record3 } of log.read({ mode: "tolerant" })) {
75753
+ if (record3.type !== "session_started")
75754
+ continue;
75755
+ if (record3.projectId !== context2.projectId || record3.topicId !== context2.topicId)
75756
+ return refuse3("foreign");
75757
+ break;
75758
+ }
75759
+ const placement = {
75760
+ paths: paths2,
75761
+ metaPath: paths2.subagentMeta(parentLocator, id3),
75762
+ createdAt: meta.createdAt,
75763
+ toolCallId: meta.toolCallId,
75764
+ agentType: meta.agentType,
75765
+ description: meta.description,
75766
+ continuation
75767
+ };
75768
+ const restored = {
75769
+ status: "restored",
75770
+ childSessionId: id3,
75771
+ agentId,
75772
+ profile: continuation.profile,
75773
+ description: meta.description
75774
+ };
75775
+ if (retained)
75776
+ return restored;
75777
+ if (this.childConversations.size >= RETAINED_CHILD_CONVERSATION_CAP) {
75778
+ const oldest = [...this.childConversations].find(([, value]) => !value.activeSubSessionId);
75779
+ if (!oldest)
75780
+ return refuse3("full");
75781
+ this.childConversations.delete(oldest[0]);
75782
+ }
75783
+ const childActor = {
75784
+ kind: "agent",
75785
+ agentId,
75786
+ tenantId: context2.tenantId,
75787
+ parentActor: context2.parentActor
75788
+ };
75789
+ let child = await store.getSession(id3, context2.tenantId);
75790
+ let createdChild = false;
75791
+ let edge;
75792
+ let createdEdge = false;
75793
+ try {
75794
+ if (child) {
75795
+ if (child.status === "active" || child.status === "archived" || child.status === "locked" || child.projectId !== context2.projectId || child.topicId !== context2.topicId || child.currentActor?.kind !== "agent" || child.currentActor.agentId !== agentId)
75796
+ return refuse3("running");
75797
+ } else {
75798
+ child = await store.createSession({ id: id3, topicId: context2.topicId, projectId: context2.projectId, currentActor: childActor }, context2.tenantId);
75799
+ createdChild = true;
75800
+ }
75801
+ edge = (await store.getChildren(context2.sessionId, context2.tenantId)).find((candidate) => candidate.childSessionId === id3);
75802
+ if (!edge) {
75803
+ edge = await store.createSubSession({
75804
+ parentSessionId: context2.sessionId,
75805
+ childSessionId: id3,
75806
+ kind: "agent_spawn",
75807
+ spawnedBy: context2.parentActor,
75808
+ failureMode: "delegate",
75809
+ completionMode: "summary_ref"
75810
+ }, context2.tenantId);
75811
+ createdEdge = true;
75812
+ }
75813
+ } catch (error) {
75814
+ if (edge && createdEdge)
75815
+ await store.deleteSubSession(edge.id, context2.tenantId).catch(() => void 0);
75816
+ if (child && createdChild)
75817
+ await store.deleteSession(id3, context2.tenantId).catch(() => void 0);
75818
+ throw error;
75819
+ }
75820
+ this.childConversations.set(id3, {
75821
+ definition: this.registry.getOrThrow(agentId),
75822
+ origin: {
75823
+ subSessionId: edge.id,
75824
+ childSessionId: id3,
75825
+ tenantId: context2.tenantId,
75826
+ parentSessionId: context2.sessionId,
75827
+ parentTurnId: meta.parentTurnId,
75828
+ rootSessionId: meta.rootSessionId,
75829
+ ancestry,
75830
+ childDepth: meta.depth,
75831
+ childOwnerVersion: child.ownerVersion,
75832
+ placement
75833
+ },
75834
+ topicId: context2.topicId,
75835
+ projectId: context2.projectId,
75836
+ cwd: resolve15(options.workingDirectory),
75837
+ log
75838
+ });
75839
+ return restored;
75840
+ }
75495
75841
  releaseChildConversation(record3) {
75496
75842
  const conversation = this.childConversations.get(record3.childSessionId);
75497
75843
  if (conversation?.activeSubSessionId !== record3.subSessionId)
@@ -75515,7 +75861,7 @@ var AgentManager = class {
75515
75861
  throw new Error("Child conversation is still running or settling");
75516
75862
  if (origin.workspaceRef || options.workspace?.mode === "isolated" || options.workspaceBackend)
75517
75863
  throw new Error("Child continuation requires a shared workspace; isolated leases cannot be resumed");
75518
- if (resolve14(options.input.workingDirectory ?? process.cwd()) !== conversation.cwd)
75864
+ if (resolve15(options.input.workingDirectory ?? process.cwd()) !== conversation.cwd)
75519
75865
  throw new Error("Child continuation cannot change its working directory");
75520
75866
  const store = this.deps.sessionStore;
75521
75867
  if (store.supportsInvocationSummaries !== true || store.supportsOwnerVersionCas !== true)
@@ -75854,8 +76200,8 @@ var AgentManager = class {
75854
76200
  resolveCompletionCallbacks(taskId) {
75855
76201
  const callbacks = this.completionCallbacks.get(taskId);
75856
76202
  if (callbacks) {
75857
- for (const resolve27 of callbacks)
75858
- resolve27();
76203
+ for (const resolve28 of callbacks)
76204
+ resolve28();
75859
76205
  this.completionCallbacks.delete(taskId);
75860
76206
  }
75861
76207
  }
@@ -76049,11 +76395,11 @@ import { spawn as spawn3, spawnSync } from "node:child_process";
76049
76395
  import { constants as constants3, accessSync as accessSync2, existsSync as existsSync4, realpathSync as realpathSync4 } from "node:fs";
76050
76396
  import { readFile as fsReadFile, writeFile as fsWriteFile, mkdir as mkdir16, open as open10, readdir as readdir11, rename as rename7, rm as rm3, stat as stat11 } from "node:fs/promises";
76051
76397
  import { tmpdir as tmpdir2 } from "node:os";
76052
- import { dirname as dirname17, isAbsolute as isAbsolute10, join as join31, parse as parse3, resolve as resolve15 } from "node:path";
76398
+ import { dirname as dirname18, isAbsolute as isAbsolute11, join as join31, parse as parse3, resolve as resolve16 } from "node:path";
76053
76399
 
76054
76400
  // ../sdk/dist/sandbox/file-walk.js
76055
76401
  var import_brace_expansion2 = __toESM(require_brace_expansion(), 1);
76056
- import { isAbsolute as isAbsolute9, posix as posix3 } from "node:path";
76402
+ import { isAbsolute as isAbsolute10, posix as posix3 } from "node:path";
76057
76403
 
76058
76404
  // ../../node_modules/.pnpm/minimatch@9.0.9/node_modules/minimatch/dist/esm/index.js
76059
76405
  var import_brace_expansion = __toESM(require_brace_expansion(), 1);
@@ -77610,7 +77956,7 @@ function positiveInteger(value, name2) {
77610
77956
  }
77611
77957
  __name(positiveInteger, "positiveInteger");
77612
77958
  function planWalk(root, options) {
77613
- if (!isAbsolute9(root) && !posix3.isAbsolute(root)) {
77959
+ if (!isAbsolute10(root) && !posix3.isAbsolute(root)) {
77614
77960
  throw new Error("File walk root must be an absolute path");
77615
77961
  }
77616
77962
  let pattern = options.pattern ?? "**/*";
@@ -77667,7 +78013,7 @@ function planWalk(root, options) {
77667
78013
  __name(planWalk, "planWalk");
77668
78014
  function directoryMatcher(plan) {
77669
78015
  const patterns = plan.patterns.map((set3) => set3.map((part2) => typeof part2 === "object" && part2 !== null ? new RegExp(part2.source, `${part2.flags}s`) : part2));
77670
- return (relative10) => patterns.some((pattern) => {
78016
+ return (relative11) => patterns.some((pattern) => {
77671
78017
  const closure = /* @__PURE__ */ __name((states2) => {
77672
78018
  for (const index of states2)
77673
78019
  if (pattern[index] === null)
@@ -77675,7 +78021,7 @@ function directoryMatcher(plan) {
77675
78021
  return states2;
77676
78022
  }, "closure");
77677
78023
  let states = closure(/* @__PURE__ */ new Set([0]));
77678
- for (const name2 of relative10.split("/")) {
78024
+ for (const name2 of relative11.split("/")) {
77679
78025
  const next = /* @__PURE__ */ new Set();
77680
78026
  for (const index of states) {
77681
78027
  const segment2 = pattern[index];
@@ -77795,14 +78141,14 @@ async function* executeWalk(plan, signal) {
77795
78141
  }
77796
78142
  if (plan.prefix.length >= maxDepth)
77797
78143
  return;
77798
- const openDirectory = /* @__PURE__ */ __name(async (absolute, relative10, depth) => {
78144
+ const openDirectory = /* @__PURE__ */ __name(async (absolute, relative11, depth) => {
77799
78145
  check2();
77800
78146
  try {
77801
78147
  const dir = await wait(fs.opendir(absolute), (late2) => {
77802
78148
  void close(late2).catch(() => {
77803
78149
  });
77804
78150
  });
77805
- open13.push({ dir, relative: relative10, depth });
78151
+ open13.push({ dir, relative: relative11, depth });
77806
78152
  } catch (error) {
77807
78153
  if (!missing(error))
77808
78154
  throw error;
@@ -77820,15 +78166,15 @@ async function* executeWalk(plan, signal) {
77820
78166
  continue;
77821
78167
  }
77822
78168
  noteVisit();
77823
- const relative10 = frame.relative ? `${frame.relative}/${entry.name}` : entry.name;
77824
- const absolute = path2.join(plan.root, relative10);
78169
+ const relative11 = frame.relative ? `${frame.relative}/${entry.name}` : entry.name;
78170
+ const absolute = path2.join(plan.root, relative11);
77825
78171
  const depth = frame.depth + 1;
77826
78172
  if (entry.isDirectory()) {
77827
- if (depth < maxDepth && canDescend(relative10))
77828
- await openDirectory(absolute, relative10, depth);
78173
+ if (depth < maxDepth && canDescend(relative11))
78174
+ await openDirectory(absolute, relative11, depth);
77829
78175
  continue;
77830
78176
  }
77831
- if (!entry.isFile() || !matchers.some((matcher) => matcher.test(relative10)))
78177
+ if (!entry.isFile() || !matchers.some((matcher) => matcher.test(relative11)))
77832
78178
  continue;
77833
78179
  let info;
77834
78180
  try {
@@ -77960,7 +78306,7 @@ var CappedStream = class {
77960
78306
  }
77961
78307
  };
77962
78308
  function requiredWrapper(request) {
77963
- if (request.wrapperCommand === void 0 || !isAbsolute10(request.wrapperCommand)) {
78309
+ if (request.wrapperCommand === void 0 || !isAbsolute11(request.wrapperCommand)) {
77964
78310
  throw new Error(`Sandbox environment ${request.environment} requires the absolute wrapper path that was probed`);
77965
78311
  }
77966
78312
  return request.wrapperCommand;
@@ -78058,7 +78404,7 @@ function buildBwrapArgs(sandboxRoot, additionalDirectories = []) {
78058
78404
  if (existsSync4(path2))
78059
78405
  args.push("--ro-bind", path2, path2);
78060
78406
  }
78061
- const interpreterPrefix = dirname17(dirname17(canonicalizePath(process.execPath)));
78407
+ const interpreterPrefix = dirname18(dirname18(canonicalizePath(process.execPath)));
78062
78408
  const alreadyCovered = BWRAP_SYSTEM_PATHS.some((path2) => interpreterPrefix === path2 || interpreterPrefix.startsWith(`${path2}/`));
78063
78409
  if (!alreadyCovered && existsSync4(interpreterPrefix)) {
78064
78410
  args.push("--ro-bind", interpreterPrefix, interpreterPrefix);
@@ -78229,7 +78575,7 @@ var LocalSandbox = class {
78229
78575
  this.rootDir = rootDir;
78230
78576
  this.environment = environment;
78231
78577
  this.config = config;
78232
- this.additionalDirectories = (config.additionalDirectories ?? []).map((dir) => canonicalizePath(resolve15(dir))).filter((dir) => dir !== rootDir);
78578
+ this.additionalDirectories = (config.additionalDirectories ?? []).map((dir) => canonicalizePath(resolve16(dir))).filter((dir) => dir !== rootDir);
78233
78579
  this._status = "ready";
78234
78580
  this.log = log.child({
78235
78581
  [SCOPE_ATTRIBUTE]: "sandbox/provider/local",
@@ -78273,7 +78619,7 @@ var LocalSandbox = class {
78273
78619
  throw new Error(`Sandbox ${this.id} is destroyed`);
78274
78620
  }
78275
78621
  const resolved2 = await resolveWithinAnyReal(this.roots, path2);
78276
- await mkdir16(dirname17(resolved2), { recursive: true });
78622
+ await mkdir16(dirname18(resolved2), { recursive: true });
78277
78623
  const tmpPath = `${resolved2}.tmp.${Date.now()}`;
78278
78624
  await fsWriteFile(tmpPath, content);
78279
78625
  await rename7(tmpPath, resolved2);
@@ -78622,7 +78968,7 @@ var LocalSandboxProvider = class {
78622
78968
  let rootDir;
78623
78969
  let removeRootOnDestroy;
78624
78970
  if (config?.workingDirectory !== void 0) {
78625
- const requested = resolve15(config.workingDirectory);
78971
+ const requested = resolve16(config.workingDirectory);
78626
78972
  let entry;
78627
78973
  try {
78628
78974
  entry = await stat11(requested);
@@ -78645,9 +78991,9 @@ var LocalSandboxProvider = class {
78645
78991
  }
78646
78992
  removeRootOnDestroy = false;
78647
78993
  for (const dir of config.additionalDirectories ?? []) {
78648
- const entry2 = await stat11(resolve15(dir)).catch(() => null);
78994
+ const entry2 = await stat11(resolve16(dir)).catch(() => null);
78649
78995
  if (!entry2?.isDirectory()) {
78650
- throw new Error(`Sandbox additional directory is not a directory: ${resolve15(dir)}`);
78996
+ throw new Error(`Sandbox additional directory is not a directory: ${resolve16(dir)}`);
78651
78997
  }
78652
78998
  }
78653
78999
  } else {
@@ -78704,8 +79050,8 @@ var WorkspaceBackendRegistry = class {
78704
79050
  // ../sdk/dist/session/workspace/git-worktree.js
78705
79051
  import { execFile } from "node:child_process";
78706
79052
  import { readFileSync as readFileSync2, realpathSync as realpathSync5 } from "node:fs";
78707
- import { realpath as realpath9 } from "node:fs/promises";
78708
- import { basename as basename9, dirname as dirname18, isAbsolute as isAbsolute11, join as join32, relative as relative5, resolve as resolve16, sep as sep9 } from "node:path";
79053
+ import { realpath as realpath10 } from "node:fs/promises";
79054
+ import { basename as basename9, dirname as dirname19, isAbsolute as isAbsolute12, join as join32, relative as relative6, resolve as resolve17, sep as sep9 } from "node:path";
78709
79055
  import { promisify } from "node:util";
78710
79056
  var execFileAsync = promisify(execFile);
78711
79057
  var defaultExecFile = /* @__PURE__ */ __name(async (file, args) => execFileAsync(file, [...args]), "defaultExecFile");
@@ -78719,8 +79065,8 @@ var GitWorktreeDriver = class {
78719
79065
  log;
78720
79066
  exec;
78721
79067
  constructor(config) {
78722
- this.repoRoot = resolve16(config.repoRoot);
78723
- this.worktreesDir = resolve16(config.worktreesDir ?? defaultWorktreesDir(config.repoRoot));
79068
+ this.repoRoot = resolve17(config.repoRoot);
79069
+ this.worktreesDir = resolve17(config.worktreesDir ?? defaultWorktreesDir(config.repoRoot));
78724
79070
  this.log = config.logger.child({ [SCOPE_ATTRIBUTE]: "session/workspace/git-worktree" });
78725
79071
  this.exec = config.execFile ?? defaultExecFile;
78726
79072
  }
@@ -78733,7 +79079,7 @@ var GitWorktreeDriver = class {
78733
79079
  try {
78734
79080
  repoRoot = await canonicalizeThroughExisting(this.repoRoot);
78735
79081
  worktreesDir = await canonicalizeThroughExisting(this.worktreesDir);
78736
- const lexicalPath = resolve16(worktreesDir, label5);
79082
+ const lexicalPath = resolve17(worktreesDir, label5);
78737
79083
  if (!isStrictDescendant(worktreesDir, lexicalPath)) {
78738
79084
  throw new Error(`Workspace label escapes the managed worktree directory: ${label5}`);
78739
79085
  }
@@ -78741,13 +79087,13 @@ var GitWorktreeDriver = class {
78741
79087
  if (!isStrictDescendant(worktreesDir, worktreePath)) {
78742
79088
  throw new Error(`Workspace label resolves through a link outside the managed worktree directory: ${label5}`);
78743
79089
  }
78744
- if (relative5(worktreesDir, lexicalPath) !== relative5(worktreesDir, worktreePath)) {
79090
+ if (relative6(worktreesDir, lexicalPath) !== relative6(worktreesDir, worktreePath)) {
78745
79091
  throw new Error(`Workspace label resolves through a link to a different managed path: ${label5}`);
78746
79092
  }
78747
79093
  } catch (cause) {
78748
79094
  throw new WorkspaceBackendError({ op: "create:ownership", kind: this.kind, cause });
78749
79095
  }
78750
- const relativePath = relative5(worktreesDir, worktreePath).split(sep9).join("/");
79096
+ const relativePath = relative6(worktreesDir, worktreePath).split(sep9).join("/");
78751
79097
  const branch = `namzu/${relativePath}`;
78752
79098
  const argv = ["-C", repoRoot, "worktree", "add", "-b", branch, "--", worktreePath];
78753
79099
  if (params.baseRef !== void 0) {
@@ -78902,7 +79248,7 @@ var GitWorktreeDriver = class {
78902
79248
  if (!isStrictDescendant(worktreesDir, worktreePath)) {
78903
79249
  throw new Error("Workspace reference escapes the managed worktree directory");
78904
79250
  }
78905
- const label5 = relative5(worktreesDir, worktreePath).split(sep9).join("/");
79251
+ const label5 = relative6(worktreesDir, worktreePath).split(sep9).join("/");
78906
79252
  const branch = `namzu/${label5}`;
78907
79253
  if (ref.meta.branch !== branch) {
78908
79254
  throw new Error("Workspace reference branch does not match its managed path");
@@ -78936,28 +79282,28 @@ var GitWorktreeDriver = class {
78936
79282
  }
78937
79283
  };
78938
79284
  async function canonicalizeThroughExisting(input) {
78939
- let existing = resolve16(input);
79285
+ let existing = resolve17(input);
78940
79286
  const remainder = [];
78941
79287
  for (; ; ) {
78942
79288
  try {
78943
- const canonical2 = await realpath9(existing);
78944
- return resolve16(canonical2, ...remainder);
79289
+ const canonical2 = await realpath10(existing);
79290
+ return resolve17(canonical2, ...remainder);
78945
79291
  } catch (cause) {
78946
79292
  const code = cause.code;
78947
79293
  if (code !== "ENOENT" && code !== "ENOTDIR")
78948
79294
  throw cause;
78949
79295
  }
78950
- const parent = dirname18(existing);
79296
+ const parent = dirname19(existing);
78951
79297
  if (parent === existing)
78952
- return resolve16(existing, ...remainder);
79298
+ return resolve17(existing, ...remainder);
78953
79299
  remainder.unshift(basename9(existing));
78954
79300
  existing = parent;
78955
79301
  }
78956
79302
  }
78957
79303
  __name(canonicalizeThroughExisting, "canonicalizeThroughExisting");
78958
79304
  function isStrictDescendant(root, candidate) {
78959
- const rel = relative5(root, candidate);
78960
- return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep9}`) && !isAbsolute11(rel);
79305
+ const rel = relative6(root, candidate);
79306
+ return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep9}`) && !isAbsolute12(rel);
78961
79307
  }
78962
79308
  __name(isStrictDescendant, "isStrictDescendant");
78963
79309
  function parseWorktreeList(stdout, worktreePath) {
@@ -78991,7 +79337,7 @@ function defaultWorktreesDir(repoRoot) {
78991
79337
  try {
78992
79338
  cwd = realpathSync5(repoRoot);
78993
79339
  } catch {
78994
- cwd = resolve16(repoRoot);
79340
+ cwd = resolve17(repoRoot);
78995
79341
  }
78996
79342
  const home = resolveNamzuHome();
78997
79343
  let slug = slugForCwd(cwd);
@@ -79152,15 +79498,15 @@ var SessionSummaryMaterializer = class {
79152
79498
 
79153
79499
  // ../sdk/dist/store/session/memory.js
79154
79500
  import { realpathSync as realpathSync6 } from "node:fs";
79155
- import { resolve as resolve18 } from "node:path";
79501
+ import { resolve as resolve19 } from "node:path";
79156
79502
 
79157
79503
  // ../sdk/dist/store/session/canonical-path.js
79158
- import { realpath as realpath10 } from "node:fs/promises";
79159
- import { resolve as resolve17 } from "node:path";
79504
+ import { realpath as realpath11 } from "node:fs/promises";
79505
+ import { resolve as resolve18 } from "node:path";
79160
79506
  async function canonicalizePath2(input) {
79161
- const absolute = resolve17(input);
79507
+ const absolute = resolve18(input);
79162
79508
  try {
79163
- return await realpath10(absolute);
79509
+ return await realpath11(absolute);
79164
79510
  } catch (err) {
79165
79511
  if (err.code === "ENOENT")
79166
79512
  return absolute;
@@ -79248,7 +79594,7 @@ var InMemorySessionStore = class {
79248
79594
  } catch (error) {
79249
79595
  if (error.code !== "ENOENT")
79250
79596
  throw error;
79251
- rootPath = resolve18(project.rootPath);
79597
+ rootPath = resolve19(project.rootPath);
79252
79598
  }
79253
79599
  const key5 = `${project.tenantId}\0${rootPath}`;
79254
79600
  const existingProjectId = roots.get(key5);
@@ -79699,13 +80045,13 @@ __name(stepResident, "stepResident");
79699
80045
 
79700
80046
  // ../sdk/dist/manager/resident/agenda.js
79701
80047
  import { randomUUID as randomUUID11 } from "node:crypto";
79702
- import { join as join34, resolve as resolve20 } from "node:path";
80048
+ import { join as join34, resolve as resolve21 } from "node:path";
79703
80049
  import { isDeepStrictEqual as isDeepStrictEqual6 } from "node:util";
79704
80050
 
79705
80051
  // ../sdk/dist/manager/resident/history-disk.js
79706
80052
  import { constants as constants4 } from "node:fs";
79707
- import { lstat as lstat8, open as open11 } from "node:fs/promises";
79708
- import { join as join33, relative as relative6, resolve as resolve19, sep as sep10 } from "node:path";
80053
+ import { lstat as lstat9, open as open11 } from "node:fs/promises";
80054
+ import { join as join33, relative as relative7, resolve as resolve20, sep as sep10 } from "node:path";
79709
80055
  var RECORD_BYTES2 = 4 * 1024 * 1024;
79710
80056
  var ResidentHistoryPageLimit = class extends Error {
79711
80057
  static {
@@ -79714,14 +80060,14 @@ var ResidentHistoryPageLimit = class extends Error {
79714
80060
  };
79715
80061
  async function readResidentHistoryRecord(root, path2, budget) {
79716
80062
  budget.signal?.throwIfAborted();
79717
- const base3 = resolve19(root);
79718
- const suffix = relative6(base3, resolve19(path2));
80063
+ const base3 = resolve20(root);
80064
+ const suffix = relative7(base3, resolve20(path2));
79719
80065
  if (suffix === ".." || suffix.startsWith(`..${sep10}`))
79720
80066
  throw new Error("Invalid history path.");
79721
80067
  let current = base3;
79722
80068
  for (const part2 of ["", ...suffix.split(sep10).filter(Boolean)]) {
79723
80069
  current = join33(current, part2);
79724
- if ((await lstat8(current)).isSymbolicLink())
80070
+ if ((await lstat9(current)).isSymbolicLink())
79725
80071
  throw new Error("History symlinks are refused.");
79726
80072
  }
79727
80073
  const handle = await open11(path2, constants4.O_RDONLY | constants4.O_NOFOLLOW | constants4.O_NONBLOCK);
@@ -80290,8 +80636,8 @@ var DiskResidentAgenda = class {
80290
80636
  revisionsDir: join34(directory, "revisions"),
80291
80637
  publishLegacyProjection: false
80292
80638
  };
80293
- this.historyRoot = resolve20(root);
80294
- this.historyRevisions = resolve20(this.location.revisionsDir);
80639
+ this.historyRoot = resolve21(root);
80640
+ this.historyRevisions = resolve21(this.location.revisionsDir);
80295
80641
  }
80296
80642
  checked(record3) {
80297
80643
  const agenda = agendaSchema.parse(record3);
@@ -81636,7 +81982,7 @@ __name(createResidentToolEvidenceSource, "createResidentToolEvidenceSource");
81636
81982
  import { createHash as createHash30, randomUUID as randomUUID13 } from "node:crypto";
81637
81983
  import { closeSync as closeSync2, existsSync as existsSync5, fsyncSync as fsyncSync2, linkSync as linkSync2, lstatSync as lstatSync4, mkdirSync as mkdirSync4, openSync as openSync2, readFileSync as readFileSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
81638
81984
  import { createRequire as createRequire3 } from "node:module";
81639
- import { dirname as dirname19, join as join35, resolve as resolve21 } from "node:path";
81985
+ import { dirname as dirname20, join as join35, resolve as resolve22 } from "node:path";
81640
81986
 
81641
81987
  // ../sdk/dist/manager/resident/learning-observation.js
81642
81988
  var label4 = external_exports.string().trim().min(1).max(256);
@@ -81766,8 +82112,8 @@ var SqliteResidentLearningStore = class {
81766
82112
  scope;
81767
82113
  readOnly;
81768
82114
  constructor(options) {
81769
- this.databasePath = resolve21(options.databasePath);
81770
- this.artifactsPath = resolve21(options.artifactsPath);
82115
+ this.databasePath = resolve22(options.databasePath);
82116
+ this.artifactsPath = resolve22(options.artifactsPath);
81771
82117
  this.scope = Object.freeze({
81772
82118
  tenantId: asTenantId(options.scope.tenantId.toLowerCase()),
81773
82119
  projectId: asProjectId(options.scope.projectId.toLowerCase()),
@@ -81787,7 +82133,7 @@ var SqliteResidentLearningStore = class {
81787
82133
  });
81788
82134
  }
81789
82135
  if (!this.readOnly)
81790
- mkdirSync4(dirname19(this.databasePath), { recursive: true, mode: 448 });
82136
+ mkdirSync4(dirname20(this.databasePath), { recursive: true, mode: 448 });
81791
82137
  const db = new Database(this.databasePath, { readOnly: this.readOnly });
81792
82138
  try {
81793
82139
  db.exec("PRAGMA busy_timeout = 5000; PRAGMA foreign_keys = ON;");
@@ -82402,7 +82748,7 @@ __name(derivePeerRef, "derivePeerRef");
82402
82748
  // ../sdk/dist/peers/registry.js
82403
82749
  import { randomBytes as randomBytes6 } from "node:crypto";
82404
82750
  import { closeSync as closeSync3, fsyncSync as fsyncSync3, lstatSync as lstatSync6, openSync as openSync3, readFileSync as readFileSync4, readdirSync as readdirSync2, renameSync, unlinkSync as unlinkSync3, writeSync as writeSync2 } from "node:fs";
82405
- import { basename as basename10, dirname as dirname20, join as join38 } from "node:path";
82751
+ import { basename as basename10, dirname as dirname21, join as join38 } from "node:path";
82406
82752
 
82407
82753
  // ../sdk/dist/peers/client.js
82408
82754
  import { createConnection } from "node:net";
@@ -82422,7 +82768,7 @@ function connectPath(address2) {
82422
82768
  }
82423
82769
  __name(connectPath, "connectPath");
82424
82770
  function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
82425
- return new Promise((resolve27) => {
82771
+ return new Promise((resolve28) => {
82426
82772
  let settled = false;
82427
82773
  const finish2 = /* @__PURE__ */ __name((result) => {
82428
82774
  if (settled)
@@ -82430,7 +82776,7 @@ function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
82430
82776
  settled = true;
82431
82777
  clearTimeout(timer);
82432
82778
  socket.destroy();
82433
- resolve27(result);
82779
+ resolve28(result);
82434
82780
  }, "finish");
82435
82781
  const unreachable = /* @__PURE__ */ __name((error) => finish2({
82436
82782
  kind: "unreachable",
@@ -82442,7 +82788,7 @@ function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
82442
82788
  path2 = connectPath(address2);
82443
82789
  } catch (error) {
82444
82790
  clearTimeout(timer);
82445
- resolve27({
82791
+ resolve28({
82446
82792
  kind: "unreachable",
82447
82793
  reason: error instanceof Error ? error.message : String(error)
82448
82794
  });
@@ -82534,7 +82880,7 @@ function recordPath(sessionsDir, sessionId5) {
82534
82880
  }
82535
82881
  __name(recordPath, "recordPath");
82536
82882
  function temporaryPathBeside(path2) {
82537
- return join38(dirname20(path2), `.${basename10(path2)}.${process.pid}.${randomBytes6(6).toString("hex")}.tmp`);
82883
+ return join38(dirname21(path2), `.${basename10(path2)}.${process.pid}.${randomBytes6(6).toString("hex")}.tmp`);
82538
82884
  }
82539
82885
  __name(temporaryPathBeside, "temporaryPathBeside");
82540
82886
  function writePeerRecord(sessionsDir, record3) {
@@ -82951,23 +83297,23 @@ async function createPeerEndpoint(options) {
82951
83297
  void handleLine(buffered.subarray(0, newline)).catch(() => socket.destroy());
82952
83298
  });
82953
83299
  });
82954
- await new Promise((resolve27, reject2) => {
83300
+ await new Promise((resolve28, reject2) => {
82955
83301
  const failed = /* @__PURE__ */ __name((error) => reject2(error), "failed");
82956
83302
  server.once("error", failed);
82957
83303
  server.listen({ path: listenPath }, () => {
82958
83304
  server.removeListener("error", failed);
82959
- resolve27();
83305
+ resolve28();
82960
83306
  });
82961
83307
  });
82962
83308
  server.on("error", () => {
82963
83309
  });
82964
83310
  if (parsed.scheme === "uds")
82965
83311
  chmodSync3(listenPath, 384);
82966
- const close = /* @__PURE__ */ __name(() => new Promise((resolve27) => {
83312
+ const close = /* @__PURE__ */ __name(() => new Promise((resolve28) => {
82967
83313
  closing = true;
82968
83314
  for (const socket of sockets)
82969
83315
  socket.destroy();
82970
- server.close(() => resolve27());
83316
+ server.close(() => resolve28());
82971
83317
  }), "close");
82972
83318
  return {
82973
83319
  address: options.address,
@@ -83571,7 +83917,7 @@ var PalRuntime = class {
83571
83917
  // ../sdk/dist/pals/communication/store.js
83572
83918
  import { randomUUID as randomUUID14 } from "node:crypto";
83573
83919
  import { chmodSync as chmodSync4, lstatSync as lstatSync8, mkdirSync as mkdirSync6, readdirSync as readdirSync3, realpathSync as realpathSync7 } from "node:fs";
83574
- import { join as join39, resolve as resolve22 } from "node:path";
83920
+ import { join as join39, resolve as resolve23 } from "node:path";
83575
83921
  import { isDeepStrictEqual as isDeepStrictEqual8 } from "node:util";
83576
83922
 
83577
83923
  // ../sdk/dist/pals/communication/ingress-types.js
@@ -83805,7 +84151,7 @@ var DiskPalCommunicationStore = class {
83805
84151
  migrations: { 1: (value) => value }
83806
84152
  }), "Pal communication", (record3) => record3.revision);
83807
84153
  constructor(options) {
83808
- this.root = resolve22(options.root);
84154
+ this.root = resolve23(options.root);
83809
84155
  this.secure = options.secureDirectory ?? ((path2) => {
83810
84156
  if (process.platform !== "win32")
83811
84157
  chmodSync4(path2, 448);
@@ -84280,7 +84626,7 @@ var PalMessageBroker = class {
84280
84626
 
84281
84627
  // ../sdk/dist/pals/communication/policy.js
84282
84628
  import { chmodSync as chmodSync5, lstatSync as lstatSync9, mkdirSync as mkdirSync7, readdirSync as readdirSync4, realpathSync as realpathSync8 } from "node:fs";
84283
- import { join as join40, resolve as resolve23 } from "node:path";
84629
+ import { join as join40, resolve as resolve24 } from "node:path";
84284
84630
  var PalMessagePermissionConflictError = class extends Error {
84285
84631
  static {
84286
84632
  __name(this, "PalMessagePermissionConflictError");
@@ -84316,7 +84662,7 @@ var DiskPalMessagePolicy = class {
84316
84662
  secure;
84317
84663
  records = new DiskRevisionRecordStore(defineSchema({ kind: "pal-message-permission", current: 1, migrations: {} }), "Pal message permission", (value) => value.revision);
84318
84664
  constructor(options) {
84319
- this.root = resolve23(options.root);
84665
+ this.root = resolve24(options.root);
84320
84666
  this.secure = options.secureDirectory ?? ((path2) => {
84321
84667
  if (process.platform !== "win32")
84322
84668
  chmodSync5(path2, 448);
@@ -84957,7 +85303,7 @@ __name(dispatchPalIngressOnce, "dispatchPalIngressOnce");
84957
85303
 
84958
85304
  // ../sdk/dist/pals/activity/subscription-store.js
84959
85305
  import { chmodSync as chmodSync6, lstatSync as lstatSync10, mkdirSync as mkdirSync8, readdirSync as readdirSync5, realpathSync as realpathSync9 } from "node:fs";
84960
- import { join as join41, resolve as resolve24 } from "node:path";
85306
+ import { join as join41, resolve as resolve25 } from "node:path";
84961
85307
  import { isDeepStrictEqual as isDeepStrictEqual9 } from "node:util";
84962
85308
 
84963
85309
  // ../sdk/dist/pals/activity/subscription-schema.js
@@ -84996,7 +85342,7 @@ var DiskPalActivitySubscriptionStore = class {
84996
85342
  migrations: {}
84997
85343
  }), "Pal activity subscription", (value) => value.revision);
84998
85344
  constructor(options) {
84999
- this.root = resolve24(options.root);
85345
+ this.root = resolve25(options.root);
85000
85346
  this.secure = options.secureDirectory ?? ((path2) => {
85001
85347
  if (process.platform !== "win32")
85002
85348
  chmodSync6(path2, 448);
@@ -85118,7 +85464,7 @@ var DiskPalActivitySubscriptionStore = class {
85118
85464
 
85119
85465
  // ../sdk/dist/pals/activity/subscription-policy.js
85120
85466
  import { chmodSync as chmodSync7, lstatSync as lstatSync11, mkdirSync as mkdirSync9, readdirSync as readdirSync6, realpathSync as realpathSync10 } from "node:fs";
85121
- import { join as join42, resolve as resolve25 } from "node:path";
85467
+ import { join as join42, resolve as resolve26 } from "node:path";
85122
85468
  import { isDeepStrictEqual as isDeepStrictEqual10 } from "node:util";
85123
85469
  var PalActivitySubscriptionPermissionConflictError = class extends Error {
85124
85470
  static {
@@ -85153,7 +85499,7 @@ var DiskPalActivitySubscriptionPolicy = class {
85153
85499
  migrations: {}
85154
85500
  }), "Pal activity subscription permission", (value) => value.revision);
85155
85501
  constructor(options) {
85156
- this.root = resolve25(options.root);
85502
+ this.root = resolve26(options.root);
85157
85503
  this.subscriptions = options.subscriptions;
85158
85504
  this.secure = options.secureDirectory ?? ((path2) => {
85159
85505
  if (process.platform !== "win32")
@@ -86520,7 +86866,7 @@ function shellProgress(report) {
86520
86866
  __name(shellProgress, "shellProgress");
86521
86867
  function execHostShell(command, options) {
86522
86868
  options.signal?.throwIfAborted();
86523
- return new Promise((resolve27, reject2) => {
86869
+ return new Promise((resolve28, reject2) => {
86524
86870
  const child = spawnHostShell(command, {
86525
86871
  cwd: options.cwd,
86526
86872
  env: options.env,
@@ -86621,7 +86967,7 @@ function execHostShell(command, options) {
86621
86967
  const stdout = decodeCapture("stdout");
86622
86968
  const stderr = decodeCapture("stderr");
86623
86969
  if (!failure2 && cause === void 0 && code === 0 && signal === null) {
86624
- resolve27({
86970
+ resolve28({
86625
86971
  stdout,
86626
86972
  stderr,
86627
86973
  stdoutBytes: captures.stdout.bytes,
@@ -86668,7 +87014,7 @@ ${stderr}`));
86668
87014
  child.off("close", onClose);
86669
87015
  child.off("error", onError);
86670
87016
  child.off("spawn", onSpawn);
86671
- resolve27({
87017
+ resolve28({
86672
87018
  backgroundedJobId: jobId,
86673
87019
  stdout: decodeCapture("stdout"),
86674
87020
  stderr: decodeCapture("stderr")
@@ -86998,8 +87344,8 @@ var BashTool = Object.defineProperty({ ...BashToolBase }, "description", {
86998
87344
  });
86999
87345
 
87000
87346
  // ../sdk/dist/tools/builtins/code-analysis.js
87001
- import { realpath as realpath11, stat as stat12 } from "node:fs/promises";
87002
- import { isAbsolute as isAbsolute12, relative as relative7, sep as sep11 } from "node:path";
87347
+ import { realpath as realpath12, stat as stat12 } from "node:fs/promises";
87348
+ import { isAbsolute as isAbsolute13, relative as relative8, sep as sep11 } from "node:path";
87003
87349
  var DEFAULT_LIMIT = 50;
87004
87350
  var MAX_LIMIT = 200;
87005
87351
  var DEFAULT_MAX_CHARS = 2e4;
@@ -87136,8 +87482,8 @@ var CodeAnalysisTool = defineTool({
87136
87482
  return renderPage(result, (hit) => {
87137
87483
  const shown = JSON.stringify(hit.value) + (hit.valueTruncated ? " (cut)" : "");
87138
87484
  const kind = hit.kind === "string" ? "" : ` (${hit.kind})`;
87139
- const inside = hit.function ? ` in ${shortFunction(hit.function)}` : " at top level";
87140
- return `${hit.line}:${hit.column} ${shown}${kind}${inside}${staleMark(hit.stale)}`;
87485
+ const inside2 = hit.function ? ` in ${shortFunction(hit.function)}` : " at top level";
87486
+ return `${hit.line}:${hit.column} ${shown}${kind}${inside2}${staleMark(hit.stale)}`;
87141
87487
  }, (hit) => relativeTo(root, hit.path));
87142
87488
  }
87143
87489
  case "enclosing_function": {
@@ -87204,11 +87550,11 @@ var CodeAnalysisTool = defineTool({
87204
87550
  ...signalOf(context2)
87205
87551
  });
87206
87552
  return renderPage(result, (site) => {
87207
- const inside = site.caller ? ` in ${shortFunction(site.caller)}` : " at top level";
87553
+ const inside2 = site.caller ? ` in ${shortFunction(site.caller)}` : " at top level";
87208
87554
  const how = site.kind === "new" ? "new " : "";
87209
87555
  const tag = site.kind === "call-via" ? " [call/apply/bind]" : site.kind === "tagged" ? " [tagged template]" : "";
87210
87556
  const label5 = site.resolution === "text-only" ? " [text-only]" : "";
87211
- return `${site.line}:${site.column} ${how}${site.callee}(${site.argumentCount} arg${site.argumentCount === 1 ? "" : "s"})${tag}${label5}${inside}${staleMark(site.stale)}`;
87557
+ return `${site.line}:${site.column} ${how}${site.callee}(${site.argumentCount} arg${site.argumentCount === 1 ? "" : "s"})${tag}${label5}${inside2}${staleMark(site.stale)}`;
87212
87558
  }, (site) => relativeTo(root, site.path));
87213
87559
  }
87214
87560
  case "imports": {
@@ -87263,7 +87609,7 @@ async function owningRoot(roots, target) {
87263
87609
  for (const candidate of roots) {
87264
87610
  let real;
87265
87611
  try {
87266
- real = await realpath11(candidate);
87612
+ real = await realpath12(candidate);
87267
87613
  if (!(await stat12(real)).isDirectory()) {
87268
87614
  if (isWithin(real, target) || real === target)
87269
87615
  sawFile = true;
@@ -87279,8 +87625,8 @@ async function owningRoot(roots, target) {
87279
87625
  }
87280
87626
  __name(owningRoot, "owningRoot");
87281
87627
  function relativeTo(root, path2) {
87282
- const rel = relative7(root, path2);
87283
- if (rel === "" || rel === ".." || rel.startsWith(`..${sep11}`) || isAbsolute12(rel))
87628
+ const rel = relative8(root, path2);
87629
+ if (rel === "" || rel === ".." || rel.startsWith(`..${sep11}`) || isAbsolute13(rel))
87284
87630
  return path2;
87285
87631
  return sep11 === "/" ? rel : rel.split(sep11).join("/");
87286
87632
  }
@@ -90249,7 +90595,7 @@ ${wrapUntrusted({
90249
90595
  __name(createComputerUseTool, "createComputerUseTool");
90250
90596
 
90251
90597
  // ../sdk/dist/tools/builtins/glob.js
90252
- import { isAbsolute as isAbsolute13, join as join43, relative as relative8, sep as sep12 } from "node:path";
90598
+ import { isAbsolute as isAbsolute14, join as join43, relative as relative9, sep as sep12 } from "node:path";
90253
90599
 
90254
90600
  // ../sdk/dist/tools/posix-path.js
90255
90601
  function normalizeSegments(path2) {
@@ -90311,9 +90657,9 @@ function relativePattern(pattern, root, sandboxed) {
90311
90657
  if (result.split("/").includes("..")) {
90312
90658
  throw new Error('Glob pattern escapes the search directory through "..". Choose a contained path and a relative pattern.');
90313
90659
  }
90314
- if (sandboxed ? result.startsWith("/") : isAbsolute13(pattern)) {
90660
+ if (sandboxed ? result.startsWith("/") : isAbsolute14(pattern)) {
90315
90661
  const contained2 = sandboxed ? resolveWithinPosix(root, result) : resolveWithin(root, pattern);
90316
- result = sandboxed ? relativePosix(root, contained2) : relative8(root, contained2).split(sep12).join("/");
90662
+ result = sandboxed ? relativePosix(root, contained2) : relative9(root, contained2).split(sep12).join("/");
90317
90663
  }
90318
90664
  while (result.startsWith("./"))
90319
90665
  result = result.slice(2);
@@ -90385,7 +90731,7 @@ var GlobTool = defineTool({
90385
90731
  truncated = true;
90386
90732
  break;
90387
90733
  }
90388
- const file = sandbox ? relativePosix(sandbox.rootDir, absolute) : relative8(context2.workingDirectory, join43(lexicalRoot, relative8(root, absolute)));
90734
+ const file = sandbox ? relativePosix(sandbox.rootDir, absolute) : relative9(context2.workingDirectory, join43(lexicalRoot, relative9(root, absolute)));
90389
90735
  files.push(`./${sandbox ? file : file.split(sep12).join("/")}`);
90390
90736
  }
90391
90737
  } catch (error) {
@@ -90413,7 +90759,7 @@ var GlobTool = defineTool({
90413
90759
 
90414
90760
  // ../sdk/dist/tools/builtins/grep.js
90415
90761
  import { readFile as readFile17, stat as stat13 } from "node:fs/promises";
90416
- import { isAbsolute as isAbsolute14, join as join44, relative as relative9, sep as sep13 } from "node:path";
90762
+ import { isAbsolute as isAbsolute15, join as join44, relative as relative10, sep as sep13 } from "node:path";
90417
90763
  async function readWithSignal(read, signal) {
90418
90764
  signal?.throwIfAborted();
90419
90765
  if (!signal)
@@ -90439,9 +90785,9 @@ function relativeInclude(include, root, sandboxed) {
90439
90785
  let pattern = sandboxed ? include : include.split(sep13).join("/");
90440
90786
  if (pattern.split("/").includes(".."))
90441
90787
  throw new Error("Include pattern escapes the search directory");
90442
- if (sandboxed ? pattern.startsWith("/") : isAbsolute14(include)) {
90788
+ if (sandboxed ? pattern.startsWith("/") : isAbsolute15(include)) {
90443
90789
  const absolute = sandboxed ? resolveWithinPosix(root, pattern) : resolveWithin(root, include);
90444
- pattern = sandboxed ? relativePosix(root, absolute) : relative9(root, absolute).split(sep13).join("/");
90790
+ pattern = sandboxed ? relativePosix(root, absolute) : relative10(root, absolute).split(sep13).join("/");
90445
90791
  }
90446
90792
  while (pattern.startsWith("./"))
90447
90793
  pattern = pattern.slice(2);
@@ -90577,7 +90923,7 @@ var GrepTool = defineTool({
90577
90923
  }
90578
90924
  const lines = content.split("\n");
90579
90925
  let fileMatches = 0;
90580
- const relPath = sandbox ? `./${relativePosix(sandbox.rootDir, filePath)}` : `./${relative9(context2.workingDirectory, join44(lexicalRoot, relative9(root, filePath))).split(sep13).join("/")}`;
90926
+ const relPath = sandbox ? `./${relativePosix(sandbox.rootDir, filePath)}` : `./${relative10(context2.workingDirectory, join44(lexicalRoot, relative10(root, filePath))).split(sep13).join("/")}`;
90581
90927
  for (let i = 0; i < lines.length; i++) {
90582
90928
  context2.abortSignal?.throwIfAborted();
90583
90929
  const line = lines[i] ?? "";
@@ -90860,7 +91206,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
90860
91206
  omittedOutputBytes
90861
91207
  };
90862
91208
  });
90863
- const expiry = new Promise((resolve27) => {
91209
+ const expiry = new Promise((resolve28) => {
90864
91210
  const tick = setInterval(() => {
90865
91211
  if (settled)
90866
91212
  return;
@@ -90868,7 +91214,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
90868
91214
  const elapsed = now() - startedAt;
90869
91215
  if (elapsed >= options.wallMs) {
90870
91216
  clearInterval(tick);
90871
- resolve27({
91217
+ resolve28({
90872
91218
  kind: "timeout",
90873
91219
  cause: "wall",
90874
91220
  elapsedMs: elapsed,
@@ -90883,7 +91229,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
90883
91229
  const quietFor = now() - lastProgressAt;
90884
91230
  if (quietFor >= options.idleMs) {
90885
91231
  clearInterval(tick);
90886
- resolve27({
91232
+ resolve28({
90887
91233
  kind: "timeout",
90888
91234
  cause: "idle",
90889
91235
  elapsedMs: elapsed,
@@ -91114,7 +91460,7 @@ ${observed}
91114
91460
 
91115
91461
  // ../sdk/dist/tools/builtins/verify-outputs.js
91116
91462
  import { stat as stat14 } from "node:fs/promises";
91117
- import { resolve as resolve26 } from "node:path";
91463
+ import { resolve as resolve27 } from "node:path";
91118
91464
  var inputSchema15 = external_exports.object({
91119
91465
  paths: external_exports.array(external_exports.string().min(1)).min(1).describe("Expected output file paths to verify. Each path is checked for existence and size."),
91120
91466
  min_bytes: external_exports.number().int().min(0).optional().describe("Minimum acceptable file size in bytes. A file under this size counts as missing. Default: 1 (any non-empty file passes).")
@@ -91170,7 +91516,7 @@ async function verifyOne(input) {
91170
91516
  };
91171
91517
  }
91172
91518
  }
91173
- const filePath = resolve26(context2.workingDirectory, path2);
91519
+ const filePath = resolve27(context2.workingDirectory, path2);
91174
91520
  try {
91175
91521
  const info = await stat14(filePath);
91176
91522
  if (!info.isFile()) {
@@ -93456,6 +93802,7 @@ export {
93456
93802
  generateTopicId,
93457
93803
  generateTurnId,
93458
93804
  generateSessionId,
93805
+ generateTaskId,
93459
93806
  generateTenantId,
93460
93807
  generateWorkspaceId,
93461
93808
  generateSummaryId,
@@ -93572,6 +93919,7 @@ export {
93572
93919
  selectTaskContext,
93573
93920
  buildTaskTools,
93574
93921
  isCompactionMessage,
93922
+ COMPACTION_RECOVERY_NOTE,
93575
93923
  PLAN_MODE_REFUSAL,
93576
93924
  toToolSourceRef,
93577
93925
  ToolManager,
@@ -93610,6 +93958,7 @@ export {
93610
93958
  withProviderFallback,
93611
93959
  buildProbeContext,
93612
93960
  probe,
93961
+ SessionEvidenceOffsetError,
93613
93962
  createSessionTextEvidenceSource,
93614
93963
  createSessionEvidenceSource,
93615
93964
  NamzuHomeError,
@@ -93782,4 +94131,4 @@ export {
93782
94131
  buildResidentToolEvidenceTools,
93783
94132
  createPalMessagingTools
93784
94133
  };
93785
- //# sourceMappingURL=chunk-RQBT4RVE.js.map
94134
+ //# sourceMappingURL=chunk-RKMGVFLZ.js.map