rea-agents 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -95
- package/bridge/ghidra/ReaGhidraBridge.java +609 -841
- package/bridge/hopper_bridge.py +99 -344
- package/dist/application/AbortablePromise.js +6 -3
- package/dist/application/AnalysisSnapshotCache.js +0 -1
- package/dist/application/AnalysisSnapshotFiles.js +7 -7
- package/dist/application/AndroidApplicationService.js +1 -1
- package/dist/application/AppleApplicationService.js +1 -1
- package/dist/application/ArtifactExtraction.js +35 -54
- package/dist/application/ArtifactExtractionDestination.js +17 -0
- package/dist/application/ArtifactGraphConstruction.js +2 -17
- package/dist/application/ArtifactInventory/classify.js +2 -6
- package/dist/application/ArtifactInventory/hash.js +2 -20
- package/dist/application/ArtifactInventory/scanCanonical.js +8 -12
- package/dist/application/ArtifactInventory/scanReader.js +69 -51
- package/dist/application/ArtifactInventory.js +6 -14
- package/dist/application/AuthorizedArtifactInventory.js +3 -13
- package/dist/application/BinarySession.js +41 -13
- package/dist/application/BinarySessionComposition.js +0 -11
- package/dist/application/BinarySessionOpen.js +2 -1
- package/dist/application/BinarySessionRecords.js +5 -93
- package/dist/application/BinarySessionStatus.js +5 -16
- package/dist/application/BinaryTargetResolver.js +216 -0
- package/dist/application/BrowserEvidence.js +42 -58
- package/dist/application/BrowserObservationService.js +3 -6
- package/dist/application/BrowserScenarioCaptureService.js +3 -6
- package/dist/application/BrowserScenarioEvidence.js +3 -3
- package/dist/application/CallPathTracing.js +2 -36
- package/dist/application/CapabilityInventory.js +10 -15
- package/dist/application/ClientConfigurationDocument.js +27 -0
- package/dist/application/ClientRegistrationStatus.js +16 -13
- package/dist/application/CommandShimReplay.js +14 -1
- package/dist/application/DirectAnalysis.js +22 -46
- package/dist/application/DirectAnalysisStatus.js +5 -61
- package/dist/application/Doctor.js +11 -32
- package/dist/application/DoctorDiagnostics.js +1 -2
- package/dist/application/DoctorScope.js +1 -1
- package/dist/application/ElectronActiveEvidence.js +3 -8
- package/dist/application/ElectronActiveObservationService.js +3 -6
- package/dist/application/ElectronBoundaryAnalysis.js +7 -8
- package/dist/application/ElectronBoundaryGraphContext.js +1 -1
- package/dist/application/ElectronBoundaryGraphIpc.js +3 -3
- package/dist/application/ElectronBoundaryGraphNative.js +1 -2
- package/dist/application/ElectronBoundaryGraphWindows.js +6 -8
- package/dist/application/ElectronEvidence.js +4 -7
- package/dist/application/ElectronObservationService.js +5 -9
- package/dist/application/EnhancedLiteralTracing.js +42 -65
- package/dist/application/EnhancedTools.js +76 -44
- package/dist/application/EvidenceBundleCommands.js +11 -11
- package/dist/application/EvidenceBundleFiles.js +9 -15
- package/dist/application/EvidenceLedger.js +6 -41
- package/dist/application/FilesystemSnapshot.js +2 -3
- package/dist/application/InterfaceBuilderAnalysis.js +266 -0
- package/dist/application/InventoryProjectionEvidence.js +4 -2
- package/dist/application/InvestigationProviders.js +1 -1
- package/dist/application/JavaScriptApplicationEvidence.js +2 -5
- package/dist/application/JavaScriptApplicationEvidenceGraph.js +6 -10
- package/dist/application/JavaScriptApplicationService.js +6 -29
- package/dist/application/JavaScriptApplicationWorkflowEvidence.js +5 -5
- package/dist/application/JavaScriptApplicationWorkflowService.js +0 -8
- package/dist/application/JavaScriptArtifactAnalysis.js +38 -127
- package/dist/application/JavaScriptArtifactFiles.js +67 -107
- package/dist/application/JavaScriptArtifactGraphAccumulator.js +0 -7
- package/dist/application/JavaScriptArtifactGraphBuilder.js +7 -58
- package/dist/application/JavaScriptArtifactGraphBundlers.js +1 -6
- package/dist/application/JavaScriptArtifactGraphContext.js +12 -39
- package/dist/application/JavaScriptArtifactGraphDocuments.js +4 -11
- package/dist/application/JavaScriptArtifactGraphEvidence.js +0 -14
- package/dist/application/JavaScriptArtifactGraphFindings.js +3 -3
- package/dist/application/JavaScriptArtifactGraphStructure.js +16 -17
- package/dist/application/JavaScriptArtifactPathResolution.js +61 -49
- package/dist/application/JavaScriptArtifactReconstruction.js +5 -10
- package/dist/application/JavaScriptArtifactReconstructionInput.js +2 -14
- package/dist/application/JavaScriptJsonModules.js +2 -2
- package/dist/application/JavaScriptModuleRelationships.js +22 -27
- package/dist/application/JavaScriptReplayPlanning.js +9 -3
- package/dist/application/JavaScriptReplayService.js +6 -32
- package/dist/application/JavaScriptReturnShapeProjection.js +12 -42
- package/dist/application/JavaScriptRuntimeObservationEvidence.js +7 -8
- package/dist/application/JavaScriptRuntimeObservationService.js +4 -8
- package/dist/application/JavaScriptRuntimeReconciliationEvidence.js +2 -3
- package/dist/application/JavaScriptSemanticGraphBuilder.js +11 -41
- package/dist/application/JavaScriptSemanticGraphConstruction.js +5 -29
- package/dist/application/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/JavaScriptSemanticGraphFingerprintProjection.js +1 -1
- package/dist/application/JavaScriptSemanticGraphFlowProjection.js +0 -13
- package/dist/application/JavaScriptSemanticGraphProjection.js +1 -3
- package/dist/application/JavaScriptSemanticTraceService.js +1 -10
- package/dist/application/JsonFiles.js +79 -0
- package/dist/application/LinuxHopper.js +11 -9
- package/dist/application/LoopbackReplay.js +26 -23
- package/dist/application/LoopbackReplayRecorder.js +29 -1
- package/dist/application/ManagedApplicationGraphService.js +1 -2
- package/dist/application/ManagedMemberComparisonService.js +11 -41
- package/dist/application/ManagedNativeVerificationService.js +1 -2
- package/dist/application/ManagedReconstructionService.js +1 -1
- package/dist/application/ManagedRuntimeCorrelationService.js +5 -8
- package/dist/application/NativeApiInspection.js +2 -7
- package/dist/application/NativeUiActionTrace.js +394 -0
- package/dist/application/NodeRuntimeCharacterizationService.js +3 -7
- package/dist/application/PermissionAuthority.js +15 -7
- package/dist/application/PermissionFailure.js +5 -0
- package/dist/application/ProcessCaptureAuthority.js +5 -7
- package/dist/application/ProcessCaptureJournal.js +3 -2
- package/dist/application/ProcessCaptureLifecycle.js +5 -12
- package/dist/application/ProcessCheckpoints.js +29 -11
- package/dist/application/ProcessCli.js +6 -16
- package/dist/application/ProcessEvidence.js +5 -7
- package/dist/application/ProcessHarness.js +52 -17
- package/dist/application/ProcessReactiveCoordinator.js +2 -4
- package/dist/application/ProcessReactiveEffects.js +9 -3
- package/dist/application/ProcessReactiveHarness.js +13 -7
- package/dist/application/ProcessSampling.js +2 -4
- package/dist/application/ProcessTimer.js +39 -0
- package/dist/application/ProjectPermissionStore.js +39 -96
- package/dist/application/RealHopperAssertions.js +20 -66
- package/dist/application/ReconstructionCoverageService.js +12 -58
- package/dist/application/ReconstructionObligationAuthority.js +2 -2
- package/dist/application/ReconstructionObligationCandidates.js +4 -4
- package/dist/application/ReconstructionObligationLedgerEvaluation.js +8 -15
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -7
- package/dist/application/ReconstructionObligationLedgerService.js +19 -38
- package/dist/application/ReferenceSourceImport.js +19 -45
- package/dist/application/ReferenceSourceImportEntries.js +2 -4
- package/dist/application/ReferenceSourceImportPolicy.js +5 -32
- package/dist/application/ReferenceSourceImportTypes.js +0 -16
- package/dist/application/RuntimeExecutableDiagnostics.js +55 -29
- package/dist/application/SessionProviderRouter.js +2 -2
- package/dist/application/Setup.js +1 -3
- package/dist/application/SetupClientConfiguration.js +22 -93
- package/dist/application/SetupRegistrationEnvironment.js +0 -7
- package/dist/application/StoreFileLock.js +119 -0
- package/dist/application/TerminalRenderer.js +2 -3
- package/dist/application/Uninstall.js +9 -14
- package/dist/application/UnknownEvidence.js +1 -1
- package/dist/artifacts/ArtifactPaths.js +2 -5
- package/dist/artifacts/ArtifactProvider.js +36 -58
- package/dist/artifacts/DirectoryArtifactReader.js +13 -8
- package/dist/artifacts/MachOSliceArtifactReader.js +1 -5
- package/dist/artifacts/NativeDmgArtifactReader.js +11 -11
- package/dist/artifacts/NibArchive.js +269 -0
- package/dist/artifacts/SafeOutputTree.js +15 -24
- package/dist/browser/BrowserProcessStartup.js +1 -2
- package/dist/browser/CdpAuthorizedMainFrame.js +16 -0
- package/dist/browser/CdpBrowserProvider.js +3 -13
- package/dist/browser/CdpCanonicalJsonDigest.js +9 -0
- package/dist/browser/CdpCaptureDocuments.js +28 -76
- package/dist/browser/CdpCaptureEventBodyShapes.js +13 -33
- package/dist/browser/CdpCaptureEventHandlers.js +22 -87
- package/dist/browser/CdpCaptureEvents.js +2 -8
- package/dist/browser/CdpCaptureStorage.js +9 -20
- package/dist/browser/CdpCaptureStorageFingerprints.js +85 -98
- package/dist/browser/CdpCaptureValues.js +21 -21
- package/dist/browser/CdpConnection.js +10 -25
- package/dist/browser/CdpElectronInspection.js +26 -50
- package/dist/browser/CdpElectronProvider.js +10 -35
- package/dist/browser/CdpElectronScriptEvents.js +8 -16
- package/dist/browser/CdpElectronScripts.js +6 -35
- package/dist/browser/CdpElectronWorkers.js +6 -10
- package/dist/browser/CdpEndpoint.js +25 -41
- package/dist/browser/CdpObservationSession.js +14 -26
- package/dist/browser/CdpPageCapture.js +34 -48
- package/dist/browser/CdpPageCaptureScripts.js +1 -19
- package/dist/browser/CdpPageCaptureWorkers.js +6 -10
- package/dist/browser/CdpSafeMetadata.js +19 -22
- package/dist/browser/CdpScreenshot.js +3 -5
- package/dist/browser/CdpTargetSession.js +1 -2
- package/dist/browser/CdpWebMcpDiscovery.js +13 -22
- package/dist/browser/ElectronFileScope.js +8 -19
- package/dist/browser/JavaScriptRuntimeScope.js +9 -14
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +31 -64
- package/dist/browser/PlaywrightElectronActiveActions.js +54 -69
- package/dist/browser/PlaywrightElectronActiveProvider.js +14 -34
- package/dist/browser/PlaywrightExecutionBoundary.js +16 -5
- package/dist/browser/PlaywrightScenarioActions.js +3 -7
- package/dist/browser/PlaywrightScenarioArtifacts.js +23 -92
- package/dist/browser/PlaywrightScenarioBrowser.js +3 -5
- package/dist/browser/PlaywrightScenarioEvents.js +45 -94
- package/dist/browser/PlaywrightScenarioSession.js +14 -30
- package/dist/browser/PngVisualDiff.js +22 -14
- package/dist/browser/SensitiveTextCapture.js +0 -17
- package/dist/browser/V8InspectorCaptureProjection.js +7 -8
- package/dist/browser/V8InspectorEndpoint.js +12 -14
- package/dist/browser/V8InspectorProvider.js +20 -61
- package/dist/browser/WebSourceMapFetcher.js +56 -176
- package/dist/catalogIdentity.js +0 -54
- package/dist/cli/artifactCommands.js +49 -77
- package/dist/cli/coreAnalysisCommands.js +83 -133
- package/dist/cli/javascriptApplicationAnalysis.js +1 -9
- package/dist/cli/managedCommands.js +5 -270
- package/dist/cli/setupCommands.js +3 -12
- package/dist/cli/utilityCommands.js +7 -41
- package/dist/cli.js +0 -2
- package/dist/cliApplicationCommands.js +42 -112
- package/dist/cliBrowserAdvancedCommands.js +10 -106
- package/dist/cliBrowserCommands.js +15 -127
- package/dist/cliBrowserContext.js +30 -0
- package/dist/cliCommandNames.js +4 -5
- package/dist/cliElectronCommands.js +8 -72
- package/dist/cliEvidenceCommands.js +8 -77
- package/dist/cliJavaScriptRuntimeCommands.js +9 -91
- package/dist/cliJsonInput.js +4 -14
- package/dist/cliObservationOptions.js +11 -96
- package/dist/cliPolicyCommands.js +2 -17
- package/dist/cliProcessCommands.js +3 -3
- package/dist/cliSetup.js +0 -13
- package/dist/config/browserScenario.js +2 -2
- package/dist/config/environment.js +0 -9
- package/dist/config/parseConfig.js +1 -33
- package/dist/config/parsers.js +6 -27
- package/dist/config/passiveObservation.js +7 -77
- package/dist/config/permissions.js +0 -7
- package/dist/contracts/analysisSearchContract.js +2 -5
- package/dist/contracts/applicationToolContracts.js +56 -109
- package/dist/contracts/applicationWorkflowInputContracts.js +27 -102
- package/dist/contracts/artifactComparisonExample.js +58 -60
- package/dist/contracts/artifactToolContracts.js +20 -67
- package/dist/contracts/browserScenarioToolContracts.js +6 -51
- package/dist/contracts/browserToolContracts.js +8 -73
- package/dist/contracts/electronToolContracts.js +8 -108
- package/dist/contracts/enhancedInputs.js +23 -54
- package/dist/contracts/errorSchemas.js +0 -1
- package/dist/contracts/functionComparisonExample.js +10 -24
- package/dist/contracts/functionInstructionContract.js +1 -3
- package/dist/contracts/functionWorkflowToolContracts.js +2 -2
- package/dist/contracts/hopperMemoryContracts.js +3 -3
- package/dist/contracts/investigationExamples.js +14 -11
- package/dist/contracts/javascriptApplicationWorkflowExamples.js +12 -19
- package/dist/contracts/javascriptRuntimeObservationToolContracts.js +2 -20
- package/dist/contracts/javascriptRuntimeReconciliationExample.js +45 -12
- package/dist/contracts/managedToolContracts.js +6 -95
- package/dist/contracts/managedWorkflowExamples.js +77 -128
- package/dist/contracts/managedWorkflowToolContracts.js +51 -77
- package/dist/contracts/nativeToolContracts.js +7 -11
- package/dist/contracts/processCaptureExample.js +2 -69
- package/dist/contracts/promptContracts.js +49 -67
- package/dist/contracts/providerSelection.js +0 -1
- package/dist/contracts/reconstructionReadinessExample.js +1 -6
- package/dist/contracts/sessionStatusContract.js +1 -17
- package/dist/contracts/sessionToolSchemas.js +6 -15
- package/dist/contracts/toolContractExamples.js +11 -11
- package/dist/contracts/toolContractHelpers.js +0 -4
- package/dist/contracts/toolContracts.js +60 -71
- package/dist/contracts/toolEffects.js +5 -13
- package/dist/contracts/toolOutputSchemaGroups.js +37 -91
- package/dist/contracts/toolOutputSchemaPrimitives.js +16 -56
- package/dist/contracts/toolSchemaMetadata.js +8 -19
- package/dist/contracts/unknownContractExamples.js +0 -2
- package/dist/domain/analysisErrorPresentation.js +46 -54
- package/dist/domain/analysisErrorProjection.js +28 -37
- package/dist/domain/analysisProfile.js +3 -31
- package/dist/domain/analysisSnapshot.js +3 -12
- package/dist/domain/androidApplication.js +15 -54
- package/dist/domain/appleApplication.js +24 -67
- package/dist/domain/artifactComparison.js +11 -29
- package/dist/domain/artifactGraph.js +14 -44
- package/dist/domain/artifactInspection.js +38 -69
- package/dist/domain/artifactInventoryEvidence.js +27 -21
- package/dist/domain/binaryTarget.js +2 -221
- package/dist/domain/browserCaptureComparison.js +47 -24
- package/dist/domain/browserObservation.js +28 -193
- package/dist/domain/browserObservationSchemas.js +5 -23
- package/dist/domain/browserScenario.js +11 -14
- package/dist/domain/browserScenarioCapture.js +11 -12
- package/dist/domain/browserScenarioCaptureValues.js +146 -84
- package/dist/domain/browserScenarioDiff.js +2 -59
- package/dist/domain/browserScenarioDiffEvidence.js +51 -0
- package/dist/domain/browserScenarioDiffValues.js +21 -38
- package/dist/domain/browserScenarioValues.js +80 -109
- package/dist/domain/browserSession.js +4 -7
- package/dist/domain/bundleComparison.js +6 -32
- package/dist/domain/bytecodeProvider.js +20 -19
- package/dist/domain/callPath.js +47 -167
- package/dist/domain/callPathSchemas.js +79 -0
- package/dist/domain/changedBehavior.js +34 -60
- package/dist/domain/completionLedgerGeneration.js +8 -14
- package/dist/domain/conformancePackage.js +126 -97
- package/dist/domain/conformanceReplay.js +36 -8
- package/dist/domain/conformanceTrustGate.js +23 -14
- package/dist/domain/customProtocolCapture.js +1 -1
- package/dist/domain/electronActiveObservation.js +70 -103
- package/dist/domain/electronObservation.js +14 -80
- package/dist/domain/electronStaticAnalysisBrowser.js +36 -46
- package/dist/domain/electronStaticAnalysisIpc.js +38 -14
- package/dist/domain/electronStaticAnalysisNative.js +1 -8
- package/dist/domain/electronStaticAnalysisValues.js +10 -17
- package/dist/domain/errors.js +33 -54
- package/dist/domain/eventProcessTree.js +20 -12
- package/dist/domain/evidence.js +2 -10
- package/dist/domain/evidenceBundle.js +3 -5
- package/dist/domain/evidenceCompletionLedger.js +6 -8
- package/dist/domain/functionComparison.js +4 -14
- package/dist/domain/functionComparisonNormalization.js +4 -11
- package/dist/domain/functionComparisonResults.js +25 -15
- package/dist/domain/functionComparisonSchemas.js +49 -33
- package/dist/domain/functionDossierEvidence.js +31 -156
- package/dist/domain/hopperStartupFailure.js +1 -1
- package/dist/domain/hopperValues.js +15 -136
- package/dist/domain/interfaceBuilderGraph.js +654 -0
- package/dist/domain/javascriptApplicationAnalysis.js +8 -112
- package/dist/domain/javascriptApplicationChangeGraph.js +22 -82
- package/dist/domain/javascriptApplicationEvidenceSchemas.js +59 -47
- package/dist/domain/javascriptApplicationGraph.js +3 -13
- package/dist/domain/javascriptApplicationGraphSchemas.js +12 -34
- package/dist/domain/javascriptApplicationVersionComparison.js +26 -30
- package/dist/domain/javascriptApplicationVersionComparisonSchemas.js +123 -68
- package/dist/domain/javascriptApplicationVersionItems.js +120 -53
- package/dist/domain/javascriptApplicationVersionKeys.js +24 -11
- package/dist/domain/javascriptAstFingerprint.js +25 -58
- package/dist/domain/javascriptAstValues.js +9 -0
- package/dist/domain/javascriptExportInstrumentation.js +2 -4
- package/dist/domain/javascriptExportShapeComparison.js +6 -7
- package/dist/domain/javascriptExportShapeComparisonSchemas.js +68 -75
- package/dist/domain/javascriptExportShapeSelection.js +17 -19
- package/dist/domain/javascriptFeatureSeed.js +20 -12
- package/dist/domain/javascriptFeatureTrace.js +13 -67
- package/dist/domain/javascriptFeatureTraceSchemas.js +24 -52
- package/dist/domain/javascriptFeatureTraversal.js +1 -44
- package/dist/domain/javascriptNativeHandoff.js +1 -1
- package/dist/domain/javascriptReplay.js +24 -41
- package/dist/domain/javascriptRuntimeLoadState.js +3 -8
- package/dist/domain/javascriptRuntimeObservation.js +42 -103
- package/dist/domain/javascriptRuntimeReconciliation.js +1 -3
- package/dist/domain/javascriptRuntimeReconciliationActive.js +8 -17
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +10 -23
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +18 -12
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +16 -45
- package/dist/domain/javascriptRuntimeReconciliationResult.js +4 -5
- package/dist/domain/javascriptRuntimeReconciliationRuntime.js +8 -12
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +33 -48
- package/dist/domain/javascriptRuntimeStaticCandidates.js +3 -3
- package/dist/domain/javascriptSemanticAnalysis.js +12 -45
- package/dist/domain/javascriptSemanticAsyncEffects.js +1 -9
- package/dist/domain/javascriptSemanticCallResolution.js +6 -16
- package/dist/domain/javascriptSemanticCalls.js +5 -32
- package/dist/domain/javascriptSemanticChildProcesses.js +1 -11
- package/dist/domain/javascriptSemanticCoverage.js +11 -0
- package/dist/domain/javascriptSemanticDataEffectHelpers.js +1 -8
- package/dist/domain/javascriptSemanticDataEffects.js +1 -11
- package/dist/domain/javascriptSemanticFingerprints.js +3 -5
- package/dist/domain/javascriptSemanticGraphSchemas.js +25 -51
- package/dist/domain/javascriptSemanticGraphSerialization.js +2 -13
- package/dist/domain/javascriptSemanticIr.js +1 -29
- package/dist/domain/javascriptSemanticObjects.js +1 -5
- package/dist/domain/javascriptSemanticPrimitives.js +2 -9
- package/dist/domain/javascriptSemanticProjection.js +0 -18
- package/dist/domain/javascriptSemanticPromises.js +9 -16
- package/dist/domain/javascriptSemanticProvenance.js +16 -19
- package/dist/domain/javascriptSemanticQuery.js +17 -139
- package/dist/domain/javascriptSemanticQueryAssessment.js +9 -37
- package/dist/domain/javascriptSemanticQueryIdentity.js +2 -23
- package/dist/domain/javascriptSemanticQuerySchemas.js +14 -107
- package/dist/domain/javascriptSemanticResources.js +1 -6
- package/dist/domain/javascriptSemanticReturns.js +10 -27
- package/dist/domain/javascriptSemanticValueTypes.js +1 -0
- package/dist/domain/javascriptSemanticValues.js +44 -62
- package/dist/domain/javascriptStaticAnalysis.js +21 -43
- package/dist/domain/javascriptStaticAnalysisBundler.js +34 -93
- package/dist/domain/javascriptStaticAnalysisCalls.js +17 -16
- package/dist/domain/javascriptStaticAnalysisFindings.js +3 -19
- package/dist/domain/javascriptStaticAnalysisHelpers.js +47 -88
- package/dist/domain/javascriptStaticAnalysisState.js +1 -5
- package/dist/domain/javascriptStaticAnalysisTypes.js +1 -0
- package/dist/domain/jsonShape.js +7 -33
- package/dist/domain/localPath.js +7 -0
- package/dist/domain/managedApplicationGraph.js +9 -41
- package/dist/domain/managedApplicationGraphCoverage.js +24 -156
- package/dist/domain/managedApplicationGraphNodes.js +10 -13
- package/dist/domain/managedArtifact.js +14 -27
- package/dist/domain/managedMemberComparison.js +90 -92
- package/dist/domain/managedMemberComparisonCoverage.js +11 -33
- package/dist/domain/managedMemberComparisonItems.js +221 -0
- package/dist/domain/managedMemberComparisonMatch.js +8 -208
- package/dist/domain/managedNativeVerification.js +3 -6
- package/dist/domain/managedNativeVerificationMatch.js +55 -59
- package/dist/domain/managedNativeVerificationSchemas.js +83 -47
- package/dist/domain/managedReconstruction.js +19 -23
- package/dist/domain/managedRuntimeCorrelation.js +6 -9
- package/dist/domain/nativeApiBoundary.js +2 -7
- package/dist/domain/nativeInspection.js +0 -2
- package/dist/domain/nativeInvestigationGraph.js +351 -0
- package/dist/domain/nativeValueFlow.js +61 -0
- package/dist/domain/nodeRuntimeCharacterization.js +1 -5
- package/dist/domain/objcSwiftMetadata.js +254 -0
- package/dist/domain/peInspection.js +1 -1
- package/dist/domain/permissionPolicy.js +13 -0
- package/dist/domain/processCapture.js +76 -113
- package/dist/domain/processCaptureExample.js +68 -0
- package/dist/domain/processCaptureParsing.js +21 -0
- package/dist/domain/processCaptureReactiveSchema.js +68 -0
- package/dist/domain/processCaptureValidation.js +1 -7
- package/dist/domain/processComparison.js +3 -12
- package/dist/domain/processReactiveMatching.js +29 -50
- package/dist/domain/processReactiveRuntime.js +4 -8
- package/dist/domain/processReactiveScenario.js +28 -94
- package/dist/domain/processReactiveScenarioPreflight.js +5 -30
- package/dist/domain/processReactiveTransition.js +33 -18
- package/dist/domain/processScenario.js +56 -90
- package/dist/domain/processTraceComparison.js +0 -8
- package/dist/domain/processTraceEvaluation.js +14 -4
- package/dist/domain/processTraceSpecification.js +11 -17
- package/dist/domain/protocolCapture.js +3 -3
- package/dist/domain/reconstructionCoverage.js +62 -129
- package/dist/domain/reconstructionCoverageEvaluation.js +17 -17
- package/dist/domain/reconstructionObligationLedgerSchemas.js +45 -72
- package/dist/domain/reconstructionReadiness.js +1 -2
- package/dist/domain/reconstructionReadinessSchemas.js +36 -38
- package/dist/domain/reconstructionUnknowns.js +3 -3
- package/dist/domain/reconstructionVerification.js +13 -47
- package/dist/domain/reconstructionVerificationSchemas.js +50 -38
- package/dist/domain/referenceSourceGraph.js +53 -61
- package/dist/domain/referenceSourceImportParsing.js +1 -5
- package/dist/domain/replayMachine.js +19 -31
- package/dist/domain/replayMachineRun.js +15 -63
- package/dist/domain/replayMachineRuntime.js +41 -41
- package/dist/domain/replayMachineValues.js +84 -0
- package/dist/domain/residualUnknown.js +25 -30
- package/dist/domain/runtimeCharacterization.js +15 -16
- package/dist/domain/runtimeIdentification.js +48 -47
- package/dist/domain/sourceToBundleComparison.js +9 -85
- package/dist/domain/sourceToBundleComparisonSchemas.js +17 -42
- package/dist/domain/sourceToBundleSignals.js +4 -15
- package/dist/domain/staticRuntimeCorrelation.js +37 -49
- package/dist/domain/symbolAnalysis.js +10 -19
- package/dist/domain/unicodeCodePointOrder.js +12 -0
- package/dist/domain/webBundleAnalysis.js +70 -99
- package/dist/domain/webBundleAnalyzer.js +2 -4
- package/dist/domain/webBundleAnalyzerAst.js +0 -13
- package/dist/domain/webBundleAnalyzerInspection.js +26 -52
- package/dist/domain/webBundleAnalyzerResult.js +7 -24
- package/dist/domain/webCaptureDiff.js +33 -73
- package/dist/domain/webCaptureDiffSchemas.js +86 -0
- package/dist/domain/webContentArtifact.js +1 -10
- package/dist/domain/webMcpDiscovery.js +3 -14
- package/dist/domain/webScreenshot.js +58 -34
- package/dist/domain/zipPackageFormat.js +7 -0
- package/dist/dotnet/ManagedArtifactInspector.js +17 -50
- package/dist/dotnet/ManagedMemberInspector.js +27 -58
- package/dist/dotnet/ManagedMemberInspectorCore.js +14 -51
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +2 -2
- package/dist/dotnet/ManagedMemberRows.js +16 -16
- package/dist/dotnet/ManagedMetadataHeaps.js +26 -8
- package/dist/dotnet/ManagedMetadataInventory.js +21 -30
- package/dist/dotnet/ManagedMetadataInventoryRows.js +57 -63
- package/dist/dotnet/ManagedMetadataLayout.js +3 -5
- package/dist/dotnet/ManagedMethodBodyReader.js +5 -30
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +19 -49
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +13 -41
- package/dist/dotnet/ManagedPeReader.js +2 -2
- package/dist/dotnet/ManagedStaticProvider.js +13 -71
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +1 -1
- package/dist/ghidra/GhidraAnalysisProfile.js +3 -8
- package/dist/ghidra/GhidraClient.js +4 -12
- package/dist/ghidra/GhidraClientWire.js +9 -5
- package/dist/ghidra/GhidraDefaults.js +0 -18
- package/dist/ghidra/GhidraDiagnostics.js +0 -2
- package/dist/ghidra/GhidraDoctor.js +16 -12
- package/dist/ghidra/GhidraFunctionValues.js +65 -108
- package/dist/ghidra/GhidraInstallation.js +98 -42
- package/dist/ghidra/GhidraInventoryValues.js +16 -85
- package/dist/ghidra/GhidraLauncher.js +0 -8
- package/dist/ghidra/GhidraProvider.js +15 -22
- package/dist/ghidra/GhidraProviderCapabilities.js +6 -47
- package/dist/ghidra/GhidraRequestQueue.js +6 -30
- package/dist/ghidra/GhidraResponseBuffer.js +1 -7
- package/dist/ghidra/GhidraSessionValues.js +0 -2
- package/dist/ghidra/GhidraTransport.js +4 -7
- package/dist/ghidra/protocol.js +2 -2
- package/dist/hopper/BridgeLauncher.js +112 -36
- package/dist/hopper/HopperAnalysisProfile.js +1 -1
- package/dist/hopper/HopperCleanup.js +6 -3
- package/dist/hopper/HopperClient.js +4 -7
- package/dist/hopper/HopperProcessDiagnostic.js +2 -2
- package/dist/hopper/HopperProvider.js +0 -16
- package/dist/hopper/HopperRequestQueue.js +21 -40
- package/dist/hopper/HopperResponseStream.js +1 -9
- package/dist/hopper/HopperSessionValues.js +3 -2
- package/dist/hopper/HopperTargetLease.js +119 -0
- package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +24 -31
- package/dist/hopper/LinuxPrivateDisplayProbe.js +5 -16
- package/dist/hopper/protocol.js +6 -4
- package/dist/main/reload.js +0 -3
- package/dist/main/shutdown.js +1 -1
- package/dist/main/state.js +0 -9
- package/dist/main/transport.js +0 -5
- package/dist/mcpDoctor.js +25 -45
- package/dist/native/CommandRunner.js +18 -25
- package/dist/native/NativeMacOSProvider.js +13 -38
- package/dist/native/NativeMachoInspection.js +1 -1
- package/dist/process/BoundedFileBytes.js +17 -0
- package/dist/process/ExecFileOutput.js +11 -0
- package/dist/process/PendingOperations.js +8 -6
- package/dist/process/ProcessOwnership.js +3 -2
- package/dist/process/ProcessOwnershipObservation.js +0 -1
- package/dist/process/ProviderProcess.js +7 -28
- package/dist/reference/ReferenceSourceReader.js +8 -24
- package/dist/reference/ReferenceSourceReaderEntries.js +11 -39
- package/dist/reference/ReferenceSourceReaderFile.js +13 -31
- package/dist/reference/ReferenceSourceReaderPaths.js +3 -18
- package/dist/reference/ReferenceSourceReaderValidate.js +3 -6
- package/dist/replay/JavaScriptReplayWorker.js +3 -5
- package/dist/replay/LinuxJavaScriptReplayRunner.js +33 -29
- package/dist/replay/LinuxJavaScriptReplaySandbox.js +0 -19
- package/dist/replay/LinuxRuntimeClosure.js +1 -3
- package/dist/replay/ReplayOutcome.js +1 -3
- package/dist/replay/ReplayProcessLifecycle.js +32 -7
- package/dist/replay/ReplaySeccompFile.js +29 -0
- package/dist/replay/ReplayWorkerProtocol.js +0 -2
- package/dist/replay/SystemJavaScriptReplayHost.js +45 -74
- package/dist/server/ProcessCaptureElicitation.js +4 -8
- package/dist/server/createServer.js +6 -44
- package/dist/server/promptCompletion.js +37 -61
- package/dist/server/recordDerivedEvidence.js +1 -1
- package/dist/server/registerApplicationTools/characterization.js +4 -8
- package/dist/server/registerApplicationTools/compareExportShapes.js +5 -10
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +6 -10
- package/dist/server/registerApplicationTools/compareVersions.js +5 -10
- package/dist/server/registerApplicationTools/controlledReplay.js +3 -5
- package/dist/server/registerApplicationTools/coverage.js +6 -71
- package/dist/server/registerApplicationTools/helpers.js +1 -13
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +5 -9
- package/dist/server/registerApplicationTools/traceSemantics.js +5 -8
- package/dist/server/registerApplicationTools.js +0 -2
- package/dist/server/registerArtifactComparisonTool.js +23 -27
- package/dist/server/registerBrowserScenarioTool.js +4 -4
- package/dist/server/registerBrowserTools.js +5 -8
- package/dist/server/registerBundleComparisonTool.js +5 -7
- package/dist/server/registerCloseLifecycleTool.js +2 -16
- package/dist/server/registerElectronTools.js +10 -29
- package/dist/server/registerEnhancedTools.js +10 -11
- package/dist/server/registerEvidenceTools.js +15 -22
- package/dist/server/registerFunctionComparisonTool.js +30 -25
- package/dist/server/registerInvestigationTools/helpers.js +3 -32
- package/dist/server/registerInvestigationTools.js +20 -116
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +6 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +15 -17
- package/dist/server/registerManagedWorkflowTools/evidence.js +19 -35
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -8
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +3 -8
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +10 -14
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +9 -15
- package/dist/server/registerOfficialTools.js +1 -43
- package/dist/server/registerProcessComparisonTool.js +33 -23
- package/dist/server/registerPrompts.js +19 -17
- package/dist/server/registerSessionRecordTools.js +10 -156
- package/dist/server/registerSessionStatusTool.js +6 -69
- package/dist/server/registerSessionTools.js +10 -51
- package/dist/server/sessionAvailabilityPolicy.js +0 -2
- package/dist/server/sessionEvidence.js +9 -15
- package/dist/server/sessionToolPolicies.js +0 -8
- package/dist/server/toolResult.js +14 -50
- package/dist/serverIdentity.js +0 -20
- package/install.sh +1 -1
- package/package.json +11 -7
- package/scripts/electron-active-hook.cjs +23 -55
- package/scripts/hopper-demo-x11.py +13 -32
- package/skills/reverse-engineer-anything/SKILL.md +47 -12
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +6 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +13 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +12 -8
- package/dist/application/ApplicationWorkflowEvidenceResolver.js +0 -188
- package/dist/application/BoundedJsonFiles.js +0 -86
- package/dist/application/CrossVersionInventory.js +0 -129
- package/dist/application/CrossVersionInvestigation.js +0 -301
- package/dist/application/CrossVersionInvestigationCollections.js +0 -23
- package/dist/application/CrossVersionInvestigationEvidence.js +0 -64
- package/dist/application/CrossVersionInvestigationReplay.js +0 -170
- package/dist/application/DeferredFileAuthorization.js +0 -61
- package/dist/application/DoctorProjection.js +0 -43
- package/dist/application/EnhancedToolPagination.js +0 -22
- package/dist/application/EvidenceReferenceResolver.js +0 -26
- package/dist/application/InvestigationWorkspaceStore.js +0 -204
- package/dist/application/ProcessPairedExperiment.js +0 -72
- package/dist/application/ReconstructionCoverageWorkspaceStore.js +0 -31
- package/dist/application/ReconstructionReadinessService.js +0 -48
- package/dist/cliInvestigationCommands.js +0 -173
- package/dist/domain/boundedCartesianProjection.js +0 -15
- package/dist/domain/investigationWorkspace.js +0 -347
- package/dist/domain/jsonLimits.js +0 -26
- package/dist/domain/knownPageCoverage.js +0 -29
- package/dist/domain/processPairedExperiment.js +0 -128
- package/dist/server/javascriptApplicationResult.js +0 -106
- package/dist/server/permissionFailure.js +0 -12
- package/dist/server/registerApplicationTools/readiness.js +0 -50
- package/dist/server/registerEvidenceResources.js +0 -315
- package/dist/server/registerJavaScriptApplicationGraphResource.js +0 -65
- package/dist/server/registerReconstructionObligationLedgerResource.js +0 -32
- package/dist/server/registerReconstructionReadinessResource.js +0 -32
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import {} from "../domain/evidence.js";
|
|
2
|
-
import { createEvidenceBundle, } from "../domain/evidenceBundle.js";
|
|
3
|
-
import { AnalysisCancelledError, AnalysisInputError, EvidenceIntegrityError, InvestigationWorkspaceError, } from "../domain/errors.js";
|
|
4
|
-
import { createLegacyInvestigationRunIdentity, createInvestigationRunIdentity, createInvestigationWorkspace, crossVersionInvestigationInputSchema, investigationRunSchema, reviseInvestigationWorkspace, } from "../domain/investigationWorkspace.js";
|
|
5
|
-
import { err, ok } from "../domain/result.js";
|
|
6
|
-
import { createInventoryEvidencePages, runLimitations, scanVersions, targetFor, } from "./CrossVersionInventory.js";
|
|
7
|
-
import { readInvestigationWorkspace, writeInvestigationWorkspace, } from "./InvestigationWorkspaceStore.js";
|
|
8
|
-
import { createArtifactComparisonEvidence, createChangedBehaviorEvidence, } from "./CrossVersionInvestigationEvidence.js";
|
|
9
|
-
import { selectCompletedInvestigationReplay } from "./CrossVersionInvestigationReplay.js";
|
|
10
|
-
import { investigationEvidenceIds as evidenceIds, mergeInvestigationEvidence as mergeEvidence, recordsForInvestigationRun as recordsForRun, replaceInvestigationRun as replaceRun, } from "./CrossVersionInvestigationCollections.js";
|
|
11
|
-
/** Run or resume a deterministic cross-version artifact investigation. */
|
|
12
|
-
export const runCrossVersionInvestigation = async (input, policy, execution) => {
|
|
13
|
-
const parsed = crossVersionInvestigationInputSchema.safeParse(input);
|
|
14
|
-
if (!parsed.success)
|
|
15
|
-
return err(new AnalysisInputError("find_changed_behavior", {
|
|
16
|
-
cause: parsed.error,
|
|
17
|
-
}));
|
|
18
|
-
return runCrossVersionInvestigationValidated(parsed.data, policy, execution);
|
|
19
|
-
};
|
|
20
|
-
/** Run input already parsed by a trusted adapter boundary. */
|
|
21
|
-
export const runCrossVersionInvestigationValidated = async (input, policy, execution) => {
|
|
22
|
-
const initial = await readInvestigationWorkspace(input.workspace_path, policy);
|
|
23
|
-
if (!initial.ok)
|
|
24
|
-
return initial;
|
|
25
|
-
const preflight = validateWorkspaceRequest(initial.value, input);
|
|
26
|
-
if (!preflight.ok)
|
|
27
|
-
return preflight;
|
|
28
|
-
if (isCancelled(execution.signal))
|
|
29
|
-
return err(new AnalysisCancelledError("find_changed_behavior"));
|
|
30
|
-
if (input.replay_run_id !== undefined) {
|
|
31
|
-
const replay = selectCompletedInvestigationReplay(initial.value, input);
|
|
32
|
-
if (!replay.ok)
|
|
33
|
-
return replay;
|
|
34
|
-
return completeOutcome(replay.value.workspace, replay.value.run, true, execution.session);
|
|
35
|
-
}
|
|
36
|
-
if (execution.authorizeInputRead !== undefined) {
|
|
37
|
-
const authorized = await execution.authorizeInputRead();
|
|
38
|
-
if (!authorized.ok)
|
|
39
|
-
return authorized;
|
|
40
|
-
}
|
|
41
|
-
await execution.progress?.report({
|
|
42
|
-
phase: "scan_versions",
|
|
43
|
-
completed: 0,
|
|
44
|
-
total: 4,
|
|
45
|
-
message: "Scanning both version inputs",
|
|
46
|
-
});
|
|
47
|
-
const snapshots = await scanVersions(input, execution.inputRoots, execution.signal, execution.integrityContinueEnabled);
|
|
48
|
-
if (!snapshots.ok)
|
|
49
|
-
return snapshots;
|
|
50
|
-
await execution.progress?.report({
|
|
51
|
-
phase: "scan_versions",
|
|
52
|
-
completed: 1,
|
|
53
|
-
total: 4,
|
|
54
|
-
message: "Version inputs scanned",
|
|
55
|
-
});
|
|
56
|
-
return continueInvestigation({
|
|
57
|
-
input,
|
|
58
|
-
initial: initial.value,
|
|
59
|
-
snapshots: snapshots.value,
|
|
60
|
-
policy,
|
|
61
|
-
session: execution.session,
|
|
62
|
-
signal: execution.signal,
|
|
63
|
-
progress: execution.progress,
|
|
64
|
-
authorizeWorkspaceWrite: execution.authorizeWorkspaceWrite,
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
const continueInvestigation = async (context) => {
|
|
68
|
-
const left = targetFor(context.snapshots.left);
|
|
69
|
-
const right = targetFor(context.snapshots.right);
|
|
70
|
-
const identity = createInvestigationRunIdentity({
|
|
71
|
-
left,
|
|
72
|
-
right,
|
|
73
|
-
options: context.input.options,
|
|
74
|
-
integrity_policy: context.input.integrity_policy,
|
|
75
|
-
integrity_continue_approved: context.input.integrity_continue_approved,
|
|
76
|
-
max_integrity_mismatches: context.input.max_integrity_mismatches,
|
|
77
|
-
});
|
|
78
|
-
const legacyIdentity = createLegacyInvestigationRunIdentity({
|
|
79
|
-
left,
|
|
80
|
-
right,
|
|
81
|
-
options: context.input.options,
|
|
82
|
-
});
|
|
83
|
-
const existing = context.initial?.runs.find((run) => run.run_id === identity.runId ||
|
|
84
|
-
(context.input.integrity_policy === "fail" &&
|
|
85
|
-
!context.input.integrity_continue_approved &&
|
|
86
|
-
context.input.max_integrity_mismatches === 10 &&
|
|
87
|
-
"legacy_request_identity" in run &&
|
|
88
|
-
run.max_integrity_mismatches === 10 &&
|
|
89
|
-
run.run_id === legacyIdentity.runId));
|
|
90
|
-
if (context.initial !== null && existing?.status === "complete")
|
|
91
|
-
return completeOutcome(context.initial, existing, true, context.session);
|
|
92
|
-
if (context.authorizeWorkspaceWrite !== undefined) {
|
|
93
|
-
const authorized = await context.authorizeWorkspaceWrite();
|
|
94
|
-
if (!authorized.ok)
|
|
95
|
-
return authorized;
|
|
96
|
-
}
|
|
97
|
-
const pages = createInventoryEvidencePages(context.input, context.snapshots);
|
|
98
|
-
if (!pages.ok)
|
|
99
|
-
return pages;
|
|
100
|
-
if (isCancelled(context.signal))
|
|
101
|
-
return err(new AnalysisCancelledError("find_changed_behavior"));
|
|
102
|
-
const inventoried = await ensureInventoryCheckpoint({
|
|
103
|
-
input: context.input,
|
|
104
|
-
current: context.initial,
|
|
105
|
-
existing,
|
|
106
|
-
pages: pages.value,
|
|
107
|
-
snapshots: context.snapshots,
|
|
108
|
-
policy: context.policy,
|
|
109
|
-
});
|
|
110
|
-
if (!inventoried.ok)
|
|
111
|
-
return inventoried;
|
|
112
|
-
await context.progress?.report({
|
|
113
|
-
phase: "inventory_versions",
|
|
114
|
-
completed: 2,
|
|
115
|
-
total: 4,
|
|
116
|
-
message: "Both artifact inventories checkpointed",
|
|
117
|
-
});
|
|
118
|
-
if (isCancelled(context.signal))
|
|
119
|
-
return err(new AnalysisCancelledError("find_changed_behavior"));
|
|
120
|
-
const compared = await ensureComparisonCheckpoint(context.input, inventoried.value, context.policy);
|
|
121
|
-
if (!compared.ok)
|
|
122
|
-
return compared;
|
|
123
|
-
await context.progress?.report({
|
|
124
|
-
phase: "compare_artifacts",
|
|
125
|
-
completed: 3,
|
|
126
|
-
total: 4,
|
|
127
|
-
message: "Artifact comparison checkpointed",
|
|
128
|
-
});
|
|
129
|
-
if (isCancelled(context.signal))
|
|
130
|
-
return err(new AnalysisCancelledError("find_changed_behavior"));
|
|
131
|
-
const finalized = await finalizeInvestigation(context.input, compared.value, context.policy, context.session);
|
|
132
|
-
await context.progress?.report({
|
|
133
|
-
phase: "changed_behavior",
|
|
134
|
-
completed: 4,
|
|
135
|
-
total: 4,
|
|
136
|
-
message: finalized.ok ? "Investigation completed" : "Investigation failed",
|
|
137
|
-
terminal: true,
|
|
138
|
-
});
|
|
139
|
-
return finalized;
|
|
140
|
-
};
|
|
141
|
-
const isCancelled = (signal) => signal?.aborted === true;
|
|
142
|
-
const ensureInventoryCheckpoint = async (input) => {
|
|
143
|
-
if (input.existing !== undefined) {
|
|
144
|
-
const consistent = validateInventoryCheckpoint(input.existing, input.pages);
|
|
145
|
-
if (!consistent.ok)
|
|
146
|
-
return consistent;
|
|
147
|
-
return input.current === null
|
|
148
|
-
? err(new EvidenceIntegrityError("Investigation workspace is missing"))
|
|
149
|
-
: ok({ workspace: input.current, run: input.existing });
|
|
150
|
-
}
|
|
151
|
-
const left = targetFor(input.snapshots.left);
|
|
152
|
-
const right = targetFor(input.snapshots.right);
|
|
153
|
-
const identity = createInvestigationRunIdentity({
|
|
154
|
-
left,
|
|
155
|
-
right,
|
|
156
|
-
options: input.input.options,
|
|
157
|
-
integrity_policy: input.input.integrity_policy,
|
|
158
|
-
integrity_continue_approved: input.input.integrity_continue_approved,
|
|
159
|
-
max_integrity_mismatches: input.input.max_integrity_mismatches,
|
|
160
|
-
});
|
|
161
|
-
const run = investigationRunSchema.parse({
|
|
162
|
-
schema_version: 1,
|
|
163
|
-
run_id: identity.runId,
|
|
164
|
-
request_sha256: identity.requestSha256,
|
|
165
|
-
left,
|
|
166
|
-
right,
|
|
167
|
-
options: input.input.options,
|
|
168
|
-
integrity_policy: input.input.integrity_policy,
|
|
169
|
-
integrity_continue_approved: input.input.integrity_continue_approved,
|
|
170
|
-
max_integrity_mismatches: input.input.max_integrity_mismatches,
|
|
171
|
-
status: "running",
|
|
172
|
-
completed_stages: ["inventory_left", "inventory_right"],
|
|
173
|
-
left_inventory_evidence_ids: evidenceIds(input.pages.left),
|
|
174
|
-
right_inventory_evidence_ids: evidenceIds(input.pages.right),
|
|
175
|
-
comparison_evidence_id: null,
|
|
176
|
-
result_evidence_id: null,
|
|
177
|
-
limitations: runLimitations(input.snapshots),
|
|
178
|
-
});
|
|
179
|
-
const saved = await checkpoint({
|
|
180
|
-
path: input.input.workspace_path,
|
|
181
|
-
name: input.input.workspace_name,
|
|
182
|
-
current: input.current,
|
|
183
|
-
records: [...input.pages.left, ...input.pages.right],
|
|
184
|
-
run,
|
|
185
|
-
policy: input.policy,
|
|
186
|
-
});
|
|
187
|
-
return saved.ok ? ok({ workspace: saved.value, run }) : saved;
|
|
188
|
-
};
|
|
189
|
-
const ensureComparisonCheckpoint = async (input, state, policy) => {
|
|
190
|
-
if (state.run.comparison_evidence_id !== null)
|
|
191
|
-
return ok(state);
|
|
192
|
-
const inventory = inventoryEvidence(state.workspace, state.run);
|
|
193
|
-
if (!inventory.ok)
|
|
194
|
-
return inventory;
|
|
195
|
-
const evidence = createArtifactComparisonEvidence(inventory.value, input.options.change_limit);
|
|
196
|
-
const run = investigationRunSchema.parse({
|
|
197
|
-
...state.run,
|
|
198
|
-
completed_stages: [
|
|
199
|
-
"inventory_left",
|
|
200
|
-
"inventory_right",
|
|
201
|
-
"compare_artifacts",
|
|
202
|
-
],
|
|
203
|
-
comparison_evidence_id: evidence.evidence_id,
|
|
204
|
-
});
|
|
205
|
-
const saved = await checkpoint({
|
|
206
|
-
path: input.workspace_path,
|
|
207
|
-
name: input.workspace_name,
|
|
208
|
-
current: state.workspace,
|
|
209
|
-
records: [evidence],
|
|
210
|
-
run,
|
|
211
|
-
policy,
|
|
212
|
-
});
|
|
213
|
-
return saved.ok ? ok({ workspace: saved.value, run }) : saved;
|
|
214
|
-
};
|
|
215
|
-
const finalizeInvestigation = async (input, state, policy, session) => {
|
|
216
|
-
const comparison = comparisonEvidenceFor(state.workspace, state.run);
|
|
217
|
-
if (!comparison.ok)
|
|
218
|
-
return comparison;
|
|
219
|
-
const evidence = createChangedBehaviorEvidence(state.workspace, state.run, comparison.value);
|
|
220
|
-
const run = investigationRunSchema.parse({
|
|
221
|
-
...state.run,
|
|
222
|
-
status: "complete",
|
|
223
|
-
completed_stages: [
|
|
224
|
-
"inventory_left",
|
|
225
|
-
"inventory_right",
|
|
226
|
-
"compare_artifacts",
|
|
227
|
-
"find_changed_behavior",
|
|
228
|
-
],
|
|
229
|
-
result_evidence_id: evidence.evidence_id,
|
|
230
|
-
});
|
|
231
|
-
const saved = await checkpoint({
|
|
232
|
-
path: input.workspace_path,
|
|
233
|
-
name: input.workspace_name,
|
|
234
|
-
current: state.workspace,
|
|
235
|
-
records: [evidence],
|
|
236
|
-
run,
|
|
237
|
-
policy,
|
|
238
|
-
});
|
|
239
|
-
return saved.ok ? completeOutcome(saved.value, run, false, session) : saved;
|
|
240
|
-
};
|
|
241
|
-
const comparisonEvidenceFor = (workspace, run) => {
|
|
242
|
-
const evidence = workspace.bundle.records.find(({ evidence_id: id }) => id === run.comparison_evidence_id);
|
|
243
|
-
return evidence === undefined
|
|
244
|
-
? err(new EvidenceIntegrityError("Investigation comparison checkpoint is missing Evidence"))
|
|
245
|
-
: ok(evidence);
|
|
246
|
-
};
|
|
247
|
-
const checkpoint = async (input) => {
|
|
248
|
-
const records = mergeEvidence(input.current?.bundle.records ?? [], input.records);
|
|
249
|
-
const bundle = createEvidenceBundle(records, input.current?.bundle.unknowns ?? []);
|
|
250
|
-
const runs = replaceRun(input.current?.runs ?? [], input.run);
|
|
251
|
-
const next = input.current === null
|
|
252
|
-
? createInvestigationWorkspace(input.name, bundle, runs)
|
|
253
|
-
: reviseInvestigationWorkspace(input.current, bundle, runs);
|
|
254
|
-
const written = await writeInvestigationWorkspace(next, input.path, input.current?.revision ?? null, input.policy);
|
|
255
|
-
return written.ok ? ok(next) : written;
|
|
256
|
-
};
|
|
257
|
-
const completeOutcome = (workspace, run, reused, session) => {
|
|
258
|
-
if (run.result_evidence_id === null)
|
|
259
|
-
return err(new EvidenceIntegrityError("Completed investigation has no result"));
|
|
260
|
-
const evidence = workspace.bundle.records.find(({ evidence_id: id }) => id === run.result_evidence_id);
|
|
261
|
-
if (evidence === undefined)
|
|
262
|
-
return err(new EvidenceIntegrityError("Completed investigation result Evidence is missing"));
|
|
263
|
-
if (session !== undefined) {
|
|
264
|
-
const records = recordsForRun(workspace, run);
|
|
265
|
-
const imported = session.importEvidenceBundle(createEvidenceBundle(records));
|
|
266
|
-
if (!imported.ok)
|
|
267
|
-
return imported;
|
|
268
|
-
}
|
|
269
|
-
return ok({ evidence, workspace, reused });
|
|
270
|
-
};
|
|
271
|
-
const validateWorkspaceRequest = (workspace, input) => {
|
|
272
|
-
if (workspace !== null && workspace.name !== input.workspace_name)
|
|
273
|
-
return err(new InvestigationWorkspaceError("update", "name-conflict"));
|
|
274
|
-
if (input.expected_workspace_revision !== undefined &&
|
|
275
|
-
workspace?.revision !== input.expected_workspace_revision)
|
|
276
|
-
return err(new InvestigationWorkspaceError("update", "revision-conflict"));
|
|
277
|
-
return ok(null);
|
|
278
|
-
};
|
|
279
|
-
const validateInventoryCheckpoint = (run, pages) => JSON.stringify(run.left_inventory_evidence_ids) ===
|
|
280
|
-
JSON.stringify(evidenceIds(pages.left)) &&
|
|
281
|
-
JSON.stringify(run.right_inventory_evidence_ids) ===
|
|
282
|
-
JSON.stringify(evidenceIds(pages.right))
|
|
283
|
-
? ok(null)
|
|
284
|
-
: err(new EvidenceIntegrityError("Investigation inventory checkpoint disagrees with current content"));
|
|
285
|
-
const inventoryEvidence = (workspace, run) => {
|
|
286
|
-
if (workspace === null)
|
|
287
|
-
return err(new EvidenceIntegrityError("Investigation workspace is missing"));
|
|
288
|
-
const byId = new Map(workspace.bundle.records.map((record) => [record.evidence_id, record]));
|
|
289
|
-
const left = run.left_inventory_evidence_ids.flatMap((id) => {
|
|
290
|
-
const evidence = byId.get(id);
|
|
291
|
-
return evidence === undefined ? [] : [evidence];
|
|
292
|
-
});
|
|
293
|
-
const right = run.right_inventory_evidence_ids.flatMap((id) => {
|
|
294
|
-
const evidence = byId.get(id);
|
|
295
|
-
return evidence === undefined ? [] : [evidence];
|
|
296
|
-
});
|
|
297
|
-
return left.length === run.left_inventory_evidence_ids.length &&
|
|
298
|
-
right.length === run.right_inventory_evidence_ids.length
|
|
299
|
-
? ok({ left, right })
|
|
300
|
-
: err(new EvidenceIntegrityError("Investigation inventory checkpoint is incomplete"));
|
|
301
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const recordsForInvestigationRun = (workspace, run) => {
|
|
2
|
-
const ids = new Set([
|
|
3
|
-
...run.left_inventory_evidence_ids,
|
|
4
|
-
...run.right_inventory_evidence_ids,
|
|
5
|
-
...(run.comparison_evidence_id === null
|
|
6
|
-
? []
|
|
7
|
-
: [run.comparison_evidence_id]),
|
|
8
|
-
...(run.result_evidence_id === null ? [] : [run.result_evidence_id]),
|
|
9
|
-
]);
|
|
10
|
-
return workspace.bundle.records.filter(({ evidence_id: id }) => ids.has(id));
|
|
11
|
-
};
|
|
12
|
-
export const mergeInvestigationEvidence = (current, additions) => {
|
|
13
|
-
const records = new Map(current.map((record) => [record.evidence_id, record]));
|
|
14
|
-
for (const record of additions)
|
|
15
|
-
if (!records.has(record.evidence_id))
|
|
16
|
-
records.set(record.evidence_id, record);
|
|
17
|
-
return [...records.values()];
|
|
18
|
-
};
|
|
19
|
-
export const replaceInvestigationRun = (runs, replacement) => [
|
|
20
|
-
...runs.filter(({ run_id: id }) => id !== replacement.run_id),
|
|
21
|
-
replacement,
|
|
22
|
-
];
|
|
23
|
-
export const investigationEvidenceIds = (records) => records.map(({ evidence_id: id }) => id);
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { compareArtifacts } from "../domain/artifactComparison.js";
|
|
2
|
-
import { findChangedBehavior } from "../domain/changedBehavior.js";
|
|
3
|
-
import { createEvidence } from "../domain/evidence.js";
|
|
4
|
-
import { investigationRunSummarySchema, } from "../domain/investigationWorkspace.js";
|
|
5
|
-
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
6
|
-
import { AUTOMATIC_RUN_LIMITATION } from "./CrossVersionInventory.js";
|
|
7
|
-
import { ARTIFACT_COMPARISON_PROVIDER, CHANGED_BEHAVIOR_PROVIDER, } from "./InvestigationProviders.js";
|
|
8
|
-
/** Derive deterministic artifact-comparison Evidence from inventory pages. */
|
|
9
|
-
export const createArtifactComparisonEvidence = (inventory, limit) => {
|
|
10
|
-
const comparison = compareArtifacts(inventory.left, inventory.right, 0, limit);
|
|
11
|
-
const leftIds = evidenceIds(inventory.left);
|
|
12
|
-
const rightIds = evidenceIds(inventory.right);
|
|
13
|
-
return createEvidence(undefined, ARTIFACT_COMPARISON_PROVIDER, {
|
|
14
|
-
predicateType: "rea.artifact-comparison/v1",
|
|
15
|
-
operation: "compare_artifacts",
|
|
16
|
-
parameters: {
|
|
17
|
-
left_evidence_ids: leftIds,
|
|
18
|
-
right_evidence_ids: rightIds,
|
|
19
|
-
offset: 0,
|
|
20
|
-
limit,
|
|
21
|
-
},
|
|
22
|
-
result: jsonValueSchema.parse(comparison),
|
|
23
|
-
confidence: "derived",
|
|
24
|
-
authority: "analyst-inference",
|
|
25
|
-
limitations: comparison.limitations,
|
|
26
|
-
evidenceLinks: [...leftIds, ...rightIds],
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
/** Derive the deterministic final report for one comparison checkpoint. */
|
|
30
|
-
export const createChangedBehaviorEvidence = (workspace, run, comparison) => {
|
|
31
|
-
const limit = Math.min(run.options.change_limit, 100);
|
|
32
|
-
const changed = findChangedBehavior([comparison], 0, limit);
|
|
33
|
-
const summary = investigationRunSummarySchema.parse({
|
|
34
|
-
schema_version: 1,
|
|
35
|
-
workspace_id: workspace.workspace_id,
|
|
36
|
-
run_id: run.run_id,
|
|
37
|
-
left_manifest_id: run.left.manifest_id,
|
|
38
|
-
right_manifest_id: run.right.manifest_id,
|
|
39
|
-
inventory_evidence_count: run.left_inventory_evidence_ids.length +
|
|
40
|
-
run.right_inventory_evidence_ids.length,
|
|
41
|
-
comparison_evidence_id: comparison.evidence_id,
|
|
42
|
-
limitations: run.limitations,
|
|
43
|
-
});
|
|
44
|
-
return createEvidence(undefined, CHANGED_BEHAVIOR_PROVIDER, {
|
|
45
|
-
predicateType: "rea.changed-behavior/v1",
|
|
46
|
-
operation: "find_changed_behavior",
|
|
47
|
-
parameters: {
|
|
48
|
-
workspace_id: workspace.workspace_id,
|
|
49
|
-
run_id: run.run_id,
|
|
50
|
-
comparison_evidence_ids: [comparison.evidence_id],
|
|
51
|
-
offset: 0,
|
|
52
|
-
limit,
|
|
53
|
-
},
|
|
54
|
-
result: jsonValueSchema.parse({
|
|
55
|
-
...changed,
|
|
56
|
-
investigation_run: summary,
|
|
57
|
-
}),
|
|
58
|
-
confidence: "derived",
|
|
59
|
-
authority: "analyst-inference",
|
|
60
|
-
limitations: [...changed.limitations, AUTOMATIC_RUN_LIMITATION],
|
|
61
|
-
evidenceLinks: changed.evidence_links,
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
const evidenceIds = (records) => records.map(({ evidence_id: id }) => id);
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { isDeepStrictEqual } from "node:util";
|
|
2
|
-
import { artifactInventoryResultSchema, } from "../domain/artifactGraph.js";
|
|
3
|
-
import { parseArtifactInventoryEvidence } from "../domain/artifactInventoryEvidence.js";
|
|
4
|
-
import { EvidenceIntegrityError, InvestigationWorkspaceError, } from "../domain/errors.js";
|
|
5
|
-
import { err, ok } from "../domain/result.js";
|
|
6
|
-
import { createArtifactComparisonEvidence, createChangedBehaviorEvidence, } from "./CrossVersionInvestigationEvidence.js";
|
|
7
|
-
import { AUTOMATIC_RUN_LIMITATION } from "./CrossVersionInventory.js";
|
|
8
|
-
import { ARTIFACT_GRAPH_PROVIDER } from "./InvestigationProviders.js";
|
|
9
|
-
/** Select and verify one caller-identified complete run without input access. */
|
|
10
|
-
export const selectCompletedInvestigationReplay = (workspace, input) => {
|
|
11
|
-
const run = workspace?.runs.find(({ run_id: runId }) => runId === input.replay_run_id);
|
|
12
|
-
if (workspace === null ||
|
|
13
|
-
run === undefined ||
|
|
14
|
-
run.status !== "complete" ||
|
|
15
|
-
!controlsMatch(run, input))
|
|
16
|
-
return replayConflict();
|
|
17
|
-
const records = new Map(workspace.bundle.records.map((record) => [record.evidence_id, record]));
|
|
18
|
-
const left = inventoryRecords(records, run.left_inventory_evidence_ids);
|
|
19
|
-
const right = inventoryRecords(records, run.right_inventory_evidence_ids);
|
|
20
|
-
if (!left.ok)
|
|
21
|
-
return left;
|
|
22
|
-
if (!right.ok)
|
|
23
|
-
return right;
|
|
24
|
-
if (!pathsMatch(left.value, input.left_path) ||
|
|
25
|
-
!pathsMatch(right.value, input.right_path))
|
|
26
|
-
return replayConflict();
|
|
27
|
-
const validated = validateLinkedEvidence(workspace, run, left.value, right.value);
|
|
28
|
-
return validated.ok ? ok({ workspace, run }) : validated;
|
|
29
|
-
};
|
|
30
|
-
const controlsMatch = (run, input) => isDeepStrictEqual(run.options, input.options) &&
|
|
31
|
-
run.integrity_policy === input.integrity_policy &&
|
|
32
|
-
run.integrity_continue_approved === input.integrity_continue_approved &&
|
|
33
|
-
run.max_integrity_mismatches === input.max_integrity_mismatches;
|
|
34
|
-
const inventoryRecords = (records, evidenceIds) => {
|
|
35
|
-
if (new Set(evidenceIds).size !== evidenceIds.length)
|
|
36
|
-
return replayIntegrity("Investigation replay repeats inventory Evidence");
|
|
37
|
-
const selected = evidenceIds.flatMap((evidenceId) => {
|
|
38
|
-
const evidence = records.get(evidenceId);
|
|
39
|
-
return evidence === undefined ? [] : [evidence];
|
|
40
|
-
});
|
|
41
|
-
return selected.length === evidenceIds.length
|
|
42
|
-
? ok(selected)
|
|
43
|
-
: replayIntegrity("Investigation replay is missing inventory Evidence");
|
|
44
|
-
};
|
|
45
|
-
const pathsMatch = (records, path) => records.every(({ subject }) => subject?.local_path === path);
|
|
46
|
-
const validateLinkedEvidence = (workspace, run, leftRecords, rightRecords) => {
|
|
47
|
-
try {
|
|
48
|
-
const left = validateInventory(leftRecords, run.left, run);
|
|
49
|
-
const right = validateInventory(rightRecords, run.right, run);
|
|
50
|
-
if (!left.ok)
|
|
51
|
-
return left;
|
|
52
|
-
if (!right.ok)
|
|
53
|
-
return right;
|
|
54
|
-
const expectedLimitations = runLimitations(left.value, right.value);
|
|
55
|
-
if (!isDeepStrictEqual(run.limitations, expectedLimitations))
|
|
56
|
-
return replayIntegrity("Investigation replay limitations disagree with inventory Evidence");
|
|
57
|
-
const comparison = createArtifactComparisonEvidence({ left: left.value.records, right: right.value.records }, run.options.change_limit);
|
|
58
|
-
const storedComparison = evidenceFor(workspace, run.comparison_evidence_id);
|
|
59
|
-
if (storedComparison === undefined ||
|
|
60
|
-
!isDeepStrictEqual(storedComparison, comparison))
|
|
61
|
-
return replayIntegrity("Investigation replay comparison Evidence is inconsistent");
|
|
62
|
-
const result = createChangedBehaviorEvidence(workspace, run, comparison);
|
|
63
|
-
const storedResult = evidenceFor(workspace, run.result_evidence_id);
|
|
64
|
-
return storedResult !== undefined && isDeepStrictEqual(storedResult, result)
|
|
65
|
-
? ok(null)
|
|
66
|
-
: replayIntegrity("Investigation replay result Evidence is inconsistent");
|
|
67
|
-
}
|
|
68
|
-
catch (cause) {
|
|
69
|
-
return replayIntegrity("Investigation replay linked Evidence is invalid", cause);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const validateInventory = (records, target, run) => {
|
|
73
|
-
const pages = records.map((record) => artifactInventoryResultSchema.parse(record.normalized_result));
|
|
74
|
-
const expectedPageCount = Math.max(1, Math.ceil((pages[0]?.manifest.node_count ?? 0) / run.options.page_size), Math.ceil((pages[0]?.manifest.occurrence_count ?? 0) / run.options.page_size), Math.ceil((pages[0]?.manifest.edge_count ?? 0) / run.options.page_size));
|
|
75
|
-
if (records.length !== expectedPageCount)
|
|
76
|
-
return replayIntegrity("Investigation replay inventory Evidence pagination is inconsistent");
|
|
77
|
-
if (!sameSnapshotMetadata(pages))
|
|
78
|
-
return replayIntegrity("Investigation replay inventory pages disagree on snapshot metadata");
|
|
79
|
-
for (const [index, record] of records.entries()) {
|
|
80
|
-
const page = pages[index];
|
|
81
|
-
if (page === undefined || !inventoryRecordMatches(record, page, run, index))
|
|
82
|
-
return replayIntegrity("Investigation replay inventory Evidence is inconsistent");
|
|
83
|
-
}
|
|
84
|
-
const result = parseArtifactInventoryEvidence(records);
|
|
85
|
-
if (!result.inventory.complete || !targetMatches(result.inventory, target))
|
|
86
|
-
return replayIntegrity("Investigation replay inventory commitment is inconsistent");
|
|
87
|
-
return ok({ records, result });
|
|
88
|
-
};
|
|
89
|
-
const inventoryRecordMatches = (record, page, run, index) => {
|
|
90
|
-
const offset = index * run.options.page_size;
|
|
91
|
-
const parameters = {
|
|
92
|
-
node_offset: offset,
|
|
93
|
-
node_limit: run.options.page_size,
|
|
94
|
-
occurrence_offset: offset,
|
|
95
|
-
occurrence_limit: run.options.page_size,
|
|
96
|
-
edge_offset: offset,
|
|
97
|
-
edge_limit: run.options.page_size,
|
|
98
|
-
max_entries: run.options.max_entries,
|
|
99
|
-
max_total_bytes: run.options.max_total_bytes,
|
|
100
|
-
max_entry_bytes: run.options.max_entry_bytes,
|
|
101
|
-
max_compression_ratio: run.options.max_compression_ratio,
|
|
102
|
-
max_depth: run.options.max_depth,
|
|
103
|
-
max_path_bytes: run.options.max_path_bytes,
|
|
104
|
-
integrity_policy: run.integrity_policy,
|
|
105
|
-
integrity_continue_approved: run.integrity_continue_approved,
|
|
106
|
-
max_integrity_mismatches: run.max_integrity_mismatches,
|
|
107
|
-
};
|
|
108
|
-
const locations = page.occurrences.items.map(({ logical_path: path }) => ({
|
|
109
|
-
kind: "artifact-path",
|
|
110
|
-
path,
|
|
111
|
-
}));
|
|
112
|
-
return (record.subject !== null &&
|
|
113
|
-
record.subject.name === record.subject.local_path.split("/").at(-1) &&
|
|
114
|
-
record.subject.digest.sha256 === page.manifest.root_sha256 &&
|
|
115
|
-
record.subject.format === page.manifest.root_format &&
|
|
116
|
-
record.subject.architecture === null &&
|
|
117
|
-
isDeepStrictEqual(record.provider, ARTIFACT_GRAPH_PROVIDER) &&
|
|
118
|
-
record.predicate_type === "rea.analysis/v2" &&
|
|
119
|
-
record.operation === "inventory_artifact" &&
|
|
120
|
-
isDeepStrictEqual(record.parameters, parameters) &&
|
|
121
|
-
record.raw_result === null &&
|
|
122
|
-
record.confidence === "observed" &&
|
|
123
|
-
record.authority === "shipped-artifact" &&
|
|
124
|
-
record.environment === null &&
|
|
125
|
-
isDeepStrictEqual(record.limitations, page.limitations) &&
|
|
126
|
-
isDeepStrictEqual(record.locations, locations) &&
|
|
127
|
-
record.evidence_links.length === 0 &&
|
|
128
|
-
isDeepStrictEqual(page.limits, traversalLimits(run)) &&
|
|
129
|
-
pageMatches(page.nodes, offset, run.options.page_size, page.manifest.node_count) &&
|
|
130
|
-
pageMatches(page.occurrences, offset, run.options.page_size, page.manifest.occurrence_count) &&
|
|
131
|
-
pageMatches(page.edges, offset, run.options.page_size, page.manifest.edge_count));
|
|
132
|
-
};
|
|
133
|
-
const sameSnapshotMetadata = (pages) => {
|
|
134
|
-
const first = pages[0];
|
|
135
|
-
return (first !== undefined &&
|
|
136
|
-
pages.every((page) => isDeepStrictEqual(page.manifest, first.manifest) &&
|
|
137
|
-
isDeepStrictEqual(page.limits, first.limits) &&
|
|
138
|
-
isDeepStrictEqual(page.provenance, first.provenance) &&
|
|
139
|
-
isDeepStrictEqual(page.integrity_contradictions, first.integrity_contradictions) &&
|
|
140
|
-
isDeepStrictEqual(page.limitations, first.limitations)));
|
|
141
|
-
};
|
|
142
|
-
const pageMatches = (page, offset, limit, total) => page.offset === offset &&
|
|
143
|
-
page.limit === limit &&
|
|
144
|
-
page.total === total &&
|
|
145
|
-
page.items.length === Math.max(0, Math.min(limit, page.total - offset)) &&
|
|
146
|
-
page.next_offset === (offset + limit < page.total ? offset + limit : null);
|
|
147
|
-
const traversalLimits = (run) => ({
|
|
148
|
-
max_entries: run.options.max_entries,
|
|
149
|
-
max_total_bytes: run.options.max_total_bytes,
|
|
150
|
-
max_entry_bytes: run.options.max_entry_bytes,
|
|
151
|
-
max_compression_ratio: run.options.max_compression_ratio,
|
|
152
|
-
max_depth: run.options.max_depth,
|
|
153
|
-
max_path_bytes: run.options.max_path_bytes,
|
|
154
|
-
});
|
|
155
|
-
const targetMatches = (inventory, target) => inventory.manifest.root_sha256 === target.root_sha256 &&
|
|
156
|
-
inventory.manifest.graph_sha256 === target.graph_sha256 &&
|
|
157
|
-
inventory.manifest.manifest_id === target.manifest_id &&
|
|
158
|
-
inventory.manifest.root_format === target.format;
|
|
159
|
-
const runLimitations = (left, right) => [
|
|
160
|
-
...new Set([
|
|
161
|
-
...left.result.inventory.limitations.map((item) => `Left: ${item}`),
|
|
162
|
-
...right.result.inventory.limitations.map((item) => `Right: ${item}`),
|
|
163
|
-
AUTOMATIC_RUN_LIMITATION,
|
|
164
|
-
]),
|
|
165
|
-
].sort((first, second) => first.localeCompare(second));
|
|
166
|
-
const evidenceFor = (workspace, evidenceId) => evidenceId === null
|
|
167
|
-
? undefined
|
|
168
|
-
: workspace.bundle.records.find(({ evidence_id: current }) => current === evidenceId);
|
|
169
|
-
const replayConflict = () => err(new InvestigationWorkspaceError("read", "revision-conflict"));
|
|
170
|
-
const replayIntegrity = (message, cause) => err(new EvidenceIntegrityError(message, cause === undefined ? undefined : { cause }));
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { AnalysisProtocolError, PermissionRequiredError, } from "../domain/errors.js";
|
|
2
|
-
import { err, ok } from "../domain/result.js";
|
|
3
|
-
import { PermissionPathError, } from "./PermissionAuthority.js";
|
|
4
|
-
/** Authorize one root-scoped operation and project policy path failures. */
|
|
5
|
-
export const authorizeRootPermission = async (authority, request) => {
|
|
6
|
-
const authorized = await authority.authorize({
|
|
7
|
-
capability: request.capability,
|
|
8
|
-
roots: request.roots,
|
|
9
|
-
executables: [],
|
|
10
|
-
environment_names: [],
|
|
11
|
-
network: "none",
|
|
12
|
-
mount: false,
|
|
13
|
-
operation_identity: `${request.operation}:${request.capability}:${request.roots.join(":")}`,
|
|
14
|
-
}, request.access);
|
|
15
|
-
return authorized.ok
|
|
16
|
-
? ok(null)
|
|
17
|
-
: err(authorized.error instanceof PermissionRequiredError
|
|
18
|
-
? authorized.error
|
|
19
|
-
: new AnalysisProtocolError(authorized.error.message, {
|
|
20
|
-
cause: authorized.error,
|
|
21
|
-
}));
|
|
22
|
-
};
|
|
23
|
-
/** Authorize an existing file read and defer write authority until requested. */
|
|
24
|
-
export const authorizeFileReadWithDeferredWrite = async (authority, input) => {
|
|
25
|
-
const read = await authority.authorize({
|
|
26
|
-
capability: input.readCapability,
|
|
27
|
-
roots: [input.path],
|
|
28
|
-
executables: [],
|
|
29
|
-
environment_names: [],
|
|
30
|
-
network: "none",
|
|
31
|
-
mount: false,
|
|
32
|
-
operation_identity: `${input.operation}:${input.readCapability}:${input.path}`,
|
|
33
|
-
}, "read");
|
|
34
|
-
let writeAuthorization;
|
|
35
|
-
if (!read.ok) {
|
|
36
|
-
if (!(read.error instanceof PermissionPathError) ||
|
|
37
|
-
read.error.reason !== "not_found")
|
|
38
|
-
return err(read.error instanceof PermissionRequiredError
|
|
39
|
-
? read.error
|
|
40
|
-
: new AnalysisProtocolError(read.error.message, {
|
|
41
|
-
cause: read.error,
|
|
42
|
-
}));
|
|
43
|
-
writeAuthorization = authorizeRootPermission(authority, {
|
|
44
|
-
capability: input.writeCapability,
|
|
45
|
-
roots: [input.path],
|
|
46
|
-
access: "write",
|
|
47
|
-
operation: input.operation,
|
|
48
|
-
});
|
|
49
|
-
const authorized = await writeAuthorization;
|
|
50
|
-
if (!authorized.ok)
|
|
51
|
-
return authorized;
|
|
52
|
-
}
|
|
53
|
-
return ok({
|
|
54
|
-
authorizeWrite: () => (writeAuthorization ??= authorizeRootPermission(authority, {
|
|
55
|
-
capability: input.writeCapability,
|
|
56
|
-
roots: [input.path],
|
|
57
|
-
access: "write",
|
|
58
|
-
operation: input.operation,
|
|
59
|
-
})),
|
|
60
|
-
});
|
|
61
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** Project doctor diagnostics for concise CLI output or explicit full detail. */
|
|
2
|
-
export const projectDoctorReport = (report, detail) => detail === "full" ? report : doctorSummary(report);
|
|
3
|
-
const doctorSummary = (report) => ({
|
|
4
|
-
healthy: report.healthy,
|
|
5
|
-
environment_healthy: report.environment_healthy,
|
|
6
|
-
scope: report.scope,
|
|
7
|
-
...(report.hopperPath === undefined
|
|
8
|
-
? {}
|
|
9
|
-
: { hopper_path: report.hopperPath }),
|
|
10
|
-
providers: (report.providerInspections ?? []).map((provider) => ({
|
|
11
|
-
id: provider.id,
|
|
12
|
-
configured: provider.configured,
|
|
13
|
-
available: provider.available,
|
|
14
|
-
provider_version: provider.providerVersion,
|
|
15
|
-
failed_checks: provider.checks.filter(({ ok }) => !ok).map(checkSummary),
|
|
16
|
-
})),
|
|
17
|
-
failed_scope_checks: report.scope_checks
|
|
18
|
-
.filter(({ ok }) => !ok)
|
|
19
|
-
.map(checkSummary),
|
|
20
|
-
informational_drift_count: report.informational_checks.filter(({ ok }) => !ok)
|
|
21
|
-
.length,
|
|
22
|
-
identity: report.identity === undefined
|
|
23
|
-
? null
|
|
24
|
-
: {
|
|
25
|
-
cli_package_version: report.identity.cli_package_version,
|
|
26
|
-
expected_skill_version: report.identity.expected_skill_version,
|
|
27
|
-
catalog: {
|
|
28
|
-
counts: report.identity.catalog.counts,
|
|
29
|
-
digests: report.identity.catalog.digests,
|
|
30
|
-
},
|
|
31
|
-
installations: report.identity.installations,
|
|
32
|
-
skill: report.identity.skill,
|
|
33
|
-
registrations: report.identity.registrations,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
const checkSummary = (check) => ({
|
|
37
|
-
name: check.name,
|
|
38
|
-
classification: check.classification,
|
|
39
|
-
...(check.detail === undefined ? {} : { detail: check.detail }),
|
|
40
|
-
...(check.remediation === undefined || check.remediation === null
|
|
41
|
-
? {}
|
|
42
|
-
: { remediation: check.remediation }),
|
|
43
|
-
});
|