tenjin-cli 0.1.0-alpha.32 → 0.1.0-alpha.33
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 +42 -23
- package/dist/{_esm-RLLC72MS.js → _esm-BIN7VY2L.js} +2 -2
- package/dist/{alive-MROUMFH3.js → alive-GSOWKUOY.js} +4 -4
- package/dist/{auto-update-OPWMRZLS.js → auto-update-Y24UL56V.js} +5 -3
- package/dist/{chunk-2GNOFONN.js → chunk-2M2VPI2E.js} +2 -2
- package/dist/chunk-2M2VPI2E.js.map +1 -0
- package/dist/{chunk-VUGQTZ2L.js → chunk-2RWB7RKE.js} +89 -33
- package/dist/chunk-2RWB7RKE.js.map +1 -0
- package/dist/{chunk-OTWLERSW.js → chunk-36RVGZNY.js} +2 -2
- package/dist/{chunk-B7EM4GGF.js → chunk-3GNJXKIT.js} +2 -2
- package/dist/{chunk-DRDUIZIA.js → chunk-4K7TQHNP.js} +4 -4
- package/dist/{chunk-SYOS5CAC.js → chunk-4YOZGGTZ.js} +73 -2
- package/dist/chunk-4YOZGGTZ.js.map +1 -0
- package/dist/{chunk-AD226HDR.js → chunk-A5GKIG5O.js} +5 -5
- package/dist/{chunk-JEVQ5LKO.js → chunk-AGMVASXZ.js} +3 -3
- package/dist/{chunk-ADV4LDTB.js → chunk-BF4XHEQK.js} +12 -2
- package/dist/chunk-BF4XHEQK.js.map +1 -0
- package/dist/{chunk-IDTRSAHE.js → chunk-C2Q76BVM.js} +48 -49
- package/dist/chunk-C2Q76BVM.js.map +1 -0
- package/dist/{chunk-VJUVFZ2D.js → chunk-FVIGCDSV.js} +1 -1
- package/dist/chunk-FVIGCDSV.js.map +1 -0
- package/dist/{chunk-QF3LSMGS.js → chunk-GTTUCOPD.js} +2 -2
- package/dist/{chunk-3DIL66VX.js → chunk-HGGWCP7W.js} +2 -2
- package/dist/{chunk-D5TOQSO4.js → chunk-HMWYAUA6.js} +10 -6
- package/dist/{chunk-D5TOQSO4.js.map → chunk-HMWYAUA6.js.map} +1 -1
- package/dist/{chunk-445VQTVM.js → chunk-IE7P2BZE.js} +2 -2
- package/dist/{chunk-VOZA6O7K.js → chunk-ILNIZ5I2.js} +190 -96
- package/dist/chunk-ILNIZ5I2.js.map +1 -0
- package/dist/{chunk-TF5HCP33.js → chunk-INTFHMU4.js} +4 -4
- package/dist/{chunk-HREHWL32.js → chunk-J57UC3DD.js} +2 -2
- package/dist/{chunk-AV5NZMYO.js → chunk-KM7RY2ZS.js} +2 -2
- package/dist/{chunk-TAW4UFFF.js → chunk-L6JEXB3E.js} +132 -132
- package/dist/chunk-L6JEXB3E.js.map +1 -0
- package/dist/{chunk-E7LGOMH6.js → chunk-LRW6S53P.js} +4 -3
- package/dist/chunk-LRW6S53P.js.map +1 -0
- package/dist/{chunk-PKHI276N.js → chunk-LXAYUOXI.js} +18 -9
- package/dist/chunk-LXAYUOXI.js.map +1 -0
- package/dist/{chunk-WOM257PW.js → chunk-NDGZDTSJ.js} +3 -3
- package/dist/{chunk-SFASB5FL.js → chunk-P3LFTKE7.js} +3 -14
- package/dist/chunk-P3LFTKE7.js.map +1 -0
- package/dist/{chunk-YUY4SAGM.js → chunk-RVPYTUP4.js} +5 -5
- package/dist/chunk-RVPYTUP4.js.map +1 -0
- package/dist/{chunk-GAKUQHKA.js → chunk-TC2WZLSC.js} +3 -3
- package/dist/{chunk-D3ZURCG7.js → chunk-TKPF35W6.js} +2 -2
- package/dist/{chunk-I5TDIUKM.js → chunk-U3IKUGRP.js} +23 -5
- package/dist/chunk-U3IKUGRP.js.map +1 -0
- package/dist/{chunk-BI673VEJ.js → chunk-UXZONNEQ.js} +3 -3
- package/dist/{chunk-PJNENX2A.js → chunk-WFSPCCVW.js} +2 -2
- package/dist/{chunk-PJNENX2A.js.map → chunk-WFSPCCVW.js.map} +1 -1
- package/dist/{chunk-DW4YTVR3.js → chunk-WXA2BWTE.js} +6 -2
- package/dist/chunk-WXA2BWTE.js.map +1 -0
- package/dist/{chunk-JRZBBPO6.js → chunk-ZDZERB6L.js} +56 -228
- package/dist/chunk-ZDZERB6L.js.map +1 -0
- package/dist/{chunk-G75OPGAK.js → chunk-ZNNXRNFD.js} +5 -3
- package/dist/chunk-ZNNXRNFD.js.map +1 -0
- package/dist/{chunk-CISYM4EO.js → chunk-ZURZHELF.js} +2 -2
- package/dist/{cli-FB4LOA5A.js → cli-E36SPKBW.js} +44 -44
- package/dist/{cli-FB4LOA5A.js.map → cli-E36SPKBW.js.map} +1 -1
- package/dist/{codex-event-TYVES3UX.js → codex-event-ZO2GEFE6.js} +2 -2
- package/dist/{codex-host-WW4H2SKT.js → codex-host-KECJVTA2.js} +3 -3
- package/dist/{codex-install-2C623HPW.js → codex-install-HQZDGFXW.js} +90 -47
- package/dist/codex-install-HQZDGFXW.js.map +1 -0
- package/dist/{config-HOVJFEKD.js → config-HY2E4GGW.js} +8 -8
- package/dist/{doctor-NKU4V5OV.js → doctor-I6XQEKWD.js} +42 -31
- package/dist/doctor-I6XQEKWD.js.map +1 -0
- package/dist/{fund-WEBHTZGN.js → fund-2QRO7OJL.js} +16 -11
- package/dist/{fund-WEBHTZGN.js.map → fund-2QRO7OJL.js.map} +1 -1
- package/dist/{hook-command-ZA2PNKS6.js → hook-command-2UBCSZG6.js} +12 -13
- package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
- package/dist/hosts/claude/tenjin/hooks/register.tsx +51 -11
- package/dist/hosts/claude/tenjin/types/index.d.ts +2 -1
- package/dist/{hosts-AV5MHBAU.js → hosts-DVQJ32QC.js} +2 -2
- package/dist/index.js +16 -15
- package/dist/index.js.map +1 -1
- package/dist/{install-PT4EZS4R.js → install-ILUX5C4A.js} +24 -17
- package/dist/{install-identity-5A4OE6YC.js → install-identity-TZKGY6LQ.js} +7 -7
- package/dist/{install-wallet-SAAPKB73.js → install-wallet-5M4OTYLX.js} +13 -13
- package/dist/isows-native-Q2UDIVPT.js +9 -0
- package/dist/isows-native-Q2UDIVPT.js.map +1 -0
- package/dist/{mcp-HAWKCTPQ.js → mcp-LE4DUS22.js} +23 -24
- package/dist/{mcp-HAWKCTPQ.js.map → mcp-LE4DUS22.js.map} +1 -1
- package/dist/{package-SR2WB6MK.js → package-IJFGMWEV.js} +2 -2
- package/dist/{pay-OXC3WKYV.js → pay-WCG3IH4R.js} +13 -13
- package/dist/{payments-3KHMP2MG.js → payments-HFPPWHTV.js} +6 -6
- package/dist/{plugin-registration-N3GRIZVM.js → plugin-registration-PZFI5GZW.js} +18 -17
- package/dist/{runtime-UVNUA3AS.js → runtime-UZOKSUZX.js} +145 -27
- package/dist/runtime-UZOKSUZX.js.map +1 -0
- package/dist/{runtime-fetch-EKFRNR6Z.js → runtime-fetch-ZSSSK72Y.js} +5 -2
- package/dist/{runtime-layout-BDWZG2TQ.js → runtime-layout-WIDILZ6K.js} +2 -2
- package/dist/{send-HMKJLT34.js → send-GCVEAQKL.js} +8 -8
- package/dist/{status-RWXIIWYS.js → status-HCVAOCN7.js} +10 -10
- package/dist/{status-line-77XYZP7E.js → status-line-OPCXDHL2.js} +6 -6
- package/dist/{uninstall-D5G67UJH.js → uninstall-BAWRBXXQ.js} +19 -18
- package/dist/{uninstall-D5G67UJH.js.map → uninstall-BAWRBXXQ.js.map} +1 -1
- package/dist/{update-LRNOEGSB.js → update-CACXLQLR.js} +20 -17
- package/dist/{usdc-D6X7EIQ2.js → usdc-VG4CIOUK.js} +4 -4
- package/dist/{viemAdapter-By13KInL-RL742ETX.js → viemAdapter-By13KInL-DOFTEIJV.js} +2 -2
- package/dist/{wallet-XFYC27BR.js → wallet-QL4UUXEZ.js} +11 -11
- package/docs/agent-permissions.md +16 -12
- package/docs/troubleshooting.md +5 -5
- package/package.json +4 -4
- package/scripts/installers/install.ps1 +67 -0
- package/scripts/installers/install.sh +68 -0
- package/dist/_esm-C5CRWCYU.js +0 -3737
- package/dist/_esm-C5CRWCYU.js.map +0 -1
- package/dist/chunk-2GNOFONN.js.map +0 -1
- package/dist/chunk-ADV4LDTB.js.map +0 -1
- package/dist/chunk-DW4YTVR3.js.map +0 -1
- package/dist/chunk-E7LGOMH6.js.map +0 -1
- package/dist/chunk-G75OPGAK.js.map +0 -1
- package/dist/chunk-I5TDIUKM.js.map +0 -1
- package/dist/chunk-IDTRSAHE.js.map +0 -1
- package/dist/chunk-JRZBBPO6.js.map +0 -1
- package/dist/chunk-PKHI276N.js.map +0 -1
- package/dist/chunk-SFASB5FL.js.map +0 -1
- package/dist/chunk-SYOS5CAC.js.map +0 -1
- package/dist/chunk-TAW4UFFF.js.map +0 -1
- package/dist/chunk-VJUVFZ2D.js.map +0 -1
- package/dist/chunk-VOZA6O7K.js.map +0 -1
- package/dist/chunk-VUGQTZ2L.js.map +0 -1
- package/dist/chunk-YUY4SAGM.js.map +0 -1
- package/dist/codex-install-2C623HPW.js.map +0 -1
- package/dist/doctor-NKU4V5OV.js.map +0 -1
- package/dist/runtime-UVNUA3AS.js.map +0 -1
- /package/dist/{_esm-RLLC72MS.js.map → _esm-BIN7VY2L.js.map} +0 -0
- /package/dist/{alive-MROUMFH3.js.map → alive-GSOWKUOY.js.map} +0 -0
- /package/dist/{auto-update-OPWMRZLS.js.map → auto-update-Y24UL56V.js.map} +0 -0
- /package/dist/{chunk-OTWLERSW.js.map → chunk-36RVGZNY.js.map} +0 -0
- /package/dist/{chunk-B7EM4GGF.js.map → chunk-3GNJXKIT.js.map} +0 -0
- /package/dist/{chunk-DRDUIZIA.js.map → chunk-4K7TQHNP.js.map} +0 -0
- /package/dist/{chunk-AD226HDR.js.map → chunk-A5GKIG5O.js.map} +0 -0
- /package/dist/{chunk-JEVQ5LKO.js.map → chunk-AGMVASXZ.js.map} +0 -0
- /package/dist/{chunk-QF3LSMGS.js.map → chunk-GTTUCOPD.js.map} +0 -0
- /package/dist/{chunk-3DIL66VX.js.map → chunk-HGGWCP7W.js.map} +0 -0
- /package/dist/{chunk-445VQTVM.js.map → chunk-IE7P2BZE.js.map} +0 -0
- /package/dist/{chunk-TF5HCP33.js.map → chunk-INTFHMU4.js.map} +0 -0
- /package/dist/{chunk-HREHWL32.js.map → chunk-J57UC3DD.js.map} +0 -0
- /package/dist/{chunk-AV5NZMYO.js.map → chunk-KM7RY2ZS.js.map} +0 -0
- /package/dist/{chunk-WOM257PW.js.map → chunk-NDGZDTSJ.js.map} +0 -0
- /package/dist/{chunk-GAKUQHKA.js.map → chunk-TC2WZLSC.js.map} +0 -0
- /package/dist/{chunk-D3ZURCG7.js.map → chunk-TKPF35W6.js.map} +0 -0
- /package/dist/{chunk-BI673VEJ.js.map → chunk-UXZONNEQ.js.map} +0 -0
- /package/dist/{chunk-CISYM4EO.js.map → chunk-ZURZHELF.js.map} +0 -0
- /package/dist/{codex-event-TYVES3UX.js.map → codex-event-ZO2GEFE6.js.map} +0 -0
- /package/dist/{codex-host-WW4H2SKT.js.map → codex-host-KECJVTA2.js.map} +0 -0
- /package/dist/{config-HOVJFEKD.js.map → config-HY2E4GGW.js.map} +0 -0
- /package/dist/{hook-command-ZA2PNKS6.js.map → hook-command-2UBCSZG6.js.map} +0 -0
- /package/dist/{hosts-AV5MHBAU.js.map → hosts-DVQJ32QC.js.map} +0 -0
- /package/dist/{install-PT4EZS4R.js.map → install-ILUX5C4A.js.map} +0 -0
- /package/dist/{install-identity-5A4OE6YC.js.map → install-identity-TZKGY6LQ.js.map} +0 -0
- /package/dist/{install-wallet-SAAPKB73.js.map → install-wallet-5M4OTYLX.js.map} +0 -0
- /package/dist/{package-SR2WB6MK.js.map → package-IJFGMWEV.js.map} +0 -0
- /package/dist/{pay-OXC3WKYV.js.map → pay-WCG3IH4R.js.map} +0 -0
- /package/dist/{payments-3KHMP2MG.js.map → payments-HFPPWHTV.js.map} +0 -0
- /package/dist/{plugin-registration-N3GRIZVM.js.map → plugin-registration-PZFI5GZW.js.map} +0 -0
- /package/dist/{runtime-fetch-EKFRNR6Z.js.map → runtime-fetch-ZSSSK72Y.js.map} +0 -0
- /package/dist/{runtime-layout-BDWZG2TQ.js.map → runtime-layout-WIDILZ6K.js.map} +0 -0
- /package/dist/{send-HMKJLT34.js.map → send-GCVEAQKL.js.map} +0 -0
- /package/dist/{status-RWXIIWYS.js.map → status-HCVAOCN7.js.map} +0 -0
- /package/dist/{status-line-77XYZP7E.js.map → status-line-OPCXDHL2.js.map} +0 -0
- /package/dist/{update-LRNOEGSB.js.map → update-CACXLQLR.js.map} +0 -0
- /package/dist/{usdc-D6X7EIQ2.js.map → usdc-VG4CIOUK.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-RL742ETX.js.map → viemAdapter-By13KInL-DOFTEIJV.js.map} +0 -0
- /package/dist/{wallet-XFYC27BR.js.map → wallet-QL4UUXEZ.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/router/uninstall.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { realpath, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { isAbsolute, resolve, sep } from 'node:path';\nimport { persistRouterProject } from '../commands/config';\nimport type { CommandContext, CommandResult } from '../context';\nimport { loadRawConfig } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { defaultDataDir, runtimeDir } from '../lib/paths';\nimport { runtimeStatePath } from '../lib/runtime-layout';\nimport { readWalletFacts } from '../lib/wallet-facts';\nimport { removeAliveState } from './alive';\nimport { findClaudeBinary, jsonList, jsonResult, runClaude, type ClaudeBinary } from './claude-cli';\nimport { projectInstallAt, settingsInstallPaths } from './install';\nimport { inspectLegacyInstall, removeLegacyInstall, type LegacyRemoval } from './legacy-install';\nimport { MARKETPLACE_NAME, PLUGIN_ID } from './names';\nimport { removePluginFolder, type FolderRemoval } from './plugin-folder';\nimport {\n folderFor,\n folderState,\n ownMarketplace,\n recordedInstalls,\n type InstallRecord,\n} from './plugin-registration';\n\n/**\n * `tenjin uninstall`: take out the install for where you are, and the shared\n * parts once no install is left anywhere.\n *\n * WHICH INSTALL. Claude Code records every `tenjin@tenjin` install, in any\n * scope or project, in its own `installed_plugins.json`; `install.routerProjects`\n * adds the projects `install --project` wired. A bare run takes the project\n * install whose folder is the cwd or the nearest one above it, else the user\n * install; `--project <path>` takes that project's, and `--all` every one. Each\n * goes through `claude plugin uninstall` run in exactly its own folder, the\n * only cwd Claude Code accepts for a local install.\n *\n * ALL OR NOTHING FOR THE SHARED PARTS. The marketplace (and, through `finish`\n * in `hosts.ts`, Tenjin's runtime and its launcher) go only when no install is\n * left anywhere and every removal this run asked for succeeded. A removal that\n * fails refuses, naming what was removed and what is left; so does a\n * marketplace Claude Code would not remove, which keeps the runtime its folder\n * lives in, and the launcher that retries.\n *\n * THE WALLET AND `spend.json` STAY. Removing an integration is not a reason to\n * destroy a key that holds funds or a ledger that records what was spent; both\n * are the user's, and the receipt says where they are.\n */\n\nexport type UninstallTarget =\n { kind: 'all' } | { kind: 'user' } | { kind: 'project'; path: string };\n\nexport interface RouterUninstallDeps {\n homeDir?: string;\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n findClaude?: (env: NodeJS.ProcessEnv) => ClaudeBinary | null;\n /** Runs one `claude` command; tests inject one that records its cwd. */\n runClaude?: typeof runClaude;\n}\n\n/** One install this run went after, and what became of it. */\nexport interface Removal {\n scope: InstallRecord['scope'];\n projectPath: string | null;\n /** `skipped`: the project folder is gone, so `claude` cannot be run there. */\n state: 'removed' | 'absent' | 'skipped' | 'failed';\n reason?: string;\n}\n\n/** `remaining`'s name for the user install; a project is its folder. */\nconst USER = 'user';\n\nconst real = (path: string): Promise<string> => realpath(path).catch(() => resolve(path));\nconst isDir = async (path: string): Promise<boolean> =>\n (await stat(path).catch(() => null))?.isDirectory() === true;\n\n/** Is `dir` the folder `parent`, or inside it? */\nfunction within(dir: string, parent: string): boolean {\n return dir === parent || dir.startsWith(parent.endsWith(sep) ? parent : `${parent}${sep}`);\n}\n\nfunction uncheckable(): CliError {\n return new CliError('REFUSED', \"Tenjin's plugin could not be checked, so nothing was removed\", {\n fix: `Run \\`tenjin uninstall\\` from a terminal where \\`claude\\` runs, or type /plugin uninstall ${PLUGIN_ID} in Claude Code.`,\n });\n}\n\n/**\n * EVERY INSTALL ON THIS MACHINE: Claude Code's record, plus each project in\n * `install.routerProjects` that still holds an install of ours, by realpath.\n * A project only that list names, and that holds nothing any more, is stale\n * and does not keep the shared parts. Throws when Claude Code's record is\n * there and cannot be read: what it holds is unknown, so nothing may go.\n * `recorded` counts the installs Claude Code itself records: only those need\n * `claude` to remove; a project only the list names is a folder install.\n */\nasync function installRecords(\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<InstallRecord[] & { recorded: number }> {\n const claude = await recordedInstalls(env, home);\n if (claude === null) throw uncheckable();\n const listed = (await loadRawConfig(dataDir).catch(() => null))?.install?.routerProjects ?? [];\n const records: InstallRecord[] = [];\n const seen = new Set<string>();\n for (const r of claude) {\n const key = r.projectPath === null ? USER : await real(r.projectPath);\n if (seen.has(key)) continue;\n seen.add(key);\n records.push(r.projectPath === null ? r : { scope: 'local', projectPath: key });\n }\n const recorded = records.length;\n for (const dir of listed) {\n const key = await real(dir);\n if (seen.has(key) || !(await projectInstallAt(key, home, env))) continue;\n seen.add(key);\n records.push({ scope: 'local', projectPath: key });\n }\n return Object.assign(records, { recorded });\n}\n\n/**\n * The project install for `dir`: the record whose folder is `dir` or the\n * nearest one above it. One at home counts only from home itself, or every\n * folder under home would read as inside that project.\n */\nasync function nearestProject(\n records: InstallRecord[],\n dir: string,\n home: string,\n): Promise<(InstallRecord & { projectPath: string }) | undefined> {\n const homeReal = await real(home);\n return records\n .filter(\n (r): r is InstallRecord & { projectPath: string } =>\n r.projectPath !== null &&\n within(dir, r.projectPath) &&\n (r.projectPath !== homeReal || dir === homeReal),\n )\n .sort((a, b) => b.projectPath.length - a.projectPath.length)[0];\n}\n\n/**\n * Which install a run removes, decided before the hosts are picked: `--all`,\n * the project `--project` names (this folder's when it names none), or for a\n * bare run the project install here, else the user install.\n */\nexport async function resolveUninstallTarget(\n o: { all?: boolean; project?: string | true },\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<UninstallTarget> {\n if (o.all === true) return { kind: 'all' };\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n const cwd = deps.cwd ?? process.cwd();\n const records = await installRecords(ctx.dataDir, env, home);\n if (o.project !== undefined) {\n const dir = await real(o.project === true ? cwd : resolve(cwd, o.project));\n return {\n kind: 'project',\n path: (await nearestProject(records, dir, home))?.projectPath ?? dir,\n };\n }\n const here = await nearestProject(records, await real(cwd), home);\n return here !== undefined ? { kind: 'project', path: here.projectPath } : { kind: 'user' };\n}\n\nexport async function runRouterUninstall(\n o: { target: UninstallTarget },\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n if (!isAbsolute(home)) throw new Error('The home directory is not an absolute path.');\n const cwd = deps.cwd ?? process.cwd();\n const binary = (deps.findClaude ?? findClaudeBinary)(env);\n const run = (args: string[], at: string) =>\n (deps.runClaude ?? runClaude)(binary!, args, { env, cwd: at });\n\n const records = await installRecords(ctx.dataDir, env, home);\n // Only what Claude Code records needs `claude` to remove. A project only\n // `routerProjects` names is the folder a run with no `claude` wrote: it is\n // `absent` below, and its folder goes in cleanUp.\n if (binary === null && records.recorded > 0) throw uncheckable();\n const { target } = o;\n let targets = records.filter((r) =>\n target.kind === 'all'\n ? true\n : target.kind === 'user'\n ? r.projectPath === null\n : r.projectPath === target.path,\n );\n // A USER INSTALL CLAUDE CODE DOES NOT RECORD (the folder a run with no\n // `claude` wrote, which starts the runtime's own Node and entry) is one\n // `--all` removes too, and one any other run leaves in use.\n const userUnrecorded =\n !records.some((r) => r.projectPath === null) &&\n (await leftHere({ scope: 'user', projectPath: null }, env, home));\n if (target.kind === 'all' && userUnrecorded && targets.length > 0) {\n targets = [{ scope: 'user', projectPath: null }, ...targets];\n }\n const others = records.filter((r) => !targets.includes(r));\n if (targets.length === 0) {\n // NOTHING CLAUDE CODE RECORDS FOR THE TARGET. A folder or settings install\n // of ours is still one; with other installs left and neither, there is\n // nothing here to remove. With nothing left anywhere, the run goes on, so\n // a marketplace or runtime that outlived its plugin is cleared.\n const fallback: InstallRecord =\n target.kind === 'project'\n ? { scope: 'local', projectPath: target.path }\n : { scope: 'user', projectPath: null };\n const live = await liveOthers(others);\n if (live.length > 0 && !(await leftHere(fallback, env, home))) {\n return nothingHere(target, await real(cwd), live.map(labelOf), ctx.dataDir, env, home);\n }\n targets = [fallback];\n }\n\n const removals: Removal[] = [];\n for (const r of targets) {\n if (r.projectPath !== null && !(await isDir(r.projectPath))) {\n removals.push({ ...r, state: 'skipped', reason: `${r.projectPath} no longer exists` });\n continue;\n }\n // No binary and no record: Claude Code holds no install to remove.\n if (binary === null) {\n removals.push({ ...r, state: 'absent' });\n continue;\n }\n const out = await run(\n ['plugin', 'uninstall', PLUGIN_ID, '--scope', r.scope, '--json'],\n r.projectPath ?? home,\n );\n const result = jsonResult(out.stdout);\n if (out.code === 0) removals.push({ ...r, state: 'removed' });\n else if (result?.failureCode === 'not_installed') removals.push({ ...r, state: 'absent' });\n else {\n const message =\n typeof result?.message === 'string' ? result.message : out.stderr.trim().slice(0, 200);\n removals.push({ ...r, state: 'failed', reason: `claude plugin uninstall: ${message}` });\n }\n }\n\n // WHAT CLAUDE CODE STILL RECORDS decides, not the exit codes alone.\n const after = (await recordedInstalls(env, home)) ?? [];\n const afterKeys = new Set(\n await Promise.all(after.map((r) => (r.projectPath === null ? USER : real(r.projectPath)))),\n );\n const left = removals.filter(\n (r) =>\n r.state === 'failed' ||\n (r.state !== 'skipped' && afterKeys.has(r.projectPath === null ? USER : r.projectPath)),\n );\n const gone = removals.filter((r) => !left.includes(r) && r.state !== 'skipped');\n const userKept = userUnrecorded && !targets.some((r) => r.projectPath === null);\n const remaining =\n left.length > 0 ? [] : [...(userKept ? [USER] : []), ...(await liveOthers(others)).map(keyOf)];\n\n // THE INSTALLS THAT WENT leave their plugin folders and settings installs\n // too, and are forgotten, so a later `tenjin update` does not go looking for\n // a project this machine no longer wires. Done before a refusal as well.\n const folders: FolderRemoval[] = [];\n const settings: { path: string; found: boolean; removed: LegacyRemoval | null }[] = [];\n const cleanUp = async (): Promise<void> => {\n for (const r of gone) {\n const at = r.projectPath ?? home;\n folders.push(await removePluginFolder(folderFor(r.scope, env, home, at)));\n const paths = settingsInstallPaths(r.projectPath !== null, env, home, at);\n const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);\n settings.push({\n path: paths.settingsPath,\n found: legacy.present,\n removed: legacy.present\n ? await removeLegacyInstall(legacy, { binary, env, cwd: at, mcpScope: paths.mcpScope })\n : null,\n });\n }\n for (const r of removals) {\n if (r.projectPath !== null && !left.includes(r)) {\n await persistRouterProject(ctx.dataDir, r.projectPath, false).catch(() => undefined);\n }\n }\n };\n\n const named = (list: Removal[]) => list.map(labelOf).join(', ') || 'nothing';\n if (left.length > 0) {\n await cleanUp();\n throw new CliError(\n 'REFUSED',\n `${left.length} Tenjin install${left.length === 1 ? '' : 's'} could not be removed: ${left.map((r) => `${labelOf(r)}${r.reason !== undefined ? ` (${r.reason})` : ''}`).join(', ')}. Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: { removed: gone.map(keyOf), left: left.map(keyOf), removals },\n fix: retryFix(target, left),\n },\n );\n }\n\n let marketplace: 'removed' | 'absent' | 'kept' = 'kept';\n let marketplaceWhy: string | undefined;\n if (remaining.length > 0) {\n marketplaceWhy = `Kept ${sharedParts(ctx.dataDir, home)}: still used by ${remaining.map(nameOf).join(', ')}.`;\n } else if (binary === null) {\n marketplaceWhy = `the ${MARKETPLACE_NAME} marketplace was not checked: no claude binary on PATH or in CLAUDE_CODE_EXECPATH`;\n } else {\n // THE MARKETPLACE GOES ONLY WHEN IT IS THE ONE `install` ADDED, and\n // unscoped from home: that clears every scope's record of it.\n const listing = await run(['plugin', 'marketplace', 'list', '--json'], home);\n const listed = jsonList(listing.stdout);\n if (listed === null) {\n // A LIST THAT DID NOT ANSWER IS NOT AN ABSENT MARKETPLACE: it may still be\n // registered on the runtime's folder, so the shared parts stay with it.\n await cleanUp();\n const again = againCommand(target);\n throw new CliError(\n 'REFUSED',\n `The ${MARKETPLACE_NAME} marketplace could not be checked (claude plugin marketplace list${listing.stderr.trim() !== '' ? `: ${listing.stderr.trim().slice(0, 200)}` : ''}). Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: {\n removed: gone.map(keyOf),\n left: [`${MARKETPLACE_NAME} marketplace`],\n removals,\n },\n fix: `Run \\`${again}\\` again.`,\n },\n );\n }\n const row = listed.find((m) => m.name === MARKETPLACE_NAME);\n if (row === undefined) marketplace = 'absent';\n else if (!(await ownMarketplace(row))) {\n marketplaceWhy = `kept the ${MARKETPLACE_NAME} marketplace: it is not one \\`tenjin install\\` added`;\n } else {\n const removed = await run(\n ['plugin', 'marketplace', 'remove', MARKETPLACE_NAME, '--json'],\n home,\n );\n if (removed.code !== 0) {\n // A MARKETPLACE STILL REGISTERED KEEPS ITS FOLDER: it is the runtime's\n // `claude` folder, so the runtime and the launcher a retry runs must\n // stay with it. A refusal keeps `uninstallEach` from removing them.\n await cleanUp();\n const result = jsonResult(removed.stdout);\n const why =\n typeof result?.message === 'string'\n ? result.message\n : removed.stderr.trim().slice(0, 200);\n const again = againCommand(target);\n throw new CliError(\n 'REFUSED',\n `The ${MARKETPLACE_NAME} marketplace could not be removed (claude plugin marketplace remove${why !== '' ? `: ${why}` : ''}). Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: {\n removed: gone.map(keyOf),\n left: [`${MARKETPLACE_NAME} marketplace`],\n removals,\n },\n fix: `Run \\`${again}\\` again; if it still fails, run \\`claude plugin marketplace remove ${MARKETPLACE_NAME}\\`, then \\`${again}\\`.`,\n },\n );\n }\n marketplace = 'removed';\n }\n }\n await cleanUp();\n const aliveRemoved = remaining.length === 0 ? await removeAliveState(ctx.dataDir) : false;\n const kept = await keptBlock(ctx.dataDir, env, home);\n\n const data = {\n target,\n removals,\n remaining,\n marketplace,\n ...(remaining.length > 0 ? { marketplaceKeptFor: remaining } : {}),\n folders,\n settings,\n aliveRemoved,\n kept: kept.data,\n };\n const lines = [\n ...removals.map(removalLine),\n ...(marketplace === 'removed' ? [`removed the ${MARKETPLACE_NAME} marketplace`] : []),\n ...(marketplaceWhy !== undefined ? [marketplaceWhy] : []),\n ...folders.flatMap(folderLines),\n ...settings.flatMap((s) => settingsLines(s.path, s.removed)),\n ...kept.lines,\n ];\n return { data, humanLines: lines };\n}\n\n/**\n * The way back after a removal that failed: this run's own target again (a\n * bare run here finds the same install; from elsewhere it would not), then\n * Claude Code's own command, in each project's folder where one is left.\n */\nfunction retryFix(target: UninstallTarget, left: Removal[]): string {\n const again = againCommand(target);\n const projects = left.flatMap((r) => (r.projectPath !== null ? [r.projectPath] : []));\n const where =\n projects.length === 0\n ? 'a Claude Code session'\n : `a Claude Code session started in ${projects.join(', ')}${projects.length < left.length ? ' (any session for your user install)' : ''}`;\n return `Run \\`${again}\\` again; if it still fails, type /plugin uninstall ${PLUGIN_ID} in ${where}.`;\n}\n\n/** This run's own target as a command: a bare run here finds the same install; from elsewhere it would not. */\nfunction againCommand(target: UninstallTarget): string {\n return target.kind === 'all'\n ? 'tenjin uninstall --all'\n : target.kind === 'project'\n ? `tenjin uninstall --project ${shellWord(target.path)}`\n : 'tenjin uninstall';\n}\n\n/** `path` as one shell word: quoted only when it needs to be. */\nfunction shellWord(path: string): string {\n return /^[\\w@%+=:,./~-]+$/.test(path) ? path : `'${path.replace(/'/g, \"'\\\\''\")}'`;\n}\n\n/** The other installs that can still be used: the user's, and projects still on disk. */\nasync function liveOthers(others: InstallRecord[]): Promise<InstallRecord[]> {\n const live: InstallRecord[] = [];\n for (const r of others) if (r.projectPath === null || (await isDir(r.projectPath))) live.push(r);\n return live;\n}\n\n/** An install of ours Claude Code does not record: a plugin folder, or a settings install. */\nasync function leftHere(r: InstallRecord, env: NodeJS.ProcessEnv, home: string): Promise<boolean> {\n if (r.projectPath !== null) return projectInstallAt(r.projectPath, home, env);\n if ((await folderState('user', env, home, home)).state === 'ours') return true;\n const paths = settingsInstallPaths(false, env, home, home);\n return (await inspectLegacyInstall(paths.settingsPath, paths.mcpFile)).present;\n}\n\nconst keyOf = (r: Pick<InstallRecord, 'projectPath'>): string => r.projectPath ?? USER;\nconst nameOf = (key: string): string => (key === USER ? 'your user install' : key);\nconst labelOf = (r: Pick<InstallRecord, 'projectPath'>): string => nameOf(keyOf(r));\n\n/**\n * Does Claude Code hold any Tenjin install still, in any scope or project?\n * Asked by an uninstall Claude Code was not part of (Codex removed last), so\n * the runtime goes only once nothing at all can use it. A record that cannot\n * be read counts as one.\n */\nexport async function claudeInstallsLeft(\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<boolean> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n try {\n const records = await installRecords(ctx.dataDir, env, home);\n if ((await liveOthers(records)).length > 0) return true;\n return await leftHere({ scope: 'user', projectPath: null }, env, home);\n } catch {\n return true;\n }\n}\n\n/** The line for a runtime kept because another recorded host still runs it; none where there is no runtime. */\nexport function runtimeKeptFor(dataDir: string, home: string, users: string[]): string | null {\n if (!hasRuntime(dataDir, home)) return null;\n return `Kept Tenjin's runtime and its launcher: still used by ${users.join(', ')}.`;\n}\n\n/** The parts every install shares, as the \"kept\" lines name them: the runtime only where there is one. */\nfunction sharedParts(dataDir: string, home: string): string {\n return hasRuntime(dataDir, home)\n ? `the ${MARKETPLACE_NAME} marketplace, Tenjin's runtime and its launcher`\n : `the ${MARKETPLACE_NAME} marketplace`;\n}\n\n/**\n * Is there a runtime to keep? Only the default data dir has one, and only once\n * an install set it up: a platform Tenjin pins no Node for, or an install that\n * fell back, has none.\n */\nfunction hasRuntime(dataDir: string, home: string): boolean {\n return isDefaultDataDir(dataDir, home) && existsSync(runtimeStatePath(runtimeDir(dataDir)));\n}\n\nfunction isDefaultDataDir(dataDir: string, home: string): boolean {\n return resolve(dataDir) === resolve(defaultDataDir(home));\n}\n\nasync function nothingHere(\n target: UninstallTarget,\n cwd: string,\n installed: string[],\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<CommandResult> {\n const whose =\n target.kind !== 'project'\n ? 'your user'\n : target.path === cwd\n ? \"this folder's project\"\n : target.path;\n const kept = await keptBlock(dataDir, env, home);\n return {\n data: {\n target,\n removals: [],\n remaining: installed,\n marketplace: 'kept',\n marketplaceKeptFor: installed,\n folders: [],\n settings: [],\n aliveRemoved: false,\n kept: kept.data,\n },\n humanLines: [\n `No Tenjin install for ${whose}, so nothing was removed. Still installed: ${installed.join(', ')}. Run \\`tenjin uninstall --project <path>\\` for one of them, or \\`tenjin uninstall --all\\`.`,\n ],\n };\n}\n\nfunction removalLine(r: Removal): string {\n const which = r.projectPath === null ? 'your user install' : `the install for ${r.projectPath}`;\n switch (r.state) {\n case 'removed':\n return `removed the ${PLUGIN_ID} plugin (${which})`;\n case 'absent':\n return `plugin: ${PLUGIN_ID} was not installed (${which})`;\n case 'skipped':\n return `skipped ${which}: ${r.reason ?? 'its folder no longer exists'}`;\n case 'failed':\n return `plugin: ${r.reason ?? 'left in place'} (${which})`;\n }\n}\n\nfunction folderLines(folder: FolderRemoval): string[] {\n if (folder.removed) {\n return [\n folder.left.length === 0\n ? `removed the plugin folder ${folder.path}`\n : `removed the plugin's files from ${folder.path}; kept what is not Tenjin's: ${folder.left.join(', ')}`,\n ];\n }\n return folder.reason !== undefined ? [`folder: ${folder.reason}`] : [];\n}\n\nfunction settingsLines(settingsPath: string, settings: LegacyRemoval | null): string[] {\n if (settings === null) return [];\n const lines: string[] = [];\n const parts = [\n ...(settings.events.length > 0 ? [`hook entries (${settings.events.join(', ')})`] : []),\n ...(settings.allowRule || settings.denyRule ? ['the permission rules'] : []),\n ...(settings.statusLine !== 'kept' ? ['the status line'] : []),\n ...(settings.mcp === 'removed' ? ['the x402 MCP server'] : []),\n ];\n if (parts.length > 0) {\n lines.push(`removed the settings install's ${parts.join(', ')} from ${settingsPath}`);\n }\n lines.push(...settings.warnings.map((w) => `settings: ${w}`));\n return lines;\n}\n\n/** `path` with the home folder written as `~`. */\nfunction tilde(path: string, home: string): string {\n return path === home || path.startsWith(`${home}${sep}`) ? `~${path.slice(home.length)}` : path;\n}\n\n/**\n * WHAT STAYS, said last: the data dir with the wallet (named, since it may\n * hold funds), and where its passphrase is kept. Read through the hook-safe\n * facts: nothing is unlocked to name them.\n */\nasync function keptBlock(\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<{\n data: { dataDir: string; wallet: string | null; passphraseStore: string | null };\n lines: string[];\n}> {\n const facts = await readWalletFacts(dataDir, env);\n const wallet = facts.address;\n let store: string | null = null;\n if (wallet !== null && facts.passphraseStore !== null) {\n const { describeStoreLocation } = await import('../lib/wallet/passphrase');\n store = describeStoreLocation(facts.passphraseStore, wallet.toLowerCase(), dataDir);\n }\n const lines = [\n wallet !== null\n ? `Kept ${tilde(dataDir, home)}: your wallet ${wallet} (it may hold funds; move them with \\`tenjin wallet send\\` before you delete it), the spend ledger and the config.`\n : `Kept ${tilde(dataDir, home)}: the spend ledger and the config.`,\n ...(store !== null ? [`The wallet passphrase stays in ${store}.`] : []),\n ...(facts.envPassphraseSet\n ? [\n 'TENJIN_WALLET_PASSPHRASE is set in this shell; remove its export line from your shell startup file if you added one.',\n ]\n : []),\n ];\n return { data: { dataDir, wallet, passphraseStore: store }, lines };\n}\n\nexport interface RuntimeRemovalDeps {\n platform?: NodeJS.Platform;\n /** Tests inject these; the defaults are `runtime.ts`'s own. */\n removeLaunchers?: (\n home: string,\n platform?: NodeJS.Platform,\n ) => Promise<{ removed: string[]; left: string[] }>;\n removeRuntime?: (root: string) => Promise<{ removed: boolean; left: string[] }>;\n}\n\n/**\n * UNINSTALL'S LAST STEP, run by `hosts.uninstallEach` only once no install is\n * left anywhere: the launchers, then Tenjin's runtime. Nothing under a\n * non-default data dir, whose installs never had either.\n *\n * NOTHING IS IMPORTED AFTER THE REMOVAL. When this build runs from the\n * runtime, its own files are gone once it returns, so `runtime.ts` is loaded\n * first and every line after is plain string work. On Windows a running\n * `node.exe` keeps its folder; it is named, to delete once this exits.\n */\nexport async function removeRuntimeAndLaunchers(\n dataDir: string,\n home: string,\n deps: RuntimeRemovalDeps = {},\n): Promise<CommandResult> {\n if (!isDefaultDataDir(dataDir, home)) {\n return { data: { runtime: null, launcher: null }, humanLines: [] };\n }\n const lib =\n deps.removeLaunchers !== undefined && deps.removeRuntime !== undefined\n ? null\n : await import('../lib/runtime');\n const removeLaunchers = deps.removeLaunchers ?? lib!.removeLaunchers;\n const removeRuntime = deps.removeRuntime ?? lib!.removeRuntime;\n const root = runtimeDir(dataDir);\n const launcher = await removeLaunchers(home, deps.platform ?? process.platform).catch(() => ({\n removed: [] as string[],\n left: [] as string[],\n }));\n const runtime = await removeRuntime(root).then(\n (r) => ({ ...r, error: null as string | null }),\n (err: unknown) => ({\n removed: false,\n left: [] as string[],\n error: err instanceof Error ? err.message : String(err),\n }),\n );\n const lines = [\n ...launcher.removed.map((p) => `removed the launcher ${tilde(p, home)}`),\n ...launcher.left.map((p) => `left ${tilde(p, home)}: it is not a launcher Tenjin wrote`),\n ];\n if (runtime.error !== null) {\n lines.push(`kept Tenjin's runtime ${tilde(root, home)}: ${runtime.error}`);\n } else if (runtime.removed || runtime.left.length > 0) {\n lines.push(\n runtime.left.length === 0\n ? `removed Tenjin's runtime ${tilde(root, home)}`\n : `removed Tenjin's runtime ${tilde(root, home)}, except what is still running:`,\n ...runtime.left.map((p) => ` delete ${p} after this exits`),\n 'To remove the CLI too, run `npm uninstall -g tenjin-cli` now: always after `tenjin uninstall`, never before.',\n );\n }\n return {\n data: {\n runtime: { root, removed: runtime.removed, left: runtime.left },\n launcher: { removed: launcher.removed, left: launcher.left },\n },\n humanLines: l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AAyB,MAAM,MAAM,IAAI,CAAC,KAAK,QAAQ,KAAK,EAAE;AAAA,EAC3E,WAAW,QAAQ,WAAW,QAAQ,KAAK,SAAS,GAAG;AACrD,UAAM;AAAA,MACJ,QAAQ,KAAK,WAAW,IACpB,4BAA4B,MAAM,MAAM,IAAI,CAAC,KAC7C,4BAA4B,MAAM,MAAM,IAAI,CAAC;AAAA,MACjD,GAAG,QAAQ,KAAK,IAAI,CAAC,MAAM,YAAY,CAAC,mBAAmB;AAAA,MAC3D;AAAA,IACF;AAAA,EACF;AACA,SAAO;AAAA,IACL,MAAM;AAAA,MACJ,SAAS,EAAE,MAAM,SAAS,QAAQ,SAAS,MAAM,QAAQ,KAAK;AAAA,MAC9D,UAAU,EAAE,SAAS,SAAS,SAAS,MAAM,SAAS,KAAK;AAAA,IAC7D;AAAA,IACA,YAAY;AAAA,EACd;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/router/uninstall.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { realpath, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { isAbsolute, resolve, sep } from 'node:path';\nimport { persistRouterProject } from '../commands/config';\nimport type { CommandContext, CommandResult } from '../context';\nimport { loadRawConfig } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { defaultDataDir, runtimeDir } from '../lib/paths';\nimport { runtimeStatePath } from '../lib/runtime-layout';\nimport { readWalletFacts } from '../lib/wallet-facts';\nimport { removeAliveState } from './alive';\nimport { findClaudeBinary, jsonList, jsonResult, runClaude, type ClaudeBinary } from './claude-cli';\nimport { projectInstallAt, settingsInstallPaths } from './install';\nimport { inspectLegacyInstall, removeLegacyInstall, type LegacyRemoval } from './legacy-install';\nimport { MARKETPLACE_NAME, PLUGIN_ID } from './names';\nimport { removePluginFolder, type FolderRemoval } from './plugin-folder';\nimport {\n folderFor,\n folderState,\n ownMarketplace,\n recordedInstalls,\n type InstallRecord,\n} from './plugin-registration';\n\n/**\n * `tenjin uninstall`: take out the install for where you are, and the shared\n * parts once no install is left anywhere.\n *\n * WHICH INSTALL. Claude Code records every `tenjin@tenjin` install, in any\n * scope or project, in its own `installed_plugins.json`; `install.routerProjects`\n * adds the projects `install --project` wired. A bare run takes the project\n * install whose folder is the cwd or the nearest one above it, else the user\n * install; `--project <path>` takes that project's, and `--all` every one. Each\n * goes through `claude plugin uninstall` run in exactly its own folder, the\n * only cwd Claude Code accepts for a local install.\n *\n * ALL OR NOTHING FOR THE SHARED PARTS. The marketplace (and, through `finish`\n * in `hosts.ts`, Tenjin's runtime and its launcher) go only when no install is\n * left anywhere and every removal this run asked for succeeded. A removal that\n * fails refuses, naming what was removed and what is left; so does a\n * marketplace Claude Code would not remove, which keeps the runtime its folder\n * lives in, and the launcher that retries.\n *\n * THE WALLET AND `spend.json` STAY. Removing an integration is not a reason to\n * destroy a key that holds funds or a ledger that records what was spent; both\n * are the user's, and the receipt says where they are.\n */\n\nexport type UninstallTarget =\n { kind: 'all' } | { kind: 'user' } | { kind: 'project'; path: string };\n\nexport interface RouterUninstallDeps {\n homeDir?: string;\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n findClaude?: (env: NodeJS.ProcessEnv) => ClaudeBinary | null;\n /** Runs one `claude` command; tests inject one that records its cwd. */\n runClaude?: typeof runClaude;\n}\n\n/** One install this run went after, and what became of it. */\nexport interface Removal {\n scope: InstallRecord['scope'];\n projectPath: string | null;\n /** `skipped`: the project folder is gone, so `claude` cannot be run there. */\n state: 'removed' | 'absent' | 'skipped' | 'failed';\n reason?: string;\n}\n\n/** `remaining`'s name for the user install; a project is its folder. */\nconst USER = 'user';\n\nconst real = (path: string): Promise<string> => realpath(path).catch(() => resolve(path));\nconst isDir = async (path: string): Promise<boolean> =>\n (await stat(path).catch(() => null))?.isDirectory() === true;\n\n/** Is `dir` the folder `parent`, or inside it? */\nfunction within(dir: string, parent: string): boolean {\n return dir === parent || dir.startsWith(parent.endsWith(sep) ? parent : `${parent}${sep}`);\n}\n\nfunction uncheckable(): CliError {\n return new CliError('REFUSED', \"Tenjin's plugin could not be checked, so nothing was removed\", {\n fix: `Run \\`tenjin uninstall\\` from a terminal where \\`claude\\` runs, or type /plugin uninstall ${PLUGIN_ID} in Claude Code.`,\n });\n}\n\n/**\n * EVERY INSTALL ON THIS MACHINE: Claude Code's record, plus each project in\n * `install.routerProjects` that still holds an install of ours, by realpath.\n * A project only that list names, and that holds nothing any more, is stale\n * and does not keep the shared parts. Throws when Claude Code's record is\n * there and cannot be read: what it holds is unknown, so nothing may go.\n * `recorded` counts the installs Claude Code itself records: only those need\n * `claude` to remove; a project only the list names is a folder install.\n */\nasync function installRecords(\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<InstallRecord[] & { recorded: number }> {\n const claude = await recordedInstalls(env, home);\n if (claude === null) throw uncheckable();\n const listed = (await loadRawConfig(dataDir).catch(() => null))?.install?.routerProjects ?? [];\n const records: InstallRecord[] = [];\n const seen = new Set<string>();\n for (const r of claude) {\n const key = r.projectPath === null ? USER : await real(r.projectPath);\n if (seen.has(key)) continue;\n seen.add(key);\n records.push(r.projectPath === null ? r : { scope: 'local', projectPath: key });\n }\n const recorded = records.length;\n for (const dir of listed) {\n const key = await real(dir);\n if (seen.has(key) || !(await projectInstallAt(key, home, env))) continue;\n seen.add(key);\n records.push({ scope: 'local', projectPath: key });\n }\n return Object.assign(records, { recorded });\n}\n\n/**\n * The project install for `dir`: the record whose folder is `dir` or the\n * nearest one above it. One at home counts only from home itself, or every\n * folder under home would read as inside that project.\n */\nasync function nearestProject(\n records: InstallRecord[],\n dir: string,\n home: string,\n): Promise<(InstallRecord & { projectPath: string }) | undefined> {\n const homeReal = await real(home);\n return records\n .filter(\n (r): r is InstallRecord & { projectPath: string } =>\n r.projectPath !== null &&\n within(dir, r.projectPath) &&\n (r.projectPath !== homeReal || dir === homeReal),\n )\n .sort((a, b) => b.projectPath.length - a.projectPath.length)[0];\n}\n\n/**\n * Which install a run removes, decided before the hosts are picked: `--all`,\n * the project `--project` names (this folder's when it names none), or for a\n * bare run the project install here, else the user install.\n */\nexport async function resolveUninstallTarget(\n o: { all?: boolean; project?: string | true },\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<UninstallTarget> {\n if (o.all === true) return { kind: 'all' };\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n const cwd = deps.cwd ?? process.cwd();\n const records = await installRecords(ctx.dataDir, env, home);\n if (o.project !== undefined) {\n const dir = await real(o.project === true ? cwd : resolve(cwd, o.project));\n return {\n kind: 'project',\n path: (await nearestProject(records, dir, home))?.projectPath ?? dir,\n };\n }\n const here = await nearestProject(records, await real(cwd), home);\n return here !== undefined ? { kind: 'project', path: here.projectPath } : { kind: 'user' };\n}\n\nexport async function runRouterUninstall(\n o: { target: UninstallTarget },\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n if (!isAbsolute(home)) throw new Error('The home directory is not an absolute path.');\n const cwd = deps.cwd ?? process.cwd();\n const binary = (deps.findClaude ?? findClaudeBinary)(env);\n const run = (args: string[], at: string) =>\n (deps.runClaude ?? runClaude)(binary!, args, { env, cwd: at });\n\n const records = await installRecords(ctx.dataDir, env, home);\n // Only what Claude Code records needs `claude` to remove. A project only\n // `routerProjects` names is the folder a run with no `claude` wrote: it is\n // `absent` below, and its folder goes in cleanUp.\n if (binary === null && records.recorded > 0) throw uncheckable();\n const { target } = o;\n let targets = records.filter((r) =>\n target.kind === 'all'\n ? true\n : target.kind === 'user'\n ? r.projectPath === null\n : r.projectPath === target.path,\n );\n // A USER INSTALL CLAUDE CODE DOES NOT RECORD (the folder a run with no\n // `claude` wrote, which starts the runtime's own Node and entry) is one\n // `--all` removes too, and one any other run leaves in use.\n const userUnrecorded =\n !records.some((r) => r.projectPath === null) &&\n (await leftHere({ scope: 'user', projectPath: null }, env, home));\n if (target.kind === 'all' && userUnrecorded && targets.length > 0) {\n targets = [{ scope: 'user', projectPath: null }, ...targets];\n }\n const others = records.filter((r) => !targets.includes(r));\n if (targets.length === 0) {\n // NOTHING CLAUDE CODE RECORDS FOR THE TARGET. A folder or settings install\n // of ours is still one; with other installs left and neither, there is\n // nothing here to remove. With nothing left anywhere, the run goes on, so\n // a marketplace or runtime that outlived its plugin is cleared.\n const fallback: InstallRecord =\n target.kind === 'project'\n ? { scope: 'local', projectPath: target.path }\n : { scope: 'user', projectPath: null };\n const live = await liveOthers(others);\n if (live.length > 0 && !(await leftHere(fallback, env, home))) {\n return nothingHere(target, await real(cwd), live.map(labelOf), ctx.dataDir, env, home);\n }\n targets = [fallback];\n }\n\n const removals: Removal[] = [];\n for (const r of targets) {\n if (r.projectPath !== null && !(await isDir(r.projectPath))) {\n removals.push({ ...r, state: 'skipped', reason: `${r.projectPath} no longer exists` });\n continue;\n }\n // No binary and no record: Claude Code holds no install to remove.\n if (binary === null) {\n removals.push({ ...r, state: 'absent' });\n continue;\n }\n const out = await run(\n ['plugin', 'uninstall', PLUGIN_ID, '--scope', r.scope, '--json'],\n r.projectPath ?? home,\n );\n const result = jsonResult(out.stdout);\n if (out.code === 0) removals.push({ ...r, state: 'removed' });\n else if (result?.failureCode === 'not_installed') removals.push({ ...r, state: 'absent' });\n else {\n const message =\n typeof result?.message === 'string' ? result.message : out.stderr.trim().slice(0, 200);\n removals.push({ ...r, state: 'failed', reason: `claude plugin uninstall: ${message}` });\n }\n }\n\n // WHAT CLAUDE CODE STILL RECORDS decides, not the exit codes alone.\n const after = (await recordedInstalls(env, home)) ?? [];\n const afterKeys = new Set(\n await Promise.all(after.map((r) => (r.projectPath === null ? USER : real(r.projectPath)))),\n );\n const left = removals.filter(\n (r) =>\n r.state === 'failed' ||\n (r.state !== 'skipped' && afterKeys.has(r.projectPath === null ? USER : r.projectPath)),\n );\n const gone = removals.filter((r) => !left.includes(r) && r.state !== 'skipped');\n const userKept = userUnrecorded && !targets.some((r) => r.projectPath === null);\n const remaining =\n left.length > 0 ? [] : [...(userKept ? [USER] : []), ...(await liveOthers(others)).map(keyOf)];\n\n // THE INSTALLS THAT WENT leave their plugin folders and settings installs\n // too, and are forgotten, so a later `tenjin update` does not go looking for\n // a project this machine no longer wires. Done before a refusal as well.\n const folders: FolderRemoval[] = [];\n const settings: { path: string; found: boolean; removed: LegacyRemoval | null }[] = [];\n const cleanUp = async (): Promise<void> => {\n for (const r of gone) {\n const at = r.projectPath ?? home;\n folders.push(await removePluginFolder(folderFor(r.scope, env, home, at)));\n const paths = settingsInstallPaths(r.projectPath !== null, env, home, at);\n const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);\n settings.push({\n path: paths.settingsPath,\n found: legacy.present,\n removed: legacy.present\n ? await removeLegacyInstall(legacy, { binary, env, cwd: at, mcpScope: paths.mcpScope })\n : null,\n });\n }\n for (const r of removals) {\n if (r.projectPath !== null && !left.includes(r)) {\n await persistRouterProject(ctx.dataDir, r.projectPath, false).catch(() => undefined);\n }\n }\n };\n\n const named = (list: Removal[]) => list.map(labelOf).join(', ') || 'nothing';\n if (left.length > 0) {\n await cleanUp();\n throw new CliError(\n 'REFUSED',\n `${left.length} Tenjin install${left.length === 1 ? '' : 's'} could not be removed: ${left.map((r) => `${labelOf(r)}${r.reason !== undefined ? ` (${r.reason})` : ''}`).join(', ')}. Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: { removed: gone.map(keyOf), left: left.map(keyOf), removals },\n fix: retryFix(target, left),\n },\n );\n }\n\n let marketplace: 'removed' | 'absent' | 'kept' = 'kept';\n let marketplaceWhy: string | undefined;\n if (remaining.length > 0) {\n marketplaceWhy = `Kept ${sharedParts(ctx.dataDir, home)}: still used by ${remaining.map(nameOf).join(', ')}.`;\n } else if (binary === null) {\n marketplaceWhy = `the ${MARKETPLACE_NAME} marketplace was not checked: no claude binary on PATH or in CLAUDE_CODE_EXECPATH`;\n } else {\n // THE MARKETPLACE GOES ONLY WHEN IT IS THE ONE `install` ADDED, and\n // unscoped from home: that clears every scope's record of it.\n const listing = await run(['plugin', 'marketplace', 'list', '--json'], home);\n const listed = jsonList(listing.stdout);\n if (listed === null) {\n // A LIST THAT DID NOT ANSWER IS NOT AN ABSENT MARKETPLACE: it may still be\n // registered on the runtime's folder, so the shared parts stay with it.\n await cleanUp();\n const again = againCommand(target);\n throw new CliError(\n 'REFUSED',\n `The ${MARKETPLACE_NAME} marketplace could not be checked (claude plugin marketplace list${listing.stderr.trim() !== '' ? `: ${listing.stderr.trim().slice(0, 200)}` : ''}). Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: {\n removed: gone.map(keyOf),\n left: [`${MARKETPLACE_NAME} marketplace`],\n removals,\n },\n fix: `Run \\`${again}\\` again.`,\n },\n );\n }\n const row = listed.find((m) => m.name === MARKETPLACE_NAME);\n if (row === undefined) marketplace = 'absent';\n else if (!(await ownMarketplace(row))) {\n marketplaceWhy = `kept the ${MARKETPLACE_NAME} marketplace: it is not one \\`tenjin install\\` added`;\n } else {\n const removed = await run(\n ['plugin', 'marketplace', 'remove', MARKETPLACE_NAME, '--json'],\n home,\n );\n if (removed.code !== 0) {\n // A MARKETPLACE STILL REGISTERED KEEPS ITS FOLDER: it is the runtime's\n // `claude` folder, so the runtime and the launcher a retry runs must\n // stay with it. A refusal keeps `uninstallEach` from removing them.\n await cleanUp();\n const result = jsonResult(removed.stdout);\n const why =\n typeof result?.message === 'string'\n ? result.message\n : removed.stderr.trim().slice(0, 200);\n const again = againCommand(target);\n throw new CliError(\n 'REFUSED',\n `The ${MARKETPLACE_NAME} marketplace could not be removed (claude plugin marketplace remove${why !== '' ? `: ${why}` : ''}). Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: {\n removed: gone.map(keyOf),\n left: [`${MARKETPLACE_NAME} marketplace`],\n removals,\n },\n fix: `Run \\`${again}\\` again; if it still fails, run \\`claude plugin marketplace remove ${MARKETPLACE_NAME}\\`, then \\`${again}\\`.`,\n },\n );\n }\n marketplace = 'removed';\n }\n }\n await cleanUp();\n const aliveRemoved = remaining.length === 0 ? await removeAliveState(ctx.dataDir) : false;\n const kept = await keptBlock(ctx.dataDir, env, home);\n\n const data = {\n target,\n removals,\n remaining,\n marketplace,\n ...(remaining.length > 0 ? { marketplaceKeptFor: remaining } : {}),\n folders,\n settings,\n aliveRemoved,\n kept: kept.data,\n };\n const lines = [\n ...removals.map(removalLine),\n ...(marketplace === 'removed' ? [`removed the ${MARKETPLACE_NAME} marketplace`] : []),\n ...(marketplaceWhy !== undefined ? [marketplaceWhy] : []),\n ...folders.flatMap(folderLines),\n ...settings.flatMap((s) => settingsLines(s.path, s.removed)),\n ...kept.lines,\n ];\n return { data, humanLines: lines };\n}\n\n/**\n * The way back after a removal that failed: this run's own target again (a\n * bare run here finds the same install; from elsewhere it would not), then\n * Claude Code's own command, in each project's folder where one is left.\n */\nfunction retryFix(target: UninstallTarget, left: Removal[]): string {\n const again = againCommand(target);\n const projects = left.flatMap((r) => (r.projectPath !== null ? [r.projectPath] : []));\n const where =\n projects.length === 0\n ? 'a Claude Code session'\n : `a Claude Code session started in ${projects.join(', ')}${projects.length < left.length ? ' (any session for your user install)' : ''}`;\n return `Run \\`${again}\\` again; if it still fails, type /plugin uninstall ${PLUGIN_ID} in ${where}.`;\n}\n\n/** This run's own target as a command: a bare run here finds the same install; from elsewhere it would not. */\nfunction againCommand(target: UninstallTarget): string {\n return target.kind === 'all'\n ? 'tenjin uninstall --all'\n : target.kind === 'project'\n ? `tenjin uninstall --project ${shellWord(target.path)}`\n : 'tenjin uninstall';\n}\n\n/** `path` as one shell word: quoted only when it needs to be. */\nfunction shellWord(path: string): string {\n return /^[\\w@%+=:,./~-]+$/.test(path) ? path : `'${path.replace(/'/g, \"'\\\\''\")}'`;\n}\n\n/** The other installs that can still be used: the user's, and projects still on disk. */\nasync function liveOthers(others: InstallRecord[]): Promise<InstallRecord[]> {\n const live: InstallRecord[] = [];\n for (const r of others) if (r.projectPath === null || (await isDir(r.projectPath))) live.push(r);\n return live;\n}\n\n/** An install of ours Claude Code does not record: a plugin folder, or a settings install. */\nasync function leftHere(r: InstallRecord, env: NodeJS.ProcessEnv, home: string): Promise<boolean> {\n if (r.projectPath !== null) return projectInstallAt(r.projectPath, home, env);\n if ((await folderState('user', env, home, home)).state === 'ours') return true;\n const paths = settingsInstallPaths(false, env, home, home);\n return (await inspectLegacyInstall(paths.settingsPath, paths.mcpFile)).present;\n}\n\nconst keyOf = (r: Pick<InstallRecord, 'projectPath'>): string => r.projectPath ?? USER;\nconst nameOf = (key: string): string => (key === USER ? 'your user install' : key);\nconst labelOf = (r: Pick<InstallRecord, 'projectPath'>): string => nameOf(keyOf(r));\n\n/**\n * Does Claude Code hold any Tenjin install still, in any scope or project?\n * Asked by an uninstall Claude Code was not part of (Codex removed last), so\n * the runtime goes only once nothing at all can use it. A record that cannot\n * be read counts as one.\n */\nexport async function claudeInstallsLeft(\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<boolean> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n try {\n const records = await installRecords(ctx.dataDir, env, home);\n if ((await liveOthers(records)).length > 0) return true;\n return await leftHere({ scope: 'user', projectPath: null }, env, home);\n } catch {\n return true;\n }\n}\n\n/** The line for a runtime kept because another recorded host still runs it; none where there is no runtime. */\nexport function runtimeKeptFor(dataDir: string, home: string, users: string[]): string | null {\n if (!hasRuntime(dataDir, home)) return null;\n return `Kept Tenjin's runtime and its launcher: still used by ${users.join(', ')}.`;\n}\n\n/** The parts every install shares, as the \"kept\" lines name them: the runtime only where there is one. */\nfunction sharedParts(dataDir: string, home: string): string {\n return hasRuntime(dataDir, home)\n ? `the ${MARKETPLACE_NAME} marketplace, Tenjin's runtime and its launcher`\n : `the ${MARKETPLACE_NAME} marketplace`;\n}\n\n/**\n * Is there a runtime to keep? Only the default data dir has one, and only once\n * an install set it up: a platform Tenjin pins no Node for, or an install that\n * fell back, has none.\n */\nfunction hasRuntime(dataDir: string, home: string): boolean {\n return isDefaultDataDir(dataDir, home) && existsSync(runtimeStatePath(runtimeDir(dataDir)));\n}\n\nfunction isDefaultDataDir(dataDir: string, home: string): boolean {\n return resolve(dataDir) === resolve(defaultDataDir(home));\n}\n\nasync function nothingHere(\n target: UninstallTarget,\n cwd: string,\n installed: string[],\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<CommandResult> {\n const whose =\n target.kind !== 'project'\n ? 'your user'\n : target.path === cwd\n ? \"this folder's project\"\n : target.path;\n const kept = await keptBlock(dataDir, env, home);\n return {\n data: {\n target,\n removals: [],\n remaining: installed,\n marketplace: 'kept',\n marketplaceKeptFor: installed,\n folders: [],\n settings: [],\n aliveRemoved: false,\n kept: kept.data,\n },\n humanLines: [\n `No Tenjin install for ${whose}, so nothing was removed. Still installed: ${installed.join(', ')}. Run \\`tenjin uninstall --project <path>\\` for one of them, or \\`tenjin uninstall --all\\`.`,\n ],\n };\n}\n\nfunction removalLine(r: Removal): string {\n const which = r.projectPath === null ? 'your user install' : `the install for ${r.projectPath}`;\n switch (r.state) {\n case 'removed':\n return `removed the ${PLUGIN_ID} plugin (${which})`;\n case 'absent':\n return `plugin: ${PLUGIN_ID} was not installed (${which})`;\n case 'skipped':\n return `skipped ${which}: ${r.reason ?? 'its folder no longer exists'}`;\n case 'failed':\n return `plugin: ${r.reason ?? 'left in place'} (${which})`;\n }\n}\n\nfunction folderLines(folder: FolderRemoval): string[] {\n if (folder.removed) {\n return [\n folder.left.length === 0\n ? `removed the plugin folder ${folder.path}`\n : `removed the plugin's files from ${folder.path}; kept what is not Tenjin's: ${folder.left.join(', ')}`,\n ];\n }\n return folder.reason !== undefined ? [`folder: ${folder.reason}`] : [];\n}\n\nfunction settingsLines(settingsPath: string, settings: LegacyRemoval | null): string[] {\n if (settings === null) return [];\n const lines: string[] = [];\n const parts = [\n ...(settings.events.length > 0 ? [`hook entries (${settings.events.join(', ')})`] : []),\n ...(settings.allowRule || settings.denyRule ? ['the permission rules'] : []),\n ...(settings.statusLine !== 'kept' ? ['the status line'] : []),\n ...(settings.mcp === 'removed' ? ['the x402 MCP server'] : []),\n ];\n if (parts.length > 0) {\n lines.push(`removed the settings install's ${parts.join(', ')} from ${settingsPath}`);\n }\n lines.push(...settings.warnings.map((w) => `settings: ${w}`));\n return lines;\n}\n\n/** `path` with the home folder written as `~`. */\nfunction tilde(path: string, home: string): string {\n return path === home || path.startsWith(`${home}${sep}`) ? `~${path.slice(home.length)}` : path;\n}\n\n/**\n * WHAT STAYS, said last: the data dir with the wallet (named, since it may\n * hold funds), and where its passphrase is kept. Read through the hook-safe\n * facts: nothing is unlocked to name them.\n */\nasync function keptBlock(\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<{\n data: { dataDir: string; wallet: string | null; passphraseStore: string | null };\n lines: string[];\n}> {\n const facts = await readWalletFacts(dataDir, env);\n const wallet = facts.address;\n let store: string | null = null;\n if (wallet !== null && facts.passphraseStore !== null) {\n const { describeStoreLocation } = await import('../lib/wallet/passphrase');\n store = describeStoreLocation(facts.passphraseStore, wallet.toLowerCase(), dataDir);\n }\n const lines = [\n wallet !== null\n ? `Kept ${tilde(dataDir, home)}: your wallet ${wallet} (it may hold funds; move them with \\`tenjin wallet send\\` before you delete it), the spend ledger and the config.`\n : `Kept ${tilde(dataDir, home)}: the spend ledger and the config.`,\n ...(store !== null ? [`The wallet passphrase stays in ${store}.`] : []),\n ...(facts.envPassphraseSet\n ? [\n 'TENJIN_WALLET_PASSPHRASE is set in this shell; remove its export line from your shell startup file if you added one.',\n ]\n : []),\n ];\n return { data: { dataDir, wallet, passphraseStore: store }, lines };\n}\n\nexport interface RuntimeRemovalDeps {\n platform?: NodeJS.Platform;\n /** Tests inject these; the defaults are `runtime.ts`'s own. */\n removeLaunchers?: (\n home: string,\n platform?: NodeJS.Platform,\n ) => Promise<{ removed: string[]; left: string[] }>;\n removeRuntime?: (root: string) => Promise<{ removed: boolean; left: string[] }>;\n}\n\n/**\n * UNINSTALL'S LAST STEP, run by `hosts.uninstallEach` only once no install is\n * left anywhere: the launchers, then Tenjin's runtime. Nothing under a\n * non-default data dir, whose installs never had either.\n *\n * NOTHING IS IMPORTED AFTER THE REMOVAL. When this build runs from the\n * runtime, its own files are gone once it returns, so `runtime.ts` is loaded\n * first and every line after is plain string work. On Windows a running\n * `node.exe` keeps its folder; it is named, to delete once this exits.\n */\nexport async function removeRuntimeAndLaunchers(\n dataDir: string,\n home: string,\n deps: RuntimeRemovalDeps = {},\n): Promise<CommandResult> {\n if (!isDefaultDataDir(dataDir, home)) {\n return { data: { runtime: null, launcher: null }, humanLines: [] };\n }\n const lib =\n deps.removeLaunchers !== undefined && deps.removeRuntime !== undefined\n ? null\n : await import('../lib/runtime');\n const removeLaunchers = deps.removeLaunchers ?? lib!.removeLaunchers;\n const removeRuntime = deps.removeRuntime ?? lib!.removeRuntime;\n const root = runtimeDir(dataDir);\n const launcher = await removeLaunchers(home, deps.platform ?? process.platform).catch(() => ({\n removed: [] as string[],\n left: [] as string[],\n }));\n const runtime = await removeRuntime(root).then(\n (r) => ({ ...r, error: null as string | null }),\n (err: unknown) => ({\n removed: false,\n left: [] as string[],\n error: err instanceof Error ? err.message : String(err),\n }),\n );\n const lines = [\n ...launcher.removed.map((p) => `removed the launcher ${tilde(p, home)}`),\n ...launcher.left.map((p) => `left ${tilde(p, home)}: it is not a launcher Tenjin wrote`),\n ];\n if (runtime.error !== null) {\n lines.push(`kept Tenjin's runtime ${tilde(root, home)}: ${runtime.error}`);\n } else if (runtime.removed || runtime.left.length > 0) {\n lines.push(\n runtime.left.length === 0\n ? `removed Tenjin's runtime ${tilde(root, home)}`\n : `removed Tenjin's runtime ${tilde(root, home)}, except what is still running:`,\n ...runtime.left.map((p) => ` delete ${p} after this exits`),\n 'To remove the CLI too, run `npm uninstall -g tenjin-cli` now: always after `tenjin uninstall`, never before.',\n );\n }\n return {\n data: {\n runtime: { root, removed: runtime.removed, left: runt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A,MAAI,QAAQ,UAAU,MAAM;AAC1B,UAAM,KAAK,yBAAyB,MAAM,MAAM,IAAI,CAAC,KAAK,QAAQ,KAAK,EAAE;AAAA,EAC3E,WAAW,QAAQ,WAAW,QAAQ,KAAK,SAAS,GAAG;AACrD,UAAM;AAAA,MACJ,QAAQ,KAAK,WAAW,IACpB,4BAA4B,MAAM,MAAM,IAAI,CAAC,KAC7C,4BAA4B,MAAM,MAAM,IAAI,CAAC;AAAA,MACjD,GAAG,QAAQ,KAAK,IAAI,CAAC,MAAM,YAAY,CAAC,mBAAmB;AAAA,MAC3D;AAAA,IACF;AAAA,EACF;AACA,SAAO;AAAA,IACL,MAAM;AAAA,MACJ,SAAS,EAAE,MAAM,SAAS,QAAQ,SAAS,MAAM,QAAQ,KAAK;AAAA,MAC9D,UAAU,EAAE,SAAS,SAAS,SAAS,MAAM,SAAS,KAAK;AAAA,IAC7D;AAAA,IACA,YAAY;AAAA,EACd;AACF;","names":[]}
|
|
@@ -1,53 +1,56 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
BACKGROUND_COOLDOWN_MS,
|
|
3
4
|
runUpdate,
|
|
4
5
|
spawnCapture,
|
|
5
6
|
versionFreeEntry
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-ILNIZ5I2.js";
|
|
8
|
+
import "./chunk-U3IKUGRP.js";
|
|
8
9
|
import "./chunk-KOGZDMHO.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-LXAYUOXI.js";
|
|
11
|
+
import "./chunk-3GNJXKIT.js";
|
|
12
|
+
import "./chunk-A5GKIG5O.js";
|
|
12
13
|
import "./chunk-4LMUQMBH.js";
|
|
13
14
|
import "./chunk-3623BLPV.js";
|
|
14
15
|
import "./chunk-XKESD27X.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-FVIGCDSV.js";
|
|
16
17
|
import "./chunk-HDPUXS3Z.js";
|
|
17
18
|
import "./chunk-2SNUOHAT.js";
|
|
18
19
|
import "./chunk-E7SW44LM.js";
|
|
19
20
|
import "./chunk-F3ED5WTR.js";
|
|
20
21
|
import "./chunk-DOQGNFHM.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-L6JEXB3E.js";
|
|
23
|
+
import "./chunk-LRW6S53P.js";
|
|
23
24
|
import "./chunk-MEFB5KHA.js";
|
|
24
25
|
import "./chunk-UUGOUOVT.js";
|
|
25
26
|
import "./chunk-MPZUYCAP.js";
|
|
27
|
+
import "./chunk-4YOZGGTZ.js";
|
|
26
28
|
import "./chunk-3FMZGI7I.js";
|
|
27
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-36RVGZNY.js";
|
|
28
30
|
import "./chunk-QXP3Z3JN.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-RVPYTUP4.js";
|
|
32
|
+
import "./chunk-AGMVASXZ.js";
|
|
33
|
+
import "./chunk-KM7RY2ZS.js";
|
|
32
34
|
import "./chunk-Y527D4TV.js";
|
|
33
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-NDGZDTSJ.js";
|
|
34
36
|
import "./chunk-BFDQ4WNW.js";
|
|
35
37
|
import "./chunk-3AIHRXKO.js";
|
|
36
38
|
import "./chunk-X5ZBP3IY.js";
|
|
37
39
|
import "./chunk-2I4QTOLB.js";
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-2M2VPI2E.js";
|
|
41
|
+
import "./chunk-WXA2BWTE.js";
|
|
40
42
|
import "./chunk-XQJXNMSB.js";
|
|
41
43
|
import "./chunk-SNNSAGMT.js";
|
|
42
44
|
import "./chunk-7WEQQJLG.js";
|
|
43
45
|
import "./chunk-3UCIG4TG.js";
|
|
44
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-ZNNXRNFD.js";
|
|
45
47
|
import "./chunk-EDJWHDDL.js";
|
|
46
48
|
import "./chunk-OJNTCYQQ.js";
|
|
47
49
|
import "./chunk-ZXTAQYNA.js";
|
|
48
50
|
export {
|
|
51
|
+
BACKGROUND_COOLDOWN_MS,
|
|
49
52
|
runUpdate,
|
|
50
53
|
spawnCapture,
|
|
51
54
|
versionFreeEntry
|
|
52
55
|
};
|
|
53
|
-
//# sourceMappingURL=update-
|
|
56
|
+
//# sourceMappingURL=update-CACXLQLR.js.map
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
broadcastUsdcSend,
|
|
12
12
|
getUsdcBalance,
|
|
13
13
|
prepareUsdcSend
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-TC2WZLSC.js";
|
|
15
|
+
import "./chunk-WFSPCCVW.js";
|
|
16
16
|
import "./chunk-JRGFKVAZ.js";
|
|
17
17
|
import "./chunk-2GP3HRYK.js";
|
|
18
18
|
import "./chunk-KG3D7FIF.js";
|
|
19
19
|
import "./chunk-RBJPAZFI.js";
|
|
20
20
|
import "./chunk-BPMWXTFX.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-WXA2BWTE.js";
|
|
22
22
|
import "./chunk-7WEQQJLG.js";
|
|
23
23
|
import "./chunk-OJNTCYQQ.js";
|
|
24
24
|
import "./chunk-ZXTAQYNA.js";
|
|
@@ -35,4 +35,4 @@ export {
|
|
|
35
35
|
getUsdcBalance,
|
|
36
36
|
prepareUsdcSend
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=usdc-
|
|
38
|
+
//# sourceMappingURL=usdc-VG4CIOUK.js.map
|
|
@@ -2,7 +2,7 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
a,
|
|
4
4
|
s
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-J57UC3DD.js";
|
|
6
6
|
import "./chunk-RL5UUDT4.js";
|
|
7
7
|
import "./chunk-KG3D7FIF.js";
|
|
8
8
|
import "./chunk-BPMWXTFX.js";
|
|
@@ -11,4 +11,4 @@ export {
|
|
|
11
11
|
a as n,
|
|
12
12
|
s as t
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=viemAdapter-By13KInL-
|
|
14
|
+
//# sourceMappingURL=viemAdapter-By13KInL-DOFTEIJV.js.map
|
|
@@ -8,22 +8,22 @@ import {
|
|
|
8
8
|
runWalletRepair,
|
|
9
9
|
runWalletShow,
|
|
10
10
|
withWalletLock
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HMWYAUA6.js";
|
|
12
12
|
import "./chunk-HGZEPQUT.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-TC2WZLSC.js";
|
|
14
14
|
import "./chunk-WYXUQGOL.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-TKPF35W6.js";
|
|
16
|
+
import "./chunk-GTTUCOPD.js";
|
|
17
|
+
import "./chunk-IE7P2BZE.js";
|
|
18
|
+
import "./chunk-UXZONNEQ.js";
|
|
19
19
|
import "./chunk-V2LQLN5H.js";
|
|
20
20
|
import "./chunk-SO3XRZPX.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-FVIGCDSV.js";
|
|
22
22
|
import "./chunk-HDPUXS3Z.js";
|
|
23
23
|
import "./chunk-2SNUOHAT.js";
|
|
24
24
|
import "./chunk-MEFB5KHA.js";
|
|
25
25
|
import "./chunk-CEXSOI5R.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-WFSPCCVW.js";
|
|
27
27
|
import "./chunk-JRGFKVAZ.js";
|
|
28
28
|
import "./chunk-2GP3HRYK.js";
|
|
29
29
|
import "./chunk-KG3D7FIF.js";
|
|
@@ -34,8 +34,8 @@ import "./chunk-BFDQ4WNW.js";
|
|
|
34
34
|
import "./chunk-3AIHRXKO.js";
|
|
35
35
|
import "./chunk-X5ZBP3IY.js";
|
|
36
36
|
import "./chunk-2I4QTOLB.js";
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-2M2VPI2E.js";
|
|
38
|
+
import "./chunk-WXA2BWTE.js";
|
|
39
39
|
import "./chunk-XQJXNMSB.js";
|
|
40
40
|
import "./chunk-SNNSAGMT.js";
|
|
41
41
|
import "./chunk-7WEQQJLG.js";
|
|
@@ -52,4 +52,4 @@ export {
|
|
|
52
52
|
runWalletShow,
|
|
53
53
|
withWalletLock
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=wallet-
|
|
55
|
+
//# sourceMappingURL=wallet-QL4UUXEZ.js.map
|
|
@@ -21,7 +21,7 @@ The allow is a tool grant, not a spending grant. Every payment the tool makes st
|
|
|
21
21
|
|
|
22
22
|
Router on/off controls automatic routing. The spending controls and ledger are local; the router cannot read or raise them:
|
|
23
23
|
|
|
24
|
-
- **`sessionBudget`**, the daily budget, is the control. It caps automatic spending
|
|
24
|
+
- **`sessionBudget`**, the daily budget, is the control. It caps automatic spending within a 24-hour budget window across agent sessions, $5 by default. Zero blocks automatic spending; `none` removes the daily ceiling.
|
|
25
25
|
- **`maxAutoSpend`**, the per-call ceiling, is the runaway guard. It caps what one router call pays on its own: all its payments together, so several takes of one call or every option of a compare count as one total. It is $0.25 by default, and it cannot be set below $0.25, the routing deposit, because below that routing cannot pay at all: `tenjin install` and `tenjin config set` refuse a lower amount and say why, and `tenjin doctor` flags one an earlier release left. A service priced above it (today two video models at $0.42 and $0.45, hosting at $0.50 and research at $0.60) is approved once, for that call (below).
|
|
26
26
|
- **The wallet balance** is the hard stop. Nothing pays past it.
|
|
27
27
|
- **`spend.json`** records all payments, with separate automatic exposure and reservation modes. Only automatic exposure and pending automatic reservations consume the daily budget. Manual payments remain in total reporting. Older records without a mode/counter conservatively count as automatic until their window expires. Both modes retain the keyed duplicate guard, including under `none`.
|
|
@@ -111,9 +111,9 @@ Prefer the narrow rules on this page to a broad `Bash(tenjin:*)`, `Bash(tenjin w
|
|
|
111
111
|
Under an agent harness (Claude Code, Claude Desktop, Codex), `tenjin install` opens nothing and pays nothing. Each question comes at the point where its answer is needed, in `nextSteps`, with the one command every answer names:
|
|
112
112
|
|
|
113
113
|
1. The spend question comes first, while the config file names neither limit, because the answer picks the install command: Use the defaults (`tenjin install --yes`) or Set my own limits (`--max-auto-spend <usd> --session-budget <usd|none>`), as above. The defaults already hold while the question waits.
|
|
114
|
-
2. The funding question comes from the output of that install command, when the wallet is new or
|
|
114
|
+
2. The funding question comes from the output of that install command, when the wallet is new or its balance confirms it is empty: "Add $5 to Tenjin now?" "Add $5" runs `tenjin wallet fund 5`, which opens checkout in your default browser with $5 filled in. "Not now" runs nothing: the agent says you can ask it to add funds later. Your usual tools keep working; paid tools need funds. When an existing balance cannot be checked, install reports that without suggesting another payment; ask the agent to check funds later. The address remains available if you choose a direct transfer. Install mints no link and does not unlock the wallet; a later yes runs `tenjin wallet fund 5`.
|
|
115
115
|
|
|
116
|
-
So the agent asks the spend question, runs the one install command your answer names, asks the funding question from that command's output, and runs `tenjin wallet fund 5` alone only after your yes. It never runs it without that yes. It shows you
|
|
116
|
+
So the agent asks the spend question, runs the one install command your answer names, asks the funding question from that command's output, and runs `tenjin wallet fund 5` alone only after your yes. It never runs it without that yes. It shows a transfer address only when you choose that option, and never asks you to run a command. A person running `tenjin install` in a terminal answers the spend question there and gets no question handed over.
|
|
117
117
|
|
|
118
118
|
## What `tenjin install` writes, in full
|
|
119
119
|
|
|
@@ -121,16 +121,16 @@ Claude Code 2.1.287 or later is required. `tenjin install` and `tenjin doctor` r
|
|
|
121
121
|
|
|
122
122
|
1. A wallet, when this machine has none (`--no-wallet` skips it). Install says in one line where it saved the passphrase. It never marks with a ✓ a wallet Claude Code could not unlock (it names `tenjin wallet repair` instead), or one that signs only through `TENJIN_WALLET_KEY` or `TENJIN_WALLET_PASSPHRASE` in the shell you ran install from (it says Claude Code needs the same variable).
|
|
123
123
|
2. The two automatic spend limits above, only where your config file is silent, and only after you answer the question in a terminal. When your agent runs the install, it writes neither and the defaults hold: your agent asks you the same question and runs the one install command your answer names (see [When your agent runs the install](#when-your-agent-runs-the-install)). Explicit zero, unlimited, custom registry lists and router opt-outs are preserved. Ignored `bazaarPay` and `confirm` keys are removed and reported; refresh removes retired keys without filling absent settings.
|
|
124
|
-
3. Tenjin's own runtime, in `~/.tenjin/runtime`, so that switching or removing Node, or `npm rm -g tenjin-cli`, does not stop it: a copy of this build in `versions/<version>`, and a pinned Node 24 in `node/<version>`, downloaded from nodejs.org and checked against the SHA-256 this build carries. Install runs the copy on that Node to check it before anything points at it. It also puts a `tenjin` command in `~/.local/bin` (and `tenjin.cmd` on Windows): a short launcher that runs the copy on that Node, and says how to reinstall when the runtime is gone. A file there that is not Tenjin's launcher, or npm's own link, is left as it is. Install edits no shell file; when `~/.local/bin` is not on your PATH it prints the line to add.
|
|
124
|
+
3. Tenjin's own runtime, in `~/.tenjin/runtime`, so that switching or removing Node, or `npm rm -g tenjin-cli`, does not stop it: a copy of this build in `versions/<version>`, and a pinned Node 24 in `node/<version>`, downloaded from nodejs.org and checked against the SHA-256 this build carries. Install runs the copy on that Node to check it before anything points at it. It also puts a `tenjin` command in `~/.local/bin` (and `tenjin.cmd` on Windows): a short launcher that runs the copy on that Node, and says how to reinstall when the runtime is gone. A file there that is not Tenjin's launcher, or npm's own link, is left as it is. Install edits no shell file; when `~/.local/bin` is not on your PATH it prints the line to add. Plugin installation requires the default data directory and a supported platform: macOS 13.5+, Windows or glibc Linux 2.28+ on x64/arm64. A custom `TENJIN_DATA_DIR` or unsupported platform is refused before registration changes. A runtime setup failure stops the install and keeps any working runtime and plugin registration; fix the reported cause, then retry.
|
|
125
125
|
4. The Claude Code plugin `tenjin`, registered with Claude Code's own commands, which leave no step to you: `claude plugin marketplace add ~/.tenjin/runtime/claude` and then `claude plugin install tenjin@tenjin` (with `--scope local` under `--project`, so only this project loads it), and `claude plugin update tenjin@tenjin` when Claude Code holds an older version. The marketplace is the runtime's `claude` folder, read in place, so the plugin is the build you installed, and an update only rewrites that folder. Claude Code keeps one `tenjin` marketplace for the whole machine, so this one `add` also moves a project install made by an earlier release. Claude Code writes `extraKnownMarketplaces` and `enabledPlugins` into its settings; this CLI writes nothing into `settings.json` or `~/.claude.json` itself. The binary is `claude` on PATH, else the one Claude Code names in `CLAUDE_CODE_EXECPATH`; with neither, or when a `claude plugin` command fails, the same plugin is written as a folder, `skills/tenjin-router/` under Claude Code's config directory (`$CLAUDE_CONFIG_DIR` when set, else `~/.claude`), which Claude Code loads as `tenjin@skills-dir` with no command at all. `skills/tenjin`, where tenjin.sh suggests dropping its hosted skill, is never touched, and in the folder only the plugin's own five files are ever written or removed. The plugin carries:
|
|
126
126
|
- Seven hook legs, each a Claude Code `mcp_tool` hook that calls the `hook` tool of the plugin's `router` server with the event's fields: `UserPromptSubmit`, `PreToolUse` on `WebSearch|WebFetch`, `PreToolUse` on `Agent|Task`, `PostToolUse` and `PostToolUseFailure` on `WebSearch|WebFetch`, and `PreToolUse` and `PostToolUse` on `AskUserQuestion`. So each routing step runs inside the session's own `tenjin mcp`, the one process that holds the wallet. That tool reads history only from a file whose real path, symlinks resolved, lies under Claude Code's projects directory (`$CLAUDE_CONFIG_DIR/projects` when that variable is set, else `~/.claude/projects/`) and that is named for the calling session or one of its subagents; a session's first prompt, which fires before that transcript is written, routes on the prompt alone, and any other call reads, sends and pays nothing. Each has a 5 second timeout, so a stuck server never holds a prompt longer, and the two after-call entries on `WebSearch|WebFetch` 15 seconds so a search can wait for the free docs described below. A call that carries a routing channel's deposit waits 4.5 of those seconds instead of 3.5, and a routing payment still out when its time ends says nothing: that prompt runs on the native tools while `tenjin mcp` lets the request finish, for 15 seconds at most, so the channel records it; a deposit in it was counted in the spend ledger when it was sent. A session where the `router` server is not running routes nothing, and its native tools run. No daemon, no generated script; the one background process is that docs fetch, a single `node` process per such search that exits within 12 seconds. `tenjin hook <prompt|native|shortfall|agent|ask|answer>` still exists for a host with no MCP server, and always takes the free path.
|
|
127
|
-
- The two permission answers above. No hook approves any other call, so WebSearch and WebFetch stay under your own permission rules. Before each one, when a paid lookup fits it, the hook redirects your assistant to `mcp__plugin_tenjin_router__request` in its place; a subagent is redirected only when it is known to have that tool and your spend policy would pay without asking, and otherwise its call simply runs. For library documentation, which is a free lookup, it never redirects, in the main agent or a subagent:
|
|
127
|
+
- The two permission answers above. No hook approves any other call, so WebSearch and WebFetch stay under your own permission rules. Before each one, when a paid lookup fits it, the hook redirects your assistant to `mcp__plugin_tenjin_router__request` in its place; a subagent is redirected only when it is known to have that tool and your spend policy would pay without asking, and otherwise its call simply runs. For library documentation, which is a free lookup, it never redirects, in the main agent or a subagent: the search runs as your assistant wrote it, and when Tenjin's server sends the lookup as a note, after it the hook adds one optional line naming the free Context7 docs lookup for the same query, which your assistant calls or ignores, once in five minutes for one agent's identical search. A WebFetch with a free lookup simply runs. It never redirects the same call twice: once a search or URL has been redirected, your assistant's own retry of that same search or URL runs as it is, whether the redirected lookup succeeded, failed or was never called, and however many other calls ran in between, for ten minutes and separately for each agent, while every other search or URL is routed as usual. After a call that came back short (a failed call, a page that answers 401, 402, 403, 429 or 5xx, an empty page, a search with no results; never a 404 or 410, since a missing page is missing for a paid reader too), the router may offer a paid lookup.
|
|
128
128
|
- One `SessionStart` command, `tenjin hook alive`, run by the runtime's Node with the runtime's `dist/index.js`, which writes two small files under `~/.tenjin/alive/`: a marker for the session (a hash of its id) and a stamp saying the plugin has loaded on this machine. When `wallet.json` cannot be read, or the passphrase file Tenjin saved is gone, it prints one message for you with the reason and the fix, and one line for your assistant. Otherwise, while the wallet holds less than the per-call limit, it shows you one line, `Tenjin balance: $0.00. Ask your agent to add funds to Tenjin.`, with no wallet address; to know, it reads the balance once from your configured Base RPC (the public ones when you set none), at most two seconds, and adds nothing to your assistant's context. Anything else about the wallet, and the "Tenjin wallet unlocked" confirmation after a repair, comes from the router on the session's first prompt.
|
|
129
129
|
- A mod (`hooks/register.tsx`, with its state contract in `types/index.d.ts`), which Claude Code runs in the terminal, the desktop app and VS Code. It reads three kinds of file the CLI already keeps under `~/.tenjin`: a kept spec's label, price and the one input a row may show; a choice set's option names; and the offer record of a redirected call, plus the request tool's own result, and writes nothing there. It draws each lookup the way Claude Code draws an MCP call: `⏺ Calling Exa search… · $0.007` with the query under it while it runs, then the dim `Called Exa search · $0.007 (ctrl+o to expand)`. In the ctrl+o transcript, under `--verbose`, or in a run Claude Code expands, every call to the router, the ones the normal view hides included, is Claude Code's own row with its input and result. A lookup over a spend limit draws no row of its own; the `approve` call that runs it once you say yes draws as that lookup (`Calling Exa search… · $0.775`, then `Called Exa search · $0.775`). A call that failed after paying shows the error dot, the amount and the state. A call the router sends back for a missing field, and the router's own free calls, draw nothing. It shows an input only when it names what was looked up (a query, a URL, a name, at most 80 characters), never a media prompt, so an image call reads `Called Ideogram V4 · $0.03`. A run that mixes a lookup with other calls is drawn unfolded, each call its own row. A WebSearch or WebFetch held for a Tenjin offer shows as its native row struck through, `⏺ ~~Web Search~~("query") · Tenjin offered Exa search`, then becomes, in place, the lookup drawn as a built-in row would be, `⏺ Exa search("query") · $0.007`, or disappears if your assistant runs the same search itself. It answers no permission question, rewrites no prompt, denies nothing, writes no config and answers no tool call. The request tool stays in the prompt's tool list through the server's own `anthropic/alwaysLoad`, and the permission answer above allows it.
|
|
130
130
|
- The `router` MCP server, `tenjin mcp --plugin`, run the same way, never by the `node` on your PATH.
|
|
131
131
|
- `bin/tenjin`, the same launcher as `~/.local/bin/tenjin`. Claude Code puts the plugin's `bin/` at the end of the Bash tool's PATH, so your assistant's `tenjin` is this one when nothing earlier on PATH is named `tenjin`.
|
|
132
132
|
|
|
133
|
-
Every command the plugin carries is a Claude Code exec-form command: the absolute path of the runtime's Node and the absolute path of its `dist/index.js`, started with no shell and never through the `tenjin` npm shim or a launcher, so Windows runs the same files macOS and Linux run.
|
|
133
|
+
Every command the plugin carries is a Claude Code exec-form command: the absolute path of the runtime's Node and the absolute path of its `dist/index.js`, started with no shell and never through the `tenjin` npm shim or a launcher, so Windows runs the same files macOS and Linux run. The `skills/tenjin-router/` folder uses the same verified runtime; a failed runtime setup never registers npm-folder commands.
|
|
134
134
|
|
|
135
135
|
5. Nothing else. The status line is no longer set up: `tenjin status-line` still exists, and you can set it as your status line command yourself.
|
|
136
136
|
|
|
@@ -140,9 +140,11 @@ Install then sends the router one empty, unsigned request to check that this mac
|
|
|
140
140
|
|
|
141
141
|
The plugin carries one skill, `tenjin-pay`. It teaches an agent to quote an endpoint for free first, cap the price at the option this wallet would pay, and pay only with your consent to that quote, using this machine's wallet rather than another tool's, with any of the five methods and a JSON or raw body. Install and refresh still remove only an owned obsolete `tenjin-pay` skill file an earlier release wrote under your Claude config folder, preserving adjacent user files and foreign skills.
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
When an agent opens checkout, the funding command returns promptly with a `nextStep`: finish checkout and return to the same conversation. The agent runs `tenjin wallet balance` to confirm funds and continues the task when sufficient. An unconfirmed balance or failed balance read does not establish a failed payment or trigger another checkout. A confirmed balance check clears the hook balance cache, so eligible offers can resume without restarting.
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
Follow the activation instruction from install. A fresh terminal installation offers `/reload-plugins` in the same conversation, then you continue your task. In Claude Desktop's Code tab, choose **New session** in the same folder: Desktop connects the plugin's MCP server in a new session. Before switching, your agent gives you a short, ready-to-paste prompt containing your task, progress and next action, with a Tenjin doctor check before continuing. The next prompt hook records that the plugin serves this session; doctor uses that live observation, so a standalone MCP probe cannot contradict it. Reload does not run `SessionStart`; future sessions still do. Upgrades from the earlier settings-based installation need a new session to leave the old server behind. Codex also needs a new session; ask your agent for a short task handoff before switching.
|
|
146
|
+
|
|
147
|
+
`tenjin update` needs no npm. It downloads the newest `tenjin-cli` from the npm registry, installs it only when npm's provenance shows Tenjin's own release workflow (`release.yml` on `main` of BackTrackCo/tenjin-agent) built it, checks it against the registry's SHA-512, fetches the Node that version pins, and has the new build check itself on that Node before it switches anything; a version that fails the check is not used, and the current one keeps running. The version it replaces stays in the runtime, and an older version is removed only once nothing runs from it. An older build never replaces a newer one; to go back, run `tenjin uninstall`, then install the older version.
|
|
146
148
|
|
|
147
149
|
`tenjin uninstall` removes the install for where you are, from any folder: the project install made in the folder you are in or the nearest folder above it, or else the user install. `tenjin uninstall --project <path>` removes another project's install, and `tenjin uninstall --all` removes every one. For each, it runs `claude plugin uninstall tenjin@tenjin` in that install's scope, unlinks the plugin folder's own files, and removes an earlier release's settings install under the rules above. The `tenjin` marketplace, the runtime and the launchers go only when no install is left anywhere, and a run is all or nothing: when one removal fails, those stay, and uninstall names what it removed and what is left. It ends by saying what it kept: your wallet, with its address, the spend ledger, the config, and where the passphrase is saved. Run it before `npm uninstall -g tenjin-cli`, never after; if npm went first, `~/.local/bin/tenjin uninstall --all` still works.
|
|
148
150
|
|
|
@@ -152,7 +154,7 @@ To stop the router without removing anything, `tenjin config set router.enabled
|
|
|
152
154
|
|
|
153
155
|
1. You type a turn. The hook sends the bounded packet to Tenjin, which answers whether a paid capability fits and, if it does, keeps that packet under a short-lived id.
|
|
154
156
|
2. When one fits, your assistant sees one line, opening with `Tenjin router (installed by the user):`, that starts at the service's name and its price (`Exa search, $0.007: …`) and ends with the call to make: `mcp__plugin_tenjin_router__request({id, input})` with the required fields as placeholders, or already filled in when the hook holds them (the search a native call was about to run, or the page it was about to fetch). The hook keeps the service's spec on this machine under the id.
|
|
155
|
-
3. Your assistant fills the fields and calls `request({id, input})` once. This CLI validates the input against the spec, builds the request, pays that provider once under your limits, hands back the result, and tells Tenjin only how the call ended.
|
|
157
|
+
3. Your assistant fills the fields and calls `request({id, input})` once. This CLI validates the input against the spec, builds the request, pays that provider once under your limits, hands back the result, and tells Tenjin only how the call ended. Any paid routing call costs $0.003 separately, including when no tool is suggested. Where the spec names the fields its result promises, the result holds only those, and the provider's whole response is saved under `~/.tenjin/results/` (readable by you alone, kept a day) at the path the result names in `fullResultPath`.
|
|
156
158
|
4. An input that does not fit the spec is refused before anything is sent to the provider: your assistant gets every problem and the whole spec (each input with its description and allowed values, the required fields inside a nested object, an example and what comes back), locally and with nothing paid, and calls again. `request({id})` alone shows the same spec. A spec whose input schema this CLI cannot compile is refused outright, with nothing sent to the provider or paid.
|
|
157
159
|
5. Your assistant can also see what is available without a lookup: `request({browse: "<a need>"})`, or `browse: ""` for every tool, returns the tool list (each tool's id, name, what it does and its price), and `request({tool: "<id>"})` returns one tool's spec under a fresh id, which `request({id, input})` then runs as in step 3. Both are free: no routing decision, no routing fee and no payment. A browse sends only the words of the need; a `tool` call sends only the id. The hooks still route each lookup as above.
|
|
158
160
|
6. Some lines offer a choice of services for the same step, such as several image models. Your assistant uses the one you named or asked to compare, asks you when you have not said and you are there to answer, and otherwise uses the line's default, then calls `request({id, choice, input})`. One choice runs exactly as that service's own offer. `all` runs every choice side by side, each paid once to its own provider, but only after each is quoted at its live price and the whole set's total fits your limits: within `maxAutoSpend`, which is per call, and inside the day's `sessionBudget`. A set that does not fit returns `needs_approval` with nothing paid, and in Claude Code runs once you approve it. The result lists each choice with its cost and the file it saved under `~/.tenjin/downloads/`.
|
|
@@ -172,7 +174,7 @@ To stop the router without removing anything, `tenjin config set router.enabled
|
|
|
172
174
|
- When your assistant hands a task to a subagent: that task, as the current message, with the same bounded turn before it.
|
|
173
175
|
- When your assistant asks you a question (`AskUserQuestion`): the questions and their options, attached to the same bounded turn, before you see them; and after you answer, your answers as the current message. Before the question, a fitting lookup redirects it once, under the same rules as a native call, and only when your spend limits and wallet would pay it without asking you; after it, a fitting lookup is offered beside your answers.
|
|
174
176
|
- Every hook request carries this session's id, so one session is not offered the same pay-per-call service twice.
|
|
175
|
-
- Every request also lists what this CLI can parse and run (`accepts`): `catalog`, `spec`, `label` and `
|
|
177
|
+
- Every request also lists what this CLI can parse and run (`accepts`): `catalog`, `spec`, `label`, `fields`, `jobs` and `note`, plus `bazaar` while the open Bazaar is on. The server sends a field only to a CLI that lists it: `label` brings each tool's display name and the line that starts at it, and `fields` brings which input takes a pending search or URL, what kind of result a tool returns (files are saved only when it says `media`), and how the free docs lookup is delivered, and `note` brings the free docs line after a search in place of docs added to it. A server change to a tool then reaches an installed CLI without a new release.
|
|
176
178
|
- With `router.context turn`, no prior messages are sent: the prompt on a prompt, your latest message on a native call, and the task on a delegation. `tenjin config set router.context turn` sets it for this machine, and `--project` for this repository.
|
|
177
179
|
- Slash commands and one-word acknowledgements are never sent at all.
|
|
178
180
|
- With `tenjin config set experimental.bazaar on` (off by default), short snippets of your prompts also go to Coinbase's public x402 Bazaar search, so the router can suggest unreviewed sellers listed there.
|
|
@@ -204,11 +206,13 @@ A subagent is only redirected or offered a lookup when it is known to have `mcp_
|
|
|
204
206
|
|
|
205
207
|
## Codex
|
|
206
208
|
|
|
207
|
-
|
|
209
|
+
Codex support is experimental.
|
|
210
|
+
|
|
211
|
+
`tenjin install` sets up Codex when Codex's agent runs it, or in a terminal when this machine has Codex (`codex --version` must answer; a name on PATH is not enough). With both Claude Code and Codex there, a terminal install asks which, both selected; `--yes`, `--json` or no terminal takes both. `--harness claude|codex` picks one instead. An agent's install that also finds the other agent ends with one line, in `notices`, telling the agent to ask whether to set up Tenjin there too and, on yes, to run `tenjin install --harness <other>`. Install records the agents it set up in `installed-hosts.json` in your Tenjin data dir, and `tenjin doctor` and `tenjin uninstall` check or remove each one recorded (Claude Code on a machine set up before the record). For Codex, install writes the wallet, the spend limits and the Codex plugin through `codex plugin add`, and no Codex config. The plugin is added from `~/.tenjin/runtime/codex`, and its server runs the `tenjin` launcher in that folder by absolute path, so a Node upgrade or `npm rm -g tenjin-cli` does not stop it and an update changes nothing Codex has trusted; its hooks name no path at all. If the runtime cannot be set up, installation stops and preserves the previous registration. Moving an existing Codex plugin to the runtime moves its hooks file, and install turns those hooks on again as below. Its spend limits follow the same defaults as Claude Code: `--yes` takes them, `--max-auto-spend <usd>` (at least 0.25) and `--session-budget <usd|none>` set your own, and a terminal asks once while the config file names neither limit. With no answer it writes neither, the defaults ($0.25 a call, $5 a day) hold, and the spend question comes back in `nextSteps` with `tenjin install` as its command. The plugin carries five hooks. Three are routing legs: the prompt, and one web call (a search, a page open, or a batch of them) before it runs and after, where a batch is blocked at most once and the block names the rest of the call to run as written. Each leg is an `mcp_tool` hook that Codex sends to the plugin's `router` server, the same `tenjin mcp` that carries the request tool, so the leg pays the $0.003 routing fee from your wallet under your spend limits, as a request does; these need Codex 0.149.0 or later, and on an older Codex install and update leave its plugin copy as it is. The fourth is a `PreToolUse` hook that denies `mcp__router__hook` to your assistant, since only the hooks call that tool. The fifth is a `PermissionRequest` hook on `mcp__router__request` that answers allow. That last hook is how the request tool runs without a prompt, `approval_policy = "never"` included: Codex runs hooks before its approval policy. It covers the request tool alone, and your spend limits still bound every payment. Install turns the five hooks on, as installing a Claude Code plugin does: it reads Tenjin's own rows and the hash Codex computed for each from Codex's app server, writes them as trusted through the same `config/batchWrite` call `/hooks` makes, and reads them back to confirm. It never computes a hash, never touches another tool's hook, and leaves a hook you turned off in `/hooks` off. If that step fails, install says to approve Tenjin's hooks in `/hooks`.
|
|
208
212
|
|
|
209
213
|
The trade-off: the allow hook also overrides your own `approval_mode = "prompt"` for the request tool. To be asked before each call, turn that one hook off in `/hooks`; `tenjin doctor` then reports that the tool asks first, and under `approval_policy = "never"` that Codex refuses it. With that hook off, the router still blocks a web search once to point at the request tool. Where Codex then asks or refuses, a retry of that search runs: each search is blocked once at most, so the cost is one extra step. `tenjin doctor` also checks, with nothing paid or sent, that the routing legs reach the `router` server and that your Codex can run them. A plugin copy from an earlier release runs its legs as commands, which cannot pay the routing fee and so route nothing, and the first prompt of each session says so. `tenjin update` replaces such a copy, only where Codex already has the plugin, and turns its new hooks on the same way; when it cannot, it prints one line saying to approve Tenjin's hooks in `/hooks`, and the update itself still succeeds. `tenjin uninstall` removes the plugin and its marketplace.
|
|
210
214
|
|
|
211
215
|
## Other settings
|
|
212
216
|
|
|
213
217
|
- `tenjin wallet send <amount> USDC <address>` moves funds out. It needs a per-send cap (`tenjin config set sendMaxAmount <usd>`) and a little ETH on Base for gas.
|
|
214
|
-
- Where Tenjin's runtime is set up, Tenjin updates itself at most once a day, the way `tenjin update` does: at the start of a Claude Code
|
|
218
|
+
- Where Tenjin's runtime is set up, Tenjin updates itself at most once a day, the way `tenjin update` does, but only to a release published at least 24 hours earlier: at the start of a Claude Code or Codex session, it starts that update in the background on the runtime's own Node, which checks the new version before switching to it, keeps the previous one, never moves to an older one and never runs npm. Both Claude Code and Codex run the new version from their next session. `tenjin doctor` shows the last result. `tenjin config set update.mode nudge` only reports a newer version, and `off` stops the check. Without a runtime, the CLI checks npm at most once a day and reports a newer version.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -39,17 +39,17 @@ The router fails to start in Claude Code or shows `cache-miss`, a terminal says
|
|
|
39
39
|
|
|
40
40
|
Before this release, Tenjin ran from npm's global folder, which belongs to one Node version. mise, nvm, fnm, asdf and Volta keep one such folder per version, so removing that Node, or running `npm rm -g tenjin-cli`, deleted the files the plugin ran.
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Ask your agent to reinstall it:
|
|
43
43
|
|
|
44
|
-
```
|
|
45
|
-
|
|
44
|
+
```text
|
|
45
|
+
Install Tenjin from tenjin.sh
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
For a project
|
|
48
|
+
Or follow the [official installation instructions](https://tenjin.sh/agents); the installer includes Node and needs no npm or working `tenjin` command. For a project-only installation, pass `--project` to the installer from that project folder. Follow the installer's activation instruction. From this release on, Tenjin runs from `~/.tenjin/runtime` on its own Node, so a Node upgrade or `npm rm -g tenjin-cli` no longer stops it. Your wallet, spend ledger and settings stay where they were.
|
|
49
49
|
|
|
50
50
|
### The launcher says the runtime is missing
|
|
51
51
|
|
|
52
|
-
`tenjin: Tenjin's runtime is missing (…)` means the files in `~/.tenjin/runtime` that the `tenjin` command runs are gone.
|
|
52
|
+
`tenjin: Tenjin's runtime is missing (…)` means the files in `~/.tenjin/runtime` that the `tenjin` command runs are gone. Use the same official installer above, keeping `--project` for a project-only installation, then follow its activation instruction.
|
|
53
53
|
|
|
54
54
|
### `tenjin` not found in a terminal
|
|
55
55
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tenjin-cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The tool router for coding agents. Tenjin picks the right tool when your agent needs one, and one wallet pays for every call.",
|
|
6
6
|
"repository": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"files": [
|
|
48
48
|
"dist",
|
|
49
49
|
"docs",
|
|
50
|
+
"scripts/installers",
|
|
50
51
|
"NOTICE.md"
|
|
51
52
|
],
|
|
52
53
|
"devDependencies": {
|
|
@@ -72,17 +73,16 @@
|
|
|
72
73
|
"typescript-eslint": "^8",
|
|
73
74
|
"viem": "^2.53.1",
|
|
74
75
|
"vitest": "^4.1.9",
|
|
75
|
-
"zod": "^4.
|
|
76
|
+
"zod": "^4.6.6"
|
|
76
77
|
},
|
|
77
78
|
"scripts": {
|
|
78
|
-
"build": "rm -rf dist && tsup",
|
|
79
|
+
"build": "rm -rf dist .bundle-meta && tsup",
|
|
79
80
|
"test": "vitest run",
|
|
80
81
|
"typecheck": "tsc --noEmit",
|
|
81
82
|
"lint": "eslint .",
|
|
82
83
|
"format": "prettier --write .",
|
|
83
84
|
"format:check": "prettier --check .",
|
|
84
85
|
"check": "pnpm run build && pnpm run test",
|
|
85
|
-
"sync:skill": "node scripts/sync-skill.mjs",
|
|
86
86
|
"pack-smoke": "bash scripts/pack-smoke.sh",
|
|
87
87
|
"changeset": "changeset",
|
|
88
88
|
"githooks": "git config core.hooksPath .githooks"
|