Files
rea/src/ida/IdaProviderCapabilities.ts
T
Kaoru0822andClaude Opus 5.5 cf692072b5 fix(ida): declare GUI navigation for attached legacy analysis (#1764)
Attached IDA mode always uses the legacy 1.4 producer, whose
disassemble_function jumps to the function and whose decompile_function
opens or reuses a pseudocode view whenever an IDA window is active.
Session discovery still advertised may_show_ui: false for every
operation.

Declare the UI effect for the attached operations that reach those
tools: pseudocode, assembly, raw function instructions and the function
dossier. Headless operations and the other attached operations keep
false. A conformance check now compares each declaration with the
upstream tools the operation actually calls.

Fixes #1712

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 01:36:56 -07:00

81 lines
3.4 KiB
TypeScript

import type {
AnalysisOperation,
CapabilityDescriptor,
} from "../application/AnalysisProvider.js";
/** This version identifies REA's adapter, not IDA or the upstream Python package. */
export const IDA_PROVIDER_IDENTITY = Object.freeze({
id: "ida",
name: "IDA Pro MCP adapter",
version: "1",
});
/** Read-only analyst outcomes supported by both upstream compatibility profiles. */
export const IDA_OPERATIONS = Object.freeze([
"list_procedures",
"search_procedures",
"list_strings",
"search_strings",
"procedure_address",
"procedure_pseudo_code",
"procedure_assembly",
"procedure_callers",
"procedure_callees",
"read_function_instructions",
"xrefs",
"analyze_function",
] as const satisfies readonly Exclude<AnalysisOperation, "health">[]);
export type IdaOperation = (typeof IDA_OPERATIONS)[number];
/** Shared limitations of observations from an externally mutable analysis database. */
export const IDA_LIMITATIONS = Object.freeze([
"Provider version identifies the REA IDA adapter. IDA engine and upstream distribution versions are unknown unless separately observed; MCP serverInfo is reported independently.",
"Results describe the current IDA analysis database. Input identity does not prove an unmodified database; patches, annotations, analysis completeness, and database revision remain unknown.",
"Live results are never replayed from analysis snapshots. Target checks before and after a request do not provide an atomic lock against external GUI changes.",
"Caller cancellation drains the in-flight MCP request before cleanup; it does not prove that IDA engine work was interrupted.",
"Headless workers are released through the upstream database lifecycle. Abrupt termination of REA, its proxy, or the supervisor cannot prove worker cleanup; inspect upstream inventory after an interrupted process.",
"Complete function body ranges, typed references, unresolved indirect calls, referenced data, and basic blocks are unavailable in this adapter. Empty unsupported dossier facets are unknown, not observed absence.",
]);
/**
* Attached mode requires the legacy 1.4 profile, whose `disassemble_function`
* jumps to the function and whose `decompile_function` opens or reuses a
* pseudocode view whenever an IDA window is active.
*/
const ATTACHED_GUI_NAVIGATION_OPERATIONS: ReadonlySet<IdaOperation> = new Set([
"procedure_pseudo_code",
"procedure_assembly",
"read_function_instructions",
"analyze_function",
]);
/** Advertise live observations and configured lifecycle effects truthfully. */
export const idaCapabilities = (
mode: "attached" | "headless",
stdio: boolean,
): readonly CapabilityDescriptor[] =>
IDA_OPERATIONS.map((operation) => ({
provider: IDA_PROVIDER_IDENTITY,
operation,
...(mode === "headless" && operation === "procedure_callers"
? ({
available: false,
reason:
"The modern upstream profile reports code references without proving direct call edges.",
} as const)
: ({ available: true, reason: null } as const)),
cachePolicy: "live",
effects: {
mutatesArtifact: false,
launchesProcess: stdio || mode === "headless",
mayShowUi:
mode === "attached" &&
ATTACHED_GUI_NAVIGATION_OPERATIONS.has(operation),
mayAccessNetwork: true,
mayWriteFilesystem: stdio || mode === "headless",
changesPermissions: false,
requiresRoot: false,
},
limitations: IDA_LIMITATIONS,
}));