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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +7 -5
  2. package/dist/{chunk-25GGN553.js → chunk-3O2BQIF6.js} +86 -22
  3. package/dist/chunk-3O2BQIF6.js.map +1 -0
  4. package/dist/{chunk-R4AO7GC2.js → chunk-5LJCEMFD.js} +14 -12
  5. package/dist/{chunk-R4AO7GC2.js.map → chunk-5LJCEMFD.js.map} +1 -1
  6. package/dist/{chunk-QTGUDCIR.js → chunk-AEG2PXBP.js} +3 -3
  7. package/dist/{chunk-AMEUXNJT.js → chunk-AWFUPKTM.js} +2 -2
  8. package/dist/{chunk-XJQ6CH7X.js → chunk-EBVIKMCH.js} +2 -2
  9. package/dist/{chunk-XDYKZRLN.js → chunk-HE2MS4QO.js} +6 -6
  10. package/dist/{chunk-RJEPZMYY.js → chunk-IOODYAXL.js} +3 -3
  11. package/dist/{chunk-SBL4THYT.js → chunk-JMM6YE7J.js} +190 -90
  12. package/dist/chunk-JMM6YE7J.js.map +1 -0
  13. package/dist/{chunk-VKQXVCZR.js → chunk-KHE6L6TD.js} +3 -3
  14. package/dist/chunk-KOGZDMHO.js +21 -0
  15. package/dist/chunk-KOGZDMHO.js.map +1 -0
  16. package/dist/{chunk-TROZ6HL4.js → chunk-KYFZTGMC.js} +2 -2
  17. package/dist/{chunk-LX5OT4TQ.js → chunk-NZIP4PA2.js} +2 -2
  18. package/dist/chunk-O2FRQ2L2.js +168 -0
  19. package/dist/chunk-O2FRQ2L2.js.map +1 -0
  20. package/dist/{chunk-3FY5HG7R.js → chunk-OK2TDZQU.js} +4 -4
  21. package/dist/{chunk-ZQNGTLOC.js → chunk-OSYTBCUC.js} +7 -5
  22. package/dist/{chunk-ZQNGTLOC.js.map → chunk-OSYTBCUC.js.map} +1 -1
  23. package/dist/{chunk-MRUPDSUM.js → chunk-PAYV4XUA.js} +3 -5
  24. package/dist/chunk-PAYV4XUA.js.map +1 -0
  25. package/dist/{chunk-USOLCBKC.js → chunk-QUVVWYJW.js} +7 -5
  26. package/dist/{chunk-USOLCBKC.js.map → chunk-QUVVWYJW.js.map} +1 -1
  27. package/dist/{chunk-MOG7PB3A.js → chunk-RAULEAZ6.js} +3 -3
  28. package/dist/{chunk-MG3G644T.js → chunk-SPAVAYSW.js} +3 -3
  29. package/dist/{chunk-4FYMDRD3.js → chunk-TTBKWWTV.js} +22 -20
  30. package/dist/chunk-TTBKWWTV.js.map +1 -0
  31. package/dist/{chunk-OOSRB3OF.js → chunk-U6YQ6FRI.js} +2 -2
  32. package/dist/{chunk-P4LVLFO4.js → chunk-VFMQTSXG.js} +2 -2
  33. package/dist/{chunk-LRCJ2IZ5.js → chunk-VUFAK2LW.js} +2 -2
  34. package/dist/{chunk-LRCJ2IZ5.js.map → chunk-VUFAK2LW.js.map} +1 -1
  35. package/dist/{chunk-WM7TJEBP.js → chunk-VZGAONSJ.js} +7 -5
  36. package/dist/{chunk-WM7TJEBP.js.map → chunk-VZGAONSJ.js.map} +1 -1
  37. package/dist/{chunk-VVAHFCX2.js → chunk-WO5BJNIB.js} +45 -194
  38. package/dist/chunk-WO5BJNIB.js.map +1 -0
  39. package/dist/chunk-WVUSXNIE.js +39 -0
  40. package/dist/chunk-WVUSXNIE.js.map +1 -0
  41. package/dist/chunk-XKESD27X.js +10 -0
  42. package/dist/chunk-XKESD27X.js.map +1 -0
  43. package/dist/{chunk-SFEQGENI.js → chunk-YFQOA5AU.js} +7 -2
  44. package/dist/{chunk-SFEQGENI.js.map → chunk-YFQOA5AU.js.map} +1 -1
  45. package/dist/{cli-JPTDHGRX.js → cli-O5SN7ZJ4.js} +38 -30
  46. package/dist/{cli-JPTDHGRX.js.map → cli-O5SN7ZJ4.js.map} +1 -1
  47. package/dist/{config-YYKDH2TH.js → config-OJQI27LT.js} +13 -12
  48. package/dist/{doctor-SSTXGCHX.js → doctor-IQQJHGGM.js} +36 -62
  49. package/dist/doctor-IQQJHGGM.js.map +1 -0
  50. package/dist/{fund-QWVWRVDK.js → fund-WEV6DMTD.js} +17 -12
  51. package/dist/{fund-QWVWRVDK.js.map → fund-WEV6DMTD.js.map} +1 -1
  52. package/dist/hook-command-D2P3ILRV.js +32 -0
  53. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  54. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  55. package/dist/index.js +4 -4
  56. package/dist/{install-2GXXD4DK.js → install-TUCRF32I.js} +23 -14
  57. package/dist/{install-identity-FK3YF227.js → install-identity-WHPNMNMQ.js} +7 -6
  58. package/dist/{install-wallet-TC22U52X.js → install-wallet-MA27FTQ5.js} +11 -10
  59. package/dist/{install-wallet-TC22U52X.js.map → install-wallet-MA27FTQ5.js.map} +1 -1
  60. package/dist/{mcp-42H2F4NY.js → mcp-QML7ZMPH.js} +33 -40
  61. package/dist/mcp-QML7ZMPH.js.map +1 -0
  62. package/dist/{package-6DJA3Y2O.js → package-LGKYOEPV.js} +2 -2
  63. package/dist/{pay-LSDJBIAZ.js → pay-2C2UBBXJ.js} +14 -13
  64. package/dist/{payments-SPECLBRQ.js → payments-C44QUFXU.js} +10 -9
  65. package/dist/{payments-SPECLBRQ.js.map → payments-C44QUFXU.js.map} +1 -1
  66. package/dist/{send-MHAOLPK3.js → send-KVJX4XIR.js} +9 -8
  67. package/dist/{send-MHAOLPK3.js.map → send-KVJX4XIR.js.map} +1 -1
  68. package/dist/{status-O2RWLPS5.js → status-S7C3WMSH.js} +10 -9
  69. package/dist/{status-O2RWLPS5.js.map → status-S7C3WMSH.js.map} +1 -1
  70. package/dist/{status-line-45TVCRM3.js → status-line-YR2T5HC4.js} +6 -5
  71. package/dist/{status-line-45TVCRM3.js.map → status-line-YR2T5HC4.js.map} +1 -1
  72. package/dist/{uninstall-VOK2Z5M4.js → uninstall-HY6LKIIT.js} +17 -14
  73. package/dist/{uninstall-VOK2Z5M4.js.map → uninstall-HY6LKIIT.js.map} +1 -1
  74. package/dist/{update-FGP3HNLD.js → update-OJV22LR3.js} +17 -14
  75. package/dist/usdc-JK4RRFFQ.js +39 -0
  76. package/dist/{wallet-DA7OFNEW.js → wallet-PD2IMZDU.js} +11 -10
  77. package/dist/wallet-PD2IMZDU.js.map +1 -0
  78. package/docs/agent-permissions.md +16 -4
  79. package/package.json +1 -1
  80. package/dist/chunk-25GGN553.js.map +0 -1
  81. package/dist/chunk-4FYMDRD3.js.map +0 -1
  82. package/dist/chunk-EWLU46J6.js +0 -100
  83. package/dist/chunk-EWLU46J6.js.map +0 -1
  84. package/dist/chunk-MRUPDSUM.js.map +0 -1
  85. package/dist/chunk-SBL4THYT.js.map +0 -1
  86. package/dist/chunk-VVAHFCX2.js.map +0 -1
  87. package/dist/doctor-SSTXGCHX.js.map +0 -1
  88. package/dist/hook-command-VWJXRT7H.js +0 -31
  89. package/dist/mcp-42H2F4NY.js.map +0 -1
  90. /package/dist/{chunk-QTGUDCIR.js.map → chunk-AEG2PXBP.js.map} +0 -0
  91. /package/dist/{chunk-AMEUXNJT.js.map → chunk-AWFUPKTM.js.map} +0 -0
  92. /package/dist/{chunk-XJQ6CH7X.js.map → chunk-EBVIKMCH.js.map} +0 -0
  93. /package/dist/{chunk-XDYKZRLN.js.map → chunk-HE2MS4QO.js.map} +0 -0
  94. /package/dist/{chunk-RJEPZMYY.js.map → chunk-IOODYAXL.js.map} +0 -0
  95. /package/dist/{chunk-VKQXVCZR.js.map → chunk-KHE6L6TD.js.map} +0 -0
  96. /package/dist/{chunk-TROZ6HL4.js.map → chunk-KYFZTGMC.js.map} +0 -0
  97. /package/dist/{chunk-LX5OT4TQ.js.map → chunk-NZIP4PA2.js.map} +0 -0
  98. /package/dist/{chunk-3FY5HG7R.js.map → chunk-OK2TDZQU.js.map} +0 -0
  99. /package/dist/{chunk-MOG7PB3A.js.map → chunk-RAULEAZ6.js.map} +0 -0
  100. /package/dist/{chunk-MG3G644T.js.map → chunk-SPAVAYSW.js.map} +0 -0
  101. /package/dist/{chunk-OOSRB3OF.js.map → chunk-U6YQ6FRI.js.map} +0 -0
  102. /package/dist/{chunk-P4LVLFO4.js.map → chunk-VFMQTSXG.js.map} +0 -0
  103. /package/dist/{config-YYKDH2TH.js.map → config-OJQI27LT.js.map} +0 -0
  104. /package/dist/{hook-command-VWJXRT7H.js.map → hook-command-D2P3ILRV.js.map} +0 -0
  105. /package/dist/{install-2GXXD4DK.js.map → install-TUCRF32I.js.map} +0 -0
  106. /package/dist/{install-identity-FK3YF227.js.map → install-identity-WHPNMNMQ.js.map} +0 -0
  107. /package/dist/{package-6DJA3Y2O.js.map → package-LGKYOEPV.js.map} +0 -0
  108. /package/dist/{pay-LSDJBIAZ.js.map → pay-2C2UBBXJ.js.map} +0 -0
  109. /package/dist/{update-FGP3HNLD.js.map → update-OJV22LR3.js.map} +0 -0
  110. /package/dist/{wallet-DA7OFNEW.js.map → usdc-JK4RRFFQ.js.map} +0 -0
