@mcpjam/inspector 3.12.9 → 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.
Files changed (56) hide show
  1. package/bin/runtime-profile.mjs +774 -0
  2. package/bin/start.js +138 -19
  3. package/dist/client/assets/OAuthDesktopReturnNotice-BZEaGzn6.css +2 -0
  4. package/dist/client/assets/{OAuthDesktopReturnNotice-DlTJhJwy.js → OAuthDesktopReturnNotice-D7d-faB1.js} +2 -2
  5. package/dist/client/assets/{app-bootstrap-BtbHLWDU.js → app-bootstrap-BtDjj9nz.js} +370 -387
  6. package/dist/client/assets/{button-12hqsTUk.js → button-B99pZFz_.js} +2 -2
  7. package/dist/client/assets/chunk-D32TOXHM-Bcyg0ZVj.js +160 -0
  8. package/dist/client/assets/dead-clicks-autocapture-CnUHv5CB.js +3 -0
  9. package/dist/client/assets/error-reporting-BohBwcQQ.js +120 -0
  10. package/dist/client/assets/{error-reporting-D3byeSLw.js → error-reporting-p6G1ojum.js} +1 -1
  11. package/dist/client/assets/{exception-autocapture-CzpTtsxv.js → exception-autocapture-Q-isBTHp.js} +4 -4
  12. package/dist/client/assets/{failed-request-tracker-CmHxaDPF.js → failed-request-tracker-BBJW8izb.js} +2 -2
  13. package/dist/client/assets/highlighted-body-KQOG7T2V-zsXWRnSM.js +3 -0
  14. package/dist/client/assets/{index-C0SfPmai.js → index-C9oFRqoK.js} +3 -3
  15. package/dist/client/assets/{jszip.min-BmAHHtmZ.js → jszip.min-C86zG41a.js} +2 -2
  16. package/dist/client/assets/mermaid-MCJ5UELQ-DAW4LYwz.js +1 -0
  17. package/dist/client/assets/posthog-recorder-trUd0BXy.js +110 -0
  18. package/dist/client/assets/{preload-helper-B22rzauv.js → preload-helper-Buauuydw.js} +2 -2
  19. package/dist/client/assets/{react-BzkNdoI5.js → react-CZb-kDOs.js} +2 -2
  20. package/dist/client/assets/{rolldown-runtime-BNuWddGb.js → rolldown-runtime-Bkua2_Tb.js} +1 -1
  21. package/dist/client/assets/surveys-BISK_WOT.js +3 -0
  22. package/dist/client/assets/trace-timeline-CRewsP1E.js +71 -0
  23. package/dist/client/assets/{trace-timeline-Bg58ukyI.js → trace-timeline-D-DWE-sO.js} +1 -1
  24. package/dist/client/assets/{web-vitals-D4bU8W1t.js → web-vitals-DqmZ9w02.js} +2 -2
  25. package/dist/client/index.html +8 -8
  26. package/dist/server/authorization-MA42CNYT.js +22 -0
  27. package/dist/server/chunk-7M3XVZCQ.js +381 -0
  28. package/dist/server/{chunk-SH24KJBI.js → chunk-7ZIR7SX7.js} +17 -45
  29. package/dist/server/chunk-C47PTIDS.js +487 -0
  30. package/dist/server/chunk-DHRTCKJA.js +3979 -0
  31. package/dist/server/chunk-HJTKF2X6.js +45 -0
  32. package/dist/server/{chunk-DGAFFBDM.js → chunk-KNO4KZJF.js} +728 -682
  33. package/dist/server/{chunk-4PYR7GMQ.js → chunk-RWFTW2EW.js} +7 -5
  34. package/dist/server/chunk-SDWJSPSI.js +252 -0
  35. package/dist/server/chunk-VFRLMHOC.js +33 -0
  36. package/dist/server/chunk-XSQ2GC45.js +438 -0
  37. package/dist/server/chunk-YQ2BTE46.js +88 -0
  38. package/dist/server/{consent-lifetime-M7PS6RUU.js → consent-lifetime-OXQM37RV.js} +4 -3
  39. package/dist/server/grants-UVE62NGN.js +37 -0
  40. package/dist/server/harness-install-cli.js +259 -7
  41. package/dist/server/index.js +14252 -12005
  42. package/dist/server/local-turn-XSUGEKTL.js +19 -0
  43. package/dist/server/runtime-health-TCF3ZEKS.js +28 -0
  44. package/dist/server/runtime-lifecycle-YQ3KWDLJ.js +53 -0
  45. package/package.json +62 -59
  46. package/dist/client/assets/OAuthDesktopReturnNotice-FnFv52Ym.css +0 -2
  47. package/dist/client/assets/chunk-YOKDWASO--Bd-6XAf.js +0 -145
  48. package/dist/client/assets/dead-clicks-autocapture-RCao2exY.js +0 -3
  49. package/dist/client/assets/error-reporting-StyhxjHz.js +0 -102
  50. package/dist/client/assets/highlighted-body-KPVGNVTW-BweERQbm.js +0 -3
  51. package/dist/client/assets/mermaid-HWGCJPDP-C6s_jIuz.js +0 -1
  52. package/dist/client/assets/posthog-recorder-wc41pimR.js +0 -110
  53. package/dist/client/assets/surveys-D-NcCeqw.js +0 -3
  54. package/dist/client/assets/trace-timeline-CxoCCEiW.js +0 -137
  55. package/dist/server/chunk-WZVZ6LQX.js +0 -2876
  56. package/dist/server/local-turn-ZWMMQGV3.js +0 -12
