tenjin-cli 0.1.0-alpha.2 → 0.1.0-alpha.20

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 (215) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +161 -257
  3. package/dist/{_esm-FEASBWRP.js → _esm-CE7KNONL.js} +9 -10
  4. package/dist/{ccip-NQXCEK2U.js → ccip-7RMRLAGV.js} +4 -4
  5. package/dist/{ccip-XR5NE5QK.js → ccip-NLCSCHKI.js} +5 -5
  6. package/dist/chunk-2E6GVIRP.js +888 -0
  7. package/dist/chunk-2E6GVIRP.js.map +1 -0
  8. package/dist/chunk-2G2WLVHB.js +102 -0
  9. package/dist/chunk-2G2WLVHB.js.map +1 -0
  10. package/dist/chunk-2QYORQBF.js +55 -0
  11. package/dist/chunk-2QYORQBF.js.map +1 -0
  12. package/dist/chunk-3BS55ANY.js +245 -0
  13. package/dist/chunk-3BS55ANY.js.map +1 -0
  14. package/dist/chunk-3KKKB2AQ.js +40 -0
  15. package/dist/chunk-3KKKB2AQ.js.map +1 -0
  16. package/dist/chunk-4AS52HUG.js +165 -0
  17. package/dist/chunk-4AS52HUG.js.map +1 -0
  18. package/dist/chunk-4M5FBWT5.js +368 -0
  19. package/dist/chunk-4M5FBWT5.js.map +1 -0
  20. package/dist/chunk-5FYKPQNX.js +1784 -0
  21. package/dist/chunk-5FYKPQNX.js.map +1 -0
  22. package/dist/{chunk-ZMHYXMO6.js → chunk-5IEP5EGE.js} +3 -3
  23. package/dist/chunk-5KD5HRAJ.js +241 -0
  24. package/dist/chunk-5KD5HRAJ.js.map +1 -0
  25. package/dist/chunk-72UHZRG6.js +231 -0
  26. package/dist/chunk-72UHZRG6.js.map +1 -0
  27. package/dist/chunk-7ACHDNJA.js +155 -0
  28. package/dist/chunk-7ACHDNJA.js.map +1 -0
  29. package/dist/chunk-7QKHZQKW.js +1680 -0
  30. package/dist/chunk-7QKHZQKW.js.map +1 -0
  31. package/dist/chunk-A36LQPHV.js +29 -0
  32. package/dist/chunk-A36LQPHV.js.map +1 -0
  33. package/dist/{chunk-UGX7YPX2.js → chunk-AWQPGIR6.js} +7 -9
  34. package/dist/{chunk-UGX7YPX2.js.map → chunk-AWQPGIR6.js.map} +1 -1
  35. package/dist/{chunk-5CLSD5YN.js → chunk-BPMWXTFX.js} +2 -2
  36. package/dist/{chunk-XJIW7USF.js → chunk-BTX2QE2Y.js} +115 -11
  37. package/dist/chunk-BTX2QE2Y.js.map +1 -0
  38. package/dist/{chunk-OYMYCW7J.js → chunk-CCDOV45D.js} +588 -97
  39. package/dist/chunk-CCDOV45D.js.map +1 -0
  40. package/dist/chunk-CXUYCDPX.js +127 -0
  41. package/dist/chunk-CXUYCDPX.js.map +1 -0
  42. package/dist/{chunk-YALGASEU.js → chunk-EGELTSPU.js} +2 -2
  43. package/dist/chunk-HH3PDYIG.js +194 -0
  44. package/dist/chunk-HH3PDYIG.js.map +1 -0
  45. package/dist/{chunk-CYOF7ROH.js → chunk-HPWO4O6S.js} +3 -3
  46. package/dist/chunk-JLEF5WHM.js +132 -0
  47. package/dist/chunk-JLEF5WHM.js.map +1 -0
  48. package/dist/{chunk-QVX5MWJZ.js → chunk-JRGFKVAZ.js} +2 -2
  49. package/dist/{chunk-HIVZG55D.js → chunk-KG3D7FIF.js} +2 -2
  50. package/dist/chunk-LHHMV4GU.js +27 -0
  51. package/dist/chunk-LHHMV4GU.js.map +1 -0
  52. package/dist/chunk-LI44XLMB.js +242 -0
  53. package/dist/chunk-LI44XLMB.js.map +1 -0
  54. package/dist/chunk-LN2HISWU.js +172 -0
  55. package/dist/chunk-LN2HISWU.js.map +1 -0
  56. package/dist/{chunk-YBMMV4Y4.js → chunk-MEFB5KHA.js} +13 -5
  57. package/dist/chunk-MEFB5KHA.js.map +1 -0
  58. package/dist/{chunk-NCE5NSN6.js → chunk-N35E6CM2.js} +140 -10
  59. package/dist/chunk-N35E6CM2.js.map +1 -0
  60. package/dist/chunk-NSG5TVZQ.js +447 -0
  61. package/dist/chunk-NSG5TVZQ.js.map +1 -0
  62. package/dist/chunk-O2JYBOUO.js +47 -0
  63. package/dist/chunk-O2JYBOUO.js.map +1 -0
  64. package/dist/{chunk-N62ROTMC.js → chunk-P42QX3QF.js} +14 -10
  65. package/dist/chunk-P42QX3QF.js.map +1 -0
  66. package/dist/chunk-PO4HAXAW.js +10528 -0
  67. package/dist/chunk-PO4HAXAW.js.map +1 -0
  68. package/dist/{chunk-ZABPQJ3M.js → chunk-POUWHWID.js} +2 -2
  69. package/dist/{chunk-S3IGX57D.js → chunk-RGVOODF4.js} +7703 -7475
  70. package/dist/chunk-RGVOODF4.js.map +1 -0
  71. package/dist/chunk-RPR2C2JO.js +112 -0
  72. package/dist/chunk-RPR2C2JO.js.map +1 -0
  73. package/dist/chunk-S2NRVRPF.js +171 -0
  74. package/dist/chunk-S2NRVRPF.js.map +1 -0
  75. package/dist/chunk-TGLKKLQG.js +11 -0
  76. package/dist/chunk-TGLKKLQG.js.map +1 -0
  77. package/dist/{chunk-RRN3YTK7.js → chunk-TTNESUPQ.js} +3 -3
  78. package/dist/chunk-TU7XH3JJ.js +97 -0
  79. package/dist/chunk-TU7XH3JJ.js.map +1 -0
  80. package/dist/{chunk-HSDCI7OV.js → chunk-XZKD7DIF.js} +3 -3
  81. package/dist/{chunk-Z6MFJV5Z.js → chunk-YEBNE5NW.js} +851 -500
  82. package/dist/chunk-YEBNE5NW.js.map +1 -0
  83. package/dist/chunk-YREKMJPP.js +131 -0
  84. package/dist/chunk-YREKMJPP.js.map +1 -0
  85. package/dist/{cli-4NNBEQYH.js → cli-XJQYUOHI.js} +355 -217
  86. package/dist/cli-XJQYUOHI.js.map +1 -0
  87. package/dist/config-KMJLFPSI.js +39 -0
  88. package/dist/dist-3LOO6M4U.js +2842 -0
  89. package/dist/dist-3LOO6M4U.js.map +1 -0
  90. package/dist/doctor-KMN55D7U.js +444 -0
  91. package/dist/doctor-KMN55D7U.js.map +1 -0
  92. package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  93. package/dist/fund-LT6ZPGEQ.js +298 -0
  94. package/dist/fund-LT6ZPGEQ.js.map +1 -0
  95. package/dist/hook-command-U5XPEHAJ.js +1052 -0
  96. package/dist/hook-command-U5XPEHAJ.js.map +1 -0
  97. package/dist/index.js +11 -3
  98. package/dist/index.js.map +1 -1
  99. package/dist/install-MMNXJ5LM.js +61 -0
  100. package/dist/install-identity-B7FVIWML.js +27 -0
  101. package/dist/install-wallet-XMVUBCHS.js +107 -0
  102. package/dist/install-wallet-XMVUBCHS.js.map +1 -0
  103. package/dist/mcp-TUPRIPSI.js +10000 -0
  104. package/dist/mcp-TUPRIPSI.js.map +1 -0
  105. package/dist/paths-LRMWNTJP.js +51 -0
  106. package/dist/pay-XAWW3NV3.js +44 -0
  107. package/dist/redact-6W23GGJC.js +15 -0
  108. package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-ZZZT2CAX.js} +3 -3
  109. package/dist/secp256k1-ZZZT2CAX.js.map +1 -0
  110. package/dist/send-HESQYRKM.js +225 -0
  111. package/dist/send-HESQYRKM.js.map +1 -0
  112. package/dist/status-ANZPRZJJ.js +71 -0
  113. package/dist/status-ANZPRZJJ.js.map +1 -0
  114. package/dist/status-line-J3TUWVRQ.js +87 -0
  115. package/dist/status-line-J3TUWVRQ.js.map +1 -0
  116. package/dist/status-line-wiring-HSV7DXO5.js +29 -0
  117. package/dist/status-line-wiring-HSV7DXO5.js.map +1 -0
  118. package/dist/tenjin-daemon.mjs +20547 -0
  119. package/dist/tenjin-shim.mjs +251 -0
  120. package/dist/tenjin-vitest-reporter.mjs +49 -0
  121. package/dist/uninstall-GUU34YKP.js +165 -0
  122. package/dist/uninstall-GUU34YKP.js.map +1 -0
  123. package/dist/update-KO2NZRJ5.js +433 -0
  124. package/dist/update-KO2NZRJ5.js.map +1 -0
  125. package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
  126. package/dist/viemAdapter-By13KInL-X2VY6CY3.js.map +1 -0
  127. package/dist/wallet-3URC5QPK.js +33 -0
  128. package/dist/wallet-3URC5QPK.js.map +1 -0
  129. package/dist/wallet-kdf-worker.mjs +980 -0
  130. package/docs/agent-permissions.md +139 -0
  131. package/docs/safety-model.md +70 -0
  132. package/package.json +14 -9
  133. package/LICENSE +0 -21
  134. package/dist/buy-U35DQ6XM.js +0 -1598
  135. package/dist/buy-U35DQ6XM.js.map +0 -1
  136. package/dist/candidate-RLYCQMF5.js +0 -127
  137. package/dist/candidate-RLYCQMF5.js.map +0 -1
  138. package/dist/chunk-27ONARHV.js +0 -171
  139. package/dist/chunk-27ONARHV.js.map +0 -1
  140. package/dist/chunk-3OV7E5G5.js +0 -18
  141. package/dist/chunk-3OV7E5G5.js.map +0 -1
  142. package/dist/chunk-7KUW4MJD.js +0 -59
  143. package/dist/chunk-7KUW4MJD.js.map +0 -1
  144. package/dist/chunk-7PHSZKQS.js +0 -333
  145. package/dist/chunk-7PHSZKQS.js.map +0 -1
  146. package/dist/chunk-IYLHQMT5.js +0 -211
  147. package/dist/chunk-IYLHQMT5.js.map +0 -1
  148. package/dist/chunk-JPHG2JW3.js +0 -96
  149. package/dist/chunk-JPHG2JW3.js.map +0 -1
  150. package/dist/chunk-MUBUQVC3.js +0 -67
  151. package/dist/chunk-MUBUQVC3.js.map +0 -1
  152. package/dist/chunk-N62ROTMC.js.map +0 -1
  153. package/dist/chunk-NCE5NSN6.js.map +0 -1
  154. package/dist/chunk-OYMYCW7J.js.map +0 -1
  155. package/dist/chunk-QNP7H47L.js +0 -152
  156. package/dist/chunk-QNP7H47L.js.map +0 -1
  157. package/dist/chunk-RY4XKNV3.js +0 -140
  158. package/dist/chunk-RY4XKNV3.js.map +0 -1
  159. package/dist/chunk-S3IGX57D.js.map +0 -1
  160. package/dist/chunk-TFGSOPWR.js +0 -261
  161. package/dist/chunk-TFGSOPWR.js.map +0 -1
  162. package/dist/chunk-TLCMMYLY.js +0 -126
  163. package/dist/chunk-TLCMMYLY.js.map +0 -1
  164. package/dist/chunk-UO22YNY4.js +0 -69
  165. package/dist/chunk-UO22YNY4.js.map +0 -1
  166. package/dist/chunk-UPIEAMGH.js +0 -160
  167. package/dist/chunk-UPIEAMGH.js.map +0 -1
  168. package/dist/chunk-XJIW7USF.js.map +0 -1
  169. package/dist/chunk-YBMMV4Y4.js.map +0 -1
  170. package/dist/chunk-YIYQ2ZNT.js +0 -286
  171. package/dist/chunk-YIYQ2ZNT.js.map +0 -1
  172. package/dist/chunk-YN5SHIXQ.js +0 -126
  173. package/dist/chunk-YN5SHIXQ.js.map +0 -1
  174. package/dist/chunk-Z52RA3NC.js +0 -137
  175. package/dist/chunk-Z52RA3NC.js.map +0 -1
  176. package/dist/chunk-Z6MFJV5Z.js.map +0 -1
  177. package/dist/cli-4NNBEQYH.js.map +0 -1
  178. package/dist/config-2VSXWWHK.js +0 -21
  179. package/dist/doctor-JJPNIBYH.js +0 -20
  180. package/dist/inspect-JGYJWFDP.js +0 -96
  181. package/dist/inspect-JGYJWFDP.js.map +0 -1
  182. package/dist/install-ZQRMSRGW.js +0 -378
  183. package/dist/install-ZQRMSRGW.js.map +0 -1
  184. package/dist/lookup-WYVTOMVY.js +0 -113
  185. package/dist/lookup-WYVTOMVY.js.map +0 -1
  186. package/dist/outcome-HKKT6QIA.js +0 -66
  187. package/dist/outcome-HKKT6QIA.js.map +0 -1
  188. package/dist/publish-D76B3MBK.js +0 -1480
  189. package/dist/publish-D76B3MBK.js.map +0 -1
  190. package/dist/usdc-JIAJW4SV.js +0 -22
  191. package/dist/wallet-6QKS6UHW.js +0 -179
  192. package/dist/wallet-6QKS6UHW.js.map +0 -1
  193. package/dist/wallet-PA54CRBL.js +0 -30
  194. package/skills/tenjin/SKILL.md +0 -199
  195. package/skills/tenjin-publish/SKILL.md +0 -96
  196. package/skills/tenjin-search/SKILL.md +0 -122
  197. /package/dist/{_esm-FEASBWRP.js.map → _esm-CE7KNONL.js.map} +0 -0
  198. /package/dist/{ccip-NQXCEK2U.js.map → ccip-7RMRLAGV.js.map} +0 -0
  199. /package/dist/{ccip-XR5NE5QK.js.map → ccip-NLCSCHKI.js.map} +0 -0
  200. /package/dist/{chunk-ZMHYXMO6.js.map → chunk-5IEP5EGE.js.map} +0 -0
  201. /package/dist/{chunk-5CLSD5YN.js.map → chunk-BPMWXTFX.js.map} +0 -0
  202. /package/dist/{chunk-YALGASEU.js.map → chunk-EGELTSPU.js.map} +0 -0
  203. /package/dist/{chunk-CYOF7ROH.js.map → chunk-HPWO4O6S.js.map} +0 -0
  204. /package/dist/{chunk-QVX5MWJZ.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  205. /package/dist/{chunk-HIVZG55D.js.map → chunk-KG3D7FIF.js.map} +0 -0
  206. /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POUWHWID.js.map} +0 -0
  207. /package/dist/{chunk-RRN3YTK7.js.map → chunk-TTNESUPQ.js.map} +0 -0
  208. /package/dist/{chunk-HSDCI7OV.js.map → chunk-XZKD7DIF.js.map} +0 -0
  209. /package/dist/{config-2VSXWWHK.js.map → config-KMJLFPSI.js.map} +0 -0
  210. /package/dist/{doctor-JJPNIBYH.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
  211. /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → install-MMNXJ5LM.js.map} +0 -0
  212. /package/dist/{secp256k1-N3ZHU7LB.js.map → install-identity-B7FVIWML.js.map} +0 -0
  213. /package/dist/{usdc-JIAJW4SV.js.map → paths-LRMWNTJP.js.map} +0 -0
  214. /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → pay-XAWW3NV3.js.map} +0 -0
  215. /package/dist/{wallet-PA54CRBL.js.map → redact-6W23GGJC.js.map} +0 -0
@@ -0,0 +1,444 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ agentsWithoutRequestTool
4
+ } from "./chunk-S2NRVRPF.js";
5
+ import {
6
+ ROUTER_PATH
7
+ } from "./chunk-4AS52HUG.js";
8
+ import {
9
+ describeWallet,
10
+ resolveWalletProvider,
11
+ walletFileExists
12
+ } from "./chunk-YEBNE5NW.js";
13
+ import "./chunk-YREKMJPP.js";
14
+ import "./chunk-7ACHDNJA.js";
15
+ import "./chunk-N35E6CM2.js";
16
+ import "./chunk-JRGFKVAZ.js";
17
+ import "./chunk-EGELTSPU.js";
18
+ import "./chunk-KG3D7FIF.js";
19
+ import "./chunk-RBJPAZFI.js";
20
+ import "./chunk-BPMWXTFX.js";
21
+ import {
22
+ ALLOW_RULE,
23
+ mcpAddCommand,
24
+ mcpScope,
25
+ readMcpEntry,
26
+ routerHookPlan,
27
+ routerSettingsPath
28
+ } from "./chunk-NSG5TVZQ.js";
29
+ import {
30
+ MCP_SERVER_NAME,
31
+ REQUEST_TOOL
32
+ } from "./chunk-TGLKKLQG.js";
33
+ import "./chunk-72UHZRG6.js";
34
+ import {
35
+ httpRequest
36
+ } from "./chunk-3BS55ANY.js";
37
+ import {
38
+ onPath
39
+ } from "./chunk-2E6GVIRP.js";
40
+ import "./chunk-A36LQPHV.js";
41
+ import "./chunk-2QYORQBF.js";
42
+ import "./chunk-MEFB5KHA.js";
43
+ import {
44
+ routerSettings
45
+ } from "./chunk-CXUYCDPX.js";
46
+ import "./chunk-2I4QTOLB.js";
47
+ import {
48
+ resolveContextSettings
49
+ } from "./chunk-5KD5HRAJ.js";
50
+ import {
51
+ toMoney
52
+ } from "./chunk-O2JYBOUO.js";
53
+ import {
54
+ PRODUCTION_ORIGIN
55
+ } from "./chunk-CCDOV45D.js";
56
+ import {
57
+ STATUS_LINE_COMMAND,
58
+ inspectStatusLine
59
+ } from "./chunk-LN2HISWU.js";
60
+ import {
61
+ inspectHooksFile,
62
+ ownsHookEntry,
63
+ pruneOurHandlers
64
+ } from "./chunk-5FYKPQNX.js";
65
+ import "./chunk-P42QX3QF.js";
66
+ import {
67
+ CliError
68
+ } from "./chunk-JLEF5WHM.js";
69
+ import "./chunk-TU7XH3JJ.js";
70
+ import "./chunk-ZXTAQYNA.js";
71
+
72
+ // src/router/doctor.ts
73
+ import { execFile } from "node:child_process";
74
+ import { homedir } from "node:os";
75
+ import { promisify } from "node:util";
76
+ var exec = promisify(execFile);
77
+ var NODE_FLOOR = 24;
78
+ async function runRouterDoctor(ctx, deps = {}) {
79
+ const env = deps.env ?? process.env;
80
+ const router = await routerSettings(
81
+ { cwd: deps.cwd ?? process.cwd(), dataDir: ctx.dataDir },
82
+ deps.homeDir !== void 0 ? { homeDir: deps.homeDir } : {}
83
+ ).catch((err) => err instanceof Error ? err : new Error(String(err)));
84
+ const settings = await resolveContextSettings(ctx);
85
+ const settingsPath = routerSettingsPath({
86
+ ...deps.project === true ? { project: true } : {},
87
+ ...deps.homeDir !== void 0 ? { homeDir: deps.homeDir } : {},
88
+ ...deps.cwd !== void 0 ? { cwd: deps.cwd } : {}
89
+ });
90
+ const checks = [nodeCheck(deps.nodeVersion ?? process.version)];
91
+ checks.push(await hooksCheck(settingsPath, ctx.dataDir, router));
92
+ checks.push(await statusLineCheck(settingsPath));
93
+ checks.push(
94
+ await mcpCheck(
95
+ deps,
96
+ env,
97
+ deps.project === true,
98
+ deps.cwd ?? process.cwd(),
99
+ deps.homeDir ?? homedir()
100
+ )
101
+ );
102
+ checks.push(spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic));
103
+ checks.push(...await walletCheck(ctx));
104
+ checks.push(await routerCheck(settings.baseUrl, ctx.flags.timeout, deps.fetchImpl));
105
+ const agents = await subagentsCheck(deps.cwd ?? process.cwd(), deps.homeDir ?? homedir());
106
+ if (agents !== null) checks.push(agents);
107
+ const failure = checks.find((c) => c.status === "fail" && c.required);
108
+ const data = { checks, dataDir: ctx.dataDir, baseUrl: settings.baseUrl, settingsPath };
109
+ if (failure !== void 0) {
110
+ throw new CliError("REFUSED", failure.detail, {
111
+ ...failure.fix !== void 0 ? { fix: failure.fix } : {},
112
+ details: data
113
+ });
114
+ }
115
+ const bad = checks.filter((c) => c.status !== "ok").length;
116
+ return {
117
+ data,
118
+ humanLines: [
119
+ ...checks.map(
120
+ (c) => `${c.status === "ok" ? "ok " : c.status === "warn" ? "warn" : "fail"} ${c.name}: ${c.detail}`
121
+ ),
122
+ bad === 0 ? `${checks.length} checks, all pass.` : `${checks.length} checks, ${bad} to look at.`
123
+ ]
124
+ };
125
+ }
126
+ async function subagentsCheck(cwd, homeDir) {
127
+ const excluded = await agentsWithoutRequestTool({ cwd, homeDir });
128
+ if (excluded.length === 0) return null;
129
+ return {
130
+ name: "subagents",
131
+ status: "ok",
132
+ required: false,
133
+ detail: `${excluded.join(", ")} ${excluded.length === 1 ? "is" : "are"} offered no paid lookups: add ${REQUEST_TOOL} to tools: to allow paid lookups there`
134
+ };
135
+ }
136
+ function nodeCheck(version) {
137
+ const major = Number(/^v(\d+)/.exec(version)?.[1] ?? "0");
138
+ return major >= NODE_FLOOR ? { name: "node", status: "ok", required: true, detail: version } : {
139
+ name: "node",
140
+ status: "fail",
141
+ required: true,
142
+ detail: `${version} is below the Node ${NODE_FLOOR} floor.`,
143
+ fix: `Install Node ${NODE_FLOOR} or newer, then re-run \`tenjin doctor\`.`
144
+ };
145
+ }
146
+ async function statusLineCheck(path) {
147
+ const found = await inspectStatusLine(path);
148
+ const name = "status line";
149
+ if (found.warning !== void 0) {
150
+ return { name, status: "warn", required: false, detail: found.warning };
151
+ }
152
+ switch (found.state) {
153
+ case "ours":
154
+ return { name, status: "ok", required: false, detail: `\`${STATUS_LINE_COMMAND}\`` };
155
+ case "composed":
156
+ return {
157
+ name,
158
+ status: "ok",
159
+ required: false,
160
+ detail: "yours, with the x402 footer appended"
161
+ };
162
+ case "foreign":
163
+ return {
164
+ name,
165
+ status: "warn",
166
+ required: false,
167
+ detail: "yours is registered and was left alone, so there is no live x402 footer",
168
+ fix: "Run `tenjin install --status-line compose` to show both."
169
+ };
170
+ default:
171
+ return {
172
+ name,
173
+ status: "warn",
174
+ required: false,
175
+ detail: "not registered, so lookups run without the live footer",
176
+ fix: "Run `tenjin install` to register it."
177
+ };
178
+ }
179
+ }
180
+ async function hooksCheck(path, dataDir, router) {
181
+ const found = await inspectHooksFile(path);
182
+ if ("refusal" in found) {
183
+ return {
184
+ name: "hooks",
185
+ status: "fail",
186
+ required: true,
187
+ detail: found.refusal.message,
188
+ fix: "Fix the reported file, then run `tenjin install`."
189
+ };
190
+ }
191
+ const events = Object.entries(found.hooks).filter(([, list]) => list.some((entry) => ownsHookEntry(entry, dataDir))).map(([event]) => event);
192
+ const allow = allowRules(found.settings);
193
+ if (events.length === 0) {
194
+ return {
195
+ name: "hooks",
196
+ status: "fail",
197
+ required: true,
198
+ detail: `no Tenjin hook entries in ${path}`,
199
+ fix: "Run `tenjin install`, then restart Claude Code."
200
+ };
201
+ }
202
+ if (router instanceof Error) {
203
+ return {
204
+ name: "hooks",
205
+ status: "warn",
206
+ required: false,
207
+ detail: `${events.join(" and ")} registered, but the router is off here: ${router.message}`,
208
+ fix: "Fix or delete that file."
209
+ };
210
+ }
211
+ if (!router.enabled.value) {
212
+ const file = router.enabled.path ?? "the config";
213
+ return {
214
+ name: "hooks",
215
+ status: "warn",
216
+ required: false,
217
+ detail: `${events.join(" and ")} registered, but router.enabled is false in ${file}, so nothing is routed from this directory`,
218
+ fix: router.enabled.source === "file" ? "Run `tenjin config set router.enabled true` to route again." : `Remove router.enabled from ${file} to route here again.`
219
+ };
220
+ }
221
+ if (!allow.includes(ALLOW_RULE)) {
222
+ return {
223
+ name: "hooks",
224
+ status: "warn",
225
+ required: false,
226
+ detail: `${events.join(" and ")} registered, but ${ALLOW_RULE} is not allowed, so every lookup asks`,
227
+ fix: "Run `tenjin install` to write the permission rule."
228
+ };
229
+ }
230
+ const drift = planDrift(found.hooks, dataDir);
231
+ if (drift.missing.length > 0 || drift.stale.length > 0) {
232
+ const parts = [
233
+ ...drift.missing.length > 0 ? [`missing ${drift.missing.join(", ")}`] : [],
234
+ ...drift.stale.length > 0 ? [`stale ${drift.stale.join(", ")}`] : []
235
+ ];
236
+ return {
237
+ name: "hooks",
238
+ status: "warn",
239
+ required: false,
240
+ detail: `${events.join(" and ")} registered, but not as this build writes them: ${parts.join("; ")}`,
241
+ fix: "Run `tenjin install --refresh`."
242
+ };
243
+ }
244
+ return {
245
+ name: "hooks",
246
+ status: "ok",
247
+ required: true,
248
+ detail: `${events.join(" and ")} registered, ${ALLOW_RULE} allowed`
249
+ };
250
+ }
251
+ function entryLabel(event, matcher, command) {
252
+ return `${event}${typeof matcher === "string" ? ` ${matcher}` : ""} \u2192 ${command}`;
253
+ }
254
+ function planDrift(hooks, dataDir) {
255
+ const planned = routerHookPlan().map(
256
+ (entry) => entryLabel(entry.event, entry.matcher, entry.hooks[0].command)
257
+ );
258
+ const present = [];
259
+ for (const [event, list] of Object.entries(hooks)) {
260
+ for (const entry of list) {
261
+ if (!ownsHookEntry(entry, dataDir)) continue;
262
+ const { matcher, hooks: handlers } = entry;
263
+ const kept = pruneOurHandlers(entry, dataDir);
264
+ for (const handler of handlers.filter((h) => kept === null || !kept.hooks.includes(h))) {
265
+ const command = handler.command;
266
+ const url = handler.url;
267
+ const label = typeof command === "string" ? command : typeof url === "string" ? url : "?";
268
+ present.push(entryLabel(event, matcher, label));
269
+ }
270
+ }
271
+ }
272
+ return {
273
+ missing: planned.filter((label) => !present.includes(label)),
274
+ stale: present.filter((label) => !planned.includes(label))
275
+ };
276
+ }
277
+ function allowRules(settings) {
278
+ const permissions = settings.permissions;
279
+ if (permissions === null || typeof permissions !== "object" || Array.isArray(permissions)) {
280
+ return [];
281
+ }
282
+ const allow = permissions.allow;
283
+ return Array.isArray(allow) ? allow.filter((r) => typeof r === "string") : [];
284
+ }
285
+ async function mcpCheck(deps, env, project, cwd, home) {
286
+ const scope = mcpScope(project);
287
+ const add = mcpAddCommand(project);
288
+ const where = scope === "project" ? "this project's .mcp.json" : "~/.claude.json";
289
+ const { found, state } = await (deps.readMcpEntry ?? readMcpEntry)(scope, cwd, home);
290
+ if (state === "ok") {
291
+ return {
292
+ name: "mcp",
293
+ status: "ok",
294
+ required: true,
295
+ detail: `${MCP_SERVER_NAME} registered (${scope} scope), running \`tenjin mcp\``
296
+ };
297
+ }
298
+ if (state === "wrong-command") {
299
+ return {
300
+ name: "mcp",
301
+ status: "fail",
302
+ required: true,
303
+ detail: `${MCP_SERVER_NAME} registered but not \`tenjin mcp\`: the entry in ${where} launches something else, so the request tool is not there`,
304
+ fix: `Remove it and re-run \`tenjin install\`${project ? " --project" : ""}, or: ${add}`
305
+ };
306
+ }
307
+ if (state === "unreadable") {
308
+ return {
309
+ name: "mcp",
310
+ status: "fail",
311
+ required: true,
312
+ detail: `${where} could not be read, so whether ${MCP_SERVER_NAME} is registered is unknown`,
313
+ fix: `Fix the JSON in ${where}, then re-run \`tenjin install\`${project ? " --project" : ""}.`
314
+ };
315
+ }
316
+ if (scope === "user") {
317
+ const which = deps.which ?? ((bin) => onPath(bin, env));
318
+ if (which("claude")) {
319
+ const seen = await (deps.readMcp ?? claudeHasServer)({ scope, cwd }).catch(() => false);
320
+ if (seen) {
321
+ return {
322
+ name: "mcp",
323
+ status: "warn",
324
+ required: false,
325
+ detail: `${MCP_SERVER_NAME} is registered somewhere this check cannot read, so what it launches was not verified`,
326
+ fix: `Re-run \`tenjin install\` to write a registration this build can check, or: ${add}`
327
+ };
328
+ }
329
+ }
330
+ }
331
+ return {
332
+ name: "mcp",
333
+ status: "fail",
334
+ required: true,
335
+ detail: found ? `${MCP_SERVER_NAME} is not in ${where}, so there is no request tool` : `${where} does not exist, so ${MCP_SERVER_NAME} is not registered`,
336
+ fix: `Run \`tenjin install\`${project ? " --project" : ""}, or: ${add}`
337
+ };
338
+ }
339
+ async function claudeHasServer(opts) {
340
+ const { stdout } = await exec("claude", ["mcp", "get", MCP_SERVER_NAME], {
341
+ timeout: 15e3,
342
+ cwd: opts.cwd
343
+ });
344
+ return stdout.includes(MCP_SERVER_NAME) && !/no mcp server/i.test(stdout);
345
+ }
346
+ function spendCheck(maxAutoSpendAtomic, sessionBudgetAtomic) {
347
+ if (sessionBudgetAtomic === 0n) {
348
+ return {
349
+ name: "spend",
350
+ status: "fail",
351
+ required: true,
352
+ detail: "The daily limit is 0, so positive payments are refused even with --yes.",
353
+ fix: "Choose a daily limit with `tenjin config set sessionBudget <usd|none>`."
354
+ };
355
+ }
356
+ if (maxAutoSpendAtomic === 0n) {
357
+ return {
358
+ name: "spend",
359
+ status: "fail",
360
+ required: true,
361
+ detail: "maxAutoSpend is 0, so every lookup needs approval and none can pay",
362
+ fix: "Run `tenjin install`, or `tenjin config set maxAutoSpend 0.10`."
363
+ };
364
+ }
365
+ const budget = sessionBudgetAtomic === null ? "no daily ceiling" : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;
366
+ return {
367
+ name: "spend",
368
+ status: sessionBudgetAtomic === null ? "warn" : "ok",
369
+ required: false,
370
+ detail: `automatic approval up to ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,
371
+ ...sessionBudgetAtomic === null ? { fix: "Set one with `tenjin config set sessionBudget 1.00`." } : {}
372
+ };
373
+ }
374
+ async function walletCheck(ctx) {
375
+ if (!await walletFileExists(ctx.dataDir)) {
376
+ return [
377
+ {
378
+ name: "wallet",
379
+ status: "fail",
380
+ required: true,
381
+ detail: "no wallet on this machine, so nothing can pay",
382
+ fix: "Run `tenjin wallet create`, then `tenjin wallet fund`."
383
+ }
384
+ ];
385
+ }
386
+ try {
387
+ const described = await describeWallet(resolveWalletProvider(ctx));
388
+ return [{ name: "wallet", status: "ok", required: true, detail: described.address }];
389
+ } catch (err) {
390
+ return [
391
+ {
392
+ name: "wallet",
393
+ status: "fail",
394
+ required: true,
395
+ detail: err instanceof CliError ? err.message : String(err),
396
+ ...err instanceof CliError && err.fix !== void 0 ? { fix: err.fix } : {}
397
+ }
398
+ ];
399
+ }
400
+ }
401
+ async function routerCheck(baseUrl, timeoutMs, fetchImpl) {
402
+ const url = new URL(ROUTER_PATH, baseUrl).toString();
403
+ const probe = await httpRequest(url, {
404
+ method: "POST",
405
+ timeoutMs,
406
+ blockRedirects: true,
407
+ jsonBody: {},
408
+ ...fetchImpl !== void 0 ? { fetchImpl } : {}
409
+ });
410
+ const fail = (detail, fix) => ({
411
+ name: "router",
412
+ status: "fail",
413
+ required: true,
414
+ detail,
415
+ fix
416
+ });
417
+ const checkBase = "Check that the configured base URL names the Tenjin router (`tenjin config get baseUrl`), then try again later.";
418
+ if (!probe.ok) {
419
+ return fail(`the router at ${url} is unreachable or erroring (${probe.message})`, checkBase);
420
+ }
421
+ if (probe.status === 200 || probe.status === 400 || probe.status === 429) {
422
+ return { name: "router", status: "ok", required: true, detail: `${url} is live` };
423
+ }
424
+ if (probe.status === 404) {
425
+ return fail(`the router is not enabled at ${url}`, checkBase);
426
+ }
427
+ if (probe.status === 401 || probe.status === 403) {
428
+ return fail(
429
+ `${url} is not a Tenjin router (it asked for credentials)`,
430
+ `Set the router URL with \`tenjin config set baseUrl ${PRODUCTION_ORIGIN}\`.`
431
+ );
432
+ }
433
+ if (probe.status >= 500) {
434
+ return fail(`the router at ${url} is unreachable or erroring (${probe.status})`, checkBase);
435
+ }
436
+ return fail(
437
+ `${url} answered ${probe.status}, which a Tenjin router does not`,
438
+ "Check that the configured base URL names a Tenjin deployment (`tenjin config get baseUrl`)."
439
+ );
440
+ }
441
+ export {
442
+ runRouterDoctor
443
+ };
444
+ //# sourceMappingURL=doctor-KMN55D7U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/doctor.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { homedir } from 'node:os';\nimport { promisify } from 'node:util';\nimport { CliError } from '../lib/errors';\nimport { inspectHooksFile, ownsHookEntry, pruneOurHandlers } from '../lib/harness-hooks';\nimport { httpRequest } from '../lib/http';\nimport { toMoney } from '../lib/money';\nimport { PRODUCTION_ORIGIN } from '../lib/production-origin';\nimport { resolveContextSettings } from '../lib/settings';\nimport { onPath } from '../lib/skill-wiring';\nimport { describeWallet, resolveWalletProvider } from '../lib/wallet';\nimport { walletFileExists } from '../lib/wallet/store';\nimport type { CommandContext, CommandResult } from '../context';\nimport { agentsWithoutRequestTool } from './agent-tools';\nimport { ROUTER_PATH } from './decision';\nimport {\n ALLOW_RULE,\n MCP_SERVER_NAME,\n mcpAddCommand,\n mcpScope,\n readMcpEntry,\n routerHookPlan,\n routerSettingsPath,\n type McpEntryState,\n} from './install';\nimport { routerSettings, type RouterSettings } from './settings';\nimport { REQUEST_TOOL } from './names';\nimport { inspectStatusLine, STATUS_LINE_COMMAND } from './status-line-wiring';\n\n/**\n * `tenjin doctor` for the router product: the six things that decide whether a\n * lookup can happen at all.\n *\n * THE SHELF'S DOCTOR IS NOT THIS ONE. It checks a loop daemon, a skills tree\n * and a marketplace contract, and prescribes `tenjin daemon start`, a command\n * this release does not register: on a router install every one of those lines\n * was a failure about a product that is not installed. That doctor stays with\n * the product it belongs to (`src/commands/doctor.ts`, unregistered), and this\n * one reports the router's own wiring.\n */\n\nconst exec = promisify(execFile);\n\nexport interface RouterCheck {\n name: string;\n status: 'ok' | 'warn' | 'fail';\n required: boolean;\n detail: string;\n fix?: string;\n}\n\nexport interface RouterDoctorDeps {\n homeDir?: string;\n cwd?: string;\n /** Look at this project's `.claude/settings.json`, as `--project` installed it. */\n project?: boolean;\n env?: NodeJS.ProcessEnv;\n which?: (bin: string) => boolean;\n fetchImpl?: typeof fetch;\n /** The harness's own read-back, for a user-scope registration this build\n * cannot find on disk; tests inject it so nothing is spawned. */\n readMcp?: (opts: { scope: 'user' | 'project'; cwd: string }) => Promise<boolean>;\n /** Reads the registration entry from the file the scope writes. */\n readMcpEntry?: (\n scope: 'user' | 'project',\n cwd: string,\n home: string,\n ) => Promise<{ found: boolean; state: McpEntryState }>;\n /** Node's own version, for the floor check. */\n nodeVersion?: string;\n}\n\nconst NODE_FLOOR = 24;\n\nexport async function runRouterDoctor(\n ctx: CommandContext,\n deps: RouterDoctorDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n // From the directory doctor runs in, which is the one a session there would use.\n const router = await routerSettings(\n { cwd: deps.cwd ?? process.cwd(), dataDir: ctx.dataDir },\n deps.homeDir !== undefined ? { homeDir: deps.homeDir } : {},\n ).catch((err: unknown) => (err instanceof Error ? err : new Error(String(err))));\n const settings = await resolveContextSettings(ctx);\n // The SAME resolution `install` and `uninstall` use. Reading the home file\n // only made a correctly wired `--project` install, which the README tells\n // people to do, fail a required check and exit 3.\n const settingsPath = routerSettingsPath({\n ...(deps.project === true ? { project: true } : {}),\n ...(deps.homeDir !== undefined ? { homeDir: deps.homeDir } : {}),\n ...(deps.cwd !== undefined ? { cwd: deps.cwd } : {}),\n });\n const checks: RouterCheck[] = [nodeCheck(deps.nodeVersion ?? process.version)];\n checks.push(await hooksCheck(settingsPath, ctx.dataDir, router));\n checks.push(await statusLineCheck(settingsPath));\n checks.push(\n await mcpCheck(\n deps,\n env,\n deps.project === true,\n deps.cwd ?? process.cwd(),\n deps.homeDir ?? homedir(),\n ),\n );\n checks.push(spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic));\n checks.push(...(await walletCheck(ctx)));\n checks.push(await routerCheck(settings.baseUrl, ctx.flags.timeout, deps.fetchImpl));\n const agents = await subagentsCheck(deps.cwd ?? process.cwd(), deps.homeDir ?? homedir());\n if (agents !== null) checks.push(agents);\n\n const failure = checks.find((c) => c.status === 'fail' && c.required);\n const data = { checks, dataDir: ctx.dataDir, baseUrl: settings.baseUrl, settingsPath };\n if (failure !== undefined) {\n // REFUSED, the exit-3 class: a machine this command found unready is\n // understood and refused, not a runtime failure of the command itself.\n throw new CliError('REFUSED', failure.detail, {\n ...(failure.fix !== undefined ? { fix: failure.fix } : {}),\n details: data,\n });\n }\n const bad = checks.filter((c) => c.status !== 'ok').length;\n return {\n data,\n humanLines: [\n ...checks.map(\n (c) =>\n `${c.status === 'ok' ? 'ok ' : c.status === 'warn' ? 'warn' : 'fail'} ${c.name}: ${c.detail}`,\n ),\n bad === 0\n ? `${checks.length} checks, all pass.`\n : `${checks.length} checks, ${bad} to look at.`,\n ],\n };\n}\n\n/**\n * INFORMATIONAL, NEVER A FAILURE. A custom agent whose `tools:` leave the\n * request tool out is a choice its author may have meant, so this names those\n * agents and the one line that would change it, and counts as passing. It is\n * absent when there is nothing to name. The files are only read.\n */\nasync function subagentsCheck(cwd: string, homeDir: string): Promise<RouterCheck | null> {\n const excluded = await agentsWithoutRequestTool({ cwd, homeDir });\n if (excluded.length === 0) return null;\n return {\n name: 'subagents',\n status: 'ok',\n required: false,\n detail: `${excluded.join(', ')} ${excluded.length === 1 ? 'is' : 'are'} offered no paid lookups: add ${REQUEST_TOOL} to tools: to allow paid lookups there`,\n };\n}\n\nfunction nodeCheck(version: string): RouterCheck {\n const major = Number(/^v(\\d+)/.exec(version)?.[1] ?? '0');\n return major >= NODE_FLOOR\n ? { name: 'node', status: 'ok', required: true, detail: version }\n : {\n name: 'node',\n status: 'fail',\n required: true,\n detail: `${version} is below the Node ${NODE_FLOOR} floor.`,\n fix: `Install Node ${NODE_FLOOR} or newer, then re-run \\`tenjin doctor\\`.`,\n };\n}\n\n/**\n * The live footer, which is the one check here that is never required: a lookup\n * runs exactly the same without it. It reports what is in the file, including a\n * status line of the user's that this CLI deliberately did not touch.\n */\nasync function statusLineCheck(path: string): Promise<RouterCheck> {\n const found = await inspectStatusLine(path);\n const name = 'status line';\n if (found.warning !== undefined) {\n return { name, status: 'warn', required: false, detail: found.warning };\n }\n switch (found.state) {\n case 'ours':\n return { name, status: 'ok', required: false, detail: `\\`${STATUS_LINE_COMMAND}\\`` };\n case 'composed':\n return {\n name,\n status: 'ok',\n required: false,\n detail: 'yours, with the x402 footer appended',\n };\n case 'foreign':\n return {\n name,\n status: 'warn',\n required: false,\n detail: 'yours is registered and was left alone, so there is no live x402 footer',\n fix: 'Run `tenjin install --status-line compose` to show both.',\n };\n default:\n return {\n name,\n status: 'warn',\n required: false,\n detail: 'not registered, so lookups run without the live footer',\n fix: 'Run `tenjin install` to register it.',\n };\n }\n}\n\nasync function hooksCheck(\n path: string,\n dataDir: string,\n router: RouterSettings | Error,\n): Promise<RouterCheck> {\n const found = await inspectHooksFile(path);\n if ('refusal' in found) {\n return {\n name: 'hooks',\n status: 'fail',\n required: true,\n detail: found.refusal.message,\n fix: 'Fix the reported file, then run `tenjin install`.',\n };\n }\n const events = Object.entries(found.hooks)\n .filter(([, list]) => list.some((entry) => ownsHookEntry(entry, dataDir)))\n .map(([event]) => event);\n const allow = allowRules(found.settings);\n if (events.length === 0) {\n return {\n name: 'hooks',\n status: 'fail',\n required: true,\n detail: `no Tenjin hook entries in ${path}`,\n fix: 'Run `tenjin install`, then restart Claude Code.',\n };\n }\n // WIRED BUT SWITCHED OFF is a choice, not a fault, so it warns and names the\n // file that made it: the entries are there and every one of them is silent.\n if (router instanceof Error) {\n return {\n name: 'hooks',\n status: 'warn',\n required: false,\n detail: `${events.join(' and ')} registered, but the router is off here: ${router.message}`,\n fix: 'Fix or delete that file.',\n };\n }\n if (!router.enabled.value) {\n const file = router.enabled.path ?? 'the config';\n return {\n name: 'hooks',\n status: 'warn',\n required: false,\n detail: `${events.join(' and ')} registered, but router.enabled is false in ${file}, so nothing is routed from this directory`,\n fix:\n router.enabled.source === 'file'\n ? 'Run `tenjin config set router.enabled true` to route again.'\n : `Remove router.enabled from ${file} to route here again.`,\n };\n }\n if (!allow.includes(ALLOW_RULE)) {\n return {\n name: 'hooks',\n status: 'warn',\n required: false,\n detail: `${events.join(' and ')} registered, but ${ALLOW_RULE} is not allowed, so every lookup asks`,\n fix: 'Run `tenjin install` to write the permission rule.',\n };\n }\n // AN INSTALL FROM AN OLDER BUILD STILL WORKS, so this is a warning with its\n // one-command remedy, not a failure: its `tenjin hook native` entry is a\n // no-op now, and the entries it lacks are offers it does not make.\n const drift = planDrift(found.hooks, dataDir);\n if (drift.missing.length > 0 || drift.stale.length > 0) {\n const parts = [\n ...(drift.missing.length > 0 ? [`missing ${drift.missing.join(', ')}`] : []),\n ...(drift.stale.length > 0 ? [`stale ${drift.stale.join(', ')}`] : []),\n ];\n return {\n name: 'hooks',\n status: 'warn',\n required: false,\n detail: `${events.join(' and ')} registered, but not as this build writes them: ${parts.join('; ')}`,\n fix: 'Run `tenjin install --refresh`.',\n };\n }\n return {\n name: 'hooks',\n status: 'ok',\n required: true,\n detail: `${events.join(' and ')} registered, ${ALLOW_RULE} allowed`,\n };\n}\n\n/** One entry as `event matcher → command`, the way doctor names it. */\nfunction entryLabel(event: string, matcher: unknown, command: string): string {\n return `${event}${typeof matcher === 'string' ? ` ${matcher}` : ''} → ${command}`;\n}\n\n/**\n * Which of `routerHookPlan()`'s entries this file lacks, and which handlers of\n * ours it carries that the plan no longer writes (an older install's\n * `tenjin hook native`, or a shelf-era entry). Compared by event, matcher and\n * command, so a timeout the writer would raise is not called drift here.\n */\nfunction planDrift(\n hooks: Record<string, unknown[]>,\n dataDir: string,\n): { missing: string[]; stale: string[] } {\n const planned = (routerHookPlan() as PlannedEntry[]).map((entry) =>\n entryLabel(entry.event, entry.matcher, entry.hooks[0]!.command),\n );\n const present: string[] = [];\n for (const [event, list] of Object.entries(hooks)) {\n for (const entry of list) {\n if (!ownsHookEntry(entry, dataDir)) continue;\n const { matcher, hooks: handlers } = entry as { matcher?: unknown; hooks: unknown[] };\n // Ours only: a handler someone hand-merged beside ours is not drift.\n const kept = pruneOurHandlers(entry, dataDir) as { hooks: unknown[] } | null;\n for (const handler of handlers.filter((h) => kept === null || !kept.hooks.includes(h))) {\n const command = (handler as { command?: unknown }).command;\n const url = (handler as { url?: unknown }).url;\n const label = typeof command === 'string' ? command : typeof url === 'string' ? url : '?';\n present.push(entryLabel(event, matcher, label));\n }\n }\n }\n return {\n missing: planned.filter((label) => !present.includes(label)),\n stale: present.filter((label) => !planned.includes(label)),\n };\n}\n\ninterface PlannedEntry {\n event: string;\n matcher?: string;\n hooks: { command: string }[];\n}\n\nfunction allowRules(settings: Record<string, unknown>): string[] {\n const permissions = settings.permissions;\n if (permissions === null || typeof permissions !== 'object' || Array.isArray(permissions)) {\n return [];\n }\n const allow = (permissions as { allow?: unknown }).allow;\n return Array.isArray(allow) ? allow.filter((r): r is string => typeof r === 'string') : [];\n}\n\nasync function mcpCheck(\n deps: RouterDoctorDeps,\n env: NodeJS.ProcessEnv,\n project: boolean,\n cwd: string,\n home: string,\n): Promise<RouterCheck> {\n const scope = mcpScope(project);\n const add = mcpAddCommand(project);\n const where = scope === 'project' ? \"this project's .mcp.json\" : '~/.claude.json';\n const { found, state } = await (deps.readMcpEntry ?? readMcpEntry)(scope, cwd, home);\n\n if (state === 'ok') {\n return {\n name: 'mcp',\n status: 'ok',\n required: true,\n detail: `${MCP_SERVER_NAME} registered (${scope} scope), running \\`tenjin mcp\\``,\n };\n }\n if (state === 'wrong-command') {\n return {\n name: 'mcp',\n status: 'fail',\n required: true,\n detail: `${MCP_SERVER_NAME} registered but not \\`tenjin mcp\\`: the entry in ${where} launches something else, so the request tool is not there`,\n fix: `Remove it and re-run \\`tenjin install\\`${project ? ' --project' : ''}, or: ${add}`,\n };\n }\n // A file that is there and unreadable is not an absence: \"run install\" would\n // be the wrong instruction, since `install` refuses to write over it too.\n if (state === 'unreadable') {\n return {\n name: 'mcp',\n status: 'fail',\n required: true,\n detail: `${where} could not be read, so whether ${MCP_SERVER_NAME} is registered is unknown`,\n fix: `Fix the JSON in ${where}, then re-run \\`tenjin install\\`${project ? ' --project' : ''}.`,\n };\n }\n // Absent. On USER scope the file may simply not be where this build looks,\n // so the harness's own answer is worth asking before calling it missing.\n if (scope === 'user') {\n const which = deps.which ?? ((bin: string) => onPath(bin, env));\n if (which('claude')) {\n const seen = await (deps.readMcp ?? claudeHasServer)({ scope, cwd }).catch(() => false);\n if (seen) {\n return {\n name: 'mcp',\n status: 'warn',\n required: false,\n detail: `${MCP_SERVER_NAME} is registered somewhere this check cannot read, so what it launches was not verified`,\n fix: `Re-run \\`tenjin install\\` to write a registration this build can check, or: ${add}`,\n };\n }\n }\n }\n return {\n name: 'mcp',\n status: 'fail',\n required: true,\n detail: found\n ? `${MCP_SERVER_NAME} is not in ${where}, so there is no request tool`\n : `${where} does not exist, so ${MCP_SERVER_NAME} is not registered`,\n fix: `Run \\`tenjin install\\`${project ? ' --project' : ''}, or: ${add}`,\n };\n}\n\n/** The harness's own answer, for a user-scope registration this build cannot\n * find on disk. It resolves across scopes, which is why it is a last resort\n * and only ever downgrades the verdict to a warn. */\nasync function claudeHasServer(opts: { scope: 'user' | 'project'; cwd: string }): Promise<boolean> {\n const { stdout } = await exec('claude', ['mcp', 'get', MCP_SERVER_NAME], {\n timeout: 15_000,\n cwd: opts.cwd,\n });\n return stdout.includes(MCP_SERVER_NAME) && !/no mcp server/i.test(stdout);\n}\n\nfunction spendCheck(maxAutoSpendAtomic: bigint, sessionBudgetAtomic: bigint | null): RouterCheck {\n if (sessionBudgetAtomic === 0n) {\n return {\n name: 'spend',\n status: 'fail',\n required: true,\n detail: 'The daily limit is 0, so positive payments are refused even with --yes.',\n fix: 'Choose a daily limit with `tenjin config set sessionBudget <usd|none>`.',\n };\n }\n if (maxAutoSpendAtomic === 0n) {\n return {\n name: 'spend',\n status: 'fail',\n required: true,\n detail: 'maxAutoSpend is 0, so every lookup needs approval and none can pay',\n fix: 'Run `tenjin install`, or `tenjin config set maxAutoSpend 0.10`.',\n };\n }\n const budget =\n sessionBudgetAtomic === null\n ? 'no daily ceiling'\n : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;\n return {\n name: 'spend',\n status: sessionBudgetAtomic === null ? 'warn' : 'ok',\n required: false,\n detail: `automatic approval up to ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,\n ...(sessionBudgetAtomic === null\n ? { fix: 'Set one with `tenjin config set sessionBudget 1.00`.' }\n : {}),\n };\n}\n\nasync function walletCheck(ctx: CommandContext): Promise<RouterCheck[]> {\n if (!(await walletFileExists(ctx.dataDir))) {\n return [\n {\n name: 'wallet',\n status: 'fail',\n required: true,\n detail: 'no wallet on this machine, so nothing can pay',\n fix: 'Run `tenjin wallet create`, then `tenjin wallet fund`.',\n },\n ];\n }\n try {\n const described = await describeWallet(resolveWalletProvider(ctx));\n return [{ name: 'wallet', status: 'ok', required: true, detail: described.address }];\n } catch (err) {\n return [\n {\n name: 'wallet',\n status: 'fail',\n required: true,\n detail: err instanceof CliError ? err.message : String(err),\n ...(err instanceof CliError && err.fix !== undefined ? { fix: err.fix } : {}),\n },\n ];\n }\n}\n\n/**\n * One cheap request to the free decision route with an empty body. It checks\n * the route is reachable and enabled, not that it routes: a 400 is the route\n * refusing that body, and a 404 is the route switched off. Nothing is signed\n * and no Jev request is spent.\n */\nasync function routerCheck(\n baseUrl: string,\n timeoutMs: number,\n fetchImpl: typeof fetch | undefined,\n): Promise<RouterCheck> {\n const url = new URL(ROUTER_PATH, baseUrl).toString();\n const probe = await httpRequest(url, {\n method: 'POST',\n timeoutMs,\n blockRedirects: true,\n jsonBody: {},\n ...(fetchImpl !== undefined ? { fetchImpl } : {}),\n });\n const fail = (detail: string, fix: string): RouterCheck => ({\n name: 'router',\n status: 'fail',\n required: true,\n detail,\n fix,\n });\n const checkBase =\n 'Check that the configured base URL names the Tenjin router (`tenjin config get baseUrl`), then try again later.';\n if (!probe.ok) {\n return fail(`the router at ${url} is unreachable or erroring (${probe.message})`, checkBase);\n }\n // 429 is the route's own rate limit: proof the router is there.\n if (probe.status === 200 || probe.status === 400 || probe.status === 429) {\n return { name: 'router', status: 'ok', required: true, detail: `${url} is live` };\n }\n if (probe.status === 404) {\n return fail(`the router is not enabled at ${url}`, checkBase);\n }\n if (probe.status === 401 || probe.status === 403) {\n return fail(\n `${url} is not a Tenjin router (it asked for credentials)`,\n `Set the router URL with \\`tenjin config set baseUrl ${PRODUCTION_ORIGIN}\\`.`,\n );\n }\n if (probe.status >= 500) {\n return fail(`the router at ${url} is unreachable or erroring (${probe.status})`, checkBase);\n }\n return fail(\n `${url} answered ${probe.status}, which a Tenjin router does not`,\n 'Check that the configured base URL names a Tenjin deployment (`tenjin config get baseUrl`).',\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAuC1B,IAAM,OAAO,UAAU,QAAQ;AA+B/B,IAAM,aAAa;AAEnB,eAAsB,gBACpB,KACA,OAAyB,CAAC,GACF;AACxB,QAAM,MAAM,KAAK,OAAO,QAAQ;AAEhC,QAAM,SAAS,MAAM;AAAA,IACnB,EAAE,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG,SAAS,IAAI,QAAQ;AAAA,IACvD,KAAK,YAAY,SAAY,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;AAAA,EAC5D,EAAE,MAAM,CAAC,QAAkB,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,CAAE;AAC/E,QAAM,WAAW,MAAM,uBAAuB,GAAG;AAIjD,QAAM,eAAe,mBAAmB;AAAA,IACtC,GAAI,KAAK,YAAY,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;AAAA,IACjD,GAAI,KAAK,YAAY,SAAY,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;AAAA,IAC9D,GAAI,KAAK,QAAQ,SAAY,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC;AAAA,EACpD,CAAC;AACD,QAAM,SAAwB,CAAC,UAAU,KAAK,eAAe,QAAQ,OAAO,CAAC;AAC7E,SAAO,KAAK,MAAM,WAAW,cAAc,IAAI,SAAS,MAAM,CAAC;AAC/D,SAAO,KAAK,MAAM,gBAAgB,YAAY,CAAC;AAC/C,SAAO;AAAA,IACL,MAAM;AAAA,MACJ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ABPQJ3M.js";
8
- import "./chunk-HSDCI7OV.js";
9
- import "./chunk-HIVZG55D.js";
10
- import "./chunk-5CLSD5YN.js";
7
+ } from "./chunk-POUWHWID.js";
8
+ import "./chunk-XZKD7DIF.js";
9
+ import "./chunk-KG3D7FIF.js";
10
+ import "./chunk-BPMWXTFX.js";
11
11
  import "./chunk-ZXTAQYNA.js";
12
12
  export {
13
13
  s as i,
@@ -15,4 +15,4 @@ export {
15
15
  a as r,
16
16
  f as t
17
17
  };
18
- //# sourceMappingURL=ethersCompat-Df4a6QIZ-3YZIAXDK.js.map
18
+ //# sourceMappingURL=ethersCompat-Df4a6QIZ-THAVUGIJ.js.map