tenjin-cli 0.1.0-alpha.18 → 0.1.0-alpha.19

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 (108) hide show
  1. package/README.md +151 -40
  2. package/dist/{_esm-CE7KNONL.js → _esm-OVVGTKHH.js} +4 -4
  3. package/dist/{chunk-WUHY2AXD.js → chunk-2SQEFBAM.js} +4 -3
  4. package/dist/{chunk-FGR734LZ.js → chunk-3VYGDRRL.js} +5 -5
  5. package/dist/{chunk-PDA2BVFY.js → chunk-5DOHKQ24.js} +4 -15
  6. package/dist/chunk-5DOHKQ24.js.map +1 -0
  7. package/dist/{chunk-N35E6CM2.js → chunk-6DCELMQA.js} +6 -6
  8. package/dist/{chunk-WXC57XGG.js → chunk-A36LQPHV.js} +1 -1
  9. package/dist/chunk-A36LQPHV.js.map +1 -0
  10. package/dist/{chunk-BTX2QE2Y.js → chunk-A6CY6BUW.js} +3 -3
  11. package/dist/{chunk-TP4D47BY.js → chunk-AISBL7EY.js} +3 -3
  12. package/dist/{chunk-ON6C6WOX.js → chunk-AMG4SONW.js} +138 -58
  13. package/dist/chunk-AMG4SONW.js.map +1 -0
  14. package/dist/{chunk-AUKDYPPX.js → chunk-BG2EXNAA.js} +7 -6
  15. package/dist/chunk-BG2EXNAA.js.map +1 -0
  16. package/dist/{chunk-F3FUGWPZ.js → chunk-FHBGTOFA.js} +121 -40
  17. package/dist/chunk-FHBGTOFA.js.map +1 -0
  18. package/dist/{chunk-HPWO4O6S.js → chunk-FPUPBQHX.js} +2 -2
  19. package/dist/{chunk-3AUDA53C.js → chunk-KTAW4KGH.js} +6 -5
  20. package/dist/{chunk-J5INH7WB.js → chunk-LSWVVSFX.js} +106 -5
  21. package/dist/chunk-LSWVVSFX.js.map +1 -0
  22. package/dist/chunk-O2JYBOUO.js +47 -0
  23. package/dist/chunk-O2JYBOUO.js.map +1 -0
  24. package/dist/{chunk-NRQMOVKM.js → chunk-PZQRSZJV.js} +2 -2
  25. package/dist/{chunk-NRQMOVKM.js.map → chunk-PZQRSZJV.js.map} +1 -1
  26. package/dist/{chunk-N44H5TFB.js → chunk-SCAOYGKX.js} +315 -71
  27. package/dist/chunk-SCAOYGKX.js.map +1 -0
  28. package/dist/{chunk-35M3VITA.js → chunk-TDGN476R.js} +60 -7
  29. package/dist/chunk-TDGN476R.js.map +1 -0
  30. package/dist/{chunk-AR7U7BRG.js → chunk-UNV4K45L.js} +12 -18
  31. package/dist/{chunk-AR7U7BRG.js.map → chunk-UNV4K45L.js.map} +1 -1
  32. package/dist/{chunk-ZG7SFI34.js → chunk-VFVFVQM6.js} +4 -4
  33. package/dist/{chunk-EPCOMXLF.js → chunk-WUU3BH6G.js} +2 -2
  34. package/dist/{chunk-KUBEYXSO.js → chunk-XDADPAWW.js} +22 -22
  35. package/dist/{chunk-YPQSMIDH.js → chunk-XNP6VUAJ.js} +3 -3
  36. package/dist/{chunk-AWQPGIR6.js → chunk-Y66XUXVI.js} +5 -5
  37. package/dist/{chunk-TJMCBIZU.js → chunk-ZDKEU2GF.js} +2 -2
  38. package/dist/{chunk-WLMJE3GJ.js → chunk-ZTFIQC4C.js} +2 -2
  39. package/dist/{cli-MP3RAYHL.js → cli-456F77ZY.js} +33 -28
  40. package/dist/{cli-MP3RAYHL.js.map → cli-456F77ZY.js.map} +1 -1
  41. package/dist/{config-BJK6U5VY.js → config-BLUWOH6S.js} +9 -12
  42. package/dist/{doctor-KJROWE5V.js → doctor-PS45CR3T.js} +37 -29
  43. package/dist/{doctor-KJROWE5V.js.map → doctor-PS45CR3T.js.map} +1 -1
  44. package/dist/{fund-I5COXPEJ.js → fund-4SW2ZBWC.js} +17 -17
  45. package/dist/{hook-command-EJO2564A.js → hook-command-YTV7X333.js} +247 -24
  46. package/dist/hook-command-YTV7X333.js.map +1 -0
  47. package/dist/index.js +2 -2
  48. package/dist/{install-NUQLLHS2.js → install-U4BIDCHH.js} +14 -13
  49. package/dist/{install-wallet-JPFTEC6H.js → install-wallet-EYHELQMG.js} +14 -14
  50. package/dist/{mcp-I5XMVE64.js → mcp-AC4PIXH5.js} +30 -26
  51. package/dist/{mcp-I5XMVE64.js.map → mcp-AC4PIXH5.js.map} +1 -1
  52. package/dist/{pay-WA3JSCNB.js → pay-VJOP6TFT.js} +19 -19
  53. package/dist/{send-KVUH5WDO.js → send-YH75Z6LB.js} +14 -14
  54. package/dist/{status-FFC6FO72.js → status-5CHCDLUE.js} +24 -17
  55. package/dist/status-5CHCDLUE.js.map +1 -0
  56. package/dist/{status-line-SAXSU6CR.js → status-line-CZAZUOAY.js} +6 -6
  57. package/dist/{status-line-wiring-DQZCWIUO.js → status-line-wiring-2ABDVXSJ.js} +4 -4
  58. package/dist/tenjin-daemon.mjs +3 -14
  59. package/dist/{uninstall-SWICHBTF.js → uninstall-BYVGAQMO.js} +13 -15
  60. package/dist/{uninstall-SWICHBTF.js.map → uninstall-BYVGAQMO.js.map} +1 -1
  61. package/dist/{update-W572AMXG.js → update-7QJDSHST.js} +5 -5
  62. package/dist/{viemAdapter-By13KInL-X2VY6CY3.js → viemAdapter-By13KInL-N2GIVMZ7.js} +2 -2
  63. package/dist/{wallet-L2YLAJFN.js → wallet-YZOXIXBC.js} +14 -14
  64. package/docs/agent-permissions.md +29 -13
  65. package/docs/safety-model.md +7 -1
  66. package/package.json +1 -1
  67. package/dist/chunk-35M3VITA.js.map +0 -1
  68. package/dist/chunk-AUKDYPPX.js.map +0 -1
  69. package/dist/chunk-F3FUGWPZ.js.map +0 -1
  70. package/dist/chunk-J5INH7WB.js.map +0 -1
  71. package/dist/chunk-N44H5TFB.js.map +0 -1
  72. package/dist/chunk-ON6C6WOX.js.map +0 -1
  73. package/dist/chunk-PDA2BVFY.js.map +0 -1
  74. package/dist/chunk-U2DZISAH.js +0 -111
  75. package/dist/chunk-U2DZISAH.js.map +0 -1
  76. package/dist/chunk-WS4JA6TC.js +0 -137
  77. package/dist/chunk-WS4JA6TC.js.map +0 -1
  78. package/dist/chunk-WXC57XGG.js.map +0 -1
  79. package/dist/hook-command-EJO2564A.js.map +0 -1
  80. package/dist/skill-placement-JMDPSKE6.js +0 -299
  81. package/dist/skill-placement-JMDPSKE6.js.map +0 -1
  82. package/dist/status-FFC6FO72.js.map +0 -1
  83. /package/dist/{_esm-CE7KNONL.js.map → _esm-OVVGTKHH.js.map} +0 -0
  84. /package/dist/{chunk-WUHY2AXD.js.map → chunk-2SQEFBAM.js.map} +0 -0
  85. /package/dist/{chunk-FGR734LZ.js.map → chunk-3VYGDRRL.js.map} +0 -0
  86. /package/dist/{chunk-N35E6CM2.js.map → chunk-6DCELMQA.js.map} +0 -0
  87. /package/dist/{chunk-BTX2QE2Y.js.map → chunk-A6CY6BUW.js.map} +0 -0
  88. /package/dist/{chunk-TP4D47BY.js.map → chunk-AISBL7EY.js.map} +0 -0
  89. /package/dist/{chunk-HPWO4O6S.js.map → chunk-FPUPBQHX.js.map} +0 -0
  90. /package/dist/{chunk-3AUDA53C.js.map → chunk-KTAW4KGH.js.map} +0 -0
  91. /package/dist/{chunk-ZG7SFI34.js.map → chunk-VFVFVQM6.js.map} +0 -0
  92. /package/dist/{chunk-EPCOMXLF.js.map → chunk-WUU3BH6G.js.map} +0 -0
  93. /package/dist/{chunk-KUBEYXSO.js.map → chunk-XDADPAWW.js.map} +0 -0
  94. /package/dist/{chunk-YPQSMIDH.js.map → chunk-XNP6VUAJ.js.map} +0 -0
  95. /package/dist/{chunk-AWQPGIR6.js.map → chunk-Y66XUXVI.js.map} +0 -0
  96. /package/dist/{chunk-TJMCBIZU.js.map → chunk-ZDKEU2GF.js.map} +0 -0
  97. /package/dist/{chunk-WLMJE3GJ.js.map → chunk-ZTFIQC4C.js.map} +0 -0
  98. /package/dist/{config-BJK6U5VY.js.map → config-BLUWOH6S.js.map} +0 -0
  99. /package/dist/{fund-I5COXPEJ.js.map → fund-4SW2ZBWC.js.map} +0 -0
  100. /package/dist/{install-NUQLLHS2.js.map → install-U4BIDCHH.js.map} +0 -0
  101. /package/dist/{install-wallet-JPFTEC6H.js.map → install-wallet-EYHELQMG.js.map} +0 -0
  102. /package/dist/{pay-WA3JSCNB.js.map → pay-VJOP6TFT.js.map} +0 -0
  103. /package/dist/{send-KVUH5WDO.js.map → send-YH75Z6LB.js.map} +0 -0
  104. /package/dist/{status-line-SAXSU6CR.js.map → status-line-CZAZUOAY.js.map} +0 -0
  105. /package/dist/{status-line-wiring-DQZCWIUO.js.map → status-line-wiring-2ABDVXSJ.js.map} +0 -0
  106. /package/dist/{update-W572AMXG.js.map → update-7QJDSHST.js.map} +0 -0
  107. /package/dist/{viemAdapter-By13KInL-X2VY6CY3.js.map → viemAdapter-By13KInL-N2GIVMZ7.js.map} +0 -0
  108. /package/dist/{wallet-L2YLAJFN.js.map → wallet-YZOXIXBC.js.map} +0 -0
