rea-agents 4.0.1 → 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.
- package/README.md +93 -30
- package/bridge/ghidra/ReaGhidraBridge.java +358 -15
- package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
- package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
- package/dist/android/AndroidTargetSnapshot.js +34 -0
- package/dist/android/JadxAnalysis.js +191 -0
- package/dist/android/JadxConfiguration.js +41 -0
- package/dist/android/JadxMcpTransport.js +145 -0
- package/dist/android/JadxProtocol.js +101 -0
- package/dist/android/JadxProvider.js +170 -0
- package/dist/android/JadxRelease.js +19 -0
- package/dist/android/JadxSession.js +97 -0
- package/dist/application/AnalysisContextQueries.js +2 -1
- package/dist/application/AnalysisProviderEvaluation.js +5 -3
- package/dist/application/AnalysisProviderRegistry.js +2 -1
- package/dist/application/AnalysisSnapshotCache.js +4 -1
- package/dist/application/AnalysisSnapshotFiles.js +1 -1
- package/dist/application/AndroidAnalysisPort.js +1 -0
- package/dist/application/AndroidAnalysisService.js +37 -0
- package/dist/application/ArtifactExtraction.js +7 -4
- package/dist/application/ArtifactGraphConstruction.js +10 -17
- package/dist/application/ArtifactInventory/scanCanonical.js +8 -7
- package/dist/application/BinarySession.js +16 -3
- package/dist/application/BinarySessionExecution.js +4 -1
- package/dist/application/BinarySessionOpen.js +3 -2
- package/dist/application/BinarySessionRecords.js +9 -3
- package/dist/application/BinaryTargetResolver.js +25 -6
- package/dist/application/BrowserObservationService.js +2 -1
- package/dist/application/BrowserScenarioCaptureService.js +2 -1
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CallPathTracing.js +2 -1
- package/dist/application/CapabilityInventory.js +18 -0
- package/dist/application/ClientConfigPath.js +3 -1
- package/dist/application/ClientConfigurationDocument.js +11 -1
- package/dist/application/ClientRegistrationStatus.js +8 -1
- package/dist/application/CompositeProvider.js +1 -1
- package/dist/application/DirectAnalysis.js +23 -7
- package/dist/application/DirectAnalysisStatus.js +3 -3
- package/dist/application/Doctor.js +48 -8
- package/dist/application/DoctorDiagnostics.js +7 -5
- package/dist/application/DoctorScope.js +1 -1
- package/dist/application/ElectronActiveEvidence.js +2 -2
- package/dist/application/ElectronActiveObservationService.js +2 -1
- package/dist/application/ElectronBoundaryAnalysis.js +1 -1
- package/dist/application/ElectronObservationService.js +2 -1
- package/dist/application/EnhancedLiteralTracing.js +2 -1
- package/dist/application/EnhancedToolTypes.js +2 -1
- package/dist/application/EnhancedTools.js +3 -1
- package/dist/application/EvidenceBundleCommands.js +2 -1
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/EvidenceInputResolver.js +30 -0
- package/dist/application/EvidenceLedger.js +2 -1
- package/dist/application/FirmwareAnalysisPort.js +1 -0
- package/dist/application/FirmwareAnalysisService.js +35 -0
- package/dist/application/FunctionAnalysisEvidence.js +32 -0
- package/dist/application/InventoryProjectionEvidence.js +2 -1
- package/dist/application/JavaScriptApplicationService.js +50 -3
- package/dist/application/JavaScriptApplicationWorkflowService.js +2 -1
- package/dist/application/JavaScriptArtifactAnalysis.js +4 -2
- package/dist/application/JavaScriptArtifactFiles.js +4 -2
- package/dist/application/JavaScriptArtifactPathResolution.js +6 -2
- package/dist/application/JavaScriptJsonModules.js +3 -2
- package/dist/application/JavaScriptModuleRelationships.js +4 -2
- package/dist/application/JavaScriptRuntimeObservationService.js +2 -1
- package/dist/application/JavaScriptRuntimeReconciliationService.js +2 -1
- package/dist/application/JavaScriptSemanticGraphProjection.js +1 -1
- package/dist/application/JavaScriptSemanticTraceService.js +2 -1
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +3 -1
- package/dist/application/LinuxHopper.js +12 -4
- package/dist/application/MacHopper.js +20 -7
- package/dist/application/ManagedApplicationGraphService.js +2 -1
- package/dist/application/ManagedMemberComparisonService.js +3 -1
- package/dist/application/ManagedNativeVerificationService.js +2 -1
- package/dist/application/ManagedReconstructionService.js +2 -1
- package/dist/application/NativeCallRoutes.js +1 -1
- package/dist/application/NativeDispatchMetadataInspection.js +1 -1
- package/dist/application/NativeUiActionTrace.js +2 -1
- package/dist/application/NativeValueTrace.js +1 -1
- package/dist/application/ProcessCaptureError.js +1 -1
- package/dist/application/ProcessCaptureJournal.js +3 -1
- package/dist/application/ProcessCaptureLifecycle.js +6 -3
- package/dist/application/ProcessCli.js +9 -5
- package/dist/application/ProcessEvidence.js +2 -6
- package/dist/application/ProcessHarness.js +3 -2
- package/dist/application/ProcessNormalization.js +12 -5
- package/dist/application/ProcessSampling.js +3 -1
- package/dist/application/ReconstructionCoverageService.js +2 -1
- package/dist/application/ReconstructionObligationLedgerService.js +2 -1
- package/dist/application/ReferenceSourceImportEntries.js +2 -0
- package/dist/application/ReferenceSourceImportPolicy.js +4 -2
- package/dist/application/ReferenceSourceVcsAdapter.js +35 -4
- package/dist/application/SessionProviderRouter.js +4 -1
- package/dist/application/Setup.js +1 -128
- package/dist/application/SetupClientConfiguration.js +17 -6
- package/dist/application/SetupHost.js +111 -0
- package/dist/application/SetupRegistrationEnvironment.js +1 -2
- package/dist/application/SetupSkill.js +9 -3
- package/dist/application/SetupTypes.js +17 -0
- package/dist/application/StoreFileLock.js +7 -2
- package/dist/application/SupportedClients.js +8 -0
- package/dist/application/Uninstall.js +9 -4
- package/dist/application/UpdateRuntime.js +5 -2
- package/dist/application/WindowsCapabilities.js +7 -7
- package/dist/application/runtime.js +3 -1
- package/dist/artifacts/ArtifactProvider.js +3 -1
- package/dist/artifacts/DirectoryArtifactReader.js +2 -0
- package/dist/artifacts/NativeDmgArtifactReader.js +10 -3
- package/dist/artifacts/NibArchive.js +4 -2
- package/dist/artifacts/SafeOutputTree.js +26 -10
- package/dist/artifacts/ZipArtifactReader.js +1 -0
- package/dist/browser/BrowserProcessStartup.js +3 -1
- package/dist/browser/CdpAuthorizedMainFrame.js +1 -1
- package/dist/browser/CdpBrowserProvider.js +4 -1
- package/dist/browser/CdpCaptureDocuments.js +3 -1
- package/dist/browser/CdpCaptureEventHandlers.js +6 -2
- package/dist/browser/CdpCaptureStorageFingerprints.js +1 -1
- package/dist/browser/CdpCaptureValues.js +6 -2
- package/dist/browser/CdpConnection.js +8 -6
- package/dist/browser/CdpElectronInspection.js +3 -3
- package/dist/browser/CdpElectronProvider.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpEndpoint.js +22 -10
- package/dist/browser/CdpObservationSession.js +2 -1
- package/dist/browser/CdpOptionalCommand.js +1 -1
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpSafeMetadata.js +53 -8
- package/dist/browser/CdpScreenshot.js +1 -1
- package/dist/browser/CdpTargetSession.js +8 -5
- package/dist/browser/CdpWebMcpDiscovery.js +1 -1
- package/dist/browser/ElectronFileScope.js +9 -3
- package/dist/browser/JavaScriptRuntimeScope.js +3 -1
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +3 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +1 -1
- package/dist/browser/PlaywrightElectronActiveProvider.js +6 -2
- package/dist/browser/PlaywrightExecutionBoundary.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +10 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +3 -1
- package/dist/browser/PlaywrightScenarioEvents.js +6 -2
- package/dist/browser/PlaywrightScenarioSession.js +5 -2
- package/dist/browser/V8InspectorEndpoint.js +2 -1
- package/dist/browser/V8InspectorProvider.js +6 -1
- package/dist/browser/WebSourceMapFetcher.js +24 -11
- package/dist/cli/androidCommands.js +81 -0
- package/dist/{cliApplicationCommands.js → cli/applicationCommands.js} +18 -16
- package/dist/{cliBrowserAdvancedCommands.js → cli/browserAdvancedCommands.js} +13 -16
- package/dist/{cliBrowserCommands.js → cli/browserCommands.js} +9 -9
- package/dist/cli/commandCancellation.js +24 -0
- package/dist/cli/coreAnalysisCommands.js +110 -17
- package/dist/{cliElectronCommands.js → cli/electronCommands.js} +14 -13
- package/dist/cli/firmwareCommands.js +75 -0
- package/dist/{cliSetup.js → cli/interactiveSetup.js} +1 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/managedCommands.js +1 -1
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/options.js +7 -1
- package/dist/{cliProcessCommands.js → cli/processCommands.js} +3 -3
- package/dist/cli/referenceSourceImportStatus.js +10 -0
- package/dist/cli/setupCommands.js +4 -2
- package/dist/cli/utilityCommands.js +3 -2
- package/dist/cli.js +10 -15
- package/dist/cliBrowserContext.js +1 -1
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +11 -2
- package/dist/cliEvidenceCommands.js +2 -1
- package/dist/cliJavaScriptRuntimeCommands.js +2 -1
- package/dist/cliJsonInput.js +26 -11
- package/dist/cliLogging.js +2 -1
- package/dist/cliOutput.js +15 -16
- package/dist/config/environment.js +11 -1
- package/dist/config/parseConfig.js +7 -1
- package/dist/config/parsers.js +1 -1
- package/dist/contracts/androidToolContracts.js +77 -0
- package/dist/contracts/applicationToolContracts.js +32 -5
- package/dist/contracts/applicationWorkflowInputContracts.js +13 -13
- package/dist/contracts/artifactComparisonExample.js +7 -14
- package/dist/contracts/enhancedToolContracts.js +31 -0
- package/dist/contracts/errorSchemas.js +4 -2
- package/dist/contracts/evidenceInputContracts.js +13 -0
- package/dist/contracts/firmwareToolContracts.js +38 -0
- package/dist/contracts/officialToolContracts.js +66 -0
- package/dist/contracts/promptContracts.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -0
- package/dist/contracts/sessionToolContracts.js +43 -0
- package/dist/contracts/sessionToolSchemas.js +1 -1
- package/dist/contracts/toolContractExamples.js +5 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +7 -130
- package/dist/contracts/toolEffects.js +43 -0
- package/dist/contracts/toolOutputSchemaGroups.js +4 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -0
- package/dist/doctorRuntime.js +5 -1
- package/dist/domain/analysisErrorBase.js +33 -0
- package/dist/domain/analysisErrorCore.js +60 -0
- package/dist/domain/analysisErrorPresentation.js +22 -2
- package/dist/domain/analysisErrorProjection.js +24 -3
- package/dist/domain/analysisSnapshot.js +1 -0
- package/dist/domain/androidAnalysis.js +141 -0
- package/dist/domain/appleAssetCatalog.js +1 -1
- package/dist/domain/artifactGraph.js +1 -0
- package/dist/domain/artifactInspection.js +19 -17
- package/dist/domain/artifactInventoryEvidence.js +20 -25
- package/dist/domain/artifactOperationError.js +16 -0
- package/dist/domain/browserObservation.js +12 -4
- package/dist/domain/browserObservationError.js +23 -0
- package/dist/domain/browserScenario.js +1 -1
- package/dist/domain/browserScenarioCapture.js +1 -1
- package/dist/domain/browserScenarioDiff.js +1 -1
- package/dist/domain/browserScenarioNormalization.js +6 -11
- package/dist/domain/browserScenarioValues.js +3 -1
- package/dist/domain/callPath.js +47 -7
- package/dist/domain/canonicalDigest.js +65 -0
- package/dist/domain/canonicalOrdering.js +11 -0
- package/dist/domain/changedBehavior.js +8 -7
- package/dist/domain/comparisonSemantics.js +2 -4
- package/dist/domain/configurationErrors.js +25 -0
- package/dist/domain/dosCom.js +8 -0
- package/dist/domain/electronActiveObservation.js +3 -1
- package/dist/domain/electronStaticAnalysisBrowser.js +13 -23
- package/dist/domain/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/electronStaticAnalysisValues.js +23 -3
- package/dist/domain/evidence.js +3 -11
- package/dist/domain/evidenceErrors.js +30 -0
- package/dist/domain/firmwareAnalysis.js +121 -0
- package/dist/domain/functionComparison.js +4 -2
- package/dist/domain/functionComparisonDimensions.js +6 -4
- package/dist/domain/functionComparisonNormalization.js +8 -1
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/hopperErrors.js +78 -0
- package/dist/domain/hopperValues.js +2 -1
- package/dist/domain/interfaceBuilderGraph.js +3 -1
- package/dist/domain/javascriptApplicationChangeGraph.js +2 -2
- package/dist/domain/javascriptApplicationGraph.js +13 -22
- package/dist/domain/javascriptApplicationVersionComparison.js +3 -11
- package/dist/domain/javascriptApplicationVersionItems.js +3 -3
- package/dist/domain/javascriptApplicationVersionKeys.js +1 -1
- package/dist/domain/javascriptAstFingerprint.js +1 -1
- package/dist/domain/javascriptExportShapeComparison.js +1 -2
- package/dist/domain/javascriptExportShapeSelection.js +1 -1
- package/dist/domain/javascriptExportShapeVariants.js +7 -3
- package/dist/domain/javascriptFeatureSeed.js +29 -9
- package/dist/domain/javascriptFeatureTrace.js +9 -13
- package/dist/domain/javascriptFeatureTraversal.js +2 -1
- package/dist/domain/javascriptNativeHandoff.js +2 -1
- package/dist/domain/javascriptRuntimeLoadState.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationActive.js +3 -10
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +4 -3
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +8 -14
- package/dist/domain/javascriptRuntimeReconciliationResult.js +4 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +5 -2
- package/dist/domain/javascriptRuntimeStaticCandidates.js +8 -4
- package/dist/domain/javascriptSemanticAnalysis.js +40 -3
- package/dist/domain/javascriptSemanticCallResolution.js +2 -1
- package/dist/domain/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascriptSemanticDataEffects.js +2 -1
- package/dist/domain/javascriptSemanticFingerprints.js +1 -1
- package/dist/domain/javascriptSemanticGraph.js +23 -28
- package/dist/domain/javascriptSemanticPrimitives.js +9 -2
- package/dist/domain/javascriptSemanticProjection.js +2 -1
- package/dist/domain/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascriptSemanticProvenance.js +1 -1
- package/dist/domain/javascriptSemanticQuery.js +7 -8
- package/dist/domain/javascriptSemanticQueryAssessment.js +1 -2
- package/dist/domain/javascriptSemanticQueryIdentity.js +1 -2
- package/dist/domain/javascriptSemanticReturns.js +2 -1
- package/dist/domain/javascriptSemanticValues.js +50 -16
- package/dist/domain/javascriptSourceParser.js +4 -2
- package/dist/domain/javascriptStaticAnalysis.js +1 -1
- package/dist/domain/javascriptStaticAnalysisBundler.js +2 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +14 -6
- package/dist/domain/javascriptStaticAnalysisHelpers.js +31 -4
- package/dist/domain/jsonShape.js +6 -2
- package/dist/domain/managedMemberComparison.js +1 -0
- package/dist/domain/managedMemberComparisonItems.js +2 -0
- package/dist/domain/managedNativeVerificationMatch.js +5 -3
- package/dist/domain/nativeDataType.js +2 -0
- package/dist/domain/nativeFunctionAnnotations.js +43 -0
- package/dist/domain/nativeLoadImage.js +95 -0
- package/dist/domain/nativeMetadataRecovery.js +55 -0
- package/dist/domain/processCapture.js +0 -1
- package/dist/domain/processEvidenceProvider.js +11 -0
- package/dist/domain/processTraceComparison.js +1 -1
- package/dist/domain/providerAdapterError.js +17 -0
- package/dist/domain/providerCleanupError.js +1 -1
- package/dist/domain/providerSelectionError.js +44 -0
- package/dist/domain/reconstructionUnknowns.js +1 -1
- package/dist/domain/reconstructionVerification.js +22 -8
- package/dist/domain/referenceSourceClassification.js +5 -6
- package/dist/domain/referenceSourceGraph.js +9 -17
- package/dist/domain/referenceSourceImportParsing.js +38 -23
- package/dist/domain/runtimeIdentification.js +1 -1
- package/dist/domain/runtimeVersion.js +4 -7
- package/dist/domain/safeJson.js +13 -0
- package/dist/domain/sourceToBundleComparison.js +5 -7
- package/dist/domain/sourceToBundleSignals.js +6 -6
- package/dist/domain/staticRuntimeCorrelation.js +9 -7
- package/dist/domain/unknownRegistryError.js +10 -0
- package/dist/domain/webBundleAnalyzerAst.js +22 -5
- package/dist/domain/webBundleAnalyzerInspection.js +20 -14
- package/dist/dotnet/ManagedMemberRows.js +1 -1
- package/dist/dotnet/ManagedMetadataHeaps.js +3 -2
- package/dist/dotnet/ManagedMetadataInventoryRows.js +4 -2
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -1
- package/dist/dotnet/ManagedStaticProvider.js +3 -1
- package/dist/firmware/FirmwareCommand.js +163 -0
- package/dist/firmware/FirmwareFiles.js +190 -0
- package/dist/firmware/FirmwareProvider.js +258 -0
- package/dist/firmware/FirmwarePublication.js +84 -0
- package/dist/firmware/FirmwareRelease.js +32 -0
- package/dist/firmware/FirmwareReports.js +223 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +5 -5
- package/dist/ghidra/GhidraAnalysisProfile.js +37 -8
- package/dist/ghidra/GhidraClient.js +52 -6
- package/dist/ghidra/GhidraDiagnostics.js +3 -0
- package/dist/ghidra/GhidraDoctor.js +38 -14
- package/dist/ghidra/GhidraFunctionValues.js +10 -4
- package/dist/ghidra/GhidraInstallation.js +10 -4
- package/dist/ghidra/GhidraInventoryValues.js +39 -2
- package/dist/ghidra/GhidraLauncher.js +91 -26
- package/dist/ghidra/GhidraLoadImageValues.js +199 -0
- package/dist/ghidra/GhidraProvider.js +129 -13
- package/dist/ghidra/GhidraProviderCapabilities.js +52 -15
- package/dist/ghidra/GhidraRequestQueue.js +2 -2
- package/dist/ghidra/GhidraSessionError.js +31 -4
- package/dist/ghidra/GhidraSessionValues.js +10 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +16 -2
- package/dist/ghidra/GhidraTransport.js +12 -0
- package/dist/ghidra/extensions/GhidraExtensionFailures.js +20 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +170 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +21 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +84 -0
- package/dist/hopper/BridgeLauncher.js +4 -2
- package/dist/hopper/HopperAnalysisProfile.js +7 -2
- package/dist/hopper/HopperCleanup.js +55 -9
- package/dist/hopper/HopperClient.js +14 -4
- package/dist/hopper/HopperProcessDiagnostic.js +1 -1
- package/dist/hopper/HopperProvider.js +8 -4
- package/dist/hopper/HopperRequestQueue.js +7 -3
- package/dist/hopper/HopperSessionValues.js +1 -1
- package/dist/hopper/HopperSocketConnection.js +1 -1
- package/dist/hopper/HopperTargetLease.js +23 -15
- package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +7 -8
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -2
- package/dist/hopper/protocol.js +8 -8
- package/dist/ida/IdaConfiguration.js +56 -0
- package/dist/ida/IdaDoctor.js +53 -0
- package/dist/ida/IdaInput.js +62 -0
- package/dist/ida/IdaMcpConnection.js +111 -0
- package/dist/ida/IdaOperationRunner.js +299 -0
- package/dist/ida/IdaProtocolValues.js +178 -0
- package/dist/ida/IdaProvider.js +126 -0
- package/dist/ida/IdaProviderCapabilities.js +60 -0
- package/dist/ida/IdaSessionClient.js +306 -0
- package/dist/ida/IdaWorkspace.js +54 -0
- package/dist/main/shutdown.js +21 -1
- package/dist/main/startup.js +1 -1
- package/dist/main/transport.js +8 -4
- package/dist/main.js +5 -2
- package/dist/native/AppleDispatchMetadata.js +31 -10
- package/dist/native/NativeMacOSProvider.js +87 -15
- package/dist/native/NativeMachoInspection.js +42 -12
- package/dist/native/NativeUiHelperRuntime.js +7 -1
- package/dist/native/NativeUiObservation.js +6 -2
- package/dist/native/parsers/demangle.js +1 -1
- package/dist/native/parsers/dyldInfo.js +3 -3
- package/dist/native/parsers/otool.js +4 -1
- package/dist/native/parsers/plist.js +11 -3
- package/dist/process/PrivateRuntimeRoot.js +13 -3
- package/dist/process/ProcessOwnership.js +5 -73
- package/dist/process/ProcessOwnershipObservation.js +62 -2
- package/dist/process/ProcessOwnershipProcessTree.js +13 -0
- package/dist/process/ProviderProcess.js +24 -7
- package/dist/process/ProviderRunLineage.js +1 -1
- package/dist/process/WindowsAuthority.js +20 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +1 -0
- package/dist/server/createServer.js +25 -2
- package/dist/server/mcpProgress.js +2 -1
- package/dist/server/promptCompletion.js +3 -3
- package/dist/server/registerAndroidTools.js +30 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +5 -1
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +7 -2
- package/dist/server/registerApplicationTools/compareVersions.js +5 -1
- package/dist/server/registerApplicationTools/traceFeature.js +7 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +7 -2
- package/dist/server/registerEnhancedTools.js +28 -1
- package/dist/server/registerFirmwareTools.js +22 -0
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools/helpers.js +2 -1
- package/dist/server/registerManagedTools.js +1 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +1 -1
- package/dist/server/registerOfficialTools.js +4 -1
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerSessionTools.js +3 -1
- package/dist/server/runDerivedOperation.js +1 -1
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/sessionEvidence.js +1 -1
- package/dist/server/toolResult.js +2 -1
- package/dist/windows/WindowsNativeLoader.js +108 -0
- package/dist/windows/WindowsOwnedProcess.js +168 -0
- package/dist/windows/WindowsPrivateRuntime.js +137 -0
- package/install.sh +4 -6
- package/native/windows/README.md +102 -0
- package/native/windows/build/manifest.json +9 -0
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -24
- package/scripts/rea.mjs +1 -1
- package/scripts/verify-windows-native-artifact.mjs +39 -0
- package/skills/reverse-engineer-anything/SKILL.md +92 -24
- package/skills/reverse-engineer-anything/references/android-applications.md +31 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +19 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +52 -4
- package/dist/browser/CdpCanonicalJsonDigest.js +0 -9
- package/dist/domain/errors.js +0 -324
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Audited upstream release; source remains unmodified in the Git submodule. */
|
|
2
|
+
export const JADX_RELEASE = Object.freeze({
|
|
3
|
+
version: "0.7.1",
|
|
4
|
+
revision: "5844800a486d2248fa949b74c9896285f5b54de2",
|
|
5
|
+
sha256: "6e5eacf500b64292bfb73c49797c1958f6ee44646e43e868039ae7feb573ff75",
|
|
6
|
+
url: "https://github.com/1013503897/jadx-headless-mcp/releases/download/v0.7.1/jadx-headless-mcp-0.7.1-all.jar",
|
|
7
|
+
});
|
|
8
|
+
/** Producing engine identity used by Evidence and the generated product catalog. */
|
|
9
|
+
export const JADX_PROVIDER_IDENTITY = Object.freeze({
|
|
10
|
+
id: "jadx",
|
|
11
|
+
name: "JADX headless",
|
|
12
|
+
version: JADX_RELEASE.version,
|
|
13
|
+
});
|
|
14
|
+
/** Audited engine coverage, kept outside portable Android semantics. */
|
|
15
|
+
export const JADX_LIMITATIONS = [
|
|
16
|
+
"Static decompiler observations do not establish runtime behavior; the APK is never executed.",
|
|
17
|
+
"Method signatures use provider display types; exact DEX descriptors and instruction offsets are unavailable. Overload indices are local to this engine and artifact.",
|
|
18
|
+
"Manifest summary fields are extracted by the upstream engine; decoded XML is retained for verification. APK signatures, split APKs, native libraries and Android runtime capture are not verified by this provider.",
|
|
19
|
+
];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Client } from "@modelcontextprotocol/client";
|
|
2
|
+
import { createAnalysisExecution, } from "../application/AnalysisProvider.js";
|
|
3
|
+
import { AnalysisCapabilityUnavailableError, AnalysisOutputError, } from "../domain/analysisErrorCore.js";
|
|
4
|
+
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
5
|
+
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
6
|
+
import { analyzeJadxRequest } from "./JadxAnalysis.js";
|
|
7
|
+
import { JadxMcpTransport } from "./JadxMcpTransport.js";
|
|
8
|
+
import { jadxLoadSchema, parseJadxEnvelope, parseJadxJson, } from "./JadxProtocol.js";
|
|
9
|
+
import { JADX_RELEASE, JADX_PROVIDER_IDENTITY, JADX_LIMITATIONS, } from "./JadxRelease.js";
|
|
10
|
+
/** One owned engine connection; its wire protocol stays inside the Android adapter. */
|
|
11
|
+
export class JadxSession {
|
|
12
|
+
transport;
|
|
13
|
+
#client = new Client({ name: "rea-android-adapter", version: "1" });
|
|
14
|
+
#raw = [];
|
|
15
|
+
constructor(options, launcher) {
|
|
16
|
+
this.transport = new JadxMcpTransport(options, launcher);
|
|
17
|
+
}
|
|
18
|
+
/** Analyze one admitted immutable APK, checking producer identity and selectors. */
|
|
19
|
+
async execute(context) {
|
|
20
|
+
const { request, target, snapshot, jarHash, signal } = context;
|
|
21
|
+
const abort = () => {
|
|
22
|
+
void this.transport.close().catch(() => undefined);
|
|
23
|
+
};
|
|
24
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
25
|
+
try {
|
|
26
|
+
signal.throwIfAborted();
|
|
27
|
+
await this.#client.connect(this.transport, { timeout: 30_000 });
|
|
28
|
+
const server = this.#client.getServerVersion();
|
|
29
|
+
if (server?.name !== "jadx-headless-mcp" ||
|
|
30
|
+
server.version !== JADX_RELEASE.version)
|
|
31
|
+
throw new AnalysisCapabilityUnavailableError("jadx", request.operation, `Expected jadx-headless-mcp ${JADX_RELEASE.version}; server reported ${server?.name ?? "unknown"} ${server?.version ?? "unknown"}.`);
|
|
32
|
+
const tools = this.#tools(request, target, signal);
|
|
33
|
+
const loaded = jadxLoadSchema.parse(await tools.json("load_apk", {
|
|
34
|
+
path: snapshot,
|
|
35
|
+
threads: 1,
|
|
36
|
+
resources: "full",
|
|
37
|
+
}));
|
|
38
|
+
if (loaded.apk_path !== snapshot)
|
|
39
|
+
throw new AnalysisOutputError(request.operation, "JADX loaded a different APK path than the admitted snapshot");
|
|
40
|
+
const engine = {
|
|
41
|
+
name: "jadx-headless-mcp",
|
|
42
|
+
version: "0.7.1",
|
|
43
|
+
artifact_sha256: jarHash,
|
|
44
|
+
source_revision: jarHash === JADX_RELEASE.sha256 ? JADX_RELEASE.revision : null,
|
|
45
|
+
worker_count: 1,
|
|
46
|
+
heap_limit_mib: 512,
|
|
47
|
+
};
|
|
48
|
+
const result = await analyzeJadxRequest(tools, request, loaded, engine);
|
|
49
|
+
return createAnalysisExecution(result, JADX_PROVIDER_IDENTITY, {
|
|
50
|
+
rawResult: { server, jar_sha256: jarHash, calls: this.#raw },
|
|
51
|
+
subject: target,
|
|
52
|
+
limitations: JADX_LIMITATIONS,
|
|
53
|
+
locations: request.operation === "inspect_android_package"
|
|
54
|
+
? [{ kind: "artifact-path", path: "AndroidManifest.xml" }]
|
|
55
|
+
: [],
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
signal.removeEventListener("abort", abort);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Join owned cleanup even if SDK connection teardown itself fails. */
|
|
63
|
+
async close() {
|
|
64
|
+
try {
|
|
65
|
+
await this.#client.close();
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
await this.transport.close();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
#tools(request, target, signal) {
|
|
72
|
+
const call = async (name, input) => {
|
|
73
|
+
signal.throwIfAborted();
|
|
74
|
+
const response = await this.#client.callTool({ name, arguments: input }, { timeout: 120_000, signal });
|
|
75
|
+
const envelope = parseJadxEnvelope(response, request.operation);
|
|
76
|
+
this.#raw.push({
|
|
77
|
+
operation: name,
|
|
78
|
+
input,
|
|
79
|
+
response: jsonValueSchema.parse(response),
|
|
80
|
+
});
|
|
81
|
+
if (envelope.failed)
|
|
82
|
+
throw new ProviderAdapterError("jadx", request.operation, {
|
|
83
|
+
diagnostics: {
|
|
84
|
+
upstream_operation: name,
|
|
85
|
+
reason: envelope.text,
|
|
86
|
+
target_path: target.path,
|
|
87
|
+
target_sha256: target.sha256,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
return envelope.text;
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
text: call,
|
|
94
|
+
json: async (name, input) => parseJadxJson(await call(name, input), request.operation),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AnalysisCapabilityUnavailableError, AnalysisOutputError, } from "../domain/
|
|
1
|
+
import { AnalysisCapabilityUnavailableError, AnalysisOutputError, } from "../domain/analysisErrorCore.js";
|
|
2
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
2
3
|
import { parseDocuments } from "../domain/hopperValues.js";
|
|
3
4
|
import { err, ok } from "../domain/result.js";
|
|
4
5
|
const parameters = (document, address) => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { analysisProfileSchema, } from "../domain/analysisProfile.js";
|
|
2
|
-
import { AnalysisCancelledError } from "../domain/
|
|
2
|
+
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
|
3
3
|
import { jsonObjectSchema } from "../domain/jsonValue.js";
|
|
4
4
|
import { err, ok } from "../domain/result.js";
|
|
5
5
|
import { ABORTED, waitForAbortable } from "./AbortablePromise.js";
|
|
@@ -14,7 +14,8 @@ export const evaluateAnalysisProviderCandidate = async (candidate, status, targe
|
|
|
14
14
|
return err(new AnalysisCancelledError("open_binary"));
|
|
15
15
|
resolved = resolution;
|
|
16
16
|
}
|
|
17
|
-
catch {
|
|
17
|
+
catch (cause) {
|
|
18
|
+
void cause;
|
|
18
19
|
return ok(rejectedProfile(candidate, status, "Provider profile resolution threw"));
|
|
19
20
|
}
|
|
20
21
|
if (signalIsAborted(signal))
|
|
@@ -38,7 +39,8 @@ export const evaluateAnalysisProviderCandidate = async (candidate, status, targe
|
|
|
38
39
|
return ok(rejectedProfile(candidate, status, "Resolved analysis profile has mismatched provider identity"));
|
|
39
40
|
return ok({ candidate, status, profile, compatibility });
|
|
40
41
|
}
|
|
41
|
-
catch {
|
|
42
|
+
catch (cause) {
|
|
43
|
+
void cause;
|
|
42
44
|
return ok(rejectedProfile(candidate, status, "Provider returned an invalid analysis profile"));
|
|
43
45
|
}
|
|
44
46
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { analysisProviderIdSchema, analysisProviderSelectorSchema, } from "../contracts/providerSelection.js";
|
|
2
|
-
import { AnalysisCancelledError
|
|
2
|
+
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
|
3
|
+
import { ProviderSelectionError, } from "../domain/providerSelectionError.js";
|
|
3
4
|
import { jsonObjectSchema } from "../domain/jsonValue.js";
|
|
4
5
|
import { err, ok } from "../domain/result.js";
|
|
5
6
|
import { evaluateAnalysisProviderCandidate, } from "./AnalysisProviderEvaluation.js";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { EvidenceIntegrityError
|
|
1
|
+
import { EvidenceIntegrityError } from "../domain/evidenceErrors.js";
|
|
2
|
+
import { NoBinaryOpenError } from "../domain/configurationErrors.js";
|
|
3
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
2
4
|
import { err, ok } from "../domain/result.js";
|
|
3
5
|
import { analysisQueryId, createAnalysisSnapshotEntry, snapshotBinding, snapshotMatchesProfile, snapshotMatchesTarget, snapshotTarget, parseAnalysisSnapshot, } from "../domain/analysisSnapshot.js";
|
|
4
6
|
import { GENERATED_MCP_TOOL_CATALOG } from "../generatedMcpToolCatalog.js";
|
|
@@ -31,6 +33,7 @@ export const isSnapshotCacheable = (operation, descriptor, parameters) => !STATE
|
|
|
31
33
|
(!CURSOR_DEFAULT_OPERATIONS.has(operation) ||
|
|
32
34
|
typeof parameters.address === "string") &&
|
|
33
35
|
descriptor?.effects.mutatesArtifact === false &&
|
|
36
|
+
descriptor.cachePolicy !== "live" &&
|
|
34
37
|
descriptor.effects.mayWriteFilesystem === false &&
|
|
35
38
|
descriptor.effects.changesPermissions === false;
|
|
36
39
|
/** Bounded in-memory cache for one immutable binary identity. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseAnalysisSnapshot, serializeAnalysisSnapshot, } from "../domain/analysisSnapshot.js";
|
|
2
|
-
import { EvidenceFileError, EvidenceIntegrityError } from "../domain/
|
|
2
|
+
import { EvidenceFileError, EvidenceIntegrityError, } from "../domain/evidenceErrors.js";
|
|
3
3
|
import { err, ok } from "../domain/result.js";
|
|
4
4
|
import { readJsonFile, writeTextFile } from "./JsonFiles.js";
|
|
5
5
|
/** Read and validate an analysis snapshot from the caller's path. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { parseBinaryTarget } from "./BinaryTargetResolver.js";
|
|
2
|
+
import { androidRequestSchema, } from "../domain/androidAnalysis.js";
|
|
3
|
+
import { AnalysisCancelledError, AnalysisInputError, } from "../domain/analysisErrorCore.js";
|
|
4
|
+
import { createEvidence } from "../domain/evidence.js";
|
|
5
|
+
import { jsonObjectSchema } from "../domain/jsonValue.js";
|
|
6
|
+
import { err, ok } from "../domain/result.js";
|
|
7
|
+
/** Shared CLI/MCP admission, execution and Evidence composition for Android. */
|
|
8
|
+
export class AndroidAnalysisService {
|
|
9
|
+
provider;
|
|
10
|
+
constructor(provider) {
|
|
11
|
+
this.provider = provider;
|
|
12
|
+
}
|
|
13
|
+
/** Inspect a caller-selected APK and retain producing-provider provenance inline. */
|
|
14
|
+
async execute(operation, input, options) {
|
|
15
|
+
if (options?.signal?.aborted === true)
|
|
16
|
+
return err(new AnalysisCancelledError(operation));
|
|
17
|
+
const request = androidRequestSchema.safeParse({ operation, input });
|
|
18
|
+
if (!request.success)
|
|
19
|
+
return err(new AnalysisInputError(operation, { cause: request.error }));
|
|
20
|
+
const target = await parseBinaryTarget(request.data.input.path);
|
|
21
|
+
if (!target.ok)
|
|
22
|
+
return target;
|
|
23
|
+
const executed = await this.provider.execute(target.value, request.data, options);
|
|
24
|
+
if (!executed.ok)
|
|
25
|
+
return executed;
|
|
26
|
+
const execution = executed.value;
|
|
27
|
+
return ok(createEvidence(execution.subject ?? target.value, execution.provider, {
|
|
28
|
+
operation,
|
|
29
|
+
parameters: jsonObjectSchema.parse(request.data.input),
|
|
30
|
+
result: execution.result,
|
|
31
|
+
rawResult: execution.rawResult,
|
|
32
|
+
limitations: execution.limitations,
|
|
33
|
+
locations: execution.locations,
|
|
34
|
+
confidence: operation === "inspect_android_method" ? "derived" : "observed",
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { lstat, realpath } from "node:fs/promises";
|
|
2
|
+
import { canonicalDigest } from "../domain/comparisonSemantics.js";
|
|
2
3
|
import { AsarArtifactReader } from "../artifacts/AsarArtifactReader.js";
|
|
3
4
|
import { ArtifactPathRegistry, normalizeArtifactPath, } from "../artifacts/ArtifactPaths.js";
|
|
4
5
|
import { ArtifactReaderFailure, } from "../artifacts/ArtifactReader.js";
|
|
@@ -8,7 +9,6 @@ import { ZipArtifactReader } from "../artifacts/ZipArtifactReader.js";
|
|
|
8
9
|
import { MachOSliceArtifactReader } from "../artifacts/MachOSliceArtifactReader.js";
|
|
9
10
|
import { artifactExtractionResultSchema, } from "../domain/artifactGraph.js";
|
|
10
11
|
import { scanArtifactInventory } from "./ArtifactInventory.js";
|
|
11
|
-
import { digestCanonical } from "./ArtifactGraphConstruction.js";
|
|
12
12
|
/** Extract every regular inventory occurrence into an exclusively owned absent root. */
|
|
13
13
|
export const extractArtifact = async (input, signal) => {
|
|
14
14
|
const sourcePath = await realpath(input.inputPath);
|
|
@@ -86,7 +86,10 @@ const materializeSelection = async ({ input, sourcePath, inventory, selected, si
|
|
|
86
86
|
}
|
|
87
87
|
catch (cause) {
|
|
88
88
|
if (!readerClosed)
|
|
89
|
-
await reader.close().catch(() =>
|
|
89
|
+
await reader.close().catch((cause) => {
|
|
90
|
+
// best-effort cleanup: reader close must not mask the extraction failure.
|
|
91
|
+
void cause;
|
|
92
|
+
});
|
|
90
93
|
await output.rollback();
|
|
91
94
|
throw cause;
|
|
92
95
|
}
|
|
@@ -97,14 +100,14 @@ const createExtractionResult = (input, inventory, selected, extracted) => {
|
|
|
97
100
|
selected_occurrence_ids: selected
|
|
98
101
|
.map(({ occurrence }) => occurrence.occurrence_id)
|
|
99
102
|
.sort((left, right) => left.localeCompare(right)),
|
|
100
|
-
files_sha256:
|
|
103
|
+
files_sha256: canonicalDigest(extracted, "Artifact"),
|
|
101
104
|
output_root_alias: "$OUTPUT_ROOT",
|
|
102
105
|
};
|
|
103
106
|
return artifactExtractionResultSchema.parse({
|
|
104
107
|
manifest: inventory.manifest,
|
|
105
108
|
extraction_manifest: {
|
|
106
109
|
...extractionSemantic,
|
|
107
|
-
extraction_id: `aex_${
|
|
110
|
+
extraction_id: `aex_${canonicalDigest(extractionSemantic, "Artifact")}`,
|
|
108
111
|
},
|
|
109
112
|
output_root: input.outputRoot,
|
|
110
113
|
artifacts: extracted,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import canonicalize from "canonicalize";
|
|
1
|
+
import { canonicalDigest } from "../domain/comparisonSemantics.js";
|
|
3
2
|
import { zipPackageFormatForPath } from "../domain/zipPackageFormat.js";
|
|
4
3
|
import { mzWindowsHeaderOffset, parseDosMzHeader } from "../domain/dosMz.js";
|
|
5
4
|
/** Index the first occurrence for each canonical logical path. */
|
|
@@ -11,7 +10,7 @@ export const indexOccurrencesByPath = (occurrences) => {
|
|
|
11
10
|
return byPath;
|
|
12
11
|
};
|
|
13
12
|
export const createOccurrence = (entry, path, parent) => ({
|
|
14
|
-
occurrence_id: `occ_${
|
|
13
|
+
occurrence_id: `occ_${canonicalDigest({ path, kind: entry.kind }, "Artifact")}`,
|
|
15
14
|
artifact_id: null,
|
|
16
15
|
parent_occurrence_id: parent,
|
|
17
16
|
logical_path: path,
|
|
@@ -59,7 +58,7 @@ export const materializeDirectoryNodes = (occurrences, nodes) => {
|
|
|
59
58
|
}))
|
|
60
59
|
.sort((left, right) => compareDirectoryChildNames(left.name, right.name));
|
|
61
60
|
const node = createArtifactNode({
|
|
62
|
-
sha256:
|
|
61
|
+
sha256: canonicalDigest({ kind: "directory", children }, "Artifact"),
|
|
63
62
|
size: 0,
|
|
64
63
|
kind: directory.logical_path.toLowerCase().endsWith(".framework")
|
|
65
64
|
? "framework"
|
|
@@ -76,13 +75,13 @@ export const materializeDirectoryNodes = (occurrences, nodes) => {
|
|
|
76
75
|
};
|
|
77
76
|
export const createRootNode = (input) => createArtifactNode({
|
|
78
77
|
sha256: input.digest?.sha256 ??
|
|
79
|
-
|
|
78
|
+
canonicalDigest({
|
|
80
79
|
kind: "directory-root",
|
|
81
80
|
children: input.occurrences.map(({ logical_path, artifact_id }) => ({
|
|
82
81
|
logical_path,
|
|
83
82
|
artifact_id,
|
|
84
83
|
})),
|
|
85
|
-
}),
|
|
84
|
+
}, "Artifact"),
|
|
86
85
|
size: input.digest?.bytes ?? 0,
|
|
87
86
|
kind: input.directory ||
|
|
88
87
|
["zip", "ipa", "apk", "msix", "appx", "asar", "dmg", "pkg"].includes(input.format)
|
|
@@ -95,7 +94,7 @@ export const createRootNode = (input) => createArtifactNode({
|
|
|
95
94
|
contentState: "materialized",
|
|
96
95
|
});
|
|
97
96
|
export const createArtifactNode = (input) => ({
|
|
98
|
-
artifact_id: `art_${
|
|
97
|
+
artifact_id: `art_${canonicalDigest({ sha256: input.sha256 }, "Artifact")}`,
|
|
99
98
|
kind: input.kind,
|
|
100
99
|
format: input.format,
|
|
101
100
|
sha256: input.sha256,
|
|
@@ -107,7 +106,7 @@ export const createArtifactNode = (input) => ({
|
|
|
107
106
|
limitations: [...(input.limitations ?? [])],
|
|
108
107
|
});
|
|
109
108
|
export const rootOccurrenceFor = (node, declaredSize) => ({
|
|
110
|
-
occurrence_id: `occ_${
|
|
109
|
+
occurrence_id: `occ_${canonicalDigest({ root: node.artifact_id }, "Artifact")}`,
|
|
111
110
|
artifact_id: node.artifact_id,
|
|
112
111
|
parent_occurrence_id: null,
|
|
113
112
|
logical_path: ".",
|
|
@@ -123,11 +122,11 @@ export const rootOccurrenceFor = (node, declaredSize) => ({
|
|
|
123
122
|
export const rekeyOccurrences = (rootArtifactId, occurrences) => {
|
|
124
123
|
const replacements = new Map();
|
|
125
124
|
for (const occurrence of occurrences)
|
|
126
|
-
replacements.set(occurrence.occurrence_id, `occ_${
|
|
125
|
+
replacements.set(occurrence.occurrence_id, `occ_${canonicalDigest({
|
|
127
126
|
root_artifact_id: rootArtifactId,
|
|
128
127
|
logical_path: occurrence.logical_path,
|
|
129
128
|
entry_kind: occurrence.entry_kind,
|
|
130
|
-
})}`);
|
|
129
|
+
}, "Artifact")}`);
|
|
131
130
|
for (const occurrence of occurrences) {
|
|
132
131
|
occurrence.occurrence_id =
|
|
133
132
|
replacements.get(occurrence.occurrence_id) ?? occurrence.occurrence_id;
|
|
@@ -161,7 +160,7 @@ export const createArtifactEdges = (rootArtifactId, occurrences, producer) => {
|
|
|
161
160
|
logical_path: occurrence.logical_path,
|
|
162
161
|
};
|
|
163
162
|
edges.push({
|
|
164
|
-
edge_id: `edge_${
|
|
163
|
+
edge_id: `edge_${canonicalDigest(semantic, "Artifact")}`,
|
|
165
164
|
...semantic,
|
|
166
165
|
producer: occurrence.entry_kind === "slice" ? (producer ?? null) : null,
|
|
167
166
|
ordinal: edges.length,
|
|
@@ -255,12 +254,6 @@ export const classifyArtifactContent = (path, prefix, fileSize = prefix.length)
|
|
|
255
254
|
}
|
|
256
255
|
return byPath;
|
|
257
256
|
};
|
|
258
|
-
export const digestCanonical = (value) => {
|
|
259
|
-
const encoded = canonicalize(value);
|
|
260
|
-
if (encoded === undefined)
|
|
261
|
-
throw new TypeError("Artifact value is not canonical JSON");
|
|
262
|
-
return createHash("sha256").update(encoded).digest("hex");
|
|
263
|
-
};
|
|
264
257
|
const relationFor = (path) => {
|
|
265
258
|
const lower = path.toLowerCase();
|
|
266
259
|
if (lower.endsWith(".map"))
|
|
@@ -2,7 +2,8 @@ import { createReadStream } from "node:fs";
|
|
|
2
2
|
import { lstat } from "node:fs/promises";
|
|
3
3
|
import { ArtifactReaderFailure, } from "../../artifacts/ArtifactReader.js";
|
|
4
4
|
import { artifactInventoryResultSchema, } from "../../domain/artifactGraph.js";
|
|
5
|
-
import { createArtifactEdges, createRootNode,
|
|
5
|
+
import { createArtifactEdges, createRootNode, indexOccurrencesByPath, materializeDirectoryNodes, rekeyOccurrences, rootOccurrenceFor, } from "../ArtifactGraphConstruction.js";
|
|
6
|
+
import { canonicalDigest } from "../../domain/comparisonSemantics.js";
|
|
6
7
|
import { classifyRoot } from "./classify.js";
|
|
7
8
|
import { hashReadable } from "./hash.js";
|
|
8
9
|
import { createReader, inventoryLimitations } from "./reader.js";
|
|
@@ -62,12 +63,12 @@ const buildInventorySnapshot = async (input) => {
|
|
|
62
63
|
const orderedOccurrences = sortOccurrences(input.occurrences);
|
|
63
64
|
const orderedEdges = sortEdges(edges);
|
|
64
65
|
await verifyRootDigest(path, rootDigest, signal);
|
|
65
|
-
const graphSha256 =
|
|
66
|
+
const graphSha256 = canonicalDigest({
|
|
66
67
|
nodes: orderedNodes,
|
|
67
68
|
occurrences: orderedOccurrences,
|
|
68
69
|
edges: orderedEdges,
|
|
69
70
|
integrity_contradictions: integrityContradictions,
|
|
70
|
-
});
|
|
71
|
+
}, "Artifact");
|
|
71
72
|
const manifest = buildManifest({
|
|
72
73
|
rootNode,
|
|
73
74
|
graphSha256,
|
|
@@ -94,12 +95,12 @@ const buildIntegrityContradictions = (pending, occurrenceByPath, occurrenceById,
|
|
|
94
95
|
: occurrenceById.get(occurrence.parent_occurrence_id);
|
|
95
96
|
const parentArtifactId = parent?.artifact_id ?? rootNode.artifact_id;
|
|
96
97
|
return {
|
|
97
|
-
contradiction_id: `ic_${
|
|
98
|
+
contradiction_id: `ic_${canonicalDigest({
|
|
98
99
|
root_artifact_id: rootNode.artifact_id,
|
|
99
100
|
logical_path: contradiction.logicalPath,
|
|
100
101
|
declared_sha256: contradiction.declaredSha256,
|
|
101
102
|
observed_sha256: contradiction.observedSha256,
|
|
102
|
-
})}`,
|
|
103
|
+
}, "Artifact")}`,
|
|
103
104
|
occurrence_id: occurrence.occurrence_id,
|
|
104
105
|
parent_artifact_id: parentArtifactId,
|
|
105
106
|
logical_path: contradiction.logicalPath,
|
|
@@ -126,10 +127,10 @@ const sortNodes = (nodes) => nodes.sort((left, right) => left.artifact_id.locale
|
|
|
126
127
|
const sortOccurrences = (occurrences) => occurrences.sort((left, right) => left.logical_path.localeCompare(right.logical_path, "en"));
|
|
127
128
|
const sortEdges = (edges) => edges.sort((left, right) => left.edge_id.localeCompare(right.edge_id));
|
|
128
129
|
const buildManifest = ({ rootNode, graphSha256, orderedNodes, orderedOccurrences, orderedEdges, }) => artifactInventoryResultSchema.shape.manifest.parse({
|
|
129
|
-
manifest_id: `agm_${
|
|
130
|
+
manifest_id: `agm_${canonicalDigest({
|
|
130
131
|
root_artifact_id: rootNode.artifact_id,
|
|
131
132
|
graph_sha256: graphSha256,
|
|
132
|
-
})}`,
|
|
133
|
+
}, "Artifact")}`,
|
|
133
134
|
root_artifact_id: rootNode.artifact_id,
|
|
134
135
|
root_sha256: rootNode.sha256,
|
|
135
136
|
root_format: rootNode.format,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { analysisProfilesEqual, } from "../domain/analysisProfile.js";
|
|
3
|
-
import { AnalysisCancelledError
|
|
3
|
+
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
|
4
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
4
5
|
import { err, ok } from "../domain/result.js";
|
|
5
6
|
import { createEvidence } from "../domain/evidence.js";
|
|
6
7
|
import { GENERATED_MCP_TOOL_CATALOG } from "../generatedMcpToolCatalog.js";
|
|
@@ -58,6 +59,14 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
58
59
|
? profile.provider
|
|
59
60
|
: selected);
|
|
60
61
|
}
|
|
62
|
+
/** External live state cannot be replayed by a direct or composed CLI workflow. */
|
|
63
|
+
allowsSnapshotReplay(operation) {
|
|
64
|
+
const capabilities = this.#active?.route.capabilities;
|
|
65
|
+
const descriptor = capabilities?.get(operation);
|
|
66
|
+
if (descriptor !== undefined)
|
|
67
|
+
return descriptor.cachePolicy !== "live";
|
|
68
|
+
return ![...(capabilities?.values() ?? [])].some(({ cachePolicy }) => cachePolicy === "live");
|
|
69
|
+
}
|
|
61
70
|
/** Return the selected immutable profile, optionally scoped to an operation. */
|
|
62
71
|
analysisProfile(operation) {
|
|
63
72
|
const profile = this.#active?.profile;
|
|
@@ -318,12 +327,16 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
318
327
|
for (const listener of this.#availabilityListeners) {
|
|
319
328
|
try {
|
|
320
329
|
const notification = listener();
|
|
321
|
-
if (notification !== undefined)
|
|
330
|
+
if (notification !== undefined) {
|
|
331
|
+
// best-effort cleanup: async observer notifications must not reject
|
|
332
|
+
// unhandled; state transitions and other listeners continue.
|
|
322
333
|
void notification.catch(() => undefined);
|
|
334
|
+
}
|
|
323
335
|
}
|
|
324
|
-
catch {
|
|
336
|
+
catch (cause) {
|
|
325
337
|
// External observers are best-effort notifications. Contain only the
|
|
326
338
|
// callback failure so state transitions and other listeners continue.
|
|
339
|
+
void cause;
|
|
327
340
|
}
|
|
328
341
|
}
|
|
329
342
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { AnalysisCapabilityUnavailableError
|
|
1
|
+
import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.js";
|
|
2
|
+
import { NoBinaryOpenError } from "../domain/configurationErrors.js";
|
|
3
|
+
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
4
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
2
5
|
import { err, ok } from "../domain/result.js";
|
|
3
6
|
import { isSnapshotCacheable } from "./AnalysisSnapshotCache.js";
|
|
4
7
|
/** Resolve capability, profile, and snapshot state before invoking a provider. */
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { snapshotMatchesBinding, snapshotMatchesTarget, snapshotTarget, } from "../domain/analysisSnapshot.js";
|
|
2
2
|
import { parseBinaryTarget } from "./BinaryTargetResolver.js";
|
|
3
3
|
import {} from "../domain/binaryTarget.js";
|
|
4
|
-
import { EvidenceIntegrityError
|
|
4
|
+
import { EvidenceIntegrityError } from "../domain/evidenceErrors.js";
|
|
5
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
5
6
|
import { err } from "../domain/result.js";
|
|
6
7
|
import { SessionProviderRouter } from "./SessionProviderRouter.js";
|
|
7
8
|
/** Parse a target, resolve its provider route, and validate snapshot binding. */
|
|
8
9
|
export const resolveSessionOpen = async (input) => {
|
|
9
10
|
const { router, current, path, options, stagedSnapshotMatches } = input;
|
|
10
|
-
const parsed = await parseBinaryTarget(path, process.cwd(), process.arch, options.targetKind);
|
|
11
|
+
const parsed = await parseBinaryTarget(path, process.cwd(), process.arch, options.targetKind, options.formatHint);
|
|
11
12
|
if (!parsed.ok)
|
|
12
13
|
return parsed;
|
|
13
14
|
const target = parsed.value;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createEvidence } from "../domain/evidence.js";
|
|
2
2
|
import { evidenceBundleForTarget } from "../domain/evidenceBundle.js";
|
|
3
|
-
import { EvidenceIntegrityError
|
|
3
|
+
import { EvidenceIntegrityError } from "../domain/evidenceErrors.js";
|
|
4
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
5
|
+
import {} from "../domain/unknownRegistryError.js";
|
|
4
6
|
import { err, ok } from "../domain/result.js";
|
|
5
7
|
import { AnalysisSnapshotCache } from "./AnalysisSnapshotCache.js";
|
|
6
8
|
import { EvidenceLedger } from "./EvidenceLedger.js";
|
|
@@ -105,11 +107,15 @@ export class BinarySessionRecords {
|
|
|
105
107
|
try {
|
|
106
108
|
const notification = listener();
|
|
107
109
|
if (notification !== undefined)
|
|
108
|
-
void notification.catch(() =>
|
|
110
|
+
void notification.catch((cause) => {
|
|
111
|
+
// best-effort cleanup: async observer notifications must not reject unhandled.
|
|
112
|
+
void cause;
|
|
113
|
+
});
|
|
109
114
|
}
|
|
110
|
-
catch {
|
|
115
|
+
catch (cause) {
|
|
111
116
|
// External resource observers are best-effort; one callback must not
|
|
112
117
|
// make a committed evidence mutation appear to fail.
|
|
118
|
+
void cause;
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
}
|
|
@@ -5,8 +5,9 @@ import { execFile } from "node:child_process";
|
|
|
5
5
|
import { extname, isAbsolute, join, resolve } from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { isPathWithinRoot } from "../domain/localPath.js";
|
|
8
|
-
import { BinaryTargetError } from "../domain/
|
|
8
|
+
import { BinaryTargetError } from "../domain/configurationErrors.js";
|
|
9
9
|
import { err, ok } from "../domain/result.js";
|
|
10
|
+
import { validateDosComLength, } from "../domain/dosCom.js";
|
|
10
11
|
import { mzWindowsHeaderOffset } from "../domain/dosMz.js";
|
|
11
12
|
import { hasZipSignature, zipPackageFormatForPath, } from "../domain/zipPackageFormat.js";
|
|
12
13
|
import { parseExecutableHeader, parsePeRecord, } from "../domain/binaryTarget.js";
|
|
@@ -16,7 +17,7 @@ const execFileAsync = promisify(execFile);
|
|
|
16
17
|
* FAT Mach-O inputs select only a host-compatible architecture so setup remains
|
|
17
18
|
* non-interactive; unsupported or ambiguous inputs are returned as typed errors.
|
|
18
19
|
*/
|
|
19
|
-
export const parseBinaryTarget = async (input, cwd = process.cwd(), hostArchitecture = process.arch, targetKind) => {
|
|
20
|
+
export const parseBinaryTarget = async (input, cwd = process.cwd(), hostArchitecture = process.arch, targetKind, formatHint) => {
|
|
20
21
|
const candidate = isAbsolute(input) ? input : resolve(cwd, input);
|
|
21
22
|
try {
|
|
22
23
|
await access(candidate, constants.R_OK);
|
|
@@ -29,11 +30,27 @@ export const parseBinaryTarget = async (input, cwd = process.cwd(), hostArchitec
|
|
|
29
30
|
try {
|
|
30
31
|
if (!(await handle.stat()).isFile())
|
|
31
32
|
return err(new BinaryTargetError(path, "target is not a regular file"));
|
|
33
|
+
if (formatHint === "dos-com") {
|
|
34
|
+
if (targetKind !== undefined && targetKind !== "executable")
|
|
35
|
+
return err(new BinaryTargetError(path, "DOS COM format requires an executable target kind"));
|
|
36
|
+
const length = validateDosComLength((await handle.stat()).size);
|
|
37
|
+
if (!length.ok)
|
|
38
|
+
return err(new BinaryTargetError(path, length.error));
|
|
39
|
+
return ok({
|
|
40
|
+
path,
|
|
41
|
+
sourcePath: canonical,
|
|
42
|
+
sha256: await sha256Handle(handle),
|
|
43
|
+
kind: "executable",
|
|
44
|
+
format: "dos-com",
|
|
45
|
+
architecture: "x86",
|
|
46
|
+
availableArchitectures: ["x86"],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
32
49
|
if (targetKind === "database" ||
|
|
33
50
|
(targetKind === undefined && path.toLowerCase().endsWith(".hop")))
|
|
34
51
|
return ok({
|
|
35
52
|
path,
|
|
36
|
-
sourcePath: canonical,
|
|
53
|
+
sourcePath: process.platform === "win32" ? candidate : canonical,
|
|
37
54
|
sha256: await sha256Handle(handle),
|
|
38
55
|
kind: "database",
|
|
39
56
|
format: "analysis-database",
|
|
@@ -42,7 +59,7 @@ export const parseBinaryTarget = async (input, cwd = process.cwd(), hostArchitec
|
|
|
42
59
|
if (artifactFormat !== undefined) {
|
|
43
60
|
const identity = {
|
|
44
61
|
path,
|
|
45
|
-
sourcePath: canonical,
|
|
62
|
+
sourcePath: process.platform === "win32" ? candidate : canonical,
|
|
46
63
|
sha256: await sha256Handle(handle),
|
|
47
64
|
};
|
|
48
65
|
return isArchiveFormat(artifactFormat)
|
|
@@ -54,7 +71,7 @@ export const parseBinaryTarget = async (input, cwd = process.cwd(), hostArchitec
|
|
|
54
71
|
return err(new BinaryTargetError(path, detected.error));
|
|
55
72
|
return ok({
|
|
56
73
|
path,
|
|
57
|
-
sourcePath: canonical,
|
|
74
|
+
sourcePath: process.platform === "win32" ? candidate : canonical,
|
|
58
75
|
sha256: await sha256Handle(handle),
|
|
59
76
|
kind: "executable",
|
|
60
77
|
...detected.value,
|
|
@@ -144,7 +161,9 @@ const resolveAppBundle = async (path) => {
|
|
|
144
161
|
if (!metadata.isDirectory())
|
|
145
162
|
return ok(path);
|
|
146
163
|
if (extname(path).toLowerCase() !== ".app")
|
|
147
|
-
return err(new BinaryTargetError(path, "
|
|
164
|
+
return err(new BinaryTargetError(path, "this opening route requires a file or macOS app bundle", {
|
|
165
|
+
constraint: "directory_requires_file",
|
|
166
|
+
}));
|
|
148
167
|
const plistPath = join(path, "Contents", "Info.plist");
|
|
149
168
|
let name;
|
|
150
169
|
try {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AnalysisCapabilityUnavailableError
|
|
1
|
+
import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.js";
|
|
2
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
2
3
|
import { err, ok } from "../domain/result.js";
|
|
3
4
|
import { createBrowserEvidence } from "./BrowserEvidence.js";
|
|
4
5
|
/** List browser targets within the endpoint and origin scope in the request. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createBrowserScenarioEvidence } from "./BrowserScenarioEvidence.js";
|
|
2
|
-
import { AnalysisCapabilityUnavailableError
|
|
2
|
+
import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.js";
|
|
3
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
3
4
|
import { err } from "../domain/result.js";
|
|
4
5
|
const OPERATION = "capture_browser_scenario";
|
|
5
6
|
const PROVIDER_ID = "rea-playwright-browser-scenario";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { canonicalDigest } from "../domain/comparisonSemantics.js";
|
|
1
2
|
import { sanitizeBrowserUrl } from "../domain/browserObservation.js";
|
|
2
3
|
import { createEvidence, } from "../domain/evidence.js";
|
|
3
4
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
4
|
-
import { digestCanonicalJson } from "../domain/browserScenarioNormalization.js";
|
|
5
5
|
const browserScenarioParameters = (scenario) => ({
|
|
6
|
-
scenario_sha256:
|
|
6
|
+
scenario_sha256: canonicalDigest(scenario, "Browser scenario"),
|
|
7
7
|
browser_mode: scenario.browser.mode,
|
|
8
8
|
...(scenario.browser.mode === "launch"
|
|
9
9
|
? { browser_headless: scenario.browser.headless }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { projectAnalysisError } from "../domain/
|
|
1
|
+
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
|
2
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
2
3
|
import { parseRelatedAddresses } from "../domain/hopperValues.js";
|
|
3
4
|
import { ok } from "../domain/result.js";
|
|
4
5
|
/** Trace direct caller/callee relationships until the graph is exhausted or the goal is reached. */
|