tenjin-cli 0.1.0-alpha.28 → 0.1.0-alpha.29

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.
Files changed (127) hide show
  1. package/README.md +13 -10
  2. package/dist/{chunk-ZG6ZZLO7.js → chunk-25GGN553.js} +9 -11
  3. package/dist/{chunk-ZG6ZZLO7.js.map → chunk-25GGN553.js.map} +1 -1
  4. package/dist/{chunk-B2L53TMK.js → chunk-2SNUOHAT.js} +28 -23
  5. package/dist/chunk-2SNUOHAT.js.map +1 -0
  6. package/dist/{chunk-UEOWNDQG.js → chunk-3FY5HG7R.js} +82 -13
  7. package/dist/chunk-3FY5HG7R.js.map +1 -0
  8. package/dist/{chunk-DJYAPACT.js → chunk-4FYMDRD3.js} +32 -24
  9. package/dist/chunk-4FYMDRD3.js.map +1 -0
  10. package/dist/{chunk-ZP7AHN7Z.js → chunk-AMEUXNJT.js} +3 -5
  11. package/dist/{chunk-ZP7AHN7Z.js.map → chunk-AMEUXNJT.js.map} +1 -1
  12. package/dist/chunk-EWLU46J6.js +100 -0
  13. package/dist/chunk-EWLU46J6.js.map +1 -0
  14. package/dist/{chunk-RLPLYUME.js → chunk-LRCJ2IZ5.js} +3 -3
  15. package/dist/{chunk-RLPLYUME.js.map → chunk-LRCJ2IZ5.js.map} +1 -1
  16. package/dist/{chunk-YFJJYHVG.js → chunk-LX5OT4TQ.js} +3 -3
  17. package/dist/{chunk-YFJJYHVG.js.map → chunk-LX5OT4TQ.js.map} +1 -1
  18. package/dist/{chunk-ZO3X5NPG.js → chunk-MG3G644T.js} +4 -4
  19. package/dist/{chunk-6KA4HFX5.js → chunk-MOG7PB3A.js} +3 -3
  20. package/dist/{chunk-DYSDQE7S.js → chunk-MRUPDSUM.js} +14 -93
  21. package/dist/chunk-MRUPDSUM.js.map +1 -0
  22. package/dist/{chunk-KAMRYUK2.js → chunk-OOSRB3OF.js} +2 -2
  23. package/dist/{chunk-PZ5N6BAL.js → chunk-ORWL5BSN.js} +5 -4
  24. package/dist/chunk-ORWL5BSN.js.map +1 -0
  25. package/dist/chunk-P4LVLFO4.js +29 -0
  26. package/dist/chunk-P4LVLFO4.js.map +1 -0
  27. package/dist/{chunk-ZP5PV3JB.js → chunk-QTGUDCIR.js} +5 -5
  28. package/dist/{chunk-FQ6DHINU.js → chunk-R4AO7GC2.js} +437 -78
  29. package/dist/chunk-R4AO7GC2.js.map +1 -0
  30. package/dist/{chunk-UOW5JXYY.js → chunk-RJEPZMYY.js} +10 -4
  31. package/dist/chunk-RJEPZMYY.js.map +1 -0
  32. package/dist/{chunk-VSUHGRVB.js → chunk-SBL4THYT.js} +712 -93
  33. package/dist/chunk-SBL4THYT.js.map +1 -0
  34. package/dist/{chunk-BRHREK7E.js → chunk-SFEQGENI.js} +2 -2
  35. package/dist/{chunk-K6AXXYCG.js → chunk-SJLTEINJ.js} +10 -2
  36. package/dist/{chunk-K6AXXYCG.js.map → chunk-SJLTEINJ.js.map} +1 -1
  37. package/dist/{chunk-XVTD7UWR.js → chunk-TROZ6HL4.js} +2 -2
  38. package/dist/{chunk-3QJREVMX.js → chunk-USOLCBKC.js} +5 -5
  39. package/dist/{chunk-W6JX4LYF.js → chunk-VKQXVCZR.js} +46 -5
  40. package/dist/chunk-VKQXVCZR.js.map +1 -0
  41. package/dist/{chunk-QTND6XWJ.js → chunk-VVAHFCX2.js} +51 -3
  42. package/dist/chunk-VVAHFCX2.js.map +1 -0
  43. package/dist/{chunk-7H3RN4WJ.js → chunk-WM7TJEBP.js} +5 -5
  44. package/dist/{chunk-MNTQMZJB.js → chunk-XDYKZRLN.js} +22 -13
  45. package/dist/chunk-XDYKZRLN.js.map +1 -0
  46. package/dist/{chunk-A5H3E5QA.js → chunk-XJQ6CH7X.js} +3 -2
  47. package/dist/{chunk-7R37M6WV.js → chunk-ZQNGTLOC.js} +5 -5
  48. package/dist/{cli-234DNHN6.js → cli-JPTDHGRX.js} +38 -33
  49. package/dist/{cli-234DNHN6.js.map → cli-JPTDHGRX.js.map} +1 -1
  50. package/dist/{config-IY2OJCAK.js → config-YYKDH2TH.js} +11 -11
  51. package/dist/{doctor-2UZZF44A.js → doctor-SSTXGCHX.js} +60 -56
  52. package/dist/doctor-SSTXGCHX.js.map +1 -0
  53. package/dist/{fund-RZ2QFULK.js → fund-QWVWRVDK.js} +14 -16
  54. package/dist/{fund-RZ2QFULK.js.map → fund-QWVWRVDK.js.map} +1 -1
  55. package/dist/hook-command-VWJXRT7H.js +31 -0
  56. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  57. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  58. package/dist/hosts/claude/tenjin/.mcp.json +2 -1
  59. package/dist/hosts/claude/tenjin/hooks/hooks.json +18 -3
  60. package/dist/index.js +6 -6
  61. package/dist/{install-O5FJ5EP3.js → install-2GXXD4DK.js} +19 -16
  62. package/dist/{install-identity-QM44IQ6Z.js → install-identity-FK3YF227.js} +7 -8
  63. package/dist/{install-wallet-Z52EDLPB.js → install-wallet-TC22U52X.js} +17 -12
  64. package/dist/{install-wallet-Z52EDLPB.js.map → install-wallet-TC22U52X.js.map} +1 -1
  65. package/dist/{mcp-33HAADDF.js → mcp-42H2F4NY.js} +2091 -348
  66. package/dist/mcp-42H2F4NY.js.map +1 -0
  67. package/dist/{package-RT24HTTP.js → package-6DJA3Y2O.js} +2 -2
  68. package/dist/{paths-MUXHUOCM.js → paths-POPTXJO6.js} +6 -2
  69. package/dist/{pay-IR2V76FX.js → pay-LSDJBIAZ.js} +18 -15
  70. package/dist/payments-SPECLBRQ.js +105 -0
  71. package/dist/payments-SPECLBRQ.js.map +1 -0
  72. package/dist/{send-PI4NUA7I.js → send-MHAOLPK3.js} +12 -14
  73. package/dist/{send-PI4NUA7I.js.map → send-MHAOLPK3.js.map} +1 -1
  74. package/dist/status-O2RWLPS5.js +114 -0
  75. package/dist/status-O2RWLPS5.js.map +1 -0
  76. package/dist/{status-line-2G5JPQAE.js → status-line-45TVCRM3.js} +7 -8
  77. package/dist/{status-line-2G5JPQAE.js.map → status-line-45TVCRM3.js.map} +1 -1
  78. package/dist/{uninstall-THKUH5ZT.js → uninstall-VOK2Z5M4.js} +27 -17
  79. package/dist/uninstall-VOK2Z5M4.js.map +1 -0
  80. package/dist/update-FGP3HNLD.js +33 -0
  81. package/dist/{wallet-53EFH4M5.js → wallet-DA7OFNEW.js} +17 -12
  82. package/docs/agent-permissions.md +11 -8
  83. package/docs/safety-model.md +3 -1
  84. package/package.json +2 -2
  85. package/dist/chunk-AO54FM4H.js +0 -563
  86. package/dist/chunk-AO54FM4H.js.map +0 -1
  87. package/dist/chunk-B2L53TMK.js.map +0 -1
  88. package/dist/chunk-DJYAPACT.js.map +0 -1
  89. package/dist/chunk-DYSDQE7S.js.map +0 -1
  90. package/dist/chunk-FQ6DHINU.js.map +0 -1
  91. package/dist/chunk-FZTSGQVK.js +0 -52
  92. package/dist/chunk-FZTSGQVK.js.map +0 -1
  93. package/dist/chunk-MNTQMZJB.js.map +0 -1
  94. package/dist/chunk-PZ5N6BAL.js.map +0 -1
  95. package/dist/chunk-QTND6XWJ.js.map +0 -1
  96. package/dist/chunk-UEOWNDQG.js.map +0 -1
  97. package/dist/chunk-UOW5JXYY.js.map +0 -1
  98. package/dist/chunk-VSUHGRVB.js.map +0 -1
  99. package/dist/chunk-W6JX4LYF.js.map +0 -1
  100. package/dist/doctor-2UZZF44A.js.map +0 -1
  101. package/dist/hook-command-PZHKS7ES.js +0 -31
  102. package/dist/mcp-33HAADDF.js.map +0 -1
  103. package/dist/payments-GFV4HU5R.js +0 -47
  104. package/dist/payments-GFV4HU5R.js.map +0 -1
  105. package/dist/status-ZUHTJK46.js +0 -71
  106. package/dist/status-ZUHTJK46.js.map +0 -1
  107. package/dist/uninstall-THKUH5ZT.js.map +0 -1
  108. package/dist/update-NPZDP24E.js +0 -18
  109. /package/dist/{chunk-ZO3X5NPG.js.map → chunk-MG3G644T.js.map} +0 -0
  110. /package/dist/{chunk-6KA4HFX5.js.map → chunk-MOG7PB3A.js.map} +0 -0
  111. /package/dist/{chunk-KAMRYUK2.js.map → chunk-OOSRB3OF.js.map} +0 -0
  112. /package/dist/{chunk-ZP5PV3JB.js.map → chunk-QTGUDCIR.js.map} +0 -0
  113. /package/dist/{chunk-BRHREK7E.js.map → chunk-SFEQGENI.js.map} +0 -0
  114. /package/dist/{chunk-XVTD7UWR.js.map → chunk-TROZ6HL4.js.map} +0 -0
  115. /package/dist/{chunk-3QJREVMX.js.map → chunk-USOLCBKC.js.map} +0 -0
  116. /package/dist/{chunk-7H3RN4WJ.js.map → chunk-WM7TJEBP.js.map} +0 -0
  117. /package/dist/{chunk-A5H3E5QA.js.map → chunk-XJQ6CH7X.js.map} +0 -0
  118. /package/dist/{chunk-7R37M6WV.js.map → chunk-ZQNGTLOC.js.map} +0 -0
  119. /package/dist/{config-IY2OJCAK.js.map → config-YYKDH2TH.js.map} +0 -0
  120. /package/dist/{hook-command-PZHKS7ES.js.map → hook-command-VWJXRT7H.js.map} +0 -0
  121. /package/dist/{install-O5FJ5EP3.js.map → install-2GXXD4DK.js.map} +0 -0
  122. /package/dist/{install-identity-QM44IQ6Z.js.map → install-identity-FK3YF227.js.map} +0 -0
  123. /package/dist/{package-RT24HTTP.js.map → package-6DJA3Y2O.js.map} +0 -0
  124. /package/dist/{paths-MUXHUOCM.js.map → paths-POPTXJO6.js.map} +0 -0
  125. /package/dist/{pay-IR2V76FX.js.map → pay-LSDJBIAZ.js.map} +0 -0
  126. /package/dist/{update-NPZDP24E.js.map → update-FGP3HNLD.js.map} +0 -0
  127. /package/dist/{wallet-53EFH4M5.js.map → wallet-DA7OFNEW.js.map} +0 -0