@@ -1,21 +1,273 @@
1
1
  import {
2
+ LOCAL_HARNESS_MANIFEST,
3
+ describeInstallerNetwork,
4
+ expectedPackFor,
2
5
  installRuntimePack,
3
- readRuntimeInstallStatus
4
- } from "./chunk-WZVZ6LQX.js";
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";
5
33
  import "./chunk-PZ5AY32C.js";
6
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
+
7
221
  // server/harness-install-cli.ts
8
- async function harnessStatus() {
9
- return readRuntimeInstallStatus({ harnessId: "claude-code" });
222
+ var supportedHarnessIds = SUPPORTED_LOCAL_HARNESS_IDS;
223
+ var harnessDisplayNames = {
224
+ "claude-code": "Claude Code",
225
+ codex: "Codex"
226
+ };
227
+ function harnessIdOf(value) {
228
+ const id = value ?? "claude-code";
229
+ if (!SUPPORTED_LOCAL_HARNESS_IDS.includes(id)) {
230
+ throw new Error(
231
+ `unknown harness ${JSON.stringify(id)} (expected one of ${SUPPORTED_LOCAL_HARNESS_IDS.join(", ")})`
232
+ );
233
+ }
234
+ return id;
10
235
  }
11
- async function harnessInstall(onProgress) {
236
+ async function harnessStatus(harnessId) {
237
+ return readRuntimeInstallStatus({ harnessId: harnessIdOf(harnessId) });
238
+ }
239
+ async function harnessInstall(onProgress, harnessId, options = {}) {
12
240
  return installRuntimePack({
13
- harnessId: "claude-code",
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 } : {},
246
+ ...onProgress ? { onProgress } : {}
247
+ });
248
+ }
249
+ async function harnessRepair(onProgress, harnessId, options = {}) {
250
+ return repairRuntime({
251
+ harnessId: harnessIdOf(harnessId),
252
+ ...options.fromArchive !== void 0 ? { fromArchive: options.fromArchive } : {},
14
253
  ...onProgress ? { onProgress } : {}
15
254
  });
16
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
+ }
17
265
  export {
266
+ harnessDisplayNames,
267
+ harnessDoctor,
18
268
  harnessInstall,
19
- harnessStatus
269
+ harnessRepair,
270
+ harnessStatus,
271
+ supportedHarnessIds
20
272
  };
21
273
  //# sourceMappingURL=harness-install-cli.js.map