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.
- package/README.md +5 -5
- package/dist/{_esm-MEXZI5DL.js → _esm-RLLC72MS.js} +128 -132
- package/dist/{alive-J64H46HI.js → alive-MROUMFH3.js} +13 -6
- package/dist/auto-update-OPWMRZLS.js +22 -0
- package/dist/{ccip-7RMRLAGV.js → ccip-DHDFKTQV.js} +2 -2
- package/dist/chunk-2GNOFONN.js +560 -0
- package/dist/chunk-2GNOFONN.js.map +1 -0
- package/dist/{chunk-TTNESUPQ.js → chunk-2GP3HRYK.js} +2120 -193
- package/dist/chunk-2GP3HRYK.js.map +1 -0
- package/dist/chunk-3AIHRXKO.js +72 -0
- package/dist/chunk-3AIHRXKO.js.map +1 -0
- package/dist/{chunk-LEFIX6RS.js → chunk-3DIL66VX.js} +31 -11
- package/dist/chunk-3DIL66VX.js.map +1 -0
- package/dist/{chunk-S4SAZ7OD.js → chunk-3FMZGI7I.js} +12 -2
- package/dist/{chunk-S4SAZ7OD.js.map → chunk-3FMZGI7I.js.map} +1 -1
- package/dist/{chunk-7Q5FDF65.js → chunk-445VQTVM.js} +3 -3
- package/dist/{chunk-A36LQPHV.js → chunk-4LMUQMBH.js} +1 -1
- package/dist/{chunk-A36LQPHV.js.map → chunk-4LMUQMBH.js.map} +1 -1
- package/dist/{chunk-KXQ4UIP7.js → chunk-4USCZ2NI.js} +2 -2
- package/dist/chunk-62KNUYWD.js +111 -0
- package/dist/chunk-62KNUYWD.js.map +1 -0
- package/dist/{chunk-POUWHWID.js → chunk-6CMM6YCB.js} +3 -3
- package/dist/{chunk-POUWHWID.js.map → chunk-6CMM6YCB.js.map} +1 -1
- package/dist/{chunk-5MARFNSB.js → chunk-AD226HDR.js} +49 -30
- package/dist/chunk-AD226HDR.js.map +1 -0
- package/dist/chunk-ADV4LDTB.js +106 -0
- package/dist/chunk-ADV4LDTB.js.map +1 -0
- package/dist/{chunk-7WU4OPLP.js → chunk-AV5NZMYO.js} +5 -3
- package/dist/{chunk-7WU4OPLP.js.map → chunk-AV5NZMYO.js.map} +1 -1
- package/dist/chunk-B7EM4GGF.js +198 -0
- package/dist/chunk-B7EM4GGF.js.map +1 -0
- package/dist/chunk-BFDQ4WNW.js +119 -0
- package/dist/chunk-BFDQ4WNW.js.map +1 -0
- package/dist/{chunk-2XLC3AEX.js → chunk-BI673VEJ.js} +536 -510
- package/dist/chunk-BI673VEJ.js.map +1 -0
- package/dist/chunk-CEXSOI5R.js +808 -0
- package/dist/chunk-CEXSOI5R.js.map +1 -0
- package/dist/{chunk-FW75G2W4.js → chunk-CISYM4EO.js} +5 -5
- package/dist/{chunk-B7HUUJOK.js → chunk-D3ZURCG7.js} +3 -3
- package/dist/chunk-D5TOQSO4.js +474 -0
- package/dist/chunk-D5TOQSO4.js.map +1 -0
- package/dist/{chunk-UQUOVWBG.js → chunk-DRDUIZIA.js} +7 -7
- package/dist/{chunk-27EPWVOY.js → chunk-DW4YTVR3.js} +2 -2
- package/dist/chunk-E7LGOMH6.js +449 -0
- package/dist/chunk-E7LGOMH6.js.map +1 -0
- package/dist/{chunk-QSCPK4F5.js → chunk-E7SW44LM.js} +4 -11
- package/dist/chunk-E7SW44LM.js.map +1 -0
- package/dist/chunk-EDJWHDDL.js +33 -0
- package/dist/chunk-EDJWHDDL.js.map +1 -0
- package/dist/chunk-F3ED5WTR.js +13 -0
- package/dist/chunk-F3ED5WTR.js.map +1 -0
- package/dist/chunk-G75OPGAK.js +111 -0
- package/dist/chunk-G75OPGAK.js.map +1 -0
- package/dist/{chunk-R5LCN54M.js → chunk-GAKUQHKA.js} +13 -17
- package/dist/{chunk-R5LCN54M.js.map → chunk-GAKUQHKA.js.map} +1 -1
- package/dist/{chunk-4ZZO6ULA.js → chunk-HDPUXS3Z.js} +19 -48
- package/dist/chunk-HDPUXS3Z.js.map +1 -0
- package/dist/{chunk-ORWL5BSN.js → chunk-HGZEPQUT.js} +2 -2
- package/dist/{chunk-6E5R45ZO.js → chunk-HREHWL32.js} +4 -4
- package/dist/{chunk-6E5R45ZO.js.map → chunk-HREHWL32.js.map} +1 -1
- package/dist/{chunk-KXVP2VKA.js → chunk-I5TDIUKM.js} +15 -34
- package/dist/chunk-I5TDIUKM.js.map +1 -0
- package/dist/{chunk-7QKHZQKW.js → chunk-IADZOXKN.js} +39 -6
- package/dist/chunk-IADZOXKN.js.map +1 -0
- package/dist/{chunk-P4NH7OUK.js → chunk-IDTRSAHE.js} +2 -2
- package/dist/{chunk-YFPY4ONH.js → chunk-JEVQ5LKO.js} +4 -4
- package/dist/chunk-JNJWBTU2.js +3497 -0
- package/dist/chunk-JNJWBTU2.js.map +1 -0
- package/dist/{chunk-MNXS2U45.js → chunk-JRZBBPO6.js} +167 -86
- package/dist/chunk-JRZBBPO6.js.map +1 -0
- package/dist/{chunk-WJXLQXJY.js → chunk-MPZUYCAP.js} +4 -1
- package/dist/{chunk-WJXLQXJY.js.map → chunk-MPZUYCAP.js.map} +1 -1
- package/dist/{chunk-SJLTEINJ.js → chunk-OJNTCYQQ.js} +17 -1
- package/dist/chunk-OJNTCYQQ.js.map +1 -0
- package/dist/{chunk-AGZ7PJKY.js → chunk-OTWLERSW.js} +22 -5
- package/dist/chunk-OTWLERSW.js.map +1 -0
- package/dist/{chunk-NEFNKLBE.js → chunk-PJNENX2A.js} +1535 -422
- package/dist/chunk-PJNENX2A.js.map +1 -0
- package/dist/{chunk-UKY4CHNC.js → chunk-PKHI276N.js} +8 -4
- package/dist/chunk-PKHI276N.js.map +1 -0
- package/dist/{chunk-5K5W4S66.js → chunk-QF3LSMGS.js} +2 -2
- package/dist/{chunk-XZKD7DIF.js → chunk-RL5UUDT4.js} +3 -3
- package/dist/{chunk-XZKD7DIF.js.map → chunk-RL5UUDT4.js.map} +1 -1
- package/dist/{chunk-OHRR5OYM.js → chunk-SFASB5FL.js} +10 -4
- package/dist/chunk-SFASB5FL.js.map +1 -0
- package/dist/{chunk-YVFXE7RR.js → chunk-SNNSAGMT.js} +7279 -2627
- package/dist/chunk-SNNSAGMT.js.map +1 -0
- package/dist/{chunk-WK7F3B2E.js → chunk-SO3XRZPX.js} +3 -3
- package/dist/chunk-SYOS5CAC.js +176 -0
- package/dist/chunk-SYOS5CAC.js.map +1 -0
- package/dist/chunk-TAW4UFFF.js +293 -0
- package/dist/chunk-TAW4UFFF.js.map +1 -0
- package/dist/{hosts-FWZOV26H.js → chunk-TF5HCP33.js} +79 -24
- package/dist/chunk-TF5HCP33.js.map +1 -0
- package/dist/{chunk-AKWGE6JQ.js → chunk-UUGOUOVT.js} +37 -2
- package/dist/chunk-UUGOUOVT.js.map +1 -0
- package/dist/{chunk-7ZRL2LBQ.js → chunk-V2LQLN5H.js} +6 -6
- package/dist/{chunk-K72RURN3.js → chunk-VJUVFZ2D.js} +2 -2
- package/dist/{chunk-77TCKDEC.js → chunk-VOZA6O7K.js} +663 -477
- package/dist/chunk-VOZA6O7K.js.map +1 -0
- package/dist/{chunk-D65GNPS3.js → chunk-VUGQTZ2L.js} +208 -84
- package/dist/chunk-VUGQTZ2L.js.map +1 -0
- package/dist/chunk-WOM257PW.js +393 -0
- package/dist/chunk-WOM257PW.js.map +1 -0
- package/dist/chunk-WYXUQGOL.js +191 -0
- package/dist/chunk-WYXUQGOL.js.map +1 -0
- package/dist/chunk-X5ZBP3IY.js +97 -0
- package/dist/chunk-X5ZBP3IY.js.map +1 -0
- package/dist/{chunk-5C32RLTA.js → chunk-YUY4SAGM.js} +17 -2
- package/dist/chunk-YUY4SAGM.js.map +1 -0
- package/dist/{cli-D5OE3URZ.js → cli-FB4LOA5A.js} +144 -63
- package/dist/{cli-D5OE3URZ.js.map → cli-FB4LOA5A.js.map} +1 -1
- package/dist/{codex-event-PPNVRRDH.js → codex-event-TYVES3UX.js} +2 -2
- package/dist/{codex-host-2RJOJW2B.js → codex-host-WW4H2SKT.js} +7 -6
- package/dist/codex-install-2C623HPW.js +393 -0
- package/dist/codex-install-2C623HPW.js.map +1 -0
- package/dist/{config-ZD4OB2DO.js → config-HOVJFEKD.js} +21 -17
- package/dist/doctor-NKU4V5OV.js +1312 -0
- package/dist/doctor-NKU4V5OV.js.map +1 -0
- package/dist/{env-proxy-XL4P73MZ.js → env-proxy-R6ZMLQTT.js} +6 -2
- package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js → ethersCompat-Df4a6QIZ-X6YZWAML.js} +3 -3
- package/dist/{fund-5ITKQGYF.js → fund-WEBHTZGN.js} +37 -36
- package/dist/{fund-5ITKQGYF.js.map → fund-WEBHTZGN.js.map} +1 -1
- package/dist/hook-command-ZA2PNKS6.js +44 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
- package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +82 -0
- package/dist/hosts/codex/tenjin/.mcp.json +3 -0
- package/dist/hosts/codex/tenjin/hooks/hooks.json +51 -5
- package/dist/hosts-AV5MHBAU.js +38 -0
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/dist/{install-XWGE4Q7L.js → install-PT4EZS4R.js} +53 -30
- package/dist/{install-identity-K7EJIQFP.js → install-identity-5A4OE6YC.js} +11 -10
- package/dist/install-wallet-SAAPKB73.js +281 -0
- package/dist/install-wallet-SAAPKB73.js.map +1 -0
- package/dist/{mcp-3LIJSSJB.js → mcp-HAWKCTPQ.js} +785 -210
- package/dist/mcp-HAWKCTPQ.js.map +1 -0
- package/dist/{mine.wasm-6PIT3DK6.js → mine.wasm-QFAHIFPY.js} +2 -2
- package/dist/{mine.wasm-6PIT3DK6.js.map → mine.wasm-QFAHIFPY.js.map} +1 -1
- package/dist/{package-ZKQFDWLE.js → package-SR2WB6MK.js} +4 -2
- package/dist/passphrase-IFTDS3CU.js +44 -0
- package/dist/{paths-POPTXJO6.js → paths-XCSAKISU.js} +10 -2
- package/dist/{pay-WHBERZ3W.js → pay-OXC3WKYV.js} +29 -29
- package/dist/{payments-KVICEKD2.js → payments-3KHMP2MG.js} +15 -14
- package/dist/{payments-KVICEKD2.js.map → payments-3KHMP2MG.js.map} +1 -1
- package/dist/plugin-registration-N3GRIZVM.js +67 -0
- package/dist/{redact-6W23GGJC.js → redact-D7ASVWKL.js} +2 -2
- package/dist/runtime-UVNUA3AS.js +1203 -0
- package/dist/runtime-UVNUA3AS.js.map +1 -0
- package/dist/runtime-fetch-EKFRNR6Z.js +20 -0
- package/dist/runtime-layout-BDWZG2TQ.js +25 -0
- package/dist/{send-7G7Y7DLN.js → send-HMKJLT34.js} +24 -22
- package/dist/{send-7G7Y7DLN.js.map → send-HMKJLT34.js.map} +1 -1
- package/dist/{status-OF7RH5HM.js → status-RWXIIWYS.js} +55 -25
- package/dist/status-RWXIIWYS.js.map +1 -0
- package/dist/{status-line-XOUE6MPL.js → status-line-77XYZP7E.js} +10 -9
- package/dist/{status-line-XOUE6MPL.js.map → status-line-77XYZP7E.js.map} +1 -1
- package/dist/uninstall-D5G67UJH.js +480 -0
- package/dist/uninstall-D5G67UJH.js.map +1 -0
- package/dist/update-LRNOEGSB.js +53 -0
- package/dist/update-LRNOEGSB.js.map +1 -0
- package/dist/{usdc-OGOGEHV2.js → usdc-D6X7EIQ2.js} +6 -8
- package/dist/usdc-D6X7EIQ2.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-S3DA7DFW.js → viemAdapter-By13KInL-RL742ETX.js} +3 -3
- package/dist/viemAdapter-By13KInL-RL742ETX.js.map +1 -0
- package/dist/wallet-XFYC27BR.js +55 -0
- package/dist/wallet-XFYC27BR.js.map +1 -0
- package/dist/wallet-kdf-worker.mjs +8 -8
- package/docs/agent-permissions.md +40 -22
- package/docs/safety-model.md +1 -1
- package/docs/troubleshooting.md +72 -1
- package/package.json +14 -1
- package/dist/ccip-NLCSCHKI.js +0 -19
- package/dist/chunk-2XLC3AEX.js.map +0 -1
- package/dist/chunk-4ZZO6ULA.js.map +0 -1
- package/dist/chunk-5C32RLTA.js.map +0 -1
- package/dist/chunk-5IEP5EGE.js +0 -5332
- package/dist/chunk-5IEP5EGE.js.map +0 -1
- package/dist/chunk-5MARFNSB.js.map +0 -1
- package/dist/chunk-77TCKDEC.js.map +0 -1
- package/dist/chunk-7EKYXMUO.js +0 -7536
- package/dist/chunk-7EKYXMUO.js.map +0 -1
- package/dist/chunk-7QKHZQKW.js.map +0 -1
- package/dist/chunk-AGZ7PJKY.js.map +0 -1
- package/dist/chunk-AKWGE6JQ.js.map +0 -1
- package/dist/chunk-BL3332HQ.js +0 -7611
- package/dist/chunk-BL3332HQ.js.map +0 -1
- package/dist/chunk-D65GNPS3.js.map +0 -1
- package/dist/chunk-EGELTSPU.js +0 -2865
- package/dist/chunk-EGELTSPU.js.map +0 -1
- package/dist/chunk-GA7JETVM.js +0 -150
- package/dist/chunk-GA7JETVM.js.map +0 -1
- package/dist/chunk-I3EQFHCD.js +0 -175
- package/dist/chunk-I3EQFHCD.js.map +0 -1
- package/dist/chunk-K3I7C2MO.js +0 -1185
- package/dist/chunk-K3I7C2MO.js.map +0 -1
- package/dist/chunk-KXVP2VKA.js.map +0 -1
- package/dist/chunk-LEFIX6RS.js.map +0 -1
- package/dist/chunk-MNXS2U45.js.map +0 -1
- package/dist/chunk-NEFNKLBE.js.map +0 -1
- package/dist/chunk-OHRR5OYM.js.map +0 -1
- package/dist/chunk-QSCPK4F5.js.map +0 -1
- package/dist/chunk-SJLTEINJ.js.map +0 -1
- package/dist/chunk-TTNESUPQ.js.map +0 -1
- package/dist/chunk-UKY4CHNC.js.map +0 -1
- package/dist/chunk-V6BSF6OC.js +0 -260
- package/dist/chunk-V6BSF6OC.js.map +0 -1
- package/dist/chunk-YVFXE7RR.js.map +0 -1
- package/dist/codex-install-UUZ6QMBQ.js +0 -221
- package/dist/codex-install-UUZ6QMBQ.js.map +0 -1
- package/dist/doctor-KBR34Q4B.js +0 -601
- package/dist/doctor-KBR34Q4B.js.map +0 -1
- package/dist/hook-command-4TYCHHRL.js +0 -39
- package/dist/hosts-FWZOV26H.js.map +0 -1
- package/dist/install-wallet-XQ6XFZV4.js +0 -117
- package/dist/install-wallet-XQ6XFZV4.js.map +0 -1
- package/dist/mcp-3LIJSSJB.js.map +0 -1
- package/dist/plugin-registration-5TIA564H.js +0 -54
- package/dist/status-OF7RH5HM.js.map +0 -1
- package/dist/uninstall-JXUAFNDB.js +0 -158
- package/dist/uninstall-JXUAFNDB.js.map +0 -1
- package/dist/update-ZKUERSO2.js +0 -44
- package/dist/wallet-2HA6W4R4.js +0 -43
- /package/dist/{_esm-MEXZI5DL.js.map → _esm-RLLC72MS.js.map} +0 -0
- /package/dist/{alive-J64H46HI.js.map → alive-MROUMFH3.js.map} +0 -0
- /package/dist/{ccip-7RMRLAGV.js.map → auto-update-OPWMRZLS.js.map} +0 -0
- /package/dist/{ccip-NLCSCHKI.js.map → ccip-DHDFKTQV.js.map} +0 -0
- /package/dist/{chunk-7Q5FDF65.js.map → chunk-445VQTVM.js.map} +0 -0
- /package/dist/{chunk-KXQ4UIP7.js.map → chunk-4USCZ2NI.js.map} +0 -0
- /package/dist/{chunk-FW75G2W4.js.map → chunk-CISYM4EO.js.map} +0 -0
- /package/dist/{chunk-B7HUUJOK.js.map → chunk-D3ZURCG7.js.map} +0 -0
- /package/dist/{chunk-UQUOVWBG.js.map → chunk-DRDUIZIA.js.map} +0 -0
- /package/dist/{chunk-27EPWVOY.js.map → chunk-DW4YTVR3.js.map} +0 -0
- /package/dist/{chunk-ORWL5BSN.js.map → chunk-HGZEPQUT.js.map} +0 -0
- /package/dist/{chunk-P4NH7OUK.js.map → chunk-IDTRSAHE.js.map} +0 -0
- /package/dist/{chunk-YFPY4ONH.js.map → chunk-JEVQ5LKO.js.map} +0 -0
- /package/dist/{chunk-5K5W4S66.js.map → chunk-QF3LSMGS.js.map} +0 -0
- /package/dist/{chunk-WK7F3B2E.js.map → chunk-SO3XRZPX.js.map} +0 -0
- /package/dist/{chunk-7ZRL2LBQ.js.map → chunk-V2LQLN5H.js.map} +0 -0
- /package/dist/{chunk-K72RURN3.js.map → chunk-VJUVFZ2D.js.map} +0 -0
- /package/dist/{codex-event-PPNVRRDH.js.map → codex-event-TYVES3UX.js.map} +0 -0
- /package/dist/{codex-host-2RJOJW2B.js.map → codex-host-WW4H2SKT.js.map} +0 -0
- /package/dist/{config-ZD4OB2DO.js.map → config-HOVJFEKD.js.map} +0 -0
- /package/dist/{env-proxy-XL4P73MZ.js.map → env-proxy-R6ZMLQTT.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js.map → ethersCompat-Df4a6QIZ-X6YZWAML.js.map} +0 -0
- /package/dist/{hook-command-4TYCHHRL.js.map → hook-command-ZA2PNKS6.js.map} +0 -0
- /package/dist/{install-XWGE4Q7L.js.map → hosts-AV5MHBAU.js.map} +0 -0
- /package/dist/{install-identity-K7EJIQFP.js.map → install-PT4EZS4R.js.map} +0 -0
- /package/dist/{package-ZKQFDWLE.js.map → install-identity-5A4OE6YC.js.map} +0 -0
- /package/dist/{paths-POPTXJO6.js.map → package-SR2WB6MK.js.map} +0 -0
- /package/dist/{pay-WHBERZ3W.js.map → passphrase-IFTDS3CU.js.map} +0 -0
- /package/dist/{plugin-registration-5TIA564H.js.map → paths-XCSAKISU.js.map} +0 -0
- /package/dist/{redact-6W23GGJC.js.map → pay-OXC3WKYV.js.map} +0 -0
- /package/dist/{update-ZKUERSO2.js.map → plugin-registration-N3GRIZVM.js.map} +0 -0
- /package/dist/{usdc-OGOGEHV2.js.map → redact-D7ASVWKL.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-S3DA7DFW.js.map → runtime-fetch-EKFRNR6Z.js.map} +0 -0
- /package/dist/{wallet-2HA6W4R4.js.map → runtime-layout-BDWZG2TQ.js.map} +0 -0
|
@@ -1,45 +1,54 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
codexRouterEvent,
|
|
4
|
-
codexSession
|
|
5
|
-
} from "./chunk-OHRR5OYM.js";
|
|
6
2
|
import {
|
|
7
3
|
isPublicAddress
|
|
8
4
|
} from "./chunk-JKKAIPTU.js";
|
|
5
|
+
import {
|
|
6
|
+
codexRouterEvent,
|
|
7
|
+
codexSession
|
|
8
|
+
} from "./chunk-SFASB5FL.js";
|
|
9
9
|
import {
|
|
10
10
|
UNREACHABLE_BACKOFF_MS,
|
|
11
11
|
clearRouterMemo,
|
|
12
12
|
readRouterMemo,
|
|
13
13
|
requestToolAccess,
|
|
14
14
|
writeRouterMemo
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4USCZ2NI.js";
|
|
16
|
+
import {
|
|
17
|
+
canPayProvider,
|
|
18
|
+
canSign
|
|
19
|
+
} from "./chunk-62KNUYWD.js";
|
|
16
20
|
import {
|
|
17
21
|
readSpendSummary,
|
|
18
22
|
spentOf
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-SO3XRZPX.js";
|
|
20
24
|
import {
|
|
21
25
|
ChoicesSchema,
|
|
22
26
|
OfferSpecSchema,
|
|
23
27
|
ROUTER_PATH,
|
|
24
28
|
requestDecision
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import {
|
|
27
|
-
launchedByPlugin,
|
|
28
|
-
requestToolName
|
|
29
|
-
} from "./chunk-WJXLQXJY.js";
|
|
29
|
+
} from "./chunk-PKHI276N.js";
|
|
30
30
|
import {
|
|
31
31
|
FEE_REQUIRED,
|
|
32
32
|
depositSentence,
|
|
33
|
-
firstNoticeFor,
|
|
34
33
|
isFeeRequired,
|
|
35
34
|
unpaidSentence
|
|
36
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-HDPUXS3Z.js";
|
|
37
36
|
import {
|
|
38
37
|
evaluateSpendPolicy
|
|
39
38
|
} from "./chunk-2SNUOHAT.js";
|
|
39
|
+
import {
|
|
40
|
+
launchedByPlugin,
|
|
41
|
+
requestToolName
|
|
42
|
+
} from "./chunk-MPZUYCAP.js";
|
|
43
|
+
import {
|
|
44
|
+
proxyVariable
|
|
45
|
+
} from "./chunk-3FMZGI7I.js";
|
|
46
|
+
import {
|
|
47
|
+
composeUserAgent
|
|
48
|
+
} from "./chunk-OTWLERSW.js";
|
|
40
49
|
import {
|
|
41
50
|
mask
|
|
42
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-IADZOXKN.js";
|
|
43
52
|
import {
|
|
44
53
|
augmentOf,
|
|
45
54
|
bindDecision,
|
|
@@ -55,48 +64,48 @@ import {
|
|
|
55
64
|
sessionDir,
|
|
56
65
|
wasOffered,
|
|
57
66
|
writeProgress
|
|
58
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-IDTRSAHE.js";
|
|
59
68
|
import {
|
|
60
69
|
routerSettings
|
|
61
|
-
} from "./chunk-
|
|
62
|
-
import {
|
|
63
|
-
sessionServedByPlugin
|
|
64
|
-
} from "./chunk-I3EQFHCD.js";
|
|
65
|
-
import {
|
|
66
|
-
proxyVariable
|
|
67
|
-
} from "./chunk-S4SAZ7OD.js";
|
|
68
|
-
import {
|
|
69
|
-
composeUserAgent
|
|
70
|
-
} from "./chunk-AGZ7PJKY.js";
|
|
70
|
+
} from "./chunk-JEVQ5LKO.js";
|
|
71
71
|
import {
|
|
72
72
|
resolveContextSettings
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-AV5NZMYO.js";
|
|
74
74
|
import {
|
|
75
75
|
parseUsdToAtomic,
|
|
76
76
|
toMoney
|
|
77
77
|
} from "./chunk-Y527D4TV.js";
|
|
78
78
|
import {
|
|
79
|
-
|
|
79
|
+
noticeCleared,
|
|
80
|
+
noticeFor,
|
|
81
|
+
readWalletFacts,
|
|
82
|
+
sessionServedByPlugin,
|
|
83
|
+
settleCurrent
|
|
84
|
+
} from "./chunk-WOM257PW.js";
|
|
85
|
+
import {
|
|
86
|
+
WALLET_UNLOCKED,
|
|
87
|
+
agentFixFor
|
|
88
|
+
} from "./chunk-BFDQ4WNW.js";
|
|
89
|
+
import {
|
|
80
90
|
loadRawConfig,
|
|
81
91
|
resolveExperimentalBazaar,
|
|
82
92
|
resolveSettings
|
|
83
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-2GNOFONN.js";
|
|
94
|
+
import {
|
|
95
|
+
rememberingBalanceReader
|
|
96
|
+
} from "./chunk-DW4YTVR3.js";
|
|
84
97
|
import {
|
|
85
98
|
isSameDeployment
|
|
86
99
|
} from "./chunk-XQJXNMSB.js";
|
|
87
100
|
import {
|
|
88
|
-
|
|
89
|
-
} from "./chunk-
|
|
101
|
+
external_exports
|
|
102
|
+
} from "./chunk-SNNSAGMT.js";
|
|
90
103
|
import {
|
|
91
104
|
writeFileAtomic,
|
|
92
105
|
writeFileAtomicExclusive
|
|
93
106
|
} from "./chunk-7WEQQJLG.js";
|
|
94
|
-
import {
|
|
95
|
-
walletPath
|
|
96
|
-
} from "./chunk-SJLTEINJ.js";
|
|
97
107
|
|
|
98
108
|
// src/router/hooks.ts
|
|
99
|
-
import { readFile } from "node:fs/promises";
|
|
100
109
|
import { homedir } from "node:os";
|
|
101
110
|
|
|
102
111
|
// src/router/context.ts
|
|
@@ -1070,7 +1079,7 @@ async function spendShortfall(decision, deps, deadline) {
|
|
|
1070
1079
|
withheld: "offer needs approval",
|
|
1071
1080
|
note: `Note: ${price} ${detail}; request will pay nothing and return needs_approval with what it costs.`
|
|
1072
1081
|
});
|
|
1073
|
-
let
|
|
1082
|
+
let policy;
|
|
1074
1083
|
try {
|
|
1075
1084
|
const settings = await resolveContextSettings(hookContext(deps));
|
|
1076
1085
|
const ledger = await readSpendSummary(deps.dataDir, {
|
|
@@ -1081,37 +1090,55 @@ async function spendShortfall(decision, deps, deadline) {
|
|
|
1081
1090
|
creator: new URL(decision.endpoint).host,
|
|
1082
1091
|
sessionSpentAtomic: ledger === null ? 0n : spentOf(ledger)
|
|
1083
1092
|
});
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1093
|
+
policy = evaluation.decision !== "allow" ? approval(
|
|
1094
|
+
evaluation.reason === "above_auto_spend" ? `is above this machine's automatic per-call limit ($${toMoney(settings.policy.maxAutoSpendAtomic.toString()).usd})` : "needs approval under this machine's spend limits"
|
|
1095
|
+
) : { rpcUrl: settings.rpcUrl };
|
|
1096
|
+
} catch {
|
|
1097
|
+
policy = approval("needs approval under this machine's spend limits");
|
|
1098
|
+
}
|
|
1099
|
+
if (BigInt(decision.providerPriceAtomic) === 0n) return "rpcUrl" in policy ? null : policy;
|
|
1100
|
+
const facts = await readWalletFacts(deps.dataDir, deps.env ?? process.env);
|
|
1101
|
+
const sign = deps.signer?.() ?? canSign(facts);
|
|
1102
|
+
if (sign.status === "blocked") return cannotSign(sign);
|
|
1103
|
+
if (!("rpcUrl" in policy)) return policy;
|
|
1104
|
+
const { rpcUrl } = policy;
|
|
1105
|
+
let balance = null;
|
|
1106
|
+
if (facts.address !== null && facts.envKey !== "valid") {
|
|
1107
|
+
const readBalance = rememberingBalanceReader(deps.dataDir, {
|
|
1108
|
+
...deps.now !== void 0 ? { now: deps.now } : {}
|
|
1109
|
+
});
|
|
1110
|
+
balance = await readBalance(facts.address, rpcUrl, {
|
|
1111
|
+
timeoutMs: Math.min(BALANCE_TIMEOUT_MS, deadline - (deps.now?.() ?? Date.now())),
|
|
1112
|
+
...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {}
|
|
1113
|
+
});
|
|
1114
|
+
if (balance === null) {
|
|
1115
|
+
(deps.warn ?? ((line) => process.stderr.write(`${line}
|
|
1116
|
+
`)))(
|
|
1117
|
+
`tenjin hook: the wallet's USDC balance could not be read from ${new URL(rpcUrl).host}, so the spend policy alone decides`
|
|
1087
1118
|
);
|
|
1088
1119
|
}
|
|
1089
|
-
rpcUrl = settings.rpcUrl;
|
|
1090
|
-
} catch {
|
|
1091
|
-
return approval("needs approval under this machine's spend limits");
|
|
1092
1120
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
`)))(
|
|
1106
|
-
`tenjin hook: the wallet's USDC balance could not be read from ${new URL(rpcUrl).host}, so the spend policy alone decides`
|
|
1107
|
-
);
|
|
1108
|
-
return null;
|
|
1121
|
+
const v = canPayProvider(
|
|
1122
|
+
{ policy: { decision: "allow" }, sign, balanceAtomic: balance },
|
|
1123
|
+
BigInt(decision.providerPriceAtomic)
|
|
1124
|
+
);
|
|
1125
|
+
if (v.status !== "blocked" || v.reason === "needs_approval") return null;
|
|
1126
|
+
if (v.reason === "wallet_short") {
|
|
1127
|
+
if (balance === null) return null;
|
|
1128
|
+
const short = BigInt(decision.providerPriceAtomic) - balance;
|
|
1129
|
+
return {
|
|
1130
|
+
withheld: "wallet needs USDC",
|
|
1131
|
+
note: `Note: the wallet holds $${toMoney(balance.toString()).usd}, $${toMoney(short.toString()).usd} short of its ${price}; fund it with \`tenjin wallet fund\`.`
|
|
1132
|
+
};
|
|
1109
1133
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1134
|
+
return cannotSign(v);
|
|
1135
|
+
}
|
|
1136
|
+
function cannotSign(v) {
|
|
1137
|
+
return {
|
|
1138
|
+
withheld: "wallet cannot sign",
|
|
1139
|
+
note: `Note: Tenjin's wallet cannot pay for this (${v.detail}); ${agentFixFor(v.reason, v.fix)}`,
|
|
1140
|
+
signBlocked: true
|
|
1141
|
+
};
|
|
1115
1142
|
}
|
|
1116
1143
|
async function vetOffer(offer, deps, deadline, canAskUser) {
|
|
1117
1144
|
const shortfall = await spendShortfall(termsOf(offer), deps, deadline);
|
|
@@ -1119,7 +1146,7 @@ async function vetOffer(offer, deps, deadline, canAskUser) {
|
|
|
1119
1146
|
const note = await overCapNote(offer, deps, canAskUser);
|
|
1120
1147
|
return { offer: note === null ? offer : { ...offer, hint: `${offer.hint} ${note}` } };
|
|
1121
1148
|
}
|
|
1122
|
-
if (offer.action === "discovered" && canAskUser) {
|
|
1149
|
+
if (offer.action === "discovered" && canAskUser && shortfall.signBlocked !== true) {
|
|
1123
1150
|
return { offer: { ...offer, hint: `${offer.hint} ${shortfall.note}` } };
|
|
1124
1151
|
}
|
|
1125
1152
|
return { withheld: shortfall.withheld };
|
|
@@ -1157,15 +1184,6 @@ async function overCapNote(offer, deps, canAskUser) {
|
|
|
1157
1184
|
const which = over.length > 1 ? "those services" : "that service";
|
|
1158
1185
|
return `Note: ${prices} ${over.length > 1 ? "are" : "is"} above this machine's automatic per-call limit ($${toMoney(cap.toString()).usd}), so request returns needs_approval for ${which}; ` + (canAskUser ? "prefer one within the limit." : "use one within the limit.");
|
|
1159
1186
|
}
|
|
1160
|
-
async function walletAddress(dataDir) {
|
|
1161
|
-
try {
|
|
1162
|
-
const record2 = JSON.parse(await readFile(walletPath(dataDir), "utf8"));
|
|
1163
|
-
const address = record2?.address;
|
|
1164
|
-
return typeof address === "string" && /^0x[0-9a-fA-F]{40}$/.test(address) ? address : null;
|
|
1165
|
-
} catch {
|
|
1166
|
-
return null;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
1187
|
function agentLookup(cwd, deps) {
|
|
1170
1188
|
return { ...cwd !== void 0 ? { cwd } : {}, homeDir: deps.homeDir ?? homedir() };
|
|
1171
1189
|
}
|
|
@@ -1199,7 +1217,14 @@ async function offerOnUserText(event, text, hookEventName, deps) {
|
|
|
1199
1217
|
);
|
|
1200
1218
|
const footer = await openFooter(deps, event.sessionId, "prompt");
|
|
1201
1219
|
const deadline = gateDeadline(deps);
|
|
1202
|
-
const outcome = await decide(
|
|
1220
|
+
const outcome = await decide(
|
|
1221
|
+
sealed,
|
|
1222
|
+
deps,
|
|
1223
|
+
router.config,
|
|
1224
|
+
event.sessionId,
|
|
1225
|
+
deadline,
|
|
1226
|
+
footer.unpaid
|
|
1227
|
+
);
|
|
1203
1228
|
if (!isOffer(outcome)) {
|
|
1204
1229
|
await footer.close(outcome);
|
|
1205
1230
|
return { response: null, ...outcome !== null ? { action: outcome.action } : {} };
|
|
@@ -1274,7 +1299,14 @@ async function routeNativeCall(event, pending, deps, opts = {}) {
|
|
|
1274
1299
|
}
|
|
1275
1300
|
const footer = await openFooter(deps, event.sessionId, opts.operation ?? "search");
|
|
1276
1301
|
const deadline = gateDeadline(deps);
|
|
1277
|
-
const outcome = await decide(
|
|
1302
|
+
const outcome = await decide(
|
|
1303
|
+
sealed,
|
|
1304
|
+
deps,
|
|
1305
|
+
router.config,
|
|
1306
|
+
event.sessionId,
|
|
1307
|
+
deadline,
|
|
1308
|
+
footer.unpaid
|
|
1309
|
+
);
|
|
1278
1310
|
if (!isOffer(outcome)) {
|
|
1279
1311
|
await footer.close(outcome);
|
|
1280
1312
|
return {
|
|
@@ -1511,7 +1543,14 @@ async function runDelegationHook(raw, deps) {
|
|
|
1511
1543
|
if (sealed.packet.historyStatus !== "ok") return { response: null };
|
|
1512
1544
|
const footer = await openFooter(deps, event.sessionId, "delegate");
|
|
1513
1545
|
const deadline = gateDeadline(deps);
|
|
1514
|
-
const outcome = await decide(
|
|
1546
|
+
const outcome = await decide(
|
|
1547
|
+
sealed,
|
|
1548
|
+
deps,
|
|
1549
|
+
router.config,
|
|
1550
|
+
event.sessionId,
|
|
1551
|
+
deadline,
|
|
1552
|
+
footer.unpaid
|
|
1553
|
+
);
|
|
1515
1554
|
if (!isOffer(outcome)) {
|
|
1516
1555
|
await footer.close(outcome);
|
|
1517
1556
|
return { response: null, ...outcome !== null ? { action: outcome.action } : {} };
|
|
@@ -1553,7 +1592,11 @@ async function openFooter(deps, sessionId, operation) {
|
|
|
1553
1592
|
);
|
|
1554
1593
|
await pruneProgress(directory, now());
|
|
1555
1594
|
await pruneSessions(deps.dataDir, now());
|
|
1595
|
+
let unpaid;
|
|
1556
1596
|
return {
|
|
1597
|
+
unpaid: (why) => {
|
|
1598
|
+
unpaid = why;
|
|
1599
|
+
},
|
|
1557
1600
|
close: async (decision, opts) => {
|
|
1558
1601
|
const withheld = opts?.withheld;
|
|
1559
1602
|
await writeProgress(
|
|
@@ -1562,7 +1605,7 @@ async function openFooter(deps, sessionId, operation) {
|
|
|
1562
1605
|
{
|
|
1563
1606
|
phase: "done",
|
|
1564
1607
|
operation,
|
|
1565
|
-
outcome: withheld !== void 0 ? `native tools (${withheld})` : hookOutcome(decision)
|
|
1608
|
+
outcome: withheld !== void 0 ? `native tools (${withheld})` : hookOutcome(decision, unpaid)
|
|
1566
1609
|
},
|
|
1567
1610
|
now()
|
|
1568
1611
|
);
|
|
@@ -1579,13 +1622,16 @@ async function openFooter(deps, sessionId, operation) {
|
|
|
1579
1622
|
}
|
|
1580
1623
|
};
|
|
1581
1624
|
}
|
|
1582
|
-
function hookOutcome(decision) {
|
|
1583
|
-
if (decision === null) return "native tools (router unavailable)";
|
|
1625
|
+
function hookOutcome(decision, unpaid) {
|
|
1584
1626
|
if (isOffer(decision)) return `paid lookup offered (${termsOf(decision).provider})`;
|
|
1585
|
-
if (decision.action === "native")
|
|
1627
|
+
if (unpaid !== void 0 && (decision === null || decision.action === "native")) {
|
|
1628
|
+
return `fee unpaid: ${unpaid}`;
|
|
1629
|
+
}
|
|
1630
|
+
if (decision === null) return "native tools (router unavailable)";
|
|
1631
|
+
if (decision.action === "native") return "native tools (router chose native)";
|
|
1586
1632
|
return "needs input";
|
|
1587
1633
|
}
|
|
1588
|
-
async function decide({ packet }, deps, config, sessionId, deadline) {
|
|
1634
|
+
async function decide({ packet }, deps, config, sessionId, deadline, unpaid) {
|
|
1589
1635
|
const baseUrl = resolveBaseUrl(deps, config);
|
|
1590
1636
|
const warn = deps.warn ?? ((line) => process.stderr.write(`${line}
|
|
1591
1637
|
`));
|
|
@@ -1613,10 +1659,15 @@ async function decide({ packet }, deps, config, sessionId, deadline) {
|
|
|
1613
1659
|
const deposited = route?.deposited?.() ?? 0n;
|
|
1614
1660
|
if (deposited > 0n) deps.notice?.(depositSentence(deposited));
|
|
1615
1661
|
const why = outcome.status === "skipped" ? outcome.why : outcome.freePath ?? (outcome.status === "decided" && isFeeRequired(outcome.decision) ? FEE_REQUIRED : void 0);
|
|
1662
|
+
if (why !== void 0) unpaid?.(why);
|
|
1616
1663
|
const memoed = deps.route !== void 0 && route === null;
|
|
1617
1664
|
if (why !== void 0 && !(memoed && why === FEE_REQUIRED)) {
|
|
1618
1665
|
await tellOnce(deps, sessionId, why, now);
|
|
1619
1666
|
}
|
|
1667
|
+
if (route !== null && outcome.status === "decided" && outcome.freePath === void 0) {
|
|
1668
|
+
const cleared = await noticeCleared(deps.dataDir, sessionId, now).catch(() => null);
|
|
1669
|
+
if (cleared !== null) deps.notice?.(cleared);
|
|
1670
|
+
}
|
|
1620
1671
|
if (outcome.status === "decided" && isFeeRequired(outcome.decision)) {
|
|
1621
1672
|
await clearRouterMemo(deps.dataDir, "paid-path-absent", baseUrl);
|
|
1622
1673
|
}
|
|
@@ -1645,7 +1696,8 @@ async function decide({ packet }, deps, config, sessionId, deadline) {
|
|
|
1645
1696
|
async function tellOnce(deps, sessionId, why, now) {
|
|
1646
1697
|
const sentence = unpaidSentence(why);
|
|
1647
1698
|
if (sentence === null || deps.notice === void 0) return;
|
|
1648
|
-
|
|
1699
|
+
const told = await noticeFor(deps.dataDir, sessionId, why, now).catch(() => "quiet");
|
|
1700
|
+
if (told === "tell") deps.notice(sentence);
|
|
1649
1701
|
}
|
|
1650
1702
|
function nullStream() {
|
|
1651
1703
|
return { write: () => true };
|
|
@@ -1704,7 +1756,7 @@ async function runHookCommand(kind, io, deps) {
|
|
|
1704
1756
|
const raw = await (deps.readEvent ?? readStdin)();
|
|
1705
1757
|
const event = JSON.parse(raw);
|
|
1706
1758
|
if (deps.harness === "codex") {
|
|
1707
|
-
const { codexResponse } = await import("./codex-event-
|
|
1759
|
+
const { codexResponse } = await import("./codex-event-TYVES3UX.js");
|
|
1708
1760
|
response = codexResponse(await runHookKind(kind, event, deps));
|
|
1709
1761
|
} else {
|
|
1710
1762
|
if (!launchedByPlugin(deps.env) && await sessionServedByPlugin(deps.dataDir, event)) return;
|
|
@@ -1716,13 +1768,42 @@ async function runHookCommand(kind, io, deps) {
|
|
|
1716
1768
|
if (response !== null) io.stdout.write(`${JSON.stringify(response)}
|
|
1717
1769
|
`);
|
|
1718
1770
|
}
|
|
1771
|
+
function sessionIdOf(event) {
|
|
1772
|
+
if (event === null || typeof event !== "object") return null;
|
|
1773
|
+
const id = event.session_id;
|
|
1774
|
+
return typeof id === "string" && id.length > 0 && id.length <= 200 ? id : null;
|
|
1775
|
+
}
|
|
1719
1776
|
async function runHookKind(kind, event, hookDeps) {
|
|
1720
1777
|
const notices = /* @__PURE__ */ new Set();
|
|
1721
1778
|
const deps = { ...hookDeps, notice: (line) => notices.add(line) };
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1779
|
+
const sessionId = sessionIdOf(event);
|
|
1780
|
+
const news = sessionId !== null && hookDeps.walletNews !== void 0 ? await hookDeps.walletNews(sessionId).catch(() => null) : null;
|
|
1781
|
+
for (const line of news?.lines ?? []) notices.add(line);
|
|
1782
|
+
let response;
|
|
1783
|
+
try {
|
|
1784
|
+
if (sessionId !== null && news?.lines.includes(WALLET_UNLOCKED) === true) {
|
|
1785
|
+
await settleCurrent(hookDeps.dataDir, sessionId, hookDeps.now?.() ?? Date.now()).catch(
|
|
1786
|
+
() => void 0
|
|
1787
|
+
);
|
|
1788
|
+
}
|
|
1789
|
+
if (sessionId !== null && news?.told !== void 0) {
|
|
1790
|
+
await noticeFor(hookDeps.dataDir, sessionId, news.told, hookDeps.now?.() ?? Date.now()).catch(
|
|
1791
|
+
() => void 0
|
|
1792
|
+
);
|
|
1793
|
+
}
|
|
1794
|
+
const outcome = kind === "prompt" ? await runPromptHook(event, deps) : kind === "native" ? await runNativeHook(event, deps) : kind === "shortfall" ? await runShortfallHook(event, deps) : kind === "ask" ? await runAskHook(event, deps) : kind === "answer" ? await runAnswerHook(event, deps) : await runDelegationHook(event, deps);
|
|
1795
|
+
response = withNotices(outcome.response, notices);
|
|
1796
|
+
} catch (err) {
|
|
1797
|
+
news?.release();
|
|
1798
|
+
throw err;
|
|
1799
|
+
}
|
|
1800
|
+
if (news !== null) await news.ack().catch(() => void 0);
|
|
1801
|
+
return response;
|
|
1802
|
+
}
|
|
1803
|
+
function withNotices(response, notices) {
|
|
1804
|
+
if (notices.size === 0) return response;
|
|
1724
1805
|
const systemMessage = [...notices].join("\n");
|
|
1725
|
-
return
|
|
1806
|
+
return response === null || typeof response !== "object" ? { systemMessage } : { ...response, systemMessage };
|
|
1726
1807
|
}
|
|
1727
1808
|
async function readStdin() {
|
|
1728
1809
|
return new Promise((resolve, reject) => {
|
|
@@ -1765,4 +1846,4 @@ export {
|
|
|
1765
1846
|
runHookCommand,
|
|
1766
1847
|
runHookKind
|
|
1767
1848
|
};
|
|
1768
|
-
//# sourceMappingURL=chunk-
|
|
1849
|
+
//# sourceMappingURL=chunk-JRZBBPO6.js.map
|