mirror of
https://github.com/morluto/rea.git
synced 2026-10-28 18:35:53 +00:00
* feat(mcp): make MCP startup phase budgets configurable REA_MCP_INITIALIZE_BUDGET_MS, REA_MCP_TOOLS_LIST_BUDGET_MS, REA_MCP_FIRST_CATALOG_BUDGET_MS, and REA_MCP_DOCTOR_DEADLINE_MS keep today's defaults and refuse values outside 1 to 2147483647 ms. Codex's 30 second startup figure stays client guidance. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(mcp): enforce the first-catalog budget while phases are pending The packaged startup probe applied each phase timeout on its own and checked REA_MCP_FIRST_CATALOG_BUDGET_MS only after both requests finished. A shorter first-catalog budget now clamps the in-flight request and cancels it from one deadline measured at startup. 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>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import type { DoctorProviderInspection } from "./Doctor.js";
|
|
import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";
|
|
|
|
const SELECTED_REGISTRATION_SETTINGS = [
|
|
"REA_ANALYSIS_PROVIDER",
|
|
"REA_CAPTURE_DECODER_OLD_GENERATION_MIB",
|
|
"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",
|
|
"REA_REGEX_WORKER_HEAP_REQUEST_MIB",
|
|
"REA_MCP_INITIALIZE_BUDGET_MS",
|
|
"REA_MCP_TOOLS_LIST_BUDGET_MS",
|
|
"REA_MCP_FIRST_CATALOG_BUDGET_MS",
|
|
"REA_MCP_DOCTOR_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)),
|
|
);
|