rea-agents 6.1.0 → 6.2.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 +7 -5
- package/bridge/ghidra/ReaGhidraBridge.java +32 -4
- package/bridge/hopper_bridge.py +6 -1
- package/dist/android/JadxConfiguration.js +87 -7
- package/dist/android/JadxMcpTransport.js +14 -2
- package/dist/android/JadxProvider.js +57 -35
- package/dist/application/BinaryTargetResolver.js +5 -3
- package/dist/application/BrowserEvidence.js +3 -8
- package/dist/application/BrowserScenarioEvidence.js +2 -18
- package/dist/application/CapabilityInventory.js +43 -9
- package/dist/application/ClientConfigurationDocument.js +69 -25
- package/dist/application/DirectAnalysis.js +29 -14
- package/dist/application/DirectAnalysisCleanup.js +72 -0
- package/dist/application/DirectAnalysisStatus.js +4 -5
- package/dist/application/Doctor.js +15 -19
- package/dist/application/DoctorDiagnostics.js +1 -2
- package/dist/application/EnhancedTools.js +51 -6
- package/dist/application/EvidenceBundleFiles.js +8 -3
- package/dist/application/InvestigationProviders.js +9 -1
- package/dist/application/JsonFiles.js +42 -9
- package/dist/application/LinuxHopper.js +9 -6
- package/dist/application/MacHopper.js +15 -18
- package/dist/application/RealHopperAssertions.js +0 -11
- package/dist/application/ReconstructionObligationCandidates.js +1 -1
- package/dist/application/ReferenceSourceImportEntries.js +1 -1
- package/dist/application/Setup.js +8 -16
- package/dist/application/SetupHost.js +16 -27
- package/dist/application/SetupPlan.js +6 -6
- package/dist/application/Uninstall.js +81 -29
- package/dist/application/UpdateMaintenance.js +7 -5
- package/dist/application/UpdateRuntime.js +12 -12
- package/dist/application/WebScriptExportService.js +30 -4
- package/dist/application/WorkflowEvidence.js +25 -2
- package/dist/application/XrefsAddressResolution.js +45 -0
- package/dist/application/analysisView/AnalysisViewService.js +76 -0
- package/dist/application/binary/AnalysisClientCleanup.js +30 -5
- package/dist/application/binary/AnalysisProviderEvaluation.js +1 -2
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -6
- package/dist/application/binary/AnalysisSnapshotCache.js +10 -8
- package/dist/application/binary/BinarySession.js +70 -29
- package/dist/application/binary/BinarySessionComposition.js +1 -3
- package/dist/application/binary/BinarySessionExecution.js +3 -5
- package/dist/application/binary/BinarySessionOpen.js +1 -1
- package/dist/application/binary/BinarySessionRecords.js +1 -1
- package/dist/application/binary/BinarySessionStatus.js +1 -6
- package/dist/application/binary/CompositeProvider.js +4 -18
- package/dist/application/binary/LazyAnalysisProvider.js +5 -5
- package/dist/application/binary/SessionProviderRouter.js +27 -135
- package/dist/application/homebrew.js +48 -0
- package/dist/application/javascript/ElectronActiveEvidence.js +9 -13
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +2 -6
- package/dist/application/javascript/JavaScriptApplicationService.js +6 -1
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +5 -3
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +11 -9
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +11 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +9 -0
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +8 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +12 -3
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +43 -16
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +46 -6
- package/dist/application/javascript/JavaScriptModuleRelationships.js +1 -1
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -2
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +1 -5
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +75 -46
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +42 -19
- package/dist/application/managed/ManagedMemberComparisonService.js +2 -1
- package/dist/application/managed/ManagedNativeVerificationService.js +2 -1
- package/dist/application/process/ProcessCli.js +11 -11
- package/dist/application/process/ProcessEvidence.js +0 -1
- package/dist/artifacts/ArtifactProvider.js +39 -14
- package/dist/artifacts/ArtifactReader.js +31 -0
- package/dist/artifacts/DirectoryArtifactReader.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +9 -2
- package/dist/artifacts/NativeDmgArtifactReader.js +65 -20
- package/dist/artifacts/SafeOutputTree.js +16 -2
- package/dist/artifacts/ZipArtifactReader.js +11 -4
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +4 -2
- package/dist/artifacts/apple/DylibResolutionReader.js +17 -7
- package/dist/artifacts/apple/KeyedArchiveReader.js +21 -3
- package/dist/artifacts/extraction/ArtifactExtraction.js +78 -21
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +67 -61
- package/dist/artifacts/inventory/ArtifactInventory.js +0 -1
- package/dist/artifacts/inventory/reader.js +3 -3
- package/dist/artifacts/inventory/scanCanonical.js +48 -24
- package/dist/artifacts/inventory/scanReader.js +5 -9
- package/dist/browser/BrowserScenarioPartialObservation.js +106 -0
- package/dist/browser/CdpBrowserProvider.js +2 -3
- package/dist/browser/CdpCaptureEventHandlers.js +2 -4
- package/dist/browser/CdpCaptureEvents.js +0 -1
- package/dist/browser/CdpCaptureValues.js +20 -0
- package/dist/browser/CdpElectronProvider.js +0 -2
- package/dist/browser/CdpElectronScriptEvents.js +2 -8
- package/dist/browser/CdpElectronScripts.js +2 -3
- package/dist/browser/CdpPageCaptureScripts.js +2 -3
- package/dist/browser/CdpSafeMetadata.js +10 -10
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +59 -44
- package/dist/browser/PlaywrightElectronActiveActions.js +2 -56
- package/dist/browser/PlaywrightElectronActiveProvider.js +10 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +1 -1
- package/dist/browser/PlaywrightScenarioBrowser.js +139 -39
- package/dist/browser/PlaywrightScenarioEvents.js +1 -1
- package/dist/browser/PlaywrightScenarioSession.js +39 -22
- package/dist/browser/assets/ScriptCaptureAdapters.js +1 -1
- package/dist/browser/history/CaptureFailures.js +6 -2
- package/dist/browser/history/MitmproxyCaptureAdapter.js +4 -2
- package/dist/catalogIdentity.js +0 -1
- package/dist/cli/analysisViewCommands.js +36 -0
- package/dist/cli/artifactCommands.js +11 -12
- package/dist/cli/coreAnalysisCommands.js +3 -3
- package/dist/cli/coreBinaryCommands.js +32 -27
- package/dist/cli/coreNativeCommands.js +9 -10
- package/dist/cli/electronCommands.js +4 -4
- package/dist/cli/interactiveSetup.js +6 -6
- package/dist/cli/managedCommands.js +7 -8
- package/dist/cli/nativeCallCommands.js +1 -2
- package/dist/cli/omittableDefaults.js +50 -0
- package/dist/cli/processCommands.js +3 -2
- package/dist/cli/setupCommands.js +16 -15
- package/dist/cli/utilityCommands.js +9 -9
- package/dist/cli.js +16 -8
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +1 -0
- package/dist/cliJsonInput.js +15 -1
- package/dist/cliOutput.js +0 -38
- package/dist/composition/auxiliaryAnalysisProviders.js +27 -23
- package/dist/composition/binary.js +9 -9
- package/dist/composition/browserScenario.js +2 -1
- package/dist/composition/directAnalysis.js +20 -13
- package/dist/composition/electronScenario.js +1 -1
- package/dist/composition/optionalObservationProviders.js +12 -7
- package/dist/config/environment.js +6 -0
- package/dist/config/ghidraStartupTimeout.js +4 -9
- package/dist/config/homeDirectory.js +12 -0
- package/dist/config/mcpResponseBudget.js +9 -1
- package/dist/config/parseConfig.js +7 -3
- package/dist/config/parsers.js +19 -22
- package/dist/contracts/analysisViewToolContracts.js +56 -0
- package/dist/contracts/applicationToolContracts.js +5 -4
- package/dist/contracts/artifactComparisonExample.js +2 -2
- package/dist/contracts/artifactToolContracts.js +1 -1
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +19 -15
- package/dist/contracts/enhancedInputs.js +2 -2
- package/dist/contracts/enhancedToolContracts.js +4 -3
- package/dist/contracts/evm/evmToolContracts.js +1 -1
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +90 -0
- package/dist/contracts/investigationExamples.js +4 -3
- package/dist/contracts/javascript/electronToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +0 -20
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +245 -0
- package/dist/contracts/javascript/javascriptRuntimeObservationToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +5 -10
- package/dist/contracts/managed/managedWorkflowToolContracts.js +1 -1
- package/dist/contracts/mobileApplicationGraphExamples.js +3 -3
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +1 -1
- package/dist/contracts/native/nativeToolContracts.js +2 -2
- package/dist/contracts/officialToolContracts.js +2 -1
- package/dist/contracts/promptContracts.js +2 -2
- package/dist/contracts/providerSelection.js +1 -1
- package/dist/contracts/sessionToolContracts.js +14 -2
- package/dist/contracts/sessionToolSchemas.js +1 -14
- package/dist/contracts/toolContracts.js +2 -0
- package/dist/contracts/toolEffects.js +1 -0
- package/dist/contracts/toolOutputSchemaGroups.js +136 -92
- package/dist/contracts/toolOutputSchemaPrimitives.js +11 -21
- package/dist/contracts/toolSchemaMetadata.js +18 -69
- package/dist/contracts/webNetworkCaptureToolContracts.js +1 -1
- package/dist/contracts/webRuntimeToolContracts.js +1 -1
- package/dist/contracts/webScriptToolContracts.js +1 -1
- package/dist/doctorRuntime.js +7 -5
- package/dist/domain/analysisErrorCore.js +3 -0
- package/dist/domain/analysisErrorPresentation.js +18 -3
- package/dist/domain/analysisErrorProjection.js +24 -5
- package/dist/domain/analysisSnapshot.js +29 -31
- package/dist/domain/analysisView/analysisView.js +243 -0
- package/dist/domain/analysisView/analysisViewCoverage.js +19 -0
- package/dist/domain/analysisView/binaryLayoutView.js +159 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +238 -0
- package/dist/domain/android/androidApplication.js +1 -1
- package/dist/domain/apple/appleApplication.js +1 -1
- package/dist/domain/apple/dylibResolution.js +10 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +0 -1
- package/dist/domain/apple/keyedArchive.js +26 -2
- package/dist/domain/artifactComparison.js +15 -6
- package/dist/domain/artifactGraph.js +16 -3
- package/dist/domain/artifactInventoryEvidence.js +9 -16
- package/dist/domain/artifactOperationError.js +3 -3
- package/dist/domain/artifactPartialObservation.js +1 -0
- package/dist/domain/artifactPathSyntax.js +49 -0
- package/dist/domain/binaryTarget.js +39 -13
- package/dist/domain/browserCaptureComparison.js +13 -49
- package/dist/domain/browserNetworkEvidence.js +10 -4
- package/dist/domain/browserObservation.js +0 -1
- package/dist/domain/browserObservationSchemas.js +14 -3
- package/dist/domain/browserScenario.js +0 -1
- package/dist/domain/browserScenarioCapture.js +1 -2
- package/dist/domain/browserScenarioDiff.js +0 -2
- package/dist/domain/browserScenarioDiffEvidence.js +0 -12
- package/dist/domain/browserScenarioDiffValues.js +2 -2
- package/dist/domain/browserScenarioValues.js +3 -4
- package/dist/domain/callPath.js +8 -9
- package/dist/domain/callPathSchemas.js +2 -2
- package/dist/domain/changedBehavior.js +3 -3
- package/dist/domain/completionLedgerGeneration.js +2 -1
- package/dist/domain/configurationErrors.js +12 -0
- package/dist/domain/conformancePackage.js +4 -3
- package/dist/domain/evidence.js +10 -36
- package/dist/domain/evidenceBundle.js +7 -9
- package/dist/domain/evidenceCompletionLedger.js +2 -1
- package/dist/domain/functionComparison.js +4 -5
- package/dist/domain/functionComparisonDimensions.js +120 -87
- package/dist/domain/functionComparisonNormalization.js +23 -34
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/functionComparisonSchemas.js +2 -8
- package/dist/domain/functionDossierEvidence.js +2 -37
- package/dist/domain/javascript/electronActiveObservation.js +26 -69
- package/dist/domain/javascript/electronObservation.js +14 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +10 -9
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +2 -1
- package/dist/domain/javascript/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +2 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +26 -3
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +9 -2
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +5 -2
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +2 -1
- package/dist/{application/javascript/JavaScriptReturnShapeProjection.js → domain/javascript/javascriptExportReturnShapeProjection.js} +4 -4
- package/dist/domain/javascript/javascriptExportShapeComparison.js +7 -1
- package/dist/domain/javascript/javascriptExportShapeComparisonIdentity.js +6 -1
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +29 -1
- package/dist/domain/javascript/javascriptExportShapeSelection.js +5 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +67 -14
- package/dist/domain/javascript/javascriptFeatureSeed.js +20 -0
- package/dist/domain/javascript/javascriptFeatureTraversal.js +0 -1
- package/dist/domain/javascript/javascriptNativeHandoff.js +1 -1
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeObservation.js +10 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +1 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +3 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +0 -1
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +9 -3
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +2 -1
- package/dist/domain/javascript/javascriptSemanticCalls.js +2 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +1 -1
- package/dist/domain/javascript/javascriptSemanticGraph.js +88 -46
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +77 -20
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +21 -27
- package/dist/domain/javascript/javascriptSemanticObjects.js +83 -42
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +1 -12
- package/dist/domain/javascript/javascriptSemanticProjection.js +2 -3
- package/dist/domain/javascript/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +1 -1
- package/dist/domain/javascript/javascriptSemanticResources.js +1 -1
- package/dist/domain/javascript/javascriptSemanticReturns.js +32 -17
- package/dist/domain/javascript/javascriptSemanticSlots.js +72 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +47 -54
- package/dist/domain/javascript/javascriptSourceMapPaths.js +104 -0
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +2 -1
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +0 -1
- package/dist/domain/javascript/sourceToBundleComparison.js +12 -3
- package/dist/domain/javascript/sourceToBundleSignals.js +47 -19
- package/dist/domain/localPath.js +1 -1
- package/dist/domain/managed/managedArtifact.js +6 -4
- package/dist/domain/managed/managedMemberComparison.js +2 -9
- package/dist/domain/managed/managedNativeVerification.js +0 -2
- package/dist/domain/managed/managedNativeVerificationMatch.js +9 -3
- package/dist/domain/native/binaryLayout.js +2 -3
- package/dist/domain/native/nativeApiBoundary.js +1 -1
- package/dist/domain/native/nativeCallObservation.js +5 -3
- package/dist/domain/native/nativeInstruction.js +7 -0
- package/dist/domain/native/recordedCrash.js +2 -3
- package/dist/domain/offsetDateTime.js +17 -0
- package/dist/domain/process/processCapture.js +13 -12
- package/dist/domain/process/processCaptureCoverage.js +67 -0
- package/dist/domain/process/processCaptureExample.js +2 -1
- package/dist/domain/process/processCaptureParsing.js +1 -34
- package/dist/domain/process/processCaptureValidation.js +81 -13
- package/dist/domain/process/processComparison.js +41 -22
- package/dist/domain/process/processObservation.js +10 -2
- package/dist/domain/process/processScenario.js +24 -2
- package/dist/domain/process/processTraceComparison.js +0 -2
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +15 -11
- package/dist/domain/process/processTraceSpecification.js +3 -4
- package/dist/domain/providerAdapterError.js +2 -0
- package/dist/domain/reconstructionCoverage.js +5 -2
- package/dist/domain/reconstructionObligationLedgerSchemas.js +2 -1
- package/dist/domain/reconstructionReadinessSchemas.js +2 -1
- package/dist/domain/reconstructionVerification.js +3 -3
- package/dist/domain/reconstructionVerificationSchemas.js +2 -1
- package/dist/domain/referenceSourceGraph.js +20 -21
- package/dist/domain/staticRuntimeCorrelation.js +2 -2
- package/dist/domain/stringPatterns.js +6 -0
- package/dist/domain/swiftSymbolClassification.js +61 -0
- package/dist/domain/symbolAnalysis.js +66 -18
- package/dist/domain/webCaptureDiff.js +0 -1
- package/dist/domain/webCaptureDiffSchemas.js +6 -3
- package/dist/domain/webEventListeners.js +3 -2
- package/dist/domain/webExecution.js +3 -2
- package/dist/domain/webRuntime.js +0 -2
- package/dist/domain/webScriptExport.js +1 -1
- package/dist/dotnet/ManagedArtifactInspector.js +2 -19
- package/dist/dotnet/ManagedMemberInspector.js +12 -18
- package/dist/dotnet/ManagedMemberInspectorCore.js +47 -44
- package/dist/dotnet/ManagedMemberRows.js +75 -62
- package/dist/dotnet/ManagedMetadataInventory.js +16 -22
- package/dist/dotnet/ManagedMethodBodyReader.js +4 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +109 -94
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +12 -21
- package/dist/dotnet/ManagedReaderFailure.js +16 -0
- package/dist/dotnet/ManagedStaticProvider.js +3 -5
- package/dist/evaluation/AgentEvaluationFixtures.js +250 -0
- package/dist/evaluation/AgentEvaluationReport.js +28 -0
- package/dist/evaluation/CodexAgentEval.js +12 -8
- package/dist/evaluation/KnownAnswerEvaluation.js +281 -0
- package/dist/evm/EvmoleInterfaceProvider.js +2 -1
- package/dist/firmware/FirmwareCommand.js +9 -5
- package/dist/firmware/FirmwareProvider.js +4 -4
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +3 -6
- package/dist/ghidra/GhidraClient.js +91 -32
- package/dist/ghidra/GhidraClientStartup.js +0 -2
- package/dist/ghidra/GhidraDoctor.js +6 -5
- package/dist/ghidra/GhidraFunctionValues.js +3 -5
- package/dist/ghidra/GhidraInstallation.js +40 -12
- package/dist/ghidra/GhidraJavaLaunch.js +6 -2
- package/dist/ghidra/GhidraLauncher.js +15 -7
- package/dist/ghidra/GhidraProvider.js +6 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +6 -0
- package/dist/ghidra/GhidraProviderClient.js +13 -3
- package/dist/ghidra/GhidraSessionError.js +2 -0
- package/dist/ghidra/GhidraSessionRoot.js +39 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +17 -10
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +8 -2
- package/dist/hopper/BridgeLauncher.js +34 -45
- package/dist/hopper/HopperAnalysisProfile.js +3 -8
- package/dist/hopper/HopperCleanup.js +56 -27
- package/dist/hopper/HopperClient.js +86 -65
- package/dist/hopper/HopperMachOImage.js +3 -2
- package/dist/hopper/HopperProvider.js +16 -18
- package/dist/hopper/HopperRegexSearch.js +3 -6
- package/dist/hopper/HopperTargetLease.js +132 -49
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -0
- package/dist/ida/IdaConfiguration.js +8 -3
- package/dist/ida/IdaInput.js +1 -7
- package/dist/ida/IdaMcpConnection.js +8 -4
- package/dist/ida/IdaOperationRunner.js +3 -3
- package/dist/ida/IdaProvider.js +8 -12
- package/dist/ida/IdaSessionClient.js +20 -18
- package/dist/ida/IdaWorkspace.js +12 -13
- package/dist/inspector/V8InspectorCaptureProjection.js +1 -1
- package/dist/inspector/V8InspectorProvider.js +38 -28
- package/dist/javascript/recovery/WakaruCommand.js +7 -2
- package/dist/javascript/recovery/WakaruExecution.js +5 -2
- package/dist/main/shutdown.js +11 -3
- package/dist/main/startup.js +9 -2
- package/dist/main/transport.js +22 -2
- package/dist/main.js +11 -18
- package/dist/native/AppleMachoSelection.js +16 -6
- package/dist/native/CommandRunner.js +9 -7
- package/dist/native/LldbCallTracer.js +8 -2
- package/dist/native/NativeMacOSProvider.js +25 -15
- package/dist/native/NativeUiHelperRuntime.js +11 -2
- package/dist/native/NativeUiObservation.js +2 -2
- package/dist/native/pwntools/PwntoolsDecoder.js +2 -1
- package/dist/process/DarwinProcessRunTokenReader.js +16 -2
- package/dist/process/ExecFileOutput.js +88 -6
- package/dist/process/PrivateRuntimeRoot.js +10 -5
- package/dist/process/ProcessOwnership.js +1 -4
- package/dist/process/ProcessOwnershipObservation.js +11 -5
- package/dist/process/ProviderProcess.js +1 -3
- package/dist/process/capture/FilesystemSnapshot.js +50 -13
- package/dist/process/capture/ProcessCaptureError.js +13 -0
- package/dist/process/capture/ProcessCaptureLifecycle.js +158 -70
- package/dist/process/capture/ProcessFilesystemEffects.js +33 -3
- package/dist/process/capture/ProcessHarness.js +21 -25
- package/dist/process/capture/ProcessNormalization.js +20 -2
- package/dist/process/capture/ProcessSampling.js +25 -2
- package/dist/process/capture/TerminalRenderer.js +14 -0
- package/dist/process/snapshotEnvironment.js +14 -0
- package/dist/server/EvidenceMcpServer.js +25 -14
- package/dist/server/createServer.js +49 -36
- package/dist/server/mcpClientMetadata.js +12 -5
- package/dist/server/promptCompletion.js +3 -8
- package/dist/server/registerAnalysisViewTool.js +15 -0
- package/dist/server/registerAndroidTools.js +2 -3
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -5
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +4 -5
- package/dist/server/registerApplicationTools/coverage.js +1 -2
- package/dist/server/registerApplicationTools/helpers.js +1 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +4 -5
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -4
- package/dist/server/registerApplicationTools/traceFeature.js +4 -5
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +4 -5
- package/dist/server/registerBinaryDiagnosticsTools.js +2 -3
- package/dist/server/registerBrowserScenarioTool.js +3 -4
- package/dist/server/registerBrowserTools.js +13 -16
- package/dist/server/registerBundleComparisonTool.js +5 -6
- package/dist/server/registerCloseLifecycleTool.js +2 -3
- package/dist/server/registerElectronTools.js +10 -13
- package/dist/server/registerEnhancedTools.js +23 -23
- package/dist/server/registerEvidenceTools.js +3 -4
- package/dist/server/registerEvmTools.js +2 -3
- package/dist/server/registerFirmwareTools.js +2 -3
- package/dist/server/registerFunctionComparisonTool.js +7 -8
- package/dist/server/registerInvestigationTools.js +14 -15
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -3
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +6 -6
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +5 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +4 -5
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +6 -7
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +6 -7
- package/dist/server/registerOfficialTools.js +4 -19
- package/dist/server/registerProcessComparisonTool.js +8 -8
- package/dist/server/registerRecordedCrashTools.js +2 -3
- package/dist/server/registerSessionRecordTools.js +15 -19
- package/dist/server/registerSessionStatusTool.js +3 -4
- package/dist/server/registerSessionTools.js +12 -18
- package/dist/server/registerWebModuleTool.js +2 -3
- package/dist/server/registerWebNetworkCaptureTool.js +2 -3
- package/dist/server/registerWebRuntimeTools.js +4 -5
- package/dist/server/registerWebScriptTool.js +2 -3
- package/dist/server/registerWebSourceLocationTool.js +2 -3
- package/dist/server/toolResult.js +66 -94
- package/dist/server/toolResultEncoding.js +11 -10
- package/dist/windows/WindowsNativeLoader.js +1 -0
- package/dist/windows/WindowsOwnedProcess.js +60 -15
- package/dist/windows/WindowsPrivateRuntime.js +7 -8
- package/native/windows/README.md +3 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +39 -30
- package/scripts/rea.mjs +3 -6
- package/skills/reverse-engineer-anything/SKILL.md +9 -8
- package/skills/reverse-engineer-anything/references/android-applications.md +6 -3
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +16 -6
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +9 -0
- package/dist/config.js +0 -1
- package/dist/contracts/browserCaptureToolInputSchema.js +0 -43
- package/dist/contracts/process/processCaptureExample.js +0 -2
- package/dist/contracts/toolOutputSchemas.js +0 -2
- package/dist/main/reload.js +0 -12
- package/dist/main/state.js +0 -3
- package/dist/server/sessionToolPolicies.js +0 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { compareCodePoints } from "../../domain/canonicalOrdering.js";
|
|
1
2
|
import { canonicalDigest } from "../../domain/comparisonSemantics.js";
|
|
2
3
|
import { artifactEdgeId, artifactIdForContent, occurrenceIdForLocation, } from "../../domain/artifactIdentity.js";
|
|
3
|
-
import { zipPackageFormatForPath } from "../../domain/zipPackageFormat.js";
|
|
4
|
+
import { hasZipSignature, zipPackageFormatForPath, } from "../../domain/zipPackageFormat.js";
|
|
4
5
|
import { mzWindowsHeaderOffset, parseDosMzHeader } from "../../domain/dosMz.js";
|
|
5
6
|
/** Index the first occurrence for each canonical logical path. */
|
|
6
7
|
export const indexOccurrencesByPath = (occurrences) => {
|
|
@@ -16,6 +17,14 @@ export const createOccurrence = (entry, path, parent) => ({
|
|
|
16
17
|
parent_occurrence_id: parent,
|
|
17
18
|
logical_path: path,
|
|
18
19
|
entry_kind: entry.kind,
|
|
20
|
+
artifact_kind: entry.kind === "directory"
|
|
21
|
+
? path.toLowerCase().endsWith(".framework")
|
|
22
|
+
? "framework"
|
|
23
|
+
: "container"
|
|
24
|
+
: classifyArtifactPath(path).kind,
|
|
25
|
+
artifact_format: entry.kind === "directory"
|
|
26
|
+
? "directory"
|
|
27
|
+
: classifyArtifactPath(path).format,
|
|
19
28
|
declared_size: entry.declaredSize,
|
|
20
29
|
compressed_size: entry.compressedSize,
|
|
21
30
|
executable: entry.executable,
|
|
@@ -26,15 +35,8 @@ export const createOccurrence = (entry, path, parent) => ({
|
|
|
26
35
|
: { offset: entry.byteOffset, length: entry.declaredSize },
|
|
27
36
|
limitations: [...entry.limitations],
|
|
28
37
|
});
|
|
29
|
-
/**
|
|
30
|
-
export const compareDirectoryChildNames =
|
|
31
|
-
const collated = left.localeCompare(right);
|
|
32
|
-
if (collated !== 0)
|
|
33
|
-
return collated;
|
|
34
|
-
if (left < right)
|
|
35
|
-
return -1;
|
|
36
|
-
return left > right ? 1 : 0;
|
|
37
|
-
};
|
|
38
|
+
/** Compare exact child names independently of host locale and traversal order. */
|
|
39
|
+
export const compareDirectoryChildNames = compareCodePoints;
|
|
38
40
|
export const materializeDirectoryNodes = (occurrences, nodes) => {
|
|
39
41
|
const directories = occurrences
|
|
40
42
|
.filter(({ entry_kind: kind }) => kind === "directory")
|
|
@@ -61,15 +63,10 @@ export const materializeDirectoryNodes = (occurrences, nodes) => {
|
|
|
61
63
|
const node = createArtifactNode({
|
|
62
64
|
sha256: canonicalDigest({ kind: "directory", children }, "Artifact"),
|
|
63
65
|
size: 0,
|
|
64
|
-
kind: directory.logical_path.toLowerCase().endsWith(".framework")
|
|
65
|
-
? "framework"
|
|
66
|
-
: "container",
|
|
67
66
|
format: "directory",
|
|
68
|
-
executable: false,
|
|
69
67
|
contentState: "virtual",
|
|
70
68
|
});
|
|
71
|
-
|
|
72
|
-
nodes.set(node.artifact_id, existing?.kind === "framework" ? existing : node);
|
|
69
|
+
nodes.set(node.artifact_id, node);
|
|
73
70
|
directory.artifact_id = node.artifact_id;
|
|
74
71
|
directory.hash_status = "verified";
|
|
75
72
|
}
|
|
@@ -78,47 +75,47 @@ export const createRootNode = (input) => createArtifactNode({
|
|
|
78
75
|
sha256: input.digest?.sha256 ??
|
|
79
76
|
canonicalDigest({
|
|
80
77
|
kind: "directory-root",
|
|
81
|
-
children: input.occurrences
|
|
78
|
+
children: input.occurrences
|
|
79
|
+
.map(({ logical_path, artifact_id }) => ({
|
|
82
80
|
logical_path,
|
|
83
81
|
artifact_id,
|
|
84
|
-
}))
|
|
82
|
+
}))
|
|
83
|
+
.sort((left, right) => compareDirectoryChildNames(left.logical_path, right.logical_path)),
|
|
85
84
|
}, "Artifact"),
|
|
86
85
|
size: input.digest?.bytes ?? 0,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
: input.format === "dos-mz"
|
|
91
|
-
? "executable"
|
|
92
|
-
: classifyArtifactPath(input.path).kind,
|
|
93
|
-
format: input.format,
|
|
94
|
-
executable: false,
|
|
86
|
+
format: input.digest === null
|
|
87
|
+
? "directory"
|
|
88
|
+
: classifyArtifactBytes(input.digest.prefix, input.digest.bytes),
|
|
95
89
|
contentState: "materialized",
|
|
96
90
|
});
|
|
97
91
|
export const createArtifactNode = (input) => ({
|
|
98
92
|
artifact_id: artifactIdForContent(input.sha256),
|
|
99
|
-
kind: input.kind,
|
|
100
93
|
format: input.format,
|
|
101
94
|
sha256: input.sha256,
|
|
102
95
|
size: input.size,
|
|
103
96
|
media_type: null,
|
|
104
97
|
architecture: null,
|
|
105
|
-
executable: input.executable,
|
|
106
98
|
content_state: input.contentState,
|
|
107
|
-
limitations: [
|
|
99
|
+
limitations: [],
|
|
108
100
|
});
|
|
109
|
-
export const rootOccurrenceFor = (node,
|
|
101
|
+
export const rootOccurrenceFor = (node, metadata) => ({
|
|
110
102
|
occurrence_id: occurrenceIdForLocation({
|
|
111
103
|
rootArtifactId: node.artifact_id,
|
|
112
104
|
logicalPath: ".",
|
|
113
|
-
entryKind:
|
|
105
|
+
entryKind: metadata.format === "directory" ? "directory" : "file",
|
|
114
106
|
}),
|
|
115
107
|
artifact_id: node.artifact_id,
|
|
116
108
|
parent_occurrence_id: null,
|
|
117
109
|
logical_path: ".",
|
|
118
|
-
entry_kind:
|
|
119
|
-
|
|
110
|
+
entry_kind: metadata.format === "directory" ? "directory" : "file",
|
|
111
|
+
artifact_kind: metadata.format === "directory" ||
|
|
112
|
+
["zip", "ipa", "apk", "msix", "appx", "asar", "dmg", "pkg"].includes(metadata.format)
|
|
113
|
+
? "container"
|
|
114
|
+
: artifactRoleForFormat(metadata.path, metadata.format).kind,
|
|
115
|
+
artifact_format: metadata.format,
|
|
116
|
+
declared_size: metadata.size,
|
|
120
117
|
compressed_size: null,
|
|
121
|
-
executable:
|
|
118
|
+
executable: metadata.executable,
|
|
122
119
|
encrypted: false,
|
|
123
120
|
hash_status: "verified",
|
|
124
121
|
source_location: null,
|
|
@@ -211,34 +208,48 @@ export const classifyArtifactPath = (path) => {
|
|
|
211
208
|
};
|
|
212
209
|
/** Classify executable formats from bytes while retaining path-specific roles. */
|
|
213
210
|
export const classifyArtifactContent = (path, prefix, fileSize = prefix.length) => {
|
|
211
|
+
return artifactRoleForFormat(path, classifyArtifactBytes(prefix, fileSize));
|
|
212
|
+
};
|
|
213
|
+
const artifactRoleForFormat = (path, format) => {
|
|
214
214
|
const byPath = classifyArtifactPath(path);
|
|
215
|
+
if (format === "file" || format === byPath.format)
|
|
216
|
+
return byPath;
|
|
217
|
+
if (format === "unknown")
|
|
218
|
+
return { kind: "unknown", format };
|
|
219
|
+
if (format === "zip")
|
|
220
|
+
return {
|
|
221
|
+
kind: "container",
|
|
222
|
+
format: zipPackageFormatForPath(path) ?? format,
|
|
223
|
+
};
|
|
224
|
+
if (format === "plist")
|
|
225
|
+
return { kind: "plist", format };
|
|
226
|
+
return {
|
|
227
|
+
kind: ["native-addon", "dynamic-library"].includes(byPath.kind)
|
|
228
|
+
? byPath.kind
|
|
229
|
+
: "executable",
|
|
230
|
+
format,
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
/** Classify storage bytes independently of path names, roles, and permissions. */
|
|
234
|
+
export const classifyArtifactBytes = (prefix, fileSize = prefix.length) => {
|
|
235
|
+
if (hasZipSignature(prefix))
|
|
236
|
+
return "zip";
|
|
237
|
+
if (prefix.subarray(0, 8).equals(Buffer.from("bplist00")))
|
|
238
|
+
return "plist";
|
|
215
239
|
if (prefix.length >= 4) {
|
|
216
240
|
const magic = prefix.readUInt32BE(0);
|
|
217
241
|
if ([0xcafebabe, 0xbebafeca, 0xcafebabf, 0xbfbafeca].includes(magic))
|
|
218
|
-
return
|
|
219
|
-
kind: byPath.kind === "native-addon" ? "native-addon" : "executable",
|
|
220
|
-
format: "mach-o-universal",
|
|
221
|
-
};
|
|
242
|
+
return "mach-o-universal";
|
|
222
243
|
if ([0xfeedface, 0xfeedfacf, 0xcefaedfe, 0xcffaedfe].includes(magic))
|
|
223
|
-
return
|
|
224
|
-
kind: ["native-addon", "dynamic-library"].includes(byPath.kind)
|
|
225
|
-
? byPath.kind
|
|
226
|
-
: "executable",
|
|
227
|
-
format: "mach-o",
|
|
228
|
-
};
|
|
244
|
+
return "mach-o";
|
|
229
245
|
if (prefix.subarray(0, 4).equals(Buffer.from([0x7f, 0x45, 0x4c, 0x46])))
|
|
230
|
-
return
|
|
231
|
-
kind: ["native-addon", "dynamic-library"].includes(byPath.kind)
|
|
232
|
-
? byPath.kind
|
|
233
|
-
: "executable",
|
|
234
|
-
format: "elf",
|
|
235
|
-
};
|
|
246
|
+
return "elf";
|
|
236
247
|
}
|
|
237
248
|
if (prefix.length >= 2 && prefix[0] === 0x4d && prefix[1] === 0x5a) {
|
|
238
249
|
if (!Number.isSafeInteger(fileSize) ||
|
|
239
250
|
fileSize < prefix.length ||
|
|
240
251
|
prefix.length < Math.min(fileSize, 64))
|
|
241
|
-
return
|
|
252
|
+
return "unknown";
|
|
242
253
|
const windowsOffset = mzWindowsHeaderOffset(prefix);
|
|
243
254
|
if (windowsOffset !== null) {
|
|
244
255
|
if (windowsOffset >= 64 &&
|
|
@@ -246,18 +257,13 @@ export const classifyArtifactContent = (path, prefix, fileSize = prefix.length)
|
|
|
246
257
|
prefix
|
|
247
258
|
.subarray(windowsOffset, windowsOffset + 4)
|
|
248
259
|
.equals(Buffer.from([0x50, 0x45, 0, 0])))
|
|
249
|
-
return
|
|
250
|
-
kind: byPath.kind === "native-addon" ? "native-addon" : "executable",
|
|
251
|
-
format: "pe",
|
|
252
|
-
};
|
|
260
|
+
return "pe";
|
|
253
261
|
}
|
|
254
|
-
else if (parseDosMzHeader(prefix, fileSize).ok)
|
|
255
|
-
return
|
|
256
|
-
|
|
257
|
-
// Missing bounded evidence and malformed MZ bytes both remain unclassified.
|
|
258
|
-
return { kind: "unknown", format: "unknown" };
|
|
262
|
+
else if (parseDosMzHeader(prefix, fileSize).ok)
|
|
263
|
+
return "dos-mz";
|
|
264
|
+
return "unknown";
|
|
259
265
|
}
|
|
260
|
-
return
|
|
266
|
+
return "file";
|
|
261
267
|
};
|
|
262
268
|
const relationFor = (path) => {
|
|
263
269
|
const lower = path.toLowerCase();
|
|
@@ -2,7 +2,6 @@ import { realpath } from "node:fs/promises";
|
|
|
2
2
|
import { artifactInventoryResultSchema, } from "../../domain/artifactGraph.js";
|
|
3
3
|
import { abortIfNeeded } from "../ArtifactHash.js";
|
|
4
4
|
import { scanCanonicalArtifactInventory } from "./scanCanonical.js";
|
|
5
|
-
export { scanCanonicalArtifactInventory } from "./scanCanonical.js";
|
|
6
5
|
/** Inventory one local artifact and return every graph collection inline. */
|
|
7
6
|
export const inventoryArtifact = async (inputPath, options = {}) => {
|
|
8
7
|
const snapshot = await scanArtifactInventory(inputPath, options);
|
|
@@ -3,7 +3,7 @@ import { DirectoryArtifactReader } from "../DirectoryArtifactReader.js";
|
|
|
3
3
|
import { MachOSliceArtifactReader } from "../MachOSliceArtifactReader.js";
|
|
4
4
|
import { NativeDmgArtifactReader } from "../NativeDmgArtifactReader.js";
|
|
5
5
|
import { ZipArtifactReader } from "../ZipArtifactReader.js";
|
|
6
|
-
export const createReader = async (path, format, signal) => {
|
|
6
|
+
export const createReader = async (path, format, environment, signal) => {
|
|
7
7
|
switch (format) {
|
|
8
8
|
case "directory":
|
|
9
9
|
return new DirectoryArtifactReader(path);
|
|
@@ -17,12 +17,12 @@ export const createReader = async (path, format, signal) => {
|
|
|
17
17
|
return new AsarArtifactReader(path);
|
|
18
18
|
case "mach-o-universal":
|
|
19
19
|
return process.platform === "darwin"
|
|
20
|
-
? new MachOSliceArtifactReader(path)
|
|
20
|
+
? new MachOSliceArtifactReader(path, environment)
|
|
21
21
|
: undefined;
|
|
22
22
|
case "dmg":
|
|
23
23
|
if (process.platform !== "darwin")
|
|
24
24
|
return undefined;
|
|
25
|
-
return NativeDmgArtifactReader.create(path, signal);
|
|
25
|
+
return NativeDmgArtifactReader.create(path, environment, signal);
|
|
26
26
|
default:
|
|
27
27
|
return undefined;
|
|
28
28
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { compareCodePoints } from "../../domain/canonicalOrdering.js";
|
|
1
2
|
import { createReadStream } from "node:fs";
|
|
2
3
|
import { lstat } from "node:fs/promises";
|
|
3
4
|
import { ArtifactReaderFailure, } from "../ArtifactReader.js";
|
|
@@ -9,45 +10,64 @@ import { hashReadable } from "../ArtifactHash.js";
|
|
|
9
10
|
import { createReader, inventoryLimitations } from "./reader.js";
|
|
10
11
|
import { scanReader, } from "./scanReader.js";
|
|
11
12
|
import { STRICT_INTEGRITY_POLICY, } from "./types.js";
|
|
12
|
-
export const scanCanonicalArtifactInventory = async (path, options = {}) => {
|
|
13
|
+
export const scanCanonicalArtifactInventory = async (path, options = {}, readerFactory = createReader) => {
|
|
13
14
|
const integrity = options.integrity ?? STRICT_INTEGRITY_POLICY;
|
|
14
15
|
const metadata = await lstat(path);
|
|
15
16
|
const rootFormat = await classifyRoot(path, metadata.isDirectory());
|
|
16
17
|
const rootDigest = metadata.isDirectory()
|
|
17
18
|
? null
|
|
18
19
|
: await hashReadable(createReadStream(path), options.signal);
|
|
19
|
-
const reader = await
|
|
20
|
+
const reader = await readerFactory(path, rootFormat, options.environment ?? {}, options.signal);
|
|
21
|
+
let outcome;
|
|
20
22
|
try {
|
|
21
23
|
const { nodes, occurrences, pendingContradictions } = await scanReader(reader, options.signal, integrity);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
outcome = {
|
|
25
|
+
kind: "completed",
|
|
26
|
+
snapshot: await buildInventorySnapshot({
|
|
27
|
+
path,
|
|
28
|
+
metadata,
|
|
29
|
+
rootFormat,
|
|
30
|
+
rootDigest,
|
|
31
|
+
reader,
|
|
32
|
+
signal: options.signal,
|
|
33
|
+
nodes,
|
|
34
|
+
occurrences,
|
|
35
|
+
pendingContradictions,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
33
38
|
}
|
|
34
|
-
|
|
39
|
+
catch (cause) {
|
|
40
|
+
outcome = { kind: "failed", cause };
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
35
43
|
await reader?.close();
|
|
36
44
|
}
|
|
45
|
+
catch (cleanupCause) {
|
|
46
|
+
const cleanup = ArtifactReaderFailure.cleanupObservation(cleanupCause, `artifact reader for ${path}`);
|
|
47
|
+
const primary = outcome.kind === "failed" ? outcome.cause : cleanupCause;
|
|
48
|
+
throw ArtifactReaderFailure.withCleanup(primary, cleanup, outcome.kind === "completed"
|
|
49
|
+
? { kind: "artifact-inventory", inventory: outcome.snapshot }
|
|
50
|
+
: undefined);
|
|
51
|
+
}
|
|
52
|
+
if (outcome.kind === "failed")
|
|
53
|
+
throw outcome.cause;
|
|
54
|
+
return outcome.snapshot;
|
|
37
55
|
};
|
|
38
56
|
const buildInventorySnapshot = async (input) => {
|
|
39
57
|
const { path, metadata, rootFormat, rootDigest, reader, signal } = input;
|
|
40
58
|
materializeDirectoryNodes(input.occurrences, input.nodes);
|
|
41
59
|
const rootNode = createRootNode({
|
|
42
|
-
path,
|
|
43
|
-
format: rootFormat,
|
|
44
|
-
directory: metadata.isDirectory(),
|
|
45
60
|
digest: rootDigest,
|
|
46
61
|
occurrences: input.occurrences,
|
|
47
62
|
});
|
|
48
63
|
input.nodes.set(rootNode.artifact_id, rootNode);
|
|
49
64
|
rekeyOccurrences(rootNode.artifact_id, input.occurrences);
|
|
50
|
-
const rootOccurrence = rootOccurrenceFor(rootNode,
|
|
65
|
+
const rootOccurrence = rootOccurrenceFor(rootNode, {
|
|
66
|
+
size: metadata.size,
|
|
67
|
+
executable: (metadata.mode & 0o111) !== 0,
|
|
68
|
+
format: rootFormat,
|
|
69
|
+
path,
|
|
70
|
+
});
|
|
51
71
|
for (const occurrence of input.occurrences)
|
|
52
72
|
if (occurrence.parent_occurrence_id === null)
|
|
53
73
|
occurrence.parent_occurrence_id = rootOccurrence.occurrence_id;
|
|
@@ -61,7 +81,10 @@ const buildInventorySnapshot = async (input) => {
|
|
|
61
81
|
const edges = createArtifactEdges(rootNode.artifact_id, input.occurrences, reader?.provenance()[0]);
|
|
62
82
|
const orderedNodes = sortNodes([...input.nodes.values()]);
|
|
63
83
|
const orderedOccurrences = sortOccurrences(input.occurrences);
|
|
64
|
-
const orderedEdges = sortEdges(edges)
|
|
84
|
+
const orderedEdges = sortEdges(edges).map((edge, ordinal) => ({
|
|
85
|
+
...edge,
|
|
86
|
+
ordinal,
|
|
87
|
+
}));
|
|
65
88
|
await verifyRootDigest(path, rootDigest, signal);
|
|
66
89
|
const graphSha256 = artifactGraphDigest({
|
|
67
90
|
nodes: orderedNodes,
|
|
@@ -71,6 +94,7 @@ const buildInventorySnapshot = async (input) => {
|
|
|
71
94
|
});
|
|
72
95
|
const manifest = buildManifest({
|
|
73
96
|
rootNode,
|
|
97
|
+
rootFormat,
|
|
74
98
|
graphSha256,
|
|
75
99
|
orderedNodes,
|
|
76
100
|
orderedOccurrences,
|
|
@@ -123,14 +147,14 @@ const verifyRootDigest = async (path, rootDigest, signal) => {
|
|
|
123
147
|
verified.bytes !== rootDigest.bytes)
|
|
124
148
|
throw new ArtifactReaderFailure("integrity", "Root artifact changed during inventory");
|
|
125
149
|
};
|
|
126
|
-
const sortNodes = (nodes) => nodes.sort((left, right) => left.artifact_id
|
|
127
|
-
const sortOccurrences = (occurrences) => occurrences.sort((left, right) => left.logical_path
|
|
128
|
-
const sortEdges = (edges) => edges.sort((left, right) => left.edge_id
|
|
129
|
-
const buildManifest = ({ rootNode, graphSha256, orderedNodes, orderedOccurrences, orderedEdges, }) => artifactInventoryResultSchema.shape.manifest.parse({
|
|
150
|
+
const sortNodes = (nodes) => nodes.sort((left, right) => compareCodePoints(left.artifact_id, right.artifact_id));
|
|
151
|
+
const sortOccurrences = (occurrences) => occurrences.sort((left, right) => compareCodePoints(left.logical_path, right.logical_path));
|
|
152
|
+
const sortEdges = (edges) => edges.sort((left, right) => compareCodePoints(left.edge_id, right.edge_id));
|
|
153
|
+
const buildManifest = ({ rootNode, rootFormat, graphSha256, orderedNodes, orderedOccurrences, orderedEdges, }) => artifactInventoryResultSchema.shape.manifest.parse({
|
|
130
154
|
manifest_id: artifactManifestId(rootNode.artifact_id, graphSha256),
|
|
131
155
|
root_artifact_id: rootNode.artifact_id,
|
|
132
156
|
root_sha256: rootNode.sha256,
|
|
133
|
-
root_format:
|
|
157
|
+
root_format: rootFormat,
|
|
134
158
|
graph_sha256: graphSha256,
|
|
135
159
|
node_count: orderedNodes.length,
|
|
136
160
|
occurrence_count: orderedOccurrences.length,
|
|
@@ -2,7 +2,7 @@ import { isAbsolute } from "node:path";
|
|
|
2
2
|
import { ArtifactPathRegistry, normalizeArtifactPath, } from "../ArtifactPaths.js";
|
|
3
3
|
import { ArtifactReaderFailure, } from "../ArtifactReader.js";
|
|
4
4
|
import { AsarArtifactReader } from "../AsarArtifactReader.js";
|
|
5
|
-
import { classifyArtifactContent, createArtifactNode, createOccurrence, nearestParent, } from "./ArtifactGraphConstruction.js";
|
|
5
|
+
import { classifyArtifactContent, classifyArtifactBytes, createArtifactNode, createOccurrence, nearestParent, } from "./ArtifactGraphConstruction.js";
|
|
6
6
|
import { STRICT_INTEGRITY_POLICY, } from "./types.js";
|
|
7
7
|
import { hashReadable } from "../ArtifactHash.js";
|
|
8
8
|
const UNAVAILABLE_UNPACKED_LIMITATION = "ASAR unpacked companion bytes were unavailable; no content hash or child artifact was produced.";
|
|
@@ -71,6 +71,8 @@ const visitArtifactEntries = async (context, currentReader, prefix) => {
|
|
|
71
71
|
if (digested !== undefined) {
|
|
72
72
|
context.nodes.set(digested.node.artifact_id, digested.node);
|
|
73
73
|
occurrence.artifact_id = digested.node.artifact_id;
|
|
74
|
+
occurrence.artifact_kind = digested.classification.kind;
|
|
75
|
+
occurrence.artifact_format = digested.classification.format;
|
|
74
76
|
occurrence.hash_status = digested.mismatched
|
|
75
77
|
? "mismatched"
|
|
76
78
|
: "verified";
|
|
@@ -129,17 +131,11 @@ const digestArtifactEntry = async (context, currentReader, entry, logicalPath) =
|
|
|
129
131
|
node: createArtifactNode({
|
|
130
132
|
sha256: digest.sha256,
|
|
131
133
|
size: digest.bytes,
|
|
132
|
-
|
|
133
|
-
format: classified.format,
|
|
134
|
-
executable: entry.executable,
|
|
134
|
+
format: classifyArtifactBytes(digest.prefix, digest.bytes),
|
|
135
135
|
contentState: "embedded",
|
|
136
|
-
limitations: mismatched
|
|
137
|
-
? [
|
|
138
|
-
"Observed content contradicts declared integrity metadata and is untrusted.",
|
|
139
|
-
]
|
|
140
|
-
: [],
|
|
141
136
|
}),
|
|
142
137
|
mismatched,
|
|
138
|
+
classification: classified,
|
|
143
139
|
};
|
|
144
140
|
};
|
|
145
141
|
const isExpandableAsar = (entry, logicalPath) => entry.kind === "file" &&
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
2
|
+
import { AnalysisCancelledError, AnalysisTimeoutError, } from "../domain/analysisErrorCore.js";
|
|
3
|
+
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
|
4
|
+
import { BrowserObservationError } from "../domain/browserObservationError.js";
|
|
5
|
+
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
6
|
+
import { PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY } from "./providerIdentities.js";
|
|
7
|
+
const OPERATION = "capture_browser_scenario";
|
|
8
|
+
const browserScenarioLimitations = (session) => [
|
|
9
|
+
"Event sequence records provider receipt order; simultaneous browser causality is not inferred.",
|
|
10
|
+
"Network content is retained only when selected; response bytes are browser-decoded, not compressed wire bytes.",
|
|
11
|
+
"Request bytes are limited to what Playwright exposes; not_exposed does not establish body absence or multipart file coverage.",
|
|
12
|
+
"Network content reads settle within 5 seconds each and never wait for unfinished responses or refetch them.",
|
|
13
|
+
"Playwright scenario events do not expose request initiator stacks; receipt order does not prove causality.",
|
|
14
|
+
"Storage values are hashed only after declared-secret redaction.",
|
|
15
|
+
...(session.eventLimitations?.() ?? []),
|
|
16
|
+
...(session.mode === "connect"
|
|
17
|
+
? [
|
|
18
|
+
"CDP attachment cannot recover pre-attach events or guarantee launch-time context options.",
|
|
19
|
+
]
|
|
20
|
+
: []),
|
|
21
|
+
];
|
|
22
|
+
/** Project one session into the common capture fields used by success and failure. */
|
|
23
|
+
export const browserScenarioCaptureData = (input) => ({
|
|
24
|
+
browser: {
|
|
25
|
+
mode: input.session.mode,
|
|
26
|
+
process_ownership: input.session.processOwnership,
|
|
27
|
+
cleanup: input.cleanup,
|
|
28
|
+
product: input.session.product,
|
|
29
|
+
version: input.session.version,
|
|
30
|
+
},
|
|
31
|
+
scenario: {
|
|
32
|
+
start_origin: new URL(input.scenario.start_url.url).origin,
|
|
33
|
+
action_count: input.scenario.actions.length,
|
|
34
|
+
secret_references: input.scenario.secrets
|
|
35
|
+
.map(({ secret_id: id }) => id)
|
|
36
|
+
.sort(),
|
|
37
|
+
network_content: input.scenario.capture.network,
|
|
38
|
+
},
|
|
39
|
+
duration_ms: Date.now() - input.startedAt,
|
|
40
|
+
steps: [...input.steps],
|
|
41
|
+
events: input.session.events(),
|
|
42
|
+
limitations: [
|
|
43
|
+
...browserScenarioLimitations(input.session),
|
|
44
|
+
...(input.limitations ?? []),
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
/** Describe the cleanup failure without discarding its resource evidence. */
|
|
48
|
+
export const browserScenarioCleanupObservation = (cause) => cause instanceof AnalysisError && cause.cleanup !== undefined
|
|
49
|
+
? cause.cleanup
|
|
50
|
+
: {
|
|
51
|
+
reason: cause instanceof Error ? cause.message : String(cause),
|
|
52
|
+
resources: cause instanceof AnalysisError && cause.cleanupResources.length > 0
|
|
53
|
+
? cause.cleanupResources
|
|
54
|
+
: ["browser_transport"],
|
|
55
|
+
};
|
|
56
|
+
/** Retain operation diagnostics and capture data after cleanup settles. */
|
|
57
|
+
export const browserScenarioOperationFailure = (cause, partialObservation, cleanupFailure) => {
|
|
58
|
+
const primary = cause instanceof AnalysisError
|
|
59
|
+
? cause
|
|
60
|
+
: new ProviderAdapterError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, OPERATION, { cause });
|
|
61
|
+
const primaryProjection = projectAnalysisError(primary);
|
|
62
|
+
const cleanupCause = cleanupFailure === undefined
|
|
63
|
+
? undefined
|
|
64
|
+
: cleanupFailure.cause instanceof AnalysisError
|
|
65
|
+
? cleanupFailure.cause
|
|
66
|
+
: new ProviderAdapterError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, "close_browser_scenario", { cause: cleanupFailure.cause });
|
|
67
|
+
const cleanupObservation = cleanupFailure === undefined
|
|
68
|
+
? undefined
|
|
69
|
+
: browserScenarioCleanupObservation(cleanupFailure.cause);
|
|
70
|
+
const retainedOptions = {
|
|
71
|
+
cause: primary,
|
|
72
|
+
partialObservation,
|
|
73
|
+
...(primary.capturedOutput === undefined
|
|
74
|
+
? {}
|
|
75
|
+
: { capturedOutput: primary.capturedOutput }),
|
|
76
|
+
...(primary.cleanup === undefined ? {} : { cleanup: primary.cleanup }),
|
|
77
|
+
};
|
|
78
|
+
if (cleanupCause === undefined) {
|
|
79
|
+
if (primary instanceof AnalysisCancelledError)
|
|
80
|
+
return new AnalysisCancelledError(primary.operation, retainedOptions);
|
|
81
|
+
if (primary instanceof AnalysisTimeoutError)
|
|
82
|
+
return new AnalysisTimeoutError(primary.operation, primary.timeoutMs, retainedOptions);
|
|
83
|
+
if (primary instanceof BrowserObservationError)
|
|
84
|
+
return new BrowserObservationError(primary.operation, primary.reason, {
|
|
85
|
+
...retainedOptions,
|
|
86
|
+
...(primary.userMessage === undefined
|
|
87
|
+
? {}
|
|
88
|
+
: { detail: primary.userMessage }),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const cleanup = cleanupObservation ?? primary.cleanup;
|
|
92
|
+
return new ProviderAdapterError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, OPERATION, {
|
|
93
|
+
...retainedOptions,
|
|
94
|
+
cause: cleanupCause === undefined
|
|
95
|
+
? primary
|
|
96
|
+
: new AggregateError([primary, cleanupCause], "Browser scenario operation and cleanup both failed", { cause: primary }),
|
|
97
|
+
userMessage: primaryProjection.message,
|
|
98
|
+
...(cleanup === undefined ? {} : { cleanup }),
|
|
99
|
+
diagnostics: {
|
|
100
|
+
primary_error: primaryProjection,
|
|
101
|
+
...(cleanupCause === undefined
|
|
102
|
+
? {}
|
|
103
|
+
: { cleanup_error: projectAnalysisError(cleanupCause) }),
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sanitizeBrowserUrl, } from "../domain/browserObservation.js";
|
|
2
|
+
import { browserTargetListSchema, webPageInspectionSchema, } from "../domain/browserObservationSchemas.js";
|
|
2
3
|
import { analyzeCapturedWebBundle } from "../domain/webBundleAnalyzer.js";
|
|
3
4
|
import { webBundleAnalysisSchema, } from "../domain/webBundleAnalysis.js";
|
|
4
5
|
import { webObservationSessionSchema, } from "../domain/browserSession.js";
|
|
@@ -19,8 +20,6 @@ import { observeCdpSession } from "./CdpObservationSession.js";
|
|
|
19
20
|
import { discoverWebMcp } from "./CdpWebMcpDiscovery.js";
|
|
20
21
|
import { captureCdpScreenshot } from "./CdpScreenshot.js";
|
|
21
22
|
import { comparePngScreenshots } from "./PngVisualDiff.js";
|
|
22
|
-
/** Public identity committed by passive browser observations. */
|
|
23
|
-
export { CDP_BROWSER_PROVIDER_IDENTITY } from "./providerIdentities.js";
|
|
24
23
|
import { CDP_BROWSER_PROVIDER_IDENTITY } from "./providerIdentities.js";
|
|
25
24
|
const IDENTITY = CDP_BROWSER_PROVIDER_IDENTITY;
|
|
26
25
|
const CLEANUP_DOMAINS = ["Network", "Debugger", "Runtime", "Page"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inferJsonShape } from "../domain/jsonShape.js";
|
|
2
2
|
import { safeResponseMetadata } from "./CdpSafeMetadata.js";
|
|
3
|
-
import { allowedSanitizedUrl, isHttpUrl, numberValue, recordValue, recordsValue, cdpStringValue, } from "./CdpCaptureValues.js";
|
|
3
|
+
import { allowedSanitizedUrl, isHttpUrl, numberValue, recordValue, recordsValue, scriptMetadataValues, cdpStringValue, } from "./CdpCaptureValues.js";
|
|
4
4
|
import { requestBodyShape, updateResponseBodyShape, } from "./CdpCaptureEventBodyShapes.js";
|
|
5
5
|
import { consolePrimitive, decodeBase64, exclusionReasonForUrl, executionContextKey, firstCallFrame, initiatorLocation, integerOrNull, isJsonMediaType, isMainFrameNavigation, } from "./CdpCaptureEventHelpers.js";
|
|
6
6
|
import { CDP_CAPTURE_SCRIPT_METADATA_LIMITS, } from "./CdpCaptureEventTypes.js";
|
|
@@ -44,9 +44,7 @@ export const handleScriptParsed = (state, params) => {
|
|
|
44
44
|
rawUrl,
|
|
45
45
|
url: sanitized.url,
|
|
46
46
|
origin: sanitized.origin,
|
|
47
|
-
|
|
48
|
-
length: Math.max(0, Math.min(Number.MAX_SAFE_INTEGER, Math.trunc(numberValue(params.length) ?? 0))),
|
|
49
|
-
isModule: params.isModule === true,
|
|
47
|
+
...scriptMetadataValues(params),
|
|
50
48
|
language: cdpStringValue(params.scriptLanguage) ?? null,
|
|
51
49
|
executionContextKey: executionContextKey(params.executionContextId),
|
|
52
50
|
};
|
|
@@ -3,7 +3,6 @@ import * as bodyShapes from "./CdpCaptureEventBodyShapes.js";
|
|
|
3
3
|
import * as handlers from "./CdpCaptureEventHandlers.js";
|
|
4
4
|
import { isJsonMediaType } from "./CdpCaptureEventHelpers.js";
|
|
5
5
|
import { recordValue } from "./CdpCaptureValues.js";
|
|
6
|
-
export {} from "./CdpCaptureEventTypes.js";
|
|
7
6
|
/** Event accumulator that validates and normalizes payloads at ingestion. */
|
|
8
7
|
export class CdpCaptureEvents {
|
|
9
8
|
#scriptMetadataBudgetExclusionsRecorded = false;
|
|
@@ -13,12 +13,32 @@ export const recordsValue = (value) => Array.isArray(value)
|
|
|
13
13
|
: [];
|
|
14
14
|
export const cdpStringValue = (value) => typeof value === "string" ? value : undefined;
|
|
15
15
|
export const numberValue = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
16
|
+
/** Preserve partial script declarations; omitted or invalid fields remain unknown. */
|
|
17
|
+
export const scriptMetadataValues = (value) => {
|
|
18
|
+
const length = numberValue(value?.length);
|
|
19
|
+
return {
|
|
20
|
+
hash: cdpStringValue(value?.hash) ?? null,
|
|
21
|
+
length: length !== undefined && Number.isSafeInteger(length) && length >= 0
|
|
22
|
+
? length
|
|
23
|
+
: null,
|
|
24
|
+
isModule: typeof value?.isModule === "boolean" ? value.isModule : null,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
16
27
|
export const requiredRecord = (value) => {
|
|
17
28
|
const record = recordValue(value);
|
|
18
29
|
if (record === undefined)
|
|
19
30
|
throw new BrowserObservationError("inspect_web_page", "protocol_error");
|
|
20
31
|
return record;
|
|
21
32
|
};
|
|
33
|
+
/** Require producer source text; an absent source is distinct from an empty script. */
|
|
34
|
+
export const requiredScriptSource = (value, operation) => {
|
|
35
|
+
const source = cdpStringValue(recordValue(value)?.scriptSource);
|
|
36
|
+
if (source === undefined)
|
|
37
|
+
throw new BrowserObservationError(operation, "protocol_error", {
|
|
38
|
+
detail: "Debugger.getScriptSource returned malformed source text: scriptSource must be a string.",
|
|
39
|
+
});
|
|
40
|
+
return source;
|
|
41
|
+
};
|
|
22
42
|
export const isHttpUrl = (value) => {
|
|
23
43
|
if (value === undefined)
|
|
24
44
|
return false;
|
|
@@ -8,8 +8,6 @@ import { discoverCdpEndpoint, hasCdpTargetWebSocket, } from "./CdpEndpoint.js";
|
|
|
8
8
|
import { closeCdpTargetSession, openCdpTargetSession, } from "./CdpTargetSession.js";
|
|
9
9
|
import { inspectCdpElectronPage } from "./CdpElectronInspection.js";
|
|
10
10
|
import { authorizedElectronFile } from "./ElectronFileScope.js";
|
|
11
|
-
/** Public identity committed by passive Electron observations. */
|
|
12
|
-
export { CDP_ELECTRON_PROVIDER_IDENTITY } from "./providerIdentities.js";
|
|
13
11
|
import { CDP_ELECTRON_PROVIDER_IDENTITY } from "./providerIdentities.js";
|
|
14
12
|
const IDENTITY = CDP_ELECTRON_PROVIDER_IDENTITY;
|
|
15
13
|
/** Passive Electron provider for local file pages exposed by loopback CDP. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CdpCaptureCompleteness } from "./CdpCaptureCompleteness.js";
|
|
2
|
-
import { numberValue, recordValue, cdpStringValue, } from "./CdpCaptureValues.js";
|
|
2
|
+
import { numberValue, recordValue, scriptMetadataValues, cdpStringValue, } from "./CdpCaptureValues.js";
|
|
3
3
|
/** Retain script/frame metadata from passive Electron events. */
|
|
4
4
|
export const ingestElectronScriptEvent = (input) => {
|
|
5
5
|
if (input.event.method === "Runtime.executionContextsCleared") {
|
|
@@ -33,9 +33,7 @@ export const ingestElectronScriptEvent = (input) => {
|
|
|
33
33
|
input.scripts.push({
|
|
34
34
|
scriptId,
|
|
35
35
|
rawUrl,
|
|
36
|
-
|
|
37
|
-
length: nonnegativeInteger(value?.length),
|
|
38
|
-
isModule: value?.isModule === true,
|
|
36
|
+
...scriptMetadataValues(value),
|
|
39
37
|
language: cdpStringValue(value?.scriptLanguage) ?? null,
|
|
40
38
|
executionContextKey: executionContextKey(value?.executionContextId),
|
|
41
39
|
});
|
|
@@ -49,10 +47,6 @@ const retainExecutionContext = (event, frames) => {
|
|
|
49
47
|
return;
|
|
50
48
|
frames.set(contextKey, frameId);
|
|
51
49
|
};
|
|
52
|
-
const nonnegativeInteger = (value) => {
|
|
53
|
-
const number = numberValue(value);
|
|
54
|
-
return number === undefined ? 0 : Math.max(0, Math.trunc(number));
|
|
55
|
-
};
|
|
56
50
|
const executionContextKey = (value) => {
|
|
57
51
|
const identifier = numberValue(value);
|
|
58
52
|
return identifier !== undefined && Number.isSafeInteger(identifier)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { canonicalDigest } from "../domain/comparisonSemantics.js";
|
|
2
2
|
import { createWebTextArtifact } from "../domain/webContentArtifact.js";
|
|
3
3
|
import { CdpCaptureCompleteness } from "./CdpCaptureCompleteness.js";
|
|
4
|
-
import {
|
|
4
|
+
import { requiredScriptSource } from "./CdpCaptureValues.js";
|
|
5
5
|
import { authorizedElectronFile } from "./ElectronFileScope.js";
|
|
6
6
|
/** Normalize local script metadata and optionally approved source. */
|
|
7
7
|
export const captureElectronScripts = async (input) => {
|
|
@@ -54,8 +54,7 @@ const captureScriptSource = async (input, script) => {
|
|
|
54
54
|
reason: "source capture was not selected",
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
|
-
const
|
|
58
|
-
const text = cdpStringValue(result.scriptSource) ?? "";
|
|
57
|
+
const text = requiredScriptSource(await input.connection.send("Debugger.getScriptSource", { scriptId: script.scriptId }, input.sessionId, input.signal), "inspect_electron_page");
|
|
59
58
|
return {
|
|
60
59
|
source: {
|
|
61
60
|
included: true,
|