@@ -3,42 +3,42 @@ import {
3
3
  MAX_PAID_LEG_TIMEOUT_MS,
4
4
  paidLegTimeoutMs,
5
5
  runPay
6
- } from "./chunk-N44H5TFB.js";
6
+ } from "./chunk-SCAOYGKX.js";
7
7
  import "./chunk-2G2WLVHB.js";
8
- import "./chunk-3AUDA53C.js";
9
- import "./chunk-WUHY2AXD.js";
8
+ import "./chunk-KTAW4KGH.js";
9
+ import "./chunk-2SQEFBAM.js";
10
10
  import "./chunk-TTNESUPQ.js";
11
- import "./chunk-HPWO4O6S.js";
11
+ import "./chunk-FPUPBQHX.js";
12
12
  import "./chunk-POUWHWID.js";
13
13
  import "./chunk-XZKD7DIF.js";
14
14
  import "./chunk-LHHMV4GU.js";
15
- import "./chunk-BTX2QE2Y.js";
15
+ import "./chunk-A6CY6BUW.js";
16
16
  import "./chunk-3KKKB2AQ.js";
17
- import "./chunk-KUBEYXSO.js";
18
- import "./chunk-AUKDYPPX.js";
19
- import "./chunk-35M3VITA.js";
20
- import "./chunk-AWQPGIR6.js";
21
- import "./chunk-N35E6CM2.js";
22
- import "./chunk-JRGFKVAZ.js";
17
+ import "./chunk-XDADPAWW.js";
18
+ import "./chunk-BG2EXNAA.js";
19
+ import "./chunk-TDGN476R.js";
20
+ import "./chunk-Y66XUXVI.js";
21
+ import "./chunk-6DCELMQA.js";
23
22
  import "./chunk-5IEP5EGE.js";
24
23
  import "./chunk-EGELTSPU.js";
25
24
  import "./chunk-KG3D7FIF.js";
26
- import "./chunk-RBJPAZFI.js";
27
- import "./chunk-BPMWXTFX.js";
25
+ import "./chunk-ZTFIQC4C.js";
28
26
  import "./chunk-7QKHZQKW.js";
29
- import "./chunk-WLMJE3GJ.js";
30
27
  import "./chunk-MEFB5KHA.js";
31
28
  import "./chunk-2I4QTOLB.js";
32
- import "./chunk-PDA2BVFY.js";
33
- import "./chunk-U2DZISAH.js";
34
- import "./chunk-AR7U7BRG.js";
35
- import "./chunk-NRQMOVKM.js";
29
+ import "./chunk-5DOHKQ24.js";
30
+ import "./chunk-O2JYBOUO.js";
31
+ import "./chunk-UNV4K45L.js";
32
+ import "./chunk-PZQRSZJV.js";
36
33
  import "./chunk-JLEF5WHM.js";
37
34
  import "./chunk-2BKS2FVE.js";
35
+ import "./chunk-JRGFKVAZ.js";
36
+ import "./chunk-RBJPAZFI.js";
37
+ import "./chunk-BPMWXTFX.js";
38
38
  import "./chunk-ZXTAQYNA.js";
39
39
  export {
40
40
  MAX_PAID_LEG_TIMEOUT_MS,
41
41
  paidLegTimeoutMs,
42
42
  runPay
43
43
  };
44
- //# sourceMappingURL=pay-WA3JSCNB.js.map
44
+ //# sourceMappingURL=pay-VJOP6TFT.js.map
@@ -10,17 +10,16 @@ import {
10
10
  broadcastUsdcSend,
11
11
  getUsdcBalance,
12
12
  prepareUsdcSend
13
- } from "./chunk-BTX2QE2Y.js";
13
+ } from "./chunk-A6CY6BUW.js";
14
14
  import "./chunk-3KKKB2AQ.js";
15
15
  import {
16
16
  describeWallet,
17
17
  resolveWalletProvider
18
- } from "./chunk-KUBEYXSO.js";
19
- import "./chunk-AUKDYPPX.js";
20
- import "./chunk-35M3VITA.js";
21
- import "./chunk-AWQPGIR6.js";
22
- import "./chunk-N35E6CM2.js";
23
- import "./chunk-JRGFKVAZ.js";
18
+ } from "./chunk-XDADPAWW.js";
19
+ import "./chunk-BG2EXNAA.js";
20
+ import "./chunk-TDGN476R.js";
21
+ import "./chunk-Y66XUXVI.js";
22
+ import "./chunk-6DCELMQA.js";
24
23
  import "./chunk-5IEP5EGE.js";
25
24
  import {
26
25
  formatEther,
@@ -28,25 +27,26 @@ import {
28
27
  isAddress
29
28
  } from "./chunk-EGELTSPU.js";
30
29
  import "./chunk-KG3D7FIF.js";
31
- import "./chunk-RBJPAZFI.js";
32
- import "./chunk-BPMWXTFX.js";
33
- import "./chunk-WLMJE3GJ.js";
30
+ import "./chunk-ZTFIQC4C.js";
34
31
  import "./chunk-MEFB5KHA.js";
35
32
  import "./chunk-2I4QTOLB.js";
36
33
  import {
37
34
  resolveContextSettings
38
- } from "./chunk-PDA2BVFY.js";
35
+ } from "./chunk-5DOHKQ24.js";
39
36
  import {
40
37
  parseUsdToAtomic,
41
38
  toMoney
42
- } from "./chunk-U2DZISAH.js";
39
+ } from "./chunk-O2JYBOUO.js";
43
40
  import {
44
41
  SEND_MAX_UNSET
45
- } from "./chunk-AR7U7BRG.js";
42
+ } from "./chunk-UNV4K45L.js";
46
43
  import {
47
44
  CliError
48
45
  } from "./chunk-JLEF5WHM.js";
49
46
  import "./chunk-2BKS2FVE.js";
47
+ import "./chunk-JRGFKVAZ.js";
48
+ import "./chunk-RBJPAZFI.js";
49
+ import "./chunk-BPMWXTFX.js";
50
50
  import "./chunk-ZXTAQYNA.js";
51
51
 
52
52
  // src/commands/send.ts
