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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
readPassphraseRecord
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZS7JIUJ3.js";
|
|
5
5
|
import {
|
|
6
6
|
ADDRESS_RE
|
|
7
7
|
} from "./chunk-JWAK7JQB.js";
|
|
@@ -20,18 +20,18 @@ import {
|
|
|
20
20
|
} from "./chunk-JUUBBBY5.js";
|
|
21
21
|
import {
|
|
22
22
|
routerSettings
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-W2GXIARJ.js";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_MAX_AUTO_SPEND,
|
|
26
26
|
loadRawConfig
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import {
|
|
29
|
-
hasCode
|
|
30
|
-
} from "./chunk-3MZ7DYRO.js";
|
|
27
|
+
} from "./chunk-UIB33QQP.js";
|
|
31
28
|
import {
|
|
32
29
|
DEFAULT_RPC_URL,
|
|
33
30
|
readUsdcBalanceWithFallback
|
|
34
31
|
} from "./chunk-ZCT5DJ3G.js";
|
|
32
|
+
import {
|
|
33
|
+
hasCode
|
|
34
|
+
} from "./chunk-3MZ7DYRO.js";
|
|
35
35
|
import {
|
|
36
36
|
passphraseFilePathFor,
|
|
37
37
|
passphraseRecordPath,
|
|
@@ -39,11 +39,11 @@ import {
|
|
|
39
39
|
} from "./chunk-JTX3BUDK.js";
|
|
40
40
|
import {
|
|
41
41
|
sha256Hex
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-RGCPELQN.js";
|
|
43
43
|
|
|
44
44
|
// src/router/alive.ts
|
|
45
45
|
import { createHash } from "node:crypto";
|
|
46
|
-
import { mkdir as mkdir2, readdir, readFile as readFile3, rm as rm2, rmdir, stat as stat2
|
|
46
|
+
import { chmod, mkdir as mkdir2, readdir, readFile as readFile3, rm as rm2, rmdir, stat as stat2 } from "node:fs/promises";
|
|
47
47
|
import { join as join2 } from "node:path";
|
|
48
48
|
|
|
49
49
|
// src/lib/wallet-facts.ts
|
|
@@ -212,6 +212,12 @@ var MAX_SESSION_ID = 200;
|
|
|
212
212
|
function aliveDir(dataDir) {
|
|
213
213
|
return join2(dataDir, "alive");
|
|
214
214
|
}
|
|
215
|
+
async function privateAliveDir(dataDir) {
|
|
216
|
+
const dir = aliveDir(dataDir);
|
|
217
|
+
await mkdir2(dir, { recursive: true, mode: PRIVATE.dirMode });
|
|
218
|
+
if (process.platform !== "win32") await chmod(dir, PRIVATE.dirMode);
|
|
219
|
+
return dir;
|
|
220
|
+
}
|
|
215
221
|
function markerName(sessionId) {
|
|
216
222
|
return createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
217
223
|
}
|
|
@@ -225,13 +231,13 @@ async function runAliveHook(event, opts) {
|
|
|
225
231
|
const now = opts.now ?? Date.now();
|
|
226
232
|
const dir = aliveDir(opts.dataDir);
|
|
227
233
|
try {
|
|
228
|
-
await
|
|
234
|
+
await privateAliveDir(opts.dataDir);
|
|
229
235
|
if (sessionId !== null) {
|
|
230
|
-
await
|
|
236
|
+
await writePrivate(join2(dir, markerName(sessionId)), `${new Date(now).toISOString()}
|
|
231
237
|
`);
|
|
232
238
|
}
|
|
233
239
|
const stamp = { at: new Date(now).toISOString(), version: opts.version };
|
|
234
|
-
await
|
|
240
|
+
await writePrivate(join2(dir, STAMP), `${JSON.stringify(stamp)}
|
|
235
241
|
`);
|
|
236
242
|
await pruneMarkers(dir, now);
|
|
237
243
|
} catch {
|
|
@@ -318,7 +324,7 @@ async function walletNotice(dataDir, opts = {}) {
|
|
|
318
324
|
}
|
|
319
325
|
try {
|
|
320
326
|
await mkdir2(aliveDir(dataDir), { recursive: true, mode: 448 });
|
|
321
|
-
await
|
|
327
|
+
await writePrivate(noticePath, JSON.stringify({ at: now }));
|
|
322
328
|
} catch {
|
|
323
329
|
return null;
|
|
324
330
|
}
|
|
@@ -416,8 +422,8 @@ async function markSessionServed(dataDir, event) {
|
|
|
416
422
|
const path = join2(aliveDir(dataDir), markerName(sessionId));
|
|
417
423
|
if (await stat2(path).catch(() => null) !== null) return;
|
|
418
424
|
try {
|
|
419
|
-
await
|
|
420
|
-
await
|
|
425
|
+
await privateAliveDir(dataDir);
|
|
426
|
+
await writePrivate(path, `${(/* @__PURE__ */ new Date()).toISOString()}
|
|
421
427
|
`);
|
|
422
428
|
} catch {
|
|
423
429
|
}
|
|
@@ -442,4 +448,4 @@ export {
|
|
|
442
448
|
aliveMain,
|
|
443
449
|
markSessionServed
|
|
444
450
|
};
|
|
445
|
-
//# sourceMappingURL=chunk-
|
|
451
|
+
//# sourceMappingURL=chunk-5F4OB5B3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/router/alive.ts","../src/lib/wallet-facts.ts","../src/router/notice-markers.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { chmod, mkdir, readdir, readFile, rm, rmdir, stat } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { DEFAULT_MAX_AUTO_SPEND, loadRawConfig, type PartialConfig } from '../lib/config';\nimport { walletPath } from '../lib/paths';\nimport { DEFAULT_RPC_URL, readUsdcBalanceWithFallback } from '../lib/usdc-balance';\nimport { readWalletFacts } from '../lib/wallet-facts';\nimport { noticeFor } from './notice-markers';\nimport { routerSettings } from './settings';\nimport { PRIVATE, writePrivate } from './store-files';\nimport { sessionStartMessage } from './wallet-reasons';\n\n/**\n * THE PLUGIN SAYS IT IS HERE. While a machine carries both the plugin and the\n * settings install it replaces, every event would run two sets of routing legs\n * and offer the same lookup twice. The plugin's `SessionStart` entry runs\n * `tenjin hook alive` before any other event of the session, and it writes:\n *\n * - a per-session marker, which every leg a settings install launched checks\n * first, staying silent in a session the plugin serves;\n * - a per-machine stamp, the proof the guarded migration waits for: the plugin\n * has loaded in a real session on this machine at least once, so the\n * settings install can be removed without leaving the machine unrouted.\n *\n * Outside `progress/`, whose files are pruned after ten minutes. Markers are\n * pruned here after a week, which outlasts any session that still matters.\n *\n * SHIM: the per-session check goes on or after 2026-12-01, the first release\n * cut 30 or more days after the plugin PR 2 ships; the stamp stays for doctor.\n *\n * It also says, once, when the wallet's FILES already show it cannot sign in\n * this session ({@link walletAtStart}). That is a file fact, not a verdict:\n * `alive` never unlocks, never execs, never reads a keychain and never replays\n * what a router saw (Q4). Everything else waits for the router's first notice.\n * Its one network call is the balance read behind {@link walletNotice}, at\n * most once a day and bounded at 2 s, through the env proxy it sets up then.\n */\n\nconst MARKER_TTL_MS = 7 * 24 * 60 * 60 * 1000;\nconst STAMP = 'plugin-loaded.json';\n/** When the balance was last read for the notice ({@link walletNotice}). */\nconst BALANCE_NOTICE_FILE = 'balance-notice.json';\n/** A session id names a file only through its hash, so any string is safe. */\nconst MAX_SESSION_ID = 200;\n\nexport function aliveDir(dataDir: string): string {\n return join(dataDir, 'alive');\n}\n\n/**\n * The alive folder, the user's alone whatever the umask: made 0700, and one an older\n * build left wider is narrowed. Each file in it is written through {@link writePrivate}.\n */\nasync function privateAliveDir(dataDir: string): Promise<string> {\n const dir = aliveDir(dataDir);\n await mkdir(dir, { recursive: true, mode: PRIVATE.dirMode });\n if (process.platform !== 'win32') await chmod(dir, PRIVATE.dirMode);\n return dir;\n}\n\nfunction markerName(sessionId: string): string {\n return createHash('sha256').update(sessionId).digest('hex').slice(0, 32);\n}\n\nfunction sessionIdOf(event: unknown): string | null {\n if (event === null || typeof event !== 'object') return null;\n const id = (event as { session_id?: unknown }).session_id;\n return typeof id === 'string' && id.length > 0 && id.length <= MAX_SESSION_ID ? id : null;\n}\n\nexport interface AliveStamp {\n at: string;\n /** The CLI version whose plugin loaded. */\n version: string;\n}\n\n/** What a `SessionStart` hook prints when the wallet cannot sign: one line for\n * the person, one for the model. */\nexport interface AliveAnswer {\n systemMessage: string;\n hookSpecificOutput: { hookEventName: 'SessionStart'; additionalContext: string };\n}\n\n/**\n * The `alive` leg: marker, stamp, prune, then the wallet's files. It prints\n * only when the wallet file is unreadable or the saved passphrase file is gone\n * (with TENJIN_WALLET_PASSPHRASE unset), because a `SessionStart` hook's stdout\n * is added to the session's context and nothing else there is definite before\n * a router has tried to unlock; everything else waits for the router's first\n * notice. The answer carries the person's fix in `systemMessage` and the\n * model's `agentFix` in `additionalContext` (B1), and the reason's notice\n * marker is written so the session's first prompt leg does not say it again.\n * ({@link aliveMain} adds the balance notice as JSON when there is no answer.)\n * It never fails the session: every error is swallowed, and gives null.\n */\nexport async function runAliveHook(\n event: unknown,\n opts: { dataDir: string; version: string; now?: number; env?: NodeJS.ProcessEnv },\n): Promise<AliveAnswer | null> {\n const sessionId = sessionIdOf(event);\n const now = opts.now ?? Date.now();\n const dir = aliveDir(opts.dataDir);\n try {\n await privateAliveDir(opts.dataDir);\n if (sessionId !== null) {\n await writePrivate(join(dir, markerName(sessionId)), `${new Date(now).toISOString()}\\n`);\n }\n const stamp: AliveStamp = { at: new Date(now).toISOString(), version: opts.version };\n await writePrivate(join(dir, STAMP), `${JSON.stringify(stamp)}\\n`);\n await pruneMarkers(dir, now);\n } catch {\n // A marker that could not be written costs only a duplicate offer.\n }\n try {\n const reason = await walletAtStart(opts.dataDir, opts.env ?? process.env);\n if (reason === null) return null;\n const { systemMessage, additionalContext } = sessionStartMessage(reason);\n if (sessionId !== null) {\n await noticeFor(opts.dataDir, sessionId, reason, now).catch(() => undefined);\n }\n return {\n systemMessage,\n hookSpecificOutput: { hookEventName: 'SessionStart', additionalContext },\n };\n } catch {\n return null;\n }\n}\n\n/**\n * WHAT THE FILES ALONE SAY AT SESSION START, and only what is definite (Q4).\n * Filesystem only: one wallet.json read, the sidecar read and a few stats; no\n * exec, no keychain, no scrypt, and never the router's unlock-state, so it\n * cannot repeat a verdict that has since changed. In order:\n *\n * - a TENJIN_WALLET_KEY (valid or not) shadows the file, and whether it works\n * is the router's to report: null;\n * - no wallet.json: null, never `no_wallet`, because the person may have\n * installed with `--no-wallet` on purpose;\n * - a wallet.json nothing can read: `wallet_corrupt`;\n * - the sidecar names the file store, its `.plain` file is gone, and\n * TENJIN_WALLET_PASSPHRASE is unset: `passphrase_missing`;\n * - anything else: null.\n */\nexport async function walletAtStart(\n dataDir: string,\n env: NodeJS.ProcessEnv,\n): Promise<'wallet_corrupt' | 'passphrase_missing' | null> {\n const facts = await readWalletFacts(dataDir, env);\n if (facts.envKey !== 'absent') return null;\n if (facts.walletFile === 'absent') return null;\n if (facts.walletFile === 'unparsable') return 'wallet_corrupt';\n if (facts.passphraseFileMissing && !facts.envPassphraseSet) return 'passphrase_missing';\n return null;\n}\n\nasync function pruneMarkers(dir: string, now: number): Promise<void> {\n for (const name of await readdir(dir).catch(() => [] as string[])) {\n if (!/^[0-9a-f]{32}$/.test(name)) continue;\n const path = join(dir, name);\n const s = await stat(path).catch(() => null);\n if (s !== null && now - s.mtimeMs > MARKER_TTL_MS) await rm(path, { force: true });\n }\n}\n\n/** Has the plugin's `alive` leg marked this session? False on any doubt. */\nexport async function sessionServedByPlugin(dataDir: string, event: unknown): Promise<boolean> {\n const sessionId = sessionIdOf(event);\n if (sessionId === null) return false;\n return (await stat(join(aliveDir(dataDir), markerName(sessionId))).catch(() => null)) !== null;\n}\n\n/** The machine's stamp, or null when the plugin has never loaded here. */\nexport async function readAliveStamp(dataDir: string): Promise<AliveStamp | null> {\n try {\n const parsed = JSON.parse(await readFile(join(aliveDir(dataDir), STAMP), 'utf8')) as unknown;\n if (parsed === null || typeof parsed !== 'object') return null;\n const { at, version } = parsed as { at?: unknown; version?: unknown };\n return typeof at === 'string' && typeof version === 'string' ? { at, version } : null;\n } catch {\n return null;\n }\n}\n\n/** `uninstall`: the markers, the stamp and the notice record, and nothing else under the data dir. */\nexport async function removeAliveState(dataDir: string): Promise<boolean> {\n const dir = aliveDir(dataDir);\n const existed = (await stat(dir).catch(() => null)) !== null;\n if (!existed) return false;\n for (const name of await readdir(dir).catch(() => [] as string[])) {\n if (name === STAMP || name === BALANCE_NOTICE_FILE || /^[0-9a-f]{32}$/.test(name))\n await rm(join(dir, name), { force: true });\n }\n // Only when empty: a file somebody else put there keeps the folder.\n await rmdir(dir).catch(() => undefined);\n return true;\n}\n\n/** How long the leg waits on a balance read before it says nothing. */\nexport const WALLET_READ_MS = 2_000;\n\n/** The balance is read for the notice at most once in this long, across sessions. */\nexport const BALANCE_NOTICE_EVERY_MS = 24 * 60 * 60 * 1000;\n\n/**\n * THE BALANCE, SAID TO THE PERSON AT THE START OF A SESSION while it is under\n * the per-call limit: the leg's `systemMessage`, which Claude Code shows the\n * user and never the model, on every surface and without the mod. The read\n * behind it is one bounded balance read, at most once a day\n * (`balance-notice.json`), so the notice is too: a reminder at every session\n * start gets Tenjin uninstalled. Null when there is no wallet, a\n * TENJIN_WALLET_KEY shadows wallet.json, the router is off, the balance was\n * read in the last day, it could not be read in time, or it holds at least the\n * per-call limit.\n */\nexport async function walletNotice(\n dataDir: string,\n opts: {\n /** The session's directory, whose project layers `router.enabled` reads too. */\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n read?: typeof readUsdcBalanceWithFallback;\n timeoutMs?: number;\n now?: () => number;\n } = {},\n): Promise<string | null> {\n const env = opts.env ?? process.env;\n // The env key, valid or not, shadows wallet.json as in {@link walletAtStart}:\n // the file's address is not the wallet that pays, so it is never read for.\n if ((env.TENJIN_WALLET_KEY?.trim() ?? '') !== '') return null;\n const now = (opts.now ?? Date.now)();\n const noticePath = join(aliveDir(dataDir), BALANCE_NOTICE_FILE);\n const last = (await readJson(noticePath))?.at;\n if (typeof last === 'number' && now >= last && now - last < BALANCE_NOTICE_EVERY_MS) return null;\n const wallet = await readJson(walletPath(dataDir));\n const address = typeof wallet?.address === 'string' ? wallet.address : undefined;\n if (address === undefined || !/^0x[0-9a-fA-F]{40}$/.test(address)) return null;\n // `router.enabled` as every hook reads it, for the session's directory: off,\n // or a config that cannot be read, and nothing is read or said, nor recorded.\n let config: PartialConfig;\n try {\n config = await loadRawConfig(dataDir);\n const router = await routerSettings(\n { cwd: opts.cwd ?? process.cwd(), dataDir, config },\n { warn: () => undefined },\n );\n if (!router.enabled.value) return null;\n } catch {\n return null;\n }\n // A read that cannot record itself is not made: unrecorded, it would\n // come back at every session start.\n try {\n await mkdir(aliveDir(dataDir), { recursive: true, mode: 0o700 });\n await writePrivate(noticePath, JSON.stringify({ at: now }));\n } catch {\n return null;\n }\n const rpcUrl = config.rpcUrl ?? DEFAULT_RPC_URL;\n const timeoutMs = opts.timeoutMs ?? WALLET_READ_MS;\n const read = opts.read ?? readThroughEnvProxy(env);\n const balance = await read(address, rpcUrl, { timeoutMs });\n if (balance === null) return null;\n // The per-call limit as the spend policy reads it: the file's, else the default.\n const cap = BigInt(config.maxAutoSpend ?? DEFAULT_MAX_AUTO_SPEND);\n if (balance > 0n && balance >= cap) return null;\n // Only the person reads it, inside the session: they say so, the agent runs it.\n return `Tenjin balance $${dollars(balance)} · low. Say \"add funds\" when you're ready.`;\n}\n\n/**\n * The balance read, through the proxy the environment names. The bin entry\n * sets that proxy up only after this leg has exited, and here only a read that\n * is due loads it, so a session start with nothing to read pays nothing for it.\n */\nfunction readThroughEnvProxy(env: NodeJS.ProcessEnv): typeof readUsdcBalanceWithFallback {\n return async (address, rpcUrl, opts) => {\n (await import('../lib/env-proxy')).useEnvProxy(env);\n return readUsdcBalanceWithFallback(address, rpcUrl, opts);\n };\n}\n\n/** `$0.00`, `$0.10`, `$0.007`: whole cents keep two decimals. */\nfunction dollars(atomic: bigint): string {\n const fraction = (atomic % 1_000_000n).toString().padStart(6, '0').replace(/0+$/, '');\n return `${atomic / 1_000_000n}.${fraction.padEnd(2, '0')}`;\n}\n\nasync function readJson(path: string): Promise<Record<string, unknown> | null> {\n try {\n const value: unknown = JSON.parse(await readFile(path, 'utf8'));\n return value !== null && typeof value === 'object' ? (value as Record<string, unknown>) : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The command form's entry, read off stdin: `tenjin hook alive`. It writes the\n * answer, when there is one, as one JSON line and WAITS for the write to land:\n * on macOS stdout to a pipe is asynchronous, and `src/index.ts` calls\n * `process.exit(0)` right after this returns, which would drop it. With no\n * answer from the wallet's files, it prints the balance notice\n * ({@link walletNotice}) as a JSON `systemMessage`, which Claude Code shows the\n * user; plain text would be added to the session's context. A wallet that\n * cannot sign is told that, never to add funds.\n */\nexport async function aliveMain(opts: {\n dataDir: string;\n version: string;\n env?: NodeJS.ProcessEnv;\n /** Test seams: the harness event and the stream the answer goes to. */\n readEvent?: () => Promise<string>;\n stdout?: Pick<NodeJS.WritableStream, 'write'>;\n}): Promise<void> {\n const raw = await (opts.readEvent ?? (() => readStdin(1_000)))().catch(() => '');\n const event = parseEvent(raw);\n const answer = await runAliveHook(event, {\n dataDir: opts.dataDir,\n version: opts.version,\n ...(opts.env !== undefined ? { env: opts.env } : {}),\n });\n const cwd = cwdOf(event);\n const notice =\n answer === null\n ? await walletNotice(opts.dataDir, {\n ...(cwd !== null ? { cwd } : {}),\n ...(opts.env !== undefined ? { env: opts.env } : {}),\n }).catch(() => null)\n : null;\n const payload = answer ?? (notice !== null ? { systemMessage: notice } : null);\n if (payload === null) return;\n const out = opts.stdout ?? process.stdout;\n await new Promise<void>((resolve) => {\n try {\n out.write(`${JSON.stringify(payload)}\\n`, () => resolve());\n } catch {\n resolve();\n }\n });\n}\n\nfunction parseEvent(raw: string): unknown {\n try {\n return JSON.parse(raw) as unknown;\n } catch {\n return null;\n }\n}\n\n/** The session's directory, as the harness event names it. */\nfunction cwdOf(event: unknown): string | null {\n if (event === null || typeof event !== 'object') return null;\n const cwd = (event as { cwd?: unknown }).cwd;\n return typeof cwd === 'string' && cwd.length > 0 ? cwd : null;\n}\n\nfunction readStdin(timeoutMs: number): Promise<string> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let size = 0;\n const timer = setTimeout(() => reject(new Error('no harness event')), timeoutMs);\n process.stdin.on('data', (chunk: Buffer) => {\n size += chunk.length;\n if (size > 1_000_000) {\n clearTimeout(timer);\n reject(new Error('harness event too large'));\n return;\n }\n chunks.push(chunk);\n });\n process.stdin.once('end', () => {\n clearTimeout(timer);\n resolve(Buffer.concat(chunks).toString('utf8'));\n });\n process.stdin.once('error', () => {\n clearTimeout(timer);\n reject(new Error('harness event unreadable'));\n });\n });\n}\n\n/**\n * A plugin leg marks its own session too, for a session that loaded the plugin\n * without a `SessionStart` (a `/reload-plugins` mid-session): from the next\n * event on, the settings install's legs there stay silent. A stat when the\n * marker is already there.\n */\nexport async function markSessionServed(dataDir: string, event: unknown): Promise<void> {\n const sessionId = sessionIdOf(event);\n if (sessionId === null) return;\n const path = join(aliveDir(dataDir), markerName(sessionId));\n if ((await stat(path).catch(() => null)) !== null) return;\n try {\n await privateAliveDir(dataDir);\n await writePrivate(path, `${new Date().toISOString()}\\n`);\n } catch {\n // Costs only a duplicate offer.\n }\n}\n","import { readFile, stat } from 'node:fs/promises';\nimport { hasCode } from './errno';\nimport { readPassphraseRecord } from './passphrase-record';\nimport { passphraseFilePathFor, passphraseRecordPath, walletPath } from './paths';\nimport { PRIVATE_KEY_RE, type DurableStore } from './wallet-unlock';\nimport { ADDRESS_RE } from './ids';\n\n/**\n * WHAT THE FILES SAY ABOUT THE WALLET, without unlocking it. The hooks, `alive`\n * and the routing payer's memo need to know \"is there a wallet, is it readable,\n * where was its passphrase saved, and did any of that change\" on every prompt,\n * and none of them may load the wallet layer (`src/router/dist-chunks.test.ts`)\n * or pay for a keychain read or an scrypt to find out.\n *\n * So this reads only: wallet.json's cleartext address, the sidecar, two or three\n * `stat`s, and the environment. It never execs and never throws; anything it\n * cannot read is reported as the fact it is (`unparsable`, null), and deciding\n * what that means is `src/router/eligibility.ts`'s job.\n */\nexport interface WalletFacts {\n /** TENJIN_WALLET_KEY trimmed vs PRIVATE_KEY_RE; whitespace-only = absent. */\n envKey: 'absent' | 'valid' | 'malformed';\n /** unparsable = unreadable, bad JSON, or no valid address. */\n walletFile: 'present' | 'absent' | 'unparsable';\n /** Cleartext top-level address of wallet.json. */\n address: string | null;\n envPassphraseSet: boolean;\n /** Sidecar entry for `address`. */\n passphraseStore: DurableStore | null;\n /** Sidecar says 'file' and the .plain file is absent. */\n passphraseFileMissing: boolean;\n walletMtimeMs: number | null;\n sidecarMtimeMs: number | null;\n}\n\n/** The same address test `hooks.ts` applies to wallet.json's cleartext field. */\n\n/**\n * Read {@link WalletFacts} for `dataDir` under `env`. Never rejects.\n *\n * `envKey` runs the exact test `loadCredential` (src/lib/wallet/local.ts)\n * runs, through the one shared {@link PRIVATE_KEY_RE}, so a key these facts\n * call valid is one the signer accepts. The env passphrase counts as set only\n * when non-empty, as the passphrase resolver treats it.\n */\nexport async function readWalletFacts(\n dataDir: string,\n env: NodeJS.ProcessEnv,\n): Promise<WalletFacts> {\n const key = env.TENJIN_WALLET_KEY?.trim() ?? '';\n const envKey: WalletFacts['envKey'] =\n key.length === 0 ? 'absent' : PRIVATE_KEY_RE.test(key) ? 'valid' : 'malformed';\n const passphrase = env.TENJIN_WALLET_PASSPHRASE;\n const envPassphraseSet = passphrase !== undefined && passphrase.length > 0;\n\n const { walletFile, address } = await readWalletAddress(dataDir);\n const [walletMtimeMs, sidecarMtimeMs] = await Promise.all([\n mtimeOf(walletPath(dataDir)),\n mtimeOf(passphraseRecordPath(dataDir)),\n ]);\n\n let passphraseStore: DurableStore | null = null;\n let passphraseFileMissing = false;\n if (address !== null) {\n passphraseStore =\n (await readPassphraseRecord(dataDir, address).catch(() => null))?.store ?? null;\n if (passphraseStore === 'file') {\n // Only a definite ENOENT is \"missing\". Any other stat failure says\n // nothing about whether the file is there, so it claims nothing.\n passphraseFileMissing = await stat(passphraseFilePathFor(address.toLowerCase(), dataDir))\n .then(() => false)\n .catch((err: unknown) => hasCode(err, 'ENOENT'));\n }\n }\n\n return {\n envKey,\n walletFile,\n address,\n envPassphraseSet,\n passphraseStore,\n passphraseFileMissing,\n walletMtimeMs,\n sidecarMtimeMs,\n };\n}\n\n/** `${walletMtimeMs}:${sidecarMtimeMs}`, the stamp the payer memo compares. */\nexport function unlockStamp(f: Pick<WalletFacts, 'walletMtimeMs' | 'sidecarMtimeMs'>): string {\n return `${f.walletMtimeMs}:${f.sidecarMtimeMs}`;\n}\n\n/** wallet.json's state and cleartext address. ENOENT is absent; any other\n * failure to read or understand it is unparsable. */\nasync function readWalletAddress(\n dataDir: string,\n): Promise<Pick<WalletFacts, 'walletFile' | 'address'>> {\n let text: string;\n try {\n text = await readFile(walletPath(dataDir), 'utf8');\n } catch (err) {\n return { walletFile: hasCode(err, 'ENOENT') ? 'absent' : 'unparsable', address: null };\n }\n try {\n const record: unknown = JSON.parse(text);\n const address = (record as { address?: unknown } | null)?.address;\n return typeof address === 'string' && ADDRESS_RE.test(address)\n ? { walletFile: 'present', address }\n : { walletFile: 'unparsable', address: null };\n } catch {\n return { walletFile: 'unparsable', address: null };\n }\n}\n\nasync function mtimeOf(path: string): Promise<number | null> {\n try {\n return (await stat(path)).mtimeMs;\n } catch {\n return null;\n }\n}\n","import { randomBytes } from 'node:crypto';\nimport { mkdir, open, readFile, rename, rm } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport { hasCode } from '../lib/errno';\nimport type { UnlockReason } from '../lib/wallet-unlock';\nimport { WALLET_CLASS, walletClearedSentence } from './wallet-reasons';\nimport { sha256Hex } from '../lib/hash';\nimport { PRIVATE, sweep, writePrivate } from './store-files';\n\n/**\n * WHAT A SESSION HAS ALREADY BEEN TOLD, on disk, because every hook leg is its\n * own process (or a fresh call into `tenjin mcp`) and none of them remembers\n * the last. Under `<dataDir>/router/notices`:\n *\n * <sha32> the old once-per-session marker ({@link firstNoticeFor})\n * <sha32>-<sha8> told this session this reason ({@link noticeFor})\n * <sha32>.current `${at}\\n${why}`: the reason told last, or `cleared`\n *\n * `<sha32>` is the first 32 hex of sha256(session id) and `<sha8>` the first 8\n * of sha256(reason), so neither a session id nor a reason ever names a file.\n *\n * Once per (session, reason), with a clear line. A wallet that\n * goes from \"no passphrase\" to \"wrong passphrase\" is news twice; the same\n * reason on every prompt is news once. Once a paid call succeeds after a\n * wallet-class reason was told, the session hears paid routing recovered, once\n * ({@link noticeCleared}), and the reason's marker goes with it, so a relapse is\n * told again.\n *\n * Every file's FIRST line is the time it was written, and pruning reads only\n * that line, so old markers, new ones and `.current` all age out the same way:\n * a week after they were last written.\n *\n * Hook-safe: node, `./store-files`, `lib/errno` and the reason strings.\n */\n\n/** How long a session's notice marker is kept. */\nconst NOTICE_KEEP_MS = 7 * 86_400_000;\n\n/** What `.current` says once the reason told last has been cleared. */\nconst CLEARED = 'cleared';\n\n/** Every reason {@link settleCurrent} clears: the unlock reasons and the\n * unclassified fallback, all of which \"Tenjin wallet unlocked.\" answers. */\nconst UNLOCK_CLASS: ReadonlyArray<UnlockReason | 'wallet_locked'> = [\n 'no_wallet',\n 'wallet_corrupt',\n 'env_key_invalid',\n 'passphrase_missing',\n 'passphrase_wrong',\n 'env_passphrase_wrong',\n 'keychain_locked',\n 'unlock_timeout',\n 'wallet_locked',\n];\n\nfunction noticesDir(dataDir: string): string {\n return join(dataDir, 'router', 'notices');\n}\n\nfunction sessionHash(sessionId: string): string {\n return sha256Hex(sessionId, 32);\n}\n\nfunction reasonMarker(dataDir: string, sessionId: string, why: string): string {\n const reason = sha256Hex(why, 8);\n return join(noticesDir(dataDir), `${sessionHash(sessionId)}-${reason}`);\n}\n\nfunction currentPath(dataDir: string, sessionId: string): string {\n return join(noticesDir(dataDir), `${sessionHash(sessionId)}.current`);\n}\n\n/** Record the reason told last (or `cleared`), atomically: two legs at once\n * leave one whole answer, never a torn one. */\nasync function writeCurrent(\n dataDir: string,\n sessionId: string,\n now: number,\n why: string,\n): Promise<void> {\n await writePrivate(currentPath(dataDir, sessionId), `${now}\\n${why}`);\n}\n\n/**\n * 'tell' ONCE PER (SESSION, REASON): the first caller creates the marker,\n * records `why` as the reason told last, and gets 'tell'; every later caller\n * for the same pair gets 'quiet'. A new reason is a new marker, so it is told.\n * Rejects only on an I/O failure other than \"already there\"; callers treat\n * that as quiet.\n */\nexport async function noticeFor(\n dataDir: string,\n sessionId: string,\n why: string,\n now: number,\n): Promise<'tell' | 'quiet'> {\n const created = await createExclusive(reasonMarker(dataDir, sessionId, why), String(now));\n if (!created) return 'quiet';\n await writeCurrent(dataDir, sessionId, now, why);\n await pruneNotices(dataDir, now);\n return 'tell';\n}\n\n/**\n * THE CLEAR LINE, only after a completed signed routing payment: paid routing\n * is working again when the reason told last was wallet-class, else null.\n * A free answer or background deposit alone must not call this.\n *\n * CLAIM BY UNLINK. Two legs can finish paid calls at once and both read the\n * same `.current`; only the one that takes that reason's marker away returns\n * the sentence, so it is said once. Removing the marker is also what lets the\n * reason be told again if the wallet relapses. The take is a rename to a name\n * of this caller's own, then a remove: two concurrent `unlink`s of one path\n * were both seen to succeed on macOS, and a rename of one source has exactly\n * one winner.\n */\nexport async function noticeCleared(\n dataDir: string,\n sessionId: string,\n now: number,\n): Promise<string | null> {\n const text = await readFile(currentPath(dataDir, sessionId), 'utf8').catch(() => null);\n if (text === null) return null;\n const why = text.split('\\n')[1] ?? '';\n if (!WALLET_CLASS.has(why)) return null;\n const marker = reasonMarker(dataDir, sessionId, why);\n const claimed = join(\n dirname(marker),\n `.${basename(marker)}.${randomBytes(6).toString('hex')}.claimed`,\n );\n try {\n await rename(marker, claimed);\n } catch {\n // Another leg claimed it (ENOENT), or it cannot be touched: say nothing.\n return null;\n }\n await rm(claimed, { force: true }).catch(() => undefined);\n await writeCurrent(dataDir, sessionId, now, CLEARED);\n return walletClearedSentence(why);\n}\n\n/**\n * The router's wallet news already said `Tenjin wallet unlocked.` on this\n * session's leg: mark the reason told last as cleared, so a later paid call\n * does not say it twice, and drop the markers of every unlock reason, so a\n * relapse is told again.\n */\nexport async function settleCurrent(\n dataDir: string,\n sessionId: string,\n now: number,\n): Promise<void> {\n await writeCurrent(dataDir, sessionId, now, CLEARED);\n await Promise.all(\n UNLOCK_CLASS.map((why) =>\n rm(reasonMarker(dataDir, sessionId, why), { force: true }).catch(() => undefined),\n ),\n );\n}\n\n/**\n * TRUE ONCE PER SESSION: the first caller for a session id creates its marker\n * and gets true; every later one gets false. Each marker holds the time it was\n * made, and those older than a week go on the way past, so the directory does\n * not grow with every session ever run.\n */\nexport async function firstNoticeFor(\n dataDir: string,\n sessionId: string,\n now: number,\n): Promise<boolean> {\n const created = await createExclusive(\n join(noticesDir(dataDir), sessionHash(sessionId)),\n String(now),\n );\n if (created) await pruneNotices(dataDir, now);\n return created;\n}\n\n/**\n * Remove every notice file whose first line is not a time, or is a time more\n * than a week before `now`. Only the first line: `.current` carries its reason\n * on the second, and must age like any marker rather than look malformed.\n *\n * Skipped: a dot-file (another leg's `.current` mid-rename) and an empty file\n * (another leg's marker between its exclusive create and its write), so a prune\n * never pulls a file out from under a writer.\n */\nasync function pruneNotices(dataDir: string, now: number): Promise<void> {\n await sweep(noticesDir(dataDir), async (name, path) => {\n if (name.startsWith('.')) return false;\n const text = await readFile(path, 'utf8').catch(() => 'NaN');\n if (text.length === 0) return false;\n const at = Number(text.split('\\n')[0]);\n return !Number.isFinite(at) || now - at > NOTICE_KEEP_MS;\n });\n}\n\n/** Create `path` holding `body`, only if it is not already there: true when\n * this call made it, false on EEXIST, and any other failure rethrown. */\nexport async function createExclusive(path: string, body: string): Promise<boolean> {\n try {\n await mkdir(join(path, '..'), { recursive: true, mode: PRIVATE.dirMode });\n const handle = await open(path, 'wx', PRIVATE.mode);\n try {\n await handle.writeFile(body);\n } finally {\n await handle.close();\n }\n return true;\n } catch (err) {\n if (hasCode(err, 'EEXIST')) return false;\n throw err;\n }\n}\n"],"mappings":";;;;;;;;;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