rea-agents 5.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -655
- package/bridge/android/ReaJadxBridge.java +14 -5
- package/bridge/ghidra/ReaGhidraBridge.java +173 -47
- package/bridge/hopper_bridge.py +310 -128
- package/bridge/mitmproxy/capture.py +208 -0
- package/bridge/native/rea_lldb_tracer.py +839 -0
- package/bridge/process/ProcessRunTokenReader.swift +297 -0
- package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
- package/bridge/pwndbg/core_context.py +101 -0
- package/bridge/pwndbg/launch.py +39 -0
- package/bridge/pwndbg/launch_impl.py +34 -0
- package/bridge/pwntools/decoder_runtime.py +59 -0
- package/bridge/pwntools/layout.py +39 -0
- package/bridge/pwntools/layout_impl.py +309 -0
- package/bridge/pwntools/recorded_crash.py +39 -0
- package/bridge/pwntools/recorded_crash_impl.py +147 -0
- package/dist/android/JadxConfiguration.js +196 -33
- package/dist/android/JadxMcpTransport.js +4 -0
- package/dist/android/JadxProtocol.js +6 -0
- package/dist/android/JadxProvider.js +20 -2
- package/dist/android/JadxSession.js +23 -4
- package/dist/application/AnalysisContextQueries.js +8 -35
- package/dist/application/AnalysisDocument.js +32 -0
- package/dist/application/AppBundleExecutable.js +67 -21
- package/dist/application/CallPathTracing.js +19 -3
- package/dist/application/CapabilityInventory.js +27 -3
- package/dist/application/ClientConfigurationDocument.js +871 -6
- package/dist/application/ClientRegistrationIdentity.js +26 -5
- package/dist/application/ClientRegistrationStatus.js +29 -14
- package/dist/application/DirectAnalysis.js +97 -33
- package/dist/application/Doctor.js +4 -2
- package/dist/application/DoctorScope.js +25 -13
- package/dist/application/EnhancedLiteralTracing.js +22 -25
- package/dist/application/EnhancedTools.js +13 -11
- package/dist/application/EvidenceBundleFiles.js +24 -12
- package/dist/application/FunctionAnalysisEvidence.js +2 -3
- package/dist/application/InventoryProjectionEvidence.js +4 -3
- package/dist/application/InvestigationProviders.js +3 -2
- package/dist/application/JsonFiles.js +50 -28
- package/dist/application/ProcedureAddressResolution.js +11 -0
- package/dist/application/ReconstructionCoverageService.js +7 -4
- package/dist/application/ReconstructionObligationCandidates.js +5 -1
- package/dist/application/ReconstructionObligationLedgerService.js +4 -3
- package/dist/application/Setup.js +13 -1
- package/dist/application/SetupClientConfiguration.js +10 -15
- package/dist/application/SetupHost.js +5 -2
- package/dist/application/SetupPlan.js +5 -3
- package/dist/application/SupportedClients.js +34 -1
- package/dist/application/Uninstall.js +4 -3
- package/dist/application/Update.js +18 -3
- package/dist/application/UpdateRuntime.js +46 -25
- package/dist/application/WebModuleTraceService.js +4 -2
- package/dist/application/WebNetworkCapturePort.js +1 -0
- package/dist/application/WebNetworkCaptureService.js +134 -0
- package/dist/application/WebRuntimeService.js +5 -3
- package/dist/application/WebScriptExportService.js +2 -2
- package/dist/application/WebSourceLocationService.js +4 -2
- package/dist/application/WindowsCapabilities.js +1 -1
- package/dist/application/WorkflowEvidence.js +82 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +21 -5
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -0
- package/dist/application/binary/AnalysisSnapshotCache.js +52 -12
- package/dist/application/binary/BinarySession.js +131 -76
- package/dist/application/binary/BinarySessionOpen.js +19 -6
- package/dist/application/binary/BinarySessionRecords.js +45 -3
- package/dist/application/binary/BinarySessionStatus.js +17 -1
- package/dist/application/binary/CompositeProvider.js +13 -0
- package/dist/application/binary/LazyAnalysisProvider.js +3 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutPort.js +1 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +59 -0
- package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +62 -0
- package/dist/application/evm/EvmInterfacePort.js +1 -0
- package/dist/application/evm/EvmInterfaceService.js +64 -0
- package/dist/application/investigation/EvidenceLedger.js +21 -7
- package/dist/application/investigation/InvestigationRecords.js +8 -0
- package/dist/application/javascript/JavaScriptAnalysisControl.js +34 -0
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +25 -5
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +19 -2
- package/dist/application/javascript/JavaScriptApplicationService.js +34 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +5 -5
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +47 -27
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +39 -7
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +26 -2
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +80 -27
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +33 -12
- package/dist/application/javascript/JavaScriptModuleRelationships.js +37 -8
- package/dist/application/javascript/JavaScriptRecoveryService.js +4 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -1
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +149 -72
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +14 -15
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +41 -1
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -9
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +118 -12
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +27 -5
- package/dist/application/managed/ManagedApplicationGraphService.js +4 -3
- package/dist/application/managed/ManagedMemberComparisonService.js +7 -4
- package/dist/application/managed/ManagedNativeVerificationService.js +4 -3
- package/dist/application/managed/ManagedReconstructionService.js +4 -3
- package/dist/application/{ProcessCli.js → process/ProcessCli.js} +23 -15
- package/dist/application/{ProcessEvidence.js → process/ProcessEvidence.js} +8 -7
- package/dist/application/workflowInputError.js +18 -0
- package/dist/artifacts/ArtifactProvider.js +42 -5
- package/dist/artifacts/ArtifactProviderMetadata.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +98 -14
- package/dist/artifacts/NativeDmgArtifactReader.js +13 -6
- package/dist/artifacts/ZipArtifactReader.js +3 -0
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +22 -3
- package/dist/artifacts/apple/DylibResolutionReader.js +259 -0
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +176 -56
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +195 -0
- package/dist/artifacts/apple/KeyedArchiveReader.js +36 -22
- package/dist/artifacts/apple/MachoLoadCommandReader.js +355 -0
- package/dist/artifacts/apple/NibArchive.js +81 -14
- package/dist/artifacts/apple/NibViewHierarchy.js +10 -3
- package/dist/artifacts/apple/PlistNumberLiterals.js +164 -0
- package/dist/{application → artifacts/extraction}/ArtifactExtraction.js +10 -10
- package/dist/{application → artifacts/inventory}/ArtifactGraphConstruction.js +16 -11
- package/dist/{application → artifacts/inventory}/ArtifactInventory.js +4 -4
- package/dist/{application/ArtifactInventory → artifacts/inventory}/classify.js +2 -2
- package/dist/{application/ArtifactInventory → artifacts/inventory}/reader.js +5 -5
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanCanonical.js +14 -17
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanReader.js +5 -5
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +6 -2
- package/dist/artifacts/readStableArtifact.js +20 -4
- package/dist/browser/CdpCaptureCompleteness.js +2 -0
- package/dist/browser/CdpCaptureEventHandlers.js +165 -12
- package/dist/browser/CdpCaptureEventTypes.js +5 -1
- package/dist/browser/CdpCaptureEvents.js +34 -0
- package/dist/browser/CdpConnection.js +30 -11
- package/dist/browser/CdpOptionalCommand.js +2 -3
- package/dist/browser/CdpPageCapture.js +23 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +32 -23
- package/dist/browser/PlaywrightElectronActiveProjection.js +141 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +130 -122
- package/dist/browser/WebSourceMapFetcher.js +426 -72
- package/dist/browser/assets/LocalWebScriptArtifacts.js +2 -2
- package/dist/browser/history/CaptureFailures.js +137 -0
- package/dist/browser/history/CaptureFormatError.js +10 -0
- package/dist/browser/history/CaptureRedaction.js +65 -0
- package/dist/browser/history/CaptureRelease.js +17 -0
- package/dist/browser/history/HarCapture.js +165 -0
- package/dist/browser/history/HarCaptureAdapter.js +20 -0
- package/dist/browser/history/HarCaptureProcess.js +57 -0
- package/dist/browser/history/HarJson.js +92 -0
- package/dist/browser/history/HarSchema.js +72 -0
- package/dist/browser/history/HistoricalCaptureDecoder.js +188 -0
- package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
- package/dist/browser/history/MitmproxyCaptureAdapter.js +42 -0
- package/dist/cli/analysisSelector.js +23 -0
- package/dist/cli/applicationCommands.js +2 -3
- package/dist/cli/artifactCommands.js +26 -1
- package/dist/cli/binaryDiagnosticsCommands.js +39 -0
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +78 -20
- package/dist/cli/electronCommands.js +21 -13
- package/dist/cli/evmCommands.js +24 -0
- package/dist/cli/firmwareCommands.js +6 -3
- package/dist/cli/javascriptApplicationAnalysis.js +20 -3
- package/dist/cli/jsonOutput.js +38 -0
- package/dist/cli/nativeCallCommands.js +34 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/streamedJsonOutput.js +56 -0
- package/dist/cli/utilityCommands.js +2 -0
- package/dist/cli/webNetworkCaptureCommands.js +40 -0
- package/dist/cli/webRuntimeCommands.js +8 -8
- package/dist/cli.js +11 -4
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +6 -1
- package/dist/cliJsonInput.js +35 -1
- package/dist/cliOutput.js +21 -6
- package/dist/composition/binaryDiagnostics.js +8 -0
- package/dist/composition/evm.js +4 -0
- package/dist/composition/webNetworkCaptures.js +6 -0
- package/dist/config/environment.js +4 -0
- package/dist/config/ghidraStartupTimeout.js +17 -0
- package/dist/config/mcpResponseBudget.js +22 -0
- package/dist/config/parseConfig.js +2 -1
- package/dist/contracts/artifactToolContracts.js +6 -0
- package/dist/contracts/browserCaptureToolInputSchema.js +43 -0
- package/dist/contracts/browserToolContracts.js +4 -3
- package/dist/contracts/enhancedInputs.js +5 -3
- package/dist/contracts/enhancedToolContracts.js +3 -3
- package/dist/contracts/errorSchemas.js +8 -1
- package/dist/contracts/evm/evmToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +2 -5
- package/dist/contracts/investigationExamples.js +2 -2
- package/dist/contracts/javascript/electronToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +8 -6
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +42 -0
- package/dist/contracts/native/nativeToolContracts.js +21 -3
- package/dist/contracts/officialToolContracts.js +26 -24
- package/dist/contracts/process/processCaptureExample.js +2 -0
- package/dist/contracts/promptContracts.js +3 -3
- package/dist/contracts/sessionLifecycleInputs.js +18 -5
- package/dist/contracts/sessionStatusContract.js +8 -2
- package/dist/contracts/sessionToolContracts.js +8 -3
- package/dist/contracts/sessionToolSchemas.js +8 -4
- package/dist/contracts/toolContractExamples.js +1 -2
- package/dist/contracts/toolContractHelpers.js +4 -1
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +30 -1
- package/dist/contracts/toolOutputSchemaGroups.js +33 -28
- package/dist/contracts/toolOutputSchemaPrimitives.js +19 -1
- package/dist/contracts/toolSchemaMetadata.js +69 -10
- package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
- package/dist/domain/analysisErrorBase.js +22 -2
- package/dist/domain/analysisErrorCore.js +61 -5
- package/dist/domain/analysisErrorPresentation.js +95 -12
- package/dist/domain/analysisErrorProjection.js +148 -19
- package/dist/domain/analysisSnapshot.js +166 -2
- package/dist/domain/android/androidAnalysis.js +2 -4
- package/dist/domain/android/androidApplication.js +17 -9
- package/dist/domain/apple/appleApplication.js +41 -14
- package/dist/domain/apple/dyldEnvironment.js +73 -0
- package/dist/domain/apple/dyldPaths.js +81 -0
- package/dist/domain/apple/dylibResolution.js +478 -0
- package/dist/domain/apple/dylibResolutionFindings.js +77 -0
- package/dist/domain/apple/interfaceBuilderGraph.js +25 -13
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +13 -3
- package/dist/domain/apple/keyedArchive.js +9 -1
- package/dist/domain/apple/machoContainer.js +54 -0
- package/dist/domain/apple/plistNumbers.js +76 -0
- package/dist/domain/artifactIdentity.js +29 -0
- package/dist/domain/artifactInventoryEvidence.js +19 -24
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/bridgeCandidateProjection.js +71 -0
- package/dist/domain/browserCompleteness.js +1 -0
- package/dist/domain/browserObservation.js +1 -1
- package/dist/domain/browserObservationError.js +24 -5
- package/dist/domain/browserObservationSchemas.js +13 -0
- package/dist/domain/browserScenarioValues.js +5 -2
- package/dist/domain/bundleComparison.js +3 -2
- package/dist/domain/callPathSchemas.js +1 -1
- package/dist/domain/canonicalDigest.js +13 -1
- package/dist/domain/canonicalJsonDigestSteps.js +133 -0
- package/dist/domain/canonicalOrdering.js +9 -5
- package/dist/domain/changedBehavior.js +9 -9
- package/dist/domain/comparisonSourceEvidence.js +40 -0
- package/dist/domain/comparisonStatus.js +2 -30
- package/dist/domain/configurationErrors.js +1 -1
- package/dist/domain/conformanceTrustGate.js +0 -16
- package/dist/domain/evidence.js +78 -11
- package/dist/domain/evidenceBundle.js +42 -1
- package/dist/domain/evidenceErrors.js +12 -1
- package/dist/domain/evm/evmInterface.js +63 -0
- package/dist/domain/explicitSensitiveFailure.js +108 -0
- package/dist/domain/explicitSensitiveValues.js +10 -0
- package/dist/domain/firmware/firmwareAnalysis.js +10 -4
- package/dist/domain/hopperErrors.js +23 -2
- package/dist/domain/hopperValues.js +51 -8
- package/dist/domain/immutableJson.js +114 -0
- package/dist/domain/inputIssueProjection.js +3 -0
- package/dist/domain/javascript/electronActiveObservation.js +37 -6
- package/dist/domain/javascript/electronStaticAnalysisValues.js +6 -12
- package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +71 -23
- package/dist/domain/javascript/javascriptApplicationGraph.js +13 -0
- package/dist/domain/javascript/javascriptAstValues.js +20 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +21 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +0 -10
- package/dist/domain/javascript/javascriptRecovery.js +3 -8
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +97 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +6 -5
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +9 -17
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +22 -5
- package/dist/domain/javascript/javascriptSemanticGraph.js +34 -5
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +25 -17
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -4
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +77 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +83 -11
- package/dist/domain/javascript/javascriptSourceParser.js +6 -2
- package/dist/domain/javascript/javascriptStaticAnalysis.js +22 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -3
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +14 -4
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +66 -7
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +28 -16
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -2
- package/dist/domain/jsonSerialization.js +109 -0
- package/dist/domain/jsonValue.js +91 -3
- package/dist/domain/localPath.js +8 -0
- package/dist/domain/managed/managedApplicationGraph.js +10 -10
- package/dist/domain/managed/managedInspectionEvidence.js +16 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +5 -9
- package/dist/domain/managed/managedNativeVerification.js +3 -9
- package/dist/domain/native/binaryLayout.js +357 -0
- package/dist/domain/native/fileOffsetPartialObservation.js +1 -0
- package/dist/domain/native/nativeCallObservation.js +186 -0
- package/dist/domain/native/nativeCallPartialObservation.js +33 -0
- package/dist/domain/native/objcSwiftMetadata.js +0 -39
- package/dist/domain/native/recordedCrash.js +266 -0
- package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
- package/dist/domain/{processCapture.js → process/processCapture.js} +143 -2
- package/dist/domain/{processCaptureExample.js → process/processCaptureExample.js} +5 -0
- package/dist/domain/process/processCaptureParsing.js +54 -0
- package/dist/domain/{processCaptureValidation.js → process/processCaptureValidation.js} +18 -2
- package/dist/domain/{processComparison.js → process/processComparison.js} +39 -5
- package/dist/domain/{processObservation.js → process/processObservation.js} +1 -1
- package/dist/domain/{processScenario.js → process/processScenario.js} +11 -10
- package/dist/domain/{processTraceSpecification.js → process/processTraceSpecification.js} +1 -1
- package/dist/domain/propertyListKeys.js +1 -1
- package/dist/domain/propertyListXmlText.js +19 -0
- package/dist/domain/providerAdapterError.js +1 -1
- package/dist/domain/providerOperationHealth.js +54 -0
- package/dist/domain/providerSelectionError.js +4 -2
- package/dist/domain/reconstructionVerification.js +9 -46
- package/dist/domain/reconstructionVerificationSchemas.js +3 -3
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +9 -46
- package/dist/domain/webBundleAnalysis.js +20 -8
- package/dist/domain/webBundleAnalyzerInspection.js +13 -8
- package/dist/domain/webBundleAnalyzerResult.js +41 -2
- package/dist/domain/webCaptureDiff.js +1 -0
- package/dist/domain/webNetworkCapture.js +118 -0
- package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
- package/dist/domain/webRuntime.js +19 -5
- package/dist/domain/webSourceLocation.js +1 -0
- package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
- package/dist/dotnet/ManagedMemberInspector.js +4 -2
- package/dist/dotnet/ManagedMemberInspectorCore.js +38 -32
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +23 -7
- package/dist/dotnet/ManagedMemberRows.js +14 -3
- package/dist/dotnet/ManagedMetadataHeaps.js +20 -2
- package/dist/dotnet/ManagedMetadataInventory.js +38 -28
- package/dist/dotnet/ManagedMetadataInventoryRows.js +24 -10
- package/dist/dotnet/ManagedMethodBodyReader.js +7 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +15 -3
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +3 -1
- package/dist/dotnet/ManagedPeReader.js +11 -0
- package/dist/evm/EvmBytecodeCarrier.js +21 -0
- package/dist/evm/EvmWorkerLimits.js +40 -0
- package/dist/evm/EvmoleFailures.js +126 -0
- package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
- package/dist/evm/EvmoleInterfaceProvider.js +273 -0
- package/dist/evm/EvmoleInterfaceWorker.js +87 -0
- package/dist/evm/EvmoleRelease.js +16 -0
- package/dist/firmware/FirmwareCommand.js +1 -0
- package/dist/firmware/FirmwareFiles.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +5 -0
- package/dist/ghidra/GhidraClient.js +47 -14
- package/dist/ghidra/GhidraDiagnostics.js +7 -7
- package/dist/ghidra/GhidraFunctionValues.js +10 -7
- package/dist/ghidra/GhidraInstallation.js +18 -21
- package/dist/ghidra/GhidraInventoryValues.js +14 -4
- package/dist/ghidra/GhidraJavaLaunch.js +62 -0
- package/dist/ghidra/GhidraLauncher.js +34 -16
- package/dist/ghidra/GhidraProvider.js +2 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +15 -3
- package/dist/ghidra/GhidraProviderClient.js +23 -12
- package/dist/ghidra/GhidraSessionError.js +11 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +47 -12
- package/dist/ghidra/GhidraTransport.js +20 -0
- package/dist/hopper/BridgeLauncher.js +33 -11
- package/dist/hopper/HopperAnalysisProfile.js +62 -4
- package/dist/hopper/HopperCleanup.js +15 -3
- package/dist/hopper/HopperClient.js +222 -14
- package/dist/hopper/HopperFileOffset.js +237 -0
- package/dist/hopper/HopperMachOImage.js +196 -0
- package/dist/hopper/HopperOperationStage.js +6 -0
- package/dist/hopper/HopperProvider.js +63 -9
- package/dist/hopper/HopperProviderCapabilities.js +19 -1
- package/dist/hopper/HopperRegexSearch.js +137 -0
- package/dist/hopper/HopperRegexWorker.js +27 -0
- package/dist/hopper/HopperRequestQueue.js +68 -19
- package/dist/hopper/HopperTargetLease.js +3 -2
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -1
- package/dist/inspector/V8InspectorCaptureProjection.js +8 -3
- package/dist/inspector/V8InspectorProvider.js +47 -11
- package/dist/javascript/recovery/WakaruCommand.js +3 -0
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +47 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +17 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +79 -31
- package/dist/javascript/sourceMaps/TraceSourceMap.js +14 -28
- package/dist/mcpDoctor.js +62 -2
- package/dist/native/AppleDispatchCoverage.js +47 -6
- package/dist/native/AppleDispatchDecodeFacts.js +6 -0
- package/dist/native/AppleDispatchMetadata.js +6 -3
- package/dist/native/AppleMachoFixups.js +48 -24
- package/dist/native/AppleMachoSelection.js +32 -16
- package/dist/native/AppleObjcCategories.js +6 -2
- package/dist/native/AppleObjcDispatchFacets.js +5 -2
- package/dist/native/AppleObjcProperties.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +27 -21
- package/dist/native/AppleSwiftVtables.js +21 -15
- package/dist/native/CommandRunner.js +82 -84
- package/dist/native/LldbCallTracer.js +541 -0
- package/dist/native/LldbRetainedObservations.js +178 -0
- package/dist/native/NativeCallObservation.js +194 -0
- package/dist/native/NativeMacOSProvider.js +117 -20
- package/dist/native/NativeMacOSProviderMetadata.js +8 -3
- package/dist/native/SignatureTargetBinding.js +155 -0
- package/dist/native/parsers/lipo.js +71 -1
- package/dist/native/pwndbg/PwndbgCoreContext.js +180 -0
- package/dist/native/pwntools/PwntoolsDecoder.js +203 -0
- package/dist/native/pwntools/PwntoolsFailures.js +180 -0
- package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
- package/dist/native/pwntools/PwntoolsRelease.js +19 -0
- package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +103 -0
- package/dist/process/DarwinProcessRunTokenReader.js +293 -0
- package/dist/process/ExecFileOutput.js +20 -0
- package/dist/process/OwnedCommand.js +118 -0
- package/dist/process/ProcessOwnership.js +431 -51
- package/dist/process/ProcessOwnershipObservation.js +209 -27
- package/dist/process/ProviderProcess.js +68 -10
- package/dist/{application → process/capture}/ProcessCaptureCapability.js +15 -0
- package/dist/{application → process/capture}/ProcessCaptureError.js +18 -2
- package/dist/process/capture/ProcessCaptureLifecycle.js +681 -0
- package/dist/{application → process/capture}/ProcessHarness.js +195 -29
- package/dist/{application → process/capture}/ProcessSampling.js +2 -2
- package/dist/server/EvidenceMcpServer.js +146 -0
- package/dist/server/createServer.js +37 -8
- package/dist/server/promptCompletion.js +10 -3
- package/dist/server/registerAndroidTools.js +2 -4
- package/dist/server/registerApplicationTools/helpers.js +2 -4
- package/dist/server/registerArtifactComparisonTool.js +11 -7
- package/dist/server/registerBinaryDiagnosticsTools.js +15 -0
- package/dist/server/registerBrowserScenarioTool.js +2 -4
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerBundleComparisonTool.js +2 -3
- package/dist/server/registerCloseLifecycleTool.js +8 -18
- package/dist/server/registerElectronTools.js +2 -4
- package/dist/server/registerEnhancedTools.js +18 -59
- package/dist/server/registerEvidenceTools.js +3 -5
- package/dist/server/registerEvmTools.js +15 -0
- package/dist/server/registerFirmwareTools.js +2 -4
- package/dist/server/registerFunctionComparisonTool.js +10 -6
- package/dist/server/registerInvestigationTools.js +7 -7
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -4
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -4
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +2 -4
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +2 -4
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -4
- package/dist/server/registerOfficialTools.js +2 -4
- package/dist/server/registerProcessComparisonTool.js +72 -46
- package/dist/server/registerRecordedCrashTools.js +15 -0
- package/dist/server/registerSessionRecordTools.js +5 -6
- package/dist/server/registerSessionStatusTool.js +17 -3
- package/dist/server/registerSessionTools.js +13 -5
- package/dist/server/registerWebModuleTool.js +2 -4
- package/dist/server/registerWebNetworkCaptureTool.js +26 -0
- package/dist/server/registerWebRuntimeTools.js +3 -7
- package/dist/server/registerWebScriptTool.js +2 -4
- package/dist/server/registerWebSourceLocationTool.js +2 -4
- package/dist/server/runDerivedOperation.js +15 -3
- package/dist/server/sessionAvailabilityPolicy.js +3 -1
- package/dist/server/sessionToolPolicies.js +1 -1
- package/dist/server/toolRegistrationOptions.js +2 -2
- package/dist/server/toolResult.js +63 -11
- package/dist/server/toolResultEncoding.js +33 -0
- package/install.sh +1 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +42 -9
- package/scripts/electron-active-hook-boundaries.cjs +18 -20
- package/scripts/electron-active-hook.cjs +241 -37
- package/scripts/rea.mjs +11 -3
- package/skills/reverse-engineer-anything/SKILL.md +32 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +8 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +29 -0
- package/third_party/README.md +60 -0
- package/third_party/evmole/LICENSE +21 -0
- package/third_party/evmole/README.md +22 -0
- package/third_party/pwndbg/LICENSE.md +21 -0
- package/third_party/pwndbg/README.md +23 -0
- package/third_party/pwntools/README.md +40 -0
- package/dist/application/AuthorizedArtifactInventory.js +0 -7
- package/dist/application/ProcessCaptureLifecycle.js +0 -299
- package/dist/application/StoreFileLock.js +0 -124
- package/dist/contracts/processCaptureExample.js +0 -2
- package/dist/domain/bytecodeProvider.js +0 -178
- package/dist/domain/customProtocolCapture.js +0 -137
- package/dist/domain/eventProcessTree.js +0 -225
- package/dist/domain/mobileApplicationInvestigation.js +0 -159
- package/dist/domain/packageAnalysis.js +0 -123
- package/dist/domain/peInspection.js +0 -197
- package/dist/domain/processCaptureParsing.js +0 -21
- package/dist/domain/protocolCapture.js +0 -217
- package/dist/domain/runtimeIdentification.js +0 -212
- package/dist/generatedMcpToolCatalog.js +0 -37
- package/dist/ghidra/GhidraDefaults.js +0 -2
- /package/dist/application/{ArtifactExtractionDestination.js → artifacts/ArtifactExtractionDestination.js} +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/policy.js +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/types.js +0 -0
- /package/dist/domain/{processEvidenceProvider.js → process/processEvidenceProvider.js} +0 -0
- /package/dist/domain/{processTraceComparison.js → process/processTraceComparison.js} +0 -0
- /package/dist/domain/{processTraceDimensionProjection.js → process/processTraceDimensionProjection.js} +0 -0
- /package/dist/domain/{processTraceEvaluation.js → process/processTraceEvaluation.js} +0 -0
- /package/dist/{application → process/capture}/FilesystemSnapshot.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureEnvironment.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureJournal.js +0 -0
- /package/dist/{application → process/capture}/ProcessFilesystemEffects.js +0 -0
- /package/dist/{application → process/capture}/ProcessNormalization.js +0 -0
- /package/dist/{application → process/capture}/ProcessScenarioRuntimeValidation.js +0 -0
- /package/dist/{application → process/capture}/ProcessTimer.js +0 -0
- /package/dist/{application → process/capture}/TerminalRenderer.js +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { javascriptApplicationGraphSchema } from "./javascriptApplicationGraph.js";
|
|
3
|
-
import { javaScriptSemanticGraphSchema } from "./javascriptSemanticGraph.js";
|
|
2
|
+
import { javascriptApplicationGraphSchema, isValidatedImmutableJavaScriptApplicationGraph, } from "./javascriptApplicationGraph.js";
|
|
3
|
+
import { javaScriptSemanticGraphSchema, isValidatedImmutableJavaScriptSemanticGraph, } from "./javascriptSemanticGraph.js";
|
|
4
4
|
import { digestSchema } from "../digests.js";
|
|
5
5
|
import { prefixedDigestSchema } from "../digests.js";
|
|
6
|
+
import { localPathStringSchema } from "../localPath.js";
|
|
6
7
|
const countSchema = z.number().int().min(0);
|
|
7
8
|
/** Public target-free request for static JavaScript application analysis. */
|
|
8
9
|
export const analyzeJavaScriptApplicationInputSchema = z.strictObject({
|
|
9
|
-
input_path:
|
|
10
|
+
input_path: localPathStringSchema,
|
|
10
11
|
format: z.enum(["auto", "asar", "directory"]).default("auto"),
|
|
11
12
|
});
|
|
12
13
|
/** Compact counts for the high-level Electron architecture/security surface. */
|
|
@@ -45,9 +46,7 @@ const reconstructionStatisticsSchema = z.strictObject({
|
|
|
45
46
|
parse_failures: countSchema,
|
|
46
47
|
truncated_scopes: countSchema,
|
|
47
48
|
});
|
|
48
|
-
|
|
49
|
-
export const javascriptApplicationAnalysisResultSchema = z
|
|
50
|
-
.strictObject({
|
|
49
|
+
const applicationAnalysisResultShape = z.strictObject({
|
|
51
50
|
input_path: z.string().min(1),
|
|
52
51
|
format: z.enum(["asar", "directory"]),
|
|
53
52
|
root_artifact_sha256: digestSchema,
|
|
@@ -58,8 +57,8 @@ export const javascriptApplicationAnalysisResultSchema = z
|
|
|
58
57
|
statistics: reconstructionStatisticsSchema,
|
|
59
58
|
limitations: z.array(z.string().min(1)),
|
|
60
59
|
semantic_graph: javaScriptSemanticGraphSchema,
|
|
61
|
-
})
|
|
62
|
-
|
|
60
|
+
});
|
|
61
|
+
function* checkApplicationBindingsSteps(result, context) {
|
|
63
62
|
if (result.semantic_graph.application_graph_id !== result.graph.graph_id)
|
|
64
63
|
context.addIssue({
|
|
65
64
|
code: "custom",
|
|
@@ -72,19 +71,68 @@ export const javascriptApplicationAnalysisResultSchema = z
|
|
|
72
71
|
path: ["semantic_graph", "root_artifact_sha256"],
|
|
73
72
|
message: "Semantic graph must commit the containing root artifact",
|
|
74
73
|
});
|
|
75
|
-
const applicationNodeIds = new Set(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
74
|
+
const applicationNodeIds = new Set();
|
|
75
|
+
let examined = 0;
|
|
76
|
+
try {
|
|
77
|
+
for (const node of result.graph.nodes) {
|
|
78
|
+
applicationNodeIds.add(node.node_id);
|
|
79
|
+
if (++examined === 4096) {
|
|
80
|
+
examined = 0;
|
|
81
|
+
yield;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const [nodeIndex, node] of result.semantic_graph.nodes.entries()) {
|
|
85
|
+
if (++examined === 4096) {
|
|
86
|
+
examined = 0;
|
|
87
|
+
yield;
|
|
88
|
+
}
|
|
89
|
+
for (const [identifierIndex, identifier,] of node.application_node_ids.entries()) {
|
|
90
|
+
if (!applicationNodeIds.has(identifier))
|
|
91
|
+
context.addIssue({
|
|
92
|
+
code: "custom",
|
|
93
|
+
path: [
|
|
94
|
+
"semantic_graph",
|
|
95
|
+
"nodes",
|
|
96
|
+
nodeIndex,
|
|
97
|
+
"application_node_ids",
|
|
98
|
+
identifierIndex,
|
|
99
|
+
],
|
|
100
|
+
message: "Semantic node references an absent application node",
|
|
101
|
+
});
|
|
102
|
+
if (++examined === 4096) {
|
|
103
|
+
examined = 0;
|
|
104
|
+
yield;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
applicationNodeIds.clear();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** JavaScript application analysis with an authenticated semantic companion. */
|
|
114
|
+
export const javascriptApplicationAnalysisResultSchema = applicationAnalysisResultShape.superRefine((result, context) => {
|
|
115
|
+
const steps = checkApplicationBindingsSteps(result, context);
|
|
116
|
+
while (!steps.next().done) {
|
|
117
|
+
// Public/imported results still receive complete synchronous validation.
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
const ownedAnalysisResultShape = applicationAnalysisResultShape.extend({
|
|
121
|
+
graph: z.custom(isValidatedImmutableJavaScriptApplicationGraph),
|
|
122
|
+
semantic_graph: z.custom(isValidatedImmutableJavaScriptSemanticGraph),
|
|
90
123
|
});
|
|
124
|
+
/** Reuse exact owned graphs while validating metadata and cross-graph bindings. */
|
|
125
|
+
export function* parseOwnedJavaScriptApplicationAnalysisSteps(input) {
|
|
126
|
+
const prepared = ownedAnalysisResultShape.safeParse(input);
|
|
127
|
+
if (!prepared.success)
|
|
128
|
+
return javascriptApplicationAnalysisResultSchema.parse(input);
|
|
129
|
+
const issues = [];
|
|
130
|
+
yield* checkApplicationBindingsSteps(prepared.data, {
|
|
131
|
+
addIssue: (issue) => {
|
|
132
|
+
issues.push(issue);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
if (issues.length > 0)
|
|
136
|
+
throw new z.ZodError(issues);
|
|
137
|
+
return prepared.data;
|
|
138
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { canonicalDigest, canonicalJson } from "../comparisonSemantics.js";
|
|
3
3
|
import { compareCodePoints, uniqueSorted } from "../canonicalOrdering.js";
|
|
4
|
+
import { freezeOwnedJsonSnapshotSteps } from "../immutableJson.js";
|
|
4
5
|
import { applicationEdgeInputSchema, applicationEdgeSchema, applicationNodeInputSchema, applicationNodeObservationSchema, applicationNodeSchema, javascriptApplicationGraphInputSchema, javascriptApplicationGraphRecordSchema, } from "./javascriptApplicationGraphSchemas.js";
|
|
5
6
|
const OBSERVATION_IDENTIFIER_STRATEGY = {
|
|
6
7
|
strategy: "semantic-content-sha256",
|
|
@@ -255,6 +256,18 @@ export const createJavaScriptApplicationGraph = (input) => {
|
|
|
255
256
|
graph_id: `jag_${canonicalDigest(semantic, "JavaScript Application Graph")}`,
|
|
256
257
|
});
|
|
257
258
|
};
|
|
259
|
+
const validatedImmutableApplicationGraphs = new WeakSet();
|
|
260
|
+
/** Clone and validate synchronously, then return steps to seal the owned graph. */
|
|
261
|
+
export const createImmutableJavaScriptApplicationGraphSteps = (input) => sealValidatedApplicationGraphSteps(createJavaScriptApplicationGraph(input));
|
|
262
|
+
function* sealValidatedApplicationGraphSteps(graph) {
|
|
263
|
+
yield* freezeOwnedJsonSnapshotSteps(graph);
|
|
264
|
+
validatedImmutableApplicationGraphs.add(graph);
|
|
265
|
+
return graph;
|
|
266
|
+
}
|
|
267
|
+
/** Recognize the exact completely sealed graph produced by the owned factory. */
|
|
268
|
+
export const isValidatedImmutableJavaScriptApplicationGraph = (value) => typeof value === "object" &&
|
|
269
|
+
value !== null &&
|
|
270
|
+
validatedImmutableApplicationGraphs.has(value);
|
|
258
271
|
/** Parse a stored graph and reject stale IDs. */
|
|
259
272
|
export const parseJavaScriptApplicationGraph = (input) => javascriptApplicationGraphSchema.parse(input);
|
|
260
273
|
/** Compute the byte-stable SHA-256 commitment of a verified graph. */
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
+
/** Read one syntax-level primitive only when its value is exact. */
|
|
3
|
+
export const readExactJavaScriptLiteral = (node) => {
|
|
4
|
+
if (t.isStringLiteral(node))
|
|
5
|
+
return { found: true, value: node.value };
|
|
6
|
+
if (t.isNumericLiteral(node) && Number.isFinite(node.value))
|
|
7
|
+
return { found: true, value: node.value };
|
|
8
|
+
if (t.isBooleanLiteral(node))
|
|
9
|
+
return { found: true, value: node.value };
|
|
10
|
+
if (t.isNullLiteral(node))
|
|
11
|
+
return { found: true, value: null };
|
|
12
|
+
if (t.isTemplateLiteral(node) &&
|
|
13
|
+
node.expressions.length === 0 &&
|
|
14
|
+
node.quasis.length === 1) {
|
|
15
|
+
const cooked = node.quasis[0]?.value.cooked;
|
|
16
|
+
return cooked === null || cooked === undefined
|
|
17
|
+
? { found: false }
|
|
18
|
+
: { found: true, value: cooked };
|
|
19
|
+
}
|
|
20
|
+
return { found: false };
|
|
21
|
+
};
|
|
2
22
|
/** Read an identifier or literal property name without evaluating syntax. */
|
|
3
23
|
export const propertyName = (node) => {
|
|
4
24
|
if (t.isIdentifier(node))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
2
|
-
import { digestExportShapeValue } from "./javascriptExportShapeComparisonIdentity.js";
|
|
1
|
+
import { compareCodePoints, uniqueSorted } from "../canonicalOrdering.js";
|
|
2
|
+
import { canonicalExportShapeValue, digestExportShapeValue, } from "./javascriptExportShapeComparisonIdentity.js";
|
|
3
3
|
import { javaScriptExportShapeComparisonResultSchema, } from "./javascriptExportShapeComparisonSchemas.js";
|
|
4
4
|
import { retainJavaScriptExportShapes, selectJavaScriptExport, } from "./javascriptExportShapeSelection.js";
|
|
5
|
-
import { buildJavaScriptExportShapeChanges,
|
|
5
|
+
import { buildJavaScriptExportShapeChanges, hasPartialJavaScriptExportPropertyCoverage, pairJavaScriptExportShapeVariants, } from "./javascriptExportShapeVariants.js";
|
|
6
6
|
/** Compare exact selected export return shapes without executing JavaScript. */
|
|
7
7
|
export const compareJavaScriptExportShapes = (input) => {
|
|
8
8
|
const left = selectJavaScriptExport(input.left);
|
|
@@ -11,14 +11,14 @@ export const compareJavaScriptExportShapes = (input) => {
|
|
|
11
11
|
const rightRetained = retainJavaScriptExportShapes(right);
|
|
12
12
|
const pairing = pairJavaScriptExportShapeVariants(leftRetained.shapes, rightRetained.shapes);
|
|
13
13
|
const evidenceLinks = evidencePair(input.left.evidenceId, input.right.evidenceId);
|
|
14
|
-
const allChanges = buildJavaScriptExportShapeChanges({
|
|
14
|
+
const allChanges = sortChanges(buildJavaScriptExportShapeChanges({
|
|
15
15
|
leftSelection: left,
|
|
16
16
|
rightSelection: right,
|
|
17
17
|
pairing,
|
|
18
18
|
leftShapes: leftRetained.shapes,
|
|
19
19
|
rightShapes: rightRetained.shapes,
|
|
20
20
|
evidenceLinks,
|
|
21
|
-
})
|
|
21
|
+
}));
|
|
22
22
|
const changes = allChanges;
|
|
23
23
|
const omittedChanges = 0;
|
|
24
24
|
const coverage = comparisonCoverage({
|
|
@@ -46,6 +46,22 @@ export const compareJavaScriptExportShapes = (input) => {
|
|
|
46
46
|
comparison_id: `jesc_${digestExportShapeValue(semantic)}`,
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
|
+
const sortChanges = (changes) => changes
|
|
50
|
+
.map((change, index) => ({
|
|
51
|
+
change,
|
|
52
|
+
index,
|
|
53
|
+
sortKey: canonicalExportShapeValue({
|
|
54
|
+
discriminant: change.discriminant,
|
|
55
|
+
path: change.path,
|
|
56
|
+
status: change.status,
|
|
57
|
+
left_source_range: change.left_source_range,
|
|
58
|
+
right_source_range: change.right_source_range,
|
|
59
|
+
change_id: change.change_id,
|
|
60
|
+
}),
|
|
61
|
+
}))
|
|
62
|
+
.sort((left, right) => compareCodePoints(left.sortKey, right.sortKey) ||
|
|
63
|
+
left.index - right.index)
|
|
64
|
+
.map(({ change }) => change);
|
|
49
65
|
const comparisonCoverage = (context) => {
|
|
50
66
|
const leftSource = context.left.projection?.return_shape_coverage;
|
|
51
67
|
const rightSource = context.right.projection?.return_shape_coverage;
|
|
@@ -61,8 +61,6 @@ export const buildJavaScriptExportShapeChanges = (input) => {
|
|
|
61
61
|
});
|
|
62
62
|
return [...paired, ...unpairedLeft, ...unpairedRight];
|
|
63
63
|
};
|
|
64
|
-
/** Sort changes by semantic content rather than traversal order. */
|
|
65
|
-
export const compareJavaScriptExportShapeChanges = (left, right) => compareCodePoints(canonicalExportShapeValue(changeSortKey(left)), canonicalExportShapeValue(changeSortKey(right)));
|
|
66
64
|
/** Report whether any retained shape lacks complete property coverage. */
|
|
67
65
|
export const hasPartialJavaScriptExportPropertyCoverage = (shapes) => shapes.some((shape) => shape.property_coverage.some(({ status }) => status === "partial"));
|
|
68
66
|
const discriminantOccurrences = (shapes) => {
|
|
@@ -270,14 +268,6 @@ const changeWithId = (semantic) => ({
|
|
|
270
268
|
...semantic,
|
|
271
269
|
change_id: `jesc_change_${digestExportShapeValue(semantic)}`,
|
|
272
270
|
});
|
|
273
|
-
const changeSortKey = (change) => ({
|
|
274
|
-
discriminant: change.discriminant,
|
|
275
|
-
path: change.path,
|
|
276
|
-
status: change.status,
|
|
277
|
-
left_source_range: change.left_source_range,
|
|
278
|
-
right_source_range: change.right_source_range,
|
|
279
|
-
change_id: change.change_id,
|
|
280
|
-
});
|
|
281
271
|
const literalValue = (field) => field.state === "literal" && isPrimitive(field.value)
|
|
282
272
|
? { found: true, value: field.value }
|
|
283
273
|
: { found: false };
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { digestSchema } from "../digests.js";
|
|
3
3
|
import { analyzeJavaScriptApplicationInputSchema } from "./javascriptApplicationAnalysis.js";
|
|
4
|
+
import { localPathStringSchema } from "../localPath.js";
|
|
4
5
|
/** Recover derived readable modules from one explicitly selected local script. */
|
|
5
6
|
export const javascriptRecoveryInputSchema = z.strictObject({
|
|
6
|
-
path:
|
|
7
|
-
|
|
8
|
-
.min(1)
|
|
9
|
-
.describe("Absolute path to a UTF-8 JavaScript file; never executed"),
|
|
10
|
-
output_directory: z
|
|
11
|
-
.string()
|
|
12
|
-
.min(1)
|
|
13
|
-
.describe("Absolute absent output directory; parent must exist"),
|
|
7
|
+
path: localPathStringSchema.describe("Absolute path to a UTF-8 JavaScript file; never executed"),
|
|
8
|
+
output_directory: localPathStringSchema.describe("Absolute absent output directory; parent must exist"),
|
|
14
9
|
extraction_mode: z
|
|
15
10
|
.enum(["structural", "heuristic", "inspection"])
|
|
16
11
|
.default("structural")
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { failedJavaScriptSemanticIr, } from "./javascriptSemanticIr.js";
|
|
3
3
|
import { collectSemanticModuleLink, collectSemanticCallable, collectSemanticReferences, immutableSemanticBindings, immutableSemanticScopes, semanticStaticPropertyKey, } from "./javascriptSemanticProjection.js";
|
|
4
|
-
import { currentSemanticScope, resolveSemanticBindingFromScope, semanticScopeId, semanticVariableScope, } from "./javascriptSemanticState.js";
|
|
4
|
+
import { currentSemanticScope, resolveSemanticBindingState, semanticResolutionBlocked, resolveSemanticBindingFromScope, semanticScopeId, semanticVariableScope, } from "./javascriptSemanticState.js";
|
|
5
5
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
6
6
|
import { collectSemanticMemberMutations } from "./javascriptSemanticMemberMutations.js";
|
|
7
7
|
import { collectSemanticReturns, resolveSemanticModuleCallables, } from "./javascriptSemanticReturns.js";
|
|
8
8
|
import { collectJavaScriptDerivedSemantics } from "./javascriptSemanticDerivedAnalysis.js";
|
|
9
9
|
import { propertyName, range } from "./javascriptStaticAnalysisHelpers.js";
|
|
10
10
|
import { semanticCoverage } from "./javascriptSemanticCoverage.js";
|
|
11
|
+
import { semanticResourceLimitsIn } from "./javascriptSemanticResourceLimits.js";
|
|
11
12
|
import { parseJavaScriptSource, } from "./javascriptSourceParser.js";
|
|
12
13
|
/** Recover lexical bindings, aliases, constants, and module links. */
|
|
13
14
|
export const analyzeJavaScriptSemantics = (source) => {
|
|
@@ -44,7 +45,10 @@ export const analyzeParsedJavaScriptSemantics = (file) => {
|
|
|
44
45
|
references,
|
|
45
46
|
moduleLinks,
|
|
46
47
|
...derived,
|
|
47
|
-
coverage: semanticCoverage(parserPartial
|
|
48
|
+
coverage: semanticCoverage(parserPartial, semanticResourceLimitsIn([
|
|
49
|
+
...bindings.map(({ value }) => value),
|
|
50
|
+
...callables.flatMap((callable) => callable.returnSites.map(({ value }) => value)),
|
|
51
|
+
])),
|
|
48
52
|
limitations: [
|
|
49
53
|
...(parserPartial
|
|
50
54
|
? [
|
|
@@ -59,6 +63,97 @@ export const analyzeParsedJavaScriptSemantics = (file) => {
|
|
|
59
63
|
],
|
|
60
64
|
};
|
|
61
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Resolve only the lexical receiver identity needed to distinguish browser
|
|
68
|
+
* `window.open` from XHR and global storage `.open` calls. This deliberately
|
|
69
|
+
* builds definitions without running semantic value or provenance analysis.
|
|
70
|
+
*/
|
|
71
|
+
export const classifyParsedJavaScriptOpenReceivers = (file) => {
|
|
72
|
+
const state = createState(file.program);
|
|
73
|
+
collectDefinitions(file.program, state);
|
|
74
|
+
const facts = new Map();
|
|
75
|
+
traverseJavaScriptAst(file.program, {
|
|
76
|
+
enter: (node) => {
|
|
77
|
+
if ((!t.isCallExpression(node) && !t.isOptionalCallExpression(node)) ||
|
|
78
|
+
(!t.isMemberExpression(node.callee) &&
|
|
79
|
+
!t.isOptionalMemberExpression(node.callee)) ||
|
|
80
|
+
semanticStaticPropertyKey(node.callee.property, node.callee.computed) !== "open" ||
|
|
81
|
+
!t.isIdentifier(node.callee.object))
|
|
82
|
+
return;
|
|
83
|
+
const receiver = node.callee.object.name;
|
|
84
|
+
const binding = resolveSemanticBindingState(state, node, receiver);
|
|
85
|
+
if (binding === undefined) {
|
|
86
|
+
if (semanticResolutionBlocked(state, node, receiver))
|
|
87
|
+
return;
|
|
88
|
+
const fact = openGlobalFact(receiver);
|
|
89
|
+
if (fact !== undefined)
|
|
90
|
+
facts.set(node.start ?? -1, fact);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// A lexically bound receiver overrides ambient browser globals. Mark an
|
|
94
|
+
// otherwise unresolved local as local so name-based window.open
|
|
95
|
+
// heuristics do not hide its XHR-like overloads.
|
|
96
|
+
facts.set(node.start ?? -1, "local");
|
|
97
|
+
if (receiver === "indexedDB" || receiver === "caches") {
|
|
98
|
+
facts.set(node.start ?? -1, receiver === "indexedDB" ? "local-indexed-db" : "local-cache-storage");
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (binding.mutable || binding.initializers.length !== 1)
|
|
102
|
+
return;
|
|
103
|
+
const initializer = binding.initializers[0]?.node;
|
|
104
|
+
if (!t.isIdentifier(initializer))
|
|
105
|
+
return;
|
|
106
|
+
const initializerBinding = resolveSemanticBindingState(state, initializer, initializer.name);
|
|
107
|
+
if (initializerBinding !== undefined) {
|
|
108
|
+
if (initializer.name === "indexedDB" || initializer.name === "caches") {
|
|
109
|
+
const localFact = initializer.name === "indexedDB"
|
|
110
|
+
? "local-indexed-db"
|
|
111
|
+
: "local-cache-storage";
|
|
112
|
+
facts.set(node.start ?? -1, localFact);
|
|
113
|
+
if (initializerBinding.mutable ||
|
|
114
|
+
initializerBinding.initializers.length !== 1)
|
|
115
|
+
return;
|
|
116
|
+
const nested = initializerBinding.initializers[0]?.node;
|
|
117
|
+
if (t.isIdentifier(nested)) {
|
|
118
|
+
const nestedFact = resolveGlobalAliasFact(state, initializer, nested.name);
|
|
119
|
+
if (nestedFact !== undefined)
|
|
120
|
+
facts.set(node.start ?? -1, nestedFact);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else if (initializer.name === "window") {
|
|
124
|
+
facts.set(node.start ?? -1, "local");
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const aliasFact = resolveGlobalAliasFact(state, initializer, initializer.name);
|
|
129
|
+
if (aliasFact !== undefined)
|
|
130
|
+
facts.set(node.start ?? -1, aliasFact);
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
return facts;
|
|
134
|
+
};
|
|
135
|
+
const openGlobalFact = (name) => {
|
|
136
|
+
if (name === "window" ||
|
|
137
|
+
name === "self" ||
|
|
138
|
+
name === "globalThis" ||
|
|
139
|
+
name === "top" ||
|
|
140
|
+
name === "parent" ||
|
|
141
|
+
name === "opener" ||
|
|
142
|
+
name === "frames" ||
|
|
143
|
+
name === "document")
|
|
144
|
+
return "window";
|
|
145
|
+
if (name === "indexedDB")
|
|
146
|
+
return "indexed-db";
|
|
147
|
+
if (name === "caches")
|
|
148
|
+
return "cache-storage";
|
|
149
|
+
return undefined;
|
|
150
|
+
};
|
|
151
|
+
const resolveGlobalAliasFact = (state, node, name) => {
|
|
152
|
+
if (resolveSemanticBindingState(state, node, name) !== undefined ||
|
|
153
|
+
semanticResolutionBlocked(state, node, name))
|
|
154
|
+
return undefined;
|
|
155
|
+
return openGlobalFact(name);
|
|
156
|
+
};
|
|
62
157
|
const createState = (program) => {
|
|
63
158
|
const root = {
|
|
64
159
|
scopeId: semanticScopeId("program", program),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/** Classify whole-file semantic coverage from
|
|
2
|
-
export const semanticCoverage = (parserPartial) =>
|
|
3
|
-
status:
|
|
4
|
-
omittedCount: 0
|
|
5
|
-
|
|
1
|
+
/** Classify whole-file semantic coverage from parsing and value bounds. */
|
|
2
|
+
export const semanticCoverage = (parserPartial, resourceLimits = []) => resourceLimits.length > 0
|
|
3
|
+
? { status: "partial", omittedCount: null, resourceLimits }
|
|
4
|
+
: { status: parserPartial ? "partial" : "complete", omittedCount: 0 };
|
|
5
|
+
/** Read typed resource-limit classifications from any coverage state. */
|
|
6
|
+
export const semanticCoverageResourceLimits = (coverage) => coverage.resourceLimits ?? [];
|
|
6
7
|
/** Classify one callable's direct-return coverage. */
|
|
7
8
|
export const semanticReturnCoverage = (retainedCount, parserPartial) => ({
|
|
8
9
|
status: parserPartial ? "partial" : "complete",
|
|
@@ -3,7 +3,7 @@ import { semanticBuiltinNamespacePath } from "./javascriptSemanticProvenance.js"
|
|
|
3
3
|
import { semanticCallableIdForNode } from "./javascriptSemanticProjection.js";
|
|
4
4
|
import { resolveSemanticBindingState, semanticResolutionBlocked, } from "./javascriptSemanticState.js";
|
|
5
5
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
6
|
-
import { semanticStaticPropertyKey, semanticStaticPropertyName, } from "./javascriptAstValues.js";
|
|
6
|
+
import { readExactJavaScriptLiteral, semanticStaticPropertyKey, semanticStaticPropertyName, } from "./javascriptAstValues.js";
|
|
7
7
|
/** Resolve bindings written by the nearest variable or assignment owner. */
|
|
8
8
|
export const assignedSemanticResultBindings = (node, ancestors, state) => {
|
|
9
9
|
for (let index = ancestors.length - 1; index >= 0; index -= 1) {
|
|
@@ -164,11 +164,14 @@ export const dataEffectPrimitive = (node) => {
|
|
|
164
164
|
};
|
|
165
165
|
/** Read one static string or expression-free template. */
|
|
166
166
|
export const dataEffectLiteralString = (node) => {
|
|
167
|
-
if (
|
|
168
|
-
return
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
if (node === undefined)
|
|
168
|
+
return null;
|
|
169
|
+
const literal = readExactJavaScriptLiteral(node);
|
|
170
|
+
if (literal.found && typeof literal.value === "string")
|
|
171
|
+
return literal.value;
|
|
172
|
+
return t.isTemplateLiteral(node) && node.expressions.length === 0
|
|
173
|
+
? (node.quasis[0]?.value.raw ?? null)
|
|
174
|
+
: null;
|
|
172
175
|
};
|
|
173
176
|
/** Read a member callee from call or construction syntax. */
|
|
174
177
|
export const dataEffectMemberCallee = (node) => t.isMemberExpression(node.callee) || t.isOptionalMemberExpression(node.callee)
|
|
@@ -179,14 +182,3 @@ export const dataEffectMemberObject = (node) => node !== null &&
|
|
|
179
182
|
(t.isMemberExpression(node) || t.isOptionalMemberExpression(node))
|
|
180
183
|
? node.object
|
|
181
184
|
: null;
|
|
182
|
-
/** Compare Babel source offsets for exact containment. */
|
|
183
|
-
export const containsSemanticNode = (outer, inner) => outer.start !== null &&
|
|
184
|
-
outer.start !== undefined &&
|
|
185
|
-
outer.end !== null &&
|
|
186
|
-
outer.end !== undefined &&
|
|
187
|
-
inner.start !== null &&
|
|
188
|
-
inner.start !== undefined &&
|
|
189
|
-
inner.end !== null &&
|
|
190
|
-
inner.end !== undefined &&
|
|
191
|
-
outer.start <= inner.start &&
|
|
192
|
-
outer.end >= inner.end;
|
|
@@ -3,7 +3,7 @@ import { semanticBuiltinNamespacePath } from "./javascriptSemanticProvenance.js"
|
|
|
3
3
|
import { compareCodePoints } from "../canonicalOrdering.js";
|
|
4
4
|
import { semanticStaticPropertyKey, semanticStaticPropertyName, } from "./javascriptSemanticProjection.js";
|
|
5
5
|
import { resolveSemanticBindingState, semanticResolutionBlocked, } from "./javascriptSemanticState.js";
|
|
6
|
-
import { builtinDataEffectMethod as builtinMethod,
|
|
6
|
+
import { builtinDataEffectMethod as builtinMethod, 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";
|
|
7
7
|
import { range } from "./javascriptStaticAnalysisHelpers.js";
|
|
8
8
|
/** Recover configuration, request, and boundary candidates from inert syntax. */
|
|
9
9
|
export const collectJavaScriptSemanticDataEffects = (program, state, callables) => {
|
|
@@ -80,20 +80,37 @@ const processConfigurationMember = (node, state) => {
|
|
|
80
80
|
return null;
|
|
81
81
|
// `process.env[""]` names an exact (empty) key; only a dynamic key is unknown.
|
|
82
82
|
const key = semanticStaticPropertyKey(node.property, node.computed);
|
|
83
|
+
if (family === "argv" && key !== null && !isArrayIndexKey(key))
|
|
84
|
+
return null;
|
|
83
85
|
return {
|
|
84
86
|
kind: family === "env" ? "environment" : "argv",
|
|
85
87
|
key,
|
|
86
88
|
resolution: key === null ? "partial" : "complete",
|
|
87
89
|
};
|
|
88
90
|
};
|
|
91
|
+
const isArrayIndexKey = (key) => {
|
|
92
|
+
if (!/^(?:0|[1-9][0-9]*)$/u.test(key))
|
|
93
|
+
return false;
|
|
94
|
+
const index = Number(key);
|
|
95
|
+
return Number.isSafeInteger(index) && index < 2 ** 32 - 1;
|
|
96
|
+
};
|
|
89
97
|
const collectDefaults = (program, context, configurations) => {
|
|
90
98
|
const output = [];
|
|
99
|
+
const configurationsByNode = new Map(configurations.map((candidate) => [candidate.node, candidate]));
|
|
91
100
|
traverseWithContext(program, context, (node) => {
|
|
92
101
|
if (!t.isLogicalExpression(node) ||
|
|
93
102
|
(node.operator !== "??" && node.operator !== "||"))
|
|
94
103
|
return;
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
let source = node.left;
|
|
105
|
+
while (t.isParenthesizedExpression(source) ||
|
|
106
|
+
t.isTSAsExpression(source) ||
|
|
107
|
+
t.isTSTypeAssertion(source) ||
|
|
108
|
+
t.isTypeCastExpression(source) ||
|
|
109
|
+
t.isTSSatisfiesExpression(source) ||
|
|
110
|
+
t.isTSNonNullExpression(source))
|
|
111
|
+
source = source.expression;
|
|
112
|
+
const candidate = configurationsByNode.get(source);
|
|
113
|
+
if (candidate === undefined)
|
|
97
114
|
return;
|
|
98
115
|
output.push({
|
|
99
116
|
configId: `config:default:${String(node.start ?? -1)}:${String(node.end ?? -1)}`,
|
|
@@ -101,8 +118,8 @@ const collectDefaults = (program, context, configurations) => {
|
|
|
101
118
|
location: range(node.right),
|
|
102
119
|
ownerCallableId: context.callableStack.at(-1) ?? null,
|
|
103
120
|
resultBindingId: outerAssignedBinding(node, context),
|
|
104
|
-
key:
|
|
105
|
-
sourceConfigId:
|
|
121
|
+
key: candidate.operation.key,
|
|
122
|
+
sourceConfigId: candidate.operation.configId,
|
|
106
123
|
value: primitiveValue(node.right),
|
|
107
124
|
resolution: primitiveValue(node.right) === null ? "partial" : "complete",
|
|
108
125
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { canonicalDigest, canonicalJson } from "../comparisonSemantics.js";
|
|
3
3
|
import { compareCodePoints, uniqueSorted } from "../canonicalOrdering.js";
|
|
4
|
+
import { freezeOwnedJsonSnapshotSteps } from "../immutableJson.js";
|
|
4
5
|
import { JAVASCRIPT_SEMANTIC_RELATION_FAMILIES, JAVASCRIPT_SEMANTIC_RELATION_FAMILY, javaScriptSemanticFingerprintInputSchema, javaScriptSemanticFingerprintSchema, javaScriptSemanticGraphInputSchema, javaScriptSemanticGraphRecordSchema, javaScriptSemanticNodeInputSchema, javaScriptSemanticNodeSchema, javaScriptSemanticRelationInputSchema, javaScriptSemanticRelationSchema, javaScriptSemanticUnknownInputSchema, javaScriptSemanticUnknownSchema, } from "./javascriptSemanticGraphSchemas.js";
|
|
5
6
|
const normalizeEvidence = (evidence) => ({
|
|
6
7
|
...evidence,
|
|
@@ -11,7 +12,8 @@ const normalizeEvidence = (evidence) => ({
|
|
|
11
12
|
limitations: uniqueSorted(evidence.limitations),
|
|
12
13
|
evidence_ids: uniqueSorted(evidence.evidence_ids),
|
|
13
14
|
});
|
|
14
|
-
|
|
15
|
+
/** Derive a semantic node ID from its kind and exact artifact identity. */
|
|
16
|
+
export const javaScriptSemanticNodeId = (node) => `jsrg_node_${canonicalDigest({ kind: node.kind, identity: node.identity }, "JavaScript semantic graph")}`;
|
|
15
17
|
/** Normalize one semantic entity and derive its artifact-version identifier. */
|
|
16
18
|
export const createJavaScriptSemanticGraphNode = (input) => {
|
|
17
19
|
const parsed = javaScriptSemanticNodeInputSchema.parse(input);
|
|
@@ -26,7 +28,7 @@ export const createJavaScriptSemanticGraphNode = (input) => {
|
|
|
26
28
|
};
|
|
27
29
|
return javaScriptSemanticNodeSchema.parse({
|
|
28
30
|
...semantic,
|
|
29
|
-
node_id:
|
|
31
|
+
node_id: javaScriptSemanticNodeId(semantic),
|
|
30
32
|
});
|
|
31
33
|
};
|
|
32
34
|
/** Normalize one semantic relationship and derive its exact identifier. */
|
|
@@ -157,7 +159,7 @@ const checkCanonicalOrder = (graph, context) => {
|
|
|
157
159
|
};
|
|
158
160
|
const checkNodes = (graph, nodes, context) => {
|
|
159
161
|
for (const [index, node] of graph.nodes.entries()) {
|
|
160
|
-
if (node.node_id !==
|
|
162
|
+
if (node.node_id !== javaScriptSemanticNodeId(node))
|
|
161
163
|
context.addIssue({
|
|
162
164
|
code: "custom",
|
|
163
165
|
path: ["nodes", index, "node_id"],
|
|
@@ -295,7 +297,7 @@ const checkFingerprints = (graph, nodes, context) => {
|
|
|
295
297
|
});
|
|
296
298
|
}
|
|
297
299
|
};
|
|
298
|
-
const
|
|
300
|
+
const checkGraphContent = (graph, context) => {
|
|
299
301
|
checkCanonicalOrder(graph, context);
|
|
300
302
|
const nodes = new Map(graph.nodes.map((node) => [node.node_id, node]));
|
|
301
303
|
checkNodes(graph, nodes, context);
|
|
@@ -311,6 +313,9 @@ const checkGraph = (graph, context) => {
|
|
|
311
313
|
path: ["limitations"],
|
|
312
314
|
message: "Non-complete graph coverage requires a limitation",
|
|
313
315
|
});
|
|
316
|
+
};
|
|
317
|
+
const checkGraph = (graph, context) => {
|
|
318
|
+
checkGraphContent(graph, context);
|
|
314
319
|
const { graph_id: identifier, ...semantic } = graph;
|
|
315
320
|
if (identifier !==
|
|
316
321
|
"jsrg_" + canonicalDigest(semantic, "JavaScript semantic graph"))
|
|
@@ -344,8 +349,32 @@ export const createJavaScriptSemanticGraph = (input) => {
|
|
|
344
349
|
},
|
|
345
350
|
limitations: uniqueSorted(parsed.limitations),
|
|
346
351
|
};
|
|
347
|
-
|
|
352
|
+
// The input schema already cloned and validated every field. Validate the
|
|
353
|
+
// normalized relationships in place, then derive the only added field. The
|
|
354
|
+
// public schema still verifies arbitrary records and their commitments.
|
|
355
|
+
const record = {
|
|
348
356
|
...semantic,
|
|
349
357
|
graph_id: `jsrg_${canonicalDigest(semantic, "JavaScript semantic graph")}`,
|
|
358
|
+
};
|
|
359
|
+
const issues = [];
|
|
360
|
+
checkGraphContent(record, {
|
|
361
|
+
addIssue: (issue) => {
|
|
362
|
+
issues.push(issue);
|
|
363
|
+
},
|
|
350
364
|
});
|
|
365
|
+
if (issues.length > 0)
|
|
366
|
+
throw new z.ZodError(issues);
|
|
367
|
+
return record;
|
|
351
368
|
};
|
|
369
|
+
const validatedImmutableSemanticGraphs = new WeakSet();
|
|
370
|
+
/** Clone and validate synchronously, then return steps to seal the owned graph. */
|
|
371
|
+
export const createImmutableJavaScriptSemanticGraphSteps = (input) => sealValidatedSemanticGraphSteps(createJavaScriptSemanticGraph(input));
|
|
372
|
+
function* sealValidatedSemanticGraphSteps(graph) {
|
|
373
|
+
yield* freezeOwnedJsonSnapshotSteps(graph);
|
|
374
|
+
validatedImmutableSemanticGraphs.add(graph);
|
|
375
|
+
return graph;
|
|
376
|
+
}
|
|
377
|
+
/** Recognize the exact completely sealed graph produced by the owned factory. */
|
|
378
|
+
export const isValidatedImmutableJavaScriptSemanticGraph = (value) => typeof value === "object" &&
|
|
379
|
+
value !== null &&
|
|
380
|
+
validatedImmutableSemanticGraphs.has(value);
|
|
@@ -221,6 +221,7 @@ export const JAVASCRIPT_SEMANTIC_UNKNOWN_REASONS = [
|
|
|
221
221
|
"eval-or-generated-code",
|
|
222
222
|
"incomplete-module",
|
|
223
223
|
"missing-source",
|
|
224
|
+
"resource-limit",
|
|
224
225
|
"unsupported-syntax",
|
|
225
226
|
];
|
|
226
227
|
/** One unresolved semantic frontier before its ID is derived. */
|