tenjin-cli 0.1.0-alpha.34 → 0.1.0-alpha.35
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/NOTICE.md +30 -0
- package/README.md +20 -18
- package/dist/{_esm-MMYV66AX.js → _esm-2KST7HQ7.js} +4 -4
- package/dist/{alive-VOIL5W3I.js → alive-5TV22PNF.js} +13 -13
- package/dist/{auth-UHD3QFX4.js → auth-XI7BJFLW.js} +4 -4
- package/dist/balance-DFHC6XEU.js +71 -0
- package/dist/{ccip-CS7K5QRQ.js → ccip-HOW3DZYF.js} +3 -3
- package/dist/{chunk-RJ5HRPAZ.js → chunk-24XKUN2S.js} +68 -10
- package/dist/chunk-24XKUN2S.js.map +1 -0
- package/dist/chunk-2L7TDGLV.js +56 -0
- package/dist/chunk-2L7TDGLV.js.map +1 -0
- package/dist/{chunk-PZHBPGDE.js → chunk-34SAECKZ.js} +34 -10
- package/dist/chunk-34SAECKZ.js.map +1 -0
- package/dist/{chunk-EQZ2CCWC.js → chunk-3Y2EHT4F.js} +5 -2
- package/dist/chunk-3Y2EHT4F.js.map +1 -0
- package/dist/{chunk-FSYH7J75.js → chunk-3Y6BHIN6.js} +3 -3
- package/dist/{chunk-FZZWTDWP.js → chunk-3YPL6T3P.js} +6 -6
- package/dist/{chunk-JEZMWJEF.js → chunk-44MVIRZH.js} +4 -4
- package/dist/{chunk-27FIHFXF.js → chunk-45MMSBHA.js} +5 -5
- package/dist/{chunk-QXP3Z3JN.js → chunk-4MBCJFY4.js} +35 -3
- package/dist/chunk-4MBCJFY4.js.map +1 -0
- package/dist/chunk-4TPL54KW.js +227 -0
- package/dist/chunk-4TPL54KW.js.map +1 -0
- package/dist/{chunk-7JB6SYJX.js → chunk-54ELBTKE.js} +2 -2
- package/dist/{chunk-6J64MQFD.js → chunk-5F4OB5B3.js} +21 -15
- package/dist/chunk-5F4OB5B3.js.map +1 -0
- package/dist/{chunk-PYVQ74D5.js → chunk-5HN4KVQU.js} +189 -117
- package/dist/chunk-5HN4KVQU.js.map +1 -0
- package/dist/{chunk-VFKPIIV2.js → chunk-5J4E5GYI.js} +35 -32
- package/dist/chunk-5J4E5GYI.js.map +1 -0
- package/dist/chunk-5USBZ2MU.js +58 -0
- package/dist/chunk-5USBZ2MU.js.map +1 -0
- package/dist/chunk-64WOMNYR.js +183 -0
- package/dist/chunk-64WOMNYR.js.map +1 -0
- package/dist/{chunk-APWELUI7.js → chunk-65RS4LQS.js} +57 -43
- package/dist/chunk-65RS4LQS.js.map +1 -0
- package/dist/{chunk-HWZO6HYZ.js → chunk-6QMDUDF2.js} +3 -3
- package/dist/{chunk-FNBGRKS6.js → chunk-7V25UAQO.js} +2 -2
- package/dist/chunk-BGA4DO5M.js +719 -0
- package/dist/chunk-BGA4DO5M.js.map +1 -0
- package/dist/chunk-BVP7YK2J.js +706 -0
- package/dist/chunk-BVP7YK2J.js.map +1 -0
- package/dist/chunk-C265QIMJ.js +83 -0
- package/dist/chunk-C265QIMJ.js.map +1 -0
- package/dist/{chunk-MXN2ZEUB.js → chunk-D6M3ZK66.js} +2 -2
- package/dist/chunk-D6M3ZK66.js.map +1 -0
- package/dist/chunk-DJ36BM62.js +78 -0
- package/dist/chunk-DJ36BM62.js.map +1 -0
- package/dist/{chunk-JOKPBYXP.js → chunk-DTEWAVNE.js} +2 -2
- package/dist/chunk-F2KJAJ7T.js +13 -0
- package/dist/chunk-F2KJAJ7T.js.map +1 -0
- package/dist/{chunk-KAILF7QA.js → chunk-F43CV6UC.js} +2 -2
- package/dist/{chunk-ACO7ZCR2.js → chunk-FKVJKLPI.js} +2 -2
- package/dist/{chunk-43HLS2HM.js → chunk-FYFHH7V5.js} +54 -3
- package/dist/{chunk-43HLS2HM.js.map → chunk-FYFHH7V5.js.map} +1 -1
- package/dist/{chunk-2F5JUAHZ.js → chunk-GAJC4BQZ.js} +3 -3
- package/dist/{chunk-L7N73ZAW.js → chunk-HAZAN4UM.js} +2 -2
- package/dist/{chunk-6QJZA6EX.js → chunk-HI5XQOX2.js} +2 -2
- package/dist/{chunk-BOENA6XR.js → chunk-HKGUKAQW.js} +6 -6
- package/dist/{chunk-LJSCGIYH.js → chunk-HPRVFJPM.js} +2 -2
- package/dist/{chunk-OO6FIBL7.js → chunk-HZKANST2.js} +3 -6
- package/dist/chunk-HZKANST2.js.map +1 -0
- package/dist/{chunk-UVDJ5SSQ.js → chunk-I557SAOM.js} +8 -2
- package/dist/chunk-I557SAOM.js.map +1 -0
- package/dist/{chunk-SDUOJRSV.js → chunk-IGLWLH73.js} +3 -3
- package/dist/{chunk-3AKH7ODX.js → chunk-INSIW65E.js} +5 -5
- package/dist/{chunk-PNHNXUSL.js → chunk-IULCDMVG.js} +12 -1
- package/dist/chunk-IULCDMVG.js.map +1 -0
- package/dist/{chunk-JF4T4HCQ.js → chunk-IVNSUAVC.js} +10 -5
- package/dist/chunk-IVNSUAVC.js.map +1 -0
- package/dist/chunk-JDQZCREI.js +87 -0
- package/dist/chunk-JDQZCREI.js.map +1 -0
- package/dist/{chunk-2P3NJTHE.js → chunk-JHFFUVON.js} +23 -23
- package/dist/{chunk-7JVARP5R.js → chunk-JTILUN4W.js} +55 -29
- package/dist/{chunk-7JVARP5R.js.map → chunk-JTILUN4W.js.map} +1 -1
- package/dist/{chunk-2TO5F6CT.js → chunk-K5KNGC4I.js} +8 -8
- package/dist/{chunk-HUWTFKEM.js → chunk-KAQ4Q3TO.js} +3 -3
- package/dist/{chunk-E6VP6MQM.js → chunk-KGUE5AVX.js} +4 -4
- package/dist/chunk-KGUE5AVX.js.map +1 -0
- package/dist/{chunk-GS5RZF7U.js → chunk-KLDMLWXT.js} +2 -2
- package/dist/{chunk-HN2EN6P4.js → chunk-KNKDMTHU.js} +5 -5
- package/dist/chunk-LDA6TAYQ.js +95 -0
- package/dist/chunk-LDA6TAYQ.js.map +1 -0
- package/dist/chunk-LWSSIZOY.js +347 -0
- package/dist/chunk-LWSSIZOY.js.map +1 -0
- package/dist/{chunk-5VWQSCDO.js → chunk-MAHNZA6C.js} +89 -9
- package/dist/chunk-MAHNZA6C.js.map +1 -0
- package/dist/{chunk-46HAB26L.js → chunk-MEWZCIA6.js} +56 -9
- package/dist/chunk-MEWZCIA6.js.map +1 -0
- package/dist/{chunk-R2KMLONN.js → chunk-MJDO4EXD.js} +4 -4
- package/dist/{chunk-IHVUE3XF.js → chunk-NJA6NT3A.js} +3 -3
- package/dist/{chunk-TSIID2LV.js → chunk-ODRPASFP.js} +375 -1166
- package/dist/chunk-ODRPASFP.js.map +1 -0
- package/dist/{chunk-S3JKF3IK.js → chunk-OJJFANO6.js} +3 -3
- package/dist/{chunk-56SOPRM2.js → chunk-OQWPRFAC.js} +344 -4
- package/dist/chunk-OQWPRFAC.js.map +1 -0
- package/dist/{chunk-QEZZDIQT.js → chunk-P6YQWIT2.js} +4053 -4039
- package/dist/chunk-P6YQWIT2.js.map +1 -0
- package/dist/{chunk-GGGEGMWC.js → chunk-Q6RSJCXB.js} +9 -9
- package/dist/{chunk-OTIUEUIS.js → chunk-QKEUKBRK.js} +7 -7
- package/dist/{chunk-X52BVGCJ.js → chunk-QQDPRTLP.js} +5 -5
- package/dist/chunk-QQYCYAKI.js +79 -0
- package/dist/chunk-QQYCYAKI.js.map +1 -0
- package/dist/chunk-R4KDH477.js +1064 -0
- package/dist/chunk-R4KDH477.js.map +1 -0
- package/dist/{chunk-6AQSUBNR.js → chunk-RGCPELQN.js} +2 -2
- package/dist/{chunk-AXODGQ23.js → chunk-RGVCOG2S.js} +9 -2
- package/dist/{chunk-AXODGQ23.js.map → chunk-RGVCOG2S.js.map} +1 -1
- package/dist/chunk-SOLNJ3AZ.js +209 -0
- package/dist/chunk-SOLNJ3AZ.js.map +1 -0
- package/dist/{chunk-LQ33RLHL.js → chunk-TFT2X7SH.js} +3 -3
- package/dist/chunk-TVWCLUBI.js +293 -0
- package/dist/chunk-TVWCLUBI.js.map +1 -0
- package/dist/{chunk-VH7JMLTG.js → chunk-UIB33QQP.js} +25 -16
- package/dist/chunk-UIB33QQP.js.map +1 -0
- package/dist/chunk-V6GIVALQ.js +1889 -0
- package/dist/chunk-V6GIVALQ.js.map +1 -0
- package/dist/{chunk-IVHGQNIN.js → chunk-VHXCPXUS.js} +8 -8
- package/dist/{chunk-7DW7GAM6.js → chunk-VU6GMWF6.js} +2 -2
- package/dist/chunk-VWZYE3NC.js +8415 -0
- package/dist/chunk-VWZYE3NC.js.map +1 -0
- package/dist/{chunk-3X4GOMXT.js → chunk-W2GXIARJ.js} +12 -7
- package/dist/chunk-W2GXIARJ.js.map +1 -0
- package/dist/chunk-W4G3K3V7.js +288 -0
- package/dist/chunk-W4G3K3V7.js.map +1 -0
- package/dist/{chunk-FHXTEVO7.js → chunk-W74LJ5OT.js} +21 -28
- package/dist/chunk-W74LJ5OT.js.map +1 -0
- package/dist/{chunk-FOEPH67T.js → chunk-W7ELYLYK.js} +1 -74
- package/dist/chunk-W7ELYLYK.js.map +1 -0
- package/dist/{chunk-YU3DLVSQ.js → chunk-XSCGUO2U.js} +5 -5
- package/dist/{chunk-EPCIJLLU.js → chunk-XWROSMI5.js} +9 -9
- package/dist/{chunk-HMT6L65V.js → chunk-YJGEVBKZ.js} +4 -4
- package/dist/{chunk-7U3P4PB7.js → chunk-ZEYA2WWX.js} +4 -4
- package/dist/chunk-ZEYA2WWX.js.map +1 -0
- package/dist/chunk-ZRC7Z5X3.js +82 -0
- package/dist/chunk-ZRC7Z5X3.js.map +1 -0
- package/dist/{chunk-I47ARU5G.js → chunk-ZS7JIUJ3.js} +2 -2
- package/dist/{claude-cli-2YKABJJZ.js → claude-cli-GIIHOBGT.js} +4 -2
- package/dist/claude-install-BAUSJMW3.js +64 -0
- package/dist/{cli-BFDKEX53.js → cli-QY4KKA3D.js} +116 -49
- package/dist/cli-QY4KKA3D.js.map +1 -0
- package/dist/{client-XMWEKXX7.js → client-3YQKORVK.js} +4 -4
- package/dist/{codex-host-B6NAUWL6.js → codex-host-ZON3S6HU.js} +5 -5
- package/dist/{codex-install-GTGO5FYN.js → codex-install-HZV2DOAB.js} +62 -47
- package/dist/codex-install-HZV2DOAB.js.map +1 -0
- package/dist/{config-THJANIU5.js → config-QZOBMTEL.js} +18 -18
- package/dist/{config-names-JU54HYWY.js → config-names-Z5NZD5R2.js} +18 -18
- package/dist/{config-rules-VNU23RL4.js → config-rules-YOYHS6YL.js} +19 -19
- package/dist/config-subagents-WQV2ZAD5.js +362 -0
- package/dist/config-subagents-WQV2ZAD5.js.map +1 -0
- package/dist/{connect-HPWS7U63.js → connect-YDWTYU4B.js} +28 -27
- package/dist/{connect-HPWS7U63.js.map → connect-YDWTYU4B.js.map} +1 -1
- package/dist/core-0a66n3e7-TTP554XV.js +127 -0
- package/dist/core-0a66n3e7-TTP554XV.js.map +1 -0
- package/dist/core-0bmnpbz2-C2JIRVZO.js +10790 -0
- package/dist/core-0bmnpbz2-C2JIRVZO.js.map +1 -0
- package/dist/core-9je8ee1j-74DGHWPV.js +30 -0
- package/dist/core-9je8ee1j-74DGHWPV.js.map +1 -0
- package/dist/core-wadgcjfh-TSZFQZGH.js +666 -0
- package/dist/core-wadgcjfh-TSZFQZGH.js.map +1 -0
- package/dist/core-zg882d22-LKV5DZYW.js +37 -0
- package/dist/core-zg882d22-LKV5DZYW.js.map +1 -0
- package/dist/{decision-JIIHDTOF.js → decision-QSKHOGCO.js} +6 -6
- package/dist/{doctor-4MMHBRDU.js → doctor-ZWJXRD75.js} +67 -66
- package/dist/doctor-ZWJXRD75.js.map +1 -0
- package/dist/{explicit-AGENAX6E.js → explicit-ME2NRADQ.js} +45 -42
- package/dist/{explicit-AGENAX6E.js.map → explicit-ME2NRADQ.js.map} +1 -1
- package/dist/flush-stdio-NYIJ3QXT.js +18 -0
- package/dist/{fund-MLXUH24Q.js → fund-VF7TLDJH.js} +110 -34
- package/dist/fund-VF7TLDJH.js.map +1 -0
- package/dist/{hook-command-UB7FOEUL.js → hook-command-VZ27MGWO.js} +21 -20
- 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/hooks/hook-data.ts +152 -0
- package/dist/hosts/claude/tenjin/hooks/hooks.json +7 -0
- package/dist/hosts/claude/tenjin/hooks/model-viewer.tsx +2987 -0
- package/dist/hosts/claude/tenjin/hooks/register.tsx +265 -30
- package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +14 -4
- package/dist/hosts/claude/tenjin/types/index.d.ts +133 -0
- package/dist/{hosts-WNQKYKP2.js → hosts-3EMTVM4H.js} +5 -3
- package/dist/index.js +16 -13
- package/dist/index.js.map +1 -1
- package/dist/{install-Q5SHHEDH.js → install-ZA7L2UF3.js} +34 -30
- package/dist/{install-funding-EGSW2KEP.js → install-funding-JDGYTF72.js} +9 -13
- package/dist/{install-identity-OID43B4D.js → install-identity-FFAYEFLX.js} +8 -8
- package/dist/{install-wallet-TZFWY5GK.js → install-wallet-2SFOVE3Q.js} +48 -33
- package/dist/{install-wallet-TZFWY5GK.js.map → install-wallet-2SFOVE3Q.js.map} +1 -1
- package/dist/mcp-36S6MK3C.js +67642 -0
- package/dist/mcp-36S6MK3C.js.map +1 -0
- package/dist/new-install-5L4GY3LN.js +51 -0
- package/dist/{package-NRHU7HBR.js → package-BONDXSV3.js} +2 -2
- package/dist/{passphrase-3JEVW5XG.js → passphrase-T4ULBN4M.js} +4 -4
- package/dist/{pay-I47AIUQR.js → pay-CMV5KL74.js} +37 -30
- package/dist/{payments-A5FNI5GN.js → payments-Z6UBZL4Z.js} +10 -10
- package/dist/reclaim-subagent-credit-ABSF67SJ.js +105 -0
- package/dist/reclaim-subagent-credit-ABSF67SJ.js.map +1 -0
- package/dist/{routing-quote-QQW2I5MH.js → routing-quote-AHLAREXR.js} +16 -18
- package/dist/{run-4SHEOBIU.js → run-JH7ELYAM.js} +41 -38
- package/dist/{runtime-BABJMHY7.js → runtime-2GX4ALJP.js} +12 -12
- package/dist/{runtime-activate-N6VLQI2C.js → runtime-activate-IDQ2NCSP.js} +9 -9
- package/dist/{runtime-launchers-GMAUICRW.js → runtime-launchers-YAPKCBHV.js} +7 -7
- package/dist/{runtime-place-DOEWFTF3.js → runtime-place-4POL4KK4.js} +3 -3
- package/dist/{send-ECXS6JEO.js → send-ELXFKEKY.js} +17 -17
- package/dist/{status-AHE5HSR7.js → status-FXUFWJDM.js} +89 -36
- package/dist/status-FXUFWJDM.js.map +1 -0
- package/dist/{status-line-63XFJAXR.js → status-line-IH5JBWBC.js} +11 -11
- package/dist/{streamableHttp-Z3YF6LTQ.js → streamableHttp-CP2ZQBIK.js} +4 -4
- package/dist/{uninstall-YGQPRCVY.js → uninstall-LJZUKM4D.js} +42 -38
- package/dist/{uninstall-YGQPRCVY.js.map → uninstall-LJZUKM4D.js.map} +1 -1
- package/dist/{update-GTLMLFA3.js → update-EUIX72IX.js} +34 -30
- package/dist/{usage-FCWP2CHO.js → usage-EKDC7LUC.js} +13 -13
- package/dist/{usdc-25RNBYYR.js → usdc-YIHK2OMC.js} +5 -5
- package/dist/{viemAdapter-By13KInL-3CG63XDX.js → viemAdapter-By13KInL-PRLSIESK.js} +2 -2
- package/dist/viemAdapter-By13KInL-PRLSIESK.js.map +1 -0
- package/dist/wallet-HSW757W6.js +80 -0
- package/dist/wallet-HSW757W6.js.map +1 -0
- package/docs/agent-permissions.md +19 -11
- package/docs/router-reference.md +21 -12
- package/docs/safety-model.md +4 -2
- package/docs/subagents-internals.md +97 -0
- package/docs/subagents.md +348 -0
- package/package.json +4 -1
- package/dist/balance-RQW5T5FB.js +0 -55
- package/dist/chunk-3X4GOMXT.js.map +0 -1
- package/dist/chunk-46HAB26L.js.map +0 -1
- package/dist/chunk-56SOPRM2.js.map +0 -1
- package/dist/chunk-5VWQSCDO.js.map +0 -1
- package/dist/chunk-6J64MQFD.js.map +0 -1
- package/dist/chunk-7U3P4PB7.js.map +0 -1
- package/dist/chunk-APWELUI7.js.map +0 -1
- package/dist/chunk-E6VP6MQM.js.map +0 -1
- package/dist/chunk-EQZ2CCWC.js.map +0 -1
- package/dist/chunk-FHXTEVO7.js.map +0 -1
- package/dist/chunk-FOEPH67T.js.map +0 -1
- package/dist/chunk-IVXPIIZJ.js +0 -91
- package/dist/chunk-IVXPIIZJ.js.map +0 -1
- package/dist/chunk-JF4T4HCQ.js.map +0 -1
- package/dist/chunk-LPQNZKSG.js +0 -269
- package/dist/chunk-LPQNZKSG.js.map +0 -1
- package/dist/chunk-MXN2ZEUB.js.map +0 -1
- package/dist/chunk-OO6FIBL7.js.map +0 -1
- package/dist/chunk-PNHNXUSL.js.map +0 -1
- package/dist/chunk-PYVQ74D5.js.map +0 -1
- package/dist/chunk-PZHBPGDE.js.map +0 -1
- package/dist/chunk-QEZZDIQT.js.map +0 -1
- package/dist/chunk-QXP3Z3JN.js.map +0 -1
- package/dist/chunk-RJ5HRPAZ.js.map +0 -1
- package/dist/chunk-TSIID2LV.js.map +0 -1
- package/dist/chunk-UVDJ5SSQ.js.map +0 -1
- package/dist/chunk-VFKPIIV2.js.map +0 -1
- package/dist/chunk-VH7JMLTG.js.map +0 -1
- package/dist/claude-install-7CVYQ73E.js +0 -60
- package/dist/cli-BFDKEX53.js.map +0 -1
- package/dist/codex-install-GTGO5FYN.js.map +0 -1
- package/dist/doctor-4MMHBRDU.js.map +0 -1
- package/dist/fund-MLXUH24Q.js.map +0 -1
- package/dist/mcp-CC3H7LFO.js +0 -3655
- package/dist/mcp-CC3H7LFO.js.map +0 -1
- package/dist/status-AHE5HSR7.js.map +0 -1
- package/dist/wallet-CJGEHP2Q.js +0 -64
- /package/dist/{_esm-MMYV66AX.js.map → _esm-2KST7HQ7.js.map} +0 -0
- /package/dist/{alive-VOIL5W3I.js.map → alive-5TV22PNF.js.map} +0 -0
- /package/dist/{auth-UHD3QFX4.js.map → auth-XI7BJFLW.js.map} +0 -0
- /package/dist/{balance-RQW5T5FB.js.map → balance-DFHC6XEU.js.map} +0 -0
- /package/dist/{ccip-CS7K5QRQ.js.map → ccip-HOW3DZYF.js.map} +0 -0
- /package/dist/{chunk-FSYH7J75.js.map → chunk-3Y6BHIN6.js.map} +0 -0
- /package/dist/{chunk-FZZWTDWP.js.map → chunk-3YPL6T3P.js.map} +0 -0
- /package/dist/{chunk-JEZMWJEF.js.map → chunk-44MVIRZH.js.map} +0 -0
- /package/dist/{chunk-27FIHFXF.js.map → chunk-45MMSBHA.js.map} +0 -0
- /package/dist/{chunk-7JB6SYJX.js.map → chunk-54ELBTKE.js.map} +0 -0
- /package/dist/{chunk-HWZO6HYZ.js.map → chunk-6QMDUDF2.js.map} +0 -0
- /package/dist/{chunk-FNBGRKS6.js.map → chunk-7V25UAQO.js.map} +0 -0
- /package/dist/{chunk-JOKPBYXP.js.map → chunk-DTEWAVNE.js.map} +0 -0
- /package/dist/{chunk-KAILF7QA.js.map → chunk-F43CV6UC.js.map} +0 -0
- /package/dist/{chunk-ACO7ZCR2.js.map → chunk-FKVJKLPI.js.map} +0 -0
- /package/dist/{chunk-2F5JUAHZ.js.map → chunk-GAJC4BQZ.js.map} +0 -0
- /package/dist/{chunk-L7N73ZAW.js.map → chunk-HAZAN4UM.js.map} +0 -0
- /package/dist/{chunk-6QJZA6EX.js.map → chunk-HI5XQOX2.js.map} +0 -0
- /package/dist/{chunk-BOENA6XR.js.map → chunk-HKGUKAQW.js.map} +0 -0
- /package/dist/{chunk-LJSCGIYH.js.map → chunk-HPRVFJPM.js.map} +0 -0
- /package/dist/{chunk-SDUOJRSV.js.map → chunk-IGLWLH73.js.map} +0 -0
- /package/dist/{chunk-3AKH7ODX.js.map → chunk-INSIW65E.js.map} +0 -0
- /package/dist/{chunk-2P3NJTHE.js.map → chunk-JHFFUVON.js.map} +0 -0
- /package/dist/{chunk-2TO5F6CT.js.map → chunk-K5KNGC4I.js.map} +0 -0
- /package/dist/{chunk-HUWTFKEM.js.map → chunk-KAQ4Q3TO.js.map} +0 -0
- /package/dist/{chunk-GS5RZF7U.js.map → chunk-KLDMLWXT.js.map} +0 -0
- /package/dist/{chunk-HN2EN6P4.js.map → chunk-KNKDMTHU.js.map} +0 -0
- /package/dist/{chunk-R2KMLONN.js.map → chunk-MJDO4EXD.js.map} +0 -0
- /package/dist/{chunk-IHVUE3XF.js.map → chunk-NJA6NT3A.js.map} +0 -0
- /package/dist/{chunk-S3JKF3IK.js.map → chunk-OJJFANO6.js.map} +0 -0
- /package/dist/{chunk-GGGEGMWC.js.map → chunk-Q6RSJCXB.js.map} +0 -0
- /package/dist/{chunk-OTIUEUIS.js.map → chunk-QKEUKBRK.js.map} +0 -0
- /package/dist/{chunk-X52BVGCJ.js.map → chunk-QQDPRTLP.js.map} +0 -0
- /package/dist/{chunk-6AQSUBNR.js.map → chunk-RGCPELQN.js.map} +0 -0
- /package/dist/{chunk-LQ33RLHL.js.map → chunk-TFT2X7SH.js.map} +0 -0
- /package/dist/{chunk-IVHGQNIN.js.map → chunk-VHXCPXUS.js.map} +0 -0
- /package/dist/{chunk-7DW7GAM6.js.map → chunk-VU6GMWF6.js.map} +0 -0
- /package/dist/{chunk-YU3DLVSQ.js.map → chunk-XSCGUO2U.js.map} +0 -0
- /package/dist/{chunk-EPCIJLLU.js.map → chunk-XWROSMI5.js.map} +0 -0
- /package/dist/{chunk-HMT6L65V.js.map → chunk-YJGEVBKZ.js.map} +0 -0
- /package/dist/{chunk-I47ARU5G.js.map → chunk-ZS7JIUJ3.js.map} +0 -0
- /package/dist/{claude-cli-2YKABJJZ.js.map → claude-cli-GIIHOBGT.js.map} +0 -0
- /package/dist/{claude-install-7CVYQ73E.js.map → claude-install-BAUSJMW3.js.map} +0 -0
- /package/dist/{client-XMWEKXX7.js.map → client-3YQKORVK.js.map} +0 -0
- /package/dist/{codex-host-B6NAUWL6.js.map → codex-host-ZON3S6HU.js.map} +0 -0
- /package/dist/{config-THJANIU5.js.map → config-QZOBMTEL.js.map} +0 -0
- /package/dist/{config-names-JU54HYWY.js.map → config-names-Z5NZD5R2.js.map} +0 -0
- /package/dist/{config-rules-VNU23RL4.js.map → config-rules-YOYHS6YL.js.map} +0 -0
- /package/dist/{decision-JIIHDTOF.js.map → decision-QSKHOGCO.js.map} +0 -0
- /package/dist/{hook-command-UB7FOEUL.js.map → flush-stdio-NYIJ3QXT.js.map} +0 -0
- /package/dist/{hosts-WNQKYKP2.js.map → hook-command-VZ27MGWO.js.map} +0 -0
- /package/dist/{install-Q5SHHEDH.js.map → hosts-3EMTVM4H.js.map} +0 -0
- /package/dist/{install-funding-EGSW2KEP.js.map → install-ZA7L2UF3.js.map} +0 -0
- /package/dist/{install-identity-OID43B4D.js.map → install-funding-JDGYTF72.js.map} +0 -0
- /package/dist/{package-NRHU7HBR.js.map → install-identity-FFAYEFLX.js.map} +0 -0
- /package/dist/{passphrase-3JEVW5XG.js.map → new-install-5L4GY3LN.js.map} +0 -0
- /package/dist/{pay-I47AIUQR.js.map → package-BONDXSV3.js.map} +0 -0
- /package/dist/{routing-quote-QQW2I5MH.js.map → passphrase-T4ULBN4M.js.map} +0 -0
- /package/dist/{run-4SHEOBIU.js.map → pay-CMV5KL74.js.map} +0 -0
- /package/dist/{payments-A5FNI5GN.js.map → payments-Z6UBZL4Z.js.map} +0 -0
- /package/dist/{runtime-activate-N6VLQI2C.js.map → routing-quote-AHLAREXR.js.map} +0 -0
- /package/dist/{runtime-launchers-GMAUICRW.js.map → run-JH7ELYAM.js.map} +0 -0
- /package/dist/{runtime-BABJMHY7.js.map → runtime-2GX4ALJP.js.map} +0 -0
- /package/dist/{runtime-place-DOEWFTF3.js.map → runtime-activate-IDQ2NCSP.js.map} +0 -0
- /package/dist/{update-GTLMLFA3.js.map → runtime-launchers-YAPKCBHV.js.map} +0 -0
- /package/dist/{usdc-25RNBYYR.js.map → runtime-place-4POL4KK4.js.map} +0 -0
- /package/dist/{send-ECXS6JEO.js.map → send-ELXFKEKY.js.map} +0 -0
- /package/dist/{status-line-63XFJAXR.js.map → status-line-IH5JBWBC.js.map} +0 -0
- /package/dist/{streamableHttp-Z3YF6LTQ.js.map → streamableHttp-CP2ZQBIK.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-3CG63XDX.js.map → update-EUIX72IX.js.map} +0 -0
- /package/dist/{usage-FCWP2CHO.js.map → usage-EKDC7LUC.js.map} +0 -0
- /package/dist/{wallet-CJGEHP2Q.js.map → usdc-YIHK2OMC.js.map} +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
LEGACY_ROUTING_QUOTE_ATOMIC,
|
|
4
|
+
unpaid
|
|
5
|
+
} from "./chunk-HZKANST2.js";
|
|
6
|
+
import {
|
|
7
|
+
PRIVATE,
|
|
8
|
+
writePrivate
|
|
9
|
+
} from "./chunk-ILWCKCOI.js";
|
|
10
|
+
import {
|
|
11
|
+
UNKNOWN_DETAIL,
|
|
12
|
+
WALLET_REASONS
|
|
13
|
+
} from "./chunk-RFZA7PSM.js";
|
|
14
|
+
import {
|
|
15
|
+
DEFINITE_UNLOCK
|
|
16
|
+
} from "./chunk-JUUBBBY5.js";
|
|
17
|
+
import {
|
|
18
|
+
writeFileAtomicExclusive
|
|
19
|
+
} from "./chunk-7WEQQJLG.js";
|
|
20
|
+
import {
|
|
21
|
+
hasCode
|
|
22
|
+
} from "./chunk-3MZ7DYRO.js";
|
|
23
|
+
import {
|
|
24
|
+
sha256Hex
|
|
25
|
+
} from "./chunk-RGCPELQN.js";
|
|
26
|
+
|
|
27
|
+
// src/router/eligibility.ts
|
|
28
|
+
function unlockBlocked(reason, fix) {
|
|
29
|
+
const r = WALLET_REASONS[reason];
|
|
30
|
+
return { status: "blocked", reason, detail: r.reason, fix: fix ?? r.fix };
|
|
31
|
+
}
|
|
32
|
+
function unknown(reason, detail) {
|
|
33
|
+
return {
|
|
34
|
+
status: "unknown",
|
|
35
|
+
reason,
|
|
36
|
+
detail: UNKNOWN_DETAIL[reason] ?? detail ?? UNKNOWN_DETAIL["check_failed"]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function ready(source, warning) {
|
|
40
|
+
return {
|
|
41
|
+
status: "ready",
|
|
42
|
+
...source !== void 0 ? { source } : {},
|
|
43
|
+
...warning !== void 0 ? { warning } : {}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function moneyBlocked(reason) {
|
|
47
|
+
const u = unpaid(reason);
|
|
48
|
+
return {
|
|
49
|
+
status: "blocked",
|
|
50
|
+
reason,
|
|
51
|
+
detail: u?.reason ?? reason,
|
|
52
|
+
fix: u?.fix ?? "Run `tenjin doctor`."
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function canSign(f) {
|
|
56
|
+
if (f.envKey === "valid") return ready("key-env");
|
|
57
|
+
if (f.envKey === "malformed") return unlockBlocked("env_key_invalid");
|
|
58
|
+
if (f.walletFile === "absent") return unlockBlocked("no_wallet");
|
|
59
|
+
if (f.walletFile === "unparsable") return unlockBlocked("wallet_corrupt");
|
|
60
|
+
const envPassphraseSet = f.envPassphraseSet === true;
|
|
61
|
+
if (f.unlock !== void 0) {
|
|
62
|
+
if (f.unlock.ok) return ready(f.unlock.source, f.unlock.warning);
|
|
63
|
+
const { reason } = f.unlock;
|
|
64
|
+
if (reason === "passphrase_missing" && envPassphraseSet) return unknown("not_checked");
|
|
65
|
+
if (reason !== "wallet_locked" && DEFINITE_UNLOCK.has(reason)) {
|
|
66
|
+
return unlockBlocked(reason, f.unlock.fix);
|
|
67
|
+
}
|
|
68
|
+
return unknown(reason, f.unlock.detail);
|
|
69
|
+
}
|
|
70
|
+
if (f.passphraseFileMissing === true && !envPassphraseSet) {
|
|
71
|
+
return unlockBlocked("passphrase_missing");
|
|
72
|
+
}
|
|
73
|
+
return unknown("not_checked");
|
|
74
|
+
}
|
|
75
|
+
function canPayRouting(r) {
|
|
76
|
+
if (r.feeRefusal !== null) return moneyBlocked(r.feeRefusal);
|
|
77
|
+
if (r.sign.status === "blocked") return r.sign;
|
|
78
|
+
if ((r.creditAtomic ?? 0n) >= LEGACY_ROUTING_QUOTE_ATOMIC) return r.sign;
|
|
79
|
+
if (r.depositRefusal !== null) return moneyBlocked(r.depositRefusal);
|
|
80
|
+
if (r.balanceAtomic !== null && (r.depositAtomic === 0n || r.balanceAtomic < r.depositAtomic)) {
|
|
81
|
+
return moneyBlocked("wallet_low");
|
|
82
|
+
}
|
|
83
|
+
if (r.sign.status === "unknown") return r.sign;
|
|
84
|
+
if (r.balanceAtomic === null) return unknown("balance_unreadable");
|
|
85
|
+
return r.sign;
|
|
86
|
+
}
|
|
87
|
+
function signFromVerification(v) {
|
|
88
|
+
if (v === null || v === void 0) return unknown("not_checked");
|
|
89
|
+
if (v.status === "verified") return ready(v.source, v.warning);
|
|
90
|
+
if (v.status === "broken") return unlockBlocked(v.reason ?? "passphrase_wrong");
|
|
91
|
+
if (v.reason !== void 0 && DEFINITE_UNLOCK.has(v.reason)) return unlockBlocked(v.reason);
|
|
92
|
+
return unknown(v.reason ?? "wallet_locked", v.detail);
|
|
93
|
+
}
|
|
94
|
+
function isDefiniteBlock(v) {
|
|
95
|
+
return v.status === "blocked";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/router/router-memo.ts
|
|
99
|
+
import { randomBytes } from "node:crypto";
|
|
100
|
+
import { readFile, rm } from "node:fs/promises";
|
|
101
|
+
import { join } from "node:path";
|
|
102
|
+
var UNREACHABLE_BACKOFF_MS = 6e4;
|
|
103
|
+
var TOPPING_UP_MEMO_MS = 35e3;
|
|
104
|
+
var WARM_ABSENT_MS = 60 * 6e4;
|
|
105
|
+
function memoPath(dataDir, kind, baseUrl, scope) {
|
|
106
|
+
const origin = new URL(baseUrl).origin;
|
|
107
|
+
const key = sha256Hex(scope === void 0 ? origin : `${origin}
|
|
108
|
+
${scope}`, 16);
|
|
109
|
+
return join(dataDir, "router-memo", `${kind}-${key}.json`);
|
|
110
|
+
}
|
|
111
|
+
async function readMemoFile(dataDir, kind, baseUrl, scope) {
|
|
112
|
+
try {
|
|
113
|
+
const raw = JSON.parse(
|
|
114
|
+
await readFile(memoPath(dataDir, kind, baseUrl, scope), "utf8")
|
|
115
|
+
);
|
|
116
|
+
if (raw === null || typeof raw !== "object") return null;
|
|
117
|
+
const { at, until, detail } = raw;
|
|
118
|
+
if (typeof at !== "number" || typeof until !== "number") return null;
|
|
119
|
+
return { at, until, ...typeof detail === "string" ? { detail } : {} };
|
|
120
|
+
} catch {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function readRouterMemo(dataDir, kind, baseUrl, now, scope) {
|
|
125
|
+
const memo = await readMemoFile(dataDir, kind, baseUrl, scope);
|
|
126
|
+
return memo === null || memo.at > now || memo.until <= now ? null : memo;
|
|
127
|
+
}
|
|
128
|
+
async function writeRouterMemo(dataDir, kind, baseUrl, memo) {
|
|
129
|
+
const body = {
|
|
130
|
+
at: memo.now,
|
|
131
|
+
until: memo.now + memo.ttlMs,
|
|
132
|
+
...memo.detail !== void 0 ? { detail: memo.detail.slice(0, 300) } : {}
|
|
133
|
+
};
|
|
134
|
+
try {
|
|
135
|
+
await writePrivate(memoPath(dataDir, kind, baseUrl), `${JSON.stringify(body)}
|
|
136
|
+
`);
|
|
137
|
+
} catch {
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async function clearRouterMemo(dataDir, kind, baseUrl, scope) {
|
|
141
|
+
try {
|
|
142
|
+
await rm(memoPath(dataDir, kind, baseUrl, scope), { force: true });
|
|
143
|
+
} catch {
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function claimRouterMemo(dataDir, kind, baseUrl, memo) {
|
|
147
|
+
const path = memoPath(dataDir, kind, baseUrl, memo.scope);
|
|
148
|
+
const token = randomBytes(8).toString("hex");
|
|
149
|
+
const body = { at: memo.now, until: memo.now + memo.ttlMs, detail: token };
|
|
150
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
151
|
+
try {
|
|
152
|
+
await writeFileAtomicExclusive(path, `${JSON.stringify(body)}
|
|
153
|
+
`, PRIVATE);
|
|
154
|
+
return token;
|
|
155
|
+
} catch (err) {
|
|
156
|
+
if (!hasCode(err, "EEXIST")) return token;
|
|
157
|
+
}
|
|
158
|
+
const held = await readMemoFile(dataDir, kind, baseUrl, memo.scope);
|
|
159
|
+
if (held !== null && held.until > memo.now && held.at <= memo.now + memo.ttlMs) return null;
|
|
160
|
+
await rm(path, { force: true }).catch(() => void 0);
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
async function releaseRouterMemo(dataDir, kind, baseUrl, claim) {
|
|
165
|
+
const held = await readRouterMemo(dataDir, kind, baseUrl, claim.now, claim.scope);
|
|
166
|
+
if (held?.detail === claim.token) await clearRouterMemo(dataDir, kind, baseUrl, claim.scope);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
canSign,
|
|
171
|
+
canPayRouting,
|
|
172
|
+
signFromVerification,
|
|
173
|
+
isDefiniteBlock,
|
|
174
|
+
UNREACHABLE_BACKOFF_MS,
|
|
175
|
+
TOPPING_UP_MEMO_MS,
|
|
176
|
+
WARM_ABSENT_MS,
|
|
177
|
+
readRouterMemo,
|
|
178
|
+
writeRouterMemo,
|
|
179
|
+
clearRouterMemo,
|
|
180
|
+
claimRouterMemo,
|
|
181
|
+
releaseRouterMemo
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=chunk-64WOMNYR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/router/eligibility.ts","../src/router/router-memo.ts"],"sourcesContent":["import type { PolicyReason } from '../lib/policy';\nimport type { WalletFacts } from '../lib/wallet-facts';\nimport type { WalletVerification } from '../lib/wallet/provider';\nimport { DEFINITE_UNLOCK, type SigningSource, type UnlockReason } from '../lib/wallet-unlock';\nimport { LEGACY_ROUTING_QUOTE_ATOMIC, unpaid } from './fee';\nimport { UNKNOWN_DETAIL, WALLET_REASONS } from './wallet-reasons';\n\n/**\n * CAN THIS WALLET SIGN, PAY THE ROUTING FEE, PAY A PROVIDER: three pure answers\n * from facts someone else gathered. The payer, the hooks, doctor and install\n * all decide from these, so a wallet one of them calls blocked is blocked to\n * every other.\n *\n * Every answer is one of three, never a boolean:\n * - `ready`: it will work, as far as anything here can tell;\n * - `blocked`: it DEFINITELY will not until a person fixes something, and the\n * verdict says what and how;\n * - `unknown`: nothing definite either way (a keychain that did not answer, a\n * balance that could not be read, an unlock not tried yet).\n *\n * ONLY `blocked` GATES. An unknown never withholds an offer, never skips a\n * routing attempt, and never renders as ok. Two invariants follow, and the\n * property test holds them: nothing is ready while signing is not ready, and\n * nothing is blocked from an unknown input alone.\n *\n * Pure and hook-safe: types, fee.ts's constants and wording, and the reason\n * strings. The I/O that fills these facts in lives in `eligibility-check.ts`\n * (doctor) and in the payer and hooks themselves.\n */\nexport type Verdict<R extends string = string> =\n | { status: 'ready'; source?: SigningSource; warning?: string }\n | { status: 'blocked'; reason: R; detail: string; fix: string }\n | { status: 'unknown'; reason: string; detail: string };\n\nexport type SignVerdict = Verdict<UnlockReason>;\n\nexport type { SigningSource };\n\nexport interface SignFacts {\n envKey: WalletFacts['envKey'];\n walletFile: WalletFacts['walletFile'];\n passphraseFileMissing?: boolean;\n /** S13: with this set, canSign never returns blocked passphrase_missing. */\n envPassphraseSet?: boolean;\n unlock?:\n | { ok: true; source?: SigningSource; warning?: string }\n | { ok: false; reason: UnlockReason | 'wallet_locked'; detail?: string; fix?: string };\n}\n\nexport interface RoutingFacts {\n feeRefusal: string | null;\n sign: SignVerdict;\n creditAtomic: bigint | null;\n depositRefusal: string | null;\n /** The deposit the payer would sign (`routingDepositAtomic`). */\n depositAtomic: bigint;\n balanceAtomic: bigint | null;\n}\n\nexport interface ProviderFacts {\n policy: { decision: 'allow' } | { decision: 'refuse'; reason: PolicyReason };\n sign: SignVerdict;\n balanceAtomic: bigint | null;\n}\n\n/** A definite unlock block, worded from WALLET_REASONS: the fragment as the\n * detail, the PERSON fix (decision 15) unless the caller supplied its own. */\nfunction unlockBlocked(reason: UnlockReason, fix?: string): SignVerdict {\n const r = WALLET_REASONS[reason as keyof typeof WALLET_REASONS];\n return { status: 'blocked', reason, detail: r.reason, fix: fix ?? r.fix };\n}\n\n/** An unknown, worded from UNKNOWN_DETAIL, else the caller's detail. */\nfunction unknown(\n reason: string,\n detail?: string,\n): { status: 'unknown'; reason: string; detail: string } {\n return {\n status: 'unknown',\n reason,\n detail: UNKNOWN_DETAIL[reason] ?? detail ?? UNKNOWN_DETAIL['check_failed']!,\n };\n}\n\n/** A ready verdict carrying only the fields that are set. */\nfunction ready(\n source?: SigningSource,\n warning?: string,\n): { status: 'ready'; source?: SigningSource; warning?: string } {\n return {\n status: 'ready',\n ...(source !== undefined ? { source } : {}),\n ...(warning !== undefined ? { warning } : {}),\n };\n}\n\n/**\n * A money or policy block in TODAY'S words (S5): `detail` and `fix` are fee.ts's\n * `unpaid(reason)`, byte for byte. No new fee or funding wording comes from here.\n */\nfunction moneyBlocked(reason: string): Verdict {\n const u = unpaid(reason);\n return {\n status: 'blocked',\n reason,\n detail: u?.reason ?? reason,\n fix: u?.fix ?? 'Run `tenjin doctor`.',\n };\n}\n\n/**\n * CAN THIS WALLET SIGN, first match wins (section 2.4).\n *\n * The file facts that are definite come first (a malformed key, no wallet, a\n * wallet.json nobody can read), then what an actual unlock said, then the one\n * file fact that is definite only without the env variable: the sidecar names\n * the file store and the file is gone.\n *\n * S13: a set TENJIN_WALLET_PASSPHRASE is itself a passphrase source, so \"no\n * passphrase can be reached\" is never definite while it is set. Until an\n * unlock has actually tried it, the answer is unknown.\n */\nexport function canSign(f: SignFacts): SignVerdict {\n if (f.envKey === 'valid') return ready('key-env');\n if (f.envKey === 'malformed') return unlockBlocked('env_key_invalid');\n if (f.walletFile === 'absent') return unlockBlocked('no_wallet');\n if (f.walletFile === 'unparsable') return unlockBlocked('wallet_corrupt');\n const envPassphraseSet = f.envPassphraseSet === true;\n if (f.unlock !== undefined) {\n if (f.unlock.ok) return ready(f.unlock.source, f.unlock.warning);\n const { reason } = f.unlock;\n if (reason === 'passphrase_missing' && envPassphraseSet) return unknown('not_checked');\n if (reason !== 'wallet_locked' && DEFINITE_UNLOCK.has(reason)) {\n return unlockBlocked(reason, f.unlock.fix);\n }\n return unknown(reason, f.unlock.detail);\n }\n if (f.passphraseFileMissing === true && !envPassphraseSet) {\n return unlockBlocked('passphrase_missing');\n }\n return unknown('not_checked');\n}\n\n/**\n * CAN THE NEXT ROUTING CALL PAY ITS FEE, first match wins (section 2.4).\n *\n * Definite money facts come AHEAD of an unknown signer (decision 11): a\n * command-mode hook cannot unlock, so its signer is always unknown, and a\n * balance below the deposit must still withhold there as it does today. The\n * payer reads the balance only when depositing and uses the same liquidity\n * bounds as this doctor estimate. A\n * channel that already holds the fee needs no deposit, so neither the deposit\n * policy nor the balance matters to it (checklist item 8: $0 with credit).\n */\nexport function canPayRouting(r: RoutingFacts): Verdict {\n if (r.feeRefusal !== null) return moneyBlocked(r.feeRefusal);\n if (r.sign.status === 'blocked') return r.sign;\n if ((r.creditAtomic ?? 0n) >= LEGACY_ROUTING_QUOTE_ATOMIC) return r.sign;\n if (r.depositRefusal !== null) return moneyBlocked(r.depositRefusal);\n if (r.balanceAtomic !== null && (r.depositAtomic === 0n || r.balanceAtomic < r.depositAtomic)) {\n return moneyBlocked('wallet_low');\n }\n if (r.sign.status === 'unknown') return r.sign;\n if (r.balanceAtomic === null) return unknown('balance_unreadable');\n return r.sign;\n}\n\n/**\n * CAN THIS WALLET PAY A PROVIDER `priceAtomic`, first match wins (section 2.4).\n *\n * `needs_approval` keeps the policy's own reason, and it and `wallet_short`\n * carry empty text on purpose: the hooks render them with today's Shortfall\n * strings, and nothing here may invent new ones.\n */\nexport function canPayProvider(\n p: ProviderFacts,\n priceAtomic: bigint,\n): Verdict<UnlockReason | 'needs_approval' | 'wallet_short'> & { policyReason?: PolicyReason } {\n if (p.policy.decision !== 'allow') {\n return {\n status: 'blocked',\n reason: 'needs_approval',\n detail: '',\n fix: '',\n policyReason: p.policy.reason,\n };\n }\n if (p.sign.status === 'blocked') return p.sign;\n if (p.balanceAtomic !== null && p.balanceAtomic < priceAtomic) {\n return { status: 'blocked', reason: 'wallet_short', detail: '', fix: '' };\n }\n if (p.sign.status === 'unknown') return p.sign;\n if (p.balanceAtomic === null) return unknown('balance_unreadable');\n return p.sign;\n}\n\n/**\n * A provider's `verify()` answer as a sign verdict.\n *\n * verified is ready (with its source and warning); broken is blocked\n * (`reason`, else `passphrase_wrong`, the one thing today's broken verdicts\n * all were before they carried one); unverified is blocked only with a\n * DEFINITE reason, and unknown otherwise; no answer at all is unknown.\n *\n * A blocked verdict is worded from WALLET_REASONS, not from the verification's\n * own `detail` and `fix`: those predate B1 and can tell a person to set\n * TENJIN_WALLET_PASSPHRASE, and doctor shows the WALLET_REASONS person fix for\n * every unlock reason (decision 15).\n */\nexport function signFromVerification(v: WalletVerification | null | undefined): SignVerdict {\n if (v === null || v === undefined) return unknown('not_checked');\n if (v.status === 'verified') return ready(v.source, v.warning);\n if (v.status === 'broken') return unlockBlocked(v.reason ?? 'passphrase_wrong');\n if (v.reason !== undefined && DEFINITE_UNLOCK.has(v.reason)) return unlockBlocked(v.reason);\n return unknown(v.reason ?? 'wallet_locked', v.detail);\n}\n\n/** True only for a definite block: the one status any caller may gate on. */\nexport function isDefiniteBlock(v: Verdict): v is Extract<Verdict, { status: 'blocked' }> {\n return v.status === 'blocked';\n}\n","import { randomBytes } from 'node:crypto';\nimport { readFile, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { writeFileAtomicExclusive } from '../lib/atomic-json';\nimport { hasCode } from '../lib/errno';\nimport { sha256Hex } from '../lib/hash';\nimport { PRIVATE, writePrivate } from './store-files';\n\n/**\n * ONE MEMO FOR \"DO NOT ASK THE ROUTER YET\", per machine and per router origin,\n * in the data dir, so every hook leg and every `tenjin mcp` process reads the\n * same answer:\n *\n * - `unreachable`: a routing leg's call could not reach the router (DNS, TLS,\n * a refused connection, a proxy refusing the tunnel; see `isUnreachable`). For\n * {@link UNREACHABLE_BACKOFF_MS} every leg skips the router and the native\n * tool runs at once, instead of each prompt and search waiting out the gate.\n * Doctor's probe ends it early when it reaches the router.\n * - `topping-up`: a `tenjin mcp` process is topping up the wallet's routing\n * channel in the background ({@link TOPPING_UP_MEMO_MS}), so another one on\n * the same wallet does not send a second deposit. One memo per wallet, which\n * one process at a time claims ({@link claimRouterMemo}).\n * - `warm-absent`: the router answered the background top-up's `warm` call\n * with a 2xx that is not the `warm` answer, or a 3xx or 4xx other than a\n * 402 or 429 (an older server answers 400), so it has no `warm` form. For\n * {@link WARM_ABSENT_MS} a deposit rides the next paid call, as it did\n * before the form existed. A 402, 429, 5xx or no answer backs off instead.\n *\n * A memo is a file written atomically and read with the clock: one older than\n * its window, or dated in the future, reads as absent, so nothing cleans up\n * after it. An unreadable file reads as absent too: the cost of a lost memo is\n * one more call to the router.\n */\nexport type RouterMemoKind = 'unreachable' | 'topping-up' | 'warm-absent';\n\nexport interface RouterMemo {\n /** When it was written, in epoch ms. */\n at: number;\n /** When it ends, in epoch ms. */\n until: number;\n /** What happened, for doctor. */\n detail?: string;\n}\n\n/** How long routing legs skip a router that did not answer. */\nexport const UNREACHABLE_BACKOFF_MS = 60_000;\n/** How long another process's top-up holds this one's off at most: the\n * top-up's own budget (`TOP_UP_TIMEOUT_MS`, 15 s), a deposit still out after\n * it (`DETACHED_CEILING_MS`, 15 s) and some. Its holder ends it sooner. */\nexport const TOPPING_UP_MEMO_MS = 35_000;\n/** How long a router without the `warm` form gets deposits on the next paid\n * call instead, before the top-up tries `warm` again. */\nexport const WARM_ABSENT_MS = 60 * 60_000;\n\n/** `scope` gives each wallet a memo of its own, under the same origin. */\nfunction memoPath(dataDir: string, kind: RouterMemoKind, baseUrl: string, scope?: string): string {\n const origin = new URL(baseUrl).origin;\n const key = sha256Hex(scope === undefined ? origin : `${origin}\\n${scope}`, 16);\n return join(dataDir, 'router-memo', `${kind}-${key}.json`);\n}\n\n/** The memo in the file, whatever its window, or null. Never throws, not\n * even on a base URL that does not parse. */\nasync function readMemoFile(\n dataDir: string,\n kind: RouterMemoKind,\n baseUrl: string,\n scope?: string,\n): Promise<RouterMemo | null> {\n try {\n const raw = JSON.parse(\n await readFile(memoPath(dataDir, kind, baseUrl, scope), 'utf8'),\n ) as unknown;\n if (raw === null || typeof raw !== 'object') return null;\n const { at, until, detail } = raw as Record<string, unknown>;\n if (typeof at !== 'number' || typeof until !== 'number') return null;\n return { at, until, ...(typeof detail === 'string' ? { detail } : {}) };\n } catch {\n return null;\n }\n}\n\n/** The memo in force at `now`, or null. Never throws. */\nexport async function readRouterMemo(\n dataDir: string,\n kind: RouterMemoKind,\n baseUrl: string,\n now: number,\n scope?: string,\n): Promise<RouterMemo | null> {\n const memo = await readMemoFile(dataDir, kind, baseUrl, scope);\n return memo === null || memo.at > now || memo.until <= now ? null : memo;\n}\n\n/** Starts a memo of `ttlMs` from `now`. Never throws. */\nexport async function writeRouterMemo(\n dataDir: string,\n kind: RouterMemoKind,\n baseUrl: string,\n memo: { now: number; ttlMs: number; detail?: string },\n): Promise<void> {\n const body: RouterMemo = {\n at: memo.now,\n until: memo.now + memo.ttlMs,\n ...(memo.detail !== undefined ? { detail: memo.detail.slice(0, 300) } : {}),\n };\n try {\n await writePrivate(memoPath(dataDir, kind, baseUrl), `${JSON.stringify(body)}\\n`);\n } catch {\n // Best effort: a memo that did not land costs one more call.\n }\n}\n\n/** Ends a memo before its window does. Never throws. */\nexport async function clearRouterMemo(\n dataDir: string,\n kind: RouterMemoKind,\n baseUrl: string,\n scope?: string,\n): Promise<void> {\n try {\n await rm(memoPath(dataDir, kind, baseUrl, scope), { force: true });\n } catch {\n // Best effort: the window ends it anyway.\n }\n}\n\n/**\n * A MEMO ONLY ONE PROCESS HOLDS. It is created whole and exclusively, so of\n * two processes claiming at once exactly one wins. One past its window, or\n * unreadable, was left by a process that died holding it: it is removed and\n * claimed once more. One dated after this claim's `now` is a contender's that\n * read the clock a moment later and is held, unless it is a whole window\n * ahead (the clock went back). The claim's token, its `detail`, is what\n * {@link releaseRouterMemo} checks, so a holder never ends another's claim.\n * The token, or null when another process holds it. Never throws: a claim the\n * file system refuses outright counts as this call's, as before claims existed.\n */\nexport async function claimRouterMemo(\n dataDir: string,\n kind: RouterMemoKind,\n baseUrl: string,\n memo: { now: number; ttlMs: number; scope?: string },\n): Promise<string | null> {\n const path = memoPath(dataDir, kind, baseUrl, memo.scope);\n const token = randomBytes(8).toString('hex');\n const body: RouterMemo = { at: memo.now, until: memo.now + memo.ttlMs, detail: token };\n for (let attempt = 0; attempt < 2; attempt += 1) {\n try {\n await writeFileAtomicExclusive(path, `${JSON.stringify(body)}\\n`, PRIVATE);\n return token;\n } catch (err) {\n if (!hasCode(err, 'EEXIST')) return token;\n }\n const held = await readMemoFile(dataDir, kind, baseUrl, memo.scope);\n if (held !== null && held.until > memo.now && held.at <= memo.now + memo.ttlMs) return null;\n await rm(path, { force: true }).catch(() => undefined);\n }\n return null;\n}\n\n/** Ends this claim, unless another process's has replaced it. Never throws. */\nexport async function releaseRouterMemo(\n dataDir: string,\n kind: RouterMemoKind,\n baseUrl: string,\n claim: { token: string; now: number; scope?: string },\n): Promise<void> {\n const held = await readRouterMemo(dataDir, kind, baseUrl, claim.now, claim.scope);\n if (held?.detail === claim.token) await clearRouterMemo(dataDir, kind, baseUrl, claim.scope);\n}\n"],"mappings":"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","names":[]}
|
|
@@ -5,10 +5,13 @@ import {
|
|
|
5
5
|
fetchDistTags,
|
|
6
6
|
fetchPublishTime,
|
|
7
7
|
resolveTarget
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QKEUKBRK.js";
|
|
9
9
|
import {
|
|
10
10
|
recordTermsTold
|
|
11
11
|
} from "./chunk-Y2EXZ47H.js";
|
|
12
|
+
import {
|
|
13
|
+
readMcpServers
|
|
14
|
+
} from "./chunk-F43CV6UC.js";
|
|
12
15
|
import {
|
|
13
16
|
MANAGERS,
|
|
14
17
|
classifyManager,
|
|
@@ -22,13 +25,13 @@ import {
|
|
|
22
25
|
readModSources,
|
|
23
26
|
removePluginFolder,
|
|
24
27
|
writePluginFolder
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-OJJFANO6.js";
|
|
26
29
|
import {
|
|
27
30
|
PLUGIN_DIR,
|
|
28
31
|
RUNTIME_MISSING_FIX,
|
|
29
32
|
renderPluginFiles,
|
|
30
33
|
shQuote
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-34SAECKZ.js";
|
|
32
35
|
import {
|
|
33
36
|
LEGACY_HOOK_TOOL,
|
|
34
37
|
LEGACY_MCP_SERVER_NAME,
|
|
@@ -38,22 +41,16 @@ import {
|
|
|
38
41
|
PLUGIN_ID,
|
|
39
42
|
PLUGIN_NAME,
|
|
40
43
|
SKILLS_DIR_PLUGIN_ID
|
|
41
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-IULCDMVG.js";
|
|
42
45
|
import {
|
|
43
46
|
underAgentHarness
|
|
44
47
|
} from "./chunk-WXA3WTPF.js";
|
|
45
48
|
import {
|
|
46
49
|
fundStep
|
|
47
|
-
} from "./chunk-
|
|
48
|
-
import {
|
|
49
|
-
readMcpServers
|
|
50
|
-
} from "./chunk-KAILF7QA.js";
|
|
50
|
+
} from "./chunk-QQDPRTLP.js";
|
|
51
51
|
import {
|
|
52
52
|
isRecord
|
|
53
53
|
} from "./chunk-P4I7BFNJ.js";
|
|
54
|
-
import {
|
|
55
|
-
readAliveStamp
|
|
56
|
-
} from "./chunk-6J64MQFD.js";
|
|
57
54
|
import {
|
|
58
55
|
CLAUDE_CODE_FLOOR,
|
|
59
56
|
claudeConfigDir,
|
|
@@ -64,11 +61,23 @@ import {
|
|
|
64
61
|
runClaude,
|
|
65
62
|
userMcpFile,
|
|
66
63
|
userSettingsPath
|
|
67
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-4MBCJFY4.js";
|
|
65
|
+
import {
|
|
66
|
+
runningGlibc,
|
|
67
|
+
unpinnedPlatform
|
|
68
|
+
} from "./chunk-OC7K2DVZ.js";
|
|
69
|
+
import {
|
|
70
|
+
readAliveStamp
|
|
71
|
+
} from "./chunk-5F4OB5B3.js";
|
|
72
|
+
import {
|
|
73
|
+
captureNewInstall,
|
|
74
|
+
finishNewInstall,
|
|
75
|
+
reserveNewInstall
|
|
76
|
+
} from "./chunk-4TPL54KW.js";
|
|
68
77
|
import {
|
|
69
78
|
persistRouterDefaults,
|
|
70
79
|
persistRouterProject
|
|
71
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-W74LJ5OT.js";
|
|
72
81
|
import {
|
|
73
82
|
DEFAULTS_LABEL,
|
|
74
83
|
FEE_APPROVAL,
|
|
@@ -79,17 +88,17 @@ import {
|
|
|
79
88
|
shownLimits,
|
|
80
89
|
spendChoiceQuestion,
|
|
81
90
|
spendOptions
|
|
82
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-KGUE5AVX.js";
|
|
83
92
|
import {
|
|
84
93
|
emitWriteNotice,
|
|
85
94
|
paint,
|
|
86
95
|
sanitizeForTerminal
|
|
87
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-KLDMLWXT.js";
|
|
88
97
|
import {
|
|
89
98
|
ROUTING_FEE_CEILING_ATOMIC,
|
|
90
99
|
SUGGESTED_FUND_USD,
|
|
91
100
|
usd
|
|
92
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-HZKANST2.js";
|
|
93
102
|
import {
|
|
94
103
|
parseUsdToAtomic,
|
|
95
104
|
toMoney
|
|
@@ -105,10 +114,6 @@ import {
|
|
|
105
114
|
askText,
|
|
106
115
|
selectOne
|
|
107
116
|
} from "./chunk-GH5UKMZD.js";
|
|
108
|
-
import {
|
|
109
|
-
runningGlibc,
|
|
110
|
-
unpinnedPlatform
|
|
111
|
-
} from "./chunk-OC7K2DVZ.js";
|
|
112
117
|
import {
|
|
113
118
|
hasRuntime,
|
|
114
119
|
isNewer,
|
|
@@ -116,15 +121,13 @@ import {
|
|
|
116
121
|
} from "./chunk-5N4GGUBN.js";
|
|
117
122
|
import {
|
|
118
123
|
resolveContextSettings
|
|
119
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-DTEWAVNE.js";
|
|
125
|
+
import {
|
|
126
|
+
loadRawConfig
|
|
127
|
+
} from "./chunk-UIB33QQP.js";
|
|
120
128
|
import {
|
|
121
129
|
writeFileAtomic
|
|
122
130
|
} from "./chunk-7WEQQJLG.js";
|
|
123
|
-
import {
|
|
124
|
-
MAX_AUTO_SPEND_FLOOR_ATOMIC,
|
|
125
|
-
MAX_AUTO_SPEND_FLOOR_WHY,
|
|
126
|
-
loadRawConfig
|
|
127
|
-
} from "./chunk-VH7JMLTG.js";
|
|
128
131
|
import {
|
|
129
132
|
hasCode
|
|
130
133
|
} from "./chunk-3MZ7DYRO.js";
|
|
@@ -138,10 +141,10 @@ import {
|
|
|
138
141
|
} from "./chunk-JTX3BUDK.js";
|
|
139
142
|
import {
|
|
140
143
|
ROUTE_PAID_PATH
|
|
141
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-ZEYA2WWX.js";
|
|
142
145
|
import {
|
|
143
146
|
httpRequest
|
|
144
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-D6M3ZK66.js";
|
|
145
148
|
import {
|
|
146
149
|
PRODUCTION_ORIGIN,
|
|
147
150
|
isSameDeployment
|
|
@@ -151,7 +154,7 @@ import {
|
|
|
151
154
|
} from "./chunk-DI4QAGRZ.js";
|
|
152
155
|
import {
|
|
153
156
|
package_default
|
|
154
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-3Y2EHT4F.js";
|
|
155
158
|
import {
|
|
156
159
|
envProxySupported,
|
|
157
160
|
proxyNodeStep,
|
|
@@ -808,7 +811,7 @@ async function refuseRuntimeElsewhere(ctx, moduleDir, home) {
|
|
|
808
811
|
async function runtimeUpdate(ctx, deps, o) {
|
|
809
812
|
const { root, base, latest } = o;
|
|
810
813
|
const [rt, layout] = await Promise.all([
|
|
811
|
-
import("./runtime-place-
|
|
814
|
+
import("./runtime-place-4POL4KK4.js"),
|
|
812
815
|
import("./runtime-layout-QHZQJV7C.js")
|
|
813
816
|
]);
|
|
814
817
|
const stays = `so ${base} stays`;
|
|
@@ -1433,7 +1436,7 @@ async function probeRouter(baseUrl, opts) {
|
|
|
1433
1436
|
return fail(`the router at ${url} is unreachable or erroring (${probe.message})`, unreached);
|
|
1434
1437
|
}
|
|
1435
1438
|
if (probe.status === 402) {
|
|
1436
|
-
const { quoteOf } = await import("./routing-quote-
|
|
1439
|
+
const { quoteOf } = await import("./routing-quote-AHLAREXR.js");
|
|
1437
1440
|
const quoted = quoteOf((name) => probe.header(name));
|
|
1438
1441
|
if (quoted === null) {
|
|
1439
1442
|
return {
|
|
@@ -1596,6 +1599,7 @@ async function somethingToRefresh(claude, scope, legacy, env, home, cwd) {
|
|
|
1596
1599
|
return false;
|
|
1597
1600
|
}
|
|
1598
1601
|
async function runRouterInstall(args, ctx, deps = {}) {
|
|
1602
|
+
const newInstall = deps.newInstall ?? await captureNewInstall(ctx.dataDir);
|
|
1599
1603
|
const env = deps.env ?? process.env;
|
|
1600
1604
|
const home = deps.homeDir ?? homedir2();
|
|
1601
1605
|
if (!isAbsolute(home)) {
|
|
@@ -1643,6 +1647,11 @@ async function runRouterInstall(args, ctx, deps = {}) {
|
|
|
1643
1647
|
const answered = args.yes === true || named.keys.length > 0;
|
|
1644
1648
|
const unasked = config.maxAutoSpend === void 0 && config.sessionBudget === void 0;
|
|
1645
1649
|
const limits = args.refresh === true ? void 0 : named.keys.length > 0 ? { ...shownLimits(config), ...named.limits } : args.yes === true ? shownLimits(config) : canPrompt && unasked ? await approveLimits(deps) : {};
|
|
1650
|
+
if (args.refresh !== true)
|
|
1651
|
+
await reserveNewInstall(
|
|
1652
|
+
newInstall,
|
|
1653
|
+
!legacy.present && (!newInstall.absent || !await somethingToRefresh(claude, scope, legacy, env, home, cwd))
|
|
1654
|
+
);
|
|
1646
1655
|
const deferred = !claude.meetsFloor && legacy.present;
|
|
1647
1656
|
const rt = deferred ? null : await setUpRuntime();
|
|
1648
1657
|
requireRuntime(rt);
|
|
@@ -1723,7 +1732,7 @@ async function runRouterInstall(args, ctx, deps = {}) {
|
|
|
1723
1732
|
]
|
|
1724
1733
|
};
|
|
1725
1734
|
}
|
|
1726
|
-
const { resolveWallet } = await import("./install-wallet-
|
|
1735
|
+
const { resolveWallet } = await import("./install-wallet-2SFOVE3Q.js");
|
|
1727
1736
|
const wallet = await resolveWallet(ctx, deps, args.noWallet === true ? "flag" : void 0, false);
|
|
1728
1737
|
const effective = await resolveContextSettings(ctx);
|
|
1729
1738
|
const command = continuationCommand(rt);
|
|
@@ -1781,7 +1790,9 @@ async function runRouterInstall(args, ctx, deps = {}) {
|
|
|
1781
1790
|
runtime: runtimeData(rt),
|
|
1782
1791
|
launcher: rt?.launcher ?? null
|
|
1783
1792
|
};
|
|
1784
|
-
|
|
1793
|
+
newInstall.completed.push(plugin.state !== "failed" && plugin.state !== "deferred");
|
|
1794
|
+
newInstall.continueWith ??= installCommand(args, command);
|
|
1795
|
+
const result = {
|
|
1785
1796
|
data,
|
|
1786
1797
|
humanLines: [
|
|
1787
1798
|
...lines(ctx, {
|
|
@@ -1803,9 +1814,15 @@ async function runRouterInstall(args, ctx, deps = {}) {
|
|
|
1803
1814
|
],
|
|
1804
1815
|
humanTail: receiptTail(ctx, effective.policy, data.next)
|
|
1805
1816
|
};
|
|
1817
|
+
return deps.newInstall ? result : finishNewInstall(result, newInstall, ctx, {
|
|
1818
|
+
...args.subagents !== void 0 ? { choice: args.subagents } : {},
|
|
1819
|
+
yes: args.yes === true,
|
|
1820
|
+
isInteractive: canPrompt,
|
|
1821
|
+
...deps.promptSubagents ? { promptSubagents: deps.promptSubagents } : {}
|
|
1822
|
+
});
|
|
1806
1823
|
}
|
|
1807
1824
|
async function defaultRuntime(o) {
|
|
1808
|
-
const { setupRuntime } = await import("./runtime-
|
|
1825
|
+
const { setupRuntime } = await import("./runtime-2GX4ALJP.js");
|
|
1809
1826
|
return setupRuntime(o);
|
|
1810
1827
|
}
|
|
1811
1828
|
var sharedResults = /* @__PURE__ */ new WeakSet();
|
|
@@ -1853,7 +1870,7 @@ function runtimeOnlyRefresh(ctx, rt, home) {
|
|
|
1853
1870
|
}
|
|
1854
1871
|
async function collectRuntime(root, folders) {
|
|
1855
1872
|
try {
|
|
1856
|
-
const { collect } = await import("./runtime-activate-
|
|
1873
|
+
const { collect } = await import("./runtime-activate-IDQ2NCSP.js");
|
|
1857
1874
|
await collect(root, { lockWaitMs: 5e3, keep: await folderPointers(root, folders) });
|
|
1858
1875
|
} catch {
|
|
1859
1876
|
}
|
|
@@ -2114,7 +2131,7 @@ function namedLimits(args) {
|
|
|
2114
2131
|
const parsed = parseLimit(raw, per);
|
|
2115
2132
|
if ("refusal" in parsed) {
|
|
2116
2133
|
throw new CliError("USAGE", `${flag} ${raw}: ${parsed.refusal}`, {
|
|
2117
|
-
fix: per === "day" ? `Give a positive USD amount or none, for example \`${flag} 5\`.` : `Give
|
|
2134
|
+
fix: per === "day" ? `Give a positive USD amount or none, for example \`${flag} 5\`.` : `Give a non-negative USD amount with up to 6 decimal places, for example \`${flag} 0.1\`. Zero blocks positive automatic payments.`
|
|
2118
2135
|
});
|
|
2119
2136
|
}
|
|
2120
2137
|
limits[key] = parsed.value;
|
|
@@ -2138,8 +2155,8 @@ ${ROUTING_FEE_TERMS} ${FEE_APPROVAL}`
|
|
|
2138
2155
|
);
|
|
2139
2156
|
const maxAutoSpend = await askLimit(
|
|
2140
2157
|
ask,
|
|
2141
|
-
"Most it may pay for one call, in USD
|
|
2142
|
-
|
|
2158
|
+
"Most it may pay for one call, in USD; 0 blocks positive automatic payments",
|
|
2159
|
+
toMoney(ROUTER_DEFAULTS.maxAutoSpend).usd,
|
|
2143
2160
|
"call"
|
|
2144
2161
|
);
|
|
2145
2162
|
return { maxAutoSpend, sessionBudget };
|
|
@@ -2164,10 +2181,7 @@ function parseLimit(answer, per) {
|
|
|
2164
2181
|
if (err instanceof CliError) return { refusal: `${err.message}.` };
|
|
2165
2182
|
throw err;
|
|
2166
2183
|
}
|
|
2167
|
-
if (per === "
|
|
2168
|
-
return { refusal: "The per-call limit is at least $0.25." };
|
|
2169
|
-
}
|
|
2170
|
-
if (atomic === "0") {
|
|
2184
|
+
if (per === "day" && atomic === "0") {
|
|
2171
2185
|
return {
|
|
2172
2186
|
refusal: "The limit must be more than zero; `tenjin config set router.enabled false` turns the router off."
|
|
2173
2187
|
};
|
|
@@ -2360,4 +2374,4 @@ export {
|
|
|
2360
2374
|
settingsInstallPaths,
|
|
2361
2375
|
claudeInstallAt
|
|
2362
2376
|
};
|
|
2363
|
-
//# sourceMappingURL=chunk-
|
|
2377
|
+
//# sourceMappingURL=chunk-65RS4LQS.js.map
|