@@ -222,4 +222,4 @@ This moves funds out of the agent wallet and cannot be undone. [y/N] `;
222
222
  export {
223
223
  runSend
224
224
  };
225
- //# sourceMappingURL=send-KVUH5WDO.js.map
225
+ //# sourceMappingURL=send-YH75Z6LB.js.map
@@ -1,17 +1,22 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
- import "./chunk-AUKDYPPX.js";
2
+ import "./chunk-BG2EXNAA.js";
3
3
  import {
4
- readSpendSummary
5
- } from "./chunk-35M3VITA.js";
4
+ readSpendSummary,
5
+ spentOf
6
+ } from "./chunk-TDGN476R.js";
6
7
  import "./chunk-MEFB5KHA.js";
7
8
  import "./chunk-2I4QTOLB.js";
8
9
  import {
9
10
  resolveContextSettings
10
- } from "./chunk-PDA2BVFY.js";
11
+ } from "./chunk-5DOHKQ24.js";
11
12
  import {
12
13
  toMoney
13
- } from "./chunk-U2DZISAH.js";
14
- import "./chunk-AR7U7BRG.js";
14
+ } from "./chunk-O2JYBOUO.js";
15
+ import {
16
+ RETIRED_PAYMENT_GUIDANCE,
17
+ loadRawConfig,
18
+ retiredPaymentKeys
19
+ } from "./chunk-UNV4K45L.js";
15
20
  import "./chunk-JLEF5WHM.js";
16
21
  import "./chunk-2BKS2FVE.js";
17
22
  import "./chunk-ZXTAQYNA.js";
@@ -26,18 +31,22 @@ async function runRouterStatus(ctx, deps = {}) {
26
31
  (sum, r) => sum + BigInt(r.amountAtomic),
27
32
  0n
28
33
  );
29
- const budgetAtomic = BigInt(settings.policy.sessionBudgetAtomic);
34
+ const retired = retiredPaymentKeys(await loadRawConfig(ctx.dataDir));
35
+ const warnings = retired.length ? [`Ignored retired keys: ${retired.join(", ")}. ${RETIRED_PAYMENT_GUIDANCE}`] : [];
36
+ const automaticAtomic = ledger === null ? 0n : spentOf(ledger);
37
+ const budgetAtomic = settings.policy.sessionBudgetAtomic;
30
38
  const data = {
31
39
  baseUrl: settings.baseUrl,
40
+ warnings,
32
41
  window: {
33
42
  startedAtMs: ledger?.windowStartMs ?? null,
34
43
  committed: toMoney(committedAtomic.toString()),
44
+ automaticExposure: toMoney(automaticAtomic.toString()),
35
45
  reserved: toMoney(reservedAtomic.toString()),
36
- budget: budgetAtomic === 0n ? null : toMoney(budgetAtomic.toString())
46
+ budget: budgetAtomic === null ? null : toMoney(budgetAtomic.toString())
37
47
  },
38
48
  caps: {
39
- maxAutoSpend: toMoney(settings.policy.maxAutoSpendAtomic.toString()),
40
- confirm: confirmLabel(settings.policy.confirm)
49
+ maxAutoSpend: toMoney(settings.policy.maxAutoSpendAtomic.toString())
41
50
  },
42
51
  inFlight: (ledger?.reservations ?? []).map((r) => ({
43
52
  amount: toMoney(r.amountAtomic),
@@ -45,20 +54,18 @@ async function runRouterStatus(ctx, deps = {}) {
45
54
  ...r.requestKey !== void 0 ? { request: r.requestKey } : {}
46
55
  }))
47
56
  };
48
- const budgetLine = budgetAtomic === 0n ? "no session budget set" : `of ${toMoney(budgetAtomic.toString()).usd} USD in the rolling 24h window`;
57
+ const budgetLine = budgetAtomic === null ? "no daily limit" : `of ${toMoney(budgetAtomic.toString()).usd} USD in the rolling 24h window`;
49
58
  return {
50
59
  data,
51
60
  humanLines: [
52
- `spent ${toMoney(committedAtomic.toString()).usd} USD ${budgetLine}`,
61
+ `spent ${toMoney(committedAtomic.toString()).usd} USD total; automatic exposure ${toMoney(automaticAtomic.toString()).usd} USD ${budgetLine}`,
53
62
  `reserved ${toMoney(reservedAtomic.toString()).usd} USD in ${data.inFlight.length} open request(s)`,
54
- `per call at most ${toMoney(settings.policy.maxAutoSpendAtomic.toString()).usd} USD, confirm ${confirmLabel(settings.policy.confirm)}`
63
+ `automatic router up to ${toMoney(settings.policy.maxAutoSpendAtomic.toString()).usd} USD per call; manual pay always requires consent`,
64
+ ...warnings
55
65
  ]
56
66
  };
57
67
  }
58
- function confirmLabel(confirm) {
59
- return confirm.mode === "always" ? "always" : `above ${toMoney(confirm.thresholdAtomic.toString()).usd} USD`;
60
- }
61
68
  export {
62
69
  runRouterStatus
63
70
  };
64
- //# sourceMappingURL=status-FFC6FO72.js.map
71
+ //# sourceMappingURL=status-5CHCDLUE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/status.ts"],"sourcesContent":["import { toMoney } from '../lib/money';\nimport { loadRawConfig, retiredPaymentKeys, RETIRED_PAYMENT_GUIDANCE } from '../lib/config';\nimport { spentOf } from '../lib/spend-ledger';\nimport { resolveContextSettings } from '../lib/settings';\nimport { readSpendSummary } from '../lib/wallet/spend';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin status`: what this machine has spent and what it is still holding.\n *\n * IT READS `spend.json`, NOT THE BACKEND. The rolling window, the committed\n * total and the reservations still open are the local truth about money, and\n * the reservations are also the record of a request whose outcome is unknown:\n * an authorization that was transmitted is committed, so anything still open\n * here is either in flight or a crash that has not yet aged out.\n */\n\nexport interface StatusDeps {\n now?: () => number;\n}\n\nexport async function runRouterStatus(\n ctx: CommandContext,\n deps: StatusDeps = {},\n): Promise<CommandResult> {\n const now = deps.now ?? Date.now;\n const settings = await resolveContextSettings(ctx);\n // The same projection an authorization would make, so what this prints is\n // what the next lookup would actually be measured against.\n const ledger = await readSpendSummary(ctx.dataDir, { now });\n const committedAtomic = BigInt(ledger?.committedAtomic ?? '0');\n const reservedAtomic = (ledger?.reservations ?? []).reduce(\n (sum, r) => sum + BigInt(r.amountAtomic),\n 0n,\n );\n const retired = retiredPaymentKeys(await loadRawConfig(ctx.dataDir));\n const warnings = retired.length\n ? [`Ignored retired keys: ${retired.join(', ')}. ${RETIRED_PAYMENT_GUIDANCE}`]\n : [];\n const automaticAtomic = ledger === null ? 0n : spentOf(ledger);\n const budgetAtomic = settings.policy.sessionBudgetAtomic;\n const data = {\n baseUrl: settings.baseUrl,\n warnings,\n window: {\n startedAtMs: ledger?.windowStartMs ?? null,\n committed: toMoney(committedAtomic.toString()),\n automaticExposure: toMoney(automaticAtomic.toString()),\n reserved: toMoney(reservedAtomic.toString()),\n budget: budgetAtomic === null ? null : toMoney(budgetAtomic.toString()),\n },\n caps: {\n maxAutoSpend: toMoney(settings.policy.maxAutoSpendAtomic.toString()),\n },\n inFlight: (ledger?.reservations ?? []).map((r) => ({\n amount: toMoney(r.amountAtomic),\n ageSeconds: Math.max(0, Math.round((now() - r.atMs) / 1000)),\n ...(r.requestKey !== undefined ? { request: r.requestKey } : {}),\n })),\n };\n const budgetLine =\n budgetAtomic === null\n ? 'no daily limit'\n : `of ${toMoney(budgetAtomic.toString()).usd} USD in the rolling 24h window`;\n return {\n data,\n humanLines: [\n `spent ${toMoney(committedAtomic.toString()).usd} USD total; automatic exposure ${toMoney(automaticAtomic.toString()).usd} USD ${budgetLine}`,\n `reserved ${toMoney(reservedAtomic.toString()).usd} USD in ${data.inFlight.length} open request(s)`,\n `automatic router up to ${toMoney(settings.policy.maxAutoSpendAtomic.toString()).usd} USD per call; manual pay always requires consent`,\n ...warnings,\n ],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,gBACpB,KACA,OAAmB,CAAC,GACI;AACxB,QAAM,MAAM,KAAK,OAAO,KAAK;AAC7B,QAAM,WAAW,MAAM,uBAAuB,GAAG;AAGjD,QAAM,SAAS,MAAM,iBAAiB,IAAI,SAAS,EAAE,IAAI,CAAC;AAC1D,QAAM,kBAAkB,OAAO,QAAQ,mBAAmB,GAAG;AAC7D,QAAM,kBAAkB,QAAQ,gBAAgB,CAAC,GAAG;AAAA,IAClD,CAAC,KAAK,MAAM,MAAM,OAAO,EAAE,YAAY;AAAA,IACvC;AAAA,EACF;AACA,QAAM,UAAU,mBAAmB,MAAM,cAAc,IAAI,OAAO,CAAC;AACnE,QAAM,WAAW,QAAQ,SACrB,CAAC,yBAAyB,QAAQ,KAAK,IAAI,CAAC,KAAK,wBAAwB,EAAE,IAC3E,CAAC;AACL,QAAM,kBAAkB,WAAW,OAAO,KAAK,QAAQ,MAAM;AAC7D,QAAM,eAAe,SAAS,OAAO;AACrC,QAAM,OAAO;AAAA,IACX,SAAS,SAAS;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,MACN,aAAa,QAAQ,iBAAiB;AAAA,MACtC,WAAW,QAAQ,gBAAgB,SAAS,CAAC;AAAA,MAC7C,mBAAmB,QAAQ,gBAAgB,SAAS,CAAC;AAAA,MACrD,UAAU,QAAQ,eAAe,SAAS,CAAC;AAAA,MAC3C,QAAQ,iBAAiB,OAAO,OAAO,QAAQ,aAAa,SAAS,CAAC;AAAA,IACxE;AAAA,IACA,MAAM;AAAA,MACJ,cAAc,QAAQ,SAAS,OAAO,mBAAmB,SAAS,CAAC;AAAA,IACrE;AAAA,IACA,WAAW,QAAQ,gBAAgB,CAAC,GAAG,IAAI,CAAC,OAAO;AAAA,MACjD,QAAQ,QAAQ,EAAE,YAAY;AAAA,MAC9B,YAAY,KAAK,IAAI,GAAG,KAAK,OAAO,IAAI,IAAI,EAAE,QAAQ,GAAI,CAAC;AAAA,MAC3D,GAAI,EAAE,eAAe,SAAY,EAAE,SAAS,EAAE,WAAW,IAAI,CAAC;AAAA,IAChE,EAAE;AAAA,EACJ;AACA,QAAM,aACJ,iBAAiB,OACb,mBACA,MAAM,QAAQ,aAAa,SAAS,CAAC,EAAE,GAAG;AAChD,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,MACV,SAAS,QAAQ,gBAAgB,SAAS,CAAC,EAAE,GAAG,kCAAkC,QAAQ,gBAAgB,SAAS,CAAC,EAAE,GAAG,QAAQ,UAAU;AAAA,MAC3I,YAAY,QAAQ,eAAe,SAAS,CAAC,EAAE,GAAG,WAAW,KAAK,SAAS,MAAM;AAAA,MACjF,0BAA0B,QAAQ,SAAS,OAAO,mBAAmB,SAAS,CAAC,EAAE,GAAG;AAAA,MACpF,GAAG;AAAA,IACL;AAAA,EACF;AACF;","names":[]}
@@ -1,13 +1,13 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  renderProgress
4
- } from "./chunk-J5INH7WB.js";
4
+ } from "./chunk-LSWVVSFX.js";
5
5
  import {
6
6
  routerSettings
7
- } from "./chunk-TP4D47BY.js";
8
- import "./chunk-PDA2BVFY.js";
9
- import "./chunk-U2DZISAH.js";
10
- import "./chunk-AR7U7BRG.js";
7
+ } from "./chunk-AISBL7EY.js";
8
+ import "./chunk-5DOHKQ24.js";
9
+ import "./chunk-O2JYBOUO.js";
10
+ import "./chunk-UNV4K45L.js";
11
11
  import "./chunk-JLEF5WHM.js";