@@ -6,39 +6,39 @@ import {
6
6
  jsonList,
7
7
  jsonResult,
8
8
  ownMarketplace,
9
+ projectInstallHere,
9
10
  removeLegacyInstall,
10
11
  removePluginFolder,
11
12
  runClaude,
12
13
  settingsInstallPaths
13
- } from "./chunk-VSUHGRVB.js";
14
- import "./chunk-W6JX4LYF.js";
14
+ } from "./chunk-SBL4THYT.js";
15
+ import "./chunk-VKQXVCZR.js";
16
+ import "./chunk-WM7TJEBP.js";
15
17
  import {
16
18
  persistRouterProject
17
- } from "./chunk-ZG6ZZLO7.js";
19
+ } from "./chunk-25GGN553.js";
18
20
  import "./chunk-AKWGE6JQ.js";
19
21
  import {
20
22
  MARKETPLACE_NAME,
21
23
  PLUGIN_ID
22
- } from "./chunk-DYSDQE7S.js";
24
+ } from "./chunk-EWLU46J6.js";
23
25
  import "./chunk-A36LQPHV.js";
24
26
  import "./chunk-P7LABKCW.js";
27
+ import "./chunk-MRUPDSUM.js";
25
28
  import "./chunk-MEFB5KHA.js";
