rea-agents 6.2.0 → 6.4.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 -23
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/bridge/hopper_bridge.py +2 -0
- package/dist/adb/AdbConfiguration.js +88 -0
- package/dist/adb/AdbDeviceOutput.js +186 -0
- package/dist/adb/AdbProvider.js +1190 -0
- package/dist/adb/AdbShellOutput.js +309 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxConfiguration.js +44 -24
- package/dist/android/JadxProvider.js +59 -21
- package/dist/android/JadxSession.js +51 -9
- package/dist/apktool/ApktoolConfiguration.js +84 -0
- package/dist/apktool/ApktoolDecodeOutput.js +59 -0
- package/dist/apktool/ApktoolProvider.js +506 -0
- package/dist/application/AnalysisProvider.js +8 -2
- package/dist/application/AppBundleExecutable.js +27 -22
- package/dist/application/BinaryTargetResolver.js +85 -19
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +98 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +75 -27
- package/dist/application/DirectAnalysis.js +14 -8
- package/dist/application/DirectAnalysisCleanup.js +1 -2
- package/dist/application/DirectAnalysisStatus.js +3 -6
- package/dist/application/Doctor.js +27 -34
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/GeminiClientSettings.js +139 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InvestigationProviders.js +10 -4
- package/dist/application/JsonFiles.js +16 -15
- package/dist/application/JsonInputFile.js +252 -0
- package/dist/application/LinuxHopper.js +6 -13
- package/dist/application/MacHopper.js +172 -149
- package/dist/application/MipsElfAbiFlags.js +140 -0
- package/dist/application/ProviderOperationExecution.js +31 -0
- package/dist/application/ReconstructionObligationCandidates.js +16 -3
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -1
- package/dist/application/ReferenceSourceImport.js +76 -29
- package/dist/application/ReferenceSourceImportEntries.js +18 -9
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -22
- package/dist/application/ReferenceSourceVcsAdapter.js +145 -30
- package/dist/application/RegularFileRead.js +103 -0
- package/dist/application/Setup.js +69 -10
- package/dist/application/SetupClientConfiguration.js +134 -23
- package/dist/application/SetupHost.js +102 -22
- package/dist/application/SetupPlan.js +18 -17
- package/dist/application/SetupSkill.js +81 -13
- package/dist/application/SupportedClients.js +305 -37
- package/dist/application/Uninstall.js +172 -8
- package/dist/application/UpdateMaintenance.js +23 -23
- package/dist/application/Utf8JsonInput.js +71 -0
- package/dist/application/WebScriptExportService.js +130 -57
- package/dist/application/WebSourceLocationService.js +3 -0
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +40 -2
- package/dist/application/android/AndroidAnalysisService.js +1 -1
- package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
- package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
- package/dist/application/binary/AnalysisClientCleanup.js +0 -24
- package/dist/application/binary/AnalysisSnapshotCache.js +5 -4
- package/dist/application/binary/BinarySession.js +18 -1
- package/dist/application/binary/BinarySessionOpen.js +9 -1
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +2 -1
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +2 -1
- package/dist/application/evm/EvmInterfaceService.js +3 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/javascript/ElectronActiveEvidence.js +2 -2
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +20 -3
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +1 -0
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +107 -46
- package/dist/application/javascript/JavaScriptApplicationService.js +23 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +59 -45
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -36
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +74 -36
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +53 -42
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +293 -238
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +120 -28
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -0
- package/dist/application/javascript/JavaScriptJsonModules.js +2 -2
- package/dist/application/javascript/JavaScriptModuleRelationships.js +10 -20
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +11 -27
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +11 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +206 -66
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +18 -23
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +5 -2
- package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +7 -5
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +6 -4
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +29 -15
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +15 -10
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -1
- package/dist/application/native/NativeCallRoutes.js +2 -4
- package/dist/application/native/NativeUiActionTrace.js +16 -8
- package/dist/application/native/NativeValueTrace.js +23 -6
- package/dist/application/process/ProcessCli.js +25 -20
- package/dist/artifacts/ArtifactPaths.js +129 -8
- package/dist/artifacts/ArtifactProvider.js +34 -31
- package/dist/artifacts/ArtifactProviderMetadata.js +1 -4
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +218 -80
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/DirectoryArtifactReader.js +168 -65
- package/dist/artifacts/MachOSliceArtifactReader.js +116 -39
- package/dist/artifacts/NativeDmgArtifactReader.js +179 -87
- package/dist/artifacts/NativeDmgOwnership.js +109 -0
- package/dist/artifacts/SafeOutputTree.js +245 -70
- package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
- package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
- package/dist/artifacts/ZipArtifactReader.js +77 -27
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +58 -18
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +62 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +76 -49
- package/dist/artifacts/apple/MachoLoadCommandReader.js +36 -6
- package/dist/artifacts/extraction/ArtifactExtraction.js +134 -92
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +116 -50
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +87 -25
- package/dist/artifacts/inventory/hashStableRootArtifact.js +70 -0
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +73 -30
- package/dist/artifacts/inventory/scanReader.js +43 -20
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +72 -28
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/browser/BrowserScenarioPartialObservation.js +8 -2
- package/dist/browser/BrowserScenarioSecrets.js +52 -37
- package/dist/browser/CdpBrowserProvider.js +9 -3
- package/dist/browser/CdpCaptureDocuments.js +40 -6
- package/dist/browser/CdpCaptureDomSvg.js +210 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +4 -8
- package/dist/browser/CdpCaptureEventHandlers.js +26 -9
- package/dist/browser/CdpCaptureEvents.js +4 -9
- package/dist/browser/CdpCaptureStorageFingerprints.js +3 -3
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpElectronInspection.js +2 -2
- package/dist/browser/CdpElectronProvider.js +4 -3
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +48 -23
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +63 -7
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +208 -43
- package/dist/browser/PlaywrightScenarioSession.js +130 -65
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +35 -9
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/ScenarioScriptCapture.js +8 -12
- package/dist/browser/assets/WebArtifactReads.js +23 -1
- package/dist/browser/assets/WebSourceLocationArtifacts.js +1 -0
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/HarCapture.js +14 -0
- package/dist/browser/history/HarCaptureProcess.js +2 -10
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/modules/WebModuleArtifacts.js +1 -0
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/apktoolCommands.js +53 -0
- package/dist/cli/artifactCommands.js +8 -11
- package/dist/cli/binaryDiagnosticsCommands.js +19 -1
- package/dist/cli/browserAdvancedCommands.js +65 -36
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +12 -13
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +14 -10
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +19 -13
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +12 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/streamedJsonOutput.js +83 -4
- package/dist/cli/utilityCommands.js +68 -22
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +11 -2
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +47 -34
- package/dist/cliObservationOptions.js +7 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +5 -4
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/browserScenario.js +2 -2
- package/dist/composition/directAnalysis.js +14 -7
- package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
- package/dist/composition/jeb.js +6 -0
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/mcpInputSchemaProfile.js +27 -0
- package/dist/config/parseConfig.js +28 -1
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +10 -0
- package/dist/contracts/analysisViewToolContracts.js +17 -2
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/artifactComparisonExample.js +5 -5
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/errorSchemas.js +3 -1
- package/dist/contracts/functionComparisonExample.js +8 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +104 -13
- package/dist/contracts/javascript/electronToolContracts.js +16 -3
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +3 -2
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +6 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +8 -7
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/managed/managedToolContracts.js +3 -2
- package/dist/contracts/mobileApplicationGraphExamples.js +5 -5
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/native/nativeToolContracts.js +1 -1
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionLifecycleInputs.js +4 -3
- package/dist/contracts/sessionStatusContract.js +3 -2
- package/dist/contracts/sessionToolContracts.js +5 -4
- package/dist/contracts/sessionToolSchemas.js +9 -4
- package/dist/contracts/toolContractExamples.js +6 -0
- package/dist/contracts/toolContractTypes.js +3 -0
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +167 -0
- package/dist/contracts/toolOutputSchemaGroups.js +7 -5
- package/dist/contracts/toolOutputSchemaPrimitives.js +2 -5
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorBase.js +5 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -4
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +5 -2
- package/dist/domain/analysisView/analysisView.js +53 -5
- package/dist/domain/analysisView/binaryLayoutView.js +2 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +2 -0
- package/dist/domain/analysisView/nativeFunctionView.js +155 -0
- package/dist/domain/android/androidApplication.js +25 -20
- package/dist/domain/android/androidPartialObservation.js +36 -0
- package/dist/domain/apktool/apktoolResourceAnalysis.js +77 -0
- package/dist/domain/apple/appleApplication.js +40 -23
- package/dist/domain/apple/appleBundleAnatomy.js +95 -28
- package/dist/domain/apple/dyldPaths.js +9 -1
- package/dist/domain/apple/dylibResolution.js +3 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +39 -11
- package/dist/domain/artifactGraph.js +6 -4
- package/dist/domain/artifactIdentity.js +37 -9
- package/dist/domain/artifactInspection.js +10 -50
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +16 -17
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserCompleteness.js +3 -2
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/browserScenarioCaptureValues.js +2 -2
- package/dist/domain/browserScenarioNormalization.js +3 -3
- package/dist/domain/browserScenarioValues.js +3 -2
- package/dist/domain/callPath.js +8 -10
- package/dist/domain/canonicalDigest.js +7 -1
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/canonicalOrdering.js +1 -13
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/comparisonSemantics.js +0 -5
- package/dist/domain/digests.js +0 -3
- package/dist/domain/evidence.js +12 -6
- package/dist/domain/evidenceBundle.js +51 -33
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/firmware/firmwareAnalysis.js +4 -3
- package/dist/domain/functionComparison.js +2 -1
- package/dist/domain/functionComparisonNormalization.js +4 -3
- package/dist/domain/functionComparisonResults.js +2 -2
- package/dist/domain/functionDossierEvidence.js +2 -1
- package/dist/domain/hopperValues.js +11 -15
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronActiveObservation.js +4 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +14 -15
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +20 -21
- package/dist/domain/javascript/electronStaticAnalysisNative.js +73 -41
- package/dist/domain/javascript/electronStaticAnalysisValues.js +24 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +6 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +18 -14
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +4 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +91 -28
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparison.js +4 -4
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +37 -22
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +72 -45
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +16 -8
- package/dist/domain/javascript/javascriptAstFingerprint.js +60 -33
- package/dist/domain/javascript/javascriptAstValues.js +54 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +3 -2
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +31 -23
- package/dist/domain/javascript/javascriptExportShapeSelection.js +2 -2
- package/dist/domain/javascript/javascriptExportShapeVariants.js +3 -2
- package/dist/domain/javascript/javascriptFeatureSeed.js +5 -3
- package/dist/domain/javascript/javascriptFeatureTrace.js +7 -6
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +17 -9
- package/dist/domain/javascript/javascriptFeatureTraversal.js +4 -4
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +12 -7
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeObservation.js +8 -5
- 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 +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +5 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +12 -223
- 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 +15 -17
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +379 -30
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +9 -7
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -2
- 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/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +43 -42
- package/dist/domain/javascript/javascriptSemanticGraph.js +205 -52
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +21 -11
- package/dist/domain/javascript/javascriptSemanticIr.js +0 -4
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +139 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +774 -136
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +98 -41
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +9 -7
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +7 -2
- package/dist/domain/javascript/javascriptSemanticProjection.js +72 -28
- package/dist/domain/javascript/javascriptSemanticPromises.js +15 -21
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +100 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +3 -3
- package/dist/domain/javascript/javascriptSemanticQuery.js +33 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +4 -5
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -9
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +16 -10
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +34 -48
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +25 -2
- package/dist/domain/javascript/javascriptSemanticValues.js +169 -30
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptSourceMapPaths.js +11 -1
- package/dist/domain/javascript/javascriptSourceParser.js +34 -9
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +13 -12
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +26 -15
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +7 -5
- package/dist/domain/javascript/sourceToBundleSignals.js +7 -7
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonSerialization.js +109 -55
- package/dist/domain/jsonShape.js +69 -31
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/localPath.js +10 -4
- package/dist/domain/managed/managedApplicationGraph.js +47 -6
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +94 -59
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +6 -7
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeCallObservation.js +2 -4
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/nativeValueFlow.js +5 -11
- package/dist/domain/native/objcSwiftMetadata.js +15 -17
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +102 -11
- package/dist/domain/process/processCaptureCoverage.js +8 -5
- package/dist/domain/process/processCaptureExample.js +67 -0
- package/dist/domain/process/processCaptureValidation.js +83 -3
- package/dist/domain/process/processComparison.js +0 -23
- package/dist/domain/process/processScenario.js +62 -10
- package/dist/domain/process/processTraceEvaluation.js +4 -4
- package/dist/domain/process/processTraceSpecification.js +1 -3
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/providerCleanupError.js +6 -2
- package/dist/domain/reconstructionCoverage.js +2 -1
- package/dist/domain/reconstructionUnknowns.js +4 -3
- package/dist/domain/reconstructionVerification.js +3 -2
- package/dist/domain/referenceSourceGraph.js +32 -23
- package/dist/domain/referenceSourceImportParsing.js +40 -48
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +2 -1
- package/dist/domain/swiftSymbolClassification.js +6 -1
- package/dist/domain/symbolAnalysis.js +17 -2
- package/dist/domain/unicodeCodePointOrder.js +6 -0
- package/dist/domain/webBundleAnalyzerInspection.js +23 -3
- package/dist/domain/webCaptureDiff.js +170 -30
- package/dist/domain/webCaptureDiffSchemas.js +2 -8
- package/dist/domain/webInventory.js +3 -2
- package/dist/domain/webMcpDiscovery.js +4 -3
- package/dist/domain/webScriptExport.js +1 -1
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +7 -13
- package/dist/domain/zipPackageFormat.js +4 -1
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +55 -43
- package/dist/dotnet/ManagedDecodeBudget.js +80 -0
- package/dist/dotnet/ManagedMemberInspector.js +13 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +2 -2
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +5 -4
- package/dist/dotnet/ManagedMemberRows.js +9 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +15 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +20 -11
- package/dist/dotnet/ManagedMetadataLayout.js +10 -4
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +3 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +49 -34
- package/dist/dotnet/ManagedPeReader.js +41 -25
- package/dist/dotnet/ManagedReaderFailure.js +2 -1
- package/dist/dotnet/ManagedStaticProvider.js +65 -31
- package/dist/dotnet/ManagedStaticProviderMetadata.js +1 -4
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +43 -13
- package/dist/evm/EvmoleFailures.js +0 -2
- package/dist/evm/EvmoleInterfaceProvider.js +67 -2
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/RegularFile.js +73 -0
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +26 -0
- package/dist/firmware/FirmwareCommand.js +25 -3
- package/dist/firmware/FirmwareFiles.js +23 -8
- package/dist/firmware/FirmwareProvider.js +156 -32
- package/dist/firmware/FirmwarePublication.js +24 -3
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +55 -4
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +90 -8
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +111 -10
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +123 -58
- package/dist/ghidra/GhidraLoadImageAttest.js +49 -2
- package/dist/ghidra/GhidraMipsProfile.js +79 -0
- package/dist/ghidra/GhidraProvider.js +57 -9
- package/dist/ghidra/GhidraProviderCapabilities.js +18 -8
- package/dist/ghidra/GhidraProviderClient.js +282 -21
- package/dist/ghidra/GhidraSessionValues.js +9 -2
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperCleanup.js +1 -1
- package/dist/hopper/HopperClient.js +15 -6
- package/dist/hopper/HopperMachOImage.js +2 -0
- package/dist/hopper/HopperProvider.js +13 -2
- package/dist/ida/IdaOperationRunner.js +10 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +7 -3
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -5
- package/dist/inspector/V8InspectorCaptureProjection.js +46 -13
- package/dist/inspector/V8InspectorProvider.js +60 -8
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +326 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +520 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +63 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +521 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +116 -0
- package/dist/javascript/recovery/RecoveryFiles.js +18 -7
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +11 -7
- package/dist/javascript/recovery/WakaruProvider.js +139 -16
- package/dist/javascript/recovery/WakaruPublication.js +14 -4
- package/dist/javascript/recovery/WakaruRelease.js +10 -3
- package/dist/javascript/recovery/WakaruReport.js +12 -7
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -3
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +63 -7
- package/dist/javascript/sourceMaps/SourceMapFormat.js +15 -4
- package/dist/jeb/JebMcpConnection.js +179 -0
- package/dist/jeb/JebMcpEndpoint.js +40 -0
- package/dist/jeb/JebProvider.js +299 -0
- package/dist/main/shutdown.js +76 -32
- package/dist/main/transport.js +1 -1
- package/dist/mcpDoctor.js +15 -6
- package/dist/native/AppleDispatchCoverage.js +25 -12
- package/dist/native/AppleDispatchMetadata.js +14 -7
- package/dist/native/AppleMachoFixups.js +71 -15
- package/dist/native/AppleMachoSelection.js +23 -3
- package/dist/native/AppleObjcDispatchFacets.js +3 -3
- package/dist/native/AppleObjcProperties.js +17 -7
- package/dist/native/LldbCallTracer.js +241 -75
- package/dist/native/NativeMacOSProvider.js +100 -20
- package/dist/native/NativeMacOSProviderMetadata.js +1 -2
- package/dist/native/NativeMachoInspection.js +11 -7
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +4 -3
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +63 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/DarwinProcessRunTokenReader.js +8 -3
- package/dist/process/OwnedCommand.js +4 -3
- package/dist/process/ProcessOwnership.js +104 -112
- package/dist/process/ProcessOwnershipObservation.js +104 -51
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +4 -3
- package/dist/process/capture/FilesystemSnapshot.js +116 -22
- package/dist/process/capture/ProcessCaptureLifecycle.js +363 -86
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessFilesystemEffects.js +19 -4
- package/dist/process/capture/ProcessHarness.js +202 -47
- package/dist/process/capture/ProcessNormalization.js +3 -1
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +5 -2
- package/dist/process/capture/TerminalRenderer.js +24 -7
- package/dist/reference/ReferenceSourceReader.js +22 -5
- package/dist/reference/ReferenceSourceReaderEntries.js +114 -51
- package/dist/reference/ReferenceSourceReaderErrors.js +12 -0
- package/dist/reference/ReferenceSourceReaderFile.js +50 -10
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -4
- package/dist/server/EvidenceMcpServer.js +36 -1
- package/dist/server/admittedToolOperation.js +9 -0
- package/dist/server/analysisAdmission.js +8 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +118 -47
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +4 -9
- package/dist/server/registerAndroidTools.js +3 -12
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +6 -7
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +3 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -2
- package/dist/server/registerApplicationTools/helpers.js +3 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +3 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +5 -2
- package/dist/server/registerArtifactTools.js +2 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +12 -9
- package/dist/server/registerBundleComparisonTool.js +16 -2
- package/dist/server/registerCloseLifecycleTool.js +36 -5
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEnhancedTools.js +78 -73
- package/dist/server/registerEvidenceTools.js +54 -46
- package/dist/server/registerEvmTools.js +4 -9
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFunctionComparisonTool.js +5 -2
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -6
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedTools.js +7 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
- package/dist/server/registerOfficialTools.js +31 -25
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerSessionRecordTools.js +2 -1
- package/dist/server/registerSessionTools.js +58 -21
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +4 -9
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/toolResult.js +21 -2
- package/dist/windows/WindowsPrivateRuntime.js +12 -5
- package/install.sh +7 -4
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -7
- package/scripts/rea.mjs +16 -1
- package/skills/reverse-engineer-anything/SKILL.md +52 -51
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +92 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +31 -1
- package/dist/artifacts/inventory/policy.js +0 -2
- package/dist/domain/managed/managedApplicationGraphNodeCoverage.js +0 -6
- package/dist/server/registerNativeTools.js +0 -6
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { arrayContainerSchema, parseElementSteps, } from "../zodCollectionSteps.js";
|
|
3
|
+
import { canonicalJsonDigestSteps } from "../canonicalJsonDigestSteps.js";
|
|
4
|
+
import { canonicalJson } from "../comparisonSemantics.js";
|
|
5
|
+
import { digestCanonicalValue } from "../canonicalDigest.js";
|
|
6
|
+
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
7
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
8
|
+
import { freezeJsonSnapshot, freezeOwnedJsonSnapshotSteps, } from "../immutableJson.js";
|
|
5
9
|
import { applicationEdgeInputSchema, applicationEdgeSchema, applicationNodeInputSchema, applicationNodeObservationSchema, applicationNodeSchema, javascriptApplicationGraphInputSchema, javascriptApplicationGraphRecordSchema, } from "./javascriptApplicationGraphSchemas.js";
|
|
6
10
|
const OBSERVATION_IDENTIFIER_STRATEGY = {
|
|
7
11
|
strategy: "semantic-content-sha256",
|
|
@@ -12,7 +16,7 @@ const EDGE_IDENTIFIER_STRATEGY = {
|
|
|
12
16
|
stability: "relationship-exact",
|
|
13
17
|
};
|
|
14
18
|
const limitKey = (limit) => canonicalJson(limit, "JavaScript Application Graph");
|
|
15
|
-
const normalizeLimits = (limits) => [...new Map(limits.map((limit) => [limitKey(limit), limit])).values()].sort((left, right) =>
|
|
19
|
+
const normalizeLimits = (limits) => [...new Map(limits.map((limit) => [limitKey(limit), limit])).values()].sort((left, right) => compareUnicodeCodePoints(limitKey(left), limitKey(right)));
|
|
16
20
|
const normalizeEvidence = (evidence) => ({
|
|
17
21
|
...evidence,
|
|
18
22
|
coverage: {
|
|
@@ -29,13 +33,13 @@ const nodeSemantic = (node) => ({
|
|
|
29
33
|
kind: node.kind,
|
|
30
34
|
identity: node.identity,
|
|
31
35
|
});
|
|
32
|
-
const nodeId = (node) => `jag_node_${
|
|
36
|
+
const nodeId = (node) => `jag_node_${digestCanonicalValue(nodeSemantic(node), "JavaScript Application Graph")}`;
|
|
33
37
|
const observationSemantic = (nodeIdentifier, observation) => ({ node_id: nodeIdentifier, ...observation });
|
|
34
|
-
const observationId = (nodeIdentifier, observation) => `jag_observation_${
|
|
35
|
-
const edgeId = (edge) => `jag_edge_${
|
|
38
|
+
const observationId = (nodeIdentifier, observation) => `jag_observation_${digestCanonicalValue(observationSemantic(nodeIdentifier, observation))}`;
|
|
39
|
+
const edgeId = (edge) => `jag_edge_${digestCanonicalValue(edge, "JavaScript Application Graph")}`;
|
|
36
40
|
const sortedUniqueIssue = (values, path, label, context) => {
|
|
37
41
|
for (let index = 1; index < values.length; index += 1) {
|
|
38
|
-
if (
|
|
42
|
+
if (compareUnicodeCodePoints(values[index - 1] ?? "", values[index] ?? "") < 0)
|
|
39
43
|
continue;
|
|
40
44
|
context.addIssue({
|
|
41
45
|
code: "custom",
|
|
@@ -158,7 +162,12 @@ const checkNode = (node, index, context) => {
|
|
|
158
162
|
path: ["nodes", index, "identity"],
|
|
159
163
|
});
|
|
160
164
|
};
|
|
161
|
-
const
|
|
165
|
+
const checkGraphContent = (graph, context) => {
|
|
166
|
+
const steps = checkGraphContentSteps(graph, context);
|
|
167
|
+
while (steps.next().done !== true)
|
|
168
|
+
;
|
|
169
|
+
};
|
|
170
|
+
function* checkGraphContentSteps(graph, context) {
|
|
162
171
|
sortedUniqueIssue(graph.root_node_ids, ["root_node_ids"], "Root nodes", context);
|
|
163
172
|
sortedUniqueIssue(graph.nodes.map(({ node_id: id }) => id), ["nodes"], "Nodes", context);
|
|
164
173
|
sortedUniqueIssue(graph.edges.map(({ edge_id: id }) => id), ["edges"], "Edges", context);
|
|
@@ -178,9 +187,14 @@ const checkGraphInvariants = (graph, context) => {
|
|
|
178
187
|
message: "Root identifier must name a graph node",
|
|
179
188
|
path: ["root_node_ids"],
|
|
180
189
|
});
|
|
181
|
-
for (const [index, node] of graph.nodes.entries())
|
|
190
|
+
for (const [index, node] of graph.nodes.entries()) {
|
|
191
|
+
if (index % 64 === 0)
|
|
192
|
+
yield;
|
|
182
193
|
checkNode(node, index, context);
|
|
194
|
+
}
|
|
183
195
|
for (const [index, edge] of graph.edges.entries()) {
|
|
196
|
+
if (index % 64 === 0)
|
|
197
|
+
yield;
|
|
184
198
|
const { edge_id: identifier, ...semantic } = edge;
|
|
185
199
|
if (identifier !== edgeId(semantic))
|
|
186
200
|
context.addIssue({
|
|
@@ -211,9 +225,12 @@ const checkGraphInvariants = (graph, context) => {
|
|
|
211
225
|
});
|
|
212
226
|
checkEvidenceNormalization(edge.evidence, ["edges", index, "evidence"], context);
|
|
213
227
|
}
|
|
228
|
+
}
|
|
229
|
+
const checkGraphInvariants = (graph, context) => {
|
|
230
|
+
checkGraphContent(graph, context);
|
|
214
231
|
const { graph_id: identifier, ...semantic } = graph;
|
|
215
232
|
if (identifier !==
|
|
216
|
-
`jag_${
|
|
233
|
+
`jag_${digestCanonicalValue(semantic, "JavaScript Application Graph")}`)
|
|
217
234
|
context.addIssue({
|
|
218
235
|
code: "custom",
|
|
219
236
|
message: "Graph identifier does not match its semantic content",
|
|
@@ -222,9 +239,14 @@ const checkGraphInvariants = (graph, context) => {
|
|
|
222
239
|
};
|
|
223
240
|
/** Strict JavaScript Application Graph with verified commitments. */
|
|
224
241
|
export const javascriptApplicationGraphSchema = javascriptApplicationGraphRecordSchema.superRefine(checkGraphInvariants);
|
|
242
|
+
const javascriptApplicationGraphContentSchema = javascriptApplicationGraphInputSchema.superRefine(checkGraphContent);
|
|
225
243
|
/** Build one normalized application entity and derive all semantic IDs. */
|
|
226
244
|
export const createJavaScriptApplicationNode = (input) => {
|
|
227
245
|
const parsed = applicationNodeInputSchema.parse(input);
|
|
246
|
+
// These properties are newly parsed and exclusively owned. Authenticate
|
|
247
|
+
// them before the observation/node schemas and final graph validate again.
|
|
248
|
+
for (const observation of parsed.observations)
|
|
249
|
+
freezeJsonSnapshot(observation.properties);
|
|
228
250
|
const identity = normalizeIdentity(parsed.identity);
|
|
229
251
|
const identifier = nodeId({ kind: parsed.kind, identity });
|
|
230
252
|
const observations = parsed.observations
|
|
@@ -239,7 +261,7 @@ export const createJavaScriptApplicationNode = (input) => {
|
|
|
239
261
|
observation_id: observationId(identifier, semantic),
|
|
240
262
|
});
|
|
241
263
|
})
|
|
242
|
-
.sort((left, right) =>
|
|
264
|
+
.sort((left, right) => compareUnicodeCodePoints(left.observation_id, right.observation_id));
|
|
243
265
|
return applicationNodeSchema.parse({
|
|
244
266
|
node_id: identifier,
|
|
245
267
|
kind: parsed.kind,
|
|
@@ -250,6 +272,7 @@ export const createJavaScriptApplicationNode = (input) => {
|
|
|
250
272
|
/** Build one normalized directed relationship and derive its semantic ID. */
|
|
251
273
|
export const createJavaScriptApplicationEdge = (input) => {
|
|
252
274
|
const parsed = applicationEdgeInputSchema.parse(input);
|
|
275
|
+
freezeJsonSnapshot(parsed.properties);
|
|
253
276
|
const semantic = {
|
|
254
277
|
...parsed,
|
|
255
278
|
evidence: normalizeEvidence(parsed.evidence),
|
|
@@ -262,26 +285,66 @@ export const createJavaScriptApplicationEdge = (input) => {
|
|
|
262
285
|
};
|
|
263
286
|
/** Normalize a complete graph and derive its top-level semantic ID. */
|
|
264
287
|
export const createJavaScriptApplicationGraph = (input) => {
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
edges: [...parsed.edges].sort((left, right) => compareCodePoints(left.edge_id, right.edge_id)),
|
|
271
|
-
coverage: {
|
|
272
|
-
...parsed.coverage,
|
|
273
|
-
limits: normalizeLimits(parsed.coverage.limits),
|
|
274
|
-
},
|
|
275
|
-
limitations: uniqueSorted(parsed.limitations),
|
|
288
|
+
const semantic = normalizeGraphInput(javascriptApplicationGraphInputSchema.parse(input));
|
|
289
|
+
const content = javascriptApplicationGraphContentSchema.parse(semantic);
|
|
290
|
+
return {
|
|
291
|
+
...content,
|
|
292
|
+
graph_id: `jag_${digestCanonicalValue(content, "JavaScript Application Graph")}`,
|
|
276
293
|
};
|
|
277
|
-
return javascriptApplicationGraphSchema.parse({
|
|
278
|
-
...semantic,
|
|
279
|
-
graph_id: `jag_${canonicalDigest(semantic, "JavaScript Application Graph")}`,
|
|
280
|
-
});
|
|
281
294
|
};
|
|
295
|
+
const normalizeGraphInput = (parsed) => ({
|
|
296
|
+
...parsed,
|
|
297
|
+
root_node_ids: uniqueSorted(parsed.root_node_ids),
|
|
298
|
+
nodes: [...parsed.nodes].sort((left, right) => compareUnicodeCodePoints(left.node_id, right.node_id)),
|
|
299
|
+
edges: [...parsed.edges].sort((left, right) => compareUnicodeCodePoints(left.edge_id, right.edge_id)),
|
|
300
|
+
coverage: {
|
|
301
|
+
...parsed.coverage,
|
|
302
|
+
limits: normalizeLimits(parsed.coverage.limits),
|
|
303
|
+
},
|
|
304
|
+
limitations: uniqueSorted(parsed.limitations),
|
|
305
|
+
});
|
|
282
306
|
const validatedImmutableApplicationGraphs = new WeakSet();
|
|
283
307
|
/** Clone and validate synchronously, then return steps to seal the owned graph. */
|
|
284
308
|
export const createImmutableJavaScriptApplicationGraphSteps = (input) => sealValidatedApplicationGraphSteps(createJavaScriptApplicationGraph(input));
|
|
309
|
+
const applicationGraphShape = javascriptApplicationGraphInputSchema.shape;
|
|
310
|
+
const applicationGraphContainerSchema = javascriptApplicationGraphInputSchema.extend({
|
|
311
|
+
nodes: arrayContainerSchema(applicationGraphShape.nodes),
|
|
312
|
+
edges: arrayContainerSchema(applicationGraphShape.edges),
|
|
313
|
+
});
|
|
314
|
+
/**
|
|
315
|
+
* Seal a graph whose input the caller transfers: the caller neither retains nor
|
|
316
|
+
* mutates any part of it afterwards. Only the graph's own fields are validated
|
|
317
|
+
* synchronously; nodes and edges are validated, checked, hashed and frozen in
|
|
318
|
+
* steps, because doing so at once held the event loop for large applications.
|
|
319
|
+
*/
|
|
320
|
+
export const sealTransferredJavaScriptApplicationGraphSteps = (input) => parseAndSealApplicationGraphSteps(applicationGraphContainerSchema.parse(input));
|
|
321
|
+
function* parseAndSealApplicationGraphSteps(container) {
|
|
322
|
+
const issues = [];
|
|
323
|
+
const parsed = {
|
|
324
|
+
...container,
|
|
325
|
+
nodes: yield* parseElementSteps(applicationGraphShape.nodes.element, container.nodes, ["nodes"], issues),
|
|
326
|
+
edges: yield* parseElementSteps(applicationGraphShape.edges.element, container.edges, ["edges"], issues),
|
|
327
|
+
};
|
|
328
|
+
if (issues.length > 0)
|
|
329
|
+
throw new z.ZodError(issues);
|
|
330
|
+
const content = normalizeGraphInput(parsed);
|
|
331
|
+
let invalid = false;
|
|
332
|
+
yield* checkGraphContentSteps(content, {
|
|
333
|
+
addIssue: () => {
|
|
334
|
+
invalid = true;
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
// An invalid owned graph is a construction defect; report it with the exact
|
|
338
|
+
// issues the content schema produces.
|
|
339
|
+
if (invalid) {
|
|
340
|
+
javascriptApplicationGraphContentSchema.parse(content);
|
|
341
|
+
throw new TypeError("Application graph checks disagree with its schema");
|
|
342
|
+
}
|
|
343
|
+
return yield* sealValidatedApplicationGraphSteps({
|
|
344
|
+
...content,
|
|
345
|
+
graph_id: `jag_${yield* canonicalJsonDigestSteps(content)}`,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
285
348
|
function* sealValidatedApplicationGraphSteps(graph) {
|
|
286
349
|
yield* freezeOwnedJsonSnapshotSteps(graph);
|
|
287
350
|
validatedImmutableApplicationGraphs.add(graph);
|
|
@@ -294,6 +357,6 @@ export const isValidatedImmutableJavaScriptApplicationGraph = (value) => typeof
|
|
|
294
357
|
/** Parse a stored graph and reject stale IDs. */
|
|
295
358
|
export const parseJavaScriptApplicationGraph = (input) => javascriptApplicationGraphSchema.parse(input);
|
|
296
359
|
/** Compute the byte-stable SHA-256 commitment of a verified graph. */
|
|
297
|
-
export const computeJavaScriptApplicationGraphSha256 = (input) =>
|
|
360
|
+
export const computeJavaScriptApplicationGraphSha256 = (input) => digestCanonicalValue(parseJavaScriptApplicationGraph(input), "JavaScript Application Graph");
|
|
298
361
|
/** Serialize a verified graph as RFC 8785 canonical JSON. */
|
|
299
362
|
export const serializeJavaScriptApplicationGraph = (input) => canonicalJson(parseJavaScriptApplicationGraph(input), "JavaScript Application Graph");
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Forecast static-fact expansion into observations, nodes and relationships. */
|
|
2
|
+
export const estimateJavaScriptStaticApplicationProjection = (facts, checkpointBytes, sourcePath) => {
|
|
3
|
+
// A finding can produce a node, a separate observation and several edges.
|
|
4
|
+
// Allow for identifiers, locations, authority, coverage and schema copies,
|
|
5
|
+
// independently of the producer's compact checkpoint representation.
|
|
6
|
+
const findings = facts.references.length +
|
|
7
|
+
facts.endpoints.length +
|
|
8
|
+
facts.storage.length +
|
|
9
|
+
facts.role_paths.length +
|
|
10
|
+
facts.source_map_urls.length +
|
|
11
|
+
facts.electron.browser_windows.length +
|
|
12
|
+
facts.electron.context_bridge_apis.length +
|
|
13
|
+
facts.electron.ipc.length +
|
|
14
|
+
facts.electron.sender_validations.length +
|
|
15
|
+
facts.electron.utility_processes.length +
|
|
16
|
+
facts.electron.native_addon_bindings.length;
|
|
17
|
+
let records = findings * 8;
|
|
18
|
+
let repeatedBytes = 0;
|
|
19
|
+
for (const registration of facts.bundler_registrations) {
|
|
20
|
+
records +=
|
|
21
|
+
3 +
|
|
22
|
+
registration.modules.length * 3 +
|
|
23
|
+
registration.entry_module_keys.length * 3 +
|
|
24
|
+
registration.async_chunk_keys.length * 3;
|
|
25
|
+
// Every module observation and containment edge repeats its chunk keys.
|
|
26
|
+
repeatedBytes +=
|
|
27
|
+
Buffer.byteLength(JSON.stringify(registration.chunk_keys)) *
|
|
28
|
+
registration.modules.length *
|
|
29
|
+
2;
|
|
30
|
+
}
|
|
31
|
+
for (const binding of facts.electron.native_addon_bindings)
|
|
32
|
+
records += binding.members.length * 3;
|
|
33
|
+
const metadataBytes = 2048 + Buffer.byteLength(sourcePath) * 4;
|
|
34
|
+
return (checkpointBytes * 4 + repeatedBytes + records * metadataBytes) * 8;
|
|
35
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { digestCanonicalValue } from "../canonicalDigest.js";
|
|
2
2
|
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
3
3
|
import { buildJavaScriptApplicationChangeGraph } from "./javascriptApplicationChangeGraph.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ownedApplicationVersionComparisonResultSchema, } from "./javascriptApplicationVersionComparisonSchemas.js";
|
|
5
5
|
import { classifyJavaScriptApplicationVersions } from "./javascriptApplicationVersionItems.js";
|
|
6
6
|
import { matchJavaScriptApplicationVersions } from "./javascriptApplicationVersionKeys.js";
|
|
7
7
|
/** Compare application entities with ordered unique-only identity tiers. */
|
|
@@ -47,9 +47,9 @@ export const compareJavaScriptApplicationVersions = (input) => {
|
|
|
47
47
|
evidence_links: evidenceLinks,
|
|
48
48
|
limitations: comparisonLimitations(input),
|
|
49
49
|
};
|
|
50
|
-
return
|
|
50
|
+
return ownedApplicationVersionComparisonResultSchema.parse({
|
|
51
51
|
...semantic,
|
|
52
|
-
comparison_id: `javc_${
|
|
52
|
+
comparison_id: `javc_${digestCanonicalValue(semantic, "Application version comparison")}`,
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
55
|
const summary = (items) => ({
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { emptyArraySchema } from "../emptyArraySchema.js";
|
|
3
3
|
import { evidenceSchema } from "../evidence.js";
|
|
4
|
-
import { javascriptApplicationGraphSchema } from "./javascriptApplicationGraph.js";
|
|
4
|
+
import { isValidatedImmutableJavaScriptApplicationGraph, javascriptApplicationGraphSchema, } from "./javascriptApplicationGraph.js";
|
|
5
5
|
import { JAVASCRIPT_APPLICATION_NODE_KINDS } from "./javascriptApplicationGraphSchemas.js";
|
|
6
6
|
import { prefixedDigestSchema } from "../digests.js";
|
|
7
7
|
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
8
8
|
const nodeIdSchema = prefixedDigestSchema("jag_node");
|
|
9
9
|
const textSchema = z.string().min(1);
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
.strictObject({
|
|
13
|
-
left: evidenceSchema,
|
|
14
|
-
right: evidenceSchema,
|
|
15
|
-
left_native_observations: z.array(evidenceSchema).default([]),
|
|
16
|
-
right_native_observations: z.array(evidenceSchema).default([]),
|
|
17
|
-
})
|
|
18
|
-
.superRefine((input, context) => {
|
|
10
|
+
/** Check paired version identities and per-side native identity uniqueness. */
|
|
11
|
+
const validateApplicationVersionIdentities = (input, context) => {
|
|
19
12
|
if (input.left.evidence_id === input.right.evidence_id)
|
|
20
13
|
context.addIssue({
|
|
21
14
|
code: "custom",
|
|
@@ -34,8 +27,26 @@ export const compareApplicationVersionsInputSchema = z
|
|
|
34
27
|
message: "Native observations must be unique on each side",
|
|
35
28
|
});
|
|
36
29
|
}
|
|
37
|
-
}
|
|
38
|
-
const
|
|
30
|
+
};
|
|
31
|
+
const evidenceIdentitySchema = z.object({ evidence_id: evidenceIdSchema });
|
|
32
|
+
/** Validate paired version identities without capturing whole analysis graphs. */
|
|
33
|
+
export const applicationVersionIdentitiesSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
left: evidenceIdentitySchema,
|
|
36
|
+
right: evidenceIdentitySchema,
|
|
37
|
+
left_native_observations: z.array(evidenceIdentitySchema),
|
|
38
|
+
right_native_observations: z.array(evidenceIdentitySchema),
|
|
39
|
+
})
|
|
40
|
+
.superRefine(validateApplicationVersionIdentities);
|
|
41
|
+
/** Two authenticated application versions and their native observations. */
|
|
42
|
+
export const compareApplicationVersionsInputSchema = z
|
|
43
|
+
.strictObject({
|
|
44
|
+
left: evidenceSchema,
|
|
45
|
+
right: evidenceSchema,
|
|
46
|
+
left_native_observations: z.array(evidenceSchema).default([]),
|
|
47
|
+
right_native_observations: z.array(evidenceSchema).default([]),
|
|
48
|
+
})
|
|
49
|
+
.superRefine(validateApplicationVersionIdentities);
|
|
39
50
|
const candidateNodesSchema = z.tuple([nodeIdSchema]).rest(nodeIdSchema);
|
|
40
51
|
const exactMatchSchema = z.strictObject({
|
|
41
52
|
status: z.literal("matched"),
|
|
@@ -45,22 +56,22 @@ const exactMatchSchema = z.strictObject({
|
|
|
45
56
|
"exact-module-source-digest",
|
|
46
57
|
]),
|
|
47
58
|
confidence: z.literal("exact"),
|
|
48
|
-
candidate_left_node_ids:
|
|
49
|
-
candidate_right_node_ids:
|
|
59
|
+
candidate_left_node_ids: emptyArraySchema,
|
|
60
|
+
candidate_right_node_ids: emptyArraySchema,
|
|
50
61
|
});
|
|
51
62
|
const sourceMapMatchSchema = z.strictObject({
|
|
52
63
|
status: z.literal("matched"),
|
|
53
64
|
basis: z.literal("source-map-identity"),
|
|
54
65
|
confidence: z.literal("high"),
|
|
55
|
-
candidate_left_node_ids:
|
|
56
|
-
candidate_right_node_ids:
|
|
66
|
+
candidate_left_node_ids: emptyArraySchema,
|
|
67
|
+
candidate_right_node_ids: emptyArraySchema,
|
|
57
68
|
});
|
|
58
69
|
const inferredMatchSchema = z.strictObject({
|
|
59
70
|
status: z.literal("matched"),
|
|
60
71
|
basis: z.enum(["structural-fingerprint", "semantic-key"]),
|
|
61
72
|
confidence: z.literal("medium"),
|
|
62
|
-
candidate_left_node_ids:
|
|
63
|
-
candidate_right_node_ids:
|
|
73
|
+
candidate_left_node_ids: emptyArraySchema,
|
|
74
|
+
candidate_right_node_ids: emptyArraySchema,
|
|
64
75
|
});
|
|
65
76
|
const matchedItemMatchSchema = z.union([
|
|
66
77
|
exactMatchSchema,
|
|
@@ -71,14 +82,14 @@ const unmatchedItemMatchSchema = z.strictObject({
|
|
|
71
82
|
status: z.literal("unmatched"),
|
|
72
83
|
basis: z.literal("none"),
|
|
73
84
|
confidence: z.literal("unknown"),
|
|
74
|
-
candidate_left_node_ids:
|
|
75
|
-
candidate_right_node_ids:
|
|
85
|
+
candidate_left_node_ids: emptyArraySchema,
|
|
86
|
+
candidate_right_node_ids: emptyArraySchema,
|
|
76
87
|
});
|
|
77
88
|
const leftAmbiguousMatchSchema = z.strictObject({
|
|
78
89
|
status: z.literal("ambiguous"),
|
|
79
90
|
basis: z.literal("none"),
|
|
80
91
|
confidence: z.literal("unknown"),
|
|
81
|
-
candidate_left_node_ids:
|
|
92
|
+
candidate_left_node_ids: emptyArraySchema,
|
|
82
93
|
candidate_right_node_ids: candidateNodesSchema,
|
|
83
94
|
});
|
|
84
95
|
const rightAmbiguousMatchSchema = z.strictObject({
|
|
@@ -86,7 +97,7 @@ const rightAmbiguousMatchSchema = z.strictObject({
|
|
|
86
97
|
basis: z.literal("none"),
|
|
87
98
|
confidence: z.literal("unknown"),
|
|
88
99
|
candidate_left_node_ids: candidateNodesSchema,
|
|
89
|
-
candidate_right_node_ids:
|
|
100
|
+
candidate_right_node_ids: emptyArraySchema,
|
|
90
101
|
});
|
|
91
102
|
const comparisonItemContextShape = {
|
|
92
103
|
item_id: prefixedDigestSchema("javc_item"),
|
|
@@ -194,3 +205,7 @@ export const applicationVersionComparisonResultSchema = z
|
|
|
194
205
|
message: "Comparison coverage must match source graph completeness",
|
|
195
206
|
});
|
|
196
207
|
});
|
|
208
|
+
/** Reuse the exact owned change graph while validating the rest of the result. */
|
|
209
|
+
export const ownedApplicationVersionComparisonResultSchema = applicationVersionComparisonResultSchema.safeExtend({
|
|
210
|
+
graph: z.custom(isValidatedImmutableJavaScriptApplicationGraph),
|
|
211
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { absenceClaimable,
|
|
2
|
-
import {
|
|
1
|
+
import { absenceClaimable, canonicalJson } from "../comparisonSemantics.js";
|
|
2
|
+
import { digestCanonicalValue } from "../canonicalDigest.js";
|
|
3
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
3
4
|
/** Classify matched, unmatched, and ambiguous nodes without inventing absence. */
|
|
4
5
|
export const classifyJavaScriptApplicationVersions = (matching, context) => {
|
|
5
6
|
const pairByLeft = new Map(matching.pairs.map(({ left, right }) => [
|
|
@@ -10,7 +11,18 @@ export const classifyJavaScriptApplicationVersions = (matching, context) => {
|
|
|
10
11
|
right.node_id,
|
|
11
12
|
`pair:${left.node_id}:${right.node_id}`,
|
|
12
13
|
]));
|
|
13
|
-
const fullContext = {
|
|
14
|
+
const fullContext = {
|
|
15
|
+
leftGraph: context.leftGraph,
|
|
16
|
+
rightGraph: context.rightGraph,
|
|
17
|
+
leftEvidenceId: context.leftEvidenceId,
|
|
18
|
+
rightEvidenceId: context.rightEvidenceId,
|
|
19
|
+
leftNativeEvidenceByDigest: indexNativeEvidence(context.leftNativeEvidence),
|
|
20
|
+
rightNativeEvidenceByDigest: indexNativeEvidence(context.rightNativeEvidence),
|
|
21
|
+
pairByLeft,
|
|
22
|
+
pairByRight,
|
|
23
|
+
leftRelationships: indexRelationships(context.leftGraph),
|
|
24
|
+
rightRelationships: indexRelationships(context.rightGraph),
|
|
25
|
+
};
|
|
14
26
|
const leftItems = matching.unmatchedLeft.map((node) => {
|
|
15
27
|
const candidates = matching.candidatesForLeft.get(node.node_id) ?? [];
|
|
16
28
|
return unmatchedItem({
|
|
@@ -30,7 +42,7 @@ export const classifyJavaScriptApplicationVersions = (matching, context) => {
|
|
|
30
42
|
...matching.pairs.map((pair) => matchedItem(pair, fullContext)),
|
|
31
43
|
...leftItems,
|
|
32
44
|
...rightItems,
|
|
33
|
-
].sort((left, right) =>
|
|
45
|
+
].sort((left, right) => compareUnicodeCodePoints(left.item_id, right.item_id)),
|
|
34
46
|
};
|
|
35
47
|
};
|
|
36
48
|
const matchedItem = (pair, context) => {
|
|
@@ -201,42 +213,46 @@ const contentIdentity = (node) => {
|
|
|
201
213
|
};
|
|
202
214
|
const locations = (node) => node.observations
|
|
203
215
|
.map(({ evidence }) => evidence.location.available ? evidence.location.value : evidence.location)
|
|
204
|
-
.sort((left, right) =>
|
|
216
|
+
.sort((left, right) => compareUnicodeCodePoints(canonicalJson(left), canonicalJson(right)));
|
|
205
217
|
const properties = (node) => node.observations
|
|
206
218
|
.map(({ label, properties: values, source_map_reference }) => ({
|
|
207
219
|
label,
|
|
208
220
|
properties: values,
|
|
209
221
|
source_map_reference,
|
|
210
222
|
}))
|
|
211
|
-
.sort((left, right) =>
|
|
223
|
+
.sort((left, right) => compareUnicodeCodePoints(canonicalJson(left), canonicalJson(right)));
|
|
224
|
+
const indexRelationships = (graph) => {
|
|
225
|
+
const adjacency = new Map();
|
|
226
|
+
const add = (nodeId, relationship) => {
|
|
227
|
+
const existing = adjacency.get(nodeId);
|
|
228
|
+
if (existing === undefined)
|
|
229
|
+
adjacency.set(nodeId, [relationship]);
|
|
230
|
+
else
|
|
231
|
+
existing.push(relationship);
|
|
232
|
+
};
|
|
233
|
+
for (const edge of graph.edges) {
|
|
234
|
+
add(edge.source_node_id, {
|
|
235
|
+
direction: "out",
|
|
236
|
+
relation: edge.relation,
|
|
237
|
+
neighborId: edge.target_node_id,
|
|
238
|
+
});
|
|
239
|
+
if (edge.target_node_id !== edge.source_node_id)
|
|
240
|
+
add(edge.target_node_id, {
|
|
241
|
+
direction: "in",
|
|
242
|
+
relation: edge.relation,
|
|
243
|
+
neighborId: edge.source_node_id,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
nodeById: new Map(graph.nodes.map((value) => [value.node_id, value])),
|
|
248
|
+
adjacency,
|
|
249
|
+
};
|
|
250
|
+
};
|
|
212
251
|
const relationshipSignature = (node, side, context) => {
|
|
213
|
-
const
|
|
252
|
+
const { nodeById, adjacency } = side === "left" ? context.leftRelationships : context.rightRelationships;
|
|
214
253
|
const paired = side === "left" ? context.pairByLeft : context.pairByRight;
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
if (edge.source_node_id === node.node_id)
|
|
218
|
-
return [
|
|
219
|
-
edgeSignature({
|
|
220
|
-
direction: "out",
|
|
221
|
-
relation: edge.relation,
|
|
222
|
-
neighborId: edge.target_node_id,
|
|
223
|
-
paired,
|
|
224
|
-
nodeById,
|
|
225
|
-
}),
|
|
226
|
-
];
|
|
227
|
-
if (edge.target_node_id === node.node_id)
|
|
228
|
-
return [
|
|
229
|
-
edgeSignature({
|
|
230
|
-
direction: "in",
|
|
231
|
-
relation: edge.relation,
|
|
232
|
-
neighborId: edge.source_node_id,
|
|
233
|
-
paired,
|
|
234
|
-
nodeById,
|
|
235
|
-
}),
|
|
236
|
-
];
|
|
237
|
-
return [];
|
|
238
|
-
});
|
|
239
|
-
return canonicalJson(signatures.sort(compareCodePoints));
|
|
254
|
+
const signatures = (adjacency.get(node.node_id) ?? []).map((relationship) => edgeSignature({ ...relationship, paired, nodeById }));
|
|
255
|
+
return canonicalJson(signatures.sort(compareUnicodeCodePoints));
|
|
240
256
|
};
|
|
241
257
|
const edgeSignature = (context) => {
|
|
242
258
|
const mapped = context.paired.get(context.neighborId);
|
|
@@ -247,19 +263,30 @@ const itemEvidenceLinks = (left, right, context) => [
|
|
|
247
263
|
...new Set([
|
|
248
264
|
context.leftEvidenceId,
|
|
249
265
|
context.rightEvidenceId,
|
|
250
|
-
...nativeLinks(left, context.
|
|
251
|
-
...nativeLinks(right, context.
|
|
266
|
+
...nativeLinks(left, context.leftNativeEvidenceByDigest),
|
|
267
|
+
...nativeLinks(right, context.rightNativeEvidenceByDigest),
|
|
252
268
|
]),
|
|
253
|
-
].sort(
|
|
254
|
-
const nativeLinks = (node,
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
269
|
+
].sort(compareUnicodeCodePoints);
|
|
270
|
+
const nativeLinks = (node, evidenceByDigest) => {
|
|
271
|
+
const identity = node === undefined ? null : contentIdentity(node);
|
|
272
|
+
if (identity === null)
|
|
273
|
+
return [];
|
|
274
|
+
const digest = identity.replace(/^content:/u, "");
|
|
275
|
+
return evidenceByDigest.get(digest) ?? [];
|
|
276
|
+
};
|
|
277
|
+
const indexNativeEvidence = (evidence) => {
|
|
278
|
+
const evidenceByDigest = new Map();
|
|
279
|
+
for (const { evidence_id: id, subject } of evidence) {
|
|
280
|
+
const digest = subject?.digest.sha256;
|
|
281
|
+
if (digest === undefined)
|
|
282
|
+
continue;
|
|
283
|
+
const ids = evidenceByDigest.get(digest);
|
|
284
|
+
if (ids === undefined)
|
|
285
|
+
evidenceByDigest.set(digest, [id]);
|
|
286
|
+
else
|
|
287
|
+
ids.push(id);
|
|
288
|
+
}
|
|
289
|
+
return evidenceByDigest;
|
|
263
290
|
};
|
|
264
291
|
const pairLimitations = (pair, status) => [
|
|
265
292
|
...(pair.basis === "structural-fingerprint"
|
|
@@ -283,7 +310,7 @@ const pairLimitations = (pair, status) => [
|
|
|
283
310
|
];
|
|
284
311
|
const itemWithId = (semantic) => ({
|
|
285
312
|
...semantic,
|
|
286
|
-
item_id: `javc_item_${
|
|
313
|
+
item_id: `javc_item_${digestCanonicalValue(semantic, "Application version item")}`,
|
|
287
314
|
});
|
|
288
315
|
const stringProperty = (node, key) => {
|
|
289
316
|
const values = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { canonicalJson } from "../comparisonSemantics.js";
|
|
2
|
-
import {
|
|
2
|
+
import { compareUnicodeCodePoints, compositeKey, } from "../unicodeCodePointOrder.js";
|
|
3
3
|
const matchTiers = () => [
|
|
4
4
|
{
|
|
5
5
|
match: { basis: "exact-content-digest", confidence: "exact" },
|
|
@@ -40,7 +40,7 @@ export const matchJavaScriptApplicationVersions = (leftNodes, rightNodes) => {
|
|
|
40
40
|
const leftIds = new Set(remainingLeft.map(({ node_id: id }) => id));
|
|
41
41
|
const rightIds = new Set(remainingRight.map(({ node_id: id }) => id));
|
|
42
42
|
return {
|
|
43
|
-
pairs: pairs.sort((a, b) =>
|
|
43
|
+
pairs: pairs.sort((a, b) => compareUnicodeCodePoints(`${a.left.node_id}\0${a.right.node_id}`, `${b.left.node_id}\0${b.right.node_id}`)),
|
|
44
44
|
unmatchedLeft: remainingLeft,
|
|
45
45
|
unmatchedRight: remainingRight,
|
|
46
46
|
candidatesForLeft: filteredCandidates(leftCandidates, rightIds),
|
|
@@ -50,7 +50,7 @@ export const matchJavaScriptApplicationVersions = (leftNodes, rightNodes) => {
|
|
|
50
50
|
const applyTier = (context) => {
|
|
51
51
|
const leftByKey = nodesByKey(context.left.values(), context.tier.key);
|
|
52
52
|
const rightByKey = nodesByKey(context.right.values(), context.tier.key);
|
|
53
|
-
for (const key of [...leftByKey.keys()].sort(
|
|
53
|
+
for (const key of [...leftByKey.keys()].sort(compareUnicodeCodePoints)) {
|
|
54
54
|
const leftGroup = leftByKey.get(key) ?? [];
|
|
55
55
|
const rightGroup = rightByKey.get(key) ?? [];
|
|
56
56
|
if (rightGroup.length === 0)
|
|
@@ -98,7 +98,7 @@ const recordCandidates = (left, right, leftCandidates, rightCandidates) => {
|
|
|
98
98
|
const filteredCandidates = (candidates, retained) => new Map([...candidates.entries()].flatMap(([nodeId, values]) => {
|
|
99
99
|
const filtered = [...values]
|
|
100
100
|
.filter((value) => retained.has(value))
|
|
101
|
-
.sort(
|
|
101
|
+
.sort(compareUnicodeCodePoints);
|
|
102
102
|
return filtered.length === 0 ? [] : [[nodeId, filtered]];
|
|
103
103
|
}));
|
|
104
104
|
const nodeIdentityKey = (node) => `node\0${node.kind}\0${node.node_id}`;
|
|
@@ -153,7 +153,15 @@ const semanticValue = (node, properties) => {
|
|
|
153
153
|
exactString(properties.api_key) ??
|
|
154
154
|
nonEmptyString(properties.api_name));
|
|
155
155
|
if (node.kind === "native-export")
|
|
156
|
-
return (joined(properties.specifier,
|
|
156
|
+
return (joined(properties.specifier, compositeKey([
|
|
157
|
+
stringList(properties.requested_members),
|
|
158
|
+
typeof properties.namespace_access === "boolean"
|
|
159
|
+
? properties.namespace_access
|
|
160
|
+
: null,
|
|
161
|
+
typeof properties.dynamic_member_access === "boolean"
|
|
162
|
+
? properties.dynamic_member_access
|
|
163
|
+
: null,
|
|
164
|
+
])) ?? firstLabel(node));
|
|
157
165
|
if ([
|
|
158
166
|
"electron-main",
|
|
159
167
|
"electron-preload",
|
|
@@ -178,7 +186,7 @@ const uniqueStringProperty = (node, name) => {
|
|
|
178
186
|
};
|
|
179
187
|
const joined = (...values) => {
|
|
180
188
|
const strings = values.map(nonEmptyString);
|
|
181
|
-
return strings.some((value) => value === null) ? null : strings
|
|
189
|
+
return strings.some((value) => value === null) ? null : compositeKey(strings);
|
|
182
190
|
};
|
|
183
191
|
const nonEmptyString = (value) => typeof value === "string" && value !== "" ? value : null;
|
|
184
192
|
/** A literal value such as `ipcMain.handle("")` keeps its exact empty text. */
|
|
@@ -186,6 +194,6 @@ const exactString = (value) => typeof value === "string" ? value : null;
|
|
|
186
194
|
const stringList = (value) => Array.isArray(value)
|
|
187
195
|
? value
|
|
188
196
|
.filter((item) => typeof item === "string")
|
|
189
|
-
.sort(
|
|
197
|
+
.sort(compareUnicodeCodePoints)
|
|
190
198
|
: [];
|
|
191
|
-
const sortedNodes = (nodes) => [...nodes].sort((left, right) =>
|
|
199
|
+
const sortedNodes = (nodes) => [...nodes].sort((left, right) => compareUnicodeCodePoints(left.node_id, right.node_id));
|