@namzu/cli 45.0.0 → 45.1.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 (321) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-XSAUUT2D.js → acp-CGGPX6FV.js} +49 -48
  4. package/dist/chunks/{acp-XSAUUT2D.js.map → acp-CGGPX6FV.js.map} +1 -1
  5. package/dist/chunks/{activity-command-DB4DREW7.js → activity-command-D744W6SC.js} +13 -13
  6. package/dist/chunks/{add-NVXRVUGY.js → add-7F26IYNU.js} +19 -19
  7. package/dist/chunks/{agent-6TD66IMV.js → agent-42PYZGA5.js} +37 -37
  8. package/dist/chunks/agent-session-SYLDVKFJ.js +69 -0
  9. package/dist/chunks/{archive-A3X7KX2U.js → archive-FLZUJDJZ.js} +11 -11
  10. package/dist/chunks/{bin-main-5PYV7WYI.js → bin-main-NID46PS7.js} +5 -5
  11. package/dist/chunks/{binding-EMMG5PAE.js → binding-JQUI2CTZ.js} +3 -3
  12. package/dist/chunks/{browser-FUFFJBRR.js → browser-YZCY2CI6.js} +6 -6
  13. package/dist/chunks/{chat-M653DEAF.js → chat-WBJPS4K6.js} +16 -16
  14. package/dist/chunks/{chunk-OMRU22BQ.js → chunk-24NEAMG5.js} +3 -3
  15. package/dist/chunks/{chunk-TKIWAXRU.js → chunk-2UATEMPS.js} +7 -7
  16. package/dist/chunks/{chunk-6TT7NXLP.js → chunk-2YKQMUTC.js} +9 -3
  17. package/dist/chunks/chunk-2YKQMUTC.js.map +6 -0
  18. package/dist/chunks/{chunk-MMZHUQZQ.js → chunk-4HL5LUP5.js} +497 -63
  19. package/dist/chunks/chunk-4HL5LUP5.js.map +6 -0
  20. package/dist/chunks/{chunk-U6U472VN.js → chunk-5DFBOMTX.js} +3 -3
  21. package/dist/chunks/{chunk-HV2JFRSE.js → chunk-5OGY4CE7.js} +2 -2
  22. package/dist/chunks/{chunk-GCFXQSN6.js → chunk-5VBA5XSC.js} +2 -2
  23. package/dist/chunks/{chunk-IRUDNBAR.js → chunk-5W7CSQXQ.js} +4 -4
  24. package/dist/chunks/{chunk-H6AUN2YD.js → chunk-6F4PW7TF.js} +5 -5
  25. package/dist/chunks/{chunk-THJQXERD.js → chunk-6LMIJ2YT.js} +8 -8
  26. package/dist/chunks/{chunk-NXX6C3WS.js → chunk-6OWRRNLC.js} +2 -2
  27. package/dist/chunks/{chunk-VHFPIYVY.js → chunk-7BRK6EHB.js} +2 -2
  28. package/dist/chunks/{chunk-WSIMHBEQ.js → chunk-7HNWFGWD.js} +2 -2
  29. package/dist/chunks/{chunk-RJQ6WQYX.js → chunk-AR2GPJUO.js} +5 -5
  30. package/dist/chunks/{chunk-RJQ6WQYX.js.map → chunk-AR2GPJUO.js.map} +1 -1
  31. package/dist/chunks/{chunk-HH3NBBBE.js → chunk-B7QEQ7Y3.js} +2 -2
  32. package/dist/chunks/{chunk-EFU2OFEK.js → chunk-BDHXJ7BM.js} +40 -2
  33. package/dist/chunks/chunk-BDHXJ7BM.js.map +6 -0
  34. package/dist/chunks/{chunk-G5FWVYK2.js → chunk-BWI7L43E.js} +6 -6
  35. package/dist/chunks/{chunk-K5FQ4G64.js → chunk-D7BXM6WW.js} +2 -2
  36. package/dist/chunks/{chunk-M7LCVDP3.js → chunk-EVRWBRUB.js} +2 -2
  37. package/dist/chunks/{chunk-FUJSGQYW.js → chunk-F2QERXWD.js} +10 -10
  38. package/dist/chunks/{chunk-46OOPRR6.js → chunk-F4B77QJQ.js} +3 -3
  39. package/dist/chunks/{chunk-3F3V2PB7.js → chunk-FJONRQQU.js} +3 -1
  40. package/dist/chunks/{chunk-3F3V2PB7.js.map → chunk-FJONRQQU.js.map} +1 -1
  41. package/dist/chunks/{chunk-MKRYUMLP.js → chunk-FU776PDS.js} +5 -5
  42. package/dist/chunks/{chunk-4DVCHAWN.js → chunk-G742EI3J.js} +2 -2
  43. package/dist/chunks/{chunk-C4MAQ64X.js → chunk-GXP5BKCZ.js} +34 -33
  44. package/dist/chunks/{chunk-C4MAQ64X.js.map → chunk-GXP5BKCZ.js.map} +1 -1
  45. package/dist/chunks/{chunk-BICC735N.js → chunk-GXQ4G3KA.js} +3 -3
  46. package/dist/chunks/{chunk-S2UDKXWH.js → chunk-H2RDYYTB.js} +2 -2
  47. package/dist/chunks/{chunk-P6RUYL3F.js → chunk-H5H6HDRA.js} +3 -3
  48. package/dist/chunks/{chunk-ADCVLGQO.js → chunk-HIJXUSOS.js} +3 -3
  49. package/dist/chunks/{chunk-GAEZQRQI.js → chunk-HYPNAC4H.js} +3 -3
  50. package/dist/chunks/{chunk-OENL667J.js → chunk-I6W3KJR3.js} +2 -2
  51. package/dist/chunks/{chunk-HGIIAAEG.js → chunk-IFEBBQ2M.js} +3 -3
  52. package/dist/chunks/{chunk-U33GIKBK.js → chunk-IFXYNA2K.js} +4 -4
  53. package/dist/chunks/{chunk-X7WLWVR7.js → chunk-IPVDXTWF.js} +2 -2
  54. package/dist/chunks/{chunk-FZR4XULA.js → chunk-IZDYKTPN.js} +6 -6
  55. package/dist/chunks/{chunk-7TBETDTX.js → chunk-JCLZ5HXI.js} +2 -2
  56. package/dist/chunks/{chunk-7NJAEWFK.js → chunk-JU7JQ62S.js} +3 -3
  57. package/dist/chunks/{chunk-7DR7EU3J.js → chunk-K3UL7Z4X.js} +43 -33
  58. package/dist/chunks/{chunk-7DR7EU3J.js.map → chunk-K3UL7Z4X.js.map} +1 -1
  59. package/dist/chunks/{chunk-JAB62RI5.js → chunk-KY2WSKNM.js} +2 -2
  60. package/dist/chunks/{chunk-Y2PZNQH5.js → chunk-LMVXENEF.js} +3 -3
  61. package/dist/chunks/{chunk-THQAGFMO.js → chunk-LQN7NG2F.js} +13 -13
  62. package/dist/chunks/{chunk-LHZSSQ6K.js → chunk-NCW3WBBI.js} +4 -4
  63. package/dist/chunks/{chunk-BOM64EUQ.js → chunk-NFATUZMX.js} +2 -2
  64. package/dist/chunks/{chunk-VAP6YMB6.js → chunk-NGMXEU2B.js} +2 -2
  65. package/dist/chunks/{chunk-J2FGTLZV.js → chunk-NI3LZ6UX.js} +2 -2
  66. package/dist/chunks/{chunk-TFOIA3U3.js → chunk-NS4PN3SI.js} +2 -2
  67. package/dist/chunks/{chunk-ANHFJD66.js → chunk-NZ6DX5CL.js} +4 -4
  68. package/dist/chunks/{chunk-43HR3AF5.js → chunk-O7H4QZ7I.js} +2 -2
  69. package/dist/chunks/{chunk-2OAD3CZE.js → chunk-OM3EDVLG.js} +3 -3
  70. package/dist/chunks/{chunk-AHNXQAYZ.js → chunk-OMRGJSUJ.js} +11 -11
  71. package/dist/chunks/{chunk-MYSU54EZ.js → chunk-OXM3GHWE.js} +9 -9
  72. package/dist/chunks/{chunk-IYEDXZQZ.js → chunk-OYX743QK.js} +4 -4
  73. package/dist/chunks/{chunk-THUX2WOG.js → chunk-P2Y3IUE6.js} +12 -12
  74. package/dist/chunks/{chunk-B6INWHLR.js → chunk-PAY5TGHV.js} +3 -3
  75. package/dist/chunks/{chunk-YLNQLDMP.js → chunk-PCWQ3ET3.js} +4 -4
  76. package/dist/chunks/{chunk-KVCYYXCS.js → chunk-PFFQOCEI.js} +2 -2
  77. package/dist/chunks/{chunk-E3FA5H3Q.js → chunk-POKKY7MR.js} +6 -5
  78. package/dist/chunks/chunk-POKKY7MR.js.map +6 -0
  79. package/dist/chunks/{chunk-CDDS3UKB.js → chunk-PQTS7XQB.js} +12 -12
  80. package/dist/chunks/{chunk-6PDIDZGX.js → chunk-Q3AB63M5.js} +2 -2
  81. package/dist/chunks/{chunk-6ZEHXLF7.js → chunk-Q6DM2TVI.js} +2 -2
  82. package/dist/chunks/{chunk-VGUU6E6X.js → chunk-Q7ELMF4C.js} +6 -6
  83. package/dist/chunks/{chunk-TUF4NNJV.js → chunk-QWVWGW6I.js} +2 -2
  84. package/dist/chunks/{chunk-VY377HAA.js → chunk-QXNROEIH.js} +4 -4
  85. package/dist/chunks/{chunk-HFD2VRQP.js → chunk-RBH2FDM5.js} +7 -5
  86. package/dist/chunks/chunk-RBH2FDM5.js.map +6 -0
  87. package/dist/chunks/{chunk-WG32TSVL.js → chunk-RPCJJZTI.js} +3 -3
  88. package/dist/chunks/{chunk-2YCPLLUW.js → chunk-SSE5CXYL.js} +3 -3
  89. package/dist/chunks/{chunk-P7MNE6YP.js → chunk-T3NLKQO2.js} +4 -4
  90. package/dist/chunks/{chunk-43PTHA5N.js → chunk-TGPKTH2S.js} +2 -2
  91. package/dist/chunks/{chunk-667W6Z5W.js → chunk-TOJSNO4M.js} +5 -5
  92. package/dist/chunks/{chunk-L6QJZZCJ.js → chunk-U4YXQWPW.js} +6 -6
  93. package/dist/chunks/{chunk-325X27UO.js → chunk-U4ZP2JN2.js} +4 -4
  94. package/dist/chunks/{chunk-S766UWAQ.js → chunk-V26FS5VG.js} +2 -2
  95. package/dist/chunks/{chunk-LR4QQMJH.js → chunk-V3R3MR7F.js} +4 -4
  96. package/dist/chunks/{chunk-NUNOIP4Y.js → chunk-VPJG7NQL.js} +2 -2
  97. package/dist/chunks/{chunk-P6FEQPES.js → chunk-W7XKWKEZ.js} +2 -2
  98. package/dist/chunks/{chunk-24FBGXYR.js → chunk-WNOB6C62.js} +2 -2
  99. package/dist/chunks/{chunk-U3EQTU4G.js → chunk-X2F5ZFBV.js} +4 -4
  100. package/dist/chunks/{chunk-X4WCRRZV.js → chunk-XK26JNIF.js} +6 -6
  101. package/dist/chunks/{chunk-JKPUOSDC.js → chunk-XN7C5GWO.js} +2 -2
  102. package/dist/chunks/{chunk-KZ5WYSA6.js → chunk-XSAEGHPS.js} +9 -9
  103. package/dist/chunks/{chunk-D23EJNO5.js → chunk-ZB45QDNU.js} +3 -3
  104. package/dist/chunks/{cli-runtime-QWBGE2VF.js → cli-runtime-OBTTHZZI.js} +10 -10
  105. package/dist/chunks/{commands-LVUUZ6LF.js → commands-56WUDKVN.js} +5 -5
  106. package/dist/chunks/{crash-report-PGXMRS5P.js → crash-report-3IE2RFYG.js} +6 -6
  107. package/dist/chunks/{dist-JRBSW53E.js → dist-7UW2VLWO.js} +3 -2
  108. package/dist/chunks/{dist-JRBSW53E.js.map → dist-7UW2VLWO.js.map} +1 -1
  109. package/dist/chunks/{dist-VON3NRHE.js → dist-BLC5XSXL.js} +185 -120
  110. package/dist/chunks/dist-BLC5XSXL.js.map +6 -0
  111. package/dist/chunks/{dist-NSCNMOX7.js → dist-BLCQRSQS.js} +2 -2
  112. package/dist/chunks/{dist-V4SNHHMB.js → dist-GUHZ3EE6.js} +5 -2
  113. package/dist/chunks/dist-GUHZ3EE6.js.map +6 -0
  114. package/dist/chunks/{dist-6HN2ZMLV.js → dist-L757TGUH.js} +3 -3
  115. package/dist/chunks/dist-L757TGUH.js.map +6 -0
  116. package/dist/chunks/{dist-TC6H7TPQ.js → dist-QZPA2XDK.js} +6 -2
  117. package/dist/chunks/{dist-VV3V36IP.js → dist-SEXSU4PO.js} +4 -2
  118. package/dist/chunks/{dist-VV3V36IP.js.map → dist-SEXSU4PO.js.map} +1 -1
  119. package/dist/chunks/{dist-JJANJMY5.js → dist-Y6IO47UU.js} +3 -2
  120. package/dist/chunks/{dist-JJANJMY5.js.map → dist-Y6IO47UU.js.map} +1 -1
  121. package/dist/chunks/{doctor-P7L35KGN.js → doctor-QGFOTR5H.js} +16 -16
  122. package/dist/chunks/{drain-HOHRXIYY.js → drain-5WSM4MTM.js} +10 -10
  123. package/dist/chunks/{entry-L7XZIE7J.js → entry-HLIJKK65.js} +6 -6
  124. package/dist/chunks/{eval-2F473JAC.js → eval-5ZIBALCB.js} +2 -2
  125. package/dist/chunks/{exec-VCM4AL2S.js → exec-7YEZ64T4.js} +49 -35
  126. package/dist/chunks/exec-7YEZ64T4.js.map +6 -0
  127. package/dist/chunks/{home-R6WCBSOT.js → home-DXPCVXZK.js} +3 -3
  128. package/dist/chunks/{host-JGPJVLTC.js → host-663JLCCW.js} +10 -10
  129. package/dist/chunks/{host-queries-QWV47CFK.js → host-queries-7CSOWEPE.js} +17 -17
  130. package/dist/chunks/{learn-3UPHM5OI.js → learn-NNBHDBLF.js} +13 -13
  131. package/dist/chunks/{learn-builtin-3Q4BJFCF.js → learn-builtin-YEDJT6ZP.js} +16 -16
  132. package/dist/chunks/{lifecycle-EJLVISCU.js → lifecycle-NDR7R22S.js} +29 -29
  133. package/dist/chunks/{list-DQJBF4AB.js → list-GIP6KAYZ.js} +10 -10
  134. package/dist/chunks/{live-IWDOVSLG.js → live-FJISKPXJ.js} +15 -15
  135. package/dist/chunks/{login-B2PHE6IL.js → login-42ZPPMYK.js} +13 -13
  136. package/dist/chunks/{logs-5UTV3FMG.js → logs-7MAFXNFR.js} +4 -4
  137. package/dist/chunks/{mcp-JN36OQLX.js → mcp-EBVO25Q2.js} +20 -20
  138. package/dist/chunks/{message-command-RMLQ2PU5.js → message-command-YIHQF33L.js} +43 -43
  139. package/dist/chunks/{open-LDBJL43A.js → open-3I5NZTSX.js} +8 -8
  140. package/dist/chunks/{operator-tools-NA7PLRIP.js → operator-tools-PK2WYSF3.js} +14 -14
  141. package/dist/chunks/{output-schema-UKYWRZPS.js → output-schema-2UJ7LOOX.js} +3 -3
  142. package/dist/chunks/{pal-MAVUNYMB.js → pal-IOPI5RKZ.js} +16 -16
  143. package/dist/chunks/{peers-FBTQW2SY.js → peers-MZD3KTZK.js} +6 -6
  144. package/dist/chunks/{providers-M75ET3GT.js → providers-SI467SWN.js} +11 -11
  145. package/dist/chunks/{pty-VMUEEJRN.js → pty-T5LBAATA.js} +3 -3
  146. package/dist/chunks/{resident-URNRPE2S.js → resident-DDGJ2IWB.js} +24 -24
  147. package/dist/chunks/resume-GPXJJXCK.js +24 -0
  148. package/dist/chunks/{resume-command-5QGHV6WR.js → resume-command-V6ZKY7J6.js} +4 -4
  149. package/dist/chunks/{schedule-BK3WF2VK.js → schedule-GSNY74KJ.js} +8 -8
  150. package/dist/chunks/{service-VWASFP3R.js → service-MH57P24N.js} +28 -28
  151. package/dist/chunks/{session-step-DORV5FER.js → session-step-D4AT5RZR.js} +15 -15
  152. package/dist/chunks/{skills-TDDPMTQI.js → skills-QARQHL6M.js} +8 -8
  153. package/dist/chunks/{spaces-AEOU6MSZ.js → spaces-JVPRV4YM.js} +16 -16
  154. package/dist/chunks/{start-check-N4TPV2TM.js → start-check-2EP7HZTU.js} +2 -2
  155. package/dist/chunks/{state-SHLWYVZU.js → state-ADQWQEYB.js} +2 -2
  156. package/dist/chunks/{store-Z5H6LYVE.js → store-IRKBQZNF.js} +3 -3
  157. package/dist/chunks/{store-GUSFCKJA.js → store-KOGQWG66.js} +11 -11
  158. package/dist/chunks/{store-CQVUIU7K.js → store-RF6D7U2T.js} +6 -6
  159. package/dist/chunks/{store-75YZOOZI.js → store-TFJ73ZAM.js} +4 -4
  160. package/dist/chunks/{tui-PGHWYFN4.js → tui-5HAU6RLS.js} +108 -66
  161. package/dist/chunks/tui-5HAU6RLS.js.map +6 -0
  162. package/dist/chunks/{upgrade-RHPZQ33L.js → upgrade-ARBZZZRK.js} +6 -6
  163. package/dist/chunks/{worktree-5IYFN33C.js → worktree-5M2XFFJT.js} +13 -13
  164. package/dist/cli.d.ts.map +1 -1
  165. package/dist/commands/desktop-host.d.ts.map +1 -1
  166. package/dist/commands/exec-json.d.ts.map +1 -1
  167. package/dist/commands/exec.d.ts.map +1 -1
  168. package/dist/config/load.d.ts.map +1 -1
  169. package/dist/config/schema.d.ts +14 -0
  170. package/dist/config/schema.d.ts.map +1 -1
  171. package/dist/context/runtime-message.d.ts.map +1 -1
  172. package/dist/index.js +19 -19
  173. package/dist/integrations/learning/session-feed.d.ts.map +1 -1
  174. package/dist/integrations/resident/runner-worker.js +21 -21
  175. package/dist/tui/App.d.ts.map +1 -1
  176. package/dist/tui/agent.d.ts +19 -0
  177. package/dist/tui/agent.d.ts.map +1 -1
  178. package/dist/tui/model-refusal.d.ts +34 -0
  179. package/dist/tui/model-refusal.d.ts.map +1 -0
  180. package/dist/tui/plain-interruption.d.ts.map +1 -1
  181. package/dist/tui/turn-interruption.d.ts.map +1 -1
  182. package/dist/tui/types.d.ts +2 -0
  183. package/dist/tui/types.d.ts.map +1 -1
  184. package/package.json +8 -8
  185. package/dist/chunks/agent-session-3A5K5VK3.js +0 -69
  186. package/dist/chunks/chunk-6TT7NXLP.js.map +0 -6
  187. package/dist/chunks/chunk-E3FA5H3Q.js.map +0 -6
  188. package/dist/chunks/chunk-EFU2OFEK.js.map +0 -6
  189. package/dist/chunks/chunk-HFD2VRQP.js.map +0 -6
  190. package/dist/chunks/chunk-MMZHUQZQ.js.map +0 -6
  191. package/dist/chunks/dist-6HN2ZMLV.js.map +0 -6
  192. package/dist/chunks/dist-V4SNHHMB.js.map +0 -6
  193. package/dist/chunks/dist-VON3NRHE.js.map +0 -6
  194. package/dist/chunks/exec-VCM4AL2S.js.map +0 -6
  195. package/dist/chunks/resume-7B3EHDJ7.js +0 -24
  196. package/dist/chunks/tui-PGHWYFN4.js.map +0 -6
  197. /package/dist/chunks/{activity-command-DB4DREW7.js.map → activity-command-D744W6SC.js.map} +0 -0
  198. /package/dist/chunks/{add-NVXRVUGY.js.map → add-7F26IYNU.js.map} +0 -0
  199. /package/dist/chunks/{agent-6TD66IMV.js.map → agent-42PYZGA5.js.map} +0 -0
  200. /package/dist/chunks/{agent-session-3A5K5VK3.js.map → agent-session-SYLDVKFJ.js.map} +0 -0
  201. /package/dist/chunks/{archive-A3X7KX2U.js.map → archive-FLZUJDJZ.js.map} +0 -0
  202. /package/dist/chunks/{bin-main-5PYV7WYI.js.map → bin-main-NID46PS7.js.map} +0 -0
  203. /package/dist/chunks/{binding-EMMG5PAE.js.map → binding-JQUI2CTZ.js.map} +0 -0
  204. /package/dist/chunks/{browser-FUFFJBRR.js.map → browser-YZCY2CI6.js.map} +0 -0
  205. /package/dist/chunks/{chat-M653DEAF.js.map → chat-WBJPS4K6.js.map} +0 -0
  206. /package/dist/chunks/{chunk-OMRU22BQ.js.map → chunk-24NEAMG5.js.map} +0 -0
  207. /package/dist/chunks/{chunk-TKIWAXRU.js.map → chunk-2UATEMPS.js.map} +0 -0
  208. /package/dist/chunks/{chunk-U6U472VN.js.map → chunk-5DFBOMTX.js.map} +0 -0
  209. /package/dist/chunks/{chunk-HV2JFRSE.js.map → chunk-5OGY4CE7.js.map} +0 -0
  210. /package/dist/chunks/{chunk-GCFXQSN6.js.map → chunk-5VBA5XSC.js.map} +0 -0
  211. /package/dist/chunks/{chunk-IRUDNBAR.js.map → chunk-5W7CSQXQ.js.map} +0 -0
  212. /package/dist/chunks/{chunk-H6AUN2YD.js.map → chunk-6F4PW7TF.js.map} +0 -0
  213. /package/dist/chunks/{chunk-THJQXERD.js.map → chunk-6LMIJ2YT.js.map} +0 -0
  214. /package/dist/chunks/{chunk-NXX6C3WS.js.map → chunk-6OWRRNLC.js.map} +0 -0
  215. /package/dist/chunks/{chunk-VHFPIYVY.js.map → chunk-7BRK6EHB.js.map} +0 -0
  216. /package/dist/chunks/{chunk-WSIMHBEQ.js.map → chunk-7HNWFGWD.js.map} +0 -0
  217. /package/dist/chunks/{chunk-HH3NBBBE.js.map → chunk-B7QEQ7Y3.js.map} +0 -0
  218. /package/dist/chunks/{chunk-G5FWVYK2.js.map → chunk-BWI7L43E.js.map} +0 -0
  219. /package/dist/chunks/{chunk-K5FQ4G64.js.map → chunk-D7BXM6WW.js.map} +0 -0
  220. /package/dist/chunks/{chunk-M7LCVDP3.js.map → chunk-EVRWBRUB.js.map} +0 -0
  221. /package/dist/chunks/{chunk-FUJSGQYW.js.map → chunk-F2QERXWD.js.map} +0 -0
  222. /package/dist/chunks/{chunk-46OOPRR6.js.map → chunk-F4B77QJQ.js.map} +0 -0
  223. /package/dist/chunks/{chunk-MKRYUMLP.js.map → chunk-FU776PDS.js.map} +0 -0
  224. /package/dist/chunks/{chunk-4DVCHAWN.js.map → chunk-G742EI3J.js.map} +0 -0
  225. /package/dist/chunks/{chunk-BICC735N.js.map → chunk-GXQ4G3KA.js.map} +0 -0
  226. /package/dist/chunks/{chunk-S2UDKXWH.js.map → chunk-H2RDYYTB.js.map} +0 -0
  227. /package/dist/chunks/{chunk-P6RUYL3F.js.map → chunk-H5H6HDRA.js.map} +0 -0
  228. /package/dist/chunks/{chunk-ADCVLGQO.js.map → chunk-HIJXUSOS.js.map} +0 -0
  229. /package/dist/chunks/{chunk-GAEZQRQI.js.map → chunk-HYPNAC4H.js.map} +0 -0
  230. /package/dist/chunks/{chunk-OENL667J.js.map → chunk-I6W3KJR3.js.map} +0 -0
  231. /package/dist/chunks/{chunk-HGIIAAEG.js.map → chunk-IFEBBQ2M.js.map} +0 -0
  232. /package/dist/chunks/{chunk-U33GIKBK.js.map → chunk-IFXYNA2K.js.map} +0 -0
  233. /package/dist/chunks/{chunk-X7WLWVR7.js.map → chunk-IPVDXTWF.js.map} +0 -0
  234. /package/dist/chunks/{chunk-FZR4XULA.js.map → chunk-IZDYKTPN.js.map} +0 -0
  235. /package/dist/chunks/{chunk-7TBETDTX.js.map → chunk-JCLZ5HXI.js.map} +0 -0
  236. /package/dist/chunks/{chunk-7NJAEWFK.js.map → chunk-JU7JQ62S.js.map} +0 -0
  237. /package/dist/chunks/{chunk-JAB62RI5.js.map → chunk-KY2WSKNM.js.map} +0 -0
  238. /package/dist/chunks/{chunk-Y2PZNQH5.js.map → chunk-LMVXENEF.js.map} +0 -0
  239. /package/dist/chunks/{chunk-THQAGFMO.js.map → chunk-LQN7NG2F.js.map} +0 -0
  240. /package/dist/chunks/{chunk-LHZSSQ6K.js.map → chunk-NCW3WBBI.js.map} +0 -0
  241. /package/dist/chunks/{chunk-BOM64EUQ.js.map → chunk-NFATUZMX.js.map} +0 -0
  242. /package/dist/chunks/{chunk-VAP6YMB6.js.map → chunk-NGMXEU2B.js.map} +0 -0
  243. /package/dist/chunks/{chunk-J2FGTLZV.js.map → chunk-NI3LZ6UX.js.map} +0 -0
  244. /package/dist/chunks/{chunk-TFOIA3U3.js.map → chunk-NS4PN3SI.js.map} +0 -0
  245. /package/dist/chunks/{chunk-ANHFJD66.js.map → chunk-NZ6DX5CL.js.map} +0 -0
  246. /package/dist/chunks/{chunk-43HR3AF5.js.map → chunk-O7H4QZ7I.js.map} +0 -0
  247. /package/dist/chunks/{chunk-2OAD3CZE.js.map → chunk-OM3EDVLG.js.map} +0 -0
  248. /package/dist/chunks/{chunk-AHNXQAYZ.js.map → chunk-OMRGJSUJ.js.map} +0 -0
  249. /package/dist/chunks/{chunk-MYSU54EZ.js.map → chunk-OXM3GHWE.js.map} +0 -0
  250. /package/dist/chunks/{chunk-IYEDXZQZ.js.map → chunk-OYX743QK.js.map} +0 -0
  251. /package/dist/chunks/{chunk-THUX2WOG.js.map → chunk-P2Y3IUE6.js.map} +0 -0
  252. /package/dist/chunks/{chunk-B6INWHLR.js.map → chunk-PAY5TGHV.js.map} +0 -0
  253. /package/dist/chunks/{chunk-YLNQLDMP.js.map → chunk-PCWQ3ET3.js.map} +0 -0
  254. /package/dist/chunks/{chunk-KVCYYXCS.js.map → chunk-PFFQOCEI.js.map} +0 -0
  255. /package/dist/chunks/{chunk-CDDS3UKB.js.map → chunk-PQTS7XQB.js.map} +0 -0
  256. /package/dist/chunks/{chunk-6PDIDZGX.js.map → chunk-Q3AB63M5.js.map} +0 -0
  257. /package/dist/chunks/{chunk-6ZEHXLF7.js.map → chunk-Q6DM2TVI.js.map} +0 -0
  258. /package/dist/chunks/{chunk-VGUU6E6X.js.map → chunk-Q7ELMF4C.js.map} +0 -0
  259. /package/dist/chunks/{chunk-TUF4NNJV.js.map → chunk-QWVWGW6I.js.map} +0 -0
  260. /package/dist/chunks/{chunk-VY377HAA.js.map → chunk-QXNROEIH.js.map} +0 -0
  261. /package/dist/chunks/{chunk-WG32TSVL.js.map → chunk-RPCJJZTI.js.map} +0 -0
  262. /package/dist/chunks/{chunk-2YCPLLUW.js.map → chunk-SSE5CXYL.js.map} +0 -0
  263. /package/dist/chunks/{chunk-P7MNE6YP.js.map → chunk-T3NLKQO2.js.map} +0 -0
  264. /package/dist/chunks/{chunk-43PTHA5N.js.map → chunk-TGPKTH2S.js.map} +0 -0
  265. /package/dist/chunks/{chunk-667W6Z5W.js.map → chunk-TOJSNO4M.js.map} +0 -0
  266. /package/dist/chunks/{chunk-L6QJZZCJ.js.map → chunk-U4YXQWPW.js.map} +0 -0
  267. /package/dist/chunks/{chunk-325X27UO.js.map → chunk-U4ZP2JN2.js.map} +0 -0
  268. /package/dist/chunks/{chunk-S766UWAQ.js.map → chunk-V26FS5VG.js.map} +0 -0
  269. /package/dist/chunks/{chunk-LR4QQMJH.js.map → chunk-V3R3MR7F.js.map} +0 -0
  270. /package/dist/chunks/{chunk-NUNOIP4Y.js.map → chunk-VPJG7NQL.js.map} +0 -0
  271. /package/dist/chunks/{chunk-P6FEQPES.js.map → chunk-W7XKWKEZ.js.map} +0 -0
  272. /package/dist/chunks/{chunk-24FBGXYR.js.map → chunk-WNOB6C62.js.map} +0 -0
  273. /package/dist/chunks/{chunk-U3EQTU4G.js.map → chunk-X2F5ZFBV.js.map} +0 -0
  274. /package/dist/chunks/{chunk-X4WCRRZV.js.map → chunk-XK26JNIF.js.map} +0 -0
  275. /package/dist/chunks/{chunk-JKPUOSDC.js.map → chunk-XN7C5GWO.js.map} +0 -0
  276. /package/dist/chunks/{chunk-KZ5WYSA6.js.map → chunk-XSAEGHPS.js.map} +0 -0
  277. /package/dist/chunks/{chunk-D23EJNO5.js.map → chunk-ZB45QDNU.js.map} +0 -0
  278. /package/dist/chunks/{cli-runtime-QWBGE2VF.js.map → cli-runtime-OBTTHZZI.js.map} +0 -0
  279. /package/dist/chunks/{commands-LVUUZ6LF.js.map → commands-56WUDKVN.js.map} +0 -0
  280. /package/dist/chunks/{crash-report-PGXMRS5P.js.map → crash-report-3IE2RFYG.js.map} +0 -0
  281. /package/dist/chunks/{dist-NSCNMOX7.js.map → dist-BLCQRSQS.js.map} +0 -0
  282. /package/dist/chunks/{dist-TC6H7TPQ.js.map → dist-QZPA2XDK.js.map} +0 -0
  283. /package/dist/chunks/{doctor-P7L35KGN.js.map → doctor-QGFOTR5H.js.map} +0 -0
  284. /package/dist/chunks/{drain-HOHRXIYY.js.map → drain-5WSM4MTM.js.map} +0 -0
  285. /package/dist/chunks/{entry-L7XZIE7J.js.map → entry-HLIJKK65.js.map} +0 -0
  286. /package/dist/chunks/{eval-2F473JAC.js.map → eval-5ZIBALCB.js.map} +0 -0
  287. /package/dist/chunks/{home-R6WCBSOT.js.map → home-DXPCVXZK.js.map} +0 -0
  288. /package/dist/chunks/{host-JGPJVLTC.js.map → host-663JLCCW.js.map} +0 -0
  289. /package/dist/chunks/{host-queries-QWV47CFK.js.map → host-queries-7CSOWEPE.js.map} +0 -0
  290. /package/dist/chunks/{learn-3UPHM5OI.js.map → learn-NNBHDBLF.js.map} +0 -0
  291. /package/dist/chunks/{learn-builtin-3Q4BJFCF.js.map → learn-builtin-YEDJT6ZP.js.map} +0 -0
  292. /package/dist/chunks/{lifecycle-EJLVISCU.js.map → lifecycle-NDR7R22S.js.map} +0 -0
  293. /package/dist/chunks/{list-DQJBF4AB.js.map → list-GIP6KAYZ.js.map} +0 -0
  294. /package/dist/chunks/{live-IWDOVSLG.js.map → live-FJISKPXJ.js.map} +0 -0
  295. /package/dist/chunks/{login-B2PHE6IL.js.map → login-42ZPPMYK.js.map} +0 -0
  296. /package/dist/chunks/{logs-5UTV3FMG.js.map → logs-7MAFXNFR.js.map} +0 -0
  297. /package/dist/chunks/{mcp-JN36OQLX.js.map → mcp-EBVO25Q2.js.map} +0 -0
  298. /package/dist/chunks/{message-command-RMLQ2PU5.js.map → message-command-YIHQF33L.js.map} +0 -0
  299. /package/dist/chunks/{open-LDBJL43A.js.map → open-3I5NZTSX.js.map} +0 -0
  300. /package/dist/chunks/{operator-tools-NA7PLRIP.js.map → operator-tools-PK2WYSF3.js.map} +0 -0
  301. /package/dist/chunks/{output-schema-UKYWRZPS.js.map → output-schema-2UJ7LOOX.js.map} +0 -0
  302. /package/dist/chunks/{pal-MAVUNYMB.js.map → pal-IOPI5RKZ.js.map} +0 -0
  303. /package/dist/chunks/{peers-FBTQW2SY.js.map → peers-MZD3KTZK.js.map} +0 -0
  304. /package/dist/chunks/{providers-M75ET3GT.js.map → providers-SI467SWN.js.map} +0 -0
  305. /package/dist/chunks/{pty-VMUEEJRN.js.map → pty-T5LBAATA.js.map} +0 -0
  306. /package/dist/chunks/{resident-URNRPE2S.js.map → resident-DDGJ2IWB.js.map} +0 -0
  307. /package/dist/chunks/{resume-7B3EHDJ7.js.map → resume-GPXJJXCK.js.map} +0 -0
  308. /package/dist/chunks/{resume-command-5QGHV6WR.js.map → resume-command-V6ZKY7J6.js.map} +0 -0
  309. /package/dist/chunks/{schedule-BK3WF2VK.js.map → schedule-GSNY74KJ.js.map} +0 -0
  310. /package/dist/chunks/{service-VWASFP3R.js.map → service-MH57P24N.js.map} +0 -0
  311. /package/dist/chunks/{session-step-DORV5FER.js.map → session-step-D4AT5RZR.js.map} +0 -0
  312. /package/dist/chunks/{skills-TDDPMTQI.js.map → skills-QARQHL6M.js.map} +0 -0
  313. /package/dist/chunks/{spaces-AEOU6MSZ.js.map → spaces-JVPRV4YM.js.map} +0 -0
  314. /package/dist/chunks/{start-check-N4TPV2TM.js.map → start-check-2EP7HZTU.js.map} +0 -0
  315. /package/dist/chunks/{state-SHLWYVZU.js.map → state-ADQWQEYB.js.map} +0 -0
  316. /package/dist/chunks/{store-75YZOOZI.js.map → store-IRKBQZNF.js.map} +0 -0
  317. /package/dist/chunks/{store-CQVUIU7K.js.map → store-KOGQWG66.js.map} +0 -0
  318. /package/dist/chunks/{store-GUSFCKJA.js.map → store-RF6D7U2T.js.map} +0 -0
  319. /package/dist/chunks/{store-Z5H6LYVE.js.map → store-TFJ73ZAM.js.map} +0 -0
  320. /package/dist/chunks/{upgrade-RHPZQ33L.js.map → upgrade-ARBZZZRK.js.map} +0 -0
  321. /package/dist/chunks/{worktree-5IYFN33C.js.map → worktree-5M2XFFJT.js.map} +0 -0