@@ -3,21 +3,21 @@ import {
3
3
  runWalletBalance,
4
4
  runWalletCreate,
5
5
  runWalletShow
6
- } from "./chunk-XDYKZRLN.js";
6
+ } from "./chunk-HE2MS4QO.js";
7
7
  import "./chunk-ORWL5BSN.js";
8
- import "./chunk-SFEQGENI.js";
9
- import "./chunk-P4LVLFO4.js";
8
+ import "./chunk-YFQOA5AU.js";
9
+ import "./chunk-VFMQTSXG.js";
10
10
  import "./chunk-YHKXNYTB.js";
11
11
  import "./chunk-LFZJM56J.js";
12
12
  import "./chunk-EL56RW2J.js";
13
- import "./chunk-ZQNGTLOC.js";
14
- import "./chunk-QTGUDCIR.js";
15
- import "./chunk-LX5OT4TQ.js";
13
+ import "./chunk-OSYTBCUC.js";
14
+ import "./chunk-AEG2PXBP.js";
15
+ import "./chunk-NZIP4PA2.js";
16
16
  import "./chunk-TTNESUPQ.js";
17
- import "./chunk-MRUPDSUM.js";
17
+ import "./chunk-PAYV4XUA.js";
18
18
  import "./chunk-MEFB5KHA.js";
