rea-agents 3.2.1 → 4.0.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 (434) hide show
  1. package/README.md +183 -332
  2. package/bridge/ghidra/ReaGhidraBridge.java +561 -74
  3. package/bridge/hopper_bridge.py +70 -27
  4. package/bridge/native/ReaNativeUI.swift +157 -0
  5. package/dist/application/AnalysisContextQueries.js +19 -5
  6. package/dist/application/AnalysisSnapshotCache.js +30 -11
  7. package/dist/application/AppleAssetCatalogAnalysis.js +171 -0
  8. package/dist/application/ArtifactExtractionDestination.js +0 -12
  9. package/dist/application/ArtifactGraphConstruction.js +44 -11
  10. package/dist/application/ArtifactInventory/classify.js +7 -15
  11. package/dist/application/ArtifactInventory/hash.js +4 -2
  12. package/dist/application/ArtifactInventory/policy.js +2 -17
  13. package/dist/application/ArtifactInventory/reader.js +3 -3
  14. package/dist/application/ArtifactInventory/scanCanonical.js +2 -2
  15. package/dist/application/ArtifactInventory/scanReader.js +12 -4
  16. package/dist/application/ArtifactInventory/types.js +0 -3
  17. package/dist/application/BinarySession.js +28 -43
  18. package/dist/application/BinarySessionExecution.js +37 -1
  19. package/dist/application/BinaryTargetResolver.js +50 -4
  20. package/dist/application/BrowserEvidence.js +36 -7
  21. package/dist/application/BrowserObservationService.js +17 -44
  22. package/dist/application/BrowserScenarioCaptureService.js +2 -35
  23. package/dist/application/BrowserScenarioEvidence.js +13 -9
  24. package/dist/application/CapabilityClientRequirements.js +2 -11
  25. package/dist/application/CapabilityInventory.js +21 -35
  26. package/dist/application/ClientConfigurationDocument.js +84 -7
  27. package/dist/application/ClientRegistrationIdentity.js +32 -0
  28. package/dist/application/ClientRegistrationStatus.js +59 -6
  29. package/dist/application/DirectAnalysis.js +37 -58
  30. package/dist/application/DirectAnalysisStatus.js +4 -4
  31. package/dist/application/Doctor.js +89 -80
  32. package/dist/application/DoctorDiagnostics.js +2 -26
  33. package/dist/application/DoctorScope.js +8 -14
  34. package/dist/application/ElectronActiveEvidence.js +10 -27
  35. package/dist/application/ElectronActiveObservationService.js +9 -36
  36. package/dist/application/ElectronBoundaryAnalysis.js +2 -0
  37. package/dist/application/ElectronBoundaryGraphNative.js +1 -1
  38. package/dist/application/ElectronEvidence.js +8 -3
  39. package/dist/application/ElectronObservationService.js +9 -25
  40. package/dist/application/EnhancedLiteralTracing.js +4 -8
  41. package/dist/application/EnhancedTools.js +15 -35
  42. package/dist/application/FilesystemSnapshot.js +7 -8
  43. package/dist/application/JavaScriptApplicationEvidenceGraph.js +2 -1
  44. package/dist/application/JavaScriptApplicationWorkflowService.js +31 -7
  45. package/dist/application/JavaScriptArtifactAnalysis.js +6 -4
  46. package/dist/application/JavaScriptArtifactFiles.js +5 -0
  47. package/dist/application/JavaScriptArtifactPathResolution.js +179 -47
  48. package/dist/application/JavaScriptRuntimeObservationEvidence.js +6 -3
  49. package/dist/application/JavaScriptRuntimeObservationService.js +9 -25
  50. package/dist/application/JavaScriptRuntimeReconciliationService.js +45 -4
  51. package/dist/application/JavaScriptSemanticGraphAsyncProjection.js +11 -0
  52. package/dist/application/JavaScriptSemanticGraphChildProcessProjection.js +11 -0
  53. package/dist/application/JavaScriptSemanticGraphDataProjection.js +11 -0
  54. package/dist/application/JavaScriptSemanticGraphFlowProjection.js +14 -5
  55. package/dist/application/JsonFiles.js +1 -1
  56. package/dist/application/LazyAnalysisProvider.js +27 -6
  57. package/dist/application/ManagedMemberComparisonService.js +19 -6
  58. package/dist/application/NativeApiInspection.js +2 -0
  59. package/dist/application/NativeCallRoutes.js +72 -0
  60. package/dist/application/NativeDispatchMetadataInspection.js +33 -0
  61. package/dist/application/NativeUiActionTrace.js +73 -49
  62. package/dist/application/NativeValueTrace.js +320 -0
  63. package/dist/application/ProcessCaptureCapability.js +32 -5
  64. package/dist/application/ProcessCaptureEnvironment.js +9 -26
  65. package/dist/application/ProcessCaptureError.js +1 -5
  66. package/dist/application/ProcessCaptureJournal.js +3 -40
  67. package/dist/application/ProcessCaptureLifecycle.js +102 -111
  68. package/dist/application/ProcessCli.js +18 -25
  69. package/dist/application/ProcessEvidence.js +5 -7
  70. package/dist/application/ProcessFilesystemEffects.js +36 -0
  71. package/dist/application/ProcessHarness.js +41 -120
  72. package/dist/application/ProcessNormalization.js +2 -17
  73. package/dist/application/ProcessScenarioRuntimeValidation.js +76 -0
  74. package/dist/application/ReferenceSourceImport.js +3 -4
  75. package/dist/application/Setup.js +236 -84
  76. package/dist/application/SetupClientConfiguration.js +14 -9
  77. package/dist/application/SetupPlan.js +138 -86
  78. package/dist/application/SetupSkill.js +0 -1
  79. package/dist/application/SupportedClients.js +102 -21
  80. package/dist/application/Uninstall.js +31 -20
  81. package/dist/application/Update.js +93 -0
  82. package/dist/application/UpdateMaintenance.js +108 -0
  83. package/dist/application/UpdateRuntime.js +126 -0
  84. package/dist/application/runtime.js +13 -2
  85. package/dist/artifacts/ArtifactPaths.js +6 -8
  86. package/dist/artifacts/ArtifactProvider.js +94 -41
  87. package/dist/artifacts/AsarArtifactReader.js +19 -4
  88. package/dist/artifacts/KeyedArchiveReader.js +110 -0
  89. package/dist/artifacts/MachOSliceArtifactReader.js +53 -5
  90. package/dist/artifacts/ZipArtifactReader.js +18 -1
  91. package/dist/browser/BrowserScenarioSecrets.js +28 -1
  92. package/dist/browser/CdpBrowserProvider.js +36 -15
  93. package/dist/browser/CdpCaptureDocuments.js +22 -8
  94. package/dist/browser/CdpCaptureEventHandlers.js +14 -5
  95. package/dist/browser/CdpCaptureEventHelpers.js +13 -0
  96. package/dist/browser/CdpCaptureEvents.js +10 -1
  97. package/dist/browser/CdpElectronInspection.js +5 -10
  98. package/dist/browser/CdpElectronProvider.js +1 -5
  99. package/dist/browser/CdpElectronScripts.js +1 -1
  100. package/dist/browser/CdpEndpoint.js +3 -2
  101. package/dist/browser/CdpObservationSession.js +14 -10
  102. package/dist/browser/CdpPageCapture.js +1 -1
  103. package/dist/browser/CdpPageCaptureScripts.js +1 -1
  104. package/dist/browser/CdpSafeMetadata.js +5 -4
  105. package/dist/browser/CdpScreenshot.js +16 -5
  106. package/dist/browser/CdpTargetSession.js +25 -4
  107. package/dist/browser/CdpWebMcpDiscovery.js +93 -20
  108. package/dist/browser/JavaScriptRuntimeScope.js +28 -2
  109. package/dist/browser/PlaywrightBrowserScenarioProvider.js +9 -8
  110. package/dist/browser/PlaywrightElectronActiveActions.js +3 -10
  111. package/dist/browser/PlaywrightElectronActiveProvider.js +5 -5
  112. package/dist/browser/PlaywrightScenarioActions.js +1 -1
  113. package/dist/browser/PlaywrightScenarioArtifacts.js +13 -25
  114. package/dist/browser/PlaywrightScenarioBrowser.js +28 -25
  115. package/dist/browser/PlaywrightScenarioEvents.js +82 -93
  116. package/dist/browser/PlaywrightScenarioSession.js +27 -123
  117. package/dist/browser/PngVisualDiff.js +22 -3
  118. package/dist/browser/V8InspectorCaptureProjection.js +7 -1
  119. package/dist/browser/V8InspectorProvider.js +60 -7
  120. package/dist/browser/WebSourceMapFetcher.js +99 -53
  121. package/dist/cli/artifactCommands.js +56 -12
  122. package/dist/cli/coreAnalysisCommands.js +110 -0
  123. package/dist/cli/managedCommands.js +1 -31
  124. package/dist/cli/setupCommands.js +16 -14
  125. package/dist/cli/utilityCommands.js +61 -4
  126. package/dist/cli.js +5 -7
  127. package/dist/cliApplicationCommands.js +0 -83
  128. package/dist/cliBrowserAdvancedCommands.js +7 -11
  129. package/dist/cliBrowserCommands.js +15 -23
  130. package/dist/cliBrowserContext.js +3 -24
  131. package/dist/cliBrowserScenarioCommands.js +2 -10
  132. package/dist/cliCommandNames.js +82 -7
  133. package/dist/cliElectronCommands.js +10 -36
  134. package/dist/cliJavaScriptRuntimeCommands.js +6 -30
  135. package/dist/cliJsonInput.js +4 -2
  136. package/dist/cliLogging.js +16 -7
  137. package/dist/cliObservationOptions.js +1 -1
  138. package/dist/cliOutput.js +2 -4
  139. package/dist/cliProcessCommands.js +6 -33
  140. package/dist/cliSetup.js +90 -160
  141. package/dist/config/environment.js +2 -78
  142. package/dist/config/parseConfig.js +18 -109
  143. package/dist/config/parsers.js +0 -23
  144. package/dist/contracts/applicationToolContracts.js +1 -118
  145. package/dist/contracts/artifactToolContracts.js +11 -19
  146. package/dist/contracts/browserScenarioToolContracts.js +1 -5
  147. package/dist/contracts/browserToolContracts.js +9 -16
  148. package/dist/contracts/electronToolContracts.js +5 -6
  149. package/dist/contracts/enhancedInputs.js +3 -2
  150. package/dist/contracts/errorSchemas.js +16 -40
  151. package/dist/contracts/functionWorkflowToolContracts.js +2 -2
  152. package/dist/contracts/javascriptApplicationWorkflowExamples.js +2 -2
  153. package/dist/contracts/javascriptRuntimeObservationToolContracts.js +4 -4
  154. package/dist/contracts/javascriptRuntimeReconciliationExample.js +1 -1
  155. package/dist/contracts/managedToolContracts.js +7 -4
  156. package/dist/contracts/managedWorkflowExamples.js +0 -22
  157. package/dist/contracts/managedWorkflowToolContracts.js +16 -31
  158. package/dist/contracts/nativeToolContracts.js +9 -0
  159. package/dist/contracts/promptContracts.js +6 -6
  160. package/dist/contracts/sessionToolSchemas.js +3 -3
  161. package/dist/contracts/toolContractExamples.js +4 -3
  162. package/dist/contracts/toolContracts.js +18 -7
  163. package/dist/contracts/toolEffects.js +34 -21
  164. package/dist/contracts/toolOutputSchemaGroups.js +18 -5
  165. package/dist/contracts/toolOutputSchemaPrimitives.js +9 -6
  166. package/dist/contracts/toolSchemaMetadata.js +5 -8
  167. package/dist/doctorRuntime.js +0 -41
  168. package/dist/domain/analysisErrorPresentation.js +4 -28
  169. package/dist/domain/analysisErrorProjection.js +33 -50
  170. package/dist/domain/analysisProfile.js +1 -1
  171. package/dist/domain/analysisSnapshot.js +77 -3
  172. package/dist/domain/androidApplication.js +5 -4
  173. package/dist/domain/appleApplication.js +5 -4
  174. package/dist/domain/appleAssetCatalog.js +127 -0
  175. package/dist/domain/artifactComparison.js +7 -11
  176. package/dist/domain/artifactGraph.js +8 -6
  177. package/dist/domain/artifactInspection.js +13 -12
  178. package/dist/domain/binaryTarget.js +23 -9
  179. package/dist/domain/browserObservation.js +43 -24
  180. package/dist/domain/browserObservationSchemas.js +2 -1
  181. package/dist/domain/browserScenario.js +7 -107
  182. package/dist/domain/browserScenarioCapture.js +0 -1
  183. package/dist/domain/browserScenarioCaptureValues.js +5 -4
  184. package/dist/domain/browserScenarioDiff.js +1 -3
  185. package/dist/domain/browserScenarioValues.js +16 -107
  186. package/dist/domain/bundleComparison.js +18 -17
  187. package/dist/domain/callPathSchemas.js +17 -7
  188. package/dist/domain/changedBehavior.js +2 -3
  189. package/dist/domain/comparisonSemantics.js +19 -0
  190. package/dist/domain/completionLedgerGeneration.js +3 -2
  191. package/dist/domain/conformancePackage.js +2 -1
  192. package/dist/domain/conformanceTrustGate.js +3 -5
  193. package/dist/domain/customProtocolCapture.js +2 -2
  194. package/dist/domain/digests.js +30 -0
  195. package/dist/domain/dosMz.js +83 -0
  196. package/dist/domain/electronActiveObservation.js +7 -5
  197. package/dist/domain/electronObservation.js +3 -2
  198. package/dist/domain/electronStaticAnalysisNative.js +15 -6
  199. package/dist/domain/emptyArraySchema.js +3 -0
  200. package/dist/domain/errors.js +10 -28
  201. package/dist/domain/evidence.js +5 -3
  202. package/dist/domain/evidenceCompletionLedger.js +3 -2
  203. package/dist/domain/functionComparisonNormalization.js +24 -18
  204. package/dist/domain/functionComparisonResults.js +3 -7
  205. package/dist/domain/functionComparisonSchemas.js +3 -2
  206. package/dist/domain/hopperValues.js +108 -8
  207. package/dist/domain/javascriptApplicationAnalysis.js +4 -7
  208. package/dist/domain/javascriptApplicationEvidenceSchemas.js +4 -3
  209. package/dist/domain/javascriptApplicationGraphSchemas.js +8 -7
  210. package/dist/domain/javascriptApplicationVersionComparisonSchemas.js +9 -7
  211. package/dist/domain/javascriptApplicationVersionItems.js +12 -18
  212. package/dist/domain/javascriptAstValues.js +4 -0
  213. package/dist/domain/javascriptExportShapeComparison.js +1 -6
  214. package/dist/domain/javascriptExportShapeComparisonSchemas.js +6 -10
  215. package/dist/domain/javascriptExportShapeVariants.js +15 -2
  216. package/dist/domain/javascriptFeatureTraceSchemas.js +8 -7
  217. package/dist/domain/javascriptRuntimeObservation.js +14 -2
  218. package/dist/domain/javascriptRuntimeReconciliationMatching.js +8 -0
  219. package/dist/domain/javascriptRuntimeReconciliationParsing.js +4 -2
  220. package/dist/domain/javascriptRuntimeReconciliationResult.js +6 -4
  221. package/dist/domain/javascriptRuntimeReconciliationRuntime.js +15 -4
  222. package/dist/domain/javascriptRuntimeReconciliationSchemas.js +19 -18
  223. package/dist/domain/javascriptRuntimeStaticCandidates.js +18 -6
  224. package/dist/domain/javascriptSemanticAnalysis.js +57 -19
  225. package/dist/domain/javascriptSemanticAsyncEffects.js +39 -40
  226. package/dist/domain/javascriptSemanticCalls.js +46 -27
  227. package/dist/domain/javascriptSemanticChildProcesses.js +43 -50
  228. package/dist/domain/javascriptSemanticDataEffectHelpers.js +91 -18
  229. package/dist/domain/javascriptSemanticDataEffects.js +22 -10
  230. package/dist/domain/javascriptSemanticGraphSchemas.js +8 -6
  231. package/dist/domain/javascriptSemanticObjects.js +13 -3
  232. package/dist/domain/javascriptSemanticProjection.js +144 -38
  233. package/dist/domain/javascriptSemanticPromises.js +14 -27
  234. package/dist/domain/javascriptSemanticQuerySchemas.js +6 -9
  235. package/dist/domain/javascriptSemanticResources.js +2 -5
  236. package/dist/domain/javascriptSemanticState.js +4 -0
  237. package/dist/domain/javascriptSemanticTraceSchemas.js +2 -1
  238. package/dist/domain/javascriptSemanticTraversal.js +13 -5
  239. package/dist/domain/javascriptSemanticValues.js +10 -9
  240. package/dist/domain/javascriptSourceParser.js +5 -1
  241. package/dist/domain/javascriptStaticAnalysisCalls.js +8 -5
  242. package/dist/domain/javascriptStaticAnalysisHelpers.js +16 -7
  243. package/dist/domain/keyedArchive.js +181 -0
  244. package/dist/domain/managedApplicationGraph.js +4 -3
  245. package/dist/domain/managedArtifact.js +2 -1
  246. package/dist/domain/managedMemberComparison.js +18 -13
  247. package/dist/domain/managedMemberComparisonCoverage.js +2 -1
  248. package/dist/domain/managedMemberComparisonItems.js +27 -7
  249. package/dist/domain/managedMemberComparisonMatch.js +22 -6
  250. package/dist/domain/managedNativeVerificationMatch.js +2 -2
  251. package/dist/domain/managedNativeVerificationSchemas.js +7 -5
  252. package/dist/domain/managedReconstruction.js +6 -5
  253. package/dist/domain/nativeApiBoundary.js +7 -0
  254. package/dist/domain/nativeDataType.js +51 -0
  255. package/dist/domain/nativeInspection.js +0 -1
  256. package/dist/domain/nativeInstruction.js +82 -0
  257. package/dist/domain/nativeInvestigationGraph.js +9 -5
  258. package/dist/domain/nativeUiObservation.js +123 -0
  259. package/dist/domain/nativeValueFlow.js +17 -0
  260. package/dist/domain/nativeValueTrace.js +64 -0
  261. package/dist/domain/objcSwiftMetadata.js +39 -0
  262. package/dist/domain/peInspection.js +1 -0
  263. package/dist/domain/processCapture.js +5 -55
  264. package/dist/domain/processCaptureExample.js +0 -9
  265. package/dist/domain/processCaptureValidation.js +13 -144
  266. package/dist/domain/processComparison.js +3 -25
  267. package/dist/domain/processObservation.js +0 -29
  268. package/dist/domain/processScenario.js +28 -228
  269. package/dist/domain/processTraceDimensionProjection.js +0 -15
  270. package/dist/domain/processTraceEvaluation.js +0 -6
  271. package/dist/domain/protocolCapture.js +8 -36
  272. package/dist/domain/reconstructionCoverage.js +3 -2
  273. package/dist/domain/reconstructionObligationLedgerSchemas.js +4 -12
  274. package/dist/domain/reconstructionReadinessSchemas.js +4 -3
  275. package/dist/domain/reconstructionVerification.js +2 -1
  276. package/dist/domain/reconstructionVerificationSchemas.js +6 -13
  277. package/dist/domain/referenceSourceClassification.js +0 -110
  278. package/dist/domain/referenceSourceGraph.js +15 -5
  279. package/dist/domain/residualUnknown.js +3 -2
  280. package/dist/domain/runtimeIdentification.js +6 -5
  281. package/dist/domain/sourceMapContents.js +5 -0
  282. package/dist/domain/sourceToBundleComparison.js +3 -10
  283. package/dist/domain/sourceToBundleComparisonSchemas.js +7 -6
  284. package/dist/domain/sourceToBundleSignals.js +9 -3
  285. package/dist/domain/staticRuntimeCorrelation.js +5 -11
  286. package/dist/domain/webBundleAnalysis.js +17 -9
  287. package/dist/domain/webBundleAnalyzer.js +1 -1
  288. package/dist/domain/webCaptureDiff.js +5 -11
  289. package/dist/domain/webCaptureDiffSchemas.js +2 -1
  290. package/dist/domain/webMcpDiscovery.js +2 -1
  291. package/dist/dotnet/ManagedMemberInspectorCore.js +15 -7
  292. package/dist/dotnet/ManagedMemberInstructionDecoder.js +57 -40
  293. package/dist/dotnet/ManagedMemberRows.js +2 -0
  294. package/dist/dotnet/ManagedMethodBodyReader.js +15 -8
  295. package/dist/dotnet/ManagedPeReader.js +2 -0
  296. package/dist/generatedMcpToolCatalog.js +1 -1
  297. package/dist/generatedPackageMetadata.js +2 -2
  298. package/dist/ghidra/GhidraAnalysisProfile.js +15 -5
  299. package/dist/ghidra/GhidraClient.js +38 -8
  300. package/dist/ghidra/GhidraFunctionValues.js +56 -20
  301. package/dist/ghidra/GhidraInstallation.js +7 -4
  302. package/dist/ghidra/GhidraInventoryValues.js +44 -9
  303. package/dist/ghidra/GhidraLauncher.js +18 -3
  304. package/dist/ghidra/GhidraProvider.js +23 -2
  305. package/dist/ghidra/GhidraRequestQueue.js +45 -4
  306. package/dist/ghidra/GhidraSessionValues.js +5 -0
  307. package/dist/hopper/HopperAnalysisProfile.js +2 -0
  308. package/dist/hopper/HopperProvider.js +29 -6
  309. package/dist/hopper/HopperTargetLease.js +18 -4
  310. package/dist/logger.js +0 -13
  311. package/dist/main/messages.js +0 -1
  312. package/dist/main/reload.js +3 -32
  313. package/dist/main/shutdown.js +1 -2
  314. package/dist/main/transport.js +0 -17
  315. package/dist/main.js +0 -10
  316. package/dist/native/AppleDispatchMetadata.js +582 -0
  317. package/dist/native/AppleObjcProtocols.js +88 -0
  318. package/dist/native/AppleSwiftVtables.js +86 -0
  319. package/dist/native/CommandRunner.js +1 -1
  320. package/dist/native/NativeHostCapabilities.js +23 -0
  321. package/dist/native/NativeMacOSProvider.js +61 -9
  322. package/dist/native/NativeMachoInspection.js +39 -6
  323. package/dist/native/NativeUiHelperRuntime.js +42 -0
  324. package/dist/native/NativeUiObservation.js +174 -0
  325. package/dist/native/parsers/codesign.js +4 -1
  326. package/dist/native/parsers/dyldInfo.js +51 -25
  327. package/dist/native/parsers/lipo.js +13 -4
  328. package/dist/native/parsers/otool.js +84 -39
  329. package/dist/native/parsers/plist.js +2 -1
  330. package/dist/process/ExecFileOutput.js +5 -1
  331. package/dist/process/ProcessOwnership.js +69 -33
  332. package/dist/process/ProcessOwnershipObservation.js +31 -12
  333. package/dist/process/ProviderProcess.js +4 -2
  334. package/dist/reference/ReferenceSourceReaderEntries.js +48 -31
  335. package/dist/reference/ReferenceSourceReaderErrors.js +24 -0
  336. package/dist/reference/ReferenceSourceReaderFile.js +11 -5
  337. package/dist/reference/ReferenceSourceReaderValidate.js +22 -8
  338. package/dist/server/createServer.js +7 -62
  339. package/dist/server/registerApplicationTools/helpers.js +2 -9
  340. package/dist/server/registerApplicationTools.js +0 -4
  341. package/dist/server/registerArtifactComparisonTool.js +1 -1
  342. package/dist/server/registerBrowserScenarioTool.js +4 -2
  343. package/dist/server/registerBrowserTools.js +7 -7
  344. package/dist/server/registerBundleComparisonTool.js +1 -1
  345. package/dist/server/registerCloseLifecycleTool.js +1 -1
  346. package/dist/server/registerElectronTools.js +10 -4
  347. package/dist/server/registerEnhancedTools.js +20 -12
  348. package/dist/server/registerEvidenceTools.js +4 -28
  349. package/dist/server/registerFunctionComparisonTool.js +1 -1
  350. package/dist/server/registerInvestigationTools.js +6 -6
  351. package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -2
  352. package/dist/server/registerManagedTools.js +28 -14
  353. package/dist/server/registerManagedWorkflowTools.js +0 -2
  354. package/dist/server/registerProcessComparisonTool.js +1 -3
  355. package/dist/server/registerSessionRecordTools.js +9 -9
  356. package/dist/server/registerSessionStatusTool.js +1 -1
  357. package/dist/server/registerSessionTools.js +28 -57
  358. package/dist/server/sessionAvailabilityPolicy.js +2 -3
  359. package/dist/server/sessionToolPolicies.js +0 -4
  360. package/dist/server/toolResult.js +8 -10
  361. package/package.json +32 -22
  362. package/skills/reverse-engineer-anything/SKILL.md +15 -11
  363. package/skills/reverse-engineer-anything/references/evidence-workflows.md +3 -2
  364. package/skills/reverse-engineer-anything/references/javascript-applications.md +3 -2
  365. package/skills/reverse-engineer-anything/references/native-and-artifacts.md +8 -6
  366. package/skills/reverse-engineer-anything/references/runtime-observation.md +15 -11
  367. package/dist/application/CommandShimReplay.js +0 -152
  368. package/dist/application/ConfiguredRoots.js +0 -19
  369. package/dist/application/InstrumentedJavaScriptReplayHost.js +0 -36
  370. package/dist/application/JavaScriptReplayPermission.js +0 -16
  371. package/dist/application/JavaScriptReplayPlanning.js +0 -207
  372. package/dist/application/JavaScriptReplayService.js +0 -274
  373. package/dist/application/LoopbackReplay.js +0 -389
  374. package/dist/application/LoopbackReplayRecorder.js +0 -129
  375. package/dist/application/ManagedRuntimeCorrelationService.js +0 -104
  376. package/dist/application/NodeRuntimeCharacterizationService.js +0 -191
  377. package/dist/application/PermissionAuthority.js +0 -268
  378. package/dist/application/PermissionConfiguration.js +0 -26
  379. package/dist/application/PermissionFailure.js +0 -5
  380. package/dist/application/ProcessCaptureAuthority.js +0 -24
  381. package/dist/application/ProcessCapturePermission.js +0 -13
  382. package/dist/application/ProcessCheckpoints.js +0 -178
  383. package/dist/application/ProcessReactiveCoordinator.js +0 -223
  384. package/dist/application/ProcessReactiveEffects.js +0 -153
  385. package/dist/application/ProcessReactiveHarness.js +0 -106
  386. package/dist/application/ProcessReactiveObservations.js +0 -105
  387. package/dist/application/ProjectPermissionStore.js +0 -199
  388. package/dist/application/RuntimeExecutableDiagnostics.js +0 -198
  389. package/dist/application/Upgrade.js +0 -134
  390. package/dist/browser/SensitiveTextCapture.js +0 -8
  391. package/dist/cliPolicyCommands.js +0 -185
  392. package/dist/config/browserScenario.js +0 -77
  393. package/dist/config/electronAutomation.js +0 -35
  394. package/dist/config/javascriptReplay.js +0 -41
  395. package/dist/config/managedRuntime.js +0 -25
  396. package/dist/config/passiveObservation.js +0 -87
  397. package/dist/config/permissions.js +0 -23
  398. package/dist/config/processCapture.js +0 -47
  399. package/dist/contracts/replayMachineExample.js +0 -37
  400. package/dist/domain/javascriptExportInstrumentation.js +0 -95
  401. package/dist/domain/javascriptReplay.js +0 -360
  402. package/dist/domain/managedRuntimeCorrelation.js +0 -181
  403. package/dist/domain/nodeRuntimeCharacterization.js +0 -63
  404. package/dist/domain/permissionPolicy.js +0 -176
  405. package/dist/domain/processCaptureReactiveSchema.js +0 -68
  406. package/dist/domain/processCaptureReactiveValidation.js +0 -180
  407. package/dist/domain/processReactiveCheckpointDataflow.js +0 -32
  408. package/dist/domain/processReactiveMatching.js +0 -196
  409. package/dist/domain/processReactiveRuntime.js +0 -116
  410. package/dist/domain/processReactiveScenario.js +0 -296
  411. package/dist/domain/processReactiveScenarioPreflight.js +0 -95
  412. package/dist/domain/processReactiveTransition.js +0 -187
  413. package/dist/domain/replayMachine.js +0 -320
  414. package/dist/domain/replayMachineRun.js +0 -168
  415. package/dist/domain/replayMachineRuntime.js +0 -296
  416. package/dist/domain/replayMachineValues.js +0 -84
  417. package/dist/domain/runtimeCharacterization.js +0 -84
  418. package/dist/replay/JavaScriptReplayWorker.js +0 -382
  419. package/dist/replay/JavaScriptReplayWorkerTypes.js +0 -1
  420. package/dist/replay/LinuxJavaScriptReplayRunner.js +0 -216
  421. package/dist/replay/LinuxJavaScriptReplaySandbox.js +0 -121
  422. package/dist/replay/LinuxRuntimeClosure.js +0 -44
  423. package/dist/replay/LinuxSeccompPolicy.js +0 -40
  424. package/dist/replay/ReplayOutcome.js +0 -104
  425. package/dist/replay/ReplayProcessLifecycle.js +0 -96
  426. package/dist/replay/ReplaySeccompFile.js +0 -29
  427. package/dist/replay/ReplayWorkerProtocol.js +0 -58
  428. package/dist/replay/SystemJavaScriptReplayHost.js +0 -153
  429. package/dist/server/ProcessCaptureElicitation.js +0 -153
  430. package/dist/server/registerApplicationTools/characterization.js +0 -46
  431. package/dist/server/registerApplicationTools/controlledReplay.js +0 -31
  432. package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +0 -29
  433. package/dist/server/registerReplayMachineTool.js +0 -14
  434. package/skills/reverse-engineer-anything/references/controlled-replay.md +0 -12
