tenjin-cli 0.1.0-alpha.3 → 0.1.0-alpha.31
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 +54 -7
- package/README.md +100 -266
- package/dist/{_esm-FEASBWRP.js → _esm-MEXZI5DL.js} +9 -10
- package/dist/alive-J64H46HI.js +31 -0
- package/dist/{ccip-NQXCEK2U.js → ccip-7RMRLAGV.js} +4 -4
- package/dist/{ccip-XR5NE5QK.js → ccip-NLCSCHKI.js} +5 -5
- package/dist/chunk-27EPWVOY.js +108 -0
- package/dist/chunk-27EPWVOY.js.map +1 -0
- package/dist/chunk-2SNUOHAT.js +75 -0
- package/dist/chunk-2SNUOHAT.js.map +1 -0
- package/dist/{chunk-Z6MFJV5Z.js → chunk-2XLC3AEX.js} +857 -504
- package/dist/chunk-2XLC3AEX.js.map +1 -0
- package/dist/chunk-3623BLPV.js +184 -0
- package/dist/chunk-3623BLPV.js.map +1 -0
- package/dist/chunk-3UCIG4TG.js +65 -0
- package/dist/chunk-3UCIG4TG.js.map +1 -0
- package/dist/chunk-4ZZO6ULA.js +151 -0
- package/dist/chunk-4ZZO6ULA.js.map +1 -0
- package/dist/chunk-5C32RLTA.js +115 -0
- package/dist/chunk-5C32RLTA.js.map +1 -0
- package/dist/{chunk-ZMHYXMO6.js → chunk-5IEP5EGE.js} +3 -3
- package/dist/chunk-5K5W4S66.js +105 -0
- package/dist/chunk-5K5W4S66.js.map +1 -0
- package/dist/chunk-5MARFNSB.js +2018 -0
- package/dist/chunk-5MARFNSB.js.map +1 -0
- package/dist/{chunk-CYOF7ROH.js → chunk-6E5R45ZO.js} +3 -3
- package/dist/chunk-77TCKDEC.js +1987 -0
- package/dist/chunk-77TCKDEC.js.map +1 -0
- package/dist/chunk-7EKYXMUO.js +7536 -0
- package/dist/chunk-7EKYXMUO.js.map +1 -0
- package/dist/chunk-7Q5FDF65.js +159 -0
- package/dist/chunk-7Q5FDF65.js.map +1 -0
- package/dist/chunk-7QKHZQKW.js +1680 -0
- package/dist/chunk-7QKHZQKW.js.map +1 -0
- package/dist/{chunk-MUBUQVC3.js → chunk-7WEQQJLG.js} +6 -5
- package/dist/{chunk-MUBUQVC3.js.map → chunk-7WEQQJLG.js.map} +1 -1
- package/dist/chunk-7WU4OPLP.js +244 -0
- package/dist/chunk-7WU4OPLP.js.map +1 -0
- package/dist/chunk-7ZRL2LBQ.js +192 -0
- package/dist/chunk-7ZRL2LBQ.js.map +1 -0
- package/dist/chunk-A36LQPHV.js +29 -0
- package/dist/chunk-A36LQPHV.js.map +1 -0
- package/dist/chunk-AGZ7PJKY.js +326 -0
- package/dist/chunk-AGZ7PJKY.js.map +1 -0
- package/dist/chunk-AKWGE6JQ.js +49 -0
- package/dist/chunk-AKWGE6JQ.js.map +1 -0
- package/dist/chunk-B7HUUJOK.js +29 -0
- package/dist/chunk-B7HUUJOK.js.map +1 -0
- package/dist/{chunk-S3IGX57D.js → chunk-BL3332HQ.js} +290 -7361
- package/dist/chunk-BL3332HQ.js.map +1 -0
- package/dist/{chunk-5CLSD5YN.js → chunk-BPMWXTFX.js} +2 -2
- package/dist/chunk-D65GNPS3.js +12708 -0
- package/dist/chunk-D65GNPS3.js.map +1 -0
- package/dist/chunk-DOQGNFHM.js +121 -0
- package/dist/chunk-DOQGNFHM.js.map +1 -0
- package/dist/{chunk-YALGASEU.js → chunk-EGELTSPU.js} +2 -2
- package/dist/chunk-FW75G2W4.js +406 -0
- package/dist/chunk-FW75G2W4.js.map +1 -0
- package/dist/chunk-GA7JETVM.js +150 -0
- package/dist/chunk-GA7JETVM.js.map +1 -0
- package/dist/chunk-I3EQFHCD.js +175 -0
- package/dist/chunk-I3EQFHCD.js.map +1 -0
- package/dist/chunk-JKKAIPTU.js +108 -0
- package/dist/chunk-JKKAIPTU.js.map +1 -0
- package/dist/{chunk-QVX5MWJZ.js → chunk-JRGFKVAZ.js} +2 -2
- package/dist/{chunk-NCE5NSN6.js → chunk-K3I7C2MO.js} +142 -12
- package/dist/chunk-K3I7C2MO.js.map +1 -0
- package/dist/chunk-K72RURN3.js +239 -0
- package/dist/chunk-K72RURN3.js.map +1 -0
- package/dist/{chunk-HIVZG55D.js → chunk-KG3D7FIF.js} +2 -2
- package/dist/chunk-KOGZDMHO.js +21 -0
- package/dist/chunk-KOGZDMHO.js.map +1 -0
- package/dist/chunk-KXQ4UIP7.js +228 -0
- package/dist/chunk-KXQ4UIP7.js.map +1 -0
- package/dist/chunk-KXVP2VKA.js +194 -0
- package/dist/chunk-KXVP2VKA.js.map +1 -0
- package/dist/chunk-LEFIX6RS.js +100 -0
- package/dist/chunk-LEFIX6RS.js.map +1 -0
- package/dist/chunk-LHHMV4GU.js +27 -0
- package/dist/chunk-LHHMV4GU.js.map +1 -0
- package/dist/{chunk-YBMMV4Y4.js → chunk-MEFB5KHA.js} +13 -5
- package/dist/chunk-MEFB5KHA.js.map +1 -0
- package/dist/chunk-MNXS2U45.js +1768 -0
- package/dist/chunk-MNXS2U45.js.map +1 -0
- package/dist/{chunk-UGX7YPX2.js → chunk-NEFNKLBE.js} +9 -11
- package/dist/{chunk-UGX7YPX2.js.map → chunk-NEFNKLBE.js.map} +1 -1
- package/dist/chunk-OHRR5OYM.js +63 -0
- package/dist/chunk-OHRR5OYM.js.map +1 -0
- package/dist/chunk-ORWL5BSN.js +269 -0
- package/dist/chunk-ORWL5BSN.js.map +1 -0
- package/dist/chunk-P4NH7OUK.js +398 -0
- package/dist/chunk-P4NH7OUK.js.map +1 -0
- package/dist/{chunk-ZABPQJ3M.js → chunk-POUWHWID.js} +2 -2
- package/dist/chunk-QSCPK4F5.js +145 -0
- package/dist/chunk-QSCPK4F5.js.map +1 -0
- package/dist/chunk-QXP3Z3JN.js +131 -0
- package/dist/chunk-QXP3Z3JN.js.map +1 -0
- package/dist/{chunk-XJIW7USF.js → chunk-R5LCN54M.js} +118 -9
- package/dist/chunk-R5LCN54M.js.map +1 -0
- package/dist/chunk-S4SAZ7OD.js +30 -0
- package/dist/chunk-S4SAZ7OD.js.map +1 -0
- package/dist/chunk-SJLTEINJ.js +117 -0
- package/dist/chunk-SJLTEINJ.js.map +1 -0
- package/dist/{chunk-RRN3YTK7.js → chunk-TTNESUPQ.js} +3 -3
- package/dist/chunk-UKY4CHNC.js +498 -0
- package/dist/chunk-UKY4CHNC.js.map +1 -0
- package/dist/chunk-UQUOVWBG.js +114 -0
- package/dist/chunk-UQUOVWBG.js.map +1 -0
- package/dist/chunk-V6BSF6OC.js +260 -0
- package/dist/chunk-V6BSF6OC.js.map +1 -0
- package/dist/chunk-WJXLQXJY.js +43 -0
- package/dist/chunk-WJXLQXJY.js.map +1 -0
- package/dist/chunk-WK7F3B2E.js +114 -0
- package/dist/chunk-WK7F3B2E.js.map +1 -0
- package/dist/chunk-XKESD27X.js +10 -0
- package/dist/chunk-XKESD27X.js.map +1 -0
- package/dist/chunk-XQJXNMSB.js +23 -0
- package/dist/chunk-XQJXNMSB.js.map +1 -0
- package/dist/{chunk-HSDCI7OV.js → chunk-XZKD7DIF.js} +3 -3
- package/dist/chunk-Y527D4TV.js +56 -0
- package/dist/chunk-Y527D4TV.js.map +1 -0
- package/dist/chunk-YFPY4ONH.js +127 -0
- package/dist/chunk-YFPY4ONH.js.map +1 -0
- package/dist/{chunk-OYMYCW7J.js → chunk-YVFXE7RR.js} +606 -97
- package/dist/chunk-YVFXE7RR.js.map +1 -0
- package/dist/clack-EZ7TDWQU.js +19 -0
- package/dist/claude-cli-2YKABJJZ.js +31 -0
- package/dist/{cli-SBXI5AMS.js → cli-D5OE3URZ.js} +458 -218
- package/dist/cli-D5OE3URZ.js.map +1 -0
- package/dist/codex-event-PPNVRRDH.js +16 -0
- package/dist/codex-host-2RJOJW2B.js +28 -0
- package/dist/codex-install-UUZ6QMBQ.js +221 -0
- package/dist/codex-install-UUZ6QMBQ.js.map +1 -0
- package/dist/config-ZD4OB2DO.js +51 -0
- package/dist/dist-3LOO6M4U.js +2842 -0
- package/dist/dist-3LOO6M4U.js.map +1 -0
- package/dist/doctor-KBR34Q4B.js +601 -0
- package/dist/doctor-KBR34Q4B.js.map +1 -0
- package/dist/env-proxy-XL4P73MZ.js +15 -0
- package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
- package/dist/ethersCompat-Df4a6QIZ-THAVUGIJ.js.map +1 -0
- package/dist/fund-5ITKQGYF.js +372 -0
- package/dist/fund-5ITKQGYF.js.map +1 -0
- package/dist/hook-command-4TYCHHRL.js +39 -0
- package/dist/hook-command-4TYCHHRL.js.map +1 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +19 -0
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +15 -0
- package/dist/hosts/claude/tenjin/.mcp.json +12 -0
- package/dist/hosts/claude/tenjin/hooks/hooks.json +224 -0
- package/dist/hosts/claude/tenjin/hooks/register.tsx +589 -0
- package/dist/hosts/claude/tenjin/types/index.d.ts +41 -0
- package/dist/hosts/codex/.agents/plugins/marketplace.json +20 -0
- package/dist/hosts/codex/tenjin/.codex-plugin/plugin.json +16 -0
- package/dist/hosts/codex/tenjin/.mcp.json +12 -0
- package/dist/hosts/codex/tenjin/hooks/hooks.json +52 -0
- package/dist/hosts-FWZOV26H.js +216 -0
- package/dist/hosts-FWZOV26H.js.map +1 -0
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/install-XWGE4Q7L.js +77 -0
- package/dist/install-XWGE4Q7L.js.map +1 -0
- package/dist/install-identity-K7EJIQFP.js +30 -0
- package/dist/install-identity-K7EJIQFP.js.map +1 -0
- package/dist/install-wallet-XQ6XFZV4.js +117 -0
- package/dist/install-wallet-XQ6XFZV4.js.map +1 -0
- package/dist/mcp-3LIJSSJB.js +13553 -0
- package/dist/mcp-3LIJSSJB.js.map +1 -0
- package/dist/package-ZKQFDWLE.js +37 -0
- package/dist/package-ZKQFDWLE.js.map +1 -0
- package/dist/paths-POPTXJO6.js +61 -0
- package/dist/paths-POPTXJO6.js.map +1 -0
- package/dist/pay-WHBERZ3W.js +55 -0
- package/dist/pay-WHBERZ3W.js.map +1 -0
- package/dist/payments-KVICEKD2.js +110 -0
- package/dist/payments-KVICEKD2.js.map +1 -0
- package/dist/plugin-registration-5TIA564H.js +54 -0
- package/dist/plugin-registration-5TIA564H.js.map +1 -0
- package/dist/redact-6W23GGJC.js +15 -0
- package/dist/redact-6W23GGJC.js.map +1 -0
- package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-ZZZT2CAX.js} +3 -3
- package/dist/secp256k1-ZZZT2CAX.js.map +1 -0
- package/dist/send-7G7Y7DLN.js +228 -0
- package/dist/send-7G7Y7DLN.js.map +1 -0
- package/dist/status-OF7RH5HM.js +120 -0
- package/dist/status-OF7RH5HM.js.map +1 -0
- package/dist/status-line-XOUE6MPL.js +90 -0
- package/dist/status-line-XOUE6MPL.js.map +1 -0
- package/dist/uninstall-JXUAFNDB.js +158 -0
- package/dist/uninstall-JXUAFNDB.js.map +1 -0
- package/dist/update-ZKUERSO2.js +44 -0
- package/dist/update-ZKUERSO2.js.map +1 -0
- package/dist/usdc-OGOGEHV2.js +40 -0
- package/dist/usdc-OGOGEHV2.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-S3DA7DFW.js} +5 -5
- package/dist/viemAdapter-By13KInL-S3DA7DFW.js.map +1 -0
- package/dist/wallet-2HA6W4R4.js +43 -0
- package/dist/wallet-2HA6W4R4.js.map +1 -0
- package/dist/wallet-kdf-worker.mjs +980 -0
- package/docs/agent-permissions.md +196 -0
- package/docs/safety-model.md +59 -0
- package/docs/troubleshooting.md +13 -0
- package/package.json +28 -19
- package/LICENSE +0 -21
- package/dist/buy-EE6SEXP6.js +0 -1598
- package/dist/buy-EE6SEXP6.js.map +0 -1
- package/dist/candidate-ERMSYYQZ.js +0 -127
- package/dist/candidate-ERMSYYQZ.js.map +0 -1
- package/dist/chunk-3OV7E5G5.js +0 -18
- package/dist/chunk-3OV7E5G5.js.map +0 -1
- package/dist/chunk-4ONXEEQL.js +0 -152
- package/dist/chunk-4ONXEEQL.js.map +0 -1
- package/dist/chunk-662MSGZB.js +0 -286
- package/dist/chunk-662MSGZB.js.map +0 -1
- package/dist/chunk-7KUW4MJD.js +0 -59
- package/dist/chunk-7KUW4MJD.js.map +0 -1
- package/dist/chunk-AWPAWHNX.js +0 -333
- package/dist/chunk-AWPAWHNX.js.map +0 -1
- package/dist/chunk-DXTQ3CSI.js +0 -171
- package/dist/chunk-DXTQ3CSI.js.map +0 -1
- package/dist/chunk-ESPNTPQ2.js +0 -207
- package/dist/chunk-ESPNTPQ2.js.map +0 -1
- package/dist/chunk-FJPLRISB.js +0 -79
- package/dist/chunk-FJPLRISB.js.map +0 -1
- package/dist/chunk-GO75V3NZ.js +0 -160
- package/dist/chunk-GO75V3NZ.js.map +0 -1
- package/dist/chunk-JPHG2JW3.js +0 -96
- package/dist/chunk-JPHG2JW3.js.map +0 -1
- package/dist/chunk-NCE5NSN6.js.map +0 -1
- package/dist/chunk-OYMYCW7J.js.map +0 -1
- package/dist/chunk-RY4XKNV3.js +0 -140
- package/dist/chunk-RY4XKNV3.js.map +0 -1
- package/dist/chunk-S3IGX57D.js.map +0 -1
- package/dist/chunk-TLCMMYLY.js +0 -126
- package/dist/chunk-TLCMMYLY.js.map +0 -1
- package/dist/chunk-UO22YNY4.js +0 -69
- package/dist/chunk-UO22YNY4.js.map +0 -1
- package/dist/chunk-XHC6FCGZ.js +0 -261
- package/dist/chunk-XHC6FCGZ.js.map +0 -1
- package/dist/chunk-XJIW7USF.js.map +0 -1
- package/dist/chunk-YBMMV4Y4.js.map +0 -1
- package/dist/chunk-YN5SHIXQ.js +0 -126
- package/dist/chunk-YN5SHIXQ.js.map +0 -1
- package/dist/chunk-Z52RA3NC.js +0 -137
- package/dist/chunk-Z52RA3NC.js.map +0 -1
- package/dist/chunk-Z6MFJV5Z.js.map +0 -1
- package/dist/cli-SBXI5AMS.js.map +0 -1
- package/dist/config-VELDKLHY.js +0 -21
- package/dist/doctor-T3KWNNP2.js +0 -20
- package/dist/inspect-LMKOXE4Y.js +0 -96
- package/dist/inspect-LMKOXE4Y.js.map +0 -1
- package/dist/install-LEX3ENQ6.js +0 -387
- package/dist/install-LEX3ENQ6.js.map +0 -1
- package/dist/lookup-ZPN2Q67N.js +0 -129
- package/dist/lookup-ZPN2Q67N.js.map +0 -1
- package/dist/outcome-N7TAK6WR.js +0 -66
- package/dist/outcome-N7TAK6WR.js.map +0 -1
- package/dist/publish-BKBQQAW4.js +0 -1478
- package/dist/publish-BKBQQAW4.js.map +0 -1
- package/dist/usdc-JIAJW4SV.js +0 -22
- package/dist/wallet-CWEMYVIH.js +0 -179
- package/dist/wallet-CWEMYVIH.js.map +0 -1
- package/dist/wallet-PA54CRBL.js +0 -30
- package/skills/tenjin/SKILL.md +0 -199
- package/skills/tenjin-publish/SKILL.md +0 -111
- package/skills/tenjin-search/SKILL.md +0 -133
- /package/dist/{_esm-FEASBWRP.js.map → _esm-MEXZI5DL.js.map} +0 -0
- /package/dist/{ccip-NQXCEK2U.js.map → alive-J64H46HI.js.map} +0 -0
- /package/dist/{ccip-XR5NE5QK.js.map → ccip-7RMRLAGV.js.map} +0 -0
- /package/dist/{config-VELDKLHY.js.map → ccip-NLCSCHKI.js.map} +0 -0
- /package/dist/{chunk-ZMHYXMO6.js.map → chunk-5IEP5EGE.js.map} +0 -0
- /package/dist/{chunk-CYOF7ROH.js.map → chunk-6E5R45ZO.js.map} +0 -0
- /package/dist/{chunk-5CLSD5YN.js.map → chunk-BPMWXTFX.js.map} +0 -0
- /package/dist/{chunk-YALGASEU.js.map → chunk-EGELTSPU.js.map} +0 -0
- /package/dist/{chunk-QVX5MWJZ.js.map → chunk-JRGFKVAZ.js.map} +0 -0
- /package/dist/{chunk-HIVZG55D.js.map → chunk-KG3D7FIF.js.map} +0 -0
- /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POUWHWID.js.map} +0 -0
- /package/dist/{chunk-RRN3YTK7.js.map → chunk-TTNESUPQ.js.map} +0 -0
- /package/dist/{chunk-HSDCI7OV.js.map → chunk-XZKD7DIF.js.map} +0 -0
- /package/dist/{doctor-T3KWNNP2.js.map → clack-EZ7TDWQU.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → claude-cli-2YKABJJZ.js.map} +0 -0
- /package/dist/{secp256k1-N3ZHU7LB.js.map → codex-event-PPNVRRDH.js.map} +0 -0
- /package/dist/{usdc-JIAJW4SV.js.map → codex-host-2RJOJW2B.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → config-ZD4OB2DO.js.map} +0 -0
- /package/dist/{wallet-PA54CRBL.js.map → env-proxy-XL4P73MZ.js.map} +0 -0
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
maybeUpdate,
|
|
4
|
+
readUpdateSignal
|
|
5
|
+
} from "./chunk-KXVP2VKA.js";
|
|
6
|
+
import {
|
|
7
|
+
PERMISSIONS_DOC_URL
|
|
8
|
+
} from "./chunk-A36LQPHV.js";
|
|
9
|
+
import {
|
|
10
|
+
HARNESSES
|
|
11
|
+
} from "./chunk-WJXLQXJY.js";
|
|
2
12
|
import {
|
|
3
13
|
defaultIo,
|
|
4
14
|
emitFailure,
|
|
5
15
|
emitSuccess
|
|
6
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-K72RURN3.js";
|
|
7
17
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
18
|
+
noteBaseUrlFlag
|
|
19
|
+
} from "./chunk-UQUOVWBG.js";
|
|
20
|
+
import "./chunk-AGZ7PJKY.js";
|
|
21
|
+
import "./chunk-2I4QTOLB.js";
|
|
22
|
+
import "./chunk-7WU4OPLP.js";
|
|
23
|
+
import "./chunk-Y527D4TV.js";
|
|
10
24
|
import {
|
|
11
|
-
CliError,
|
|
12
|
-
dataDir,
|
|
13
25
|
external_exports
|
|
14
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-YVFXE7RR.js";
|
|
27
|
+
import "./chunk-XQJXNMSB.js";
|
|
28
|
+
import {
|
|
29
|
+
CliError
|
|
30
|
+
} from "./chunk-3UCIG4TG.js";
|
|
31
|
+
import "./chunk-27EPWVOY.js";
|
|
32
|
+
import "./chunk-7WEQQJLG.js";
|
|
33
|
+
import {
|
|
34
|
+
dataDir
|
|
35
|
+
} from "./chunk-SJLTEINJ.js";
|
|
36
|
+
import {
|
|
37
|
+
package_default
|
|
38
|
+
} from "./chunk-5C32RLTA.js";
|
|
15
39
|
import {
|
|
16
40
|
__commonJS,
|
|
17
41
|
__require,
|
|
@@ -1185,11 +1209,11 @@ var require_suggestSimilar = __commonJS({
|
|
|
1185
1209
|
var require_command = __commonJS({
|
|
1186
1210
|
"node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports) {
|
|
1187
1211
|
"use strict";
|
|
1188
|
-
var EventEmitter = __require("events").EventEmitter;
|
|
1189
|
-
var childProcess = __require("child_process");
|
|
1190
|
-
var path = __require("path");
|
|
1191
|
-
var fs = __require("fs");
|
|
1192
|
-
var process2 = __require("process");
|
|
1212
|
+
var EventEmitter = __require("node:events").EventEmitter;
|
|
1213
|
+
var childProcess = __require("node:child_process");
|
|
1214
|
+
var path = __require("node:path");
|
|
1215
|
+
var fs = __require("node:fs");
|
|
1216
|
+
var process2 = __require("node:process");
|
|
1193
1217
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1194
1218
|
var { CommanderError: CommanderError2 } = require_error();
|
|
1195
1219
|
var { Help: Help2, stripColor } = require_help();
|
|
@@ -3468,268 +3492,479 @@ var {
|
|
|
3468
3492
|
Help
|
|
3469
3493
|
} = import_index.default;
|
|
3470
3494
|
|
|
3471
|
-
// src/cli.ts
|
|
3472
|
-
var
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
function
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
const runCommand = async (command, cmd, run) => {
|
|
3498
|
-
const json = cmd.optsWithGlobals().json === true;
|
|
3499
|
-
try {
|
|
3500
|
-
const ctx = buildContext(cmd, io);
|
|
3501
|
-
const result = await run(ctx);
|
|
3502
|
-
emitSuccess(ctx.io, command, result.data, result.humanLines, { json: ctx.flags.json });
|
|
3503
|
-
} catch (err) {
|
|
3504
|
-
setExit(emitFailure(io, command, err, { json }).exitCode);
|
|
3505
|
-
}
|
|
3506
|
-
};
|
|
3507
|
-
program2.name("tenjin").description("Tenjin agent CLI for the x402 knowledge marketplace.").version(package_default.version, "-V, --version", "output the version number").option("--json", "emit machine JSON only (suppress human stderr rendering)").option("--base-url <url>", "Tenjin API base URL").option("--timeout <ms>", "request timeout in milliseconds", "10000").configureOutput({
|
|
3508
|
-
// --help / --version print here (stdout). Nothing else uses writeOut, so
|
|
3509
|
-
// stdout stays a single JSON object for every real command.
|
|
3510
|
-
writeOut: (str) => io.stdout.write(str),
|
|
3511
|
-
// Commander's usage/help text is human decoration: TTY only, never under
|
|
3512
|
-
// --json. This gates on the root's --json (the scope available when a parse
|
|
3513
|
-
// error fires before any subcommand runs); the machine contract for the same
|
|
3514
|
-
// failure goes to stdout via handleParseError, so the two never collide.
|
|
3515
|
-
writeErr: (str) => {
|
|
3516
|
-
if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
|
|
3517
|
-
}
|
|
3518
|
-
}).exitOverride();
|
|
3519
|
-
addGlobalFlags(program2.command("install")).description(
|
|
3520
|
-
"Detect installed harnesses (Claude Code, Codex), wire the Tenjin skills, then run the doctor checks last"
|
|
3521
|
-
).option(
|
|
3522
|
-
"--harness <name>",
|
|
3523
|
-
"target a specific harness: claude | codex | shared (repeatable; overrides detection)",
|
|
3524
|
-
collect,
|
|
3525
|
-
[]
|
|
3526
|
-
).option("--dry-run", "print what would change without writing anything").option(
|
|
3527
|
-
"--publish-mode <mode>",
|
|
3528
|
-
"set the publish consent mode non-interactively: review | auto | full-auto"
|
|
3495
|
+
// src/cli/registration.ts
|
|
3496
|
+
var SETUP = "Setup:";
|
|
3497
|
+
var WALLET = "Wallet:";
|
|
3498
|
+
var INTEGRATION = "Integration:";
|
|
3499
|
+
|
|
3500
|
+
// src/cli/core.ts
|
|
3501
|
+
function registerCore(reg) {
|
|
3502
|
+
const { runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2 } = reg;
|
|
3503
|
+
leaf2(SETUP, "install", "set up Tenjin for your agent and create a wallet").description(
|
|
3504
|
+
"Set up Tenjin for your agent: a wallet if this machine has none, spend limits for each lookup, and the Tenjin plugin (its routing hooks and its `router` MCP server), registered through the agent's own plugin commands. Run by an agent, it sets up the agent it runs in. In a terminal, it sets up Claude Code or Codex, whichever this machine has, and asks which when it has both. For Claude Code, a settings-based install from an earlier release is removed once the plugin has loaded. Codex is user scope only."
|
|
3505
|
+
).addOption(hostOverride()).option("--project", "register the plugin for this project only").option("--no-wallet", "create no wallet").option("--refresh", "bring the plugin this machine already has up to this version").option("--yes", "accept the defaults ($5 a day, $0.25 a call) instead of asking").option("--session-budget <usd|none>", "your own daily limit, or none, instead of asking").option("--max-auto-spend <usd>", "your own per-call limit, at least 0.25 (the default)").addHelpText(
|
|
3506
|
+
"after",
|
|
3507
|
+
`
|
|
3508
|
+
Examples:
|
|
3509
|
+
$ tenjin install
|
|
3510
|
+
$ tenjin install --project
|
|
3511
|
+
$ tenjin install --max-auto-spend 0.50 --session-budget 10
|
|
3512
|
+
|
|
3513
|
+
The daily limit is the control, the per-call limit the runaway guard, and the
|
|
3514
|
+
wallet balance the hard stop. To turn the router off instead:
|
|
3515
|
+
$ tenjin config set router.enabled false
|
|
3516
|
+
|
|
3517
|
+
Learn more:
|
|
3518
|
+
What the router may spend, and what leaves this machine:
|
|
3519
|
+
${PERMISSIONS_DOC_URL}
|
|
3520
|
+
`
|
|
3529
3521
|
).action(async function() {
|
|
3530
3522
|
await runCommand("install", this, async (ctx) => {
|
|
3531
3523
|
const o = this.opts();
|
|
3532
|
-
const
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
},
|
|
3539
|
-
|
|
3524
|
+
const harness = o.harness;
|
|
3525
|
+
if (harness === "codex" && o.refresh === true) {
|
|
3526
|
+
throw new CliError("USAGE", "The Codex plugin has no refresh; omit --refresh.");
|
|
3527
|
+
}
|
|
3528
|
+
const { installHosts, otherHostNote, recordInstalledHost, runEach, withNote } = await import("./hosts-FWZOV26H.js");
|
|
3529
|
+
const hostArgs = {
|
|
3530
|
+
...harness !== void 0 ? { harness } : {},
|
|
3531
|
+
...o.project === true ? { project: true } : {},
|
|
3532
|
+
...o.refresh === true ? { refresh: true } : {},
|
|
3533
|
+
...o.yes === true ? { yes: true } : {}
|
|
3534
|
+
};
|
|
3535
|
+
const hosts = await installHosts(hostArgs, ctx);
|
|
3536
|
+
const note = otherHostNote(hostArgs).catch(() => void 0);
|
|
3537
|
+
const out = await runEach(hosts, async (host) => {
|
|
3538
|
+
const one = host === "codex" ? await (await import("./codex-install-UUZ6QMBQ.js")).runCodexInstall(codexArgs(o), ctx) : await (await import("./install-XWGE4Q7L.js")).runRouterInstall(
|
|
3539
|
+
{
|
|
3540
|
+
...o.project === true ? { project: true } : {},
|
|
3541
|
+
...o.refresh === true ? { refresh: true } : {},
|
|
3542
|
+
...o.yes === true ? { yes: true } : {},
|
|
3543
|
+
...o.wallet === false ? { noWallet: true } : {},
|
|
3544
|
+
...typeof o.maxAutoSpend === "string" ? { maxAutoSpend: o.maxAutoSpend } : {},
|
|
3545
|
+
...typeof o.sessionBudget === "string" ? { sessionBudget: o.sessionBudget } : {}
|
|
3546
|
+
},
|
|
3547
|
+
ctx
|
|
3548
|
+
);
|
|
3549
|
+
if (o.refresh !== true) await recordInstalledHost(ctx.dataDir, host);
|
|
3550
|
+
return one;
|
|
3551
|
+
});
|
|
3552
|
+
return withNote(out, await note);
|
|
3553
|
+
});
|
|
3554
|
+
});
|
|
3555
|
+
leaf2(SETUP, "uninstall", "remove what install wrote; the wallet is kept").description(
|
|
3556
|
+
"Remove the Tenjin plugin from each agent `tenjin install` set up, and any settings-based install an earlier release wrote. For Codex it removes the plugin and its marketplace. Your wallet, spend ledger and config are kept."
|
|
3557
|
+
).addOption(hostOverride()).option("--project", "remove the project-only install").action(async function() {
|
|
3558
|
+
await runCommand("uninstall", this, async (ctx) => {
|
|
3559
|
+
const o = this.opts();
|
|
3560
|
+
const harness = o.harness;
|
|
3561
|
+
const { recordedHosts, uninstallEach } = await import("./hosts-FWZOV26H.js");
|
|
3562
|
+
const hosts = await recordedHosts(
|
|
3563
|
+
{ ...harness !== void 0 ? { harness } : {}, project: o.project === true },
|
|
3564
|
+
ctx.dataDir
|
|
3565
|
+
);
|
|
3566
|
+
return uninstallEach(
|
|
3567
|
+
hosts,
|
|
3568
|
+
ctx.dataDir,
|
|
3569
|
+
o.project === true,
|
|
3570
|
+
async (host) => host === "codex" ? (await import("./codex-install-UUZ6QMBQ.js")).runCodexUninstall(codexArgs(o), ctx) : (await import("./uninstall-JXUAFNDB.js")).runRouterUninstall(
|
|
3571
|
+
{ ...o.project === true ? { project: true } : {} },
|
|
3572
|
+
ctx
|
|
3573
|
+
)
|
|
3540
3574
|
);
|
|
3541
3575
|
});
|
|
3542
3576
|
});
|
|
3543
|
-
|
|
3577
|
+
leaf2(SETUP, "doctor", "check this machine can run a lookup").description(
|
|
3578
|
+
"Check everything a lookup needs, for each agent `tenjin install` set up. For Claude Code: the Node floor, Claude Code's version, the Tenjin plugin and its router server, any settings install an earlier release left, the spend limits, the wallet, and the router endpoint answering its 402. For Codex: Codex's hook list for the plugin and its hook trust. It prints one line per check with a fix for each failure, writes nothing, and exits nonzero if a required one fails."
|
|
3579
|
+
).addOption(hostOverride()).option("--project", "check the project-only install, as --project registered it").addHelpText(
|
|
3580
|
+
"after",
|
|
3581
|
+
`
|
|
3582
|
+
Examples:
|
|
3583
|
+
$ tenjin doctor
|
|
3584
|
+
$ tenjin doctor --project
|
|
3585
|
+
$ tenjin doctor --json
|
|
3586
|
+
`
|
|
3587
|
+
).action(async function() {
|
|
3544
3588
|
await runCommand("doctor", this, async (ctx) => {
|
|
3545
|
-
const
|
|
3546
|
-
|
|
3589
|
+
const o = this.opts();
|
|
3590
|
+
const harness = o.harness;
|
|
3591
|
+
const { checkEach, recordedHosts } = await import("./hosts-FWZOV26H.js");
|
|
3592
|
+
const hosts = await recordedHosts(
|
|
3593
|
+
{ ...harness !== void 0 ? { harness } : {}, project: o.project === true },
|
|
3594
|
+
ctx.dataDir
|
|
3595
|
+
);
|
|
3596
|
+
return checkEach(
|
|
3597
|
+
hosts,
|
|
3598
|
+
async (host) => host === "codex" ? (await import("./codex-install-UUZ6QMBQ.js")).runCodexDoctor(codexArgs(o), ctx) : (await import("./doctor-KBR34Q4B.js")).runRouterDoctor(
|
|
3599
|
+
ctx,
|
|
3600
|
+
o.project === true ? { project: true } : {}
|
|
3601
|
+
)
|
|
3602
|
+
);
|
|
3547
3603
|
});
|
|
3548
3604
|
});
|
|
3549
|
-
|
|
3550
|
-
"
|
|
3605
|
+
leaf2(SETUP, "update", "update tenjin-cli to the newest published version").description(
|
|
3606
|
+
"Update tenjin-cli to the newest version npm publishes on the latest tag. It then runs `install --refresh` on the new binary, so the Claude Code plugin is registered at the build that just landed."
|
|
3607
|
+
).option("--check", "report whether a newer version exists without installing it").action(async function() {
|
|
3608
|
+
await runCommand("update", this, async (ctx) => {
|
|
3609
|
+
const { runUpdate } = await import("./update-ZKUERSO2.js");
|
|
3610
|
+
return runUpdate({ check: this.opts().check === true }, ctx);
|
|
3611
|
+
});
|
|
3612
|
+
});
|
|
3613
|
+
const config = leaf2(SETUP, "config", "read and set config values").description(
|
|
3614
|
+
"Print every effective config value, or read and write one. Values are stored in config.json under your Tenjin data dir (~/.tenjin by default)."
|
|
3615
|
+
);
|
|
3616
|
+
config.addHelpText(
|
|
3617
|
+
"after",
|
|
3618
|
+
`
|
|
3619
|
+
Examples:
|
|
3620
|
+
$ tenjin config
|
|
3621
|
+
$ tenjin config set router.context turn
|
|
3622
|
+
$ tenjin config set maxAutoSpend 0.25
|
|
3623
|
+
$ tenjin config set --project router.enabled false
|
|
3624
|
+
`
|
|
3551
3625
|
);
|
|
3552
3626
|
config.action(async function() {
|
|
3553
3627
|
await runCommand("config", this, async (ctx) => {
|
|
3554
|
-
const { runConfigList } = await import("./config-
|
|
3628
|
+
const { runConfigList } = await import("./config-ZD4OB2DO.js");
|
|
3555
3629
|
return runConfigList(ctx);
|
|
3556
3630
|
});
|
|
3557
3631
|
});
|
|
3558
|
-
|
|
3632
|
+
addGlobalFlags2(config.command("get <key>")).summary("print one effective config value").description(
|
|
3633
|
+
"Print one effective config value by key. The effective value is what the command would use, defaults and environment overrides included."
|
|
3634
|
+
).action(async function(key) {
|
|
3559
3635
|
await runCommand("config.get", this, async (ctx) => {
|
|
3560
|
-
const { runConfigGet } = await import("./config-
|
|
3636
|
+
const { runConfigGet } = await import("./config-ZD4OB2DO.js");
|
|
3561
3637
|
return runConfigGet({ key }, ctx);
|
|
3562
3638
|
});
|
|
3563
3639
|
});
|
|
3564
|
-
|
|
3640
|
+
addGlobalFlags2(config.command("set <key> <value>")).summary("set a config value").description(
|
|
3641
|
+
"Write one config value, validated against the key it is for. Spend keys take decimal USD."
|
|
3642
|
+
).option(
|
|
3643
|
+
"--project",
|
|
3644
|
+
"write a router key into this project's .tenjin/config.json, which is committed"
|
|
3645
|
+
).option("--local", "with --project, write .tenjin/config.local.json instead, which is yours").action(async function(key, value) {
|
|
3646
|
+
const o = this.opts();
|
|
3565
3647
|
await runCommand("config.set", this, async (ctx) => {
|
|
3566
|
-
const { runConfigSet } = await import("./config-
|
|
3567
|
-
return runConfigSet(
|
|
3648
|
+
const { runConfigSet } = await import("./config-ZD4OB2DO.js");
|
|
3649
|
+
return runConfigSet(
|
|
3650
|
+
{ key, value, project: o.project === true, local: o.local === true },
|
|
3651
|
+
ctx
|
|
3652
|
+
);
|
|
3568
3653
|
});
|
|
3569
3654
|
});
|
|
3570
|
-
const wallet =
|
|
3571
|
-
|
|
3655
|
+
const wallet = leaf2(
|
|
3656
|
+
WALLET,
|
|
3657
|
+
"wallet",
|
|
3658
|
+
"create, show, fund and send from the local wallet"
|
|
3659
|
+
).description(
|
|
3660
|
+
"Manage the local x402 payment wallet used for paid reads and publishing. The private key is generated on this machine, stored encrypted, and never printed."
|
|
3572
3661
|
);
|
|
3573
|
-
|
|
3662
|
+
addGlobalFlags2(wallet.command("create")).summary("create a new local wallet").description(
|
|
3663
|
+
"Create a new local wallet and store its keystore encrypted under your Tenjin data dir. It refuses when one already exists, so replacing an active wallet is the deliberate --replace."
|
|
3664
|
+
).option(
|
|
3665
|
+
"--replace",
|
|
3666
|
+
"archive the existing wallet beside the new one, passphrase preserved, then create a new active wallet"
|
|
3667
|
+
).action(async function() {
|
|
3574
3668
|
await runCommand("wallet.create", this, async (ctx) => {
|
|
3575
|
-
const
|
|
3576
|
-
|
|
3669
|
+
const o = this.opts();
|
|
3670
|
+
const { runWalletCreate } = await import("./wallet-2HA6W4R4.js");
|
|
3671
|
+
return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
|
|
3577
3672
|
});
|
|
3578
3673
|
});
|
|
3579
|
-
|
|
3674
|
+
addGlobalFlags2(wallet.command("show")).alias("address").summary("show the wallet address and key source").description(
|
|
3675
|
+
"Print the active wallet address and where its key comes from. The private key is never printed, by any flag. At a terminal it also draws the address as a QR code for a phone wallet to scan."
|
|
3676
|
+
).option("--no-qr", "print the address without the QR code").action(async function() {
|
|
3580
3677
|
await runCommand("wallet.show", this, async (ctx) => {
|
|
3581
|
-
const
|
|
3582
|
-
|
|
3678
|
+
const o = this.opts();
|
|
3679
|
+
const { runWalletShow } = await import("./wallet-2HA6W4R4.js");
|
|
3680
|
+
return runWalletShow(ctx, o.qr === false ? { qr: false } : {});
|
|
3583
3681
|
});
|
|
3584
3682
|
});
|
|
3585
|
-
|
|
3683
|
+
addGlobalFlags2(wallet.command("balance")).summary("show the wallet USDC balance on Base").description(
|
|
3684
|
+
"Read the wallet USDC balance on Base. It is a chain read: no key is unlocked and nothing is spent."
|
|
3685
|
+
).action(async function() {
|
|
3586
3686
|
await runCommand("wallet.balance", this, async (ctx) => {
|
|
3587
|
-
const { runWalletBalance } = await import("./wallet-
|
|
3687
|
+
const { runWalletBalance } = await import("./wallet-2HA6W4R4.js");
|
|
3588
3688
|
return runWalletBalance(ctx);
|
|
3589
3689
|
});
|
|
3590
3690
|
});
|
|
3591
|
-
|
|
3592
|
-
"
|
|
3593
|
-
).option("--
|
|
3594
|
-
|
|
3691
|
+
addGlobalFlags2(wallet.command("fund [amountUsd]")).summary("fund this wallet through a checkout link for your region").description(
|
|
3692
|
+
"Get a checkout link for THIS wallet, open it in the browser, and wait for the USDC to land on Base. In the US: Apple Pay or Google Pay with no Coinbase account. Elsewhere: your Coinbase account. The link moves no money: a human completes the payment."
|
|
3693
|
+
).option("--no-open", "print the checkout link without opening a browser").option("--no-qr", "skip the QR code of the address for sending USDC from a phone").option(
|
|
3694
|
+
"--no-wait",
|
|
3695
|
+
"return once the link is issued instead of polling the balance (already the default when not at a TTY)"
|
|
3696
|
+
).action(async function(amountUsd) {
|
|
3697
|
+
await runCommand("wallet.fund", this, async (ctx) => {
|
|
3595
3698
|
const o = this.opts();
|
|
3596
|
-
const {
|
|
3597
|
-
return
|
|
3598
|
-
{
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {}
|
|
3604
|
-
},
|
|
3605
|
-
ctx
|
|
3606
|
-
);
|
|
3699
|
+
const { runFund } = await import("./fund-5ITKQGYF.js");
|
|
3700
|
+
return runFund(ctx, {
|
|
3701
|
+
...amountUsd !== void 0 ? { amountUsd } : {},
|
|
3702
|
+
...o.open === false ? { open: false } : {},
|
|
3703
|
+
...o.qr === false ? { qr: false } : {},
|
|
3704
|
+
...o.wait === false ? { wait: false } : {}
|
|
3705
|
+
});
|
|
3607
3706
|
});
|
|
3608
3707
|
});
|
|
3609
|
-
|
|
3610
|
-
"
|
|
3611
|
-
).
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3708
|
+
addGlobalFlags2(wallet.command("send <amount> <token> <to>")).summary("move funds out of the wallet (escape hatch)").description(
|
|
3709
|
+
"Move funds OUT of the agent wallet: preview the resolved recipient and amount, confirm explicitly, then transfer on Base and print the tx hash. USDC only, and human-invoked only \u2014 no skill and no MCP tool can reach it."
|
|
3710
|
+
).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").addHelpText(
|
|
3711
|
+
"after",
|
|
3712
|
+
`
|
|
3713
|
+
Examples:
|
|
3714
|
+
$ tenjin wallet send 5 USDC 0x1234abcd...
|
|
3715
|
+
`
|
|
3716
|
+
).action(async function(amount, token, to) {
|
|
3717
|
+
await runCommand("wallet.send", this, async (ctx) => {
|
|
3718
|
+
const o = this.opts();
|
|
3719
|
+
const { runSend } = await import("./send-7G7Y7DLN.js");
|
|
3720
|
+
return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
|
|
3615
3721
|
});
|
|
3616
3722
|
});
|
|
3617
|
-
|
|
3618
|
-
"Pay
|
|
3619
|
-
).option("--max-price <usd>", "hard price cap in decimal USD (never bypassed by --yes)").option("--yes", "bypass the interactive confirm only (not the price cap)").option(
|
|
3620
|
-
"--
|
|
3621
|
-
"
|
|
3622
|
-
).
|
|
3623
|
-
|
|
3723
|
+
leaf2(WALLET, "pay <url>", "pay an x402 endpoint with explicit user consent").description(
|
|
3724
|
+
"Pay an x402 endpoint (exact scheme, USDC on Base) with explicit user consent. Manual pay ignores automatic router limits and always confirms; --yes records prior consent for this quote. Never use it as an autonomous workaround for router refusal. Unlisted endpoints need no warning flag. Registry lookup failures or listed-term mismatches require --ignore-warnings separately. Every paid call pays; entitled delivery remains free."
|
|
3725
|
+
).option("-X, --method <method>", "GET (default) or POST (implied by --data)").option("-d, --data <json>", "JSON request body (sent as application/json)").option("--max-price <usd>", "hard price cap in decimal USD (never bypassed by --yes)").option("--yes", "bypass the interactive confirm only (not the price cap)").option(
|
|
3726
|
+
"--ignore-warnings",
|
|
3727
|
+
"acknowledge direct-payment registry warnings only; all payment checks still apply"
|
|
3728
|
+
).option("--print-body", "print the full body instead of the capped preview").addHelpText(
|
|
3729
|
+
"after",
|
|
3730
|
+
`
|
|
3731
|
+
Examples:
|
|
3732
|
+
$ tenjin pay https://api.example.com/quote --max-price 0.05
|
|
3733
|
+
$ tenjin pay https://api.example.com/quote --json --max-price 0.05 --ignore-warnings --yes
|
|
3734
|
+
$ tenjin pay https://api.example.com/quote -d '{"symbol":"ETH"}' --yes
|
|
3735
|
+
`
|
|
3736
|
+
).action(async function(url) {
|
|
3737
|
+
await runCommand("pay", this, async (ctx) => {
|
|
3624
3738
|
const o = this.opts();
|
|
3625
|
-
const {
|
|
3626
|
-
return
|
|
3739
|
+
const { runPay } = await import("./pay-WHBERZ3W.js");
|
|
3740
|
+
return runPay(
|
|
3627
3741
|
{
|
|
3628
|
-
|
|
3742
|
+
url,
|
|
3743
|
+
...typeof o.method === "string" ? { method: o.method } : {},
|
|
3744
|
+
...typeof o.data === "string" ? { data: o.data } : {},
|
|
3629
3745
|
...typeof o.maxPrice === "string" ? { maxPrice: o.maxPrice } : {},
|
|
3630
3746
|
...o.yes === true ? { yes: true } : {},
|
|
3631
3747
|
...o.printBody === true ? { printBody: true } : {},
|
|
3632
|
-
...
|
|
3748
|
+
...o.ignoreWarnings === true ? { ignoreWarnings: true } : {}
|
|
3633
3749
|
},
|
|
3634
3750
|
ctx
|
|
3635
3751
|
);
|
|
3636
3752
|
});
|
|
3637
3753
|
});
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
).
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3754
|
+
}
|
|
3755
|
+
function hostOverride() {
|
|
3756
|
+
return new Option("--harness <host>", "only this agent host, instead of the ones found").choices(
|
|
3757
|
+
HARNESSES
|
|
3758
|
+
);
|
|
3759
|
+
}
|
|
3760
|
+
function codexArgs(o) {
|
|
3761
|
+
return {
|
|
3762
|
+
...o.project === true ? { project: true } : {},
|
|
3763
|
+
...o.yes === true ? { yes: true } : {},
|
|
3764
|
+
...o.wallet === false ? { noWallet: true } : {},
|
|
3765
|
+
...typeof o.maxAutoSpend === "string" ? { maxAutoSpend: o.maxAutoSpend } : {},
|
|
3766
|
+
...typeof o.sessionBudget === "string" ? { sessionBudget: o.sessionBudget } : {}
|
|
3767
|
+
};
|
|
3768
|
+
}
|
|
3769
|
+
|
|
3770
|
+
// src/cli/router.ts
|
|
3771
|
+
function harnessOption() {
|
|
3772
|
+
return new Option("--harness <host>", "the agent host").choices(HARNESSES).default("claude");
|
|
3773
|
+
}
|
|
3774
|
+
function registerRouter(reg) {
|
|
3775
|
+
const { io, runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2, buildContext: buildContext2 } = reg;
|
|
3776
|
+
const hook = leaf2(INTEGRATION, "hook", "run one harness hook handler (called by your agent host)").description(
|
|
3777
|
+
"The handlers Tenjin's Claude Code and Codex plugins run. Each reads one hook event on stdin and writes the harness response, or nothing, on stdout. You never run these by hand."
|
|
3778
|
+
).helpCommand(false);
|
|
3779
|
+
addGlobalFlags2(hook.command("alive")).summary("SessionStart: mark this session and machine as ones the plugin serves").action(async function() {
|
|
3780
|
+
const ctx = buildContext2(this);
|
|
3781
|
+
const [{ aliveMain }, { default: pkg }] = await Promise.all([
|
|
3782
|
+
import("./alive-J64H46HI.js"),
|
|
3783
|
+
import("./package-ZKQFDWLE.js")
|
|
3784
|
+
]);
|
|
3785
|
+
await aliveMain({ dataDir: ctx.dataDir, version: pkg.version });
|
|
3786
|
+
});
|
|
3787
|
+
for (const [name, summary] of [
|
|
3788
|
+
["prompt", "UserPromptSubmit: build the session packet and ask the free gate"],
|
|
3789
|
+
["native", "PreToolUse on WebSearch|WebFetch: allow the call, or redirect it"],
|
|
3790
|
+
[
|
|
3791
|
+
"shortfall",
|
|
3792
|
+
"PostToolUse(Failure) on WebSearch|WebFetch: offer a paid lookup when the result came back short"
|
|
3793
|
+
],
|
|
3794
|
+
["agent", "PreToolUse on Agent|Task: append any paid offer to the subagent's task"],
|
|
3795
|
+
["ask", "PreToolUse on AskUserQuestion: allow the question, or redirect it once"],
|
|
3796
|
+
["answer", "PostToolUse on AskUserQuestion: offer a paid lookup beside the user's answers"]
|
|
3797
|
+
]) {
|
|
3798
|
+
addGlobalFlags2(hook.command(name)).addOption(harnessOption()).summary(summary).action(async function() {
|
|
3799
|
+
const ctx = buildContext2(this);
|
|
3800
|
+
const { runHookCommand } = await import("./hook-command-4TYCHHRL.js");
|
|
3801
|
+
await runHookCommand(name, io, {
|
|
3802
|
+
dataDir: ctx.dataDir,
|
|
3803
|
+
harness: this.opts().harness,
|
|
3804
|
+
...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {}
|
|
3805
|
+
});
|
|
3669
3806
|
});
|
|
3807
|
+
}
|
|
3808
|
+
hook.command("unknown", { hidden: true, isDefault: true }).argument("[args...]").allowUnknownOption().allowExcessArguments().action(() => {
|
|
3670
3809
|
});
|
|
3671
|
-
|
|
3672
|
-
"
|
|
3673
|
-
).
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
return runOutcome(
|
|
3681
|
-
{
|
|
3682
|
-
status: String(o.status),
|
|
3683
|
-
...typeof o.lookupId === "string" ? { lookupId: o.lookupId } : {},
|
|
3684
|
-
...o.last === true ? { last: true } : {},
|
|
3685
|
-
...typeof o.resource === "string" ? { resource: o.resource } : {},
|
|
3686
|
-
...typeof o.contentHash === "string" ? { contentHash: o.contentHash } : {}
|
|
3687
|
-
},
|
|
3688
|
-
ctx
|
|
3689
|
-
);
|
|
3810
|
+
leaf2(INTEGRATION, "mcp", "run the local stdio MCP server").addOption(new Option("--plugin", "started by the Tenjin Claude Code plugin").hideHelp()).addOption(harnessOption().hideHelp()).description(
|
|
3811
|
+
"Run the local stdio MCP server that carries the `request` tool: one free routing decision per lookup, then the provider call, built here from the offer's spec and your assistant's input where it has one, under your local spend policy. It speaks on stdin and stdout and runs until the client disconnects, so it prints no envelope of its own."
|
|
3812
|
+
).action(async function() {
|
|
3813
|
+
const ctx = buildContext2(this);
|
|
3814
|
+
const { runRouterMcpServer } = await import("./mcp-3LIJSSJB.js");
|
|
3815
|
+
await runRouterMcpServer({
|
|
3816
|
+
dataDir: ctx.dataDir,
|
|
3817
|
+
flags: ctx.flags,
|
|
3818
|
+
harness: this.opts().harness
|
|
3690
3819
|
});
|
|
3691
3820
|
});
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
)
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
...typeof o.question === "string" ? { question: o.question } : {}
|
|
3706
|
-
},
|
|
3707
|
-
ctx
|
|
3708
|
-
);
|
|
3821
|
+
leaf2(INTEGRATION, "status-line", "the live footer, for Claude Code's status line").description(
|
|
3822
|
+
"Print one line naming what this session is looking up right now: the provider actually being called, its bounded parameters, and what it cost. It reads Claude Code's status event on stdin for the session identity, reads that session's own progress records, writes nothing, and prints `x402 \xB7 ready` when this session has no activity. Opt-in: set it as your Claude Code status line command yourself."
|
|
3823
|
+
).action(async function() {
|
|
3824
|
+
const ctx = buildContext2(this);
|
|
3825
|
+
const { runStatusLine } = await import("./status-line-XOUE6MPL.js");
|
|
3826
|
+
await runStatusLine(io, { dataDir: ctx.dataDir });
|
|
3827
|
+
});
|
|
3828
|
+
leaf2(SETUP, "status", "what this machine has spent, and what is still open").description(
|
|
3829
|
+
"Report the rolling 24h spend window from spend.json: what has settled, what is reserved by a request still in flight, and the per-call and per-day caps in force."
|
|
3830
|
+
).action(async function() {
|
|
3831
|
+
await runCommand("status", this, async (ctx) => {
|
|
3832
|
+
const { runRouterStatus } = await import("./status-OF7RH5HM.js");
|
|
3833
|
+
return runRouterStatus(ctx);
|
|
3709
3834
|
});
|
|
3710
3835
|
});
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3836
|
+
const payments = leaf2(SETUP, "payments", "the paid lookups this machine made").description(
|
|
3837
|
+
"The local record of paid router lookups, in `~/.tenjin/paid/ledger.jsonl`. A bare `tenjin payments` lists the newest: when, who was paid, how much, whether it settled, and the transaction."
|
|
3838
|
+
);
|
|
3839
|
+
payments.action(async function() {
|
|
3840
|
+
await runCommand("payments", this, async (ctx) => {
|
|
3841
|
+
const { runPaymentsList } = await import("./payments-KVICEKD2.js");
|
|
3842
|
+
return runPaymentsList(ctx);
|
|
3715
3843
|
});
|
|
3716
3844
|
});
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3845
|
+
addGlobalFlags2(payments.command("reconcile")).summary("resolve paid lookups whose settlement is unknown").description(
|
|
3846
|
+
"For each paid lookup whose seller never confirmed settlement and whose authorization has expired, ask USDC on Base (through the configured rpcUrl) whether it was used: used means it was charged, unused means it never can be. Nothing is signed or sent but that one read."
|
|
3847
|
+
).action(async function() {
|
|
3848
|
+
await runCommand("payments.reconcile", this, async (ctx) => {
|
|
3849
|
+
const { runPaymentsReconcile } = await import("./payments-KVICEKD2.js");
|
|
3850
|
+
return runPaymentsReconcile(ctx);
|
|
3721
3851
|
});
|
|
3722
3852
|
});
|
|
3723
|
-
return program2;
|
|
3724
3853
|
}
|
|
3725
|
-
|
|
3726
|
-
|
|
3854
|
+
|
|
3855
|
+
// src/cli.ts
|
|
3856
|
+
var GlobalOptsSchema = external_exports.object({
|
|
3857
|
+
json: external_exports.boolean().default(false),
|
|
3858
|
+
baseUrl: external_exports.url().optional(),
|
|
3859
|
+
timeout: external_exports.coerce.number().int().positive().default(1e4)
|
|
3860
|
+
});
|
|
3861
|
+
var GLOBAL_FLAGS = [
|
|
3862
|
+
["--json", "emit one machine JSON envelope on stdout instead of the human rendering"],
|
|
3863
|
+
["--base-url <url>", "Tenjin API base URL"],
|
|
3864
|
+
["--timeout <ms>", "request timeout in milliseconds", "10000"]
|
|
3865
|
+
];
|
|
3866
|
+
function addGlobalFlags(cmd) {
|
|
3867
|
+
for (const [flags, help] of GLOBAL_FLAGS) cmd.addOption(new Option(flags, help).hideHelp());
|
|
3868
|
+
return cmd;
|
|
3869
|
+
}
|
|
3870
|
+
function leaf(program2, group, nameAndArgs, summary) {
|
|
3871
|
+
return addGlobalFlags(
|
|
3872
|
+
program2.command(nameAndArgs).helpGroup(group).summary(summary).helpCommand(false).helpOption("-h, --help", "show this help")
|
|
3873
|
+
);
|
|
3874
|
+
}
|
|
3875
|
+
function rootHelpCommand() {
|
|
3876
|
+
return new Command("help").argument("[command]", "the command to show help for").helpGroup(SETUP).summary("show help for a command").description("Show help for a command. `tenjin <command> --help` says the same thing.").helpOption(false);
|
|
3877
|
+
}
|
|
3878
|
+
function buildContext(cmd, io) {
|
|
3879
|
+
const parsed = GlobalOptsSchema.safeParse(cmd.optsWithGlobals());
|
|
3880
|
+
if (!parsed.success) {
|
|
3881
|
+
throw new CliError("USAGE", "Invalid global option", {
|
|
3882
|
+
fix: "Run `tenjin --help` for usage.",
|
|
3883
|
+
details: parsed.error.issues
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3886
|
+
const flags = {
|
|
3887
|
+
json: parsed.data.json,
|
|
3888
|
+
timeout: parsed.data.timeout,
|
|
3889
|
+
baseUrl: parsed.data.baseUrl
|
|
3890
|
+
};
|
|
3891
|
+
noteBaseUrlFlag(flags.baseUrl);
|
|
3892
|
+
return { flags, dataDir: dataDir(process.env), io };
|
|
3893
|
+
}
|
|
3894
|
+
var PRODUCTS = [registerCore, registerRouter];
|
|
3895
|
+
function buildProgram(io, setExit, products = PRODUCTS) {
|
|
3896
|
+
const program2 = new Command();
|
|
3897
|
+
const runCommand = async (command, cmd, run) => {
|
|
3898
|
+
const json = cmd.optsWithGlobals().json === true;
|
|
3899
|
+
const refreshRun = command === "install" && cmd.optsWithGlobals().refresh === true;
|
|
3900
|
+
const updateAvailable = command === "update" ? null : await readUpdateSignal(dataDir(process.env));
|
|
3901
|
+
try {
|
|
3902
|
+
const ctx = buildContext(cmd, io);
|
|
3903
|
+
const result = await run(ctx);
|
|
3904
|
+
emitSuccess(ctx.io, command, result.data, result.humanLines, {
|
|
3905
|
+
json: ctx.flags.json,
|
|
3906
|
+
updateAvailable
|
|
3907
|
+
});
|
|
3908
|
+
} catch (err) {
|
|
3909
|
+
setExit(emitFailure(io, command, err, { json, updateAvailable }).exitCode);
|
|
3910
|
+
}
|
|
3911
|
+
if (command !== "update" && !refreshRun) {
|
|
3912
|
+
await maybeUpdate({ dir: dataDir(process.env), io, json });
|
|
3913
|
+
}
|
|
3914
|
+
};
|
|
3915
|
+
program2.name("tenjin").description(
|
|
3916
|
+
"x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base."
|
|
3917
|
+
).optionsGroup("Global options:").addHelpCommand(rootHelpCommand()).configureOutput({
|
|
3918
|
+
// --help / --version print here (stdout). Nothing else uses writeOut, so
|
|
3919
|
+
// stdout stays a single JSON object for every real command.
|
|
3920
|
+
writeOut: (str) => io.stdout.write(str),
|
|
3921
|
+
// Commander's usage/help text is human decoration: TTY only, never under
|
|
3922
|
+
// --json. This gates on the root's --json (the scope available when a parse
|
|
3923
|
+
// error fires before any subcommand runs); the machine contract for the same
|
|
3924
|
+
// failure goes to stdout via handleParseError, so the two never collide.
|
|
3925
|
+
writeErr: (str) => {
|
|
3926
|
+
if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
|
|
3927
|
+
}
|
|
3928
|
+
}).exitOverride();
|
|
3929
|
+
for (const [flags, help, fallback] of GLOBAL_FLAGS) {
|
|
3930
|
+
const option = new Option(flags, help);
|
|
3931
|
+
program2.addOption(fallback === void 0 ? option : option.default(fallback));
|
|
3932
|
+
}
|
|
3933
|
+
program2.version(package_default.version, "-V, --version", "output the version number").helpOption("-h, --help", "show this help");
|
|
3934
|
+
const registration = {
|
|
3935
|
+
program: program2,
|
|
3936
|
+
io,
|
|
3937
|
+
runCommand,
|
|
3938
|
+
leaf: (group, nameAndArgs, summary) => leaf(program2, group, nameAndArgs, summary),
|
|
3939
|
+
addGlobalFlags,
|
|
3940
|
+
buildContext: (cmd) => buildContext(cmd, io)
|
|
3941
|
+
};
|
|
3942
|
+
for (const register of products) register(registration);
|
|
3943
|
+
program2.addHelpText(
|
|
3944
|
+
"after",
|
|
3945
|
+
`
|
|
3946
|
+
Examples:
|
|
3947
|
+
$ tenjin install
|
|
3948
|
+
$ tenjin wallet fund
|
|
3949
|
+
$ tenjin status
|
|
3950
|
+
|
|
3951
|
+
Learn more:
|
|
3952
|
+
Run \`tenjin <command> --help\` for one command.
|
|
3953
|
+
Permissions: ${PERMISSIONS_DOC_URL}
|
|
3954
|
+
Issues: ${package_default.bugs}
|
|
3955
|
+
`
|
|
3956
|
+
);
|
|
3957
|
+
return program2;
|
|
3727
3958
|
}
|
|
3728
|
-
async function main(argv, io = defaultIo()) {
|
|
3959
|
+
async function main(argv, io = defaultIo(), products = PRODUCTS) {
|
|
3729
3960
|
let exitCode = 0;
|
|
3730
|
-
const program2 = buildProgram(
|
|
3731
|
-
|
|
3732
|
-
|
|
3961
|
+
const program2 = buildProgram(
|
|
3962
|
+
io,
|
|
3963
|
+
(code) => {
|
|
3964
|
+
exitCode = code;
|
|
3965
|
+
},
|
|
3966
|
+
products
|
|
3967
|
+
);
|
|
3733
3968
|
try {
|
|
3734
3969
|
await program2.parseAsync(argv, { from: "user" });
|
|
3735
3970
|
} catch (err) {
|
|
@@ -3739,21 +3974,26 @@ async function main(argv, io = defaultIo()) {
|
|
|
3739
3974
|
}
|
|
3740
3975
|
function handleParseError(err, io, program2) {
|
|
3741
3976
|
const json = program2.opts().json === true;
|
|
3977
|
+
const humanFirst = io.isTTY && !json;
|
|
3742
3978
|
if (err instanceof CommanderError) {
|
|
3743
3979
|
if (err.code === "commander.version" || err.code === "commander.helpDisplayed") {
|
|
3744
3980
|
return 0;
|
|
3745
3981
|
}
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3982
|
+
if (err.code === "commander.help" && err.exitCode === 0) return 0;
|
|
3983
|
+
if (!humanFirst) {
|
|
3984
|
+
const message = err.code === "commander.help" ? "No command specified" : err.message.replace(/^error:\s*/i, "");
|
|
3985
|
+
const usageErr = new CliError("USAGE", message, {
|
|
3986
|
+
fix: "Run `tenjin --help` for available commands."
|
|
3987
|
+
});
|
|
3988
|
+
emitFailure(io, "tenjin", usageErr, { json: true });
|
|
3989
|
+
}
|
|
3751
3990
|
return 2;
|
|
3752
3991
|
}
|
|
3753
3992
|
return emitFailure(io, "tenjin", err, { json }).exitCode;
|
|
3754
3993
|
}
|
|
3755
3994
|
export {
|
|
3995
|
+
PRODUCTS,
|
|
3756
3996
|
buildProgram,
|
|
3757
3997
|
main
|
|
3758
3998
|
};
|
|
3759
|
-
//# sourceMappingURL=cli-
|
|
3999
|
+
//# sourceMappingURL=cli-D5OE3URZ.js.map
|