rea-agents 4.0.0 → 4.1.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 (416) hide show
  1. package/README.md +93 -30
  2. package/bridge/ghidra/ReaGhidraBridge.java +358 -15
  3. package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
  4. package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
  5. package/dist/android/AndroidTargetSnapshot.js +34 -0
  6. package/dist/android/JadxAnalysis.js +191 -0
  7. package/dist/android/JadxConfiguration.js +41 -0
  8. package/dist/android/JadxMcpTransport.js +145 -0
  9. package/dist/android/JadxProtocol.js +101 -0
  10. package/dist/android/JadxProvider.js +170 -0
  11. package/dist/android/JadxRelease.js +19 -0
  12. package/dist/android/JadxSession.js +97 -0
  13. package/dist/application/AnalysisContextQueries.js +2 -1
  14. package/dist/application/AnalysisProviderEvaluation.js +5 -3
  15. package/dist/application/AnalysisProviderRegistry.js +2 -1
  16. package/dist/application/AnalysisSnapshotCache.js +4 -1
  17. package/dist/application/AnalysisSnapshotFiles.js +1 -1
  18. package/dist/application/AndroidAnalysisPort.js +1 -0
  19. package/dist/application/AndroidAnalysisService.js +37 -0
  20. package/dist/application/ArtifactExtraction.js +7 -4
  21. package/dist/application/ArtifactGraphConstruction.js +10 -17
  22. package/dist/application/ArtifactInventory/scanCanonical.js +8 -7
  23. package/dist/application/BinarySession.js +16 -3
  24. package/dist/application/BinarySessionExecution.js +4 -1
  25. package/dist/application/BinarySessionOpen.js +3 -2
  26. package/dist/application/BinarySessionRecords.js +9 -3
  27. package/dist/application/BinaryTargetResolver.js +25 -6
  28. package/dist/application/BrowserObservationService.js +2 -1
  29. package/dist/application/BrowserScenarioCaptureService.js +2 -1
  30. package/dist/application/BrowserScenarioEvidence.js +2 -2
  31. package/dist/application/CallPathTracing.js +2 -1
  32. package/dist/application/CapabilityInventory.js +18 -0
  33. package/dist/application/ClientConfigPath.js +3 -1
  34. package/dist/application/ClientConfigurationDocument.js +11 -1
  35. package/dist/application/ClientRegistrationStatus.js +8 -1
  36. package/dist/application/CompositeProvider.js +1 -1
  37. package/dist/application/DirectAnalysis.js +23 -7
  38. package/dist/application/DirectAnalysisStatus.js +3 -3
  39. package/dist/application/Doctor.js +48 -8
  40. package/dist/application/DoctorDiagnostics.js +7 -5
  41. package/dist/application/DoctorScope.js +1 -1
  42. package/dist/application/ElectronActiveEvidence.js +2 -2
  43. package/dist/application/ElectronActiveObservationService.js +2 -1
  44. package/dist/application/ElectronBoundaryAnalysis.js +1 -1
  45. package/dist/application/ElectronObservationService.js +2 -1
  46. package/dist/application/EnhancedLiteralTracing.js +2 -1
  47. package/dist/application/EnhancedToolTypes.js +2 -1
  48. package/dist/application/EnhancedTools.js +3 -1
  49. package/dist/application/EvidenceBundleCommands.js +2 -1
  50. package/dist/application/EvidenceBundleFiles.js +1 -1
  51. package/dist/application/EvidenceInputResolver.js +30 -0
  52. package/dist/application/EvidenceLedger.js +2 -1
  53. package/dist/application/FirmwareAnalysisPort.js +1 -0
  54. package/dist/application/FirmwareAnalysisService.js +35 -0
  55. package/dist/application/FunctionAnalysisEvidence.js +32 -0
  56. package/dist/application/InventoryProjectionEvidence.js +2 -1
  57. package/dist/application/JavaScriptApplicationService.js +50 -3
  58. package/dist/application/JavaScriptApplicationWorkflowService.js +2 -1
  59. package/dist/application/JavaScriptArtifactAnalysis.js +4 -2
  60. package/dist/application/JavaScriptArtifactFiles.js +4 -2
  61. package/dist/application/JavaScriptArtifactPathResolution.js +6 -2
  62. package/dist/application/JavaScriptJsonModules.js +3 -2
  63. package/dist/application/JavaScriptModuleRelationships.js +4 -2
  64. package/dist/application/JavaScriptRuntimeObservationService.js +2 -1
  65. package/dist/application/JavaScriptRuntimeReconciliationService.js +2 -1
  66. package/dist/application/JavaScriptSemanticGraphProjection.js +1 -1
  67. package/dist/application/JavaScriptSemanticTraceService.js +2 -1
  68. package/dist/application/JsonFiles.js +1 -1
  69. package/dist/application/LazyAnalysisProvider.js +3 -1
  70. package/dist/application/LinuxHopper.js +12 -4
  71. package/dist/application/MacHopper.js +20 -7
  72. package/dist/application/ManagedApplicationGraphService.js +2 -1
  73. package/dist/application/ManagedMemberComparisonService.js +3 -1
  74. package/dist/application/ManagedNativeVerificationService.js +2 -1
  75. package/dist/application/ManagedReconstructionService.js +2 -1
  76. package/dist/application/NativeCallRoutes.js +1 -1
  77. package/dist/application/NativeDispatchMetadataInspection.js +1 -1
  78. package/dist/application/NativeUiActionTrace.js +2 -1
  79. package/dist/application/NativeValueTrace.js +1 -1
  80. package/dist/application/ProcessCaptureError.js +1 -1
  81. package/dist/application/ProcessCaptureJournal.js +3 -1
  82. package/dist/application/ProcessCaptureLifecycle.js +6 -3
  83. package/dist/application/ProcessCli.js +9 -5
  84. package/dist/application/ProcessEvidence.js +2 -6
  85. package/dist/application/ProcessHarness.js +3 -2
  86. package/dist/application/ProcessNormalization.js +12 -5
  87. package/dist/application/ProcessSampling.js +3 -1
  88. package/dist/application/ReconstructionCoverageService.js +2 -1
  89. package/dist/application/ReconstructionObligationLedgerService.js +2 -1
  90. package/dist/application/ReferenceSourceImportEntries.js +2 -0
  91. package/dist/application/ReferenceSourceImportPolicy.js +4 -2
  92. package/dist/application/ReferenceSourceVcsAdapter.js +35 -4
  93. package/dist/application/SessionProviderRouter.js +4 -1
  94. package/dist/application/Setup.js +1 -128
  95. package/dist/application/SetupClientConfiguration.js +17 -6
  96. package/dist/application/SetupHost.js +111 -0
  97. package/dist/application/SetupRegistrationEnvironment.js +1 -2
  98. package/dist/application/SetupSkill.js +9 -3
  99. package/dist/application/SetupTypes.js +17 -0
  100. package/dist/application/StoreFileLock.js +7 -2
  101. package/dist/application/SupportedClients.js +8 -0
  102. package/dist/application/Uninstall.js +9 -4
  103. package/dist/application/UpdateRuntime.js +5 -2
  104. package/dist/application/WindowsCapabilities.js +7 -7
  105. package/dist/application/runtime.js +3 -1
  106. package/dist/artifacts/ArtifactProvider.js +3 -1
  107. package/dist/artifacts/DirectoryArtifactReader.js +2 -0
  108. package/dist/artifacts/NativeDmgArtifactReader.js +10 -3
  109. package/dist/artifacts/NibArchive.js +4 -2
  110. package/dist/artifacts/SafeOutputTree.js +26 -10
  111. package/dist/artifacts/ZipArtifactReader.js +1 -0
  112. package/dist/browser/BrowserProcessStartup.js +3 -1
  113. package/dist/browser/CdpAuthorizedMainFrame.js +1 -1
  114. package/dist/browser/CdpBrowserProvider.js +4 -1
  115. package/dist/browser/CdpCaptureDocuments.js +3 -1
  116. package/dist/browser/CdpCaptureEventHandlers.js +6 -2
  117. package/dist/browser/CdpCaptureStorageFingerprints.js +1 -1
  118. package/dist/browser/CdpCaptureValues.js +6 -2
  119. package/dist/browser/CdpConnection.js +8 -6
  120. package/dist/browser/CdpElectronInspection.js +3 -3
  121. package/dist/browser/CdpElectronProvider.js +4 -1
  122. package/dist/browser/CdpElectronScripts.js +2 -2
  123. package/dist/browser/CdpEndpoint.js +22 -10
  124. package/dist/browser/CdpObservationSession.js +2 -1
  125. package/dist/browser/CdpOptionalCommand.js +1 -1
  126. package/dist/browser/CdpPageCapture.js +2 -1
  127. package/dist/browser/CdpSafeMetadata.js +53 -8
  128. package/dist/browser/CdpScreenshot.js +1 -1
  129. package/dist/browser/CdpTargetSession.js +8 -5
  130. package/dist/browser/CdpWebMcpDiscovery.js +1 -1
  131. package/dist/browser/ElectronFileScope.js +9 -3
  132. package/dist/browser/JavaScriptRuntimeScope.js +3 -1
  133. package/dist/browser/PlaywrightBrowserScenarioProvider.js +3 -1
  134. package/dist/browser/PlaywrightElectronActiveActions.js +1 -1
  135. package/dist/browser/PlaywrightElectronActiveProvider.js +6 -2
  136. package/dist/browser/PlaywrightExecutionBoundary.js +1 -1
  137. package/dist/browser/PlaywrightScenarioArtifacts.js +10 -5
  138. package/dist/browser/PlaywrightScenarioBrowser.js +3 -1
  139. package/dist/browser/PlaywrightScenarioEvents.js +6 -2
  140. package/dist/browser/PlaywrightScenarioSession.js +5 -2
  141. package/dist/browser/V8InspectorEndpoint.js +2 -1
  142. package/dist/browser/V8InspectorProvider.js +6 -1
  143. package/dist/browser/WebSourceMapFetcher.js +24 -11
  144. package/dist/cli/androidCommands.js +81 -0
  145. package/dist/{cliApplicationCommands.js → cli/applicationCommands.js} +18 -16
  146. package/dist/{cliBrowserAdvancedCommands.js → cli/browserAdvancedCommands.js} +13 -16
  147. package/dist/{cliBrowserCommands.js → cli/browserCommands.js} +9 -9
  148. package/dist/cli/commandCancellation.js +24 -0
  149. package/dist/cli/coreAnalysisCommands.js +110 -17
  150. package/dist/{cliElectronCommands.js → cli/electronCommands.js} +14 -13
  151. package/dist/cli/firmwareCommands.js +75 -0
  152. package/dist/{cliSetup.js → cli/interactiveSetup.js} +1 -1
  153. package/dist/cli/javascriptApplicationAnalysis.js +1 -1
  154. package/dist/cli/managedCommands.js +1 -1
  155. package/dist/cli/managedProjectGraphCommand.js +1 -1
  156. package/dist/cli/options.js +7 -1
  157. package/dist/{cliProcessCommands.js → cli/processCommands.js} +3 -3
  158. package/dist/cli/referenceSourceImportStatus.js +10 -0
  159. package/dist/cli/setupCommands.js +4 -2
  160. package/dist/cli/utilityCommands.js +3 -2
  161. package/dist/cli.js +10 -15
  162. package/dist/cliBrowserContext.js +1 -1
  163. package/dist/cliBrowserScenarioCommands.js +2 -1
  164. package/dist/cliCommandNames.js +11 -2
  165. package/dist/cliEvidenceCommands.js +2 -1
  166. package/dist/cliJavaScriptRuntimeCommands.js +2 -1
  167. package/dist/cliJsonInput.js +26 -11
  168. package/dist/cliLogging.js +2 -1
  169. package/dist/cliOutput.js +15 -16
  170. package/dist/config/environment.js +11 -1
  171. package/dist/config/parseConfig.js +7 -1
  172. package/dist/config/parsers.js +1 -1
  173. package/dist/contracts/androidToolContracts.js +77 -0
  174. package/dist/contracts/applicationToolContracts.js +32 -5
  175. package/dist/contracts/applicationWorkflowInputContracts.js +13 -13
  176. package/dist/contracts/artifactComparisonExample.js +7 -14
  177. package/dist/contracts/enhancedToolContracts.js +31 -0
  178. package/dist/contracts/errorSchemas.js +4 -2
  179. package/dist/contracts/evidenceInputContracts.js +13 -0
  180. package/dist/contracts/firmwareToolContracts.js +38 -0
  181. package/dist/contracts/officialToolContracts.js +66 -0
  182. package/dist/contracts/promptContracts.js +1 -1
  183. package/dist/contracts/sessionLifecycleInputs.js +4 -0
  184. package/dist/contracts/sessionToolContracts.js +43 -0
  185. package/dist/contracts/sessionToolSchemas.js +1 -1
  186. package/dist/contracts/toolContractExamples.js +5 -0
  187. package/dist/contracts/toolContractTypes.js +2 -0
  188. package/dist/contracts/toolContracts.js +7 -130
  189. package/dist/contracts/toolEffects.js +43 -0
  190. package/dist/contracts/toolOutputSchemaGroups.js +4 -0
  191. package/dist/contracts/toolOutputSchemaPrimitives.js +1 -0
  192. package/dist/doctorRuntime.js +5 -1
  193. package/dist/domain/analysisErrorBase.js +33 -0
  194. package/dist/domain/analysisErrorCore.js +60 -0
  195. package/dist/domain/analysisErrorPresentation.js +22 -2
  196. package/dist/domain/analysisErrorProjection.js +24 -3
  197. package/dist/domain/analysisSnapshot.js +1 -0
  198. package/dist/domain/androidAnalysis.js +141 -0
  199. package/dist/domain/appleAssetCatalog.js +1 -1
  200. package/dist/domain/artifactGraph.js +1 -0
  201. package/dist/domain/artifactInspection.js +19 -17
  202. package/dist/domain/artifactInventoryEvidence.js +20 -25
  203. package/dist/domain/artifactOperationError.js +16 -0
  204. package/dist/domain/browserObservation.js +12 -4
  205. package/dist/domain/browserObservationError.js +23 -0
  206. package/dist/domain/browserScenario.js +1 -1
  207. package/dist/domain/browserScenarioCapture.js +1 -1
  208. package/dist/domain/browserScenarioDiff.js +1 -1
  209. package/dist/domain/browserScenarioNormalization.js +6 -11
  210. package/dist/domain/browserScenarioValues.js +3 -1
  211. package/dist/domain/callPath.js +47 -7
  212. package/dist/domain/canonicalDigest.js +65 -0
  213. package/dist/domain/canonicalOrdering.js +11 -0
  214. package/dist/domain/changedBehavior.js +8 -7
  215. package/dist/domain/comparisonSemantics.js +2 -4
  216. package/dist/domain/configurationErrors.js +25 -0
  217. package/dist/domain/dosCom.js +8 -0
  218. package/dist/domain/electronActiveObservation.js +3 -1
  219. package/dist/domain/electronStaticAnalysisBrowser.js +13 -23
  220. package/dist/domain/electronStaticAnalysisNative.js +2 -1
  221. package/dist/domain/electronStaticAnalysisValues.js +23 -3
  222. package/dist/domain/evidence.js +3 -11
  223. package/dist/domain/evidenceErrors.js +30 -0
  224. package/dist/domain/firmwareAnalysis.js +121 -0
  225. package/dist/domain/functionComparison.js +4 -2
  226. package/dist/domain/functionComparisonDimensions.js +6 -4
  227. package/dist/domain/functionComparisonNormalization.js +8 -1
  228. package/dist/domain/functionComparisonResults.js +1 -4
  229. package/dist/domain/hopperErrors.js +78 -0
  230. package/dist/domain/hopperValues.js +2 -1
  231. package/dist/domain/interfaceBuilderGraph.js +3 -1
  232. package/dist/domain/javascriptApplicationChangeGraph.js +2 -2
  233. package/dist/domain/javascriptApplicationGraph.js +13 -22
  234. package/dist/domain/javascriptApplicationVersionComparison.js +3 -11
  235. package/dist/domain/javascriptApplicationVersionItems.js +3 -3
  236. package/dist/domain/javascriptApplicationVersionKeys.js +1 -1
  237. package/dist/domain/javascriptAstFingerprint.js +1 -1
  238. package/dist/domain/javascriptExportShapeComparison.js +1 -2
  239. package/dist/domain/javascriptExportShapeSelection.js +1 -1
  240. package/dist/domain/javascriptExportShapeVariants.js +7 -3
  241. package/dist/domain/javascriptFeatureSeed.js +29 -9
  242. package/dist/domain/javascriptFeatureTrace.js +9 -13
  243. package/dist/domain/javascriptFeatureTraversal.js +2 -1
  244. package/dist/domain/javascriptNativeHandoff.js +2 -1
  245. package/dist/domain/javascriptRuntimeLoadState.js +2 -2
  246. package/dist/domain/javascriptRuntimeReconciliationActive.js +3 -10
  247. package/dist/domain/javascriptRuntimeReconciliationGraph.js +2 -2
  248. package/dist/domain/javascriptRuntimeReconciliationMatching.js +4 -3
  249. package/dist/domain/javascriptRuntimeReconciliationParsing.js +8 -14
  250. package/dist/domain/javascriptRuntimeReconciliationResult.js +4 -4
  251. package/dist/domain/javascriptRuntimeReconciliationSchemas.js +5 -2
  252. package/dist/domain/javascriptRuntimeStaticCandidates.js +8 -4
  253. package/dist/domain/javascriptSemanticAnalysis.js +40 -3
  254. package/dist/domain/javascriptSemanticCallResolution.js +2 -1
  255. package/dist/domain/javascriptSemanticChildProcesses.js +2 -1
  256. package/dist/domain/javascriptSemanticDataEffects.js +2 -1
  257. package/dist/domain/javascriptSemanticFingerprints.js +1 -1
  258. package/dist/domain/javascriptSemanticGraph.js +23 -28
  259. package/dist/domain/javascriptSemanticPrimitives.js +9 -2
  260. package/dist/domain/javascriptSemanticProjection.js +2 -1
  261. package/dist/domain/javascriptSemanticPromises.js +2 -1
  262. package/dist/domain/javascriptSemanticProvenance.js +1 -1
  263. package/dist/domain/javascriptSemanticQuery.js +7 -8
  264. package/dist/domain/javascriptSemanticQueryAssessment.js +1 -2
  265. package/dist/domain/javascriptSemanticQueryIdentity.js +1 -2
  266. package/dist/domain/javascriptSemanticReturns.js +2 -1
  267. package/dist/domain/javascriptSemanticValues.js +50 -16
  268. package/dist/domain/javascriptSourceParser.js +4 -2
  269. package/dist/domain/javascriptStaticAnalysis.js +1 -1
  270. package/dist/domain/javascriptStaticAnalysisBundler.js +2 -1
  271. package/dist/domain/javascriptStaticAnalysisCalls.js +14 -6
  272. package/dist/domain/javascriptStaticAnalysisHelpers.js +31 -4
  273. package/dist/domain/jsonShape.js +6 -2
  274. package/dist/domain/managedMemberComparison.js +1 -0
  275. package/dist/domain/managedMemberComparisonItems.js +2 -0
  276. package/dist/domain/managedNativeVerificationMatch.js +5 -3
  277. package/dist/domain/nativeDataType.js +2 -0
  278. package/dist/domain/nativeFunctionAnnotations.js +43 -0
  279. package/dist/domain/nativeLoadImage.js +95 -0
  280. package/dist/domain/nativeMetadataRecovery.js +55 -0
  281. package/dist/domain/processCapture.js +0 -1
  282. package/dist/domain/processEvidenceProvider.js +11 -0
  283. package/dist/domain/processTraceComparison.js +1 -1
  284. package/dist/domain/providerAdapterError.js +17 -0
  285. package/dist/domain/providerCleanupError.js +1 -1
  286. package/dist/domain/providerSelectionError.js +44 -0
  287. package/dist/domain/reconstructionUnknowns.js +1 -1
  288. package/dist/domain/reconstructionVerification.js +22 -8
  289. package/dist/domain/referenceSourceClassification.js +5 -6
  290. package/dist/domain/referenceSourceGraph.js +9 -17
  291. package/dist/domain/referenceSourceImportParsing.js +38 -23
  292. package/dist/domain/runtimeIdentification.js +1 -1
  293. package/dist/domain/runtimeVersion.js +4 -7
  294. package/dist/domain/safeJson.js +13 -0
  295. package/dist/domain/sourceToBundleComparison.js +5 -7
  296. package/dist/domain/sourceToBundleSignals.js +6 -6
  297. package/dist/domain/staticRuntimeCorrelation.js +9 -7
  298. package/dist/domain/unknownRegistryError.js +10 -0
  299. package/dist/domain/webBundleAnalyzerAst.js +22 -5
  300. package/dist/domain/webBundleAnalyzerInspection.js +20 -14
  301. package/dist/dotnet/ManagedMemberRows.js +1 -1
  302. package/dist/dotnet/ManagedMetadataHeaps.js +3 -2
  303. package/dist/dotnet/ManagedMetadataInventoryRows.js +4 -2
  304. package/dist/dotnet/ManagedMethodBodyReader.js +8 -1
  305. package/dist/dotnet/ManagedStaticProvider.js +3 -1
  306. package/dist/firmware/FirmwareCommand.js +163 -0
  307. package/dist/firmware/FirmwareFiles.js +190 -0
  308. package/dist/firmware/FirmwareProvider.js +258 -0
  309. package/dist/firmware/FirmwarePublication.js +84 -0
  310. package/dist/firmware/FirmwareRelease.js +32 -0
  311. package/dist/firmware/FirmwareReports.js +223 -0
  312. package/dist/generatedMcpToolCatalog.js +1 -1
  313. package/dist/generatedPackageMetadata.js +5 -5
  314. package/dist/ghidra/GhidraAnalysisProfile.js +37 -8
  315. package/dist/ghidra/GhidraClient.js +52 -6
  316. package/dist/ghidra/GhidraDiagnostics.js +3 -0
  317. package/dist/ghidra/GhidraDoctor.js +38 -14
  318. package/dist/ghidra/GhidraFunctionValues.js +10 -4
  319. package/dist/ghidra/GhidraInstallation.js +10 -4
  320. package/dist/ghidra/GhidraInventoryValues.js +39 -2
  321. package/dist/ghidra/GhidraLauncher.js +91 -26
  322. package/dist/ghidra/GhidraLoadImageValues.js +199 -0
  323. package/dist/ghidra/GhidraProvider.js +129 -13
  324. package/dist/ghidra/GhidraProviderCapabilities.js +52 -15
  325. package/dist/ghidra/GhidraRequestQueue.js +2 -2
  326. package/dist/ghidra/GhidraSessionError.js +31 -4
  327. package/dist/ghidra/GhidraSessionValues.js +10 -7
  328. package/dist/ghidra/GhidraTargetSnapshot.js +16 -2
  329. package/dist/ghidra/GhidraTransport.js +12 -0
  330. package/dist/ghidra/extensions/GhidraExtensionFailures.js +20 -0
  331. package/dist/ghidra/extensions/GhidraExtensions.js +170 -0
  332. package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +21 -0
  333. package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +84 -0
  334. package/dist/hopper/BridgeLauncher.js +4 -2
  335. package/dist/hopper/HopperAnalysisProfile.js +7 -2
  336. package/dist/hopper/HopperCleanup.js +55 -9
  337. package/dist/hopper/HopperClient.js +14 -4
  338. package/dist/hopper/HopperProcessDiagnostic.js +1 -1
  339. package/dist/hopper/HopperProvider.js +8 -4
  340. package/dist/hopper/HopperRequestQueue.js +7 -3
  341. package/dist/hopper/HopperSessionValues.js +1 -1
  342. package/dist/hopper/HopperSocketConnection.js +1 -1
  343. package/dist/hopper/HopperTargetLease.js +23 -15
  344. package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +7 -8
  345. package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -2
  346. package/dist/hopper/protocol.js +8 -8
  347. package/dist/ida/IdaConfiguration.js +56 -0
  348. package/dist/ida/IdaDoctor.js +53 -0
  349. package/dist/ida/IdaInput.js +62 -0
  350. package/dist/ida/IdaMcpConnection.js +111 -0
  351. package/dist/ida/IdaOperationRunner.js +299 -0
  352. package/dist/ida/IdaProtocolValues.js +178 -0
  353. package/dist/ida/IdaProvider.js +126 -0
  354. package/dist/ida/IdaProviderCapabilities.js +60 -0
  355. package/dist/ida/IdaSessionClient.js +306 -0
  356. package/dist/ida/IdaWorkspace.js +54 -0
  357. package/dist/main/shutdown.js +21 -1
  358. package/dist/main/startup.js +1 -1
  359. package/dist/main/transport.js +8 -4
  360. package/dist/main.js +5 -2
  361. package/dist/native/AppleDispatchMetadata.js +31 -10
  362. package/dist/native/NativeMacOSProvider.js +87 -15
  363. package/dist/native/NativeMachoInspection.js +42 -12
  364. package/dist/native/NativeUiHelperRuntime.js +7 -1
  365. package/dist/native/NativeUiObservation.js +6 -2
  366. package/dist/native/parsers/demangle.js +1 -1
  367. package/dist/native/parsers/dyldInfo.js +3 -3
  368. package/dist/native/parsers/otool.js +4 -1
  369. package/dist/native/parsers/plist.js +11 -3
  370. package/dist/process/PrivateRuntimeRoot.js +13 -3
  371. package/dist/process/ProcessOwnership.js +5 -73
  372. package/dist/process/ProcessOwnershipObservation.js +62 -2
  373. package/dist/process/ProcessOwnershipProcessTree.js +13 -0
  374. package/dist/process/ProviderProcess.js +24 -7
  375. package/dist/process/ProviderRunLineage.js +1 -1
  376. package/dist/process/WindowsAuthority.js +20 -1
  377. package/dist/reference/ReferenceSourceReaderEntries.js +5 -1
  378. package/dist/reference/ReferenceSourceReaderFile.js +1 -0
  379. package/dist/server/createServer.js +25 -2
  380. package/dist/server/mcpProgress.js +2 -1
  381. package/dist/server/promptCompletion.js +3 -3
  382. package/dist/server/registerAndroidTools.js +30 -0
  383. package/dist/server/registerApplicationTools/compareExportShapes.js +5 -1
  384. package/dist/server/registerApplicationTools/compareSourceToBundle.js +7 -2
  385. package/dist/server/registerApplicationTools/compareVersions.js +5 -1
  386. package/dist/server/registerApplicationTools/traceFeature.js +7 -2
  387. package/dist/server/registerApplicationTools/traceSemantics.js +7 -2
  388. package/dist/server/registerEnhancedTools.js +28 -1
  389. package/dist/server/registerFirmwareTools.js +22 -0
  390. package/dist/server/registerFunctionComparisonTool.js +1 -1
  391. package/dist/server/registerInvestigationTools/helpers.js +2 -1
  392. package/dist/server/registerManagedTools.js +1 -1
  393. package/dist/server/registerManagedWorkflowTools/evidence.js +1 -1
  394. package/dist/server/registerOfficialTools.js +4 -1
  395. package/dist/server/registerProcessComparisonTool.js +5 -2
  396. package/dist/server/registerSessionTools.js +3 -1
  397. package/dist/server/runDerivedOperation.js +1 -1
  398. package/dist/server/sessionAvailabilityPolicy.js +3 -0
  399. package/dist/server/sessionEvidence.js +1 -1
  400. package/dist/server/toolResult.js +2 -1
  401. package/dist/windows/WindowsNativeLoader.js +108 -0
  402. package/dist/windows/WindowsOwnedProcess.js +168 -0
  403. package/dist/windows/WindowsPrivateRuntime.js +137 -0
  404. package/install.sh +4 -6
  405. package/native/windows/README.md +102 -0
  406. package/native/windows/build/manifest.json +9 -0
  407. package/native/windows/build/rea-windows-x64.node +0 -0
  408. package/package.json +38 -24
  409. package/scripts/rea.mjs +1 -1
  410. package/scripts/verify-windows-native-artifact.mjs +39 -0
  411. package/skills/reverse-engineer-anything/SKILL.md +92 -24
  412. package/skills/reverse-engineer-anything/references/android-applications.md +31 -0
  413. package/skills/reverse-engineer-anything/references/javascript-applications.md +19 -2
  414. package/skills/reverse-engineer-anything/references/native-and-artifacts.md +52 -4
  415. package/dist/browser/CdpCanonicalJsonDigest.js +0 -9
  416. package/dist/domain/errors.js +0 -324
