@mcpjam/inspector 3.13.0 → 3.14.0
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/bin/runtime-profile.mjs +774 -0
- package/bin/start.js +117 -24
- package/dist/client/assets/{OAuthDesktopReturnNotice-D5tJNqny.js → OAuthDesktopReturnNotice-D7d-faB1.js} +2 -2
- package/dist/client/assets/{app-bootstrap-baadQQNk.js → app-bootstrap-BtDjj9nz.js} +350 -350
- package/dist/client/assets/{button-DHPqnOj6.js → button-B99pZFz_.js} +2 -2
- package/dist/client/assets/{chunk-D32TOXHM-BPB6AqSK.js → chunk-D32TOXHM-Bcyg0ZVj.js} +5 -5
- package/dist/client/assets/{dead-clicks-autocapture-Cbczl2El.js → dead-clicks-autocapture-CnUHv5CB.js} +2 -2
- package/dist/client/assets/{error-reporting-CORfsjyM.js → error-reporting-BohBwcQQ.js} +4 -4
- package/dist/client/assets/{error-reporting-B4hGM_ob.js → error-reporting-p6G1ojum.js} +1 -1
- package/dist/client/assets/{exception-autocapture-CMOUrnel.js → exception-autocapture-Q-isBTHp.js} +2 -2
- package/dist/client/assets/{failed-request-tracker-DoQRXuIy.js → failed-request-tracker-BBJW8izb.js} +2 -2
- package/dist/client/assets/{highlighted-body-KQOG7T2V-_ljE4u1k.js → highlighted-body-KQOG7T2V-zsXWRnSM.js} +2 -2
- package/dist/client/assets/{index-BBr8TZVx.js → index-C9oFRqoK.js} +3 -3
- package/dist/client/assets/{jszip.min-C-vIQbxH.js → jszip.min-C86zG41a.js} +2 -2
- package/dist/client/assets/{mermaid-MCJ5UELQ-DTJaEEBm.js → mermaid-MCJ5UELQ-DAW4LYwz.js} +1 -1
- package/dist/client/assets/{posthog-recorder-Dby9Z8HR.js → posthog-recorder-trUd0BXy.js} +2 -2
- package/dist/client/assets/{preload-helper-Dvt1a6xa.js → preload-helper-Buauuydw.js} +2 -2
- package/dist/client/assets/{react-CD7Pk4KS.js → react-CZb-kDOs.js} +2 -2
- package/dist/client/assets/{rolldown-runtime-mzU9SaVm.js → rolldown-runtime-Bkua2_Tb.js} +1 -1
- package/dist/client/assets/{surveys-DYqpu8xl.js → surveys-BISK_WOT.js} +2 -2
- package/dist/client/assets/{trace-timeline-PnE1ouRj.js → trace-timeline-CRewsP1E.js} +2 -2
- package/dist/client/assets/{trace-timeline-WXINST5z.js → trace-timeline-D-DWE-sO.js} +1 -1
- package/dist/client/assets/{web-vitals-BLq6M5vx.js → web-vitals-DqmZ9w02.js} +2 -2
- package/dist/client/index.html +7 -7
- package/dist/server/authorization-MA42CNYT.js +22 -0
- package/dist/server/chunk-7M3XVZCQ.js +381 -0
- package/dist/server/{chunk-MBS3EZ3U.js → chunk-7ZIR7SX7.js} +5 -44
- package/dist/server/chunk-C47PTIDS.js +487 -0
- package/dist/server/chunk-DHRTCKJA.js +3979 -0
- package/dist/server/chunk-HJTKF2X6.js +45 -0
- package/dist/server/{chunk-2FVSBJQF.js → chunk-KNO4KZJF.js} +224 -758
- package/dist/server/{chunk-QHYREDE3.js → chunk-RWFTW2EW.js} +7 -5
- package/dist/server/chunk-SDWJSPSI.js +252 -0
- package/dist/server/chunk-VFRLMHOC.js +33 -0
- package/dist/server/chunk-XSQ2GC45.js +438 -0
- package/dist/server/chunk-YQ2BTE46.js +88 -0
- package/dist/server/{consent-lifetime-TYLDY64H.js → consent-lifetime-OXQM37RV.js} +4 -3
- package/dist/server/grants-UVE62NGN.js +37 -0
- package/dist/server/harness-install-cli.js +239 -4
- package/dist/server/index.js +9044 -9216
- package/dist/server/local-turn-XSUGEKTL.js +19 -0
- package/dist/server/runtime-health-TCF3ZEKS.js +28 -0
- package/dist/server/runtime-lifecycle-YQ3KWDLJ.js +53 -0
- package/package.json +26 -23
- package/dist/server/chunk-I7ZVTBZP.js +0 -3100
- package/dist/server/local-turn-VQDSTY6T.js +0 -12
|
@@ -1,10 +1,223 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
LOCAL_HARNESS_MANIFEST,
|
|
3
|
+
describeInstallerNetwork,
|
|
4
|
+
expectedPackFor,
|
|
3
5
|
installRuntimePack,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
isPackInstalled,
|
|
7
|
+
packVersionRoot,
|
|
8
|
+
permittedPackFor,
|
|
9
|
+
readCachedRevocations,
|
|
10
|
+
readDesiredRuntimeStatus,
|
|
11
|
+
readLocalRuntimeUpdatePolicy,
|
|
12
|
+
readRuntimeInstallStatus,
|
|
13
|
+
readVerifiedRuntimeStatus,
|
|
14
|
+
repairRuntime,
|
|
15
|
+
resolveLocalCompatibility,
|
|
16
|
+
revocationFor,
|
|
17
|
+
revocationsUrl,
|
|
18
|
+
runtimeInstallRoot
|
|
19
|
+
} from "./chunk-DHRTCKJA.js";
|
|
20
|
+
import {
|
|
21
|
+
readRuntimeHealth
|
|
22
|
+
} from "./chunk-YQ2BTE46.js";
|
|
23
|
+
import {
|
|
24
|
+
readRuntimeOperation
|
|
25
|
+
} from "./chunk-7M3XVZCQ.js";
|
|
26
|
+
import {
|
|
27
|
+
SUPPORTED_LOCAL_HARNESS_IDS,
|
|
28
|
+
currentLocalPlatform,
|
|
29
|
+
localPackTarget
|
|
30
|
+
} from "./chunk-VFRLMHOC.js";
|
|
31
|
+
import "./chunk-C47PTIDS.js";
|
|
32
|
+
import "./chunk-7ZIR7SX7.js";
|
|
6
33
|
import "./chunk-PZ5AY32C.js";
|
|
7
34
|
|
|
35
|
+
// server/utils/harness/local/runtime-doctor.ts
|
|
36
|
+
import { homedir, platform as osPlatform, arch as osArch } from "os";
|
|
37
|
+
var DOCTOR_SCHEMA = "mcpjam.local-harness-doctor/1";
|
|
38
|
+
async function packView(harnessId, pack, installed, revocations) {
|
|
39
|
+
if (pack === null) return null;
|
|
40
|
+
const target = localPackTarget();
|
|
41
|
+
const record = target === null ? null : await readRuntimeHealth(packVersionRoot(harnessId, pack.packVersion, target));
|
|
42
|
+
const sameBytes = record !== null && record.treeDigest === pack.treeDigest;
|
|
43
|
+
return {
|
|
44
|
+
...pack,
|
|
45
|
+
installed,
|
|
46
|
+
revoked: revocationFor(revocations, harnessId, pack.treeDigest)?.reason ?? null,
|
|
47
|
+
health: !installed ? "absent" : sameBytes && record.unhealthy ? "unhealthy" : sameBytes && record.probe ? "healthy" : "unprobed",
|
|
48
|
+
...sameBytes && record.unhealthy ? { unhealthyReason: record.unhealthy.reason } : {},
|
|
49
|
+
...sameBytes ? { launchFailures: record.launchFailures.length } : {}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function suggestRepairs(input) {
|
|
53
|
+
const flag = input.harnessId === "claude-code" ? "" : ` --harness ${input.harnessId}`;
|
|
54
|
+
const install = `mcpjam-inspector harness install${flag}`;
|
|
55
|
+
const repair = `mcpjam-inspector harness repair${flag}`;
|
|
56
|
+
const offline = `mcpjam-inspector harness install${flag} --from <pack>.tar.gz (no network; keep the .manifest.json and .sig beside it)`;
|
|
57
|
+
const out = [];
|
|
58
|
+
const d = input.desiredStatus;
|
|
59
|
+
if (d.state === "unsupported-platform") return [];
|
|
60
|
+
if (input.desired?.revoked) {
|
|
61
|
+
out.push(`Update the Inspector: MCPJam withdrew the ${input.harnessId} runtime ${input.desired.packVersion} (${input.desired.revoked}).`);
|
|
62
|
+
}
|
|
63
|
+
if (d.state === "corrupt") out.push(repair);
|
|
64
|
+
if (d.state === "ready" && input.desired?.health === "unhealthy") out.push(repair);
|
|
65
|
+
if (d.state === "failed") {
|
|
66
|
+
if (d.stage === "disk-space" || d.reason === "disk") out.push(`Free disk space under the runtime root, then: ${install}`);
|
|
67
|
+
else if (d.reason === "network") {
|
|
68
|
+
out.push(
|
|
69
|
+
input.proxyConfigured ? "Check HTTPS_PROXY / NO_PROXY, and NODE_EXTRA_CA_CERTS if the proxy inspects TLS." : "If this network needs a proxy, set HTTPS_PROXY (and NODE_EXTRA_CA_CERTS for a TLS-inspecting proxy)."
|
|
70
|
+
);
|
|
71
|
+
out.push(install);
|
|
72
|
+
out.push(offline);
|
|
73
|
+
} else out.push(install);
|
|
74
|
+
}
|
|
75
|
+
if (d.state === "absent" || d.state === "interrupted") {
|
|
76
|
+
out.push(install);
|
|
77
|
+
if (input.policy === "manual") out.push(offline);
|
|
78
|
+
}
|
|
79
|
+
if (input.selected.state === "ready" && input.selected.role === "permitted" && d.state === "absent" && input.policy === "manual") {
|
|
80
|
+
out.push("Updates are manual on this machine: the previous runtime keeps working until an administrator installs the new one.");
|
|
81
|
+
}
|
|
82
|
+
return [...new Set(out)];
|
|
83
|
+
}
|
|
84
|
+
async function buildDoctorReport(options = {}) {
|
|
85
|
+
const target = localPackTarget();
|
|
86
|
+
const platform = currentLocalPlatform(process.platform);
|
|
87
|
+
const runtimeRoot = runtimeInstallRoot();
|
|
88
|
+
const updatePolicy = await readLocalRuntimeUpdatePolicy();
|
|
89
|
+
const network = describeInstallerNetwork();
|
|
90
|
+
const revocations = await readCachedRevocations();
|
|
91
|
+
let freeBytes = null;
|
|
92
|
+
try {
|
|
93
|
+
const { statfs } = await import("fs/promises");
|
|
94
|
+
const { existsSync } = await import("fs");
|
|
95
|
+
const info = await statfs(existsSync(runtimeRoot) ? runtimeRoot : homedir());
|
|
96
|
+
freeBytes = Number(info.bavail) * Number(info.bsize);
|
|
97
|
+
} catch {
|
|
98
|
+
freeBytes = null;
|
|
99
|
+
}
|
|
100
|
+
const harnesses = [];
|
|
101
|
+
for (const harnessId of options.harnessIds ?? SUPPORTED_LOCAL_HARNESS_IDS) {
|
|
102
|
+
const selected = await readRuntimeInstallStatus({ harnessId });
|
|
103
|
+
const desiredStatus = options.verify ? await readVerifiedRuntimeStatus({ harnessId, desiredOnly: true }) : await readDesiredRuntimeStatus({ harnessId });
|
|
104
|
+
const desiredPack = target === null ? null : expectedPackFor(harnessId, target);
|
|
105
|
+
const permittedPack = target === null ? null : permittedPackFor(harnessId, target);
|
|
106
|
+
const permittedInstalled = permittedPack !== null && await isPackInstalled(harnessId, permittedPack, target);
|
|
107
|
+
const desired = await packView(harnessId, desiredPack, desiredStatus.state === "ready", revocations);
|
|
108
|
+
const permitted = await packView(harnessId, permittedPack, permittedInstalled, revocations);
|
|
109
|
+
const manifest = LOCAL_HARNESS_MANIFEST[harnessId];
|
|
110
|
+
const compatibility = platform === null ? { ok: false, status: "platform-not-supported", message: `${process.platform} has no local harness` } : (() => {
|
|
111
|
+
const result = resolveLocalCompatibility(
|
|
112
|
+
{
|
|
113
|
+
harnessId,
|
|
114
|
+
platform,
|
|
115
|
+
targetKind: "local-native",
|
|
116
|
+
permissionProfile: "workspace-edits",
|
|
117
|
+
packTarget: target,
|
|
118
|
+
installedAdapterVersion: manifest.adapterVersion
|
|
119
|
+
},
|
|
120
|
+
LOCAL_HARNESS_MANIFEST
|
|
121
|
+
);
|
|
122
|
+
return result.ok ? { ok: true } : { ok: false, status: result.status, message: result.message };
|
|
123
|
+
})();
|
|
124
|
+
const record = desiredPack === null || target === null ? null : await readRuntimeOperation({ runtimeRoot, harnessId, target, ...desiredPack });
|
|
125
|
+
harnesses.push({
|
|
126
|
+
harnessId,
|
|
127
|
+
selected,
|
|
128
|
+
desiredStatus,
|
|
129
|
+
desired,
|
|
130
|
+
permitted,
|
|
131
|
+
compatibility,
|
|
132
|
+
lastAttempt: record === null ? null : {
|
|
133
|
+
state: record.state,
|
|
134
|
+
packVersion: record.packVersion,
|
|
135
|
+
...record.stage ? { stage: record.stage } : {},
|
|
136
|
+
...record.reason ? { reason: record.reason } : {},
|
|
137
|
+
...record.message ? { message: record.message } : {},
|
|
138
|
+
...record.trigger ? { trigger: record.trigger } : {},
|
|
139
|
+
updatedAt: record.updatedAt
|
|
140
|
+
},
|
|
141
|
+
repairs: suggestRepairs({
|
|
142
|
+
harnessId,
|
|
143
|
+
selected,
|
|
144
|
+
desiredStatus,
|
|
145
|
+
desired,
|
|
146
|
+
policy: updatePolicy.policy,
|
|
147
|
+
proxyConfigured: network.proxy !== null
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
schema: DOCTOR_SCHEMA,
|
|
153
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
154
|
+
machine: { os: osPlatform(), arch: osArch(), target },
|
|
155
|
+
runtimeRoot,
|
|
156
|
+
freeBytes,
|
|
157
|
+
updatePolicy,
|
|
158
|
+
network,
|
|
159
|
+
revocations: { url: revocationsUrl(), sequence: revocations?.sequence ?? null, revoked: revocations?.revoked.length ?? 0 },
|
|
160
|
+
harnesses
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
var TOKEN_PATTERNS = [
|
|
164
|
+
/\b(?:sk|pk|rk)-[A-Za-z0-9_-]{16,}\b/g,
|
|
165
|
+
// API keys
|
|
166
|
+
/\bgh[pousr]_[A-Za-z0-9]{20,}\b/g,
|
|
167
|
+
// GitHub tokens
|
|
168
|
+
/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi,
|
|
169
|
+
/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,
|
|
170
|
+
// JWTs
|
|
171
|
+
/\b(?:token|secret|password|apikey|api_key|key)=([^&\s"']+)/gi
|
|
172
|
+
];
|
|
173
|
+
function redactDoctorReport(report, home = homedir()) {
|
|
174
|
+
let text = JSON.stringify(report);
|
|
175
|
+
if (home && home !== "/") {
|
|
176
|
+
const escaped = JSON.stringify(home).slice(1, -1);
|
|
177
|
+
text = text.split(escaped).join("~");
|
|
178
|
+
}
|
|
179
|
+
text = text.replace(/:\/\/[^/@"\s]+@/g, "://***@");
|
|
180
|
+
for (const pattern of TOKEN_PATTERNS) {
|
|
181
|
+
text = text.replace(pattern, (match) => {
|
|
182
|
+
const eq = match.indexOf("=");
|
|
183
|
+
return eq > 0 && !/^Bearer/i.test(match) ? `${match.slice(0, eq + 1)}[redacted]` : "[redacted]";
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return JSON.parse(text);
|
|
187
|
+
}
|
|
188
|
+
function renderDoctorReport(report) {
|
|
189
|
+
const mb = (bytes) => bytes === null ? "unknown" : `${Math.floor(bytes / 1024 / 1024)} MB`;
|
|
190
|
+
const lines = [];
|
|
191
|
+
lines.push(`Machine: ${report.machine.os}-${report.machine.arch} (pack target ${report.machine.target ?? "none"})`);
|
|
192
|
+
lines.push(`Runtime root: ${report.runtimeRoot} \u2014 ${mb(report.freeBytes)} free`);
|
|
193
|
+
lines.push(
|
|
194
|
+
`Updates: ${report.updatePolicy.policy}${report.updatePolicy.source ? ` (from ${report.updatePolicy.source})` : " (default)"}` + (report.updatePolicy.problem ? ` \u2014 ${report.updatePolicy.problem}` : "")
|
|
195
|
+
);
|
|
196
|
+
lines.push(
|
|
197
|
+
`Network: proxy ${report.network.proxy ?? "none"}` + (report.network.noProxy ? `, NO_PROXY ${report.network.noProxy}` : "") + `, extra CA ${report.network.extraCaCerts ?? "none"}`
|
|
198
|
+
);
|
|
199
|
+
lines.push(`Revocations: list ${report.revocations.sequence ?? "not cached"}, ${report.revocations.revoked} revoked`);
|
|
200
|
+
for (const h of report.harnesses) {
|
|
201
|
+
lines.push("");
|
|
202
|
+
lines.push(`${h.harnessId}:`);
|
|
203
|
+
const s = h.selected;
|
|
204
|
+
lines.push(
|
|
205
|
+
s.state === "ready" ? ` runs: ${s.packVersion} (${s.role ?? "desired"}${s.health ? `, ${s.health}` : ""}) ${s.digest.slice(0, 19)}\u2026` : ` runs: nothing (${s.state}${"message" in s && s.message ? `: ${s.message}` : ""})`
|
|
206
|
+
);
|
|
207
|
+
const pack = (label, p) => p === null ? ` ${label}: none` : ` ${label}: ${p.packVersion} ${p.treeDigest.slice(0, 19)}\u2026 \u2014 ${p.installed ? "installed" : "not installed"}, ${p.health}` + (p.revoked ? `, REVOKED (${p.revoked})` : "") + (p.unhealthyReason ? ` \u2014 ${p.unhealthyReason}` : "");
|
|
208
|
+
lines.push(pack("desired", h.desired));
|
|
209
|
+
lines.push(pack("previous", h.permitted));
|
|
210
|
+
lines.push(` compatibility: ${h.compatibility.ok ? "ok" : `${h.compatibility.status} \u2014 ${h.compatibility.message}`}`);
|
|
211
|
+
if (h.lastAttempt) {
|
|
212
|
+
lines.push(
|
|
213
|
+
` last install: ${h.lastAttempt.state}` + (h.lastAttempt.stage ? ` at ${h.lastAttempt.stage}` : "") + (h.lastAttempt.trigger ? ` (${h.lastAttempt.trigger})` : "") + (h.lastAttempt.message && h.lastAttempt.state !== "ready" ? ` \u2014 ${h.lastAttempt.message}` : "")
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
for (const repair of h.repairs) lines.push(` \u2192 ${repair}`);
|
|
217
|
+
}
|
|
218
|
+
return lines.join("\n");
|
|
219
|
+
}
|
|
220
|
+
|
|
8
221
|
// server/harness-install-cli.ts
|
|
9
222
|
var supportedHarnessIds = SUPPORTED_LOCAL_HARNESS_IDS;
|
|
10
223
|
var harnessDisplayNames = {
|
|
@@ -23,15 +236,37 @@ function harnessIdOf(value) {
|
|
|
23
236
|
async function harnessStatus(harnessId) {
|
|
24
237
|
return readRuntimeInstallStatus({ harnessId: harnessIdOf(harnessId) });
|
|
25
238
|
}
|
|
26
|
-
async function harnessInstall(onProgress, harnessId) {
|
|
239
|
+
async function harnessInstall(onProgress, harnessId, options = {}) {
|
|
27
240
|
return installRuntimePack({
|
|
28
241
|
harnessId: harnessIdOf(harnessId),
|
|
242
|
+
// The installers an administrator's `updates: manual` policy leaves on:
|
|
243
|
+
// this command, and pre-provisioning from a local archive.
|
|
244
|
+
trigger: options.fromArchive !== void 0 ? "provision" : "cli",
|
|
245
|
+
...options.fromArchive !== void 0 ? { fromArchive: options.fromArchive } : {},
|
|
29
246
|
...onProgress ? { onProgress } : {}
|
|
30
247
|
});
|
|
31
248
|
}
|
|
249
|
+
async function harnessRepair(onProgress, harnessId, options = {}) {
|
|
250
|
+
return repairRuntime({
|
|
251
|
+
harnessId: harnessIdOf(harnessId),
|
|
252
|
+
...options.fromArchive !== void 0 ? { fromArchive: options.fromArchive } : {},
|
|
253
|
+
...onProgress ? { onProgress } : {}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
async function harnessDoctor(options = {}) {
|
|
257
|
+
const report = await buildDoctorReport({
|
|
258
|
+
...options.harnessId !== void 0 ? { harnessIds: [harnessIdOf(options.harnessId)] } : {},
|
|
259
|
+
...options.verify ? { verify: true } : {}
|
|
260
|
+
});
|
|
261
|
+
const shown = options.exported ? redactDoctorReport(report) : report;
|
|
262
|
+
const healthy = report.harnesses.every((h) => h.repairs.length === 0);
|
|
263
|
+
return { report: shown, text: renderDoctorReport(shown), healthy };
|
|
264
|
+
}
|
|
32
265
|
export {
|
|
33
266
|
harnessDisplayNames,
|
|
267
|
+
harnessDoctor,
|
|
34
268
|
harnessInstall,
|
|
269
|
+
harnessRepair,
|
|
35
270
|
harnessStatus,
|
|
36
271
|
supportedHarnessIds
|
|
37
272
|
};
|