26
- import "./chunk-B2L53TMK.js";
27
- import "./chunk-AO54FM4H.js";
28
- import "./chunk-7H3RN4WJ.js";
29
- import "./chunk-XVTD7UWR.js";
30
- import "./chunk-ZO3X5NPG.js";
29
+ import "./chunk-2SNUOHAT.js";
30
+ import "./chunk-TROZ6HL4.js";
31
+ import "./chunk-MG3G644T.js";
31
32
  import {
32
33
  removeAliveState
33
34
  } from "./chunk-6W5GYG3W.js";
34
35
  import "./chunk-S4SAZ7OD.js";
35
- import "./chunk-UOW5JXYY.js";
36
+ import "./chunk-RJEPZMYY.js";
36
37
  import "./chunk-2I4QTOLB.js";
37
- import "./chunk-ZP7AHN7Z.js";
38
- import "./chunk-FZTSGQVK.js";
39
- import "./chunk-QTND6XWJ.js";
40
- import "./chunk-K6AXXYCG.js";
41
- import "./chunk-RLPLYUME.js";
38
+ import "./chunk-AMEUXNJT.js";
39
+ import "./chunk-VVAHFCX2.js";
40
+ import "./chunk-SJLTEINJ.js";
41
+ import "./chunk-LRCJ2IZ5.js";
42
42
  import "./chunk-ZXTAQYNA.js";
43
43
 
44
44
  // src/router/uninstall.ts
@@ -58,13 +58,23 @@ async function runRouterUninstall(args, ctx, deps = {}) {
58
58
  const settings = legacy.present ? await removeLegacyInstall(legacy, { binary, env, cwd, mcpScope: paths.mcpScope }) : null;
59
59
  const alive = await removeAliveState(ctx.dataDir);
60
60
  if (project) await persistRouterProject(ctx.dataDir, cwd, false).catch(() => void 0);
61
+ const projectLeft = !project && await projectInstallHere(cwd, home, env);
61
62
  const data = {
62
63
  plugin,
63
64
  settings: { path: paths.settingsPath, found: legacy.present, removed: settings },
64
65
  aliveRemoved: alive,
66
+ ...projectLeft ? { projectInstallLeft: cwd } : {},
65
67
  kept: ["wallet.json", "spend.json", "config.json"]
66
68
  };
67
- return { data, humanLines: uninstallLines(plugin, paths.settingsPath, settings) };
69
+ const lines = uninstallLines(plugin, paths.settingsPath, settings);
70
+ if (projectLeft) {
71
+ lines.splice(
72
+ -1,
73
+ 0,
74
+ "This project has its own Tenjin install, which this left in place; `tenjin uninstall --project` here removes it."
75
+ );
76
+ }
77
+ return { data, humanLines: lines };
68
78
  }
