rea-agents 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/dist/adb/AdbConfiguration.js +88 -0
- package/dist/adb/AdbDeviceOutput.js +186 -0
- package/dist/adb/AdbProvider.js +1190 -0
- package/dist/adb/AdbShellOutput.js +309 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxConfiguration.js +44 -24
- package/dist/android/JadxProvider.js +51 -19
- package/dist/apktool/ApktoolConfiguration.js +84 -0
- package/dist/apktool/ApktoolDecodeOutput.js +59 -0
- package/dist/apktool/ApktoolProvider.js +506 -0
- package/dist/application/AnalysisProvider.js +8 -2
- package/dist/application/AppBundleExecutable.js +27 -22
- package/dist/application/BinaryTargetResolver.js +22 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +70 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +66 -31
- package/dist/application/DirectAnalysis.js +2 -2
- package/dist/application/DirectAnalysisCleanup.js +1 -1
- package/dist/application/DirectAnalysisStatus.js +1 -1
- package/dist/application/Doctor.js +5 -3
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/GeminiClientSettings.js +139 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/JsonFiles.js +6 -5
- package/dist/{cliJsonFile.js → application/JsonInputFile.js} +108 -35
- package/dist/application/LinuxHopper.js +4 -12
- package/dist/application/MacHopper.js +172 -149
- package/dist/application/MipsElfAbiFlags.js +140 -0
- package/dist/application/ProviderOperationExecution.js +31 -0
- package/dist/application/ReconstructionObligationCandidates.js +9 -3
- package/dist/application/ReferenceSourceImport.js +76 -29
- package/dist/application/ReferenceSourceImportEntries.js +18 -9
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -22
- package/dist/application/ReferenceSourceVcsAdapter.js +145 -30
- package/dist/application/RegularFileRead.js +93 -7
- package/dist/application/Setup.js +54 -6
- package/dist/application/SetupClientConfiguration.js +116 -16
- package/dist/application/SetupHost.js +102 -24
- package/dist/application/SetupPlan.js +5 -8
- package/dist/application/SetupSkill.js +58 -39
- package/dist/application/SupportedClients.js +290 -65
- package/dist/application/Uninstall.js +158 -10
- package/dist/application/UpdateMaintenance.js +17 -21
- package/dist/application/Utf8JsonInput.js +7 -0
- package/dist/application/WebScriptExportService.js +131 -65
- package/dist/application/WebSourceLocationService.js +3 -0
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +40 -2
- package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
- package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
- package/dist/application/binary/AnalysisClientCleanup.js +0 -24
- package/dist/application/binary/BinarySession.js +2 -1
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +2 -1
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +2 -1
- package/dist/application/evm/EvmInterfaceService.js +3 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +19 -6
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationService.js +22 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -30
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +67 -19
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +19 -16
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +258 -235
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +115 -26
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -1
- package/dist/application/javascript/JavaScriptModuleRelationships.js +6 -4
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +9 -3
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +199 -61
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +12 -19
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +4 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +19 -8
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -1
- package/dist/application/native/NativeUiActionTrace.js +16 -8
- package/dist/application/native/NativeValueTrace.js +23 -6
- package/dist/application/process/ProcessCli.js +25 -20
- package/dist/artifacts/ArtifactPaths.js +129 -8
- package/dist/artifacts/ArtifactProvider.js +20 -15
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +176 -102
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/DirectoryArtifactReader.js +168 -65
- package/dist/artifacts/MachOSliceArtifactReader.js +116 -39
- package/dist/artifacts/NativeDmgArtifactReader.js +29 -22
- package/dist/artifacts/SafeOutputTree.js +245 -70
- package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
- package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
- package/dist/artifacts/ZipArtifactReader.js +77 -27
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +58 -18
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +62 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +32 -13
- package/dist/artifacts/extraction/ArtifactExtraction.js +110 -86
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +110 -43
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +75 -32
- package/dist/artifacts/inventory/hashStableRootArtifact.js +48 -15
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +62 -25
- package/dist/artifacts/inventory/scanReader.js +38 -11
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +15 -9
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/browser/BrowserScenarioPartialObservation.js +8 -2
- package/dist/browser/BrowserScenarioSecrets.js +52 -37
- package/dist/browser/CdpBrowserProvider.js +5 -0
- package/dist/browser/CdpCaptureDocuments.js +40 -6
- package/dist/browser/CdpCaptureDomSvg.js +210 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +4 -8
- package/dist/browser/CdpCaptureEventHandlers.js +26 -9
- package/dist/browser/CdpCaptureEvents.js +4 -9
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +32 -10
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +60 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +69 -7
- package/dist/browser/PlaywrightScenarioSession.js +127 -54
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +3 -3
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/WebArtifactReads.js +23 -1
- package/dist/browser/assets/WebSourceLocationArtifacts.js +1 -0
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/HarCapture.js +14 -0
- package/dist/browser/history/HarCaptureProcess.js +2 -10
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/modules/WebModuleArtifacts.js +1 -0
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/apktoolCommands.js +53 -0
- package/dist/cli/artifactCommands.js +8 -11
- package/dist/cli/binaryDiagnosticsCommands.js +19 -1
- package/dist/cli/browserAdvancedCommands.js +65 -36
- package/dist/cli/coreBinaryCommands.js +0 -5
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +6 -1
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +17 -1
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +11 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/utilityCommands.js +66 -18
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +6 -0
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +2 -2
- package/dist/cliObservationOptions.js +3 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/directAnalysis.js +12 -4
- package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
- package/dist/composition/jeb.js +6 -0
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/mcpInputSchemaProfile.js +27 -0
- package/dist/config/parseConfig.js +28 -1
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +10 -0
- package/dist/contracts/analysisViewToolContracts.js +17 -2
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +10 -10
- package/dist/contracts/javascript/electronToolContracts.js +15 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionToolContracts.js +2 -2
- package/dist/contracts/sessionToolSchemas.js +6 -2
- package/dist/contracts/toolContractExamples.js +6 -0
- package/dist/contracts/toolContractTypes.js +3 -0
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +167 -0
- package/dist/contracts/toolOutputSchemaGroups.js +5 -3
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -6
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +2 -1
- package/dist/domain/analysisView/analysisView.js +52 -2
- package/dist/domain/analysisView/binaryLayoutView.js +2 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +2 -0
- package/dist/domain/analysisView/nativeFunctionView.js +155 -0
- package/dist/domain/android/androidApplication.js +25 -20
- package/dist/domain/apktool/apktoolResourceAnalysis.js +77 -0
- package/dist/domain/apple/appleApplication.js +40 -23
- package/dist/domain/apple/appleBundleAnatomy.js +95 -28
- package/dist/domain/apple/dyldPaths.js +9 -1
- package/dist/domain/apple/dylibResolution.js +2 -2
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +35 -7
- package/dist/domain/artifactGraph.js +5 -3
- package/dist/domain/artifactIdentity.js +30 -2
- package/dist/domain/artifactInspection.js +3 -43
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +11 -12
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/evidence.js +2 -1
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +12 -13
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +11 -20
- package/dist/domain/javascript/electronStaticAnalysisNative.js +70 -40
- package/dist/domain/javascript/electronStaticAnalysisValues.js +16 -0
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +4 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +6 -6
- package/dist/domain/javascript/javascriptApplicationGraph.js +79 -18
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +28 -12
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +9 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +58 -31
- package/dist/domain/javascript/javascriptAstValues.js +32 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +6 -1
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +7 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +8 -11
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +190 -33
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +42 -41
- package/dist/domain/javascript/javascriptSemanticGraph.js +69 -23
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +2 -10
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +40 -7
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +341 -87
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +78 -35
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +7 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +52 -14
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +77 -0
- package/dist/domain/javascript/javascriptSemanticQuery.js +27 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +1 -3
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +13 -23
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +19 -1
- package/dist/domain/javascript/javascriptSemanticValues.js +47 -19
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +8 -6
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonShape.js +63 -52
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/managed/managedApplicationGraph.js +37 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +32 -22
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +91 -1
- package/dist/domain/process/processCaptureExample.js +24 -0
- package/dist/domain/process/processCaptureValidation.js +79 -0
- package/dist/domain/process/processScenario.js +59 -7
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/referenceSourceGraph.js +25 -16
- package/dist/domain/referenceSourceImportParsing.js +6 -3
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/webBundleAnalyzerInspection.js +14 -2
- package/dist/domain/webCaptureDiff.js +102 -4
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +7 -13
- package/dist/domain/zipPackageFormat.js +4 -1
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +55 -43
- package/dist/dotnet/ManagedDecodeBudget.js +80 -0
- package/dist/dotnet/ManagedMemberInspector.js +13 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +2 -2
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +4 -2
- package/dist/dotnet/ManagedMemberRows.js +9 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +15 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +20 -11
- package/dist/dotnet/ManagedMetadataLayout.js +10 -4
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +3 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +49 -34
- package/dist/dotnet/ManagedPeReader.js +41 -25
- package/dist/dotnet/ManagedReaderFailure.js +2 -1
- package/dist/dotnet/ManagedStaticProvider.js +55 -24
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +43 -13
- package/dist/evm/EvmoleFailures.js +0 -2
- package/dist/evm/EvmoleInterfaceProvider.js +67 -2
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/RegularFile.js +33 -1
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +26 -0
- package/dist/firmware/FirmwareCommand.js +25 -3
- package/dist/firmware/FirmwareFiles.js +23 -8
- package/dist/firmware/FirmwareProvider.js +156 -32
- package/dist/firmware/FirmwarePublication.js +24 -3
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +55 -4
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +76 -4
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +1 -1
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +80 -39
- package/dist/ghidra/GhidraLoadImageAttest.js +49 -2
- package/dist/ghidra/GhidraMipsProfile.js +79 -0
- package/dist/ghidra/GhidraProvider.js +57 -9
- package/dist/ghidra/GhidraProviderCapabilities.js +18 -8
- package/dist/ghidra/GhidraProviderClient.js +282 -21
- package/dist/ghidra/GhidraSessionValues.js +9 -2
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperClient.js +15 -6
- package/dist/hopper/HopperMachOImage.js +2 -0
- package/dist/hopper/HopperProvider.js +13 -2
- package/dist/ida/IdaOperationRunner.js +8 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +3 -1
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +326 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +520 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +63 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +521 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +116 -0
- package/dist/javascript/recovery/RecoveryFiles.js +18 -7
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +11 -7
- package/dist/javascript/recovery/WakaruProvider.js +139 -16
- package/dist/javascript/recovery/WakaruPublication.js +14 -4
- package/dist/javascript/recovery/WakaruRelease.js +10 -3
- package/dist/javascript/recovery/WakaruReport.js +12 -7
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -3
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +63 -7
- package/dist/javascript/sourceMaps/SourceMapFormat.js +15 -4
- package/dist/jeb/JebMcpConnection.js +179 -0
- package/dist/jeb/JebMcpEndpoint.js +40 -0
- package/dist/jeb/JebProvider.js +299 -0
- package/dist/mcpDoctor.js +15 -6
- package/dist/native/AppleDispatchCoverage.js +25 -12
- package/dist/native/AppleDispatchMetadata.js +14 -7
- package/dist/native/AppleMachoFixups.js +71 -15
- package/dist/native/AppleMachoSelection.js +23 -3
- package/dist/native/NativeMacOSProvider.js +91 -16
- package/dist/native/NativeMachoInspection.js +11 -7
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +4 -3
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +63 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/DarwinProcessRunTokenReader.js +8 -3
- package/dist/process/OwnedCommand.js +4 -3
- package/dist/process/ProcessOwnership.js +104 -112
- package/dist/process/ProcessOwnershipObservation.js +96 -39
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +4 -3
- package/dist/process/capture/FilesystemSnapshot.js +28 -4
- package/dist/process/capture/ProcessCaptureLifecycle.js +350 -59
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessHarness.js +194 -26
- package/dist/process/capture/ProcessNormalization.js +3 -1
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +5 -2
- package/dist/process/capture/TerminalRenderer.js +24 -7
- package/dist/reference/ReferenceSourceReader.js +22 -5
- package/dist/reference/ReferenceSourceReaderEntries.js +114 -51
- package/dist/reference/ReferenceSourceReaderErrors.js +12 -0
- package/dist/reference/ReferenceSourceReaderFile.js +50 -10
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -4
- package/dist/server/EvidenceMcpServer.js +36 -1
- package/dist/server/admittedToolOperation.js +9 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +97 -25
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +4 -9
- package/dist/server/registerAndroidTools.js +3 -12
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -6
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +3 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +3 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +5 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +12 -9
- package/dist/server/registerBundleComparisonTool.js +16 -2
- package/dist/server/registerCloseLifecycleTool.js +32 -3
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEvmTools.js +4 -9
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFunctionComparisonTool.js +5 -2
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -6
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerSessionRecordTools.js +2 -1
- package/dist/server/registerSessionTools.js +49 -18
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +4 -9
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/toolResult.js +21 -2
- package/dist/windows/WindowsPrivateRuntime.js +12 -5
- package/install.sh +7 -4
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +33 -5
- package/scripts/rea.mjs +16 -1
- package/skills/reverse-engineer-anything/SKILL.md +52 -51
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +92 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +22 -1
|
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import * as t from "@babel/types";
|
|
3
3
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
4
4
|
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
5
|
-
import { propertyName } from "./javascriptAstValues.js";
|
|
5
|
+
import { propertyName, semanticStaticPropertyKey, } from "./javascriptAstValues.js";
|
|
6
6
|
import { stringValue } from "./javascriptStaticAnalysisHelpers.js";
|
|
7
7
|
/** Derive a rename-resistant syntax fingerprint without code execution. */
|
|
8
8
|
export const fingerprintJavaScriptAst = (node) => {
|
|
@@ -59,40 +59,71 @@ const semanticTokens = (node) => {
|
|
|
59
59
|
};
|
|
60
60
|
const collectAssignmentExports = (left, right, output) => {
|
|
61
61
|
const path = memberPath(left);
|
|
62
|
-
if (path ===
|
|
62
|
+
if (path === null)
|
|
63
|
+
return;
|
|
64
|
+
// Rebinding the CommonJS alias does not replace module.exports.
|
|
65
|
+
if (path.length === 1 && path[0] === "exports")
|
|
66
|
+
return;
|
|
67
|
+
const exportOffset = path[0] === "exports"
|
|
68
|
+
? 1
|
|
69
|
+
: path[0] === "module" && path[1] === "exports"
|
|
70
|
+
? 2
|
|
71
|
+
: null;
|
|
72
|
+
if (exportOffset === null)
|
|
73
|
+
return;
|
|
74
|
+
if (path.length === exportOffset) {
|
|
63
75
|
if (t.isObjectExpression(right))
|
|
64
76
|
collectObjectKeys(right, output);
|
|
65
77
|
else
|
|
66
78
|
addExport(output, "default");
|
|
67
79
|
return;
|
|
68
80
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
// A CommonJS export assignment exposes the first property below the
|
|
82
|
+
// exports object. Deeper writes mutate that exported value, rather than
|
|
83
|
+
// creating an export whose name is the dotted member path.
|
|
84
|
+
addExport(output, path[exportOffset]);
|
|
73
85
|
};
|
|
74
86
|
const collectCallExports = (call, output) => {
|
|
75
87
|
const callee = memberPath(call.callee);
|
|
76
|
-
if (callee ===
|
|
77
|
-
|
|
88
|
+
if (callee === null)
|
|
89
|
+
return;
|
|
90
|
+
const definePropertyCall = callee.length === 2 &&
|
|
91
|
+
callee[0] === "Object" &&
|
|
92
|
+
callee[1] === "defineProperty";
|
|
93
|
+
const declarationCall = callee.length >= 2 && callee.at(-1) === "d";
|
|
94
|
+
if (!definePropertyCall && !declarationCall)
|
|
95
|
+
return;
|
|
96
|
+
const target = memberPath(call.arguments[0]);
|
|
97
|
+
const exportTarget = target !== null &&
|
|
98
|
+
((target.length === 1 && target[0] === "exports") ||
|
|
99
|
+
(target.length === 2 &&
|
|
100
|
+
target[0] === "module" &&
|
|
101
|
+
target[1] === "exports"));
|
|
102
|
+
if (!exportTarget)
|
|
103
|
+
return;
|
|
104
|
+
if (definePropertyCall) {
|
|
78
105
|
const name = stringValue(call.arguments[1]);
|
|
79
|
-
if (
|
|
106
|
+
if (name !== undefined)
|
|
80
107
|
addExport(output, name);
|
|
81
|
-
}
|
|
82
|
-
if (!callee.endsWith(".d"))
|
|
83
108
|
return;
|
|
84
|
-
|
|
109
|
+
}
|
|
85
110
|
const declarations = call.arguments[1];
|
|
86
|
-
if ((
|
|
87
|
-
t.isObjectExpression(declarations))
|
|
111
|
+
if (t.isObjectExpression(declarations))
|
|
88
112
|
collectObjectKeys(declarations, output);
|
|
89
113
|
};
|
|
90
114
|
const collectObjectKeys = (object, output) => {
|
|
91
115
|
for (const property of object.properties) {
|
|
92
116
|
if (!t.isObjectProperty(property) && !t.isObjectMethod(property))
|
|
93
117
|
continue;
|
|
94
|
-
const name =
|
|
95
|
-
|
|
118
|
+
const name = semanticStaticPropertyKey(property.key, property.computed);
|
|
119
|
+
// In an object literal, a non-computed `__proto__: value` sets the
|
|
120
|
+
// prototype instead of creating an own property. Shorthand, computed,
|
|
121
|
+
// and method forms do create own properties.
|
|
122
|
+
if (name !== null &&
|
|
123
|
+
!(t.isObjectProperty(property) &&
|
|
124
|
+
!property.computed &&
|
|
125
|
+
!property.shorthand &&
|
|
126
|
+
name === "__proto__"))
|
|
96
127
|
addExport(output, name);
|
|
97
128
|
}
|
|
98
129
|
};
|
|
@@ -105,22 +136,18 @@ const memberPath = (node) => {
|
|
|
105
136
|
while (current !== undefined &&
|
|
106
137
|
current !== null &&
|
|
107
138
|
(t.isMemberExpression(current) || t.isOptionalMemberExpression(current))) {
|
|
108
|
-
|
|
109
|
-
|
|
139
|
+
const property = semanticStaticPropertyKey(current.property, current.computed);
|
|
140
|
+
if (property === null)
|
|
141
|
+
return null;
|
|
142
|
+
properties.push(property);
|
|
143
|
+
current = current.object;
|
|
110
144
|
}
|
|
111
|
-
|
|
145
|
+
if (current === undefined || current === null)
|
|
146
|
+
return null;
|
|
147
|
+
const root = t.isIdentifier(current)
|
|
112
148
|
? current.name
|
|
113
|
-
:
|
|
149
|
+
: t.isThisExpression(current)
|
|
114
150
|
? "this"
|
|
115
|
-
:
|
|
116
|
-
|
|
117
|
-
return root;
|
|
118
|
-
properties.reverse();
|
|
119
|
-
const path = root === "" ? [] : [root];
|
|
120
|
-
for (const property of properties) {
|
|
121
|
-
if (path.length === 0 && property === "")
|
|
122
|
-
continue;
|
|
123
|
-
path.push(property);
|
|
124
|
-
}
|
|
125
|
-
return path.join(".");
|
|
151
|
+
: null;
|
|
152
|
+
return root === null ? null : [root, ...properties.reverse()];
|
|
126
153
|
};
|
|
@@ -57,6 +57,38 @@ export const semanticStaticPropertyKey = (property, computed) => {
|
|
|
57
57
|
return String(property.value);
|
|
58
58
|
return !computed && t.isIdentifier(property) ? property.name : null;
|
|
59
59
|
};
|
|
60
|
+
/** Read exact consumed object-pattern keys, leaving dynamic keys unknown. */
|
|
61
|
+
export const semanticObjectPatternKeys = (pattern) => pattern.properties.flatMap((property) => {
|
|
62
|
+
if (t.isRestElement(property))
|
|
63
|
+
return [];
|
|
64
|
+
const key = semanticStaticPropertyKey(property.key, property.computed);
|
|
65
|
+
return key === null ? [] : [key];
|
|
66
|
+
});
|
|
67
|
+
/** Visit member write targets in direct and destructuring assignment forms. */
|
|
68
|
+
export function* semanticMemberWriteTargets(root) {
|
|
69
|
+
const pending = [root];
|
|
70
|
+
while (pending.length > 0) {
|
|
71
|
+
const next = pending.pop();
|
|
72
|
+
if (next === undefined)
|
|
73
|
+
break;
|
|
74
|
+
const node = unwrapJavaScriptExpression(next).node;
|
|
75
|
+
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node))
|
|
76
|
+
yield node;
|
|
77
|
+
else if (t.isRestElement(node))
|
|
78
|
+
pending.push(node.argument);
|
|
79
|
+
else if (t.isAssignmentPattern(node))
|
|
80
|
+
pending.push(node.left);
|
|
81
|
+
else if (t.isArrayPattern(node)) {
|
|
82
|
+
for (const element of node.elements.toReversed())
|
|
83
|
+
if (element !== null)
|
|
84
|
+
pending.push(element);
|
|
85
|
+
}
|
|
86
|
+
else if (t.isObjectPattern(node)) {
|
|
87
|
+
for (const property of node.properties.toReversed())
|
|
88
|
+
pending.push(t.isRestElement(property) ? property.argument : property.value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
60
92
|
/**
|
|
61
93
|
* Display an exact JavaScript string as nonempty label text. Graph labels and
|
|
62
94
|
* artifact-local keys are nonempty, so the legal empty value is shown as `""`;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
2
|
+
import { semanticStaticPropertyKey, semanticMemberWriteTargets, unwrapJavaScriptExpression, } from "./javascriptAstValues.js";
|
|
3
|
+
import { SemanticPropertyPathCoverage } from "./javascriptSemanticPropertyPaths.js";
|
|
4
|
+
import { traverseJavaScriptAstSteps } from "./javascriptSemanticTraversal.js";
|
|
5
|
+
/** Match Electron's supported module entry points. */
|
|
6
|
+
export const ELECTRON_MODULE = /^electron(?:\/(?:common|main|renderer|utility))?$/u;
|
|
7
|
+
/**
|
|
8
|
+
* Electron's CommonJS exports define no `default` member, so a leading
|
|
9
|
+
* `default` segment can only denote the module object itself, as an ES module
|
|
10
|
+
* default import (`import electron from "electron"`) binds it.
|
|
11
|
+
*/
|
|
12
|
+
export const electronExportPath = (importedPath) => importedPath[0] === "default" ? importedPath.slice(1) : importedPath;
|
|
13
|
+
/** Static identity recovery cannot establish the absence of Electron usage. */
|
|
14
|
+
export const ELECTRON_IDENTITY_LIMITATION = "Electron API identity follows proven lexical module aliases. Reassigned bindings, dynamic selections, and visibly overwritten namespace members are unresolved; missing findings do not establish absence. Arbitrary call side effects and runtime registration are not evaluated.";
|
|
15
|
+
/** Preserve exact property segments instead of flattening literal dotted keys. */
|
|
16
|
+
export const electronMemberPath = (node) => {
|
|
17
|
+
let root = unwrapJavaScriptExpression(node).node;
|
|
18
|
+
const members = [];
|
|
19
|
+
while (t.isMemberExpression(root) || t.isOptionalMemberExpression(root)) {
|
|
20
|
+
members.push(semanticStaticPropertyKey(root.property, root.computed));
|
|
21
|
+
root = unwrapJavaScriptExpression(root.object).node;
|
|
22
|
+
}
|
|
23
|
+
return { root, members: members.toReversed() };
|
|
24
|
+
};
|
|
25
|
+
/** Index visible writes through proven Electron aliases, without executing them. */
|
|
26
|
+
export function* collectElectronMemberWritesSteps(program, origin) {
|
|
27
|
+
const writes = new SemanticPropertyPathCoverage();
|
|
28
|
+
yield* traverseJavaScriptAstSteps(program, {
|
|
29
|
+
enter: (node) => {
|
|
30
|
+
const target = t.isAssignmentExpression(node)
|
|
31
|
+
? node.left
|
|
32
|
+
: t.isUpdateExpression(node)
|
|
33
|
+
? node.argument
|
|
34
|
+
: t.isUnaryExpression(node, { operator: "delete" })
|
|
35
|
+
? node.argument
|
|
36
|
+
: t.isForOfStatement(node) || t.isForInStatement(node)
|
|
37
|
+
? node.left
|
|
38
|
+
: undefined;
|
|
39
|
+
if (target === undefined)
|
|
40
|
+
return;
|
|
41
|
+
for (const member of semanticMemberWriteTargets(target)) {
|
|
42
|
+
const { root, members } = electronMemberPath(member);
|
|
43
|
+
const exported = origin(root);
|
|
44
|
+
if (exported !== undefined)
|
|
45
|
+
writes.retain([...exported, ...members]);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
return writes;
|
|
50
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Retain facts consumed by source-module and export-return composition. */
|
|
2
|
+
export const projectJavaScriptModuleSemantics = (ir) => {
|
|
3
|
+
const scopes = ir.scopes.filter(({ kind }) => kind === "program");
|
|
4
|
+
const programScopeId = scopes[0]?.scopeId;
|
|
5
|
+
const localNames = new Set(ir.moduleLinks.map(({ localName }) => localName));
|
|
6
|
+
const callableIds = new Set(ir.moduleLinks.map(({ callableId }) => callableId));
|
|
7
|
+
return {
|
|
8
|
+
scopes,
|
|
9
|
+
bindings: ir.bindings.filter(({ name, scopeId }) => scopeId === programScopeId && localNames.has(name)),
|
|
10
|
+
callables: ir.callables.filter(({ callableId }) => callableIds.has(callableId)),
|
|
11
|
+
moduleLinks: ir.moduleLinks,
|
|
12
|
+
coverage: ir.coverage,
|
|
13
|
+
limitations: ir.limitations,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -69,7 +69,12 @@ const nativeExportNodes = (addon, edges, nodeById) => {
|
|
|
69
69
|
};
|
|
70
70
|
const requestedExports = (nodes) => {
|
|
71
71
|
const values = nodes.flatMap((node) => node.observations.flatMap((observation) => [
|
|
72
|
-
|
|
72
|
+
// Display labels can summarize several names or namespace access.
|
|
73
|
+
// Only legacy observations without structured member facts need them.
|
|
74
|
+
...(observation.label === null ||
|
|
75
|
+
Array.isArray(observation.properties.requested_members)
|
|
76
|
+
? []
|
|
77
|
+
: [observation.label]),
|
|
73
78
|
...stringArray(observation.properties.requested_members),
|
|
74
79
|
...stringArray(observation.properties.members),
|
|
75
80
|
]));
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
2
|
+
import { unwrapJavaScriptExpression, semanticStaticPropertyKey, } from "./javascriptAstValues.js";
|
|
3
|
+
import { calleeName } from "./javascriptStaticAnalysisHelpers.js";
|
|
4
|
+
// tRPC proxies preserve router and procedure names as property names, so they
|
|
5
|
+
// survive identifier minification. Method names follow @trpc/react-query and
|
|
6
|
+
// @trpc/tanstack-react-query 11.19 documentation; cache-key helpers such as
|
|
7
|
+
// queryKey are excluded because they never issue a request.
|
|
8
|
+
const TRPC_HOOK_METHODS = new Set([
|
|
9
|
+
"useQuery",
|
|
10
|
+
"useSuspenseQuery",
|
|
11
|
+
"useInfiniteQuery",
|
|
12
|
+
"useSuspenseInfiniteQuery",
|
|
13
|
+
"usePrefetchQuery",
|
|
14
|
+
"usePrefetchInfiniteQuery",
|
|
15
|
+
"useMutation",
|
|
16
|
+
"useSubscription",
|
|
17
|
+
"queryOptions",
|
|
18
|
+
"infiniteQueryOptions",
|
|
19
|
+
"mutationOptions",
|
|
20
|
+
"subscriptionOptions",
|
|
21
|
+
]);
|
|
22
|
+
// @trpc/client 11.19 clientCallTypeMap methods; common outside tRPC (Apollo,
|
|
23
|
+
// database pools, stores), so they need corroborating evidence.
|
|
24
|
+
const TRPC_REQUEST_METHODS = new Set(["query", "mutate"]);
|
|
25
|
+
// @trpc/client 11.19 TRPCSubscriptionObserver callbacks; RxJS observers use
|
|
26
|
+
// next/error/complete instead.
|
|
27
|
+
const TRPC_SUBSCRIPTION_CALLBACKS = new Set([
|
|
28
|
+
"onStarted",
|
|
29
|
+
"onData",
|
|
30
|
+
"onError",
|
|
31
|
+
"onStopped",
|
|
32
|
+
"onComplete",
|
|
33
|
+
"onConnectionStateChange",
|
|
34
|
+
]);
|
|
35
|
+
// @trpc/client 11.19 client factories (createTRPCProxyClient is the
|
|
36
|
+
// deprecated alias of createTRPCClient).
|
|
37
|
+
const TRPC_CLIENT_FACTORIES = new Set([
|
|
38
|
+
"createTRPCClient",
|
|
39
|
+
"createTRPCProxyClient",
|
|
40
|
+
]);
|
|
41
|
+
// Built-in HTTP links documented by tRPC 11.19 that carry a `url` option.
|
|
42
|
+
const TRPC_URL_LINKS = new Set([
|
|
43
|
+
"httpLink",
|
|
44
|
+
"httpBatchLink",
|
|
45
|
+
"httpBatchStreamLink",
|
|
46
|
+
"httpSubscriptionLink",
|
|
47
|
+
]);
|
|
48
|
+
// Literals retained by @trpc/client 11.19 bundles (`this.name`, the default
|
|
49
|
+
// accept header key) or by the conventional transport path.
|
|
50
|
+
const TRPC_SOURCE_MARKERS = ["TRPCClientError", "trpc-accept", "/trpc"];
|
|
51
|
+
// Browser-owned roots whose methods share tRPC names, such as
|
|
52
|
+
// navigator.permissions.query.
|
|
53
|
+
const BROWSER_GLOBAL_NAMES = new Set([
|
|
54
|
+
"window",
|
|
55
|
+
"self",
|
|
56
|
+
"globalThis",
|
|
57
|
+
"document",
|
|
58
|
+
"navigator",
|
|
59
|
+
"location",
|
|
60
|
+
"history",
|
|
61
|
+
"console",
|
|
62
|
+
"performance",
|
|
63
|
+
"screen",
|
|
64
|
+
"top",
|
|
65
|
+
"parent",
|
|
66
|
+
"frames",
|
|
67
|
+
]);
|
|
68
|
+
const PROCEDURE_SEGMENT = /^[A-Za-z_$][\w$]*$/u;
|
|
69
|
+
/** Read a static member path and the expression it starts from. */
|
|
70
|
+
const memberPath = (callee) => {
|
|
71
|
+
const reversed = [];
|
|
72
|
+
let current = callee;
|
|
73
|
+
while (t.isMemberExpression(current) ||
|
|
74
|
+
t.isOptionalMemberExpression(current)) {
|
|
75
|
+
const property = semanticStaticPropertyKey(current.property, current.computed);
|
|
76
|
+
if (property === null || !PROCEDURE_SEGMENT.test(property))
|
|
77
|
+
return undefined;
|
|
78
|
+
reversed.push(property);
|
|
79
|
+
current = current.object;
|
|
80
|
+
}
|
|
81
|
+
return { root: current, properties: reversed.reverse() };
|
|
82
|
+
};
|
|
83
|
+
const objectKeys = (node) => t.isObjectExpression(node)
|
|
84
|
+
? node.properties.flatMap((property) => {
|
|
85
|
+
if (!t.isObjectProperty(property) && !t.isObjectMethod(property))
|
|
86
|
+
return [];
|
|
87
|
+
const key = semanticStaticPropertyKey(property.key, property.computed);
|
|
88
|
+
return key === null ? [] : [key];
|
|
89
|
+
})
|
|
90
|
+
: [];
|
|
91
|
+
const objectStringProperty = (node, key) => {
|
|
92
|
+
for (const property of node.properties)
|
|
93
|
+
if (t.isObjectProperty(property) &&
|
|
94
|
+
semanticStaticPropertyKey(property.key, property.computed) === key &&
|
|
95
|
+
t.isStringLiteral(property.value))
|
|
96
|
+
return property.value.value;
|
|
97
|
+
return undefined;
|
|
98
|
+
};
|
|
99
|
+
const objectProperty = (node, key) => {
|
|
100
|
+
for (const property of node.properties)
|
|
101
|
+
if (t.isObjectProperty(property) &&
|
|
102
|
+
semanticStaticPropertyKey(property.key, property.computed) === key)
|
|
103
|
+
return property.value;
|
|
104
|
+
return undefined;
|
|
105
|
+
};
|
|
106
|
+
const GRAPHQL_OPERATION_TYPES = new Set([
|
|
107
|
+
"query",
|
|
108
|
+
"mutation",
|
|
109
|
+
"subscription",
|
|
110
|
+
]);
|
|
111
|
+
// A named GraphQL operation header (GraphQL October 2021, OperationDefinition):
|
|
112
|
+
// type, name, then variable definitions starting with `$`, a directive, or a
|
|
113
|
+
// selection set starting with a field name.
|
|
114
|
+
const GRAPHQL_OPERATION_HEADER = /^(query|mutation|subscription)[\s,]+([_A-Za-z][_0-9A-Za-z]*)[\s,]*(?:\([\s,]*\$|@[_A-Za-z]|\{[\s,]*[_A-Za-z])/u;
|
|
115
|
+
const isGraphqlIgnoredCharacter = (character) => character === "," || character === "" || /\s/u.test(character);
|
|
116
|
+
/** Recover a named operation from GraphQL document text. */
|
|
117
|
+
export const graphqlOperationFromText = (text) => {
|
|
118
|
+
// Skip GraphQL ignored tokens: whitespace, commas, BOM and # comments.
|
|
119
|
+
const limit = text.length;
|
|
120
|
+
let index = 0;
|
|
121
|
+
while (index < limit) {
|
|
122
|
+
const character = text.charAt(index);
|
|
123
|
+
if (isGraphqlIgnoredCharacter(character))
|
|
124
|
+
index += 1;
|
|
125
|
+
else if (character === "#") {
|
|
126
|
+
while (index < limit && !/[\n\r]/u.test(text.charAt(index)))
|
|
127
|
+
index += 1;
|
|
128
|
+
}
|
|
129
|
+
else
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
if (index >= limit)
|
|
133
|
+
return undefined;
|
|
134
|
+
const header = GRAPHQL_OPERATION_HEADER.exec(text.slice(index));
|
|
135
|
+
const type = header?.[1];
|
|
136
|
+
const name = header?.[2];
|
|
137
|
+
return type === undefined || name === undefined
|
|
138
|
+
? undefined
|
|
139
|
+
: { value: name, mechanism: `graphql:${type}` };
|
|
140
|
+
};
|
|
141
|
+
/** Recover a named operation from a precompiled GraphQL document object. */
|
|
142
|
+
export const graphqlOperationFromDocumentNode = (node) => {
|
|
143
|
+
if (objectStringProperty(node, "kind") !== "OperationDefinition")
|
|
144
|
+
return undefined;
|
|
145
|
+
const type = objectStringProperty(node, "operation");
|
|
146
|
+
if (type === undefined || !GRAPHQL_OPERATION_TYPES.has(type))
|
|
147
|
+
return undefined;
|
|
148
|
+
const name = objectProperty(node, "name");
|
|
149
|
+
if (!t.isObjectExpression(name) ||
|
|
150
|
+
objectStringProperty(name, "kind") !== "Name")
|
|
151
|
+
return undefined;
|
|
152
|
+
const value = objectStringProperty(name, "value");
|
|
153
|
+
return value === undefined
|
|
154
|
+
? undefined
|
|
155
|
+
: { value, mechanism: `graphql:${type}` };
|
|
156
|
+
};
|
|
157
|
+
/** Bundlers use `(0, imported.factory)` to call an import without a receiver. */
|
|
158
|
+
const rpcFactoryName = (callee) => {
|
|
159
|
+
let current = unwrapJavaScriptExpression(callee).node;
|
|
160
|
+
while (t.isSequenceExpression(current)) {
|
|
161
|
+
const last = current.expressions.at(-1);
|
|
162
|
+
if (last === undefined)
|
|
163
|
+
return "";
|
|
164
|
+
current = unwrapJavaScriptExpression(last).node;
|
|
165
|
+
}
|
|
166
|
+
return calleeName(current);
|
|
167
|
+
};
|
|
168
|
+
/** Whether an initializer has the syntax of a documented tRPC client factory. */
|
|
169
|
+
export const isJavaScriptRpcClientFactory = (node) => {
|
|
170
|
+
const call = unwrapJavaScriptExpression(node).node;
|
|
171
|
+
return ((t.isCallExpression(call) || t.isOptionalCallExpression(call)) &&
|
|
172
|
+
TRPC_CLIENT_FACTORIES.has(rpcFactoryName(call.callee).split(".").pop() ?? ""));
|
|
173
|
+
};
|
|
174
|
+
/** Recover the literal `url` option passed to a documented tRPC HTTP link. */
|
|
175
|
+
const trpcLinkUrl = (node) => {
|
|
176
|
+
const name = rpcFactoryName(node.callee);
|
|
177
|
+
const factory = name.slice(name.lastIndexOf(".") + 1);
|
|
178
|
+
if (!TRPC_URL_LINKS.has(factory))
|
|
179
|
+
return undefined;
|
|
180
|
+
const options = node.arguments[0];
|
|
181
|
+
if (!t.isObjectExpression(options))
|
|
182
|
+
return undefined;
|
|
183
|
+
const url = objectStringProperty(options, "url");
|
|
184
|
+
return url === undefined
|
|
185
|
+
? undefined
|
|
186
|
+
: { value: url, mechanism: `trpc:link:${factory}` };
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Create the per-source scan. Hook and option-factory methods are distinctive.
|
|
190
|
+
* `query`/`mutate` need a root bound to a tRPC client factory, or a tRPC source
|
|
191
|
+
* marker with a router path of at least two segments; `subscribe` needs the
|
|
192
|
+
* marker and a tRPC observer argument. `this` roots, browser globals and RTK
|
|
193
|
+
* Query `endpoints` chains are never procedures.
|
|
194
|
+
*/
|
|
195
|
+
export const createJavaScriptRpcScan = (source, clientRoots) => {
|
|
196
|
+
let marker;
|
|
197
|
+
const hasMarker = () => (marker ??= TRPC_SOURCE_MARKERS.some((value) => source.includes(value)));
|
|
198
|
+
// graphql-tag documents retain their source text in loc.source.body; that
|
|
199
|
+
// text repeats the OperationDefinition already recovered from the object.
|
|
200
|
+
const documentSourceBodies = new WeakSet();
|
|
201
|
+
const procedure = (node) => {
|
|
202
|
+
const path = memberPath(node.callee);
|
|
203
|
+
if (path === undefined || t.isThisExpression(path.root))
|
|
204
|
+
return undefined;
|
|
205
|
+
if (t.isIdentifier(path.root) && BROWSER_GLOBAL_NAMES.has(path.root.name))
|
|
206
|
+
return undefined;
|
|
207
|
+
const method = path.properties[path.properties.length - 1];
|
|
208
|
+
const segments = path.properties.slice(0, -1);
|
|
209
|
+
const first = segments[0];
|
|
210
|
+
if (method === undefined || first === undefined)
|
|
211
|
+
return undefined;
|
|
212
|
+
if (BROWSER_GLOBAL_NAMES.has(first) || segments.includes("endpoints"))
|
|
213
|
+
return undefined;
|
|
214
|
+
const bound = clientRoots.has(path.root);
|
|
215
|
+
const recognized = TRPC_HOOK_METHODS.has(method)
|
|
216
|
+
? true
|
|
217
|
+
: TRPC_REQUEST_METHODS.has(method)
|
|
218
|
+
? bound || (segments.length >= 2 && hasMarker())
|
|
219
|
+
: method === "subscribe" &&
|
|
220
|
+
(bound || hasMarker()) &&
|
|
221
|
+
objectKeys(node.arguments[1]).some((key) => TRPC_SUBSCRIPTION_CALLBACKS.has(key));
|
|
222
|
+
return recognized
|
|
223
|
+
? { value: segments.join("."), mechanism: `trpc:procedure:${method}` }
|
|
224
|
+
: undefined;
|
|
225
|
+
};
|
|
226
|
+
return {
|
|
227
|
+
inspect: (node) => {
|
|
228
|
+
if (t.isCallExpression(node) || t.isOptionalCallExpression(node))
|
|
229
|
+
return trpcLinkUrl(node) ?? procedure(node);
|
|
230
|
+
if (t.isObjectExpression(node)) {
|
|
231
|
+
const body = objectProperty(node, "body");
|
|
232
|
+
if (t.isStringLiteral(body) &&
|
|
233
|
+
objectProperty(node, "locationOffset") !== undefined) {
|
|
234
|
+
documentSourceBodies.add(body);
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
return graphqlOperationFromDocumentNode(node);
|
|
238
|
+
}
|
|
239
|
+
if (t.isStringLiteral(node))
|
|
240
|
+
return documentSourceBodies.has(node)
|
|
241
|
+
? undefined
|
|
242
|
+
: graphqlOperationFromText(node.value);
|
|
243
|
+
if (t.isTemplateLiteral(node)) {
|
|
244
|
+
// A template recovered without a cooked value stays dynamic.
|
|
245
|
+
const cooked = node.quasis[0]?.value.cooked;
|
|
246
|
+
return cooked === undefined || cooked === null
|
|
247
|
+
? undefined
|
|
248
|
+
: graphqlOperationFromText(cooked);
|
|
249
|
+
}
|
|
250
|
+
return undefined;
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
};
|
|
@@ -25,7 +25,7 @@ const classifyLayer = (layer, runtimeEntities, matches, options) => {
|
|
|
25
25
|
const layerComplete = options.reconciliationComplete &&
|
|
26
26
|
layer.graph.coverage.status === "complete" &&
|
|
27
27
|
scopedEntities.length > 0 &&
|
|
28
|
-
scopedEntities.every(({ capture }) =>
|
|
28
|
+
scopedEntities.every(({ capture }) => capture.scriptsCompleteWithinScope);
|
|
29
29
|
const states = nodes.map((node) => {
|
|
30
30
|
const runtimeNodeIds = uniqueSorted(direct.get(node.node_id) ?? []);
|
|
31
31
|
if (runtimeNodeIds.length > 0)
|
|
@@ -85,8 +85,6 @@ const append = (values, key, value) => {
|
|
|
85
85
|
else
|
|
86
86
|
current.push(value);
|
|
87
87
|
};
|
|
88
|
-
const captureScriptsComplete = (evidenceId, entities) => entities.find(({ capture }) => capture.evidence.evidence_id === evidenceId)
|
|
89
|
-
?.capture.scriptsCompleteWithinScope === true;
|
|
90
88
|
const isLoadStateNode = (node) => node.kind === "javascript-asset" ||
|
|
91
89
|
node.kind === "javascript-chunk" ||
|
|
92
90
|
node.kind === "javascript-module";
|
|
@@ -131,8 +131,13 @@ const graphCoverage = (input, facts, nodeCount) => facts.inputStatus === "comple
|
|
|
131
131
|
};
|
|
132
132
|
const mergeNodes = (nodes) => {
|
|
133
133
|
const grouped = new Map();
|
|
134
|
-
for (const node of nodes)
|
|
135
|
-
|
|
134
|
+
for (const node of nodes) {
|
|
135
|
+
const group = grouped.get(node.node_id);
|
|
136
|
+
if (group === undefined)
|
|
137
|
+
grouped.set(node.node_id, [node]);
|
|
138
|
+
else
|
|
139
|
+
group.push(node);
|
|
140
|
+
}
|
|
136
141
|
const merged = [...grouped.values()].map((group) => {
|
|
137
142
|
const first = group[0];
|
|
138
143
|
if (first === undefined)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { posix, relative, win32 } from "node:path";
|
|
2
|
+
import { logicalPathEscapesRoot, normalizeJoinedLogicalPath, } from "../artifactIdentity.js";
|
|
2
3
|
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
3
4
|
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
4
5
|
/** Index statically reconstructed entities that can receive runtime matches. */
|
|
@@ -108,7 +109,7 @@ const nodePaths = (node) => {
|
|
|
108
109
|
paths.push(observation.evidence.location.value.path);
|
|
109
110
|
}
|
|
110
111
|
return paths
|
|
111
|
-
.map(
|
|
112
|
+
.map(relativeLogicalPath)
|
|
112
113
|
.filter((path) => path !== null && path !== "artifact-root");
|
|
113
114
|
};
|
|
114
115
|
const candidateDigests = (node) => {
|
|
@@ -142,7 +143,7 @@ const pathBelowRoot = (root, value) => {
|
|
|
142
143
|
portableRemainder === ".." ||
|
|
143
144
|
portableRemainder.startsWith("../"))
|
|
144
145
|
return null;
|
|
145
|
-
return
|
|
146
|
+
return relativeLogicalPath(portableRemainder);
|
|
146
147
|
};
|
|
147
148
|
const absoluteFilePathStyle = (path) => {
|
|
148
149
|
if (/^[a-z]:[\\/]/iu.test(path) ||
|
|
@@ -166,7 +167,7 @@ const pathBelowUrlPrefix = (prefix, value) => {
|
|
|
166
167
|
!candidate.pathname.startsWith(base.pathname))
|
|
167
168
|
return null;
|
|
168
169
|
try {
|
|
169
|
-
return
|
|
170
|
+
return relativeLogicalPath(decodeURIComponent(candidate.pathname.slice(base.pathname.length)));
|
|
170
171
|
}
|
|
171
172
|
catch (cause) {
|
|
172
173
|
// Undecodable path segments are represented by the null return.
|
|
@@ -190,16 +191,12 @@ const activeArtifactPrefixes = (layer, entities) => {
|
|
|
190
191
|
return [...prefixes].sort(compareUnicodeCodePoints);
|
|
191
192
|
};
|
|
192
193
|
const pathWithinPrefix = (path, prefix) => prefix === "" || path === prefix || path.startsWith(`${prefix}/`);
|
|
193
|
-
const safeArtifactPath = (prefix, suffix) =>
|
|
194
|
-
const
|
|
195
|
-
const normalized =
|
|
196
|
-
.normalize(value.replaceAll("\\", "/"))
|
|
197
|
-
.replace(/^\.\//u, "");
|
|
194
|
+
const safeArtifactPath = (prefix, suffix) => relativeLogicalPath(prefix === "" ? suffix : posix.join(prefix, suffix));
|
|
195
|
+
const relativeLogicalPath = (value) => {
|
|
196
|
+
const normalized = normalizeJoinedLogicalPath(value);
|
|
198
197
|
return normalized !== "" &&
|
|
199
198
|
normalized !== "." &&
|
|
200
|
-
normalized
|
|
201
|
-
!normalized.startsWith("/") &&
|
|
202
|
-
!normalized.startsWith("../")
|
|
199
|
+
!logicalPathEscapesRoot(normalized)
|
|
203
200
|
? normalized
|
|
204
201
|
: null;
|
|
205
202
|
};
|