12
12
  import "./chunk-2BKS2FVE.js";
13
13
  import "./chunk-ZXTAQYNA.js";
@@ -84,4 +84,4 @@ export {
84
84
  runStatusLine,
85
85
  statusLineMain
86
86
  };
87
- //# sourceMappingURL=status-line-SAXSU6CR.js.map
87
+ //# sourceMappingURL=status-line-CZAZUOAY.js.map
@@ -9,9 +9,9 @@ import {
9
9
  inspectStatusLine,
10
10
  removeStatusLine,
11
11
  statusLineMode
12
- } from "./chunk-EPCOMXLF.js";
13
- import "./chunk-TJMCBIZU.js";
14
- import "./chunk-NRQMOVKM.js";
12
+ } from "./chunk-WUU3BH6G.js";
13
+ import "./chunk-ZDKEU2GF.js";
14
+ import "./chunk-PZQRSZJV.js";
15
15
  import "./chunk-JLEF5WHM.js";
16
16
  import "./chunk-2BKS2FVE.js";
17
17
  import "./chunk-ZXTAQYNA.js";
@@ -26,4 +26,4 @@ export {
26
26
  removeStatusLine,
27
27
  statusLineMode
28
28
  };
29
- //# sourceMappingURL=status-line-wiring-DQZCWIUO.js.map
29
+ //# sourceMappingURL=status-line-wiring-2ABDVXSJ.js.map
@@ -11,7 +11,7 @@ import { readFileSync as readFileSync4, statSync as statSync4 } from "node:fs";
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "tenjin-cli",
14
- version: "0.1.0-alpha.18",
14
+ version: "0.1.0-alpha.19",
15
15
  mcpName: "blog.tenjin/tenjin",
16
16
  type: "module",
17
17
  description: "x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base.",
