rea-agents 5.0.0 → 6.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 +168 -655
- package/bridge/android/ReaJadxBridge.java +14 -5
- package/bridge/ghidra/ReaGhidraBridge.java +173 -47
- package/bridge/hopper_bridge.py +310 -128
- package/bridge/mitmproxy/capture.py +208 -0
- package/bridge/native/rea_lldb_tracer.py +839 -0
- package/bridge/process/ProcessRunTokenReader.swift +297 -0
- package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
- package/bridge/pwndbg/core_context.py +101 -0
- package/bridge/pwndbg/launch.py +39 -0
- package/bridge/pwndbg/launch_impl.py +34 -0
- package/bridge/pwntools/decoder_runtime.py +59 -0
- package/bridge/pwntools/layout.py +39 -0
- package/bridge/pwntools/layout_impl.py +309 -0
- package/bridge/pwntools/recorded_crash.py +39 -0
- package/bridge/pwntools/recorded_crash_impl.py +147 -0
- package/dist/android/JadxConfiguration.js +196 -33
- package/dist/android/JadxMcpTransport.js +4 -0
- package/dist/android/JadxProtocol.js +6 -0
- package/dist/android/JadxProvider.js +20 -2
- package/dist/android/JadxSession.js +23 -4
- package/dist/application/AnalysisContextQueries.js +8 -35
- package/dist/application/AnalysisDocument.js +32 -0
- package/dist/application/AppBundleExecutable.js +67 -21
- package/dist/application/CallPathTracing.js +19 -3
- package/dist/application/CapabilityInventory.js +27 -3
- package/dist/application/ClientConfigurationDocument.js +871 -6
- package/dist/application/ClientRegistrationIdentity.js +26 -5
- package/dist/application/ClientRegistrationStatus.js +29 -14
- package/dist/application/DirectAnalysis.js +97 -33
- package/dist/application/Doctor.js +4 -2
- package/dist/application/DoctorScope.js +25 -13
- package/dist/application/EnhancedLiteralTracing.js +22 -25
- package/dist/application/EnhancedTools.js +13 -11
- package/dist/application/EvidenceBundleFiles.js +24 -12
- package/dist/application/FunctionAnalysisEvidence.js +2 -3
- package/dist/application/InventoryProjectionEvidence.js +4 -3
- package/dist/application/InvestigationProviders.js +3 -2
- package/dist/application/JsonFiles.js +50 -28
- package/dist/application/ProcedureAddressResolution.js +11 -0
- package/dist/application/ReconstructionCoverageService.js +7 -4
- package/dist/application/ReconstructionObligationCandidates.js +5 -1
- package/dist/application/ReconstructionObligationLedgerService.js +4 -3
- package/dist/application/Setup.js +13 -1
- package/dist/application/SetupClientConfiguration.js +10 -15
- package/dist/application/SetupHost.js +5 -2
- package/dist/application/SetupPlan.js +5 -3
- package/dist/application/SupportedClients.js +34 -1
- package/dist/application/Uninstall.js +4 -3
- package/dist/application/Update.js +18 -3
- package/dist/application/UpdateRuntime.js +46 -25
- package/dist/application/WebModuleTraceService.js +4 -2
- package/dist/application/WebNetworkCapturePort.js +1 -0
- package/dist/application/WebNetworkCaptureService.js +134 -0
- package/dist/application/WebRuntimeService.js +5 -3
- package/dist/application/WebScriptExportService.js +2 -2
- package/dist/application/WebSourceLocationService.js +4 -2
- package/dist/application/WindowsCapabilities.js +1 -1
- package/dist/application/WorkflowEvidence.js +82 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +21 -5
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -0
- package/dist/application/binary/AnalysisSnapshotCache.js +52 -12
- package/dist/application/binary/BinarySession.js +131 -76
- package/dist/application/binary/BinarySessionOpen.js +19 -6
- package/dist/application/binary/BinarySessionRecords.js +45 -3
- package/dist/application/binary/BinarySessionStatus.js +17 -1
- package/dist/application/binary/CompositeProvider.js +13 -0
- package/dist/application/binary/LazyAnalysisProvider.js +3 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutPort.js +1 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +59 -0
- package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +62 -0
- package/dist/application/evm/EvmInterfacePort.js +1 -0
- package/dist/application/evm/EvmInterfaceService.js +64 -0
- package/dist/application/investigation/EvidenceLedger.js +21 -7
- package/dist/application/investigation/InvestigationRecords.js +8 -0
- package/dist/application/javascript/JavaScriptAnalysisControl.js +34 -0
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +25 -5
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +19 -2
- package/dist/application/javascript/JavaScriptApplicationService.js +34 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +5 -5
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +47 -27
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +39 -7
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +26 -2
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +80 -27
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +33 -12
- package/dist/application/javascript/JavaScriptModuleRelationships.js +37 -8
- package/dist/application/javascript/JavaScriptRecoveryService.js +4 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -1
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +149 -72
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +14 -15
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +41 -1
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -9
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +118 -12
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +27 -5
- package/dist/application/managed/ManagedApplicationGraphService.js +4 -3
- package/dist/application/managed/ManagedMemberComparisonService.js +7 -4
- package/dist/application/managed/ManagedNativeVerificationService.js +4 -3
- package/dist/application/managed/ManagedReconstructionService.js +4 -3
- package/dist/application/{ProcessCli.js → process/ProcessCli.js} +23 -15
- package/dist/application/{ProcessEvidence.js → process/ProcessEvidence.js} +8 -7
- package/dist/application/workflowInputError.js +18 -0
- package/dist/artifacts/ArtifactProvider.js +42 -5
- package/dist/artifacts/ArtifactProviderMetadata.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +98 -14
- package/dist/artifacts/NativeDmgArtifactReader.js +13 -6
- package/dist/artifacts/ZipArtifactReader.js +3 -0
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +22 -3
- package/dist/artifacts/apple/DylibResolutionReader.js +259 -0
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +176 -56
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +195 -0
- package/dist/artifacts/apple/KeyedArchiveReader.js +36 -22
- package/dist/artifacts/apple/MachoLoadCommandReader.js +355 -0
- package/dist/artifacts/apple/NibArchive.js +81 -14
- package/dist/artifacts/apple/NibViewHierarchy.js +10 -3
- package/dist/artifacts/apple/PlistNumberLiterals.js +164 -0
- package/dist/{application → artifacts/extraction}/ArtifactExtraction.js +10 -10
- package/dist/{application → artifacts/inventory}/ArtifactGraphConstruction.js +16 -11
- package/dist/{application → artifacts/inventory}/ArtifactInventory.js +4 -4
- package/dist/{application/ArtifactInventory → artifacts/inventory}/classify.js +2 -2
- package/dist/{application/ArtifactInventory → artifacts/inventory}/reader.js +5 -5
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanCanonical.js +14 -17
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanReader.js +5 -5
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +6 -2
- package/dist/artifacts/readStableArtifact.js +20 -4
- package/dist/browser/CdpCaptureCompleteness.js +2 -0
- package/dist/browser/CdpCaptureEventHandlers.js +165 -12
- package/dist/browser/CdpCaptureEventTypes.js +5 -1
- package/dist/browser/CdpCaptureEvents.js +34 -0
- package/dist/browser/CdpConnection.js +30 -11
- package/dist/browser/CdpOptionalCommand.js +2 -3
- package/dist/browser/CdpPageCapture.js +23 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +32 -23
- package/dist/browser/PlaywrightElectronActiveProjection.js +141 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +130 -122
- package/dist/browser/WebSourceMapFetcher.js +426 -72
- package/dist/browser/assets/LocalWebScriptArtifacts.js +2 -2
- package/dist/browser/history/CaptureFailures.js +137 -0
- package/dist/browser/history/CaptureFormatError.js +10 -0
- package/dist/browser/history/CaptureRedaction.js +65 -0
- package/dist/browser/history/CaptureRelease.js +17 -0
- package/dist/browser/history/HarCapture.js +165 -0
- package/dist/browser/history/HarCaptureAdapter.js +20 -0
- package/dist/browser/history/HarCaptureProcess.js +57 -0
- package/dist/browser/history/HarJson.js +92 -0
- package/dist/browser/history/HarSchema.js +72 -0
- package/dist/browser/history/HistoricalCaptureDecoder.js +188 -0
- package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
- package/dist/browser/history/MitmproxyCaptureAdapter.js +42 -0
- package/dist/cli/analysisSelector.js +23 -0
- package/dist/cli/applicationCommands.js +2 -3
- package/dist/cli/artifactCommands.js +26 -1
- package/dist/cli/binaryDiagnosticsCommands.js +39 -0
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +78 -20
- package/dist/cli/electronCommands.js +21 -13
- package/dist/cli/evmCommands.js +24 -0
- package/dist/cli/firmwareCommands.js +6 -3
- package/dist/cli/javascriptApplicationAnalysis.js +20 -3
- package/dist/cli/jsonOutput.js +38 -0
- package/dist/cli/nativeCallCommands.js +34 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/streamedJsonOutput.js +56 -0
- package/dist/cli/utilityCommands.js +2 -0
- package/dist/cli/webNetworkCaptureCommands.js +40 -0
- package/dist/cli/webRuntimeCommands.js +8 -8
- package/dist/cli.js +11 -4
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +6 -1
- package/dist/cliJsonInput.js +35 -1
- package/dist/cliOutput.js +21 -6
- package/dist/composition/binaryDiagnostics.js +8 -0
- package/dist/composition/evm.js +4 -0
- package/dist/composition/webNetworkCaptures.js +6 -0
- package/dist/config/environment.js +4 -0
- package/dist/config/ghidraStartupTimeout.js +17 -0
- package/dist/config/mcpResponseBudget.js +22 -0
- package/dist/config/parseConfig.js +2 -1
- package/dist/contracts/artifactToolContracts.js +6 -0
- package/dist/contracts/browserCaptureToolInputSchema.js +43 -0
- package/dist/contracts/browserToolContracts.js +4 -3
- package/dist/contracts/enhancedInputs.js +5 -3
- package/dist/contracts/enhancedToolContracts.js +3 -3
- package/dist/contracts/errorSchemas.js +8 -1
- package/dist/contracts/evm/evmToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +2 -5
- package/dist/contracts/investigationExamples.js +2 -2
- package/dist/contracts/javascript/electronToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +8 -6
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +42 -0
- package/dist/contracts/native/nativeToolContracts.js +21 -3
- package/dist/contracts/officialToolContracts.js +26 -24
- package/dist/contracts/process/processCaptureExample.js +2 -0
- package/dist/contracts/promptContracts.js +3 -3
- package/dist/contracts/sessionLifecycleInputs.js +18 -5
- package/dist/contracts/sessionStatusContract.js +8 -2
- package/dist/contracts/sessionToolContracts.js +8 -3
- package/dist/contracts/sessionToolSchemas.js +8 -4
- package/dist/contracts/toolContractExamples.js +1 -2
- package/dist/contracts/toolContractHelpers.js +4 -1
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +30 -1
- package/dist/contracts/toolOutputSchemaGroups.js +33 -28
- package/dist/contracts/toolOutputSchemaPrimitives.js +19 -1
- package/dist/contracts/toolSchemaMetadata.js +69 -10
- package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
- package/dist/domain/analysisErrorBase.js +22 -2
- package/dist/domain/analysisErrorCore.js +61 -5
- package/dist/domain/analysisErrorPresentation.js +95 -12
- package/dist/domain/analysisErrorProjection.js +148 -19
- package/dist/domain/analysisSnapshot.js +166 -2
- package/dist/domain/android/androidAnalysis.js +2 -4
- package/dist/domain/android/androidApplication.js +17 -9
- package/dist/domain/apple/appleApplication.js +41 -14
- package/dist/domain/apple/dyldEnvironment.js +73 -0
- package/dist/domain/apple/dyldPaths.js +81 -0
- package/dist/domain/apple/dylibResolution.js +478 -0
- package/dist/domain/apple/dylibResolutionFindings.js +77 -0
- package/dist/domain/apple/interfaceBuilderGraph.js +25 -13
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +13 -3
- package/dist/domain/apple/keyedArchive.js +9 -1
- package/dist/domain/apple/machoContainer.js +54 -0
- package/dist/domain/apple/plistNumbers.js +76 -0
- package/dist/domain/artifactIdentity.js +29 -0
- package/dist/domain/artifactInventoryEvidence.js +19 -24
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/bridgeCandidateProjection.js +71 -0
- package/dist/domain/browserCompleteness.js +1 -0
- package/dist/domain/browserObservation.js +1 -1
- package/dist/domain/browserObservationError.js +24 -5
- package/dist/domain/browserObservationSchemas.js +13 -0
- package/dist/domain/browserScenarioValues.js +5 -2
- package/dist/domain/bundleComparison.js +3 -2
- package/dist/domain/callPathSchemas.js +1 -1
- package/dist/domain/canonicalDigest.js +13 -1
- package/dist/domain/canonicalJsonDigestSteps.js +133 -0
- package/dist/domain/canonicalOrdering.js +9 -5
- package/dist/domain/changedBehavior.js +9 -9
- package/dist/domain/comparisonSourceEvidence.js +40 -0
- package/dist/domain/comparisonStatus.js +2 -30
- package/dist/domain/configurationErrors.js +1 -1
- package/dist/domain/conformanceTrustGate.js +0 -16
- package/dist/domain/evidence.js +78 -11
- package/dist/domain/evidenceBundle.js +42 -1
- package/dist/domain/evidenceErrors.js +12 -1
- package/dist/domain/evm/evmInterface.js +63 -0
- package/dist/domain/explicitSensitiveFailure.js +108 -0
- package/dist/domain/explicitSensitiveValues.js +10 -0
- package/dist/domain/firmware/firmwareAnalysis.js +10 -4
- package/dist/domain/hopperErrors.js +23 -2
- package/dist/domain/hopperValues.js +51 -8
- package/dist/domain/immutableJson.js +114 -0
- package/dist/domain/inputIssueProjection.js +3 -0
- package/dist/domain/javascript/electronActiveObservation.js +37 -6
- package/dist/domain/javascript/electronStaticAnalysisValues.js +6 -12
- package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +71 -23
- package/dist/domain/javascript/javascriptApplicationGraph.js +13 -0
- package/dist/domain/javascript/javascriptAstValues.js +20 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +21 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +0 -10
- package/dist/domain/javascript/javascriptRecovery.js +3 -8
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +97 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +6 -5
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +9 -17
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +22 -5
- package/dist/domain/javascript/javascriptSemanticGraph.js +34 -5
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +25 -17
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -4
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +77 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +83 -11
- package/dist/domain/javascript/javascriptSourceParser.js +6 -2
- package/dist/domain/javascript/javascriptStaticAnalysis.js +22 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -3
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +14 -4
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +66 -7
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +28 -16
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -2
- package/dist/domain/jsonSerialization.js +109 -0
- package/dist/domain/jsonValue.js +91 -3
- package/dist/domain/localPath.js +8 -0
- package/dist/domain/managed/managedApplicationGraph.js +10 -10
- package/dist/domain/managed/managedInspectionEvidence.js +16 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +5 -9
- package/dist/domain/managed/managedNativeVerification.js +3 -9
- package/dist/domain/native/binaryLayout.js +357 -0
- package/dist/domain/native/fileOffsetPartialObservation.js +1 -0
- package/dist/domain/native/nativeCallObservation.js +186 -0
- package/dist/domain/native/nativeCallPartialObservation.js +33 -0
- package/dist/domain/native/objcSwiftMetadata.js +0 -39
- package/dist/domain/native/recordedCrash.js +266 -0
- package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
- package/dist/domain/{processCapture.js → process/processCapture.js} +143 -2
- package/dist/domain/{processCaptureExample.js → process/processCaptureExample.js} +5 -0
- package/dist/domain/process/processCaptureParsing.js +54 -0
- package/dist/domain/{processCaptureValidation.js → process/processCaptureValidation.js} +18 -2
- package/dist/domain/{processComparison.js → process/processComparison.js} +39 -5
- package/dist/domain/{processObservation.js → process/processObservation.js} +1 -1
- package/dist/domain/{processScenario.js → process/processScenario.js} +11 -10
- package/dist/domain/{processTraceSpecification.js → process/processTraceSpecification.js} +1 -1
- package/dist/domain/propertyListKeys.js +1 -1
- package/dist/domain/propertyListXmlText.js +19 -0
- package/dist/domain/providerAdapterError.js +1 -1
- package/dist/domain/providerOperationHealth.js +54 -0
- package/dist/domain/providerSelectionError.js +4 -2
- package/dist/domain/reconstructionVerification.js +9 -46
- package/dist/domain/reconstructionVerificationSchemas.js +3 -3
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +9 -46
- package/dist/domain/webBundleAnalysis.js +20 -8
- package/dist/domain/webBundleAnalyzerInspection.js +13 -8
- package/dist/domain/webBundleAnalyzerResult.js +41 -2
- package/dist/domain/webCaptureDiff.js +1 -0
- package/dist/domain/webNetworkCapture.js +118 -0
- package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
- package/dist/domain/webRuntime.js +19 -5
- package/dist/domain/webSourceLocation.js +1 -0
- package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
- package/dist/dotnet/ManagedMemberInspector.js +4 -2
- package/dist/dotnet/ManagedMemberInspectorCore.js +38 -32
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +23 -7
- package/dist/dotnet/ManagedMemberRows.js +14 -3
- package/dist/dotnet/ManagedMetadataHeaps.js +20 -2
- package/dist/dotnet/ManagedMetadataInventory.js +38 -28
- package/dist/dotnet/ManagedMetadataInventoryRows.js +24 -10
- package/dist/dotnet/ManagedMethodBodyReader.js +7 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +15 -3
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +3 -1
- package/dist/dotnet/ManagedPeReader.js +11 -0
- package/dist/evm/EvmBytecodeCarrier.js +21 -0
- package/dist/evm/EvmWorkerLimits.js +40 -0
- package/dist/evm/EvmoleFailures.js +126 -0
- package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
- package/dist/evm/EvmoleInterfaceProvider.js +273 -0
- package/dist/evm/EvmoleInterfaceWorker.js +87 -0
- package/dist/evm/EvmoleRelease.js +16 -0
- package/dist/firmware/FirmwareCommand.js +1 -0
- package/dist/firmware/FirmwareFiles.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +5 -0
- package/dist/ghidra/GhidraClient.js +47 -14
- package/dist/ghidra/GhidraDiagnostics.js +7 -7
- package/dist/ghidra/GhidraFunctionValues.js +10 -7
- package/dist/ghidra/GhidraInstallation.js +18 -21
- package/dist/ghidra/GhidraInventoryValues.js +14 -4
- package/dist/ghidra/GhidraJavaLaunch.js +62 -0
- package/dist/ghidra/GhidraLauncher.js +34 -16
- package/dist/ghidra/GhidraProvider.js +2 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +15 -3
- package/dist/ghidra/GhidraProviderClient.js +23 -12
- package/dist/ghidra/GhidraSessionError.js +11 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +47 -12
- package/dist/ghidra/GhidraTransport.js +20 -0
- package/dist/hopper/BridgeLauncher.js +33 -11
- package/dist/hopper/HopperAnalysisProfile.js +62 -4
- package/dist/hopper/HopperCleanup.js +15 -3
- package/dist/hopper/HopperClient.js +222 -14
- package/dist/hopper/HopperFileOffset.js +237 -0
- package/dist/hopper/HopperMachOImage.js +196 -0
- package/dist/hopper/HopperOperationStage.js +6 -0
- package/dist/hopper/HopperProvider.js +63 -9
- package/dist/hopper/HopperProviderCapabilities.js +19 -1
- package/dist/hopper/HopperRegexSearch.js +137 -0
- package/dist/hopper/HopperRegexWorker.js +27 -0
- package/dist/hopper/HopperRequestQueue.js +68 -19
- package/dist/hopper/HopperTargetLease.js +3 -2
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -1
- package/dist/inspector/V8InspectorCaptureProjection.js +8 -3
- package/dist/inspector/V8InspectorProvider.js +47 -11
- package/dist/javascript/recovery/WakaruCommand.js +3 -0
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +47 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +17 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +79 -31
- package/dist/javascript/sourceMaps/TraceSourceMap.js +14 -28
- package/dist/mcpDoctor.js +62 -2
- package/dist/native/AppleDispatchCoverage.js +47 -6
- package/dist/native/AppleDispatchDecodeFacts.js +6 -0
- package/dist/native/AppleDispatchMetadata.js +6 -3
- package/dist/native/AppleMachoFixups.js +48 -24
- package/dist/native/AppleMachoSelection.js +32 -16
- package/dist/native/AppleObjcCategories.js +6 -2
- package/dist/native/AppleObjcDispatchFacets.js +5 -2
- package/dist/native/AppleObjcProperties.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +27 -21
- package/dist/native/AppleSwiftVtables.js +21 -15
- package/dist/native/CommandRunner.js +82 -84
- package/dist/native/LldbCallTracer.js +541 -0
- package/dist/native/LldbRetainedObservations.js +178 -0
- package/dist/native/NativeCallObservation.js +194 -0
- package/dist/native/NativeMacOSProvider.js +117 -20
- package/dist/native/NativeMacOSProviderMetadata.js +8 -3
- package/dist/native/SignatureTargetBinding.js +155 -0
- package/dist/native/parsers/lipo.js +71 -1
- package/dist/native/pwndbg/PwndbgCoreContext.js +180 -0
- package/dist/native/pwntools/PwntoolsDecoder.js +203 -0
- package/dist/native/pwntools/PwntoolsFailures.js +180 -0
- package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
- package/dist/native/pwntools/PwntoolsRelease.js +19 -0
- package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +103 -0
- package/dist/process/DarwinProcessRunTokenReader.js +293 -0
- package/dist/process/ExecFileOutput.js +20 -0
- package/dist/process/OwnedCommand.js +118 -0
- package/dist/process/ProcessOwnership.js +431 -51
- package/dist/process/ProcessOwnershipObservation.js +209 -27
- package/dist/process/ProviderProcess.js +68 -10
- package/dist/{application → process/capture}/ProcessCaptureCapability.js +15 -0
- package/dist/{application → process/capture}/ProcessCaptureError.js +18 -2
- package/dist/process/capture/ProcessCaptureLifecycle.js +681 -0
- package/dist/{application → process/capture}/ProcessHarness.js +195 -29
- package/dist/{application → process/capture}/ProcessSampling.js +2 -2
- package/dist/server/EvidenceMcpServer.js +146 -0
- package/dist/server/createServer.js +37 -8
- package/dist/server/promptCompletion.js +10 -3
- package/dist/server/registerAndroidTools.js +2 -4
- package/dist/server/registerApplicationTools/helpers.js +2 -4
- package/dist/server/registerArtifactComparisonTool.js +11 -7
- package/dist/server/registerBinaryDiagnosticsTools.js +15 -0
- package/dist/server/registerBrowserScenarioTool.js +2 -4
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerBundleComparisonTool.js +2 -3
- package/dist/server/registerCloseLifecycleTool.js +8 -18
- package/dist/server/registerElectronTools.js +2 -4
- package/dist/server/registerEnhancedTools.js +18 -59
- package/dist/server/registerEvidenceTools.js +3 -5
- package/dist/server/registerEvmTools.js +15 -0
- package/dist/server/registerFirmwareTools.js +2 -4
- package/dist/server/registerFunctionComparisonTool.js +10 -6
- package/dist/server/registerInvestigationTools.js +7 -7
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -4
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -4
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +2 -4
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +2 -4
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -4
- package/dist/server/registerOfficialTools.js +2 -4
- package/dist/server/registerProcessComparisonTool.js +72 -46
- package/dist/server/registerRecordedCrashTools.js +15 -0
- package/dist/server/registerSessionRecordTools.js +5 -6
- package/dist/server/registerSessionStatusTool.js +17 -3
- package/dist/server/registerSessionTools.js +13 -5
- package/dist/server/registerWebModuleTool.js +2 -4
- package/dist/server/registerWebNetworkCaptureTool.js +26 -0
- package/dist/server/registerWebRuntimeTools.js +3 -7
- package/dist/server/registerWebScriptTool.js +2 -4
- package/dist/server/registerWebSourceLocationTool.js +2 -4
- package/dist/server/runDerivedOperation.js +15 -3
- package/dist/server/sessionAvailabilityPolicy.js +3 -1
- package/dist/server/sessionToolPolicies.js +1 -1
- package/dist/server/toolRegistrationOptions.js +2 -2
- package/dist/server/toolResult.js +63 -11
- package/dist/server/toolResultEncoding.js +33 -0
- package/install.sh +1 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +42 -9
- package/scripts/electron-active-hook-boundaries.cjs +18 -20
- package/scripts/electron-active-hook.cjs +241 -37
- package/scripts/rea.mjs +11 -3
- package/skills/reverse-engineer-anything/SKILL.md +32 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +8 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +29 -0
- package/third_party/README.md +60 -0
- package/third_party/evmole/LICENSE +21 -0
- package/third_party/evmole/README.md +22 -0
- package/third_party/pwndbg/LICENSE.md +21 -0
- package/third_party/pwndbg/README.md +23 -0
- package/third_party/pwntools/README.md +40 -0
- package/dist/application/AuthorizedArtifactInventory.js +0 -7
- package/dist/application/ProcessCaptureLifecycle.js +0 -299
- package/dist/application/StoreFileLock.js +0 -124
- package/dist/contracts/processCaptureExample.js +0 -2
- package/dist/domain/bytecodeProvider.js +0 -178
- package/dist/domain/customProtocolCapture.js +0 -137
- package/dist/domain/eventProcessTree.js +0 -225
- package/dist/domain/mobileApplicationInvestigation.js +0 -159
- package/dist/domain/packageAnalysis.js +0 -123
- package/dist/domain/peInspection.js +0 -197
- package/dist/domain/processCaptureParsing.js +0 -21
- package/dist/domain/protocolCapture.js +0 -217
- package/dist/domain/runtimeIdentification.js +0 -212
- package/dist/generatedMcpToolCatalog.js +0 -37
- package/dist/ghidra/GhidraDefaults.js +0 -2
- /package/dist/application/{ArtifactExtractionDestination.js → artifacts/ArtifactExtractionDestination.js} +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/policy.js +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/types.js +0 -0
- /package/dist/domain/{processEvidenceProvider.js → process/processEvidenceProvider.js} +0 -0
- /package/dist/domain/{processTraceComparison.js → process/processTraceComparison.js} +0 -0
- /package/dist/domain/{processTraceDimensionProjection.js → process/processTraceDimensionProjection.js} +0 -0
- /package/dist/domain/{processTraceEvaluation.js → process/processTraceEvaluation.js} +0 -0
- /package/dist/{application → process/capture}/FilesystemSnapshot.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureEnvironment.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureJournal.js +0 -0
- /package/dist/{application → process/capture}/ProcessFilesystemEffects.js +0 -0
- /package/dist/{application → process/capture}/ProcessNormalization.js +0 -0
- /package/dist/{application → process/capture}/ProcessScenarioRuntimeValidation.js +0 -0
- /package/dist/{application → process/capture}/ProcessTimer.js +0 -0
- /package/dist/{application → process/capture}/TerminalRenderer.js +0 -0
|
@@ -6,11 +6,12 @@ import { err, ok } from "../../domain/result.js";
|
|
|
6
6
|
import { createEvidence } from "../../domain/evidence.js";
|
|
7
7
|
import { OFFICIAL_TOOL_CONTRACTS } from "../../contracts/officialToolContracts.js";
|
|
8
8
|
import { ENHANCED_TOOL_CONTRACTS } from "../../contracts/enhancedToolContracts.js";
|
|
9
|
+
import { writeAnalysisSnapshot } from "./AnalysisSnapshotFiles.js";
|
|
9
10
|
import { SessionProviderRouter, } from "./SessionProviderRouter.js";
|
|
10
11
|
import { InvestigationRecords } from "../investigation/InvestigationRecords.js";
|
|
11
12
|
import { BinarySessionRecords } from "./BinarySessionRecords.js";
|
|
12
13
|
import { binarySessionStatus } from "./BinarySessionStatus.js";
|
|
13
|
-
import { resolveSessionOpen, } from "./BinarySessionOpen.js";
|
|
14
|
+
import { resolveSessionOpen, resolveSessionTarget, validateResolvedSessionTarget, } from "./BinarySessionOpen.js";
|
|
14
15
|
import { bindExecutionTarget, commitExecutionProfile, prepareSessionExecution, } from "./BinarySessionExecution.js";
|
|
15
16
|
import { closeAnalysisClient } from "./AnalysisClientCleanup.js";
|
|
16
17
|
const OFFICIAL_OPERATIONS = new Set(OFFICIAL_TOOL_CONTRACTS.map(({ name }) => name));
|
|
@@ -25,7 +26,8 @@ const ENHANCED_OPERATIONS = new Set(ENHANCED_TOOL_CONTRACTS.map(({ name }) => na
|
|
|
25
26
|
export class BinarySession extends BinarySessionRecords {
|
|
26
27
|
#active;
|
|
27
28
|
#transition = Promise.resolve();
|
|
28
|
-
#
|
|
29
|
+
#transitionGeneration = 0;
|
|
30
|
+
#calls = new Map();
|
|
29
31
|
#providerRouter;
|
|
30
32
|
#runtimeUnavailability = new Map();
|
|
31
33
|
#availabilityListeners = new Set();
|
|
@@ -88,21 +90,47 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
88
90
|
this.#availabilityListeners.add(listener);
|
|
89
91
|
return () => this.#availabilityListeners.delete(listener);
|
|
90
92
|
}
|
|
93
|
+
/** Resolve a target and provider profile without creating a provider client. */
|
|
94
|
+
previewTarget(target, options = {}) {
|
|
95
|
+
if (isAborted(options.signal))
|
|
96
|
+
return Promise.resolve(err(new AnalysisCancelledError("open_binary")));
|
|
97
|
+
return resolveSessionTarget({
|
|
98
|
+
router: this.#providerRouter,
|
|
99
|
+
current: this.#active,
|
|
100
|
+
target,
|
|
101
|
+
options,
|
|
102
|
+
stagedSnapshotMatches: (target, profile) => this.matchesSnapshot(target, profile),
|
|
103
|
+
}).then((resolved) => isAborted(options.signal)
|
|
104
|
+
? err(new AnalysisCancelledError("open_binary"))
|
|
105
|
+
: resolved);
|
|
106
|
+
}
|
|
91
107
|
/**
|
|
92
108
|
* Open or switch targets after draining calls against the current target.
|
|
93
109
|
* Returns the switch failure even if best-effort restoration also fails.
|
|
94
110
|
*/
|
|
95
111
|
open(path, options = {}) {
|
|
96
|
-
return this.#
|
|
112
|
+
return this.#open(() => resolveSessionOpen({
|
|
113
|
+
router: this.#providerRouter,
|
|
114
|
+
current: this.#active,
|
|
115
|
+
path,
|
|
116
|
+
options,
|
|
117
|
+
stagedSnapshotMatches: (target, profile) => this.matchesSnapshot(target, profile),
|
|
118
|
+
}), options);
|
|
119
|
+
}
|
|
120
|
+
/** Open a previewed target without repeating parsing or provider profile discovery. */
|
|
121
|
+
openResolvedTarget(resolved, options = {}) {
|
|
122
|
+
return this.#open(() => Promise.resolve(validateResolvedSessionTarget({
|
|
123
|
+
...resolved,
|
|
124
|
+
current: this.#active,
|
|
125
|
+
options,
|
|
126
|
+
stagedSnapshotMatches: (target, profile) => this.matchesSnapshot(target, profile),
|
|
127
|
+
})), options);
|
|
128
|
+
}
|
|
129
|
+
#open(resolve, options) {
|
|
130
|
+
return this.#serialize(async (admittedThrough) => {
|
|
97
131
|
if (isAborted(options.signal))
|
|
98
132
|
return err(new AnalysisCancelledError("open_binary"));
|
|
99
|
-
const resolved = await
|
|
100
|
-
router: this.#providerRouter,
|
|
101
|
-
current: this.#active,
|
|
102
|
-
path,
|
|
103
|
-
options,
|
|
104
|
-
stagedSnapshotMatches: (target, profile) => this.matchesSnapshot(target, profile),
|
|
105
|
-
});
|
|
133
|
+
const resolved = await resolve();
|
|
106
134
|
if (!resolved.ok)
|
|
107
135
|
return resolved;
|
|
108
136
|
const { target, route, sameTarget } = resolved.value;
|
|
@@ -113,16 +141,17 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
113
141
|
const sameProfile = activeProfile === null || activeProfile === undefined
|
|
114
142
|
? profile === null
|
|
115
143
|
: profile !== null && analysisProfilesEqual(activeProfile, profile);
|
|
144
|
+
await this.#drainCalls(admittedThrough);
|
|
145
|
+
if (isAborted(options.signal))
|
|
146
|
+
return err(new AnalysisCancelledError("open_binary"));
|
|
116
147
|
if (sameTarget && sameProfile) {
|
|
117
148
|
if (options.snapshot !== undefined) {
|
|
118
149
|
const imported = this.importAnalysisSnapshot(options.snapshot);
|
|
119
150
|
if (!imported.ok)
|
|
120
151
|
return imported;
|
|
121
152
|
}
|
|
122
|
-
this.resetSnapshotInvalidation();
|
|
123
153
|
return ok(target);
|
|
124
154
|
}
|
|
125
|
-
await this.#drainCalls();
|
|
126
155
|
const previous = this.#active;
|
|
127
156
|
this.#active = undefined;
|
|
128
157
|
if (previous !== undefined) {
|
|
@@ -155,6 +184,7 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
155
184
|
runId,
|
|
156
185
|
};
|
|
157
186
|
this.#clearRuntimeAvailability();
|
|
187
|
+
this.resetSnapshotInvalidation();
|
|
158
188
|
if (options.snapshot === undefined) {
|
|
159
189
|
if (profile === null)
|
|
160
190
|
this.clearSnapshot();
|
|
@@ -170,31 +200,49 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
170
200
|
return imported;
|
|
171
201
|
}
|
|
172
202
|
}
|
|
173
|
-
this.resetSnapshotInvalidation();
|
|
174
203
|
return ok(target);
|
|
175
204
|
});
|
|
176
205
|
}
|
|
177
206
|
/** Close the active target, if any. */
|
|
178
207
|
close(options = {}) {
|
|
179
|
-
return this.#serialize(async () => {
|
|
180
|
-
|
|
181
|
-
this.#
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
this.#
|
|
195
|
-
return closed
|
|
208
|
+
return this.#serialize(async (admittedThrough) => {
|
|
209
|
+
await this.#drainCalls(admittedThrough);
|
|
210
|
+
return this.#closeActive(options);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/** Drain earlier requests, save an immutable snapshot, and close under one lifecycle lock. */
|
|
214
|
+
closeWithSnapshot(path, overwrite, options = {}) {
|
|
215
|
+
return this.#serialize(async (admittedThrough) => {
|
|
216
|
+
await this.#drainCalls(admittedThrough);
|
|
217
|
+
const snapshot = this.exportAnalysisSnapshot();
|
|
218
|
+
if (!snapshot.ok)
|
|
219
|
+
return snapshot;
|
|
220
|
+
const written = await writeAnalysisSnapshot(snapshot.value, path, overwrite);
|
|
221
|
+
if (!written.ok)
|
|
222
|
+
return written;
|
|
223
|
+
const closed = await this.#closeActive(options);
|
|
224
|
+
return closed.ok
|
|
225
|
+
? ok({ ...written.value, entries: snapshot.value.entries.length })
|
|
226
|
+
: closed;
|
|
196
227
|
});
|
|
197
228
|
}
|
|
229
|
+
async #closeActive(options) {
|
|
230
|
+
const previous = this.#active;
|
|
231
|
+
this.#active = undefined;
|
|
232
|
+
const closed = previous === undefined
|
|
233
|
+
? ok(null)
|
|
234
|
+
: await closeAnalysisClient(previous.client, previous.route.identity.id, {
|
|
235
|
+
...(options.progress === undefined
|
|
236
|
+
? {}
|
|
237
|
+
: { progress: options.progress }),
|
|
238
|
+
...(options.retainProviderDocuments === true
|
|
239
|
+
? { retainDocument: true }
|
|
240
|
+
: {}),
|
|
241
|
+
});
|
|
242
|
+
this.clearSessionRecords();
|
|
243
|
+
this.#clearRuntimeAvailability();
|
|
244
|
+
return closed;
|
|
245
|
+
}
|
|
198
246
|
/** Describe the active binary session. */
|
|
199
247
|
status() {
|
|
200
248
|
return binarySessionStatus({
|
|
@@ -205,6 +253,7 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
205
253
|
runId: this.#active?.runId,
|
|
206
254
|
runtimeLineageSnapshots: this.#active?.client.runtimeLineageSnapshots?.() ?? [],
|
|
207
255
|
requestActivitySnapshots: this.#active?.client.requestActivitySnapshots?.() ?? [],
|
|
256
|
+
providerOperationHealth: this.#active?.client.operationHealthSnapshot?.() ?? null,
|
|
208
257
|
});
|
|
209
258
|
}
|
|
210
259
|
/** Return the immutable artifact identity captured before its provider started. */
|
|
@@ -221,8 +270,14 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
221
270
|
* Calls may overlap, but a pending target transition prevents new calls from
|
|
222
271
|
* entering until the transition has settled.
|
|
223
272
|
*/
|
|
224
|
-
|
|
225
|
-
const
|
|
273
|
+
execute(name, arguments_, options) {
|
|
274
|
+
const generation = this.#transitionGeneration;
|
|
275
|
+
const call = this.#execute(name, arguments_, options, this.#transition);
|
|
276
|
+
this.#calls.set(call, generation);
|
|
277
|
+
return call.finally(() => this.#calls.delete(call));
|
|
278
|
+
}
|
|
279
|
+
async #execute(name, arguments_, options, transition) {
|
|
280
|
+
const transitioned = await this.#waitForTransition(name, options?.signal, transition);
|
|
226
281
|
if (!transitioned.ok)
|
|
227
282
|
return transitioned;
|
|
228
283
|
const prepared = prepareSessionExecution({
|
|
@@ -232,7 +287,8 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
232
287
|
unboundOperationError: (operation, route) => this.#providerRouter.unboundOperationError(operation, route),
|
|
233
288
|
lookupSnapshot: (target, profile, operation, parameters) => operation === "decode_interface_builder" ||
|
|
234
289
|
operation === "inspect_asset_catalog" ||
|
|
235
|
-
operation === "inspect_keyed_archive"
|
|
290
|
+
operation === "inspect_keyed_archive" ||
|
|
291
|
+
operation === "trace_dylib_resolution"
|
|
236
292
|
? undefined
|
|
237
293
|
: this.lookupSnapshot(target, profile, operation, parameters),
|
|
238
294
|
});
|
|
@@ -242,45 +298,40 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
242
298
|
if (cached !== undefined)
|
|
243
299
|
return ok(cached);
|
|
244
300
|
const call = active.client.execute(name, arguments_, options);
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
else if (profiled.ok && capability?.effects.mutatesArtifact === true) {
|
|
277
|
-
this.invalidateSnapshot();
|
|
278
|
-
}
|
|
279
|
-
return profiled;
|
|
301
|
+
const result = await call;
|
|
302
|
+
const profiled = bindExecutionTarget(commitExecutionProfile(name, result, profile), name, active.target);
|
|
303
|
+
this.#observeRuntimeAvailability(name, profiled);
|
|
304
|
+
if (profiled.ok &&
|
|
305
|
+
cacheable &&
|
|
306
|
+
profile !== undefined &&
|
|
307
|
+
name !== "decode_interface_builder" &&
|
|
308
|
+
name !== "inspect_asset_catalog" &&
|
|
309
|
+
name !== "inspect_keyed_archive" &&
|
|
310
|
+
name !== "trace_dylib_resolution") {
|
|
311
|
+
const evidence = createEvidence(profiled.value.subject ?? active.target, profiled.value.provider, {
|
|
312
|
+
operation: name,
|
|
313
|
+
parameters: arguments_,
|
|
314
|
+
result: profiled.value.result,
|
|
315
|
+
analysisProfile: profile,
|
|
316
|
+
rawResult: profiled.value.rawResult,
|
|
317
|
+
limitations: profiled.value.limitations,
|
|
318
|
+
locations: profiled.value.locations,
|
|
319
|
+
});
|
|
320
|
+
const recorded = this.recordEvidence(evidence);
|
|
321
|
+
if (!recorded.ok)
|
|
322
|
+
return recorded;
|
|
323
|
+
this.recordSnapshot({
|
|
324
|
+
target: active.target,
|
|
325
|
+
profile,
|
|
326
|
+
operation: name,
|
|
327
|
+
parameters: arguments_,
|
|
328
|
+
execution: profiled.value,
|
|
329
|
+
});
|
|
280
330
|
}
|
|
281
|
-
|
|
282
|
-
this
|
|
331
|
+
else if (profiled.ok && capability?.effects.mutatesArtifact === true) {
|
|
332
|
+
this.invalidateSnapshot();
|
|
283
333
|
}
|
|
334
|
+
return profiled;
|
|
284
335
|
}
|
|
285
336
|
#observeRuntimeAvailability(operation, result) {
|
|
286
337
|
if (result.ok) {
|
|
@@ -346,12 +397,16 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
346
397
|
return this.#active?.route ?? this.#providerRouter.initialRoute();
|
|
347
398
|
}
|
|
348
399
|
#serialize(operation) {
|
|
349
|
-
|
|
400
|
+
// Later calls wait for this transition and must not be included in its drain.
|
|
401
|
+
const admittedThrough = this.#transitionGeneration++;
|
|
402
|
+
const result = this.#transition.then(() => operation(admittedThrough), () => operation(admittedThrough));
|
|
350
403
|
this.#transition = result.then(() => undefined, () => undefined);
|
|
351
404
|
return result;
|
|
352
405
|
}
|
|
353
|
-
async #drainCalls() {
|
|
354
|
-
await Promise.allSettled(this.#calls
|
|
406
|
+
async #drainCalls(admittedThrough) {
|
|
407
|
+
await Promise.allSettled([...this.#calls]
|
|
408
|
+
.filter(([, generation]) => generation <= admittedThrough)
|
|
409
|
+
.map(([call]) => call));
|
|
355
410
|
}
|
|
356
411
|
async #restore(previous) {
|
|
357
412
|
if (previous === undefined)
|
|
@@ -371,11 +426,11 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
371
426
|
else
|
|
372
427
|
await client.close();
|
|
373
428
|
}
|
|
374
|
-
async #waitForTransition(operation, signal) {
|
|
429
|
+
async #waitForTransition(operation, signal, transition) {
|
|
375
430
|
if (signal?.aborted === true)
|
|
376
431
|
return err(new AnalysisCancelledError(operation));
|
|
377
432
|
if (signal === undefined) {
|
|
378
|
-
await
|
|
433
|
+
await transition;
|
|
379
434
|
return ok(undefined);
|
|
380
435
|
}
|
|
381
436
|
return new Promise((resolve) => {
|
|
@@ -383,7 +438,7 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
383
438
|
resolve(err(new AnalysisCancelledError(operation)));
|
|
384
439
|
};
|
|
385
440
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
386
|
-
|
|
441
|
+
transition.then(() => {
|
|
387
442
|
signal.removeEventListener("abort", onAbort);
|
|
388
443
|
resolve(signal.aborted
|
|
389
444
|
? err(new AnalysisCancelledError(operation))
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { snapshotMatchesBinding, snapshotMatchesTarget, snapshotTarget, } from "../../domain/analysisSnapshot.js";
|
|
2
2
|
import { parseBinaryTarget } from "../BinaryTargetResolver.js";
|
|
3
3
|
import {} from "../../domain/binaryTarget.js";
|
|
4
|
-
import { EvidenceIntegrityError } from "../../domain/evidenceErrors.js";
|
|
4
|
+
import { EvidenceIntegrityError, AnalysisSnapshotMismatchError, } from "../../domain/evidenceErrors.js";
|
|
5
5
|
import {} from "../../domain/analysisErrorBase.js";
|
|
6
6
|
import { err } from "../../domain/result.js";
|
|
7
7
|
import { SessionProviderRouter } from "./SessionProviderRouter.js";
|
|
8
8
|
/** Parse a target, resolve its provider route, and validate snapshot binding. */
|
|
9
9
|
export const resolveSessionOpen = async (input) => {
|
|
10
|
-
const {
|
|
10
|
+
const { path, options } = input;
|
|
11
11
|
const parsed = await parseBinaryTarget(path, process.cwd(), process.arch, options.targetKind, options.formatHint);
|
|
12
12
|
if (!parsed.ok)
|
|
13
13
|
return parsed;
|
|
14
|
-
|
|
14
|
+
return resolveSessionTarget({ ...input, target: parsed.value });
|
|
15
|
+
};
|
|
16
|
+
/** Resolve a known target's provider route and validate snapshot binding. */
|
|
17
|
+
export const resolveSessionTarget = async (input) => {
|
|
18
|
+
const { router, current, target, options } = input;
|
|
15
19
|
const sameTarget = current?.target.path === target.path &&
|
|
16
20
|
snapshotMatchesTarget(snapshotTarget(current.target), target);
|
|
17
21
|
const resolvedRoute = sameTarget && options.providerId === undefined && current !== undefined
|
|
@@ -19,7 +23,16 @@ export const resolveSessionOpen = async (input) => {
|
|
|
19
23
|
: await router.resolve(target, options.providerId, options.signal);
|
|
20
24
|
if (!resolvedRoute.ok)
|
|
21
25
|
return resolvedRoute;
|
|
22
|
-
|
|
26
|
+
return validateResolvedSessionTarget({
|
|
27
|
+
...input,
|
|
28
|
+
route: resolvedRoute.value,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
/** Revalidate a previewed route against the current session and snapshot binding. */
|
|
32
|
+
export const validateResolvedSessionTarget = (input) => {
|
|
33
|
+
const { current, target, route, options, stagedSnapshotMatches } = input;
|
|
34
|
+
const sameTarget = current?.target.path === target.path &&
|
|
35
|
+
snapshotMatchesTarget(snapshotTarget(current.target), target);
|
|
23
36
|
const snapshotError = validateSnapshot({
|
|
24
37
|
snapshot: options.snapshot,
|
|
25
38
|
target,
|
|
@@ -34,8 +47,8 @@ export const resolveSessionOpen = async (input) => {
|
|
|
34
47
|
const validateSnapshot = ({ snapshot, target, profile, current, stagedSnapshotMatches, }) => {
|
|
35
48
|
if (snapshot !== undefined &&
|
|
36
49
|
(profile === null || !snapshotMatchesBinding(snapshot, target, profile)))
|
|
37
|
-
return new
|
|
50
|
+
return new AnalysisSnapshotMismatchError("Analysis snapshot profile_mismatch: target, provider, or analysis profile does not match the requested binary");
|
|
38
51
|
if (current === undefined && !stagedSnapshotMatches(target, profile))
|
|
39
|
-
return new
|
|
52
|
+
return new AnalysisSnapshotMismatchError("Analysis snapshot profile_mismatch: staged target, provider, or analysis profile does not match");
|
|
40
53
|
return undefined;
|
|
41
54
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { evidenceBundleForTarget } from "../../domain/evidenceBundle.js";
|
|
2
|
-
import { EvidenceIntegrityError } from "../../domain/evidenceErrors.js";
|
|
2
|
+
import { EvidenceIntegrityError, AnalysisSnapshotMismatchError, } from "../../domain/evidenceErrors.js";
|
|
3
3
|
import {} from "../../domain/analysisErrorBase.js";
|
|
4
4
|
import {} from "../../domain/unknownRegistryError.js";
|
|
5
5
|
import { err, ok } from "../../domain/result.js";
|
|
6
6
|
import { AnalysisSnapshotCache } from "./AnalysisSnapshotCache.js";
|
|
7
7
|
import { InvestigationRecords } from "../investigation/InvestigationRecords.js";
|
|
8
|
+
const SNAPSHOT_MUTATION_RECOVERY = "Export session observations through export_evidence_bundle if needed. Close the active target without saving a snapshot, then reopen it before importing or saving a snapshot.";
|
|
8
9
|
/** Binary snapshot owner and compatibility facade for composed investigation records. */
|
|
9
10
|
export class BinarySessionRecords {
|
|
10
11
|
#records;
|
|
@@ -31,9 +32,17 @@ export class BinarySessionRecords {
|
|
|
31
32
|
evidenceById(evidenceId) {
|
|
32
33
|
return this.#records.evidenceById(evidenceId);
|
|
33
34
|
}
|
|
35
|
+
/** Borrow immutable investigation Evidence without copying a complete graph. */
|
|
36
|
+
evidenceForAnalysis(evidenceId) {
|
|
37
|
+
return this.#records.evidenceForAnalysis(evidenceId);
|
|
38
|
+
}
|
|
34
39
|
exportEvidenceBundle() {
|
|
35
40
|
return this.#records.exportEvidenceBundle();
|
|
36
41
|
}
|
|
42
|
+
/** Borrow a sealed bundle for complete serialization without cloning retained graphs. */
|
|
43
|
+
evidenceBundleForSerialization() {
|
|
44
|
+
return this.#records.evidenceBundleForSerialization();
|
|
45
|
+
}
|
|
37
46
|
importEvidenceBundle(bundle) {
|
|
38
47
|
const imported = this.#records.mergeEvidenceBundle(bundle);
|
|
39
48
|
if (!imported.ok)
|
|
@@ -47,7 +56,9 @@ export class BinarySessionRecords {
|
|
|
47
56
|
exportAnalysisSnapshot() {
|
|
48
57
|
const active = this.activeAnalysisBinding();
|
|
49
58
|
if (this.#snapshotInvalidated)
|
|
50
|
-
return err(new EvidenceIntegrityError("Analysis snapshots are unavailable after analysis metadata mutations"
|
|
59
|
+
return err(new EvidenceIntegrityError("Analysis snapshots are unavailable after analysis metadata mutations", {
|
|
60
|
+
userMessage: `Analysis snapshots are unavailable after analysis metadata mutations. ${SNAPSHOT_MUTATION_RECOVERY}`,
|
|
61
|
+
}));
|
|
51
62
|
const target = active?.target;
|
|
52
63
|
const profile = active?.profile ?? undefined;
|
|
53
64
|
if (target !== undefined && profile === undefined)
|
|
@@ -58,8 +69,12 @@ export class BinarySessionRecords {
|
|
|
58
69
|
}
|
|
59
70
|
importAnalysisSnapshot(snapshot) {
|
|
60
71
|
const active = this.activeAnalysisBinding();
|
|
72
|
+
if (active !== undefined && this.#snapshotInvalidated)
|
|
73
|
+
return err(new EvidenceIntegrityError("Analysis snapshots cannot be imported after analysis metadata mutations", {
|
|
74
|
+
userMessage: `Analysis snapshots cannot be imported after analysis metadata mutations. ${SNAPSHOT_MUTATION_RECOVERY}`,
|
|
75
|
+
}));
|
|
61
76
|
if (active?.profile === null)
|
|
62
|
-
return err(new
|
|
77
|
+
return err(new AnalysisSnapshotMismatchError("Analysis snapshot profile_mismatch: the active target has no concrete analysis profile"));
|
|
63
78
|
const imported = this.#snapshot.import(snapshot, active === undefined
|
|
64
79
|
? undefined
|
|
65
80
|
: { target: active.target, profile: active.profile }, (bundle) => {
|
|
@@ -78,12 +93,38 @@ export class BinarySessionRecords {
|
|
|
78
93
|
this.#emitSnapshotChanged();
|
|
79
94
|
}
|
|
80
95
|
lookupSnapshot(target, profile, operation, parameters) {
|
|
96
|
+
if (this.#snapshotInvalidated)
|
|
97
|
+
return undefined;
|
|
81
98
|
return this.#snapshot.lookup(target, profile, operation, parameters);
|
|
82
99
|
}
|
|
83
100
|
recordSnapshot(input) {
|
|
101
|
+
if (this.#snapshotInvalidated)
|
|
102
|
+
return;
|
|
84
103
|
this.#snapshot.record(input);
|
|
85
104
|
this.#emitSnapshotChanged();
|
|
86
105
|
}
|
|
106
|
+
/** Retain one derived workflow result alongside its provider cache entries. */
|
|
107
|
+
recordWorkflowSnapshot(input) {
|
|
108
|
+
const active = this.activeAnalysisBinding();
|
|
109
|
+
if (active === undefined || active.profile === null)
|
|
110
|
+
return err(new EvidenceIntegrityError("Workflow snapshot entries require an active concrete provider profile"));
|
|
111
|
+
if (this.#snapshotInvalidated)
|
|
112
|
+
return ok(null);
|
|
113
|
+
try {
|
|
114
|
+
this.#snapshot.recordWorkflow({
|
|
115
|
+
target: active.target,
|
|
116
|
+
profile: active.profile,
|
|
117
|
+
...input,
|
|
118
|
+
});
|
|
119
|
+
this.#emitSnapshotChanged();
|
|
120
|
+
return ok(null);
|
|
121
|
+
}
|
|
122
|
+
catch (cause) {
|
|
123
|
+
return err(new EvidenceIntegrityError(cause instanceof Error
|
|
124
|
+
? cause.message
|
|
125
|
+
: "Workflow snapshot entry validation failed", { cause }));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
87
128
|
invalidateSnapshot() {
|
|
88
129
|
this.#snapshot.clear();
|
|
89
130
|
this.#snapshotInvalidated = true;
|
|
@@ -92,6 +133,7 @@ export class BinarySessionRecords {
|
|
|
92
133
|
resetSnapshotInvalidation() {
|
|
93
134
|
if (!this.#snapshotInvalidated)
|
|
94
135
|
return;
|
|
136
|
+
this.#snapshot.clear();
|
|
95
137
|
this.#snapshotInvalidated = false;
|
|
96
138
|
this.#emitSnapshotChanged();
|
|
97
139
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Project internal provider routing state into the caller-visible session status. */
|
|
2
|
-
export const binarySessionStatus = ({ target, route, router, runtimeUnavailability, runId, runtimeLineageSnapshots, requestActivitySnapshots, }) => {
|
|
2
|
+
export const binarySessionStatus = ({ target, route, router, runtimeUnavailability, runId, runtimeLineageSnapshots, requestActivitySnapshots, providerOperationHealth, }) => {
|
|
3
3
|
const configuredProvider = router.configuredIdentity();
|
|
4
4
|
const provider = providerSummary(configuredProvider);
|
|
5
5
|
const providers = router.providerIdentities(route).map(providerSummary);
|
|
@@ -50,6 +50,7 @@ export const binarySessionStatus = ({ target, route, router, runtimeUnavailabili
|
|
|
50
50
|
process_lineage: processLineageStatus(runtimeLineageSnapshots),
|
|
51
51
|
},
|
|
52
52
|
analysis_activity: requestActivityStatus(requestActivitySnapshots),
|
|
53
|
+
provider_operation_health: providerOperationHealthStatus(providerOperationHealth),
|
|
53
54
|
};
|
|
54
55
|
return target === undefined
|
|
55
56
|
? { open: false, ...common }
|
|
@@ -137,3 +138,18 @@ const capabilityStatus = (descriptor) => ({
|
|
|
137
138
|
},
|
|
138
139
|
limitations: [...descriptor.limitations],
|
|
139
140
|
});
|
|
141
|
+
const providerOperationHealthStatus = (health) => {
|
|
142
|
+
if (health === undefined || health === null)
|
|
143
|
+
return null;
|
|
144
|
+
return {
|
|
145
|
+
state: health.state,
|
|
146
|
+
stage: health.stage,
|
|
147
|
+
retry_action: health.retryAction,
|
|
148
|
+
exit_code: health.exitCode,
|
|
149
|
+
requests: health.requests.map((request) => ({
|
|
150
|
+
request_id: request.requestId,
|
|
151
|
+
operation: request.operation,
|
|
152
|
+
stage: request.stage,
|
|
153
|
+
})),
|
|
154
|
+
};
|
|
155
|
+
};
|
|
@@ -88,6 +88,19 @@ export class CompositeProvider {
|
|
|
88
88
|
requestActivitySnapshots: () => [...clients.values()]
|
|
89
89
|
.flatMap((client) => client.requestActivitySnapshots?.() ?? [])
|
|
90
90
|
.sort((left, right) => left.provider.id.localeCompare(right.provider.id)),
|
|
91
|
+
operationHealthSnapshot: () => {
|
|
92
|
+
for (const client of clients.values()) {
|
|
93
|
+
const snapshot = client.operationHealthSnapshot?.();
|
|
94
|
+
if (snapshot !== undefined && snapshot.state !== "idle")
|
|
95
|
+
return snapshot;
|
|
96
|
+
}
|
|
97
|
+
for (const client of clients.values()) {
|
|
98
|
+
const snapshot = client.operationHealthSnapshot?.();
|
|
99
|
+
if (snapshot !== undefined)
|
|
100
|
+
return snapshot;
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
},
|
|
91
104
|
closeWithOutcome,
|
|
92
105
|
close: async () => {
|
|
93
106
|
await closeWithOutcome();
|
|
@@ -74,6 +74,9 @@ class LazyAnalysisClient {
|
|
|
74
74
|
requestActivitySnapshots() {
|
|
75
75
|
return this.#client?.requestActivitySnapshots?.() ?? [];
|
|
76
76
|
}
|
|
77
|
+
operationHealthSnapshot() {
|
|
78
|
+
return this.#client?.operationHealthSnapshot?.();
|
|
79
|
+
}
|
|
77
80
|
async close() {
|
|
78
81
|
this.#closed = true;
|
|
79
82
|
if (this.#loading === undefined)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isAbsolute } from "node:path";
|
|
2
|
+
import { AnalysisCancelledError, AnalysisInputError, AnalysisOutputError, } from "../../domain/analysisErrorCore.js";
|
|
3
|
+
import { createEvidence } from "../../domain/evidence.js";
|
|
4
|
+
import { inspectBinaryLayoutInputSchema, binaryLayoutSchema, } from "../../domain/native/binaryLayout.js";
|
|
5
|
+
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
|
|
6
|
+
import { err, ok } from "../../domain/result.js";
|
|
7
|
+
const OPERATION = "inspect_binary_layout";
|
|
8
|
+
/** Shared CLI/MCP validation and Evidence composition for offline layout inspection. */
|
|
9
|
+
export class BinaryLayoutService {
|
|
10
|
+
provider;
|
|
11
|
+
constructor(provider) {
|
|
12
|
+
this.provider = provider;
|
|
13
|
+
}
|
|
14
|
+
/** Bind complete observations to the caller-selected artifact before creating Evidence. */
|
|
15
|
+
async inspect(rawInput, options) {
|
|
16
|
+
if (options?.signal?.aborted)
|
|
17
|
+
return err(new AnalysisCancelledError(OPERATION));
|
|
18
|
+
const input = inspectBinaryLayoutInputSchema.safeParse(rawInput);
|
|
19
|
+
if (!input.success)
|
|
20
|
+
return err(analysisInputErrorFromIssues(OPERATION, input.error.issues, rawInput, {
|
|
21
|
+
cause: input.error,
|
|
22
|
+
}));
|
|
23
|
+
if (!isAbsolute(input.data.path))
|
|
24
|
+
return err(new AnalysisInputError(OPERATION, undefined, [
|
|
25
|
+
{
|
|
26
|
+
path: ["path"],
|
|
27
|
+
reason: "invalid_format",
|
|
28
|
+
message: "Expected an absolute filesystem path on this host.",
|
|
29
|
+
},
|
|
30
|
+
]));
|
|
31
|
+
const inspected = await this.provider.inspect(input.data, options);
|
|
32
|
+
if (!inspected.ok)
|
|
33
|
+
return inspected;
|
|
34
|
+
const diagnostics = binaryLayoutSchema.shape.diagnostics.safeParse(inspected.value.diagnostics);
|
|
35
|
+
const outputOptions = diagnostics.success
|
|
36
|
+
? { capturedOutput: diagnostics.data }
|
|
37
|
+
: undefined;
|
|
38
|
+
if (options?.signal?.aborted)
|
|
39
|
+
return err(new AnalysisCancelledError(OPERATION, outputOptions));
|
|
40
|
+
const report = binaryLayoutSchema.safeParse(inspected.value);
|
|
41
|
+
if (!report.success || report.data.artifact.path !== input.data.path)
|
|
42
|
+
return err(new AnalysisOutputError(OPERATION, "Binary layout provider returned malformed evidence or changed the selected artifact identity.", outputOptions));
|
|
43
|
+
const value = report.data;
|
|
44
|
+
return ok(createEvidence({
|
|
45
|
+
path: value.artifact.path,
|
|
46
|
+
format: "elf",
|
|
47
|
+
architecture: "x86_64",
|
|
48
|
+
sha256: value.artifact.sha256,
|
|
49
|
+
}, this.provider.identity, {
|
|
50
|
+
operation: OPERATION,
|
|
51
|
+
parameters: input.data,
|
|
52
|
+
result: value,
|
|
53
|
+
rawResult: value,
|
|
54
|
+
confidence: "observed",
|
|
55
|
+
limitations: value.limitations,
|
|
56
|
+
locations: [{ kind: "artifact-path", path: value.artifact.path }],
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|