69
79
  async function removePlugin(binary, scope, env, home, cwd) {
70
80
  const folder = await removePluginFolder(folderFor(scope, env, home, cwd));
@@ -133,4 +143,4 @@ function uninstallLines(plugin, settingsPath, settings) {
133
143
  export {
134
144
  runRouterUninstall
135
145
  };
136
- //# sourceMappingURL=uninstall-THKUH5ZT.js.map
146
+ //# sourceMappingURL=uninstall-VOK2Z5M4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/uninstall.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport { isAbsolute } from 'node:path';\nimport { persistRouterProject } from '../commands/config';\nimport type { CommandContext, CommandResult } from '../context';\nimport { removeAliveState } from './alive';\nimport { findClaudeBinary, jsonList, jsonResult, runClaude, type ClaudeBinary } from './claude-cli';\nimport { projectInstallHere, 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 { folderFor, ownMarketplace, type PluginScope } from './plugin-registration';\n\n/**\n * `tenjin uninstall`: take out the plugin and anything a settings install of\n * an earlier release left, and nothing else.\n *\n * THE PLUGIN goes through Claude Code's own commands (`claude plugin\n * uninstall`, then `claude plugin marketplace remove` for the marketplace\n * `install` added), and a plugin folder of ours loses its listed files. The\n * settings install's hook entries, rules, status line and `x402` server go\n * under the exact-shape rules of `legacy-install.ts`.\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 `tenjin wallet` is where they go to move either.\n */\n\nexport interface RouterUninstallArgs {\n project?: boolean;\n}\n\nexport interface RouterUninstallDeps {\n homeDir?: string;\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n findClaude?: (env: NodeJS.ProcessEnv) => ClaudeBinary | null;\n}\n\nexport interface PluginRemoval {\n /** `removed`, `absent` (it was not installed), or `kept` with the reason. */\n plugin: 'removed' | 'absent' | 'kept';\n marketplace: 'removed' | 'absent' | 'kept';\n folder: FolderRemoval;\n reason?: string;\n}\n\nexport async function runRouterUninstall(\n args: RouterUninstallArgs,\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 project = args.project === true;\n const scope: PluginScope = project ? 'local' : 'user';\n const binary = (deps.findClaude ?? findClaudeBinary)(env);\n\n const plugin = await removePlugin(binary, scope, env, home, cwd);\n const paths = settingsInstallPaths(project, env, home, cwd);\n const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);\n const settings: LegacyRemoval | null = legacy.present\n ? await removeLegacyInstall(legacy, { binary, env, cwd, mcpScope: paths.mcpScope })\n : null;\n const alive = await removeAliveState(ctx.dataDir);\n // Forgotten, so a later `tenjin update` does not go looking for a project\n // this machine no longer wires.\n if (project) await persistRouterProject(ctx.dataDir, cwd, false).catch(() => undefined);\n // A BARE UNINSTALL TOUCHES USER SCOPE ONLY: a project install here is left,\n // and said to be, with the command that removes it.\n const projectLeft = !project && (await projectInstallHere(cwd, home, env));\n const data = {\n plugin,\n settings: { path: paths.settingsPath, found: legacy.present, removed: settings },\n aliveRemoved: alive,\n ...(projectLeft ? { projectInstallLeft: cwd } : {}),\n kept: ['wallet.json', 'spend.json', 'config.json'],\n };\n const lines = uninstallLines(plugin, paths.settingsPath, settings);\n if (projectLeft) {\n lines.splice(\n -1,\n 0,\n 'This project has its own Tenjin install, which this left in place; `tenjin uninstall --project` here removes it.',\n );\n }\n return { data, humanLines: lines };\n}\n\nasync function removePlugin(\n binary: ClaudeBinary | null,\n scope: PluginScope,\n env: NodeJS.ProcessEnv,\n home: string,\n cwd: string,\n): Promise<PluginRemoval> {\n const folder = await removePluginFolder(folderFor(scope, env, home, cwd));\n if (binary === null) {\n return {\n plugin: 'kept',\n marketplace: 'kept',\n folder,\n reason: `no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so ${PLUGIN_ID} could not be checked; if Claude Code still lists it, type /plugin uninstall ${PLUGIN_ID} in a Claude Code session`,\n };\n }\n const run = (a: string[]) => runClaude(binary, a, { env, cwd });\n const uninstall = await run(['plugin', 'uninstall', PLUGIN_ID, '--scope', scope, '--json']);\n const result = jsonResult(uninstall.stdout);\n const pluginState: PluginRemoval['plugin'] =\n uninstall.code === 0 ? 'removed' : result?.failureCode === 'not_installed' ? 'absent' : 'kept';\n // THE MARKETPLACE GOES ONLY WHEN IT IS THE ONE `install` ADDED. A marketplace\n // of the same name from anywhere else is somebody else's.\n const listed = jsonList((await run(['plugin', 'marketplace', 'list', '--json'])).stdout) ?? [];\n const row = listed.find((m) => m.name === MARKETPLACE_NAME);\n let marketplace: PluginRemoval['marketplace'] = 'absent';\n if (row !== undefined) {\n if (await ownMarketplace(row)) {\n // Named only for a project install, as `install` added it.\n const scoped = scope === 'user' ? [] : ['--scope', scope];\n const removed = await run([\n 'plugin',\n 'marketplace',\n 'remove',\n MARKETPLACE_NAME,\n ...scoped,\n '--json',\n ]);\n marketplace = removed.code === 0 ? 'removed' : 'kept';\n } else marketplace = 'kept';\n }\n const message =\n typeof result?.message === 'string' ? result.message : uninstall.stderr.trim().slice(0, 200);\n return {\n plugin: pluginState,\n marketplace,\n folder,\n ...(pluginState === 'kept'\n ? { reason: `claude plugin uninstall did not succeed: ${message}` }\n : {}),\n };\n}\n\nfunction uninstallLines(\n plugin: PluginRemoval,\n settingsPath: string,\n settings: LegacyRemoval | null,\n): string[] {\n const lines: string[] = [\n plugin.plugin === 'removed'\n ? `removed the ${PLUGIN_ID} plugin`\n : plugin.plugin === 'absent'\n ? `plugin: ${PLUGIN_ID} was not installed`\n : `plugin: ${plugin.reason ?? 'left in place'}`,\n ];\n if (plugin.marketplace === 'removed') lines.push(`removed the ${MARKETPLACE_NAME} marketplace`);\n if (plugin.folder.removed) {\n lines.push(\n plugin.folder.left.length === 0\n ? `removed the plugin folder ${plugin.folder.path}`\n : `removed the plugin's files from ${plugin.folder.path}; kept what is not Tenjin's: ${plugin.folder.left.join(', ')}`,\n );\n } else if (plugin.folder.reason !== undefined) lines.push(`folder: ${plugin.folder.reason}`);\n if (settings !== null) {\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 }\n lines.push('Your wallet, spend ledger and config are kept.');\n return lines;\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,33 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ runUpdate,
4
+ spawnCapture,
5
+ versionFreeEntry
6
+ } from "./chunk-SBL4THYT.js";
7
+ import "./chunk-VKQXVCZR.js";
8
+ import "./chunk-WM7TJEBP.js";
9
+ import "./chunk-25GGN553.js";
10
+ import "./chunk-AKWGE6JQ.js";
11
+ import "./chunk-EWLU46J6.js";
12
+ import "./chunk-A36LQPHV.js";
13
+ import "./chunk-P7LABKCW.js";
14
+ import "./chunk-MRUPDSUM.js";
15
+ import "./chunk-MEFB5KHA.js";
16
+ import "./chunk-2SNUOHAT.js";
17
+ import "./chunk-TROZ6HL4.js";
18
+ import "./chunk-MG3G644T.js";
19
+ import "./chunk-6W5GYG3W.js";
20
+ import "./chunk-S4SAZ7OD.js";
21
+ import "./chunk-RJEPZMYY.js";
22
+ import "./chunk-2I4QTOLB.js";
23
+ import "./chunk-AMEUXNJT.js";
24
+ import "./chunk-VVAHFCX2.js";
25
+ import "./chunk-SJLTEINJ.js";
26
+ import "./chunk-LRCJ2IZ5.js";
27
+ import "./chunk-ZXTAQYNA.js";
28
+ export {
29
+ runUpdate,
30
+ spawnCapture,
31
+ versionFreeEntry
32
+ };
33
+ //# sourceMappingURL=update-FGP3HNLD.js.map
@@ -3,15 +3,21 @@ import {
3
3
  runWalletBalance,
4
4
  runWalletCreate,
5
5
  runWalletShow
6
- } from "./chunk-MNTQMZJB.js";
7
- import "./chunk-PZ5N6BAL.js";
8
- import "./chunk-BRHREK7E.js";
9
- import "./chunk-7R37M6WV.js";
10
- import "./chunk-ZP5PV3JB.js";
11
- import "./chunk-YFJJYHVG.js";
6
+ } from "./chunk-XDYKZRLN.js";
7
+ import "./chunk-ORWL5BSN.js";
8
+ import "./chunk-SFEQGENI.js";
9
+ import "./chunk-P4LVLFO4.js";
10
+ import "./chunk-YHKXNYTB.js";
11
+ import "./chunk-LFZJM56J.js";
12
+ import "./chunk-EL56RW2J.js";
13
+ import "./chunk-ZQNGTLOC.js";
14
+ import "./chunk-QTGUDCIR.js";
15
+ import "./chunk-LX5OT4TQ.js";
16
+ import "./chunk-TTNESUPQ.js";
17
+ import "./chunk-MRUPDSUM.js";
12
18
  import "./chunk-MEFB5KHA.js";
