mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 14:59:05 +00:00
bc6f999b8b3152f1df95ad16cdb514b06aa110c7
697
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c809ee5405 | refactor(ntfs): derive attribute coverage from the recorded issue (#16983) | ||
|
|
639da1a3cf |
feat(artifacts): read ESP8266 images when the caller names the chip (#16662)
* feat(artifacts): inventory and extract ESP32 firmware images ESP32-family app and bootloader images (magic 0xE9) had no reader, so open_binary refused OTA downloads, app partitions and bootloaders. Add the esp-image container format behind inspect_artifact and extract_artifact. A pure decoder reads each byte once and keeps only fixed-size fields. Derived facts cover the chip, from a table cited to ESP-IDF v6.1; segment classification as ESP-IDF's should_map and should_load; checksum and appended SHA-256 results; app and bootloader descriptors; Secure Boot v2 signature blocks, observed and unverified; and undescribed trailing byte ranges. Truncation and undescribed bytes make coverage unknown. ESP8266 images are refused with a specific reason, and ciphertext stays unrecognized. Add the format to every target, Evidence, snapshot, live-summary and artifact vocabulary, document it, and add an optional verify:esp-images lane that compares esptool-built images with esptool image-info and espsecure signature-info-v2. Refs #3615 * test(artifacts): run the ESP image lane on esptool v5.6.0 The lane compared descriptor fields only when esptool image-info printed one, so a descriptor that REA reports and esptool does not print passed without comparison. Compare the descriptor kind in both directions. Record that the lane passed for all 13 images with esptool and espsecure v5.6.0, the version the layout facts cite, as well as with 4.12.0. * refactor(artifacts): define ESP image layout sizes once The decoder and the derived facts each defined the segment-header, appended-digest and flash-sector sizes, the erased-byte scan and the offset formatter. Define them once with the other fixed-layout structures and import them in both places. The signature slot count is the one constant that drives the slot scan. Correct the observedEnd comment: it is the end of the last chunk read. * fix(artifacts): report ESP-IDF's segment length limit by chip ESP-IDF's verify_segment_header rejects a segment of 16 MiB or more unless the chip maps flash through 32-bit cache addresses (SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP: ESP32-S3, P4, C5, C61, H4 and S31 in v6.1). Record that capability in the chip table and add a limitation for such segments; unknown chips get none. `loaded` repeats should_load. It does not mean the bootloader accepts the segment: verify_load_addresses still rejects one outside the chip's RAM, which REA does not model. Say so in the docs, the skill reference and the inventory limitation. * test(artifacts): check ESP lane tools first and verify extraction The lane started work before checking its tools, so a missing RISC-V target, ld.lld, esptool or espsecure surfaced as a raw spawn or command error. Check each one before building and name the variable to set. Warn when esptool is not v5.6.0, the release the layout facts cite. Assert each segment's class for the ESP32-C3 app, its variants and the bootloader, as the Xtensa image already did. Extract the app and the signed image through the CLI and compare every file with the bytes at esptool's segment offsets or in the appended signature sector; the source's SHA-256 must be unchanged and equal the reported root_sha256. * docs(artifacts): state what the ESP image lane does not establish The Verification section listed the lane's checks but not its gaps: only ESP32-C3 and ESP32 images come from a real producer, no real project build, OTA download or flash dump is inspected, no signature is verified, and the lane does not run in CI. Record the timing of the final lane run on esptool v5.6.0. * fix(artifacts): compare ESP segment declarations Segment entries hash only their data, so compare_artifacts reported a segment that moved to another load address with the same bytes as unchanged; only the image itself changed. Compare each segment's load_addr and data_len as its declaration, as Node SEA and PyInstaller members are compared, and count a changed declaration as a metadata change, also when content is unavailable. Header offsets are layout and the classification is derived, so neither is compared. * test(artifacts): run ESP lane commands as owned process trees The lane ran its tools through execFile. A timeout killed only the direct child, so a linker or assembler that Clang or GCC had started could keep running while the lane removed its workspace. Run every command through createVerifierCommands, check the tools inside withVerifierCleanup, and remove the workspace only after commands.close() has stopped every tree; a failed close keeps the workspace. Only a nonzero exit now counts as a refusal or an expected esptool failure; timeouts and spawn failures propagate. Supervising each command roughly doubles the lane's run time. * test(artifacts): cancel ESP decoding after its first decoded chunk The cancellation test requested cancel or close on setImmediate, which can land while the file is still being opened and checked, so it never showed that decoding had started. It also passed against a reader that ignored both requests while decoding. Acknowledge the decoder's first chunk, then cancel or close, join the operation, and assert that no later chunk reaches the decoder and that the reader ends closed. * docs(artifacts): record which ESP metadata comparison ignores Segments are compared by their declaration. The image's and the signature blocks' format_metadata are not: every field comes from their own bytes, which content comparison already covers, and a block's image_digest_matches follows the image's content. * docs(artifacts): state that ESP mmu_page_size is a base-2 logarithm The app descriptor's mmu_page_size keeps ESP-IDF's name and value, the MMU page size in log base 2 as esp_app_desc_t declares it, so 16 means 64 KiB. Say so in docs/esp-image.md and the schema comment; a reader could otherwise take 16 as 16 KiB. * fix(esp-image): retain member consumption and share lifecycle regressions * test(artifacts): scope MCP catalogs and budget full-schema validation * test(artifacts): verify compact output profiles and document bounded catalogs * test(artifacts): close readers when cleanup-test admission fails * test(artifacts): compare ESP image limitations with their owners The decoder and reader tests froze complete limitation sentences, so a harmless rewording failed them. The wording now has two owners: ESP_IMAGE_LIMITATIONS in espImageFacts.ts, which the decoder, the inventory and the reader use, and ESP_DESCRIPTOR_LIMITATIONS beside the descriptor decoder. Tests compare delivered limitations with the owner, called with the facts each case establishes (segment index, declared and available bytes, offsets, chip, page range), next to the structured assertions they already make. Delivered text is unchanged. * test(esp-image): assert structured facts and owned guidance * fix(esp-image): keep spi_flash_mode and descriptor fields before a truncated tail ESP-IDF v6.1's esp_app_desc_t declares spi_flash_mode at byte 181, after mmu_page_size, as the committed reference layout shows; the descriptor now keeps it as stored. The decoder also required all 256 descriptor bytes, though it reads none past byte 181, so a file ending in the reserved tail lost the version, project, digest and revision facts it does hold. The app descriptor now needs only its fields; the segment's truncation is reported as before. * test(esp-image): pin the P-192 public key digest to espsecure's layout espsecure packs ECDSA signature blocks as "<BBBx32sB64s64s1031x" and zero-pads a 48-byte P-192 point to 64 bytes, so the signature starts at byte 101 for every SHA-256 curve. signature_info_v2 hashes sig_block[36:101] and _digest_sbv2_public_key the curve ID with the padded point. No test built a P-192 block; this one checks public_key_sha256 against that definition. * fix(esp-image): keep each app descriptor field the file holds in full A file can end anywhere inside the 256-byte esp_app_desc_t. The decoder needed every field byte, so a cut at byte 176 dropped the version, project and app_elf_sha256 it does hold. Once the 4-byte magic identifies an app descriptor, each field is now kept when the file holds all of its bytes and is null otherwise; observed_length records where the descriptor ends, so a cut field is told apart from text that is not UTF-8. The fields after the magic become nullable in the metadata schema. * fix(esp-image): report a signature block whose image digest does not match A CRC-valid Secure Boot v2 block can carry another image's digest. The block recorded image_digest_matches false, but no limitation said so, unlike a checksum or appended-SHA mismatch, so CLI and MCP summaries showed only the generic unverified note. The mismatch is now a limitation; coverage stays complete and signature_status stays unverified. The three other signature-sector limitations move into ESP_IMAGE_LIMITATIONS with their text unchanged, so all ESP image wording has one owner. * feat(artifacts): read ESP8266 images when the caller names the chip An ESP8266 image shares the 0xE9 magic with ESP32-family images, and its 8-byte header does not name the chip, so REA still never detects one. The caller now names it with one additive explicit format, `esp8266-image`: `open_binary` `format`, or `--target-format` on `inspect-artifact` and `extract-artifact`. The native `--target-format` excludes it, because the target is an archive. With the chip named, REA reads the file as esptool v5.6.0's ESP8266ROMFirmwareImage does: the 8-byte header, the header-declared segments and the XOR checksum seeded with 0xEF. The shared streaming decoder takes the layout from the caller's format, and one domain function admits the header for the resolver, inventory classification and the decoder. Integrity, truncation and coverage follow the ESP32 rules where they apply. Segments keep `esp-image-segment` metadata and its comparison declaration, but their classification is always unknown, because ESP-IDF's should_map and should_load do not describe the ESP8266 loaders. A segment that esptool warns about, or that esptool would not write, gets a limitation, which also shows when an ESP32-family image was named ESP8266. Magic 0xEA (esptool's version 2) is refused as unsupported. The auto-detection refusal now names the explicit format. Inventory and extraction receive the caller's format, so byte classification does not reclassify the root. Contract: `esp8266-image` joins the explicit format, Evidence subject, artifact graph, snapshot target and live summary enums, and `format_metadata` gains the `esp8266-image` root kind. The ESP32 schemas are unchanged: the shared checksum and byte-range shapes are separate instances, so the advertised JSON Schema keeps them inline. * fix(artifacts): name every ESP8266 route and own the caller's root format (panel review) The refusal for an unnamed ESP8266 image told CLI users to pass `--target-format esp8266-image`, which the native commands reject. It now names `open_binary` `format` and the two artifact commands. `CALLER_SELECTED_ROOT_FORMATS`, next to the explicit-format enum, owns the formats whose root inventory must not reclassify. The CLI option, the native exclusion, the artifact selection type and inventory derive from it, and extraction derives the format from its input format instead of taking a second field. Other changes: - The 8-byte common header has one parser. - Reader messages name an ESP8266 image as one. - The lane's version 3 digest check no longer assumes the digest begins with a byte other than 0xFF. - The docs no longer call the absent digest fields established, and no longer claim that snapshots record the format. Artifact sessions cannot be saved as snapshots. - New tests cover esptool's segment-warning bounds. - The lane passed with esptool v5.6.0 and 4.12.0. * chore(plugin): regenerate the skill bundle from the authored skill * refactor(firmware): format the ESP8266 magic byte with the shared byteToHex owner Main's architecture guard admits no new inline byte-to-hex formatting; the header refusal now uses src/kernel/byteToHex. * chore(verify): record open_binary's input schema with esp8266-image CI's package build compares the committed advertised-schema summaries with the packaged catalog; regenerated with `node scripts/verify-advertised-schemas.mjs --update-summary`. * fix(artifacts): say how to read an ESP8266 image inside an ESP flash dump A partition or bootloader region of an ESP flash dump that begins with an ESP8266 image header carried the whole-file refusal, which tells the caller to open "this file" as esp8266-image. Inside a dump that file is the dump. The region now carries ESP8266_REGION_REFUSAL: extract the region, then open the extracted file with format esp8266-image. Both refusals share the reason ESP8266 images are never detected. The test follows that advice through extraction and a named read, and fails with the old message. * refactor(artifacts): skip ESP32-only decoder state for ESP8266 images --------- Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
4e93e5a8d6 |
perf(contracts): shorten the shared detail parameter description (#16823)
* perf(contracts): shorten the shared detail parameter description The detail input description is repeated on 42 tools in the default tools/list. Shorten it from 523 to 369 bytes while keeping the omitted, complete and summary semantics; delivery facts still name the budget and recovery at the point of use. Also drop a redundant inventory scan in the release-exposure container reader: both callers already pass the occurrence digest resolved through the nodeSha map. * test(schemas): refresh advertised schema summaries for the detail description |
||
|
|
d28ee2b639 |
feat(model): inspect PyTorch checkpoints and pickle opcodes statically (#16257)
* feat(model): inspect PyTorch checkpoints and pickle opcodes statically inspect_model_artifact now reads PyTorch ZIP checkpoints, legacy torch.save files and protocol 2-5 pickle streams without unpickling. A bounded static walker (protocols 0-5) reports each stream's protocol and opcode counts and every GLOBAL, STACK_GLOBAL, INST, OBJ, REDUCE, NEWOBJ, BUILD and EXT reference with its offset, marking callables outside PyTorch's tensor-rebuild allow-list as observations of what loading would import or call. ZIP checkpoints report their archive prefix, version, byteorder and serialization records and each referenced data/<key> storage; legacy files locate every storage in the file. State-dict tensors get dtype, shape, byte span and parameter counts, and names when one unshared key path reaches them. Malformed opcodes, truncation and memo misuse are target failures with their offset; max_pickle_opcodes and max_pickle_memo_entries bound the walk. Refs #3652 * fix(model): address pickle walker and PyTorch interpretation review findings - push APPENDS/ADDITEMS values one at a time instead of spreading them - replace an equal key on SETITEM(S), as unpickling does - refuse a FRAME longer than the remaining stream as truncated - decode BINUNICODE with surrogatepass and validate raw-unicode-escape text - unwrap _rebuild_parameter chains iteratively - resolve tensor key paths once per node and charge names before building them - inventory every storage persistent ID and require its storage bytes - bound archive records in the MCP summary with record_count and records_omitted * fix(model): bound pickle integers, ZIP names and keep partial facts - validate but do not convert protocol 0 integers beyond an exact long; refuse inexact memo keys - decode STRING with Python's escape rules, keeping unknown escapes - fill the format peek before classifying the file - read PyTorch ZIPs under the session member count with a bounded metadata read, charging names as they are listed - retain completed pickle facts before full-file hashing - mark tensor coverage partial when a rebuild call cannot be read * fix(model): keep Python string identity and bound dict-key work - record the exact code point sequence of strings holding Python surrogates, so distinct keys stay distinct - build each key's identity once per node, so a reused memoized key is not rebuilt per write - decode raw-unicode-escape text in bounded batches instead of one fragment per backslash run - keep the first equal key when SETITEM replaces its value * fix(model): scan raw-unicode-escape text in one pass Measure each backslash run once instead of retrying a regular expression from every backslash, and build output without a per-escape list. * fix(model): keep GGUF partial tensor data offsets non-null * fix(model): bound pickle tensor counts and validate FLOAT operands * fix(model): bound shared tensor work and read expanded views * fix(model): format the pickle changes and drop the unused ModelFormat type --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
73582aa342 |
feat(native): identify Nim, Zig, GHC, OCaml and D toolchains (#16252)
* feat(native): identify Nim, Zig, GHC, OCaml and D toolchains Add identify_native_toolchain, a static, read-only reader that reports whether a local ELF, PE or thin or universal Mach-O image was built by Nim, Zig, Haskell (GHC), OCaml or D, including stripped images without a DWARF producer. The reader searches a bounded part of the selected image for a fixed table of runtime symbol names, runtime messages, mangled names, source paths and producer strings, and returns each observed marker with its file offset, section or segment, matched text and occurrence count. Data sections are searched before bytes outside sections and before instruction sections, so a bounded scan reaches strings first; coverage reports the bytes examined. The verdict is derived from the listed markers only: a language needs two distinct markers, one strong. Conflicting, too few or no markers give unknown, and a version is reported only when a marker states it. * perf(native): order toolchain scan ranges in linear time Intersect instruction sections with the bytes outside data sections in one pass, so an image with tens of thousands of sections does not take quadratic time before the scan starts. * fix(native): bound stated toolchain versions and describe scan order Track distinct versions per marker in a Set and list at most eight, counting the rest in versions_omitted, so an image with many version strings costs constant time per match and a bounded result. A candidate reports a version only when exactly one was stated. Describe max_scan_bytes and examined_bytes as a total in scan order rather than a prefix from the image start, and place the chunk-boundary test's marker across an actual read boundary. * fix(native): keep every stated toolchain version in the report * fix(native): bound stated toolchain version bytes before keeping them * feat(native): make the stated version budget a per-call control * fix(native): give no larger-limit retry once a toolchain control is at its maximum * fix(native): do not match toolchain markers on truncated runs * fix(native): keep exact markers on a final run at the image end * style(native): format the toolchain changes --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
a37994b3e8 |
feat(artifacts): inspect MetaTrader EX4 and EX5 program headers and resources (#16501)
* feat(artifacts): inspect MetaTrader 5 EX5 program headers and resources Recognize compiled MQL5 programs by their EX5 magic and inventory them through inspect_artifact and extract_artifact. Report the program type, compiler build, copyright/link/version property slots, nonzero header fields of unknown meaning, and the resource table. List the opaque body and resource payloads as stored byte ranges; nothing is decrypted, decompressed or decompiled. Refs #16495 * feat(artifacts): read MetaTrader 4 EX4 programs with the EX5 layout EX4 (magic EX-) shares the EX5 header, property slots and resource table, so both containers become one mql-program format with a container field. The version slot is 64 bytes and the opaque body starts at 0x2E8 in both containers; the earlier 0x3A8 header length counted 192 opaque bytes as part of the version slot. EX4 type code 3 is a library; build is reported under a neutral name because its EX4 meaning is not established. * fix(artifacts): bound repeated MQL resource ranges and let tar outrank printable magics Resource records may share one payload range, and each occurrence is hashed and extractable, so the reader now charges every record against artifact_limits.expanded_bytes, as the DTBO reader does. A checksum-valid tar header now runs before the recognizers that match a printable magic at offset 0. A tar whose first member was named EX-..., GDPC... or UnityFS was claimed as an MQL program, Godot PCK or UnityFS. Slot text keeps a leading U+FEFF, which is declared content rather than an encoding mark. * fix(artifacts): refuse an invalid tar header only after leading-magic formats Only a checksum-valid tar header outranks the printable leading magics. A Godot pack can hold ustar at 257 inside its own content without a valid tar checksum; refusing that header first rejected the valid pack. * fix(artifacts): compare MetaTrader resource declarations A resource's name, kind, record index and unpacked size live in the resource table, outside the stored payload that content comparison hashes, so a renamed resource compared as unchanged. Compare them as the resource's declaration, as tar, ar and UnityFS members do. * fix(artifacts): keep unreadable MetaTrader resource names unknown in comparison |
||
|
|
472db72f3e | test(clients): share JavaScript fixture literal assertions (#16502) | ||
|
|
766c45de1d |
feat(firmware)!: replace the literal-pool and split-immediate MMIO tools with inspect_firmware_mmio
inspect_firmware_literal_pools and inspect_firmware_mmio_synthesis answered the same question and differed only in the instruction idiom they decode. One tool, inspect_firmware_mmio, now takes a single architecture vocabulary across all nine ISAs and dispatches to the literal-pool or split-immediate decoder. Both decoders write the same report: - accesses rows: instruction, address register, access kind and width, address and MIPS physical address, region kind, architectural block, and CMSIS-SVD peripheral and register facts; - a source object with the decoder's own facts: pool slot and disassembly, or pattern and high instruction; - decoder facts on the report. firmwareMmioGroups.ts owns grouping MMIO accesses by SVD peripheral, architectural block or 4 KiB page. mmioAttributionBasis owns the group basis. The retained view kind is firmware-mmio, with collections accesses, peripheral_groups and anomalies, and its summary lists the top 16 groups as compact rows. max_references and max_syntheses are removed, since max_representation_bytes already bounds the rows they counted. The literal-pool pre-allocation measurement now includes an upper bound for each group, so its refusal reports the exact required bytes. max_scan_bytes defaults to its 16 MiB maximum, so one call covers a whole application image. mmio_only, default true, now also drops literal-pool constants that are not MMIO; counts.candidate_accesses still counts every decoded access. BREAKING CHANGE: inspect_firmware_literal_pools and inspect_firmware_mmio_synthesis (CLI inspect-firmware-literal-pools and inspect-firmware-mmio-synthesis) and the retained view kinds firmware-literal-pools and firmware-mmio-synthesis are replaced by inspect_firmware_mmio (inspect-firmware-mmio) and view kind firmware-mmio. isa becomes architecture, max_svd_nodes becomes max_svd_xml_nodes, and max_references and max_syntheses are removed. Neither old tool has been released. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
0af842ad26 |
feat(firmware): disassemble RISC-V, MIPS32, PowerPC, and ARM64 split-immediate MMIO accesses (#15413)
* feat(firmware): disassemble RISC-V, MIPS32, PowerPC, and ARM64 split-immediate MMIO accesses * fix(firmware): tighten SVD interval inheritance and split-immediate register tracking * fix(firmware): bound inherited SVD block expansion and decode exact destination GPRs * fix(firmware): clear Rs across acquire-ordered ARM64 CAS and CASP variants * chore(mcp): sync advertised schema summary and budget projection with main * fix(firmware): bound CMSIS-SVD numeric widths before BigInt and index expansion * fix(firmware): keep rejected SVD addressBlocks distinct from omitted spans * fix(firmware): bound MMIO representation growth and preserve SVD ambiguity * perf(firmware): memoize SVD address lookups and pre-rank peripheral names * fix(firmware): scan a whole application image by default for MMIO syntheses On the 1.36 MB IROM segment of the MicroPython 1.24.1 ESP32-C3 image, a default call scanned 256 KiB and kept 512 of 713 matching accesses. The omitted rows were not in the retained Evidence, so the agent had to repeat the call with larger controls or page by scan_offset. Defaults now scan 4 MiB and keep up to 32,768 syntheses within a 16 MiB representation allowance, matching the literal-pool tool. Retained summary delivery still sizes what reaches the agent. The image completes in about 1 s with 4,073 syntheses. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(firmware): use MMIO synthesis maximums as their defaults directly The default scan, synthesis and representation constants only repeated their maximums, which Knip reports as duplicate exports. The budgets and the parser fallback now name the maximums. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(firmware): bound SVD match cache weight, exclude RISC-V flash, and report scan-limit stops --------- Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
04d473ca0b |
feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads (#14447)
* feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads Disassemble PC-relative literal-pool load instructions (`arm-thumb` 16-bit LDR and 32-bit Thumb-2 LDR.W, `arm-a32` LDR, and `xtensa` L32R) from local firmware images at an explicit `base_address` without target execution: - Byte-granular `PoolByteBitset` suppresses forward and backward pool byte ranges even at `4k + 2` unaligned file offsets (`base_address` ending in 2). - Two-pass Xtensa pool discovery preserves `L32R` alignment after leading or interleaved 4-byte literal pools and preserves valid `21 36 01` encodings. - Indexed `O(log M)` CMSIS-SVD disjoint `<addressBlock>`/`<register>` matching with cycle-safe multi-hop `derivedFrom` resolution, `mapped_image` bounds precedence, exact ARMv7-M/v8-M SCS sub-blocks, and `arm-a32` SoC neutrality. - Cooperative `setImmediate` event-loop yields with `AbortSignal` cancellation, complete retained Evidence with `detail: "summary"` and `inspect_analysis_view` (`firmware-literal-pools`), `max_svd_nodes` parameter budget, and field-specific `invalid_request` validation. * fix(firmware): bound SVD and candidate memory, preserve overshadowed loads, and report required_value * fix(firmware): resolve SVD derivedFrom chains iteratively and restore lifecycle test title * fix(firmware): bound Xtensa trace and SVD representation memory, make Evidence cooperative, and preserve unaligned literal loads * fix(firmware): retain completed literal-pool scans on late cancellation and avoid repeated SVD string hashing * fix(firmware): walk SVD register clusters, sweep dense overlaps linearly, and preserve XML depth recovery * fix(firmware): enforce profile-wide cooperative SVD cluster expansion budget and sync schema * fix(firmware): pre-parse SVD cluster templates, inherit defaults, and keep Xtensa framing * fix(firmware): share inherited SVD template chains and count compact arrays as single intervals * fix(firmware): replace SVD override chain links with persistent O(log K) treap * fix(firmware): default max_references to the representation-bounded maximum The IROM segment of the MicroPython 1.24.1 ESP32 image resolves 35,179 literal-pool loads. A default call scanned it and then refused at 16,384 references, so the agent had to repeat the whole scan with a larger max_references. The count is checked after scanning, and max_representation_bytes already bounds the Evidence these rows build. The default is now the maximum; the same image completes in 1.4 s with a 12 MB complete result. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(firmware): use the max_references maximum as its default directly Knip reported DEFAULT_LITERAL_POOL_MAX_REFERENCES as a duplicate export of MAX_LITERAL_POOL_REFERENCES. The budget now names the maximum as its default, and the provider test reads the default from the budget. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(firmware): preserve inherited SVD register widths and addressBlock spans --------- Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
bf7646b0c7 |
feat(firmware): classify privileged system-register, CSR, and port-I/O instructions (#14422)
* feat(firmware): classify privileged system-register, CSR, and port-I/O instructions Add `inspect_procedure_hardware_instructions` (`rea inspect-procedure-hardware-instructions`) to extract and classify architectural non-MMIO hardware instructions from `read_function_instructions` across `arm`, `arm64`, `riscv`, `xtensa`, `mips`, `x86`, and `x86_64`. - Parse provider `<nativeAddress>: <assembly>` lines through the shared native address grammar (`OBSERVED_NATIVE_ADDRESS_PATTERN` / `nativeAddressInputSchema`) without stripping 2-hex-letter mnemonics (`dc`) or discarding address spaces (`rom:0x1000`, `overlay%3Aspace:0x1000`). - Normalize conditional A32/T32 system, coprocessor, barrier, wait, and trap mnemonics (`mrcne`, `mcrgt`, `mrsne`, `msreq`, `cpsie.w`, `wfene`, `wfine`, `sevne`, `svcne`) while preserving original disassembled mnemonics, and cover AArch64 `dc`/`ic`/`at`/`tlbi` maintenance operations. - Parse complete 8-bit immediate x86 port tokens (`0x00..0xff` across `0x`, Intel `h`, `$`/`#`, and decimal syntax), keep register-selected `DX` ports as `unresolved_register`, and separate symbolic or unparsed port tokens as `unresolved_operand`. - Classify zero-source RISC-V CSR set/clear pseudo-instructions (`csrsi csr, 0`, `csrci csr, 0`, `csrs csr, zero`, `csrc csr, x0`) as `read` consistently with their canonical `csrrs`/`csrrc`/`csrrsi`/`csrrci` encodings. Refs #7955 * chore(firmware): refresh the hardware-instruction advertised schema summary The shared Evidence output schema on main now advertises its string patterns, so the summary recorded on the older base was stale. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@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> |
||
|
|
60d804050c |
feat(firmware): disassemble ARM A/R, Atmel AVR, and Motorola 68000 vector tables (#15404)
* feat(firmware): disassemble ARM A/R, Atmel AVR, and Motorola 68000 vector tables * fix(firmware): preserve legacy vector views and tighten AVR/ARM-AR bounds * fix(firmware): report truncated AVR vector slots and remove unused wrapper * fix(firmware): enforce ARM A/R LDR pc target rules and slot-based table coverage |
||
|
|
c50b1bae9d |
feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs (#14419)
* feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs * fix(firmware): preserve MCP caller inputs, x32 decoder width, and bounded ELF tallies * fix(firmware): leave M-profile variant and PPC width unresolved and report observed file size * chore(firmware): remove unused exported types flagged by knip * fix(firmware): recognize x86_64 leave;ret functions, keep uImage ppc width unknown, and preserve MIPS ELF flags * fix(firmware): preserve MIPS/ARM decoder uncertainty and partial scan stages * fix(firmware): preserve MIPS16 and microMIPS ELF ASE mode declarations * fix(firmware): admit Cortex-M vector tables with filled reserved slots The Raspberry Pi Pico SDK fills reserved vector slots with its default handler. The detector required them to be zero, so it missed the vector table and load base of the MicroPython 1.24.1 RP2040 image and offered only an instruction-census guess. Reserved slots may now hold a Thumb handler in the Reset region; any other value still rejects the table. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(firmware): identify ESP-IDF images from their header chip_id The detectors found no candidate for the MicroPython 1.24.1 ESP32 image. They have no Xtensa signature, and the chip is named in the image header. A new esp-image-header detector recognizes the ESP-IDF header at offset 0 or a ROM bootloader offset, and takes the ISA from the existing ESP-IDF chip table. The chip_id field now has one reader shared with the ESP image parser. ESP32 images report Xtensa and ESP32-C3 images RISC-V. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@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> |
||
|
|
dcc17fd75a | refactor(lint): share keyed first-match predicate patterns (#16163) | ||
|
|
4155d6d936 | refactor(lint): track ternary constraint state once per depth (#16159) | ||
|
|
369de39fbd | refactor(managed): retain verified manifest method tokens (#16147) | ||
|
|
cdf12a874d | refactor(managed): reuse parsed ILSpy import facts (#16145) | ||
|
|
e6e7420ed0 | refactor(ci): collect fixed-ceiling facts in one AST walk (#16141) | ||
|
|
d8e2593529 | refactor(managed): derive completion claim IDs from scenario IDs (#16131) | ||
|
|
07bbaee894 | refactor(verification): scan arrow return types in one pass (#16040) | ||
|
|
a05c260559 | refactor(verification): collect numeric limit assignments once (#16037) | ||
|
|
104c1c189e |
test(clients): verify native OpenCode integration against OpenCode V2 (#10178)
* test(clients): verify native OpenCode integration against OpenCode V2 The OpenCode client lane targeted OpenCode V1 (opencode-ai@1.18.35) and could not pass against OpenCode V2. The V2 skill tool names its argument `id`, so the lane's `{ name: ... }` call was rejected with "id: Missing key" and the personal skill never loaded. Bring the lane to OpenCode V2: - Call the skill tool with `id` under V2 and keep `name` for V1. - Register REA in the native `mcp.servers` table and read additional skill sources from the `skills` array; grant tool access with a `permissions` ruleset. The V1 dialect remains selectable with `REA_VERIFY_OPENCODE_DIALECT=v1`. - OpenCode V2 groups MCP tools behind its Code Mode tool by default, so the lane sets the documented `codemode: false` server option to observe the forwarded catalog as direct function tools. REA's refresh preserves that client-owned option, which the lane now covers. - Start a private server under V2. The shared background service keeps the environment it started with and would read the caller's own configuration instead of the lane's isolated one. - Isolate the home for both platforms. The lane set only USERPROFILE, so a POSIX run resolved the caller's real home for the shared skill directory. - Take the expected catalog from the runtime under test, so `REA_VERIFY_RUNTIME_ROOT` can point at an installed package whose catalog differs from this checkout. - Record the dialect, plugin-isolation mechanism and tool surface in the receipt. OpenCode V2 dropped OPENCODE_PURE, so the V1 isolation claim no longer described what ran. The lane no longer refuses Windows, so the OpenCode integration can be verified on a native Windows host. * fix(clients): isolate OpenCode verifier config and coverage claims Clear inherited OPENCODE_CONFIG and OPENCODE_CONFIG_CONTENT so the lab cannot load the caller's configuration layers. Record V2 as verified only on native Windows and leave POSIX V2 explicitly unverified. * fix(clients): pin OpenCode verifier to a full REA catalog Clear inherited REA_MCP_TOOL_FAMILIES and set REA_MCP_TOOL_CATALOG_PROFILE=full so setup and the MCP child always advertise the complete catalog the fixture asserts. * fix(ci): pin Native MCP OpenCode checks to @opencode/cli@2.2.7 The verifier defaults to the OpenCode V2 dialect, but the Native MCP registration workflow still installed opencode-ai@1.19.6 without selecting v1. Point the matrix at the published V2 CLI that supports the V2 config and --standalone. * fix(clients): harden OpenCode V2 verifier modes and launch seeds Keep Code Mode enabled for scoped-chat and assert the paginated catalog search, clear inherited REA MCP capacity/schema settings that can reject fixture calls, and accept Aube-managed shim launchers alongside the raw Node/script/mcp shape. * fix(clients): only require Code Mode catalog search for OpenCode V2 * fix(clients): clear OpenCode verifier ambient budget and Windows env aliases Unset inherited REA_AGENT_RESULT_BUDGET_BYTES so the fixture keeps complete Evidence, and delete cleared OpenCode/REA launch seeds case-insensitively before spawn so mixed-case Windows aliases cannot survive. * fix(clients): require Windows packaged OpenCode runtime and isolate V2 ancestors Document that Windows call verification needs REA_VERIFY_RUNTIME_ROOT with a matching packaged runtime, and refuse OpenCode V2 lab runs when an ancestor project configuration file would join the private server. * fix(clients): qualify POSIX OpenCode V2 coverage and dialect Windows hint Limit checked-in POSIX V2 claims to scoped-chat catalog search and point Windows preflight recovery at the selected OpenCode package major. * fix(clients): match OpenCode runtime contracts and clear registration seeds Reject a REA_VERIFY_RUNTIME_ROOT whose package version or tool catalog differs from this checkout, and clear every selected registration setting from SetupRegistrationEnvironment instead of a hand-maintained MCP list. * fix(verification): bind OpenCode fixtures to selected runtime * fix(verification): refuse discovered OpenCode plugin sources * test(verification): reject plugins before starting OpenCode * test(ci): exercise packaged OpenCode on Windows * fix(verification): type the selected-runtime fixture reader * chore(ci): use pinned npm for Windows client proof * docs(verification): distinguish Windows runner isolation * test(verification): keep compiled fixtures in the built test lane * test(verification): type catalog fixtures without generated output * fix(ci): classify automated OpenCode verification |
||
|
|
cacaefe8f8 |
refactor(api-contract): share parser heap admission (#15725)
* refactor(api-contract): share parser heap admission * refactor(errors): centralize measured heap refusals * test(api-contract): isolate parser heap regression |
||
|
|
81adf5ff74 |
fix(contracts): refuse empty enhanced selector strings (#15589)
* fix(contracts): refuse empty enhanced selector strings Empty get_call_graph, find_xrefs_to_name, trace_call_path, and batch_decompile selectors were admitted by the schema, so agents could reach the provider or record empty Evidence. Align them with the shared min(1) selector rule. * test(mcp): refresh advertised compact digests for empty selectors The min(1) admission change updated the compact input schemas for batch_decompile, find_xrefs_to_name, get_call_graph, and trace_call_path. Commit the advertised-schema summaries CI printed for those tools. |
||
|
|
925dce1ded |
fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget (#15687)
* fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget Neither tool had a detail input or a summary view, so their complete Evidence was always delivered inline: about 200-480 KB of CLI JSON for stock kernel32.dll, shell32.dll and explorer.exe, and over 1 MB over MCP. Both now follow the inspect_deb_package pattern. With detail omitted, complete Evidence is returned when it fits the agent result budget, and otherwise the retained summary with delivery facts; detail complete always returns everything, and inspect_analysis_view evidence-json pages the retained record. The CLI gains --detail and --evidence_output. The imports summary carries image identity, imphash, coverage with DLL and function counts, issue/limitation counts and one name/function_count/ delay_load row per DLL, bounded to 16 KiB of rows with an omitted count. The resources summary carries image identity, the resource directory, coverage, directory/resource/icon-group counts and resource counts by type and by language, each bounded to 8 KiB of rows with an omitted count. The byte-bounded leading-prefix rule extract_artifact's summary used is now byteBoundedList, shared by the three summaries. BREAKING CHANGE: inspect_pe_imports and inspect_pe_resources output is now complete Evidence or, when detail is omitted and the Evidence exceeds the agent result budget, the inspect_analysis_view summary with delivery facts. Callers that need the complete record inline pass detail "complete" (CLI --detail complete); otherwise follow delivery.next. Fixes #15619 * test(pe): cover byte-bounded lists and named resource identities in summaries * fix(cli): withhold an over-budget summary answer and print its paging facts The CLI printed {summary, evidence_bundle, delivery} for over-budget Evidence without measuring it, so a summary larger than a smaller configured agent result budget was printed whole. Like MCP since #15591, the CLI now measures that answer and, when it is over the budget, prints the bundle receipt and the delivery facts marked withheld, whose next call pages the saved Evidence. |
||
|
|
21a5122a9a |
fix(native)!: bound read_bytes to what a minimum MCP response delivers (#15583)
* fix(native)!: bound read_bytes to 1 MiB per call read_bytes accepted any length up to Number.MAX_SAFE_INTEGER, both in the public contract and in the Ghidra bridge request, so one call could ask a provider to allocate and hex-encode an unbounded range before any delivery budget applied. Admit at most 1,048,576 bytes per call: about 2 MiB of hex, inside the 10 MiB maximum agent result budget and the MCP SDK's default 10 MiB stdio message buffer. The contract and the Ghidra request share one MAX_READ_BYTES_LENGTH, the schema describes the bound and how to read a longer range, and the refusal comes from input admission before the provider runs. Refs #8560 BREAKING CHANGE: read_bytes refuses length above 1048576 with invalid_request on length. Read longer ranges as consecutive calls that start at the previous address plus returned_bytes. * fix(native): derive the read_bytes ceiling from the maximum agent result budget The 1 MiB ceiling was a chosen number. Each byte returns as at least two hex characters and no result can exceed MAXIMUM_AGENT_RESULT_BUDGET_BYTES, so a read longer than half that maximum could never be delivered at any budget. Derive MAX_READ_BYTES_LENGTH from it (5,242,880 bytes), so it follows that ceiling instead of a separate constant. * fix(native): size the read_bytes ceiling to a complete MCP response MCP sends bytes_hex in both structuredContent and the text block, so a read of N bytes needs about 4N bytes of response. The ceiling was half the maximum agent budget, so a full read at it could not fit the default 10 MiB MCP response and failed after the provider finished. Derive it from MINIMUM_RESPONSE_BYTES, which every server delivers, less a 64 KiB Evidence envelope reserve, divided by four (2,605,056 bytes). The boundary test now delivers a complete read at the ceiling. The compact input schema drops field descriptions, so the consecutive-call advice now lives in the tool description and the length refusal message, from one READ_BYTES_CONTINUATION. * refactor(limits): own the minimum MCP response size in the domain limits nativeByteRead derives the read_bytes ceiling from the minimum MCP response, but imported it from config, which the pure-layer boundary forbids. Define MINIMUM_RESPONSE_BYTES with the other delivery limits in src/domain/analysisResourceLimits.ts; the config parser, the byte-read ceiling, the numeric-limit verifier and tests read it there. * test(ghidra): verify read_bytes at its admitted ceiling The real-Ghidra verifier still requested read_bytes with Number.MAX_SAFE_INTEGER and with a length past the new ceiling, so it stopped on input refusal. - The boundary probe reads MAX_READ_BYTES_LENGTH, which runs past the probe's mapped bytes, so it still checks an explicit incomplete read, and refuses a length one over the ceiling. - The large-result probe reads MAX_READ_BYTES_LENGTH through MCP and the CLI and checks it is delivered complete with the fixture's bytes. The annotation and dossier probes keep covering oversized delivery with a retained reference. * test(ghidra): compare the served annotation description with its owner The real-Ghidra boundary verifier compared annotate_native_function's served description with the bare contract text. Since the open-target prerequisite is appended by describeToolPrerequisite, the check failed before reaching the read_bytes probes. Compare with the description that owner produces from the contract and its availability. * test(ghidra): run verifier probes under the shared command owner The read_bytes and large-result verifier helpers launched the CLI, ps and the compiler through promisify(execFile), outside the verifier's command owner, so a failure or timeout could leave their children running. Pass the native-value verifier's commands owner through verifyGhidraBoundaries, verifyStartupCancellation and verifyGhidraLargeResults and run every command with commands.exec. Expected-refusal checks read the owner's VerifierCommandExitError output (snapshot.stdout.text). |
||
|
|
6b57e8e17d |
fix(delivery): refuse within the budget when even the summary is over it (#15591)
* fix(delivery): refuse within the budget when even the summary is over it
When complete Evidence was over the agent result budget, MCP retained it
and delivered its summary without measuring the summary. A deb package
with many ar members, for example, produced a summary larger than the
budget it was meant to fit.
Measure the summary before retaining it. When it is still over the
budget, return a resource_constraint error that carries the same
delivery facts in details.reported_limits.agent_budget: the complete
size, the budget, the retained complete Evidence ID and the
inspect_analysis_view call that pages it within the budget. Errors are
already delivered within the budget.
The CLI path, which builds its summary separately, is unchanged.
* fix(delivery): measure the delivered answer and describe the refusal
- Measure the {summary, delivery} answer MCP sends, not the summary
alone, when deciding whether the summary fits the budget.
- The refusal's delivery note says neither the result nor its summary
was delivered, instead of reusing the summary-delivered note.
- Offer repeating the call with detail complete only for idempotent
tools; a call with effects is told not to repeat its completed call.
- Build all three delivery refusals in this file through one
responseRefusal helper, and lower the resource-constraint constructor
baseline it no longer needs.
* Merge origin/main into fix/over-budget-summary-refusal
Also lower the untyped-budget-refusal baseline for ToolResultDelivery.ts,
which now builds its refusals through one helper.
* Merge origin/main into fix/over-budget-summary-refusal
With #15638, the page delivery.next names fits the effective budget.
The deb regression now asserts the followed page is within 4,096 bytes,
and the minimum-budget paging test accepts the refusal this branch
returns when the summary answer is over the budget too, following the
same next call.
* test(firmware): select a budget the vector-table summary answer fits
The test selected the 4,096-byte minimum budget to make the complete
vector-table report over budget. At that budget the summary answer with
its delivery facts is over the budget too, so this branch now refuses
with paging facts instead. Select 12,000 bytes: above the summary
answer and below the about 18 KB complete report, so the test still
exercises summary delivery.
|
||
|
|
44fbcfc787 |
feat(evtx)!: page event records with offset and report page facts (#15636)
* feat(evtx): page event records with offset and report page facts
inspect_evtx_archive stopped walking at max_records, so records past the first 20,000 (the newest events of a default-size Application log) could not be listed. The walk now covers every record. max_records stays a 20,000-record page bound, which limits retained Evidence. A new zero-based offset selects the first record listed. The result reports page { offset, limit, returned, total, next_offset }, and the record-limit-reached diagnostic names offset=next_offset. Coverage now describes parse loss only, so a page that leaves records out by selection is no longer partial, and chunk ending facts and endpoint checks cover records past the page.
Fixes #15612
* feat(evtx)!: qualify the file-tail offset for small and wrapped logs
The suggested tail offset is now the larger of 0 and page.total minus max_records, so a log smaller than one page gets a valid offset. File order is oldest first only in a log that has not wrapped; the guide and descriptions now say how chunks[] locates the newest records in a wrapped log.
BREAKING CHANGE: inspect_evtx_archive results now require page. Evidence saved before this change has no page, and inspect_analysis_view refuses to summarise it. Re-run inspect_evtx_archive on the log to produce current Evidence.
|
||
|
|
82eebbcb1e |
refactor(javascript): share semantic map list appends (#15639)
* refactor(javascript): share semantic map list appends * chore: lower the JavaScript effect index guard baseline |
||
|
|
8ca74c46c7 |
fix(deb)!: deliver inspect_deb_package within the agent result budget (#15432)
* fix(deb)!: deliver inspect_deb_package within the agent result budget inspect_deb_package registered a retained summary view but declared no detail selector and no summary delivery, so a large .deb inventory was always inlined whole (about 790 KB for 5000 files). The tool now takes detail like inspect_nuget_nupkg: omitted detail returns complete Evidence within delivery.agent_result_budget_bytes and the retained summary otherwise, and the CLI gains --detail and --evidence_output. BREAKING CHANGE: inspect_deb_package with detail omitted now returns its retained summary when complete Evidence exceeds the agent result budget in a session that can page it. Pass detail "complete" (CLI --detail complete) for complete inline delivery. Refs #15326 * test(deb): read the retained parent without reopening the package |
||
|
|
d958391201 |
fix(mcp): serve refinement-only input rules agents need before the first call (#15437)
* fix(mcp): serve refinement-only input rules agents need before the first call - UEFI paths use the shared absolute-path schema, so the served schema carries the absolute-path pattern instead of a refinement. - Blank-text checks (guided workflow ids, prompt arguments, guidance queries, residual-unknown text) are a served `\S` pattern, not a trim refinement. - Input groups name the selector values that open them, for example `operation=architectures` for inspect_with_objdump. - inspect_native_data_type states its one-of rule in the tool description, from the same constant the refusal uses. - The served-schema parity sweep credits a cross-field rule when the description states the refusal or the selecting input group, with controls, and drops the fixed refinement gaps. Refs #15311 * fix(mcp): serve endpoint and literal rules on reduced schemas; state wider patterns - A reduced schema over budget drops name-derived fallback descriptions before its scalar rules, so analyze_web_bundle keeps its bounds. - Reduced root properties that are unions of literals serve their values as one enum (detail, format). - CDP and Inspector endpoint schemas declare the explicit-port envelope that explicitEndpointAuthority reads, as their pattern. - A pattern the portable grammar can only serve wider (`\S`, the adb serial) is also stated exactly in guidance. - The parity sweep drops the endpoint and literal gaps; the generated property accepts the host-independent absolute-path envelope. Refs #15311 |
||
|
|
184e371e04 |
fix(ida): bound each MCP HTTP reply message like stdio frames (#15436)
* fix(ida): bound each MCP HTTP reply message like stdio frames IDA over stdio refuses a reply message above 64 MiB with max_response_bytes, but IDA over HTTP read a successful JSON reply whole with readText() and JSON.parse, and an SSE stream without any limit. JEB and the agentenv driver share the same HTTP response validator and were equally unbounded. validateMcpHttpResponse, which already owns the accepted reply bytes for UTF-8 validation, now also counts each message (the whole JSON body, or each SSE event) and refuses one over the consumer's limit before the SDK buffers or parses it, closing the transport as it does for malformed UTF-8. IDA uses one message limit for stdio and HTTP and reports the HTTP refusal exactly as the stdio one: a non-retryable transport resource constraint attributed to the operation with max_response_bytes. JEB and agentenv use the same 64 MiB default. Refs #15326 * fix(ida): count SSE events across CR, LF and CRLF line endings The per-event counter only recognized LF, so a valid CR-only SSE stream was counted as one message and could be refused although every event fit. * fix(ida): count a CRLF event separator with its event and register the HTTP message ceiling A blank line ended by CR reset the event count before its LF, so that LF was charged to the next event and an event exactly at the limit was refused. The reset now waits for the possible LF. The message allowance is declared through fixedAllowanceOptions so the fixed-ceiling guard sees it, and is registered as a protocol ceiling. |
||
|
|
6625dc153b |
refactor(artifacts): share Android parser limit projection (#15469)
* refactor(artifacts): share Android parser limit projection * fix(artifacts): accept specialized parser failure facts * fix(artifacts): use the resources entry point * fix(verify): register the shared Android ceiling forwarder |
||
|
|
bdba620af3 |
fix(mcp): serve input rules agents need within every client's schema budget (#15393)
* test(mcp): check schema parity against the served tools/list Schema parity tests registered contracts on a bare SDK server, so they checked a schema REA never serves and missed the compact presentation's losses (#15310, #15311). - Add servedToolCatalog, which lists every tools/list page from a session server, and use it for parity checks in toolSchemaValidity and advertisedDialect. - Add a catalog-wide test that derives one violating value per constrained canonical field from each contract example and requires the served schema to reject it or the served description to name the rule. Today's gaps are listed by root cause; an entry that stops matching fails the test. - Remove absoluteLocalPathTools.test.ts; the catalog test covers every absolute-path field it checked. Refs #15328 * test(mcp): add a seeded property and visited fields to served parity - Generate string values for every constrained string field with a fixed fast-check seed; the refinement gaps it found (rules in .refine() with no served keyword or guidance) are listed with a violating value each. - Assert the sweep derives violations for root, nested and array absolute-path fields. - Check canonical schema validity against the contract schemas directly instead of a bare SDK server, and drop the served-listing test that validated canonicalInputSchema. - Move the reserved environment key check into the compact handler test, which now requires the served description to name the rule. - testing.md: assert parity against the served tools/list. Refs #15328 * fix(mcp): advertise the absolute-path pattern and dialect-dropped rules absoluteLocalPathStringSchema serialized as two allOf patterns, and the dialect projection kept only the first (NUL-free), so every absolute-path field advertised a schema that accepts relative paths. - absoluteLocalPathStringSchema emits one pattern: the absolute envelope over a NUL-free path. NUL is still refused first with its own message. - mergeAllOf conjoins exactly what it can: bounds keep the tighter value and negated-class patterns become one class. A pattern it cannot conjoin is named in tool guidance instead of dropped silently. - multipleOf, length bounds of 1999 or more and exclusive bounds on non-integers become tool guidance, including on nullable values. - Move the allOf merge into advertisedAllOf.ts. Fixes #15310 Refs #15328 * fix(mcp): keep defaults, scalar rules, examples and field semantics in compact schemas Compact input schemas dropped facts an agent needs for a correct first call: every default, the enums and bounds of reduced root properties, any example for reduced or pruned schemas, and the Frida cross-field rules. Name-keyed fallback descriptions also labelled fields of another type. - Tool guidance names root property defaults in one "Defaults:" sentence. - A reduced schema keeps the enum, const, pattern and bounds of each scalar root property. - A reduced or depth-pruned schema states its smallest canonical example (up to 1,024 bytes), and a pruned schema says nested fields are omitted. - Frida contracts state each cross-field rule once, as the refusal and the root description. - Fallback descriptions apply only to a property of the JSON type they describe; they move to propertyFallbackDescriptions.ts. Refs #15311 Refs #15328 * test(mcp): validate the served schema in three advertisement tests compare_artifacts sources, compare_web_captures inputs and the analyze_javascript_application source selection called a canonical or bare-server schema advertised. They now validate the served listing; canonical rejections stay on the contract parser, and the gaps the reduced form leaves are asserted with a pointer to the parity list. Refs #15328 * test(mcp): check recovery promises on an agent's first wrong calls Calls every served tool with generated wrong arguments on a session with nothing open: an unknown path key, an omitted required field, valid arguments for an active-target tool, a missing file and an unknown id. Every refusal must name only advertised tools, name open_binary for an active-target tool, give no schema remediation to arguments the served schema accepts, and claim retryable only when an identical replay can succeed. A seeded property varies the guessed key and missing path. Known failures are listed by root cause (#15309, #15312, #15323 and the active-target declarations #15350 removes); a new failure or a stale entry fails the sweep. * test(mcp): assert the served schema where tests claimed the advertisement Five tests validated the canonical schema and called it advertised, so they asserted rules the served tools/list does not carry: batch_decompile maxItems, inspect_api_contract format and view, the inspect_dart_aot length and line-terminator rules, extract_artifact uniqueItems, and examples on compare_javascript_export_shapes. Each now validates the served schema and keeps the handler enforcement. A missing rule is pinned as a known gap (in the parity sweep where it can see the field, or beside the test where the contract example leaves it unreachable), so the expectation fails once the rule is served. The parity sweep now also derives maxItems and uniqueItems violations from example arrays; it finds inspect_managed_members type_names uniqueItems. Two value-correct tests are relabelled and check the served schema too. * fix(mcp): fit every advertised input schema under Codex's 5,000-byte compaction threshold Codex compacts any MCP input schema above 5,000 serialized bytes and drops descriptions and nested structure first, so update_analysis_settings reached the model as a list of empty objects with no setting IDs. Lower the advertised input budget from 13 KiB to 5,000 bytes, bound $ref expansion separately so projection and depth pruning are judged on their result, and advertise update_analysis_settings changes as one object whose setting enum lists every ID; the canonical parser still enforces each setting's bounds. Refs #15339 * fix(mcp): address review findings across the served-schema stack Keep the recorded description, or its absence, when the deferred runtime materializes, so discovery and the loaded listing agree. Measure example guidance in UTF-8 bytes once, resolve defaults through each property's own reference scope, keep root names and types when scalar rules alone would overflow the reduced form, and decline joining negated classes that a literal hyphen could turn into a range. Served parity now counts guidance only when one sentence labels the field and states its rule, and counts uniqueItems guidance. That stricter match exposed seven gaps the loose match hid; they join their root causes, and the fixed arrayRules gap is removed. The first-contact sweep keys findings by check, checks a structured next step against the served catalog, and uses the catalog's own MCP settings. * chore(mcp): refresh advertised catalog summaries * fix(paths): keep the NUL path refusal's format reason Moving the NUL check out of the advertised pattern turned its issue into a custom refinement, so tool refusals reported reason invalid_value instead of invalid_format with expected regex. The check now raises the same format issue, and still stops before the absolute-path rule. * fix(mcp): state the optional Frida device choice and match bounds by rule The Frida device rule now says both fields may be omitted for the local device. Served parity matches a numeric bound by its direction, unit and complete value, so another bound on the same field cannot cover it. * test(mcp): stop pinning served-schema omissions in workflow tests Workflow tests asserted that the served schema accepts values runtime refuses, so serving a rule would fail them. They keep the valid-input and runtime-refusal checks; the catalog-wide parity sweep tracks what is served. * test(mcp): count a required field only when guidance requires it A sentence that only mentions a field, or a same-named key under another parent, no longer covers a missing required rule. Guidance must state the requirement about the field's full path, or state a shape listing every required key of the field's parent. * test(mcp): credit a served rejection only to the rule that failed The parity sweep counted any served rejection as coverage, so a probe that also broke another rule (a too-long locale that breaks its pattern) hid a missing bound. Served validation now reports every failing keyword, and a rejection covers a rule only when that rule's served keyword fails. |
||
|
|
0e07a3c876 |
fix(delivery)!: deliver over-budget results and errors inside the agent result budget (#15396)
* fix(mcp)!: deliver over-budget delivery facts inside the structured result
Codex and VS Code forward only structuredContent to the model, and Gemini
CLI and LangChain forward only the text blocks; _meta reaches no model. An
over-budget result put its delivery facts in a second text block and in
_meta, so Codex and VS Code agents received a summary with no sign that it
was one.
An over-budget result is now {summary, delivery} in structuredContent,
the shape the CLI already prints, and its one text block is that value's
serialization. The delivery layer owns the alternative: every budgeted
operation's registered output schema admits it, so canonical and compact
advertisements validate the result.
An overflowing completed result no longer picks its recovery by tool
name. The producer declares an overflow recovery (stateless, retained or
committed, with its next call and identities): list_unknowns,
get_evidence_bundle, inspect_address_context and committed unknowns
declare theirs in their bindings, and retained Evidence declares its own.
Undeclared results fall back to the contract's effects. Only a CLI
contract that reads no session is told to use its `rea` command, so
session reads and committed mutations are never told to use CLI JSON.
BREAKING CHANGE: When a budgeted tool's omitted detail returns a retained
summary, structuredContent is {"summary": <summary Evidence>, "delivery":
<delivery facts>} instead of the summary Evidence, the second
{"delivery": ...} text block is gone, and _meta["rea/agent-budget-delivery"]
is no longer set. Read the summary from structuredContent.summary and the
delivery facts from structuredContent.delivery (or the same members of the
text block). Pass detail "summary" or "complete" to receive Evidence at the
root as before.
Refs #15338
Refs #15326
* fix(delivery)!: deliver every error result under the agent result budget
A failure whose text exceeds delivery.agent_result_budget_bytes is now
retained whole as Evidence (mcp_tool_error in the MCP session,
cli_command_error in the CLI's private cache) and replaced by a bounded
summary. The summary keeps the code, category, retry, recovery and
remediation and every detail field that fits, names the fields it left
out, and carries details.failure_delivery with the inspect_analysis_view
call that pages the complete failure. Non-Evidence facts such as a
mid-extraction artifact inventory were previously inlined whole.
The transport's unretained string-ceiling fallback no longer points at
complete CLI JSON output.
BREAKING CHANGE: An MCP error, or a one-shot CLI failure without
--evidence_output, larger than the agent result budget is delivered as a
bounded summary: oversized details fields are listed in
details.omitted_details instead of being inlined, and
details.failure_delivery names the retained failure Evidence and the
inspect_analysis_view call that pages it. Pass detail complete (CLI
--detail complete) for the complete failure inline, or raise
delivery.agent_result_budget_bytes.
Refs #15326
* fix(delivery): keep overflow recovery from repeating effects or losing the session target
A retained overflow no longer offers the CLI command: the retained record is the complete result, and a call with effects is told not to repeat it. The CLI fallback for an unretained result excludes session tools. The MCP result guarantee is limited to successful results. The schema validity test selects the complete-result alternative of a budgeted output schema.
* fix(delivery): keep failure summaries schema-valid and CLI failure retention self-contained
boundedFailureSummary restores the details a code's schema requires. The CLI retains the failure as it was before its partial observation was summarized, so the record does not depend on a partial file the cache could evict, and a cache write that commits before failing or leaves cleanup incomplete keeps its receipt and cleanup owner.
* fix(delivery): retain the delivered CLI failure with its complete partial restored
* fix(delivery): budget CLI-enveloped failures through the envelope's owner
Provider-backed CLI commands wrap the canonical failure in their error envelope (a label and input diagnostics). The strict projection schema rejected the wrapped failure, so an over-budget failure printed whole without being retained. The envelope's owner now splits it; delivery budgets the canonical failure and keeps the envelope fields on the bounded result. CLI logging uses the same splitter instead of its own destructuring.
* fix(cli): print a bounded failure's retrieval facts on a terminal
A failure bounded to the agent budget carries its retained record and paging call in details.failure_delivery. The terminal presentation printed only the concise error for it, because its preserved-Evidence check did not know that field. It now does, so the structured failure is printed whole.
|
||
|
|
1c00958431 | fix(android): advertise portable DEX descriptor patterns (#15392) | ||
|
|
4d84c6919f |
fix(frida): recover detached sessions and report why Frida detached them (#15357)
* fix(frida): give detached and unknown sessions lifecycle recovery A session whose target detached was refused with the unknown-session error, "No open Frida session; start one with start_frida_session", although the session is still held, frida_session_status still returns its remaining messages and close_frida_session must still release it. Following the advice abandoned the session and its messages. load_frida_script and resume_frida_session now refuse a detached session with a capability refusal naming frida_session_status, then close_frida_session. Unknown session and script IDs conform to the input contract, so their recovery names the lifecycle tools instead of schema guidance, matching the gdb and rizin session errors. Refs #15329 * fix(frida): track session phase and report why a session detached ManagedSession kept attachment as a `detached` boolean beside `cleanupStarted` and `resumeAfterDetachPending`, and the `detached` signal handler ignored Frida's (reason, crash) arguments, so an agent could see that a session detached but not whether the target exited, crashed, or the connection dropped. The session now has one phase: attached, detached with its detachment, or closing with the detachment seen so far and whether a paused spawn still owes a resume. The signal arguments are parsed at the native boundary; a detach seen only through isDetached() is recorded as `unobserved`. frida_session_status, start_frida_session and instrument_with_frida report an optional `detachment` with Frida's reason and crash summary, and the detached-session refusal names the reason. close_frida_session cleanup is unchanged. Refs #15329 * fix(frida): report whether a retained crash summary was truncated A crash summary is bounded to 4096 bytes; detachment output now carries crash_summary_truncated so a clipped summary is not presented as complete. The detached-session test also proves messages captured before the detach stay readable. Commits the advertised schema summary for start_frida_session. * docs(frida): state why the crash summary bound is fixed * fix(frida): keep Frida's one-line crash summary complete instead of capping it The 4096-byte cap had no format, protocol or resource reason, and cutting the summary left no way to read the rest. The summary is now kept whole apart from credential redaction, so the truncation flag and constant are removed. |
||
|
|
2d1748117e |
fix(browser): redact literal credentials in browser scenarios unless retained (#15347)
* fix(browser): redact literal credentials in browser scenarios unless retained capture_browser_scenario records the scenario in Evidence parameters as written. A literal Authorization header value or cookie seed therefore stayed verbatim in Evidence, while the same record's network events redacted it. Literal values of transport-credential headers (isTransportCredentialHeader) and cookie seeds are now redacted like declared secrets. One domain owner, scenarioLiteralCredentials, lists them with their redaction identities; the capture session adds them to its redaction set, and Evidence parameters and scenario_sha256 record the redacted scenario. A caller that wants the literal kept sets retain_literal_credentials: true. Other literals stay ordinary evidence; secrecy is not inferred from names. Refs #15340 * test(browser): assert whole-value redaction instead of any change not.toBe(value) also passed for partial redaction, such as a marker appended with the secret left in place. Assert that each redacted value is exactly one marker and that no fragment of the secret or its JSON-escaped form remains in text, bytes, URLs or protected response bodies. Refs #15340 * fix(browser): redact the trimmed spelling of padded literal credentials and commit the schema summary * fix(browser): treat a credential header's prefix as part of its literal credential and retain fingerprint fixtures * fix(browser): keep the bare literal token redacted beside the prefixed header |
||
|
|
d09fa76eca |
fix(debuggers)!: report the inferior disposition that debugger cleanup established (#15353)
* fix(debuggers)!: report the inferior disposition that debugger cleanup established The shared owned-debugger stop returned `stopped` or `already_exited` without saying what happened to the inferior, so close_gdb_session re-derived a local target_state (reporting a verified -target-detach as "unknown") and close_rizin_debug_session always returned the literal "unknown". The stop result now carries one InferiorDisposition (none_observed, detached, exited, or unknown with the provider's reason), mapped once from the recorded detach outcome. `stopped_inferior_unknown` is folded into it. Providers report a verified state through `verifiedInferior` (replacing `inferiorStateUnknown`), and a detach whose identified inferior then ended reports `inferior-ended` instead of `no-inferior`. GDB tracks its verified inferior state as a union instead of a boolean, so the detach that close performed is still reported after the debugger stops. Both close tools return `target_state` from the stop result. Refs #15324 BREAKING CHANGE: close_gdb_session and close_rizin_debug_session output `target_state` is now one of none_observed, detached, exited or unknown. close_gdb_session previously returned only none_observed or unknown; close_rizin_debug_session always returned unknown. Clients that validate output against the previous schemas must accept the new values; `unknown` keeps its meaning (the debugger was terminated without a verified detach, so the inferior may still be running). * test(debuggers): type the lifecycle close fake with the full inferior disposition * test(debuggers): commit close schema summaries and prove what a failed close keeps Commits the advertised schema summaries for close_gdb_session and close_rizin_debug_session. The GDB manager test now asserts the close itself stopped the owned process, and the external-mutation lifecycle test asserts a command refused behind a failed close is that retained cleanup blocker and never reaches the debugger. |
||
|
|
fbfcad3152 |
fix(evidence): route web script export and WASM comparison through shared Evidence inputs (#15385)
* fix(evidence): resolve web script and WASM comparison sources through the shared Evidence input owner export_web_scripts accepts its capture as declared Evidence input: a complete record, a retained reference, or a retained inspect_analysis_view summary, which reads its retained parent. compare_wasm_interfaces admits both sides through resolveEvidenceRequest, so a malformed side is a bounded evidence_integrity_mismatch and a summary reads its parent. The summary-to-parent rule lives in the shared resolver as completeProducers. A catalog test checks that every declared Evidence input resolves a retained reference through the shared resolver. Refs #15341 * fix(evidence): retain an inline web script capture before publishing and commit the schema summary |
||
|
|
3e3c2ba1cc |
feat(artifacts): inspect SWF and extract embedded payloads (#15264)
Inventory FWS and CWS files through the shared artifact reader. Preserve the carrier and normalized identities, top-level tag counts, and individual DefineBinaryData occurrences. Use the existing selected-extraction pipeline and per-call artifact admission controls. Refs #3614 Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
3f6260249c |
fix(api-contract): report structured retained-facts allowance (#15256)
* fix(api-contract): report structured retained-facts allowance * fix(limits): track contract retention as a pending resource policy --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
bd6ff678c4 |
feat(artifacts): inventory standalone Unix ar archives offline (#15224)
* feat(artifacts): inventory standalone Unix ar archives offline * test(artifacts): align standalone ar assertions and comparison docs * fix(artifacts): preserve ar names, admission and permission uncertainty * chore(contracts): refresh ar admission schema summaries * fix(artifacts): handle GNU thin references and exact name budgets * perf(artifacts): cache ar name-table observations --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
aea385cda1 |
feat(evtx): inventory Windows event log records offline
Inventory EVTX file, chunk and record headers with source-scoped identities, full timestamp precision and explicit partial coverage. Discover the reader from first-contact inspection. Refs #9174. |
||
|
|
a5aee4f9e9 |
feat(artifacts): inventory Android super image metadata (#14928)
* feat(artifacts): inventory Android super image metadata Refs #14391 * fix(artifacts): preserve partial Android super metadata evidence * fix(artifacts): recognize Android super PE overlays Refs #14928 * fix(artifacts): reject an Android super device with no usable sector A first usable sector at the device size was accepted, so extent checks reported a different field. Keep stored copy failures to malformed, truncated, and unsupported now that format failures include unrecognized. * fix(artifacts): preserve Android super partial evidence on budget exhaustion * fix(mcp): preserve existing provider partial observation contracts --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
81657ccede |
fix(analysis-view): return continuation for GPU pages at the byte limit (#15206)
* fix(analysis-view): return continuation for GPU pages at the byte limit * test(analysis-view): admit GPU pagination requests through the schema * fix(analysis-view): reuse shared byte-bounded GPU pagination |
||
|
|
6ec105be6d |
fix(screenshots): report the PNG comparison memory allowance (#15217)
* fix(screenshots): report the PNG comparison memory allowance * style(screenshots): format memory allowance assertion |
||
|
|
31cec30f51 |
fix(android): declare Android mapping and JNI fixed allowances (#15183)
* fix(android): declare Android mapping and JNI fixed allowances * fix(android): avoid ineffective JNI allowance recovery advice --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
6c7dffc59b |
fix(json): classify JSON input heap headroom and string-ceiling refusals (#14949)
* fix(json): classify JSON input heap headroom and string-ceiling refusals Mark live V8 heap-headroom refusals in JsonInputFile as measuredExhaustion, bind single-string runtime and serialization ceilings in JsonInputFile and JsonAuthenticationHeadroom to registered representation allowances, and remove all 4 entries from untyped-budget-refusal-baseline.json (Refs #14234). * test(json): inject runtime probes instead of mocking node:v8 --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
6f36de3012 |
feat(ghidra): admit raw 8051 images (#15057)
* feat(ghidra): admit raw 8051 images Add 8051 as a raw-only architecture: byte-aligned entry, mapping within 0x0000..0xffff, analyzed by Ghidra with 8051:BE:16:default in the CODE space. Hopper, IDA, Kuna and Windows Ghidra P0 keep refusing it. Document the lane, including that bank-switch thunks and Keil ?C?CCASE switch arms are not followed by auto-analysis and need REA_GHIDRA_SEED_FILE entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(mcp): update the advertised open_binary schema summary for raw 8051 The architecture enum gained 8051, so the committed input schema digest for open_binary changed. Regenerated with `npm run verify:advertised-schemas -- --update-summary`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ghidra): pin the 8051 CODE binding and correct the 8051 docs - Assert the 8051 language binding (8051:BE:16:default, CODE) and that load-image attestation requires the CODE default space; replacing CODE with ram now fails three tests. - Assert that Windows Ghidra P0 refuses raw 8051. - Derive the raw-binary architecture refusal from BINARY_ARCHITECTURES with Intl.ListFormat; the wording, and so the admission grid digest, is unchanged. - Docs: list the memory blocks Ghidra really creates for 8051 (no external RAM block), explain bank addressing for paged banks and the entry-decode requirement, state when the seed file is read, and add 8051 to the n64 guide's family list. Fix a duplicated "and" in the generic-language limitation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Alex Petrochenko <5717309+petrochen@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |