Compare commits

...
Author SHA1 Message Date
279cca0828 experiment(re): validate guard slices and record token tradeoffs
Verify three repaired zlib mappings, a SQLite call guard and all ordinary 16-bit header values against retained native evidence. Record producer omissions, failed-run costs and the small-function context counterexample. Preserve existing capture outputs with exclusive writes.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-16 02:40:13 +00:00
bf86511477 experiment(re): compose native SSA uses and branch dependencies
Retain bounded native snapshots and public MCP evidence, then query explicit SSA relations without interpreting reconstructed C. Preserve unknown flow, cloned block identity and dependency frontiers.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-16 02:27:32 +00:00
500e5bb4be experiment(re): distinguish point facts from object selectors
Apply the interior-reference counterexample to the facade: label exact-address scope and emit location endpoints while preserving caller selectors separately. Carry canonical target-content provenance through experimental MCP replies and verify it on the real client. Keep original measurements pinned to the v1 response shape. Nine experiment checks and real Kuna lifecycle/context checks pass.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 17:21:05 +00:00
3e747586b4 experiment(re): record native sharing and composition counterexamples
Measure twelve equivalent MCP navigation workflows, native reference plans on SQLite/zlib, a compiled interior-reference oracle and a failed exact code-mapping composition. Preserve failed attempts and measurement limits, including unavailable live-agent effectiveness evidence. Add bounded native probes and deterministic mapping tests. All 191 Kuna cases pass serially; nine experiment tests and one-checker typecheck pass.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 17:17:02 +00:00
b4bdd61ace experiment(kuna): preserve typed reference facts at their owner
Expose source-owned reference kind, endpoints, function identities and instruction text for experiments. Keep the existing address-only public result and retained-cache shape; materialize richer facts only when explicitly requested. Record prior art, composition rules and the distinction between fact, transport and compute units. Verified 18 producer boundary cases and an independently checked native interior-reference example.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 16:46:28 +00:00
fa8d6a7a23 experiment(re): compare fact granularity through real MCP
Add a non-shipping MCP facade over the existing admitted analysis port, real-provider comparison runner and offline token accounting. Keep the full catalog, source Evidence and per-input failures. Separate verification runs from equivalent-work timings. Kuna zlib comparisons pass; broader comparisons remain in progress.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 16:35:23 +00:00
ce4fe65170 experiment(re): define composable facts and context boundaries
Start a non-integrating experiment around fact identity, per-input outcomes, paging and shared primitive composition. Include deterministic boundary checks; real-provider comparisons remain in progress.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 16:28:41 +00:00
Guilherme Dias FusariandKaoru0822 5b16f24310 test(applications): pass Evidence requests to the CLI through files (#3049)
Use existing test-owned request files for the remaining full Evidence CLI inputs. Preserve complete inputs, semantic assertions and inline transport coverage. Verified the full Linux file and native Windows baseline failures plus corrected public CLI cases.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 15:51:03 +00:00
YsopwnableandKaoru0822 9f8659e053 fix(javascript): enforce semantic byte bounds for literals
Fixes #3933. Part of #4027.

Normalize exact literals and configuration defaults through the shared primitive owner. Preserve tagged limits through member/destructuring projection and record encountered bounds in per-analysis state independently of later selected values. Remove the retained-value rescan and duplicate default reader. Preserve source Evidence, bounded/null values, aggregate wire capacity and complete endpoint lookup identities for query/trace/comparison.

Validated 66 focused and 932 semantic tests on the restored identical runtime; final public selection 7/7 adds an augmented large-endpoint acceptance (67 distinct focused cases across invocations). Full static/docs and fresh real Obsidian controls passed. Compact measurements and rejected attempts remain recorded.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 23:43:05 +08:00
KenmegeandKaoru0822 40f73f62bc test(rizin): own fake provider cleanup in shared fixtures (#3735)
Retain native fixture ownership through observed bounded cleanup and preserve files and handles when cleanup cannot be confirmed. Verified all seven files on Linux and native macOS, including cleanup failure and exit-wait controls.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 15:24:55 +00:00
Ysopwnable 6ae59f3d19 fix(verifiers): launch npm through Node on Windows (#4153)
* fix(verifiers): launch npm through Node on Windows

* test(verifiers): cover Windows npm fallback
2026-10-15 23:12:29 +08:00
Kaoru0822andClaude Opus 5.5 9d6651e5b5 fix(artifacts): never treat a directory named *.map as a source map (#4131)
Artifact inventory decided source-map edges from the `.map` path suffix,
so an archive directory such as `main.js.map/` received a maps-source
edge whose parent was the sibling `main.js`, although the same
occurrence was classified as a directory container. Edge construction
now uses the occurrence's own artifact_kind, and the duplicate suffix
rule in relationFor is removed; such directories are contained by their
parent, and real source-map files keep maps-source.

Fixes #3909

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 07:41:04 -07:00
Kaoru0822andClaude Opus 5.5 a90c9eac6a fix(apple): keep Interface Builder objects whose archived class is unresolved (#4118)
* fix(apple): keep Interface Builder objects whose archived class is unresolved

Interface Builder keyed-archive projection skipped every object-table
entry without a resolved class name, so an archived object whose $class
reference dangled vanished from the objects, its count and its coverage,
which still reported complete; as a hierarchy root it lost its label.
Entries that carry their own $class are archived objects: they are now
kept with class_name null and the generic kind, their fields and labels
preserved. Scalars and class descriptors remain excluded.

Fixes #3958

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(apple): keep the dangling class reference of an unknown IB object

Review follow-up. An archived object kept with an unresolved class lost
its original `$class` reference, because class resolution replaces it
with a null class name. The object's attributes now retain that raw
reference when the class cannot be resolved. A graph-level test covers
the reported hierarchy-root case: the unresolved root keeps its label,
unknown kind, containment edge, object count and coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 07:40:10 -07:00
Kaoru0822andClaude Opus 5.5 cfd3c35a50 fix(kuna): keep the real lane's wide-string marker independent of layout (#4116)
On macOS arm64 the lane's UTF-8 marker ends right before the UTF-16 array,
and its last byte plus NUL decode as the UTF-16LE unit 'r'. Kuna therefore
reports "rREA wide marker", and the lane, which requires the exact text,
failed with "Required string \"REA wide marker\" was not recovered". A
leading NUL unit now ends any run the preceding bytes start, so the marker
is recovered exactly on any layout.

Refs #1957

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 07:38:33 -07:00
Kaoru0822andClaude Opus 5.5 3776f218e5 fix(apple): bound Interface Builder XML plists by shared value depth (#4114)
* fix(apple): bound Interface Builder XML plists by shared value depth

The Interface Builder preflight rejected XML archives whose raw element
depth exceeded 128, but the shared plist parser bounds zero-based value
depth at 128; the plist envelope and dictionary keys add elements, not
value depth. Archives whose deepest value sat at depth 127 or 128 were
therefore omitted as over budget although keyed-archive inspection
decodes them. The preflight's duplicate depth rule is removed; the
shared parser's depth limit is mapped to the existing budget omission,
so deeper archives stay explicitly omitted.

Fixes #3949

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(apple): return the decode reservation of a depth-rejected archive

Review follow-up. The removed element-depth preflight rejected an archive
before its plist representation was reserved; the shared depth limit now
rejects it during decoding, after the reservation. A large over-depth
archive therefore kept its share of the aggregate budget and could
starve later valid archives. A document omitted by the budget after
reserving now releases that reservation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 07:38:07 -07:00
Kaoru0822andClaude Opus 5.5 f7250fe35f fix(kuna): say why Kuna cannot answer instead of a generic message (#4113)
Kuna capability gaps such as "no code at this address" or "no function node
at this address" were built without a user message, so MCP and the CLI
showed only "This analysis is unavailable for the current target. Choose
another analysis or target." and kept the reason in details. One Kuna
helper now presents the reason as the message for every such gap, and the
unsupported-operation reason names call relationships and xrefs, which Kuna
now answers.

Refs #1957

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 07:37:20 -07:00
Ysopwnable cd64e24ff2 fix(verifiers): align WABT operation timeout (#4117)
* fix(verifiers): align WABT MCP request timeout

* fix(verifiers): bound packaged WABT workflow
2026-10-15 22:29:15 +08:00
Abdul Samad SiddiquiandKaoru0822 a40ee741c2 test(ghidra): align MIPS verifier ABI and snapshot expectations
Fixes #3415. Retain independently inspected GNU attribute facts and compare exact snapshot wire fields. Preserve strict metadata comparisons, specific incomplete-ABI refusals and source immutability checks.

Original implementation by @AbdulSamad94.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 22:00:16 +08:00
YsopwnableandKaoru0822 e9a71efa31 fix(javascript): declare owned analysis worker effects
Advertise internal worker launches and temporary source writes through the
canonical effects owner so MCP hints and session availability agree with
existing analysis behavior. Preserve non-destructive, idempotent semantics.

Verify public metadata boundaries and a real Obsidian CLI/MCP workflow,
retaining compact reproduction and cost records.

Fixes #3867

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 21:36:12 +08:00
Kaoru0822andClaude Opus 5.5 fe7bcc3fbe fix(apple): report __proto__ entries omitted from OpenStep property lists (#4105)
* fix(apple): report __proto__ entries omitted from OpenStep property lists

The pinned OpenStep decoder assigns a `__proto__` dictionary key to the
object's prototype, so the entry vanished before REA could count it and
OpenStep keyed archives reported no omission, unlike the same archive in
XML. The OpenStep pre-scan, which already walks every key for the depth
limit, now counts keys that decode to `__proto__`; quoted keys with
escapes are decoded by the pinned decoder itself. The rebuilt value still
drops any prototype a key replaced.

Fixes #3892

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(apple): count OpenStep compound keys that coerce to __proto__

Review follow-up. A compound dictionary key such as `(__proto__)` is
coerced by the decoder's `obj[key]` assignment to the property name
__proto__, but the scan only checked scalar keys. Containers opened in
key position are now decoded by the pinned decoder on close and counted
when their property-name coercion is __proto__.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 06:12:15 -07:00
Kaoru0822andClaude Opus 5.5 736aa946bc fix(kuna): suggest no restart when a fixed buffer stopped the export (#4104)
A failed export's capability error appended "restart REA, then reopen the
target" to every resource-constraint remediation. Since output overflows
became fixed `memory` bounds, an export whose own output overflowed REA's
buffer was told both that repeating fails the same way and that a restart
would help. The restart sentence now follows only settings-backed
remediations such as the cache size.

Refs #1957

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 06:12:00 -07:00
Kaoru0822andClaude Opus 5.5 d929543198 fix(artifacts): never count occurrences on an unknown duplicate path as unchanged (#4100)
Artifact comparison subtracted change rows from the left occurrence
count to derive summary.unchanged. A duplicate logical path produces one
unknown row that stands for every occurrence on that path, so the extra
occurrences were reported as affirmatively unchanged. The summary now
counts only left occurrences on paths without a left-side change row.

Fixes #3956

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 06:11:46 -07:00
e598b4656a fix(ghidra): use resolved type addresses for NativeAOT metadata
Fixes #3327.

Reuse parsed Ghidra type identities for NativeAOT metadata lookup, preserve
caller spelling and address spaces, and retain supplied engine metadata
without deriving another source snapshot. Verify actual compiled NativeAOT
PEs through real Ghidra and public CLI/MCP workflows.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-15 21:05:33 +08:00
YsopwnableandKaoru0822 ec394a2bdf feat(javascript): add filtered retained module reference views
Expose filtered canonical module identities, retained source-range counts and mixed support through the existing shared CLI/MCP analysis view. Preserve full-item access, source selection, provenance and partial coverage while allocating only the selected page.

Verify exact facts and CLI/MCP identity on shipped Obsidian, record complete-task BPE/resource measurements and reuse owned-process supervision for optional tokenizer cleanup.

Fixes #4092
Part of #4027; decision #4091.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 21:05:00 +08:00
7054bbb9ab feat(kuna): add cached string inventory and search (#4095)
Add cached, reference-free Kuna string inventories through existing CLI/MCP operations. Preserve exact addresses, typed facts, selected Evidence and bounded query lifecycles; validate native fields and caller-specific failures. Verified with real Linux SQLite, zlib, printf and Unicode/empty ELF targets, 194 focused regressions and all 38 CI checks.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 13:04:27 +00:00
YsopwnableandKaoru0822 b2257653ca test(ghidra): isolate source admission failure sessions
Fixes #3405. Isolate each negative source-admission case with a cold Ghidra session while retaining valid snapshot readback coverage.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 20:45:35 +08:00
Kaoru0822andClaude Opus 5.5 b3b5c8b133 fix(kuna): report output beyond REA's buffer as deterministic and final (#4098)
Kuna output that overflowed REA's fixed buffer was a `capacity` constraint,
which projects as `retryable: true` with "wait for an active analysis to
complete, then retry". The same target and executable overflow the same
buffer every time; on a 169 MB Mach-O, each retry of a call query repeated a
113 s whole-program graph walk and failed again. The overflow is now a
`memory` constraint whose remediation says repeating fails the same way, a
session answers later call queries from a graph overflow it already saw, and
the cut-off document's stdout tail is no longer returned.

Refs #1957

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:23:43 -07:00
Kaoru0822andClaude Opus 5.5 befbc024c9 fix(apple): select only entries named Assets.car as asset catalogs (#4094)
inspect-asset-catalog selected every bundle entry whose relative path
ended in Assets.car, so an unrelated NotAssets.car directory was listed
as a skipped catalog and, with no real catalog present, failed the
inspection instead of returning the empty inventory; a regular file such
as OldAssets.car would have been sent to assetutil. The selector now
compares the final path component exactly.

Fixes #3914

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:21:17 -07:00
Kaoru0822andClaude Opus 5.5 fc41b24dc4 fix(native): keep a category whose class reference cannot be read (#4093)
An Objective-C category whose nonzero class reference pointed outside
mapped metadata failed as a whole, discarding its readable name, method
selectors and implementations. The category decoder now resolves the
local class name in its own boundary: on failure the category keeps its
facts with class_name null and class_source unresolved, and a
category_class_unresolved issue records the unreadable reference in the
category coverage.

Fixes #4012

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:21:04 -07:00
Kaoru0822andClaude Opus 5.5 2c90082a69 docs(mcp): describe the 100-value completion reply limit (#4086)
* docs(mcp): describe the 100-value completion reply limit

The prompt guide said completion returns all matching values. A reply
carries at most 100 values, the MCP limit, with total and hasMore
reporting omitted matches. Describe that and how to reach omitted values
with a longer prefix.

Fixes #3866

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(mcp): qualify longer-prefix completion recovery

Review follow-up. A longer prefix reaches an omitted value only when it
excludes other matches; values whose normalized forms share a prefix
with more than 100 matches stay unreachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:20:50 -07:00
Kaoru0822andClaude Opus 5.5 82763824dc fix(domain): keep a decoded Swift alias category beside undecoded aliases (#4085)
categorizeSwiftTypes counted a recognized Swift alias whose category was
not decoded as a null vote, so one undecoded same-address alias erased a
class category established by another alias: the procedure moved to
other, and a classes filter returned nothing. Only decoded categories now
vote; undecoded aliases stay in mangled_names as evidence.

Fixes #3934

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:20:35 -07:00
Kaoru0822andClaude Opus 5.5 41e4c06397 fix(native): record an empty Objective-C protocol name as a protocol failure (#4078)
* fix(native): record an empty Objective-C protocol name as a protocol failure

A protocol declaration whose name was an empty NUL-terminated string was
accepted as decoded, so whole-result validation of objc_protocols[].name
failed and inspect-native-dispatch-metadata discarded every decoded
class from the same image. The protocol decoder now rejects the empty
name inside its per-protocol boundary, as the class decoder already
does, so the protocol becomes a recorded partial-coverage failure and
independently decoded classes are retained.

Fixes #3873

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(native): decode adopted protocols before rejecting an empty parent name

Review follow-up. The empty-name check ran before the adopted-protocol
list was traversed, so a protocol declared only through an empty-named
parent's list was dropped. Adopted protocols are independent
declarations; traverse the list first, then reject only the parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:20:22 -07:00
Kaoru0822andClaude Opus 5.5 a5024a9710 fix(kuna): report a failed export as not retryable in its session (#4070)
* fix(kuna): report a failed export as not retryable in its session

A session never rebuilds a failed project export, yet requests that need it
returned the export's raw failure. For a timeout that projected as
`retryable: true` with "Try a smaller request", and every retry returned the
same stored failure. Those requests now fail with a non-retryable
capability error that keeps the export failure as its cause and diagnostics
and names what to change (the deadline or jobs for a timeout) before
reopening the target. Cancellation and unproven cleanup keep their own
errors.

Refs #1957

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(kuna): keep a failed export's output and name the restart it needs

The capability error for a failed export dropped the export's captured Kuna
output, which the MCP projection only reads from the top-level error. It
also told callers to change a setting and reopen the target, but REA reads
Kuna settings once at startup. The error now carries the captured output
and partial observation, and its recovery text says to change the setting
where REA starts and restart REA.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(kuna): keep resource limits on a failed export's capability error

An export larger than REA_KUNA_CACHE_MAX_BYTES, or a Kuna command at its
output cap, fails with a resource constraint whose resource and reported
limits the projection exposes only on the top-level error. The wrapper now
copies them into its diagnostics under the same names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(kuna): carry a failed export's whole projection on its wrapper

The capability error for a failed export copied the cause's facts field by
field (captured output, resource limits), and each missing field, such as an
artifact change's path and boundary, dropped evidence callers could not
reach through `cause`. The wrapper now carries the export failure's own
projected code and details in its diagnostics, so every typed field survives
in the shape its own projection gives it, and the duplicated top-level
copies are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:20:08 -07:00
Kaoru0822andClaude Opus 5.5 fc791bb606 fix(paths): select caller paths through symlinks and .. as the filesystem does (#4067)
* fix: select caller paths through symlinks and .. as the filesystem does

CLI adapters, binary target resolution, the reverse-engineering service
and the objdump and Rizin command builders made caller-selected paths
absolute with path.resolve, which collapses `link/..` lexically. On
POSIX the filesystem follows `link` first, so these commands inspected,
hashed or launched a different file and returned internally consistent
Evidence for it.

absoluteCallerPath now owns that step: on POSIX it prefixes a relative
path with the working directory and keeps an absolute path as spelled;
on Windows, where `..` resolves lexically, it keeps win32.resolve.

Fixes #3864
Fixes #3911
Fixes #3912

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep firmware, WASM list and output-root paths on the selected file

Review follow-up. The CLI already passed firmware and WASM paths through
absoluteCallerPath, but snapshotFirmware and SafeOutputTree.create
re-resolved them lexically, and the WASM glue and candidate lists still
used resolve, so those inputs could still select a sibling file or
create output beside the intended directory.

absoluteCallerPath now also drops `.` segments and repeated or trailing
separators on POSIX, which never change the named file, so selected
paths such as `./module.wasm` keep matching their glue references
exactly. Every `..` is still left for the filesystem.

SafeOutputTree keeps host path syntax; its platform argument selects only
the Windows name policy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep directory requirements and relative cwd in caller paths

Review follow-up. absoluteCallerPath stripped a trailing `/` or `/.`, so
`file/` selected the regular file instead of failing with ENOTDIR; it
now keeps one trailing separator. A relative cwd option was appended to
the root; it is now made absolute without collapsing `..`. WASM glue
matching resolved local literals lexically, so a module selected through
`link/..` matched only by basename; the adapter now compares both sides
through absoluteCallerPath and still reports each candidate as given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:19:43 -07:00
Kaoru0822andClaude Opus 5.5 8ed3d1df72 fix(kuna): list a cold target from the export's own inventory (#4062)
* fix(kuna): list a cold target from the export's own inventory

On a cold cache the session ran `kuna functions --json` for listings while
the background export ran the same inventory as its first step, so every
cold target was inventoried twice at once. On a 254 MB Mach-O each run took
about 66 s of CPU. The quick run was also bound by the single-function
deadline.

The export's status now carries its parsed inventory, the cache replays the
latest status to requests that join a running build, and listings wait for
that inventory. The session runs its own inventory only when the export ends
without one.

Refs #1957

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(kuna): replay a running build's status after its waiter can cancel

The cache replayed the latest status to a joining request before it
registered that request's abort listener, so a listener that cancelled on
the replayed status was ignored and the request waited for the export to
finish. Replay now happens once cancellation is registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(kuna): publish the export's inventory without parsing it twice

The export parsed `functions.json` for its status and then parsed the file
it had just written again to publish, so two expanded inventories coexisted
while the export finished. Publishing now reuses the inventory parsed from
that same text. Cached lookups still parse the published file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(kuna): exercise export inventory sharing from pseudocode requests

Inventory-only requests no longer start the export, so a cold request that
shares the export's inventory is now a text request. The tests and the
guide describe that trigger.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(kuna): let a listing wait for an export that is still starting

A listing that arrived while a concurrent text request was still looking up
the cache saw no export inventory yet and started its own `kuna functions`,
and the export then started another. The listing now waits for that startup
decision before falling back to its own run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:19:25 -07:00
Ysopwnable 2b5ee72d26 feat(ghidra): admit ARM PE targets on Windows (#3965)
Admit Windows ARMNT/Thumb-2 and ARM64 PE targets using preserved COFF machine facts. Keep unsupported machine gates explicit and distinguish loader-selected versus configured language provenance.

Verified with real Windows Ghidra 12.1.4 CLI/MCP workflows, ARM fixtures and Microsoft-signed Coreinfo ARM64 / MSVCR120 ARM inputs. Resource limits, analyzer overrides, startup timeout observations and verification gaps are documented in the PR. Final CI and automated review passed.

Fixes #2186
2026-10-15 20:11:26 +08:00
Ysopwnable 2a2a33ad92 fix(browser): confirm service-worker cancellation cleanup (#4010)
* fix(browser): confirm service-worker cancellation cleanup

* fix(browser): restore policy after setup failure

* fix(browser): transfer cancelled navigation cleanup

* fix(browser): retain cancellation ownership across retries

* fix(browser): confirm storage navigation cleanup
2026-10-15 20:08:30 +08:00
c7697595d8 fix(browser): report attached locale coverage limits
Fixes #3395.

Disclose attached locale coverage in complete and retained partial captures,
clarify the shared locale contract, and verify actual CLI/MCP caller-language
preservation and browser cleanup. Launch supplies full page/request locale.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-15 19:37:19 +08:00
c9f9b83c6f feat(kuna): add bounded call relationships and exact xrefs
Add session-cached call relationships and exact incoming xrefs using a body-free graph and bounded native queries. Reuse existing graph/path tools, preserve coverage and exact u64 identities, and retain native cleanup owners and admission leases.

Validated with 136 tests, real Linux Kuna workflows on SQLite/zlib and source-owned fixtures, independent native xref comparisons, resource measurements, CI and review.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 11:12:47 +00:00
YsopwnableandKaoru0822 55cef2566a perf(tests): reuse CLI compilation for exported binding checks
Reuse the existing CLI compilation policy in the exported binding acceptance
matrix. Own and clean a fresh cache per file while preserving caller cache
and coverage choices, all 92 cases, and every live CLI/MCP request and oracle.

Fixes #4079

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 19:00:04 +08:00
Kaoru0822andClaude Opus 5.5 f255899ee8 fix(kuna): keep the run slot of an unproven stop until close proves it (#4052)
A single-function run whose process tree could not be proven stopped
released its run slot immediately, so the next queued run started while
the old tree might still run, and repeated unproven stops bypassed the
bound. The retained run now carries its slot, and close releases it only
after a retried stop is proven.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 03:42:22 -07:00
Kaoru0822andClaude Opus 5.5 65726afaaa fix(native): report an object file's unnamed segment by its empty name (#4051)
inspect-macho projected an empty Mach-O segment or section name as the
display label "unknown", so an exhaustive segment inventory for an
ordinary MH_OBJECT reported a segment literally named "unknown" while
the raw LC_SEGMENT_64 field showed "". Object files place every section
in one unnamed segment, so the empty name is a source value. Segment and
section names are now reported exactly as observed.

Fixes #3875

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 03:42:15 -07:00
Kaoru0822andClaude Opus 5.5 30ba5e99f9 fix(native): keep a dylib's own install name out of its dependencies (#4050)
inspect-macho listed the LC_ID_DYLIB command of a dylib as a dependency,
so every dylib reported a self-dependency and an inflated exhaustive
count, while trace-dylib-resolution correctly treats that name as the
image identity. The dependency collector now skips LC_ID_DYLIB; the
command, with its install name, remains in the raw load commands.

Fixes #3872

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 03:42:03 -07:00
Kaoru0822andClaude Opus 5.5 b6529bf1af fix(kuna): verify a warm export once for concurrent first requests (#4049)
Every request a session admitted checked `#project` before awaiting the
cache lookup, so concurrent first requests, such as batch_decompile's
parallel resolutions on a fresh server, each re-hashed every export file
and re-parsed the export. Concurrent first requests now share one lookup.

Refs #1957

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 03:41:27 -07:00
1b8a9c831b fix(reconstruction): require comparable cited Evidence for coverage
Fixes #3357

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-15 18:39:57 +08:00
Kaoru0822andClaude Opus 5.5 cb18d4c9c4 docs(objdump): show debug-link flag forms that keep their meaning (#4068)
The DWARF example passed `--follow-debug-links false`. The CLI parses
the option as a Boolean flag and drops the separate `false` word, so the
documented command enabled debug-link following (`-WK`). Show the
default and the bare flag, and name `--no-follow-debug-links` and
`--follow-debug-links=false` as the forms that keep it disabled.

Fixes #3893

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 18:07:09 +08:00
Kaoru0822andClaude Opus 5.5 47b4628bac fix(native): retain every repeated otool load-command field (#4048)
`inspect-macho` stored each `otool -l` row in a flat record, so a key
printed more than once kept only its last value. A two-string
LC_LINKER_OPTION lost `-framework` and kept `#2 Foundation`, and a
multi-tool LC_BUILD_VERSION kept only its last tool, while the
collection still claimed exhaustive coverage.

Linker-option strings are now keyed by otool's own `string #n` label
with the exact option text and must match the declared count. Any other
repeated key is labeled `key #n` in print order. Dylib encoding checks
read the parsed rows, so repeated `options` rows are still rejected.

Fixes #4008

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 02:29:06 -07:00
Kaoru0822andClaude Opus 5.5 670ad6bd96 fix(kuna): share and bound single-function decompile runs (#4045)
While the project export builds, every pseudocode request started its own
`kuna decompile --addr` process, and each one analyzes the whole image
again. A cold batch_decompile therefore launched one process per address,
including duplicates, with no bound.

Requests for one entry now share one run, which stops when its last waiter
is cancelled; that waiter still receives the run's outcome, including
unproven cleanup. A provider-wide pool admits at most the host's cores
beyond REA_KUNA_JOBS (at least one) at once, and a queued request is
answered from the export when it finishes first.

Refs #1957

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 02:24:29 -07:00
Kaoru0822andClaude Opus 5.5 c61c108b52 perf(catalog): record default catalog digests at build time (#4041)
Every `doctor`, `mcp doctor` and MCP server that reports or compares its
catalog identity rebuilt all advertised JSON Schemas and canonicalized
them to compute the default digests, about 200 ms of CPU per process.
The default (full input and output schema) catalog is a deterministic
function of the compiled contracts and pinned schema converter, so
compilation now records it once into dist and the runtime reuses it.
Compact and output-schema-off identities, and source runs, still compute
their digests on first use.

Refs #3813

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 02:19:38 -07:00
d7651b6a0d fix(javascript): preserve mapped runtime digest disagreements
Fixes #3316

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-15 17:04:49 +08:00
YsopwnableandKaoru0822 e18fccc548 fix(ci): reject false browser environment cancellation passes
Require typed cancellation and confirmed external-browser cleanup in the
real environment verifier. Close its provider and CDP observer while
preserving primary and cleanup failures. Cover six controlled outcomes
through the verifier's actual cancellation path.

Fixes #4033

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 16:54:58 +08:00
morluto e45eb33f03 fix(ci): await complete browser fixture restoration
Wait for the restored document's matching CDP load event before closing the observer. Drain storage verifier providers and surface cleanup failures so the next scenario receives a settled page.
2026-10-15 16:47:29 +08:00
337d2e33c5 fix(kuna): preserve ownership through cancellation and failed verification (#4029)
Let individual requests cancel their shared assembly-index wait while the session aborts and drains the owned producer. Preserve verifier workspaces until provider, transport and process cleanup are confirmed; report failed runs with original errors and lineage evidence.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-15 08:26:13 +00:00
6688ed6db7 fix(javascript): retain standalone GraphQL source operations
Retain named operations in GraphQL Source bodies with locationOffset metadata.
Use final property ownership and parsed lexical facts to suppress copies only
when a recovered document, its containers and source aliases have proven
private metadata ownership. Preserve independent observations after writes,
exports, opaque uses, classic-script global exposure or direct evaluation.

Share interpretation across application and captured-web analysis. Build
optional reference indexes once per source and checkpoint examined records,
including suppressed findings, to retain cooperative cancellation.

Fixes #3311

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-15 15:59:42 +08:00
c1fd496e6a 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>
2026-10-15 00:53:26 -07:00
Kaoru0822andClaude Opus 5.5 6fcfc5b5e0 fix(browser): keep malformed Electron CDP inventories incomplete (#3901)
inspect-electron-page read missing or non-array DOMSnapshot documents and
node arrays, frame-tree resource lists, and Target.getTargets target lists
as empty inventories while reporting complete_within_window.

The web capture path already validated these replies. Its parsing now has
one shared owner in CdpCaptureDocuments: snapshotDocuments,
snapshotDocumentNodes and frameTreeResources report unreadable parts
through a callback, and both the web and Electron inspections consume
them. Worker discovery records a missing target list or non-record entry as
an invalid_protocol_value exclusion. The Electron copies of this parsing are
removed.

Fixes #3379

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 00:09:38 -07:00
pablodiazjorge 35e17a7172 fix(captures): admit schema-valid HAR numbers that evidence cannot publish exactly (#3159)
* fix(captures): admit schema-valid HAR numbers that evidence cannot publish exactly

* fix(captures): judge overflowing HAR integers by their lexeme
2026-10-15 16:09:07 +09:00
pablodiazjorge f8f3593a8c test: resolve script paths from file URLs with fileURLToPath on Windows (#3266)
* test: resolve worker and CI script paths with fileURLToPath on Windows

* test: skip the fake gh lookup failure on Windows

* test: resolve the release helper and Hopper probe paths with fileURLToPath
2026-10-15 16:07:57 +09:00
Aaditya ed4a1c7d95 docs(installation): list every client that first shipped in 6.5.0 (#3465)
docs(installation): list every client missing from npm 6.4.0

The installation guide named only dsh, or dsh, kimi and workbuddy, as
needing a newer release. The rea-agents-6.4.0 tag also lacks droid,
qoder, trae and zcode, so setup against @latest rejects all seven as an
unsupported agent integration.

List all seven client IDs in both the registry-check note and the
supported-agents table note.
2026-10-15 16:07:42 +09:00
Wade 7a83af3cba fix(process): keep observed symlink targets in filesystem snapshots (#3418)
Snapshots stored resolve(dirname(link), readlink(link)), a lexical
absolute path. Two different targets such as aaa/../target and
bbb/../target collapse to the same value, and with equal lengths the
before/after comparison reported a retargeted link as unchanged even
when the new link is broken. Store the target exactly as readlink
returns it.

Fixes #3303
2026-10-15 16:07:28 +09:00
Ysopwnable f5b1dce881 docs: celebrate 250,000 GitHub stars 🎉 (#3971) 2026-10-15 15:07:07 +08:00
Rudy Mizrahi CelekliandClaude Sonnet 5.5 73c72d5745 fix(mcp): keep a snapshot open ahead of later calls on the same connection (#3661)
open_binary read snapshot_path before it entered the session's lifecycle
order, so a current_document or close_binary dispatched after it could
run first: the read returned Evidence for the previous target and the
close left the snapshot target open. The session now loads the snapshot
inside the open's own turn.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 16:05:44 +09:00
ShuaixinHuang ce89706145 fix(javascript): preserve exact static property keys (#3480)
* fix(javascript): preserve Electron options with static empty keys

* fix(javascript): retain exact computed member keys
2026-10-15 15:59:06 +09:00
Harsh Asalkar 3e88e21705 fix(electron): reject active scenario capture when inspect fuse is disabled (#3453) (#3605)
* feat(electron): add EnableNodeCliInspectArguments fuse pre-flight helper

* fix(electron): reject active scenario capture when inspect fuse is disabled (#3453)

* docs(electron): document inspect fuse pre-flight refusal for scenario capture (#3453)

* test(electron): add PE, ELF, and abort-signal coverage for fuse pre-flight (#3453)

* fix(electron): resolve macOS framework binary and enforce startup deadline on fuse preflight (#3453)
2026-10-15 15:57:42 +09:00
Wade d94ef22d70 fix(cli): route app bundles with trailing separators to native analysis (#3511) 2026-10-15 15:55:44 +09:00
Lucien c61a24b8c5 fix(browser): bound CDP handshakes and command responses (#3555)
* fix(browser): bound CDP handshakes and command responses

* test(browser): expire stalled deadlines after fixture readiness

* docs(browser): explain handshake deadline ownership
2026-10-15 15:55:29 +09:00
Kaoru0822andClaude Opus 5.5 fc712b3750 fix(javascript): keep releases through a replaced handle as candidates (#3897)
A release call was linked to its acquisition through the receiver's lexical
binding alone, so `stream = { destroy() {} }; stream.destroy()` still
produced a resolved `releases` edge to the original stream and entered the
default ownership trace.

A release is now complete only when every value written to the handle
binding is the linked acquisition itself (through parentheses, TypeScript
wrappers or `await`) or a nullish placeholder such as `let h = null`, which
cannot be released. Any other write, conditional replacement, or
destructuring keeps the linked release as a candidate (partial).

Fixes #3313

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 23:40:14 -07:00
Kaoru0822andClaude Opus 5.5 ab45bf641e fix(ghidra): refuse PSP targets with unexamined ABI declarations (#3904)
The generic Ghidra MIPS lane refuses a target whose ABI declaration
inspection is incomplete, such as a section-header table beyond the
captured file, because unexamined headers may hold declarations that
would refuse it. The PSP Allegrex lane skipped that check. It admitted
the target and resolved a supported profile while target inspection
said those declarations remained unknown.

The incomplete-declaration rule is now one shared helper,
ghidraMipsIncompleteDeclarationsReason, used by both the generic MIPS
and the PSP lanes.

Fixes #3329

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 23:30:12 -07:00
Kaoru0822andClaude Opus 5.5 57f30029b1 fix(javascript): reject Webpack getters replaced through any identity write (#3860)
The canonical `n.n` getter proof scanned for direct `loader.n =` assignments
and four Object methods on its own. `Reflect.set`, `Reflect.defineProperty`,
`delete`, destructuring and unknown-key writes left the proof intact, so a
replaced or deleted getter still attributed BrowserWindow calls to Electron.
Any Object method call on the loader also rejected the proof, even for an
unrelated key.

The proof now uses the shared identity-write owner
(`collectJavaScriptIdentityWritesSteps` with the module interop's intrinsic
resolution), as ambient writes already do. A write whose path may select `n`
(the key itself, an unknown key, or the whole loader) counts; exactly one
canonical assignment installed before entry dispatch remains required.

Fixes #3315

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 23:25:18 -07:00
morluto 22ec8bdb2f Merge remote-tracking branch 'origin/main' into codex/ci-followups-20261015 2026-10-15 14:11:13 +08:00
morluto a715fb9e6d test(browser): bound atomic environment polling across navigation 2026-10-15 14:11:13 +08:00
morluto 85788452dd test(cli): batch redundant client lifecycle dry runs 2026-10-15 14:11:13 +08:00
Kaoru0822andClaude Opus 5.5 1b036ecbff fix(flutter): check section-backed symbol tables against PT_LOAD (#3859)
* fix(flutter): check section-backed symbol tables against PT_LOAD

The section-backed ELF path read .dynsym and .dynstr only through their
section file offsets. The stripped PT_DYNAMIC path and snapshot symbols
resolve through the PT_LOAD map. A second PT_LOAD interpretation over an
allocated symbol or string table was therefore ignored, and
inspect-dart-aot reported complete coverage from metadata the loader may
read differently.

An allocated (SHF_ALLOC) dynamic symbol table and its string table now
need a single file-backed PT_LOAD interpretation that matches the section
offset, the same check the dynamic path applies to its tables. Otherwise
the symbol inventory is refused with the mapping reason, and
inspect-dart-aot reports that no recognizable snapshot selection remains.
Non-allocated tables keep their section-offset reading.

Fixes #3346

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(flutter): cover allocated ELF32 symbol-table mapping checks

Add an ELF32 (ARM) counterpart of the synthetic ELF64 image and run the
allocated-table cases for both classes, so the ELF32 section-header reads
in the mapping check are exercised: matching mappings, conflicting symbol
and string mappings, and a disagreeing section offset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 23:02:49 -07:00
933f216698 feat(kuna): add Kuna readiness, doctor and owned project cache (#3832)
Add caller-supplied Kuna readiness, scoped doctor support and a verified whole-program export cache. Index function byte ranges without introducing analysis-tool responses, and retain unresolved process ownership through cleanup failures. Separate retryable file cleanup from unproven process cleanup.

Verified real Kuna 1.833 on Debian 12 x86-64 with coreutils, SQLite and zlib; 5,207 exported function spans, cold/warm performance, raw-export parity and lifecycle failures. Refs #1957.

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: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:56:56 +00:00
Kaoru0822andClaude Opus 5.5 cf0a38ad97 fix(managed): project metadata with empty names without a display label (#3853)
The managed application graph copied metadata names into observation
labels. The graph schema requires a non-empty label or null, so Evidence
whose Module name was the string heap's empty entry made
project-managed-application-graph fail with invalid_request at
observations.0.label. The inspector accepts that Evidence as complete,
and no graph was returned.

Labels derived from metadata names (assembly, module, type, member,
P/Invoke import and native implementation) now become null when the name
is empty. The node's properties keep the source value, so display
formatting no longer rejects identity facts.

Fixes #3352

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 22:22:59 -07:00
a1ca8c76af fix(website): give navigation room and refresh contributors (#3851)
Give the header its own 1320px container while preserving body/article widths, move the complete navigation below the controls on smaller screens, and refresh the dated public contributor snapshot from 214 to 216 accounts.

Validated shared HTML/translations/links/assets and 16 maintenance tests; local Chromium acceptance covered 20 languages, 15 viewport widths and both root/project paths. CI and Greptile review passed.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-15 05:18:54 +00:00
Kaoru0822andClaude Opus 5.5 034342ba28 fix(reference): select a package main before its directory index (#3844)
* fix(reference): select a package main before its directory index

import-reference-source resolved a relative directory import such as
require("./dep") from path candidates alone, so it reported dep/index.js
as the internal, parsed dependency even when dep/package.json declared
"main": "actual.js". Node loads actual.js.

parseReferenceSourceEntries now reads each inventoried package.json once.
When an internal specifier resolves through a directory index, a
non-empty string main is loaded first, as a file and then as a directory
index, as Node does. A main whose target is absent falls back to the
index, matching Node's legacy fallback. An unreadable or invalid
manifest leaves the relationship unresolved instead of asserting the
index.

Fixes #3383

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(reference): resolve package main the way path.resolve does

A trailing separator in main ("lib/") kept directory intent, so the
declared entry selected lib/index.js where Node loads lib.js. An absolute
main was joined under the package directory instead of leaving the
imported root. Strip trailing separators after joining, and report an
absolute main as unresolved. Both cases join the Node-oracle CLI test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 22:02:45 -07:00
Kaoru0822andClaude Opus 5.5 788964d52c perf(javascript): index object literal members for exact-key reference lookup (#3836)
semanticObjectPropertyReferences scanned every property of an object
literal on each call, and member-mutation tracking calls it once per
write, so N writes to an N-property literal cost O(N^2).

For an exact string or number key, a property with another static name
only updates override bookkeeping for that other name, which the key
never reads. Index each literal once by static name, keeping spreads,
computed keys and __proto__ data entries for every key, and walk only
the relevant members in reverse source order. Wildcard and selection
keys keep the full scan.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:44:14 -07:00
Kaoru0822andClaude Opus 5.5 acca91d22b fix(javascript): keep members unknown after a write through a local setter (#3831)
* fix(javascript): keep members unknown after a write through a local setter

Assigning to a key that a setter of the binding's own object literal
defines runs that setter, which may replace any member of its receiver.
The member-mutation collector recorded it as an ordinary write to that
one key, so sibling literals such as value: 1 stayed known and
export-shape comparisons reported complete, unchanged shapes.

Record such a write with an unknown key, which invalidates the object's
known members. A computed setter key may match any written key.

Fixes #3312

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(javascript): follow nested setters, skip deletes and cache setter keys

Resolve the written receiver along nested object-literal members so a
write through a nested setter widens that receiver's members. A delete
never calls a setter, so it keeps its exact path. Setter keys are
computed once per object literal, including the no-setter result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(javascript): ignore setters replaced by a later data property

Build cached setter keys from the effective definitions: a later data
property or method with the same static name replaces the accessor, so
assigning that key no longer runs a setter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:39:39 -07:00
Kaoru0822andClaude Opus 5.5 0323ce0a28 fix(javascript): keep the request endpoint on a uniquely consumed response (#3822)
* fix(javascript): keep the request endpoint on a uniquely consumed response

collectResponseConsumers always produced response-consumer operations
with endpoint null, so a json()/text() consumer that resolved to exactly
one request lost the request's literal endpoint in the semantic graph.

When the consumer resolves to one request through that request's own
result binding, the same condition that already makes it complete, it
now carries that request's endpoint. Ambiguous consumers stay null.

Fixes #3328

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(javascript): drop the endpoint when another write can replace the response

Copy the request's endpoint only when the request is the binding's sole
write; any other assignment, update, loop or destructuring target can
replace the response before the consumer reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:39:26 -07:00
Kaoru0822andClaude Opus 5.5 089ef732e8 fix(apktool): own the version probe's process group and keep its timeout typed (#3808)
* fix(apktool): own the version probe's process group and keep its timeout typed

The version probe ran its launcher through execFileOutput, which waits
for every inherited output pipe to close. A shell launcher's child that
holds those pipes outlived the stop request, so the probe stayed pending
past its deadline and its grace period, and cancellation hung the same
way. An expired probe also surfaced as a non-retryable unusable-version
refusal.

Run the probe through runOwnedCommand like the decode run, so the owned
process group is stopped with its children. Report its deadline as
AnalysisTimeoutError with timeout_ms and retain an unresolved cleanup
owner for close. Apktool launchers are interpreter scripts, so both the
probe and the decode run prove ownership by run token instead of the
launcher's argv prefix. A close with unresolved process cleanup reports
a typed ProviderCleanupError instead of an untyped AggregateError.

Fixes #3342
Fixes #3347
Fixes #3337

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(apktool): carry unresolved probe cleanup through both provider entry points

A probe failure other than cancellation or timeout, such as an output
overflow whose launcher child survives, now keeps its cleanup reason and
resources on ApktoolConfigurationFailure. inspectAvailability and execute
report it as ProviderCleanupError instead of ordinary unavailability or
capability_unavailable.

Add a real-process lifecycle test: an interpreter launcher starts a child
that holds the inherited output pipes, the probe is cancelled after
launch, and both processes must be stopped within the bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(apktool): ignore zombies and always clean up the probe lifecycle fixture

Treat a zombie as exited when checking the launcher and child, bound the
cancellation wait so a regressed probe still reaches cleanup, and stop
any remaining fixture processes in a finally block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(apktool): treat a failed process inspection as unknown, not stopped

Only ESRCH, a zombie state or ps reporting no match counts as exited; a
ps launch failure leaves the process presumed live so the assertion
fails and the finally block still stops it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:37:52 -07:00
Kaoru0822andClaude Opus 5.5 f09f454f45 fix(native): retain valid Objective-C properties beside a malformed record (#3833)
* fix(native): retain valid Objective-C properties beside a malformed record

readObjcPropertyList decoded a whole property_list_t in one operation.
When a later entry's name pointer was unmapped, the list-level catch
discarded the properties already decoded. An empty property name passed
decoding and then failed schema validation of the whole result, so
inspect-native-dispatch-metadata exited 1 with no metadata.

Each property_t entry is now decoded on its own. A failing entry, or an
empty name, becomes a property_decode_failed issue at the entry address,
and sibling properties are retained. Incomplete-attribute issues also
report their entry address. List-header failures still fail only that
list.

Fixes #3336

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(native): cover property record isolation on every platform

Move the synthetic Objective-C property Mach-O into a shared fixture and
decode it through decodeAppleDispatchMetadata in a portable test, so
Linux and Windows runs also catch a regression that drops valid sibling
properties. The macOS CLI cases keep exercising the built command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:22:40 -07:00
70cd4cbfb8 fix(hopper)!: verify current Linux releases with the publisher key
Replace fixed Linux Hopper release pins with current vendor feed metadata,
complete detached-PGP package verification under the stable publisher primary
key, and authenticated package evidence for offline admission. Share parsed
publisher facts across approved setup, doctor and the pre-execution guard.
Preserve existing ownership, cancellation, private-display and cleanup rules.

Fixes #3577

Normalize empty XDG settings, preserve backups during approved cache repair,
and retain publisher cleanup through cancellation and shutdown. Exercise cold
offline verification without reusing process-local proof state. Serialize
approved cache publication across processes, restore old evidence on failure,
and share the existing lease owner from process without changing its identities.

Validation: 438 focused tests (six platform-related skips), full static/documentation checks, real Ubuntu
24.04 official Hopper 6.6.0 setup/CLI/MCP, offline ordinary-user admission,
launcher mutation rejection, and cold/warm verification measurements. Official
RPM metadata mismatch is tracked separately in #3578 and fails closed.

BREAKING CHANGE: Older Linux Hopper builds admitted by the fixed allowlist
now require retained publisher-signed package evidence or an approved update
to the current public demo. Update explicit HOPPER_LAUNCHER_PATH values when
migrating; the live feed exposes only its current release.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-15 12:15:55 +08:00
Kaoru0822andClaude Opus 5.5 b7dcf782aa fix(native): keep property flags unknown for unfinished quoted types (#3825)
An Objective-C property attribute string whose quoted class name never
closes, such as T@"NSString, was treated as complete. The missing N and
R were then read as the Objective-C defaults, so the property was reported
atomic and read-write, and objc_properties_categories coverage stayed
complete. The documented semantics require null flags for incomplete
attribute metadata.

The attribute splitter now reports whether every quote closed. An
incomplete string leaves atomicity and any unestablished read-only value
null, while explicit N or R tokens remain established and the raw type is
preserved. Each affected property adds a property_attributes_incomplete
issue, which marks the facet partial.

Fixes #3345

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:42:44 -07:00
Kaoru0822andClaude Opus 5.5 4135c911d3 fix(javascript): keep recovered invalid templates dynamic in semantic effects (#3815)
dataEffectLiteralString asked the literal owner for an exact value, and
when a template recovered with an invalid escape had no cooked value it
fell back to the raw spelling. Child-process commands, request endpoints
and event names then became resolved values that are not JavaScript
strings.

Use only the owner's cooked value; a template without one stays dynamic.

Fixes #3361

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:22:16 -07:00
Kaoru0822andClaude Opus 5.5 0781716788 fix(cli): accept --flag=value for global output flags (#3811)
* fix(cli): accept --flag=value for global output flags

`rea <command> --format=json` failed with "Unknown flag: --format".
`--filter-output=...`, `--token-limit=...` and `--token-offset=...`
failed the same way. Incur reads these global flags only in spaced form,
so the equals form fell through to the command parser. Command options
already accept both forms, and `rea mcp doctor` parses `--format=` itself.

A valued output flag with no value (`--format` last, or `--format=`)
also reported the flag as unknown with code UNKNOWN.

normalizeCliOutputArguments, in the module that owns output-argument
interpretation, now splits the equals forms of the four valued output
flags. The entry point passes the normalized argv to rea's output
validation and to Incur, so both read the same effective values. A
missing value now fails with MISSING_OUTPUT_VALUE and names the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): detect missing output values while parsing output flags

The missing-value check scanned argv again after parsing, so it also
checked tokens the parser had already consumed as values. For example,
`--filter-output --format` selects the field `--format`, yet the second
scan reported `--format` as missing a value. parseCliOutputArguments
now records the first valued flag it skips for lack of a value, in the
same pass that consumes values.

Cover normalizeCliOutputArguments directly: values containing `=`, empty
values, and command options that only share a prefix. Export it in the
dispatcher test's runtime stub as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:22:02 -07:00
Kaoru0822andClaude Opus 5.5 847b7328cf fix(comparison): keep unnamed reference endpoints distinct or unknown (#3809)
* fix(comparison): keep unnamed reference endpoints distinct or unknown

compare_functions projected reference endpoints to procedure names only,
so two edges whose targets had no named procedure both became null and
compared equal, even when their recorded addresses differed.

Identify an unnamed endpoint by its address when both dossiers describe
the same artifact, where that address names one location. Across
artifacts the endpoint has no stable identity, so equal-looking
projections that contain one leave the references dimension unknown
with an explicit limitation. Named endpoints still survive relocation.

Fixes #3388

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(comparison): report known reference-kind changes before unnamed-endpoint uncertainty

Compare known reference kinds first and keep a differing kind as a
change; the unnamed-endpoint limitation now applies only when equality
remains unproven. The kind projection uses the same endpoint identity
as the endpoint projection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:21:49 -07:00
Kaoru0822andClaude Opus 5.5 baad9eebe4 fix(javascript): reject FIFO recovery inputs without blocking (#3788)
* fix(javascript): reject FIFO recovery inputs without blocking

scanRecoveryFile opened the selected path with a blocking O_RDONLY open
before checking that it is a regular file. A FIFO with no writer blocks
that open in the libuv threadpool, so cancellation and the recovery
deadline could not settle the read, and the process could not exit.

Admit the input through the shared openRegularFile owner, which opens
with O_NONBLOCK and verifies a regular file before any read. A FIFO,
directory or socket now fails admission immediately with the existing
regular-file error; symlink rejection and cancellation are unchanged.

Fixes #3332

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(javascript): keep a failed admission close owned on cancellation

Rethrow RegularFileAdmissionFailure before mapping cancellation, so a
descriptor whose close failed stays owned by its error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:21:34 -07:00
Kaoru0822andClaude Opus 5.5 4692bb3330 fix(reference): stop attributing overwritten require members to Node (#3801)
* fix(reference): stop attributing overwritten require members to Node

import-reference-source treated require.resolve(...) and require.main(...)
as Node's resolver even after the file replaced that member, so a literal
argument became a parsed internal dependency that the source never loads.

Attribute member calls only while the loader's resolve and main members
keep Node's identity: no write to either member or a computed member
(assignment, update, delete, destructuring) and no use of require as a
value where a mutator or alias could replace them. Bare require(...) calls
are unaffected.

Fixes #3393

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(reference): keep optional and wrapped loader uses intact

An optional call require?.(...) or a TypeScript or parenthesis wrapper
around require was read as require escaping as a value, which disabled
every member-call link in the file. Look through inert wrappers and
accept optional calls before deciding the loader escaped, and add
controls for bare calls after a member overwrite, a local loader's
member write, and optional calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 19:23:06 -07:00
Kaoru0822andClaude Opus 5.5 af6a998066 fix(javascript): keep string Worker paths unresolved without a document base (#3797)
A plain new Worker("./w.js") or navigator.serviceWorker.register("./sw.js")
resolves against the document base URL in a browser, and a Node
worker_threads string resolves against the working directory. Static
analysis was resolving browser strings against the calling script, which
recorded a resolved mapping to the wrong file.

Only new Worker(new URL(path, import.meta.url)) now produces a specifier.
Other worker and service-worker strings keep their expression and stay
unresolved, matching the existing worker_threads string handling.

Fixes #3309

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 19:13:17 -07:00
Kaoru0822andClaude Opus 5.5 7a66470385 fix(apple): report plist dates the decoder cannot represent as unknown (#3793)
plutil writes years past 9999 and negative years in a form the pinned
XML decoder cannot parse, and binary plists can hold dates outside the
JavaScript Date range. The decoder returns an Invalid Date. Its
projection's toISOString() call then threw, so inspect_plist failed the
whole plist as "unreadable_output" with a `rea doctor` remediation.
Keyed archive inspection and Interface Builder decoding rejected the
archive in the same way.

projectPlistValue, the shared projection, now reports such a date as
{ "$plist_type": "date", "iso8601": null } and counts it. inspect_plist,
keyed archive inspection and Interface Builder decoding each add a
counted limitation, as they already do for non-finite reals.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 19:13:01 -07:00
Kaoru0822andClaude Opus 5.5 90c6922905 fix(javascript): keep empty URL path segments significant (#3792)
* fix(javascript): keep empty URL path segments significant

ESM imports and HTML script references were joined with POSIX path
rules, which collapse '//' before applying '..'. URL resolution removes
the empty segment instead, so './assets//../app.js' names assets/app.js,
not app.js, and the graph linked the importer and renderer to the wrong
file. URL references refused every '//' even when dot segments cancel it.

Resolve ESM, HTML (including document base) and URL references through
one URL dot-segment helper. A remaining empty segment stays unavailable,
references above the artifact root are still rejected, and CommonJS keeps
filesystem path semantics.

Fixes #3307

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(javascript): resolve HTML base and reference as one URL path

The base href was turned into a canonical path before the script
reference was applied. A base empty segment that the reference's '..'
would remove was rejected early, and an above-root '..' from the base
became a removable segment that the reference's '..' could cancel.

Keep one URL path state through base and reference resolution, with
above-root escapes held apart from removable segments, and reject empty
segments only in the final path. Remove the superseded htmlBaseDirectory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 19:12:49 -07:00
Kaoru0822andClaude Opus 5.5 3ded799bc7 fix(reference): never resolve a directory to an extensionless index (#3789)
resolveInternalSpecifier offered posix.join(dir, "index") as the
second candidate, ahead of every extension. With both dep.js and an
extensionless dep/index present, require("./dep") therefore resolved to
dep/index, a file that neither Node nor TypeScript ever selects.

Directory candidates now carry an extension. File and index ordering is
otherwise unchanged, so Node-validated cases such as dep/index.js
winning over dep.cjs keep their meaning.

Fixes #3381

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 19:12:36 -07:00
morluto d69acc3455 fix(windows): retain runtime ownership and clear readonly attributes 2026-10-15 09:29:04 +08:00
Ysopwnable 7d1e4d0e2b fix(browser): release attached emulation overrides (#3778)
* fix(browser): release attached emulation overrides

* fix(browser): preserve unowned environment state

* fix(browser): coordinate attached environment cleanup
2026-10-15 09:21:56 +08:00
Kaoru0822andClaude Opus 5.5 949228b606 perf(javascript): check wrapper IPC duplicates by invocation set (#3783)
The endpoint index from #3779 still scanned every earlier finding at the
same endpoint and serialized each invocation location. One wrapper called
N times for one channel shares an endpoint, so duplicate checks stayed
quadratic in N.

Record per endpoint whether a directly observed send/invoke exists and the
set of serialized invocation locations. The duplicate rule is unchanged and
each check is constant time.

Refs #3670

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:20:34 -07:00
Kaoru0822andClaude Opus 5.5 5e8f7c536e fix(cli): stop quietly when the stdout reader closes early (#3781)
* fix(cli): stop quietly when the stdout reader closes early

`rea ... | head` crashed once head closed the pipe. TOON and YAML output
raised an unhandled EPIPE 'error' event with a Node stack trace. JSON
output reported {"code":"UNKNOWN","message":"write EPIPE"} on stderr.
Both exited 1, as if the analysis had failed.

The CLI entry point owns process.stdout, so it now treats EPIPE as the
reader declining the rest of the output. It stops writing, suppresses
the failure report and exits 141 like a SIGPIPE-terminated writer, also
when Incur exits through its own failure path. Other stdout errors are
handled as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): guard mcp doctor output and cover midstream reader closure

The closed-reader guard was only installed for ordinary CLI commands. As a
result `rea mcp doctor | head` still crashed on EPIPE. The guard now lives
in one entry-point function shared by both CLI branches; MCP stdio keeps
its own lifecycle.

The tests now also close the reader after the first chunk of a 4 MiB
streamed JSON result, so later writes in writeJsonOutput are covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:20:19 -07:00
morluto 18591f78ae Merge remote-tracking branch 'origin/main' into codex/bug-sweep-20261015-final 2026-10-15 09:14:14 +08:00
Kaoru0822andClaude Opus 5.5 44b197f924 fix(javascript): parse JavaScript sources with JavaScript grammar (#3782)
parserPluginsForPath enabled Babel's typescript plugin for .js, .jsx,
.mjs and .cjs sources. TypeScript reads some valid JavaScript
differently: a conditional whose consequent is an arrow with a
parenthesized body (c?x=>(a):y=>(b)) throws as a return-type
annotation, and a<b>(c) becomes a generic call. VS Code's 20 MB
workbench bundles therefore returned no AST at all.

Select JavaScript grammar (JSX plus legacy decorators) for explicit
JavaScript extensions. TypeScript dialects and unnamed sources keep the
existing TypeScript-capable contract.

Fixes #3780
Refs #3670

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:12:30 -07:00
morluto 610f873e91 Merge remote-tracking branch 'origin/main' into codex/bug-sweep-20261015-final 2026-10-15 09:01:38 +08:00
Kaoru0822andClaude Opus 5.5 59f528f0e5 perf(javascript): share one definitions pass and index wrapper IPC dedupe (#3779)
Static analysis rebuilt the full lexical definitions index three times per
file (open receivers, RPC client roots, binding lookup) and the Electron
wrapper pass checked each substituted IPC registration against every prior
finding with JSON.stringify, which is quadratic in registrations.

Classify open receivers and RPC client roots in one traversal over a single
definitions-only index, then extend that same state with ambient writes for
binding lookup. Index IPC findings by side, operation, channel and location
so duplicate checks only consult same-endpoint candidates.

Static facts are byte-identical on the measured corpora.

Refs #3670

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:59:44 -07:00
morluto c553d1138e fix(windows): clear readonly when no other file attributes remain 2026-10-15 08:49:11 +08:00
morluto 930dd5357f Merge remote-tracking branch 'origin/main' into codex/bug-sweep-20261015-final 2026-10-15 08:44:08 +08:00
Kaoru0822andClaude Opus 5.5 084e540414 fix(native): resolve inspect_plist defaults from the selected target's bundle (#3774)
inspect_plist rooted every file target at the file's own directory, so a
program file under App.app/Contents/MacOS defaulted to
Contents/MacOS/Contents/Info.plist and --relative-path resolved from MacOS/
instead of the app root the CLI documents. A selected plist file likewise
looked for <dir>/Contents/Info.plist instead of reading itself.

A program file directly under a bundle's Contents/MacOS now roots at that
bundle, and a plist artifact target is its own default plist. The missing
default message names the default plist rather than Contents/Info.plist.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:40:24 -07:00
morluto db689f3c3c fix(windows): relax owned parent sharing before admission validation 2026-10-15 08:35:11 +08:00
morluto f15ddbea7a Merge remote-tracking branch 'origin/main' into codex/bug-sweep-20261015-final 2026-10-15 08:31:24 +08:00
morluto 68081ac414 fix(windows): grant retained roots the rights required for cleanup 2026-10-15 08:31:22 +08:00
Kaoru0822andClaude Opus 5.5 bddeae5108 fix(managed): charge admitted member facts once in the final projection (#3487)
* fix(managed): charge admitted member facts once in the final projection

inspect_managed_members admits method bodies, signatures, call edges,
field accesses and user strings as they are produced, then admits the
whole result again before returning it. The final pass re-counted every
already-admitted record, so the 64 MiB representation budget was spent
at roughly twice the result's JSON size. Ordinary assemblies such as
MathNet.Numerics, MongoDB.Driver, Npgsql, ClosedXML, System.Reactive and
Azure.Storage.Blobs returned resource-limit with no members.

The budget now remembers each admitted projection. A containing
projection spends that charge once instead of counting the subtree
again; a value that serializes more than once still pays for every
further occurrence. Results that already fit are byte-identical.

Refs #3449

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(managed): check a repeated occurrence pays with fresh credit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:19:33 -07:00
morluto f78d137b42 fix(windows): retain unpublished runtimes after cleanup failure 2026-10-15 08:16:22 +08:00
morluto 1a3a96d36b fix(windows): honor directory readonly semantics during cleanup 2026-10-15 08:16:22 +08:00
Kaoru0822andClaude Opus 5.5 c9764084b8 fix(reconstruction): withhold readiness for manifest references to absent Evidence (#3526)
build_reconstruction_obligation_ledger accepted a manifest original case or
fixture whose Evidence ID was absent from the bundle whenever another entry
of the same case kind was valid. The obligation was reported verified, the
ledger ready, and the dangling ID appeared in evidence_links with no
diagnostic, although the documented contract requires every referenced
Evidence ID to exist in the bundle.

Report each absent original-case or fixture reference as missing-original-case
or missing-case, naming the ID. Any such diagnostic withholds verification and
readiness.

Fixes #3363

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:11:40 -07:00
Kaoru0822andClaude Opus 5.5 0f966e2b44 fix(reconstruction): merge repeated observations into one generated obligation (#3524)
Two capture-process records of the same executable and scenario generate
the same obligation ID. addCandidate added their definition counts, so the
ledger reported duplicate-definition, a closure blocker meant for competing
definitions, merely because the claim was observed twice. The merge also
kept only the first record's unavailable_authority and
required_next_evidence.

Generated IDs digest their derivation key, so merging two generated
candidates keeps one definition. A reviewed definition that reuses an ID is
still a duplicate. The merge now unions unavailable_authority and
required_next_evidence from every observation.

Fixes #3375

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:11:28 -07:00
Kaoru0822andClaude Opus 5.5 1851f1fcfd fix(managed): report ILONLY-clear assemblies as mixed in boundary summaries (#3516)
inspect_managed_native_boundaries derived summary.mixed_mode_or_native_header
only from the managed native header and the native entry-point flag. A C++/CLI
assembly with ILONLY clear and no ReadyToRun signature was classified as
mixed-clr-native by inspect_managed_artifact but summarized as not mixed.

Give the rule one owner, managedCliIsMixedClrNative in ManagedPeReader, and
use it for both the artifact runtime family and the boundary summary. The
summary now reads the CLI header directly instead of the cli_native projection.

Fixes #3366

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:11:12 -07:00
Kaoru0822andClaude Opus 5.5 2b2a5d0f26 fix(native): inspect arm64e.x1 slices by their exact name (#3500)
inspect_macho passed the CPU-family spelling (`arm64e`) for every dotted lipo
slice name to otool, nm, dwarfdump and vtool. That is right for the
pointer-auth ABI version suffix (`arm64e.v1`), but `arm64e.x1` is a distinct
subtype: on a universal x86_64 + arm64e.x1 executable otool failed with
"does not contain architecture: arm64e" and the whole inspection failed.

Strip only the `.v<N>` ABI version suffix and pass other variant names
exactly. vtool has no spelling for a variant subtype, so skip it for such
slices and report that build metadata comes from otool only.

Fixes #3389

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:10:58 -07:00
Kaoru0822andClaude Opus 5.5 2a9252e4e6 fix(managed): report metadata range failures at artifact file offsets (#3508)
ManagedMetadataLayout's range check reported offsets relative to the buffer
it was given: the metadata root for version and stream headers, and the
table stream for the tables header, row counts and table data. Other
diagnostics in the same reader already use artifact file offsets, so a
truncated table stream at file offset 888 was reported at offset 24, inside
the DOS header.

Pass each buffer's artifact file offset to the range check so every
invalid-metadata-root issue carries a file offset.

Fixes #3364

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:06:06 -07:00
Kaoru0822andClaude Opus 5.5 7666a482b6 fix(adb)!: keep the exact Android long version code (#3485)
inspect_adb_package converted the dumpsys versionCode, a signed 64-bit long
(versionCodeMajor << 32 | versionCode), to a JavaScript number. Values above
2^53 were rounded, so 9007199254740993 was reported as 9007199254740992 with
the same Evidence ID, and negative values became null.

Return version_code as the exact decimal string dumpsys prints, matching the
apktool and JADX version_code contracts.

BREAKING CHANGE: inspect_adb_package version_code is now a decimal string
("45") instead of a JSON number (45). Read it as a string, or parse it with
BigInt when numeric comparison is needed.

Fixes #3368

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:01:25 -07:00
morluto fa318995f5 fix(setup): include registered IDA budgets in client deadlines 2026-10-15 07:36:34 +08:00
morluto 9a44fea347 test(mcp): avoid unrelated validator compilation in availability checks 2026-10-15 07:12:53 +08:00
morluto 2819defeea test(cli): verify attributed caveats in composed analysis 2026-10-15 06:56:09 +08:00
morluto 937b4e69c8 fix(cache): invalidate snapshots that lack source caveat semantics 2026-10-15 06:45:53 +08:00
morluto 1b668a527d chore: integrate current main before bug qualification 2026-10-15 06:42:51 +08:00
morluto 1e377e6965 perf(evidence): group repeated caveats with their source operations 2026-10-15 06:39:48 +08:00
morluto fb6e2b07e0 fix(ida): bound readiness requests by the remaining deadline 2026-10-15 06:34:32 +08:00
morluto c4608a2962 fix(evidence): preserve source attribution across composed workflows 2026-10-15 06:33:48 +08:00
morluto 225f26a5f8 refactor(ghidra): give function boundary scans one owner 2026-10-15 06:25:02 +08:00
morluto a004061abc fix(native): preserve provider limitations through call traces 2026-10-15 06:20:20 +08:00
morluto 01a1b3fda6 fix(ghidra): retain function boundary limitations on references 2026-10-15 06:20:20 +08:00
Ysopwnable 3d2846f237 fix(ghidra): invalidate synthetic entry reference snapshots (#3728)
fix(ghidra): exclude synthetic entry references
2026-10-15 06:14:29 +08:00
527 changed files with 35726 additions and 3286 deletions

No files matched your search

@@ -59,7 +59,7 @@ availability have different remedies; avoid repeating setup for all of them.
absent, inspect the client's MCP launch error rather than repeating setup.
REA setup never installs or upgrades Node.js, npm, Homebrew, Java, Ghidra, IDA,
JADX, Binwalk, or Unblob. Use existing prerequisites; do not install unrelated
JADX, Kuna, Binwalk, or Unblob. Use existing prerequisites; do not install unrelated
software to repair
MCP registration. For an unsupported client, use manual stdio registration
with a version-pinned `rea-agents` package or continue through the CLI.
@@ -79,7 +79,7 @@ is within the authorized scope, use `npx -y rea-agents@latest` in its place.
Configuration repair starts with a read-only setup plan; show paths, backups and
skill replacement before applying authorized changes. Preserve existing approval
and target-execution boundaries. REA setup never installs or upgrades unrelated
software, including Node.js, npm, Homebrew, Java, Ghidra, IDA, JADX, Binwalk or Unblob.
software, including Node.js, npm, Homebrew, Java, Ghidra, IDA, JADX, Kuna, Binwalk or Unblob.
## Route the target first
@@ -215,6 +215,20 @@ after opening; IDA does not supply `binary_overview`. Consult session availabili
when composing broader workflows. Modern direct callers and unsupported dossier
facets remain unknown; live IDA results are not replayed from snapshots.
With `REA_KUNA_COMMAND` configured, `provider_id: "kuna"` answers procedure
lists, lookups, pseudocode, assembly and `analyze_function` from Kuna's cached
whole-program export. Callers/callees use a separate body-free graph shared by
the session; `xrefs` returns exact-address incoming sites and filters forwarding
aliases. These queries and inventory lookups do not trigger a C export. Indirect
targets remain unknown and can make relationship coverage partial. Reference
caches expire on close; a fresh CLI process repeats the native reference walk.
Typed references, CFG, raw-memory tools and annotations remain unsupported. A cold first
answer can come from a single-function run (its limitations say so); assembly
waits for the export. For pseudocode and assembly, `raw_result.source` names the
cached `.c`/`.asm` file and byte span, which you may search directly instead of
calling per function. See the
[Kuna provider guide](https://github.com/morluto/rea/blob/main/docs/kuna-provider.md).
If the user says only "my app" without a name, path, or target already selected
for this task, ask which app before searching for artifacts. Paths in unrelated
saved reports and nearby test fixtures do not select the user's target. Resolve
@@ -94,6 +94,36 @@ recorded observations, identity, hashes, exports and source ranges; it does not
include every child syntax observation, related edge or original source file.
An absent item fact is not evidence of absence from the whole application.
For canonical identities and retained source-range counts, use a typed reference
page instead of reading every full item:
```json
{
"source": {
"kind": "retained-evidence",
"evidence_id": "ev_ACTUAL_PARENT_ID"
},
"view": {
"kind": "javascript",
"collection": "modules",
"projection": "references",
"where": { "path": "main.js", "kind": "javascript-module" },
"offset": 0,
"limit": 16
}
}
```
Filters match exact retained strings; omit a filter to include all values, use
`path: null` for unavailable paths, and `path: ""` for a recorded empty path.
Rows preserve canonical `identity` and distinct observation support states in
`basis`. `retained_source_range_count` counts retained source-range observations,
not runtime imports or unique reference sites. Use a row's `node_id` with the item
view above for exact locations and full supporting observations. Follow
`coverage.next_offset`; page exhaustion describes matching retained rows only.
Check `source_coverage` for source selection, partial/unknown graph coverage and
unknown counts before drawing a negative conclusion.
## Trace only the remaining question
Use `trace_application_feature` on the parent application Evidence for one
+1
View File
@@ -741,6 +741,7 @@ jobs:
tests/boundary/filesystem/javascriptApplicationWorkflows.test.ts
tests/boundary/filesystem/webScriptManifestPaths.test.ts
tests/boundary/process/ProcessEvidence.host.test.ts
tests/boundary/process/packageNpmInvocation.test.ts
tests/boundary/process/windowsOutputCapture.test.ts
tests/acceptance/webModuleCli.test.ts
tests/acceptance/webSourceLocationCli.test.ts
+3 -2
View File
@@ -205,7 +205,8 @@ or update either provider.
Native formats and host support vary by provider. See
[Hopper and Ghidra setup](docs/installation.md#hopper), the
[IDA guide](docs/ida-provider.md) (including an optional native MCP bridge), and
[IDA guide](docs/ida-provider.md) (including an optional native MCP bridge), the
[Kuna decompiler guide](docs/kuna-provider.md), and
[experimental Windows Ghidra support](docs/windows-ghidra-p0.md).
Ghidra also supports [16-bit DOS analysis](docs/ghidra-dos.md).
For large binaries, raise the provider's startup deadline with
@@ -344,7 +345,7 @@ Report vulnerabilities through [SECURITY.md](SECURITY.md).
## Star history
🎉 **200,000 GitHub stars — thank you!**
🎉 **250,000 GitHub stars — thank you!**
Thanks to everyone using REA, reporting bugs, requesting features, testing builds, and contributing fixes.
+1
View File
@@ -58,6 +58,7 @@ pin inspection sources; they are not included in the npm package.
| ghidra-nativeaot | [MIT](https://github.com/Washi1337/ghidra-nativeaot/blob/effeb734fc570c32650f88b159608979dc7b423e/LICENSE.md) | Pinned inspection source; derived parser attribution above. |
| JADX | [Apache-2.0](https://github.com/skylot/jadx/blob/v1.5.6/LICENSE) | The audited jadx-headless-mcp source uses JADX 1.5.6 for Android decompilation; the engine JAR is separately supplied. |
| jadx-headless-mcp | [Apache-2.0](https://github.com/1013503897/jadx-headless-mcp/blob/5844800a486d2248fa949b74c9896285f5b54de2/LICENSE) | v0.7.1; pinned submodule and user-supplied JAR. |
| Kuna | [Apache-2.0](https://github.com/Noelo-Lab/kuna/blob/v1.833/LICENSE), with its [NOTICE](https://github.com/Noelo-Lab/kuna/blob/v1.833/NOTICE) | Bring your own `kuna`; REA verified 1.833 and never downloads, installs or bundles it. REA invokes it as a separate process. |
| Apktool | [Apache-2.0](https://github.com/iBotPeaches/Apktool/blob/master/LICENSE.md) | User-supplied Android resource decoder. |
| Binwalk | [MIT](https://github.com/ReFirmLabs/binwalk/blob/4fdab3d464d97b68e0af9088df3f9e2e1545b21c/LICENSE) | v3.1.0; pinned submodule and user-supplied firmware engine. |
| Unblob | [MIT](https://github.com/onekey-sec/unblob/blob/1fcc7a0a584a70a96c31f5a276c20944d199a089/LICENSE) | 26.6.4; pinned submodule and user-supplied firmware engine. |
+80 -67
View File
@@ -934,7 +934,7 @@ public final class ReaGhidraBridge extends HeadlessScript {
String value = decompiledText(decompile(function));
JsonObject result = functionObservation(
value == null ? JsonNull.INSTANCE : GSON.toJsonTree(value),
noReturnCallLimitations(
functionBoundaryLimitations(
function,
currentProgram.getListing().getInstructions(function.getBody(), true)
)
@@ -1027,7 +1027,7 @@ public final class ReaGhidraBridge extends HeadlessScript {
InstructionScan scan = scanInstructions(function, Integer.MAX_VALUE);
return functionObservation(
GSON.toJsonTree(renderAssembly(scan.instructions)),
noReturnCallLimitations(function, scan.instructions)
functionBoundaryLimitations(function, scan.instructions)
);
}
@@ -1046,7 +1046,7 @@ public final class ReaGhidraBridge extends HeadlessScript {
limitations.add(
"The fast path does not invoke the decompiler or scan whole-program names and strings."
);
List<String> boundaryLimitations = noReturnCallLimitations(function, scan.instructions);
List<String> boundaryLimitations = functionBoundaryLimitations(function, scan.instructions);
for (String limitation : boundaryLimitations) limitations.add(limitation);
JsonObject result = new JsonObject();
result.add("procedure", procedureIdentity(function));
@@ -1069,7 +1069,7 @@ public final class ReaGhidraBridge extends HeadlessScript {
result.add(canonicalAddress(item.getEntryPoint()));
}
if (callers) {
JsonObject observation = functionObservation(result, noReturnCallLimitations(function,
JsonObject observation = functionObservation(result, functionBoundaryLimitations(function,
currentProgram.getListing().getInstructions(function.getBody(), true)
));
observation.add("relationship_coverage", callRelationshipCoverage(null,
@@ -1099,7 +1099,7 @@ public final class ReaGhidraBridge extends HeadlessScript {
result.add("classification", functionClassification(function));
return functionObservation(
result,
noReturnCallLimitations(
functionBoundaryLimitations(
function,
currentProgram.getListing().getInstructions(function.getBody(), true)
)
@@ -1131,12 +1131,22 @@ public final class ReaGhidraBridge extends HeadlessScript {
result.addProperty("direction", direction);
result.add("references", edges);
result.addProperty("reference_kinds_available", true);
JsonArray unresolvedCalls = direction.equals("outgoing")
? callBoundaryObservation(
List<String> limitations;
JsonArray unresolvedCalls = new JsonArray();
if (direction.equals("outgoing")) {
CallBoundaryObservation calls = callBoundaryObservation(
function, currentProgram.getListing().getInstructions(function.getBody(), true), null, true, references
).unresolvedCalls() : new JsonArray();
);
unresolvedCalls = calls.unresolvedCalls();
limitations = calls.limitations();
} else {
limitations = functionBoundaryLimitations(
function,
currentProgram.getListing().getInstructions(function.getBody(), true)
);
}
result.add("unresolved_calls", unresolvedCalls);
return result;
return functionObservation(result, limitations);
}
private JsonObject inspectNativeDataType(JsonObject params) throws Exception {
@@ -1337,12 +1347,7 @@ public final class ReaGhidraBridge extends HeadlessScript {
result.add("references", references);
if (includeIncoming) {
TreeMap<String, Reference> incoming = new TreeMap<>();
ReferenceIterator incomingIterator = currentProgram.getReferenceManager().getReferencesTo(address);
while (incomingIterator.hasNext()) {
monitor.checkCancelled();
Reference reference = incomingIterator.next();
if (!reference.isEntryPointReference()) addReference(incoming, reference);
}
visitObservedReferencesTo(address, reference -> addReference(incoming, reference));
List<Reference> orderedIncoming = new ArrayList<>(incoming.values());
orderedIncoming.sort(REFERENCE_ORDER);
JsonArray incomingReferences = new JsonArray();
@@ -1394,16 +1399,8 @@ public final class ReaGhidraBridge extends HeadlessScript {
requireKeys(params, Set.of("document", "address"));
requireDocument(params);
Address address = requireAddress(params, "address");
ReferenceIterator references = currentProgram.getReferenceManager().getReferencesTo(address);
Set<Address> sources = new HashSet<>();
while (references.hasNext()) {
monitor.checkCancelled();
Reference reference = references.next();
if (reference.isEntryPointReference()) {
continue;
}
sources.add(reference.getFromAddress());
}
visitObservedReferencesTo(address, reference -> sources.add(reference.getFromAddress()));
List<Address> ordered = new ArrayList<>(sources);
ordered.sort(Address::compareTo);
JsonArray result = new JsonArray();
@@ -3431,51 +3428,27 @@ public final class ReaGhidraBridge extends HeadlessScript {
return omitted[0];
}
private List<String> noReturnCallLimitations(
private List<String> functionBoundaryLimitations(
Function function, Iterable<Instruction> instructions)
throws Exception {
List<String> limitations = new ArrayList<>();
Instruction beforePrevious = null;
Instruction previous = null;
for (Instruction instruction : instructions) {
monitor.checkCancelled();
String limitation = terminalCallLimitation(instruction);
if (limitation != null) limitations.add(limitation);
if (beforePrevious != null && previous != null) {
String seh = borlandSehHandlerLimitation(
function, beforePrevious, previous, instruction);
if (seh != null) limitations.add(seh);
}
beforePrevious = previous;
previous = instruction;
}
return limitations;
FunctionBoundaryLimitations boundary = new FunctionBoundaryLimitations(function);
for (Instruction instruction : instructions) boundary.observe(instruction);
return boundary.values();
}
private CallBoundaryObservation callBoundaryObservation(
Function function, Iterable<Instruction> instructions, Set<Function> returnedCallees,
boolean includeUnresolvedSites, List<Reference> observedReferences)
throws Exception {
List<String> limitations = new ArrayList<>();
FunctionBoundaryLimitations boundary = new FunctionBoundaryLimitations(function);
CallBoundaryReferences calls = new CallBoundaryReferences(returnedCallees, includeUnresolvedSites);
Instruction beforePrevious = null;
Instruction previous = null;
if (observedReferences == null) visitReferences(function, "outgoing", calls::observe);
else for (Reference reference : observedReferences) {
monitor.checkCancelled();
calls.observe(reference);
}
for (Instruction instruction : instructions) {
monitor.checkCancelled();
String limitation = terminalCallLimitation(instruction);
if (limitation != null) limitations.add(limitation);
if (beforePrevious != null && previous != null) {
String seh = borlandSehHandlerLimitation(
function, beforePrevious, previous, instruction);
if (seh != null) limitations.add(seh);
}
beforePrevious = previous;
previous = instruction;
boundary.observe(instruction);
if (!instruction.getFlowType().isCall()) continue;
boolean destination = false;
for (Reference reference : instruction.getReferencesFrom()) {
@@ -3489,10 +3462,38 @@ public final class ReaGhidraBridge extends HeadlessScript {
"Instruction decoder identifies a call but ReferenceManager supplies no call destination");
}
}
return new CallBoundaryObservation(List.copyOf(limitations),
return new CallBoundaryObservation(boundary.values(),
returnedCallees == null ? null : calls.unrepresented, calls.unresolvedCalls());
}
private final class FunctionBoundaryLimitations {
private final Function function;
private final List<String> limitations = new ArrayList<>();
private Instruction beforePrevious;
private Instruction previous;
private FunctionBoundaryLimitations(Function function) {
this.function = function;
}
private void observe(Instruction instruction) throws Exception {
monitor.checkCancelled();
String limitation = terminalCallLimitation(instruction);
if (limitation != null) limitations.add(limitation);
if (beforePrevious != null && previous != null) {
String seh = borlandSehHandlerLimitation(
function, beforePrevious, previous, instruction);
if (seh != null) limitations.add(seh);
}
beforePrevious = previous;
previous = instruction;
}
private List<String> values() {
return List.copyOf(limitations);
}
}
private String borlandSehHandlerLimitation(
Function function, Instruction handlerPush, Instruction framePush,
Instruction frameLink) {
@@ -3674,24 +3675,36 @@ public final class ReaGhidraBridge extends HeadlessScript {
monitor.checkCancelled();
Address address = addresses.next();
if (outgoing) {
for (Reference reference : currentProgram.getReferenceManager()
.getReferencesFrom(address)) {
monitor.checkCancelled();
if (!reference.isEntryPointReference()) visitor.accept(reference);
}
visitObservedReferencesFrom(address, visitor);
}
else {
ReferenceIterator iterator = currentProgram.getReferenceManager()
.getReferencesTo(address);
while (iterator.hasNext()) {
monitor.checkCancelled();
Reference reference = iterator.next();
if (!reference.isEntryPointReference()) visitor.accept(reference);
}
visitObservedReferencesTo(address, visitor);
}
}
}
private void visitObservedReferencesFrom(Address address, ReferenceVisitor visitor)
throws Exception {
for (Reference reference : currentProgram.getReferenceManager().getReferencesFrom(address)) {
monitor.checkCancelled();
visitObservedReference(reference, visitor);
}
}
private void visitObservedReferencesTo(Address address, ReferenceVisitor visitor)
throws Exception {
ReferenceIterator references = currentProgram.getReferenceManager().getReferencesTo(address);
while (references.hasNext()) {
monitor.checkCancelled();
visitObservedReference(references.next(), visitor);
}
}
private static void visitObservedReference(Reference reference, ReferenceVisitor visitor)
throws Exception {
if (!reference.isEntryPointReference()) visitor.accept(reference);
}
private static void addReference(TreeMap<String, Reference> observed, Reference reference) {
String key = canonicalAddress(reference.getFromAddress()) + "\u0000" +
canonicalAddress(reference.getToAddress()) + "\u0000" +
+1
View File
@@ -60,6 +60,7 @@ export default defineConfig({
collapsed: true,
items: [
{ text: "IDA", link: "/ida-provider" },
{ text: "Kuna", link: "/kuna-provider" },
{ text: "Ghidra on Windows", link: "/windows-ghidra-p0" },
{ text: "Ghidra DOS analysis", link: "/ghidra-dos" },
{ text: "Ghidra raw binary", link: "/raw-binary" },
+4 -2
View File
@@ -343,8 +343,10 @@ an invalid supplied size remains unknown with incomplete resource coverage while
the resource's other facts are retained. Zero and nonnegative fractional sizes
are preserved.
CDP discovery, connection, and commands wait for the peer or caller cancellation;
a stalled peer can leave an operation waiting. WebSocket messages remain subject
CDP discovery has a 10-second deadline. Each WebSocket handshake and command
response has its own 20-second deadline, separate from the caller-selected
observation window. A stalled handshake or command reports `provider_timeout`;
caller cancellation still reports cancellation. WebSocket messages remain subject
to the [64 MiB limit](#request-boundary). REA does not impose a message-count or
pending-command quota. On cancellation, it closes only its own WebSocket,
waiting up to one second before terminating it. Malformed unsolicited events
+9
View File
@@ -144,6 +144,15 @@ distinction: it closes and deletes provider-owned profiles, but only disconnects
from an external CDP browser. Real-browser verification checks both outcomes and
confirms that an attached external browser remains alive.
`environment.locale` sets Intl formatting in both modes. Launch also sets
`navigator.language`, `navigator.languages`, and the request `Accept-Language`.
Connect preserves the caller's page and request languages; every attached
capture identifies this locale limitation, including retained partial
observations. Use launch mode when the application must select the requested
language through navigator values or request headers. Artifact completeness
covers the selected observations, not equivalence of launch and connect
language environments.
HTTP(S) URLs may include ordinary query values and fragments directly. Use
ordered structured query entries when a value needs to reference a declared
environment-backed secret. Form, storage, and cookie values are either literal
+11 -3
View File
@@ -95,8 +95,9 @@ dependency edges, and the section's file range. A missing `.dep-v0` section is
null metadata, not proof that the binary has no dependencies. See
[Rust binaries](rust-binaries.md).
Configure [Hopper or Ghidra](installation.md#hopper), or the
[IDA adapter](ida-provider.md), before analyzing a native target. Substitute
Configure [Hopper or Ghidra](installation.md#hopper), the
[IDA adapter](ida-provider.md), or [Kuna](kuna-provider.md) before analyzing a
native target. Substitute
your target, search text and function name or address in these examples:
```bash
@@ -314,7 +315,9 @@ diagnostics appear inside the report when `--full-output` is selected. Log
truncation alone does not change the diagnostic health or exit status.
The default terminal format is TOON. Use `--json` when saving results for a
JSON consumer. `--json` is indented on a terminal and compact when piped or
JSON consumer. Valued output flags (`--format`, `--filter-output`,
`--token-limit`, `--token-offset`) accept `--flag value` or `--flag=value`; a
missing value fails with `MISSING_OUTPUT_VALUE` before the command runs. `--json` is indented on a terminal and compact when piped or
redirected, which keeps large results smaller for agents and scripts; pipe
through `jq .` for indented files. Output selection and formatting do not change
operation status.
@@ -352,6 +355,11 @@ command, objdump, Rizin and GDB. In these paths, a returned structured
signal-derived status. This describes the current source routing; it is not a
claim that every command or provider runtime has been independently exercised.
When the reader of piped output closes early, as `rea ... | head` does, the
CLI stops writing, prints no error and exits `141` (`128 + 13`, the status of a
SIGPIPE-terminated writer). The operation itself may have completed; only its
output was declined.
`inspect-artifact` also returns a structured cancelled result, but its direct
analysis cancellation path does not set a signal-derived exit status, so it
exits `1`. Setup has its own contract: cancellation exits `0`. Treat the
+7 -4
View File
@@ -148,8 +148,10 @@ startup; an explicit Ghidra startup timeout of 2700000 ms produces a 2820000 ms
tool timeout. The startup allowance follows an explicitly selected Ghidra or
Hopper provider, and otherwise uses the larger known Ghidra/Hopper deadline.
An explicit `REA_JEB_MCP_TIMEOUT_MS` request budget also contributes to that
maximum. Setup forwards these explicitly selected REA deadlines and the input
schema profile into the registration; unrelated process values are omitted.
maximum. For `ida` or `auto` selection, a valid IDA registration's parsed
`timeoutMs` also contributes to that maximum; its default is 300000 ms.
Setup forwards these explicitly selected REA deadlines and the input schema
profile into the registration; unrelated process values are omitted.
This headroom is a practical default, not a guarantee for every analysis
duration. Setup preserves positive timeout values already in the `rea` entry.
You can edit `startupTimeoutMs` and `toolTimeoutMs` there; doctor keeps positive
@@ -241,8 +243,9 @@ the default Ghidra allowance; an explicit Ghidra startup timeout of 2700
seconds yields 2820 seconds. Setup preserves positive caller-selected timeout
values in the REA entry, and doctor reports a non-blocking advisory when a tool
timeout is shorter than the known provider allowance. An explicitly selected
JEB request budget also contributes to the allowance. These values are
client-side deadlines, so increase them in `~/.codex/config.toml` if a
JEB request budget also contributes to the allowance. A configured IDA
registration's parsed `timeoutMs` contributes for `ida` or `auto` selection.
These values are client-side deadlines, so increase them in `~/.codex/config.toml` if a
workload needs more time. Devin honors `XDG_CONFIG_HOME` for its
`devin/mcp_config.json` on non-Windows systems.
+6
View File
@@ -116,6 +116,12 @@ If cleanup cannot be verified, the error retains collected observations in
`details.partial_observation` and marks their application cleanup `unverified`.
Cleanup uncertainty does not authorize signaling unrelated processes.
### Target fuse prerequisites
Active scenario capture requires that the target Electron executable honors Node CLI inspector flags (`--inspect` or `--remote-debugging-port`) so that Playwright can establish its DevTools protocol session.
When an Electron executable explicitly disables the `EnableNodeCliInspectArguments` fuse (or removes the capability), `capture-electron-scenario` fails immediately before process launch with an `AnalysisUnsupportedTargetError` ("unsupported_target") rather than waiting for the startup deadline. For targets with disabled inspector fuses, use passive CDP inspection via `inspect_electron_page` or run against an unrestricted development binary with the extracted `app.asar`.
The real verifier exercises compiled CLI and stdio MCP discovery, page/script
inspection, static/runtime reconciliation, active observation, and CLI SIGTERM
cleanup before checking the IPC, renderer crash/reload, utility/child-process,
+6
View File
@@ -69,6 +69,12 @@ Pass a returned MethodTable address to `inspect_native_data_type`. A direct PE
query also derives the snapshot metadata from the authenticated Ghidra session
handshake, so it does not require a preceding load-image call. In a persistent
MCP session, load-image followed by type inspection reuses that same derivation.
The bridge resolves the caller's address spelling once; metadata lookup uses
its canonical default-space identity. Bare hexadecimal, prefixed hexadecimal,
and encoded default-space selectors therefore select the same MethodTable.
Other address spaces and unresolved identities are not matched by offset alone.
Metadata already supplied by the engine is retained without reading or deriving
an additional source snapshot.
The database result remains `unavailable` when Ghidra has no DataType at that
address; its `metadata_recovery.source` is `read-only-derived-overlay` and
carries related type, interface, slot, and target observations. Generated
+7 -3
View File
@@ -153,8 +153,8 @@ overview merely because its source artifact is unchanged.
Function extents and instruction completeness refer to Ghidra's analyzed body.
An inferred no-return call can terminate that body before subsequent bytes.
Pseudocode, assembly, procedure info, instruction windows, callee and caller
reads, and dossiers report observed terminal call sites in Evidence limitations,
Pseudocode, assembly, procedure info, instruction windows, incoming and outgoing
references, callee and caller reads, and dossiers report observed terminal call sites in Evidence limitations,
including resolved callee names, addresses, and FunctionManager flags when
available. On x86-32, the same views also report the exact Borland/Delphi-style
FS exception-registration pattern when its handler address falls outside the
@@ -193,7 +193,11 @@ these tools before compilation. Keeping this matrix separate lets Linux
host/provider acceptance run with only the host compiler.
`npm run verify:ghidra:windows` checks source-owned native x86-64 PE applications;
`-- --x86` selects x86 and `-- --dll` selects DLLs, and the flags can be combined.
`-- --x86`, `-- --arm`, or `-- --arm64` selects another target architecture;
`-- --dll` selects DLLs. Choose one architecture and optionally combine it with
`--dll`. These static fixtures contain source-owned encoded instructions; they
are not compiler-produced programs. See the [Windows verification scope](windows-ghidra-p0.md#native-authority-and-target-identity)
for real-provider coverage and exclusions.
These lanes check all 26 read-only operations, target/snapshot/import SHA-256 linkage,
and project, endpoint, process, and runtime cleanup. The independent native
lane checks DACLs, handle admission, cancellation, and Job Object lifecycle.
+2 -2
View File
@@ -131,9 +131,9 @@ Use a package version that actually includes this adapter; repository main can b
{"name":"close_binary","arguments":{}}
```
Opening an MCP target starts its selected provider session; headless opening waits for auto-analysis. Set the agent's MCP request deadline long enough for the target. The registration's optional `timeoutMs` defaults to 300000 for upstream requests. An upstream SDK request that reaches this deadline returns `provider_timeout` with its operation and configured budget. A freshly opened headless worker can briefly report `status: "busy"` from `server_health`; REA re-reads the health every 100 ms until the worker answers, the caller cancels, or `timeoutMs` has elapsed since the first read. Expiry of this polling deadline while the worker is still busy also produces a retryable `provider_timeout`; no further read is started once the deadline has passed. That error names the busy tool of the last observation, or `unknown` when the worker reported none or a value that is not tool-name-shaped. Cancellation during the wait produces `cancelled`. Any other unexpected health payload, including a busy payload with an invalid shape, remains `unreadable_output`. Cancellation drains the current upstream request before cleanup; it does not force-stop GUI analysis. An open request that times out without a completed response retains the private workspace because worker inventory alone cannot prove the request has stopped. `binary_session` reports actual tool availability. Repeated doctor/setup calls are unnecessary when the registration already works.
Opening an MCP target starts its selected provider session; headless opening waits for auto-analysis. Set the agent's MCP request deadline long enough for the target. The registration's optional `timeoutMs` defaults to 300000 for upstream requests. An upstream SDK request that reaches this limit returns `provider_timeout` with its operation and actual request budget. A freshly opened headless worker can briefly report `status: "busy"` from `server_health`; REA re-reads health every 100 ms until the worker answers, the caller cancels, or `timeoutMs` has elapsed since the first read. Each health request is capped by the time remaining in that overall wait, so a stalled read cannot extend the readiness deadline by another full request timeout. Expiry while the worker is still busy produces a retryable `provider_timeout`; no further read is started after the deadline. That error names the busy tool from the last observation, or `unknown` when the worker reported none or a value that is not tool-name-shaped. If a health request itself consumes the remaining wait budget, the same last-busy timeout is returned with the stalled request's captured output. Cancellation during the wait produces `cancelled`. Any other unexpected health payload, including a busy payload with an invalid shape, remains `unreadable_output`. Cancellation drains the current upstream request before cleanup; it does not force-stop GUI analysis. An open request that times out without a completed response retains the private workspace because worker inventory alone cannot prove the request has stopped. `binary_session` reports actual tool availability. Repeated doctor/setup calls are unnecessary when the registration already works.
For guided registration, set `REA_IDA_MCP_CONFIG` before `rea setup --client <client>`. Setup includes that file reference in its reviewed plan and preserves it after approval; it does not copy upstream credentials into the agent configuration. `rea doctor --provider ida --json` validates the registration without starting IDA and explicitly leaves runtime compatibility and target binding for analysis.
For guided registration, set `REA_IDA_MCP_CONFIG` before `rea setup --client <client>`. Setup includes that file reference in its reviewed plan and preserves it after approval; it does not copy upstream credentials into the agent configuration. For `ida` or `auto` selection, Codex/Kimi setup and doctor use the effective client registration's parsed `timeoutMs` (default 300000 ms) when recommending the agent's per-tool deadline. Existing positive client deadlines remain caller choices. `rea doctor --provider ida --json` validates the registration without starting IDA and explicitly leaves runtime compatibility and target binding for analysis.
## Coverage and evidence
+1 -1
View File
@@ -50,7 +50,7 @@ For runtime instrumentation, see the [Frida guide](./frida-instrumentation.md).
| Task | Guides |
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Inspect native functions, references, or types | [Native binaries](native-investigation.md), [Go metadata](go-binaries.md), [Rust dependencies](rust-binaries.md), [offline ELF layout](binary-diagnostics.md), [recorded crashes](recorded-crashes.md) |
| Select a native provider or import format | [Ghidra semantics](ghidra-provider.md), [Windows](windows-ghidra-p0.md), [DOS](ghidra-dos.md), [raw bytes](raw-binary.md), [MIPS](ghidra-mips.md), [PSP](ghidra-psp.md), [NativeAOT](ghidra-nativeaot.md), [IDA](ida-provider.md), [JEB](jeb-analysis.md) |
| Select a native provider or import format | [Ghidra semantics](ghidra-provider.md), [Windows](windows-ghidra-p0.md), [DOS](ghidra-dos.md), [raw bytes](raw-binary.md), [MIPS](ghidra-mips.md), [PSP](ghidra-psp.md), [NativeAOT](ghidra-nativeaot.md), [IDA](ida-provider.md), [Kuna](kuna-provider.md), [JEB](jeb-analysis.md) |
| Analyze JavaScript or Electron artifacts | [Static analysis](javascript-artifact-reconstruction.md), [tracing and comparisons](javascript-application-workflows.md), [application graph](javascript-application-graph.md), [source recovery](javascript-recovery.md) |
| Compare static JavaScript with runtime observations | [Runtime attribution](javascript-runtime-observation.md), [reconciliation](javascript-runtime-reconciliation.md), [Electron observation](electron-observation.md), [Electron fuses](electron-fuses.md) |
| Inspect assemblies, packages, or firmware | [.NET](managed-code-analysis.md), [Android](android-analysis.md), [Apktool resources](apktool-resource-analysis.md), [ADB acquisition](adb-device-analysis.md), [Apple](apple-application-analysis.md), [Harmony](harmony-analysis.md), [firmware](firmware-analysis.md), [WASM](wasm-artifacts.md), [EVM](evm-bytecode.md) |
+44 -12
View File
@@ -3,13 +3,13 @@
Run REA, connect your selected agents, and check the tools needed for your task.
Setup previews configuration changes and asks for approval before applying them.
| Task | Section |
| --------------------------------- | ------------------------------------------------------------------------- |
| Connect an agent | [Start setup](#start-setup), then [review changes](#review-setup-changes) |
| Diagnose one task | [Scoped readiness checks](#check-readiness-for-your-task) |
| Configure an analysis engine | [Hopper](#hopper), [Ghidra](#ghidra), or the [IDA guide](ida-provider.md) |
| Update or remove REA | [Maintenance](#diagnose-update-and-remove) |
| Resolve a client-specific problem | [Client configuration](client-configuration.md) |
| Task | Section |
| --------------------------------- | --------------------------------------------------------------------------------------------------- |
| Connect an agent | [Start setup](#start-setup), then [review changes](#review-setup-changes) |
| Diagnose one task | [Scoped readiness checks](#check-readiness-for-your-task) |
| Configure an analysis engine | [Hopper](#hopper), [Ghidra](#ghidra), the [IDA guide](ida-provider.md), or [Kuna](kuna-provider.md) |
| Update or remove REA | [Maintenance](#diagnose-update-and-remove) |
| Resolve a client-specific problem | [Client configuration](client-configuration.md) |
## Start setup
@@ -398,8 +398,9 @@ running server or its registration.
The npm release checked on **2026-10-11** was **6.4.0**, published from
[`a56f7bb6`](https://github.com/morluto/rea/commit/a56f7bb668ab23fec8d33f7af353ac7ed2fe1895).
The actual registry package accepted dry-run setup plans for the 17 client IDs
in that release, including Qwen Code, Pi and Hermes. DeepSeek Harness (`dsh`)
is included from 6.5.0 and was absent from the checked npm 6.4.0 package.
in that release, including Qwen Code, Pi and Hermes. Seven client IDs are
included from 6.5.0 and were absent from the checked npm 6.4.0 package: `droid`,
`dsh`, `kimi`, `qoder`, `trae`, `workbuddy` and `zcode`.
The 6.4.0 registry check does not establish 6.5.0 publication or live DeepSeek
API integration.
OpenCode's plan selected
@@ -482,8 +483,8 @@ hosted connector; see [its configuration](client-configuration.md#other-client-s
| ZCode | `zcode` |
| DeepSeek Harness | `dsh` |
`dsh`, `kimi`, and `workbuddy` require a release containing them. The registry
check above does not cover them.
`droid`, `dsh`, `kimi`, `qoder`, `trae`, `workbuddy`, and `zcode` require
`rea-agents@6.5.0` or later. The 6.4.0 registry check above does not cover them.
See [client configuration and troubleshooting](client-configuration.md) for
configuration paths, profiles, trust policies, and schema-limit workarounds.
@@ -541,6 +542,37 @@ search permissions (`0700`) on a directory you own before retrying.
On supported Linux distributions, approved setup verifies Hopper's official
`.deb`, `.rpm`, or Arch package before invoking the native package manager.
The official release feed selects the current public demo without a version
pin. REA verifies the package's detached PGP signature against Hopper's stable
primary fingerprint `7C2D73BAFAF5B9A710A69DA1A26DF815099B1BCD`, then checks
that the signed package and installed launcher agree with `main_exe_hash`.
Rotating signing subkeys remain bound to that primary identity.
The feed row itself is not PGP-signed; doctor labels its display version as
`reported_release_version`, separately from the authenticated launcher identity.
The approval plan includes the caller-selected cache location. Approved setup
retains the signed archive, public key and release metadata under
`${XDG_CACHE_HOME:-$HOME/.cache}/rea/hopper-releases/<launcher-sha256>`.
An empty `XDG_CACHE_HOME` uses `$HOME/.cache`. Approved setup can repair a
damaged caller-owned entry after authenticating a fresh package; the previous
entry is preserved beside it as `<launcher-sha256>.backup-<id>`. Ordinary doctor
and launches reject damaged evidence and never repair it implicitly.
Approved publications of the same canonical cache entry share a process-backed
lease. Concurrent setup waits without moving another writer's evidence; a
failed replacement restores the previous directory when possible and reports
any retained backup path. Unavailable reads or native inspection tools do not
authorize replacing existing evidence.
Doctor and launches authenticate this evidence for offline use; an editable
digest receipt alone cannot authorize a launcher. Verification reuses at most
eight immutable package proofs per process, keyed by the complete package,
key, signature, package format and expected launcher digest. Cached file reads
still check identity and content. Without retained evidence, inspecting an
existing install requires the matching current official package and network
access. Successful live inspection can be reused within that process after
rehashing the launcher; it does not write a persistent cache or claim that a
previously observed release is still the latest. Older uncached builds require
an approved update while the feed exposes only its current release.
REA runs the supported demo build on a private Xvfb display and selects Hopper's
offered demo mode for each analysis session; it does not require the user's
desktop display. Unattended package-manager access requires
@@ -765,7 +797,7 @@ and `set_addresses_names` name a function entry or any other mapped address
session metadata edits leave executable bytes unchanged and are discarded on close. GUI controls
require Hopper; Windows P0 remains read-only.
Windows P0 admits native x86 and x86-64 PE applications and DLLs, plus explicitly
Windows P0 admits native x86, x86-64, ARMNT (Thumb-2) and ARM64 PE applications and DLLs, plus explicitly
selected [raw NMOS 6502 images](raw-binary.md#nmos-6502) with a caller-supplied
entry at file offset 0, on fixed local NTFS volumes. Other raw CPU families remain
unsupported on Windows.
+44 -1
View File
@@ -6,7 +6,7 @@ are `inspect_analysis_view`, `trace_application_feature`,
`trace_javascript_semantics`, `compare_application_versions`,
`compare_source_to_bundle`, and `compare_javascript_export_shapes`; their CLI
equivalents use the same names with hyphens. `inspect_analysis_view` projects a
summary, module page, or one module from already completed application
summary, module page, typed module references, or one module from already completed application
Evidence; it does not walk relationships.
`inspect_analysis_view` also projects retained `inspect_binary_layout`
@@ -40,6 +40,46 @@ combine its fields with the fact's location. Semantic trace results include the
canonical context subset referenced by their returned facts, so those facts
remain self-contained in the response.
## Retained module facts
For canonical identities and retained source-range counts, query the existing
`inspect_analysis_view` tool with a typed module-reference projection:
```json
{
"source": {
"kind": "retained-evidence",
"evidence_id": "ev_ACTUAL_PARENT_ID"
},
"view": {
"kind": "javascript",
"collection": "modules",
"projection": "references",
"where": { "path": "main.js", "kind": "javascript-module" },
"offset": 0,
"limit": 16
}
}
```
Replace the parent ID with the actual analysis summary's `parent_evidence_id`.
Filters match exact retained paths and kinds. Omission includes all values;
`path: null` selects an unavailable path and `path: ""` selects a recorded empty
path. Multiple identities can share a path. The default offset is 0 and limit
is 64; follow `coverage.next_offset` for later matching rows in retained order.
Each row contains its `node_id`, kind, path, canonical identity, retained
source-range observation count, and distinct supporting authority/state/confidence
combinations in `basis`. These counts do not prove unique reference sites or
runtime loading. Use the existing module item view with the row's `node_id` for
exact source ranges and complete observations. The result retains parent/query
Evidence identity, artifact identity, limitations and unknowns. `source_coverage`
keeps selected/unselected sources, graph coverage and unknown counts separate
from page exhaustion; an exhausted or empty page cannot prove absence from an
incompletely analyzed application. CLI `inspect-analysis-view` reads the same
request from a JSON file; portable input uses `source.kind: "inline"` with the
complete parent Evidence.
## Feature tracing
Select one literal seed kind: node ID, route, string, API, IPC channel, module,
@@ -128,6 +168,9 @@ valid inputs.
Endpoint nodes keep the exact endpoint in each observation's `properties.value`;
semantic request and response nodes keep it in `properties.endpoint`. Endpoint
lookup identities are preserved independently of the primitive-value lattice's
byte budget. An oversized normalized literal can become unknown while the same
string remains an exact endpoint for tracing and comparison. Endpoint
identity keys use `value-sha256:<digest>` over the canonical JSON string when
that is shorter, or when the original value starts with the reserved digest
prefix. Other short endpoint keys remain unchanged. Endpoint labels use the
+30 -4
View File
@@ -206,6 +206,9 @@ code unit, matching the original bytes identified by the artifact digest.
Plain `.ts` artifact sources use TypeScript syntax without JSX, including
angle-bracket type assertions. `.tsx` and `.jsx` retain JSX parsing.
JavaScript sources use JavaScript grammar with JSX, never TypeScript syntax,
so valid JavaScript that TypeScript reads differently keeps its JavaScript
meaning.
Relative TypeScript imports can name their emitted `.js`, `.mjs`, or `.cjs`
counterparts while resolving to inventoried source files. This substitution
@@ -220,7 +223,10 @@ Selected bounded text is then parsed as inert data to recover:
- Webpack and Rspack chunk registrations and module factories represented as
AST literals;
- static imports, dynamic imports, CommonJS `require` calls, workers, and
service workers;
service workers (only `new Worker(new URL(path, import.meta.url))` resolves
relative to the calling module; string worker and service-worker paths use
the document base URL or Node's working directory, which static analysis
does not establish, so they keep their expression and stay unresolved);
- route, network endpoint, storage, and vendor-marker observations;
- local source-map declarations and original
source names and content digests;
@@ -270,8 +276,13 @@ RPC client syntax also contributes network endpoint candidates, in both
named operation found at the start of a string or cooked template literal —
the name must be followed by variable definitions (`($`), a directive, or a
selection set starting with a field name — or in a precompiled
`OperationDefinition` document object. A graphql-tag `loc.source.body` copy is
not reported twice. Anonymous operations are not reported.
`OperationDefinition` document object. A standalone Source object's `body`
remains an operation candidate even when it has `locationOffset` metadata.
A graphql-tag `loc.source.body` copy is suppressed only when that source
belongs to a recovered document with the same operation and its containing
document, location and source have proven private metadata ownership. Writes,
escapes and classic-script global bindings retain the source observation.
Anonymous operations are not reported.
Literal link options and precompiled document fields follow object property
order: the final definition owns the key. A later spread, dynamic computed key,
@@ -426,7 +437,18 @@ retained candidate strings and temporary canonical-key serialization. This is
an in-memory semantic allocation bound independent of CLI or MCP transport
budgets. Source literal bytes remain in the parsed source and artifact evidence;
when a normalized semantic value exceeds the bound, its value is unknown and
coverage is partial. Expression
coverage is partial. Direct string literals, cooked templates without
substitutions, and derived strings all use this normalization boundary. A
single exact primitive is validated without allocating deduplication or sort
state or serializing a canonical key. Configuration defaults use the same
normalizer; limited defaults retain `value_resource_limit` and an anchored
resource-limit unknown. Known null, false, zero, and empty-string defaults stay
exact. This primitive-value bound does not truncate lookup identities such as
source paths, field names or request endpoints. Full endpoint properties remain
available for endpoint queries, tracing and comparison. Each analysis records encountered limit classifications independently of
later projections: a selected healthy sibling can remain exact while whole-file
coverage reports the encountered bound. Projection preserves limiting values
from the shared property-slot owner. Expression
evaluation and provenance walks stop after 256 nested levels. Union products
and string lengths are checked before allocating combinations or concatenated
strings. When a boundary is reached, the value stays unknown, semantic coverage
@@ -626,6 +648,10 @@ href are read without surrounding whitespace or embedded tabs and newlines, and
their percent-encoded path bytes are decoded; encoded dot and separator bytes
are still rejected. CommonJS module lookups retain extension and directory
resolution.
ESM, HTML, and URL references apply URL dot segments to empty path segments:
`./assets//../app.js` selects `assets/app.js`, while a remaining empty segment
such as `./assets//app.js` stays unavailable. CommonJS keeps filesystem path
semantics and selects `app.js` for the same text.
Unresolved HTML references retain their declaration, source range, and resolution
reason in the renderer observations.
HTML script source ranges follow the HTML parser across LF, CRLF, and bare CR
+5
View File
@@ -95,6 +95,11 @@ pauses or resumes execution, calls `Runtime.runIfWaitingForDebugger`, launches
the target, instruments JavaScript, or invokes Electron APIs. Closing a call
closes only REA's WebSocket.
Each WebSocket handshake and command response has its own 20-second deadline,
separate from the caller-selected observation window. A stalled handshake or
command reports `provider_timeout` and retains observations already received;
caller cancellation still reports cancellation.
The direct observations are:
- `Debugger.scriptParsed`, establishing that a bounded script location was
+7 -4
View File
@@ -91,17 +91,20 @@ nodes. REA evaluates compatible static candidates conservatively:
1. A captured-source SHA-256 plus one matching mapped location yields
a content-and-location match.
2. One unique exact content digest can match even when no location mapping is
available. Whole-asset digests and reconstructed module-factory source
2. When no static candidate exists at a mapped location, one unique exact
content digest can match. Whole-asset digests and reconstructed module-factory source
digests remain distinguishable in the reported basis.
3. Without captured bytes, one unique mapped artifact path can produce a
medium-confidence location match.
4. Multiple candidates remain `ambiguous`; no `observed_as` edge is emitted.
With captured source and mapped candidates, only mapped content matches
qualify; unrelated content matches elsewhere are excluded.
`candidate_static_count` reports the full qualified layer/node count, and
`candidate_static_nodes` includes every unique candidate reference.
5. If captured bytes disagree with the static candidate at the mapped path,
the result is an explicit mismatch. A path never overrides a digest
disagreement.
the result is an explicit mismatch. An equal digest elsewhere cannot hide
that disagreement. If a mapped candidate's digest is unavailable and no
mapped content match is known, the comparison remains `unknown`.
6. Missing authorization mappings and incomplete or truncated input coverage
remain unknown or truncated rather than becoming absence claims.
+112
View File
@@ -0,0 +1,112 @@
# Kuna provider
[Kuna](https://github.com/Noelo-Lab/kuna) is an Apache-2.0 decompiler distributed as one `kuna` executable. REA uses a `kuna` you supply. It does not download, install, update or bundle Kuna. REA verified this provider with Kuna 1.833; it accepts other releases and reports them as unverified in `rea doctor` and in each analysis profile.
Kuna is static: it reads the selected image and never executes it.
## Configure
```bash
export REA_KUNA_COMMAND=/absolute/path/to/kuna
rea doctor --provider kuna
```
Select it explicitly with `--provider kuna`, MCP's `open_binary.provider_id: "kuna"`, or `REA_ANALYSIS_PROVIDER=kuna`. With Kuna and another provider configured for the same target, `auto` reports `ambiguous` instead of choosing one.
| Setting | Default | Meaning |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `REA_KUNA_COMMAND` | none (required) | Absolute path of the `kuna` executable. |
| `REA_KUNA_CACHE_DIR` | `~/Library/Caches/rea/kuna` (macOS), `$XDG_CACHE_HOME/rea/kuna` (Linux; `~/.cache/rea/kuna` when `XDG_CACHE_HOME` is unset or relative) | Absolute directory REA owns for project exports. Kuna's own spec cache also lives here, not in your Kuna cache. |
| `REA_KUNA_CACHE_MAX_BYTES` | 4 GiB | Size cap; least recently used exports are evicted above it. |
| `REA_KUNA_PROJECT_TIMEOUT_MS` | 30 minutes | Deadline for whole-program inventory/export, reference and string scans. |
| `REA_KUNA_TIMEOUT_MS` | 120 s | Deadline for one single-function decompile, and for the inventory run REA makes when the export ends without one. |
| `REA_KUNA_JOBS` | 1 | `decompile-project --jobs`. 1 is Kuna's reference answer; more jobs finish sooner but lose callee-first prototypes, and change about 40–60% of function bodies on the measured binaries. |
Windows is not supported yet. Supported targets are ELF and thin Mach-O executables for x86-64, AArch64 and ARM; PE and universal Mach-O are rejected with a typed reason.
## What Kuna answers
| Tool | Source |
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `list_procedures`, `search_procedures`, `procedure_address` | Kuna's callable inventory (`kuna functions --json`), including import slots it does not decompile |
| `address_name` | Function entries, then the data labels Kuna's export assigns |
| `procedure_pseudo_code`, `batch_decompile` | The project export, or a single-function run while the export builds |
| `procedure_assembly` | The project export's labeled listing |
| `procedure_callers`, `procedure_callees` | Call-kind edges from a lazy, body-free Kuna graph; synthetic import nodes are accepted by address |
| `list_strings`, `search_strings` | Typed string candidates from one cached, reference-free scan; exact-address, literal and ECMAScript regex selection |
| `xrefs` | Exact-address incoming reference sites, with forwarding aliases filtered explicitly |
| `analyze_function` | Pseudocode and assembly from the export, plus call relationships; typed references, comments, strings and CFG remain unavailable |
Typed procedure references, basic blocks, raw-memory tools, annotations and type recovery are not available from this provider. Use another provider for those operations.
## How answers are produced
The first text or assembly request in a session looks for this target's export in the cache. `list_documents` reads the selected path without initializing analysis. Inventory, function lookup, string queries, call relationships and xrefs do not start a C export. A data-name lookup starts it only when the address is absent from the function inventory. The export is keyed by the target's SHA-256, the Kuna executable's SHA-256, its version and `--jobs`.
- **Warm cache:** analysis reads reuse the verified export. A fresh server verifies its file digests once, even for concurrent first requests; that cost scales with export size.
- **Cold cache:**
- REA starts `kuna decompile-project` in the background on a private copy of the target.
- Meanwhile, pseudocode comes from one `kuna decompile --addr` run. Name and address lookups, and listings, use the inventory the export takes with `kuna functions --json` before it decompiles. The session runs `kuna functions` itself, under `REA_KUNA_TIMEOUT_MS`, only when no export is building (an inventory-only request does not start one) or the export ends without an inventory.
- Requests for the same function share one run; it stops when its last waiting request is cancelled. Each run analyzes the whole image again in its own process, so one REA process runs at most as many at once as the host has cores beyond `REA_KUNA_JOBS` (at least one). Further requests wait in order, and a waiting request is answered from the export if it finishes first. A run whose stop REA cannot prove keeps its slot until `close_binary` proves it stopped.
- Assembly and data names wait for the export; progress notifications report the wait every ten seconds. A session does not rebuild a failed export: requests that need it fail with `retryable: false`, the export's failure, its captured Kuna output and what to change before reopening the target. A setting such as `REA_KUNA_PROJECT_TIMEOUT_MS` or `REA_KUNA_JOBS` is read when REA starts, so changing it also needs a restart. Pseudocode keeps using single-function runs.
- A single-function answer says so in its limitations. It lacks the export's whole-program prototypes, so a later request can return different text for the same function.
Pseudocode, assembly, `analyze_function` and data-name answers record where their text came from in `raw_result.source`: `single-function`, or `project-export` with the cache directory. `procedure_pseudo_code` and `procedure_assembly` answers from the export also name the file, byte span and the file's SHA-256. Combined `analyze_function` answers retain both facet records in `raw_result.source.files`, each with its file, digest and byte span. Both texts come from one export; losing that project retries the complete report. Listings and procedure lookups carry no `raw_result`. Agents can open or search the export's `.c` and `.asm` there directly when that is cheaper than calling a tool per function. Text read that way is target-derived, like any decompiler output, but it bypasses the untrusted-content marker that REA's tool results carry.
The background export belongs to the session. `close_binary`, or the end of a CLI command, cancels it unless another session still waits for it. A one-shot CLI decompile therefore answers from a single-function run; any request that needs the export, such as `procedure_assembly` or `analyze_function`, keeps it.
The assembly label index is scanned once per export reader. Cancelling a request stops its wait without interrupting other readers; closing the session aborts and drains the shared scan before releasing its files.
Regex procedure and string search uses ECMAScript Unicode matching in a cancellable worker with a five-second matching deadline. Literal matching remains the default. Cancellation or a matching deadline leaves the session available.
Single-function subprocess output and each cached source facet share a 16 MiB buffered-text capacity. Cached spans are checked before allocation; larger text remains in the local export and the error identifies the file and range. `analyze_function` initially returns the complete dossier, which can still be large; later retained views do not remove that first transfer. Prefer the individual text tools for a focused question.
## Strings
`list_strings` and `search_strings` share one lazy `kuna strings --json --encoding all --min-length 5 --termination any --no-xrefs` scan of the digest-checked private input. Skipping references avoids program lifting, a call graph and a C export. REA validates the input, scan policy, every row and the total before caching any facts. Encoding, character count, byte length and terminator facts must agree; supplementary UTF-8 characters count as Unicode scalars. Malformed or oversized output is an error, not an empty search. JSON admits at most 16 MiB before parsing. String scans use the whole-program `REA_KUNA_PROJECT_TIMEOUT_MS` deadline; `REA_KUNA_TIMEOUT_MS` applies to single-function decompilation. The parsed inventory belongs to one selected target/executable profile and expires on session close; deterministic output-buffer failures are retained until close, while other failures are not cached.
Results keep exact u64 virtual addresses, decoded text, native encoding, terminator status and byte length including any terminator. Kuna scans mapped sections or segments for runs of at least five characters; unterminated fragments can include instruction bytes. `all` includes ASCII, UTF-8 and the engine's Latin-range UTF-16LE reading. Other text, including short strings, non-Latin wide text and UTF-16BE, can remain undiscovered. An empty result does not prove absence.
Use `search_strings` for the matching rows or `list_strings` with an exact address for that location. Literal and regex matching run in REA, preserving the existing case and ECMAScript Unicode semantics instead of substituting Kuna's different regex dialect. Procedure and string regex queries share one worker slot per session. Input projections are materialized only after admission, so queued queries retain no per-query inventory arrays. Close cancels and drains matching. Native metadata queries also share one admission slot, including references; a failed stop retains admission until cleanup is proven.
`raw_result.strings` reports the source JSON digest/size, scanned scope, extraction policy, complete inventory count and selected count without copying unrequested text into the answer. Omit the address from `list_strings` to retrieve the complete inventory as Evidence; normal session retention and bundle export apply, including transport-capacity errors for oversized inline replies. These operations preserve their complete-result contracts and do not add paging. Function-referenced string facets in `analyze_function` remain unavailable; call `xrefs` explicitly when references to one returned string are needed.
## Calls and references
The first call query runs `kuna decompile-graph --functions ''`, admitting no C or assembly bodies. One validated graph and forward/reverse indexes serve later call queries and existing `get_call_graph` / `trace_call_path` workflows. Numeric u64 addresses are parsed from their original JSON tokens. Only `call` edges become callers/callees; jumps and data references retain their distinct meaning. Graph counts, edge endpoints and ordering are validated before any relationship is returned. A forwarding address may be an instruction inside a function, so it is retained separately and never promoted to a function node or call edge. Reported indirect calls make affected relationship coverage partial; no target is invented for them.
`xrefs` runs native `xrefs --to ADDRESS --json` on demand. Kuna unifies forwarding aliases and suppresses edges internal to their class; REA filters to the requested address and records the excluded-row count. Duplicate source sites appear once. An empty result cannot establish the absence of references. Addresses are explicit u64 values or exact, unambiguous procedure names; Kuna has no cursor.
Graph JSON admits at most 32 MiB before parsing; xref JSON at most 16 MiB. A large image can exceed the graph budget: an arm64 Firefox `XUL` (404k functions) does, while a 14 MB Sublime Text binary produced 31.8 MB. Output beyond a buffer is reported as a `memory` resource constraint with `retryable: false`, because the same target and executable produce the same output. The session remembers a graph that overflowed, so later call queries fail at once instead of repeating the whole-program walk. The graph is cached for the selected target and executable profile within one session. Xref reuse is an LRU charged by source bytes plus metadata, limited to 16 MiB and 128 entries; at most eight distinct native xref queries may be pending. Reference commands run one at a time per session and share the provider's foreground budget with single-function decompiles. An unproven process stop retains its admission slots until cleanup succeeds. Concurrent callers share work, individual cancellation releases only that waiter, and the last departing waiter cancels its producer and receives any unproven cleanup. Session close aborts and drains producers, releases parsed caches and retries any retained process/file cleanup.
Evidence includes only selected addresses or dossier neighbors, the producing JSON's SHA-256/byte count, coverage and relevant function facts; unrequested program-wide JSON and instruction text are omitted. Reference caches are in memory and expire on close: a fresh CLI process or MCP server rebuilds them. A first call query therefore costs a whole-program reference walk even when a C export is warm. These operations do not establish full Ghidra/IDA feature parity.
## Provenance and limitations
- Addresses and bytes are Kuna's observations of the image. Procedure entries and extents are its derivations: extents are upper bounds clipped at the next entry, and Kuna can split one function at an entry its own analysis infers. Pseudocode is its reconstruction, never original source.
- Pseudocode and assembly are exact Kuna text; text from Kuna and from another provider is not comparable as equal or different.
- Results are re-read rather than replayed from REA's analysis snapshots, because a cold answer can differ from the export's.
## Cache ownership
REA writes Kuna's exports only inside `REA_KUNA_CACHE_DIR`:
- `projects/<key>/` holds published, immutable exports with a manifest of file digests.
- `staging/` holds builds whose processes may still be live.
- `trash/` holds retired builds and evicted exports awaiting removal.
- `home/` is Kuna's HOME.
Builds publish by one rename, so a reader sees a complete export or none. A session keeps the export it uses from eviction only within its own REA process. If another REA process sharing the cache evicts it, the session rebuilds it; meanwhile pseudocode falls back to single-function runs. A damaged or edited export is removed and rebuilt. Staging moves to `trash/` for removal only after REA proves its Kuna process stopped. Staging of a process it cannot prove stopped is never swept; REA keeps it owned, retries the stop on `close_binary`, and reports it until the stop is proven. Failed file removal also stays bound to its export and is retried by `close_binary`; closing does not report success while that cleanup remains. `rea doctor --provider kuna` reports the cache directory without creating it.
## Verify with a real Kuna
```bash
REA_KUNA_COMMAND=/absolute/path/to/kuna npm run verify:kuna
# Compare with Ghidra on caller-built binaries
REA_KUNA_COMMAND=/absolute/path/to/kuna GHIDRA_INSTALL_DIR=/absolute/path/to/ghidra \
npm run verify:kuna -- --targets DIR --functions inflate,crc32 --compare-ghidra
```
The lane compiles a small source-owned fixture with the host C compiler and verifies the MCP workflow end to end. `--targets DIR --functions a,b` adds caller-built binaries. `--compare-ghidra` (with `GHIDRA_INSTALL_DIR`) runs those same functions through Ghidra; it requires `--targets` and `--functions` and refuses empty matrices or requested function names missing from every target. See [testing](testing.md#kuna-lane) for coverage.
Failed runs also report process-lineage evidence and exit unsuccessfully. If provider or transport cleanup is unconfirmed, the report says `cleanup: "incomplete"` and records `retained_workspace`; that directory is preserved for investigation and cleanup retries.
+1 -1
View File
@@ -352,7 +352,7 @@ install it or its toolchain. The [NativeAOT guide](ghidra-nativeaot.md) defines
these routes, their layout/host restrictions, derived-memory provenance, and
verification coverage.
REA's experimental Windows Ghidra boundary admits native x86 and x86-64 PE
REA's experimental Windows Ghidra boundary admits native x86, x86-64, ARMNT (Thumb-2) and ARM64 PE
applications and DLLs for static analysis. For x64 PE NativeAOT, the read-only
parser also runs there; the [NativeAOT guide](ghidra-nativeaot.md) lists what a
Windows host covers.
+4 -1
View File
@@ -497,7 +497,10 @@ declared by their tools. Artifact extraction materializes the selected regular
files into a fresh REA-chosen temporary directory and reports its path.
`analyze_javascript_application` reads the supplied local directory or ASAR path
and returns its result and Evidence inline.
and returns its result and Evidence inline. Its owned analysis worker and private
temporary source files are declared as `launchesProcess` and `writesFilesystem`,
including for a single JavaScript source. This internal analysis does not execute
the supplied application code.
## Ghidra first-query deadlines and recovery
+6 -2
View File
@@ -111,8 +111,12 @@ list does not establish that the target has no procedures.
Suggestions are Unicode-normalized, case-insensitive prefix matches. The server
deduplicates them and sorts by code point for deterministic results. Procedure
completion derives candidates from the complete inventory, so a name is offered
only when it identifies one address in that inventory. Completion returns all
matching values; it does not expose paging controls.
only when it identifies one address in that inventory. A completion reply
carries at most 100 values, the MCP limit. `total` counts every match and
`hasMore` is `true` when values were omitted. Completion has no paging
controls. A longer prefix reaches an omitted value only when it excludes other
matches; matching uses normalized, case-insensitive forms, so a value can stay
unreachable when more than 100 matches share its normalized prefix.
## Lifecycle and safety
+16 -3
View File
@@ -270,7 +270,9 @@ Mach-O image. Architecture
`file_offset` values are container-relative. Entrypoint, segment and section
`file_offset` values retain their source meaning and are relative to the
selected Mach-O slice. Raw load-command fields retain their original values.
Evidence locations map the LC_MAIN entrypoint and nonempty file-backed segment
A field otool prints more than once, such as each `LC_BUILD_VERSION` tool, is
keyed `name #n` in print order. Each `LC_LINKER_OPTION` string is keyed
`string #n` and checked against the declared `count`. Evidence locations map the LC_MAIN entrypoint and nonempty file-backed segment
ranges to container offsets by adding the observed slice offset. Zero-fill
segments do not produce file ranges. When the selected slice's container offset
is unknown, those mapped locations are omitted with an explicit limitation;
@@ -378,7 +380,12 @@ complete observation.
property: `N` means `nonatomic`; a complete typed attribute string without
`N` means the Objective-C default `atomic`;
missing or incomplete attribute metadata leaves `atomicity` and any
unestablished read-only value null. `is_meta_class`, `is_root_class`, and
unestablished read-only value null. A type attribute whose quoted class name
never closes is incomplete and marks `objc_properties_categories` partial
with `property_attributes_incomplete`. A property record that cannot be
decoded, such as one with an empty or unmapped name, is reported as
`property_decode_failed` at its entry address while sibling properties are
retained. `is_meta_class`, `is_root_class`, and
`ivar_count` are also nullable when the selected provider exposes only symbol
names. Class implementation methods have null `is_required` and `is_optional`
fields because those facts apply to protocol declarations; decoded protocol
@@ -490,7 +497,7 @@ is present. A denied trace reports the `debugger-attach-denied` reason.
Install a Ghidra 12.1.x release and the 64-bit full JDK it declares, then configure REA to
use them. Ghidra analysis supports Linux x64/arm64 and macOS x64/arm64; each installation requires
the matching native decompiler. Experimental Windows x64 P0 admits native
x86 and x86-64 PE applications and DLLs, plus explicitly selected
x86, x86-64, ARMNT (Thumb-2) and ARM64 PE applications and DLLs, plus explicitly selected
[raw NMOS 6502 images](raw-binary.md#nmos-6502) with a caller-supplied load address,
on fixed local NTFS volumes. Other raw CPU families remain unsupported on Windows.
The boundary uses bundled Job Object ownership, protected runtime DACLs, and
@@ -570,6 +577,12 @@ Exact and ambiguous value counts describe emitted root/object value instances;
a root and an object may contain the same value. Archive digests identify the
original bytes.
Dates are reported as `{ "$plist_type": "date", "iso8601": "<timestamp>" }`. A
date the decoder cannot represent, such as an XML date with a year beyond 9999
or a negative year, is reported as `{ "$plist_type": "date", "iso8601": null }`
with a counted limitation; the rest of the plist or archive is still decoded.
`inspect_plist` and Interface Builder decoding use the same projection.
## Locate a byte signature
Use `search_bytes` after opening a target with Ghidra to locate a known constant
+2 -2
View File
@@ -166,7 +166,7 @@ npx rea-agents@latest setup
<a id="choosing-a-deep-analysis-provider"></a>
تختلف صيغ ملفات الشيفرة الأصلية والأنظمة المضيفة المدعومة باختلاف الموفّر. راجع [إعداد Hopper وGhidra](../installation.md#hopper)، و[دليل IDA](../ida-provider.md)، و[دعم Ghidra التجريبي على Windows](../windows-ghidra-p0.md). يدعم Ghidra أيضًا [تحليل DOS ذي 16 بت](../ghidra-dos.md). لاختيار الموفّر، راجع [دليل CLI](../cli.md#choose-a-provider). تحقّق من [توفر الميزات في الإصدارات](../installation.md#released-package-and-main) للميزات المضافة بعد أحدث إصدار على npm.
تختلف صيغ ملفات الشيفرة الأصلية والأنظمة المضيفة المدعومة باختلاف الموفّر. راجع [إعداد Hopper وGhidra](../installation.md#hopper)، و[دليل IDA](../ida-provider.md)، [Kuna](../kuna-provider.md)، و[دعم Ghidra التجريبي على Windows](../windows-ghidra-p0.md). يدعم Ghidra أيضًا [تحليل DOS ذي 16 بت](../ghidra-dos.md). لاختيار الموفّر، راجع [دليل CLI](../cli.md#choose-a-provider). تحقّق من [توفر الميزات في الإصدارات](../installation.md#released-package-and-main) للميزات المضافة بعد أحدث إصدار على npm.
## دراسات الحالة
@@ -274,7 +274,7 @@ npx rea-agents@latest setup
## سجل النجوم
🎉 **200,000 نجمة على GitHub — شكرًا لكم!**
🎉 **250,000 نجمة على GitHub — شكرًا لكم!**
شكرًا لكل من يستخدم REA، ويبلّغ عن الأخطاء، ويقترح ميزات، ويختبر إصدارات البناء، ويساهم بالإصلاحات.
+2 -2
View File
@@ -166,7 +166,7 @@ Statische JavaScript- und .NET-Untersuchungen lesen die bereitgestellten Dateien
<a id="choosing-a-deep-analysis-provider"></a>
Native Formate und unterstützte Hostsysteme unterscheiden sich je nach Provider. Siehe [Hopper- und Ghidra-Einrichtung](../installation.md#hopper), den [IDA-Leitfaden](../ida-provider.md) und die [experimentelle Ghidra-Unterstützung unter Windows](../windows-ghidra-p0.md). Ghidra unterstützt auch [16-Bit-DOS-Analyse](../ghidra-dos.md). Die Provider-Auswahl beschreibt der [CLI-Leitfaden](../cli.md#choose-a-provider). Prüfe die [Verfügbarkeit in Releases](../installation.md#released-package-and-main) für Funktionen, die seit der neuesten npm-Version hinzugekommen sind.
Native Formate und unterstützte Hostsysteme unterscheiden sich je nach Provider. Siehe [Hopper- und Ghidra-Einrichtung](../installation.md#hopper), den [IDA-Leitfaden](../ida-provider.md), [Kuna](../kuna-provider.md) und die [experimentelle Ghidra-Unterstützung unter Windows](../windows-ghidra-p0.md). Ghidra unterstützt auch [16-Bit-DOS-Analyse](../ghidra-dos.md). Die Provider-Auswahl beschreibt der [CLI-Leitfaden](../cli.md#choose-a-provider). Prüfe die [Verfügbarkeit in Releases](../installation.md#released-package-and-main) für Funktionen, die seit der neuesten npm-Version hinzugekommen sind.
## Fallstudien
@@ -272,7 +272,7 @@ Melde Sicherheitslücken gemäß [SECURITY.md](../../SECURITY.md).
## Sternverlauf
🎉 **200.000 GitHub-Sterne – vielen Dank!**
🎉 **250.000 GitHub-Sterne – vielen Dank!**
Danke an alle, die REA nutzen, Fehler melden, Funktionswünsche äußern, Builds testen und Fehlerbehebungen beitragen.
+2 -2
View File
@@ -179,7 +179,7 @@ npx rea-agents@latest setup
<a id="choosing-a-deep-analysis-provider"></a>
Οι μορφές κώδικα μηχανής και τα υποστηριζόμενα συστήματα διαφέρουν ανά πάροχο ανάλυσης. Δες τη [ρύθμιση Hopper και Ghidra](../installation.md#hopper), τον [οδηγό IDA](../ida-provider.md) (που περιλαμβάνει προαιρετική γέφυρα MCP για κώδικα μηχανής) και την [πειραματική υποστήριξη Ghidra στα Windows](../windows-ghidra-p0.md). Το Ghidra υποστηρίζει επίσης [ανάλυση DOS 16 bit](../ghidra-dos.md). Για μεγάλα δυαδικά αρχεία, αύξησε το χρονικό όριο εκκίνησης του παρόχου με `REA_GHIDRA_STARTUP_TIMEOUT_MS` ή `REA_HOPPER_STARTUP_TIMEOUT_MS`. Για την επιλογή παρόχου, δες τον [οδηγό CLI](../cli.md#choose-a-provider). Έλεγξε τη [διαθεσιμότητα ανά έκδοση](../installation.md#released-package-and-main) για λειτουργίες που προστέθηκαν μετά την τελευταία έκδοση στο npm.
Οι μορφές κώδικα μηχανής και τα υποστηριζόμενα συστήματα διαφέρουν ανά πάροχο ανάλυσης. Δες τη [ρύθμιση Hopper και Ghidra](../installation.md#hopper), τον [οδηγό IDA](../ida-provider.md) (που περιλαμβάνει προαιρετική γέφυρα MCP για κώδικα μηχανής), [Kuna](../kuna-provider.md) και την [πειραματική υποστήριξη Ghidra στα Windows](../windows-ghidra-p0.md). Το Ghidra υποστηρίζει επίσης [ανάλυση DOS 16 bit](../ghidra-dos.md). Για μεγάλα δυαδικά αρχεία, αύξησε το χρονικό όριο εκκίνησης του παρόχου με `REA_GHIDRA_STARTUP_TIMEOUT_MS` ή `REA_HOPPER_STARTUP_TIMEOUT_MS`. Για την επιλογή παρόχου, δες τον [οδηγό CLI](../cli.md#choose-a-provider). Έλεγξε τη [διαθεσιμότητα ανά έκδοση](../installation.md#released-package-and-main) για λειτουργίες που προστέθηκαν μετά την τελευταία έκδοση στο npm.
## Μελέτες περίπτωσης
@@ -285,7 +285,7 @@ npx rea-agents@latest setup
## Ιστορικό αστεριών
🎉 **200.000 αστέρια στο GitHub — σας ευχαριστούμε!**
🎉 **250.000 αστέρια στο GitHub — σας ευχαριστούμε!**
Ευχαριστούμε όλους όσοι χρησιμοποιούν το REA, αναφέρουν σφάλματα, ζητούν νέες λειτουργίες, δοκιμάζουν builds και συνεισφέρουν διορθώσεις.
+2 -2
View File
@@ -166,7 +166,7 @@ La inspección estática de JavaScript y .NET lee los archivos suministrados sin
<a id="choosing-a-deep-analysis-provider"></a>
Los formatos nativos y los sistemas anfitriones compatibles varían según el proveedor. Consulta [configuración de Hopper y Ghidra](../installation.md#hopper), la [guía de IDA](../ida-provider.md) y la [compatibilidad experimental de Ghidra en Windows](../windows-ghidra-p0.md). Ghidra también admite [análisis de DOS de 16 bits](../ghidra-dos.md). Para elegir un proveedor, consulta la [guía de CLI](../cli.md#choose-a-provider). Comprueba la [disponibilidad por versión](../installation.md#released-package-and-main) de las funciones añadidas después de la última versión publicada en npm.
Los formatos nativos y los sistemas anfitriones compatibles varían según el proveedor. Consulta [configuración de Hopper y Ghidra](../installation.md#hopper), la [guía de IDA](../ida-provider.md), [Kuna](../kuna-provider.md) y la [compatibilidad experimental de Ghidra en Windows](../windows-ghidra-p0.md). Ghidra también admite [análisis de DOS de 16 bits](../ghidra-dos.md). Para elegir un proveedor, consulta la [guía de CLI](../cli.md#choose-a-provider). Comprueba la [disponibilidad por versión](../installation.md#released-package-and-main) de las funciones añadidas después de la última versión publicada en npm.
## Casos prácticos
@@ -272,7 +272,7 @@ Informa de vulnerabilidades siguiendo [SECURITY.md](../../SECURITY.md).
## Historial de estrellas
🎉 **200.000 estrellas en GitHub: ¡gracias!**
🎉 **250.000 estrellas en GitHub: ¡gracias!**
Gracias a quienes usan REA, informan de errores, solicitan funciones, prueban compilaciones y contribuyen con correcciones.
+2 -2
View File
@@ -158,7 +158,7 @@ REA به Node.js 22.x (>=22.19)، 24.x (>=24.11) یا 26+، به‌همراه np
<a id="choosing-a-deep-analysis-provider"></a>
فرمت‌های بومی و پشتیبانی سیستم میزبان بر اساس ارائه‌دهنده متفاوت‌اند. [راه‌اندازی Hopper و Ghidra](../installation.md#hopper)، [راهنمای IDA](../ida-provider.md) و [پشتیبانی آزمایشی Ghidra در ویندوز](../windows-ghidra-p0.md) را ببینید. Ghidra همچنین از [تحلیل DOS شانزده‌بیتی](../ghidra-dos.md) پشتیبانی می‌کند. برای انتخاب ارائه‌دهنده، به [راهنمای CLI](../cli.md#choose-a-provider) مراجعه کنید. برای قابلیت‌هایی که پس از آخرین انتشار npm اضافه شده‌اند، [وضعیت انتشار](../installation.md#released-package-and-main) را بررسی کنید.
فرمت‌های بومی و پشتیبانی سیستم میزبان بر اساس ارائه‌دهنده متفاوت‌اند. [راه‌اندازی Hopper و Ghidra](../installation.md#hopper)، [راهنمای IDA](../ida-provider.md)، [Kuna](../kuna-provider.md) و [پشتیبانی آزمایشی Ghidra در ویندوز](../windows-ghidra-p0.md) را ببینید. Ghidra همچنین از [تحلیل DOS شانزده‌بیتی](../ghidra-dos.md) پشتیبانی می‌کند. برای انتخاب ارائه‌دهنده، به [راهنمای CLI](../cli.md#choose-a-provider) مراجعه کنید. برای قابلیت‌هایی که پس از آخرین انتشار npm اضافه شده‌اند، [وضعیت انتشار](../installation.md#released-package-and-main) را بررسی کنید.
## نمونه‌های عملی
@@ -257,7 +257,7 @@ npx rea-agents@latest setup
## تاریخچهٔ ستاره‌ها
🎉 **۲۰۰٬۰۰۰ ستارهٔ GitHub — سپاسگزاریم!**
🎉 **۲۵۰٬۰۰۰ ستارهٔ GitHub — سپاسگزاریم!**
از همهٔ کسانی که از REA استفاده می‌کنند، خطاها را گزارش می‌دهند، قابلیت‌های جدید پیشنهاد می‌کنند، buildها را آزمایش می‌کنند و در بهبود پروژه مشارکت دارند سپاسگزاریم.
+2 -2
View File
@@ -170,7 +170,7 @@ L'inspection statique JavaScript et .NET lit les fichiers fournis sans exécuter
<a id="choosing-a-deep-analysis-provider"></a>
Les formats natifs et les hôtes pris en charge varient selon le fournisseur. Consultez [la configuration de Hopper et Ghidra](../installation.md#hopper), le [guide IDA](../ida-provider.md) et [la prise en charge expérimentale de Ghidra sous Windows](../windows-ghidra-p0.md). Ghidra prend aussi en charge [l'analyse DOS 16 bits](../ghidra-dos.md). Pour les gros binaires, augmentez son délai de démarrage avec `REA_GHIDRA_STARTUP_TIMEOUT_MS`. Pour le choix du fournisseur, consultez le [guide CLI](../cli.md#choose-a-provider). Vérifiez la [disponibilité dans les versions publiées](../installation.md#released-package-and-main) pour les fonctionnalités ajoutées depuis la dernière version npm.
Les formats natifs et les hôtes pris en charge varient selon le fournisseur. Consultez [la configuration de Hopper et Ghidra](../installation.md#hopper), le [guide IDA](../ida-provider.md), [Kuna](../kuna-provider.md) et [la prise en charge expérimentale de Ghidra sous Windows](../windows-ghidra-p0.md). Ghidra prend aussi en charge [l'analyse DOS 16 bits](../ghidra-dos.md). Pour les gros binaires, augmentez son délai de démarrage avec `REA_GHIDRA_STARTUP_TIMEOUT_MS`. Pour le choix du fournisseur, consultez le [guide CLI](../cli.md#choose-a-provider). Vérifiez la [disponibilité dans les versions publiées](../installation.md#released-package-and-main) pour les fonctionnalités ajoutées depuis la dernière version npm.
## Études de cas
@@ -276,7 +276,7 @@ Signalez les vulnérabilités via [SECURITY.md](../../SECURITY.md).
## Historique des étoiles
🎉 **200 000 étoiles GitHub — merci !**
🎉 **250 000 étoiles GitHub — merci !**
Merci à toutes les personnes qui utilisent REA, signalent des bugs, proposent des fonctionnalités, testent les builds et contribuent des correctifs.
+2 -2
View File
@@ -173,7 +173,7 @@ Pemeriksaan JavaScript dan .NET statis membaca berkas yang disediakan tanpa menj
<a id="choosing-a-deep-analysis-provider"></a>
Format native dan dukungan sistem host berbeda-beda menurut penyedia. Lihat [penyiapan Hopper dan Ghidra](../installation.md#hopper), [panduan IDA](../ida-provider.md), dan [dukungan eksperimental Ghidra di Windows](../windows-ghidra-p0.md).
Format native dan dukungan sistem host berbeda-beda menurut penyedia. Lihat [penyiapan Hopper dan Ghidra](../installation.md#hopper), [panduan IDA](../ida-provider.md), [Kuna](../kuna-provider.md), dan [dukungan eksperimental Ghidra di Windows](../windows-ghidra-p0.md).
Ghidra juga mendukung [analisis DOS 16-bit](../ghidra-dos.md).
@@ -297,7 +297,7 @@ Laporkan kerentanan melalui [SECURITY.md](../../SECURITY.md).
## Riwayat Bintang
🎉 **200.000 bintang GitHub, terima kasih!**
🎉 **250.000 bintang GitHub, terima kasih!**
Terima kasih kepada semua orang yang menggunakan REA, melaporkan bug, meminta fitur, menguji build, dan berkontribusi dalam perbaikan.
+2 -2
View File
@@ -170,7 +170,7 @@ L'ispezione statica di JavaScript e .NET legge i file forniti senza eseguire l'a
<a id="choosing-a-deep-analysis-provider"></a>
I formati nativi e il supporto host variano in base al provider. Vedi la [configurazione di Hopper e Ghidra](../installation.md#hopper), la [guida IDA](../ida-provider.md) e il [supporto sperimentale Windows Ghidra](../windows-ghidra-p0.md). Ghidra supporta anche l'[analisi DOS a 16 bit](../ghidra-dos.md). Per binari di grandi dimensioni, aumenta il timeout di avvio con `REA_GHIDRA_STARTUP_TIMEOUT_MS`. Per la selezione del provider, vedi la [guida CLI](../cli.md#choose-a-provider). Controlla la [disponibilità delle release](../installation.md#released-package-and-main) per le funzionalità aggiunte dall'ultima release npm.
I formati nativi e il supporto host variano in base al provider. Vedi la [configurazione di Hopper e Ghidra](../installation.md#hopper), la [guida IDA](../ida-provider.md), [Kuna](../kuna-provider.md) e il [supporto sperimentale Windows Ghidra](../windows-ghidra-p0.md). Ghidra supporta anche l'[analisi DOS a 16 bit](../ghidra-dos.md). Per binari di grandi dimensioni, aumenta il timeout di avvio con `REA_GHIDRA_STARTUP_TIMEOUT_MS`. Per la selezione del provider, vedi la [guida CLI](../cli.md#choose-a-provider). Controlla la [disponibilità delle release](../installation.md#released-package-and-main) per le funzionalità aggiunte dall'ultima release npm.
## Showcase
@@ -276,7 +276,7 @@ Segnala vulnerabilità tramite [SECURITY.md](../../SECURITY.md).
## Cronologia delle stelle
🎉 **200.000 stelle su GitHub — grazie!**
🎉 **250.000 stelle su GitHub — grazie!**
Grazie a tutti coloro che usano REA, segnalano bug, propongono funzionalità, testano le build e contribuiscono con correzioni.
+2 -2
View File
@@ -166,7 +166,7 @@ REA には Node.js 22.x(>=22.19)、24.x(>=24.11)、または 26+ と npm
<a id="choosing-a-deep-analysis-provider"></a>
対応するネイティブ形式とホストは、プロバイダーによって異なります。[Hopper と Ghidra のセットアップ](../installation.md#hopper)、[IDA ガイド](../ida-provider.md)、[Windows 向け Ghidra の実験的対応](../windows-ghidra-p0.md)を参照してください。Ghidra は [16 ビット DOS 分析](../ghidra-dos.md)にも対応しています。プロバイダーの選択は [CLI ガイド](../cli.md#choose-a-provider)を参照してください。最新の npm リリース以降に追加された機能については、[リリースでの利用可否](../installation.md#released-package-and-main)を確認してください。
対応するネイティブ形式とホストは、プロバイダーによって異なります。[Hopper と Ghidra のセットアップ](../installation.md#hopper)、[IDA ガイド](../ida-provider.md)、[Kuna](../kuna-provider.md)、[Windows 向け Ghidra の実験的対応](../windows-ghidra-p0.md)を参照してください。Ghidra は [16 ビット DOS 分析](../ghidra-dos.md)にも対応しています。プロバイダーの選択は [CLI ガイド](../cli.md#choose-a-provider)を参照してください。最新の npm リリース以降に追加された機能については、[リリースでの利用可否](../installation.md#released-package-and-main)を確認してください。
## 事例
@@ -274,7 +274,7 @@ npx rea-agents@latest setup
## スター履歴
🎉 **GitHub スター 200,000 件、ありがとうございます!**
🎉 **GitHub スター 250,000 件、ありがとうございます!**
REA の利用、バグ報告、機能の要望、ビルドのテスト、修正への貢献に感謝します。
+2 -2
View File
@@ -175,7 +175,7 @@ REA에는 Node.js 22.x(>=22.19), 24.x(>=24.11) 또는 26+와 npm이 필요합니
<a id="choosing-a-deep-analysis-provider"></a>
지원하는 네이티브 형식과 호스트는 제공자마다 다릅니다. [Hopper 및 Ghidra 설정](../installation.md#hopper), [IDA 가이드](../ida-provider.md)(선택 사항인 네이티브 MCP 브리지 포함), [실험적 Windows Ghidra 지원](../windows-ghidra-p0.md)을 참고하세요. Ghidra는 [16비트 DOS 분석](../ghidra-dos.md)도 지원합니다. 큰 바이너리를 분석할 때는 `REA_GHIDRA_STARTUP_TIMEOUT_MS` 또는 `REA_HOPPER_STARTUP_TIMEOUT_MS`로 제공자의 시작 제한 시간을 늘리세요. 제공자 선택은 [CLI 가이드](../cli.md#choose-a-provider)를 참고하세요. 최신 npm 릴리스 이후 추가된 기능은 [릴리스에서의 사용 가능 여부](../installation.md#released-package-and-main)를 확인하세요.
지원하는 네이티브 형식과 호스트는 제공자마다 다릅니다. [Hopper 및 Ghidra 설정](../installation.md#hopper), [IDA 가이드](../ida-provider.md)(선택 사항인 네이티브 MCP 브리지 포함), [Kuna](../kuna-provider.md), [실험적 Windows Ghidra 지원](../windows-ghidra-p0.md)을 참고하세요. Ghidra는 [16비트 DOS 분석](../ghidra-dos.md)도 지원합니다. 큰 바이너리를 분석할 때는 `REA_GHIDRA_STARTUP_TIMEOUT_MS` 또는 `REA_HOPPER_STARTUP_TIMEOUT_MS`로 제공자의 시작 제한 시간을 늘리세요. 제공자 선택은 [CLI 가이드](../cli.md#choose-a-provider)를 참고하세요. 최신 npm 릴리스 이후 추가된 기능은 [릴리스에서의 사용 가능 여부](../installation.md#released-package-and-main)를 확인하세요.
## 사례
@@ -283,7 +283,7 @@ npx rea-agents@latest setup
## 스타 기록
🎉 **GitHub 스타 200,000개, 감사합니다!**
🎉 **GitHub 스타 250,000개, 감사합니다!**
REA를 사용하고, 버그를 보고하고, 기능을 요청하고, 빌드를 테스트하고, 수정에 기여해 주신 모든 분께 감사드립니다.
+2 -2
View File
@@ -166,7 +166,7 @@ Statyczna analiza JavaScript i .NET odczytuje dostarczone pliki bez uruchamiania
<a id="choosing-a-deep-analysis-provider"></a>
Obsługiwane formaty natywne i platformy zależą od dostawcy analizy. Zobacz [konfigurację Hoppera i Ghidry](../installation.md#hopper), [przewodnik IDA](../ida-provider.md) oraz [eksperymentalną obsługę Ghidry w systemie Windows](../windows-ghidra-p0.md). Ghidra obsługuje też [analizę 16-bitowego DOS-a](../ghidra-dos.md). Wybór dostawcy opisuje [przewodnik CLI](../cli.md#choose-a-provider). Sprawdź [dostępność w wydaniach](../installation.md#released-package-and-main) dla funkcji dodanych po najnowszym wydaniu npm.
Obsługiwane formaty natywne i platformy zależą od dostawcy analizy. Zobacz [konfigurację Hoppera i Ghidry](../installation.md#hopper), [przewodnik IDA](../ida-provider.md), [Kuna](../kuna-provider.md) oraz [eksperymentalną obsługę Ghidry w systemie Windows](../windows-ghidra-p0.md). Ghidra obsługuje też [analizę 16-bitowego DOS-a](../ghidra-dos.md). Wybór dostawcy opisuje [przewodnik CLI](../cli.md#choose-a-provider). Sprawdź [dostępność w wydaniach](../installation.md#released-package-and-main) dla funkcji dodanych po najnowszym wydaniu npm.
## Przykłady zastosowań
@@ -272,7 +272,7 @@ Zgłaszaj podatności zgodnie z [SECURITY.md](../../SECURITY.md).
## Historia gwiazdek
🎉 **200 000 gwiazdek na GitHubie — dziękujemy!**
🎉 **250 000 gwiazdek na GitHubie — dziękujemy!**
Dziękujemy wszystkim, którzy używają REA, zgłaszają błędy, proponują nowe funkcje, testują kompilacje i przesyłają poprawki.
+2 -2
View File
@@ -166,7 +166,7 @@ A inspeção estática de JavaScript e .NET lê os arquivos fornecidos sem execu
<a id="choosing-a-deep-analysis-provider"></a>
Os formatos nativos e os sistemas anfitriões compatíveis variam por provedor. Consulte [configuração do Hopper e Ghidra](../installation.md#hopper), o [guia do IDA](../ida-provider.md) e o [suporte experimental ao Ghidra no Windows](../windows-ghidra-p0.md). O Ghidra também oferece [análise de DOS de 16 bits](../ghidra-dos.md). Para selecionar um provedor, consulte o [guia da CLI](../cli.md#choose-a-provider). Verifique a [disponibilidade nas versões](../installation.md#released-package-and-main) das funcionalidades adicionadas após a versão mais recente no npm.
Os formatos nativos e os sistemas anfitriões compatíveis variam por provedor. Consulte [configuração do Hopper e Ghidra](../installation.md#hopper), o [guia do IDA](../ida-provider.md), [Kuna](../kuna-provider.md) e o [suporte experimental ao Ghidra no Windows](../windows-ghidra-p0.md). O Ghidra também oferece [análise de DOS de 16 bits](../ghidra-dos.md). Para selecionar um provedor, consulte o [guia da CLI](../cli.md#choose-a-provider). Verifique a [disponibilidade nas versões](../installation.md#released-package-and-main) das funcionalidades adicionadas após a versão mais recente no npm.
## Casos de uso
@@ -272,7 +272,7 @@ Relate vulnerabilidades conforme [SECURITY.md](../../SECURITY.md).
## Histórico de estrelas
🎉 **200.000 estrelas no GitHub — muito obrigado!**
🎉 **250.000 estrelas no GitHub — muito obrigado!**
Obrigado a todos que usam o REA, relatam bugs, sugerem funcionalidades, testam builds e contribuem com correções.
+2 -2
View File
@@ -166,7 +166,7 @@ REA требует Node.js 22.x (>=22.19), 24.x (>=24.11) или 26+, а так
<a id="choosing-a-deep-analysis-provider"></a>
Нативные форматы и поддерживаемые системы различаются у разных провайдеров. См. [настройку Hopper и Ghidra](../installation.md#hopper), [руководство по IDA](../ida-provider.md) и [экспериментальную поддержку Ghidra в Windows](../windows-ghidra-p0.md). Ghidra также поддерживает [анализ 16-битного DOS](../ghidra-dos.md). Выбор провайдера описан в [руководстве по CLI](../cli.md#choose-a-provider). Для функций, добавленных после последней версии в npm, проверьте [доступность в релизах](../installation.md#released-package-and-main).
Нативные форматы и поддерживаемые системы различаются у разных провайдеров. См. [настройку Hopper и Ghidra](../installation.md#hopper), [руководство по IDA](../ida-provider.md), [Kuna](../kuna-provider.md) и [экспериментальную поддержку Ghidra в Windows](../windows-ghidra-p0.md). Ghidra также поддерживает [анализ 16-битного DOS](../ghidra-dos.md). Выбор провайдера описан в [руководстве по CLI](../cli.md#choose-a-provider). Для функций, добавленных после последней версии в npm, проверьте [доступность в релизах](../installation.md#released-package-and-main).
## Примеры
@@ -272,7 +272,7 @@ npx rea-agents@latest setup
## История звёзд
🎉 **200 000 звёзд на GitHub — спасибо!**
🎉 **250 000 звёзд на GitHub — спасибо!**
Спасибо всем, кто использует REA, сообщает об ошибках, предлагает новые функции, тестирует сборки и помогает с исправлениями.
+2 -2
View File
@@ -166,7 +166,7 @@ REA ต้องใช้ Node.js 22.x (>=22.19), 24.x (>=24.11) หรือ 26
<a id="choosing-a-deep-analysis-provider"></a>
รูปแบบไบนารีเนทีฟและแพลตฟอร์มที่รองรับแตกต่างกันตามผู้ให้บริการวิเคราะห์ ดู[การตั้งค่า Hopper และ Ghidra](../installation.md#hopper), [คู่มือ IDA](../ida-provider.md) และ[การรองรับ Ghidra บน Windows แบบทดลอง](../windows-ghidra-p0.md) Ghidra ยังรองรับ[การวิเคราะห์ DOS แบบ 16 บิต](../ghidra-dos.md) สำหรับการเลือกผู้ให้บริการ ดู[คู่มือ CLI](../cli.md#choose-a-provider) ตรวจสอบ[ความพร้อมใช้งานในแต่ละรุ่น](../installation.md#released-package-and-main) สำหรับฟีเจอร์ที่เพิ่มหลังรุ่นล่าสุดบน npm
รูปแบบไบนารีเนทีฟและแพลตฟอร์มที่รองรับแตกต่างกันตามผู้ให้บริการวิเคราะห์ ดู[การตั้งค่า Hopper และ Ghidra](../installation.md#hopper), [คู่มือ IDA](../ida-provider.md) [Kuna](../kuna-provider.md) และ[การรองรับ Ghidra บน Windows แบบทดลอง](../windows-ghidra-p0.md) Ghidra ยังรองรับ[การวิเคราะห์ DOS แบบ 16 บิต](../ghidra-dos.md) สำหรับการเลือกผู้ให้บริการ ดู[คู่มือ CLI](../cli.md#choose-a-provider) ตรวจสอบ[ความพร้อมใช้งานในแต่ละรุ่น](../installation.md#released-package-and-main) สำหรับฟีเจอร์ที่เพิ่มหลังรุ่นล่าสุดบน npm
## ตัวอย่างการใช้งาน
@@ -272,7 +272,7 @@ npx rea-agents@latest setup
## ประวัติดาว
🎉 **200,000 ดาวบน GitHub — ขอบคุณทุกคน!**
🎉 **250,000 ดาวบน GitHub — ขอบคุณทุกคน!**
ขอบคุณทุกคนที่ใช้ REA รายงานบั๊ก เสนอฟีเจอร์ ทดสอบบิลด์ และช่วยแก้ไข
+2 -2
View File
@@ -171,7 +171,7 @@ Statik JavaScript ve .NET incelemesi, uygulamayı çalıştırmadan sağlanan do
<a id="choosing-a-deep-analysis-provider"></a>
Yerel makine kodu içeren ikili dosya biçimleri ve ana bilgisayar desteği sağlayıcıya göre değişir. [Hopper ve Ghidra kurulumu](../installation.md#hopper), isteğe bağlı native MCP bridge'i de açıklayan [IDA rehberi](../ida-provider.md) ve [Windows için deneysel Ghidra desteği](../windows-ghidra-p0.md) belgelerine bakın. Ghidra ayrıca [16 bit DOS analizini](../ghidra-dos.md) destekler. Büyük ikili dosyalar için sağlayıcının başlatma zaman aşımını `REA_GHIDRA_STARTUP_TIMEOUT_MS` veya `REA_HOPPER_STARTUP_TIMEOUT_MS` ile artırın. Sağlayıcı seçimi için [CLI rehberine](../cli.md#choose-a-provider) bakın. En son npm sürümünden sonra eklenen özellikler için [sürümlerde kullanılabilirliği](../installation.md#released-package-and-main) kontrol edin.
Yerel makine kodu içeren ikili dosya biçimleri ve ana bilgisayar desteği sağlayıcıya göre değişir. [Hopper ve Ghidra kurulumu](../installation.md#hopper), isteğe bağlı native MCP bridge'i de açıklayan [IDA rehberi](../ida-provider.md), [Kuna](../kuna-provider.md) ve [Windows için deneysel Ghidra desteği](../windows-ghidra-p0.md) belgelerine bakın. Ghidra ayrıca [16 bit DOS analizini](../ghidra-dos.md) destekler. Büyük ikili dosyalar için sağlayıcının başlatma zaman aşımını `REA_GHIDRA_STARTUP_TIMEOUT_MS` veya `REA_HOPPER_STARTUP_TIMEOUT_MS` ile artırın. Sağlayıcı seçimi için [CLI rehberine](../cli.md#choose-a-provider) bakın. En son npm sürümünden sonra eklenen özellikler için [sürümlerde kullanılabilirliği](../installation.md#released-package-and-main) kontrol edin.
## Örnek çalışmalar
@@ -277,7 +277,7 @@ Güvenlik açıklarını [SECURITY.md](../../SECURITY.md) üzerinden bildirin.
## Yıldız geçmişi
🎉 **GitHub'da 200.000 yıldız — teşekkürler!**
🎉 **GitHub'da 250.000 yıldız — teşekkürler!**
REA'yı kullanan, hata bildiren, özellik talep eden, derlemeleri test eden ve düzeltmelere katkıda bulunan herkese teşekkürler.
+2 -2
View File
@@ -166,7 +166,7 @@ REA потребує Node.js 22.x (>=22.19), 24.x (>=24.11) або 26+, а та
<a id="choosing-a-deep-analysis-provider"></a>
Нативні формати й підтримка систем відрізняються залежно від провайдера. Дивіться [налаштування Hopper і Ghidra](../installation.md#hopper), [посібник IDA](../ida-provider.md) та [експериментальну підтримку Ghidra у Windows](../windows-ghidra-p0.md). Ghidra також підтримує [аналіз 16-бітного DOS](../ghidra-dos.md). Для вибору провайдера дивіться [посібник CLI](../cli.md#choose-a-provider). Для функцій, доданих після найновішої версії в npm, перевірте [доступність у випусках](../installation.md#released-package-and-main).
Нативні формати й підтримка систем відрізняються залежно від провайдера. Дивіться [налаштування Hopper і Ghidra](../installation.md#hopper), [посібник IDA](../ida-provider.md), [Kuna](../kuna-provider.md) та [експериментальну підтримку Ghidra у Windows](../windows-ghidra-p0.md). Ghidra також підтримує [аналіз 16-бітного DOS](../ghidra-dos.md). Для вибору провайдера дивіться [посібник CLI](../cli.md#choose-a-provider). Для функцій, доданих після найновішої версії в npm, перевірте [доступність у випусках](../installation.md#released-package-and-main).
## Приклади
@@ -272,7 +272,7 @@ npx rea-agents@latest setup
## Історія зірок
🎉 **200 000 зірок на GitHub — дякуємо!**
🎉 **250 000 зірок на GitHub — дякуємо!**
Дякуємо всім, хто використовує REA, повідомляє про помилки, пропонує нові функції, тестує збірки й допомагає з виправленнями.
+2 -2
View File
@@ -166,7 +166,7 @@ Kiểm tra tĩnh JavaScript và .NET đọc các tệp được cung cấp mà k
<a id="choosing-a-deep-analysis-provider"></a>
Định dạng mã máy và nền tảng chạy REA được hỗ trợ khác nhau tùy trình phân tích. Xem [thiết lập Hopper và Ghidra](../installation.md#hopper), [hướng dẫn IDA](../ida-provider.md) và [hỗ trợ Ghidra thử nghiệm trên Windows](../windows-ghidra-p0.md). Ghidra cũng hỗ trợ [phân tích DOS 16 bit](../ghidra-dos.md). Để chọn trình phân tích, xem [hướng dẫn CLI](../cli.md#choose-a-provider). Kiểm tra [khả năng sử dụng theo bản phát hành](../installation.md#released-package-and-main) đối với tính năng được bổ sung sau phiên bản npm mới nhất.
Định dạng mã máy và nền tảng chạy REA được hỗ trợ khác nhau tùy trình phân tích. Xem [thiết lập Hopper và Ghidra](../installation.md#hopper), [hướng dẫn IDA](../ida-provider.md), [Kuna](../kuna-provider.md) và [hỗ trợ Ghidra thử nghiệm trên Windows](../windows-ghidra-p0.md). Ghidra cũng hỗ trợ [phân tích DOS 16 bit](../ghidra-dos.md). Để chọn trình phân tích, xem [hướng dẫn CLI](../cli.md#choose-a-provider). Kiểm tra [khả năng sử dụng theo bản phát hành](../installation.md#released-package-and-main) đối với tính năng được bổ sung sau phiên bản npm mới nhất.
## Các nghiên cứu điển hình
@@ -272,7 +272,7 @@ Báo cáo lỗ hổng theo [SECURITY.md](../../SECURITY.md).
## Lịch sử sao
🎉 **200.000 sao trên GitHub — xin cảm ơn!**
🎉 **250.000 sao trên GitHub — xin cảm ơn!**
Cảm ơn mọi người đã sử dụng REA, báo lỗi, đề xuất tính năng, kiểm thử bản dựng và đóng góp bản sửa lỗi.
+2 -2
View File
@@ -170,7 +170,7 @@ REA 需要 Node.js 22.x(>=22.19)、24.x(>=24.11)或 26+,以及 npm。
<a id="choosing-a-deep-analysis-provider"></a>
不同提供者支援的原生格式和主機系統有所不同。請參閱 [Hopper 與 Ghidra 設定](../installation.md#hopper)、[IDA 指南](../ida-provider.md)和[實驗性 Windows Ghidra 支援](../windows-ghidra-p0.md)。Ghidra 也支援 [16 位 DOS 分析](../ghidra-dos.md)。提供者選擇見 [CLI 指南](../cli.md#choose-a-provider)。對於最新 npm 版本發佈後新增的功能,請查看[發佈可用性](../installation.md#released-package-and-main)。
不同提供者支援的原生格式和主機系統有所不同。請參閱 [Hopper 與 Ghidra 設定](../installation.md#hopper)、[IDA 指南](../ida-provider.md)、[Kuna](../kuna-provider.md)和[實驗性 Windows Ghidra 支援](../windows-ghidra-p0.md)。Ghidra 也支援 [16 位 DOS 分析](../ghidra-dos.md)。提供者選擇見 [CLI 指南](../cli.md#choose-a-provider)。對於最新 npm 版本發佈後新增的功能,請查看[發佈可用性](../installation.md#released-package-and-main)。
## 案例
@@ -278,7 +278,7 @@ npx rea-agents@latest setup
## Star 歷史
🎉 **GitHub Star 達到 200,000 個,感謝大家!**
🎉 **GitHub Star 達到 250,000 個,感謝大家!**
感謝每一位使用 REA、報告錯誤、提出功能需求、測試建置和貢獻修復的朋友。
+2 -2
View File
@@ -170,7 +170,7 @@ REA 需要 Node.js 22.x(>=22.19)、24.x(>=24.11)或 26+,以及 npm。
<a id="choosing-a-deep-analysis-provider"></a>
不同提供方支持的原生格式和主机系统有所不同。请参阅 [Hopper 与 Ghidra 设置](../installation.md#hopper)、[IDA 指南](../ida-provider.md)和[实验性 Windows Ghidra 支持](../windows-ghidra-p0.md)。Ghidra 也支持 [16 位 DOS 分析](../ghidra-dos.md)。提供方选择见 [CLI 指南](../cli.md#choose-a-provider)。对于最新 npm 版本发布后新增的功能,请查看[发布可用性](../installation.md#released-package-and-main)。
不同提供方支持的原生格式和主机系统有所不同。请参阅 [Hopper 与 Ghidra 设置](../installation.md#hopper)、[IDA 指南](../ida-provider.md)、[Kuna](../kuna-provider.md)和[实验性 Windows Ghidra 支持](../windows-ghidra-p0.md)。Ghidra 也支持 [16 位 DOS 分析](../ghidra-dos.md)。提供方选择见 [CLI 指南](../cli.md#choose-a-provider)。对于最新 npm 版本发布后新增的功能,请查看[发布可用性](../installation.md#released-package-and-main)。
## 案例
@@ -278,7 +278,7 @@ npx rea-agents@latest setup
## Star 历史
🎉 **GitHub Star 达到 200,000 个,感谢大家!**
🎉 **GitHub Star 达到 250,000 个,感谢大家!**
感谢每一位使用 REA、报告错误、提出功能需求、测试构建和贡献修复的朋友。
+43
View File
@@ -0,0 +1,43 @@
# Reconstruction coverage
`rea evaluate-reconstruction-coverage coverage.json --json` evaluates an inline
coverage workspace and its selected `boundary_id`. MCP exposes the same input
through `evaluate_reconstruction_coverage`. Results contain a status, reasons,
recommended probes and Evidence references; the supplied bundle retains the
complete records.
Evidence IDs and bundle manifests must authenticate before evaluation. A valid
record can still be insufficient proof: a passing verifier summary cannot
promote inferred Evidence into a replay observation. That case returns
`unknown`, while a missing or tampered record remains an input error.
## Comparable verifier Evidence
At least one record explicitly cited by the latest verifier observation must
support the declared contract authority:
| Contract authority | Evidence source | Confidence |
| ------------------- | ----------------------------------------- | ----------------------- |
| `shipped-artifact` | `shipped-artifact` | `observed` or `derived` |
| `controlled-replay` | `controlled-replay` | `observed` |
| `live-observation` | `controlled-replay` or `external-service` | `observed` |
| `external` | `external-service` | `observed` |
Contextual references can accompany qualifying proof. An unrelated observed
record elsewhere in the bundle cannot repair a result that cites only
inference. Older observed results cannot replace the newest weak result.
Equivalent observations at the same instant can share qualifying proof from
one of those observations; conflicting tied assessments remain unknown.
## Package and integration proof
Build, clean-install and runtime-routing claims require observed runtime
Evidence (`controlled-replay` or `external-service`). Package-content and
authority-independence audits can also use observed or derived
`shipped-artifact` Evidence. Each proof must cite its qualifying records and
cover the selected boundary's artifact digests. An inference alone establishes
neither a passing nor a failed package workflow.
The evaluator preserves Evidence provenance and returns an actionable unknown
when qualification is unavailable. It does not change the cited records to
make their authority match a caller's declaration.
@@ -323,3 +323,6 @@ disposition but does not silently count it as verified.
The tool returns every obligation inline. Its `ledger_id` and `closure_digest`
identify the complete result, including summaries, reports, ownership and
dependency graphs, Evidence links, and limitations.
For named boundaries with explicit verifier contracts and package-proof kinds,
see [reconstruction coverage](reconstruction-coverage.md).
+3 -2
View File
@@ -16,11 +16,12 @@ can run.
`inspect_with_objdump` and `rea inspect-with-objdump` capture stdout and stderr as inline Evidence. Artifact inspection Evidence records SHA-256 digests before and after the provider call and whether those observed digests differ; this cannot prove the exact bytes consumed if the artifact changes during execution. Choose one artifact operation: `file_headers`, `section_headers`, `symbols`, `relocations`, `dwarf`, `disassemble`, or `disassemble_all`. `disassemble` maps to `-d`; `disassemble_all` maps to `-D` and has different symbol-boundary semantics. The pathless `inspect_with_objdump {"operation":"architectures"}` MCP call or `rea list-objdump-architectures` CLI command maps to `-i` and produces subjectless provider-capability Evidence describing BFD targets compiled into the installed binary, not a guarantee that a target is supported.
For DWARF, REA does not follow local debug links by default. Set `follow_debug_links` to `true` to pass `-WK`; external debug-file identities are not bound to Evidence when following links is enabled. The CLI option is `--follow-debug-links true`. REA clears `DEBUGINFOD_URLS` in the objdump child environment to disable debuginfod network access on GNU binutils versions that do not support `-WE`. The complete raw output is authoritative; REA does not normalize it into a version-independent disassembly schema.
For DWARF, REA does not follow local debug links by default. Set `follow_debug_links` to `true` to pass `-WK`; external debug-file identities are not bound to Evidence when following links is enabled. The CLI flag is `--follow-debug-links`; `--no-follow-debug-links` or `--follow-debug-links=false` keeps the default. A separate `true` or `false` word after the flag is not its value. REA clears `DEBUGINFOD_URLS` in the objdump child environment to disable debuginfod network access on GNU binutils versions that do not support `-WE`. The complete raw output is authoritative; REA does not normalize it into a version-independent disassembly schema.
```sh
rea inspect-with-objdump ./program disassemble
rea inspect-with-objdump ./program dwarf --follow-debug-links false
rea inspect-with-objdump ./program dwarf
rea inspect-with-objdump ./program dwarf --follow-debug-links
```
Captured stdout and stderr are retained up to a 16 MiB combined limit; `output_truncated` marks output beyond that limit.
+32
View File
@@ -817,6 +817,38 @@ 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 non-inlined calls, with symbols and stripped, then verifies through MCP that
callers, callees and exact incoming xrefs agree with those calls, graph/path
composition reaches the callee, reference-only queries leave project/staging
entries unchanged, repeated relationships reuse the graph, and
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. Reference timings and response sizes are
reported separately; reference caches expire when the server closes. `--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
@@ -0,0 +1,249 @@
{
"base_revision": "e598b4656ad90d59ede2d10454a0ac34f3813558",
"scope": "Canonical effect metadata only; real static Obsidian reads, no target execution",
"baseline_source_sha256": {
"src/contracts/toolEffects.ts": "39505b5f1501768515229a37ff67e8a1a512faedfb6669aee7a690a2ac3ac633",
"src/javascript/analysis/JavaScriptAnalysisWorker.ts": "49ea4e6344060fae3529ffe6e14bfadc534132067cfa5c370263dc7476375be0",
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1"
},
"final_source_sha256": {
"src/contracts/toolEffects.ts": "feb66f1b71c4a6849d1730227c9c74e4efbb67b4537d75fd41ce9ff615c25753",
"src/javascript/analysis/JavaScriptAnalysisWorker.ts": "49ea4e6344060fae3529ffe6e14bfadc534132067cfa5c370263dc7476375be0",
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1",
"tests/boundary/mcp/electronMcp.test.ts": "e483bec8512cfeafa7f951c8faf25e1aecd6e6987ea74aead14230501912928d",
"tests/boundary/mcp/toolSchemaValidity.test.ts": "ab6d9ba37035a6ff9279b820aa8660c50a3ef9f31d25f838c0ba40929148e89c"
},
"cohorts": {
"baseline": {
"metadata": {
"tool": "analyze_javascript_application",
"advertised_annotations": {
"readOnlyHint": false,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
},
"session_effects": ["mutatesSession", "idempotent"],
"session_annotations": ["idempotent"],
"catalog_tool_count": 207
},
"metadata_probe_resources": {
"elapsed_seconds": 10.711,
"cpu_seconds": 10.503415,
"peak_cgroup_bytes": 842891264,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
},
"real_workflow": {
"artifact": {
"path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
"sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f"
},
"parent_evidence_id": "ev_73ef06e3b9b944f54c5257f7960279127d8518d2a73cd8618bd045dbe44e6b5a",
"samples": [
{
"round": 0,
"mode": "references",
"elapsed_ms": 109.19401700000162,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
}
],
"token_costs": {
"tokenizer": "cl100k_base",
"tiktoken_version": "0.12.0",
"costs": {
"references": {
"selected_catalog": 7977,
"full_catalog": 195522,
"common_request": 53,
"common_summary": 2675,
"requests": 102,
"structured_replies": 5741,
"selected_catalog_task_total": 16548,
"full_catalog_task_total": 204093
}
}
},
"cli_parity": {
"evidence_id": "ev_b3586dfdf7d4f01157f8f2978326aaa7103987110f2df4fa5bf3331ff2898749",
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"exact_cli_mcp_view_parity": true
}
},
"real_workflow_resources": {
"elapsed_seconds": 30.47,
"cpu_seconds": 29.939807,
"peak_cgroup_bytes": 1551282176,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
}
},
"final": {
"metadata": {
"tool": "analyze_javascript_application",
"advertised_annotations": {
"readOnlyHint": false,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": true
},
"session_effects": [
"mutatesSession",
"writesFilesystem",
"launchesProcess",
"idempotent"
],
"session_annotations": ["idempotent", "open_world"],
"catalog_tool_count": 207
},
"metadata_probe_resources": {
"elapsed_seconds": 10.909,
"cpu_seconds": 10.664997,
"peak_cgroup_bytes": 853958656,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
},
"real_workflow": {
"artifact": {
"path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
"sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f"
},
"parent_evidence_id": "ev_73ef06e3b9b944f54c5257f7960279127d8518d2a73cd8618bd045dbe44e6b5a",
"samples": [
{
"round": 0,
"mode": "references",
"elapsed_ms": 110.17946600000141,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
}
],
"token_costs": {
"tokenizer": "cl100k_base",
"tiktoken_version": "0.12.0",
"costs": {
"references": {
"selected_catalog": 7977,
"full_catalog": 195522,
"common_request": 53,
"common_summary": 2675,
"requests": 102,
"structured_replies": 5741,
"selected_catalog_task_total": 16548,
"full_catalog_task_total": 204093
}
}
},
"cli_parity": {
"evidence_id": "ev_b3586dfdf7d4f01157f8f2978326aaa7103987110f2df4fa5bf3331ff2898749",
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"exact_cli_mcp_view_parity": true
}
},
"real_workflow_resources": {
"elapsed_seconds": 31.059,
"cpu_seconds": 30.663163,
"peak_cgroup_bytes": 1584574464,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
}
}
},
"conditions": "Separate fresh MCP sessions, uncontrolled warm filesystem/build and shared-host scheduling. One CPU, 8 GiB hard cap, 6 GiB early stop, no swap. Resource counters are at payload exit with the observer alive, not final whole-scope counters; memory includes charged file cache, not summed RSS. Whole real-verifier resources include analysis, export, CLI parity and tokenizer; metadata probe resources are separate. Static BPE uses name/description/inputSchema catalog projections plus requests/structured replies, excludes annotations, metadata-probe calls, rendering/replay/reasoning/final-answer/model usage. No performance improvement or equivalence bound established by one before/after pair.",
"regressions": {
"baseline": "20 executed: 2 expected metadata failures, 18 passed",
"final": "27 passed after the test ownership cleanup across canonical effects and MCP/catalog boundaries",
"interim_correction": "26 passed before metadata assertions were split into their own target-free case to satisfy function-size lint"
},
"selected_input": {
"input_path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
"detail": "summary",
"source_paths": ["package.json", "main.js"]
},
"selected_view": {
"kind": "javascript",
"collection": "modules",
"projection": "references",
"where": {
"path": "main.js",
"kind": "javascript-module"
}
},
"observer_sources_sha256": {
"resource-run.py": "7728862171415e7dee2c11af2ead2b9a54265fccaf82a7113956d36b29065e33",
"resource_payload.py": "6f089e645459eba80c5d73e39c21606c78173a44daf49fabc3b88c4631ce51c6"
},
"runtime": {
"platform": "Linux x64",
"node": "24.18.0",
"npm": "11.16.0",
"tiktoken": "0.12.0"
}
}
@@ -0,0 +1,121 @@
# JavaScript analysis effect metadata verification
Tracks #3867 under #4027. The canonical effect record omitted existing internal
worker launches and source staging. `CapabilityInventory` and SDK registration
already consume that owner directly; no adapter override is required. The
[worker](../../src/javascript/analysis/JavaScriptAnalysisWorker.ts) creates a
private runtime root, stages `.source` files and launches an owned REA worker.
These are source-derived facts; the analyzed application code is not executed.
## Executed results
Public stdio MCP before/after:
| Surface | Before | After |
| ---------------------------- | ------------------------------ | ------------------------------------------ |
| `tools/list` `openWorldHint` | `false` | `true` |
| `binary_session` effects | `mutatesSession`, `idempotent` | also `writesFilesystem`, `launchesProcess` |
| Session annotation flags | `idempotent` | also `open_world` |
| Advertised tools | 207 | 207 |
Regression assertions failed on the original contract: **2 failed,
18 passed**. After correction and separating the target-free metadata case, **27 passed** across canonical effects, public
Electron/JavaScript MCP and SDK-converted catalog validity. The tests retain the
non-destructive, idempotent hints and exact session effects; no foreign target
execution is declared.
The existing real verifier analyzed official Obsidian 1.14.4 with `package.json`
and `main.js` selected, then read the typed module references and verified exact
public CLI/MCP parity. Both revisions returned the same parent/view Evidence
identities and 23-row fact digest. Query replies remained 22,158 bytes and the
selected-schema task remained 16,548 `cl100k_base` BPE tokens (204,093 with the full
name/description/inputSchema catalog projection). These are static counts, not
model billing; annotations, the separate metadata probe, host rendering/replay,
reasoning and final answers are outside this projection. No hosted agent was run.
| Complete real verifier | Before | After |
| ---------------------- | ------------: | ------------: |
| Elapsed seconds | 30.470 | 31.059 |
| CPU seconds | 29.939807 | 30.663163 |
| Peak cgroup bytes | 1,551,282,176 | 1,584,574,464 |
The scope includes shared analysis, temporary export, CLI parity and tokenizer.
The metadata-only probe separately used 10.711/10.909 s wall,
10.503415/10.664997 s CPU and 842,891,264/853,958,656 B peak cgroup memory.
All scopes used one CPU, an 8 GiB hard cap, 6 GiB early stop and no swap; cleanup
was verified with no OOM. Memory includes charged file cache, not summed RSS.
Counters were observed at payload exit while the observer remained alive.
Fresh MCP sessions do not establish an OS-cold cache. Shared-host scheduling and
filesystem/build warmness were uncontrolled; one pair establishes neither a
performance improvement nor an equivalence bound. Linux x64 static ASAR analysis
was executed; live Electron and other platforms were not exercised locally.
[Compact records and source hashes](javascript-analysis-effects-2026-10-15.json)
preserve these distinctions without archiving the downloadable application.
## Reproduce
Use pinned Node/npm, `npm ci`, then `npm run build:cached`. Run the following as
an ES module from the checkout root (`node --input-type=module < probe.mjs`):
```javascript
import assert from "node:assert/strict";
import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { toolAvailabilityInventory } from "./dist/contracts/toolOutputSchemaPrimitives.js";
import { closeVerifierResources } from "./scripts/lib/verifier-cleanup.mjs";
const client = new Client({
name: "javascript-effect-verification",
version: "1",
});
const transport = new StdioClientTransport({
command: process.execPath,
args: ["scripts/rea.mjs", "mcp"],
stderr: "pipe",
});
let primaryError;
try {
await client.connect(transport);
transport.stderr?.resume();
const { tools } = await client.listTools();
const tool = tools.find(
({ name }) => name === "analyze_javascript_application",
);
assert.ok(tool);
const response = await client.callTool({
name: "binary_session",
arguments: {},
});
assert.notEqual(response.isError, true);
const inventory = toolAvailabilityInventory.parse(
response.structuredContent?.result?.tool_availability,
);
const group = inventory.groups.find(({ names }) => names.includes(tool.name));
assert.ok(group);
console.log(
JSON.stringify({
tool: tool.name,
advertised_annotations: tool.annotations,
session_effects: group.effects,
session_annotations: group.annotations,
catalog_tool_count: tools.length,
}),
);
} catch (cause) {
primaryError = cause;
throw cause;
} finally {
await closeVerifierResources(
[() => client.close(), () => transport.close()],
primaryError,
);
}
```
For the real workflow, follow the artifact acquisition/digest instructions in
[module-reference verification](javascript-module-references-2026-10-15.md).
Run its existing command with `--mode references --rounds 1 --cli-parity` and the
same selected source paths and tokenizer. That verifier is unchanged by this
fix. The preserved 8 GiB cgroup observer and its source hashes are documented in
the same guide. The machine-readable records separate metadata-probe resources
from the complete real-workflow resources.
@@ -0,0 +1,547 @@
{
"base_revision": "e9a71efa31d6c3675b67938b8a79fa4ddf01604c",
"scope": "Semantic per-value string-byte normalization; real static shipped-application control, no hosted-model performance claim",
"runtime": {
"platform": "Linux x64",
"node": "24.18.0",
"npm": "11.16.0",
"tiktoken": "0.12.0"
},
"baseline_source_sha256": {
"src/domain/javascript/javascriptSemanticValues.ts": "df3fc30b5ba91901a85fe56f200355930da32d054bb026a747e3414af233b6b5",
"src/domain/javascript/javascriptSemanticPrimitives.ts": "c12b29f0faf4b6511777cba7ed8ac007c6d6170d657f01e43e194feacb3e0601",
"src/domain/javascript/javascriptSemanticResourceLimits.ts": "0203d207e0d6bb8aaa17746090f008876a11653afd660fce3dc44f3fda646a6c",
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1"
},
"final_source_sha256": {
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1",
"src/application/javascript/JavaScriptSemanticGraphDataProjection.ts": "844d4639401a9f050ce42c80192572a6d0d74fe4f81b37e93a2c20aaca9fb9a6",
"src/domain/javascript/javascriptSemanticAnalysis.ts": "a3f802ca3446c2b5376cc58b19d818eff318e6775bd47752793c3f649994f8a2",
"src/domain/javascript/javascriptSemanticAnalysis.unions.test.ts": "2e78717d30e637b5fc5bab6d0eff063f7a62e0199d33697c1cdfaf8317baa698",
"src/domain/javascript/javascriptSemanticDataEffectHelpers.ts": "8f9cf1a36f05b03dd816eaf9a6cdba0160d34ad7d17a961206e1bc32444d2ccc",
"src/domain/javascript/javascriptSemanticDataEffects.ts": "e69408f2f5910a0107fd5d0cae0ff60ed706448857bc8e535c37cac1a0cd4d37",
"src/domain/javascript/javascriptSemanticIr.ts": "68dad360d0a9e6bd72108b2717cae756b84ca1efb48455248ded2ff699d2c113",
"src/domain/javascript/javascriptSemanticPrimitives.ts": "899eeb6ccdf666f504f8b722327599997c924c8e4fb13a1cbd13edaf08c96640",
"src/domain/javascript/javascriptSemanticResourceLimits.ts": "0993a397f2a2a48c2b6c35494e940b3fce5c2c9032cfe33c7cf0401128c79dde",
"src/domain/javascript/javascriptSemanticState.ts": "bfcface5dcda22594f47ed390efa15f9140fe41cb2d5995896e52dd0ee31b978",
"src/domain/javascript/javascriptSemanticValues.ts": "a4ba51cc60fff38ef11fd5af35a2e1ad753cdb2dea9d44895f91d89320c5ddeb",
"tests/acceptance/applications/javascriptEndpointPayload.test.ts": "b3cfcde1c5b5e0698f84afd51f4b53e42e56101267707c20c0d038320f5cfbd2",
"tests/boundary/mcp/javascriptLiteralBudget.test.ts": "070106115b482269794799e448bd20b8e02df1f511f4ceb2b8fa75612c7f78e4",
"tests/boundary/mcp/javascriptLiteralPayload.test.ts": "03618272c605f8877ed171ab39e037e4d80eac72b7478421640076f739adfb50"
},
"artifact": {
"path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
"sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f"
},
"selected_source_paths": ["package.json", "main.js"],
"where": {
"path": "main.js",
"kind": "javascript-module"
},
"identical_parent_evidence_id": "ev_73ef06e3b9b944f54c5257f7960279127d8518d2a73cd8618bd045dbe44e6b5a",
"cli_parity": {
"evidence_id": "ev_b3586dfdf7d4f01157f8f2978326aaa7103987110f2df4fa5bf3331ff2898749",
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"exact_cli_mcp_view_parity": true
},
"unchanged_query_shapes": {
"legacy": {
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
"references": {
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
}
},
"unchanged_token_costs": {
"tokenizer": "cl100k_base",
"tiktoken_version": "0.12.0",
"costs": {
"legacy": {
"selected_catalog": 7977,
"full_catalog": 195522,
"common_request": 53,
"common_summary": 2675,
"requests": 2836,
"structured_replies": 71761,
"selected_catalog_task_total": 85302,
"full_catalog_task_total": 272847
},
"references": {
"selected_catalog": 7977,
"full_catalog": 195522,
"common_request": 53,
"common_summary": 2675,
"requests": 102,
"structured_replies": 5741,
"selected_catalog_task_total": 16548,
"full_catalog_task_total": 204093
}
}
},
"cohorts": {
"baseline": {
"preparation_ms": 19089.119622,
"query_samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 383.8260569999984
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 15.778886999996757
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 13.15173700000014
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 240.44363500000327
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 346.04796499999793
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 13.727306999997381
}
],
"resources": {
"elapsed_seconds": 33.394,
"cpu_seconds": 33.016802,
"peak_cgroup_bytes": 1979863040,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
}
},
"final": {
"preparation_ms": 19061.292544,
"query_samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 344.6316079999997
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 14.438351000000694
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 11.38763100000142
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 298.41579600000114
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 211.45682099999976
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 10.275370999999723
}
],
"resources": {
"elapsed_seconds": 32.949,
"cpu_seconds": 32.559187,
"peak_cgroup_bytes": 1880096768,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
}
}
},
"conditions": "First query is after shared artifact analysis; subsequent queries share one MCP session. Legacy item reads are serial; a concurrent legacy baseline is unmeasured. Filesystem/build warmness uncontrolled. Token costs count one post-change catalog, preparation request/summary and each request/structured reply once; client rendering, replay, reasoning, final answer and model latency are unmeasured. Preparation and parity/tokenization overhead are outside per-query elapsed times; external family-resource receipts include the complete verifier and children. Before/after used separate fresh MCP sessions. CPU/memory includes analysis, query arms, export, CLI parity and tokenization; cgroup memory includes file cache, not summed RSS. Counters are at payload exit while observer lives, not final scope counters. One before/after control establishes no speedup or equivalence bound. Catalog BPE projection excludes annotations/output schemas.",
"resource_policy": {
"memory_max_bytes": 8589934592,
"early_stop_bytes": 6442450944,
"cpu_quota_percent": 100,
"swap": false
},
"observer_sources_sha256": {
"resource-run.py": "7728862171415e7dee2c11af2ead2b9a54265fccaf82a7113956d36b29065e33",
"resource_payload.py": "6f089e645459eba80c5d73e39c21606c78173a44daf49fabc3b88c4631ce51c6"
},
"regressions": {
"original_main": "Quoted/template oversized literals failed through public CLI/MCP; addition/small controls passed. Corrected domain boundary reproduced 2 failures/16 passes.",
"review_head": "8 failed/25 passed before fixes for projection tags, encountered-but-discarded limits and bare quoted/template defaults; includes exact null default control.",
"interim_review_fix": "65/66 focused passed; old doubling-chain expectation omitted a genuine expression-depth limit now observed. Adjusted that assertion to preserve the byte-limit requirement while allowing other observed classes.",
"final_focused": "66 passed across five files on the restored 38d263a runtime. Final corrected public selection passed 7/7 in two files: the six literal/default/member cases plus the augmented original large-endpoint acceptance. 67 distinct focused cases across invocations; not a single 67-case invocation.",
"final_semantic_suite": "932 passed in 36 files on 38d263a. Final production src tree (including these domain tests) verified byte-identical to that revision; no repeated semantic run claimed.",
"arithmetic": "Computed 174762*6+2=1048574 and 174763*6+2=1048580. Corrected the erroneous published 1048578 total.",
"final_grouped_domain": "27 passed after grouping observations/defaults/allocation within function-size rules; no scenarios removed.",
"endpoint_contract_correction": "Restored exact endpoint lookup identities rather than shrinking the existing large-endpoint fixture. Added the identical oversized string as an exported primitive in that acceptance workflow: literal normalization must report its bound while full endpoint lookup/feature trace/semantic trace/version comparison continue to work. Production src tree restored byte-identical to 38d263a; 932 semantic tests from that state remain applicable. Final corrected public tests/gates recorded after execution.",
"final_corrected_gates": "Full static gate and docs gate (5 consistency tests) passed after endpoint identity restoration and strengthened unchanged-large-input acceptance. Production src remains byte-identical to 38d263a; final public 7/7 and fresh real control passed."
},
"prior_attempts": [
{
"stage": "Initial literal normalization, incomplete for member/default paths identified in review",
"revision": "40b9d3c5b9cbeae7661d8e351e1b5ef6e5338931",
"source_sha256": {
"src/domain/javascript/javascriptSemanticValues.ts": "2debbb4f32d7d189819f2413f0f7d05b9bdcf497451a1c578475e3f2ec6c8554",
"src/domain/javascript/javascriptSemanticPrimitives.ts": "899eeb6ccdf666f504f8b722327599997c924c8e4fb13a1cbd13edaf08c96640",
"src/domain/javascript/javascriptSemanticResourceLimits.ts": "0203d207e0d6bb8aaa17746090f008876a11653afd660fce3dc44f3fda646a6c",
"src/domain/javascript/javascriptSemanticAnalysis.unions.test.ts": "747d893d6ddd91cf24d3b62b7eb50e0af9b1715ab355bbfc2e10ed0dc171ec17",
"tests/boundary/mcp/javascriptLiteralBudget.test.ts": "46ceb5a169de3eec3a335b05ef4aa7b1b341a5ac06ad325bd191e862c5b6be70",
"tests/boundary/mcp/javascriptLiteralPayload.test.ts": "03618272c605f8877ed171ab39e037e4d80eac72b7478421640076f739adfb50",
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1"
},
"real_control_cohort": {
"preparation_ms": 18876.764036,
"query_samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 346.7870870000006
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 18.34765800000241
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 11.56626999999935
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 227.17703500000061
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 251.5148330000011
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 10.888227999999799
}
],
"resources": {
"elapsed_seconds": 31.347,
"cpu_seconds": 31.05517,
"peak_cgroup_bytes": 1589915648,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
}
},
"validation": {
"baseline_public": "Quoted and cooked-template cases retained 200000-unit normalized literals and failed; addition and small exact controls passed. Aggregate-capacity test passed.",
"baseline_domain_corrected": "2 over-bound failures, 16 passed. Initial combined-run domain assertions had incorrectly required an empty optional resourceLimits array; corrected before using the domain reproduction as evidence.",
"fixed_focused": "55 passed across five files.",
"semantic_suite": "923 passed across 36 files.",
"capacity_after_fixture_cleanup": "1 passed; all 16 bounded values, aggregate size >= original, typed identities and retained tracing preserved.",
"interim_static_failure": "Typecheck rejected resume() on the new test SDK stderr Stream declaration. Switched to its declared data event, matching existing typed tests; analyzer source unchanged.",
"public_boundary_after_stream_type_fix": "4 passed across actual CLI and stdio MCP; analyzer source unchanged."
}
},
{
"stage": "Projection/default correction; final review subsequently found unnormalized request endpoints",
"revision": "38d263a369e7853ccfae1c8e0a3bd387f920c7cf",
"source_sha256": {
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1",
"src/application/javascript/JavaScriptSemanticGraphDataProjection.ts": "844d4639401a9f050ce42c80192572a6d0d74fe4f81b37e93a2c20aaca9fb9a6",
"src/domain/javascript/javascriptSemanticAnalysis.ts": "a3f802ca3446c2b5376cc58b19d818eff318e6775bd47752793c3f649994f8a2",
"src/domain/javascript/javascriptSemanticAnalysis.unions.test.ts": "2e78717d30e637b5fc5bab6d0eff063f7a62e0199d33697c1cdfaf8317baa698",
"src/domain/javascript/javascriptSemanticDataEffectHelpers.ts": "8f9cf1a36f05b03dd816eaf9a6cdba0160d34ad7d17a961206e1bc32444d2ccc",
"src/domain/javascript/javascriptSemanticDataEffects.ts": "e69408f2f5910a0107fd5d0cae0ff60ed706448857bc8e535c37cac1a0cd4d37",
"src/domain/javascript/javascriptSemanticIr.ts": "68dad360d0a9e6bd72108b2717cae756b84ca1efb48455248ded2ff699d2c113",
"src/domain/javascript/javascriptSemanticPrimitives.ts": "899eeb6ccdf666f504f8b722327599997c924c8e4fb13a1cbd13edaf08c96640",
"src/domain/javascript/javascriptSemanticResourceLimits.ts": "0993a397f2a2a48c2b6c35494e940b3fce5c2c9032cfe33c7cf0401128c79dde",
"src/domain/javascript/javascriptSemanticState.ts": "bfcface5dcda22594f47ed390efa15f9140fe41cb2d5995896e52dd0ee31b978",
"src/domain/javascript/javascriptSemanticValues.ts": "a4ba51cc60fff38ef11fd5af35a2e1ad753cdb2dea9d44895f91d89320c5ddeb",
"tests/boundary/mcp/javascriptLiteralBudget.test.ts": "070106115b482269794799e448bd20b8e02df1f511f4ceb2b8fa75612c7f78e4",
"tests/boundary/mcp/javascriptLiteralPayload.test.ts": "03618272c605f8877ed171ab39e037e4d80eac72b7478421640076f739adfb50"
},
"real_control_cohort": {
"preparation_ms": 19599.643274,
"query_samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 396.9265450000021
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 15.658120000000054
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 12.24905100000251
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 237.03392900000108
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 357.78818299999693
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 14.37622100000226
}
],
"resources": {
"elapsed_seconds": 33.969,
"cpu_seconds": 33.499223,
"peak_cgroup_bytes": 1893015552,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
}
},
"validation": {
"original_main": "Quoted/template oversized literals failed through public CLI/MCP; addition/small controls passed. Corrected domain boundary reproduced 2 failures/16 passes.",
"review_head": "8 failed/25 passed before fixes for projection tags, encountered-but-discarded limits and bare quoted/template defaults; includes exact null default control.",
"interim_review_fix": "65/66 focused passed; old doubling-chain expectation omitted a genuine expression-depth limit now observed. Adjusted that assertion to preserve the byte-limit requirement while allowing other observed classes.",
"final_focused": "66 passed in five files.",
"final_semantic_suite": "932 passed in 36 files.",
"arithmetic": "Computed 174762*6+2=1048574 and 174763*6+2=1048580. Corrected the erroneous published 1048578 total.",
"final_grouped_domain": "27 passed after grouping observations/defaults/allocation within function-size rules; no scenarios removed.",
"endpoint_review_baseline": "Production at 38d263a: 7 failed/14 passed across 13 new domain and 8 CLI/MCP cases before endpoint normalization. The later public linked-response case was not in this baseline run. Regression tests were uncommitted; final formatted test hashes are preserved, not claimed as the baseline test bytes.",
"endpoint_selection_attempt": "First six-file selection exited before execution because a signed-zero test filename was mistyped; corrected the exact path. No test result claimed for that attempt."
}
},
{
"stage": "Rejected endpoint normalization: violated existing full-endpoint lookup/trace contract; reverted after CI acceptance failure",
"revision": "580887209c4fceda432eac4083fac82a0dd78f15",
"source_sha256": {
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1",
"src/application/javascript/JavaScriptSemanticGraphDataProjection.ts": "a648f97e631985edcb5259ff4f1fdf0332dca18b8c10b57e050e36a785c1c524",
"src/domain/javascript/javascriptSemanticAnalysis.requestBudget.test.ts": "8e84ffa70d834f5589d04118f0aaf33b0383b15ea97545ff69c66a74473aca73",
"src/domain/javascript/javascriptSemanticAnalysis.ts": "a3f802ca3446c2b5376cc58b19d818eff318e6775bd47752793c3f649994f8a2",
"src/domain/javascript/javascriptSemanticAnalysis.unions.test.ts": "2e78717d30e637b5fc5bab6d0eff063f7a62e0199d33697c1cdfaf8317baa698",
"src/domain/javascript/javascriptSemanticDataEffectHelpers.ts": "8f9cf1a36f05b03dd816eaf9a6cdba0160d34ad7d17a961206e1bc32444d2ccc",
"src/domain/javascript/javascriptSemanticDataEffects.ts": "eed961e0b1d8a320e76bbba933408e950b4a4a446110401e8cf470f1e74d8315",
"src/domain/javascript/javascriptSemanticIr.ts": "3b2ede73dbcfc74c4014e4d1affcbf00ecccc29a422ed495a7a3f2f517056c9b",
"src/domain/javascript/javascriptSemanticPrimitives.ts": "899eeb6ccdf666f504f8b722327599997c924c8e4fb13a1cbd13edaf08c96640",
"src/domain/javascript/javascriptSemanticResourceLimits.ts": "0993a397f2a2a48c2b6c35494e940b3fce5c2c9032cfe33c7cf0401128c79dde",
"src/domain/javascript/javascriptSemanticState.ts": "bfcface5dcda22594f47ed390efa15f9140fe41cb2d5995896e52dd0ee31b978",
"src/domain/javascript/javascriptSemanticValues.ts": "a4ba51cc60fff38ef11fd5af35a2e1ad753cdb2dea9d44895f91d89320c5ddeb",
"tests/boundary/mcp/javascriptLiteralBudget.test.ts": "61319ea954de7f256841f43ca9355a1706ce8e93d30f2a8ba851d5e717bd19e7",
"tests/boundary/mcp/javascriptLiteralPayload.test.ts": "03618272c605f8877ed171ab39e037e4d80eac72b7478421640076f739adfb50"
},
"real_control_cohort": {
"preparation_ms": 19939.160272,
"query_samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 348.3974309999976
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 13.97052899999835
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 12.060379000002285
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 212.01217800000086
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 223.73954800000138
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 10.450989999997546
}
],
"resources": {
"elapsed_seconds": 33.062,
"cpu_seconds": 32.71624,
"peak_cgroup_bytes": 1897406464,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
}
},
"validation": {
"original_main": "Quoted/template oversized literals failed through public CLI/MCP; addition/small controls passed. Corrected domain boundary reproduced 2 failures/16 passes.",
"review_head": "8 failed/25 passed before fixes for projection tags, encountered-but-discarded limits and bare quoted/template defaults; includes exact null default control.",
"interim_review_fix": "65/66 focused passed; old doubling-chain expectation omitted a genuine expression-depth limit now observed. Adjusted that assertion to preserve the byte-limit requirement while allowing other observed classes.",
"final_focused": "81 passed in six files; the same CLI/MCP file then passed 9/9 after adding a linked-response case. That follow-up replaces its earlier 8-case coverage; 82 distinct cases across the final six-file selection, not one 82-case invocation.",
"final_semantic_suite": "945 passed in 37 files, overlapping focused domain coverage.",
"arithmetic": "Computed 174762*6+2=1048574 and 174763*6+2=1048580. Corrected the erroneous published 1048578 total.",
"final_grouped_domain": "27 passed after grouping observations/defaults/allocation within function-size rules; no scenarios removed.",
"endpoint_review_baseline": "Production at 38d263a: 7 failed/14 passed across 13 new domain and 8 CLI/MCP cases before endpoint normalization. The later public linked-response case was not in this baseline run. Regression tests were uncommitted; final formatted test hashes are preserved, not claimed as the baseline test bytes.",
"endpoint_selection_attempt": "First six-file selection exited before execution because a signed-zero test filename was mistyped; corrected the exact path. No test result claimed for that attempt.",
"endpoint_typecheck_attempt": "Full static gate found the inferred optional dataField in the public test computed key. Replaced the in-property check with an explicit bare === true discriminant; scenario inputs and runtime implementation unchanged. Corrected static/public checks recorded separately.",
"final_gates": "Full static gate passed after the explicit test discriminant; final public file passed 9/9 again, then docs gate passed including 5 consistency tests. Runtime implementation unchanged after the 945-test semantic suite and real control."
},
"ci_failure": {
"run_id": 38758262643,
"job_id": 116503076738,
"test": "tests/acceptance/applications/javascriptEndpointPayload.test.ts",
"result": "1 failed/1573 passed/19 skipped; request endpoint no longer matched its complete source value. Other local tests and real Obsidian control passed but did not establish this compatibility contract.",
"aggregate_result": "Merged source/built report: 1 failed/15625 passed/138 skipped. Portable tests and CI required failed as aggregates of the same endpoint assertion; no separate additional failed test."
}
}
],
"review_baseline_revision": "40b9d3c5b9cbeae7661d8e351e1b5ef6e5338931",
"review_baseline_source_sha256": {
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1",
"src/application/javascript/JavaScriptSemanticGraphDataProjection.ts": "ee541e634264363822bf4ce05c42c72272029c7e8da72bbeed643ad1341d0756",
"src/domain/javascript/javascriptSemanticAnalysis.ts": "a1cf791a61ee4742c351c006b69b64eba6bef3068f7a8450ed8f9366bfe4ff88",
"src/domain/javascript/javascriptSemanticAnalysis.unions.test.ts": "747d893d6ddd91cf24d3b62b7eb50e0af9b1715ab355bbfc2e10ed0dc171ec17",
"src/domain/javascript/javascriptSemanticDataEffectHelpers.ts": "5ee7af18dd847726d8fe1828ea25f386ff9ef317d996a3f7969253bf73973cfa",
"src/domain/javascript/javascriptSemanticDataEffects.ts": "4c62462016246bc7198294a74a60e87598fc009c53f1601abc2d4662d41b5bd1",
"src/domain/javascript/javascriptSemanticIr.ts": "14955cb4b7912ed6a4f26f804a2480f841dcb6084dbddd15856375fa62cdcfa1",
"src/domain/javascript/javascriptSemanticPrimitives.ts": "899eeb6ccdf666f504f8b722327599997c924c8e4fb13a1cbd13edaf08c96640",
"src/domain/javascript/javascriptSemanticResourceLimits.ts": "0203d207e0d6bb8aaa17746090f008876a11653afd660fce3dc44f3fda646a6c",
"src/domain/javascript/javascriptSemanticState.ts": "d94c5a88bb105284fab192406a8c88860d59f80c93394ed3ee7264969df254a6",
"src/domain/javascript/javascriptSemanticValues.ts": "2debbb4f32d7d189819f2413f0f7d05b9bdcf497451a1c578475e3f2ec6c8554",
"tests/boundary/mcp/javascriptLiteralBudget.test.ts": "46ceb5a169de3eec3a335b05ef4aa7b1b341a5ac06ad325bd191e862c5b6be70",
"tests/boundary/mcp/javascriptLiteralPayload.test.ts": "03618272c605f8877ed171ab39e037e4d80eac72b7478421640076f739adfb50"
},
"implementation": "Per-analysis state records encountered resource classifications at expression/default normalization; final coverage consumes those facts. Slot projection preserves tagged unknown values. Removed retained-value recursive coverage scan and duplicate raw default reader. Defaults retain optional valueResourceLimit and graph value_resource_limit plus an anchored resource-limit unknown; known null/false/0/empty remain exact. Endpoint identities intentionally remain exact lookup values, outside the normalized primitive lattice; rejected endpoint normalization and its CI failure are preserved separately.",
"restored_production_revision": "38d263a369e7853ccfae1c8e0a3bd387f920c7cf",
"final_corrected_resource_receipts": {
"public_7": {
"elapsed_seconds": 43.621,
"cpu_seconds": 43.097453,
"peak_cgroup_bytes": 1520324608,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
},
"static_and_docs": {
"elapsed_seconds": 111.403,
"cpu_seconds": 110.830839,
"peak_cgroup_bytes": 4268244992,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
}
}
}
}
@@ -0,0 +1,86 @@
# Semantic literal byte-budget verification
Tracks #3933 under #4027. All normalized semantic literals and configuration
defaults use the primitive owner. Its singleton path validates strings/nonfinite
numbers/negative zero without a Set, sorting or canonical-key serialization.
Each source analysis owns a bounded set of encountered limit classifications;
coverage consumes these observations after evaluation. This replaces a recursive
scan that only saw retained binding/return values. No persistent cache is added.
## Correctness and coverage
Public CLI and actual stdio MCP cases cover quoted strings, cooked templates,
equivalent concatenation, member receivers, a configuration-only expression
statement and a small exact control. Direct/default oversized values become
`resource-limit` unknowns with partial application coverage and
`javascript_semantic_primitive_bytes = 1048576`. Defaults carry
`value_resource_limit` inline and an unknown anchored to their config node.
Known null/false/zero/empty defaults remain exact. Original source/digests and
CLI/MCP identity parity are preserved.
Member and destructuring projections use the shared slot owner's tagged value.
An encountered limit stays visible even when a subsequent projection selects a
healthy sibling: the selected value remains exactly `7`, while file coverage is
partial. This avoids inferring completeness from the final retained values alone.
The duplicate raw default reader and superseded retained-value scan are removed.
Boundary controls admit 174,762 UTF-16 units (1,048,574 estimated JSON bytes)
and reject 174,763 (1,048,580 bytes). Actual arithmetic corrected the earlier
published 1,048,578 total; the unit-count boundary assertions were already correct.
The estimate counts six bytes per unit plus two quotes. It does not establish
actual ASCII JSON size above 1 MiB or an observed OOM.
The initial main baseline reproduced both public literal failures, with addition
and small controls passing. A mistaken optional-limit-array control was corrected
before the separate domain reproduction (2 failed/16 passed). Review head
`40b9d3c5` then reproduced the additional projection/default gaps (8 failed,
25 passed). The first review correction passed 65/66 focused tests; a doubling
chain now truthfully retains an additional encountered expression-depth limit,
so its byte-growth assertion was updated to allow other recorded limits.
Prior validation on the restored runtime: **66 focused tests** in five files and **932 semantic tests**
in 36 files, with overlapping domain coverage. The large-wire fixture retains
16 individually admitted values and at least the former aggregate UTF-16 payload,
plus complete CLI/MCP delivery, typed identities, empty strings and retained
tracing. Inputs regenerate from the tests.
## Endpoint identity compatibility
An attempted endpoint normalization at `5808872` passed its new local cases and real Obsidian control, but failed the existing CI endpoint-payload acceptance workflow (1 failed/1,573 passed/19 skipped in that shard). It violated the established full endpoint lookup/trace contract. This extension was reverted; endpoint values are lookup identities, outside the normalized primitive lattice. The original large endpoint is preserved. Corrected public validation passed **7/7** across two files; this adds one acceptance workflow to the previous 66-case focused selection (**67 distinct cases**, not one 67-case invocation). Its acceptance workflow now also normalizes that identical string as an exported primitive, requiring the typed value bound while endpoint lookup, both trace workflows and version comparison remain usable. Prior measurements and failed attempts remain in the JSON record. Production source is restored byte-identical to `38d263a`; the 932-test semantic run belongs to that state. Final full static and documentation gates (five consistency tests) passed after the compatibility correction.
## Real application control and costs
Official Obsidian 1.14.4 ASAR, selected `package.json` and `main.js`. Follow the
acquisition/digest and existing verifier command in
[module-reference verification](javascript-module-references-2026-10-15.md).
Use three alternating-order query pairs with CLI parity on each revision.
Application code is not executed.
The final correction retains the exact baseline full parent/view Evidence IDs,
23-row fact digest, source coverage and unknowns. Static `cl100k_base` task costs
remain 16,548 with selected name/description/inputSchema contracts, or 204,093
with the full catalog projection, for the reference workflow. Serial legacy
reads also keep their original costs. The query projection improvement belongs
to #4097; these are controls for semantic normalization and coverage.
| Complete real verifier | Before | Final correction |
| ---------------------- | ------------: | ---------------: |
| Elapsed seconds | 33.394 | 32.949 |
| CPU seconds | 33.016802 | 32.559187 |
| Peak cgroup bytes | 1,979,863,040 | 1,880,096,768 |
Includes initial analysis, both query arms, export, CLI parity and tokenizer.
One CPU, 8 GiB hard cap, 6 GiB early stop, no swap; cleanup verified and no OOM.
Memory includes charged file cache, not summed RSS. Counters are at payload exit
while the observer remains alive. Fresh MCP sessions do not establish OS-cold
cache conditions. Shared-host scheduling and filesystem/build warmness were
uncontrolled. This one before/after control establishes neither a speedup nor
an equivalence bound. Static BPE excludes annotations/output schemas, client
rendering/replay, reasoning and final answers; no hosted agent was run. Linux
static ASAR analysis was exercised, not live Electron or other platforms.
[Compact records, samples, source hashes and prior attempts](javascript-literal-byte-budget-2026-10-15.json)
preserve the initial incomplete correction separately from the final measurements.
No downloadable application or complete bundle is archived. Reproduce boundary
outcomes through the listed public tests and reuse the existing real verifier
and preserved 8 GiB observer linked above. Observer hashes and result-affecting
touched source hashes are pinned in the records.
@@ -0,0 +1,691 @@
{
"base_revision": "c9f9b83c6f5878f1d5b102ab206a2ce214749258",
"source_sha256": {
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1",
"src/contracts/analysisViewToolContracts.ts": "f7c64b3472e7ec1090f9d47ede864b8c9630d506d896454a800747f2c90a8960",
"src/domain/analysisView/analysisView.ts": "854b03988791c19642b01d17813b379b51d8edc10d2190a3c236c9a1b2feb365",
"src/domain/analysisView/javascriptApplicationView.ts": "f2c41ad15fdc9f891412c9161a832b60baf3dae55e3c4d60159098d07f7d1ef1",
"src/domain/analysisView/javascriptModuleReferences.ts": "34c7a7ff466e9c49d43f1b11b72f878041de61a1bc09086ec190a5833b454806",
"scripts/fixtures/tokenizer-family-wrapper.py": "2e9b7092ee539ae1c6a477492f05bb6007d4612dadfff9b90051d621de43049b"
},
"verification": {
"scope": "Completed module-fact reads from identical retained Evidence; no hosted-model performance claim",
"artifact": {
"path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
"sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f"
},
"parent_evidence_id": "ev_73ef06e3b9b944f54c5257f7960279127d8518d2a73cd8618bd045dbe44e6b5a",
"source_selection": {
"requested_paths": ["package.json", "main.js"],
"unselected_files": 36
},
"source_coverage": {
"application": {
"status": "partial",
"truncated": false,
"omitted_count": null,
"limits": []
},
"semantic": {
"status": "partial",
"truncated": false,
"omitted_nodes": null,
"omitted_relations": null,
"limits": [],
"families": [
{
"family": "boundary",
"status": "partial",
"retained_relations": 14,
"omitted_relations": null,
"unknown_count": 31
},
{
"family": "call-flow",
"status": "partial",
"retained_relations": 845,
"omitted_relations": null,
"unknown_count": 1278
},
{
"family": "child-process",
"status": "partial",
"retained_relations": 0,
"omitted_relations": null,
"unknown_count": 31
},
{
"family": "closure",
"status": "partial",
"retained_relations": 1187,
"omitted_relations": null,
"unknown_count": 31
},
{
"family": "configuration",
"status": "partial",
"retained_relations": 0,
"omitted_relations": null,
"unknown_count": 31
},
{
"family": "data-flow",
"status": "partial",
"retained_relations": 9388,
"omitted_relations": null,
"unknown_count": 1135
},
{
"family": "event",
"status": "partial",
"retained_relations": 127,
"omitted_relations": null,
"unknown_count": 89
},
{
"family": "object-flow",
"status": "partial",
"retained_relations": 1462,
"omitted_relations": null,
"unknown_count": 2292
},
{
"family": "promise-ownership",
"status": "partial",
"retained_relations": 80,
"omitted_relations": null,
"unknown_count": 98
},
{
"family": "request",
"status": "partial",
"retained_relations": 0,
"omitted_relations": null,
"unknown_count": 31
},
{
"family": "resource-lifecycle",
"status": "partial",
"retained_relations": 4,
"omitted_relations": null,
"unknown_count": 31
},
{
"family": "timer",
"status": "partial",
"retained_relations": 8,
"omitted_relations": null,
"unknown_count": 31
}
]
},
"application_unknowns": 36,
"semantic_unknowns": 5109
},
"where": {
"path": "main.js",
"kind": "javascript-module"
},
"preparation_ms": 20978.249922,
"samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 363.02500200000213,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 14.895039999999426,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 12.951290000000881,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 232.7533779999976,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 235.16672899999685,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 10.566158999998152,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
}
],
"token_costs": {
"tokenizer": "cl100k_base",
"tiktoken_version": "0.12.0",
"costs": {
"legacy": {
"selected_catalog": 7977,
"full_catalog": 195446,
"common_request": 53,
"common_summary": 2675,
"requests": 2836,
"structured_replies": 71761,
"selected_catalog_task_total": 85302,
"full_catalog_task_total": 272771
},
"references": {
"selected_catalog": 7977,
"full_catalog": 195446,
"common_request": 53,
"common_summary": 2675,
"requests": 102,
"structured_replies": 5741,
"selected_catalog_task_total": 16548,
"full_catalog_task_total": 204017
}
}
},
"cli_parity": {
"evidence_id": "ev_b3586dfdf7d4f01157f8f2978326aaa7103987110f2df4fa5bf3331ff2898749",
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"exact_cli_mcp_view_parity": true
},
"conditions": "First query is after shared artifact analysis; subsequent queries share one MCP session. Legacy item reads are serial; a concurrent legacy baseline is unmeasured. Filesystem/build warmness uncontrolled. Token costs count one post-change catalog, preparation request/summary and each request/structured reply once; client rendering, replay, reasoning, final answer and model latency are unmeasured. Preparation and parity/tokenization overhead are outside per-query elapsed times; external family-resource receipts include the complete verifier and children."
},
"resources": {
"scope": "Complete verifier, MCP/analysis descendants, temporary export, CLI parity and tokenizer; cgroup memory includes charged file cache and is not summed RSS",
"elapsed_seconds": 35.797,
"cpu_seconds": 35.197074,
"peak_cgroup_bytes": 1938313216,
"memory_max_bytes": 8589934592,
"memory_early_stop_bytes": 6442450944,
"cpu_quota_percent": 100,
"payload_exit_code": 0,
"payload_cleanup_verified": true,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
},
"observer_sources_sha256": {
"resource-run.py": "7728862171415e7dee2c11af2ead2b9a54265fccaf82a7113956d36b29065e33",
"resource_payload.py": "6f089e645459eba80c5d73e39c21606c78173a44daf49fabc3b88c4631ce51c6"
}
},
"prior_attempts": [
{
"scope": "Initial verifier incorrectly requested full MCP delivery; completed analysis exceeded existing response admission",
"elapsed_seconds": 21.971,
"cpu_seconds": 21.78546,
"peak_cgroup_bytes": 1080860672,
"outcome": "resource_constraint transport; verifier corrected to summary-first; no performance credit"
},
{
"scope": "Interim successful parity run before eliminating verifier assertion serialization and counting the bootstrap request",
"elapsed_seconds": 31.335,
"cpu_seconds": 31.07044,
"peak_cgroup_bytes": 1652293632,
"outcome": "parity passed; superseded measurement, not pooled with final samples"
},
{
"scope": "Successful three-pair probe before adding the shared analyze_javascript_application schema to selected-catalog accounting",
"preparation_ms": 18317.110148,
"samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 313.59318599999824,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 13.595478999999614,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 11.230690000000322,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 206.19418099999893,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 242.2037199999977,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 13.734700000000885,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
}
],
"elapsed_seconds": 31.037,
"cpu_seconds": 30.786998,
"peak_cgroup_bytes": 1886543872,
"outcome": "Facts and CLI/MCP parity passed. Selected-catalog totals omitted the common analysis-tool schema; superseded, not pooled. Shared-host timing differed substantially from the final run."
},
{
"scope": "Completed three-pair probe with full token accounting before the review-added tokenizer deadline",
"preparation_ms": 66696.731143,
"samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 1114.080965000001,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 46.572758999987855,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 37.09324900001229,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 675.7124039999908,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 777.2660329999926,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 36.31178899999941,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
}
],
"elapsed_seconds": 108.372,
"cpu_seconds": 81.551676,
"peak_cgroup_bytes": 1884962816,
"outcome": "All facts/costs and CLI/MCP parity passed. Superseded execution source after adding a tokenizer deadline; retained separately, not pooled."
},
{
"scope": "Successful data comparison with direct-child tokenizer timeout before adopting shared owned-process supervision",
"preparation_ms": 19051.368892000002,
"samples": [
{
"round": 0,
"mode": "legacy",
"elapsed_ms": 330.7313439999998,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 0,
"mode": "references",
"elapsed_ms": 13.62184999999954,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
},
{
"round": 1,
"mode": "references",
"elapsed_ms": 12.475999999998749,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
},
{
"round": 1,
"mode": "legacy",
"elapsed_ms": 187.18667300000016,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 2,
"mode": "legacy",
"elapsed_ms": 293.4882039999975,
"calls": 24,
"structured_reply_bytes": 325201,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 55,
"total": 55,
"next_offset": null,
"exhausted": true
}
},
{
"round": 2,
"mode": "references",
"elapsed_ms": 8.146389999998064,
"calls": 1,
"structured_reply_bytes": 22158,
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
"matching_modules": 23,
"coverage": {
"status": "page",
"examined": 23,
"total": 23,
"next_offset": null,
"exhausted": true
}
}
],
"elapsed_seconds": 30.742,
"cpu_seconds": 30.425218,
"peak_cgroup_bytes": 1592938496,
"outcome": "Fact and cost parity passed. That harness only killed its immediate tokenizer child; superseded by process-family supervision and detached-helper verification."
}
],
"prior_tokenizer_timeout_verifications": [
{
"artifact_sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f",
"scenario": "Real Obsidian references plus CLI parity, then a deliberately stalled tokenizer",
"injected_tokenizer_source": "#!/bin/sh\nexec /bin/sleep 30\n",
"timeout_ms": 20,
"observed_error_code": "ETIMEDOUT",
"expected_payload_exit_code": 1,
"payload_cleanup_verified": true,
"remaining_owned_temporary_files": 0,
"elapsed_seconds": 31.258,
"cpu_seconds": 31.00025,
"peak_cgroup_bytes": 1644077056,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
},
"scope": "Robustness check; no efficiency credit",
"limitation": "Immediate child only; did not test detached descendants and is superseded by the owned-family check."
}
],
"tokenizer_timeout_verification": {
"artifact_sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f",
"scenario": "Real Obsidian references and CLI parity, then an owned tokenizer wrapper with a detached SIGTERM-ignoring helper",
"fixture": "scripts/fixtures/tokenizer-family-wrapper.py",
"fixture_sha256": "2e9b7092ee539ae1c6a477492f05bb6007d4612dadfff9b90051d621de43049b",
"timeout_ms": 2000,
"observed_failure_type": "OwnedCommandFailure",
"observed_reason": "timeout",
"cleanup_failure": null,
"expected_payload_exit_code": 1,
"payload_cleanup_verified": true,
"remaining_owned_temporary_files": 0,
"helper_observation": {
"pid": 2871108,
"group": 2871108,
"parent": 2871107,
"run_id": "rea-module-token-f139b74a-dd83-498b-b663-e765104159ec",
"detached": true,
"ignores_sigterm": true
},
"elapsed_seconds": 55.08,
"cpu_seconds": 45.245603,
"peak_cgroup_bytes": 1563475968,
"events_at_payload_exit": {
"memory.events": {
"low": 0,
"high": 0,
"max": 0,
"oom": 0,
"oom_kill": 0,
"oom_group_kill": 0
},
"pids.events": {
"max": 0
}
},
"scope": "Robustness check; no efficiency credit. PIDs are observations; signaling authority comes from the shared process owner."
}
}
@@ -0,0 +1,123 @@
# Retained JavaScript module-reference verification
Tracks #4092 under #4027 and the decision in #4091. This verifies an existing
tool's data projection, without a code-mode host or SDK. [Machine-readable
results](javascript-module-references-2026-10-15.json) pin the base revision,
executed source hashes, samples, tokenizer and resource observations.
## Real application and question
Official Obsidian 1.14.4 ASAR, 27,477,966 bytes, SHA-256
`146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f`.
The [official gzip](https://github.com/obsidianmd/obsidian-releases/releases/download/v1.14.4/obsidian-1.14.4.asar.gz)
has SHA-256 `d1ed428c363968774f0f3906e67d8a53a058ece0b6cdd924b07865977b2ada21`.
Select `package.json` and `main.js`; the other 36 inventoried files remain
explicitly unselected. No target code is executed.
Question: retrieve every retained `javascript-module` identity at exact path
`main.js`, its retained source-range observation count, and distinct support
states. Compare the existing module page plus full item reads with one filtered
typed reference view. All six completed query samples use one identical retained
parent. All 23 selected rows, identities, counts and support states match. Public
CLI inline input and MCP retained input produce the exact same view and Evidence
ID. This establishes producer-fact consistency, not independent extractor
correctness or proof of runtime loading.
## Completed read costs
| Measurement | Existing page + items | Typed reference view |
| ------------------------------------------------------------- | --------------------: | -------------------: |
| Calls per query task | 24 | 1 |
| Structured reply bytes | 325,201 | 22,158 |
| First query in its arm, after preparation | 363.03 ms | 14.90 ms |
| Subsequent same-session query times | 232.75 / 235.17 ms | 12.95 / 10.57 ms |
| Request + structured-reply BPE tokens | 74,597 | 5,843 |
| With selected tool catalog + shared bootstrap request/summary | 85,302 | 16,548 |
| With complete tool catalog + shared bootstrap request/summary | 272,771 | 204,017 |
Order alternates: existing/reference, reference/existing, existing/reference.
Times include verifier-side fact normalization and equality checks; byte/token
accounting follows the timed reads. The initial artifact analysis and summary
took 20.978 seconds and is shared preparation, not a query-speed improvement.
The retained source remains partial; unknown counts and source selection are
preserved independently of exhausted pages. No query cache was introduced.
Tokens are `cl100k_base` counts with tiktoken 0.12.0 over serialized values, not
hosted-model usage. Catalog projections contain name/description/inputSchema;
both workflows use the same post-change catalog. Each request/reply is counted
once. Output schemas, host-specific rendering/replay, reasoning, final answers,
agent success rates and model latency are unmeasured. This is a completed
data-retrieval comparison; it does not establish a whole-agent speedup or a
before/after catalog-size improvement. Legacy item reads are serial; a concurrent
legacy baseline was not measured. Selected discovery includes both the
analysis and view tool schemas. Builds/filesystem are warm or uncontrolled,
so the first query is not an OS-cold analysis measurement. Shared-host scheduling
was uncontrolled: an earlier successful probe had substantially higher wall/CPU
times. Its samples are retained separately; neither run establishes a portable
latency guarantee.
The complete final verifier scope used 35.797 seconds elapsed, 35.197 seconds
CPU and 1,938,313,216 bytes peak cgroup memory. This includes shared analysis,
both query arms, temporary export, CLI parity and tokenization; CPU/memory were
not isolated by arm. Cgroup memory includes charged file cache and is not summed
process RSS. The whole scope had one CPU, an 8 GiB hard memory cap, 6 GiB early
stop and no swap. Payload cleanup was verified; no OOM/capacity event occurred.
An earlier full-response transport failure and interim probes are recorded
separately in the JSON and earn no performance credit.
A review follow-up exercised a stalled tokenizer after real Obsidian reference
reads and CLI parity. The committed POSIX fault fixture forks a helper into a
separate process group, ignores SIGTERM and stalls. With a caller-selected
2,000 ms deadline, the shared owned-command supervisor reported
`OwnedCommandFailure` with reason `timeout` and no cleanup failure. The verifier
failed as expected, its complete owned scope was cleaned, and its selected
temporary root was empty. The separate robustness run used 55.080 s wall /
45.246 s CPU / 1,563,475,968 B peak cgroup memory, with cleanup verified and no
OOM. It earns no efficiency credit. An earlier 20 ms immediate-child timeout
probe did not establish descendant cleanup; it remains a separate prior attempt.
The detached-helper scenario was executed on Linux, not Windows or macOS.
A deterministic CI regression also asserts two retained
observations at the same source range, excludes an unavailable location, and
checks agreement with the full item view; the count deliberately measures
observations rather than unique source sites.
## Reproduce
Use the pinned Node/npm toolchain and `npm ci`, then `npm run build:cached`.
Download/decompress the versioned application outside the checkout and check its
digest. Run with an operator-selected absolute artifact path:
```bash
node scripts/verify/javascript/module-references.mjs \
--artifact /absolute/path/obsidian-1.14.4.asar \
--source-path package.json --source-path main.js \
--path main.js --kind javascript-module --rounds 3 --cli-parity \
--tokenizer-python /absolute/path/to/tiktoken-venv/bin/python
```
The optional Python interpreter needs tiktoken 0.12.0; omit that flag to skip
token accounting. It has a 60-second wall-time deadline, configurable with the
positive integer `--tokenizer-timeout-ms`. The tokenizer uses the existing
owned-command supervisor, with native identity checks and inherited run-token
sweeping for descendants. Inputs and temporary Evidence use the existing private
runtime root. Cleanup attempts preserve the primary error; incomplete command
cleanup retains its owner and private files for recovery. `--mode legacy` or
`--mode references` runs one arm. Fresh runs
reanalyze the artifact and can produce different parent identities/resource
coverage; the verifier requires equal facts within its paired run. The measured
run additionally used the preserved [8 GiB cgroup observer](https://github.com/morluto/rea/blob/b3bdabab694af1f9801eff7caf75001b92314a58/experiments/analysis-efficiency/resource-run.py)
and its adjacent `resource_payload.py`; observer hashes are in the JSON.
No application, complete bundle, raw observations or ambient environment is
archived. Temporary exported/inline Evidence files are removed after successful
owned-command cleanup.
For the Linux descendant-timeout check, create an operator-selected private
directory and set `REA_TOKENIZER_PROBE_RECORD` to a file within it. Run the same
real-artifact command with `--mode references --rounds 1`, replace the tokenizer
with the absolute path to `scripts/fixtures/tokenizer-family-wrapper.py`, and add
`--tokenizer-timeout-ms 2000`. Expect a timeout failure. The explicit marker
confirms the detached helper started; the resource observer must separately
verify the complete owned scope is empty, and the selected temporary root must
contain no verifier files. The recorded PID is an observation, not authority to
signal that process.
+51 -3
View File
@@ -17,7 +17,7 @@ additional permission flag or degraded mode is required.
- Node.js 22.x (>=22.19), 24.x (>=24.11), or 26+;
- an operator-installed Ghidra 12.1.x distribution (verified with 12.1.4);
- a 64-bit full JDK inside that installation's declared Java range (JDK 21 or newer, with no maximum, for current 12.1 releases);
- an explicit native, non-managed x86 or x86-64 PE application/DLL, or a
- an explicit native, non-managed x86, x86-64, ARMNT (Thumb-2) or ARM64 PE application/DLL, or a
[raw NMOS 6502 image](raw-binary.md#nmos-6502) with a caller-supplied entry; and
- the 26 read-only Ghidra inventory, memory, and function-analysis operations.
@@ -135,9 +135,55 @@ and artifact SHA-256 before loading the package-owned addon. Native failure
reasons remain distinct from a valid installation and an unsupported target.
PE header classification and SHA-256 come from the same open file. The Windows
provider admits native x86 and x86-64 PE applications and DLLs and rejects unsupported roles,
provider admits native x86, x86-64, ARMNT (Thumb-2) and ARM64 PE applications and DLLs and rejects unsupported roles,
architectures, managed images, and malformed headers. The original selected
source coordinate is preserved for native admission.
source coordinate is preserved for native admission. The original COFF machine is
retained separately from the normalized CPU family. ARM admission requires the
observed ARMNT machine 0x01C4; ARM64 requires 0xAA64. Legacy ARM (0x01C0), Thumb
(0x01C2), and unavailable machine facts do not select this Windows lane.
Without a caller-selected processor override, Ghidra's PE loader
selects the language from the PE machine field: ARM (`IMAGE_FILE_MACHINE_ARMNT`)
imports as `ARM:LE:32:v8` (Thumb), ARM64 (`IMAGE_FILE_MACHINE_ARM64`) as
`AARCH64:LE:64:v8A`. Explicit language/compiler selections remain caller choices
in the analysis profile and are recorded as explicit imports. The source
fixture verifier compares the complete observed language ID, not just its CPU
family prefix. ARM/ARM64 admission is a bounded extension of the x86/x64
lane. `npm run verify:ghidra:windows -- --arm` or `-- --arm64`, optionally
combined with `--dll`, selects encoded Thumb or ARM64 PE fixtures on a Windows
x64 host. The packaged verifier accepts the same flags. These fixtures are not
compiler-produced programs. ARM64EC (machine 0xA641) and ARM64X are not admitted;
this target support does not establish Windows-on-Arm host support.
Real Windows x64 verification with Ghidra 12.1.4 and JDK 21 completed the ARM64
application and ARMNT/Thumb DLL fixtures' 26 read-only operations, constant-return
decompilation, byte searches, CLI/MCP file-offset parity, source identity, and
owned cleanup. The DLL fixture also verifies the exported caller/callee
relationship. The x86/x64 compact-reference value-flow battery does not cover
ARM or ARM64 instructions. ARM64 EXE file-offset verification includes ambiguous
mappings; the single-section ARM32 DLL cannot exercise that case.
The runs used two logical CPUs, 512 MiB Node/JVM heaps, a 900-second startup
budget, and an explicit `REA_GHIDRA_DISABLED_ANALYZERS=WindowsResourceReference`
test configuration. Default-analyzer runs exceeded the selected startup budget;
resource-reference analysis and default-configuration completion are not
established by these results. A Microsoft-signed Coreinfo ARM64 application also
completed focused MCP decompilation, repeated readback, source-mapped memory
reads, unchanged-input and cleanup checks. On this constrained host the first
function query, including cold analysis, took about 434 seconds; its identical
same-session read took about 23 ms and returned about 4.6 KiB of Evidence. These
are individual observations, not general latency guarantees. Public ARM32
DLL verification also completed against Microsoft Visual C++ 2013 ARM
`msvcr120.dll`, including decompilation of its exported `abs`, repeated readback,
source-mapped bytes, unchanged-input and cleanup checks. Its first function
query took about 601 seconds; the same-session repeat took about 11 ms and
returned about 4.8 KiB of Evidence. After preserving original COFF machines in the
admission/profile, a further real Windows check rejected legacy ARM/Thumb and
retained ARMNT/ARM64 admission. A rebuilt-candidate MSVCR120 query completed
in about 407 seconds with a 15 ms repeat (4,830 bytes of Evidence), unchanged
input and complete cleanup. That retry selected an 1,800-second startup budget
after an additional 900-second attempt timed out. The resource bounds were
unchanged; these observations do not establish a speedup. Configured processor
selection is covered by profile tests, not these real-provider runs.
Admission opens and checks every path component without following a reparse
point. It retains handles, verifies local NTFS semantics, and observes volume
@@ -200,6 +246,8 @@ npm run verify:ghidra:windows
npm run verify:ghidra:windows -- --x86
npm run verify:ghidra:windows -- --dll
npm run verify:ghidra:windows -- --x86 --dll
npm run verify:ghidra:windows -- --arm64
npm run verify:ghidra:windows -- --arm64 --dll
npm run verify:ghidra:windows:package -- --x86
npm run verify:ghidra:windows:package -- --dll
npm run verify:ghidra:windows:package -- --x86 --dll
+154
View File
@@ -0,0 +1,154 @@
# Atomic RE tools: an experiment
Experimental branch only: no PR, merge, production registration, or Code Mode.
Started from REA main `5b16f2431062eea6ffd245a9e05512790007cb13`.
Read [measured results](results.md) and [mechanism / prior-art notes](research.md).
The first round includes an object-reference counterexample and a failed
code-mapping composition; it does not claim every hypothesis succeeded.
The [control-flow / SSA follow-up](relations.md) repairs three zlib mapping
paths, tests a SQLite call guard, and records where structured slices cost more.
The question is whether composable facts improve **completed reverse-engineering
tasks**, especially on complex software. Three outcomes matter together:
1. Time, native work, CPU and process-family memory, including startup and retries.
2. Whole-task estimated tokens: catalog, arguments, results and necessary follow-up.
3. Correct answers with traceable evidence, meaningful coverage and explicit unknowns.
Smaller replies, fewer tool names and fewer calls are intermediate measurements,
not proof of a better investigation. Negative results are useful experiment results.
## Working definition
An atom is a coherent fact or relationship about an identified object, with its
producing evidence and uncertainty. It need not be a single field, MCP call,
instruction, native command or engine pass. A string's encoding and the status of
that encoding belong together; separating them can change the meaning.
Candidate reusable building blocks:
| Object / fact | Relationships and questions |
| ------------------------------------ | --------------------------------------------------------------------------------------- |
| Artifact and analysis context | Which bytes, architecture, address space and analysis profile produced this? |
| Location and byte span | What is mapped here? Where are the source bytes? Is the span initialized? |
| Instruction | What bytes decoded here, and with which mode and provenance? |
| Function | Which entry is identified? Which locations does the engine actually assign to its body? |
| String, symbol, type | What was observed or recovered, and what remains unknown? |
| Reference / call / control-flow edge | What are both endpoints, the reference site, kind and coverage? |
| Decompiled view | Which engine reconstruction and machine locations support this selected text? |
An inventory extent is an upper bound, not proof that an interior address belongs
to the preceding function. A reference to a string's start address is not proof
of a runtime string use, and misses references into its interior. Different
providers' recovered functions and types are not automatically the same entities.
Identity needs artifact digest + analysis profile + address space + object kind
and location/discriminator. A separate session lease controls whether a handle
is still usable. Identity, existence, lookup success and readiness are distinct.
## Hypotheses to try to falsify
- Fine-grained getters can lose to coherent fact batches through repeated
envelopes, schemas and round trips.
- A small workflow can be built from the same facts without maintaining a second
analysis implementation. Explicit selection must survive composition.
- Batching at MCP may reduce agent turns without saving any native analysis.
The engine's unit of work must be measured separately from the fact/read unit.
- Richer structured relations can improve investigation completeness more than
another wrapper around whole-function C text.
- On complex targets, a narrow result can omit the decisive evidence. Compare
coverage and final answers, counting all extra reads and failed paths.
## First prototype
`facts.mjs` consumes REA's existing normalized observations. It does not parse
assembly/C or guess ownership. The same methods support individual reads,
homogeneous batches, and one string-reference-function workflow. Native analysis,
target admission, caches, cancellation and full Evidence ownership stay in REA.
`server.mjs` adds experimental tools to the **complete** production MCP catalog.
It does not hide unrelated schemas to manufacture catalog savings. The additional
schemas are included in costs. Its operations are static reads; it never executes
the target or mutates an attached analysis database.
`benchmark.mjs` compares production calls, individual fact calls, batches and
composition using actual MCP clients and actual Kuna/Ghidra. Verification runs
are separate from timed equivalent-work runs. Each performance run repeats the
task in one session to distinguish first queries and warm native caches. Cold
Ghidra import/open cost must also be reported, not hidden in the query timer.
The prototype projects the current address-only `xrefs` contract. Reference kinds
stay unknown. Unsupported containing-function resolution stays unknown without
futile retries. This is intentionally a way to expose integration gaps rather
than claim that the adapter can recover information already discarded upstream.
Full Evidence is explicitly readable while its existing session owner retains
it; closing the binary expires those records. Paging covers the provider-returned
set and never establishes complete artifact discovery.
This is not a production contract proposal. Overlays, non-default address spaces,
typed edges, native batching and live agent decision quality need further work.
No measured claim about improved complex-program reasoning is established yet.
## Native experiments
After the build described below, with `REA_KUNA_COMMAND` configured:
```sh
mkdir -p .cache/atomic-re-tools
gcc -O2 -fno-pie -no-pie -o .cache/atomic-re-tools/interior-reference \
experiments/atomic-re-tools/interior-reference.c
# Run once for each variant: per-address, then inventory.
python3 experiments/analysis-efficiency/resource-run.py --observe-payload-exit -- \
node experiments/atomic-re-tools/native-relations.mjs \
.cache/atomic-re-tools/interior-reference HEAD:REA per-address \
.cache/atomic-re-tools/native-interior-per-address
python3 experiments/atomic-re-tools/verify-interior.py \
.cache/atomic-re-tools/interior-reference \
.cache/atomic-re-tools/native-interior-per-address.report.json \
.cache/atomic-re-tools/native-interior-inventory.report.json
```
Use the installed zlib/SQLite paths and `incorrect`/`malformed` to repeat the
native plan comparison. Append `--code-slice` to the per-address experiment for
an exact instruction-to-line probe. `mapped-code.mjs` rejects unsupported address
precision and never substitutes a nearby line for a missing mapping.
The experiment adds an opt-in typed reference projection at the existing Kuna
protocol owner. The existing public address-only result and its retained cache
shape remain the same; ordinary queries do not materialize the richer facts.
Experimental MCP tools have live-validated input schemas, but no canonical
output-schema/product-catalog integration. They are not a production SDK/API.
The v2 facade labels reference scope explicitly and connects **locations** in its
point-reference edges. A result's `target` preserves the caller's selector; it
is not a separate observation proving that an object exists at that address.
All experimental MCP results carry REA's canonical untrusted-target-content
marker. The v1 measurement table is retained with its revision label; it is not
relabelled as a measurement of this later response shape.
## Reproduce
Use the repository's pinned Node/npm and run `npm ci`, then
`npm run build:cached`. Supply existing installations through `REA_KUNA_COMMAND`,
`GHIDRA_INSTALL_DIR` and `JAVA_HOME`; this experiment installs no provider.
```sh
node --test experiments/atomic-re-tools/facts.test.mjs
# Existing bounded runner: one CPU, 4 GiB hard memory cap, early stop at 3 GiB.
# Its payload-exit counters include all processes in the owned scope.
python3 experiments/analysis-efficiency/resource-run.py --observe-payload-exit -- \
node experiments/atomic-re-tools/benchmark.mjs \
kuna batch /usr/lib/x86_64-linux-gnu/libz.so.1 incorrect \
.cache/atomic-re-tools/kuna-batch
```
Use `baseline`, `fine`, `batch`, or `workflow`, and `ghidra` or `kuna`.
Append `--verify` for additional lifecycle, paging, negative and Evidence checks;
those runs must not be used as equivalent-work performance samples. Binaries,
provider projects, captured catalogs/traffic and local measurements stay ignored
under `.cache/atomic-re-tools/`, never in commits. Summarize reproducible results
and limitations here as experiments finish.
+375
View File
@@ -0,0 +1,375 @@
import assert from "node:assert/strict";
import { mkdir, writeFile } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import Ajv2020 from "ajv/dist/2020.js";
import { requireMcpOperationResult } from "../../scripts/lib/mcp-verifier-results.mjs";
import {
createVerifierRun,
completeVerifierRun,
assertVerifierCleanupComplete,
} from "../../scripts/lib/verifier-run.mjs";
const [provider, variant, binary, pattern, prefix, verification] =
process.argv.slice(2);
assert.ok(["ghidra", "kuna"].includes(provider));
assert.ok(["baseline", "fine", "batch", "workflow"].includes(variant));
assert.ok(binary && pattern && prefix);
await mkdir(dirname(prefix), { recursive: true });
const verifier = createVerifierRun();
const client = new Client({ name: "rea-atomic-experiment", version: "0.1.0" });
const transport = new StdioClientTransport({
command: process.execPath,
args: [
resolve(
variant === "baseline"
? "dist/main.js"
: "experiments/atomic-re-tools/server.mjs",
),
],
env: {
...process.env,
REA_LOG_LEVEL: "error",
REA_MCP_OUTPUT_SCHEMA_PROFILE:
process.env.REA_MCP_OUTPUT_SCHEMA_PROFILE ?? "full",
REA_KUNA_CACHE_DIR: resolve(`${prefix}.kuna-cache`),
REA_KUNA_JOBS: "1",
GHIDRA_HEADLESS_MAXMEM: "1G",
REA_GHIDRA_STARTUP_TIMEOUT_MS: "120000",
},
stderr: "pipe",
});
let stderr = "";
transport.stderr?.on("data", (part) => {
stderr = (stderr + part).slice(-32_768);
});
const wire = [],
calls = [],
checks = [],
failures = [];
let phase = "lifecycle";
const call = async (name, arguments_ = {}, expectError = false) => {
const started = performance.now();
const response = await client.callTool(
{ name, arguments: arguments_ },
{ timeout: 180000 },
);
wire.push({ request: { name, arguments: arguments_ }, response, phase });
if (name.startsWith("experiment_"))
assert.equal(
response._meta?.provenance?.untrusted_content,
true,
"Experimental results lost the canonical target-content marker",
);
calls.push({ name, phase, elapsed_ms: performance.now() - started });
if (expectError) {
assert.equal(response.isError, true);
return JSON.parse(
response.content.find((part) => part.type === "text").text,
);
}
assert.notEqual(
response.isError,
true,
JSON.stringify(response).slice(0, 2000),
);
return name.startsWith("experiment_")
? JSON.parse(response.content.find((part) => part.type === "text").text)
: requireMcpOperationResult(response, name);
};
const contextInput = (context) => ({ ref: context.ref, lease: context.lease });
const stringLimit = 3,
referenceLimit = 4;
const query = { pattern, mode: "literal", case_sensitive: true };
const identity = (row) => ({
kind: "string",
address: row.address,
encoding: row.string?.encoding ?? null,
});
const readBatch = async (name, common, { key, items, individually }) => {
if (!individually) return call(name, { ...common, [key]: items });
const results = [];
for (const item of items)
results.push(...(await call(name, { ...common, [key]: [item] })).results);
return { results };
};
const readExperimentalTask = async (supportsOwners) => {
const input = { query, limit: stringLimit, fields: ["value"] };
if (variant === "workflow") {
const traced = await call("experiment_trace_string_uses", {
...input,
reference_limit: referenceLimit,
});
return {
found: traced.strings,
refs: traced.references,
owners: traced.functions,
};
}
const found = await call("experiment_find_strings", input);
const context = contextInput(found.context);
const refs = await readBatch(
"experiment_incoming_refs",
{ context, limit: referenceLimit },
{
key: "targets",
items: found.items.map((row) => row.id),
individually: variant === "fine",
},
);
const locations = [
...new Map(
refs.results
.flatMap((row) => row.items ?? [])
.map((row) => [row.from.address, row.from]),
).values(),
];
const owners = await readBatch(
"experiment_resolve_functions",
{ context },
{
key: "locations",
items: locations,
individually: variant === "fine" && supportsOwners,
},
);
return { found, refs, owners };
};
let catalog,
firstSourceId,
firstContext,
outcomes = [];
try {
await client.connect(transport);
catalog = await client.listTools();
const expectedOutputSchemas =
process.env.REA_MCP_OUTPUT_SCHEMA_PROFILE === "off"
? 0
: catalog.tools.filter((tool) => !tool.name.startsWith("experiment_"))
.length;
assert.equal(
catalog.tools.filter((tool) => Object.hasOwn(tool, "outputSchema")).length,
expectedOutputSchemas,
"Advertised output-schema profile differs from the requested profile",
);
const ajv = new Ajv2020({ strict: false, validateFormats: false });
for (const tool of catalog.tools.filter((tool) =>
tool.name.startsWith("experiment_"),
)) {
assert.equal(
ajv.validateSchema(tool.inputSchema),
true,
JSON.stringify(ajv.errors),
);
ajv.compile(tool.inputSchema);
}
await call("open_binary", { path: resolve(binary), provider_id: provider });
const status = await call("binary_session");
const supportsOwners = status.capabilities.some(
(row) => row.operation === "resolve_containing_procedure" && row.available,
);
for (phase of ["cold", "warm"]) {
const started = performance.now();
let strings, references, functions;
if (variant === "baseline") {
const all = await call("search_strings", query);
strings = all
.slice(0, stringLimit)
.map((row) => ({ id: identity(row), value: row.value }));
references = [];
for (const string of strings)
references.push({
target: string.id,
items: (await call("xrefs", { address: string.id.address })).slice(
0,
referenceLimit,
),
});
const locations = [...new Set(references.flatMap((row) => row.items))];
functions = [];
for (const address of locations)
functions.push(
supportsOwners
? {
address,
resolution: await call("resolve_containing_procedure", {
address,
}),
}
: { address, status: "unknown" },
);
} else {
const { found, refs, owners } =
await readExperimentalTask(supportsOwners);
assert.equal(found.status, "ok");
assert.ok(refs.results.every((row) => row.status === "ok"));
firstSourceId ??= found.evidence_id;
firstContext ??= found.context;
strings = found.items.map((row) => ({ id: row.id, value: row.value }));
references = refs.results.map((row) => ({
target: row.target,
items: row.items.map((edge) => edge.from.address),
}));
functions = owners.results.map((row) =>
row.status === "ok"
? { address: row.location.address, resolution: row.resolution }
: { address: row.location.address, status: "unknown" },
);
}
outcomes.push({
phase,
elapsed_ms: performance.now() - started,
strings,
references,
functions,
});
}
assert.deepEqual(outcomes[0].strings, outcomes[1].strings);
assert.deepEqual(outcomes[0].references, outcomes[1].references);
assert.deepEqual(outcomes[0].functions, outcomes[1].functions);
assert.ok(outcomes[0].strings.length > 0);
phase = "verification";
if (variant !== "baseline" && verification === "--verify") {
const raw = await call("experiment_read_evidence", {
evidence_id: firstSourceId,
});
assert.equal(raw.evidence.operation, "search_strings");
assert.equal(
raw.evidence.analysis_profile.digest,
firstContext.analysis_profile_digest,
);
assert.equal(
raw.evidence.subject.digest.sha256,
createHash("sha256")
.update(await readFile(binary))
.digest("hex"),
);
assert.deepEqual(
raw.evidence.normalized_result
.slice(0, stringLimit)
.map((row) => ({ id: identity(row), value: row.value })),
outcomes[0].strings,
);
const duplicate = await call("experiment_incoming_refs", {
context: contextInput(firstContext),
targets: [outcomes[0].strings[0].id, outcomes[0].strings[0].id],
limit: 1,
});
assert.deepEqual(duplicate.results[0], duplicate.results[1]);
const nextPage = await call("experiment_find_strings", {
query,
offset: stringLimit,
limit: stringLimit,
});
assert.deepEqual(
nextPage.items.map((row) => row.id),
raw.evidence.normalized_result
.slice(stringLimit, stringLimit * 2)
.map(identity),
);
const negative = await call("experiment_find_strings", {
query: { pattern: "\u0000REA-atomic-negative\u0000" },
});
assert.equal(negative.items.length, 0);
assert.equal(negative.coverage.status, "unknown");
const stale = await call(
"experiment_incoming_refs",
{
context: {
ref: "different-artifact-or-profile",
lease: firstContext.lease,
},
targets: [outcomes[0].strings[0].id],
},
true,
);
assert.equal(stale.status, "error");
await call("close_binary");
assert.equal(
(
await call(
"experiment_read_evidence",
{ evidence_id: firstSourceId },
true,
)
).error.code,
"not_found",
);
await call("open_binary", { path: resolve(binary), provider_id: provider });
const expired = await call(
"experiment_incoming_refs",
{
context: contextInput(firstContext),
targets: [outcomes[0].strings[0].id],
},
true,
);
assert.equal(expired.status, "error");
checks.push(
"retained-evidence",
"paging",
"duplicate-targets",
"negative-unknown",
"foreign-context",
"expired-lease",
);
}
} catch (error) {
failures.push(String(error.stack ?? error));
}
phase = "lifecycle";
try {
await call("close_binary");
} catch (error) {
failures.push(String(error));
}
await client.close().catch((error) => failures.push(String(error)));
await transport.close().catch((error) => failures.push(String(error)));
const lifecycle = await completeVerifierRun(verifier);
try {
assertVerifierCleanupComplete(lifecycle.process_lineage);
} catch (error) {
failures.push(String(error));
}
const report = {
provider,
variant,
binary: resolve(binary),
pattern,
node_version: process.versions.node,
target_sha256: createHash("sha256")
.update(await readFile(binary))
.digest("hex"),
string_limit: stringLimit,
reference_limit: referenceLimit,
outcomes,
calls,
checks,
failures,
verification_only: verification === "--verify",
lifecycle,
};
await writeFile(`${prefix}.wire.json`, JSON.stringify(wire));
await writeFile(`${prefix}.catalog.json`, JSON.stringify(catalog));
await writeFile(`${prefix}.report.json`, JSON.stringify(report, null, 2));
await writeFile(`${prefix}.stderr.txt`, stderr);
console.log(
JSON.stringify({
provider,
variant,
calls: calls.length,
outcomes: outcomes.map(({ strings, references, functions, ...rest }) => ({
...rest,
strings: strings.length,
references: references.flatMap((row) => row.items).length,
functions: functions.length,
})),
failures,
}),
);
assert.deepEqual(failures, []);
@@ -0,0 +1,140 @@
// Capture the existing public MCP function dossier, without changing its contract.
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import {
requireMcpOperationResult,
requireMcpToolError,
} from "../../scripts/lib/mcp-verifier-results.mjs";
import {
createVerifierRun,
completeVerifierRun,
assertVerifierCleanupComplete,
} from "../../scripts/lib/verifier-run.mjs";
const [provider, binary, procedure, prefix] = process.argv.slice(2);
assert.ok(
["ghidra", "kuna"].includes(provider) && binary && procedure && prefix,
);
await mkdir(dirname(prefix), { recursive: true });
const verifier = createVerifierRun();
const client = new Client({
name: "rea-relation-experiment",
version: "0.1.0",
});
const transport = new StdioClientTransport({
command: process.execPath,
args: [resolve("dist/main.js")],
env: {
...process.env,
REA_LOG_LEVEL: "error",
REA_MCP_OUTPUT_SCHEMA_PROFILE: "off",
GHIDRA_HEADLESS_MAXMEM: "1G",
REA_GHIDRA_STARTUP_TIMEOUT_MS: "120000",
REA_KUNA_CACHE_DIR: resolve(`${prefix}.kuna-cache`),
REA_KUNA_JOBS: "1",
},
stderr: "pipe",
});
let stderr = "";
transport.stderr?.on("data", (part) => {
stderr = (stderr + part).slice(-32_768);
});
const wire = [],
calls = [],
failures = [];
let catalog;
const call = async (name, arguments_ = {}, acceptRetained = false) => {
const start = performance.now();
const response = await client.callTool(
{ name, arguments: arguments_ },
{ timeout: 180000 },
);
wire.push({ request: { name, arguments: arguments_ }, response });
calls.push({ name, elapsed_ms: performance.now() - start });
if (response.isError === true && acceptRetained) {
const error = requireMcpToolError(response);
const source = error.details?.reported_limits?.evidence_reference;
assert.equal(error.code, "resource_constraint");
assert.equal(source?.kind, "retained-evidence");
await call("inspect_analysis_view", {
source,
view: { kind: "native", facet: "value_flow_summary" },
});
return { retained: source, initial_error: error };
}
assert.notEqual(
response.isError,
true,
JSON.stringify(response).slice(0, 1600),
);
return requireMcpOperationResult(response, name);
};
try {
await client.connect(transport);
catalog = await client.listTools();
assert.ok(
catalog.tools.every((tool) => !Object.hasOwn(tool, "outputSchema")),
);
await call("open_binary", { path: resolve(binary), provider_id: provider });
await call("binary_session");
for (const phase of ["first", "warm"]) {
const dossier = await call("analyze_function", { procedure }, true);
await writeFile(`${prefix}.${phase}.json`, JSON.stringify(dossier), {
flag: "wx",
});
}
await call("export_evidence_bundle", {
path: resolve(`${prefix}.bundle.json`),
});
} catch (error) {
failures.push(String(error.stack ?? error));
} finally {
try {
await call("close_binary");
} catch (error) {
failures.push(String(error));
}
await client.close().catch((error) => failures.push(String(error)));
await transport.close().catch((error) => failures.push(String(error)));
}
const lifecycle = await completeVerifierRun(verifier);
let cleanupVerified = false;
try {
assertVerifierCleanupComplete(lifecycle.process_lineage);
cleanupVerified = true;
} catch (error) {
failures.push(String(error));
}
await writeFile(`${prefix}.wire.json`, JSON.stringify(wire), { flag: "wx" });
await writeFile(`${prefix}.catalog.json`, JSON.stringify(catalog), {
flag: "wx",
});
await writeFile(`${prefix}.stderr.txt`, stderr, { flag: "wx" });
const report = {
provider,
binary: resolve(binary),
procedure,
target_sha256: createHash("sha256")
.update(await readFile(binary))
.digest("hex"),
node_version: process.versions.node,
calls,
failures,
lifecycle,
};
await writeFile(`${prefix}.report.json`, JSON.stringify(report, null, 2), {
flag: "wx",
});
console.log(
JSON.stringify({
provider,
calls,
failures,
cleanup_verified: cleanupVerified,
}),
);
if (failures.length) process.exitCode = 1;
@@ -0,0 +1,109 @@
// Native diagnostic probes; these text dumps are not a typed provider contract.
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { parseBinaryTarget } from "../../dist/application/BinaryTargetResolver.js";
import { inspectKunaInstallation } from "../../dist/kuna/KunaInstallation.js";
import { KunaTargetCommands } from "../../dist/kuna/KunaTargetCommands.js";
import { AnalysisError } from "../../dist/domain/analysisErrorBase.js";
import { projectAnalysisError } from "../../dist/domain/analysisErrorProjection.js";
import {
createVerifierRun,
completeVerifierRun,
assertVerifierCleanupComplete,
} from "../../scripts/lib/verifier-run.mjs";
const [binary, procedure, view, prefix] = process.argv.slice(2);
assert.ok(binary && /^0x[0-9a-f]+$/u.test(procedure) && prefix);
assert.ok(["raw", "regions", "assembly"].includes(view));
await mkdir(dirname(prefix), { recursive: true });
const verifier = createVerifierRun();
const lifetime = new AbortController();
const target = await parseBinaryTarget(binary);
assert.ok(target.ok);
const installed = await inspectKunaInstallation({
...process.env,
REA_KUNA_CACHE_DIR: resolve(`${prefix}.cache`),
});
assert.ok(installed.ok);
const commands = new KunaTargetCommands(target.value, {
signal: lifetime.signal,
});
const failures = [],
calls = [];
try {
const arguments_ = (input) =>
view === "assembly"
? ["disassemble", input, procedure, "--addr", "--json"]
: [
"decompile",
input,
procedure,
"--addr",
`--${view}`,
"--max-fn-memory",
"1024",
];
const start = performance.now();
const outcome = await commands.run({
installation: installed.value,
operation: "experiment:structure",
arguments: arguments_,
outputBytes: 16 * 1024 * 1024,
timeoutMs: 120000,
signal: lifetime.signal,
});
if (!outcome.ok) throw outcome.error;
const snapshot = outcome.value;
const file = `${prefix}.native.txt`;
await writeFile(file, snapshot.stdout.text, { flag: "wx" });
calls.push({
arguments: arguments_(snapshot.input),
elapsed_ms: performance.now() - start,
file,
bytes: Buffer.byteLength(snapshot.stdout.text),
sha256: createHash("sha256").update(snapshot.stdout.text).digest("hex"),
});
} catch (error) {
failures.push(
error instanceof AnalysisError
? projectAnalysisError(error)
: String(error.stack ?? error),
);
} finally {
lifetime.abort();
await commands.close();
}
const lifecycle = await completeVerifierRun(verifier);
let cleanupVerified = false;
try {
assertVerifierCleanupComplete(lifecycle.process_lineage);
cleanupVerified = true;
} catch (error) {
failures.push(String(error));
}
const report = {
binary: resolve(binary),
procedure,
view,
calls,
failures,
lifecycle,
engine: { version: installed.value.version, sha256: installed.value.sha256 },
target_sha256: createHash("sha256")
.update(await readFile(binary))
.digest("hex"),
};
await writeFile(`${prefix}.report.json`, JSON.stringify(report, null, 2), {
flag: "wx",
});
console.log(
JSON.stringify({
view,
calls,
failures,
cleanup_verified: cleanupVerified,
}),
);
if (failures.length) process.exitCode = 1;
+210
View File
@@ -0,0 +1,210 @@
// Experimental application layer. Provider parsing and native caches remain in REA.
import { createHash } from "node:crypto";
export const contextFor = (artifactSha, profile, lease) => {
const identity = {
artifact_sha256: artifactSha,
analysis_profile_digest: profile.digest,
address_space: "provider-default",
};
return {
ref: createHash("sha256").update(JSON.stringify(identity)).digest("hex"),
...identity,
provider: profile.provider,
lease,
};
};
const failure = (code, message) => ({
status: "error",
error: { code, message },
});
const source = (evidence) => ({
evidence_id: evidence.evidence_id,
confidence: evidence.confidence,
limitations: evidence.limitations,
});
const pageOf = (items, offset, limit) => ({
items: items.slice(offset, offset + limit),
selection: {
matched: items.length,
offset,
returned: Math.max(0, Math.min(limit, items.length - offset)),
next_offset: offset + limit < items.length ? offset + limit : null,
},
});
/** One fact can be read alone or in a batch; a batch is not a new fact kind. */
export class FactQueries {
constructor(port) {
this.port = port;
}
async findStrings({ query, offset = 0, limit = 20, fields = ["value"] }) {
const observed = await this.port.observe("search_strings", query);
if (!observed.ok) return { status: "error", error: observed.error };
const evidence = observed.value;
const all = evidence.normalized_result;
const page = pageOf(all, offset, limit);
return {
status: "ok",
context: this.port.context(),
...source(evidence),
selection: page.selection,
// Paging is complete over this provider's answer, not all artifact strings.
coverage: {
status: "unknown",
reason:
"Provider inventory is not proof of every string in the artifact.",
},
items: page.items.map((row) => ({
id: {
kind: "string",
address: row.address,
encoding: row.string?.encoding ?? null,
},
...Object.fromEntries(
fields
.filter((key) => Object.hasOwn(row, key))
.map((key) => [key, row[key]]),
),
})),
};
}
validContext(context) {
const current = this.port.context();
return context.ref === current.ref && context.lease === current.lease;
}
async incomingReferences({ context, targets, offset = 0, limit = 20 }) {
if (!this.validContext(context))
return failure(
"invalid_request",
"Fact context or session lease is stale; find facts again on the selected target.",
);
// Share duplicate targets within this batch. Native/session cache ownership
// remains with the provider; this layer adds no long-lived result cache.
const observations = new Map();
const results = [];
for (const target of targets) {
let observed = observations.get(target.address);
if (observed === undefined) {
observed = await this.port.observe("xrefs", {
address: target.address,
});
observations.set(target.address, observed);
}
if (!observed.ok) {
results.push({ target, status: "error", error: observed.error });
continue;
}
const evidence = observed.value;
const page = pageOf(evidence.normalized_result, offset, limit);
results.push({
target,
status: "ok",
scope: { kind: "exact-address", address: target.address },
...source(evidence),
selection: page.selection,
coverage: {
status: "unknown",
reason:
"The existing xrefs contract does not carry reference completeness.",
},
items: page.items.map((address) => ({
from: { kind: "location", address },
to: { kind: "location", address: target.address },
kind: "unknown",
kind_reason: "The existing xrefs contract projects addresses only.",
})),
});
}
return {
status: results.every((row) => row.status === "ok") ? "ok" : "partial",
context: this.port.context(),
results,
};
}
async resolveFunctions({ context, locations }) {
if (!this.validContext(context))
return failure(
"invalid_request",
"Fact context or session lease is stale; find facts again on the selected target.",
);
if (!this.port.supports("resolve_containing_procedure"))
return {
status: locations.length === 0 ? "ok" : "partial",
context: this.port.context(),
results: locations.map((location) => ({
location,
status: "unknown",
error: {
code: "unsupported",
message:
"The selected provider does not advertise containing-procedure resolution.",
},
})),
};
const observations = new Map();
const results = [];
for (const location of locations) {
let observed = observations.get(location.address);
if (observed === undefined) {
observed = await this.port.observe("resolve_containing_procedure", {
address: location.address,
});
observations.set(location.address, observed);
}
results.push(
observed.ok
? {
location,
status: "ok",
...source(observed.value),
// Preserve the owner's complete tagged found/negative outcome.
resolution: observed.value.normalized_result,
}
: { location, status: "unknown", error: observed.error },
);
}
return {
status: results.every((row) => row.status === "ok") ? "ok" : "partial",
context: this.port.context(),
results,
};
}
async traceStringUses(input) {
const strings = await this.findStrings(input);
if (strings.status !== "ok") return strings;
const references = await this.incomingReferences({
context: strings.context,
targets: strings.items.map((row) => row.id),
offset: 0,
limit: input.reference_limit ?? 20,
});
if (references.status === "error") return references;
const locations = [
...new Map(
references.results
.flatMap((row) => row.items ?? [])
.map((row) => [row.from.address, row.from]),
).values(),
];
const functions =
input.include_functions === false
? null
: await this.resolveFunctions({ context: strings.context, locations });
return {
status:
references.status === "partial" || functions?.status === "partial"
? "partial"
: "ok",
strings,
references,
functions,
};
}
}
+160
View File
@@ -0,0 +1,160 @@
import assert from "node:assert/strict";
import test from "node:test";
import { FactQueries, contextFor } from "./facts.mjs";
const profile = {
digest: "p1",
provider: { id: "test", name: "Test", version: "1" },
};
const context = contextFor("artifact-a", profile, "lease-1");
const evidence = (normalized_result) => ({
evidence_id: "ev:test",
confidence: "derived",
limitations: ["fixture coverage only"],
normalized_result,
});
const port = (observe, extra = {}) => ({
context: () => context,
supports: () => true,
observe,
...extra,
});
const string = {
kind: "string",
address: "0x20000000000001",
encoding: "utf8",
};
test("artifact, profile and lease boundaries reject joins before invoking analysis", async () => {
let calls = 0;
const facts = new FactQueries(
port(async () => {
calls++;
throw new Error("must not run");
}),
);
for (const foreign of [
contextFor("artifact-b", profile, "lease-1"),
contextFor("artifact-a", { ...profile, digest: "p2" }, "lease-1"),
contextFor("artifact-a", profile, "lease-2"),
]) {
assert.equal(
(await facts.incomingReferences({ context: foreign, targets: [string] }))
.status,
"error",
);
assert.equal(
(await facts.resolveFunctions({ context: foreign, locations: [] }))
.status,
"error",
);
}
assert.equal(calls, 0);
assert.equal(contextFor("artifact-a", profile, "lease-2").ref, context.ref);
});
test("partial batches retain good observations and exact failure reasons", async () => {
const cancelled = {
code: "cancelled",
message: "caller cancelled",
details: { stage: "native" },
};
const facts = new FactQueries(
port(async (_, parameters) =>
parameters.address === "0xbad"
? { ok: false, error: cancelled }
: { ok: true, value: evidence(["0x20000000000002"]) },
),
);
const result = await facts.incomingReferences({
context,
targets: [string, { ...string, address: "0xbad" }],
});
assert.equal(result.status, "partial");
assert.equal(result.results[0].items[0].from.address, "0x20000000000002");
assert.equal(result.results[0].items[0].kind, "unknown");
assert.deepEqual(result.results[1].error, cancelled);
assert.equal(result.results[0].coverage.status, "unknown");
});
test("duplicate point lookups share work without turning selectors into observed objects", async () => {
let calls = 0;
const facts = new FactQueries(
port(async () => {
calls++;
return { ok: true, value: evidence(["0x20"]) };
}),
);
const otherEncoding = { ...string, encoding: "utf16le" };
const result = await facts.incomingReferences({
context,
targets: [string, otherEncoding, string],
});
assert.equal(calls, 1);
assert.deepEqual(
result.results.map((row) => row.target),
[string, otherEncoding, string],
);
assert.deepEqual(
result.results.map((row) => row.items[0].to),
Array(3).fill({ kind: "location", address: string.address }),
);
assert.equal(result.results[0].scope.kind, "exact-address");
});
test("paging and field selection retain identities, source and unknown coverage", async () => {
const rows = [
{
address: string.address,
value: "😀 marker",
string: {
encoding: "utf8",
encoding_status: "observed",
byte_length: 12,
},
},
{ address: "0x20000000000002", value: "other" },
];
const facts = new FactQueries(
port(async () => ({ ok: true, value: evidence(rows) })),
);
const page = await facts.findStrings({
query: { pattern: "" },
limit: 1,
fields: ["string"],
});
assert.deepEqual(page.items, [{ id: string, string: rows[0].string }]);
assert.equal(page.selection.next_offset, 1);
assert.equal(page.evidence_id, "ev:test");
assert.equal(page.coverage.status, "unknown");
const beyond = await facts.findStrings({
query: { pattern: "" },
offset: 99,
limit: 1,
});
assert.equal(beyond.selection.matched, 2);
assert.equal(beyond.selection.returned, 0);
assert.equal(beyond.coverage.status, "unknown");
});
test("unsupported function resolution remains unknown without futile native calls", async () => {
const facts = new FactQueries(
port(
async () => {
throw new Error("unsupported capability must not run");
},
{ supports: () => false },
),
);
const result = await facts.resolveFunctions({
context,
locations: [{ kind: "location", address: "0x12" }],
});
assert.equal(result.status, "partial");
assert.equal(result.results[0].status, "unknown");
assert.equal(result.results[0].error.code, "unsupported");
assert.equal(
(await facts.resolveFunctions({ context, locations: [] })).status,
"ok",
);
});
@@ -0,0 +1,12 @@
/* Static fixture: compile and inspect, never execute. The only reference into
* this string lands after its first byte. Point xrefs and object uses differ. */
static const char marker[] = "HEAD:REA atomic interior-only marker";
__attribute__((noinline)) const char *give_suffix(void) {
return marker + 5;
}
int main(int argc, char **argv) {
(void)argv;
return (unsigned char)*give_suffix() == (unsigned char)argc;
}
+300
View File
@@ -0,0 +1,300 @@
// Decoder for the pinned 1.833 print_raw format, not a production Kuna API.
// Relations come from native SSA annotations, never from reconstructed C text.
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
const pc = "0x[0-9a-f]{1,16}";
const seq = `${pc}:[0-9a-f]{1,16}`;
const operationLine = new RegExp(`^(${seq}):\\s+(.+)$`, "u");
const blockLine = new RegExp(`^Basic Block (\\d+) (${pc})-(${pc})$`, "u");
const definitionToken = new RegExp(`\\((${seq})\\)`, "gu");
const constantToken = /#(0x[0-9a-f]{1,16})(?::(\d+))?(?![0-9a-f])/gu;
const destination = `Block_(\\d+):(${pc})`;
const conditional = new RegExp(
`^goto ${destination} if (.+) else ${destination}$`,
"u",
);
const direct = new RegExp(`^goto ${destination}$`, "u");
const implied = new RegExp(`^(${pc}):\\s+\\[ goto ${destination} \\]$`, "u");
const address = (value) => `0x${BigInt(value).toString(16)}`;
const operationId = (value) => {
const [location, time] = value.split(":");
return `${address(location)}:${BigInt(`0x${time}`).toString(16)}`;
};
const indexInto = (index, key, row) => {
if (!index.has(key)) index.set(key, []);
index.get(key).push(row);
};
const ordinal = (value) => {
const n = Number(value);
assert.ok(Number.isSafeInteger(n) && n >= 0);
return n;
};
const freeze = (value) => {
if (value && typeof value === "object" && !Object.isFrozen(value)) {
Object.freeze(value);
for (const child of Object.values(value)) freeze(child);
}
return value;
};
const validateDefinitions = (operations, issues) => {
for (const row of operations.values()) {
for (const relation of row.definitions) {
if (!operations.has(relation.definition))
issues.push({
source_line: row.source_line,
reason: `Missing definition ${relation.definition}`,
});
}
}
};
const parseOperation = (match, blockId, sourceLine) => {
const id = operationId(match[1]);
const statement = match[2];
const split = statement.indexOf(" = ");
const lhs = split < 0 ? "" : statement.slice(0, split);
const rhs = split < 0 ? statement : statement.slice(split + 3);
const kind = lhs.startsWith("*(")
? "store"
: rhs.startsWith("*(")
? "load"
: rhs.startsWith("call ")
? "call"
: statement.startsWith("goto ")
? "branch"
: statement.startsWith("switch ")
? "switch"
: statement.startsWith("return(")
? "return"
: rhs.includes(" ? ")
? "phi"
: "value";
// STORE's address is an input. An ordinary assignment's LHS is its output.
const inputText = kind === "store" ? statement : rhs;
const definitions = [...inputText.matchAll(definitionToken)].map(
(token, occurrence) => ({
definition: operationId(token[1]),
use: id,
occurrence,
// This is printed-varnode order, NOT a p-code input_index or phi predecessor.
}),
);
const literals = [...inputText.matchAll(constantToken)].map((token) => ({
value: address(token[1]),
printed_size_bytes: token[2] === undefined ? null : ordinal(token[2]),
}));
const row = {
id,
address: id.split(":")[0],
block: blockId,
kind,
statement,
definitions,
constants: literals,
source_line: sourceLine,
};
return row;
};
const controlEdges = (row) => {
const { statement } = row;
const edges = [];
const branch = conditional.exec(statement);
const jump = direct.exec(statement);
if (branch) {
for (const [target, targetAddress, polarity] of [
[branch[1], branch[2], "true"],
[branch[4], branch[5], "false"],
]) {
edges.push({
from: row.block,
to: ordinal(target),
target_address: address(targetAddress),
kind: "conditional",
polarity,
predicate: branch[3],
operation: row.id,
source_line: row.source_line,
});
}
} else if (jump) {
edges.push({
from: row.block,
to: ordinal(jump[1]),
target_address: address(jump[2]),
kind: "direct",
operation: row.id,
source_line: row.source_line,
});
}
return edges;
};
const graphStart = (lines) => {
const first = lines.findIndex(
(line, i) => line.startsWith("Basic Block 0 ") && lines[i - 1] === "0",
);
assert.ok(first >= 0, "Missing native SSA block graph header");
return first;
};
export const parseKunaSsaDump = (text) => {
assert.ok(
Buffer.byteLength(text) <= 16 * 1024 * 1024,
"SSA dump exceeds capture budget",
);
const lines = text.split("\n");
// The CLI places C before the root block graph header. Ignore that C entirely.
const first = graphStart(lines);
const operations = new Map(),
blocks = new Map(),
constants = new Map();
const users = new Map(),
incoming = new Map(),
edges = [],
issues = [];
let block;
for (let i = first; i < lines.length; i++) {
const line = lines[i];
const header = blockLine.exec(line);
if (header) {
const id = ordinal(header[1]);
assert.ok(!blocks.has(id), "Duplicate block identity");
// Stop is the last instruction's address, NOT an exclusive byte bound.
block = {
id,
start: address(header[2]),
stop_instruction: address(header[3]),
operations: [],
source_line: i + 1,
};
blocks.set(id, block);
continue;
}
if (!line.trim()) continue;
const fallthrough = implied.exec(line);
if (fallthrough) {
edges.push({
from: block.id,
to: ordinal(fallthrough[2]),
target_address: address(fallthrough[3]),
kind: "printed-implied-goto",
operation: null,
source_line: i + 1,
});
continue;
}
const match = operationLine.exec(line);
if (!match) {
issues.push({
source_line: i + 1,
reason: "Unrecognized native dump line",
});
continue;
}
const row = parseOperation(match, block.id, i + 1);
assert.ok(!operations.has(row.id), "Duplicate operation identity");
operations.set(row.id, row);
block.operations.push(row.id);
for (const literal of new Set(row.constants.map((c) => c.value)))
indexInto(constants, literal, row.id);
for (const edge of row.definitions) indexInto(users, edge.definition, edge);
edges.push(...controlEdges(row));
}
validateDefinitions(operations, issues);
for (const edge of edges) {
assert.equal(
blocks.get(edge.to)?.start,
edge.target_address,
"Branch target identity mismatch",
);
indexInto(incoming, edge.to, edge);
}
const outgoing = new Set(edges.map((edge) => edge.from));
const unrepresented = [...blocks.values()]
.filter((b) => {
const tail = operations.get(b.operations.at(-1));
return tail?.kind !== "return" && !outgoing.has(b.id);
})
.map((b) => b.id);
const digest = createHash("sha256").update(text).digest("hex");
for (const table of [operations, blocks, constants, users, incoming])
for (const value of table.values()) freeze(value);
return freeze({
identity: { kind: "native-ssa-snapshot", sha256: digest },
coverage: {
scope: "printed-SSA",
operations: operations.size,
blocks: blocks.size,
explicit_control_edges: edges.length,
unrepresented_outgoing_blocks: unrepresented,
issues,
control_flow: "partial",
machine_semantic_equivalence: "unknown",
},
// The owner parses/indexes once; all compositions reuse the same facts.
operation: (id) => operations.get(id) ?? null,
block: (id) => blocks.get(id) ?? null,
findConstant: (value) => [...(constants.get(address(value)) ?? [])],
uses: (id) => users.get(id) ?? [],
incoming: (id) => incoming.get(id) ?? [],
});
};
// Dependency-closed only within the caller's selected budget and boundaries.
export const backwardSlice = (
snapshot,
seeds,
{ maxOperations = 48, stopAt = [], stopKinds = ["phi", "load"] } = {},
) => {
assert.ok(Number.isSafeInteger(maxOperations) && maxOperations > 0);
const stopped = new Set(stopAt),
kinds = new Set(stopKinds);
const queue = [...new Set(seeds)],
queued = new Set(queue),
seen = new Set(),
selected = [],
boundaries = [],
missing = [];
for (let cursor = 0; cursor < queue.length; cursor++) {
const id = queue[cursor];
if (seen.has(id)) continue;
seen.add(id);
const row = snapshot.operation(id);
if (!row) {
missing.push(id);
continue;
}
if (selected.length >= maxOperations) {
boundaries.push({ id, reason: "operation-budget" });
continue;
}
selected.push(row);
if (stopped.has(id) || kinds.has(row.kind)) {
boundaries.push({
id,
reason: stopped.has(id) ? "caller-selected" : row.kind,
});
} else
for (const edge of row.definitions) {
if (!queued.has(edge.definition)) {
queue.push(edge.definition);
queued.add(edge.definition);
}
}
}
return {
operations: selected,
coverage: {
status:
boundaries.length || missing.length || snapshot.coverage.issues.length
? "partial"
: "complete-for-printed-definitions",
boundaries,
missing,
source_issues: snapshot.coverage.issues.length,
runtime_reachability: "unknown",
memory_alias_dependencies: "unknown",
},
};
};
@@ -0,0 +1,120 @@
import assert from "node:assert/strict";
import test from "node:test";
import { backwardSlice, parseKunaSsaDump } from "./kuna-ssa.mjs";
import { queryLiteralUses } from "./query-ssa.mjs";
// Minimal native print_raw syntax, including a STORE pointer on its LHS.
const dump = `ignored C text
0
Basic Block 0 0x100-0x106
0x100:1: r0(0x100:1) = #0xffffffffffffffff
0x102:2: u0(0x102:2) = r0(0x100:1) != #0x0
0x106:3: goto Block_1:0x110 if (u0(0x102:2) != 0) else Block_2:0x120
Basic Block 1 0x110-0x114
0x110:4: u1(0x110:4) = ->(RDI(i),#0x30)
0x112:5: *(ram,u1(0x110:4)) = r0(0x100:1)
0x114:6: return(#0x0)
Basic Block 2 0x120-0x120
0x120:7: switch r0(0x100:1)
`;
test("SSA definitions preserve STORE address dependencies, exact u64 and conditional polarity", () => {
const snapshot = parseKunaSsaDump(dump);
assert.deepEqual(snapshot.findConstant("0xffffffffffffffff"), ["0x100:1"]);
assert.deepEqual(
snapshot.operation("0x112:5").definitions.map((e) => e.definition),
["0x110:4", "0x100:1"],
);
assert.equal(snapshot.operation("0x100:1").definitions.length, 0);
assert.deepEqual(
snapshot.incoming(1).map((e) => [e.from, e.polarity]),
[[0, "true"]],
);
assert.deepEqual(
snapshot.incoming(2).map((e) => [e.from, e.polarity]),
[[0, "false"]],
);
assert.deepEqual(snapshot.coverage.unrepresented_outgoing_blocks, [2]);
assert.equal(snapshot.coverage.control_flow, "partial");
});
test("a bounded slice names budget frontiers; graph cycles terminate", () => {
const snapshot = parseKunaSsaDump(dump);
const result = backwardSlice(snapshot, ["0x112:5"], { maxOperations: 1 });
assert.equal(result.operations.length, 1);
assert.equal(result.coverage.boundaries.length, 2);
assert.equal(result.coverage.status, "partial");
const cyclic = parseKunaSsaDump(
dump.replace("#0xffffffffffffffff", "r0(0x100:1)"),
);
assert.equal(backwardSlice(cyclic, ["0x100:1"]).operations.length, 1);
});
test("snapshot identity changes with source; malformed and missing facts cannot look complete", () => {
assert.notEqual(
parseKunaSsaDump(dump).identity.sha256,
parseKunaSsaDump(dump + "unknown native line\n").identity.sha256,
);
assert.equal(
parseKunaSsaDump(dump + "unknown native line\n").coverage.issues.length,
1,
);
assert.throws(
() => parseKunaSsaDump(dump.replace("Block_1:0x110", "Block_1:0x111")),
/identity mismatch/u,
);
assert.throws(
() => parseKunaSsaDump(dump.replace("0x112:5:", "0x100:1:")),
/Duplicate operation/u,
);
const missing = parseKunaSsaDump(
dump.replace("r0(0x100:1) !=", "r0(0xff:9) !="),
);
assert.equal(missing.coverage.issues.length, 1);
assert.deepEqual(backwardSlice(missing, ["0x102:2"]).coverage.missing, [
"0xff:9",
]);
});
test("phi/load cutoffs preserve boundary rows and do not invent memory or predecessor bindings", () => {
const snapshot = parseKunaSsaDump(
dump.replace("r0(0x100:1) != #0x0", "r0(0x100:1) ? r0(0x100:1)"),
);
const result = backwardSlice(snapshot, ["0x102:2"]);
assert.deepEqual(result.coverage.boundaries, [
{ id: "0x102:2", reason: "phi" },
]);
assert.equal(result.operations.length, 1);
assert.equal(result.operations[0].definitions.length, 2);
assert.equal(result.coverage.memory_alias_dependencies, "unknown");
});
test("cloned blocks share starts; operation identity includes sequence, and facts stay immutable", () => {
const snapshot = parseKunaSsaDump(dump.replaceAll("0x120", "0x110"));
assert.equal(snapshot.block(1).start, snapshot.block(2).start);
assert.notEqual(snapshot.block(1).id, snapshot.block(2).id);
assert.throws(() => {
snapshot.operation("0x100:1").kind = "store";
}, TypeError);
assert.throws(() => snapshot.uses("0x100:1").pop(), TypeError);
const query = queryLiteralUses(snapshot, "0xffffffffffffffff");
assert.deepEqual(query.constant_operations, ["0x100:1"]);
assert.ok(query.direct_uses.includes("0x112:5"));
assert.equal(query.coverage.control_flow, "partial");
});
test("a literal directly in STORE is itself an effect seed; shared block edges are returned once", () => {
const snapshot = parseKunaSsaDump(
dump.replace(
"*(ram,u1(0x110:4)) = r0(0x100:1)",
"*(ram,u1(0x110:4)) = #0x20",
),
);
const query = queryLiteralUses(snapshot, "0x20");
assert.deepEqual(query.effect_seed_operations, ["0x112:5"]);
assert.deepEqual(
query.control_edges.map((e) => e.operation),
["0x106:3"],
);
assert.ok(query.operations.some((row) => row.id === "0x102:2"));
});
+121
View File
@@ -0,0 +1,121 @@
// A view over native printer-to-instruction mappings, never a C-text parser.
import assert from "node:assert/strict";
import { z } from "zod";
const mapping = z.object({
line_number: z.number().int().positive(),
addresses: z.array(z.number().nonnegative()),
});
const documentSchema = z.object({
binary: z.string(),
count: z.number().int().nonnegative(),
functions: z.array(
z.object({
address_hex: z.string(),
address: z.number().nonnegative(),
code: z.string().nullable(),
error: z.string().nullable(),
line_mappings: z.array(mapping).optional(),
}),
),
});
export const mappedCode = async (native, reference, contextLines = 16) => {
if (reference.functions.length !== 1 || !Array.isArray(reference.sites))
return {
status: "unknown",
reason:
"A unique native owning function and exact reference sites are required.",
};
const entry = reference.functions[0].address;
const snapshot = await native((input) => [
"decompile",
input,
entry,
"--addr",
"--json",
"--max-fn-memory",
"1024",
]);
const document = documentSchema.parse(JSON.parse(snapshot.stdout.text));
assert.equal(document.binary, snapshot.input);
assert.equal(document.count, document.functions.length);
const candidates = document.functions.filter(
(row) => row.address_hex === entry,
);
const fn = candidates.length === 1 ? candidates[0] : undefined;
if (fn === undefined || fn.code === null || fn.line_mappings === undefined)
return {
status: "unknown",
reason:
"Native decompilation did not supply a body with instruction-to-line mappings.",
native_error: fn?.error ?? null,
};
// This low-VMA experiment rejects unsafe numeric arrays, rather than rounding
// u64 addresses. General u64 array support would need the owning JSON parser.
if (
!Number.isSafeInteger(fn.address) ||
`0x${fn.address.toString(16)}` !== entry ||
fn.line_mappings.some((row) =>
row.addresses.some((value) => !Number.isSafeInteger(value)),
)
)
return {
status: "unknown",
reason:
"Instruction mapping contains an address outside this prototype's exact safe-integer coverage.",
};
const sites = new Set(reference.sites.map((row) => row.from));
const hits = fn.line_mappings.filter((row) =>
row.addresses.some((value) => sites.has(`0x${value.toString(16)}`)),
);
const mappedSites = new Set(
hits.flatMap((row) =>
row.addresses.map((value) => `0x${value.toString(16)}`),
),
);
const unmappedSites = [...sites].filter((site) => !mappedSites.has(site));
const lines = fn.code.split("\n");
for (const hit of hits) assert.ok(hit.line_number <= lines.length);
if (!hits.length)
return {
status: "unknown",
reason:
"No exact reference site maps to an emitted line; nearest-line guessing is disabled.",
};
const ranges = hits.map((hit) => ({
start_line: Math.max(1, hit.line_number - contextLines),
end_line: Math.min(lines.length, hit.line_number + contextLines),
}));
const slices = [];
for (const range of ranges.sort((a, b) => a.start_line - b.start_line)) {
const previous = slices.at(-1);
if (previous !== undefined && range.start_line <= previous.end_line + 1)
previous.end_line = Math.max(previous.end_line, range.end_line);
else slices.push({ ...range });
}
return {
status: unmappedSites.length || fn.error !== null ? "partial" : "ok",
native_error: fn.error,
entry,
reference_sites: [...sites],
unmapped_reference_sites: unmappedSites,
exact_mapped_lines: hits.map((row) => row.line_number),
total_lines: lines.length,
total_characters: fn.code.length,
slices: slices.map((range) => ({
...range,
text: lines.slice(range.start_line - 1, range.end_line).join("\n"),
})),
coverage: {
status: "partial",
reason:
"Selected text around exact mapped sites; not a proof that every relevant guard or data dependency is included.",
},
limitations: [
"Single-function engine reconstruction, not original source.",
"Printer line mappings are derived and do not prove runtime reachability.",
"Complete native body and mappings remain in the retained source document.",
],
};
};
@@ -0,0 +1,56 @@
import assert from "node:assert/strict";
import test from "node:test";
import { mappedCode } from "./mapped-code.mjs";
const reference = {
functions: [{ address: "0x1000" }],
sites: [{ from: "0x2000" }, { from: "0x2001" }],
};
const document = () => ({
binary: "/private/input",
count: 1,
functions: [
{
address: 4096,
address_hex: "0x1000",
code: "one\ntwo\nthree\nfour\nfive",
error: null,
line_mappings: [{ line_number: 3, addresses: [8192] }],
},
],
});
const native = (value) => async () => ({
input: "/private/input",
stdout: { text: JSON.stringify(value) },
});
test("a mapped subset names unmapped sites instead of implying complete mapping", async () => {
const result = await mappedCode(native(document()), reference, 1);
assert.equal(result.status, "partial");
assert.deepEqual(result.unmapped_reference_sites, ["0x2001"]);
assert.deepEqual(result.slices, [
{ start_line: 2, end_line: 4, text: "two\nthree\nfour" },
]);
assert.equal(result.coverage.status, "partial");
});
test("unmapped locations never select a nearby printed line", async () => {
const result = await mappedCode(native(document()), {
...reference,
sites: [{ from: "0x1fff" }],
});
assert.equal(result.status, "unknown");
});
test("unsafe numeric address arrays stay unknown without lossy conversion", async () => {
const value = document();
value.functions[0].line_mappings[0].addresses = [Number.MAX_SAFE_INTEGER + 1];
const result = await mappedCode(native(value), reference);
assert.equal(result.status, "unknown");
});
test("malformed line locations reject the view before publishing fragments", async () => {
const value = document();
value.functions[0].line_mappings[0].line_number = 99;
await assert.rejects(mappedCode(native(value), reference));
});
@@ -0,0 +1,274 @@
// Native-boundary experiment, not MCP and not a production provider extension.
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { mkdir, writeFile } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { z } from "zod";
import { AnalysisError } from "../../dist/domain/analysisErrorBase.js";
import { projectAnalysisError } from "../../dist/domain/analysisErrorProjection.js";
import { mappedCode } from "./mapped-code.mjs";
import { parseBinaryTarget } from "../../dist/application/BinaryTargetResolver.js";
import { inspectKunaInstallation } from "../../dist/kuna/KunaInstallation.js";
import { KunaTargetCommands } from "../../dist/kuna/KunaTargetCommands.js";
import { parseKunaJson } from "../../dist/kuna/KunaJson.js";
import { parseKunaStringInventory } from "../../dist/kuna/KunaStringInventory.js";
import { parseKunaIncomingReferenceFacts } from "../../dist/kuna/KunaReferenceFiles.js";
import {
createVerifierRun,
completeVerifierRun,
assertVerifierCleanupComplete,
} from "../../scripts/lib/verifier-run.mjs";
const [binary, pattern, variant, prefix, codeOption] = process.argv.slice(2);
assert.ok(binary && pattern && prefix);
assert.ok(["per-address", "inventory"].includes(variant));
await mkdir(dirname(prefix), { recursive: true });
const verifier = createVerifierRun();
const lifetime = new AbortController();
const parsed = await parseBinaryTarget(binary);
assert.ok(parsed.ok);
const installed = await inspectKunaInstallation({
...process.env,
REA_KUNA_CACHE_DIR: resolve(`${prefix}.cache`),
});
assert.ok(installed.ok);
const commands = new KunaTargetCommands(parsed.value, {
signal: lifetime.signal,
});
const address = z.string().regex(/^0x(?:0|[1-9a-f][0-9a-f]{0,15})$/u);
const functionSchema = z.object({
name: z.string(),
address,
address_hex: address,
});
const relatedRow = z.object({
address,
address_hex: address,
text: z.string(),
length: z.number().int().nonnegative(),
encoding: z.string(),
byte_length: z.number().int().nonnegative(),
nul_terminated: z.boolean(),
xrefs_count: z.number().int().nonnegative(),
functions: z.array(functionSchema),
});
const sourceKeys = new Set(["address", "from_address", "to_address"]);
const limit = 16 * 1024 * 1024;
const calls = [],
failures = [];
let facts;
const native = async (arguments_) => {
const start = performance.now();
const outcome = await commands.run({
installation: installed.value,
operation: "experiment:native-relations",
arguments: arguments_,
outputBytes: limit,
timeoutMs: 120000,
signal: lifetime.signal,
});
if (!outcome.ok) throw outcome.error;
const snapshot = outcome.value;
const file = `${prefix}.native-${calls.length}.json`;
await writeFile(file, snapshot.stdout.text);
calls.push({
elapsed_ms: performance.now() - start,
file,
arguments: arguments_(snapshot.input),
sha256: createHash("sha256").update(snapshot.stdout.text).digest("hex"),
bytes: Buffer.byteLength(snapshot.stdout.text),
});
return snapshot;
};
try {
// Common producer: validate all string facts once through the existing owner.
const scan = await native((input) => [
"strings",
input,
"--json",
"--encoding",
"all",
"--min-length",
"5",
"--termination",
"any",
"--no-xrefs",
]);
const inventory = parseKunaStringInventory(scan.stdout.text, scan.input);
assert.ok(inventory.ok, inventory.error);
const selected = inventory.value.items
.filter((row) => row.value.includes(pattern))
.slice(0, 3);
assert.ok(selected.length > 0);
const results = [];
if (variant === "per-address") {
for (const item of selected) {
const result = await native((input) => [
"xrefs",
input,
"--to",
item.address,
"--json",
]);
// Consume the owning parser's facts, without reinterpreting raw JSON.
const validated = parseKunaIncomingReferenceFacts(
result.stdout.text,
result.input,
item.address,
);
assert.ok(validated.ok, validated.error);
const rows = validated.value.facts;
const functions = [
...new Map(
rows
.flatMap((row) =>
row.fromFunction === null ? [] : [row.fromFunction],
)
.map((fn) => [fn.address, fn]),
).values(),
];
results.push({
string: item,
scope: "exact-start-address",
xrefs_count: rows.length,
functions,
sites: rows.map((row) => ({
from: row.from,
to: row.to,
kind: row.kind,
instruction: row.instruction,
})),
source: calls.at(-1),
});
}
} else {
const result = await native((input) => [
"strings",
input,
"--json",
"--encoding",
"all",
"--min-length",
"5",
"--termination",
"any",
]);
const document = parseKunaJson(result.stdout.text, limit, sourceKeys);
assert.equal(document.binary, result.input);
assert.equal(document.xrefs, true);
assert.equal(document.encoding, "all");
assert.equal(document.min_length, 5);
assert.equal(document.termination, "any");
assert.equal(document.filter, null);
assert.equal(document.section, null);
assert.equal(document.scanned, inventory.value.scanned);
assert.equal(document.count, document.strings.length);
assert.equal(document.count, inventory.value.items.length);
const known = new Map(
inventory.value.items.map((row) => [
`${row.address}|${row.string.encoding}`,
row,
]),
);
const examined = new Map();
for (const value of document.strings) {
const row = relatedRow.parse(value);
assert.equal(row.address, row.address_hex);
const key = `${row.address}|${row.encoding}`;
assert.ok(!examined.has(key));
const expected = known.get(key);
assert.ok(expected);
assert.equal(row.text, expected.value);
assert.equal(row.length, [...expected.value].length);
assert.equal(row.byte_length, expected.string.byte_length);
assert.equal(
row.nul_terminated,
expected.string.termination === "present_or_not_required",
);
const entries = new Set();
for (const fn of row.functions) {
assert.equal(fn.address, fn.address_hex);
assert.ok(!entries.has(fn.address));
entries.add(fn.address);
}
assert.ok(row.functions.length <= row.xrefs_count);
examined.set(key, row);
}
for (const item of selected) {
const row = examined.get(`${item.address}|${item.string.encoding}`);
results.push({
string: item,
scope: "any-byte-in-string-extent",
xrefs_count: row.xrefs_count,
functions: row.functions,
sites: {
status: "unknown",
reason:
"Native string attribution does not return reference sites or kinds.",
},
source: calls.at(-1),
});
}
}
const code =
codeOption === "--code-slice" ? await mappedCode(native, results[0]) : null;
facts = {
artifact_sha256: parsed.value.sha256,
engine: {
version: installed.value.version,
sha256: installed.value.sha256,
},
inventory_count: inventory.value.items.length,
selected_count: selected.length,
results,
mapped_code: code === null ? null : { ...code, source: calls.at(-1) },
limitations: [
"These are native derived static references, not runtime uses.",
"The per-address and inventory scopes differ; their timings do not establish equivalent-query speedup.",
"An empty function set can mean unowned references, not that a string is unused.",
"Complete native source documents are retained locally by file and SHA-256; this is not an MCP token measurement.",
],
};
} catch (error) {
failures.push(
error instanceof AnalysisError
? projectAnalysisError(error)
: { message: String(error), stack: error.stack ?? null },
);
}
lifetime.abort();
const closed = await commands.close();
if (!closed.ok) failures.push(String(closed.error));
const lifecycle = await completeVerifierRun(verifier);
try {
assertVerifierCleanupComplete(lifecycle.process_lineage);
} catch (error) {
failures.push(String(error));
}
await writeFile(
`${prefix}.report.json`,
JSON.stringify(
{
variant,
binary: resolve(binary),
pattern,
calls,
facts,
failures,
lifecycle,
},
null,
2,
),
);
console.log(
JSON.stringify({
variant,
native_commands: calls.length,
native_ms: calls.reduce((sum, row) => sum + row.elapsed_ms, 0),
selected: facts?.selected_count,
owners: facts?.results.map((row) => row.functions.length),
failures,
}),
);
assert.deepEqual(failures, []);
+168
View File
@@ -0,0 +1,168 @@
// A composition over one validated, immutable snapshot; no new engine work.
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile, writeFile } from "node:fs/promises";
import { pathToFileURL } from "node:url";
import { backwardSlice, parseKunaSsaDump } from "./kuna-ssa.mjs";
import { assertVerifierCleanupComplete } from "../../scripts/lib/verifier-run.mjs";
export const queryLiteralUses = (snapshot, literal, maxOperations = 48) => {
const allSeeds = snapshot.findConstant(literal);
const seeds = allSeeds.slice(0, 16);
const effectSeeds = seeds.filter((id) =>
["store", "call"].includes(snapshot.operation(id).kind),
);
const allUses = [
...new Set([
...effectSeeds,
...seeds.flatMap((id) => snapshot.uses(id).map((e) => e.use)),
]),
];
const selectedUses = allUses.slice(0, 16);
const consumers = selectedUses.map((id) => snapshot.operation(id));
const controlEdges = [
...new Map(
consumers
.flatMap((row) => snapshot.incoming(row.block))
.map((edge) => [
JSON.stringify([edge.from, edge.to, edge.operation, edge.polarity]),
edge,
]),
).values(),
];
const branchIds = [
...new Set(
controlEdges.flatMap((edge) =>
edge.operation === null ? [] : [edge.operation],
),
),
];
const guards = backwardSlice(snapshot, branchIds, { maxOperations });
const facts = [
...new Map(
[
...seeds.map((id) => snapshot.operation(id)),
...consumers,
...guards.operations,
].map((row) => [row.id, row]),
).values(),
];
const selected = new Set(facts.map((row) => row.id));
return {
literal,
snapshot: snapshot.identity,
constant_operations: seeds,
effect_seed_operations: effectSeeds,
direct_uses: selectedUses,
control_edges: controlEdges,
operations: facts,
coverage: {
status: "partial",
seed_matches: allSeeds.length,
omitted_seed_matches: allSeeds.length - seeds.length,
omitted_direct_uses: allUses.length - selectedUses.length,
dependencies: guards.coverage,
unexpanded_definition_ids: [
...new Set(
facts.flatMap((row) =>
row.definitions
.filter((edge) => !selected.has(edge.definition))
.map((edge) => edge.definition),
),
),
],
control_flow: snapshot.coverage.control_flow,
unrepresented_outgoing_blocks:
snapshot.coverage.unrepresented_outgoing_blocks.length,
source_issues: snapshot.coverage.issues.length,
scope:
"literal equality, effect seeds and direct printed uses, their explicit incoming edges and bounded branch definitions",
address_object_identity: "unknown",
call_argument_bindings: "unknown",
},
};
};
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
const main = async () => {
const [prefix, values, output] = process.argv.slice(2);
assert.ok(prefix && values && output);
const literals = values.split(",");
assert.ok(
literals.length <= 16 &&
literals.every((s) => /^0x[0-9a-f]{1,16}$/u.test(s)),
);
const report = JSON.parse(await readFile(`${prefix}.report.json`, "utf8"));
assert.equal(report.view, "raw");
assert.deepEqual(report.failures, []);
assert.equal(report.calls.length, 1);
assert.equal(
report.engine.version,
"1.833",
"Decoder is pinned to the inspected printer format",
);
assertVerifierCleanupComplete(report.lifecycle.process_lineage);
const source = report.calls[0];
const raw = await readFile(source.file, "utf8");
assert.equal(sha256(raw), source.sha256);
assert.equal(Buffer.byteLength(raw), source.bytes);
assert.equal(
sha256(await readFile(report.binary)),
report.target_sha256,
"Artifact changed since capture",
);
const start = performance.now();
const snapshot = parseKunaSsaDump(raw);
const parseIndexMs = performance.now() - start;
const runs = [];
for (const phase of ["first-projection", "reused-index"]) {
const before = performance.now();
const answers = literals.map((literal) =>
queryLiteralUses(snapshot, literal),
);
const serialized = JSON.stringify(answers);
runs.push({
phase,
query_and_serialization_ms: performance.now() - before,
answers,
serialized_bytes: Buffer.byteLength(serialized),
});
}
assert.deepEqual(runs[0].answers, runs[1].answers);
await writeFile(
output,
JSON.stringify(
{
source: {
artifact_sha256: report.target_sha256,
engine: report.engine,
procedure: report.procedure,
capture_report: `${prefix}.report.json`,
raw: source,
profile:
"one-function native decompile defaults + --raw; no annotations",
},
parse_index_ms: parseIndexMs,
coverage: snapshot.coverage,
runs,
lifetime:
"One local process; validated immutable snapshot reused without native analysis. No cross-session cache.",
},
null,
2,
),
{ flag: "wx" },
);
console.log(
JSON.stringify({
output,
parse_index_ms: parseIndexMs,
runs: runs.map(({ answers, ...timing }) => ({
...timing,
selected_operations: answers.map((a) => a.operations.length),
})),
}),
);
};
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
await main();
+239
View File
@@ -0,0 +1,239 @@
# Control-flow and definition/use experiment
This continues the first-round experiment on the same REA source baseline and
Kuna 1.833. It is an exploratory native-boundary decoder, not a production
provider capability or a new MCP catalog. No PR or merge is intended.
The analyst questions are which local conditions lead to zlib's
`incorrect header check` assignment and SQLite's
`malformed MATCH expression: [%s]` error-formatting call. Runtime reachability,
memory aliasing, phi predecessor bindings and complete entry-state conditions
remain unknown. These are not controlled agent trials.
`capture-function.mjs` records the existing public MCP function dossier. It
preserves transport-budget failures and follows retained Evidence for a value-flow
summary, then exports the complete local Evidence bundle before closing.
`capture-kuna-structure.mjs` uses REA's existing target/process owners to capture
the native `--raw`, `--regions` or disassembly output. All target inspection is
static. The engine and artifact digests, command arguments, raw digest and cleanup
proof are retained locally.
`kuna-ssa.mjs` owns the decoder for the inspected 1.833 SSA diagnostic format.
It indexes explicit definition annotations, literal values, block membership and
printed branch destinations once. Immutable rows carry native source lines;
operation and block IDs are local to the content-digested snapshot. A block's
printed stop is an instruction address, not an exclusive extent. Blocks can share
start addresses. Unknown lines, omitted outgoing relationships, missing definitions
and traversal boundaries remain explicit. Printed operand occurrences do not
claim p-code input indexes or phi-to-predecessor bindings.
`query-ssa.mjs` composes literal equality, direct uses, incoming explicit edges
and bounded backward definitions. It validates the retained capture against its
digest and the current artifact before indexing. It retains complete native
evidence; its local cache lives for one process. Default phi/load boundaries avoid
expanding the whole program state. Selection limits report omissions.
Use the pinned Node from `.nvmrc`, an existing build and caller-supplied Kuna:
```sh
node --test experiments/atomic-re-tools/kuna-ssa.test.mjs
python3 experiments/analysis-efficiency/resource-run.py --observe-payload-exit -- \
node experiments/atomic-re-tools/capture-kuna-structure.mjs \
/usr/lib/x86_64-linux-gnu/libz.so.1 0xc1e0 raw .cache/atomic-re-tools/relations-zlib
python3 experiments/analysis-efficiency/resource-run.py --observe-payload-exit -- \
node experiments/atomic-re-tools/query-ssa.mjs .cache/atomic-re-tools/relations-zlib \
0x18fc4 .cache/atomic-re-tools/relations-zlib-query.json
```
The addresses above apply only to the exact zlib artifact in [results](results.md).
Do not reuse them across provider load spaces or binary versions. Complete
measurement and validation notes follow below.
## Observed results
The same artifact and engine digests as [round one](results.md) apply. This is
the existing experiment, not a newly rebased feature branch: newer REA main
`42fc6c53ae188978deb3bedfe88287b6b316ba22` was fetched for inspection, but these
runs retain baseline `5b16f2431062eea6ffd245a9e05512790007cb13` and Kuna 1.833.
The source decoder was checked against Kuna's pinned
[SSA renderer](https://github.com/Noelo-Lab/kuna/blob/fe01d6294eb0d1053ce343c8943646df88e143fc/decompiler/crates/kuna-decomp/src/substrate/funcdata_printraw.rs).
No newer Kuna version was tested.
1. **SSA value origins repair all three failed zlib mappings.** The original
string xrefs are LEAs whose addresses do not appear in printer mappings.
Literal equality in optimized SSA finds a pointer-valued operation; its
explicit def-use points to a STORE at a different instruction origin. Those
origins do appear in the retained JSON line mappings:
| String address | Original LEA | STORE origin | Exact emitted line |
| -------------- | ------------ | ------------ | -----------------: |
| `0x18fc4` | `0xded7` | `0xdee6` | 164 |
| `0x19003` | `0xdc6a` | `0xdc74` | 551 |
| `0x19018` | `0xcd05` | `0xcd0f` | 653 |
The independently captured raw-mode C and JSON-mode C are byte-equal after
removing outer whitespace. The verifier checks both retained source digests,
artifact and engine equality before joining instruction origins. This is
corroboration between two captures, not proof of a shared internal IR revision.
A production interface should export these relationships together.
2. **Control and def-use answer a bounded local question.** For the header error,
the result contains 21 operations: the literal origin, STORE and 19 branch
dependencies. Two explicit incoming edges enter block 446. They correspond
to a missing low wrap bit and a failed divisibility check on the constructed
header value. The branch definitions stop at a memory load and a phi node.
Original machine instructions independently show `test $1` / `je` and the
reciprocal-division sequence / `jne` into the error block. The verifier
exhaustively checks all 65,536 ordinary 16-bit header values against both
the captured arithmetic sequence and modulo 31. No target code is executed.
This agrees with [zlib 1.2.13 source](https://github.com/madler/zlib/blob/v1.2.13/inflate.c#L633)
and [RFC 1950](https://www.rfc-editor.org/rfc/rfc1950.html#section-2.2).
It does not establish all entry-state preconditions or primed bit-buffer states.
3. **The same composition finds a SQLite call guard.** For the first malformed
MATCH string at `0x11dcd8`, five selected operations connect the literal to
`sqlite3Fts3ErrMsg` and the observed condition `EBX == 1`. The original bytes
have `cmp $1,%ebx` and `je` to the formatting path; the corresponding
[3.40.1 source](https://github.com/sqlite/sqlite/blob/version-3.40.1/ext/fts3/fts3_expr.c#L1057)
uses `rc == SQLITE_ERROR`, whose [code is 1](https://www.sqlite.org/rescode.html#error).
The slice stops at the return-code phi: it does not explain why a particular
input caused the parser error. Source-version agreement is corroboration,
not proof of an exact Debian source/build match.
4. **Addresses do not identify IR blocks.** SQLite blocks 20 and 22 both start at
`0x6523e`, yet have distinct identities and paths. Several operations also
share instruction origins. Do not use a block's printed address span as its
membership set, or pair phi inputs with CFG predecessors by printed order.
5. **Retained paging cannot recover producer omissions.** Ghidra `inflate` by
name is ambiguous between PLT and body. Its exact body is `0x10c1e0`, in a
different load space from Kuna's `0xc1e0`. The complete MCP dossier exceeded
the 10 MiB transport budget. The server correctly retained Evidence and
supplied continuation arguments; summary reads and local bundle export worked.
However, high p-code was already truncated to 3,000 operations, with 239 known
omitted edges and at least one omitted operation. The late error literal is
outside that prefix. Its absence remains **unknown**. Raising the response
limit or paging the retained prefix would not repair this missing coverage.
Kuna's raw dump contains 3,860 operations / 472 blocks for `inflate`, and
253 operations / 23 blocks for the SQLite function. All printed definition IDs
resolved in these captures. Nevertheless, 63 / 1 blocks respectively have
unrepresented outgoing relationships. In particular, the diagnostic format does
not enumerate switch successors or every layout fallthrough. Incoming edges are
local observations, not a complete control-dependence or feasible-path proof.
`--regions` exposes structuring output; it did not provide the missing typed CFG.
## Cost and limits of the comparison
The estimates below use tiktoken 0.14.0 / `o200k_base`, not bytes-to-token ratios.
Full C is native text; the selected answer is JSON including source identity,
raw-Evidence access, facts and unknown coverage. No hypothetical MCP wrapper is
counted. These are **representation costs**, not equivalent completed agent tasks.
| Target / question | Full C tokens | Full raw C + SSA tokens | Selected answer tokens |
| ------------------ | ------------: | ----------------------: | ---------------------: |
| zlib header error | 17,726 | 254,265 | 3,270 |
| SQLite MATCH error | 931 | 14,928 | 1,283 |
The three zlib answers together cost 5,485 tokens with one shared source envelope.
The SQLite counterexample matters: a small function is cheaper as complete C than
as this structured slice. A successful atomic API does not force tiny getters or
graph output for every question. A C window around zlib line 164, on the other
hand, still misses the earlier guard at lines 122–124; locating a line alone did
not complete the local explanation.
| Stage | Elapsed s | Family CPU s | Peak family MiB |
| ---------------------------------------------------------- | --------: | -----------: | --------------: |
| zlib native raw, first capture | 6.965 | 6.608 | 208.1 |
| zlib native raw, fresh repeat | 18.749 | 13.462 | 195.9 |
| SQLite native raw | 2.738 | 2.557 | 172.5 |
| zlib validation, index and two projections | 0.423 | 0.227 | 43.7 |
| SQLite validation, index and two projections | 0.322 | 0.095 | 24.9 |
| Ghidra exact selection, retained summary / bundle workflow | 49.170 | 48.536 | 1,466.6 |
The fresh zlib captures have identical raw digests, but different elapsed/CPU
costs; the cause is unisolated. These samples establish neither native-analysis
acceleration nor a cross-provider speed ranking. OS caches were not flushed.
The Ghidra row includes first/warm requests and lifecycle, and is not equivalent
to the one-command native rows. Its analyst question remained unfinished.
Within the final projection runs, parse/index took 130.20 ms / 7.96 ms for
zlib / SQLite. First query plus serialization took 1.10 ms / 0.64 ms; repeat
queries on the same immutable index took 0.29 ms / 0.09 ms. Native analysis did
not run during either projection. This is a useful reuse mechanism, not a claim
that the original native decompilation becomes that fast.
All resource observations use the existing one-CPU, 4 GiB hard limit, 3 GiB early
stop and 192-task owner. Peak memory is the kernel cgroup `memory.peak` for the
whole process family, **including charged file cache**, not RSS. Every captured
run had verified payload-exit cleanup and zero OOM kills. The complete 12-run
ledger includes the ambiguous-name failure, the transport failure, the region
probe, superseded projections and automated verification: 178.051 s wall and
168.094 s family CPU in total. Manual investigation, old discovery/xrefs, objdump,
tokenization and development checks are outside that ledger.
The actual Ghidra retained workflow used the existing complete input-only catalog:
206,954 estimated catalog tokens plus 39,620 captured request/response tokens,
including failures, lifecycle and export. Exported bundle contents stayed local.
These costs do not count as a successful solution or as comparable Kuna savings.
No model reasoning tokens, answer-quality score, controlled agent A/B trial or
end-to-end agent latency was measured.
## What to explore next
The useful candidate is a shared analysis snapshot with typed facts and relations,
then bounded question-specific projections. Stable identity must include artifact,
load space, profile and snapshot; value definitions and block membership need
native identities in addition to instruction origins. Complete control dependence
requires a CFG with coverage; alias effects and phi predecessor bindings need
explicit producer support.
The nearest existing surfaces are `trace_native_values` for analysis and native
facets of `inspect_analysis_view` for retained reads. Retained views should remain
read-only: new analysis belongs to the analysis owner. Seeded selection must happen
before Ghidra's producer limit. Kuna should ideally export a structured IR/CFG
subset from the native owner instead of making this diagnostic-text decoder a
production protocol. Do not add a separate MCP tool for each getter or a custom
query language on the basis of these two functions.
Complex-software superiority is still unproven. The next discriminating question
is why an input reaches a selected error: that needs phi predecessor bindings and
control dependencies beyond these local slices, with a completed-task comparison
against the ordinary C workflow. Keep the small-SQLite counterexample in that
evaluation rather than optimizing only the large-function case.
## Verification and retained evidence
Six distinct SSA module tests plus the existing nine fact/mapping tests passed.
Real static captures, exact mapping replay for three errors, bounded SQLite
composition, 65,536 arithmetic cases, original instruction checks and Ghidra
retained-Evidence recovery passed. The Ghidra late-literal query did not have
sufficient producer coverage. Formatter, targeted lint, syntax and whitespace
checks ran; no production runtime source was changed in this round.
Locally retained evidence is under `.cache/atomic-re-tools/`, including
`relations-*.{report.json,log}`, `relations-*-raw*.native.txt`, the exported Ghidra
bundle, `relations-*-query-v2.json`, `relations-verification-v2.json` and
`relations-summary-v2.json`. Raw captures are not committed. Their SHA-256 values:
- zlib raw: `b1d6bc61755041d2934e4ab173aca4e5fdf40f5bda01ca404458a163b129681b`.
- SQLite raw: `8a945a1549b855802958bd4d33f37b9aaf00781aa57059fe25cb740244a1cdde`.
- zlib JSON body/mappings: `21631d31b4b93aa75c200be71a71ffe9f4b209982a9c329a2120d9f7c7509ea3`.
After producing captures with the prefixes used in the scripts, replay and count:
```sh
node experiments/atomic-re-tools/verify-relations.mjs \
.cache/atomic-re-tools .cache/atomic-re-tools/relations-verification-v2.json
python experiments/atomic-re-tools/summarize-relations.py \
.cache/atomic-re-tools .cache/atomic-re-tools/relations-summary-v2.json
```
The second command requires tiktoken. The checked-in verifier intentionally binds
to these exact artifacts and oracle addresses; it is not a generic correctness
test for arbitrary zlib/SQLite versions. Capture Ghidra with
`capture-function.mjs ghidra <zlib-path> 0x10c1e0 <prefix>`, and SQLite with
`capture-kuna-structure.mjs <sqlite-path> 0x65180 raw <prefix>`. Caller-supplied
engine paths and the existing resource wrapper are required as in round one.
Capture prefixes and output paths must be fresh; exclusive writes preserve any
existing evidence or caller-owned file.
+112
View File
@@ -0,0 +1,112 @@
# What might count as an RE atom?
This is an experiment record, not a claim that a new universal instruction set
has been discovered. APIs already expose many relevant primitives. The open
question here is how to make their evidence, cost and composition useful to an
agent investigating a real program.
## Existing mechanisms and what they establish
- Ghidra has a program database, `ReferenceManager.getReferencesTo`, function-body
ownership through `FunctionManager.getFunctionContaining`, listing objects and
decompiler IR. Fine-grained **engine APIs already exist**. A poor MCP projection
can still discard their metadata or require excessive round trips.
Sources: [ReferenceManager](https://ghidra.re/ghidra_docs/api/ghidra/program/model/symbol/ReferenceManager.html),
[FunctionManager](https://ghidra.re/ghidra_docs/api/ghidra/program/model/listing/FunctionManager.html).
- Binary Ninja distinguishes code/data, type and variable references, including
IL-level references. This shows why one undifferentiated `xref` is insufficient
for some questions. It does not establish that an MCP interface using these
APIs will be token-efficient or that another provider can reproduce the facts.
Sources: [type/variable references](https://binary.ninja/2021/04/12/type-and-variable-xrefs.html),
[BinaryView API](https://dev-api.binary.ninja/binaryninja.binaryview-module.html).
- Kuna's Rust engine and SLEIGH compiler derive from Ghidra, while its standalone
loader/analyzer tier and CLI are separate components. Port lineage does not
imply identical observations or a shared live program database.
Source: [NOTICE](https://github.com/Noelo-Lab/kuna/blob/fe01d6294eb0d1053ce343c8943646df88e143fc/NOTICE).
- In **tested Kuna 1.833**, an `xrefs` command loads a program and builds an
`XrefIndex` for its query. A different CLI invocation does that again.
`strings` with attribution instead loads/indexes once and joins references over
each string's byte extent. That is already internal composition, even though
the CLI does not expose an arbitrary persistent query interface.
Sources: [xref producer](https://github.com/Noelo-Lab/kuna/blob/fe01d6294eb0d1053ce343c8943646df88e143fc/decompiler/crates/kuna-cli/src/xrefs.rs),
[string attribution](https://github.com/Noelo-Lab/kuna/blob/fe01d6294eb0d1053ce343c8943646df88e143fc/decompiler/crates/kuna-cli/src/strings.rs).
These are source-derived observations. They are not measurements of current
upstream main, a guarantee of decompilation correctness, or a novelty claim.
## Granularity has at least three independent dimensions
| Dimension | Example | Consequence |
| -------------- | ------------------------------------------------------ | --------------------------------------------------------------------- |
| Fact unit | One typed reference with both endpoints and provenance | Can be retained and joined without reading unrelated C text |
| Transport unit | A batch of references for several selectors | Amortizes headers and agent turns; need not change native work |
| Compute unit | One image load and reference walk | Can serve many fact queries; may cost much more than one returned row |
Calling all three "atomic tools" hides the main optimization opportunity. A tiny
getter can repeat a whole-program analysis. Conversely, one expensive shared
analysis can provide precise, small, independently addressable facts.
## Candidate semantic core
1. **Identified objects and located observations**: artifact, image/address-space,
byte span, decoded instruction, symbol, string candidate, recovered function,
variable and type. Keep width, encoding, storage and confidence where needed
to interpret a value. A recovered object is an analysis claim, not necessarily
a source-language object that existed before compilation.
2. **Relations and constraints**: maps-to, owns/contains, references, calls,
flows-to, defines/uses, argument binding, type/storage association and branch
guard. Keep source and destination, reference site, kind, supporting evidence
and unknown/partial coverage. Do not collapse a call site into just a callee.
3. **Evidence views**: retain the original observations and expose the requested
fields, range or neighborhood. A readable decompilation is an important view;
it does not replace a machine-grounded relation or prove original source.
Useful query operations resemble selection, projection, traversal, join and
aggregation. This is a design vocabulary, **not a proposal to add a SQL/graph
language or Code Mode**. Start with named, typed analyst questions; add more
general execution only if repeated real workflows demonstrate the need.
## Composition rules that prevent false conclusions
- Entity identity and an observation's identity differ. Artifact/profile/location
can identify a function candidate; `evidence_id` identifies one exact claim
about it. Keep disagreeing claims instead of deduplicating them by address.
- A session lease prevents using a handle after close/reopen. It is not a frozen
analysis revision. In particular, Kuna's whole-project and early single-function
reconstructions can differ under the same selected profile. Target admission
prevents a target switch; it does not establish a consistent analysis snapshot.
- A string spans bytes. A point-address xref and a reference anywhere inside that
object answer different questions. A data-pointer reference is not automatically
a runtime call, string consumption, or a reachable execution path.
- Omission, an unsupported operation, cancellation, an unowned reference and an
examined empty set are different outcomes. No empty set proves global absence
unless the producing analysis actually establishes that coverage.
- Field selection must not detach a value from the metadata that makes it
meaningful. For example, the first prototype keeps REA's complete `string`
metadata record as one selectable field, including its encoding status.
- Expensive producer work should be shared with explicit identity, lifetime,
invalidation and cancellation ownership. A client-side batch is insufficient
evidence that native work was shared.
## What complex-program effectiveness would require
Navigation is only the first tier. Finding a string and its users is weaker than
explaining why a branch rejects input or how data reaches a privileged operation.
The next tier needs definition/use, call-argument and memory-flow relationships,
with explicit analysis assumptions. The existing prototypes do **not** supply
those relationships, and slicing C text cannot manufacture them.
For every harder trial, specify the analyst question, independent answer/evidence
oracle, input artifact/profile, initial knowledge and allowed budget. Compare:
- whether the actual question was answered correctly;
- decisive evidence recovered and relevant evidence omitted;
- remaining unknowns and unsafe conclusions;
- all calls, follow-up reads, failures, latency, CPU, family memory and estimated
token traffic, including tool discovery and retained Evidence reads.
Source inspection can establish architectural opportunities. Scripted equivalent
workflows can establish transport and engine costs. Neither alone establishes
that a live agent reasons better on complex software; a controlled agent trial
is a separate validation step. Likewise, byte/token reductions alone do not
establish improved correctness or analyst productivity.
+216
View File
@@ -0,0 +1,216 @@
# First-round results
Continued in the [control-flow / SSA experiment](relations.md). The results below
remain the fixed first-round baseline, including its failed mapping composition.
This is a completed, bounded first round of exploration, including failures.
It does **not** establish that an agent solves complex RE tasks better than with
the existing tools. No PR, merge, target execution or executable mutation occurred;
Ghidra used its normal ephemeral analysis databases.
## Inputs and measurement
- REA base: `5b16f2431062eea6ffd245a9e05512790007cb13`; experiment commits retain
the runnable code and tests. Node 24.18.0 / npm 11.16.0.
- Kuna 1.833, executable SHA-256
`d858918b0766435cd96b999a77f2d5a31a0cc4f07256421c883b5b9dc4dd58e4`.
These results do not verify newer Kuna releases.
- Ghidra 12.1.4, Temurin JDK 21.0.12.1+1, Java heap 1 GiB.
- Installed zlib: `/usr/lib/x86_64-linux-gnu/libz.so.1.2.13`, SHA-256
`7e2a72b4c4b38c61e6962de6e3f4a5e9ae692e732c68deead10a7ce2135a7f68`.
- Installed SQLite: `/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6`, SHA-256
`2e6eef9a727f081f0d453b4e5e6cbd8b9ef8b6f86cbf7681cbad444d3b0b55c8`.
- Real-provider jobs used the existing scope runner: one CPU, affinity to one
allowed core, 4 GiB hard memory limit, early stop at 3 GiB. They ran serially.
Build/type/test gates used separate bounded scopes, up to two CPUs / 4 GiB.
- CPU is complete owned-cgroup CPU at payload exit. Memory is kernel
`memory.peak` for the process family, **including charged file cache**, not RSS.
The observer verified cleanup and resource counters while its scope was alive.
- Tokens below are **offline `o200k_base` estimates**, tiktoken 0.14.0, over actual
captured MCP payloads, including text and structured copies. They are not
model-billed tokens. Model reasoning, tool selection, host rendering, cache
billing and JSON-RPC framing were not measured.
- Each table row is **one sample**, not a median or controlled causal estimate.
OS caches were not flushed. Startup and native work varied substantially on
this shared host. No universal latency improvement is established.
## Experiment 1: transport granularity
Task: case-sensitive literal search (`incorrect` in zlib, `malformed` in SQLite),
select the first three provider-ordered string candidates, read at most four
exact-start reference sites per candidate, then resolve their containing
functions when advertised. Repeat in the same session to measure warm reads.
Unsupported Kuna function resolution remains unknown, rather than guessed.
The four variants use the same application/provider observations. Native query
planning was unchanged. `fine` reads individual facts; `batch` groups homogeneous
reads; `workflow` composes those same fact methods in one call.
These captures measure the **v1 fact response shape**, introduced at `fa8d6a7a2`.
Later selector/scope and transport-provenance clarifications are not retroactive
performance measurements; rerun the harness to measure their current payload.
| Provider / target | Variant | Calls per task | Query payload tokens, first / warm | First query task ms | Warm task ms | Session CPU s | Peak family MiB |
| ----------------- | -------- | -------------: | ---------------------------------: | ------------------: | -----------: | ------------: | --------------: |
| Ghidra / zlib | existing | 10 | 41,565 / 41,565 | 34,926 | 429 | 50.00 | 1,444 |
| Ghidra / zlib | fine | 10 | 23,483 / 23,483 | 34,260 | 120 | 47.37 | 1,376 |
| Ghidra / zlib | batch | 3 | 20,114 / 20,114 | 75,202 | 218 | 52.63 | 1,360 |
| Ghidra / zlib | workflow | 1 | 19,824 / 19,824 | 75,491 | 198 | 51.76 | 1,276 |
| Kuna / zlib | existing | 4 | 5,638 / 5,638 | 4,079 | 44 | 16.12 | 905 |
| Kuna / zlib | fine | 5 | 4,702 / 4,702 | 2,857 | 51 | 15.61 | 927 |
| Kuna / zlib | batch | 3 | 3,774 / 3,774 | 2,843 | 59 | 15.14 | 911 |
| Kuna / zlib | workflow | 1 | 3,509 / 3,509 | 1,376 | 11 | 14.34 | 922 |
| Kuna / SQLite | existing | 4 | 6,039 / 6,039 | 5,874 | 24 | 19.15 | 994 |
| Kuna / SQLite | fine | 5 | 4,753 / 4,753 | 13,058 | 47 | 20.40 | 989 |
| Kuna / SQLite | batch | 3 | 3,829 / 3,829 | 25,868 | 217 | 25.85 | 1,022 |
| Kuna / SQLite | workflow | 1 | 3,560 / 3,560 | 36,231 | 39 | 58.19 | 1,004 |
Session CPU/memory include MCP startup, catalog/status discovery, both tasks and
close/cleanup. Query timers exclude the earlier `open_binary`; Ghidra lazily
performs import/preparation during its first query. Whole-session elapsed times
for existing/workflow were 50.67/104.15 s (Ghidra zlib), 32.46/16.63 s (Kuna zlib),
and 19.46/159.81 s (Kuna SQLite). The SQLite workflow's `open_binary` itself took
64.98 s versus 7.31 s in the existing-tools sample, before any experimental fact
query. Cause is unresolved; neither host contention nor adapter overhead has
been established as the explanation. Do not interpret these samples as a
controlled speedup or slowdown attributable to atomization.
**Failure retained:** the first Ghidra batch attempt hit its 120 s provider
request deadline during cold preparation. Its log ended in `ReaGhidraNoReturnFix`
after reporting successful auto-analysis. The attempt cost 141.45 s elapsed,
106.19 CPU s and 1,211 MiB peak; cleanup was verified and OOM kills were zero.
The successful batch row excludes that failed attempt; any retry-cost comparison
must add it. All twelve successful rows agreed on the selected strings,
reference sites and function-resolution outcomes within each provider/target.
That is adapter equivalence, not an independent proof of native discovery.
### Fixed context costs
The existing catalog had 207 tools; the prototype added five, retaining every
existing tool. Actual default catalogs included output schemas: about 842k /
843k estimated tokens. Removing only output schemas gives about 207k / 208k.
This input-only projection is **not** an assertion about any particular model
host: hosts can omit output schemas, deduplicate content or cache declarations.
For a session containing both completed tasks plus lifecycle/status traffic,
the input-only-catalog estimate changed as follows:
| Provider / target | Existing tools | Workflow |
| ----------------- | -------------: | -------: |
| Ghidra / zlib | 319,907 | 277,458 |
| Kuna / zlib | 245,476 | 242,249 |
| Kuna / SQLite | 245,803 | 241,870 |
Thus a large reduction in query payload need not produce a large whole-task
context reduction. Catalog/discovery and repeated envelopes deserve separate
attention. This experiment has not yet tested a client that loads declarations
on demand or an explicitly smaller, separately declared service surface.
## Experiment 2: compute sharing in native Kuna
Both plans first obtain a complete reference-free scan, validated by REA's
existing string-fact owner. Then select three matching strings. The point plan
runs `xrefs --to` separately; the inventory plan runs `strings` with attribution
once, letting Kuna share its reference index. Full source JSON is retained
locally, while only selected facts need be exposed to a caller.
| Target | Plan | Native commands | Elapsed s | CPU s | Peak family MiB |
| ------ | ------------------ | --------------: | --------: | ----: | --------------: |
| zlib | per address | 4 | 3.846 | 1.796 | 110.4 |
| zlib | shared attribution | 2 | 2.838 | 1.341 | 114.4 |
| SQLite | per address | 4 | 13.221 | 6.497 | 196.1 |
| SQLite | shared attribution | 2 | 6.261 | 3.028 | 196.6 |
For these selected samples, both plans found one owner per string. Their scopes
are nevertheless **different**: point references cover the first address;
attribution covers any byte in the string extent. Attribution also does not
return individual sites/kinds. These figures establish costs of the two real
plans, not a universally equivalent-query speedup. They support investigating
producer-level work sharing, with query selectivity and coverage kept explicit.
This is a native-boundary experiment, not an MCP/model token measurement.
## Experiment 3: the point/object distinction changes correctness
`interior-reference.c` is compiled with `gcc -O2 -fno-pie -no-pie` and never run.
Its `give_suffix` returns a pointer five bytes into `marker`. In this build,
`nm` reports `marker=0x402020`, `give_suffix=0x401120`; `objdump` independently
shows `mov $0x402025,%eax` followed by `ret` in `give_suffix`.
- Exact-start xref query: zero references, no owner.
- Extent attribution: one reference, owner `give_suffix` at `0x401120`.
`verify-interior.py` checks the compiled symbols, input and retained-source
digests, and both native results. This is a genuine counterexample to treating
"no xref to the start address" as "the string has no users". Neither tool was
wrong about its own scope. The compositional representation must carry the
object span and reference offset/scope instead of silently equating the questions.
## Experiment 4: existing relations do not always bridge into code
On real zlib, the three selected string references belong to `inflate` at
`0xc1e0`; their reference instructions are at `0xded7`, `0xdc6a` and `0xcd05`.
The native single-function JSON contains 52,431 characters / 1,620 code lines,
1,167 mapping records and 1,568 mapped instruction addresses. **None of those
three reference instructions occurs in the printer's line mappings.**
The exact-address composition therefore returns **unknown**, not a guessed
nearby line. The mapped-code run cost 8.387 s / 8.091 CPU s / 202.0 MiB, including
discovery/references and decompilation. It did not finish the analyst question
"which condition triggers the error?" and must not count as a successful
context-saving answer. Single-function work uses REA's owned command deadline
and the native `--max-fn-memory` option shown by the tested CLI's actual help.
The retained C text does contain the error literal at line 164, but a small
fixed window there omits the earlier check around lines 122–124. Literal search
and a larger manual read can help, but they are **reconstructed-text evidence**,
not the missing machine-to-source relation. This is not proof that Kuna's line
mapping is buggy: the contract does not promise every contributing instruction
survives transformation into an emitted line.
The next useful relations to test are instruction/block ownership, control-flow
guards and definition/use or contributing-origin edges across transformations.
For a stronger zlib question, an independent expected mechanism is the FCHECK
constraint in [RFC 1950 §2.2](https://www.rfc-editor.org/rfc/rfc1950.html#section-2.2):
the network-order CMF/FLG value must be divisible by 31. Testing an agent's
explanation against that mechanism would be a separate trial; this experiment
does not claim to have completed that trial.
## Validation
- All **191 Kuna regression cases in 20 files passed with one worker**; the
owning reference parser's 18 cases include typed endpoints, distinct kinds,
unknown ownership, alias exclusion and late malformed rows. A prior two-worker
CPU-limited run had three timing-sensitive failures in existing project/export
tests. Those tests were not edited; the isolated cause is not established.
- Nine experiment boundary cases passed, including stale artifact/profile/lease,
partial batches, duplicate point lookups, paging, unsupported ownership,
unmapped/unsafe addresses and invalid line locations.
- Typecheck passed with one checker. Changed experiment files passed formatter
and lint; the existing graph parser's complexity warning remains unrelated.
- A real Kuna MCP run with the actual output-schema **off** profile passed
paging, duplicate-selector, negative/unknown, retained-Evidence, foreign-context
and expired-lease checks. Its live catalog had 212 tools and zero output
schemas. Verification runs are excluded from the performance table.
- The v2 facade was also exercised through a real Kuna MCP client: edges carry
explicit point scope and location endpoints, caller selectors stay separate,
and successful/error results retain the canonical untrusted-target marker.
The same six additional verification groups passed. This v2 verification is
not relabelled as a new performance comparison.
- All real-provider measurements reported verified cleanup and zero OOM kills.
No default parallel-suite stability, live-model reasoning improvement, general
high-address code mapping, overlay support or newer Kuna compatibility is claimed.
## What this round supports
- A coherent fact includes the metadata needed to interpret it. One-field
getters are not necessarily useful atoms.
- Fact, transport and compute units are different. Batches/workflows can share
one fact implementation while the producer independently shares analysis.
- Identity and evidence are necessary, but scope and uncertainty determine
whether joins answer the analyst's actual question.
- Complex-program effectiveness remains **unproven**. The experiments found a
real coverage distinction and a real composition gap, not a universal RE API.
Raw captures, projects, binaries and counters remain ignored under
`.cache/atomic-re-tools/`. `summarize.py` checks selected-answer equivalence,
payload-exit cleanup and OOM counters, and includes failed runs separately.
+40
View File
@@ -0,0 +1,40 @@
"""Run comparable real-provider tasks serially using REA's existing scope owner."""
import argparse
import json
from pathlib import Path
import subprocess
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--provider", choices=["kuna", "ghidra"], required=True)
parser.add_argument("--binary", required=True)
parser.add_argument("--pattern", required=True)
parser.add_argument("--output", required=True)
parser.add_argument("--variants", nargs="+", choices=["baseline", "fine", "batch", "workflow"],
default=["baseline", "fine", "batch", "workflow"])
options = parser.parse_args()
root = Path(options.output).resolve()
root.mkdir(parents=True, exist_ok=True)
completed = []
for variant in options.variants:
prefix = root / (options.provider + "-" + variant)
command = [sys.executable, "experiments/analysis-efficiency/resource-run.py", "--observe-payload-exit", "--",
"node", "experiments/atomic-re-tools/benchmark.mjs", options.provider, variant,
options.binary, options.pattern, str(prefix)]
with Path(str(prefix) + ".log").open("w") as output:
result = subprocess.run(command, stdout=output, stderr=subprocess.STDOUT, check=False)
if result.returncode:
raise SystemExit(f"{variant} failed ({result.returncode}); retained {prefix}.log")
report = json.loads(Path(str(prefix) + ".report.json").read_text())
if report["failures"] or report["verification_only"]:
raise SystemExit("Not a successful comparable performance sample: " + str(prefix))
completed.append(str(prefix))
(root / (options.provider + "-completed.json")).write_text(json.dumps(completed, indent=2) + "\n")
print(json.dumps({"completed": variant, "provider": options.provider,
"query_ms": [round(row["elapsed_ms"], 2) for row in report["outcomes"]]}), flush=True)
if __name__ == "__main__":
main()
+202
View File
@@ -0,0 +1,202 @@
// Experimental tools are added to the complete production catalog, never shipped.
import { serveStdio } from "@modelcontextprotocol/server/stdio";
import { z } from "zod";
import { run } from "../../dist/main.js";
import { createServer } from "../../dist/server/createServer.js";
import { createEvidence } from "../../dist/domain/evidence.js";
import { projectAnalysisError } from "../../dist/domain/analysisErrorProjection.js";
import { toolContract } from "../../dist/contracts/toolContracts.js";
import { TARGET_CONTENT_RESULT_META } from "../../dist/server/toolResultEncoding.js";
import { expandProviderCapabilities } from "../../dist/contracts/toolOutputSchemaPrimitives.js";
import { FactQueries, contextFor } from "./facts.mjs";
const contextSchema = z.strictObject({ ref: z.string(), lease: z.string() });
const location = z.strictObject({
kind: z.literal("location"),
address: z.string().min(1),
});
const stringId = z.strictObject({
kind: z.literal("string"),
address: z.string().min(1),
encoding: z.string().nullable(),
});
const paging = {
offset: z.number().int().nonnegative().default(0),
limit: z.number().int().positive().default(20),
};
const stringsInput = z.strictObject({
query: toolContract("search_strings").inputSchema,
...paging,
fields: z.array(z.enum(["value", "string"])).default(["value"]),
});
const contracts = [
[
"experiment_find_strings",
"Find string facts with scoped identities, selected fields, paging and retained source Evidence. Experimental; provider discovery coverage remains unknown.",
stringsInput,
"findStrings",
],
[
"experiment_incoming_refs",
"Read incoming reference facts for a batch of string identities from this session. Preserve per-target failures and unknown reference kinds. Reuse the context ref and lease returned by find_strings.",
z.strictObject({
context: contextSchema,
targets: z.array(stringId),
...paging,
}),
"incomingReferences",
],
[
"experiment_resolve_functions",
"Resolve a batch of instruction locations to provider-analyzed containing functions. Unsupported or failed resolution stays unknown; never guess the nearest symbol.",
z.strictObject({ context: contextSchema, locations: z.array(location) }),
"resolveFunctions",
],
[
"experiment_trace_string_uses",
"Compose the same string, incoming reference and containing-function facts in one call. Page limits and partial outcomes remain explicit.",
stringsInput.extend({
reference_limit: z.number().int().positive().default(20),
include_functions: z.boolean().default(true),
}),
"traceStringUses",
],
];
const encode = (value) => ({
_meta: TARGET_CONTENT_RESULT_META,
content: [{ type: "text", text: JSON.stringify(value) }],
structuredContent: value,
...(value.status === "error" ? { isError: true } : {}),
});
const createFacts = (session, analysis, signal) => {
const status = session.status();
const context = contextFor(
session.activeTarget().sha256,
session.analysisProfile("search_strings"),
status.analysis_run.run_id,
);
const capabilities = expandProviderCapabilities(status.capabilities);
const facts = new FactQueries({
supports: (operation) =>
capabilities.some(
(capability) =>
capability.operation === operation && capability.available,
),
context: () => context,
observe: async (operation, parameters) => {
const outcome = await analysis.execute(
operation,
toolContract(operation).inputSchema.parse(parameters),
{ signal: signal },
);
if (!outcome.ok)
return {
ok: false,
error: projectAnalysisError(outcome.error),
};
const execution = outcome.value;
const evidence = createEvidence(
execution.subject ?? session.activeTarget(),
execution.provider,
{
operation,
parameters,
result: execution.result,
analysisProfile: execution.analysisProfile,
rawResult: execution.rawResult,
limitations: execution.limitations,
relationshipCoverage: execution.relationshipCoverage,
locations: execution.locations,
},
);
const recorded = session.recordEvidence(evidence);
return recorded.ok
? { ok: true, value: evidence }
: {
ok: false,
error: projectAnalysisError(recorded.error),
};
},
});
return facts;
};
await run({
env: process.env,
serve: serveStdio,
writeStderr: (value) => process.stderr.write(value),
setExitCode: (value) => {
process.exitCode = value;
},
registerShutdown: (handler) => {
const registrations = [
[process, "SIGINT"],
[process, "SIGTERM"],
[process.stdin, "end"],
[process.stdin, "close"],
];
for (const [emitter, event] of registrations) emitter.once(event, handler);
return () => {
for (const [emitter, event] of registrations) emitter.off(event, handler);
};
},
createServer(source, options) {
const server = createServer(source, options);
const session = source.session;
for (const [name, description, inputSchema, method] of contracts) {
server.registerTool(
name,
{ description, inputSchema, annotations: { readOnlyHint: true } },
async (input, request) => {
const admitted = await session.withAdmittedAnalysis(
name,
request.mcpReq.signal,
async (analysis) => {
const facts = createFacts(
session,
analysis,
request.mcpReq.signal,
);
return facts[method](inputSchema.parse(input));
},
);
return encode(
admitted.ok
? admitted.value
: {
status: "error",
error: projectAnalysisError(admitted.error),
},
);
},
);
}
server.registerTool(
"experiment_read_evidence",
{
description:
"Read complete retained source Evidence explicitly by evidence_id while the existing session record owner retains it. Closing the binary expires these records.",
inputSchema: z.strictObject({ evidence_id: z.string().min(1) }),
annotations: { readOnlyHint: true },
},
(input) => {
const evidence = session.evidenceById(input.evidence_id);
return encode(
evidence === undefined
? {
status: "error",
error: {
code: "not_found",
message: "Evidence is not retained in this server.",
},
}
: { status: "ok", evidence },
);
},
);
return server;
},
});
@@ -0,0 +1,94 @@
"""Representation estimates and a complete ledger of this round's captured runs.
Run with the tokenizer environment from the first round. This does not measure
model billing, model reasoning, or equivalent completed agent tasks.
"""
import importlib.metadata
import json
from pathlib import Path
import sys
import tiktoken
def load(path):
return json.loads(path.read_text())
def resource(path):
records = [json.loads(line) for line in path.read_text().splitlines()
if line.startswith('{"resource_scope":')]
assert len(records) == 1, path
record = records[0]
observation = record['payload_resource_observation']
assert record['payload_resource_observation_verified'] is True
assert observation['payload_cleanup_verified'] is True
return {
'log': str(path), 'elapsed_s': record['elapsed_seconds'],
'cpu_s': observation['cpu_stat']['usage_usec'] / 1_000_000,
'family_peak_mib_including_file_cache': observation['memory_peak_bytes'] / 2**20,
'exit_code': observation['payload_exit_code'],
'oom_kills': observation['resource_events']['memory.events']['oom_kill'],
}
def main():
root, output = map(Path, sys.argv[1:])
encoder = tiktoken.get_encoding('o200k_base')
def tokens(value):
return len(encoder.encode(value, disallowed_special=()))
def encoded(value):
return json.dumps(value, ensure_ascii=False, separators=(',', ':'))
rows = []
for name, prefix, query_file in [
('zlib', 'relations-kuna-zlib-raw-v2', 'relations-zlib-query-v2.json'),
('sqlite', 'relations-kuna-sqlite-raw', 'relations-sqlite-query-v2.json'),
]:
capture = load(root / (prefix + '.report.json'))
query = load(root / query_file)
raw = Path(capture['calls'][0]['file']).read_text()
code = raw.split('\n0\nBasic Block', 1)[0].strip()
answers = query['runs'][0]['answers']
rows.append({
'target': name, 'artifact_sha256': capture['target_sha256'],
'full_code_tokens': tokens(code), 'full_code_bytes': len(code.encode()),
'full_native_dump_tokens': tokens(raw),
'selected_answer_tokens_with_source': [tokens(encoded({'source': query['source'], 'answer': a})) for a in answers],
'batch_answer_tokens_with_source': tokens(encoded({'source': query['source'], 'answers': answers})),
'parse_index_ms': query['parse_index_ms'],
'projection_runs': [{k: v for k, v in r.items() if k != 'answers'} for r in query['runs']],
'snapshot_coverage': query['coverage'],
})
ghidra = root / 'relations-ghidra-zlib-retained'
wire = load(ghidra.with_suffix('.wire.json'))
report = load(ghidra.with_suffix('.report.json'))
resources = [resource(p) for p in sorted(root.glob('relations-*.log'))]
summary = {
'encoding': 'o200k_base', 'tiktoken': importlib.metadata.version('tiktoken'),
'representation_estimates': rows,
'ghidra_retained_workflow': {
'wire_tokens_including_errors_and_exports': tokens(encoded(wire)),
'input_only_catalog_tokens': tokens(encoded(load(ghidra.with_suffix('.catalog.json')))),
'calls': report['calls'], 'analyst_task_completed': False,
'reason': 'Late literal not covered by the producer-truncated high-p-code prefix.',
},
'run_ledger': resources,
'scope': [
'Raw captures are fresh native analyses; OS caches were not flushed.',
'Reused-index runs reuse parsed facts, not a warm native analysis.',
'Token counts cover the stated representations. The native probe has no new MCP catalog.',
'No controlled agent A/B task, model reasoning tokens or model latency measured.',
'Discovery, old xrefs, manual oracle construction, objdump and tokenizer CPU are outside the native/projection runs.',
'The ledger retains failed and superseded probes rather than excluding their costs.',
],
}
with output.open('x') as destination:
destination.write(json.dumps(summary, indent=2) + '\n')
print(json.dumps({'output': str(output), 'targets': len(rows), 'runs': len(resources)}))
if __name__ == '__main__':
main()
+84
View File
@@ -0,0 +1,84 @@
"""Compare completed equivalent tasks; token counts are offline estimates only."""
import argparse
import importlib.metadata
import json
from pathlib import Path
import tiktoken
def main():
parser = argparse.ArgumentParser()
parser.add_argument("roots", nargs="+")
options = parser.parse_args()
encoding = tiktoken.get_encoding("o200k_base")
def tokens(value):
return len(encoding.encode(json.dumps(value, ensure_ascii=False, separators=(",", ":")), disallowed_special=()))
results = []
failed_runs = []
equivalence = {}
for root in map(Path, options.roots):
for report_path in sorted(root.glob("*.report.json")):
report = json.loads(report_path.read_text())
if report["verification_only"]:
continue
prefix = str(report_path).removesuffix(".report.json")
catalog = json.loads(Path(prefix + ".catalog.json").read_text())
wire = json.loads(Path(prefix + ".wire.json").read_text())
resources = [json.loads(line) for line in Path(prefix + ".log").read_text().splitlines()
if line.startswith('{"resource_scope":')][-1]
assert resources["payload_resource_observation_verified"], prefix
counters = resources["payload_resource_observation"]
assert counters["payload_cleanup_verified"], prefix
assert counters["resource_events"]["memory.events"]["oom_kill"] == 0, prefix
if report["failures"]:
failed_runs.append({"provider": report["provider"], "variant": report["variant"], "target": report["binary"],
"elapsed_seconds": resources["elapsed_seconds"], "cpu_seconds": round(counters["cpu_stat"]["usage_usec"] / 1e6, 3),
"peak_process_family_cgroup_mib": round(counters["memory_peak_bytes"] / 1024 ** 2, 1),
"failure_count": len(report["failures"]), "retained_prefix": prefix,
"cleanup_verified": True, "oom_kills": 0})
continue
assert counters["payload_exit_code"] == 0, prefix
key = (report["provider"], report["target_sha256"], report["pattern"])
outcome = [{name: row[name] for name in ["strings", "references", "functions"]} for row in report["outcomes"]]
if key in equivalence:
assert outcome == equivalence[key], "Equivalent-task answers differ: " + prefix
else:
equivalence[key] = outcome
phase_traffic = {phase: [{"request": row["request"], "response": row["response"]} for row in wire if row["phase"] == phase]
for phase in ["cold", "warm", "lifecycle"]}
used = {row["request"]["name"] for row in wire}
input_only_catalog = {**catalog, "tools": [{key: value for key, value in tool.items() if key != "outputSchema"} for tool in catalog["tools"]]}
task_traffic = [row for row in wire if row["phase"] in ["cold", "warm", "lifecycle"]]
rows = {phase: {"calls": len(traffic), "estimated_tokens": tokens(traffic)} for phase, traffic in phase_traffic.items()}
results.append({
"provider": report["provider"], "variant": report["variant"], "target_sha256": report["target_sha256"],
"pattern": report["pattern"], "catalog_tools": len(catalog["tools"]), "catalog_estimated_tokens": tokens(catalog),
"observed_output_schema_count": sum("outputSchema" in tool for tool in catalog["tools"]),
"input_only_catalog_estimated_tokens": tokens(input_only_catalog),
"phases": rows,
"query_elapsed_ms": {row["phase"]: round(row["elapsed_ms"], 2) for row in report["outcomes"]},
"session_elapsed_seconds_including_two_tasks": resources["elapsed_seconds"],
"session_cpu_seconds_including_two_tasks": round(counters["cpu_stat"]["usage_usec"] / 1e6, 3),
"peak_process_family_cgroup_mib": round(counters["memory_peak_bytes"] / 1024 ** 2, 1),
"whole_session_estimated_tokens": tokens(catalog) + tokens([{"request": row["request"], "response": row["response"]} for row in task_traffic]),
"whole_session_with_input_only_catalog_estimated_tokens": tokens(input_only_catalog) + tokens([{"request": row["request"], "response": row["response"]} for row in task_traffic]),
"hypothetical_selected_declarations_estimated_tokens": tokens([tool for tool in catalog["tools"] if tool["name"] in used]),
"answer": {"strings": len(outcome[0]["strings"]), "reference_sites": sum(len(row["items"]) for row in outcome[0]["references"]), "locations": len(outcome[0]["functions"])},
"cleanup_verified": True, "oom_kills": 0,
})
summary = {
"token_method": {"encoding": "o200k_base", "tiktoken_version": importlib.metadata.version("tiktoken"),
"estimated_not_billed": True, "scope": "Captured MCP tool catalog and request/response payloads, including text and structured copies; excludes JSON-RPC framing, model reasoning, host prompts and model tool selection."},
"memory_method": "Kernel memory.peak for the complete owned process-family cgroup, including charged file cache; not summed RSS. Payload-exit counters verified while the observer remains alive.",
"workload": "One cold and one warm selected navigation task per fresh session, plus startup, discovery/status, close and cleanup. Additional --verify runs excluded.",
"equivalence": "All included variants agree on selected strings, reference sites and per-location function resolutions within each provider/target/query. This is not cross-provider truth or a live-agent reasoning evaluation.",
"results": results,
"failed_runs": failed_runs,
}
print(json.dumps(summary, indent=2))
if __name__ == "__main__":
main()
@@ -0,0 +1,26 @@
"""Independent compiled-symbol oracle for the interior-only reference experiment."""
import hashlib
import json
from pathlib import Path
import subprocess
import sys
binary, point_report, extent_report = map(Path, sys.argv[1:])
point, extent = [json.loads(path.read_text()) for path in [point_report, extent_report]]
symbols = {}
for line in subprocess.check_output(["nm", "--defined-only", "--format=posix", str(binary)], text=True).splitlines():
fields = line.split()
if fields[0] in ["marker", "give_suffix"]:
symbols[fields[0]] = "0x" + format(int(fields[2], 16), "x")
assert set(symbols) == {"marker", "give_suffix"}
for report in [point, extent]:
assert not report["failures"]
assert report["facts"]["artifact_sha256"] == hashlib.sha256(binary.read_bytes()).hexdigest()
for call in report["calls"]:
assert hashlib.sha256(Path(call["file"]).read_bytes()).hexdigest() == call["sha256"]
assert report["facts"]["results"][0]["string"]["address"] == symbols["marker"]
assert point["facts"]["results"][0]["xrefs_count"] == 0
assert point["facts"]["results"][0]["functions"] == []
assert extent["facts"]["results"][0]["xrefs_count"] == 1
assert [fn["address"] for fn in extent["facts"]["results"][0]["functions"]] == [symbols["give_suffix"]]
print(json.dumps({"verified": True, "point_references": 0, "extent_references": 1, "symbols": symbols}))
@@ -0,0 +1,163 @@
// Replay real captures against independent machine-byte and arithmetic checks.
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { mappedCode } from "./mapped-code.mjs";
import { parseKunaSsaDump } from "./kuna-ssa.mjs";
import { queryLiteralUses } from "./query-ssa.mjs";
const [root, output] = process.argv.slice(2);
assert.ok(root && output);
const json = async (name) =>
JSON.parse(await readFile(join(root, name), "utf8"));
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
const zlib = await json("relations-zlib-query-v2.json");
const sqlite = await json("relations-sqlite-query-v2.json");
assert.deepEqual(zlib.runs[0].answers, zlib.runs[1].answers);
assert.deepEqual(sqlite.runs[0].answers, sqlite.runs[1].answers);
for (const query of [zlib, sqlite]) {
const source = await readFile(query.source.raw.file, "utf8");
assert.equal(sha256(source), query.source.raw.sha256);
const snapshot = parseKunaSsaDump(source);
for (const answer of query.runs[0].answers)
assert.deepEqual(queryLiteralUses(snapshot, answer.literal), answer);
}
const old = await json("native-zlib-code-fixed.report.json");
assert.equal(zlib.source.artifact_sha256, old.facts.artifact_sha256);
assert.deepEqual(zlib.source.engine, old.facts.engine);
const bodySource = old.calls.find((call) => call.arguments[0] === "decompile");
const body = await readFile(bodySource.file, "utf8");
assert.equal(sha256(body), bodySource.sha256);
const bodyDocument = JSON.parse(body);
const raw = await readFile(zlib.source.raw.file, "utf8");
assert.equal(sha256(raw), zlib.source.raw.sha256);
assert.equal(
raw.split("\n0\nBasic Block", 1)[0].trim(),
bodyDocument.functions[0].code.trim(),
"Cross-surface emitted C differs",
);
const native = async () => ({
input: bodyDocument.binary,
stdout: { text: body },
});
const mappings = [];
for (const [i, expectedLine] of [164, 551, 653].entries()) {
const answer = zlib.runs[0].answers[i];
const original = old.facts.results[i];
assert.equal(answer.literal, original.string.address);
const failed = await mappedCode(native, original);
assert.equal(failed.status, "unknown");
const sites = answer.direct_uses.map((id) => ({
from: answer.operations.find((op) => op.id === id).address,
}));
const mapped = await mappedCode(native, {
functions: original.functions,
sites,
});
assert.equal(mapped.status, "ok");
assert.deepEqual(mapped.exact_mapped_lines, [expectedLine]);
mappings.push({
literal: answer.literal,
original_sites: original.sites.map((s) => s.from),
semantic_sites: sites.map((s) => s.from),
line: expectedLine,
});
}
const header = zlib.runs[0].answers[0];
assert.deepEqual(
header.control_edges.map((e) => [e.from, e.to, e.polarity]),
[
[182, 446, "false"],
[183, 446, "false"],
],
);
assert.equal(header.operations.length, 21);
assert.equal(header.coverage.dependencies.boundaries.length, 2);
assert.ok(header.operations.some((op) => op.statement.includes("& #0x1:4")));
assert.ok(header.operations.some((op) => op.statement.includes("/ #0x1f")));
const match = sqlite.runs[0].answers[0];
assert.equal(
match.operations.find((op) => op.id === match.direct_uses[0]).kind,
"call",
);
assert.ok(match.operations.some((op) => op.statement.includes("!= #0x1:4")));
assert.deepEqual(
match.control_edges.map((e) => e.polarity),
["false"],
);
const assemblyProofs = [];
for (const [file, patterns] of [
[
"relations-zlib-guard.objdump.txt",
[/d9ec:.*je\s+ded7/u, /da32:.*jne\s+ded7/u, /0x842108421084211/u],
],
[
"relations-sqlite-error.objdump.txt",
[
/65239:.*cmp\s+\$0x1,%ebx/u,
/6523c:.*je\s+65281/u,
/65284:.*lea.*11dcd8/u,
],
],
]) {
const text = await readFile(join(root, file), "utf8");
for (const pattern of patterns) assert.match(text, pattern);
assemblyProofs.push({ file, sha256: sha256(text) });
}
// Exhaustive ordinary 16-bit header domain. This executes arithmetic, not targets.
for (let n = 0n; n < 65536n; n++) {
const high = (n * 0x842108421084211n) >> 64n;
const machineQ = (((n - high) >> 1n) + high) >> 4n;
const ssaQ = (((n - n / 31n) >> 1n) + n / 31n) >> 4n;
assert.equal(machineQ, n / 31n);
assert.equal(ssaQ, machineQ);
assert.equal(n !== machineQ * 31n, n % 31n !== 0n);
}
const ghidra = await json("relations-ghidra-zlib-retained.bundle.json");
const flow = ghidra.records.find((r) => r.normalized_result?.native_value_flow)
?.normalized_result.native_value_flow;
assert.equal(flow.truncated, true);
assert.equal(flow.operations.length, 3000);
assert.equal(flow.known_omitted_edges, 239);
assert.ok(
!flow.operations.some((op) =>
op.inputs.some((v) => v.constant_hex === "118fc4"),
),
);
await writeFile(
output,
JSON.stringify(
{
mappings,
zlib_header_selected_operations: header.operations.length,
sqlite_selected_operations: match.operations.length,
assemblyProofs,
arithmetic_oracle: {
tested_values: 65536,
domain: "ordinary 16-bit header value",
target_executed: false,
},
ghidra: {
retained_operations: 3000,
known_omitted_edges: 239,
late_literal_coverage: "unknown due to truncation",
},
limitations: [
"Printed-SSA observations are derived, not runtime behavior.",
"Entry state, complete control dependencies, phi predecessor and memory alias bindings remain unknown.",
"Source-version agreement does not prove an exact Debian source/build match.",
],
},
null,
2,
),
{ flag: "wx" },
);
console.log(
JSON.stringify({
output,
mapped_errors: mappings.length,
arithmetic_values: 65536,
}),
);
+6 -1
View File
@@ -2,7 +2,7 @@ REA npm dependency inventory
Prepared from the root package-lock.json; refresh this inventory when locked dependencies change.
License identifiers are upstream lockfile declarations, not a legal assessment.
Runtime includes transitive and optional platform packages; development includes build, test and website tooling.
Locked package entries: 721; runtime: 177.
Locked package entries: 722; runtime: 178.
Full runtime copyright/license/NOTICE texts: npm-runtime-notices.txt.
@algolia/abtesting@1.25.0 | development | MIT
@@ -2740,6 +2740,11 @@ oniguruma-to-es@3.1.1 | development | MIT
Package: https://www.npmjs.com/package/oniguruma-to-es/v/3.1.1
Archive: https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-3.1.1.tgz
Integrity: sha512-bUH8SDvPkH3ho3dvwJwfonjlQ4R80vjyvrU8YpxuROddv55vAEJrTuCuCVUhhsHbtlD9tGGbaNApGQckXhS8iQ==
openpgp@6.3.2 | runtime | LGPL-3.0+
Lockfile path: node_modules/openpgp
Package: https://www.npmjs.com/package/openpgp/v/6.3.2
Archive: https://registry.npmjs.org/openpgp/-/openpgp-6.3.2.tgz
Integrity: sha512-wcZTzHz41LV8Y48zH/JlD1JT8YdNmpWOuMAjQ/podvvCwsjBEU37K3znJh4UQcj3hksE5z9TzvhbUbwzsGvlLQ==
oxc-parser@0.150.0 | development | MIT
Lockfile path: node_modules/oxc-parser
Package: https://www.npmjs.com/package/oxc-parser/v/0.150.0
+175 -1
View File
@@ -1,7 +1,7 @@
REA third-party npm runtime copyright, license and NOTICE texts
Collected from integrity-verified locked npm archives. Release-specific supplements and upstream notice gaps are identified in their entries.
External engines are separately obtained; see THIRD_PARTY_NOTICES.md.
Runtime dependency fingerprint (SHA-256): 49b181923ab240c68c64d35ecdd8f93cb5cd516c765f2282d0e0eca0bcadd13e
Runtime dependency fingerprint (SHA-256): 131100b2e1e6ad5e55b10a0baf4be2d7a0838fd724fb307b9bafd73446b0d3ec
===== @babel/helper-string-parser@8.0.6 =====
Declared license: MIT
@@ -5171,6 +5171,180 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
===== openpgp@6.3.2 =====
Declared license: LGPL-3.0+
Archive: https://registry.npmjs.org/openpgp/-/openpgp-6.3.2.tgz
Integrity: sha512-wcZTzHz41LV8Y48zH/JlD1JT8YdNmpWOuMAjQ/podvvCwsjBEU37K3znJh4UQcj3hksE5z9TzvhbUbwzsGvlLQ==
Scope: npm runtime dependency. GPLv3 terms incorporated by this LGPL text are preserved in licenses/GPL-3.0.txt.
--- package/LICENSE ---
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
===== pako@1.0.11 =====
Declared license: (MIT AND Zlib)
Archive: https://registry.npmjs.org/pako/-/pako-1.0.11.tgz
+13 -6
View File
@@ -111,7 +111,9 @@ automatically. Alternatively, build it using the Linux/MinGW lane above.
- Cleanup walks locked directory objects, removes files by handle, and unlinks
reparse entries without traversing their targets. Failed removal retains the
root and ancestor leases for retry; a partially removed runtime accepts only
cleanup, and its registry entry remains until removal succeeds. Normal close, cancellation,
cleanup, and its registry entry remains until removal succeeds. The owned root
handle includes attribute-write access so cleanup can clear a read-only marker,
matching the child cleanup handles. Normal close, cancellation,
startup failure, and timeout release provider resources. Abrupt owner death
kills the owned job. The Android provider additionally uses a detached helper
that owns its private runtime directory and cleans it when the owner pipe
@@ -156,8 +158,11 @@ npm run verify:windows-native
npm run verify:ghidra:windows
```
The native inspection probe retains its directory owner if deletion fails. A
later availability query retries that cleanup before creating another probe;
An unpublished runtime retains its directory and parent handles if validation,
result publication, or rollback fails. Errors retain the original failure and
any rollback failure. Later runtime creation or native inspection retries that
exact owner before allocating another directory. The same owner covers the
native inspection probe. A later availability query retries failed probe cleanup;
successful admission and static artifact failures remain cached. Environment
teardown makes one final cleanup attempt and reports a persistent failure to
stderr rather than claiming the directory was removed.
@@ -174,9 +179,11 @@ On Windows, after compiling the runtime:
node scripts/verify-windows-native-inspection.mjs
```
This artifact injects one access-denied disposition result while using a real
NTFS directory. The verifier checks retained ownership, recovery on a later
query, cached successful admission, and cleanup on environment teardown. It
This artifact injects an access-denied disposition result while using real
NTFS directories, and separately denies post-create validation and rollback.
The verifier checks retained ownership after inspection and direct runtime
creation failures, recovery on later admission, cached successful inspection,
and cleanup on environment teardown. It
renames the retained probe and recreates its old path, checking that cleanup
removes the owned inode while preserving the replacement directory.
It does not reproduce or identify the host-dependent cause reported in #1701.
+35 -15
View File
@@ -60,6 +60,15 @@ napi_value wrap(napi_env env, std::unique_ptr<Resource> value) {
value.release();
return result;
}
void publishRuntimeHandle(napi_env env, napi_value observation, std::unique_ptr<Runtime>& value) {
auto handle = object(env);
check(napi_type_tag_object(env, handle, &RESOURCE_TAG));
// Complete the result before transferring cleanup ownership. Any earlier
// N-API failure leaves the unpublished runtime in its environment owner.
set(env, observation, "handle", handle);
check(napi_wrap(env, handle, value.get(), finalize, nullptr, nullptr));
value.release();
}
Resource& resource(napi_env env, napi_value value, Kind kind) {
bool tagged = false;
check(napi_check_object_type_tag(env, value, &RESOURCE_TAG, &tagged));
@@ -77,8 +86,15 @@ napi_value failureValue(napi_env env, const Failure& failure) {
std::wstring detail = message == nullptr ? L"" : message;
if (message != nullptr) LocalFree(message);
const std::wstring constraint(failure.constraint.begin(), failure.constraint.end());
auto text = string(env, constraint + (failure.path.empty() ? L"" : L" [" + failure.path + L"]") +
L" (Win32 " + std::to_wstring(failure.win32) + L"): " + detail);
std::wstring renderedMessage = constraint + (failure.path.empty() ? L"" : L" [" + failure.path + L"]") +
L" (Win32 " + std::to_wstring(failure.win32) + L"): " + detail;
if (!failure.cleanupConstraint.empty()) {
const std::wstring cleanup(failure.cleanupConstraint.begin(), failure.cleanupConstraint.end());
renderedMessage += L"; cleanup also failed: " + cleanup +
(failure.cleanupPath.empty() ? L"" : L" [" + failure.cleanupPath + L"]") +
L" (Win32 " + std::to_wstring(failure.cleanupWin32) + L")";
}
auto text = string(env, renderedMessage);
napi_value error; napi_create_error(env, nullptr, text, &error);
const char* code = failure.win32 == ERROR_FILE_NOT_FOUND || failure.win32 == ERROR_PATH_NOT_FOUND ? "ENOENT"
: failure.win32 == ERROR_ACCESS_DENIED ? "EACCES" : "ERR_REA_WINDOWS_NATIVE";
@@ -87,21 +103,24 @@ napi_value failureValue(napi_env env, const Failure& failure) {
set(env, error, "requestedPath", string(env, failure.path));
set(env, error, "win32Code", number(env, failure.win32));
set(env, error, "win32Message", string(env, detail));
if (!failure.cleanupConstraint.empty()) {
set(env, error, "cleanupConstraint", string(env, failure.cleanupConstraint));
set(env, error, "cleanupRequestedPath", string(env, failure.cleanupPath));
set(env, error, "cleanupWin32Code", number(env, failure.cleanupWin32));
}
if (failure.runtimeDirectoryUnallocated)
set(env, error, "runtimeAllocation", string(env, std::string("not-started")));
return error;
}
struct InspectionContext { std::unique_ptr<Runtime> probe; };
static void cleanupInspection(void* data) noexcept {
std::unique_ptr<InspectionContext> context(static_cast<InspectionContext*>(data));
if (!context->probe) return;
try { closeRuntime(*context->probe); }
static void cleanupRuntimeContext(void* data) noexcept {
std::unique_ptr<RuntimeContext> context(static_cast<RuntimeContext*>(data));
if (!context->pending) return;
try { closeRuntime(*context->pending); }
catch (const Failure& failure) {
// Environment teardown cannot retain an owner or return an error. Report
// terminal cleanup failure instead of claiming the directory was removed.
std::fprintf(stderr, "REA Windows probe cleanup failed (Win32 %lu) path=\"",
std::fprintf(stderr, "REA Windows runtime cleanup failed (Win32 %lu) path=\"",
static_cast<unsigned long>(failure.win32));
// Emit reversible UTF-16 escapes without allocation or CRT locale conversion.
for (wchar_t unit : failure.path) {
@@ -112,10 +131,10 @@ static void cleanupInspection(void* data) noexcept {
std::fprintf(stderr, "\"\n");
}
catch (const std::exception& failure) {
std::fprintf(stderr, "REA Windows probe cleanup failed: %s\n", failure.what());
std::fprintf(stderr, "REA Windows runtime cleanup failed: %s\n", failure.what());
}
catch (...) {
std::fprintf(stderr, "REA Windows probe cleanup failed: unknown native exception\n");
std::fprintf(stderr, "REA Windows runtime cleanup failed: unknown native exception\n");
}
}
@@ -128,12 +147,13 @@ static napi_value call(napi_env env, napi_callback_info info) {
require(count == 2, "Native call requires operation and arguments", L"", ERROR_INVALID_PARAMETER);
const auto operation = wide(env, args[0]);
const auto values = array(env, args[1]);
auto& context = *static_cast<RuntimeContext*>(data);
if (operation == L"inspect") {
require(values.empty(), "Inspect takes no arguments", L"", ERROR_INVALID_PARAMETER);
return inspect(env, static_cast<InspectionContext*>(data)->probe);
return inspect(env, context.pending);
}
if (operation.rfind(L"process_", 0) == 0) return processCall(env, operation, values);
return filesystemCall(env, operation, values);
return filesystemCall(env, operation, values, context);
} catch (const Failure& failure) {
auto error = failureValue(env, failure);
napi_throw(env, error);
@@ -145,8 +165,8 @@ static napi_value call(napi_env env, napi_callback_info info) {
}
static napi_value initialize(napi_env env, napi_value exports) {
auto context = std::make_unique<InspectionContext>();
if (napi_add_env_cleanup_hook(env, cleanupInspection, context.get()) != napi_ok) return nullptr;
auto context = std::make_unique<RuntimeContext>();
if (napi_add_env_cleanup_hook(env, cleanupRuntimeContext, context.get()) != napi_ok) return nullptr;
// The environment owns callback data before a function can expose it. Failed
// initialization still leaves a valid context for the registered cleanup hook.
auto* data = context.release();
+12 -3
View File
@@ -33,6 +33,9 @@ struct Failure : std::runtime_error {
DWORD win32;
std::wstring path;
std::string constraint;
std::string cleanupConstraint;
DWORD cleanupWin32 = ERROR_SUCCESS;
std::wstring cleanupPath;
// Affirmative proof for a failed runtime-parent admission; omission is unknown.
bool runtimeDirectoryUnallocated = false;
Failure(std::string constraint, std::wstring path = L"", DWORD code = GetLastError())
@@ -96,6 +99,9 @@ struct Runtime : Resource {
std::atomic_bool snapshotCancelled{false};
Runtime() : Resource(Kind::Runtime) {}
};
// A failed, not-yet-published runtime remains owned by its N-API environment
// until a later admission or environment teardown can retry cleanup by handle.
struct RuntimeContext { std::unique_ptr<Runtime> pending; };
struct Process : Resource {
Handle job, process, stdoutRead, stderrRead, stdinWrite;
// Present only for a job with a commit limit; receives the job's notifications.
@@ -120,21 +126,24 @@ std::wstring wide(napi_env env, napi_value value);
double numeric(napi_env env, napi_value value);
std::vector<napi_value> array(napi_env env, napi_value value);
napi_value wrap(napi_env env, std::unique_ptr<Resource> resource);
void publishRuntimeHandle(napi_env env, napi_value observation, std::unique_ptr<Runtime>& runtime);
Resource& resource(napi_env env, napi_value value, Kind kind);
std::unique_ptr<File> openFile(const std::wstring& path, DWORD access = GENERIC_READ,
bool directory = false,
DWORD finalSharing = FILE_SHARE_READ);
napi_value identity(napi_env env, HANDLE handle, const std::wstring& path);
std::unique_ptr<Runtime> createRuntime(const std::wstring& parent, const std::wstring& prefix);
void createRuntime(const std::wstring& parent, const std::wstring& prefix,
std::unique_ptr<Runtime>& owner);
void cleanupFailedRuntime(std::unique_ptr<Runtime>& owner, Failure& primary);
void closeRuntime(Runtime& runtime);
napi_value filesystemCall(napi_env env, const std::wstring& operation,
const std::vector<napi_value>& args);
const std::vector<napi_value>& args, RuntimeContext& context);
std::unique_ptr<Process> spawnProcess(const std::wstring& command, const std::wstring& commandLine,
const std::wstring& cwd, const std::vector<std::wstring>& environment,
bool protocolStdin = false, ULONGLONG memoryLimit = 0);
napi_value processCall(napi_env env, const std::wstring& operation,
const std::vector<napi_value>& args);
napi_value inspect(napi_env env, std::unique_ptr<Runtime>& probe);
napi_value inspect(napi_env env, std::unique_ptr<Runtime>& pending);
} // namespace rea
+65 -20
View File
@@ -184,6 +184,29 @@ static Handle createRelative(HANDLE parent, const std::wstring& name, DWORD acce
return result;
}
void cleanupFailedRuntime(std::unique_ptr<Runtime>& owner, Failure& primary) {
if (!owner || !owner->directory.valid()) {
owner.reset();
return;
}
try {
closeRuntime(*owner);
owner.reset();
} catch (const Failure& cleanup) {
primary.cleanupConstraint = cleanup.constraint;
primary.cleanupWin32 = cleanup.win32;
primary.cleanupPath = cleanup.path;
} catch (const std::exception& cleanup) {
primary.cleanupConstraint = cleanup.what();
primary.cleanupWin32 = ERROR_GEN_FAILURE;
primary.cleanupPath = owner->path;
} catch (...) {
primary.cleanupConstraint = "Unknown runtime cleanup failure";
primary.cleanupWin32 = ERROR_GEN_FAILURE;
primary.cleanupPath = owner->path;
}
}
// Lookup relative to an already-owned directory; path is diagnostic only.
static Handle openRelative(HANDLE parent, const std::wstring& name, DWORD access,
DWORD sharing, ULONG kind, const std::wstring& path) {
@@ -337,7 +360,11 @@ static napi_value readCutterBridgeDescriptor(napi_env env, const std::vector<nap
return result;
}
std::unique_ptr<Runtime> createRuntime(const std::wstring& parentPath, const std::wstring& prefix) {
void createRuntime(const std::wstring& parentPath, const std::wstring& prefix,
std::unique_ptr<Runtime>& owner) {
// A previous failed admission retains the original root handle. Retry that
// owner before allowing this environment to allocate another runtime.
if (owner) { closeRuntime(*owner); owner.reset(); }
std::unique_ptr<File> parent;
try { parent = openFile(parentPath, 0, true); }
catch (Failure& failure) {
@@ -349,24 +376,29 @@ std::unique_ptr<Runtime> createRuntime(const std::wstring& parentPath, const std
std::array<unsigned char, 16> random;
require(BCryptGenRandom(nullptr, random.data(), random.size(), BCRYPT_USE_SYSTEM_PREFERRED_RNG) == 0,
"Generate runtime identity failed", parentPath, ERROR_GEN_FAILURE);
Security security;
auto result = std::make_unique<Runtime>();
const auto name = prefix + hex(random.data(), random.size());
result->path = parent->path + (parent->path.back() == L'\\' ? L"" : L"\\") + name;
Security security;
result->directory = createRelative(parent->get(), name,
DELETE | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES | READ_CONTROL,
true, security, result->path);
result->parents = std::move(parent->handles);
owner = std::move(result);
try {
verifyPrivate(result->directory.get(), result->path, true);
// The owned child pins the parent nonempty before write sharing is relaxed.
parent->handles.back() = openComponent(parent->path, 0, true, FILE_SHARE_READ | FILE_SHARE_WRITE);
result->parents = std::move(parent->handles);
} catch (...) {
FILE_DISPOSITION_INFO deletion{TRUE};
SetFileInformationByHandle(result->directory.get(), FileDispositionInfo, &deletion, sizeof(deletion));
owner->directory = createRelative(owner->parents.back().get(), name,
DELETE | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | READ_CONTROL,
true, security, owner->path);
// FILE_CREATE proves ownership and pins the parent nonempty independently
// of admission validation. A failed validation must not retain a strict
// parent lease that prevents renaming the still-owned child before retry.
owner->parents.back() = openComponent(parent->path, 0, true, FILE_SHARE_READ | FILE_SHARE_WRITE);
verifyPrivate(owner->directory.get(), owner->path, true);
} catch (Failure& primary) {
cleanupFailedRuntime(owner, primary);
throw;
} catch (const std::exception& error) {
Failure primary(error.what(), owner->path, ERROR_GEN_FAILURE);
cleanupFailedRuntime(owner, primary);
throw primary;
}
return result;
}
static std::wstring relativePath(Runtime& root, const std::wstring& relative) {
@@ -441,6 +473,9 @@ static void dispose(HANDLE handle, const std::wstring& path) {
require(GetFileInformationByHandleEx(handle, FileBasicInfo, &info, sizeof(info)), "Read cleanup attributes failed", path);
if ((info.FileAttributes & FILE_ATTRIBUTE_READONLY) != 0) {
info.FileAttributes &= ~FILE_ATTRIBUTE_READONLY;
// Zero means "leave attributes unchanged" to FileBasicInfo. A file whose
// sole attribute was READONLY needs NORMAL to actually clear that marker.
if (info.FileAttributes == 0) info.FileAttributes = FILE_ATTRIBUTE_NORMAL;
require(SetFileInformationByHandle(handle, FileBasicInfo, &info, sizeof(info)), "Clear owned readonly attribute failed", path);
}
FILE_DISPOSITION_INFO deletion{TRUE};
@@ -657,7 +692,8 @@ static napi_value snapshot(napi_env env, napi_value rootValue, Runtime& root,
return promise;
}
napi_value filesystemCall(napi_env env, const std::wstring& operation, const std::vector<napi_value>& args) {
napi_value filesystemCall(napi_env env, const std::wstring& operation,
const std::vector<napi_value>& args, RuntimeContext& context) {
if (operation == L"cutter_bridge_verify_directory") return verifyCutterBridgeDirectory(env, args);
if (operation == L"cutter_bridge_read_descriptor") return readCutterBridgeDescriptor(env, args);
const auto expected = operation == L"open" || operation == L"close" || operation == L"runtime_close" || operation == L"runtime_snapshot_cancel" ? 1
@@ -691,12 +727,21 @@ napi_value filesystemCall(napi_env env, const std::wstring& operation, const std
return result;
}
if (operation == L"runtime_create") {
auto root = createRuntime(wide(env, args[0]), wide(env, args[1]));
auto result = identity(env, root->directory.get(), root->path);
set(env, result, "path", string(env, root->path));
set(env, result, "privateDacl", boolean(env, true));
set(env, result, "handle", wrap(env, std::move(root)));
return result;
createRuntime(wide(env, args[0]), wide(env, args[1]), context.pending);
try {
auto result = identity(env, context.pending->directory.get(), context.pending->path);
set(env, result, "path", string(env, context.pending->path));
set(env, result, "privateDacl", boolean(env, true));
publishRuntimeHandle(env, result, context.pending);
return result;
} catch (Failure& primary) {
cleanupFailedRuntime(context.pending, primary);
throw;
} catch (const std::exception& error) {
Failure primary(error.what(), context.pending ? context.pending->path : L"", ERROR_GEN_FAILURE);
cleanupFailedRuntime(context.pending, primary);
throw primary;
}
}
auto& root = static_cast<Runtime&>(resource(env, args[0], Kind::Runtime));
require(!root.closing || operation == L"runtime_close", "Runtime cleanup is pending", root.path, ERROR_BUSY);
+16 -6
View File
@@ -454,17 +454,27 @@ napi_value processCall(napi_env env, const std::wstring& operation, const std::v
throw Failure("Unknown native process operation", L"", ERROR_INVALID_PARAMETER);
}
napi_value inspect(napi_env env, std::unique_ptr<Runtime>& probe) {
napi_value inspect(napi_env env, std::unique_ptr<Runtime>& pending) {
// Settle the previous owner before admitting another probe. Failed cleanup
// retains its handles, including when identity construction itself failed.
if (probe) { closeRuntime(*probe); probe.reset(); }
if (pending) { closeRuntime(*pending); pending.reset(); }
wchar_t temp[32768];
const auto length = GetTempPathW(32768, temp);
require(length > 0 && length < 32768, "Read temporary directory coordinate failed");
probe = createRuntime(std::wstring(temp, length), L"rea-native-probe-");
auto filesystem = identity(env, probe->directory.get(), probe->path);
closeRuntime(*probe);
probe.reset();
createRuntime(std::wstring(temp, length), L"rea-native-probe-", pending);
napi_value filesystem;
try {
filesystem = identity(env, pending->directory.get(), pending->path);
} catch (Failure& primary) {
cleanupFailedRuntime(pending, primary);
throw;
} catch (const std::exception& error) {
Failure primary(error.what(), pending ? pending->path : L"", ERROR_GEN_FAILURE);
cleanupFailedRuntime(pending, primary);
throw primary;
}
closeRuntime(*pending);
pending.reset();
auto job = createJob();
Attributes attributes(1);
HANDLE raw = job.get();
+19
View File
@@ -34,6 +34,7 @@
"isomorphic-git": "1.38.7",
"jsonc-parser": "3.3.1",
"lossless-json": "4.3.1",
"openpgp": "6.3.2",
"parse5": "8.0.1",
"pino": "10.4.0",
"playwright-core": "1.58.2",
@@ -7871,6 +7872,24 @@
"regex-recursion": "^6.0.2"
}
},
"node_modules/openpgp": {
"version": "6.3.2",
"resolved": "https://registry.npmjs.org/openpgp/-/openpgp-6.3.2.tgz",
"integrity": "sha512-wcZTzHz41LV8Y48zH/JlD1JT8YdNmpWOuMAjQ/podvvCwsjBEU37K3znJh4UQcj3hksE5z9TzvhbUbwzsGvlLQ==",
"license": "LGPL-3.0+",
"engines": {
"node": ">= 18.0.0",
"typescript": ">= 5.0.0"
},
"peerDependencies": {
"@openpgp/web-stream-tools": "~0.3.0"
},
"peerDependenciesMeta": {
"@openpgp/web-stream-tools": {
"optional": true
}
}
},
"node_modules/oxc-parser": {
"version": "0.150.0",
"resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.150.0.tgz",
+5 -2
View File
@@ -194,6 +194,7 @@
"verify:ghidra:swift": "npm run build:cached && node scripts/verify-real-ghidra-swift.mjs",
"verify:ida": "npm run build:cached && node scripts/verify-real-ida.mjs",
"verify:ghidra:switch": "npm run build:cached && node scripts/verify-real-ghidra-switch.mjs",
"verify:kuna": "npm run build:cached && node scripts/verify-real-kuna.mjs",
"verify:ghidra:dos": "npm run build:cached && node scripts/verify-real-ghidra-dos.mjs",
"verify:ghidra:com": "npm run build:cached && node scripts/verify-real-ghidra-com.mjs",
"verify:ghidra:raw": "npm run build:cached && node scripts/verify-real-ghidra-raw.mjs",
@@ -212,6 +213,7 @@
"verify:javascript-runtime": "npm run build:cached && node scripts/verify/javascript/runtime-observation.mjs",
"verify:javascript:digests": "npm run build:cached && node scripts/verify/javascript/digests.mjs",
"verify:javascript:output": "npm run build:cached && node scripts/verify/javascript/output.mjs",
"verify:javascript:module-references": "npm run build:cached && node scripts/verify/javascript/module-references.mjs",
"verify:application-workflows": "npm run build:cached && node scripts/verify/javascript/application-workflows.mjs",
"verify:managed": "npm run build:cached && node scripts/verify/managed/conformance.mjs",
"verify:firmware": "npm run build:cached && node scripts/verify/firmware/analysis.mjs",
@@ -290,8 +292,8 @@
"verify:solidity:metadata": "npm run build:cached && node scripts/verify-solidity-metadata.mjs",
"verify:recorded:crash": "npm run build:cached && node scripts/verify-recorded-crash.mjs",
"mcp-catalog:check:built": "node scripts/generate-mcp-tool-catalog.mjs --check",
"compile": "node scripts/clean-build-output.mjs && tsc -p tsconfig.build.json && node scripts/bundle-runtime.mjs",
"compile:termux": "node scripts/clean-build-output.mjs && node --max-old-space-size=3072 node_modules/typescript-termux/lib/tsc.js -p tsconfig.build.json && node scripts/bundle-runtime.mjs",
"compile": "node scripts/clean-build-output.mjs && tsc -p tsconfig.build.json && node scripts/record-catalog-digests.mjs && node scripts/bundle-runtime.mjs",
"compile:termux": "node scripts/clean-build-output.mjs && node --max-old-space-size=3072 node_modules/typescript-termux/lib/tsc.js -p tsconfig.build.json && node scripts/record-catalog-digests.mjs && node scripts/bundle-runtime.mjs",
"artifacts:mcp-catalog": "node scripts/generate-mcp-tool-catalog.mjs",
"artifacts:skills": "node scripts/generate-skill-metadata.mjs",
"artifacts:product-catalog": "node scripts/generate-product-catalog.mjs",
@@ -337,6 +339,7 @@
"isomorphic-git": "1.38.7",
"jsonc-parser": "3.3.1",
"lossless-json": "4.3.1",
"openpgp": "6.3.2",
"parse5": "8.0.1",
"pino": "10.4.0",
"playwright-core": "1.58.2",
+1
View File
@@ -138,6 +138,7 @@ export const SCOPES = {
"src/domain/javascript/javascriptRuntimeStaticCandidates.ts",
"tests/boundary/filesystem/webScriptManifestPaths.test.ts",
"tests/boundary/process/ProcessEvidence.host.test.ts",
"tests/boundary/process/packageNpmInvocation.test.ts",
"tests/boundary/process/windowsOutputCapture.test.ts",
"tests/acceptance/webModuleCli.test.ts",
"tests/acceptance/webSourceLocationCli.test.ts",
+146 -40
View File
@@ -3,42 +3,52 @@ import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { writeWindowsGhidraByteSearchFixture } from "./lib/ghidra-windows-byte-search.mjs";
import {
WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES,
windowsGhidraFixtureOptions,
} from "./lib/ghidra-windows-fixture-options.mjs";
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
// Source-owned static fixtures: no compiler, target loading or execution.
for (const architecture of ["x86_64", "x86"]) {
for (const architecture of WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES) {
for (const dll of [false, true]) {
const x86 = architecture === "x86";
const output = resolve(
root,
"build",
"fixtures",
`rea-ghidra-windows${x86 ? "-x86" : ""}.${dll ? "dll" : "exe"}`,
);
const arm = architecture === "arm";
const arm64 = architecture === "arm64";
const fixture = windowsGhidraFixtureOptions([
...(architecture === "x86_64" ? [] : [`--${architecture}`]),
...(dll ? ["--dll"] : []),
]);
const pe32 = fixture.pe32;
const output = resolve(root, "build", "fixtures", fixture.filename);
const bytes = Buffer.alloc(dll ? 1024 : 1536);
const peOffset = 0x80;
const optionalHeader = peOffset + 24;
const optionalHeaderSize = x86 ? 0xe0 : 0xf0;
const optionalHeaderSize = pe32 ? 0xe0 : 0xf0;
const sectionTable = optionalHeader + optionalHeaderSize;
const directories = optionalHeader + (x86 ? 96 : 112);
const directories = optionalHeader + (pe32 ? 96 : 112);
bytes.write("MZ", 0, "ascii");
bytes.writeUInt32LE(peOffset, 0x3c);
bytes.write("PE\0\0", peOffset, "binary");
bytes.writeUInt16LE(x86 ? 0x14c : 0x8664, peOffset + 4);
// The fixture descriptor owns COFF machine, width and function coordinates.
bytes.writeUInt16LE(fixture.machine, peOffset + 4);
bytes.writeUInt16LE(dll ? 1 : 2, peOffset + 6);
bytes.writeUInt16LE(optionalHeaderSize, peOffset + 20);
bytes.writeUInt16LE(
(x86 ? 0x102 : 0x22) | (dll ? 0x2000 : 0),
(pe32 ? 0x102 : 0x22) | (dll ? 0x2000 : 0),
peOffset + 22,
);
bytes.writeUInt16LE(x86 ? 0x10b : 0x20b, optionalHeader);
// ARM64 PE uses the PE32+ optional header (magic 0x20b), like x86-64.
bytes.writeUInt16LE(pe32 ? 0x10b : 0x20b, optionalHeader);
bytes.writeUInt32LE(0x200, optionalHeader + 4);
if (!dll) bytes.writeUInt32LE(0x200, optionalHeader + 8);
bytes.writeUInt32LE(dll ? 0 : 0x1000, optionalHeader + 16);
bytes.writeUInt32LE(dll ? 0 : arm ? 0x1001 : 0x1000, optionalHeader + 16);
bytes.writeUInt32LE(0x1000, optionalHeader + 20);
if (x86) bytes.writeUInt32LE(0x400000, optionalHeader + 28);
else bytes.writeBigUInt64LE(0x1_4000_0000n, optionalHeader + 24);
if (pe32)
bytes.writeUInt32LE(Number(fixture.imageBase), optionalHeader + 28);
else bytes.writeBigUInt64LE(fixture.imageBase, optionalHeader + 24);
bytes.writeUInt32LE(0x1000, optionalHeader + 32);
bytes.writeUInt32LE(0x200, optionalHeader + 36);
bytes.writeUInt16LE(6, optionalHeader + 40);
@@ -46,8 +56,8 @@ for (const architecture of ["x86_64", "x86"]) {
bytes.writeUInt32LE(dll ? 0x2000 : 0x3000, optionalHeader + 56);
bytes.writeUInt32LE(0x200, optionalHeader + 60);
bytes.writeUInt16LE(3, optionalHeader + 68);
bytes.writeUInt16LE(x86 ? 0x8140 : 0x8160, optionalHeader + 70);
if (x86) {
bytes.writeUInt16LE(pe32 ? 0x8140 : 0x8160, optionalHeader + 70);
if (pe32) {
bytes.writeUInt32LE(0x10_0000, optionalHeader + 72);
bytes.writeUInt32LE(0x1000, optionalHeader + 76);
bytes.writeUInt32LE(0x10_0000, optionalHeader + 80);
@@ -69,13 +79,97 @@ for (const architecture of ["x86_64", "x86"]) {
bytes.writeUInt32LE(0x6000_0020, sectionTable + 36);
// EXE entry returns zero. DLL caller adds one to the callee's 42.
bytes.set(
dll
? [0xe8, 0x0b, 0, 0, 0, 0x83, 0xc0, 1, 0xc3]
: [0xe8, 0x0b, 0, 0, 0, 0xe8, 0x16, 0, 0, 0, 0x31, 0xc0, 0xc3],
0x200,
);
bytes.set([0xb8, 0x2a, 0, 0, 0, 0xc3], 0x210);
if (arm) {
// ARMNT uses Thumb instructions and low-bit-tagged PE entry/export RVAs.
// PUSH keeps SP aligned and preserves LR across BL from 0x1002 to 0x1020.
bytes.set(
[
0x10,
0xb5,
0x00,
0xf0,
0x0d,
0xf8,
dll ? 0x01 : 0x00,
dll ? 0x30 : 0x20,
0x10,
0xbd,
],
0x200,
);
bytes.set([0x2a, 0x20, 0x70, 0x47], 0x220);
} else if (arm64) {
// Preserve the caller's frame/link registers across BL. The callee
// starts at RVA 0x1020, outside the five-instruction caller.
const instructions = [
0xa9bf7bfd, // STP X29, X30, [SP, #-16]!
0x94000007, // BL +0x1c from RVA 0x1004 to RVA 0x1020
dll ? 0x11000400 : 0x52800000, // ADD W0,W0,#1 / MOV W0,#0
0xa8c17bfd, // LDP X29, X30, [SP], #16
0xd65f03c0, // RET
];
for (const [index, instruction] of instructions.entries())
bytes.writeUInt32LE(instruction, 0x200 + index * 4);
bytes.set([0x40, 0x05, 0x80, 0x52, 0xc0, 0x03, 0x5f, 0xd6], 0x220);
} else {
bytes.set(
dll
? [0xe8, 0x0b, 0, 0, 0, 0x83, 0xc0, 1, 0xc3]
: [0xe8, 0x0b, 0, 0, 0, 0xe8, 0x16, 0, 0, 0, 0x31, 0xc0, 0xc3],
0x200,
);
bytes.set(
x86 && !dll
? [0xb8, 0x2a, 0, 0, 0, 0xe8, 0x66, 0, 0, 0, 0xc3]
: [0xb8, 0x2a, 0, 0, 0, 0xc3],
0x210,
);
}
if (x86 && !dll) {
// A statically analyzed Borland-style SEH registration whose handler
// entry is referenced but is not part of the registering function body.
bytes.set(
[
0x55, // PUSH EBP
0x89,
0xe5, // MOV EBP, ESP
0x68,
0xc0,
0x10,
0x40,
0x00, // PUSH 0x4010c0
0x64,
0xff,
0x35,
0,
0,
0,
0, // PUSH DWORD PTR FS:[0]
0x64,
0x89,
0x25,
0,
0,
0,
0, // MOV DWORD PTR FS:[0], ESP
0x64,
0x8f,
0x05,
0,
0,
0,
0, // POP DWORD PTR FS:[0]
0x83,
0xc4,
0x04, // ADD ESP, 4
0x5d, // POP EBP
0xc3, // RET
],
0x280,
);
bytes.set([0xc3], 0x2c0);
}
if (!dll) {
const dataSection = sectionTable + 40;
@@ -99,19 +193,31 @@ for (const architecture of ["x86_64", "x86"]) {
"ffd7", // CALL EDI: unknown target.
"c3",
]
: [
"488d15d90f0000", // LEA RDX, [RIP + displacement]: DATA.
"8b05d30f0000", // MOV EAX, [RIP + displacement]: READ.
"8905d10f0000", // MOV [RIP + displacement], EAX: WRITE.
"488d15d60f0000", // Indexed base, unknown RCX.
"85db", // TEST EBX, EBX: two candidate bases.
"7407", // JZ over the alternate base.
"488d15d30f0000", // LEA RDX, alternate base.
"c6040a01", // MOV byte [RDX + RCX], 1.
"41ffd0", // CALL R8: unknown target.
"c3",
];
bytes.set(Buffer.from(referenceInstructions.join(""), "hex"), 0x220);
: arm
? ["7047"] // Thumb return; x86 reference-flow controls do not apply.
: arm64
? [
"010000b0", // ADRP X1, .data page (RVA 0x2000): DATA.
"200040b9", // LDR W0, [X1]: READ.
"200000b9", // STR W0, [X1]: WRITE.
"c0035fd6", // RET.
]
: [
"488d15d90f0000", // LEA RDX, [RIP + displacement]: DATA.
"8b05d30f0000", // MOV EAX, [RIP + displacement]: READ.
"8905d10f0000", // MOV [RIP + displacement], EAX: WRITE.
"488d15d60f0000", // Indexed base, unknown RCX.
"85db", // TEST EBX, EBX: two candidate bases.
"7407", // JZ over the alternate base.
"488d15d30f0000", // LEA RDX, alternate base.
"c6040a01", // MOV byte [RDX + RCX], 1.
"41ffd0", // CALL R8: unknown target.
"c3",
];
bytes.set(
Buffer.from(referenceInstructions.join(""), "hex"),
arm || arm64 ? 0x230 : 0x220,
);
}
if (dll) {
@@ -126,8 +232,8 @@ for (const architecture of ["x86_64", "x86"]) {
bytes.writeUInt32LE(0x1080, exports + 28);
bytes.writeUInt32LE(0x1088, exports + 32);
bytes.writeUInt32LE(0x1090, exports + 36);
bytes.writeUInt32LE(0x1000, 0x280);
bytes.writeUInt32LE(0x1010, 0x284);
bytes.writeUInt32LE(arm ? 0x1001 : 0x1000, 0x280);
bytes.writeUInt32LE(fixture.calleeRva + (arm ? 1 : 0), 0x284);
bytes.writeUInt32LE(0x1120, 0x288);
bytes.writeUInt32LE(0x1140, 0x28c);
bytes.writeUInt16LE(0, 0x290);
@@ -141,6 +247,6 @@ for (const architecture of ["x86_64", "x86"]) {
await mkdir(dirname(output), { recursive: true });
await writeFile(output, bytes);
if (!x86 && !dll) process.stdout.write(`${output}\n`);
if (architecture === "x86_64" && !dll) process.stdout.write(`${output}\n`);
}
}
+14 -1
View File
@@ -12,13 +12,22 @@ export async function startBrowserVerifierSite() {
return;
}
const requestUrl = new URL(request.url ?? "/", "http://127.0.0.1");
if (requestUrl.pathname === "/scenario-request-language") {
response.setHeader("content-type", "application/json");
response.setHeader("cache-control", "no-store");
response.end(JSON.stringify(request.headers["accept-language"] ?? null));
return;
}
if (requestUrl.pathname === "/scenario-environment") {
const requestedRun = requestUrl.searchParams.get("run");
const run = ["A", "B", "C"].includes(requestedRun)
? requestedRun
: "default";
response.setHeader("content-type", "text/html");
response.end(`<!doctype html><html><body data-run="${run}"><pre id="environment"></pre>
const requestLanguage = encodeURIComponent(
JSON.stringify(request.headers["accept-language"] ?? null),
);
response.end(`<!doctype html><html><body data-run="${run}" data-request-language="${requestLanguage}"><pre id="environment"></pre><pre id="language"></pre>
<button id="refresh-environment">Refresh environment</button><script>
const refresh = () => document.querySelector('#environment').textContent = JSON.stringify({
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -26,6 +35,10 @@ export async function startBrowserVerifierSite() {
dpr: devicePixelRatio, width: innerWidth, height: innerHeight
});
document.querySelector('#refresh-environment').onclick = refresh;
document.querySelector('#language').textContent = JSON.stringify({
language: navigator.language, languages: [...navigator.languages],
request_language: JSON.parse(decodeURIComponent(document.body.dataset.requestLanguage))
});
window.releaseScenario = () => {
const release = document.createElement('span');
release.id = 'release-' + document.body.dataset.run;
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
"""POSIX fault fixture for the optional module-reference token counter.
Use as --tokenizer-python with an explicit REA_TOKENIZER_PROBE_RECORD path.
It deliberately ignores the counter arguments, forks a detached helper that
ignores SIGTERM, and stalls. The production owned-command supervisor must
terminate the verified family. Recorded PIDs are observations, not authority
to signal a process; verification also checks the owned scope after exit.
"""
import json
import os
from pathlib import Path
import signal
import time
def main():
record = Path(os.environ["REA_TOKENIZER_PROBE_RECORD"])
child = os.fork()
if child == 0:
os.setsid()
signal.signal(signal.SIGTERM, signal.SIG_IGN)
record.write_text(json.dumps({
"pid": os.getpid(),
"group": os.getpgrp(),
"parent": os.getppid(),
"run_id": os.environ.get("REA_PROCESS_RUN_ID"),
"detached": True,
"ignores_sigterm": True,
}) + "\n", encoding="utf-8")
time.sleep(30)
if __name__ == "__main__":
main()
+12 -10
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Inspect or activate Hopper's version-pinned demo dialog on a private X display."""
"""Inspect or activate Hopper's authenticated demo dialog on a private X display."""
from __future__ import annotations
@@ -8,6 +8,7 @@ import ctypes
import hashlib
import json
import os
import re
from pathlib import Path
import secrets
import select
@@ -18,12 +19,6 @@ import threading
import time
# Keep this digest aligned with LinuxHopper.ts and rerun real-Hopper verification
# before accepting another vendor build.
SUPPORTED_HOPPER_SHA256 = {
"0294ced141cc373468ee22d8343e7dac41980cb05a937994ca81c9f09afe7ded",
"1339f9e58377442b0c6fcb0dfc3cec20d593cc557408521fad9a00dbc6b8da13",
}
EXPECTED_SCREEN = (1280, 1024)
DIALOG_TITLES = {"Registration", "Registration — Hopper Disassembler"}
HOPPER_WINDOW_TITLE = "Hopper Disassembler"
@@ -121,6 +116,7 @@ def parse_args() -> argparse.Namespace:
parser.add_argument("--probe", action="store_true")
parser.add_argument("--owner-stdin", action="store_true")
parser.add_argument("--hopper")
parser.add_argument("--expected-launcher-sha256")
parser.add_argument("--socket")
parser.add_argument(
"--strategy",
@@ -661,7 +657,11 @@ def run_probe(args: argparse.Namespace) -> dict[str, object]:
def run_launch(args: argparse.Namespace) -> int:
if args.hopper is None or args.socket is None:
if (
args.hopper is None or args.socket is None
or args.expected_launcher_sha256 is None
or re.fullmatch(r"[a-f0-9]{64}", args.expected_launcher_sha256) is None
):
raise AdapterFailure(
INVALID_LAUNCH_COMMAND,
"invalid_launch_command",
@@ -673,7 +673,9 @@ def run_launch(args: argparse.Namespace) -> int:
hopper = Path(args.hopper)
socket = Path(args.socket)
try:
supported = digest(hopper) in SUPPORTED_HOPPER_SHA256
# The parent owns publisher/package interpretation. Recheck its admitted
# launcher bytes immediately before execution, preserving all X11 guards.
supported = digest(hopper) == args.expected_launcher_sha256
except OSError as error:
raise AdapterFailure(
INVALID_LAUNCH_COMMAND,
@@ -684,7 +686,7 @@ def run_launch(args: argparse.Namespace) -> int:
raise AdapterFailure(
UNSUPPORTED_HOPPER_BUILD,
"unsupported_hopper_build",
"unsupported Hopper binary",
"Hopper binary differs from the authenticated release",
)
command = args.command[1:] if args.command[:1] == ["--"] else args.command
if not command or Path(command[0]).resolve() != hopper.resolve():
+160 -86
View File
@@ -4,11 +4,14 @@ import { fileURLToPath } from "node:url";
import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { CdpCommandRejection } from "../../dist/browser/CdpCommandRejection.js";
import { CdpConnection } from "../../dist/browser/CdpConnection.js";
import { createBrowserScenarioProvider } from "../../dist/composition/browserScenario.js";
import { browserScenarioSchema } from "../../dist/domain/browserScenario.js";
import { AnalysisCancelledError } from "../../dist/domain/analysisErrorCore.js";
import { runScenarioCli } from "./browser-scenario-verifier.mjs";
import { requireMcpEvidenceResult } from "./mcp-verifier-results.mjs";
import { closeVerifierResources } from "./verifier-cleanup.mjs";
const expected = {
timezone: "Pacific/Honolulu",
@@ -24,12 +27,24 @@ const alternate = {
width: 700,
height: 500,
};
const expression = `JSON.stringify({
const environmentExpression = `{
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
locale: Intl.DateTimeFormat().resolvedOptions().locale,
dpr: devicePixelRatio, width: innerWidth, height: innerHeight
}`;
const expression = `JSON.stringify(${environmentExpression})`;
const scenarioSnapshotExpression = `JSON.stringify({
timeOrigin: performance.timeOrigin,
environment: ${environmentExpression},
run: document.body?.dataset.run ?? null
})`;
const isNavigationTransitionRejection = (cause) =>
cause instanceof CdpCommandRejection &&
cause.command === "Runtime.evaluate" &&
cause.code === -32_000 &&
cause.reportedMessage === "Inspected target navigated or closed";
const environmentScenario = ({ endpoint, targetId, origin, values, run }) =>
browserScenarioSchema.parse({
browser: { mode: "connect", cdp_endpoint: endpoint, target_id: targetId },
@@ -82,8 +97,32 @@ const assertCapture = (capture, values = expected) => {
}
};
const assertCallerLanguage = (capture, baseline) => {
assert.ok(
capture.limitations.some((value) =>
value.includes("Attached locale fr-FR applies to Intl formatting only"),
),
"Attached capture must identify its page/request language limitation",
);
for (const step of capture.steps) {
const text = step.artifacts.dom.value.text;
const observed = /<pre id="language">([^<]+)<\/pre>/u.exec(text);
assert.ok(
observed,
"DOM omitted the navigator/request language observations",
);
assert.deepEqual(JSON.parse(observed[1]), baseline);
}
};
/** Verify actual attached-page emulation and restoration across scenario outcomes. */
export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
const languageExpression = `(async () => JSON.stringify({
language: navigator.language, languages: [...navigator.languages],
request_language: await (await fetch(
${JSON.stringify(`${origin}/scenario-request-language`)}, { cache: "no-store" }
)).json()
}))()`;
const targets = await (await fetch(`${endpoint}/json/list`)).json();
const target = targets.find(({ id }) => id === targetId);
assert.ok(target, "External fixture target is missing");
@@ -91,28 +130,38 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
target.webSocketDebuggerUrl,
"capture_browser_scenario",
);
const readEnvironment = async () => {
const readEnvironment = async (expressionToRead = expression) => {
const value = await connection.send("Runtime.evaluate", {
expression,
expression: expressionToRead,
returnByValue: true,
awaitPromise: true,
});
assert.equal(value.result.type, "string");
return JSON.parse(value.result.value);
};
const baseline = await readEnvironment();
const scenario = environmentScenario({
endpoint,
targetId,
origin,
values: expected,
});
const assertRestored = async () => {
assert.deepEqual(await readEnvironment(), baseline);
const remaining = await (await fetch(`${endpoint}/json/list`)).json();
assert.ok(remaining.some(({ id }) => id === targetId));
};
const provider = createBrowserScenarioProvider(process.env);
let verificationError;
try {
assertCapture((await runScenarioCli(scenario)).normalized_result);
const baseline = await readEnvironment();
const callerLanguage = await readEnvironment(languageExpression);
const scenario = environmentScenario({
endpoint,
targetId,
origin,
values: expected,
});
const assertRestored = async () => {
assert.deepEqual(await readEnvironment(), baseline);
assert.deepEqual(
await readEnvironment(languageExpression),
callerLanguage,
);
const remaining = await (await fetch(`${endpoint}/json/list`)).json();
assert.ok(remaining.some(({ id }) => id === targetId));
};
const cliCapture = (await runScenarioCli(scenario)).normalized_result;
assertCapture(cliCapture);
assertCallerLanguage(cliCapture, callerLanguage);
await assertRestored();
const transport = new StdioClientTransport({
command: process.execPath,
@@ -130,15 +179,15 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
({ name }) => name === "capture_browser_scenario",
);
assert.ok(definition, "Scenario tool is absent from the current catalog");
assertCapture(
requireMcpEvidenceResult(
await client.callTool(
{ name: "capture_browser_scenario", arguments: scenario },
{ toolDefinition: definition },
),
"capture_browser_scenario",
const mcpCapture = requireMcpEvidenceResult(
await client.callTool(
{ name: "capture_browser_scenario", arguments: scenario },
{ toolDefinition: definition },
),
"capture_browser_scenario",
);
assertCapture(mcpCapture);
assertCallerLanguage(mcpCapture, callerLanguage);
await verifyConcurrentMcpCapture({
client,
definition,
@@ -146,7 +195,6 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
endpoint,
targetId,
origin,
readEnvironment,
assertRestored,
});
} finally {
@@ -154,7 +202,6 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
await transport.close();
}
await assertRestored();
const provider = createBrowserScenarioProvider(process.env);
const initializationFailure = await provider.captureScenario({
...scenario,
environment: { ...scenario.environment, timezone: "REA/Invalid" },
@@ -178,12 +225,7 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
assertCapture(actionFailure.value);
assert.equal(actionFailure.value.steps.at(-1).status, "failed");
await assertRestored();
await verifyCancelledEnvironment(
provider,
connection,
waiting,
readEnvironment,
);
await verifyCancelledEnvironment(provider, connection, waiting);
await assertRestored();
return {
mocked: false,
@@ -191,13 +233,21 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
stdio_mcp: true,
observed: expected,
restored: baseline,
caller_language_preserved: callerLanguage,
attached_locale_limitation: true,
initialization_failure_cleanup: true,
action_failure_cleanup: true,
cancellation_cleanup: true,
external_target_preserved: true,
};
} catch (cause) {
verificationError = cause;
throw cause;
} finally {
await connection.close();
await closeVerifierResources(
[() => provider.close(), () => connection.close()],
verificationError,
);
}
}
@@ -208,7 +258,6 @@ const verifyConcurrentMcpCapture = async ({
endpoint,
targetId,
origin,
readEnvironment,
assertRestored,
}) => {
const firstScenario = environmentScenario({
@@ -241,12 +290,13 @@ const verifyConcurrentMcpCapture = async ({
try {
const first = callTool(firstScenario, firstCancellation.signal);
await waitForEnvironment(readEnvironment, connection, expected, "A");
await waitForEnvironment(connection, expected, "A");
const second = callTool(secondScenario, secondCancellation.signal);
await client.ping();
assert.deepEqual(await readEnvironment(), expected);
assert.equal(await readScenarioRun(connection), "A");
const firstSnapshot = await readScenarioSnapshot(connection);
assert.deepEqual(firstSnapshot.environment, expected);
assert.equal(firstSnapshot.run, "A");
const cancelled = callTool(
environmentScenario({
@@ -261,8 +311,9 @@ const verifyConcurrentMcpCapture = async ({
await client.ping();
cancellation.abort(new Error("cancel queued browser scenario"));
await assert.rejects(cancelled, /cancel queued browser scenario/u);
assert.deepEqual(await readEnvironment(), expected);
assert.equal(await readScenarioRun(connection), "A");
const queuedSnapshot = await readScenarioSnapshot(connection);
assert.deepEqual(queuedSnapshot.environment, expected);
assert.equal(queuedSnapshot.run, "A");
await releaseScenario(connection);
assertCapture(
@@ -270,7 +321,7 @@ const verifyConcurrentMcpCapture = async ({
expected,
);
await waitForEnvironment(readEnvironment, connection, alternate, "B");
await waitForEnvironment(connection, alternate, "B");
await releaseScenario(connection);
assertCapture(
requireMcpEvidenceResult(await second, "capture_browser_scenario"),
@@ -287,31 +338,57 @@ const verifyConcurrentMcpCapture = async ({
}
};
const waitForEnvironment = async (
readEnvironment,
connection,
expectedValues,
run,
) => {
const deadline = Date.now() + 10_000;
while (Date.now() < deadline) {
if (
JSON.stringify(await readEnvironment()) ===
JSON.stringify(expectedValues) &&
(await readScenarioRun(connection)) === run
)
return;
await delay(25);
}
throw new Error(`Scenario ${run} never reached its page-controlled gate`);
const waitForEnvironment = async (connection, expectedValues, run) => {
await waitForScenarioSnapshot(
connection,
(snapshot) =>
JSON.stringify(snapshot.environment) === JSON.stringify(expectedValues) &&
snapshot.run === run,
`Scenario ${run} never reached its page-controlled gate`,
);
};
const readScenarioRun = async (connection) => {
const value = await connection.send("Runtime.evaluate", {
expression: "document.body.dataset.run ?? null",
returnByValue: true,
});
return value.result.value;
const waitForScenarioSnapshot = async (connection, accept, message) => {
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 10_000);
let lastTransitionRejection;
try {
while (!controller.signal.aborted) {
try {
const snapshot = await readScenarioSnapshot(
connection,
controller.signal,
);
if (controller.signal.aborted) break;
if (accept(snapshot)) return;
} catch (cause) {
if (
controller.signal.aborted &&
cause instanceof AnalysisCancelledError
)
break;
if (!isNavigationTransitionRejection(cause)) throw cause;
lastTransitionRejection = cause;
}
await delay(25);
}
throw new Error(message, {
cause: lastTransitionRejection ?? controller.signal.reason,
});
} finally {
clearTimeout(timer);
}
};
const readScenarioSnapshot = async (connection, signal) => {
const value = await connection.send(
"Runtime.evaluate",
{ expression: scenarioSnapshotExpression, returnByValue: true },
undefined,
signal,
);
assert.equal(value.result.type, "string");
return JSON.parse(value.result.value);
};
const releaseScenario = async (connection) => {
@@ -321,44 +398,41 @@ const releaseScenario = async (connection) => {
});
};
async function verifyCancelledEnvironment(
export async function verifyCancelledEnvironment(
provider,
connection,
scenario,
readEnvironment,
) {
const controller = new AbortController();
const priorNavigation = await connection.send("Runtime.evaluate", {
expression: "performance.timeOrigin",
returnByValue: true,
});
const priorSnapshot = await readScenarioSnapshot(connection);
const pending = provider.captureScenario(
{ ...scenario, actions: [{ ...scenario.actions[0], timeout_ms: 30_000 }] },
{ signal: controller.signal },
);
const settlement = Promise.allSettled([pending]);
try {
const deadline = Date.now() + 10_000;
while (true) {
const navigation = await connection.send("Runtime.evaluate", {
expression: "performance.timeOrigin",
returnByValue: true,
});
if (
navigation.result.value !== priorNavigation.result.value &&
JSON.stringify(await readEnvironment()) === JSON.stringify(expected)
)
break;
assert.ok(Date.now() < deadline, "Scenario never applied emulation");
await delay(25);
}
await waitForScenarioSnapshot(
connection,
(snapshot) =>
snapshot.timeOrigin !== priorSnapshot.timeOrigin &&
JSON.stringify(snapshot.environment) === JSON.stringify(expected),
"Scenario never applied emulation",
);
await delay(100);
} finally {
controller.abort();
await settlement;
}
const cancelled = await pending;
assert.ok(
!cancelled.ok ||
if (!cancelled.ok) {
if (!(cancelled.error instanceof AnalysisCancelledError))
throw cancelled.error;
assert.equal(cancelled.error.cleanupIncomplete, false);
} else {
assert.ok(
cancelled.value.steps.some(({ status }) => status === "cancelled"),
"Cancellation unexpectedly completed every action",
);
"Cancellation unexpectedly completed every action",
);
assert.equal(cancelled.value.browser.cleanup, "disconnected-external");
}
}
+88 -48
View File
@@ -10,6 +10,7 @@ import {
runScenarioCli,
scenarioProfiles,
} from "./browser-scenario-verifier.mjs";
import { closeVerifierResources } from "./verifier-cleanup.mjs";
const scenarioFor = (browser, origin) =>
browserScenarioSchema.parse({
@@ -299,6 +300,7 @@ const verifyConnectedStorage = async (endpoint, targetId, origin) => {
target.webSocketDebuggerUrl,
"capture_browser_scenario",
);
let failure;
try {
await assertStorageKeyPartition(observer, origin);
const result = await runScenarioCli(scenario);
@@ -313,11 +315,14 @@ const verifyConnectedStorage = async (endpoint, targetId, origin) => {
assert.equal(capture.browser.cleanup, "disconnected-external");
await verifyCallerDebuggerPause(observer, origin, scenario);
await verifyCancelledStorage(observer, endpoint, targetId, scenario);
} catch (cause) {
failure = cause;
throw cause;
} finally {
await raceWithTimeout(restoreTarget(observer, target.url), 1_000).catch(
() => undefined,
await closeVerifierResources(
[() => restoreTarget(observer, target.url), () => observer.close()],
failure,
);
await raceWithTimeout(observer.close(), 1_000).catch(() => undefined);
}
};
@@ -503,7 +508,8 @@ const verifyCallerDebuggerPause = async (caller, origin, scenario) => {
],
});
let settled = false;
const pending = createBrowserScenarioProvider(process.env)
const provider = createBrowserScenarioProvider(process.env);
const pending = provider
.captureScenario(debuggerScenario, { signal: controller.signal })
.finally(() => {
settled = true;
@@ -586,9 +592,10 @@ const verifyCallerDebuggerPause = async (caller, origin, scenario) => {
});
} finally {
unsubscribe();
await raceWithTimeout(caller.send("Debugger.disable"), 1_000).catch(
() => undefined,
);
await closeVerifierResources([
() => caller.send("Debugger.disable"),
() => provider.close(),
]);
}
};
@@ -615,38 +622,48 @@ const verifyCancelledStorage = async (
expression: "performance.timeOrigin",
returnByValue: true,
});
const pending = createBrowserScenarioProvider(process.env).captureScenario(
cancelledScenario,
{ signal: controller.signal },
);
await waitForNewDocument(
observer,
"/storage-main",
priorDocument.result.value,
);
const state = await observer.send("Runtime.evaluate", {
expression:
"JSON.parse(document.querySelector('#main-report').textContent)",
returnByValue: true,
const provider = createBrowserScenarioProvider(process.env);
const pending = provider.captureScenario(cancelledScenario, {
signal: controller.signal,
});
assert.deepEqual(state.result.value, {
local: "main-initial",
session: "main-session-initial",
removed: "main-remove-seed",
empty: "main-empty-seed",
});
controller.abort(new Error("cancel storage seed scenario"));
const result = await pending;
assert.ok(
!result.ok ||
result.value.steps.some(({ status }) => status === "cancelled"),
"Cancellation unexpectedly completed every scenario step",
);
const targets = await (await fetch(`${endpoint}/json/list`)).json();
assert.ok(
targets.some(({ id }) => id === targetId),
"Cancelled connect-mode storage cleanup closed the external target",
);
let failure;
try {
await waitForNewDocument(
observer,
"/storage-main",
priorDocument.result.value,
);
const state = await observer.send("Runtime.evaluate", {
expression:
"JSON.parse(document.querySelector('#main-report').textContent)",
returnByValue: true,
});
assert.deepEqual(state.result.value, {
local: "main-initial",
session: "main-session-initial",
removed: "main-remove-seed",
empty: "main-empty-seed",
});
controller.abort(new Error("cancel storage seed scenario"));
const result = await pending;
if (result.ok)
assert.ok(
result.value.steps.some(({ status }) => status === "cancelled"),
"Cancellation unexpectedly completed every scenario step",
);
else assert.equal(result.error._tag, "AnalysisCancelledError");
const targets = await (await fetch(`${endpoint}/json/list`)).json();
assert.ok(
targets.some(({ id }) => id === targetId),
"Cancelled connect-mode storage cleanup closed the external target",
);
} catch (cause) {
failure = cause;
throw cause;
} finally {
controller.abort(new Error("cancel failed storage verification"));
await closeVerifierResources([() => provider.close()], failure);
}
};
const waitForNewDocument = async (connection, path, priorTimeOrigin) => {
@@ -669,15 +686,38 @@ const waitForNewDocument = async (connection, path, priorTimeOrigin) => {
};
const restoreTarget = async (connection, url) => {
await connection.send("Page.navigate", { url });
const deadline = Date.now() + 10_000;
while (Date.now() < deadline) {
const result = await connection.send("Runtime.evaluate", {
expression: "location.href",
returnByValue: true,
});
if (result.result.value === url) return;
await new Promise((resolve) => setTimeout(resolve, 25));
const loaded = new Set();
let loaderId;
let resolveLoaded;
const load = new Promise((resolve) => {
resolveLoaded = resolve;
});
const unsubscribe = connection.onEvent((event) => {
if (
event.method !== "Page.lifecycleEvent" ||
event.params?.name !== "load" ||
typeof event.params.loaderId !== "string"
)
return;
loaded.add(event.params.loaderId);
if (event.params.loaderId === loaderId) resolveLoaded();
});
try {
await connection.send("Page.setLifecycleEventsEnabled", { enabled: true });
const navigation = await connection.send("Page.navigate", { url });
assert.equal(navigation.errorText, undefined);
assert.equal(typeof navigation.loaderId, "string");
loaderId = navigation.loaderId;
// A URL changes at commit, before old child frames have been retired.
// Do not hand the shared page to the next verifier until this load ends.
if (!loaded.has(loaderId))
await raceWithTimeout(load, 10_000, () => {
throw new Error(
"External browser did not finish restoring its document",
);
});
} finally {
unsubscribe();
await connection.send("Page.setLifecycleEventsEnabled", { enabled: false });
}
throw new Error("External browser did not return to its original URL");
};
+7
View File
@@ -218,6 +218,13 @@ export const providerCatalog = (sources) => {
identity: sources.idaProvider.IDA_PROVIDER_IDENTITY,
contracts: declaredContracts("ida", sources.idaProvider.IDA_OPERATIONS),
},
{
identity: sources.kunaProvider.KUNA_PROVIDER_IDENTITY,
contracts: declaredContracts(
"kuna",
sources.kunaProvider.KUNA_OPERATIONS,
),
},
{
identity: sources.nativeProvider.NATIVE_MACOS_PROVIDER_IDENTITY,
contracts: sources.nativeContracts.NATIVE_TOOL_CONTRACTS,
+1
View File
@@ -109,6 +109,7 @@ const SOURCE_PATHS = {
hopperProvider: "dist/hopper/HopperProviderCapabilities.js",
ghidraProvider: "dist/ghidra/GhidraProviderCapabilities.js",
idaProvider: "dist/ida/IdaProviderCapabilities.js",
kunaProvider: "dist/kuna/KunaProviderCapabilities.js",
nativeProvider: "dist/native/NativeMacOSProviderMetadata.js",
artifactProviders: "dist/application/InvestigationProviders.js",
browserIdentities: "dist/browser/providerIdentities.js",
+1 -2
View File
@@ -18,13 +18,12 @@ export function writeWindowsGhidraByteSearchFixture(bytes) {
export async function verifyWindowsGhidraByteSearch({
invoke,
sourceBytes,
architecture,
imageBase,
sourceOwnedFixture = true,
fallbackAddress,
fallbackFileOffset,
runCliPage,
}) {
const imageBase = architecture === "x86" ? 0x400000n : 0x140000000n;
const query = sourceOwnedFixture
? {
pattern: WINDOWS_GHIDRA_BYTE_SEARCH_FIXTURE.pattern,
@@ -0,0 +1,21 @@
export const WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES: readonly [
"x86_64",
"x86",
"arm",
"arm64",
];
export const WINDOWS_GHIDRA_FIXTURE_FLAGS: readonly string[];
/** Select one architecture without interpreting positional paths as flags. */
export function windowsGhidraFixtureOptions(arguments_: readonly string[]): {
architecture: (typeof WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES)[number];
dll: boolean;
pe32: boolean;
imageBase: bigint;
calleeRva: number;
machine: number;
filename: string;
languageId: string;
callerAddress: string;
calleeAddress: string;
};
@@ -0,0 +1,50 @@
/** Source-owned PE fixtures; these are encoded bytes, not compiled programs. */
/** @type {readonly ["x86_64", "x86", "arm", "arm64"]} */
export const WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES = Object.freeze([
"x86_64",
"x86",
"arm",
"arm64",
]);
export const WINDOWS_GHIDRA_FIXTURE_FLAGS = Object.freeze([
"--x86",
"--arm",
"--arm64",
"--dll",
]);
/** Select one architecture without interpreting positional paths as flags. */
/** @param {readonly string[]} arguments_ */
export const windowsGhidraFixtureOptions = (arguments_) => {
const selected = WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES.filter(
(architecture) =>
architecture !== "x86_64" && arguments_.includes(`--${architecture}`),
);
if (selected.length > 1)
throw new Error("Choose one Windows PE fixture architecture.");
const architecture = selected[0] ?? "x86_64";
const dll = arguments_.includes("--dll");
const pe32 = architecture === "x86" || architecture === "arm";
const imageBase = pe32 ? 0x400000n : 0x140000000n;
const calleeRva = architecture.startsWith("arm") ? 0x1020 : 0x1010;
return {
architecture,
dll,
pe32,
imageBase,
calleeRva,
machine: { x86: 0x14c, x86_64: 0x8664, arm: 0x1c4, arm64: 0xaa64 }[
architecture
],
filename: `rea-ghidra-windows${architecture === "x86_64" ? "" : `-${architecture}`}.${dll ? "dll" : "exe"}`,
languageId:
architecture === "arm"
? "ARM:LE:32:v8"
: architecture === "arm64"
? "AARCH64:LE:64:v8A"
: `x86:LE:${pe32 ? 32 : 64}:default`,
callerAddress: `0x${(imageBase + 0x1000n).toString(16)}`,
calleeAddress: `0x${(imageBase + BigInt(calleeRva)).toString(16)}`,
};
};
@@ -0,0 +1,46 @@
import assert from "node:assert/strict";
import { realpath } from "node:fs/promises";
import { runKunaCommand } from "../../dist/kuna/KunaCommand.js";
import { inspectKunaInstallation } from "../../dist/kuna/KunaInstallation.js";
import { KUNA_XREF_OUTPUT_BYTES } from "../../dist/kuna/KunaReferenceFiles.js";
/** Independent projection of native exact-target rows, bypassing REA's parser. */
export const nativeKunaIncomingSites = async ({
executable,
cacheRoot,
workspace,
binary,
address,
retain,
}) => {
const installed = await inspectKunaInstallation({
REA_KUNA_COMMAND: executable,
REA_KUNA_CACHE_DIR: cacheRoot,
});
assert.ok(installed.ok, "Native reference oracle could not inspect Kuna");
const input = await realpath(binary);
const timeoutMs = installed.value.configuration.functionTimeoutMs;
const outcome = await runKunaCommand({
installation: installed.value,
arguments: ["xrefs", input, "--to", address, "--json"],
workspace,
operation: "verify:kuna-native-xrefs",
timeoutMs,
reportedTimeoutMs: timeoutMs,
outputBytes: KUNA_XREF_OUTPUT_BYTES,
signal: new AbortController().signal,
});
if (outcome.kind === "retained") retain(outcome);
if (outcome.kind !== "ok") throw outcome.error;
const document = JSON.parse(outcome.snapshot.stdout.text);
assert.equal(document.binary, input);
assert.equal(document.direction, "to");
assert.equal(document.target.address_hex, address);
assert.equal(document.count, document.xrefs.length);
const sites = document.xrefs
.filter((row) => row.to_address_hex === address)
.map((row) => row.from_address_hex);
assert.ok(sites.every((site) => /^0x[0-9a-f]+$/u.test(site)));
return [...new Set(sites)].sort();
};
Loaded 100 of 527 files, more files were not shown because too many files have changed in this diff. Show more