Files
reverse-engineering-anything/src/domain/analysisSettings.ts
T
Cursor Agent b0541c80b3 feat(settings): read per-call REA_ limits from the operation snapshot
Part of #9881. Move the limits checked on each call into update_analysis_settings, keep their REA_ seeds and bounds, and reject updates outside the allowed range.
2026-11-11 20:16:24 +08:00

84 lines
3.7 KiB
TypeScript

/** Runtime policy overrides, separate from target state and launch environment. */
export interface AnalysisSettingValues {
readonly "asar.max_header_bytes": number;
readonly "asar.max_listing_bytes": number;
readonly "ghidra.value_flow_max_operations": number;
readonly "ghidra.value_flow_max_inputs_per_operation": number;
readonly "ghidra.value_flow_max_edges": number;
readonly "ghidra.startup_timeout_ms": number;
readonly "hopper.startup_timeout_ms": number;
readonly "ghidra.decompile_timeout_seconds": number | null;
readonly "ghidra.decompile_max_payload_mib": number | null;
readonly "jadx.operation_timeout_ms": number;
readonly "regex.matching_deadline_ms": number;
readonly "regex.worker_heap_request_mib": number;
readonly "capture.decoder_old_generation_mib": number;
readonly "javascript.analysis_timeout_ms": number;
readonly "javascript.max_heap_mb": number;
readonly "wasm.command_timeout_ms": number;
readonly "native.matching_representation_bytes": number;
readonly "bridge.max_request_bytes": number;
readonly "debugger.command_deadline_ms": number;
readonly "debugger.max_command_output_bytes": number;
readonly "hopper.caller_scan_budget_ms": number;
readonly "jeb.mcp_timeout_ms": number;
readonly "kuna.project_timeout_ms": number;
readonly "kuna.function_timeout_ms": number;
readonly "pwntools.max_input_bytes": number;
readonly "windows.change_time_drift_ms": number;
readonly "windows.change_time_settle_poll_ms": number;
readonly "windows.change_time_settle_max_polls": number;
}
export type AnalysisSettingId = keyof AnalysisSettingValues;
export interface AnalysisSettingsSnapshot {
readonly revision: number;
readonly overrides: Readonly<Partial<AnalysisSettingValues>>;
}
/** Injected by the runtime owner; reads the accepted operation's immutable snapshot. */
export type AnalysisSettingsReader = () => AnalysisSettingsSnapshot;
/**
* Whether `update_analysis_settings` can change the active value.
* `runtime` applies inside this process. `restart` stays at the value this
* process already started with. A limit fact uses `parameter` when its value
* is adjustable through a per-call argument; its source is recorded separately.
*/
export type AnalysisSettingUpdateMode = "runtime" | "restart";
/** Limit facts supplied by the failing owner, never inferred from error prose. */
export interface AnalysisSettingLimit {
readonly setting: AnalysisSettingId;
readonly effective_value: number | null;
readonly unit: "bytes" | "ms" | "seconds" | "MiB" | "count";
readonly minimum: number;
readonly maximum: number;
readonly source?: "default" | "setting" | "runtime" | "request";
readonly applies_at: "next_operation" | "next_worker" | "next_startup";
readonly agent_editable: true;
readonly scope: "rea-runtime";
readonly update_mode: AnalysisSettingUpdateMode | "parameter";
/**
* True only when a configured value is not the one this process is using.
* The reported effective value is active, so limit errors leave this false.
*/
readonly pending_restart: false;
readonly required_value?: number;
readonly parameter?: string;
}
/**
* The same limit for a caller whose REA runtime ended with one invocation. No
* runtime override can reach it; a new invocation reads the launch
* environment seed or the per-call argument. The caller can still choose that
* value, and no running REA process needs a restart.
*/
export interface AnalysisInvocationSettingLimit extends Omit<
AnalysisSettingLimit,
"applies_at" | "scope"
> {
readonly applies_at: "next_invocation";
readonly scope: "rea-invocation";
/** Launch-environment seed that a new invocation reads, when one exists. */
readonly environment?: string;
}