mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import type { DoctorProviderInspection } from "./Doctor.js";
|
|
import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";
|
|
|
|
const SELECTED_REGISTRATION_SETTINGS = [
|
|
"REA_ANALYSIS_PROVIDER",
|
|
"REA_GHIDRA_STARTUP_TIMEOUT_MS",
|
|
"REA_HOPPER_STARTUP_TIMEOUT_MS",
|
|
"REA_JEB_MCP_TIMEOUT_MS",
|
|
"REA_MCP_INPUT_SCHEMA_PROFILE",
|
|
] 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]];
|
|
}),
|
|
);
|
|
|
|
/** Preserve adapter-published settings independently of runtime readiness. */
|
|
export const providerRegistrationEnvironment = (
|
|
inspections: readonly DoctorProviderInspection[],
|
|
): Readonly<Record<string, string>> =>
|
|
Object.fromEntries(
|
|
inspections
|
|
.flatMap(({ registrationEnvironment }) =>
|
|
Object.entries(registrationEnvironment),
|
|
)
|
|
.sort(([left], [right]) => compareUnicodeCodePoints(left, right)),
|
|
);
|