tenjin-cli 0.1.0-alpha.31 → 0.1.0-alpha.32

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 (258) hide show
  1. package/README.md +5 -5
  2. package/dist/{_esm-MEXZI5DL.js → _esm-RLLC72MS.js} +128 -132
  3. package/dist/{alive-J64H46HI.js → alive-MROUMFH3.js} +13 -6
  4. package/dist/auto-update-OPWMRZLS.js +22 -0
  5. package/dist/{ccip-7RMRLAGV.js → ccip-DHDFKTQV.js} +2 -2
  6. package/dist/chunk-2GNOFONN.js +560 -0
  7. package/dist/chunk-2GNOFONN.js.map +1 -0
  8. package/dist/{chunk-TTNESUPQ.js → chunk-2GP3HRYK.js} +2120 -193
  9. package/dist/chunk-2GP3HRYK.js.map +1 -0
  10. package/dist/chunk-3AIHRXKO.js +72 -0
  11. package/dist/chunk-3AIHRXKO.js.map +1 -0
  12. package/dist/{chunk-LEFIX6RS.js → chunk-3DIL66VX.js} +31 -11
  13. package/dist/chunk-3DIL66VX.js.map +1 -0
  14. package/dist/{chunk-S4SAZ7OD.js → chunk-3FMZGI7I.js} +12 -2
  15. package/dist/{chunk-S4SAZ7OD.js.map → chunk-3FMZGI7I.js.map} +1 -1
  16. package/dist/{chunk-7Q5FDF65.js → chunk-445VQTVM.js} +3 -3
  17. package/dist/{chunk-A36LQPHV.js → chunk-4LMUQMBH.js} +1 -1
  18. package/dist/{chunk-A36LQPHV.js.map → chunk-4LMUQMBH.js.map} +1 -1
  19. package/dist/{chunk-KXQ4UIP7.js → chunk-4USCZ2NI.js} +2 -2
  20. package/dist/chunk-62KNUYWD.js +111 -0
  21. package/dist/chunk-62KNUYWD.js.map +1 -0
  22. package/dist/{chunk-POUWHWID.js → chunk-6CMM6YCB.js} +3 -3
  23. package/dist/{chunk-POUWHWID.js.map → chunk-6CMM6YCB.js.map} +1 -1
  24. package/dist/{chunk-5MARFNSB.js → chunk-AD226HDR.js} +49 -30
  25. package/dist/chunk-AD226HDR.js.map +1 -0
  26. package/dist/chunk-ADV4LDTB.js +106 -0
  27. package/dist/chunk-ADV4LDTB.js.map +1 -0
  28. package/dist/{chunk-7WU4OPLP.js → chunk-AV5NZMYO.js} +5 -3
  29. package/dist/{chunk-7WU4OPLP.js.map → chunk-AV5NZMYO.js.map} +1 -1
  30. package/dist/chunk-B7EM4GGF.js +198 -0
  31. package/dist/chunk-B7EM4GGF.js.map +1 -0
  32. package/dist/chunk-BFDQ4WNW.js +119 -0
  33. package/dist/chunk-BFDQ4WNW.js.map +1 -0
  34. package/dist/{chunk-2XLC3AEX.js → chunk-BI673VEJ.js} +536 -510
  35. package/dist/chunk-BI673VEJ.js.map +1 -0
  36. package/dist/chunk-CEXSOI5R.js +808 -0
  37. package/dist/chunk-CEXSOI5R.js.map +1 -0
  38. package/dist/{chunk-FW75G2W4.js → chunk-CISYM4EO.js} +5 -5
  39. package/dist/{chunk-B7HUUJOK.js → chunk-D3ZURCG7.js} +3 -3
  40. package/dist/chunk-D5TOQSO4.js +474 -0
  41. package/dist/chunk-D5TOQSO4.js.map +1 -0
  42. package/dist/{chunk-UQUOVWBG.js → chunk-DRDUIZIA.js} +7 -7
  43. package/dist/{chunk-27EPWVOY.js → chunk-DW4YTVR3.js} +2 -2
  44. package/dist/chunk-E7LGOMH6.js +449 -0
  45. package/dist/chunk-E7LGOMH6.js.map +1 -0
  46. package/dist/{chunk-QSCPK4F5.js → chunk-E7SW44LM.js} +4 -11
  47. package/dist/chunk-E7SW44LM.js.map +1 -0
  48. package/dist/chunk-EDJWHDDL.js +33 -0
  49. package/dist/chunk-EDJWHDDL.js.map +1 -0
  50. package/dist/chunk-F3ED5WTR.js +13 -0
  51. package/dist/chunk-F3ED5WTR.js.map +1 -0
  52. package/dist/chunk-G75OPGAK.js +111 -0
  53. package/dist/chunk-G75OPGAK.js.map +1 -0
  54. package/dist/{chunk-R5LCN54M.js → chunk-GAKUQHKA.js} +13 -17
  55. package/dist/{chunk-R5LCN54M.js.map → chunk-GAKUQHKA.js.map} +1 -1
  56. package/dist/{chunk-4ZZO6ULA.js → chunk-HDPUXS3Z.js} +19 -48
  57. package/dist/chunk-HDPUXS3Z.js.map +1 -0
  58. package/dist/{chunk-ORWL5BSN.js → chunk-HGZEPQUT.js} +2 -2
  59. package/dist/{chunk-6E5R45ZO.js → chunk-HREHWL32.js} +4 -4
  60. package/dist/{chunk-6E5R45ZO.js.map → chunk-HREHWL32.js.map} +1 -1
  61. package/dist/{chunk-KXVP2VKA.js → chunk-I5TDIUKM.js} +15 -34
  62. package/dist/chunk-I5TDIUKM.js.map +1 -0
  63. package/dist/{chunk-7QKHZQKW.js → chunk-IADZOXKN.js} +39 -6
  64. package/dist/chunk-IADZOXKN.js.map +1 -0
  65. package/dist/{chunk-P4NH7OUK.js → chunk-IDTRSAHE.js} +2 -2
  66. package/dist/{chunk-YFPY4ONH.js → chunk-JEVQ5LKO.js} +4 -4
  67. package/dist/chunk-JNJWBTU2.js +3497 -0
  68. package/dist/chunk-JNJWBTU2.js.map +1 -0
  69. package/dist/{chunk-MNXS2U45.js → chunk-JRZBBPO6.js} +167 -86
  70. package/dist/chunk-JRZBBPO6.js.map +1 -0
  71. package/dist/{chunk-WJXLQXJY.js → chunk-MPZUYCAP.js} +4 -1
  72. package/dist/{chunk-WJXLQXJY.js.map → chunk-MPZUYCAP.js.map} +1 -1
  73. package/dist/{chunk-SJLTEINJ.js → chunk-OJNTCYQQ.js} +17 -1
  74. package/dist/chunk-OJNTCYQQ.js.map +1 -0
  75. package/dist/{chunk-AGZ7PJKY.js → chunk-OTWLERSW.js} +22 -5
  76. package/dist/chunk-OTWLERSW.js.map +1 -0
  77. package/dist/{chunk-NEFNKLBE.js → chunk-PJNENX2A.js} +1535 -422
  78. package/dist/chunk-PJNENX2A.js.map +1 -0
  79. package/dist/{chunk-UKY4CHNC.js → chunk-PKHI276N.js} +8 -4
  80. package/dist/chunk-PKHI276N.js.map +1 -0
  81. package/dist/{chunk-5K5W4S66.js → chunk-QF3LSMGS.js} +2 -2
  82. package/dist/{chunk-XZKD7DIF.js → chunk-RL5UUDT4.js} +3 -3
  83. package/dist/{chunk-XZKD7DIF.js.map → chunk-RL5UUDT4.js.map} +1 -1
  84. package/dist/{chunk-OHRR5OYM.js → chunk-SFASB5FL.js} +10 -4
  85. package/dist/chunk-SFASB5FL.js.map +1 -0
  86. package/dist/{chunk-YVFXE7RR.js → chunk-SNNSAGMT.js} +7279 -2627
  87. package/dist/chunk-SNNSAGMT.js.map +1 -0
  88. package/dist/{chunk-WK7F3B2E.js → chunk-SO3XRZPX.js} +3 -3
  89. package/dist/chunk-SYOS5CAC.js +176 -0
  90. package/dist/chunk-SYOS5CAC.js.map +1 -0
  91. package/dist/chunk-TAW4UFFF.js +293 -0
  92. package/dist/chunk-TAW4UFFF.js.map +1 -0
  93. package/dist/{hosts-FWZOV26H.js → chunk-TF5HCP33.js} +79 -24
  94. package/dist/chunk-TF5HCP33.js.map +1 -0
  95. package/dist/{chunk-AKWGE6JQ.js → chunk-UUGOUOVT.js} +37 -2
  96. package/dist/chunk-UUGOUOVT.js.map +1 -0
  97. package/dist/{chunk-7ZRL2LBQ.js → chunk-V2LQLN5H.js} +6 -6
  98. package/dist/{chunk-K72RURN3.js → chunk-VJUVFZ2D.js} +2 -2
  99. package/dist/{chunk-77TCKDEC.js → chunk-VOZA6O7K.js} +663 -477
  100. package/dist/chunk-VOZA6O7K.js.map +1 -0
  101. package/dist/{chunk-D65GNPS3.js → chunk-VUGQTZ2L.js} +208 -84
  102. package/dist/chunk-VUGQTZ2L.js.map +1 -0
  103. package/dist/chunk-WOM257PW.js +393 -0
  104. package/dist/chunk-WOM257PW.js.map +1 -0
  105. package/dist/chunk-WYXUQGOL.js +191 -0
  106. package/dist/chunk-WYXUQGOL.js.map +1 -0
  107. package/dist/chunk-X5ZBP3IY.js +97 -0
  108. package/dist/chunk-X5ZBP3IY.js.map +1 -0
  109. package/dist/{chunk-5C32RLTA.js → chunk-YUY4SAGM.js} +17 -2
  110. package/dist/chunk-YUY4SAGM.js.map +1 -0
  111. package/dist/{cli-D5OE3URZ.js → cli-FB4LOA5A.js} +144 -63
  112. package/dist/{cli-D5OE3URZ.js.map → cli-FB4LOA5A.js.map} +1 -1
  113. package/dist/{codex-event-PPNVRRDH.js → codex-event-TYVES3UX.js} +2 -2
  114. package/dist/{codex-host-2RJOJW2B.js → codex-host-WW4H2SKT.js} +7 -6
  115. package/dist/codex-install-2C623HPW.js +393 -0
  116. package/dist/codex-install-2C623HPW.js.map +1 -0
  117. package/dist/{config-ZD4OB2DO.js → config-HOVJFEKD.js} +21 -17
  118. package/dist/doctor-NKU4V5OV.js +1312 -0
  119. package/dist/doctor-NKU4V5OV.js.map +1 -0
  120. package/dist/{env-proxy-XL4P73MZ.js → env-proxy-R6ZMLQTT.js} +6 -2
  121. package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js → ethersCompat-Df4a6QIZ-X6YZWAML.js} +3 -3
  122. package/dist/{fund-5ITKQGYF.js → fund-WEBHTZGN.js} +37 -36
  123. package/dist/{fund-5ITKQGYF.js.map → fund-WEBHTZGN.js.map} +1 -1
  124. package/dist/hook-command-ZA2PNKS6.js +44 -0
  125. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  126. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  127. package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +82 -0
  128. package/dist/hosts/codex/tenjin/.mcp.json +3 -0
  129. package/dist/hosts/codex/tenjin/hooks/hooks.json +51 -5
  130. package/dist/hosts-AV5MHBAU.js +38 -0
  131. package/dist/index.js +28 -8
  132. package/dist/index.js.map +1 -1
  133. package/dist/{install-XWGE4Q7L.js → install-PT4EZS4R.js} +53 -30
  134. package/dist/{install-identity-K7EJIQFP.js → install-identity-5A4OE6YC.js} +11 -10
  135. package/dist/install-wallet-SAAPKB73.js +281 -0
  136. package/dist/install-wallet-SAAPKB73.js.map +1 -0
  137. package/dist/{mcp-3LIJSSJB.js → mcp-HAWKCTPQ.js} +785 -210
  138. package/dist/mcp-HAWKCTPQ.js.map +1 -0
  139. package/dist/{mine.wasm-6PIT3DK6.js → mine.wasm-QFAHIFPY.js} +2 -2
  140. package/dist/{mine.wasm-6PIT3DK6.js.map → mine.wasm-QFAHIFPY.js.map} +1 -1
  141. package/dist/{package-ZKQFDWLE.js → package-SR2WB6MK.js} +4 -2
  142. package/dist/passphrase-IFTDS3CU.js +44 -0
  143. package/dist/{paths-POPTXJO6.js → paths-XCSAKISU.js} +10 -2
  144. package/dist/{pay-WHBERZ3W.js → pay-OXC3WKYV.js} +29 -29
  145. package/dist/{payments-KVICEKD2.js → payments-3KHMP2MG.js} +15 -14
  146. package/dist/{payments-KVICEKD2.js.map → payments-3KHMP2MG.js.map} +1 -1
  147. package/dist/plugin-registration-N3GRIZVM.js +67 -0
  148. package/dist/{redact-6W23GGJC.js → redact-D7ASVWKL.js} +2 -2
  149. package/dist/runtime-UVNUA3AS.js +1203 -0
  150. package/dist/runtime-UVNUA3AS.js.map +1 -0
  151. package/dist/runtime-fetch-EKFRNR6Z.js +20 -0
  152. package/dist/runtime-layout-BDWZG2TQ.js +25 -0
  153. package/dist/{send-7G7Y7DLN.js → send-HMKJLT34.js} +24 -22
  154. package/dist/{send-7G7Y7DLN.js.map → send-HMKJLT34.js.map} +1 -1
  155. package/dist/{status-OF7RH5HM.js → status-RWXIIWYS.js} +55 -25
  156. package/dist/status-RWXIIWYS.js.map +1 -0
  157. package/dist/{status-line-XOUE6MPL.js → status-line-77XYZP7E.js} +10 -9
  158. package/dist/{status-line-XOUE6MPL.js.map → status-line-77XYZP7E.js.map} +1 -1
  159. package/dist/uninstall-D5G67UJH.js +480 -0
  160. package/dist/uninstall-D5G67UJH.js.map +1 -0
  161. package/dist/update-LRNOEGSB.js +53 -0
  162. package/dist/update-LRNOEGSB.js.map +1 -0
  163. package/dist/{usdc-OGOGEHV2.js → usdc-D6X7EIQ2.js} +6 -8
  164. package/dist/usdc-D6X7EIQ2.js.map +1 -0
  165. package/dist/{viemAdapter-By13KInL-S3DA7DFW.js → viemAdapter-By13KInL-RL742ETX.js} +3 -3
  166. package/dist/viemAdapter-By13KInL-RL742ETX.js.map +1 -0
  167. package/dist/wallet-XFYC27BR.js +55 -0
  168. package/dist/wallet-XFYC27BR.js.map +1 -0
  169. package/dist/wallet-kdf-worker.mjs +8 -8
  170. package/docs/agent-permissions.md +40 -22
  171. package/docs/safety-model.md +1 -1
  172. package/docs/troubleshooting.md +72 -1
  173. package/package.json +14 -1
  174. package/dist/ccip-NLCSCHKI.js +0 -19
  175. package/dist/chunk-2XLC3AEX.js.map +0 -1
  176. package/dist/chunk-4ZZO6ULA.js.map +0 -1
  177. package/dist/chunk-5C32RLTA.js.map +0 -1
  178. package/dist/chunk-5IEP5EGE.js +0 -5332
  179. package/dist/chunk-5IEP5EGE.js.map +0 -1
  180. package/dist/chunk-5MARFNSB.js.map +0 -1
  181. package/dist/chunk-77TCKDEC.js.map +0 -1
  182. package/dist/chunk-7EKYXMUO.js +0 -7536
  183. package/dist/chunk-7EKYXMUO.js.map +0 -1
  184. package/dist/chunk-7QKHZQKW.js.map +0 -1
  185. package/dist/chunk-AGZ7PJKY.js.map +0 -1
  186. package/dist/chunk-AKWGE6JQ.js.map +0 -1
  187. package/dist/chunk-BL3332HQ.js +0 -7611
  188. package/dist/chunk-BL3332HQ.js.map +0 -1
  189. package/dist/chunk-D65GNPS3.js.map +0 -1
  190. package/dist/chunk-EGELTSPU.js +0 -2865
  191. package/dist/chunk-EGELTSPU.js.map +0 -1
  192. package/dist/chunk-GA7JETVM.js +0 -150
  193. package/dist/chunk-GA7JETVM.js.map +0 -1
  194. package/dist/chunk-I3EQFHCD.js +0 -175
  195. package/dist/chunk-I3EQFHCD.js.map +0 -1
  196. package/dist/chunk-K3I7C2MO.js +0 -1185
  197. package/dist/chunk-K3I7C2MO.js.map +0 -1
  198. package/dist/chunk-KXVP2VKA.js.map +0 -1
  199. package/dist/chunk-LEFIX6RS.js.map +0 -1
  200. package/dist/chunk-MNXS2U45.js.map +0 -1
  201. package/dist/chunk-NEFNKLBE.js.map +0 -1
  202. package/dist/chunk-OHRR5OYM.js.map +0 -1
  203. package/dist/chunk-QSCPK4F5.js.map +0 -1
  204. package/dist/chunk-SJLTEINJ.js.map +0 -1
  205. package/dist/chunk-TTNESUPQ.js.map +0 -1
  206. package/dist/chunk-UKY4CHNC.js.map +0 -1
  207. package/dist/chunk-V6BSF6OC.js +0 -260
  208. package/dist/chunk-V6BSF6OC.js.map +0 -1
  209. package/dist/chunk-YVFXE7RR.js.map +0 -1
  210. package/dist/codex-install-UUZ6QMBQ.js +0 -221
  211. package/dist/codex-install-UUZ6QMBQ.js.map +0 -1
  212. package/dist/doctor-KBR34Q4B.js +0 -601
  213. package/dist/doctor-KBR34Q4B.js.map +0 -1
  214. package/dist/hook-command-4TYCHHRL.js +0 -39
  215. package/dist/hosts-FWZOV26H.js.map +0 -1
  216. package/dist/install-wallet-XQ6XFZV4.js +0 -117
  217. package/dist/install-wallet-XQ6XFZV4.js.map +0 -1
  218. package/dist/mcp-3LIJSSJB.js.map +0 -1
  219. package/dist/plugin-registration-5TIA564H.js +0 -54
  220. package/dist/status-OF7RH5HM.js.map +0 -1
  221. package/dist/uninstall-JXUAFNDB.js +0 -158
  222. package/dist/uninstall-JXUAFNDB.js.map +0 -1
  223. package/dist/update-ZKUERSO2.js +0 -44
  224. package/dist/wallet-2HA6W4R4.js +0 -43
  225. /package/dist/{_esm-MEXZI5DL.js.map → _esm-RLLC72MS.js.map} +0 -0
  226. /package/dist/{alive-J64H46HI.js.map → alive-MROUMFH3.js.map} +0 -0
  227. /package/dist/{ccip-7RMRLAGV.js.map → auto-update-OPWMRZLS.js.map} +0 -0
  228. /package/dist/{ccip-NLCSCHKI.js.map → ccip-DHDFKTQV.js.map} +0 -0
  229. /package/dist/{chunk-7Q5FDF65.js.map → chunk-445VQTVM.js.map} +0 -0
  230. /package/dist/{chunk-KXQ4UIP7.js.map → chunk-4USCZ2NI.js.map} +0 -0
  231. /package/dist/{chunk-FW75G2W4.js.map → chunk-CISYM4EO.js.map} +0 -0
  232. /package/dist/{chunk-B7HUUJOK.js.map → chunk-D3ZURCG7.js.map} +0 -0
  233. /package/dist/{chunk-UQUOVWBG.js.map → chunk-DRDUIZIA.js.map} +0 -0
  234. /package/dist/{chunk-27EPWVOY.js.map → chunk-DW4YTVR3.js.map} +0 -0
  235. /package/dist/{chunk-ORWL5BSN.js.map → chunk-HGZEPQUT.js.map} +0 -0
  236. /package/dist/{chunk-P4NH7OUK.js.map → chunk-IDTRSAHE.js.map} +0 -0
  237. /package/dist/{chunk-YFPY4ONH.js.map → chunk-JEVQ5LKO.js.map} +0 -0
  238. /package/dist/{chunk-5K5W4S66.js.map → chunk-QF3LSMGS.js.map} +0 -0
  239. /package/dist/{chunk-WK7F3B2E.js.map → chunk-SO3XRZPX.js.map} +0 -0
  240. /package/dist/{chunk-7ZRL2LBQ.js.map → chunk-V2LQLN5H.js.map} +0 -0
  241. /package/dist/{chunk-K72RURN3.js.map → chunk-VJUVFZ2D.js.map} +0 -0
  242. /package/dist/{codex-event-PPNVRRDH.js.map → codex-event-TYVES3UX.js.map} +0 -0
  243. /package/dist/{codex-host-2RJOJW2B.js.map → codex-host-WW4H2SKT.js.map} +0 -0
  244. /package/dist/{config-ZD4OB2DO.js.map → config-HOVJFEKD.js.map} +0 -0
  245. /package/dist/{env-proxy-XL4P73MZ.js.map → env-proxy-R6ZMLQTT.js.map} +0 -0
  246. /package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js.map → ethersCompat-Df4a6QIZ-X6YZWAML.js.map} +0 -0
  247. /package/dist/{hook-command-4TYCHHRL.js.map → hook-command-ZA2PNKS6.js.map} +0 -0
  248. /package/dist/{install-XWGE4Q7L.js.map → hosts-AV5MHBAU.js.map} +0 -0
  249. /package/dist/{install-identity-K7EJIQFP.js.map → install-PT4EZS4R.js.map} +0 -0
  250. /package/dist/{package-ZKQFDWLE.js.map → install-identity-5A4OE6YC.js.map} +0 -0
  251. /package/dist/{paths-POPTXJO6.js.map → package-SR2WB6MK.js.map} +0 -0
  252. /package/dist/{pay-WHBERZ3W.js.map → passphrase-IFTDS3CU.js.map} +0 -0
  253. /package/dist/{plugin-registration-5TIA564H.js.map → paths-XCSAKISU.js.map} +0 -0
  254. /package/dist/{redact-6W23GGJC.js.map → pay-OXC3WKYV.js.map} +0 -0
  255. /package/dist/{update-ZKUERSO2.js.map → plugin-registration-N3GRIZVM.js.map} +0 -0
  256. /package/dist/{usdc-OGOGEHV2.js.map → redact-D7ASVWKL.js.map} +0 -0
  257. /package/dist/{viemAdapter-By13KInL-S3DA7DFW.js.map → runtime-fetch-EKFRNR6Z.js.map} +0 -0
  258. /package/dist/{wallet-2HA6W4R4.js.map → runtime-layout-BDWZG2TQ.js.map} +0 -0