13
- import "./chunk-B2L53TMK.js";
14
- import "./chunk-XVTD7UWR.js";
19
+ import "./chunk-2SNUOHAT.js";
20
+ import "./chunk-TROZ6HL4.js";
15
21
  import "./chunk-AWQPGIR6.js";
16
22
  import "./chunk-N35E6CM2.js";
17
23
  import "./chunk-JRGFKVAZ.js";
@@ -21,13 +27,12 @@ import "./chunk-KG3D7FIF.js";
21
27
  import "./chunk-RBJPAZFI.js";
22
28
  import "./chunk-BPMWXTFX.js";
23
29
  import "./chunk-2I4QTOLB.js";
24
- import "./chunk-FZTSGQVK.js";
25
- import "./chunk-QTND6XWJ.js";
26
- import "./chunk-K6AXXYCG.js";
30
+ import "./chunk-VVAHFCX2.js";
31
+ import "./chunk-SJLTEINJ.js";
27
32
  import "./chunk-ZXTAQYNA.js";
28
33
  export {
29
34
  runWalletBalance,
30
35
  runWalletCreate,
31
36
  runWalletShow
32
37
  };
33
- //# sourceMappingURL=wallet-53EFH4M5.js.map
38
+ //# sourceMappingURL=wallet-DA7OFNEW.js.map
@@ -13,7 +13,7 @@ mcp__plugin_tenjin_router__request allow
13
13
  mcp__plugin_tenjin_router__hook deny
14
14
  ```
15
15
 
16
- The first clears the `request` tool on the plugin's `router` MCP server, and nothing else: no shell verb, no other tool, no price. A hook's allow never overrides a `deny` or `ask` rule you wrote for that tool, so a rule of yours still wins. The second blocks your assistant from calling `hook`, the tool the plugin's own hook legs call, in every permission mode, bypass included; Claude Code's own hook calls to it still run. The tool stays in your assistant's tool list, and a call to it returns the reason instead of running.
16
+ The first clears the `request` tool on the plugin's `router` MCP server, and nothing else: no shell verb, no other tool, no price. A hook's allow never overrides a `deny` or `ask` rule you wrote for that tool, so a rule of yours still wins. The second blocks your assistant from calling `hook`, the tool the plugin's own hook legs call, in every permission mode, bypass included; Claude Code's own hook calls to it still run. The tool stays in your assistant's tool list, and a call to it returns the reason instead of running. Each answer is a fixed line of JSON that `node -e` prints, started with no shell.
17
17
 
18
18
  The allow is a tool grant, not a spending grant. Every payment the tool makes still passes the local spend policy, and the policy is the only thing that decides an amount.
19
19
 
@@ -21,13 +21,13 @@ 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
- - **`maxAutoSpend`** caps automatic router purchases per call. `tenjin install` asks you to approve or change these limits (0.25 USD a call and 5 USD a day) in an interactive terminal. When it cannot ask (`--json`, or a shell with no terminal, which is how an agent runs it), it writes neither limit, exactly as when you cancel at the question in a terminal, and sets up everything else. Its output shows what the terminal question shows (the limits, the routing fee they also approve, `spend.approval` in `--json`) and the command for each answer, so your agent puts the same question to you and, for a yes, runs the same install again with `--yes` (for example `tenjin install --no-wallet --yes`), which writes the limits shown just as "Use these limits" does; everything else it writes is what the first run wrote. Until someone answers, the bare CLI's zero holds and the router pays for nothing on its own; `tenjin doctor` and the first unpaid routing call in a session show the same question and one-step yes. A script or CI that ignores the question stays at zero. A 0 you set yourself is an answer, and doctor reports it as a failure. Above the cap, automatic payment is refused without prompting.
24
+ - **`maxAutoSpend`** 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. `tenjin install` asks you to approve or change these limits (0.25 USD a call and 5 USD a day) in an interactive terminal. When it cannot ask (`--json`, or a shell with no terminal, which is how an agent runs it), it writes neither limit, exactly as when you cancel at the question in a terminal, and sets up everything else. Its output shows what the terminal question shows (the limits, the routing fee they also approve, `spend.approval` in `--json`) and the command for each answer, so your agent puts the same question to you and, for a yes, runs the same install again with `--yes` (for example `tenjin install --no-wallet --yes`), which writes the limits shown just as "Use these limits" does; everything else it writes is what the first run wrote. Until someone answers, the bare CLI's zero holds and the router pays for nothing on its own; `tenjin doctor` and the first unpaid routing call in a session show the same question and one-step yes. A script or CI that ignores the question stays at zero. A 0 you set yourself is an answer, and doctor reports it as a failure. Above the cap, nothing is paid on its own (below).
25
25
  - **`sessionBudget`** caps automatic exposure in the existing 24 hour ledger window. It defaults to 5.00 USD before and after install. Explicit zero blocks positive automatic spending; `none` removes the automatic daily ceiling.
26
26
  - **`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`.
27
27
 
28
28
  Manual pay ignores both configured limits and always requires user consent. The retired `bazaarPay` and `confirm` keys have no effect after upgrade, regardless of their old values. Doctor/status warn while they remain. Install/refresh removes and reports exactly those keys, preserving current router/limit settings and unrelated fields. `config set` rejects the retired keys.
29
29
 
30
- A router refusal retains the `needs_approval` status with the summary “Blocked by spending policy.” It does not offer an approval/resume flow or automatically raise limits.
30
+ A router call whose total is over `maxAutoSpend` or what is left of the day's `sessionBudget` pays nothing, and returns `needs_approval` with one sentence your assistant repeats ("5 takes of AiSpace (Hailuo 3 Max) cost $0.775 in total ($0.155 each)."). In Claude Code 2.1.214 or later, the `router` server also offers the `approve` tool, and the result carries a quote and the call your assistant makes next, `approve({quote, total, what})`. Claude Code shows its own permission prompt for that tool, with the total and what it buys, on every call and in every permission mode; no allow rule or hook skips it, and where nobody can answer (`dontAsk`, or `-p` with a permission-prompt tool) the call is denied. Your yes to that prompt is the only approval: nothing on disk, and no command, approves a quote. It then runs the quoted call exactly, once. A quote lasts ten minutes. An approved call may pass both limits, and counts as your own payment, outside the automatic budget, as manual pay does; it never runs past the wallet's balance. Any other host, and an older Claude Code, gets no `approve` tool: the call is refused with what it would cost and nothing paid. Nothing raises a limit on your behalf: `tenjin config set` below changes them, and only you run it.
31
31
 
32
32
  ```bash
