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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
/** Hash owned, validated JSON in bounded steps without a document-sized string. */
|
|
3
|
+
export function* canonicalJsonDigestSteps(value) {
|
|
4
|
+
const hash = createHash("sha256");
|
|
5
|
+
const ancestors = new Set();
|
|
6
|
+
const stack = [{ kind: "value", value }];
|
|
7
|
+
let buffered = "";
|
|
8
|
+
let flushed = false;
|
|
9
|
+
const emit = (part) => {
|
|
10
|
+
buffered += part;
|
|
11
|
+
if (buffered.length >= 8192) {
|
|
12
|
+
hash.update(buffered);
|
|
13
|
+
buffered = "";
|
|
14
|
+
flushed = true;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
try {
|
|
18
|
+
while (stack.length > 0) {
|
|
19
|
+
if (flushed) {
|
|
20
|
+
flushed = false;
|
|
21
|
+
yield;
|
|
22
|
+
}
|
|
23
|
+
const frame = stack.pop();
|
|
24
|
+
if (frame === undefined)
|
|
25
|
+
break;
|
|
26
|
+
if (frame.kind === "separator") {
|
|
27
|
+
emit(":");
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (frame.kind === "string") {
|
|
31
|
+
if (frame.index === frame.value.length) {
|
|
32
|
+
emit('"');
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
let end = Math.min(frame.index + 8192, frame.value.length);
|
|
36
|
+
const last = frame.value.charCodeAt(end - 1);
|
|
37
|
+
const next = frame.value.charCodeAt(end);
|
|
38
|
+
if (end < frame.value.length &&
|
|
39
|
+
last >= 0xd800 &&
|
|
40
|
+
last <= 0xdbff &&
|
|
41
|
+
next >= 0xdc00 &&
|
|
42
|
+
next <= 0xdfff)
|
|
43
|
+
end -= 1;
|
|
44
|
+
emit(JSON.stringify(frame.value.slice(frame.index, end)).slice(1, -1));
|
|
45
|
+
frame.index = end;
|
|
46
|
+
stack.push(frame);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (frame.kind === "array") {
|
|
50
|
+
if (frame.index === frame.length) {
|
|
51
|
+
emit("]");
|
|
52
|
+
ancestors.delete(frame.value);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const item = frame.value[frame.index];
|
|
56
|
+
if (item === undefined)
|
|
57
|
+
throw new TypeError("Canonical JSON digest requires dense JSON arrays");
|
|
58
|
+
if (frame.index++ > 0)
|
|
59
|
+
emit(",");
|
|
60
|
+
stack.push(frame, { kind: "value", value: item });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (frame.kind === "object") {
|
|
64
|
+
if (frame.index === frame.keys.length) {
|
|
65
|
+
emit("}");
|
|
66
|
+
ancestors.delete(frame.value);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const key = frame.keys[frame.index++];
|
|
70
|
+
if (key === undefined)
|
|
71
|
+
throw new TypeError("Canonical JSON object changed during hashing");
|
|
72
|
+
const item = frame.value[key];
|
|
73
|
+
if (item === undefined)
|
|
74
|
+
continue;
|
|
75
|
+
if (frame.written++ > 0)
|
|
76
|
+
emit(",");
|
|
77
|
+
if (key.length > 8192) {
|
|
78
|
+
emit('"');
|
|
79
|
+
stack.push(frame, { kind: "value", value: item }, { kind: "separator" }, { kind: "string", value: key, index: 0 });
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
emit(JSON.stringify(key));
|
|
83
|
+
emit(":");
|
|
84
|
+
stack.push(frame, { kind: "value", value: item });
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const item = frame.value;
|
|
88
|
+
if (typeof item === "string" && item.length > 8192) {
|
|
89
|
+
emit('"');
|
|
90
|
+
stack.push({ kind: "string", value: item, index: 0 });
|
|
91
|
+
}
|
|
92
|
+
else if (item === null || typeof item !== "object") {
|
|
93
|
+
if (typeof item === "number" && !Number.isFinite(item))
|
|
94
|
+
throw new Error(Number.isNaN(item)
|
|
95
|
+
? "NaN is not allowed"
|
|
96
|
+
: "Infinity is not allowed");
|
|
97
|
+
emit(JSON.stringify(item));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (ancestors.has(item))
|
|
101
|
+
throw new Error("Circular reference detected");
|
|
102
|
+
ancestors.add(item);
|
|
103
|
+
if (Array.isArray(item)) {
|
|
104
|
+
emit("[");
|
|
105
|
+
stack.push({
|
|
106
|
+
kind: "array",
|
|
107
|
+
value: item,
|
|
108
|
+
length: item.length,
|
|
109
|
+
index: 0,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
emit("{");
|
|
114
|
+
stack.push({
|
|
115
|
+
kind: "object",
|
|
116
|
+
value: item,
|
|
117
|
+
keys: Object.keys(item).sort(),
|
|
118
|
+
index: 0,
|
|
119
|
+
written: 0,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (buffered !== "")
|
|
125
|
+
hash.update(buffered);
|
|
126
|
+
return hash.digest("hex");
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
stack.length = 0;
|
|
130
|
+
ancestors.clear();
|
|
131
|
+
buffered = "";
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { compareUnicodeCodePoints } from "./unicodeCodePointOrder.js";
|
|
1
2
|
/**
|
|
2
3
|
* Canonical code-point ordering shared across domain and application layers.
|
|
3
4
|
*
|
|
4
|
-
* Compares strings by Unicode code point
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Compares strings by Unicode code point so graph ordering, fingerprints, and
|
|
6
|
+
* deterministic tie-breaks stay stable regardless of locale. Prefer this over
|
|
7
|
+
* `String.prototype.localeCompare`, which is locale-dependent.
|
|
8
|
+
*
|
|
9
|
+
* Ordering by code point differs from ordering by UTF-16 code unit for astral
|
|
10
|
+
* code points (above U+FFFF), whose lead surrogate is numerically below the
|
|
11
|
+
* BMP tail U+E000-U+FFFF.
|
|
8
12
|
*/
|
|
9
|
-
export const compareCodePoints = (left, right) => left
|
|
13
|
+
export const compareCodePoints = (left, right) => compareUnicodeCodePoints(left, right);
|
|
10
14
|
/** Deduplicate and sort strings with canonical code-point ordering. */
|
|
11
15
|
export const uniqueSorted = (values) => [...new Set(values)].sort(compareCodePoints);
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { artifactComparisonResultSchema } from "./artifactComparison.js";
|
|
3
3
|
import { uniqueSorted } from "./canonicalOrdering.js";
|
|
4
|
+
import { comparisonSourceEvidenceIds } from "./comparisonSourceEvidence.js";
|
|
4
5
|
import { evidenceSchema, parseEvidence } from "./evidence.js";
|
|
5
6
|
import { functionComparisonResultSchema } from "./functionComparison.js";
|
|
6
|
-
import { PROCESS_PROVIDER, isProcessEvidenceProvider, } from "./processEvidenceProvider.js";
|
|
7
|
-
import { comparisonStatusSchema, deriveProcessComparisonStatus, PROCESS_COMPARISON_DIMENSIONS, processCaptureComparisonSchema, } from "./processCapture.js";
|
|
7
|
+
import { PROCESS_PROVIDER, isProcessEvidenceProvider, } from "./process/processEvidenceProvider.js";
|
|
8
|
+
import { comparisonStatusSchema, deriveProcessComparisonStatus, PROCESS_COMPARISON_DIMENSIONS, processCaptureComparisonSchema, } from "./process/processCapture.js";
|
|
8
9
|
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
9
10
|
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
10
11
|
/** Input for aggregating existing comparison Evidence. */
|
|
11
|
-
export const changedBehaviorInputSchema = z.
|
|
12
|
-
comparisons: z.array(evidenceSchema).
|
|
12
|
+
export const changedBehaviorInputSchema = z.strictObject({
|
|
13
|
+
comparisons: z.array(evidenceSchema).min(1),
|
|
13
14
|
});
|
|
14
15
|
const findingSchema = z.object({
|
|
15
16
|
scope: z.enum(["runtime", "protocol", "resource", "static_candidate"]),
|
|
@@ -22,7 +23,7 @@ const findingSchema = z.object({
|
|
|
22
23
|
]),
|
|
23
24
|
status: comparisonStatusSchema,
|
|
24
25
|
source_comparison_id: evidenceIdSchema,
|
|
25
|
-
evidence_links: z.array(evidenceIdSchema).min(
|
|
26
|
+
evidence_links: z.array(evidenceIdSchema).min(2),
|
|
26
27
|
limitations: z.array(z.string()),
|
|
27
28
|
});
|
|
28
29
|
/** Truthful aggregate: runtime observations remain separate from static candidates. */
|
|
@@ -43,7 +44,7 @@ export const changedBehaviorResultSchema = z
|
|
|
43
44
|
findings: z.object({
|
|
44
45
|
items: z.array(findingSchema),
|
|
45
46
|
}),
|
|
46
|
-
evidence_links: z.array(evidenceIdSchema).min(
|
|
47
|
+
evidence_links: z.array(evidenceIdSchema).min(2),
|
|
47
48
|
limitations: z.array(z.string()),
|
|
48
49
|
})
|
|
49
50
|
.superRefine((result, context) => {
|
|
@@ -141,9 +142,8 @@ const parseComparisonEvidence = (input) => {
|
|
|
141
142
|
evidence.authority !== "analyst-inference" ||
|
|
142
143
|
evidence.subject !== null)
|
|
143
144
|
throw new TypeError("Comparison Evidence operation, predicate, and provider disagree");
|
|
144
|
-
if (evidence.evidence_links.
|
|
145
|
-
throw new TypeError("Comparison Evidence must cite both source observations");
|
|
146
|
-
assertUnique(evidence.evidence_links, "source Evidence links");
|
|
145
|
+
if (!comparisonSourceEvidenceIds(evidence).every((id) => evidence.evidence_links.includes(id)))
|
|
146
|
+
throw new TypeError("Comparison Evidence must cite both selected source observations");
|
|
147
147
|
parseResult(evidence);
|
|
148
148
|
return evidence;
|
|
149
149
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { uniqueSorted } from "./canonicalOrdering.js";
|
|
3
|
+
import { prefixedDigestSchema } from "./digests.js";
|
|
4
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
5
|
+
const sideParametersSchema = z.object({
|
|
6
|
+
left_evidence_id: evidenceIdSchema.optional(),
|
|
7
|
+
right_evidence_id: evidenceIdSchema.optional(),
|
|
8
|
+
left_evidence_ids: z.array(evidenceIdSchema).min(1).optional(),
|
|
9
|
+
right_evidence_ids: z.array(evidenceIdSchema).min(1).optional(),
|
|
10
|
+
});
|
|
11
|
+
/** Resolve each selected side and validate aliases and duplicates within that role. */
|
|
12
|
+
export const comparisonSourceEvidenceSides = (evidence) => {
|
|
13
|
+
const parameters = sideParametersSchema.parse(evidence.parameters);
|
|
14
|
+
if ((parameters.left_evidence_id === undefined) !==
|
|
15
|
+
(parameters.right_evidence_id === undefined) ||
|
|
16
|
+
(parameters.left_evidence_ids === undefined) !==
|
|
17
|
+
(parameters.right_evidence_ids === undefined))
|
|
18
|
+
throw new TypeError("Comparison Evidence source representation omitted one side");
|
|
19
|
+
const side = (single, multiple) => {
|
|
20
|
+
if (single !== undefined &&
|
|
21
|
+
multiple !== undefined &&
|
|
22
|
+
(multiple.length !== 1 || multiple[0] !== single))
|
|
23
|
+
throw new TypeError("Comparison Evidence source representations disagree");
|
|
24
|
+
const selected = single === undefined ? (multiple ?? []) : [single];
|
|
25
|
+
if (selected.length === 0)
|
|
26
|
+
throw new TypeError("Comparison Evidence omitted its source parameters");
|
|
27
|
+
if (new Set(selected).size !== selected.length)
|
|
28
|
+
throw new TypeError("Comparison Evidence repeats a source within one side");
|
|
29
|
+
return selected;
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
left: side(parameters.left_evidence_id, parameters.left_evidence_ids),
|
|
33
|
+
right: side(parameters.right_evidence_id, parameters.right_evidence_ids),
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/** Resolve the source closure without counting observations shared by both roles twice. */
|
|
37
|
+
export const comparisonSourceEvidenceIds = (evidence) => {
|
|
38
|
+
const sides = comparisonSourceEvidenceSides(evidence);
|
|
39
|
+
return uniqueSorted([...sides.left, ...sides.right]);
|
|
40
|
+
};
|
|
@@ -1,39 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* Canonical top-level comparison outcome shared by every comparison
|
|
4
|
-
* pipeline. Pipeline-native detail enums
|
|
5
|
-
*
|
|
6
|
-
* truncation) keep their wire schemas; the mappers below project each of
|
|
7
|
-
* them onto this triple without changing any pipeline result.
|
|
4
|
+
* pipeline. Pipeline-native detail enums keep their wire schemas, while
|
|
5
|
+
* shared result contracts use this canonical triple.
|
|
8
6
|
*/
|
|
9
7
|
export const comparisonStatusSchema = z.enum([
|
|
10
8
|
"unchanged",
|
|
11
9
|
"changed",
|
|
12
10
|
"unknown",
|
|
13
11
|
]);
|
|
14
|
-
/** Canonical comparison conclusion shared by every comparison pipeline. */
|
|
15
|
-
export const comparisonConclusionSchema = z.enum([
|
|
16
|
-
"observed_change",
|
|
17
|
-
"derived_relationship",
|
|
18
|
-
"contradiction",
|
|
19
|
-
"unresolved_branch",
|
|
20
|
-
]);
|
|
21
|
-
/** Project a bundle change classification onto the canonical triple. */
|
|
22
|
-
export const bundleClassificationToCanonical = (classification) => (classification === "unknown" ? "unknown" : "changed");
|
|
23
|
-
/** Project a source-to-bundle item status onto the canonical triple. */
|
|
24
|
-
export const sourceToBundleStatusToCanonical = (status) => status === "unchanged"
|
|
25
|
-
? "unchanged"
|
|
26
|
-
: status === "unknown"
|
|
27
|
-
? "unknown"
|
|
28
|
-
: "changed";
|
|
29
|
-
/**
|
|
30
|
-
* Project a function dimension status onto the canonical triple. A
|
|
31
|
-
* truncated dimension cannot support an unchanged/changed claim.
|
|
32
|
-
*/
|
|
33
|
-
export const functionStatusToCanonical = (status) => status === "unchanged"
|
|
34
|
-
? "unchanged"
|
|
35
|
-
: status === "changed"
|
|
36
|
-
? "changed"
|
|
37
|
-
: "unknown";
|
|
38
|
-
/** Project a browser-scenario artifact status onto the canonical triple. */
|
|
39
|
-
export const scenarioArtifactStatusToCanonical = (status) => status;
|
|
@@ -38,18 +38,6 @@ const VOLATILE_DIMENSIONS = new Set([
|
|
|
38
38
|
"created_at",
|
|
39
39
|
"updated_at",
|
|
40
40
|
]);
|
|
41
|
-
/** Dimension that carries semantic content. */
|
|
42
|
-
const SEMANTIC_DIMENSIONS = new Set([
|
|
43
|
-
"exit_code",
|
|
44
|
-
"stdout",
|
|
45
|
-
"stderr",
|
|
46
|
-
"filesystem",
|
|
47
|
-
"process",
|
|
48
|
-
"process_tree",
|
|
49
|
-
"shim_events",
|
|
50
|
-
"protocol_events",
|
|
51
|
-
"event_journal",
|
|
52
|
-
]);
|
|
53
41
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
54
42
|
const uniqueStrings = (values) => [
|
|
55
43
|
...new Set(values.filter((value) => value.length > 0)),
|
|
@@ -172,10 +160,6 @@ const comparisonIncompleteStatus = (expected, actual, options) => {
|
|
|
172
160
|
export function isVolatileDimension(name) {
|
|
173
161
|
return VOLATILE_DIMENSIONS.has(name);
|
|
174
162
|
}
|
|
175
|
-
/** Check if a dimension name carries semantic content. */
|
|
176
|
-
export function isSemanticDimension(name) {
|
|
177
|
-
return SEMANTIC_DIMENSIONS.has(name);
|
|
178
|
-
}
|
|
179
163
|
/**
|
|
180
164
|
* Compare two values for a dimension, classifying semantic diffs
|
|
181
165
|
* from timing/normalization noise.
|
package/dist/domain/evidence.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { digestCanonicalValue } from "./canonicalDigest.js";
|
|
3
|
+
import { canonicalJsonDigestSteps } from "./canonicalJsonDigestSteps.js";
|
|
3
4
|
import { analysisProfileSchema, } from "./analysisProfile.js";
|
|
4
|
-
import { jsonValueSchema } from "./jsonValue.js";
|
|
5
|
+
import { jsonObjectSchema, jsonValueSchema, jsonValueValidationIssue, jsonValueValidationSteps, } from "./jsonValue.js";
|
|
6
|
+
import { freezeJsonSnapshot, isImmutableJsonSnapshot, } from "./immutableJson.js";
|
|
5
7
|
import { digestSchema } from "./../domain/digests.js";
|
|
6
8
|
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
7
9
|
/** Provider identity schema shared by evidence-bearing persistence formats. */
|
|
@@ -79,7 +81,7 @@ const evidenceBaseSchema = z
|
|
|
79
81
|
provider: providerSchema,
|
|
80
82
|
predicate_type: z.string().min(1),
|
|
81
83
|
operation: z.string().min(1),
|
|
82
|
-
parameters:
|
|
84
|
+
parameters: jsonObjectSchema,
|
|
83
85
|
raw_result: jsonValueSchema.nullable(),
|
|
84
86
|
normalized_result: jsonValueSchema,
|
|
85
87
|
confidence: z.enum(["observed", "derived", "inferred"]),
|
|
@@ -116,6 +118,14 @@ export const evidenceRecordSchema = z.union([
|
|
|
116
118
|
profiledEvidenceSchema,
|
|
117
119
|
evidenceBaseSchema,
|
|
118
120
|
]);
|
|
121
|
+
const immutableEvidenceSnapshots = new WeakMap();
|
|
122
|
+
const immutableResultSchema = z
|
|
123
|
+
.custom(isImmutableJsonSnapshot)
|
|
124
|
+
.superRefine((value, context) => {
|
|
125
|
+
const issue = jsonValueValidationIssue(value);
|
|
126
|
+
if (issue !== undefined)
|
|
127
|
+
context.addIssue({ code: "custom", message: issue });
|
|
128
|
+
});
|
|
119
129
|
const semanticProjection = (evidence) => ({
|
|
120
130
|
subject: evidence.subject === null
|
|
121
131
|
? null
|
|
@@ -140,22 +150,64 @@ const semanticProjection = (evidence) => ({
|
|
|
140
150
|
locations: evidence.locations,
|
|
141
151
|
evidence_links: evidence.evidence_links,
|
|
142
152
|
});
|
|
143
|
-
/**
|
|
153
|
+
/** Hash semantic content, including raw results and excluding display-subject fields. */
|
|
144
154
|
const computeEvidenceId = (evidence) => `ev_${digestCanonicalValue(semanticProjection(evidence), "Evidence")}`;
|
|
145
155
|
/** Parse evidence and reject a syntactically valid but tampered semantic ID. */
|
|
146
156
|
export const parseEvidence = (input) => {
|
|
147
|
-
const
|
|
157
|
+
const immutable = typeof input === "object" && input !== null
|
|
158
|
+
? immutableEvidenceSnapshots.get(input)
|
|
159
|
+
: undefined;
|
|
160
|
+
if (immutable !== undefined)
|
|
161
|
+
return immutable;
|
|
162
|
+
// Select the producer's envelope before traversing its payload. A legacy
|
|
163
|
+
// record cannot satisfy the required-profile branch, whose failed parse
|
|
164
|
+
// would otherwise clone the entire normalized result before trying legacy.
|
|
165
|
+
const schema = typeof input === "object" && input !== null && "analysis_profile" in input
|
|
166
|
+
? profiledEvidenceSchema
|
|
167
|
+
: evidenceBaseSchema;
|
|
168
|
+
const evidence = schema.parse(input);
|
|
148
169
|
const { evidence_id: evidenceId, ...withoutId } = evidence;
|
|
149
170
|
if (computeEvidenceId(withoutId) !== evidenceId)
|
|
150
171
|
throw new TypeError("Evidence semantic identifier does not match its record");
|
|
151
172
|
return evidence;
|
|
152
173
|
};
|
|
174
|
+
/** Authenticate and seal a ledger-owned snapshot; external mutable values are copied first. */
|
|
175
|
+
export const immutableEvidence = (input) => rememberImmutableEvidence(parseEvidence(input));
|
|
176
|
+
/** Recognize authenticated Evidence whose complete reachable JSON data is immutable. */
|
|
177
|
+
export const isImmutableEvidence = (evidence) => immutableEvidenceSnapshots.has(evidence);
|
|
178
|
+
const rememberImmutableEvidence = (evidence) => {
|
|
179
|
+
freezeJsonSnapshot(evidence);
|
|
180
|
+
immutableEvidenceSnapshots.set(evidence, evidence);
|
|
181
|
+
return evidence;
|
|
182
|
+
};
|
|
153
183
|
/** Build deterministic Evidence from an immutable artifact subject. */
|
|
154
184
|
export const createEvidence = (target, provider, observation) => {
|
|
185
|
+
const { normalized, sharedResult } = normalizeEvidenceObservation(target, provider, observation);
|
|
186
|
+
const evidence = {
|
|
187
|
+
...normalized,
|
|
188
|
+
evidence_id: computeEvidenceId(normalized),
|
|
189
|
+
};
|
|
190
|
+
return sharedResult ? rememberImmutableEvidence(evidence) : evidence;
|
|
191
|
+
};
|
|
192
|
+
/** Create Evidence from owned immutable JSON while exposing cooperative computation steps. */
|
|
193
|
+
export function* createImmutableEvidenceSteps(target, provider, observation) {
|
|
194
|
+
if (!isImmutableJsonSnapshot(observation.result))
|
|
195
|
+
throw new TypeError("Cooperative Evidence requires an authenticated immutable result");
|
|
196
|
+
// The envelope parser below retains its usual diagnostics, using the completed
|
|
197
|
+
// immutable validation rather than traversing the payload synchronously again.
|
|
198
|
+
yield* jsonValueValidationSteps(observation.result);
|
|
199
|
+
const { normalized } = normalizeEvidenceObservation(target, provider, observation);
|
|
200
|
+
const digest = yield* canonicalJsonDigestSteps(semanticProjection(normalized));
|
|
201
|
+
return rememberImmutableEvidence({
|
|
202
|
+
...normalized,
|
|
203
|
+
evidence_id: `ev_${digest}`,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
const normalizeEvidenceObservation = (target, provider, observation) => {
|
|
155
207
|
const subject = target === undefined
|
|
156
208
|
? null
|
|
157
209
|
: {
|
|
158
|
-
name: target.path.split("/").at(-1)
|
|
210
|
+
name: target.path.split("/").at(-1) || "artifact",
|
|
159
211
|
digest: { sha256: target.sha256 },
|
|
160
212
|
format: target.format,
|
|
161
213
|
architecture: target.architecture ?? null,
|
|
@@ -187,20 +239,35 @@ export const createEvidence = (target, provider, observation) => {
|
|
|
187
239
|
environment: observation.environment ?? null,
|
|
188
240
|
limitations: [
|
|
189
241
|
...(target === undefined
|
|
190
|
-
? [
|
|
242
|
+
? [
|
|
243
|
+
observation.subjectUnavailableReason ??
|
|
244
|
+
"Artifact identity is unavailable for this observation.",
|
|
245
|
+
]
|
|
191
246
|
: []),
|
|
192
247
|
...(observation.limitations ?? []),
|
|
193
248
|
],
|
|
194
249
|
locations: [...(observation.locations ?? [])],
|
|
195
250
|
evidence_links: [...(observation.evidenceLinks ?? [])],
|
|
196
251
|
};
|
|
197
|
-
|
|
252
|
+
// Select the known envelope before parsing. A union otherwise traverses and
|
|
253
|
+
// clones a legacy result for the profiled branch before rejecting its absent
|
|
254
|
+
// profile and trying the legacy branch.
|
|
255
|
+
const schema = observation.analysisProfile === undefined
|
|
256
|
+
? evidenceBaseSchema
|
|
257
|
+
: profiledEvidenceSchema;
|
|
258
|
+
const sharedResult = typeof observation.result === "object" &&
|
|
259
|
+
observation.result !== null &&
|
|
260
|
+
isImmutableJsonSnapshot(observation.result);
|
|
261
|
+
const selectedSchema = sharedResult
|
|
262
|
+
? schema.safeExtend({ normalized_result: immutableResultSchema })
|
|
263
|
+
: schema;
|
|
264
|
+
const normalized = selectedSchema.parse({
|
|
198
265
|
...semantic,
|
|
199
266
|
evidence_id: `ev_${"0".repeat(64)}`,
|
|
200
267
|
subject,
|
|
201
268
|
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
269
|
+
// The envelope has already been parsed into an independent snapshot. Only
|
|
270
|
+
// its derived identifier changes here; parsing again clones the full payload
|
|
271
|
+
// and recomputes the same digest while the previous snapshot is still live.
|
|
272
|
+
return { normalized, sharedResult };
|
|
206
273
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
|
-
import { evidenceEnvelopeSchema, evidenceRecordSchema, parseEvidence, providerSchema, } from "./evidence.js";
|
|
3
|
+
import { evidenceEnvelopeSchema, evidenceRecordSchema, immutableEvidence, parseEvidence, providerSchema, } from "./evidence.js";
|
|
4
4
|
import { residualUnknownSchema, } from "./residualUnknown.js";
|
|
5
|
+
import { freezeJsonSnapshot } from "./immutableJson.js";
|
|
5
6
|
const artifactManifestSchema = evidenceEnvelopeSchema.shape.subject
|
|
6
7
|
.unwrap()
|
|
7
8
|
.pick({
|
|
@@ -29,6 +30,19 @@ export const evidenceBundleSchema = z.object({
|
|
|
29
30
|
unknowns: z.array(residualUnknownSchema),
|
|
30
31
|
records: z.array(evidenceRecordSchema),
|
|
31
32
|
});
|
|
33
|
+
const immutableBundles = new WeakMap();
|
|
34
|
+
/** Build and authenticate a sealed bundle while reusing immutable Evidence records. */
|
|
35
|
+
export const createImmutableEvidenceBundle = (records, unknowns = []) => {
|
|
36
|
+
const checkedRecords = records.map(immutableEvidence);
|
|
37
|
+
if (new Set(checkedRecords.map(({ evidence_id }) => evidence_id)).size !==
|
|
38
|
+
checkedRecords.length)
|
|
39
|
+
throw new TypeError("Evidence bundle contains duplicate record IDs");
|
|
40
|
+
const checkedUnknowns = unknowns.map((unknown) => residualUnknownSchema.parse(unknown));
|
|
41
|
+
validateUnknownGraph(checkedUnknowns, checkedRecords);
|
|
42
|
+
const bundle = freezeJsonSnapshot(createEvidenceBundle(checkedRecords, checkedUnknowns));
|
|
43
|
+
immutableBundles.set(bundle, bundle);
|
|
44
|
+
return bundle;
|
|
45
|
+
};
|
|
32
46
|
/** Project records into a deterministic bundle whose order has no semantics. */
|
|
33
47
|
export const createEvidenceBundle = (records, unknowns = []) => {
|
|
34
48
|
const sortedRecords = [...records].sort((left, right) => left.evidence_id.localeCompare(right.evidence_id));
|
|
@@ -120,8 +134,35 @@ const referencedEvidenceIds = (unknown) => [
|
|
|
120
134
|
...unknown.mutation_evidence_ids,
|
|
121
135
|
...(unknown.resolution?.evidence_ids ?? []),
|
|
122
136
|
];
|
|
137
|
+
/**
|
|
138
|
+
* Name the bundle constraint that failed and how to recover. A single
|
|
139
|
+
* Evidence record, such as one command result, is not a bundle.
|
|
140
|
+
*/
|
|
141
|
+
export const describeEvidenceBundleFailure = (input, cause) => {
|
|
142
|
+
const record = evidenceRecordSchema.safeParse(input);
|
|
143
|
+
if (record.success)
|
|
144
|
+
return `Expected an Evidence bundle with records and manifest arrays, but this JSON is one Evidence record (${record.data.evidence_id}). Export a session bundle with the MCP export_evidence_bundle tool and supply that file.`;
|
|
145
|
+
return cause instanceof z.ZodError
|
|
146
|
+
? `Evidence bundle does not match the bundle schema ${describeValidationFailure(cause)}. Supply an unmodified bundle written by export_evidence_bundle or rea evidence-export.`
|
|
147
|
+
: `Evidence bundle validation failed: ${describeValidationFailure(cause)}. Recreate or re-export the bundle, then try again.`;
|
|
148
|
+
};
|
|
149
|
+
/** Locate the first schema issue, or keep a thrown constraint message. */
|
|
150
|
+
export const describeValidationFailure = (cause) => {
|
|
151
|
+
if (!(cause instanceof z.ZodError))
|
|
152
|
+
return cause instanceof Error ? cause.message : String(cause);
|
|
153
|
+
const [first, ...rest] = cause.issues;
|
|
154
|
+
const location = first === undefined || first.path.length === 0
|
|
155
|
+
? "the document root"
|
|
156
|
+
: first.path.map(String).join(".");
|
|
157
|
+
return `at ${location}: ${first?.message ?? "invalid value"}${rest.length === 0 ? "" : ` (${String(rest.length)} more issues)`}`;
|
|
158
|
+
};
|
|
123
159
|
/** Parse records, verify semantic IDs, and reject inconsistent manifests. */
|
|
124
160
|
export const parseEvidenceBundle = (input) => {
|
|
161
|
+
if (typeof input === "object" && input !== null) {
|
|
162
|
+
const owned = immutableBundles.get(input);
|
|
163
|
+
if (owned !== undefined)
|
|
164
|
+
return owned;
|
|
165
|
+
}
|
|
125
166
|
const parsed = evidenceBundleSchema.parse(input);
|
|
126
167
|
const recordIds = parsed.records.map(({ evidence_id: id }) => id);
|
|
127
168
|
if (new Set(recordIds).size !== recordIds.length)
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { AnalysisError } from "./analysisErrorBase.js";
|
|
1
|
+
import { AnalysisError, } from "./analysisErrorBase.js";
|
|
2
2
|
/** Evidence identity, schema, or bundle manifests failed integrity checks. */
|
|
3
3
|
export class EvidenceIntegrityError extends AnalysisError {
|
|
4
4
|
_tag = "EvidenceIntegrityError";
|
|
5
|
+
userMessage;
|
|
6
|
+
constructor(message, options) {
|
|
7
|
+
super(message, options);
|
|
8
|
+
this.userMessage = options?.userMessage;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** A valid snapshot belongs to a different target, provider, or analysis profile. */
|
|
12
|
+
export class AnalysisSnapshotMismatchError extends EvidenceIntegrityError {
|
|
5
13
|
}
|
|
6
14
|
/** A session Evidence reference is missing or has the wrong semantic identity. */
|
|
7
15
|
export class EvidenceReferenceError extends EvidenceIntegrityError {
|
|
@@ -22,9 +30,12 @@ export class EvidenceFileError extends AnalysisError {
|
|
|
22
30
|
operation;
|
|
23
31
|
reason;
|
|
24
32
|
_tag = "EvidenceFileError";
|
|
33
|
+
/** Caller-selected path that failed, resolved against the working directory. */
|
|
34
|
+
path;
|
|
25
35
|
constructor(operation, reason, options) {
|
|
26
36
|
super(`Evidence bundle ${operation} failed: ${reason}`, options);
|
|
27
37
|
this.operation = operation;
|
|
28
38
|
this.reason = reason;
|
|
39
|
+
this.path = options?.path;
|
|
29
40
|
}
|
|
30
41
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const byteOffset = z.number().int().nonnegative();
|
|
3
|
+
const sha256 = z.string().regex(/^[a-f0-9]{64}$/);
|
|
4
|
+
/** Select the carrier representation explicitly; no RPC or deployed-contract lookup is implied. */
|
|
5
|
+
export const inspectEvmInterfaceInputSchema = z.strictObject({
|
|
6
|
+
path: z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.describe("Absolute path to caller-selected local bytecode carrier"),
|
|
10
|
+
encoding: z
|
|
11
|
+
.enum(["raw", "hex"])
|
|
12
|
+
.describe("Raw bytes or UTF-8 hex with optional 0x prefix and outer ASCII whitespace"),
|
|
13
|
+
});
|
|
14
|
+
/** Recovered interface candidates are inferences, independently of observed byte identity. */
|
|
15
|
+
export const evmInterfaceSchema = z
|
|
16
|
+
.strictObject({
|
|
17
|
+
artifact: z.strictObject({
|
|
18
|
+
path: z.string().min(1),
|
|
19
|
+
sha256,
|
|
20
|
+
bytes: byteOffset,
|
|
21
|
+
encoding: z.enum(["raw", "hex"]),
|
|
22
|
+
}),
|
|
23
|
+
bytecode: z.strictObject({
|
|
24
|
+
sha256,
|
|
25
|
+
bytes: byteOffset,
|
|
26
|
+
hex: z.string().regex(/^(?:[0-9a-f]{2})*$/),
|
|
27
|
+
digest_algorithm: z.literal("sha256"),
|
|
28
|
+
kind: z.literal("unknown"),
|
|
29
|
+
deployment_authenticity: z.literal("unknown"),
|
|
30
|
+
hardfork: z.literal("unknown"),
|
|
31
|
+
}),
|
|
32
|
+
evidence_kind: z.literal("inferred"),
|
|
33
|
+
functions: z.array(z.strictObject({
|
|
34
|
+
selector: z.string().regex(/^0x[0-9a-f]{8}$/),
|
|
35
|
+
bytecode_offset: byteOffset,
|
|
36
|
+
dispatch: z.enum(["abi", "fallback"]),
|
|
37
|
+
inferred_arguments: z.string().nullable(),
|
|
38
|
+
inferred_state_mutability: z.string().nullable(),
|
|
39
|
+
})),
|
|
40
|
+
discovery_completeness: z.literal("unknown"),
|
|
41
|
+
runtime_execution: z.literal("not-performed"),
|
|
42
|
+
diagnostics: z.strictObject({
|
|
43
|
+
stdout: z.string(),
|
|
44
|
+
stderr: z.string(),
|
|
45
|
+
truncated: z.boolean(),
|
|
46
|
+
}),
|
|
47
|
+
limitations: z.array(z.string()),
|
|
48
|
+
})
|
|
49
|
+
.superRefine((value, context) => {
|
|
50
|
+
if (value.bytecode.hex.length !== value.bytecode.bytes * 2)
|
|
51
|
+
context.addIssue({
|
|
52
|
+
code: "custom",
|
|
53
|
+
path: ["bytecode"],
|
|
54
|
+
message: "Selected byte count does not match the bytecode hex representation.",
|
|
55
|
+
});
|
|
56
|
+
for (const [index, fn] of value.functions.entries())
|
|
57
|
+
if (fn.bytecode_offset >= value.bytecode.bytes)
|
|
58
|
+
context.addIssue({
|
|
59
|
+
code: "custom",
|
|
60
|
+
path: ["functions", index, "bytecode_offset"],
|
|
61
|
+
message: "Inferred body offset lies outside the selected bytecode.",
|
|
62
|
+
});
|
|
63
|
+
});
|