rea-agents 4.0.0 → 4.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 +93 -30
- package/bridge/ghidra/ReaGhidraBridge.java +358 -15
- package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
- package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
- package/dist/android/AndroidTargetSnapshot.js +34 -0
- package/dist/android/JadxAnalysis.js +191 -0
- package/dist/android/JadxConfiguration.js +41 -0
- package/dist/android/JadxMcpTransport.js +145 -0
- package/dist/android/JadxProtocol.js +101 -0
- package/dist/android/JadxProvider.js +170 -0
- package/dist/android/JadxRelease.js +19 -0
- package/dist/android/JadxSession.js +97 -0
- package/dist/application/AnalysisContextQueries.js +2 -1
- package/dist/application/AnalysisProviderEvaluation.js +5 -3
- package/dist/application/AnalysisProviderRegistry.js +2 -1
- package/dist/application/AnalysisSnapshotCache.js +4 -1
- package/dist/application/AnalysisSnapshotFiles.js +1 -1
- package/dist/application/AndroidAnalysisPort.js +1 -0
- package/dist/application/AndroidAnalysisService.js +37 -0
- package/dist/application/ArtifactExtraction.js +7 -4
- package/dist/application/ArtifactGraphConstruction.js +10 -17
- package/dist/application/ArtifactInventory/scanCanonical.js +8 -7
- package/dist/application/BinarySession.js +16 -3
- package/dist/application/BinarySessionExecution.js +4 -1
- package/dist/application/BinarySessionOpen.js +3 -2
- package/dist/application/BinarySessionRecords.js +9 -3
- package/dist/application/BinaryTargetResolver.js +25 -6
- package/dist/application/BrowserObservationService.js +2 -1
- package/dist/application/BrowserScenarioCaptureService.js +2 -1
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CallPathTracing.js +2 -1
- package/dist/application/CapabilityInventory.js +18 -0
- package/dist/application/ClientConfigPath.js +3 -1
- package/dist/application/ClientConfigurationDocument.js +11 -1
- package/dist/application/ClientRegistrationStatus.js +8 -1
- package/dist/application/CompositeProvider.js +1 -1
- package/dist/application/DirectAnalysis.js +23 -7
- package/dist/application/DirectAnalysisStatus.js +3 -3
- package/dist/application/Doctor.js +48 -8
- package/dist/application/DoctorDiagnostics.js +7 -5
- package/dist/application/DoctorScope.js +1 -1
- package/dist/application/ElectronActiveEvidence.js +2 -2
- package/dist/application/ElectronActiveObservationService.js +2 -1
- package/dist/application/ElectronBoundaryAnalysis.js +1 -1
- package/dist/application/ElectronObservationService.js +2 -1
- package/dist/application/EnhancedLiteralTracing.js +2 -1
- package/dist/application/EnhancedToolTypes.js +2 -1
- package/dist/application/EnhancedTools.js +3 -1
- package/dist/application/EvidenceBundleCommands.js +2 -1
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/EvidenceInputResolver.js +30 -0
- package/dist/application/EvidenceLedger.js +2 -1
- package/dist/application/FirmwareAnalysisPort.js +1 -0
- package/dist/application/FirmwareAnalysisService.js +35 -0
- package/dist/application/FunctionAnalysisEvidence.js +32 -0
- package/dist/application/InventoryProjectionEvidence.js +2 -1
- package/dist/application/JavaScriptApplicationService.js +50 -3
- package/dist/application/JavaScriptApplicationWorkflowService.js +2 -1
- package/dist/application/JavaScriptArtifactAnalysis.js +4 -2
- package/dist/application/JavaScriptArtifactFiles.js +4 -2
- package/dist/application/JavaScriptArtifactPathResolution.js +6 -2
- package/dist/application/JavaScriptJsonModules.js +3 -2
- package/dist/application/JavaScriptModuleRelationships.js +4 -2
- package/dist/application/JavaScriptRuntimeObservationService.js +2 -1
- package/dist/application/JavaScriptRuntimeReconciliationService.js +2 -1
- package/dist/application/JavaScriptSemanticGraphProjection.js +1 -1
- package/dist/application/JavaScriptSemanticTraceService.js +2 -1
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +3 -1
- package/dist/application/LinuxHopper.js +12 -4
- package/dist/application/MacHopper.js +20 -7
- package/dist/application/ManagedApplicationGraphService.js +2 -1
- package/dist/application/ManagedMemberComparisonService.js +3 -1
- package/dist/application/ManagedNativeVerificationService.js +2 -1
- package/dist/application/ManagedReconstructionService.js +2 -1
- package/dist/application/NativeCallRoutes.js +1 -1
- package/dist/application/NativeDispatchMetadataInspection.js +1 -1
- package/dist/application/NativeUiActionTrace.js +2 -1
- package/dist/application/NativeValueTrace.js +1 -1
- package/dist/application/ProcessCaptureError.js +1 -1
- package/dist/application/ProcessCaptureJournal.js +3 -1
- package/dist/application/ProcessCaptureLifecycle.js +6 -3
- package/dist/application/ProcessCli.js +9 -5
- package/dist/application/ProcessEvidence.js +2 -6
- package/dist/application/ProcessHarness.js +3 -2
- package/dist/application/ProcessNormalization.js +12 -5
- package/dist/application/ProcessSampling.js +3 -1
- package/dist/application/ReconstructionCoverageService.js +2 -1
- package/dist/application/ReconstructionObligationLedgerService.js +2 -1
- package/dist/application/ReferenceSourceImportEntries.js +2 -0
- package/dist/application/ReferenceSourceImportPolicy.js +4 -2
- package/dist/application/ReferenceSourceVcsAdapter.js +35 -4
- package/dist/application/SessionProviderRouter.js +4 -1
- package/dist/application/Setup.js +1 -128
- package/dist/application/SetupClientConfiguration.js +17 -6
- package/dist/application/SetupHost.js +111 -0
- package/dist/application/SetupRegistrationEnvironment.js +1 -2
- package/dist/application/SetupSkill.js +9 -3
- package/dist/application/SetupTypes.js +17 -0
- package/dist/application/StoreFileLock.js +7 -2
- package/dist/application/SupportedClients.js +8 -0
- package/dist/application/Uninstall.js +9 -4
- package/dist/application/UpdateRuntime.js +5 -2
- package/dist/application/WindowsCapabilities.js +7 -7
- package/dist/application/runtime.js +3 -1
- package/dist/artifacts/ArtifactProvider.js +3 -1
- package/dist/artifacts/DirectoryArtifactReader.js +2 -0
- package/dist/artifacts/NativeDmgArtifactReader.js +10 -3
- package/dist/artifacts/NibArchive.js +4 -2
- package/dist/artifacts/SafeOutputTree.js +26 -10
- package/dist/artifacts/ZipArtifactReader.js +1 -0
- package/dist/browser/BrowserProcessStartup.js +3 -1
- package/dist/browser/CdpAuthorizedMainFrame.js +1 -1
- package/dist/browser/CdpBrowserProvider.js +4 -1
- package/dist/browser/CdpCaptureDocuments.js +3 -1
- package/dist/browser/CdpCaptureEventHandlers.js +6 -2
- package/dist/browser/CdpCaptureStorageFingerprints.js +1 -1
- package/dist/browser/CdpCaptureValues.js +6 -2
- package/dist/browser/CdpConnection.js +8 -6
- package/dist/browser/CdpElectronInspection.js +3 -3
- package/dist/browser/CdpElectronProvider.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpEndpoint.js +22 -10
- package/dist/browser/CdpObservationSession.js +2 -1
- package/dist/browser/CdpOptionalCommand.js +1 -1
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpSafeMetadata.js +53 -8
- package/dist/browser/CdpScreenshot.js +1 -1
- package/dist/browser/CdpTargetSession.js +8 -5
- package/dist/browser/CdpWebMcpDiscovery.js +1 -1
- package/dist/browser/ElectronFileScope.js +9 -3
- package/dist/browser/JavaScriptRuntimeScope.js +3 -1
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +3 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +1 -1
- package/dist/browser/PlaywrightElectronActiveProvider.js +6 -2
- package/dist/browser/PlaywrightExecutionBoundary.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +10 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +3 -1
- package/dist/browser/PlaywrightScenarioEvents.js +6 -2
- package/dist/browser/PlaywrightScenarioSession.js +5 -2
- package/dist/browser/V8InspectorEndpoint.js +2 -1
- package/dist/browser/V8InspectorProvider.js +6 -1
- package/dist/browser/WebSourceMapFetcher.js +24 -11
- package/dist/cli/androidCommands.js +81 -0
- package/dist/{cliApplicationCommands.js → cli/applicationCommands.js} +18 -16
- package/dist/{cliBrowserAdvancedCommands.js → cli/browserAdvancedCommands.js} +13 -16
- package/dist/{cliBrowserCommands.js → cli/browserCommands.js} +9 -9
- package/dist/cli/commandCancellation.js +24 -0
- package/dist/cli/coreAnalysisCommands.js +110 -17
- package/dist/{cliElectronCommands.js → cli/electronCommands.js} +14 -13
- package/dist/cli/firmwareCommands.js +75 -0
- package/dist/{cliSetup.js → cli/interactiveSetup.js} +1 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/managedCommands.js +1 -1
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/options.js +7 -1
- package/dist/{cliProcessCommands.js → cli/processCommands.js} +3 -3
- package/dist/cli/referenceSourceImportStatus.js +10 -0
- package/dist/cli/setupCommands.js +4 -2
- package/dist/cli/utilityCommands.js +3 -2
- package/dist/cli.js +10 -15
- package/dist/cliBrowserContext.js +1 -1
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +11 -2
- package/dist/cliEvidenceCommands.js +2 -1
- package/dist/cliJavaScriptRuntimeCommands.js +2 -1
- package/dist/cliJsonInput.js +26 -11
- package/dist/cliLogging.js +2 -1
- package/dist/cliOutput.js +15 -16
- package/dist/config/environment.js +11 -1
- package/dist/config/parseConfig.js +7 -1
- package/dist/config/parsers.js +1 -1
- package/dist/contracts/androidToolContracts.js +77 -0
- package/dist/contracts/applicationToolContracts.js +32 -5
- package/dist/contracts/applicationWorkflowInputContracts.js +13 -13
- package/dist/contracts/artifactComparisonExample.js +7 -14
- package/dist/contracts/enhancedToolContracts.js +31 -0
- package/dist/contracts/errorSchemas.js +4 -2
- package/dist/contracts/evidenceInputContracts.js +13 -0
- package/dist/contracts/firmwareToolContracts.js +38 -0
- package/dist/contracts/officialToolContracts.js +66 -0
- package/dist/contracts/promptContracts.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -0
- package/dist/contracts/sessionToolContracts.js +43 -0
- package/dist/contracts/sessionToolSchemas.js +1 -1
- package/dist/contracts/toolContractExamples.js +5 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +7 -130
- package/dist/contracts/toolEffects.js +43 -0
- package/dist/contracts/toolOutputSchemaGroups.js +4 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -0
- package/dist/doctorRuntime.js +5 -1
- package/dist/domain/analysisErrorBase.js +33 -0
- package/dist/domain/analysisErrorCore.js +60 -0
- package/dist/domain/analysisErrorPresentation.js +22 -2
- package/dist/domain/analysisErrorProjection.js +24 -3
- package/dist/domain/analysisSnapshot.js +1 -0
- package/dist/domain/androidAnalysis.js +141 -0
- package/dist/domain/appleAssetCatalog.js +1 -1
- package/dist/domain/artifactGraph.js +1 -0
- package/dist/domain/artifactInspection.js +19 -17
- package/dist/domain/artifactInventoryEvidence.js +20 -25
- package/dist/domain/artifactOperationError.js +16 -0
- package/dist/domain/browserObservation.js +12 -4
- package/dist/domain/browserObservationError.js +23 -0
- package/dist/domain/browserScenario.js +1 -1
- package/dist/domain/browserScenarioCapture.js +1 -1
- package/dist/domain/browserScenarioDiff.js +1 -1
- package/dist/domain/browserScenarioNormalization.js +6 -11
- package/dist/domain/browserScenarioValues.js +3 -1
- package/dist/domain/callPath.js +47 -7
- package/dist/domain/canonicalDigest.js +65 -0
- package/dist/domain/canonicalOrdering.js +11 -0
- package/dist/domain/changedBehavior.js +8 -7
- package/dist/domain/comparisonSemantics.js +2 -4
- package/dist/domain/configurationErrors.js +25 -0
- package/dist/domain/dosCom.js +8 -0
- package/dist/domain/electronActiveObservation.js +3 -1
- package/dist/domain/electronStaticAnalysisBrowser.js +13 -23
- package/dist/domain/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/electronStaticAnalysisValues.js +23 -3
- package/dist/domain/evidence.js +3 -11
- package/dist/domain/evidenceErrors.js +30 -0
- package/dist/domain/firmwareAnalysis.js +121 -0
- package/dist/domain/functionComparison.js +4 -2
- package/dist/domain/functionComparisonDimensions.js +6 -4
- package/dist/domain/functionComparisonNormalization.js +8 -1
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/hopperErrors.js +78 -0
- package/dist/domain/hopperValues.js +2 -1
- package/dist/domain/interfaceBuilderGraph.js +3 -1
- package/dist/domain/javascriptApplicationChangeGraph.js +2 -2
- package/dist/domain/javascriptApplicationGraph.js +13 -22
- package/dist/domain/javascriptApplicationVersionComparison.js +3 -11
- package/dist/domain/javascriptApplicationVersionItems.js +3 -3
- package/dist/domain/javascriptApplicationVersionKeys.js +1 -1
- package/dist/domain/javascriptAstFingerprint.js +1 -1
- package/dist/domain/javascriptExportShapeComparison.js +1 -2
- package/dist/domain/javascriptExportShapeSelection.js +1 -1
- package/dist/domain/javascriptExportShapeVariants.js +7 -3
- package/dist/domain/javascriptFeatureSeed.js +29 -9
- package/dist/domain/javascriptFeatureTrace.js +9 -13
- package/dist/domain/javascriptFeatureTraversal.js +2 -1
- package/dist/domain/javascriptNativeHandoff.js +2 -1
- package/dist/domain/javascriptRuntimeLoadState.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationActive.js +3 -10
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +4 -3
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +8 -14
- package/dist/domain/javascriptRuntimeReconciliationResult.js +4 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +5 -2
- package/dist/domain/javascriptRuntimeStaticCandidates.js +8 -4
- package/dist/domain/javascriptSemanticAnalysis.js +40 -3
- package/dist/domain/javascriptSemanticCallResolution.js +2 -1
- package/dist/domain/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascriptSemanticDataEffects.js +2 -1
- package/dist/domain/javascriptSemanticFingerprints.js +1 -1
- package/dist/domain/javascriptSemanticGraph.js +23 -28
- package/dist/domain/javascriptSemanticPrimitives.js +9 -2
- package/dist/domain/javascriptSemanticProjection.js +2 -1
- package/dist/domain/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascriptSemanticProvenance.js +1 -1
- package/dist/domain/javascriptSemanticQuery.js +7 -8
- package/dist/domain/javascriptSemanticQueryAssessment.js +1 -2
- package/dist/domain/javascriptSemanticQueryIdentity.js +1 -2
- package/dist/domain/javascriptSemanticReturns.js +2 -1
- package/dist/domain/javascriptSemanticValues.js +50 -16
- package/dist/domain/javascriptSourceParser.js +4 -2
- package/dist/domain/javascriptStaticAnalysis.js +1 -1
- package/dist/domain/javascriptStaticAnalysisBundler.js +2 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +14 -6
- package/dist/domain/javascriptStaticAnalysisHelpers.js +31 -4
- package/dist/domain/jsonShape.js +6 -2
- package/dist/domain/managedMemberComparison.js +1 -0
- package/dist/domain/managedMemberComparisonItems.js +2 -0
- package/dist/domain/managedNativeVerificationMatch.js +5 -3
- package/dist/domain/nativeDataType.js +2 -0
- package/dist/domain/nativeFunctionAnnotations.js +43 -0
- package/dist/domain/nativeLoadImage.js +95 -0
- package/dist/domain/nativeMetadataRecovery.js +55 -0
- package/dist/domain/processCapture.js +0 -1
- package/dist/domain/processEvidenceProvider.js +11 -0
- package/dist/domain/processTraceComparison.js +1 -1
- package/dist/domain/providerAdapterError.js +17 -0
- package/dist/domain/providerCleanupError.js +1 -1
- package/dist/domain/providerSelectionError.js +44 -0
- package/dist/domain/reconstructionUnknowns.js +1 -1
- package/dist/domain/reconstructionVerification.js +22 -8
- package/dist/domain/referenceSourceClassification.js +5 -6
- package/dist/domain/referenceSourceGraph.js +9 -17
- package/dist/domain/referenceSourceImportParsing.js +38 -23
- package/dist/domain/runtimeIdentification.js +1 -1
- package/dist/domain/runtimeVersion.js +4 -7
- package/dist/domain/safeJson.js +13 -0
- package/dist/domain/sourceToBundleComparison.js +5 -7
- package/dist/domain/sourceToBundleSignals.js +6 -6
- package/dist/domain/staticRuntimeCorrelation.js +9 -7
- package/dist/domain/unknownRegistryError.js +10 -0
- package/dist/domain/webBundleAnalyzerAst.js +22 -5
- package/dist/domain/webBundleAnalyzerInspection.js +20 -14
- package/dist/dotnet/ManagedMemberRows.js +1 -1
- package/dist/dotnet/ManagedMetadataHeaps.js +3 -2
- package/dist/dotnet/ManagedMetadataInventoryRows.js +4 -2
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -1
- package/dist/dotnet/ManagedStaticProvider.js +3 -1
- package/dist/firmware/FirmwareCommand.js +163 -0
- package/dist/firmware/FirmwareFiles.js +190 -0
- package/dist/firmware/FirmwareProvider.js +258 -0
- package/dist/firmware/FirmwarePublication.js +84 -0
- package/dist/firmware/FirmwareRelease.js +32 -0
- package/dist/firmware/FirmwareReports.js +223 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +5 -5
- package/dist/ghidra/GhidraAnalysisProfile.js +37 -8
- package/dist/ghidra/GhidraClient.js +52 -6
- package/dist/ghidra/GhidraDiagnostics.js +3 -0
- package/dist/ghidra/GhidraDoctor.js +38 -14
- package/dist/ghidra/GhidraFunctionValues.js +10 -4
- package/dist/ghidra/GhidraInstallation.js +10 -4
- package/dist/ghidra/GhidraInventoryValues.js +39 -2
- package/dist/ghidra/GhidraLauncher.js +91 -26
- package/dist/ghidra/GhidraLoadImageValues.js +199 -0
- package/dist/ghidra/GhidraProvider.js +129 -13
- package/dist/ghidra/GhidraProviderCapabilities.js +52 -15
- package/dist/ghidra/GhidraRequestQueue.js +2 -2
- package/dist/ghidra/GhidraSessionError.js +31 -4
- package/dist/ghidra/GhidraSessionValues.js +10 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +16 -2
- package/dist/ghidra/GhidraTransport.js +12 -0
- package/dist/ghidra/extensions/GhidraExtensionFailures.js +20 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +170 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +21 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +84 -0
- package/dist/hopper/BridgeLauncher.js +4 -2
- package/dist/hopper/HopperAnalysisProfile.js +7 -2
- package/dist/hopper/HopperCleanup.js +55 -9
- package/dist/hopper/HopperClient.js +14 -4
- package/dist/hopper/HopperProcessDiagnostic.js +1 -1
- package/dist/hopper/HopperProvider.js +8 -4
- package/dist/hopper/HopperRequestQueue.js +7 -3
- package/dist/hopper/HopperSessionValues.js +1 -1
- package/dist/hopper/HopperSocketConnection.js +1 -1
- package/dist/hopper/HopperTargetLease.js +23 -15
- package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +7 -8
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -2
- package/dist/hopper/protocol.js +8 -8
- package/dist/ida/IdaConfiguration.js +56 -0
- package/dist/ida/IdaDoctor.js +53 -0
- package/dist/ida/IdaInput.js +62 -0
- package/dist/ida/IdaMcpConnection.js +111 -0
- package/dist/ida/IdaOperationRunner.js +299 -0
- package/dist/ida/IdaProtocolValues.js +178 -0
- package/dist/ida/IdaProvider.js +126 -0
- package/dist/ida/IdaProviderCapabilities.js +60 -0
- package/dist/ida/IdaSessionClient.js +306 -0
- package/dist/ida/IdaWorkspace.js +54 -0
- package/dist/main/shutdown.js +21 -1
- package/dist/main/startup.js +1 -1
- package/dist/main/transport.js +8 -4
- package/dist/main.js +5 -2
- package/dist/native/AppleDispatchMetadata.js +31 -10
- package/dist/native/NativeMacOSProvider.js +87 -15
- package/dist/native/NativeMachoInspection.js +42 -12
- package/dist/native/NativeUiHelperRuntime.js +7 -1
- package/dist/native/NativeUiObservation.js +6 -2
- package/dist/native/parsers/demangle.js +1 -1
- package/dist/native/parsers/dyldInfo.js +3 -3
- package/dist/native/parsers/otool.js +4 -1
- package/dist/native/parsers/plist.js +11 -3
- package/dist/process/PrivateRuntimeRoot.js +13 -3
- package/dist/process/ProcessOwnership.js +5 -73
- package/dist/process/ProcessOwnershipObservation.js +62 -2
- package/dist/process/ProcessOwnershipProcessTree.js +13 -0
- package/dist/process/ProviderProcess.js +24 -7
- package/dist/process/ProviderRunLineage.js +1 -1
- package/dist/process/WindowsAuthority.js +20 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +1 -0
- package/dist/server/createServer.js +25 -2
- package/dist/server/mcpProgress.js +2 -1
- package/dist/server/promptCompletion.js +3 -3
- package/dist/server/registerAndroidTools.js +30 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +5 -1
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +7 -2
- package/dist/server/registerApplicationTools/compareVersions.js +5 -1
- package/dist/server/registerApplicationTools/traceFeature.js +7 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +7 -2
- package/dist/server/registerEnhancedTools.js +28 -1
- package/dist/server/registerFirmwareTools.js +22 -0
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools/helpers.js +2 -1
- package/dist/server/registerManagedTools.js +1 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +1 -1
- package/dist/server/registerOfficialTools.js +4 -1
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerSessionTools.js +3 -1
- package/dist/server/runDerivedOperation.js +1 -1
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/sessionEvidence.js +1 -1
- package/dist/server/toolResult.js +2 -1
- package/dist/windows/WindowsNativeLoader.js +108 -0
- package/dist/windows/WindowsOwnedProcess.js +168 -0
- package/dist/windows/WindowsPrivateRuntime.js +137 -0
- package/install.sh +4 -6
- package/native/windows/README.md +102 -0
- package/native/windows/build/manifest.json +9 -0
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -24
- package/scripts/rea.mjs +1 -1
- package/scripts/verify-windows-native-artifact.mjs +39 -0
- package/skills/reverse-engineer-anything/SKILL.md +92 -24
- package/skills/reverse-engineer-anything/references/android-applications.md +31 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +19 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +52 -4
- package/dist/browser/CdpCanonicalJsonDigest.js +0 -9
- package/dist/domain/errors.js +0 -324
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
3
|
import { evidenceSchema } from "./evidence.js";
|
|
3
4
|
import { javascriptRuntimeUnresolvedLocationSchema } from "./javascriptRuntimeObservation.js";
|
|
4
|
-
import {
|
|
5
|
+
import { javascriptApplicationGraphSchema } from "./javascriptApplicationGraph.js";
|
|
5
6
|
import { digestSchema } from "./../domain/digests.js";
|
|
6
7
|
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
7
8
|
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
@@ -32,7 +33,9 @@ const normalizeRuntimeUrlPrefix = (value) => {
|
|
|
32
33
|
try {
|
|
33
34
|
url = new URL(value);
|
|
34
35
|
}
|
|
35
|
-
catch {
|
|
36
|
+
catch (cause) {
|
|
37
|
+
// Invalid input is represented by the null return.
|
|
38
|
+
void cause;
|
|
36
39
|
return null;
|
|
37
40
|
}
|
|
38
41
|
if (!["http:", "https:"].includes(url.protocol) ||
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { posix, relative, win32 } from "node:path";
|
|
2
|
-
import {
|
|
2
|
+
import {} from "./javascriptApplicationGraph.js";
|
|
3
|
+
import { compareCodePoints, uniqueSorted } from "./canonicalOrdering.js";
|
|
3
4
|
/** Index statically reconstructed entities that can receive runtime matches. */
|
|
4
5
|
export const collectStaticRuntimeCandidates = (layers) => layers
|
|
5
6
|
.flatMap((layer) => candidatesForLayer(layer))
|
|
@@ -156,7 +157,9 @@ const pathBelowUrlPrefix = (prefix, value) => {
|
|
|
156
157
|
base = new URL(prefix);
|
|
157
158
|
candidate = new URL(value);
|
|
158
159
|
}
|
|
159
|
-
catch {
|
|
160
|
+
catch (cause) {
|
|
161
|
+
// Invalid input is represented by the null return.
|
|
162
|
+
void cause;
|
|
160
163
|
return null;
|
|
161
164
|
}
|
|
162
165
|
if (base.origin !== candidate.origin ||
|
|
@@ -165,7 +168,9 @@ const pathBelowUrlPrefix = (prefix, value) => {
|
|
|
165
168
|
try {
|
|
166
169
|
return normalizeArtifactPath(decodeURIComponent(candidate.pathname.slice(base.pathname.length)));
|
|
167
170
|
}
|
|
168
|
-
catch {
|
|
171
|
+
catch (cause) {
|
|
172
|
+
// Undecodable path segments are represented by the null return.
|
|
173
|
+
void cause;
|
|
169
174
|
return null;
|
|
170
175
|
}
|
|
171
176
|
};
|
|
@@ -202,4 +207,3 @@ const uniqueMappedPaths = (values) => [
|
|
|
202
207
|
...new Map(values.map((value) => [`${value.basis}:${value.path}`, value])).values(),
|
|
203
208
|
].sort((left, right) => compareCodePoints(left.path, right.path) ||
|
|
204
209
|
compareCodePoints(left.basis, right.basis));
|
|
205
|
-
const uniqueSorted = (values) => [...new Set(values)].sort(compareCodePoints);
|
|
@@ -174,8 +174,43 @@ const bindInnerDeclaration = (node, parent, scope, state) => {
|
|
|
174
174
|
mutable: true,
|
|
175
175
|
kind: "catch",
|
|
176
176
|
});
|
|
177
|
-
else if (t.isAssignmentExpression(node)
|
|
178
|
-
|
|
177
|
+
else if (t.isAssignmentExpression(node)) {
|
|
178
|
+
if (t.isIdentifier(node.left))
|
|
179
|
+
addAssignment(node.left, node.right, scope, state);
|
|
180
|
+
else
|
|
181
|
+
for (const identifier of assignedPatternIdentifiers(node.left))
|
|
182
|
+
addAssignment(identifier, node, scope, state);
|
|
183
|
+
}
|
|
184
|
+
else if (t.isUpdateExpression(node) && t.isIdentifier(node.argument))
|
|
185
|
+
addAssignment(node.argument, node, scope, state);
|
|
186
|
+
else if (t.isForOfStatement(node) || t.isForInStatement(node))
|
|
187
|
+
for (const identifier of assignedPatternIdentifiers(node.left))
|
|
188
|
+
addAssignment(identifier, node, scope, state);
|
|
189
|
+
};
|
|
190
|
+
const assignedPatternIdentifiers = (pattern) => {
|
|
191
|
+
const identifiers = [];
|
|
192
|
+
const pending = [pattern];
|
|
193
|
+
while (pending.length > 0) {
|
|
194
|
+
const node = pending.pop();
|
|
195
|
+
if (node === undefined)
|
|
196
|
+
continue;
|
|
197
|
+
if (t.isIdentifier(node))
|
|
198
|
+
identifiers.push(node);
|
|
199
|
+
else if (t.isRestElement(node))
|
|
200
|
+
pending.push(node.argument);
|
|
201
|
+
else if (t.isAssignmentPattern(node))
|
|
202
|
+
pending.push(node.left);
|
|
203
|
+
else if (t.isArrayPattern(node)) {
|
|
204
|
+
for (const element of node.elements)
|
|
205
|
+
if (element !== null)
|
|
206
|
+
pending.push(element);
|
|
207
|
+
}
|
|
208
|
+
else if (t.isObjectPattern(node)) {
|
|
209
|
+
for (const property of node.properties)
|
|
210
|
+
pending.push(t.isRestElement(property) ? property.argument : property.value);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return identifiers;
|
|
179
214
|
};
|
|
180
215
|
const nestedScope = (node, parent, parentScope, state) => {
|
|
181
216
|
const switchOwner = t.isSwitchCase(node) && parent !== null && t.isSwitchStatement(parent)
|
|
@@ -290,7 +325,9 @@ const bindPattern = (input) => {
|
|
|
290
325
|
bindPattern({
|
|
291
326
|
...input,
|
|
292
327
|
pattern: pattern.left,
|
|
293
|
-
initializer:
|
|
328
|
+
initializer: kind === "parameter" || kind === "catch"
|
|
329
|
+
? initializer
|
|
330
|
+
: (initializer ?? pattern.right),
|
|
294
331
|
});
|
|
295
332
|
return;
|
|
296
333
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
3
|
import { semanticCallableIdForNode } from "./javascriptSemanticProjection.js";
|
|
3
4
|
import { resolveSemanticBindingState, } from "./javascriptSemanticState.js";
|
|
4
|
-
import {
|
|
5
|
+
import { range } from "./javascriptStaticAnalysisHelpers.js";
|
|
5
6
|
/** Resolve local callable candidates without following dynamic properties. */
|
|
6
7
|
export const resolveLocalCallables = (input) => resolveCallables(input.node, {
|
|
7
8
|
state: input.state,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { semanticCallableIdForNode, semanticStaticPropertyName, } from "./javascriptSemanticProjection.js";
|
|
3
3
|
import { resolveSemanticBindingState, } from "./javascriptSemanticState.js";
|
|
4
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
4
5
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
5
|
-
import {
|
|
6
|
+
import { range } from "./javascriptStaticAnalysisHelpers.js";
|
|
6
7
|
import { dataEffectLiteralString, dataEffectMemberCallee, assignedSemanticResultBindings, scalarAssignedResultBinding, semanticProjectedBindingFacts, } from "./javascriptSemanticDataEffectHelpers.js";
|
|
7
8
|
const CHILD_PROCESS_METHODS = ["spawn", "exec", "execFile", "fork"];
|
|
8
9
|
const CHILD_LISTENER_METHODS = ["on", "once", "addListener"];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
3
|
import { semanticStaticPropertyName } from "./javascriptSemanticProjection.js";
|
|
3
4
|
import { resolveSemanticBindingState, semanticResolutionBlocked, } from "./javascriptSemanticState.js";
|
|
4
5
|
import { builtinDataEffectMethod as builtinMethod, containsSemanticNode as containsNode, dataEffectArgumentBindingId as argumentBindingId, dataEffectLiteralString as literalString, dataEffectMemberCallee as memberCallee, dataEffectMemberObject as memberObject, dataEffectPrimitive as primitiveValue, isSemanticProcessObject as isProcessObject, outerDataEffectBinding as outerAssignedBinding, assignedSemanticResultBindings, semanticProjectedBindingFacts, traverseDataEffects as traverseWithContext, } from "./javascriptSemanticDataEffectHelpers.js";
|
|
5
|
-
import {
|
|
6
|
+
import { range } from "./javascriptStaticAnalysisHelpers.js";
|
|
6
7
|
/** Recover configuration, request, and boundary candidates from inert syntax. */
|
|
7
8
|
export const collectJavaScriptSemanticDataEffects = (program, state, callables) => {
|
|
8
9
|
const context = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import * as t from "@babel/types";
|
|
3
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
3
4
|
import { semanticCallableIdForNode } from "./javascriptSemanticProjection.js";
|
|
4
5
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
5
|
-
import { compareCodePoints } from "./javascriptStaticAnalysisHelpers.js";
|
|
6
6
|
/** Build bounded rename- and formatting-resistant components per callable. */
|
|
7
7
|
export const collectJavaScriptSemanticFingerprints = (input) => {
|
|
8
8
|
const { state, callables, calls, promises, events, timers, childProcessSpawns, childProcessInteractions, requestOperations, resourceOperations, parserPartial, } = input;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import canonicalize from "canonicalize";
|
|
3
1
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
2
|
+
import { canonicalDigest, canonicalJson } from "./comparisonSemantics.js";
|
|
3
|
+
import { compareCodePoints, uniqueSorted } from "./canonicalOrdering.js";
|
|
5
4
|
import { JAVASCRIPT_SEMANTIC_RELATION_FAMILIES, JAVASCRIPT_SEMANTIC_RELATION_FAMILY, javaScriptSemanticFingerprintInputSchema, javaScriptSemanticFingerprintSchema, javaScriptSemanticGraphInputSchema, javaScriptSemanticGraphRecordSchema, javaScriptSemanticNodeInputSchema, javaScriptSemanticNodeSchema, javaScriptSemanticRelationInputSchema, javaScriptSemanticRelationSchema, javaScriptSemanticUnknownInputSchema, javaScriptSemanticUnknownSchema, } from "./javascriptSemanticGraphSchemas.js";
|
|
6
|
-
const canonicalJson = (value) => {
|
|
7
|
-
const encoded = canonicalize(value);
|
|
8
|
-
if (encoded === undefined)
|
|
9
|
-
throw new TypeError("JavaScript semantic graph could not canonicalize data");
|
|
10
|
-
return encoded;
|
|
11
|
-
};
|
|
12
|
-
const digestCanonical = (value) => createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
13
|
-
const uniqueSorted = (values) => [...new Set(values)].sort(compareCodePoints);
|
|
14
5
|
const normalizeEvidence = (evidence) => ({
|
|
15
6
|
...evidence,
|
|
16
7
|
coverage: {
|
|
17
8
|
...evidence.coverage,
|
|
18
|
-
limits: [...evidence.coverage.limits].sort((left, right) => compareCodePoints(canonicalJson(left), canonicalJson(right))),
|
|
9
|
+
limits: [...evidence.coverage.limits].sort((left, right) => compareCodePoints(canonicalJson(left, "JavaScript semantic graph"), canonicalJson(right, "JavaScript semantic graph"))),
|
|
19
10
|
},
|
|
20
11
|
limitations: uniqueSorted(evidence.limitations),
|
|
21
12
|
evidence_ids: uniqueSorted(evidence.evidence_ids),
|
|
22
13
|
});
|
|
23
|
-
const nodeId = (node) => `jsrg_node_${
|
|
14
|
+
const nodeId = (node) => `jsrg_node_${canonicalDigest({ kind: node.kind, identity: node.identity }, "JavaScript semantic graph")}`;
|
|
24
15
|
/** Normalize one semantic entity and derive its artifact-version identifier. */
|
|
25
16
|
export const createJavaScriptSemanticGraphNode = (input) => {
|
|
26
17
|
const parsed = javaScriptSemanticNodeInputSchema.parse(input);
|
|
@@ -51,7 +42,7 @@ export const createJavaScriptSemanticGraphRelation = (input) => {
|
|
|
51
42
|
};
|
|
52
43
|
return javaScriptSemanticRelationSchema.parse({
|
|
53
44
|
...semantic,
|
|
54
|
-
relation_id: `jsrg_relation_${
|
|
45
|
+
relation_id: `jsrg_relation_${canonicalDigest(semantic, "JavaScript semantic graph")}`,
|
|
55
46
|
});
|
|
56
47
|
};
|
|
57
48
|
/** Normalize one unresolved semantic frontier and derive its identifier. */
|
|
@@ -65,7 +56,7 @@ export const createJavaScriptSemanticGraphUnknown = (input) => {
|
|
|
65
56
|
};
|
|
66
57
|
return javaScriptSemanticUnknownSchema.parse({
|
|
67
58
|
...semantic,
|
|
68
|
-
unknown_id: `jsrg_unknown_${
|
|
59
|
+
unknown_id: `jsrg_unknown_${canonicalDigest(semantic, "JavaScript semantic graph")}`,
|
|
69
60
|
});
|
|
70
61
|
};
|
|
71
62
|
/** Normalize one function fingerprint and derive its component commitment. */
|
|
@@ -80,15 +71,15 @@ export const createJavaScriptSemanticFingerprint = (input) => {
|
|
|
80
71
|
limitations: uniqueSorted(parsed.limitations),
|
|
81
72
|
evidence: normalizeEvidence(parsed.evidence),
|
|
82
73
|
};
|
|
83
|
-
const fingerprintSha256 =
|
|
74
|
+
const fingerprintSha256 = canonicalDigest(semantic.components, "JavaScript semantic graph");
|
|
84
75
|
return javaScriptSemanticFingerprintSchema.parse({
|
|
85
76
|
...semantic,
|
|
86
77
|
fingerprint_sha256: fingerprintSha256,
|
|
87
|
-
fingerprint_id: `jsrg_fingerprint_${
|
|
78
|
+
fingerprint_id: `jsrg_fingerprint_${canonicalDigest({
|
|
88
79
|
function_node_id: semantic.function_node_id,
|
|
89
80
|
algorithm: semantic.algorithm,
|
|
90
81
|
fingerprint_sha256: fingerprintSha256,
|
|
91
|
-
})}`,
|
|
82
|
+
}, "JavaScript semantic graph")}`,
|
|
92
83
|
});
|
|
93
84
|
};
|
|
94
85
|
const sortedUniqueIssue = (values, path, label, context) => {
|
|
@@ -105,8 +96,8 @@ const sortedUniqueIssue = (values, path, label, context) => {
|
|
|
105
96
|
};
|
|
106
97
|
const checkCoverage = (graph, context) => {
|
|
107
98
|
const families = graph.coverage.families.map(({ family }) => family);
|
|
108
|
-
if (canonicalJson(families) !==
|
|
109
|
-
canonicalJson(JAVASCRIPT_SEMANTIC_RELATION_FAMILIES))
|
|
99
|
+
if (canonicalJson(families, "JavaScript semantic graph") !==
|
|
100
|
+
canonicalJson(JAVASCRIPT_SEMANTIC_RELATION_FAMILIES, "JavaScript semantic graph"))
|
|
110
101
|
context.addIssue({
|
|
111
102
|
code: "custom",
|
|
112
103
|
path: ["coverage", "families"],
|
|
@@ -193,7 +184,8 @@ const checkRoots = (graph, nodes, context) => {
|
|
|
193
184
|
const checkRelations = (graph, nodes, context) => {
|
|
194
185
|
for (const [index, relation] of graph.relations.entries()) {
|
|
195
186
|
const { relation_id: identifier, ...semantic } = relation;
|
|
196
|
-
if (identifier !==
|
|
187
|
+
if (identifier !==
|
|
188
|
+
"jsrg_relation_" + canonicalDigest(semantic, "JavaScript semantic graph"))
|
|
197
189
|
context.addIssue({
|
|
198
190
|
code: "custom",
|
|
199
191
|
path: ["relations", index, "relation_id"],
|
|
@@ -224,7 +216,8 @@ const checkRelations = (graph, nodes, context) => {
|
|
|
224
216
|
const checkUnknowns = (graph, nodes, context) => {
|
|
225
217
|
for (const [index, unknown] of graph.unknowns.entries()) {
|
|
226
218
|
const { unknown_id: identifier, ...semantic } = unknown;
|
|
227
|
-
if (identifier !==
|
|
219
|
+
if (identifier !==
|
|
220
|
+
"jsrg_unknown_" + canonicalDigest(semantic, "JavaScript semantic graph"))
|
|
228
221
|
context.addIssue({
|
|
229
222
|
code: "custom",
|
|
230
223
|
path: ["unknowns", index, "unknown_id"],
|
|
@@ -274,18 +267,19 @@ const checkFingerprints = (graph, nodes, context) => {
|
|
|
274
267
|
path: ["fingerprints", index, "function_node_id"],
|
|
275
268
|
message: "Fingerprint must name a function node",
|
|
276
269
|
});
|
|
277
|
-
if (fingerprint.fingerprint_sha256 !==
|
|
270
|
+
if (fingerprint.fingerprint_sha256 !==
|
|
271
|
+
canonicalDigest(fingerprint.components, "JavaScript semantic graph"))
|
|
278
272
|
context.addIssue({
|
|
279
273
|
code: "custom",
|
|
280
274
|
path: ["fingerprints", index, "fingerprint_sha256"],
|
|
281
275
|
message: "Fingerprint component commitment is stale",
|
|
282
276
|
});
|
|
283
277
|
const expectedIdentifier = "jsrg_fingerprint_" +
|
|
284
|
-
|
|
278
|
+
canonicalDigest({
|
|
285
279
|
function_node_id: fingerprint.function_node_id,
|
|
286
280
|
algorithm: fingerprint.algorithm,
|
|
287
281
|
fingerprint_sha256: fingerprint.fingerprint_sha256,
|
|
288
|
-
});
|
|
282
|
+
}, "JavaScript semantic graph");
|
|
289
283
|
if (fingerprint.fingerprint_id !== expectedIdentifier)
|
|
290
284
|
context.addIssue({
|
|
291
285
|
code: "custom",
|
|
@@ -318,7 +312,8 @@ const checkGraph = (graph, context) => {
|
|
|
318
312
|
message: "Non-complete graph coverage requires a limitation",
|
|
319
313
|
});
|
|
320
314
|
const { graph_id: identifier, ...semantic } = graph;
|
|
321
|
-
if (identifier !==
|
|
315
|
+
if (identifier !==
|
|
316
|
+
"jsrg_" + canonicalDigest(semantic, "JavaScript semantic graph"))
|
|
322
317
|
context.addIssue({
|
|
323
318
|
code: "custom",
|
|
324
319
|
path: ["graph_id"],
|
|
@@ -339,7 +334,7 @@ export const createJavaScriptSemanticGraph = (input) => {
|
|
|
339
334
|
unknowns: [...parsed.unknowns].sort((left, right) => compareCodePoints(left.unknown_id, right.unknown_id)),
|
|
340
335
|
coverage: {
|
|
341
336
|
...parsed.coverage,
|
|
342
|
-
limits: [...parsed.coverage.limits].sort((left, right) => compareCodePoints(canonicalJson(left), canonicalJson(right))),
|
|
337
|
+
limits: [...parsed.coverage.limits].sort((left, right) => compareCodePoints(canonicalJson(left, "JavaScript semantic graph"), canonicalJson(right, "JavaScript semantic graph"))),
|
|
343
338
|
families: [...parsed.coverage.families]
|
|
344
339
|
.map((family) => ({
|
|
345
340
|
...family,
|
|
@@ -351,6 +346,6 @@ export const createJavaScriptSemanticGraph = (input) => {
|
|
|
351
346
|
};
|
|
352
347
|
return javaScriptSemanticGraphSchema.parse({
|
|
353
348
|
...semantic,
|
|
354
|
-
graph_id: `jsrg_${
|
|
349
|
+
graph_id: `jsrg_${canonicalDigest(semantic, "JavaScript semantic graph")}`,
|
|
355
350
|
});
|
|
356
351
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
3
|
import { semanticPrimitiveKey } from "./javascriptSemanticProvenance.js";
|
|
3
|
-
import { compareCodePoints } from "./javascriptStaticAnalysisHelpers.js";
|
|
4
4
|
/** Normalize one bounded collection of possible primitive values. */
|
|
5
5
|
export const semanticPrimitiveSet = (values) => {
|
|
6
|
+
if (values.some((value) => typeof value === "number" && !Number.isFinite(value)))
|
|
7
|
+
return {
|
|
8
|
+
status: "unknown",
|
|
9
|
+
reason: "Nonfinite numbers are outside the JSON primitive lattice.",
|
|
10
|
+
};
|
|
6
11
|
const unique = [
|
|
7
12
|
...new Map(values.map((value) => [semanticPrimitiveKey(value), value])).values(),
|
|
8
13
|
].sort((left, right) => compareCodePoints(semanticPrimitiveKey(left), semanticPrimitiveKey(right)));
|
|
@@ -19,7 +24,9 @@ export const semanticPrimitiveCandidates = (value) => value.status === "literal"
|
|
|
19
24
|
: null;
|
|
20
25
|
/** Parse one Babel primitive literal without evaluating code. */
|
|
21
26
|
export const semanticPrimitiveValue = (node) => {
|
|
22
|
-
if (t.isStringLiteral(node)
|
|
27
|
+
if (t.isStringLiteral(node))
|
|
28
|
+
return { found: true, value: node.value };
|
|
29
|
+
if (t.isNumericLiteral(node) && Number.isFinite(node.value))
|
|
23
30
|
return { found: true, value: node.value };
|
|
24
31
|
if (t.isBooleanLiteral(node))
|
|
25
32
|
return { found: true, value: node.value };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { resolveSemanticBindingState, semanticResolutionBlocked, isUnshadowedGlobal, } from "./javascriptSemanticState.js";
|
|
3
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
3
4
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
4
5
|
import { evaluateSemanticBinding, evaluateSemanticProvenance, } from "./javascriptSemanticValues.js";
|
|
5
|
-
import {
|
|
6
|
+
import { propertyName, range, stringValue, } from "./javascriptStaticAnalysisHelpers.js";
|
|
6
7
|
import { semanticStaticPropertyName } from "./javascriptAstValues.js";
|
|
7
8
|
/** Retain callable identity without polluting lexical bindings. */
|
|
8
9
|
export const collectSemanticCallable = (input) => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { semanticCallableIdForNode, semanticStaticPropertyName, } from "./javascriptSemanticProjection.js";
|
|
3
3
|
import { resolveSemanticBindingState, semanticResolutionBlocked, } from "./javascriptSemanticState.js";
|
|
4
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
4
5
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
5
|
-
import {
|
|
6
|
+
import { range, sourceRangesEqual } from "./javascriptStaticAnalysisHelpers.js";
|
|
6
7
|
import { assignedSemanticResultBindings, containsSemanticNode, dataEffectMemberCallee, scalarAssignedResultBinding, } from "./javascriptSemanticDataEffectHelpers.js";
|
|
7
8
|
/** Recover explicit Promise construction, chaining, aggregation, and ownership. */
|
|
8
9
|
export const collectJavaScriptSemanticPromises = (program, state, callables) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compareCodePoints } from "./
|
|
1
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
2
|
/** Construct exact local provenance without inventing module origins. */
|
|
3
3
|
export const semanticLocalProvenance = () => ({
|
|
4
4
|
status: "local",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compareCodePoints } from "./
|
|
1
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
2
|
import { isJavaScriptSemanticOwnershipRelation as ownershipRelation } from "./javascriptSemanticQueryRelations.js";
|
|
3
3
|
import { javaScriptSemanticQueryInputSchema, javaScriptSemanticQueryResultSchema, } from "./javascriptSemanticQuerySchemas.js";
|
|
4
4
|
import { assessJavaScriptSemanticQuery } from "./javascriptSemanticQueryAssessment.js";
|
|
@@ -153,13 +153,12 @@ const relevantUnknownFrontiers = (graph, nodeIds, input) => {
|
|
|
153
153
|
unknown.relation_kinds.some((relation) => allowed.has(relation))));
|
|
154
154
|
};
|
|
155
155
|
const relevantCandidateRelationCount = (graph, nodeIds, input) => {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
nodeIds.has(relation.target_node_id))).length;
|
|
156
|
+
const adjacency = buildAdjacency(graph.relations.filter(({ resolution }) => resolution === "candidate"), { ...input, include_ambiguous_dynamic_edges: true });
|
|
157
|
+
const relevant = new Set();
|
|
158
|
+
for (const nodeId of nodeIds)
|
|
159
|
+
for (const { relation } of adjacency.get(nodeId) ?? [])
|
|
160
|
+
relevant.add(relation.relation_id);
|
|
161
|
+
return relevant.size;
|
|
163
162
|
};
|
|
164
163
|
const expectedMatchesFor = (nodes, relations, input) => {
|
|
165
164
|
if (input.expected === null)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uniqueSorted } from "./canonicalOrdering.js";
|
|
2
2
|
/** Classify a complete semantic traversal without promoting unknowns to absence. */
|
|
3
3
|
export const assessJavaScriptSemanticQuery = (input) => ({
|
|
4
4
|
status: queryStatus(input),
|
|
@@ -43,4 +43,3 @@ const queryLimitations = (input) => uniqueSorted([
|
|
|
43
43
|
"Candidate relations remain ambiguous and do not establish a resolved semantic path.",
|
|
44
44
|
]),
|
|
45
45
|
]);
|
|
46
|
-
const uniqueSorted = (values) => [...new Set(values)].sort(compareCodePoints);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
|
-
import { compareCodePoints } from "./
|
|
3
|
+
import { compareCodePoints, uniqueSorted } from "./canonicalOrdering.js";
|
|
4
4
|
/** Canonical JSON used by semantic query commitments and ordering. */
|
|
5
5
|
export const canonicalJavaScriptSemanticQueryJson = (value) => {
|
|
6
6
|
const encoded = canonicalize(value);
|
|
@@ -11,7 +11,6 @@ export const canonicalJavaScriptSemanticQueryJson = (value) => {
|
|
|
11
11
|
const digest = (value) => createHash("sha256")
|
|
12
12
|
.update(canonicalJavaScriptSemanticQueryJson(value))
|
|
13
13
|
.digest("hex");
|
|
14
|
-
const uniqueSorted = (values) => [...new Set(values)].sort(compareCodePoints);
|
|
15
14
|
/** Derive the stable identity for one graph-bound query. */
|
|
16
15
|
export const javaScriptSemanticQueryIdentifier = (graph, input) => {
|
|
17
16
|
const semantic = input;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
3
|
import { semanticCallableIdForNode } from "./javascriptSemanticProjection.js";
|
|
3
4
|
import { resolveSemanticBindingState, } from "./javascriptSemanticState.js";
|
|
4
5
|
import { evaluateSemanticExpression } from "./javascriptSemanticValues.js";
|
|
5
|
-
import {
|
|
6
|
+
import { range } from "./javascriptStaticAnalysisHelpers.js";
|
|
6
7
|
import { semanticReturnCoverage } from "./javascriptSemanticCoverage.js";
|
|
7
8
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
8
9
|
/** Evaluate direct returns while excluding every nested callable. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { resolveSemanticBindingState, semanticResolutionBlocked, } from "./javascriptSemanticState.js";
|
|
3
|
-
import {
|
|
3
|
+
import { stringValue } from "./javascriptStaticAnalysisHelpers.js";
|
|
4
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
4
5
|
import { semanticStaticPropertyName } from "./javascriptAstValues.js";
|
|
5
6
|
import { semanticAmbiguousProvenance, semanticLocalProvenance, semanticOriginsProvenance, semanticUnresolvedProvenance, uniqueSemanticOrigins, } from "./javascriptSemanticProvenance.js";
|
|
6
7
|
import { semanticPrimitiveCandidates as primitiveCandidates, semanticPrimitiveSet as primitiveSet, semanticPrimitiveValue as primitiveValue, } from "./javascriptSemanticPrimitives.js";
|
|
@@ -88,34 +89,55 @@ const evaluateTemplate = (node, context) => {
|
|
|
88
89
|
return primitiveSet(candidates);
|
|
89
90
|
};
|
|
90
91
|
const evaluateObject = (node, context) => {
|
|
91
|
-
const
|
|
92
|
+
const propertiesByName = new Map();
|
|
92
93
|
let unknownProperties = false;
|
|
93
94
|
let omittedProperties = 0;
|
|
95
|
+
const invalidateEarlierProperties = () => {
|
|
96
|
+
for (const [name] of propertiesByName)
|
|
97
|
+
propertiesByName.set(name, {
|
|
98
|
+
name,
|
|
99
|
+
value: {
|
|
100
|
+
status: "unknown",
|
|
101
|
+
reason: "A later property may overwrite this value.",
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
};
|
|
94
105
|
for (const property of node.properties) {
|
|
95
106
|
if (t.isSpreadElement(property)) {
|
|
96
107
|
unknownProperties = true;
|
|
97
108
|
omittedProperties = null;
|
|
109
|
+
invalidateEarlierProperties();
|
|
98
110
|
continue;
|
|
99
111
|
}
|
|
100
|
-
|
|
112
|
+
const name = semanticStaticPropertyName(property.key, property.computed);
|
|
113
|
+
if (name === "" && !t.isStringLiteral(property.key, { value: "" })) {
|
|
101
114
|
unknownProperties = true;
|
|
102
115
|
if (omittedProperties !== null)
|
|
103
116
|
omittedProperties += 1;
|
|
117
|
+
invalidateEarlierProperties();
|
|
104
118
|
continue;
|
|
105
119
|
}
|
|
106
|
-
|
|
107
|
-
if (
|
|
120
|
+
// This spelling changes the prototype instead of defining an own slot.
|
|
121
|
+
if (t.isObjectProperty(property) &&
|
|
122
|
+
!property.computed &&
|
|
123
|
+
!property.shorthand &&
|
|
124
|
+
name === "__proto__") {
|
|
108
125
|
unknownProperties = true;
|
|
109
126
|
if (omittedProperties !== null)
|
|
110
127
|
omittedProperties += 1;
|
|
111
128
|
continue;
|
|
112
129
|
}
|
|
113
|
-
|
|
130
|
+
propertiesByName.set(name, {
|
|
114
131
|
name,
|
|
115
|
-
value:
|
|
132
|
+
value: t.isObjectProperty(property)
|
|
133
|
+
? evaluateExpression(property.value, nestedContext(context))
|
|
134
|
+
: {
|
|
135
|
+
status: "unknown",
|
|
136
|
+
reason: "Object method or accessor value is not a primitive.",
|
|
137
|
+
},
|
|
116
138
|
});
|
|
117
139
|
}
|
|
118
|
-
properties.sort((left, right) => compareCodePoints(left.name, right.name));
|
|
140
|
+
const properties = [...propertiesByName.values()].sort((left, right) => compareCodePoints(left.name, right.name));
|
|
119
141
|
return unknownProperties
|
|
120
142
|
? {
|
|
121
143
|
status: "object",
|
|
@@ -138,12 +160,17 @@ const evaluateArray = (node, context) => {
|
|
|
138
160
|
if (t.isSpreadElement(element)) {
|
|
139
161
|
unknownItems = true;
|
|
140
162
|
omittedItems = null;
|
|
141
|
-
|
|
163
|
+
// Subsequent elements have no fixed index after an unknown-length spread.
|
|
164
|
+
break;
|
|
142
165
|
}
|
|
143
166
|
if (element === null) {
|
|
144
167
|
unknownItems = true;
|
|
145
168
|
if (omittedItems !== null)
|
|
146
169
|
omittedItems += 1;
|
|
170
|
+
items.push({
|
|
171
|
+
status: "unknown",
|
|
172
|
+
reason: "Array hole has no primitive value.",
|
|
173
|
+
});
|
|
147
174
|
continue;
|
|
148
175
|
}
|
|
149
176
|
items.push(evaluateExpression(element, nestedContext(context)));
|
|
@@ -167,9 +194,9 @@ const evaluateAddition = (node, context) => {
|
|
|
167
194
|
const right = primitiveCandidates(evaluateExpression(node.right, nestedContext(context)));
|
|
168
195
|
if (left === null || right === null)
|
|
169
196
|
return { status: "unknown", reason: "Non-primitive addition." };
|
|
170
|
-
const values = left.flatMap((leftValue) => right.map((rightValue) => typeof leftValue === "
|
|
171
|
-
? leftValue
|
|
172
|
-
:
|
|
197
|
+
const values = left.flatMap((leftValue) => right.map((rightValue) => typeof leftValue === "string" || typeof rightValue === "string"
|
|
198
|
+
? `${String(leftValue)}${String(rightValue)}`
|
|
199
|
+
: Number(leftValue) + Number(rightValue)));
|
|
173
200
|
return primitiveSet(values);
|
|
174
201
|
};
|
|
175
202
|
const evaluateUnary = (node, context) => {
|
|
@@ -201,8 +228,16 @@ const projectValue = (value, projection) => {
|
|
|
201
228
|
};
|
|
202
229
|
current = property.value;
|
|
203
230
|
}
|
|
204
|
-
else if (current.status === "array"
|
|
205
|
-
const
|
|
231
|
+
else if (current.status === "array") {
|
|
232
|
+
const index = typeof key === "number" ? key : Number(key);
|
|
233
|
+
if (!Number.isSafeInteger(index) ||
|
|
234
|
+
index < 0 ||
|
|
235
|
+
String(index) !== String(key))
|
|
236
|
+
return {
|
|
237
|
+
status: "unknown",
|
|
238
|
+
reason: `Array property ${String(key)} is not a canonical index.`,
|
|
239
|
+
};
|
|
240
|
+
const item = current.items[index];
|
|
206
241
|
if (item === undefined)
|
|
207
242
|
return {
|
|
208
243
|
status: "unknown",
|
|
@@ -302,8 +337,7 @@ const requireOrigin = (node, state) => {
|
|
|
302
337
|
};
|
|
303
338
|
const mergeValues = (values) => {
|
|
304
339
|
const primitives = values.flatMap((value) => primitiveCandidates(value) ?? []);
|
|
305
|
-
return
|
|
306
|
-
values.every((value) => value.status === "union" || value.status === "literal")
|
|
340
|
+
return values.every((value) => value.status === "union" || value.status === "literal")
|
|
307
341
|
? primitiveSet(primitives)
|
|
308
342
|
: { status: "ambiguous", reason: "Branches have incompatible values." };
|
|
309
343
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parse } from "@babel/parser";
|
|
2
|
-
/** Parse JavaScript or TypeScript once without
|
|
2
|
+
/** Parse JavaScript or TypeScript once without attaching comments to AST nodes. */
|
|
3
3
|
export const parseJavaScriptSource = (source) => {
|
|
4
4
|
try {
|
|
5
5
|
return parse(source, {
|
|
@@ -13,7 +13,9 @@ export const parseJavaScriptSource = (source) => {
|
|
|
13
13
|
plugins: ["decorators-legacy", "jsx", "typescript"],
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
catch {
|
|
16
|
+
catch (cause) {
|
|
17
|
+
// Unparseable source is represented by the null return.
|
|
18
|
+
void cause;
|
|
17
19
|
return null;
|
|
18
20
|
}
|
|
19
21
|
};
|
|
@@ -17,7 +17,7 @@ export const analyzeJavaScriptStaticSource = (source) => {
|
|
|
17
17
|
export const analyzeParsedJavaScriptStaticSource = (source, file) => {
|
|
18
18
|
const accumulator = createJavaScriptAnalysisAccumulator();
|
|
19
19
|
traverseStaticSource(source, file, accumulator);
|
|
20
|
-
addSourceMapDirectives(source, accumulator);
|
|
20
|
+
addSourceMapDirectives(source, file.comments ?? [], accumulator);
|
|
21
21
|
return finalizeStaticAnalysis(source, file, accumulator);
|
|
22
22
|
};
|
|
23
23
|
const traverseStaticSource = (source, file, accumulator) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { collectJavaScriptExports, fingerprintJavaScriptAst, } from "./javascriptAstFingerprint.js";
|
|
3
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
3
4
|
import { addFindingOnce } from "./javascriptStaticAnalysisFindings.js";
|
|
4
|
-
import { argumentValue, calleeName, chunkRuntime,
|
|
5
|
+
import { argumentValue, calleeName, chunkRuntime, factoryRequireName, moduleFactory, modulePropertyName, range, registrationKey, sha256Text, sourceSlice, staticArrayValues, } from "./javascriptStaticAnalysisHelpers.js";
|
|
5
6
|
/** Inspect a bundler registration call and recover its module table. */
|
|
6
7
|
export const inspectBundlerRegistration = (source, call, accumulator) => {
|
|
7
8
|
const runtime = chunkRuntime(call);
|
|
@@ -191,15 +191,23 @@ const addEndpoint = (context, input) => addLocatedFinding(context, {
|
|
|
191
191
|
location: range(input.node),
|
|
192
192
|
},
|
|
193
193
|
});
|
|
194
|
-
export const addSourceMapDirectives = (source, accumulator) => {
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
export const addSourceMapDirectives = (source, comments, accumulator) => {
|
|
195
|
+
// Read real comment tokens only; quoted text can contain identical markers.
|
|
196
|
+
// Keep both current/legacy line annotations and minifier block annotations.
|
|
197
|
+
for (const comment of comments) {
|
|
198
|
+
const start = comment.start;
|
|
199
|
+
const end = comment.end;
|
|
200
|
+
if (start === undefined ||
|
|
201
|
+
start === null ||
|
|
202
|
+
end === undefined ||
|
|
203
|
+
end === null)
|
|
204
|
+
continue;
|
|
205
|
+
const match = /^(?:\/\/|\/\*)[#@]\s*sourceMappingURL\s*=\s*([^\s*]+)/u.exec(source.slice(start, end));
|
|
206
|
+
if (match === null)
|
|
207
|
+
continue;
|
|
199
208
|
const declared = match[1];
|
|
200
209
|
if (declared === undefined || declared.length === 0)
|
|
201
210
|
continue;
|
|
202
|
-
const start = match.index;
|
|
203
211
|
const location = rangeForOffsets(source, start, start + match[0].length);
|
|
204
212
|
addFindingOnce(accumulator, `source-map\0${declared}`, () => accumulator.sourceMaps.push({ declared_url: declared, location }));
|
|
205
213
|
}
|