@@ -16566,8 +16566,7 @@ function resolveInstallHarness(value) {
16566
16566
  var RawInstallHarnessSchema = external_exports.array(external_exports.enum(STORED_INSTALL_HARNESSES)).transform(resolveInstallHarness);
16567
16567
  var ConfigSchema = external_exports.object({
16568
16568
  maxAutoSpend: atomicString,
16569
- sessionBudget: atomicString,
16570
- confirm: external_exports.union([external_exports.literal("always"), external_exports.string().regex(/^above:\d+$/)]),
16569
+ sessionBudget: external_exports.union([atomicString, external_exports.literal("none")]),
16571
16570
  /**
16572
16571
  * Hard per-send cap for `tenjin wallet send`, NOT satisfiable by --yes or a prompt
16573
16572
  * (the spend-policy posture): an atomic amount caps each send, "0" disables
@@ -16612,14 +16611,6 @@ var ConfigSchema = external_exports.object({
16612
16611
  * 90 days. Off by default; no query text is retained server-side without it.
16613
16612
  */
16614
16613
  evalCohort: external_exports.boolean(),
16615
- /**
16616
- * The Bazaar pay lane opt-in: when true, `tenjin pay` may pay a NON-Tenjin
16617
- * x402 endpoint, provided a configured registry lists that exact resource and
16618
- * the live 402 matches the listed deal. Off by default; `install` asks once.
16619
- * The lane's teaching is the OPTIONAL tenjin-pay skill, present on disk
16620
- * exactly while this is on (lib/skill-placement).
16621
- */
16622
- bazaarPay: external_exports.boolean(),
16623
16614
  /** x402 discovery registries (facilitator base URLs) `discover` queries and
16624
16615
  * the Bazaar pay lane verifies against. */
16625
16616
  bazaarRegistries: external_exports.array(external_exports.url()),
@@ -16651,8 +16642,7 @@ var DEFAULT_BAZAAR_REGISTRIES = [
16651
16642
  ];
16652
16643
  var CONFIG_DEFAULTS = {
16653
16644
  maxAutoSpend: "0",
16654
- sessionBudget: "0",
16655
- confirm: "always",
16645
+ sessionBudget: "5000000",
16656
16646
  // A type placeholder only, never honored: Config requires every key (and
16657
16647
  // CONFIG_KEYS derives from these). resolveSendMaxAmount never reads it — an
16658
16648
  // absent key resolves to SEND_MAX_UNSET and `tenjin wallet send` refuses until the
@@ -16667,7 +16657,6 @@ var CONFIG_DEFAULTS = {
16667
16657
  shelfBypassSecret: "",
16668
16658
  rpcUrl: "https://mainnet.base.org",
16669
16659
  evalCohort: false,
16670
- bazaarPay: false,
16671
16660
  bazaarRegistries: DEFAULT_BAZAAR_REGISTRIES,
16672
16661
  publish: { mode: "review", defaultPrice: "100000", ackServerWarnings: "mode" },
16673
16662
  install: { harness: [], grantDeclined: [], routerProjects: [] },
@@ -5,33 +5,31 @@ import {
5
5
  mcpScope,
6
6
  readMcpEntry,
7
7
  routerSettingsPath
8
- } from "./chunk-F3FUGWPZ.js";
8
+ } from "./chunk-FHBGTOFA.js";
9
9
  import {
10
10
  MCP_SERVER_NAME
11
11
  } from "./chunk-TGLKKLQG.js";
12
- import "./chunk-WLMJE3GJ.js";
12
+ import "./chunk-ZTFIQC4C.js";
13
13
  import {
14
+ onPath,
14
15
  persistRouterProject
15
- } from "./chunk-ON6C6WOX.js";
16
- import "./chunk-WXC57XGG.js";
16
+ } from "./chunk-AMG4SONW.js";
17
+ import "./chunk-A36LQPHV.js";
17
18
  import "./chunk-2QYORQBF.js";
18
19
  import "./chunk-MEFB5KHA.js";
19
- import "./chunk-TP4D47BY.js";
20
- import {
21
- onPath
22
- } from "./chunk-WS4JA6TC.js";
23
20
  import "./chunk-2I4QTOLB.js";
24
- import "./chunk-PDA2BVFY.js";
25
- import "./chunk-U2DZISAH.js";
26
- import "./chunk-AR7U7BRG.js";
21
+ import "./chunk-AISBL7EY.js";
22
+ import "./chunk-5DOHKQ24.js";
23
+ import "./chunk-O2JYBOUO.js";
24
+ import "./chunk-UNV4K45L.js";
27
25
  import {
28
26
  removeStatusLine
29
- } from "./chunk-EPCOMXLF.js";
27
+ } from "./chunk-WUU3BH6G.js";
30
28
  import {
31
29
  inspectHooksFile,
32
30
  pruneHooks
33
- } from "./chunk-TJMCBIZU.js";
34
- import "./chunk-NRQMOVKM.js";
31
+ } from "./chunk-ZDKEU2GF.js";
32
+ import "./chunk-PZQRSZJV.js";
35
33
  import {
36
34
  writeFileAtomic
37
35
  } from "./chunk-JLEF5WHM.js";
@@ -164,4 +162,4 @@ export {
164
162
  MCP_REMOVE_COMMAND,
165
163
  runRouterUninstall
166
164
  };
167
- //# sourceMappingURL=uninstall-SWICHBTF.js.map
165
+ //# sourceMappingURL=uninstall-BYVGAQMO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/router/uninstall.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { homedir } from 'node:os';\nimport { readFile, stat } from 'node:fs/promises';\nimport { isAbsolute } from 'node:path';\nimport { promisify } from 'node:util';\nimport { persistRouterProject } from '../commands/config';\nimport { writeFileAtomic } from '../lib/atomic-json';\nimport { inspectHooksFile, pruneHooks } from '../lib/harness-hooks';\nimport { onPath } from '../lib/skill-wiring';\nimport type { CommandContext, CommandResult } from '../context';\nimport {\n ALLOW_RULE,\n MCP_SERVER_NAME,\n mcpRemoveCommand,\n mcpScope,\n readMcpEntry,\n routerSettingsPath,\n type McpEntryState,\n} from './install';\nimport { removeStatusLine } from './status-line-wiring';\n\n/**\n * `tenjin uninstall`: take out the hook entries, the allow rule and the MCP\n * registration, and nothing else.\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\nconst exec = promisify(execFile);\n/** The user-scope form; `--project` removes at project scope symmetrically. */\nexport const MCP_REMOVE_COMMAND = mcpRemoveCommand();\n\nexport interface RouterUninstallArgs {\n project?: boolean;\n}\n\nexport interface RouterUninstallDeps {\n homeDir?: string;\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n which?: (bin: string) => boolean;\n removeMcp?: (opts: { scope: 'user' | 'project'; cwd: string }) => Promise<void>;\n /** Reads the registration the scope's own file holds; tests inject it. */\n readMcpEntry?: (\n scope: 'user' | 'project',\n cwd: string,\n home: string,\n ) => Promise<{ found: boolean; state: McpEntryState }>;\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 settingsPath = routerSettingsPath({\n ...(args.project === true ? { project: true } : {}),\n homeDir: home,\n cwd,\n });\n\n const removed = await removeFromSettings(settingsPath, ctx.dataDir);\n // OURS ALONE, and after the hooks write so the two never touch the file at\n // once. A COMPOSED status line is the user's own text with ours appended:\n // deleting it would take their line with it, so it is reported and kept.\n const statusLine = await removeStatusLine(settingsPath);\n // Forgotten, so a later `tenjin update` does not go looking for a project\n // this machine no longer wires.\n if (args.project === true) {\n await persistRouterProject(ctx.dataDir, cwd, false).catch(() => undefined);\n }\n // The SAME scope the install used, or a `--project` uninstall would leave the\n // project's registration behind and reach into the user's file instead.\n const mcp = await removeMcpServer(deps, env, args.project === true, cwd, home);\n const data = {\n settingsPath,\n ...removed,\n statusLine,\n mcp,\n kept: ['wallet.json', 'spend.json', 'config.json'],\n };\n return {\n data,\n humanLines: [\n removed.warning === undefined\n ? `removed ${removed.events.length > 0 ? removed.events.join(', ') : 'no'} hook entries and ${removed.ruleRemoved ? 'the' : 'no'} permission rule from ${settingsPath}`\n : `${settingsPath} was left untouched (${removed.warning})`,\n statusLine.wrote\n ? 'removed the x402 status line'\n : statusLine.state === 'composed'\n ? 'status line: yours also runs the x402 footer; edit that command to drop it'\n : 'status line: none of ours was registered',\n mcp.removed\n ? `removed the ${MCP_SERVER_NAME} MCP server (${mcp.scope} scope)`\n : mcp.kept !== undefined\n ? `mcp: ${mcp.reason ?? 'left in place'}`\n : `mcp: run ${mcp.command}`,\n 'Your wallet, spend ledger and config are kept.',\n ],\n };\n}\n\ninterface SettingsRemoval {\n /** The events an entry of ours was taken out of. */\n events: string[];\n ruleRemoved: boolean;\n wrote: boolean;\n warning?: string;\n}\n\nasync function removeFromSettings(path: string, dataDir: string): Promise<SettingsRemoval> {\n const found = await inspectHooksFile(path);\n if ('refusal' in found) {\n return { events: [], ruleRemoved: false, wrote: false, warning: found.refusal.reason };\n }\n const { raw, settings, hooks } = found;\n if (raw === null) return { events: [], ruleRemoved: false, wrote: false };\n const pruned = pruneHooks(hooks, dataDir);\n const permissions =\n settings.permissions !== null &&\n typeof settings.permissions === 'object' &&\n !Array.isArray(settings.permissions)\n ? (settings.permissions as Record<string, unknown>)\n : undefined;\n const allow = Array.isArray(permissions?.allow) ? permissions.allow : undefined;\n const ruleRemoved = allow?.includes(ALLOW_RULE) === true;\n const next = {\n ...settings,\n hooks: pruned.next,\n ...(permissions !== undefined && allow !== undefined\n ? { permissions: { ...permissions, allow: allow.filter((r) => r !== ALLOW_RULE) } }\n : {}),\n };\n const body = `${JSON.stringify(next, null, 2)}\\n`;\n if (body === raw) {\n return { events: pruned.removed, ruleRemoved, wrote: false };\n }\n const mode = await stat(found.path)\n .then((s) => ({ mode: s.mode & 0o777 }))\n .catch(() => ({}));\n if ((await readFile(found.path, 'utf8').catch(() => null)) !== raw) {\n return { events: [], ruleRemoved: false, wrote: false, warning: 'changed-since-read' };\n }\n try {\n await writeFileAtomic(found.path, body, mode);\n } catch (err) {\n return {\n events: [],\n ruleRemoved: false,\n wrote: false,\n warning: err instanceof Error ? err.message : String(err),\n };\n }\n return { events: pruned.removed, ruleRemoved, wrote: true };\n}\n\nasync function removeMcpServer(\n deps: RouterUninstallDeps,\n env: NodeJS.ProcessEnv,\n project: boolean,\n cwd: string,\n home: string,\n): Promise<{\n removed: boolean;\n scope: 'user' | 'project';\n command: string;\n reason?: string;\n kept?: 'foreign' | 'unreadable';\n}> {\n const scope = mcpScope(project);\n const command = mcpRemoveCommand(project);\n // THE SAME CHECK INSTALL MAKES. The name `x402` proves nothing: another tool\n // can register its own server under it, and install refuses to touch that\n // entry. Uninstall must not remove it either. An absent entry falls through\n // to the remove as before, so nothing changes for a normal install.\n const existing = await (deps.readMcpEntry ?? readMcpEntry)(scope, cwd, home);\n if (existing.state === 'wrong-command') {\n return {\n removed: false,\n scope,\n command,\n kept: 'foreign',\n reason: `an MCP server named ${MCP_SERVER_NAME} at ${scope} scope launches something else; this command will not remove a registration it did not write, so it was left in place`,\n };\n }\n if (existing.state === 'unreadable') {\n return {\n removed: false,\n scope,\n command,\n kept: 'unreadable',\n reason: `the ${scope}-scope registration file could not be read, so nothing was removed from it`,\n };\n }\n const which = deps.which ?? ((bin: string) => onPath(bin, env));\n if (!which('claude')) {\n return { removed: false, scope, command, reason: 'the `claude` binary is not on PATH' };\n }\n try {\n await (deps.removeMcp ?? runClaudeMcpRemove)({ scope, cwd });\n return { removed: true, scope, command };\n } catch (err) {\n return {\n removed: false,\n scope,\n command,\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n}\n\nasync function runClaudeMcpRemove(opts: { scope: 'user' | 'project'; cwd: string }): Promise<void> {\n await exec('claude', ['mcp', 'remove', MCP_SERVER_NAME, '-s', opts.scope], {\n timeout: 20_000,\n cwd: opts.cwd,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,UAAU,YAAY;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AA0B1B,IAAM,OAAO,UAAU,QAAQ;AAExB,IAAM,qBAAqB,iBAAiB;AAoBnD,eAAsB,mBACpB,MACA,KACA,OAA4B,CAAC,GACL;AACxB,QAAM,MAAM,KAAK,OAAO,QAAQ;AAChC,QAAM,OAAO,KAAK,WAAW,QAAQ;AACrC,MAAI,CAAC,WAAW,IAAI,EAAG,OAAM,IAAI,MAAM,6CAA6C;AACpF,QAAM,MAAM,KAAK,OAAO,QAAQ,IAAI;AACpC,QAAM,eAAe,mBAAmB;AAAA,IACtC,GAAI,KAAK,YAAY,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;AAAA,IACjD,SAAS;AAAA,IACT;AAAA,EACF,CAAC;AAED,QAAM,UAAU,MAAM,mBAAmB,cAAc,IAAI,OAAO;AAIlE,QAAM,aAAa,MAAM,iBAAiB,YAAY;AAGtD,MAAI,KAAK,YAAY,MAAM;AACzB,UAAM,qBAAqB,IAAI,SAAS,KAAK,KAAK,EAAE,MAAM,MAAM,MAAS;AAAA,EAC3E;AAG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eAAe,OAAO,KAAK;AAAA,IAC5D;AAAA,EACF;AACA,MAAI,SAAS,UAAU,cAAc;AACnC,WAAO;AAAA,MACL,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,QAAQ,OAAO,KAAK;AAAA,IACtB;AAAA,EACF;AACA,QAAM,QAAQ,KAAK,UAAU,CAAC,QAAgB,OAAO,KAAK,GAAG;AAC7D,MAAI,CAAC,MAAM,QAAQ,GAAG;AACpB,WAAO,EAAE,SAAS,OAAO,OAAO,SAAS,QAAQ,qCAAqC;AAAA,EACxF;AACA,MAAI;AACF,WAAO,KAAK,aAAa,oBAAoB,EAAE,OAAO,IAAI,CAAC;AAC3D,WAAO,EAAE,SAAS,MAAM,OAAO,QAAQ;AAAA,EACzC,SAAS,KAAK;AACZ,WAAO;AAAA,MACL,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA,QAAQ,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,IACzD;AAAA,EACF;AACF;AAEA,eAAe,mBAAmB,MAAiE;AACjG,QAAM,KAAK,UAAU,CAAC,OAAO,UAAU,iBAAiB,MAAM,KAAK,KAAK,GAAG;AAAA,IACzE,SAAS;AAAA,IACT,KAAK,KAAK;AAAA,EACZ,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/router/uninstall.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { homedir } from 'node:os';\nimport { readFile, stat } from 'node:fs/promises';\nimport { isAbsolute } from 'node:path';\nimport { promisify } from 'node:util';\nimport { persistRouterProject } from '../commands/config';\nimport { writeFileAtomic } from '../lib/atomic-json';\nimport { inspectHooksFile, pruneHooks } from '../lib/harness-hooks';\nimport { onPath } from '../lib/skill-wiring';\nimport type { CommandContext, CommandResult } from '../context';\nimport {\n ALLOW_RULE,\n MCP_SERVER_NAME,\n mcpRemoveCommand,\n mcpScope,\n readMcpEntry,\n routerSettingsPath,\n type McpEntryState,\n} from './install';\nimport { removeStatusLine } from './status-line-wiring';\n\n/**\n * `tenjin uninstall`: take out the hook entries, the allow rule and the MCP\n * registration, and nothing else.\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\nconst exec = promisify(execFile);\n/** The user-scope form; `--project` removes at project scope symmetrically. */\nexport const MCP_REMOVE_COMMAND = mcpRemoveCommand();\n\nexport interface RouterUninstallArgs {\n project?: boolean;\n}\n\nexport interface RouterUninstallDeps {\n homeDir?: string;\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n which?: (bin: string) => boolean;\n removeMcp?: (opts: { scope: 'user' | 'project'; cwd: string }) => Promise<void>;\n /** Reads the registration the scope's own file holds; tests inject it. */\n readMcpEntry?: (\n scope: 'user' | 'project',\n cwd: string,\n home: string,\n ) => Promise<{ found: boolean; state: McpEntryState }>;\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 settingsPath = routerSettingsPath({\n ...(args.project === true ? { project: true } : {}),\n homeDir: home,\n cwd,\n });\n\n const removed = await removeFromSettings(settingsPath, ctx.dataDir);\n // OURS ALONE, and after the hooks write so the two never touch the file at\n // once. A COMPOSED status line is the user's own text with ours appended:\n // deleting it would take their line with it, so it is reported and kept.\n const statusLine = await removeStatusLine(settingsPath);\n // Forgotten, so a later `tenjin update` does not go looking for a project\n // this machine no longer wires.\n if (args.project === true) {\n await persistRouterProject(ctx.dataDir, cwd, false).catch(() => undefined);\n }\n // The SAME scope the install used, or a `--project` uninstall would leave the\n // project's registration behind and reach into the user's file instead.\n const mcp = await removeMcpServer(deps, env, args.project === true, cwd, home);\n const data = {\n settingsPath,\n ...removed,\n statusLine,\n mcp,\n kept: ['wallet.json', 'spend.json', 'config.json'],\n };\n return {\n data,\n humanLines: [\n removed.warning === undefined\n ? `removed ${removed.events.length > 0 ? removed.events.join(', ') : 'no'} hook entries and ${removed.ruleRemoved ? 'the' : 'no'} permission rule from ${settingsPath}`\n : `${settingsPath} was left untouched (${removed.warning})`,\n statusLine.wrote\n ? 'removed the x402 status line'\n : statusLine.state === 'composed'\n ? 'status line: yours also runs the x402 footer; edit that command to drop it'\n : 'status line: none of ours was registered',\n mcp.removed\n ? `removed the ${MCP_SERVER_NAME} MCP server (${mcp.scope} scope)`\n : mcp.kept !== undefined\n ? `mcp: ${mcp.reason ?? 'left in place'}`\n : `mcp: run ${mcp.command}`,\n 'Your wallet, spend ledger and config are kept.',\n ],\n };\n}\n\ninterface SettingsRemoval {\n /** The events an entry of ours was taken out of. */\n events: string[];\n ruleRemoved: boolean;\n wrote: boolean;\n warning?: string;\n}\n\nasync function removeFromSettings(path: string, dataDir: string): Promise<SettingsRemoval> {\n const found = await inspectHooksFile(path);\n if ('refusal' in found) {\n return { events: [], ruleRemoved: false, wrote: false, warning: found.refusal.reason };\n }\n const { raw, settings, hooks } = found;\n if (raw === null) return { events: [], ruleRemoved: false, wrote: false };\n const pruned = pruneHooks(hooks, dataDir);\n const permissions =\n settings.permissions !== null &&\n typeof settings.permissions === 'object' &&\n !Array.isArray(settings.permissions)\n ? (settings.permissions as Record<string, unknown>)\n : undefined;\n const allow = Array.isArray(permissions?.allow) ? permissions.allow : undefined;\n const ruleRemoved = allow?.includes(ALLOW_RULE) === true;\n const next = {\n ...settings,\n hooks: pruned.next,\n ...(permissions !== undefined && allow !== undefined\n ? { permissions: { ...permissions, allow: allow.filter((r) => r !== ALLOW_RULE) } }\n : {}),\n };\n const body = `${JSON.stringify(next, null, 2)}\\n`;\n if (body === raw) {\n return { events: pruned.removed, ruleRemoved, wrote: false };\n }\n const mode = await stat(found.path)\n .then((s) => ({ mode: s.mode & 0o777 }))\n .catch(() => ({}));\n if ((await readFile(found.path, 'utf8').catch(() => null)) !== raw) {\n return { events: [], ruleRemoved: false, wrote: false, warning: 'changed-since-read' };\n }\n try {\n await writeFileAtomic(found.path, body, mode);\n } catch (err) {\n return {\n events: [],\n ruleRemoved: false,\n wrote: false,\n warning: err instanceof Error ? err.message : String(err),\n };\n }\n return { events: pruned.removed, ruleRemoved, wrote: true };\n}\n\nasync function removeMcpServer(\n deps: RouterUninstallDeps,\n env: NodeJS.ProcessEnv,\n project: boolean,\n cwd: string,\n home: string,\n): Promise<{\n removed: boolean;\n scope: 'user' | 'project';\n command: string;\n reason?: string;\n kept?: 'foreign' | 'unreadable';\n}> {\n const scope = mcpScope(project);\n const command = mcpRemoveCommand(project);\n // THE SAME CHECK INSTALL MAKES. The name `x402` proves nothing: another tool\n // can register its own server under it, and install refuses to touch that\n // entry. Uninstall must not remove it either. An absent entry falls through\n // to the remove as before, so nothing changes for a normal install.\n const existing = await (deps.readMcpEntry ?? readMcpEntry)(scope, cwd, home);\n if (existing.state === 'wrong-command') {\n return {\n removed: false,\n scope,\n command,\n kept: 'foreign',\n reason: `an MCP server named ${MCP_SERVER_NAME} at ${scope} scope launches something else; this command will not remove a registration it did not write, so it was left in place`,\n };\n }\n if (existing.state === 'unreadable') {\n return {\n removed: false,\n scope,\n command,\n kept: 'unreadable',\n reason: `the ${scope}-scope registration file could not be read, so nothing was removed from it`,\n };\n }\n const which = deps.which ?? ((bin: string) => onPath(bin, env));\n if (!which('claude')) {\n return { removed: false, scope, command, reason: 'the `claude` binary is not on PATH' };\n }\n try {\n await (deps.removeMcp ?? runClaudeMcpRemove)({ scope, cwd });\n return { removed: true, scope, command };\n } catch (err) {\n return {\n removed: false,\n scope,\n command,\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n}\n\nasync function runClaudeMcpRemove(opts: { scope: 'user' | 'project'; cwd: string }): Promise<void> {\n await exec('claude', ['mcp', 'remove', MCP_SERVER_NAME, '-s', opts.scope], {\n timeout: 20_000,\n cwd: opts.cwd,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AC;AAC3D,WAAO,EAAE,SAAS,MAAM,OAAO,QAAQ;AAAA,EACzC,SAAS,KAAK;AACZ,WAAO;AAAA,MACL,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA,QAAQ,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,IACzD;AAAA,EACF;AACF;AAEA,eAAe,mBAAmB,MAAiE;AACjG,QAAM,KAAK,UAAU,CAAC,OAAO,UAAU,iBAAiB,MAAM,KAAK,KAAK,GAAG;AAAA,IACzE,SAAS;AAAA,IACT,KAAK,KAAK;AAAA,EACZ,CAAC;AACH;","names":[]}
@@ -5,15 +5,15 @@ import {
5
5
  fetchDistTags,
6
6
  isNewer,
7
7
  resolveTarget
8
- } from "./chunk-ZG7SFI34.js";
8
+ } from "./chunk-VFVFVQM6.js";
9
9
  import {
10
10
  emitWriteNotice,
11
11
  sanitizeForTerminal
12
- } from "./chunk-WLMJE3GJ.js";
13
- import "./chunk-AR7U7BRG.js";
12
+ } from "./chunk-ZTFIQC4C.js";
13
+ import "./chunk-UNV4K45L.js";
14
14
  import {
15
15
  package_default
16
- } from "./chunk-NRQMOVKM.js";
16
+ } from "./chunk-PZQRSZJV.js";
17
17
  import {
18
18
  CliError
19
19
  } from "./chunk-JLEF5WHM.js";
