tenjin-cli 0.1.0-alpha.3 → 0.1.0-alpha.30
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 +149 -264
- package/dist/{_esm-FEASBWRP.js → _esm-CE7KNONL.js} +9 -10
- package/dist/alive-3J3CHOQP.js +21 -0
- package/dist/{ccip-NQXCEK2U.js → ccip-7RMRLAGV.js} +4 -4
- package/dist/{ccip-XR5NE5QK.js → ccip-NLCSCHKI.js} +5 -5
- package/dist/chunk-2SNUOHAT.js +75 -0
- package/dist/chunk-2SNUOHAT.js.map +1 -0
- package/dist/chunk-3O2BQIF6.js +2227 -0
- package/dist/chunk-3O2BQIF6.js.map +1 -0
- package/dist/{chunk-ZMHYXMO6.js → chunk-5IEP5EGE.js} +3 -3
- package/dist/chunk-5LJCEMFD.js +12700 -0
- package/dist/chunk-5LJCEMFD.js.map +1 -0
- package/dist/chunk-6W5GYG3W.js +128 -0
- package/dist/chunk-6W5GYG3W.js.map +1 -0
- package/dist/chunk-7EKYXMUO.js +7536 -0
- package/dist/chunk-7EKYXMUO.js.map +1 -0
- package/dist/chunk-7QKHZQKW.js +1680 -0
- package/dist/chunk-7QKHZQKW.js.map +1 -0
- package/dist/chunk-A36LQPHV.js +29 -0
- package/dist/chunk-A36LQPHV.js.map +1 -0
- package/dist/chunk-AEG2PXBP.js +192 -0
- package/dist/chunk-AEG2PXBP.js.map +1 -0
- package/dist/chunk-AKWGE6JQ.js +49 -0
- package/dist/chunk-AKWGE6JQ.js.map +1 -0
- package/dist/chunk-AWFUPKTM.js +238 -0
- package/dist/chunk-AWFUPKTM.js.map +1 -0
- package/dist/{chunk-UGX7YPX2.js → chunk-AWQPGIR6.js} +7 -9
- package/dist/{chunk-UGX7YPX2.js.map → chunk-AWQPGIR6.js.map} +1 -1
- package/dist/{chunk-5CLSD5YN.js → chunk-BPMWXTFX.js} +2 -2
- package/dist/chunk-EBVIKMCH.js +108 -0
- package/dist/chunk-EBVIKMCH.js.map +1 -0
- package/dist/{chunk-YALGASEU.js → chunk-EGELTSPU.js} +2 -2
- package/dist/{chunk-S3IGX57D.js → chunk-EL56RW2J.js} +166 -7237
- package/dist/chunk-EL56RW2J.js.map +1 -0
- package/dist/chunk-HE2MS4QO.js +256 -0
- package/dist/chunk-HE2MS4QO.js.map +1 -0
- package/dist/{chunk-CYOF7ROH.js → chunk-HPWO4O6S.js} +3 -3
- package/dist/chunk-IOODYAXL.js +324 -0
- package/dist/chunk-IOODYAXL.js.map +1 -0
- package/dist/chunk-JMM6YE7J.js +2174 -0
- package/dist/chunk-JMM6YE7J.js.map +1 -0
- package/dist/{chunk-QVX5MWJZ.js → chunk-JRGFKVAZ.js} +2 -2
- package/dist/{chunk-HIVZG55D.js → chunk-KG3D7FIF.js} +2 -2
- package/dist/chunk-KHE6L6TD.js +416 -0
- package/dist/chunk-KHE6L6TD.js.map +1 -0
- package/dist/chunk-KOGZDMHO.js +21 -0
- package/dist/chunk-KOGZDMHO.js.map +1 -0
- package/dist/chunk-KYFZTGMC.js +237 -0
- package/dist/chunk-KYFZTGMC.js.map +1 -0
- package/dist/chunk-LFZJM56J.js +159 -0
- package/dist/chunk-LFZJM56J.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-NCE5NSN6.js → chunk-N35E6CM2.js} +140 -10
- package/dist/chunk-N35E6CM2.js.map +1 -0
- package/dist/chunk-NZIP4PA2.js +114 -0
- package/dist/chunk-NZIP4PA2.js.map +1 -0
- package/dist/chunk-O2FRQ2L2.js +168 -0
- package/dist/chunk-O2FRQ2L2.js.map +1 -0
- package/dist/chunk-OK2TDZQU.js +404 -0
- package/dist/chunk-OK2TDZQU.js.map +1 -0
- package/dist/chunk-ORWL5BSN.js +269 -0
- package/dist/chunk-ORWL5BSN.js.map +1 -0
- package/dist/{chunk-Z6MFJV5Z.js → chunk-OSYTBCUC.js} +850 -499
- package/dist/chunk-OSYTBCUC.js.map +1 -0
- package/dist/chunk-P7LABKCW.js +90 -0
- package/dist/chunk-P7LABKCW.js.map +1 -0
- package/dist/chunk-PAYV4XUA.js +151 -0
- package/dist/chunk-PAYV4XUA.js.map +1 -0
- package/dist/{chunk-ZABPQJ3M.js → chunk-POUWHWID.js} +2 -2
- package/dist/chunk-QUVVWYJW.js +112 -0
- package/dist/chunk-QUVVWYJW.js.map +1 -0
- package/dist/chunk-RAULEAZ6.js +228 -0
- package/dist/chunk-RAULEAZ6.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-SPAVAYSW.js +125 -0
- package/dist/chunk-SPAVAYSW.js.map +1 -0
- package/dist/chunk-TTBKWWTV.js +1605 -0
- package/dist/chunk-TTBKWWTV.js.map +1 -0
- package/dist/{chunk-RRN3YTK7.js → chunk-TTNESUPQ.js} +3 -3
- package/dist/chunk-U6YQ6FRI.js +378 -0
- package/dist/chunk-U6YQ6FRI.js.map +1 -0
- package/dist/chunk-VFMQTSXG.js +29 -0
- package/dist/chunk-VFMQTSXG.js.map +1 -0
- package/dist/chunk-VUFAK2LW.js +115 -0
- package/dist/chunk-VUFAK2LW.js.map +1 -0
- package/dist/chunk-VZGAONSJ.js +194 -0
- package/dist/chunk-VZGAONSJ.js.map +1 -0
- package/dist/{chunk-OYMYCW7J.js → chunk-WO5BJNIB.js} +682 -53
- package/dist/chunk-WO5BJNIB.js.map +1 -0
- package/dist/chunk-WVUSXNIE.js +39 -0
- package/dist/chunk-WVUSXNIE.js.map +1 -0
- package/dist/chunk-XKESD27X.js +10 -0
- package/dist/chunk-XKESD27X.js.map +1 -0
- package/dist/{chunk-HSDCI7OV.js → chunk-XZKD7DIF.js} +3 -3
- package/dist/{chunk-XJIW7USF.js → chunk-YFQOA5AU.js} +118 -9
- package/dist/chunk-YFQOA5AU.js.map +1 -0
- package/dist/chunk-YHKXNYTB.js +105 -0
- package/dist/chunk-YHKXNYTB.js.map +1 -0
- package/dist/{cli-SBXI5AMS.js → cli-O5SN7ZJ4.js} +382 -214
- package/dist/cli-O5SN7ZJ4.js.map +1 -0
- package/dist/config-OJQI27LT.js +45 -0
- package/dist/dist-3LOO6M4U.js +2842 -0
- package/dist/dist-3LOO6M4U.js.map +1 -0
- package/dist/doctor-IQQJHGGM.js +590 -0
- package/dist/doctor-IQQJHGGM.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/fund-WEV6DMTD.js +365 -0
- package/dist/fund-WEV6DMTD.js.map +1 -0
- package/dist/hook-command-D2P3ILRV.js +32 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +19 -0
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +14 -0
- package/dist/hosts/claude/tenjin/.mcp.json +12 -0
- package/dist/hosts/claude/tenjin/hooks/hooks.json +221 -0
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/install-TUCRF32I.js +60 -0
- package/dist/install-identity-WHPNMNMQ.js +26 -0
- package/dist/install-wallet-MA27FTQ5.js +113 -0
- package/dist/install-wallet-MA27FTQ5.js.map +1 -0
- package/dist/mcp-QML7ZMPH.js +13427 -0
- package/dist/mcp-QML7ZMPH.js.map +1 -0
- package/dist/package-LGKYOEPV.js +37 -0
- package/dist/package-LGKYOEPV.js.map +1 -0
- package/dist/paths-POPTXJO6.js +61 -0
- package/dist/paths-POPTXJO6.js.map +1 -0
- package/dist/pay-2C2UBBXJ.js +51 -0
- package/dist/pay-2C2UBBXJ.js.map +1 -0
- package/dist/payments-C44QUFXU.js +106 -0
- package/dist/payments-C44QUFXU.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-KVJX4XIR.js +222 -0
- package/dist/send-KVJX4XIR.js.map +1 -0
- package/dist/status-S7C3WMSH.js +115 -0
- package/dist/status-S7C3WMSH.js.map +1 -0
- package/dist/status-line-YR2T5HC4.js +86 -0
- package/dist/status-line-YR2T5HC4.js.map +1 -0
- package/dist/uninstall-HY6LKIIT.js +149 -0
- package/dist/uninstall-HY6LKIIT.js.map +1 -0
- package/dist/update-OJV22LR3.js +36 -0
- package/dist/update-OJV22LR3.js.map +1 -0
- package/dist/usdc-JK4RRFFQ.js +39 -0
- package/dist/usdc-JK4RRFFQ.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
- package/dist/viemAdapter-By13KInL-X2VY6CY3.js.map +1 -0
- package/dist/wallet-PD2IMZDU.js +39 -0
- package/dist/wallet-PD2IMZDU.js.map +1 -0
- package/dist/wallet-kdf-worker.mjs +980 -0
- package/docs/agent-permissions.md +180 -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-MUBUQVC3.js +0 -67
- package/dist/chunk-MUBUQVC3.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-CE7KNONL.js.map} +0 -0
- /package/dist/{ccip-NQXCEK2U.js.map → alive-3J3CHOQP.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-5CLSD5YN.js.map → chunk-BPMWXTFX.js.map} +0 -0
- /package/dist/{chunk-YALGASEU.js.map → chunk-EGELTSPU.js.map} +0 -0
- /package/dist/{chunk-CYOF7ROH.js.map → chunk-HPWO4O6S.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 → config-OJQI27LT.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → env-proxy-XL4P73MZ.js.map} +0 -0
- /package/dist/{secp256k1-N3ZHU7LB.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
- /package/dist/{usdc-JIAJW4SV.js.map → hook-command-D2P3ILRV.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → install-TUCRF32I.js.map} +0 -0
- /package/dist/{wallet-PA54CRBL.js.map → install-identity-WHPNMNMQ.js.map} +0 -0
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
maybeUpdate,
|
|
4
|
+
readUpdateSignal
|
|
5
|
+
} from "./chunk-VZGAONSJ.js";
|
|
6
|
+
import {
|
|
7
|
+
PERMISSIONS_DOC_URL
|
|
8
|
+
} from "./chunk-A36LQPHV.js";
|
|
2
9
|
import {
|
|
3
10
|
defaultIo,
|
|
4
11
|
emitFailure,
|
|
5
12
|
emitSuccess
|
|
6
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KYFZTGMC.js";
|
|
7
14
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
15
|
+
noteBaseUrlFlag
|
|
16
|
+
} from "./chunk-QUVVWYJW.js";
|
|
17
|
+
import "./chunk-IOODYAXL.js";
|
|
18
|
+
import "./chunk-2I4QTOLB.js";
|
|
19
|
+
import "./chunk-AWFUPKTM.js";
|
|
10
20
|
import {
|
|
11
21
|
CliError,
|
|
12
|
-
dataDir,
|
|
13
22
|
external_exports
|
|
14
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-WO5BJNIB.js";
|
|
24
|
+
import "./chunk-O2FRQ2L2.js";
|
|
25
|
+
import {
|
|
26
|
+
dataDir
|
|
27
|
+
} from "./chunk-SJLTEINJ.js";
|
|
28
|
+
import {
|
|
29
|
+
package_default
|
|
30
|
+
} from "./chunk-VUFAK2LW.js";
|
|
15
31
|
import {
|
|
16
32
|
__commonJS,
|
|
17
33
|
__require,
|
|
@@ -1185,11 +1201,11 @@ var require_suggestSimilar = __commonJS({
|
|
|
1185
1201
|
var require_command = __commonJS({
|
|
1186
1202
|
"node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports) {
|
|
1187
1203
|
"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");
|
|
1204
|
+
var EventEmitter = __require("node:events").EventEmitter;
|
|
1205
|
+
var childProcess = __require("node:child_process");
|
|
1206
|
+
var path = __require("node:path");
|
|
1207
|
+
var fs = __require("node:fs");
|
|
1208
|
+
var process2 = __require("node:process");
|
|
1193
1209
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1194
1210
|
var { CommanderError: CommanderError2 } = require_error();
|
|
1195
1211
|
var { Help: Help2, stripColor } = require_help();
|
|
@@ -3468,268 +3484,415 @@ var {
|
|
|
3468
3484
|
Help
|
|
3469
3485
|
} = import_index.default;
|
|
3470
3486
|
|
|
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"
|
|
3487
|
+
// src/cli/registration.ts
|
|
3488
|
+
var SETUP = "Setup:";
|
|
3489
|
+
var WALLET = "Wallet:";
|
|
3490
|
+
var INTEGRATION = "Integration:";
|
|
3491
|
+
|
|
3492
|
+
// src/cli/core.ts
|
|
3493
|
+
function registerCore(reg) {
|
|
3494
|
+
const { runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2 } = reg;
|
|
3495
|
+
leaf2(SETUP, "install", "set up Tenjin for Claude Code and create a wallet").description(
|
|
3496
|
+
"Set up Claude Code to use Tenjin: a wallet if this machine has none, spend limits for each lookup, and the Claude Code plugin `tenjin` (its routing hooks and its `router` MCP server), registered through Claude Code's own `claude plugin` commands. A settings-based install from an earlier release is removed once the plugin has loaded."
|
|
3497
|
+
).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(
|
|
3498
|
+
"after",
|
|
3499
|
+
`
|
|
3500
|
+
Examples:
|
|
3501
|
+
$ tenjin install
|
|
3502
|
+
$ tenjin install --project
|
|
3503
|
+
$ tenjin install --max-auto-spend 0.50 --session-budget 10
|
|
3504
|
+
|
|
3505
|
+
The daily limit is the control, the per-call limit the runaway guard, and the
|
|
3506
|
+
wallet balance the hard stop. To turn the router off instead:
|
|
3507
|
+
$ tenjin config set router.enabled false
|
|
3508
|
+
|
|
3509
|
+
Learn more:
|
|
3510
|
+
What the router may spend, and what leaves this machine:
|
|
3511
|
+
${PERMISSIONS_DOC_URL}
|
|
3512
|
+
`
|
|
3529
3513
|
).action(async function() {
|
|
3530
3514
|
await runCommand("install", this, async (ctx) => {
|
|
3531
3515
|
const o = this.opts();
|
|
3532
|
-
const {
|
|
3533
|
-
return
|
|
3516
|
+
const { runRouterInstall } = await import("./install-TUCRF32I.js");
|
|
3517
|
+
return runRouterInstall(
|
|
3534
3518
|
{
|
|
3535
|
-
...
|
|
3536
|
-
...o.
|
|
3537
|
-
...
|
|
3519
|
+
...o.project === true ? { project: true } : {},
|
|
3520
|
+
...o.refresh === true ? { refresh: true } : {},
|
|
3521
|
+
...o.yes === true ? { yes: true } : {},
|
|
3522
|
+
...o.wallet === false ? { noWallet: true } : {},
|
|
3523
|
+
...typeof o.maxAutoSpend === "string" ? { maxAutoSpend: o.maxAutoSpend } : {},
|
|
3524
|
+
...typeof o.sessionBudget === "string" ? { sessionBudget: o.sessionBudget } : {}
|
|
3538
3525
|
},
|
|
3539
3526
|
ctx
|
|
3540
3527
|
);
|
|
3541
3528
|
});
|
|
3542
3529
|
});
|
|
3543
|
-
|
|
3530
|
+
leaf2(SETUP, "uninstall", "remove what install wrote; the wallet is kept").description(
|
|
3531
|
+
"Remove the Tenjin plugin `tenjin install` registered, and any settings-based install an earlier release wrote. Your wallet, spend ledger and config are kept."
|
|
3532
|
+
).option("--project", "remove the project-only install").action(async function() {
|
|
3533
|
+
await runCommand("uninstall", this, async (ctx) => {
|
|
3534
|
+
const o = this.opts();
|
|
3535
|
+
const { runRouterUninstall } = await import("./uninstall-HY6LKIIT.js");
|
|
3536
|
+
return runRouterUninstall({ ...o.project === true ? { project: true } : {} }, ctx);
|
|
3537
|
+
});
|
|
3538
|
+
});
|
|
3539
|
+
leaf2(SETUP, "doctor", "check this machine can run a lookup").description(
|
|
3540
|
+
"Check everything a lookup needs: 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. It prints one line per check with a fix for each failure, writes nothing, and exits nonzero if a required one fails."
|
|
3541
|
+
).option("--project", "check the project-only install, as --project registered it").addHelpText(
|
|
3542
|
+
"after",
|
|
3543
|
+
`
|
|
3544
|
+
Examples:
|
|
3545
|
+
$ tenjin doctor
|
|
3546
|
+
$ tenjin doctor --project
|
|
3547
|
+
$ tenjin doctor --json
|
|
3548
|
+
`
|
|
3549
|
+
).action(async function() {
|
|
3544
3550
|
await runCommand("doctor", this, async (ctx) => {
|
|
3545
|
-
const {
|
|
3546
|
-
return
|
|
3551
|
+
const { runRouterDoctor } = await import("./doctor-IQQJHGGM.js");
|
|
3552
|
+
return runRouterDoctor(ctx, this.opts().project === true ? { project: true } : {});
|
|
3553
|
+
});
|
|
3554
|
+
});
|
|
3555
|
+
leaf2(SETUP, "update", "update tenjin-cli to the newest published version").description(
|
|
3556
|
+
"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."
|
|
3557
|
+
).option("--check", "report whether a newer version exists without installing it").action(async function() {
|
|
3558
|
+
await runCommand("update", this, async (ctx) => {
|
|
3559
|
+
const { runUpdate } = await import("./update-OJV22LR3.js");
|
|
3560
|
+
return runUpdate({ check: this.opts().check === true }, ctx);
|
|
3547
3561
|
});
|
|
3548
3562
|
});
|
|
3549
|
-
const config =
|
|
3550
|
-
"
|
|
3563
|
+
const config = leaf2(SETUP, "config", "read and set config values").description(
|
|
3564
|
+
"Print every effective config value, or read and write one. Values are stored in config.json under your Tenjin data dir (~/.tenjin by default)."
|
|
3565
|
+
);
|
|
3566
|
+
config.addHelpText(
|
|
3567
|
+
"after",
|
|
3568
|
+
`
|
|
3569
|
+
Examples:
|
|
3570
|
+
$ tenjin config
|
|
3571
|
+
$ tenjin config set router.context turn
|
|
3572
|
+
$ tenjin config set maxAutoSpend 0.25
|
|
3573
|
+
$ tenjin config set --project router.enabled false
|
|
3574
|
+
`
|
|
3551
3575
|
);
|
|
3552
3576
|
config.action(async function() {
|
|
3553
3577
|
await runCommand("config", this, async (ctx) => {
|
|
3554
|
-
const { runConfigList } = await import("./config-
|
|
3578
|
+
const { runConfigList } = await import("./config-OJQI27LT.js");
|
|
3555
3579
|
return runConfigList(ctx);
|
|
3556
3580
|
});
|
|
3557
3581
|
});
|
|
3558
|
-
|
|
3582
|
+
addGlobalFlags2(config.command("get <key>")).summary("print one effective config value").description(
|
|
3583
|
+
"Print one effective config value by key. The effective value is what the command would use, defaults and environment overrides included."
|
|
3584
|
+
).action(async function(key) {
|
|
3559
3585
|
await runCommand("config.get", this, async (ctx) => {
|
|
3560
|
-
const { runConfigGet } = await import("./config-
|
|
3586
|
+
const { runConfigGet } = await import("./config-OJQI27LT.js");
|
|
3561
3587
|
return runConfigGet({ key }, ctx);
|
|
3562
3588
|
});
|
|
3563
3589
|
});
|
|
3564
|
-
|
|
3590
|
+
addGlobalFlags2(config.command("set <key> <value>")).summary("set a config value").description(
|
|
3591
|
+
"Write one config value, validated against the key it is for. Spend keys take decimal USD."
|
|
3592
|
+
).option(
|
|
3593
|
+
"--project",
|
|
3594
|
+
"write a router key into this project's .tenjin/config.json, which is committed"
|
|
3595
|
+
).option("--local", "with --project, write .tenjin/config.local.json instead, which is yours").action(async function(key, value) {
|
|
3596
|
+
const o = this.opts();
|
|
3565
3597
|
await runCommand("config.set", this, async (ctx) => {
|
|
3566
|
-
const { runConfigSet } = await import("./config-
|
|
3567
|
-
return runConfigSet(
|
|
3598
|
+
const { runConfigSet } = await import("./config-OJQI27LT.js");
|
|
3599
|
+
return runConfigSet(
|
|
3600
|
+
{ key, value, project: o.project === true, local: o.local === true },
|
|
3601
|
+
ctx
|
|
3602
|
+
);
|
|
3568
3603
|
});
|
|
3569
3604
|
});
|
|
3570
|
-
const wallet =
|
|
3571
|
-
|
|
3605
|
+
const wallet = leaf2(
|
|
3606
|
+
WALLET,
|
|
3607
|
+
"wallet",
|
|
3608
|
+
"create, show, fund and send from the local wallet"
|
|
3609
|
+
).description(
|
|
3610
|
+
"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
3611
|
);
|
|
3573
|
-
|
|
3612
|
+
addGlobalFlags2(wallet.command("create")).summary("create a new local wallet").description(
|
|
3613
|
+
"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."
|
|
3614
|
+
).option(
|
|
3615
|
+
"--replace",
|
|
3616
|
+
"archive the existing wallet beside the new one, passphrase preserved, then create a new active wallet"
|
|
3617
|
+
).action(async function() {
|
|
3574
3618
|
await runCommand("wallet.create", this, async (ctx) => {
|
|
3575
|
-
const
|
|
3576
|
-
|
|
3619
|
+
const o = this.opts();
|
|
3620
|
+
const { runWalletCreate } = await import("./wallet-PD2IMZDU.js");
|
|
3621
|
+
return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
|
|
3577
3622
|
});
|
|
3578
3623
|
});
|
|
3579
|
-
|
|
3624
|
+
addGlobalFlags2(wallet.command("show")).alias("address").summary("show the wallet address and key source").description(
|
|
3625
|
+
"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."
|
|
3626
|
+
).option("--no-qr", "print the address without the QR code").action(async function() {
|
|
3580
3627
|
await runCommand("wallet.show", this, async (ctx) => {
|
|
3581
|
-
const
|
|
3582
|
-
|
|
3628
|
+
const o = this.opts();
|
|
3629
|
+
const { runWalletShow } = await import("./wallet-PD2IMZDU.js");
|
|
3630
|
+
return runWalletShow(ctx, o.qr === false ? { qr: false } : {});
|
|
3583
3631
|
});
|
|
3584
3632
|
});
|
|
3585
|
-
|
|
3633
|
+
addGlobalFlags2(wallet.command("balance")).summary("show the wallet USDC balance on Base").description(
|
|
3634
|
+
"Read the wallet USDC balance on Base. It is a chain read: no key is unlocked and nothing is spent."
|
|
3635
|
+
).action(async function() {
|
|
3586
3636
|
await runCommand("wallet.balance", this, async (ctx) => {
|
|
3587
|
-
const { runWalletBalance } = await import("./wallet-
|
|
3637
|
+
const { runWalletBalance } = await import("./wallet-PD2IMZDU.js");
|
|
3588
3638
|
return runWalletBalance(ctx);
|
|
3589
3639
|
});
|
|
3590
3640
|
});
|
|
3591
|
-
|
|
3592
|
-
"
|
|
3593
|
-
).option("--
|
|
3594
|
-
|
|
3641
|
+
addGlobalFlags2(wallet.command("fund [amountUsd]")).summary("fund this wallet through a checkout link for your region").description(
|
|
3642
|
+
"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."
|
|
3643
|
+
).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(
|
|
3644
|
+
"--no-wait",
|
|
3645
|
+
"return once the link is issued instead of polling the balance (already the default when not at a TTY)"
|
|
3646
|
+
).action(async function(amountUsd) {
|
|
3647
|
+
await runCommand("wallet.fund", this, async (ctx) => {
|
|
3595
3648
|
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
|
-
);
|
|
3649
|
+
const { runFund } = await import("./fund-WEV6DMTD.js");
|
|
3650
|
+
return runFund(ctx, {
|
|
3651
|
+
...amountUsd !== void 0 ? { amountUsd } : {},
|
|
3652
|
+
...o.open === false ? { open: false } : {},
|
|
3653
|
+
...o.qr === false ? { qr: false } : {},
|
|
3654
|
+
...o.wait === false ? { wait: false } : {}
|
|
3655
|
+
});
|
|
3607
3656
|
});
|
|
3608
3657
|
});
|
|
3609
|
-
|
|
3610
|
-
"
|
|
3611
|
-
).
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3658
|
+
addGlobalFlags2(wallet.command("send <amount> <token> <to>")).summary("move funds out of the wallet (escape hatch)").description(
|
|
3659
|
+
"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."
|
|
3660
|
+
).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").addHelpText(
|
|
3661
|
+
"after",
|
|
3662
|
+
`
|
|
3663
|
+
Examples:
|
|
3664
|
+
$ tenjin wallet send 5 USDC 0x1234abcd...
|
|
3665
|
+
`
|
|
3666
|
+
).action(async function(amount, token, to) {
|
|
3667
|
+
await runCommand("wallet.send", this, async (ctx) => {
|
|
3668
|
+
const o = this.opts();
|
|
3669
|
+
const { runSend } = await import("./send-KVJX4XIR.js");
|
|
3670
|
+
return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
|
|
3615
3671
|
});
|
|
3616
3672
|
});
|
|
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
|
-
|
|
3673
|
+
leaf2(WALLET, "pay <url>", "pay an x402 endpoint with explicit user consent").description(
|
|
3674
|
+
"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."
|
|
3675
|
+
).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(
|
|
3676
|
+
"--ignore-warnings",
|
|
3677
|
+
"acknowledge direct-payment registry warnings only; all payment checks still apply"
|
|
3678
|
+
).option("--print-body", "print the full body instead of the capped preview").addHelpText(
|
|
3679
|
+
"after",
|
|
3680
|
+
`
|
|
3681
|
+
Examples:
|
|
3682
|
+
$ tenjin pay https://api.example.com/quote --max-price 0.05
|
|
3683
|
+
$ tenjin pay https://api.example.com/quote --json --max-price 0.05 --ignore-warnings --yes
|
|
3684
|
+
$ tenjin pay https://api.example.com/quote -d '{"symbol":"ETH"}' --yes
|
|
3685
|
+
`
|
|
3686
|
+
).action(async function(url) {
|
|
3687
|
+
await runCommand("pay", this, async (ctx) => {
|
|
3624
3688
|
const o = this.opts();
|
|
3625
|
-
const {
|
|
3626
|
-
return
|
|
3689
|
+
const { runPay } = await import("./pay-2C2UBBXJ.js");
|
|
3690
|
+
return runPay(
|
|
3627
3691
|
{
|
|
3628
|
-
|
|
3692
|
+
url,
|
|
3693
|
+
...typeof o.method === "string" ? { method: o.method } : {},
|
|
3694
|
+
...typeof o.data === "string" ? { data: o.data } : {},
|
|
3629
3695
|
...typeof o.maxPrice === "string" ? { maxPrice: o.maxPrice } : {},
|
|
3630
3696
|
...o.yes === true ? { yes: true } : {},
|
|
3631
3697
|
...o.printBody === true ? { printBody: true } : {},
|
|
3632
|
-
...
|
|
3698
|
+
...o.ignoreWarnings === true ? { ignoreWarnings: true } : {}
|
|
3633
3699
|
},
|
|
3634
3700
|
ctx
|
|
3635
3701
|
);
|
|
3636
3702
|
});
|
|
3637
3703
|
});
|
|
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
|
-
|
|
3704
|
+
}
|
|
3705
|
+
|
|
3706
|
+
// src/cli/router.ts
|
|
3707
|
+
function registerRouter(reg) {
|
|
3708
|
+
const { io, runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2, buildContext: buildContext2 } = reg;
|
|
3709
|
+
const hook = leaf2(INTEGRATION, "hook", "run one harness hook handler (called by Claude Code)").description(
|
|
3710
|
+
"The handlers Tenjin's Claude Code plugin runs. Each reads one hook event on stdin and writes the harness response, or nothing, on stdout. You never run these by hand."
|
|
3711
|
+
).helpCommand(false);
|
|
3712
|
+
addGlobalFlags2(hook.command("alive")).summary("SessionStart: mark this session and machine as ones the plugin serves").action(async function() {
|
|
3713
|
+
const ctx = buildContext2(this);
|
|
3714
|
+
const [{ aliveMain }, { default: pkg }] = await Promise.all([
|
|
3715
|
+
import("./alive-3J3CHOQP.js"),
|
|
3716
|
+
import("./package-LGKYOEPV.js")
|
|
3717
|
+
]);
|
|
3718
|
+
await aliveMain({ dataDir: ctx.dataDir, version: pkg.version });
|
|
3719
|
+
});
|
|
3720
|
+
for (const [name, summary] of [
|
|
3721
|
+
["prompt", "UserPromptSubmit: build the session packet and ask the free gate"],
|
|
3722
|
+
["native", "PreToolUse on WebSearch|WebFetch: allow the call, or redirect it"],
|
|
3723
|
+
[
|
|
3724
|
+
"shortfall",
|
|
3725
|
+
"PostToolUse(Failure) on WebSearch|WebFetch: offer a paid lookup when the result came back short"
|
|
3726
|
+
],
|
|
3727
|
+
["agent", "PreToolUse on Agent|Task: append any paid offer to the subagent's task"],
|
|
3728
|
+
["ask", "PreToolUse on AskUserQuestion: allow the question, or redirect it once"],
|
|
3729
|
+
["answer", "PostToolUse on AskUserQuestion: offer a paid lookup beside the user's answers"]
|
|
3730
|
+
]) {
|
|
3731
|
+
addGlobalFlags2(hook.command(name)).summary(summary).action(async function() {
|
|
3732
|
+
const ctx = buildContext2(this);
|
|
3733
|
+
const { runHookCommand } = await import("./hook-command-D2P3ILRV.js");
|
|
3734
|
+
await runHookCommand(name, io, {
|
|
3735
|
+
dataDir: ctx.dataDir,
|
|
3736
|
+
...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {}
|
|
3737
|
+
});
|
|
3669
3738
|
});
|
|
3739
|
+
}
|
|
3740
|
+
hook.command("unknown", { hidden: true, isDefault: true }).argument("[args...]").allowUnknownOption().allowExcessArguments().action(() => {
|
|
3670
3741
|
});
|
|
3671
|
-
|
|
3672
|
-
"
|
|
3673
|
-
).
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
);
|
|
3742
|
+
leaf2(INTEGRATION, "mcp", "run the local stdio MCP server").addOption(new Option("--plugin", "started by the Tenjin Claude Code plugin").hideHelp()).description(
|
|
3743
|
+
"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."
|
|
3744
|
+
).action(async function() {
|
|
3745
|
+
const ctx = buildContext2(this);
|
|
3746
|
+
const { runRouterMcpServer } = await import("./mcp-QML7ZMPH.js");
|
|
3747
|
+
await runRouterMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
|
|
3748
|
+
});
|
|
3749
|
+
leaf2(INTEGRATION, "status-line", "the live footer, for Claude Code's status line").description(
|
|
3750
|
+
"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."
|
|
3751
|
+
).action(async function() {
|
|
3752
|
+
const ctx = buildContext2(this);
|
|
3753
|
+
const { runStatusLine } = await import("./status-line-YR2T5HC4.js");
|
|
3754
|
+
await runStatusLine(io, { dataDir: ctx.dataDir });
|
|
3755
|
+
});
|
|
3756
|
+
leaf2(SETUP, "status", "what this machine has spent, and what is still open").description(
|
|
3757
|
+
"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."
|
|
3758
|
+
).action(async function() {
|
|
3759
|
+
await runCommand("status", this, async (ctx) => {
|
|
3760
|
+
const { runRouterStatus } = await import("./status-S7C3WMSH.js");
|
|
3761
|
+
return runRouterStatus(ctx);
|
|
3690
3762
|
});
|
|
3691
3763
|
});
|
|
3692
|
-
const
|
|
3693
|
-
|
|
3694
|
-
"Manage local publish candidates (parked drafts; nothing uploads until publish)"
|
|
3695
|
-
)
|
|
3764
|
+
const payments = leaf2(SETUP, "payments", "the paid lookups this machine made").description(
|
|
3765
|
+
"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."
|
|
3696
3766
|
);
|
|
3697
|
-
|
|
3698
|
-
await runCommand("
|
|
3699
|
-
const
|
|
3700
|
-
|
|
3701
|
-
return runCandidateAdd(
|
|
3702
|
-
{
|
|
3703
|
-
file,
|
|
3704
|
-
lookupId: String(o.lookupId),
|
|
3705
|
-
...typeof o.question === "string" ? { question: o.question } : {}
|
|
3706
|
-
},
|
|
3707
|
-
ctx
|
|
3708
|
-
);
|
|
3767
|
+
payments.action(async function() {
|
|
3768
|
+
await runCommand("payments", this, async (ctx) => {
|
|
3769
|
+
const { runPaymentsList } = await import("./payments-C44QUFXU.js");
|
|
3770
|
+
return runPaymentsList(ctx);
|
|
3709
3771
|
});
|
|
3710
3772
|
});
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3773
|
+
addGlobalFlags2(payments.command("reconcile")).summary("resolve paid lookups whose settlement is unknown").description(
|
|
3774
|
+
"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."
|
|
3775
|
+
).action(async function() {
|
|
3776
|
+
await runCommand("payments.reconcile", this, async (ctx) => {
|
|
3777
|
+
const { runPaymentsReconcile } = await import("./payments-C44QUFXU.js");
|
|
3778
|
+
return runPaymentsReconcile(ctx);
|
|
3715
3779
|
});
|
|
3716
3780
|
});
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
// src/cli.ts
|
|
3784
|
+
var GlobalOptsSchema = external_exports.object({
|
|
3785
|
+
json: external_exports.boolean().default(false),
|
|
3786
|
+
baseUrl: external_exports.url().optional(),
|
|
3787
|
+
timeout: external_exports.coerce.number().int().positive().default(1e4)
|
|
3788
|
+
});
|
|
3789
|
+
var GLOBAL_FLAGS = [
|
|
3790
|
+
["--json", "emit one machine JSON envelope on stdout instead of the human rendering"],
|
|
3791
|
+
["--base-url <url>", "Tenjin API base URL"],
|
|
3792
|
+
["--timeout <ms>", "request timeout in milliseconds", "10000"]
|
|
3793
|
+
];
|
|
3794
|
+
function addGlobalFlags(cmd) {
|
|
3795
|
+
for (const [flags, help] of GLOBAL_FLAGS) cmd.addOption(new Option(flags, help).hideHelp());
|
|
3796
|
+
return cmd;
|
|
3797
|
+
}
|
|
3798
|
+
function leaf(program2, group, nameAndArgs, summary) {
|
|
3799
|
+
return addGlobalFlags(
|
|
3800
|
+
program2.command(nameAndArgs).helpGroup(group).summary(summary).helpCommand(false).helpOption("-h, --help", "show this help")
|
|
3801
|
+
);
|
|
3802
|
+
}
|
|
3803
|
+
function rootHelpCommand() {
|
|
3804
|
+
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);
|
|
3805
|
+
}
|
|
3806
|
+
function buildContext(cmd, io) {
|
|
3807
|
+
const parsed = GlobalOptsSchema.safeParse(cmd.optsWithGlobals());
|
|
3808
|
+
if (!parsed.success) {
|
|
3809
|
+
throw new CliError("USAGE", "Invalid global option", {
|
|
3810
|
+
fix: "Run `tenjin --help` for usage.",
|
|
3811
|
+
details: parsed.error.issues
|
|
3721
3812
|
});
|
|
3722
|
-
}
|
|
3723
|
-
|
|
3813
|
+
}
|
|
3814
|
+
const flags = {
|
|
3815
|
+
json: parsed.data.json,
|
|
3816
|
+
timeout: parsed.data.timeout,
|
|
3817
|
+
baseUrl: parsed.data.baseUrl
|
|
3818
|
+
};
|
|
3819
|
+
noteBaseUrlFlag(flags.baseUrl);
|
|
3820
|
+
return { flags, dataDir: dataDir(process.env), io };
|
|
3724
3821
|
}
|
|
3725
|
-
|
|
3726
|
-
|
|
3822
|
+
var PRODUCTS = [registerCore, registerRouter];
|
|
3823
|
+
function buildProgram(io, setExit, products = PRODUCTS) {
|
|
3824
|
+
const program2 = new Command();
|
|
3825
|
+
const runCommand = async (command, cmd, run) => {
|
|
3826
|
+
const json = cmd.optsWithGlobals().json === true;
|
|
3827
|
+
const refreshRun = command === "install" && cmd.optsWithGlobals().refresh === true;
|
|
3828
|
+
const updateAvailable = command === "update" ? null : await readUpdateSignal(dataDir(process.env));
|
|
3829
|
+
try {
|
|
3830
|
+
const ctx = buildContext(cmd, io);
|
|
3831
|
+
const result = await run(ctx);
|
|
3832
|
+
emitSuccess(ctx.io, command, result.data, result.humanLines, {
|
|
3833
|
+
json: ctx.flags.json,
|
|
3834
|
+
updateAvailable
|
|
3835
|
+
});
|
|
3836
|
+
} catch (err) {
|
|
3837
|
+
setExit(emitFailure(io, command, err, { json, updateAvailable }).exitCode);
|
|
3838
|
+
}
|
|
3839
|
+
if (command !== "update" && !refreshRun) {
|
|
3840
|
+
await maybeUpdate({ dir: dataDir(process.env), io, json });
|
|
3841
|
+
}
|
|
3842
|
+
};
|
|
3843
|
+
program2.name("tenjin").description(
|
|
3844
|
+
"x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base."
|
|
3845
|
+
).optionsGroup("Global options:").addHelpCommand(rootHelpCommand()).configureOutput({
|
|
3846
|
+
// --help / --version print here (stdout). Nothing else uses writeOut, so
|
|
3847
|
+
// stdout stays a single JSON object for every real command.
|
|
3848
|
+
writeOut: (str) => io.stdout.write(str),
|
|
3849
|
+
// Commander's usage/help text is human decoration: TTY only, never under
|
|
3850
|
+
// --json. This gates on the root's --json (the scope available when a parse
|
|
3851
|
+
// error fires before any subcommand runs); the machine contract for the same
|
|
3852
|
+
// failure goes to stdout via handleParseError, so the two never collide.
|
|
3853
|
+
writeErr: (str) => {
|
|
3854
|
+
if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
|
|
3855
|
+
}
|
|
3856
|
+
}).exitOverride();
|
|
3857
|
+
for (const [flags, help, fallback] of GLOBAL_FLAGS) {
|
|
3858
|
+
const option = new Option(flags, help);
|
|
3859
|
+
program2.addOption(fallback === void 0 ? option : option.default(fallback));
|
|
3860
|
+
}
|
|
3861
|
+
program2.version(package_default.version, "-V, --version", "output the version number").helpOption("-h, --help", "show this help");
|
|
3862
|
+
const registration = {
|
|
3863
|
+
program: program2,
|
|
3864
|
+
io,
|
|
3865
|
+
runCommand,
|
|
3866
|
+
leaf: (group, nameAndArgs, summary) => leaf(program2, group, nameAndArgs, summary),
|
|
3867
|
+
addGlobalFlags,
|
|
3868
|
+
buildContext: (cmd) => buildContext(cmd, io)
|
|
3869
|
+
};
|
|
3870
|
+
for (const register of products) register(registration);
|
|
3871
|
+
program2.addHelpText(
|
|
3872
|
+
"after",
|
|
3873
|
+
`
|
|
3874
|
+
Examples:
|
|
3875
|
+
$ tenjin install
|
|
3876
|
+
$ tenjin wallet fund
|
|
3877
|
+
$ tenjin status
|
|
3878
|
+
|
|
3879
|
+
Learn more:
|
|
3880
|
+
Run \`tenjin <command> --help\` for one command.
|
|
3881
|
+
Permissions: ${PERMISSIONS_DOC_URL}
|
|
3882
|
+
Issues: ${package_default.bugs}
|
|
3883
|
+
`
|
|
3884
|
+
);
|
|
3885
|
+
return program2;
|
|
3727
3886
|
}
|
|
3728
|
-
async function main(argv, io = defaultIo()) {
|
|
3887
|
+
async function main(argv, io = defaultIo(), products = PRODUCTS) {
|
|
3729
3888
|
let exitCode = 0;
|
|
3730
|
-
const program2 = buildProgram(
|
|
3731
|
-
|
|
3732
|
-
|
|
3889
|
+
const program2 = buildProgram(
|
|
3890
|
+
io,
|
|
3891
|
+
(code) => {
|
|
3892
|
+
exitCode = code;
|
|
3893
|
+
},
|
|
3894
|
+
products
|
|
3895
|
+
);
|
|
3733
3896
|
try {
|
|
3734
3897
|
await program2.parseAsync(argv, { from: "user" });
|
|
3735
3898
|
} catch (err) {
|
|
@@ -3739,21 +3902,26 @@ async function main(argv, io = defaultIo()) {
|
|
|
3739
3902
|
}
|
|
3740
3903
|
function handleParseError(err, io, program2) {
|
|
3741
3904
|
const json = program2.opts().json === true;
|
|
3905
|
+
const humanFirst = io.isTTY && !json;
|
|
3742
3906
|
if (err instanceof CommanderError) {
|
|
3743
3907
|
if (err.code === "commander.version" || err.code === "commander.helpDisplayed") {
|
|
3744
3908
|
return 0;
|
|
3745
3909
|
}
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3910
|
+
if (err.code === "commander.help" && err.exitCode === 0) return 0;
|
|
3911
|
+
if (!humanFirst) {
|
|
3912
|
+
const message = err.code === "commander.help" ? "No command specified" : err.message.replace(/^error:\s*/i, "");
|
|
3913
|
+
const usageErr = new CliError("USAGE", message, {
|
|
3914
|
+
fix: "Run `tenjin --help` for available commands."
|
|
3915
|
+
});
|
|
3916
|
+
emitFailure(io, "tenjin", usageErr, { json: true });
|
|
3917
|
+
}
|
|
3751
3918
|
return 2;
|
|
3752
3919
|
}
|
|
3753
3920
|
return emitFailure(io, "tenjin", err, { json }).exitCode;
|
|
3754
3921
|
}
|
|
3755
3922
|
export {
|
|
3923
|
+
PRODUCTS,
|
|
3756
3924
|
buildProgram,
|
|
3757
3925
|
main
|
|
3758
3926
|
};
|
|
3759
|
-
//# sourceMappingURL=cli-
|
|
3927
|
+
//# sourceMappingURL=cli-O5SN7ZJ4.js.map
|