@@ -4,19 +4,34 @@ import { resolve } from "node:path";
4
4
  import { z } from "zod";
5
5
  import { PRODUCT_IDENTITY } from "../identity.js";
6
6
  import { MCP_STARTUP_POLICY } from "../mcpStartupPolicy.js";
7
+ import { isOwnedClientRegistrationCommand } from "./ClientRegistrationIdentity.js";
7
8
  import { supportedClients } from "./SupportedClients.js";
8
9
  const registrationSchema = z
9
10
  .object({
10
11
  command: z.string().min(1),
11
12
  args: z.array(z.string()).default([]),
12
13
  startup_timeout_sec: z.number().positive().optional(),
14
+ type: z.string().optional(),
15
+ tools: z.array(z.string()).optional(),
16
+ disabled: z.boolean().optional(),
17
+ enabled: z.boolean().optional(),
13
18
  })
14
19
  .passthrough();
15
20
  /** Inspect supported client registrations without reading their environment. */
16
- export const readClientRegistrationStatuses = async (home, currentCommandPath = resolve(process.argv[1] ?? "unknown")) => {
21
+ export const readClientRegistrationStatuses = async (home, currentCommandPath = resolve(process.argv[1] ?? "unknown"), options = {}) => {
17
22
  const statuses = [];
18
- for (const client of supportedClients(home)) {
19
- if (client.format === "unsupported" || !(await exists(client.markerPath)))
23
+ for (const client of supportedClients(home, options.platform, options.environment === undefined
24
+ ? undefined
25
+ : {
26
+ APPDATA: options.environment.APPDATA,
27
+ CLAUDE_CONFIG_DIR: options.environment.CLAUDE_CONFIG_DIR,
28
+ CODEX_HOME: options.environment.CODEX_HOME,
29
+ COPILOT_HOME: options.environment.COPILOT_HOME,
30
+ OPENCODE_CONFIG: options.environment.OPENCODE_CONFIG,
31
+ XDG_CONFIG_HOME: options.environment.XDG_CONFIG_HOME,
32
+ })) {
33
+ if (client.format === "unsupported" ||
34
+ (!(await exists(client.markerPath)) && !(await exists(client.configPath))))
20
35
  continue;
21
36
  try {
22
37
  const content = await readFile(client.configPath, "utf8");
@@ -26,12 +41,12 @@ export const readClientRegistrationStatuses = async (home, currentCommandPath =
26
41
  statuses.push(unavailableStatus(client.name, client.configPath, "missing"));
27
42
  continue;
28
43
  }
29
- const registration = registrationSchema.parse(raw);
44
+ const registration = parseRegistration(raw, client);
30
45
  const command = [
31
46
  registration.command,
32
47
  ...registration.args,
33
48
  ];
34
- statuses.push(configuredStatus(client.name, client.configPath, command, registrationAligned(registration, client.name, currentCommandPath)
49
+ statuses.push(configuredStatus(client.name, client.configPath, command, registrationAligned(registration, client, currentCommandPath)
35
50
  ? "aligned"
36
51
  : "stale"));
37
52
  }
@@ -43,10 +58,25 @@ export const readClientRegistrationStatuses = async (home, currentCommandPath =
43
58
  };
44
59
  const registrationAligned = (registration, client, currentCommandPath) => {
45
60
  const command = [registration.command, ...registration.args];
46
- if (client === "codex" &&
61
+ if (registration.disabled === true || registration.enabled === false)
62
+ return false;
63
+ if (!isOwnedClientRegistrationCommand(command, currentCommandPath))
64
+ return false;
65
+ if (command.length === 3 &&
66
+ command[2] === "mcp" &&
67
+ resolve(command[0] ?? "") === resolve(process.execPath) &&
68
+ resolve(command[1] ?? "") === currentCommandPath)
69
+ return true;
70
+ if (client.name === "codex" &&
47
71
  registration.startup_timeout_sec !==
48
72
  MCP_STARTUP_POLICY.codexStartupTimeoutSeconds)
49
73
  return false;
74
+ if (client.format === "vscode" && registration.type !== "stdio")
75
+ return false;
76
+ if (client.format === "copilot_cli" &&
77
+ (registration.type !== "stdio" ||
78
+ JSON.stringify(registration.tools) !== JSON.stringify(["*"])))
79
+ return false;
50
80
  if (command.length === 4 &&
51
81
  command[0] === "npx" &&
52
82
  command[1] === "-y" &&
@@ -57,6 +87,29 @@ const registrationAligned = (registration, client, currentCommandPath) => {
57
87
  command[1] === "mcp" &&
58
88
  resolve(command[0] ?? "") === currentCommandPath);
59
89
  };
90
+ const parseRegistration = (value, client) => {
91
+ if (client.format === "opencode") {
92
+ const entry = z
93
+ .object({
94
+ type: z.literal("local"),
95
+ command: z.array(z.string()).min(1),
96
+ environment: z.record(z.string(), z.string()).optional(),
97
+ })
98
+ .passthrough()
99
+ .parse(value);
100
+ const [command = "", ...args] = entry.command;
101
+ return registrationSchema.parse({
102
+ ...entry,
103
+ command,
104
+ args,
105
+ });
106
+ }
107
+ const registration = registrationSchema.parse(value);
108
+ if ((client.format === "vscode" || client.format === "copilot_cli") &&
109
+ registration.type !== "stdio")
110
+ throw new TypeError("Expected an stdio registration");
111
+ return registration;
112
+ };
60
113
  const remediation = "Run rea setup to refresh this registration, then restart the client.";
61
114
  const configuredStatus = (client, configPath, command, state) => state === "aligned"
62
115
  ? { client, config_path: configPath, command, state, remediation: null }
@@ -1,17 +1,15 @@
1
- import { projectPermissionFailure } from "./PermissionFailure.js";
2
- import { artifactExtractionPermissionRequest } from "./ArtifactExtractionDestination.js";
3
1
  import { parseConfig } from "../config.js";
4
2
  import { EnhancedTools } from "./EnhancedTools.js";
5
- import { createBinarySession } from "./runtime.js";
3
+ import { createBinarySession, createManagedBinarySession } from "./runtime.js";
6
4
  import { silentLogger } from "../logger.js";
7
5
  import { createEvidence } from "../domain/evidence.js";
6
+ import { isManagedToolName, } from "../contracts/managedToolContracts.js";
8
7
  import { EvidenceIntegrityError, projectAnalysisError, } from "../domain/errors.js";
9
8
  import { access } from "node:fs/promises";
10
9
  import { readAnalysisSnapshot, writeAnalysisSnapshot, } from "./AnalysisSnapshotFiles.js";
11
10
  import { parseBinaryTarget } from "./BinaryTargetResolver.js";
12
11
  import { snapshotEvidenceForQuery, snapshotMatchesTarget, } from "../domain/analysisSnapshot.js";
13
12
  import { err, ok } from "../domain/result.js";
14
- import { loadConfiguredPermissionAuthority } from "./PermissionConfiguration.js";
15
13
  import { REA_WORKFLOW_PROVIDER, workflowAnalysisProfile, } from "./InvestigationProviders.js";
16
14
  import { artifactInspectionResultSchema } from "../domain/artifactInspection.js";
17
15
  export { runCapabilityStatus, runProviderStatus, } from "./DirectAnalysisStatus.js";
@@ -27,69 +25,47 @@ export const runDirectAnalysis = async (path, tool, arguments_, options = {}) =>
27
25
  ...(options.providerId === undefined
28
26
  ? {}
29
27
  : { providerId: options.providerId }),
30
- ...(options.permissionAuthority === undefined
31
- ? {}
32
- : { permissionAuthority: options.permissionAuthority }),
33
28
  }));
34
29
  /** Execute one provider-native semantic operation with atomic provenance. */
35
- export const runProviderAnalysis = async (...[path, tool, arguments_, logger = silentLogger, signal]) => withProcessCancellation(signal, (operationSignal) => runAnalysis(path, tool, arguments_, {
36
- logger,
37
- snapshotPath: undefined,
38
- signal: operationSignal,
39
- }));
40
- const authorizeAnalysis = async (authority, tool, arguments_) => {
41
- const requests = [];
42
- if (tool === "extract_artifact" && typeof arguments_.output_root === "string")
43
- requests.push({
44
- request: artifactExtractionPermissionRequest(),
45
- access: "write",
46
- });
47
- for (const request of requests) {
48
- const result = await authority.authorize(request.request, request.access);
49
- if (!result.ok)
50
- return err(projectPermissionFailure(result.error));
30
+ export const runProviderAnalysis = async (...[path, tool, arguments_, logger = silentLogger, signal]) => isManagedToolName(tool)
31
+ ? runManagedProviderAnalysis(path, tool, signal)
32
+ : withProcessCancellation(signal, (operationSignal) => runAnalysis(path, tool, arguments_, {
33
+ logger,
34
+ snapshotPath: undefined,
35
+ signal: operationSignal,
36
+ }));
37
+ /** Execute managed metadata inspection in an isolated managed-only session. */
38
+ export const runManagedProviderExecution = async (path, tool, signal) => withProcessCancellation(signal, async (operationSignal) => {
39
+ const session = createManagedBinarySession();
40
+ try {
41
+ const opened = await session.open(path, { signal: operationSignal });
42
+ if (!opened.ok)
43
+ return opened;
44
+ return await session.execute(tool, {}, { signal: operationSignal });
51
45
  }
52
- if (["inventory_artifact", "inspect_artifact"].includes(tool) &&
53
- arguments_.native_mount_approved === true) {
54
- const result = await authority.authorize({
55
- capability: "native_mount",
56
- roots: [],
57
- executables: [],
58
- environment_names: [],
59
- network: "none",
60
- mount: true,
61
- operation_identity: `${tool}:native_mount`,
62
- }, "read");
63
- if (!result.ok)
64
- return err(projectPermissionFailure(result.error));
46
+ finally {
47
+ await session.close();
65
48
  }
66
- return ok(null);
67
- };
68
- const permissionAuthorityFor = (config, supplied) => supplied === undefined
69
- ? loadConfiguredPermissionAuthority(config)
70
- : Promise.resolve(ok(supplied));
71
- const authorizeAnalysisRun = async (input) => {
72
- const authority = await permissionAuthorityFor(input.config, input.suppliedAuthority);
73
- if (!authority.ok)
74
- return authority;
75
- const operation = await authorizeAnalysis(authority.value, input.tool, input.arguments);
76
- if (!operation.ok)
77
- return operation;
78
- return ok(null);
49
+ });
50
+ const runManagedProviderAnalysis = async (path, tool, signal) => {
51
+ const execution = await runManagedProviderExecution(path, tool, signal);
52
+ if (!execution.ok)
53
+ return cliError(execution.error);
54
+ const value = execution.value;
55
+ return createEvidence(value.subject ?? undefined, value.provider, {
56
+ operation: tool,
57
+ parameters: {},
58
+ result: value.result,
59
+ rawResult: value.rawResult,
60
+ limitations: value.limitations,
61
+ locations: value.locations,
62
+ });
79
63
  };
80
64
  const runAnalysis = async (path, tool, arguments_, options) => {
81
65
  const { logger, signal, snapshotPath } = options;
82
- const config = parseConfig(process.env);
66
+ const config = parseConfig(options.environment ?? process.env);
83
67
  if (!config.ok)
84
68
  return cliError(config.error);
85
- const authorization = await authorizeAnalysisRun({
86
- config: config.value,
87
- suppliedAuthority: options.permissionAuthority,
88
- tool,
89
- arguments: arguments_,
90
- });
91
- if (!authorization.ok)
92
- return cliError(authorization.error);
93
69
  const session = createBinarySession(config.value, logger);
94
70
  try {
95
71
  const prepared = await prepareSnapshot({
@@ -158,6 +134,7 @@ const executeAnalysisTool = async (input) => {
158
134
  tool === "inspect_native_api" ||
159
135
  tool === "inspect_native_dispatch_metadata" ||
160
136
  tool === "trace_feature" ||
137
+ tool === "trace_native_values" ||
161
138
  tool === "trace_native_ui_action") {
162
139
  const result = await new EnhancedTools(session).execute(tool, input.arguments, signal);
163
140
  if (!result.ok)
@@ -234,7 +211,9 @@ const analysisProfileForEvidence = (session, tool) => {
234
211
  };
235
212
  const isWorkflowEvidenceTool = (tool) => tool === "binary_overview" ||
236
213
  tool === "inspect_native_api" ||
214
+ tool === "inspect_native_dispatch_metadata" ||
237
215
  tool === "trace_feature" ||
216
+ tool === "trace_native_values" ||
238
217
  tool === "trace_native_ui_action";
239
218
  const fileExists = async (path) => {
240
219
  try {
@@ -4,8 +4,8 @@ import { jsonObjectSchema } from "../domain/jsonValue.js";
4
4
  import { createServerIdentity } from "../serverIdentity.js";
5
5
  import { silentLogger } from "../logger.js";
6
6
  import { createBinarySession } from "./runtime.js";
7
- const runSessionStatus = async (logger = silentLogger) => {
8
- const config = parseConfig(process.env);
7
+ const runSessionStatus = async (logger = silentLogger, environment = process.env) => {
8
+ const config = parseConfig(environment);
9
9
  if (!config.ok)
10
10
  return { error: projectAnalysisError(config.error) };
11
11
  const session = createBinarySession(config.value, logger);
@@ -22,6 +22,6 @@ const runSessionStatus = async (logger = silentLogger) => {
22
22
  }
23
23
  };
24
24
  /** List complete provider identities, capabilities, and availability. */
25
- export const runProviderStatus = (logger = silentLogger) => runSessionStatus(logger);
25
+ export const runProviderStatus = (logger = silentLogger, environment = process.env) => runSessionStatus(logger, environment);
26
26
  /** List complete operation descriptors and availability. */
27
- export const runCapabilityStatus = (logger = silentLogger) => runSessionStatus(logger);
27
+ export const runCapabilityStatus = (logger = silentLogger, environment = process.env) => runSessionStatus(logger, environment);
@@ -9,7 +9,6 @@ import { linuxHopperBinarySupported, linuxSharedLibrariesAvailable, readLinuxDis
9
9
  import { CATALOG_IDENTITY } from "../catalogIdentity.js";
10
10
  import { PRODUCT_IDENTITY, SDK_IDENTITY } from "../identity.js";
11
11
  import { readClientRegistrationStatuses, } from "./ClientRegistrationStatus.js";
12
- import { inspectRuntimeExecutables, } from "./RuntimeExecutableDiagnostics.js";
13
12
  import { collectDoctorDiagnostics, doctorHealthy, } from "./DoctorDiagnostics.js";
14
13
  import { normalizeDoctorScope, scopeDoctorChecks, } from "./DoctorScope.js";
15
14
  /** Deep provider IDs whose readiness can be selected explicitly by doctor. */
@@ -20,8 +19,8 @@ export const DOCTOR_PROVIDER_IDS = ["hopper", "ghidra"];
20
19
  * or an agent consuming the structured result.
21
20
  */
22
21
  export const runDoctor = async (target, host = systemDoctorHost(), requestedScope) => {
23
- const { checks: diagnosticChecks, hopperPath, providerInspections, runtimeExecutables, } = await collectDoctorDiagnostics(target, host);
24
- const identity = await collectDoctorIdentity(host, runtimeExecutables);
22
+ const { checks: diagnosticChecks, hopperPath, providerInspections, } = await collectDoctorDiagnostics(target, host);
23
+ const identity = await collectDoctorIdentity(host);
25
24
  const checks = [...diagnosticChecks, ...identity.checks];
26
25
  const providers = {
27
26
  hopperAvailable: hopperPath !== undefined &&
@@ -52,7 +51,7 @@ export const runDoctor = async (target, host = systemDoctorHost(), requestedScop
52
51
  identity: identity.value,
53
52
  };
54
53
  };
55
- const collectDoctorIdentity = async (host, runtimeExecutables) => {
54
+ const collectDoctorIdentity = async (host) => {
56
55
  const installationPaths = (await host.installationPaths?.()) ?? [];
57
56
  const installedSkillIdentity = await host.installedSkillIdentity?.();
58
57
  const skillAligned = skillIdentityAligned(installedSkillIdentity);
@@ -91,7 +90,6 @@ const collectDoctorIdentity = async (host, runtimeExecutables) => {
91
90
  : "Run rea setup to update the installed REA skill.",
92
91
  },
93
92
  registrations,
94
- runtime_executables: runtimeExecutables ?? null,
95
93
  },
96
94
  };
97
95
  };
@@ -115,91 +113,102 @@ const registrationCheck = (registration) => ({
115
113
  remediation: registration.remediation,
116
114
  });
117
115
  const installationState = (paths) => paths.length === 0 ? "unknown" : paths.length === 1 ? "single" : "multiple";
116
+ const homeFromEnvironment = (environment, platform) => {
117
+ const selected = platform === "win32"
118
+ ? (environment.USERPROFILE ??
119
+ (environment.HOMEDRIVE !== undefined &&
120
+ environment.HOMEPATH !== undefined
121
+ ? `${environment.HOMEDRIVE}${environment.HOMEPATH}`
122
+ : environment.HOME))
123
+ : (environment.HOME ?? environment.USERPROFILE);
124
+ return selected ?? homedir();
125
+ };
118
126
  /** Create diagnostics backed by the current process and host commands. */
119
- export const systemDoctorHost = (options = {}) => ({
120
- platform: process.platform,
121
- architecture: process.arch,
122
- nodeVersion: process.versions.node,
123
- ...(process.env.HOPPER_LAUNCHER_PATH === undefined
124
- ? {}
125
- : { configuredHopperPath: process.env.HOPPER_LAUNCHER_PATH }),
126
- ...(process.env.REA_ILSPY_CMD_PATH === undefined
127
- ? {}
128
- : { configuredIlspyCmdPath: process.env.REA_ILSPY_CMD_PATH }),
129
- macosVersion: readMacosVersion,
130
- linuxDistribution: readLinuxDistribution,
131
- async validTarget(path) {
132
- return (await parseBinaryTarget(path)).ok;
133
- },
134
- executable: executableAvailable,
135
- linuxDemoRuntimeCheck: options.linuxDemoRuntimeCheck ?? uncomposedLinuxDemoRuntimeCheck,
136
- supportedLinuxHopper: linuxHopperBinarySupported,
137
- async brewHopperPath() {
138
- return probeHomebrew(async (command) => {
127
+ export const systemDoctorHost = (options = {}) => {
128
+ const platform = options.platform ?? process.platform;
129
+ const architecture = options.architecture ?? process.arch;
130
+ const environment = options.environment ?? process.env;
131
+ const hostExecFileOutput = options.execFileOutput ?? execFileOutput;
132
+ const homeDirectory = homeFromEnvironment(environment, platform);
133
+ const commandEnvironment = { env: environment };
134
+ return {
135
+ platform,
136
+ architecture,
137
+ nodeVersion: process.versions.node,
138
+ homeDirectory,
139
+ ...(environment.HOPPER_LAUNCHER_PATH === undefined
140
+ ? {}
141
+ : { configuredHopperPath: environment.HOPPER_LAUNCHER_PATH }),
142
+ ...(environment.REA_ILSPY_CMD_PATH === undefined
143
+ ? {}
144
+ : { configuredIlspyCmdPath: environment.REA_ILSPY_CMD_PATH }),
145
+ macosVersion: () => readMacosVersion(hostExecFileOutput, commandEnvironment),
146
+ linuxDistribution: readLinuxDistribution,
147
+ async validTarget(path) {
148
+ return (await parseBinaryTarget(path, process.cwd(), architecture)).ok;
149
+ },
150
+ executable: (path) => executableAvailable(path, platform, hostExecFileOutput, commandEnvironment),
151
+ linuxDemoRuntimeCheck: options.linuxDemoRuntimeCheck ?? uncomposedLinuxDemoRuntimeCheck,
152
+ supportedLinuxHopper: linuxHopperBinarySupported,
153
+ async brewHopperPath() {
154
+ return probeHomebrew(async (command) => {
155
+ try {
156
+ const prefix = (await hostExecFileOutput(command, ["--prefix", "--cask", "hopper-disassembler"], commandEnvironment)).stdout.trim();
157
+ return `${prefix}/Hopper Disassembler.app/Contents/MacOS/hopper`;
158
+ }
159
+ catch {
160
+ return undefined;
161
+ }
162
+ });
163
+ },
164
+ manualHopperPaths: () => manualHopperPaths(homeDirectory),
165
+ ...(options.providerInspections === undefined
166
+ ? {}
167
+ : { providerInspections: options.providerInspections }),
168
+ async ilspyCmdVersion(path) {
139
169
  try {
140
- const prefix = (await execFileOutput(command, [
141
- "--prefix",
142
- "--cask",
143
- "hopper-disassembler",
144
- ])).stdout.trim();
145
- return `${prefix}/Hopper Disassembler.app/Contents/MacOS/hopper`;
170
+ await access(path, constants.X_OK);
171
+ return firstIlspyVersionLine((await hostExecFileOutput(path, ["--version"], {
172
+ timeout: 10_000,
173
+ ...commandEnvironment,
174
+ })).stdout);
146
175
  }
147
176
  catch {
148
177
  return undefined;
149
178
  }
150
- });
151
- },
152
- manualHopperPaths,
153
- ...(options.providerInspections === undefined
154
- ? {}
155
- : { providerInspections: options.providerInspections }),
156
- ...(options.javascriptReplayCheck === undefined
157
- ? {}
158
- : { javascriptReplayCheck: options.javascriptReplayCheck }),
159
- async ilspyCmdVersion(path) {
160
- try {
161
- await access(path, constants.X_OK);
162
- return firstIlspyVersionLine((await execFileOutput(path, ["--version"], { timeout: 10_000 })).stdout);
163
- }
164
- catch {
165
- return undefined;
166
- }
167
- },
168
- runtimeExecutables: () => inspectRuntimeExecutables({
169
- platform: process.platform,
170
- path: process.env.PATH ?? "",
171
- launcherNode: process.execPath,
172
- ...(process.env.PATHEXT === undefined
173
- ? {}
174
- : { pathExtensions: process.env.PATHEXT.split(delimiter) }),
175
- }),
176
- async installationPaths() {
177
- try {
178
- const command = process.platform === "win32" ? "where" : "which";
179
- const arguments_ = process.platform === "win32" ? ["rea"] : ["-a", "rea"];
180
- return uniqueLines((await execFileOutput(command, arguments_)).stdout);
181
- }
182
- catch {
183
- return [];
184
- }
185
- },
186
- installedSkillIdentity,
187
- clientRegistrations: () => readClientRegistrationStatuses(homedir()),
188
- });
189
- const readMacosVersion = async () => {
179
+ },
180
+ async installationPaths() {
181
+ try {
182
+ const command = platform === "win32" ? "where" : "which";
183
+ const arguments_ = platform === "win32" ? ["rea"] : ["-a", "rea"];
184
+ return uniqueLines((await hostExecFileOutput(command, arguments_, commandEnvironment))
185
+ .stdout);
186
+ }
187
+ catch {
188
+ return [];
189
+ }
190
+ },
191
+ installedSkillIdentity: () => installedSkillIdentity(homeDirectory),
192
+ clientRegistrations: () => readClientRegistrationStatuses(homeDirectory, undefined, {
193
+ platform,
194
+ environment,
195
+ }),
196
+ };
197
+ };
198
+ const readMacosVersion = async (run = execFileOutput, options = { env: process.env }) => {
190
199
  try {
191
- return (await execFileOutput("sw_vers", ["-productVersion"])).stdout.trim();
200
+ return (await run("sw_vers", ["-productVersion"], options)).stdout.trim();
192
201
  }
193
202
  catch {
194
203
  return undefined;
195
204
  }
196
205
  };
197
- const executableAvailable = async (path) => {
206
+ const executableAvailable = async (path, platform = process.platform, run = execFileOutput, options = { env: process.env }) => {
198
207
  try {
199
208
  await access(path, constants.X_OK);
200
- if (process.platform !== "linux")
209
+ if (platform !== "linux")
201
210
  return true;
202
- const linked = await execFileOutput("ldd", [path]);
211
+ const linked = await run("ldd", [path], options);
203
212
  return linuxSharedLibrariesAvailable(`${linked.stdout}\n${linked.stderr}`);
204
213
  }
205
214
  catch {
@@ -213,9 +222,9 @@ const uncomposedLinuxDemoRuntimeCheck = () => Promise.resolve({
213
222
  detail: "Linux Hopper private-display diagnostics were not composed",
214
223
  remediation: "Run rea doctor through the production CLI adapter.",
215
224
  });
216
- const manualHopperPaths = async () => {
225
+ const manualHopperPaths = async (home = homedir()) => {
217
226
  const paths = [];
218
- for (const root of ["/Applications", join(homedir(), "Applications")]) {
227
+ for (const root of ["/Applications", join(home, "Applications")]) {
219
228
  try {
220
229
  for (const entry of await readdir(root, { withFileTypes: true })) {
221
230
  if (entry.isDirectory() && /^Hopper.*\.app$/i.test(entry.name))
@@ -228,10 +237,10 @@ const manualHopperPaths = async () => {
228
237
  }
229
238
  return paths;
230
239
  };
231
- const readInstalledSkill = () => readFile(join(homedir(), ".agents/skills", PRODUCT_IDENTITY.skillName, "SKILL.md"), "utf8");
232
- const installedSkillIdentity = async () => {
240
+ const readInstalledSkill = (home) => readFile(join(home, ".agents/skills", PRODUCT_IDENTITY.skillName, "SKILL.md"), "utf8");
241
+ const installedSkillIdentity = async (home) => {
233
242
  try {
234
- const content = await readInstalledSkill();
243
+ const content = await readInstalledSkill(home);
235
244
  const countText = /^\s{2}tool_count:\s*(\d+)\s*$/mu.exec(content)?.[1];
236
245
  return {
237
246
  version: /^\s{2}version:\s*"([^"]+)"\s*$/mu.exec(content)?.[1] ?? null,
@@ -5,11 +5,7 @@ const DEFAULT_HOPPER = "/Applications/Hopper Disassembler.app/Contents/MacOS/hop
5
5
  const SYSTEM_LINUX_HOPPER = "/opt/hopper/bin/Hopper";
6
6
  /** Collect host, provider, and optional-target diagnostics without mutation. */
7
7
  export const collectDoctorDiagnostics = async (target, host) => {
8
- const runtimeExecutables = await host.runtimeExecutables?.();
9
- const checks = [
10
- nodeCheck(host),
11
- ...runtimeChecks(runtimeExecutables),
12
- ];
8
+ const checks = [nodeCheck(host)];
13
9
  checks.push(await hostCheck(host));
14
10
  const hopperPath = await findHopper(host);
15
11
  checks.push(hopperCheck(host, hopperPath));
@@ -19,9 +15,6 @@ export const collectDoctorDiagnostics = async (target, host) => {
19
15
  const providerInspections = await host.providerInspections?.();
20
16
  if (providerInspections !== undefined)
21
17
  checks.push(...providerInspections.flatMap(providerDoctorChecks));
22
- const javascriptReplayCheck = await host.javascriptReplayCheck?.();
23
- if (javascriptReplayCheck !== undefined)
24
- checks.push(javascriptReplayCheck);
25
18
  const ilspyCheck = await optionalIlspyCheck(host);
26
19
  if (ilspyCheck !== undefined)
27
20
  checks.push(ilspyCheck);
@@ -35,7 +28,6 @@ export const collectDoctorDiagnostics = async (target, host) => {
35
28
  checks,
36
29
  ...(hopperPath === undefined ? {} : { hopperPath }),
37
30
  ...(providerInspections === undefined ? {} : { providerInspections }),
38
- ...(runtimeExecutables === undefined ? {} : { runtimeExecutables }),
39
31
  };
40
32
  };
41
33
  /** Evaluate core health while treating unconfigured providers as optional. */
@@ -63,22 +55,6 @@ const nodeCheck = (host) => check("node", supportsNodeVersion(host.nodeVersion),
63
55
  remediation: "Install Node.js 22.19+ or 24.11+.",
64
56
  classification: "missing_dependency",
65
57
  });
66
- const runtimeChecks = (inventory) => {
67
- if (inventory === undefined)
68
- return [];
69
- const broken = inventory.candidates.filter(({ healthy }) => !healthy);
70
- const detail = broken.length === 0
71
- ? `${String(inventory.candidates.length)} runtime executable candidates passed bounded version probes.`
72
- : `${String(broken.length)} of ${String(inventory.candidates.length)} runtime executable candidates failed bounded version probes: ${broken
73
- .map(({ lexical_path: path }) => path)
74
- .join(", ")}`;
75
- return [
76
- check("node-toolchains", broken.length === 0, detail, {
77
- remediation: "Select a verified healthy Node toolchain or repair the failing installation, then rerun rea doctor. Do not create compatibility-library symlinks.",
78
- classification: "missing_dependency",
79
- }),
80
- ];
81
- };
82
58
  const hostCheck = async (host) => {
83
59
  const macosVersion = host.platform === "darwin" ? await host.macosVersion() : undefined;
84
60
  const linuxDistribution = host.platform === "linux" ? await host.linuxDistribution() : undefined;
@@ -99,7 +75,7 @@ const findHopper = async (host) => {
99
75
  ? [
100
76
  DEFAULT_HOPPER,
101
77
  SYSTEM_LINUX_HOPPER,
102
- linuxHopperLauncherPath(homedir()),
78
+ linuxHopperLauncherPath(host.homeDirectory ?? homedir()),
103
79
  ...(await host.manualHopperPaths()),
104
80
  ]
105
81
  : [host.configuredHopperPath];
@@ -1,4 +1,3 @@
1
- import { doctorHealthy } from "./DoctorDiagnostics.js";
2
1
  /** Normalize a caller-selected doctor readiness boundary. */
3
2
  export const normalizeDoctorScope = (requested, target) => ({
4
3
  mode: requested === undefined ? "audit-wide" : "explicit",
@@ -10,40 +9,35 @@ export const normalizeDoctorScope = (requested, target) => ({
10
9
  /** Partition diagnostics into required and informational scope checks. */
11
10
  export const scopeDoctorChecks = (input) => {
12
11
  const providerChecks = input.checks.filter((candidate) => isProviderCheck(candidate.name, input.providers.providerInspections));
13
- const coreChecks = input.checks.filter(({ name }) => !isProviderCheck(name, input.providers.providerInspections) &&
14
- name !== "skill:identity" &&
15
- !name.startsWith("registration:"));
12
+ const coreChecks = input.checks.filter(({ name }) => name === "node" || (input.scope.target !== null && name === "target"));
16
13
  const clientChecks = input.scope.clients.map((client) => selectedRegistrationCheck(client, input.registrations.find((candidate) => candidate.client === client)));
17
14
  const skillChecks = input.scope.skill
18
15
  ? [selectedSkillCheck(input.skillState, input.checks)]
19
16
  : [];
20
- const selectedProviderChecks = input.scope.providers.length === 0
21
- ? configuredProviderChecks(providerChecks, input.providers)
22
- : input.scope.providers.flatMap((providerId) => selectedProviderChecksFor(providerId, providerChecks, input.providers));
17
+ const selectedProviderChecks = input.scope.providers.flatMap((providerId) => selectedProviderChecksFor(providerId, providerChecks, input.providers));
18
+ const hopperHostChecks = input.scope.providers.includes("hopper")
19
+ ? input.checks.filter(({ name }) => name === "host")
20
+ : [];
23
21
  const scopeChecks = [
24
22
  ...coreChecks,
23
+ ...hopperHostChecks,
25
24
  ...selectedProviderChecks,
26
25
  ...clientChecks,
27
26
  ...skillChecks,
28
27
  ];
29
- const providerHealthy = input.scope.providers.length === 0
30
- ? doctorHealthy([...coreChecks, ...providerChecks, ...clientChecks, ...skillChecks], input.providers)
31
- : selectedProviderChecks.every(({ ok }) => ok);
32
28
  const selectedNames = new Set(scopeChecks.map(({ name }) => name));
33
29
  return {
34
30
  healthy: coreChecks.every(({ ok }) => ok) &&
31
+ hopperHostChecks.every(({ ok }) => ok) &&
35
32
  clientChecks.every(({ ok }) => ok) &&
36
33
  skillChecks.every(({ ok }) => ok) &&
37
- providerHealthy,
34
+ selectedProviderChecks.every(({ ok }) => ok),
38
35
  scopeChecks,
39
36
  informationalChecks: input.checks.filter(({ name }) => !selectedNames.has(name)),
40
37
  };
41
38
  };
42
39
  const isProviderCheck = (name, inspections) => name.startsWith("hopper") ||
43
40
  inspections?.some(({ id }) => doctorProviderCheckName(id, name)) === true;
44
- const configuredProviderChecks = (checks, providers) => checks.filter(({ name }) => name.startsWith("hopper")
45
- ? providers.hopperConfigured
46
- : providers.providerInspections?.some(({ id, configured }) => configured && doctorProviderCheckName(id, name)) === true);
47
41
  const selectedProviderChecksFor = (providerId, checks, providers) => {
48
42
  const selected = checks.filter(({ name }) => providerId === "hopper"
49
43
  ? name.startsWith("hopper")