@@ -430,4 +430,4 @@ export {
430
430
  spawnCapture,
431
431
  versionFreeEntry
432
432
  };
433
- //# sourceMappingURL=update-W572AMXG.js.map
433
+ //# sourceMappingURL=update-7QJDSHST.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-HPWO4O6S.js";
5
+ } from "./chunk-FPUPBQHX.js";
6
6
  import "./chunk-XZKD7DIF.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-X2VY6CY3.js.map
14
+ //# sourceMappingURL=viemAdapter-By13KInL-N2GIVMZ7.js.map
@@ -3,31 +3,31 @@ import {
3
3
  runWalletBalance,
4
4
  runWalletCreate,
5
5
  runWalletShow
6
- } from "./chunk-FGR734LZ.js";
7
- import "./chunk-BTX2QE2Y.js";
6
+ } from "./chunk-3VYGDRRL.js";
7
+ import "./chunk-A6CY6BUW.js";
8
8
  import "./chunk-3KKKB2AQ.js";
9
- import "./chunk-KUBEYXSO.js";
10
- import "./chunk-AUKDYPPX.js";
11
- import "./chunk-35M3VITA.js";
12
- import "./chunk-AWQPGIR6.js";
13
- import "./chunk-N35E6CM2.js";
14
- import "./chunk-JRGFKVAZ.js";
9
+ import "./chunk-XDADPAWW.js";
10
+ import "./chunk-BG2EXNAA.js";
11
+ import "./chunk-TDGN476R.js";
12
+ import "./chunk-Y66XUXVI.js";
13
+ import "./chunk-6DCELMQA.js";
15
14
  import "./chunk-5IEP5EGE.js";
