rea-agents 6.1.0 → 6.3.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 +24 -24
- package/bridge/ghidra/ReaGhidraBridge.java +32 -4
- package/bridge/hopper_bridge.py +8 -1
- package/dist/android/JadxConfiguration.js +87 -7
- package/dist/android/JadxMcpTransport.js +14 -2
- package/dist/android/JadxProvider.js +64 -36
- package/dist/android/JadxSession.js +51 -9
- package/dist/application/BinaryTargetResolver.js +68 -20
- package/dist/application/BrowserEvidence.js +3 -8
- package/dist/application/BrowserScenarioEvidence.js +4 -20
- package/dist/application/CapabilityInventory.js +43 -9
- package/dist/application/ClientConfigurationDocument.js +97 -25
- package/dist/application/ClientRegistrationStatus.js +19 -6
- package/dist/application/DirectAnalysis.js +41 -20
- package/dist/application/DirectAnalysisCleanup.js +71 -0
- package/dist/application/DirectAnalysisStatus.js +3 -7
- package/dist/application/Doctor.js +40 -53
- package/dist/application/DoctorDiagnostics.js +2 -3
- package/dist/application/EnhancedTools.js +51 -6
- package/dist/application/EvidenceBundleFiles.js +8 -3
- package/dist/application/InvestigationProviders.js +13 -5
- package/dist/application/JsonFiles.js +56 -23
- package/dist/application/LinuxHopper.js +11 -7
- package/dist/application/MacHopper.js +15 -18
- package/dist/application/RealHopperAssertions.js +0 -11
- package/dist/application/ReconstructionObligationCandidates.js +10 -3
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -1
- package/dist/application/ReferenceSourceImportEntries.js +1 -1
- package/dist/application/RegularFileRead.js +17 -0
- package/dist/application/Setup.js +26 -23
- package/dist/application/SetupClientConfiguration.js +18 -7
- package/dist/application/SetupHost.js +20 -29
- package/dist/application/SetupPlan.js +24 -20
- package/dist/application/SetupSkill.js +57 -8
- package/dist/application/SupportedClients.js +43 -0
- package/dist/application/Uninstall.js +98 -30
- package/dist/application/UpdateMaintenance.js +13 -7
- package/dist/application/UpdateRuntime.js +12 -12
- package/dist/application/Utf8JsonInput.js +64 -0
- package/dist/application/WebScriptExportService.js +38 -5
- package/dist/application/WorkflowEvidence.js +25 -2
- package/dist/application/XrefsAddressResolution.js +45 -0
- package/dist/application/analysisView/AnalysisViewService.js +76 -0
- package/dist/application/android/AndroidAnalysisService.js +1 -1
- package/dist/application/binary/AnalysisClientCleanup.js +30 -5
- package/dist/application/binary/AnalysisProviderEvaluation.js +1 -2
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -6
- package/dist/application/binary/AnalysisSnapshotCache.js +13 -10
- package/dist/application/binary/BinarySession.js +86 -29
- package/dist/application/binary/BinarySessionComposition.js +1 -3
- package/dist/application/binary/BinarySessionExecution.js +3 -5
- package/dist/application/binary/BinarySessionOpen.js +10 -2
- package/dist/application/binary/BinarySessionRecords.js +1 -1
- package/dist/application/binary/BinarySessionStatus.js +1 -6
- package/dist/application/binary/CompositeProvider.js +4 -18
- package/dist/application/binary/LazyAnalysisProvider.js +5 -5
- package/dist/application/binary/SessionProviderRouter.js +27 -135
- package/dist/application/homebrew.js +48 -0
- package/dist/application/javascript/ElectronActiveEvidence.js +10 -14
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +5 -1
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +3 -6
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +107 -46
- package/dist/application/javascript/JavaScriptApplicationService.js +7 -1
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +59 -45
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +5 -9
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +19 -27
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +11 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +9 -0
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +8 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +46 -29
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +86 -27
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +52 -9
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +1 -0
- package/dist/application/javascript/JavaScriptJsonModules.js +2 -2
- package/dist/application/javascript/JavaScriptModuleRelationships.js +6 -18
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -3
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +11 -27
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +4 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +8 -6
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +7 -5
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +3 -4
- package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +3 -7
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +76 -47
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -4
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +51 -25
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +15 -10
- package/dist/application/managed/ManagedMemberComparisonService.js +2 -1
- package/dist/application/managed/ManagedNativeVerificationService.js +2 -1
- package/dist/application/native/NativeCallRoutes.js +2 -4
- package/dist/application/process/ProcessCli.js +11 -11
- package/dist/application/process/ProcessEvidence.js +0 -1
- package/dist/artifacts/ArtifactProvider.js +53 -30
- package/dist/artifacts/ArtifactProviderMetadata.js +1 -4
- package/dist/artifacts/ArtifactReader.js +31 -0
- package/dist/artifacts/AsarArtifactReader.js +81 -17
- package/dist/artifacts/DirectoryArtifactReader.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +9 -2
- package/dist/artifacts/NativeDmgArtifactReader.js +207 -77
- package/dist/artifacts/NativeDmgOwnership.js +109 -0
- package/dist/artifacts/SafeOutputTree.js +16 -2
- package/dist/artifacts/ZipArtifactReader.js +11 -4
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +4 -2
- package/dist/artifacts/apple/DylibResolutionReader.js +17 -7
- package/dist/artifacts/apple/KeyedArchiveReader.js +68 -42
- package/dist/artifacts/apple/MachoLoadCommandReader.js +36 -6
- package/dist/artifacts/extraction/ArtifactExtraction.js +104 -29
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +71 -66
- package/dist/artifacts/inventory/ArtifactInventory.js +0 -1
- package/dist/artifacts/inventory/classify.js +33 -14
- package/dist/artifacts/inventory/hashStableRootArtifact.js +37 -0
- package/dist/artifacts/inventory/reader.js +3 -3
- package/dist/artifacts/inventory/scanCanonical.js +64 -34
- package/dist/artifacts/inventory/scanReader.js +12 -20
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +65 -27
- package/dist/browser/BrowserScenarioPartialObservation.js +106 -0
- package/dist/browser/CdpBrowserProvider.js +6 -6
- package/dist/browser/CdpCaptureEventHandlers.js +2 -4
- package/dist/browser/CdpCaptureEvents.js +0 -1
- package/dist/browser/CdpCaptureStorageFingerprints.js +3 -3
- package/dist/browser/CdpCaptureValues.js +20 -0
- package/dist/browser/CdpElectronInspection.js +2 -2
- package/dist/browser/CdpElectronProvider.js +4 -5
- package/dist/browser/CdpElectronScriptEvents.js +2 -8
- package/dist/browser/CdpElectronScripts.js +4 -5
- package/dist/browser/CdpPageCaptureScripts.js +2 -3
- package/dist/browser/CdpSafeMetadata.js +10 -10
- package/dist/browser/CdpWebMcpDiscovery.js +16 -13
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +64 -49
- package/dist/browser/PlaywrightElectronActiveActions.js +2 -56
- package/dist/browser/PlaywrightElectronActiveProvider.js +10 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +1 -1
- package/dist/browser/PlaywrightScenarioBrowser.js +269 -66
- package/dist/browser/PlaywrightScenarioEvents.js +1 -1
- package/dist/browser/PlaywrightScenarioSession.js +41 -32
- package/dist/browser/WebSourceMapFetcher.js +32 -6
- package/dist/browser/assets/ScenarioScriptCapture.js +8 -12
- package/dist/browser/assets/ScriptCaptureAdapters.js +1 -1
- package/dist/browser/history/CaptureFailures.js +6 -2
- package/dist/browser/history/MitmproxyCaptureAdapter.js +4 -2
- package/dist/catalogIdentity.js +0 -1
- package/dist/cli/analysisViewCommands.js +36 -0
- package/dist/cli/artifactCommands.js +11 -12
- package/dist/cli/coreAnalysisCommands.js +3 -3
- package/dist/cli/coreBinaryCommands.js +37 -28
- package/dist/cli/coreNativeCommands.js +9 -10
- package/dist/cli/electronCommands.js +12 -13
- package/dist/cli/interactiveSetup.js +6 -6
- package/dist/cli/javascriptApplicationAnalysis.js +2 -12
- package/dist/cli/jsonOutput.js +3 -2
- package/dist/cli/managedCommands.js +7 -8
- package/dist/cli/nativeCallCommands.js +1 -2
- package/dist/cli/omittableDefaults.js +50 -0
- package/dist/cli/processCommands.js +3 -2
- package/dist/cli/setupCommands.js +16 -15
- package/dist/cli/streamedJsonOutput.js +83 -4
- package/dist/cli/utilityCommands.js +10 -12
- package/dist/cli.js +19 -8
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +1 -0
- package/dist/cliJsonFile.js +179 -0
- package/dist/cliJsonInput.js +60 -33
- package/dist/cliObservationOptions.js +4 -0
- package/dist/cliOutput.js +0 -38
- package/dist/composition/auxiliaryAnalysisProviders.js +30 -25
- package/dist/composition/binary.js +9 -9
- package/dist/composition/browserScenario.js +2 -1
- package/dist/composition/directAnalysis.js +20 -14
- package/dist/composition/electronScenario.js +1 -1
- package/dist/composition/optionalObservationProviders.js +12 -7
- package/dist/config/environment.js +6 -0
- package/dist/config/ghidraStartupTimeout.js +4 -9
- package/dist/config/homeDirectory.js +12 -0
- package/dist/config/mcpResponseBudget.js +9 -1
- package/dist/config/parseConfig.js +7 -3
- package/dist/config/parsers.js +19 -22
- package/dist/contracts/analysisViewToolContracts.js +56 -0
- package/dist/contracts/applicationToolContracts.js +5 -4
- package/dist/contracts/artifactComparisonExample.js +7 -7
- package/dist/contracts/artifactToolContracts.js +1 -1
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +19 -15
- package/dist/contracts/enhancedInputs.js +2 -2
- package/dist/contracts/enhancedToolContracts.js +4 -3
- package/dist/contracts/errorSchemas.js +3 -1
- package/dist/contracts/evm/evmToolContracts.js +1 -1
- package/dist/contracts/functionComparisonExample.js +8 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +181 -0
- package/dist/contracts/investigationExamples.js +4 -3
- package/dist/contracts/javascript/electronToolContracts.js +3 -2
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +3 -22
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +248 -0
- package/dist/contracts/javascript/javascriptRuntimeObservationToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +8 -7
- package/dist/contracts/managed/managedToolContracts.js +8 -12
- package/dist/contracts/managed/managedWorkflowToolContracts.js +1 -1
- package/dist/contracts/mobileApplicationGraphExamples.js +8 -8
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +1 -1
- package/dist/contracts/native/nativeToolContracts.js +2 -2
- package/dist/contracts/officialToolContracts.js +2 -1
- package/dist/contracts/promptContracts.js +2 -2
- package/dist/contracts/providerSelection.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -3
- package/dist/contracts/sessionStatusContract.js +3 -2
- package/dist/contracts/sessionToolContracts.js +17 -4
- package/dist/contracts/sessionToolSchemas.js +4 -16
- package/dist/contracts/toolContracts.js +2 -0
- package/dist/contracts/toolEffects.js +1 -0
- package/dist/contracts/toolOutputSchemaGroups.js +138 -94
- package/dist/contracts/toolOutputSchemaPrimitives.js +13 -26
- package/dist/contracts/toolSchemaMetadata.js +18 -69
- package/dist/contracts/webNetworkCaptureToolContracts.js +1 -1
- package/dist/contracts/webRuntimeToolContracts.js +1 -1
- package/dist/contracts/webScriptToolContracts.js +1 -1
- package/dist/doctorRuntime.js +7 -5
- package/dist/domain/analysisErrorBase.js +5 -0
- package/dist/domain/analysisErrorCore.js +3 -0
- package/dist/domain/analysisErrorPresentation.js +22 -5
- package/dist/domain/analysisErrorProjection.js +24 -5
- package/dist/domain/analysisSnapshot.js +31 -31
- package/dist/domain/analysisView/analysisView.js +241 -0
- package/dist/domain/analysisView/analysisViewCoverage.js +19 -0
- package/dist/domain/analysisView/binaryLayoutView.js +159 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +238 -0
- package/dist/domain/android/androidApplication.js +1 -1
- package/dist/domain/android/androidPartialObservation.js +36 -0
- package/dist/domain/apple/appleApplication.js +1 -1
- package/dist/domain/apple/dylibResolution.js +10 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +0 -1
- package/dist/domain/apple/keyedArchive.js +26 -2
- package/dist/domain/artifactComparison.js +15 -6
- package/dist/domain/artifactGraph.js +17 -4
- package/dist/domain/artifactIdentity.js +8 -8
- package/dist/domain/artifactInspection.js +8 -8
- package/dist/domain/artifactInventoryEvidence.js +9 -16
- package/dist/domain/artifactOperationError.js +3 -3
- package/dist/domain/artifactPartialObservation.js +1 -0
- package/dist/domain/artifactPathSyntax.js +49 -0
- package/dist/domain/binaryTarget.js +39 -13
- package/dist/domain/browserCaptureComparison.js +13 -49
- package/dist/domain/browserCompleteness.js +3 -2
- package/dist/domain/browserNetworkEvidence.js +10 -4
- package/dist/domain/browserObservation.js +0 -1
- package/dist/domain/browserObservationSchemas.js +14 -3
- package/dist/domain/browserScenario.js +0 -1
- package/dist/domain/browserScenarioCapture.js +1 -2
- package/dist/domain/browserScenarioCaptureValues.js +2 -2
- package/dist/domain/browserScenarioDiff.js +0 -2
- package/dist/domain/browserScenarioDiffEvidence.js +0 -12
- package/dist/domain/browserScenarioDiffValues.js +2 -2
- package/dist/domain/browserScenarioNormalization.js +3 -3
- package/dist/domain/browserScenarioValues.js +6 -6
- package/dist/domain/callPath.js +15 -18
- package/dist/domain/callPathSchemas.js +2 -2
- package/dist/domain/canonicalDigest.js +7 -1
- package/dist/domain/canonicalOrdering.js +1 -13
- package/dist/domain/changedBehavior.js +5 -6
- package/dist/domain/comparisonSemantics.js +0 -5
- package/dist/domain/completionLedgerGeneration.js +2 -1
- package/dist/domain/configurationErrors.js +12 -0
- package/dist/domain/conformancePackage.js +4 -3
- package/dist/domain/digests.js +0 -3
- package/dist/domain/evidence.js +19 -40
- package/dist/domain/evidenceBundle.js +58 -42
- package/dist/domain/evidenceCompletionLedger.js +2 -1
- package/dist/domain/firmware/firmwareAnalysis.js +4 -3
- package/dist/domain/functionComparison.js +6 -6
- package/dist/domain/functionComparisonDimensions.js +120 -87
- package/dist/domain/functionComparisonNormalization.js +26 -36
- package/dist/domain/functionComparisonResults.js +3 -6
- package/dist/domain/functionComparisonSchemas.js +2 -8
- package/dist/domain/functionDossierEvidence.js +4 -38
- package/dist/domain/hopperValues.js +11 -15
- package/dist/domain/javascript/electronActiveObservation.js +29 -71
- package/dist/domain/javascript/electronObservation.js +14 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +12 -11
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +11 -2
- package/dist/domain/javascript/electronStaticAnalysisNative.js +7 -4
- package/dist/domain/javascript/electronStaticAnalysisValues.js +8 -4
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +3 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +12 -8
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +6 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +41 -16
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +9 -2
- package/dist/domain/javascript/javascriptApplicationVersionComparison.js +4 -4
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +37 -22
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +50 -36
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +9 -8
- package/dist/domain/javascript/javascriptAstFingerprint.js +2 -2
- package/dist/domain/javascript/javascriptAstValues.js +22 -0
- package/dist/{application/javascript/JavaScriptReturnShapeProjection.js → domain/javascript/javascriptExportReturnShapeProjection.js} +4 -4
- package/dist/domain/javascript/javascriptExportShapeComparison.js +10 -3
- package/dist/domain/javascript/javascriptExportShapeComparisonIdentity.js +6 -1
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +58 -22
- package/dist/domain/javascript/javascriptExportShapeSelection.js +7 -7
- package/dist/domain/javascript/javascriptExportShapeVariants.js +70 -16
- package/dist/domain/javascript/javascriptFeatureSeed.js +25 -3
- package/dist/domain/javascript/javascriptFeatureTrace.js +7 -6
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +17 -9
- package/dist/domain/javascript/javascriptFeatureTraversal.js +4 -5
- package/dist/domain/javascript/javascriptNativeHandoff.js +7 -7
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeObservation.js +18 -7
- package/dist/domain/javascript/javascriptRuntimeReconciliation.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationActive.js +9 -8
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +212 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +5 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +6 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +12 -222
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +7 -7
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +209 -11
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +2 -1
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +9 -7
- package/dist/domain/javascript/javascriptSemanticCalls.js +2 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +4 -3
- package/dist/domain/javascript/javascriptSemanticCoverage.js +20 -0
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -9
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +4 -11
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +2 -2
- package/dist/domain/javascript/javascriptSemanticGraph.js +220 -71
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +19 -1
- package/dist/domain/javascript/javascriptSemanticIr.js +0 -4
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +106 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +515 -74
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +44 -36
- package/dist/domain/javascript/javascriptSemanticObjects.js +79 -42
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +8 -14
- package/dist/domain/javascript/javascriptSemanticProjection.js +21 -16
- package/dist/domain/javascript/javascriptSemanticPromises.js +16 -21
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +23 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +3 -3
- package/dist/domain/javascript/javascriptSemanticQuery.js +8 -2
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +3 -2
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -9
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +16 -10
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +1 -1
- package/dist/domain/javascript/javascriptSemanticResources.js +1 -1
- package/dist/domain/javascript/javascriptSemanticReturns.js +55 -44
- package/dist/domain/javascript/javascriptSemanticSlots.js +72 -0
- package/dist/domain/javascript/javascriptSemanticTraversal.js +6 -1
- package/dist/domain/javascript/javascriptSemanticValues.js +180 -76
- package/dist/domain/javascript/javascriptSourceMapPaths.js +114 -0
- package/dist/domain/javascript/javascriptSourceParser.js +34 -9
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -6
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +2 -1
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +26 -16
- package/dist/domain/javascript/sourceToBundleComparison.js +19 -8
- package/dist/domain/javascript/sourceToBundleSignals.js +53 -25
- package/dist/domain/jsonSerialization.js +109 -55
- package/dist/domain/jsonShape.js +46 -19
- package/dist/domain/localPath.js +10 -4
- package/dist/domain/managed/managedApplicationGraph.js +10 -6
- package/dist/domain/managed/managedApplicationGraphNodes.js +82 -57
- package/dist/domain/managed/managedArtifact.js +6 -4
- package/dist/domain/managed/managedMemberComparison.js +2 -9
- package/dist/domain/managed/managedMemberComparisonMatch.js +6 -7
- package/dist/domain/managed/managedNativeVerification.js +0 -2
- package/dist/domain/managed/managedNativeVerificationMatch.js +9 -3
- package/dist/domain/native/binaryLayout.js +2 -3
- package/dist/domain/native/nativeApiBoundary.js +1 -1
- package/dist/domain/native/nativeCallObservation.js +3 -3
- package/dist/domain/native/nativeInstruction.js +7 -0
- package/dist/domain/native/nativeValueFlow.js +5 -11
- package/dist/domain/native/objcSwiftMetadata.js +15 -17
- package/dist/domain/native/recordedCrash.js +2 -3
- package/dist/domain/offsetDateTime.js +17 -0
- package/dist/domain/process/processCapture.js +22 -20
- package/dist/domain/process/processCaptureCoverage.js +70 -0
- package/dist/domain/process/processCaptureExample.js +45 -1
- package/dist/domain/process/processCaptureParsing.js +1 -34
- package/dist/domain/process/processCaptureValidation.js +82 -13
- package/dist/domain/process/processComparison.js +39 -43
- package/dist/domain/process/processObservation.js +10 -2
- package/dist/domain/process/processScenario.js +24 -2
- package/dist/domain/process/processTraceComparison.js +0 -2
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +19 -15
- package/dist/domain/process/processTraceSpecification.js +4 -7
- package/dist/domain/providerAdapterError.js +2 -0
- package/dist/domain/providerCleanupError.js +6 -2
- package/dist/domain/reconstructionCoverage.js +7 -3
- package/dist/domain/reconstructionObligationLedgerSchemas.js +2 -1
- package/dist/domain/reconstructionReadinessSchemas.js +2 -1
- package/dist/domain/reconstructionUnknowns.js +4 -3
- package/dist/domain/reconstructionVerification.js +6 -5
- package/dist/domain/reconstructionVerificationSchemas.js +2 -1
- package/dist/domain/referenceSourceGraph.js +27 -28
- package/dist/domain/referenceSourceImportParsing.js +34 -45
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +4 -3
- package/dist/domain/stringPatterns.js +6 -0
- package/dist/domain/swiftSymbolClassification.js +66 -0
- package/dist/domain/symbolAnalysis.js +83 -20
- package/dist/domain/unicodeCodePointOrder.js +6 -0
- package/dist/domain/webBundleAnalyzerInspection.js +9 -1
- package/dist/domain/webCaptureDiff.js +71 -30
- package/dist/domain/webCaptureDiffSchemas.js +8 -11
- package/dist/domain/webEventListeners.js +3 -2
- package/dist/domain/webExecution.js +3 -2
- package/dist/domain/webInventory.js +3 -2
- package/dist/domain/webMcpDiscovery.js +4 -3
- package/dist/domain/webRuntime.js +0 -2
- package/dist/domain/webScriptExport.js +2 -2
- package/dist/dotnet/ManagedArtifactInspector.js +2 -19
- package/dist/dotnet/ManagedMemberInspector.js +12 -18
- package/dist/dotnet/ManagedMemberInspectorCore.js +47 -44
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +1 -2
- package/dist/dotnet/ManagedMemberRows.js +75 -62
- package/dist/dotnet/ManagedMetadataInventory.js +16 -22
- package/dist/dotnet/ManagedMethodBodyReader.js +4 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +109 -94
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +12 -21
- package/dist/dotnet/ManagedReaderFailure.js +16 -0
- package/dist/dotnet/ManagedStaticProvider.js +13 -12
- package/dist/dotnet/ManagedStaticProviderMetadata.js +1 -4
- package/dist/evaluation/AgentEvaluationFixtures.js +250 -0
- package/dist/evaluation/AgentEvaluationReport.js +28 -0
- package/dist/evaluation/CodexAgentEval.js +12 -8
- package/dist/evaluation/KnownAnswerEvaluation.js +281 -0
- package/dist/evm/EvmoleInterfaceProvider.js +2 -1
- package/dist/filesystem/RegularFile.js +41 -0
- package/dist/firmware/FirmwareCommand.js +9 -5
- package/dist/firmware/FirmwareProvider.js +4 -4
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +3 -6
- package/dist/ghidra/GhidraClient.js +105 -36
- package/dist/ghidra/GhidraClientStartup.js +0 -2
- package/dist/ghidra/GhidraDoctor.js +6 -5
- package/dist/ghidra/GhidraFunctionValues.js +3 -5
- package/dist/ghidra/GhidraInstallation.js +151 -22
- package/dist/ghidra/GhidraJavaLaunch.js +6 -2
- package/dist/ghidra/GhidraLauncher.js +58 -26
- package/dist/ghidra/GhidraProvider.js +6 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +6 -0
- package/dist/ghidra/GhidraProviderClient.js +13 -3
- package/dist/ghidra/GhidraSessionError.js +2 -0
- package/dist/ghidra/GhidraSessionRoot.js +39 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +17 -10
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +8 -2
- package/dist/hopper/BridgeLauncher.js +34 -45
- package/dist/hopper/HopperAnalysisProfile.js +3 -8
- package/dist/hopper/HopperCleanup.js +56 -27
- package/dist/hopper/HopperClient.js +86 -65
- package/dist/hopper/HopperMachOImage.js +3 -2
- package/dist/hopper/HopperProvider.js +16 -18
- package/dist/hopper/HopperRegexSearch.js +3 -6
- package/dist/hopper/HopperTargetLease.js +132 -49
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -0
- package/dist/ida/IdaConfiguration.js +8 -3
- package/dist/ida/IdaInput.js +1 -7
- package/dist/ida/IdaMcpConnection.js +8 -4
- package/dist/ida/IdaOperationRunner.js +5 -3
- package/dist/ida/IdaProvider.js +8 -12
- package/dist/ida/IdaSessionClient.js +24 -20
- package/dist/ida/IdaWorkspace.js +12 -13
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -5
- package/dist/inspector/V8InspectorCaptureProjection.js +47 -14
- package/dist/inspector/V8InspectorProvider.js +97 -35
- package/dist/javascript/recovery/WakaruCommand.js +7 -2
- package/dist/javascript/recovery/WakaruExecution.js +5 -2
- package/dist/main/shutdown.js +81 -29
- package/dist/main/startup.js +9 -2
- package/dist/main/transport.js +23 -3
- package/dist/main.js +11 -18
- package/dist/native/AppleMachoSelection.js +16 -6
- package/dist/native/AppleObjcDispatchFacets.js +3 -3
- package/dist/native/AppleObjcProperties.js +17 -7
- package/dist/native/CommandRunner.js +9 -7
- package/dist/native/LldbCallTracer.js +249 -77
- package/dist/native/NativeMacOSProvider.js +32 -17
- package/dist/native/NativeMacOSProviderMetadata.js +1 -2
- package/dist/native/NativeUiHelperRuntime.js +11 -2
- package/dist/native/NativeUiObservation.js +2 -2
- package/dist/native/pwntools/PwntoolsDecoder.js +2 -1
- package/dist/process/DarwinProcessRunTokenReader.js +16 -2
- package/dist/process/ExecFileOutput.js +88 -6
- package/dist/process/PrivateRuntimeRoot.js +10 -5
- package/dist/process/ProcessOwnership.js +1 -4
- package/dist/process/ProcessOwnershipObservation.js +18 -16
- package/dist/process/ProviderProcess.js +1 -3
- package/dist/process/capture/FilesystemSnapshot.js +131 -24
- package/dist/process/capture/ProcessCaptureError.js +13 -0
- package/dist/process/capture/ProcessCaptureLifecycle.js +148 -74
- package/dist/process/capture/ProcessFilesystemEffects.js +51 -6
- package/dist/process/capture/ProcessHarness.js +16 -33
- package/dist/process/capture/ProcessNormalization.js +20 -2
- package/dist/process/capture/ProcessSampling.js +25 -2
- package/dist/process/capture/TerminalRenderer.js +14 -0
- package/dist/process/snapshotEnvironment.js +14 -0
- package/dist/server/EvidenceMcpServer.js +25 -14
- package/dist/server/analysisAdmission.js +8 -0
- package/dist/server/createServer.js +71 -59
- package/dist/server/mcpClientMetadata.js +12 -5
- package/dist/server/promptCompletion.js +3 -8
- package/dist/server/registerAnalysisViewTool.js +15 -0
- package/dist/server/registerAndroidTools.js +2 -3
- package/dist/server/registerApplicationTools/compareExportShapes.js +6 -6
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +4 -5
- package/dist/server/registerApplicationTools/coverage.js +1 -2
- package/dist/server/registerApplicationTools/helpers.js +4 -4
- package/dist/server/registerApplicationTools/obligationLedger.js +4 -5
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -4
- package/dist/server/registerApplicationTools/traceFeature.js +4 -5
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +4 -5
- package/dist/server/registerArtifactTools.js +2 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +2 -3
- package/dist/server/registerBrowserScenarioTool.js +3 -4
- package/dist/server/registerBrowserTools.js +13 -16
- package/dist/server/registerBundleComparisonTool.js +5 -6
- package/dist/server/registerCloseLifecycleTool.js +8 -7
- package/dist/server/registerElectronTools.js +10 -13
- package/dist/server/registerEnhancedTools.js +82 -77
- package/dist/server/registerEvidenceTools.js +54 -47
- package/dist/server/registerEvmTools.js +2 -3
- package/dist/server/registerFirmwareTools.js +2 -3
- package/dist/server/registerFunctionComparisonTool.js +7 -8
- package/dist/server/registerInvestigationTools.js +14 -15
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -3
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +6 -6
- package/dist/server/registerManagedTools.js +7 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +5 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +4 -5
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +6 -7
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +6 -7
- package/dist/server/registerOfficialTools.js +32 -41
- package/dist/server/registerProcessComparisonTool.js +8 -8
- package/dist/server/registerRecordedCrashTools.js +2 -3
- package/dist/server/registerSessionRecordTools.js +15 -19
- package/dist/server/registerSessionStatusTool.js +3 -4
- package/dist/server/registerSessionTools.js +19 -19
- package/dist/server/registerWebModuleTool.js +2 -3
- package/dist/server/registerWebNetworkCaptureTool.js +2 -3
- package/dist/server/registerWebRuntimeTools.js +4 -5
- package/dist/server/registerWebScriptTool.js +2 -3
- package/dist/server/registerWebSourceLocationTool.js +2 -3
- package/dist/server/toolResult.js +66 -94
- package/dist/server/toolResultEncoding.js +11 -10
- package/dist/windows/WindowsNativeLoader.js +1 -0
- package/dist/windows/WindowsOwnedProcess.js +60 -15
- package/dist/windows/WindowsPrivateRuntime.js +7 -8
- package/native/windows/README.md +3 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +42 -30
- package/scripts/rea.mjs +3 -6
- package/skills/reverse-engineer-anything/SKILL.md +14 -13
- package/skills/reverse-engineer-anything/references/android-applications.md +6 -3
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +16 -6
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +18 -0
- package/dist/artifacts/inventory/policy.js +0 -2
- package/dist/config.js +0 -1
- package/dist/contracts/browserCaptureToolInputSchema.js +0 -43
- package/dist/contracts/process/processCaptureExample.js +0 -2
- package/dist/contracts/toolOutputSchemas.js +0 -2
- package/dist/domain/managed/managedApplicationGraphNodeCoverage.js +0 -6
- package/dist/main/reload.js +0 -12
- package/dist/main/state.js +0 -3
- package/dist/server/registerNativeTools.js +0 -6
- package/dist/server/sessionToolPolicies.js +0 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { compareUnicodeCodePoints, compositeKey, } from "../unicodeCodePointOrder.js";
|
|
2
3
|
/** Objective-C method type. */
|
|
3
4
|
export const objcMethodTypeSchema = z.enum([
|
|
4
5
|
"instance",
|
|
@@ -10,25 +11,22 @@ export const objcMethodTypeSchema = z.enum([
|
|
|
10
11
|
export const objcPropertyAttributeSchema = z.strictObject({
|
|
11
12
|
name: z.string().min(1),
|
|
12
13
|
value: z.string(),
|
|
13
|
-
is_weak: z.boolean().default(false),
|
|
14
|
-
is_atomic: z.boolean().default(false),
|
|
15
|
-
is_copy: z.boolean().default(false),
|
|
16
|
-
is_strong: z.boolean().default(false),
|
|
17
14
|
});
|
|
18
15
|
/** Objective-C method metadata. */
|
|
19
16
|
export const objcMethodSchema = z.strictObject({
|
|
20
17
|
selector: z.string().min(1),
|
|
21
18
|
method_type: objcMethodTypeSchema,
|
|
22
19
|
address: z.number().int().nullable(),
|
|
23
|
-
is_required: z.boolean().
|
|
24
|
-
is_optional: z.boolean().
|
|
20
|
+
is_required: z.boolean().nullable(),
|
|
21
|
+
is_optional: z.boolean().nullable(),
|
|
25
22
|
});
|
|
26
23
|
/** Objective-C property metadata. */
|
|
27
24
|
export const objcPropertySchema = z.strictObject({
|
|
28
25
|
name: z.string().min(1),
|
|
29
26
|
type_encoding: z.string().nullable(),
|
|
30
|
-
attributes: z.array(objcPropertyAttributeSchema)
|
|
31
|
-
|
|
27
|
+
attributes: z.array(objcPropertyAttributeSchema),
|
|
28
|
+
atomicity: z.enum(["atomic", "nonatomic"]).nullable(),
|
|
29
|
+
is_readonly: z.boolean().nullable(),
|
|
32
30
|
getter: z.string().nullable(),
|
|
33
31
|
setter: z.string().nullable(),
|
|
34
32
|
});
|
|
@@ -43,12 +41,12 @@ export const objcProtocolSchema = z.strictObject({
|
|
|
43
41
|
export const objcClassSchema = z.strictObject({
|
|
44
42
|
name: z.string().min(1),
|
|
45
43
|
super_class: z.string().nullable(),
|
|
46
|
-
is_meta_class: z.boolean().
|
|
47
|
-
is_root_class: z.boolean().
|
|
44
|
+
is_meta_class: z.boolean().nullable(),
|
|
45
|
+
is_root_class: z.boolean().nullable(),
|
|
48
46
|
methods: z.array(objcMethodSchema).default([]),
|
|
49
47
|
properties: z.array(objcPropertySchema).default([]),
|
|
50
48
|
protocols: z.array(z.string()).default([]),
|
|
51
|
-
ivar_count: z.number().int().nonnegative().
|
|
49
|
+
ivar_count: z.number().int().nonnegative().nullable(),
|
|
52
50
|
instance_size: z.number().int().nonnegative().nullable(),
|
|
53
51
|
location: z
|
|
54
52
|
.object({
|
|
@@ -333,23 +331,23 @@ export const inspectNativeDispatchMetadata = (names, maxRecords = 5_000) => {
|
|
|
333
331
|
selector: implementation.selector,
|
|
334
332
|
method_type: implementation.method_type,
|
|
335
333
|
address: parseMetadataAddress(implementation.implementation_address),
|
|
336
|
-
is_required:
|
|
337
|
-
is_optional:
|
|
334
|
+
is_required: null,
|
|
335
|
+
is_optional: null,
|
|
338
336
|
});
|
|
339
337
|
methodsByClass.set(implementation.class_name, methods);
|
|
340
338
|
}
|
|
341
339
|
const classes = [...classNames].sort().map((name) => ({
|
|
342
340
|
name,
|
|
343
341
|
super_class: null,
|
|
344
|
-
is_meta_class:
|
|
345
|
-
is_root_class:
|
|
342
|
+
is_meta_class: null,
|
|
343
|
+
is_root_class: null,
|
|
346
344
|
methods: methodsByClass.get(name) ?? [],
|
|
347
345
|
properties: [],
|
|
348
346
|
protocols: [],
|
|
349
|
-
ivar_count:
|
|
347
|
+
ivar_count: null,
|
|
350
348
|
instance_size: null,
|
|
351
349
|
}));
|
|
352
|
-
const decodedImplementations = [...implementations.values()].sort((left, right) =>
|
|
350
|
+
const decodedImplementations = [...implementations.values()].sort((left, right) => compareUnicodeCodePoints(compositeKey([left.class_name, left.selector]), compositeKey([right.class_name, right.selector])));
|
|
353
351
|
const swift = swiftSymbols.length > 0;
|
|
354
352
|
return objcSwiftMetadataSchema.parse({
|
|
355
353
|
objc_classes: classes,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { CANONICAL_BASE64_PATTERN } from "../stringPatterns.js";
|
|
2
3
|
import { recordedNoteCoverageIssues } from "./recordedCrashNoteCoverage.js";
|
|
3
4
|
const hex = z.string().regex(/^0x(?:0|[1-9a-f][0-9a-f]{0,15})$/);
|
|
4
5
|
const index = z.number().int().nonnegative();
|
|
5
6
|
const signed32 = z.number().int().min(-2147483648).max(2147483647);
|
|
6
|
-
const base64 = z
|
|
7
|
-
.string()
|
|
8
|
-
.regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/][AQgw]==|[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=)?$/);
|
|
7
|
+
const base64 = z.string().regex(CANONICAL_BASE64_PATTERN);
|
|
9
8
|
const range = z.strictObject({ offset: hex, bytes: hex });
|
|
10
9
|
const diagnostics = z.strictObject({
|
|
11
10
|
stdout: z.string(),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* ISO-8601 date-time that requires an explicit UTC offset.
|
|
4
|
+
*
|
|
5
|
+
* `z.string().datetime({ offset: true })` emits Zod's offset class as `[+-]`.
|
|
6
|
+
* Annex B and `u` mode accept that, but ECMA-262 `v` mode rejects the
|
|
7
|
+
* unescaped `-`, so any tool whose schema carries the pattern is unusable for a
|
|
8
|
+
* client that compiles advertised patterns — schema compilation happens before
|
|
9
|
+
* arguments are supplied, so the whole tools request fails rather than one call.
|
|
10
|
+
*
|
|
11
|
+
* The accepted set is identical to the Zod validator; only the offset class
|
|
12
|
+
* escapes `-`, as `\x2d`, because an escaped `-` inside a character class is
|
|
13
|
+
* removed by `oxlint --fix` as a useless escape.
|
|
14
|
+
*/
|
|
15
|
+
export const offsetDateTimeSchema = z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|(?:[+\x2d](?:[01]\d|2[0-3]):[0-5]\d)))$/u, "Use an ISO-8601 date-time with an explicit UTC offset");
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { jsonValueSchema } from "../jsonValue.js";
|
|
3
3
|
import { normalizationSchema } from "./processScenario.js";
|
|
4
4
|
import { collectProcessCaptureIssues } from "./processCaptureValidation.js";
|
|
5
|
-
|
|
5
|
+
import { filesystemCoverageSchema, processCaptureTruncationDetailsSchema, } from "./processCaptureCoverage.js";
|
|
6
6
|
/** Capture collection whose members participate in global observation order. */
|
|
7
7
|
export const PROCESS_CAPTURE_EVENT_COLLECTIONS = [
|
|
8
8
|
"frames",
|
|
@@ -40,6 +40,13 @@ const fileStateSchema = z.discriminatedUnion("type", [
|
|
|
40
40
|
symlink_target: z.null(),
|
|
41
41
|
}),
|
|
42
42
|
]);
|
|
43
|
+
/** Canonical checkpoint facts retained even when capture completion fails. */
|
|
44
|
+
export const processFilesystemSnapshotSchema = z.strictObject({
|
|
45
|
+
files: z.array(fileStateSchema),
|
|
46
|
+
truncated: z.boolean(),
|
|
47
|
+
completeRoots: z.array(z.string()),
|
|
48
|
+
coverage: filesystemCoverageSchema,
|
|
49
|
+
});
|
|
43
50
|
const fileEffectSchema = z.discriminatedUnion("status", [
|
|
44
51
|
z.object({
|
|
45
52
|
path: z.string(),
|
|
@@ -59,6 +66,13 @@ const fileEffectSchema = z.discriminatedUnion("status", [
|
|
|
59
66
|
before: fileStateSchema,
|
|
60
67
|
after: fileStateSchema,
|
|
61
68
|
}),
|
|
69
|
+
z.object({
|
|
70
|
+
path: z.string(),
|
|
71
|
+
status: z.literal("unknown"),
|
|
72
|
+
before: fileStateSchema.nullable(),
|
|
73
|
+
after: fileStateSchema.nullable(),
|
|
74
|
+
reason: z.string().min(1),
|
|
75
|
+
}),
|
|
62
76
|
]);
|
|
63
77
|
/** Exact serialized shape of a process capture. */
|
|
64
78
|
const processSettlementSchema = z.discriminatedUnion("state", [
|
|
@@ -95,10 +109,6 @@ const processCaptureShapeSchema = z.strictObject({
|
|
|
95
109
|
.string()
|
|
96
110
|
.regex(/^[a-f0-9]{64}$/u)
|
|
97
111
|
.nullable(),
|
|
98
|
-
legacy_executable_sha256: z
|
|
99
|
-
.string()
|
|
100
|
-
.regex(/^[a-f0-9]{64}$/u)
|
|
101
|
-
.optional(),
|
|
102
112
|
executable_identity: z.strictObject({
|
|
103
113
|
state: z.enum(["path_metadata_unchanged", "unknown"]),
|
|
104
114
|
reason: z.string().nullable(),
|
|
@@ -110,6 +120,7 @@ const processCaptureShapeSchema = z.strictObject({
|
|
|
110
120
|
sequence: z.number().int().nonnegative(),
|
|
111
121
|
at_ms: z.number().int().nonnegative(),
|
|
112
122
|
data: z.string(),
|
|
123
|
+
raw_data: z.string().optional(),
|
|
113
124
|
})),
|
|
114
125
|
rendered_frames: z.array(z.object({
|
|
115
126
|
sequence: z.number().int().nonnegative(),
|
|
@@ -162,17 +173,16 @@ const processCaptureShapeSchema = z.strictObject({
|
|
|
162
173
|
effects: z.array(fileEffectSchema),
|
|
163
174
|
truncated: z.boolean(),
|
|
164
175
|
})),
|
|
165
|
-
event_journal: z
|
|
166
|
-
.array(z.object({
|
|
176
|
+
event_journal: z.array(z.object({
|
|
167
177
|
capture_order: z.number().int().nonnegative(),
|
|
168
178
|
collection: z.enum(PROCESS_CAPTURE_EVENT_COLLECTIONS),
|
|
169
179
|
index: z.number().int().nonnegative(),
|
|
170
|
-
}))
|
|
171
|
-
.default([]),
|
|
180
|
+
})),
|
|
172
181
|
files_before: z.array(fileStateSchema),
|
|
173
182
|
files_after: z.array(fileStateSchema),
|
|
174
183
|
filesystem_effects: z.array(fileEffectSchema),
|
|
175
184
|
truncated: z.boolean(),
|
|
185
|
+
truncation_details: processCaptureTruncationDetailsSchema,
|
|
176
186
|
limitations: z.array(z.string()),
|
|
177
187
|
residual_unknowns: z.array(z.object({
|
|
178
188
|
scope: z.enum([
|
|
@@ -218,14 +228,8 @@ const incompleteProcessCaptureObservationsSchema = z.strictObject({
|
|
|
218
228
|
})),
|
|
219
229
|
process_samples: partialObservationFieldSchema(processCaptureShapeSchema.shape.process_samples),
|
|
220
230
|
filesystem_snapshots: z.strictObject({
|
|
221
|
-
before: partialObservationFieldSchema(
|
|
222
|
-
|
|
223
|
-
truncated: z.boolean(),
|
|
224
|
-
})),
|
|
225
|
-
after: partialObservationFieldSchema(z.strictObject({
|
|
226
|
-
files: z.array(fileStateSchema),
|
|
227
|
-
truncated: z.boolean(),
|
|
228
|
-
})),
|
|
231
|
+
before: partialObservationFieldSchema(processFilesystemSnapshotSchema),
|
|
232
|
+
after: partialObservationFieldSchema(processFilesystemSnapshotSchema),
|
|
229
233
|
}),
|
|
230
234
|
event_journal: partialObservationFieldSchema(processCaptureShapeSchema.shape.event_journal),
|
|
231
235
|
manifest: partialObservationFieldSchema(processCaptureShapeSchema.shape.manifest),
|
|
@@ -315,6 +319,4 @@ export const processCaptureSchema = processCaptureShapeSchema
|
|
|
315
319
|
message: issue.message,
|
|
316
320
|
});
|
|
317
321
|
})
|
|
318
|
-
.describe("The capture must preserve its canonical scenario, comparison, and normalization SHA-256 commitments; ordered capture timestamps and contiguous sequence numbers; before and final filesystem snapshots with truncation propagated; and exit-code consistency with deadline termination.
|
|
319
|
-
export { parseProcessCapture } from "./processCaptureParsing.js";
|
|
320
|
-
export { compareProcessCaptures, comparisonStatusSchema, deriveProcessComparisonStatus, PROCESS_COMPARISON_DIMENSIONS, processCaptureComparisonSchema, } from "./processComparison.js";
|
|
322
|
+
.describe("The capture must preserve its canonical scenario, comparison, and normalization SHA-256 commitments; ordered capture timestamps and contiguous sequence numbers; before and final filesystem snapshots with truncation propagated; and exit-code consistency with deadline termination. The event journal is required; empty journals are valid. A non-empty journal must reference every captured observation exactly once with unique in-range references. These cross-field invariants are checked by REA after capture.");
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const byteRetentionSchema = z.strictObject({
|
|
3
|
+
budget_bytes: z.number().int().nonnegative(),
|
|
4
|
+
observed_bytes: z.number().int().nonnegative(),
|
|
5
|
+
retained_bytes: z.number().int().nonnegative(),
|
|
6
|
+
observed_frames: z.number().int().nonnegative(),
|
|
7
|
+
retained_frames: z.number().int().nonnegative(),
|
|
8
|
+
});
|
|
9
|
+
/** Filesystem enumeration and whole-file digest coverage for one checkpoint. */
|
|
10
|
+
export const filesystemCoverageSchema = z.strictObject({
|
|
11
|
+
files_limit: z.number().int().nonnegative(),
|
|
12
|
+
depth_limit: z.number().int().nonnegative(),
|
|
13
|
+
enumeration_truncated: z.boolean(),
|
|
14
|
+
enumeration_reasons: z.array(z.enum(["files_limit", "depth_limit", "identity_changed"])),
|
|
15
|
+
hash_budget_bytes: z.number().int().nonnegative(),
|
|
16
|
+
hashed_bytes: z.number().int().nonnegative(),
|
|
17
|
+
hash_omissions: z.array(z.strictObject({
|
|
18
|
+
path: z.string(),
|
|
19
|
+
size_bytes: z.number().int().nonnegative(),
|
|
20
|
+
remaining_budget_bytes: z.number().int().nonnegative(),
|
|
21
|
+
reason: z.enum([
|
|
22
|
+
"file_bytes_budget",
|
|
23
|
+
"file_changed_or_short_read",
|
|
24
|
+
"file_unavailable",
|
|
25
|
+
]),
|
|
26
|
+
system_code: z.string().nullable(),
|
|
27
|
+
})),
|
|
28
|
+
});
|
|
29
|
+
/** Actual budget accounting; rendered bytes count state and visible lines, not JSON. */
|
|
30
|
+
export const processCaptureTruncationDetailsSchema = z.strictObject({
|
|
31
|
+
raw_terminal: byteRetentionSchema.describe("UTF-8 bytes of original PTY chunks; whole chunks are retained or omitted."),
|
|
32
|
+
rendered_terminal: byteRetentionSchema.describe("Cumulative UTF-8 bytes of serialized state plus visible lines, evaluated from retained PTY input; whole frames are retained or omitted."),
|
|
33
|
+
filesystem_before: filesystemCoverageSchema,
|
|
34
|
+
filesystem_after: filesystemCoverageSchema,
|
|
35
|
+
process: z.strictObject({
|
|
36
|
+
sample_limit: z.number().int().nonnegative(),
|
|
37
|
+
sampling_partial: z.boolean(),
|
|
38
|
+
retained_samples: z.number().int().nonnegative(),
|
|
39
|
+
sample_limit_reached: z.boolean(),
|
|
40
|
+
sampling_failures: z.number().int().nonnegative(),
|
|
41
|
+
first_sampling_failure: z.string().nullable(),
|
|
42
|
+
coverage: z.literal("sampled"),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
const omitted = (retention) => retention.observed_frames > retention.retained_frames;
|
|
46
|
+
const filesystemTruncated = (coverage) => coverage.enumeration_truncated || coverage.hash_omissions.length > 0;
|
|
47
|
+
/** Derive the aggregate truncation flag from independent producer observations. */
|
|
48
|
+
export const hasCaptureTruncation = (details) => omitted(details.raw_terminal) ||
|
|
49
|
+
omitted(details.rendered_terminal) ||
|
|
50
|
+
filesystemTruncated(details.filesystem_before) ||
|
|
51
|
+
filesystemTruncated(details.filesystem_after) ||
|
|
52
|
+
details.process.sampling_partial;
|
|
53
|
+
/** Whether producer accounting reports a gap in the selected observation source. */
|
|
54
|
+
export const processSourceTruncated = (capture, source) => {
|
|
55
|
+
const details = capture.truncation_details;
|
|
56
|
+
switch (source) {
|
|
57
|
+
case "terminal_raw":
|
|
58
|
+
return omitted(details.raw_terminal);
|
|
59
|
+
case "terminal_rendered":
|
|
60
|
+
return (omitted(details.raw_terminal) || omitted(details.rendered_terminal));
|
|
61
|
+
case "filesystem":
|
|
62
|
+
return (filesystemTruncated(details.filesystem_before) ||
|
|
63
|
+
filesystemTruncated(details.filesystem_after));
|
|
64
|
+
case "process":
|
|
65
|
+
return details.process.sampling_partial;
|
|
66
|
+
case "interaction":
|
|
67
|
+
case "lifecycle":
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { digestProcessCommitment } from "./
|
|
1
|
+
import { digestProcessCommitment } from "./processScenario.js";
|
|
2
2
|
const normalization = {
|
|
3
3
|
paths: true,
|
|
4
4
|
pids: true,
|
|
@@ -51,10 +51,54 @@ export const EMPTY_PROCESS_CAPTURE_EXAMPLE = {
|
|
|
51
51
|
truncated: false,
|
|
52
52
|
},
|
|
53
53
|
],
|
|
54
|
+
event_journal: [],
|
|
54
55
|
files_before: [],
|
|
55
56
|
files_after: [],
|
|
56
57
|
filesystem_effects: [],
|
|
57
58
|
truncated: false,
|
|
59
|
+
truncation_details: {
|
|
60
|
+
raw_terminal: {
|
|
61
|
+
budget_bytes: 1_000_000,
|
|
62
|
+
observed_bytes: 0,
|
|
63
|
+
retained_bytes: 0,
|
|
64
|
+
observed_frames: 0,
|
|
65
|
+
retained_frames: 0,
|
|
66
|
+
},
|
|
67
|
+
rendered_terminal: {
|
|
68
|
+
budget_bytes: 1_000_000,
|
|
69
|
+
observed_bytes: 0,
|
|
70
|
+
retained_bytes: 0,
|
|
71
|
+
observed_frames: 0,
|
|
72
|
+
retained_frames: 0,
|
|
73
|
+
},
|
|
74
|
+
filesystem_before: {
|
|
75
|
+
files_limit: 10_000,
|
|
76
|
+
depth_limit: 16,
|
|
77
|
+
enumeration_truncated: false,
|
|
78
|
+
enumeration_reasons: [],
|
|
79
|
+
hash_budget_bytes: 10_000_000,
|
|
80
|
+
hashed_bytes: 0,
|
|
81
|
+
hash_omissions: [],
|
|
82
|
+
},
|
|
83
|
+
filesystem_after: {
|
|
84
|
+
files_limit: 10_000,
|
|
85
|
+
depth_limit: 16,
|
|
86
|
+
enumeration_truncated: false,
|
|
87
|
+
enumeration_reasons: [],
|
|
88
|
+
hash_budget_bytes: 10_000_000,
|
|
89
|
+
hashed_bytes: 0,
|
|
90
|
+
hash_omissions: [],
|
|
91
|
+
},
|
|
92
|
+
process: {
|
|
93
|
+
sample_limit: 1_000,
|
|
94
|
+
sampling_partial: false,
|
|
95
|
+
retained_samples: 0,
|
|
96
|
+
sample_limit_reached: false,
|
|
97
|
+
sampling_failures: 0,
|
|
98
|
+
first_sampling_failure: null,
|
|
99
|
+
coverage: "sampled",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
58
102
|
limitations: [],
|
|
59
103
|
residual_unknowns: [],
|
|
60
104
|
cleanup: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { processCaptureSchema, } from "./processCapture.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
2
|
const verifiedCaptures = new WeakSet();
|
|
4
3
|
const isVerifiedCapture = (capture) => verifiedCaptures.has(capture);
|
|
5
4
|
const attachProof = (capture) => {
|
|
@@ -8,41 +7,9 @@ const attachProof = (capture) => {
|
|
|
8
7
|
return capture;
|
|
9
8
|
throw new TypeError("Process Capture proof ownership failed");
|
|
10
9
|
};
|
|
11
|
-
const recordSchema = z.record(z.string(), z.unknown());
|
|
12
|
-
const LEGACY_EXECUTABLE_IDENTITY_REASON = "Legacy v3 capture did not distinguish selected and launch executable digests";
|
|
13
|
-
const migrateLegacyV3Capture = (input) => {
|
|
14
|
-
const capture = recordSchema.safeParse(input);
|
|
15
|
-
if (!capture.success)
|
|
16
|
-
return input;
|
|
17
|
-
const manifest = recordSchema.safeParse(capture.data.manifest);
|
|
18
|
-
if (!manifest.success)
|
|
19
|
-
return input;
|
|
20
|
-
if (manifest.data.provider_version !== "3" ||
|
|
21
|
-
"selected_executable_sha256" in manifest.data ||
|
|
22
|
-
"executable_identity" in manifest.data ||
|
|
23
|
-
"legacy_executable_sha256" in manifest.data)
|
|
24
|
-
return input;
|
|
25
|
-
const { executable_sha256 } = manifest.data;
|
|
26
|
-
if (typeof executable_sha256 !== "string" ||
|
|
27
|
-
!/^[a-f0-9]{64}$/u.test(executable_sha256))
|
|
28
|
-
return input;
|
|
29
|
-
return {
|
|
30
|
-
...capture.data,
|
|
31
|
-
manifest: {
|
|
32
|
-
...manifest.data,
|
|
33
|
-
selected_executable_sha256: null,
|
|
34
|
-
executable_sha256: null,
|
|
35
|
-
executable_identity: {
|
|
36
|
-
state: "unknown",
|
|
37
|
-
reason: LEGACY_EXECUTABLE_IDENTITY_REASON,
|
|
38
|
-
},
|
|
39
|
-
legacy_executable_sha256: executable_sha256,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
10
|
/** Parse unknown input and reject invalid commitments or semantics. */
|
|
44
11
|
export const parseProcessCapture = (input) => {
|
|
45
|
-
const parsed = processCaptureSchema.safeParse(
|
|
12
|
+
const parsed = processCaptureSchema.safeParse(input);
|
|
46
13
|
if (parsed.success)
|
|
47
14
|
return attachProof(parsed.data);
|
|
48
15
|
const issues = parsed.error.issues.flatMap((issue) => issue.code === "custom"
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { digestProcessCommitment } from "./processScenario.js";
|
|
2
|
+
import { hasCaptureTruncation } from "./processCaptureCoverage.js";
|
|
2
3
|
const orderedTimestamps = (values) => values.every((value, index) => {
|
|
3
4
|
const previous = values[index - 1];
|
|
4
5
|
return previous === undefined || value.at_ms >= previous.at_ms;
|
|
5
6
|
});
|
|
6
7
|
const validateCommitments = (capture, require) => {
|
|
7
8
|
const { manifest } = capture;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
manifest.executable_sha256 === null &&
|
|
11
|
-
manifest.executable_identity.state === "unknown" &&
|
|
12
|
-
manifest.executable_identity.reason !== null &&
|
|
13
|
-
manifest.scenario.executable_sha256 ===
|
|
14
|
-
manifest.legacy_executable_sha256, "manifest.legacy_executable_sha256", "legacy executable digest must remain distinct from unknown selected and launch digests");
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
require(manifest.scenario.executable_sha256 ===
|
|
18
|
-
manifest.selected_executable_sha256, "manifest.selected_executable_sha256", "selected executable commitment does not match the scenario projection");
|
|
19
|
-
}
|
|
9
|
+
require(manifest.scenario.executable_sha256 ===
|
|
10
|
+
manifest.selected_executable_sha256, "manifest.selected_executable_sha256", "selected executable commitment does not match the scenario projection");
|
|
20
11
|
require(manifest.executable_identity.state === "path_metadata_unchanged"
|
|
21
12
|
? manifest.executable_sha256 === manifest.selected_executable_sha256 &&
|
|
22
13
|
manifest.executable_identity.reason === null
|
|
@@ -48,7 +39,7 @@ const validateOrdering = (capture, require) => {
|
|
|
48
39
|
require(orderedTimestamps(values), name, "timestamps must be ordered");
|
|
49
40
|
};
|
|
50
41
|
const validateEventJournal = (capture, require) => {
|
|
51
|
-
const journal = capture.event_journal
|
|
42
|
+
const journal = capture.event_journal;
|
|
52
43
|
if (journal.length === 0)
|
|
53
44
|
return;
|
|
54
45
|
const sizes = {
|
|
@@ -83,6 +74,83 @@ const validateLifecycle = (capture, require) => {
|
|
|
83
74
|
capture.exit.code ===
|
|
84
75
|
null, "exit", "deadline termination cannot declare a normal exit code");
|
|
85
76
|
};
|
|
77
|
+
const validateCoverage = (capture, require) => {
|
|
78
|
+
const details = capture.truncation_details;
|
|
79
|
+
require(details.process.retained_samples === capture.process_samples.length &&
|
|
80
|
+
details.process.retained_samples <= details.process.sample_limit &&
|
|
81
|
+
details.process.sampling_partial ===
|
|
82
|
+
(details.process.sample_limit_reached ||
|
|
83
|
+
details.process.sampling_failures > 0) &&
|
|
84
|
+
(details.process.sampling_failures === 0) ===
|
|
85
|
+
(details.process.first_sampling_failure ===
|
|
86
|
+
null), "truncation_details.process", "sampling coverage must agree with retained samples and observed failures");
|
|
87
|
+
require(capture.truncated ===
|
|
88
|
+
hasCaptureTruncation(details), "truncation_details", "aggregate truncation must match producer coverage");
|
|
89
|
+
for (const [name, retention, count, bytes] of [
|
|
90
|
+
[
|
|
91
|
+
"raw_terminal",
|
|
92
|
+
details.raw_terminal,
|
|
93
|
+
capture.frames.length,
|
|
94
|
+
capture.frames.reduce((total, frame) => total + Buffer.byteLength(frame.raw_data ?? frame.data), 0),
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
"rendered_terminal",
|
|
98
|
+
details.rendered_terminal,
|
|
99
|
+
capture.rendered_frames.length,
|
|
100
|
+
capture.rendered_frames.reduce((total, frame) => frame.lines.reduce((sum, line) => sum + Buffer.byteLength(line), total + Buffer.byteLength(frame.serialized_state)), 0),
|
|
101
|
+
],
|
|
102
|
+
]) {
|
|
103
|
+
// Whole frames are retained or omitted, so retained bytes are exactly the
|
|
104
|
+
// retained frames' bytes, and nothing is unretained when no frame was omitted.
|
|
105
|
+
require(retention.retained_frames === count &&
|
|
106
|
+
retention.observed_frames >= count &&
|
|
107
|
+
retention.retained_bytes === bytes &&
|
|
108
|
+
retention.observed_bytes >= retention.retained_bytes &&
|
|
109
|
+
(retention.observed_frames > count ||
|
|
110
|
+
retention.observed_bytes === retention.retained_bytes) &&
|
|
111
|
+
retention.retained_bytes <=
|
|
112
|
+
retention.budget_bytes, `truncation_details.${name}`, "retained observations and budget accounting do not agree");
|
|
113
|
+
}
|
|
114
|
+
for (const [name, coverage, files, checkpoint] of [
|
|
115
|
+
[
|
|
116
|
+
"filesystem_before",
|
|
117
|
+
details.filesystem_before,
|
|
118
|
+
capture.files_before,
|
|
119
|
+
capture.filesystem_checkpoints[0],
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
"filesystem_after",
|
|
123
|
+
details.filesystem_after,
|
|
124
|
+
capture.files_after,
|
|
125
|
+
capture.filesystem_checkpoints[1],
|
|
126
|
+
],
|
|
127
|
+
]) {
|
|
128
|
+
const unhashedFiles = new Map(files
|
|
129
|
+
.filter((file) => file.type === "file" && file.sha256 === null)
|
|
130
|
+
.map((file) => [file.path, file]));
|
|
131
|
+
require(coverage.hash_omissions.length === unhashedFiles.size &&
|
|
132
|
+
new Set(coverage.hash_omissions.map(({ path }) => path)).size ===
|
|
133
|
+
unhashedFiles.size &&
|
|
134
|
+
coverage.hash_omissions.every((omission) => unhashedFiles.get(omission.path)?.size === omission.size_bytes &&
|
|
135
|
+
omission.remaining_budget_bytes <= coverage.hash_budget_bytes &&
|
|
136
|
+
(omission.reason === "file_unavailable"
|
|
137
|
+
? omission.system_code !== null
|
|
138
|
+
: omission.system_code === null)), `truncation_details.${name}.hash_omissions`, "every retained regular file without a digest must have one matching omission reason");
|
|
139
|
+
require(coverage.hashed_bytes ===
|
|
140
|
+
files
|
|
141
|
+
.filter((file) => file.type === "file" && file.sha256 !== null)
|
|
142
|
+
.reduce((sum, file) => sum + file.size, 0) &&
|
|
143
|
+
coverage.hashed_bytes <= coverage.hash_budget_bytes &&
|
|
144
|
+
files.length <=
|
|
145
|
+
coverage.files_limit, `truncation_details.${name}`, "filesystem budget accounting does not match retained observations");
|
|
146
|
+
require(coverage.enumeration_truncated ===
|
|
147
|
+
coverage.enumeration_reasons.length > 0 &&
|
|
148
|
+
checkpoint?.truncated ===
|
|
149
|
+
(coverage.enumeration_truncated ||
|
|
150
|
+
coverage.hash_omissions.length >
|
|
151
|
+
0), `truncation_details.${name}`, "filesystem checkpoint truncation must match enumeration and digest coverage");
|
|
152
|
+
}
|
|
153
|
+
};
|
|
86
154
|
/** Recompute commitments and cross-field invariants without side effects. */
|
|
87
155
|
export const collectProcessCaptureIssues = (capture) => {
|
|
88
156
|
const issues = [];
|
|
@@ -94,5 +162,6 @@ export const collectProcessCaptureIssues = (capture) => {
|
|
|
94
162
|
validateOrdering(capture, require);
|
|
95
163
|
validateEventJournal(capture, require);
|
|
96
164
|
validateLifecycle(capture, require);
|
|
165
|
+
validateCoverage(capture, require);
|
|
97
166
|
return issues;
|
|
98
167
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import canonicalize from "canonicalize";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { processSourceTruncated } from "./processCaptureCoverage.js";
|
|
4
|
+
import { comparableTerminalFrame } from "./processObservation.js";
|
|
3
5
|
import { AnalysisInputError } from "../analysisErrorCore.js";
|
|
4
6
|
import { jsonValueSchema } from "../jsonValue.js";
|
|
5
|
-
import {
|
|
7
|
+
import {} from "./processTraceSpecification.js";
|
|
8
|
+
import { processTraceComparisonResultSchema } from "./processTraceEvaluation.js";
|
|
6
9
|
import { dimensionsForTraceSources, traceCoversObservedDimension, } from "./processTraceDimensionProjection.js";
|
|
10
|
+
import { compareProcessTraces, processTraceOutcomesDiffer, } from "./processTraceComparison.js";
|
|
7
11
|
const OPERATION = "compare_process_captures";
|
|
8
12
|
/** Comparison classification that never equates incomplete evidence. */
|
|
9
13
|
export const comparisonStatusSchema = z.enum([
|
|
@@ -72,7 +76,10 @@ export const processCaptureComparisonSchema = z
|
|
|
72
76
|
});
|
|
73
77
|
});
|
|
74
78
|
const terminalObservations = (capture) => [
|
|
75
|
-
...capture.frames.map((frame) => ({
|
|
79
|
+
...capture.frames.map((frame) => ({
|
|
80
|
+
kind: "raw",
|
|
81
|
+
...comparableTerminalFrame(frame),
|
|
82
|
+
})),
|
|
76
83
|
...capture.rendered_frames.map((frame) => ({
|
|
77
84
|
kind: "rendered",
|
|
78
85
|
...frame,
|
|
@@ -195,19 +202,6 @@ const differingContractFields = (left, right) => [...new Set([...Object.keys(lef
|
|
|
195
202
|
!Object.hasOwn(right, field) ||
|
|
196
203
|
canonicalize(left[field]) !== canonicalize(right[field]))
|
|
197
204
|
.sort();
|
|
198
|
-
const truncatedComparison = () => ({
|
|
199
|
-
status: "truncated",
|
|
200
|
-
terminal: "truncated",
|
|
201
|
-
interaction: "truncated",
|
|
202
|
-
exit: "truncated",
|
|
203
|
-
filesystem: "truncated",
|
|
204
|
-
process: "truncated",
|
|
205
|
-
first_divergence: {
|
|
206
|
-
status: "unknown",
|
|
207
|
-
reason: "At least one capture is truncated.",
|
|
208
|
-
},
|
|
209
|
-
limitations: ["At least one capture is truncated."],
|
|
210
|
-
});
|
|
211
205
|
const applyTraceVerdict = (dimensions, specification, trace, captures) => {
|
|
212
206
|
const traceShowsDifference = processTraceOutcomesDiffer(trace);
|
|
213
207
|
const traceStatus = trace.verdict === "unknown"
|
|
@@ -241,19 +235,23 @@ const applyTraceVerdict = (dimensions, specification, trace, captures) => {
|
|
|
241
235
|
};
|
|
242
236
|
};
|
|
243
237
|
const compareDimensions = (left, right, sameNormalization) => {
|
|
244
|
-
const classify = (scope, leftValues, rightValues) => !sameNormalization ||
|
|
238
|
+
const classify = (scope, leftValues, rightValues, source) => !sameNormalization ||
|
|
239
|
+
hasUnknown(left, scope) ||
|
|
240
|
+
hasUnknown(right, scope) ||
|
|
241
|
+
processSourceTruncated(left, source) ||
|
|
242
|
+
processSourceTruncated(right, source)
|
|
245
243
|
? "unknown"
|
|
246
244
|
: classifyCollection(leftValues, rightValues);
|
|
247
245
|
return {
|
|
248
|
-
terminal: classify("terminal", terminalObservations(left), terminalObservations(right)),
|
|
249
|
-
interaction: classify("interaction", left.interaction_events, right.interaction_events),
|
|
246
|
+
terminal: classify("terminal", terminalObservations(left), terminalObservations(right), "terminal_rendered"),
|
|
247
|
+
interaction: classify("interaction", left.interaction_events, right.interaction_events, "interaction"),
|
|
250
248
|
exit: hasUnknown(left, "exit") || hasUnknown(right, "exit")
|
|
251
249
|
? "unknown"
|
|
252
250
|
: sameJsonValue({ exit: left.exit, settlement: left.settlement }, { exit: right.exit, settlement: right.settlement })
|
|
253
251
|
? "unchanged"
|
|
254
252
|
: "changed",
|
|
255
|
-
filesystem: classify("filesystem", filesystemObservations(left), filesystemObservations(right)),
|
|
256
|
-
process: classify("process", left.process_samples, right.process_samples),
|
|
253
|
+
filesystem: classify("filesystem", filesystemObservations(left), filesystemObservations(right), "filesystem"),
|
|
254
|
+
process: classify("process", left.process_samples, right.process_samples, "process"),
|
|
257
255
|
};
|
|
258
256
|
};
|
|
259
257
|
/**
|
|
@@ -264,15 +262,6 @@ const compareDimensions = (left, right, sameNormalization) => {
|
|
|
264
262
|
*/
|
|
265
263
|
export const compareProcessCaptures = (left, right, options = {}) => {
|
|
266
264
|
assertComparable(left, right, options);
|
|
267
|
-
if (left.truncated || right.truncated) {
|
|
268
|
-
const truncated = truncatedComparison();
|
|
269
|
-
return options.traceSpecification === undefined
|
|
270
|
-
? truncated
|
|
271
|
-
: {
|
|
272
|
-
...truncated,
|
|
273
|
-
trace: compareProcessTraces(left, right, options.traceSpecification),
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
265
|
const sameNormalization = sameJsonValue(left.normalization, right.normalization);
|
|
277
266
|
const exactDimensions = compareDimensions(left, right, sameNormalization);
|
|
278
267
|
const trace = options.traceSpecification === undefined
|
|
@@ -284,25 +273,32 @@ export const compareProcessCaptures = (left, right, options = {}) => {
|
|
|
284
273
|
left,
|
|
285
274
|
right,
|
|
286
275
|
]);
|
|
287
|
-
const divergenceCandidates = PROCESS_COMPARISON_DIMENSIONS.map((dimension) =>
|
|
276
|
+
const divergenceCandidates = PROCESS_COMPARISON_DIMENSIONS.map((dimension) => dimensions[dimension] === "unknown"
|
|
277
|
+
? null
|
|
278
|
+
: firstCollectionDivergence(dimension, processDimensionObservations(left, dimension), processDimensionObservations(right, dimension)));
|
|
288
279
|
const observedFirstDivergence = chooseFirstDivergence(divergenceCandidates.map((candidate) => candidate !== null &&
|
|
289
280
|
trace?.verdict === "equivalent" &&
|
|
290
281
|
dimensions[candidate.dimension] === "unchanged"
|
|
291
282
|
? null
|
|
292
283
|
: candidate));
|
|
293
|
-
const firstDivergence =
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
284
|
+
const firstDivergence = left.truncated || right.truncated
|
|
285
|
+
? {
|
|
286
|
+
status: "unknown",
|
|
287
|
+
reason: "Incomplete observations prevent locating the first divergence; unaffected dimensions retain their comparisons.",
|
|
288
|
+
}
|
|
289
|
+
: trace?.verdict === "equivalent" &&
|
|
290
|
+
deriveProcessComparisonStatus(PROCESS_COMPARISON_DIMENSIONS.map((dimension) => dimensions[dimension])) === "unchanged"
|
|
291
|
+
? { status: "none" }
|
|
292
|
+
: observedFirstDivergence.status === "found"
|
|
293
|
+
? observedFirstDivergence
|
|
294
|
+
: !sameNormalization ||
|
|
295
|
+
left.residual_unknowns.length > 0 ||
|
|
296
|
+
right.residual_unknowns.length > 0
|
|
297
|
+
? {
|
|
298
|
+
status: "unknown",
|
|
299
|
+
reason: "Residual unknowns prevent proving that no divergence occurred.",
|
|
300
|
+
}
|
|
301
|
+
: observedFirstDivergence;
|
|
306
302
|
const observedStatus = deriveProcessComparisonStatus(PROCESS_COMPARISON_DIMENSIONS.map((dimension) => dimensions[dimension]));
|
|
307
303
|
return {
|
|
308
304
|
status: observedStatus,
|