rea-agents 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/README.md +144 -58
  2. package/bridge/ghidra/ReaGhidraBridge.java +2075 -0
  3. package/bridge/hopper_bridge.py +13 -3
  4. package/dist/application/AbortablePromise.js +25 -0
  5. package/dist/application/AnalysisProvider.js +3 -0
  6. package/dist/application/AnalysisProviderEvaluation.js +60 -0
  7. package/dist/application/AnalysisProviderRegistry.js +228 -0
  8. package/dist/application/AnalysisSnapshotCache.js +41 -21
  9. package/dist/application/AnalysisSnapshotFiles.js +5 -6
  10. package/dist/application/BinarySession.js +229 -102
  11. package/dist/application/BrowserEvidence.js +87 -15
  12. package/dist/application/BrowserObservationService.js +65 -1
  13. package/dist/application/CapabilityInventory.js +7 -0
  14. package/dist/application/ClientConfigPath.js +33 -0
  15. package/dist/application/CompositeProvider.js +20 -8
  16. package/dist/application/CrossVersionInventory.js +16 -3
  17. package/dist/application/CrossVersionInvestigation.js +17 -62
  18. package/dist/application/CrossVersionInvestigationEvidence.js +64 -0
  19. package/dist/application/CrossVersionInvestigationReplay.js +170 -0
  20. package/dist/application/DirectAnalysis.js +49 -35
  21. package/dist/application/Doctor.js +70 -13
  22. package/dist/application/ElectronEvidence.js +35 -0
  23. package/dist/application/ElectronObservationPort.js +1 -0
  24. package/dist/application/ElectronObservationService.js +46 -0
  25. package/dist/application/EnhancedTools.js +1 -1
  26. package/dist/application/EvidenceLedger.js +5 -2
  27. package/dist/application/InvestigationProviders.js +11 -0
  28. package/dist/application/JavaScriptArtifactAnalysis.js +299 -0
  29. package/dist/application/JavaScriptArtifactAnalysisTypes.js +1 -0
  30. package/dist/application/JavaScriptArtifactFiles.js +231 -0
  31. package/dist/application/JavaScriptArtifactGraphAccumulator.js +54 -0
  32. package/dist/application/JavaScriptArtifactGraphBuilder.js +101 -0
  33. package/dist/application/JavaScriptArtifactGraphContext.js +205 -0
  34. package/dist/application/JavaScriptArtifactGraphDocuments.js +108 -0
  35. package/dist/application/JavaScriptArtifactGraphEvidence.js +89 -0
  36. package/dist/application/JavaScriptArtifactGraphFindings.js +271 -0
  37. package/dist/application/JavaScriptArtifactGraphStructure.js +409 -0
  38. package/dist/application/JavaScriptArtifactReconstruction.js +74 -0
  39. package/dist/application/JavaScriptArtifactReconstructionInput.js +99 -0
  40. package/dist/application/MacHopper.js +20 -4
  41. package/dist/application/PermissionAuthority.js +30 -0
  42. package/dist/application/ProcessCaptureLifecycle.js +2 -6
  43. package/dist/application/ProcessHarness.js +13 -7
  44. package/dist/application/ProcessSampling.js +59 -8
  45. package/dist/application/ProjectPermissionStore.js +1 -0
  46. package/dist/application/ReferenceSourceImport.js +13 -16
  47. package/dist/application/SessionProviderRouter.js +219 -0
  48. package/dist/application/Setup.js +153 -70
  49. package/dist/application/SetupClients.js +8 -5
  50. package/dist/application/SetupInstallFailure.js +24 -0
  51. package/dist/application/SetupPlan.js +19 -8
  52. package/dist/application/SetupSkill.js +20 -3
  53. package/dist/application/SupportedClients.js +40 -16
  54. package/dist/application/Uninstall.js +20 -7
  55. package/dist/application/Upgrade.js +15 -4
  56. package/dist/application/runtime.js +9 -6
  57. package/dist/artifacts/AsarArtifactReader.js +23 -3
  58. package/dist/browser/CdpBrowserProvider.js +158 -53
  59. package/dist/browser/CdpCaptureCompleteness.js +90 -0
  60. package/dist/browser/CdpCaptureDocuments.js +180 -21
  61. package/dist/browser/CdpCaptureEvents.js +342 -43
  62. package/dist/browser/CdpCaptureValues.js +5 -7
  63. package/dist/browser/CdpConnection.js +47 -24
  64. package/dist/browser/CdpElectronInspection.js +330 -0
  65. package/dist/browser/CdpElectronProvider.js +136 -0
  66. package/dist/browser/CdpEndpoint.js +77 -5
  67. package/dist/browser/CdpObservationSession.js +301 -0
  68. package/dist/browser/CdpPageCapture.js +159 -56
  69. package/dist/browser/CdpSafeMetadata.js +203 -0
  70. package/dist/browser/CdpScreenshot.js +101 -0
  71. package/dist/browser/CdpTargetSession.js +47 -0
  72. package/dist/browser/CdpWebMcpDiscovery.js +242 -0
  73. package/dist/browser/ElectronFileScope.js +50 -0
  74. package/dist/browser/PngVisualDiff.js +177 -0
  75. package/dist/browser/SensitiveTextCapture.js +25 -0
  76. package/dist/browser/WebSourceMapFetcher.js +357 -0
  77. package/dist/catalogIdentity.js +2 -33
  78. package/dist/cli.js +62 -34
  79. package/dist/cliBrowserAdvancedCommands.js +170 -0
  80. package/dist/cliBrowserCommands.js +180 -3
  81. package/dist/cliCommandNames.js +43 -0
  82. package/dist/cliElectronCommands.js +115 -0
  83. package/dist/cliEvidenceCommands.js +4 -3
  84. package/dist/cliInvestigationCommands.js +17 -9
  85. package/dist/cliPolicyCommands.js +49 -3
  86. package/dist/cliProcessCommands.js +3 -2
  87. package/dist/config.js +58 -7
  88. package/dist/contracts/browserToolContracts.js +304 -3
  89. package/dist/contracts/electronToolContracts.js +73 -0
  90. package/dist/contracts/enhancedInputs.js +2 -2
  91. package/dist/contracts/providerSelection.js +28 -0
  92. package/dist/contracts/sessionLifecycleInputs.js +2 -0
  93. package/dist/contracts/toolContracts.js +24 -20
  94. package/dist/contracts/toolOutputSchemas.js +117 -22
  95. package/dist/doctorRuntime.js +6 -0
  96. package/dist/domain/analysisProfile.js +78 -0
  97. package/dist/domain/analysisSnapshot.js +92 -46
  98. package/dist/domain/artifactGraph.js +1 -0
  99. package/dist/domain/binaryTarget.js +4 -29
  100. package/dist/domain/browserCompleteness.js +101 -0
  101. package/dist/domain/browserObservation.js +240 -14
  102. package/dist/domain/browserSession.js +63 -0
  103. package/dist/domain/electronObservation.js +162 -0
  104. package/dist/domain/errors.js +81 -6
  105. package/dist/domain/evidence.js +44 -5
  106. package/dist/domain/evidenceBundle.js +9 -7
  107. package/dist/domain/functionComparison.js +9 -3
  108. package/dist/domain/functionComparisonNormalization.js +37 -0
  109. package/dist/domain/functionDossierEvidence.js +4 -1
  110. package/dist/domain/hopperValues.js +66 -9
  111. package/dist/domain/investigationWorkspace.js +6 -1
  112. package/dist/domain/javascriptApplicationEvidenceSchemas.js +361 -0
  113. package/dist/domain/javascriptApplicationGraph.js +281 -0
  114. package/dist/domain/javascriptApplicationGraphSchemas.js +132 -0
  115. package/dist/domain/javascriptAstFingerprint.js +143 -0
  116. package/dist/domain/javascriptStaticAnalysis.js +358 -0
  117. package/dist/domain/javascriptStaticAnalysisHelpers.js +264 -0
  118. package/dist/domain/javascriptStaticAnalysisState.js +17 -0
  119. package/dist/domain/javascriptStaticAnalysisTypes.js +1 -0
  120. package/dist/domain/jsonShape.js +125 -0
  121. package/dist/domain/referenceSourceGraph.js +3 -1
  122. package/dist/domain/webBundleAnalysis.js +195 -0
  123. package/dist/domain/webBundleAnalyzer.js +423 -0
  124. package/dist/domain/webCaptureDiff.js +184 -0
  125. package/dist/domain/webContentArtifact.js +47 -0
  126. package/dist/domain/webInventory.js +61 -0
  127. package/dist/domain/webMcpDiscovery.js +68 -0
  128. package/dist/domain/webScreenshot.js +114 -0
  129. package/dist/generatedPackageMetadata.js +2 -2
  130. package/dist/ghidra/GhidraAnalysisProfile.js +37 -0
  131. package/dist/ghidra/GhidraClient.js +400 -0
  132. package/dist/ghidra/GhidraClientTypes.js +1 -0
  133. package/dist/ghidra/GhidraDefaults.js +20 -0
  134. package/dist/ghidra/GhidraDiagnostics.js +43 -0
  135. package/dist/ghidra/GhidraDoctor.js +59 -0
  136. package/dist/ghidra/GhidraFunctionValues.js +264 -0
  137. package/dist/ghidra/GhidraInstallation.js +239 -0
  138. package/dist/ghidra/GhidraInventoryValues.js +217 -0
  139. package/dist/ghidra/GhidraLauncher.js +139 -0
  140. package/dist/ghidra/GhidraProvider.js +360 -0
  141. package/dist/ghidra/GhidraRequestQueue.js +98 -0
  142. package/dist/ghidra/GhidraResponseBuffer.js +31 -0
  143. package/dist/ghidra/GhidraResponseRouter.js +24 -0
  144. package/dist/ghidra/GhidraSessionError.js +39 -0
  145. package/dist/ghidra/GhidraSessionValues.js +62 -0
  146. package/dist/ghidra/GhidraSocketConnection.js +46 -0
  147. package/dist/ghidra/protocol.js +69 -0
  148. package/dist/hopper/BridgeLauncher.js +21 -57
  149. package/dist/hopper/HopperAnalysisProfile.js +106 -0
  150. package/dist/hopper/HopperClient.js +197 -165
  151. package/dist/hopper/HopperProvider.js +105 -8
  152. package/dist/hopper/HopperSessionValues.js +27 -0
  153. package/dist/hopper/HopperSocketConnection.js +31 -0
  154. package/dist/main.js +36 -31
  155. package/dist/native/NativeMacOSProvider.js +6 -3
  156. package/dist/native/NativeMachoInspection.js +21 -6
  157. package/dist/process/PendingOperations.js +59 -0
  158. package/dist/process/PrivateRuntimeRoot.js +33 -0
  159. package/dist/{application → process}/ProcessOwnership.js +40 -20
  160. package/dist/process/ProviderDeadline.js +95 -0
  161. package/dist/process/ProviderProcess.js +275 -0
  162. package/dist/server/createServer.js +8 -0
  163. package/dist/server/promptCompletion.js +9 -3
  164. package/dist/server/registerBrowserTools.js +61 -2
  165. package/dist/server/registerElectronTools.js +36 -0
  166. package/dist/server/registerEnhancedTools.js +9 -6
  167. package/dist/server/registerInvestigationTools.js +11 -12
  168. package/dist/server/registerOfficialTools.js +3 -0
  169. package/dist/server/registerSessionTools.js +7 -1
  170. package/package.json +12 -6
  171. package/scripts/rea.mjs +37 -3
  172. package/skills/rea-analysis/SKILL.md +19 -9