@@ -304,7 +304,7 @@ var require_brace_expansion = __commonJS({
304
304
  });
305
305
 
306
306
  // ../sdk/dist/version.js
307
- var VERSION = "60.0.0";
307
+ var VERSION = "60.1.0";
308
308
 
309
309
  // ../sdk/dist/runtime/harness-session/index.js
310
310
  import { posix, win32 } from "node:path";
@@ -12824,6 +12824,8 @@ var DEFAULT_CAPABILITIES = {
12824
12824
  // ../sdk/dist/constants/continuation.js
12825
12825
  var AUTO_CONTINUATION_USER_MESSAGE = "Continue exactly where you left off. Do not repeat content you already wrote \u2014 pick up at the next token.";
12826
12826
  var REASONING_CUT_USER_MESSAGE = "The output limit was reached while you were still reasoning, before any text or tool call. Continue from the conversation above: think much more briefly and give your answer or next tool call well within the limit.";
12827
+ var REFUSED_REPLY_RETRY_MESSAGE = "Your previous response was stopped by a safety classifier. This is not a tool or API error. The rest of it was withheld, and any tool calls in it that had not finished did not run. Do not produce that content again, even reworded. Continue with the task without it.";
12828
+ var REFUSED_REPLY_CALL_RESULT = "This call did not run: the response that contained it was stopped by a safety classifier.";
12827
12829
 
12828
12830
  // ../sdk/dist/constants/limits.js
12829
12831
  var ZERO_COST = {
@@ -17588,6 +17590,9 @@ function withStreamIdleTimeout(provider, options) {
17588
17590
  ...provider.effortLevelsFor ? {
17589
17591
  effortLevelsFor: /* @__PURE__ */ __name((model, thinking) => provider.effortLevelsFor?.(model, thinking) ?? [], "effortLevelsFor")
17590
17592
  } : {},
17593
+ ...provider.refusalFallbackFor ? {
17594
+ refusalFallbackFor: /* @__PURE__ */ __name((model, refusal4, signal) => provider.refusalFallbackFor?.(model, refusal4, signal) ?? Promise.resolve(void 0), "refusalFallbackFor")
17595
+ } : {},
17591
17596
  ...provider.resolveContextWindow ? {
17592
17597
  resolveContextWindow: /* @__PURE__ */ __name((model, signal) => provider.resolveContextWindow?.(model, signal) ?? Promise.resolve(void 0), "resolveContextWindow")
17593
17598
  } : {}
@@ -20596,6 +20601,7 @@ var RUNTIME_CONTEXT_MESSAGE_KINDS = [
20596
20601
  "peer-notice",
20597
20602
  "reminder",
20598
20603
  "repeat-call",
20604
+ "refusal-retry",
20599
20605
  "steering",
20600
20606
  "step-context",
20601
20607
  "structured-output",
@@ -20949,6 +20955,7 @@ async function collectChatCompletion(stream) {
20949
20955
  let replayState;
20950
20956
  let finishReason = "stop";
20951
20957
  let finishDetail;
20958
+ let refusal4;
20952
20959
  let usage = {
20953
20960
  promptTokens: 0,
20954
20961
  completionTokens: 0,
@@ -21022,6 +21029,8 @@ async function collectChatCompletion(stream) {
21022
21029
  finishReason = chunk.finishReason;
21023
21030
  finishDetail = chunk.finishReason === "length" ? chunk.finishDetail : void 0;
21024
21031
  }
21032
+ if (chunk.refusal)
21033
+ refusal4 = chunk.refusal;
21025
21034
  if (chunk.usage)
21026
21035
  usage = mergeTokenUsage(usage, chunk.usage);
21027
21036
  }
@@ -21061,6 +21070,7 @@ async function collectChatCompletion(stream) {
21061
21070
  },
21062
21071
  finishReason,
21063
21072
  ...finishDetail ? { finishDetail } : {},
21073
+ ...refusal4 && finishReason === "content_filter" ? { refusal: refusal4 } : {},
21064
21074
  usage
21065
21075
  };
21066
21076
  }
@@ -25839,6 +25849,7 @@ var stopReason = external_exports.enum([
25839
25849
  "step_refused",
25840
25850
  "structured_output_failed",
25841
25851
  "output_limit",
25852
+ "refused",
25842
25853
  "answer_rejected",
25843
25854
  "input_guardrail",
25844
25855
  "output_guardrail",
@@ -26130,6 +26141,7 @@ var SESSION_EVENT_TYPE_TABLE = {
26130
26141
  hosted_tool: true,
26131
26142
  provider_retry: true,
26132
26143
  provider_fallback: true,
26144
+ model_refusal: true,
26133
26145
  tool_completed: true,
26134
26146
  user_question_asked: true,
26135
26147
  user_question_answered: true,
@@ -26197,6 +26209,7 @@ var TURN_BOUND_OTHER_TYPE_LIST = [
26197
26209
  "hosted_tool",
26198
26210
  "provider_retry",
26199
26211
  "provider_fallback",
26212
+ "model_refusal",
26200
26213
  "tool_completed",
26201
26214
  "user_question_asked",
26202
26215
  "user_question_answered",
@@ -28883,6 +28896,7 @@ var TURN_BOUND_EVENT_TYPES = /* @__PURE__ */ new Set([
28883
28896
  "hosted_tool",
28884
28897
  "provider_retry",
28885
28898
  "provider_fallback",
28899
+ "model_refusal",
28886
28900
  "tool_completed",
28887
28901
  "user_question_asked",
28888
28902
  "user_question_answered",
@@ -36082,6 +36096,36 @@ function diffRequestContext(previous, next2) {
36082
36096
  }
36083
36097
  __name(diffRequestContext, "diffRequestContext");
36084
36098
 
36099
+ // ../sdk/dist/runtime/query/iteration/effort-clamp.js
36100
+ var EFFORT_ORDER = [
36101
+ "none",
36102
+ "minimal",
36103
+ "low",
36104
+ "medium",
36105
+ "high",
36106
+ "xhigh",
36107
+ "max",
36108
+ "ultra"
36109
+ ];
36110
+ function effortForModel(provider, model, effort, thinking) {
36111
+ let menu;
36112
+ try {
36113
+ menu = provider.reasoningEffortLevelsFor ? provider.reasoningEffortLevelsFor(model, thinking) : provider.effortLevelsFor?.(model, thinking);
36114
+ } catch {
36115
+ return effort;
36116
+ }
36117
+ if (!menu || menu.length === 0 || menu.includes(effort))
36118
+ return effort;
36119
+ const rank = /* @__PURE__ */ __name((level) => EFFORT_ORDER.indexOf(level), "rank");
36120
+ const wanted = rank(effort);
36121
+ if (wanted < 0)
36122
+ return effort;
36123
+ const ranked2 = menu.filter((level) => rank(level) >= 0).sort((a, b) => rank(a) - rank(b));
36124
+ const below = ranked2.filter((level) => rank(level) < wanted);
36125
+ return below[below.length - 1] ?? ranked2[0] ?? effort;
36126
+ }
36127
+ __name(effortForModel, "effortForModel");
36128
+
36085
36129
  // ../sdk/dist/runtime/query/iteration/native-output.js
36086
36130
  async function parseNativeCandidate(schema, response, signal) {
36087
36131
  signal.throwIfAborted();
@@ -56716,6 +56760,7 @@ async function* streamProviderTurn(provider, params, emitEvent, drainPending, tu
56716
56760
  let finishReason = "stop";
56717
56761
  let reportedFinishReason;
56718
56762
  let finishDetail;
56763
+ let refusal4;
56719
56764
  let usage = {
56720
56765
  promptTokens: 0,
56721
56766
  completionTokens: 0,
@@ -56791,6 +56836,7 @@ async function* streamProviderTurn(provider, params, emitEvent, drainPending, tu
56791
56836
  finishReason = "stop";
56792
56837
  reportedFinishReason = void 0;
56793
56838
  finishDetail = void 0;
56839
+ refusal4 = void 0;
56794
56840
  streamedLength = 0;
56795
56841
  lastOutputCall = void 0;
56796
56842
  usage = {
@@ -57078,6 +57124,8 @@ async function* streamProviderTurn(provider, params, emitEvent, drainPending, tu
57078
57124
  reportedFinishReason = chunk.finishReason;
57079
57125
  finishDetail = chunk.finishReason === "length" ? chunk.finishDetail : void 0;
57080
57126
  }
57127
+ if (chunk.refusal)
57128
+ refusal4 = chunk.refusal;
57081
57129
  if (chunk.usage)
57082
57130
  usage = mergeTokenUsage(usage, chunk.usage);
57083
57131
  }
@@ -57251,6 +57299,7 @@ async function* streamProviderTurn(provider, params, emitEvent, drainPending, tu
57251
57299
  },
57252
57300
  finishReason: effectiveFinishReason,
57253
57301
  ...effectiveFinishReason === "length" && finishDetail ? { finishDetail } : {},
57302
+ ...effectiveFinishReason === "content_filter" && refusal4 ? { refusal: refusal4 } : {},
57254
57303
  usage
57255
57304
  };
57256
57305
  recordTokenUsage(params.model, usage);
@@ -57407,6 +57456,16 @@ var IterationOrchestrator = class {
57407
57456
  stopDeferredForOutstandingWork = false;
57408
57457
  /** Nudges sent since the model last finished a call without hitting its output cap. */
57409
57458
  outputContinuations = 0;
57459
+ /**
57460
+ * The model a refused request moved to. Once set it replaces the model the
57461
+ * step asked for, for the rest of the turn: the request that was refused
57462
+ * would only be refused again.
57463
+ */
57464
+ refusalPinnedModel;
57465
+ /** The request has already been re-run on another model once this turn. */
57466
+ refusalFallbackUsed = false;
57467
+ /** The request has already been re-run on the same model once this turn. */
57468
+ refusalRetryUsed = false;
57410
57469
  /**
57411
57470
  * `turn_end` (and, for a child, `subagent_stop`) fired when the model
57412
57471
  * finished and no hook asked for more. `finalizeTurn` then does not fire
@@ -57737,7 +57796,7 @@ var IterationOrchestrator = class {
57737
57796
  const step = await prepareStep(shaping, iterationNum);
57738
57797
  usageBefore = { ...recorder.tokenUsage };
57739
57798
  costBefore = { ...recorder.costInfo };
57740
- stepModel = step.model ?? model;
57799
+ stepModel = this.refusalPinnedModel ?? step.model ?? model;
57741
57800
  await selectContextModel(shaping, stepModel);
57742
57801
  if (stepModel !== contextModelBeforePreparation)
57743
57802
  await runCompactionCheck(this.ctx);
@@ -57753,7 +57812,7 @@ var IterationOrchestrator = class {
57753
57812
  const llmTools = this.ctx.tools.toLLMTools(stepAllowedTools).filter((tool) => this.ctx.structuredOutput?.mode !== "native" || tool.function.name !== STRUCTURED_OUTPUT_TOOL_NAME);
57754
57813
  this.ctx.toolExecutor.setStepAllowedTools(stepAllowedTools);
57755
57814
  const enforceToolInputSchema = enforcedModelInputToolNames(this.ctx.tools, llmTools);
57756
- stepModel = step.model ?? model;
57815
+ stepModel = this.refusalPinnedModel ?? step.model ?? model;
57757
57816
  const closingDirective = forceFinalize ? createRuntimeContextMessage(`[SYSTEM] You are approaching your resource limits. ${CLOSING_RESPONSE_GUIDANCE}`, "limit-finalization") : void 0;
57758
57817
  appendRecordedContext(recorder, step.recordedContext, this.ctx.log);
57759
57818
  const baseMessages = recorder.messages;
@@ -57854,6 +57913,17 @@ var IterationOrchestrator = class {
57854
57913
  model: requestedMember.model ?? stepModel,
57855
57914
  chainIndex: requestedMember.index
57856
57915
  };
57916
+ let requestEffort = turnConfig.effort;
57917
+ if (requestEffort && stepModel !== model) {
57918
+ requestEffort = effortForModel(this.ctx.provider, stepModel, requestEffort, turnConfig.thinking);
57919
+ if (requestEffort !== turnConfig.effort) {
57920
+ this.ctx.log.debug("Effort lowered to a level this model offers", {
57921
+ "namzu.runtime.model": stepModel,
57922
+ "namzu.runtime.effort_requested": turnConfig.effort,
57923
+ "namzu.runtime.effort_used": requestEffort
57924
+ });
57925
+ }
57926
+ }
57857
57927
  const operatorInputAtDispatch = this.latestUserMessage;
57858
57928
  const latestReviewUserMessage = (this.ctx.reviewAnswer || this.ctx.structuredOutput?.review) && operatorInputAtDispatch ? structuredClone(operatorInputAtDispatch) : void 0;
57859
57929
  const { response, messageId: messageId4, requestMessages } = yield* streamProviderTurn(this.ctx.provider, {
@@ -57882,7 +57952,7 @@ var IterationOrchestrator = class {
57882
57952
  maxTokens: outputCapOverride ?? step.maxResponseTokens ?? turnConfig.maxResponseTokens,
57883
57953
  cacheControl: { type: "auto" },
57884
57954
  ...turnConfig.thinking ? { thinking: turnConfig.thinking } : {},
57885
- ...turnConfig.effort ? { effort: turnConfig.effort } : {},
57955
+ ...requestEffort ? { effort: requestEffort } : {},
57886
57956
  ...!forceFinalize && turnConfig.webSearch ? { webSearch: turnConfig.webSearch } : {},
57887
57957
  // Thread the turn abort into the model call so a Stop tears the
57888
57958
  // in-flight turn down (provider passes it to fetch; the consumer
@@ -57973,6 +58043,30 @@ var IterationOrchestrator = class {
57973
58043
  } : {},
57974
58044
  ...contextFigures
57975
58045
  });
58046
+ if (response.finishReason === "content_filter") {
58047
+ iterSpan.setStatus({ code: SpanStatusCode.OK });
58048
+ if (iterationActivity) {
58049
+ this.ctx.activityStore.complete(iterationActivity.id, {
58050
+ content: response.message.content,
58051
+ hasToolCalls: false
58052
+ });
58053
+ }
58054
+ const outcome = yield* this.recoverFromRefusal({
58055
+ response,
58056
+ messageId: messageId4,
58057
+ stepModel,
58058
+ servedBy,
58059
+ forceFinalize,
58060
+ limitStopReason: forceFinalize ? guardResult.stopReason : void 0,
58061
+ iterationNum,
58062
+ stepStartedAt,
58063
+ usageBefore,
58064
+ costBefore
58065
+ });
58066
+ if (outcome === "retry")
58067
+ continue;
58068
+ break;
58069
+ }
57976
58070
  const assistantMsg = withStreamedMessageIdentity(createAssistantMessage(
57977
58071
  response.message.content,
57978
58072
  forceFinalize ? void 0 : response.message.toolCalls,
@@ -58195,7 +58289,7 @@ var IterationOrchestrator = class {
58195
58289
  [NAMZU.ITERATION]: iterationNum,
58196
58290
  "namzu.runtime.finish_reason": response.finishReason
58197
58291
  });
58198
- closingStopReason = await this.requestFinalResponse(model, "end_turn");
58292
+ closingStopReason = await this.requestFinalResponse(this.refusalPinnedModel ?? model, "end_turn");
58199
58293
  yield* this.ctx.drainPending();
58200
58294
  }
58201
58295
  await this.ctx.emitEvent({
@@ -59017,6 +59111,131 @@ ${feedback}`, "hook-feedback"));
59017
59111
  providerRejectedImagesSuppressed: repaired.count
59018
59112
  });
59019
59113
  }
59114
+ /**
59115
+ * A reply the provider declined to give.
59116
+ *
59117
+ * The refused reply never enters the history sent next, except on the
59118
+ * same-model retry, where the stopped partial reply stays so the model can
59119
+ * see what to avoid. At most one automatic retry of each kind per turn:
59120
+ *
59121
+ * 1. Another model of the same provider, when the provider names one and
59122
+ * the host has not turned `refusalFallback` off. The model is kept for
59123
+ * the rest of the turn and announced in a `model_refusal` event.
59124
+ * 2. The same model once more, only when the refused reply had partial
59125
+ * text or tool calls: unfinished calls get an error result and the
59126
+ * model is told the reply was stopped.
59127
+ * 3. Otherwise the turn settles `refused`.
59128
+ */
59129
+ async *recoverFromRefusal(input) {
59130
+ const { recorder } = this.ctx;
59131
+ const { response, servedBy, iterationNum } = input;
59132
+ const refusal4 = response.refusal ?? {};
59133
+ const toolCalls = response.message.toolCalls ?? [];
59134
+ const hasPartial = response.message.content !== null && response.message.content.length > 0 || toolCalls.length > 0;
59135
+ this.ctx.log.warn("The model declined to answer", {
59136
+ [NAMZU.TURN_ID]: recorder.turnId,
59137
+ [NAMZU.ITERATION]: iterationNum,
59138
+ "namzu.runtime.model": servedBy.model,
59139
+ "namzu.runtime.refusal_category": refusal4.category,
59140
+ "namzu.runtime.has_partial_output": hasPartial
59141
+ });
59142
+ const announce = /* @__PURE__ */ __name(async (outcome, fallbackModel) => {
59143
+ await this.ctx.emitEvent({
59144
+ type: "model_refusal",
59145
+ turnId: recorder.turnId,
59146
+ iteration: iterationNum,
59147
+ model: servedBy.model,
59148
+ providerId: servedBy.providerId,
59149
+ outcome,
59150
+ ...fallbackModel !== void 0 ? { fallbackModel } : {},
59151
+ ...refusal4.category ? { category: refusal4.category } : {},
59152
+ ...refusal4.explanation ? { explanation: refusal4.explanation } : {}
59153
+ });
59154
+ }, "announce");
59155
+ const closeIteration = /* @__PURE__ */ __name(async () => {
59156
+ this.recordStep({
59157
+ stepNumber: iterationNum,
59158
+ model: input.stepModel,
59159
+ servedBy,
59160
+ messageId: input.messageId,
59161
+ response,
59162
+ toolResults: [],
59163
+ toolExecutionMs: 0,
59164
+ startedAt: input.stepStartedAt,
59165
+ usageBefore: input.usageBefore,
59166
+ costBefore: input.costBefore
59167
+ });
59168
+ await this.ctx.emitEvent({
59169
+ type: "iteration_completed",
59170
+ turnId: recorder.turnId,
59171
+ iteration: iterationNum,
59172
+ hasToolCalls: false
59173
+ });
59174
+ }, "closeIteration");
59175
+ if (this.ctx.abortController.signal.aborted) {
59176
+ recorder.setStopReason("cancelled");
59177
+ recorder.markCancelled();
59178
+ await closeIteration();
59179
+ yield* this.ctx.drainPending();
59180
+ return "settled";
59181
+ }
59182
+ if (!input.forceFinalize && !this.refusalFallbackUsed && this.ctx.refusalFallback !== "off") {
59183
+ const next2 = await this.refusalFallbackModel(input.stepModel, refusal4);
59184
+ if (next2 !== void 0) {
59185
+ this.refusalFallbackUsed = true;
59186
+ this.refusalPinnedModel = next2;
59187
+ await announce("fallback", next2);
59188
+ await closeIteration();
59189
+ yield* this.ctx.drainPending();
59190
+ return "retry";
59191
+ }
59192
+ }
59193
+ if (!input.forceFinalize && !this.refusalRetryUsed && hasPartial) {
59194
+ this.refusalRetryUsed = true;
59195
+ recorder.pushMessage(withStreamedMessageIdentity(createAssistantMessage(response.message.content, toolCalls.length > 0 ? toolCalls : void 0, response.message.reasoning, response.message.citations, {
59196
+ type: "model",
59197
+ ...servedBy,
59198
+ ...response.message.replayState !== void 0 ? { replayState: response.message.replayState } : {}
59199
+ }, response.message.textParts), input.messageId));
59200
+ for (const call2 of toolCalls) {
59201
+ recorder.pushMessage(createToolMessage(REFUSED_REPLY_CALL_RESULT, call2.id, true));
59202
+ }
59203
+ recorder.pushMessage(createRuntimeContextMessage(REFUSED_REPLY_RETRY_MESSAGE, "refusal-retry"));
59204
+ await announce("retry");
59205
+ await closeIteration();
59206
+ yield* this.ctx.drainPending();
59207
+ return "retry";
59208
+ }
59209
+ recorder.setLastError(`${servedBy.model} declined to answer this message${refusal4.explanation ? `: ${refusal4.explanation}` : "."}`);
59210
+ recorder.setStopReason(input.limitStopReason ?? "refused");
59211
+ await announce("declined");
59212
+ await closeIteration();
59213
+ yield* this.ctx.drainPending();
59214
+ return "settled";
59215
+ }
59216
+ /**
59217
+ * Another model to try after `model` declined, or `undefined` when there is
59218
+ * none. Only the provider can say: it names its own recommendation or its
59219
+ * own declared order, checked against what this credential can serve. A
59220
+ * chain member declared with a model of its own cannot be swapped, because
59221
+ * the chain would put its own model back on the request.
59222
+ */
59223
+ async refusalFallbackModel(model, refusal4) {
59224
+ if (this.ctx.servingMember?.()?.model !== void 0)
59225
+ return void 0;
59226
+ const pick3 = this.ctx.provider.refusalFallbackFor;
59227
+ if (!pick3)
59228
+ return void 0;
59229
+ try {
59230
+ const next2 = await pick3.call(this.ctx.provider, model, refusal4, this.ctx.abortController.signal);
59231
+ return next2 !== void 0 && next2.length > 0 && next2 !== model ? next2 : void 0;
59232
+ } catch (err) {
59233
+ this.ctx.log.warn("The provider could not name a model to retry a refusal on", {
59234
+ "exception.message": toErrorMessage(err)
59235
+ });
59236
+ return void 0;
59237
+ }
59238
+ }
59020
59239
  async requestFinalResponse(model, reason2) {
59021
59240
  if (this.ctx.structuredOutput?.mode === "native")
59022
59241
  return "structured_output_failed";
@@ -59080,6 +59299,13 @@ ${feedback}`, "hook-feedback"));
59080
59299
  providerId: servedBy.providerId,
59081
59300
  model: servedBy.model
59082
59301
  });
59302
+ if (response.finishReason === "content_filter") {
59303
+ this.ctx.log.warn("The closing response was declined by the model", {
59304
+ [NAMZU.TURN_ID]: this.ctx.recorder.turnId,
59305
+ "namzu.runtime.model": servedBy.model
59306
+ });
59307
+ return void 0;
59308
+ }
59083
59309
  const finalMessageId = generateMessageId();
59084
59310
  const assistantMsg = withStreamedMessageIdentity(createAssistantMessage(response.message.content, void 0, response.message.reasoning, response.message.citations, {
59085
59311
  type: "model",
@@ -59381,6 +59607,14 @@ function withProviderFallback(members, options = {}) {
59381
59607
  ...first.provider.effortLevelsFor ? {
59382
59608
  effortLevelsFor: /* @__PURE__ */ __name((model, thinking) => first.provider.effortLevelsFor?.(model, thinking) ?? [], "effortLevelsFor")
59383
59609
  } : {},
59610
+ // Answered by the member the next request goes to first, the one the
59611
+ // cursor rests on: it is the member whose model just declined.
59612
+ ...members.some((member) => member.provider.refusalFallbackFor) ? {
59613
+ refusalFallbackFor: /* @__PURE__ */ __name((model, refusal4, signal) => {
59614
+ const serving = members[cursor] ?? first;
59615
+ return serving.provider.refusalFallbackFor?.(serving.model ?? model, refusal4, signal) ?? Promise.resolve(void 0);
59616
+ }, "refusalFallbackFor")
59617
+ } : {},
59384
59618
  ...first.provider.resolveContextWindow ? {
59385
59619
  resolveContextWindow: /* @__PURE__ */ __name((model, signal) => first.provider.resolveContextWindow?.(model, signal) ?? Promise.resolve(void 0), "resolveContextWindow")
59386
59620
  } : {}
@@ -59544,6 +59778,9 @@ function withProviderRetry(provider, options = {}) {
59544
59778
  ...provider.effortLevelsFor ? {
59545
59779
  effortLevelsFor: /* @__PURE__ */ __name((model, thinking) => provider.effortLevelsFor?.(model, thinking) ?? [], "effortLevelsFor")
59546
59780
  } : {},
59781
+ ...provider.refusalFallbackFor ? {
59782
+ refusalFallbackFor: /* @__PURE__ */ __name((model, refusal4, signal) => provider.refusalFallbackFor?.(model, refusal4, signal) ?? Promise.resolve(void 0), "refusalFallbackFor")
59783
+ } : {},
59547
59784
  ...provider.resolveContextWindow ? {
59548
59785
  resolveContextWindow: /* @__PURE__ */ __name((model, signal) => provider.resolveContextWindow?.(model, signal) ?? Promise.resolve(void 0), "resolveContextWindow")
59549
59786
  } : {}
@@ -64539,6 +64776,7 @@ async function* query(params) {
64539
64776
  ...params.repeatCallAdvisory === false ? {} : { repeatCalls: new RepeatCallTracker() },
64540
64777
  compactionConfig,
64541
64778
  ...params.maxOutputContinuations !== void 0 ? { maxOutputContinuations: params.maxOutputContinuations } : {},
64779
+ ...params.refusalFallback !== void 0 ? { refusalFallback: params.refusalFallback } : {},
64542
64780
  ...params.inboundMessages ? { inboundMessages: params.inboundMessages } : {},
64543
64781
  ...params.reminders ? { reminders: params.reminders } : {},
64544
64782
  ...params.durableInbound ? { durableInbound: params.durableInbound } : {},
@@ -68548,6 +68786,17 @@ function createTurnReporter(parentLogger) {
68548
68786
  "namzu.turn.server_directed": event.serverDirected
68549
68787
  });
68550
68788
  break;
68789
+ case "model_refusal":
68790
+ log.warn("Model declined to answer", {
68791
+ [NAMZU.TURN_ID]: event.turnId,
68792
+ [NAMZU.ITERATION]: event.iteration,
68793
+ "namzu.turn.from_model": event.model,
68794
+ "namzu.turn.from_provider_id": event.providerId,
68795
+ "namzu.turn.outcome": event.outcome,
68796
+ "namzu.turn.to_model": event.fallbackModel,
68797
+ "namzu.turn.category": event.category
68798
+ });
68799
+ break;
68551
68800
  case "provider_fallback":
68552
68801
  log.warn("Provider could not serve \u2014 continuing on the fallback", {
68553
68802
  [NAMZU.TURN_ID]: event.turnId,
@@ -72860,6 +73109,7 @@ var configRoutes = {
72860
73109
  toolRetryBackoff: "query",
72861
73110
  maxToolConcurrency: "query",
72862
73111
  maxOutputContinuations: "query",
73112
+ refusalFallback: "query",
72863
73113
  maxToolOutputChars: "query",
72864
73114
  maxToolOutputCharsPerMessage: "query",
72865
73115
  retainedToolPreviewChars: "query",
@@ -75426,6 +75676,7 @@ import { dirname as dirname17, join as join31, resolve as resolve13 } from "node
75426
75676
  // ../sdk/dist/store/memory/operation-lock.js
75427
75677
  import { randomUUID as randomUUID6 } from "node:crypto";
75428
75678
  import { lstat as lstat7, open as open12, readFile as readFile16, unlink as unlink10 } from "node:fs/promises";
75679
+ import { hostname as osHostname } from "node:os";
75429
75680
  import { setTimeout as delay } from "node:timers/promises";
75430
75681
  var DEFAULT_MEMORY_LOCK_TIMEOUT_MS = 1e4;
75431
75682
  function validateMemoryLockTimeout(timeoutMs) {
@@ -75438,70 +75689,217 @@ function validateMemoryLockTimeout(timeoutMs) {
75438
75689
  }
75439
75690
  }
75440
75691
  __name(validateMemoryLockTimeout, "validateMemoryLockTimeout");
75441
- function lockError(path3, reason2, timeoutMs) {
75692
+ var MEMORY_LOCK_RECORD_GRACE_MS = 5e3;
75693
+ function defaultIsPidAlive(pid) {
75694
+ try {
75695
+ process.kill(pid, 0);
75696
+ return true;
75697
+ } catch (error) {
75698
+ return error.code !== "ESRCH";
75699
+ }
75700
+ }
75701
+ __name(defaultIsPidAlive, "defaultIsPidAlive");
75702
+ function lockError(path3, message, timeoutMs) {
75442
75703
  return new NamzuError({
75443
75704
  code: "storage_error",
75444
- message: `Memory operation lock ${path3}: ${reason2}. Stop all processes using this memory store and inspect the lock owner before removing a stale lock; it is never broken automatically.`,
75705
+ message,
75445
75706
  details: { lockPath: path3, timeoutMs },
75446
75707
  retryable: false
75447
75708
  });
75448
75709
  }
75449
75710
  __name(lockError, "lockError");
75450
- async function acquireMemoryOperationLock(path3, timeoutMs) {
75711
+ function busyError2(path3, pid, timeoutMs) {
75712
+ const who = pid === void 0 ? "Another Namzu process is" : `Another Namzu process (pid ${pid}) is`;
75713
+ return lockError(path3, `${who} using the stored memory. Close it, or wait for it to finish.`, timeoutMs);
75714
+ }
75715
+ __name(busyError2, "busyError");
75716
+ function parseOwner(content) {
75717
+ try {
75718
+ const value = JSON.parse(content);
75719
+ if (!value || typeof value !== "object")
75720
+ return void 0;
75721
+ const pid = value.pid;
75722
+ if (typeof pid !== "number" || !Number.isSafeInteger(pid) || pid <= 0)
75723
+ return void 0;
75724
+ const host = value.hostname;
75725
+ return {
75726
+ pid,
75727
+ token: String(value.token ?? ""),
75728
+ acquiredAt: Number(value.acquiredAt ?? 0),
75729
+ ...typeof host === "string" && host.length > 0 ? { hostname: host } : {}
75730
+ };
75731
+ } catch {
75732
+ return void 0;
75733
+ }
75734
+ }
75735
+ __name(parseOwner, "parseOwner");
75736
+ async function inspect(path3, env) {
75737
+ const before = await lstat7(path3).catch((error) => {
75738
+ if (error.code === "ENOENT")
75739
+ return void 0;
75740
+ throw error;
75741
+ });
75742
+ if (!before)
75743
+ return void 0;
75744
+ if (!before.isFile() || before.isSymbolicLink())
75745
+ return { stats: before, content: "", pid: void 0, staleReason: void 0 };
75746
+ const content = await readFile16(path3, "utf8").catch((error) => {
75747
+ if (error.code === "ENOENT")
75748
+ return void 0;
75749
+ throw error;
75750
+ });
75751
+ if (content === void 0)
75752
+ return void 0;
75753
+ const after = await lstat7(path3).catch(() => void 0);
75754
+ if (!after || after.dev !== before.dev || after.ino !== before.ino)
75755
+ return void 0;
75756
+ const owner = parseOwner(content);
75757
+ if (owner) {
75758
+ if (owner.hostname !== void 0 && owner.hostname !== env.hostname) {
75759
+ return { stats: before, content, pid: owner.pid, staleReason: void 0 };
75760
+ }
75761
+ return {
75762
+ stats: before,
75763
+ content,
75764
+ pid: owner.pid,
75765
+ staleReason: env.isPidAlive(owner.pid) ? void 0 : `owner process ${owner.pid} is gone`
75766
+ };
75767
+ }
75768
+ const age = env.now() - before.mtimeMs;
75769
+ return {
75770
+ stats: before,
75771
+ content,
75772
+ pid: void 0,
75773
+ staleReason: age > MEMORY_LOCK_RECORD_GRACE_MS ? `lock holds no readable owner record and is ${Math.round(age / 1e3)}s old` : void 0
75774
+ };
75775
+ }
75776
+ __name(inspect, "inspect");
75777
+ async function createOwned(path3, env) {
75778
+ let handle;
75779
+ try {
75780
+ handle = await open12(path3, "wx", 384);
75781
+ } catch (error) {
75782
+ if (error.code === "EEXIST")
75783
+ return void 0;
75784
+ throw error;
75785
+ }
75786
+ const owner = `${JSON.stringify({
75787
+ pid: process.pid,
75788
+ token: randomUUID6(),
75789
+ acquiredAt: Date.now(),
75790
+ hostname: env.hostname
75791
+ })}
75792
+ `;
75793
+ let identity;
75794
+ try {
75795
+ identity = await handle.stat();
75796
+ await handle.writeFile(owner, "utf8");
75797
+ await handle.sync();
75798
+ } catch (error) {
75799
+ await handle.close().catch(() => void 0);
75800
+ const current = await lstat7(path3).catch(() => void 0);
75801
+ if (!identity || current?.dev === identity.dev && current.ino === identity.ino) {
75802
+ await unlink10(path3).catch(() => void 0);
75803
+ }
75804
+ throw error;
75805
+ }
75806
+ await handle.close();
75807
+ return { identity, owner };
75808
+ }
75809
+ __name(createOwned, "createOwned");
75810
+ async function releaseOwned(path3, identity, owner, timeoutMs) {
75811
+ const current = await lstat7(path3);
75812
+ if (!current.isFile() || current.isSymbolicLink() || current.dev !== identity.dev || current.ino !== identity.ino || await readFile16(path3, "utf8") !== owner) {
75813
+ throw lockError(path3, `Memory operation lock ${path3}: the lock owner changed before release.`, timeoutMs);
75814
+ }
75815
+ await unlink10(path3);
75816
+ }
75817
+ __name(releaseOwned, "releaseOwned");
75818
+ function sameFile(a, b) {
75819
+ return a.dev === b.dev && a.ino === b.ino;
75820
+ }
75821
+ __name(sameFile, "sameFile");
75822
+ async function unlinkIfStillStale(path3, seen, env) {
75823
+ const again = await inspect(path3, env);
75824
+ if (!again || !sameFile(again.stats, seen.stats) || again.content !== seen.content)
75825
+ return false;
75826
+ if (again.staleReason === void 0)
75827
+ return false;
75828
+ const last = await lstat7(path3).catch(() => void 0);
75829
+ if (!last || !sameFile(last, seen.stats))
75830
+ return false;
75831
+ await unlink10(path3).catch((error) => {
75832
+ if (error.code !== "ENOENT")
75833
+ throw error;
75834
+ });
75835
+ return true;
75836
+ }
75837
+ __name(unlinkIfStillStale, "unlinkIfStillStale");
75838
+ async function breakStaleLock(path3, seen, timeoutMs, env) {
75839
+ const breakPath = `${path3}.break`;
75840
+ let held3;
75841
+ for (let attempt = 0; attempt < 2 && !held3; attempt++) {
75842
+ held3 = await createOwned(breakPath, env);
75843
+ if (held3)
75844
+ break;
75845
+ const breaker = await inspect(breakPath, env);
75846
+ if (!breaker)
75847
+ continue;
75848
+ if (breaker.staleReason === void 0 || !await unlinkIfStillStale(breakPath, breaker, env)) {
75849
+ return false;
75850
+ }
75851
+ }
75852
+ if (!held3)
75853
+ return false;
75854
+ try {
75855
+ const removed = await unlinkIfStillStale(path3, seen, env);
75856
+ if (removed) {
75857
+ env.logger?.info("Broke an abandoned memory operation lock", {
75858
+ "namzu.store.lock_path": path3,
75859
+ "namzu.store.lock_reason": seen.staleReason
75860
+ });
75861
+ }
75862
+ return removed;
75863
+ } finally {
75864
+ await releaseOwned(breakPath, held3.identity, held3.owner, timeoutMs).catch(() => void 0);
75865
+ }
75866
+ }
75867
+ __name(breakStaleLock, "breakStaleLock");
75868
+ async function acquireMemoryOperationLock(path3, timeoutMs, options = {}) {
75869
+ const env = {
75870
+ logger: options.logger,
75871
+ now: options.now ?? Date.now,
75872
+ isPidAlive: options.isPidAlive ?? defaultIsPidAlive,
75873
+ hostname: options.hostname ?? osHostname()
75874
+ };
75451
75875
  const deadline = performance.now() + timeoutMs;
75452
75876
  let attempted = false;
75877
+ let lastPid;
75878
+ let justBroke = false;
75453
75879
  for (; ; ) {
75454
- if (attempted && performance.now() >= deadline) {
75455
- throw lockError(path3, `acquisition timed out after ${timeoutMs} ms`, timeoutMs);
75880
+ if (attempted && !justBroke && performance.now() >= deadline) {
75881
+ throw busyError2(path3, lastPid, timeoutMs);
75456
75882
  }
75883
+ justBroke = false;
75457
75884
  attempted = true;
75458
- let handle;
75459
- try {
75460
- handle = await open12(path3, "wx", 384);
75461
- } catch (error) {
75462
- if (error.code !== "EEXIST")
75463
- throw error;
75464
- const existing = await lstat7(path3).catch((statError) => {
75465
- if (statError.code === "ENOENT")
75466
- return void 0;
75467
- throw statError;
75468
- });
75469
- if (!existing)
75470
- continue;
75471
- if (!existing.isFile() || existing.isSymbolicLink()) {
75472
- throw lockError(path3, "the occupied lock is not a regular file", timeoutMs);
75473
- }
75474
- if (performance.now() >= deadline) {
75475
- throw lockError(path3, `acquisition timed out after ${timeoutMs} ms`, timeoutMs);
75476
- }
75477
- await delay(Math.min(25, Math.max(1, deadline - performance.now())));
75885
+ const created = await createOwned(path3, env);
75886
+ if (created) {
75887
+ return () => releaseOwned(path3, created.identity, created.owner, timeoutMs);
75888
+ }
75889
+ const seen = await inspect(path3, env);
75890
+ if (!seen)
75478
75891
  continue;
75892
+ if (!seen.stats.isFile() || seen.stats.isSymbolicLink()) {
75893
+ throw lockError(path3, `The stored memory lock ${path3} is not a regular file, so Namzu will not use it. Move it aside to continue.`, timeoutMs);
75479
75894
  }
75480
- const owner = `${JSON.stringify({ pid: process.pid, token: randomUUID6(), acquiredAt: Date.now() })}
75481
- `;
75482
- const identity = await handle.stat().catch(async (error) => {
75483
- await handle.close();
75484
- throw error;
75485
- });
75486
- try {
75487
- await handle.writeFile(owner, "utf8");
75488
- await handle.sync();
75489
- } catch (error) {
75490
- await handle.close();
75491
- const current = await lstat7(path3).catch(() => void 0);
75492
- if (current?.dev === identity.dev && current.ino === identity.ino) {
75493
- await unlink10(path3).catch(() => void 0);
75494
- }
75495
- throw error;
75895
+ lastPid = seen.pid;
75896
+ if (seen.staleReason !== void 0 && await breakStaleLock(path3, seen, timeoutMs, env)) {
75897
+ justBroke = true;
75898
+ continue;
75496
75899
  }
75497
- await handle.close();
75498
- return async () => {
75499
- const current = await lstat7(path3);
75500
- if (!current.isFile() || current.isSymbolicLink() || current.dev !== identity.dev || current.ino !== identity.ino || await readFile16(path3, "utf8") !== owner) {
75501
- throw lockError(path3, "the lock owner changed before release", timeoutMs);
75502
- }
75503
- await unlink10(path3);
75504
- };
75900
+ if (performance.now() >= deadline)
75901
+ throw busyError2(path3, lastPid, timeoutMs);
75902
+ await delay(Math.min(25, Math.max(1, deadline - performance.now())));
75505
75903
  }
75506
75904
  }
75507
75905
  __name(acquireMemoryOperationLock, "acquireMemoryOperationLock");
@@ -75674,7 +76072,7 @@ var DiskMemoryStore = class {
75674
76072
  }
75675
76073
  async withAuthoritativeIndex(operation) {
75676
76074
  const location = await this.storageLocation();
75677
- const release2 = await acquireMemoryOperationLock(join31(dirname17(location.indexPath), "operation.lock"), this.lockTimeoutMs);
76075
+ const release2 = await acquireMemoryOperationLock(join31(dirname17(location.indexPath), "operation.lock"), this.lockTimeoutMs, { logger: this.log });
75678
76076
  try {
75679
76077
  await this.reloadIndex(location);
75680
76078
  return await operation(location);
@@ -76325,7 +76723,7 @@ var MarkdownMemoryStore = class {
76325
76723
  }
76326
76724
  async withLoaded(operation, mode = {}) {
76327
76725
  const dir = await this.location();
76328
- const release2 = await acquireMemoryOperationLock(join32(dir, "operation.lock"), this.lockTimeoutMs);
76726
+ const release2 = await acquireMemoryOperationLock(join32(dir, "operation.lock"), this.lockTimeoutMs, { logger: this.log });
76329
76727
  try {
76330
76728
  const { loaded, superseded } = await this.load(dir, mode.importing ?? false);
76331
76729
  if (mode.writes)
@@ -88671,11 +89069,17 @@ var MockLLMProvider = class {
88671
89069
  turnIndex = 0;
88672
89070
  /** Every request this provider has received, in order. */
88673
89071
  requests = [];
89072
+ /** Present only when the script names a model to retry a refusal on. */
89073
+ refusalFallbackFor;
88674
89074
  constructor(config = {}) {
88675
89075
  this.capabilities = config.capabilities;
88676
89076
  this.model = config.model ?? FALLBACK_MOCK_MODEL;
88677
89077
  this.responseDelayMs = config.responseDelayMs ?? 0;
88678
89078
  this.onRequest = config.onRequest;
89079
+ const refusalFallbackModel = config.refusalFallbackModel;
89080
+ if (refusalFallbackModel !== void 0) {
89081
+ this.refusalFallbackFor = async (model) => model === refusalFallbackModel ? void 0 : refusalFallbackModel;
89082
+ }
88679
89083
  this.nextTurn = config.nextTurn;
88680
89084
  this.turns = config.turns ?? [{ text: config.responseText ?? "Mock provider response" }];
88681
89085
  }
@@ -88752,12 +89156,14 @@ var MockLLMProvider = class {
88752
89156
  break;
88753
89157
  yield { id: id3, delta: { toolCallEnd: { index, id: callId } } };
88754
89158
  }
89159
+ const finishReason = turn.finishReason ?? // A call cut off mid-JSON is what the output limit does, and the
89160
+ // finish reason is how a consumer tells that from malformed JSON.
89161
+ (toolCalls.some((call2) => call2.truncateArguments === true) ? "length" : toolCalls.length > 0 ? "tool_calls" : "stop");
88755
89162
  yield {
88756
89163
  id: id3,
88757
89164
  delta: {},
88758
- finishReason: turn.finishReason ?? // A call cut off mid-JSON is what the output limit does, and the
88759
- // finish reason is how a consumer tells that from malformed JSON.
88760
- (toolCalls.some((call2) => call2.truncateArguments === true) ? "length" : toolCalls.length > 0 ? "tool_calls" : "stop"),
89165
+ finishReason,
89166
+ ...finishReason === "content_filter" ? { refusal: turn.refusal ?? {} } : {},
88761
89167
  usage: { ...EMPTY_USAGE, ...turn.usage }
88762
89168
  };
88763
89169
  }
@@ -94239,6 +94645,18 @@ var MAPPING = {
94239
94645
  }
94240
94646
  ]
94241
94647
  }), "provider_fallback"),
94648
+ // The answer arriving next may come from another model than the peer asked
94649
+ // for, or the turn may end declined: both are news. Still `running`; the
94650
+ // stop reason carries the final word.
94651
+ model_refusal: /* @__PURE__ */ __name((e, ctx) => statusEvent(e.turnId, "running", false, ctx, {
94652
+ role: "agent",
94653
+ parts: [
94654
+ {
94655
+ kind: "text",
94656
+ text: e.outcome === "fallback" && e.fallbackModel ? `${e.model} declined to answer; continuing on ${e.fallbackModel}` : e.outcome === "retry" ? `${e.model} stopped its reply; continuing once with that noted` : `${e.model} declined to answer`
94657
+ }
94658
+ ]
94659
+ }), "model_refusal"),
94242
94660
  tool_completed: /* @__PURE__ */ __name((e, ctx) => artifactEvent(e.turnId, ctx, {
94243
94661
  artifactId: `tool-${e.toolName}-${Date.now()}`,
94244
94662
  name: `${e.toolName} result`,
@@ -95075,6 +95493,18 @@ var MAPPING2 = {
95075
95493
  reason: e.reason
95076
95494
  }), "transform")
95077
95495
  },
95496
+ model_refusal: {
95497
+ wire: "model.refusal",
95498
+ transform: /* @__PURE__ */ __name((e) => ({
95499
+ iteration: e.iteration,
95500
+ model: e.model,
95501
+ provider_id: e.providerId,
95502
+ outcome: e.outcome,
95503
+ ...e.fallbackModel ? { fallback_model: e.fallbackModel } : {},
95504
+ ...e.category ? { category: e.category } : {},
95505
+ ...e.explanation ? { explanation: e.explanation } : {}
95506
+ }), "transform")
95507
+ },
95078
95508
  user_question_asked: {
95079
95509
  wire: "question.asked",
95080
95510
  transform: /* @__PURE__ */ __name((e) => ({
@@ -95445,6 +95875,7 @@ var STOP_REASONS = {
95445
95875
  input_guardrail: "refused",
95446
95876
  output_guardrail: "refused",
95447
95877
  step_refused: "refused",
95878
+ refused: "refused",
95448
95879
  plan_rejected: "refused",
95449
95880
  answer_rejected: "refused",
95450
95881
  structured_output_failed: "error",
@@ -96937,6 +97368,7 @@ var MODEL_FIRST_METHODS = /* @__PURE__ */ new Set([
96937
97368
  "reasoningEffortDefaultFor",
96938
97369
  "effortLevelsFor",
96939
97370
  "resolveContextWindow",
97371
+ "refusalFallbackFor",
96940
97372
  "healthCheck",
96941
97373
  "doctorCheck"
96942
97374
  ]);
@@ -106451,7 +106883,7 @@ function removeStaleSocketIfOwned(address2, uid) {
106451
106883
  }
106452
106884
  }
106453
106885
  __name(removeStaleSocketIfOwned, "removeStaleSocketIfOwned");
106454
- function defaultIsPidAlive(pid) {
106886
+ function defaultIsPidAlive2(pid) {
106455
106887
  try {
106456
106888
  process.kill(pid, 0);
106457
106889
  return true;
@@ -106459,9 +106891,9 @@ function defaultIsPidAlive(pid) {
106459
106891
  return error.code === "EPERM";
106460
106892
  }
106461
106893
  }
106462
- __name(defaultIsPidAlive, "defaultIsPidAlive");
106894
+ __name(defaultIsPidAlive2, "defaultIsPidAlive");
106463
106895
  async function isPeerRecordLive(record3, options = {}) {
106464
- const isPidAlive = options.isPidAlive ?? defaultIsPidAlive;
106896
+ const isPidAlive = options.isPidAlive ?? defaultIsPidAlive2;
106465
106897
  const ping = options.ping ?? pingPeer;
106466
106898
  const timeoutMs = options.pingTimeoutMs ?? 500;
106467
106899
  return isPidAlive(record3.pid) && await ping(record3.address, timeoutMs);
@@ -119839,6 +120271,8 @@ export {
119839
120271
  DEFAULT_CAPABILITIES,
119840
120272
  AUTO_CONTINUATION_USER_MESSAGE,
119841
120273
  REASONING_CUT_USER_MESSAGE,
120274
+ REFUSED_REPLY_RETRY_MESSAGE,
120275
+ REFUSED_REPLY_CALL_RESULT,
119842
120276
  ZERO_COST,
119843
120277
  CHARS_PER_TOKEN,
119844
120278
  EMPTY_TOKEN_USAGE,
@@ -120981,4 +121415,4 @@ export {
120981
121415
  WakeBudget,
120982
121416
  wakeBudgetFromEnv
120983
121417
  };
120984
- //# sourceMappingURL=chunk-MMZHUQZQ.js.map
121418
+ //# sourceMappingURL=chunk-4HL5LUP5.js.map