2026-07-22 20:38:26 +08:00
|
|
|
import type { DoctorProviderInspection } from "./Doctor.js";
|
2026-10-11 10:10:01 -07:00
|
|
|
import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";
|
2026-07-22 20:38:26 +08:00
|
|
|
|
2026-10-15 05:16:08 +08:00
|
|
|
const SELECTED_REGISTRATION_SETTINGS = [
|
|
|
|
|
"REA_ANALYSIS_PROVIDER",
|
2026-10-22 23:52:21 +08:00
|
|
|
"REA_CAPTURE_DECODER_OLD_GENERATION_MIB",
|
2026-10-15 05:16:08 +08:00
|
|
|
"REA_GHIDRA_STARTUP_TIMEOUT_MS",
|
|
|
|
|
"REA_HOPPER_STARTUP_TIMEOUT_MS",
|
|
|
|
|
"REA_JEB_MCP_TIMEOUT_MS",
|
|
|
|
|
"REA_MCP_INPUT_SCHEMA_PROFILE",
|
2026-10-22 17:10:51 +08:00
|
|
|
"REA_REGEX_MATCHING_DEADLINE_MS",
|
2026-10-22 23:43:13 +08:00
|
|
|
"REA_REGEX_WORKER_HEAP_REQUEST_MIB",
|
2026-10-22 23:54:01 +08:00
|
|
|
"REA_MCP_INITIALIZE_BUDGET_MS",
|
|
|
|
|
"REA_MCP_TOOLS_LIST_BUDGET_MS",
|
|
|
|
|
"REA_MCP_FIRST_CATALOG_BUDGET_MS",
|
|
|
|
|
"REA_MCP_DOCTOR_DEADLINE_MS",
|
2026-10-15 05:16:08 +08:00
|
|
|
] as const;
|
|
|
|
|
|
|
|
|
|
/** Preserve selected setup settings without copying unrelated process values. */
|
|
|
|
|
export const explicitSetupRegistrationEnvironment = (
|
|
|
|
|
environment: Readonly<Record<string, string | undefined>>,
|
|
|
|
|
): Readonly<Record<string, string>> =>
|
|
|
|
|
Object.fromEntries(
|
|
|
|
|
SELECTED_REGISTRATION_SETTINGS.flatMap((key) => {
|
|
|
|
|
const value = environment[key];
|
|
|
|
|
return value === undefined ? [] : [[key, value]];
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
2026-10-06 16:53:33 +08:00
|
|
|
/** Preserve adapter-published settings independently of runtime readiness. */
|
2026-07-22 20:38:26 +08:00
|
|
|
export const providerRegistrationEnvironment = (
|
|
|
|
|
inspections: readonly DoctorProviderInspection[],
|
|
|
|
|
): Readonly<Record<string, string>> =>
|
|
|
|
|
Object.fromEntries(
|
|
|
|
|
inspections
|
|
|
|
|
.flatMap(({ registrationEnvironment }) =>
|
|
|
|
|
Object.entries(registrationEnvironment),
|
|
|
|
|
)
|
2026-10-11 10:10:01 -07:00
|
|
|
.sort(([left], [right]) => compareUnicodeCodePoints(left, right)),
|
2026-07-22 20:38:26 +08:00
|
|
|
);
|