tenjin-cli 0.1.0-alpha.33 → 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 +110 -0
- package/README.md +87 -81
- package/dist/{_esm-BIN7VY2L.js → _esm-2KST7HQ7.js} +7 -7
- package/dist/alive-5TV22PNF.js +51 -0
- package/dist/auth-XI7BJFLW.js +47 -0
- package/dist/{auto-update-Y24UL56V.js → auto-update-7L24KDWA.js} +4 -5
- package/dist/balance-DFHC6XEU.js +71 -0
- package/dist/{ccip-DHDFKTQV.js → ccip-HOW3DZYF.js} +4 -4
- package/dist/chunk-24XKUN2S.js +202 -0
- 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-C2Q76BVM.js → chunk-2U7H35IP.js} +29 -7
- package/dist/chunk-2U7H35IP.js.map +1 -0
- package/dist/chunk-2W4DQQUU.js +176 -0
- package/dist/chunk-2W4DQQUU.js.map +1 -0
- package/dist/{chunk-LRW6S53P.js → chunk-34SAECKZ.js} +35 -11
- package/dist/chunk-34SAECKZ.js.map +1 -0
- package/dist/{chunk-2I4QTOLB.js → chunk-3MZ7DYRO.js} +1 -1
- package/dist/chunk-3MZ7DYRO.js.map +1 -0
- package/dist/{chunk-RVPYTUP4.js → chunk-3Y2EHT4F.js} +13 -9
- package/dist/chunk-3Y2EHT4F.js.map +1 -0
- package/dist/chunk-3Y6BHIN6.js +169 -0
- package/dist/chunk-3Y6BHIN6.js.map +1 -0
- package/dist/{chunk-4K7TQHNP.js → chunk-3YPL6T3P.js} +17 -33
- package/dist/chunk-3YPL6T3P.js.map +1 -0
- package/dist/{chunk-E7SW44LM.js → chunk-44MVIRZH.js} +121 -6
- package/dist/chunk-44MVIRZH.js.map +1 -0
- package/dist/chunk-45MMSBHA.js +321 -0
- package/dist/chunk-45MMSBHA.js.map +1 -0
- package/dist/{chunk-3FMZGI7I.js → chunk-4CE6TMI5.js} +1 -1
- package/dist/chunk-4CE6TMI5.js.map +1 -0
- 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-54ELBTKE.js +1615 -0
- package/dist/chunk-54ELBTKE.js.map +1 -0
- package/dist/{chunk-NDGZDTSJ.js → chunk-5F4OB5B3.js} +115 -57
- package/dist/chunk-5F4OB5B3.js.map +1 -0
- package/dist/chunk-5HN4KVQU.js +3348 -0
- package/dist/chunk-5HN4KVQU.js.map +1 -0
- package/dist/{chunk-ZDZERB6L.js → chunk-5J4E5GYI.js} +572 -407
- package/dist/chunk-5J4E5GYI.js.map +1 -0
- package/dist/{chunk-ZNNXRNFD.js → chunk-5N4GGUBN.js} +48 -6
- package/dist/chunk-5N4GGUBN.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-ILNIZ5I2.js → chunk-65RS4LQS.js} +1825 -1715
- package/dist/chunk-65RS4LQS.js.map +1 -0
- package/dist/{chunk-IE7P2BZE.js → chunk-6QMDUDF2.js} +3 -3
- package/dist/{chunk-IADZOXKN.js → chunk-7SLOTLO7.js} +19 -697
- package/dist/chunk-7SLOTLO7.js.map +1 -0
- package/dist/{chunk-WFSPCCVW.js → chunk-7V25UAQO.js} +99 -99
- package/dist/{chunk-WFSPCCVW.js.map → chunk-7V25UAQO.js.map} +1 -1
- 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-XQJXNMSB.js → chunk-CRG54LEB.js} +1 -1
- package/dist/chunk-CRG54LEB.js.map +1 -0
- package/dist/{chunk-KG3D7FIF.js → chunk-CZJOMUBP.js} +2 -2
- package/dist/{chunk-36RVGZNY.js → chunk-D6M3ZK66.js} +22 -39
- package/dist/chunk-D6M3ZK66.js.map +1 -0
- package/dist/{chunk-3UCIG4TG.js → chunk-DI4QAGRZ.js} +1 -11
- package/dist/chunk-DI4QAGRZ.js.map +1 -0
- package/dist/{chunk-JKKAIPTU.js → chunk-DIH2G3YG.js} +47 -10
- package/dist/chunk-DIH2G3YG.js.map +1 -0
- package/dist/chunk-DJ36BM62.js +78 -0
- package/dist/chunk-DJ36BM62.js.map +1 -0
- package/dist/chunk-DTEWAVNE.js +114 -0
- package/dist/chunk-DTEWAVNE.js.map +1 -0
- package/dist/chunk-F2KJAJ7T.js +13 -0
- package/dist/chunk-F2KJAJ7T.js.map +1 -0
- package/dist/{chunk-BF4XHEQK.js → chunk-F3QPGYOY.js} +6 -6
- package/dist/chunk-F3QPGYOY.js.map +1 -0
- package/dist/{chunk-3GNJXKIT.js → chunk-F43CV6UC.js} +2 -2
- package/dist/{chunk-J57UC3DD.js → chunk-FKVJKLPI.js} +3 -3
- package/dist/{chunk-V2LQLN5H.js → chunk-FYFHH7V5.js} +59 -8
- package/dist/{chunk-V2LQLN5H.js.map → chunk-FYFHH7V5.js.map} +1 -1
- package/dist/chunk-GAJC4BQZ.js +1096 -0
- package/dist/chunk-GAJC4BQZ.js.map +1 -0
- package/dist/{chunk-DOQGNFHM.js → chunk-GH5UKMZD.js} +2 -12
- package/dist/{chunk-DOQGNFHM.js.map → chunk-GH5UKMZD.js.map} +1 -1
- package/dist/{chunk-WYXUQGOL.js → chunk-HAZAN4UM.js} +7 -6
- package/dist/chunk-HAZAN4UM.js.map +1 -0
- package/dist/chunk-HI5XQOX2.js +393 -0
- package/dist/chunk-HI5XQOX2.js.map +1 -0
- package/dist/chunk-HKGUKAQW.js +488 -0
- package/dist/chunk-HKGUKAQW.js.map +1 -0
- package/dist/{chunk-SO3XRZPX.js → chunk-HPRVFJPM.js} +6 -6
- package/dist/{chunk-L6JEXB3E.js → chunk-HQR4BWKX.js} +3 -131
- package/dist/chunk-HQR4BWKX.js.map +1 -0
- package/dist/chunk-HZKANST2.js +177 -0
- package/dist/chunk-HZKANST2.js.map +1 -0
- package/dist/{chunk-UUGOUOVT.js → chunk-I557SAOM.js} +8 -2
- package/dist/chunk-I557SAOM.js.map +1 -0
- package/dist/{chunk-TC2WZLSC.js → chunk-IGLWLH73.js} +8 -7
- package/dist/chunk-IGLWLH73.js.map +1 -0
- package/dist/chunk-ILWCKCOI.js +58 -0
- package/dist/chunk-ILWCKCOI.js.map +1 -0
- package/dist/{chunk-2GP3HRYK.js → chunk-INSIW65E.js} +182 -182
- package/dist/{chunk-MPZUYCAP.js → chunk-IULCDMVG.js} +12 -1
- package/dist/chunk-IULCDMVG.js.map +1 -0
- package/dist/{chunk-INTFHMU4.js → chunk-IVNSUAVC.js} +25 -26
- 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-JHFFUVON.js +1050 -0
- package/dist/chunk-JHFFUVON.js.map +1 -0
- package/dist/{chunk-RL5UUDT4.js → chunk-JNUKLSMZ.js} +3 -3
- package/dist/chunk-JTILUN4W.js +2933 -0
- package/dist/chunk-JTILUN4W.js.map +1 -0
- package/dist/{chunk-OJNTCYQQ.js → chunk-JTX3BUDK.js} +37 -53
- package/dist/chunk-JTX3BUDK.js.map +1 -0
- package/dist/{chunk-X5ZBP3IY.js → chunk-JUUBBBY5.js} +2 -2
- package/dist/chunk-JUUBBBY5.js.map +1 -0
- package/dist/chunk-JWAK7JQB.js +15 -0
- package/dist/chunk-JWAK7JQB.js.map +1 -0
- package/dist/{chunk-UXZONNEQ.js → chunk-K5KNGC4I.js} +34 -31
- package/dist/chunk-K5KNGC4I.js.map +1 -0
- package/dist/chunk-KAQ4Q3TO.js +135 -0
- package/dist/chunk-KAQ4Q3TO.js.map +1 -0
- package/dist/chunk-KFVJYLVL.js +125 -0
- package/dist/chunk-KFVJYLVL.js.map +1 -0
- package/dist/chunk-KGUE5AVX.js +69 -0
- package/dist/chunk-KGUE5AVX.js.map +1 -0
- package/dist/{chunk-FVIGCDSV.js → chunk-KLDMLWXT.js} +11 -85
- package/dist/chunk-KLDMLWXT.js.map +1 -0
- package/dist/chunk-KNKDMTHU.js +453 -0
- package/dist/chunk-KNKDMTHU.js.map +1 -0
- 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-ZURZHELF.js → chunk-MAHNZA6C.js} +158 -41
- package/dist/chunk-MAHNZA6C.js.map +1 -0
- package/dist/chunk-MEWZCIA6.js +220 -0
- package/dist/chunk-MEWZCIA6.js.map +1 -0
- package/dist/{chunk-2SNUOHAT.js → chunk-MEZJ3I63.js} +49 -1
- package/dist/chunk-MEZJ3I63.js.map +1 -0
- package/dist/chunk-MJDO4EXD.js +353 -0
- package/dist/chunk-MJDO4EXD.js.map +1 -0
- package/dist/chunk-NJA6NT3A.js +6595 -0
- package/dist/chunk-NJA6NT3A.js.map +1 -0
- package/dist/{chunk-LHHMV4GU.js → chunk-NVSKJPRC.js} +1 -1
- package/dist/{chunk-LHHMV4GU.js.map → chunk-NVSKJPRC.js.map} +1 -1
- package/dist/{chunk-4YOZGGTZ.js → chunk-OC7K2DVZ.js} +5 -5
- package/dist/chunk-OC7K2DVZ.js.map +1 -0
- package/dist/chunk-ODRPASFP.js +2078 -0
- package/dist/chunk-ODRPASFP.js.map +1 -0
- package/dist/chunk-OJJFANO6.js +133 -0
- package/dist/chunk-OJJFANO6.js.map +1 -0
- package/dist/{chunk-JNJWBTU2.js → chunk-OQWPRFAC.js} +332 -882
- package/dist/chunk-OQWPRFAC.js.map +1 -0
- package/dist/chunk-P4I7BFNJ.js +11 -0
- package/dist/chunk-P4I7BFNJ.js.map +1 -0
- package/dist/{chunk-SNNSAGMT.js → chunk-P6YQWIT2.js} +4058 -4039
- package/dist/chunk-P6YQWIT2.js.map +1 -0
- package/dist/{chunk-JRGFKVAZ.js → chunk-PETQ5WEA.js} +2 -2
- package/dist/{chunk-HMWYAUA6.js → chunk-Q6RSJCXB.js} +29 -69
- package/dist/chunk-Q6RSJCXB.js.map +1 -0
- package/dist/{chunk-U3IKUGRP.js → chunk-QKEUKBRK.js} +17 -23
- package/dist/chunk-QKEUKBRK.js.map +1 -0
- package/dist/{chunk-2RWB7RKE.js → chunk-QKYUCITR.js} +174 -5814
- package/dist/chunk-QKYUCITR.js.map +1 -0
- package/dist/chunk-QQDPRTLP.js +127 -0
- package/dist/chunk-QQDPRTLP.js.map +1 -0
- 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-R5TR2DIK.js +119 -0
- package/dist/chunk-R5TR2DIK.js.map +1 -0
- package/dist/chunk-R62PKTAG.js +66 -0
- package/dist/chunk-R62PKTAG.js.map +1 -0
- package/dist/{chunk-BFDQ4WNW.js → chunk-RFZA7PSM.js} +4 -5
- package/dist/chunk-RFZA7PSM.js.map +1 -0
- package/dist/chunk-RGCPELQN.js +219 -0
- package/dist/chunk-RGCPELQN.js.map +1 -0
- package/dist/chunk-RGVCOG2S.js +910 -0
- package/dist/chunk-RGVCOG2S.js.map +1 -0
- package/dist/chunk-SOLNJ3AZ.js +209 -0
- package/dist/chunk-SOLNJ3AZ.js.map +1 -0
- package/dist/chunk-TFT2X7SH.js +77 -0
- package/dist/chunk-TFT2X7SH.js.map +1 -0
- package/dist/chunk-TUCKEEXE.js +2 -0
- package/dist/chunk-TVWCLUBI.js +293 -0
- package/dist/chunk-TVWCLUBI.js.map +1 -0
- package/dist/chunk-U4TRWSVE.js +78 -0
- package/dist/chunk-U4TRWSVE.js.map +1 -0
- package/dist/chunk-UIB33QQP.js +379 -0
- 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-VHXCPXUS.js +366 -0
- package/dist/chunk-VHXCPXUS.js.map +1 -0
- package/dist/{chunk-HGZEPQUT.js → chunk-VU6GMWF6.js} +17 -8
- package/dist/chunk-VU6GMWF6.js.map +1 -0
- package/dist/chunk-VWZYE3NC.js +8415 -0
- package/dist/chunk-VWZYE3NC.js.map +1 -0
- package/dist/{chunk-AGMVASXZ.js → chunk-W2GXIARJ.js} +88 -11
- 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-W74LJ5OT.js +588 -0
- package/dist/chunk-W74LJ5OT.js.map +1 -0
- package/dist/chunk-W7ELYLYK.js +233 -0
- package/dist/chunk-W7ELYLYK.js.map +1 -0
- package/dist/{chunk-BPMWXTFX.js → chunk-WFZX352D.js} +7 -7
- package/dist/chunk-WXA3WTPF.js +20 -0
- package/dist/chunk-WXA3WTPF.js.map +1 -0
- package/dist/chunk-XRGFH7FI.js +454 -0
- package/dist/chunk-XRGFH7FI.js.map +1 -0
- package/dist/chunk-XSCGUO2U.js +330 -0
- package/dist/chunk-XSCGUO2U.js.map +1 -0
- package/dist/chunk-XWROSMI5.js +1039 -0
- package/dist/chunk-XWROSMI5.js.map +1 -0
- package/dist/chunk-Y2EXZ47H.js +40 -0
- package/dist/chunk-Y2EXZ47H.js.map +1 -0
- package/dist/chunk-YJGEVBKZ.js +47 -0
- package/dist/chunk-YJGEVBKZ.js.map +1 -0
- package/dist/{chunk-6CMM6YCB.js → chunk-YWWMISDY.js} +2 -2
- package/dist/{chunk-WXA2BWTE.js → chunk-ZCT5DJ3G.js} +2 -48
- package/dist/chunk-ZCT5DJ3G.js.map +1 -0
- package/dist/chunk-ZEYA2WWX.js +982 -0
- 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-3AIHRXKO.js → chunk-ZS7JIUJ3.js} +12 -10
- package/dist/chunk-ZS7JIUJ3.js.map +1 -0
- package/dist/{clack-EZ7TDWQU.js → clack-Q4RNC5VE.js} +2 -6
- package/dist/{claude-cli-2YKABJJZ.js → claude-cli-GIIHOBGT.js} +4 -2
- package/dist/claude-install-BAUSJMW3.js +64 -0
- package/dist/{cli-E36SPKBW.js → cli-QY4KKA3D.js} +632 -150
- package/dist/cli-QY4KKA3D.js.map +1 -0
- package/dist/client-3YQKORVK.js +710 -0
- package/dist/client-3YQKORVK.js.map +1 -0
- package/dist/{codex-event-ZO2GEFE6.js → codex-event-EUTCAOTQ.js} +3 -5
- package/dist/{codex-host-KECJVTA2.js → codex-host-ZON3S6HU.js} +7 -7
- package/dist/{codex-install-HQZDGFXW.js → codex-install-HZV2DOAB.js} +242 -88
- package/dist/codex-install-HZV2DOAB.js.map +1 -0
- package/dist/config-QZOBMTEL.js +57 -0
- package/dist/config-names-Z5NZD5R2.js +224 -0
- package/dist/config-names-Z5NZD5R2.js.map +1 -0
- package/dist/config-rules-YOYHS6YL.js +55 -0
- package/dist/config-subagents-WQV2ZAD5.js +362 -0
- package/dist/config-subagents-WQV2ZAD5.js.map +1 -0
- package/dist/connect-YDWTYU4B.js +1020 -0
- package/dist/connect-YDWTYU4B.js.map +1 -0
- 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-QSKHOGCO.js +145 -0
- package/dist/{doctor-I6XQEKWD.js → doctor-ZWJXRD75.js} +162 -148
- package/dist/doctor-ZWJXRD75.js.map +1 -0
- package/dist/{env-proxy-R6ZMLQTT.js → env-proxy-XLSLHBKQ.js} +2 -2
- package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js → ethersCompat-Df4a6QIZ-K3DMHR6Y.js} +5 -5
- package/dist/explicit-ME2NRADQ.js +371 -0
- package/dist/explicit-ME2NRADQ.js.map +1 -0
- package/dist/flush-stdio-NYIJ3QXT.js +18 -0
- package/dist/fund-VF7TLDJH.js +722 -0
- package/dist/fund-VF7TLDJH.js.map +1 -0
- package/dist/hook-command-VZ27MGWO.js +49 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
- package/dist/hosts/claude/tenjin/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 +527 -56
- package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +14 -4
- package/dist/hosts/claude/tenjin/types/index.d.ts +144 -1
- package/dist/{hosts-DVQJ32QC.js → hosts-3EMTVM4H.js} +7 -6
- package/dist/index.js +18 -15
- package/dist/index.js.map +1 -1
- package/dist/install-ZA7L2UF3.js +115 -0
- package/dist/install-funding-JDGYTF72.js +30 -0
- package/dist/install-identity-FFAYEFLX.js +30 -0
- package/dist/{install-wallet-5M4OTYLX.js → install-wallet-2SFOVE3Q.js} +68 -53
- package/dist/install-wallet-2SFOVE3Q.js.map +1 -0
- 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-IJFGMWEV.js → package-BONDXSV3.js} +2 -2
- package/dist/{passphrase-IFTDS3CU.js → passphrase-T4ULBN4M.js} +16 -12
- package/dist/{paths-XCSAKISU.js → paths-O2KDWZ76.js} +18 -28
- package/dist/pay-CMV5KL74.js +74 -0
- package/dist/{payments-HFPPWHTV.js → payments-Z6UBZL4Z.js} +36 -26
- package/dist/payments-Z6UBZL4Z.js.map +1 -0
- package/dist/reclaim-subagent-credit-ABSF67SJ.js +105 -0
- package/dist/reclaim-subagent-credit-ABSF67SJ.js.map +1 -0
- package/dist/{redact-D7ASVWKL.js → redact-LOTHE5TS.js} +2 -8
- package/dist/redact-LOTHE5TS.js.map +1 -0
- package/dist/routing-quote-AHLAREXR.js +40 -0
- package/dist/routing-quote-AHLAREXR.js.map +1 -0
- package/dist/run-JH7ELYAM.js +88 -0
- package/dist/run-JH7ELYAM.js.map +1 -0
- package/dist/runtime-2GX4ALJP.js +410 -0
- package/dist/runtime-2GX4ALJP.js.map +1 -0
- package/dist/runtime-activate-IDQ2NCSP.js +39 -0
- package/dist/runtime-activate-IDQ2NCSP.js.map +1 -0
- package/dist/{runtime-fetch-ZSSSK72Y.js → runtime-fetch-6LOBHBEN.js} +4 -4
- package/dist/runtime-fetch-6LOBHBEN.js.map +1 -0
- package/dist/runtime-launchers-YAPKCBHV.js +31 -0
- package/dist/runtime-launchers-YAPKCBHV.js.map +1 -0
- package/dist/{runtime-layout-WIDILZ6K.js → runtime-layout-QHZQJV7C.js} +5 -4
- package/dist/runtime-layout-QHZQJV7C.js.map +1 -0
- package/dist/runtime-place-4POL4KK4.js +37 -0
- package/dist/runtime-place-4POL4KK4.js.map +1 -0
- package/dist/runtime-provenance-MNJGVBV2.js +12 -0
- package/dist/runtime-provenance-MNJGVBV2.js.map +1 -0
- package/dist/{secp256k1-ZZZT2CAX.js → secp256k1-N5P2GVGF.js} +3 -3
- package/dist/secp256k1-N5P2GVGF.js.map +1 -0
- package/dist/{send-GCVEAQKL.js → send-ELXFKEKY.js} +35 -32
- package/dist/send-ELXFKEKY.js.map +1 -0
- package/dist/status-FXUFWJDM.js +404 -0
- package/dist/status-FXUFWJDM.js.map +1 -0
- package/dist/{status-line-OPCXDHL2.js → status-line-IH5JBWBC.js} +51 -43
- package/dist/status-line-IH5JBWBC.js.map +1 -0
- package/dist/streamableHttp-CP2ZQBIK.js +768 -0
- package/dist/streamableHttp-CP2ZQBIK.js.map +1 -0
- package/dist/{uninstall-BAWRBXXQ.js → uninstall-LJZUKM4D.js} +76 -76
- package/dist/uninstall-LJZUKM4D.js.map +1 -0
- package/dist/update-EUIX72IX.js +68 -0
- package/dist/update-EUIX72IX.js.map +1 -0
- package/dist/usage-EKDC7LUC.js +180 -0
- package/dist/usage-EKDC7LUC.js.map +1 -0
- package/dist/{usdc-VG4CIOUK.js → usdc-YIHK2OMC.js} +8 -12
- package/dist/usdc-YIHK2OMC.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-DOFTEIJV.js → viemAdapter-By13KInL-PRLSIESK.js} +5 -5
- 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/dist/wallet-kdf-worker.mjs +1433 -818
- package/docs/agent-permissions.md +88 -155
- package/docs/router-reference.md +236 -0
- package/docs/safety-model.md +31 -33
- package/docs/subagents-internals.md +97 -0
- package/docs/subagents.md +348 -0
- package/docs/troubleshooting.md +10 -6
- package/package.json +12 -8
- package/scripts/installers/install.sh +7 -1
- package/dist/alive-GSOWKUOY.js +0 -38
- package/dist/chunk-2I4QTOLB.js.map +0 -1
- package/dist/chunk-2M2VPI2E.js +0 -560
- package/dist/chunk-2M2VPI2E.js.map +0 -1
- package/dist/chunk-2RWB7RKE.js.map +0 -1
- package/dist/chunk-2SNUOHAT.js.map +0 -1
- package/dist/chunk-3623BLPV.js +0 -184
- package/dist/chunk-3623BLPV.js.map +0 -1
- package/dist/chunk-36RVGZNY.js.map +0 -1
- package/dist/chunk-3AIHRXKO.js.map +0 -1
- package/dist/chunk-3FMZGI7I.js.map +0 -1
- package/dist/chunk-3UCIG4TG.js.map +0 -1
- package/dist/chunk-4K7TQHNP.js.map +0 -1
- package/dist/chunk-4LMUQMBH.js +0 -29
- package/dist/chunk-4LMUQMBH.js.map +0 -1
- package/dist/chunk-4USCZ2NI.js +0 -228
- package/dist/chunk-4USCZ2NI.js.map +0 -1
- package/dist/chunk-4YOZGGTZ.js.map +0 -1
- package/dist/chunk-62KNUYWD.js +0 -111
- package/dist/chunk-62KNUYWD.js.map +0 -1
- package/dist/chunk-A5GKIG5O.js +0 -2037
- package/dist/chunk-A5GKIG5O.js.map +0 -1
- package/dist/chunk-AGMVASXZ.js.map +0 -1
- package/dist/chunk-BF4XHEQK.js.map +0 -1
- package/dist/chunk-BFDQ4WNW.js.map +0 -1
- package/dist/chunk-C2Q76BVM.js.map +0 -1
- package/dist/chunk-CEXSOI5R.js +0 -808
- package/dist/chunk-CEXSOI5R.js.map +0 -1
- package/dist/chunk-E7SW44LM.js.map +0 -1
- package/dist/chunk-EDJWHDDL.js +0 -33
- package/dist/chunk-EDJWHDDL.js.map +0 -1
- package/dist/chunk-FVIGCDSV.js.map +0 -1
- package/dist/chunk-GTTUCOPD.js +0 -105
- package/dist/chunk-GTTUCOPD.js.map +0 -1
- package/dist/chunk-HDPUXS3Z.js +0 -122
- package/dist/chunk-HDPUXS3Z.js.map +0 -1
- package/dist/chunk-HGGWCP7W.js +0 -120
- package/dist/chunk-HGGWCP7W.js.map +0 -1
- package/dist/chunk-HGZEPQUT.js.map +0 -1
- package/dist/chunk-HMWYAUA6.js.map +0 -1
- package/dist/chunk-IADZOXKN.js.map +0 -1
- package/dist/chunk-ILNIZ5I2.js.map +0 -1
- package/dist/chunk-INTFHMU4.js.map +0 -1
- package/dist/chunk-JKKAIPTU.js.map +0 -1
- package/dist/chunk-JNJWBTU2.js.map +0 -1
- package/dist/chunk-KM7RY2ZS.js +0 -246
- package/dist/chunk-KM7RY2ZS.js.map +0 -1
- package/dist/chunk-KOGZDMHO.js +0 -21
- package/dist/chunk-KOGZDMHO.js.map +0 -1
- package/dist/chunk-L6JEXB3E.js.map +0 -1
- package/dist/chunk-LRW6S53P.js.map +0 -1
- package/dist/chunk-LXAYUOXI.js +0 -511
- package/dist/chunk-LXAYUOXI.js.map +0 -1
- package/dist/chunk-MEFB5KHA.js +0 -59
- package/dist/chunk-MEFB5KHA.js.map +0 -1
- package/dist/chunk-MPZUYCAP.js.map +0 -1
- package/dist/chunk-NDGZDTSJ.js.map +0 -1
- package/dist/chunk-OJNTCYQQ.js.map +0 -1
- package/dist/chunk-P3LFTKE7.js +0 -58
- package/dist/chunk-P3LFTKE7.js.map +0 -1
- package/dist/chunk-QXP3Z3JN.js.map +0 -1
- package/dist/chunk-RVPYTUP4.js.map +0 -1
- package/dist/chunk-SNNSAGMT.js.map +0 -1
- package/dist/chunk-TC2WZLSC.js.map +0 -1
- package/dist/chunk-TKPF35W6.js +0 -29
- package/dist/chunk-TKPF35W6.js.map +0 -1
- package/dist/chunk-U3IKUGRP.js.map +0 -1
- package/dist/chunk-UUGOUOVT.js.map +0 -1
- package/dist/chunk-UXZONNEQ.js.map +0 -1
- package/dist/chunk-WXA2BWTE.js.map +0 -1
- package/dist/chunk-WYXUQGOL.js.map +0 -1
- package/dist/chunk-X5ZBP3IY.js.map +0 -1
- package/dist/chunk-XKESD27X.js +0 -10
- package/dist/chunk-XKESD27X.js.map +0 -1
- package/dist/chunk-XQJXNMSB.js.map +0 -1
- package/dist/chunk-Y527D4TV.js +0 -56
- package/dist/chunk-Y527D4TV.js.map +0 -1
- package/dist/chunk-ZDZERB6L.js.map +0 -1
- package/dist/chunk-ZNNXRNFD.js.map +0 -1
- package/dist/chunk-ZURZHELF.js.map +0 -1
- package/dist/cli-E36SPKBW.js.map +0 -1
- package/dist/codex-install-HQZDGFXW.js.map +0 -1
- package/dist/config-HY2E4GGW.js +0 -55
- package/dist/doctor-I6XQEKWD.js.map +0 -1
- package/dist/fund-2QRO7OJL.js +0 -378
- package/dist/fund-2QRO7OJL.js.map +0 -1
- package/dist/hook-command-2UBCSZG6.js +0 -43
- package/dist/install-ILUX5C4A.js +0 -107
- package/dist/install-identity-TZKGY6LQ.js +0 -31
- package/dist/install-wallet-5M4OTYLX.js.map +0 -1
- package/dist/mcp-LE4DUS22.js +0 -14127
- package/dist/mcp-LE4DUS22.js.map +0 -1
- package/dist/pay-WCG3IH4R.js +0 -55
- package/dist/payments-HFPPWHTV.js.map +0 -1
- package/dist/plugin-registration-PZFI5GZW.js +0 -68
- package/dist/runtime-UZOKSUZX.js +0 -1321
- package/dist/runtime-UZOKSUZX.js.map +0 -1
- package/dist/send-GCVEAQKL.js.map +0 -1
- package/dist/status-HCVAOCN7.js +0 -150
- package/dist/status-HCVAOCN7.js.map +0 -1
- package/dist/status-line-OPCXDHL2.js.map +0 -1
- package/dist/uninstall-BAWRBXXQ.js.map +0 -1
- package/dist/update-CACXLQLR.js +0 -56
- package/dist/wallet-QL4UUXEZ.js +0 -55
- /package/dist/{_esm-BIN7VY2L.js.map → _esm-2KST7HQ7.js.map} +0 -0
- /package/dist/{alive-GSOWKUOY.js.map → alive-5TV22PNF.js.map} +0 -0
- /package/dist/{auto-update-Y24UL56V.js.map → auth-XI7BJFLW.js.map} +0 -0
- /package/dist/{ccip-DHDFKTQV.js.map → auto-update-7L24KDWA.js.map} +0 -0
- /package/dist/{clack-EZ7TDWQU.js.map → balance-DFHC6XEU.js.map} +0 -0
- /package/dist/{claude-cli-2YKABJJZ.js.map → ccip-HOW3DZYF.js.map} +0 -0
- /package/dist/{chunk-IE7P2BZE.js.map → chunk-6QMDUDF2.js.map} +0 -0
- /package/dist/{chunk-KG3D7FIF.js.map → chunk-CZJOMUBP.js.map} +0 -0
- /package/dist/{chunk-3GNJXKIT.js.map → chunk-F43CV6UC.js.map} +0 -0
- /package/dist/{chunk-J57UC3DD.js.map → chunk-FKVJKLPI.js.map} +0 -0
- /package/dist/{chunk-SO3XRZPX.js.map → chunk-HPRVFJPM.js.map} +0 -0
- /package/dist/{chunk-2GP3HRYK.js.map → chunk-INSIW65E.js.map} +0 -0
- /package/dist/{chunk-RL5UUDT4.js.map → chunk-JNUKLSMZ.js.map} +0 -0
- /package/dist/{chunk-JRGFKVAZ.js.map → chunk-PETQ5WEA.js.map} +0 -0
- /package/dist/{codex-event-ZO2GEFE6.js.map → chunk-TUCKEEXE.js.map} +0 -0
- /package/dist/{chunk-BPMWXTFX.js.map → chunk-WFZX352D.js.map} +0 -0
- /package/dist/{chunk-6CMM6YCB.js.map → chunk-YWWMISDY.js.map} +0 -0
- /package/dist/{codex-host-KECJVTA2.js.map → clack-Q4RNC5VE.js.map} +0 -0
- /package/dist/{config-HY2E4GGW.js.map → claude-cli-GIIHOBGT.js.map} +0 -0
- /package/dist/{env-proxy-R6ZMLQTT.js.map → claude-install-BAUSJMW3.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js.map → codex-event-EUTCAOTQ.js.map} +0 -0
- /package/dist/{hook-command-2UBCSZG6.js.map → codex-host-ZON3S6HU.js.map} +0 -0
- /package/dist/{hosts-DVQJ32QC.js.map → config-QZOBMTEL.js.map} +0 -0
- /package/dist/{install-ILUX5C4A.js.map → config-rules-YOYHS6YL.js.map} +0 -0
- /package/dist/{install-identity-TZKGY6LQ.js.map → decision-QSKHOGCO.js.map} +0 -0
- /package/dist/{package-IJFGMWEV.js.map → env-proxy-XLSLHBKQ.js.map} +0 -0
- /package/dist/{passphrase-IFTDS3CU.js.map → ethersCompat-Df4a6QIZ-K3DMHR6Y.js.map} +0 -0
- /package/dist/{paths-XCSAKISU.js.map → flush-stdio-NYIJ3QXT.js.map} +0 -0
- /package/dist/{pay-WCG3IH4R.js.map → hook-command-VZ27MGWO.js.map} +0 -0
- /package/dist/{plugin-registration-PZFI5GZW.js.map → hosts-3EMTVM4H.js.map} +0 -0
- /package/dist/{redact-D7ASVWKL.js.map → install-ZA7L2UF3.js.map} +0 -0
- /package/dist/{runtime-fetch-ZSSSK72Y.js.map → install-funding-JDGYTF72.js.map} +0 -0
- /package/dist/{runtime-layout-WIDILZ6K.js.map → install-identity-FFAYEFLX.js.map} +0 -0
- /package/dist/{secp256k1-ZZZT2CAX.js.map → new-install-5L4GY3LN.js.map} +0 -0
- /package/dist/{update-CACXLQLR.js.map → package-BONDXSV3.js.map} +0 -0
- /package/dist/{usdc-VG4CIOUK.js.map → passphrase-T4ULBN4M.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-DOFTEIJV.js.map → paths-O2KDWZ76.js.map} +0 -0
- /package/dist/{wallet-QL4UUXEZ.js.map → pay-CMV5KL74.js.map} +0 -0
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
randomBytes,
|
|
36
36
|
rotr,
|
|
37
37
|
toBytes
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-WFZX352D.js";
|
|
39
39
|
|
|
40
40
|
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
|
|
41
41
|
function setBigUint64(view, byteOffset, value, isLE) {
|
|
@@ -2250,4 +2250,4 @@ export {
|
|
|
2250
2250
|
@noble/curves/esm/secp256k1.js:
|
|
2251
2251
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
2252
2252
|
*/
|
|
2253
|
-
//# sourceMappingURL=chunk-
|
|
2253
|
+
//# sourceMappingURL=chunk-PETQ5WEA.js.map
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
addressQrLines
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VU6GMWF6.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
markUnlockPending
|
|
10
|
-
} from "./chunk-WYXUQGOL.js";
|
|
11
|
-
import {
|
|
12
|
-
channelCredit
|
|
13
|
-
} from "./chunk-TKPF35W6.js";
|
|
6
|
+
runBalance
|
|
7
|
+
} from "./chunk-MEWZCIA6.js";
|
|
14
8
|
import {
|
|
9
|
+
KEY_STORAGE,
|
|
15
10
|
commitLocalWallet,
|
|
16
11
|
createLocalWallet,
|
|
17
12
|
describeWallet,
|
|
13
|
+
isWindows,
|
|
18
14
|
openKeystore,
|
|
19
15
|
parkOutgoingWallet,
|
|
20
16
|
prepareLocalWallet,
|
|
@@ -25,58 +21,50 @@ import {
|
|
|
25
21
|
verifyAndPreserveOutgoingWallet,
|
|
26
22
|
walletExistsError,
|
|
27
23
|
walletFileExists
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import {
|
|
30
|
-
emitNotice
|
|
31
|
-
} from "./chunk-FVIGCDSV.js";
|
|
32
|
-
import {
|
|
33
|
-
FUNDING_LINE,
|
|
34
|
-
FUND_COMMAND_LINE
|
|
35
|
-
} from "./chunk-HDPUXS3Z.js";
|
|
36
|
-
import {
|
|
37
|
-
LockTimeoutError,
|
|
38
|
-
withFileLock
|
|
39
|
-
} from "./chunk-MEFB5KHA.js";
|
|
24
|
+
} from "./chunk-K5KNGC4I.js";
|
|
40
25
|
import {
|
|
41
26
|
STORE_TIMEOUTS,
|
|
42
27
|
describeStoreLocation,
|
|
43
28
|
promptPassphrase,
|
|
44
29
|
resolvePassphrase,
|
|
45
30
|
resolvePassphraseForCreate,
|
|
46
|
-
storeNoun,
|
|
47
31
|
unstorableWhy
|
|
48
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-HI5XQOX2.js";
|
|
49
33
|
import {
|
|
50
|
-
|
|
51
|
-
} from "./chunk-
|
|
34
|
+
storeNoun
|
|
35
|
+
} from "./chunk-XRGFH7FI.js";
|
|
52
36
|
import {
|
|
53
37
|
writePassphraseRecord
|
|
54
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-ZS7JIUJ3.js";
|
|
39
|
+
import {
|
|
40
|
+
markUnlockPending
|
|
41
|
+
} from "./chunk-HAZAN4UM.js";
|
|
42
|
+
import {
|
|
43
|
+
LockTimeoutError,
|
|
44
|
+
withFileLock
|
|
45
|
+
} from "./chunk-2W4DQQUU.js";
|
|
46
|
+
import {
|
|
47
|
+
emitNotice
|
|
48
|
+
} from "./chunk-KLDMLWXT.js";
|
|
49
|
+
import {
|
|
50
|
+
FUNDING_LINE
|
|
51
|
+
} from "./chunk-HZKANST2.js";
|
|
55
52
|
import {
|
|
56
53
|
NO_KEYRING_LINE,
|
|
57
54
|
REPAIR_CLAUSE,
|
|
58
55
|
REPAIR_IN_TERMINAL
|
|
59
|
-
} from "./chunk-
|
|
60
|
-
import {
|
|
61
|
-
loadRawConfig,
|
|
62
|
-
resolveSettings
|
|
63
|
-
} from "./chunk-2M2VPI2E.js";
|
|
56
|
+
} from "./chunk-JUUBBBY5.js";
|
|
64
57
|
import {
|
|
65
|
-
|
|
66
|
-
} from "./chunk-
|
|
58
|
+
walletPath
|
|
59
|
+
} from "./chunk-JTX3BUDK.js";
|
|
67
60
|
import {
|
|
68
61
|
CliError
|
|
69
|
-
} from "./chunk-
|
|
70
|
-
import {
|
|
71
|
-
walletPath
|
|
72
|
-
} from "./chunk-OJNTCYQQ.js";
|
|
62
|
+
} from "./chunk-DI4QAGRZ.js";
|
|
73
63
|
|
|
74
64
|
// src/commands/wallet.ts
|
|
75
65
|
import { mkdir, readFile } from "node:fs/promises";
|
|
76
66
|
import { homedir } from "node:os";
|
|
77
67
|
import { dirname, join } from "node:path";
|
|
78
|
-
var KEY_STORAGE = "encrypted (keystore v3, scrypt)";
|
|
79
|
-
var isWindows = process.platform === "win32";
|
|
80
68
|
var REPAIR_DONE_LINE = "Passphrase saved; start a new Claude Code session to verify.";
|
|
81
69
|
async function runWalletCreate(ctx, opts = {}) {
|
|
82
70
|
const { address, walletPath: path, passphrase, replaced } = await createWalletLocked(ctx, opts);
|
|
@@ -420,35 +408,7 @@ async function runWalletShow(ctx, opts = {}) {
|
|
|
420
408
|
};
|
|
421
409
|
}
|
|
422
410
|
async function runWalletBalance(ctx, opts = {}) {
|
|
423
|
-
|
|
424
|
-
const desc = await describeWallet(provider);
|
|
425
|
-
const config = await loadRawConfig(ctx.dataDir);
|
|
426
|
-
const rpcUrl = resolveSettings({
|
|
427
|
-
config,
|
|
428
|
-
flags: { baseUrl: ctx.flags.baseUrl },
|
|
429
|
-
env: process.env
|
|
430
|
-
}).rpcUrl.value;
|
|
431
|
-
let atomic;
|
|
432
|
-
try {
|
|
433
|
-
atomic = await getUsdcBalance(desc.address, rpcUrl);
|
|
434
|
-
} catch (err) {
|
|
435
|
-
throw new CliError("RPC_ERROR", `Could not read the USDC balance from ${rpcUrl}.`, {
|
|
436
|
-
fix: "Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.",
|
|
437
|
-
cause: err
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
await forgetRememberedBalance(ctx.dataDir);
|
|
441
|
-
const balance = toMoney(atomic.toString());
|
|
442
|
-
const credit = toMoney(
|
|
443
|
-
(await channelCredit(ctx.dataDir, desc.address).catch(() => 0n)).toString()
|
|
444
|
-
);
|
|
445
|
-
return {
|
|
446
|
-
data: { address: desc.address, balance, routingCredit: credit },
|
|
447
|
-
humanLines: [
|
|
448
|
-
`Balance: ${balance.usd} USDC on Base` + (credit.atomic !== "0" ? ` (+${credit.usd} routing credit)` : ""),
|
|
449
|
-
...atomic === 0n ? [FUND_COMMAND_LINE] : []
|
|
450
|
-
]
|
|
451
|
-
};
|
|
411
|
+
return runBalance(ctx, opts);
|
|
452
412
|
}
|
|
453
413
|
function custodyWarnings() {
|
|
454
414
|
const warnings = [];
|
|
@@ -475,4 +435,4 @@ export {
|
|
|
475
435
|
runWalletShow,
|
|
476
436
|
runWalletBalance
|
|
477
437
|
};
|
|
478
|
-
//# sourceMappingURL=chunk-
|
|
438
|
+
//# sourceMappingURL=chunk-Q6RSJCXB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/wallet.ts"],"sourcesContent":["import { mkdir, readFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport { CliError } from '../lib/errors';\nimport { emitNotice } from '../lib/output';\nimport { walletPath } from '../lib/paths';\nimport { withFileLock, LockTimeoutError } from '../lib/lock';\nimport { addressQrLines } from '../lib/qr';\nimport { writePassphraseRecord } from '../lib/passphrase-record';\nimport { NO_KEYRING_LINE, REPAIR_CLAUSE, REPAIR_IN_TERMINAL } from '../lib/wallet-unlock';\nimport { FUNDING_LINE } from '../router/fee';\nimport { runBalance, type BalanceOptions } from './balance';\nimport { markUnlockPending } from '../router/router-observation';\nimport {\n commitLocalWallet,\n createLocalWallet,\n describeWallet,\n openKeystore,\n parkOutgoingWallet,\n prepareLocalWallet,\n repairLocalWalletPassphrase,\n resolveWalletProvider,\n restoreParkedWallet,\n verifyAndPreserveOutgoingWallet,\n type ArchivedWalletInfo,\n type ResolveWalletProviderOptions,\n} from '../lib/wallet';\nimport {\n readWalletRecord,\n walletExistsError,\n walletFileExists,\n type WalletRecord,\n} from '../lib/wallet/store';\nimport {\n describeStoreLocation,\n promptPassphrase,\n resolvePassphrase,\n resolvePassphraseForCreate,\n STORE_TIMEOUTS,\n storeNoun,\n unstorableWhy,\n type CreatePassphraseResult,\n type DurableStore,\n} from '../lib/wallet/passphrase';\nimport { isWindows, KEY_STORAGE, type PassphraseOverrides } from '../lib/wallet/local';\nimport type { CommandContext, CommandResult } from '../context';\n\n/** The last line `tenjin wallet repair` prints: the save is proven, the unlock is not yet. */\nexport const REPAIR_DONE_LINE = 'Passphrase saved; start a new Claude Code session to verify.';\n\nexport interface WalletCreateOptions {\n /**\n * Explicitly replace the existing active wallet (mirrors the `--yes`-style\n * explicit-flag precedent): the outgoing wallet is ARCHIVED — passphrase\n * verified against its keystore and preserved under its own address, keystore\n * parked beside the new one — never destroyed. Without it, create refuses\n * when a wallet exists. There is always exactly ONE active wallet.\n */\n replace?: boolean;\n /** Test seam for passphrase resolution (keychain exec, TTY prompt, platform). */\n passphrase?: PassphraseOverrides;\n /**\n * The environment TENJIN_WALLET_PASSPHRASE is read from; defaults to\n * process.env. A seam rather than a global read so a caller (and above all a\n * test) can settle the passphrase source WITHOUT mutating the real process\n * environment, which under a parallel runner leaks across whole test files.\n */\n env?: NodeJS.ProcessEnv;\n /**\n * `--insecure-storage`: save the passphrase to the 0600 file even where an OS\n * keychain exists. For a person who chose it; never suggested by an error.\n */\n insecureStorage?: boolean;\n}\n\nexport async function runWalletCreate(\n ctx: CommandContext,\n opts: WalletCreateOptions = {},\n): Promise<CommandResult> {\n const { address, walletPath: path, passphrase, replaced } = await createWalletLocked(ctx, opts);\n\n const note = passphraseNote(passphrase, address, ctx.dataDir);\n const warnings = custodyWarnings();\n return {\n data: {\n address,\n walletPath: path,\n provider: 'local',\n policyEnforcement: 'client-only',\n keyStorage: KEY_STORAGE,\n passphraseSource: passphrase.source,\n passphraseLocation: passphrase.location,\n passphraseOrigin: passphrase.origin,\n passphraseDurable: passphrase.durable,\n passphraseNote: note,\n ...(replaced !== undefined\n ? {\n replaced: {\n address: replaced.address,\n archivedWalletPath: replaced.archivedPath,\n passphrasePreserved: replaced.passphraseLocation,\n ...(replaced.unarchivedReason !== undefined\n ? { unarchivedReason: replaced.unarchivedReason }\n : {}),\n },\n }\n : {}),\n warnings,\n },\n humanLines: [\n `Wallet created: ${address}`,\n `Key stored ${KEY_STORAGE}.`,\n note,\n ...(replaced !== undefined ? replacedNote(replaced, path) : []),\n FUNDING_LINE,\n ...warnings,\n ],\n };\n}\n\n/** Where the outgoing wallet's funds live, why they remain reachable, and how to restore it. */\nfunction replacedNote(replaced: ArchivedWalletInfo, activeWalletPath: string): string[] {\n const passphraseLine =\n replaced.passphraseLocation === 'store'\n ? `its passphrase is preserved in ${replaced.location ?? `the OS credential store (service tenjin-cli, account ${replaced.account})`}.`\n : replaced.passphraseLocation === 'env'\n ? 'its passphrase is TENJIN_WALLET_PASSPHRASE — keep that value.'\n : replaced.unarchivedReason === 'rejected-characters'\n ? 'its passphrase was NOT archived: the macOS keychain writer only stores printable ASCII passphrases, and this typed one contains other characters. Keep it yourself, or set TENJIN_WALLET_PASSPHRASE to it.'\n : 'its passphrase was NOT archived: this platform has no OS credential store. It exists only where you keep it.';\n return [\n `Previous wallet archived: ${replaced.address} still holds any funds sent to it.`,\n `Its keystore was moved to ${replaced.archivedPath}; ${passphraseLine}`,\n `To make it the active wallet again later: move the current ${activeWalletPath} aside first, then \\`mv ${replaced.archivedPath} ${activeWalletPath}\\`.`,\n ];\n}\n\n/**\n * Run `fn` under the cross-process wallet lock (`<dir>/wallet.create.lock`):\n * create, `--replace` and repair all change where a wallet's passphrase lives,\n * and the sidecar's read-modify-write assumes one writer at a time.\n *\n * A lock timeout is not the user's error; it surfaces as INTERNAL with the one\n * manual step (there is no auto-steal), keeping the JSON error contract. Every\n * other error — notably a create loser's WALLET_EXISTS — propagates unchanged.\n */\nexport async function withWalletLock<T>(dir: string, fn: () => Promise<T>): Promise<T> {\n // Ensure the data dir exists so the lock's own mkdir has a parent on a fresh\n // install; the exclusive wallet write re-ensures it at 0700 regardless.\n await mkdir(dir, { recursive: true, mode: 0o700 });\n const lockPath = join(dir, 'wallet.create.lock');\n try {\n return await withFileLock(lockPath, fn);\n } catch (err) {\n if (err instanceof LockTimeoutError) {\n throw new CliError('INTERNAL', err.message, {\n fix: `If no other tenjin process is running, remove ${lockPath} and retry.`,\n cause: err,\n });\n }\n throw err;\n }\n}\n\n/**\n * Run the whole create critical section under the wallet lock: the existence\n * pre-check, the passphrase choose-and-store, and the no-clobber write. Without\n * the lock these interleave across two concurrent creates — each generates a\n * distinct passphrase and persists it BEFORE the exclusive file write, so a\n * different process could win the file while this one's per-address entry\n * names a wallet that never landed. Serializing means the loser blocks until\n * the winner commits, then trips the exists check and exits WALLET_EXISTS\n * having never generated or stored a passphrase. The store-before-write\n * ordering stays (it still guards the single-process crash window), and the\n * exclusive write stays the final authority.\n *\n * The passphrase is resolved inside the prepare step's address callback so the\n * store entry is keyed to the new wallet's own address (issue #32), and the\n * sidecar records where it went BEFORE the key is encrypted: a sidecar that\n * cannot be written aborts the create, so no wallet exists whose passphrase\n * location nobody recorded.\n *\n * `--replace` ordering closes the no-active-wallet window: verify-and-preserve\n * the outgoing wallet (no file moves), fully PREPARE the replacement (key,\n * stored passphrase, encrypted keystore — every fallible step) while the old\n * wallet is still active, and only then park the old keystore and commit the\n * new one. A commit failure rolls the park back, so at every exit either the\n * old or the new wallet is the active one.\n */\nasync function createWalletLocked(\n ctx: CommandContext,\n opts: WalletCreateOptions,\n): Promise<{\n address: string;\n walletPath: string;\n passphrase: CreatePassphraseResult;\n replaced?: ArchivedWalletInfo;\n}> {\n const dir = ctx.dataDir;\n return withWalletLock(dir, async () => {\n const env = opts.env ?? process.env;\n let chosen: CreatePassphraseResult | undefined;\n const passphraseFor = async (forAddress: string): Promise<string> => {\n const resolved = await resolvePassphraseForCreate(\n {\n env,\n dir,\n ...opts.passphrase,\n // Create never prompts; this only picks the 10 s or 60 s write bound.\n isTTY: opts.passphrase?.isTTY ?? ctx.io.isTTY,\n onWait: (line) => emitNotice(ctx.io, line, { json: ctx.flags.json }),\n },\n forAddress,\n { insecureStorage: opts.insecureStorage === true },\n );\n if (resolved.durable && resolved.source !== 'env') {\n await writePassphraseRecord(dir, forAddress, { store: resolved.source, by: 'create' });\n }\n chosen = resolved;\n return resolved.passphrase;\n };\n const result = (path: { address: string; walletPath: string }) => {\n if (chosen === undefined) throw new CliError('INTERNAL', 'No wallet passphrase was chosen.');\n return { ...path, passphrase: chosen };\n };\n\n if (!(await walletFileExists(dir))) {\n return result(await createLocalWallet(dir, passphraseFor));\n }\n\n if (opts.replace !== true) throw walletExistsError(dir);\n const preserved = await verifyAndPreserveOutgoingWallet({\n dir,\n env,\n ...(opts.passphrase !== undefined ? { passphrase: opts.passphrase } : {}),\n });\n const prepared = await prepareLocalWallet(passphraseFor);\n const archivedPath = await parkOutgoingWallet(dir, preserved.account);\n try {\n const committed = await commitLocalWallet(dir, prepared);\n return { ...result(committed), replaced: { ...preserved, archivedPath } };\n } catch (err) {\n try {\n await restoreParkedWallet(dir, archivedPath);\n } catch (restoreErr) {\n // The no-clobber restore also refuses when a wallet.json appeared out\n // of band (commit EEXIST) — never overwrite it; name both files.\n throw new CliError(\n 'INTERNAL',\n 'Creating the replacement wallet failed after the old wallet was parked, and restoring it also failed.',\n {\n fix: `Your old wallet ${preserved.address} is intact at ${archivedPath} with its passphrase preserved. If a ${walletPath(dir)} now exists, another process wrote it — move it aside first. Then restore with \\`mv ${archivedPath} ${walletPath(dir)}\\`.`,\n cause: restoreErr,\n },\n );\n }\n // Old wallet restored as the active one; say so rather than surfacing a\n // raw fs error (or a WALLET_EXISTS whose fix suggests re-running --replace).\n throw new CliError(\n 'INTERNAL',\n 'Creating the replacement wallet failed; the previous wallet was restored and is the active wallet again.',\n {\n fix: 'Nothing was lost. Fix the underlying error, then retry `tenjin wallet create --replace`.',\n cause: err,\n },\n );\n }\n });\n}\n\n/**\n * THE ONE LINE THAT SAYS WHERE THE PASSPHRASE WENT (Q2, S4). A generated secret\n * in an OS store keeps today's three notes byte for byte; an env secret saved\n * there says the variable is no longer needed; the 0600 file says why it was\n * used; and an env secret nothing durable holds says so, and how to fix it\n * once the store answers. Every line that names `tenjin wallet repair` carries\n * REPAIR_CLAUSE, and a file failure never names a keychain (decision 6).\n */\nexport function passphraseNote(p: CreatePassphraseResult, address: string, dir: string): string {\n const account = address.toLowerCase();\n if (!p.durable) {\n const attempted = p.attempted ?? 'keychain';\n const only = 'so Claude Code can unlock this wallet only where that variable is set.';\n switch (p.notSaved) {\n case 'rejected-characters':\n // Repair would refuse the same value: the variable is the fix.\n return `Encrypted with TENJIN_WALLET_PASSPHRASE only: ${unstorableWhy(attempted)}, ${only} Keep it set in the environment Claude Code starts from.`;\n case 'conflict':\n case 'kept-existing':\n return `Encrypted with TENJIN_WALLET_PASSPHRASE only: ${describeStoreLocation(attempted, account, dir)} already holds a different passphrase for this wallet, ${only} Run \\`tenjin wallet repair\\` yourself ${REPAIR_CLAUSE} to replace it.`;\n default:\n break;\n }\n if (attempted === 'file') {\n const path = describeStoreLocation('file', account, dir);\n return `Encrypted with TENJIN_WALLET_PASSPHRASE only: Tenjin could not save the passphrase to ${path}, ${only} Check that ${dirname(path)} is writable, then run \\`tenjin wallet repair\\` yourself ${REPAIR_CLAUSE}.`;\n }\n if (p.notSaved === 'store-failed') {\n return `Encrypted with TENJIN_WALLET_PASSPHRASE only: Tenjin could not save the passphrase to the ${storeNoun(attempted)}, ${only} Run \\`tenjin wallet repair\\` yourself ${REPAIR_CLAUSE}.`;\n }\n return `Encrypted with TENJIN_WALLET_PASSPHRASE only: the ${storeNoun(attempted)} did not answer, ${only} Once it answers, run \\`tenjin wallet repair\\` yourself ${REPAIR_CLAUSE}.`;\n }\n if (p.source === 'file' || p.source === 'env') {\n if (p.fileReason === 'insecure-storage') {\n return `Passphrase saved to ${p.location} (readable only by you). Anyone who can read that file and wallet.json can spend this wallet.`;\n }\n return NO_KEYRING_LINE(p.location);\n }\n if (p.origin === 'env') {\n return `Passphrase from TENJIN_WALLET_PASSPHRASE saved to ${p.location}; Claude Code can unlock this wallet without the variable.`;\n }\n switch (p.source) {\n case 'keychain':\n return `Passphrase saved to your macOS keychain (service tenjin-cli, account ${account}); signing will be transparent on this machine.`;\n case 'dpapi':\n return `Passphrase saved to a DPAPI-encrypted per-wallet file (passphrase.${account}.dpapi), readable only by you on this Windows machine; signing will be transparent here.`;\n case 'secret-service':\n return `Passphrase saved to your Linux keyring (Secret Service, service tenjin-cli, account ${account}); signing will be transparent on this machine.`;\n }\n}\n\nexport interface WalletRepairOptions {\n /** `--insecure-storage`: save to the 0600 file even where an OS keychain exists. */\n insecureStorage?: boolean;\n /** Test seam for passphrase storage (keychain exec, TTY prompt, platform). */\n passphrase?: PassphraseOverrides;\n /** The environment TENJIN_WALLET_PASSPHRASE is read from; defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n /** The home directory whose shell startup files are scanned for an export; defaults to os.homedir(). */\n home?: string;\n /** Reads one startup file, null when it cannot be read; a seam for tests. */\n readText?: (path: string) => Promise<string | null>;\n}\n\n/** What `tenjin wallet repair --json` prints. */\nexport interface WalletRepairData {\n address: string;\n passphraseStore: DurableStore;\n location: string;\n alreadySaved: boolean;\n replacedUnusableEntry: boolean;\n envOverride: {\n state: 'unset' | 'matches' | 'wrong';\n exports: Array<{ file: string; line: number }>;\n };\n restartRequired: true;\n next: typeof REPAIR_DONE_LINE;\n}\n\n/** The shell startup files a TENJIN_WALLET_PASSPHRASE export usually lives in, relative to home. */\nconst SHELL_STARTUP_FILES = [\n '.zshrc',\n '.zprofile',\n '.zshenv',\n '.bashrc',\n '.bash_profile',\n '.profile',\n '.config/fish/config.fish',\n];\n\n/**\n * `tenjin wallet repair`: for a wallet Claude Code cannot unlock. A PERSON runs\n * it, in their own terminal: it asks for the passphrase at a hidden prompt (or\n * uses TENJIN_WALLET_PASSPHRASE when that opens the wallet), proves it opens\n * this wallet, saves it where Claude Code's router can read it without a\n * prompt, and marks the unlock as awaiting confirmation, which the next\n * session's router confirms (\"Tenjin wallet unlocked.\").\n *\n * With no terminal and a wrong variable, the saved passphrase is checked in\n * its place, so a headless run still names the variable when the saved one\n * already opens the wallet. With no terminal and nothing usable it refuses with\n * REPAIR_IN_TERMINAL and never suggests passing the passphrase inline (B1): a passphrase never\n * goes on a command line or into chat. It reports success only when the store\n * reads this passphrase back (S1). A TENJIN_WALLET_PASSPHRASE in this shell\n * that does not open the wallet is named, with the startup-file line that\n * exports it, because it shadows the saved passphrase until removed.\n */\nexport async function runWalletRepair(\n ctx: CommandContext,\n opts: WalletRepairOptions = {},\n): Promise<CommandResult> {\n const env = opts.env ?? process.env;\n const dir = ctx.dataDir;\n const record = await readWalletRecord(dir);\n if (record === null) {\n throw new CliError('WALLET_MISSING', 'No wallet found to repair.', {\n fix: 'Run `tenjin wallet create` to create one.',\n });\n }\n const address = record.address;\n const humanPre: string[] = [];\n const envKey = env.TENJIN_WALLET_KEY;\n if (envKey !== undefined && envKey.trim().length > 0) {\n humanPre.push(\n 'TENJIN_WALLET_KEY is set and shadows the wallet file; repair fixes only the file wallet.',\n );\n }\n\n const fromEnv = env.TENJIN_WALLET_PASSPHRASE;\n let envState: WalletRepairData['envOverride']['state'] = 'unset';\n let candidate: string | undefined;\n if (fromEnv !== undefined && fromEnv.length > 0) {\n const opened = await openKeystore(record.keystore, address, fromEnv);\n envState = opened === 'wrong' ? 'wrong' : 'matches';\n // A mismatch is a tampered file; repair refuses it below with the tamper error.\n if (opened !== 'wrong') candidate = fromEnv;\n }\n const interactive = ctx.io.isTTY && (opts.passphrase?.isTTY ?? Boolean(process.stdin.isTTY));\n if (candidate === undefined && !interactive && envState === 'wrong') {\n // Headless with a wrong variable: a SAVED passphrase that opens the wallet\n // is the candidate, so an agent's run reaches the same conflict line (unset\n // the variable) a person's prompt would, instead of a bare USAGE.\n candidate = await savedPassphraseThatOpens(dir, env, record, opts.passphrase);\n }\n if (candidate === undefined) {\n if (!interactive) {\n throw new CliError(\n 'USAGE',\n envState === 'wrong'\n ? 'No passphrase to check: TENJIN_WALLET_PASSPHRASE is set but does not open this wallet, and no saved passphrase does.'\n : 'No passphrase to check.',\n { fix: REPAIR_IN_TERMINAL },\n );\n }\n const entered = await promptPassphrase(\n { env, ...opts.passphrase },\n `Passphrase for wallet ${address}: `,\n );\n if (entered.length === 0) {\n throw new CliError('USAGE', 'No passphrase entered; nothing was saved.', {\n fix: REPAIR_IN_TERMINAL,\n });\n }\n candidate = entered;\n }\n\n const passphrase = candidate;\n const outcome = await withWalletLock(dir, () =>\n repairLocalWalletPassphrase(\n {\n dir,\n env,\n passphrase: {\n ...opts.passphrase,\n isTTY: ctx.io.isTTY,\n onWait: (line) => emitNotice(ctx.io, line, { json: ctx.flags.json }),\n },\n },\n passphrase,\n opts.insecureStorage === true ? { insecureStorage: true } : {},\n ),\n );\n // The next session's router confirms the unlock and says so once. A failure\n // to record that only costs the confirmation line, never the saved passphrase,\n // so it does not fail a repair that is already proven.\n await markUnlockPending(dir, outcome.address).catch(() => undefined);\n\n const exports =\n envState === 'unset' ? [] : await scanShellExports(opts.home ?? homedir(), opts.readText);\n const savedLine = outcome.alreadySaved\n ? `Already saved in ${outcome.location}.`\n : outcome.fileReason === 'no-keyring'\n ? NO_KEYRING_LINE(outcome.location)\n : `Saved to ${outcome.location}.`;\n const envLine =\n envState === 'wrong'\n ? `! TENJIN_WALLET_PASSPHRASE is set in this shell but does not open this wallet. Tenjin now uses the saved passphrase, but remove the variable: \\`unset TENJIN_WALLET_PASSPHRASE\\`${\n exports.length > 0\n ? `, and delete the export at ${exports.map((e) => `${e.file}:${e.line}`).join(', ')}`\n : ''\n }.`\n : envState === 'matches'\n ? 'TENJIN_WALLET_PASSPHRASE in this shell matches; the saved copy is enough, so you can remove it.'\n : null;\n\n const data: WalletRepairData = {\n address: outcome.address,\n passphraseStore: outcome.store,\n location: outcome.location,\n alreadySaved: outcome.alreadySaved,\n replacedUnusableEntry: outcome.replacedUnusableEntry,\n envOverride: { state: envState, exports },\n restartRequired: true,\n next: REPAIR_DONE_LINE,\n };\n return {\n data,\n humanLines: [\n ...humanPre,\n `Wallet: ${outcome.address}`,\n 'Passphrase verified: it opens this wallet.',\n savedLine,\n ...(envLine !== null ? [envLine] : []),\n REPAIR_DONE_LINE,\n ],\n };\n}\n\n/**\n * The saved passphrase (keychain, 0600 file or legacy slot; never the variable\n * and never a prompt) when it opens this wallet, else undefined. Reads are\n * bounded like doctor's verify, so a locked keychain cannot hang a headless\n * run; any failure to read reads as \"none\".\n */\nasync function savedPassphraseThatOpens(\n dir: string,\n env: NodeJS.ProcessEnv,\n record: WalletRecord,\n overrides: PassphraseOverrides | undefined,\n): Promise<string | undefined> {\n try {\n const saved = await resolvePassphrase(\n {\n env,\n dir,\n ...overrides,\n isTTY: false,\n readDeadlineMs: overrides?.timeouts?.verifyReadMs ?? STORE_TIMEOUTS.verifyReadMs,\n },\n record.address,\n { skipEnv: true },\n );\n const opened = await openKeystore(record.keystore, record.address, saved.passphrase);\n return opened === 'ok' ? saved.passphrase : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Every TENJIN_WALLET_PASSPHRASE line in the usual shell startup files, as `~/<file>:<line>`. */\nasync function scanShellExports(\n home: string,\n readText: (path: string) => Promise<string | null> = (path) =>\n readFile(path, 'utf8').catch(() => null),\n): Promise<Array<{ file: string; line: number }>> {\n const files: Array<{ path: string; text: string }> = [];\n for (const rel of SHELL_STARTUP_FILES) {\n const text = await readText(join(home, rel));\n if (text !== null) files.push({ path: `~/${rel}`, text });\n }\n return findPassphraseExports(files);\n}\n\n/**\n * The lines that set TENJIN_WALLET_PASSPHRASE (any `export`, `set -gx` or plain\n * assignment naming it), skipping `#` comments. Line numbers are 1-based, as an\n * editor shows them. Only the location is returned, never the line's text: the\n * line may hold the passphrase itself.\n */\nexport function findPassphraseExports(\n files: Array<{ path: string; text: string }>,\n): Array<{ file: string; line: number }> {\n const found: Array<{ file: string; line: number }> = [];\n for (const { path, text } of files) {\n text.split(/\\r?\\n/).forEach((line, i) => {\n if (line.trimStart().startsWith('#')) return;\n if (/\\bTENJIN_WALLET_PASSPHRASE\\b/.test(line)) found.push({ file: path, line: i + 1 });\n });\n }\n return found;\n}\n\nexport interface WalletShowOptions extends ResolveWalletProviderOptions {\n /** `--no-qr`: print the address without the QR block at a TTY. */\n qr?: boolean;\n}\n\nexport async function runWalletShow(\n ctx: CommandContext,\n opts: WalletShowOptions = {},\n): Promise<CommandResult> {\n const provider = resolveWalletProvider(ctx, opts);\n const desc = await describeWallet(provider);\n // Diagnostics are the provider's own: a remote provider reports no local file\n // path or perms warning, so `show` never contaminates a remote wallet's output\n // with a stale local wallet.json's state. keyStorage/passphraseSource are the\n // custody posture reported without decrypting or requiring a passphrase.\n const {\n walletPath: path,\n keyStorage,\n passphraseSource,\n archivedWallets,\n warnings,\n } = await provider.diagnostics();\n\n const humanLines = [\n `Address: ${desc.address}`,\n ...(opts.qr !== false && ctx.io.isTTY && !ctx.flags.json\n ? addressQrLines(desc.address, ctx.io.stdout)\n : []),\n `Key source: ${desc.credentialSource}`,\n ];\n if (keyStorage !== undefined) humanLines.push(`Key storage: ${keyStorage}`);\n if (passphraseSource !== undefined) humanLines.push(`Passphrase: ${passphraseSource}`);\n if (archivedWallets !== undefined && archivedWallets.length > 0) {\n // A recovery hint, not a wallet switcher: exactly one wallet is ever active.\n humanLines.push(\n `Archived (replaced) wallets, funds recoverable via their preserved passphrases: ${archivedWallets.join(', ')}`,\n );\n }\n humanLines.push(...warnings);\n\n return {\n data: {\n address: desc.address,\n provider: desc.provider,\n credentialSource: desc.credentialSource,\n policyEnforcement: desc.policyEnforcement,\n ...(path !== undefined ? { walletPath: path } : {}),\n ...(keyStorage !== undefined ? { keyStorage } : {}),\n ...(passphraseSource !== undefined ? { passphraseSource } : {}),\n ...(archivedWallets !== undefined && archivedWallets.length > 0 ? { archivedWallets } : {}),\n warnings,\n },\n humanLines,\n };\n}\n\n/** `tenjin wallet balance`, the same command as `tenjin balance` (`./balance.ts`). */\nexport async function runWalletBalance(\n ctx: CommandContext,\n opts: BalanceOptions = {},\n): Promise<CommandResult> {\n return runBalance(ctx, opts);\n}\n\nfunction custodyWarnings(): string[] {\n const warnings: string[] = [];\n if (hasEnvKey()) {\n warnings.push('TENJIN_WALLET_KEY is set and shadows this file at runtime.');\n }\n if (isWindows) {\n warnings.push('File permissions are not enforced on Windows; the key file is not restricted.');\n }\n return warnings;\n}\n\nfunction hasEnvKey(): boolean {\n const envKey = process.env.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A,MAAI,WAAW;AACb,aAAS,KAAK,+EAA+E;AAAA,EAC/F;AACA,SAAO;AACT;AAEA,SAAS,YAAqB;AAC5B,QAAM,SAAS,QAAQ,IAAI;AAC3B,SAAO,WAAW,UAAa,OAAO,SAAS;AACjD;","names":[]}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
emitNotice
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KLDMLWXT.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
isNewer,
|
|
7
|
+
parseVersion
|
|
8
|
+
} from "./chunk-5N4GGUBN.js";
|
|
8
9
|
import {
|
|
9
10
|
loadConfig
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
external_exports
|
|
13
|
-
} from "./chunk-SNNSAGMT.js";
|
|
11
|
+
} from "./chunk-UIB33QQP.js";
|
|
14
12
|
import {
|
|
15
13
|
writeFileAtomic
|
|
16
14
|
} from "./chunk-7WEQQJLG.js";
|
|
17
|
-
import {
|
|
18
|
-
isNewer,
|
|
19
|
-
parseVersion
|
|
20
|
-
} from "./chunk-EDJWHDDL.js";
|
|
21
15
|
import {
|
|
22
16
|
updateCheckPath
|
|
23
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JTX3BUDK.js";
|
|
18
|
+
import {
|
|
19
|
+
external_exports
|
|
20
|
+
} from "./chunk-P6YQWIT2.js";
|
|
21
|
+
import {
|
|
22
|
+
package_default
|
|
23
|
+
} from "./chunk-3Y2EHT4F.js";
|
|
24
24
|
|
|
25
25
|
// src/lib/update-check.ts
|
|
26
26
|
import { readFile } from "node:fs/promises";
|
|
@@ -33,7 +33,7 @@ var TagEntrySchema = external_exports.object({
|
|
|
33
33
|
checkedAtMs: external_exports.number(),
|
|
34
34
|
/** The version the tag named. Absent when the answer was unusable. */
|
|
35
35
|
latest: external_exports.string().optional(),
|
|
36
|
-
/** When the nudge was last
|
|
36
|
+
/** When the nudge was last printed for this tag. */
|
|
37
37
|
notifiedAtMs: external_exports.number().optional()
|
|
38
38
|
});
|
|
39
39
|
var CacheSchema = external_exports.object({
|
|
@@ -41,13 +41,8 @@ var CacheSchema = external_exports.object({
|
|
|
41
41
|
tags: external_exports.record(external_exports.string(), TagEntrySchema),
|
|
42
42
|
/**
|
|
43
43
|
* The resolved "you could upgrade" fact, written whenever it changes and
|
|
44
|
-
* cleared when it stops being true
|
|
45
|
-
*
|
|
46
|
-
* Denormalized from `tags` on purpose: the generated hook scripts are
|
|
47
|
-
* standalone .mjs that cannot import this module and do not know which
|
|
48
|
-
* version is running, so a per-tag entry would leave them unable to tell an
|
|
49
|
-
* upgrade from a match. Storing the comparison's ANSWER is what lets a hook
|
|
50
|
-
* report it without reimplementing any of it.
|
|
44
|
+
* cleared when it stops being true, so a reader that does not know the
|
|
45
|
+
* running version can still report it.
|
|
51
46
|
*/
|
|
52
47
|
signal: external_exports.object({ current: external_exports.string(), latest: external_exports.string() }).optional()
|
|
53
48
|
});
|
|
@@ -86,8 +81,7 @@ async function maybeUpdate(deps) {
|
|
|
86
81
|
await writeCache(path, {
|
|
87
82
|
schemaVersion: 1,
|
|
88
83
|
...signal !== void 0 ? { signal } : {},
|
|
89
|
-
//
|
|
90
|
-
// knew, including its own nudge clock.
|
|
84
|
+
// The tag this run did not ask about keeps what it knew.
|
|
91
85
|
tags: {
|
|
92
86
|
...cached?.tags,
|
|
93
87
|
[tag]: {
|
|
@@ -190,4 +184,4 @@ export {
|
|
|
190
184
|
fetchDistTags,
|
|
191
185
|
fetchPublishTime
|
|
192
186
|
};
|
|
193
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-QKEUKBRK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/update-check.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { z } from 'zod';\nimport pkg from '../../package.json';\nimport { writeFileAtomic } from './atomic-json';\nimport { loadConfig } from './config';\nimport type { UpdateMode } from './config';\nimport { emitNotice } from './output';\nimport type { Io } from './output';\nimport type { UpdateAvailable } from '../schemas';\nimport { updateCheckPath } from './paths';\nimport { isNewer, parseVersion } from './version-order';\n\n/**\n * \"A newer tenjin-cli exists\", asked of npm at most once a day and reported as a\n * dim stderr line for a human at a terminal and as `updateAvailable` on the\n * JSON envelope.\n *\n * It reports and never installs: `update.mode auto` installs from\n * lib/auto-update, which the session hooks start, because Tenjin's runtime lets\n * a running session keep its own version.\n *\n * It never affects the command that ran: the fetch happens after the envelope\n * is written, never touches stdout or the exit code, and swallows every\n * failure. CI skips it, and `update.mode off` silences it, npm request included.\n */\n\n/**\n * Silences this check for one process, cache write and registry request\n * included. `update` sets it on its `install --refresh` children: their data\n * dirs come from a settings file this CLI does not own, and `writeCache` would\n * create such a directory where the refresh only converges what exists.\n */\nexport const NUDGE_OPT_OUT = 'TENJIN_NO_UPDATE_CHECK';\n\nconst CHECK_INTERVAL_MS = 86_400_000; // 24h\nconst FETCH_TIMEOUT_MS = 1500;\nconst DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/tenjin-cli/dist-tags';\nconst PACKUMENT_URL = 'https://registry.npmjs.org/tenjin-cli';\n\n/** What is known about one dist-tag: when it was asked, and what it said. */\nconst TagEntrySchema = z.object({\n checkedAtMs: z.number(),\n /** The version the tag named. Absent when the answer was unusable. */\n latest: z.string().optional(),\n /** When the nudge was last printed for this tag. */\n notifiedAtMs: z.number().optional(),\n});\n\n/**\n * A pure cache, so a bad one is re-fetched, never repaired. Keyed by dist-tag;\n * an entry this build did not ask about is carried forward untouched.\n */\nconst CacheSchema = z.object({\n schemaVersion: z.literal(1),\n tags: z.record(z.string(), TagEntrySchema),\n /**\n * The resolved \"you could upgrade\" fact, written whenever it changes and\n * cleared when it stops being true, so a reader that does not know the\n * running version can still report it.\n */\n signal: z.object({ current: z.string(), latest: z.string() }).optional(),\n});\ntype Cache = z.infer<typeof CacheSchema>;\n\n/** `{\"latest\":\"1.2.3\",\"alpha\":\"1.3.0-alpha.1\"}` — tag names are not fixed. */\nconst DistTagsSchema = z.record(z.string(), z.string());\n\nexport interface UpdateCheckDeps {\n dir: string;\n io: Io;\n /** The global --json flag; ANDed with io.isTTY exactly as the emit path does. */\n json: boolean;\n env?: NodeJS.ProcessEnv;\n /** Clock seam (ms since epoch) for deterministic TTL tests. */\n now?: () => number;\n /** Override global fetch (tests inject a stub returning canned Responses). */\n fetchImpl?: typeof fetch;\n /** The running version; defaults to this build's. Injectable for tests. */\n currentVersion?: string;\n /** Resolved update.mode; defaults to reading the config file. */\n mode?: UpdateMode;\n}\n\n/**\n * Print the update nudge if one is due. Never rejects: the caller awaits it\n * after a command's output, so a throw would replace a finished result.\n */\nexport async function maybeUpdate(deps: UpdateCheckDeps): Promise<void> {\n try {\n const env = deps.env ?? process.env;\n // Never in CI, in either mode: a build log cannot act on a nudge, and a\n // build machine must not silently acquire a different binary mid-pipeline.\n if (env.CI !== undefined && env.CI.length > 0) return;\n if (env[NUDGE_OPT_OUT] === '1') return;\n\n const mode = deps.mode ?? (await loadConfig(deps.dir)).update.mode;\n if (mode === 'off') return;\n\n const nowMs = (deps.now ?? Date.now)();\n const current = deps.currentVersion ?? pkg.version;\n const path = updateCheckPath(deps.dir);\n const tag = channelTag(current);\n if (tag === null) return; // a version this build cannot parse follows no channel\n\n // Only this tag's entry answers this binary's question; the other channel's\n // is neither used nor disturbed.\n const cached = await readCache(path);\n const entry = cached?.tags[tag];\n const fresh = entry !== undefined && nowMs - entry.checkedAtMs < CHECK_INTERVAL_MS;\n\n // The same resolver `tenjin update` uses, so the nudge never names a version\n // the command would not install. Only an unreachable registry skips the\n // cache; an unusable answer still moves the clock.\n let latest: string | null;\n if (fresh) {\n latest = entry.latest ?? null;\n } else {\n const answer = await resolveLatest(current, deps);\n if (answer === null) return;\n latest = answer.latest;\n }\n\n const upgradeable = latest !== null && isNewer(latest, current);\n\n // Two clocks: when we last asked npm, and when we last interrupted the\n // human, so a fresh cache does not repeat the line on every command.\n // `human` gates `due` so an agent run, which prints nothing, never stamps\n // the nudge clock and silences a shared machine's terminal for 24h.\n const human = deps.io.isTTY && !deps.json;\n const notifiedAtMs = entry?.notifiedAtMs;\n const due =\n human &&\n upgradeable &&\n (notifiedAtMs === undefined || nowMs - notifiedAtMs >= CHECK_INTERVAL_MS);\n\n // Carried forward when nothing is printed, so asking npm again does not\n // restart the day since the last nudge.\n const nudgedAtMs = due ? nowMs : notifiedAtMs;\n\n const signal = upgradeable && latest !== null ? { current, latest } : undefined;\n const signalChanged =\n cached?.signal?.current !== signal?.current || cached?.signal?.latest !== signal?.latest;\n\n // Nothing learned and nothing said means nothing to write. Not locked: one\n // duplicated line is cheaper than a lock on every command's exit path.\n if (!fresh || due || signalChanged) {\n await writeCache(path, {\n schemaVersion: 1,\n ...(signal !== undefined ? { signal } : {}),\n // The tag this run did not ask about keeps what it knew.\n tags: {\n ...cached?.tags,\n [tag]: {\n checkedAtMs: fresh ? entry.checkedAtMs : nowMs,\n ...(latest !== null ? { latest } : {}),\n ...(nudgedAtMs !== undefined ? { notifiedAtMs: nudgedAtMs } : {}),\n },\n },\n });\n }\n\n // Names the command, not npm: `update` prints its own instructions for an\n // install it cannot perform (a source checkout, a yarn global).\n if (due && latest !== null) {\n emitNotice(\n deps.io,\n `tenjin-cli ${latest} is available (you have ${current}). Update: run tenjin update`,\n { json: deps.json },\n );\n }\n } catch {\n // Every step is already guarded; this keeps the check invisible regardless.\n }\n}\n\n/**\n * What the last check learned, for the envelope. Cache only: this runs before\n * every command's output, so it may not fetch, block or throw. Null when\n * nothing newer is known, the cache is absent or bad, or `update.mode` is `off`.\n */\nexport async function readUpdateSignal(\n dir: string,\n currentVersion?: string,\n): Promise<UpdateAvailable | null> {\n try {\n const current = currentVersion ?? pkg.version;\n const tag = channelTag(current);\n if (tag === null) return null;\n if ((await loadConfig(dir)).update.mode === 'off') return null;\n const cached = await readCache(updateCheckPath(dir));\n const latest = cached?.tags[tag]?.latest;\n if (latest === undefined || !isNewer(latest, current)) return null;\n return { current, latest };\n } catch {\n return null; // never the command's business\n }\n}\n\n/**\n * Which dist-tag this build follows, or null for a version this package has no\n * channel for, so the nudge goes quiet and `tenjin update` refuses rather than\n * call a foreign build \"up to date\". Every build follows `latest`; see\n * RELEASING.md, which changes with this.\n */\nexport function channelTag(version: string): 'latest' | null {\n return parseVersion(version) === null ? null : 'latest';\n}\n\n/**\n * The version this build can move to: whatever sits on the tag it follows, and\n * only that tag, so a tag ahead of `latest` cannot redirect the self-update to\n * an unpromoted build. Null when the tag is absent or names an unparseable\n * version; neither means the registry was unreachable.\n */\nexport function resolveTarget(current: string, tags: Record<string, string>): string | null {\n const channel = channelTag(current);\n if (channel === null) return null;\n const candidate = tags[channel];\n // Unparseable counts as absent: isNewer loses every comparison against junk,\n // so admitting one would read as \"up to date\" forever.\n if (candidate === undefined || parseVersion(candidate) === null) return null;\n return candidate;\n}\n\n/**\n * Ask the registry for tenjin-cli's whole dist-tag map, or null on any failure,\n * a late response included: the timeout bounds the delay a finished command can\n * suffer. The whole map, so a caller can tell an unreachable registry (null)\n * from one that answered without its tag.\n */\nexport async function fetchDistTags(opts: {\n fetchImpl?: typeof fetch;\n timeoutMs: number;\n}): Promise<Record<string, string> | null> {\n const doFetch = opts.fetchImpl ?? fetch;\n let json: unknown;\n try {\n const res = await doFetch(DIST_TAGS_URL, { signal: AbortSignal.timeout(opts.timeoutMs) });\n if (!res.ok) return null;\n json = await res.json();\n } catch {\n return null;\n }\n const parsed = DistTagsSchema.safeParse(json);\n return parsed.success ? parsed.data : null;\n}\n\n/**\n * When the registry says `version` was published (ms since epoch), from the\n * packument's `time` map, since the per-version document has none. Null when\n * the registry could not be asked; `{ publishedAt: null }` when it has no\n * usable time. The registry sets these at publish and a publisher cannot\n * backdate them, which is why `tenjin update --background` can wait on one.\n */\nexport async function fetchPublishTime(\n version: string,\n opts: { fetchImpl?: typeof fetch; timeoutMs: number },\n): Promise<{ publishedAt: number | null } | null> {\n let json: { time?: Record<string, unknown> } | null;\n try {\n const res = await (opts.fetchImpl ?? fetch)(PACKUMENT_URL, {\n signal: AbortSignal.timeout(opts.timeoutMs),\n headers: { accept: 'application/json' },\n });\n if (!res.ok) return null;\n json = (await res.json()) as typeof json;\n } catch {\n return null;\n }\n const raw = json?.time?.[version];\n const at = typeof raw === 'string' ? Date.parse(raw) : NaN;\n return { publishedAt: Number.isNaN(at) ? null : at };\n}\n\n/**\n * The nudge's one-shot: fetch, then resolve. Null when the registry could not be\n * asked; `{ latest: null }` when it answered with nothing usable.\n */\nasync function resolveLatest(\n current: string,\n deps: UpdateCheckDeps,\n): Promise<{ latest: string | null } | null> {\n const tags = await fetchDistTags({ fetchImpl: deps.fetchImpl, timeoutMs: FETCH_TIMEOUT_MS });\n return tags === null ? null : { latest: resolveTarget(current, tags) };\n}\n\nasync function writeCache(path: string, cache: Cache): Promise<void> {\n await writeFileAtomic(path, `${JSON.stringify(cache, null, 2)}\\n`, {\n mode: 0o600,\n dirMode: 0o700,\n });\n}\n\nasync function readCache(path: string): Promise<Cache | null> {\n try {\n const parsed = CacheSchema.safeParse(JSON.parse(await readFile(path, 'utf8')));\n return parsed.success ? parsed.data : null;\n } catch {\n return null;\n }\n}\n\n// Re-exported from ./version-order for existing importers.\nexport { isNewer };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAgClB,IAAM,gBAAgB;AAE7B,IAAM,oBAAoB;AAC1B,IAAM,mBAAmB;AACzB,IAAM,gBAAgB;AACtB,IAAM,gBAAgB;AAGtB,IAAM,iBAAiB,iBAAE,OAAO;AAAA,EAC9B,aAAa,iBAAE,OAAO;AAAA;AAAA,EAEtB,QAAQ,iBAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE5B,cAAc,iBAAE,OAAO,EAAE,SAAS;AACpC,CAAC;AA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