rea-agents 5.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -655
- package/bridge/android/ReaJadxBridge.java +14 -5
- package/bridge/ghidra/ReaGhidraBridge.java +173 -47
- package/bridge/hopper_bridge.py +310 -128
- package/bridge/mitmproxy/capture.py +208 -0
- package/bridge/native/rea_lldb_tracer.py +839 -0
- package/bridge/process/ProcessRunTokenReader.swift +297 -0
- package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
- package/bridge/pwndbg/core_context.py +101 -0
- package/bridge/pwndbg/launch.py +39 -0
- package/bridge/pwndbg/launch_impl.py +34 -0
- package/bridge/pwntools/decoder_runtime.py +59 -0
- package/bridge/pwntools/layout.py +39 -0
- package/bridge/pwntools/layout_impl.py +309 -0
- package/bridge/pwntools/recorded_crash.py +39 -0
- package/bridge/pwntools/recorded_crash_impl.py +147 -0
- package/dist/android/JadxConfiguration.js +196 -33
- package/dist/android/JadxMcpTransport.js +4 -0
- package/dist/android/JadxProtocol.js +6 -0
- package/dist/android/JadxProvider.js +20 -2
- package/dist/android/JadxSession.js +23 -4
- package/dist/application/AnalysisContextQueries.js +8 -35
- package/dist/application/AnalysisDocument.js +32 -0
- package/dist/application/AppBundleExecutable.js +67 -21
- package/dist/application/CallPathTracing.js +19 -3
- package/dist/application/CapabilityInventory.js +27 -3
- package/dist/application/ClientConfigurationDocument.js +871 -6
- package/dist/application/ClientRegistrationIdentity.js +26 -5
- package/dist/application/ClientRegistrationStatus.js +29 -14
- package/dist/application/DirectAnalysis.js +97 -33
- package/dist/application/Doctor.js +4 -2
- package/dist/application/DoctorScope.js +25 -13
- package/dist/application/EnhancedLiteralTracing.js +22 -25
- package/dist/application/EnhancedTools.js +13 -11
- package/dist/application/EvidenceBundleFiles.js +24 -12
- package/dist/application/FunctionAnalysisEvidence.js +2 -3
- package/dist/application/InventoryProjectionEvidence.js +4 -3
- package/dist/application/InvestigationProviders.js +3 -2
- package/dist/application/JsonFiles.js +50 -28
- package/dist/application/ProcedureAddressResolution.js +11 -0
- package/dist/application/ReconstructionCoverageService.js +7 -4
- package/dist/application/ReconstructionObligationCandidates.js +5 -1
- package/dist/application/ReconstructionObligationLedgerService.js +4 -3
- package/dist/application/Setup.js +13 -1
- package/dist/application/SetupClientConfiguration.js +10 -15
- package/dist/application/SetupHost.js +5 -2
- package/dist/application/SetupPlan.js +5 -3
- package/dist/application/SupportedClients.js +34 -1
- package/dist/application/Uninstall.js +4 -3
- package/dist/application/Update.js +18 -3
- package/dist/application/UpdateRuntime.js +46 -25
- package/dist/application/WebModuleTraceService.js +4 -2
- package/dist/application/WebNetworkCapturePort.js +1 -0
- package/dist/application/WebNetworkCaptureService.js +134 -0
- package/dist/application/WebRuntimeService.js +5 -3
- package/dist/application/WebScriptExportService.js +2 -2
- package/dist/application/WebSourceLocationService.js +4 -2
- package/dist/application/WindowsCapabilities.js +1 -1
- package/dist/application/WorkflowEvidence.js +82 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +21 -5
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -0
- package/dist/application/binary/AnalysisSnapshotCache.js +52 -12
- package/dist/application/binary/BinarySession.js +131 -76
- package/dist/application/binary/BinarySessionOpen.js +19 -6
- package/dist/application/binary/BinarySessionRecords.js +45 -3
- package/dist/application/binary/BinarySessionStatus.js +17 -1
- package/dist/application/binary/CompositeProvider.js +13 -0
- package/dist/application/binary/LazyAnalysisProvider.js +3 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutPort.js +1 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +59 -0
- package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +62 -0
- package/dist/application/evm/EvmInterfacePort.js +1 -0
- package/dist/application/evm/EvmInterfaceService.js +64 -0
- package/dist/application/investigation/EvidenceLedger.js +21 -7
- package/dist/application/investigation/InvestigationRecords.js +8 -0
- package/dist/application/javascript/JavaScriptAnalysisControl.js +34 -0
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +25 -5
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +19 -2
- package/dist/application/javascript/JavaScriptApplicationService.js +34 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +5 -5
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +47 -27
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +39 -7
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +26 -2
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +80 -27
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +33 -12
- package/dist/application/javascript/JavaScriptModuleRelationships.js +37 -8
- package/dist/application/javascript/JavaScriptRecoveryService.js +4 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -1
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +149 -72
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +14 -15
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +41 -1
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -9
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +118 -12
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +27 -5
- package/dist/application/managed/ManagedApplicationGraphService.js +4 -3
- package/dist/application/managed/ManagedMemberComparisonService.js +7 -4
- package/dist/application/managed/ManagedNativeVerificationService.js +4 -3
- package/dist/application/managed/ManagedReconstructionService.js +4 -3
- package/dist/application/{ProcessCli.js → process/ProcessCli.js} +23 -15
- package/dist/application/{ProcessEvidence.js → process/ProcessEvidence.js} +8 -7
- package/dist/application/workflowInputError.js +18 -0
- package/dist/artifacts/ArtifactProvider.js +42 -5
- package/dist/artifacts/ArtifactProviderMetadata.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +98 -14
- package/dist/artifacts/NativeDmgArtifactReader.js +13 -6
- package/dist/artifacts/ZipArtifactReader.js +3 -0
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +22 -3
- package/dist/artifacts/apple/DylibResolutionReader.js +259 -0
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +176 -56
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +195 -0
- package/dist/artifacts/apple/KeyedArchiveReader.js +36 -22
- package/dist/artifacts/apple/MachoLoadCommandReader.js +355 -0
- package/dist/artifacts/apple/NibArchive.js +81 -14
- package/dist/artifacts/apple/NibViewHierarchy.js +10 -3
- package/dist/artifacts/apple/PlistNumberLiterals.js +164 -0
- package/dist/{application → artifacts/extraction}/ArtifactExtraction.js +10 -10
- package/dist/{application → artifacts/inventory}/ArtifactGraphConstruction.js +16 -11
- package/dist/{application → artifacts/inventory}/ArtifactInventory.js +4 -4
- package/dist/{application/ArtifactInventory → artifacts/inventory}/classify.js +2 -2
- package/dist/{application/ArtifactInventory → artifacts/inventory}/reader.js +5 -5
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanCanonical.js +14 -17
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanReader.js +5 -5
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +6 -2
- package/dist/artifacts/readStableArtifact.js +20 -4
- package/dist/browser/CdpCaptureCompleteness.js +2 -0
- package/dist/browser/CdpCaptureEventHandlers.js +165 -12
- package/dist/browser/CdpCaptureEventTypes.js +5 -1
- package/dist/browser/CdpCaptureEvents.js +34 -0
- package/dist/browser/CdpConnection.js +30 -11
- package/dist/browser/CdpOptionalCommand.js +2 -3
- package/dist/browser/CdpPageCapture.js +23 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +32 -23
- package/dist/browser/PlaywrightElectronActiveProjection.js +141 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +130 -122
- package/dist/browser/WebSourceMapFetcher.js +426 -72
- package/dist/browser/assets/LocalWebScriptArtifacts.js +2 -2
- package/dist/browser/history/CaptureFailures.js +137 -0
- package/dist/browser/history/CaptureFormatError.js +10 -0
- package/dist/browser/history/CaptureRedaction.js +65 -0
- package/dist/browser/history/CaptureRelease.js +17 -0
- package/dist/browser/history/HarCapture.js +165 -0
- package/dist/browser/history/HarCaptureAdapter.js +20 -0
- package/dist/browser/history/HarCaptureProcess.js +57 -0
- package/dist/browser/history/HarJson.js +92 -0
- package/dist/browser/history/HarSchema.js +72 -0
- package/dist/browser/history/HistoricalCaptureDecoder.js +188 -0
- package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
- package/dist/browser/history/MitmproxyCaptureAdapter.js +42 -0
- package/dist/cli/analysisSelector.js +23 -0
- package/dist/cli/applicationCommands.js +2 -3
- package/dist/cli/artifactCommands.js +26 -1
- package/dist/cli/binaryDiagnosticsCommands.js +39 -0
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +78 -20
- package/dist/cli/electronCommands.js +21 -13
- package/dist/cli/evmCommands.js +24 -0
- package/dist/cli/firmwareCommands.js +6 -3
- package/dist/cli/javascriptApplicationAnalysis.js +20 -3
- package/dist/cli/jsonOutput.js +38 -0
- package/dist/cli/nativeCallCommands.js +34 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/streamedJsonOutput.js +56 -0
- package/dist/cli/utilityCommands.js +2 -0
- package/dist/cli/webNetworkCaptureCommands.js +40 -0
- package/dist/cli/webRuntimeCommands.js +8 -8
- package/dist/cli.js +11 -4
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +6 -1
- package/dist/cliJsonInput.js +35 -1
- package/dist/cliOutput.js +21 -6
- package/dist/composition/binaryDiagnostics.js +8 -0
- package/dist/composition/evm.js +4 -0
- package/dist/composition/webNetworkCaptures.js +6 -0
- package/dist/config/environment.js +4 -0
- package/dist/config/ghidraStartupTimeout.js +17 -0
- package/dist/config/mcpResponseBudget.js +22 -0
- package/dist/config/parseConfig.js +2 -1
- package/dist/contracts/artifactToolContracts.js +6 -0
- package/dist/contracts/browserCaptureToolInputSchema.js +43 -0
- package/dist/contracts/browserToolContracts.js +4 -3
- package/dist/contracts/enhancedInputs.js +5 -3
- package/dist/contracts/enhancedToolContracts.js +3 -3
- package/dist/contracts/errorSchemas.js +8 -1
- package/dist/contracts/evm/evmToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +2 -5
- package/dist/contracts/investigationExamples.js +2 -2
- package/dist/contracts/javascript/electronToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +8 -6
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +42 -0
- package/dist/contracts/native/nativeToolContracts.js +21 -3
- package/dist/contracts/officialToolContracts.js +26 -24
- package/dist/contracts/process/processCaptureExample.js +2 -0
- package/dist/contracts/promptContracts.js +3 -3
- package/dist/contracts/sessionLifecycleInputs.js +18 -5
- package/dist/contracts/sessionStatusContract.js +8 -2
- package/dist/contracts/sessionToolContracts.js +8 -3
- package/dist/contracts/sessionToolSchemas.js +8 -4
- package/dist/contracts/toolContractExamples.js +1 -2
- package/dist/contracts/toolContractHelpers.js +4 -1
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +30 -1
- package/dist/contracts/toolOutputSchemaGroups.js +33 -28
- package/dist/contracts/toolOutputSchemaPrimitives.js +19 -1
- package/dist/contracts/toolSchemaMetadata.js +69 -10
- package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
- package/dist/domain/analysisErrorBase.js +22 -2
- package/dist/domain/analysisErrorCore.js +61 -5
- package/dist/domain/analysisErrorPresentation.js +95 -12
- package/dist/domain/analysisErrorProjection.js +148 -19
- package/dist/domain/analysisSnapshot.js +166 -2
- package/dist/domain/android/androidAnalysis.js +2 -4
- package/dist/domain/android/androidApplication.js +17 -9
- package/dist/domain/apple/appleApplication.js +41 -14
- package/dist/domain/apple/dyldEnvironment.js +73 -0
- package/dist/domain/apple/dyldPaths.js +81 -0
- package/dist/domain/apple/dylibResolution.js +478 -0
- package/dist/domain/apple/dylibResolutionFindings.js +77 -0
- package/dist/domain/apple/interfaceBuilderGraph.js +25 -13
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +13 -3
- package/dist/domain/apple/keyedArchive.js +9 -1
- package/dist/domain/apple/machoContainer.js +54 -0
- package/dist/domain/apple/plistNumbers.js +76 -0
- package/dist/domain/artifactIdentity.js +29 -0
- package/dist/domain/artifactInventoryEvidence.js +19 -24
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/bridgeCandidateProjection.js +71 -0
- package/dist/domain/browserCompleteness.js +1 -0
- package/dist/domain/browserObservation.js +1 -1
- package/dist/domain/browserObservationError.js +24 -5
- package/dist/domain/browserObservationSchemas.js +13 -0
- package/dist/domain/browserScenarioValues.js +5 -2
- package/dist/domain/bundleComparison.js +3 -2
- package/dist/domain/callPathSchemas.js +1 -1
- package/dist/domain/canonicalDigest.js +13 -1
- package/dist/domain/canonicalJsonDigestSteps.js +133 -0
- package/dist/domain/canonicalOrdering.js +9 -5
- package/dist/domain/changedBehavior.js +9 -9
- package/dist/domain/comparisonSourceEvidence.js +40 -0
- package/dist/domain/comparisonStatus.js +2 -30
- package/dist/domain/configurationErrors.js +1 -1
- package/dist/domain/conformanceTrustGate.js +0 -16
- package/dist/domain/evidence.js +78 -11
- package/dist/domain/evidenceBundle.js +42 -1
- package/dist/domain/evidenceErrors.js +12 -1
- package/dist/domain/evm/evmInterface.js +63 -0
- package/dist/domain/explicitSensitiveFailure.js +108 -0
- package/dist/domain/explicitSensitiveValues.js +10 -0
- package/dist/domain/firmware/firmwareAnalysis.js +10 -4
- package/dist/domain/hopperErrors.js +23 -2
- package/dist/domain/hopperValues.js +51 -8
- package/dist/domain/immutableJson.js +114 -0
- package/dist/domain/inputIssueProjection.js +3 -0
- package/dist/domain/javascript/electronActiveObservation.js +37 -6
- package/dist/domain/javascript/electronStaticAnalysisValues.js +6 -12
- package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +71 -23
- package/dist/domain/javascript/javascriptApplicationGraph.js +13 -0
- package/dist/domain/javascript/javascriptAstValues.js +20 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +21 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +0 -10
- package/dist/domain/javascript/javascriptRecovery.js +3 -8
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +97 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +6 -5
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +9 -17
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +22 -5
- package/dist/domain/javascript/javascriptSemanticGraph.js +34 -5
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +25 -17
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -4
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +77 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +83 -11
- package/dist/domain/javascript/javascriptSourceParser.js +6 -2
- package/dist/domain/javascript/javascriptStaticAnalysis.js +22 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -3
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +14 -4
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +66 -7
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +28 -16
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -2
- package/dist/domain/jsonSerialization.js +109 -0
- package/dist/domain/jsonValue.js +91 -3
- package/dist/domain/localPath.js +8 -0
- package/dist/domain/managed/managedApplicationGraph.js +10 -10
- package/dist/domain/managed/managedInspectionEvidence.js +16 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +5 -9
- package/dist/domain/managed/managedNativeVerification.js +3 -9
- package/dist/domain/native/binaryLayout.js +357 -0
- package/dist/domain/native/fileOffsetPartialObservation.js +1 -0
- package/dist/domain/native/nativeCallObservation.js +186 -0
- package/dist/domain/native/nativeCallPartialObservation.js +33 -0
- package/dist/domain/native/objcSwiftMetadata.js +0 -39
- package/dist/domain/native/recordedCrash.js +266 -0
- package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
- package/dist/domain/{processCapture.js → process/processCapture.js} +143 -2
- package/dist/domain/{processCaptureExample.js → process/processCaptureExample.js} +5 -0
- package/dist/domain/process/processCaptureParsing.js +54 -0
- package/dist/domain/{processCaptureValidation.js → process/processCaptureValidation.js} +18 -2
- package/dist/domain/{processComparison.js → process/processComparison.js} +39 -5
- package/dist/domain/{processObservation.js → process/processObservation.js} +1 -1
- package/dist/domain/{processScenario.js → process/processScenario.js} +11 -10
- package/dist/domain/{processTraceSpecification.js → process/processTraceSpecification.js} +1 -1
- package/dist/domain/propertyListKeys.js +1 -1
- package/dist/domain/propertyListXmlText.js +19 -0
- package/dist/domain/providerAdapterError.js +1 -1
- package/dist/domain/providerOperationHealth.js +54 -0
- package/dist/domain/providerSelectionError.js +4 -2
- package/dist/domain/reconstructionVerification.js +9 -46
- package/dist/domain/reconstructionVerificationSchemas.js +3 -3
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +9 -46
- package/dist/domain/webBundleAnalysis.js +20 -8
- package/dist/domain/webBundleAnalyzerInspection.js +13 -8
- package/dist/domain/webBundleAnalyzerResult.js +41 -2
- package/dist/domain/webCaptureDiff.js +1 -0
- package/dist/domain/webNetworkCapture.js +118 -0
- package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
- package/dist/domain/webRuntime.js +19 -5
- package/dist/domain/webSourceLocation.js +1 -0
- package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
- package/dist/dotnet/ManagedMemberInspector.js +4 -2
- package/dist/dotnet/ManagedMemberInspectorCore.js +38 -32
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +23 -7
- package/dist/dotnet/ManagedMemberRows.js +14 -3
- package/dist/dotnet/ManagedMetadataHeaps.js +20 -2
- package/dist/dotnet/ManagedMetadataInventory.js +38 -28
- package/dist/dotnet/ManagedMetadataInventoryRows.js +24 -10
- package/dist/dotnet/ManagedMethodBodyReader.js +7 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +15 -3
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +3 -1
- package/dist/dotnet/ManagedPeReader.js +11 -0
- package/dist/evm/EvmBytecodeCarrier.js +21 -0
- package/dist/evm/EvmWorkerLimits.js +40 -0
- package/dist/evm/EvmoleFailures.js +126 -0
- package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
- package/dist/evm/EvmoleInterfaceProvider.js +273 -0
- package/dist/evm/EvmoleInterfaceWorker.js +87 -0
- package/dist/evm/EvmoleRelease.js +16 -0
- package/dist/firmware/FirmwareCommand.js +1 -0
- package/dist/firmware/FirmwareFiles.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +5 -0
- package/dist/ghidra/GhidraClient.js +47 -14
- package/dist/ghidra/GhidraDiagnostics.js +7 -7
- package/dist/ghidra/GhidraFunctionValues.js +10 -7
- package/dist/ghidra/GhidraInstallation.js +18 -21
- package/dist/ghidra/GhidraInventoryValues.js +14 -4
- package/dist/ghidra/GhidraJavaLaunch.js +62 -0
- package/dist/ghidra/GhidraLauncher.js +34 -16
- package/dist/ghidra/GhidraProvider.js +2 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +15 -3
- package/dist/ghidra/GhidraProviderClient.js +23 -12
- package/dist/ghidra/GhidraSessionError.js +11 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +47 -12
- package/dist/ghidra/GhidraTransport.js +20 -0
- package/dist/hopper/BridgeLauncher.js +33 -11
- package/dist/hopper/HopperAnalysisProfile.js +62 -4
- package/dist/hopper/HopperCleanup.js +15 -3
- package/dist/hopper/HopperClient.js +222 -14
- package/dist/hopper/HopperFileOffset.js +237 -0
- package/dist/hopper/HopperMachOImage.js +196 -0
- package/dist/hopper/HopperOperationStage.js +6 -0
- package/dist/hopper/HopperProvider.js +63 -9
- package/dist/hopper/HopperProviderCapabilities.js +19 -1
- package/dist/hopper/HopperRegexSearch.js +137 -0
- package/dist/hopper/HopperRegexWorker.js +27 -0
- package/dist/hopper/HopperRequestQueue.js +68 -19
- package/dist/hopper/HopperTargetLease.js +3 -2
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -1
- package/dist/inspector/V8InspectorCaptureProjection.js +8 -3
- package/dist/inspector/V8InspectorProvider.js +47 -11
- package/dist/javascript/recovery/WakaruCommand.js +3 -0
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +47 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +17 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +79 -31
- package/dist/javascript/sourceMaps/TraceSourceMap.js +14 -28
- package/dist/mcpDoctor.js +62 -2
- package/dist/native/AppleDispatchCoverage.js +47 -6
- package/dist/native/AppleDispatchDecodeFacts.js +6 -0
- package/dist/native/AppleDispatchMetadata.js +6 -3
- package/dist/native/AppleMachoFixups.js +48 -24
- package/dist/native/AppleMachoSelection.js +32 -16
- package/dist/native/AppleObjcCategories.js +6 -2
- package/dist/native/AppleObjcDispatchFacets.js +5 -2
- package/dist/native/AppleObjcProperties.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +27 -21
- package/dist/native/AppleSwiftVtables.js +21 -15
- package/dist/native/CommandRunner.js +82 -84
- package/dist/native/LldbCallTracer.js +541 -0
- package/dist/native/LldbRetainedObservations.js +178 -0
- package/dist/native/NativeCallObservation.js +194 -0
- package/dist/native/NativeMacOSProvider.js +117 -20
- package/dist/native/NativeMacOSProviderMetadata.js +8 -3
- package/dist/native/SignatureTargetBinding.js +155 -0
- package/dist/native/parsers/lipo.js +71 -1
- package/dist/native/pwndbg/PwndbgCoreContext.js +180 -0
- package/dist/native/pwntools/PwntoolsDecoder.js +203 -0
- package/dist/native/pwntools/PwntoolsFailures.js +180 -0
- package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
- package/dist/native/pwntools/PwntoolsRelease.js +19 -0
- package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +103 -0
- package/dist/process/DarwinProcessRunTokenReader.js +293 -0
- package/dist/process/ExecFileOutput.js +20 -0
- package/dist/process/OwnedCommand.js +118 -0
- package/dist/process/ProcessOwnership.js +431 -51
- package/dist/process/ProcessOwnershipObservation.js +209 -27
- package/dist/process/ProviderProcess.js +68 -10
- package/dist/{application → process/capture}/ProcessCaptureCapability.js +15 -0
- package/dist/{application → process/capture}/ProcessCaptureError.js +18 -2
- package/dist/process/capture/ProcessCaptureLifecycle.js +681 -0
- package/dist/{application → process/capture}/ProcessHarness.js +195 -29
- package/dist/{application → process/capture}/ProcessSampling.js +2 -2
- package/dist/server/EvidenceMcpServer.js +146 -0
- package/dist/server/createServer.js +37 -8
- package/dist/server/promptCompletion.js +10 -3
- package/dist/server/registerAndroidTools.js +2 -4
- package/dist/server/registerApplicationTools/helpers.js +2 -4
- package/dist/server/registerArtifactComparisonTool.js +11 -7
- package/dist/server/registerBinaryDiagnosticsTools.js +15 -0
- package/dist/server/registerBrowserScenarioTool.js +2 -4
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerBundleComparisonTool.js +2 -3
- package/dist/server/registerCloseLifecycleTool.js +8 -18
- package/dist/server/registerElectronTools.js +2 -4
- package/dist/server/registerEnhancedTools.js +18 -59
- package/dist/server/registerEvidenceTools.js +3 -5
- package/dist/server/registerEvmTools.js +15 -0
- package/dist/server/registerFirmwareTools.js +2 -4
- package/dist/server/registerFunctionComparisonTool.js +10 -6
- package/dist/server/registerInvestigationTools.js +7 -7
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -4
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -4
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +2 -4
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +2 -4
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -4
- package/dist/server/registerOfficialTools.js +2 -4
- package/dist/server/registerProcessComparisonTool.js +72 -46
- package/dist/server/registerRecordedCrashTools.js +15 -0
- package/dist/server/registerSessionRecordTools.js +5 -6
- package/dist/server/registerSessionStatusTool.js +17 -3
- package/dist/server/registerSessionTools.js +13 -5
- package/dist/server/registerWebModuleTool.js +2 -4
- package/dist/server/registerWebNetworkCaptureTool.js +26 -0
- package/dist/server/registerWebRuntimeTools.js +3 -7
- package/dist/server/registerWebScriptTool.js +2 -4
- package/dist/server/registerWebSourceLocationTool.js +2 -4
- package/dist/server/runDerivedOperation.js +15 -3
- package/dist/server/sessionAvailabilityPolicy.js +3 -1
- package/dist/server/sessionToolPolicies.js +1 -1
- package/dist/server/toolRegistrationOptions.js +2 -2
- package/dist/server/toolResult.js +63 -11
- package/dist/server/toolResultEncoding.js +33 -0
- package/install.sh +1 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +42 -9
- package/scripts/electron-active-hook-boundaries.cjs +18 -20
- package/scripts/electron-active-hook.cjs +241 -37
- package/scripts/rea.mjs +11 -3
- package/skills/reverse-engineer-anything/SKILL.md +32 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +8 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +29 -0
- package/third_party/README.md +60 -0
- package/third_party/evmole/LICENSE +21 -0
- package/third_party/evmole/README.md +22 -0
- package/third_party/pwndbg/LICENSE.md +21 -0
- package/third_party/pwndbg/README.md +23 -0
- package/third_party/pwntools/README.md +40 -0
- package/dist/application/AuthorizedArtifactInventory.js +0 -7
- package/dist/application/ProcessCaptureLifecycle.js +0 -299
- package/dist/application/StoreFileLock.js +0 -124
- package/dist/contracts/processCaptureExample.js +0 -2
- package/dist/domain/bytecodeProvider.js +0 -178
- package/dist/domain/customProtocolCapture.js +0 -137
- package/dist/domain/eventProcessTree.js +0 -225
- package/dist/domain/mobileApplicationInvestigation.js +0 -159
- package/dist/domain/packageAnalysis.js +0 -123
- package/dist/domain/peInspection.js +0 -197
- package/dist/domain/processCaptureParsing.js +0 -21
- package/dist/domain/protocolCapture.js +0 -217
- package/dist/domain/runtimeIdentification.js +0 -212
- package/dist/generatedMcpToolCatalog.js +0 -37
- package/dist/ghidra/GhidraDefaults.js +0 -2
- /package/dist/application/{ArtifactExtractionDestination.js → artifacts/ArtifactExtractionDestination.js} +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/policy.js +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/types.js +0 -0
- /package/dist/domain/{processEvidenceProvider.js → process/processEvidenceProvider.js} +0 -0
- /package/dist/domain/{processTraceComparison.js → process/processTraceComparison.js} +0 -0
- /package/dist/domain/{processTraceDimensionProjection.js → process/processTraceDimensionProjection.js} +0 -0
- /package/dist/domain/{processTraceEvaluation.js → process/processTraceEvaluation.js} +0 -0
- /package/dist/{application → process/capture}/FilesystemSnapshot.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureEnvironment.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureJournal.js +0 -0
- /package/dist/{application → process/capture}/ProcessFilesystemEffects.js +0 -0
- /package/dist/{application → process/capture}/ProcessNormalization.js +0 -0
- /package/dist/{application → process/capture}/ProcessScenarioRuntimeValidation.js +0 -0
- /package/dist/{application → process/capture}/ProcessTimer.js +0 -0
- /package/dist/{application → process/capture}/TerminalRenderer.js +0 -0
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { createJavaScriptApplicationGraph, } from "../../domain/javascript/javascriptApplicationGraph.js";
|
|
1
|
+
import { createJavaScriptApplicationGraph, createImmutableJavaScriptApplicationGraphSteps, } from "../../domain/javascript/javascriptApplicationGraph.js";
|
|
2
2
|
import { JavaScriptArtifactGraphAccumulator } from "./JavaScriptArtifactGraphAccumulator.js";
|
|
3
3
|
import { addJavaScriptHtmlRoles, addJavaScriptSourceMapOriginals, } from "./JavaScriptArtifactGraphDocuments.js";
|
|
4
4
|
import { addJavaScriptStaticFindings } from "./JavaScriptArtifactGraphFindings.js";
|
|
5
5
|
import { addJavaScriptModuleRelationships, addJavaScriptSourceModules, } from "./JavaScriptModuleRelationships.js";
|
|
6
6
|
import { completeApplicationCoverage, partialApplicationCoverage, } from "../../domain/javascript/javascriptApplicationEvidenceSchemas.js";
|
|
7
|
+
import { semanticCoverageResourceLimits } from "../../domain/javascript/javascriptSemanticCoverage.js";
|
|
8
|
+
import { SEMANTIC_EXPRESSION_DEPTH_LIMIT, SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT, SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT, semanticResourceLimitReason, } from "../../domain/javascript/javascriptSemanticResourceLimits.js";
|
|
7
9
|
import { addJavaScriptArtifactContainers, addJavaScriptArtifactFiles, addJavaScriptBundlerNodes, addJavaScriptPackageNodes, createJavaScriptArtifactRootNode, } from "./JavaScriptArtifactGraphStructure.js";
|
|
8
10
|
import { addElectronBoundaries } from "./ElectronBoundaryGraph.js";
|
|
9
11
|
import { classifyElectronIpcPairings, collectElectronIpcRecords, } from "./ElectronBoundaryAnalysis.js";
|
|
10
12
|
/** Project artifact and AST facts into JavaScript Application Graph. */
|
|
11
|
-
export const buildJavaScriptArtifactGraph = (snapshot, fileSet, analysis) =>
|
|
13
|
+
export const buildJavaScriptArtifactGraph = (snapshot, fileSet, analysis) => createJavaScriptApplicationGraph(buildJavaScriptArtifactGraphInput(snapshot, fileSet, analysis));
|
|
14
|
+
/** Build a validated application graph with cooperative immutable ownership. */
|
|
15
|
+
export const buildImmutableJavaScriptArtifactGraphSteps = (snapshot, fileSet, analysis) => createImmutableJavaScriptApplicationGraphSteps(buildJavaScriptArtifactGraphInput(snapshot, fileSet, analysis));
|
|
16
|
+
const buildJavaScriptArtifactGraphInput = (snapshot, fileSet, analysis) => {
|
|
12
17
|
const accumulator = new JavaScriptArtifactGraphAccumulator();
|
|
13
18
|
const root = createJavaScriptArtifactRootNode(accumulator, snapshot);
|
|
14
19
|
const context = {
|
|
@@ -30,13 +35,13 @@ export const buildJavaScriptArtifactGraph = (snapshot, fileSet, analysis) => {
|
|
|
30
35
|
const packageRoots = addJavaScriptPackageNodes(context);
|
|
31
36
|
addJavaScriptSourceModules(context);
|
|
32
37
|
addJavaScriptBundlerNodes(context);
|
|
33
|
-
addJavaScriptModuleRelationships(context);
|
|
38
|
+
const relationshipOmissions = addJavaScriptModuleRelationships(context);
|
|
34
39
|
addJavaScriptStaticFindings(context);
|
|
35
40
|
addElectronBoundaries(context);
|
|
36
41
|
addJavaScriptHtmlRoles(context);
|
|
37
42
|
addJavaScriptSourceMapOriginals(context);
|
|
38
43
|
const coverage = graphCoverage(context);
|
|
39
|
-
return
|
|
44
|
+
return {
|
|
40
45
|
schema: "JavaScriptApplicationGraph",
|
|
41
46
|
root_node_ids: packageRoots.length === 0
|
|
42
47
|
? [root.node_id]
|
|
@@ -44,10 +49,11 @@ export const buildJavaScriptArtifactGraph = (snapshot, fileSet, analysis) => {
|
|
|
44
49
|
nodes: accumulator.nodes(),
|
|
45
50
|
edges: accumulator.edges(),
|
|
46
51
|
coverage,
|
|
47
|
-
limitations: graphLimitations(context, coverage.status),
|
|
48
|
-
}
|
|
52
|
+
limitations: graphLimitations(context, coverage.status, relationshipOmissions),
|
|
53
|
+
};
|
|
49
54
|
};
|
|
50
55
|
const graphCoverage = (context) => {
|
|
56
|
+
const resourceLimits = semanticResourceLimits(context);
|
|
51
57
|
const sourceMapPolicyGap = context.analysis.source_maps.some(({ status }) => status === "invalid");
|
|
52
58
|
const malformedStructuredData = context.analysis.packages.some(({ status }) => status !== "included") ||
|
|
53
59
|
context.analysis.json_modules.some(({ status }) => status !== "included") ||
|
|
@@ -60,11 +66,31 @@ const graphCoverage = (context) => {
|
|
|
60
66
|
partialJavaScript;
|
|
61
67
|
if (context.analysis.truncated_scopes > 0)
|
|
62
68
|
return partialApplicationCoverage([], null);
|
|
69
|
+
if (resourceLimits.length > 0)
|
|
70
|
+
return partialApplicationCoverage(resourceLimits.map(applicationGraphResourceLimit), null);
|
|
63
71
|
if (unknownGap)
|
|
64
72
|
return partialApplicationCoverage([], null);
|
|
65
73
|
return completeApplicationCoverage();
|
|
66
74
|
};
|
|
67
|
-
const
|
|
75
|
+
const semanticResourceLimits = (context) => [
|
|
76
|
+
...new Set(context.analysis.files.flatMap(({ semantic }) => semantic === null
|
|
77
|
+
? []
|
|
78
|
+
: semanticCoverageResourceLimits(semantic.ir.coverage))),
|
|
79
|
+
].sort();
|
|
80
|
+
const applicationGraphResourceLimit = (resourceLimit) => ({
|
|
81
|
+
name: `javascript_semantic_${resourceLimit.replaceAll("-", "_")}`,
|
|
82
|
+
value: resourceLimit === "primitive-candidates"
|
|
83
|
+
? SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT
|
|
84
|
+
: resourceLimit === "primitive-bytes"
|
|
85
|
+
? SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT
|
|
86
|
+
: SEMANTIC_EXPRESSION_DEPTH_LIMIT,
|
|
87
|
+
unit: resourceLimit === "expression-depth"
|
|
88
|
+
? "depth"
|
|
89
|
+
: resourceLimit === "primitive-bytes"
|
|
90
|
+
? "bytes"
|
|
91
|
+
: "items",
|
|
92
|
+
});
|
|
93
|
+
const graphLimitations = (context, coverage, relationshipOmissions) => {
|
|
68
94
|
const ipc = collectElectronIpcRecords(context.analysis);
|
|
69
95
|
const pairings = classifyElectronIpcPairings(ipc);
|
|
70
96
|
const electronFindings = context.analysis.files.reduce((count, { javascript }) => count +
|
|
@@ -78,6 +104,11 @@ const graphLimitations = (context, coverage) => {
|
|
|
78
104
|
javascript.electron.native_addon_bindings.length), 0);
|
|
79
105
|
return [
|
|
80
106
|
...context.analysis.limitations,
|
|
107
|
+
...(relationshipOmissions.selfImports > 0
|
|
108
|
+
? [
|
|
109
|
+
`${String(relationshipOmissions.selfImports)} import ${relationshipOmissions.selfImports === 1 ? "specifier" : "specifiers"} resolved back to the importing module itself and ${relationshipOmissions.selfImports === 1 ? "was" : "were"} omitted; application graph edges cannot be self-referential.`,
|
|
110
|
+
]
|
|
111
|
+
: []),
|
|
81
112
|
"CommonJS and ESM binding relationships were recovered from inert syntax and resolved only within the inventoried artifact container.",
|
|
82
113
|
"Webpack/Rspack factories were recovered from AST literals; REA did not invoke push handlers or bundle bootstrap code.",
|
|
83
114
|
"Static imports, entrypoints, workers, endpoints, and storage relationships do not prove runtime execution.",
|
|
@@ -101,6 +132,7 @@ const graphLimitations = (context, coverage) => {
|
|
|
101
132
|
"Sender, frame, URL, and origin checks are observations only; REA does not claim that they enforce a complete authorization policy.",
|
|
102
133
|
]
|
|
103
134
|
: []),
|
|
135
|
+
...semanticResourceLimits(context).map(semanticResourceLimitReason),
|
|
104
136
|
...(context.analysis.files.some(({ javascript }) => (javascript?.electron.native_addon_bindings.length ?? 0) > 0)
|
|
105
137
|
? [
|
|
106
138
|
"Native member names are requested by JavaScript syntax and are not verified binary exports in this workflow.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addArtifactContainsEdge, addStaticInferenceEdge, createElectronRoleNode, linkElectronRoleToAsset, } from "./JavaScriptArtifactGraphContext.js";
|
|
2
|
-
import { artifactObservationEvidence } from "./JavaScriptArtifactGraphEvidence.js";
|
|
2
|
+
import { artifactObservationEvidence, staticInferenceEvidence, } from "./JavaScriptArtifactGraphEvidence.js";
|
|
3
3
|
import { completeApplicationCoverage } from "../../domain/javascript/javascriptApplicationEvidenceSchemas.js";
|
|
4
4
|
import { resolveArtifactPathByContext } from "./JavaScriptArtifactPathResolution.js";
|
|
5
5
|
/** Project HTML renderer entrypoints and their local script assets. */
|
|
@@ -46,8 +46,32 @@ export const addJavaScriptHtmlRoles = (context) => {
|
|
|
46
46
|
htmlBaseHref: script.base_href,
|
|
47
47
|
});
|
|
48
48
|
const resolvedPath = resolution.resolved_path;
|
|
49
|
-
if (resolvedPath === null)
|
|
49
|
+
if (resolvedPath === null) {
|
|
50
|
+
context.accumulator.addNode({
|
|
51
|
+
kind: role.kind,
|
|
52
|
+
identity: role.identity,
|
|
53
|
+
observations: [
|
|
54
|
+
{
|
|
55
|
+
label: script.script_path,
|
|
56
|
+
properties: {
|
|
57
|
+
mechanism: "html-script-reference",
|
|
58
|
+
script_path: script.script_path,
|
|
59
|
+
base_href: script.base_href,
|
|
60
|
+
...resolution,
|
|
61
|
+
},
|
|
62
|
+
evidence: staticInferenceEvidence({
|
|
63
|
+
sha256: html.sha256,
|
|
64
|
+
path: html.path,
|
|
65
|
+
range: script.location,
|
|
66
|
+
operation: "resolve-html-script-reference",
|
|
67
|
+
coverage: completeApplicationCoverage(),
|
|
68
|
+
limitations: resolution.limitations,
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
});
|
|
50
73
|
continue;
|
|
74
|
+
}
|
|
51
75
|
const resolved = context.fileNodes.get(resolvedPath);
|
|
52
76
|
if (resolved === undefined)
|
|
53
77
|
continue;
|
|
@@ -14,16 +14,24 @@ const EXTENSIONS = [
|
|
|
14
14
|
const NODE_BUILTINS = new Set(builtinModules.map((name) => name.replace(/^node:/u, "")));
|
|
15
15
|
/** Resolve one declaration under its exact syntax/metadata context. */
|
|
16
16
|
export const resolveArtifactPathByContext = (input) => resolvePackagePath(input, new Set());
|
|
17
|
-
const resolvePackagePath = (input, packageChain, mode = "full") => {
|
|
17
|
+
const resolvePackagePath = (input, packageChain, mode = "full", exportsTargetUrl = false) => {
|
|
18
18
|
const rejected = rejectDeclaration(input);
|
|
19
19
|
if (rejected !== null)
|
|
20
20
|
return rejected;
|
|
21
|
-
const candidate = contextualCandidate(input);
|
|
21
|
+
const candidate = contextualCandidate(input, exportsTargetUrl);
|
|
22
22
|
if (typeof candidate !== "string")
|
|
23
23
|
return candidate;
|
|
24
24
|
const confined = confineCandidate(input, candidate);
|
|
25
25
|
if (typeof confined !== "string")
|
|
26
26
|
return confined;
|
|
27
|
+
if (input.context === "html-reference")
|
|
28
|
+
return outcome(input, resolveFileCandidates(input, [confined]) ?? {
|
|
29
|
+
resolvedPath: null,
|
|
30
|
+
status: "not-found",
|
|
31
|
+
limitations: [
|
|
32
|
+
`The exact HTML resource ${confined} was not found among the selected application files.`,
|
|
33
|
+
],
|
|
34
|
+
});
|
|
27
35
|
const resolved = mode === "files-and-index"
|
|
28
36
|
? (resolveFileCandidates(input, [
|
|
29
37
|
...fileCandidates(confined),
|
|
@@ -48,10 +56,11 @@ const rejectDeclaration = (input) => {
|
|
|
48
56
|
]);
|
|
49
57
|
return null;
|
|
50
58
|
};
|
|
51
|
-
const contextualCandidate = (input) => {
|
|
59
|
+
const contextualCandidate = (input, exportsTargetUrl) => {
|
|
52
60
|
const { context } = input;
|
|
53
|
-
|
|
61
|
+
let declared = context === "html-reference" ||
|
|
54
62
|
context === "url-reference" ||
|
|
63
|
+
exportsTargetUrl ||
|
|
55
64
|
(context === "module-specifier" && input.moduleKind !== "require")
|
|
56
65
|
? stripQueryAndFragment(input.declaredPath)
|
|
57
66
|
: input.declaredPath;
|
|
@@ -72,6 +81,23 @@ const contextualCandidate = (input) => {
|
|
|
72
81
|
return unresolvedOutcome(input, "external", [
|
|
73
82
|
"URL schemes and protocol-relative URLs are outside this local artifact path context.",
|
|
74
83
|
]);
|
|
84
|
+
// Exports targets use URL paths for both loaders; legacy main fields remain literal.
|
|
85
|
+
if (exportsTargetUrl ||
|
|
86
|
+
(context === "module-specifier" && input.moduleKind !== "require")) {
|
|
87
|
+
try {
|
|
88
|
+
declared = decodeURIComponent(declared);
|
|
89
|
+
}
|
|
90
|
+
catch (cause) {
|
|
91
|
+
void cause;
|
|
92
|
+
return unresolvedOutcome(input, "rejected", [
|
|
93
|
+
"The module URL path contains malformed percent encoding.",
|
|
94
|
+
]);
|
|
95
|
+
}
|
|
96
|
+
if (declared.includes("\0"))
|
|
97
|
+
return unresolvedOutcome(input, "rejected", [
|
|
98
|
+
"The decoded module URL path contains NUL.",
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
75
101
|
const relative = declared.startsWith("/") ? declared.slice(1) : declared;
|
|
76
102
|
return declared.startsWith("/")
|
|
77
103
|
? relative
|
|
@@ -206,6 +232,12 @@ const resolveCandidate = (input, candidate, packageChain) => {
|
|
|
206
232
|
`Directory package metadata ${packagePath} is not valid package JSON.`,
|
|
207
233
|
],
|
|
208
234
|
};
|
|
235
|
+
if (main.status === "rejected")
|
|
236
|
+
return {
|
|
237
|
+
resolvedPath: null,
|
|
238
|
+
status: "rejected",
|
|
239
|
+
limitations: [`Package metadata ${packagePath}: ${main.limitation}`],
|
|
240
|
+
};
|
|
209
241
|
if (main.status === "unmatched")
|
|
210
242
|
return {
|
|
211
243
|
resolvedPath: null,
|
|
@@ -242,7 +274,7 @@ const resolveCandidate = (input, candidate, packageChain) => {
|
|
|
242
274
|
return index;
|
|
243
275
|
}
|
|
244
276
|
// Preserve recursive artifact package lookup only after legacy file/index fallbacks.
|
|
245
|
-
return candidateOutcome(resolvePackagePath(entryInput, chain));
|
|
277
|
+
return candidateOutcome(resolvePackagePath(entryInput, chain, "full", main.source === "exports"));
|
|
246
278
|
};
|
|
247
279
|
const candidateOutcome = (nested) => nested.resolution_status === "resolved"
|
|
248
280
|
? {
|
|
@@ -283,9 +315,12 @@ const packageEntry = (text, moduleKind, useExports) => {
|
|
|
283
315
|
? { ...exported, source: "exports" }
|
|
284
316
|
: exported;
|
|
285
317
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
318
|
+
// Node imports and requires ignore the bundler-only module field. Keep
|
|
319
|
+
// that fallback for callers without an explicit module-loading kind.
|
|
320
|
+
const preferred = [
|
|
321
|
+
Reflect.get(value, "main"),
|
|
322
|
+
...(moduleKind === undefined ? [Reflect.get(value, "module")] : []),
|
|
323
|
+
];
|
|
289
324
|
const entry = preferred.find((candidate) => candidate !== undefined);
|
|
290
325
|
if (entry === undefined)
|
|
291
326
|
return { status: "missing" };
|
|
@@ -299,23 +334,35 @@ const packageEntry = (text, moduleKind, useExports) => {
|
|
|
299
334
|
}
|
|
300
335
|
};
|
|
301
336
|
const packageExport = (value, moduleKind) => {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
return { status: "invalid" };
|
|
306
|
-
const root = Reflect.get(value, ".") ?? value;
|
|
307
|
-
if (typeof root === "string")
|
|
308
|
-
return packagePathValue(root);
|
|
309
|
-
if (typeof root !== "object" || root === null || Array.isArray(root))
|
|
310
|
-
return { status: "invalid" };
|
|
337
|
+
const root = typeof value === "object" && value !== null && Object.hasOwn(value, ".")
|
|
338
|
+
? Reflect.get(value, ".")
|
|
339
|
+
: value;
|
|
311
340
|
const flattened = exportTargets(root, packageExportConditions(moduleKind));
|
|
312
341
|
if (flattened.kind === "invalid")
|
|
313
|
-
return { status: "
|
|
342
|
+
return { status: "rejected", limitation: flattened.limitation };
|
|
314
343
|
const first = flattened.kind === "unmatched" ? undefined : flattened.values[0];
|
|
315
344
|
return first === undefined
|
|
316
|
-
? {
|
|
345
|
+
? {
|
|
346
|
+
status: "unmatched",
|
|
347
|
+
declared: typeof root === "object" && root !== null ? Object.keys(root) : [],
|
|
348
|
+
}
|
|
317
349
|
: { status: "value", value: first };
|
|
318
350
|
};
|
|
351
|
+
const invalidExportTarget = (value, reason) => ({
|
|
352
|
+
kind: "invalid",
|
|
353
|
+
limitation: `The package exports target ${JSON.stringify(value) ?? String(value)} ${reason}.`,
|
|
354
|
+
});
|
|
355
|
+
// Node checks raw target segments before URL normalization. Compare encoded
|
|
356
|
+
// segment names here; full URL decoding follows array target selection.
|
|
357
|
+
const forbiddenExportSegment = (value) => value
|
|
358
|
+
.slice(2)
|
|
359
|
+
.split(/[\\/]/u)
|
|
360
|
+
.find((raw) => {
|
|
361
|
+
const segment = raw.replace(/%[0-9a-f]{2}/giu, (encoded) => String.fromCharCode(Number.parseInt(encoded.slice(1), 16)));
|
|
362
|
+
return (segment === "." ||
|
|
363
|
+
segment === ".." ||
|
|
364
|
+
segment.toLowerCase() === "node_modules");
|
|
365
|
+
});
|
|
319
366
|
/**
|
|
320
367
|
* Resolve a target in Node's declared order. Explicit null blocks an active
|
|
321
368
|
* condition, whereas an unmatched nested object permits the next condition.
|
|
@@ -323,30 +370,36 @@ const packageExport = (value, moduleKind) => {
|
|
|
323
370
|
* preserves the final invalid-versus-null refusal if no string is selected.
|
|
324
371
|
*/
|
|
325
372
|
const exportTargets = (value, conditions) => {
|
|
326
|
-
if (typeof value === "string")
|
|
327
|
-
|
|
373
|
+
if (typeof value === "string") {
|
|
374
|
+
if (!value.startsWith("./"))
|
|
375
|
+
return invalidExportTarget(value, 'must start with "./"');
|
|
376
|
+
const forbidden = forbiddenExportSegment(value);
|
|
377
|
+
return forbidden === undefined
|
|
328
378
|
? { kind: "targets", values: [value] }
|
|
329
|
-
: {
|
|
379
|
+
: invalidExportTarget(value, `contains forbidden path segment ${JSON.stringify(forbidden)} before URL normalization`);
|
|
380
|
+
}
|
|
330
381
|
if (value === null)
|
|
331
382
|
return { kind: "targets", values: [] };
|
|
332
383
|
if (Array.isArray(value)) {
|
|
333
|
-
let invalid =
|
|
384
|
+
let invalid = null;
|
|
334
385
|
for (const entry of value) {
|
|
335
386
|
const nested = exportTargets(entry, conditions);
|
|
336
387
|
if (nested.kind === "invalid") {
|
|
337
|
-
invalid =
|
|
388
|
+
invalid = nested.limitation;
|
|
338
389
|
continue;
|
|
339
390
|
}
|
|
340
391
|
if (nested.kind === "unmatched")
|
|
341
392
|
continue;
|
|
342
|
-
invalid =
|
|
393
|
+
invalid = null;
|
|
343
394
|
if (nested.values.length > 0)
|
|
344
395
|
return nested;
|
|
345
396
|
}
|
|
346
|
-
return invalid
|
|
397
|
+
return invalid === null
|
|
398
|
+
? { kind: "targets", values: [] }
|
|
399
|
+
: { kind: "invalid", limitation: invalid };
|
|
347
400
|
}
|
|
348
401
|
if (typeof value !== "object")
|
|
349
|
-
return
|
|
402
|
+
return invalidExportTarget(value, "must be a relative string, object, array, or null");
|
|
350
403
|
for (const [condition, target] of Object.entries(value)) {
|
|
351
404
|
if (!conditions.has(condition))
|
|
352
405
|
continue;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { lstat, realpath } from "node:fs/promises";
|
|
2
2
|
import { ArtifactReaderFailure } from "../../artifacts/ArtifactReader.js";
|
|
3
3
|
import { createJavaScriptArtifactReader as createReader } from "../../artifacts/javascript/JavaScriptArtifactReader.js";
|
|
4
|
-
import {
|
|
4
|
+
import { analyzeAndProjectJavaScriptArtifactFiles } from "./JavaScriptArtifactAnalysis.js";
|
|
5
5
|
import { readJavaScriptArtifactFiles } from "../../artifacts/javascript/JavaScriptArtifactFiles.js";
|
|
6
|
-
import {
|
|
6
|
+
import { buildImmutableJavaScriptArtifactGraphSteps } from "./JavaScriptArtifactGraphBuilder.js";
|
|
7
7
|
import { javascriptArtifactReconstructionInputSchema, } from "./JavaScriptArtifactReconstructionInput.js";
|
|
8
|
-
import { scanCanonicalArtifactInventory } from "
|
|
8
|
+
import { scanCanonicalArtifactInventory } from "../../artifacts/inventory/ArtifactInventory.js";
|
|
9
9
|
import { summarizeElectronBoundaries } from "./ElectronBoundaryAnalysis.js";
|
|
10
|
-
import {
|
|
10
|
+
import { createJavaScriptSemanticGraphProjection } from "./JavaScriptSemanticGraphBuilder.js";
|
|
11
|
+
import { checkpointJavaScriptAnalysis, completeJavaScriptAnalysisSteps, } from "./JavaScriptAnalysisControl.js";
|
|
11
12
|
/** Reconstruct one local ASAR or extracted directory without executing code. */
|
|
12
|
-
export const reconstructJavaScriptArtifact = async (rawInput, signal) => {
|
|
13
|
+
export const reconstructJavaScriptArtifact = async (rawInput, signal, progress) => {
|
|
14
|
+
const reportPhase = async (phase, message) => {
|
|
15
|
+
await progress?.report({ phase, completed: 0, total: 1, message });
|
|
16
|
+
await checkpointJavaScriptAnalysis(signal);
|
|
17
|
+
};
|
|
13
18
|
const input = javascriptArtifactReconstructionInputSchema.parse(rawInput);
|
|
14
19
|
abortIfNeeded(signal);
|
|
15
20
|
const path = await realpath(input.input_path);
|
|
@@ -19,15 +24,31 @@ export const reconstructJavaScriptArtifact = async (rawInput, signal) => {
|
|
|
19
24
|
throw new ArtifactReaderFailure("format", `Artifact inventory classified ${path} as ${snapshot.manifest.root_format}, not ${format}`);
|
|
20
25
|
const reader = createReader(path, format);
|
|
21
26
|
try {
|
|
27
|
+
await reportPhase("read_javascript_artifacts", "Reading inventoried JavaScript application sources");
|
|
22
28
|
const files = await readJavaScriptArtifactFiles(reader, snapshot, signal);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
await reportPhase("parse_javascript_sources", `Parsing and projecting ${String(files.files.length)} application source files`);
|
|
30
|
+
const semanticProjection = createJavaScriptSemanticGraphProjection();
|
|
31
|
+
const analysis = await analyzeAndProjectJavaScriptArtifactFiles(files, semanticProjection.projectFile, async (file, completed, total) => {
|
|
32
|
+
abortIfNeeded(signal);
|
|
33
|
+
await progress?.report({
|
|
34
|
+
phase: "parse_javascript_source",
|
|
35
|
+
completed: 0,
|
|
36
|
+
total: 1,
|
|
37
|
+
message: `Parsing and projecting ${file.path} (${String(completed + 1)}/${String(total)})`,
|
|
38
|
+
});
|
|
39
|
+
abortIfNeeded(signal);
|
|
30
40
|
});
|
|
41
|
+
await checkpointJavaScriptAnalysis(signal);
|
|
42
|
+
abortIfNeeded(signal);
|
|
43
|
+
await reportPhase("build_javascript_application_graph", "Constructing application and Electron boundary relationships");
|
|
44
|
+
const applicationGraphSteps = buildImmutableJavaScriptArtifactGraphSteps(snapshot, files, analysis);
|
|
45
|
+
await reportPhase("seal_javascript_application_graph", "Sealing the validated application graph");
|
|
46
|
+
const graph = await completeJavaScriptAnalysisSteps(applicationGraphSteps, signal);
|
|
47
|
+
await reportPhase("build_javascript_semantic_graph", "Binding and validating static semantic relationships");
|
|
48
|
+
const semanticGraphSteps = semanticProjection.finishImmutableSteps(snapshot.manifest.root_sha256, graph, analysis);
|
|
49
|
+
await reportPhase("seal_javascript_semantic_graph", "Sealing the validated semantic graph");
|
|
50
|
+
const semanticGraph = await completeJavaScriptAnalysisSteps(semanticGraphSteps, signal);
|
|
51
|
+
await checkpointJavaScriptAnalysis(signal);
|
|
31
52
|
return {
|
|
32
53
|
input_path: path,
|
|
33
54
|
format,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import { compareCodePoints } from "../../domain/canonicalOrdering.js";
|
|
3
3
|
import { completeApplicationCoverage, partialApplicationCoverage, } from "../../domain/javascript/javascriptApplicationEvidenceSchemas.js";
|
|
4
|
+
import { semanticCoverageResourceLimits } from "../../domain/javascript/javascriptSemanticCoverage.js";
|
|
5
|
+
import { SEMANTIC_EXPRESSION_DEPTH_LIMIT, SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT, SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT, semanticResourceLimitReason, } from "../../domain/javascript/javascriptSemanticResourceLimits.js";
|
|
4
6
|
import { addAstContainsEdge, artifactLocalIdentity, } from "./JavaScriptArtifactGraphContext.js";
|
|
5
7
|
import { astObservationEvidence, staticInferenceEvidence, } from "./JavaScriptArtifactGraphEvidence.js";
|
|
6
8
|
import { resolveArtifactPathByContext, } from "./JavaScriptArtifactPathResolution.js";
|
|
@@ -58,6 +60,7 @@ export const addJavaScriptSourceModules = (context) => {
|
|
|
58
60
|
};
|
|
59
61
|
/** Compose bounded CommonJS and ESM binding relationships across artifact files. */
|
|
60
62
|
export const addJavaScriptModuleRelationships = (context) => {
|
|
63
|
+
const omissions = { selfImports: 0 };
|
|
61
64
|
for (const analyzed of context.analysis.files) {
|
|
62
65
|
const { file, semantic } = analyzed;
|
|
63
66
|
const source = context.sourceModuleNodes.get(file.path);
|
|
@@ -66,16 +69,17 @@ export const addJavaScriptModuleRelationships = (context) => {
|
|
|
66
69
|
for (const link of semantic.ir.moduleLinks) {
|
|
67
70
|
const input = { context, file, semantic, source, link };
|
|
68
71
|
if (isExportLink(link))
|
|
69
|
-
addExportRelationship(input);
|
|
72
|
+
addExportRelationship(input, omissions);
|
|
70
73
|
else if (link.specifier !== null)
|
|
71
|
-
addImportRelationship(input, source, {
|
|
74
|
+
addImportRelationship(input, source, omissions, {
|
|
72
75
|
specifier: link.specifier,
|
|
73
76
|
importedPath: link.importedName === null ? [] : [link.importedName],
|
|
74
77
|
});
|
|
75
78
|
}
|
|
76
79
|
}
|
|
80
|
+
return omissions;
|
|
77
81
|
};
|
|
78
|
-
const addExportRelationship = (input) => {
|
|
82
|
+
const addExportRelationship = (input, omissions) => {
|
|
79
83
|
const { context, file, semantic, source, link } = input;
|
|
80
84
|
if (link.exportedName === null)
|
|
81
85
|
return;
|
|
@@ -137,10 +141,18 @@ const addExportRelationship = (input) => {
|
|
|
137
141
|
});
|
|
138
142
|
const origin = moduleOriginForExport(semantic.ir, link);
|
|
139
143
|
if (origin !== null)
|
|
140
|
-
addImportRelationship(input, exported, origin);
|
|
144
|
+
addImportRelationship(input, exported, omissions, origin);
|
|
141
145
|
};
|
|
142
|
-
const addImportRelationship = (input, source, origin) => {
|
|
146
|
+
const addImportRelationship = (input, source, omissions, origin) => {
|
|
143
147
|
const target = resolveModuleTarget(input, origin.specifier);
|
|
148
|
+
// A specifier that resolves back to the importing module itself (a literal
|
|
149
|
+
// self-import, self-require, or artifact-confined path alias)
|
|
150
|
+
// cannot become an edge: the application graph forbids self-referential
|
|
151
|
+
// edges, and emitting one fails result validation for the whole analysis.
|
|
152
|
+
if (target.node.node_id === source.node_id) {
|
|
153
|
+
omissions.selfImports += 1;
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
144
156
|
input.context.accumulator.addEdge({
|
|
145
157
|
source_node_id: source.node_id,
|
|
146
158
|
target_node_id: target.node.node_id,
|
|
@@ -242,12 +254,29 @@ const relationshipEvidence = (input, operation, limitations, confidence = "high"
|
|
|
242
254
|
operation,
|
|
243
255
|
coverage: semanticCoverage(input.semantic),
|
|
244
256
|
confidence,
|
|
245
|
-
limitations: [
|
|
257
|
+
limitations: [
|
|
258
|
+
...input.semantic.ir.limitations,
|
|
259
|
+
...semanticCoverageResourceLimits(input.semantic.ir.coverage).map(semanticResourceLimitReason),
|
|
260
|
+
...limitations,
|
|
261
|
+
],
|
|
246
262
|
});
|
|
247
263
|
const semanticCoverage = (semantic) => {
|
|
248
|
-
|
|
264
|
+
const resourceLimits = semanticCoverageResourceLimits(semantic.ir.coverage);
|
|
265
|
+
if (semantic.ir.coverage.status === "complete" && resourceLimits.length === 0)
|
|
249
266
|
return completeApplicationCoverage();
|
|
250
|
-
return partialApplicationCoverage(
|
|
267
|
+
return partialApplicationCoverage(resourceLimits.map((resourceLimit) => ({
|
|
268
|
+
name: `javascript_semantic_${resourceLimit.replaceAll("-", "_")}`,
|
|
269
|
+
value: resourceLimit === "primitive-candidates"
|
|
270
|
+
? SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT
|
|
271
|
+
: resourceLimit === "primitive-bytes"
|
|
272
|
+
? SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT
|
|
273
|
+
: SEMANTIC_EXPRESSION_DEPTH_LIMIT,
|
|
274
|
+
unit: resourceLimit === "expression-depth"
|
|
275
|
+
? "depth"
|
|
276
|
+
: resourceLimit === "primitive-bytes"
|
|
277
|
+
? "bytes"
|
|
278
|
+
: "items",
|
|
279
|
+
})), semantic.ir.coverage.omittedCount);
|
|
251
280
|
};
|
|
252
281
|
const moduleFormat = (path, ir) => {
|
|
253
282
|
const extension = posix.extname(path).toLowerCase();
|
|
@@ -3,7 +3,7 @@ import { AnalysisCancelledError, AnalysisInputError, AnalysisOutputError, } from
|
|
|
3
3
|
import { createEvidence } from "../../domain/evidence.js";
|
|
4
4
|
import { javascriptRecoveryInputSchema, javascriptRecoveryResultSchema, } from "../../domain/javascript/javascriptRecovery.js";
|
|
5
5
|
import { jsonObjectSchema } from "../../domain/jsonValue.js";
|
|
6
|
-
import {
|
|
6
|
+
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
|
|
7
7
|
import { err, ok } from "../../domain/result.js";
|
|
8
8
|
const OPERATION = "recover_javascript_sources";
|
|
9
9
|
/** Shared CLI/MCP parsing and Evidence for derived JavaScript artifacts. */
|
|
@@ -18,7 +18,9 @@ export class JavaScriptRecoveryService {
|
|
|
18
18
|
return err(new AnalysisCancelledError(OPERATION));
|
|
19
19
|
const parsed = javascriptRecoveryInputSchema.safeParse(input);
|
|
20
20
|
if (!parsed.success)
|
|
21
|
-
return err(
|
|
21
|
+
return err(analysisInputErrorFromIssues(OPERATION, parsed.error.issues, input, {
|
|
22
|
+
cause: parsed.error,
|
|
23
|
+
}));
|
|
22
24
|
const invalidPaths = ["path", "output_directory"].filter((field) => !isAbsolute(parsed.data[field]));
|
|
23
25
|
if (invalidPaths.length > 0)
|
|
24
26
|
return err(new AnalysisInputError(OPERATION, undefined, invalidPaths.map((field) => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createJavaScriptRuntimeObservationEvidence } from "./JavaScriptRuntimeObservationEvidence.js";
|
|
2
|
-
import { AnalysisCapabilityUnavailableError } from "../../domain/analysisErrorCore.js";
|
|
2
|
+
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, } from "../../domain/analysisErrorCore.js";
|
|
3
3
|
import {} from "../../domain/analysisErrorBase.js";
|
|
4
4
|
import { err, ok } from "../../domain/result.js";
|
|
5
5
|
/** List targets exposed by the explicitly selected loopback Inspector. */
|
|
@@ -18,6 +18,8 @@ export const observeJavaScriptRuntime = async (provider, input, options = {}) =>
|
|
|
18
18
|
if (!ready.ok)
|
|
19
19
|
return ready;
|
|
20
20
|
const result = await ready.value.observe(input, options);
|
|
21
|
+
if (options.signal?.aborted === true)
|
|
22
|
+
return err(new AnalysisCancelledError("observe_javascript_runtime"));
|
|
21
23
|
return result.ok
|
|
22
24
|
? ok(createJavaScriptRuntimeObservationEvidence("observe_javascript_runtime", input, result.value, ready.value.identity()))
|
|
23
25
|
: result;
|
|
@@ -2,7 +2,7 @@ import { resolve } from "node:path";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { AnalysisInputError, AnalysisProtocolError, } from "../../domain/analysisErrorCore.js";
|
|
4
4
|
import {} from "../../domain/analysisErrorBase.js";
|
|
5
|
-
import {
|
|
5
|
+
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
|
|
6
6
|
import { reconcileJavaScriptRuntime } from "../../domain/javascript/javascriptRuntimeReconciliation.js";
|
|
7
7
|
import { reconcileJavaScriptRuntimeInputSchema } from "../../domain/javascript/javascriptRuntimeReconciliationSchemas.js";
|
|
8
8
|
import { err, ok } from "../../domain/result.js";
|
|
@@ -12,7 +12,7 @@ const OPERATION = "reconcile_javascript_runtime";
|
|
|
12
12
|
export const reconcileJavaScriptRuntimeEvidence = (rawInput) => {
|
|
13
13
|
const parsed = reconcileJavaScriptRuntimeInputSchema.safeParse(rawInput);
|
|
14
14
|
if (!parsed.success)
|
|
15
|
-
return err(
|
|
15
|
+
return err(analysisInputErrorFromIssues(OPERATION, parsed.error.issues, rawInput));
|
|
16
16
|
return reconcileJavaScriptRuntimeEvidenceValidated(parsed.data);
|
|
17
17
|
};
|
|
18
18
|
/** Reconcile input already parsed by a trusted adapter boundary. */
|
|
@@ -24,7 +24,7 @@ export const reconcileJavaScriptRuntimeEvidenceValidated = (parsedInput) => {
|
|
|
24
24
|
}
|
|
25
25
|
catch (cause) {
|
|
26
26
|
if (cause instanceof z.ZodError)
|
|
27
|
-
return err(
|
|
27
|
+
return err(analysisInputErrorFromIssues(OPERATION, cause.issues, parsedInput));
|
|
28
28
|
if (cause instanceof TypeError &&
|
|
29
29
|
SAFE_RECONCILIATION_INPUT_CONSTRAINTS.has(cause.message))
|
|
30
30
|
return err(new AnalysisInputError(OPERATION, undefined, [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createJavaScriptSemanticGraphUnknown } from "../../domain/javascript/javascriptSemanticGraph.js";
|
|
2
|
-
import {
|
|
2
|
+
import { retainSemanticGraphNode, addSemanticGraphRelation, addSemanticGraphUnknown, } from "./JavaScriptSemanticGraphConstruction.js";
|
|
3
3
|
import { unknownSemanticEvidence } from "./JavaScriptSemanticGraphEvidence.js";
|
|
4
4
|
import { semanticCallSiteAt, } from "./JavaScriptSemanticGraphFlowProjection.js";
|
|
5
5
|
/** Project literal EventEmitter registrations, removals, and dispatches. */
|
|
@@ -34,7 +34,7 @@ export const projectSemanticEvents = (context) => {
|
|
|
34
34
|
addEventUnknown(context, operation, event, relation);
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
const addEventNode = (context, operation, eventKey) =>
|
|
37
|
+
const addEventNode = (context, operation, eventKey) => retainSemanticGraphNode(context.state, context.file, {
|
|
38
38
|
kind: "event",
|
|
39
39
|
roleKey: `event:${eventKey}`,
|
|
40
40
|
location: operation.eventName === null ? operation.location : null,
|
|
@@ -44,8 +44,8 @@ const addEventNode = (context, operation, eventKey) => addSemanticGraphNode(cont
|
|
|
44
44
|
emitter_key: operation.emitterKey,
|
|
45
45
|
event_name: operation.eventName,
|
|
46
46
|
},
|
|
47
|
-
}
|
|
48
|
-
const addListenerNode = (context, operation) =>
|
|
47
|
+
});
|
|
48
|
+
const addListenerNode = (context, operation) => retainSemanticGraphNode(context.state, context.file, {
|
|
49
49
|
kind: "listener",
|
|
50
50
|
roleKey: `listener:${operation.eventId}`,
|
|
51
51
|
location: operation.listenerLocation ?? operation.location,
|
|
@@ -61,7 +61,7 @@ const addListenerNode = (context, operation) => addSemanticGraphNode(context.sta
|
|
|
61
61
|
event_name: operation.eventName,
|
|
62
62
|
method: operation.method,
|
|
63
63
|
},
|
|
64
|
-
}
|
|
64
|
+
});
|
|
65
65
|
const eventEmitterNode = (context, operation) => (operation.emitterBindingId === null
|
|
66
66
|
? undefined
|
|
67
67
|
: context.bindingNodes.get(operation.emitterBindingId)) ??
|
|
@@ -95,7 +95,7 @@ export const projectSemanticTimers = (context) => {
|
|
|
95
95
|
const owner = operation.ownerCallableId === null
|
|
96
96
|
? undefined
|
|
97
97
|
: context.callableNodes.get(operation.ownerCallableId);
|
|
98
|
-
const timer =
|
|
98
|
+
const timer = retainSemanticGraphNode(context.state, context.file, {
|
|
99
99
|
kind: "timer",
|
|
100
100
|
roleKey: operation.timerId,
|
|
101
101
|
location: operation.location,
|
|
@@ -105,7 +105,7 @@ export const projectSemanticTimers = (context) => {
|
|
|
105
105
|
delay_milliseconds: operation.delayMilliseconds,
|
|
106
106
|
method: operation.method,
|
|
107
107
|
},
|
|
108
|
-
}
|
|
108
|
+
});
|
|
109
109
|
return timer === null ? [] : [[operation.timerId, timer]];
|
|
110
110
|
}));
|
|
111
111
|
for (const operation of context.ir.timerOperations)
|