rea-agents 6.3.0 → 6.5.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/DISCLAIMER.md +136 -0
- package/README.md +72 -18
- package/THIRD_PARTY_NOTICES.md +134 -0
- package/bridge/android/ReaJadxBridge.java +123 -11
- package/bridge/cutter/rea_bridge.py +816 -0
- package/bridge/ghidra/ReaGhidraAnalysisOptions.java +38 -0
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +1729 -283
- package/bridge/ghidra/ReaGhidraBundleActivator.java +14 -0
- package/bridge/ghidra/ReaGhidraMipsSoftFloat.java +176 -0
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/bridge/ghidra/ReaGhidraPrepareRaw.java +49 -0
- package/bridge/hopper_bridge.py +103 -69
- package/bridge/mitmproxy/capture.py +189 -13
- package/bridge/native/rea_lldb_tracer.py +40 -6
- package/bridge/process/ProcessRunTokenReader.swift +76 -34
- package/bridge/pwntools/layout_impl.py +5 -0
- package/bridge/pwntools/recorded_crash_impl.py +31 -10
- package/dist/adb/AdbConfiguration.js +100 -0
- package/dist/adb/AdbDeviceOutput.js +208 -0
- package/dist/adb/AdbDirectoryListing.js +80 -0
- package/dist/adb/AdbHostFileName.js +34 -0
- package/dist/adb/AdbProvider.js +1433 -0
- package/dist/adb/AdbShellOutput.js +307 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxAnalysis.js +32 -7
- package/dist/android/JadxConfiguration.js +163 -53
- package/dist/android/JadxDoctor.js +115 -0
- package/dist/android/JadxMcpTransport.js +5 -3
- package/dist/android/JadxProtocol.js +14 -0
- package/dist/android/JadxProvider.js +63 -25
- package/dist/android/JadxRelease.js +12 -1
- package/dist/android/JadxWorkspaceRoot.js +157 -0
- package/dist/apktool/ApktoolConfiguration.js +227 -0
- package/dist/apktool/ApktoolDecodeOutput.js +142 -0
- package/dist/apktool/ApktoolProvider.js +543 -0
- package/dist/application/AnalysisContextQueries.js +5 -8
- package/dist/application/AnalysisProvider.js +24 -14
- package/dist/application/AppBundleExecutable.js +30 -25
- package/dist/application/BinaryTargetResolver.js +210 -33
- package/dist/application/BrowserEvidence.js +1 -1
- package/dist/application/BrowserObservationService.js +13 -2
- package/dist/application/BrowserScenarioCaptureService.js +0 -1
- package/dist/application/CallPathTracing.js +52 -13
- package/dist/application/CapabilityInventory.js +179 -29
- package/dist/application/ClaudeDesktopConfigLocation.js +152 -0
- package/dist/application/ClientConfigurationDocument.js +154 -7
- package/dist/application/ClientConfigurationFiles.js +128 -0
- package/dist/application/ClientRegistrationEnvironment.js +41 -0
- package/dist/application/ClientRegistrationIdentity.js +94 -29
- package/dist/application/ClientRegistrationStatus.js +223 -67
- package/dist/application/DirectAnalysis.js +86 -31
- package/dist/application/DirectAnalysisCleanup.js +1 -1
- package/dist/application/DirectAnalysisStatus.js +14 -2
- package/dist/application/Doctor.js +117 -34
- package/dist/application/DoctorDiagnostics.js +34 -12
- package/dist/application/DoctorProviderIds.js +2 -0
- package/dist/application/DoctorScope.js +11 -2
- package/dist/application/DshCordisPatch.js +355 -0
- package/dist/application/DshCordisYaml.js +155 -0
- package/dist/application/EnhancedLiteralTracing.js +30 -16
- package/dist/application/EnhancedToolTypes.js +0 -1
- package/dist/application/EnhancedTools.js +164 -54
- package/dist/application/EvidenceBundleCommands.js +36 -19
- package/dist/application/EvidenceBundleFiles.js +29 -7
- package/dist/application/FunctionAnalysisEvidence.js +3 -0
- package/dist/application/GeminiClientSettings.js +151 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HermesConfigurationYaml.js +272 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InventoryProjectionEvidence.js +0 -1
- package/dist/application/InvestigationProviders.js +19 -3
- package/dist/application/JsonFiles.js +114 -23
- package/dist/application/JsonInputFile.js +410 -0
- package/dist/application/LinuxHopper.js +130 -60
- package/dist/application/MacHopper.js +177 -150
- package/dist/application/MacHopperPaths.js +40 -0
- package/dist/application/MipsElfMetadata.js +201 -0
- package/dist/application/MipsElfSharedLoad.js +164 -0
- package/dist/application/MipsGnuAttributes.js +90 -0
- package/dist/application/MsixPackageStorage.js +133 -0
- package/dist/application/ProgressReporter.js +1 -1
- package/dist/application/ProviderOperationExecution.js +39 -0
- package/dist/application/ReconstructionCoverageService.js +0 -1
- package/dist/application/ReconstructionObligationCandidates.js +12 -5
- package/dist/application/ReconstructionObligationLedgerDiagnostics.js +2 -2
- package/dist/application/ReconstructionObligationLedgerEvaluation.js +15 -33
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -72
- package/dist/application/ReconstructionObligationLedgerService.js +3 -1
- package/dist/application/ReconstructionObligationOriginalCases.js +2 -1
- package/dist/application/ReferenceSourceImport.js +94 -31
- package/dist/application/ReferenceSourceImportEntries.js +40 -30
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -23
- package/dist/application/ReferenceSourceVcsAdapter.js +163 -31
- package/dist/application/RegularFileRead.js +121 -7
- package/dist/application/Setup.js +88 -14
- package/dist/application/SetupClientConfiguration.js +307 -38
- package/dist/application/SetupClients.js +12 -6
- package/dist/application/SetupHost.js +158 -38
- package/dist/application/SetupInstallFailure.js +42 -2
- package/dist/application/SetupPlan.js +83 -57
- package/dist/application/SetupRecoveryBackup.js +66 -0
- package/dist/application/SetupRegistrationEnvironment.js +2 -1
- package/dist/application/SetupSkill.js +354 -88
- package/dist/application/SupportedClients.js +429 -70
- package/dist/application/TypeScriptEmittedSourceCandidates.js +26 -0
- package/dist/application/Uninstall.js +412 -73
- package/dist/application/UninstallFailure.js +14 -0
- package/dist/application/Update.js +54 -25
- package/dist/application/UpdateFailure.js +17 -0
- package/dist/application/UpdateMaintenance.js +25 -47
- package/dist/application/UpdateRuntime.js +141 -27
- package/dist/application/Utf8JsonInput.js +7 -0
- package/dist/application/WebModuleTraceService.js +7 -0
- package/dist/application/WebNetworkCaptureService.js +16 -7
- package/dist/application/WebScriptExportService.js +131 -65
- package/dist/application/WebSourceLocationService.js +22 -3
- package/dist/application/WindowsCapabilities.js +18 -15
- package/dist/application/WorkflowEvidence.js +24 -1
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +122 -6
- package/dist/application/android/AndroidPackageInspection.js +25 -0
- package/dist/application/android/AndroidSearchEvidenceSummary.js +100 -0
- 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/AnalysisProviderEvaluation.js +1 -1
- package/dist/application/binary/AnalysisProviderRegistry.js +36 -21
- package/dist/application/binary/AnalysisSnapshotCache.js +41 -20
- package/dist/application/binary/AnalysisSnapshotFiles.js +75 -9
- package/dist/application/binary/BinarySession.js +250 -97
- package/dist/application/binary/BinarySessionExecution.js +5 -4
- package/dist/application/binary/BinarySessionOpen.js +13 -6
- package/dist/application/binary/BinarySessionRecords.js +33 -7
- package/dist/application/binary/BinarySessionStatus.js +93 -23
- package/dist/application/binary/BinaryTargetSummary.js +9 -0
- package/dist/application/binary/CompositeProvider.js +71 -28
- package/dist/application/binary/LazyAnalysisProvider.js +3 -1
- package/dist/application/binary/SessionProviderRouter.js +5 -2
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +13 -2
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +114 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +16 -4
- package/dist/application/captures/PacketCaptureService.js +83 -0
- package/dist/application/closeOwnedWebResources.js +7 -0
- package/dist/application/electron/ElectronFusePort.js +1 -0
- package/dist/application/electron/ElectronFuseService.js +80 -0
- package/dist/application/evm/EvmInterfaceService.js +4 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/flutter/DartAotInspection.js +26 -0
- package/dist/application/flutter/FlutterBuildAnalysisPort.js +1 -0
- package/dist/application/flutter/FlutterBuildAnalysisService.js +13 -0
- package/dist/application/frida/FridaInstrumentationPort.js +8 -0
- package/dist/application/frida/FridaInstrumentationService.js +310 -0
- package/dist/application/frida/fridaInputErrors.js +17 -0
- package/dist/application/go/GoBinaryPort.js +1 -0
- package/dist/application/go/GoBinaryService.js +80 -0
- package/dist/application/harmony/HarmonyApplicationService.js +17 -0
- package/dist/application/investigation/EvidenceLedger.js +40 -14
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/investigation/InvestigationRecords.js +12 -21
- package/dist/application/investigation/UnknownEvidence.js +22 -18
- package/dist/application/javascript/ElectronActiveObservationService.js +55 -25
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +17 -3
- package/dist/application/javascript/ElectronBoundaryGraph.js +2 -0
- package/dist/application/javascript/ElectronBoundaryGraphCallPaths.js +144 -0
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +28 -9
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +20 -7
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +50 -12
- package/dist/application/javascript/ElectronObservationService.js +0 -1
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +15 -0
- package/dist/application/javascript/JavaScriptApplicationService.js +44 -18
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +253 -60
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +51 -23
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +93 -21
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +35 -8
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +25 -14
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +163 -54
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +246 -15
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +1057 -323
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +134 -32
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +6 -1
- package/dist/application/javascript/JavaScriptModuleRelationships.js +39 -15
- package/dist/application/javascript/JavaScriptRecoveryService.js +32 -9
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +2 -1
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +0 -1
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +9 -3
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +228 -74
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +12 -19
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +4 -1
- package/dist/application/javascript/JavaScriptSemanticGraphElectronProjection.js +67 -0
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +19 -8
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +0 -1
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -2
- package/dist/application/managed/ManagedMemberComparisonService.js +72 -54
- package/dist/application/managed/ManagedNativeVerificationService.js +0 -1
- package/dist/application/managed/ManagedReconstructionService.js +0 -1
- package/dist/application/native/NativeCallRoutes.js +54 -34
- package/dist/application/native/NativeDispatchMetadataInspection.js +6 -2
- package/dist/application/native/NativeUiActionTrace.js +51 -30
- package/dist/application/native/NativeValueTrace.js +75 -24
- package/dist/application/pcap/PcapAnalysisPort.js +1 -0
- package/dist/application/pcap/PcapAnalysisService.js +24 -0
- package/dist/application/process/ProcessCli.js +57 -32
- package/dist/application/reverse/ReverseEngineeringCommandPort.js +1 -0
- package/dist/application/reverse/ReverseEngineeringService.js +688 -0
- package/dist/application/rust/RustBinaryPort.js +1 -0
- package/dist/application/rust/RustBinaryService.js +80 -0
- package/dist/application/signals/SignalRecordingService.js +83 -0
- package/dist/application/sqlite/SqliteDatabaseCapability.js +30 -0
- package/dist/application/sqlite/SqliteDatabasePort.js +1 -0
- package/dist/application/sqlite/SqliteDatabaseService.js +76 -0
- package/dist/application/wasm/WasmArtifactPort.js +1 -0
- package/dist/application/wasm/WasmArtifactService.js +77 -0
- package/dist/application/wasm/WasmInterfaceComparisonService.js +188 -0
- package/dist/artifacts/ArtifactHash.js +13 -2
- package/dist/artifacts/ArtifactPaths.js +133 -15
- package/dist/artifacts/ArtifactProvider.js +28 -19
- package/dist/artifacts/ArtifactReader.js +35 -0
- package/dist/artifacts/ArtifactResourceScope.js +109 -0
- package/dist/artifacts/AsarArtifactReader.js +295 -156
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/AsarListing.js +78 -0
- package/dist/artifacts/DirectoryArtifactReader.js +247 -74
- package/dist/artifacts/MachOSliceArtifactReader.js +198 -48
- package/dist/artifacts/NativeDmgArtifactReader.js +188 -78
- package/dist/artifacts/OrderedReads.js +57 -0
- package/dist/artifacts/SafeOutputTree.js +261 -71
- 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 +186 -31
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +77 -68
- package/dist/artifacts/apple/DylibResolutionReader.js +11 -5
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +114 -38
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +125 -35
- package/dist/artifacts/apple/KeyedArchiveReader.js +35 -15
- package/dist/artifacts/apple/MachoLoadCommandReader.js +62 -61
- package/dist/artifacts/apple/NibArchive.js +11 -4
- package/dist/artifacts/apple/PlistNumberLiterals.js +2 -2
- package/dist/artifacts/extraction/ArtifactExtraction.js +115 -92
- package/dist/artifacts/hostExecutableMarking.js +16 -0
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +236 -69
- package/dist/artifacts/inventory/ArtifactInventory.js +7 -6
- package/dist/artifacts/inventory/classify.js +95 -35
- package/dist/artifacts/inventory/hashStableRootArtifact.js +48 -15
- package/dist/artifacts/inventory/reader.js +40 -17
- package/dist/artifacts/inventory/scanCanonical.js +84 -40
- package/dist/artifacts/inventory/scanReader.js +72 -19
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +177 -15
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/artifacts/readStableArtifact.js +28 -4
- package/dist/browser/BrowserProcessStartup.js +20 -9
- package/dist/browser/BrowserScenarioPartialObservation.js +60 -38
- package/dist/browser/BrowserScenarioSecrets.js +193 -48
- package/dist/browser/CdpBrowserProvider.js +74 -98
- package/dist/browser/CdpCaptureDocuments.js +261 -65
- package/dist/browser/CdpCaptureDomSvg.js +243 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +12 -12
- package/dist/browser/CdpCaptureEventHandlers.js +49 -21
- package/dist/browser/CdpCaptureEvents.js +53 -19
- package/dist/browser/CdpCaptureStorage.js +22 -5
- package/dist/browser/CdpCaptureStorageFingerprints.js +54 -11
- package/dist/browser/CdpCaptureValues.js +0 -1
- package/dist/browser/CdpConnection.js +25 -9
- package/dist/browser/CdpElectronInspection.js +14 -4
- package/dist/browser/CdpElectronProvider.js +7 -2
- package/dist/browser/CdpElectronScripts.js +2 -1
- package/dist/browser/CdpElectronWorkers.js +7 -2
- package/dist/browser/CdpEndpoint.js +143 -17
- package/dist/browser/CdpObservationSession.js +24 -8
- package/dist/browser/CdpPageCapture.js +67 -17
- package/dist/browser/CdpPageCaptureScripts.js +4 -3
- package/dist/browser/CdpPageCaptureWorkers.js +5 -1
- package/dist/browser/CdpSafeMetadata.js +9 -5
- package/dist/browser/CdpScreenshot.js +5 -14
- package/dist/browser/CdpSnapshotStrings.js +21 -0
- package/dist/browser/CdpTargetSession.js +59 -36
- package/dist/browser/CdpWebMcpDiscovery.js +55 -16
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +64 -8
- package/dist/browser/PlaywrightElectronActiveActions.js +4 -4
- package/dist/browser/PlaywrightElectronActiveProjection.js +16 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +114 -36
- package/dist/browser/PlaywrightExecutionBoundary.js +2 -2
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +78 -13
- package/dist/browser/PlaywrightScenarioEvents.js +198 -36
- package/dist/browser/PlaywrightScenarioServiceWorkers.js +249 -0
- package/dist/browser/PlaywrightScenarioSession.js +180 -75
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +164 -81
- package/dist/browser/assets/LocalWebScriptArtifacts.js +27 -4
- package/dist/browser/assets/PublishWebScripts.js +88 -22
- package/dist/browser/assets/ScenarioScriptCapture.js +2 -1
- package/dist/browser/assets/WebArtifactReads.js +34 -4
- package/dist/browser/assets/WebSourceLocationArtifacts.js +39 -3
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/CaptureFailures.js +22 -8
- package/dist/browser/history/CaptureFormatError.js +2 -2
- package/dist/browser/history/{HarJson.js → CaptureJson.js} +14 -4
- package/dist/browser/history/CaptureRedaction.js +16 -3
- package/dist/browser/history/CaptureRelease.js +20 -2
- package/dist/browser/history/HarCapture.js +16 -9
- package/dist/browser/history/HarSchema.js +36 -36
- package/dist/browser/history/HistoricalCaptureDecoder.js +93 -25
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/history/NodeCaptureAdapter.js +48 -0
- package/dist/browser/history/{HarCaptureProcess.js → NodeCaptureProcess.js} +16 -15
- package/dist/browser/history/QlogCapture.js +385 -0
- package/dist/browser/history/SazCapture.js +130 -0
- package/dist/browser/history/SazHttp.js +61 -0
- package/dist/browser/history/SazMetadata.js +92 -0
- package/dist/browser/history/SazProjection.js +90 -0
- package/dist/browser/modules/NativeModuleResolver.js +177 -110
- package/dist/browser/modules/WebModuleArtifacts.js +41 -3
- package/dist/browser/network/PlaywrightNetworkContent.js +40 -5
- package/dist/browser/network/PlaywrightScenarioNetwork.js +125 -11
- package/dist/captures/TsharkCaptureProvider.js +370 -0
- package/dist/captures/parseFieldDiscovery.js +66 -0
- package/dist/captures/parsePacketOutput.js +21 -0
- package/dist/catalogIdentity.js +46 -35
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/androidCommands.js +11 -2
- package/dist/cli/apktoolCommands.js +52 -0
- package/dist/cli/applicationCommands.js +44 -17
- package/dist/cli/artifactCommands.js +9 -12
- package/dist/cli/binaryDiagnosticsCommands.js +27 -5
- package/dist/cli/browserAdvancedCommands.js +97 -55
- package/dist/cli/browserCommands.js +46 -29
- package/dist/cli/captureCommands.js +72 -0
- package/dist/cli/cliResultOutput.js +188 -0
- package/dist/cli/coreBinaryCommands.js +73 -32
- package/dist/cli/coreNativeCommands.js +54 -45
- package/dist/cli/cutterCommands.js +50 -0
- package/dist/cli/electronCommands.js +51 -4
- package/dist/cli/evmCommands.js +16 -8
- package/dist/cli/finishAnalysisCommand.js +44 -0
- package/dist/cli/firmwareCommands.js +21 -38
- package/dist/cli/flutterCommands.js +69 -0
- package/dist/cli/fridaCommands.js +211 -0
- package/dist/cli/goCommands.js +20 -0
- package/dist/cli/interactiveSetup.js +11 -1
- package/dist/cli/javascriptApplicationAnalysis.js +18 -2
- package/dist/cli/javascriptRecoveryCommands.js +29 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +13 -6
- package/dist/cli/managedCommands.js +31 -3
- package/dist/cli/options.js +20 -2
- package/dist/cli/pcapCommands.js +47 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/reverseEngineeringCommands.js +268 -0
- package/dist/cli/rustCommands.js +21 -0
- package/dist/cli/setupCommands.js +55 -15
- package/dist/cli/signalCommands.js +72 -0
- package/dist/cli/sqliteCommands.js +79 -0
- package/dist/cli/utilityCommands.js +179 -89
- package/dist/cli/wasmCommands.js +61 -0
- package/dist/cli/webModuleCommands.js +36 -32
- package/dist/cli/webNetworkCaptureCommands.js +8 -8
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli-runtime/AbortablePromise-BVBemxbD.js +123 -0
- package/dist/cli-runtime/AnalysisProvider-D0Us2OTk.js +27 -0
- package/dist/cli-runtime/AnalysisSnapshotCache-BXS0wRd2.js +710 -0
- package/dist/cli-runtime/ArtifactReader-BXkffc1D.js +55 -0
- package/dist/cli-runtime/ArtifactResourceScope-DQWTcUwE.js +114 -0
- package/dist/cli-runtime/AsarHeader-CnzOzYEH.js +31 -0
- package/dist/cli-runtime/BinarySessionStatus-DnMxMk-r.js +211 -0
- package/dist/cli-runtime/BinaryTargetResolver-CVIJ_s1A.js +1308 -0
- package/dist/cli-runtime/BoundedFileBytes-BU30odTm.js +39 -0
- package/dist/cli-runtime/CdpTargetSession-DGX5pV9w.js +650 -0
- package/dist/cli-runtime/ClientConfigPath-c6jr6INc.js +36 -0
- package/dist/cli-runtime/ClientConfigurationDocument-ffQ9X0Se.js +1957 -0
- package/dist/cli-runtime/ClientRegistrationStatus-DszCyPEU.js +509 -0
- package/dist/cli-runtime/CurrentEntrypointPath-D5FRNdkq.js +14 -0
- package/dist/cli-runtime/DirectAnalysis-BgvAtpN3.js +528 -0
- package/dist/cli-runtime/Doctor-DIpf_I7N.js +588 -0
- package/dist/cli-runtime/ElectronFileScope-dpHm2nrS.js +1054 -0
- package/dist/cli-runtime/ExecFileOutput-BEQs-lDD.js +117 -0
- package/dist/cli-runtime/IdaConfiguration-CtGP7EKo.js +1094 -0
- package/dist/cli-runtime/InterfaceBuilderDecodeBudget-D4omRUe4.js +279 -0
- package/dist/cli-runtime/InventoryProjectionEvidence-DIsI4DJ6.js +49 -0
- package/dist/cli-runtime/InvestigationProviders-DoQRIHii.js +117 -0
- package/dist/cli-runtime/JavaScriptApplicationEvidenceGraph-D5aI_FSJ.js +160 -0
- package/dist/cli-runtime/JavaScriptApplicationWorkflowEvidence-Bz4-V0Ct.js +75 -0
- package/dist/cli-runtime/JavaScriptWorkerMemoryLimit-B1bwMM1a.js +86 -0
- package/dist/cli-runtime/JebMcpEndpoint-DUytrn5G.js +428 -0
- package/dist/cli-runtime/JsonFiles-DQa1PRKy.js +708 -0
- package/dist/cli-runtime/MacCodeSignature-MgYbRK_H.js +24 -0
- package/dist/cli-runtime/MacHopperPaths-CwL5lYPX.js +434 -0
- package/dist/cli-runtime/MachoLoadCommandReader-C7e074Ze.js +510 -0
- package/dist/cli-runtime/ManagedSnapshot-rqyBHcdL.js +4185 -0
- package/dist/cli-runtime/OwnedCommand-Cj9GhmPR.js +112 -0
- package/dist/cli-runtime/PrivateRuntimeRoot-DAy0PiBM.js +263 -0
- package/dist/cli-runtime/ProcessOwnership-DXC5-UWt.js +1378 -0
- package/dist/cli-runtime/ProviderDeadline-8m2pFRDc.js +122 -0
- package/dist/cli-runtime/RegularFile-B_6KPCNQ.js +139 -0
- package/dist/cli-runtime/RegularFileRead-DVlC5faM.js +125 -0
- package/dist/cli-runtime/SafeOutputTree-D6U15GXd.js +524 -0
- package/dist/cli-runtime/SetupHost-FkYWswsq.js +1098 -0
- package/dist/cli-runtime/SupportedClients-DaX6Lt2d.js +1049 -0
- package/dist/cli-runtime/UninstallFailure-1blyKXHE.js +22 -0
- package/dist/cli-runtime/Update-CbTC_eg1.js +143 -0
- package/dist/cli-runtime/UpdateFailure-BcFNxEZZ.js +24 -0
- package/dist/cli-runtime/ZipArtifactReader-B8ZgNe4D.js +248 -0
- package/dist/cli-runtime/analysisErrorCleanup-Do6YeeoD.js +32 -0
- package/dist/cli-runtime/analysisErrorPresentation-DGt7TdsH.js +497 -0
- package/dist/cli-runtime/appleArchiveFormat-tVoI2ykA.js +263 -0
- package/dist/cli-runtime/application__DirectAnalysisStatus-DpOejOf0.js +150 -0
- package/dist/cli-runtime/application__EnhancedTools-oFE2bOjs.js +1787 -0
- package/dist/cli-runtime/application__FunctionAnalysisEvidence-B6osuhvW.js +41 -0
- package/dist/cli-runtime/application__ReconstructionCoverageService-DN3wTFQj.js +32 -0
- package/dist/cli-runtime/application__ReconstructionObligationLedgerService-CKcTppX9.js +815 -0
- package/dist/cli-runtime/application__Setup-XpMaRNjy.js +514 -0
- package/dist/cli-runtime/application__Uninstall-_23pU2yB.js +427 -0
- package/dist/cli-runtime/application__UpdateRuntime-DPvY8ohd.js +345 -0
- package/dist/cli-runtime/application__android__AndroidApplicationService-CFgIFPM4.js +31 -0
- package/dist/cli-runtime/application__apple__AppleApplicationService-Db6QCsun.js +31 -0
- package/dist/cli-runtime/application__harmony__HarmonyApplicationService-CFjocHoK.js +31 -0
- package/dist/cli-runtime/application__javascript__ElectronActiveObservationService-CmVDUI_Z.js +118 -0
- package/dist/cli-runtime/application__javascript__ElectronObservationService-DEsR8KDN.js +63 -0
- package/dist/cli-runtime/application__javascript__JavaScriptApplicationService-CCkp8KBh.js +11450 -0
- package/dist/cli-runtime/application__javascript__JavaScriptApplicationWorkflowService-lPy0tzr3.js +2329 -0
- package/dist/cli-runtime/application__javascript__JavaScriptRuntimeReconciliationService-DWleA8K9.js +88 -0
- package/dist/cli-runtime/application__javascript__JavaScriptSemanticTraceService-DkALH4rL.js +299 -0
- package/dist/cli-runtime/artifactOperationError-B7n03FbD.js +27 -0
- package/dist/cli-runtime/artifacts__ArtifactProvider-zXI0QjSL.js +2187 -0
- package/dist/cli-runtime/binary-BVOr2mgE.js +14206 -0
- package/dist/cli-runtime/browserObservationError-Dx6xRTjb.js +40 -0
- package/dist/cli-runtime/catalogIdentity-DLoXgfIR.js +933 -0
- package/dist/cli-runtime/cli.js +41848 -0
- package/dist/cli-runtime/cliOutput-BC1BdAcB.js +122 -0
- package/dist/cli-runtime/cliOutput.js +5 -0
- package/dist/cli-runtime/cliResultOutput-DsRMI8CJ.js +780 -0
- package/dist/cli-runtime/cliResultOutput.js +5 -0
- package/dist/cli-runtime/composition__browserScenario-DHXC1a8n.js +2927 -0
- package/dist/cli-runtime/composition__electronObservation-GecK2EID.js +555 -0
- package/dist/cli-runtime/composition__electronScenario-CEZnVrAL.js +653 -0
- package/dist/cli-runtime/cutterToolContracts-TZH9EHr5.js +5134 -0
- package/dist/cli-runtime/doctorRuntime-BE5ZX8it.js +258 -0
- package/dist/cli-runtime/dotnet__ManagedStaticProvider-C8_yZCDc.js +5 -0
- package/dist/cli-runtime/errorSchemas-CTRmvMl3.js +601 -0
- package/dist/cli-runtime/javascriptApplicationAnalysis-HgMzVMQw.js +2068 -0
- package/dist/cli-runtime/javascriptExportReturnShapeProjection-Dg00g35t.js +78 -0
- package/dist/cli-runtime/javascriptExportShapeComparisonSchemas-BYnoIqIk.js +1242 -0
- package/dist/cli-runtime/javascriptRuntimeReconciliation-DNjDoL3S.js +1507 -0
- package/dist/cli-runtime/javascriptRuntimeReconciliationSchemas-BWpGWNcI.js +247 -0
- package/dist/cli-runtime/javascriptSemanticTraceSchemas-BTCNcvbc.js +126 -0
- package/dist/cli-runtime/lipo-DSWP6fv-.js +396 -0
- package/dist/cli-runtime/logger-CQQCI4a2.js +48 -0
- package/dist/cli-runtime/machoContainer-C8BIkkq3.js +172 -0
- package/dist/cli-runtime/managedApplicationGraph-B08jb3jq.js +1130 -0
- package/dist/cli-runtime/managedToolContracts-D60QmIYj.js +99 -0
- package/dist/cli-runtime/mcpDoctor.js +359 -0
- package/dist/cli-runtime/mcpStartupPolicy-CVVSOmRc.js +21 -0
- package/dist/cli-runtime/native__NativeMacOSProvider-YBTvUeJO.js +4875 -0
- package/dist/cli-runtime/officialToolContracts-CCFF0an9.js +1501 -0
- package/dist/cli-runtime/propertyListKeys-G8e74YWb.js +248 -0
- package/dist/cli-runtime/providerAdapterError-DAjhICdr.js +25 -0
- package/dist/cli-runtime/providerCleanupError-Ceq8f0wK.js +27 -0
- package/dist/cli-runtime/providerIdentities-Ao1XTvwx.js +31 -0
- package/dist/cli-runtime/providerStartupTimeout-B2tF2LtZ.js +17 -0
- package/dist/cli-runtime/readFileHandleChunks-dp60iZ6v.js +38 -0
- package/dist/cli-runtime/reconstructionObligationLedgerSchemas-Bao0xMr-.js +19478 -0
- package/dist/cli-runtime/rolldown-runtime-DXoylpqc.js +121 -0
- package/dist/cli-runtime/runtimeVersion-CMGd0bDu.js +23 -0
- package/dist/cli-runtime/safeJson-DKKACtdy.js +25 -0
- package/dist/cli-runtime/scanCanonical-KP4T9jSl.js +2724 -0
- package/dist/cli-runtime/snapshotEnvironment-D_tWyOub.js +813 -0
- package/dist/cli-runtime/toolContracts-D2FOG_Nb.js +3721 -0
- package/dist/cli-runtime/toolOutputSchemaGroups-DRiYs1je.js +12070 -0
- package/dist/cli-runtime/workflowInputError-n8Oo-bLA.js +26 -0
- package/dist/cli.js +44 -5
- package/dist/cliBrowserScenarioCommands.js +41 -5
- package/dist/cliCommandNames.js +80 -0
- package/dist/cliEvidenceCommands.js +0 -1
- package/dist/cliJavaScriptRuntimeCommands.js +16 -14
- package/dist/cliJsonInput.js +14 -6
- package/dist/cliLogging.js +50 -14
- package/dist/cliObservationOptions.js +9 -0
- package/dist/cliOutput.js +38 -5
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/binary.js +4 -0
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/captures.js +3 -0
- package/dist/composition/directAnalysis.js +36 -11
- package/dist/composition/electronFuses.js +4 -0
- package/dist/composition/evm.js +12 -0
- package/dist/composition/flutter.js +3 -0
- package/dist/composition/go.js +4 -0
- package/dist/composition/javascriptAnalysisWorkerProcess.js +49 -0
- package/dist/composition/jeb.js +35 -0
- package/dist/composition/pcap.js +3 -0
- package/dist/composition/resolveWindowsProviderExecutable.js +61 -0
- package/dist/composition/reverseEngineering.js +29 -0
- package/dist/composition/rust.js +4 -0
- package/dist/composition/signals.js +3 -0
- package/dist/composition/sqlite.js +4 -0
- package/dist/composition/wasm.js +22 -0
- package/dist/composition/webNetworkCaptures.js +7 -2
- package/dist/config/environment.js +55 -4
- package/dist/config/ghidraDisabledAnalyzers.js +25 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/homeDirectory.js +9 -6
- package/dist/config/mcpInputSchemaProfile.js +31 -0
- package/dist/config/mcpOutputSchemaProfile.js +22 -0
- package/dist/config/parseConfig.js +36 -19
- package/dist/config/parsers.js +4 -3
- package/dist/config/{ghidraStartupTimeout.js → providerStartupTimeout.js} +7 -3
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +13 -0
- package/dist/contracts/analysisViewApiSurfaceExample.js +68 -0
- package/dist/contracts/analysisViewToolContracts.js +39 -3
- package/dist/contracts/android/androidToolContracts.js +17 -8
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/applicationToolContracts.js +17 -2
- package/dist/contracts/artifactToolContracts.js +21 -6
- package/dist/contracts/browserToolContracts.js +2 -1
- package/dist/contracts/captures/captureToolContracts.js +42 -0
- package/dist/contracts/compactInputSchema.js +276 -0
- package/dist/contracts/cutterToolContracts.js +84 -0
- package/dist/contracts/enhancedToolContracts.js +2 -2
- package/dist/contracts/evm/evmToolContracts.js +30 -15
- package/dist/contracts/firmware/firmwareToolContracts.js +1 -1
- package/dist/contracts/flutter/flutterToolContracts.js +47 -0
- package/dist/contracts/fridaRemoteAddress.js +23 -0
- package/dist/contracts/fridaToolContracts.js +273 -0
- package/dist/contracts/functionComparisonExample.js +12 -1
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/gdbToolContracts.js +103 -0
- package/dist/contracts/go/goToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +15 -0
- package/dist/contracts/inputSchemaPresentation.js +91 -24
- package/dist/contracts/investigationExamples.js +1 -0
- package/dist/contracts/javascript/electronToolContracts.js +40 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +13 -1
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/managed/managedToolContracts.js +43 -4
- package/dist/contracts/managed/managedWorkflowExamples.js +7 -1
- package/dist/contracts/managed/managedWorkflowToolContracts.js +4 -30
- package/dist/contracts/mobileApplicationGraphExamples.js +12 -0
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +27 -4
- package/dist/contracts/native/nativeToolContracts.js +10 -6
- package/dist/contracts/officialToolContracts.js +9 -9
- package/dist/contracts/pcap/pcapToolContracts.js +33 -0
- package/dist/contracts/providerSelection.js +1 -0
- package/dist/contracts/reconstructionReadinessExample.js +126 -119
- package/dist/contracts/reverseEngineeringToolContracts.js +52 -0
- package/dist/contracts/rizinDebugToolContracts.js +96 -0
- package/dist/contracts/rust/rustToolContracts.js +20 -0
- package/dist/contracts/sessionLifecycleInputs.js +34 -2
- package/dist/contracts/sessionToolContracts.js +4 -4
- package/dist/contracts/sessionToolSchemas.js +20 -2
- package/dist/contracts/signals/signalToolContracts.js +40 -0
- package/dist/contracts/sqlite/sqliteToolContracts.js +36 -0
- package/dist/contracts/toolContractExamples.js +35 -0
- package/dist/contracts/toolContractTypes.js +5 -0
- package/dist/contracts/toolContracts.js +32 -0
- package/dist/contracts/toolEffects.js +414 -8
- package/dist/contracts/toolOutputSchemaGroups.js +78 -33
- package/dist/contracts/toolOutputSchemaPrimitives.js +111 -10
- package/dist/contracts/toolSchemaMetadata.js +98 -9
- package/dist/contracts/unknownContractExamples.js +1 -1
- package/dist/contracts/wasm/wasmComparisonContracts.js +52 -0
- package/dist/contracts/wasm/wasmToolContracts.js +33 -0
- package/dist/contracts/webNetworkCaptureToolContracts.js +15 -4
- package/dist/cutter/CutterBridgeClient.js +621 -0
- package/dist/cutter/CutterBridgeService.js +139 -0
- package/dist/doctorRuntime.js +20 -8
- package/dist/domain/adb/adbDeviceAnalysis.js +605 -0
- package/dist/domain/analysisErrorBase.js +20 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorCore.js +19 -0
- package/dist/domain/analysisErrorPresentation.js +75 -22
- package/dist/domain/analysisErrorProjection.js +35 -13
- package/dist/domain/analysisProfile.js +7 -3
- package/dist/domain/analysisSnapshot.js +313 -185
- package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +414 -0
- package/dist/domain/analysisView/analysisView.js +417 -45
- package/dist/domain/analysisView/analysisViewCoverage.js +32 -0
- package/dist/domain/analysisView/analysisViewErrors.js +4 -0
- package/dist/domain/analysisView/analysisViewParent.js +12 -0
- package/dist/domain/analysisView/analysisViewText.js +29 -0
- package/dist/domain/analysisView/androidPackageView.js +102 -0
- package/dist/domain/analysisView/artifactInventoryView.js +140 -0
- package/dist/domain/analysisView/binaryLayoutView.js +13 -4
- package/dist/domain/analysisView/dartAotView.js +93 -0
- package/dist/domain/analysisView/evmInterfaceView.js +105 -0
- package/dist/domain/analysisView/interfaceBuilderView.js +182 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +29 -26
- package/dist/domain/analysisView/machoView.js +186 -0
- package/dist/domain/analysisView/managedArtifactView.js +108 -0
- package/dist/domain/analysisView/managedMemberView.js +209 -0
- package/dist/domain/analysisView/nativeFunctionView.js +150 -0
- package/dist/domain/analysisView/pcapCaptureView.js +264 -0
- package/dist/domain/analysisView/qlogCaptureView.js +198 -0
- package/dist/domain/analysisView/wasmArtifactView.js +162 -0
- package/dist/domain/analysisView/webNetworkApiSurfaceView.js +123 -0
- package/dist/domain/analysisView/webNetworkCaptureView.js +388 -0
- package/dist/domain/android/androidAnalysis.js +36 -2
- package/dist/domain/android/androidApplication.js +57 -80
- package/dist/domain/apktool/apktoolResourceAnalysis.js +89 -0
- package/dist/domain/apple/appleApplication.js +71 -52
- package/dist/domain/apple/appleArchiveFormat.js +184 -0
- package/dist/domain/apple/appleAssetCatalog.js +15 -0
- package/dist/domain/apple/appleBundleAnatomy.js +96 -29
- package/dist/domain/apple/dyldPaths.js +18 -3
- package/dist/domain/apple/dylibResolution.js +21 -11
- package/dist/domain/apple/dylibResolutionFindings.js +8 -9
- package/dist/domain/apple/interfaceBuilderGraph.js +72 -45
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +38 -9
- package/dist/domain/apple/machoContainer.js +120 -8
- package/dist/domain/apple/machoCpuIdentity.js +4 -0
- package/dist/domain/apple/plistValue.js +6 -1
- package/dist/domain/artifactComparison.js +130 -25
- package/dist/domain/artifactDecompressionBudget.js +26 -0
- package/dist/domain/artifactGraph.js +28 -9
- package/dist/domain/artifactIdentity.js +33 -2
- package/dist/domain/artifactInspection.js +47 -45
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +148 -51
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +253 -80
- package/dist/domain/binaryTargetTypes.js +21 -1
- package/dist/domain/browserNetworkEvidence.js +4 -0
- package/dist/domain/browserObservation.js +88 -29
- package/dist/domain/browserObservationSchemas.js +12 -5
- package/dist/domain/browserScenarioCapture.js +2 -1
- package/dist/domain/browserScenarioCaptureValues.js +26 -2
- package/dist/domain/browserScenarioDiff.js +120 -11
- package/dist/domain/browserScenarioDiffEvidence.js +46 -13
- package/dist/domain/browserScenarioDiffValues.js +10 -3
- package/dist/domain/browserScenarioNetworkComparison.js +158 -0
- package/dist/domain/browserScenarioNormalization.js +10 -13
- package/dist/domain/browserScenarioValues.js +2 -12
- package/dist/domain/browserSession.js +2 -2
- package/dist/domain/bundleComparison.js +1 -5
- package/dist/domain/callPath.js +40 -3
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/captures/packetCapture.js +138 -0
- package/dist/domain/captures/packetFields.js +81 -0
- package/dist/domain/changedBehavior.js +43 -41
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/comparisonSourceEvidence.js +6 -0
- package/dist/domain/dosCom.js +2 -2
- package/dist/domain/dosMz.js +52 -14
- package/dist/domain/electron/electronFuses.js +360 -0
- package/dist/domain/elfFixedHeader.js +42 -0
- package/dist/domain/evidence.js +104 -38
- package/dist/domain/evidenceBundle.js +58 -20
- package/dist/domain/evidenceErrors.js +5 -0
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/evm/evmInterface.js +18 -4
- package/dist/domain/evm/solidityMetadata.js +70 -0
- package/dist/domain/explicitSensitiveFailure.js +42 -24
- package/dist/domain/firmware/firmwareAnalysis.js +29 -0
- package/dist/domain/flutter/flutterBuildAnalysis.js +141 -0
- package/dist/domain/functionCallCoverage.js +60 -0
- package/dist/domain/functionComparisonDimensions.js +101 -10
- package/dist/domain/functionComparisonNormalization.js +66 -10
- package/dist/domain/functionComparisonResults.js +7 -6
- package/dist/domain/functionComparisonSchemas.js +14 -3
- package/dist/domain/functionDossierEvidence.js +3 -0
- package/dist/domain/go/goBinary.js +96 -0
- package/dist/domain/harmony/harmonyApplication.js +156 -0
- package/dist/domain/hopperErrors.js +15 -16
- package/dist/domain/hopperPublisher.js +12 -0
- package/dist/domain/hopperValues.js +112 -34
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronObservation.js +4 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +24 -24
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +13 -20
- package/dist/domain/javascript/electronStaticAnalysisNative.js +85 -41
- package/dist/domain/javascript/electronStaticAnalysisValues.js +30 -8
- package/dist/domain/javascript/electronWrappedCallPaths.js +498 -0
- package/dist/domain/javascript/htmlArtifactReferences.js +94 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +65 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +7 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +13 -8
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +1 -1
- package/dist/domain/javascript/javascriptApplicationGraph.js +96 -19
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +43 -0
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +28 -12
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +40 -19
- package/dist/domain/javascript/javascriptArtifactFiles.js +2 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +100 -39
- package/dist/domain/javascript/javascriptAstValues.js +81 -0
- package/dist/domain/javascript/javascriptBootstrap.js +94 -0
- package/dist/domain/javascript/javascriptBootstrapIntegrity.js +372 -0
- package/dist/domain/javascript/javascriptBuiltinResourceMethods.js +8 -0
- package/dist/domain/javascript/javascriptBundledRequireOrigin.js +291 -0
- package/dist/domain/javascript/javascriptContextBridgeExposure.js +23 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +114 -0
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +6 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +1 -1
- package/dist/domain/javascript/javascriptFeatureSeed.js +33 -16
- package/dist/domain/javascript/javascriptFeatureTrace.js +9 -3
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +42 -11
- package/dist/domain/javascript/javascriptIntrinsicInvocation.js +132 -0
- package/dist/domain/javascript/javascriptModuleDeclaration.js +28 -0
- package/dist/domain/javascript/javascriptModuleInterop.js +618 -0
- package/dist/domain/javascript/javascriptModuleResolutionMode.js +18 -0
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptModuleSpecifier.js +5 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +6 -2
- package/dist/domain/javascript/javascriptPackageImportAliases.js +58 -0
- package/dist/domain/javascript/javascriptRecovery.js +12 -5
- package/dist/domain/javascript/javascriptRpcEndpoints.js +331 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +12 -3
- package/dist/domain/javascript/javascriptRuntimeObservation.js +4 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +10 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +7 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +15 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +5 -4
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +121 -22
- package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +251 -0
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +493 -104
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +17 -34
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +4 -3
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCallableStack.js +52 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +14 -12
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +42 -55
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +428 -32
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +14 -20
- package/dist/domain/javascript/javascriptSemanticDependencies.js +69 -0
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +51 -53
- package/dist/domain/javascript/javascriptSemanticGraph.js +74 -24
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +2 -11
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +41 -8
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +538 -151
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +199 -3
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +78 -35
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +671 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +27 -17
- package/dist/domain/javascript/javascriptSemanticProjection.js +202 -56
- package/dist/domain/javascript/javascriptSemanticPromises.js +6 -9
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +77 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +5 -1
- package/dist/domain/javascript/javascriptSemanticQuery.js +34 -31
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +1 -3
- package/dist/domain/javascript/javascriptSemanticReferenceSources.js +25 -0
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +331 -8
- package/dist/domain/javascript/javascriptSemanticResources.js +6 -40
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +233 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +49 -52
- package/dist/domain/javascript/javascriptSemanticState.js +61 -4
- package/dist/domain/javascript/javascriptSemanticTraversal.js +25 -5
- package/dist/domain/javascript/javascriptSemanticValues.js +260 -35
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptSourceMapPaths.js +44 -17
- package/dist/domain/javascript/javascriptSourceParser.js +72 -3
- package/dist/domain/javascript/javascriptSourceSelection.js +11 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +72 -26
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +100 -24
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +271 -47
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +166 -56
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +2 -0
- package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +2 -1
- package/dist/domain/javascript/javascriptSymbolicBindings.js +836 -0
- package/dist/domain/javascript/javascriptSymbolicControlFlow.js +40 -0
- package/dist/domain/javascript/javascriptSymbolicValues.js +34 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +3 -1
- package/dist/domain/javascript/sourceToBundleComparisonSchemas.js +2 -0
- package/dist/domain/javascript/sourceToBundleSignals.js +47 -13
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonShape.js +63 -52
- package/dist/domain/jsonValue.js +40 -12
- package/dist/domain/localPath.js +6 -3
- package/dist/domain/managed/managedApplicationGraph.js +42 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +12 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +32 -23
- package/dist/domain/managed/managedArtifact.js +52 -1
- package/dist/domain/managed/managedInspectionEvidence.js +12 -0
- package/dist/domain/managed/managedMemberComparison.js +3 -0
- package/dist/domain/managed/managedMemberComparisonCoverage.js +23 -3
- package/dist/domain/managed/managedMemberComparisonItems.js +23 -19
- package/dist/domain/managed/managedMemberComparisonMatch.js +209 -18
- package/dist/domain/managed/managedNativeVerificationMatch.js +49 -26
- package/dist/domain/managed/managedNativeVerificationSchemas.js +13 -2
- package/dist/domain/managed/managedReconstruction.js +5 -8
- package/dist/domain/mobileApplicationGraphProjection.js +80 -0
- package/dist/domain/native/addressCoordinate.js +11 -0
- package/dist/domain/native/binaryLayout.js +2 -4
- package/dist/domain/native/bytePattern.js +100 -0
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeInspection.js +38 -4
- package/dist/domain/native/nativeInstruction.js +38 -2
- package/dist/domain/native/nativeInvestigationGraph.js +9 -5
- package/dist/domain/native/nativeLoadImage.js +19 -1
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/nativeUiObservation.js +5 -6
- package/dist/domain/native/objcSwiftMetadata.js +4 -1
- package/dist/domain/native/peResources.js +100 -0
- package/dist/domain/native/recordedCrash.js +79 -10
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/offsetDateTime.js +60 -0
- package/dist/domain/pcap/pcapAnalysis.js +91 -0
- package/dist/domain/pcap/pcapEvidence.js +15 -0
- package/dist/domain/peMachine.js +36 -0
- package/dist/domain/pngHeader.js +18 -0
- package/dist/domain/process/processCapture.js +91 -1
- package/dist/domain/process/processCaptureCoverage.js +26 -3
- package/dist/domain/process/processCaptureExample.js +26 -0
- package/dist/domain/process/processCaptureValidation.js +112 -8
- package/dist/domain/process/processComparison.js +41 -13
- package/dist/domain/process/processScenario.js +66 -7
- package/dist/domain/process/processTraceEvaluation.js +54 -50
- package/dist/domain/process/processTraceSpecification.js +243 -89
- package/dist/domain/propertyListKeys.js +214 -12
- package/dist/domain/propertyListXmlText.js +20 -4
- package/dist/domain/providerAdapterError.js +0 -5
- package/dist/domain/providerConfigurationRefusal.js +12 -0
- package/dist/domain/providerSelectionError.js +2 -1
- package/dist/domain/qlogCapture.js +62 -0
- package/dist/domain/rawBinary.js +96 -0
- package/dist/domain/reconstructionCoverage.js +5 -1
- package/dist/domain/reconstructionCoverageEvaluation.js +18 -15
- package/dist/domain/reconstructionCoverageVerifierResults.js +35 -0
- package/dist/domain/reconstructionObligationLedgerIntegrity.js +114 -0
- package/dist/domain/reconstructionObligationLedgerSchemas.js +104 -1
- package/dist/domain/reconstructionReadiness.js +4 -8
- package/dist/domain/reconstructionReadinessJourneyFindings.js +4 -1
- package/dist/domain/reconstructionUnknowns.js +9 -1
- package/dist/domain/reconstructionVerification.js +54 -25
- package/dist/domain/recordedTransportUrl.js +59 -0
- package/dist/domain/referenceSourceClassification.js +27 -23
- package/dist/domain/referenceSourceGraph.js +70 -23
- package/dist/domain/referenceSourceImportParsing.js +29 -16
- package/dist/domain/referenceSourcePathIdentity.js +32 -0
- package/dist/domain/referenceSourceRequireBindings.js +130 -0
- package/dist/domain/referenceSourceSummary.js +92 -0
- package/dist/domain/relationshipCoverage.js +44 -0
- package/dist/domain/residualUnknown.js +93 -26
- package/dist/domain/reverseEngineering.js +31 -0
- package/dist/domain/runtimeVersion.js +8 -0
- package/dist/domain/rust/rustBinary.js +200 -0
- package/dist/domain/signals/annotationTextWindow.js +31 -0
- package/dist/domain/signals/signalDecoders.js +69 -0
- package/dist/domain/signals/signalRecording.js +115 -0
- package/dist/domain/sourceMapContents.js +10 -3
- package/dist/domain/sourceMapEnvelope.js +17 -11
- package/dist/domain/sqlite/sqliteDatabase.js +188 -0
- package/dist/domain/staticRuntimeCorrelation.js +7 -9
- package/dist/domain/swiftSymbolClassification.js +17 -0
- package/dist/domain/symbolAnalysis.js +16 -4
- package/dist/domain/urlComponents.js +6 -0
- package/dist/domain/wasm/wasmArtifact.js +119 -0
- package/dist/domain/wasm/wasmInterface.js +89 -0
- package/dist/domain/webBundleAnalysis.js +14 -3
- package/dist/domain/webBundleAnalyzerAst.js +7 -2
- package/dist/domain/webBundleAnalyzerInspection.js +68 -40
- package/dist/domain/webBundleAnalyzerResult.js +18 -6
- package/dist/domain/webCaptureDiff.js +233 -34
- package/dist/domain/webCaptureFrameComparison.js +49 -0
- package/dist/domain/webMcpDiscovery.js +5 -2
- package/dist/domain/webModuleImports.js +22 -27
- package/dist/domain/webModuleTrace.js +3 -8
- package/dist/domain/webNetworkCapture.js +101 -39
- package/dist/domain/webNetworkCaptureCoordinates.js +21 -0
- package/dist/domain/webRuntime.js +0 -1
- package/dist/domain/webScreenshot.js +2 -2
- package/dist/domain/webScriptArtifacts.js +2 -4
- package/dist/domain/webScriptExport.js +6 -8
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +9 -15
- package/dist/domain/webSourceLocation.js +20 -9
- package/dist/domain/zipPackageFormat.js +31 -2
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +81 -54
- package/dist/dotnet/ManagedDecodeBudget.js +138 -0
- package/dist/dotnet/ManagedMemberInspector.js +113 -26
- package/dist/dotnet/ManagedMemberInspectorCore.js +356 -140
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +112 -38
- package/dist/dotnet/ManagedMemberOwnership.js +65 -0
- package/dist/dotnet/ManagedMemberPointers.js +69 -0
- package/dist/dotnet/ManagedMemberRows.js +182 -44
- package/dist/dotnet/ManagedMetadataHeaps.js +123 -27
- package/dist/dotnet/ManagedMetadataInventory.js +5 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +56 -63
- package/dist/dotnet/ManagedMetadataLayout.js +19 -5
- package/dist/dotnet/ManagedMetadataRowSizes.js +1 -1
- package/dist/dotnet/ManagedMethodBodyReader.js +34 -11
- package/dist/dotnet/ManagedMethodSpecs.js +78 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +5 -4
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +52 -44
- package/dist/dotnet/ManagedPeReader.js +96 -52
- package/dist/dotnet/ManagedReaderFailure.js +11 -1
- package/dist/dotnet/ManagedSnapshot.js +88 -0
- package/dist/dotnet/ManagedStaticProvider.js +57 -35
- package/dist/dotnet/ManagedTypeMemberLists.js +105 -0
- package/dist/dotnet/ManagedTypeNames.js +98 -0
- package/dist/dotnet/ManagedUserStrings.js +75 -0
- package/dist/electron/ElectronFusePath.js +247 -0
- package/dist/electron/ElectronFuseProvider.js +113 -0
- package/dist/electron/ElectronFuseReader.js +317 -0
- package/dist/evaluation/AgentEvaluationFixtures.js +194 -11
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +58 -49
- package/dist/evaluation/KnownAnswerEvaluation.js +126 -57
- package/dist/evm/EvmoleFailures.js +19 -16
- package/dist/evm/EvmoleInterfaceAdapter.js +5 -1
- package/dist/evm/EvmoleInterfaceProvider.js +198 -23
- package/dist/evm/EvmoleInterfaceWorker.js +2 -0
- package/dist/evm/SolidityMetadata.js +139 -0
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/OwnedStagedOutput.js +138 -0
- package/dist/filesystem/RegularFile.js +81 -5
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +35 -0
- package/dist/firmware/FirmwareCommand.js +27 -5
- package/dist/firmware/FirmwareFiles.js +18 -7
- package/dist/firmware/FirmwareProvider.js +158 -32
- package/dist/firmware/FirmwarePublication.js +242 -4
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/firmware/FirmwareReports.js +202 -12
- package/dist/flutter/DartElf.js +418 -0
- package/dist/flutter/ElfBuildId.js +137 -0
- package/dist/flutter/ElfLoadMap.js +91 -0
- package/dist/flutter/FlutterBuildProvider.js +826 -0
- package/dist/flutter/FlutterPayloadScan.js +180 -0
- package/dist/frida/FridaInstrumentationManager.js +1104 -0
- package/dist/gdb/GdbSessionManager.js +1451 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +175 -6
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +208 -29
- package/dist/ghidra/GhidraDiagnostics.js +18 -8
- package/dist/ghidra/GhidraDoctor.js +15 -12
- package/dist/ghidra/GhidraFunctionValues.js +73 -2
- package/dist/ghidra/GhidraInstallation.js +216 -20
- package/dist/ghidra/GhidraInstallationPolicy.js +79 -29
- package/dist/ghidra/GhidraInventoryValues.js +53 -1
- package/dist/ghidra/GhidraJavaLaunch.js +91 -10
- package/dist/ghidra/GhidraJavaProperties.js +117 -0
- package/dist/ghidra/GhidraLanguageCatalog.js +169 -0
- package/dist/ghidra/GhidraLauncher.js +306 -88
- package/dist/ghidra/GhidraLoadImageAttest.js +74 -7
- package/dist/ghidra/GhidraLoadImageValues.js +72 -0
- package/dist/ghidra/GhidraMipsProfile.js +315 -0
- package/dist/ghidra/GhidraPeProfile.js +21 -0
- package/dist/ghidra/GhidraPowerPcProfile.js +51 -0
- package/dist/ghidra/GhidraProvider.js +106 -20
- package/dist/ghidra/GhidraProviderCapabilities.js +30 -19
- package/dist/ghidra/GhidraProviderClient.js +520 -56
- package/dist/ghidra/GhidraPspExtension.js +140 -0
- package/dist/ghidra/GhidraPspProfile.js +59 -0
- package/dist/ghidra/GhidraRawBinaryLanguage.js +40 -0
- package/dist/ghidra/GhidraRiscvProfile.js +100 -0
- package/dist/ghidra/GhidraSessionError.js +155 -11
- package/dist/ghidra/GhidraSessionValues.js +75 -2
- package/dist/ghidra/GhidraTransport.js +2 -1
- package/dist/go/GoBinaryContainer.js +140 -0
- package/dist/go/GoBinaryImage.js +210 -0
- package/dist/go/GoBinaryProvider.js +151 -0
- package/dist/go/GoElfImage.js +211 -0
- package/dist/go/GoMachoImage.js +164 -0
- package/dist/go/GoModuleText.js +217 -0
- package/dist/go/GoPeImage.js +124 -0
- package/dist/hopper/BridgeLauncher.js +35 -2
- package/dist/hopper/HopperAnalysisProfile.js +21 -9
- package/dist/hopper/HopperCleanup.js +15 -3
- package/dist/hopper/HopperClient.js +203 -42
- package/dist/hopper/HopperMacPublisher.js +29 -0
- package/dist/hopper/HopperMachOImage.js +61 -27
- package/dist/hopper/HopperProcessDiagnostic.js +27 -0
- package/dist/hopper/HopperProvider.js +68 -26
- package/dist/hopper/HopperProviderCapabilities.js +7 -3
- package/dist/hopper/HopperRequestQueue.js +17 -5
- package/dist/hopper/HopperSessionValues.js +10 -1
- package/dist/hopper/HopperTargetLease.js +66 -19
- package/dist/ida/IdaBusyHealth.js +44 -0
- package/dist/ida/IdaCallGraph.js +134 -0
- package/dist/ida/IdaConfiguration.js +7 -2
- package/dist/ida/IdaDiagnosticRedactor.js +199 -0
- package/dist/ida/IdaDiagnosticWriter.js +62 -0
- package/dist/ida/IdaDoctor.js +7 -5
- package/dist/ida/IdaJsonDiagnostic.js +138 -0
- package/dist/ida/IdaMcpConnection.js +297 -27
- package/dist/ida/IdaNativeProtocol.js +93 -0
- package/dist/ida/IdaOperationRunner.js +249 -40
- package/dist/ida/IdaProtocolValues.js +86 -4
- package/dist/ida/IdaProvider.js +34 -8
- package/dist/ida/IdaProviderCapabilities.js +37 -8
- package/dist/ida/IdaSessionClient.js +332 -53
- package/dist/ida/IdaWorkspace.js +57 -7
- package/dist/inspector/V8InspectorCaptureProjection.js +7 -2
- package/dist/inspector/V8InspectorEndpoint.js +15 -13
- package/dist/inspector/V8InspectorProvider.js +41 -7
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +337 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +594 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +65 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +590 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +126 -0
- package/dist/javascript/recovery/RecoveryFiles.js +68 -12
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +30 -18
- package/dist/javascript/recovery/WakaruProvider.js +150 -24
- package/dist/javascript/recovery/WakaruPublication.js +38 -14
- package/dist/javascript/recovery/WakaruRelease.js +11 -4
- package/dist/javascript/recovery/WakaruReport.js +15 -9
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +2 -16
- package/dist/javascript/sourceMaps/SourceMapCommand.js +38 -7
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +84 -10
- package/dist/javascript/sourceMaps/SourceMapFormat.js +26 -28
- package/dist/javascript/sourceMaps/TraceSourceMap.js +34 -6
- package/dist/jeb/JebMcpConnection.js +186 -0
- package/dist/jeb/JebMcpEndpoint.js +45 -0
- package/dist/jeb/JebProvider.js +297 -0
- package/dist/logger.js +14 -1
- package/dist/main/shutdown.js +3 -0
- package/dist/main/transport.js +48 -4
- package/dist/main.js +14 -3
- package/dist/mcp/AnalysisSnapshotFiles-BAbiJQOc.js +1412 -0
- package/dist/mcp/ArtifactProvider-DViCU_rn.js +2183 -0
- package/dist/mcp/ArtifactProviderMetadata-b7pOK5_t.js +76 -0
- package/dist/mcp/ArtifactReader-OyM03Gjn.js +55 -0
- package/dist/mcp/ArtifactResourceScope-P3tq5z8Z.js +162 -0
- package/dist/mcp/AsarHeader-WsPgoooH.js +31 -0
- package/dist/mcp/BinarySessionStatus-B4P9gf-S.js +212 -0
- package/dist/mcp/BinaryTargetResolver-BMaE_0H1.js +1427 -0
- package/dist/mcp/BoundedFileBytes-DuczXiQZ.js +68 -0
- package/dist/mcp/CdpCaptureDocuments-HDiF2O7k.js +746 -0
- package/dist/mcp/CdpCaptureValues-M-j6CIh1.js +90 -0
- package/dist/mcp/CdpConnection-BpDfz4MK.js +570 -0
- package/dist/mcp/CdpOptionalCommand-BPjRD9Kz.js +120 -0
- package/dist/mcp/CdpTargetSession-BsPoKhEU.js +86 -0
- package/dist/mcp/DirectAnalysis-DrafbXke.js +409 -0
- package/dist/mcp/DirectAnalysisStatus-CjjeDLzW.js +44 -0
- package/dist/mcp/ElectronFileScope-BPG_YoyU.js +110 -0
- package/dist/mcp/InterfaceBuilderDecodeBudget-5F2AkxJT.js +652 -0
- package/dist/mcp/ManagedStaticProvider-BthZbKyZ.js +5028 -0
- package/dist/mcp/NativeMacOSProvider-Bh79k8dI.js +4867 -0
- package/dist/mcp/NativeMacOSProviderMetadata-N1lPOaY_.js +307 -0
- package/dist/mcp/ProcedureAddressResolution-CQpuwm1h.js +19 -0
- package/dist/mcp/ProcessOwnership-Bl_3ejLe.js +1502 -0
- package/dist/mcp/ProviderDeadline-DskQ94YD.js +932 -0
- package/dist/mcp/WorkflowEvidence-umWrB_wm.js +111 -0
- package/dist/mcp/analysisErrorCore-DXRTvF_m.js +235 -0
- package/dist/mcp/analysisErrorProjection-BN0EPM-3.js +892 -0
- package/dist/mcp/artifactOperationError-CkHMMaf7.js +27 -0
- package/dist/mcp/artifactToolContracts-Di4qZlEt.js +72 -0
- package/dist/mcp/browserObservation-C0s4i8UI.js +4468 -0
- package/dist/mcp/browserObservationError-CyLugqX4.js +40 -0
- package/dist/mcp/browserObservationSchemas-tgqjH7aA.js +573 -0
- package/dist/mcp/browserScenario-CAQ8Fns9.js +2929 -0
- package/dist/mcp/browserScenarioCapture-CTNFN-FI.js +479 -0
- package/dist/mcp/canonicalDigest-Bi_0_zGi.js +71 -0
- package/dist/mcp/digests-BFoWUT_-.js +223 -0
- package/dist/mcp/electronActiveObservation-lDvQTMR0.js +226 -0
- package/dist/mcp/electronObservation-DFOFEood.js +112 -0
- package/dist/mcp/electronObservation-i7LcILQ-.js +562 -0
- package/dist/mcp/electronScenario-nCzE6IfJ.js +653 -0
- package/dist/mcp/emptyArraySchema-tL6Qymyd.js +140 -0
- package/dist/mcp/enhancedInputs-DgdEnzHy.js +56 -0
- package/dist/mcp/javascriptRuntimeObservation-61NhCf7H.js +690 -0
- package/dist/mcp/javascriptRuntimeObservation-PIUoLfX6.js +121 -0
- package/dist/mcp/jsonSerialization-V-wWiFRE.js +152 -0
- package/dist/mcp/lipo-Bnkoq_6W.js +502 -0
- package/dist/mcp/localPath-AxvW9aPe.js +19 -0
- package/dist/mcp/logger-BQY5ulYv.js +48 -0
- package/dist/mcp/main-kBXHZ8S5.js +69390 -0
- package/dist/mcp/main.js +6 -0
- package/dist/mcp/managedToolContracts-CK--I_s7.js +101 -0
- package/dist/mcp/nativeValueTrace-DR9UE62L.js +3439 -0
- package/dist/mcp/officialToolContracts-B67NJ2tC.js +1413 -0
- package/dist/mcp/pngHeader-DQ-ObyY2.js +147 -0
- package/dist/mcp/propertyListKeys-DD25WsjI.js +553 -0
- package/dist/mcp/providerAdapterError-sDxToNal.js +25 -0
- package/dist/mcp/providerIdentities--ptAh481.js +31 -0
- package/dist/mcp/providerIdentity-BCQ5n5tw.js +16 -0
- package/dist/mcp/providerOperationHealth-CTYa3iLf.js +48 -0
- package/dist/mcp/rolldown-runtime-BjeaiXFo.js +121 -0
- package/dist/mcp/safeJson-NeGfpkrI.js +25 -0
- package/dist/mcp/scanCanonical-CRXSpule.js +3982 -0
- package/dist/mcp/serverIdentity-Cio4iFV3.js +1328 -0
- package/dist/mcp/sourceMapEnvelope-C0uJlrOh.js +94 -0
- package/dist/mcp/toolContracts-BW05wpcr.js +12200 -0
- package/dist/mcp/toolOutputSchemaGroups-ColvNZ1r.js +17533 -0
- package/dist/mcp/unicodeCodePointOrder-BezCbTpg.js +26 -0
- package/dist/mcp/webContentArtifact-Dzjc1z-R.js +284 -0
- package/dist/mcp/webRuntime-K__NYzXm.js +74 -0
- package/dist/mcp/webSourceLocation-DbMAT2J9.js +11130 -0
- package/dist/mcpDoctor.js +108 -76
- package/dist/mcpStartupPolicy.js +3 -0
- package/dist/native/AppleDispatchCoverage.js +81 -28
- package/dist/native/AppleDispatchMetadata.js +20 -9
- package/dist/native/AppleMachoFixups.js +253 -34
- package/dist/native/AppleMachoSelection.js +44 -17
- package/dist/native/AppleObjcCategories.js +1 -2
- package/dist/native/AppleObjcDispatchFacets.js +76 -7
- package/dist/native/CommandRunner.js +142 -32
- package/dist/native/LldbCallTracer.js +5 -3
- package/dist/native/MachoArchitectureSelection.js +50 -0
- package/dist/native/NativeCallObservation.js +2 -1
- package/dist/native/NativeMacOSProvider.js +173 -37
- package/dist/native/NativeMachoInspection.js +142 -78
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +6 -5
- package/dist/native/SignatureTargetBinding.js +118 -55
- package/dist/native/parsers/codesign.js +27 -10
- package/dist/native/parsers/demangle.js +7 -1
- package/dist/native/parsers/dyldInfo.js +73 -4
- package/dist/native/parsers/lipo.js +53 -19
- package/dist/native/parsers/machoUuid.js +150 -0
- package/dist/native/parsers/otool.js +232 -29
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +77 -0
- package/dist/native/pwndbg/PwndbgCoreContext.js +20 -20
- package/dist/native/pwntools/PwntoolsDecoder.js +264 -40
- package/dist/native/pwntools/PwntoolsFailures.js +2 -1
- package/dist/native/pwntools/PwntoolsInputLimit.js +27 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +27 -15
- package/dist/native/pwntools/PwntoolsResourceLimits.js +3 -3
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +12 -8
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +3 -1
- package/dist/objdump/ObjdumpCommand.js +21 -0
- package/dist/pcap/PcapCommand.js +146 -0
- package/dist/pcap/PcapConfiguration.js +93 -0
- package/dist/pcap/PcapNativeBound.js +58 -0
- package/dist/pcap/PcapOutput.js +240 -0
- package/dist/pcap/PcapProvider.js +424 -0
- package/dist/pcap/PcapSnapshot.js +171 -0
- package/dist/process/ArtifactAnalysisResources.js +213 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/CurrentEntrypointPath.js +6 -0
- package/dist/process/DarwinProcessRunTokenReader.js +125 -16
- package/dist/process/ExecFileBoundedOutput.js +44 -0
- package/dist/process/ExecFileOutput.js +30 -6
- package/dist/process/JavaScriptWorkerMemoryLimit.js +25 -0
- package/dist/process/LinuxResourceLimits.js +80 -0
- package/dist/process/MacCodeSignature.js +3 -0
- package/dist/process/OwnedCommand.js +40 -15
- package/dist/process/PrivateRuntimeRoot.js +9 -19
- package/dist/process/PrivateRuntimeRootUnavailableError.js +10 -0
- package/dist/process/ProcessOwnership.js +173 -128
- package/dist/process/ProcessOwnershipObservation.js +131 -43
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDeadline.js +58 -12
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +112 -14
- package/dist/process/WindowsAuthority.js +48 -39
- package/dist/process/WindowsBatchCommand.js +46 -0
- package/dist/process/boundedUtf8Text.js +13 -0
- package/dist/process/capture/FilesystemSnapshot.js +87 -12
- package/dist/process/capture/ProcessCaptureClock.js +2 -0
- package/dist/process/capture/ProcessCaptureError.js +22 -3
- package/dist/process/capture/ProcessCaptureJournal.js +2 -1
- package/dist/process/capture/ProcessCaptureLifecycle.js +433 -91
- package/dist/process/capture/ProcessCaptureProgress.js +63 -0
- package/dist/process/capture/ProcessHarness.js +209 -38
- package/dist/process/capture/ProcessNormalization.js +278 -34
- package/dist/process/capture/ProcessSampling.js +3 -2
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +18 -15
- package/dist/process/capture/TerminalRenderer.js +52 -14
- package/dist/process/ownedDebuggerSession.js +203 -0
- package/dist/reference/ReferenceSourceReader.js +22 -6
- package/dist/reference/ReferenceSourceReaderEntries.js +182 -105
- package/dist/reference/ReferenceSourceReaderErrors.js +17 -1
- package/dist/reference/ReferenceSourceReaderFile.js +50 -11
- package/dist/reference/ReferenceSourceReaderTypes.js +1 -2
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -5
- package/dist/rizin/RizinCommand.js +14 -0
- package/dist/rizin/RizinDebugSessionManager.js +1072 -0
- package/dist/rust/RustAuditableReader.js +309 -0
- package/dist/rust/RustBinaryImage.js +116 -0
- package/dist/rust/RustBinaryProvider.js +162 -0
- package/dist/server/EvidenceMcpServer.js +185 -27
- package/dist/server/admittedToolOperation.js +14 -0
- package/dist/server/contractToolHandler.js +28 -0
- package/dist/server/createServer.js +238 -36
- package/dist/server/externalMutationAdmission.js +50 -0
- package/dist/server/mcpProgress.js +4 -2
- package/dist/server/promptCompletion.js +19 -6
- package/dist/server/providerEnvironment.js +3 -0
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +9 -10
- package/dist/server/registerAndroidTools.js +22 -13
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -6
- 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/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +11 -3
- 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 +21 -1
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +14 -13
- package/dist/server/registerBundleComparisonTool.js +20 -6
- package/dist/server/registerCaptureTools.js +12 -0
- package/dist/server/registerCloseLifecycleTool.js +32 -3
- package/dist/server/registerCutterTools.js +33 -0
- package/dist/server/registerElectronTools.js +38 -17
- package/dist/server/registerEnhancedTools.js +7 -6
- package/dist/server/registerEvidenceTools.js +14 -10
- package/dist/server/registerEvmTools.js +24 -11
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFlutterTools.js +17 -0
- package/dist/server/registerFridaTools.js +205 -0
- package/dist/server/registerFunctionComparisonTool.js +34 -11
- package/dist/server/registerGdbTools.js +64 -0
- package/dist/server/registerGoTools.js +9 -0
- package/dist/server/registerInvestigationTools/helpers.js +2 -2
- package/dist/server/registerInvestigationTools.js +12 -8
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +10 -11
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedTools.js +11 -1
- 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/registerNativeTools.js +14 -0
- package/dist/server/registerOfficialTools.js +5 -0
- package/dist/server/registerPcapTools.js +35 -0
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +14 -4
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerReverseEngineeringTools.js +86 -0
- package/dist/server/registerRizinDebugTools.js +53 -0
- package/dist/server/registerRustTools.js +9 -0
- package/dist/server/registerSessionRecordTools.js +21 -14
- package/dist/server/registerSessionStatusTool.js +22 -4
- package/dist/server/registerSessionTools.js +78 -34
- package/dist/server/registerSignalTools.js +12 -0
- package/dist/server/registerSqliteTools.js +9 -0
- package/dist/server/registerWasmTools.js +46 -0
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +26 -17
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/retainedSummaryDelivery.js +28 -0
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/toolRegistrationOptions.js +8 -0
- package/dist/server/toolResult.js +68 -16
- package/dist/server/toolResultEncoding.js +36 -3
- package/dist/serverIdentity.js +17 -8
- package/dist/signals/SigrokRecordingProvider.js +339 -0
- package/dist/signals/parseDecoderDiscovery.js +65 -0
- package/dist/sqlite/SqliteDatabaseFailures.js +134 -0
- package/dist/sqlite/SqliteDatabaseInspection.js +421 -0
- package/dist/sqlite/SqliteDatabaseLimits.js +16 -0
- package/dist/sqlite/SqliteDatabaseProvider.js +295 -0
- package/dist/sqlite/SqliteDatabaseSnapshot.js +156 -0
- package/dist/sqlite/SqliteDatabaseWorker.js +46 -0
- package/dist/sqlite/SqliteDatabaseWorkerExecution.js +112 -0
- package/dist/wasm/WabtArtifactProvider.js +336 -0
- package/dist/wasm/WabtFailures.js +101 -0
- package/dist/wasm/WabtInterface.js +309 -0
- package/dist/wasm/WabtOutput.js +60 -0
- package/dist/wasm/WabtRelease.js +12 -0
- package/dist/wasm/WabtString.js +48 -0
- package/dist/wasm/WabtWat.js +147 -0
- package/dist/wasm/WasmGlueAdapter.js +53 -0
- package/dist/wasm/WasmInterfaceBudget.js +11 -0
- package/dist/windows/WindowsNativeLoader.js +37 -7
- package/dist/windows/WindowsOwnedProcess.js +150 -17
- package/dist/windows/WindowsPrivateRuntime.js +34 -6
- package/install.sh +157 -95
- package/licenses/Apache-2.0.txt +202 -0
- package/licenses/GCC-Runtime-Library-Exception-3.1.txt +73 -0
- package/licenses/GPL-3.0.txt +674 -0
- package/licenses/LGPL-2.0.txt +480 -0
- package/licenses/MIT-template.txt +18 -0
- package/licenses/MinGW-w64-runtime.txt +240 -0
- package/licenses/Node-22.19.0-LICENSE.txt +2666 -0
- package/licenses/README.md +68 -0
- package/licenses/cfworker-MIT.txt +21 -0
- package/licenses/dotnet-runtime-MIT.txt +23 -0
- package/licenses/frida-17.23.2-COPYING.txt +50 -0
- package/licenses/ghidra-12.1.4-DISCLAIMER.txt +13 -0
- package/licenses/ghidra-12.1.4-LICENSE.txt +201 -0
- package/licenses/ghidra-12.1.4-NOTICE.txt +49 -0
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/licenses/npm-dependencies.txt +3612 -0
- package/licenses/npm-runtime-notices.txt +8548 -0
- package/licenses/upstream-sources.json +72 -0
- package/licenses/xterm-MIT.txt +21 -0
- package/native/windows/README.md +92 -11
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +117 -22
- package/scripts/electron-active-hook.cjs +4 -1
- package/scripts/hopper-demo-x11.py +53 -3
- package/scripts/prepack.mjs +5 -0
- package/scripts/rea-android-workspace-guardian.mjs +46 -0
- package/scripts/rea.mjs +44 -13
- package/scripts/verify-windows-native-artifact.mjs +2 -2
- package/skills/reverse-engineer-anything/SKILL.md +142 -20
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +31 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +118 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +147 -16
- package/skills/reverse-engineer-anything/references/runtime-observation.md +57 -7
- package/third_party/README.md +1 -1
- package/third_party/wabt/README.md +24 -0
- package/dist/browser/history/HarCaptureAdapter.js +0 -20
- package/dist/cli/streamedJsonOutput.js +0 -135
- package/dist/cliJsonFile.js +0 -179
- /package/dist/{application/binary → process}/AbortablePromise.js +0 -0
|
@@ -0,0 +1,1412 @@
|
|
|
1
|
+
import { t as __esmMin } from "./rolldown-runtime-BjeaiXFo.js";
|
|
2
|
+
import { _ as ok, f as init_analysisErrorCore, g as init_result, h as err, i as AnalysisCancelledError, l as AnalysisResourceConstraintError, o as AnalysisInputError } from "./analysisErrorCore-DXRTvF_m.js";
|
|
3
|
+
import { E as init_configurationErrors, T as NoBinaryOpenError, c as EvidenceFileError, d as init_evidenceErrors, l as EvidenceIntegrityError, s as AnalysisSnapshotMismatchError } from "./analysisErrorProjection-BN0EPM-3.js";
|
|
4
|
+
import { Jt as committedProviderSchema, Kt as analysisProfileSchema, Qt as init_binaryTargetTypes, Xt as init_analysisProfile, Zt as BINARY_ARCHITECTURES, gt as init_canonicalJsonDigestSteps, ht as canonicalJsonDigestSteps, lt as init_evidence, mt as rebindEvidenceToTargetPath, ot as evidenceLocationSchema, pt as rebindEvidenceSubjectTargetPath, qt as analysisProfilesEqual, rn as relationshipCoverageSchema, tn as init_relationshipCoverage } from "./nativeValueTrace-DR9UE62L.js";
|
|
5
|
+
import { r as localPathStringSchema, t as init_localPath } from "./localPath-AxvW9aPe.js";
|
|
6
|
+
import { n as safeParseJson, t as init_safeJson } from "./safeJson-NeGfpkrI.js";
|
|
7
|
+
import { c as jsonValueSchema, d as freezeJsonSnapshot, i as prefixedDigestSchema, n as init_digests, o as init_jsonValue, p as init_immutableJson, s as jsonObjectSchema, t as digestSchema } from "./digests-BFoWUT_-.js";
|
|
8
|
+
import { n as compositeKey, r as init_unicodeCodePointOrder, t as compareUnicodeCodePoints } from "./unicodeCodePointOrder-BezCbTpg.js";
|
|
9
|
+
import { c as NonRegularFileReadError, d as init_RegularFile, h as init_OwnedFileHandle, m as OwnedFileHandle, u as RegularFileChangedError } from "./propertyListKeys-DD25WsjI.js";
|
|
10
|
+
import { Ca as rawBinaryEntryPointSchema, Jt as evidenceBundleSchema, Sa as init_rawBinary, Xt as parseEvidenceBundle, Yt as init_evidenceBundle, Zt as parseImmutableEvidenceBundle, qt as evidenceBundleForTarget, xa as binaryArchitectureSchema } from "./toolOutputSchemaGroups-ColvNZ1r.js";
|
|
11
|
+
import { n as init_officialToolContracts, t as OFFICIAL_TOOL_CONTRACTS } from "./officialToolContracts-B67NJ2tC.js";
|
|
12
|
+
import { a as init_RegularFileRead, c as withRegularFile, i as RegularFileCleanupFailure } from "./BinaryTargetResolver-BMaE_0H1.js";
|
|
13
|
+
import { r as init_ArtifactReader, t as ArtifactReaderFailure } from "./ArtifactReader-OyM03Gjn.js";
|
|
14
|
+
import { basename, dirname, resolve } from "node:path";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
import { createHash } from "node:crypto";
|
|
17
|
+
import { link, lstat, mkdtemp, open, readdir, realpath, rename, rmdir, unlink } from "node:fs/promises";
|
|
18
|
+
import canonicalize from "canonicalize";
|
|
19
|
+
import { pipeline } from "node:stream/promises";
|
|
20
|
+
import { constants } from "node:buffer";
|
|
21
|
+
import { setImmediate } from "node:timers/promises";
|
|
22
|
+
import { getHeapStatistics } from "node:v8";
|
|
23
|
+
import { asStream, none } from "stream-chain";
|
|
24
|
+
import fun from "stream-chain/fun.js";
|
|
25
|
+
import parser from "stream-json/parser.js";
|
|
26
|
+
import streamValues from "stream-json/streamers/stream-values.js";
|
|
27
|
+
import streamArray from "stream-json/streamers/stream-array.js";
|
|
28
|
+
|
|
29
|
+
//#region dist/domain/analysisSnapshot.js
|
|
30
|
+
var architectureSchema, formatSchema, kindSchema, subjectBaseSchema, subjectFormatSchema, subjectSchema, targetIdentitySchema, targetSchema, bindingSchema, entrySchema, workflowEntrySchema, analysisSnapshotSchema, preparedEntryBrand, preparedEntries, prepareSnapshotEntry, snapshotFileHeaderSchema, parsePreparedAnalysisSnapshot, contentDigest, snapshotContentDigest, evidenceContentDigest, canonicalJson, snapshotTarget, snapshotBinding, snapshotMatchesTarget, snapshotMatchesProfile, snapshotMatchesBinding, snapshotEvidenceForQuery, createAnalysisSnapshotWorkflowEntry, evidenceMatchesEntry, analysisQueryId, createAnalysisSnapshotEntry, validatedSnapshots, parseAnalysisSnapshot, immutableAnalysisSnapshot, sealSnapshot, restoreSnapshot, hasCanonicalQueryOrder, isCorrespondingEvidence, evidenceQueryKey, entryQueryKey, entryEvidenceKey, workflowEntryQueryKey, workflowEntryEvidenceKey, isWorkflowEvidence, evidenceMatchesWorkflowEntry, evidenceContentMetadata, serializeAnalysisSnapshot;
|
|
31
|
+
function init_analysisSnapshot() {
|
|
32
|
+
return (init_analysisSnapshot = __esmMin((() => {
|
|
33
|
+
init_unicodeCodePointOrder();
|
|
34
|
+
init_localPath();
|
|
35
|
+
init_analysisProfile();
|
|
36
|
+
init_binaryTargetTypes();
|
|
37
|
+
init_evidenceBundle();
|
|
38
|
+
init_evidence();
|
|
39
|
+
init_jsonValue();
|
|
40
|
+
init_digests();
|
|
41
|
+
init_canonicalJsonDigestSteps();
|
|
42
|
+
init_immutableJson();
|
|
43
|
+
init_rawBinary();
|
|
44
|
+
init_relationshipCoverage();
|
|
45
|
+
architectureSchema = z.enum(BINARY_ARCHITECTURES);
|
|
46
|
+
formatSchema = z.enum([
|
|
47
|
+
"analysis-database",
|
|
48
|
+
"mach-o",
|
|
49
|
+
"mach-o-universal",
|
|
50
|
+
"elf",
|
|
51
|
+
"pe",
|
|
52
|
+
"dos-mz",
|
|
53
|
+
"dos-com",
|
|
54
|
+
"raw-binary",
|
|
55
|
+
"zip",
|
|
56
|
+
"ipa",
|
|
57
|
+
"apk",
|
|
58
|
+
"msix",
|
|
59
|
+
"appx",
|
|
60
|
+
"hap",
|
|
61
|
+
"hsp",
|
|
62
|
+
"app-pack",
|
|
63
|
+
"asar",
|
|
64
|
+
"dmg",
|
|
65
|
+
"pkg",
|
|
66
|
+
"plist",
|
|
67
|
+
"javascript",
|
|
68
|
+
"source-map"
|
|
69
|
+
]);
|
|
70
|
+
kindSchema = z.enum([
|
|
71
|
+
"executable",
|
|
72
|
+
"database",
|
|
73
|
+
"archive",
|
|
74
|
+
"artifact"
|
|
75
|
+
]);
|
|
76
|
+
subjectBaseSchema = z.object({
|
|
77
|
+
path: localPathStringSchema,
|
|
78
|
+
sha256: digestSchema
|
|
79
|
+
});
|
|
80
|
+
subjectFormatSchema = z.enum([
|
|
81
|
+
...formatSchema.options,
|
|
82
|
+
"hopper",
|
|
83
|
+
"directory",
|
|
84
|
+
"file",
|
|
85
|
+
"unknown",
|
|
86
|
+
"javascript-bundle",
|
|
87
|
+
"entitlements"
|
|
88
|
+
]);
|
|
89
|
+
subjectSchema = z.discriminatedUnion("format", [subjectBaseSchema.extend({
|
|
90
|
+
format: subjectFormatSchema.exclude(["raw-binary"]),
|
|
91
|
+
architecture: architectureSchema.exclude(["6502"]).nullable()
|
|
92
|
+
}), subjectBaseSchema.extend({
|
|
93
|
+
format: z.literal("raw-binary"),
|
|
94
|
+
architecture: architectureSchema.nullable()
|
|
95
|
+
})]);
|
|
96
|
+
targetIdentitySchema = z.object({
|
|
97
|
+
sha256: digestSchema,
|
|
98
|
+
kind: kindSchema,
|
|
99
|
+
architecture: architectureSchema.nullable()
|
|
100
|
+
});
|
|
101
|
+
targetSchema = z.discriminatedUnion("format", [targetIdentitySchema.extend({
|
|
102
|
+
format: z.enum(formatSchema.options.filter((format) => format !== "raw-binary")),
|
|
103
|
+
architecture: architectureSchema.exclude(["6502"]).nullable()
|
|
104
|
+
}), targetIdentitySchema.extend({
|
|
105
|
+
format: z.literal("raw-binary"),
|
|
106
|
+
kind: z.literal("executable"),
|
|
107
|
+
architecture: binaryArchitectureSchema,
|
|
108
|
+
entry_point: rawBinaryEntryPointSchema
|
|
109
|
+
})]);
|
|
110
|
+
bindingSchema = z.object({
|
|
111
|
+
provider: committedProviderSchema,
|
|
112
|
+
analysis_profile: analysisProfileSchema
|
|
113
|
+
}).superRefine((binding, context) => {
|
|
114
|
+
if (binding.provider.id !== binding.analysis_profile.provider.id || binding.provider.name !== binding.analysis_profile.provider.name || binding.provider.version !== binding.analysis_profile.provider.version) context.addIssue({
|
|
115
|
+
code: "custom",
|
|
116
|
+
path: ["provider"],
|
|
117
|
+
message: "Snapshot binding provider does not match analysis profile"
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
entrySchema = z.object({
|
|
121
|
+
query_id: prefixedDigestSchema("query"),
|
|
122
|
+
operation: z.string().min(1),
|
|
123
|
+
parameters: jsonObjectSchema,
|
|
124
|
+
execution: z.object({
|
|
125
|
+
result: jsonValueSchema,
|
|
126
|
+
raw_result: jsonValueSchema.nullable(),
|
|
127
|
+
provider: committedProviderSchema,
|
|
128
|
+
limitations: z.array(z.string()),
|
|
129
|
+
relationship_coverage: relationshipCoverageSchema.nullable().default(null),
|
|
130
|
+
locations: z.array(evidenceLocationSchema),
|
|
131
|
+
subject: subjectSchema.nullable()
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
workflowEntrySchema = z.object({
|
|
135
|
+
query_id: prefixedDigestSchema("query"),
|
|
136
|
+
operation: z.string().min(1),
|
|
137
|
+
parameters: jsonObjectSchema,
|
|
138
|
+
execution: z.object({
|
|
139
|
+
result: jsonValueSchema,
|
|
140
|
+
raw_result: jsonValueSchema.nullable(),
|
|
141
|
+
provider: committedProviderSchema,
|
|
142
|
+
analysis_profile: analysisProfileSchema,
|
|
143
|
+
limitations: z.array(z.string()),
|
|
144
|
+
relationship_coverage: relationshipCoverageSchema.nullable().default(null),
|
|
145
|
+
locations: z.array(evidenceLocationSchema),
|
|
146
|
+
subject: subjectSchema.nullable()
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
analysisSnapshotSchema = z.object({
|
|
150
|
+
target: targetSchema,
|
|
151
|
+
binding: bindingSchema,
|
|
152
|
+
entries: z.array(entrySchema),
|
|
153
|
+
workflow_entries: z.array(workflowEntrySchema),
|
|
154
|
+
evidence_bundle: evidenceBundleSchema
|
|
155
|
+
});
|
|
156
|
+
preparedEntryBrand = Symbol("prepared-snapshot-entry");
|
|
157
|
+
preparedEntries = new WeakMap();
|
|
158
|
+
prepareSnapshotEntry = (input, kind) => {
|
|
159
|
+
const handle = Object.freeze({ [preparedEntryBrand]: true });
|
|
160
|
+
if (kind === "provider") {
|
|
161
|
+
const entry = entrySchema.parse(input);
|
|
162
|
+
const { result, raw_result, ...execution } = entry.execution;
|
|
163
|
+
preparedEntries.set(handle, {
|
|
164
|
+
kind,
|
|
165
|
+
entry: {
|
|
166
|
+
...entry,
|
|
167
|
+
execution
|
|
168
|
+
},
|
|
169
|
+
digest: snapshotContentDigest(result, raw_result, execution)
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
const entry = workflowEntrySchema.parse(input);
|
|
173
|
+
const { result, raw_result, ...execution } = entry.execution;
|
|
174
|
+
preparedEntries.set(handle, {
|
|
175
|
+
kind,
|
|
176
|
+
entry: {
|
|
177
|
+
...entry,
|
|
178
|
+
execution
|
|
179
|
+
},
|
|
180
|
+
digest: snapshotContentDigest(result, raw_result, execution)
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return handle;
|
|
184
|
+
};
|
|
185
|
+
snapshotFileHeaderSchema = z.object({
|
|
186
|
+
target: targetSchema,
|
|
187
|
+
binding: bindingSchema,
|
|
188
|
+
evidence_bundle: z.unknown()
|
|
189
|
+
});
|
|
190
|
+
parsePreparedAnalysisSnapshot = (input, entries, workflowEntries) => {
|
|
191
|
+
const header = snapshotFileHeaderSchema.parse(input);
|
|
192
|
+
const bundle = parseImmutableEvidenceBundle(header.evidence_bundle);
|
|
193
|
+
const providerRows = entries.map((handle) => {
|
|
194
|
+
const row = preparedEntries.get(handle);
|
|
195
|
+
if (row?.kind !== "provider") throw new TypeError("Analysis snapshot entry was not parsed in this realm");
|
|
196
|
+
return row;
|
|
197
|
+
});
|
|
198
|
+
const workflowRows = workflowEntries.map((handle) => {
|
|
199
|
+
const row = preparedEntries.get(handle);
|
|
200
|
+
if (row?.kind !== "workflow") throw new TypeError("Analysis snapshot workflow entry was not parsed in this realm");
|
|
201
|
+
return row;
|
|
202
|
+
});
|
|
203
|
+
const restored = sealSnapshot(restoreSnapshot(header, bundle, providerRows, workflowRows));
|
|
204
|
+
for (const handle of [...entries, ...workflowEntries]) preparedEntries.delete(handle);
|
|
205
|
+
return restored;
|
|
206
|
+
};
|
|
207
|
+
contentDigest = (value) => {
|
|
208
|
+
const steps = canonicalJsonDigestSteps(value);
|
|
209
|
+
let step = steps.next();
|
|
210
|
+
while (!step.done) step = steps.next();
|
|
211
|
+
return step.value;
|
|
212
|
+
};
|
|
213
|
+
snapshotContentDigest = (result, rawResult, execution) => {
|
|
214
|
+
const metadata = jsonObjectSchema.parse({
|
|
215
|
+
limitations: execution.limitations,
|
|
216
|
+
locations: execution.locations,
|
|
217
|
+
subject: execution.subject === null ? null : {
|
|
218
|
+
local_path: execution.subject.path,
|
|
219
|
+
sha256: execution.subject.sha256,
|
|
220
|
+
format: execution.subject.format,
|
|
221
|
+
architecture: execution.subject.architecture
|
|
222
|
+
},
|
|
223
|
+
...execution.relationship_coverage === null ? {} : { relationship_coverage: execution.relationship_coverage }
|
|
224
|
+
});
|
|
225
|
+
return contentDigest({
|
|
226
|
+
...metadata,
|
|
227
|
+
normalized_result: result,
|
|
228
|
+
raw_result: rawResult
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
evidenceContentDigest = (evidence) => {
|
|
232
|
+
return contentDigest({
|
|
233
|
+
...jsonObjectSchema.parse(evidenceContentMetadata(evidence)),
|
|
234
|
+
normalized_result: evidence.normalized_result,
|
|
235
|
+
raw_result: evidence.raw_result
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
canonicalJson = (value) => {
|
|
239
|
+
const json = jsonValueSchema.parse(value);
|
|
240
|
+
const encoded = canonicalize(json);
|
|
241
|
+
if (encoded === undefined) throw new TypeError("RFC 8785 canonicalization rejected snapshot data");
|
|
242
|
+
return encoded;
|
|
243
|
+
};
|
|
244
|
+
snapshotTarget = (target) => target.format === "raw-binary" ? {
|
|
245
|
+
sha256: target.sha256,
|
|
246
|
+
kind: target.kind,
|
|
247
|
+
architecture: target.architecture,
|
|
248
|
+
format: target.format,
|
|
249
|
+
entry_point: target.entryPoint
|
|
250
|
+
} : {
|
|
251
|
+
sha256: target.sha256,
|
|
252
|
+
kind: target.kind,
|
|
253
|
+
architecture: target.architecture ?? null,
|
|
254
|
+
format: target.format
|
|
255
|
+
};
|
|
256
|
+
snapshotBinding = (profile) => bindingSchema.parse({
|
|
257
|
+
provider: profile.provider,
|
|
258
|
+
analysis_profile: profile
|
|
259
|
+
});
|
|
260
|
+
snapshotMatchesTarget = (snapshot, target) => snapshot.sha256 === target.sha256 && snapshot.kind === target.kind && snapshot.format === target.format && snapshot.architecture === (target.architecture ?? null) && (snapshot.format !== "raw-binary" || target.format === "raw-binary" && snapshot.entry_point === target.entryPoint);
|
|
261
|
+
snapshotMatchesProfile = (binding, profile) => binding.provider.id === profile.provider.id && binding.provider.name === profile.provider.name && binding.provider.version === profile.provider.version && analysisProfilesEqual(binding.analysis_profile, profile);
|
|
262
|
+
snapshotMatchesBinding = (snapshot, target, profile) => snapshotMatchesTarget(snapshot.target, target) && snapshotMatchesProfile(snapshot.binding, profile);
|
|
263
|
+
snapshotEvidenceForQuery = (snapshot, query) => {
|
|
264
|
+
const { target, bindingProfile, operation, parameters, provider, evidenceProfile } = query;
|
|
265
|
+
if (!snapshotMatchesBinding(snapshot, target, bindingProfile)) return undefined;
|
|
266
|
+
const encodedParameters = canonicalJson(parameters);
|
|
267
|
+
const queryId = analysisQueryId(snapshot.target, snapshot.binding, operation, parameters);
|
|
268
|
+
const entry = snapshot.entries.find((candidate) => candidate.query_id === queryId);
|
|
269
|
+
const workflowEntry = snapshot.workflow_entries.find((candidate) => candidate.query_id === queryId);
|
|
270
|
+
if (entry === undefined && workflowEntry === undefined) return undefined;
|
|
271
|
+
const evidence = snapshot.evidence_bundle.records.find((record) => record.subject?.digest.sha256 === target.sha256 && record.operation === operation && record.provider.id === provider.id && record.provider.name === provider.name && record.provider.version === provider.version && record.analysis_profile !== null && analysisProfilesEqual(record.analysis_profile, evidenceProfile) && canonicalJson(record.parameters) === encodedParameters && (entry !== undefined && evidenceMatchesEntry(record, entry, snapshot) || workflowEntry !== undefined && evidenceMatchesWorkflowEntry(record, workflowEntry, snapshot)));
|
|
272
|
+
return evidence === undefined ? undefined : rebindEvidenceToTargetPath(evidence, target);
|
|
273
|
+
};
|
|
274
|
+
createAnalysisSnapshotWorkflowEntry = (input) => {
|
|
275
|
+
const { target, binding, operation, parameters, execution } = input;
|
|
276
|
+
if (execution.provider.id !== execution.analysisProfile.provider.id || execution.provider.name !== execution.analysisProfile.provider.name || execution.provider.version !== execution.analysisProfile.provider.version) throw new TypeError("Workflow snapshot execution provider does not match its profile");
|
|
277
|
+
return {
|
|
278
|
+
query_id: analysisQueryId(target, binding, operation, parameters),
|
|
279
|
+
operation,
|
|
280
|
+
parameters: jsonObjectSchema.parse(parameters),
|
|
281
|
+
execution: {
|
|
282
|
+
result: execution.result,
|
|
283
|
+
raw_result: execution.rawResult,
|
|
284
|
+
provider: execution.analysisProfile.provider,
|
|
285
|
+
analysis_profile: execution.analysisProfile,
|
|
286
|
+
limitations: [...execution.limitations],
|
|
287
|
+
relationship_coverage: execution.relationshipCoverage ?? null,
|
|
288
|
+
locations: [...execution.locations],
|
|
289
|
+
subject: execution.subject === null ? null : subjectSchema.parse({
|
|
290
|
+
...execution.subject,
|
|
291
|
+
architecture: execution.subject.architecture ?? null
|
|
292
|
+
})
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
evidenceMatchesEntry = (evidence, entry, snapshot) => isCorrespondingEvidence(evidence, snapshot) && compositeKey([evidenceQueryKey(evidence), evidenceContentDigest(evidence)]) === entryEvidenceKey(entry, snapshot.binding);
|
|
297
|
+
analysisQueryId = (target, binding, operation, parameters) => `query_${createHash("sha256").update(canonicalJson({
|
|
298
|
+
target,
|
|
299
|
+
binding,
|
|
300
|
+
operation,
|
|
301
|
+
parameters
|
|
302
|
+
})).digest("hex")}`;
|
|
303
|
+
createAnalysisSnapshotEntry = (input) => {
|
|
304
|
+
const { target, binding, operation, parameters, execution } = input;
|
|
305
|
+
if (execution.analysisProfile === undefined || !snapshotMatchesProfile(binding, execution.analysisProfile) || execution.provider.id !== binding.provider.id || execution.provider.name !== binding.provider.name || execution.provider.version !== binding.provider.version) throw new TypeError("Snapshot execution does not match its provider/profile binding");
|
|
306
|
+
return {
|
|
307
|
+
query_id: analysisQueryId(target, binding, operation, parameters),
|
|
308
|
+
operation,
|
|
309
|
+
parameters: jsonObjectSchema.parse(parameters),
|
|
310
|
+
execution: {
|
|
311
|
+
result: execution.result,
|
|
312
|
+
raw_result: execution.rawResult,
|
|
313
|
+
provider: binding.provider,
|
|
314
|
+
limitations: [...execution.limitations],
|
|
315
|
+
relationship_coverage: execution.relationshipCoverage ?? null,
|
|
316
|
+
locations: [...execution.locations],
|
|
317
|
+
subject: execution.subject === null ? null : subjectSchema.parse({
|
|
318
|
+
...execution.subject,
|
|
319
|
+
architecture: execution.subject.architecture ?? null
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
validatedSnapshots = new WeakMap();
|
|
325
|
+
parseAnalysisSnapshot = (input) => {
|
|
326
|
+
if (typeof input === "object" && input !== null) {
|
|
327
|
+
const owned = validatedSnapshots.get(input);
|
|
328
|
+
if (owned !== undefined) return owned;
|
|
329
|
+
}
|
|
330
|
+
const parsed = analysisSnapshotSchema.parse(input);
|
|
331
|
+
restoreSnapshot(parsed, parseEvidenceBundle(parsed.evidence_bundle), parsed.entries.map((entry) => ({
|
|
332
|
+
kind: "provider",
|
|
333
|
+
entry,
|
|
334
|
+
digest: snapshotContentDigest(entry.execution.result, entry.execution.raw_result, entry.execution)
|
|
335
|
+
})), parsed.workflow_entries.map((entry) => ({
|
|
336
|
+
kind: "workflow",
|
|
337
|
+
entry,
|
|
338
|
+
digest: snapshotContentDigest(entry.execution.result, entry.execution.raw_result, entry.execution)
|
|
339
|
+
})));
|
|
340
|
+
return parsed;
|
|
341
|
+
};
|
|
342
|
+
immutableAnalysisSnapshot = (input) => sealSnapshot(parseAnalysisSnapshot(input));
|
|
343
|
+
sealSnapshot = (snapshot) => {
|
|
344
|
+
for (const entry of [...snapshot.entries, ...snapshot.workflow_entries]) {
|
|
345
|
+
freezeJsonSnapshot(entry.execution.result);
|
|
346
|
+
freezeJsonSnapshot(entry.execution.raw_result);
|
|
347
|
+
}
|
|
348
|
+
freezeJsonSnapshot(snapshot);
|
|
349
|
+
validatedSnapshots.set(snapshot, snapshot);
|
|
350
|
+
return snapshot;
|
|
351
|
+
};
|
|
352
|
+
restoreSnapshot = (header, bundle, providerRows, workflowRows) => {
|
|
353
|
+
const scopedEvidence = evidenceBundleForTarget(bundle, header.target.sha256);
|
|
354
|
+
if (scopedEvidence.records.length !== bundle.records.length || scopedEvidence.unknowns.length !== bundle.unknowns.length) throw new TypeError("Analysis snapshot evidence contains records for another target");
|
|
355
|
+
if (!hasCanonicalQueryOrder(providerRows.map(({ entry }) => entry))) throw new TypeError("Analysis snapshot entries are not canonical");
|
|
356
|
+
if (!hasCanonicalQueryOrder(workflowRows.map(({ entry }) => entry))) throw new TypeError("Analysis snapshot workflow entries are not canonical");
|
|
357
|
+
const ids = new Set();
|
|
358
|
+
const corresponding = new Set();
|
|
359
|
+
const matching = new Map();
|
|
360
|
+
for (const evidence of bundle.records) {
|
|
361
|
+
if (evidence.predicate_type !== "rea.analysis" || evidence.authority !== "shipped-artifact" || evidence.subject?.digest.sha256 !== header.target.sha256 || evidence.analysis_profile === null || evidence.confidence !== "observed" && evidence.confidence !== "derived") continue;
|
|
362
|
+
if (evidence.confidence === "observed" && !isCorrespondingEvidence(evidence, header)) continue;
|
|
363
|
+
const query = compositeKey([evidence.confidence, evidenceQueryKey(evidence)]);
|
|
364
|
+
corresponding.add(query);
|
|
365
|
+
matching.set(compositeKey([query, evidenceContentDigest(evidence)]), evidence);
|
|
366
|
+
}
|
|
367
|
+
const find = (query, digest, label, operation) => {
|
|
368
|
+
const evidence = matching.get(compositeKey([query, digest]));
|
|
369
|
+
if (evidence !== undefined) return evidence;
|
|
370
|
+
throw new TypeError(corresponding.has(query) ? `Analysis snapshot ${label} ${operation} differs from its Evidence record` : `Analysis snapshot ${label} ${operation} has no profile-bound Evidence record`);
|
|
371
|
+
};
|
|
372
|
+
const checkId = (entry, workflow) => {
|
|
373
|
+
const expected = analysisQueryId(header.target, header.binding, entry.operation, entry.parameters);
|
|
374
|
+
if (entry.query_id !== expected) throw new TypeError(workflow ? "Analysis snapshot workflow query identifier does not match" : "Analysis snapshot query identifier does not match");
|
|
375
|
+
if (ids.has(entry.query_id)) throw new TypeError("Analysis snapshot contains duplicate queries");
|
|
376
|
+
ids.add(entry.query_id);
|
|
377
|
+
};
|
|
378
|
+
const entries = providerRows.map(({ entry, digest }) => {
|
|
379
|
+
if (entry.execution.provider.id !== header.binding.provider.id || entry.execution.provider.name !== header.binding.provider.name || entry.execution.provider.version !== header.binding.provider.version) throw new TypeError("Analysis snapshot entry provider does not match");
|
|
380
|
+
checkId(entry, false);
|
|
381
|
+
const evidence = find(compositeKey(["observed", entryQueryKey(entry, header.binding)]), digest, "entry", entry.operation);
|
|
382
|
+
return {
|
|
383
|
+
...entry,
|
|
384
|
+
execution: {
|
|
385
|
+
...entry.execution,
|
|
386
|
+
result: evidence.normalized_result,
|
|
387
|
+
raw_result: evidence.raw_result
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
});
|
|
391
|
+
const workflow_entries = workflowRows.map(({ entry, digest }) => {
|
|
392
|
+
const provider = entry.execution.analysis_profile.provider;
|
|
393
|
+
if (entry.execution.provider.id !== provider.id || entry.execution.provider.name !== provider.name || entry.execution.provider.version !== provider.version) throw new TypeError("Analysis snapshot workflow entry provider does not match its profile");
|
|
394
|
+
checkId(entry, true);
|
|
395
|
+
const evidence = find(compositeKey(["derived", workflowEntryQueryKey(entry)]), digest, "workflow entry", entry.operation);
|
|
396
|
+
return {
|
|
397
|
+
...entry,
|
|
398
|
+
execution: {
|
|
399
|
+
...entry.execution,
|
|
400
|
+
result: evidence.normalized_result,
|
|
401
|
+
raw_result: evidence.raw_result
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
});
|
|
405
|
+
return {
|
|
406
|
+
target: header.target,
|
|
407
|
+
binding: header.binding,
|
|
408
|
+
entries,
|
|
409
|
+
workflow_entries,
|
|
410
|
+
evidence_bundle: bundle
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
hasCanonicalQueryOrder = (entries) => {
|
|
414
|
+
let previous;
|
|
415
|
+
for (const { query_id: queryId } of entries) {
|
|
416
|
+
if (previous !== undefined && compareUnicodeCodePoints(previous, queryId) > 0) return false;
|
|
417
|
+
previous = queryId;
|
|
418
|
+
}
|
|
419
|
+
return true;
|
|
420
|
+
};
|
|
421
|
+
isCorrespondingEvidence = (evidence, snapshot) => evidence.predicate_type === "rea.analysis" && evidence.confidence === "observed" && evidence.authority === "shipped-artifact" && evidence.subject?.digest.sha256 === snapshot.target.sha256 && evidence.analysis_profile !== null && analysisProfilesEqual(evidence.analysis_profile, snapshot.binding.analysis_profile);
|
|
422
|
+
evidenceQueryKey = (evidence) => contentDigest({
|
|
423
|
+
operation: evidence.operation,
|
|
424
|
+
parameters: evidence.parameters,
|
|
425
|
+
provider: evidence.provider,
|
|
426
|
+
analysis_profile: evidence.analysis_profile
|
|
427
|
+
});
|
|
428
|
+
entryQueryKey = (entry, binding) => contentDigest({
|
|
429
|
+
operation: entry.operation,
|
|
430
|
+
parameters: entry.parameters,
|
|
431
|
+
provider: entry.execution.provider,
|
|
432
|
+
analysis_profile: binding.analysis_profile
|
|
433
|
+
});
|
|
434
|
+
entryEvidenceKey = (entry, binding) => compositeKey([entryQueryKey(entry, binding), snapshotContentDigest(entry.execution.result, entry.execution.raw_result, entry.execution)]);
|
|
435
|
+
workflowEntryQueryKey = (entry) => contentDigest({
|
|
436
|
+
operation: entry.operation,
|
|
437
|
+
parameters: entry.parameters,
|
|
438
|
+
provider: entry.execution.provider,
|
|
439
|
+
analysis_profile: entry.execution.analysis_profile
|
|
440
|
+
});
|
|
441
|
+
workflowEntryEvidenceKey = (entry) => compositeKey([workflowEntryQueryKey(entry), snapshotContentDigest(entry.execution.result, entry.execution.raw_result, entry.execution)]);
|
|
442
|
+
isWorkflowEvidence = (evidence, snapshot, entry) => evidence.predicate_type === "rea.analysis" && evidence.confidence === "derived" && evidence.authority === "shipped-artifact" && evidence.subject?.digest.sha256 === snapshot.target.sha256 && evidence.analysis_profile !== null && analysisProfilesEqual(evidence.analysis_profile, entry.execution.analysis_profile) && evidence.provider.id === entry.execution.provider.id && evidence.provider.name === entry.execution.provider.name && evidence.provider.version === entry.execution.provider.version;
|
|
443
|
+
evidenceMatchesWorkflowEntry = (evidence, entry, snapshot) => isWorkflowEvidence(evidence, snapshot, entry) && compositeKey([evidenceQueryKey(evidence), evidenceContentDigest(evidence)]) === workflowEntryEvidenceKey(entry);
|
|
444
|
+
evidenceContentMetadata = (evidence) => {
|
|
445
|
+
return {
|
|
446
|
+
limitations: evidence.limitations,
|
|
447
|
+
...evidence.relationship_coverage === null ? {} : { relationship_coverage: evidence.relationship_coverage },
|
|
448
|
+
locations: evidence.locations,
|
|
449
|
+
subject: evidence.subject === null ? null : {
|
|
450
|
+
local_path: evidence.subject.local_path,
|
|
451
|
+
sha256: evidence.subject.digest.sha256,
|
|
452
|
+
format: evidence.subject.format,
|
|
453
|
+
architecture: evidence.subject.architecture
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
serializeAnalysisSnapshot = (snapshot) => `${canonicalJson(parseAnalysisSnapshot(snapshot))}\n`;
|
|
458
|
+
})))();
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region dist/application/binary/AnalysisSnapshotCache.js
|
|
463
|
+
var RELATIONSHIP_OPERATIONS, STATEFUL_OPERATIONS, CURSOR_DEFAULT_OPERATIONS, DOCUMENT_SCOPED_OPERATIONS, SNAPSHOT_CACHE_ENTRY_CEILING, isSnapshotCacheable, requiresNativeSourceAdmissionBeforeReplay, AnalysisSnapshotCache;
|
|
464
|
+
function init_AnalysisSnapshotCache() {
|
|
465
|
+
return (init_AnalysisSnapshotCache = __esmMin((() => {
|
|
466
|
+
init_evidenceErrors();
|
|
467
|
+
init_configurationErrors();
|
|
468
|
+
init_evidence();
|
|
469
|
+
init_result();
|
|
470
|
+
init_analysisSnapshot();
|
|
471
|
+
init_officialToolContracts();
|
|
472
|
+
init_unicodeCodePointOrder();
|
|
473
|
+
RELATIONSHIP_OPERATIONS = new Set(["procedure_callers", "procedure_callees"]);
|
|
474
|
+
STATEFUL_OPERATIONS = new Set([
|
|
475
|
+
"health",
|
|
476
|
+
"current_address",
|
|
477
|
+
"current_procedure",
|
|
478
|
+
"current_document",
|
|
479
|
+
"goto_address",
|
|
480
|
+
"list_documents"
|
|
481
|
+
]);
|
|
482
|
+
CURSOR_DEFAULT_OPERATIONS = new Set([
|
|
483
|
+
"address_name",
|
|
484
|
+
"comment",
|
|
485
|
+
"inline_comment",
|
|
486
|
+
"next_address",
|
|
487
|
+
"prev_address",
|
|
488
|
+
"xrefs"
|
|
489
|
+
]);
|
|
490
|
+
DOCUMENT_SCOPED_OPERATIONS = new Set(OFFICIAL_TOOL_CONTRACTS.map(({ name }) => name).filter((name) => name !== "current_document" && name !== "list_documents"));
|
|
491
|
+
SNAPSHOT_CACHE_ENTRY_CEILING = 1e4;
|
|
492
|
+
isSnapshotCacheable = (operation, descriptor, parameters) => !STATEFUL_OPERATIONS.has(operation) && (!DOCUMENT_SCOPED_OPERATIONS.has(operation) || typeof parameters.document === "string") && (!CURSOR_DEFAULT_OPERATIONS.has(operation) || typeof parameters.address === "string") && descriptor?.effects.mutatesArtifact === false && descriptor.cachePolicy !== "live" && (descriptor.cachePolicy === "snapshot" || descriptor.effects.mayWriteFilesystem === false) && descriptor.effects.changesPermissions === false;
|
|
493
|
+
requiresNativeSourceAdmissionBeforeReplay = (providerId) => process.platform === "win32" && providerId === "ghidra";
|
|
494
|
+
AnalysisSnapshotCache = class {
|
|
495
|
+
#entries = new Map();
|
|
496
|
+
#workflowEntries = new Map();
|
|
497
|
+
#target;
|
|
498
|
+
#binding;
|
|
499
|
+
/** Whether staged entries belong to the supplied target and profile. */
|
|
500
|
+
matches(target, profile) {
|
|
501
|
+
return this.#target === undefined && this.#binding === undefined || this.#target !== undefined && this.#binding !== undefined && profile !== undefined && snapshotMatchesTarget(this.#target, target) && snapshotMatchesProfile(this.#binding, profile);
|
|
502
|
+
}
|
|
503
|
+
/** Replace cache state when the target or selected profile changes. */
|
|
504
|
+
select(target, profile) {
|
|
505
|
+
if (!this.matches(target, profile)) this.#clearEntries();
|
|
506
|
+
this.#target = snapshotTarget(target);
|
|
507
|
+
this.#binding = snapshotBinding(profile);
|
|
508
|
+
}
|
|
509
|
+
/** Merge already-validated entries and return the new-entry count. */
|
|
510
|
+
stage(snapshot) {
|
|
511
|
+
snapshot = immutableAnalysisSnapshot(snapshot);
|
|
512
|
+
if (this.#target !== undefined && JSON.stringify(this.#target) !== JSON.stringify(snapshot.target) || this.#binding !== undefined && !snapshotMatchesProfile(this.#binding, snapshot.binding.analysis_profile)) this.#clearEntries();
|
|
513
|
+
this.#target = structuredClone(snapshot.target);
|
|
514
|
+
this.#binding = structuredClone(snapshot.binding);
|
|
515
|
+
let imported = 0;
|
|
516
|
+
for (const entry of snapshot.entries) {
|
|
517
|
+
if (!this.#entries.has(entry.query_id) && !this.#hasCapacity()) continue;
|
|
518
|
+
if (!this.#entries.has(entry.query_id)) imported += 1;
|
|
519
|
+
this.#entries.set(entry.query_id, entry);
|
|
520
|
+
}
|
|
521
|
+
for (const entry of snapshot.workflow_entries) {
|
|
522
|
+
if (!this.#workflowEntries.has(entry.query_id) && !this.#hasCapacity()) continue;
|
|
523
|
+
this.#workflowEntries.set(entry.query_id, entry);
|
|
524
|
+
}
|
|
525
|
+
return imported;
|
|
526
|
+
}
|
|
527
|
+
/** Build a complete snapshot for an active target. */
|
|
528
|
+
export(target, profile, evidenceBundle) {
|
|
529
|
+
if (target === undefined || profile === undefined) return err(new NoBinaryOpenError());
|
|
530
|
+
try {
|
|
531
|
+
const snapshotTargetIdentity = snapshotTarget(target);
|
|
532
|
+
const binding = snapshotBinding(profile);
|
|
533
|
+
const entries = [...this.#entries.values()].sort((left, right) => compareUnicodeCodePoints(left.query_id, right.query_id));
|
|
534
|
+
const workflows = [...this.#workflowEntries.values()].sort((left, right) => compareUnicodeCodePoints(left.query_id, right.query_id));
|
|
535
|
+
return ok(parseAnalysisSnapshot({
|
|
536
|
+
target: snapshotTargetIdentity,
|
|
537
|
+
binding,
|
|
538
|
+
entries,
|
|
539
|
+
workflow_entries: workflows,
|
|
540
|
+
evidence_bundle: evidenceBundle
|
|
541
|
+
}));
|
|
542
|
+
} catch (cause) {
|
|
543
|
+
return err(new EvidenceIntegrityError("Analysis snapshot validation failed", { cause }));
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
/** Validate target identity, merge evidence atomically, then stage entries. */
|
|
547
|
+
import(snapshot, active, mergeEvidence) {
|
|
548
|
+
let validated;
|
|
549
|
+
try {
|
|
550
|
+
validated = immutableAnalysisSnapshot(snapshot);
|
|
551
|
+
} catch (cause) {
|
|
552
|
+
return err(new EvidenceIntegrityError("Analysis snapshot validation failed", { cause }));
|
|
553
|
+
}
|
|
554
|
+
if (active !== undefined && (!snapshotMatchesTarget(validated.target, active.target) || !snapshotMatchesProfile(validated.binding, active.profile))) return err(new AnalysisSnapshotMismatchError("Analysis snapshot profile_mismatch: target, provider, or analysis profile does not match the active binary"));
|
|
555
|
+
const importedEvidence = mergeEvidence(validated.evidence_bundle);
|
|
556
|
+
return importedEvidence.ok ? ok(this.stage(validated)) : importedEvidence;
|
|
557
|
+
}
|
|
558
|
+
/** Return canonical entries for persistence. */
|
|
559
|
+
entries() {
|
|
560
|
+
return [...this.#entries.values()].sort((left, right) => compareUnicodeCodePoints(left.query_id, right.query_id)).map((entry) => structuredClone(entry));
|
|
561
|
+
}
|
|
562
|
+
/** Return canonical composed-workflow entries for persistence. */
|
|
563
|
+
workflowEntries() {
|
|
564
|
+
return [...this.#workflowEntries.values()].sort((left, right) => compareUnicodeCodePoints(left.query_id, right.query_id)).map((entry) => structuredClone(entry));
|
|
565
|
+
}
|
|
566
|
+
/** Record one exact derived workflow result unless the shared cache is full. */
|
|
567
|
+
recordWorkflow(input) {
|
|
568
|
+
this.select(input.target, input.profile);
|
|
569
|
+
const queryId = analysisQueryId(snapshotTarget(input.target), snapshotBinding(input.profile), input.operation, input.parameters);
|
|
570
|
+
if (!this.#workflowEntries.has(queryId) && !this.#hasCapacity()) return;
|
|
571
|
+
const entry = createAnalysisSnapshotWorkflowEntry({
|
|
572
|
+
target: snapshotTarget(input.target),
|
|
573
|
+
binding: snapshotBinding(input.profile),
|
|
574
|
+
operation: input.operation,
|
|
575
|
+
parameters: input.parameters,
|
|
576
|
+
execution: input.execution
|
|
577
|
+
});
|
|
578
|
+
this.#workflowEntries.set(entry.query_id, entry);
|
|
579
|
+
}
|
|
580
|
+
/** Replay an exact provider-specific query, marking its cached provenance. */
|
|
581
|
+
lookup(target, profile, operation, parameters) {
|
|
582
|
+
const queryId = analysisQueryId(snapshotTarget(target), snapshotBinding(profile), operation, parameters);
|
|
583
|
+
const cached = this.#entries.get(queryId);
|
|
584
|
+
if (cached === undefined) return undefined;
|
|
585
|
+
const cachedSubject = cached.execution.subject;
|
|
586
|
+
const subject = cachedSubject === null ? null : rebindEvidenceSubjectTargetPath({
|
|
587
|
+
path: cachedSubject.path,
|
|
588
|
+
sha256: cachedSubject.sha256,
|
|
589
|
+
format: cachedSubject.format,
|
|
590
|
+
...cachedSubject.architecture === null ? {} : { architecture: cachedSubject.architecture }
|
|
591
|
+
}, target);
|
|
592
|
+
return structuredClone({
|
|
593
|
+
result: cached.execution.result,
|
|
594
|
+
rawResult: cached.execution.raw_result,
|
|
595
|
+
provider: cached.execution.provider,
|
|
596
|
+
analysisProfile: structuredClone(profile),
|
|
597
|
+
limitations: [...cached.execution.limitations, "Loaded from a local REA analysis snapshot; this call did not re-run the provider."],
|
|
598
|
+
...cached.execution.relationship_coverage === null && RELATIONSHIP_OPERATIONS.has(operation) ? { relationshipCoverage: {
|
|
599
|
+
status: "unknown",
|
|
600
|
+
reason: "Snapshot entry does not report relationship coverage."
|
|
601
|
+
} } : cached.execution.relationship_coverage === null ? {} : { relationshipCoverage: cached.execution.relationship_coverage },
|
|
602
|
+
locations: cached.execution.locations,
|
|
603
|
+
subject
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
/** Record one successful immutable call unless the cache is full. */
|
|
607
|
+
record(input) {
|
|
608
|
+
const { target, profile, operation, parameters, execution } = input;
|
|
609
|
+
this.select(target, profile);
|
|
610
|
+
if (execution.referencesTruncated === true) return;
|
|
611
|
+
const queryId = analysisQueryId(snapshotTarget(target), snapshotBinding(profile), operation, parameters);
|
|
612
|
+
if (!this.#entries.has(queryId) && !this.#hasCapacity()) return;
|
|
613
|
+
const entry = createAnalysisSnapshotEntry({
|
|
614
|
+
target: snapshotTarget(target),
|
|
615
|
+
binding: snapshotBinding(profile),
|
|
616
|
+
operation,
|
|
617
|
+
parameters,
|
|
618
|
+
execution
|
|
619
|
+
});
|
|
620
|
+
this.#entries.set(entry.query_id, entry);
|
|
621
|
+
}
|
|
622
|
+
/** Forget all target-bound entries. */
|
|
623
|
+
clear() {
|
|
624
|
+
this.#clearEntries();
|
|
625
|
+
this.#target = undefined;
|
|
626
|
+
this.#binding = undefined;
|
|
627
|
+
}
|
|
628
|
+
#clearEntries() {
|
|
629
|
+
this.#entries.clear();
|
|
630
|
+
this.#workflowEntries.clear();
|
|
631
|
+
}
|
|
632
|
+
#hasCapacity() {
|
|
633
|
+
return this.#entries.size + this.#workflowEntries.size < SNAPSHOT_CACHE_ENTRY_CEILING;
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
})))();
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
//#endregion
|
|
640
|
+
//#region dist/application/Utf8JsonInput.js
|
|
641
|
+
var JSON_INPUT_RESOURCE_REMEDIATION, JSON_BYTE_ORDER_MARK_MESSAGE, parseUtf8Json;
|
|
642
|
+
function init_Utf8JsonInput() {
|
|
643
|
+
return (init_Utf8JsonInput = __esmMin((() => {
|
|
644
|
+
init_analysisErrorCore();
|
|
645
|
+
init_safeJson();
|
|
646
|
+
JSON_INPUT_RESOURCE_REMEDIATION = "Provide a smaller valid JSON value. For Evidence workflows, re-analyze a smaller selection of the original target and use its complete Evidence; splitting JSON text or trimming Evidence fields does not produce valid workflow input.";
|
|
647
|
+
JSON_BYTE_ORDER_MARK_MESSAGE = "JSON input begins with a UTF-8 byte-order mark (EF BB BF), which strict JSON input does not accept. Save the file as UTF-8 without a byte-order mark.";
|
|
648
|
+
parseUtf8Json = (bytes, operation, path, boundary = "json-input") => {
|
|
649
|
+
const stringLimitFailure = (cause, decodedUnits) => new AnalysisResourceConstraintError(operation, "memory", "JSON input exceeds the runtime's maximum decoded string length", {
|
|
650
|
+
boundary,
|
|
651
|
+
input_path: path,
|
|
652
|
+
input_bytes: bytes.byteLength,
|
|
653
|
+
max_string_code_units: constants.MAX_STRING_LENGTH,
|
|
654
|
+
...decodedUnits === undefined ? {} : { decoded_string_code_units_at_least: decodedUnits }
|
|
655
|
+
}, {
|
|
656
|
+
...cause === undefined ? {} : { cause },
|
|
657
|
+
remediationAction: JSON_INPUT_RESOURCE_REMEDIATION
|
|
658
|
+
});
|
|
659
|
+
let text;
|
|
660
|
+
try {
|
|
661
|
+
const decoder = new TextDecoder("utf-8", {
|
|
662
|
+
fatal: true,
|
|
663
|
+
ignoreBOM: true
|
|
664
|
+
});
|
|
665
|
+
if (bytes.byteLength <= constants.MAX_STRING_LENGTH) {
|
|
666
|
+
text = decoder.decode(bytes);
|
|
667
|
+
} else {
|
|
668
|
+
const parts = [];
|
|
669
|
+
let decodedUnits = 0;
|
|
670
|
+
const append = (part) => {
|
|
671
|
+
decodedUnits += part.length;
|
|
672
|
+
if (decodedUnits > constants.MAX_STRING_LENGTH) throw stringLimitFailure(undefined, decodedUnits);
|
|
673
|
+
parts.push(part);
|
|
674
|
+
};
|
|
675
|
+
const chunkBytes = 1024 * 1024;
|
|
676
|
+
for (let offset = 0; offset < bytes.byteLength; offset += chunkBytes) append(decoder.decode(bytes.subarray(offset, offset + chunkBytes), { stream: true }));
|
|
677
|
+
append(decoder.decode());
|
|
678
|
+
text = parts.join("");
|
|
679
|
+
}
|
|
680
|
+
} catch (cause) {
|
|
681
|
+
if (cause instanceof AnalysisResourceConstraintError) throw cause;
|
|
682
|
+
const code = typeof cause === "object" && cause !== null && "code" in cause ? cause.code : undefined;
|
|
683
|
+
if (code === "ERR_STRING_TOO_LONG") throw stringLimitFailure(cause);
|
|
684
|
+
if (code !== "ERR_ENCODING_INVALID_ENCODED_DATA") throw cause;
|
|
685
|
+
return {
|
|
686
|
+
ok: false,
|
|
687
|
+
error: "JSON input is not valid UTF-8",
|
|
688
|
+
cause
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
if (text.startsWith("")) return {
|
|
692
|
+
ok: false,
|
|
693
|
+
error: JSON_BYTE_ORDER_MARK_MESSAGE,
|
|
694
|
+
cause: undefined
|
|
695
|
+
};
|
|
696
|
+
return safeParseJson(text);
|
|
697
|
+
};
|
|
698
|
+
})))();
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region dist/application/JsonInputFile.js
|
|
703
|
+
async function* decodedChunks(handle, admittedBytes, path, signal, observe) {
|
|
704
|
+
const decoder = new TextDecoder("utf-8", {
|
|
705
|
+
fatal: true,
|
|
706
|
+
ignoreBOM: true
|
|
707
|
+
});
|
|
708
|
+
let leading = true;
|
|
709
|
+
const checked = (text) => {
|
|
710
|
+
if (leading && text.length > 0) {
|
|
711
|
+
leading = false;
|
|
712
|
+
if (text.startsWith("")) throw new JsonByteOrderMarkError();
|
|
713
|
+
}
|
|
714
|
+
return text;
|
|
715
|
+
};
|
|
716
|
+
const bytes = Buffer.allocUnsafe(READ_CHUNK_BYTES);
|
|
717
|
+
let observedBytes = 0;
|
|
718
|
+
while (true) {
|
|
719
|
+
signal?.throwIfAborted();
|
|
720
|
+
const read = await handle.read(bytes, 0, Math.min(bytes.length, admittedBytes - observedBytes + 1), observedBytes);
|
|
721
|
+
signal?.throwIfAborted();
|
|
722
|
+
if (read.bytesRead === 0) break;
|
|
723
|
+
observedBytes += read.bytesRead;
|
|
724
|
+
if (observedBytes > admittedBytes) throw new RegularFileChangedError(path);
|
|
725
|
+
const chunk = bytes.subarray(0, read.bytesRead);
|
|
726
|
+
observe?.(chunk);
|
|
727
|
+
yield checked(decoder.decode(chunk, { stream: true }));
|
|
728
|
+
}
|
|
729
|
+
if (observedBytes !== admittedBytes) throw new RegularFileChangedError(path);
|
|
730
|
+
yield checked(decoder.decode());
|
|
731
|
+
}
|
|
732
|
+
var READ_CHUNK_BYTES, PACKED_TOKEN_PART_CODE_UNITS, NATIVE_PARSE_READ_BUDGET, nativeParseFits, readJsonObjectFile, memberConsumer, readJsonInputFile, jsonReadFailure, packJsonScalars, admitJsonAssembly, requireStringAssemblyHeadroom, JsonByteOrderMarkError, readPrefix, readNativeJson, invalidJson;
|
|
733
|
+
function init_JsonInputFile() {
|
|
734
|
+
return (init_JsonInputFile = __esmMin((() => {
|
|
735
|
+
init_RegularFile();
|
|
736
|
+
init_RegularFileRead();
|
|
737
|
+
init_Utf8JsonInput();
|
|
738
|
+
init_analysisErrorCore();
|
|
739
|
+
init_result();
|
|
740
|
+
READ_CHUNK_BYTES = 64 * 1024;
|
|
741
|
+
PACKED_TOKEN_PART_CODE_UNITS = 64 * 1024;
|
|
742
|
+
NATIVE_PARSE_READ_BUDGET = 8 * 1024 * 1024;
|
|
743
|
+
nativeParseFits = (inputBytes) => inputBytes <= NATIVE_PARSE_READ_BUDGET && inputBytes * 72 + READ_CHUNK_BYTES <= getHeapStatistics().total_available_size;
|
|
744
|
+
readJsonObjectFile = (path, operation, scans, signal, resources) => withRegularFile(path, async (handle, stats) => {
|
|
745
|
+
let previousDigest;
|
|
746
|
+
try {
|
|
747
|
+
const native = await readNativeJson(handle, stats.size, path, operation, signal);
|
|
748
|
+
if (native !== undefined) {
|
|
749
|
+
if (!native.ok) return native;
|
|
750
|
+
const value = native.value;
|
|
751
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return err(invalidJson(operation, "JSON document root must be an object"));
|
|
752
|
+
for (const members of scans) for (const [key, member] of members) {
|
|
753
|
+
if (!Object.hasOwn(value, key)) continue;
|
|
754
|
+
signal?.throwIfAborted();
|
|
755
|
+
member.begin();
|
|
756
|
+
const selected = Reflect.get(value, key);
|
|
757
|
+
if (member.mode === "array" && !Array.isArray(selected)) {
|
|
758
|
+
member.reject(new TypeError(`JSON member ${key} must be an array`));
|
|
759
|
+
continue;
|
|
760
|
+
}
|
|
761
|
+
for (const item of member.mode === "array" && Array.isArray(selected) ? selected : [selected]) {
|
|
762
|
+
signal?.throwIfAborted();
|
|
763
|
+
try {
|
|
764
|
+
await member.accept(item);
|
|
765
|
+
} catch (cause) {
|
|
766
|
+
member.reject(cause);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
return ok(undefined);
|
|
771
|
+
}
|
|
772
|
+
for (const members of scans) {
|
|
773
|
+
const hash = createHash("sha256");
|
|
774
|
+
let rootObject = false;
|
|
775
|
+
let depth = 0;
|
|
776
|
+
let key;
|
|
777
|
+
let consume;
|
|
778
|
+
await pipeline(decodedChunks(handle, stats.size, path, signal, (bytes) => {
|
|
779
|
+
hash.update(bytes);
|
|
780
|
+
}), asStream(fun(parser({
|
|
781
|
+
jsonStreaming: false,
|
|
782
|
+
streamValues: false,
|
|
783
|
+
packKeys: false,
|
|
784
|
+
packStrings: false,
|
|
785
|
+
packNumbers: false
|
|
786
|
+
}), packJsonScalars(operation, stats.size, path), (token) => {
|
|
787
|
+
const opens = token.name === "startObject" || token.name === "startArray";
|
|
788
|
+
const closes = token.name === "endObject" || token.name === "endArray";
|
|
789
|
+
if (depth === 0) {
|
|
790
|
+
rootObject = token.name === "startObject";
|
|
791
|
+
} else if (rootObject && depth === 1 && token.name === "keyValue") {
|
|
792
|
+
key = token.value;
|
|
793
|
+
} else if (rootObject && depth === 1 && !closes) {
|
|
794
|
+
const member = key === undefined ? undefined : members.get(key);
|
|
795
|
+
consume = undefined;
|
|
796
|
+
if (member !== undefined) {
|
|
797
|
+
member.begin();
|
|
798
|
+
if (member.mode === "array" && token.name !== "startArray") {
|
|
799
|
+
member.reject(new TypeError(`JSON member ${key} must be an array`));
|
|
800
|
+
} else {
|
|
801
|
+
consume = memberConsumer(member, operation, stats.size, path);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
key = undefined;
|
|
805
|
+
}
|
|
806
|
+
const selected = consume;
|
|
807
|
+
if (opens) depth += 1;
|
|
808
|
+
if (closes) depth -= 1;
|
|
809
|
+
if (rootObject && depth === 1 && token.name !== "keyValue") consume = undefined;
|
|
810
|
+
if (selected === undefined) return none;
|
|
811
|
+
return selected(token);
|
|
812
|
+
})), signal === undefined ? {} : { signal });
|
|
813
|
+
if (!rootObject) return err(invalidJson(operation, "JSON document root must be an object"));
|
|
814
|
+
const digest = hash.digest("hex");
|
|
815
|
+
if (previousDigest !== undefined && digest !== previousDigest) throw new RegularFileChangedError(path);
|
|
816
|
+
previousDigest = digest;
|
|
817
|
+
}
|
|
818
|
+
return ok(undefined);
|
|
819
|
+
} catch (cause) {
|
|
820
|
+
const failure = jsonReadFailure(cause, operation, stats.size, path);
|
|
821
|
+
if (failure !== undefined) return err(failure);
|
|
822
|
+
throw cause;
|
|
823
|
+
}
|
|
824
|
+
}, {
|
|
825
|
+
signal,
|
|
826
|
+
...resources === undefined ? {} : { resources }
|
|
827
|
+
});
|
|
828
|
+
memberConsumer = (member, operation, size, path) => {
|
|
829
|
+
let admit = admitJsonAssembly(operation, size, path);
|
|
830
|
+
const streamer = member.mode === "array" ? streamArray() : streamValues();
|
|
831
|
+
const consume = fun((token) => admit(token), streamer, (row) => {
|
|
832
|
+
if (typeof row !== "object" || row === null || !("value" in row)) throw new Error("Unexpected JSON member parser result");
|
|
833
|
+
admit = admitJsonAssembly(operation, size, path);
|
|
834
|
+
try {
|
|
835
|
+
const accepted = member.accept(row.value);
|
|
836
|
+
if (accepted instanceof Promise) return accepted.then(() => none, (cause) => {
|
|
837
|
+
member.reject(cause);
|
|
838
|
+
return none;
|
|
839
|
+
});
|
|
840
|
+
} catch (cause) {
|
|
841
|
+
member.reject(cause);
|
|
842
|
+
}
|
|
843
|
+
return none;
|
|
844
|
+
});
|
|
845
|
+
return (token) => {
|
|
846
|
+
const consumed = consume(token);
|
|
847
|
+
return consumed instanceof Promise ? consumed.then(() => none) : none;
|
|
848
|
+
};
|
|
849
|
+
};
|
|
850
|
+
readJsonInputFile = (path, operation, signal, resources) => withRegularFile(path, async (handle, stats) => {
|
|
851
|
+
let found = false;
|
|
852
|
+
let value;
|
|
853
|
+
try {
|
|
854
|
+
const native = await readNativeJson(handle, stats.size, path, operation, signal);
|
|
855
|
+
if (native !== undefined) return native;
|
|
856
|
+
await pipeline(decodedChunks(handle, stats.size, path, signal), asStream(fun(parser({
|
|
857
|
+
jsonStreaming: false,
|
|
858
|
+
streamValues: false,
|
|
859
|
+
packKeys: false,
|
|
860
|
+
packStrings: false,
|
|
861
|
+
packNumbers: false
|
|
862
|
+
}), packJsonScalars(operation, stats.size, path), admitJsonAssembly(operation, stats.size, path), streamValues(), (row) => {
|
|
863
|
+
if (found || typeof row !== "object" || row === null || !("key" in row) || row.key !== 0 || !("value" in row)) throw new Error("Unexpected JSON parser result");
|
|
864
|
+
found = true;
|
|
865
|
+
value = row.value;
|
|
866
|
+
return none;
|
|
867
|
+
})), signal === undefined ? {} : { signal });
|
|
868
|
+
return found ? ok(value) : err(invalidJson(operation, "JSON document is empty"));
|
|
869
|
+
} catch (cause) {
|
|
870
|
+
const failure = jsonReadFailure(cause, operation, stats.size, path);
|
|
871
|
+
if (failure !== undefined) return err(failure);
|
|
872
|
+
throw cause;
|
|
873
|
+
}
|
|
874
|
+
}, {
|
|
875
|
+
signal,
|
|
876
|
+
...resources === undefined ? {} : { resources }
|
|
877
|
+
});
|
|
878
|
+
jsonReadFailure = (cause, operation, size, path) => {
|
|
879
|
+
if (cause instanceof AnalysisResourceConstraintError) return cause;
|
|
880
|
+
if (cause instanceof TypeError && "code" in cause && cause.code === "ERR_ENCODING_INVALID_ENCODED_DATA") return invalidJson(operation, "JSON input is not valid UTF-8", cause);
|
|
881
|
+
if (cause instanceof SyntaxError || cause instanceof Error && cause.message.startsWith("Parser ")) return invalidJson(operation, cause.message, cause);
|
|
882
|
+
if (cause instanceof Error && (cause instanceof RangeError && cause.message === "Invalid string length" || "code" in cause && cause.code === "ERR_STRING_TOO_LONG")) return new AnalysisResourceConstraintError(operation, "memory", "An individual JSON string or number token exceeds the runtime string limit", {
|
|
883
|
+
input_path: path,
|
|
884
|
+
input_file_bytes: size,
|
|
885
|
+
max_string_code_units: constants.MAX_STRING_LENGTH
|
|
886
|
+
}, {
|
|
887
|
+
cause,
|
|
888
|
+
remediationAction: JSON_INPUT_RESOURCE_REMEDIATION
|
|
889
|
+
});
|
|
890
|
+
return undefined;
|
|
891
|
+
};
|
|
892
|
+
packJsonScalars = (operation, inputFileBytes, path) => {
|
|
893
|
+
let kind;
|
|
894
|
+
let length = 0;
|
|
895
|
+
let value = "";
|
|
896
|
+
let parts = [];
|
|
897
|
+
let partLength = 0;
|
|
898
|
+
return (token) => {
|
|
899
|
+
if (typeof token !== "object" || token === null || !("name" in token)) throw new Error("Unexpected JSON parser token");
|
|
900
|
+
switch (token.name) {
|
|
901
|
+
case "startKey":
|
|
902
|
+
case "startString":
|
|
903
|
+
kind = token.name === "startKey" ? "keyValue" : "stringValue";
|
|
904
|
+
break;
|
|
905
|
+
case "startNumber":
|
|
906
|
+
kind = "numberValue";
|
|
907
|
+
break;
|
|
908
|
+
case "numberChunk":
|
|
909
|
+
case "stringChunk":
|
|
910
|
+
if (kind === undefined || !("value" in token) || typeof token.value !== "string") throw new Error("Unexpected JSON scalar fragment");
|
|
911
|
+
length += token.value.length;
|
|
912
|
+
if (length > constants.MAX_STRING_LENGTH) throw new RangeError("Invalid string length");
|
|
913
|
+
parts.push(token.value);
|
|
914
|
+
partLength += token.value.length;
|
|
915
|
+
if (partLength >= PACKED_TOKEN_PART_CODE_UNITS) {
|
|
916
|
+
requireStringAssemblyHeadroom(operation, inputFileBytes, path, length);
|
|
917
|
+
value += parts.join("");
|
|
918
|
+
parts = [];
|
|
919
|
+
partLength = 0;
|
|
920
|
+
}
|
|
921
|
+
break;
|
|
922
|
+
case "endKey":
|
|
923
|
+
case "endString":
|
|
924
|
+
case "endNumber": {
|
|
925
|
+
if (kind === undefined) throw new Error("Unexpected JSON scalar end");
|
|
926
|
+
requireStringAssemblyHeadroom(operation, inputFileBytes, path, length);
|
|
927
|
+
const packed = {
|
|
928
|
+
name: kind,
|
|
929
|
+
value: value + parts.join("")
|
|
930
|
+
};
|
|
931
|
+
kind = undefined;
|
|
932
|
+
length = 0;
|
|
933
|
+
value = "";
|
|
934
|
+
parts = [];
|
|
935
|
+
partLength = 0;
|
|
936
|
+
return packed;
|
|
937
|
+
}
|
|
938
|
+
default: return token;
|
|
939
|
+
}
|
|
940
|
+
return none;
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
admitJsonAssembly = (operation, inputFileBytes, path) => {
|
|
944
|
+
let projectedBytes = 0;
|
|
945
|
+
let nextCheck = 0;
|
|
946
|
+
return (token) => {
|
|
947
|
+
if (typeof token !== "object" || token === null || !("name" in token)) throw new Error("Unexpected JSON assembly token");
|
|
948
|
+
if (token.name === "startObject" || token.name === "startArray") {
|
|
949
|
+
projectedBytes += 128;
|
|
950
|
+
} else if (token.name === "keyValue" || token.name === "stringValue") {
|
|
951
|
+
if (!("value" in token) || typeof token.value !== "string") throw new Error("Unexpected packed JSON string");
|
|
952
|
+
projectedBytes += 64 + token.value.length * 2;
|
|
953
|
+
} else if (token.name === "numberValue" || token.name === "nullValue" || token.name === "trueValue" || token.name === "falseValue") {
|
|
954
|
+
projectedBytes += 64;
|
|
955
|
+
}
|
|
956
|
+
if (projectedBytes >= nextCheck) {
|
|
957
|
+
const heap = getHeapStatistics();
|
|
958
|
+
const requiredBytes = projectedBytes + READ_CHUNK_BYTES;
|
|
959
|
+
if (requiredBytes > heap.total_available_size) throw new AnalysisResourceConstraintError(operation, "memory", "Insufficient heap headroom to materialize the complete JSON value", {
|
|
960
|
+
input_path: path,
|
|
961
|
+
input_file_bytes: inputFileBytes,
|
|
962
|
+
projected_value_bytes: projectedBytes,
|
|
963
|
+
assembly_headroom_bytes: requiredBytes,
|
|
964
|
+
available_heap_bytes: heap.total_available_size,
|
|
965
|
+
heap_size_limit_bytes: heap.heap_size_limit
|
|
966
|
+
}, { remediationAction: JSON_INPUT_RESOURCE_REMEDIATION });
|
|
967
|
+
nextCheck = projectedBytes + READ_CHUNK_BYTES;
|
|
968
|
+
}
|
|
969
|
+
return token;
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
requireStringAssemblyHeadroom = (operation, inputFileBytes, path, stringCodeUnits) => {
|
|
973
|
+
if (stringCodeUnits < PACKED_TOKEN_PART_CODE_UNITS) return;
|
|
974
|
+
const heap = getHeapStatistics();
|
|
975
|
+
const requiredBytes = 2 * (stringCodeUnits + PACKED_TOKEN_PART_CODE_UNITS);
|
|
976
|
+
if (requiredBytes > heap.total_available_size) throw new AnalysisResourceConstraintError(operation, "memory", "Insufficient heap headroom to assemble a complete JSON string", {
|
|
977
|
+
input_path: path,
|
|
978
|
+
input_file_bytes: inputFileBytes,
|
|
979
|
+
string_code_units: stringCodeUnits,
|
|
980
|
+
string_assembly_headroom_bytes: requiredBytes,
|
|
981
|
+
available_heap_bytes: heap.total_available_size,
|
|
982
|
+
heap_size_limit_bytes: heap.heap_size_limit
|
|
983
|
+
}, { remediationAction: JSON_INPUT_RESOURCE_REMEDIATION });
|
|
984
|
+
};
|
|
985
|
+
JsonByteOrderMarkError = class extends SyntaxError {
|
|
986
|
+
constructor() {
|
|
987
|
+
super(JSON_BYTE_ORDER_MARK_MESSAGE);
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
readPrefix = async (handle, size, signal) => {
|
|
991
|
+
const bytes = Buffer.allocUnsafe(size);
|
|
992
|
+
let offset = 0;
|
|
993
|
+
while (offset < bytes.length) {
|
|
994
|
+
signal?.throwIfAborted();
|
|
995
|
+
const read = await handle.read(bytes, offset, bytes.length - offset, null);
|
|
996
|
+
signal?.throwIfAborted();
|
|
997
|
+
if (read.bytesRead === 0) return {
|
|
998
|
+
bytes: bytes.subarray(0, offset),
|
|
999
|
+
complete: true
|
|
1000
|
+
};
|
|
1001
|
+
offset += read.bytesRead;
|
|
1002
|
+
}
|
|
1003
|
+
return {
|
|
1004
|
+
bytes,
|
|
1005
|
+
complete: false
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
readNativeJson = async (handle, size, path, operation, signal) => {
|
|
1009
|
+
if (!nativeParseFits(size)) return undefined;
|
|
1010
|
+
const prefix = await readPrefix(handle, size + 1, signal);
|
|
1011
|
+
if (!prefix.complete || prefix.bytes.length !== size) throw new RegularFileChangedError(path);
|
|
1012
|
+
const parsed = parseUtf8Json(prefix.bytes, operation, path, "json-file-input");
|
|
1013
|
+
return parsed.ok ? ok(parsed.value) : err(invalidJson(operation, parsed.error, parsed.cause));
|
|
1014
|
+
};
|
|
1015
|
+
invalidJson = (operation, message, cause) => new AnalysisInputError(operation, cause === undefined ? undefined : { cause }, [{
|
|
1016
|
+
path: [],
|
|
1017
|
+
reason: "invalid_format",
|
|
1018
|
+
expected: "JSON",
|
|
1019
|
+
message
|
|
1020
|
+
}]);
|
|
1021
|
+
})))();
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
//#endregion
|
|
1025
|
+
//#region dist/filesystem/OwnedStagedOutput.js
|
|
1026
|
+
var identityOf, sameIdentity, OwnedStagedOutput, errorCode;
|
|
1027
|
+
function init_OwnedStagedOutput() {
|
|
1028
|
+
return (init_OwnedStagedOutput = __esmMin((() => {
|
|
1029
|
+
init_OwnedFileHandle();
|
|
1030
|
+
identityOf = (stats) => ({
|
|
1031
|
+
dev: stats.dev,
|
|
1032
|
+
ino: stats.ino
|
|
1033
|
+
});
|
|
1034
|
+
sameIdentity = (stats, identity) => stats.dev === identity.dev && stats.ino === identity.ino;
|
|
1035
|
+
OwnedStagedOutput = class OwnedStagedOutput {
|
|
1036
|
+
directory;
|
|
1037
|
+
directoryIdentity;
|
|
1038
|
+
#file;
|
|
1039
|
+
#fileIdentity;
|
|
1040
|
+
#fileRemovedByOwner = false;
|
|
1041
|
+
#publishedRename = false;
|
|
1042
|
+
#closeAttempt;
|
|
1043
|
+
#closed = false;
|
|
1044
|
+
#identityFailure;
|
|
1045
|
+
constructor(directory, directoryIdentity) {
|
|
1046
|
+
this.directory = directory;
|
|
1047
|
+
this.directoryIdentity = directoryIdentity;
|
|
1048
|
+
}
|
|
1049
|
+
static async create(directory) {
|
|
1050
|
+
try {
|
|
1051
|
+
const stats = await lstat(directory);
|
|
1052
|
+
if (!stats.isDirectory() || stats.isSymbolicLink()) return new OwnedStagedOutput(directory, undefined);
|
|
1053
|
+
return new OwnedStagedOutput(directory, identityOf(stats));
|
|
1054
|
+
} catch (cause) {
|
|
1055
|
+
const owner = new OwnedStagedOutput(directory, undefined);
|
|
1056
|
+
owner.#identityFailure = cause;
|
|
1057
|
+
return owner;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
async setFile(file) {
|
|
1061
|
+
if (this.#file !== undefined) throw new Error("Staged output already owns a file handle");
|
|
1062
|
+
this.#file = file;
|
|
1063
|
+
try {
|
|
1064
|
+
this.#fileIdentity = identityOf(await file.handle.stat());
|
|
1065
|
+
} catch (cause) {
|
|
1066
|
+
this.#identityFailure = cause;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
/** Verify that the path still names the exact closed file before publication. */
|
|
1070
|
+
async assertReadyForPublication(content) {
|
|
1071
|
+
await this.#verifiedDirectory();
|
|
1072
|
+
if (this.#fileIdentity === undefined) throw new Error("Cannot verify staged file identity", { cause: this.#identityFailure });
|
|
1073
|
+
const stagedFile = await lstat(content);
|
|
1074
|
+
if (!stagedFile.isFile() || stagedFile.isSymbolicLink() || !sameIdentity(stagedFile, this.#fileIdentity)) throw new Error(`Staged file identity changed: ${content}`);
|
|
1075
|
+
}
|
|
1076
|
+
closeFile() {
|
|
1077
|
+
return this.#file?.close() ?? Promise.resolve();
|
|
1078
|
+
}
|
|
1079
|
+
/** Record that the staged file moved to the published destination by rename. */
|
|
1080
|
+
recordPublishedRename() {
|
|
1081
|
+
this.#publishedRename = true;
|
|
1082
|
+
}
|
|
1083
|
+
/** Close the owned descriptor and remove only the exact staged entries. */
|
|
1084
|
+
close() {
|
|
1085
|
+
if (this.#closed) return Promise.resolve();
|
|
1086
|
+
if (this.#closeAttempt !== undefined) return this.#closeAttempt;
|
|
1087
|
+
const attempt = Promise.resolve().then(() => this.#cleanup());
|
|
1088
|
+
this.#closeAttempt = attempt;
|
|
1089
|
+
void attempt.then(() => {
|
|
1090
|
+
this.#closed = true;
|
|
1091
|
+
this.#closeAttempt = undefined;
|
|
1092
|
+
}, () => {
|
|
1093
|
+
this.#closeAttempt = undefined;
|
|
1094
|
+
});
|
|
1095
|
+
return attempt;
|
|
1096
|
+
}
|
|
1097
|
+
async #cleanup() {
|
|
1098
|
+
await this.closeFile();
|
|
1099
|
+
await this.#verifiedDirectory();
|
|
1100
|
+
const content = `${this.directory}/content`;
|
|
1101
|
+
let stagedFile;
|
|
1102
|
+
try {
|
|
1103
|
+
stagedFile = await lstat(content);
|
|
1104
|
+
} catch (cause) {
|
|
1105
|
+
if (errorCode(cause) === "ENOENT" && (this.#file === undefined || this.#fileRemovedByOwner || this.#publishedRename)) {
|
|
1106
|
+
stagedFile = undefined;
|
|
1107
|
+
} else if (errorCode(cause) === "ENOENT") {
|
|
1108
|
+
throw new Error(`Owned staged file disappeared: ${content}`, { cause });
|
|
1109
|
+
} else {
|
|
1110
|
+
throw cause;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
if (stagedFile !== undefined) {
|
|
1114
|
+
if (!stagedFile.isFile() || stagedFile.isSymbolicLink() || this.#fileIdentity === undefined || !sameIdentity(stagedFile, this.#fileIdentity)) throw new Error(`Staged file identity changed: ${content}`);
|
|
1115
|
+
await unlink(content);
|
|
1116
|
+
this.#fileRemovedByOwner = true;
|
|
1117
|
+
}
|
|
1118
|
+
const remaining = await readdir(this.directory);
|
|
1119
|
+
if (remaining.length > 0) throw new Error(`Unexpected staging entries remain in ${this.directory}: ${remaining.join(", ")}`);
|
|
1120
|
+
await this.#verifiedDirectory();
|
|
1121
|
+
await rmdir(this.directory);
|
|
1122
|
+
}
|
|
1123
|
+
async #verifiedDirectory() {
|
|
1124
|
+
if (this.directoryIdentity === undefined) throw new Error(`Cannot verify staging directory ownership: ${this.directory}`, { cause: this.#identityFailure });
|
|
1125
|
+
const directory = await lstat(this.directory);
|
|
1126
|
+
if (!directory.isDirectory() || directory.isSymbolicLink() || !sameIdentity(directory, this.directoryIdentity)) throw new Error(`Staging directory identity changed: ${this.directory}`);
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
errorCode = (cause) => typeof cause === "object" && cause !== null && "code" in cause ? cause.code : undefined;
|
|
1130
|
+
})))();
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
//#endregion
|
|
1134
|
+
//#region dist/application/JsonFiles.js
|
|
1135
|
+
function writeTextParts(parts, path, overwrite, resources, cancellation) {
|
|
1136
|
+
return resources.run(() => writeTextPartsOwned(parts, path, overwrite, resources, cancellation)).catch((cause) => {
|
|
1137
|
+
const cleanup = cause instanceof ArtifactReaderFailure && cause.cleanup !== undefined ? cause.cleanup : undefined;
|
|
1138
|
+
return err(new EvidenceFileError("write", "io", {
|
|
1139
|
+
cause,
|
|
1140
|
+
path: resolve(path),
|
|
1141
|
+
...cleanup === undefined ? {} : { cleanup }
|
|
1142
|
+
}));
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
var readJsonFile, readJsonObjectMembersFile, readJsonFileInput, writeTextFile, writeTextPartsOwned, missingOrIo, publishFile, StagedOutputCleanupFailure, failureMessage, writeStagedParts, assertWriteActive, fileErrorCode;
|
|
1146
|
+
function init_JsonFiles() {
|
|
1147
|
+
return (init_JsonFiles = __esmMin((() => {
|
|
1148
|
+
init_evidenceErrors();
|
|
1149
|
+
init_analysisErrorCore();
|
|
1150
|
+
init_result();
|
|
1151
|
+
init_JsonInputFile();
|
|
1152
|
+
init_RegularFile();
|
|
1153
|
+
init_RegularFileRead();
|
|
1154
|
+
init_ArtifactReader();
|
|
1155
|
+
init_OwnedFileHandle();
|
|
1156
|
+
init_OwnedStagedOutput();
|
|
1157
|
+
readJsonFile = async (path, signal, resources) => readJsonFileInput(path, (selected) => readJsonInputFile(selected, "read_evidence_file", signal, resources), signal);
|
|
1158
|
+
readJsonObjectMembersFile = (path, scans, signal, resources) => readJsonFileInput(path, (selected) => readJsonObjectFile(selected, "read_evidence_file", scans, signal, resources), signal);
|
|
1159
|
+
readJsonFileInput = async (path, read, signal) => {
|
|
1160
|
+
const requestedPath = resolve(path);
|
|
1161
|
+
try {
|
|
1162
|
+
const decoded = await read(requestedPath);
|
|
1163
|
+
if (!decoded.ok) {
|
|
1164
|
+
if (decoded.error instanceof AnalysisResourceConstraintError) return err(decoded.error);
|
|
1165
|
+
return err(new EvidenceFileError("read", "invalid-json", {
|
|
1166
|
+
cause: decoded.error.cause ?? new SyntaxError(decoded.error.issues[0]?.message ?? decoded.error.message),
|
|
1167
|
+
path: requestedPath
|
|
1168
|
+
}));
|
|
1169
|
+
}
|
|
1170
|
+
return ok(decoded.value);
|
|
1171
|
+
} catch (cause) {
|
|
1172
|
+
if (cause instanceof RegularFileCleanupFailure) throw cause;
|
|
1173
|
+
if (cause instanceof AnalysisResourceConstraintError) return err(cause);
|
|
1174
|
+
if (signal?.aborted === true) throw cause;
|
|
1175
|
+
return err(new EvidenceFileError("read", cause instanceof NonRegularFileReadError ? "not-file" : missingOrIo(cause), {
|
|
1176
|
+
cause,
|
|
1177
|
+
path: requestedPath
|
|
1178
|
+
}));
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
writeTextFile = async (encoded, path, overwrite, resources) => writeTextParts([encoded], path, overwrite, resources);
|
|
1182
|
+
writeTextPartsOwned = async (parts, path, overwrite, resources, cancellation) => {
|
|
1183
|
+
const requestedPath = resolve(path);
|
|
1184
|
+
try {
|
|
1185
|
+
assertWriteActive(cancellation);
|
|
1186
|
+
const canonicalParent = await realpath(dirname(requestedPath));
|
|
1187
|
+
const destination = resolve(canonicalParent, basename(requestedPath));
|
|
1188
|
+
const existing = await lstat(destination).catch((cause) => {
|
|
1189
|
+
if (fileErrorCode(cause) === "ENOENT") return undefined;
|
|
1190
|
+
throw cause;
|
|
1191
|
+
});
|
|
1192
|
+
if (existing !== undefined) {
|
|
1193
|
+
if (!overwrite) return err(new EvidenceFileError("write", "exists", { path: requestedPath }));
|
|
1194
|
+
if (!existing.isFile() || existing.isSymbolicLink()) return err(new EvidenceFileError("write", "not-file", { path: requestedPath }));
|
|
1195
|
+
}
|
|
1196
|
+
assertWriteActive(cancellation);
|
|
1197
|
+
const bytes = await publishFile(destination, parts, overwrite, resources, cancellation);
|
|
1198
|
+
return ok({
|
|
1199
|
+
path: requestedPath,
|
|
1200
|
+
bytes
|
|
1201
|
+
});
|
|
1202
|
+
} catch (cause) {
|
|
1203
|
+
if (cause instanceof StagedOutputCleanupFailure) {
|
|
1204
|
+
const cleanup = {
|
|
1205
|
+
reason: failureMessage(cause.cleanupCause),
|
|
1206
|
+
resources: [cause.owner.directory]
|
|
1207
|
+
};
|
|
1208
|
+
if (cause.outcome.ok) return err(new EvidenceFileError("write", "io", {
|
|
1209
|
+
cause,
|
|
1210
|
+
path: requestedPath,
|
|
1211
|
+
cleanup,
|
|
1212
|
+
published: {
|
|
1213
|
+
...cause.outcome.value,
|
|
1214
|
+
path: requestedPath
|
|
1215
|
+
}
|
|
1216
|
+
}));
|
|
1217
|
+
if (cause.outcome.error instanceof AnalysisCancelledError) return err(new AnalysisCancelledError(cause.outcome.error.operation, {
|
|
1218
|
+
cause,
|
|
1219
|
+
cleanup
|
|
1220
|
+
}));
|
|
1221
|
+
return err(new EvidenceFileError("write", missingOrIo(cause.outcome.error), {
|
|
1222
|
+
cause,
|
|
1223
|
+
path: requestedPath,
|
|
1224
|
+
cleanup
|
|
1225
|
+
}));
|
|
1226
|
+
}
|
|
1227
|
+
if (cancellation?.signal.aborted === true && cause instanceof AnalysisCancelledError && cause.operation === cancellation.operation) return err(cause);
|
|
1228
|
+
if (!overwrite && fileErrorCode(cause) === "EEXIST") return err(new EvidenceFileError("write", "exists", {
|
|
1229
|
+
cause,
|
|
1230
|
+
path: requestedPath
|
|
1231
|
+
}));
|
|
1232
|
+
return err(new EvidenceFileError("write", missingOrIo(cause), {
|
|
1233
|
+
cause,
|
|
1234
|
+
path: requestedPath
|
|
1235
|
+
}));
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
missingOrIo = (cause) => {
|
|
1239
|
+
const code = fileErrorCode(cause);
|
|
1240
|
+
return code === "ENOENT" || code === "ENOTDIR" ? "missing" : "io";
|
|
1241
|
+
};
|
|
1242
|
+
publishFile = async (destination, parts, overwrite, resources, cancellation) => {
|
|
1243
|
+
const stagingDirectory = await mkdtemp(resolve(dirname(destination), ".rea-write-"));
|
|
1244
|
+
const owner = await OwnedStagedOutput.create(stagingDirectory);
|
|
1245
|
+
let outcome;
|
|
1246
|
+
const staged = resolve(stagingDirectory, "content");
|
|
1247
|
+
try {
|
|
1248
|
+
const file = await open(staged, "wx", 384);
|
|
1249
|
+
await owner.setFile(new OwnedFileHandle(file));
|
|
1250
|
+
let written;
|
|
1251
|
+
try {
|
|
1252
|
+
const bytes = await writeStagedParts(file, parts, cancellation);
|
|
1253
|
+
assertWriteActive(cancellation);
|
|
1254
|
+
await file.sync();
|
|
1255
|
+
written = ok(bytes);
|
|
1256
|
+
} catch (cause) {
|
|
1257
|
+
written = err(cause);
|
|
1258
|
+
}
|
|
1259
|
+
try {
|
|
1260
|
+
await owner.closeFile();
|
|
1261
|
+
} catch (cause) {
|
|
1262
|
+
if (written.ok) written = err(cause);
|
|
1263
|
+
}
|
|
1264
|
+
if (!written.ok) throw written.error;
|
|
1265
|
+
assertWriteActive(cancellation);
|
|
1266
|
+
await owner.assertReadyForPublication(staged);
|
|
1267
|
+
assertWriteActive(cancellation);
|
|
1268
|
+
if (overwrite) {
|
|
1269
|
+
await rename(staged, destination);
|
|
1270
|
+
owner.recordPublishedRename();
|
|
1271
|
+
} else await link(staged, destination);
|
|
1272
|
+
outcome = ok({
|
|
1273
|
+
path: destination,
|
|
1274
|
+
bytes: written.value
|
|
1275
|
+
});
|
|
1276
|
+
} catch (cause) {
|
|
1277
|
+
outcome = err(cause);
|
|
1278
|
+
}
|
|
1279
|
+
const released = await resources.release({
|
|
1280
|
+
kind: "staged-output",
|
|
1281
|
+
resource: owner.directory,
|
|
1282
|
+
output: owner
|
|
1283
|
+
});
|
|
1284
|
+
if (released.kind === "failed") throw new StagedOutputCleanupFailure(outcome, released.cause, owner);
|
|
1285
|
+
if (!outcome.ok) throw outcome.error;
|
|
1286
|
+
return outcome.value.bytes;
|
|
1287
|
+
};
|
|
1288
|
+
StagedOutputCleanupFailure = class extends Error {
|
|
1289
|
+
outcome;
|
|
1290
|
+
cleanupCause;
|
|
1291
|
+
owner;
|
|
1292
|
+
constructor(outcome, cleanupCause, owner) {
|
|
1293
|
+
super("Staged output cleanup failed", { cause: outcome.ok ? cleanupCause : outcome.error });
|
|
1294
|
+
this.outcome = outcome;
|
|
1295
|
+
this.cleanupCause = cleanupCause;
|
|
1296
|
+
this.owner = owner;
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1299
|
+
failureMessage = (cause) => cause instanceof Error ? cause.message || cause.name : String(cause);
|
|
1300
|
+
writeStagedParts = async (file, parts, cancellation) => {
|
|
1301
|
+
assertWriteActive(cancellation);
|
|
1302
|
+
const iterator = parts[Symbol.iterator]();
|
|
1303
|
+
let exhausted = false;
|
|
1304
|
+
let bytes = 0;
|
|
1305
|
+
try {
|
|
1306
|
+
for (;;) {
|
|
1307
|
+
assertWriteActive(cancellation);
|
|
1308
|
+
const part = iterator.next();
|
|
1309
|
+
if (part.done) exhausted = true;
|
|
1310
|
+
assertWriteActive(cancellation);
|
|
1311
|
+
if (part.done) return bytes;
|
|
1312
|
+
await file.writeFile(part.value, { encoding: "utf8" });
|
|
1313
|
+
bytes += Buffer.byteLength(part.value, "utf8");
|
|
1314
|
+
}
|
|
1315
|
+
} finally {
|
|
1316
|
+
if (!exhausted) iterator.return?.();
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
assertWriteActive = (cancellation) => {
|
|
1320
|
+
if (cancellation?.signal.aborted === true) throw new AnalysisCancelledError(cancellation.operation);
|
|
1321
|
+
};
|
|
1322
|
+
fileErrorCode = (cause) => typeof cause === "object" && cause !== null && "code" in cause ? cause.code : undefined;
|
|
1323
|
+
})))();
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
//#endregion
|
|
1327
|
+
//#region dist/application/binary/AnalysisSnapshotFiles.js
|
|
1328
|
+
var readAnalysisSnapshot, snapshotEntryReader, writeAnalysisSnapshot, snapshotValidationMessage;
|
|
1329
|
+
function init_AnalysisSnapshotFiles() {
|
|
1330
|
+
return (init_AnalysisSnapshotFiles = __esmMin((() => {
|
|
1331
|
+
init_analysisSnapshot();
|
|
1332
|
+
init_evidenceErrors();
|
|
1333
|
+
init_result();
|
|
1334
|
+
init_analysisErrorCore();
|
|
1335
|
+
init_JsonFiles();
|
|
1336
|
+
init_RegularFileRead();
|
|
1337
|
+
readAnalysisSnapshot = async (path, signal, resources) => {
|
|
1338
|
+
const entries = snapshotEntryReader("provider");
|
|
1339
|
+
const workflows = snapshotEntryReader("workflow");
|
|
1340
|
+
const header = {};
|
|
1341
|
+
const metadata = new Map([
|
|
1342
|
+
"target",
|
|
1343
|
+
"binding",
|
|
1344
|
+
"evidence_bundle"
|
|
1345
|
+
].map((name) => [name, {
|
|
1346
|
+
mode: "value",
|
|
1347
|
+
begin: () => {
|
|
1348
|
+
delete header[name];
|
|
1349
|
+
},
|
|
1350
|
+
accept: (value) => {
|
|
1351
|
+
header[name] = value;
|
|
1352
|
+
},
|
|
1353
|
+
reject: (cause) => {
|
|
1354
|
+
throw cause;
|
|
1355
|
+
}
|
|
1356
|
+
}]));
|
|
1357
|
+
try {
|
|
1358
|
+
const loaded = await readJsonObjectMembersFile(path, [new Map([["entries", entries.reader], ["workflow_entries", workflows.reader]]), metadata], signal, resources);
|
|
1359
|
+
if (!loaded.ok) return loaded;
|
|
1360
|
+
signal?.throwIfAborted();
|
|
1361
|
+
const snapshot = parsePreparedAnalysisSnapshot(header, entries.finish(), workflows.finish());
|
|
1362
|
+
await setImmediate();
|
|
1363
|
+
signal?.throwIfAborted();
|
|
1364
|
+
return ok(snapshot);
|
|
1365
|
+
} catch (cause) {
|
|
1366
|
+
if (cause instanceof RegularFileCleanupFailure) throw cause;
|
|
1367
|
+
if (signal?.aborted === true) return err(new AnalysisCancelledError("read_evidence_file", { cause }));
|
|
1368
|
+
return err(new EvidenceIntegrityError(snapshotValidationMessage(cause), { cause }));
|
|
1369
|
+
}
|
|
1370
|
+
};
|
|
1371
|
+
snapshotEntryReader = (kind) => {
|
|
1372
|
+
let seen = false;
|
|
1373
|
+
let entries = [];
|
|
1374
|
+
let failure;
|
|
1375
|
+
const reader = {
|
|
1376
|
+
mode: "array",
|
|
1377
|
+
begin: () => {
|
|
1378
|
+
seen = true;
|
|
1379
|
+
entries = [];
|
|
1380
|
+
failure = undefined;
|
|
1381
|
+
},
|
|
1382
|
+
accept: (value) => {
|
|
1383
|
+
if (failure === undefined) entries.push(prepareSnapshotEntry(value, kind));
|
|
1384
|
+
},
|
|
1385
|
+
reject: (cause) => {
|
|
1386
|
+
failure ??= { cause };
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
return {
|
|
1390
|
+
reader,
|
|
1391
|
+
finish: () => {
|
|
1392
|
+
if (!seen) throw new TypeError(`Analysis snapshot ${kind === "provider" ? "entries" : "workflow_entries"} is missing`);
|
|
1393
|
+
if (failure !== undefined) throw failure.cause;
|
|
1394
|
+
return entries;
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
};
|
|
1398
|
+
writeAnalysisSnapshot = async (snapshot, path, overwrite, resources) => {
|
|
1399
|
+
let encoded;
|
|
1400
|
+
try {
|
|
1401
|
+
encoded = serializeAnalysisSnapshot(snapshot);
|
|
1402
|
+
} catch (cause) {
|
|
1403
|
+
return err(new EvidenceIntegrityError(snapshotValidationMessage(cause), { cause }));
|
|
1404
|
+
}
|
|
1405
|
+
return writeTextFile(encoded, path, overwrite, resources);
|
|
1406
|
+
};
|
|
1407
|
+
snapshotValidationMessage = (cause) => cause instanceof TypeError ? cause.message : "Analysis snapshot validation failed";
|
|
1408
|
+
})))();
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
//#endregion
|
|
1412
|
+
export { readJsonFile as a, init_AnalysisSnapshotCache as c, init_analysisSnapshot as d, snapshotEvidenceForQuery as f, snapshotTarget as h, init_JsonFiles as i, isSnapshotCacheable as l, snapshotMatchesTarget as m, readAnalysisSnapshot as n, writeTextParts as o, snapshotMatchesBinding as p, writeAnalysisSnapshot as r, AnalysisSnapshotCache as s, init_AnalysisSnapshotFiles as t, requiresNativeSourceAdmissionBeforeReplay as u };
|