rea-agents 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -86
- package/bridge/android/ReaJadxBridge.java +247 -0
- package/bridge/native/NativeUIChildren.swift +27 -0
- package/bridge/native/ReaNativeUI.swift +30 -16
- package/dist/android/AndroidTargetSnapshot.js +5 -3
- package/dist/android/JadxAnalysis.js +8 -6
- package/dist/android/JadxConfiguration.js +19 -3
- package/dist/android/JadxMcpTransport.js +43 -16
- package/dist/android/JadxProtocol.js +8 -0
- package/dist/android/JadxProvider.js +117 -28
- package/dist/android/JadxRelease.js +8 -0
- package/dist/android/JadxSession.js +32 -18
- package/dist/application/AppBundleExecutable.js +141 -0
- package/dist/application/ArtifactInventory/classify.js +1 -1
- package/dist/application/ArtifactInventory/scanCanonical.js +1 -1
- package/dist/application/ArtifactInventory/scanReader.js +1 -1
- package/dist/application/ArtifactInventory.js +1 -1
- package/dist/application/BinaryTargetResolver.js +9 -64
- package/dist/application/CapabilityInventory.js +61 -3
- package/dist/application/ClientConfigurationDocument.js +72 -12
- package/dist/application/ClientRegistrationStatus.js +7 -8
- package/dist/application/DirectAnalysis.js +12 -14
- package/dist/application/DirectAnalysisStatus.js +4 -5
- package/dist/application/DoctorDiagnostics.js +3 -3
- package/dist/application/EnhancedTools.js +4 -4
- package/dist/application/EvidenceBundleCommands.js +1 -1
- package/dist/application/FilesystemSnapshot.js +20 -5
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/LinuxHopper.js +8 -2
- package/dist/application/OptionalObservationProviders.js +3 -0
- package/dist/application/ProcessCaptureCapability.js +1 -1
- package/dist/application/ProcessCaptureLifecycle.js +2 -2
- package/dist/application/ProcessCli.js +5 -1
- package/dist/application/ProcessHarness.js +20 -9
- package/dist/application/ReconstructionCoverageService.js +2 -6
- package/dist/application/ReconstructionObligationCandidates.js +5 -2
- package/dist/application/ReferenceSourceImport.js +2 -0
- package/dist/application/ReferenceSourceImportEntries.js +20 -3
- package/dist/application/ReferenceSourceImportTypes.js +5 -0
- package/dist/application/Setup.js +10 -2
- package/dist/application/SetupClientConfiguration.js +19 -16
- package/dist/application/SetupHost.js +18 -3
- package/dist/application/SetupPlan.js +1 -1
- package/dist/application/Uninstall.js +23 -17
- package/dist/application/UpdateMaintenance.js +3 -3
- package/dist/application/ValidateSelectedWebScript.js +27 -0
- package/dist/application/WebModuleTraceService.js +209 -0
- package/dist/application/WebRuntimeService.js +73 -0
- package/dist/application/WebScriptExportService.js +115 -0
- package/dist/application/WebSourceLocationService.js +160 -0
- package/dist/application/{AndroidAnalysisService.js → android/AndroidAnalysisService.js} +6 -6
- package/dist/application/{AndroidApplicationService.js → android/AndroidApplicationService.js} +3 -3
- package/dist/application/{AppleApplicationService.js → apple/AppleApplicationService.js} +5 -5
- package/dist/application/{AnalysisClientCleanup.js → binary/AnalysisClientCleanup.js} +2 -2
- package/dist/application/{AnalysisProviderEvaluation.js → binary/AnalysisProviderEvaluation.js} +4 -4
- package/dist/application/{AnalysisProviderRegistry.js → binary/AnalysisProviderRegistry.js} +5 -5
- package/dist/application/{AnalysisSnapshotCache.js → binary/AnalysisSnapshotCache.js} +7 -9
- package/dist/application/{AnalysisSnapshotFiles.js → binary/AnalysisSnapshotFiles.js} +4 -4
- package/dist/application/{BinarySession.js → binary/BinarySession.js} +12 -10
- package/dist/application/{BinarySessionComposition.js → binary/BinarySessionComposition.js} +2 -1
- package/dist/application/{BinarySessionExecution.js → binary/BinarySessionExecution.js} +9 -7
- package/dist/application/{BinarySessionOpen.js → binary/BinarySessionOpen.js} +6 -6
- package/dist/application/{BinarySessionRecords.js → binary/BinarySessionRecords.js} +28 -40
- package/dist/application/{CompositeProvider.js → binary/CompositeProvider.js} +2 -2
- package/dist/application/{LazyAnalysisProvider.js → binary/LazyAnalysisProvider.js} +6 -6
- package/dist/application/{SessionProviderRouter.js → binary/SessionProviderRouter.js} +7 -7
- package/dist/application/{FirmwareAnalysisService.js → firmware/FirmwareAnalysisService.js} +5 -5
- package/dist/application/{EvidenceLedger.js → investigation/EvidenceLedger.js} +44 -7
- package/dist/application/investigation/InvestigationRecords.js +69 -0
- package/dist/application/{UnknownEvidence.js → investigation/UnknownEvidence.js} +1 -1
- package/dist/application/{ElectronActiveEvidence.js → javascript/ElectronActiveEvidence.js} +3 -3
- package/dist/application/javascript/ElectronActiveObservationPort.js +1 -0
- package/dist/application/{ElectronActiveObservationService.js → javascript/ElectronActiveObservationService.js} +3 -3
- package/dist/application/{ElectronBoundaryAnalysis.js → javascript/ElectronBoundaryAnalysis.js} +1 -1
- package/dist/application/{ElectronBoundaryGraphContext.js → javascript/ElectronBoundaryGraphContext.js} +1 -1
- package/dist/application/{ElectronEvidence.js → javascript/ElectronEvidence.js} +2 -2
- package/dist/application/javascript/ElectronObservationPort.js +1 -0
- package/dist/application/{ElectronObservationService.js → javascript/ElectronObservationService.js} +3 -3
- package/dist/application/{JavaScriptApplicationEvidence.js → javascript/JavaScriptApplicationEvidence.js} +3 -3
- package/dist/application/{JavaScriptApplicationEvidenceGraph.js → javascript/JavaScriptApplicationEvidenceGraph.js} +5 -5
- package/dist/application/{JavaScriptApplicationService.js → javascript/JavaScriptApplicationService.js} +10 -10
- package/dist/application/{JavaScriptApplicationWorkflowEvidence.js → javascript/JavaScriptApplicationWorkflowEvidence.js} +3 -3
- package/dist/application/{JavaScriptApplicationWorkflowService.js → javascript/JavaScriptApplicationWorkflowService.js} +12 -12
- package/dist/application/{JavaScriptArtifactAnalysis.js → javascript/JavaScriptArtifactAnalysis.js} +8 -24
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +1 -0
- package/dist/application/{JavaScriptArtifactGraphAccumulator.js → javascript/JavaScriptArtifactGraphAccumulator.js} +16 -2
- package/dist/application/{JavaScriptArtifactGraphBuilder.js → javascript/JavaScriptArtifactGraphBuilder.js} +2 -2
- package/dist/application/{JavaScriptArtifactGraphContext.js → javascript/JavaScriptArtifactGraphContext.js} +1 -1
- package/dist/application/{JavaScriptArtifactGraphDocuments.js → javascript/JavaScriptArtifactGraphDocuments.js} +1 -1
- package/dist/application/{JavaScriptArtifactGraphFindings.js → javascript/JavaScriptArtifactGraphFindings.js} +20 -7
- package/dist/application/{JavaScriptArtifactGraphStructure.js → javascript/JavaScriptArtifactGraphStructure.js} +1 -1
- package/dist/application/{JavaScriptArtifactPathResolution.js → javascript/JavaScriptArtifactPathResolution.js} +6 -12
- package/dist/application/{JavaScriptArtifactReconstruction.js → javascript/JavaScriptArtifactReconstruction.js} +4 -8
- package/dist/application/{JavaScriptJsonModules.js → javascript/JavaScriptJsonModules.js} +1 -1
- package/dist/application/{JavaScriptModuleRelationships.js → javascript/JavaScriptModuleRelationships.js} +2 -2
- package/dist/application/javascript/JavaScriptRecoveryPort.js +1 -0
- package/dist/application/javascript/JavaScriptRecoveryService.js +52 -0
- package/dist/application/{JavaScriptReturnShapeProjection.js → javascript/JavaScriptReturnShapeProjection.js} +3 -3
- package/dist/application/{JavaScriptRuntimeObservationEvidence.js → javascript/JavaScriptRuntimeObservationEvidence.js} +2 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationPort.js +1 -0
- package/dist/application/{JavaScriptRuntimeObservationService.js → javascript/JavaScriptRuntimeObservationService.js} +3 -3
- package/dist/application/{JavaScriptRuntimeReconciliationEvidence.js → javascript/JavaScriptRuntimeReconciliationEvidence.js} +3 -3
- package/dist/application/{JavaScriptRuntimeReconciliationService.js → javascript/JavaScriptRuntimeReconciliationService.js} +6 -6
- package/dist/application/{JavaScriptSemanticGraphAsyncProjection.js → javascript/JavaScriptSemanticGraphAsyncProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphBuilder.js → javascript/JavaScriptSemanticGraphBuilder.js} +5 -3
- package/dist/application/{JavaScriptSemanticGraphChildProcessProjection.js → javascript/JavaScriptSemanticGraphChildProcessProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphConstruction.js → javascript/JavaScriptSemanticGraphConstruction.js} +3 -2
- package/dist/application/{JavaScriptSemanticGraphDataProjection.js → javascript/JavaScriptSemanticGraphDataProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphFingerprintProjection.js → javascript/JavaScriptSemanticGraphFingerprintProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphFlowProjection.js → javascript/JavaScriptSemanticGraphFlowProjection.js} +2 -2
- package/dist/application/{JavaScriptSemanticGraphObjectProjection.js → javascript/JavaScriptSemanticGraphObjectProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphProjection.js → javascript/JavaScriptSemanticGraphProjection.js} +2 -2
- package/dist/application/{JavaScriptSemanticGraphResourceProjection.js → javascript/JavaScriptSemanticGraphResourceProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticTraceService.js → javascript/JavaScriptSemanticTraceService.js} +6 -6
- package/dist/application/{ManagedApplicationGraphService.js → managed/ManagedApplicationGraphService.js} +7 -7
- package/dist/application/{ManagedMemberComparisonService.js → managed/ManagedMemberComparisonService.js} +10 -10
- package/dist/application/{ManagedNativeVerificationService.js → managed/ManagedNativeVerificationService.js} +7 -7
- package/dist/application/{ManagedReconstructionService.js → managed/ManagedReconstructionService.js} +7 -7
- package/dist/application/{NativeApiInspection.js → native/NativeApiInspection.js} +1 -1
- package/dist/application/{NativeCallRoutes.js → native/NativeCallRoutes.js} +3 -3
- package/dist/application/{NativeDispatchMetadataInspection.js → native/NativeDispatchMetadataInspection.js} +4 -4
- package/dist/application/{NativeUiActionTrace.js → native/NativeUiActionTrace.js} +7 -7
- package/dist/application/{NativeValueTrace.js → native/NativeValueTrace.js} +6 -6
- package/dist/{application/ArtifactInventory/hash.js → artifacts/ArtifactHash.js} +4 -2
- package/dist/artifacts/ArtifactPaths.js +3 -3
- package/dist/artifacts/ArtifactProvider.js +7 -37
- package/dist/artifacts/ArtifactProviderMetadata.js +36 -0
- package/dist/artifacts/AsarArtifactReader.js +195 -23
- package/dist/artifacts/AsarEntryStream.js +76 -0
- package/dist/artifacts/DirectoryArtifactReader.js +41 -7
- package/dist/artifacts/NativeDmgArtifactReader.js +161 -9
- package/dist/{application → artifacts/apple}/AppleAssetCatalogAnalysis.js +4 -4
- package/dist/{application → artifacts/apple}/InterfaceBuilderAnalysis.js +125 -51
- package/dist/artifacts/{KeyedArchiveReader.js → apple/KeyedArchiveReader.js} +21 -27
- package/dist/artifacts/apple/NibViewHierarchy.js +150 -0
- package/dist/{application → artifacts/javascript}/JavaScriptArtifactFiles.js +27 -6
- package/dist/artifacts/javascript/JavaScriptArtifactReader.js +6 -0
- package/dist/artifacts/readStableArtifact.js +52 -0
- package/dist/browser/BrowserScenarioSecrets.js +50 -8
- package/dist/browser/CdpAuthorizedMainFrame.js +4 -4
- package/dist/browser/CdpAuthorizedTarget.js +22 -0
- package/dist/browser/CdpBrowserProvider.js +4 -15
- package/dist/browser/CdpCaptureDocuments.js +33 -21
- package/dist/browser/CdpCaptureEventBodyShapes.js +3 -3
- package/dist/browser/CdpCaptureEventHandlers.js +26 -26
- package/dist/browser/CdpCaptureEventHelpers.js +6 -6
- package/dist/browser/CdpCaptureStorage.js +10 -8
- package/dist/browser/CdpCaptureStorageFingerprints.js +24 -22
- package/dist/browser/CdpCaptureValues.js +2 -2
- package/dist/browser/CdpCommandRejection.js +17 -0
- package/dist/browser/CdpConnection.js +51 -11
- package/dist/browser/CdpElectronInspection.js +10 -10
- package/dist/browser/CdpElectronProvider.js +3 -6
- package/dist/browser/CdpElectronScriptEvents.js +6 -6
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpElectronWorkers.js +4 -4
- package/dist/browser/CdpObservationSession.js +18 -23
- package/dist/browser/CdpPageCapture.js +4 -4
- package/dist/browser/CdpPageCaptureScripts.js +2 -2
- package/dist/browser/CdpPageCaptureWorkers.js +9 -9
- package/dist/browser/CdpSafeMetadata.js +48 -10
- package/dist/browser/CdpScreenshot.js +5 -5
- package/dist/browser/CdpTargetEvents.js +8 -0
- package/dist/browser/CdpTargetSession.js +2 -2
- package/dist/browser/CdpWebMcpDiscovery.js +22 -16
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +7 -6
- package/dist/browser/PlaywrightElectronActiveProvider.js +3 -6
- package/dist/browser/PlaywrightScenarioEvents.js +59 -51
- package/dist/browser/PlaywrightScenarioSession.js +8 -1
- package/dist/browser/WebSourceMapFetcher.js +37 -53
- package/dist/browser/assets/LocalWebScriptArtifacts.js +87 -0
- package/dist/browser/assets/PageScriptCapture.js +32 -0
- package/dist/browser/assets/PublishWebScripts.js +74 -0
- package/dist/browser/assets/ScenarioScriptCapture.js +76 -0
- package/dist/browser/assets/ScriptCaptureAdapters.js +57 -0
- package/dist/browser/assets/WebArtifactReads.js +56 -0
- package/dist/browser/assets/WebSourceLocationArtifacts.js +40 -0
- package/dist/browser/execution/CdpEventListeners.js +79 -0
- package/dist/browser/execution/CdpExecutionCapture.js +135 -0
- package/dist/browser/execution/CdpExecutionCollection.js +57 -0
- package/dist/browser/execution/CdpExecutionWindow.js +100 -0
- package/dist/browser/execution/CdpListenerSelector.js +22 -0
- package/dist/browser/execution/CdpPreciseCoverage.js +48 -0
- package/dist/browser/execution/CdpRuntimeInitiator.js +18 -0
- package/dist/browser/execution/CdpRuntimeProtocol.js +106 -0
- package/dist/browser/execution/CdpRuntimeRequests.js +81 -0
- package/dist/browser/execution/CdpRuntimeSession.js +163 -0
- package/dist/browser/execution/CdpRuntimeSources.js +223 -0
- package/dist/browser/execution/CdpWebRuntimeProvider.js +51 -0
- package/dist/browser/modules/NativeModuleResolver.js +210 -0
- package/dist/browser/modules/WebModuleArtifacts.js +40 -0
- package/dist/browser/network/PlaywrightNetworkContent.js +71 -0
- package/dist/browser/network/PlaywrightScenarioNetwork.js +180 -0
- package/dist/browser/providerIdentities.js +24 -0
- package/dist/catalogIdentity.js +23 -15
- package/dist/cli/androidCommands.js +13 -3
- package/dist/cli/applicationCommands.js +39 -8
- package/dist/cli/artifactCommands.js +1 -1
- package/dist/cli/browserAdvancedCommands.js +27 -9
- package/dist/cli/coreAnalysisCommands.js +5 -493
- package/dist/cli/coreBinaryCommands.js +211 -0
- package/dist/cli/coreNativeCommands.js +293 -0
- package/dist/cli/electronCommands.js +13 -18
- package/dist/cli/firmwareCommands.js +3 -3
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/javascriptRecoveryCommands.js +45 -0
- package/dist/cli/managedCommands.js +4 -4
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/referenceSourceImportStatus.js +6 -1
- package/dist/cli/utilityCommands.js +47 -23
- package/dist/cli/webModuleCommands.js +56 -0
- package/dist/cli/webRuntimeCommands.js +60 -0
- package/dist/cli/webScriptCommands.js +31 -0
- package/dist/cli/webSourceLocationCommands.js +42 -0
- package/dist/cli.js +10 -0
- package/dist/cliBrowserContext.js +4 -2
- package/dist/cliBrowserScenarioCommands.js +4 -3
- package/dist/cliCommandNames.js +8 -0
- package/dist/cliJavaScriptRuntimeCommands.js +6 -4
- package/dist/cliJsonInput.js +9 -2
- package/dist/cliOutput.js +37 -11
- package/dist/composition/android.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +30 -0
- package/dist/composition/binary.js +25 -0
- package/dist/composition/browserObservation.js +3 -0
- package/dist/composition/browserScenario.js +3 -0
- package/dist/composition/directAnalysis.js +17 -0
- package/dist/composition/electronObservation.js +3 -0
- package/dist/composition/electronScenario.js +3 -0
- package/dist/composition/firmware.js +3 -0
- package/dist/composition/javascriptRecovery.js +3 -0
- package/dist/composition/javascriptRuntimeObservation.js +3 -0
- package/dist/composition/optionalObservationProviders.js +49 -0
- package/dist/composition/webModules.js +5 -0
- package/dist/composition/webRuntime.js +4 -0
- package/dist/composition/webSourceLocations.js +5 -0
- package/dist/config/parseConfig.js +22 -3
- package/dist/contracts/{androidToolContracts.js → android/androidToolContracts.js} +5 -5
- package/dist/contracts/applicationToolContracts.js +43 -8
- package/dist/contracts/artifactToolContracts.js +2 -2
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/enhancedInputs.js +1 -1
- package/dist/contracts/{firmwareToolContracts.js → firmware/firmwareToolContracts.js} +5 -5
- package/dist/contracts/{applicationWorkflowInputContracts.js → javascript/applicationWorkflowInputContracts.js} +6 -6
- package/dist/contracts/{electronToolContracts.js → javascript/electronToolContracts.js} +6 -6
- package/dist/contracts/{javascriptApplicationWorkflowExamples.js → javascript/javascriptApplicationWorkflowExamples.js} +3 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +23 -0
- package/dist/contracts/{javascriptRuntimeObservationToolContracts.js → javascript/javascriptRuntimeObservationToolContracts.js} +3 -3
- package/dist/contracts/{javascriptRuntimeReconciliationExample.js → javascript/javascriptRuntimeReconciliationExample.js} +5 -5
- package/dist/contracts/{managedToolContracts.js → managed/managedToolContracts.js} +3 -3
- package/dist/contracts/{managedWorkflowExamples.js → managed/managedWorkflowExamples.js} +1 -1
- package/dist/contracts/{managedWorkflowToolContracts.js → managed/managedWorkflowToolContracts.js} +6 -6
- package/dist/contracts/mobileApplicationGraphExamples.js +105 -0
- package/dist/contracts/{nativeToolContracts.js → native/nativeToolContracts.js} +14 -7
- package/dist/contracts/officialToolContracts.js +3 -3
- package/dist/contracts/sessionToolContracts.js +1 -1
- package/dist/contracts/toolContracts.js +13 -7
- package/dist/contracts/toolEffects.js +32 -0
- package/dist/contracts/toolOutputSchemaGroups.js +18 -18
- package/dist/contracts/webRuntimeToolContracts.js +43 -0
- package/dist/contracts/webScriptToolContracts.js +68 -0
- package/dist/domain/analysisErrorCore.js +4 -2
- package/dist/domain/analysisErrorProjection.js +1 -0
- package/dist/domain/{androidApplication.js → android/androidApplication.js} +7 -6
- package/dist/domain/apple/appleApplication.js +277 -0
- package/dist/domain/{appleAssetCatalog.js → apple/appleAssetCatalog.js} +2 -2
- package/dist/domain/apple/appleBundleAnatomy.js +236 -0
- package/dist/domain/{interfaceBuilderGraph.js → apple/interfaceBuilderGraph.js} +47 -314
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +411 -0
- package/dist/domain/{keyedArchive.js → apple/keyedArchive.js} +10 -9
- package/dist/domain/apple/plistValue.js +35 -0
- package/dist/domain/artifactInventoryEvidence.js +12 -2
- package/dist/domain/artifactInventorySnapshot.js +1 -0
- package/dist/domain/artifactOperationError.js +5 -1
- package/dist/domain/artifactPathSyntax.js +26 -0
- package/dist/domain/browserNetworkEvidence.js +82 -0
- package/dist/domain/browserObservationError.js +2 -0
- package/dist/domain/browserObservationSchemas.js +2 -1
- package/dist/domain/browserScenarioCapture.js +22 -0
- package/dist/domain/browserScenarioCaptureValues.js +25 -0
- package/dist/domain/browserScenarioDiff.js +6 -3
- package/dist/domain/browserScenarioDiffEvidence.js +35 -1
- package/dist/domain/browserScenarioValues.js +12 -1
- package/dist/domain/browserSession.js +2 -7
- package/dist/domain/bundleComparison.js +2 -1
- package/dist/domain/callPath.js +52 -44
- package/dist/domain/comparisonStatus.js +39 -0
- package/dist/domain/evidenceBundle.js +98 -35
- package/dist/domain/{firmwareAnalysis.js → firmware/firmwareAnalysis.js} +2 -2
- package/dist/domain/functionComparisonNormalization.js +11 -13
- package/dist/domain/hopperValues.js +2 -2
- package/dist/domain/inputIssueProjection.js +17 -2
- package/dist/domain/{electronObservation.js → javascript/electronObservation.js} +5 -11
- package/dist/domain/{electronStaticAnalysisBrowser.js → javascript/electronStaticAnalysisBrowser.js} +4 -3
- package/dist/domain/{electronStaticAnalysisIpc.js → javascript/electronStaticAnalysisIpc.js} +2 -2
- package/dist/domain/{electronStaticAnalysisNative.js → javascript/electronStaticAnalysisNative.js} +12 -13
- package/dist/domain/javascript/electronStaticAnalysisTypes.js +1 -0
- package/dist/domain/{electronStaticAnalysisValues.js → javascript/electronStaticAnalysisValues.js} +3 -3
- package/dist/domain/{javascriptApplicationAnalysis.js → javascript/javascriptApplicationAnalysis.js} +2 -2
- package/dist/domain/{javascriptApplicationChangeGraph.js → javascript/javascriptApplicationChangeGraph.js} +1 -1
- package/dist/domain/{javascriptApplicationEvidenceSchemas.js → javascript/javascriptApplicationEvidenceSchemas.js} +6 -4
- package/dist/domain/{javascriptApplicationGraph.js → javascript/javascriptApplicationGraph.js} +2 -2
- package/dist/domain/{javascriptApplicationGraphSchemas.js → javascript/javascriptApplicationGraphSchemas.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionComparison.js → javascript/javascriptApplicationVersionComparison.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionComparisonSchemas.js → javascript/javascriptApplicationVersionComparisonSchemas.js} +3 -3
- package/dist/domain/{javascriptApplicationVersionItems.js → javascript/javascriptApplicationVersionItems.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionKeys.js → javascript/javascriptApplicationVersionKeys.js} +16 -9
- package/dist/domain/javascript/javascriptArtifactFiles.js +1 -0
- package/dist/domain/{javascriptAstFingerprint.js → javascript/javascriptAstFingerprint.js} +38 -22
- package/dist/domain/javascript/javascriptAstValues.js +23 -0
- package/dist/domain/{javascriptExportShapeComparison.js → javascript/javascriptExportShapeComparison.js} +1 -1
- package/dist/domain/{javascriptExportShapeComparisonSchemas.js → javascript/javascriptExportShapeComparisonSchemas.js} +2 -2
- package/dist/domain/{javascriptExportShapeSelection.js → javascript/javascriptExportShapeSelection.js} +1 -1
- package/dist/domain/{javascriptExportShapeVariants.js → javascript/javascriptExportShapeVariants.js} +1 -1
- package/dist/domain/{javascriptFeatureSeed.js → javascript/javascriptFeatureSeed.js} +4 -3
- package/dist/domain/{javascriptFeatureTrace.js → javascript/javascriptFeatureTrace.js} +2 -2
- package/dist/domain/{javascriptFeatureTraceSchemas.js → javascript/javascriptFeatureTraceSchemas.js} +32 -18
- package/dist/domain/{javascriptFeatureTraversal.js → javascript/javascriptFeatureTraversal.js} +6 -2
- package/dist/domain/{javascriptNativeHandoff.js → javascript/javascriptNativeHandoff.js} +1 -1
- package/dist/domain/javascript/javascriptRecovery.js +88 -0
- package/dist/domain/{javascriptRuntimeLoadState.js → javascript/javascriptRuntimeLoadState.js} +1 -1
- package/dist/domain/{javascriptRuntimeObservation.js → javascript/javascriptRuntimeObservation.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationActive.js → javascript/javascriptRuntimeReconciliationActive.js} +3 -3
- package/dist/domain/{javascriptRuntimeReconciliationGraph.js → javascript/javascriptRuntimeReconciliationGraph.js} +1 -1
- package/dist/domain/{javascriptRuntimeReconciliationMatching.js → javascript/javascriptRuntimeReconciliationMatching.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationParsing.js → javascript/javascriptRuntimeReconciliationParsing.js} +5 -5
- package/dist/domain/{javascriptRuntimeReconciliationResult.js → javascript/javascriptRuntimeReconciliationResult.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationSchemas.js → javascript/javascriptRuntimeReconciliationSchemas.js} +4 -4
- package/dist/domain/{javascriptRuntimeStaticCandidates.js → javascript/javascriptRuntimeStaticCandidates.js} +1 -1
- package/dist/domain/{javascriptSemanticAnalysis.js → javascript/javascriptSemanticAnalysis.js} +40 -14
- package/dist/domain/{javascriptSemanticAsyncEffects.js → javascript/javascriptSemanticAsyncEffects.js} +2 -1
- package/dist/domain/{javascriptSemanticCallResolution.js → javascript/javascriptSemanticCallResolution.js} +10 -5
- package/dist/domain/{javascriptSemanticCalls.js → javascript/javascriptSemanticCalls.js} +7 -4
- package/dist/domain/{javascriptSemanticChildProcesses.js → javascript/javascriptSemanticChildProcesses.js} +4 -2
- package/dist/domain/{javascriptSemanticDataEffectHelpers.js → javascript/javascriptSemanticDataEffectHelpers.js} +7 -6
- package/dist/domain/{javascriptSemanticDataEffects.js → javascript/javascriptSemanticDataEffects.js} +8 -6
- package/dist/domain/{javascriptSemanticFingerprints.js → javascript/javascriptSemanticFingerprints.js} +40 -16
- package/dist/domain/{javascriptSemanticGraph.js → javascript/javascriptSemanticGraph.js} +2 -2
- package/dist/domain/{javascriptSemanticGraphSchemas.js → javascript/javascriptSemanticGraphSchemas.js} +3 -3
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +116 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +53 -0
- package/dist/domain/{javascriptSemanticObjects.js → javascript/javascriptSemanticObjects.js} +5 -5
- package/dist/domain/{javascriptSemanticPrimitives.js → javascript/javascriptSemanticPrimitives.js} +1 -1
- package/dist/domain/{javascriptSemanticProjection.js → javascript/javascriptSemanticProjection.js} +31 -44
- package/dist/domain/{javascriptSemanticPromises.js → javascript/javascriptSemanticPromises.js} +77 -22
- package/dist/domain/{javascriptSemanticProvenance.js → javascript/javascriptSemanticProvenance.js} +4 -1
- package/dist/domain/{javascriptSemanticQuery.js → javascript/javascriptSemanticQuery.js} +1 -1
- package/dist/domain/{javascriptSemanticQueryAssessment.js → javascript/javascriptSemanticQueryAssessment.js} +1 -1
- package/dist/domain/{javascriptSemanticQueryIdentity.js → javascript/javascriptSemanticQueryIdentity.js} +1 -1
- package/dist/domain/{javascriptSemanticQuerySchemas.js → javascript/javascriptSemanticQuerySchemas.js} +3 -3
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +25 -0
- package/dist/domain/{javascriptSemanticResources.js → javascript/javascriptSemanticResources.js} +2 -1
- package/dist/domain/{javascriptSemanticReturns.js → javascript/javascriptSemanticReturns.js} +1 -1
- package/dist/domain/{javascriptSemanticTraceSchemas.js → javascript/javascriptSemanticTraceSchemas.js} +2 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +55 -0
- package/dist/domain/javascript/javascriptSemanticValueTypes.js +1 -0
- package/dist/domain/{javascriptSemanticValues.js → javascript/javascriptSemanticValues.js} +72 -48
- package/dist/domain/{javascriptStaticAnalysis.js → javascript/javascriptStaticAnalysis.js} +7 -4
- package/dist/domain/{javascriptStaticAnalysisBundler.js → javascript/javascriptStaticAnalysisBundler.js} +14 -11
- package/dist/domain/{javascriptStaticAnalysisCalls.js → javascript/javascriptStaticAnalysisCalls.js} +2 -2
- package/dist/domain/{javascriptStaticAnalysisHelpers.js → javascript/javascriptStaticAnalysisHelpers.js} +231 -40
- package/dist/domain/{sourceToBundleComparison.js → javascript/sourceToBundleComparison.js} +2 -2
- package/dist/domain/{sourceToBundleComparisonSchemas.js → javascript/sourceToBundleComparisonSchemas.js} +4 -4
- package/dist/domain/{sourceToBundleSignals.js → javascript/sourceToBundleSignals.js} +2 -2
- package/dist/domain/{managedApplicationGraph.js → managed/managedApplicationGraph.js} +4 -4
- package/dist/domain/{managedApplicationGraphNodes.js → managed/managedApplicationGraphNodes.js} +1 -1
- package/dist/domain/{managedArtifact.js → managed/managedArtifact.js} +1 -1
- package/dist/domain/{managedMemberComparison.js → managed/managedMemberComparison.js} +4 -4
- package/dist/domain/{managedMemberComparisonCoverage.js → managed/managedMemberComparisonCoverage.js} +2 -1
- package/dist/domain/{managedMemberComparisonItems.js → managed/managedMemberComparisonItems.js} +97 -40
- package/dist/domain/{managedMemberComparisonMatch.js → managed/managedMemberComparisonMatch.js} +22 -11
- package/dist/domain/{managedNativeVerification.js → managed/managedNativeVerification.js} +1 -1
- package/dist/domain/{managedNativeVerificationMatch.js → managed/managedNativeVerificationMatch.js} +3 -3
- package/dist/domain/{managedNativeVerificationSchemas.js → managed/managedNativeVerificationSchemas.js} +6 -5
- package/dist/domain/{managedReconstruction.js → managed/managedReconstruction.js} +3 -3
- package/dist/domain/{nativeFunctionAnnotations.js → native/nativeFunctionAnnotations.js} +1 -1
- package/dist/domain/{nativeInspection.js → native/nativeInspection.js} +1 -1
- package/dist/domain/{nativeInvestigationGraph.js → native/nativeInvestigationGraph.js} +13 -4
- package/dist/domain/{nativeLoadImage.js → native/nativeLoadImage.js} +1 -1
- package/dist/domain/{nativeUiObservation.js → native/nativeUiObservation.js} +20 -6
- package/dist/domain/{objcSwiftMetadata.js → native/objcSwiftMetadata.js} +17 -0
- package/dist/domain/processCapture.js +4 -2
- package/dist/domain/processScenario.js +17 -17
- package/dist/domain/propertyListKeys.js +69 -0
- package/dist/domain/providerCleanupError.js +5 -2
- package/dist/domain/reconstructionCoverageEvaluation.js +46 -24
- package/dist/domain/reconstructionCoverageInput.js +7 -0
- package/dist/domain/runtimeVersion.js +2 -0
- package/dist/domain/sourceMapEnvelope.js +38 -0
- package/dist/domain/unicodeCodePointOrder.js +11 -6
- package/dist/domain/webBundleAnalyzerAst.js +2 -34
- package/dist/domain/webBundleAnalyzerInspection.js +12 -9
- package/dist/domain/webEventListeners.js +28 -0
- package/dist/domain/webExecution.js +74 -0
- package/dist/domain/webMcpDiscovery.js +1 -7
- package/dist/domain/webModuleImports.js +104 -0
- package/dist/domain/webModuleTrace.js +106 -0
- package/dist/domain/webRuntime.js +69 -0
- package/dist/domain/webScreenshot.js +1 -7
- package/dist/domain/webScriptArtifacts.js +39 -0
- package/dist/domain/webScriptExport.js +86 -0
- package/dist/domain/webScriptExportError.js +13 -0
- package/dist/domain/webScriptExportPlan.js +108 -0
- package/dist/domain/webSourceLocation.js +106 -0
- package/dist/domain/webSourcePosition.js +21 -0
- package/dist/dotnet/ManagedArtifactInspector.js +1 -1
- package/dist/dotnet/ManagedMemberInspector.js +1 -1
- package/dist/dotnet/ManagedMemberInspectorCore.js +34 -0
- package/dist/dotnet/ManagedMemberRows.js +5 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +22 -16
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +56 -50
- package/dist/dotnet/ManagedStaticProvider.js +3 -33
- package/dist/dotnet/ManagedStaticProviderMetadata.js +36 -0
- package/dist/evaluation/CodexAgentEval.js +2 -1
- package/dist/firmware/FirmwareProvider.js +18 -12
- package/dist/firmware/FirmwarePublication.js +1 -1
- package/dist/firmware/FirmwareRelease.js +1 -1
- package/dist/firmware/FirmwareReports.js +12 -0
- package/dist/firmware/FirmwareVersion.js +80 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraFunctionValues.js +5 -5
- package/dist/ghidra/GhidraInstallation.js +38 -34
- package/dist/ghidra/GhidraInstallationPolicy.js +140 -0
- package/dist/ghidra/GhidraInventoryValues.js +1 -1
- package/dist/ghidra/GhidraLauncher.js +12 -4
- package/dist/ghidra/GhidraLoadImageAttest.js +36 -0
- package/dist/ghidra/GhidraLoadImageValues.js +1 -1
- package/dist/ghidra/GhidraProvider.js +15 -233
- package/dist/ghidra/GhidraProviderCapabilities.js +7 -14
- package/dist/ghidra/GhidraProviderClient.js +209 -0
- package/dist/ghidra/GhidraResponseBuffer.js +7 -1
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +17 -1
- package/dist/hopper/HopperProvider.js +2 -48
- package/dist/hopper/HopperProviderCapabilities.js +73 -0
- package/dist/hopper/HopperResponseStream.js +7 -1
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -4
- package/dist/ida/IdaProviderCapabilities.js +3 -11
- package/dist/ida/IdaSessionClient.js +12 -0
- package/dist/{browser → inspector}/JavaScriptRuntimeScope.js +16 -5
- package/dist/{browser → inspector}/V8InspectorCaptureProjection.js +46 -8
- package/dist/{browser → inspector}/V8InspectorEndpoint.js +1 -1
- package/dist/{browser → inspector}/V8InspectorProvider.js +10 -13
- package/dist/inspector/providerIdentity.js +6 -0
- package/dist/javascript/recovery/RecoveryFiles.js +122 -0
- package/dist/javascript/recovery/WakaruCommand.js +116 -0
- package/dist/javascript/recovery/WakaruExecution.js +100 -0
- package/dist/javascript/recovery/WakaruProvider.js +96 -0
- package/dist/javascript/recovery/WakaruPublication.js +102 -0
- package/dist/javascript/recovery/WakaruRelease.js +29 -0
- package/dist/javascript/recovery/WakaruReport.js +134 -0
- package/dist/javascript/sourceMaps/SourceMapCodecProcess.js +37 -0
- package/dist/javascript/sourceMaps/SourceMapCodecProtocol.js +20 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +176 -0
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +61 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +185 -0
- package/dist/javascript/sourceMaps/TraceSourceMap.js +138 -0
- package/dist/main/shutdown.js +8 -2
- package/dist/main/transport.js +24 -7
- package/dist/main.js +4 -18
- package/dist/native/AppleDispatchCoverage.js +58 -0
- package/dist/native/AppleDispatchMetadata.js +71 -509
- package/dist/native/AppleMachoFixups.js +292 -0
- package/dist/native/AppleMachoSelection.js +188 -0
- package/dist/native/AppleObjcCategories.js +59 -0
- package/dist/native/AppleObjcDispatchFacets.js +257 -0
- package/dist/native/AppleObjcProperties.js +68 -0
- package/dist/native/AppleObjcProtocols.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +150 -0
- package/dist/native/NativeMacOSProvider.js +132 -72
- package/dist/native/NativeMacOSProviderMetadata.js +42 -0
- package/dist/native/NativeMachoInspection.js +45 -14
- package/dist/native/NativeUiHelperRuntime.js +7 -3
- package/dist/native/NativeUiObservation.js +8 -4
- package/dist/native/NativeUiOutputBudget.js +8 -0
- package/dist/native/parsers/codesign.js +40 -5
- package/dist/native/parsers/demangle.js +6 -2
- package/dist/native/parsers/dyldInfo.js +13 -4
- package/dist/native/parsers/echoedPath.js +14 -0
- package/dist/native/parsers/lipo.js +14 -0
- package/dist/native/parsers/otool.js +1 -1
- package/dist/native/parsers/plist.js +174 -19
- package/dist/process/ExecFileOutput.js +2 -0
- package/dist/process/ProviderProcess.js +38 -17
- package/dist/reference/ReferenceSourceReaderEntries.js +6 -1
- package/dist/server/createServer.js +48 -6
- package/dist/server/mcpClientMetadata.js +6 -3
- package/dist/server/registerAndroidTools.js +1 -1
- package/dist/server/registerApplicationTools/compareExportShapes.js +2 -2
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +2 -2
- package/dist/server/registerApplicationTools/compareVersions.js +2 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +43 -0
- package/dist/server/registerApplicationTools/traceFeature.js +1 -1
- package/dist/server/registerApplicationTools/traceSemantics.js +1 -1
- package/dist/server/registerApplicationTools.js +2 -0
- package/dist/server/registerBrowserScenarioTool.js +6 -2
- package/dist/server/registerBrowserTools.js +13 -2
- package/dist/server/registerCloseLifecycleTool.js +1 -1
- package/dist/server/registerElectronTools.js +21 -7
- package/dist/server/registerJavaScriptRecoveryTool.js +17 -0
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -4
- package/dist/server/registerManagedTools.js +3 -3
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -2
- package/dist/server/registerManagedWorkflowTools/contract.js +1 -1
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +1 -1
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +1 -1
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -2
- package/dist/server/registerNativeTools.js +1 -1
- package/dist/server/registerPrompts.js +5 -1
- package/dist/server/registerSessionTools.js +1 -1
- package/dist/server/registerWebModuleTool.js +17 -0
- package/dist/server/registerWebRuntimeTools.js +31 -0
- package/dist/server/registerWebScriptTool.js +18 -0
- package/dist/server/registerWebSourceLocationTool.js +17 -0
- package/dist/server/sessionAvailabilityPolicy.js +24 -12
- package/dist/windows/WindowsOwnedProcess.js +3 -1
- package/install.sh +12 -2
- package/native/windows/README.md +5 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +40 -19
- package/scripts/hopper-demo-x11.py +67 -8
- package/scripts/rea.mjs +9 -1
- package/skills/reverse-engineer-anything/SKILL.md +3 -3
- package/skills/reverse-engineer-anything/references/android-applications.md +2 -2
- package/skills/reverse-engineer-anything/references/javascript-applications.md +1 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +32 -23
- package/dist/application/runtime.js +0 -53
- package/dist/domain/appleApplication.js +0 -181
- package/dist/domain/javascriptAstValues.js +0 -13
- package/dist/domain/javascriptSemanticTraversal.js +0 -30
- package/dist/native/NativeHostCapabilities.js +0 -23
- /package/dist/application/{AndroidAnalysisPort.js → DirectAnalysisDependencies.js} +0 -0
- /package/dist/application/{BinarySessionPort.js → WebModulePorts.js} +0 -0
- /package/dist/application/{ElectronActiveObservationPort.js → WebRuntimePort.js} +0 -0
- /package/dist/application/{ElectronObservationPort.js → WebScriptArtifactPort.js} +0 -0
- /package/dist/application/{FirmwareAnalysisPort.js → WebSourceLocationPorts.js} +0 -0
- /package/dist/application/{JavaScriptArtifactAnalysisTypes.js → android/AndroidAnalysisPort.js} +0 -0
- /package/dist/application/{AbortablePromise.js → binary/AbortablePromise.js} +0 -0
- /package/dist/application/{JavaScriptRuntimeObservationPort.js → binary/BinarySessionPort.js} +0 -0
- /package/dist/application/{BinarySessionStatus.js → binary/BinarySessionStatus.js} +0 -0
- /package/dist/{domain/electronStaticAnalysisTypes.js → application/firmware/FirmwareAnalysisPort.js} +0 -0
- /package/dist/{domain/javascriptSemanticValueTypes.js → application/investigation/InvestigationRecordPort.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraph.js → javascript/ElectronBoundaryGraph.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphIpc.js → javascript/ElectronBoundaryGraphIpc.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphNative.js → javascript/ElectronBoundaryGraphNative.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphWindows.js → javascript/ElectronBoundaryGraphWindows.js} +0 -0
- /package/dist/application/{JavaScriptArtifactGraphBundlers.js → javascript/JavaScriptArtifactGraphBundlers.js} +0 -0
- /package/dist/application/{JavaScriptArtifactGraphEvidence.js → javascript/JavaScriptArtifactGraphEvidence.js} +0 -0
- /package/dist/application/{JavaScriptArtifactReconstructionInput.js → javascript/JavaScriptArtifactReconstructionInput.js} +0 -0
- /package/dist/application/{JavaScriptSemanticGraphEvidence.js → javascript/JavaScriptSemanticGraphEvidence.js} +0 -0
- /package/dist/application/{JavaScriptSemanticGraphValueProjection.js → javascript/JavaScriptSemanticGraphValueProjection.js} +0 -0
- /package/dist/artifacts/{NibArchive.js → apple/NibArchive.js} +0 -0
- /package/dist/domain/{androidAnalysis.js → android/androidAnalysis.js} +0 -0
- /package/dist/domain/{electronActiveObservation.js → javascript/electronActiveObservation.js} +0 -0
- /package/dist/domain/{electronStaticAnalysis.js → javascript/electronStaticAnalysis.js} +0 -0
- /package/dist/domain/{javascriptExportShapeComparisonIdentity.js → javascript/javascriptExportShapeComparisonIdentity.js} +0 -0
- /package/dist/domain/{javascriptRuntimeReconciliation.js → javascript/javascriptRuntimeReconciliation.js} +0 -0
- /package/dist/domain/{javascriptRuntimeReconciliationRuntime.js → javascript/javascriptRuntimeReconciliationRuntime.js} +0 -0
- /package/dist/domain/{javascriptSemanticCoverage.js → javascript/javascriptSemanticCoverage.js} +0 -0
- /package/dist/domain/{javascriptSemanticDerivedAnalysis.js → javascript/javascriptSemanticDerivedAnalysis.js} +0 -0
- /package/dist/domain/{javascriptSemanticGraphSerialization.js → javascript/javascriptSemanticGraphSerialization.js} +0 -0
- /package/dist/domain/{javascriptSemanticIr.js → javascript/javascriptSemanticIr.js} +0 -0
- /package/dist/domain/{javascriptSemanticQueryRelations.js → javascript/javascriptSemanticQueryRelations.js} +0 -0
- /package/dist/domain/{javascriptSemanticState.js → javascript/javascriptSemanticState.js} +0 -0
- /package/dist/domain/{javascriptSourceParser.js → javascript/javascriptSourceParser.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisFindings.js → javascript/javascriptStaticAnalysisFindings.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisState.js → javascript/javascriptStaticAnalysisState.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisTypes.js → javascript/javascriptStaticAnalysisTypes.js} +0 -0
- /package/dist/domain/{managedApplicationGraphCoverage.js → managed/managedApplicationGraphCoverage.js} +0 -0
- /package/dist/domain/{managedApplicationGraphNodeCoverage.js → managed/managedApplicationGraphNodeCoverage.js} +0 -0
- /package/dist/domain/{nativeApiBoundary.js → native/nativeApiBoundary.js} +0 -0
- /package/dist/domain/{nativeDataType.js → native/nativeDataType.js} +0 -0
- /package/dist/domain/{nativeInstruction.js → native/nativeInstruction.js} +0 -0
- /package/dist/domain/{nativeMetadataRecovery.js → native/nativeMetadataRecovery.js} +0 -0
- /package/dist/domain/{nativeValueFlow.js → native/nativeValueFlow.js} +0 -0
- /package/dist/domain/{nativeValueTrace.js → native/nativeValueTrace.js} +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Public identity committed by every Hopper-backed observation. */
|
|
2
|
+
export const HOPPER_PROVIDER_IDENTITY = Object.freeze({
|
|
3
|
+
id: "hopper",
|
|
4
|
+
name: "Hopper Disassembler",
|
|
5
|
+
version: null,
|
|
6
|
+
});
|
|
7
|
+
/** Analyst operations implemented by REA's private Hopper bridge. */
|
|
8
|
+
export const HOPPER_OPERATIONS = Object.freeze([
|
|
9
|
+
"address_name",
|
|
10
|
+
"comment",
|
|
11
|
+
"current_address",
|
|
12
|
+
"current_procedure",
|
|
13
|
+
"current_document",
|
|
14
|
+
"goto_address",
|
|
15
|
+
"inline_comment",
|
|
16
|
+
"list_bookmarks",
|
|
17
|
+
"list_documents",
|
|
18
|
+
"list_names",
|
|
19
|
+
"list_procedures",
|
|
20
|
+
"list_segments",
|
|
21
|
+
"list_strings",
|
|
22
|
+
"next_address",
|
|
23
|
+
"prev_address",
|
|
24
|
+
"procedure_address",
|
|
25
|
+
"procedure_assembly",
|
|
26
|
+
"procedure_callees",
|
|
27
|
+
"procedure_callers",
|
|
28
|
+
"procedure_info",
|
|
29
|
+
"read_function_instructions",
|
|
30
|
+
"read_bytes",
|
|
31
|
+
"address_to_file_offset",
|
|
32
|
+
"procedure_references",
|
|
33
|
+
"procedure_pseudo_code",
|
|
34
|
+
"resolve_containing_procedure",
|
|
35
|
+
"search_procedures",
|
|
36
|
+
"search_strings",
|
|
37
|
+
"set_address_name",
|
|
38
|
+
"set_addresses_names",
|
|
39
|
+
"set_bookmark",
|
|
40
|
+
"set_comment",
|
|
41
|
+
"set_current_document",
|
|
42
|
+
"set_inline_comment",
|
|
43
|
+
"unset_bookmark",
|
|
44
|
+
"xrefs",
|
|
45
|
+
"analyze_function",
|
|
46
|
+
]);
|
|
47
|
+
const MUTATING_OPERATIONS = new Set([
|
|
48
|
+
"set_address_name",
|
|
49
|
+
"set_addresses_names",
|
|
50
|
+
"set_bookmark",
|
|
51
|
+
"set_comment",
|
|
52
|
+
"set_inline_comment",
|
|
53
|
+
"unset_bookmark",
|
|
54
|
+
]);
|
|
55
|
+
/** Source-owned capabilities without acquiring or probing a Hopper session. */
|
|
56
|
+
export const CAPABILITIES = Object.freeze(HOPPER_OPERATIONS.map((operation) => Object.freeze({
|
|
57
|
+
provider: HOPPER_PROVIDER_IDENTITY,
|
|
58
|
+
operation,
|
|
59
|
+
available: true,
|
|
60
|
+
reason: null,
|
|
61
|
+
effects: Object.freeze({
|
|
62
|
+
mutatesArtifact: MUTATING_OPERATIONS.has(operation),
|
|
63
|
+
launchesProcess: true,
|
|
64
|
+
mayShowUi: true,
|
|
65
|
+
mayAccessNetwork: false,
|
|
66
|
+
mayWriteFilesystem: MUTATING_OPERATIONS.has(operation),
|
|
67
|
+
changesPermissions: false,
|
|
68
|
+
requiresRoot: false,
|
|
69
|
+
}),
|
|
70
|
+
limitations: Object.freeze([
|
|
71
|
+
"Results depend on Hopper's completed static analysis.",
|
|
72
|
+
]),
|
|
73
|
+
})));
|
|
@@ -3,11 +3,16 @@ import { parseBridgeMessageLine, } from "./protocol.js";
|
|
|
3
3
|
export class HopperResponseStream {
|
|
4
4
|
options;
|
|
5
5
|
#buffer = "";
|
|
6
|
+
#fragments = [];
|
|
6
7
|
constructor(options) {
|
|
7
8
|
this.options = options;
|
|
8
9
|
}
|
|
9
10
|
push(chunk) {
|
|
10
|
-
this.#
|
|
11
|
+
this.#fragments.push(chunk);
|
|
12
|
+
if (!chunk.includes("\n"))
|
|
13
|
+
return;
|
|
14
|
+
this.#buffer += this.#fragments.join("");
|
|
15
|
+
this.#fragments = [];
|
|
11
16
|
let newline = this.#buffer.indexOf("\n");
|
|
12
17
|
while (newline >= 0) {
|
|
13
18
|
const line = this.#buffer.slice(0, newline).trim();
|
|
@@ -19,6 +24,7 @@ export class HopperResponseStream {
|
|
|
19
24
|
}
|
|
20
25
|
reset() {
|
|
21
26
|
this.#buffer = "";
|
|
27
|
+
this.#fragments = [];
|
|
22
28
|
}
|
|
23
29
|
#acceptLine(line) {
|
|
24
30
|
const parsed = parseBridgeMessageLine(line);
|
|
@@ -62,7 +62,7 @@ export const runLinuxPrivateDisplayProbe = async (strategy, options) => {
|
|
|
62
62
|
cleanup: () => cleanupOwnedProcessGroup(started.ownership),
|
|
63
63
|
};
|
|
64
64
|
const supervisor = new ProviderProcessSupervisor(launch);
|
|
65
|
-
const outcome = await
|
|
65
|
+
const outcome = await waitForProbeOutputClose(supervisor, options.timeoutMs, options.signal);
|
|
66
66
|
let cleanupIncomplete = false;
|
|
67
67
|
if (outcome !== "exit") {
|
|
68
68
|
const stopped = await supervisor.stop();
|
|
@@ -191,7 +191,7 @@ const emptyProcessResult = (outcome) => ({
|
|
|
191
191
|
stderrBytes: 0,
|
|
192
192
|
cleanupIncomplete: false,
|
|
193
193
|
});
|
|
194
|
-
const
|
|
194
|
+
const waitForProbeOutputClose = async (supervisor, timeoutMs, signal) => {
|
|
195
195
|
if (signal?.aborted === true)
|
|
196
196
|
return "cancelled";
|
|
197
197
|
let releaseAbort;
|
|
@@ -205,8 +205,8 @@ const waitForProbeExit = async (supervisor, timeoutMs, signal) => {
|
|
|
205
205
|
try {
|
|
206
206
|
return await Promise.race([
|
|
207
207
|
supervisor
|
|
208
|
-
.
|
|
209
|
-
.then((
|
|
208
|
+
.waitForOutputClose(Math.max(1, timeoutMs))
|
|
209
|
+
.then((closed) => (closed ? "exit" : "timeout")),
|
|
210
210
|
aborted,
|
|
211
211
|
]);
|
|
212
212
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GENERATED_MCP_TOOL_CATALOG } from "../generatedMcpToolCatalog.js";
|
|
2
1
|
/** This version identifies REA's adapter, not IDA or the upstream Python package. */
|
|
3
2
|
export const IDA_PROVIDER_IDENTITY = Object.freeze({
|
|
4
3
|
id: "ida",
|
|
@@ -6,7 +5,7 @@ export const IDA_PROVIDER_IDENTITY = Object.freeze({
|
|
|
6
5
|
version: "1",
|
|
7
6
|
});
|
|
8
7
|
/** Read-only analyst outcomes supported by both upstream compatibility profiles. */
|
|
9
|
-
export const IDA_OPERATIONS = [
|
|
8
|
+
export const IDA_OPERATIONS = Object.freeze([
|
|
10
9
|
"list_procedures",
|
|
11
10
|
"search_procedures",
|
|
12
11
|
"list_strings",
|
|
@@ -19,7 +18,7 @@ export const IDA_OPERATIONS = [
|
|
|
19
18
|
"read_function_instructions",
|
|
20
19
|
"xrefs",
|
|
21
20
|
"analyze_function",
|
|
22
|
-
];
|
|
21
|
+
]);
|
|
23
22
|
/** Shared limitations of observations from an externally mutable analysis database. */
|
|
24
23
|
export const IDA_LIMITATIONS = Object.freeze([
|
|
25
24
|
"Provider version identifies the REA IDA adapter. IDA engine and upstream distribution versions are unknown unless separately observed; MCP serverInfo is reported independently.",
|
|
@@ -29,15 +28,8 @@ export const IDA_LIMITATIONS = Object.freeze([
|
|
|
29
28
|
"Headless workers are released through the upstream database lifecycle. Abrupt termination of REA, its proxy, or the supervisor cannot prove worker cleanup; inspect upstream inventory after an interrupted process.",
|
|
30
29
|
"Complete function body ranges, typed references, unresolved indirect calls, referenced data, and basic blocks are unavailable in this adapter. Empty unsupported dossier facets are unknown, not observed absence.",
|
|
31
30
|
]);
|
|
32
|
-
/** Existing REA contracts implemented by the adapter; no upstream tools are exposed directly. */
|
|
33
|
-
export const IDA_PROVIDER_TOOL_CONTRACTS = Object.freeze(IDA_OPERATIONS.map((operation) => {
|
|
34
|
-
const contract = GENERATED_MCP_TOOL_CATALOG.find(({ name }) => name === operation);
|
|
35
|
-
if (contract === undefined)
|
|
36
|
-
throw new TypeError(`Missing contract for ${operation}`);
|
|
37
|
-
return { ...contract, name: operation };
|
|
38
|
-
}));
|
|
39
31
|
/** Advertise live observations and configured lifecycle effects truthfully. */
|
|
40
|
-
export const idaCapabilities = (mode, stdio) =>
|
|
32
|
+
export const idaCapabilities = (mode, stdio) => IDA_OPERATIONS.map((operation) => ({
|
|
41
33
|
provider: IDA_PROVIDER_IDENTITY,
|
|
42
34
|
operation,
|
|
43
35
|
...(mode === "headless" && operation === "procedure_callers"
|
|
@@ -63,6 +63,7 @@ export class IdaSessionClient {
|
|
|
63
63
|
#startup;
|
|
64
64
|
#closed = false;
|
|
65
65
|
#closing = false;
|
|
66
|
+
#closePromise;
|
|
66
67
|
#workspace;
|
|
67
68
|
#database;
|
|
68
69
|
#openAttempted = false;
|
|
@@ -253,6 +254,17 @@ export class IdaSessionClient {
|
|
|
253
254
|
return this.#metadata;
|
|
254
255
|
}
|
|
255
256
|
async closeWithOutcome() {
|
|
257
|
+
if (this.#closePromise !== undefined)
|
|
258
|
+
return this.#closePromise;
|
|
259
|
+
const closing = this.#closeOnce();
|
|
260
|
+
const shared = closing.finally(() => {
|
|
261
|
+
if (this.#closePromise === shared)
|
|
262
|
+
this.#closePromise = undefined;
|
|
263
|
+
});
|
|
264
|
+
this.#closePromise = shared;
|
|
265
|
+
return shared;
|
|
266
|
+
}
|
|
267
|
+
async #closeOnce() {
|
|
256
268
|
this.#closing = true;
|
|
257
269
|
await this.#tail;
|
|
258
270
|
if (this.#closed)
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { pathToFileURL } from "node:url";
|
|
2
2
|
import { browserOriginSchema, sanitizeBrowserUrl, } from "../domain/browserObservation.js";
|
|
3
|
-
import { authorizedElectronFile } from "
|
|
3
|
+
import { authorizedElectronFile } from "../browser/ElectronFileScope.js";
|
|
4
|
+
/**
|
|
5
|
+
* Wire bucket for inspector script exclusions. The V8 observation schemas
|
|
6
|
+
* fix the `unsupported_location` key, so every canonical denial reason maps
|
|
7
|
+
* onto it; the reason itself stays available on the decision for logs and
|
|
8
|
+
* limitations text.
|
|
9
|
+
*/
|
|
10
|
+
export const inspectorExclusionKey = (reason) => {
|
|
11
|
+
// Every canonical denial collapses onto the fixed V8 wire bucket.
|
|
12
|
+
void reason;
|
|
13
|
+
return "unsupported_location";
|
|
14
|
+
};
|
|
4
15
|
/** Resolve a protocol location exposed by the explicitly selected Inspector endpoint. */
|
|
5
16
|
export const authorizeRuntimeLocation = async (value) => {
|
|
6
17
|
if (value.startsWith("node:") && value.length > 0)
|
|
@@ -11,7 +22,7 @@ export const authorizeRuntimeLocation = async (value) => {
|
|
|
11
22
|
if (value.startsWith("file:")) {
|
|
12
23
|
const filePath = await authorizedElectronFile(value);
|
|
13
24
|
return filePath === undefined
|
|
14
|
-
? { allowed: false, reason: "
|
|
25
|
+
? { allowed: false, reason: "not_approved" }
|
|
15
26
|
: { allowed: true, location: { kind: "file", file_path: filePath } };
|
|
16
27
|
}
|
|
17
28
|
let url;
|
|
@@ -21,13 +32,13 @@ export const authorizeRuntimeLocation = async (value) => {
|
|
|
21
32
|
catch (cause) {
|
|
22
33
|
// Non-URL input is outside the authorized runtime scope.
|
|
23
34
|
void cause;
|
|
24
|
-
return { allowed: false, reason: "
|
|
35
|
+
return { allowed: false, reason: "unsupported_url" };
|
|
25
36
|
}
|
|
26
37
|
if (!["http:", "https:"].includes(url.protocol))
|
|
27
|
-
return { allowed: false, reason: "
|
|
38
|
+
return { allowed: false, reason: "unsupported_url" };
|
|
28
39
|
const parsedOrigin = browserOriginSchema.safeParse(url.origin);
|
|
29
40
|
if (!parsedOrigin.success)
|
|
30
|
-
return { allowed: false, reason: "
|
|
41
|
+
return { allowed: false, reason: "unsupported_url" };
|
|
31
42
|
return {
|
|
32
43
|
allowed: true,
|
|
33
44
|
location: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { authorizeRuntimeLocation } from "./JavaScriptRuntimeScope.js";
|
|
2
|
+
import { authorizeRuntimeLocation, inspectorExclusionKey, } from "./JavaScriptRuntimeScope.js";
|
|
3
3
|
/** Empty durable-location exclusion counters. */
|
|
4
4
|
export const createInspectorExclusionCounts = () => ({
|
|
5
5
|
unsupported_location: 0,
|
|
@@ -13,18 +13,56 @@ export const describeInspectorTargetLimitations = () => [
|
|
|
13
13
|
"Every target exposed by the selected Inspector endpoint is eligible for observation; target IDs and locations are not authenticated as operating-system process identity.",
|
|
14
14
|
"No runtime graph depth is traversed because passive Inspector events do not establish require/import caller edges.",
|
|
15
15
|
];
|
|
16
|
+
const LOCATION_AUTHORIZATION_WORKERS = 8;
|
|
16
17
|
/** Canonically authorize, deduplicate, and sort one bounded raw capture. */
|
|
17
|
-
export const finalizeInspectorCapture = async ({ input, runtime, target, state, }) => {
|
|
18
|
+
export const finalizeInspectorCapture = async ({ input, runtime, target, state, authorizeLocation = authorizeRuntimeLocation, }) => {
|
|
18
19
|
const exclusions = createInspectorExclusionCounts();
|
|
19
20
|
const scripts = new Map();
|
|
21
|
+
const draftsByUrl = new Map();
|
|
20
22
|
for (const draft of state.scripts) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const drafts = draftsByUrl.get(draft.rawUrl) ?? [];
|
|
24
|
+
drafts.push(draft);
|
|
25
|
+
draftsByUrl.set(draft.rawUrl, drafts);
|
|
26
|
+
}
|
|
27
|
+
const groups = [...draftsByUrl];
|
|
28
|
+
const authorizedGroups = new Array(groups.length);
|
|
29
|
+
let nextGroup = 0;
|
|
30
|
+
let stopScheduling = false;
|
|
31
|
+
const worker = async () => {
|
|
32
|
+
try {
|
|
33
|
+
for (;;) {
|
|
34
|
+
if (stopScheduling)
|
|
35
|
+
return;
|
|
36
|
+
const index = nextGroup;
|
|
37
|
+
nextGroup += 1;
|
|
38
|
+
const group = groups[index];
|
|
39
|
+
if (group === undefined)
|
|
40
|
+
return;
|
|
41
|
+
const [rawUrl, drafts] = group;
|
|
42
|
+
authorizedGroups[index] = {
|
|
43
|
+
drafts,
|
|
44
|
+
decision: await authorizeLocation(rawUrl),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (cause) {
|
|
49
|
+
stopScheduling = true;
|
|
50
|
+
throw cause;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const workerResults = await Promise.allSettled(Array.from({ length: Math.min(LOCATION_AUTHORIZATION_WORKERS, groups.length) }, worker));
|
|
54
|
+
const failedWorker = workerResults.find((result) => result.status === "rejected");
|
|
55
|
+
if (failedWorker?.status === "rejected")
|
|
56
|
+
throw failedWorker.reason;
|
|
57
|
+
for (const { drafts, decision } of authorizedGroups) {
|
|
58
|
+
for (const draft of drafts) {
|
|
59
|
+
if (!decision.allowed) {
|
|
60
|
+
exclusions[inspectorExclusionKey(decision.reason)] += 1;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const script = scriptFromDraft(draft, decision.location);
|
|
64
|
+
scripts.set(script.script_key, script);
|
|
25
65
|
}
|
|
26
|
-
const script = scriptFromDraft(draft, decision.location);
|
|
27
|
-
scripts.set(script.script_key, script);
|
|
28
66
|
}
|
|
29
67
|
const items = [...scripts.values()].sort((left, right) => left.script_key < right.script_key
|
|
30
68
|
? -1
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
3
3
|
import {} from "../domain/browserObservationErrors.js";
|
|
4
|
-
import { parseCdpEndpointValue, readCdpJson } from "
|
|
4
|
+
import { parseCdpEndpointValue, readCdpJson } from "../browser/CdpEndpoint.js";
|
|
5
5
|
const versionSchema = z
|
|
6
6
|
.object({
|
|
7
7
|
Browser: z.string().min(1),
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { javascriptRuntimeObservationSchema, javascriptRuntimeTargetListSchema, } from "../domain/javascriptRuntimeObservation.js";
|
|
1
|
+
import { javascriptRuntimeObservationSchema, javascriptRuntimeTargetListSchema, } from "../domain/javascript/javascriptRuntimeObservation.js";
|
|
2
2
|
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
3
3
|
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
4
4
|
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
5
5
|
import {} from "../domain/browserObservationErrors.js";
|
|
6
6
|
import { err, ok } from "../domain/result.js";
|
|
7
|
-
import { numberValue, recordValue,
|
|
8
|
-
import { CdpConnection } from "
|
|
9
|
-
import { authorizeRuntimeTargetLocation } from "./JavaScriptRuntimeScope.js";
|
|
7
|
+
import { numberValue, recordValue, cdpStringValue, delayWithCancellation, } from "../browser/CdpCaptureValues.js";
|
|
8
|
+
import { CdpConnection } from "../browser/CdpConnection.js";
|
|
9
|
+
import { authorizeRuntimeTargetLocation, inspectorExclusionKey, } from "./JavaScriptRuntimeScope.js";
|
|
10
10
|
import { createInspectorExclusionCounts, describeInspectorTargetLimitations, finalizeInspectorCapture, } from "./V8InspectorCaptureProjection.js";
|
|
11
11
|
import { discoverV8Inspector, } from "./V8InspectorEndpoint.js";
|
|
12
12
|
/** Public identity committed by passive V8 Inspector observations. */
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
name: "REA passive Node/Electron V8 Inspector provider",
|
|
16
|
-
version: "1",
|
|
17
|
-
});
|
|
13
|
+
export { V8_INSPECTOR_PROVIDER_IDENTITY } from "./providerIdentity.js";
|
|
14
|
+
import { V8_INSPECTOR_PROVIDER_IDENTITY } from "./providerIdentity.js";
|
|
18
15
|
/** Attach-only provider; sends only Runtime.enable and Debugger.enable. */
|
|
19
16
|
export class V8InspectorProvider {
|
|
20
17
|
identity() {
|
|
@@ -31,7 +28,7 @@ export class V8InspectorProvider {
|
|
|
31
28
|
product: discovery.runtime.product,
|
|
32
29
|
});
|
|
33
30
|
if (!decision.allowed) {
|
|
34
|
-
excluded[decision.reason] += 1;
|
|
31
|
+
excluded[inspectorExclusionKey(decision.reason)] += 1;
|
|
35
32
|
continue;
|
|
36
33
|
}
|
|
37
34
|
if (decision.location.kind === "builtin") {
|
|
@@ -196,7 +193,7 @@ const ingestEvent = (event, input, state) => {
|
|
|
196
193
|
const ingestScript = (event, input, state) => {
|
|
197
194
|
state.scriptsObserved += 1;
|
|
198
195
|
const value = recordValue(event.params);
|
|
199
|
-
const rawUrl =
|
|
196
|
+
const rawUrl = cdpStringValue(value?.url);
|
|
200
197
|
if (rawUrl === undefined || rawUrl === "") {
|
|
201
198
|
state.invalidScripts += 1;
|
|
202
199
|
retainEvent(state, 0);
|
|
@@ -205,7 +202,7 @@ const ingestScript = (event, input, state) => {
|
|
|
205
202
|
const draft = {
|
|
206
203
|
rawUrl,
|
|
207
204
|
executionContextKey: contextKey(value?.executionContextId),
|
|
208
|
-
cdpHash:
|
|
205
|
+
cdpHash: cdpStringValue(value?.hash) ?? null,
|
|
209
206
|
length: nonnegativeInteger(value?.length),
|
|
210
207
|
isModule: value?.isModule === true,
|
|
211
208
|
};
|
|
@@ -232,7 +229,7 @@ const ingestContext = (event, input, state) => {
|
|
|
232
229
|
return;
|
|
233
230
|
}
|
|
234
231
|
const origin = event.method === "Runtime.executionContextCreated"
|
|
235
|
-
? (
|
|
232
|
+
? (cdpStringValue(runtimeContext?.origin) ?? null)
|
|
236
233
|
: null;
|
|
237
234
|
const draft = {
|
|
238
235
|
contextKey: key,
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { lstat, open, readdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import { isAbsolute, join } from "node:path";
|
|
5
|
+
import { TextDecoder } from "node:util";
|
|
6
|
+
import { AnalysisCancelledError, AnalysisInputError, AnalysisOutputError, AnalysisTimeoutError, } from "../../domain/analysisErrorCore.js";
|
|
7
|
+
import { RECOVERY_LIMITS } from "./WakaruRelease.js";
|
|
8
|
+
const OPERATION = "recover_javascript_sources";
|
|
9
|
+
/** Fingerprint exact selected or derived bytes. */
|
|
10
|
+
export const recoveryDigest = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
11
|
+
/** Read a stable regular file without retaining bytes during engine fingerprinting. */
|
|
12
|
+
const scanRecoveryFile = async (path, maximum, consume, signal) => {
|
|
13
|
+
const handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
14
|
+
const hash = createHash("sha256");
|
|
15
|
+
try {
|
|
16
|
+
const before = await handle.stat();
|
|
17
|
+
if (!before.isFile() || before.size > maximum)
|
|
18
|
+
throw new AnalysisOutputError(OPERATION, `Expected a regular file no larger than ${String(maximum)} bytes: ${path}`);
|
|
19
|
+
let bytes = 0;
|
|
20
|
+
for await (const raw of handle.createReadStream({ autoClose: false })) {
|
|
21
|
+
checkRecoveryCancellation(signal);
|
|
22
|
+
const chunk = Buffer.isBuffer(raw) ? raw : Buffer.from(raw);
|
|
23
|
+
bytes += chunk.length;
|
|
24
|
+
if (bytes > maximum)
|
|
25
|
+
throw new AnalysisOutputError(OPERATION, `File exceeds ${String(maximum)} bytes: ${path}`);
|
|
26
|
+
hash.update(chunk);
|
|
27
|
+
consume(chunk);
|
|
28
|
+
}
|
|
29
|
+
const after = await handle.stat();
|
|
30
|
+
const current = await lstat(path);
|
|
31
|
+
if (before.dev !== current.dev ||
|
|
32
|
+
before.ino !== current.ino ||
|
|
33
|
+
before.size !== bytes ||
|
|
34
|
+
before.mtimeMs !== after.mtimeMs ||
|
|
35
|
+
before.ctimeMs !== after.ctimeMs ||
|
|
36
|
+
before.size !== after.size)
|
|
37
|
+
throw new AnalysisOutputError(OPERATION, `File identity changed while reading: ${path}`);
|
|
38
|
+
return { sha256: hash.digest("hex"), bytes };
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
await handle.close();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/** Fingerprint a regular file incrementally with bounded memory. */
|
|
45
|
+
export const fingerprintRecoveryFile = async (path, maximum, signal) => scanRecoveryFile(path, maximum, () => { }, signal);
|
|
46
|
+
/** Read only a regular file through one handle with a bounded, stable identity. */
|
|
47
|
+
export const readRecoveryFile = async (path, maximum, signal) => {
|
|
48
|
+
const chunks = [];
|
|
49
|
+
const result = await scanRecoveryFile(path, maximum, (chunk) => chunks.push(chunk), signal);
|
|
50
|
+
return Buffer.concat(chunks, result.bytes);
|
|
51
|
+
};
|
|
52
|
+
/** Snapshot one caller-selected UTF-8 script before invoking the engine. */
|
|
53
|
+
export const snapshotRecoveryInput = async (path, snapshotPath, signal) => {
|
|
54
|
+
if (!isAbsolute(path))
|
|
55
|
+
throw recoveryInputFailure("path", "Select an absolute JavaScript file path");
|
|
56
|
+
let bytes;
|
|
57
|
+
try {
|
|
58
|
+
bytes = await readRecoveryFile(path, RECOVERY_LIMITS.inputBytes, signal);
|
|
59
|
+
new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
60
|
+
}
|
|
61
|
+
catch (cause) {
|
|
62
|
+
if (cause instanceof AnalysisCancelledError)
|
|
63
|
+
throw cause;
|
|
64
|
+
throw recoveryInputFailure("path", `Cannot snapshot UTF-8 JavaScript input ${path}: ${recoveryFailureMessage(cause)}`, cause);
|
|
65
|
+
}
|
|
66
|
+
await writeFile(snapshotPath, bytes, { flag: "wx", mode: 0o600 });
|
|
67
|
+
return {
|
|
68
|
+
path,
|
|
69
|
+
snapshot_path: snapshotPath,
|
|
70
|
+
sha256: recoveryDigest(bytes),
|
|
71
|
+
bytes: bytes.length,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/** Inventory staging without following symlinks or publishing special files. */
|
|
75
|
+
export const inventoryRecoveryFiles = async (root, signal) => {
|
|
76
|
+
const files = [];
|
|
77
|
+
let bytes = 0;
|
|
78
|
+
let entries = 0;
|
|
79
|
+
const visit = async (directory, prefix) => {
|
|
80
|
+
const metadata = await lstat(directory);
|
|
81
|
+
if (!metadata.isDirectory() || metadata.isSymbolicLink())
|
|
82
|
+
throw new AnalysisOutputError(OPERATION, `Unsafe staging directory: ${directory}`);
|
|
83
|
+
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
84
|
+
checkRecoveryCancellation(signal);
|
|
85
|
+
entries++;
|
|
86
|
+
const relativePath = prefix === "" ? entry.name : `${prefix}/${entry.name}`;
|
|
87
|
+
const path = join(directory, entry.name);
|
|
88
|
+
const info = await lstat(path);
|
|
89
|
+
if (entries > RECOVERY_LIMITS.outputEntries)
|
|
90
|
+
throw new AnalysisOutputError(OPERATION, "Recovery staging exceeds the 10000-entry resource limit");
|
|
91
|
+
if (info.isSymbolicLink() || (!info.isDirectory() && !info.isFile()))
|
|
92
|
+
throw new AnalysisOutputError(OPERATION, `Recovery produced a symlink or special file: ${relativePath}`);
|
|
93
|
+
if (info.isDirectory())
|
|
94
|
+
await visit(path, relativePath);
|
|
95
|
+
else {
|
|
96
|
+
bytes += info.size;
|
|
97
|
+
if (bytes > RECOVERY_LIMITS.outputBytes)
|
|
98
|
+
throw new AnalysisOutputError(OPERATION, "Recovery staging exceeds the 128 MiB resource limit");
|
|
99
|
+
files.push({ relativePath, path, bytes: info.size });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
await visit(root, "");
|
|
104
|
+
return files;
|
|
105
|
+
};
|
|
106
|
+
/** Preserve actionable caller constraints in the ordinary error algebra. */
|
|
107
|
+
export const recoveryInputFailure = (field, message, cause) => new AnalysisInputError(OPERATION, { cause }, [
|
|
108
|
+
{ path: [field], reason: "invalid_value", message },
|
|
109
|
+
]);
|
|
110
|
+
/** Convert one caught boundary cause into diagnostic text without masking its type. */
|
|
111
|
+
export const recoveryFailureMessage = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
112
|
+
/** Cancellation remains distinct from malformed source or provider output. */
|
|
113
|
+
export const checkRecoveryCancellation = (signal) => {
|
|
114
|
+
if (signal?.aborted === true)
|
|
115
|
+
throw new AnalysisCancelledError(OPERATION);
|
|
116
|
+
};
|
|
117
|
+
/** Keep both tool invocations within one operation's execution budget. */
|
|
118
|
+
export const checkRecoveryDeadline = (deadline, signal) => {
|
|
119
|
+
checkRecoveryCancellation(signal);
|
|
120
|
+
if (Date.now() >= deadline)
|
|
121
|
+
throw new AnalysisTimeoutError(OPERATION, RECOVERY_LIMITS.timeoutMs);
|
|
122
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { access, realpath } from "node:fs/promises";
|
|
4
|
+
import { isAbsolute } from "node:path";
|
|
5
|
+
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisOutputError, } from "../../domain/analysisErrorCore.js";
|
|
6
|
+
import { ProviderAdapterError } from "../../domain/providerAdapterError.js";
|
|
7
|
+
import { ProviderCleanupError } from "../../domain/providerCleanupError.js";
|
|
8
|
+
import { cleanupOwnedProcessGroup } from "../../process/ProcessOwnership.js";
|
|
9
|
+
import { ProviderProcessSupervisor, spawnOwnedProviderProcess, } from "../../process/ProviderProcess.js";
|
|
10
|
+
import { checkRecoveryDeadline, inventoryRecoveryFiles, fingerprintRecoveryFile, recoveryFailureMessage, } from "./RecoveryFiles.js";
|
|
11
|
+
import { RECOVERY_LIMITS } from "./WakaruRelease.js";
|
|
12
|
+
const OPERATION = "recover_javascript_sources";
|
|
13
|
+
/** Resolve and fingerprint explicitly configured tools; acquire nothing at startup. */
|
|
14
|
+
export const resolveWakaruCommand = async (environment) => {
|
|
15
|
+
const configured = environment.REA_WAKARU_COMMAND;
|
|
16
|
+
if (process.platform !== "linux" ||
|
|
17
|
+
process.arch !== "x64" ||
|
|
18
|
+
configured === undefined ||
|
|
19
|
+
!isAbsolute(configured))
|
|
20
|
+
throw new AnalysisCapabilityUnavailableError("wakaru", OPERATION, "Provide an absolute REA_WAKARU_COMMAND pointing to Wakaru 1.13.0 on Linux x64; no tool is installed by REA");
|
|
21
|
+
try {
|
|
22
|
+
const command = await realpath(configured);
|
|
23
|
+
await access(command, constants.R_OK | constants.X_OK);
|
|
24
|
+
const fingerprint = await fingerprintRecoveryFile(command, RECOVERY_LIMITS.outputBytes);
|
|
25
|
+
const limiter = environment.REA_JAVASCRIPT_PRLIMIT_COMMAND ?? "/usr/bin/prlimit";
|
|
26
|
+
if (!isAbsolute(limiter))
|
|
27
|
+
throw new TypeError("REA_JAVASCRIPT_PRLIMIT_COMMAND must be absolute");
|
|
28
|
+
await access(limiter, constants.X_OK);
|
|
29
|
+
return { command, limiter, ...fingerprint };
|
|
30
|
+
}
|
|
31
|
+
catch (cause) {
|
|
32
|
+
throw new AnalysisCapabilityUnavailableError("wakaru", OPERATION, `Configured Wakaru or util-linux prlimit is unavailable: ${recoveryFailureMessage(cause)}`, { cause });
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/** Run one bounded command and verify cleanup before consuming its output. */
|
|
36
|
+
export const runWakaruCommand = async (context) => {
|
|
37
|
+
checkRecoveryDeadline(context.deadline, context.signal);
|
|
38
|
+
const runId = `rea-wakaru-${randomUUID()}`;
|
|
39
|
+
const spawned = await (context.launcher ?? spawnOwnedProviderProcess)({
|
|
40
|
+
command: context.limiter,
|
|
41
|
+
arguments: [
|
|
42
|
+
`--as=${String(RECOVERY_LIMITS.addressSpaceBytes)}`,
|
|
43
|
+
`--fsize=${String(RECOVERY_LIMITS.outputBytes)}`,
|
|
44
|
+
"--core=0",
|
|
45
|
+
"--cpu=120",
|
|
46
|
+
"--",
|
|
47
|
+
context.command,
|
|
48
|
+
...context.arguments,
|
|
49
|
+
],
|
|
50
|
+
expectedCommand: null,
|
|
51
|
+
runId,
|
|
52
|
+
cwd: context.cwd,
|
|
53
|
+
hostEnvironment: context.environment,
|
|
54
|
+
env: { TMPDIR: context.cwd, RAYON_NUM_THREADS: "1", NO_COLOR: "1" },
|
|
55
|
+
}).catch((cause) => {
|
|
56
|
+
throw new ProviderAdapterError("wakaru", OPERATION, {
|
|
57
|
+
cause,
|
|
58
|
+
diagnostics: {
|
|
59
|
+
reason: "Failed to launch configured Wakaru through util-linux prlimit",
|
|
60
|
+
command: context.command,
|
|
61
|
+
detail: recoveryFailureMessage(cause),
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
let oversized = false;
|
|
66
|
+
const supervisor = new ProviderProcessSupervisor({
|
|
67
|
+
...spawned,
|
|
68
|
+
ownsProcessLifetime: true,
|
|
69
|
+
cleanup: spawned.cleanup ?? (() => cleanupOwnedProcessGroup(spawned.ownership)),
|
|
70
|
+
}, {
|
|
71
|
+
onDiagnostic: (event) => {
|
|
72
|
+
if (event.type === "output" &&
|
|
73
|
+
event.totalBytes > RECOVERY_LIMITS.reportBytes)
|
|
74
|
+
oversized = true;
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
let failure;
|
|
78
|
+
try {
|
|
79
|
+
while (!(await supervisor.waitForOutputClose(100))) {
|
|
80
|
+
checkRecoveryDeadline(context.deadline, context.signal);
|
|
81
|
+
if (oversized)
|
|
82
|
+
throw new AnalysisOutputError(OPERATION, "Wakaru diagnostic stream exceeds 8 MiB");
|
|
83
|
+
if (context.staging !== undefined)
|
|
84
|
+
await inventoryRecoveryFiles(context.staging, context.signal);
|
|
85
|
+
}
|
|
86
|
+
checkRecoveryDeadline(context.deadline, context.signal);
|
|
87
|
+
if (oversized)
|
|
88
|
+
throw new AnalysisOutputError(OPERATION, "Wakaru diagnostic stream exceeds 8 MiB");
|
|
89
|
+
}
|
|
90
|
+
catch (cause) {
|
|
91
|
+
failure = cause;
|
|
92
|
+
}
|
|
93
|
+
const stopped = await supervisor.stop();
|
|
94
|
+
const snapshot = supervisor.snapshot();
|
|
95
|
+
supervisor.dispose();
|
|
96
|
+
if (stopped.status === "incomplete")
|
|
97
|
+
throw new ProviderCleanupError("wakaru", [runId, context.cwd], {
|
|
98
|
+
reason: stopped.reason,
|
|
99
|
+
previous_error: failure instanceof Error ? failure.message : null,
|
|
100
|
+
exit_code: snapshot.exitCode ?? null,
|
|
101
|
+
signal: snapshot.signal ?? null,
|
|
102
|
+
});
|
|
103
|
+
if (failure !== undefined)
|
|
104
|
+
throw failure;
|
|
105
|
+
if (context.signal?.aborted === true)
|
|
106
|
+
throw new AnalysisCancelledError(OPERATION);
|
|
107
|
+
return {
|
|
108
|
+
exit_code: snapshot.exitCode ?? null,
|
|
109
|
+
signal: snapshot.signal ?? null,
|
|
110
|
+
stdout: snapshot.stdout.text,
|
|
111
|
+
stderr: snapshot.stderr.text,
|
|
112
|
+
command: context.command,
|
|
113
|
+
arguments: [...context.arguments],
|
|
114
|
+
resource_limiter: context.limiter,
|
|
115
|
+
};
|
|
116
|
+
};
|