33
33
  tenjin status # spent, reserved, and the caps in force
@@ -40,10 +40,10 @@ tenjin config set sessionBudget 2.00
40
40
  The routing decision comes from a server, and each call costs a flat $0.003 from the wallet's channel, paid from deposits of up to $0.25 that count against the limits (the deposit is counted when it leaves the wallet, the fees from it are not counted again): it proposes, it never authorizes. These checks are what keep a wrong or hostile one from being worth anything:
41
41
 
42
42
  - The routing fee is paid only by `tenjin mcp`, with the stock x402 client, and only at exactly $0.003 in USDC on Base over `batch-settlement`. The wallet has one routing channel. When it cannot cover the next fee, the call carries a deposit of up to $0.25, sized down to `maxAutoSpend` while that still covers ten fees ($0.03), and refused below that. A deposit is an automatic payment: it is reserved in `spend.json` before it is signed, so it must fit `maxAutoSpend`, the day's `sessionBudget` and `allowlistCreators` (the router's host is the creator), and it is counted from the moment it is sent, so a lost answer or a killed process leaves it counted; only an answered 4xx or 5xx, on which the server settles nothing, gives it back. The deposit is the spend: the fees come out of it and are not counted again, so the day's running total never refuses one. Each fee still gets the per-payment checks: it has to fit `maxAutoSpend` (a 0 you set, or the 0 that holds until the spend question is answered, refuses it) and pass `allowlistCreators`, and a `sessionBudget` of 0 refuses it. A fee that fails one is not paid, even from a channel that is already funded, and the call takes the free path. Approving the limits at install, where the question names the fee, is what approves it.