16
15
  import "./chunk-EGELTSPU.js";
17
16
  import "./chunk-KG3D7FIF.js";
18
- import "./chunk-RBJPAZFI.js";
19
- import "./chunk-BPMWXTFX.js";
20
- import "./chunk-WLMJE3GJ.js";
17
+ import "./chunk-ZTFIQC4C.js";
21
18
  import "./chunk-MEFB5KHA.js";
22
19
  import "./chunk-2I4QTOLB.js";
23
- import "./chunk-U2DZISAH.js";
24
- import "./chunk-AR7U7BRG.js";
20
+ import "./chunk-O2JYBOUO.js";
21
+ import "./chunk-UNV4K45L.js";
25
22
  import "./chunk-JLEF5WHM.js";
26
23
  import "./chunk-2BKS2FVE.js";
24
+ import "./chunk-JRGFKVAZ.js";
25
+ import "./chunk-RBJPAZFI.js";
26
+ import "./chunk-BPMWXTFX.js";
27
27
  import "./chunk-ZXTAQYNA.js";
28
28
  export {
29
29
  runWalletBalance,
30
30
  runWalletCreate,
31
31
  runWalletShow
32
32
  };
33
- //# sourceMappingURL=wallet-L2YLAJFN.js.map
33
+ //# sourceMappingURL=wallet-YZOXIXBC.js.map
@@ -16,14 +16,15 @@ It is a tool grant, not a spending grant. Every payment the tool makes still pas
16
16
 
17
17
  ## What bounds a payment
18
18
 
19
- Four numbers and a file, all local, none of them readable or raisable by the router:
19
+ Router on/off controls automatic routing. The spending controls and ledger are local; the router cannot read or raise them:
20
20
 
21
- - **`maxAutoSpend`** is the ceiling on one call. `tenjin install` sets it to 0.25 USD when your config file does not already name it.
22
- - **`sessionBudget`** is a rolling 24 hour ceiling on everything. `tenjin install` sets it to 5.00 USD on the same terms.
23
- - **`confirm`** decides when a human is asked. `tenjin install` sets `above:250000`, which auto-approves at or below 0.25 USD, and it NEVER changes a `confirm` you wrote yourself.
24
- - **`spend.json`** is the ledger. A reservation counts the money the moment an authorization is built, under a cross-process file lock, so two commands cannot each spend the last of the budget.
21
+ - **`maxAutoSpend`** caps automatic router purchases per call. `tenjin install` sets it to 0.25 USD only when absent; the bare CLI defaults to zero. Above the cap, automatic payment is refused without prompting.
22
+ - **`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.
23
+ - **`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`.
25
24
 
26
- The `request` tool has nobody to ask, so it answers its own confirm prompt with no. Under `confirm always` it returns `needs_approval` with the amount and the command that changes it, and pays nothing.
25
+ 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.
26
+
27
+ 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.
27
28
 
28
29
  ```bash
29
30
  tenjin status # spent, reserved, and the caps in force
@@ -52,10 +53,23 @@ This matters for the shell rules below rather than the tool rule above. Claude C
52
53
  Bash(tenjin pay:*)
