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
|
@@ -13,7 +13,8 @@ import { BinarySessionRecords } from "./BinarySessionRecords.js";
|
|
|
13
13
|
import { binarySessionStatus } from "./BinarySessionStatus.js";
|
|
14
14
|
import { resolveSessionOpen, resolveSessionTarget, validateResolvedSessionTarget, } from "./BinarySessionOpen.js";
|
|
15
15
|
import { bindExecutionTarget, commitExecutionProfile, prepareSessionExecution, } from "./BinarySessionExecution.js";
|
|
16
|
-
import {
|
|
16
|
+
import { closeAnalysisClient } from "./AnalysisClientCleanup.js";
|
|
17
|
+
import { analysisErrorWithCleanupFailure } from "../../domain/analysisErrorCleanup.js";
|
|
17
18
|
const OFFICIAL_OPERATIONS = new Set(OFFICIAL_TOOL_CONTRACTS.map(({ name }) => name));
|
|
18
19
|
const ENHANCED_OPERATIONS = new Set(ENHANCED_TOOL_CONTRACTS.map(({ name }) => name));
|
|
19
20
|
/**
|
|
@@ -314,6 +315,22 @@ export class BinarySession extends BinarySessionRecords {
|
|
|
314
315
|
this.#calls.set(call, generation);
|
|
315
316
|
return call.finally(() => this.#calls.delete(call));
|
|
316
317
|
}
|
|
318
|
+
/** Admit one composed request until its result and session bookkeeping settle. */
|
|
319
|
+
withAdmittedAnalysis(operationName, signal, operation) {
|
|
320
|
+
const generation = this.#transitionGeneration;
|
|
321
|
+
const transition = this.#transition;
|
|
322
|
+
const call = (async () => {
|
|
323
|
+
const admission = await this.#waitForTransition(operationName, signal, transition);
|
|
324
|
+
if (!admission.ok)
|
|
325
|
+
return admission;
|
|
326
|
+
return ok(await operation({
|
|
327
|
+
execute: (name, arguments_, options) => this.#execute(name, arguments_, options, Promise.resolve()),
|
|
328
|
+
}));
|
|
329
|
+
})();
|
|
330
|
+
// Register synchronously before a lifecycle transition can snapshot calls.
|
|
331
|
+
this.#calls.set(call, generation);
|
|
332
|
+
return call.finally(() => this.#calls.delete(call));
|
|
333
|
+
}
|
|
317
334
|
async #execute(name, arguments_, options, transition) {
|
|
318
335
|
const transitioned = await this.#waitForTransition(name, options?.signal, transition);
|
|
319
336
|
if (!transitioned.ok)
|
|
@@ -8,7 +8,15 @@ import { SessionProviderRouter } from "./SessionProviderRouter.js";
|
|
|
8
8
|
/** Parse a target, resolve its provider route, and validate snapshot binding. */
|
|
9
9
|
export const resolveSessionOpen = async (input) => {
|
|
10
10
|
const { path, options } = input;
|
|
11
|
-
const parsed = await parseBinaryTarget(path,
|
|
11
|
+
const parsed = await parseBinaryTarget(path, {
|
|
12
|
+
...(options.targetKind === undefined
|
|
13
|
+
? {}
|
|
14
|
+
: { targetKind: options.targetKind }),
|
|
15
|
+
...(options.formatHint === undefined
|
|
16
|
+
? {}
|
|
17
|
+
: { formatHint: options.formatHint }),
|
|
18
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
19
|
+
});
|
|
12
20
|
if (!parsed.ok)
|
|
13
21
|
return parsed;
|
|
14
22
|
return resolveSessionTarget({ ...input, target: parsed.value });
|
|
@@ -50,7 +50,8 @@ export class BinaryLayoutService {
|
|
|
50
50
|
operation: OPERATION,
|
|
51
51
|
parameters: input.data,
|
|
52
52
|
result: value,
|
|
53
|
-
|
|
53
|
+
// The decoded report is the only representation; do not repeat it.
|
|
54
|
+
rawResult: null,
|
|
54
55
|
confidence: "observed",
|
|
55
56
|
limitations: value.limitations,
|
|
56
57
|
locations: [{ kind: "artifact-path", path: value.artifact.path }],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { isAbsolute } from "node:path";
|
|
2
|
+
import { AnalysisCancelledError, AnalysisInputError, AnalysisOutputError, } from "../../domain/analysisErrorCore.js";
|
|
3
|
+
import { createEvidence } from "../../domain/evidence.js";
|
|
4
|
+
import { inspectPeResourcesInputSchema, peResourcesSchema, } from "../../domain/native/peResources.js";
|
|
5
|
+
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
|
|
6
|
+
import { err, ok } from "../../domain/result.js";
|
|
7
|
+
/** Shared caller validation, output parsing and Evidence provenance for CLI/MCP. */
|
|
8
|
+
export class PeResourcesService {
|
|
9
|
+
provider;
|
|
10
|
+
constructor(provider) {
|
|
11
|
+
this.provider = provider;
|
|
12
|
+
}
|
|
13
|
+
async inspect(rawInput, options) {
|
|
14
|
+
const operation = "inspect_pe_resources";
|
|
15
|
+
if (options?.signal?.aborted)
|
|
16
|
+
return err(new AnalysisCancelledError(operation));
|
|
17
|
+
const input = inspectPeResourcesInputSchema.safeParse(rawInput);
|
|
18
|
+
if (!input.success)
|
|
19
|
+
return err(analysisInputErrorFromIssues(operation, input.error.issues, rawInput, {
|
|
20
|
+
cause: input.error,
|
|
21
|
+
}));
|
|
22
|
+
if (!isAbsolute(input.data.path))
|
|
23
|
+
return err(new AnalysisInputError(operation, undefined, [
|
|
24
|
+
{
|
|
25
|
+
path: ["path"],
|
|
26
|
+
reason: "invalid_format",
|
|
27
|
+
message: "Expected an absolute filesystem path on this host.",
|
|
28
|
+
},
|
|
29
|
+
]));
|
|
30
|
+
const result = await this.provider.inspect(input.data, options);
|
|
31
|
+
if (!result.ok)
|
|
32
|
+
return result;
|
|
33
|
+
if (options?.signal?.aborted)
|
|
34
|
+
return err(new AnalysisCancelledError(operation));
|
|
35
|
+
const report = peResourcesSchema.safeParse(result.value);
|
|
36
|
+
if (!report.success ||
|
|
37
|
+
report.data.artifact.path !== input.data.path ||
|
|
38
|
+
!validReport(report.data, input.data.max_entries, input.data.max_file_bytes))
|
|
39
|
+
return err(new AnalysisOutputError(operation, "PE resource provider returned malformed output or changed artifact identity."));
|
|
40
|
+
const value = report.data;
|
|
41
|
+
return ok(createEvidence({
|
|
42
|
+
path: value.artifact.path,
|
|
43
|
+
format: "pe",
|
|
44
|
+
sha256: value.artifact.sha256,
|
|
45
|
+
}, this.provider.identity, {
|
|
46
|
+
operation,
|
|
47
|
+
parameters: input.data,
|
|
48
|
+
result: value,
|
|
49
|
+
confidence: "observed",
|
|
50
|
+
limitations: value.limitations,
|
|
51
|
+
locations: [{ kind: "artifact-path", path: value.artifact.path }],
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Check cross-field invariants before provider output becomes public Evidence. */
|
|
56
|
+
const validReport = (report, maxEntries, maxBytes) => {
|
|
57
|
+
const inside = ({ offset, bytes }) => offset <= report.artifact.bytes - bytes;
|
|
58
|
+
if (report.artifact.bytes > maxBytes ||
|
|
59
|
+
report.coverage.resources !== report.resources.length ||
|
|
60
|
+
report.coverage.examined_entries > maxEntries ||
|
|
61
|
+
report.coverage.examined_entries !==
|
|
62
|
+
report.directories.reduce((sum, item) => sum + item.named_entries + item.id_entries, 0))
|
|
63
|
+
return false;
|
|
64
|
+
if (report.directory === null &&
|
|
65
|
+
(report.directories.length > 0 || report.resources.length > 0))
|
|
66
|
+
return false;
|
|
67
|
+
if (report.directory !== null &&
|
|
68
|
+
(!inside(report.directory.location) ||
|
|
69
|
+
!inside(report.directory.data_directory_location)))
|
|
70
|
+
return false;
|
|
71
|
+
if (!report.directories.every((item) => inside(item.location)))
|
|
72
|
+
return false;
|
|
73
|
+
if (!report.resources.every((item, index) => item.index === index &&
|
|
74
|
+
inside(item.data_entry_location) &&
|
|
75
|
+
inside(item.payload.location) &&
|
|
76
|
+
item.entry_locations.every(inside) &&
|
|
77
|
+
[item.type, item.name, item.language].every((identity) => identity.kind === "id" || inside(identity.location))))
|
|
78
|
+
return false;
|
|
79
|
+
return report.icon_groups.every((group) => {
|
|
80
|
+
const resource = report.resources[group.resource_index];
|
|
81
|
+
if (resource === undefined ||
|
|
82
|
+
resource.type.kind !== "id" ||
|
|
83
|
+
resource.type.id !== 14)
|
|
84
|
+
return false;
|
|
85
|
+
return group.images.every((image) => inside(image.location) &&
|
|
86
|
+
image.location.offset >= resource.payload.location.offset &&
|
|
87
|
+
image.location.offset + image.location.bytes <=
|
|
88
|
+
resource.payload.location.offset + resource.payload.location.bytes &&
|
|
89
|
+
image.candidate_resource_indices.every((index) => {
|
|
90
|
+
const icon = report.resources[index];
|
|
91
|
+
return (icon !== undefined &&
|
|
92
|
+
icon.type.kind === "id" &&
|
|
93
|
+
icon.type.id === 3 &&
|
|
94
|
+
icon.name.kind === "id" &&
|
|
95
|
+
icon.name.id === image.resource_id);
|
|
96
|
+
}) &&
|
|
97
|
+
(image.same_language_resource_index === null
|
|
98
|
+
? image.size_matches === null
|
|
99
|
+
: image.candidate_resource_indices.includes(image.same_language_resource_index) &&
|
|
100
|
+
sameIdentity(report.resources[image.same_language_resource_index]?.language, resource.language) &&
|
|
101
|
+
image.size_matches ===
|
|
102
|
+
(report.resources[image.same_language_resource_index]?.payload
|
|
103
|
+
.location.bytes ===
|
|
104
|
+
image.declared_bytes)));
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const sameIdentity = (left, right) => left?.kind === "id" && right.kind === "id"
|
|
108
|
+
? left.id === right.id
|
|
109
|
+
: left?.kind === "name" &&
|
|
110
|
+
right.kind === "name" &&
|
|
111
|
+
left.utf16le_hex === right.utf16le_hex;
|
|
@@ -53,7 +53,8 @@ export class RecordedCrashService {
|
|
|
53
53
|
operation: OPERATION,
|
|
54
54
|
parameters: input.data,
|
|
55
55
|
result: value,
|
|
56
|
-
|
|
56
|
+
// The decoded report is the only representation; do not repeat it.
|
|
57
|
+
rawResult: null,
|
|
57
58
|
confidence: value.debugger.status === "available" ? "derived" : "observed",
|
|
58
59
|
limitations: value.limitations,
|
|
59
60
|
locations: [{ kind: "artifact-path", path: value.artifact.path }],
|
|
@@ -15,6 +15,9 @@ export class EvmInterfaceService {
|
|
|
15
15
|
constructor(provider) {
|
|
16
16
|
this.provider = provider;
|
|
17
17
|
}
|
|
18
|
+
close() {
|
|
19
|
+
return this.provider.close?.() ?? Promise.resolve();
|
|
20
|
+
}
|
|
18
21
|
/** Preserve selected byte identity while clearly labeling recovered ABI candidates as inferences. */
|
|
19
22
|
async inspect(rawInput, options) {
|
|
20
23
|
if (options?.signal?.aborted)
|
|
@@ -9,6 +9,9 @@ export class FirmwareAnalysisService {
|
|
|
9
9
|
constructor(provider) {
|
|
10
10
|
this.provider = provider;
|
|
11
11
|
}
|
|
12
|
+
close() {
|
|
13
|
+
return this.provider.close?.() ?? Promise.resolve();
|
|
14
|
+
}
|
|
12
15
|
/** Execute an explicit inspection or extraction and preserve its producing identity. */
|
|
13
16
|
async execute(operation, input, options) {
|
|
14
17
|
if (options?.signal?.aborted === true)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AnalysisInputError } from "../../domain/analysisErrorCore.js";
|
|
2
|
+
import { err, ok } from "../../domain/result.js";
|
|
3
|
+
import { summarizeEvidenceBundle, } from "../../domain/evidenceRecordSummary.js";
|
|
4
|
+
/** Select complete bundle delivery or discovery metadata without analysis payloads. */
|
|
5
|
+
export const inspectEvidenceBundle = (bundle, options) => {
|
|
6
|
+
if (options.detail === "complete" && options.filters !== undefined)
|
|
7
|
+
return err(new AnalysisInputError("get_evidence_bundle", undefined, [
|
|
8
|
+
{
|
|
9
|
+
path: ["filters"],
|
|
10
|
+
reason: "invalid_value",
|
|
11
|
+
message: "Record filters require detail: summary; complete returns the canonical bundle.",
|
|
12
|
+
expected: "detail: summary",
|
|
13
|
+
},
|
|
14
|
+
]));
|
|
15
|
+
return ok(options.detail === "summary"
|
|
16
|
+
? summarizeEvidenceBundle(bundle, options.filters)
|
|
17
|
+
: bundle);
|
|
18
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { digestCanonicalValue } from "../../domain/canonicalDigest.js";
|
|
2
2
|
import { createEvidence } from "../../domain/evidence.js";
|
|
3
3
|
import { jsonObjectSchema, jsonValueSchema } from "../../domain/jsonValue.js";
|
|
4
4
|
/** Commit the selected Electron experiment and its observed result. */
|
|
@@ -24,6 +24,6 @@ const parameters = (input) => {
|
|
|
24
24
|
const scenario = jsonObjectSchema.parse(input);
|
|
25
25
|
return {
|
|
26
26
|
...scenario,
|
|
27
|
-
scenario_sha256:
|
|
27
|
+
scenario_sha256: digestCanonicalValue(scenario, "Electron scenario"),
|
|
28
28
|
};
|
|
29
29
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { compareUnicodeCodePoints } from "../../domain/unicodeCodePointOrder.js";
|
|
2
2
|
import { resolveArtifactPathByContext } from "./JavaScriptArtifactPathResolution.js";
|
|
3
3
|
/** Flatten all per-file IPC facts into deterministic application records. */
|
|
4
4
|
export const collectElectronIpcRecords = (analysis) => analysis.files
|
|
@@ -7,7 +7,7 @@ export const collectElectronIpcRecords = (analysis) => analysis.files
|
|
|
7
7
|
file,
|
|
8
8
|
finding,
|
|
9
9
|
})))
|
|
10
|
-
.sort((left, right) =>
|
|
10
|
+
.sort((left, right) => compareUnicodeCodePoints(left.key, right.key));
|
|
11
11
|
/** Match only exact literal channels and retain ambiguous matches separately. */
|
|
12
12
|
export const classifyElectronIpcPairings = (records) => {
|
|
13
13
|
const handlers = records.filter(isMainHandler);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { sha256Text } from "../../domain/javascript/javascriptStaticAnalysisHelpers.js";
|
|
2
|
+
import { sourceNodeFor, } from "./JavaScriptArtifactGraphContext.js";
|
|
2
3
|
import { astObservationEvidence, staticInferenceEvidence, } from "./JavaScriptArtifactGraphEvidence.js";
|
|
3
4
|
/** Resolve the file or recovered bundle module that owns one finding. */
|
|
4
|
-
export const electronFindingSourceNode = (context, file, moduleKey) => moduleKey === null
|
|
5
|
+
export const electronFindingSourceNode = (context, file, moduleKey, runtime) => moduleKey === null
|
|
5
6
|
? (context.assetNodes.get(file.path) ?? context.fileNodes.get(file.path))
|
|
6
|
-
: context
|
|
7
|
+
: sourceNodeFor(context, file.path, moduleKey, runtime);
|
|
7
8
|
/** Observation-scoped identity shared safely across different artifact files. */
|
|
8
9
|
export const electronObservationIdentity = (context, scope, key) => ({
|
|
9
10
|
strategy: "observation-fingerprint",
|
|
@@ -21,7 +21,7 @@ const addIpcRecord = (state, record) => {
|
|
|
21
21
|
const coverage = coverageFor(context, record.file);
|
|
22
22
|
if (coverage === undefined)
|
|
23
23
|
return;
|
|
24
|
-
const source = electronFindingSourceNode(context, record.file, record.finding.module_key);
|
|
24
|
+
const source = electronFindingSourceNode(context, record.file, record.finding.module_key, record.finding.module_runtime);
|
|
25
25
|
if (source === undefined)
|
|
26
26
|
return;
|
|
27
27
|
state.sources.set(record.key, source);
|
|
@@ -181,7 +181,7 @@ const addValidationObservations = (state) => {
|
|
|
181
181
|
for (const validation of javascript.electron.sender_validations) {
|
|
182
182
|
const handlerRecord = containingHandler(state.records, file, validation);
|
|
183
183
|
const target = handlerRecord === undefined
|
|
184
|
-
? electronFindingSourceNode(state.context, file, validation.module_key)
|
|
184
|
+
? electronFindingSourceNode(state.context, file, validation.module_key, validation.module_runtime)
|
|
185
185
|
: state.handlers.get(handlerRecord.key);
|
|
186
186
|
if (target !== undefined)
|
|
187
187
|
addValidationObservation({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { javascriptAnalysisCoverage, resolveArtifactPath, } from "./JavaScriptArtifactGraphContext.js";
|
|
2
2
|
import { astObservationEvidence } from "./JavaScriptArtifactGraphEvidence.js";
|
|
3
|
+
import { compositeKey } from "../../domain/unicodeCodePointOrder.js";
|
|
4
|
+
import { javascriptDisplayText } from "../../domain/javascript/javascriptAstValues.js";
|
|
3
5
|
import { addElectronInferenceEdge, electronFindingSourceNode, electronObservationIdentity, electronRangeKey, } from "./ElectronBoundaryGraphContext.js";
|
|
4
6
|
/** Project JavaScript-requested native addon binding and re-export surfaces. */
|
|
5
7
|
export const addElectronNativeBoundaries = (context) => {
|
|
@@ -14,21 +16,32 @@ export const addElectronNativeBoundaries = (context) => {
|
|
|
14
16
|
};
|
|
15
17
|
const addNativeBinding = (input) => {
|
|
16
18
|
const { context, file, value, coverage } = input;
|
|
17
|
-
const source = electronFindingSourceNode(context, file, value.module_key);
|
|
19
|
+
const source = electronFindingSourceNode(context, file, value.module_key, value.module_runtime);
|
|
18
20
|
if (source === undefined)
|
|
19
21
|
return;
|
|
20
22
|
const resolved = resolveArtifactPath(value.specifier, file.path, context.filesByPath, value.module_kind);
|
|
21
23
|
const addon = resolved === null ? undefined : context.fileNodes.get(resolved);
|
|
22
24
|
const binding = context.accumulator.addNode({
|
|
23
25
|
kind: "native-export",
|
|
24
|
-
identity: electronObservationIdentity(context, "javascript-requested-native-export",
|
|
26
|
+
identity: electronObservationIdentity(context, "javascript-requested-native-export", compositeKey([
|
|
27
|
+
file.path,
|
|
28
|
+
value.specifier,
|
|
29
|
+
value.binding_kind,
|
|
30
|
+
value.members,
|
|
31
|
+
value.namespace_access ?? null,
|
|
32
|
+
value.dynamic_member_access ?? null,
|
|
33
|
+
electronRangeKey(value.location),
|
|
34
|
+
])),
|
|
25
35
|
observations: [
|
|
26
36
|
{
|
|
27
|
-
label: value.members.join(", ")
|
|
37
|
+
label: value.members.map(javascriptDisplayText).join(", ") ||
|
|
38
|
+
value.specifier,
|
|
28
39
|
properties: {
|
|
29
40
|
specifier: value.specifier,
|
|
30
41
|
binding_kind: value.binding_kind,
|
|
31
42
|
requested_members: value.members,
|
|
43
|
+
namespace_access: value.namespace_access ?? null,
|
|
44
|
+
dynamic_member_access: value.dynamic_member_access ?? null,
|
|
32
45
|
resolved_path: resolved,
|
|
33
46
|
native_export_verification: "not-performed",
|
|
34
47
|
},
|
|
@@ -57,6 +70,8 @@ const addNativeBinding = (input) => {
|
|
|
57
70
|
specifier: value.specifier,
|
|
58
71
|
binding_kind: value.binding_kind,
|
|
59
72
|
requested_members: value.members,
|
|
73
|
+
namespace_access: value.namespace_access ?? null,
|
|
74
|
+
dynamic_member_access: value.dynamic_member_access ?? null,
|
|
60
75
|
},
|
|
61
76
|
limitations: [
|
|
62
77
|
"Requested JavaScript members are not verified native exports.",
|
|
@@ -75,6 +90,8 @@ const addNativeBinding = (input) => {
|
|
|
75
90
|
properties: {
|
|
76
91
|
resolved_path: resolved,
|
|
77
92
|
requested_members: value.members,
|
|
93
|
+
namespace_access: value.namespace_access ?? null,
|
|
94
|
+
dynamic_member_access: value.dynamic_member_access ?? null,
|
|
78
95
|
verified: false,
|
|
79
96
|
},
|
|
80
97
|
confidence: "medium",
|
|
@@ -10,17 +10,17 @@ export const addElectronWindowBoundaries = (context) => {
|
|
|
10
10
|
continue;
|
|
11
11
|
const coverage = javascriptAnalysisCoverage(javascript);
|
|
12
12
|
for (const value of javascript.electron.browser_windows) {
|
|
13
|
-
const source = electronFindingSourceNode(context, file, value.module_key);
|
|
13
|
+
const source = electronFindingSourceNode(context, file, value.module_key, value.module_runtime);
|
|
14
14
|
if (source !== undefined)
|
|
15
15
|
addBrowserWindow({ context, file, source, value, coverage });
|
|
16
16
|
}
|
|
17
17
|
for (const value of javascript.electron.context_bridge_apis) {
|
|
18
|
-
const source = electronFindingSourceNode(context, file, value.module_key);
|
|
18
|
+
const source = electronFindingSourceNode(context, file, value.module_key, value.module_runtime);
|
|
19
19
|
if (source !== undefined)
|
|
20
20
|
addContextBridge({ context, file, source, value, coverage });
|
|
21
21
|
}
|
|
22
22
|
for (const value of javascript.electron.utility_processes) {
|
|
23
|
-
const source = electronFindingSourceNode(context, file, value.module_key);
|
|
23
|
+
const source = electronFindingSourceNode(context, file, value.module_key, value.module_runtime);
|
|
24
24
|
if (source !== undefined)
|
|
25
25
|
addUtilityProcess({ context, file, source, value, coverage });
|
|
26
26
|
}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { JAVASCRIPT_APPLICATION_PROVIDER, JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER, MANAGED_WORKFLOW_PROVIDER, } from "../InvestigationProviders.js";
|
|
2
2
|
import { isImmutableEvidence, parseEvidence, } from "../../domain/evidence.js";
|
|
3
|
+
import { AnalysisInputError, } from "../../domain/analysisErrorCore.js";
|
|
4
|
+
import { projectInputIssues } from "../../domain/inputIssueProjection.js";
|
|
5
|
+
import { err, ok } from "../../domain/result.js";
|
|
6
|
+
import { z } from "zod";
|
|
3
7
|
import { analyzeJavaScriptApplicationInputSchema, javascriptApplicationAnalysisResultSchema, } from "../../domain/javascript/javascriptApplicationAnalysis.js";
|
|
4
8
|
import { javascriptRuntimeReconciliationResultSchema } from "../../domain/javascript/javascriptRuntimeReconciliationSchemas.js";
|
|
5
9
|
import { managedApplicationGraphResultSchema } from "../../domain/managed/managedApplicationGraph.js";
|
|
10
|
+
/** Convert typed parser issues into this workflow's caller-facing input error. */
|
|
11
|
+
export const applicationGraphEvidenceInputError = (operation, failure) => new AnalysisInputError(operation, undefined, failure.issues);
|
|
12
|
+
class InvalidApplicationGraphEvidence extends Error {
|
|
13
|
+
issues;
|
|
14
|
+
constructor(issues) {
|
|
15
|
+
super("Application graph Evidence failed input validation");
|
|
16
|
+
this.issues = issues;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
6
19
|
const ownedApplicationSources = new WeakMap();
|
|
7
20
|
/** Retain the producer-validated meaning of its exact immutable result snapshot. */
|
|
8
21
|
export const rememberOwnedApplicationGraphEvidence = (evidence, result) => {
|
|
@@ -11,44 +24,44 @@ export const rememberOwnedApplicationGraphEvidence = (evidence, result) => {
|
|
|
11
24
|
evidence.operation !== "analyze_javascript_application" ||
|
|
12
25
|
!providerMatches(evidence, JAVASCRIPT_APPLICATION_PROVIDER))
|
|
13
26
|
throw new TypeError("Owned application Evidence must bind its exact validated immutable result");
|
|
14
|
-
ownedApplicationSources.set(evidence, Object.freeze(staticApplicationSourceForResult(evidence, result)));
|
|
27
|
+
ownedApplicationSources.set(evidence, Object.freeze(staticApplicationSourceForResult(evidence, result, [])));
|
|
15
28
|
return evidence;
|
|
16
29
|
};
|
|
17
30
|
/** Parse and authenticate one REA-produced JavaScript Application Graph Evidence. */
|
|
18
|
-
export const parseApplicationGraphEvidence = (input) => {
|
|
19
|
-
const evidence =
|
|
31
|
+
export const parseApplicationGraphEvidence = (input, path = []) => captureInputValidation(() => {
|
|
32
|
+
const evidence = parseEvidenceInput(input, path);
|
|
20
33
|
const owned = ownedApplicationSources.get(evidence);
|
|
21
34
|
if (owned !== undefined)
|
|
22
35
|
return owned;
|
|
23
|
-
if (evidence.operation === "analyze_javascript_application"
|
|
24
|
-
evidence
|
|
25
|
-
|
|
26
|
-
return staticApplicationSource(evidence);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
if (evidence.operation === "analyze_javascript_application") {
|
|
37
|
+
requirePredicate(evidence, "rea.javascript-application-analysis", path);
|
|
38
|
+
requireProvider(evidence, JAVASCRIPT_APPLICATION_PROVIDER, path);
|
|
39
|
+
return staticApplicationSource(evidence, path);
|
|
40
|
+
}
|
|
41
|
+
if (evidence.operation === "reconcile_javascript_runtime") {
|
|
42
|
+
requirePredicate(evidence, "rea.javascript-runtime-reconciliation", path);
|
|
43
|
+
requireProvider(evidence, JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER, path);
|
|
44
|
+
return staticRuntimeSource(evidence, path);
|
|
45
|
+
}
|
|
46
|
+
if (evidence.operation === "project_managed_application_graph") {
|
|
47
|
+
requirePredicate(evidence, "rea.managed-application-graph", path);
|
|
48
|
+
requireProvider(evidence, MANAGED_WORKFLOW_PROVIDER, path);
|
|
49
|
+
return managedApplicationSource(evidence, path);
|
|
50
|
+
}
|
|
51
|
+
throw invalidEvidence(path, "operation", "Expected authenticated JavaScript analysis, runtime reconciliation, or managed application graph Evidence.");
|
|
52
|
+
});
|
|
53
|
+
const staticApplicationSource = (evidence, path) => {
|
|
54
|
+
const result = parseCallerValue((input) => javascriptApplicationAnalysisResultSchema.parse(input), evidence.normalized_result, [...path, "normalized_result"]);
|
|
55
|
+
return staticApplicationSourceForResult(evidence, result, path);
|
|
36
56
|
};
|
|
37
|
-
const
|
|
38
|
-
const result = javascriptApplicationAnalysisResultSchema.parse(evidence.normalized_result);
|
|
39
|
-
return staticApplicationSourceForResult(evidence, result);
|
|
40
|
-
};
|
|
41
|
-
const staticApplicationSourceForResult = (evidence, result) => {
|
|
57
|
+
const staticApplicationSourceForResult = (evidence, result, path) => {
|
|
42
58
|
if (evidence.authority !== "shipped-artifact" ||
|
|
43
59
|
evidence.confidence !== "derived")
|
|
44
|
-
throw
|
|
60
|
+
throw invalidEvidence(path, "authority", "JavaScript application Evidence must use shipped-artifact authority and derived confidence.");
|
|
45
61
|
if (evidence.predicate_type !== "rea.javascript-application-analysis")
|
|
46
|
-
throw
|
|
47
|
-
analyzeJavaScriptApplicationInputSchema.parse({
|
|
48
|
-
|
|
49
|
-
...evidence.parameters,
|
|
50
|
-
});
|
|
51
|
-
assertApplicationSubject(evidence, result);
|
|
62
|
+
throw invalidEvidence(path, "predicate_type", "JavaScript application Evidence predicate does not match its result shape.");
|
|
63
|
+
parseCallerValue((input) => analyzeJavaScriptApplicationInputSchema.parse(input), { input_path: result.input_path, ...evidence.parameters }, [...path, "parameters"]);
|
|
64
|
+
assertApplicationSubject(evidence, result, path);
|
|
52
65
|
return {
|
|
53
66
|
evidence,
|
|
54
67
|
graph: result.graph,
|
|
@@ -57,16 +70,17 @@ const staticApplicationSourceForResult = (evidence, result) => {
|
|
|
57
70
|
semanticGraph: result.semantic_graph,
|
|
58
71
|
};
|
|
59
72
|
};
|
|
60
|
-
const staticRuntimeSource = (evidence) => {
|
|
73
|
+
const staticRuntimeSource = (evidence, path) => {
|
|
61
74
|
if (evidence.authority !== "analyst-inference" ||
|
|
62
75
|
evidence.confidence !== "inferred")
|
|
63
|
-
throw
|
|
64
|
-
const result = javascriptRuntimeReconciliationResultSchema.parse(evidence.normalized_result);
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
throw invalidEvidence(path, "authority", "Runtime reconciliation Evidence must use analyst-inference authority and inferred confidence.");
|
|
77
|
+
const result = parseCallerValue((input) => javascriptRuntimeReconciliationResultSchema.parse(input), evidence.normalized_result, [...path, "normalized_result"]);
|
|
78
|
+
const unmatchedLink = result.evidence_links.find((evidenceId) => !evidence.evidence_links.includes(evidenceId));
|
|
79
|
+
if (unmatchedLink !== undefined)
|
|
80
|
+
throw invalidEvidence([...path, "normalized_result"], "evidence_links", `Runtime reconciliation result references Evidence ${unmatchedLink} outside its envelope.`);
|
|
67
81
|
const applicationLayer = result.static_layers.find(({ role }) => role === "application");
|
|
68
82
|
if (applicationLayer === undefined)
|
|
69
|
-
throw
|
|
83
|
+
throw invalidEvidence([...path, "normalized_result"], "static_layers", "Runtime reconciliation Evidence must include its application layer.");
|
|
70
84
|
return {
|
|
71
85
|
evidence,
|
|
72
86
|
graph: result.graph,
|
|
@@ -75,13 +89,14 @@ const staticRuntimeSource = (evidence) => {
|
|
|
75
89
|
semanticGraph: null,
|
|
76
90
|
};
|
|
77
91
|
};
|
|
78
|
-
const managedApplicationSource = (evidence) => {
|
|
92
|
+
const managedApplicationSource = (evidence, path) => {
|
|
79
93
|
if (evidence.authority !== "analyst-inference" ||
|
|
80
94
|
evidence.confidence !== "inferred")
|
|
81
|
-
throw
|
|
82
|
-
const result = managedApplicationGraphResultSchema.parse(evidence.normalized_result);
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
throw invalidEvidence(path, "authority", "Managed application graph Evidence must use analyst-inference authority and inferred confidence.");
|
|
96
|
+
const result = parseCallerValue((input) => managedApplicationGraphResultSchema.parse(input), evidence.normalized_result, [...path, "normalized_result"]);
|
|
97
|
+
const unmatchedLink = result.evidence_links.find((evidenceId) => !evidence.evidence_links.includes(evidenceId));
|
|
98
|
+
if (unmatchedLink !== undefined)
|
|
99
|
+
throw invalidEvidence([...path, "normalized_result"], "evidence_links", `Managed application graph result references Evidence ${unmatchedLink} outside its envelope.`);
|
|
85
100
|
return {
|
|
86
101
|
evidence,
|
|
87
102
|
graph: result.graph,
|
|
@@ -90,23 +105,69 @@ const managedApplicationSource = (evidence) => {
|
|
|
90
105
|
semanticGraph: null,
|
|
91
106
|
};
|
|
92
107
|
};
|
|
93
|
-
const assertApplicationSubject = (evidence, result) => {
|
|
108
|
+
const assertApplicationSubject = (evidence, result, path) => {
|
|
94
109
|
if (evidence.subject === null ||
|
|
95
110
|
evidence.subject.digest.sha256 !== result.root_artifact_sha256 ||
|
|
96
111
|
evidence.subject.format !== result.format ||
|
|
97
112
|
evidence.subject.local_path !== result.input_path)
|
|
98
|
-
throw
|
|
113
|
+
throw invalidEvidence(path, "subject", "JavaScript application Evidence subject must match the analyzed artifact identity and input path.");
|
|
99
114
|
};
|
|
100
115
|
const providerMatches = (evidence, provider) => evidence.provider.id === provider.id &&
|
|
101
116
|
evidence.provider.name === provider.name &&
|
|
102
117
|
evidence.provider.version === provider.version;
|
|
118
|
+
const requirePredicate = (evidence, expected, path) => {
|
|
119
|
+
if (evidence.predicate_type !== expected)
|
|
120
|
+
throw invalidEvidence(path, "predicate_type", `Expected predicate ${expected} for operation ${evidence.operation}.`);
|
|
121
|
+
};
|
|
122
|
+
const requireProvider = (evidence, expected, path) => {
|
|
123
|
+
if (!providerMatches(evidence, expected))
|
|
124
|
+
throw invalidEvidence(path, "provider", `Expected provider ${expected.id} v${expected.version} for operation ${evidence.operation}.`);
|
|
125
|
+
};
|
|
103
126
|
/** Parse unique, artifact-bound Evidence that may extend a native handoff. */
|
|
104
|
-
export const parseNativeApplicationEvidence = (inputs) => {
|
|
105
|
-
const parsed = inputs.map((input) =>
|
|
106
|
-
|
|
107
|
-
|
|
127
|
+
export const parseNativeApplicationEvidence = (inputs, path = []) => captureInputValidation(() => {
|
|
128
|
+
const parsed = inputs.map((input, index) => parseEvidenceInput(input, [...path, index]));
|
|
129
|
+
const withoutSubject = parsed.findIndex(({ subject }) => subject === null);
|
|
130
|
+
if (withoutSubject !== -1)
|
|
131
|
+
throw invalidEvidence([...path, withoutSubject], "subject", "Native handoff Evidence requires an artifact subject.");
|
|
108
132
|
const ids = parsed.map(({ evidence_id: id }) => id);
|
|
109
133
|
if (new Set(ids).size !== ids.length)
|
|
110
|
-
throw
|
|
134
|
+
throw invalidEvidence(path, "evidence_id", "Native handoff Evidence must be unique.");
|
|
111
135
|
return parsed;
|
|
136
|
+
});
|
|
137
|
+
const captureInputValidation = (operation) => {
|
|
138
|
+
try {
|
|
139
|
+
return ok(operation());
|
|
140
|
+
}
|
|
141
|
+
catch (cause) {
|
|
142
|
+
if (cause instanceof InvalidApplicationGraphEvidence)
|
|
143
|
+
return err({ issues: cause.issues });
|
|
144
|
+
throw cause;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const parseEvidenceInput = (input, path) => {
|
|
148
|
+
try {
|
|
149
|
+
return parseEvidence(input);
|
|
150
|
+
}
|
|
151
|
+
catch (cause) {
|
|
152
|
+
if (cause instanceof z.ZodError)
|
|
153
|
+
throw zodInputFailure(cause, input, path);
|
|
154
|
+
throw cause;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const parseCallerValue = (parse, input, path) => {
|
|
158
|
+
try {
|
|
159
|
+
return parse(input);
|
|
160
|
+
}
|
|
161
|
+
catch (cause) {
|
|
162
|
+
if (cause instanceof z.ZodError)
|
|
163
|
+
throw zodInputFailure(cause, input, path);
|
|
164
|
+
throw cause;
|
|
165
|
+
}
|
|
112
166
|
};
|
|
167
|
+
const zodInputFailure = (cause, input, path) => new InvalidApplicationGraphEvidence(projectInputIssues(cause.issues, input).map((issue) => ({
|
|
168
|
+
...issue,
|
|
169
|
+
path: [...path, ...issue.path],
|
|
170
|
+
})));
|
|
171
|
+
const invalidEvidence = (path, field, message) => new InvalidApplicationGraphEvidence([
|
|
172
|
+
{ path: [...path, field], reason: "invalid_value", message },
|
|
173
|
+
]);
|