mirror of
https://github.com/morluto/rea.git
synced 2026-10-19 04:19:54 -05:00
feat(kuna): serve procedures, pseudocode and assembly from Kuna exports (#3854)
* feat(kuna): serve procedures, pseudocode and assembly from Kuna exports Register Kuna as a bring-your-own deep-analysis provider. It answers list_documents, list_procedures, search_procedures, procedure_address, address_name, procedure_pseudo_code, procedure_assembly and analyze_function (and batch_decompile through composition) from the verified project export. While a cold export builds in the background, pseudocode comes from a single-function `kuna decompile` run on a private copy and says so; assembly and data names wait for the export. Each answer records its source and file span in raw_result, limitations are scoped per operation, and the session-owned export is stopped on close unless another session still waits for it. The literal/regex procedure search predicate moves from the IDA runner into a shared domain helper. `npm run verify:kuna` adds a real-provider lane with an optional Ghidra comparison. Refs #1957 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(kuna): refuse a Ghidra comparison without caller-built targets Refs #1957 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(kuna): retry owned cleanup and keep answers bound to the opened Kuna - Re-verify the Kuna executable's digest before every launch (memoized by file identity), so no answer names one build while another produced it. - Keep the process supervisor of an unproven stop, and retry it on every later close in both the session and the cache; a failed close keeps failing until the stop is proven instead of reporting success. - Report an abandoned export's retained cleanup from session close. - Forget and rebuild an adopted export whose files another REA process evicted, instead of failing every later read. - Close a private copy whose setup failed, and retry failed removals. - Let the session own the shared quick inventory; each caller only stops waiting when it cancels. - Report a failed export as `failed` with its reason. - Lane: release the MCP client when open_binary rejects a target, and accept either valid source for the first answer. Refs #1957 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(kuna): drain session requests before releasing workspaces Combine caller cancellation with session shutdown and wait for active reads before releasing their process supervisors or private inputs. Retain unproven cleanup for later close attempts. Measure UTF-8 reply bytes without implying model token usage. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> * perf(kuna): keep document metadata reads free of target analysis Listing the selected path no longer initializes the project cache or starts an export that the request never consumes. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> * fix(kuna): reject verification matrices with missing functions Validate requested matrix coverage before building the fixture or opening providers. Empty matrices, unmatched names and partially matched function sets must fail instead of reporting an unperformed comparison as successful. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> * fix(kuna): retain component provenance in function dossiers Record each source facet as one file span and preserve both pseudocode and assembly digests/ranges in combined reports. Keep direct text source fields compatible and verify every combined span through the real MCP lane. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> * fix(kuna): keep retired file cleanup bound to its export Retain the export key with each failed file removal so a cancelled session reports and retries its own stopped resources. Preserve that association across sweeping and process-cleanup recovery without attributing unrelated cache failures to the session. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> * docs(kuna): document the Kuna provider and list it in the catalog (#3855) * docs(kuna): document the Kuna provider and list it in the catalog Add the Kuna provider guide (configuration, answered tools, cold and warm paths, provenance, cache ownership, verification lane), link it from the README and its translations, the CLI, installation and index pages and the site navigation, describe `npm run verify:kuna` in the testing guide, credit Kuna in THIRD_PARTY_NOTICES, teach the agent skill when to select Kuna, and register its identity and operations in the generated product catalog. Refs #1957 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(kuna): state the Linux cache fallback, raw_result scope and comparison inputs Refs #1957 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(kuna): note that cache pins hold within one REA process Refs #1957 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(kuna): describe retired staging and retried cleanup Refs #1957 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * fix(kuna): supervise regex and bind reads to one export Share a cancellable ECMAScript matching worker with Hopper while preserving its error contract. Bind C and assembly indexes to immutable project readers, retry whole dossiers after eviction, and enforce the existing buffered-text capacity before allocating cached spans. Document the verified Linux scope and keep complete exports accessible. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
60 files changed
+4297
-493
No files matched your search
@@ -817,6 +817,34 @@ Native IDA MCP verification uses `"protocol": "native"` with an already-running
|
||||
|
||||
The initial Linux x64 IDA Free 9.4 run used native MCP 1.1.2 with a local navigation correction. Windows x64 verification uses **IDA Pro 9.3**, the two-function public fixture, and the shipped Windows `whoami.exe` application. The native plugin was built from upstream `c9d15d98e8a143fc74f6e14037c48f63889b6d6c`, including the merged navigation fix, with a local loopback-listener change. Production CLI/MCP parity, switching, identity and cleanup passed. Correctness and performance measurements are recorded in the [Windows native verification notes](https://github.com/morluto/rea/blob/main/experiments/analysis-efficiency/ida-native-windows.md). Stock 1.1.2 switching, native macOS, and Windows IDA Free remain unverified. See the [native bridge prerequisites](ida-provider.md#optional-native-ida-mcp-bridge).
|
||||
|
||||
## Kuna lane
|
||||
|
||||
`npm run verify:kuna` requires a caller-supplied `kuna` in `REA_KUNA_COMMAND`
|
||||
and a host C compiler (`REA_CC`, default `cc`) with `strip` and `nm`. It builds a
|
||||
source-owned fixture with symbols and stripped, then verifies through MCP that
|
||||
the first cold pseudocode answer comes from a single-function run or an export
|
||||
that already finished, assembly waits for and serves from that export, and
|
||||
pseudocode and both dossier facets match their recorded file spans and digests,
|
||||
a fresh server reuses the export without rebuilding it, staging is empty after
|
||||
a completed export, and no owned process survives. Pass
|
||||
`--targets DIR --functions a,b` to add caller-built binaries laid out as
|
||||
`DIR/<flavor>/<name>` beside `<name>.stripped`; addresses come from the
|
||||
symbol-bearing build. `--compare-ghidra` with `GHIDRA_INSTALL_DIR` runs those
|
||||
caller-built functions through Ghidra (it refuses to run without `--targets` and
|
||||
`--functions`, an empty matrix, or names missing from every supplied target) and
|
||||
reports latency, sampled process-tree CPU and peak memory, UTF-8 response size,
|
||||
and goto and warning-marker counts. Those counts are not a correctness judgement,
|
||||
and model tokens are not measured. `--report PATH` writes the JSON report.
|
||||
|
||||
The first matrix run used Kuna 1.833 and Ghidra 12.1.4 with JDK 21 on macOS
|
||||
arm64. It covered zlib 1.3.2 `minigzip`, coreutils 9.9 `sort` and the sqlite
|
||||
3.54.0 shell, built at `-O2` for ELF x86-64, ELF AArch64, Mach-O arm64 and
|
||||
Mach-O x86-64, each with symbols and stripped. A separate Linux x86-64 run verified
|
||||
the fixture and system zlib 1.2.13 / SQLite 3.40.1 libraries through MCP, including
|
||||
cached byte spans and a Ghidra comparison. See the [Linux report](https://github.com/morluto/rea/pull/3854#issuecomment-6185870391)
|
||||
for measured scope and limitations. Windows, PE and universal Mach-O remain
|
||||
unverified by this lane.
|
||||
|
||||
## DOS Ghidra analysis
|
||||
|
||||
`npm run verify:ghidra:dos` requires the supported Ghidra and JDK installation
|
||||
|
||||
Reference in new issue
Block a user