@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
package/bin/start.js
CHANGED
|
@@ -5,7 +5,7 @@ import { spawn } from "child_process";
|
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
6
6
|
import { createServer, createConnection } from "net";
|
|
7
7
|
import { execSync } from "child_process";
|
|
8
|
-
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
9
9
|
import open from "open";
|
|
10
10
|
import {
|
|
11
11
|
createLaunchToken,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
networkAccessLinks,
|
|
15
15
|
} from "./access-link.mjs";
|
|
16
16
|
import { launchWorkspaceCandidate } from "./launch-workspace.mjs";
|
|
17
|
+
import { computeInstanceEnv } from "./runtime-profile.mjs";
|
|
17
18
|
|
|
18
19
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
20
|
|
|
@@ -435,29 +436,52 @@ async function setupOllamaInSingleTerminal(model) {
|
|
|
435
436
|
}
|
|
436
437
|
|
|
437
438
|
/**
|
|
438
|
-
* `mcpjam-inspector harness install
|
|
439
|
-
* runtime
|
|
439
|
+
* `mcpjam-inspector harness <install|status|doctor|repair>` — the local-harness
|
|
440
|
+
* runtime, from a terminal.
|
|
440
441
|
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
442
|
+
* install [--harness <id>] [--from <archive>] download (or, with --from,
|
|
443
|
+
* pre-provision from a local signed archive, no network) and verify
|
|
444
|
+
* status [--harness <id>] the selected runtime, as JSON
|
|
445
|
+
* doctor [--harness <id>] [--json] [--verify] [--export <file>]
|
|
446
|
+
* what runs, what is installed, the last failure and its stage, disk,
|
|
447
|
+
* proxy, update policy, and the repair to run; --export writes it
|
|
448
|
+
* redacted (no home path, no credential) for a support ticket
|
|
449
|
+
* repair [--harness <id>] [--from <archive>] re-verify, reinstall if
|
|
450
|
+
* corrupt, clear staging, re-probe an unhealthy runtime
|
|
451
|
+
*
|
|
452
|
+
* Subcommands rather than server flags, and handled before the server spawn:
|
|
453
|
+
* nothing about starting the Inspector installs a runtime by itself here.
|
|
444
454
|
*/
|
|
445
455
|
async function runHarnessSubcommand(args) {
|
|
446
456
|
const action = args[1];
|
|
447
|
-
const usage =
|
|
448
|
-
|
|
457
|
+
const usage =
|
|
458
|
+
"usage: mcpjam-inspector harness <install|status|doctor|repair> [--harness <id>] " +
|
|
459
|
+
"[--from <archive>] [--json] [--verify] [--export <file>]";
|
|
460
|
+
if (!["install", "status", "doctor", "repair"].includes(action)) {
|
|
449
461
|
logError(usage);
|
|
450
462
|
return 2;
|
|
451
463
|
}
|
|
452
|
-
// Which harness's pack. Omitted means Claude Code
|
|
464
|
+
// Which harness's pack. Omitted means Claude Code for install/status/repair
|
|
465
|
+
// (as it always did) and every harness for doctor.
|
|
453
466
|
let harnessId;
|
|
467
|
+
let fromArchive;
|
|
468
|
+
let exportPath;
|
|
469
|
+
let json = false;
|
|
470
|
+
let verify = false;
|
|
454
471
|
for (let i = 2; i < args.length; i++) {
|
|
455
472
|
const arg = args[i];
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
473
|
+
const value = (name) => {
|
|
474
|
+
if (arg === `--${name}` && typeof args[i + 1] === "string") return args[++i];
|
|
475
|
+
if (arg.startsWith(`--${name}=`)) return arg.slice(name.length + 3);
|
|
476
|
+
return undefined;
|
|
477
|
+
};
|
|
478
|
+
let v;
|
|
479
|
+
if ((v = value("harness")) !== undefined) harnessId = v;
|
|
480
|
+
else if ((v = value("from")) !== undefined && (action === "install" || action === "repair")) fromArchive = resolve(v);
|
|
481
|
+
else if ((v = value("export")) !== undefined && action === "doctor") exportPath = resolve(v);
|
|
482
|
+
else if (arg === "--json" && (action === "doctor" || action === "status")) json = true;
|
|
483
|
+
else if (arg === "--verify" && action === "doctor") verify = true;
|
|
484
|
+
else {
|
|
461
485
|
logError(usage);
|
|
462
486
|
return 2;
|
|
463
487
|
}
|
|
@@ -506,8 +530,13 @@ async function runHarnessSubcommand(args) {
|
|
|
506
530
|
);
|
|
507
531
|
return 2;
|
|
508
532
|
}
|
|
533
|
+
if (fromArchive !== undefined && !existsSync(fromArchive)) {
|
|
534
|
+
logError(`no archive at ${fromArchive}`);
|
|
535
|
+
return 2;
|
|
536
|
+
}
|
|
509
537
|
const harnessName =
|
|
510
538
|
mod?.harnessDisplayNames?.[harnessId ?? "claude-code"] ?? "Claude Code";
|
|
539
|
+
const harnessFlag = harnessId ? ` --harness ${harnessId}` : "";
|
|
511
540
|
|
|
512
541
|
if (action === "status") {
|
|
513
542
|
const current = await status(harnessId);
|
|
@@ -515,19 +544,58 @@ async function runHarnessSubcommand(args) {
|
|
|
515
544
|
return current.state === "ready" ? 0 : 1;
|
|
516
545
|
}
|
|
517
546
|
|
|
518
|
-
|
|
547
|
+
if (action === "doctor") {
|
|
548
|
+
if (typeof mod?.harnessDoctor !== "function") {
|
|
549
|
+
logError("this Inspector build has no `harness doctor`");
|
|
550
|
+
return 1;
|
|
551
|
+
}
|
|
552
|
+
const exported = exportPath !== undefined;
|
|
553
|
+
const result = await mod.harnessDoctor({ harnessId, verify, exported });
|
|
554
|
+
if (exported) {
|
|
555
|
+
writeFileSync(exportPath, `${JSON.stringify(result.report, null, 2)}\n`, { mode: 0o600 });
|
|
556
|
+
logSuccess(`Wrote a redacted report to ${exportPath}`);
|
|
557
|
+
}
|
|
558
|
+
if (json) log(JSON.stringify(result.report, null, 2));
|
|
559
|
+
else if (!exported) log(result.text);
|
|
560
|
+
return result.healthy ? 0 : 1;
|
|
561
|
+
}
|
|
562
|
+
|
|
519
563
|
let lastPercent = -1;
|
|
520
|
-
const
|
|
564
|
+
const onProgress = (progress) => {
|
|
521
565
|
if (progress.state === "downloading" && progress.percent !== lastPercent) {
|
|
522
566
|
lastPercent = progress.percent;
|
|
523
567
|
process.stdout.write(`\r downloading ${progress.percent}% `);
|
|
524
568
|
} else if (progress.state === "verifying") {
|
|
525
569
|
process.stdout.write("\r verifying… ");
|
|
526
570
|
}
|
|
527
|
-
}
|
|
528
|
-
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
let result;
|
|
574
|
+
if (action === "repair") {
|
|
575
|
+
if (typeof mod?.harnessRepair !== "function") {
|
|
576
|
+
logError("this Inspector build has no `harness repair`");
|
|
577
|
+
return 1;
|
|
578
|
+
}
|
|
579
|
+
logStep("1", `Repairing the local ${harnessName} runtime`);
|
|
580
|
+
const repaired = await mod.harnessRepair(onProgress, harnessId, fromArchive ? { fromArchive } : {});
|
|
581
|
+
process.stdout.write("\r");
|
|
582
|
+
for (const done of repaired.actions) logInfo(done);
|
|
583
|
+
result = repaired.status;
|
|
584
|
+
} else {
|
|
585
|
+
logStep(
|
|
586
|
+
"1",
|
|
587
|
+
fromArchive
|
|
588
|
+
? `Installing the local ${harnessName} runtime pack from ${fromArchive} (no network)`
|
|
589
|
+
: `Installing the local ${harnessName} runtime pack`,
|
|
590
|
+
);
|
|
591
|
+
result = await install(onProgress, harnessId, fromArchive ? { fromArchive } : {});
|
|
592
|
+
process.stdout.write("\r");
|
|
593
|
+
}
|
|
529
594
|
if (result.state === "ready") {
|
|
530
|
-
logSuccess(
|
|
595
|
+
logSuccess(
|
|
596
|
+
`Runtime pack ${result.packVersion} ${action === "repair" ? "is usable" : "installed and verified"}` +
|
|
597
|
+
(result.role === "permitted" ? " (the previous pack; the current one is not installed)" : ""),
|
|
598
|
+
);
|
|
531
599
|
return 0;
|
|
532
600
|
}
|
|
533
601
|
// The reason, where the installer could establish one. Each of these sends a
|
|
@@ -535,24 +603,28 @@ async function runHarnessSubcommand(args) {
|
|
|
535
603
|
// bad artifact — so collapsing them into "it failed" is what makes an
|
|
536
604
|
// installer message useless.
|
|
537
605
|
const REASONS = {
|
|
538
|
-
network:
|
|
606
|
+
network:
|
|
607
|
+
"the runtime could not be downloaded (behind a proxy? set HTTPS_PROXY, " +
|
|
608
|
+
"and NODE_EXTRA_CA_CERTS for a TLS-inspecting one)",
|
|
539
609
|
verification:
|
|
540
|
-
"the
|
|
541
|
-
"
|
|
610
|
+
"the runtime did not match what this Inspector expected, so it was not " +
|
|
611
|
+
"installed",
|
|
542
612
|
disk: "the runtime could not be written to its install location",
|
|
613
|
+
probe: "the runtime verified but this Inspector could not start on it",
|
|
543
614
|
unknown: "the install did not complete",
|
|
544
615
|
};
|
|
545
616
|
if (result.state === "failed") {
|
|
546
617
|
logError(
|
|
547
618
|
`${REASONS[result.reason] ?? REASONS.unknown}` +
|
|
619
|
+
(result.stage ? ` [stage: ${result.stage}]` : "") +
|
|
548
620
|
(result.message ? `: ${result.message}` : ""),
|
|
549
621
|
);
|
|
550
|
-
logInfo(`Run \`mcpjam-inspector harness
|
|
622
|
+
logInfo(`Run \`mcpjam-inspector harness doctor${harnessFlag}\` for what to do next.`);
|
|
551
623
|
return 1;
|
|
552
624
|
}
|
|
553
625
|
if (result.state === "interrupted") {
|
|
554
626
|
logError("Setup was interrupted before it finished.");
|
|
555
|
-
logInfo(`Run \`mcpjam-inspector harness
|
|
627
|
+
logInfo(`Run \`mcpjam-inspector harness ${action}${harnessFlag}\` again to continue.`);
|
|
556
628
|
return 1;
|
|
557
629
|
}
|
|
558
630
|
logError(
|
|
@@ -947,6 +1019,27 @@ async function main() {
|
|
|
947
1019
|
process.env.ENVIRONMENT === "dev" ? "localhost" : "127.0.0.1";
|
|
948
1020
|
const baseHost = process.env.HOST || defaultHost;
|
|
949
1021
|
envVars.BASE_URL = `http://${baseHost}:${PORT}`;
|
|
1022
|
+
// This instance's own addresses. The packaged server serves the app
|
|
1023
|
+
// itself, so the browser port IS the server port: it names this
|
|
1024
|
+
// instance's session namespace, and the public callback origins (CLI
|
|
1025
|
+
// login, Slack/Discord linking) follow it. A configured NON-loopback
|
|
1026
|
+
// origin is a deliberate public deployment and is kept; a loopback one
|
|
1027
|
+
// from another port never survives `--port`.
|
|
1028
|
+
const instanceEnv = computeInstanceEnv({
|
|
1029
|
+
ports: { server: Number(PORT) },
|
|
1030
|
+
browserPort: Number(PORT),
|
|
1031
|
+
host: baseHost,
|
|
1032
|
+
profile: process.env,
|
|
1033
|
+
});
|
|
1034
|
+
for (const key of [
|
|
1035
|
+
"MCPJAM_BROWSER_PORT",
|
|
1036
|
+
"CLI_AUTH_PUBLIC_ORIGIN",
|
|
1037
|
+
"SLACK_LINK_PUBLIC_ORIGIN",
|
|
1038
|
+
"DISCORD_LINK_PUBLIC_ORIGIN",
|
|
1039
|
+
]) {
|
|
1040
|
+
envVars[key] = instanceEnv[key];
|
|
1041
|
+
}
|
|
1042
|
+
verboseInfo(`Browser origin ${envVars.CLI_AUTH_PUBLIC_ORIGIN}`);
|
|
950
1043
|
Object.assign(process.env, envVars);
|
|
951
1044
|
} catch (error) {
|
|
952
1045
|
logError(`Port configuration failed: ${error.message}`);
|