tenjin-cli 0.1.0-alpha.26 → 0.1.0-alpha.28
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/README.md +9 -20
- package/dist/alive-3J3CHOQP.js +21 -0
- package/dist/{chunk-WT7DHJNJ.js → chunk-3QJREVMX.js} +5 -7
- package/dist/{chunk-WT7DHJNJ.js.map → chunk-3QJREVMX.js.map} +1 -1
- package/dist/{chunk-BOAI23CX.js → chunk-6KA4HFX5.js} +21 -15
- package/dist/chunk-6KA4HFX5.js.map +1 -0
- package/dist/chunk-6W5GYG3W.js +128 -0
- package/dist/chunk-6W5GYG3W.js.map +1 -0
- package/dist/{chunk-W36HL4TB.js → chunk-7H3RN4WJ.js} +7 -9
- package/dist/{chunk-W36HL4TB.js.map → chunk-7H3RN4WJ.js.map} +1 -1
- package/dist/{chunk-4HAV6IFE.js → chunk-7R37M6WV.js} +5 -7
- package/dist/{chunk-4HAV6IFE.js.map → chunk-7R37M6WV.js.map} +1 -1
- package/dist/{chunk-LAIZ2AQA.js → chunk-A5H3E5QA.js} +2 -2
- package/dist/{update-QXVH2DE7.js → chunk-AO54FM4H.js} +147 -35
- package/dist/chunk-AO54FM4H.js.map +1 -0
- package/dist/{chunk-XMIVHQ35.js → chunk-B2L53TMK.js} +17 -2
- package/dist/{chunk-XMIVHQ35.js.map → chunk-B2L53TMK.js.map} +1 -1
- package/dist/{chunk-YTM7OURD.js → chunk-BRHREK7E.js} +2 -2
- package/dist/{chunk-YLCWI6ZR.js → chunk-DJYAPACT.js} +79 -36
- package/dist/chunk-DJYAPACT.js.map +1 -0
- package/dist/{chunk-OBPZ36HG.js → chunk-DYSDQE7S.js} +92 -5
- package/dist/chunk-DYSDQE7S.js.map +1 -0
- package/dist/{chunk-EJXIK6WY.js → chunk-FQ6DHINU.js} +80 -48
- package/dist/chunk-FQ6DHINU.js.map +1 -0
- package/dist/chunk-FZTSGQVK.js +52 -0
- package/dist/chunk-FZTSGQVK.js.map +1 -0
- package/dist/{chunk-QF4SSCQV.js → chunk-KAMRYUK2.js} +5 -4
- package/dist/chunk-KAMRYUK2.js.map +1 -0
- package/dist/{chunk-ALJRB7NG.js → chunk-MNTQMZJB.js} +8 -8
- package/dist/{chunk-XICKN3CH.js → chunk-QTND6XWJ.js} +160 -80
- package/dist/chunk-QTND6XWJ.js.map +1 -0
- package/dist/chunk-RLPLYUME.js +115 -0
- package/dist/chunk-RLPLYUME.js.map +1 -0
- package/dist/{chunk-ZLD6MJVJ.js → chunk-S4SAZ7OD.js} +1 -1
- package/dist/chunk-S4SAZ7OD.js.map +1 -0
- package/dist/{chunk-5HS54CLI.js → chunk-UEOWNDQG.js} +8 -10
- package/dist/{chunk-5HS54CLI.js.map → chunk-UEOWNDQG.js.map} +1 -1
- package/dist/{chunk-5INS5ZZF.js → chunk-UOW5JXYY.js} +5 -7
- package/dist/{chunk-5INS5ZZF.js.map → chunk-UOW5JXYY.js.map} +1 -1
- package/dist/chunk-VSUHGRVB.js +1455 -0
- package/dist/chunk-VSUHGRVB.js.map +1 -0
- package/dist/{chunk-Z7R2QDX2.js → chunk-W6JX4LYF.js} +50 -7
- package/dist/chunk-W6JX4LYF.js.map +1 -0
- package/dist/{chunk-UDWGT4FX.js → chunk-XVTD7UWR.js} +14 -8
- package/dist/chunk-XVTD7UWR.js.map +1 -0
- package/dist/{chunk-6JIYGYRB.js → chunk-YFJJYHVG.js} +2 -2
- package/dist/{chunk-DI7WHXOZ.js → chunk-ZG6ZZLO7.js} +898 -521
- package/dist/chunk-ZG6ZZLO7.js.map +1 -0
- package/dist/{chunk-OZ3LWLCI.js → chunk-ZO3X5NPG.js} +4 -6
- package/dist/{chunk-OZ3LWLCI.js.map → chunk-ZO3X5NPG.js.map} +1 -1
- package/dist/{chunk-5NUF4BHR.js → chunk-ZP5PV3JB.js} +4 -4
- package/dist/{chunk-HII5HOQV.js → chunk-ZP7AHN7Z.js} +6 -6
- package/dist/{cli-2U5JB7OQ.js → cli-234DNHN6.js} +53 -51
- package/dist/{cli-2U5JB7OQ.js.map → cli-234DNHN6.js.map} +1 -1
- package/dist/{config-44EGO636.js → config-IY2OJCAK.js} +11 -13
- package/dist/{doctor-BD42BBEG.js → doctor-2UZZF44A.js} +275 -250
- package/dist/doctor-2UZZF44A.js.map +1 -0
- package/dist/{env-proxy-KEGEMWKX.js → env-proxy-XL4P73MZ.js} +2 -2
- package/dist/{fund-WQOOUESE.js → fund-RZ2QFULK.js} +92 -36
- package/dist/{fund-WQOOUESE.js.map → fund-RZ2QFULK.js.map} +1 -1
- package/dist/hook-command-PZHKS7ES.js +31 -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 +11 -0
- package/dist/hosts/claude/tenjin/hooks/hooks.json +206 -0
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/install-O5FJ5EP3.js +48 -0
- package/dist/{install-identity-4RDWTLJ2.js → install-identity-QM44IQ6Z.js} +7 -7
- package/dist/{install-wallet-USHWL7AX.js → install-wallet-Z52EDLPB.js} +14 -14
- package/dist/{mcp-T5SYCLP7.js → mcp-33HAADDF.js} +557 -118
- package/dist/mcp-33HAADDF.js.map +1 -0
- package/dist/package-RT24HTTP.js +37 -0
- package/dist/{pay-276DSSYG.js → pay-IR2V76FX.js} +16 -16
- package/dist/{payments-TZYLJXK3.js → payments-GFV4HU5R.js} +10 -10
- package/dist/{send-YHDKZPED.js → send-PI4NUA7I.js} +13 -13
- package/dist/{status-X2INT6VD.js → status-ZUHTJK46.js} +10 -9
- package/dist/{status-X2INT6VD.js.map → status-ZUHTJK46.js.map} +1 -1
- package/dist/{status-line-QKDJYZGV.js → status-line-2G5JPQAE.js} +6 -6
- package/dist/uninstall-THKUH5ZT.js +136 -0
- package/dist/uninstall-THKUH5ZT.js.map +1 -0
- package/dist/update-NPZDP24E.js +18 -0
- package/dist/update-NPZDP24E.js.map +1 -0
- package/dist/{wallet-CKKB23D5.js → wallet-53EFH4M5.js} +11 -11
- package/dist/wallet-53EFH4M5.js.map +1 -0
- package/docs/agent-permissions.md +32 -21
- package/package.json +3 -3
- package/dist/chunk-65EJJVT3.js +0 -172
- package/dist/chunk-65EJJVT3.js.map +0 -1
- package/dist/chunk-BOAI23CX.js.map +0 -1
- package/dist/chunk-DI7WHXOZ.js.map +0 -1
- package/dist/chunk-EJXIK6WY.js.map +0 -1
- package/dist/chunk-GHR4BTNJ.js +0 -87
- package/dist/chunk-GHR4BTNJ.js.map +0 -1
- package/dist/chunk-H4BOQLWW.js +0 -99
- package/dist/chunk-H4BOQLWW.js.map +0 -1
- package/dist/chunk-JLEF5WHM.js +0 -132
- package/dist/chunk-JLEF5WHM.js.map +0 -1
- package/dist/chunk-OBPZ36HG.js.map +0 -1
- package/dist/chunk-PM2MOXJ3.js +0 -66
- package/dist/chunk-PM2MOXJ3.js.map +0 -1
- package/dist/chunk-QF4SSCQV.js.map +0 -1
- package/dist/chunk-TGLKKLQG.js +0 -11
- package/dist/chunk-TGLKKLQG.js.map +0 -1
- package/dist/chunk-UDWGT4FX.js.map +0 -1
- package/dist/chunk-VNT3CQFV.js +0 -940
- package/dist/chunk-VNT3CQFV.js.map +0 -1
- package/dist/chunk-XICKN3CH.js.map +0 -1
- package/dist/chunk-YHWBDCGS.js +0 -753
- package/dist/chunk-YHWBDCGS.js.map +0 -1
- package/dist/chunk-YLCWI6ZR.js.map +0 -1
- package/dist/chunk-Z7R2QDX2.js.map +0 -1
- package/dist/chunk-ZLD6MJVJ.js.map +0 -1
- package/dist/doctor-BD42BBEG.js.map +0 -1
- package/dist/hook-command-23LC5NRN.js +0 -32
- package/dist/install-REPLHNU7.js +0 -72
- package/dist/mcp-T5SYCLP7.js.map +0 -1
- package/dist/status-line-wiring-LW4HFRHB.js +0 -31
- package/dist/uninstall-NVTGU7JD.js +0 -175
- package/dist/uninstall-NVTGU7JD.js.map +0 -1
- package/dist/update-QXVH2DE7.js.map +0 -1
- /package/dist/{config-44EGO636.js.map → alive-3J3CHOQP.js.map} +0 -0
- /package/dist/{chunk-LAIZ2AQA.js.map → chunk-A5H3E5QA.js.map} +0 -0
- /package/dist/{chunk-YTM7OURD.js.map → chunk-BRHREK7E.js.map} +0 -0
- /package/dist/{chunk-ALJRB7NG.js.map → chunk-MNTQMZJB.js.map} +0 -0
- /package/dist/{chunk-6JIYGYRB.js.map → chunk-YFJJYHVG.js.map} +0 -0
- /package/dist/{chunk-5NUF4BHR.js.map → chunk-ZP5PV3JB.js.map} +0 -0
- /package/dist/{chunk-HII5HOQV.js.map → chunk-ZP7AHN7Z.js.map} +0 -0
- /package/dist/{env-proxy-KEGEMWKX.js.map → config-IY2OJCAK.js.map} +0 -0
- /package/dist/{hook-command-23LC5NRN.js.map → env-proxy-XL4P73MZ.js.map} +0 -0
- /package/dist/{install-REPLHNU7.js.map → hook-command-PZHKS7ES.js.map} +0 -0
- /package/dist/{install-identity-4RDWTLJ2.js.map → install-O5FJ5EP3.js.map} +0 -0
- /package/dist/{pay-276DSSYG.js.map → install-identity-QM44IQ6Z.js.map} +0 -0
- /package/dist/{install-wallet-USHWL7AX.js.map → install-wallet-Z52EDLPB.js.map} +0 -0
- /package/dist/{status-line-wiring-LW4HFRHB.js.map → package-RT24HTTP.js.map} +0 -0
- /package/dist/{wallet-CKKB23D5.js.map → pay-IR2V76FX.js.map} +0 -0
- /package/dist/{payments-TZYLJXK3.js.map → payments-GFV4HU5R.js.map} +0 -0
- /package/dist/{send-YHDKZPED.js.map → send-PI4NUA7I.js.map} +0 -0
- /package/dist/{status-line-QKDJYZGV.js.map → status-line-2G5JPQAE.js.map} +0 -0
|
@@ -5,15 +5,13 @@ import {
|
|
|
5
5
|
mainWorktreeOf,
|
|
6
6
|
ownedCandidates,
|
|
7
7
|
projectRoot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZP7AHN7Z.js";
|
|
9
9
|
import {
|
|
10
10
|
CONFIG_DEFAULTS,
|
|
11
|
+
CliError,
|
|
11
12
|
loadRawConfig,
|
|
12
13
|
parseRouterLayer
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
CliError
|
|
16
|
-
} from "./chunk-JLEF5WHM.js";
|
|
14
|
+
} from "./chunk-QTND6XWJ.js";
|
|
17
15
|
import {
|
|
18
16
|
configPath
|
|
19
17
|
} from "./chunk-K6AXXYCG.js";
|
|
@@ -124,4 +122,4 @@ export {
|
|
|
124
122
|
readProjectRouterFile,
|
|
125
123
|
projectRouterPath
|
|
126
124
|
};
|
|
127
|
-
//# sourceMappingURL=chunk-
|
|
125
|
+
//# sourceMappingURL=chunk-ZO3X5NPG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/router/settings.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport {\n CONFIG_DEFAULTS,\n loadRawConfig,\n parseRouterLayer,\n type PartialConfig,\n type RouterContext,\n type RouterLayer,\n} from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { configPath } from '../lib/paths';\nimport {\n findAllProjectFiles,\n findNearestProjectFiles,\n mainWorktreeOf,\n ownedCandidates,\n projectRoot,\n type ProjectWalkDeps,\n} from '../lib/settings';\n\n/**\n * THE ONE READER OF THE ROUTER'S OWN KEYS, `router.enabled` and\n * `router.context`. Both hooks, the `request` tool, doctor, the status line and\n * `tenjin config` call {@link routerSettings} first, and nothing reads a router\n * key any other way.\n *\n * THE LAYERS: the default, `~/.tenjin/config.json`, then EVERY\n * `.tenjin/config.json` and `config.local.json` from the working directory up\n * to the git root, and in a linked git worktree the main checkout's pair too.\n * No environment variable.\n *\n * EVERY LAYER IS A FLOOR. `enabled` is false when any layer says false, and\n * `context` is `turn` when any layer says turn; a key a file leaves out\n * inherits, and a looser value is not read. So a file a cloned repository\n * carries cannot undo `tenjin config set router.enabled false` on this\n * machine, a package in a monorepo cannot undo its root, and a\n * `config.local.json` a repository commits anyway cannot undo the committed\n * one. Both keys fail toward less data sent, and no project file has a spend\n * key to loosen. The source reported is the nearest layer at the value.\n *\n * ONE PARSER. The global block is the one `loadRawConfig` already validated,\n * and a project file goes through `parseRouterLayer` from the same schema.\n */\n\n/** The committed project file and the personal one beside it. */\nexport const PROJECT_ROUTER_FILE = join('.tenjin', 'config.json');\nexport const LOCAL_ROUTER_FILE = join('.tenjin', 'config.local.json');\n\nexport type RouterSource = 'default' | 'file' | 'project' | 'local';\n\nexport interface RouterSetting<T> {\n value: T;\n source: RouterSource;\n /** The file that set it; absent for the default. */\n path?: string;\n}\n\nexport interface RouterSettings {\n enabled: RouterSetting<boolean>;\n context: RouterSetting<RouterContext>;\n}\n\nexport interface RouterSettingsInput {\n /** The directory the harness is working in. */\n cwd: string;\n /** The data dir whose `config.json` is the global layer. */\n dataDir: string;\n /** That file, when the caller has already loaded it; read here otherwise. */\n config?: PartialConfig;\n}\n\nexport async function routerSettings(\n input: RouterSettingsInput,\n deps: ProjectWalkDeps = {},\n): Promise<RouterSettings> {\n const globalPath = configPath(input.dataDir);\n const global = (input.config ?? (await loadRawConfig(input.dataDir))).router;\n let enabled: RouterSetting<boolean> = {\n value: CONFIG_DEFAULTS.router.enabled,\n source: 'default',\n };\n let context: RouterSetting<RouterContext> = {\n value: CONFIG_DEFAULTS.router.context,\n source: 'default',\n };\n if (global?.enabled !== undefined) {\n enabled = { value: global.enabled, source: 'file', path: globalPath };\n }\n if (global?.context !== undefined) {\n context = { value: global.context, source: 'file', path: globalPath };\n }\n\n for (const { source, path, layer } of await projectLayers(input, deps)) {\n // Every layer is a floor: a value looser than the one so far is not read.\n if (layer.enabled !== undefined && (layer.enabled === false || enabled.value)) {\n enabled = { value: layer.enabled, source, path };\n }\n if (layer.context !== undefined && (layer.context === 'turn' || context.value === 'session')) {\n context = { value: layer.context, source, path };\n }\n }\n return { enabled, context };\n}\n\nconst ROUTER_FILES = [PROJECT_ROUTER_FILE, LOCAL_ROUTER_FILE];\n\n/**\n * Every project layer, outermost first so the nearest one at a value is the\n * one reported: the main checkout's pair when this is a linked worktree, then\n * each directory from the git root down to `cwd`, its project file before its\n * personal one.\n */\nasync function projectLayers(\n input: RouterSettingsInput,\n deps: ProjectWalkDeps,\n): Promise<{ source: 'project' | 'local'; path: string; layer: RouterLayer }[]> {\n const { levels, gitRoot } = await findAllProjectFiles(input.cwd, ROUTER_FILES, {\n ...deps,\n // $HOME/.tenjin is the global scope, not a project.\n homeIsProject: false,\n });\n const main = gitRoot === null ? null : await mainWorktreeOf(gitRoot, deps.homeDir);\n const outer =\n main === null ? [] : [{ dir: main, found: await ownedCandidates(main, ROUTER_FILES, deps) }];\n const layers = [];\n for (const { dir, found } of [...outer, ...levels.reverse()]) {\n // A data dir kept inside a project is the global file, already read.\n if (resolve(dir, '.tenjin') === resolve(input.dataDir)) continue;\n for (const path of found) {\n const file = await readProjectRouterFile(path);\n if (file === null) continue;\n layers.push({\n source: path === join(dir, LOCAL_ROUTER_FILE) ? ('local' as const) : ('project' as const),\n path,\n layer: file.layer,\n });\n }\n }\n return layers;\n}\n\nconst ABSENT = new Set(['ENOENT', 'ENOTDIR']);\n\n/**\n * One project file: its whole JSON, for a writer that keeps sibling keys, and\n * its router layer through the one parser. Null when there is no file.\n */\nexport async function readProjectRouterFile(\n path: string,\n): Promise<{ json: Record<string, unknown>; layer: RouterLayer } | null> {\n let raw: string;\n try {\n raw = await readFile(path, 'utf8');\n } catch (err) {\n if (ABSENT.has(String((err as { code?: unknown }).code))) return null;\n throw invalid(path, 'could not be read', err);\n }\n let json: unknown;\n try {\n json = JSON.parse(raw);\n } catch (err) {\n throw invalid(path, 'is not valid JSON', err);\n }\n const layer = parseRouterLayer(json, path);\n return { json: json as Record<string, unknown>, layer };\n}\n\n/**\n * Where `tenjin config set --project [--local]` writes from `cwd`: beside the\n * layer {@link routerSettings} already reads there, else at the git root, else\n * in `cwd`. Never in $HOME, whose `.tenjin/config.json` is the global file.\n */\nexport async function projectRouterPath(\n input: { cwd: string; local: boolean },\n deps: ProjectWalkDeps = {},\n): Promise<string> {\n const home = deps.homeDir ?? homedir();\n const hit = await findNearestProjectFiles(input.cwd, [PROJECT_ROUTER_FILE, LOCAL_ROUTER_FILE], {\n ...deps,\n warn: () => undefined,\n homeIsProject: false,\n });\n const dir = hit?.dir ?? (await projectRoot(input.cwd, home));\n if (dir === home) {\n throw new CliError(\n 'USAGE',\n 'Your home directory is not a project: its .tenjin is the global config.',\n {\n fix: 'Run it from inside the project, or drop --project to set it for this machine.',\n },\n );\n }\n return join(dir, input.local ? LOCAL_ROUTER_FILE : PROJECT_ROUTER_FILE);\n}\n\nfunction invalid(path: string, what: string, cause?: unknown): CliError {\n return new CliError('CONFIG_INVALID', `Config at ${path} ${what}`, {\n fix: `Fix ${path}, or delete it.`,\n ...(cause !== undefined ? { cause } : {}),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;AA6CvB,IAAM,sBAAsB,KAAK,WAAW,aAAa;AACzD,IAAM,oBAAoB,KAAK,WAAW,mBAAmB;AAyBpE,eAAsB,eACpB,OACA,OAAwB,CAAC,GACA;AACzB,QAAM,aAAa,WAAW,MAAM,OAAO;AAC3C,QAAM,UAAU,MAAM,UAAW,MAAM,cAAc,MAAM,OAAO,GAAI;AACtE,MAAI,UAAkC;AAAA,IACpC,OAAO,gBAAgB,OAAO;AAAA,IAC9B,QAAQ;AAAA,EACV;AACA,MAAI,UAAwC;AAAA,IAC1C,OAAO,gBAAgB,OAAO;AAAA,IAC9B,QAAQ;AAAA,EACV;AACA,MAAI,QAAQ,YAAY,QAAW;AACjC,cAAU,EAAE,OAAO,OAAO,SAAS,QAAQ,QAAQ,MAAM,WAAW;AAAA,EACtE;AACA,MAAI,QAAQ,YAAY,QAAW;AACjC,cAAU,EAAE,OAAO,OAAO,SAAS,QA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readFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport {\n CONFIG_DEFAULTS,\n loadRawConfig,\n parseRouterLayer,\n type PartialConfig,\n type RouterContext,\n type RouterLayer,\n} from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { configPath } from '../lib/paths';\nimport {\n findAllProjectFiles,\n findNearestProjectFiles,\n mainWorktreeOf,\n ownedCandidates,\n projectRoot,\n type ProjectWalkDeps,\n} from '../lib/settings';\n\n/**\n * THE ONE READER OF THE ROUTER'S OWN KEYS, `router.enabled` and\n * `router.context`. Both hooks, the `request` tool, doctor, the status line and\n * `tenjin config` call {@link routerSettings} first, and nothing reads a router\n * key any other way.\n *\n * THE LAYERS: the default, `~/.tenjin/config.json`, then EVERY\n * `.tenjin/config.json` and `config.local.json` from the working directory up\n * to the git root, and in a linked git worktree the main checkout's pair too.\n * No environment variable.\n *\n * EVERY LAYER IS A FLOOR. `enabled` is false when any layer says false, and\n * `context` is `turn` when any layer says turn; a key a file leaves out\n * inherits, and a looser value is not read. So a file a cloned repository\n * carries cannot undo `tenjin config set router.enabled false` on this\n * machine, a package in a monorepo cannot undo its root, and a\n * `config.local.json` a repository commits anyway cannot undo the committed\n * one. Both keys fail toward less data sent, and no project file has a spend\n * key to loosen. The source reported is the nearest layer at the value.\n *\n * ONE PARSER. The global block is the one `loadRawConfig` already validated,\n * and a project file goes through `parseRouterLayer` from the same schema.\n */\n\n/** The committed project file and the personal one beside it. */\nexport const PROJECT_ROUTER_FILE = join('.tenjin', 'config.json');\nexport const LOCAL_ROUTER_FILE = join('.tenjin', 'config.local.json');\n\nexport type RouterSource = 'default' | 'file' | 'project' | 'local';\n\nexport interface RouterSetting<T> {\n value: T;\n source: RouterSource;\n /** The file that set it; absent for the default. */\n path?: string;\n}\n\nexport interface RouterSettings {\n enabled: RouterSetting<boolean>;\n context: RouterSetting<RouterContext>;\n}\n\nexport interface RouterSettingsInput {\n /** The directory the harness is working in. */\n cwd: string;\n /** The data dir whose `config.json` is the global layer. */\n dataDir: string;\n /** That file, when the caller has already loaded it; read here otherwise. */\n config?: PartialConfig;\n}\n\nexport async function routerSettings(\n input: RouterSettingsInput,\n deps: ProjectWalkDeps = {},\n): Promise<RouterSettings> {\n const globalPath = configPath(input.dataDir);\n const global = (input.config ?? (await loadRawConfig(input.dataDir))).router;\n let enabled: RouterSetting<boolean> = {\n value: CONFIG_DEFAULTS.router.enabled,\n source: 'default',\n };\n let context: RouterSetting<RouterContext> = {\n value: CONFIG_DEFAULTS.router.context,\n source: 'default',\n };\n if (global?.enabled !== undefined) {\n enabled = { value: global.enabled, source: 'file', path: globalPath };\n }\n if (global?.context !== undefined) {\n context = { value: global.context, source: 'file', path: globalPath };\n }\n\n for (const { source, path, layer } of await projectLayers(input, deps)) {\n // Every layer is a floor: a value looser than the one so far is not read.\n if (layer.enabled !== undefined && (layer.enabled === false || enabled.value)) {\n enabled = { value: layer.enabled, source, path };\n }\n if (layer.context !== undefined && (layer.context === 'turn' || context.value === 'session')) {\n context = { value: layer.context, source, path };\n }\n }\n return { enabled, context };\n}\n\nconst ROUTER_FILES = [PROJECT_ROUTER_FILE, LOCAL_ROUTER_FILE];\n\n/**\n * Every project layer, outermost first so the nearest one at a value is the\n * one reported: the main checkout's pair when this is a linked worktree, then\n * each directory from the git root down to `cwd`, its project file before its\n * personal one.\n */\nasync function projectLayers(\n input: RouterSettingsInput,\n deps: ProjectWalkDeps,\n): Promise<{ source: 'project' | 'local'; path: string; layer: RouterLayer }[]> {\n const { levels, gitRoot } = await findAllProjectFiles(input.cwd, ROUTER_FILES, {\n ...deps,\n // $HOME/.tenjin is the global scope, not a project.\n homeIsProject: false,\n });\n const main = gitRoot === null ? null : await mainWorktreeOf(gitRoot, deps.homeDir);\n const outer =\n main === null ? [] : [{ dir: main, found: await ownedCandidates(main, ROUTER_FILES, deps) }];\n const layers = [];\n for (const { dir, found } of [...outer, ...levels.reverse()]) {\n // A data dir kept inside a project is the global file, already read.\n if (resolve(dir, '.tenjin') === resolve(input.dataDir)) continue;\n for (const path of found) {\n const file = await readProjectRouterFile(path);\n if (file === null) continue;\n layers.push({\n source: path === join(dir, LOCAL_ROUTER_FILE) ? ('local' as const) : ('project' as const),\n path,\n layer: file.layer,\n });\n }\n }\n return layers;\n}\n\nconst ABSENT = new Set(['ENOENT', 'ENOTDIR']);\n\n/**\n * One project file: its whole JSON, for a writer that keeps sibling keys, and\n * its router layer through the one parser. Null when there is no file.\n */\nexport async function readProjectRouterFile(\n path: string,\n): Promise<{ json: Record<string, unknown>; layer: RouterLayer } | null> {\n let raw: string;\n try {\n raw = await readFile(path, 'utf8');\n } catch (err) {\n if (ABSENT.has(String((err as { code?: unknown }).code))) return null;\n throw invalid(path, 'could not be read', err);\n }\n let json: unknown;\n try {\n json = JSON.parse(raw);\n } catch (err) {\n throw invalid(path, 'is not valid JSON', err);\n }\n const layer = parseRouterLayer(json, path);\n return { json: json as Record<string, unknown>, layer };\n}\n\n/**\n * Where `tenjin config set --project [--local]` writes from `cwd`: beside the\n * layer {@link routerSettings} already reads there, else at the git root, else\n * in `cwd`. Never in $HOME, whose `.tenjin/config.json` is the global file.\n */\nexport async function projectRouterPath(\n input: { cwd: string; local: boolean },\n deps: ProjectWalkDeps = {},\n): Promise<string> {\n const home = deps.homeDir ?? homedir();\n const hit = await findNearestProjectFiles(input.cwd, [PROJECT_ROUTER_FILE, LOCAL_ROUTER_FILE], {\n ...deps,\n warn: () => undefined,\n homeIsProject: false,\n });\n const dir = hit?.dir ?? (await projectRoot(input.cwd, home));\n if (dir === home) {\n throw new CliError(\n 'USAGE',\n 'Your home directory is not a project: its .tenjin is the global config.',\n {\n fix: 'Run it from inside the project, or drop --project to set it for this machine.',\n },\n );\n }\n return join(dir, input.local ? LOCAL_ROUTER_FILE : PROJECT_ROUTER_FILE);\n}\n\nfunction invalid(path: string, what: string, cause?: unknown): CliError {\n return new CliError('CONFIG_INVALID', `Config at ${path} ${what}`, {\n fix: `Fix ${path}, or delete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QAAM,OAAO,KAAK,WAAW,QAAQ;AACrC,QAAM,MAAM,MAAM,wBAAwB,MAAM,KAAK,CAAC,qBAAqB,iBAAiB,GAAG;AAAA,IAC7F,GAAG;AAAA,IACH,MAAM,MAAM;AAAA,IACZ,eAAe;AAAA,EACjB,CAAC;AACD,QAAM,MAAM,KAAK,OAAQ,MAAM,YAAY,MAAM,KAAK,IAAI;AAC1D,MAAI,QAAQ,MAAM;AAChB,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,oBAAoB,mBAAmB;AACxE;AAEA,SAAS,QAAQ,MAAc,MAAc,OAA2B;AACtE,SAAO,IAAI,SAAS,kBAAkB,aAAa,IAAI,IAAI,IAAI,IAAI;AAAA,IACjE,KAAK,OAAO,IAAI;AAAA,IAChB,GAAI,UAAU,SAAY,EAAE,MAAM,IAAI,CAAC;AAAA,EACzC,CAAC;AACH;","names":[]}
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
emptyLedger,
|
|
6
6
|
readLedger,
|
|
7
7
|
spentOf
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YFJJYHVG.js";
|
|
9
9
|
import {
|
|
10
10
|
withFileLock
|
|
11
11
|
} from "./chunk-MEFB5KHA.js";
|
|
12
12
|
import {
|
|
13
13
|
evaluateSpendPolicy
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-B2L53TMK.js";
|
|
15
15
|
import {
|
|
16
16
|
writeFileAtomic
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-QTND6XWJ.js";
|
|
18
18
|
import {
|
|
19
19
|
spendLedgerPath
|
|
20
20
|
} from "./chunk-K6AXXYCG.js";
|
|
@@ -189,4 +189,4 @@ export {
|
|
|
189
189
|
createLocalSpendAuthorizer,
|
|
190
190
|
releaseUnchargedExposure
|
|
191
191
|
};
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
192
|
+
//# sourceMappingURL=chunk-ZP5PV3JB.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
parseUsdToAtomic
|
|
4
|
+
} from "./chunk-FZTSGQVK.js";
|
|
2
5
|
import {
|
|
3
6
|
CONFIG_DEFAULTS,
|
|
7
|
+
CliError,
|
|
4
8
|
PRODUCTION_ORIGIN,
|
|
5
9
|
PublishModeSchema,
|
|
6
10
|
SEND_MAX_UNSET,
|
|
7
11
|
external_exports,
|
|
8
12
|
isSameDeployment,
|
|
9
13
|
loadRawConfig,
|
|
10
|
-
parseUsdToAtomic,
|
|
11
14
|
resolveSettings
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
CliError
|
|
15
|
-
} from "./chunk-JLEF5WHM.js";
|
|
15
|
+
} from "./chunk-QTND6XWJ.js";
|
|
16
16
|
|
|
17
17
|
// src/lib/settings.ts
|
|
18
18
|
import { execFile } from "node:child_process";
|
|
@@ -237,4 +237,4 @@ export {
|
|
|
237
237
|
ownedCandidates,
|
|
238
238
|
projectRoot
|
|
239
239
|
};
|
|
240
|
-
//# sourceMappingURL=chunk-
|
|
240
|
+
//# sourceMappingURL=chunk-ZP7AHN7Z.js.map
|
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
PERMISSIONS_DOC_URL
|
|
4
|
+
} from "./chunk-A36LQPHV.js";
|
|
2
5
|
import {
|
|
3
6
|
maybeUpdate,
|
|
4
7
|
readUpdateSignal
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7H3RN4WJ.js";
|
|
6
9
|
import {
|
|
7
10
|
defaultIo,
|
|
8
11
|
emitFailure,
|
|
9
12
|
emitSuccess
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XVTD7UWR.js";
|
|
11
14
|
import {
|
|
12
15
|
noteBaseUrlFlag
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
PERMISSIONS_DOC_URL
|
|
17
|
-
} from "./chunk-A36LQPHV.js";
|
|
18
|
-
import {
|
|
19
|
-
package_default
|
|
20
|
-
} from "./chunk-GHR4BTNJ.js";
|
|
16
|
+
} from "./chunk-3QJREVMX.js";
|
|
17
|
+
import "./chunk-UOW5JXYY.js";
|
|
21
18
|
import "./chunk-2I4QTOLB.js";
|
|
22
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-ZP7AHN7Z.js";
|
|
20
|
+
import "./chunk-FZTSGQVK.js";
|
|
23
21
|
import {
|
|
22
|
+
CliError,
|
|
24
23
|
external_exports
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import {
|
|
27
|
-
CliError
|
|
28
|
-
} from "./chunk-JLEF5WHM.js";
|
|
24
|
+
} from "./chunk-QTND6XWJ.js";
|
|
29
25
|
import {
|
|
30
26
|
dataDir
|
|
31
27
|
} from "./chunk-K6AXXYCG.js";
|
|
28
|
+
import {
|
|
29
|
+
package_default
|
|
30
|
+
} from "./chunk-RLPLYUME.js";
|
|
32
31
|
import {
|
|
33
32
|
__commonJS,
|
|
34
33
|
__require,
|
|
@@ -3494,11 +3493,8 @@ var INTEGRATION = "Integration:";
|
|
|
3494
3493
|
function registerCore(reg) {
|
|
3495
3494
|
const { runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2 } = reg;
|
|
3496
3495
|
leaf2(SETUP, "install", "set up Tenjin for Claude Code and create a wallet").description(
|
|
3497
|
-
"Set up Claude Code to use Tenjin:
|
|
3498
|
-
).option("--project", "
|
|
3499
|
-
"--status-line <mode>",
|
|
3500
|
-
"the live footer: `own` registers it when you have no status line of your own, `compose` appends it to the one you do have, `skip` leaves the setting alone"
|
|
3501
|
-
).addHelpText(
|
|
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 default spend limits instead of asking").addHelpText(
|
|
3502
3498
|
"after",
|
|
3503
3499
|
`
|
|
3504
3500
|
Examples:
|
|
@@ -3512,14 +3508,12 @@ Learn more:
|
|
|
3512
3508
|
).action(async function() {
|
|
3513
3509
|
await runCommand("install", this, async (ctx) => {
|
|
3514
3510
|
const o = this.opts();
|
|
3515
|
-
const { runRouterInstall } = await import("./install-
|
|
3516
|
-
const { statusLineMode } = await import("./status-line-wiring-LW4HFRHB.js");
|
|
3511
|
+
const { runRouterInstall } = await import("./install-O5FJ5EP3.js");
|
|
3517
3512
|
return runRouterInstall(
|
|
3518
3513
|
{
|
|
3519
3514
|
...o.project === true ? { project: true } : {},
|
|
3520
3515
|
...o.refresh === true ? { refresh: true } : {},
|
|
3521
3516
|
...o.yes === true ? { yes: true } : {},
|
|
3522
|
-
...o.statusLine !== void 0 ? { statusLine: statusLineMode(String(o.statusLine)) } : {},
|
|
3523
3517
|
...o.wallet === false ? { noWallet: true } : {}
|
|
3524
3518
|
},
|
|
3525
3519
|
ctx
|
|
@@ -3527,17 +3521,17 @@ Learn more:
|
|
|
3527
3521
|
});
|
|
3528
3522
|
});
|
|
3529
3523
|
leaf2(SETUP, "uninstall", "remove what install wrote; the wallet is kept").description(
|
|
3530
|
-
"Remove the
|
|
3531
|
-
).option("--project", "remove
|
|
3524
|
+
"Remove the Tenjin plugin `tenjin install` registered, and any settings-based install an earlier release wrote. Your wallet, spend ledger and config are kept."
|
|
3525
|
+
).option("--project", "remove the project-only install").action(async function() {
|
|
3532
3526
|
await runCommand("uninstall", this, async (ctx) => {
|
|
3533
3527
|
const o = this.opts();
|
|
3534
|
-
const { runRouterUninstall } = await import("./uninstall-
|
|
3528
|
+
const { runRouterUninstall } = await import("./uninstall-THKUH5ZT.js");
|
|
3535
3529
|
return runRouterUninstall({ ...o.project === true ? { project: true } : {} }, ctx);
|
|
3536
3530
|
});
|
|
3537
3531
|
});
|
|
3538
3532
|
leaf2(SETUP, "doctor", "check this machine can run a lookup").description(
|
|
3539
|
-
"Check everything a lookup needs: the Node floor, the
|
|
3540
|
-
).option("--project", "check
|
|
3533
|
+
"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."
|
|
3534
|
+
).option("--project", "check the project-only install, as --project registered it").addHelpText(
|
|
3541
3535
|
"after",
|
|
3542
3536
|
`
|
|
3543
3537
|
Examples:
|
|
@@ -3547,15 +3541,15 @@ Examples:
|
|
|
3547
3541
|
`
|
|
3548
3542
|
).action(async function() {
|
|
3549
3543
|
await runCommand("doctor", this, async (ctx) => {
|
|
3550
|
-
const { runRouterDoctor } = await import("./doctor-
|
|
3544
|
+
const { runRouterDoctor } = await import("./doctor-2UZZF44A.js");
|
|
3551
3545
|
return runRouterDoctor(ctx, this.opts().project === true ? { project: true } : {});
|
|
3552
3546
|
});
|
|
3553
3547
|
});
|
|
3554
3548
|
leaf2(SETUP, "update", "update tenjin-cli to the newest published version").description(
|
|
3555
|
-
"Update tenjin-cli to the newest version npm publishes on the latest tag. It then runs `install --refresh` on the new binary, so
|
|
3549
|
+
"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."
|
|
3556
3550
|
).option("--check", "report whether a newer version exists without installing it").action(async function() {
|
|
3557
3551
|
await runCommand("update", this, async (ctx) => {
|
|
3558
|
-
const { runUpdate } = await import("./update-
|
|
3552
|
+
const { runUpdate } = await import("./update-NPZDP24E.js");
|
|
3559
3553
|
return runUpdate({ check: this.opts().check === true }, ctx);
|
|
3560
3554
|
});
|
|
3561
3555
|
});
|
|
@@ -3574,7 +3568,7 @@ Examples:
|
|
|
3574
3568
|
);
|
|
3575
3569
|
config.action(async function() {
|
|
3576
3570
|
await runCommand("config", this, async (ctx) => {
|
|
3577
|
-
const { runConfigList } = await import("./config-
|
|
3571
|
+
const { runConfigList } = await import("./config-IY2OJCAK.js");
|
|
3578
3572
|
return runConfigList(ctx);
|
|
3579
3573
|
});
|
|
3580
3574
|
});
|
|
@@ -3582,7 +3576,7 @@ Examples:
|
|
|
3582
3576
|
"Print one effective config value by key. The effective value is what the command would use, defaults and environment overrides included."
|
|
3583
3577
|
).action(async function(key) {
|
|
3584
3578
|
await runCommand("config.get", this, async (ctx) => {
|
|
3585
|
-
const { runConfigGet } = await import("./config-
|
|
3579
|
+
const { runConfigGet } = await import("./config-IY2OJCAK.js");
|
|
3586
3580
|
return runConfigGet({ key }, ctx);
|
|
3587
3581
|
});
|
|
3588
3582
|
});
|
|
@@ -3594,7 +3588,7 @@ Examples:
|
|
|
3594
3588
|
).option("--local", "with --project, write .tenjin/config.local.json instead, which is yours").action(async function(key, value) {
|
|
3595
3589
|
const o = this.opts();
|
|
3596
3590
|
await runCommand("config.set", this, async (ctx) => {
|
|
3597
|
-
const { runConfigSet } = await import("./config-
|
|
3591
|
+
const { runConfigSet } = await import("./config-IY2OJCAK.js");
|
|
3598
3592
|
return runConfigSet(
|
|
3599
3593
|
{ key, value, project: o.project === true, local: o.local === true },
|
|
3600
3594
|
ctx
|
|
@@ -3616,7 +3610,7 @@ Examples:
|
|
|
3616
3610
|
).action(async function() {
|
|
3617
3611
|
await runCommand("wallet.create", this, async (ctx) => {
|
|
3618
3612
|
const o = this.opts();
|
|
3619
|
-
const { runWalletCreate } = await import("./wallet-
|
|
3613
|
+
const { runWalletCreate } = await import("./wallet-53EFH4M5.js");
|
|
3620
3614
|
return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
|
|
3621
3615
|
});
|
|
3622
3616
|
});
|
|
@@ -3625,7 +3619,7 @@ Examples:
|
|
|
3625
3619
|
).option("--no-qr", "print the address without the QR code").action(async function() {
|
|
3626
3620
|
await runCommand("wallet.show", this, async (ctx) => {
|
|
3627
3621
|
const o = this.opts();
|
|
3628
|
-
const { runWalletShow } = await import("./wallet-
|
|
3622
|
+
const { runWalletShow } = await import("./wallet-53EFH4M5.js");
|
|
3629
3623
|
return runWalletShow(ctx, o.qr === false ? { qr: false } : {});
|
|
3630
3624
|
});
|
|
3631
3625
|
});
|
|
@@ -3633,19 +3627,19 @@ Examples:
|
|
|
3633
3627
|
"Read the wallet USDC balance on Base. It is a chain read: no key is unlocked and nothing is spent."
|
|
3634
3628
|
).action(async function() {
|
|
3635
3629
|
await runCommand("wallet.balance", this, async (ctx) => {
|
|
3636
|
-
const { runWalletBalance } = await import("./wallet-
|
|
3630
|
+
const { runWalletBalance } = await import("./wallet-53EFH4M5.js");
|
|
3637
3631
|
return runWalletBalance(ctx);
|
|
3638
3632
|
});
|
|
3639
3633
|
});
|
|
3640
|
-
addGlobalFlags2(wallet.command("fund [amountUsd]")).summary("
|
|
3641
|
-
"
|
|
3634
|
+
addGlobalFlags2(wallet.command("fund [amountUsd]")).summary("fund this wallet through a checkout link for your region").description(
|
|
3635
|
+
"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."
|
|
3642
3636
|
).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(
|
|
3643
3637
|
"--no-wait",
|
|
3644
3638
|
"return once the link is issued instead of polling the balance (already the default when not at a TTY)"
|
|
3645
3639
|
).action(async function(amountUsd) {
|
|
3646
3640
|
await runCommand("wallet.fund", this, async (ctx) => {
|
|
3647
3641
|
const o = this.opts();
|
|
3648
|
-
const { runFund } = await import("./fund-
|
|
3642
|
+
const { runFund } = await import("./fund-RZ2QFULK.js");
|
|
3649
3643
|
return runFund(ctx, {
|
|
3650
3644
|
...amountUsd !== void 0 ? { amountUsd } : {},
|
|
3651
3645
|
...o.open === false ? { open: false } : {},
|
|
@@ -3665,7 +3659,7 @@ Examples:
|
|
|
3665
3659
|
).action(async function(amount, token, to) {
|
|
3666
3660
|
await runCommand("wallet.send", this, async (ctx) => {
|
|
3667
3661
|
const o = this.opts();
|
|
3668
|
-
const { runSend } = await import("./send-
|
|
3662
|
+
const { runSend } = await import("./send-PI4NUA7I.js");
|
|
3669
3663
|
return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
|
|
3670
3664
|
});
|
|
3671
3665
|
});
|
|
@@ -3685,7 +3679,7 @@ Examples:
|
|
|
3685
3679
|
).action(async function(url) {
|
|
3686
3680
|
await runCommand("pay", this, async (ctx) => {
|
|
3687
3681
|
const o = this.opts();
|
|
3688
|
-
const { runPay } = await import("./pay-
|
|
3682
|
+
const { runPay } = await import("./pay-IR2V76FX.js");
|
|
3689
3683
|
return runPay(
|
|
3690
3684
|
{
|
|
3691
3685
|
url,
|
|
@@ -3706,8 +3700,16 @@ Examples:
|
|
|
3706
3700
|
function registerRouter(reg) {
|
|
3707
3701
|
const { io, runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2, buildContext: buildContext2 } = reg;
|
|
3708
3702
|
const hook = leaf2(INTEGRATION, "hook", "run one harness hook handler (called by Claude Code)").description(
|
|
3709
|
-
"The handlers
|
|
3703
|
+
"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."
|
|
3710
3704
|
).helpCommand(false);
|
|
3705
|
+
addGlobalFlags2(hook.command("alive")).summary("SessionStart: mark this session and machine as ones the plugin serves").action(async function() {
|
|
3706
|
+
const ctx = buildContext2(this);
|
|
3707
|
+
const [{ aliveMain }, { default: pkg }] = await Promise.all([
|
|
3708
|
+
import("./alive-3J3CHOQP.js"),
|
|
3709
|
+
import("./package-RT24HTTP.js")
|
|
3710
|
+
]);
|
|
3711
|
+
await aliveMain({ dataDir: ctx.dataDir, version: pkg.version });
|
|
3712
|
+
});
|
|
3711
3713
|
for (const [name, summary] of [
|
|
3712
3714
|
["prompt", "UserPromptSubmit: build the session packet and ask the free gate"],
|
|
3713
3715
|
["native", "PreToolUse on WebSearch|WebFetch: allow the call, or redirect it"],
|
|
@@ -3721,7 +3723,7 @@ function registerRouter(reg) {
|
|
|
3721
3723
|
]) {
|
|
3722
3724
|
addGlobalFlags2(hook.command(name)).summary(summary).action(async function() {
|
|
3723
3725
|
const ctx = buildContext2(this);
|
|
3724
|
-
const { runHookCommand } = await import("./hook-command-
|
|
3726
|
+
const { runHookCommand } = await import("./hook-command-PZHKS7ES.js");
|
|
3725
3727
|
await runHookCommand(name, io, {
|
|
3726
3728
|
dataDir: ctx.dataDir,
|
|
3727
3729
|
...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {}
|
|
@@ -3730,25 +3732,25 @@ function registerRouter(reg) {
|
|
|
3730
3732
|
}
|
|
3731
3733
|
hook.command("unknown", { hidden: true, isDefault: true }).argument("[args...]").allowUnknownOption().allowExcessArguments().action(() => {
|
|
3732
3734
|
});
|
|
3733
|
-
leaf2(INTEGRATION, "mcp", "run the local stdio MCP server").description(
|
|
3735
|
+
leaf2(INTEGRATION, "mcp", "run the local stdio MCP server").addOption(new Option("--plugin", "started by the Tenjin Claude Code plugin").hideHelp()).description(
|
|
3734
3736
|
"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."
|
|
3735
3737
|
).action(async function() {
|
|
3736
3738
|
const ctx = buildContext2(this);
|
|
3737
|
-
const { runRouterMcpServer } = await import("./mcp-
|
|
3739
|
+
const { runRouterMcpServer } = await import("./mcp-33HAADDF.js");
|
|
3738
3740
|
await runRouterMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
|
|
3739
3741
|
});
|
|
3740
3742
|
leaf2(INTEGRATION, "status-line", "the live footer, for Claude Code's status line").description(
|
|
3741
|
-
"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.
|
|
3743
|
+
"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."
|
|
3742
3744
|
).action(async function() {
|
|
3743
3745
|
const ctx = buildContext2(this);
|
|
3744
|
-
const { runStatusLine } = await import("./status-line-
|
|
3746
|
+
const { runStatusLine } = await import("./status-line-2G5JPQAE.js");
|
|
3745
3747
|
await runStatusLine(io, { dataDir: ctx.dataDir });
|
|
3746
3748
|
});
|
|
3747
3749
|
leaf2(SETUP, "status", "what this machine has spent, and what is still open").description(
|
|
3748
3750
|
"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."
|
|
3749
3751
|
).action(async function() {
|
|
3750
3752
|
await runCommand("status", this, async (ctx) => {
|
|
3751
|
-
const { runRouterStatus } = await import("./status-
|
|
3753
|
+
const { runRouterStatus } = await import("./status-ZUHTJK46.js");
|
|
3752
3754
|
return runRouterStatus(ctx);
|
|
3753
3755
|
});
|
|
3754
3756
|
});
|
|
@@ -3759,7 +3761,7 @@ function registerRouter(reg) {
|
|
|
3759
3761
|
"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."
|
|
3760
3762
|
).action(async function() {
|
|
3761
3763
|
await runCommand("payments.reconcile", this, async (ctx) => {
|
|
3762
|
-
const { runPaymentsReconcile } = await import("./payments-
|
|
3764
|
+
const { runPaymentsReconcile } = await import("./payments-GFV4HU5R.js");
|
|
3763
3765
|
return runPaymentsReconcile(ctx);
|
|
3764
3766
|
});
|
|
3765
3767
|
});
|
|
@@ -3909,4 +3911,4 @@ export {
|
|
|
3909
3911
|
buildProgram,
|
|
3910
3912
|
main
|
|
3911
3913
|
};
|
|
3912
|
-
//# sourceMappingURL=cli-
|
|
3914
|
+
//# sourceMappingURL=cli-234DNHN6.js.map
|