rea-agents 2.0.0 → 2.2.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 (273) hide show
  1. package/README.md +103 -38
  2. package/bridge/ghidra/ReaGhidraBridge.java +96 -11
  3. package/dist/application/AndroidApplicationService.js +17 -0
  4. package/dist/application/AppleApplicationService.js +17 -0
  5. package/dist/application/ArtifactExtraction.js +1 -1
  6. package/dist/application/ArtifactInventory/classify.js +42 -0
  7. package/dist/application/ArtifactInventory/hash.js +43 -0
  8. package/dist/application/ArtifactInventory/reader.js +41 -0
  9. package/dist/application/ArtifactInventory/scanCanonical.js +155 -0
  10. package/dist/application/ArtifactInventory/scanReader.js +124 -0
  11. package/dist/application/ArtifactInventory/types.js +10 -0
  12. package/dist/application/ArtifactInventory.js +9 -351
  13. package/dist/application/AuthorizedArtifactInventory.js +2 -2
  14. package/dist/application/BinarySession.js +47 -270
  15. package/dist/application/BinarySessionExecution.js +28 -0
  16. package/dist/application/BinarySessionOpen.js +39 -0
  17. package/dist/application/BinarySessionRecords.js +149 -0
  18. package/dist/application/BinarySessionStatus.js +75 -0
  19. package/dist/application/CapabilityInventory.js +24 -2
  20. package/dist/application/ClientRegistrationStatus.js +11 -4
  21. package/dist/application/CrossVersionInventory.js +8 -2
  22. package/dist/application/CrossVersionInvestigation.js +1 -23
  23. package/dist/application/CrossVersionInvestigationCollections.js +23 -0
  24. package/dist/application/DirectAnalysis.js +47 -44
  25. package/dist/application/Doctor.js +156 -238
  26. package/dist/application/DoctorDiagnostics.js +180 -0
  27. package/dist/application/ElectronBoundaryAnalysis.js +23 -7
  28. package/dist/application/ElectronBoundaryGraphWindows.js +32 -8
  29. package/dist/application/EnhancedToolPagination.js +22 -0
  30. package/dist/application/EnhancedToolTypes.js +4 -0
  31. package/dist/application/EnhancedTools.js +20 -37
  32. package/dist/application/InstrumentedJavaScriptReplayHost.js +36 -0
  33. package/dist/application/InventoryProjectionEvidence.js +41 -0
  34. package/dist/application/InvestigationProviders.js +12 -0
  35. package/dist/application/InvestigationWorkspaceStore.js +24 -10
  36. package/dist/application/JavaScriptArtifactAnalysis.js +45 -6
  37. package/dist/application/JavaScriptArtifactFiles.js +6 -2
  38. package/dist/application/JavaScriptArtifactGraphBuilder.js +23 -1
  39. package/dist/application/JavaScriptArtifactGraphBundlers.js +225 -0
  40. package/dist/application/JavaScriptArtifactGraphContext.js +37 -36
  41. package/dist/application/JavaScriptArtifactGraphDocuments.js +27 -4
  42. package/dist/application/JavaScriptArtifactGraphFindings.js +54 -8
  43. package/dist/application/JavaScriptArtifactGraphStructure.js +29 -101
  44. package/dist/application/JavaScriptArtifactPathResolution.js +269 -0
  45. package/dist/application/JavaScriptArtifactReconstruction.js +1 -1
  46. package/dist/application/JavaScriptJsonModules.js +39 -0
  47. package/dist/application/JavaScriptModuleRelationships.js +262 -0
  48. package/dist/application/JavaScriptReplayPermission.js +16 -0
  49. package/dist/application/JavaScriptReplayService.js +182 -156
  50. package/dist/application/LinuxHopper.js +10 -0
  51. package/dist/application/MacHopper.js +22 -11
  52. package/dist/application/NodeRuntimeCharacterizationService.js +196 -0
  53. package/dist/application/PermissionAuthority.js +106 -63
  54. package/dist/application/ProcessCaptureCapability.js +1 -1
  55. package/dist/application/ProcessCapturePermission.js +13 -0
  56. package/dist/application/ProcessCli.js +2 -12
  57. package/dist/application/ProcessHarness.js +1 -1
  58. package/dist/application/ProcessPairedExperiment.js +72 -0
  59. package/dist/application/ProjectPermissionStore.js +48 -9
  60. package/dist/application/RealHopperAssertions.js +76 -0
  61. package/dist/application/ReconstructionCoverageService.js +69 -0
  62. package/dist/application/ReconstructionCoverageWorkspaceStore.js +31 -0
  63. package/dist/application/RuntimeExecutableDiagnostics.js +172 -0
  64. package/dist/application/Setup.js +148 -260
  65. package/dist/application/SetupClientConfiguration.js +224 -0
  66. package/dist/application/SetupClients.js +24 -2
  67. package/dist/application/SetupPlan.js +124 -12
  68. package/dist/application/SetupSkill.js +54 -36
  69. package/dist/application/SupportedClients.js +1 -0
  70. package/dist/application/Uninstall.js +12 -3
  71. package/dist/application/Upgrade.js +16 -1
  72. package/dist/application/WindowsCapabilities.js +86 -0
  73. package/dist/artifacts/AsarArtifactReader.js +11 -0
  74. package/dist/browser/BrowserProcessStartup.js +88 -0
  75. package/dist/browser/CdpCaptureDocuments.js +12 -8
  76. package/dist/browser/CdpCaptureEventBodyShapes.js +75 -0
  77. package/dist/browser/CdpCaptureEventHandlers.js +336 -0
  78. package/dist/browser/CdpCaptureEventHelpers.js +71 -0
  79. package/dist/browser/CdpCaptureEventState.js +1 -0
  80. package/dist/browser/CdpCaptureEventTypes.js +1 -0
  81. package/dist/browser/CdpCaptureEvents.js +29 -496
  82. package/dist/browser/CdpObservationSession.js +51 -8
  83. package/dist/browser/CdpPageCapture.js +12 -133
  84. package/dist/browser/CdpPageCaptureScripts.js +97 -0
  85. package/dist/browser/CdpPageCaptureWorkers.js +46 -0
  86. package/dist/browser/CdpWebMcpDiscovery.js +38 -14
  87. package/dist/browser/PngVisualDiff.js +9 -2
  88. package/dist/catalogIdentity.js +4 -0
  89. package/dist/cli/artifactCommands.js +82 -0
  90. package/dist/cli/coreAnalysisCommands.js +232 -0
  91. package/dist/cli/managedCommands.js +397 -0
  92. package/dist/cli/managedProjectGraphCommand.js +24 -0
  93. package/dist/cli/options.js +9 -0
  94. package/dist/cli/setupCommands.js +113 -0
  95. package/dist/cli/types.js +1 -0
  96. package/dist/cli/utilityCommands.js +122 -0
  97. package/dist/cli.js +10 -768
  98. package/dist/cliApplicationCommands.js +118 -4
  99. package/dist/cliBrowserAdvancedCommands.js +73 -16
  100. package/dist/cliBrowserCommands.js +39 -115
  101. package/dist/cliCommandNames.js +4 -0
  102. package/dist/cliElectronCommands.js +33 -62
  103. package/dist/cliEvidenceCommands.js +13 -2
  104. package/dist/cliInvestigationCommands.js +53 -10
  105. package/dist/cliObservationOptions.js +137 -0
  106. package/dist/cliPolicyCommands.js +80 -46
  107. package/dist/cliSetup.js +306 -0
  108. package/dist/config/environment.js +107 -0
  109. package/dist/config/parseConfig.js +228 -0
  110. package/dist/config/parsers.js +68 -0
  111. package/dist/config/permissions.js +30 -0
  112. package/dist/config/types.js +1 -0
  113. package/dist/config.js +1 -375
  114. package/dist/contracts/applicationToolContracts.js +134 -0
  115. package/dist/contracts/electronToolContracts.js +51 -3
  116. package/dist/contracts/managedToolContracts.js +8 -3
  117. package/dist/contracts/managedWorkflowToolContracts.js +3 -3
  118. package/dist/contracts/providerSelection.js +2 -0
  119. package/dist/contracts/sessionStatusContract.js +26 -0
  120. package/dist/contracts/toolContractTypes.js +12 -1
  121. package/dist/contracts/toolContracts.js +5 -12
  122. package/dist/contracts/toolEffects.js +14 -0
  123. package/dist/contracts/toolOutputSchemaGroups.js +274 -0
  124. package/dist/contracts/toolOutputSchemaPrimitives.js +328 -0
  125. package/dist/contracts/toolOutputSchemas.js +2 -550
  126. package/dist/domain/analysisErrorPresentation.js +234 -0
  127. package/dist/domain/analysisErrorProjection.js +284 -0
  128. package/dist/domain/androidApplication.js +206 -0
  129. package/dist/domain/appleApplication.js +221 -0
  130. package/dist/domain/artifactComparison.js +34 -15
  131. package/dist/domain/binaryTarget.js +87 -37
  132. package/dist/domain/boundedCartesianProjection.js +15 -0
  133. package/dist/domain/browserObservation.js +1 -285
  134. package/dist/domain/browserObservationSchemas.js +286 -0
  135. package/dist/domain/electronStaticAnalysisBrowser.js +14 -2
  136. package/dist/domain/errors.js +4 -486
  137. package/dist/domain/functionComparison.js +4 -165
  138. package/dist/domain/functionComparisonDimensions.js +164 -0
  139. package/dist/domain/javascriptApplicationVersionItems.js +18 -6
  140. package/dist/domain/javascriptApplicationVersionKeys.js +8 -8
  141. package/dist/domain/javascriptExportInstrumentation.js +97 -0
  142. package/dist/domain/javascriptFeatureTraversal.js +19 -7
  143. package/dist/domain/javascriptRuntimeStaticCandidates.js +3 -1
  144. package/dist/domain/javascriptSemanticAnalysis.js +386 -0
  145. package/dist/domain/javascriptSemanticIr.js +30 -0
  146. package/dist/domain/javascriptSemanticProjection.js +366 -0
  147. package/dist/domain/javascriptSemanticState.js +40 -0
  148. package/dist/domain/javascriptSemanticTraversal.js +22 -0
  149. package/dist/domain/javascriptSemanticValues.js +352 -0
  150. package/dist/domain/javascriptStaticAnalysis.js +5 -221
  151. package/dist/domain/javascriptStaticAnalysisBundler.js +209 -0
  152. package/dist/domain/javascriptStaticAnalysisCalls.js +180 -0
  153. package/dist/domain/javascriptStaticAnalysisHelpers.js +71 -2
  154. package/dist/domain/knownPageCoverage.js +21 -0
  155. package/dist/domain/managedApplicationGraph.js +14 -364
  156. package/dist/domain/managedApplicationGraphCoverage.js +170 -0
  157. package/dist/domain/managedApplicationGraphNodeCoverage.js +6 -0
  158. package/dist/domain/managedApplicationGraphNodes.js +336 -0
  159. package/dist/domain/managedArtifact.js +16 -8
  160. package/dist/domain/managedMemberComparison.js +37 -391
  161. package/dist/domain/managedMemberComparisonCoverage.js +72 -0
  162. package/dist/domain/managedMemberComparisonMatch.js +356 -0
  163. package/dist/domain/managedNativeVerification.js +27 -389
  164. package/dist/domain/managedNativeVerificationMatch.js +272 -0
  165. package/dist/domain/managedNativeVerificationSchemas.js +141 -0
  166. package/dist/domain/managedReconstruction.js +82 -69
  167. package/dist/domain/managedRuntimeCorrelation.js +12 -3
  168. package/dist/domain/nodeRuntimeCharacterization.js +66 -0
  169. package/dist/domain/permissionPolicy.js +2 -0
  170. package/dist/domain/processComparison.js +19 -0
  171. package/dist/domain/processPairedExperiment.js +128 -0
  172. package/dist/domain/reconstructionCoverage.js +387 -0
  173. package/dist/domain/reconstructionCoverageEvaluation.js +212 -0
  174. package/dist/domain/reconstructionVerificationSchemas.js +8 -0
  175. package/dist/domain/replayMachine.js +316 -0
  176. package/dist/domain/replayMachineRuntime.js +215 -0
  177. package/dist/domain/runtimeCharacterization.js +85 -0
  178. package/dist/domain/runtimeIdentification.js +210 -0
  179. package/dist/domain/webBundleAnalyzer.js +3 -409
  180. package/dist/domain/webBundleAnalyzerAst.js +77 -0
  181. package/dist/domain/webBundleAnalyzerInspection.js +307 -0
  182. package/dist/domain/webBundleAnalyzerResult.js +120 -0
  183. package/dist/dotnet/ManagedArtifactInspector.js +50 -29
  184. package/dist/dotnet/ManagedMemberInspector.js +51 -785
  185. package/dist/dotnet/ManagedMemberInspectorCore.js +297 -0
  186. package/dist/dotnet/ManagedMemberInstructionDecoder.js +427 -0
  187. package/dist/dotnet/ManagedMemberRows.js +120 -0
  188. package/dist/dotnet/ManagedMetadataInventory.js +42 -306
  189. package/dist/dotnet/ManagedMetadataInventoryRows.js +292 -0
  190. package/dist/dotnet/ManagedMetadataLayout.js +48 -111
  191. package/dist/dotnet/ManagedMetadataRowSizes.js +54 -0
  192. package/dist/dotnet/ManagedMethodBodyReader.js +143 -0
  193. package/dist/dotnet/ManagedNativeBoundaryHelpers.js +311 -0
  194. package/dist/dotnet/ManagedNativeBoundaryInspector.js +102 -350
  195. package/dist/dotnet/ManagedPeReader.js +59 -28
  196. package/dist/evaluation/CodexAgentEval.js +132 -0
  197. package/dist/generatedPackageMetadata.js +2 -2
  198. package/dist/ghidra/GhidraClient.js +76 -91
  199. package/dist/ghidra/GhidraClientStartup.js +29 -0
  200. package/dist/ghidra/GhidraClientWire.js +34 -0
  201. package/dist/ghidra/GhidraDefaults.js +1 -1
  202. package/dist/ghidra/GhidraDiagnostics.js +6 -1
  203. package/dist/ghidra/GhidraInstallation.js +20 -15
  204. package/dist/ghidra/GhidraLauncher.js +93 -29
  205. package/dist/ghidra/GhidraProvider.js +61 -161
  206. package/dist/ghidra/GhidraProviderCapabilities.js +173 -0
  207. package/dist/ghidra/GhidraSessionValues.js +2 -0
  208. package/dist/ghidra/GhidraSocketConnection.js +44 -7
  209. package/dist/ghidra/GhidraTargetSnapshot.js +30 -0
  210. package/dist/ghidra/GhidraTransport.js +71 -0
  211. package/dist/identity.js +4 -2
  212. package/dist/main/messages.js +5 -0
  213. package/dist/main/reload.js +49 -0
  214. package/dist/main/shutdown.js +25 -0
  215. package/dist/main/startup.js +14 -0
  216. package/dist/main/state.js +26 -0
  217. package/dist/main/transport.js +61 -0
  218. package/dist/main/types.js +1 -0
  219. package/dist/main.js +35 -146
  220. package/dist/process/PrivateRuntimeRoot.js +3 -2
  221. package/dist/process/ProcessOwnership.js +35 -0
  222. package/dist/process/ProviderProcess.js +2 -0
  223. package/dist/replay/JavaScriptReplayWorker.js +64 -50
  224. package/dist/replay/LinuxJavaScriptReplayRunner.js +173 -390
  225. package/dist/replay/LinuxJavaScriptReplaySandbox.js +140 -0
  226. package/dist/replay/ReplayOutcome.js +95 -0
  227. package/dist/replay/ReplayProcessLifecycle.js +71 -0
  228. package/dist/server/ProcessCaptureElicitation.js +157 -0
  229. package/dist/server/createServer.js +124 -56
  230. package/dist/server/javascriptApplicationResult.js +85 -0
  231. package/dist/server/registerApplicationTools/characterization.js +57 -0
  232. package/dist/server/registerApplicationTools/compareVersions.js +34 -0
  233. package/dist/server/registerApplicationTools/controlledReplay.js +38 -0
  234. package/dist/server/registerApplicationTools/coverage.js +84 -0
  235. package/dist/server/registerApplicationTools/helpers.js +42 -0
  236. package/dist/server/registerApplicationTools/traceFeature.js +26 -0
  237. package/dist/server/registerApplicationTools/types.js +1 -0
  238. package/dist/server/registerApplicationTools.js +10 -112
  239. package/dist/server/registerBrowserTools.js +59 -83
  240. package/dist/server/registerElectronTools.js +48 -49
  241. package/dist/server/registerEnhancedTools.js +34 -42
  242. package/dist/server/registerEvidenceResources.js +56 -0
  243. package/dist/server/registerInvestigationTools/helpers.js +74 -0
  244. package/dist/server/registerInvestigationTools/types.js +1 -0
  245. package/dist/server/registerInvestigationTools.js +83 -116
  246. package/dist/server/registerJavaScriptApplicationGraphResource.js +69 -0
  247. package/dist/server/registerManagedTools.js +18 -1
  248. package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +65 -0
  249. package/dist/server/registerManagedWorkflowTools/contract.js +8 -0
  250. package/dist/server/registerManagedWorkflowTools/evidence.js +43 -0
  251. package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +39 -0
  252. package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +39 -0
  253. package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +52 -0
  254. package/dist/server/registerManagedWorkflowTools/types.js +1 -0
  255. package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +75 -0
  256. package/dist/server/registerManagedWorkflowTools.js +10 -274
  257. package/dist/server/registerOfficialTools.js +73 -59
  258. package/dist/server/registerSessionRecordTools.js +137 -0
  259. package/dist/server/registerSessionStatusTool.js +97 -26
  260. package/dist/server/registerSessionTools.js +60 -164
  261. package/dist/server/sessionAvailabilityPolicy.js +10 -0
  262. package/dist/server/toolRegistrationOptions.js +101 -3
  263. package/dist/server/toolResult.js +15 -4
  264. package/package.json +11 -11
  265. package/skills/reverse-engineer-anything/SKILL.md +76 -0
  266. package/skills/reverse-engineer-anything/references/controlled-replay.md +12 -0
  267. package/skills/reverse-engineer-anything/references/evidence-workflows.md +33 -0
  268. package/skills/reverse-engineer-anything/references/javascript-applications.md +25 -0
  269. package/skills/reverse-engineer-anything/references/native-and-artifacts.md +36 -0
  270. package/skills/reverse-engineer-anything/references/runtime-observation.md +24 -0
  271. package/scripts/prepare-node-pty.mjs +0 -35
  272. package/scripts/rebuild-native.mjs +0 -22
  273. package/skills/rea-analysis/SKILL.md +0 -222