43
- - A routing call that cannot be paid takes the free path: the wallet holds less than the deposit, `tenjin mcp` cannot unlock the wallet without a prompt, a limit refuses the deposit, the payment fails, or the channel is carrying another session's call at that moment. The first such call in a session tells you, in Claude Code's own message line, the reason and the fix (`tenjin wallet fund 0.25`, `TENJIN_WALLET_PASSPHRASE`, or `tenjin doctor`); a busy channel says nothing, and while the router charges no fee the wallet is not touched and nothing is said. The native tools are never blocked for it, and `tenjin doctor` names the same reasons.
43
+ - A routing call that cannot be paid takes the free path: the wallet holds less than the deposit, `tenjin mcp` cannot unlock the wallet without a prompt, a limit refuses the deposit, the payment fails, or the channel is carrying another session's call at that moment. The first such call in a session tells you, in Claude Code's own message line, the reason and the fix (`tenjin wallet fund 5`, `TENJIN_WALLET_PASSPHRASE`, or `tenjin doctor`); a busy channel says nothing, and while the router charges no fee the wallet is not touched and nothing is said. The native tools are never blocked for it, and `tenjin doctor` names the same reasons.
44
44
  - A routing call that cannot reach the router (DNS, TLS, a refused connection, a proxy refusing the tunnel) makes every hook leg skip the router for the next 60 seconds, so the native tools run at once instead of each waiting out the gate. A call that runs out of its few seconds, a dropped socket (a paid call's is retried once on the free path) or an answer of any status does not start the pause. The pause is a timestamp under `~/.tenjin/router-memo/` that every session on the machine reads, beside the one-hour note that the router charges no fee, which ends as soon as the router says the fee is on. The pause ends after its 60 seconds, or at once when `tenjin doctor` reaches the router; while doctor cannot reach it either, it names the pause with the seconds left.
45
45
 
46
- - The amount actually signed has to fit `maxAutoSpend` and the day's `sessionBudget`. A live price above the one the decision quoted is refused before anything is signed, so a provider or a stale catalog cannot charge more than it advertised; a hostile server sets that quote itself, so against one the bound stays `maxAutoSpend`.
46
+ - The call's payments, together, have to fit `maxAutoSpend` and the day's `sessionBudget` unless you approved that call's quote, and each one is signed only against that plan, never above its planned amount. A live price above the one the decision quoted is refused before anything is signed, so a provider or a stale catalog cannot charge more than it advertised; a hostile server sets that quote itself, so against one the bound stays `maxAutoSpend`.
47
47
  - An offer carries the service's spec: its input schema, the fields Tenjin pins, and the HTTP request those fields become. Your assistant fills the fields; this CLI puts the pins over them, validates the result against the schema, builds the request and pays the spec's own payee, never above the spec's price ceiling. The one lookup without a spec, the free docs lookup, is bound by the backend from your assistant's query, and nothing is paid for it.
48
48
  - The destination has to be a public HTTPS endpoint whose name resolves to a public address. This is a check, not a pin: the request resolves the name again on its own, so a host that answers publicly at check time and privately a moment later is not closed by it. See [safety-model.md](./safety-model.md).
49
49
  - A 2xx whose body fails the decision's own success rule is delivered as `unverified`, never `fulfilled`, with a caveat naming the rule it missed. The money has already moved, so the body is not withheld.
@@ -102,8 +102,11 @@ Claude Code 2.1.287 or later is required. `tenjin install` and `tenjin doctor` r
102
102
  3. The Claude Code plugin `tenjin`, registered with Claude Code's own commands, which leave no step to you: `claude plugin marketplace add <package>/dist/hosts/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 installed package's own folder, read in place, so there is no download and the plugin is the build you installed. 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 three files are ever written or removed. The plugin carries:
103
103
  - 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.
104
104
  - 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: a WebSearch runs as your assistant wrote it while the hook fetches Context7 docs for the same query (up to 500 characters of it go to Tenjin's docs lookup, which asks Context7), and when docs are found they are added above the search's own results, with a line saying the web results below are there if the docs do not cover it; when none are found, or the lookup is slow or fails, the search result is left exactly as it was. One agent's identical search is not looked up again for five minutes, and the fetched docs wait in a 0700 directory under your Tenjin data dir only until that search reads them, ten minutes at most. 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.
105
- - One `SessionStart` command, `tenjin hook alive`, 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. It prints nothing and sends nothing.
106
- - The `router` MCP server, `tenjin mcp` from your PATH.
105
+ - One `SessionStart` command, `tenjin hook alive`, run as `node` with the package's own `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. It prints nothing and sends nothing.
106
+ - The `router` MCP server, `tenjin mcp --plugin`, run as `node` from your PATH with the package's own `dist/index.js`.
107
+
108
+ Every command the plugin carries is a Claude Code exec-form command: `node` and its arguments, started with no shell and never through the `tenjin` npm shim, so Windows runs the same files macOS and Linux run. The shipped plugin finds the entry three folders above `${CLAUDE_PLUGIN_ROOT}`, since Claude Code loads it in place from the package. The `skills/tenjin-router/` folder carries the absolute entry of the CLI that wrote it.
109
+
107
110
  4. 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.
108
111
 
109
112
  **An install from an earlier release** wrote seven hook entries, the `mcp__x402__request` allow rule, the `mcp__x402__hook` deny rule and possibly a `statusLine` into your settings, and registered an `x402` MCP server. On a Claude Code older than 2.1.287, install and `tenjin update` do not register the plugin at all while that install is there, and say so: the old install keeps routing until `claude update` and the next `tenjin install`. Otherwise it keeps working until the plugin has proven to load on this machine: Claude Code at 2.1.287 or later lists the plugin enabled, and its `SessionStart` leg has run in a real session. Until then both stay, and in any session the plugin serves, the old entries say nothing, so nothing is offered twice. The next `tenjin install` or `tenjin update` after that removes the old install, and only in the exact shapes it wrote: a hook handler that calls the `x402` server's `hook` tool or is exactly `tenjin hook <leg>`, the two rules (only when the `x402` server is Tenjin's or gone), a status line that runs `tenjin status-line` (a composition is put back to your own command; install and `tenjin update` both name the status line they removed, and you can set `tenjin status-line` again yourself), and the `x402` server, through `claude mcp remove x402`, only after this CLI read that entry and found it launching `tenjin mcp`. A command that only mentions `tenjin hook`, a handler of yours in the same group, your own rules and your own `x402` server stay, and doctor names what it left alone. This migration is removed on or after 2026-12-01; doctor keeps naming an unmigrated machine after that.
@@ -122,7 +125,7 @@ To stop the router without removing anything, `tenjin config set router.enabled
122
125
  2. When one fits, your assistant sees one line, opening with `Tenjin router (installed by the user):`, that names the service, its price and 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.
123
126
  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. Deciding costs nothing. 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`.
124
127
  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.
125
- 5. 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 one check that the whole set fits your limits: each payment within `maxAutoSpend`, and their total inside the day's `sessionBudget`. A set that does not fit returns `needs_approval` with nothing paid. The result lists each choice with its cost and the file it saved under `~/.tenjin/downloads/`.
128
+ 5. 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/`.
126
129
 
127
130
  ## What a paid lookup leaves on your machine
128
131
 
@@ -20,12 +20,14 @@ Do not copy commands from a provider result into an allowlist, `AGENTS.md`, `CLA
20
20
 
21
21
  Wallet display, balance checks, doctor, and checkout-link creation are separated from payments and transfers.
22
22
 
23
- The x402 router's `request` tool and `tenjin pay` are the paying commands, and they run one gate between them: `maxAutoSpend` and `sessionBudget` as limits on automatic router spending only, mandatory consent for manual pay, and a reservation that counts a signed authorization as spent the moment it leaves. A router lookup is ONE payment, to the provider: deciding where to route costs nothing and nobody signs for it. The boundary is split on purpose: an offer's spec carries the service's schema, pinned fields and request shape, and this client validates the agent's input against it and builds the call (the free docs lookup, which has no spec and costs nothing, is bound by the backend); this client alone checks the three things only it can: the amount signed against the spend caps, the body that comes back against the success rule the decision carries, and the destination resolving to a public address. That destination check is a check, not a pin, for the paid request: it resolves the name again on its own, so a host that answers publicly at check time and privately a moment later is not closed by it. The router's download of media a discovered service links to does pin: it connects to the address it validated, on every redirect hop. `--max-price` is always a hard cap on `tenjin pay`. Every automatic authorization that LEAVES the process counts against the automatic session budget until the 24 hour window rolls, even where the provider never settles it: a signed EIP-3009 authorization is a bearer instrument, so a 200 that reports no match, or a 402 that rejects the payment, is the counterparty saying it did not take the money rather than proof that it cannot. Manual exposure remains recorded in the same ledger but does not consume automatic headroom. Older records without a mode or automatic counter count conservatively as automatic. The budget is deliberately the conservative side of that, and a caller can be left with less headroom than it actually spent. The one release is proof from the chain, not the counterparty: `tenjin payments reconcile` (and the `request` tool, for up to three records beside each lookup) gives an authorization's amount back only when USDC's `authorizationState` shows it unused at a block whose timestamp is past its `validBefore`, so it can never be charged, and only inside the window that counted it, once per nonce.
23
+ The x402 router's `request` tool and `tenjin pay` are the paying commands, and they run one gate between them: `maxAutoSpend` and `sessionBudget` as limits on automatic router spending only, mandatory consent for manual pay, and a reservation that counts a signed authorization as spent the moment it leaves. A router call plans every payment it will make before it signs any (`src/lib/spend-plan.ts`): the plan's total meets `maxAutoSpend`, which is per call, the day's `sessionBudget` and the balance once, and `runPay` signs a router payment only against a slot an admitted plan minted, once, never above its planned amount. A plan over the limits pays nothing. Only for Claude Code 2.1.214 or later is it kept as a quote (`~/.tenjin/quotes`, mode 0600, ten minutes, single use) and the `approve` tool offered, marked `anthropic/requiresUserInteraction` so Claude Code puts every call of it to a person; that prompt is the only approval, and nothing in the quote file counts as one. `approve` runs the quote exactly, signed as a manual payment: past both automatic limits, never past the balance. Any other client gets no `approve` tool, and the call is refused with nothing paid and nothing kept. A router lookup is ONE payment, to the provider: deciding where to route costs nothing and nobody signs for it. The boundary is split on purpose: an offer's spec carries the service's schema, pinned fields and request shape, and this client validates the agent's input against it and builds the call (the free docs lookup, which has no spec and costs nothing, is bound by the backend); this client alone checks the three things only it can: the amount signed against the spend caps, the body that comes back against the success rule the decision carries, and the destination resolving to a public address. That destination check is a check, not a pin, for the paid request: it resolves the name again on its own, so a host that answers publicly at check time and privately a moment later is not closed by it. The router's download of media a discovered service links to does pin: it connects to the address it validated, on every redirect hop. `--max-price` is always a hard cap on `tenjin pay`. Every automatic authorization that LEAVES the process counts against the automatic session budget until the 24 hour window rolls, even where the provider never settles it: a signed EIP-3009 authorization is a bearer instrument, so a 200 that reports no match, or a 402 that rejects the payment, is the counterparty saying it did not take the money rather than proof that it cannot. Manual exposure remains recorded in the same ledger but does not consume automatic headroom. Older records without a mode or automatic counter count conservatively as automatic. The budget is deliberately the conservative side of that, and a caller can be left with less headroom than it actually spent. The one release is proof from the chain, not the counterparty: `tenjin payments reconcile` (and the `request` tool, for up to three records beside each lookup) gives an authorization's amount back only when USDC's `authorizationState` shows it unused at a block whose timestamp is past its `validBefore`, so it can never be charged, and only inside the window that counted it, once per nonce.
24
24
 
25
25
  The automatic daily limit is zero, a finite amount or `none`: zero blocks positive automatic payments and `none` removes that ceiling while retaining reservations and duplicate protection. Manual pay requires explicit user consent and is subject to neither automatic limit. Retired `bazaarPay` and `confirm` values are ignored after upgrade; doctor/status warn, and install/refresh remove and report them while preserving current controls and unrelated fields.
26
26
 
27
27
  Direct third-party payments use the supported live 402 quote. Unavailable/incomplete verification and differences from an exact listing block payment unless this invocation supplies `--ignore-warnings`. Missing listings or a missing Bazaar extension require no warning or flag. Warnings remain visible and structured in JSON. This flag acknowledges registry evidence only; `--yes` confirms payment only. Manual pay requires explicit user consent regardless of configured automatic limits and must never be an autonomous workaround for router refusal. Neither flag bypasses an explicit price cap, supported challenge, destination checks or balance check. Router payments retain the offered-price ceiling and hard checks on supplied terms, with no direct-payment fallback. An offer's spec supplies the recipient, network and asset beside the price, and the live 402 has to match them; a lookup without a spec is quoted on price alone, which does not provide complete endpoint/payee quote binding.
28
28
 
29
+ A paid call whose seller answers before the result is ready (a 202, or a body the offer's `job` rules call running) is a job, polled for up to 300 s inside one call (in Claude Code 2.1.212 or later, which moves a long call into the background, until the job's own `maxWaitS`, with each poll sent as an MCP progress notification) and resumable with `request({job})` until the job's keep time ends. A poll goes only to the submit's host over HTTPS, checked when the job starts and again before every poll, connected to the public address it resolved, with no redirect followed. A poll never carries a payment: a take's cost is its one payment, made at the submit, and nothing is signed or re-sent for a poll, a status or a complete URL. A poll that answers 402 ends the take failed, with nothing more paid. The job's record (`~/.tenjin/jobs`, mode 0600, read with `O_NOFOLLOW`) holds where to poll and how the take ended, and no payment header. `count` runs 2 to 5 takes of one media call, each its own payment and request key: one unpaid probe quotes the input's live price, the same number a single call is planned at, and the takes' total must fit `maxAutoSpend`, the day's `sessionBudget` and the balance before any take is signed; a take quoted above its plan when it is signed is refused there with nothing signed.
30
+
29
31
  After policy confirmation and immediately before signing, the actual signer's USDC balance must be readable and sufficient. Refusal releases the reservation and does not count spend; free and entitled delivery skips this read. The hook's bounded advisory read suppresses known unusable offers but does not authorize payment. Balances can change after a read, so settlement is not guaranteed. Once a payment authorization is transmitted, the conservative accounting described above applies, with that one chain-proven release.
30
32
 
31
33
  `tenjin wallet send` moves USDC out of the wallet. It exists as a human escape hatch, not as part of the agent flow.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tenjin-cli",
3
- "version": "0.1.0-alpha.28",
3
+ "version": "0.1.0-alpha.29",
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": {
@@ -40,7 +40,7 @@
40
40
  "@changesets/cli": "^3.0.3",
41
41
  "@clack/prompts": "^1.7.0",
42
42
  "@eslint/js": "^10",
43
- "@modelcontextprotocol/sdk": "1.31.0",
43
+ "@modelcontextprotocol/sdk": "1.32.0",
44
44
  "@types/node": "^22.20.5",
45
45
  "@x402/core": "2.28.0",
46
46
  "@x402/evm": "2.28.0",