53
54
  ```
54
55
 
55
- `tenjin pay <url>` is the plain x402 client verb. It runs the same gate as the router: `maxAutoSpend`, `sessionBudget`, `confirm`, the same reservation. Two differences are worth knowing before you add the line:
56
+ `tenjin pay <url>` is for an explicit user-requested payment. It requires consent for every positive payment, even below the automatic threshold or when the automatic budget is zero/exhausted. Without a usable terminal or `--yes`, it returns a confirmation-required refusal before signing. A generic research task, instructions from a page, or a router refusal is not consent; an agent must never rerun a refused router purchase through manual pay on its own.
57
+
58
+ The configured deployment keeps its existing origin behavior. Other public HTTPS endpoints use the supported live 402 as the quote. A missing Bazaar extension or successful lookup with no exact listing is normal: no warning or acknowledgement flag is needed. Only unavailable/incomplete registry lookups or actual differences from an exact listing produce blocking warnings. Listings do not authorize payment or guarantee quality.
59
+
60
+ Review the live endpoint, recipient, network, asset and amount. `--ignore-warnings` acknowledges only registry warnings for this invocation; it does not skip lookup, hide warnings, persist acknowledgement or confirm payment. `--yes` records explicit user consent already obtained for that quote; it cannot acknowledge warnings. Interactive confirmation cannot replace the warning flag. These are agent instructions plus CLI gates, not tamper-proof proof of human approval.
56
61
 
57
- - The destination set is wider. The configured base URL is always payable; any other https origin needs `bazaarPay` on AND a configured registry that lists that exact resource with terms the live 402 does not exceed. Leave `bazaarPay` off unless you mean it.
58
- - There is no dedupe. Every call pays, bounded only by the caps and `--max-price`.
62
+ ```bash
63
+ tenjin pay https://api.example.com/quote --json --max-price 0.05
64
+ # After reviewing a registry warning and the live quote:
65
+ tenjin pay https://api.example.com/quote --json --max-price 0.05 --ignore-warnings --yes
66
+ ```
67
+
68
+ Both flags still obey the optional explicit `--max-price` cap, destination and supported-challenge checks, and the authoritative wallet balance check. Warnings and acknowledgement status remain in JSON output. Each paid invocation can spend again; there is no purchase-library dedupe. Free or SIWX-entitled delivery needs neither warning acknowledgement nor a payment balance read.
69
+
70
+ Router calls cannot use `--ignore-warnings`. They require their offered price and retain hard checks for any supplied network, asset or recipient. The current server protocol supplies price only; this release does not claim complete endpoint/payee quote binding.
71
+
72
+ Immediately before signing a positive payment, the CLI reads the actual signer's Base USDC balance through the configured RPC. An unreadable balance gets one retry within the original deadline. Confirmed insufficient funds or two unreadable results refuse, releases the reservation and counts no spend. Hook balance reads are advisory and bounded: prompt, pre-call, after-call and subagent offers are suppressed for known insufficient funds or policy refusal. A successful balance read cannot reserve funds or guarantee settlement after concurrent transfers.
59
73
 
60
74
  ## Never recommended
61
75
 
@@ -74,12 +88,14 @@ Prefer the narrow rules on this page to a broad `Bash(tenjin:*)`, `Bash(tenjin w
74
88
 
75
89
  ## What `tenjin install` writes, in full
76
90
 
77
- 1. Five hook entries in `~/.claude/settings.json` (`--project` writes the project file instead): `UserPromptSubmit` running `tenjin hook prompt`, `PreToolUse` on `WebSearch|WebFetch` running `tenjin hook native`, `PreToolUse` on `Agent|Task` running `tenjin hook agent`, and `PostToolUse` and `PostToolUseFailure` on `WebSearch|WebFetch`, both running `tenjin hook shortfall`. All are plain command entries with a 5 second timeout. No daemon, no background process, no generated script. An install from an earlier release already has the first two; `tenjin install --refresh` (which `tenjin update` runs) adds the rest.
78
- 2. The `mcp__x402__request` rule in `permissions.allow`. Nothing goes into `permissions.deny`, and no hook ever approves a 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__x402__request` in its place, as earlier releases did; a subagent is redirected only when it is known to have `mcp__x402__request` and your spend policy would pay without asking, and otherwise its call simply runs. 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.
91
+ 1. Five hook entries in `~/.claude/settings.json` (`--project` writes the project file instead): `UserPromptSubmit` running `tenjin hook prompt`, `PreToolUse` on `WebSearch|WebFetch` running `tenjin hook native`, `PreToolUse` on `Agent|Task` running `tenjin hook agent`, and `PostToolUse` and `PostToolUseFailure` on `WebSearch|WebFetch`, both running `tenjin hook shortfall`. All are plain command entries with a 5 second timeout, except the two `tenjin hook shortfall` entries, which get 15 seconds so a search can wait for the free docs described below. 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. An install from an earlier release already has the first two; `tenjin install --refresh` (which `tenjin update` runs) adds the rest.
92
+ 2. The `mcp__x402__request` rule in `permissions.allow`. Nothing goes into `permissions.deny`, and no hook ever approves a 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__x402__request` in its place, as earlier releases did; a subagent is redirected only when it is known to have `mcp__x402__request` 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 the status line's 0700 directory (item 5) only until that search reads them, ten minutes at most. A WebFetch with a free lookup simply runs. It never redirects twice in a row to the same kind of lookup: when the redirected lookup does not come back fulfilled (it failed, stopped to ask, or was never called) or was a free lookup, whose success nothing verifies,, your assistant's next WebSearch or WebFetch that the router matches to that same kind runs as it is, while other lookups are 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.
79
93
  3. The `x402` MCP server, through `claude mcp add x402 -s user -- tenjin mcp` when the `claude` binary is on PATH, and printed for you to run when it is not. Under `--project` it registers at project scope instead, from the project directory, so the server lands in that project's `.mcp.json` and your `~/.claude.json` is not touched; `tenjin uninstall --project` removes it from the same place. The scope's own file is read first: a registration that already launches `tenjin mcp` is left exactly as it is and nothing is spawned, an `x402` entry launching anything else is removed and re-added, and a registration file this build cannot parse is reported rather than written over.
80
- 4. The three spend keys above, only where your config file is silent, plus `bazaarPay` on, which is the lane the router pays providers through.
94
+ 4. The two automatic spend limits above, only where your config file is silent. 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.
81
95
  5. `statusLine`, running `tenjin status-line` once a second, ONLY when that key is not already set. A status line of your own is never replaced: the install prints the command that runs both, and `--status-line compose` writes it only if you ask. The status line stores nothing new off your machine. It reads local files this CLI already writes under your Tenjin data dir: per session, the tool, the provider endpoint, the bounded redacted parameters of the call, its outcome and its price. No prompt text, no result body. Records expire after ten minutes, live in a 0700 directory under a hash of the session id, and are deleted by the next lookup that passes over them.
82
96
 
97
+ The installer installs no skills. Install/refresh removes only an owned obsolete `tenjin-pay/SKILL.md`, preserving adjacent user files and foreign skills.
98
+
83
99
  Every other key in the settings file is preserved byte for byte, a second run writes the same bytes, and `tenjin uninstall` removes exactly those five things and keeps your wallet, your ledger and your config.
84
100
 
85
101
  To stop the router without removing anything, `tenjin config set router.enabled false` stops it on this machine, and `tenjin config set --project router.enabled false` stops it in this repository. Off means no router hook reads or sends anything and the `request` tool refuses without paying. The project value lives in `<project>/.tenjin/config.json`, which you commit; `--project --local` writes `.tenjin/config.local.json` beside it instead, which is yours alone and belongs in `.gitignore`. Every such file from where the session runs up to the git root applies, and in a git worktree so do the main checkout's; a key a file leaves out is inherited from the files around it. A project file can only turn the router off or narrow what it sends; it cannot enable anything or change a spend setting. From a git worktree, `config set --project` writes at the worktree's own root, never the main checkout's file, though the router reads both.
@@ -114,7 +130,7 @@ Decryption happens in this CLI, in a disposable worker thread, and the key never
114
130
 
115
131
  When your assistant delegates, the task it hands over is routed before the subagent starts, and a paid lookup that fits is appended to that task as one optional line. A native search or fetch the subagent makes later is routed on its own task, read from its own transcript, with your turn still in front of it.
116
132
 
117
- A subagent cannot reach you to approve a spend, so it is only offered lookups your spend policy would pay without asking: within `maxAutoSpend` and the `confirm` threshold, inside the day's `sessionBudget`, and to a host `allowlistCreators` permits. Its payments run through the same ledger and the same caps as the lead's, because the lock is on the file rather than on the process. A subagent is not a second budget.
133
+ A subagent cannot reach you to approve a spend, so it is only offered lookups your spend policy would pay without asking: within `maxAutoSpend`, inside the day's `sessionBudget`, and to a host `allowlistCreators` permits. Its payments run through the same ledger and the same caps as the lead's, because the lock is on the file rather than on the process. A subagent is not a second budget.
118
134
 
119
135
  A subagent is only redirected or offered a lookup when it is known to have `mcp__x402__request`: a custom agent whose definition (`.claude/agents/<name>.md` in the project, `~/.claude/agents/<name>.md`, or an installed plugin's) lists it in `tools:` or has no `tools:` line at all, or one of the built-in `general-purpose`, `Explore` and `Plan` agents, which inherit MCP tools. Any other subagent, such as the built-in `claude-code-guide` (which has WebFetch and WebSearch but no MCP tools) or a type with no definition to read, is left alone: its native calls and delegated tasks are not sent to the router at all, and its calls run free. `tenjin doctor` names your own agents that leave the tool out; add `mcp__x402__request` to their `tools:` to allow paid lookups there. Nothing here edits your agent files.
120
136