@@ -1,4 +1,18 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ MAX_MEDIA_BYTES,
4
+ MAX_MEDIA_FILES,
5
+ appendPaidRecord,
6
+ createUniqueFile,
7
+ maskDeep,
8
+ mediaUrlsIn,
9
+ pinnedLookup,
10
+ reconcilePayments,
11
+ recordedSent,
12
+ saveMedia,
13
+ updatePaidRecord,
14
+ writeAll
15
+ } from "./chunk-CISYM4EO.js";
2
16
  import {
3
17
  BatchSettlementEvmScheme,
4
18
  admitPlan,
@@ -21,7 +35,13 @@ import {
21
35
  toClientEvmSigner,
22
36
  validateResultBody,
23
37
  x402Client
24
- } from "./chunk-D65GNPS3.js";
38
+ } from "./chunk-VUGQTZ2L.js";
39
+ import {
40
+ x402HTTPClient
41
+ } from "./chunk-JNJWBTU2.js";
42
+ import "./chunk-HREHWL32.js";
43
+ import "./chunk-6CMM6YCB.js";
44
+ import "./chunk-RL5UUDT4.js";
25
45
  import "./chunk-LHHMV4GU.js";
26
46
  import {
27
47
  DEPOSIT_GATE_TIMEOUT_MS,
@@ -35,64 +55,41 @@ import {
35
55
  storeChoices,
36
56
  storeFullResult,
37
57
  storeSpecs
38
- } from "./chunk-MNXS2U45.js";
39
- import "./chunk-OHRR5OYM.js";
40
- import {
41
- MAX_MEDIA_BYTES,
42
- MAX_MEDIA_FILES,
43
- appendPaidRecord,
44
- createUniqueFile,
45
- maskDeep,
46
- mediaUrlsIn,
47
- pinnedLookup,
48
- reconcilePayments,
49
- recordedSent,
50
- saveMedia,
51
- updatePaidRecord,
52
- writeAll
53
- } from "./chunk-FW75G2W4.js";
58
+ } from "./chunk-JRZBBPO6.js";
54
59
  import {
55
60
  assertPublicHttpsUrl,
56
61
  resolvePublicDestination
57
62
  } from "./chunk-JKKAIPTU.js";