package/README.md CHANGED
@@ -10,11 +10,11 @@
10
10
 
11
11
  [![npm version](https://img.shields.io/npm/v/rea-agents?style=flat-square&color=cb3837)](https://www.npmjs.com/package/rea-agents)
12
12
  [![CI](https://img.shields.io/github/actions/workflow/status/morluto/rea/ci.yml?branch=main&style=flat-square&label=CI)](https://github.com/morluto/rea/actions/workflows/ci.yml)
13
- [![70 MCP tools](https://img.shields.io/badge/MCP_tools-70-5c4ee5?style=flat-square)](#70-tools-for-investigation)
13
+ [![78 MCP tools](https://img.shields.io/badge/MCP_tools-78-5c4ee5?style=flat-square)](#78-tools-for-investigation)
14
14
  [![Node.js 22+](https://img.shields.io/badge/Node.js-22.19%2B-339933?style=flat-square&logo=nodedotjs&logoColor=white)](https://nodejs.org/)
15
15
  [![MIT license](https://img.shields.io/badge/license-MIT-f4c430?style=flat-square)](LICENSE)
16
16
 
17
- [Quick start](#quick-start) · [Current status](#current-status) · [Investigation model](#the-investigation-model) · [70 tools](#70-tools-for-investigation) · [Roadmap](#roadmap) · [How it works](#how-it-works)
17
+ [Quick start](#quick-start) · [Current status](#current-status) · [Investigation model](#the-investigation-model) · [78 tools](#78-tools-for-investigation) · [Roadmap](#roadmap) · [How it works](#how-it-works)
18
18
 
19
19
  <br />
20
20
 
@@ -30,7 +30,7 @@
30
30
 
31
31
  See a feature in an app that you want in your own product? Give the app to your agent—even without its source code. With REA, the agent can investigate the feature, explain how it works, show its evidence, and build a version adapted to your stack and requirements.
32
32
 
33
- REA gives agents one consistent way to investigate software. Today that includes deep native analysis through Hopper, complete function dossiers, reproducible Evidence v2 records, and controlled process capture. The longer-term toolkit extends the same agent workflow to packaged apps, JavaScript bundles, websites, APIs, protocols, mobile artifacts, firmware, runtime behavior, and differences between versions.
33
+ REA gives agents one consistent way to investigate software. Today that includes deep native analysis and function dossiers through Hopper or bring-your-own Ghidra on Linux, reproducible Evidence v2 records, controlled process capture, passive website and Electron observation, bounded JavaScript/source-map reconstruction, and a versioned domain graph for connecting JavaScript application layers without confusing static inference with runtime observation. The longer-term toolkit extends the same agent workflow to APIs, protocols, mobile artifacts, firmware, richer runtime behavior, and differences between versions.
34
34
 
35
35
  Reverse engineering normally makes the operator choose a tool, learn its API, move evidence between programs, and decide what to inspect next. REA gives that work to the agent through commands, skills, structured results, and repeatable investigation workflows.
36
36
 
@@ -74,14 +74,14 @@ REA shows how it reached its conclusions. It does not claim to recover original
74
74
 
75
75
  ## Why REA
76
76
 
77
- | | |
78
- | ------------------------ | ------------------------------------------------------------------------------------ |
79
- | **Built for agents** | Ask what an app does and let your agent inspect it instead of guessing. |
80
- | **CLI and MCP** | Run the same reverse-engineering capabilities from your terminal or agent. |
81
- | **Complexity handled** | REA installs and manages the reverse-engineering tools behind the scenes. |
82
- | **From insight to code** | Understand a feature, then build your own version in the same coding session. |
83
- | **Local by design** | Analysis runs on your Mac. REA does not upload the app to a hosted analysis service. |
84
- | **Keeps context** | Investigate several apps without starting over for every question. |
77
+ | | |
78
+ | ------------------------ | ----------------------------------------------------------------------------------------------------- |
79
+ | **Built for agents** | Ask what an app does and let your agent inspect it instead of guessing. |
80
+ | **CLI and MCP** | Run the same reverse-engineering capabilities from your terminal or agent. |
81
+ | **Complexity handled** | REA installs and manages the reverse-engineering tools behind the scenes. |
82
+ | **From insight to code** | Understand a feature, then build your own version in the same coding session. |
83
+ | **Local by design** | Analysis runs on your supported local host. REA does not upload the app to a hosted analysis service. |
84
+ | **Keeps context** | Investigate several apps without starting over for every question. |
85
85
 
86
86
  ## Quick start
87
87
 
@@ -94,7 +94,7 @@ rea setup
94
94
 
95
95
  Installing the CLI does not update Homebrew, Node.js, npm, Hopper, or agent configuration. `rea setup` detects what is already present, prints every proposed change, and asks before applying it.
96
96
 
97
- REA detects Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, and Devin. Registrations are additive, backup-first, and read back after writing. You can safely rerun setup.
97
+ REA detects Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, and Devin. It configures the first six when detected; Devin is reported but left unchanged because it has no documented local MCP configuration boundary. Registrations are additive, backup-first, and read back after writing. You can safely rerun setup.
98
98
 
99
99
  An optional curl wrapper installs the same CLI package and starts setup only when a terminal is available:
100
100
 
@@ -110,7 +110,7 @@ Pass installer options after `bash -s --`, for example `--dry-run`, `--no-setup`
110
110
  npx skills add morluto/rea
111
111
  ```
112
112
 
113
- Ask your agent to set up REA. It will check your Mac, explain anything it needs to install, ask for approval, and guide you through system prompts. After setup, restart the agent if it asks you to load the full REA toolset.
113
+ Ask your agent to set up REA. It will check your supported host, explain anything it needs to install, ask for approval, and guide you through system prompts. After setup, restart the agent if it asks you to load the full REA toolset.
114
114
 
115
115
  Review the setup plan, approve it if appropriate, then describe the app or feature you want to understand. Hopper can run in its free demo mode; if it shows a first-run prompt, choose the demo or enter an existing license.
116
116
 
@@ -153,7 +153,7 @@ Choose either the no-install commands or the global installation. You do not nee
153
153
  - Node.js 22.19+ or 24.11+ (including newer releases)
154
154
  - npm; REA does not require or install a particular npm version
155
155
 
156
- Deep binary analysis currently uses [Hopper](https://www.hopperapp.com/), a separate desktop application with its own license. Setup reuses an existing installation. If Hopper is missing, interactive setup proposes the official package and includes it in the confirmation plan. Unattended installation requires `rea setup --yes --install-hopper`.
156
+ Deep binary operations use [Hopper](https://www.hopperapp.com/), a separate desktop application with its own license, or a caller-selected Ghidra provider. Ghidra supplies read-only inventory, function metadata, decompilation, assembly, resolved calls, typed references, xrefs, CFG, and function dossiers; GUI state and mutations remain unavailable through that provider. Setup reuses an existing Hopper installation or an operator-supplied Ghidra installation. It never downloads Ghidra or installs Java. If neither provider is ready, interactive setup proposes Hopper; unattended Hopper installation requires `rea setup --yes --install-hopper`.
157
157
 
158
158
  If something is not working, run:
159
159
 
@@ -186,6 +186,28 @@ Install the missing distribution packages and rerun `rea setup`. Linux demo auto
186
186
 
187
187
  REA defaults `HOPPER_LAUNCHER_PATH` to `/Applications/Hopper Disassembler.app/Contents/MacOS/hopper` on macOS and `/opt/hopper/bin/Hopper` on Linux. Explicit configuration always takes precedence.
188
188
 
189
+ ### Ghidra read-only analysis provider
190
+
191
+ The current Ghidra adapter supports the exact official Ghidra 12.1.2 release on Linux x64 with a 64-bit full JDK 21. Download and extract those projects yourself, then configure absolute paths:
192
+
193
+ ```bash
194
+ export GHIDRA_INSTALL_DIR=/absolute/path/to/ghidra_12.1.2_PUBLIC
195
+ export JAVA_HOME=/absolute/path/to/jdk-21 # optional when java and javac resolve from PATH
196
+ rea doctor --json
197
+ rea setup
198
+ rea providers --json
199
+ ```
200
+
201
+ Doctor distinguishes missing configuration, a bad installation root, the wrong Ghidra or Java version, a JRE without `javac`, a missing `support/analyzeHeadless`, and an unsupported platform or architecture. Approved setup only copies the verified non-secret paths into detected MCP registrations; it does not modify the Ghidra installation or install/download Ghidra or Java.
202
+
203
+ REA loads its packaged Java `HeadlessScript` with `-scriptPath`, imports the target into a mode-0700 temporary project, enables `-readOnly` and `-deleteProject`, caps auto-analysis at 300 seconds with two CPUs and a 2 GiB Java heap, and authenticates every request over a mode-0600 Unix socket. It isolates Ghidra home/cache/config/temp paths and removes the owned project, socket, process group, and runtime root on close, cancellation, timeout, or process exit.
204
+
205
+ The Ghidra adapter declares 18 direct and enhanced operations. Its ten inventory operations are `list_documents`, `list_procedures`, `list_strings`, `list_names`, `list_segments`, `address_name`, `procedure_address`, `resolve_containing_procedure`, `search_procedures`, and `search_strings`. It also admits `procedure_info`, `procedure_pseudo_code`, `procedure_assembly`, `procedure_callers`, `procedure_callees`, `procedure_references`, `xrefs`, and `analyze_function`. These capabilities enable the shared Swift/Objective-C inventory workflows, `binary_overview`, `batch_decompile`, `get_call_graph`, `find_xrefs_to_name`, `trace_feature`, and complete function dossiers. Default-space addresses are lowercase `0x` hexadecimal. Other spaces, including `EXTERNAL`, use `<percent-encoded-space>:0x<hex>`. Symbol results identify primary, dynamic, external, type, and source facts; procedures distinguish external functions and thunks; strings identify charset, missing-terminator state, byte length, and value truncation; memory-block ends are exclusive and permissions come directly from Ghidra.
206
+
207
+ The bridge serves operations only after auto-analysis completes. Each Program owns one persistent `DecompInterface`; a bounded 32-request FIFO serializes Ghidra API access, and every decompile has a 30-second native deadline. Reference results preserve Ghidra's call/jump/data/read/write/indirect/computed/external facts, while unresolved targetless flows remain explicitly unknown. Synthetic entry-point references without actionable memory sources are omitted. Pseudocode and assembly are provider-specific observations, not original source or Hopper-equivalent text. An analysis timeout, scan or inventory safety limit, request timeout, or oversized response fails explicitly instead of returning a partial result labeled complete.
208
+
209
+ `npm run verify:ghidra` compiles source-owned x86-64 debug and stripped ELF, AArch64 ELF, x86-64 PE, and x86-64 Mach-O fixtures. Against real Ghidra 12.1.2 it validates every admitted operation, direct and indirect calls, imports/exports/thunks, typed references, strings/xrefs, multi-block CFG, cancellation, deadlines, concurrency, malformed inputs, and complete process/project cleanup. Set `REA_CC`, `REA_CLANG`, or `REA_LLD_LINK` only when the corresponding compiler command is not on `PATH`.
210
+
189
211
  To remove only REA-owned MCP registrations and the managed skill:
190
212
 
191
213
  ```bash
@@ -240,13 +262,15 @@ Exports never replace an existing file unless `--overwrite` is explicit. Imports
240
262
 
241
263
  Provider-neutral analysis snapshots persist successful, immutable REA calls and
242
264
  their Evidence v2 records. They are exact caches rather than Hopper databases:
243
- REA reuses an entry only when the binary digest, format, architecture, operation
244
- parameters, loader arguments, and provider identity match. Custom Hopper loader
245
- overrides disable snapshots because their provider configuration cannot be
246
- replayed safely. Cursor-dependent and mutating calls are never cached. Snapshot
247
- files can contain proprietary analysis results and local
248
- paths, so REA keeps them local, writes them with owner-only permissions, and
249
- requires a separate approved root:
265
+ REA reuses a v2 entry only when the binary digest, kind, format, architecture,
266
+ operation parameters, concrete provider build, and canonical analysis-profile
267
+ digest match. Hopper loader defaults and configured overrides are normalized by
268
+ the Hopper adapter and committed to that profile, so overrides occupy a distinct
269
+ safe cache partition instead of disabling snapshots. Snapshot v1 cannot prove
270
+ those semantics and is rejected with recapture guidance. Cursor-dependent and
271
+ mutating calls are never cached. Snapshot files can contain proprietary analysis
272
+ results and local paths, so REA keeps them local, writes them with owner-only
273
+ permissions, and requires a separate approved root:
250
274
 
251
275
  ```bash
252
276
  export REA_ANALYSIS_SNAPSHOT_ROOTS_JSON='["/absolute/path/to/analysis"]'
@@ -255,7 +279,7 @@ rea analyze /absolute/path/to/app --snapshot /absolute/path/to/analysis/app.json
255
279
  rea analyze /absolute/path/to/app --snapshot /absolute/path/to/analysis/app.json
256
280
  ```
257
281
 
258
- Exact CLI evidence replays happen before any provider starts. In MCP sessions,
282
+ Exact CLI evidence replays happen before any provider process starts. In MCP sessions,
259
283
  pass `snapshot_path` to `open_binary` to import a snapshot atomically while
260
284
  opening its matching target; MCP providers may still start before a cached call
261
285
  is replayed. Pass `snapshot_path` and, when required, `overwrite: true` to
@@ -294,25 +318,30 @@ REA handles the app analysis in steps 1–5. The agent performs step 6 with its
294
318
  - Analyze Swift and Objective-C metadata without manually untangling every mangled symbol.
295
319
  - Leave names, comments, and bookmarks in Hopper so human and agent analysis reinforce each other.
296
320
 
297
- ## 70 tools for investigation
321
+ ## 78 tools for investigation
298
322
 
299
- | Tool family | Count | Examples |
300
- | ------------------------- | ----: | ---------------------------------------------------------------------------------------------------------------------------------- |
301
- | Native inspection | 33 | procedures, pseudocode, assembly, strings, names, segments, callers, callees, xrefs, annotations |
302
- | Investigation workflows | 10 | `binary_overview`, `analyze_function`, `batch_decompile`, `trace_feature`, call graphs, Swift and Objective-C discovery |
303
- | Native macOS utilities | 5 | Mach-O metadata, code signatures, plists, architectures, Swift demangling; Hopper-free and provenance-bearing |
304
- | Artifact graph | 2 | deterministic directory, ZIP/APK/IPA, and ASAR inventory; explicitly selected extraction into an absent owned tree |
305
- | Browser observation | 2 | exact-origin CDP page discovery and passive DOM, accessibility, script, resource, network, console, worker, and storage inspection |
306
- | Workspace and observation | 18 | target lifecycle, Evidence v2 bundles, process/artifact/function comparison, evidence-linked residual-unknown lifecycle |
323
+ | Tool family | Count | Examples |
324
+ | ------------------------- | ----: | -------------------------------------------------------------------------------------------------------------------------------- |
325
+ | Native inspection | 33 | procedures, pseudocode, assembly, strings, names, segments, callers, callees, xrefs, annotations |
326
+ | Investigation workflows | 10 | `binary_overview`, `analyze_function`, `batch_decompile`, `trace_feature`, call graphs, Swift and Objective-C discovery |
327
+ | Native macOS utilities | 5 | Mach-O metadata, code signatures, plists, architectures, Swift demangling; Hopper-free and provenance-bearing |
328
+ | Artifact graph | 2 | deterministic directory, ZIP/APK/IPA, and ASAR inventory; explicitly selected extraction into an absent owned tree |
329
+ | Browser observation | 8 | exact-origin CDP capture, bundle and source-map analysis, WebMCP discovery, session timelines, capture diff, and visual evidence |
330
+ | Electron observation | 2 | canonical-root-confined file-page discovery and passive DOM, resource, and optionally approved script-source inspection |
331
+ | Workspace and observation | 18 | target lifecycle, Evidence v2 bundles, process/artifact/function comparison, evidence-linked residual-unknown lifecycle |
307
332
 
308
333
  The public interface describes what the agent is trying to learn. Providers decide how to answer. macOS utilities handle common semantic inspection without launching Hopper; Hopper handles deeper native analysis; the process harness implements controlled behavioral capture.
309
334
 
310
335
  ## Current status
311
336
 
312
- REA is already useful for native application investigation on macOS:
337
+ REA is already useful for native application, browser, and Electron investigation on supported macOS and Linux hosts:
313
338
 
314
- - Open Mach-O, ELF, PE, `.app`, ZIP, APK, IPA, ASAR, plist, JavaScript, source-map, and Hopper database targets.
315
- - Attach to a user-owned Chrome-family browser over a configured loopback CDP endpoint, list only pages on approved exact origins, and capture bounded passive web evidence without navigation or JavaScript evaluation.
339
+ - Open Mach-O, ELF, PE, `.app`, ZIP, APK, IPA, ASAR, plist, JavaScript, source-map, and generic analysis-database targets; Hopper remains the only adapter that accepts legacy `.hop` databases.
340
+ - Discover deep-analysis candidates without starting them, choose deterministically, and retain one immutable provider/profile binding until an explicit switch or close; provider failures never trigger transparent fallback.
341
+ - Attach to a user-owned Chrome-family browser over a configured loopback CDP endpoint; capture exact-origin web structure, safe metadata, approved value-free payload shapes, bundle/source-map evidence, WebMCP declarations, user-action timelines, capture diffs, and explicitly approved screenshots without navigation or JavaScript evaluation.
342
+ - Inspect Electron `file://` renderer pages through a separate canonical-root permission boundary without invoking Electron APIs; script contents remain separately approved and byte bounded.
343
+ - Validate and canonically serialize a provider-neutral [JavaScript Application Graph v1](docs/javascript-application-graph.md) spanning packages, ASAR entries, Electron roles, JavaScript/source-map entities, browser/runtime instances, IPC, endpoints, storage, and native add-ons. This shipped domain contract performs no extraction or I/O by itself.
344
+ - Reconstruct bounded static package, entrypoint, Webpack/Rspack module, import, worker, endpoint, storage, source-map, and native-add-on structure from a local directory or ASAR through an AST-only [application service](docs/javascript-artifact-reconstruction.md). The service does not execute bootstrap code and does not add a standalone CLI/MCP tool yet.
316
345
  - Traverse content-addressed artifact graphs without extraction; on macOS, read-only DMG traversal additionally requires `native_mount_approved: true` and `REA_ARTIFACT_NATIVE_MOUNT_ENABLED=true`. Materialize only approved occurrences into absent output roots.
317
346
  - Build bounded function dossiers with pseudocode, assembly, CFG edges, comments, calls, references, strings, and names.
318
347
  - Search and trace features across symbols, strings, metadata, references, and call paths.
@@ -346,28 +375,39 @@ rea list-browser-targets http://127.0.0.1:9222 --approved --json
346
375
  rea inspect-web-page http://127.0.0.1:9222 TARGET_ID --approved --json
347
376
  ```
348
377
 
349
- `list_browser_targets` and `inspect_web_page` expose the same Evidence v2 contracts over MCP. Inspection is passive: REA does not evaluate page JavaScript, navigate, click, close the page, or close the browser. It redacts query values and never retains headers, bodies, cookies, storage values, console argument values, or WebSocket payloads. Existing activity before attach is explicitly unavailable. See [Website observation with CDP](docs/browser-observation.md) for browser startup, schemas, limits, and the threat model.
378
+ All eight browser tools expose the same Evidence v2 contracts over CLI and MCP. Inspection is passive: REA does not evaluate page JavaScript, navigate, click, close the page, or close the browser. Query values, credentials, cookies, authorization headers, storage values, and raw JSON or WebSocket values are never retained. Separately approved captures can retain bounded redacted console primitives, value-free JSON/WebSocket shapes, script sources, accessibility text, or screenshot pixels. Existing activity before attach is explicitly unavailable. See [Website observation with CDP](docs/browser-observation.md) for browser startup, schemas, limits, and the threat model.
379
+
380
+ Exact package, tool-family, provider, setup-client, public schema-version, and CLI facts are generated from source in [`docs/product-catalog.json`](docs/product-catalog.json). `npm run docs:check` verifies that this catalog, the narrative documentation, TypeDoc, and generated schemas have not drifted.
350
381
 
351
382
  ## Roadmap
352
383
 
353
- REA is growing into a toolkit for understanding software across static artifacts and observed behavior. The next capability families are:
384
+ REA is growing into a toolkit for understanding software across static artifacts and observed behavior. The [current status](#current-status) above is the shipped baseline; the items below are planned work.
385
+
386
+ ### Now
387
+
388
+ 1. **Maintain truthful product metadata** — extend the shipped canonical catalog and drift checks whenever versions, tools, providers, schemas, setup clients, or CLI capabilities change.
389
+ 2. **Electron boundary extraction and high-level surface** — extend the shipped static artifact projector with contextBridge, IPC, utility-process, and native-export boundaries, then expose one provider-neutral CLI/MCP workflow without widening authority.
390
+ 3. **Cross-provider conformance growth** — add source-owned architectures and difficult indirect/thunk cases while preserving semantic comparison and provider-specific text boundaries.
391
+
392
+ ### Next
393
+
394
+ 1. **Cross-layer tracing and version comparison** — trace renderer behavior through preload, IPC, main-process, storage, network, and native boundaries, then compare those paths across application versions.
395
+ 2. **Deeper JavaScript and source recovery** — add historical-source matching, rechunked/minified cross-version matching, and stronger static/runtime reconciliation on top of the shipped AST-only Webpack/Rspack reconstruction.
396
+ 3. **Deterministic behavior harnesses** — extend process ownership, protocol fixtures, filesystem observation, reconnects, and cross-version behavioral comparison.
397
+
398
+ ### Later
354
399
 
355
- 1. **Artifact decomposition** — DMG, ASAR, ZIP, packages, universal-binary slices, application resources, embedded frameworks, mobile packages, and artifact graphs.
356
- 2. **Web and Electron investigation** — extend the shipped passive CDP observation with approved interaction, screenshots, Electron IPC, route discovery, controlled replay, and visual or structural differences.
357
- 3. **Deterministic behavior harnesses** — stronger process-tree ownership, protocol fixtures, network policy, filesystem tracing, signals, reconnects, and cross-version comparison.
358
- 4. **JavaScript and source recovery** — bundle indexing, AST/module reconstruction, source-map discovery, historical-source matching, and CodeDB-backed cross-references.
359
- 5. **Runtime observation** — approval-gated LLDB, Frida, system logs, process and filesystem observers, and native API tracing.
360
- 6. **More static-analysis providers** — native platform utilities first, followed by Ghidra, IDA/Hex-Rays, Binary Ninja, Rizin, LIEF, and other engines behind provider-neutral capabilities.
361
- 7. **More targets and platforms** — Windows-native providers and ConPTY verification, Linux parity, websites and APIs, mobile artifacts, firmware, document formats, and other software-defined systems.
362
- 8. **Differential reconstruction expansion** — add automatic function matching, protocol/UI comparison, controlled replay, residual-unknown planning, and reconstruction verification to persistent version runs.
400
+ 1. **Controlled interaction and replay** — keep approved JavaScript execution, browser interaction, Electron instrumentation, and fuzzing behind a separate authority from passive observation.
401
+ 2. **Native runtime observation** — approval-gated LLDB, Frida, system logs, process/filesystem observers, and native API tracing.
402
+ 3. **Additional providers and targets** — evaluate IDA/Hex-Rays, Binary Ninja, Rizin, LIEF, Windows-native providers, mobile artifacts, firmware, document formats, and other software-defined systems.
363
403
 
364
- Roadmap items describe direction, not shipped support. New providers must produce the same evidence and safety metadata as existing capabilities before they become part of the public workflow. Once REA has multiple optional toolchains, setup can become capability-selective; the consent rules for that future work are recorded in the [installation roadmap](docs/roadmap.md).
404
+ New providers must produce the same evidence and safety metadata as existing capabilities before they become part of the public workflow. Once REA has multiple optional toolchains, setup can become capability-selective; the consent rules for that future work are recorded in the [installation roadmap](docs/roadmap.md).
365
405
 
366
- See the [static-analysis provider evaluation](docs/provider-evaluation.md) for the current research matrix and admission gate.
406
+ See the [static-analysis provider evaluation](docs/provider-evaluation.md) for the shipped Ghidra function-analysis boundary, remaining admission gates, and provider comparison matrix, and [ADR-0001](docs/adr/0001-provider-selection-and-analysis-profiles.md) for the binding, selection, profile, snapshot, and compatibility decisions.
367
407
 
368
408
  ## Using REA with other agents
369
409
 
370
- Setup currently configures Claude Desktop and Cursor automatically. Any agent that supports local MCP servers can use REA with the configuration below.
410
+ Setup detects Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, and Devin. It automatically configures the first six when present; detected Devin installations are reported but left unchanged. Any agent that supports local MCP servers can use REA with the configuration below.
371
411
 
372
412
  ### Manual MCP configuration
373
413
 
@@ -394,14 +434,17 @@ flowchart LR
394
434
  Agent["Agent"] --> REA["REA<br/>CLI + MCP"]
395
435
  Terminal --> REA
396
436
  REA --> Workspace["Investigation workspace<br/>evidence + artifacts + captures"]
397
- Workspace --> Router["Capability router"]
398
- Router --> Hopper["Hopper provider"]
399
- Router --> Native["Native macOS provider"]
400
- Router --> Artifact["Artifact graph provider"]
401
- Router --> Browser["Browser CDP provider"]
402
- Router --> Process["Process capture provider"]
403
- Router -. roadmap .-> More["Dynamic and additional<br/>static providers"]
404
- Hopper --> Target["Target software"]
437
+ REA --> Session["Target-bound session router"]
438
+ Session --> Registry["Deep-provider registry<br/>deterministic selection"]
439
+ Registry --> Hopper["Hopper provider"]
440
+ Registry --> Ghidra["Ghidra provider<br/>read-only inventory + function analysis"]
441
+ Hopper --> Runtime["Owned provider runtime<br/>deadline + bounded diagnostics + cleanup"]
442
+ Ghidra --> Runtime
443
+ Session --> Native["Native macOS provider"]
444
+ Session --> Artifact["Artifact graph provider"]
445
+ REA --> Browser["Browser CDP provider"]
446
+ REA --> Process["Process capture provider"]
447
+ Runtime --> Target["Target software"]
405
448
  Process --> Target
406
449
  Native --> Target
407
450
  Artifact --> Target
@@ -442,6 +485,42 @@ rea mcp
442
485
 
443
486
  REA accepts a Mac `.app` folder directly. If an agent cannot find an app by name, tell it where the app is installed.
444
487
 
488
+ ### Choosing a deep-analysis provider
489
+
490
+ Every deep-analysis open resolves a provider before creating its client. The
491
+ same selector and precedence apply to the CLI, MCP, and startup configuration:
492
+
493
+ ```bash
494
+ rea providers --json
495
+ rea analyze /absolute/path/to/program --provider hopper
496
+ REA_ANALYSIS_PROVIDER=hopper rea decompile /absolute/path/to/program 0x1000
497
+ ```
498
+
499
+ For MCP, pass the optional selector on `open_binary`:
500
+
501
+ ```json
502
+ {
503
+ "path": "/absolute/path/to/program",
504
+ "provider_id": "hopper"
505
+ }
506
+ ```
507
+
508
+ The request-level `provider_id` or `--provider` wins over
509
+ `REA_ANALYSIS_PROVIDER`; all accept a provider ID or `auto`. Automatic selection
510
+ binds the sole usable deep candidate, reports `ambiguous` when several are
511
+ usable, and can leave an artifact-only target unbound so its disjoint artifact
512
+ operations still work. An explicit unknown, unavailable, or unsupported
513
+ provider fails with candidate IDs, stable rejection codes, and actionable local
514
+ diagnostics. `binary_session`, `rea providers`, and `rea capabilities` expose
515
+ the authoritative `analysis_provider_candidates` and
516
+ `analysis_provider_binding` fields. Reopening the same target without a selector
517
+ keeps its binding; runtime failure never selects another provider silently.
518
+ Ghidra can appear as an available, target-compatible candidate after doctor
519
+ validates its exact installation. Its capability list contains the 18 admitted
520
+ read-only inventory and function-analysis operations; selecting it still does
521
+ not make Hopper-only GUI or mutation operations available and never triggers a
522
+ silent fallback.
523
+
445
524
  ### CLI exit status
446
525
 
447
526
  | Status | Meaning |
@@ -504,7 +583,7 @@ unpacked; REA does not silently accept the mismatched artifact.
504
583
 
505
584
  ## Security model
506
585
 
507
- REA does not provide a hosted analysis service. Hopper communication uses an authenticated private local socket. Dynamic capabilities are disabled by default and require both operator policy and explicit per-call approval. REA is not a security sandbox: providers and launched targets run with the current user's permissions, and each capability reports its side effects and limitations. Report vulnerabilities through the private process in [SECURITY.md](SECURITY.md).
586
+ REA does not provide a hosted analysis service. Hopper and Ghidra bridge communication uses authenticated private local sockets. Dynamic capabilities are disabled by default and require both operator policy and explicit per-call approval. REA is not a security sandbox: providers and launched targets run with the current user's permissions, and each capability reports its side effects and limitations. Report vulnerabilities through the private process in [SECURITY.md](SECURITY.md).
508
587
 
509
588
  ## FAQ
510
589
 
@@ -529,6 +608,13 @@ No. Setup can install Hopper for you, but Hopper remains separate software with
529
608
 
530
609
  </details>
531
610
 
611
+ <details>
612
+ <summary><strong>Does REA install or include Ghidra or Java?</strong></summary>
613
+
614
+ No. Ghidra support is bring-your-own. REA packages only its Java bridge source, validates the exact supported Ghidra 12.1.2 and 64-bit JDK 21 installation, and loads that bridge through Ghidra's external script path after setup approval records the paths.
615
+
616
+ </details>
617
+
532
618
  <details>
533
619
  <summary><strong>Does REA upload the app?</strong></summary>
534
620
 
@@ -546,7 +632,7 @@ No decompiler can guarantee the original source. REA gives an agent pseudocode,
546
632
  <details>
547
633
  <summary><strong>Which agents can use REA?</strong></summary>
548
634
 
549
- Any agent that can run a local MCP server can use the manual configuration. Setup currently detects and configures Claude Desktop and Cursor automatically.
635
+ Any agent that can run a local MCP server can use the manual configuration. Setup detects Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, and Devin; it automatically configures the first six when present and reports Devin without modifying it.
550
636
 
551
637
  </details>
552
638
 
@@ -556,7 +642,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, architecture, tests, and relea
556
642
 
557
643
  ## Project links
558
644
 
559
- [npm](https://www.npmjs.com/package/rea-agents) · [Issues](https://github.com/morluto/rea/issues) · [Security](SECURITY.md) · [Contributing](CONTRIBUTING.md) · [Hopper](https://www.hopperapp.com/)
645
+ [npm](https://www.npmjs.com/package/rea-agents) · [Issues](https://github.com/morluto/rea/issues) · [Security](SECURITY.md) · [Contributing](CONTRIBUTING.md) · [Hopper](https://www.hopperapp.com/) · [Ghidra](https://github.com/NationalSecurityAgency/ghidra)
560
646
 
561
647
  ## License
562
648