@@ -1,5 +1,5 @@
1
1
  import { parse } from "@babel/parser";
2
- import { isCallExpression, isExportAllDeclaration, isExportNamedDeclaration, isIdentifier, isImport, isImportDeclaration, isMemberExpression, isNode, isStringLiteral, isTSExternalModuleReference, isTSImportEqualsDeclaration, isTSModuleDeclaration, } from "@babel/types";
2
+ import { isCallExpression, isExportAllDeclaration, isExportNamedDeclaration, isIdentifier, isImport, isImportDeclaration, isImportExpression, isMemberExpression, isNode, isStringLiteral, isTSExternalModuleReference, isTSImportEqualsDeclaration, isTSModuleDeclaration, } from "@babel/types";
3
3
  const codeSourceLanguages = new Set(["JavaScript", "TypeScript", "JSX", "TSX"]);
4
4
  const safeModuleName = (node) => {
5
5
  if (isStringLiteral(node))
@@ -101,7 +101,8 @@ const isRequireCallee = (callee) => {
101
101
  if (isMemberExpression(callee) &&
102
102
  isIdentifier(callee.object) &&
103
103
  callee.object.name === "require" &&
104
- (isIdentifier(callee.property) || isStringLiteral(callee.property))) {
104
+ ((!callee.computed && isIdentifier(callee.property)) ||
105
+ isStringLiteral(callee.property))) {
105
106
  const propertyName = isIdentifier(callee.property)
106
107
  ? callee.property.name
107
108
  : isStringLiteral(callee.property)
@@ -112,19 +113,19 @@ const isRequireCallee = (callee) => {
112
113
  return false;
113
114
  };
114
115
  const isImportCallee = (callee) => isImport(callee);
115
- const collectCallExpressions = (node, targets) => {
116
+ const collectModuleExpressions = (node, targets) => {
116
117
  if (node === null || node === undefined)
117
118
  return;
118
119
  if (typeof node !== "object")
119
120
  return;
120
121
  if (Array.isArray(node)) {
121
122
  for (const item of node)
122
- collectCallExpressions(item, targets);
123
+ collectModuleExpressions(item, targets);
123
124
  return;
124
125
  }
125
126
  if (!isNode(node))
126
127
  return;
127
- if (isCallExpression(node)) {
128
+ if (isCallExpression(node) || isImportExpression(node)) {
128
129
  targets.push(node);
129
130
  }
130
131
  for (const value of Object.values(node)) {
@@ -132,7 +133,7 @@ const collectCallExpressions = (node, targets) => {
132
133
  value !== undefined &&
133
134
  typeof value === "object" &&
134
135
  !isSourceLocation(value)) {
135
- collectCallExpressions(value, targets);
136
+ collectModuleExpressions(value, targets);
136
137
  }
137
138
  }
138
139
  };
@@ -142,10 +143,21 @@ const isSourceLocation = (value) => typeof value === "object" &&
142
143
  "end" in value &&
143
144
  !("type" in value);
144
145
  const extractRequireAndDynamicImports = (body, from_path, relationships) => {
145
- const calls = [];
146
+ const expressions = [];
146
147
  for (const statement of body)
147
- collectCallExpressions(statement, calls);
148
- for (const call of calls) {
148
+ collectModuleExpressions(statement, expressions);
149
+ for (const call of expressions) {
150
+ if (isImportExpression(call)) {
151
+ const specifier = safeModuleName(call.source);
152
+ appendRelationship(relationships, {
153
+ fromPath: from_path,
154
+ to: specifier ?? "<dynamic-import>",
155
+ kind: "imports",
156
+ parseState: specifier === undefined ? "partial" : "parsed",
157
+ ...(specifier === undefined ? { resolution: "unknown" } : {}),
158
+ });
159
+ continue;
160
+ }
149
161
  const first = call.arguments[0];
150
162
  if (isRequireCallee(call.callee) && isModuleExpression(first)) {
151
163
  const result = moduleSpecifierFromExpression(first);
@@ -193,13 +205,12 @@ const parseWithBabel = (path, source, language) => {
193
205
  errorRecovery: true,
194
206
  plugins,
195
207
  });
196
- return { ast, parseState: "parsed" };
208
+ return { ast, reasons: ast.errors.map((error) => error.message) };
197
209
  }
198
210
  catch (cause) {
199
211
  return {
200
212
  ast: undefined,
201
- parseState: "unknown",
202
- reason: cause instanceof Error ? cause.message : "Parse failed",
213
+ reasons: [cause instanceof Error ? cause.message : "Parse failed"],
203
214
  };
204
215
  }
205
216
  };
@@ -208,24 +219,28 @@ export const parseReferenceSourceImports = (path, bytes, language) => {
208
219
  if (language !== null && !codeSourceLanguages.has(language))
209
220
  return { relationships: [], parse_failures: [] };
210
221
  const source = new TextDecoder("utf-8", { fatal: false }).decode(bytes);
211
- const { ast, parseState, reason } = parseWithBabel(path, source, language);
212
- if (ast === undefined || parseState === "unknown") {
222
+ const { ast, reasons } = parseWithBabel(path, source, language);
223
+ const parseFailures = reasons.map((reason) => ({
224
+ path,
225
+ parser: "babel",
226
+ reason,
227
+ }));
228
+ if (ast === undefined) {
213
229
  return {
214
230
  relationships: [],
215
- parse_failures: [
216
- {
217
- path,
218
- parser: "babel",
219
- reason: reason ?? "Unknown parse failure",
220
- },
221
- ],
231
+ parse_failures: parseFailures,
222
232
  };
223
233
  }
224
234
  const relationships = [];
225
235
  extractImportDeclarations(ast.program.body, path, relationships);
226
236
  extractRequireAndDynamicImports(ast.program.body, path, relationships);
227
237
  return {
228
- relationships,
229
- parse_failures: [],
238
+ relationships: relationships.map((relationship) => ({
239
+ ...relationship,
240
+ parse_state: parseFailures.length > 0 && relationship.parse_state === "parsed"
241
+ ? "partial"
242
+ : relationship.parse_state,
243
+ })),
244
+ parse_failures: parseFailures,
230
245
  };
231
246
  };
@@ -194,7 +194,7 @@ const familiesFor = (format, path) => {
194
194
  families.add("javascript");
195
195
  if (format === "jvm-class" || /(?:^|\/)[^/]+\.class$/iu.test(path))
196
196
  families.add("jvm");
197
- if (["elf", "mach-o", "mach-o-universal", "pe", "dos-mz"].includes(format))
197
+ if (["elf", "mach-o", "mach-o-universal", "pe", "dos-mz", "dos-com"].includes(format))
198
198
  families.add("native");
199
199
  if (format === "webassembly" || /(?:^|\/)[^/]+\.wasm$/iu.test(path))
200
200
  families.add("webassembly");
@@ -1,8 +1,5 @@
1
+ import { satisfies } from "semver";
2
+ /** Supported runtime range, kept in sync with the published package engines. */
3
+ export const SUPPORTED_NODE_VERSION_RANGE = "^22.19.0 || ^24.11.0 || >=26.0.0";
1
4
  /** Return whether a Node.js version satisfies REA's tested runtime families. */
2
- export const supportsNodeVersion = (version) => {
3
- const [majorText = "", minorText = ""] = version.split(".");
4
- const major = Number.parseInt(majorText, 10);
5
- const minor = Number.parseInt(minorText, 10);
6
- return ((major === 22 && minor >= 19) ||
7
- (major >= 24 && (major !== 24 || minor >= 11)));
8
- };
5
+ export const supportsNodeVersion = (version) => satisfies(version, SUPPORTED_NODE_VERSION_RANGE);
@@ -0,0 +1,13 @@
1
+ /** Parse JSON text, returning the failure reason instead of throwing. */
2
+ export const safeParseJson = (value) => {
3
+ try {
4
+ return { ok: true, value: JSON.parse(value) };
5
+ }
6
+ catch (cause) {
7
+ return {
8
+ ok: false,
9
+ error: cause instanceof Error ? cause.message : String(cause),
10
+ cause,
11
+ };
12
+ }
13
+ };
@@ -1,3 +1,4 @@
1
+ import { compareCodePoints, uniqueSorted } from "./canonicalOrdering.js";
1
2
  import { absenceClaimable, canonicalDigest } from "./comparisonSemantics.js";
2
3
  import { SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS, sourceToBundleComparisonResultSchema, } from "./sourceToBundleComparisonSchemas.js";
3
4
  import { buildSourceToBundleCandidateIndex, candidateIdsForSource, historicalSourceFiles, scoreSourceToBundleCandidate, sourceBearingNodes, } from "./sourceToBundleSignals.js";
@@ -32,7 +33,7 @@ export const compareSourceToBundle = (input) => {
32
33
  };
33
34
  return sourceToBundleComparisonResultSchema.parse({
34
35
  ...semanticResult,
35
- comparison_id: `stbc_${digestCanonical(semanticResult)}`,
36
+ comparison_id: `stbc_${canonicalDigest(semanticResult, "Source-to-bundle comparison")}`,
36
37
  });
37
38
  };
38
39
  const projectComparison = (input) => {
@@ -208,11 +209,11 @@ const markMergedMappings = (input, items) => {
208
209
  return { ...semantic, mapping_id: mappingId(input, semantic) };
209
210
  });
210
211
  };
211
- const mappingId = (input, item) => `stbc_item_${digestCanonical({
212
+ const mappingId = (input, item) => `stbc_item_${canonicalDigest({
212
213
  reference_root_sha256: input.reference.root_sha256,
213
214
  application_graph_id: input.application.graph.graph_id,
214
215
  ...item,
215
- })}`;
216
+ }, "Source-to-bundle comparison")}`;
216
217
  const comparisonSummary = (items) => ({
217
218
  unchanged: countStatus(items, "unchanged"),
218
219
  modified: countStatus(items, "modified"),
@@ -246,7 +247,4 @@ const comparisonLimitations = (factors) => uniqueSorted([
246
247
  ]);
247
248
  const hasSignal = (candidate, kind) => candidate.signals.some((signal) => signal.kind === kind);
248
249
  const compareCandidates = (left, right) => right.score - left.score ||
249
- compareText(left.current_node_id, right.current_node_id);
250
- const digestCanonical = (value) => canonicalDigest(value, "Source-to-bundle comparison");
251
- const uniqueSorted = (values) => [...new Set(values)].sort(compareText);
252
- const compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
250
+ compareCodePoints(left.current_node_id, right.current_node_id);
@@ -1,4 +1,5 @@
1
1
  import { posix } from "node:path";
2
+ import { compareCodePoints } from "./canonicalOrdering.js";
2
3
  import { SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS, } from "./sourceToBundleComparisonSchemas.js";
3
4
  import { isDigest } from "./digests.js";
4
5
  const RELEVANT_NODE_KINDS = new Set([
@@ -23,11 +24,11 @@ const signalWeight = (kind) => {
23
24
  /** Keep source-bearing application nodes in stable identifier order. */
24
25
  export const sourceBearingNodes = (nodes) => nodes
25
26
  .filter(({ kind }) => RELEVANT_NODE_KINDS.has(kind))
26
- .sort((left, right) => compareText(left.node_id, right.node_id));
27
+ .sort((left, right) => compareCodePoints(left.node_id, right.node_id));
27
28
  /** Keep historical source files in stable path order. */
28
29
  export const historicalSourceFiles = (graph) => graph.entries
29
30
  .filter((entry) => entry.kind === "file" && entry.classifications.includes("source"))
30
- .sort((left, right) => compareText(left.path, right.path));
31
+ .sort((left, right) => compareCodePoints(left.path, right.path));
31
32
  /** Build deterministic candidate indices without assigning fuzzy matches. */
32
33
  export const buildSourceToBundleCandidateIndex = (nodes) => {
33
34
  const projections = nodes.map(projectCurrentNode);
@@ -62,7 +63,7 @@ export const candidateIdsForSource = (source, index) => {
62
63
  for (const group of groups) {
63
64
  if (group === undefined)
64
65
  continue;
65
- for (const nodeId of [...group].sort(compareText)) {
66
+ for (const nodeId of [...group].sort(compareCodePoints)) {
66
67
  if (seen.has(nodeId))
67
68
  continue;
68
69
  seen.add(nodeId);
@@ -149,7 +150,7 @@ const signal = (kind, sourceValue, currentValues) => ({
149
150
  kind,
150
151
  weight: signalWeight(kind),
151
152
  source_value: sourceValue,
152
- current_values: [...new Set(currentValues)].sort(compareText),
153
+ current_values: [...new Set(currentValues)].sort(compareCodePoints),
153
154
  });
154
155
  const candidateConfidence = (signals) => {
155
156
  const kinds = new Set(signals.map(({ kind }) => kind));
@@ -190,7 +191,7 @@ const normalizeCurrentPath = (raw) => {
190
191
  };
191
192
  const uniquePaths = (paths) => [
192
193
  ...new Map(paths.map((path) => [`${path.kind}\0${path.value}`, path])).values(),
193
- ].sort((left, right) => compareText(`${left.kind}\0${left.value}`, `${right.kind}\0${right.value}`));
194
+ ].sort((left, right) => compareCodePoints(`${left.kind}\0${left.value}`, `${right.kind}\0${right.value}`));
194
195
  const pathSuffixes = (path) => {
195
196
  const parts = path.split("/");
196
197
  return parts.map((_, index) => parts.slice(index).join("/"));
@@ -200,4 +201,3 @@ const addIndexValue = (index, key, nodeId) => {
200
201
  values.add(nodeId);
201
202
  index.set(key, values);
202
203
  };
203
- const compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
@@ -2,8 +2,10 @@ import { createHash } from "node:crypto";
2
2
  import canonicalize from "canonicalize";
3
3
  import { z } from "zod";
4
4
  import { artifactComparisonResultSchema } from "./artifactComparison.js";
5
+ import { uniqueSorted } from "./canonicalOrdering.js";
5
6
  import { evidenceSchema, parseEvidence } from "./evidence.js";
6
7
  import { functionComparisonResultSchema } from "./functionComparison.js";
8
+ import { PROCESS_PROVIDER, isProcessEvidenceProvider, } from "./processEvidenceProvider.js";
7
9
  import { comparisonStatusSchema, processCaptureComparisonSchema, } from "./processCapture.js";
8
10
  import { PROCESS_COMPARISON_DIMENSIONS } from "./processComparison.js";
9
11
  import { prefixedDigestSchema } from "./../domain/digests.js";
@@ -128,8 +130,8 @@ const EXPECTED = {
128
130
  ],
129
131
  compare_process_captures: [
130
132
  "rea.process-comparison",
131
- "rea-process",
132
- "REA deterministic process harness",
133
+ PROCESS_PROVIDER.id,
134
+ PROCESS_PROVIDER.name,
133
135
  ],
134
136
  };
135
137
  /** Correlate only caller-declared static/runtime hypotheses. */
@@ -280,10 +282,11 @@ const assertComparisonIdentity = (evidence) => {
280
282
  !(Array.isArray(expected[0])
281
283
  ? expected[0].includes(evidence.predicate_type)
282
284
  : evidence.predicate_type === expected[0]) ||
283
- evidence.provider.id !== expected[1] ||
284
- evidence.provider.name !== expected[2] ||
285
- evidence.provider.version !==
286
- (evidence.operation === "compare_process_captures" ? "3" : "1") ||
285
+ (evidence.operation === "compare_process_captures"
286
+ ? !isProcessEvidenceProvider(evidence.provider)
287
+ : evidence.provider.id !== expected[1] ||
288
+ evidence.provider.name !== expected[2] ||
289
+ evidence.provider.version !== "1") ||
287
290
  evidence.confidence !== "derived" ||
288
291
  evidence.authority !== "analyst-inference" ||
289
292
  evidence.subject !== null ||
@@ -358,7 +361,6 @@ const assertUnique = (evidence, label) => {
358
361
  if (new Set(evidence.map(({ evidence_id: id }) => id)).size !== evidence.length)
359
362
  throw new TypeError(`Static/runtime correlation rejects duplicate ${label}`);
360
363
  };
361
- const uniqueSorted = (values) => [...new Set(values)].sort((left, right) => left.localeCompare(right, "en"));
362
364
  const sha256 = (value) => createHash("sha256").update(value).digest("hex");
363
365
  const canonicalJson = (value) => {
364
366
  const serialized = canonicalize(value);
@@ -0,0 +1,10 @@
1
+ import { AnalysisError } from "./analysisErrorBase.js";
2
+ /** Residual-unknown mutation failed a lifecycle, reference, or CAS invariant. */
3
+ export class UnknownRegistryError extends AnalysisError {
4
+ reason;
5
+ _tag = "UnknownRegistryError";
6
+ constructor(reason, options) {
7
+ super(`Residual unknown registry mutation failed: ${reason}`, options);
8
+ this.reason = reason;
9
+ }
10
+ }
@@ -1,5 +1,6 @@
1
1
  import * as t from "@babel/types";
2
2
  import { sanitizeBrowserUrl } from "./browserObservation.js";
3
+ import { semanticStaticPropertyName } from "./javascriptAstValues.js";
3
4
  /** Name of a call/new callee from its AST node. */
4
5
  export const calleeName = (callee) => {
5
6
  if (t.isIdentifier(callee))
@@ -24,15 +25,29 @@ export const propertyName = (value) => {
24
25
  return "";
25
26
  };
26
27
  export const objectValue = (object, name) => {
27
- for (const property of object.properties)
28
- if (t.isObjectProperty(property) && propertyName(property.key) === name)
29
- return property.value;
30
- return undefined;
28
+ let value;
29
+ for (const property of object.properties) {
30
+ if (t.isSpreadElement(property)) {
31
+ value = undefined;
32
+ continue;
33
+ }
34
+ const key = semanticStaticPropertyName(property.key, property.computed);
35
+ if (key === "" && !t.isStringLiteral(property.key))
36
+ value = undefined;
37
+ else if (key === name)
38
+ value = t.isObjectProperty(property) ? property.value : undefined;
39
+ }
40
+ return value;
31
41
  };
32
42
  export const objectString = (object, name) => {
33
43
  const value = objectValue(object, name);
34
44
  return t.isStringLiteral(value) ? value.value : undefined;
35
45
  };
46
+ /** Whether module syntax supplies a URL location without a package/import-map resolver. */
47
+ export const isUrlLikeModuleSpecifier = (specifier) => specifier.startsWith("/") ||
48
+ specifier.startsWith("./") ||
49
+ specifier.startsWith("../") ||
50
+ /^[A-Za-z][A-Za-z0-9+.-]*:/u.test(specifier);
36
51
  export const resolveSpecifier = (specifier, base) => {
37
52
  try {
38
53
  const resolved = new URL(specifier, base);
@@ -40,7 +55,9 @@ export const resolveSpecifier = (specifier, base) => {
40
55
  return null;
41
56
  return sanitizeBrowserUrl(resolved.href).url;
42
57
  }
43
- catch {
58
+ catch (cause) {
59
+ // Unresolvable specifiers are represented by the null return.
60
+ void cause;
44
61
  return null;
45
62
  }
46
63
  };
@@ -1,7 +1,8 @@
1
1
  import { parse } from "@babel/parser";
2
2
  import * as t from "@babel/types";
3
3
  import { sanitizeEndpointCandidate } from "./browserObservation.js";
4
- import { calleeName, endpointArgument, location, locationFields, objectString, objectValue, propertyName, resolveSpecifier, stringArgument, } from "./webBundleAnalyzerAst.js";
4
+ import { semanticStaticPropertyName } from "./javascriptAstValues.js";
5
+ import { calleeName, endpointArgument, location, locationFields, objectString, objectValue, resolveSpecifier, isUrlLikeModuleSpecifier, stringArgument, } from "./webBundleAnalyzerAst.js";
5
6
  export const analyzeScript = (script, accumulator) => {
6
7
  let file;
7
8
  try {
@@ -11,7 +12,9 @@ export const analyzeScript = (script, accumulator) => {
11
12
  plugins: ["jsx", "typescript"],
12
13
  });
13
14
  }
14
- catch {
15
+ catch (cause) {
16
+ // Unparseable scripts are counted; the failure needs no extra detail.
17
+ void cause;
15
18
  accumulator.parseFailures += 1;
16
19
  return;
17
20
  }
@@ -65,15 +68,13 @@ const inspectCall = (script, node, accumulator) => {
65
68
  node,
66
69
  accumulator,
67
70
  });
68
- if ((name === "importScripts" || name.endsWith(".importScripts")) &&
69
- first !== undefined)
70
- addEdge({
71
- script,
72
- specifier: first,
73
- kind: "worker_import",
74
- node,
75
- accumulator,
76
- });
71
+ if (name === "importScripts" || name.endsWith(".importScripts"))
72
+ for (const argument of node.arguments) {
73
+ const specifier = stringArgument(argument);
74
+ if (specifier === undefined)
75
+ continue;
76
+ addEdge({ script, specifier, kind: "worker_import", node, accumulator });
77
+ }
77
78
  if (routeCallNames.some((candidate) => name === candidate || name.endsWith(`.${candidate}`))) {
78
79
  if (first !== undefined)
79
80
  addFinding({
@@ -106,7 +107,7 @@ const inspectCall = (script, node, accumulator) => {
106
107
  addWebMcpDeclaration(script, node, accumulator);
107
108
  };
108
109
  const inspectRouteProperty = (script, node, accumulator) => {
109
- const key = propertyName(node.key);
110
+ const key = semanticStaticPropertyName(node.key, node.computed);
110
111
  if ((key === "path" || key === "route") && t.isStringLiteral(node.value))
111
112
  addFinding({
112
113
  collection: accumulator.routes,
@@ -123,7 +124,10 @@ const addEdge = (context) => {
123
124
  from_script_key: context.script.script_key,
124
125
  kind: context.kind,
125
126
  specifier: context.specifier,
126
- resolved_url: resolveSpecifier(context.specifier, context.script.url),
127
+ resolved_url: context.kind === "worker_import" ||
128
+ isUrlLikeModuleSpecifier(context.specifier)
129
+ ? resolveSpecifier(context.specifier, context.script.url)
130
+ : null,
127
131
  location: location(context.script.script_key, context.node),
128
132
  }));
129
133
  };
@@ -152,7 +156,9 @@ const addWebMcpDeclaration = (script, node, accumulator) => {
152
156
  : schema;
153
157
  const schemaPropertyNames = t.isObjectExpression(propertyObject)
154
158
  ? propertyObject.properties.flatMap((property) => t.isObjectProperty(property)
155
- ? [propertyName(property.key)].filter(Boolean)
159
+ ? [
160
+ semanticStaticPropertyName(property.key, property.computed),
161
+ ].filter(Boolean)
156
162
  : [])
157
163
  : [];
158
164
  const key = `webmcp\0${script.script_key}\0${name ?? ""}\0${schemaPropertyNames.join("\0")}`;
@@ -70,7 +70,7 @@ export const parseMethods = ({ bytes, layout, pe, ranges, }) => {
70
70
  impl_flags: implFlags,
71
71
  flags,
72
72
  signature: signature(sig),
73
- body: methodBody(bytes, pe, rva),
73
+ body: methodBody(bytes, pe, rva, { implFlags, flags }),
74
74
  });
75
75
  core.set(token, { token, name, declaringType: declared?.fullName ?? null });
76
76
  }
@@ -80,9 +80,10 @@ export const readMetadataString = (bytes, layout, index, heapExtent) => {
80
80
  if (end === maximum)
81
81
  throw managedFailure("invalid-string", "metadata.#Strings", "String heap item has no terminator within #Strings", start);
82
82
  try {
83
- return new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(start, end));
83
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes.subarray(start, end));
84
84
  }
85
- catch {
85
+ catch (cause) {
86
+ void cause;
86
87
  throw managedFailure("invalid-string", "metadata.#Strings", "String heap item is not valid UTF-8", start);
87
88
  }
88
89
  };
@@ -201,9 +201,11 @@ const decodeFixedString = (blob) => {
201
201
  if (start > blob.length - length.length)
202
202
  return null;
203
203
  try {
204
- return new TextDecoder("utf-8", { fatal: true }).decode(blob.subarray(start, start + length.length));
204
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(blob.subarray(start, start + length.length));
205
205
  }
206
- catch {
206
+ catch (cause) {
207
+ // Invalid UTF-8 blobs decode as null.
208
+ void cause;
207
209
  return null;
208
210
  }
209
211
  };
@@ -38,9 +38,16 @@ const readMethodBodyHeader = (bytes, offset) => {
38
38
  localSig: bytes.readUInt32LE(offset + 8),
39
39
  };
40
40
  };
41
- export const methodBody = (bytes, pe, rva) => {
41
+ /** Decode admitted managed CIL, retaining unavailable implementation metadata as partial. */
42
+ export const methodBody = (bytes, pe, rva, implementation = {
43
+ implFlags: 0,
44
+ flags: 0,
45
+ }) => {
42
46
  if (rva === 0)
43
47
  return emptyMethodBody(rva, "absent", null);
48
+ if ((implementation.implFlags & 7) !== 0 ||
49
+ (implementation.flags & 0x2000) !== 0)
50
+ return emptyMethodBody(rva, "partial", "CIL decoding is unavailable for native, runtime, unmanaged, or P/Invoke implementations");
44
51
  try {
45
52
  const offset = pe.rvaToOffset(rva, 1, "method.body");
46
53
  const header = readMethodBodyHeader(bytes, offset);
@@ -4,7 +4,9 @@ import { readFile } from "node:fs/promises";
4
4
  import { createAnalysisExecution, } from "../application/AnalysisProvider.js";
5
5
  import { MANAGED_STATIC_PROVIDER } from "../application/InvestigationProviders.js";
6
6
  import { MANAGED_TOOL_CONTRACTS, managedArtifactInputSchema, managedMemberInputSchema, managedNativeBoundaryInputSchema, } from "../contracts/managedToolContracts.js";
7
- import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, EvidenceIntegrityError, ProviderAdapterError, } from "../domain/errors.js";
7
+ import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, } from "../domain/analysisErrorCore.js";
8
+ import { EvidenceIntegrityError } from "../domain/evidenceErrors.js";
9
+ import { ProviderAdapterError } from "../domain/providerAdapterError.js";
8
10
  import { err, ok } from "../domain/result.js";
9
11
  import { inspectManagedArtifactBytes } from "./ManagedArtifactInspector.js";
10
12
  import { inspectManagedMembersBytes } from "./ManagedMemberInspector.js";