mirror of
https://github.com/morluto/rea.git
synced 2026-11-13 10:12:50 +00:00
* feat(config): make the regex matching deadline configurable REA_REGEX_MATCHING_DEADLINE_MS defaults to 5000 ms and refuses values outside 1..2147483647. Recovery and capability text name the effective deadline, its source, and how to change the setting. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(setup): preserve the regex matching deadline in registrations Setup validated REA_REGEX_MATCHING_DEADLINE_MS but left it out of the selected registration environment, so a caller override never reached the launched server and matching fell back to 5000 ms. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(config): restore a stubbed regex matching deadline on failure Kuna deadline assertions now unstub the environment in finally, so a thrown construction or expectation cannot leave the setting stubbed. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com>
35 lines
1.2 KiB
TypeScript
35 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",
|
|
"REA_REGEX_MATCHING_DEADLINE_MS",
|
|
] 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)),
|
|
);
|