@@ -32,8 +32,8 @@ const advertisedOutputSchema = (schema) => {
32
32
  "~standard": {
33
33
  ...standard,
34
34
  jsonSchema: {
35
- input: () => closeObjectSchemas(converter({ target: "draft-2020-12" })),
36
- output: () => closeObjectSchemas(converter({ target: "draft-2020-12" })),
35
+ input: () => describeRootProperties(closeObjectSchemas(converter({ target: "draft-2020-12" }))),
36
+ output: () => describeRootProperties(closeObjectSchemas(converter({ target: "draft-2020-12" }))),
37
37
  },
38
38
  },
39
39
  };
@@ -70,7 +70,7 @@ const describeProperties = (value) => Object.fromEntries(Object.entries(value).m
70
70
  isObject(schema) && typeof schema.description !== "string"
71
71
  ? {
72
72
  ...describeProperties(schema),
73
- description: property.replaceAll("_", " "),
73
+ description: fallbackPropertyDescription(property),
74
74
  }
75
75
  : describeValue(schema),
76
76
  ])),
@@ -81,4 +81,102 @@ const describeValue = (value) => {
81
81
  return value.map(describeValue);
82
82
  return isObject(value) ? describeProperties(value) : value;
83
83
  };
84
+ const describeRootProperties = (value) => {
85
+ const properties = value.properties;
86
+ if (!isObject(properties))
87
+ return { ...value };
88
+ return {
89
+ ...value,
90
+ properties: Object.fromEntries(Object.entries(properties).map(([property, schema]) => [
91
+ property,
92
+ isObject(schema) && typeof schema.description !== "string"
93
+ ? {
94
+ ...schema,
95
+ description: fallbackPropertyDescription(property),
96
+ }
97
+ : schema,
98
+ ])),
99
+ };
100
+ };
101
+ const PROPERTY_DESCRIPTIONS = {
102
+ addresses: "Ordered provider-normalized procedure addresses to analyze.",
103
+ approved: "Explicit operator approval to perform this operation.",
104
+ after: "The later or right-hand observation to compare.",
105
+ before: "The earlier or left-hand observation to compare.",
106
+ boundary_id: "Exact reconstruction boundary identifier to evaluate.",
107
+ case_sensitive: "Whether text matching distinguishes uppercase and lowercase.",
108
+ cdp_endpoint: "Approved literal loopback Chrome DevTools Protocol endpoint.",
109
+ comment: "Exact analyst comment text to write.",
110
+ comparisons: "Validated comparison Evidence records to aggregate.",
111
+ coverage: "Exact reconstruction-coverage commitment to verify.",
112
+ detail: "Requested response detail level.",
113
+ direction: "Direction in which to traverse or compare relationships.",
114
+ document: "Exact provider document or program identity.",
115
+ error: "Structured, caller-actionable error when the operation fails.",
116
+ evidence: "Evidence v2 record produced by this operation.",
117
+ evidence_id: "Stable identifier of the recorded Evidence v2 observation.",
118
+ evidence_uri: "Session resource URI for the recorded Evidence v2 observation.",
119
+ executable: "Approved absolute path of the executable to run.",
120
+ format: "Declared input artifact format.",
121
+ name: "Exact name used by this operation.",
122
+ pattern: "Text or bounded pattern used to filter matching results.",
123
+ phase: "Current plan or execution phase of the operation.",
124
+ plan: "Content-bound execution plan and its approval commitment.",
125
+ query: "Non-empty feature or text query to investigate.",
126
+ question: "Concrete unresolved question to retain for later investigation.",
127
+ result: "Primary structured result returned by this operation.",
128
+ left: "Left-hand input used for comparison or differential execution.",
129
+ limit: "Maximum number of results to return in this page.",
130
+ limits: "Bounded resource-consumption and result-size limits for this operation.",
131
+ mode: "Operation mode that selects the requested behavior.",
132
+ offset: "Zero-based index of the first result to return.",
133
+ overwrite: "Whether an existing destination may be replaced.",
134
+ path: "Local filesystem path used by this operation.",
135
+ provider_id: "Exact deep-analysis provider ID, or automatic selection when omitted.",
136
+ right: "Right-hand input used for comparison or differential execution.",
137
+ schema_version: "Version of this structured result schema.",
138
+ source_evidence: "Evidence records supporting the prepared source transformation.",
139
+ status: "Current lifecycle or verification status.",
140
+ summary: "Concise evidence-backed summary of the result.",
141
+ symbols: "Ordered bounded Swift symbols to demangle.",
142
+ target_id: "Exact authorized CDP target identifier.",
143
+ unknown_id: "Exact residual-unknown identifier.",
144
+ unknown_registry_approved: "Explicit approval to record bounded residual uncertainty in the session registry.",
145
+ workspace_path: "Approved local path of the persistent investigation workspace.",
146
+ };
147
+ const fallbackPropertyDescription = (property) => {
148
+ const explicit = PROPERTY_DESCRIPTIONS[property];
149
+ if (explicit !== undefined)
150
+ return explicit;
151
+ const words = property.replaceAll("_", " ");
152
+ if (property.endsWith("_approved"))
153
+ return `Explicit operator approval for ${words.slice(0, -9)}.`;
154
+ if (property.endsWith("_offset"))
155
+ return `Zero-based index of the first ${words.slice(0, -7)} to return.`;
156
+ if (property.endsWith("_limit"))
157
+ return `Maximum number of ${words.slice(0, -6)} entries to return.`;
158
+ if (property.startsWith("max_"))
159
+ return `Maximum permitted ${words.slice(4)} for this operation.`;
160
+ if (property.startsWith("include_"))
161
+ return `Whether to include ${words.slice(8)} in the result.`;
162
+ if (property.startsWith("expected_"))
163
+ return `Expected ${words.slice(9)} used to reject stale or mismatched input.`;
164
+ if (property.endsWith("_sha256"))
165
+ return `Exact SHA-256 digest of ${words.slice(0, -7)}.`;
166
+ if (property.endsWith("_evidence_id"))
167
+ return `Exact Evidence v2 identifier for the ${words.slice(0, -12)} observation.`;
168
+ if (property.endsWith("_evidence_ids"))
169
+ return `Ordered Evidence v2 identifiers for the ${words.slice(0, -13)} observations.`;
170
+ if (property.endsWith("_path"))
171
+ return `Local filesystem path for ${words.slice(0, -5)}.`;
172
+ if (property.endsWith("_uri"))
173
+ return `Canonical URI for ${words.slice(0, -4)}.`;
174
+ if (property.endsWith("_bytes"))
175
+ return `Bounded byte count for ${words.slice(0, -6)}.`;
176
+ if (property.endsWith("_root") || property.endsWith("_roots"))
177
+ return `Approved canonical filesystem ${words}.`;
178
+ if (property.startsWith("is_") || property.startsWith("has_"))
179
+ return `Whether ${words}.`;
180
+ return `Value for ${words}.`;
181
+ };
84
182
  const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -22,7 +22,7 @@ const errorResult = (error) => {
22
22
  };
