Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership. Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers. BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
70 lines
2.7 KiB
TypeScript
70 lines
2.7 KiB
TypeScript
import {
|
|
systemDoctorHost,
|
|
type DoctorCheck,
|
|
type DoctorHost,
|
|
} from "./application/Doctor.js";
|
|
import { fileURLToPath } from "node:url";
|
|
import { inspectSystemGhidraProvider } from "./ghidra/GhidraDoctor.js";
|
|
import { inspectIdaRegistration } from "./ida/IdaDoctor.js";
|
|
import { selectLinuxPrivateDisplayStrategy } from "./hopper/LinuxPrivateDisplayProbe.js";
|
|
|
|
/** Compose provider diagnostics at the outer CLI adapter boundary. */
|
|
export const createSystemDoctorHost = (
|
|
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
|
): DoctorHost =>
|
|
systemDoctorHost({
|
|
environment,
|
|
providerInspections: async () => [
|
|
await inspectSystemGhidraProvider(environment),
|
|
inspectIdaRegistration(environment.REA_IDA_MCP_CONFIG),
|
|
],
|
|
linuxDemoRuntimeCheck: () => inspectLinuxPrivateDisplay(environment),
|
|
});
|
|
|
|
const HOPPER_DEMO_HELPER_PATH = fileURLToPath(
|
|
new URL("../scripts/hopper-demo-x11.py", import.meta.url),
|
|
);
|
|
|
|
const inspectLinuxPrivateDisplay = async (
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
): Promise<DoctorCheck> => {
|
|
const selection = await selectLinuxPrivateDisplayStrategy({
|
|
helperPath: HOPPER_DEMO_HELPER_PATH,
|
|
environment,
|
|
});
|
|
const value = selection.diagnostic;
|
|
const detail = [
|
|
`strategy=${selection.strategy}`,
|
|
`socket_directory=${value.socket_directory}`,
|
|
`mode=${value.socket_directory_mode ?? "unknown"}`,
|
|
`mount_read_only=${String(value.mount_read_only)}`,
|
|
`effective_mode=${value.effective_socket_directory_mode ?? "unknown"}`,
|
|
`effective_mount_read_only=${String(value.effective_mount_read_only)}`,
|
|
`wsl=${String(value.wsl)}`,
|
|
].join("; ");
|
|
if (selection.ok)
|
|
return {
|
|
name: "hopper-demo-runtime",
|
|
ok: true,
|
|
classification: "healthy",
|
|
detail,
|
|
details: { private_display: { ...value } },
|
|
};
|
|
const missingDependency =
|
|
value.failure_code === "runtime_dependency_unavailable" ||
|
|
value.failure_code === "x11_authorization_failed";
|
|
return {
|
|
name: "hopper-demo-runtime",
|
|
ok: false,
|
|
classification: missingDependency ? "missing_dependency" : "config_drift",
|
|
detail,
|
|
details: { private_display: { ...value } },
|
|
remediation:
|
|
value.failure_code === "x11_socket_directory_unusable"
|
|
? "Enable unprivileged user and mount namespaces, or provide a writable mode-1777 /tmp/.X11-unix directory. Do not mutate the current host mount with sudo; then rerun rea doctor --provider hopper."
|
|
: missingDependency
|
|
? "Install Xvfb, xauth, Python 3, libX11, and libXtst, then rerun rea doctor --provider hopper."
|
|
: "Inspect the private-display diagnostic, correct the reported local condition, and rerun rea doctor --provider hopper.",
|
|
};
|
|
};
|