19
+ import "./chunk-KYFZTGMC.js";
19
20
  import "./chunk-2SNUOHAT.js";
20
- import "./chunk-TROZ6HL4.js";
21
21
  import "./chunk-AWQPGIR6.js";
22
22
  import "./chunk-N35E6CM2.js";
23
23
  import "./chunk-JRGFKVAZ.js";
@@ -27,7 +27,8 @@ import "./chunk-KG3D7FIF.js";
27
27
  import "./chunk-RBJPAZFI.js";
28
28
  import "./chunk-BPMWXTFX.js";
29
29
  import "./chunk-2I4QTOLB.js";
30
- import "./chunk-VVAHFCX2.js";
30
+ import "./chunk-WO5BJNIB.js";
31
+ import "./chunk-O2FRQ2L2.js";
31
32
  import "./chunk-SJLTEINJ.js";
32
33
  import "./chunk-ZXTAQYNA.js";
33
34
  export {
@@ -35,4 +36,4 @@ export {
35
36
  runWalletCreate,
36
37
  runWalletShow
37
38
  };
38
- //# sourceMappingURL=wallet-DA7OFNEW.js.map
39
+ //# sourceMappingURL=wallet-PD2IMZDU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -21,10 +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 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
- - **`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.
24
+ - **`sessionBudget`**, the daily budget, is the control. It caps automatic spending over a rolling 24 hours, $5 by default. Zero blocks automatic spending; `none` removes the daily ceiling.
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
+ - **The wallet balance** is the hard stop. Nothing pays past it.
26
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`.
27
28
 
29
+ Both defaults hold from the moment Tenjin is installed, whether or not anyone answers. `tenjin install` asks once: "Use the defaults ($5 a day, $0.25 a call) or set your own limits." In a terminal it asks you directly. When it cannot ask (`--json`, or a shell with no terminal, which is how an agent runs it), it writes neither limit, the defaults hold, and its output hands the same question to whoever ran it (the first entry of `nextSteps` in `--json`), with the one command for each answer: **Use the defaults** runs the same install again with `--yes` (for example `tenjin install --no-wallet --yes`), which writes them; **Set my own limits** asks you for the most per day and the most per call, then runs `tenjin install --max-auto-spend <usd> --session-budget <usd|none>` with your amounts, which replace any limit the config file holds. Everything else the follow-up install writes is what the first run wrote. The question is asked only while the config file names neither limit. No answer turns spending off: `tenjin config set router.enabled false` turns the router off.
30
+
28
31
  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
32
 
30
33
  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.
@@ -39,7 +42,7 @@ tenjin config set sessionBudget 2.00
39
42
 
40
43
  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
44
 
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.
45
+ - 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 $0.25. 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 an earlier release let you set 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
46
  - 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
47
  - 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
48
 
@@ -93,12 +96,21 @@ Each of these is a decision a person makes, so none is in the rule set and none
93
96
 
94
97
  Prefer the narrow rules on this page to a broad `Bash(tenjin:*)`, `Bash(tenjin wallet:*)` or `Bash(tenjin config:*)`, each of which swallows the table above.
95
98
 
99
+ ## When your agent runs the install
100
+
101
+ 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:
102
+
103
+ 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.
104
+ 2. The funding question comes from the output of that install command, when the wallet is new or holds no USDC: "Do you want to add $5 to your Tenjin wallet now?" "Yes, open the funding page" runs `tenjin wallet fund 5`, which opens the fund page in your default browser with $5 filled in. "Not now" runs nothing: the agent shows you the wallet address (`nextSteps[].show`) for later. Install mints no link and does not unlock the wallet; a later yes runs `tenjin wallet fund 5`.
105
+
106
+ 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 the address, 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.
107
+
96
108
  ## What `tenjin install` writes, in full
97
109
 
98
110
  Claude Code 2.1.287 or later is required. `tenjin install` and `tenjin doctor` read `claude --version`, and on an older one say to run `claude update` in the session.
99
111
 
100
112
  1. A wallet, when this machine has none (`--no-wallet` skips it).
101
- 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: your agent asks you the same question and runs the same install again with `--yes` if you say yes. 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.
113
+ 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.
102
114
  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
115
  - 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
116
  - 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tenjin-cli",
3
- "version": "0.1.0-alpha.29",
3
+ "version": "0.1.0-alpha.30",
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": {