23
23
  };
24
24
  const successResult = (value, contract, options) => {
25
- const candidate = compactEvidence(value) ??
25
+ const candidate = compactEvidence(value, options.evidenceResultProjection) ??
26
26
  (contract.kind === "session" ? { result: value } : value);
27
27
  const parsed = contract.outputSchema.safeParse(candidate);
28
28
  if (!parsed.success) {
@@ -42,14 +42,25 @@ const successResult = (value, contract, options) => {
42
42
  }
43
43
  return {
44
44
  content: [
45
- { type: "text", text: JSON.stringify(parsed.data) },
45
+ {
46
+ type: "text",
47
+ text: JSON.stringify(options.evidenceTextProjection === undefined
48
+ ? parsed.data
49
+ : (compactEvidence(value, options.evidenceTextProjection) ??
50
+ options.evidenceTextProjection)),
51
+ },
46
52
  ...evidenceResourceLinks(value, contract.kind === "session" ||
47
53
  options.evidenceResourcesAvailable === true),
54
+ ...(options.resourceLinks ?? []).map((resource) => ({
55
+ type: "resource_link",
56
+ ...resource,
57
+ mimeType: "application/json",
58
+ })),
48
59
  ],
49
60
  structuredContent: candidate,
50
61
  };
51
62
  };
52
- const compactEvidence = (value) => {
63
+ const compactEvidence = (value, resultProjection) => {
53
64
  if (typeof value !== "object" ||
54
65
  value === null ||
55
66
  Array.isArray(value) ||
@@ -58,7 +69,7 @@ const compactEvidence = (value) => {
58
69
  !("normalized_result" in value))
59
70
  return undefined;
60
71
  return {
61
- result: value.normalized_result,
72
+ result: resultProjection ?? value.normalized_result,
62
73
  evidence_id: value.evidence_id,
63
74
  evidence_uri: `rea://evidence/${value.evidence_id}`,
64
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rea-agents",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Reverse engineer anything from your terminal or agent with one CLI and MCP server.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,7 +30,8 @@
30
30
  },
31
31
  "type": "module",
32
32
  "bin": {
33
- "rea": "scripts/rea.mjs"
33
+ "rea": "scripts/rea.mjs",
34
+ "rea-agents": "scripts/rea.mjs"
34
35
  },
35
36
  "engines": {
36
37
  "node": "^22.19.0 || >=24.11.0"
@@ -42,8 +43,6 @@
42
43
  "bridge/hopper_bridge.py",
43
44
  "bridge/ghidra/ReaGhidraBridge.java",
44
45
  "scripts/rea.mjs",
45
- "scripts/prepare-node-pty.mjs",
46
- "scripts/rebuild-native.mjs",
47
46
  "scripts/hopper-demo-x11.py",
48
47
  "skills",
49
48
  "README.md",
@@ -66,7 +65,6 @@
66
65
  "scan:todos": "node scripts/scan-todos.mjs",
67
66
  "start": "node scripts/rea.mjs mcp",
68
67
  "pretest": "npm run build",
69
- "postinstall": "node scripts/prepare-node-pty.mjs",
70
68
  "test": "vitest run",
71
69
  "pretest:coverage": "npm run build",
72
70
  "test:coverage": "vitest run --coverage.enabled --coverage.provider=v8",
@@ -75,16 +73,21 @@
75
73
  "typecheck": "tsc --noEmit",
76
74
  "verify:hopper": "npm run build && node scripts/verify-real-hopper.mjs",
77
75
  "verify:ghidra": "npm run build && node scripts/verify-real-ghidra.mjs",
76
+ "verify:ghidra:windows": "npm run build && npm run build:ghidra-windows-fixture && node scripts/verify-real-ghidra-windows.mjs",
78
77
  "verify:browser": "npm run build && node scripts/verify-real-browser.mjs",
79
78
  "verify:javascript-runtime": "npm run build && node scripts/verify-local-javascript-runtime.mjs",
80
79
  "verify:application-workflows": "npm run build && node scripts/verify-local-application-workflows.mjs",
81
80
  "verify:managed": "npm run build && node scripts/verify-managed-conformance.mjs",
82
81
  "verify:replay": "npm run build && node scripts/verify-real-javascript-replay.mjs",
82
+ "verify:agent": "npm run build && node scripts/verify-agent-experience.mjs",
83
83
  "verify:hopper:linux": "npm run build && node scripts/verify-real-hopper-linux.mjs",
84
84
  "verify:setup:linux": "npm run build && node scripts/verify-linux-setup-e2e.mjs",
85
85
  "build:fixtures": "node scripts/build-conformance-fixtures.mjs",
86
+ "build:ghidra-windows-fixture": "node scripts/create-ghidra-windows-fixture.mjs",
86
87
  "verify:fixtures": "npm run build:fixtures && node scripts/verify-conformance-fixtures.mjs",
87
88
  "verify:package": "npm run build && node scripts/verify-package.mjs",
89
+ "verify:package:windows": "npm run build && node scripts/verify-windows-package.mjs",
90
+ "probe:windows-capabilities": "npm run build && node scripts/windows-capabilities.mjs",
88
91
  "verify:published": "node scripts/verify-published-package.mjs",
89
92
  "config:print": "node scripts/print-mcp-config.mjs",
90
93
  "docs:generate": "npm run build && node scripts/generate-skill-metadata.mjs && node scripts/generate-product-catalog.mjs && typedoc && node scripts/generate-error-schema.mjs",
@@ -92,8 +95,7 @@
92
95
  "docs:error-schema": "npm run build && node scripts/generate-error-schema.mjs",
93
96
  "prepack": "npm run deps:check && node scripts/generate-skill-metadata.mjs --check",
94
97
  "prepublishOnly": "npm run deps:check && node scripts/generate-skill-metadata.mjs --check",
95
- "prepare": "npm run build && husky",
96
- "rebuild:native": "node scripts/rebuild-native.mjs"
98
+ "prepare": "npm run build && husky"
97
99
  },
98
100
  "lint-staged": {
99
101
  "*.{ts,mjs,json,md,yml,yaml}": "prettier --write",
@@ -102,8 +104,10 @@
102
104
  "dependencies": {
103
105
  "@babel/parser": "8.0.4",
104
106
  "@babel/types": "8.0.4",
107
+ "@clack/prompts": "1.7.0",
105
108
  "@electron/asar": "4.2.0",
106
109
  "@jridgewell/trace-mapping": "0.3.31",
110
+ "@lydell/node-pty": "1.1.0",
107
111
  "@modelcontextprotocol/server": "2.0.0-beta.4",
108
112
  "@xterm/addon-serialize": "0.14.0",
109
113
  "@xterm/headless": "6.0.0",
@@ -115,7 +119,6 @@
115
119
  "ignore": "7.0.6",
116
120
  "incur": "0.4.13",
117
121
  "isomorphic-git": "1.38.7",
118
- "node-pty": "1.1.0",
119
122
  "pino": "9.14.0",
120
123
  "plist": "5.0.0",
121
124
  "semver": "7.8.5",
@@ -141,8 +144,5 @@
141
144
  "typedoc": "0.28.20",
142
145
  "typescript": "5.9.3",
143
146
  "vitest": "4.1.10"
144
- },
145
- "allowScripts": {
146
- "node-pty@1.1.0": true
147
147
  }
148
148
  }
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: reverse-engineer-anything
3
+ description: Reverse engineer native, managed, Electron/JavaScript, packaged, and browser applications with REA. Use shipped-artifact or approved runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.
4
+ metadata:
5
+ version: "23"
6
+ tool_count: 95
7
+ catalog_digest: "f8a4a8392f73780686234656e3e4555539a828e021c72754e4131c83df349b9f"
8
+ ---
9
+
10
+ # REA
11
+
12
+ Use REA when a claim depends on a shipped binary or package, decompilation,
13
+ passive application runtime evidence, controlled replay, or comparison with
14
+ behavior not established by available source. For ordinary analysis of a
15
+ complete source repository, use normal repository tools and do not run REA
16
+ readiness or provider commands.
17
+
18
+ ## Route the target first
19
+
20
+ Choose the first tool from the target the user supplied. Do not call
21
+ `open_binary` unless the target is native or an analysis database.
22
+
23
+ - ASAR or extracted JavaScript/Electron tree:
24
+ `analyze_javascript_application`.
25
+ - Archive, application package, ZIP/APK/IPA, or DMG: `inventory_artifact`.
26
+ - Managed PE/CLI assembly: `inspect_managed_artifact`.
27
+ - User-owned browser page already open: `list_browser_targets`.
28
+ - User-owned Electron runtime already open: `list_electron_targets`.
29
+ - Native executable, library, or analysis database: `open_binary`, then
30
+ `binary_overview`.
31
+
32
+ If the app is missing, ask which app to inspect. Resolve a human-readable app
33
+ name to one clear installed artifact when possible; ask only when matches are
34
+ ambiguous. Never choose an example app on the user's behalf.
35
+
36
+ ## Work summary-first
37
+
38
+ Start with the default summary projection. Do not repeat an identical tool call.
39
+ Do not fetch full Evidence or a full application graph unless a specific claim
40
+ requires detail absent from the summary. For JavaScript graphs, follow the
41
+ paged resource URIs returned by the summary and fetch only the relevant page.
42
+
43
+ Every conclusion must distinguish observations, inferences, and unknowns. Cite
44
+ Evidence IDs, preserve limitations and incomplete coverage, and never imply
45
+ that static analysis observed execution. Ask for approval only where a tool or
46
+ policy requires it; approval never broadens a different authority boundary.
47
+
48
+ ## Read only the relevant guide
49
+
50
+ - Native binaries, managed assemblies, archives, and extraction:
51
+ [references/native-and-artifacts.md](references/native-and-artifacts.md)
52
+ - ASARs, extracted JavaScript, feature tracing, and version comparison:
53
+ [references/javascript-applications.md](references/javascript-applications.md)
54
+ - Passive browser/Electron observation and static/runtime reconciliation:
55
+ [references/runtime-observation.md](references/runtime-observation.md)
56
+ - Evidence paging, comparisons, residual unknowns, and verification:
57
+ [references/evidence-workflows.md](references/evidence-workflows.md)
58
+ - Controlled JavaScript replay:
59
+ [references/controlled-replay.md](references/controlled-replay.md)
60
+
61
+ ## Readiness and setup
62
+
63
+ If REA tools are available, use them directly; do not run `doctor` on every
64
+ task. If the MCP server is unavailable or registration is reported stale, run
65
+ `npx -y rea-agents@latest doctor`. Propose
66
+ `npx -y rea-agents@latest setup` only when doctor identifies an alignment or
67
+ provider problem. Show the exact plan and obtain approval before setup writes
68
+ configuration or installs Hopper. Restart the agent after MCP registration
69
+ changes; direct CLI commands remain available immediately.
70
+
71
+ ## Finish the task
72
+
73
+ Explain findings in plain language and tie them to returned evidence. When the
74
+ user asks to build something, use normal coding tools and separate observed
75
+ behavior from design choices. Close an opened native session with
76
+ `close_binary` when the investigation is complete.
@@ -0,0 +1,12 @@
1
+ # Controlled JavaScript replay
2
+
3
+ Use `run_controlled_replay` only for operator-selected extracted modules when
4
+ the separate replay policy is enabled. Call `mode: plan` first. Review the exact
5
+ module, stub, runtime, sandbox, case, limits, and policy commitments. Execute
6
+ only with `approved: true` and that exact plan digest.
7
+
8
+ Treat return values, exceptions, denials, limits, and crashes as observations of
9
+ the isolated experiment with controlled-replay authority, not facts about the
10
+ real application. Never substitute browser/Electron permission, process
11
+ capture, or an in-process `vm` run. Reproducer export requires separate literal
12
+ approval and evidence-write authority after sandbox cleanup.
@@ -0,0 +1,33 @@
1
+ # Evidence, comparison, and verification workflows
2
+
3
+ REA results are Evidence v2. Cite evidence IDs and preserve authority,
4
+ limitations, coverage, and residual unknowns. Read the smallest deterministic
5
+ page that answers the question. Continue from a returned next offset while
6
+ `has_more` is true only when exhaustive coverage matters.
7
+
8
+ Use `record_unknown` only with explicit approval and name the authority or
9
+ environment still required. Supply supporting and contradicting evidence IDs.
10
+ Use `update_unknown` with the current revision; reread after a stale revision
11
+ instead of retrying blindly. Only qualifying observed evidence can verify a
12
+ resolution.
13
+
14
+ Use comparisons with complete, compatible page sets when claiming equivalence
15
+ or absence:
16
+
17
+ - `compare_artifacts` compares inventory pages by occurrence path, content,
18
+ metadata, and graph relations.
19
+ - `compare_functions` compares explicit function Evidence, not fuzzy
20
+ whole-binary matches.
21
+ - `compare_bundles` compares canonical bundle membership and unknown history.
22
+ - `find_changed_behavior` combines existing comparisons; static differences
23
+ remain candidates, not causal proof.
24
+ - `build_call_path` needs explicit function dossiers from one artifact/provider;
25
+ an incomplete frontier makes absence unknown.
26
+ - `correlate_static_and_runtime` uses explicit mappings; matching patterns are
27
+ hypotheses, not causality.
28
+ - `verify_reconstruction` evaluates a finite typed specification. A pass covers
29
+ only declared comparable claims, not global equivalence.
30
+
31
+ Process captures are opt-in behavioral evidence, not a security sandbox. V3
32
+ captures cannot be upgraded to V4; rerun the original scenario. Distinguish root
33
+ exit from descendant settlement and require freshness when the task needs it.
@@ -0,0 +1,25 @@
1
+ # JavaScript and Electron application artifacts
2
+
3
+ Use `analyze_javascript_application` for an operator-supplied ASAR or extracted
4
+ tree beneath an approved investigation root. Every call requires `approved:
5
+ true`; source-map contents require separate approval. Keep the default summary.
6
+ Use its counts, roots, node kinds, top findings, coverage, unknowns, and graph
7
+ page URIs before requesting more data.
8
+
9
+ BrowserWindow preferences, preload and contextBridge surfaces, IPC
10
+ registrations, utility processes, and native binding requests are static syntax
11
+ observations. Only a unique exact literal IPC channel match supports an inferred
12
+ pairing. Dynamic or ambiguous channels remain unresolved. A requested `.node`
13
+ member is not a verified native export. Never claim runtime reachability,
14
+ registration, defaults, or policy enforcement from static analysis.
15
+
16
+ Use `trace_application_feature` on existing application Evidence for one
17
+ literal node ID, route, string, API, IPC channel, module, or native export.
18
+ Choose a direction and finite bounds. Link Hopper or Ghidra Evidence only when
19
+ the exact artifact digest matches.
20
+
21
+ For version comparison, analyze each version once, then call
22
+ `compare_application_versions`. Accept only its digest, source-map, structural
23
+ fingerprint, or non-module semantic matches. Module ordinals and minified names
24
+ are not persistent identity. Report added or removed only with complete
25
+ opposite-side coverage; otherwise report unknown.
@@ -0,0 +1,36 @@
1
+ # Native, managed, and packaged artifacts
2
+
3
+ ## Native targets
4
+
5
+ After `open_binary`, use `binary_overview` once and narrow around the requested
6
+ feature. Prefer literal search, names, decompilation, callers, callees, and
7
+ cross-references. Addresses and recovered pseudocode are analysis observations,
8
+ not original source. Provider unavailability and unsupported metadata remain
9
+ unknown rather than false.
10
+
11
+ Use `binary_session` with its default summary to check the open target, selected
12
+ provider, alignment, and recommended remediation. Request the capabilities view
13
+ with a family filter and page bounds only when choosing a tool. Request the full
14
+ view only for an explicit session-diagnostic need.
15
+
16
+ ## Managed PE/CLI
17
+
18
+ Start with `inspect_managed_artifact`. REA's canonical managed inspection is
19
+ execution-free: do not claim it loaded, reflected, executed, or resolved the
20
+ assembly. Keep managed/native boundaries and unavailable reconstruction facts
21
+ explicit. A bring-your-own reconstruction oracle is separate from the canonical
22
+ parser and must not become an implicit setup dependency.
23
+
24
+ ## Packages and extraction
25
+
26
+ Call `inventory_artifact` before extraction for application bundles, archives,
27
+ ZIP/APK/IPA, ASAR, or DMG inputs. Continue deterministic occurrence pages from
28
+ the returned offset only when needed. Cite graph manifest IDs.
29
+
30
+ `extract_artifact` requires explicit approval, an absent absolute output root,
31
+ and selected occurrence IDs. Never extract every entry implicitly. Symlinks and
32
+ encrypted entries are inventory facts, not extractable files.
33
+
34
+ Native DMG traversal is macOS-only, read-only, and requires both operator policy
35
+ and `native_mount_approved: true`; without both, retain the root-hash-only result.
36
+ Approval for inventory never grants extraction authority.
@@ -0,0 +1,24 @@
1
+ # Passive browser and Electron observation
2
+
3
+ Before browser observation, the operator must configure the exact loopback CDP
4
+ endpoint and allowed HTTP(S) origins. Before Electron observation, configure its
5
+ separate loopback endpoint and canonical file roots. Obtain the per-call
6
+ approval required by the selected tool.
7
+
8
+ Start browser work with `list_browser_targets`; start Electron runtime work with
9
+ `list_electron_targets`. Inspect only the selected approved target. Observation
10
+ is passive: never claim REA clicked, navigated, evaluated page JavaScript,
11
+ invoked IPC, captured prior activity, or contained the page's network.
12
+
13
+ Credentials, cookies, authorization headers, storage values, query values, and
14
+ raw WebSocket/JSON values are deliberately absent. Accessibility text, console
15
+ primitives, value-free shapes, script sources, source maps, storage key names,
16
+ and screenshot pixels have independent opt-ins. Treat policy filtering,
17
+ truncation, and attach-window coverage as limitations. Page-declared WebMCP
18
+ tools are untrusted inventory and are never invoked by REA.
19
+
20
+ Use `reconcile_javascript_runtime` only after static application Evidence and
21
+ passive browser/Electron Evidence exist. Prefer captured-source digest identity;
22
+ report path/digest disagreement as a mismatch and preserve ambiguity. Explicit
23
+ path mappings are inference inputs and never broaden filesystem or CDP authority.
24
+ A bundle observed at runtime does not prove every contained module executed.
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { chmod, lstat } from "node:fs/promises";
4
- import { createRequire } from "node:module";
5
- import { dirname, join } from "node:path";
6
- import { fileURLToPath } from "node:url";
7
-
8
- if (process.platform !== "win32") {
9
- const require = createRequire(import.meta.url);
10
- const packageRoot = dirname(
11
- require.resolve("node-pty/package.json", {
12
- paths: [dirname(fileURLToPath(import.meta.url))],
13
- }),
14
- );
15
- const helperPath = join(
16
- packageRoot,
17
- "prebuilds",
18
- `${process.platform}-${process.arch}`,
19
- "spawn-helper",
20
- );
21
-
22
- try {
23
- const helper = await lstat(helperPath);
24
- if (!helper.isFile() || helper.isSymbolicLink()) {
25
- throw new Error("node-pty spawn helper is not a regular file");
26
- }
27
- await chmod(helperPath, helper.mode | 0o111);
28
- } catch (error) {
29
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
30
- // Source builds place their correctly-modeled helper under build/Release.
31
- } else {
32
- throw error;
33
- }
34
- }
35
- }
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { spawn } from "node:child_process";
4
-
5
- const npm = process.platform === "win32" ? "npm.cmd" : "npm";
6
- const child = spawn(npm, ["rebuild", "node-pty"], {
7
- stdio: "inherit",
8
- env: { ...process.env, npm_config_build_from_source: "true" },
9
- });
10
-
11
- child.once("error", (error) => {
12
- console.error(`Unable to rebuild node-pty: ${error.message}`);
13
- process.exitCode = 1;
14
- });
15
- child.once("exit", (code, signal) => {
16
- if (signal !== null) {
17
- console.error(`node-pty rebuild terminated by ${signal}`);
18
- process.exitCode = 1;
19
- return;
20
- }
21
- process.exitCode = code ?? 1;
22
- });