A plugin install has no `rea setup` registration to carry a WABT
tool directory, so the only way to enable inspect_wasm_artifact was a
client-wide environment variable, even though #3016 persisted the other
host-stable tool paths.
Add REA_WABT_BIN_DIRECTORY to PERSISTED_SETTINGS and the environment
schema as an absolute path, so `rea config --set`,
`rea config --get --json` and startup precedence (env > config > auto)
behave like REA_ILSPY_CMD_PATH and HOPPER_LAUNCHER_PATH. The value is
merged into the effective environment before the WASM provider reads it,
so no provider change is needed. Setup still leaves saved values in the
file rather than copying them into a client registration.
* 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.
The fixed 128 MiB ZIP Zstandard window allowance refuses the read at
admission, which #15588 reports as resource_constraint. The test still
pinned partial through a ternary keyed by the fixture size.
* fix(errors)!: report wrong-format, missing-file and missing-Evidence refusals by their cause
- inspect_labview_artifact refuses a file with no LabVIEW RSRC data as an
unrecognized target (code unsupported_target, failure_kind unrecognized),
as its format siblings do, instead of invalid_request. A PE whose
resource tree could not be fully read is a malformed PE target.
- inspect_gpu_code_objects, inspect_model_artifact and Apktool reported a
missing or non-regular selected file through their own copy of the
selected-file refusal (BinaryTargetError, target_unavailable). They now
use the shared projectSelectedArtifactFileFailure owner
(invalid_request, conforming, with its own next step), and the copy is
removed. The shared owner keeps the verified-symlink recovery the copy
carried.
- A retained Evidence reference the session does not hold is
invalid_request / invalid_input instead of evidence_integrity_mismatch.
Altered or unauthenticated Evidence stays evidence_integrity_mismatch.
BREAKING CHANGE: error codes change for three refusals. A non-LabVIEW
file given to inspect_labview_artifact is unsupported_target (was
invalid_request). A missing or non-regular selected file for
inspect_gpu_code_objects, inspect_model_artifact or Apktool operations is
invalid_request (was target_unavailable). A missing retained Evidence
reference (details.reason "missing") is invalid_request with category
invalid_input (was evidence_integrity_mismatch / integrity_mismatch).
Callers that branch on these codes should match the new values;
details.reason, retry_class and the remediation are unchanged in meaning.
* test(model): expect the shared selected-file refusal for a missing model path
The process-global host read failure test still expected
target_unavailable for path errors on a model file. Those are now the
shared selected-file input refusal.
* fix(resources): name a rejected symlink in the shared selected-file refusal
The GPU and model readers' copy of the selected-file refusal said the
path was a symbolic link; the shared owner reported only ELOOP, so
rejectedSymlinkRecovery failed once they moved to it. Use the rejected
symlink's own message, and keep the errno message for every other
selected-path refusal.
* docs(errors): describe missing references and closure members as the caller's selection
The comment above RESOURCE_SNAPSHOT_NOT_APPLICABLE still said a missing
Evidence reference stays an integrity failure. Missing references,
including retained sources and closure members, are invalid_request; only
altered or unauthenticated Evidence stays an integrity failure.
* fix(artifacts)!: report reader admission limits as resource_constraint
An artifact read refused by a reader limit (artifact_limits.*) or a
release-fixed allowance was code partial, which the error contract
reserves for a result cut short by a delivery or decode limit. The
read was refused at admission, so it is now resource_constraint, like
every other admission limit. The retry class is unchanged: change_first
when the limit can be raised, never when it cannot. A limit without
admission facts, such as a parser budget, stays partial.
The reader's own recovery, which names the parameter, its supported
range and the next step, and the reader_limit fact are unchanged.
Refs #15323
BREAKING CHANGE: artifact refusals with details.reason "limit" and a
details.reader_limit or fixed allowance report code and category
resource_constraint instead of partial. Match resource_constraint, or
read details.reason and details.reader_limit, which are unchanged.
* fix(errors): catalogue each artifact admission limit with the retry it returns
The catalogue listed one row for reader limits and fixed allowances with
change_first, though a fixed allowance and a reader limit already at its
maximum return never, and the release-fixed row still said partial.
List the raisable reader limit, the reader limit at its maximum and the
release-fixed allowance as separate rows, and test each row against the
error it projects.
* fix(desktop): recognize unpacked resources/app Electron applications
Electron loads an application from resources/app.asar, resources/app or
resources/default_app.asar. The desktop path convention recognized only the
ASAR names, so VS Code and GitHub Desktop, which ship an unpacked
resources/app folder, got no Electron candidate and only .NET probes for the
managed helpers they bundle.
The convention owner now reports the Electron application layout and its
depth for both forms. inspect_desktop_application emits an
electron-app-directory-convention fact for resources/app/package.json, adds it
to the Electron candidate and offers analyze_javascript_application on the
folder. Electron application probes are now application priority, so bundled
managed or native helpers no longer lead next_probes. Release exposure reads
the layout folder from the same convention, so an unpacked build names its
fuse host like an ASAR build.
* fix(desktop): derive Electron probes before bundled managed helpers
A bundled managed helper with its own .runtimeconfig.json, such as Git
Credential Manager in GitHub Desktop, is application priority too. Its probe
was derived first, so the stable priority sort still put it ahead of the
Electron application. Derive the Electron candidate and probes first.
* test: fix false-pass assertions, consolidate suites, and close coverage gaps
* test: finish signal-0, unchecked close_binary, and vacuous .every() audit
* test(registration): run shared capture inside test so child inherits scaled deadline
* test(artifacts): bind final verification fault to reader source and post-read phase
"keeps its CLI-only options out of the contract input" ran for every
contract command, but 121 commands have no CLI-only options, so their loop
asserted nothing. Run it only for commands that have them, and assert that
list is not empty.
"never auto-detects a DOL without the caller's format selection" only
asserted when parsing succeeded. Without a selection the DOL is refused as
an unsupported binary format; assert that refusal.
Replace bare toThrow() across the MCP, CLI and other boundary tests, the
Hopper and fixture conformance verifiers, the evaluation guards and the
process-global tests with the SDK cancellation code and reason, schema
issue paths, tagged error reasons, cleanup facts, errno codes and
verifier messages each case is meant to refuse.
When header detection admitted no route for a file, open_binary and
inspect_artifact refused it with the generic "select a supported,
well-formed target", leaving no next step for a headerless firmware or
memory image. The explicit raw-binary load is the only route that admits
such a file, so the producer now names it with its required architecture
and entry_point. inspect_artifact shares the same detection, so it is
not offered as a way to identify the file.
Refs #15319
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(errors)!: make retry_class the only retry field of a target failure
A target failure reported two retry fields: its own `retry` hint
(`none | backoff | after_change`) and the `retry_class` every error
carries. They mapped one to one, so readers had to reconcile both.
`retry_class` is now the single owner: the target-failure table declares
it directly, the projection no longer emits `retry`, the error schema no
longer accepts it, and the CLI recovery rewrite reads `retry_class`.
BREAKING CHANGE: target failures no longer include `retry`, and the
error schema rejects it. Read `retry_class` instead: `backoff` is
`same_call`, `after_change` is `change_first` and `none` is `never`.
* test(errors): readers reject the removed target-failure retry field
* 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.
Since #15385 export_web_scripts takes exactly one of capture_path or capture, so neither is required alone and the parity check's argv builder supplied no capture source; the contract refused the input. The check now selects the positional capture file.
* fix(artifacts): refuse an unusable extract_artifact output_root before scanning
extract_artifact checked output_root only when it created the output tree,
after scanning the whole archive and preparing its reader. A destination
that already existed was refused there, and the refusal carried the
archive's complete inventory as its partial observation: 1.7 MB of error
text for a 2,000-entry ZIP.
The read-only SafeOutputTree.checkDestination admission, which firmware
and environment-bundle extraction already use, now runs before the archive
is read. SafeOutputTree.create still rechecks and acquires the destination
exclusively, so a destination that changes after the early check is still
refused there.
Refs #15326
* fix(artifacts)!: report a refused extract_artifact output_root as caller input
A destination refusal on extract_artifact is now an input error on
output_root, as firmware, UEFI, script and bundle export report theirs.
Every destination refusal conforms to the input contract and names the
fix instead of pointing at the schema.
BREAKING CHANGE: extract_artifact reports a refused output_root as
invalid_request with an issue at output_root (CLI: outputRoot) instead of
artifact_operation_failed with reason path. Destination refusals of
extract_firmware, UEFI extraction, export_web_scripts,
export_environment_bundle, environment-export/build and desktop build
exports no longer carry recovery.kind inspect_input_contract; read
remediation.action and details.issues instead.
Refs #15326
* test(artifacts): expect the caller-input refusal for a refused extract_artifact output_root
The provider extraction boundary tests still asserted ArtifactOperationError reason path, the shape this change replaces; they now expect AnalysisInputError with an issue at output_root.
* test(artifacts): prove extract_artifact refuses the destination before reading the source
* 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.