tenjin-cli 0.1.0-alpha.27 → 0.1.0-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -17
- package/dist/alive-3J3CHOQP.js +21 -0
- package/dist/{chunk-SKQQOEWH.js → chunk-3QJREVMX.js} +5 -7
- package/dist/{chunk-SKQQOEWH.js.map → chunk-3QJREVMX.js.map} +1 -1
- package/dist/{chunk-BOAI23CX.js → chunk-6KA4HFX5.js} +21 -15
- package/dist/chunk-6KA4HFX5.js.map +1 -0
- package/dist/chunk-6W5GYG3W.js +128 -0
- package/dist/chunk-6W5GYG3W.js.map +1 -0
- package/dist/{chunk-4L7KMA7P.js → chunk-7H3RN4WJ.js} +7 -9
- package/dist/{chunk-4L7KMA7P.js.map → chunk-7H3RN4WJ.js.map} +1 -1
- package/dist/{chunk-O7CUHHYU.js → chunk-7R37M6WV.js} +7 -9
- package/dist/{chunk-O7CUHHYU.js.map → chunk-7R37M6WV.js.map} +1 -1
- package/dist/{chunk-LAIZ2AQA.js → chunk-A5H3E5QA.js} +2 -2
- package/dist/{update-RJDA5ZY3.js → chunk-AO54FM4H.js} +147 -26
- package/dist/chunk-AO54FM4H.js.map +1 -0
- package/dist/{chunk-VNNXAYJE.js → chunk-BRHREK7E.js} +2 -2
- package/dist/{chunk-YQOQ6XEI.js → chunk-DJYAPACT.js} +35 -33
- package/dist/chunk-DJYAPACT.js.map +1 -0
- package/dist/{chunk-GU4GGKYP.js → chunk-DYSDQE7S.js} +36 -2
- package/dist/chunk-DYSDQE7S.js.map +1 -0
- package/dist/{chunk-YKM2ZTA2.js → chunk-FQ6DHINU.js} +36 -38
- package/dist/{chunk-YKM2ZTA2.js.map → chunk-FQ6DHINU.js.map} +1 -1
- package/dist/{chunk-6ZSGER3A.js → chunk-FZTSGQVK.js} +2 -2
- package/dist/{chunk-AWKQSKUL.js → chunk-KAMRYUK2.js} +2 -2
- package/dist/{chunk-2TYQD22Q.js → chunk-MNTQMZJB.js} +6 -8
- package/dist/{chunk-2TYQD22Q.js.map → chunk-MNTQMZJB.js.map} +1 -1
- package/dist/{chunk-VIOUZW7Z.js → chunk-QTND6XWJ.js} +159 -35
- package/dist/chunk-QTND6XWJ.js.map +1 -0
- package/dist/chunk-RLPLYUME.js +115 -0
- package/dist/{chunk-HC3QEZKT.js.map → chunk-RLPLYUME.js.map} +1 -1
- package/dist/{chunk-5NEHH2E5.js → chunk-UEOWNDQG.js} +8 -10
- package/dist/{chunk-5NEHH2E5.js.map → chunk-UEOWNDQG.js.map} +1 -1
- package/dist/{chunk-OHZYNZSD.js → chunk-UOW5JXYY.js} +5 -7
- package/dist/{chunk-OHZYNZSD.js.map → chunk-UOW5JXYY.js.map} +1 -1
- package/dist/chunk-VSUHGRVB.js +1455 -0
- package/dist/chunk-VSUHGRVB.js.map +1 -0
- package/dist/{chunk-64SE3QC5.js → chunk-W6JX4LYF.js} +12 -4
- package/dist/chunk-W6JX4LYF.js.map +1 -0
- package/dist/{chunk-5FGO6TYT.js → chunk-XVTD7UWR.js} +3 -5
- package/dist/{chunk-5FGO6TYT.js.map → chunk-XVTD7UWR.js.map} +1 -1
- package/dist/{chunk-X7I343ZY.js → chunk-YFJJYHVG.js} +2 -2
- package/dist/{chunk-XVYATBKD.js → chunk-ZG6ZZLO7.js} +898 -521
- package/dist/chunk-ZG6ZZLO7.js.map +1 -0
- package/dist/{chunk-DATCR7AU.js → chunk-ZO3X5NPG.js} +4 -6
- package/dist/{chunk-DATCR7AU.js.map → chunk-ZO3X5NPG.js.map} +1 -1
- package/dist/{chunk-VXIBZ6W5.js → chunk-ZP5PV3JB.js} +3 -3
- package/dist/{chunk-G4AM2SOL.js → chunk-ZP7AHN7Z.js} +4 -6
- package/dist/{chunk-G4AM2SOL.js.map → chunk-ZP7AHN7Z.js.map} +1 -1
- package/dist/{cli-6JNIPZQ6.js → cli-234DNHN6.js} +54 -53
- package/dist/{cli-6JNIPZQ6.js.map → cli-234DNHN6.js.map} +1 -1
- package/dist/{config-G75YT6NC.js → config-IY2OJCAK.js} +10 -13
- package/dist/{doctor-3GMDOW4Y.js → doctor-2UZZF44A.js} +267 -242
- package/dist/doctor-2UZZF44A.js.map +1 -0
- package/dist/{fund-3IPR5YRJ.js → fund-RZ2QFULK.js} +92 -38
- package/dist/{fund-3IPR5YRJ.js.map → fund-RZ2QFULK.js.map} +1 -1
- package/dist/hook-command-PZHKS7ES.js +31 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +19 -0
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +14 -0
- package/dist/hosts/claude/tenjin/.mcp.json +11 -0
- package/dist/hosts/claude/tenjin/hooks/hooks.json +206 -0
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/install-O5FJ5EP3.js +48 -0
- package/dist/{install-identity-PM4AGFFX.js → install-identity-QM44IQ6Z.js} +7 -8
- package/dist/{install-wallet-6756NOB5.js → install-wallet-Z52EDLPB.js} +14 -15
- package/dist/{install-wallet-6756NOB5.js.map → install-wallet-Z52EDLPB.js.map} +1 -1
- package/dist/{mcp-33FAAZ7F.js → mcp-33HAADDF.js} +80 -67
- package/dist/{mcp-33FAAZ7F.js.map → mcp-33HAADDF.js.map} +1 -1
- package/dist/package-RT24HTTP.js +37 -0
- package/dist/{pay-XOYR4PCH.js → pay-IR2V76FX.js} +16 -17
- package/dist/{payments-UTQDBO7H.js → payments-GFV4HU5R.js} +9 -10
- package/dist/{payments-UTQDBO7H.js.map → payments-GFV4HU5R.js.map} +1 -1
- package/dist/{send-CVGNOQW3.js → send-PI4NUA7I.js} +12 -14
- package/dist/{send-CVGNOQW3.js.map → send-PI4NUA7I.js.map} +1 -1
- package/dist/{status-NACN4DGX.js → status-ZUHTJK46.js} +6 -7
- package/dist/{status-NACN4DGX.js.map → status-ZUHTJK46.js.map} +1 -1
- package/dist/{status-line-3IQKGRUH.js → status-line-2G5JPQAE.js} +6 -7
- package/dist/{status-line-3IQKGRUH.js.map → status-line-2G5JPQAE.js.map} +1 -1
- package/dist/uninstall-THKUH5ZT.js +136 -0
- package/dist/uninstall-THKUH5ZT.js.map +1 -0
- package/dist/update-NPZDP24E.js +18 -0
- package/dist/update-NPZDP24E.js.map +1 -0
- package/dist/{wallet-B3FVHNTS.js → wallet-53EFH4M5.js} +11 -12
- package/dist/wallet-53EFH4M5.js.map +1 -0
- package/docs/agent-permissions.md +27 -17
- package/package.json +1 -1
- package/dist/chunk-64SE3QC5.js.map +0 -1
- package/dist/chunk-BOAI23CX.js.map +0 -1
- package/dist/chunk-DSNXKUXI.js +0 -172
- package/dist/chunk-DSNXKUXI.js.map +0 -1
- package/dist/chunk-GU4GGKYP.js.map +0 -1
- package/dist/chunk-H2L33M7F.js +0 -944
- package/dist/chunk-H2L33M7F.js.map +0 -1
- package/dist/chunk-HC3QEZKT.js +0 -87
- package/dist/chunk-JLEF5WHM.js +0 -132
- package/dist/chunk-JLEF5WHM.js.map +0 -1
- package/dist/chunk-MAQUL5BD.js +0 -99
- package/dist/chunk-MAQUL5BD.js.map +0 -1
- package/dist/chunk-PY7MQUKP.js +0 -755
- package/dist/chunk-PY7MQUKP.js.map +0 -1
- package/dist/chunk-TGLKKLQG.js +0 -11
- package/dist/chunk-TGLKKLQG.js.map +0 -1
- package/dist/chunk-VIOUZW7Z.js.map +0 -1
- package/dist/chunk-XVYATBKD.js.map +0 -1
- package/dist/chunk-YQOQ6XEI.js.map +0 -1
- package/dist/doctor-3GMDOW4Y.js.map +0 -1
- package/dist/hook-command-ZXX4FT4N.js +0 -32
- package/dist/install-6OROTYHZ.js +0 -72
- package/dist/status-line-wiring-QXBOOY2T.js +0 -31
- package/dist/uninstall-NYFKSYW4.js +0 -175
- package/dist/uninstall-NYFKSYW4.js.map +0 -1
- package/dist/update-RJDA5ZY3.js.map +0 -1
- /package/dist/{config-G75YT6NC.js.map → alive-3J3CHOQP.js.map} +0 -0
- /package/dist/{chunk-LAIZ2AQA.js.map → chunk-A5H3E5QA.js.map} +0 -0
- /package/dist/{chunk-VNNXAYJE.js.map → chunk-BRHREK7E.js.map} +0 -0
- /package/dist/{chunk-6ZSGER3A.js.map → chunk-FZTSGQVK.js.map} +0 -0
- /package/dist/{chunk-AWKQSKUL.js.map → chunk-KAMRYUK2.js.map} +0 -0
- /package/dist/{chunk-X7I343ZY.js.map → chunk-YFJJYHVG.js.map} +0 -0
- /package/dist/{chunk-VXIBZ6W5.js.map → chunk-ZP5PV3JB.js.map} +0 -0
- /package/dist/{hook-command-ZXX4FT4N.js.map → config-IY2OJCAK.js.map} +0 -0
- /package/dist/{install-6OROTYHZ.js.map → hook-command-PZHKS7ES.js.map} +0 -0
- /package/dist/{install-identity-PM4AGFFX.js.map → install-O5FJ5EP3.js.map} +0 -0
- /package/dist/{pay-XOYR4PCH.js.map → install-identity-QM44IQ6Z.js.map} +0 -0
- /package/dist/{status-line-wiring-QXBOOY2T.js.map → package-RT24HTTP.js.map} +0 -0
- /package/dist/{wallet-B3FVHNTS.js.map → pay-IR2V76FX.js.map} +0 -0
|
@@ -3,56 +3,48 @@ import {
|
|
|
3
3
|
FileClientChannelStorage
|
|
4
4
|
} from "./chunk-YHKXNYTB.js";
|
|
5
5
|
import "./chunk-LFZJM56J.js";
|
|
6
|
+
import "./chunk-EL56RW2J.js";
|
|
6
7
|
import {
|
|
7
8
|
agentsWithoutRequestTool,
|
|
8
9
|
clearRouterMemo,
|
|
9
10
|
readRouterMemo
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
ALLOW_RULE,
|
|
13
|
-
mcpAddCommand,
|
|
14
|
-
mcpScope,
|
|
15
|
-
probeRouter,
|
|
16
|
-
readMcpEntry,
|
|
17
|
-
routerHookPlan,
|
|
18
|
-
routerSettingsPath
|
|
19
|
-
} from "./chunk-PY7MQUKP.js";
|
|
20
|
-
import "./chunk-64SE3QC5.js";
|
|
21
|
-
import {
|
|
22
|
-
readMcpServers
|
|
23
|
-
} from "./chunk-MAQUL5BD.js";
|
|
24
|
-
import "./chunk-EL56RW2J.js";
|
|
25
|
-
import "./chunk-TTNESUPQ.js";
|
|
26
|
-
import {
|
|
27
|
-
STATUS_LINE_COMMAND,
|
|
28
|
-
inspectStatusLine
|
|
29
|
-
} from "./chunk-DSNXKUXI.js";
|
|
11
|
+
} from "./chunk-6KA4HFX5.js";
|
|
30
12
|
import {
|
|
31
13
|
describeWallet,
|
|
32
14
|
resolveWalletProvider,
|
|
33
15
|
walletFileExists
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-7R37M6WV.js";
|
|
17
|
+
import "./chunk-ZP5PV3JB.js";
|
|
36
18
|
import {
|
|
37
19
|
readSpendSummary,
|
|
38
20
|
spentOf
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-N35E6CM2.js";
|
|
41
|
-
import "./chunk-JRGFKVAZ.js";
|
|
42
|
-
import "./chunk-EGELTSPU.js";
|
|
43
|
-
import "./chunk-KG3D7FIF.js";
|
|
44
|
-
import "./chunk-RBJPAZFI.js";
|
|
45
|
-
import "./chunk-BPMWXTFX.js";
|
|
46
|
-
import "./chunk-S4SAZ7OD.js";
|
|
47
|
-
import "./chunk-OHZYNZSD.js";
|
|
21
|
+
} from "./chunk-YFJJYHVG.js";
|
|
48
22
|
import {
|
|
49
|
-
|
|
50
|
-
|
|
23
|
+
CLAUDE_CODE_FLOOR,
|
|
24
|
+
claudeConfigDir,
|
|
25
|
+
findClaudeBinary,
|
|
26
|
+
folderState,
|
|
27
|
+
inspectLegacyInstall,
|
|
28
|
+
loadStep,
|
|
29
|
+
pluginProof,
|
|
30
|
+
probeRouter,
|
|
31
|
+
readClaudeCode,
|
|
32
|
+
readPluginListing,
|
|
33
|
+
runClaude,
|
|
34
|
+
settingsInstallPaths
|
|
35
|
+
} from "./chunk-VSUHGRVB.js";
|
|
36
|
+
import "./chunk-W6JX4LYF.js";
|
|
37
|
+
import "./chunk-TTNESUPQ.js";
|
|
38
|
+
import "./chunk-ZG6ZZLO7.js";
|
|
39
|
+
import "./chunk-AKWGE6JQ.js";
|
|
51
40
|
import {
|
|
52
41
|
ACCEPT_COMMAND,
|
|
53
42
|
CHANNEL_DEPOSIT_ATOMIC,
|
|
54
43
|
MIN_DEPOSIT_ATOMIC,
|
|
55
44
|
OWN_LIMITS_COMMANDS,
|
|
45
|
+
PLUGIN_ID,
|
|
46
|
+
PLUGIN_SERVER,
|
|
47
|
+
REQUEST_TOOL,
|
|
56
48
|
ROUTING_FEE_ATOMIC,
|
|
57
49
|
feeRefusal,
|
|
58
50
|
payerDir,
|
|
@@ -60,78 +52,81 @@ import {
|
|
|
60
52
|
spendQuestion,
|
|
61
53
|
unpaid,
|
|
62
54
|
usd
|
|
63
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-DYSDQE7S.js";
|
|
64
56
|
import "./chunk-A36LQPHV.js";
|
|
65
|
-
import {
|
|
66
|
-
inspectHooksFile,
|
|
67
|
-
ownsHookEntry,
|
|
68
|
-
pruneOurHandlers
|
|
69
|
-
} from "./chunk-XVYATBKD.js";
|
|
70
|
-
import "./chunk-AKWGE6JQ.js";
|
|
71
|
-
import {
|
|
72
|
-
MCP_SERVER_NAME,
|
|
73
|
-
REQUEST_TOOL
|
|
74
|
-
} from "./chunk-TGLKKLQG.js";
|
|
75
57
|
import "./chunk-P7LABKCW.js";
|
|
76
58
|
import "./chunk-MEFB5KHA.js";
|
|
77
59
|
import {
|
|
78
60
|
evaluateSpendPolicy
|
|
79
61
|
} from "./chunk-B2L53TMK.js";
|
|
80
|
-
import
|
|
62
|
+
import {
|
|
63
|
+
readMcpServers
|
|
64
|
+
} from "./chunk-AO54FM4H.js";
|
|
65
|
+
import "./chunk-7H3RN4WJ.js";
|
|
66
|
+
import "./chunk-XVTD7UWR.js";
|
|
67
|
+
import "./chunk-N35E6CM2.js";
|
|
68
|
+
import "./chunk-JRGFKVAZ.js";
|
|
69
|
+
import "./chunk-EGELTSPU.js";
|
|
70
|
+
import "./chunk-KG3D7FIF.js";
|
|
71
|
+
import "./chunk-RBJPAZFI.js";
|
|
72
|
+
import "./chunk-BPMWXTFX.js";
|
|
81
73
|
import {
|
|
82
74
|
routerSettings
|
|
83
|
-
} from "./chunk-
|
|
84
|
-
import
|
|
75
|
+
} from "./chunk-ZO3X5NPG.js";
|
|
76
|
+
import {
|
|
77
|
+
readAliveStamp
|
|
78
|
+
} from "./chunk-6W5GYG3W.js";
|
|
79
|
+
import "./chunk-S4SAZ7OD.js";
|
|
80
|
+
import "./chunk-UOW5JXYY.js";
|
|
85
81
|
import "./chunk-2I4QTOLB.js";
|
|
86
82
|
import {
|
|
87
83
|
resolveContextSettings
|
|
88
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-ZP7AHN7Z.js";
|
|
89
85
|
import {
|
|
90
86
|
toMoney
|
|
91
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-FZTSGQVK.js";
|
|
92
88
|
import {
|
|
89
|
+
CliError,
|
|
93
90
|
loadRawConfig,
|
|
94
91
|
readUsdcBalance
|
|
95
|
-
} from "./chunk-
|
|
96
|
-
import {
|
|
97
|
-
CliError
|
|
98
|
-
} from "./chunk-JLEF5WHM.js";
|
|
92
|
+
} from "./chunk-QTND6XWJ.js";
|
|
99
93
|
import "./chunk-K6AXXYCG.js";
|
|
94
|
+
import {
|
|
95
|
+
package_default
|
|
96
|
+
} from "./chunk-RLPLYUME.js";
|
|
100
97
|
import "./chunk-ZXTAQYNA.js";
|
|
101
98
|
|
|
102
99
|
// src/router/doctor.ts
|
|
103
|
-
import {
|
|
104
|
-
import { readdir } from "node:fs/promises";
|
|
100
|
+
import { readFile, readdir } from "node:fs/promises";
|
|
105
101
|
import { homedir } from "node:os";
|
|
106
102
|
import { join } from "node:path";
|
|
107
|
-
import { promisify } from "node:util";
|
|
108
|
-
var exec = promisify(execFile);
|
|
109
103
|
var NODE_FLOOR = 22;
|
|
110
104
|
async function runRouterDoctor(ctx, deps = {}) {
|
|
111
105
|
const env = deps.env ?? process.env;
|
|
106
|
+
const home = deps.homeDir ?? homedir();
|
|
107
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
108
|
+
const project = deps.project === true;
|
|
112
109
|
const router = await routerSettings(
|
|
113
|
-
{ cwd
|
|
110
|
+
{ cwd, dataDir: ctx.dataDir },
|
|
114
111
|
deps.homeDir !== void 0 ? { homeDir: deps.homeDir } : {}
|
|
115
112
|
).catch((err) => err instanceof Error ? err : new Error(String(err)));
|
|
116
113
|
const settings = await resolveContextSettings(ctx);
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
114
|
+
const claude = await readClaudeCode(env, cwd, deps.findClaude ?? findClaudeBinary);
|
|
115
|
+
const scope = project ? "local" : "user";
|
|
116
|
+
const paths = settingsInstallPaths(project, env, home, cwd);
|
|
117
|
+
const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);
|
|
122
118
|
const checks = [nodeCheck(deps.nodeVersion ?? process.version)];
|
|
123
|
-
checks.push(
|
|
124
|
-
|
|
125
|
-
checks.push(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
);
|
|
134
|
-
checks.push((await readMcpServers(deps)).check);
|
|
119
|
+
checks.push(claudeCodeCheck(claude));
|
|
120
|
+
const plugin = await pluginCheck(claude, { scope, env, home, cwd, dataDir: ctx.dataDir, legacy });
|
|
121
|
+
checks.push(plugin.check);
|
|
122
|
+
if (plugin.registered && claude.binary !== null) {
|
|
123
|
+
checks.push(await serverCheck(claude.binary, env, cwd));
|
|
124
|
+
}
|
|
125
|
+
if (legacy.present || legacy.unreadable !== void 0) {
|
|
126
|
+
checks.push(await migrationCheck(legacy, claude, ctx.dataDir, env, cwd));
|
|
127
|
+
}
|
|
128
|
+
checks.push(routingCheck(router));
|
|
129
|
+
checks.push((await readMcpServers(deps, { settingsInstallPending: legacy.present })).check);
|
|
135
130
|
const rawConfig = await loadRawConfig(ctx.dataDir);
|
|
136
131
|
const unanswered = rawConfig.maxAutoSpend === void 0 ? { limits: shownLimits(rawConfig) } : null;
|
|
137
132
|
checks.push(
|
|
@@ -158,10 +153,15 @@ async function runRouterDoctor(ctx, deps = {}) {
|
|
|
158
153
|
)
|
|
159
154
|
);
|
|
160
155
|
}
|
|
161
|
-
const agents = await subagentsCheck(
|
|
156
|
+
const agents = await subagentsCheck(cwd, home);
|
|
162
157
|
if (agents !== null) checks.push(agents);
|
|
163
158
|
const failure = checks.find((c) => c.status === "fail" && c.required);
|
|
164
|
-
const data = {
|
|
159
|
+
const data = {
|
|
160
|
+
checks,
|
|
161
|
+
dataDir: ctx.dataDir,
|
|
162
|
+
baseUrl: settings.baseUrl,
|
|
163
|
+
settingsPath: paths.settingsPath
|
|
164
|
+
};
|
|
165
165
|
if (failure !== void 0) {
|
|
166
166
|
throw new CliError("REFUSED", failure.detail, {
|
|
167
167
|
...failure.fix !== void 0 ? { fix: failure.fix } : {},
|
|
@@ -190,7 +190,7 @@ function withBackoff(check, memo, now) {
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
async function subagentsCheck(cwd, homeDir) {
|
|
193
|
-
const excluded = await agentsWithoutRequestTool({ cwd, homeDir });
|
|
193
|
+
const excluded = await agentsWithoutRequestTool({ cwd, homeDir }, REQUEST_TOOL);
|
|
194
194
|
if (excluded.length === 0) return null;
|
|
195
195
|
return {
|
|
196
196
|
name: "subagents",
|
|
@@ -209,204 +209,229 @@ function nodeCheck(version) {
|
|
|
209
209
|
fix: `Install Node ${NODE_FLOOR} or newer, then re-run \`tenjin doctor\`.`
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return {
|
|
223
|
-
name,
|
|
224
|
-
status: "ok",
|
|
225
|
-
required: false,
|
|
226
|
-
detail: "yours, with the x402 footer appended"
|
|
227
|
-
};
|
|
228
|
-
case "foreign":
|
|
229
|
-
return {
|
|
230
|
-
name,
|
|
231
|
-
status: "warn",
|
|
232
|
-
required: false,
|
|
233
|
-
detail: "yours is registered and was left alone, so there is no live x402 footer",
|
|
234
|
-
fix: "Run `tenjin install --status-line compose` to show both."
|
|
235
|
-
};
|
|
236
|
-
default:
|
|
237
|
-
return {
|
|
238
|
-
name,
|
|
239
|
-
status: "warn",
|
|
240
|
-
required: false,
|
|
241
|
-
detail: "not registered, so lookups run without the live footer",
|
|
242
|
-
fix: "Run `tenjin install` to register it."
|
|
243
|
-
};
|
|
212
|
+
function claudeCodeCheck(claude) {
|
|
213
|
+
const name = "claude code";
|
|
214
|
+
if (claude.binary === null) {
|
|
215
|
+
return {
|
|
216
|
+
name,
|
|
217
|
+
status: "warn",
|
|
218
|
+
required: false,
|
|
219
|
+
detail: "no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so the plugin was checked from its folder only",
|
|
220
|
+
fix: "Run `tenjin doctor` from a Claude Code session, where CLAUDE_CODE_EXECPATH names the binary."
|
|
221
|
+
};
|
|
244
222
|
}
|
|
245
|
-
|
|
246
|
-
async function hooksCheck(path, dataDir, router) {
|
|
247
|
-
const found = await inspectHooksFile(path);
|
|
248
|
-
if ("refusal" in found) {
|
|
223
|
+
if (claude.version === null) {
|
|
249
224
|
return {
|
|
250
|
-
name
|
|
251
|
-
status: "
|
|
252
|
-
required:
|
|
253
|
-
detail:
|
|
254
|
-
fix: "Fix the reported file, then run `tenjin install`."
|
|
225
|
+
name,
|
|
226
|
+
status: "warn",
|
|
227
|
+
required: false,
|
|
228
|
+
detail: `${claude.binary.path} did not report a version`
|
|
255
229
|
};
|
|
256
230
|
}
|
|
257
|
-
|
|
258
|
-
const allow = allowRules(found.settings);
|
|
259
|
-
if (events.length === 0) {
|
|
231
|
+
if (!claude.meetsFloor) {
|
|
260
232
|
return {
|
|
261
|
-
name
|
|
233
|
+
name,
|
|
262
234
|
status: "fail",
|
|
263
235
|
required: true,
|
|
264
|
-
detail: `
|
|
265
|
-
fix
|
|
236
|
+
detail: `Claude Code ${claude.version} is older than ${CLAUDE_CODE_FLOOR}, which the Tenjin plugin needs`,
|
|
237
|
+
...claude.fix !== void 0 ? { fix: claude.fix } : {}
|
|
266
238
|
};
|
|
267
239
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
240
|
+
return {
|
|
241
|
+
name,
|
|
242
|
+
status: "ok",
|
|
243
|
+
required: true,
|
|
244
|
+
detail: `${claude.version}${claude.binary.source === "execpath" ? " (from CLAUDE_CODE_EXECPATH)" : ""}`
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
async function pluginCheck(claude, c) {
|
|
248
|
+
const name = "plugin";
|
|
249
|
+
const missing = (detail) => ({
|
|
250
|
+
registered: false,
|
|
251
|
+
check: c.legacy.present ? {
|
|
252
|
+
name,
|
|
271
253
|
status: "warn",
|
|
272
254
|
required: false,
|
|
273
|
-
detail: `${
|
|
274
|
-
fix: "
|
|
255
|
+
detail: `${detail}; the settings install of an earlier release still routes here`,
|
|
256
|
+
fix: claude.meetsFloor ? `Run \`tenjin install${c.scope === "local" ? " --project" : ""}\` to move this machine to the plugin.` : `Run \`claude update\`, then \`tenjin install${c.scope === "local" ? " --project" : ""}\` to move this machine to the plugin.`
|
|
257
|
+
} : {
|
|
258
|
+
name,
|
|
259
|
+
status: "fail",
|
|
260
|
+
required: true,
|
|
261
|
+
detail,
|
|
262
|
+
fix: `Run \`tenjin install${c.scope === "local" ? " --project" : ""}\`.`
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
if (claude.binary !== null) {
|
|
266
|
+
const listing = await readPluginListing(claude.binary, c.env, c.cwd);
|
|
267
|
+
if (!listing.read) {
|
|
268
|
+
return {
|
|
269
|
+
registered: false,
|
|
270
|
+
check: {
|
|
271
|
+
name,
|
|
272
|
+
status: "warn",
|
|
273
|
+
required: false,
|
|
274
|
+
detail: "Claude Code's plugin list could not be read, so the plugin was not checked",
|
|
275
|
+
fix: "Run `tenjin doctor` again in a moment."
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
if (listing.id === null) return missing(`${PLUGIN_ID} is not installed in Claude Code`);
|
|
280
|
+
if (!listing.enabled) {
|
|
281
|
+
return {
|
|
282
|
+
registered: false,
|
|
283
|
+
check: {
|
|
284
|
+
name,
|
|
285
|
+
status: "fail",
|
|
286
|
+
required: true,
|
|
287
|
+
detail: `${listing.id} is installed but disabled, so no lookup is routed`,
|
|
288
|
+
fix: `Run \`claude plugin enable ${listing.id}\`, then ${loadStep(c.legacy.present)}.`
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
if (listing.version !== package_default.version) {
|
|
293
|
+
return {
|
|
294
|
+
registered: true,
|
|
295
|
+
check: {
|
|
296
|
+
name,
|
|
297
|
+
status: "warn",
|
|
298
|
+
required: false,
|
|
299
|
+
detail: `${listing.id} is enabled at ${listing.version ?? "an unknown version"}, and this CLI is ${package_default.version}`,
|
|
300
|
+
fix: "Run `tenjin install --refresh` to register this version."
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
return {
|
|
305
|
+
registered: true,
|
|
306
|
+
check: { name, status: "ok", required: true, detail: `${listing.id} ${package_default.version} enabled` }
|
|
275
307
|
};
|
|
276
308
|
}
|
|
277
|
-
|
|
278
|
-
|
|
309
|
+
const folder = await folderState(c.scope, c.env, c.home, c.cwd);
|
|
310
|
+
if (folder.state === "foreign") {
|
|
279
311
|
return {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
312
|
+
registered: false,
|
|
313
|
+
check: {
|
|
314
|
+
name,
|
|
315
|
+
status: "fail",
|
|
316
|
+
required: true,
|
|
317
|
+
detail: `${folder.path} is there and is not a folder this CLI wrote, so the plugin cannot be written`,
|
|
318
|
+
fix: `Move ${folder.path} aside, then run \`tenjin install\` again.`
|
|
319
|
+
}
|
|
285
320
|
};
|
|
286
321
|
}
|
|
287
|
-
if (
|
|
322
|
+
if (folder.state === "ours") {
|
|
323
|
+
const stamp = await readAliveStamp(c.dataDir);
|
|
288
324
|
return {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
325
|
+
registered: true,
|
|
326
|
+
check: stamp === null ? {
|
|
327
|
+
name,
|
|
328
|
+
status: "warn",
|
|
329
|
+
required: false,
|
|
330
|
+
detail: `the plugin folder is at ${folder.path} and has not loaded in a session yet`,
|
|
331
|
+
fix: `To load it, ${loadStep(c.legacy.present)}.`
|
|
332
|
+
} : {
|
|
333
|
+
name,
|
|
334
|
+
status: "ok",
|
|
335
|
+
required: true,
|
|
336
|
+
detail: `the plugin folder at ${folder.path} loaded, last at ${stamp.at}`
|
|
337
|
+
}
|
|
294
338
|
};
|
|
295
339
|
}
|
|
296
|
-
|
|
297
|
-
if (drift.missing.length > 0 || drift.stale.length > 0) {
|
|
298
|
-
const parts = [
|
|
299
|
-
...drift.missing.length > 0 ? [`missing ${drift.missing.join(", ")}`] : [],
|
|
300
|
-
...drift.stale.length > 0 ? [`stale ${drift.stale.join(", ")}`] : []
|
|
301
|
-
];
|
|
340
|
+
if (await listedInClaudeFiles(c.env, c.home)) {
|
|
302
341
|
return {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
342
|
+
registered: true,
|
|
343
|
+
check: {
|
|
344
|
+
name,
|
|
345
|
+
status: "warn",
|
|
346
|
+
required: false,
|
|
347
|
+
detail: `${PLUGIN_ID} is registered, and there is no claude binary here to check it`,
|
|
348
|
+
fix: "Run `tenjin doctor` from a Claude Code session to check it."
|
|
349
|
+
}
|
|
308
350
|
};
|
|
309
351
|
}
|
|
310
|
-
return {
|
|
311
|
-
name: "hooks",
|
|
312
|
-
status: "ok",
|
|
313
|
-
required: true,
|
|
314
|
-
detail: `${events.join(" and ")} registered, ${ALLOW_RULE} allowed`
|
|
315
|
-
};
|
|
352
|
+
return missing(`${PLUGIN_ID} is not registered`);
|
|
316
353
|
}
|
|
317
|
-
function
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
354
|
+
async function listedInClaudeFiles(env, home) {
|
|
355
|
+
try {
|
|
356
|
+
const raw = await readFile(
|
|
357
|
+
join(claudeConfigDir(env, home), "plugins", "installed_plugins.json"),
|
|
358
|
+
"utf8"
|
|
359
|
+
);
|
|
360
|
+
const plugins = JSON.parse(raw).plugins;
|
|
361
|
+
return plugins !== null && typeof plugins === "object" && PLUGIN_ID in plugins;
|
|
362
|
+
} catch {
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
321
365
|
}
|
|
322
|
-
function
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
for (const handler of handlers.filter((h) => kept === null || !kept.hooks.includes(h))) {
|
|
333
|
-
present.push(entryLabel(event, matcher, handler));
|
|
334
|
-
}
|
|
335
|
-
}
|
|
366
|
+
async function serverCheck(binary, env, cwd) {
|
|
367
|
+
const name = "router server";
|
|
368
|
+
const run = await runClaude(binary, ["mcp", "get", PLUGIN_SERVER], {
|
|
369
|
+
env,
|
|
370
|
+
cwd,
|
|
371
|
+
timeoutMs: 45e3
|
|
372
|
+
});
|
|
373
|
+
const status = /Status:\s*(.+)/.exec(run.stdout)?.[1]?.trim();
|
|
374
|
+
if (run.code === 0 && status !== void 0 && /connected/i.test(status) && !/fail/i.test(status)) {
|
|
375
|
+
return { name, status: "ok", required: true, detail: `${PLUGIN_SERVER} connected` };
|
|
336
376
|
}
|
|
337
377
|
return {
|
|
338
|
-
|
|
339
|
-
|
|
378
|
+
name,
|
|
379
|
+
status: "fail",
|
|
380
|
+
required: true,
|
|
381
|
+
detail: `${PLUGIN_SERVER} did not connect${status !== void 0 ? `: ${status.slice(0, 200)}` : ""}`,
|
|
382
|
+
fix: "Run `tenjin --version` in this session: the plugin starts `tenjin mcp` from PATH, so it must print a version."
|
|
340
383
|
};
|
|
341
384
|
}
|
|
342
|
-
function
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
345
|
-
return
|
|
385
|
+
async function migrationCheck(legacy, claude, dataDir, env, cwd) {
|
|
386
|
+
const name = "settings install";
|
|
387
|
+
if (legacy.unreadable !== void 0) {
|
|
388
|
+
return { name, status: "warn", required: false, detail: legacy.unreadable };
|
|
346
389
|
}
|
|
347
|
-
const
|
|
348
|
-
|
|
390
|
+
const parts = [
|
|
391
|
+
...legacy.events.length > 0 ? [`hook entries (${legacy.events.join(", ")})`] : [],
|
|
392
|
+
...legacy.allowRule || legacy.denyRule ? ["permission rules"] : [],
|
|
393
|
+
...legacy.statusLine === "ours" || legacy.statusLine === "composed" ? ["a status line"] : [],
|
|
394
|
+
...legacy.mcp === "ok" ? ["the x402 MCP server"] : []
|
|
395
|
+
];
|
|
396
|
+
const found = `${parts.join(", ")} from an earlier release in ${legacy.settingsPath}`;
|
|
397
|
+
const lookalikes = legacy.lookalikes.length > 0 ? `; not Tenjin's and left alone: ${legacy.lookalikes.join(", ")}` : "";
|
|
398
|
+
const proof = await pluginProof(claude, dataDir, env, cwd);
|
|
399
|
+
return proof.proven ? {
|
|
400
|
+
name,
|
|
401
|
+
status: "warn",
|
|
402
|
+
required: false,
|
|
403
|
+
detail: `${found}, ready to remove: the plugin has loaded here${lookalikes}`,
|
|
404
|
+
fix: "Run `tenjin install --refresh` to remove it."
|
|
405
|
+
} : {
|
|
406
|
+
name,
|
|
407
|
+
status: "warn",
|
|
408
|
+
required: false,
|
|
409
|
+
detail: `${found}, kept until the plugin loads: ${proof.reason}${lookalikes}`,
|
|
410
|
+
fix: claude.meetsFloor ? `To load the plugin, ${loadStep(true)}; the next \`tenjin install\` or \`tenjin update\` then removes the old entries.` : "Run `claude update`, then `tenjin install`: until then the old entries keep routing."
|
|
411
|
+
};
|
|
349
412
|
}
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
const where = scope === "project" ? "this project's .mcp.json" : "~/.claude.json";
|
|
354
|
-
const { found, state } = await (deps.readMcpEntry ?? readMcpEntry)(scope, cwd, home);
|
|
355
|
-
if (state === "ok") {
|
|
356
|
-
return {
|
|
357
|
-
name: "mcp",
|
|
358
|
-
status: "ok",
|
|
359
|
-
required: true,
|
|
360
|
-
detail: `${MCP_SERVER_NAME} registered (${scope} scope), running \`tenjin mcp\``
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
if (state === "wrong-command") {
|
|
413
|
+
function routingCheck(router) {
|
|
414
|
+
const name = "routing";
|
|
415
|
+
if (router instanceof Error) {
|
|
364
416
|
return {
|
|
365
|
-
name
|
|
366
|
-
status: "
|
|
367
|
-
required:
|
|
368
|
-
detail:
|
|
369
|
-
fix:
|
|
417
|
+
name,
|
|
418
|
+
status: "warn",
|
|
419
|
+
required: false,
|
|
420
|
+
detail: `the router is off here: ${router.message}`,
|
|
421
|
+
fix: "Fix or delete that file."
|
|
370
422
|
};
|
|
371
423
|
}
|
|
372
|
-
if (
|
|
424
|
+
if (!router.enabled.value) {
|
|
425
|
+
const file = router.enabled.path ?? "the config";
|
|
373
426
|
return {
|
|
374
|
-
name
|
|
375
|
-
status: "
|
|
376
|
-
required:
|
|
377
|
-
detail:
|
|
378
|
-
fix:
|
|
427
|
+
name,
|
|
428
|
+
status: "warn",
|
|
429
|
+
required: false,
|
|
430
|
+
detail: `router.enabled is false in ${file}, so nothing is routed from this directory`,
|
|
431
|
+
fix: router.enabled.source === "file" ? "Run `tenjin config set router.enabled true` to route again." : `Remove router.enabled from ${file} to route here again.`
|
|
379
432
|
};
|
|
380
433
|
}
|
|
381
|
-
|
|
382
|
-
const which = deps.which ?? ((bin) => onPath(bin, env));
|
|
383
|
-
if (which("claude")) {
|
|
384
|
-
const seen = await (deps.readMcp ?? claudeHasServer)({ scope, cwd }).catch(() => false);
|
|
385
|
-
if (seen) {
|
|
386
|
-
return {
|
|
387
|
-
name: "mcp",
|
|
388
|
-
status: "warn",
|
|
389
|
-
required: false,
|
|
390
|
-
detail: `${MCP_SERVER_NAME} is registered somewhere this check cannot read, so what it launches was not verified`,
|
|
391
|
-
fix: `Re-run \`tenjin install\` to write a registration this build can check, or: ${add}`
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
return {
|
|
397
|
-
name: "mcp",
|
|
398
|
-
status: "fail",
|
|
399
|
-
required: true,
|
|
400
|
-
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`,
|
|
401
|
-
fix: `Run \`tenjin install\`${project ? " --project" : ""}, or: ${add}`
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
async function claudeHasServer(opts) {
|
|
405
|
-
const { stdout } = await exec("claude", ["mcp", "get", MCP_SERVER_NAME], {
|
|
406
|
-
timeout: 15e3,
|
|
407
|
-
cwd: opts.cwd
|
|
408
|
-
});
|
|
409
|
-
return stdout.includes(MCP_SERVER_NAME) && !/no mcp server/i.test(stdout);
|
|
434
|
+
return { name, status: "ok", required: false, detail: "on" };
|
|
410
435
|
}
|
|
411
436
|
async function routingFeeCheck(ctx, settings, fetchImpl, unanswered) {
|
|
412
437
|
let host;
|
|
@@ -530,7 +555,7 @@ function spendCheck(maxAutoSpendAtomic, sessionBudgetAtomic, unanswered) {
|
|
|
530
555
|
status: "warn",
|
|
531
556
|
required: false,
|
|
532
557
|
detail: `the spend limits are not answered yet, so automatic payments are off and every lookup needs approval. Ask the user: ${spendQuestion(unanswered.limits)}`,
|
|
533
|
-
fix: `Answer the spend question: for a yes, run \`${ACCEPT_COMMAND}\`; for other amounts, ${OWN_LIMITS_COMMANDS}
|
|
558
|
+
fix: `Answer the spend question: for a yes, run \`${ACCEPT_COMMAND}\`; for other amounts, ${OWN_LIMITS_COMMANDS}.`
|
|
534
559
|
};
|
|
535
560
|
}
|
|
536
561
|
if (maxAutoSpendAtomic === 0n) {
|
|
@@ -584,4 +609,4 @@ export {
|
|
|
584
609
|
routingFeeRow,
|
|
585
610
|
runRouterDoctor
|
|
586
611
|
};
|
|
587
|
-
//# sourceMappingURL=doctor-
|
|
612
|
+
//# sourceMappingURL=doctor-2UZZF44A.js.map
|