+43 f8a12eba17 fix(javascript): name minified receiverless import calls by their final callee (#9095)
* feat(apktool)!: budget decode_android_resources delivery

decode_android_resources returned the complete decode inline. Claude Code
saves an MCP result above about 25,000 tokens to a file, so on VLC 3.7.2
(180,996 bytes) a Claude Code agent limited to REA tools never saw the
strings: in two trials it failed every answer after 20 or more calls and
about 900,000 tokens. Even string_limit 1 returned 77 KB, because the
manifest text is always inline.

decode_android_resources now takes detail and joins the agent result
budget. Omitted, a decode that fits delivery.agent_result_budget_bytes is
inline and a larger one is retained behind its summary. With detail
summary, view returns one android-resources page in the same call, so the
German and Japanese values of one string take one call. The CLI uses the
shared Evidence delivery with --view.

On VLC with real Apktool 3.0.3 the default reply was 3,368 bytes, and the
two-locale strings page 2,695 bytes.

BREAKING CHANGE: a decode_android_resources call that omits detail on a
decode above the agent result budget now returns the retained summary.
Pass detail: "complete" (--detail complete) for the previous shape.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(apktool): describe decode delivery and resource views

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(analysis-view): page retained Android reference traces

A retained trace_android_references result could only be read back
whole. It lists every using node, so on VLC's PlaybackService it was
76 KB of normalized result beside a 140 KB raw provider reply.

The android-references view pages one retained trace. Facet top-classes
lists distinct top classes with their package and using-node count,
sorted by name; facet references lists using nodes with their index and
only the selected fields. Both filter by exact kinds, packages (the top
class's name before its last dot) and top classes, and every page carries
the trace target, total and direct-invoke coverage.

The summary keeps the target, total and coverage, and counts using nodes
by kind, top class and package, with the 32 most referenced packages.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(android)!: budget trace_android_references delivery

trace_android_references returned every using node inline. On VLC's
org.videolan.vlc.PlaybackService the MCP result was 214,955 bytes, so
Claude Code saved it to a file a REA-only agent could not read, and
inspect_analysis_view did not support the operation. In two trials asking
which outer classes reference the class, Claude Code answered nothing
after 17 to 20 calls and about 870,000 tokens.

trace_android_references now takes detail and view and joins the agent
result budget. Omitted, a trace that fits delivery.agent_result_budget_bytes
is inline and a larger one is retained behind its summary. With detail
summary, view returns one android-references page in the same call. The
CLI uses the shared Evidence delivery with --view.

With real JADX on VLC the default reply was 5,987 bytes, and the
top-classes page of all 97 top classes 16,724 bytes. In two trials each,
Claude Code then answered correctly with 92,000 to 125,000 tokens, and
Codex with 208,000 to 217,000 tokens instead of 364,000 to 408,000.

BREAKING CHANGE: a trace_android_references call that omits detail on a
trace above the agent result budget now returns the retained summary.
Pass detail: "complete" (--detail complete) for the previous shape.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(android)!: count class members in summaries and page them

The inspect_android_class summary was the complete normalized class: on
VLC's org.videolan.vlc.PlaybackService, with 302 methods, it was 70,266
bytes, twice the agent result budget it was delivered for. Claude Code
saved it to a file, and REA-only agents read the class back through about
five evidence-json pages.

The class summary now carries the class name, engine, counts of methods,
constructors, overloaded method names, fields, encoded static values and
inner classes, the overloaded method names with their overload counts,
and the mapping's identity and record counts. The android-class view pages
methods (exact names, name prefixes, constructors), fields (exact names,
name prefixes, static values), inner classes and mapping symbols, and
inspect_android_class accepts it with detail summary in the same call.
Method summaries are unchanged and keep their own projector.

With real JADX on VLC the class summary was 4,601 bytes.

BREAKING CHANGE: the inspect_android_class summary, delivered for detail
summary or above the agent result budget, no longer lists methods, fields,
inner classes or mapping symbols. Page them with the android-class view,
or pass detail: "complete".

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(android)!: count components in package summaries

The inspect_android_package summary kept every component declaration.
On VLC 3.7.2 its 60 components made the summary 62,118 bytes, above the
agent result budget it was delivered for, although the component-summary
and components facets already page and count them.

The summary's components now carry the component status, limitations and
counts by kind, exported declaration, exported default and declaration
coverage, computed by the same helper as the component-summary facet.
Component rows page through the components facet.

With real JADX on VLC the package summary was 6,280 bytes.

BREAKING CHANGE: the inspect_android_package summary no longer lists
component declarations. Page them with view {kind: "android", facet:
"components"}, or pass detail: "complete".

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(android): describe budgeted delivery and the class and reference views

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* refactor(android): share boot image parser layout types (#14695)

* fix(artifacts): read the next tar header after header-only members (#14500)

* fix(artifacts): read the next tar header after header-only members

POSIX ustar stores no data blocks for symbolic links, devices,
directories and FIFOs, and a directory's size field may be nonzero by
design. The tar walk skipped the declared size after every header, so
such a header hid the members that followed. When the skipped span
landed on a later header, those members were missing while coverage
stayed complete. Otherwise the walk stopped as malformed.

The stored data length now comes from the header's type, through the
same directory rule that classifies members. Hard links keep their
declared size, because pax interchange archives may store a body.

Fixes #14497

* test(artifacts): cover pax and long-name sizes on header-only tar members

---------

Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>

* test(fixtures): share literal-only LZ4 blocks across fixture builders (#14696)

* feat(artifacts): inventory and expand Android sparse images offline (#13244)

* feat(artifacts): inventory and expand Android sparse images offline

* chore(schemas): update artifact tool schema summaries for the sparse image limit

* fix(artifacts): retire undrained sparse image streams on cancellation

* fix(artifacts): keep large RAW reads in the sparse stream's owner

A large RAW run was streamed through a nested readFileHandleChunks
Readable, which could prefetch a descriptor read while the outer
iterator was idle, so close or cancellation could retire the stream
with that read still running. Read the run directly in the expansion
iterator so every read is pending in the owner that cancellation waits
on, and add held-read close and cancellation regressions.

* fix(firmware): drop unused ANDROID_SPARSE_MAGIC_BYTES export

* test(artifacts): release held sparse reads before restoring mocks

Release the held RAW read and join the retiring close or cancellation in
finally before restoring the read spy, so a failed assertion cannot leave
reader.close() waiting on a read nobody will finish. Use
awaitAcknowledgement for the held-read start barrier and drop the
per-test five-second timeouts in favor of the shared test deadlines.

* fix(lint): register sparse-image forwarded fixed ceiling

Upstream main added the fixed-ceiling registry check. The sparse-image
reader projects the parser's own named ceiling, so register it as
forwarding like the boot-image reader.

* Address review feedback

* test(android-sparse): expect partial code for chunk budget refusal

* test(android-sparse): expect partial code in MCP chunk budget refusal

* fix(artifacts): keep the chunk_sz offset when a RAW chunk outgrows its header

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>

* ci: resume hosted APT package downloads across bounded attempts

A slow archive connection can still be progressing when the single
download deadline expires, failing the Windows native controls lane
while MinGW archives were mid-transfer. Download within three bounded
attempts instead; APT keeps completed archives and resumes partial ones,
so a later attempt reconnects and continues. Installation still runs
only from the local cache after a successful download.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* ci: retry transient failures of pinned release downloads

curl --retry covers only timeouts and a few HTTP statuses, so a
connection reset mid-transfer failed the Ghidra SDK acquisition outright.
Retry every transient error for the pinned downloads, as the web network
capture lane already does; each archive is still checked against its
pinned SHA-256 before use.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* ci: fit the binary layout toolchain download into three attempts

Each hosted APT download attempt now has its own deadline, so the
900-second budget would let three attempts outlast the 25-minute job.
Give each attempt 360 seconds: a resumed second attempt still covers the
slowest observed cold download (657 seconds), and the test asserts that
three attempts leave the job five minutes to build and verify fixtures.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(setup): normalize win32 paths and trailing backslashes in fxLocation (#14725)

* test(cli): share command results across fresh and shared processes (#14718)

* refactor(parsers): share typed failure handling for Android and ISO images (#14719)

* test(filesystem): release the lease after simulated device changes (#14731)

* fix(tar): read pax values that hdrcharset=BINARY leaves as raw bytes (#14632)

* fix(tar): read pax values that hdrcharset=BINARY leaves as raw bytes

A pax extended header may declare hdrcharset=BINARY, and then its path,
linkpath, uname and gname values are raw bytes rather than UTF-8 (POSIX
pax, "hdrcharset"). Python tarfile and libarchive write exactly this for
a file name that is not UTF-8. parsePaxRecords refused every non-UTF-8
value, so the walk stopped as malformed at that header and no member
from it on was inventoried.

Under hdrcharset=BINARY those four values are now decoded as Latin-1,
with a limitation giving the raw bytes, as header names already are.
Any other non-UTF-8 value still stops the walk.

* fix(tar): charge hdrcharset=BINARY warnings to the metadata allowance

Each Latin-1 warning carries the raw value in hex, twice its size, and a
repeated global header appends a new one while a same-sized replacement
leaves the global map charge unchanged. Charge every warning to
artifact_limits.tar.metadata_bytes before building it.

* fix(tar): refund hdrcharset=BINARY warnings no member keeps

A local pax header's warnings were charged to
artifact_limits.tar.metadata_bytes but never refunded when they were
discarded: by the next local header that replaces them, or by an omitted
member or the archive root, which do not keep them. Repeated binary owner
names on omitted members could exhaust the allowance while the retained
data fit. Refund the charge whenever the warnings are dropped.

* fix(views): validate retained web source metadata against producer rules (#14729)

* fix(environment): release abort listeners when waits settle (#14730)

* refactor(javascript): share the artifact reconstruction cancellation check (#14732)

* fix(apple): preserve unknown CPU subtype in dylib selection (#14706)

* fix(apple): preserve unknown CPU subtype in dylib resolution

* chore: remove unused internal LZMA request type

* chore: mark partial module AST visitor switch explicitly

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(artifacts): keep boot image coverage unknown when layout bytes are not exposed (#14370)

* fix(artifacts): keep boot image coverage unknown when layout bytes are not exposed

Android boot and vendor_boot inventories reported complete coverage while
a limitation said declared layout bytes were not exposed as children: a
vendor_boot v4 section without table entries, table entries that cover
only part of the section, and bytes between the sequential layout and a
v1/v2 recovery_dtbo. The same section bytes already left coverage unknown
when the vendor table failed to parse.

The header and vendor table parsers now report unexposed bytes as typed
facts (unexposedLayoutBytes, unexposedSectionBytes) next to the existing
limitations, and the reader derives coverage from them instead of from
the parse-failure flags alone. The legacy tail's facts are named as the
parse fields they become and are spread into the parse result.

Fixes #14369

* docs(artifacts): separate boot image metadata ranges from children in the coverage rule

---------

Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>

* fix(firmware): mark ESP flash coverage unknown when bootloader region is omitted (#14285)

When planEspFlashLayout locates a bootloader whose flash address is at or
after the selected partition table, it omits the bootloader region and
records a limitation. finishEspFlashLayout previously checked only
plan.input.bootloader === undefined, so a dump whose partitions covered
the rest of the image could still report coverage: "complete".

Check whether a bootloader region was actually placed in plan.regions
instead of re-deriving presence from plan.input.bootloader, matching
EspFlashImageArtifactReader. Update docs/esp-flash-image.md and add unit,
reader, and CLI regressions.

* fix(har): fall back to postData.params when postData.text is empty or unreadable (#14256)

* fix(native): resolve Objective-C protocol _classProperties via pointer fixups (#14283)

Resolve a protocol_t `_classProperties` slot through `resolvePointer`
instead of `read.pointer(...) !== 0n`, sharing the undecoded class-property
slot check in `AppleObjcProperties.ts` with `AppleObjcCategories.ts`.
A bound slot now counts as present and undecoded, and an unreadable or
unknown-fixup zero slot keeps the protocol record and coverage partial
rather than treating the list as absent.

* fix(verify): bound concurrent file reads in architecture and limit guards (#14720)

* fix(verify): bound concurrent file reads in architecture and limit guards

`scripts/verify/architecture-guards.mjs` reads every `.ts`, `.mts`, `.mjs`,
and `.py` file under `src/`, `tests/`, `scripts/`, and `bridge/` (8,203 files
on current `main`) via unbounded `Promise.all(paths.map(readFile))`. On
Windows, queuing all `open()` calls at once exceeds the UCRT 8,192 file
descriptor ceiling and deterministically fails `npm run verify:architecture-guards`,
`npm run check:fast`, and the pre-push hook with `EMFILE: too many open files`.

Add a zero-dependency JSDoc-typed `mapWithConcurrency` helper in
`scripts/verify/bounded-file-reads.mjs` (default cap 64, registered in
`tsconfig.scripts.json` so it runs before `npm ci`), apply it across all four
bulk `readFile` loops in `scripts/verify/architecture-guards.mjs` and the
sibling `src/` scan in `scripts/verify/rea-numeric-limits.mjs`, and add unit
coverage in `tests/evaluation/boundedFileReads.test.ts`.

* test(verify): copy bounded-file-reads helper in numericLimitGuardPermission fixture

`scripts/verify/rea-numeric-limits.mjs` now imports
`./bounded-file-reads.mjs`. Copy both scripts into the temporary checkout
in `tests/boundary/process/numericLimitGuardPermission.test.ts` so the
copied verifier starts cleanly on non-root Linux/macOS runs instead of
failing with `ERR_MODULE_NOT_FOUND`.

* fix(native): decode Objective-C categories that Swift lists in __objc_catlist2 (#14025)

* fix(native): decode Objective-C categories that Swift lists in __objc_catlist2

Swift lists categories on a class it reaches through a Swift class stub
in __objc_catlist2, and the Objective-C runtime loads that list like
__objc_catlist. inspect_native_dispatch_metadata read only __objc_catlist,
so these categories, their methods and protocols were missing while
objc_properties_categories coverage reported complete.

Read both lists. A stub's first word is a plain value from 1 to 15, as
the runtime's isStubClass checks, and it holds no class_t, so a category
whose class reference is a stub keeps a null class and coverage names
the reference instead of reading unrelated bytes as a class name.

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

* fix(native): version the dispatch reader profile for __objc_catlist2 categories

Reading __objc_catlist2 changes inspect_native_dispatch_metadata results,
but the reader still declared apple-metadata-reader-4, so a snapshot saved
before this change matched the current profile and replayed its empty,
complete category result. Declare reader version and revision 5 so those
snapshots are refused with a binding mismatch and the image is read again.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* test(artifacts): reuse temporary files in Android reader fixtures (#14750)

* fix(artifacts): explain ASAR PE signed-after-packing mismatches (#14702)

* fix(artifacts): explain ASAR PE signed-after-packing mismatches

When an unpacked PE companion fails ASAR integrity only because Authenticode
was applied after packing, record a verifiable signing_explanation on the
SHA-256 contradiction and error details instead of an opaque untrusted
mismatch. Bytes stay observed-untrusted; any other mutation remains an
unexplained contradiction.

Fixes #7212

* fix(artifacts): address signed-after-packing Greptile review

Catch ParseFailureError so unreadable PKCS#7 keeps the digest explanation,
share WIN_CERTIFICATE structural walks, index signer lookups, charge optional
reads to acquisition budgets with reported skips, preserve mismatch details
through cleanup failures, and inherit the shared MCP test deadline.

* fix(pe): walk WIN_CERTIFICATE entries lazily under max_entries

Convert the certificate-table walker into a generator so inspection stops at
the entry budget without materializing every range, and reconstruction can
validate structure with constant memory.

* fix(views): validate Android class rows against the selected facet (#14754)

* fix(android): allow filtering references by the unnamed package (#14752)

* fix(javascript): drop a stream acquisition whose options Node refuses (#9262)

* fix(javascript): drop a stream acquisition whose options Node refuses

`fs.createReadStream` and `fs.createWriteStream` are tracked as acquisitions with
`close`/`destroy` releases, so a wrongly retained one also invents a teardown. Node
validates five option members before it constructs the stream, and the filter
inspected none of them. Measured on Node 24.22.1, seven shapes were wrong:

| call | Node | before |
| --- | --- | --- |
| `createReadStream(p, {start:-1})` | throws | retained |
| `createReadStream(p, {end:-5})` | throws | retained |
| `createReadStream(p, {start:10, end:2})` | throws | retained |
| `createWriteStream(p, {start:-1})` | throws | retained |
| `createReadStream(p, {fd:-1})` | throws | retained |
| `createReadStream(p, {highWaterMark:-1})` | throws | retained |
| `createReadStream(p, {encoding:5})` | throws | retained |

Each member has its own check, so each is decided separately:

- `start` / `end` need a non-negative integer number. A string, `null`, boolean or
  BigInt throws `ERR_INVALID_ARG_TYPE`; `undefined` is absent and `-0` is zero.
- `fd` applies the same number rule but treats `null` as absent.
- `highWaterMark` throws `ERR_INVALID_ARG_VALUE` below zero or for a fraction, and
  treats `null` as absent.
- `encoding` is skipped by Node when falsy, so only a truthy literal is decided and a
  string must be one `Buffer` accepts.
- `start` above `end` throws, so the pair is read together.
- `createWriteStream` has no `end` member at all, so `{end:-1}` still creates a handle.
- `flags`, `mode` and `autoClose` are not validated eagerly and stay undecided.

A decided rejection is only trusted while the constructor it dispatches through is
still Node's own. `Object.prototype`, the stream prototypes, the fs stream
constructors and their shared `Stream` / `EventEmitter` ancestors are all consulted
through `prototypeMutationMayPrecede`, `builtinModuleSlotUnmodified`,
`builtinModuleSubtreeUnmodified` and `builtinSharedPrototypeUnmodified`, so a
replaced constructor or an intercepting prototype keeps the acquisition and reports
`resolution: "partial"` instead of inventing a rejection.

This is a port of the branch onto current `main`. `javascriptSemanticMemberMutations`
was restructured into an `executions` dispatch while the branch sat, so the net change
is applied to one base with the conflict blocks resolved:

- The `Object.defineProperty` analysis moved into `markBuiltinPropertyDefinition`,
  called from the `case "call"/"construction"` branch, and `markInvocation` takes an
  optional `definedTarget` so a discarded result is still stepped over.
- `requiredModuleChanged` keeps main's `allowCandidate` / `ignoreCandidateEffects` /
  `snapshotObjectRoot` parameters and appends `descendantsMatter` /
  `ignoreRootSlotWrite`; the three guards spell every argument because the position
  of `allowCandidate` differs from the branch's.
- A namespace reached through a candidate loader is still the original built-in
  receiver, so the guards pass that allowance and `markBuiltinPropertyDefinition`
  accepts the same single-candidate origin `semanticExpressionModuleOrigin` does.
- `semanticEffectTiming` reads became `prototypeMutationMayPrecede` and
  `ambientPathMayObserveAt`, which the architecture guard requires.
- `isUnmodifiedGlobalReference` imports from `javascriptSemanticGlobalReference.js`;
  both `AmbientWrites` modules lack it.

49 new cases in `javascriptSemanticAnalysis.open_flag_literal.test.ts`, 29 of which
fail on the base commit. With the guards' arguments in the branch's order the file is
10 failed / 298 passed and every failure is a case that must still refuse; now 308
passing. `src/domain/javascript` + `src/application/javascript` — 7 009 passing.
`architecture-guards` passed across 2 818 files. `tsc --noEmit` 0 errors.
`npm run lint` 0 errors.

* fix(javascript): refuse BigInt and import.meta stream option members

* fix(javascript): evaluate a unary BigInt chain before deciding stream truthiness

* fix(javascript): keep an fd supplied through import.meta undecided

* refactor(javascript): route the acquisition coverage through the accumulator

---------

Co-authored-by: 吴佳浩 <wujiahao@supremind.com>

* fix(sqlite): accept the documented sqlite_master spelling of the schema catalog (#10277)

* fix(sqlite): accept the documented sqlite_master spelling of the schema catalog

SQLite's schema-table documentation, "Alternative Names", recognizes four spellings and says
plainly that `sqlite_master` "works anywhere" while the two `sqlite_temp_*` forms only resolve for
the TEMP database. The inspector accepted exactly one of them.

`table: "sqlite_master"` was refused with "Selected ordinary table does not exist with that exact
name: sqlite_master", which is factually wrong for a name the engine resolves:

| same library, same connection | result |
| --- | --- |
| `SELECT count(*) FROM sqlite_master` | 1 |
| `SELECT count(*) FROM sqlite_schema` | 1 |
| `SELECT count(*) FROM pragma_table_list WHERE name = 'sqlite_master'` | **0** |
| `pragma_table_xinfo('sqlite_master', 'main')` | `type, name, tbl_name, rootpage, sql` |

The stored-catalog identity comes from `temp.pragma_table_list` with a `COLLATE BINARY` exact-name
match, and that inventory lists the catalog under its canonical spelling only, so the alias never
reached the row-source facts that already work. All three schema scopes threw.

Both spellings now yield the same rows and order, and the catalog still publishes no invented
declaration:

| spelling | before | after |
| --- | --- | --- |
| `sqlite_schema` | rows, `order: rowid` | unchanged |
| `sqlite_master` | THREW | rows, `order: rowid`, no self-declaration |
| `sqlite_temp_schema`, `sqlite_temp_master`, `SQLITE_MASTER` | THREW | still THREW |
| `absent` | THREW | still THREW |

Only the everywhere-alias is added. The TEMP-only spellings and a case variant stay refused,
because SQLite does not resolve them here either.

The guide now names both spellings instead of promising one exact name.

`tests/boundary/sqlite` and `src/application/sqlite` — 79 passing, 1 skipped, 6 new cases.
Reverting the normalization fails three of them.

* test(sqlite): cover the alias through the service boundary

A review finding on the previous commit: the shared predicate change also alters
`SqliteDatabaseService.matchesSelectedSchema`, which decides CLI and MCP result admission, and
nothing exercised the alias there.

The alias case now runs through the service twice — once against a report whose catalog carries no
self-declaration, which must be admitted, and once against a report that declares the table, which
must stay an output error. Dropping the alias from `sqliteSchemaHasObjectDeclaration` fails it.

* refactor(sqlite): derive the catalog declaration check from its spelling owner

---------

Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(adb): list a transport adb reports without a serial number (#10187)

* fix(adb): list a transport adb reports without a serial number

AOSP `transport.cpp append_transport()` substitutes the literal `(no serial number)` in the serial
column when the transport has none to report, which is reachable: `client/usb_linux.cpp` keeps an
empty serial for a device that cannot report one during early bringup (`http://b/20883914`) and
still registers the transport. The long listing pads that column with `%-22s` and the short one
separates it with a tab, so the placeholder carries spaces either way — and `DEVICE_LINE` required
a single `\S+` token.

The consequence was larger than one lost line. `AdbDeviceOperations` rejects any unparsed line
outright, so a single serial-less transport failed the whole `list_adb_devices` call:

| listing | before | after |
| --- | --- | --- |
| two placeholder transports | 0 devices, 2 unparsed | 2 devices, 0 unparsed |
| placeholder in the short form | 0 devices, 1 unparsed | 1 device, 0 unparsed |
| two healthy devices plus one placeholder | 2 devices **and 1 unparsed**, so the call fails and all three are lost | 3 devices, 0 unparsed |

The state, transport identity, USB metadata and inferred kind parse exactly as before; only the
serial column admits the placeholder. `src/adb` — 40 passing, 3 new cases; restoring `\S+` fails
all three.

* fix(adb): model the missing serial instead of the display placeholder

A review finding: the placeholder `(no serial number)` is formatter text, not an identity. Two
transports without a serial became indistinguishable once it was stored as one, and the text cannot
be passed to any device operation, because `deviceSerialSchema` rejects whitespace while the schema
describes the serial as "Device serial exactly as `adb devices` reports it".

The observation now carries `serial: null` with `serial_status: "not_reported"`, which is the shape
this module already uses for a transport ID it was not given (`transport_identity.status` and
`transport_id_status`). The reported value is unchanged for every transport that has a serial, and
`transport_id` still identifies a transport that has none.

Before this change the placeholder line was not parsed at all — `\S+` cannot match text containing
spaces — so it landed in `unparsedLines`, and `AdbDeviceOperations` refuses any unparsed line, which
removed every healthy device from the listing too:

| input | before | after |
| --- | --- | --- |
| placeholder line only | 0 devices, 1 unparsed | 1 device, `serial: null` |
| two placeholder transports | 0 devices | 2 devices, distinct `transport_id` |
| healthy + placeholder | 0 devices, 1 unparsed | 3 devices, one `serial: null` |

`src/adb` and `tests/boundary/cli/adbCli.test.ts` — 189 passing. `tests/boundary/providers/adb`
fails 4, all of which fail on `main` on this Windows host (where it fails 25). `tsc --noEmit`
0 errors, `npm run lint` 0 errors.

* test(adb): give the MCP fixture the serial status the parser reports

A review finding: `adbDeviceObservationSchema.serial_status` is now required, and the fixture in
`tests/boundary/mcp/adbMcp.test.ts` still omitted it, so `projectDeviceList` refused the listing
before the test's success assertion could run:

```
tests/boundary/mcp/adbMcp.test.ts:372
  expect(listed.isError).not.toBe(true);   → expected true not to be true
```

Both fixture devices report a serial, so both take `serial_status: "reported"`.

The reviewer also mentioned three full-object assertions in `AdbProvider.test.ts`; those do not
exist in the tree at this commit — `src/adb` runs 162 passing with the change, and
`git grep serial_status` finds no other fixture that carries a complete device object. I checked
rather than trusting the report.

* test(adb): give the provider device assertions the serial status

A review finding, and the reviewer was right about this file: I had reported it as not containing the
assertions, because `AdbProvider.test.ts:76` is `test.skipIf(process.platform === "win32")`, so all
117 of its tests are skipped on this Windows host and my local run reported 162 passing without ever
executing them. CI runs the adapters lane on Linux, where the three `toEqual` device objects compared
a 9-field observation against an 8-field one:

```
FAIL  src/adb/AdbProvider.test.ts > lists devices with inferred kinds and observed daemon startup
FAIL  src/adb/AdbProvider.test.ts > observes daemon startup when notices are printed to stderr
FAIL  src/adb/AdbProvider.test.ts > lists a USB device adb has no permission to open alongside online devices
  +     "serial_status": "reported",
```

Those are exactly the three, so `serial_status: "reported"` is added to each. Every device in this
file reports a serial, so the value is the same at all three sites.

Correcting my previous message on this PR: the file does carry them. The lesson is the same one that
has bitten this branch twice — `src/adb` passing locally is not evidence about a lane this host
skips.

`tsc --noEmit` 0 errors, `npm run lint` 0 errors.

* refactor(adb): let a null serial carry the not-reported fact

serial_status restated serial === null on every device row. Drop it and
document the null serial at the schema, where transport_identity still
tells two serial-less transports apart.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(macho): document what a null build platform means (#14128)

* fix(macho): mark a conflicting build platform instead of reporting none

slice.platform is documented as null when no LC_BUILD_VERSION command was
observed, but the reader also writes null when several distinct platforms were
declared. trace_dylib_resolution therefore reported a binary that declares two
contradictory platforms as having no platform at all, which is the absent-versus
-unknown collapse AGENTS.md forbids.

Keep platform null for the conflict case and add platform_conflict so callers can
tell the two apart.

* fix(macho): describe build platform facts without a redundant conflict flag

The slice already records every platform declaration in platforms, so
platform_conflict duplicated that fact. It also labelled the zippered
macOS + macCatalyst pair, which dyld accepts, as a conflict. Drop the
flag, correct the platform and platforms contracts, and cover none,
single, repeated and zippered declarations through the reader.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* test(ci): require a positive binary-layout download deadline (#14755)

* fix(apple): observe keyed-archive dates when the offset table reaches the trailer (#7166)

* fix(apple): observe keyed-archive dates when the offset table reaches the trailer

inspect_keyed_archive preflights binary plists with decoder bounds, which
admit an offset table that ends anywhere before end of file, including
inside the 32-byte trailer. plist@5 reads such a table. Dates must still
end before the offset table, so the preflight records each reachable date.

The scalar scanner, however, required the table to end before the
trailer. For a table that runs into the trailer it abandoned the whole
file and collected no dates. The precision clamp in
decodeBinaryPlistScalars then saw no unrepresentable date, so a 0.1005 s
instant was reported as the exact timestamp 2001-01-01T00:00:00.100Z with
no unknown-date limitation.

Bound the scanner's offset-table reads by the end of the file, which is
the widest table any preflight admits. Strict preflight already rejects
tables past the trailer before scanning, so strict callers are unchanged.
Object and date bounds still end at the offset table.

* fix(apple): rebuild a complete trailer when cloning plist scalars

Review follow-up. With the scanner observing dates when the offset table
runs into the trailer, a sub-millisecond date that overlaps another object
now reaches cloneBinaryPlistObjects. That rewrite sized its output as
bytes.length plus the growth of a table assumed to end before the trailer.
When the old table overlaps the trailer, those bytes exist only once, so
the buffer came out short and the copied trailer was truncated. plist@5
then failed with "Unsupported int size: 0".

binaryPlistCloneGrowth now computes the bytes a clone rewrite adds,
subtracting only the old table bytes that precede the trailer. The
allocator and both preflight budget estimates use it, so admission and
allocation agree. For tables that end before the trailer the value is
unchanged.

* fix(apple): keep every source byte when cloning plist scalars

Review follow-up (Codex). Decoder bounds admit an offset table that runs
into the trailer and an object stored in the trailer's spare bytes after
it. With dates now observed for that layout, an overlapping
sub-millisecond date reaches cloneBinaryPlistObjects. Since #7820 the
rewrite appends clones and a fresh table, but only after the bytes before
the trailer, so it overwrote such an object and plist@5 failed with
"Unsupported int size: 256".

Copy the whole source buffer and append the clones, the new table and a
new trailer after it. The old table and trailer stay as inert bytes, so
every source offset still names its original record. The offset width and
both preflight estimates now account for the clones starting at the end
of the buffer and for the extra trailer.

* test(apple): match main's limitation assertions in keyed-archive date tests

* fix(apple): observe binary plist dates only when they end before the trailer

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(mcp): refuse stale sessions and serialize initialize handovers (#13195)

* fix(mcp): refuse a stale session id without arming a transport

A request that already carries mcp-session-id went through the slot's
current session even when that id was not live. Initialize skips the
SDK session check, so the stale id opened a transport. A presented id
now gets 404 unless it is the live session, and it never arms one.

* fix(mcp): serialize initialize session handovers

Two sessionless initialize requests could both close the same live
session and then handle on the one transport that replaced it. The
second request was rejected because that server was already initialized.
Each initialize now waits until the previous handover has answered, then
replaces that session with its own.

* fix(mcp): reject an unmatched session id before joining a drain

A presented id that is not the live session waited on transport close.
A drain timeout, or a shutdown that won that wait, answered 503.
Compare the id first and return 404 without joining the drain.
A matching id still waits, then checks that the same id is live.

* test(mcp): read raced initialize results and always release session gates

The replacement race now requires a complete initialize result from each reply.
The stale-session test releases its connect gate, joins the arming request, and closes the slot when an assertion fails.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(browser): advertise the environment variable names a secret may not use (#10876)

* fix(browser): advertise the environment variable names a secret may not use

`browserScenarioSecretSchema` refuses a name containing `=` or NUL with a `.refine`, which
states the rule where a caller meets it only after sending a request. The published input
schema carried `minLength: 1` alone, so an MCP client validating against `tools/list` accepted
a name the server then refused:

| `environment_variable` | runtime | advertised (before) |
| --- | --- | --- |
| `A=B` | rejected | **accepted** |
| `=A` | rejected | **accepted** |
| `A=` | rejected | **accepted** |
| `A\0B` | rejected | **accepted** |
| `TOKEN`, `PATH` | accepted | accepted |

Both characters break the launched process's environment before any action runs, so the
refusal is one a caller needs before sending, not after. It is now stated as two `not`
patterns in the schema metadata:

```ts
.meta({ allOf: [{ not: { pattern: "=" } }, { not: { pattern: "\\x00" } }] })
```

An unanchored `pattern` under `not` reads as "contains none of", and `\x00` is the escape form
this repository's advertised patterns already use. `src/contracts/jsonSchemaKeywords.ts` lists
`not` and `allOf` among the visited schema positions, so
`tests/boundary/mcp/advertisedPatternsVMode.test.ts` compiles these patterns under the empty
flags, `u` and `v`. No look-around is used.

## Impact

Only discoverability changes: no name the server accepts becomes rejected, and no refused name
becomes accepted. The environment a scenario action runs in is unchanged.

## Evidence

- `src/domain/browserScenarioSecretName.test.ts` — new, one case. It builds a complete
  `capture_browser_scenario` request, asserts three ordinary names pass through both
  `contract.inputSchema.safeParse` and an AJV validate of the advertised document, and that
  `A=B`, `=A`, `A=` and `A\0B` fail through both.
- Reverting only the `.meta({ allOf: ... })` fails it with
  `AssertionError: "A=B": expected true to be false`.
- `browserScenario.test.ts`, `browserScenarioCapture.test.ts`, `browserScenarioMcp.test.ts`,
  `advertisedPatternsVMode.test.ts` and the new file — 27 passing.
- `npx tsc --noEmit -p .` — 0 errors. `npm run lint` — 0 errors.

## Author readiness

Human owner: @XiaoBinGan

- [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
- [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
- [x] I declare this PR ready for initial maintainer review.

* fix(browser): state the secret name refusal as one anchored pattern

A review finding, and the recorded dialect baseline is the authority: `countAdvertisedDialectViolations`
records the constructs the presentation does not project away, and
`advertisedDialectBaseline.ts` states counts may only shrink. The previous commit wrote the refusal as
`not`/`allOf`/unanchored `pattern`, which raised `input keyword not` from 10 to 12 and `input keyword
allOf` by one, so `tests/boundary/mcp/advertisedDialect.test.ts` failed.

An anchored complement character class states the same refusal with one `pattern` keyword and no new
constructs:

```ts
.meta({ pattern: "^[^=\\x00]+$" })
```

Measured through `advertisedInputDialectViolations` on the same tool, the leaf now reports exactly the
violations it reported before this PR (`input keyword $schema`), where the `not`/`allOf` form reported
seven more.

The class is also what the compact profile keeps: a `not` whose child has no `type` is gateway
incompatible, so the compact presentation reduced the whole input to shallow property types and lost
the name pattern and UUID checks with it. A `pattern` at the leaf survives that reduction.

Equivalence checked exhaustively, not assumed: over 7 381 strings (every string of length 0..4 over
`a`, `=`, NUL, space, newline, `:`, `-`, `é`, `🎉`), `^[^=\x00]+$` and
`!(name.includes("=") || name.includes("\0"))` with `min(1)` agree on every one.

`browserScenarioSecretName.test.ts`, `browserScenario.test.ts`, `browserScenarioMcp.test.ts`,
`advertisedDialect.test.ts` and `advertisedPatternsVMode.test.ts` — pass. `tsc --noEmit` 0 errors,
`npm run lint` 0 errors.

* test(browser): load only the contract family under test

A review finding: the case imports `toolContract`, which pulls the complete catalog, to reach one
browser contract. `BROWSER_SCENARIO_TOOL_CONTRACTS` is the named family a focused test should read,
and selecting `capture_browser_scenario` from it loads nothing else.

`CONTRIBUTING.md` asks focused tests to import their named contract family, so this is the same
requirement the reviewer cited. Behaviour is unchanged: the same request is built, and the same
eight names are checked through both `contract.inputSchema.safeParse` and an AJV validate of the
advertised document.

`advertisedDialect.test.ts`, `advertisedPatternsVMode.test.ts`, `browserScenario.test.ts`,
`browserScenarioMcp.test.ts` and this case — 52 passing. `tsc --noEmit` 0 errors, `npm run lint`
0 errors.

* fix(browser): state the secret name refusal with the check itself

A review finding from the architecture guard: a raw JSON Schema keyword in `.meta()` is refused,
because a Zod `.meta()` carries presentation, not validation. `node scripts/verify/architecture-guards.mjs`
on the previous commit:

```
raw JSON Schema keyword or x-rea marker in Zod .meta() (use a typed annotation from
src/domain/schemaAnnotations, a Zod check, or a src/domain/schemaConstraints helper);
new copies are not allowed:
  src/domain/browserScenarioValues.ts: 1 (baseline 0)
```

The check was the one wrong thing, not the pattern. `environment_variable` is now a plain
`.regex(/^[^=\x00]+$/u, "Environment variable names cannot contain '=' or NUL")`, which

- is a Zod check, so the guard is satisfied and nothing new enters `.meta()`;
- advertises the identical leaf — `{"type":"string","minLength":1,"pattern":"^[^=\\x00]+$"}`,
  measured against the previous commit;
- keeps the compact presentation's leaf, where the earlier `not`/`allOf` form reduced the whole
  input to shallow property types.

Distinct from `declaredByPatterns` in `schemaConstraints.ts`: that helper declares a predicate the
schema cannot state, for predicates JSON Schema *can* express the regex is the check, and adding a
second declaration would be two sources of truth for one rule.

Red side: deleting the `.regex` fails the case with `AssertionError: "A=B": expected true to be false`.

`node scripts/verify/architecture-guards.mjs` — passed across 2 843 source files.
`src/domain/browserScenarioSecretName.test.ts` + `advertisedDialect.test.ts` — 42 passing.
`tsc --noEmit` 0 errors.

---------

Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(website): resolve tagged and latest release download links (#9238)

* fix(website): resolve tagged and latest release download links

* fix(website): reuse parsed release asset identity

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(javascript): preserve CommonJS exports through TypeScript wrappers (#4784)

* fix(javascript): preserve CommonJS exports through TypeScript wrappers

* fix(javascript): normalize wrapped CommonJS delete targets

---------

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>

* fix(desktop): retain reader scratch files under its cleanup owner (#9775)

* fix(desktop): keep reader scratch files under the cleanup owner

* test(ci): align callee discovery and invalid model extent expectations

* test(ci): preserve CLI source closure and initialize alias fixture state

* fix(cli): retain capture caller paths in environment builds

* fix(desktop): keep owned reader paths short for Unix sockets

* revert(desktop): restore canonical main before replay for #9775

This reverts commit 10011501e5, reversing
changes made to e2585aa7ce.

* fix(desktop): retain owned reader scratch on current main

* revert(desktop): restore canonical main before replay for #9775

This reverts commit 1e1f6b04f4, reversing
changes made to 047d75a498.

* fix(desktop): integrate upstream lifecycle CI corrections

* fix(desktop): run a local reader in its caller's folder to keep socket paths short

The runner nested a second realpath'd temporary folder inside the one its
caller already owns. On macOS the default TMPDIR then put a command's
Unix socket at 106+ bytes, past the 104-byte sun_path limit, so Python's
multiprocessing and other socket users could not bind under the private
TMPDIR. Work in the caller's folder directly, write the source under a
fixed name clear of the runner's own folders, and budget the regression
from the canonical root.

---------

Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(call-path): bound inline shortest-path enumeration (#4984)

* fix(call-path): bound inline shortest-path enumeration

build_call_path could allocate every shortest path before response-budget enforcement. Count the exact total with a capped BigInt pass over the distance graph instead, and bound enumeration itself: max_paths (default 64) is a caller-selected count preference while a 2 MiB serialized paths-field budget is the resource bound, checked before each cited path is formed.

The representation accounting measures each string with the rules JSON.stringify applies instead of charging six bytes per code unit, so an ASCII address or Evidence id is no longer billed six times what it writes, and the paths-array brackets the per-path accounting excludes are reserved. A path that serializes to 469,497 bytes is no longer refused as over the budget.

Results report total_shortest_paths, total_shortest_paths_capped, paths_truncated and paths_limited_by_bytes so exact counts, representation limits and completeness stay distinguishable, and a found result whose single path cannot fit still reports the known path with byte-budget truncation.

* fix(call-path): always return the first shortest path and measure cited paths

The byte budget dropped a sole shortest path whose citations exceeded
2 MiB, although that path is linear in the supplied Evidence; only path
count grows exponentially, and max_paths bounds it. Always return the
first path and let the budget bound the paths after it.

Measure each cited path with JSON.stringify instead of a hand-written
estimator that duplicated citePath's shape and JSON escaping (it also
charged U+007F-U+009F as escaped). The found result again requires at
least one path.

* refactor(call-path): measure cited paths from cached parts before assembling

A candidate path was cited and serialized in full before the byte check,
so a rejected path still built its representation. Move citation into
CitedPathParts, which builds each node and edge record once per graph
position with its exact JSON size. Enumeration sums a candidate from
those parts and assembles only an accepted path, which shares the cached
records. The path skeleton is measured from the same record constructor,
so size and output cannot drift.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(objdump): summarize command output by its size

Since the agent result budget, an over-budget inspect_with_objdump result
is replaced by its summary view, but that summary kept the complete
stdout and stderr. A whole-binary disassemble_all of a small C++ program
delivered 17.7 MB as its "summary", and over MCP exceeded the 10 MiB
stdio response limit, so the default call failed.

The summary now keeps every completion fact and reports available_counts
of stdout and stderr UTF-16 code units, as the GDB summary does for its
console streams; the retained parent keeps the complete output.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(objdump): describe the command summary output counts

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* refactor(gdb): name the MI stream record rule in the command observation owner

The GDB provider grouped console, target and log text by record prefix.
Name that rule beside the command result schema so the summary view can
select the same records without restating the prefixes.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(gdb): report console stream records by size in the command summary

The gdb_console summary dropped the console, target and log text but kept
every ordered record, and each stream record repeats that text. An
"info functions" summary of a small C++ program was 857 KB of console
records, so the over-budget delivery was as large as complete Evidence.

The summary now keeps result, asynchronous and unrecognized records in
order and counts the stream records it leaves in the retained parent.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(electron): trace IPC channels and bridge keys spelled as exact templates (#9538)

* fix(electron): trace IPC channels and bridge keys spelled as exact templates

Electron call-path tracing started only at calls whose first argument
was a quoted string literal, and its symbolic evaluator had no case for
template literals. A template without substitutions, such as
`app:template`, therefore stayed dynamic in the trace while the syntax
pass already reads it as a literal channel through
readExactJavaScriptLiteral. Wrapper registrations on such channels were
missing, direct handlers and contextBridge exposures keyed that way got
no call paths, and exact template switch cases lost their selection
condition.

The seed check, the evaluator and the switch-case label check now read
exact strings through readExactJavaScriptLiteral. Templates with
substitutions stay dynamic.

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

* test(electron): declare CommonJS in the exact-template CLI fixture

Since #9477, main counts an Electron finding as proven only in modules
declared CommonJS. The exact-template fixture used .js files without a
package.json, so after merging main the wrapper registrations stayed
unpaired (paired_renderer_transmissions 0) and the wrapper's own call
changed to inferred. The change under test still works: with .cjs files
the original expectations hold.

Name the fixture files .cjs, like the neighbouring fixtures in this file.

Validation: npx vitest run tests/boundary/cli/electronWrappedCallPaths.test.ts
- Tests 27 passed (27) on the built merged tree; npm run test:local on
electronWrappedCallPaths.test.ts and javascriptSymbolicBindings.test.ts -
Tests 326 passed (326).

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

* refactor(electron): read switch case literals through the exact-literal owner

* fix(electron): keep non-finite numeric switch cases as selection predicates

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix: name the violated rule in nested input refusals (#14766)

* fix(browser): name the rule when refusing a request header

A request step that set a browser-controlled header was refused with
"A page's fetch cannot set this header", which named neither the header
nor the rule. The advertised compact schema cannot carry this nested rule,
so the refusal is where an agent learns it. Name the header and say
whether it is browser-controlled or uses the reserved Proxy-/Sec- prefix.

* fix: name the violated rule in browser URL, CDP endpoint and Mach-O selection refusals

Invalid browser URL, Invalid CDP endpoint URL and Invalid Mach-O
container identity named no rule. The compact advertisement drops these
nested constraints, so the refusal is where an agent learns them. Name
the accepted form, without echoing values that may carry secrets, and
record the practice in the tool-design guide.

* chore(deps): update EVMole to 0.10.0 (#14765)

* fix(session): settle snapshot, shutdown, and cleanup-retry races (#14757)

* fix(session): settle snapshot, shutdown, and cleanup-retry races

- Invalidate the analysis snapshot only when an external mutation retires a
  bound engine. Without a target there is no analysis to retire, and the
  lingering flag made the next open discard a snapshot staged meanwhile.
- Let a deferred MCP server's close cancel in-flight runtime startup instead
  of waiting for it to finish before cleanup can run.
- Keep a concurrently confirmed command cleanup owner confirmed when a peer
  retry's stale stop reports it incomplete.
- Re-check provider registry closing after every wait so a selection is never
  admitted while a newer close is in progress.

* fix(session): stop cleanup owners registered while a retry is in flight

retryCleanup visits owners that appear during a stop await and returns
success only when none remain pending. An incomplete stop still cannot
replace an owner a concurrent retry has already confirmed.

* fix(mcp): keep a failed deferred startup failed when close aborts cleanup

The eager result classifies cancellation before its cleanup await. A close
that aborts during that await no longer treats a nonzero startup result as
a cancelled success.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* fix(domain): keep worker, SQLite, and sealing invariants owned (#14770)

* fix(domain): keep worker, SQLite, and sealing invariants owned

- Retain a late caller cancellation when SQLite keeps an unresolved worker
  owner instead of finalizing through runOwned.
- Key retained JavaScript static checkpoints by source identity so a
  discovered preload read with another package type releases its entry
  instead of leaking it across parked-worker reuse.
- Keep a parked JavaScript worker owned by its scope until its close
  succeeds.
- Borrow only sealed JSON members that sealing visited, and seal a shared
  subtree once instead of once per path.
- Refuse borrowed Evidence declarations whose resolution depends on the
  union branch their own frame parse selected.

* test(domain): bound shared JSON sealing inspections

A synchronous seal cannot be interrupted by the test timeout, so a lost
visited set would expand every shared path on the worker. Stop descriptor
reads after one per owned edge of this call and assert that count.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(website): honor validators and restore the implicit design system (#14768)

* fix(website): honor validators and restore the implicit design system

- Route every worker answer that skips Markdown negotiation through the HTML
  fallback, so validators and ranges removed for the probe still apply.
- Replace undefined classes with existing components and remove 27 CSS
  classes no page uses.
- Express article text color as a token so component colors win in both
  themes, and use logical properties for text-flow layout in RTL pages.
- Give an untranslated English fallback notice English direction.
- Start the page navigation closed without JavaScript, dismiss it with Escape
  or an outside click, and keep later copy clicks, failed key imports and
  first animation frames from corrupting demo state.
- Sync the theme bootstrap into the Notes fixture through a declared region.

* fix(website): skip Markdown negotiation for requests with a body

Markdown probing takes ownership of the caller request body. Methods other
than GET and HEAD have no Markdown representation, so they reach the asset
service once with the original body and validators.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(website): describe the homepage menu's closed start

The disclosure has no open attribute, so without JavaScript it starts
closed and the summary reveals the fragment links. The guide now matches
that, including overlay dismissal.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* style(website): wrap the worker precondition assertion

oxfmt's 80-column width is what Static checks enforce. The If-Match
comparison in the non-retrieval test exceeded it.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(desktop): tear down build computers whose reader or run state is uncertain (#14778)

- Close the build computer when every retained reader is uncertain instead of
  returning before teardown, then resolve those readers after the verified
  teardown.
- Record an absent marker when run-cancel claims an unstarted job, so a
  retried cancel answers absent instead of waiting forever.
- Roll back a cancelled capture start without the already-aborted signal.
- Keep an established long-run failure primary over a cancellation that
  arrives during its cancel, as the documented lifecycle rule requires.
- Read the sandbox only after the helper handshake settles, keep a newer stop
  attempt when retrying, clear the report drain timer, and retry a failed
  controller script read.

* fix(cli): reject invalid inline values and honor requested output on terminals (#14763)

* fix(cli): reject invalid inline values and honor requested output on terminals

- Reject inline boolean and empty number values the schema cannot accept
  instead of coercing --skill=yes to false or --limit= to 0.
- Give captured mcp add output the terminal presentation of every other
  command through one shared result destination.
- Show the unapproved setup plan whose remediation asks a terminal reader to
  review it, and open the setup rail once when a scoped run starts at approval.
- Treat --full-output and --token-count as requesting the result document, so
  setup and argument errors no longer add terminal presentation beside it.
- Answer --schema for an unknown command in the selected format, and set the
  exit code instead of exiting so piped stdout drains.

* fix(cli): keep rejected boolean and number literals across repeated flags

Binding stored one scalar value, so a later valid flag replaced an earlier
literal before the schema could reject it. Boolean and number literals the
field rejects now stay bound, including decimal unions and count options,
while repeated valid flags still use the last value. --dry-run keeps its
own error.

* test(cli): assert the terminal full-output failure envelope

The terminal --full-output regression only checked that usage text was
absent. Decode the default document and the --json envelope and require
VALIDATION_ERROR with the skill field's invalid_type error.

* test(cli): accept a counted setup approval prompt

A scoped terminal plan names every eligible action, so a Linux host that
can install Hopper asks "Apply these N changes?" rather than the singular
question. The consent helper now answers either prompt, and the rail test
finds that question before checking the intro was rendered once.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* feat(providers): retain native selection provenance in Evidence (#9668)

* feat(providers): retain provider selection provenance with session evidence

The registry records how a deep provider became selected and why every other candidate was rejected, and binary_session exposes those facts for the active route. Evidence already carried provider identity, but nothing recorded which candidates the session evaluated, so a retained record could not explain why this engine produced the observation or what the alternatives were.

Attach provider_selection to Evidence admitted by the session: the selection source and, for each evaluated candidate, its identity and version, selection state, availability and target-support outcome, and the stable rejection codes. The field is optional and excluded from semantic identity, following caller_input_path, so each admitted record stays attributable to the exact provider instance without changing observation identity, evidence IDs or replay.

Copy only stable selection facts. Candidate diagnostics, remediation prose and target content stay in the session status projection instead of being repeated in every record.

* style(domain): reformat the provider-selection assertion

oxfmt --check rejected the three-line expect() call; the formatter's
single-line layout is the canonical one, so Static checks failed only
on formatting.

* fix(evidence): keep a rejected record inside the Result boundary

`recordEvidence` ran `withEvidenceProviderSelection` before handing the record
to the ledger. That helper parses to seal the rebound envelope, so a tampered or
otherwise invalid record threw a `ZodError` from the attribution step and never
reached `EvidenceLedger.record`, which is where the declared `Result` is
produced. `tests/boundary/mcp/processEvidenceIdentityMcp.test.ts:454` asserts
`session.recordEvidence(tampered).ok === false` and fails on the throw.

Authenticate the input first and return the ledger's own rejection for a value
it would refuse anyway; attribution then only ever sees a record its reader
accepts.

* fix(binary): attribute imported records to the recording session

Import replaces a same-ID record's presentation metadata, and
provider_selection is part of that metadata. When runDirectAnalysis imports
the provider's own bundle, the copy it rebuilds carries no selection, so the
import erased the attribution the session had stamped and the caller kept an
unattributed record instead. Attribute at both merge sites, where the session
already authenticates everything it admits.

A refreshed route after a failed switch can bind a different selection than
the one the earlier binding held, so re-derive it there as the initial open
does; spreading the previous binding kept the stale value.

* fix(binary): admit record input before sealing it for attribution

recordEvidence and the two bundle import paths seal Evidence through
withEvidenceProviderSelection before handing it to the ledger. A sealed
value skips the ledger's ordinary-JSON and heap-headroom admission, so a
session with no authentication allowance accepted a mutable record and a
large record was copied and traversed before the guard ran.

Hold the caller's own value to that admission first, then attribute. The
import paths also refuse with a Result instead of falling through to an
unattributed import when admission fails.

* fix(binary): re-attribute a sealed record without traversing it again

recordEvidence now admits the caller's value before attributing it, but a
record returned by evidenceForAnalysis has already been through that
admission and is sealed. Running the ordinary-JSON walk and the
heap-headroom check over it again repeats the work the ledger itself
skips for a sealed value.

Ask the ledger first: a value it holds is the admission it made, so the
check costs one lookup. Only a value the ledger has not seen pays for the
full walk.

* fix(providers): return the recorded Evidence after import

Import re-stamps session provenance onto the Evidence it records, but callers kept the pre-import copy, so retained selection attribution and cache metadata were dropped from what analysis reported. Read the recorded record back after a successful import, and leave an already-retained record as the ledger attributed it instead of re-deriving attribution from the caller's copy.

* fix(providers): keep the caller's copy when re-attributing an imported record

The merge with main brought in the unchanged-record path, where an import whose only change is display metadata now replaces the ledger's record. Re-attributing that incoming value put the session's provider selection on the caller's copy, so the import reported a record that differed from what the caller sent. Attribution now applies only to records the ledger does not already hold.

The snapshot cache test now asserts the session's attribution explicitly instead of byte equality with the un-attributed source.

* fix(providers): keep the caller's record when importing over a retained one

The previous change skipped attribution for a record the ledger already held, which left the imported copy's own selection — missing or from another session — in place. Import replaces a same-ID record's presentation metadata, and provider_selection is part of it, so the session's attribution wins over the caller's copy while the caller's other display metadata is kept untouched.

* fix(providers): attribute staged snapshot and unknown-mutation Evidence

Address the open review findings on session provider provenance:

- importAnalysisSnapshot merged the re-attributed bundle into the ledger but
  staged the snapshot's own bundle, so AnalysisSnapshotCache rebuilt replay
  bindings from records the merge had replaced. Hand the merged bundle back
  to the stage so replays bind to the attributed evidence.
- recordResult recorded an attributed record and then serialized the
  caller's copy, so successful MCP responses omitted provider_selection
  while the ledger and exports carried it. Read the recorded Evidence back
  before delivery, as the direct analysis path already does.
- recordUnknown and updateUnknown synthesized unknown-mutation Evidence
  without the active session's provider selection, so those exported
  records were unattributed. Thread the binding's selection through to
  unknownMutationEvidence, which is where the record is produced.

* fix(providers): attribute the atomic Evidence-and-Unknown mutation record

recordEvidenceWithUnknown synthesizes its own rea.residual-unknown-mutation record, so the selection the session threads into recordUnknown and updateUnknown never reached it. The atomic comparison workflows therefore exported one record without provider_selection, contradicting the guarantee that every admitted record carries the recording session's selection. Thread the active binding through the atomic method as well; analyst-authored mutation records still keep analyst-inference authority and gain only the session selection.

* fix(evidence): require one selected candidate in provider provenance

provider_selection carries no separate selected-provider id, so a reader can only name the recording session's provider when exactly one candidate claims the selection. The schema accepted any candidates array, so an imported bundle could re-export zero or several selected candidates under a stable Evidence id and consumers would have no way to resolve the provider.

The recording paths always derive the selection from a single bound provider (AnalysisProviderRegistry selects one usable candidate, and SessionProviderRouter marks only the bound id selected), so the refine rejects only foreign input.

* fix(evidence): adopt the recording session's selection on a duplicate record

Recording an observation the ledger already holds under the same semantic ID
returned duplicate and discarded the attributed object, so lookup and export
kept the imported record's missing or foreign provider_selection. Replace the
retained display metadata with the active selection on that path; semantic
identity and the stored payload stay the same record.

The provenance schema also accepted a selected candidate that is unavailable
or unsupported, which no registry path can bind. Require the selected
candidate to be available and supported so an imported bundle cannot
re-export a selection that never occurred.

* fix(evidence): keep retained display metadata and notify observers on duplicate

Attribution replaced the whole stored record with the incoming copy, so a
provider-produced duplicate without the caller-selected path, alias set or
subject display erased the metadata the recording session retained merely to
add provider_selection. Adopt only the display facts the incoming copy actually
carries; omission is not deletion. Import keeps its documented replace
semantics.

The duplicate branch also returned before refreshEvidenceMetadata and
#emitSnapshotChanged, so replay caches and snapshot subscribers kept the old
metadata after a successful replacement. Treat a non-no-op replacement exactly
as the import path does.

* fix(artifacts): compare Evidence by identity across a replay session

The composed-workflow test opened a second fixture, which writes its own
temp artifact, so a replay record's subject path and the session-attributed
provider selection no longer matched the snapshot copy. Both are display
metadata outside the Evidence id; the provider call is what establishes
the binding here, so compare the content the id commits to and assert the
ids separately, which the test already does.

Also apply the formatter to BinarySessionInvestigation.test.ts, which
fails format:check on its own.

* fix(server): deliver the retained copy that carries the session selection

Recording stamps the active session's provider selection onto the ledger copy
of a semantic ID. The tools that build or project their own Evidence value
then delivered that unattributed copy, so the MCP response and the snapshot
export disagreed for the same evidence_id: Ghidra reference and evidence
flows, composed workflow overviews, analysis functions and the process
capture tools all failed deep-equality against the retained record.

Hand the delivered copy the session's selection when the ID is retained.
Other retained display metadata, such as a caller path carried by an
imported record, stays as the caller built it.

* test(investigation): keep the session test within its lint and format limits

Two checks on this branch failed for reasons the branch itself introduced:

format:check wants the withEvidenceProviderSelection call in
UnknownEvidence.ts wrapped at its argument list, which the branch's
edit moved off.

lint reports max-lines-per-function (152 lines, limit 150) for the
"reobserves resource-scoped ..." case after the branch expanded two
assertions in it. The provider-selection expectation is a fixed value,
so it moves to a module-level constant and the case drops back under
the limit without weakening either assertion.

* fix(server): carry the session selection on the workflow copy delivered

Commit 76d14ff9f stamped the delivered copy with the retained session
selection by patching registerEnhancedTools and registerEvidenceTools.
Upstream #11617 replaced both with the shared contract bindings, so the
merge dropped the stamp and the composed-workflow tools delivered an
unattributed copy again: workflowSnapshotReplayMcp compares the live
binary_overview response against the replayed Evidence and saw 19 fields
against 18.

Stamp at createAnalysisToolHandler, where every analysis workflow's
Evidence leaves for delivery, using the retention lookup already passed
in. A call whose ID is not retained, or whose record carries no
selection, is delivered unchanged.

* chore(schemas): record the provider_selection evidence schema digest

Adding provider_selection to the shared Evidence schema changes the output
compact schema of every tool that returns Evidence, so Build package
rejects 211 stale advertised catalog summaries. The summaries were
refreshed by running npm run verify:advertised-schemas -- --update-summary;
each file changes only its output compact digest.

* test(mcp): assert retained provider attribution instead of producer identity

Recording now stamps the session's provider selection onto retained Evidence,
so a producer-built copy and the retained record share every semantic member
but differ in provider_selection. Replace raw object identity/equality
assertions with display-metadata agreement plus a selection-neutral deep
comparison, and deliver the retained selection from contract tools so callers
do not receive an unattributed copy of the same evidence_id.

Verified: tests/boundary/mcp (345 files, 2289 passed / 12 skipped after
generating .cache/mcp-tool-catalog.json); npx tsc --noEmit exit 0.

* test(mcp): share the selection-neutral comparison across provenance assertions

Seven sites repeated the same spread-and-mask expression, which pushed the
test past the 150-line function limit and failed Static checks. Move it into a
withoutSelection helper that drops the session's provider_selection stamp and
compare both sides through it.

Verified: npm run check:fast (typecheck, lint, architecture guards);
the six boundary files CI reported, 37 passed.

* test(mcp): fold repeated retention checks into one helper

Static checks failed on format:check for three files and then on
max-lines-per-function after oxfmt re-wrapped the assertions. Run oxfmt on
the three files and replace the repeated selection-neutral comparisons with
an expectRetained helper so the test stays under the 150-line limit.

Verified: npm run check:fast (typecheck, lint, architecture guards);
npm run format:check; the six boundary files CI reported, 37 passed.

* test(snapshot): compare retained records without the session selection stamp

The same attribution change makes a fixture-built record differ from the
retained one by provider_selection alone, so the equality assertion failed in
both the portable and sharded lanes. Mask the stamp and keep every semantic
member under strict comparison.

Verified: npx vitest run tests/boundary/filesystem/analysisSnapshotProvenance.test.ts,
2 passed; npm run lint (0 errors); oxfmt --check.

* chore(schemas): record the provider_selection output digest on five tools

The session_provider_facts binding gained a .describe() explaining that the
selection source and candidate outcomes are retained with each admitted
Evidence record. That text is part of the advertised output schema, so every
tool whose output embeds the binding has a new compact digest.

Regenerate the committed catalog summaries with
npm run verify:advertised-schemas -- --update-summary. Only the five output
compact hashes change; no tool's shape or pattern changes.

* fix(evidence): keep a retained record's caller-selected path when adopting metadata

adoptEvidenceDisplayMetadata let a later copy's caller_input_path overwrite the value already held under the same semantic id, so a second selection through a different alias rewrote the display path the first selection recorded. Prefer the retained value and take the incoming one only as a fact the retained record lacks.

* fix(evidence): stamp the session provider selection on summarized delivery

Recording stamps the active session's provider_selection onto the retained
record under the same Evidence id. The summary delivery path re-admitted
the summarized copy without that stamp, so a caller reading a summarized
result saw no provider_selection while the retained record carried one, and
the response and the retained view disagreed for a single id. Pass the
retention lookup to deliverEvidenceResult on both the analyze_function and
external-mutation summary paths so the delivered copy carries the same stamp.

* chore(schemas): refresh UEFI tool summaries for the Evidence schema change

main added the UEFI inspection and extraction tools after this branch
regenerated the advertised catalog summaries, so their output compact
digest still recorded the pre-provider_selection value. Regenerate them
so the shared Evidence schema digest matches the branch.

* test(investigation): compare borrowed records without the selection stamp

Importing a sealed bundle stamps the session's provider_selection onto every retained record, so a borrowed record no longer shares object identity with the caller's unstamped bundle record. Replace the identity and equality assertions with a selection-neutral deep comparison, matching the attribution handling already applied to the snapshot and MCP provenance tests.

* fix(investigation): admit unknown mutations against their expanded Evidence

record_unknown and update_unknown check authentication headroom against the
caller's input before building the mutation Evidence. The Evidence repeats
parts of the input (for example the question in both parameters and the
normalized result), so with live headroom that admits the input but not the
larger record, the operation authenticated and sealed a representation past
the stated bound. #readEvidence skips the admission for immutable records, so
nothing downstream re-checked it.

Charge the derived Evidence's authentication cost in addition to the input
before sealing it, across the record, atomic record-with-unknown and update
paths. The regression test finds an allowance between the two sizes and
asserts the operation is refused with no Evidence recorded.

* chore(schemas): refresh advertised summaries after the provider-selection change

The advertised-schema catalog digests still described the pre-change input
schemas, so the Build package lane failed with 28 missing or stale summary
files and skipped every lane downstream of it. Regenerate the summaries with
npm run verify:advertised-schemas -- --update-summary.

* test(deno): damage Deno PE resource framing at the directory entry

The fixed-allowance case shrank the language directory Size to make the
65,535-row table malformed, but #14253 now walks resource trees at their
RVA whatever Size declares, so the table stayed well-formed and the run
reported the entry allowance (truncated/limit) instead of malformed
framing (unsupported_target/malformed). Point the type directory's entry
at a language directory outside the file-backed resource bytes, whose
header cannot be read. This mirrors the fix already on main (271bad782).

* fix(evidence): preserve source provenance and admit before copying

* fix(providers): scope selection provenance to native executions

* fix(providers): carry native provenance through workflow projections

* fix(providers): retain selection on shared session limitations

* fix(providers): preserve provenance during source recovery

* test(contracts): refresh combined Android reference schema

* fix(evidence): admit provider metadata before copying observations

* fix(evidence): recover completed calls after context refusal

* test(contracts): format merged call path schema summary

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* chore(deps): update EVMole to 0.10.1 (#14781)

* fix(server): reject duplicate in-flight MCP request IDs (#14776)

* fix(server): reject duplicate in-flight MCP request IDs

A tools/call whose JSON-RPC id matched an in-flight request replaced the
first request's validation owner. The first reply then settled the second
request, the first never finished publication, and BinarySession's call
drain waited forever. Completions overwrote their abort controller and
target-content marking tracked ids in a set.

Refuse a request whose id is still in flight with -32600 before any
bookkeeping changes; MCP forbids a requestor from reusing an id within a
session. Track active tool requests by owner rather than id, abort a replaced
completion controller, and count target-content calls.

* fix(server): own every in-flight MCP request until its reply settles

Duplicate rejection only consulted method-specific maps, so a prompts/get
still awaiting its reply did not reserve its id. Reply cleanup also treated
a missing tool owner as permission to clear that id, which let a completion
reply already inside send() abort the controller installed after cancellation.

Every accepted request now has one owner. Cancellation drops that owner only
when no reply has entered send(), because the SDK suppresses that reply. A
reply settles the owner it captured, and only while that owner still holds
the id.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* fix(providers): settle debugger and engine close races (#14783)

* fix(providers): settle debugger and engine close races

- Re-admit a JEB connection after disposal so a close or cancellation that
  arrived meanwhile cannot resurrect a transport.
- Mark a GDB session as closing before every debugger stop, so an incomplete
  stop is retried as cleanup, and admit one close past a full command queue.
- Fail a Rizin detach that would wait behind an active command, as GDB does,
  instead of timing out and running an orphaned detach later.
- Run a forced Ghidra stop requested during a graceful close, and check reply
  size against the largest in-flight request ceiling.
- Evict a failed or cancelled IDA configuration read from its scope cache.
- Serialize Cutter commands per session so an unknown completion gates the
  next command, and stop the Cutter bridge closing a descriptor its stream
  already owns.

* fix(providers): keep the Cutter gate and interrupt a stalled Ghidra close

- Keep a session's Cutter turn until the chain of a waiter cancelled before
  its turn settles, so a later command still queues behind the running one.
- Fail the bridge requests a graceful Ghidra close is waiting on when a
  forced stop is requested, so a stalled checkpoint cannot block the stop.

* test(ghidra): cover a forced stop interrupting a stalled graceful close

Add a fake bridge mode that holds the final close checkpoint while a tool
never answers. A caller cancelling that tool during the held close must
still stop the process; without the escalation the close never settles.

* fix(native)!: bound Android packed relocations with max_structure_bytes (#14788)

BREAKING CHANGE: Oversized Android APS2 packed relocation tables in inspect_native_initializers now project a memory/adjustable_budget refusal (boundary max_structure_bytes with details.limit) instead of capacity/fixed_ceiling (native-index-capacity).

* fix(providers): bind client cleanup state to the exact client (#14777)

* fix(providers): bind client cleanup state to the exact client

- Mark an error incomplete when it first binds incomplete cleanup
  dependencies, and keep settled cleanup monotonic.
- Bind the client lease to the client it closes and record the failure its
  close produced, so external settlement of that failure releases the client
  and a replacement client gets its own lease.
- Keep the latest close options across concurrent close calls.
- Document why several release claims are successive owners of the same
  resources.

* test(providers): remove the unused client cleanup fixture import

The replacement-client tests wait on phaseGate and the acquire result.
They do not use binarySession's deferred, so that import is unused.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* fix(browser): settle Frida, Playwright, CDP, and Electron cleanup races (#14786)

* fix(browser): settle Frida, Playwright, CDP, and Electron cleanup races

- Record an owed resume when a Frida spawn's script stays retained after its
  session detached, so a close retry resumes the target.
- Give a clean Playwright open failure its bounded cleanup before reporting,
  and wrap only leases that remain unreleased.
- Retire the main policy session when CDP reports it gone, instead of
  failing every service-worker cleanup retry.
- Skip lifecycle enabling for a CDP capture that ended before arming, and
  report a termination observed after the window.
- Capture only the Electron scripts parsed before capture, and give the CDP
  Electron provider its own ASAR descriptor owner.
- Wait for any close that starts while V8 admission waits for one.

* fix(browser): recover a gone main session in every command, report late scripts

- Mark the main policy session detached whenever a command on it is rejected
  as session-gone, and stop a cancelled capture's navigation through the
  Playwright frame when Page.stopLoading finds the session gone, so cleanup
  retries no longer repeat the same failed command.
- Count Electron scripts parsed after script capture, report them as dropped
  and include them in the total, as web capture does.

* fix(apktool): restore package identity from decoded metadata (#14767)

* fix(apktool): restore package identity from decoded metadata

* fix(apktool): preserve explicitly empty manifest package attributes

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(dwarf)!: bound PE COFF section-name decoding with max_structure_bytes (#14787)

BREAKING CHANGE: Oversized individual PE COFF long section names in inspect_dwarf_units now project an adjustable_budget refusal (boundary max_structure_bytes with details.limit) instead of fixed_ceiling (pe-section-name-bytes).

* feat(firmware): inspect uClinux bFLT flat executables offline (#14663)

* feat(firmware): inspect uClinux bFLT flat executables offline

The reader matches the bFLT magic on any filename, records the 64-byte
big-endian header, and extracts text.bin (header included), data.bin,
and relocations.bin while listing relocations as stored words. gzip and
gzdata bodies inflate under artifact_limits.expanded_bytes; revision 2
is always stored, and its relocation words stay unchecked because their
layout depends on a CPU the header never names. A missing magic or a
header shorter than 64 bytes is the only refusal, other inconsistencies
are limitations beside the remaining facts, files above 128 MiB are
rejected, and the follow-up probe opens the text image as a raw binary
with a caller-chosen architecture and entry.

* Address review feedback

* Address review feedback

* fix(firmware): cap bFLT in-memory gzip inflation working memory

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(windows): accept a private DACL when the user is SYSTEM (#14769)

The trustee check treated the user SID and SYSTEM as exclusive. When the process user is SYSTEM, both ACEs match the user and the SYSTEM flag stays unset. Compare the two SIDs independently.

* fix(process): settle worker, scope, and capture retries against close (#14779)

* fix(process): settle worker, scope, and capture retries against close

- Return before posting a regex job that was cancelled before dispatch, and
  report a stop failure even when the match itself succeeded.
- Keep a worker runtime closed when start races a cleanup retry, and let
  sibling retries wait instead of reporting runtime_closing.
- Ignore owners a concurrent release settled while a scope drained.
- Check scope closure before waiting on a drain, and send SIGKILL once.
- Share one ASAR snapshot open across concurrent readers so a cancelled
  reader cannot close a peer's descriptor.
- Keep a verified staged-output identity across close retries, and stop the
  stdio transport from counting or reading after close or repeating its
  input end and onclose on retry.
- Clear a file deadline's timer when it ends.

* fix(artifacts): close a cancelled ASAR snapshot handle before publishing it

Snapshot acquisition is already serialized by the operation queue. The shared
open published the descriptor and then returned cancellation without closing
it, so the boundary test still saw a live fd. Close that handle before it is
published and drop the duplicate waiter state.

* fix(process): end the capture wait when a direct SIGKILL throws

The direct kill paths recorded killSent and then called unobservedExit, which
returned while finalization had not started. Settle that wait as unobserved
with the initiating reason and no exit code or finalization record, including
the zero-interval deadline path.

* fix(process): notify stdio close once after a natural server exit

Exit and output-close called onclose without the close flag, so a later
close() sent it again. Route exit, output close, and explicit close through
one notifier.

* test(process): cover post-acquisition abort and drain-time release

Abort after an idle worker is acquired and before dispatch, and fail a scope
owner during drain before a concurrent release succeeds. Those are the paths
the close-against-retry fixes change.

* fix(domain): remember sealed JSON identities weakly

The per-call completed set retained every finished row, so sealing an
object-heavy Evidence tree exceeded the ancestry budget. A WeakSet still
seals a shared subtree once, and the strong set stays the active ancestry.

* test(resources): release the drain gate if an assertion fails

The drain regression held owner2 until after its assertions. A failed
barrier left close waiting. Release the gate and join close in finally.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(resources): close unadmitted output handles and preserve caller directories (#13201)

* fix(resources): close output handles when pending-file admission fails

Rollback admitted pending files before closing their handles.
An admission failure skipped the close and left the descriptor open.
Close the handles after that failure, keep the unadmitted tree, and report the admission error.
A close failure stays on the admission error as cleanup.

* fix(resources): rethrow a refusal of an unowned output directory

create wrapped a non-empty accepted directory in SafeOutputTreeCreationFailure.
Callers then rolled that tree back, and the cleanup treated the caller's files as an unowned remainder.
Rethrow SafeOutputTreeDestinationRefusal when this call did not create the directory.

* fix(resources): retry pending-file cleanup without a closed handle

Store identity from the exclusive handle before the path check. Rollback closes that handle only after the identity is stored. A later rollback checks the path. A handle with no identity yet stays open.

* fix(resources): retain cleanup for a refused existing output directory

A withheld copy can find a caller file after its directory was planned empty. The refusal keeps the constructed tree so the writer can retry verification. Rollback preserves the root and leaves that file in place.

* fix(resources): report a refused existing directory as input

A file that appears in an accepted directory after planning belongs to the caller. create rethrows that refusal without attaching a tree. writeOutputTree reports an input error for the selected field. A tree this call created still rolls back through SafeOutputTreeCreationFailure.

* fix(windows): keep N-API failures inside the callback (#13193)

* fix(windows): keep native call failures inside the N-API callback

failureValue can throw while it builds the JS error. That second Failure left call() and could terminate the process. A pending exception stays the result.

* fix(windows): keep input completion inside the N-API callback

completeInput rejected through failureValue with no catch. A throw skipped the process reference release and escaped the completion callback.

* fix(windows): release the snapshot root reference when admission fails

The reference was created before the async-work try, so a later throw leaked it. Completion now reports cleanup failures without leaving the callback.

* fix(cli): load Electron fuse inspection on demand (#13922)

* fix(elf): mark missing tables unreadable when dynamic counts are nonzero (#14291)

When an ELF PT_DYNAMIC table declares a nonzero count (DT_VERNEEDNUM,
DT_VERDEFNUM, or a hash-derived dynamic symbol count) without a matching
table address tag (DT_VERNEED, DT_VERDEF, or DT_SYMTAB) or section header,
ElfDependencyParser previously treated the missing table as absent and
reported coverage.status: "complete" with no table_unavailable issue.

Report a table_unavailable issue at PT_DYNAMIC (and mark
version_requirements or version_definitions "unreadable") whenever a
nonzero declared count cannot locate its table, while keeping zero counts
and section-backed tables complete. Add unit and compiled CLI regressions.

* fix(gpu): keep the PTX target unknown when braces are unbalanced (#12888)

readPtxTarget clamped an unmatched `}` to depth zero and never checked for
a body still open at end of text, so standalone PTX that kernel inspection
rejects as "Unbalanced PTX body" or "Truncated PTX entry declaration" still
reported complete discovery and an established target. Treat both cases as
malformed text at the target reader so inventory and kernel inspection
agree.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* feat(artifacts): inventory Nintendo DS ROM binaries, overlays and file tables offline (#14664)

* feat(artifacts): inventory Nintendo DS ROM binaries, overlays and file tables offline

Recognition now claims a Nintendo DS ROM from the cartridge header:
stored logo CRC 0xCF56, unit code 0, 2, or 3, an ARM9 offset after the
header, and a matching logo-area or header CRC. Inspection records those
header facts on the root and lists arm9.bin, arm7.bin,
overlays/<cpu>/overlay_<id>.bin, FNT-named data/<path> files, and
unnamed fat/<id>.bin files as stored byte ranges. A checksum mismatch, a
partial table, or a range past the end of the file leaves coverage
unknown. Secure-area encryption, compressed overlays, and NitroARC
archives stay undecoded, and the format is registered for inventory,
extraction, and the docs.

* docs: move the Nintendo DS ROM guide under guides/firmware

* Address review feedback

* Address review feedback

* Address review feedback

* fix: Compare NDS entry addresses and overlay facts

* fix(artifacts): bound NDS path expansion and enforce expanded_bytes

* fix(artifacts): omit NDS format declaration for ordinary filesystem files

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(artifacts): inventory Nintendo Switch NSO and NRO executables offline (#14655)

* feat(artifacts): inventory Nintendo Switch NSO and NRO executables offline

Detection uses the bytes: NSO0 at the start of the file, or NRO0 at
offset 0x10. Inventory records the module id, flags, and MOD0 offset,
lists the text, rodata, and data segments, and for an NRO adds the ASET
icon, NACP, and RomFS when that trailer is present. Compressed NSO
segments are raw LZ4 blocks decoded under
artifact_limits.expanded_bytes, with the stored size and the decoded
size both reserved before allocation, and hash_status is match,
mismatch, not-checked, or unavailable. Truncated, over-budget, and
invalid-LZ4 entries stay listed while their bytes are refused, and a
positional reader can stream those decoded bytes instead of the stored
file range.

* fix(artifacts): keep valid NRO assets when one ASET range is unsafe

* docs: move the Switch executables guide under guides/firmware

* Address review feedback

* Address review feedback

* fix(artifacts): unify Switch NSO budget admission and test deadlines

- Remove the duplicate NSO decoded-only budget pre-check in #prepareNso so
  #admitStoredInput owns all compressed-segment admission and reports an
  accurate required_value covering both stored and decoded bytes.
- Use testWaitDeadline() in SwitchExecutableArtifactReader.boundaries.test.ts
  instead of a hardcoded 2_000 ms timeout.
- Reuse tests/fixtures/lz4LiteralBlock.ts in switchExecutable.fixture.ts.

* test(domain): throw typed parse errors in Switch parser tests and fix doc formatting

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(package): leave the source-checkout prepare script out of the published manifest

The published manifest kept every development script, including
prepare, which only patches release-please in a source checkout and does
nothing in an installed package. npm 11 treats prepare as an install
script, so "npm install -g rea-agents" warned that rea-agents has install
scripts not covered by allowScripts and suggested allowing them.

The staged package manifest now omits prepare. Installing the staged
tarball with npm 11.19.1 lists only frida's own installer.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(package): declare the projected manifest scripts without prepare

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(artifacts): inventory OCI image layouts offline (#12470)

* feat(artifacts): inventory OCI image layouts offline

OCI image-layout directories (oci-layout, index.json, blobs/) arrive as evidence and previously required walking the JSON by hand.

This adds inspect_oci_image_layout / inspect-oci-image-layout for the directory form only. It reports layout version, nested indexes, image config facts, layers, and streamed SHA-256 (and SHA-512 when declared) verification of present referenced blobs. Env values stay omitted unless include_env_values is selected. Missing blobs, digest and size mismatches, unreferenced blobs, unknown media types, unsupported digest algorithms, and symlink blobs are findings. Layer contents are not decompressed.

* fix(oci): preserve whitespace in image config strings

Keep config facts such as WorkingDir exactly as written instead of
returning their trimmed form. Blank values still count as absent.

* fix(oci): read the platform os.version member

The OCI image index stores a platform version under the literal
"os.version" member, so Windows entries that share OS and architecture
keep the build that tells them apart.

* fix(oci): keep config Env values unless the caller omits them

Env values are bytes from the selected image, and AGENTS.md asks to
preserve local evidence without inferring secrecy from names. The
include_env_values control now defaults to true; false still leaves each
value null and keeps the names.

* fix(oci): report descriptors the parser cannot model

An index, layer or config descriptor without a string mediaType or digest
was dropped with no diagnostic, so an index of only malformed descriptors
read as an empty, fully covered index. Each such descriptor now records a
malformed_blob_json finding naming its position, what it lacks and any
digest it carries.

* fix(oci): walk nested indexes breadth-first

The index walk was depth-first with a visited set that ignored depth, so
an index shared between a nested path and the root was first visited too
deep, and what it reached within max_index_depth was never inventoried.
Indexes now queue breadth-first, so each is first reached at the
shallowest depth any path gives it.

* fix(oci): check every declared size of a shared blob

When several descriptors referenced one blob with different sizes,
remember kept only the first declaration, so a wrong later size was
never checked. Each referenced blob now keeps every distinct declared
size, and the file-size and hashed-byte checks run against each one.

* fix(oci): report partial coverage when referenced JSON is not read

A referenced index, manifest or config that was a symlink, or otherwise
could not be read, left its facts unexamined while coverage still read
complete. Any skipped referenced JSON read now makes coverage partial,
whatever finding explains it.

* fix(oci): report unsupported layer digests without calling them missing

A layer whose digest used an unsupported algorithm got no finding and
was recorded as a missing blob, even when its file existed, and coverage
could read complete. Every referenced digest with an unsupported
algorithm now records unsupported_digest_algorithm, its blob record
reflects the file at blobs/<algorithm>/<encoded>, and such a finding
makes coverage partial.

* fix(oci): keep the parse outcome when reader cleanup fails

The provider's finally replaced the parse result with a cleanup failure
that always claimed the parse completed, so a refusal, cancellation or
integrity failure and its layout snapshot were lost when closing the
reader also failed. The parse outcome is now captured first; a failed
parse stays the primary error, with its partial facts, and the cleanup
failure is attached to it.

* Address review feedback

* fix(oci): keep oci-layout snapshot on missing imageLayoutVersion

Build the oci-layout file snapshot before checking imageLayoutVersion and
attach it to the refusal, so a readable oci-layout without a version still
reports its sha256 and byte count.

* fix(oci): keep directory traversal coverage in layout reports

parseOciImageLayout iterated the directory reader without an onCoverage
sink, so names the reader skipped (for example non-UTF-8 names on Linux)
left the report claiming complete coverage with no limitation. Collect
the traversal coverage, carry its limitations into the report, and let
unknown or partial traversal coverage override the findings-based status.
A reader that reports nothing is treated as unknown.

* fix(oci): keep reader failures on referenced blobs

A referenced index, manifest or config read that failed in the reader,
for example a close failure after the JSON was fully read, was recorded
as malformed_blob_json and the call carried on. Only format failures
become findings now; reader failures reach the caller with their own
facts.

* fix(oci): budget decoded descriptors separately from directory entries

max_entries bounds the directory walk, but index, manifest and layer
descriptors also spent it, so many manifests sharing layers were refused
far inside the advertised directory budget. Decoded descriptors now spend
their own max_descriptors allowance (default 65536, maximum 1048576), and
a refusal names that allowance.

* fix(oci): keep the completed inventory when reader cleanup fails

When parsing finished but closing the directory reader failed, the
provider threw a cleanup failure built against a placeholder outcome and
the completed inventory was dropped. The cleanup failure now carries the
completed report as unretained Evidence in its partial observation, the
same way DesktopApplicationReader keeps its report. A provider test
covers that case and checks that a later close retries the failed
reader cleanup.

* fix(oci): keep reader omissions out of complete layout coverage

parseOciImageLayout took the directory reader's coverage but not its
omission callback, so a FIFO, socket or device node under blobs/ was
dropped from the blob inventory while the report still said complete.
Collect omissions other than the intentional skip of directories
outside blobs/, name the first one in a limitation, and report unknown
coverage when any were seen.

* refactor(oci): classify layout failures through classifyProviderFailure

The provider kept its own raw-error ladder in layoutFailure. Its OCI
decisions (unsupported root or symlink, parse limits with budget
recovery, format failures, reader failures) are now the recognise step
of a ProviderFailureDialect, with the io report as its unclassified
fallback, so typed failures pass through, cancelled reads use the shared
cancellation path, and a failed read's cleanup is bound by the shared
owner.

* fix(oci): match referenced blobs by resolved path

parseOciDigest accepts uppercase SHA-256 hex and resolves it to the
lowercase blob path, but the unreferenced-blob sweep keyed membership by
the descriptor's original spelling. A blob named that way was hashed as
referenced and also reported as unreferenced_blob with a second
referenced: false row. Track the resolved paths of referenced blobs and
skip them in the sweep.

* fix(oci): read shared configs once and budget expanded config facts

Each manifest reread and reparsed its config, and every image carried its
own copy of the facts, so many small manifests sharing a large config
could expand to far more memory than the per-file limits suggest before
the service checked the report.

Each config blob is now read and parsed once per layout and its facts are
reused. The config bytes behind each image spend a new max_config_bytes
allowance (default 64 MiB, maximum 512 MiB) before the image is added, so
a shared config counts once per image and an expansion past the budget
refuses the inspect and names that allowance.

* fix(oci): report blob sizes above 4 GiB

Descriptor, layer and blob sizes used the 32-bit count schema, so a
layout with a blob over 4 GiB produced a report the output schema
rejected, hiding its blob_oversize finding. Sizes now accept any
nonnegative safe integer; depth and coverage counts stay 32-bit.

* fix(oci): report a referenced layer that is not a regular file

A referenced layer whose blob path is a directory was recorded as kind
other with present false, but no finding was emitted. Layer blobs never
go through the referenced JSON reader, so coverage stayed complete even
though the layer was never verified. The layer now gets a missing_blob
finding, matching non-file indexes, manifests and configs, and coverage
is reported as partial.

* fix(oci): keep the oci-layout hash when a later budget refuses

A manifest or config past max_json_bytes, or a layout past
max_descriptors or max_config_bytes, threw a bare ParseFailureError
after oci-layout had been read and hashed. The provider only attaches
partial facts to OciImageLayoutRefusal, so that completed observation
was dropped.

The parser now rewraps any later ParseFailureError as an
OciImageLayoutRefusal carrying the oci-layout snapshot, so every
refusal after that point reports it as the partial observation.

* fix(oci): keep blobs unknown when the reference walk is truncated

When max_index_depth, an unreadable index or manifest, or a descriptor
that cannot be modeled stops the reference walk, blobs outside the
walked part were reported as unreferenced_blob. They may still be
reachable from what was not examined, so the parser now only asserts
unreferenced status after a complete walk and otherwise records a
limitation and leaves those blobs out of the inventory.

* fix(oci): report wrong-typed manifests and layers arrays

A non-array manifests member in index.json now refuses the layout and
keeps the oci-layout observation. A non-array manifests member in a
nested index, or a non-array layers member in a manifest, records a
malformed_blob_json finding and marks the reference graph truncated
instead of reading as an empty collection.

* fix(oci): report image configs whose root is not a JSON object

A config blob holding valid JSON such as [] or null fell back to empty
facts with no finding, so the report claimed complete coverage. Record a
malformed_blob_json finding for the config digest while keeping the
manifest and layer observations.

* fix(oci): decode only image config media types as JSON

A manifest whose config is application/octet-stream or another
non-image type no longer has its config run through the JSON decoder.
Valid binary config bytes produced a false malformed_blob_json finding,
and a config larger than max_json_bytes refused the whole inventory even
when it fit max_blob_bytes. Such configs now stay opaque references that
the blob pass hashes; the unknown_media_type finding is kept.

* fix(oci): bound JSON reads by the descriptor budget

The service checked json_bytes_read against one max_json_bytes document
per returned index and image plus two. A layout reads a manifest and a
config per image, and manifests or nested indexes that fail to parse are
read without appearing in the report, so valid layouts whose every
document fit max_json_bytes could be rejected after parsing.

Every nested index or manifest read is charged one descriptor and each
manifest reads at most one config, so bound the total by oci-layout,
index.json and two documents per allowed descriptor.

* fix(oci): count OCI 1.1 subject blobs as referenced

A manifest or index subject that names a blob present in the layout now
joins the referenced set, so the blob is hashed and is not reported as
unreferenced. A subject absent from the layout is allowed by the spec
and adds no finding. A subject that is not a descriptor is reported as
malformed and keeps unreferenced blobs unknown.

* fix(oci): keep caller selections in cleanup-recovered Evidence

When the reader fails to close after a completed inspection, the provider
keeps the inventory as partial Evidence built from the resolved input, so
its parameters named defaults the caller never chose and its Evidence ID
differed from the success path. Build both from one OCI Evidence helper
and have the service rebuild a recovered inventory from the caller's own
selections.

* fix(oci): keep blob rows when the reference graph walk is incomplete

When a nested index or manifest could not be read or exceeded
max_index_depth, every blob outside the walked part was dropped from the
report, losing its path, size and kind. List those blobs with a null
referenced status instead, and report unreferenced_blob only when the
whole graph was examined.

* fix(oci): report unknown media types on present subjects

A subject blob present in the layout now joins the referenced set, which
removed its unreferenced_blob finding. Index entries, layers and configs
also report an unfamiliar media type, but subjects skipped that check, so
an unknown subject format went unreported. A present subject with an
unknown media type now records unknown_media_type.

* perf(oci): index emitted blob findings instead of rescanning them

The blob inventory loop checked each referenced digest against the whole
findings array before recording missing_blob, symlink_blob, or
unsupported_digest_algorithm, which is quadratic for layouts with many
missing blobs. Index finding kind and digest in a set built once before
the loop so each check is constant time. Output is unchanged.

* fix(oci): report invalid descriptor sizes as malformed

An index entry, config, layer or subject descriptor whose required size
was missing, a string, negative or fractional became a null size, which
dropped it from size validation without any finding, so the report could
claim complete coverage. The descriptor still keeps its other facts, but
the defect is now recorded as malformed_blob_json on the owning blob.

* fix(oci): keep damaged config, subject and descriptor facts in the report

Image config parsing kept any string in rootfs.diff_ids, so a readable
config with diff_ids [""] produced output the schema rejects and the
service discarded the whole inventory as an AnalysisOutputError. Config
parsing now owns that boundary: diff_ids members that are not nonempty
strings, and empty ExposedPorts or Volumes keys, are omitted and reported
once per config blob as malformed_blob_json, and the manifest and layer
observations stay in the report.

Related gaps in the same walk:

- A present subject was hashed but never walked, so blobs it names were
  reported as unreferenced. A subject manifest now goes through
  walkManifest and a subject index joins the breadth-first index queue one
  level below its owner, within max_index_depth.
- A manifest with no config member reported complete coverage. A missing
  config is now treated like a malformed one.
- A symlinked referenced blob was not hashed but left coverage complete.
  symlink_blob now makes coverage partial.
- An unusable descriptor size was serialized into the finding message.
  It is now described by type and length, with short strings quoted.
- A reader failure after oci-layout was hashed dropped that observation.
  It is now attached when the reader did not attach its own.
- Annotation and label names allowed by OCI, including the empty key,
  failed the output schema. The name is now any string. The advertised
  compact output schema summary is unchanged.

* perf(oci): index declared sizes for shared blobs

Recording a distinct declared size scanned every earlier declaration for
the same blob, so many references to one blob with distinct sizes cost
quadratic work inside max_descriptors. ReferencedBlob now keeps a Set
beside declaredSizes for membership, and the array keeps declaration order
for verification.

* fix(oci): walk subject manifests from a queue

Finish each manifest before reading the one its local subject names, so a
long subject chain no longer keeps every parsed document alive at once.

* fix(oci): resolve unsupported-digest layer presence at its layout path

A layer stored at blobs/sha1/<hex> was reported present: false because
the layer lookup only resolved verifiable digests, while the blob
inventory reported the same file present. Use the grammar-based path
fallback for layer presence too.

* fix(oci): keep reference coverage uncertain for opaque index entries

An index entry with an unknown media type is not walked, so the blobs
it references are unknown. Mark the reference graph truncated so no
blob is reported unreferenced, and report coverage as partial whenever
the reference graph was not fully examined.

* fix(oci): walk digest aliases that differ only in hex casing once

Descriptors whose digests differ only in accepted hex casing resolve to
one blob, but the index queue, visited set and config cache were keyed
by the source spelling, so each alias reread and rewalked the whole
index. Key traversal by the resolved blob path while descriptors keep
their source spelling in the report.

* fix(oci): keep unparsed digest spellings out of accepted traversal keys

A descriptor spelled blobs/sha256/<hex> did not parse, so its traversal
key fell back to the raw text, which matched the blob path key of the
accepted sha256:<hex> digest. Listed first, it marked the manifest
visited and the valid descriptor was skipped. Prefix accepted and
unparsed keys separately.

* fix(oci): bound index entry text retained across indexes

Index entries keep their digests, media types, platforms and annotations
in the report, but no allowance covered that text across indexes, so many
nested indexes with large annotations could exhaust memory within every
other limit. Charge each retained entry to a new max_descriptor_bytes
budget (64 MiB default, 512 MiB maximum) before adding it.

* fix(oci): hash each blob file once across digest spellings

Digest spellings that differ only in accepted hex casing resolve to one
blob path, but the blob pass hashed the file once per spelling. Cache the
hash result, or its oversize refusal, by blob path so each file is read
once, while every spelling keeps its own row, size checks and digest
check.

* fix(oci): report non-object config and rootfs subobjects

A present config or rootfs value that is not a JSON object now records a
malformed_blob_json defect instead of being replaced by an empty object, so
coverage reports partial. Other image facts are kept. Regenerate the
inspect_oci_image_layout advertised-schema summary.

* fix(oci): check declared sizes for unsupported-digest blobs

A blob referenced by a valid but unsupported digest (for example sha1)
skipped the declared-size checks and left observed_size null, even
though the directory reader already captured the file size. Record
observed_size and emit size_mismatch for it, still without hashing.

* fix(oci): keep reader integrity failures that wrap a JSON parse failure

readJsonDocument unwrapped any ArtifactReaderFailure whose cause was a
ParseFailureError. When a malformed referenced blob changed during
inspection, DirectoryArtifactReader.inspectFile raised an "integrity"
failure carrying that ParseFailureError, and the unwrap turned it back
into a malformed_blob_json finding. Only unwrap the plain "io" transport
wrapper with no cleanup lease, so integrity, cancelled and limit
failures keep their reader facts.

* fix(oci): report malformed config leaf fields

A config with Env: "A=1" or Cmd: ["/bin/sh", false] used to come back
as env: [] or cmd: null with no finding, indistinguishable from an
image that declared neither. parseConfig now checks each present known
field (the top-level strings, User, Env, Entrypoint, Cmd, WorkingDir,
ExposedPorts, Volumes, Labels, StopSignal) and records
malformed_blob_json for a wrong type, keeping the other facts. Env
members that are not a named string and non-string label values are
omitted and counted. null stays an omitted declaration.

* fix(oci): allow json_bytes_read beyond 32 bits

coverage.json_bytes_read sums bytes across every JSON document read.
OciImageLayoutService bounds it by max_json_bytes * (2 + 2 *
max_descriptors), which at a 16 MiB per-document cap passes 0xffffffff
well within budget, so the uint schema made safeParse reject a completed
report as AnalysisOutputError. Give the counter a nonnegative safe-integer
schema; the other uint counters are unchanged.

* fix(oci): report malformed image history

A non-array history or a history member that is not an object was
silently dropped, so damaged build history looked the same as omitted
history. Report both as malformed_blob_json defects on the config blob
and keep the readable history records and other image facts.

* fix(oci): report damaged descriptor metadata and symlinked blob dirs

Descriptor platform and annotations that were present but malformed
(platform: [], a non-string platform field, annotations that are not an
object or hold non-string values) were normalized to null or [] with no
finding. Report each as a malformed_blob_json defect against the owning
document and keep the readable entries.

A symlink at blobs or blobs/<algorithm> is not followed, but nothing
recorded the skipped tree, so an empty index over a linked blob
directory reported an empty inventory with complete coverage. Record a
symlink_blob finding for the linked directory so coverage is partial.

* Address review feedback

* Address review feedback

* Address review feedback

* Bound repeated JSON member names in OCI findings

A long duplicate member name is now described by its length instead of
being copied into the finding message.

* fix(oci): keep the oci-layout hash when its JSON is malformed

The oci-layout file is now read and hashed first, and its observation is
recorded before decoding. An oci-layout with invalid UTF-8, invalid JSON
or a duplicate member is refused with its completed file identity.

* fix(oci): charge accepted descriptor text to max_descriptor_bytes

Accepted subject, config and layer descriptors keep their digest and
media type in image rows, the reference map, findings and blob rows, but
only index entries and rejected descriptors spent max_descriptor_bytes.
A layout with many manifests carrying long distinct layer digests could
retain unbounded text. Charge accepted descriptor text before retaining
it, once per referencing manifest or index.

* fix(oci): report presence defects for unsupported-digest blobs

A referenced blob with an unsupported digest algorithm whose layout path
is missing, a symlink, or not a regular file now gets the same
missing_blob or symlink_blob finding a supported digest gets, alongside
unsupported_digest_algorithm. Present files still only get the size
check and stay non-missing.

* perf(oci): drain index and manifest queues with a cursor

shift() relocates the remaining queue on every step, which makes draining
layouts with many index references quadratic. Walk both breadth-first
queues with an index cursor instead.

* fix(oci): keep blobs under a symlinked blob directory unexamined

When blobs or blobs/<algorithm> is a symlink, the reader lists the link
but never its children, so a referenced blob under it is absent from the
listing without being absent from the layout. One shared lookup now
tells listed, unexamined and confirmed-missing paths apart for the
reference walk, subjects, and both inventory branches. An unexamined
blob gets a symlink_blob finding naming the directory instead of
missing_blob, and an unexamined subject marks the reference graph
truncated.

* fix(oci): charge serialized config facts to max_config_bytes

The config allowance counted the config document's source bytes, but each
image carries the parsed facts, and a sparse history entry such as {}
expands into a record with four null fields. A small shared config with
thousands of empty history entries could pass the budget while the report
grew past the runtime's string limit. Each distinct config now charges the
exact compact JSON size of its facts, once per image that uses it.

* fix(oci): keep the oci-layout snapshot when its read fails to finalize

When the oci-layout read completes but closing its descriptor fails, or
cancellation arrives during the close, the reader rejects before the
parser records the layout hash. The reader keeps the completed bytes on
that failure, so the failure reached translation without the SHA-256 and
byte count it could have carried, unlike the same failure on index.json.
The parser now records the completed layout observation from that outcome
and rethrows the reader's failure unchanged, keeping its cleanup owner.

* fix(oci): keep reference status unknown under an unwalked present subject

A present subject with an unknown media type, or an index or manifest
subject whose digest algorithm is unsupported, is not read, so the blobs
it names were reported as unreferenced with complete coverage. Mark the
reference graph truncated in both cases so unmatched blobs keep an
unknown referenced status.

* fix(oci): keep a malformed index.json primary when its handle close fails

When index.json is malformed and closing its descriptor also fails, the
directory reader raises ArtifactFileCleanupFailure with reason io and keeps
the ParseFailureError as the physical outcome. The OCI dialect translated
the wrapper directly, so the malformed input surfaced as an I/O failure even
after the resource scope retried the close.

The dialect now supplies readCleanup: the shared classifier classifies the
failed outcome as primary, and the unresolved close is attached beside it
and bound to that read's exact cleanup lease. A cleanup-only read keeps its
previous projection.

* fix(oci): count a malformed blob's bytes in json_bytes_read

A referenced index, manifest or config that was read in full but failed
UTF-8, JSON or duplicate-member decoding became a malformed_blob_json
finding, yet its bytes never reached json_bytes_read, because the count
was added only after decoding succeeded.

The blob read now adds the byte count inside the completed read, before
decoding, so coverage reports every byte the parser examined.

* fix(oci): report a missing or non-directory-ancestor path as invalid input

A selected root that resolves to ENOENT or ENOTDIR is a bad path, not an
I/O failure. Classify it as an AnalysisInputError on `path` before the
generic reader translation; other root I/O keeps its execution failure.

* fix(oci): keep the layout hash when index.json close also fails

When malformed index.json also failed to close, readCleanup composed the
error from the classified parse failure, which carries no observation,
so the completed oci-layout hash was dropped. Carry the read's partial
observation onto the primary before composing.

The close-fault test now selects the index.json handle by file identity
(dev and inode) rather than the second close call, and asserts the
fault landed there and the oci-layout hash survived.

* fix(oci): report malformed subject digests and count examined entries

A subject whose digest is not a valid OCI digest has no layout path, so
the walk returned without a finding and kept claiming it could prove
which blobs nothing references. It now records a malformed_blob_json
finding on the owner and marks the reference graph truncated, the same
as any other subject descriptor it cannot model. An absent subject with
a well-formed digest stays finding-free.

coverage.entries_examined counted only the entries the reader yielded.
It now takes the reader's examinedEntries from onCoverage, which
includes names the reader examined but omitted, and falls back to the
yielded count when the reader does not report one. An omission that
rewrites the traversal coverage keeps that count.

* fix(oci): keep the root index out of the blob traversal namespace

The root index was walked and prequeued under the traversal key of its
SHA-256 digest, which is the key of the blob path blobs/sha256/<hex>.
When a damaged nested index named that digest and the blob file there
held different index JSON, the queue skipped the blob as already walked,
so its manifests, configs and layers were never read and were reported
as unreferenced under complete coverage.

index.json now walks under its own traversal identity. A descriptor that
names its digest reads and walks the blob stored at that path like any
other nested index.

* fix(oci): diagnose conflicting media types inside referenced JSON

A referenced manifest or nested index may repeat its media type in its
own optional mediaType member. The walk ignored that declaration, so a
document admitted as a manifest but declaring the index type, or an
unknown type, produced no finding.

Check a present declaration against the descriptor type the walk
admitted it under. An unknown declared type is reported as
unknown_media_type; a known but conflicting type or a non-string value
is reported as malformed_blob_json. The members are still read, so the
other readable facts are kept, and an omitted mediaType stays valid.
The root index.json is admitted under its own declaration and is not
checked against itself.

* fix(oci): charge unknown declared media types to max_descriptor_bytes

A referenced manifest or nested index whose own mediaType is an unknown
string is quoted in an unknown_media_type finding. That text was retained
without spending the descriptor text budget, so many hash-valid documents
with long declarations could grow findings well past max_descriptor_bytes.
Charge the escaped declaration before the finding is recorded.

* fix(oci): mark the reference graph incomplete on document-type conflicts

A referenced manifest or nested index whose own mediaType names another
document kind, or an unknown type, was diagnosed but its blobs were still
judged with a complete reference graph. The walker reads only the members
of the admitted kind, so members of the declared kind, such as an index's
manifests inside a document admitted as a manifest, were never followed
and the blobs they name were reported as unreferenced_blob.

Mark the reference graph truncated for an unknown declared type or one of
a different document kind, so unreached blobs keep an unknown referenced
status. The readable facts are still reported. A declaration of the same
kind, such as the Docker manifest type on an OCI manifest descriptor,
reads the same members and keeps unreferenced status definite.

* docs(oci): state that unsupported digest algorithms skip hashing

The guide said every present referenced blob gets a SHA-256. Blobs whose
digest uses an algorithm other than sha256 or sha512 are not hashed; their
row reports hashed: false with null sha256 and sha512. Document that and pin
the null hash fields in the sha1 layer test.

* fix(oci): check the root index.json mediaType against the index kind

The root index.json skipped declaration checking because no descriptor
names it, so its own mediaType chose the admitted type. A root that
declared the manifest type or an unknown type was still walked as an
index with a complete reference graph, and blobs named by members the
index walk never reads were reported as unreferenced_blob.

Admit the root as an index: an index declaration of either family
stands, and any other declaration is checked against the OCI index type
like a nested index, which diagnoses it and marks the graph incomplete.

Also document that unknown declared media types quoted in findings
spend max_descriptor_bytes.

* Address review feedback

* Address review feedback

* fix(oci): check each referencing media type against a revisited document

A manifest or nested index reached a second time was skipped before its
mediaType declaration was compared with the new descriptor type, so a
conflict was reported or not depending on descriptor order. Each document
now records its declaration on first decode, and every distinct media type
a later reference admits it under is checked against it.

* fix(oci): detach redacted Env names from their bindings

With include_env_values false, each retained Env name was a slice of the
whole NAME=value string, so a long value stayed alive while the config
fact budget charged only the name. Redacted names are now standalone
copies, and a heap regression test covers eight 0.9 MiB values.

* fix(oci): keep only string mediaType declarations for revisit checks

The revisit cache kept each decoded document's raw mediaType, so a layout
of many manifests with large object declarations held all of them for the
whole walk while no byte budget charged them. A non-string declaration is
rejected whatever it holds, so the cache now keeps null in its place and
still reports it as not a string on each new referencing media type.

* Address review feedback

* Address review feedback

* Address review feedback

* fix(oci): preserve layout evidence on malformed targets

* Address review feedback

* fix(oci): diagnose schema versions and charge annotation records

Indexes and manifests whose schemaVersion is omitted, not a number, or a
number other than 2 now get a malformed_blob_json finding and partial
coverage, while their entries, config and layers stay readable.

Index entry annotations now spend max_descriptor_bytes as each
{name, value} record is built, charged at its serialized size, so many
short or empty annotations can no longer retain far more than their text
was charged for.

* docs(oci): describe annotation record accounting for max_descriptor_bytes

* Address review feedback

* fix(oci): wire summary delivery, parameter budget limits, and single-pass annotation parsing

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(artifacts): decode Android Verified Boot vbmeta images offline (#13239)

* feat(artifacts): decode Android Verified Boot vbmeta images offline

* fix(artifacts): locate vbmeta tail-length failures at their length fields

* fix(artifacts): make vbmeta admission budgets adjustable per call

* fix(firmware): refuse vbmeta fields too long to hex-encode

With raised descriptor_bytes and auxiliary_block_bytes limits, a valid
KERNEL_CMDLINE longer than half the host string bound passed the byte
limits, and toString("hex") then threw ERR_STRING_TOO_LONG, which
surfaced as an I/O error. Check the field against the host bound before
hex encoding and report a typed capacity failure with its own limit.

* fix(firmware): check vbmeta extents before admission budgets

A header whose declared blocks do not fit the file, or whose descriptor
range does not fit its auxiliary block, now reports truncation or a
malformed range instead of a limit a larger budget cannot repair. The
over-budget fixtures are now fully present so they still prove the limit.

* perf(firmware): count vbmeta descriptor tags in one pass and reuse readers

The summary counts every descriptor tag in a single loop instead of six
filtered arrays, and androidVbmeta reuses one BinaryReader per buffer.
The malformed-header refusal fixtures follow main's unsupported_target
classification for malformed target bytes.

* chore: regenerate advertised schema hash after merging main

* docs(android-vbmeta): name unsupported_target for structural refusals

Malformed vbmeta headers classify as unsupported_target, not
invalid_request, matching analysisErrorClassification and the refusal
fixtures.

* chore: regenerate advertised schema hashes after merging main

* chore: regenerate advertised schema hashes after merging main

* fix: restore Android vbmeta artifact reader after merging main

* test(artifacts): expect partial for the CLI vbmeta descriptor refusal

* feat(artifacts): preserve vbmeta descriptor bytes and partial refusals

Co-authored-by: iamcipherdev <268238676+iamcipherdev@users.noreply.github.com>

* fix(artifacts): use Buffer.equals in vbmeta tests and update advertised schema summaries

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Co-authored-by: iamcipherdev <268238676+iamcipherdev@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(setup): run the macOS Hopper installer's tools from /usr/bin

The macOS Hopper installer ran hdiutil, codesign, ditto and open through REA's PATH. Its two codesign checks decide whether setup installs and opens the downloaded app, so a codesign earlier on PATH that exits 0 passed the publisher check, while the launch-time check of the same publisher already runs /usr/bin/codesign. The DMG reader and the bridge launcher likewise run /usr/bin/hdiutil and /usr/bin/open.

The installer now runs each tool from its macOS system path, and the setup disclosure names the executable that runs.

Tests: a boundary test puts stand-in codesign, hdiutil and open on PATH. Before this change the stand-in codesign made validBundle return verified; now no stand-in runs. The disclosure test expects /usr/bin/codesign.

* fix(hopper): refuse downloads redirected to another origin (#6700)

* fix(hopper): refuse downloads redirected to another origin

* test(hopper): cover download redirect origins

* Check redirect protocol before origin so downgrades keep non_https

* style: apply oxfmt to HopperDownload.ts

---------

Co-authored-by: Dextheking1 <Dextheking1@users.noreply.github.com>
Co-authored-by: benjaminkincses <4175097+benjaminkincses@users.noreply.github.com>
Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com>

* fix(android): preview 16 JNI bindings and libraries in the summary

The inspect_android_jni_bindings summary previewed 64 bindings with their
declaration and candidate closure, and every selected library. That
predates the agent result budget, and on VLC's APK the summary delivered
when the report was over budget was 57,491 bytes, larger than the 32,768
byte budget it replaced.

The summary now previews 16 bindings, their closure and 16 libraries, and
reports library_coverage beside the existing declaration coverage. Counts
still describe the full selection and every collection pages through the
android-jni view. The same APK's summary is now 23,806 bytes.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(android): describe the 16-row JNI summary preview

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(artifacts): keep each extracted file's limitations on that file

extract_artifact copied every selected occurrence's limitations into its
own list, prefixed with the path. Extracting VLC's APK listed 862
limitations, 858 of them case-folding collisions between R8-shrunk
resource names, and repeated them in the Evidence envelope.

Each written file now carries its occurrence's limitations in
artifacts[].limitations, absent when it has none, and the extraction's
own list counts the files that carry them. The file digest and
extraction ID are unchanged: they cover the written files, not their
limitations. The same APK's extraction now lists 5 limitations.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(artifacts): note omitted ./ member prefixes once per ZIP or tar reader

The ZIP and tar readers each added one limitation per member whose
leading ./ they omitted from its logical path, and each restated the
prefix rule. "tar czf app.tgz -C dir ." prefixes every member, so a
297-file archive carried 297 such limitations. Every such occurrence
already keeps its recorded name in source_path.

Both readers now use one withoutCurrentDirectoryPrefix rule and report a
single reader-level limitation counting the prefixed members. A
Playwright trace whose member names were only prefixed now reports
scoped rather than partial interpretation, and SAZ members keep their
recorded path beside the logical path without a prefix limitation.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(artifacts): keep ZIP coverage on the byte account alone

zipListingCoverage decided complete coverage from an empty limitation
list, so the reader-level ./ prefix note made a fully accounted ZIP
report unknown coverage, and extraction then warned that its output was
not a complete source copy. Coverage now follows the byte-accounting
gaps; the prefix note is listed after them.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(artifacts): read ASAR occurrence limitations from extracted file rows

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(android): bound the JNI summary preview by bytes with its relations

Sixteen previewed bindings could still exceed the agent result budget:
one static registration candidate can name hundreds of same-signature
declarations, and previewing a binding pulled every one of them in. The
preview now admits selected declaration IDs and bindings in order while
they, with the candidates and declarations each adds, fit 16 KiB, and
libraries while they fit 8 KiB, each at most 16 rows. Counts and pages
still cover everything. VLC's summary is unchanged at 23,806 bytes.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(analysis): prevent self-append loop in appendAll (#14665)

* fix(analysis): prevent self-append loop in appendAll

* style: apply oxfmt to the appendAll regression test

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com>
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(errors): report a capability refusal as retryable once cleanup settles (#14124)

AnalysisCapabilityUnavailableError computed retryable once in the constructor, so a
refusal built while its cleanup was still pending stayed non-retryable after the
owner released: the documented rule is that incomplete cleanup must settle
before the operation can be retried, and the sibling projection arms already
read cleanupIncomplete live.

Keep the requested intent and derive retryable from the live cleanup state.

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>

* fix(signals): report an unsupported host as a capability limit (#14127)

A non-Linux host threw a plain Error from the configuration phase, so the shared
classifier produced a capability refusal whose recovery only described
configuring REA_SIGROK_COMMAND on Linux. That repair can never succeed on the
host that produced the refusal, and no fact said the host itself was the limit.

Give the host check its own owner with a host-only reason and remediation,
mirroring the packet-capture boundary, and keep the tool-path message for the
REA_SIGROK_COMMAND branch.

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>

* fix(maven): read Maven 4.1.0 model POMs (#14089)

inspect-maven-gradle-metadata accepted only the
http://maven.apache.org/POM/4.0.0 namespace, so every Maven 4 POM in the
4.1.0 model namespace was refused as "not a Maven project POM".

Classify a project root in any http://maven.apache.org/POM/ namespace as
a POM, as Maven 4's DefaultModelXmlFactory does, and read the 4.0.0 and
4.1.0 models with the same rules. Other model namespaces are refused
with a specific unsupported_target reason. A 4.1.0 model imports managed
bom-typed rows and carries a limitation that Maven 4 parent and reactor
coordinate inference was not applied.

Co-authored-by: aadheel <250292080+aadheel@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>

* feat(analysis-view): page retained artifact extractions

A retained extract_artifact result could only be read back whole. It
lists every written file and every selected occurrence ID, so extracting
VLC's APK (2,619 files) produced 1,163,590 bytes of Evidence.

The artifact-extraction view pages one retained extraction. Collection
artifacts lists written files with their index and only the selected
fields, filtered by exact relative paths, path globs or artifact IDs;
integrity_contradictions and residual_paths page those lists. Pages are
byte-bounded and carry output_root.

The summary keeps the manifests, output_root, containment and cleanup
verification and coverage, counts written files, created files, bytes
written and contradictions, and samples at most 16 provenance commands,
contradictions and residual paths.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(artifacts)!: budget extract_artifact delivery

extract_artifact returned every written file inline. Extracting VLC's APK
through MCP returned 1,214,138 bytes of content, beside the same
structured result, for a call whose files are already on disk.

extract_artifact now takes detail and joins the agent result budget.
Omitted, an extraction that fits delivery.agent_result_budget_bytes is
inline and a larger one is retained behind its artifact-extraction
summary; detail never reaches the provider. The CLI uses the shared
Evidence delivery. The same APK now returns a 14,592-byte summary, and a
lib/** page of its native libraries 12,472 bytes.

BREAKING CHANGE: an extract_artifact call that omits detail on an
extraction above the agent result budget now returns the retained summary.
Pass detail: "complete" (--detail complete) for the previous shape.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(artifacts): describe budgeted extraction delivery and its view

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(android)!: page class-name search by default and name the next offset

search_android_classes returned every match when limit was omitted, and
an empty query lists every class. On VLC's APK that was 15,310 names and
809,004 bytes of MCP content. A page that stopped early reported only
coverage "partial", so a caller could not tell where the next page began.

Omitted limit now returns at most 256 matches, and the result reports
next_offset: the offset of the following page, or null when no match
follows. JADX already stops once the page and one more match are found,
so a filtered search still needs a single provider call. On the same APK
the empty query now returns 256 names in 27,105 bytes of CLI JSON.

BREAKING CHANGE: a search_android_classes call that omits limit returns
at most 256 matches. Page with next_offset, or pass a larger limit.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(android): describe the default class-search page and next_offset

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(elf)!: return 64 unwind ranges by default, as PE unwind ranges do

inspect_elf_unwind_ranges returned 256 ranges by default, four times the
inspect_pe_unwind_ranges page. For libstdc++ that was 85,909 bytes, about
29,000 tokens, which is over the result size Claude Code accepts inline.
The default page is now 64 ranges: 26,926 bytes for the same library and
23,312 for libc, with next_offset naming the following page. limit still
accepts up to 4096.

BREAKING CHANGE: an inspect_elf_unwind_ranges call that omits limit
returns at most 64 ranges. Page with next_offset, or pass limit.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(elf): give the 64-range default unwind page

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(android): record only caller-selected search parameters in Evidence

The default class-search page made every search_android_classes Evidence
record limit 256, indistinguishable from a caller choice. Android Evidence
now records the fields the caller supplied; execution still uses the
defaulted input.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(analysis-view): bound extraction summary samples by bytes

The extraction summary sampled 16 rows of each list by count only. One
integrity contradiction can carry tens of kilobytes of signer names, so a
sample alone could exceed the agent result budget. Each sample now also
stays within 4,096 serialized bytes; omitted counts the rest, which the
collection still pages.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(cli): deliver an unretained non-idempotent result complete

When the retained-Evidence cache could not keep an over-budget result,
the CLI delivered its summary with rerun arguments. Rerunning a
non-idempotent operation does not reproduce it: an extraction that
created its output root refuses the same root. Each CLI delivery now
knows whether its contract is idempotent, and a non-idempotent result the
cache does not keep is delivered complete.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(javascript): unwrap pure SequenceExpression call targets (#14396)

* fix(javascript): unwrap pure SequenceExpression call targets

* fix(javascript): scope sequence aliases to valueExpressionLocation

* fix(javascript): preserve sequence initializer value and alias flows

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>

* fix(elf): read eight-byte DT_HASH entries on 64-bit s390x and Alpha (#14630)

* fix(elf): read eight-byte DT_HASH entries on 64-bit s390x and Alpha

On ELF64 s390x and Alpha every SysV hash entry (nbucket, nchain, buckets
and chains) is eight bytes wide; binutils readelf and glibc read them that
way and ld writes .hash with sh_entsize 8. The shared DT_HASH walker always
read 32-bit words, so on a big-endian s390x table it took the high half of
nbucket as the bucket count and the low half as nchain.

On Debian wheezy's s390x libz.so.1.2.7 (nbucket 97, nchain 105) this made
inspect-elf-dependencies report a false ".dynsym section declares 105
symbols, past the DT_HASH dynamic symbol count of 97" issue with partial
coverage, and inspect-native-exports refuse the same library without
section headers because DT_HASH (97) and DT_GNU_HASH (105) disagreed.

The walker now takes the entry layout from e_machine, the ELF class and
the byte order, and the dependency parser and both PT_DYNAMIC export paths
pass it.

* test(elf): cover eight-byte DT_HASH reads from a file handle

The s390x and Alpha .hash fixture now declares sh_entsize 8 to match the
entries it writes, and the sectionless export cases also run through
parseNativeExportsFromHandle, including a wide header that crosses the end
of its load mapping.

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>

* feat(artifacts): inspect VS Code extension packages offline (#12469)

* feat(artifacts): inspect VS Code extension packages offline

REA had no owner for a local .vsix ZIP. inspect_vsix_package and inspect-vsix-package now read extension.vsixmanifest and extension/package.json, report identity disagreements, engine range, activation events, a contributes summary, hashed native/wasm/executable members, and a ZIP inventory without installing the extension or contacting a marketplace.

Missing or malformed manifests return the inventory with limitations. Invalid ZIP input fails without partial success. Signature files are reported present or absent and are not verified.

* fix(vsix): bound vsixmanifest XML nodes before building the tree

A compressed extension.vsixmanifest within the 16 MiB byte budget can
still expand into millions of XML nodes. Count nodes as a stream first,
as the Maven POM reader does, and refuse the manifest with an xml_nodes
limit before parseXmlDocument allocates its document.

* fix(vsix): report the vsixmanifest node ceiling as a fixed allowance

The xml_nodes limit is a fixed parser ceiling, not a caller budget, so
the provider fell through to a generic memory refusal that implied more
memory could help. Map it through fixedAllowanceOptions as the Maven
provider does and cover the public error from the provider.

* refactor(vsix): classify provider failures through the shared owner

VsixPackageProvider kept its own chain for cancellation, identity, path,
selected-file and cleanup failures. It now supplies a dialect to
classifyProviderFailure with only the package's own refusals: its parse
ceilings and budget recovery, format failures, fixed reader allowances and
the max_file_bytes refusal. The held snapshot still supplies the completed
identity for a parser failure after the read.

* fix(vsix): report an empty contributes key instead of failing the report

A package.json with an empty contributes key produced a key with an
empty name, which the contract refuses, so the whole inventory was
rejected. The empty key is now left out of contributes.keys and
reported as a limitation.

* fix(vsix): charge member decoding to one package-wide budget

Each hashed member was read with a fresh per-member budget, so a small
compressed package with thousands of members could make the parser
decode several GiB. Member reads now draw on one artifactExpansionBudgetBytes
budget for the package; once it is spent, remaining members stay in the
inventory without a digest and a limitation names the spent budget.

* fix(vsix): resolve dot segments in package.json entry points

packageJsonEntryPath stripped only one leading ./, so a main such as
./out/./extension.js named extension/out/./extension.js and was reported
absent even when extension/out/extension.js existed. Entry points now
resolve . and .. segments under extension/; a path that climbs out of
extension/ keeps its unresolved form and matches no member.

* fix(vsix): resolve entry points with the loader's lookup rules

An extension-less main such as ./out/extension was looked up as a
literal ZIP name and reported absent although Node resolves it to
extension/out/extension.js. main now tries Node's CommonJS file and
directory suffixes, browser tries the .js the web extension host adds,
and the reported path is the member found.

* fix(vsix): resolve a directory main through its own package.json

Node's directory lookup reads the directory's package.json main before
falling back to index files, so an entry like main: ./out with
out/package.json naming ./start.js now resolves as present.

* Address review feedback

* fix(vsix): report interesting member sizes past 4 GiB

A ZIP64 member can declare an uncompressed size above 0xffffffff while
the compressed package stays under max_file_bytes. The parser skips
hashing it and reports the declared size, but interesting_members[].bytes
used the 32-bit uint schema, so the service rejected the whole report.
The field now takes any nonnegative integer, matching
contents[].uncompressed_size.

* fix(vsix): report a malformed directory package.json instead of its index

When main names a directory whose package.json is not a JSON object,
Node's loader throws ERR_INVALID_PACKAGE_CONFIG rather than falling back
to index.js. Keep that outcome distinct from a manifest with no usable
main: mark the entry point absent and add a limitation naming the member.

* fix(vsix): classify Java archives as nested archives

A bundled .jar, .war or .ear is a ZIP, but the path classifier returned unknown for it, so it was never hashed or counted as a nested archive.

* fix(vsix): match entry points by exact member case

Resolve main and browser entry points against exact ZIP member names, as a
case-sensitive file system would, and report a member that matches only when
case is ignored as a limitation instead of marking the entry present. The
directory package.json used to resolve a directory main is matched exactly
too.

* fix(vsix): keep directory-only intent for a trailing-slash main

A main such as "./out/", ".", "..", or one ending in "/." or "/.." can
only name a directory under Node's loader. Normalizing it to a bare path
let a sibling file like extension/out.js match and report the entry as
present. Carry a directory-only flag from the raw value and skip file
candidates in the declared-path lookup and in the check that decides
whether to read <main>/package.json.

* fix(vsix): only blame case when the spelling differs

The case-only entry point warning scanned index candidates even when a
malformed directory package.json had already stopped the main lookup, so
an exact extension/out/index.js could be reported as a case mismatch.
Skip index candidates when the directory manifest is malformed, and skip
any candidate whose member is spelled exactly as declared.

* fix(vsix): stop main lookup at an over-budget directory package.json

When main names a directory whose package.json exceeds
max_manifest_bytes, its main is unknown, so falling back to index.*
could report a file Node would not load. Treat the unread manifest like
a malformed one: report main unresolved, add a limitation that says the
index files were not used, and skip the index files in the case-only
scan.

* fix(vsix): resolve a main that normalizes to the package root

A main of ".", "./" or "./out/.." normalized to "extension/", so the
directory lookups searched "extension//package.json" and
"extension//index.js" and reported a present index file as absent.
Return "extension" for the root so those lookups name real members.

* fix(vsix): stop main lookup at an unread directory package.json

An encrypted or duplicated directory package.json left the directory
main unresolved as "none", so lookup fell through to index files even
though the unread manifest may name another file or be invalid. Mark it
unread and stop the lookup, as the over-budget branch already does.

* test(vsix): tag the decode-budget regression long-running

The package-wide decode budget test passed a fixed 60-second deadline,
which also turned off coverage and CI deadline scaling. Use the
long-running tag the testing guide prescribes instead.

* fix(vsix): leave unread dependency declarations unknown

A missing, encrypted, or malformed manifest reported its extension
dependencies and extension pack as empty lists, so a declaration on the
other side showed up as a disagreement. Report the unread side as null
and only flag a disagreement when both manifests were read.

* fix(vsix): look up entry points by their literal text

package.json main, browser, and a directory package.json main were
trimmed before lookup. A ZIP member name can begin or end with
whitespace and Node does not trim the specifier, so "./out/start.js "
was reported absent or matched the different "out/start.js" member.
Use the declared text as written; only an empty string names nothing.

* fix(vsix): keep activation events literal before eager classification

VS Code matches activation events as exact strings, so "* " and
"onStartupFinished " are not startup activations. The parser read
activationEvents through the whitespace-trimming ID helper, which turned
those values into "*" and "onStartupFinished" and reported them as eager.

Read activation events with a literal helper that drops only empty
strings and exact duplicates, and cover the padded values next to their
exact-name controls.

* fix(vsix): keep mode-executable members inventoried when unread

A member with no recognized suffix but Unix execute bits was only
classified after its magic was read. When the hash budget, the package
decode budget, encryption, or traversal skipped that read, it stayed
unknown and fell out of interesting_members and the executable count.
Unread mode-executable members now keep an inferred executable kind.

* fix(vsix): count a singleton contributes.commands object

VS Code accepts contributes.commands as one command object as well as
an array. Normalize the singleton form before capping and counting so a
package with one command reports commands_total 1 and the commands key
count matches.

* fix(vsix): keep contributed command identifiers literal

VS Code registers and invokes a contributed command by its exact
identifier, and the parser already keeps onCommand activation events
literal. Commands went through the trimming text helper, so a declared
"demo.run " was reported as "demo.run" next to an "onCommand:demo.run "
event, giving two different identities for the same command.

Keep the declared command text as written and report null only for an
empty string. Titles are display text and stay trimmed.

* fix(vsix): do not infer executables from symlink modes

A Unix symlink entry carries 0o120777, so its permission bits made an
unread link look like an executable helper. Only regular files, or
entries with no recorded file type, now count toward mode-inferred
executables.

* style(vsix): apply oxfmt to manifest limit guard

* fix(vsix): keep mode-executable kind when read bytes have no known magic

A suffixless regular Unix member with execute bits but no recognized
magic (for example a shell helper without a shebang) was listed as an
executable only when the hash budget skipped its read. Raising the
budget enough to hash it resolved the kind to unknown and dropped it
from interesting_members and the executable count. Fall back to the
mode-derived executable kind when the read bytes match no magic.

* fix(vsix): charge failed member expansions to the package budget

A member whose ZIP header understates its uncompressed size can decode
its whole allowance before the bounded writer refuses it. That work was
not charged to the package-wide decode budget, so every later failing
member got the same allowance again. Charge the allowance on a
max_member_bytes failure so later members see the spent budget.

* fix(vsix): bound JSON values before parsing manifests

Both package.json readers called JSON.parse after a byte-only check, so a
16 MiB manifest of many tiny values could allocate far more memory than its
text. A one-pass countJsonValues scan now runs first: an extension/package.json
holding more than 1,048,576 values is refused with a fixed json_values parser
allowance, and an over-allowance directory package.json is left unread with a
limitation, so its index files are not used.

* Address review feedback

* fix(vsix): treat absolute directory package.json main as outside the package

Node resolves a directory package main with path.resolve(dir, main), so an
absolute main names a host file, never a package member. Report it as no
main so the lookup falls back to index.* or reports the entry absent.

* fix(vsix): tag escaped entry points instead of matching them as members

A package.json main or browser that climbs out of extension/ was kept as
an ordinary member path string. A traversal ZIP member with the same name
(extension/../outside.js) is in the inventory, so the lookup reported the
entry point present even though that member is never extracted.

packageJsonEntryPath now returns a tagged resolved/escaped value. Escaped
entry points skip the member, directory manifest and case-only lookups and
are reported with present: false.

* fix(vsix): decode directory package.json as UTF-8 like Node

Node reads a nested package.json as UTF-8 only. A UTF-16 manifest
fails with ERR_INVALID_PACKAGE_CONFIG, so report it malformed instead
of transcoding it and marking main present.

* fix(vsix): keep directory package.json main inside the extension root

A directory package.json main such as ../../outside.js could pop the
extension segment and resolve to an archive-root member, which was then
reported as the present main entry point. Treat any main that climbs out
of extension/ as naming no main, so the lookup falls back to index.* or
reports the entry absent.

* fix(vsix): keep a root directory main from matching archive-root files

A nested package.json main such as ".." in extension/out resolves to the
extension root itself. Trying file suffixes on that path matched an
archive-root extension.js, which sits outside the installed payload.
Mark such a main directoryOnly and resolve it through extension/index.*
only, as Node does.

* fix(vsix): skip member reads once the package decode budget is spent

A compressed member declaring zero uncompressed bytes passed the
declared-size check even with no package allowance left, so its decoder
still ran and produced output before the writer rejected it. The failure
then charged zero, letting each later zero-declared member decompress
again past the package ceiling. Skip the read and report the spent
budget once nothing remains.

* fix(vsix): keep declared API proposal names literal

Read enabledApiProposals with the literal list reader used for activation
events. VS Code matches proposal names exactly, so trimming whitespace or
splitting on commas reported identifiers the package never declared and
collapsed declarations that differ only in surrounding whitespace.

* fix(vsix): select manifests by their exact member path

Count ZIP members by exact logical path. A package holding only
extension/Package.json no longer has it parsed as extension/package.json,
and a case-only sibling no longer marks the real lowercase manifest as a
duplicate and drops its facts. Names that differ only in case, and a
manifest present only under another case, are reported as their own
limitations.

* fix(vsix): treat shared libraries as interesting members

Bundled .dll, .so (including versioned .so.N names) and .dylib files
without Unix execute bits were classified unknown, so their magic was
never read and they were missing from interesting_members and the
summary count. Classify these suffixes as executable so they are hashed
and listed like .exe and .node members.

* refactor(vsix): run inspection through the shared artifact runner

VsixPackageService now delegates input parsing, the provider call, output
checks, Evidence creation and late cancellation to executeArtifactInspection,
as NugetNupkgService does, keeping only the VSIX-specific report checks.

* feat(vsix): point first-contact inspection of a .vsix to the VSIX reader

inspect_artifact now suggests inspect_vsix_package when a ZIP holds a
root extension.vsixmanifest file. The non-ZIP refusal test follows main's
unsupported_target classification for malformed target bytes.

* fix(vsix): align artifact failures with main

* fix(vsix): bound inspect_vsix_package output with shared detail/summary contract

* Address review feedback

* fix(vsix): bound summary text fields and report structured parameter limits

* fix(vsix): omit required_value on early-stop parameter limits

* refactor(vsix): count eager activation events without intermediate array

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(pe): report the overlay appended after a PE image's last section (#13245)

* feat(pe): report the overlay appended after a PE image's last section

* chore(schemas): add the inspect_pe_overlay schema summary

* test(pe): expect the shared non-PE refusal message in MZ admission

* test(cli): record completion goldens for inspect-pe-overlay

* fix(pe): preserve overlay diagnostics and validate certificate spans

Keep impossible security directory spans in measured overlay bytes and share bounded format recognition with inventory. Validate structured overlay facts in the domain while preserving provider diagnostics.

* docs(pe): move the PE overlay guide under docs/guides

* fix(pe): keep overlay format recognition within its probe

* Address review feedback

* fix(pe): keep header anomalies in the overlay report

parsePeOverlay dropped pe_header_anomalies from readPeImage, so a
SizeOfHeaders that ends before the section table reached the overlay
report without its warning. Carry header_anomalies through the output
contract and Evidence result, as the certificate, import and load
config reports already do.

* Address review feedback

* fix(pe): report adjustable max_file_bytes budget and preserve omitted caller parameters in inspect_pe_overlay

* fix(pe): preserve required_value on file-size limit and use executeArtifactInspection in PeOverlayService

* chore(schemas): update inspect_pe_overlay advertised schema summary

* fix(pe): include bflt in PE overlay leading formats

* test(pe): import BINARY_DIAGNOSTICS_TOOL_CONTRACTS in PE overlay tests

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>

* feat(firmware): inspect Qualcomm MBN image headers and hash segments offline (#14649)

* feat(firmware): inspect Qualcomm MBN image headers and hash segments offline

Artifact recognition now accepts a legacy Qualcomm MBN header only for
versions 3, 5, and 6, and only after every signature-based format, when
the image size matches the region sizes, the signature and
certificate-chain pointers follow the code, and the code region lies
inside the file. Inventory and extraction list the header, code,
signature, certificate-chain, and version 5/6 metadata ranges; a range
past the end of the file is reported as a limitation with unknown
coverage and is left unlisted. An ELF image whose program-header flags
mark a Qualcomm hash segment (bits 24-26 equal 2) is inventoried as
qualcomm-mbn, with the hash-segment header, hash size, hash count, and
the first 64 segment-hash rows, while binary target resolution keeps the
ELF classification and extraction still returns those regions for an ELF
input. Signatures and certificates are reported by location and size,
and hash bytes are left as stored.

* Address review feedback

* fix(firmware): require MBN image size to equal the region sum

* fix(firmware): decode Qualcomm MBN layouts and bound hash segments

* fix(firmware): restore 40-byte MBN v3 header and deduplicate QTI warnings

* fix(firmware): keep mismatched MBN hash size and count unknown

* fix(firmware): stop mapping Qualcomm MBN v3 image_src to boot-device names

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(pe): accept Qualcomm MBN as a PE overlay leading format

The PE overlay (#13245) and Qualcomm MBN recognition (#14649) merged
concurrently. Bounded artifact recognition can now return qualcomm-mbn,
which the overlay's leading-format enum did not list, so main failed to
typecheck and build.

* feat(firmware): inventory and extract UBI image volumes offline (#13333)

* feat(firmware): inventory and extract UBI image volumes offline

* docs: name ubi-volume among compared format metadata kinds

The artifact comparison contract lists every format metadata kind that
compare_artifacts compares. ubi-volume now carries a declaration, so the
contract names it beside the other members.

* fix(firmware): keep UBI LEB ranges private to the reader

entries() yielded copyArtifactEntry(entry), which spreads the private
volume field by reference, so a caller could rewrite volume.ranges and
change the bytes the next open() read. Yield only the public entry
fields, and test that a returned entry carries no volume mapping.

* fix(firmware): keep LEB source ranges in ubi-volume metadata

Saved Evidence now records the lnum, PEB, image offset and length of each
chosen LEB, so a reassembled volume can be traced to its image bytes. The
image summary keeps counts.

* fix(firmware): reject smaller UBI eraseblock sizes whose LEB padding is invalid

A dynamic LEB with data_size 0 and data_pad equal to a smaller candidate LEB passed the size check, so a valid aligned image was refused as ambiguous. Require data_pad below the candidate LEB, as classifyUbiPeb and the volume table alignment rule already do.

* fix(ubi): refuse a UBI# file shorter than its erase-counter header

recognizeUbiImage recognized any 4 to 63 byte file starting with UBI#
without a CRC or version to check, so open_binary accepted it as an
archive and inventory labelled it a container. It now takes the file size
and refuses a file that cannot hold the 64-byte header. A short prefix
read from a longer file still defers to the reader.

* fix(ubi): refuse a volume whose only surviving LEB copy failed its CRC

When both competing PEBs for a LEB are wear-leveling copies and both fail
their data CRC, the older failed copy still won and open() served bytes
that had already failed verification. Mark that LEB unverified and refuse
the volume with extract refusal unverified_copy, keeping its inventory.

* fix(ubi): refuse an image whose EC headers disagree instead of skipping them

Eraseblock discovery and both spacing checks skipped a valid erase-counter
header whose image_seq or layout differed from PEB 0, treating it as
absent. Alternating sequences or a conflicting second header then measured
a multiple of the real eraseblock size and read the image, so a volume
became an extractable empty or header-polluted volume. Any valid header now
begins an eraseblock, and classifyUbiPeb and checkUbiPebs refuse the
disagreement.

* fix(ubi): rule out a smaller eraseblock size whose volume table is invalid

The ambiguity check declared a smaller eraseblock size equally valid from
erased header positions and LEB fit alone. With 128 KiB eraseblocks,
data_offset 4096 and a volume of alignment 6144, data_pad is 4096, but a
64 KiB LEB would need data_pad 0, so that size cannot describe the image
and a valid image was refused. The check now also requires a volume table
copy to stay valid under the smaller geometry, and runs after the table
copies are read.

* fix(ubi): compare the volume ID in a UBI volume declaration

The compared ubi-volume declaration left out the volume ID. A volume
renumbered from ID 0 to ID 1 keeps its path and reconstructed bytes, so
artifact comparison reported it unchanged even though consumers that
address volumes by number now see a different volume. The declaration now
includes the ID, and PEB placement stays out of it.

* fix(ubi): refuse a volume with no mapped LEB when PEBs are corrupt

When a volume's only data PEB had a bad EC or VID header CRC,
classification dropped its mapping and reassembly read the absence of
surviving headers as an empty volume: a static volume got used_ebs 0, a
dynamic one zero LEBs, and both were served as extractable empty files.
A corrupt PEB may have held that data, so a volume with no mapped LEB in
an image with corrupt PEBs is now inventoried but refused as lost_lebs,
with used_ebs null and a named limitation. An image without corrupt PEBs
still reads an unmapped volume as empty.

* fix(ubi): accept EC headers in static LEB data no smaller eraseblock holds

A static volume holding a nested UBI image with the same EC layout puts
valid EC headers on a smaller grid inside its payload. With 128 KiB
eraseblocks, data_offset 4096 and full 126976-byte static LEBs, the
spacing check and the smaller-grid scan refused such a header as a
geometry conflict, though ubiSmallerPebSizeHoldsLebs already rules out
every smaller size those LEBs would have to fit.

Both scans now run their verdict after the PEBs and volume table copies
are read, and set aside a header at a position only ruled-out sizes would
begin at. A spacing conflict still takes precedence over later failures,
and a header where a smaller size stays possible, as under dynamic LEBs,
is still refused.

* Address review feedback

* Address review feedback

* Address review feedback

* Address review feedback

* fix(ubi-image): carry parser limit facts through reader refusals

parseFailure now passes the named parser limit and a typed parser
fixedAllowance when it wraps a UBI limit refusal, so the 16 MiB
eraseblock size ceiling and the 262,144-eraseblock count ceiling reach
CLI and MCP with reported_limits and the fixed-ceiling recovery.

* fix(ubi-image): ignore nested EC headers no eraseblock could begin at

The second-header scan now skips headers inside the data the first PEB's
own VID header declares, so a static LEB holding a nested UBI image no
longer measures the eraseblock at the nested header.

The spacing check now counts only headers at positions an eligible
smaller eraseblock (dividing the measured size, larger than data_offset)
would begin at, and after the LEBs are read only the sizes they still
admit. A dynamic LEB holding a nested image of small eraseblocks parses
the same in PEB 2 as in PEB 5.

* fix(ubi-image): read only the first VID header within the eraseblock ceiling

The eraseblock search read every byte from offset 0 through the first PEB's
declared vid_hdr_offset to find its VID header. A CRC-valid EC header could
declare an offset of 1 GiB and make the reader allocate a buffer that size
before the eraseblock ceiling refused the image.

ubiFirstVidHeaderOffset now admits the VID header only when it lies inside
the file and the fixed eraseblock ceiling, and the reader reads just those
64 bytes. A header past the ceiling is never read, so the search reaches
its bounded eraseblock-size refusal as before.

* fix(ubi-image): skip EC headers whose offset cannot be the eraseblock size

A dynamic VID header declares data_size 0, so a first PEB holding a nested
UBI image only rules out the nested header at data_offset. The next nested
header, 6144 bytes into a 128 KiB eraseblock, was taken as the eraseblock
size and the valid 524288-byte image was refused as not a multiple of it.

The second-header search now skips headers at offsets that do not divide
the file size, since no eraseblock size could put them there. The first
header at any offset is still kept for the refusal when no size fits.

* fix(ubi-image): reject truncated dumps with misleading PEB headers

* Address review feedback

* Address review feedback

* Address review feedback

* Keep undersized UBI candidates provisional on valid VID extents

A CRC-valid VID header whose data_pad and data_size do not fit a
candidate LEB now records the eraseblock size it needs. A dividing
candidate smaller than that stays retryable, with its image kept as the
fallback, so a later candidate that holds every LEB in full is accepted.

* Address review feedback

* Address review feedback

* Exercise the UBI PEB count ceiling in memory

* fix: reject unrelated UBI header conflicts

* fix: verify static UBI payloads before retrying geometry

* fix: bound UBI static payload CRC work across PEB size candidates

* fix: repair UBI integration after merging main

* Address review feedback

* fix: let cancellation retire paused UBI volume streams

* test: synchronize paused UBI volume cancellation

* fix: preserve UBI read failures during cancellation

* perf(ubi): count PEB states and extractable volumes in one pass

Replace the per-state .filter(...).length scans in assembleUbiImage and
summarizeUbiImage with single loops, per docs/development/tool-design.md.

* Address review feedback

* fix(firmware): close UBI geometry ambiguity and corrupt-PEB tail gaps

* fix(firmware): verify erased UBI PEB bodies and validate layout VID headers

* fix(firmware): defer and cache UBI erased-body scans and deduplicate stream check helper

* fix(firmware): eliminate quadratic UBI erased-range scans and cache dynamic copy CRCs

* test(firmware): assert UBI erased-range coalescing, walk steps, and elapsed time

* perf(ubi): cache EC header scan across block-size retries

* fix(ubi): bound EC header scan cache and stream past cap

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(artifacts): inspect Debian package control metadata and contents (#10689)

* feat(artifacts): inspect Debian package control metadata and contents

* fix(deb): throw ParseFailureError and record the new tool's schema counts

DebPackageFormatFailure now extends ParseFailureError, as the architecture
guard requires of parser failure classes; its kind, partial and message are
unchanged. The advertised-dialect baseline takes the counts the
inspect_deb_package input schema adds ($schema in both profiles, and allOf,
default, examples, the \/ escape, the unanchored path pattern and untyped
nodes in the full profile).

* docs(deb): say dpkg runs maintainer scripts, not dpkg-deb

dpkg-deb only reads the archive; installing with dpkg is what runs the
maintainer scripts. Correct the spec so the safety rationale names the
right tool.

* refactor(deb): project format failures through parseFailureAnalysisError

The provider now maps DebPackageFormatFailure with the shared
parseFailureAnalysisError instead of its own instanceof ladder, passing the
partial ar/control/data observation as diagnostics. The helper takes that
optional diagnostics argument. DebPackageCapacityFailure extends
ParseFailureError<"limit"> with the resource and maximum as its limit, and
the provider keeps its limit recovery.

* test(deb): resolve inspect_deb_package from its contract family

The CLI acceptance and MCP boundary tests now take the contract from
DEB_PACKAGE_TOOL_CONTRACTS instead of the full catalog, as the testing guide
asks of focused contract tests.

* fix(deb): require debian-binary and a control file for complete coverage

Coverage was complete with a missing or empty debian-binary, or a control.tar
that held no control file. It now needs a known format version and the
control file as well as the control and data members, and each gap adds a
limitation.

* fix(deb): count hardlinks in the md5sums path cross-check

dpkg lists every name of a hardlinked file in md5sums, while tar stores the
later names as hardlink entries. The cross-check inventory now takes
hardlink paths as well as regular files, so those names are no longer
counted missing.

* fix(deb): decode xz only when its index declares a size within the limit

The sync @napi-rs/lzma decoder takes no output bound, so a member whose
index could not be read was decoded with no limit and checked only after
allocation. decodeXz now refuses such a member, as truncated when the footer
is missing and malformed otherwise, before calling the decoder.

* fix(deb): leave the md5sums cross-check unknown when an input is unread

md5sums that is not UTF-8 counted as zero listed paths, and a package with
no data.tar counted as an empty inventory. The cross-check is now computed
only when both were read; otherwise it stays null and a limitation says
which input was missing.

* fix(deb): refuse Version and Installed-Size values the output schema rejects

A Version with an empty upstream part or Debian revision (1:, 1:-1, 1.0-)
and an Installed-Size past the safe integer range reached DebControl and
failed the output schema, so the service lost the report. The parser now
records a malformed field issue and leaves the value null.

* build(deb): declare src/deb as a provider module layer

Main now requires every top-level src unit in UNIT_LAYERS. src/deb is a
provider like src/sqlite, and its two type imports of application ports
are recorded in the upward-import baseline the same way. The xz spy
binding now accepts the string or bytes input XzApi.compressSync takes.

* fix(deb): keep tar names and link targets as stored

Read ustar name, prefix and linkname fields, and GNU long names, as
NUL-terminated UTF-8 without trimming or rewriting backslashes, and keep
spaces in md5sums paths. A name that is not UTF-8 is shown with U+FFFD
replacements and counted in a limitation, since it may not match md5sums.

* fix(deb): read control files from the control.tar root only

Look up control, conffiles, md5sums and maintainer scripts by their
normalized root path, so a nested subdir/control or subdir/postinst no
longer stands in for the root file.

* fix(deb): read PAX records by byte length

PAX record lengths count bytes, so walk the extended header bytes and
decode each record on its own. A UTF-8 path no longer swallows part of
the next record. A path or linkpath record that is not UTF-8 is counted
in the same not-UTF-8 limitation as ustar names.

* fix(deb): keep unreadable relationship alternatives as issues

Accept hyphenated architecture qualifiers such as kfreebsd-amd64, and
have parseDebianRelationshipField return the alternatives it cannot
read. parseControl records each as a malformed issue on its field, so
the package reports partial coverage instead of dropping a dependency.

* fix(deb): deliver the whole partial report on a refusal

A Debian package refusal now carries the bounded partial report as
diagnostics.partial, so control facts, relationships, maintainer-script
facts, ar member offsets and file rows read before the failure reach CLI
and MCP callers, not just member names and a count.

* fix(deb): decode only the maintainer script interpreter line

interpreterLine now finds the first newline in the script bytes and
decodes only the #! line, so non-UTF-8 bytes later in the script, or a
cut through a multi-byte character at byte 256, no longer hide a valid
interpreter.

* fix(deb): bound unreadable relationship diagnostics per field

parseDebianRelationshipField now counts unreadable alternatives and keeps
only the first, and parseControl records one issue per field with that
count and the first term cut to 120 characters, so a field of many `|`
separators no longer grows the report with its input.

* test(deb): check parser guidance through its owning formatters

Export undecodableTarNamesLimitation and unreadableRelationshipsDetail
from the parser and assert delivered limitations and issue details
through them, so wording edits change one place.

* fix(deb): bound PAX header work before each tar entry

Keep only the path and linkpath PAX keys the reader uses, set in place
rather than copying an accumulated object per header, and refuse more
than eight GNU long name/link or PAX headers before one entry as
malformed, so a run of short PAX headers cannot stall the server.

* fix(deb): apply PAX owner records to the following entry

PAX uid, gid, uname and gname now override the fixed ustar fields,
which can hold shortened or fallback values. A uid or gid that is not a
safe decimal integer falls back to the fixed field.

* fix(deb): keep GNU ar string tables as counted members

A // string-table member is now kept in the ar inventory and counted
against max_ar_members like any other member. As an unknown role it is
listed in extra_member_names, so coverage reports partial.

* fix(deb): honor PAX size records and escaped md5sums names

- A PAX size record overrides the next entry's ustar size field. Reading
  and skipping by the header field reported an empty file and then parsed
  its data as a header, refusing a valid archive.
- GNU md5sum writes a leading backslash and escapes names that contain a
  backslash, newline or carriage return. Those lines were dropped, so the
  cross-check counted listed files as missing; they are now read, and lines
  that are not digest lines are counted in a limitation.

* fix(deb): bound relationship alternatives and read PAX headers faithfully

- Count relationship alternatives across the control file before building
  any, refusing more than a fixed 65,536; a field of '|' separators within
  the control budget could build millions of report objects.
- Refuse a PAX extended header whose record length is unreadable or runs
  past the member, instead of using the fields read so far.
- Keep global (g) PAX values for every later entry and per-file (x) values
  for the next entry only; global values were cleared after the first file.

* refactor(deb): drop an unused import

* chore(mcp): drop the dialect baseline main retired in #10693

* fix(analysis-view): call completeWithinViewCoverage with main's single count

Main dropped its redundant second argument; both arguments were the same
count here.

* test(mcp): record this PR's advertised-schema summary

Add the advertised-schema summary for inspect_deb_package, generated
with npm run verify:advertised-schemas -- --update-summary.

* fix(deb): bound repeated global PAX text and accept xz stream padding

A global PAX path, linkpath, uname or gname is copied into every later
row, so each reuse is now charged to the member byte budget
(max_data_bytes or max_control_bytes) and refused before the row is
added. An empty global PAX value now deletes the earlier global
override, so later entries read their header owner again.

xzUncompressedSize and the footer check skip trailing zero Stream
Padding in 4-byte groups before locating the footer, so valid padded
xz members are no longer reported as truncated.

* fix(deb): trim trailing tar path slashes with a backward scan

The unanchored /\/+$/u retried from every slash, so a PAX path or
md5sums name made of a long slash run and a final non-slash took
quadratic time. logicalTarPath now trims trailing slashes with a
linear charCodeAt scan from the end.

* fix(deb): parse global PAX owner ids once per global record

Global uid and gid values were run through paxId for every later
entry, and the repeated-text budget skips numeric keys, so a long
global owner value was rescanned once per row. Parse them when the
global record is read and reuse the numbers.

* refactor(deb): report coverage with the shared coverage status schema

* refactor(deb): classify provider failures through classifyProviderFailure

* fix(deb): bound resolved ar member names before copying them

GNU ar /N references can repeat one string-table entry without charging
its text to any budget, and every resolved name is copied into the report
and its Evidence. Refuse a BSD or GNU long name above 4096 bytes before it
is read or sliced, so repeated references cannot expand a small table into
large report text.

* test(deb): register the debPackage capability conformance case

debPackage is declared in CAPABILITY_DECLARATIONS but had no entry in
PROVIDER_CAPABILITY_CONFORMANCE, so the conformance suite failed for it.
Name the existing Debian package CLI acceptance test as its case.

* fix(deb): flag repeated control and data members as extra

Only the first debian-binary, control.tar*, and data.tar* member is
read. A later member with the same role was neither decoded nor listed,
so a package with an empty first data.tar and a populated second one
reported complete coverage. Repeated members now land in
extra_member_names with a limitation, which keeps coverage partial.

* refactor(deb): use the shared excerpt and error message owners

The architecture guards from main count a hand-written ellipsis cut in
the relationship issue detail and two inline error-to-message copies.
Use ellipsisExcerpt and errorMessage instead.

* refactor(deb): move DebPackagePort to src/ports/deb

The provider imported its port from the application layer, which needed
an upward allowance in the module-layer baseline. Put the port beside the
other provider ports and drop the allowance.

* fix(deb): record only caller-selected budgets in Evidence

Omitted inspect_deb_package budgets no longer appear in Evidence
parameters as if the caller set them; only supplied fields are kept.

* fix(deb): report fixed reader allowances as limits

The ar member name, tar extension header, and relationship alternatives
allowances stop inspection without showing the input is invalid. Report
them as `limit` parse failures (DebPackageAllowanceFailure) with the
partial report attached, and project them as resource_constraint with a
fixed-allowance recovery instead of invalid_request.

* fix(deb): refuse GNU ar long name references outside the string table

A `/<offset>` reference past the end of the `//` string table, or one
that lands on an empty entry, resolved to an empty member name. The
report then failed debPackageSchema and callers got AnalysisOutputError
with no file identity or partial facts. Check the offset and the
resolved name, and refuse as a malformed DebPackageFormatFailure that
carries the partial report.

* fix(deb): align ar members by stored size and require padding

Advance past each ar member using the stored header size, so a BSD #1/N
extended name with odd length keeps the next header aligned. Refuse an
odd-sized member whose padding byte is missing at end of file instead of
reporting complete coverage for a truncated container.

* fix(deb): trim NUL-terminated header fields in linear time

Trim fixed-width ar and tar header fields at the first NUL with indexOf
instead of a NUL-to-end regex, which retried from every NUL when a
continuation line followed a NUL run. Control-field decimal parsing no
longer applies header NUL trimming.

* fix(deb): skip the tar path prefix on GNU headers

GNU tar headers use the 345-499 region for atime, ctime and sparse
data, not a POSIX path prefix. Only join the prefix when the header
carries the POSIX "ustar\0" magic.

* docs(readme): drop duplicated target tables in five translations

The fa, ko, th, zh-TW and zh guides carried the target table twice.
Restore each to upstream and add the single Debian packages row.

* fix(deb): report oversized Zstandard windows as a fixed allowance

A valid control or data zstd member can request a decoder window above
the fixed 128 MiB ceiling. Node raises
ZSTD_error_frameParameter_windowTooLarge, which the parser reported as
malformed. Map it to a DebPackageAllowanceFailure naming the new
zstd_window_bytes allowance, matching ZipArtifactReader.

* fix(package): bundle XZ decoder binaries for every plugin host

The plugin archive is produced on Linux x64, where npm ci drops other
platforms' optional packages. The packaging step only restored the PTY
binaries, so Codex plugin installs on macOS and Windows had no
@napi-rs/lzma binding and valid XZ packages failed as unsupported.

Derive the platform packages from the locked runtime tree instead:
every optional dependency of a runtime package that targets
darwin/linux/win32 on x64/arm64 is restored at its locked path with a
verified integrity, and the packed archive is checked for each one.

* fix(deb): keep only applied PAX keys while reading records

parsePax stored every record's key before PAX_KEYS filtered them, so one
extended header of many short records with distinct keys grew an object
property per record before any entry limit ran. Records whose key is not
one this reader applies are now read and dropped, and parsePax is covered
directly in DebPackageParser.test.ts.

* Address review feedback

* Trim deb822 lines with linear scans

The trailing-whitespace alternative of the shared trim expression retried
from every position of a long interior whitespace run, so a package
Description could take quadratic time. Scan from each end instead and
cover a long tab and space run in a test.

* fix(deb): read only the first control paragraph

parseControl used the first paragraph of the control file, but
deb822Paragraphs built a map for every paragraph first. A control file
of many small paragraphs could allocate millions of maps within the
decompressed-size budget. deb822Paragraphs now takes a paragraph limit
and yields string lines lazily, and parseControl stops after the first
paragraph.

* fix(deb): report unreadable tar modes as null

A tar header whose mode field is not octal was reported as mode 0000,
which invents a permission the archive never stated. Report the mode as
null and add a malformed issue for the member, so coverage is partial.

* fix(deb): refuse GNU sparse tar entries

GNU PAX sparse headers (GNU.sparse.*) rename the following entry to a
synthetic GNUSparseFile path and store only mapped segments, so reading
it as a regular file reported the wrong name and size and could miss
md5sums cross-checks. Old GNU sparse (S) entries can also carry
extension blocks their size field does not count. Refuse both as an
unsupported format instead of reporting wrong file facts.

* refactor: use shared artifact inspection for Debian packages

* fix(deb): report per-call budget refusals as parameter limits

* Address review feedback

* Address review feedback

* fix(deb): bound xz decoding, inherit global PAX size, and redact Homepage URLs

* fix(deb): bound xz index preflight memory and preserve typed cancellation with partial facts

* fix(deb): bound nested relationship lists, align tar stored-body rule, and scope async parse

* fix(deb): walk actual XZ block boundaries, scan control lines without arrays, and guard XZ close gate

* refactor(deb): avoid throwaway filter arrays in DebPackageParser

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>

* refactor(discovery): share regular-file and execute-permission checks (#14749)

* test(filesystem): restore directory modes after permission-denial checks (#14751)

* test(filesystem): restore directory modes after permission-denial checks

* test(filesystem): cover mode restoration on callback rejection

* feat(artifacts): inventory macOS flat installer packages offline (#11377)

* feat(artifacts): inventory macOS flat installer packages offline

* fix(artifacts): keep refused pkg members unavailable during inspection

A XAR member whose decode failed or whose decoded size contradicted the
TOC stayed a readable entry, so shared inspection reopened it, hit the
same mismatch at stream flush and aborted the whole scan. Record those
members and have open() report them as unavailable content, so the scan
keeps the partial facts and the named refusal.

* fix(artifacts): report out-of-range installKBytes as unknown

The Distribution parser accepted any safe integer for a pkg-ref's
installKBytes, but the report field is uint32. A value such as
4294967296 parsed fine and then failed schema validation, which
rejected the whole inventory report. Bound the attribute to uint32
at parse time so an out-of-range value reads as unknown.

* fix(artifacts): charge decoded pkg archive bytes against the shared budget

The shared expansion budget charged each Scripts or Payload member by its
stored XAR size, so several small gzip members could each decode toward the
per-archive allowance while barely moving the total. Decode now stops at
what remains of the shared budget, the decoded size is charged, and an
archive that would exceed it is listed as not expanded.

gunzipBounded also recognizes Node's ERR_BUFFER_TOO_LARGE, which is what
maxOutputLength raises, so an oversize gzip member is reported as a limit
rather than as invalid gzip data.

* fix(artifacts): keep expanded pkg Scripts/Payload archives in inventory

Expanding a gzip-cpio Scripts or Payload member deleted the stored XAR
entry, so its heap offset, sizes and TOC checksums dropped out of
inventory and extraction. Keep the stored occurrence at a sibling
logical path (for example Payload.cpio.gz) with sourcePath still naming
the XAR member, so it sits alongside the expanded children.

* fix(artifacts): count pkg check scripts in UTF-8 bytes

scriptLength returned the JavaScript string length, so non-ASCII
installation-check and volume-check scripts reported the wrong byte
count. Measure the selected text with Buffer.byteLength.

* fix(artifacts): keep pkg FIFO and device members non-materializable

A cpio member that is not a directory, symlink or regular file (FIFO,
character or block device, socket) was inventoried as an empty regular
file. Emit it as a metadata declaration with a limitation naming its
type, keep its mode in format metadata, and refuse open() on it.

* fix(artifacts): bound pkg member archived range before reading it

Refuse a zlib-encoded XAR member whose archived heap range exceeds the
compress bound of its decode allowance, and never read the range of an
unsupported encoding, so a package-controlled archived length cannot
reach a buffer allocation unbounded.

* fix(artifacts): refuse installer XML with an unexpected root element

Distribution must have an <installer-gui-script> root and PackageInfo a
<pkg-info> root. Any other root is now a named malformed-input refusal
instead of a product or component identity with null fields.

* fix(artifacts): keep duplicate XAR TOC paths as distinct pkg entries

Key XAR file entries by their TOC occurrence instead of their path, so a
later record at the same path no longer overwrites the earlier one.
Expanded Scripts/Payload member keys now derive from their archive key
for the same reason.

* fix(artifacts): cap streamed XAR inflate output before forwarding it

maxOutputLength does not bound a zlib stream, so count emitted bytes in
createBoundedXarInflate and fail before forwarding past the allowance.
The member stream also fails as soon as decoded bytes pass the TOC
extracted size instead of waiting for EOF.

* fix(artifacts): read XAR TOC execute bits across owner, group and other

The XAR TOC <mode> was tested only on its last octal digit, so a mode
such as 0750 reported a non-executable entry. Parse the octal text and
test (mode & 0o111) like the cpio path.

* fix(artifacts): keep XAR TOC directories and link-only symlinks as pkg entries

TOC records without a heap body were dropped from the inventory, so
directories, symlinks declared only by <link>, and empty files vanished.
They now become their own occurrences: directories stay non-openable,
symlinks open as their declared target text, empty files open as zero
bytes, and other record types are kept as non-materializable metadata.
Installer document lookup only considers heap-backed records.

The shared lifecycle cases open the first entry, so they now use the
component package fixture, whose first TOC record is a heap-backed file.

* fix(artifacts): record Scripts and Payload presence from the XAR TOC

A listed Scripts or Payload archive is now present before expansion is
attempted. When the shared budget skips it or the XAR read is refused,
its compression is reported as "unread" instead of "absent".

* fix(artifacts): keep pkg coverage unknown when content was refused

Coverage was complete whenever no archive hit the shared expansion
budget, even when a heap range, encoding, decode, cpio or pbzx refusal
left content unread. Any refusal other than the header-version notice
now keeps coverage unknown.

* fix(artifacts): only treat the cpio archive limit as a shared budget stop

A zero or oversize cpio namesize raises the name limit, whose maximum is
4096 bytes. When exactly 4096 bytes of shared budget remained, that limit
was mistaken for the budget stop and the refusal was dropped. Match the
limit name as well as its maximum.

* fix(artifacts): keep cpio members read before a damaged tail

A Scripts or Payload archive whose cpio stream ends or breaks after
complete members used to discard all of them and report an empty
inventory with false script flags. parseCpioOdcPrefix now returns the
members read before the failure along with the failure itself, and the
pkg reader keeps those members as entries while recording the refusal,
so coverage stays unknown. A failure before any complete member is
still a plain refusal.

* fix(artifacts): keep an out-of-range XAR TOC mode unknown

Parse <mode> once in the TOC reader. Octal text that does not fit a
uint32 becomes null, so one bad entry no longer fails the inventory
schema check for the whole package.

* fix(artifacts): cancel paused memory-backed pkg members

A retained member streamed into a paused consumer kept its output open
after abort, because the in-memory source has no signal and the shared
stream owner defers cancellation until production finishes. The member
output now retires on abort while its final validation has not started.

* Address review feedback

* fix(artifacts): share one expansion allowance across XAR members

* fix(artifacts): count XAR TOC nodes before building the DOM

A small TOC could hold millions of ignored elements under the byte
limits, and each became a DOM node before the file count ran. Parse
the TOC through parseXmlDocumentWithinNodeLimit with a 256-per-file
node allowance and report a capacity limit past it.

* fix(artifacts): cancel a paused XAR decoder after its source retires

A highly compressed zlib member can finish reading its archived range
while the decoder is still paused on a slow consumer. The file source's
abort listener is gone by then and ownArtifactStream deferred abort until
production finished, so cancellation waited for the consumer to resume.

Once the source closes, an abort now destroys a decoder that has not
ended. The output's final validation only starts after the decoder ends,
so it keeps failure precedence.

* fix(artifacts): reset XAR reader state when preparation retries

When one caller cancelled preparation and another retried it on the
same reader, #prepare built fresh metadata but kept #entries and
#refusedContent from the cancelled attempt. The retry then skipped
members already refused without recording their refusals, so coverage
could report complete while open() still refused the member.

#prepare now clears both maps before it reads the package.

* fix(artifacts): align macOS pkg reader with format failure API and zlib output limits

* fix(artifacts): bound XAR TOC expanded paths, preserve valid TOC records, and populate symlink linkTarget

* fix(pkg): enforce package-wide cpio caps, strict UTF-8 names, root Distribution, and stored size checks

* fix(macos-pkg): bound package-wide installer metadata bytes and records

* fix(macos-pkg): tie installer metadata budgets to artifact_limits.expanded_bytes

Wire macOS flat package Distribution/PackageInfo byte, record, and XML-node
allowances into artifact_limits.expanded_bytes via macosPkgMetadataBudget:
- Preserve the 4 MiB total, 1 MiB per-document, 4,096-record, and 65,536-node
  defaults when artifact_limits.expanded_bytes is omitted so aliased-heap
  metadata bombs remain bounded.
- Charge every Distribution and PackageInfo read (including aliased stored
  heap ranges) against the shared expanded_bytes budget alongside zlib XAR
  members and Scripts/Payload expansion.
- Raise the byte allowances and scale record (1 per 1,024 bytes, min 4,096)
  and XML-node (16 per record) allowances when artifact_limits.expanded_bytes
  is set, and report effective limits with artifact_limits.expanded_bytes
  recovery on metadata limit refusals.
- Also add qualcomm-mbn to PE_OVERLAY_LEADING_FORMATS to resolve the typecheck
  conflict introduced by merging origin/main.

* fix(macos-pkg): strip repeated ./ prefixes and tie cpio limits to expanded_bytes

- Normalize cpio member paths with withoutCurrentDirectoryPrefix (handling
  repeated leading ./ segments and archive-root entries such as ./. and ././)
  both when counting retained path bytes and when forming logical paths,
  preserving the recorded name in sourcePath.
- Derive Scripts/Payload cpio archive-byte, member-count, and expanded
  path-byte allowances from artifact_limits.expanded_bytes via
  macosPkgCpioBudget (keeping 64 MiB / 4,096 members / 4 MiB defaults when
  omitted, removing hardcoded cpio clamps, and reporting effective limits with
  artifact_limits.expanded_bytes recovery).
- Update docs/macos-pkg.md and docs/reference/limits-and-recovery.md and add
  regression tests.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(ci): clear stale static diagnostic context before recording (#14713)

* fix(ci): clear stale static diagnostic context before recording

* test(ci): align inherited Mach-O assertion with main

---------

Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(analysis-view): omit absent fields from extraction rows (#14806)

* perf(ci): read each source file once in architecture guards (#14808)

* fix(browser): reject a file URL with a hostname (#14792)

* fix(browser): reject a file URL with a hostname

A file URL names another host when its hostname is not empty. The navigation hook blocks that URL. An empty host stays allowed, including file://localhost, because the URL standard ignores that host.

* test(browser): cover a blocked file-host redirect

The file-host regression emits will-redirect for a remote file URL and a local file URL. Dropping the redirect check leaves preventDefault unset and fails the test.

* test(artifacts): share UBI reader fixture helpers (#14809)

* fix(cli): isolate a synchronous resource-closer throw (#14796)

* fix(cli): isolate a synchronous resource-closer throw

closeCliResources invoked each closer while building the
Promise.allSettled input. A closer that threw before returning a
promise left that call, so later owners did not run.

Start each closer on its own turn. A synchronous throw stays with
that owner, and every other owner still settles. Closers stay
registered, so a later close retries them.

A failed registration can request process exit twice. The first
request now owns shutdown. A second registration fail or host exit
returns without starting another resource close or exit timer.

* test(cli): exercise duplicate exit after rendering failure

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* chore(deps): update plist to 5.1.2 (#14810)

* fix(javascript): validate literal options.port on net and tls connects (#14760)

* fix(javascript): validate literal options.port on net and tls connects

* fix(javascript): retain TCP validation for non-string TLS arguments

* refactor(javascript): reuse function-valued syntax classification

* fix(javascript): preserve inherited TLS option assignments

* test(javascript): isolate module-order TLS setter control

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* test(fixtures): let each test clean up its own temporary directories (#14805)

* test(dotnet): share metadata layout reads for managed PE fixtures (#14807)

* fix(browser): bound armed timeline rows by the retained-event allowance (#14799)

* fix(browser): bound armed timeline rows by the retained-event allowance

Armed timeline rows were appended with no byte budget. Pre-arm
messages and document request identities already stop at the
retained-event allowance.

Count each armed row before keeping it. A row that does not fit fails
the observation with payload_limit and does not return a shorter
timeline. Event count has no separate ceiling.

* chore(browser): format the timeline allowance check

oxfmt --check rejects the wrapped comparison in TimelineCapture.#add.

* fix(browser): give timeline retention a caller control

Armed timeline rows use browser.timeline_retained_bytes. A call can pass
timeline_retained_bytes. Request identities keep a separate counter.
A row that does not fit returns payload_limit with details.limit, including
a row admitted during terminal progress.

* fix(browser): refresh advertised schemas for the timeline allowance

The new setting and per-call field change the compact input hashes for
observe_web_session, inspect_analysis_settings, and update_analysis_settings.

* fix(browser): report measured timeline bytes without required_value

Admission stops at the first row that does not fit, so later rows are
unknown. measured_timeline_bytes records the rows already measured.
The budget test waits until all four lifecycle events are delivered.

* refactor(cli): share cleanup for retained resource scopes (#14811)

* fix(api-contract): report details.limit for max_file_bytes and mark heap headroom exhaustion (#14798)

Share max_file_bytes bounds through API_CONTRACT_FILE_BYTES_BUDGET in src/domain/apiContract/apiContractQuery.ts, attach details.limit with required_value in ApiContractRead, mark V8 parser heap headroom refusals as measuredExhaustion, and drop all three entries from the untyped refusal baseline (Refs #14234).

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* refactor(analysis-view): reuse field selection for retained rows (#14816)

* perf(ci): run architecture guards once in full qualification (#14812)

* test(fixtures): use per-test cleanup in catalog suites (#14815)

* fix(ci): fall back when a changed test fixture has no traced consumer (#14709)

* fix: deepen verified coverage for PR #14354

* test(ci): assert the selected fixture consumers

---------

Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>

* test(providers): share placeholder Hopper project files (#14813)

* refactor(domain): share BOM-preserving UTF-8 field decoding (#14814)

* fix(wasm): report details.limit for max_interface_bytes refusals (#14795)

Define WASM_INTERFACE_BYTE_BUDGET in src/domain/wasm/wasmInterface.ts so wasmInterfaceByteBudgetSchema and WasmInterfaceBudget share one owner, and attach details.limit to max_interface_bytes refusals (Refs #14234).

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* test(artifacts): share entry collection in ZIP reader tests (#14821)

* fix(ci): require complete path references for test coverage (#14819)

* fix(source-maps): report details.limit for source_map_limits refusals (#14797)

Share source_map_limits bounds through a domain-owned SOURCE_MAP_BUDGETS table and attach details.limit across local source-map read, decoder admission, codec reply, and memory/output limit refusals (Refs #14234).

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* refactor(xml): share NuGet and VSIX manifest field reads (#14820)

* refactor(setup): share client configuration path error checks (#14822)

* fix(mcp): name the discover_tools call for an unloaded hot-cold tool (#14845)

* fix(ci): bound packet capture prerequisite acquisition (#14716)

* fix(ci): bound packet capture prerequisite acquisition

* test(ci): enforce packet capture prerequisite order

---------

Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(v8): report details.limit for V8 code cache per-call budgets (#14793)

Share max_file_bytes and max_strings schema bounds through a domain-owned V8_CODE_CACHE_BUDGETS table and attach details.limit to both inspect_v8_code_cache budget refusals (Refs #14234).

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* fix(vsix): read manifest fields in the package namespace (#14851)

* fix(cli): enforce the retained Evidence cap on bundle reuse (#14838)

* fix(cli): apply the retained Evidence cache cap when reusing bundles

* fix(cli): preserve earlier evidence receipts on rejected reuse

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* test(artifacts): share macOS package reader fixtures (#14853)

* docs(mcp): clarify when discovery requires a catalog refresh (#14837)

* fix(mcp): direct cold tool calls to exact-name discovery

* fix(mcp): share conditional catalog refresh guidance

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(ci): remove unused exports flagged by deep checks (#14852)

* fix(mcp): replay direct Ghidra reads that omit document (#14842)

* refactor(packages): share bounded ZIP member reads (#14849)

* refactor(views): share optional filter set construction (#14850)

* fix(ghidra): reuse completed decompiles and decompile code outside functions (#14843)

* fix(ghidra): reuse completed decompiles and decompile code outside functions

* fix(ghidra): say what the procedure inventory omits and how to reach it

* fix(ghidra): say when a file offset maps to code outside every function

A file-offset selector that mapped to disassembled code without a function
failed with advice to choose an inventory procedure, which cannot name that
code. The failure now states the fact and that procedure_pseudo_code can
decompile it by the mapped analysis address.

One predicate now decides that an address holds code outside every function
for the address, file-offset and procedure_not_found paths, and the bridge
imports UndefinedFunction and SoftReference like its other dependencies.

* fix(ghidra): decompile code outside functions selected by file offset

A file offset names the same location as its mapped analysis address, but
an offset that mapped to code Ghidra disassembled without a function was
refused while the address decompiled. The offset now resolves through the
same on-the-fly UndefinedFunction path and limitation, and its selection
reports the inferred entry as procedure_address. The refusal that sent the
caller back to the address form is removed.

* fix(ghidra): keep reused decompiles across reads without decompiler options

A request that omits decompile_max_payload_mib now leaves the session's
payload limit unchanged instead of resetting it to the Ghidra default,
so an instruction or metadata read no longer discards completed
decompiles. An explicit null still selects the installed default.

Boundary limitations for a reused decompile of code outside every
function now use the function the decompile widened, not a fresh
entry-only UndefinedFunction.

* docs(ghidra): state what an omitted decompiler payload option means

* fix(ghidra): report a held checkpoint lease as retryable contention (#14844)

* fix(ghidra): report a held checkpoint lease as retryable contention

* fix(ghidra): tell a contention retry to reopen once the owner saved edits

A session that waited for a checkpoint lease keeps the generation it selected,
so after the owner saves Program edits and closes, repeating the call cannot
succeed. Report that outcome as a typed superseded failure with reopen
recovery instead of a checkpoint-directory configuration error, and say so in
the busy recovery.

* perf(decompile-all): group durable writes per batch of functions (#14858)

* perf(decompile-all): group durable writes per batch of functions

The export synced each function file and then the journal, one function at a time, so it spent about as long waiting on the disk as decompiling.

Each file's bytes are now synced in staging while later functions are decompiled. A group of up to eight functions then publishes its files in visit order and appends its journal records with one write and one sync. A journal record is still written only after its file's content is synced and published. Cancellation and failures commit the pending group before they are reported.

Files, journal records and their order, the index and counts are unchanged. A stopped process or host now leaves up to eight decompiled functions unrecorded instead of one; a resume decompiles them again and adopts files already in place.

Addresses #14830

* fix(decompile-all): commit the pending group on a throw and after one second

A provider adapter that threw inside a group dropped the functions already
decompiled in it: their staged files were removed and no record was written,
where each had been committed before the next was requested. The pending group
is now committed before the throw propagates.

A group is also committed by the first function that settles a second or more
after the previous commit, so a slow provider is committed function by function
instead of leaving up to eight long decompilations unrecorded.

Adds the missing lifecycle regressions: a caller abort during a group's
publication and during its journal append, a failed removal of a discarded
staged file, and a resume beside staging left by a stopped run.

* test(decompile-all): release the export a failed-discard test retains

The test left its export's cleanup failing, so the directory lease stayed held
by the test process. The lease is keyed by device and inode; where the
filesystem reuses the removed directory's inode, the next test's export was
refused as already running. The test now gives the export a resource scope,
retries the retained cleanup once removal works, and resumes in the same
directory, which also covers the cleanup retry.

* fix(decompile-all): retain failures the group commit observed after a stop or throw

A write failure that stops a group now keeps a later function's provider failure as a secondary failure, with its cleanup still attached. When a provider throws and the commit of earlier functions then fails, that commit failure is returned as primary and the throw is retained with it. The first provider failure before an independent retry now joins the group before the retry runs, so a retry that throws cannot drop it.

* refactor(decompile-all): compose every export failure through one owner

Group settlement now carries each entry's outcome: the first stop leads, entries after it are abandoned but keep any failure they observed, and a failed journal append leads those. One composeFailures helper retains later failures as secondary and keeps every cleanup they own, and the final publish/index/close composition uses it too, so an index failure that still owns cleanup is no longer dropped behind an earlier failure. A journal write failure also keeps a later invalid record as a secondary failure.

* fix(deb): preserve Unicode separators in md5sums filenames (#14854)

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(ci): preserve the 75-minute npm visibility deadline (#14761)

* fix(ci): preserve the 75-minute npm visibility deadline

* test(ci): use ES2023-compatible registry deadline fixture

* refactor(ci): keep the npm visibility deadline at the polling boundary

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
Co-authored-by: Kei Ito <angila-antonia-casey@dr.com>

* fix(vsix): resolve the exact web extension entry point (#14862)

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(tar): recognize gzip archives with long extra fields (#14861)

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* test(pyinstaller): reuse archive reader fixtures (#14879)

* refactor(vsix): share manifest extension list parsing (#14876)

* fix(hopper): report the stalled export function and shell recovery (#14855)

* fix(hopper): report the stalled export function and shell recovery

decompile_all reports a progress update every five seconds while one
function stays pending, naming the function and its position. MCP sends it
as a progress notification and the CLI as a rea_progress line on stderr.

A retained Hopper document now carries remediation that holds after a
one-shot command has ended: Hopper is still running the named operation and
must finish or be quit. The close_binary retry text is kept as guidance for
a continuing caller.

Refs #14840

* fix(hopper): qualify the advice to quit Hopper while it is still working

The recovery text for an ended invocation told the user to quit Hopper to stop
a running operation without the condition its sibling text carries. Hopper is
the user's application and may hold other documents, so the advice now applies
only when it has no other work.

* fix(decompile-all): time only provider requests when reporting a function wait

The wait reporter timed a whole function attempt, including journal appends and file commits, so a slow output volume was reported as the provider still decompiling. It now wraps each provider request (procedure_info and procedure_pseudo_code) and names the request it waits on. The progress test now uses phase gates and releases and joins the export on every path.

* docs(decompile-all): say the wait report times provider requests only

* fix(progress): rate-limit each progress phase separately

The shared reporter dropped any intermediate update within 100 ms of the previous one, whatever its phase. Hopper's one-second request heartbeat could therefore suppress every decompile_all wait report that fired just after it. The interval now applies per phase, so a heartbeat cannot hide a rarer update from another phase. The decompile_all progress test also restores its commitFunctionFile spy.

* fix(ghidra): cancel an active request without closing the session (#14857)

* fix(ghidra): cancel an active request without closing the session

Cancelling the request Ghidra is working on closed the whole session, so the next call paid for a restore or a full re-import and session annotations were lost.

The bridge now reads its connection on a second thread that only cancels the Ghidra TaskMonitor of the request a cancel frame names; requests still run one at a time. For an active read, REA writes that frame and waits up to two seconds for the request's reply. When it arrives, the call returns a cancellation and the session, its annotations and the queued requests stay. Edits are not interrupted, and a read that is not answered in time closes the session as before.

Refs #14832, #8223, #5340

* feat(ghidra): bound the cancel grace with a launch control

REA_GHIDRA_CANCEL_GRACE_MS replaces the fixed 2 s wait for the bridge to
answer a cancelled read before the session is closed. Default 2000 ms,
floor 100 ms, maximum 60000 ms.

The value is parsed when REA starts and fixed for a session when its
request queue is constructed. It is a restart-only launch control in the
numeric limit registry, not a runtime analysis setting, so the MCP tool
catalog is unchanged.

The session limitation states the applied value and its source, and the
failure of requests queued behind an expired grace names the control,
value, source and range. An invalid value is reported by doctor and
registration validation and refuses a Ghidra session.

The hang_tools client cases inject the 100 ms floor instead of waiting
out the default grace.

* fix(ghidra): keep capability limitations from claiming the default cancel grace

Capability descriptors are built once without a session, so they stated the 2000 ms default as the applied value even when REA_GHIDRA_CANCEL_GRACE_MS was set at launch. They now name the control and its default; session limitations still state the value applied.

* refactor(ghidra): drop the redundant pre-decompile cancellation check

DecompInterface.decompileFunction already returns a DISPOSED_ON_CANCEL result for a monitor cancelled before it starts, which the existing isCancelled() check reports as decompile_cancelled.

* test(ghidra): expect session limitations from the session owner in MCP parity

The parity check compared session Evidence with capability limitations. Since capability descriptors no longer state an applied cancel grace, the expectation is derived from ghidraSessionCommonLimitations with the grace this harness applies.

* perf(ci): run the Windows typecheck once per matrix (#14875)

* fix(rizin): terminate the owned debugger when cleanup cannot resynchronize (#10462)

* fix(rizin): terminate the owned debugger when cleanup cannot resynchronize

A Rizin debug command whose deadline expires while the target keeps running
leaves the debugger blocked with unread cleanup commands. Cleanup could not
observe its resynchronization marker, detach was never verified, and the
retained process outlived the MCP server with its target (issue #8779).

Detach results now carry an explicit `unavailable` declaration. Rizin returns
it when a bounded resynchronization probe (500 ms, inside the shared 1000 ms
detach budget) observes no marker. `stopOwnedDebuggerProcess` then terminates
the directly owned process and reports `stopped_inferior_unknown`, leaving the
inferior's disposition unknown instead of inferring it from a PID or path.
An observed marker followed by a refused detach still retains the cleanup
owner for retry, and a session whose output streams have not settled remains
retained. Rizin never signals the inferior, so its target may continue
running; timeout, cancellation and protocol-failure evidence name the
unverified detach and the unknown target state, as do the close contract,
the Rizin guide, and the runtime-observation skill.

Validation (rebased onto upstream/main at cdc4541ef):
- npm run test:focused -- 21 Rizin/GDB boundary and MCP files: 463 passed,
  1 skipped (real Rizin 0.7.4 lane; the host runs 0.9.1).
- npm run test:coverage:reverse-tools: passed.
- npm run check:fast, format:check, metadata:check, docs:check,
  verify:architecture-guards, knip:production and lint:typed: passed.
  The repository-level knip task reports one pre-existing unused type
  (src/domain/adb/adbDeviceAnalysis.ts) that reproduces on the clean base.
- Real Rizin 0.9.1 on Linux x64: on the base, a `dc` deadline left the
  retained rizin process alive and closeAll raised retainedProcessIds; with
  this change the command returns partial output with the new limitation,
  the owned debugger is terminated, the target keeps running, and close
  returns target_state unknown.

* fix(rizin): address Greptile P1/P2 and Codex review findings

* fix(rizin): address Greptile P1/P2 and Codex review findings

* fix(rizin): address Greptile P1/P2 and Codex review findings

* fix(rizin): keep the unknown target state when cancelled startup cannot detach

A startup that failed its protocol and was cancelled reported only the
cancellation. When cleanup then could not resynchronize and terminated
Rizin without a verified detach, the caller lost the only record that the
target may still be running, because the session is removed after the stop.

Cancellation stays the reported reason and the unverified detach is
retained as a secondary failure, as the protocol-failure branch already
states it. Also route the cleanup probe reason through errorMessage.

* test(rizin): use lifecycle assertions and typed failures

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* perf(ghidra): decompile upcoming export functions in parallel (#14847)

* fix(ghidra): reuse completed decompiles and decompile code outside functions

* perf(ghidra): decompile upcoming export functions in parallel

* fix(ghidra): say what the procedure inventory omits and how to reach it

* fix(ghidra): say when a file offset maps to code outside every function

A file-offset selector that mapped to disassembled code without a function
failed with advice to choose an inventory procedure, which cannot name that
code. The failure now states the fact and that procedure_pseudo_code can
decompile it by the mapped analysis address.

One predicate now decides that an address holds code outside every function
for the address, file-offset and procedure_not_found paths, and the bridge
imports UndefinedFunction and SoftReference like its other dependencies.

* fix(ghidra): scope decompile read-ahead to the operation it prepares

The bridge ran the read-ahead window in the generic serve loop, before the
ping, analysis-incomplete and read-only checks and for any method that
carried the field. It now runs only for procedure_pseudo_code, after those
checks. The pool state sits with the other decompiler fields and its Ghidra
types are imported.

The export tests now cover consecutive windows, a limit that ends inside a
window and a window whose first function sends no decompile request. The
provider guide states that a function failing or timing out inside a window
is attempted again by its own request, and how long the pool lives.

* fix(ghidra): decompile code outside functions selected by file offset

A file offset names the same location as its mapped analysis address, but
an offset that mapped to code Ghidra disassembled without a function was
refused while the address decompiled. The offset now resolves through the
same on-the-fly UndefinedFunction path and limitation, and its selection
reports the inferred entry as procedure_address. The refusal that sent the
caller back to the address form is removed.

* fix(ghidra): bound decompile read-ahead by the carrying request's deadline

A request that carried a read-ahead window waited for every function in it,
then decompiled its own function again when the window's attempt failed or
timed out, so one configured deadline could elapse twice. That request now
waits only within its own deadline, consumes the window's outcome for its
function whatever it is, and cancels siblings still running once it has its
result and the deadline has passed; they stay uncached for their own requests.

The hint is advisory, so selectors past one window are now ignored instead
of refusing the request. Pooled decompilers run on a private thread pool
rather than resizing Ghidra's shared "Parallel Decompiler" pool, and are
released after 30 seconds without a window.

* test(ghidra): cover read-ahead deadline and hint clamp on real Ghidra

The decompiler failure probe now injects a read-ahead window whose carrying
function times out beside a sibling that never finishes. It checks that the
request reports the timeout without decompiling again, waits only within its
deadline, leaves the cancelled sibling uncached, uses REA's own thread pool,
and that a longer hint is clamped to one window.

The probe no longer ran against the current bridge: it used a removed
three-argument Request constructor, expected the old timeout and failure
wording, and injected decompilers that completed-result reuse never called.
It now builds full requests, matches the current messages by prefix and
clears reused results before each injection.

* fix(ghidra): keep reused decompiles across reads without decompiler options

A request that omits decompile_max_payload_mib now leaves the session's
payload limit unchanged instead of resetting it to the Ghidra default,
so an instruction or metadata read no longer discards completed
decompiles. An explicit null still selects the installed default.

Boundary limitations for a reused decompile of code outside every
function now use the function the decompile widened, not a fresh
entry-only UndefinedFunction.

* docs(ghidra): state what an omitted decompiler payload option means

* fix(decompile-all): plan read-ahead from the decision the export loop makes

The read-ahead window decided which functions would be requested from
journal history alone. A journaled write whose file was later deleted
is requested again, and file problems spend the caller's limit, so a
resume could prepare functions outside its limit while the ones it
requested got no preparation.

Each function is now decided once by the same check the loop uses. The
window keeps those decisions for the loop, counts every attempt against
the limit, and names only functions that will be decompiled.

* test(ghidra): cover payload-option omission and reused undefined-function bodies

* fix(decompile-all): start each read-ahead hint at the function that sends it

A function the window named first could send no decompile request, for
example when procedure_info classifies it as external, so the next
request sent a hint headed by that function. A provider reads the head
as the carrying request's own function, so the bridge could not keep
that request's window result and might decompile it again.

The request now takes the planned window from its own function on.

* feat(ghidra): set function signatures and define the types they use (#14859)

* feat(ghidra): set function signatures and define the types they use

annotate_native_function accepts an optional C prototype, applied with
USER_DEFINED source in the same transaction as the name and comments,
verified by readback and rolled back with them on refusal.
define_native_data_types stores caller-authored struct, union, enum and
typedef definitions atomically under /rea_caller_defined and refuses
existing names. inspect_native_data_type reports those types with source
caller-defined, and annotation readback reports the applied prototype
and its source.

Refs #14831

* feat(ghidra): bound caller C text with launch controls and refuse unapplied constructs

The lengths of a signature and of type declarations and the nesting depth
of parentheses are launch-only REA_ controls with measured defaults, floors
and maxima, written into the bridge's session descriptor. A refusal names
the control, its effective value, source and range.

The bridge tokenizes caller C before Ghidra's parser sees it and refuses
what that parser accepts without applying: attributes, storage-class
specifiers, variable declarations, directives other than #pragma pack,
literals, function bodies, default arguments, unnamed enums and repeated
member names. A type name that names different types is refused.

When a function has no calling convention and the prototype names none,
the compiler specification's default convention, which Ghidra already uses
to assign the locked storage, is recorded, and annotation readback reports
the convention.

Refs #14831

* fix(ghidra): apply the signature bound to the caller's text

The bridge appended the semicolon its parser needs before checking the
length, so a prototype of exactly the admitted length was refused. The
readback prototype is documented as reusable only when its function and
type names are C identifiers.

Refs #14831

* chore(mcp): refresh advertised schema summaries for Ghidra type edits

Refs #14831

* fix(ghidra): bound caller C text per call and report dropped qualifiers

Ghidra's C parser cannot be cancelled, so REA bounds the text it parses.
The three launch-only environment controls left an agent that hit them
with a restart as its only recovery. The two length bounds are now
per-call parameters, signature_max_utf16 on annotate_native_function and
declarations_max_utf16 on define_native_data_types, with the same defaults
and measured maxima. A refusal reports details.limit with
control_kind "parameter" and required_value, the text's length, so the
generated recovery names the value to pass or asks for shorter text. The
text fields no longer carry a schema maximum, so every over-length
refusal is typed. Parenthesis nesting is a fixed ceiling of 8 levels,
registered as a representation bound, because each level doubles parse
time. The session descriptor no longer carries C parser limits, and the
config module, environment entries and restart-only registry rows are
removed.

const and volatile are still applied without effect, because Ghidra's
types have no representation for them. Both edits now return
dropped_qualifiers with each qualifier's line and column, and for a
signature its parameter index, null for the return type, instead of
dropping them silently.

* fix(ghidra): read caller C through one tokenizer and bound nesting per call

The C admission scan tracked lines only at LF and read directives as raw
lines matched by a regular expression, so a CR-only line break shifted
dropped-qualifier positions and a trailing comment on #pragma pack was
refused. One tokenizer now owns caller C positions, comments and literals:
CR, LF and CRLF each end a line as in Ghidra's parser, and directives are
admitted from its tokens, so comments read as whitespace there too. A block
comment that would carry a directive onto another line is refused.

Parenthesis nesting was a fixed ceiling justified by parse time, a resource
limit. It is now the per-call parenthesis_max_depth (default 8, range
1..12) on both type-edit tools. The bridge measures the deepest nesting
over the whole text and sends it, with a text's length, as the wire
failure's required_value, so details.limit reports the bridge's own
measurement instead of the adapter re-reading the request.

The tokenizer also decides whether a prototype is terminated, so the parser
sees the caller's text unchanged: no leading whitespace is stripped, and a
trailing line comment no longer swallows the appended terminator.

* fix(ghidra): parse caller C inside the edit's rollback and refuse parser diagnostics

Ghidra's C parser writes the type database even with storeDataType false:
a definition whose name matches an existing empty composite fills that
type in place, in the parser's own nested transaction. Both type edits
parsed before opening their transaction, so a refused definition, such as
one conflicting with a DWARF placeholder, left that placeholder filled.
Parsing, validation and storage now share the edit's one transaction, and
parseCallerC refuses to run outside one.

The parser also records diagnostics it cannot apply, such as a repeated
enumerator it drops, and still reports success. Both edits now refuse any
diagnostic with Ghidra's message, before anything is stored.

The real-Ghidra verifier gains a phase with an ELF object whose DWARF
declares an opaque struct, proving a refused definition leaves that empty
composite unchanged, and refuses a repeated enumerator.

* fix(ghidra): admit caller C from one audited table of tokens Ghidra drops

Review kept finding one more construct Ghidra's C parser consumes without
applying, because admission listed spellings piecemeal. The tokenizer now
owns one table, audited against every token and production of Ghidra
12.2's C.jj and checked on Ghidra 12.2, in that grammar's own spellings:

- Refused, because meaning is lost: __ptr32 and __ptr64 (stored as a
  native-width pointer), __near and __far, every attribute, declspec,
  __readableTo, alignas, packed and asm spelling, [[...]] attributes,
  storage and inline specifiers including __forceinline, __pragma and
  _Pragma, _Static_assert, Objective-C @ blocks (Ghidra skips their whole
  text), and backslashes.
- Reported in dropped_qualifiers as pure qualifiers: every const and
  volatile spelling, restrict, __unaligned and __w64.

#pragma pack is admitted only in the operand forms Ghidra applies as
written with a decimal value; (0x1), (010), (show) and (pop, n) were
ignored or read differently, and "# pragma" is a line marker Ghidra
skips. An enum tag that neither the text nor the database defines made
Ghidra invent an empty enum without a diagnostic; declarations now refuse
it as they do an invented struct or union. Identifiers admit $, as C.jj's
do, and the tokenizer reads numbers and [[ as single tokens.

* fix(ghidra): bound caller type depth, admit only constant expressions Ghidra evaluates, refuse unmatched pack pops

Recursion: the tokenizer's [[ lookahead re-entered next() for each "[",
and the dependency walk recursed per pointer, array and member level.
Both are iterative now. Ghidra 12.2's own data-type code recurses too:
1024 pointer or array levels resolve, 2048 exhaust the stack inside
addDataType while its database lock is held, leaving the Program unable
to save. Every parsed type's chain through pointers, arrays, typedefs and
members, including existing database types, is now measured iteratively
and refused beyond a fixed 256-level ceiling before Ghidra walks it. An
unexpected StackOverflowError ends the session with a reason instead of
being caught by the parser call, since Ghidra's lock may then be held.

Constant expressions: Ghidra leaves names, casts, sizeof, floating and
binary literals unevaluated and substitutes a default, so
"MASK = FIRST << 4" was stored as 2, and it truncates values outside int.
Enum values, array sizes and bit-field widths are admitted only as integer
literals with arithmetic, shift, comparison, bitwise and logical
operators, checked iteratively with C's rules to stay in int, including
implicit enumerator values; anything else is refused at its position.

Pragma pack: Ghidra ignores a bare (push), a pop with nothing pushed keeps
the current packing, and a plain pop pops past labelled entries. The
tokenizer tracks admitted pushes and admits a pop only when Ghidra's
result matches C's.

* fix(ghidra): admit constant expressions only as one literal, skip absent pointer targets, state the type-depth recovery truthfully

Constant expressions: emulating C against Ghidra's own evaluator is an
open-ended class of mismatches (comparisons, unsigned arithmetic such as
~0U >> 1 giving -1, names, casts, truncation). The evaluator is removed.
Enum values, array sizes and bit-field widths are admitted only as one
decimal or hex integer literal within int, optionally negated, without
suffixes; anything else is refused at the first token that leaves that
form, and the refusal says to write the computed value. Implicit
enumerator values are still checked against int.

Dependency walk: Ghidra's generic pointer has a null pointed-to type, and
pushing it onto the ArrayDeque threw. Both the dependency and depth walks
now take children from one cTypeChildren and skip an absent child.

Type depth: the depth is measured over the whole chain before comparing it
with the limit, so the refusal reports the depth it used, and it names
the type from the parser's table rather than walking the type for a name.
The recovery no longer suggests splitting into named types, which cannot
help because depth counts through typedefs and existing types; it says
only fewer nested levels do.

* refactor(ghidra): refuse parentheses in definitions and keep parenthesis_max_depth on signatures only

Under the literal-only rule for constant expressions, every parenthesis in
a define_native_data_types text already ended in a refusal (function
declarators, attributes, casts, sizeof, or a Ghidra diagnostic for a
grouped declarator), so parenthesis_max_depth changed only which refusal
a caller saw. A definition now refuses its first parenthesis at its
position, and the parameter is removed from that tool's schema; it stays
on annotate_native_function, whose prototype has a parameter list.

* fix(ghidra): refuse distinct types that share one parser name

Ghidra keeps struct tags, enum tags and typedefs in separate maps.
Combining those maps dropped a typedef such as typedef int item when
struct item was also defined, and the call still succeeded. Overlapping
names are stored only when the definitions are equivalent, which keeps
typedef struct s { ... } s as one struct. Any other overlap is refused
with conflicting_type_definitions before the transaction stores anything.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(ghidra): roll back a composite the parser fills in place

Ghidra's parser replaces an empty composite during parsing and returns
that same object. A later same-path check would store the fill as
unchanged. Record those empty composites before parsing and refuse if
parsing fills one, so the open transaction restores them. A different
layout of a non-empty caller type still conflicts and leaves the stored
type in place.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(ghidra): close line comments at EOF and refuse overflowing pack values

Ghidra's // skip token requires a line break, so a comment at the end of
declarations or of an already-terminated signature was rejected. A newline
is appended whenever the text ends in a line comment, before any semicolon
added for an unterminated prototype.

Integer.parseInt drops a pack operand outside a Java int and leaves the
previous packing, so #pragma pack(2147483648) stored a natural layout.
Decimal pack operands are admitted only when that parse succeeds.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* test(ghidra): assert the empty-composite refusal by code and readback

Defining a struct over the DWARF placeholder fills that empty composite
during parsing, so the refusal is data_type_conflict before the old
name-conflict message. The verifier checks that code and that the
placeholder still has no fields.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>

* chore(deps): update Knip to 6.47.0 (#14892)

* fix(ghidra): let sessions share a checkpointed target (#14856)

* fix(ghidra): report a held checkpoint lease as retryable contention

* fix(ghidra): let sessions share a checkpointed target

Sessions restore a checkpoint into private projects without a lease. The
socket lease is held only while one session publishes, and publication is a
compare-and-set on the source that session started from, so a later save is
refused instead of overwriting another session's edits.

Addresses #14834. Stacked on #14844.

* feat(ghidra): bound the checkpoint save wait with a launch control

REA_GHIDRA_CHECKPOINT_SAVE_WAIT_MS replaces the fixed 30 s wait for another
session's checkpoint publication. Default 30000 ms, floor 50 ms (one lease
poll), maximum 600000 ms.

The value is parsed when REA starts and fixed for a session when its
checkpoint owner is constructed. It is a restart-only launch control in
the numeric limit registry, not a runtime analysis setting, so the MCP
tool catalog is unchanged.

The busy refusal names the control, the applied value, its source and the
range, and binds them as an environment limit. An invalid value is
reported by doctor and registration validation and refuses only a
checkpointed Ghidra session.

* fix(ghidra): keep checkpoint save waits and refusals accurate

- Poll again when a lease probe races the owner's release or another
  waiter's stale-socket recovery instead of failing the save with
  configuration_invalid.
- Release the publication lease even when a staging or superseded file
  removal fails, so a retained cleanup does not block other saves.
- Report an initial analysis overtaken by another session's edits as a
  superseded restore (reopen) rather than as refused edits.
- Carry the save-wait details.limit onto a busy close_binary, through
  AnalysisClientCreation, and document the close-time shape.

* fix(ghidra): report discarded checkpoint edits and end a forced close's save wait

A session whose checkpoint save was refused because another session
published first releases its edits on the next close_binary. That close
now reports it: the result carries checkpoint {status: "discarded",
reason: "superseded", directory}, alongside the snapshot receipt when
snapshot_path was given. Only the close that releases the Program reports
it, so a failed cleanup keeps the refusal and its retry reports instead.
AnalysisClient.close returns an optional EngineCloseReport that the
composite client, BinarySession close and closeWithSnapshot carry to the
close_binary contract; an ordinary close keeps result null.

A graceful close's final save did not observe a forced stop while it
waited for another session's publication lease, so a cancelled request
escalating the close could block for the whole save wait (up to ten
minutes). The escalation now aborts that wait. The abort covers only the
lease wait, the save's cancellation cutoff; once the lease is held the
bounded publication completes, so a committed save is never reported as
failed.

The busy refusal's recovery and the installation guide now state that
REA_GHIDRA_CHECKPOINT_SAVE_WAIT_MS cannot make an MCP client wait longer:
that client's request deadline is separate and unknown to REA. The
refusal keeps its environment details.limit.

* fix(ghidra): tell a contention retry to reopen once the owner saved edits

A session that waited for a checkpoint lease keeps the generation it selected,
so after the owner saves Program edits and closes, repeating the call cannot
succeed. Report that outcome as a typed superseded failure with reopen
recovery instead of a checkpoint-directory configuration error, and say so in
the busy recovery.

* fix(ghidra): report both failures when checkpoint file removal and lease release fail

retryCleanup rethrew a lease release failure before the saved removal
failure became part of the error, so callers saw only the lease. A release
failure alongside a removal failure is now reported with it: one
ProviderCleanupError names both reasons, keeps the pending files and the
retained lease as cleanup resources, and carries both causes. A lone release
failure keeps its own error.

* fix(ghidra): keep close facts and launch causes through composed failures

Completed close facts were dropped wherever a later failure was composed.
A released engine's discard report and a saved snapshot receipt are now
carried by one owner, retainCloseOutcome, which every close composition
calls on its outermost error with the outcomes it composed: the composite
client when a sibling fails after a child released its edits, the session
when file, candidate or bundle cleanup fails after the provider closed, the
process-capture close wrapper, and the Ghidra client when cleanup fails
after its JVM stopped. The report rides the failure as
partial_observation.checkpoint and is not repeated by the retry. This
replaces retainSavedAnalysisSnapshot and the close wrapper's snapshot
extractor.

Only close_binary reports edits released unsaved, so open_binary of another
target, opening app resources, reset_investigation and external mutations
now refuse with capability_unavailable while a client reports them through
the new AnalysisClient.unsavedCloseReport, instead of releasing them
silently.

A launch failure was replaced by a superseded-restore error whenever
another session had saved meanwhile. The launcher now records whether the
failure happened while restoring the checkpoint, and only that failure is
explained as superseded; any other keeps its cause, output and diagnostics.

The busy recovery now says that a repeated call can report a superseded
checkpoint when the other session's save changed it.

* fix(ghidra): deliver the discard report through GhidraProvider and keep refusals typed

GhidraProvider wraps its client in DeferredAnalysisClient, whose
AnalysisClientCreation released the client through a cleanup lease and
returned ok(null), so the real close_binary path dropped the discard
report. The lease entry now keeps the releasing close's report and hands it
to one release outcome; a failed release, a failed inspection cleanup and a
retained creation failure carry it through retainCloseOutcome. The
GhidraProvider client does the same when native AOT cleanup also fails. A
boundary test drives close_binary through GhidraProvider.

A forced close could still publish when its stop arrived while the lease
was being acquired. Acquiring the lease is now the cancellation cutoff:
publish checks the lease signal right after it and stops, and cleanup
releases the lease.

A refused save whose cleanup also failed was wrapped into a generic
adapter error, so the client missed the refusal and kept the staged file
for another impossible save. The checkpoint now keeps its typed refusal
primary and unwrapped, carrying the cleanup failure on it; the client
records the discard and reports the cleanup failure in diagnostics.

* fix(ghidra): report released edits only for refused saves and keep startup cleanup failures

A superseded initial analysis (stage restore) set the same refused-save flag
as a refused edit, so its stopped JVM became a released-unsaved report: the
session claimed discarded edits it never had, and open_binary refused the
reopen its own error asked for. The refusal now states whether it refused
edits (GhidraCheckpointSupersededError.refusesEdits, true only for a save),
and the client records a discard only from that fact. Any refusal still
discards its staged file.

The cleanup failure a checkpoint refusal carries was read at close but not
by the startup session failure factory. Ghidra lifecycle errors that carry a
cleanup failure are now recognized by one guard, isGhidraCleanupCarrier,
used by bindGhidraSessionFailure and the close error alike; the close
diagnostic is renamed carried_cleanup_failure since it covers every
carrier.

* refactor(views): reuse optional filters in report projections (#14877)

* refactor(views): centralize indexed row paging (#14878)

* fix(tar): require both end-of-archive blocks for complete coverage (#14884)

* fix(tar): require both end-of-archive blocks for complete coverage

* docs(tar): explain complete and incomplete end markers

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(artifacts): report incomplete Android sparse coverage (#14883)

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(artifacts): keep uImage coverage unknown when bytes follow the declared payload (#14896)

U-Boot does not pad a legacy image, so bytes after the 64-byte header and
the declared payload belong to no entry. The reader reported complete
coverage for them, which hid a root filesystem appended after a kernel.
Report unknown coverage with the length and starting offset of those bytes.

Fixes #14893

Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>

* fix(nuget): preserve explicitly spaced publisher metadata (#14906)

* perf(ci): skip unused test runtime uploads (#14903)

* refactor(setup): share publication destination checks (#14904)

* feat(ghidra): define function-pointer members and typedefs (#14889)

* feat(ghidra): define function-pointer members and typedefs

define_native_data_types refused every parenthesis in a definition, so
vtables, ops tables and callback structs could not be defined.

Admit ret (*name)(parameters) as a struct or union member or a typedef,
with (**name), (*name[N]) and a calling convention written before the
parenthesis. Ghidra 12.2 stores these as written. The tokenizer still
refuses, at its position, every form Ghidra stores differently: an empty
parameter list (stored as (void)), a calling convention inside the
parenthesis, _Noreturn, a nested function-pointer parameter, grouped
declarators and function types. A parameter Ghidra leaves untyped, such
as a K&R identifier list, is refused after parsing.

Ghidra names these function types by a per-parse counter, which would
collide across calls. Each is stored in /rea_caller_defined as
owner.member, or typedef.target, so a repeat is idempotent and a changed
prototype is refused. Arrays keep the element name they were built with,
so arrays of function pointers are rebuilt around the renamed type.

inspect_native_data_type reports a function type with kind function and
its function_definition: return type, parameters, varargs and calling
convention.

Refs #14887

* fix(ghidra): share caller parameter checks and bound prototype readback

Review of #14889:

- A function pointer after a comma, as in int (*open)(int), (*close)(int);
  or typedef int (*a)(int), (*b)(int);, was refused because its
  parenthesis followed ",". Ghidra 12.2 stores each declarator with the
  shared return type and calling convention, so the declarator check now
  admits "," before the parenthesis.
- A signature and a function-pointer member or typedef checked their
  parameter lists separately, so a function pointer accepted a repeated
  parameter name. requireCallerParameters is now the one check for both:
  repeated names, and a parameter written as a bare name that is not a
  type (a K&R identifier list), which Ghidra stores as undefined. The
  tokenizer records which identifiers fill a whole parameter slot, so an
  explicit undefined parameter type is not mistaken for one. This also
  refuses a K&R signature, which was previously applied with undefined
  parameters.
- inspect_native_data_type serialized every parameter of a function type
  without a bound or cancellation check. It now uses the same 20000-entry
  bound as fields and enum members, checks cancellation per parameter,
  and reports total_parameters and parameters_truncated.

Refs #14887

* refactor(desktop): share XML parent pointers in task drafts (#14905)

* refactor(views): share bounded parent and report limitations (#14902)

* fix(macho)!: select arm64e.x1 slices of universal Mach-O files by exact subtype (#14881)

* fix(macho): select arm64e.x1 slices of universal Mach-O files by exact subtype

macOS 27 system binaries such as /bin/ls and /usr/bin/codesign hold
x86_64, arm64e and arm64e.x1 slices. The caller's architecture selector
counted arm64e.x1 as arm64e and had no value of its own for it, so
inspect_native_initializers, inspect_go_binary, inspect_rust_binary and
inspect_dwarf_units refused arm64e as matching several slices and
rejected arm64e.x1 as an argument. Neither arm64e slice could be read.

Name each arm64e subtype exactly, as lipo -thin and otool -arch do:
arm64e reads only the arm64e slice and the new arm64e.x1 value only the
arm64e.x1 slice. arm64 keeps reading its family's only slice. A refusal
and the unread-slice limitation now offer arm64e.x1 where it selects one.

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

* fix(macho): record the advertised schemas that accept arm64e.x1

The architecture enum of inspect_native_initializers, inspect_go_binary,
inspect_rust_binary and inspect_dwarf_units gained arm64e.x1, which
changes their advertised input schemas. Commit the regenerated summaries
so verify-advertised-schemas matches the catalog.

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

* fix(macho): check the selected DWARF slice subtype and document arm64e.x1

inspect_dwarf_units accepted a report whose CPU family matched the
request, so an arm64e or arm64e.x1 request answered by the other arm64e
slice still produced Evidence. Validate the report's selected_slice with
machoSelectionAnswersArchitecture, as the initializer, Go and Rust
readers do.

The tool's architecture field, its CLI option and dwarf-units.md still
described a CPU family and listed only x86, x86_64, arm and arm64. Name
arm64e and arm64e.x1 and their exact-subtype rule there as well.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* feat(gpu)!: add per-call object, work, report, metadata, structure, and parser budgets to inspect_gpu_code_objects (#14882)

* feat(gpu)!: add per-call object, work, report, metadata, structure, and parser budgets to inspect_gpu_code_objects

Replace the pending GPU object and parser ceilings in GpuCodeObjectsProvider
with domain-owned optional per-call parameters (max_object_bytes, max_work_bytes,
max_report_bytes, max_metadata_bytes, max_structure_bytes, max_parser_entries,
max_parser_visits, and max_token_bytes) reporting details.limit and
adjustable_budget, remove superseded hardcoded constants, and register only the
recursive container and AMDGPU MessagePack nesting caps as a fixed
representation allowance.

BREAKING CHANGE: inspect_gpu_code_objects adds optional per-call budget
parameters and reports details.limit with details.refusal.kind
"adjustable_budget" instead of "fixed_ceiling" on top-level object, work,
report, metadata, structure, and parser budget refusals.

* fix(gpu): clamp padding scans, classify multi-frame CCOB budget cuts, and keep max_work_bytes at 512 MiB

* fix(gpu): align --max-work-bytes help text, release partial decode before refill, and admit floats under small token budgets

* test(gpu): keep multi-frame CCOB v1 decoded size within cut budgets

* fix(gpu): report decoder inputExhausted to refill and bound trailing Zstandard frames

* fix(gpu): peek next Zstd frame, charge AMD structure reads to work budget, and keep 128-token PTX limit

* fix(gpu): fix CCOB refill work double-charge, meter section reads, decouple non-GPU recognition, and align frame/recovery bounds

* refactor(gpu): drop redundant lookahead on non-refill path and pin refill/readBounded regressions

* fix(gpu): keep standalone PTX peak heap at 1x, use explicit scan reads, forward CUDA cancel signal, and report max_report_bytes required_value

* fix(gpu): report lower-bound report bytes in reported_limits and enforce max_token_bytes on recognized PTX headers

* fix(iso9660): read Joliet trees whose .. records name their own directory (#14817)

* fix(iso9660): read Joliet trees whose .. records name their own directory

libisofs, behind xorriso and its mkisofs emulation, writes every Joliet
subdirectory's .. record with that directory's own extent and length:
write_one_dir_record() reads the block and length before it switches to
the parent node. The reader required .. to name the parent and refused the
whole image, so a Joliet ISO from xorriso -J, such as the Alpine 3.21
release ISOs, could be neither inspected nor extracted.

A Joliet tree now also accepts a .. record that describes the directory
itself. The primary tree keeps the strict check.

* test(iso9660): check a self-describing Joliet .. against its own lengths

The reader test gives every directory the same data length and no
extended attribute record, so it would still pass if the relaxed check
compared those fields with the parent's. The parent link here differs in
both, and a self-describing .. carrying the parent's data length or
extended attribute length is rejected.

* fix(cli): describe universal Mach-O slice selection without a single-dash flag (#14912)

* fix(cli): describe universal Mach-O slice selection without a single-dash flag

Four --architecture options carried their own copy of the slice help,
in two variants, and each said "as lipo -thin does". CLI help must not
show a multi-letter single-dash spelling, because -abc parses as stacked
one-letter flags, so tests/boundary/cli/cliOptionAliases.test.ts fails
on main for inspect-dwarf-units, inspect-go-binary,
inspect-native-initializers and inspect-rust-binary.

The commands share one description, UNIVERSAL_SLICE_ARCHITECTURE_HELP,
which names lipo without the flag spelling. inspect-dwarf-units now
states the same-family subtype rule the other three already stated; its
selection uses the same selectMachoTarget rule.

* docs(cli): name the slice selection owner in the shared help comment

* feat(artifacts): decode UnityFS LZMA blocks (#14699)

* feat(artifacts): decode UnityFS LZMA blocks

Unity's default AssetBundle compression (type 1) left members as
hash_status unavailable. Decode 5-byte Unity LZMA streams with the
existing lzma-purejs dependency so inventory can hash and extract them.

* fix(compression): read Unity LZMA dictionary via BinaryReader

Architecture guards forbid raw Buffer numeric reads outside
binaryContainer; match the UEFI LZMA path.

* style(compression): format UnityFS LZMA helper

* fix(compression): make UnityFS LZMA cancelable and end-marker safe

Accept optional LZMA end markers without trailing junk, decode off-thread so
timer aborts land, return one expected-sized buffer, and mark xinzexi unverified.

* fix(compression): await Unity LZMA worker exit and transfer alone buffer

Await worker.terminate() before settling abort/reply paths, and allocate the
synthesized alone header with allocUnsafeSlow so the worker receives it without
a second encoded-stream copy.

* chore: retrigger CI after Greptile worker-exit follow-up

* test(compression): clarify Unity LZMA cancellation case title

Retriggers Actions after the worker-exit follow-up push did not receive a
GitHub Actions check suite.

* fix(unityfs): keep the directory for over-budget LZMA blocks and decode spec-valid streams

UnityFS writers emit one LZMA block for a whole data stream, so the per-block
decode budget refused the whole inventory of any LZMA bundle above 64 MiB,
where before this change the directory was retained. An over-budget block now
keeps the directory and only members inside it report an unavailable read
naming the budget, for LZ4 and LZMA alike.

The LZMA decoder window is bounded by the declared output instead of the
declared dictionary, so a large dictionary on a small block decodes and no
longer allocates a dictionary-sized window. Properties follow the LZMA
specification (lc 0-8, lp 0-4, pb 0-4) rather than the LZMA2 lc + lp limit.
Worker error events and exits without a reply stay runtime failures instead of
being reported as a malformed block.

Tests decode a liblzma-produced stream as a known answer, settle only after
the worker exits on completion and cancellation, and share one encoder.

* fix(artifacts): report Unity LZMA size mismatch as malformed

Overflow past the bundle's declared length is a format error, not a
decoder budget exhaustion. Declarations above maximumBytes still fail
closed as a resource limit before decode starts.

* fix(unityfs): name the encoded or decoded bound that refused a block

A block refused by its encoded size reported its decoded size against the decoded budget. The block now records which bound refused it, and the member read names that bound, its declared size and the budget.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(linux): decode utmp, wtmp and btmp login-accounting records (#11853)

* feat(linux): decode utmp, wtmp and btmp login-accounting records

Linux login-accounting files do not have one layout. glibc's `bits/utmp.h`
makes `ut_session` and `ut_tv` 32-bit under `__WORDSIZE_TIME64_COMPAT32` and
`long` without it, so an x86-64 record is 384 bytes and an aarch64 record is
400. The tail carries the session id, the timestamp and the address, so decoding
it under the wrong layout produces plausible but wrong values.

Publish the supported profiles with the header and macro each comes from, derive
the tail offsets from the profile's own widths, and decode one file under an
explicitly stated profile. Record length narrows the layout but never names the
byte order, and a length that is a multiple of every layout narrows nothing, so
an ambiguous file is reported and refused rather than guessed.

Records decode independently, so a truncated tail or an unknown `ut_type` keeps
the records before it inspectable. Fixed-width strings decode through
`strictUtf8`, and any field without a terminator or valid UTF-8 is named.

Reads go through `BinaryReader`, so bounds and truncation use the shared parser
algebra.

Verified by `src/domain/linux/utmp.test.ts` (11 tests): both layouts, profile
selection and ambiguity, truncated tails, unknown types, unterminated fields and
empty files. `tsc --noEmit`, `oxlint`, `oxfmt --check`, the architecture guards
and the module-boundary check all pass.

Not verified: the layouts are derived from glibc's headers, not from a captured
host file. No real `wtmp` from either ABI was decoded, no Android (bionic)
profile is claimed, and there is no CLI or MCP surface yet.

* feat(linux): model musl's session padding and unsigned address separately

The first version named the profiles after an architecture, which conflated two
different families that produce the same 400-byte record: glibc without
`__WORDSIZE_TIME64_COMPAT32`, where `ut_session` is `long`, and musl's
`struct utmpx`, where it is `int` followed by `__ut_pad2`. Reading musl bytes as
the glibc layout folds that padding into the session id's high half.

musl also declares `ut_addr_v6` as `unsigned`, and on a big-endian host it puts
`__ut_pad2` before `ut_session` so the pair stays in host order, which moves
every later offset by four bytes.

Profiles are now named after the layout they describe, carry the padding side and
the address signedness, and the tail offsets are derived from those facts.
`utmpFieldLayout` computes musl's big-endian session offset as 340 against 336
for both little-endian families, and the new test asserts that difference.

`docs/specs/linux/utmp-login-accounting/spec.md` gains the per-profile offset
table and the reason 400 bytes alone does not identify a layout.

Verified by `src/domain/linux/utmp.test.ts` (15 tests): the five profiles, the
padding side difference, an unsigned address word, the two 400-byte families
disagreeing on which bytes are the session id, and every diagnostic from the
first commit. `tsc --noEmit`, `oxlint`, `oxfmt --check` and the architecture
guards pass.

Not verified: still no real captured file, and the 32-bit musl layout is not
published because no capture has confirmed its size.

* test(linux): re-derive each advertised utmp record size from its own offsets

The five profiles publish a record length and a set of offsets that must agree:
the head, the tail and `__glibc_reserved[20]`, padded to the 8-byte alignment
`struct timeval` forces. A profile whose stated size drifted from its arithmetic
would decode every record after the first at the wrong offset, so the test
recomputes the size instead of trusting the constant.

Also records in the spec that `utmp(5)` documents the glibc split with its own
macro spelling, so the two glibc shapes rest on two independent sources rather
than one header.

Verified: 16 tests pass, including the new invariant over all five profiles.

* fix(linux): address the review findings on utmp record decoding

Six findings, all valid:

- **Invalid UTF-8 aborted the file.** `decodeFixedWidth` called the fatal decoder
  after `isStrictUtf8` said the bytes were malformed, so one bad byte threw out of
  the declared `Result` and discarded the records decoded before it. The readable
  prefix is now kept and the field is named; nothing throws.
- **A full-width field was called malformed.** glibc marks these members
  `__attribute_nonstring__`, and a four-byte `ut_id` commonly fills its width, so
  a valid full-width sequence is now decoded evidence.
- **Signed fields were widened before sign-extension.** `ut_type` and the exit
  status passed 32 bits for a 16-bit field, so `0xffff` read as 65535, and
  `tv_sec` skipped sign conversion entirely. Every field is now sign-extended at
  its declared width, and `tv_sec` stays negative for pre-epoch timestamps.
- **Length could select a layout that a truncation explains.** A 400-byte record
  truncated to 384 left only the x86 profile, which then decoded the session and
  timestamp at the wrong offsets. Because this parser accepts truncated tails, a
  length never proves the ABI, so `parseUtmpFile` now requires a stated profile and
  reports `ambiguous_format` with the candidates when none is given.
- **Retention was unbounded.** `maxRecords` (default 10 000) caps the records one
  call materializes and reports `record_budget_exceeded` with the count omitted.
- **Fixtures could agree with a wrong layout.** The published offsets are now
  pinned by a literal-offset fixture that does not call the layout helper.

`docs/specs/linux/utmp-login-accounting/spec.md` records the signed widths, the
nonstring rule, the required profile and the record budget.

Verified: 22 tests pass, including one per finding. `tsc --noEmit`, `oxlint`
(0 errors) and the architecture guards pass.

* test(linux): prove the two 400-byte families disagree on the session field

The comparison wrote a musl record with zero padding, so both profiles returned
the same session id and the test could not show why the profile must be stated.
It now sets the padding to a non-zero value and asserts the divergence: glibc
reads bytes 336..344 as one 64-bit session id and returns `2^32 + 4711`, musl
reads the 4-byte session and returns `4711`.

Adds a literal-offset fixture for the musl layout as well, pinning session at 336,
seconds at 344, microseconds at 352 and an unsigned address word at 360 without
calling `utmpFieldLayout`, so a wrong derivation cannot move the fixture with it.

Corrects the spec paragraph that contradicted its own table: both 400-byte
families hold 64-bit seconds at 344 and microseconds at 352, so the timestamps
agree; the differences are the session width, the padding side and the address
signedness.

Verified: 23 tests pass, `tsc --noEmit`, `oxlint` (0 errors) and the architecture
guards pass.

* fix(linux): keep every utmp layout a candidate for a truncated tail

* fix(linux): reject an impossible record budget and report inexact 64-bit fields

* fix(linux): validate utmp options before the file decides the verdict

* feat(linux): publish the big-endian glibc 32-bit-time utmp layout

* docs(linux): state which utmp fields report an undecoded field

* fix(linux): keep an undecoded utmp field distinguishable from its prefix

* perf(linux): encode an undecoded utmp field only when it is malformed

* fix(linux): decode a truncated utmp tail that still holds every modeled field

* docs(linux): correct the utmp module and record contracts

* docs(linux): stop the slice-1 task from re-marking terminated fields

* docs(linux): record the partial-trailing-record task

* feat(linux): name the members a truncated utmp record still holds

* fix(linux): end utmp coverage at the last declared member

* fix(linux): keep every whole utmp member of a truncated tail

- Describe struct utmp once as a member table (`utmpMembers`) derived from
  the profile layout. Decoding, coverage and the tail rule all read it, so
  the separate modeled, identifying and reserved extents are gone.
- A truncated tail is a record as soon as it holds ut_type whole. Every
  member it holds is decoded and every other one is null and named in
  `coverage.missing`, so a tail cut before the timestamps keeps its type,
  pid, strings, exit status and session instead of being dropped.
- Freeze the published profiles and their list, so a caller mutating
  `result.profile` or an exported profile cannot change later parses.
- Remove docs/specs for this feature: the repository now keeps specs,
  plans and task lists in issue or pull request discussions, not in Git.

---------

Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(artifacts): recognize Zip64 archives after leading bytes (#14105)

* feat(artifacts): recognize Zip64 archives after leading bytes

* test(artifacts): pin the unadjusted Zip64 extensible-sector refusal

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(uefi): read TianoCore EDK2 NVRAM variable stores (#14701)

* feat(uefi): read TianoCore EDK2 NVRAM variable stores

Add read-only parsing of gEfiVariableGuid /
gEfiAuthenticatedVariableGuid VARIABLE_STORE_HEADER regions to
inspect_uefi_nvram via additive edk2_stores, preserving the AMI NVAR
stores contract and reporting added vs superseded variable states.

* fix(uefi): harden EDK2 NVRAM scan coverage and accounting

Occupy store ranges and charge decoded names before retention, keep
truncated and damaged-name facts, examine unread tails, and compose
empty-format diagnostics from scanner facts with a provider-level test.

* fix(uefi): preserve enclosing EDK2 stores and scan erased ranges in blocks

Walk store GUID candidates in ascending offset order, claim only verified
spans so damaged oversized headers cannot hide later stores, and checkpoint
erased suffixes per 64 KiB block.

* fix(uefi): keep unusable EDK2 store signatures from reading as absence

A gEfiVariableGuid or gEfiAuthenticatedVariableGuid match whose header
lacks the formatted marker was skipped silently, so an image holding only
such a header reported that no EDK2 store exists. It is now reported as a
rejected signature, and the absence statement is qualified.

A formatted store that is not HEALTHY is walked with EDK2's verdict as a
caveat: EDK2 treats it as invalid, while UEFITool still parses it. A store at
an unaligned image offset states the HEADER_ALIGN assumption.

An in-use EDK2 fault-tolerant-write queue is noted, because REA does not
replay FTW writes or rebuild a store from the spare area.

AMI NVAR and EDK2 scans now share one structural record budget, as the
limit documents. GUID signature encoding moves to UefiGuid beside its
decoder, header field offsets are named after VariableFormat.h, the
limitation-line cap is a named limit, and the store walk is split from
header admission with unreachable branches removed.

* fix(uefi): distinguish unchecked EDK2 stores from absence

Carry an explicit completed-search absence fact from the EDK2 scanner.
Partial or budget-stopped searches report that presence is unknown
instead of claiming no store exists.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(artifacts): inventory auditd logs offline (#12062)

* feat(artifacts): inventory auditd logs offline (#11345)

An acquired Linux audit.log can only be read today with ausearch or
aureport, which means letting a host tool interpret the file. Add a
read-only inventory that joins records on the full audit event identity:
timestamp seconds, milliseconds and serial, never the serial alone,
because auditd reuses serials across boots and on wraparound.

The first increment reports line, record and event totals, per-type
counts, the malformed line count with a bounded sample, and the duplicate,
out-of-order and interleaved records it found, with a bounded window of
events whose totals still cover the whole file. Record bodies are not
decoded yet: key-value fields, hex and escaped values, argument ordering
and decoded syscall or permission meanings are named as limitations, and
the reader treats the log as neither complete nor authentic.

An auditd log declares no members, so the inventory is attached to the
root occurrence and open() refuses every entry.

Verified: npm run check:fast (typecheck, lint, architecture guards) and
npm run docs:check pass; 89 tests across the new reader test, format
descriptors, target-format vocabularies, recognition, graph, snapshot and
subject suites pass. No built or packaged CLI/MCP workflow was run.

* style(auditd): format the auditd reader and its test

format:check failed on src/domain/linux/auditdLog.ts and its reader test in CI; applying oxfmt is the whole change.

* fix(auditd): key repeated records on the PATH item index

Repeated types were joined on items=, which is the path count on a SYSCALL record, not a per-record index. Every PATH record of a multi-path event therefore shared one key: the second path was reported as a duplicate and the per-event PATH count came out as one. Use item= instead, and cover a two-path event.

* fix(auditd): join events per host and bound retained state

Address the review on #12062:

- Include the node= prefix in the event join key. Timestamp plus serial is
  only unique within one host, so a centralized log merged records from
  different hosts into one event. The reported event_id carries the node.
- Bound retained event state to a window. Duplicate and interleaving
  detection kept every PendingEvent for the whole file; records past the
  window are counted in the totals and a limitation says their status is
  not established.
- Pad the reported event timestamp millis to three digits so
  audit(1700000000.005:12) no longer reads as 500 ms, while still joining a
  padded record to an unpadded peer (via the numeric key).
- Detect duplicates per record content instead of record type plus item=,
  so split EXECVE continuations are counted, not called duplicates.
- Re-check cancellation after the coverage callback resolves, so an abort
  during the final await reports cancelled rather than success.
- Account for bytes dropped after a line overflows, so EOF trailing_bytes
  covers the whole tail.
- Drop docs/specs/linux/auditd-log/, which conflicts with AGENTS.md.

* style(auditd): wrap the retained-window guard to the repo width

oxfmt --check failed on this line after 053151eaf: the guard exceeds the
80-column print width, so Static checks never reached typecheck or lint.

* fix(auditd): count interleaved events past the display sample

interleaved_event_count scanned #sampleOrder, which holds only the first
AUDITD_INLINE_EVENT_LIMIT (32) events. An event whose resumption arrives
after the 32nd event was marked interleaved in the retained map but never
reached by the count, so a log of 34 events reported 0 interleaved where
one was actually interrupted. Every retained event is still tracked, so
this undercount had nothing to do with the retention window.

Count the transition once, where the flag is set, and read that counter in
the inventory. The per-event flag still drives the inline detail.

* fix(artifacts): keep an auditd log a resource, not an executable

The auditd-log descriptor inherited roleContainer: false from plain, and
artifactRoleForFormat falls through to "executable" for any format whose
bytes classify as neither file nor a container. Inspecting a text audit log
therefore reported and saved artifact_kind: executable.

Give the descriptor an explicit non-executable role and consult it before
that fallback. Only formats that declare a role are affected, so the other
descriptors keep their current kind.

* fix(auditd): keep event totals exact past the window and hash raw record bytes

Two review findings on the bounded-window rewrite were real:

- Past the 4096-event retention limit every record of an event that was not
  retained incremented the beyond-window tally, so a later event whose records
  are contiguous was counted once per record (4096 + SYSCALL/EXECVE/PATH
  reported 4099 events, not 4097). Only a record whose identity differs from
  the previous record can be shown to start an event there; counting just
  those keeps a contiguous tail exact, and an interleaved one a lower bound.
- Duplicate detection hashed the decoded body text, so two records differing
  only in bytes UTF-8 cannot represent both decoded to U+FFFD and were
  reported as byte-identical duplicates. Hash the line's raw bytes instead.

Since joins stop at the window, event_count and omitted_events can be lower
  bounds there; the metadata now says so with event_count_lower_bound and the
  limitation text reads "at least N further events".

* style(auditd): format auditdLog.ts to satisfy oxfmt

The static checks lane failed only on format:check: the chained
createHash(...).update(...).digest(...) call was wrapped over three lines,
which the repository formatter joins into one. Running the formatter
rewrites that single expression; no behaviour changes.

* fix(auditd): accept a line-separator character in a record body

RECORD_HEADER's body group used `.*`, and JavaScript's dot excludes U+000D, U+2028 and U+2029. A record whose opaque body carried one of them failed the header match, so the scanner dropped it (or, as the first line, failed auditd-log recognition outright) and reported a malformed header even though the header itself was valid. Body interpretation is out of scope for this inventory, so match it with [\s\S]* and keep the record.

* test(auditd): align auditd inventory and stable artifact suites with main

Merging main brought two contract changes these tests still asserted the old shape for: #14225 moved an invalid chunk size to an internal invariant violation and an impossible descriptor byte count to io, and #14189 added contentArchitecture to the classification role. The auditd role test added here predates the new field, so Source tests failed on contentArchitecture: null and shard 9 failed on the two stable-artifact reasons.

Assert the reasons and fields the producers now return so both lanes match the intended contract.

* fix(auditd): report the tail event total as an upper bound and bound record digests

The retained-window counter increments once per run of records that does not continue the previous identity, so an interleaved tail event (A, B, A) is counted once per run and the total is an upper bound, not a lower bound as the flag and limitation claimed. The flag is renamed to event_count_upper_bound and set only when a tail identity repeats, which is the case where the count can exceed the evidence.

Duplicate detection also kept one digest per distinct record body of a retained event until EOF, so a single event with a long run of records could grow without bound inside the admitted 4 GiB. Digests are now capped per event and records past the cap are counted but not checked, with a limitation naming duplicate_record_count as a lower bound.

* fix(auditd): name the type-sample omission and type the 4 GiB ceiling refusal

An event with more than 16 record types listed only 16 of them in its sample and said nothing about the rest, so a reader comparing record_types against record_count saw a silent loss. The inventory now carries a limitation naming how many sampled events were cut. The over-4-GiB refusal carried only a boundary, so CLI and MCP could not report it as a typed fixed ceiling; it now goes through artifactFixedLimitFailure with the 4 GiB allowance, registered as pending a control under #11345.

* fix(auditd): publish inventory metadata only after the source re-verifies

The final source read checks that the file did not change while it was decoded. Assigning #metadata and #limitations before that read meant a failed entries() still exposed an inventory through formatMetadata(), which is unvalidated Evidence rather than a refusal.

* test(auditd): feed the auditd role test through the classification probe

Static checks failed to typecheck this file on the PR: the new test built
ArtifactClassificationEvidence by hand as {prefix, asarHeader}, which predates
main's xmlPlistSignature, fatHeader and fatSliceHeadersByOffset members. Every
sibling assertion in the same file builds evidence with
createArtifactClassificationProbe(), so construct it the same way instead of
repeating the interface as a literal that breaks whenever the probe gains a
field.

* fix(auditd): raise a malformed log as a malformed target after the main merge

Main renamed the region decoder's format kind to malformed (#14265), so the auditd branch's `kind: "format"` no longer compiles. Keep the same behaviour through main's naming: the domain scanner reports `malformed`, and the reader turns it into `malformedArtifact` instead of building a bare `format` failure, matching DecodedRegionArtifactReader.

* fix(pe): accept auditd-log as a PE overlay leading format

The auditd-log recognizer was registered on main while this branch added
PE_OVERLAY_LEADING_FORMATS entries, so recognizeLeadingFormat's return
type no longer assigned to PeOverlayLeadingFormat and typecheck failed.
Recognizers can name auditd-log, so the overlay leading-format list has
to include it.

* fix(auditd): bound retained type state and carry type omissions

Two retained tables grew with the file rather than with the fixed budgets:
the whole-file per-type totals kept every distinct type= label a crafted
log named, and a single event kept one per distinct label it met. Both are
now capped, and records under a label past a cap are still counted in
record_count/line_count while the omitted labels are reported: the file
total names its omission in a limitation, and a sampled event carries
record_types_omitted next to record_types.

The tail event bound also now distinguishes an upper bound (a repeat while
other tail identities were held) from a lower bound (the single tail
identity repeated) and from no bound at all (an identity could not be
held), so event_count no longer claims a direction it cannot support.

* fix(auditd): judge ordering per node and keep header identity byte-faithful

Four review findings against the auditd inventory:
- Ordering compared every record against one global maximum, so a centralized
  log with two hosts reported normal mixed-node acquisitions as out of order.
  Track the greatest identity per node, bounded like the type table.
- Header bytes were decoded lossily, so two node/type values differing only in
  bytes UTF-8 cannot represent collapsed to the same U+FFFD and joined as one
  event. Decode each byte to its own code point so identity is preserved.
- The per-event type cap counted records rather than distinct labels, so two
  records of one 65th type reported two omitted labels and two affected events
  for a single event. Count distinct labels in a set.
- A tail run that reclaimed a retained identity still reported the total as an
  exact count or a lower bound. Any repeat inflates the total, so only the upper
  bound holds; event_count_lower_bound is now always false.
- The reader blamed the bytes before re-verifying the source, so a file that
  changed mid-read reported as malformed. Re-verify before translating.

* fix(auditd): bound omitted labels per event and report source text as written

The per-event set of labels named past the type cap grew with the file, so a
crafted log could retain millions of strings after the event and digest caps
were full. It is now bounded by AUDITD_RETAINED_OMITTED_TYPE_LIMIT; past it the
event reports record_types_omitted_exact: false and a limitation says the count
is a lower bound.

The byte-faithful header mapping kept identities apart but was also returned as
text, so a UTF-8 node, type or malformed-line excerpt such as hôte or échec was
reported as different characters. Lookup keys stay byte-faithful; reported text
is decoded as UTF-8, with a *_hex field carrying the raw bytes only when they
are not valid UTF-8. event_id percent-encodes the node bytes so distinct raw
nodes still never share an identity. Recognition now reads the first line
through the same decoding as the scanner.

* fix(auditd): decode long candidate prefixes in bounded chunks

Format recognition hands every candidate the whole leading buffer, and the
byte-faithful header mapping spread its code points into one
String.fromCodePoint call. A prefix of a few hundred kilobytes therefore
overflowed the call stack, so a large text member surfaced as an adapter
failure instead of a refused auditd claim. Nine ReleaseExposureReader
members with oversized text hit this.

Decode in fixed-size chunks so the argument list stays bounded; the mapping
is unchanged, and 4 MiB of prefix now answers instead of throwing.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(ghidra): admit recordless MIPS32 executables that declare o32 (#14423)

* fix(ghidra): admit recordless MIPS32 executables that declare o32

Use the o32 declaration in the ELF header when inspection confirms there is no separate ABI flags record. Keep floating-point storage unknown and reject declared-o32 MIPS-I, whose load delays need separate verification.

Signed-off-by: Deepak Jain <deepujain@gmail.com>

* fix(ghidra): keep an uninspected MIPS ABI flags record unknown in the declared-o32 lane

A declared-o32 MIPS32 executable whose ABI flags record was never inspected
was refused with the message for a record-bearing image, conflating unknown
with present. Report the uninspected case as unknown, and decide the session
floating-point limitation from the committed profile basis alone, since
admission to that basis already required an inspected absence.

* refactor(ghidra): name MIPS ELF header fields after the specification

The MIPS admission tested e_flags through raw literals in two modules, each
with its own copy of the EF_MIPS_ARCH values, and refused EF_MIPS_FP64 and
EF_MIPS_NAN2008 in two branches. One domain module now names every field as
binutils, glibc and LLVM define it, both consumers use it, and the shared
refusals run once before the recordless and declared branches.

The declared-o32 refusal cases now name the rule that rejects each one, so
a later rule cannot hide an earlier one that widened.

---------

Signed-off-by: Deepak Jain <deepujain@gmail.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* perf(ghidra): read ahead in the background and for batch_decompile (#14898)

* perf(ghidra): read ahead in the background and for batch_decompile

Read-ahead used to decompile a whole window before answering the request
that carried it, starting up to eight native decompiler processes one
after another (about 200 ms each). Small runs paid that startup before
their first result, so batch_decompile could not use it and a small
decompile-all was slower than a serial one.

The carrying request now decompiles its own function at once on the
session decompiler. The rest of the window is queued for REA's own
worker threads, started only for the queued work (none for a single
function, at most eight), and each opens its decompiler on its own
thread and takes the next queued function as soon as it is open. A
later request uses a finished result, including a failure or timeout,
without decompiling again; waits for a running one, which its own
earlier-started deadline bounds; or takes back a queued one and
decompiles it itself. Cancelling a request cancels the read-ahead; an
edit, a payload change or shutdown stops the workers, including those
still opening, and idle workers close after 30 seconds.

batch_decompile now names its next functions the same way, through the
window size shared with decompile-all on the analysis port.

Closes #14836

* fix(ghidra): redecompile read-ahead failures under a changed deadline

A read-ahead task keeps the decompile deadline it ran under, but its
lookup ignored it. After ghidra.decompile_timeout_seconds changed, a
later request reused a timeout produced under the old deadline, reported
the new limit in its message, and could wait without bound for work
started with no deadline.

The task lookup now decides reuse by the cache policy: a completed
decompilation is reusable under any deadline, as cached results are,
while a failure, a timeout or unfinished work under a different deadline
is cancelled and decompiled again under the request's own deadline. The
result cache needs no change: it holds only completed decompilations.

* fix(ghidra): bound finished read-ahead and cancel it with the workflow

Finished results were trimmed only when another hint arrived, so tasks that completed after the last hint stayed strongly held. Trim them when they finish too.

A cancelled export could also leave workers running after the carrying request had returned, because only an in-flight procedure_pseudo_code monitor disposed them. The same workflow signal now sends abandon_decompile_read_ahead for that gap.

The failure probe derives its worker count from the bridge cap, waits until a reused task has actually completed, and releases startup latches before disposal if a check fails.

* fix(ghidra): keep a read-ahead abort watch across unrelated requests

Every Program request called noteRequest, which dropped the owning signal whenever the next request used a different one. A list or journal gap could then leave the workers running after that owner cancelled.

Only a request that carries its own read-ahead window replaces the owner. The bridge has one worker pool, so that new window is the owner that a later abort disposes.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(ghidra): ignore an older read-ahead watch after a newer owner

A queued read-ahead took ownership before the carrying request settled, and that request's finally installed its watch again. Cancelling the older workflow then abandoned the newer window.

watch now leaves the newer owner in place.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(ghidra): admit read-ahead ownership and cap the queued backlog

A window with no signal left the previous abort listener armed, so that abort disposed the new workers. Ownership now moves when the request is admitted, including a signal-less window, and a request removed while queued does not move it. An abandon queued for an older generation is not written.

Queued tasks no worker has started are dropped with finished results beyond two windows. A decompile a worker has already started stays, and the worker cap bounds how many of those exist.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(ghidra): abandon read-ahead without waiting for the active request

The cleanup frame waited in the Program queue, so a slow analysis request held a cancelled workflow's workers. The reader now disposes those workers the way it applies cancel, and the client writes that frame beside the FIFO.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(ghidra): cancel read-ahead on the reader without waiting

abandon_decompile_read_ahead runs on the socket reader and was waiting up to 10s for workers. The cancel frame behind it then missed the 2s grace, and the client closed the session. A task already taken by the waiting request was also absent from the map, so that wait did not cancel it.

The reader now only cancels monitors, including taken tasks, and returns. The handler still waits for workers on edit, shutdown, and its own dispose.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(ghidra): stop the failure probe calling the removed abandon handler

The real-Ghidra probe invoked abandon_decompile_read_ahead through handleRequest. That method is only accepted on the socket reader now, so the probe threw method_unavailable before it could report success.

The probe now blocks the handler on a taken task, calls cancelDecompileAhead, and checks that the call returns inside a second and the waiting request is cancelled.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* style(ghidra): format the read-ahead client files

CI format:check rejected GhidraClient, GhidraReadAheadCancellation, and the request-queue test. The shard jobs never started because static checks failed first.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(ghidra): take read-ahead ownership after wire admission

A carrying request can leave the queue and still be refused when it
exceeds bridge.max_request_bytes. Ownership now moves only immediately
before the wire writes a frame that passed admission, so a refused hint
leaves the previous window's abort owner in place.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(uefi): decode LZMA sections through one shared LZMA1 owner (#14918)

* fix(uefi): decode LZMA sections through one shared LZMA1 owner

UEFI LZMA custom sections whose header declared a dictionary above 64 MiB
were refused as an output limit even when their output was tiny, because the
worker compared the dictionary with the output budget and handed it to
lzma-purejs, which allocates a window of that size. EDK II's one-call
LzmaDecode uses its output buffer as the dictionary, so a valid stream never
needs more window than its output.

src/compression/Lzma1.ts now owns LZMA1 for UEFI and UnityFS: the
LZMA-Alone header and LZMA1 property bounds (lc 0-8, lp 0-4, pb 0-4), the
range coder lead-in, a decoder window of max(4 KiB, min(dictionary, output
bound)), bounded output, and the verdict on a stream. Lzma1Header.ts reads the
header fields with BinaryReader at the host boundary. The UEFI worker keeps
its framing, x86 branch filter and reply protocol; a corrupt stream or invalid
properties are now reported as malformed rather than as a decoder fault. The
UnityFS worker thread loads the same module instead of an inline decoder.

Closes #14917

* fix(compression): leave LZMA1 host faults to their host

decodeLzma1Alone reported every exception from the codec as a malformed stream, so an allocation failure or codec defect inside the decoding host looked like corrupt input, and the codec's own verdict text was lost. Only lzma-purejs's verdict literals ("Error in data stream", "Incorrect stream properties") are now a malformed verdict; anything else is rethrown for the host to classify (UEFI reports it as a decoder fault, the UnityFS worker as a runtime failure).

* fix(deps): verify Brainpool publisher signatures with OpenPGP.js 6.3.3 (#14914)

* feat(artifacts): inventory Nintendo 64 ROM images and normalize byte order offline (#14911)

* feat(artifacts): inventory Nintendo 64 ROM images and normalize byte order offline

An n64-rom image is recognized from the first word in z64 (80 37 12 40),
v64 (37 80 40 12), or n64 (40 12 37 80) order plus a 4-byte-aligned boot
address in KSEG0 or KSEG1. The reader normalizes the cartridge header
and serves header.bin, ipl3.bin, and program.z64 in big-endian order,
swapping v64 and n64 bytes and recording that swap as decoded. It names
the IPL3/CIC variant from the CRC32 of bytes 0x40..0x1000 and, for a
known variant, recomputes the CRC pair over the 1 MiB window; a
mismatch, unknown CIC, short window, or non-zero reserved header bytes
leave coverage unknown, and a file above 64 MiB is refused before any
swap. Comparison ignores n64-rom and n64-rom-entry metadata so dump
order is not treated as a content change, and decoded members share the
idle-abort helper the Switch executable reader now calls.

* fix(n64): admit members before reading and follow each byte order's swap unit

Charge artifact_limits.expanded_bytes from the file size and byte order
before the checksum window is read and swapped. The member layout now has
one owner, n64RomRegions, which the parser and the allowance both use.

The length rule follows the order's swap unit, as in mupen64plus-core: a
z64 image of any length needs no swap, a v64 image needs an even length and
an n64 image a multiple of 4. The guide now says that a printable
destination byte outside the known table keeps its code with a null
destination_name.

* refactor(n64): name header fields from the spec and share the boot-address check

Header offsets, the first-word magics, the CIC 6105 table offset and the
KSEG bounds are now named constants with their reference sources, and
recognition and parsing share one boot-address decision. A closed-form
test checks the cartridge checksum on an all-zero window for every CIC,
derived from the checksum routine rather than from n64CartridgeCrc.

* fix(n64): keep the present bytes of a final partial word in the checksum window

The checksum routine now reads one defined window, n64ChecksumWindow: the
image through 0x101000 with only the bytes past a shorter file taken as
zero. A z64 or v64 image that ends inside a word keeps that word's bytes
instead of losing the whole word. The limitation now says how many bytes
were assumed.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(yara): scan an admitted artifact with caller-supplied YARA rules (#14688)

* feat(yara): scan an admitted artifact with caller-supplied YARA rules

Add inspect_yara_matches (CLI inspect-yara-matches), which runs the
installed yara command (REA_YARA_COMMAND or yara on PATH) with
caller-supplied rule files against one local file. The result lists
matching rules with tags, typed metadata and string match offsets,
bound to the SHA-256 of the scanned file and of each rule file.

yara is launched with an argument list under owned process supervision.
Its stdout is parsed as it streams, and the scanned file is re-verified
after the scan. command_timeout_ms, max_output_bytes and max_matches are
per-call arguments and runtime analysis settings with REA_YARA_* launch
seeds; max_file_bytes is per call. String matches beyond max_matches are
counted and coverage is partial. A rule compile error is an input error
naming the rule file, and a missing yara command is reported as
capability_unavailable without affecting other tools. REA bundles no
rules and downloads nothing.

* Address review feedback

* fix(yara): keep the scanned file's observation when a rule file fails

* fix(yara): require qualified Windows paths and resolve relative POSIX commands

* fix(yara): stage owned snapshot, preserve CLI array bounds, and report file-size required_value

* fix(yara): preserve relative includes, retain completed matches, order snapshot cleanup, and declare writesFilesystem

* chore(yara): update advertised schema summary for inspect_yara_matches

* fix(yara): handle regex arguments in include rewriter and retain completed matches across process cleanup

* fix(yara): preserve raw include bytes and staged file identity across close

* fix(yara): preserve completed rule identities and malformed-output primaries

* fix(yara): bound rewritten rule staging and preserve cleanup cancellation

* fix(yara): record completed rule identity before flushing rewritten includes

* Address review feedback

* Address review feedback

* fix(skills): restore the macOS flat installer guidance this branch dropped

The authored native-and-artifacts reference had lost main's macOS .pkg
paragraph, so the generated Cursor plugin copy no longer matched it and
the skill freshness check failed in docs, source tests and packaging.

* fix(yara): classify compile errors by kind and keep unrecognized diagnostics

yara 4.x prints compiler diagnostics in two forms, with and without a rule
(cli/yara.c print_compiler_error). The include failure in the stub used a
form yara never prints, so a real missing include was untested. Parse both
forms once into severity, source, line, rule and message, classify the
message by libyara's text (include, syntax, undefined, duplicate,
unreadable file, other), and give one repair per kind present. Stderr lines
that match no documented form are kept verbatim instead of only counted.

* fix(yara): decode every meta escape yara prints and anchor diagnostic file names

Meta strings: yara 4.x print_escaped_data also escapes an apostrophe and
writes \a \b \v \f, so a meta value such as "author's" failed the whole
scan as an unknown escape. Decode exactly the escapes yara writes, named
after that function, and refuse octal forms it never writes.

Diagnostics: a file name or message can contain "(N): ". Match the rule
files yara was given exactly and end any other file name at the first
location rather than the last. Name yara's EXIT_FAILURE.

* fix(yara): keep an ambiguous diagnostic location unknown and scope duplicate advice

A file name and a message can both contain "(N): ". Split an unnamed
file only where one complete diagnostic remains; several splits leave the
source and line null with the whole text kept, instead of shortening the
file name or dropping the line to unrecognized stderr. Duplicate advice now
covers string, tag and metadata identifiers within their rule, not only
rule names.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* test(setup): reject tampered packages with both signing subkeys (#14925)

* fix(mutation): unblock the daily mutation sweep (#14748)

* fix(mutation): include every mutated file in the mutation project

Stryker's typescript-checker watches the files the mutation project
includes. A mutated file the project leaves out has no watcher, and the
sweep aborts with "no watcher is registered for it" before it reports a
score. The semantics suite mutates src/rizin/RizinDebugFrames.ts and
src/rizin/RizinDebugEvidence.ts, and the reverse-tools suite mutates
src/domain/analysisResourceLimits.ts; none of the three was in
tsconfig.reverse-tools-mutation.json, so the daily mutation sweep failed
before it produced a report.

Add the three files to the project. Add scripts/verify/mutation-target-tsconfig.mjs,
which reads the resolved mutation targets from both configurations and
fails when the project does not cover them or lists a file the repository
no longer has. The guard runs in the deep static lane and before the
sweep, so the drift is reported by name instead of as a checker
abort.

* fix(mutation): give the reverse-tools sweep the time it needs

The reverse-tools suite reached 805 of 1008 mutants after 57 minutes of
mutation testing on the 2026-11-26 scheduled run and was killed by the
60-minute job budget before it could report a score. The suite needs
about 70 minutes of mutation testing plus the setup it runs before it.

Raise the job budget to 90 minutes so the sweep reports instead of
being cancelled. The budget is the only change; the suite and its
mutant set are untouched.

* fix(ci): select mutation quality for debugger limit changes

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(firmware): inspect and extract Android DTBO partition images (#14398)

* feat(firmware): inspect and extract Android DTBO partition images

* fix(firmware): replace fixed DTBO limits with artifact_limits

* fix(artifacts): keep saved effective_limits compatible without android_dtbo

* fix(firmware): accept shared DTBO payloads and keep unknown facts unknown

mkdtimg writes a repeated input file once and points every entry for it at
the same payload (libufdt mkdtimg_core.c search_fdt_info), so an exactly
shared range is valid; only partial overlaps are refused.

A compressed entry's inner FDT magic was not examined, so
fdt_magic_valid is now null rather than false. Bytes inside total_size
that the header, entry table and payloads do not claim are reported with
their range and make coverage unknown. dt_table_header and dt_table_entry
field offsets are named after dt_table.h.

* fix(firmware): charge every DTBO row against artifact_limits.expanded_bytes

Shared payloads are valid, but each row is hashed and can be extracted
separately, so 4096 rows naming one 16 MiB payload multiplied inventory
and extraction work to 64 GiB. Admit the declared bytes of every row
against the shared aggregate expansion allowance before reading any
payload, as PCK aliases do.

* test(firmware): throw the parser's typed error in DTBO success cases

Success cases asserted ok and returned, so a parse failure showed only a
boolean mismatch. They now throw the typed ParseFailureError, as the
testing guide requires.

* test(firmware): drop a duplicated result guard

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* ci(deps): update the CodeQL action to 4.39.5 (#14926)

* build(deps): update tsrs to 7.1.0-beta.tsrs4 (#14927)

* fix(deps): parse classes extending module with Babel 8.1.3 (#14924)

* fix(deps): parse classes extending module with Babel 8.1.3

* fix(javascript): preserve omitted call argument positions after recovery

* fix(javascript): restore explicit nulls in recovered argument lists

* feat(native): list Mach-O function starts and data-in-code entries offline (#14897)

* feat(native): list Mach-O function starts and data-in-code entries offline

The diff adds a static reader for LC_FUNCTION_STARTS and LC_DATA_IN_CODE
on one thin Mach-O or one selected slice of a universal file. Starts are
absolute VM addresses from ULEB128 deltas off the __TEXT vmaddr, and
each data-in-code entry reports offset, length, kind, and the function
start that owns its address, with one offset and limit applied to each
selected table and counts covering every entry.
inspect_macho_function_starts and inspect-macho-function-starts expose
that report, require architecture only for a universal file, and refuse
a combined table above max_entries with no partial result. The shared
load-command walk now yields each command once and stores the Mach-O
segment name and vmaddr on load regions, and the guides and limit docs
record coverage, paging, and the read and entry budgets.

* build: add advertised schema summary for inspect_macho_function_starts

* Address review feedback

* fix(native): bound function-start decoding and page before building rows

- Check each start against an interval index of executable segments, built
  once, instead of scanning every segment per start.
- Walk LC_FUNCTION_STARTS once. Count and check every start and
  data-in-code entry, but build result objects only for the requested page,
  and resolve owners for that page during the same walk.
- Keep every declared Mach-O segment in the shared reader (macho_segments),
  so a __TEXT with no file bytes still anchors the deltas, as
  llvm-objdump does. LoadRegion no longer carries macho_segment.
- On 32-bit ARM, clear the Thumb tag (bit 0) from published starts and
  report it as `thumb`, keeping the tagged value for the next delta, as
  ld64 encodes and LLDB decodes. Wrap 32-bit images at 2^32.
- Intersect Evidence file ranges with the selected universal slice.

* refactor(native): normalize function-start format facts once

- One table, MACHO_DICE_KIND_NAMES, names data-in-code kinds for the
  reader, the schema and the report check, which each had their own copy.
- Each linkedit command's dataoff/datasize is normalized once against the
  slice (end, 32-bit fit, in-slice bytes) instead of the overflow check and
  the in-slice length being recomputed in three helpers.
- Name CPU_TYPE_ARM, VM_PROT_EXECUTE and UINT32_MAX after their headers.
- Report coverage.text_not_at_header when __TEXT does not map file offset
  0: llvm-objdump anchors the deltas on the __TEXT vmaddr and dyld on the
  mach_header address, and they disagree there.
- Pin the fixture's expected starts to literal addresses.

* build: refresh the inspect_macho_function_starts schema summary after merging main

* fix(cli): keep lipo's flag name out of --architecture help text

The architecture help for four commands said "as lipo -thin does", which
the CLI option-alias check reads as a registered short flag `-thin`.
Describe the lipo behavior without spelling its flag.

* Revert "fix(cli): keep lipo's flag name out of --architecture help text"

This reverts commit 68f25adf74.

* refactor(cli): use the shared universal-slice help for inspect-macho-function-starts

* fix(native): bound decoding by max_entries and map data-in-code from the header

- Refuse a data table above max_entries from its byte count, and stop the
  start walk at the remaining allowance, so the allowance bounds decoding
  work. The refusal no longer claims a required_value it did not measure.
- Map each data-in-code offset as the mach_header's VM address plus the
  offset, the way ld64 encodes it and dyld documents it. MH_OBJECT does not
  map its header, so its base is 0. The shared container now carries
  mach_header.filetype.
- Use the same header address for text_not_at_header, which also catches a
  header shifted by SG_HIGHVM.
- Report a list that ends without its zero terminator as
  unterminated_starts.
- Accept an observed empty section name in both result schemas.

* fix(native): tally LINKEDIT commands compactly and report a known entry total

- Count LC_FUNCTION_STARTS and LC_DATA_IN_CODE commands during the shared
  load-command walk into a compact tally (two 32-bit words per command)
  instead of retaining a view and an object for each one. The shared
  visitor now hands over the image's byte order.
- When the image has no starts to decode, a data table above max_entries is
  refused with its exact count as required_value.

* fix(native): report a non-Mach-O input as unrecognized, not malformed

Ask the shared Mach-O header recognizer before the thin reader. An ELF or
PE file passed without `architecture` has no Mach-O magic, so it is an
unrecognized target for this operation. A recognized Mach-O with a broken
or cut-off header still fails as malformed or truncated.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(firmware): decode ESP-IDF Non-Volatile Storage (NVS) flash partitions (#14436)

* feat(firmware): decode ESP-IDF Non-Volatile Storage (NVS) flash partitions

Add offline ESP-IDF v1/v2 NVS partition decoding via `inspect_esp_nvs`
(`rea inspect-esp-nvs`) with complete retained Evidence, `detail: "summary"`
and `inspect_analysis_view` (`kind: "esp-nvs"`) paging, linear O(N+M) v2
multi-chunk blob reassembly, slot-by-slot CRC recovery past damaged item
headers, fail-closed `partition_offset`/`partition_bytes` bounds validation,
and full capability conformance and provider lifecycle coverage.

* fix(firmware): follow ESP-IDF NVS page states, header rules and encryption layout

Page states now follow ESP-IDF's PageState constants (corrupt 0xfffffff0,
invalid 0, unknown otherwise), with the header CRC and whether entries were
walked reported separately. NVS encryption keeps page headers in plaintext,
so an encrypted page is reported as a valid page whose item headers are all
unreadable instead of as a header CRC failure.

Item headers follow Item::checkHeaderConsistency: span per type, BLOB_IDX
and BLOB_DATA chunk-index rules, and a variable item's span matching its
length. An inconsistent header is not trusted and the walk advances one
slot. Unrecognized types are no longer entries with unknown values, and
namespace index 0 items that are not definitions are reported instead of
skipped silently.

Adds float (0x24) and double (0x28) items, keeps the bytes of non-UTF-8
strings and keys, and marks older copies of a key superseded by a higher
page sequence number or a later slot. Spec constants are named once and
v2 blob reassembly moves to its own module.

* fix(firmware): preserve NVS key byte identity, summary retention, bitmap span checks and artifact handoff

* fix(firmware): preserve intact NVS values, copied blob chunks, unknown page versions and -0

* fix(firmware): report older copies of used NVS blob chunks instead of dropping them

An interrupted page move leaves an older copy of a BLOB_DATA chunk next to
the copy a recovered blob used. a2e8fc1a70 stopped reporting it as an
orphan by skipping every chunk with a claimed index, which also dropped the
older copy silently, including one whose bytes differ. It is now reported
as blob_data_copy, superseded, with its own CRC-based completeness, and
does not make coverage partial.

* fix(firmware): require CRC-valid replacement before marking copied NVS blob chunks superseded

* fix(firmware): bound decoded NVS representation growth and fuse coverage flags

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(artifacts): inventory systemd journal headers and object table offline (#10151)

* feat(artifacts): inventory systemd journal headers and object table offline

Journals copied from a host or carved from a disk image had no reader, so an
analyst needed journalctl and a live host to see what a file declared. Recognize
the LPKSHHRH header by bytes and report it as its own artifact format.

Parse the fixed 272-byte header: flag bits and their names, state, the four
128-bit ids, header and arena sizes, hash-table extents, and the object, entry,
data, field, tag and entry-array counts. Anchor the object area on header_size,
requiring an aligned offset inside the file, then walk the object chain front to
back by each header's declared extent. Report totals by object type, the
valid/truncated/unknown-type counts, a bounded window of 32 object headers with
source offsets, and the trailing bytes the chain could not claim.

Payloads stay undecoded: fields, entries, entry arrays, hash tables and
compressed objects are reported as limitations rather than guessed, and the
whole file is bounded at a fixed 4 GiB ceiling.

* style(artifacts): format the systemd journal reader and its fixtures

`format:check` fails on these three files, which breaks the Static checks
lane and, through it, the CI required aggregate. `oxfmt` only reflows
lines; no behaviour changes.

* fix(artifacts): read journal objects the way systemd lays them out

The object walk that shipped with the reader did not match the on-disk
format, so a valid journal could be reported as truncated and an
incompatible one could produce plausible but wrong evidence.

- Advance to `align8(offset + size)` and validate the raw extent. systemd
  keeps a declared size unpadded and aligns only the next object's start,
  so a size that is not a multiple of eight is valid, not truncated.
- Stop at `tail_object_offset` instead of at end of file. Bytes after the
  declared tail are the arena's preallocated capacity; walking them read a
  zero header as an extra unused object and called capacity corruption.
- Stream the object chain instead of buffering the file. Payload bytes are
  skipped as chunks arrive, so a journal near the 4 GiB ceiling inventories
  in chunk-sized memory and cancellation between chunks is never queued
  behind a whole-file parse.
- Read `tail_entry_array_offset` and `tail_entry_array_n_entries` with
  `getUint32`. They are adjacent 32-bit members added in revision 252;
  reading each as 64 bits folded the following field into both values.
- Accept the 208-byte header that predates `n_data`, and read every later
  field only when the declared `header_size` covers it. Older acquired
  journals stay inspectable instead of classifying as unknown.
- Refuse to describe objects when `incompatible_flags` sets a bit outside
  the known set. Such bits change the parser's assumptions, and a journal
  from a newer systemd would otherwise yield invalid object evidence.
- Record fields whose declaration exceeds 2^53-1 in `overflowed_fields`,
  so distinct source values no longer collapse onto the same ceiling.
- Report skipped compressed payloads only when a walked object actually
  carries a compression flag, not merely because the header advertises a
  compression algorithm.

Regression tests cover the unaligned size, the declared tail with arena
capacity after it, the 208-byte header, the compact 32-bit tail-array
fields, the 2^53-1 ceiling, unknown incompatible flags, and the
compression message. The decoder was also checked against every chunk
boundary from one byte to the whole file: counts and offsets are identical.

* style(artifacts): apply repository formatting

* chore(systemd): merge main and read the journal through BinaryReader

main's guards reject new raw DataView reads, so every header, object and
state field now goes through BinaryReader, which bounds each read.

Two offsets are write cursors rather than resource allowances, and each
carries the not-an-allowance reason the budget rule asks for.

* chore(systemd): apply oxfmt to the journal header helper

format:check runs oxfmt, and the BinaryReader rewrite left one call wrapped across three lines that oxfmt wants on one. No behavior change; this is what turned the Static checks job red on the previous run.

* chore(systemd): record the open_binary output schema summary

The journal format adds artifact format metadata, which changes the open_binary output schema digest. Build package runs verify:advertised-schemas and rejects the stale summary, so commit the regenerated digest. Only the output compact hash moves; input schemas and patterns are unchanged.

* fix(contracts): recognize damaged systemd journals by signature

hasSystemdJournalHeader also required a usable header_size, so a journal with
a short or unaligned header never reached SystemdJournalArtifactReader: normal
inventory classified it as a plain file and dropped the header facts and the
object-walk limitation the reader already reports. The malformed-header test
only passed because it constructed the reader directly.

Recognition is now the signature alone. Deciding whether header_size anchors
the object area belongs to the owning reader, which keeps whatever it could
read and records why traversal stopped.

* fix(journal): separate undersized objects from truncation and bound the tail

- An object declaring a size below its own 16-byte header is a contradictory
  declaration, not a file cut short: it is counted separately so the analyst
  is not told the writer was interrupted.
- An object size above 2^53-1 now carries `size_overflowed` on its header
  record, matching how the header fields already report the ceiling.
- Object extents are validated against the declared arena, not only the
  physical file, so a short arena is reported instead of accepted.
- `tail_object_offset = 0` with `n_objects = 0` is an empty chain rather
  than an absent boundary; a declared tail the walk never reaches is
  reported as an incomplete object area.
- `tail_entry_boot_id` is null unless the compatible `tail-entry-boot-id`
  flag is set, so the legacy boot id at the same offset is not published
  as a tail-entry identity.
- A header the probe could not anchor reports `unread_fields`, so its
  zeroed numeric declarations are not read as observed values.

* fix(journal): keep journal occurrences out of the executable role

A recognized .journal with no special path role fell through to the default
executable role, so every ordinary journal was inventoried as a program.
The bytes are data, not code, so the format now keeps the resource role the
same path would carry without a recognized content format.

* fix(journal): report a short signed journal as truncated input

The reader mapped every format failure to `malformed`, so a file that
carries the signature and stops before the header shape was complete was
reported as damaged structure rather than missing bytes. The signature is
now read before the decoder runs, and a signed short file carries a
`truncatedInput` cause; unsigned bytes keep `malformedInput`.

* fix(journal): keep the legacy boot id and read flags once

The 56-71 id has two readings selected by the compatible `tail-entry-boot-id`
bit; nulling it when the bit is clear dropped a readable header value. Both
names are now reported with exactly one non-null, and `readIdFacts` takes
the compatible flags the caller already read instead of a second u32
reader.

* Merge origin/main into feat/10123-systemd-journal

Import systemdJournalMetadataSchema from androidAndSystemMetadata directly instead
of the artifactFormatMetadata barrel. main moved format metadata into per-group
modules; the barrel re-exports platform parsers that import back through
resources, and the cycle left the schema undefined at module init, failing every
SystemdJournalArtifactReader test.

* test(filesystem): align stable artifact stream failures with split error reasons

Upstream #14225 split reader path refusals from malformed target bytes and moved two stable-artifact contract breaks off ArtifactReaderFailure("format"): an invalid chunk size is now an internal invariant violation, and a descriptor returning an impossible byte count is an io failure. The suite still asserted reason "format" for both, so shard 9 and the required CI lane went red on every branch that re-merged main.

Update the assertions to the reasons the producers now raise so the boundary suite matches the intended contract.

* test(filesystem): assert path refusal for a directory entry in the reader suite

DirectoryArtifactReader has refused non-file entries as reason "path" since the reader moved into src/resources (#11520), but the boundary test still expected "format", so the re-merged branch fails shard 4 with an ArtifactReaderFailure whose reason is path.

Assert the reason the reader raises.

* fix(artifacts): report unknown journal layouts as unsupported, not truncated

A complete journal whose header sets an incompatible flag bit this reader does not know was refused through the signature-based path, which wraps every decode refusal in truncatedInput. Callers therefore told the analyst the artifact was invalid and to obtain a fresh copy, although no bytes are missing and a fresh copy cannot help.

Carry an unsupported tag from the journal decoder through the artifact boundary so truncation stays reserved for genuinely short structures, and the public reason selects the compatible-decoder recovery.

* fix(pe): accept systemd-journal as a PE overlay leading format

Merging main brought the systemd-journal recognizer into the shared format
union while this branch kept its own overlay list, so
recognizeLeadingFormat no longer assigned to PeOverlayLeadingFormat and
typecheck failed. Recognizers can name systemd-journal, so the overlay
leading-format list has to include it.

* fix(systemd-journal): bound the scan by its window, not a file-size ceiling

- Drop the 4 GiB whole-file ceiling. It was justified by ENTRY_SIZE_MAX,
  which bounds one entry, while the scanner streams and retains one chunk
  plus a 32-header window whatever the file size.
- Make the object-header window selectable: createJournalDecoder and the
  reader accept objectHeaderStart, so next_object_header_index can be
  followed to later headers.
- Treat a zero arena_size as an empty arena rather than an absent one, and
  report declared arena bytes past the end of the file even when the
  readable objects and counts agree.
- Re-verify the source before reporting a decoder failure, so a file that
  changes mid-read reports an identity failure instead of truncation.
- Read the state byte through one lookup, so a header that cannot anchor
  its objects keeps its observed state; name the tail-entry-boot-id flag.

* feat(artifacts): page format record headers past the inline window

Inventory keeps a bounded window of per-record headers, and nothing could
follow the systemd journal's next_object_header_index over MCP or CLI.
inspect_analysis_view gains a generic `format_record_headers` inventory
collection (#14919) that uses the existing offset and limit.

- Each page re-reads the root file through its format's artifact reader,
  with the window started at `offset`, after binding the file to the parent
  inventory's root digest. A changed file fails with
  artifact_integrity_mismatch (container-identity) instead of returning
  shifted rows.
- Memory is one read chunk plus one window. The read is a cancellable
  streaming scan, and the reader is released through the view's resource
  scope.
- Formats plug in through two single lists: the domain's record total and
  the artifacts layer's window reader. The systemd journal is wired; NTFS
  $MFT is left to #14919 because its streaming decoder has no start index.
- The journal metadata drops object_header_start_index and
  next_object_header_index, which nothing could follow; the page's
  coverage.next_offset is the one continuation.
- The journal test builder moves into a shared fixture for reader and
  boundary tests.

Refs #14919

* fix(artifacts): page record headers only from a caller-named file

- Opening a file must not be selected by Evidence: subject.local_path is
  display metadata and can change without changing the Evidence ID. The
  format_record_headers collection now requires an explicit absolute
  `path`, which the CLI resolves like other caller paths. The root digest
  still binds that file to the inventory.
- Keep a completed page when the reader fails to close. The view Evidence
  is attached to the cleanup failure as its partial observation, and the
  reader stays retained for retry.
- Keep a completed page when cancellation arrives after it was read.

* fix(artifacts): scope record-page file selection and cleanup to its owners

- Name the page's file selector artifact_path. The CLI's caller-path rewrite
  of view.path also rewrote other views' semantic selectors, such as a
  devicetree node path, into host paths on Windows; artifact_path exists
  only on format_record_headers pages.
- Run each page's read and release through the supplied resource scope, so
  a reader an earlier page failed to close is retried first and a new page
  is refused while that cleanup stays unresolved.

* fix(views): own the record-page row type beside the view parent

The parent module imported the inventory projector for the page row type,
which closed an import cycle the analysis-view cycle check forbids. The type
now lives in analysisViewParent.ts and its consumers import it from there.
The CLI JSON-input schema test now expects view.artifact_path among the
caller paths inspect-analysis-view resolves.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(artifacts): report declared Ogg Opus, RIFF/XMA2, Bink 2 and Vulkan pipeline-cache headers (#14700)

* feat(artifacts): report declared Ogg Opus, RIFF/XMA2, Bink 2 and Vulkan pipeline-cache headers

Recognize the four remaining #14155 media/cache containers by their public
header signatures and inventory them as archives. Root format metadata
carries the declared header facts; each named byte region is a member that
is hashed and extractable. Payloads stay opaque: no audio, video or
pipeline-cache body decode.

Disagreeing extents stay in extent_check with unknown coverage rather than
a refusal. Structural header faults refuse as malformed input with format
and offset.

Completes the remaining formats from #14155 after #14248.

* fix(artifacts): bound media-asset header walks and document formats

Stop RIFF inventory from buffering opaque chunks, keep chunk walks inside
the declared form, follow spanned OpusTags before audio, preserve first-page
truncation, ground the Bink fixture/table split, and document the formats.

* fix(media): keep truncated RIFF chunk facts and register guide sidebar

Record incomplete RIFF/XMA2 chunk headers in metadata, treat cut-off fmt as
truncated rather than missing, and add media-asset-headers to the VitePress
sidebar registry.

* fix(artifacts): report cut-off media headers as truncated

Short RIFF, Bink 2, and Vulkan pipeline-cache headers that end before the
declared header size are truncated inputs, not malformed structure.

* fix(artifacts): read Bink 2 headers at their demuxer offsets and keep Ogg and RIFF facts

* fix(pe): name media asset formats as PE overlay leading formats

* refactor(artifacts): format the Bink revision byte with the shared hex helper

* fix(artifacts): bound Bink frames.bin to the declared file end

Trailing bytes past the header size field are no longer claimed as
frame payload. Tables that do not fit the declared extent stay unlisted.

* fix(artifacts): keep unlisted Bink tables in the extent check

When header tables end past the declared file size, still measure the
frame-offset table against the file so extent_check reports truncated
instead of consistent while the tables remain unlisted.

* fix(artifacts): admit media asset regions with a per-call limit and report incomplete headers

* refactor(artifacts): import the reader limit failure through the resources entry

* fix(artifacts): keep Ogg page records as ranges, not buffer slices

Growing the read buffer with Buffer.concat left each saved page's packet
slice pinning the previous copy, so a long OpusTags continuation retained
O(n²) bytes before region_count refused the walk. Page records now store
packet offsets and read from the final buffer.

* fix(media-asset): read Ogg pages by position and report required region count

* fix(media-asset): keep Bink audio track facts inside the declared end

Refuse to decode track tables past declaredEnd so appended physical
bytes are not reported as audio_tracks.

* fix(artifacts): keep Ogg header reads inside their own packet

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(native): do not count an object file's LINKEDIT tables as misplaced (#14933)

A relocatable object (MH_OBJECT) has no __LINKEDIT segment; clang places
its link-edit data after the sections, outside any segment. The placement
check counted every such table as outside __LINKEDIT, so a complete
data-in-code table in a valid object reported partial coverage. Only file
types that have the segment now count a table outside it. in_linkedit
stays false as an observation.

* fix(yara): refuse rule files with include directives before yara starts (#14937)

* fix(yara): refuse rule files with include directives before yara starts

yara opens an included file while it lexes, outside the hashed snapshot, so
the rules it adds were not bound to the scan's Evidence. A selected rule file
with an `include` directive is now refused with a typed input error naming
each directive's line, byte column and path, and the recovery to pass the
included file as another rule_paths entry or inline its rules.

Detection follows libyara 4.x's flex lexer (lexer.l at v4.5.0): the
`include[ \t]+"` rule fires at any token start in the initial state,
including inside a rule body, and never inside comments, text strings or
regular expressions. One streaming scanner sees the staged bytes unchanged.

The relative-include rewriter, the `include` compile-error kind and its
repair advice, and the stub's include support are removed, since no include
reaches yara.

* test(yara): check the include scanner against libyara's own answers

Twenty-four rule sources cover the scanner's lexer assumptions: directives
in rule bodies and after punctuation or number tokens, and include inside
comments, strings, regexes, hex strings and longer tokens. Each case records
the include paths libyara 4.5.4 asked to open through yara-python's
include_callback, so the expected values come from yara, not the scanner. A
real-yara test compares the same cases with the installed yara's missing
include error where one is installed.

* fix(ghidra): report a wait-bounded owner probe timeout as busy regardless of clock skew (#14935)

* fix(ghidra): report a wait-bounded owner probe timeout as busy regardless of clock skew

The checkpoint save wait gives the owner-identity probe the rest of the wait,
then classified a probe timeout as busy only if the deadline had also expired.
Node's timer runs on the event loop's cached clock, which lags performance.now()
under load, so the probe timer could fire while the deadline still read time
left. The timeout was then treated as a handoff, and after the next poll the
save failed with a lease configuration error instead of the busy refusal.

A probe whose timeout is the wait's remainder now ends the wait on its own
timeout. Replace the two wall-clock elapsed-time assertions in the probe tests
with recorded probe budgets and failure reasons, gate the cancellation on the
probe's connection instead of a fixed delay, and add a regression that models
the timer firing early.

* test(ghidra): hold the deadline clock still in the probe-timeout regression

The regression relied on a real timer waking inside a 10 ms window. If the
event loop stalled past the deadline, the old code also reported busy, so the
test could pass without the fix. Stub performance.now() so the deadline is
still unexpired when the probe times out, then move it past the wait before
the save's next poll. It now fails on main every run.

* feat(artifacts): inspect Sega Mega Drive and Genesis ROM headers offline (#14895)

* feat(artifacts): inspect Sega Mega Drive and Genesis ROM headers offline

These ROMs are inventoried as containers. A plain image matches when the
four bytes at offset 0x100 are SEGA; an SMD dump matches the copier mark
0xAA 0xBB and a block count whose de-interleaved bytes carry SEGA, then
the odd and even halves are merged into the linear image. The root
record stores the 68000 vectors, header strings, declared and computed
word checksum, ROM and RAM ranges, devices, external RAM, and region,
with members vectors.bin, header.bin, and program.bin (SMD members carry
an image offset and a null file range). A checksum or range disagreement
leaves coverage unknown, 32X and Sega CD remain labels only, and a file
past 8 MiB or 512 SMD blocks is refused under the named fixed ceilings
before its body is buffered; the shared region reader maps that refusal
onto the typed allowance, and the guide, CLI, supported-targets table,
CI scopes, and ceiling registry include the format.

* Address review feedback

* Address review feedback

* Address review feedback

* fix(artifacts): read Mega Drive work RAM on the 24-bit bus and keep ambiguous regions

A header that declares work RAM as 0xE0FF0000-0xE0FFFFFF, the SGDK
default, was reported outside the work-RAM window because the check
compared full 32-bit values. The 68000 drives 24 address lines, so the
window check now compares bus addresses; metadata keeps the declared
values.

A region field of a lone A, B or E is both a classic region letter and
a one-digit mask, and references disagree on which it is. It was
reported as letters with no limitation. It is now region_style
ambiguous, keeps both readings in region_characters and region_mask,
and records a limitation.

* refactor(artifacts): name Mega Drive header fields once and share the SMD half layout

Header field offsets and lengths were literals repeated at each read, and
device support was sliced twice from separate literals. One TEXT_FIELDS
table, the named numeric offsets and the EXTERNAL_RAM block now hold the
layout, citing SGDK's rom_head.c and Genesis Plus GX's getrominfo and
sram_init.

SMD recognition and de-interleaving each encoded which block half holds
the odd bytes. Both now use SMD_ODD_HALF and SMD_EVEN_HALF, and the
decoder takes the block count from the de-interleaved image instead of
recomputing it from the file size.

The SMD round-trip test only checked the fixture against its own inverse.
It now also pins the fixture's file bytes to the Genesis Plus GX
deinterleave_block layout.

* fix(artifacts): model the Mega Drive 68000 bus once and decide SMD dumps before ESP images

Header addresses were compared in three places with two rules: the RAM
check masked to 24 bits while the reset-PC check compared raw 32-bit
values, and neither knew the work-RAM mirror. One owner now holds the
MC68000 24-bit bus (the top byte is not driven) and the Mega Drive work
RAM, 64 KiB mirrored through 0xE00000-0xFFFFFF (Genesis Plus GX gen_init
maps pages 0xE0-0xFF to it). The reset PC is checked against the ROM
range on that bus, so 0xFF000200 fetches from 0x200, and a RAM range is
work RAM when it covers at most 64 KiB inside the mirror, such as
0xE00000-0xE0FFFF. Metadata keeps the declared values.

An SMD dump of 233 or 489 blocks has 0xE9, the ESP image magic, in its
copier header's block-count byte, so the ESP image recognizer claimed
it. The shared recognizer table now decides the SMD layout, whose
signature also needs the AA BB mark, interleaved SEGA bytes and an exact
size, before the ESP recognizers, and the plain layout keeps its place
after the leading-magic formats.

* fix(docs): restore separate Mega Drive and N64 entries after the main merge

* fix(mega-drive): read ROM range and checksum window on the 24-bit bus

The reset PC check already masked the top address byte, but ROM ordering,
extent, the nonzero-start note and the checksum window still used the raw
declared endpoints. A 0x400-byte image declaring 0xFF000000-0xFF0002FF
summed through 0x3FF instead of 0x2FF, and a full 0xFF000000-0xFF0003FF
alias was marked incomplete. Derive bus addresses once in the parser and
keep the declared values in metadata.

* fix(artifacts): order every Mega Drive header range on the 24-bit bus

The ROM range was ordered on the 68000 bus, but the RAM range and the
external RAM range still compared raw 32-bit endpoints. A header whose
endpoints alias through different top bytes, such as RAM
0xE0FF0000-0x00FFFFFF, was reported as reversed even though the bus
range is the 0xFF0000-0xFFFFFF work RAM.

The bus owner now has one ordering rule, busOrdered, and the ROM, RAM
and external RAM checks all use it. Declared values stay in metadata. A
range whose end wraps past the 24-bit bus, such as 0xFF0000-0x1000000,
is now reported as reversed, which is what the bus sees.

* fix(artifacts): keep truncated region failures typed and publish Mega Drive bus addresses

A region decoder could only report malformed, limit or unsupported, and
the shared DecodedRegionArtifactReader mapped every kind but malformed to
a fixed-limit refusal. A recognized Mega Drive header cut short was
therefore reported as malformed, and an unsupported region failure would
have surfaced as a limit. RegionDecodeFailure now has truncated, with
the measured extent, and the reader maps each kind to its own typed
failure: malformed, truncated, unsupported or limit.

The header checks already interpret ROM, RAM and reset addresses on the
68000's 24-bit bus, but metadata exposed only the stored longwords, so
the raw m68k hand-off told callers to load at the stored ROM start. A
header that stores 0xFF000000 then loads at the wrong address. ROM and
RAM ranges now carry bus_start and bus_end, the reset vector carries
reset_pc_bus, and the guide and skill hand off with rom.bus_start.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* feat(labview): inspect RSRC containers and embedded VI trees (#13337)

* feat(labview): inspect RSRC containers and embedded VI trees

Add inspect_labview_artifact, a static reader for LabVIEW RSRC containers in
.vi/.ctl/.llb files and in LabVIEW-built PE resources. It reports the container
header, the recorded LabVIEW version, the complete block inventory with each
section's coding, and whether the block-diagram and front-panel heaps are
present, without starting LabVIEW or any process.

Only zlib-coded sections are decoded, for their byte count; no payload is
returned. An absent block-diagram heap is reported as a limitation rather than
reconstructed.

* docs(labview): document RSRC inspection

Describe the inspect_labview_artifact contract, section codings, and the
block-diagram limitation, and list the target in the supported-targets table
and the documentation index.

* test(labview): cover provider admission for the RSRC reader

Add the provider-admission coverage the repository requires for a new
provider, without changing the reader:

- Move the synthetic RSRC container builder into a shared test fixture so
  the unit and boundary tests build the same bytes once.
- Add a CLI and stdio MCP boundary test for inspect_labview_artifact.
- Register `rea-labview-rsrc` lifecycle coverage for operation and cancel.
- Declare the `labviewArtifact` conformance case.
- Regenerate the advertised catalog summary for inspect_labview_artifact.

* fix(labview): require an absolute path in the inspection contract

`inspect_labview_artifact` admitted a relative `path`, while every other
caller-path contract requires an absolute one. The CLI/contract parity
check caught it: the CLI resolves a relative argument before admission,
so the contract must hold the absolute rule alone.

Use `absoluteLocalPathStringSchema`, the schema the other caller-path
contracts already use.

* fix(labview): bound inspection work and preserve parse facts

Address the review findings on the RSRC reader:

- Bound the PE resource walk with a visited set, a total visit budget,
  directory-entry and container allowances, and a typed limit failure
  instead of a silently partial scan.
- Check the resource directory and its data against the declared resource
  range rather than the whole file.
- Cap zlib inflation at its declared length, add a total decoded-work
  budget, and recognise any valid zlib header instead of three byte pairs.
- Check nested RSRC records against their declared data/info sections and
  cap the total section count across blocks.
- Read the artifact through readStableArtifact so identity, bounds and
  cancellation bind to the bytes actually inspected.
- Carry parse failures as ParseFailureError facts: malformed input keeps
  its kind/offset/field, and a limit becomes a typed fixed-allowance
  refusal instead of invalid_format.
- Report heap presence as `unknown` when an embedded program tree or an
  unexamined container could still hold it, not as `absent`.
- Cover cancellation that arrives after the read starts.
- Move the analyst guide under docs/guides/native/.

* fix(labview): retry retained cleanup and keep read failures distinct

- Own the artifact resource scope and run each read through it, so a
  retained failed close is retried before later work and reported at
  shutdown.
- Translate the read failure as recorded instead of replacing it with the
  signal's current state; the stable read owns its cancellation facts.
- State the 256 MiB input ceiling as a fixed allowance so an oversized
  artifact keeps its structured maximum and recovery.
- Match the guide to the decoded-byte behavior: a section over the budget
  is reported `unknown` and the inventory continues.

* fix(labview): bound the version scan and keep cleanup on refusal

- Replace the unbounded `\d+\.\d+` scan with a bounded single-pass search
  over the first 64 KiB of each vers section; a digit-only section no
  longer drives quadratic matching work in the shared server.
- Classify read failures through the shared provider classifier with a
  LabVIEW dialect, so the size ceiling is restated as a fixed allowance
  and the read's cleanup, partial observation and cancellation facts
  survive the refusal.
- Cover both with regressions.

* fix(labview): reuse the shared PE layout and bound the decode work

- Walk PE resources through readPeResourceLayout, so RVA lookup is indexed,
  a payload may map through any admitted section, and the home-grown
  section scan is gone. Add a total entry budget.
- Charge every attempted inflation against the container's decode budget,
  including failed and length-mismatched attempts.
- Bound block records by the list's declared extent, clamped to the
  container because real LabVIEW-built PEs declare more than the resource
  payload holds.
- Reject a named section whose name leaves the list instead of reporting
  it as unnamed.
- Pass the selected container to the parser without copying it.
- Cover the PE path and the over-declared list extent with regressions.

* fix(labview): bound repeated decodes and report unexamined coverage

- Charge compressed input bytes as well as declared output, and memoize
  the decoding of one stored section, so records that share a stream do
  not repeat its work.
- Keep a zlib-coded `vers` section's decoded bytes for the version scan.
- Cap list records by both the declared extent and the info section.
- Report PE walk coverage, and keep heap presence `unknown` for a `.llb`
  archive or an unreadable PE resource branch.

* fix(labview): key cached decoding by block and section

A section's coding depends on both its stored bytes and the block that
declares it: LVzp is XOR regardless of the bytes, while another block may
read the same bytes as raw or zlib. Include the block identifier in the
memo key so a shared section keeps each block's interpretation.

Cover the shared-section case with a regression.

* fix(labview): derive block facts once and stop inferring format from names

- Compute the block-diagram, front-panel and program-tree facts in one
  pass over the inventory and reuse them.
- Check the visited set before charging the PE directory-visit budget, so
  aliases of one directory do not exhaust it.
- Deduplicate aliased resource payload ranges before counting containers.
- Report a direct RSRC container's heap facts as unknown: its content does
  not establish whether it is a VI, a control, or an archive of member VIs,
  and the caller's spelling is not evidence of format.

* fix(labview): decode the packed version record and keep resource type

- Read the LabVIEW version from the packed four-byte word at the start of
  a `vers` record instead of scanning the whole record as Latin-1, and
  report `version_coverage` so an undecodable record is unknown rather
  than absent.
- Accept only RT_RCDATA (type 10) PE resource payloads, so the
  `pe-rcdata-rsrc` kind is accurate and a larger custom resource cannot
  win selection.

* fix(labview): walk only the RCDATA subtree and validate packed digits

- Walk only the RCDATA (type 10) resource subtree, so a shared directory
  reached under another type cannot hide the container and unrelated
  branches are not charged to the entry budget.
- Reject a packed version word whose digit nibbles are not decimal; a
  damaged record is skipped and a damaged-only container reports
  `version_coverage: unknown`.
- Derive the heap and program-tree facts in the parser and consume them in
  the provider, so one owner defines their meaning.

* fix(labview): filter root resource entries before dispatch

- Apply the RCDATA root-type filter before either target branch, so a root
  entry that points straight at a payload cannot enter the result.
- Validate only the decimal major, minor and bugfix fields; the build
  field is not part of the reported version.

* fix(labview): filter PE root types before dispatch and validate only reported version digits

The RT_RCDATA filter ran only for directory targets, so a noncanonical root
entry of another type pointing straight at a data entry could be counted
and labelled pe-rcdata-rsrc. Filter the depth-0 type identity before
either target branch, and share the RT_RCDATA constant with the PE
resource facts owner.

The vers check rejected a record whose build bits held a nibble above 9.
Only major.minor is reported, and pylabview (decimal build digits) and the
classic NumVersion layout (binary non-release revision) disagree on the
build, so only the reported major and minor nibbles are validated.

* fix(labview): resolve names against the shared list and keep read identity

- Locate the one section-name list after every block's start table and use
  it for all blocks, so named sections before the last block keep their
  identity instead of reading a neighbouring table.
- Retain the completed read's byte identity on later refusals and failed
  closes, so a parse failure still names the bytes that were read.

* fix(labview): report why recognized zlib sections stay undecoded

A valid RFC 1950 header with FDICT set was classified as uncompressed, so
a vers section's four-byte length prefix was read as version 0.0. FDICT
now marks the section as recognized-but-undecodable zlib.

Each undecoded zlib section records its reason (preset dictionary,
compressed-input or decoded-output allowance, or failed inflation), and the
report names the fixed allowance that stopped it, so a capacity omission is
distinguishable from damaged bytes.

A PE whose RCDATA branch could not be read is no longer described as
carrying no embedded RSRC resource. The RSRC magic and zlib header fields
are named once and shared.

* fix(labview): keep PE admission separate from an unreadable tree

A file that does not declare `MZ` is not a PE, so it must not be reported
as a malformed PE resource tree. The scan reports whether the file was
admitted as a PE separately from whether the walk was complete.

* fix(labview): take PE identity from the MZ owner and bound section tables

A two-byte MZ check treated plain DOS MZ and NE/LE/LX images as declared
PEs, so an ordinary non-LabVIEW file was reported as an unreadable PE
resource tree. PE identity now comes from observeMzWindowsHeader: only a
PE signature at e_lfanew declares a PE. The unused admitted field is
removed.

A section-start offset inside the count word or block-header rows was
accepted and could fabricate an inventory from block metadata. Tables must
start at or after the end of every block header; blocks may still share a
later table.

The refusal tests now assert the error type unconditionally.

* fix(labview): report embedded parse failures in file coordinates

A malformed RSRC embedded in a PE failed with container-relative offsets,
but the refusal names the selected executable and carries no
container.file_offset, so callers could not locate the failure. The
parser now takes the container origin and moves a failure offset into the
selected file's coordinates; successful results keep container-relative
ranges with container.file_offset.

* fix(labview): frame RSRC tables before applying their count allowances

A damaged container declaring an impossible block or section count was
refused as a capacity limit before its table extent was checked, so a
truncated target surfaced as resource_constraint. Each table is now framed
first; a fully framed table over its allowance is still a capacity
refusal.

* fix(labview): keep unread PE resource roots and rows out of observed absence

A nonzero resource RVA whose file-backed run cannot hold one directory
header returned complete coverage without reading anything, so the file
was reported as carrying no embedded RSRC. Only a zero RVA is observed
absence now; a short declared root is an unread tree.

Directory rows were checked against the entry allowances before their
extent, so a damaged directory declaring impossible counts surfaced as
resource_constraint. Rows are framed first; a fully framed directory over
its allowance is still a capacity refusal.

* fix(labview): reject RSRC data sections that overlap the fixed header

A data offset inside the 32-byte RSRC header let a section's stored-length
word be read from header fields, returning a fabricated empty section as a
successful inventory. A data offset below the header is now malformed.

* fix(labview): check decode-omission guidance structurally and own the RSRC magic once

The allowance test froze the delivered sentence. It now checks the parser's
decodeOmissions fact and the effective allowance, and compares the public
limitation with the provider's own formatter output.

The RSRC magic was declared again in artifact recognition; it now has one
owner in the LabVIEW domain contract, used by recognition, the parser, the
PE scan and the provider.

* feat(labview): summarize and page the RSRC inventory from retained Evidence

inspect_labview_artifact returned every block and section inline, so an
admitted container with 4096 named sections could exceed a megabyte and
bypass the agent result budget. The tool now takes detail: complete keeps
the inline inventory; summary, or omitted detail over the budget, returns
container, version and heap facts with block and section counts, and the
complete inventory is paged with inspect_analysis_view kind
labview-artifact (blocks, sections, optional block filter) or read with
evidence-json. The CLI delivers the same way.

RSRC data and info ranges that intersect are refused as malformed rather
than reading list metadata as section data.

* test(labview): read the CLI report as the complete inventory

The advertised output now admits complete or summary detail, so the test
parses the complete report schema explicitly.

* perf(labview): build view rows only for the requested page

Each view call copied every section before reading the request, so a
summary or one-row page did work proportional to the whole inventory. A
section index (block and section position, and positions per block) is
built once per immutable retained report and reused; summaries read
counts from it, and section pages build objects only for selected rows.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(dotnet): reuse validated bundle entries across enumerations (#14885)

fix(dotnet): retain validated bundle entries across enumerations

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(pkg): report unexamined data after cpio trailers (#14909)

* fix(pkg): report unexamined data after cpio trailers

* fix(cpio): reject hidden bytes in trailer names

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* fix(vsix): retain metadata without an identity element (#14941)

* refactor(setup): share recovery backup inspection (#14939)

* perf(ci): narrow the CodeQL selector checkout (#14940)

* test(bun): share standalone reader fixture writes (#14944)

* fix(native): report non-native bytes as unrecognized, not malformed (#14936)

* fix(native): report non-native bytes as unrecognized, not malformed

A file that is not the format a reader owns was reported as a broken file
of that format. `inspect_native_initializers` called a PE file or random
bytes a malformed target, and the thin Mach-O reader called any bytes
without Mach-O magic a malformed Mach-O.

Format owners can now say "these bytes are not my format": parse failures
and format target failures gain the `unrecognized` kind that target
failures already define ("no reader for this operation recognizes the
bytes"). The owners report it once:

- the thin Mach-O reader, for bytes without Mach-O magic;
- the shared native container reader, for bytes that are not ELF, PE or
  Mach-O (previously `unsupported`);
- the initializers provider, for a file with neither ELF nor Mach-O magic.

Function starts no longer pre-checks the header itself; the shared reader
owns that decision. IL2CPP keeps mapping unknown native bytes to its
unsupported-container reason. A recognized header that is cut off or
broken stays truncated or malformed.

* fix(resources): keep every format failure kind's facts through artifact wrappers

`ArtifactReaderFailure` kept the owner's facts only for its own list of
three format kinds, and `artifactOperationReason` had a second list. With
`unrecognized` added, `artifactFormatFailure` and `artifactParseFailure`
dropped its facts, so `translateArtifactFailure` raised an internal
invariant error instead of the target failure.

The format kinds are now one list, `FORMAT_TARGET_FAILURE_KINDS`, and
`isFormatTargetFailureKind` is the one guard. `FormatTargetFailure`,
`ParseFailureKind` and `BinaryFormatFailure` derive from that list, and
the reader-failure constructor and the operation-reason check both use the
guard, so a new kind cannot be carried by one wrapper and dropped by another.

* test(conformance): expect unrecognized for foreign bytes on native readers

The Go, Rust and native-initializers readers now report bytes that are not
ELF, PE or Mach-O as unrecognized, so their foreign-bytes conformance cases
expect that kind. The case names follow the kind.

* fix(deps): use patched minimatch in development tooling (#14945)

* refactor(views): share field-specific input errors (#14942)

* refactor(packages): share ZIP failure translation (#14943)

* refactor(artifacts): share positional region entries (#14947)

* refactor(views): share selected page items and coverage (#14946)

* refactor(views): share selected page items and coverage

* fix(views): preserve selected page row unions

* feat(apple): inspect Image4 (IMG4, IM4P, IM4M) firmware containers offline (#14907)

* feat(apple): inspect Image4 (IMG4, IM4P, IM4M) firmware containers offline

Image4 files are recognized from a DER SEQUENCE whose first element is
the IA5String IMG4, IM4P, or IM4M, independent of the filename, and are
inventoried as apple-img4. The stored payload octet string is exposed as
payload, the embedded IM4M sequence as manifest.der, and the IM4R
sequence as restore-info.der. Keybags contribute a count and key types,
with initialization vectors and keys left out of metadata; an encrypted
payload is refused on open; signatures and certificates are reported by
size; LZFSE and complzss payloads stay compressed; IM4R property names
are listed and their values stay redacted. Four fixed allowances refuse
excessive DER depth, element count, property count, and string length,
and inventory coverage is unknown whenever a limitation is recorded.

* fix(apple): read Image4 fields by universal tag and position

Compare universal tag numbers instead of identifier octets, so constructed
OCTET STRING and string values are recognized and reported. Read IM4P fields
by position so an unsupported payload keeps its slot and a constructed keybag
still marks the payload encrypted. Walk every constructed value once, caching
the children of header-walked values so each element is charged once, and
check large values a consumer does not decode. Report unknown restore members,
extra property and object fields and a mistyped certificate chain. Decode
UTF8String as UTF-8, accept DER sign padding on unsigned 32-bit integers, and
recognize the magic with the shared BER header decoder.

* fix(apple): read IM4P and IMG4 slots by position and keep unknown counts null

Follow img4tool and img4lib: after the payload, an optional keybag OCTET
STRING, then an optional compression SEQUENCE, then PAYP in [0]; IMG4 holds
IM4P, [0] IM4M and [1] IM4R in that order. A value outside its slot is
reported as unknown and never takes another field's role, and an EXPLICIT
wrapper holds exactly one value. An absent or undecodable description is
null rather than empty, and an undecoded keybag reports a null count and
types instead of zero; a decoded keybag counts every entry.

* fix(apple): keep Image4 compression unknown when it cannot be read

An encrypted payload without a compression field, or a declared algorithm
other than LZFSE with no recognizable magic, now reports compression
"unknown" instead of "none". Make ia5Text the single owner of the
retained-text allowance so a string too large to tree-parse is refused
rather than reported absent, keep the canonical BOOLEAN check in the
structural pass only, check the keybag's inner SEQUENCE through the shared
decoder instead of its first octet, note a manifest version other than 0,
and name the spec constants after their sources. Add a hand-encoded IM4P
golden that does not use the fixture builders.

* fix(apple): keep stopped Image4 slots and bound retained bytes

A value whose end cannot be found keeps its identifier, so a stopped keybag
still marks the payload encrypted and a stopped payload keeps its slot; the
values after it become a limitation. The IMG4 payload slot is consumed
whatever it holds, so an unsupported value does not hide the manifest and
restore slots. A property body that is not a SET or SEQUENCE is reported
instead of read as empty, and an entry whose name cannot be read is one
unknown entry whose value is never walked for more names, so restore values
stay redacted. Load a value only when it may be decoded and fits an 8 MiB
retained budget; larger primitives and values past the budget are walked by
header.

* fix(apple): keep restore properties opaque and small fields readable

A PRIVATE-tagged restore value is one property: only its name is reported,
and its value is never searched for names, even when the name is unreadable
or is IM4R. Only the IM4R property SET is walked as a container. Small
primitives are always loaded, so names and scalars stay readable after the
retained budget is used. A declared uncompressed size that is negative or
not an exact integer is reported as a limitation.

* fix(apple): reserve tree budget only for parsed values and keep PRIVATE manifest entries opaque

Reserve retained bytes only for a value that will be tree-parsed, so a
ranged wrapper around a large payload no longer uses budget a later small
indefinite value needs. A PRIVATE manifest entry must name itself; when its
name cannot be read it is reported and its value is never interpreted as
manifest facts.

* fix(apple): report MANB, MANP and IM4R entries with no body

A MANB, MANP or IM4R entry that holds only its name is a missing body, not a
confirmed-empty one, so it is reported as a limitation while sibling facts
are kept.

* fix(apple): require a SEQUENCE for named manifest entries

A context-, application- or other-tagged manifest value that begins with a
name is unsupported structure, reported as an unknown tag rather than read
as a manifest entry.

* fix(apple): assign IMG4 values to slots by position and context tag

One slot assigner owns the IMG4 layout: a context-tagged value fills the
slot with its tag number, skipping earlier optional slots, and any other
value occupies the next slot even when it cannot fill it. An unsupported
manifest value therefore no longer hides a following [1] IM4R.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>

* feat(firmware): decode ARM M-profile and RISC-V mtvec interrupt vector tables (#14421)

* feat(firmware): decode ARM M-profile and RISC-V mtvec interrupt vector tables

* fix(firmware): name vector-table exceptions per ARM variant and report unbound SVD interrupts

The architecture field now takes the ARM M-profile variant names REA uses
for raw images (armv6-m through armv8.1-m.main) plus riscv. ARMv8-M
Baseline gets ARMv6-M's exceptions; only Mainline names MemManage,
BusFault, UsageFault, SecureFault and DebugMonitor. The old armv8-m value
named Mainline faults on Cortex-M23 tables.

vtor_aligned checks the 128-byte ARMv7-M/ARMv8-M minimum and is null on
ARMv6-M, whose VTOR is optional and implementation-defined. Slots past the
end of the 32-bit address space are no longer decoded with wrapped
addresses, and an initial stack pointer that is not word-aligned is
flagged.

CMSIS-SVD interrupts without a name or with a non-integer value are
reported as anomalies instead of skipped silently, and the expanded-name
budget is charged once while parsing instead of twice with two formulas.
likely_default_stub is removed: every shared-handler group set it to true.
RISC-V limitations now cover vectored exceptions on slot 0, CLIC address
tables and the mcause numbering assumed for SVD bindings.

* fix(firmware): bound SVD anomaly diagnostics, RISC-V pair addresses, and shared budget recovery

* fix(firmware): index SVD duplicates per peripheral and admit one-slot RISC-V tables

Duplicate interrupt declarations were found by rebuilding a key that
repeats the full peripheral name for every <interrupt>, so a long name
repeated across many declarations cost name length times declaration
count. Bound names are now indexed per peripheral name, looked up once
per <peripheral>.

The 8-byte minimum held for every architecture, but only an ARM table
must start with InitialSP and Reset; a RISC-V Direct-mode table can be
one instruction. max_entries and max_file_bytes now admit one slot.

* refactor(firmware): hoist the SVD IRQ value patterns to module scope

* fix(firmware): record RISC-V pair byte extent and attribute caller input errors

* style(firmware): format the vector-table provider

* fix(firmware): add summary delivery and analysis views for vector tables

* test(firmware): check vector-table recoveries and budgets through their owners

Recovery assertions compare the delivered action with the shared refusal
formatter applied to the reported limit, instead of pinning sentences.
The summary-delivery test set REA_AGENT_RESULT_MAX_BYTES, which nothing
reads, and used a result large enough to exceed the default budget too;
it now sets REA_AGENT_RESULT_BUDGET_BYTES, asserts the reported budget,
and uses a result between the minimum and default budgets, checking that
the default delivers it complete.

The view counts active ARM entries and recognized RISC-V slots with a loop
instead of filtered copies.

* perf(firmware): count active vector slots once in the report producer

The analysis view recounted active ARM entries and recognized RISC-V slots
on every summary and page request. The producer already collects exactly
those slots as handler targets, so the report now stores
active_arm_entry_count and recognized_riscv_slot_count from them, and the
view reads the stored fields. The service checks the stored counts against
the slots once when it validates the provider's report.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(tar): compare stored symlink targets (#14964)

* fix(tar): compare stored symlink targets

* fix(tar): retain observed empty symlink targets

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* fix(ghidra): refuse over-deep caller types before Ghidra parses them (#14930)

* fix(ghidra): refuse over-deep caller types before Ghidra parses them

The 256-level type-depth bound ran only after Ghidra's C parser
returned, but the parser recurses over a declarator's pointer and
array chain. On a JVM whose stack it exhausts (Ghidra 12.2 under
WSL2), define_native_data_types surfaced the generic unclassified
provider failure instead of the resource_constraint refusal naming
the exceeded limit.

Measure the same chain from the admitted tokens before parsing:
each pointer, array, typedef, bit-field, function and composite
level adds one, base names resolve through types defined earlier
in the text and then the database, and a reference back into a
composite still being measured adds no depth. The post-parse walk
remains the authority for chains through database types a
definition fills in place.

* fix(ghidra): measure grouped declarators and separate tag depths

The pre-parse depth pass read the caller text a second time instead
of measuring the tokens admission already produced. It also counted
a typedef level for an anonymous composite, which Ghidra stores as
the composite itself, so an allowed 256-level type was refused;
kept tag and typedef depths in one map, so a typedef sharing a tag
name reset the chain later composites build on; and left grouped
declarators unmeasured, so an over-deep grouped signature still
reached the parser.

Measure the admitted tokens, track tag and ordinary names apart,
count an anonymous composite typedef as the composite, and measure
grouped and trailing function declarators. The real-Ghidra verifier
now covers the 256/257 anonymous boundary, a grouped signature
flood, and the shared tag and typedef name chain.

* fix(ghidra): measure stars behind calling conventions in grouped declarators

A convention inside a function-pointer parenthesis, before or after the
stars, made the pre-parse depth measure give up and send the chain to
Ghidra unmeasured. Conventions are now skipped around the star count in
declarators and signatures, so over-deep chains refuse before parsing.

The shared tag and typedef verifier case now asserts the conflicting
definitions refusal it actually produces, and a convention-prefixed
flood case covers the measured chain.

* fix(ghidra): fail closed on partial over-deep declarators

The pre-parse depth measure discarded an already-counted over-deep
parameter when a missing closing parenthesis made the declarator
unmeasured, sending the chain to Ghidra's parser. Partial declarator,
array, parameter, composite, and signature measurements now retain
their deepest count, so an over-deep chain refuses before parsing.

A redundant forward declaration also overwrote a completed tag depth
with 1, hiding later definitions chained through that tag. Tag depths
now never fall. The real-provider verifier covers both cases.

* fix(ghidra): separate in-progress tags and count grouped arrays

The pre-parse depth measure treated a same-named typedef as recursive
while its tag body was being measured, so the typedef depth did not
chain through the member. In-progress tags are now tracked apart from
ordinary names.

Grouped signature names also left their array suffixes unmeasured, so
an over-deep pointer and array chain could reach Ghidra's parser.
Signature measurement now counts those suffixes before expecting the
parameter list. The real-provider verifier covers both cases.

* fix(ghidra): measure arrays after each grouped declarator close

* fix(ghidra): measure trailing and nested signature declarators

* fix(ghidra): descend nested grouped declarators in depth preflight

A pointer group that itself groups the declarator, as in (*(*f)),
stopped measurement at the outer star and then threw on the inner
parenthesis, leaving the inner pointer chain uncounted. Accumulate
stars across nested groups so the whole chain is measured before
Ghidra parses it, and cover the nested case in the real-provider
verifier.

* fix(ghidra): parse caller C on a fixed stack before the depth walk

Ghidra's C parser recurses once per pointer and can exhaust a 1 MiB
thread stack before the iterative depth walk runs, so the 256-level
ceiling surfaced as an unclassified bridge exception. Parsing on a
16 MiB thread lets that walk remain the authority and report
type_depth_limit. A parser overflow on that thread is the same
refusal. The hand-rolled declarator preflight is removed.

* test(ghidra): refuse an unnamed grouped abstract declarator

The depth ceiling is measured from the parsed type, so an abstract
parameter (__stdcall *[])(void) is the same refusal as the named form.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(artifacts): keep wxapkg coverage unknown when bytes lie outside every member (#14922)

* fix(artifacts): keep wxapkg coverage unknown when bytes lie outside every member

The wxapkg reader reported complete coverage after listing its members,
even when bytes after the last member, gaps between members or unused
index bytes after the last row belonged to no entry. The reader already
accepts those layouts, so the extra bytes were hidden behind a complete
inventory.

The table reader now returns where the parsed rows end, and the domain
measures the union of member extents from there to the end of the file.
Members may share one stored range, so overlapping aliases still count
as covered. Any remaining bytes make coverage unknown, with a limitation
giving their total length, range count and first offset.

Fixes #14921

* test(artifacts): cover a wxapkg gap between members listed out of byte order

---------

Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>

* fix(deb): preserve byte-counted PAX values (#14958)

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>

* refactor(process): name the vanished procfs entry check

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(process): report exits during Linux credential reads as absence

When a process exited after its first stat read, the status and
generation-confirming stat reads fell back to a readable identity without
its UID or environment restriction. A cleanup sweep then treated another
account's exiting process as a live candidate whose run token could not
be read, and failed the command's cleanup. Route those ENOENT and ESRCH
failures through the signal-zero exit check that already owns the first
stat read.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(process): cover an unrelated process exiting during the cleanup sweep

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(cli): report argv parse failures as PARSE_ERROR

Unknown flags, missing flag values and surplus positional arguments
reported the catch-all UNKNOWN code, while a misspelled flag already
reported PARSE_ERROR. Every argv parse failure now reports PARSE_ERROR
with retryable false; UNKNOWN stays reserved for unexpected failures.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(cli): name the code for every argument parse failure

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(cli): list --columns among the global options in help (#14981)

The flag selects row fields for csv and tsv output and was already named
in command descriptions, but help omitted it. It is listed only where the
entry accepts a delimited format.

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(ghidra): report a bare selector outside every mapping as a missing procedure

A bare 0x... selector that named no procedure fell back to a file-offset
reading. When the number was also outside every mapped analysis address
and had no file-offset mapping, the failure was file_offset_unmapped and
only described the offset, so a caller who passed an address saw an
offset error and offset-only recovery. Report procedure_not_found that
names both readings instead. Explicit file-offset selectors and mapped
addresses without code keep their file-offset failure.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(ghidra): verify the bare unmapped selector rejection against real Ghidra

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(ghidra): name the failure codes for unmapped decompile selectors

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(setup): remove a deleted JSON member's line break and indentation

Removing a registration deleted the member and its separator but kept
the whitespace around it, so uninstall left an indented blank line in
files such as ~/.claude.json, and an emptied object kept its closing
indentation instead of returning to {}. The whitespace-only gap before a
removed member, and an emptied object's whitespace-only closing gap, are
now removed with it; a gap holding a comment is kept as is.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(setup): cover registration removal layout in JSON client files

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(setup): take an emptied JSONC object's trailing comma gap

Removing the last member of an object whose member ended with a JSONC
trailing comma removed the comma but kept the whitespace after it, so the
object did not return to {}. The whitespace-only gap after that comma is
now removed with the member and comma.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(ghidra): compare native value graphs by cited procedure across adapters

The real-Ghidra verifier required identical CLI and MCP dependency
graphs, including upstream Evidence IDs. An MCP session states session
limitations once and the CLI records the caller input path, so the same
analysis has different record IDs in each adapter. Each adapter now checks
that every cited ID is a linked procedure record of its trace, and the
graphs are compared with those IDs replaced by the procedures they record.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(ghidra): read complete Evidence in boundary CLI comparisons

Over-budget CLI results now deliver a summary, so comparing the CLI
function dossier with MCP read an absent normalized_result.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(ghidra): forward the caller locale to native value verifier children

The verifier starts REA with a minimal environment. Without a locale a
Linux JVM encodes file names as ASCII, so the socket boundary control's
non-ASCII runtime directory became ??? and Ghidra could not start.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* refactor: drop the unused and duplicate exports Knip reports on main

Scheduled full CI runs fail Deep static checks on Knip: dead type aliases
(InspectEspNvsInput, InspectEspNvsRequest, VectorEntryNameBasis,
LabviewArtifactVersionCoverage), module-local constants exported under a
second name (LZMA1_PROPERTIES_BYTES, IMAGE4_MAX_DECODED_PRIMITIVE_BYTES)
and a schema alias (firmwareVectorTablePageContextSchema). Remove them.
decodeLzma1KnownSize is loaded by URL from the LZMA worker and is marked
@public; the checkpoint wait floor keeps its own name for the numeric limit
verifier and is marked @alias.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* ci: run Knip in the build job on every code change

Knip ran only in the full-tier deep static job, so pull requests merged
with unused exports and the next scheduled run failed; 3 of the last 12
scheduled CI runs on main failed only on Knip. It needs the built workers
that package imports name, so it now runs in the build job after
test:prepare, where it adds the Knip run itself (about 20 s cold) to a
job every code change already runs. Its cache steps move with it and the
deep job no longer repeats it.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* ci: build the runtime in the deep static job explicitly

The deep job got dist/ only because its Knip task depended on compile.
Its Python producer suite imports the runtime, so with Knip moved to the
build job a fresh full-tier runner would fail test:python. Name compile in
check:ci:deep:tasks.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* ci(mutation): run four Stryker workers on the sweep's 4-vCPU runner (#15001)

Stryker divides concurrency between TypeScript checkers and test runners,
so the configurations' concurrency of 2 ran one checker and one test
runner. The reverse-tools sweep reached 884 of 1034 mutants before its
90-minute budget and has not completed since 2026-11-14. On four pinned
cores, a reverse-tools subset (167 mutants) took 1642 s at 2 and 801 s at
4, with identical outcomes. The workflow now passes --concurrency 4; the
configurations keep 2 for shared local machines.

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(fit): report unknown coverage when an image field was not decoded (#14986)

* fix(fit): report unknown coverage when an image field was not decoded

* fix(fit): carry an undecodable image field's reason into the coverage limitations

---------

Co-authored-by: 吴佳浩 <wujiahao@supremind.com>

* fix(labview): read section names past the declared block-info extent (#14970)

* fix(labview): read section names past the declared block-info extent

* fix(labview): count the block-info extent from the info header

A +48 word that ends before the section-start tables is a truncated
list. The fixture writes that word from the info header through those
tables, and section names still run to the end of the info section.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* fix(iso9660): read the descriptor's root record from its fixed 34-byte field (#15002)

* fix(iso9660): read the descriptor's root record from its fixed 34-byte field

* fix(iso9660): decode the descriptor root without rewriting its bytes

The descriptor root is a fixed 34-byte field. Pass that extent to the
shared record parser instead of copying the field and rewriting its
length and identifier-length bytes. Accept identifier length 2 with
bytes 00 00 only for an admitted Joliet descriptor.

---------

Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* fix(javascript): import the exact literal reader the receiverless callee uses

Main stopped importing readExactJavaScriptLiteral into the static analysis
helpers, so the merged receiverless callee check referenced an unbound name.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Signed-off-by: Deepak Jain <deepujain@gmail.com>
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Co-authored-by: Anurag Singh <iamchauhan9616@gmail.com>
Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: ASHISH PATIL <148001842+ashp15205@users.noreply.github.com>
Co-authored-by: Leo Camus <leo.camus23@gmail.com>
Co-authored-by: ShuaixinHuang <1836656514@qq.com>
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
Co-authored-by: RRFZ <247457381+Plastic-time@users.noreply.github.com>
Co-authored-by: Lewis Wang <e1430629@u.nus.edu>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Beqa <91750923+BeqaKs@users.noreply.github.com>
Co-authored-by: 吴佳浩Alben <35291372+XiaoBinGan@users.noreply.github.com>
Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Dery Ferdika <114888155+DeryFerd@users.noreply.github.com>
Co-authored-by: YALLAPPAGARI RAHUL DEV REDDY <151898247+devreddy1015@users.noreply.github.com>
Co-authored-by: Adolanium <94890352+Adolanium@users.noreply.github.com>
Co-authored-by: Afloat <ShuffleMonkey@163.com>
Co-authored-by: Ao Li <leom_0919@126.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: hhang <17309584214@163.com>
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
Co-authored-by: Pedro Cormann <136615331+pedrocormann@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
Co-authored-by: 2SinceJuly <hongjxiao@gmail.com>
Co-authored-by: Yunzhou Li <154221037+YunzhouLi-hub@users.noreply.github.com>
Co-authored-by: Syed Musa Raza Naqvi <94714949+musaraza004@users.noreply.github.com>
Co-authored-by: iamcipherdev <268238676+iamcipherdev@users.noreply.github.com>
Co-authored-by: Davmunrey <108531295+Davmunrey@users.noreply.github.com>
Co-authored-by: Benjamin Kincses <beniakiraly105@gmail.com>
Co-authored-by: Dextheking1 <Dextheking1@users.noreply.github.com>
Co-authored-by: benjaminkincses <4175097+benjaminkincses@users.noreply.github.com>
Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com>
Co-authored-by: HolyDEEW <87277682+WoWHellgarve-HolyDeeW@users.noreply.github.com>
Co-authored-by: Aadheel <adheel369@gmail.com>
Co-authored-by: aadheel <250292080+aadheel@users.noreply.github.com>
Co-authored-by: Ryan S <159389674+saariuslystoned@users.noreply.github.com>
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: Kei Ito <angila-antonia-casey@dr.com>
Co-authored-by: Thanh Nguyen <274720769+RealThanhNguyxn@users.noreply.github.com>
Co-authored-by: Deepak Jain (DJ) <deepujain@users.noreply.github.com>
Co-authored-by: jeromeskiii <145741188+jeromeskiii@users.noreply.github.com>
Co-authored-by: CyberSprout <liziye627@gmail.com>
Co-authored-by: zhuweiye <61441059+Antruly@users.noreply.github.com>
Co-authored-by: Saim Shafique <msaimshafique4664@gmail.com>
Co-authored-by: rodricksz4h5 <rodricksz2005@gmail.com>
2026-11-28 22:53:43 +08:00

English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Türkçe · Русский · Tiếng Việt · ไทย · Deutsch · Español · Français · Українська · Polski · Português (Brasil) · العربية · فارسی · Bahasa Indonesia · Italiano · Ελληνικά · മലയാളം · Roman Urdu · Română · Български

REA: Reverse Engineer Anything

One MCP for reverse engineering across binaries, applications, and runtime behavior.

See a feature you like. Understand how it works, down to the binary level.

GitHub stars Monthly npm downloads MIT license Join the REA Discord Follow REA on X Supported platforms: macOS, Windows, and Linux skills.sh

Website · Guides · Showcases

Join the REA community on Discord

Quick start · Showcases · How REA works · What you can analyze · Build RL environments · FAQ · Documentation

npx rea-agents setup

Important

Get REA from morluto/rea, rea.tools, or the rea-agents npm package. Follow the installation and release links from these official sources. A similar repository name or copied README does not establish that a download is official.


REA launching its analysis bridge inside Hopper while inspecting a native binary



Discord
Join the Reverse Engineering Community

Discord · Q&A · Show and Tell


See a feature in an app that you want in your own product? Ask your agent to investigate it with REA. It can inspect the app without its source code, explain how the feature works, show the evidence, and build a version for your project.

REA connects your agent to tools for inspecting native binaries, JavaScript and Electron apps, .NET assemblies, and websites. You can also use the same tools from your terminal. Analysis runs locally, and results include the evidence and limitations behind each conclusion.

Setup registers REA with your agent and installs matching workflow instructions. Native analysis can use an existing Hopper, Ghidra, IDA or Kuna installation; setup can optionally install Hopper with approval. Static JavaScript analysis needs no native analysis engine.

Quick start

Get started at rea.tools for step-by-step instructions by operating system, agent, and analysis provider.

Connect your agent (MCP)

With Node.js and npm installed, run this from a trusted directory outside the project you plan to analyze.

npx rea-agents setup

Choose your agent, review and approve the setup plan, then restart your agent. Setup backs up existing configuration and adds REA's MCP connection and investigation skill. See the installation guide for supported clients, plugins, manual registration, and troubleshooting.

Try asking your agent:

Understand how search works in the Notes app, show me the evidence, and build a
similar feature for my project.

Replace Notes with your target app and the feature you want to understand.

Use REA from the terminal (CLI)

Inspect an extracted JavaScript/Electron app directory or ASAR:

npx -y rea-agents@latest analyze-javascript-application /absolute/path/to/app --json

The result includes modules, imports, Electron boundaries and their evidence. Replace the path with your target, such as "D:/apps/example" on Windows.

To install the rea command for regular use:

npm install --global rea-agents
rea --help

For native analysis, configure a provider first. The CLI and Evidence guide covers provider selection, native commands, snapshots, and scripting. For Linux prerequisites, see the installation guide.

Update REA

For a global npm or Bun installation, run the updater and follow its setup instructions.

rea update

If you use npx, refresh your agent setup with:

npx rea-agents@latest setup

Review the setup changes and restart your agent. See update and uninstall instructions for package runner options and troubleshooting.

Showcases

Illustrations of the DX-Ball sound-pan, Notion clipboard-bridge, and TH04 bullet-ring showcases

DX-Ball: reconstruct a sound-pan calculation

Recover a position-to-pan helper from x86 instructions and verify the C reconstruction against 3,205 original-x86 cases and all 63 compiled function bytes.

Read the case study · Reconstruction repository

Notion: trace the Electron clipboard bridge

Follow the renderer’s clipboard API through preload and IPC into the main process to see how Notion handles rich clipboard data.

Read the case study

TH04: recover a DOS bullet-ring calculation

Recover fixed and aimed angle calculations from the PC-98 game’s 16-bit instructions and compare the reconstructed C++ with historical compiler output.

Read the case study · Reconstruction repository

If you've used REA on something interesting, we'd love to see it. Share your case in an issue or a pull request, including the target, your question, how REA helped, and what you found.

How REA works

Your agent uses REA through MCP to inspect a target and trace the relevant code. It can use the evidence REA returns to ask follow-up questions, explain behavior, or build and test an implementation. The CLI uses the same workflows.

REA investigation flow: your agent asks about a local target, REA inspects and traces it using analysis tools, and the agent uses the returned code, references and unknowns to explain, implement and test.

Open the full-size figure.

What you can analyze

REA covers native binaries, JavaScript and Electron apps, websites, .NET assemblies, Android apps, firmware, and recorded runtime and network activity.

Supported targets and requirements

For native decompilation, choose a provider that supports your target format and host OS. See choosing a deep analysis provider.

Build RL environments

Build a local environment from a recorded web session or a Linux desktop app so an agent can practice a task and check its result. Build an RL environment with REA.

FAQ

Which agents can use REA?

Any agent that supports local MCP servers. Setup configures the supported agents; other clients can use manual MCP registration.

Do I need a native analysis engine?

Deep native analysis uses Hopper, Ghidra, IDA or Kuna, depending on the target and operation. Static JavaScript and .NET inspection work without a native analysis engine. Setup can install Hopper after approval; Ghidra, IDA and Kuna use your existing installations. See provider setup for the options and their supported targets.

Do I need to start Hopper first?

REA starts Hopper when an operation needs it. On macOS, a first-run dialog may ask you to choose demo mode or activate your license. Complete that prompt in the same user session before your first CLI/MCP operation or unattended job. Open Hopper manually if needed. See Hopper startup and troubleshooting.

What does installing the skill from skills.sh do?

The skill supplies investigation instructions for your agent. Use npx rea-agents setup to register REA's MCP server and install the matching instructions, then restart your agent. See skill-only installation.

What code does REA return?

Native analysis returns pseudocode and assembly. JavaScript/Electron analysis recovers modules and their relationships. Your agent uses these findings to write and test an implementation; the showcases give worked examples.

Does REA upload my app?

REA analyzes targets locally. Your agent receives the tool results, and its model provider has its own data policy.

What should I do if I hit a bug?

Update first; a recent release may already fix it.

For a CLI installed with npm install --global or bun add --global:

rea update

For agent setup through npx:

npx rea-agents@latest setup

If you're using an agent, complete the setup refresh and restart it. Retry the same task. If the problem persists, open an issue with your REA version, target type, steps to reproduce and error output.

Documentation

Start with the website's worked guides. For exact options, prerequisites and result contracts:

Report vulnerabilities through SECURITY.md.

Community & Support

  • Discord — Ask questions and share what you’re investigating with our passionate community of over 50,000 reverse engineers and builders! Join the REA Discord
  • Twitter / X — Follow @reatools for updates and announcements.
  • Feedback & Ideas — Want a new feature or support for a file format? Open a GitHub issue or join our Discord and let us know.

Star history

🎉 400,000 GitHub stars — thank you!

Thanks to everyone using REA, reporting bugs, requesting features, testing builds, and contributing fixes.

REA contributors REA GitHub star history

Contributing

We'd love your help with REA! Open an issue to report a bug or suggest a feature, or send a pull request to improve the code or docs.

See CONTRIBUTING.md for development setup and checks. See the testing guide for verification lanes.

Disclaimer

See DISCLAIMER.md for responsible-use guidance.

The project's position on illegal or unauthorized use covers all REA versions, distribution channels, and platforms; each copy retains its applicable licenses.

REA is for lawful research, education, interoperability, software preservation, and analysis of software you own or are authorized to examine.

License

MIT

REA-authored code is licensed under MIT. Third-party material retains its own licenses and copyright notices; see Third-party notices for the dependency inventory, preserved license texts, and external-tool terms.

You must legally obtain and be authorized to use commercial tools, including IDA Pro / Hex-Rays decompilers, Hopper, and JEB, under their applicable licenses. REA grants no tool license, key, or activation entitlement. Trials and demos remain subject to vendor terms, including user, feature, automation, and output sharing restrictions. Cracked copies, stolen keys, unauthorized key sharing, and bypassing license restrictions are not authorized. This guidance does not amend MIT or third-party licenses.

Languages
TypeScript 91.5%
JavaScript 4.9%
Python 1.1%
Java 1.1%
HTML 1%
Other 0.1%