Address all four PR review findings structurally:
- Isolate concurrent Doctor probes and host subsystems in child
ArtifactResourceScope instances tracked via resources.track() so a failed
cleanup on one probe cannot deadlock or abort sibling reads before close().
- Include tests/ JS/TS helper modules and fixture path literals in
throughHelpers() and named() so changes to JS fixtures such as
fakeHopperReplies.mjs reach transitive helper and socket tests.
- Extract generic createSharedMcpSession() and reuse it in lazyLocalToolsMcp()
to preserve retryable cleanup draining and startup-failure attribution.
- Replace test-scoped createTestTempDirectory() with a file-scoped workspace
in jsonInputStatus.test.ts so the shared isolated home persists across tests.
Align REA_LOG_LEVEL=silent across CLI calls and reuse a file-scoped
lazyLocalToolsMcp() session in electronWrappedCallPaths and webSourceLocationCli,
and reuse a cleaned file-scoped home across hermesClientSetup.
Record default catalog counts and digests in recordedCatalogDigests.js, reuse
the SHA-256-verified mcp-catalog.json in default rea mcp doctor runs, move
Windows existing-project Ghidra admission constants to GhidraAdmission, defer
BinaryTargetResolver and Kuna installation probes until needed, and join
independent Doctor host/provider/identity probes via settleConcurrent.
Statically loaded JS drops 7.03 MB -> 2.07 MB (-70.6%) for rea doctor/setup
(command_ms 440ms -> 207ms, -53.0%) and 5.71 MB -> 0.85 MB (-85.1%) for
rea mcp doctor.
Project retained Go and Rust dependency metadata as deterministic, bounded CycloneDX documents with parent provenance and explicit unknowns. Share current Evidence identity admission and canonical document-ceiling recovery.
Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Add offline ELF dependency, search-path, symbol-version and import inspection with retained Evidence summaries and pages. Bound GNU-hash work and preserve cancellation, stable identity and caller-selected parameters across CLI/MCP.
Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* refactor(kernel): eliminate remaining record predicate copies and compose cleanup dependencies through shared owner
* fix(firmware,tests): remove unused cleanup import and align CI shard and CLI registration tests
* refactor(parsers): state duplicate-member policies and bring parser-json-parse to 0
* fix(domain): return duplicate members as a parseJsonWithDuplicatePolicy failure
* refactor(evm): name the worker request byte limit constant
* fix(ci): narrow false full-suite fallbacks in PR test selection
* ci: unify Go and Android lanes under CI and scope CodeQL and cache retention
* perf(ci): trim classification checkout, cache MinGW/Windows builds, and rebalance full shards
* fix(ci): calibrate PR CI health window and CI timings schedule
* perf(ci): fix script-basename substring fallbacks and trim macOS/Windows lane overhead
* fix(ci): address PR review findings across CodeQL, Windows cache key, PR health, and docs
* perf(tests): share canonical MCP catalog setup and avoid Ajv $ref expansion
* fix(ci): align selected test shard limits (50 files, max 8 shards) with 400-file cap
* fix(adb): run adb commands under owned supervision and start the adb server explicitly
The adb version probe and device commands now run through runOwnedCommand
in their own process group, keeping adb's SIGTERM-first stop through the
termination policy. A device command's escaped descendants are swept with
its cleanup, and cleanup that fails stays owned by the provider, which
retries it before its next operation.
Device operations start the adb server with an explicit `adb start-server`
first. The server is an external shared service: REA may start it but never
stops it, so a device command never forks it into its own cleanup.
runOwnedCommand gains a byte-limited stdout collector: output beyond
maxStdoutBytes is an output-limit failure, like an exceeded diagnostic
budget, and the collected bytes are kept exactly for binary protocols such
as screencap. Ownership preparation that cannot start its own helper for
lack of host capacity is reported as the command's host-capacity launch
failure.
* fix(adb): preserve completed refusals, server startup facts, and lazy server start
* fix(adb): scope runtime-root command cleanup and preserve incomplete command cleanup
* fix(adb): preserve completed bugreports and staging directories across command cleanup failures
* fix(adb): preserve bugreport command cleanup across readback failures and project live cleanup resources
Migrate the remaining 2 direct AnalysisCancelledError constructions onto cancelledBy and the remaining 14 process-snapshot stdout/stderr copy sites onto capturedProviderOutput, burning down both architecture-guard baselines to zero.
* feat(errors): carry related parameters and operations and derive CLI flags and commands
* fix(cli,errors): preserve operation-selector flags in CLI hints and clarify snapshot load/save
* fix(cli): refuse csv and tsv formats on --llms, --llms-full, and --schema
* fix(cli): validate discovery row-format refusals at the shared output boundary
* refactor(mcp): route managed operations through the session auxiliary route
Refs #11674
* fix(mcp): preserve managed session factory for fixed sources and narrow port type
* build(scripts): use JSDoc in .mjs files as the single type source
Fixes#11616
Refs #11545
* test(verify): cover sibling declaration rejection for typed scripts
Run ordinary CLI commands through REA's registry, argv parser and result owner.
Remove Incur, the second admission parse, SDK error middleware, output capture
and redundant command traversal. Preserve explicit redaction, publication
receipts, incremental output, terminal notice eligibility and drain ownership.
Migrate fixtures to real registrations and retain the derived-source notices.
Validation includes unchanged public parity goldens, public and lifecycle
regressions, repaired fixture consumers, real TTY base comparisons, exports
beyond the engine string limit, four schema catalogs and final static/docs
checks. Native provider and optional validator coverage limits are in the PR.
Fixes#11654. Fixes#10583. Refs #11682, #11476 and #10511.
BREAKING CHANGE: Markdown argument diagnostics use REA's literal escaping,
table widths and token counts. Flag-shaped unknown MCP subcommands honor the
selected format. Completion --schema/--version routes use the canonical
REA-owned hook rather than the retired SDK generator. Refresh affected literal
snapshots and regenerate completion hooks with rea completions <shell>.
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* test(mcp): observe cleanup failures at their current delivery boundary
* fix(mcp): preserve workflow completion progress through delivery
* test(setup): keep the Windows Kimi profile fixture on a supported profile
The Windows-only case at `clientConfigurationEnvironment.test.ts:226` wrote
`rea_mcp_input_schema_profile: "full"`. That profile was retired: the reader
now refuses it ("REA_MCP_INPUT_SCHEMA_PROFILE accepts only \"compact\" …"),
so `configureClientConfiguration` returned `failed/readback` before writing
and the case failed on every Windows run, including main's own
`Windows capability and package lane`.
The case has no Windows dependency — it passes an explicit `configPath` and
the Kimi write dialect is the same everywhere — so it now runs on every
platform, which is what let the stale value rot unnoticed. The fixture keeps
the lowercase explicit key the case is about, with the supported value.
Verified on `main` `d6bcfc10`: the same fixture driven through
`configureClientConfiguration(..., "win32")` on this host reproduced
`{"status":"failed","reason":"readback"}` with the retired value and now
returns `{"status":"configured"}` with `compact`. The file's 75 cases pass
here (66 run, 9 platform-conditioned skips) and `check:fast` passes.
* test(ci): restore verifier and MCP contract regressions
* test(captures): assert adapter-owned input issue field names
---------
Co-authored-by: g0at <50488370+g1at@users.noreply.github.com>
Co-authored-by: IvenKooLab <276572622@qq.com>
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
Read CLI catalogs and registrar ownership from the REA command records, type-check the catalog helper and consolidate registrar types. Preserve the generated catalogs, mapping and CLI parity.
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Own builtin refusal paths and Markdown schemas in REA. Reject retired per-command MCP before loading command registrars, preserve invoked identity, and apply token controls to the complete selected failure document.
BREAKING CHANGE: rea <command> --mcp is removed. Start REA's MCP server with rea mcp or rea --mcp.
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Move the last six bespoke Electron MCP registrations to named shared bindings, preserving admission, provider isolation, selected settings, Evidence and cleanup behavior. Remove the obsolete family module, redundant dependency bundle and final counted registration baseline.
Refs #11682 (D7).
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Hash and load an optional initial executable before GDB readiness, without running it. Preserve initial identity and completed hash diagnostics through cancellation and cleanup retry; share the file owner with Rizin.
Fixes#11581. Refs #11682.
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* refactor(cli): render help pages with REA's help owner
REA now renders the root page, every command page, help after an unknown command, the mcp group page, the mcp doctor builtin page and the completions page before incur sees argv, with incur's precedence (update check, --update without help, --mcp and the LLM manifests first; then the integrations; then --version; then root and command pages). help.ts gains arguments, custom global options, the root-only flags and integrations, and a command-list page.
The --format row on the root and command pages now lists csv and tsv (#10250), the approved difference; the mcp and mcp add pages keep the document formats they accept. Every other help byte is unchanged: 397 pages compared with incur's Help for all 196 registered commands.
Fixes#10250
* test(cli): elide the root command list wherever the root page is printed
The golden renderer chose root-page elision by case name, so help after an unknown command froze the whole command list. It now elides any stdout that opens with the root page's rea@<version> title.
* refactor(cli): answer --version, --schema and the LLM manifests in REA
src/cli/discovery.ts answers help, --version, --schema, --llms and --llms-full with incur's precedence, reading the arguments as the dispatcher receives them (after result output has adapted them, so token counts and buffering are unchanged). commandManifests.ts renders the Markdown index and full manifest, the structured manifests and the --schema document; commandSuggestion.ts ranks Did-you-mean candidates. Both are adapted from incur under its MIT licence.
--schema --format md stays with incur: incur renders it without Markdown escaping, unlike REA's renderer, and that difference awaits a decision on #11654. Compared with incur's serve for every registered command and format, 3746 of 3945 discovery invocations are identical; the rest are the 196 Markdown schemas left to incur and the three root help pages with the approved csv/tsv row.
* test(cli): pin which discovery document wins when several are asked for
Goldens for --llms with --help, --llms with --version, --llms with --llms-full, --schema with --version and --schema with --help, recorded with incur's rendering on the base branch.
* refactor(cli): report unknown commands and the update notice from REA
src/cli/updateNotice.ts owns the terminal update notice: the same trigger (terminal stdout, no explicit format), text, cache file ($XDG_CACHE_HOME/incur/updates/<package>.json), daily detached refresh through rea --incur-update-check, and opt-outs (NO_UPDATE_NOTIFIER, npm_config_update_notifier=false, CI). Discovery answers the detached refresh first, and reports an unknown command with incur's Did-you-mean suggestion, corrected invocation, help command and notice, as text on a terminal or as the error document, full-output envelope, token count or token window otherwise. outputEnvelope.ts renders these dispatcher failures.
Unknown commands with --format md stay with incur pending the Markdown escaping decision on #11654. Compared with incur's serve, 224 of 224 unknown-command invocations are identical, piped and on a terminal with a due notice.
* fix(cli): redact unknown-command guidance before rendering
Share the producing reply boundary for root lookup, unknown schemas and MCP subcommands. Preserve ordinary argument identity and existing MCP suggestion policies; omit sensitive or unsafe replay commands and redact full-output command metadata.
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>
* refactor(cli): render help pages with REA's help owner
REA now renders the root page, every command page, help after an unknown command, the mcp group page, the mcp doctor builtin page and the completions page before incur sees argv, with incur's precedence (update check, --update without help, --mcp and the LLM manifests first; then the integrations; then --version; then root and command pages). help.ts gains arguments, custom global options, the root-only flags and integrations, and a command-list page.
The --format row on the root and command pages now lists csv and tsv (#10250), the approved difference; the mcp and mcp add pages keep the document formats they accept. Every other help byte is unchanged: 397 pages compared with incur's Help for all 196 registered commands.
Fixes#10250
* test(cli): elide the root command list wherever the root page is printed
The golden renderer chose root-page elision by case name, so help after an unknown command froze the whole command list. It now elides any stdout that opens with the root page's rea@<version> title.
* refactor(cli): answer --version, --schema and the LLM manifests in REA (#11690)
* refactor(cli): answer --version, --schema and the LLM manifests in REA
src/cli/discovery.ts answers help, --version, --schema, --llms and --llms-full with incur's precedence, reading the arguments as the dispatcher receives them (after result output has adapted them, so token counts and buffering are unchanged). commandManifests.ts renders the Markdown index and full manifest, the structured manifests and the --schema document; commandSuggestion.ts ranks Did-you-mean candidates. Both are adapted from incur under its MIT licence.
--schema --format md stays with incur: incur renders it without Markdown escaping, unlike REA's renderer, and that difference awaits a decision on #11654. Compared with incur's serve for every registered command and format, 3746 of 3945 discovery invocations are identical; the rest are the 196 Markdown schemas left to incur and the three root help pages with the approved csv/tsv row.
* test(cli): pin which discovery document wins when several are asked for
Goldens for --llms with --help, --llms with --version, --llms with --llms-full, --schema with --version and --schema with --help, recorded with incur's rendering on the base branch.
registerCoreBinaryCommands already registers decompile-all; the test registered it a second time. incur overwrote the duplicate silently; REA's command table (#11680) rejects it, so every case in the file failed on main.
parseCliGlobalArguments replaces normalizeCliArguments, splitIncurBuiltinArguments and splitCliTimingArguments: it normalizes spaced output forms, routes the root --update alias, splits builtin switches and output values, and reads the timing global in one pass. The output-argument reader, the launcher's doctor path, lazy registration, the Amp scope guard, completions, mcp add, strict positionals and sensitive-value redaction read that record instead of scanning argv again. Only the incur hand-off adapter remains until dispatch moves to REA. Output is unchanged; the CLI parity goldens pass as recorded.
* refactor(cli): render command help with REA's own help owner
Add src/cli/help.ts and move the three incur Help.formatCommand callers
(rea mcp add, rea mcp doctor, rea mcp --http) onto it. Option spelling and
the unwrapped field type move to src/cli/optionFields.ts, which completion
now reads instead of its own copies. A counted incur-import guard records
the names still imported from incur so the list can only shrink.
Refs #11654
* refactor(cli): share option spelling across CLI owners and count every incur import
The argv parser, strict positionals, contract command projection and the
command registry now read the flag spelling, declared field type and count
marker from src/cli/optionFields.ts instead of their own copies. The
incur-import guard also counts namespace, default, star, side-effect and
dynamic imports, so `import * as Incur from "incur"` cannot bring a removed
owner back.
* refactor(cli): format and filter CLI output without incur (#11684)
* refactor(cli): format and filter CLI output without incur
formatCliOutput encodes TOON (@toon-format/toon), JSON, YAML and JSON Lines
itself instead of calling incur's Formatter; YAML still loads on first use.
src/cli/outputFilter.ts owns the --filter-output grammar and returns a
Result: an unclosed slice is a parse failure, so output validation reads
the parser instead of a second bracket scanner, and the parsed paths
travel with the output arguments to the result writer and JSON Lines.
@toon-format/toon moves from devDependencies to dependencies because REA
now imports it at runtime.
Refs #11654
* test(cli): pin output encodings and filter grammar with literal cases
Literal expected outputs for empty values, TOON scalars, objects and rows,
JSON-text re-indentation, nested BigInt values, JSON Lines rows and YAML,
and literal parsed paths and unclosed-slice refusals for --filter-output,
so a change to either owner fails without comparing against itself.
#11680 moved every CLI command onto registerCliCommand(cli, CLI_COMMANDS.x,
...), so the Stryker command-handler selector, which matched
cli.command(CLI_COMMANDS.x, ...), found no target for debugWithGdb and
debugWithRizin and the reverse-tools quality job failed to load its config.
The selector now matches the registry call.
Refs #11654
* refactor(cli): register every command in an REA-owned command table
* fix(cli): flag grouped fields and named selectors in each command's input binding