63
+ import "./chunk-SFASB5FL.js";
64
+ import "./chunk-GAKUQHKA.js";
58
65
  import {
59
66
  clearRouterMemo,
60
67
  readRouterMemo,
61
68
  writeRouterMemo
62
- } from "./chunk-KXQ4UIP7.js";
69
+ } from "./chunk-4USCZ2NI.js";
63
70
  import {
64
- x402HTTPClient
65
- } from "./chunk-7EKYXMUO.js";
66
- import "./chunk-6E5R45ZO.js";
67
- import "./chunk-POUWHWID.js";
68
- import "./chunk-XZKD7DIF.js";
71
+ isDefiniteBlock
72
+ } from "./chunk-62KNUYWD.js";
73
+ import {
74
+ pruneDeadObservations,
75
+ readUnlockRecord,
76
+ removeObservationSync,
77
+ writeObservation,
78
+ writeUnlockRecord
79
+ } from "./chunk-WYXUQGOL.js";
69
80
  import {
70
81
  FileClientChannelStorage
71
- } from "./chunk-5K5W4S66.js";
72
- import "./chunk-7Q5FDF65.js";
73
- import "./chunk-BL3332HQ.js";
82
+ } from "./chunk-QF3LSMGS.js";
83
+ import "./chunk-445VQTVM.js";
74
84
  import {
75
85
  resolveSpendAuthorizer,
76
86
  resolveWalletProvider
77
- } from "./chunk-2XLC3AEX.js";
87
+ } from "./chunk-BI673VEJ.js";
78
88
  import {
79
89
  createLocalSpendAuthorizer,
80
90
  releaseUnchargedExposure
81
- } from "./chunk-7ZRL2LBQ.js";
82
- import "./chunk-WK7F3B2E.js";
83
- import "./chunk-R5LCN54M.js";
84
- import {
85
- createPublicClient,
86
- http
87
- } from "./chunk-NEFNKLBE.js";
88
- import "./chunk-K3I7C2MO.js";
89
- import "./chunk-5IEP5EGE.js";
90
- import "./chunk-EGELTSPU.js";
91
- import "./chunk-JRGFKVAZ.js";
92
- import "./chunk-TTNESUPQ.js";
93
- import "./chunk-KG3D7FIF.js";
94
- import "./chunk-RBJPAZFI.js";
95
- import "./chunk-BPMWXTFX.js";
91
+ } from "./chunk-V2LQLN5H.js";
92
+ import "./chunk-SO3XRZPX.js";
96
93
  import {
97
94
  ALL_CHOICES,
98
95
  CHANNEL_BUSY,
@@ -108,19 +105,10 @@ import {
108
105
  requestBrowse,
109
106
  requestDecision,
110
107
  requestToolSpec
111
- } from "./chunk-UKY4CHNC.js";
108
+ } from "./chunk-PKHI276N.js";
112
109
  import "./chunk-3623BLPV.js";
113
- import {
114
- HOOK_KINDS,
115
- HOOK_TOOL,
116
- HOOK_TOOL_FIELDS,
117
- eventFromToolInput
118
- } from "./chunk-AKWGE6JQ.js";
119
- import {
120
- MCP_SERVER_NAME,
121
- launchedByPlugin
122
- } from "./chunk-WJXLQXJY.js";
123
110
  import "./chunk-XKESD27X.js";
111
+ import "./chunk-VJUVFZ2D.js";
124
112
  import {
125
113
  CHANNEL_DEPOSIT_ATOMIC,
126
114
  FEE_REQUIRED,
@@ -133,40 +121,89 @@ import {
133
121
  payerDir,
134
122
  refusedWhy,
135
123
  unpaidSentence
136
- } from "./chunk-4ZZO6ULA.js";
124
+ } from "./chunk-HDPUXS3Z.js";
125
+ import "./chunk-2SNUOHAT.js";
126
+ import {
127
+ codexHome
128
+ } from "./chunk-F3ED5WTR.js";
137
129
  import {
138
130
  withFileLock
139
131
  } from "./chunk-MEFB5KHA.js";
140
- import "./chunk-2SNUOHAT.js";
141
- import "./chunk-K72RURN3.js";
132
+ import {
133
+ CODEX_HOOK_KINDS,
134
+ CODEX_HOOK_TOOL_FIELDS,
135
+ HOOK_KINDS,
136
+ HOOK_TOOL,
137
+ HOOK_TOOL_FIELDS,
138
+ codexEventFromToolInput,
139
+ eventFromToolInput
140
+ } from "./chunk-UUGOUOVT.js";
141
+ import {
142
+ MCP_SERVER_NAME,
143
+ launchedByPlugin
144
+ } from "./chunk-MPZUYCAP.js";
145
+ import "./chunk-3FMZGI7I.js";
146
+ import {
147
+ composeUserAgent,
148
+ httpRequest,
149
+ isBinaryContentType,
150
+ requestHeaderProblem
151
+ } from "./chunk-OTWLERSW.js";
152
+ import "./chunk-CEXSOI5R.js";
153
+ import {
154
+ createPublicClient,
155
+ http
156
+ } from "./chunk-PJNENX2A.js";
157
+ import "./chunk-JRGFKVAZ.js";
158
+ import "./chunk-2GP3HRYK.js";
159
+ import "./chunk-KG3D7FIF.js";
160
+ import "./chunk-RBJPAZFI.js";
161
+ import "./chunk-BPMWXTFX.js";
162
+ import {
163
+ package_default
164
+ } from "./chunk-YUY4SAGM.js";
142
165
  import {
143
166
  mask
144
- } from "./chunk-7QKHZQKW.js";
167
+ } from "./chunk-IADZOXKN.js";
145
168
  import {
146
169
  SILENT_FOOTER,
147
170
  openLookupFooter
148
- } from "./chunk-P4NH7OUK.js";
171
+ } from "./chunk-IDTRSAHE.js";
149
172
  import {
150
173
  routerSettings
151
- } from "./chunk-YFPY4ONH.js";
152
- import {
153
- markSessionServed,
154
- sessionServedByPlugin
155
- } from "./chunk-I3EQFHCD.js";
156
- import "./chunk-S4SAZ7OD.js";
157
- import {
158
- composeUserAgent,
159
- httpRequest,
160
- isBinaryContentType
161
- } from "./chunk-AGZ7PJKY.js";
162
- import "./chunk-2I4QTOLB.js";
174
+ } from "./chunk-JEVQ5LKO.js";
163
175
  import {
164
176
  resolveContextSettings
165
- } from "./chunk-7WU4OPLP.js";
177
+ } from "./chunk-AV5NZMYO.js";
166
178
  import {
167
179
  parseUsdToAtomic,
168
180
  toMoney
169
181
  } from "./chunk-Y527D4TV.js";
182
+ import {
183
+ markSessionServed,
184
+ readWalletFacts,
185
+ sessionServedByPlugin,
186
+ unlockStamp
187
+ } from "./chunk-WOM257PW.js";
188
+ import {
189
+ UNKNOWN_DETAIL,
190
+ WALLET_REASONS,
191
+ WALLET_UNLOCKED,
192
+ agentFixOf,
193
+ stillLockedSentence
194
+ } from "./chunk-BFDQ4WNW.js";
195
+ import "./chunk-3AIHRXKO.js";
196
+ import {
197
+ DEFINITE_UNLOCK,
198
+ classifyUnlockError
199
+ } from "./chunk-X5ZBP3IY.js";
200
+ import "./chunk-2I4QTOLB.js";
201
+ import "./chunk-2GNOFONN.js";
202
+ import {
203
+ readUsdcBalance,
204
+ readUsdcBalanceWithFallback
205
+ } from "./chunk-DW4YTVR3.js";
206
+ import "./chunk-XQJXNMSB.js";
170
207
  import {
171
208
  $ZodObject,
172
209
  $ZodType,
@@ -178,9 +215,9 @@ import {
178
215
  boolean,
179
216
  clone,
180
217
  custom,
181
- defineLazy,
182
218
  discriminatedUnion,
183
219
  external_exports,
220
+ installLazyProp,
184
221
  intersection,
185
222
  iso_exports,
186
223
  literal,
@@ -189,6 +226,7 @@ import {
189
226
  number,
190
227
  object,
191
228
  optional,
229
+ own,
192
230
  parse,
193
231
  parseAsync,
194
232
  preprocess,
@@ -199,31 +237,23 @@ import {
199
237
  toJSONSchema,
200
238
  union,
201
239
  unknown
202
- } from "./chunk-YVFXE7RR.js";
203
- import "./chunk-XQJXNMSB.js";
204
- import {
205
- CliError
206
- } from "./chunk-3UCIG4TG.js";
207
- import {
208
- readUsdcBalance,
209
- readUsdcBalanceWithFallback
210
- } from "./chunk-27EPWVOY.js";
240
+ } from "./chunk-SNNSAGMT.js";
211
241
  import {
212
242
  writeFileAtomic
213
243
  } from "./chunk-7WEQQJLG.js";
244
+ import {
245
+ CliError
246
+ } from "./chunk-3UCIG4TG.js";
214
247
  import {
215
248
  dataDir,
216
249
  downloadsDir,
217
250
  jobsDir
218
- } from "./chunk-SJLTEINJ.js";
219
- import {
220
- package_default
221
- } from "./chunk-5C32RLTA.js";
251
+ } from "./chunk-OJNTCYQQ.js";
222
252
  import {
223
253
  __toESM
224
254
  } from "./chunk-ZXTAQYNA.js";
225
255
 
226
- // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/util.js
256
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/helpers/util.js
227
257
  var util;
228
258
  (function(util2) {
229
259
  util2.assertEqual = (_) => {
@@ -357,7 +387,7 @@ var getParsedType = (data) => {
357
387
  }
358
388
  };
359
389
 
360
- // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/ZodError.js
390
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/ZodError.js
361
391
  var ZodIssueCode = util.arrayToEnum([
362
392
  "invalid_type",
363
393
  "invalid_literal",
@@ -419,13 +449,28 @@ var ZodError = class _ZodError extends Error {
419
449
  while (i < issue.path.length) {
420
450
  const el = issue.path[i];
421
451
  const terminal = i === issue.path.length - 1;
422
- if (!terminal) {
423
- curr[el] = curr[el] || { _errors: [] };
424
- } else {
425
- curr[el] = curr[el] || { _errors: [] };
426
- curr[el]._errors.push(mapper(issue));
452
+ if (el === "_errors") {
453
+ if (terminal)
454
+ curr._errors.push(mapper(issue));
455
+ i++;
456
+ continue;
457
+ }
458
+ if (!Object.prototype.hasOwnProperty.call(curr, el)) {
459
+ if (el === "__proto__") {
460
+ Object.defineProperty(curr, el, {
461
+ value: { _errors: [] },
462
+ writable: true,
463
+ enumerable: true,
464
+ configurable: true
465
+ });
466
+ } else {
467
+ curr[el] = { _errors: [] };
468
+ }
427
469
  }
428
470
  curr = curr[el];
471
+ if (terminal) {
472
+ curr._errors.push(mapper(issue));
473
+ }
429
474
  i++;
430
475
  }
431
476
  }
@@ -471,7 +516,7 @@ ZodError.create = (issues) => {
471
516
  return error;
472
517
  };
473
518
 
474
- // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/locales/en.js
519
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/locales/en.js
475
520
  var errorMap = (issue, _ctx) => {
476
521
  let message;
477
522
  switch (issue.code) {
@@ -574,13 +619,13 @@ var errorMap = (issue, _ctx) => {
574
619
  };
575
620
  var en_default = errorMap;
576
621
 
577
- // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/errors.js
622
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/errors.js
578
623
  var overrideErrorMap = en_default;
579
624
  function getErrorMap() {
580
625
  return overrideErrorMap;
581
626
  }
582
627
 
583
- // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/parseUtil.js
628
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/helpers/parseUtil.js
584
629
  var makeIssue = (params) => {
585
630
  const { data, path, errorMaps, issueData } = params;
586
631
  const fullPath = [...path, ...issueData.path || []];
@@ -689,14 +734,14 @@ var isDirty = (x) => x.status === "dirty";
689
734
  var isValid = (x) => x.status === "valid";
690
735
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
691
736
 
692
- // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/errorUtil.js
737
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/helpers/errorUtil.js
693
738
  var errorUtil;
694
739
  (function(errorUtil2) {
695
740
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
696
741
  errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
697
742
  })(errorUtil || (errorUtil = {}));
698
743
 
699
- // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/types.js
744
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/types.js
700
745
  var ParseInputLazyPath = class {
701
746
  constructor(parent, value, path, key) {
702
747
  this._cachedPath = [];
@@ -1049,7 +1094,7 @@ var nanoidRegex = /^[a-z0-9_-]{21}$/i;
1049
1094
  var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
1050
1095
  var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
1051
1096
  var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1052
- var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1097
+ var _emojiRegex = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
1053
1098
  var emojiRegex;
1054
1099
  var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
1055
1100
  var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
@@ -3016,7 +3061,11 @@ function mergeValues(a, b) {
3016
3061
  const bKeys = util.objectKeys(b);
3017
3062
  const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
3018
3063
  const newObj = { ...a, ...b };
3064
+ if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
3065
+ delete newObj.__proto__;
3019
3066
  for (const key of sharedKeys) {
3067
+ if (key === "__proto__")
3068
+ continue;
3020
3069
  const sharedValue = mergeValues(a[key], b[key]);
3021
3070
  if (!sharedValue.valid) {
3022
3071
  return { valid: false };
@@ -4099,41 +4148,61 @@ var nullableType = ZodNullable.create;
4099
4148
  var preprocessType = ZodEffects.createWithPreprocess;
4100
4149
  var pipelineType = ZodPipeline.create;
4101
4150
 
4102
- // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js
4151
+ // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/mini/schemas.js
4103
4152
  var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
4104
4153
  if (!inst._zod)
4105
4154
  throw new Error("Uninitialized schema in ZodMiniType.");
4106
4155
  $ZodType.init(inst, def);
4107
4156
  inst.def = def;
4108
4157
  inst.type = def.type;
4109
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
4110
- inst.safeParse = (data, params) => safeParse(inst, data, params);
4111
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
4112
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
4113
- inst.check = (...checks) => {
4114
- return inst.clone({
4158
+ }, {
4159
+ // `with` is an alias for `check`: the same function object, not a wrapper.
4160
+ get with() {
4161
+ return this.check;
4162
+ },
4163
+ set with(value) {
4164
+ own(this, "with", value);
4165
+ },
4166
+ parse(data, params) {
4167
+ return parse(this, data, params, { callee: this.parse });
4168
+ },
4169
+ parseAsync(data, params) {
4170
+ return parseAsync(this, data, params, { callee: this.parseAsync });
4171
+ },
4172
+ safeParse(data, params) {
4173
+ return safeParse(this, data, params);
4174
+ },
4175
+ safeParseAsync(data, params) {
4176
+ return safeParseAsync(this, data, params);
4177
+ },
4178
+ check(...checks) {
4179
+ const def = this.def;
4180
+ return this.clone({
4115
4181
  ...def,
4116
4182
  checks: [
4117
4183
  ...def.checks ?? [],
4118
- ...checks.map((ch) => typeof ch === "function" ? {
4119
- _zod: { check: ch, def: { check: "custom" }, onattach: [] }
4120
- } : ch)
4184
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
4121
4185
  ]
4122
4186
  }, { parent: true });
4123
- };
4124
- inst.with = inst.check;
4125
- inst.clone = (_def, params) => clone(inst, _def, params);
4126
- inst.brand = () => inst;
4127
- inst.register = ((reg, meta2) => {
4128
- reg.add(inst, meta2);
4129
- return inst;
4130
- });
4131
- inst.apply = (fn) => fn(inst);
4187
+ },
4188
+ clone(_def, params) {
4189
+ return clone(this, _def, params);
4190
+ },
4191
+ brand() {
4192
+ return this;
4193
+ },
4194
+ register(reg, meta2) {
4195
+ reg.add(this, meta2);
4196
+ return this;
4197
+ },
4198
+ apply(fn, ...args) {
4199
+ return args.length === 0 ? fn(this) : fn(this, ...args);
4200
+ }
4132
4201
  });
4133
4202
  var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
4134
4203
  $ZodObject.init(inst, def);
4135
4204
  ZodMiniType.init(inst, def);
4136
- defineLazy(inst, "shape", () => def.shape);
4205
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
4137
4206
  });
4138
4207
  // @__NO_SIDE_EFFECTS__
4139
4208
  function object2(shape, params) {
@@ -4145,7 +4214,7 @@ function object2(shape, params) {
4145
4214
  return new ZodMiniObject(def);
4146
4215
  }
4147
4216
 
4148
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
4217
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
4149
4218
  function isZ4Schema(s) {
4150
4219
  const schema = s;
4151
4220
  return !!schema._zod;
@@ -4305,7 +4374,7 @@ function getLiteralValue(schema) {
4305
4374
  return void 0;
4306
4375
  }
4307
4376
 
4308
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
4377
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
4309
4378
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
4310
4379
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
4311
4380
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -5836,12 +5905,12 @@ var UrlElicitationRequiredError = class extends McpError {
5836
5905
  }
5837
5906
  };
5838
5907
 
5839
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
5908
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
5840
5909
  function isTerminal(status) {
5841
5910
  return status === "completed" || status === "failed" || status === "cancelled";
5842
5911
  }
5843
5912
 
5844
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/Options.js
5913
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/Options.js
5845
5914
  var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
5846
5915
  var defaultOptions = {
5847
5916
  name: void 0,
@@ -5875,7 +5944,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
5875
5944
  ...options
5876
5945
  };
5877
5946
 
5878
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/Refs.js
5947
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/Refs.js
5879
5948
  var getRefs = (options) => {
5880
5949
  const _options = getDefaultOptions(options);
5881
5950
  const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
@@ -5896,7 +5965,7 @@ var getRefs = (options) => {
5896
5965
  };
5897
5966
  };
5898
5967
 
5899
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
5968
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
5900
5969
  function addErrorMessage(res, key, errorMessage, refs) {
5901
5970
  if (!refs?.errorMessages)
5902
5971
  return;
@@ -5912,7 +5981,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
5912
5981
  addErrorMessage(res, key, errorMessage, refs);
5913
5982
  }
5914
5983
 
5915
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
5984
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
5916
5985
  var getRelativePath = (pathA, pathB) => {
5917
5986
  let i = 0;
5918
5987
  for (; i < pathA.length && i < pathB.length; i++) {
@@ -5922,7 +5991,7 @@ var getRelativePath = (pathA, pathB) => {
5922
5991
  return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
5923
5992
  };
5924
5993
 
5925
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
5994
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
5926
5995
  function parseAnyDef(refs) {
5927
5996
  if (refs.target !== "openAi") {
5928
5997
  return {};
@@ -5938,7 +6007,7 @@ function parseAnyDef(refs) {
5938
6007
  };
5939
6008
  }
5940
6009
 
5941
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
6010
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
5942
6011
  function parseArrayDef(def, refs) {
5943
6012
  const res = {
5944
6013
  type: "array"
@@ -5962,7 +6031,7 @@ function parseArrayDef(def, refs) {
5962
6031
  return res;
5963
6032
  }
5964
6033
 
5965
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
6034
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
5966
6035
  function parseBigintDef(def, refs) {
5967
6036
  const res = {
5968
6037
  type: "integer",
@@ -6008,24 +6077,24 @@ function parseBigintDef(def, refs) {
6008
6077
  return res;
6009
6078
  }
6010
6079
 
6011
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
6080
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
6012
6081
  function parseBooleanDef() {
6013
6082
  return {
6014
6083
  type: "boolean"
6015
6084
  };
6016
6085
  }
6017
6086
 
6018
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
6087
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
6019
6088
  function parseBrandedDef(_def, refs) {
6020
6089
  return parseDef(_def.type._def, refs);
6021
6090
  }
6022
6091
 
6023
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
6092
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
6024
6093
  var parseCatchDef = (def, refs) => {
6025
6094
  return parseDef(def.innerType._def, refs);
6026
6095
  };
6027
6096
 
6028
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
6097
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
6029
6098
  function parseDateDef(def, refs, overrideDateStrategy) {
6030
6099
  const strategy = overrideDateStrategy ?? refs.dateStrategy;
6031
6100
  if (Array.isArray(strategy)) {
@@ -6084,7 +6153,7 @@ var integerDateParser = (def, refs) => {
6084
6153
  return res;
6085
6154
  };
6086
6155
 
6087
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
6156
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
6088
6157
  function parseDefaultDef(_def, refs) {
6089
6158
  return {
6090
6159
  ...parseDef(_def.innerType._def, refs),
@@ -6092,12 +6161,12 @@ function parseDefaultDef(_def, refs) {
6092
6161
  };
6093
6162
  }
6094
6163
 
6095
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
6164
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
6096
6165
  function parseEffectsDef(_def, refs) {
6097
6166
  return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
6098
6167
  }
6099
6168
 
6100
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
6169
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
6101
6170
  function parseEnumDef(def) {
6102
6171
  return {
6103
6172
  type: "string",
@@ -6105,7 +6174,7 @@ function parseEnumDef(def) {
6105
6174
  };
6106
6175
  }
6107
6176
 
6108
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
6177
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
6109
6178
  var isJsonSchema7AllOfType = (type) => {
6110
6179
  if ("type" in type && type.type === "string")
6111
6180
  return false;
@@ -6147,7 +6216,7 @@ function parseIntersectionDef(def, refs) {
6147
6216
  } : void 0;
6148
6217
  }
6149
6218
 
6150
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
6219
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
6151
6220
  function parseLiteralDef(def, refs) {
6152
6221
  const parsedType = typeof def.value;
6153
6222
  if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
@@ -6167,7 +6236,7 @@ function parseLiteralDef(def, refs) {
6167
6236
  };
6168
6237
  }
6169
6238
 
6170
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
6239
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
6171
6240
  var emojiRegex2 = void 0;
6172
6241
  var zodPatterns = {
6173
6242
  /**
@@ -6492,7 +6561,7 @@ function stringifyRegExpWithFlags(regex, refs) {
6492
6561
  return pattern;
6493
6562
  }
6494
6563
 
6495
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
6564
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
6496
6565
  function parseRecordDef(def, refs) {
6497
6566
  if (refs.target === "openAi") {
6498
6567
  console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
@@ -6544,7 +6613,7 @@ function parseRecordDef(def, refs) {
6544
6613
  return schema;
6545
6614
  }
6546
6615
 
6547
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
6616
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
6548
6617
  function parseMapDef(def, refs) {
6549
6618
  if (refs.mapStrategy === "record") {
6550
6619
  return parseRecordDef(def, refs);
@@ -6569,7 +6638,7 @@ function parseMapDef(def, refs) {
6569
6638
  };
6570
6639
  }
6571
6640
 
6572
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
6641
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
6573
6642
  function parseNativeEnumDef(def) {
6574
6643
  const object3 = def.values;
6575
6644
  const actualKeys = Object.keys(def.values).filter((key) => {
@@ -6583,7 +6652,7 @@ function parseNativeEnumDef(def) {
6583
6652
  };
6584
6653
  }
6585
6654
 
6586
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
6655
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
6587
6656
  function parseNeverDef(refs) {
6588
6657
  return refs.target === "openAi" ? void 0 : {
6589
6658
  not: parseAnyDef({
@@ -6593,7 +6662,7 @@ function parseNeverDef(refs) {
6593
6662
  };
6594
6663
  }
6595
6664
 
6596
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
6665
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
6597
6666
  function parseNullDef(refs) {
6598
6667
  return refs.target === "openApi3" ? {
6599
6668
  enum: ["null"],
@@ -6603,7 +6672,7 @@ function parseNullDef(refs) {
6603
6672
  };
6604
6673
  }
6605
6674
 
6606
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
6675
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
6607
6676
  var primitiveMappings = {
6608
6677
  ZodString: "string",
6609
6678
  ZodNumber: "number",
@@ -6671,7 +6740,7 @@ var asAnyOf = (def, refs) => {
6671
6740
  return anyOf.length ? { anyOf } : void 0;
6672
6741
  };
6673
6742
 
6674
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
6743
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
6675
6744
  function parseNullableDef(def, refs) {
6676
6745
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
6677
6746
  if (refs.target === "openApi3") {
@@ -6703,7 +6772,7 @@ function parseNullableDef(def, refs) {
6703
6772
  return base && { anyOf: [base, { type: "null" }] };
6704
6773
  }
6705
6774
 
6706
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
6775
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
6707
6776
  function parseNumberDef(def, refs) {
6708
6777
  const res = {
6709
6778
  type: "number"
@@ -6752,7 +6821,7 @@ function parseNumberDef(def, refs) {
6752
6821
  return res;
6753
6822
  }
6754
6823
 
6755
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
6824
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
6756
6825
  function parseObjectDef(def, refs) {
6757
6826
  const forceOptionalIntoNullable = refs.target === "openAi";
6758
6827
  const result = {
@@ -6822,7 +6891,7 @@ function safeIsOptional(schema) {
6822
6891
  }
6823
6892
  }
6824
6893
 
6825
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
6894
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
6826
6895
  var parseOptionalDef = (def, refs) => {
6827
6896
  if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
6828
6897
  return parseDef(def.innerType._def, refs);
@@ -6841,7 +6910,7 @@ var parseOptionalDef = (def, refs) => {
6841
6910
  } : parseAnyDef(refs);
6842
6911
  };
6843
6912
 
6844
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
6913
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
6845
6914
  var parsePipelineDef = (def, refs) => {
6846
6915
  if (refs.pipeStrategy === "input") {
6847
6916
  return parseDef(def.in._def, refs);
@@ -6861,12 +6930,12 @@ var parsePipelineDef = (def, refs) => {
6861
6930
  };
6862
6931
  };
6863
6932
 
6864
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
6933
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
6865
6934
  function parsePromiseDef(def, refs) {
6866
6935
  return parseDef(def.type._def, refs);
6867
6936
  }
6868
6937
 
6869
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
6938
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
6870
6939
  function parseSetDef(def, refs) {
6871
6940
  const items = parseDef(def.valueType._def, {
6872
6941
  ...refs,
@@ -6886,7 +6955,7 @@ function parseSetDef(def, refs) {
6886
6955
  return schema;
6887
6956
  }
6888
6957
 
6889
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
6958
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
6890
6959
  function parseTupleDef(def, refs) {
6891
6960
  if (def.rest) {
6892
6961
  return {
@@ -6914,24 +6983,24 @@ function parseTupleDef(def, refs) {
6914
6983
  }
6915
6984
  }
6916
6985
 
6917
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
6986
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
6918
6987
  function parseUndefinedDef(refs) {
6919
6988
  return {
6920
6989
  not: parseAnyDef(refs)
6921
6990
  };
6922
6991
  }
6923
6992
 
6924
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
6993
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
6925
6994
  function parseUnknownDef(refs) {
6926
6995
  return parseAnyDef(refs);
6927
6996
  }
6928
6997
 
6929
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
6998
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
6930
6999
  var parseReadonlyDef = (def, refs) => {
6931
7000
  return parseDef(def.innerType._def, refs);
6932
7001
  };
6933
7002
 
6934
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/selectParser.js
7003
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/selectParser.js
6935
7004
  var selectParser = (def, typeName, refs) => {
6936
7005
  switch (typeName) {
6937
7006
  case ZodFirstPartyTypeKind.ZodString:
@@ -7007,7 +7076,7 @@ var selectParser = (def, typeName, refs) => {
7007
7076
  }
7008
7077
  };
7009
7078
 
7010
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parseDef.js
7079
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/parseDef.js
7011
7080
  function parseDef(def, refs, forceResolution = false) {
7012
7081
  const seenItem = refs.seen.get(def);
7013
7082
  if (refs.override) {
@@ -7063,7 +7132,7 @@ var addMeta = (def, refs, jsonSchema) => {
7063
7132
  return jsonSchema;
7064
7133
  };
7065
7134
 
7066
- // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
7135
+ // node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.6.7/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
7067
7136
  var zodToJsonSchema = (schema, options) => {
7068
7137
  const refs = getRefs(options);
7069
7138
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
@@ -7125,7 +7194,7 @@ var zodToJsonSchema = (schema, options) => {
7125
7194
  return combined;
7126
7195
  };
7127
7196
 
7128
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
7197
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
7129
7198
  function mapMiniTarget(t) {
7130
7199
  if (!t)
7131
7200
  return "draft-7";
@@ -7167,7 +7236,7 @@ function parseWithCompat(schema, data) {
7167
7236
  return result.data;
7168
7237
  }
7169
7238
 
7170
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
7239
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
7171
7240
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
7172
7241
  var Protocol = class {
7173
7242
  constructor(_options) {
@@ -8144,7 +8213,7 @@ function mergeCapabilities(base, additional) {
8144
8213
  return result;
8145
8214
  }
8146
8215
 
8147
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
8216
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
8148
8217
  var import_ajv = __toESM(require_ajv(), 1);
8149
8218
  var import_ajv_formats = __toESM(require_dist(), 1);
8150
8219
  function createDefaultAjvInstance() {
@@ -8212,7 +8281,7 @@ var AjvJsonSchemaValidator = class {
8212
8281
  }
8213
8282
  };
8214
8283
 
8215
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
8284
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
8216
8285
  var ExperimentalServerTasks = class {
8217
8286
  constructor(_server) {
8218
8287
  this._server = _server;
@@ -8425,7 +8494,7 @@ var ExperimentalServerTasks = class {
8425
8494
  }
8426
8495
  };
8427
8496
 
8428
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
8497
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
8429
8498
  function assertToolsCallTaskCapability(requests, method, entityName) {
8430
8499
  if (!requests) {
8431
8500
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -8460,7 +8529,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
8460
8529
  }
8461
8530
  }
8462
8531
 
8463
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
8532
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
8464
8533
  var Server = class extends Protocol {
8465
8534
  /**
8466
8535
  * Initializes this server with the given name and version information.
@@ -8831,7 +8900,7 @@ var Server = class extends Protocol {
8831
8900
  }
8832
8901
  };
8833
8902
 
8834
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
8903
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
8835
8904
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
8836
8905
  function isCompletable(schema) {
8837
8906
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -8845,7 +8914,7 @@ var McpZodTypeKind;
8845
8914
  McpZodTypeKind2["Completable"] = "McpCompletable";
8846
8915
  })(McpZodTypeKind || (McpZodTypeKind = {}));
8847
8916
 
8848
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
8917
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
8849
8918
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
8850
8919
  function validateToolName(name) {
8851
8920
  const warnings = [];
@@ -8903,7 +8972,7 @@ function validateAndWarnToolName(name) {
8903
8972
  return result.isValid;
8904
8973
  }
8905
8974
 
8906
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
8975
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
8907
8976
  var ExperimentalMcpServerTasks = class {
8908
8977
  constructor(_mcpServer) {
8909
8978
  this._mcpServer = _mcpServer;
@@ -8918,7 +8987,7 @@ var ExperimentalMcpServerTasks = class {
8918
8987
  }
8919
8988
  };
8920
8989
 
8921
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
8990
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
8922
8991
  function toolInputElementCount(value, max) {
8923
8992
  let count = 0;
8924
8993
  const stack = [value];
@@ -9750,10 +9819,10 @@ var EMPTY_COMPLETION_RESULT = {
9750
9819
  }
9751
9820
  };
9752
9821
 
9753
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
9822
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
9754
9823
  import process2 from "node:process";
9755
9824
 
9756
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
9825
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
9757
9826
  var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
9758
9827
  var ReadBuffer = class {
9759
9828
  constructor(options) {
@@ -9790,7 +9859,7 @@ function serializeMessage(message) {
9790
9859
  return JSON.stringify(message) + "\n";
9791
9860
  }
9792
9861
 
9793
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
9862
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
9794
9863
  var StdioServerTransport = class {
9795
9864
  constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
9796
9865
  this._stdin = _stdin;
@@ -9893,6 +9962,175 @@ async function admitHookEvent(event, opts = {}) {
9893
9962
  if (!(await stat(real).catch(() => null))?.isFile()) return null;
9894
9963
  return { ...event, transcript_path: real };
9895
9964
  }
9965
+ var ROLLOUT_RE = /^rollout-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-([A-Za-z0-9_-]{1,200})\.jsonl$/;
9966
+ async function admitCodexHookEvent(event, opts = {}) {
9967
+ const sessionId = event["session_id"];
9968
+ if (typeof sessionId !== "string" || !SEGMENT_RE.test(sessionId)) return null;
9969
+ if (opts.threadId !== void 0 && opts.threadId !== sessionId) return null;
9970
+ const raw = event["transcript_path"];
9971
+ if (raw === void 0) return event;
9972
+ if (typeof raw !== "string" || !isAbsolute(raw)) return null;
9973
+ const named = (path) => {
9974
+ const id = ROLLOUT_RE.exec(basename(path))?.[1];
9975
+ return id === sessionId || id?.startsWith(`${sessionId}_`) === true;
9976
+ };
9977
+ const sessions = join(codexHome(opts.homeDir ?? homedir(), opts.env ?? process.env), "sessions");
9978
+ const roots = [sessions, await realpath(sessions).catch(() => sessions)];
9979
+ const under = (path, root) => path.startsWith(`${root}${sep}`);
9980
+ let real;
9981
+ try {
9982
+ real = await realpath(raw);
9983
+ } catch (err) {
9984
+ if (err.code !== "ENOENT") return null;
9985
+ if (!named(raw) || !roots.some((root) => under(resolve(raw), root))) return null;
9986
+ const unread = { ...event };
9987
+ delete unread["transcript_path"];
9988
+ return unread;
9989
+ }
9990
+ if (!named(real) || !under(real, roots[1])) return null;
9991
+ if (!(await stat(real).catch(() => null))?.isFile()) return null;
9992
+ return { ...event, transcript_path: real };
9993
+ }
9994
+
9995
+ // src/router/router-observer.ts
9996
+ function createRouterObserver(o) {
9997
+ const now = o.now ?? Date.now;
9998
+ let observation = {
9999
+ version: 1,
10000
+ pid: o.pid,
10001
+ startedAt: o.startedAt,
10002
+ at: now(),
10003
+ cliVersion: o.cliVersion,
10004
+ harness: o.harness,
10005
+ launchedByPlugin: o.launchedByPlugin,
10006
+ cwd: o.cwd,
10007
+ address: null,
10008
+ servedSession: false,
10009
+ env: {
10010
+ passphraseSet: (o.env.TENJIN_WALLET_PASSPHRASE ?? "").length > 0,
10011
+ keySet: (o.env.TENJIN_WALLET_KEY?.trim() ?? "").length > 0
10012
+ },
10013
+ sign: { status: "pending" }
10014
+ };
10015
+ const queue = [];
10016
+ let settled = false;
10017
+ const claimed = /* @__PURE__ */ new Set();
10018
+ let confirming = false;
10019
+ let disposed = false;
10020
+ let writes = pruneDeadObservations(o.dataDir).catch(() => void 0);
10021
+ const write = () => {
10022
+ const snapshot = observation;
10023
+ writes = writes.then(() => disposed ? void 0 : writeObservation(o.dataDir, snapshot));
10024
+ };
10025
+ write();
10026
+ const onExit = () => removeObservationSync(o.dataDir, o.pid);
10027
+ process.once("exit", onExit);
10028
+ async function verdictRecord() {
10029
+ const sign = observation.sign;
10030
+ if (sign.status === "pending") return null;
10031
+ const facts = await readWalletFacts(o.dataDir, o.env);
10032
+ const address = observation.address ?? facts.address;
10033
+ if (address === null) return null;
10034
+ return {
10035
+ address,
10036
+ record: {
10037
+ version: 1,
10038
+ address,
10039
+ status: sign.status,
10040
+ ...sign.reason !== void 0 ? { reason: sign.reason } : {},
10041
+ at: now(),
10042
+ inputs: {
10043
+ envPassphraseSet: facts.envPassphraseSet,
10044
+ envKeySet: facts.envKey !== "absent",
10045
+ walletMtimeMs: facts.walletMtimeMs,
10046
+ sidecarMtimeMs: facts.sidecarMtimeMs,
10047
+ cliVersion: o.cliVersion
10048
+ }
10049
+ }
10050
+ };
10051
+ }
10052
+ return {
10053
+ observe(u) {
10054
+ const signChanged = u.sign !== void 0;
10055
+ observation = {
10056
+ ...observation,
10057
+ ...u.sign !== void 0 ? { sign: u.sign } : {},
10058
+ ...u.routing !== void 0 ? { routing: u.routing } : {},
10059
+ ...u.address !== void 0 ? { address: u.address } : {},
10060
+ at: now()
10061
+ };
10062
+ write();
10063
+ if (settled && observation.servedSession && signChanged) {
10064
+ void verdictRecord().then((v) => v === null ? void 0 : writeUnlockRecord(o.dataDir, v.record)).catch(() => void 0);
10065
+ }
10066
+ },
10067
+ unlockStamp: async () => unlockStamp(await readWalletFacts(o.dataDir, o.env)),
10068
+ queueNews(line) {
10069
+ if (!queue.includes(line)) queue.push(line);
10070
+ },
10071
+ async takeNews(_sessionId) {
10072
+ if (!observation.servedSession) {
10073
+ observation = { ...observation, servedSession: true, at: now() };
10074
+ write();
10075
+ }
10076
+ const queued = queue.filter((line) => !claimed.has(line));
10077
+ for (const line of queued) claimed.add(line);
10078
+ const lines = [...queued];
10079
+ const sign = observation.sign;
10080
+ let confirmation = null;
10081
+ let told;
10082
+ const hasVerdict = sign.status !== "pending" && !(sign.status === "unknown" && sign.reason === "not_checked");
10083
+ const confirms = !settled && !confirming && hasVerdict;
10084
+ if (confirms) {
10085
+ confirming = true;
10086
+ confirmation = await verdictRecord().catch(() => null);
10087
+ if (confirmation !== null) {
10088
+ const prev = await readUnlockRecord(o.dataDir, confirmation.address);
10089
+ if (sign.status === "ready" && (prev?.status === "blocked" || prev?.status === "awaiting_confirmation")) {
10090
+ lines.push(WALLET_UNLOCKED);
10091
+ }
10092
+ if (sign.status === "blocked" && prev?.status === "awaiting_confirmation") {
10093
+ told = sign.reason ?? "wallet_locked";
10094
+ lines.push(stillLockedSentence(told));
10095
+ }
10096
+ }
10097
+ }
10098
+ let done = false;
10099
+ const unclaim = () => {
10100
+ for (const line of queued) claimed.delete(line);
10101
+ if (confirms) confirming = false;
10102
+ };
10103
+ return {
10104
+ lines,
10105
+ ...told !== void 0 ? { told } : {},
10106
+ ack: async () => {
10107
+ if (done) return;
10108
+ done = true;
10109
+ for (const line of queued) {
10110
+ const at = queue.indexOf(line);
10111
+ if (at !== -1) queue.splice(at, 1);
10112
+ }
10113
+ unclaim();
10114
+ if (confirmation !== null && !settled) {
10115
+ settled = true;
10116
+ await writeUnlockRecord(o.dataDir, confirmation.record);
10117
+ }
10118
+ },
10119
+ release: () => {
10120
+ if (done) return;
10121
+ done = true;
10122
+ unclaim();
10123
+ }
10124
+ };
10125
+ },
10126
+ dispose() {
10127
+ disposed = true;
10128
+ process.removeListener("exit", onExit);
10129
+ removeObservationSync(o.dataDir, o.pid);
10130
+ void writes.then(() => removeObservationSync(o.dataDir, o.pid));
10131
+ }
10132
+ };
10133
+ }
9896
10134
 
9897
10135
  // src/router/routing-payer.ts
9898
10136
  import { randomUUID } from "node:crypto";
@@ -9985,11 +10223,18 @@ function wrapFetchWithPayment(fetch2, client) {
9985
10223
  }
9986
10224
 
9987
10225
  // src/router/routing-payer.ts
10226
+ var NOT_CHECKED = {
10227
+ status: "unknown",
10228
+ reason: "not_checked",
10229
+ detail: UNKNOWN_DETAIL["not_checked"]
10230
+ };
9988
10231
  var ROUTING_SPEND_CAP = "$0.05";
9989
10232
  var DEPOSIT_MULTIPLIER = 5;
9990
10233
  var DEPOSIT_EXTRA_MS = DEPOSIT_GATE_TIMEOUT_MS - GATE_TIMEOUT_MS;
9991
10234
  var DETACHED_CEILING_MS = 15e3;
9992
10235
  var ABSENT_TTL_MS = 60 * 6e4;
10236
+ var SIGNER_RECHECK_MS = 6e4;
10237
+ var FREE_PATH_RESERVE_MS = 1e3;
9993
10238
  var BALANCE_TIMEOUT_MS = 1e3;
9994
10239
  var RPC_TIMEOUT_MS = 2e3;
9995
10240
  function chainReader(rpcUrl, fetchFn) {
@@ -10001,6 +10246,19 @@ function chainReader(rpcUrl, fetchFn) {
10001
10246
  })
10002
10247
  }).readContract(args);
10003
10248
  }
10249
+ var ROUTING_BLOCKED = /* @__PURE__ */ new Set([
10250
+ "wallet_low",
10251
+ "limit_below_deposit",
10252
+ "budget_reached",
10253
+ "not_allowlisted"
10254
+ ]);
10255
+ var ROUTING_SILENT = /* @__PURE__ */ new Set([
10256
+ CHANNEL_BUSY,
10257
+ PAID_PATH_ABSENT,
10258
+ "busy",
10259
+ DEADLINE_AFTER_PAYMENT_SENT,
10260
+ "no_call"
10261
+ ]);
10004
10262
  var routingPolicy = (version, requirements) => canonicalUsdcOnly(version, requirements).filter(
10005
10263
  (r) => r.scheme === "batch-settlement" && r.amount === ROUTING_FEE_ATOMIC.toString()
10006
10264
  );
@@ -10017,6 +10275,52 @@ var RoutingPayer = class {
10017
10275
  queue = Promise.resolve();
10018
10276
  /** A detached request still finishing; the next call waits for it. */
10019
10277
  tail = Promise.resolve();
10278
+ /** The one unlock in flight, which every caller and the prewarm await. */
10279
+ unlocking = null;
10280
+ /** Calls waiting on `unlocking` right now (the prewarm is not one). */
10281
+ waiters = 0;
10282
+ /** A signer an unlock settled with after every call waiting on it gave up:
10283
+ * the next call signs with it rather than unlocking again (B3). */
10284
+ handoff = null;
10285
+ /** The last settled unlock's verdict (decision 16). */
10286
+ memo = null;
10287
+ /** When this process last saw the server ask for the fee. */
10288
+ paidPathSeenAt = null;
10289
+ /** The sign and routing verdicts last reported to `observe`, as status:reason. */
10290
+ reported = {};
10291
+ /**
10292
+ * THE UNLOCK, ahead of any call: `tenjin mcp` starts it when it starts, so
10293
+ * the first prompt finds a verdict (and usually a signer) waiting. The same
10294
+ * single flight as a call's, with no budget; its answer goes to the memo and
10295
+ * to `observe`, and nothing else. Never rejects.
10296
+ */
10297
+ async prewarm() {
10298
+ await this.unlock().catch(() => void 0);
10299
+ }
10300
+ /**
10301
+ * What the last settled unlock said, with no waiting; unknown `not_checked`
10302
+ * before any. A definite block is believed only as the pay path believes it
10303
+ * (decision 16): within {@link SIGNER_RECHECK_MS}, with no unlock running
10304
+ * and nothing it was read from changed. Past that it reads unknown, which
10305
+ * gates nothing, and an unlock starts in the background, so a wallet created
10306
+ * or repaired mid-session is picked up although no call asks for the fee.
10307
+ * The stamp is read in the background too: a change starts the unlock, and
10308
+ * the next caller reads its answer.
10309
+ */
10310
+ signVerdict() {
10311
+ const memo = this.memo;
10312
+ if (memo === null) return NOT_CHECKED;
10313
+ if (!isDefiniteBlock(memo.verdict)) return memo.verdict;
10314
+ if (this.unlocking !== null) return NOT_CHECKED;
10315
+ if (this.now() - memo.at >= SIGNER_RECHECK_MS) {
10316
+ void this.prewarm();
10317
+ return NOT_CHECKED;
10318
+ }
10319
+ void this.stamp().then((stamp) => {
10320
+ if (this.memo === memo && stamp !== memo.stamp) void this.prewarm();
10321
+ });
10322
+ return memo.verdict;
10323
+ }
10020
10324
  /**
10021
10325
  * The paid path for one call, or null for the free path for an hour after
10022
10326
  * the server answered no paid path. That answer is the machine's `router-memo`,
@@ -10089,6 +10393,7 @@ var RoutingPayer = class {
10089
10393
  } catch (err) {
10090
10394
  const call = this.last;
10091
10395
  if (err instanceof RouteSkipped && call?.detached !== true) this.note(err.why, call, sent);
10396
+ if (err instanceof RouteSkipped) this.reportRouting(err.why);
10092
10397
  throw err;
10093
10398
  }
10094
10399
  }
@@ -10109,8 +10414,8 @@ var RoutingPayer = class {
10109
10414
  detachable(call, sent, run) {
10110
10415
  return (input, init) => {
10111
10416
  const caller = init?.signal ?? void 0;
10112
- const own = new AbortController();
10113
- const work = run(input, { ...init, signal: own.signal });
10417
+ const own2 = new AbortController();
10418
+ const work = run(input, { ...init, signal: own2.signal });
10114
10419
  return new Promise((resolve2, reject) => {
10115
10420
  let timer;
10116
10421
  const settle = () => {
@@ -10119,9 +10424,9 @@ var RoutingPayer = class {
10119
10424
  };
10120
10425
  const stop = (reason) => {
10121
10426
  settle();
10122
- if (!call.paid) return own.abort(reason);
10427
+ if (!call.paid) return own2.abort(reason);
10123
10428
  call.detached = true;
10124
- this.tail = this.finishDetached(call, sent, work, own);
10429
+ this.tail = this.finishDetached(call, sent, work, own2);
10125
10430
  reject(reason);
10126
10431
  };
10127
10432
  const onAbort = () => stop(caller?.reason);
@@ -10139,7 +10444,7 @@ var RoutingPayer = class {
10139
10444
  work.then(
10140
10445
  (response) => {
10141
10446
  settle();
10142
- resolve2(call.detached === true ? response : bounded(response, caller, own));
10447
+ resolve2(call.detached === true ? response : bounded(response, caller, own2));
10143
10448
  },
10144
10449
  (err) => {
10145
10450
  settle();
@@ -10150,8 +10455,8 @@ var RoutingPayer = class {
10150
10455
  };
10151
10456
  }
10152
10457
  /** The detached request's end: its answer read and dropped, its one line. */
10153
- async finishDetached(call, sent, work, own) {
10154
- const ceiling = this.timers.setTimeout(() => own.abort(), DETACHED_CEILING_MS);
10458
+ async finishDetached(call, sent, work, own2) {
10459
+ const ceiling = this.timers.setTimeout(() => own2.abort(), DETACHED_CEILING_MS);
10155
10460
  ceiling.unref?.();
10156
10461
  try {
10157
10462
  const response = await work;
@@ -10159,7 +10464,7 @@ var RoutingPayer = class {
10159
10464
  const why = response.ok ? DEADLINE_AFTER_PAYMENT_SENT : PAYMENT_FAILED;
10160
10465
  this.note(why, call, sent, `late http ${response.status}`);
10161
10466
  } catch {
10162
- this.note(PAYMENT_FAILED, call, sent, own.signal.aborted ? "late ceiling" : "late network");
10467
+ this.note(PAYMENT_FAILED, call, sent, own2.signal.aborted ? "late ceiling" : "late network");
10163
10468
  } finally {
10164
10469
  this.timers.clearTimeout(ceiling);
10165
10470
  }
@@ -10179,6 +10484,14 @@ var RoutingPayer = class {
10179
10484
  deposits: []
10180
10485
  };
10181
10486
  calls.push(call);
10487
+ if (this.paidPathSeenAt !== null && this.now() - this.paidPathSeenAt < ABSENT_TTL_MS) {
10488
+ const blocked = await this.freshBlock();
10489
+ if (blocked !== null) {
10490
+ this.last = call;
10491
+ call.skipped = blocked.reason;
10492
+ throw new RouteSkipped(blocked.reason);
10493
+ }
10494
+ }
10182
10495
  const base = options.fetchImpl ?? this.deps.fetchImpl ?? fetch;
10183
10496
  const askFirst = async (input, init) => {
10184
10497
  const request = new Request(input, init);
@@ -10186,10 +10499,11 @@ var RoutingPayer = class {
10186
10499
  let asked = await base(request.clone(), { signal });
10187
10500
  call.answered = true;
10188
10501
  if (asked.status !== 402) return asked;
10502
+ this.paidPathSeenAt = this.now();
10189
10503
  try {
10190
10504
  const refused = feeRefusal(await this.deps.policy(), call.host);
10191
10505
  if (refused !== null) throw new RouteSkipped(refused);
10192
- call.channel = this.channelFor(await this.signer());
10506
+ call.channel = this.channelFor(await this.signer(call));
10193
10507
  if (until - this.now() <= 0) throw new RouteSkipped("busy");
10194
10508
  } catch (err) {
10195
10509
  if (err instanceof RouteSkipped) call.skipped = err.why;
@@ -10248,6 +10562,8 @@ var RoutingPayer = class {
10248
10562
  );
10249
10563
  }
10250
10564
  if (response.status >= 500) throw new RouteSkipped(PAYMENT_FAILED);
10565
+ if (call.paid && response.status < 400)
10566
+ this.report({ routing: { status: "ready", at: this.now() } });
10251
10567
  return response;
10252
10568
  }
10253
10569
  /**
@@ -10318,17 +10634,41 @@ var RoutingPayer = class {
10318
10634
  return amount;
10319
10635
  }
10320
10636
  /**
10321
- * THE WALLET, unlocked without a prompt. One that cannot be (no passphrase
10322
- * in the environment or the OS credential store) pays nothing.
10637
+ * THE WALLET, unlocked without a prompt, for `call`. One that cannot be pays
10638
+ * nothing, and the call skips with WHY, as `classifyUnlockError` names it: a
10639
+ * definite reason (`no_wallet`, `passphrase_wrong`, ...), `keychain_locked`,
10640
+ * `unlock_timeout`, or `wallet_locked` for a failure nobody classified.
10641
+ *
10642
+ * A definite block the memo still believes skips before any unlock
10643
+ * ({@link freshBlock}). Otherwise the call joins the one unlock in flight
10644
+ * (or starts it) and waits for it only until {@link FREE_PATH_RESERVE_MS}
10645
+ * before its own budget ends, then skips with `unlock_timeout`, leaving the
10646
+ * free path its time. THE BUDGET BOUNDS THE WAIT, NEVER THE READ
10647
+ * (B3): the unlock runs on, unaborted, its store read under no deadline, so
10648
+ * an OS unlock dialog stays up; its answer lands in the memo, and a signer
10649
+ * nobody was left waiting for is the next call's.
10650
+ *
10651
+ * The warned line is the classified error's message, which never carries a
10652
+ * store's output (S2).
10323
10653
  */
10324
- async signer() {
10654
+ async signer(call) {
10655
+ const blocked = await this.freshBlock();
10656
+ if (blocked !== null) throw new RouteSkipped(blocked.reason);
10325
10657
  let signer;
10326
- try {
10327
- signer = await this.deps.getSigner();
10328
- } catch (err) {
10329
- this.warn(err instanceof Error ? err.message : String(err));
10330
- const missing = err instanceof CliError && err.code === "WALLET_MISSING";
10331
- throw new RouteSkipped(missing ? "no_wallet" : "wallet_locked");
10658
+ const held = this.handoff;
10659
+ this.handoff = null;
10660
+ if (held !== null && await this.freshReady()) signer = held;
10661
+ else {
10662
+ this.waiters += 1;
10663
+ try {
10664
+ signer = await this.waitFor(this.unlock(), call.until - FREE_PATH_RESERVE_MS);
10665
+ } catch (err) {
10666
+ if (err instanceof RouteSkipped) throw err;
10667
+ this.warn(err instanceof Error ? err.message : String(err));
10668
+ throw new RouteSkipped(classifyUnlockError(err).reason);
10669
+ } finally {
10670
+ this.waiters -= 1;
10671
+ }
10332
10672
  }
10333
10673
  return toClientEvmSigner(
10334
10674
  {
@@ -10340,6 +10680,118 @@ var RoutingPayer = class {
10340
10680
  this.deps.readContract !== void 0 ? { readContract: (args) => this.chainRead(this.deps.readContract, args) } : void 0
10341
10681
  );
10342
10682
  }
10683
+ /**
10684
+ * THE ONE UNLOCK IN FLIGHT, joined or started. Its settlement, whoever is
10685
+ * still waiting, sets the memo (with the stamp read as it started, so a
10686
+ * repair that lands mid-unlock still reads as a change) and reports the
10687
+ * sign verdict, and clears the flight. A success no call is waiting for is
10688
+ * kept for the next call. Nothing here can abort it.
10689
+ */
10690
+ unlock() {
10691
+ if (this.unlocking !== null) return this.unlocking;
10692
+ const stamp = this.stamp();
10693
+ const flight = (async () => {
10694
+ try {
10695
+ const signer = await this.deps.getSigner();
10696
+ const address = signer.address.toLowerCase();
10697
+ this.settle({ status: "ready" }, await stamp, address);
10698
+ if (this.waiters === 0) this.handoff = signer;
10699
+ return signer;
10700
+ } catch (err) {
10701
+ this.settle(verdictOf(err), await stamp);
10702
+ throw err;
10703
+ } finally {
10704
+ this.unlocking = null;
10705
+ }
10706
+ })();
10707
+ flight.catch(() => void 0);
10708
+ this.unlocking = flight;
10709
+ return flight;
10710
+ }
10711
+ /** `unlock` raced against `until`: `unlock_timeout` when the budget ends
10712
+ * first, and the unlock is left running. */
10713
+ async waitFor(unlock, until) {
10714
+ let timer;
10715
+ const deadline = new Promise((_resolve, reject) => {
10716
+ timer = this.timers.setTimeout(
10717
+ () => reject(new RouteSkipped("unlock_timeout")),
10718
+ Math.max(0, until - this.now())
10719
+ );
10720
+ });
10721
+ try {
10722
+ return await Promise.race([unlock, deadline]);
10723
+ } finally {
10724
+ this.timers.clearTimeout(timer);
10725
+ }
10726
+ }
10727
+ /** The memo, set from a settled unlock, and its verdict reported. */
10728
+ settle(verdict, stamp, address) {
10729
+ this.memo = {
10730
+ verdict,
10731
+ at: this.now(),
10732
+ stamp,
10733
+ ...address !== void 0 ? { address } : {}
10734
+ };
10735
+ this.report({ sign: signObservation(verdict), ...address !== void 0 ? { address } : {} });
10736
+ }
10737
+ /** The wallet's unlock stamp, or null when there is none to read. */
10738
+ async stamp() {
10739
+ try {
10740
+ return await this.deps.unlockStamp?.() ?? null;
10741
+ } catch {
10742
+ return null;
10743
+ }
10744
+ }
10745
+ /** Whether the memo was set within {@link SIGNER_RECHECK_MS} and nothing it
10746
+ * was read from has changed since. */
10747
+ async freshMemo(memo) {
10748
+ return this.now() - memo.at < SIGNER_RECHECK_MS && await this.stamp() === memo.stamp;
10749
+ }
10750
+ /** The memo's definite block while it is fresh; null otherwise, an unknown
10751
+ * verdict always (decision 16: only a definite block may skip anything). */
10752
+ async freshBlock() {
10753
+ const memo = this.memo;
10754
+ if (memo === null || !isDefiniteBlock(memo.verdict)) return null;
10755
+ return await this.freshMemo(memo) ? memo.verdict : null;
10756
+ }
10757
+ /** Whether the memo is a fresh ready, so a handed-off signer is still this wallet's. */
10758
+ async freshReady() {
10759
+ const memo = this.memo;
10760
+ return memo !== null && memo.verdict.status === "ready" && await this.freshMemo(memo);
10761
+ }
10762
+ /** A routing outcome, reported when it says something (see {@link ROUTING_SILENT}). */
10763
+ reportRouting(why) {
10764
+ if (ROUTING_SILENT.has(why)) return;
10765
+ const blocked = DEFINITE_UNLOCK.has(why) || ROUTING_BLOCKED.has(why);
10766
+ this.report({
10767
+ routing: { status: blocked ? "blocked" : "unknown", reason: why, at: this.now() }
10768
+ });
10769
+ }
10770
+ /** `deps.observe`, with only the parts whose status or reason changed; not
10771
+ * called at all on a repeat. An observer that throws is ignored. */
10772
+ report(u) {
10773
+ const out = {};
10774
+ if (u.sign !== void 0) {
10775
+ const key = `${u.sign.status}:${u.sign.reason ?? ""}`;
10776
+ if (key !== this.reported.sign) {
10777
+ this.reported.sign = key;
10778
+ out.sign = u.sign;
10779
+ if (u.address !== void 0) out.address = u.address;
10780
+ }
10781
+ }
10782
+ if (u.routing !== void 0) {
10783
+ const key = `${u.routing.status}:${u.routing.reason ?? ""}`;
10784
+ if (key !== this.reported.routing) {
10785
+ this.reported.routing = key;
10786
+ out.routing = u.routing;
10787
+ }
10788
+ }
10789
+ if (out.sign === void 0 && out.routing === void 0) return;
10790
+ try {
10791
+ this.deps.observe?.(out);
10792
+ } catch {
10793
+ }
10794
+ }
10343
10795
  /**
10344
10796
  * ONE SDK CHAIN READ, inside {@link RPC_TIMEOUT_MS} and the call's budget.
10345
10797
  * One that fails or times out skips the call before anything is sent.
@@ -10379,17 +10831,38 @@ var RoutingPayer = class {
10379
10831
  return this.channel;
10380
10832
  }
10381
10833
  };
10382
- function bounded(response, caller, own) {
10834
+ function bounded(response, caller, own2) {
10383
10835
  if (caller === void 0 || response.body === null) return response;
10384
- if (caller.aborted) own.abort(caller.reason);
10385
- else caller.addEventListener("abort", () => own.abort(caller.reason), { once: true });
10386
- const body = response.body.pipeThrough(new TransformStream(), { signal: own.signal });
10836
+ if (caller.aborted) own2.abort(caller.reason);
10837
+ else caller.addEventListener("abort", () => own2.abort(caller.reason), { once: true });
10838
+ const body = response.body.pipeThrough(new TransformStream(), { signal: own2.signal });
10387
10839
  return new Response(body, {
10388
10840
  status: response.status,
10389
10841
  statusText: response.statusText,
10390
10842
  headers: response.headers
10391
10843
  });
10392
10844
  }
10845
+ function verdictOf(err) {
10846
+ const c = classifyUnlockError(err);
10847
+ if (c.definite && c.reason !== "wallet_locked" && c.reason !== "unlock_timeout") {
10848
+ const r = WALLET_REASONS[c.reason];
10849
+ return { status: "blocked", reason: c.reason, detail: r.reason, fix: r.fix };
10850
+ }
10851
+ return {
10852
+ status: "unknown",
10853
+ reason: c.reason,
10854
+ detail: UNKNOWN_DETAIL[c.reason] ?? UNKNOWN_DETAIL["check_failed"]
10855
+ };
10856
+ }
10857
+ function signObservation(v) {
10858
+ if (v.status === "ready") {
10859
+ return { status: "ready", ...v.source !== void 0 ? { source: v.source } : {} };
10860
+ }
10861
+ if (v.status === "blocked") {
10862
+ return { status: "blocked", reason: v.reason, detail: v.detail, fix: v.fix };
10863
+ }
10864
+ return { status: "unknown", reason: v.reason, detail: v.detail };
10865
+ }
10393
10866
  function paymentError(channel, response) {
10394
10867
  try {
10395
10868
  return channel.http.getPaymentRequiredResponse((name) => response.header(name), response.json).error;
@@ -10516,6 +10989,13 @@ var PLACEHOLDER_RE = /\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
10516
10989
  var scalar = (value) => typeof value === "string" && value.length > 0 || typeof value === "number" && Number.isFinite(value) || typeof value === "boolean";
10517
10990
  var segment = (value) => scalar(value) && value !== "." && value !== "..";
10518
10991
  function buildSpecRequest(spec, merged) {
10992
+ const fixed = spec.request.headers ?? {};
10993
+ const refused = Object.entries(fixed).find(([name, value]) => requestHeaderProblem(name, value));
10994
+ if (refused !== void 0)
10995
+ return {
10996
+ problem: `the spec sets the header ${JSON.stringify(refused[0])}, which this build will not send`
10997
+ };
10998
+ const specHeaders = Object.keys(fixed).length ? { specHeaders: fixed } : {};
10519
10999
  const where = (name) => spec.request.fields[name] ?? spec.request.location;
10520
11000
  const inPath = [...spec.request.url.matchAll(PLACEHOLDER_RE)].map((match) => match[1]);
10521
11001
  const missing = inPath.filter((name) => !segment(merged[name]));
@@ -10560,12 +11040,18 @@ function buildSpecRequest(spec, merged) {
10560
11040
  return {
10561
11041
  problem: `a GET carries no body, so ${Object.keys(body).join(", ")} cannot be sent`
10562
11042
  };
10563
- return { url: url.toString(), method: "GET", headers: { accept: "application/json" } };
11043
+ return {
11044
+ url: url.toString(),
11045
+ method: "GET",
11046
+ headers: { accept: "application/json" },
11047
+ ...specHeaders
11048
+ };
10564
11049
  }
10565
11050
  return {
10566
11051
  url: url.toString(),
10567
11052
  method: "POST",
10568
11053
  headers: { accept: "application/json", "content-type": "application/json" },
11054
+ ...specHeaders,
10569
11055
  body: JSON.stringify(body)
10570
11056
  };
10571
11057
  }
@@ -10714,10 +11200,12 @@ async function planStop(admission, plan, deps, alternative) {
10714
11200
  };
10715
11201
  }
10716
11202
  }
11203
+ function paymentProvider(deps) {
11204
+ return deps.provider ?? deps.payDeps?.provider ?? resolveWalletProvider(deps.ctx);
11205
+ }
10717
11206
  async function walletBalance(deps, rpcUrl) {
10718
11207
  try {
10719
- const provider = deps.provider ?? deps.payDeps?.provider ?? resolveWalletProvider(deps.ctx);
10720
- const { address } = await provider.describe();
11208
+ const { address } = await paymentProvider(deps).describe();
10721
11209
  const read = deps.payDeps?.readBalance ?? readUsdcBalanceWithFallback;
10722
11210
  return await read(address, rpcUrl, {
10723
11211
  timeoutMs: Math.max(1, Math.floor(deps.ctx.flags.timeout / 2))
@@ -11142,6 +11630,7 @@ async function quoteTake(prepared, deps) {
11142
11630
  url: built.url,
11143
11631
  method: built.method,
11144
11632
  headers: built.headers,
11633
+ ...built.specHeaders !== void 0 ? { specHeaders: built.specHeaders } : {},
11145
11634
  ...built.body !== void 0 ? { rawBody: built.body } : {},
11146
11635
  terms: specTerms(spec)
11147
11636
  },
@@ -11159,7 +11648,7 @@ async function quoteTake(prepared, deps) {
11159
11648
  const rejectedInput = detail.status === 400 || detail.status === 422;
11160
11649
  const live = detail.live?.amount;
11161
11650
  const overCeiling = spec.priceVaries && cli?.code === "REGISTRY_MISMATCH" && live !== void 0 && /^\d+$/.test(live);
11162
- const reason = overCeiling ? `${spec.provider} prices this input at $${toMoney(live).usd}, over this spec's $${toMoney(spec.maxAmountAtomic).usd} ceiling, so nothing was signed. Change the input and call again with the same id.` : rejectedInput ? `${spec.provider} rejected this input before any payment (HTTP ${String(detail.status)}): see providerError. Fix the input and call again with the same id.` : cli !== void 0 ? `${cli.message} ${cli.fix ?? ""}`.trim() : String(err);
11651
+ const reason = overCeiling ? `${spec.provider} prices this input at $${toMoney(live).usd}, over this spec's $${toMoney(spec.maxAmountAtomic).usd} ceiling, so nothing was signed. Change the input and call again with the same id.` : rejectedInput ? `${spec.provider} rejected this input before any payment (HTTP ${String(detail.status)}): see providerError. Fix the input and call again with the same id.` : cli !== void 0 ? `${cli.message} ${agentFixOf(cli)}`.trim() : String(err);
11163
11652
  const status = cli?.code === "POLICY_REFUSED" ? "needs_approval" : "failed";
11164
11653
  return {
11165
11654
  refused: {
@@ -11812,8 +12301,20 @@ async function runApproveTool(args, deps) {
11812
12301
  { quote: quoteView(quote), nextStep: `Call ${approveCall(quote)}.` }
11813
12302
  );
11814
12303
  }
12304
+ const provider = paymentProvider(deps);
12305
+ try {
12306
+ await provider.getSigner();
12307
+ } catch (err) {
12308
+ if (!(err instanceof CliError)) throw err;
12309
+ return fail(
12310
+ "failed",
12311
+ `${quote.sentence} ${err.message} No payment was signed. ${agentFixOf(err)}`.trim(),
12312
+ { nextStep: "Tell the user. The quote waits for its ten minutes; nothing was paid." }
12313
+ );
12314
+ }
11815
12315
  const call_ = {
11816
12316
  ...deps,
12317
+ provider,
11817
12318
  startedAt: deps.startedAt ?? now(),
11818
12319
  downloads: deps.downloads ?? { leftBytes: MAX_CALL_DOWNLOAD_BYTES }
11819
12320
  };
@@ -12000,7 +12501,7 @@ async function requestTool(args, deps) {
12000
12501
  await footer.done("native");
12001
12502
  return fail(
12002
12503
  "native",
12003
- fresh.why === DEADLINE_AFTER_PAYMENT_SENT ? "A routing payment (possibly the channel deposit) went out, and this call ran out of time before its answer. `tenjin mcp` lets it finish so it is recorded; nothing else was paid." : `${unpaidSentence(fresh.why) ?? ""} This call ran out of time before the free path answered, so nothing was routed or paid.`.trim(),
12504
+ fresh.why === DEADLINE_AFTER_PAYMENT_SENT ? "A routing payment (possibly the channel deposit) went out, and this call ran out of time before its answer. `tenjin mcp` lets it finish so it is recorded; nothing else was paid." : `${unpaidSentence(fresh.why, "agent") ?? ""} This call ran out of time before the free path answered, so nothing was routed or paid.`.trim(),
12004
12505
  { nextStep: "Use your own tools for this one." }
12005
12506
  );
12006
12507
  }
@@ -12016,7 +12517,7 @@ async function requestTool(args, deps) {
12016
12517
  await footer.done("native");
12017
12518
  return fail(
12018
12519
  "native",
12019
- unpaidSentence(fresh.freePath ?? FEE_REQUIRED) ?? unpaidSentence(FEE_REQUIRED),
12520
+ unpaidSentence(fresh.freePath ?? FEE_REQUIRED, "agent") ?? unpaidSentence(FEE_REQUIRED),
12020
12521
  { nextStep: "Tell the user this once, and use your own tools for now." }
12021
12522
  );
12022
12523
  }
@@ -12366,6 +12867,7 @@ async function payAndDeliver(call, admission, deps, footer) {
12366
12867
  url: built.url,
12367
12868
  method: built.method,
12368
12869
  headers: built.headers,
12870
+ ...built.specHeaders !== void 0 ? { specHeaders: built.specHeaders } : {},
12369
12871
  ...built.body !== void 0 ? { rawBody: built.body } : {},
12370
12872
  terms: call.terms,
12371
12873
  execution: "router",
@@ -12468,7 +12970,7 @@ async function payAndDeliver(call, admission, deps, footer) {
12468
12970
  const live = detail.live?.amount;
12469
12971
  const ceiling = call.terms.maxAmountAtomic;
12470
12972
  const overCeiling = call.priceVaries === true && cli?.code === "REGISTRY_MISMATCH" && live !== void 0 && ceiling !== void 0 && /^\d+$/.test(live) && BigInt(live) > BigInt(ceiling);
12471
- const reason = overCeiling ? `${call.provider} prices this input at $${toMoney(live).usd}, over this spec's $${toMoney(ceiling).usd} ceiling, so nothing was signed. Change the input (a smaller size, a shorter clip, fewer items) and call again with the same id.` : rejectedInput ? `${call.provider} rejected this input before any payment (HTTP ${String(detail.status)}): see providerError. Fix the input and call again with the same id.` : cli !== void 0 ? `${cli.message} ${cli.fix ?? ""}`.trim() : String(err);
12973
+ const reason = overCeiling ? `${call.provider} prices this input at $${toMoney(live).usd}, over this spec's $${toMoney(ceiling).usd} ceiling, so nothing was signed. Change the input (a smaller size, a shorter clip, fewer items) and call again with the same id.` : rejectedInput ? `${call.provider} rejected this input before any payment (HTTP ${String(detail.status)}): see providerError. Fix the input and call again with the same id.` : cli !== void 0 ? `${cli.message} ${agentFixOf(cli)}`.trim() : String(err);
12472
12974
  await footer.done(status, {
12473
12975
  provider: built.url,
12474
12976
  ...named,
@@ -13323,7 +13825,9 @@ function buildContext(opts) {
13323
13825
  function buildRouterMcpServer(opts = {}) {
13324
13826
  const ctx = buildContext(opts);
13325
13827
  const provider = opts.handlerDeps?.provider ?? resolveWalletProvider(ctx);
13326
- if (opts.handlerDeps?.provider === void 0) {
13828
+ if (opts.payer !== void 0) {
13829
+ void opts.payer.prewarm();
13830
+ } else if (opts.handlerDeps?.provider === void 0) {
13327
13831
  void provider.getSigner().catch(() => void 0);
13328
13832
  }
13329
13833
  const server = new McpServer(
@@ -13458,7 +13962,7 @@ function buildRouterMcpServer(opts = {}) {
13458
13962
  server.server.oninitialized = () => {
13459
13963
  if (promptsBeforeApprove(server.server.getClientVersion())) approve.enable();
13460
13964
  };
13461
- if (opts.harness === "codex") return server;
13965
+ if (opts.harness === "codex") return registerCodexHookTool(server, ctx, opts);
13462
13966
  const env = opts.env ?? process.env;
13463
13967
  const fromPlugin = launchedByPlugin(env);
13464
13968
  server.registerTool(
@@ -13487,7 +13991,11 @@ function buildRouterMcpServer(opts = {}) {
13487
13991
  response = await runHookKind(args.kind, event, {
13488
13992
  dataDir: ctx.dataDir,
13489
13993
  ...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {},
13490
- ...opts.payer !== void 0 ? { route: opts.payer.routeFor.bind(opts.payer) } : {},
13994
+ ...opts.payer !== void 0 ? {
13995
+ route: opts.payer.routeFor.bind(opts.payer),
13996
+ signer: opts.payer.signVerdict.bind(opts.payer)
13997
+ } : {},
13998
+ ...opts.observer !== void 0 ? { walletNews: opts.observer.takeNews.bind(opts.observer) } : {},
13491
13999
  ...opts.hookDeps
13492
14000
  });
13493
14001
  } catch {
@@ -13500,6 +14008,52 @@ function buildRouterMcpServer(opts = {}) {
13500
14008
  );
13501
14009
  return server;
13502
14010
  }
14011
+ function registerCodexHookTool(server, ctx, opts) {
14012
+ server.registerTool(
14013
+ HOOK_TOOL,
14014
+ {
14015
+ title: "Tenjin's routing hooks (called by your agent host, not by you)",
14016
+ description: "Called by the Tenjin plugin's hooks, once per routing leg, with the hook event. Never call it yourself: to make a lookup, call `request`.",
14017
+ inputSchema: {
14018
+ kind: external_exports.enum(CODEX_HOOK_KINDS),
14019
+ ...Object.fromEntries(
14020
+ CODEX_HOOK_TOOL_FIELDS.map((field) => [field, external_exports.unknown().optional()])
14021
+ )
14022
+ }
14023
+ },
14024
+ async (args, extra) => {
14025
+ let response = null;
14026
+ try {
14027
+ const event = await admitCodexHookEvent(codexEventFromToolInput(args), {
14028
+ threadId: extra._meta?.["threadId"],
14029
+ ...opts.homeDir !== void 0 ? { homeDir: opts.homeDir, env: {} } : {}
14030
+ });
14031
+ if (event !== null) {
14032
+ const { codexResponse } = await import("./codex-event-TYVES3UX.js");
14033
+ response = codexResponse(
14034
+ await runHookKind(args.kind, event, {
14035
+ dataDir: ctx.dataDir,
14036
+ harness: "codex",
14037
+ ...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {},
14038
+ ...opts.payer !== void 0 ? {
14039
+ route: opts.payer.routeFor.bind(opts.payer),
14040
+ signer: opts.payer.signVerdict.bind(opts.payer)
14041
+ } : {},
14042
+ ...opts.observer !== void 0 ? { walletNews: opts.observer.takeNews.bind(opts.observer) } : {},
14043
+ ...opts.hookDeps
14044
+ })
14045
+ );
14046
+ }
14047
+ } catch {
14048
+ response = null;
14049
+ }
14050
+ return {
14051
+ content: [{ type: "text", text: response === null ? "" : JSON.stringify(response) }]
14052
+ };
14053
+ }
14054
+ );
14055
+ return server;
14056
+ }
13503
14057
  function toolResult(result) {
13504
14058
  return {
13505
14059
  isError: result.isError,
@@ -13510,9 +14064,7 @@ function toolResult(result) {
13510
14064
  };
13511
14065
  }
13512
14066
  async function runRouterMcpServer(opts = {}) {
13513
- const ctx = buildContext(opts);
13514
- const payer = opts.payer ?? await routingPayer(ctx);
13515
- const server = buildRouterMcpServer({ ...opts, payer });
14067
+ const server = await createRouterMcpServer(opts);
13516
14068
  await server.connect(new StdioServerTransport());
13517
14069
  await new Promise((resolve2) => {
13518
14070
  server.server.onclose = () => resolve2();
@@ -13520,9 +14072,28 @@ async function runRouterMcpServer(opts = {}) {
13520
14072
  process.stdin.once("close", resolve2);
13521
14073
  });
13522
14074
  }
13523
- async function routingPayer(ctx) {
14075
+ async function createRouterMcpServer(opts = {}) {
14076
+ const { payerDeps, ...rest } = opts;
14077
+ const ctx = buildContext(rest);
14078
+ const env = rest.env ?? process.env;
14079
+ const observer = rest.observer ?? createRouterObserver({
14080
+ dataDir: ctx.dataDir,
14081
+ pid: process.pid,
14082
+ startedAt: Date.now() - process.uptime() * 1e3,
14083
+ cliVersion: package_default.version,
14084
+ harness: rest.harness ?? "claude",
14085
+ launchedByPlugin: launchedByPlugin(env),
14086
+ cwd: process.cwd(),
14087
+ env
14088
+ });
14089
+ const payer = rest.payer ?? await routingPayer(ctx, observer, payerDeps);
14090
+ return buildRouterMcpServer({ ...rest, payer, observer });
14091
+ }
14092
+ async function routingPayer(ctx, observer, overrides = {}) {
13524
14093
  const settings = await resolveContextSettings(ctx);
13525
- const provider = resolveWalletProvider(ctx);
14094
+ const provider = resolveWalletProvider(ctx, {
14095
+ onWarning: (w) => observer.queueNews(w.message)
14096
+ });
13526
14097
  return new RoutingPayer({
13527
14098
  dataDir: ctx.dataDir,
13528
14099
  // Never a prompt: the context is not a TTY, because the stdio transport owns stdin.
@@ -13535,7 +14106,10 @@ async function routingPayer(ctx) {
13535
14106
  `)
13536
14107
  }),
13537
14108
  walletBalance: (address, timeoutMs) => readUsdcBalance(address, settings.rpcUrl, { timeoutMs }),
13538
- readContract: chainReader(settings.rpcUrl)
14109
+ readContract: chainReader(settings.rpcUrl),
14110
+ observe: observer.observe,
14111
+ unlockStamp: observer.unlockStamp,
14112
+ ...overrides
13539
14113
  });
13540
14114
  }
13541
14115
  export {
@@ -13545,9 +14119,10 @@ export {
13545
14119
  REQUIRES_USER_INTERACTION_KEY,
13546
14120
  SCOPE_RULE,
13547
14121
  buildRouterMcpServer,
14122
+ createRouterMcpServer,
13548
14123
  pollProgress,
13549
14124
  promptsBeforeApprove,
13550
14125
  runRouterMcpServer,
13551
14126
  waitsForJobs
13552
14127
  };
13553
- //# sourceMappingURL=mcp-3LIJSSJB.js.map
14128
+ //# sourceMappingURL=mcp-HAWKCTPQ.js.map