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.
- 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
|
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { posix } from "node:path";
|
|
3
3
|
import * as t from "@babel/types";
|
|
4
4
|
import { semanticStaticPropertyName } from "./javascriptAstValues.js";
|
|
5
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
5
6
|
export { propertyName, semanticStaticPropertyName, } from "./javascriptAstValues.js";
|
|
6
7
|
/** Explicit result for source text that Babel cannot parse. */
|
|
7
8
|
export const failedJavaScriptStaticAnalysis = () => ({
|
|
@@ -130,7 +131,11 @@ const staticCallPath = (node) => {
|
|
|
130
131
|
if ((name === "dirname" || name.endsWith(".dirname")) &&
|
|
131
132
|
isFileIdentity(argumentNode(node.arguments[0])))
|
|
132
133
|
return "";
|
|
133
|
-
if (
|
|
134
|
+
if (name.endsWith(".resolve"))
|
|
135
|
+
return name === "win32.resolve" || name.endsWith(".win32.resolve")
|
|
136
|
+
? undefined
|
|
137
|
+
: staticResolvedPath(node);
|
|
138
|
+
if (!name.endsWith(".join") && name !== "join")
|
|
134
139
|
return undefined;
|
|
135
140
|
const parts = [];
|
|
136
141
|
for (const argument of node.arguments) {
|
|
@@ -143,6 +148,27 @@ const staticCallPath = (node) => {
|
|
|
143
148
|
}
|
|
144
149
|
return parts.length === 0 ? undefined : posix.join(...parts);
|
|
145
150
|
};
|
|
151
|
+
const staticResolvedPath = (node) => {
|
|
152
|
+
const parts = [];
|
|
153
|
+
for (const argument of node.arguments) {
|
|
154
|
+
if (isDirectoryIdentity(argumentNode(argument))) {
|
|
155
|
+
parts.push(null);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const value = t.isNode(argument) ? staticPathAt(argument) : undefined;
|
|
159
|
+
// Validate every argument, including those before the last anchor.
|
|
160
|
+
if (value === undefined)
|
|
161
|
+
return undefined;
|
|
162
|
+
parts.push(value);
|
|
163
|
+
}
|
|
164
|
+
const anchor = parts.findLastIndex((part) => part === null || posix.isAbsolute(part));
|
|
165
|
+
// Relative-only calls depend on the target process cwd, which is unknown.
|
|
166
|
+
if (anchor === -1)
|
|
167
|
+
return undefined;
|
|
168
|
+
// A null anchor is the source directory; preserve its relative projection.
|
|
169
|
+
const path = posix.join(...parts.slice(anchor).filter((part) => part !== null));
|
|
170
|
+
return path === "/" ? path : path.replace(/\/$/u, "");
|
|
171
|
+
};
|
|
146
172
|
const isFilesystemPathExpression = (node) => {
|
|
147
173
|
if (t.isStringLiteral(node))
|
|
148
174
|
return node.value.startsWith("/");
|
|
@@ -153,6 +179,8 @@ const isFilesystemPathExpression = (node) => {
|
|
|
153
179
|
isFilesystemPathExpression(node.right));
|
|
154
180
|
if (t.isCallExpression(node) || t.isNewExpression(node)) {
|
|
155
181
|
const name = calleeName(node.callee);
|
|
182
|
+
if (name.endsWith(".resolve") && staticCallPath(node) !== undefined)
|
|
183
|
+
return true;
|
|
156
184
|
if (name === "URL" || name.endsWith(".URL"))
|
|
157
185
|
return isFileIdentity(argumentNode(node.arguments[1]));
|
|
158
186
|
if (name === "fileURLToPath" || name.endsWith(".fileURLToPath"))
|
|
@@ -284,7 +312,8 @@ export const sourceRangesEqual = (left, right) => left !== null &&
|
|
|
284
312
|
left.end.column === right.end.column;
|
|
285
313
|
const pointForOffset = (source, offset) => {
|
|
286
314
|
const before = source.slice(0, offset);
|
|
287
|
-
|
|
315
|
+
// Match JavaScript line terminators, treating CRLF as a single newline.
|
|
316
|
+
const lines = before.split(/\r\n|[\n\r\u2028\u2029]/u);
|
|
288
317
|
return { line: lines.length, column: lines.at(-1)?.length ?? 0 };
|
|
289
318
|
};
|
|
290
319
|
/** Observe known bundler/framework marker strings without claiming dependency use. */
|
|
@@ -295,8 +324,6 @@ export const registrationKey = (registration) => `${registration.runtime}\0${reg
|
|
|
295
324
|
export const sortedUnique = (values, key) => [...new Map(values.map((value) => [key(value), value])).values()].sort((left, right) => compareCodePoints(key(left), key(right)));
|
|
296
325
|
/** Hash exact UTF-8 source text. */
|
|
297
326
|
export const sha256Text = (value) => createHash("sha256").update(value).digest("hex");
|
|
298
|
-
/** Compare strings by Unicode code point for canonical ordering. */
|
|
299
|
-
export const compareCodePoints = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
300
327
|
/** Recognized route-construction call suffixes. */
|
|
301
328
|
export const STATIC_ROUTE_CALL_NAMES = [
|
|
302
329
|
"route",
|
package/dist/domain/jsonShape.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
3
|
const jsonValueTypeSchema = z.enum([
|
|
3
4
|
"object",
|
|
4
5
|
"array",
|
|
@@ -24,7 +25,9 @@ export const inferJsonShape = (text) => {
|
|
|
24
25
|
try {
|
|
25
26
|
root = JSON.parse(text);
|
|
26
27
|
}
|
|
27
|
-
catch {
|
|
28
|
+
catch (cause) {
|
|
29
|
+
// Invalid JSON is represented by the null return.
|
|
30
|
+
void cause;
|
|
28
31
|
return null;
|
|
29
32
|
}
|
|
30
33
|
const properties = new Map();
|
|
@@ -76,7 +79,8 @@ export const inferJsonShape = (text) => {
|
|
|
76
79
|
types: [...value.types].sort(),
|
|
77
80
|
observations: value.observations,
|
|
78
81
|
}))
|
|
79
|
-
.sort((left, right) => left.path.localeCompare(right.path)
|
|
82
|
+
.sort((left, right) => left.path.localeCompare(right.path) ||
|
|
83
|
+
compareCodePoints(left.path, right.path)),
|
|
80
84
|
});
|
|
81
85
|
};
|
|
82
86
|
const jsonValueType = (value) => {
|
|
@@ -2,6 +2,8 @@ import canonicalize from "canonicalize";
|
|
|
2
2
|
import { sha256, } from "./managedMemberComparisonMatch.js";
|
|
3
3
|
const methodDimensions = (left, right) => {
|
|
4
4
|
const dimensions = [];
|
|
5
|
+
if (left.flags !== right.flags || left.impl_flags !== right.impl_flags)
|
|
6
|
+
dimensions.push("metadata");
|
|
5
7
|
if (left.signature.raw_sha256 !== right.signature.raw_sha256)
|
|
6
8
|
dimensions.push("signature");
|
|
7
9
|
const leftBodyComplete = left.body.status === "present" && left.body.truncated_instructions === 0;
|
|
@@ -65,8 +65,10 @@ export const collectNativeSymbols = (observations) => {
|
|
|
65
65
|
}
|
|
66
66
|
return { symbols, accepted, unsupported };
|
|
67
67
|
};
|
|
68
|
-
const
|
|
69
|
-
|
|
68
|
+
const sameSymbolName = (expected, native) => expected ===
|
|
69
|
+
(native.source === "macho-export" && native.name.startsWith("_")
|
|
70
|
+
? native.name.slice(1)
|
|
71
|
+
: native.name);
|
|
70
72
|
const normalizeModule = (value) => basename(value)
|
|
71
73
|
.toLowerCase()
|
|
72
74
|
.replace(/^lib/u, "")
|
|
@@ -96,7 +98,7 @@ const candidateNames = (managed) => {
|
|
|
96
98
|
};
|
|
97
99
|
const matchPinvoke = (managed, symbols, supportedNativeEvidence) => {
|
|
98
100
|
const names = candidateNames(managed);
|
|
99
|
-
const allCandidates = symbols.filter((symbol) => names.some((name) => sameSymbolName(name, symbol
|
|
101
|
+
const allCandidates = symbols.filter((symbol) => names.some((name) => sameSymbolName(name, symbol)));
|
|
100
102
|
const [first, ...remaining] = allCandidates;
|
|
101
103
|
if (first === undefined)
|
|
102
104
|
return {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { nativeMetadataRecoverySchema } from "./nativeMetadataRecovery.js";
|
|
2
3
|
/** Select a database type by exact category path or a defined typed data address. */
|
|
3
4
|
export const nativeDataTypeInputSchema = z
|
|
4
5
|
.strictObject({
|
|
@@ -48,4 +49,5 @@ export const nativeDataTypeSchema = z.strictObject({
|
|
|
48
49
|
total_fields: z.number().int().nonnegative(),
|
|
49
50
|
truncated: z.boolean(),
|
|
50
51
|
limitations: z.array(z.string()),
|
|
52
|
+
metadata_recovery: nativeMetadataRecoverySchema.optional(),
|
|
51
53
|
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { functionDossierSchema } from "./hopperValues.js";
|
|
3
|
+
/** One explicit function's analyst-authored metadata changes. */
|
|
4
|
+
export const nativeFunctionAnnotationsInputSchema = z
|
|
5
|
+
.strictObject({
|
|
6
|
+
procedure: z.string().min(1),
|
|
7
|
+
name: z.string().min(1).optional(),
|
|
8
|
+
comment: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("Regular entry comment; empty text clears it"),
|
|
12
|
+
inline_comment: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Inline entry comment; empty text clears it"),
|
|
16
|
+
})
|
|
17
|
+
.refine((value) => value.name !== undefined ||
|
|
18
|
+
value.comment !== undefined ||
|
|
19
|
+
value.inline_comment !== undefined, "Supply at least one annotation change");
|
|
20
|
+
/** Readback and refreshed analysis after one atomic metadata edit. */
|
|
21
|
+
export const nativeFunctionAnnotationsSchema = z
|
|
22
|
+
.strictObject({
|
|
23
|
+
annotations: z.strictObject({
|
|
24
|
+
address: z.string().min(1),
|
|
25
|
+
name: z.string().min(1),
|
|
26
|
+
comment: z.string().nullable(),
|
|
27
|
+
inline_comment: z.string().nullable(),
|
|
28
|
+
}),
|
|
29
|
+
dossier: functionDossierSchema,
|
|
30
|
+
effects: z.strictObject({
|
|
31
|
+
scope: z.literal("session-analysis-database"),
|
|
32
|
+
source_bytes_modified: z.literal(false),
|
|
33
|
+
persists_after_close: z.literal(false),
|
|
34
|
+
}),
|
|
35
|
+
})
|
|
36
|
+
.superRefine((value, context) => {
|
|
37
|
+
if (value.annotations.address !== value.dossier.procedure.address ||
|
|
38
|
+
value.annotations.name !== value.dossier.procedure.name)
|
|
39
|
+
context.addIssue({
|
|
40
|
+
code: "custom",
|
|
41
|
+
message: "Annotation readback disagrees with refreshed function identity",
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { nativeMetadataRecoverySummarySchema } from "./nativeMetadataRecovery.js";
|
|
3
|
+
import { jsonValueSchema } from "./jsonValue.js";
|
|
4
|
+
const integer = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
5
|
+
const digest = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
6
|
+
const hexBytes = z.string().regex(/^(?:[a-f0-9]{2})*$/u);
|
|
7
|
+
const address = z.string().min(1);
|
|
8
|
+
/** Measured provider image, without exporting the complete executable bytes. */
|
|
9
|
+
export const nativeLoadImageObservationSchema = z.strictObject({
|
|
10
|
+
metadata_recovery: z.array(nativeMetadataRecoverySummarySchema).optional(),
|
|
11
|
+
executable_format: z.string().min(1),
|
|
12
|
+
language_id: z.string().min(1),
|
|
13
|
+
compiler_spec_id: z.string().min(1),
|
|
14
|
+
image_base: address,
|
|
15
|
+
default_address_space: z.string().min(1),
|
|
16
|
+
source_files: z.array(z.strictObject({
|
|
17
|
+
name: z.string(),
|
|
18
|
+
size: integer,
|
|
19
|
+
original_sha256: digest,
|
|
20
|
+
modified_sha256: digest,
|
|
21
|
+
})),
|
|
22
|
+
mappings: z.array(z.strictObject({
|
|
23
|
+
block: z.string(),
|
|
24
|
+
start: address,
|
|
25
|
+
end: address,
|
|
26
|
+
address_space: z.string().min(1),
|
|
27
|
+
initialized: z.boolean(),
|
|
28
|
+
loaded: z.boolean(),
|
|
29
|
+
overlay: z.boolean(),
|
|
30
|
+
length: integer.min(1),
|
|
31
|
+
source_file_index: integer.nullable(),
|
|
32
|
+
file_offset: integer.nullable(),
|
|
33
|
+
sha256: digest.nullable(),
|
|
34
|
+
})),
|
|
35
|
+
relocations: z.array(z.strictObject({
|
|
36
|
+
address,
|
|
37
|
+
segment: integer.max(0xffff).nullable(),
|
|
38
|
+
offset: integer.max(0xffff).nullable(),
|
|
39
|
+
status: z.string().min(1),
|
|
40
|
+
type: z.number().int(),
|
|
41
|
+
values: z.array(z
|
|
42
|
+
.number()
|
|
43
|
+
.int()
|
|
44
|
+
.min(Number.MIN_SAFE_INTEGER)
|
|
45
|
+
.max(Number.MAX_SAFE_INTEGER)),
|
|
46
|
+
original_bytes_hex: hexBytes.nullable(),
|
|
47
|
+
memory_bytes_hex: hexBytes.nullable(),
|
|
48
|
+
})),
|
|
49
|
+
entry_points: z.array(address),
|
|
50
|
+
entry_context: z.array(z.strictObject({
|
|
51
|
+
address,
|
|
52
|
+
registers: z.array(z.strictObject({
|
|
53
|
+
name: z.string().min(1),
|
|
54
|
+
value_hex: z
|
|
55
|
+
.string()
|
|
56
|
+
.regex(/^0x[a-f0-9]+$/u)
|
|
57
|
+
.nullable(),
|
|
58
|
+
})),
|
|
59
|
+
})),
|
|
60
|
+
});
|
|
61
|
+
/** Independent comparison, preserving both expectations and measured values. */
|
|
62
|
+
export const nativeLoadImageCheckSchema = z.strictObject({
|
|
63
|
+
name: z.string().min(1),
|
|
64
|
+
matched: z.boolean(),
|
|
65
|
+
expected: jsonValueSchema,
|
|
66
|
+
observed: jsonValueSchema,
|
|
67
|
+
file_offset: integer.nullable(),
|
|
68
|
+
address: address.nullable(),
|
|
69
|
+
});
|
|
70
|
+
/** Read-only native image verification; verified applies only to declared coverage. */
|
|
71
|
+
export const nativeLoadImageSchema = z.discriminatedUnion("status", [
|
|
72
|
+
z.strictObject({
|
|
73
|
+
status: z.literal("unsupported"),
|
|
74
|
+
reason: z.string().min(1),
|
|
75
|
+
observations: nativeLoadImageObservationSchema,
|
|
76
|
+
limitations: z.array(z.string().min(1)),
|
|
77
|
+
}),
|
|
78
|
+
z.strictObject({
|
|
79
|
+
status: z.enum(["verified", "mismatch"]),
|
|
80
|
+
format: z.enum(["dos-mz", "dos-com"]),
|
|
81
|
+
target_sha256: digest,
|
|
82
|
+
load_segment: integer.max(0xffff),
|
|
83
|
+
header_bytes: integer,
|
|
84
|
+
module_bytes: integer,
|
|
85
|
+
overlay_bytes: integer,
|
|
86
|
+
entry: z.strictObject({
|
|
87
|
+
relative_segment: integer.max(0xffff),
|
|
88
|
+
offset: integer.max(0xffff),
|
|
89
|
+
linear_address: address,
|
|
90
|
+
}),
|
|
91
|
+
observations: nativeLoadImageObservationSchema,
|
|
92
|
+
checks: z.array(nativeLoadImageCheckSchema),
|
|
93
|
+
limitations: z.array(z.string().min(1)),
|
|
94
|
+
}),
|
|
95
|
+
]);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const address = z.string().regex(/^0x[0-9a-f]+$/u);
|
|
3
|
+
const relatedType = z.strictObject({ address, type: z.string().nullable() });
|
|
4
|
+
/** Runtime-format metadata recovered in an analysis image, with explicit inference boundaries. */
|
|
5
|
+
export const nativeMetadataRecoverySchema = z.strictObject({
|
|
6
|
+
format: z.literal("dotnet-nativeaot"),
|
|
7
|
+
status: z.enum(["complete", "partial"]),
|
|
8
|
+
header_address: address,
|
|
9
|
+
format_major: z.number().int().nonnegative(),
|
|
10
|
+
format_minor: z.number().int().nonnegative(),
|
|
11
|
+
method_table_address: address,
|
|
12
|
+
name_origin: z.enum(["generated", "inferred"]),
|
|
13
|
+
original_name: z.null(),
|
|
14
|
+
base_size_bytes: z.number().int().nonnegative(),
|
|
15
|
+
related_type: relatedType.nullable(),
|
|
16
|
+
interfaces: z.array(relatedType),
|
|
17
|
+
virtual_slots: z.array(z.strictObject({
|
|
18
|
+
slot: z.number().int().nonnegative(),
|
|
19
|
+
slot_address: address,
|
|
20
|
+
target_address: address.nullable(),
|
|
21
|
+
procedure_name: z.string().nullable(),
|
|
22
|
+
basis: z.literal("method-table-pointer"),
|
|
23
|
+
})),
|
|
24
|
+
derived_memory: z.strictObject({
|
|
25
|
+
address,
|
|
26
|
+
size_bytes: z.number().int().nonnegative(),
|
|
27
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
28
|
+
file_offset: z.null(),
|
|
29
|
+
}),
|
|
30
|
+
diagnostics: z.array(z.string()),
|
|
31
|
+
limitations: z.array(z.string()),
|
|
32
|
+
});
|
|
33
|
+
/** Discover a recovered runtime format and reusable type identities from the loaded image. */
|
|
34
|
+
export const nativeMetadataRecoverySummarySchema = z.strictObject({
|
|
35
|
+
format: z.literal("dotnet-nativeaot"),
|
|
36
|
+
status: z.enum(["complete", "partial", "not_applicable"]),
|
|
37
|
+
reason: z.string().nullable(),
|
|
38
|
+
analysis_artifact_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
39
|
+
header_address: address.nullable(),
|
|
40
|
+
discovery: z.enum(["symbol", "signature-heuristic"]).nullable(),
|
|
41
|
+
format_major: z.number().int().nonnegative().nullable(),
|
|
42
|
+
format_minor: z.number().int().nonnegative().nullable(),
|
|
43
|
+
method_tables: z.number().int().nonnegative(),
|
|
44
|
+
types: z.array(relatedType),
|
|
45
|
+
derived_memory: nativeMetadataRecoverySchema.shape.derived_memory.nullable(),
|
|
46
|
+
coverage: z
|
|
47
|
+
.strictObject({
|
|
48
|
+
frozen_object_candidates: z.number().int().nonnegative(),
|
|
49
|
+
frozen_objects_annotated: z.number().int().nonnegative(),
|
|
50
|
+
basis: z.literal("rehydrated-pointer-candidates-and-committed-instance-types"),
|
|
51
|
+
})
|
|
52
|
+
.nullable(),
|
|
53
|
+
diagnostics: z.array(z.string()),
|
|
54
|
+
limitations: z.array(z.string()),
|
|
55
|
+
});
|
|
@@ -175,4 +175,3 @@ export const processCaptureSchema = processCaptureShapeSchema.superRefine((captu
|
|
|
175
175
|
});
|
|
176
176
|
export { parseProcessCapture } from "./processCaptureParsing.js";
|
|
177
177
|
export { compareProcessCaptures, comparisonStatusSchema, deriveProcessComparisonStatus, PROCESS_COMPARISON_DIMENSIONS, processCaptureComparisonSchema, } from "./processComparison.js";
|
|
178
|
-
export { compareProcessTraces, processTraceComparisonResultSchema, processTraceSourceSchema, processTraceSpecificationSchema, } from "./processTraceComparison.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Canonical provider identity for controlled process capture Evidence. */
|
|
2
|
+
export const PROCESS_PROVIDER = {
|
|
3
|
+
id: "rea-process",
|
|
4
|
+
name: "REA process capture",
|
|
5
|
+
version: "3",
|
|
6
|
+
};
|
|
7
|
+
/** Admit current and previously emitted names for the same v3 process provider. */
|
|
8
|
+
export const isProcessEvidenceProvider = (provider) => provider.id === PROCESS_PROVIDER.id &&
|
|
9
|
+
provider.version === PROCESS_PROVIDER.version &&
|
|
10
|
+
(provider.name === PROCESS_PROVIDER.name ||
|
|
11
|
+
provider.name === "REA deterministic process harness");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { evaluateProcessTraceSide, processTraceComparisonResultSchema, } from "./processTraceEvaluation.js";
|
|
2
2
|
import { processTraceSpecificationSchema, } from "./processTraceSpecification.js";
|
|
3
3
|
export { processTraceComparisonResultSchema, } from "./processTraceEvaluation.js";
|
|
4
|
-
export {
|
|
4
|
+
export { processTraceSpecificationSchema, } from "./processTraceSpecification.js";
|
|
5
5
|
/** Compare two captures against an explicit finite trace language. */
|
|
6
6
|
export const compareProcessTraces = (left, right, specificationInput) => {
|
|
7
7
|
const specification = processTraceSpecificationSchema.parse(specificationInput);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnalysisError } from "./analysisErrorBase.js";
|
|
2
|
+
/** A provider adapter failed outside its more precise typed variants. */
|
|
3
|
+
export class ProviderAdapterError extends AnalysisError {
|
|
4
|
+
providerId;
|
|
5
|
+
operation;
|
|
6
|
+
_tag = "ProviderAdapterError";
|
|
7
|
+
diagnostics;
|
|
8
|
+
constructor(providerId, operation, options = {}) {
|
|
9
|
+
super(`Provider ${providerId} adapter failed during ${operation}`, options);
|
|
10
|
+
this.providerId = providerId;
|
|
11
|
+
this.operation = operation;
|
|
12
|
+
this.diagnostics =
|
|
13
|
+
options.diagnostics === undefined
|
|
14
|
+
? undefined
|
|
15
|
+
: structuredClone(options.diagnostics);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderAdapterError } from "./
|
|
1
|
+
import { ProviderAdapterError } from "./providerAdapterError.js";
|
|
2
2
|
/** Provider resources could not be proven closed after bounded cleanup. */
|
|
3
3
|
export class ProviderCleanupError extends ProviderAdapterError {
|
|
4
4
|
cleanupIncomplete = true;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AnalysisError } from "./analysisErrorBase.js";
|
|
2
|
+
/** No configured provider can satisfy a requested operation or target binding. */
|
|
3
|
+
export class ProviderSelectionError extends AnalysisError {
|
|
4
|
+
_tag = "ProviderSelectionError";
|
|
5
|
+
operation;
|
|
6
|
+
reason;
|
|
7
|
+
requestedProviderId;
|
|
8
|
+
candidateIds;
|
|
9
|
+
rejections;
|
|
10
|
+
userMessage;
|
|
11
|
+
constructor(options) {
|
|
12
|
+
const operation = options.operation ?? "open_binary";
|
|
13
|
+
super(providerSelectionDiagnostic(options));
|
|
14
|
+
this.operation = operation;
|
|
15
|
+
this.reason = options.reason;
|
|
16
|
+
this.requestedProviderId = options.requestedProviderId;
|
|
17
|
+
this.candidateIds = [...options.candidateIds];
|
|
18
|
+
this.rejections = [...(options.rejections ?? [])].map((rejection) => ({
|
|
19
|
+
...rejection,
|
|
20
|
+
diagnostics: structuredClone(rejection.diagnostics),
|
|
21
|
+
}));
|
|
22
|
+
this.userMessage = providerSelectionUserMessage(options);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const providerSelectionDiagnostic = (options) => {
|
|
26
|
+
const candidates = options.candidateIds.length === 0
|
|
27
|
+
? "none"
|
|
28
|
+
: options.candidateIds.join(", ");
|
|
29
|
+
return `Analysis provider selection failed (${options.reason}) for ${options.requestedProviderId}; candidates: ${candidates}`;
|
|
30
|
+
};
|
|
31
|
+
const providerSelectionUserMessage = (options) => {
|
|
32
|
+
switch (options.reason) {
|
|
33
|
+
case "ambiguous":
|
|
34
|
+
return "Multiple analysis providers support this target. Choose one with provider_id, --provider, or REA_ANALYSIS_PROVIDER.";
|
|
35
|
+
case "unknown_provider":
|
|
36
|
+
return `The requested analysis provider is unknown. Choose one of: ${options.candidateIds.join(", ") || "no configured providers"}.`;
|
|
37
|
+
case "provider_unavailable":
|
|
38
|
+
return "The selected analysis provider is unavailable. Review the reported local diagnostics or run `rea doctor`, then retry.";
|
|
39
|
+
case "target_unsupported":
|
|
40
|
+
return "The selected analysis provider does not support this target. Choose another provider or open a supported extracted binary.";
|
|
41
|
+
case "invalid_options":
|
|
42
|
+
return "The analysis provider selection or open options are invalid. Correct them and try again.";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { uniqueSorted } from "./canonicalOrdering.js";
|
|
1
2
|
/** Select the latest revision of each residual unknown. */
|
|
2
3
|
export const reconstructionUnknownHeads = (revisions) => {
|
|
3
4
|
const heads = new Map();
|
|
@@ -87,4 +88,3 @@ const defaultProbe = (kind) => kind === "behavioral"
|
|
|
87
88
|
operation: "inspect_artifact",
|
|
88
89
|
rationale: "Capture complete artifact inventories under equal limits.",
|
|
89
90
|
};
|
|
90
|
-
const uniqueSorted = (values) => [...new Set(values)].sort((left, right) => left.localeCompare(right, "en"));
|
|
@@ -3,9 +3,11 @@ import canonicalize from "canonicalize";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { artifactComparisonResultSchema } from "./artifactComparison.js";
|
|
5
5
|
import { artifactInventoryResultSchema } from "./artifactGraph.js";
|
|
6
|
+
import { uniqueSorted } from "./canonicalOrdering.js";
|
|
6
7
|
import { parseEvidence } from "./evidence.js";
|
|
7
8
|
import { parseEvidenceBundle } from "./evidenceBundle.js";
|
|
8
9
|
import { functionComparisonResultSchema } from "./functionComparison.js";
|
|
10
|
+
import { PROCESS_PROVIDER, isProcessEvidenceProvider, } from "./processEvidenceProvider.js";
|
|
9
11
|
import { functionDossierSchema } from "./hopperValues.js";
|
|
10
12
|
import { deriveProcessComparisonStatus, PROCESS_COMPARISON_DIMENSIONS, processCaptureComparisonSchema, processCaptureSchema, } from "./processCapture.js";
|
|
11
13
|
import { reconstructionClaimResultSchema, reconstructionSpecificationSchema, reconstructionVerificationResultSchema, } from "./reconstructionVerificationSchemas.js";
|
|
@@ -17,8 +19,7 @@ const providers = {
|
|
|
17
19
|
behavioral: {
|
|
18
20
|
operation: "compare_process_captures",
|
|
19
21
|
predicates: ["rea.process-comparison"],
|
|
20
|
-
|
|
21
|
-
name: "REA deterministic process harness",
|
|
22
|
+
...PROCESS_PROVIDER,
|
|
22
23
|
},
|
|
23
24
|
"structural-function": {
|
|
24
25
|
operation: "compare_functions",
|
|
@@ -136,9 +137,11 @@ const validateComparisonIdentity = (claim, evidence) => {
|
|
|
136
137
|
const expected = providers[claim.kind];
|
|
137
138
|
if (evidence.operation !== expected.operation ||
|
|
138
139
|
!acceptsPredicate(expected.predicates, evidence.predicate_type) ||
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
(claim.kind === "behavioral"
|
|
141
|
+
? !isProcessEvidenceProvider(evidence.provider)
|
|
142
|
+
: evidence.provider.id !== expected.id ||
|
|
143
|
+
evidence.provider.name !== expected.name ||
|
|
144
|
+
evidence.provider.version !== "1") ||
|
|
142
145
|
evidence.confidence !== "derived" ||
|
|
143
146
|
evidence.authority !== "analyst-inference" ||
|
|
144
147
|
evidence.subject !== null)
|
|
@@ -146,7 +149,10 @@ const validateComparisonIdentity = (claim, evidence) => {
|
|
|
146
149
|
};
|
|
147
150
|
const sourceSides = (claim, evidence) => {
|
|
148
151
|
const parameters = evidence.parameters;
|
|
149
|
-
|
|
152
|
+
let singularSides;
|
|
153
|
+
if (claim.kind === "behavioral" ||
|
|
154
|
+
(claim.kind === "structural-function" &&
|
|
155
|
+
("left_evidence_id" in parameters || "right_evidence_id" in parameters))) {
|
|
150
156
|
const parsed = z
|
|
151
157
|
.object({
|
|
152
158
|
left_evidence_id: evidenceIdSchema,
|
|
@@ -154,10 +160,13 @@ const sourceSides = (claim, evidence) => {
|
|
|
154
160
|
})
|
|
155
161
|
.passthrough()
|
|
156
162
|
.parse(parameters);
|
|
157
|
-
|
|
163
|
+
singularSides = {
|
|
158
164
|
left: [parsed.left_evidence_id],
|
|
159
165
|
right: [parsed.right_evidence_id],
|
|
160
166
|
};
|
|
167
|
+
if (claim.kind === "behavioral" ||
|
|
168
|
+
!("left_evidence_ids" in parameters || "right_evidence_ids" in parameters))
|
|
169
|
+
return singularSides;
|
|
161
170
|
}
|
|
162
171
|
const parsed = z
|
|
163
172
|
.object({
|
|
@@ -166,6 +175,12 @@ const sourceSides = (claim, evidence) => {
|
|
|
166
175
|
})
|
|
167
176
|
.passthrough()
|
|
168
177
|
.parse(parameters);
|
|
178
|
+
if (singularSides !== undefined &&
|
|
179
|
+
(parsed.left_evidence_ids.length !== 1 ||
|
|
180
|
+
parsed.right_evidence_ids.length !== 1 ||
|
|
181
|
+
parsed.left_evidence_ids[0] !== singularSides.left[0] ||
|
|
182
|
+
parsed.right_evidence_ids[0] !== singularSides.right[0]))
|
|
183
|
+
throw new TypeError("Function comparison source Evidence aliases disagree");
|
|
169
184
|
return { left: parsed.left_evidence_ids, right: parsed.right_evidence_ids };
|
|
170
185
|
};
|
|
171
186
|
const observedStatus = (claim, evidence) => {
|
|
@@ -237,4 +252,3 @@ const digest = (value) => {
|
|
|
237
252
|
const count = (items, status) => items.filter((item) => item.status === status).length;
|
|
238
253
|
const sameSet = (left, right) => left.length === right.length &&
|
|
239
254
|
uniqueSorted(left).every((id, index) => id === uniqueSorted(right)[index]);
|
|
240
|
-
const uniqueSorted = (values) => [...new Set(values)].sort((left, right) => left.localeCompare(right, "en"));
|
|
@@ -101,7 +101,7 @@ const MANIFEST_FILENAMES = new Set([
|
|
|
101
101
|
"pipfile.lock",
|
|
102
102
|
"setup.cfg",
|
|
103
103
|
"manifest.in",
|
|
104
|
-
"
|
|
104
|
+
"cmakelists.txt",
|
|
105
105
|
"meson.build",
|
|
106
106
|
"configure",
|
|
107
107
|
"configure.ac",
|
|
@@ -272,7 +272,8 @@ const filenameIsTest = (filename) => {
|
|
|
272
272
|
return true;
|
|
273
273
|
if (lower.endsWith("_test") || lower.endsWith("_spec"))
|
|
274
274
|
return true;
|
|
275
|
-
|
|
275
|
+
const stem = basenameParts(lower).base;
|
|
276
|
+
return stem.endsWith("_test") || stem.endsWith("_spec");
|
|
276
277
|
};
|
|
277
278
|
const filenameIsGenerated = (filename) => {
|
|
278
279
|
const lower = filename.toLowerCase();
|
|
@@ -312,11 +313,9 @@ const isPathUnderAny = (path, names) => {
|
|
|
312
313
|
/** Detect a source language from a POSIX path. */
|
|
313
314
|
export const detectReferenceSourceLanguage = (path) => {
|
|
314
315
|
const filename = posix.basename(path);
|
|
315
|
-
if (filename === "Dockerfile" || filename.startsWith("Dockerfile."))
|
|
316
|
-
return "Dockerfile";
|
|
317
|
-
if (filename.toLowerCase().startsWith("dockerfile"))
|
|
318
|
-
return "Dockerfile";
|
|
319
316
|
const lower = filename.toLowerCase();
|
|
317
|
+
if (lower === "dockerfile" || lower.startsWith("dockerfile."))
|
|
318
|
+
return "Dockerfile";
|
|
320
319
|
if (lower.endsWith(".d.ts"))
|
|
321
320
|
return "TypeScript";
|
|
322
321
|
if (lower.endsWith(".d.mts"))
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { posix } from "node:path";
|
|
3
|
-
import canonicalize from "canonicalize";
|
|
4
2
|
import { z } from "zod";
|
|
3
|
+
import { canonicalDigest, canonicalJson } from "./comparisonSemantics.js";
|
|
5
4
|
import { compareUnicodeCodePoints } from "./unicodeCodePointOrder.js";
|
|
6
5
|
import { digestSchema } from "./../domain/digests.js";
|
|
7
6
|
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
@@ -184,13 +183,6 @@ const historicalSourceManifestBaseSchema = z.strictObject({
|
|
|
184
183
|
});
|
|
185
184
|
/** Stable identity used to sort and deduplicate source parse failures. */
|
|
186
185
|
export const historicalSourceParseFailureKey = (failure) => `${failure.path}\u0000${failure.parser}\u0000${failure.reason}`;
|
|
187
|
-
const canonicalJson = (value) => {
|
|
188
|
-
const serialized = canonicalize(value);
|
|
189
|
-
if (serialized === undefined)
|
|
190
|
-
throw new TypeError("RFC 8785 canonicalization rejected a graph value");
|
|
191
|
-
return serialized;
|
|
192
|
-
};
|
|
193
|
-
const digestCanonical = (value) => createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
194
186
|
const relationshipKey = (relationship) => `${relationship.from_path}\u0000${relationship.to}\u0000${relationship.kind}\u0000${relationship.resolution}\u0000${relationship.parse_state}`;
|
|
195
187
|
const checkSortedUnique = (values, field, context) => {
|
|
196
188
|
for (let index = 1; index < values.length; index += 1)
|
|
@@ -293,15 +285,15 @@ function checkGraphInvariants(graph, context) {
|
|
|
293
285
|
checkSortedUnique(graph.relationships.map(relationshipKey), "relationships", context);
|
|
294
286
|
checkSortedUnique(graph.parse_failures.map(historicalSourceParseFailureKey), "parse_failures", context);
|
|
295
287
|
checkSortedUnique(graph.exclusions.map(({ path, reason }) => `${path}\u0000${reason}`), "exclusions", context);
|
|
296
|
-
if (canonicalJson(graph.languages) !==
|
|
297
|
-
canonicalJson(historicalSourceLanguages(graph.entries)))
|
|
288
|
+
if (canonicalJson(graph.languages, "Reference source graph") !==
|
|
289
|
+
canonicalJson(historicalSourceLanguages(graph.entries), "Reference source graph"))
|
|
298
290
|
context.addIssue({
|
|
299
291
|
code: "custom",
|
|
300
292
|
message: "languages must be derived from file entries",
|
|
301
293
|
path: ["languages"],
|
|
302
294
|
});
|
|
303
|
-
if (canonicalJson(graph.manifests) !==
|
|
304
|
-
canonicalJson(historicalSourceManifests(graph.entries)))
|
|
295
|
+
if (canonicalJson(graph.manifests, "Reference source graph") !==
|
|
296
|
+
canonicalJson(historicalSourceManifests(graph.entries), "Reference source graph"))
|
|
305
297
|
context.addIssue({
|
|
306
298
|
code: "custom",
|
|
307
299
|
message: "manifests must be derived from classified file entries",
|
|
@@ -340,7 +332,7 @@ const rootCommitment = (entries, exclusions) => ({
|
|
|
340
332
|
}),
|
|
341
333
|
exclusions,
|
|
342
334
|
});
|
|
343
|
-
const computeRootSha256 = (entries, exclusions) =>
|
|
335
|
+
const computeRootSha256 = (entries, exclusions) => canonicalDigest(rootCommitment(entries, exclusions), "Reference source graph");
|
|
344
336
|
/** Build and internally commit a normalized historical source graph. */
|
|
345
337
|
export const createHistoricalSourceGraph = (input) => {
|
|
346
338
|
const parsed = historicalSourceGraphInputSchema.parse(input);
|
|
@@ -352,7 +344,7 @@ export const createHistoricalSourceGraph = (input) => {
|
|
|
352
344
|
/** Parse a graph and reject stale or caller-invented root commitments. */
|
|
353
345
|
export const parseHistoricalSourceGraph = (input) => historicalSourceGraphSchema.parse(input);
|
|
354
346
|
/** Compute a deterministic graph commitment containing no absolute root path. */
|
|
355
|
-
export const computeHistoricalSourceGraphSha256 = (input) =>
|
|
347
|
+
export const computeHistoricalSourceGraphSha256 = (input) => canonicalDigest(parseHistoricalSourceGraph(input), "Reference source graph");
|
|
356
348
|
/** Build a deterministic, relocation-independent manifest for a source graph. */
|
|
357
349
|
export const createHistoricalSourceManifest = (input) => {
|
|
358
350
|
const graph = parseHistoricalSourceGraph(input);
|
|
@@ -367,14 +359,14 @@ export const createHistoricalSourceManifest = (input) => {
|
|
|
367
359
|
};
|
|
368
360
|
return historicalSourceManifestBaseSchema.parse({
|
|
369
361
|
...semantic,
|
|
370
|
-
manifest_id: `hsm_${
|
|
362
|
+
manifest_id: `hsm_${canonicalDigest(semantic, "Reference source graph")}`,
|
|
371
363
|
});
|
|
372
364
|
};
|
|
373
365
|
/** Parse and verify a historical source manifest's semantic identifier. */
|
|
374
366
|
export const parseHistoricalSourceManifest = (input) => {
|
|
375
367
|
const manifest = historicalSourceManifestBaseSchema.parse(input);
|
|
376
368
|
const { manifest_id: manifestId, ...semantic } = manifest;
|
|
377
|
-
if (`hsm_${
|
|
369
|
+
if (`hsm_${canonicalDigest(semantic, "Reference source graph")}` !== manifestId)
|
|
378
370
|
throw new TypeError("Historical source manifest identifier does not match");
|
|
379
371
|
return manifest;
|
|
380
372
|
};
|