* fix(mcp): name response-byte and startup ceilings in recovery Name REA_MCP_MAX_RESPONSE_BYTES, its effective value, the 10485760 byte floor, and process restart when the stdio response budget is hit, and state that the setting does not raise Node's string ceiling. Name fixed MCP startup phase budgets when those deadlines fire, and keep Codex's 30 second startup figure as client guidance. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(mcp): distinguish string ceilings and keep dossier recovery Name REA's reserved string limit separately from Node's ceiling, restore detail:summary discovery for an oversized complete evidence bundle, and apply the doctor deadline sentence when binary_session itself times out. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(mcp): keep retained SDK errors inside the text budget Quoted SDK validation diagnostics expand when recovery JSON is escaped into MCP text. Shorten only that preview so the retained-evidence reference still arrives as parseable error content. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(mcp): keep export advice when a summary exceeds the response budget An oversized get_evidence_bundle summary no longer repeats detail: summary. export_evidence_bundle still writes the retained bundle outside one MCP frame, including when a larger byte budget cannot raise the string ceiling. Co-authored-by: morluto <morluto@users.noreply.github.com> * style(mcp): format the SDK diagnostic preview return oxfmt rejected the fitted-preview ternary in EvidenceMcpServer.ts, which failed Static checks and the CI required gate. 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>
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
interface McpStartupPolicy {
|
|
readonly initializeBudgetMs: number;
|
|
readonly toolsListBudgetMs: number;
|
|
readonly firstCatalogBudgetMs: number;
|
|
readonly doctorDeadlineMs: number;
|
|
}
|
|
|
|
interface McpProcessOptions {
|
|
readonly command: string;
|
|
readonly args: readonly string[];
|
|
readonly environment: Readonly<Record<string, string | undefined>>;
|
|
readonly policy: McpStartupPolicy;
|
|
}
|
|
|
|
interface McpModuleProfileOptions extends McpProcessOptions {
|
|
readonly packageName: string;
|
|
}
|
|
|
|
interface RssMeasurement {
|
|
readonly supported: boolean;
|
|
readonly method: string | null;
|
|
readonly peak_bytes: number | null;
|
|
}
|
|
|
|
/** Measure the first usable MCP catalog through a child-process boundary. */
|
|
export function measureMcpStartup(options: McpProcessOptions): Promise<{
|
|
readonly process_started_to_initialized_ms: number;
|
|
readonly initialized_to_tools_list_ms: number;
|
|
readonly process_started_to_tools_list_ms: number;
|
|
readonly listed_tool_count: number;
|
|
readonly rss: RssMeasurement;
|
|
}>;
|
|
|
|
/** Profile ESM file loading in a separate diagnostic MCP child. */
|
|
export function profileMcpModuleLoading(
|
|
options: McpModuleProfileOptions,
|
|
): Promise<{
|
|
readonly supported: true;
|
|
readonly method: "node-debug-esm";
|
|
readonly unique_file_modules: number;
|
|
readonly unique_package_modules: number;
|
|
readonly unique_dependency_modules: number;
|
|
readonly debug_lines: number;
|
|
readonly truncated: boolean;
|
|
}>;
|
|
|
|
/** Parse Linux procfs VmRSS text into bytes. */
|
|
export function parseLinuxVmRssBytes(status: string): number | null;
|
|
|
|
/** Name a fixed MCP startup phase budget. Mirrors `fixedMcpPhaseBudgetRecovery`. */
|
|
export function fixedMcpStartupPhaseBudgetRecovery(
|
|
phase: string,
|
|
value: number,
|
|
unit: "ms" | "bytes",
|
|
): string;
|
|
|
|
/** Collect unique file-backed ESM module URLs from Node diagnostics. */
|
|
export function createEsmModuleProfileCollector(packageName?: string): {
|
|
append(chunk: string): void;
|
|
result(): {
|
|
readonly supported: true;
|
|
readonly method: "node-debug-esm";
|
|
readonly unique_file_modules: number;
|
|
readonly unique_package_modules: number;
|
|
readonly unique_dependency_modules: number;
|
|
readonly debug_lines: number;
|
|
readonly truncated: boolean;
|
|
};
|
|
};
|