rea-agents 4.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -30
- package/bridge/ghidra/ReaGhidraBridge.java +358 -15
- package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
- package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
- package/dist/android/AndroidTargetSnapshot.js +34 -0
- package/dist/android/JadxAnalysis.js +191 -0
- package/dist/android/JadxConfiguration.js +41 -0
- package/dist/android/JadxMcpTransport.js +145 -0
- package/dist/android/JadxProtocol.js +101 -0
- package/dist/android/JadxProvider.js +170 -0
- package/dist/android/JadxRelease.js +19 -0
- package/dist/android/JadxSession.js +97 -0
- package/dist/application/AnalysisContextQueries.js +2 -1
- package/dist/application/AnalysisProviderEvaluation.js +5 -3
- package/dist/application/AnalysisProviderRegistry.js +2 -1
- package/dist/application/AnalysisSnapshotCache.js +4 -1
- package/dist/application/AnalysisSnapshotFiles.js +1 -1
- package/dist/application/AndroidAnalysisPort.js +1 -0
- package/dist/application/AndroidAnalysisService.js +37 -0
- package/dist/application/ArtifactExtraction.js +7 -4
- package/dist/application/ArtifactGraphConstruction.js +10 -17
- package/dist/application/ArtifactInventory/scanCanonical.js +8 -7
- package/dist/application/BinarySession.js +16 -3
- package/dist/application/BinarySessionExecution.js +4 -1
- package/dist/application/BinarySessionOpen.js +3 -2
- package/dist/application/BinarySessionRecords.js +9 -3
- package/dist/application/BinaryTargetResolver.js +25 -6
- package/dist/application/BrowserObservationService.js +2 -1
- package/dist/application/BrowserScenarioCaptureService.js +2 -1
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CallPathTracing.js +2 -1
- package/dist/application/CapabilityInventory.js +18 -0
- package/dist/application/ClientConfigPath.js +3 -1
- package/dist/application/ClientConfigurationDocument.js +11 -1
- package/dist/application/ClientRegistrationStatus.js +8 -1
- package/dist/application/CompositeProvider.js +1 -1
- package/dist/application/DirectAnalysis.js +23 -7
- package/dist/application/DirectAnalysisStatus.js +3 -3
- package/dist/application/Doctor.js +48 -8
- package/dist/application/DoctorDiagnostics.js +7 -5
- package/dist/application/DoctorScope.js +1 -1
- package/dist/application/ElectronActiveEvidence.js +2 -2
- package/dist/application/ElectronActiveObservationService.js +2 -1
- package/dist/application/ElectronBoundaryAnalysis.js +1 -1
- package/dist/application/ElectronObservationService.js +2 -1
- package/dist/application/EnhancedLiteralTracing.js +2 -1
- package/dist/application/EnhancedToolTypes.js +2 -1
- package/dist/application/EnhancedTools.js +3 -1
- package/dist/application/EvidenceBundleCommands.js +2 -1
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/EvidenceInputResolver.js +30 -0
- package/dist/application/EvidenceLedger.js +2 -1
- package/dist/application/FirmwareAnalysisPort.js +1 -0
- package/dist/application/FirmwareAnalysisService.js +35 -0
- package/dist/application/FunctionAnalysisEvidence.js +32 -0
- package/dist/application/InventoryProjectionEvidence.js +2 -1
- package/dist/application/JavaScriptApplicationService.js +50 -3
- package/dist/application/JavaScriptApplicationWorkflowService.js +2 -1
- package/dist/application/JavaScriptArtifactAnalysis.js +4 -2
- package/dist/application/JavaScriptArtifactFiles.js +4 -2
- package/dist/application/JavaScriptArtifactPathResolution.js +6 -2
- package/dist/application/JavaScriptJsonModules.js +3 -2
- package/dist/application/JavaScriptModuleRelationships.js +4 -2
- package/dist/application/JavaScriptRuntimeObservationService.js +2 -1
- package/dist/application/JavaScriptRuntimeReconciliationService.js +2 -1
- package/dist/application/JavaScriptSemanticGraphProjection.js +1 -1
- package/dist/application/JavaScriptSemanticTraceService.js +2 -1
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +3 -1
- package/dist/application/LinuxHopper.js +12 -4
- package/dist/application/MacHopper.js +20 -7
- package/dist/application/ManagedApplicationGraphService.js +2 -1
- package/dist/application/ManagedMemberComparisonService.js +3 -1
- package/dist/application/ManagedNativeVerificationService.js +2 -1
- package/dist/application/ManagedReconstructionService.js +2 -1
- package/dist/application/NativeCallRoutes.js +1 -1
- package/dist/application/NativeDispatchMetadataInspection.js +1 -1
- package/dist/application/NativeUiActionTrace.js +2 -1
- package/dist/application/NativeValueTrace.js +1 -1
- package/dist/application/ProcessCaptureError.js +1 -1
- package/dist/application/ProcessCaptureJournal.js +3 -1
- package/dist/application/ProcessCaptureLifecycle.js +6 -3
- package/dist/application/ProcessCli.js +9 -5
- package/dist/application/ProcessEvidence.js +2 -6
- package/dist/application/ProcessHarness.js +3 -2
- package/dist/application/ProcessNormalization.js +12 -5
- package/dist/application/ProcessSampling.js +3 -1
- package/dist/application/ReconstructionCoverageService.js +2 -1
- package/dist/application/ReconstructionObligationLedgerService.js +2 -1
- package/dist/application/ReferenceSourceImportEntries.js +2 -0
- package/dist/application/ReferenceSourceImportPolicy.js +4 -2
- package/dist/application/ReferenceSourceVcsAdapter.js +35 -4
- package/dist/application/SessionProviderRouter.js +4 -1
- package/dist/application/Setup.js +1 -128
- package/dist/application/SetupClientConfiguration.js +17 -6
- package/dist/application/SetupHost.js +111 -0
- package/dist/application/SetupRegistrationEnvironment.js +1 -2
- package/dist/application/SetupSkill.js +9 -3
- package/dist/application/SetupTypes.js +17 -0
- package/dist/application/StoreFileLock.js +7 -2
- package/dist/application/SupportedClients.js +8 -0
- package/dist/application/Uninstall.js +9 -4
- package/dist/application/UpdateRuntime.js +5 -2
- package/dist/application/WindowsCapabilities.js +7 -7
- package/dist/application/runtime.js +3 -1
- package/dist/artifacts/ArtifactProvider.js +3 -1
- package/dist/artifacts/DirectoryArtifactReader.js +2 -0
- package/dist/artifacts/NativeDmgArtifactReader.js +10 -3
- package/dist/artifacts/NibArchive.js +4 -2
- package/dist/artifacts/SafeOutputTree.js +26 -10
- package/dist/artifacts/ZipArtifactReader.js +1 -0
- package/dist/browser/BrowserProcessStartup.js +3 -1
- package/dist/browser/CdpAuthorizedMainFrame.js +1 -1
- package/dist/browser/CdpBrowserProvider.js +4 -1
- package/dist/browser/CdpCaptureDocuments.js +3 -1
- package/dist/browser/CdpCaptureEventHandlers.js +6 -2
- package/dist/browser/CdpCaptureStorageFingerprints.js +1 -1
- package/dist/browser/CdpCaptureValues.js +6 -2
- package/dist/browser/CdpConnection.js +8 -6
- package/dist/browser/CdpElectronInspection.js +3 -3
- package/dist/browser/CdpElectronProvider.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpEndpoint.js +22 -10
- package/dist/browser/CdpObservationSession.js +2 -1
- package/dist/browser/CdpOptionalCommand.js +1 -1
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpSafeMetadata.js +53 -8
- package/dist/browser/CdpScreenshot.js +1 -1
- package/dist/browser/CdpTargetSession.js +8 -5
- package/dist/browser/CdpWebMcpDiscovery.js +1 -1
- package/dist/browser/ElectronFileScope.js +9 -3
- package/dist/browser/JavaScriptRuntimeScope.js +3 -1
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +3 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +1 -1
- package/dist/browser/PlaywrightElectronActiveProvider.js +6 -2
- package/dist/browser/PlaywrightExecutionBoundary.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +10 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +3 -1
- package/dist/browser/PlaywrightScenarioEvents.js +6 -2
- package/dist/browser/PlaywrightScenarioSession.js +5 -2
- package/dist/browser/V8InspectorEndpoint.js +2 -1
- package/dist/browser/V8InspectorProvider.js +6 -1
- package/dist/browser/WebSourceMapFetcher.js +24 -11
- package/dist/cli/androidCommands.js +81 -0
- package/dist/{cliApplicationCommands.js → cli/applicationCommands.js} +18 -16
- package/dist/{cliBrowserAdvancedCommands.js → cli/browserAdvancedCommands.js} +13 -16
- package/dist/{cliBrowserCommands.js → cli/browserCommands.js} +9 -9
- package/dist/cli/commandCancellation.js +24 -0
- package/dist/cli/coreAnalysisCommands.js +110 -17
- package/dist/{cliElectronCommands.js → cli/electronCommands.js} +14 -13
- package/dist/cli/firmwareCommands.js +75 -0
- package/dist/{cliSetup.js → cli/interactiveSetup.js} +1 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/managedCommands.js +1 -1
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/options.js +7 -1
- package/dist/{cliProcessCommands.js → cli/processCommands.js} +3 -3
- package/dist/cli/referenceSourceImportStatus.js +10 -0
- package/dist/cli/setupCommands.js +4 -2
- package/dist/cli/utilityCommands.js +3 -2
- package/dist/cli.js +10 -15
- package/dist/cliBrowserContext.js +1 -1
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +11 -2
- package/dist/cliEvidenceCommands.js +2 -1
- package/dist/cliJavaScriptRuntimeCommands.js +2 -1
- package/dist/cliJsonInput.js +26 -11
- package/dist/cliLogging.js +2 -1
- package/dist/cliOutput.js +15 -16
- package/dist/config/environment.js +11 -1
- package/dist/config/parseConfig.js +7 -1
- package/dist/config/parsers.js +1 -1
- package/dist/contracts/androidToolContracts.js +77 -0
- package/dist/contracts/applicationToolContracts.js +32 -5
- package/dist/contracts/applicationWorkflowInputContracts.js +13 -13
- package/dist/contracts/artifactComparisonExample.js +7 -14
- package/dist/contracts/enhancedToolContracts.js +31 -0
- package/dist/contracts/errorSchemas.js +4 -2
- package/dist/contracts/evidenceInputContracts.js +13 -0
- package/dist/contracts/firmwareToolContracts.js +38 -0
- package/dist/contracts/officialToolContracts.js +66 -0
- package/dist/contracts/promptContracts.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -0
- package/dist/contracts/sessionToolContracts.js +43 -0
- package/dist/contracts/sessionToolSchemas.js +1 -1
- package/dist/contracts/toolContractExamples.js +5 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +7 -130
- package/dist/contracts/toolEffects.js +43 -0
- package/dist/contracts/toolOutputSchemaGroups.js +4 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -0
- package/dist/doctorRuntime.js +5 -1
- package/dist/domain/analysisErrorBase.js +33 -0
- package/dist/domain/analysisErrorCore.js +60 -0
- package/dist/domain/analysisErrorPresentation.js +22 -2
- package/dist/domain/analysisErrorProjection.js +24 -3
- package/dist/domain/analysisSnapshot.js +1 -0
- package/dist/domain/androidAnalysis.js +141 -0
- package/dist/domain/appleAssetCatalog.js +1 -1
- package/dist/domain/artifactGraph.js +1 -0
- package/dist/domain/artifactInspection.js +19 -17
- package/dist/domain/artifactInventoryEvidence.js +20 -25
- package/dist/domain/artifactOperationError.js +16 -0
- package/dist/domain/browserObservation.js +12 -4
- package/dist/domain/browserObservationError.js +23 -0
- package/dist/domain/browserScenario.js +1 -1
- package/dist/domain/browserScenarioCapture.js +1 -1
- package/dist/domain/browserScenarioDiff.js +1 -1
- package/dist/domain/browserScenarioNormalization.js +6 -11
- package/dist/domain/browserScenarioValues.js +3 -1
- package/dist/domain/callPath.js +47 -7
- package/dist/domain/canonicalDigest.js +65 -0
- package/dist/domain/canonicalOrdering.js +11 -0
- package/dist/domain/changedBehavior.js +8 -7
- package/dist/domain/comparisonSemantics.js +2 -4
- package/dist/domain/configurationErrors.js +25 -0
- package/dist/domain/dosCom.js +8 -0
- package/dist/domain/electronActiveObservation.js +3 -1
- package/dist/domain/electronStaticAnalysisBrowser.js +13 -23
- package/dist/domain/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/electronStaticAnalysisValues.js +23 -3
- package/dist/domain/evidence.js +3 -11
- package/dist/domain/evidenceErrors.js +30 -0
- package/dist/domain/firmwareAnalysis.js +121 -0
- package/dist/domain/functionComparison.js +4 -2
- package/dist/domain/functionComparisonDimensions.js +6 -4
- package/dist/domain/functionComparisonNormalization.js +8 -1
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/hopperErrors.js +78 -0
- package/dist/domain/hopperValues.js +2 -1
- package/dist/domain/interfaceBuilderGraph.js +3 -1
- package/dist/domain/javascriptApplicationChangeGraph.js +2 -2
- package/dist/domain/javascriptApplicationGraph.js +13 -22
- package/dist/domain/javascriptApplicationVersionComparison.js +3 -11
- package/dist/domain/javascriptApplicationVersionItems.js +3 -3
- package/dist/domain/javascriptApplicationVersionKeys.js +1 -1
- package/dist/domain/javascriptAstFingerprint.js +1 -1
- package/dist/domain/javascriptExportShapeComparison.js +1 -2
- package/dist/domain/javascriptExportShapeSelection.js +1 -1
- package/dist/domain/javascriptExportShapeVariants.js +7 -3
- package/dist/domain/javascriptFeatureSeed.js +29 -9
- package/dist/domain/javascriptFeatureTrace.js +9 -13
- package/dist/domain/javascriptFeatureTraversal.js +2 -1
- package/dist/domain/javascriptNativeHandoff.js +2 -1
- package/dist/domain/javascriptRuntimeLoadState.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationActive.js +3 -10
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +4 -3
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +8 -14
- package/dist/domain/javascriptRuntimeReconciliationResult.js +4 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +5 -2
- package/dist/domain/javascriptRuntimeStaticCandidates.js +8 -4
- package/dist/domain/javascriptSemanticAnalysis.js +40 -3
- package/dist/domain/javascriptSemanticCallResolution.js +2 -1
- package/dist/domain/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascriptSemanticDataEffects.js +2 -1
- package/dist/domain/javascriptSemanticFingerprints.js +1 -1
- package/dist/domain/javascriptSemanticGraph.js +23 -28
- package/dist/domain/javascriptSemanticPrimitives.js +9 -2
- package/dist/domain/javascriptSemanticProjection.js +2 -1
- package/dist/domain/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascriptSemanticProvenance.js +1 -1
- package/dist/domain/javascriptSemanticQuery.js +7 -8
- package/dist/domain/javascriptSemanticQueryAssessment.js +1 -2
- package/dist/domain/javascriptSemanticQueryIdentity.js +1 -2
- package/dist/domain/javascriptSemanticReturns.js +2 -1
- package/dist/domain/javascriptSemanticValues.js +50 -16
- package/dist/domain/javascriptSourceParser.js +4 -2
- package/dist/domain/javascriptStaticAnalysis.js +1 -1
- package/dist/domain/javascriptStaticAnalysisBundler.js +2 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +14 -6
- package/dist/domain/javascriptStaticAnalysisHelpers.js +31 -4
- package/dist/domain/jsonShape.js +6 -2
- package/dist/domain/managedMemberComparison.js +1 -0
- package/dist/domain/managedMemberComparisonItems.js +2 -0
- package/dist/domain/managedNativeVerificationMatch.js +5 -3
- package/dist/domain/nativeDataType.js +2 -0
- package/dist/domain/nativeFunctionAnnotations.js +43 -0
- package/dist/domain/nativeLoadImage.js +95 -0
- package/dist/domain/nativeMetadataRecovery.js +55 -0
- package/dist/domain/processCapture.js +0 -1
- package/dist/domain/processEvidenceProvider.js +11 -0
- package/dist/domain/processTraceComparison.js +1 -1
- package/dist/domain/providerAdapterError.js +17 -0
- package/dist/domain/providerCleanupError.js +1 -1
- package/dist/domain/providerSelectionError.js +44 -0
- package/dist/domain/reconstructionUnknowns.js +1 -1
- package/dist/domain/reconstructionVerification.js +22 -8
- package/dist/domain/referenceSourceClassification.js +5 -6
- package/dist/domain/referenceSourceGraph.js +9 -17
- package/dist/domain/referenceSourceImportParsing.js +38 -23
- package/dist/domain/runtimeIdentification.js +1 -1
- package/dist/domain/runtimeVersion.js +4 -7
- package/dist/domain/safeJson.js +13 -0
- package/dist/domain/sourceToBundleComparison.js +5 -7
- package/dist/domain/sourceToBundleSignals.js +6 -6
- package/dist/domain/staticRuntimeCorrelation.js +9 -7
- package/dist/domain/unknownRegistryError.js +10 -0
- package/dist/domain/webBundleAnalyzerAst.js +22 -5
- package/dist/domain/webBundleAnalyzerInspection.js +20 -14
- package/dist/dotnet/ManagedMemberRows.js +1 -1
- package/dist/dotnet/ManagedMetadataHeaps.js +3 -2
- package/dist/dotnet/ManagedMetadataInventoryRows.js +4 -2
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -1
- package/dist/dotnet/ManagedStaticProvider.js +3 -1
- package/dist/firmware/FirmwareCommand.js +163 -0
- package/dist/firmware/FirmwareFiles.js +190 -0
- package/dist/firmware/FirmwareProvider.js +258 -0
- package/dist/firmware/FirmwarePublication.js +84 -0
- package/dist/firmware/FirmwareRelease.js +32 -0
- package/dist/firmware/FirmwareReports.js +223 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +5 -5
- package/dist/ghidra/GhidraAnalysisProfile.js +37 -8
- package/dist/ghidra/GhidraClient.js +52 -6
- package/dist/ghidra/GhidraDiagnostics.js +3 -0
- package/dist/ghidra/GhidraDoctor.js +38 -14
- package/dist/ghidra/GhidraFunctionValues.js +10 -4
- package/dist/ghidra/GhidraInstallation.js +10 -4
- package/dist/ghidra/GhidraInventoryValues.js +39 -2
- package/dist/ghidra/GhidraLauncher.js +91 -26
- package/dist/ghidra/GhidraLoadImageValues.js +199 -0
- package/dist/ghidra/GhidraProvider.js +129 -13
- package/dist/ghidra/GhidraProviderCapabilities.js +52 -15
- package/dist/ghidra/GhidraRequestQueue.js +2 -2
- package/dist/ghidra/GhidraSessionError.js +31 -4
- package/dist/ghidra/GhidraSessionValues.js +10 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +16 -2
- package/dist/ghidra/GhidraTransport.js +12 -0
- package/dist/ghidra/extensions/GhidraExtensionFailures.js +20 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +170 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +21 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +84 -0
- package/dist/hopper/BridgeLauncher.js +4 -2
- package/dist/hopper/HopperAnalysisProfile.js +7 -2
- package/dist/hopper/HopperCleanup.js +55 -9
- package/dist/hopper/HopperClient.js +14 -4
- package/dist/hopper/HopperProcessDiagnostic.js +1 -1
- package/dist/hopper/HopperProvider.js +8 -4
- package/dist/hopper/HopperRequestQueue.js +7 -3
- package/dist/hopper/HopperSessionValues.js +1 -1
- package/dist/hopper/HopperSocketConnection.js +1 -1
- package/dist/hopper/HopperTargetLease.js +23 -15
- package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +7 -8
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -2
- package/dist/hopper/protocol.js +8 -8
- package/dist/ida/IdaConfiguration.js +56 -0
- package/dist/ida/IdaDoctor.js +53 -0
- package/dist/ida/IdaInput.js +62 -0
- package/dist/ida/IdaMcpConnection.js +111 -0
- package/dist/ida/IdaOperationRunner.js +299 -0
- package/dist/ida/IdaProtocolValues.js +178 -0
- package/dist/ida/IdaProvider.js +126 -0
- package/dist/ida/IdaProviderCapabilities.js +60 -0
- package/dist/ida/IdaSessionClient.js +306 -0
- package/dist/ida/IdaWorkspace.js +54 -0
- package/dist/main/shutdown.js +21 -1
- package/dist/main/startup.js +1 -1
- package/dist/main/transport.js +8 -4
- package/dist/main.js +5 -2
- package/dist/native/AppleDispatchMetadata.js +31 -10
- package/dist/native/NativeMacOSProvider.js +87 -15
- package/dist/native/NativeMachoInspection.js +42 -12
- package/dist/native/NativeUiHelperRuntime.js +7 -1
- package/dist/native/NativeUiObservation.js +6 -2
- package/dist/native/parsers/demangle.js +1 -1
- package/dist/native/parsers/dyldInfo.js +3 -3
- package/dist/native/parsers/otool.js +4 -1
- package/dist/native/parsers/plist.js +11 -3
- package/dist/process/PrivateRuntimeRoot.js +13 -3
- package/dist/process/ProcessOwnership.js +5 -73
- package/dist/process/ProcessOwnershipObservation.js +62 -2
- package/dist/process/ProcessOwnershipProcessTree.js +13 -0
- package/dist/process/ProviderProcess.js +24 -7
- package/dist/process/ProviderRunLineage.js +1 -1
- package/dist/process/WindowsAuthority.js +20 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +1 -0
- package/dist/server/createServer.js +25 -2
- package/dist/server/mcpProgress.js +2 -1
- package/dist/server/promptCompletion.js +3 -3
- package/dist/server/registerAndroidTools.js +30 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +5 -1
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +7 -2
- package/dist/server/registerApplicationTools/compareVersions.js +5 -1
- package/dist/server/registerApplicationTools/traceFeature.js +7 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +7 -2
- package/dist/server/registerEnhancedTools.js +28 -1
- package/dist/server/registerFirmwareTools.js +22 -0
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools/helpers.js +2 -1
- package/dist/server/registerManagedTools.js +1 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +1 -1
- package/dist/server/registerOfficialTools.js +4 -1
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerSessionTools.js +3 -1
- package/dist/server/runDerivedOperation.js +1 -1
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/sessionEvidence.js +1 -1
- package/dist/server/toolResult.js +2 -1
- package/dist/windows/WindowsNativeLoader.js +108 -0
- package/dist/windows/WindowsOwnedProcess.js +168 -0
- package/dist/windows/WindowsPrivateRuntime.js +137 -0
- package/install.sh +4 -6
- package/native/windows/README.md +102 -0
- package/native/windows/build/manifest.json +9 -0
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -24
- package/scripts/rea.mjs +1 -1
- package/scripts/verify-windows-native-artifact.mjs +39 -0
- package/skills/reverse-engineer-anything/SKILL.md +92 -24
- package/skills/reverse-engineer-anything/references/android-applications.md +31 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +19 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +52 -4
- package/dist/browser/CdpCanonicalJsonDigest.js +0 -9
- package/dist/domain/errors.js +0 -324
|
@@ -6,7 +6,9 @@ import { extractArtifact } from "../application/ArtifactExtraction.js";
|
|
|
6
6
|
import { analyzeInterfaceBuilderBundle } from "../application/InterfaceBuilderAnalysis.js";
|
|
7
7
|
import { analyzeAppleAssetCatalogs } from "../application/AppleAssetCatalogAnalysis.js";
|
|
8
8
|
import { ARTIFACT_ANALYSIS_OPERATIONS, artifactInventoryInputSchema, artifactExtractionExecutionSchema, } from "../contracts/artifactToolContracts.js";
|
|
9
|
-
import { AnalysisCapabilityUnavailableError
|
|
9
|
+
import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.js";
|
|
10
|
+
import { ArtifactOperationError } from "../domain/artifactOperationError.js";
|
|
11
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
10
12
|
import { interfaceBuilderLimitsSchema } from "../domain/interfaceBuilderGraph.js";
|
|
11
13
|
import { err, ok } from "../domain/result.js";
|
|
12
14
|
import { ArtifactReaderFailure } from "./ArtifactReader.js";
|
|
@@ -25,6 +25,7 @@ export class DirectoryArtifactReader {
|
|
|
25
25
|
children.push(child.name);
|
|
26
26
|
}
|
|
27
27
|
finally {
|
|
28
|
+
// best-effort cleanup: directory-handle close must not mask traversal.
|
|
28
29
|
await handle.close().catch(() => undefined);
|
|
29
30
|
}
|
|
30
31
|
await assertContainedDirectory(root, directory);
|
|
@@ -85,6 +86,7 @@ export class DirectoryArtifactReader {
|
|
|
85
86
|
return handle.createReadStream({ autoClose: true });
|
|
86
87
|
}
|
|
87
88
|
catch (cause) {
|
|
89
|
+
// best-effort cleanup: file-handle close must not mask the open failure.
|
|
88
90
|
await handle.close().catch(() => undefined);
|
|
89
91
|
throw cause;
|
|
90
92
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdtemp, rm } from "node:fs/promises";
|
|
1
|
+
import { mkdtemp, realpath, rm } from "node:fs/promises";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { basename, join } from "node:path";
|
|
4
4
|
import { parse } from "plist";
|
|
@@ -91,7 +91,7 @@ export class NativeDmgArtifactReader {
|
|
|
91
91
|
async attach(signal) {
|
|
92
92
|
await runChecked(this.host, ["verify", this.path], signal);
|
|
93
93
|
this.#provenance.push(command(["verify", this.path], ["read"]));
|
|
94
|
-
this.#mountRoot = await mkdtemp(join(tmpdir(), "rea-dmg-"));
|
|
94
|
+
this.#mountRoot = await realpath(await mkdtemp(join(tmpdir(), "rea-dmg-")));
|
|
95
95
|
try {
|
|
96
96
|
const attached = await runChecked(this.host, [
|
|
97
97
|
"attach",
|
|
@@ -103,7 +103,14 @@ export class NativeDmgArtifactReader {
|
|
|
103
103
|
this.path,
|
|
104
104
|
], signal);
|
|
105
105
|
const parsed = attachOutputSchema.parse(parse(attached.stdout));
|
|
106
|
-
|
|
106
|
+
const devices = [
|
|
107
|
+
...new Set(parsed["system-entities"].map((entity) => entity["dev-entry"])),
|
|
108
|
+
];
|
|
109
|
+
// Detaching an observed whole disk also detaches its partitions. Do not
|
|
110
|
+
// subsequently detach the now-unavailable child devices.
|
|
111
|
+
this.#devices = devices.filter((device) => !devices.some((parent) => /^\/dev\/disk\d+$/u.test(parent) &&
|
|
112
|
+
device.startsWith(`${parent}s`) &&
|
|
113
|
+
/^\d+$/u.test(device.slice(parent.length + 1))));
|
|
107
114
|
if (this.#devices.length === 0)
|
|
108
115
|
throw new ArtifactReaderFailure("format", "hdiutil returned no attached devices");
|
|
109
116
|
for (const entity of parsed["system-entities"])
|
|
@@ -231,8 +231,10 @@ const decodeUtf8 = (bytes, start, end, label) => {
|
|
|
231
231
|
try {
|
|
232
232
|
return new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(start, end));
|
|
233
233
|
}
|
|
234
|
-
catch {
|
|
235
|
-
throw new TypeError(`NIBArchive ${label} is not valid UTF-8
|
|
234
|
+
catch (cause) {
|
|
235
|
+
throw new TypeError(`NIBArchive ${label} is not valid UTF-8`, {
|
|
236
|
+
cause,
|
|
237
|
+
});
|
|
236
238
|
}
|
|
237
239
|
};
|
|
238
240
|
const readVarint = (bytes, cursor, end) => {
|
|
@@ -7,17 +7,25 @@ import { ArtifactPathRegistry, normalizeArtifactPath, } from "./ArtifactPaths.js
|
|
|
7
7
|
import { ArtifactReaderFailure } from "./ArtifactReader.js";
|
|
8
8
|
/** Symlink-resistant materialization in an exclusively owned, initially absent tree. */
|
|
9
9
|
export class SafeOutputTree {
|
|
10
|
+
platform;
|
|
10
11
|
#registry = new ArtifactPathRegistry();
|
|
11
12
|
#outputRoot;
|
|
12
13
|
#published = false;
|
|
13
14
|
#cleanup = {
|
|
14
15
|
status: "not-required",
|
|
15
16
|
};
|
|
16
|
-
constructor(outputRoot) {
|
|
17
|
+
constructor(outputRoot, platform) {
|
|
18
|
+
this.platform = platform;
|
|
17
19
|
this.#outputRoot = outputRoot;
|
|
18
20
|
}
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Exclusively create the absent destination as this operation's owned tree.
|
|
23
|
+
*
|
|
24
|
+
* POSIX mode bits and directory `fchmod`/`fsync` have no Windows equivalent:
|
|
25
|
+
* `mkdir` already applies the requested mode, so the redundant handle
|
|
26
|
+
* `chmod` is skipped there to avoid an `EPERM` on the directory descriptor.
|
|
27
|
+
*/
|
|
28
|
+
static async create(outputRoot, platform = process.platform) {
|
|
21
29
|
if (!isAbsolute(outputRoot))
|
|
22
30
|
throw new ArtifactReaderFailure("path", "Extraction output root must be absolute");
|
|
23
31
|
const requested = resolve(outputRoot);
|
|
@@ -34,14 +42,16 @@ export class SafeOutputTree {
|
|
|
34
42
|
throw cause;
|
|
35
43
|
});
|
|
36
44
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
if (platform !== "win32") {
|
|
46
|
+
const stagingHandle = await open(canonicalOutput, constants.O_RDONLY | constants.O_DIRECTORY);
|
|
47
|
+
try {
|
|
48
|
+
await stagingHandle.chmod(0o700);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
await stagingHandle.close();
|
|
52
|
+
}
|
|
40
53
|
}
|
|
41
|
-
|
|
42
|
-
await stagingHandle.close();
|
|
43
|
-
}
|
|
44
|
-
return new SafeOutputTree(canonicalOutput);
|
|
54
|
+
return new SafeOutputTree(canonicalOutput, platform);
|
|
45
55
|
}
|
|
46
56
|
catch (cause) {
|
|
47
57
|
await rm(canonicalOutput, { recursive: true, force: true });
|
|
@@ -87,6 +97,7 @@ export class SafeOutputTree {
|
|
|
87
97
|
return { relativePath: path, sha256, bytesWritten: bytes };
|
|
88
98
|
}
|
|
89
99
|
catch (cause) {
|
|
100
|
+
// best-effort cleanup: file-handle close must not mask the write failure.
|
|
90
101
|
await handle.close().catch(() => undefined);
|
|
91
102
|
throw cause;
|
|
92
103
|
}
|
|
@@ -94,6 +105,11 @@ export class SafeOutputTree {
|
|
|
94
105
|
/** Sync the owned output tree and prevent further writes through this instance. */
|
|
95
106
|
async commit() {
|
|
96
107
|
this.#assertWritable();
|
|
108
|
+
// Windows has no directory fsync; file contents are already synced in write().
|
|
109
|
+
if (this.platform === "win32") {
|
|
110
|
+
this.#published = true;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
97
113
|
const parent = await open(dirname(this.#outputRoot), constants.O_RDONLY | constants.O_DIRECTORY);
|
|
98
114
|
let output;
|
|
99
115
|
try {
|
|
@@ -71,6 +71,7 @@ export class ZipArtifactReader {
|
|
|
71
71
|
return Promise.resolve(extractStream(stored, signal));
|
|
72
72
|
}
|
|
73
73
|
async close() {
|
|
74
|
+
// best-effort cleanup: zip-reader close must not mask prior extraction state.
|
|
74
75
|
await this.#reader.close().catch(() => undefined);
|
|
75
76
|
await this.#source.closeHandle();
|
|
76
77
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BrowserObservationError } from "../domain/
|
|
1
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
2
2
|
import { mainFrameUrl } from "./CdpCaptureDocuments.js";
|
|
3
3
|
import { allowedSanitizedUrl, delayWithCancellation, isHttpUrl, } from "./CdpCaptureValues.js";
|
|
4
4
|
/** Wait for the attached target's main frame to enter its approved origin. */
|
|
@@ -5,7 +5,10 @@ import { webObservationSessionSchema, } from "../domain/browserSession.js";
|
|
|
5
5
|
import { webMcpDiscoverySchema, } from "../domain/webMcpDiscovery.js";
|
|
6
6
|
import { browserCaptureComparisonSchema, compareBrowserCaptures, } from "../domain/browserCaptureComparison.js";
|
|
7
7
|
import { webScreenshotDiffSchema, webScreenshotSchema, } from "../domain/webScreenshot.js";
|
|
8
|
-
import { AnalysisError
|
|
8
|
+
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
9
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
10
|
+
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
11
|
+
import {} from "../domain/browserObservationErrors.js";
|
|
9
12
|
import { err, ok } from "../domain/result.js";
|
|
10
13
|
import { discoverCdpEndpoint, hasCdpTargetWebSocket, } from "./CdpEndpoint.js";
|
|
11
14
|
import { closeCdpTargetSession, openCdpTargetSession, } from "./CdpTargetSession.js";
|
|
@@ -312,7 +312,9 @@ const domDestination = (value, documentUrl, allowedOrigins) => {
|
|
|
312
312
|
scope: "approved",
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
|
-
catch {
|
|
315
|
+
catch (cause) {
|
|
316
|
+
// Unparseable URLs are out of scope, not failures.
|
|
317
|
+
void cause;
|
|
316
318
|
return { url: null, scope: "unsupported" };
|
|
317
319
|
}
|
|
318
320
|
};
|
|
@@ -55,7 +55,9 @@ const sourceMapForScript = (value, scriptUrl, state) => {
|
|
|
55
55
|
try {
|
|
56
56
|
rawUrl = new URL(declaredUrl, scriptUrl).href;
|
|
57
57
|
}
|
|
58
|
-
catch {
|
|
58
|
+
catch (cause) {
|
|
59
|
+
// Unparseable URLs are recorded as unsupported, not as failures.
|
|
60
|
+
void cause;
|
|
59
61
|
state.completeness.exclude("source_maps", "unsupported_url");
|
|
60
62
|
return { sanitized: null, raw: null };
|
|
61
63
|
}
|
|
@@ -240,7 +242,9 @@ export const handleWebSocketCreated = (state, params) => {
|
|
|
240
242
|
try {
|
|
241
243
|
parsed = new URL(rawUrl);
|
|
242
244
|
}
|
|
243
|
-
catch {
|
|
245
|
+
catch (cause) {
|
|
246
|
+
// Unparseable URLs are recorded as unsupported, not as failures.
|
|
247
|
+
void cause;
|
|
244
248
|
state.completeness.exclude("websocket_connections", "unsupported_url");
|
|
245
249
|
return;
|
|
246
250
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
|
+
import { compareCodePoints } from "../domain/canonicalOrdering.js";
|
|
3
4
|
import { CdpConnection } from "./CdpConnection.js";
|
|
4
5
|
import { optionalCdpCommand } from "./CdpOptionalCommand.js";
|
|
5
6
|
import { recordValue, recordsValue, stringValue } from "./CdpCaptureValues.js";
|
|
@@ -315,4 +316,3 @@ const decodeBase64 = (value) => {
|
|
|
315
316
|
return null;
|
|
316
317
|
return Buffer.from(value, "base64");
|
|
317
318
|
};
|
|
318
|
-
const compareCodePoints = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { AnalysisCancelledError
|
|
1
|
+
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
|
2
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
3
|
+
import {} from "../domain/browserObservationErrors.js";
|
|
2
4
|
import { sanitizeBrowserUrl } from "../domain/browserObservation.js";
|
|
3
5
|
import { createWebTextArtifact } from "../domain/webContentArtifact.js";
|
|
4
6
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -24,7 +26,9 @@ export const isHttpUrl = (value) => {
|
|
|
24
26
|
const protocol = new URL(value).protocol;
|
|
25
27
|
return protocol === "http:" || protocol === "https:";
|
|
26
28
|
}
|
|
27
|
-
catch {
|
|
29
|
+
catch (cause) {
|
|
30
|
+
// Non-URL input is not an HTTP URL.
|
|
31
|
+
void cause;
|
|
28
32
|
return false;
|
|
29
33
|
}
|
|
30
34
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import WebSocket, {} from "ws";
|
|
2
|
-
import { AnalysisCancelledError
|
|
2
|
+
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
|
3
|
+
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
4
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
5
|
+
import {} from "../domain/browserObservationErrors.js";
|
|
6
|
+
import { safeParseJson } from "../domain/safeJson.js";
|
|
3
7
|
/** Correlated JSON-RPC transport for one CDP target operation. */
|
|
4
8
|
export class CdpConnection {
|
|
5
9
|
socket;
|
|
@@ -107,14 +111,12 @@ export class CdpConnection {
|
|
|
107
111
|
});
|
|
108
112
|
}
|
|
109
113
|
#receive(data) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
message = JSON.parse(rawText(data));
|
|
113
|
-
}
|
|
114
|
-
catch {
|
|
114
|
+
const parsed = safeParseJson(rawText(data));
|
|
115
|
+
if (!parsed.ok) {
|
|
115
116
|
this.#failPending("protocol_error");
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
119
|
+
const message = parsed.value;
|
|
118
120
|
if (!isRecord(message)) {
|
|
119
121
|
this.#failPending("protocol_error");
|
|
120
122
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { canonicalDigest } from "../domain/comparisonSemantics.js";
|
|
2
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
2
3
|
import { CdpCaptureCompleteness } from "./CdpCaptureCompleteness.js";
|
|
3
|
-
import { canonicalJsonDigest } from "./CdpCanonicalJsonDigest.js";
|
|
4
4
|
import { delayWithCancellation, numberValue, recordValue, recordsValue, requiredRecord, stringValue, } from "./CdpCaptureValues.js";
|
|
5
5
|
import { walkFrameTrees } from "./CdpCaptureDocuments.js";
|
|
6
6
|
import { ingestElectronScriptEvent, } from "./CdpElectronScriptEvents.js";
|
|
@@ -176,7 +176,7 @@ const captureResources = async (context, completeness) => {
|
|
|
176
176
|
? null
|
|
177
177
|
: Math.max(0, numberValue(resource.contentSize) ?? 0),
|
|
178
178
|
};
|
|
179
|
-
const resourceKey = `electron_resource_${
|
|
179
|
+
const resourceKey = `electron_resource_${canonicalDigest(item, "CDP capture")}`;
|
|
180
180
|
if (seen.has(resourceKey))
|
|
181
181
|
continue;
|
|
182
182
|
seen.add(resourceKey);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { electronPageInspectionSchema, electronTargetListSchema, } from "../domain/electronObservation.js";
|
|
2
|
-
import { AnalysisError
|
|
2
|
+
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
3
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
4
|
+
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
5
|
+
import {} from "../domain/browserObservationErrors.js";
|
|
3
6
|
import { err, ok } from "../domain/result.js";
|
|
4
7
|
import { discoverCdpEndpoint, hasCdpTargetWebSocket, } from "./CdpEndpoint.js";
|
|
5
8
|
import { closeCdpTargetSession, openCdpTargetSession, } from "./CdpTargetSession.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { canonicalDigest } from "../domain/comparisonSemantics.js";
|
|
1
2
|
import { createWebTextArtifact } from "../domain/webContentArtifact.js";
|
|
2
3
|
import { CdpCaptureCompleteness } from "./CdpCaptureCompleteness.js";
|
|
3
|
-
import { canonicalJsonDigest } from "./CdpCanonicalJsonDigest.js";
|
|
4
4
|
import { requiredRecord, stringValue } from "./CdpCaptureValues.js";
|
|
5
5
|
import { authorizedElectronFile } from "./ElectronFileScope.js";
|
|
6
6
|
/** Normalize local script metadata and optionally approved source. */
|
|
@@ -27,7 +27,7 @@ export const captureElectronScripts = async (input) => {
|
|
|
27
27
|
is_module: script.isModule,
|
|
28
28
|
language: script.language,
|
|
29
29
|
};
|
|
30
|
-
const scriptKey = `electron_script_${
|
|
30
|
+
const scriptKey = `electron_script_${canonicalDigest(identity, "CDP capture")}`;
|
|
31
31
|
if (seen.has(scriptKey))
|
|
32
32
|
continue;
|
|
33
33
|
seen.add(scriptKey);
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { request } from "node:http";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { AnalysisCancelledError
|
|
3
|
+
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
|
4
|
+
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
5
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
6
|
+
import {} from "../domain/browserObservationErrors.js";
|
|
4
7
|
import { sanitizeBrowserUrl } from "../domain/browserObservation.js";
|
|
8
|
+
import { safeParseJson } from "../domain/safeJson.js";
|
|
5
9
|
const endpointVersionSchema = z.object({
|
|
6
10
|
Browser: z.string().min(1),
|
|
7
11
|
"Protocol-Version": z.string().min(1),
|
|
@@ -49,7 +53,9 @@ const sanitizeTargetTitle = (value, targetUrl) => {
|
|
|
49
53
|
try {
|
|
50
54
|
url = new URL(value);
|
|
51
55
|
}
|
|
52
|
-
catch {
|
|
56
|
+
catch (cause) {
|
|
57
|
+
// Non-URL titles fall back to alias redaction.
|
|
58
|
+
void cause;
|
|
53
59
|
return sanitizeTargetUrlAlias(value, targetUrl);
|
|
54
60
|
}
|
|
55
61
|
return url.protocol === "http:" || url.protocol === "https:"
|
|
@@ -61,7 +67,9 @@ const sanitizeTargetUrlAlias = (value, targetUrl) => {
|
|
|
61
67
|
try {
|
|
62
68
|
parsed = new URL(targetUrl);
|
|
63
69
|
}
|
|
64
|
-
catch {
|
|
70
|
+
catch (cause) {
|
|
71
|
+
// Without a parseable target URL there is nothing to redact.
|
|
72
|
+
void cause;
|
|
65
73
|
return value;
|
|
66
74
|
}
|
|
67
75
|
const markers = [parsed.origin, `//${parsed.host}`, parsed.host];
|
|
@@ -79,7 +87,9 @@ const sanitizeSameOriginTitleUrl = (candidate, target) => {
|
|
|
79
87
|
? new URL(`${target.protocol}//${candidate}`)
|
|
80
88
|
: new URL(candidate, target.origin);
|
|
81
89
|
}
|
|
82
|
-
catch {
|
|
90
|
+
catch (cause) {
|
|
91
|
+
// Unparseable candidates are preserved verbatim.
|
|
92
|
+
void cause;
|
|
83
93
|
return candidate;
|
|
84
94
|
}
|
|
85
95
|
return parsed.origin === target.origin &&
|
|
@@ -164,7 +174,9 @@ const targetWebSocket = (endpoint, target, operation) => {
|
|
|
164
174
|
? { webSocket }
|
|
165
175
|
: {};
|
|
166
176
|
}
|
|
167
|
-
catch {
|
|
177
|
+
catch (cause) {
|
|
178
|
+
// Endpoint validation failures mean no validated transport exists.
|
|
179
|
+
void cause;
|
|
168
180
|
return {};
|
|
169
181
|
}
|
|
170
182
|
};
|
|
@@ -183,12 +195,12 @@ export const readCdpJson = async (url, operation, signal) => await new Promise((
|
|
|
183
195
|
const chunks = [];
|
|
184
196
|
response.on("data", (chunk) => chunks.push(chunk));
|
|
185
197
|
response.on("end", () => {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
reject(new BrowserObservationError(operation, "invalid_endpoint_response", { cause }));
|
|
198
|
+
const parsed = safeParseJson(Buffer.concat(chunks).toString("utf8"));
|
|
199
|
+
if (!parsed.ok) {
|
|
200
|
+
reject(new BrowserObservationError(operation, "invalid_endpoint_response", { cause: parsed.cause }));
|
|
201
|
+
return;
|
|
191
202
|
}
|
|
203
|
+
resolve(parsed.value);
|
|
192
204
|
});
|
|
193
205
|
response.on("error", (cause) => reject(endpointFailure(cause, operation, signal)));
|
|
194
206
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AnalysisCancelledError
|
|
1
|
+
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
|
2
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
2
3
|
import { CdpConnection } from "./CdpConnection.js";
|
|
3
4
|
import { CdpCaptureCompleteness } from "./CdpCaptureCompleteness.js";
|
|
4
5
|
import { authorizedMainFrame } from "./CdpAuthorizedMainFrame.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BrowserObservationError } from "../domain/
|
|
1
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
2
2
|
import { CdpConnection } from "./CdpConnection.js";
|
|
3
3
|
/** Execute an optional CDP method while preserving transport and cancellation failures. */
|
|
4
4
|
export const optionalCdpCommand = async (context, method, parameters, limitations) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BrowserObservationError
|
|
1
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
2
|
+
import {} from "../domain/browserObservationErrors.js";
|
|
2
3
|
import { stableWebResources } from "../domain/webInventory.js";
|
|
3
4
|
import { CdpConnection } from "./CdpConnection.js";
|
|
4
5
|
import { CdpCaptureEvents } from "./CdpCaptureEvents.js";
|
|
@@ -83,14 +83,55 @@ const cspSource = (token, baseUrl, allowedOrigins) => {
|
|
|
83
83
|
return { kind: "keyword", value: lower };
|
|
84
84
|
if (/^[a-z][a-z0-9+.-]*:$/u.test(lower))
|
|
85
85
|
return { kind: "scheme", value: lower };
|
|
86
|
+
const hostOrigin = cspHostSourceOrigin(token, baseUrl);
|
|
87
|
+
if (hostOrigin === undefined)
|
|
88
|
+
return { kind: "other", value: null };
|
|
89
|
+
return hostOrigin !== null && allowedOrigins.has(hostOrigin)
|
|
90
|
+
? { kind: "approved_origin", value: hostOrigin }
|
|
91
|
+
: { kind: "external_origin", value: null };
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Resolve a CSP host-source (CSP3 §2.3.1) to the single origin it names. A
|
|
95
|
+
* scheme-less source inherits the protected resource's scheme instead of being
|
|
96
|
+
* resolved as a page-relative path. Returns `null` for a recognized wildcard
|
|
97
|
+
* host or port, which denotes a set of origins rather than one origin, and
|
|
98
|
+
* `undefined` when the token is not a host-source at all.
|
|
99
|
+
*/
|
|
100
|
+
const cspHostSourceOrigin = (token, baseUrl) => {
|
|
101
|
+
const match = /^(?:([a-z][a-z0-9+.-]*):\/\/)?([^/?#]+)(?:\/[^?#]*)?$/iu.exec(token);
|
|
102
|
+
const authority = match?.[2];
|
|
103
|
+
if (authority === undefined || authority.length === 0)
|
|
104
|
+
return undefined;
|
|
105
|
+
const scheme = (match?.[1] ?? schemeOf(baseUrl))?.toLowerCase();
|
|
106
|
+
if (scheme === undefined || !/^[a-z][a-z0-9+.-]*$/u.test(scheme))
|
|
107
|
+
return undefined;
|
|
108
|
+
if (!/^(?:\*|(?:\*\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)*\.?)(?::(?:\*|\d+))?$/iu.test(authority))
|
|
109
|
+
return undefined;
|
|
110
|
+
if (authority.includes("*"))
|
|
111
|
+
return null;
|
|
86
112
|
try {
|
|
87
|
-
const parsed = new URL(
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
113
|
+
const parsed = new URL(`${scheme}://${authority}`);
|
|
114
|
+
return parsed.username === "" &&
|
|
115
|
+
parsed.password === "" &&
|
|
116
|
+
parsed.pathname === "/" &&
|
|
117
|
+
parsed.origin !== "null"
|
|
118
|
+
? parsed.origin
|
|
119
|
+
: undefined;
|
|
91
120
|
}
|
|
92
|
-
catch {
|
|
93
|
-
|
|
121
|
+
catch (cause) {
|
|
122
|
+
// Authorities that are not a bare host[:port] are classified as other.
|
|
123
|
+
void cause;
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const schemeOf = (baseUrl) => {
|
|
128
|
+
try {
|
|
129
|
+
return new URL(baseUrl).protocol.replace(/:$/u, "");
|
|
130
|
+
}
|
|
131
|
+
catch (cause) {
|
|
132
|
+
// An unparseable protected-resource URL cannot lend a scheme.
|
|
133
|
+
void cause;
|
|
134
|
+
return undefined;
|
|
94
135
|
}
|
|
95
136
|
};
|
|
96
137
|
const parseLinks = (value, baseUrl, allowedOrigins) => {
|
|
@@ -155,7 +196,9 @@ const safeDestination = (value, baseUrl, allowedOrigins) => {
|
|
|
155
196
|
return { url: sanitized, scope: "outside_policy" };
|
|
156
197
|
return { url: sanitized, scope: "approved" };
|
|
157
198
|
}
|
|
158
|
-
catch {
|
|
199
|
+
catch (cause) {
|
|
200
|
+
// Unparseable link values keep their raw text for the analyst.
|
|
201
|
+
void cause;
|
|
159
202
|
return { url: value, scope: "unsupported" };
|
|
160
203
|
}
|
|
161
204
|
};
|
|
@@ -172,7 +215,9 @@ const wellKnownHint = (url) => {
|
|
|
172
215
|
? [agentHint("well_known_resource", path, sanitizeBrowserUrl(url).url)]
|
|
173
216
|
: [];
|
|
174
217
|
}
|
|
175
|
-
catch {
|
|
218
|
+
catch (cause) {
|
|
219
|
+
// Non-URL input yields no well-known hint.
|
|
220
|
+
void cause;
|
|
176
221
|
return [];
|
|
177
222
|
}
|
|
178
223
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createWebScreenshotArtifact } from "../domain/webScreenshot.js";
|
|
2
|
-
import { BrowserObservationError } from "../domain/
|
|
2
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
3
3
|
import { isMainFrameNavigation } from "./CdpCaptureEventHelpers.js";
|
|
4
4
|
import { allowedSanitizedUrl, recordValue, stringValue, } from "./CdpCaptureValues.js";
|
|
5
5
|
import { mainFrameUrl } from "./CdpCaptureDocuments.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BrowserObservationError
|
|
1
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
2
|
+
import {} from "../domain/browserObservationErrors.js";
|
|
2
3
|
import { CdpConnection } from "./CdpConnection.js";
|
|
3
4
|
import { cdpTargetWebSocket, } from "./CdpEndpoint.js";
|
|
4
5
|
/** Open one authorized target through its supported browser or page transport. */
|
|
@@ -27,8 +28,9 @@ export const closeCdpTargetSession = async (targetSession, enabledDomains, signa
|
|
|
27
28
|
try {
|
|
28
29
|
await connection.send(`${domain}.disable`, {}, sessionId, signal);
|
|
29
30
|
}
|
|
30
|
-
catch {
|
|
31
|
-
//
|
|
31
|
+
catch (cause) {
|
|
32
|
+
// best-effort cleanup: domain disable continues to detach/close boundary.
|
|
33
|
+
void cause;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
if (signal?.aborted === true) {
|
|
@@ -39,8 +41,9 @@ export const closeCdpTargetSession = async (targetSession, enabledDomains, signa
|
|
|
39
41
|
try {
|
|
40
42
|
await connection.send("Target.detachFromTarget", { sessionId }, undefined, signal);
|
|
41
43
|
}
|
|
42
|
-
catch {
|
|
43
|
-
//
|
|
44
|
+
catch (cause) {
|
|
45
|
+
// best-effort cleanup: closing REA's socket is the final cleanup boundary.
|
|
46
|
+
void cause;
|
|
44
47
|
}
|
|
45
48
|
await connection.close();
|
|
46
49
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { inferJsonShape } from "../domain/jsonShape.js";
|
|
3
3
|
import { CdpCaptureCompleteness } from "./CdpCaptureCompleteness.js";
|
|
4
|
-
import { BrowserObservationError } from "../domain/
|
|
4
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
5
5
|
import { allowedSanitizedUrl, delayWithCancellation, numberValue, recordValue, recordsValue, stringValue, } from "./CdpCaptureValues.js";
|
|
6
6
|
import { captureFrames, mainFrameUrl, walkFrameTrees, } from "./CdpCaptureDocuments.js";
|
|
7
7
|
import { optionalCdpCommand } from "./CdpOptionalCommand.js";
|
|
@@ -9,7 +9,9 @@ export const authorizedElectronFile = async (value) => {
|
|
|
9
9
|
try {
|
|
10
10
|
url = new URL(value);
|
|
11
11
|
}
|
|
12
|
-
catch {
|
|
12
|
+
catch (cause) {
|
|
13
|
+
// Non-URL input cannot authorize a local file.
|
|
14
|
+
void cause;
|
|
13
15
|
return undefined;
|
|
14
16
|
}
|
|
15
17
|
if (url.protocol !== "file:" ||
|
|
@@ -21,7 +23,9 @@ export const authorizedElectronFile = async (value) => {
|
|
|
21
23
|
try {
|
|
22
24
|
path = fileURLToPath(url);
|
|
23
25
|
}
|
|
24
|
-
catch {
|
|
26
|
+
catch (cause) {
|
|
27
|
+
// Unconvertible file URLs cannot authorize a local file.
|
|
28
|
+
void cause;
|
|
25
29
|
return undefined;
|
|
26
30
|
}
|
|
27
31
|
if (!isAbsolute(path) || path.includes("\0"))
|
|
@@ -32,7 +36,9 @@ export const authorizedElectronFile = async (value) => {
|
|
|
32
36
|
return undefined;
|
|
33
37
|
canonical = await realpath(path);
|
|
34
38
|
}
|
|
35
|
-
catch {
|
|
39
|
+
catch (cause) {
|
|
40
|
+
// Missing or unreadable files cannot authorize a local file.
|
|
41
|
+
void cause;
|
|
36
42
|
return undefined;
|
|
37
43
|
}
|
|
38
44
|
return canonical;
|
|
@@ -18,7 +18,9 @@ export const authorizeRuntimeLocation = async (value) => {
|
|
|
18
18
|
try {
|
|
19
19
|
url = new URL(value);
|
|
20
20
|
}
|
|
21
|
-
catch {
|
|
21
|
+
catch (cause) {
|
|
22
|
+
// Non-URL input is outside the authorized runtime scope.
|
|
23
|
+
void cause;
|
|
22
24
|
return { allowed: false, reason: "unsupported_location" };
|
|
23
25
|
}
|
|
24
26
|
if (!["http:", "https:"].includes(url.protocol))
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { browserScenarioCaptureSchema, classifyBrowserScenarioCompleteness, browserScenarioStepSchema, browserStepArtifactsSchema, } from "../domain/browserScenarioCapture.js";
|
|
2
|
-
import { AnalysisError
|
|
2
|
+
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
3
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
4
|
+
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
3
5
|
import { err, ok } from "../domain/result.js";
|
|
4
6
|
const OPERATION = "capture_browser_scenario";
|
|
5
7
|
let defaultFactory;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { BrowserObservationError } from "../domain/
|
|
2
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
3
3
|
const OPERATION = "capture_electron_scenario";
|
|
4
4
|
const hookEventSchema = z.strictObject({
|
|
5
5
|
sequence: z.number().int().min(1),
|