rea-agents 3.2.1 → 4.0.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 +183 -332
- package/bridge/ghidra/ReaGhidraBridge.java +561 -74
- package/bridge/hopper_bridge.py +70 -27
- package/bridge/native/ReaNativeUI.swift +157 -0
- package/dist/application/AnalysisContextQueries.js +19 -5
- package/dist/application/AnalysisSnapshotCache.js +30 -11
- package/dist/application/AppleAssetCatalogAnalysis.js +171 -0
- package/dist/application/ArtifactExtractionDestination.js +0 -12
- package/dist/application/ArtifactGraphConstruction.js +44 -11
- package/dist/application/ArtifactInventory/classify.js +7 -15
- package/dist/application/ArtifactInventory/hash.js +4 -2
- package/dist/application/ArtifactInventory/policy.js +2 -17
- package/dist/application/ArtifactInventory/reader.js +3 -3
- package/dist/application/ArtifactInventory/scanCanonical.js +2 -2
- package/dist/application/ArtifactInventory/scanReader.js +12 -4
- package/dist/application/ArtifactInventory/types.js +0 -3
- package/dist/application/BinarySession.js +28 -43
- package/dist/application/BinarySessionExecution.js +37 -1
- package/dist/application/BinaryTargetResolver.js +50 -4
- package/dist/application/BrowserEvidence.js +36 -7
- package/dist/application/BrowserObservationService.js +17 -44
- package/dist/application/BrowserScenarioCaptureService.js +2 -35
- package/dist/application/BrowserScenarioEvidence.js +13 -9
- package/dist/application/CapabilityClientRequirements.js +2 -11
- package/dist/application/CapabilityInventory.js +21 -35
- package/dist/application/ClientConfigurationDocument.js +84 -7
- package/dist/application/ClientRegistrationIdentity.js +32 -0
- package/dist/application/ClientRegistrationStatus.js +59 -6
- package/dist/application/DirectAnalysis.js +37 -58
- package/dist/application/DirectAnalysisStatus.js +4 -4
- package/dist/application/Doctor.js +89 -80
- package/dist/application/DoctorDiagnostics.js +2 -26
- package/dist/application/DoctorScope.js +8 -14
- package/dist/application/ElectronActiveEvidence.js +10 -27
- package/dist/application/ElectronActiveObservationService.js +9 -36
- package/dist/application/ElectronBoundaryAnalysis.js +2 -0
- package/dist/application/ElectronBoundaryGraphNative.js +1 -1
- package/dist/application/ElectronEvidence.js +8 -3
- package/dist/application/ElectronObservationService.js +9 -25
- package/dist/application/EnhancedLiteralTracing.js +4 -8
- package/dist/application/EnhancedTools.js +15 -35
- package/dist/application/FilesystemSnapshot.js +7 -8
- package/dist/application/JavaScriptApplicationEvidenceGraph.js +2 -1
- package/dist/application/JavaScriptApplicationWorkflowService.js +31 -7
- package/dist/application/JavaScriptArtifactAnalysis.js +6 -4
- package/dist/application/JavaScriptArtifactFiles.js +5 -0
- package/dist/application/JavaScriptArtifactPathResolution.js +179 -47
- package/dist/application/JavaScriptRuntimeObservationEvidence.js +6 -3
- package/dist/application/JavaScriptRuntimeObservationService.js +9 -25
- package/dist/application/JavaScriptRuntimeReconciliationService.js +45 -4
- package/dist/application/JavaScriptSemanticGraphAsyncProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphChildProcessProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphDataProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphFlowProjection.js +14 -5
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +27 -6
- package/dist/application/ManagedMemberComparisonService.js +19 -6
- package/dist/application/NativeApiInspection.js +2 -0
- package/dist/application/NativeCallRoutes.js +72 -0
- package/dist/application/NativeDispatchMetadataInspection.js +33 -0
- package/dist/application/NativeUiActionTrace.js +73 -49
- package/dist/application/NativeValueTrace.js +320 -0
- package/dist/application/ProcessCaptureCapability.js +32 -5
- package/dist/application/ProcessCaptureEnvironment.js +9 -26
- package/dist/application/ProcessCaptureError.js +1 -5
- package/dist/application/ProcessCaptureJournal.js +3 -40
- package/dist/application/ProcessCaptureLifecycle.js +102 -111
- package/dist/application/ProcessCli.js +18 -25
- package/dist/application/ProcessEvidence.js +5 -7
- package/dist/application/ProcessFilesystemEffects.js +36 -0
- package/dist/application/ProcessHarness.js +41 -120
- package/dist/application/ProcessNormalization.js +2 -17
- package/dist/application/ProcessScenarioRuntimeValidation.js +76 -0
- package/dist/application/ReferenceSourceImport.js +3 -4
- package/dist/application/Setup.js +236 -84
- package/dist/application/SetupClientConfiguration.js +14 -9
- package/dist/application/SetupPlan.js +138 -86
- package/dist/application/SetupSkill.js +0 -1
- package/dist/application/SupportedClients.js +102 -21
- package/dist/application/Uninstall.js +31 -20
- package/dist/application/Update.js +93 -0
- package/dist/application/UpdateMaintenance.js +108 -0
- package/dist/application/UpdateRuntime.js +126 -0
- package/dist/application/runtime.js +13 -2
- package/dist/artifacts/ArtifactPaths.js +6 -8
- package/dist/artifacts/ArtifactProvider.js +94 -41
- package/dist/artifacts/AsarArtifactReader.js +19 -4
- package/dist/artifacts/KeyedArchiveReader.js +110 -0
- package/dist/artifacts/MachOSliceArtifactReader.js +53 -5
- package/dist/artifacts/ZipArtifactReader.js +18 -1
- package/dist/browser/BrowserScenarioSecrets.js +28 -1
- package/dist/browser/CdpBrowserProvider.js +36 -15
- package/dist/browser/CdpCaptureDocuments.js +22 -8
- package/dist/browser/CdpCaptureEventHandlers.js +14 -5
- package/dist/browser/CdpCaptureEventHelpers.js +13 -0
- package/dist/browser/CdpCaptureEvents.js +10 -1
- package/dist/browser/CdpElectronInspection.js +5 -10
- package/dist/browser/CdpElectronProvider.js +1 -5
- package/dist/browser/CdpElectronScripts.js +1 -1
- package/dist/browser/CdpEndpoint.js +3 -2
- package/dist/browser/CdpObservationSession.js +14 -10
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpPageCaptureScripts.js +1 -1
- package/dist/browser/CdpSafeMetadata.js +5 -4
- package/dist/browser/CdpScreenshot.js +16 -5
- package/dist/browser/CdpTargetSession.js +25 -4
- package/dist/browser/CdpWebMcpDiscovery.js +93 -20
- package/dist/browser/JavaScriptRuntimeScope.js +28 -2
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +9 -8
- package/dist/browser/PlaywrightElectronActiveActions.js +3 -10
- package/dist/browser/PlaywrightElectronActiveProvider.js +5 -5
- package/dist/browser/PlaywrightScenarioActions.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +13 -25
- package/dist/browser/PlaywrightScenarioBrowser.js +28 -25
- package/dist/browser/PlaywrightScenarioEvents.js +82 -93
- package/dist/browser/PlaywrightScenarioSession.js +27 -123
- package/dist/browser/PngVisualDiff.js +22 -3
- package/dist/browser/V8InspectorCaptureProjection.js +7 -1
- package/dist/browser/V8InspectorProvider.js +60 -7
- package/dist/browser/WebSourceMapFetcher.js +99 -53
- package/dist/cli/artifactCommands.js +56 -12
- package/dist/cli/coreAnalysisCommands.js +110 -0
- package/dist/cli/managedCommands.js +1 -31
- package/dist/cli/setupCommands.js +16 -14
- package/dist/cli/utilityCommands.js +61 -4
- package/dist/cli.js +5 -7
- package/dist/cliApplicationCommands.js +0 -83
- package/dist/cliBrowserAdvancedCommands.js +7 -11
- package/dist/cliBrowserCommands.js +15 -23
- package/dist/cliBrowserContext.js +3 -24
- package/dist/cliBrowserScenarioCommands.js +2 -10
- package/dist/cliCommandNames.js +82 -7
- package/dist/cliElectronCommands.js +10 -36
- package/dist/cliJavaScriptRuntimeCommands.js +6 -30
- package/dist/cliJsonInput.js +4 -2
- package/dist/cliLogging.js +16 -7
- package/dist/cliObservationOptions.js +1 -1
- package/dist/cliOutput.js +2 -4
- package/dist/cliProcessCommands.js +6 -33
- package/dist/cliSetup.js +90 -160
- package/dist/config/environment.js +2 -78
- package/dist/config/parseConfig.js +18 -109
- package/dist/config/parsers.js +0 -23
- package/dist/contracts/applicationToolContracts.js +1 -118
- package/dist/contracts/artifactToolContracts.js +11 -19
- package/dist/contracts/browserScenarioToolContracts.js +1 -5
- package/dist/contracts/browserToolContracts.js +9 -16
- package/dist/contracts/electronToolContracts.js +5 -6
- package/dist/contracts/enhancedInputs.js +3 -2
- package/dist/contracts/errorSchemas.js +16 -40
- package/dist/contracts/functionWorkflowToolContracts.js +2 -2
- package/dist/contracts/javascriptApplicationWorkflowExamples.js +2 -2
- package/dist/contracts/javascriptRuntimeObservationToolContracts.js +4 -4
- package/dist/contracts/javascriptRuntimeReconciliationExample.js +1 -1
- package/dist/contracts/managedToolContracts.js +7 -4
- package/dist/contracts/managedWorkflowExamples.js +0 -22
- package/dist/contracts/managedWorkflowToolContracts.js +16 -31
- package/dist/contracts/nativeToolContracts.js +9 -0
- package/dist/contracts/promptContracts.js +6 -6
- package/dist/contracts/sessionToolSchemas.js +3 -3
- package/dist/contracts/toolContractExamples.js +4 -3
- package/dist/contracts/toolContracts.js +18 -7
- package/dist/contracts/toolEffects.js +34 -21
- package/dist/contracts/toolOutputSchemaGroups.js +18 -5
- package/dist/contracts/toolOutputSchemaPrimitives.js +9 -6
- package/dist/contracts/toolSchemaMetadata.js +5 -8
- package/dist/doctorRuntime.js +0 -41
- package/dist/domain/analysisErrorPresentation.js +4 -28
- package/dist/domain/analysisErrorProjection.js +33 -50
- package/dist/domain/analysisProfile.js +1 -1
- package/dist/domain/analysisSnapshot.js +77 -3
- package/dist/domain/androidApplication.js +5 -4
- package/dist/domain/appleApplication.js +5 -4
- package/dist/domain/appleAssetCatalog.js +127 -0
- package/dist/domain/artifactComparison.js +7 -11
- package/dist/domain/artifactGraph.js +8 -6
- package/dist/domain/artifactInspection.js +13 -12
- package/dist/domain/binaryTarget.js +23 -9
- package/dist/domain/browserObservation.js +43 -24
- package/dist/domain/browserObservationSchemas.js +2 -1
- package/dist/domain/browserScenario.js +7 -107
- package/dist/domain/browserScenarioCapture.js +0 -1
- package/dist/domain/browserScenarioCaptureValues.js +5 -4
- package/dist/domain/browserScenarioDiff.js +1 -3
- package/dist/domain/browserScenarioValues.js +16 -107
- package/dist/domain/bundleComparison.js +18 -17
- package/dist/domain/callPathSchemas.js +17 -7
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/comparisonSemantics.js +19 -0
- package/dist/domain/completionLedgerGeneration.js +3 -2
- package/dist/domain/conformancePackage.js +2 -1
- package/dist/domain/conformanceTrustGate.js +3 -5
- package/dist/domain/customProtocolCapture.js +2 -2
- package/dist/domain/digests.js +30 -0
- package/dist/domain/dosMz.js +83 -0
- package/dist/domain/electronActiveObservation.js +7 -5
- package/dist/domain/electronObservation.js +3 -2
- package/dist/domain/electronStaticAnalysisNative.js +15 -6
- package/dist/domain/emptyArraySchema.js +3 -0
- package/dist/domain/errors.js +10 -28
- package/dist/domain/evidence.js +5 -3
- package/dist/domain/evidenceCompletionLedger.js +3 -2
- package/dist/domain/functionComparisonNormalization.js +24 -18
- package/dist/domain/functionComparisonResults.js +3 -7
- package/dist/domain/functionComparisonSchemas.js +3 -2
- package/dist/domain/hopperValues.js +108 -8
- package/dist/domain/javascriptApplicationAnalysis.js +4 -7
- package/dist/domain/javascriptApplicationEvidenceSchemas.js +4 -3
- package/dist/domain/javascriptApplicationGraphSchemas.js +8 -7
- package/dist/domain/javascriptApplicationVersionComparisonSchemas.js +9 -7
- package/dist/domain/javascriptApplicationVersionItems.js +12 -18
- package/dist/domain/javascriptAstValues.js +4 -0
- package/dist/domain/javascriptExportShapeComparison.js +1 -6
- package/dist/domain/javascriptExportShapeComparisonSchemas.js +6 -10
- package/dist/domain/javascriptExportShapeVariants.js +15 -2
- package/dist/domain/javascriptFeatureTraceSchemas.js +8 -7
- package/dist/domain/javascriptRuntimeObservation.js +14 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +8 -0
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +4 -2
- package/dist/domain/javascriptRuntimeReconciliationResult.js +6 -4
- package/dist/domain/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +19 -18
- package/dist/domain/javascriptRuntimeStaticCandidates.js +18 -6
- package/dist/domain/javascriptSemanticAnalysis.js +57 -19
- package/dist/domain/javascriptSemanticAsyncEffects.js +39 -40
- package/dist/domain/javascriptSemanticCalls.js +46 -27
- package/dist/domain/javascriptSemanticChildProcesses.js +43 -50
- package/dist/domain/javascriptSemanticDataEffectHelpers.js +91 -18
- package/dist/domain/javascriptSemanticDataEffects.js +22 -10
- package/dist/domain/javascriptSemanticGraphSchemas.js +8 -6
- package/dist/domain/javascriptSemanticObjects.js +13 -3
- package/dist/domain/javascriptSemanticProjection.js +144 -38
- package/dist/domain/javascriptSemanticPromises.js +14 -27
- package/dist/domain/javascriptSemanticQuerySchemas.js +6 -9
- package/dist/domain/javascriptSemanticResources.js +2 -5
- package/dist/domain/javascriptSemanticState.js +4 -0
- package/dist/domain/javascriptSemanticTraceSchemas.js +2 -1
- package/dist/domain/javascriptSemanticTraversal.js +13 -5
- package/dist/domain/javascriptSemanticValues.js +10 -9
- package/dist/domain/javascriptSourceParser.js +5 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +8 -5
- package/dist/domain/javascriptStaticAnalysisHelpers.js +16 -7
- package/dist/domain/keyedArchive.js +181 -0
- package/dist/domain/managedApplicationGraph.js +4 -3
- package/dist/domain/managedArtifact.js +2 -1
- package/dist/domain/managedMemberComparison.js +18 -13
- package/dist/domain/managedMemberComparisonCoverage.js +2 -1
- package/dist/domain/managedMemberComparisonItems.js +27 -7
- package/dist/domain/managedMemberComparisonMatch.js +22 -6
- package/dist/domain/managedNativeVerificationMatch.js +2 -2
- package/dist/domain/managedNativeVerificationSchemas.js +7 -5
- package/dist/domain/managedReconstruction.js +6 -5
- package/dist/domain/nativeApiBoundary.js +7 -0
- package/dist/domain/nativeDataType.js +51 -0
- package/dist/domain/nativeInspection.js +0 -1
- package/dist/domain/nativeInstruction.js +82 -0
- package/dist/domain/nativeInvestigationGraph.js +9 -5
- package/dist/domain/nativeUiObservation.js +123 -0
- package/dist/domain/nativeValueFlow.js +17 -0
- package/dist/domain/nativeValueTrace.js +64 -0
- package/dist/domain/objcSwiftMetadata.js +39 -0
- package/dist/domain/peInspection.js +1 -0
- package/dist/domain/processCapture.js +5 -55
- package/dist/domain/processCaptureExample.js +0 -9
- package/dist/domain/processCaptureValidation.js +13 -144
- package/dist/domain/processComparison.js +3 -25
- package/dist/domain/processObservation.js +0 -29
- package/dist/domain/processScenario.js +28 -228
- package/dist/domain/processTraceDimensionProjection.js +0 -15
- package/dist/domain/processTraceEvaluation.js +0 -6
- package/dist/domain/protocolCapture.js +8 -36
- package/dist/domain/reconstructionCoverage.js +3 -2
- package/dist/domain/reconstructionObligationLedgerSchemas.js +4 -12
- package/dist/domain/reconstructionReadinessSchemas.js +4 -3
- package/dist/domain/reconstructionVerification.js +2 -1
- package/dist/domain/reconstructionVerificationSchemas.js +6 -13
- package/dist/domain/referenceSourceClassification.js +0 -110
- package/dist/domain/referenceSourceGraph.js +15 -5
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/runtimeIdentification.js +6 -5
- package/dist/domain/sourceMapContents.js +5 -0
- package/dist/domain/sourceToBundleComparison.js +3 -10
- package/dist/domain/sourceToBundleComparisonSchemas.js +7 -6
- package/dist/domain/sourceToBundleSignals.js +9 -3
- package/dist/domain/staticRuntimeCorrelation.js +5 -11
- package/dist/domain/webBundleAnalysis.js +17 -9
- package/dist/domain/webBundleAnalyzer.js +1 -1
- package/dist/domain/webCaptureDiff.js +5 -11
- package/dist/domain/webCaptureDiffSchemas.js +2 -1
- package/dist/domain/webMcpDiscovery.js +2 -1
- package/dist/dotnet/ManagedMemberInspectorCore.js +15 -7
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +57 -40
- package/dist/dotnet/ManagedMemberRows.js +2 -0
- package/dist/dotnet/ManagedMethodBodyReader.js +15 -8
- package/dist/dotnet/ManagedPeReader.js +2 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +15 -5
- package/dist/ghidra/GhidraClient.js +38 -8
- package/dist/ghidra/GhidraFunctionValues.js +56 -20
- package/dist/ghidra/GhidraInstallation.js +7 -4
- package/dist/ghidra/GhidraInventoryValues.js +44 -9
- package/dist/ghidra/GhidraLauncher.js +18 -3
- package/dist/ghidra/GhidraProvider.js +23 -2
- package/dist/ghidra/GhidraRequestQueue.js +45 -4
- package/dist/ghidra/GhidraSessionValues.js +5 -0
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperProvider.js +29 -6
- package/dist/hopper/HopperTargetLease.js +18 -4
- package/dist/logger.js +0 -13
- package/dist/main/messages.js +0 -1
- package/dist/main/reload.js +3 -32
- package/dist/main/shutdown.js +1 -2
- package/dist/main/transport.js +0 -17
- package/dist/main.js +0 -10
- package/dist/native/AppleDispatchMetadata.js +582 -0
- package/dist/native/AppleObjcProtocols.js +88 -0
- package/dist/native/AppleSwiftVtables.js +86 -0
- package/dist/native/CommandRunner.js +1 -1
- package/dist/native/NativeHostCapabilities.js +23 -0
- package/dist/native/NativeMacOSProvider.js +61 -9
- package/dist/native/NativeMachoInspection.js +39 -6
- package/dist/native/NativeUiHelperRuntime.js +42 -0
- package/dist/native/NativeUiObservation.js +174 -0
- package/dist/native/parsers/codesign.js +4 -1
- package/dist/native/parsers/dyldInfo.js +51 -25
- package/dist/native/parsers/lipo.js +13 -4
- package/dist/native/parsers/otool.js +84 -39
- package/dist/native/parsers/plist.js +2 -1
- package/dist/process/ExecFileOutput.js +5 -1
- package/dist/process/ProcessOwnership.js +69 -33
- package/dist/process/ProcessOwnershipObservation.js +31 -12
- package/dist/process/ProviderProcess.js +4 -2
- package/dist/reference/ReferenceSourceReaderEntries.js +48 -31
- package/dist/reference/ReferenceSourceReaderErrors.js +24 -0
- package/dist/reference/ReferenceSourceReaderFile.js +11 -5
- package/dist/reference/ReferenceSourceReaderValidate.js +22 -8
- package/dist/server/createServer.js +7 -62
- package/dist/server/registerApplicationTools/helpers.js +2 -9
- package/dist/server/registerApplicationTools.js +0 -4
- package/dist/server/registerArtifactComparisonTool.js +1 -1
- package/dist/server/registerBrowserScenarioTool.js +4 -2
- package/dist/server/registerBrowserTools.js +7 -7
- package/dist/server/registerBundleComparisonTool.js +1 -1
- package/dist/server/registerCloseLifecycleTool.js +1 -1
- package/dist/server/registerElectronTools.js +10 -4
- package/dist/server/registerEnhancedTools.js +20 -12
- package/dist/server/registerEvidenceTools.js +4 -28
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools.js +6 -6
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -2
- package/dist/server/registerManagedTools.js +28 -14
- package/dist/server/registerManagedWorkflowTools.js +0 -2
- package/dist/server/registerProcessComparisonTool.js +1 -3
- package/dist/server/registerSessionRecordTools.js +9 -9
- package/dist/server/registerSessionStatusTool.js +1 -1
- package/dist/server/registerSessionTools.js +28 -57
- package/dist/server/sessionAvailabilityPolicy.js +2 -3
- package/dist/server/sessionToolPolicies.js +0 -4
- package/dist/server/toolResult.js +8 -10
- package/package.json +32 -22
- package/skills/reverse-engineer-anything/SKILL.md +15 -11
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +3 -2
- package/skills/reverse-engineer-anything/references/javascript-applications.md +3 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +8 -6
- package/skills/reverse-engineer-anything/references/runtime-observation.md +15 -11
- package/dist/application/CommandShimReplay.js +0 -152
- package/dist/application/ConfiguredRoots.js +0 -19
- package/dist/application/InstrumentedJavaScriptReplayHost.js +0 -36
- package/dist/application/JavaScriptReplayPermission.js +0 -16
- package/dist/application/JavaScriptReplayPlanning.js +0 -207
- package/dist/application/JavaScriptReplayService.js +0 -274
- package/dist/application/LoopbackReplay.js +0 -389
- package/dist/application/LoopbackReplayRecorder.js +0 -129
- package/dist/application/ManagedRuntimeCorrelationService.js +0 -104
- package/dist/application/NodeRuntimeCharacterizationService.js +0 -191
- package/dist/application/PermissionAuthority.js +0 -268
- package/dist/application/PermissionConfiguration.js +0 -26
- package/dist/application/PermissionFailure.js +0 -5
- package/dist/application/ProcessCaptureAuthority.js +0 -24
- package/dist/application/ProcessCapturePermission.js +0 -13
- package/dist/application/ProcessCheckpoints.js +0 -178
- package/dist/application/ProcessReactiveCoordinator.js +0 -223
- package/dist/application/ProcessReactiveEffects.js +0 -153
- package/dist/application/ProcessReactiveHarness.js +0 -106
- package/dist/application/ProcessReactiveObservations.js +0 -105
- package/dist/application/ProjectPermissionStore.js +0 -199
- package/dist/application/RuntimeExecutableDiagnostics.js +0 -198
- package/dist/application/Upgrade.js +0 -134
- package/dist/browser/SensitiveTextCapture.js +0 -8
- package/dist/cliPolicyCommands.js +0 -185
- package/dist/config/browserScenario.js +0 -77
- package/dist/config/electronAutomation.js +0 -35
- package/dist/config/javascriptReplay.js +0 -41
- package/dist/config/managedRuntime.js +0 -25
- package/dist/config/passiveObservation.js +0 -87
- package/dist/config/permissions.js +0 -23
- package/dist/config/processCapture.js +0 -47
- package/dist/contracts/replayMachineExample.js +0 -37
- package/dist/domain/javascriptExportInstrumentation.js +0 -95
- package/dist/domain/javascriptReplay.js +0 -360
- package/dist/domain/managedRuntimeCorrelation.js +0 -181
- package/dist/domain/nodeRuntimeCharacterization.js +0 -63
- package/dist/domain/permissionPolicy.js +0 -176
- package/dist/domain/processCaptureReactiveSchema.js +0 -68
- package/dist/domain/processCaptureReactiveValidation.js +0 -180
- package/dist/domain/processReactiveCheckpointDataflow.js +0 -32
- package/dist/domain/processReactiveMatching.js +0 -196
- package/dist/domain/processReactiveRuntime.js +0 -116
- package/dist/domain/processReactiveScenario.js +0 -296
- package/dist/domain/processReactiveScenarioPreflight.js +0 -95
- package/dist/domain/processReactiveTransition.js +0 -187
- package/dist/domain/replayMachine.js +0 -320
- package/dist/domain/replayMachineRun.js +0 -168
- package/dist/domain/replayMachineRuntime.js +0 -296
- package/dist/domain/replayMachineValues.js +0 -84
- package/dist/domain/runtimeCharacterization.js +0 -84
- package/dist/replay/JavaScriptReplayWorker.js +0 -382
- package/dist/replay/JavaScriptReplayWorkerTypes.js +0 -1
- package/dist/replay/LinuxJavaScriptReplayRunner.js +0 -216
- package/dist/replay/LinuxJavaScriptReplaySandbox.js +0 -121
- package/dist/replay/LinuxRuntimeClosure.js +0 -44
- package/dist/replay/LinuxSeccompPolicy.js +0 -40
- package/dist/replay/ReplayOutcome.js +0 -104
- package/dist/replay/ReplayProcessLifecycle.js +0 -96
- package/dist/replay/ReplaySeccompFile.js +0 -29
- package/dist/replay/ReplayWorkerProtocol.js +0 -58
- package/dist/replay/SystemJavaScriptReplayHost.js +0 -153
- package/dist/server/ProcessCaptureElicitation.js +0 -153
- package/dist/server/registerApplicationTools/characterization.js +0 -46
- package/dist/server/registerApplicationTools/controlledReplay.js +0 -31
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +0 -29
- package/dist/server/registerReplayMachineTool.js +0 -14
- package/skills/reverse-engineer-anything/references/controlled-replay.md +0 -12
|
@@ -13,7 +13,7 @@ const EXTENSIONS = [
|
|
|
13
13
|
const NODE_BUILTINS = new Set(builtinModules.map((name) => name.replace(/^node:/u, "")));
|
|
14
14
|
/** Resolve one declaration under its exact syntax/metadata context. */
|
|
15
15
|
export const resolveArtifactPathByContext = (input) => resolvePackagePath(input, new Set());
|
|
16
|
-
const resolvePackagePath = (input, packageChain) => {
|
|
16
|
+
const resolvePackagePath = (input, packageChain, mode = "full") => {
|
|
17
17
|
const rejected = rejectDeclaration(input);
|
|
18
18
|
if (rejected !== null)
|
|
19
19
|
return rejected;
|
|
@@ -23,7 +23,12 @@ const resolvePackagePath = (input, packageChain) => {
|
|
|
23
23
|
const confined = confineCandidate(input, candidate);
|
|
24
24
|
if (typeof confined !== "string")
|
|
25
25
|
return confined;
|
|
26
|
-
const resolved =
|
|
26
|
+
const resolved = mode === "files-and-index"
|
|
27
|
+
? (resolveFileCandidates(input, [
|
|
28
|
+
...fileCandidates(confined),
|
|
29
|
+
...indexCandidates(confined),
|
|
30
|
+
]) ?? notFoundCandidate())
|
|
31
|
+
: resolveCandidate(input, confined, packageChain);
|
|
27
32
|
return outcome(input, resolved);
|
|
28
33
|
};
|
|
29
34
|
const rejectDeclaration = (input) => {
|
|
@@ -36,15 +41,20 @@ const rejectDeclaration = (input) => {
|
|
|
36
41
|
return unresolvedOutcome(input, "rejected", [
|
|
37
42
|
"NUL and backslash path syntax are not admitted for canonical artifact paths.",
|
|
38
43
|
]);
|
|
39
|
-
if (
|
|
44
|
+
if (!admitsCanonicalPathSyntax(declared))
|
|
40
45
|
return unresolvedOutcome(input, "rejected", [
|
|
41
46
|
"Encoded dot or separator bytes are rejected before artifact path resolution.",
|
|
42
47
|
]);
|
|
43
48
|
return null;
|
|
44
49
|
};
|
|
50
|
+
/** Path syntax admitted for a canonical artifact path. */
|
|
51
|
+
const admitsCanonicalPathSyntax = (value) => !value.includes("\0") &&
|
|
52
|
+
!value.includes("\\") &&
|
|
53
|
+
!/%(?:2e|2f|5c)/iu.test(value);
|
|
45
54
|
const contextualCandidate = (input) => {
|
|
46
55
|
const { context } = input;
|
|
47
|
-
const declared = context === "
|
|
56
|
+
const declared = context === "html-reference" ||
|
|
57
|
+
(context === "module-specifier" && input.moduleKind !== "require")
|
|
48
58
|
? stripQueryAndFragment(input.declaredPath)
|
|
49
59
|
: input.declaredPath;
|
|
50
60
|
if (context === "html-reference")
|
|
@@ -103,7 +113,11 @@ const barePackageName = (specifier) => {
|
|
|
103
113
|
: null;
|
|
104
114
|
return segments[0] === "" ? null : (segments[0] ?? null);
|
|
105
115
|
};
|
|
106
|
-
const hasContainerCandidate = (files, candidate, containerSha256) => [
|
|
116
|
+
const hasContainerCandidate = (files, candidate, containerSha256) => [
|
|
117
|
+
...fileCandidates(candidate),
|
|
118
|
+
...indexCandidates(candidate),
|
|
119
|
+
posix.join(candidate, "package.json"),
|
|
120
|
+
].some((path) => {
|
|
107
121
|
const file = files.get(path);
|
|
108
122
|
return (file !== undefined &&
|
|
109
123
|
(containerSha256 === undefined ||
|
|
@@ -111,25 +125,49 @@ const hasContainerCandidate = (files, candidate, containerSha256) => [...directC
|
|
|
111
125
|
});
|
|
112
126
|
const htmlCandidate = (input) => {
|
|
113
127
|
const declared = stripQueryAndFragment(input.declaredPath);
|
|
114
|
-
if (hasScheme(declared))
|
|
128
|
+
if (hasScheme(declared) || declared.startsWith("//"))
|
|
115
129
|
return unresolvedOutcome(input, "external", [
|
|
116
130
|
"External HTML references are not mapped to local artifact assets.",
|
|
117
131
|
]);
|
|
132
|
+
const rawBase = input.htmlBaseHref;
|
|
133
|
+
const base = rawBase === undefined || rawBase === null
|
|
134
|
+
? rawBase
|
|
135
|
+
: stripQueryAndFragment(rawBase);
|
|
136
|
+
if (base !== undefined &&
|
|
137
|
+
base !== null &&
|
|
138
|
+
(hasScheme(base) || base.startsWith("//")))
|
|
139
|
+
return unresolvedOutcome(input, "external", [
|
|
140
|
+
"The document base href is external, so its script reference is not a local artifact path.",
|
|
141
|
+
]);
|
|
118
142
|
if (declared.startsWith("/"))
|
|
119
143
|
return declared.slice(1);
|
|
120
|
-
const base = input.htmlBaseHref;
|
|
121
144
|
if (base === undefined || base === null || base === "")
|
|
122
145
|
return posix.join(posix.dirname(input.sourcePath), declared);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
146
|
+
// A local base href is a second untrusted path input; apply the same
|
|
147
|
+
// admission rules a declared path gets so it cannot smuggle traversal or
|
|
148
|
+
// separator syntax past canonicalization.
|
|
149
|
+
if (!admitsCanonicalPathSyntax(base))
|
|
150
|
+
return unresolvedOutcome(input, "rejected", [
|
|
151
|
+
"The document base href uses NUL, backslash, or encoded dot and separator bytes that are not admitted for canonical artifact paths.",
|
|
126
152
|
]);
|
|
127
153
|
const basePath = base.startsWith("/")
|
|
128
154
|
? base.slice(1)
|
|
129
155
|
: posix.join(posix.dirname(input.sourcePath), base);
|
|
130
|
-
|
|
131
|
-
return posix.join(baseDirectory, declared);
|
|
156
|
+
return posix.join(htmlBaseDirectory(base, basePath), declared);
|
|
132
157
|
};
|
|
158
|
+
/**
|
|
159
|
+
* The directory a relative HTML reference resolves against. A base path
|
|
160
|
+
* ending in "/" or in a "." or ".." segment is already a directory, because a
|
|
161
|
+
* relative reference resolves against the base URL's directory and those
|
|
162
|
+
* segments are dropped rather than stepped through.
|
|
163
|
+
*/
|
|
164
|
+
const htmlBaseDirectory = (base, basePath) => base.endsWith("/") ||
|
|
165
|
+
base.endsWith("/.") ||
|
|
166
|
+
base.endsWith("/..") ||
|
|
167
|
+
base === "." ||
|
|
168
|
+
base === ".."
|
|
169
|
+
? basePath
|
|
170
|
+
: posix.dirname(basePath);
|
|
133
171
|
const confineCandidate = (input, candidate) => {
|
|
134
172
|
const normalized = posix.normalize(candidate);
|
|
135
173
|
if (normalized === ".." ||
|
|
@@ -141,20 +179,17 @@ const confineCandidate = (input, candidate) => {
|
|
|
141
179
|
return normalized === "." ? "" : normalized;
|
|
142
180
|
};
|
|
143
181
|
const resolveCandidate = (input, candidate, packageChain) => {
|
|
182
|
+
const direct = resolveFileCandidates(input, fileCandidates(candidate));
|
|
183
|
+
if (direct !== null)
|
|
184
|
+
return direct;
|
|
144
185
|
const source = input.files.get(input.sourcePath);
|
|
145
|
-
for (const path of directCandidates(candidate)) {
|
|
146
|
-
const target = input.files.get(path);
|
|
147
|
-
if (target !== undefined &&
|
|
148
|
-
(source === undefined ||
|
|
149
|
-
target.container_sha256 === source.container_sha256))
|
|
150
|
-
return { resolvedPath: path, status: "resolved", limitations: [] };
|
|
151
|
-
}
|
|
152
186
|
const packagePath = posix.join(candidate, "package.json");
|
|
153
187
|
const packageFile = input.files.get(packagePath);
|
|
154
188
|
if (packageFile === undefined ||
|
|
155
189
|
(source !== undefined &&
|
|
156
190
|
packageFile.container_sha256 !== source.container_sha256))
|
|
157
|
-
return
|
|
191
|
+
return (resolveFileCandidates(input, indexCandidates(candidate)) ??
|
|
192
|
+
notFoundCandidate());
|
|
158
193
|
if (!packageFile.text.included)
|
|
159
194
|
return {
|
|
160
195
|
resolvedPath: null,
|
|
@@ -163,63 +198,103 @@ const resolveCandidate = (input, candidate, packageChain) => {
|
|
|
163
198
|
`Directory package metadata ${packagePath} was inventoried but its text is unavailable: ${packageFile.text.reason}.`,
|
|
164
199
|
],
|
|
165
200
|
};
|
|
166
|
-
|
|
201
|
+
const main = packageEntry(packageFile.text.value, input.moduleKind, input.context === "module-specifier" &&
|
|
202
|
+
!input.declaredPath.startsWith(".") &&
|
|
203
|
+
!input.declaredPath.startsWith("/") &&
|
|
204
|
+
!hasScheme(input.declaredPath));
|
|
205
|
+
if (main.status === "invalid")
|
|
167
206
|
return {
|
|
168
207
|
resolvedPath: null,
|
|
169
208
|
status: "unavailable",
|
|
170
209
|
limitations: [
|
|
171
|
-
`Directory package
|
|
210
|
+
`Directory package metadata ${packagePath} is not valid package JSON.`,
|
|
172
211
|
],
|
|
173
212
|
};
|
|
174
|
-
|
|
175
|
-
|
|
213
|
+
if (main.status === "unmatched")
|
|
214
|
+
return {
|
|
215
|
+
resolvedPath: null,
|
|
216
|
+
status: "external",
|
|
217
|
+
limitations: [
|
|
218
|
+
`Directory package metadata ${packagePath} declares no exports target for the active conditions; it declares ${main.declared.join(", ")}.`,
|
|
219
|
+
],
|
|
220
|
+
};
|
|
221
|
+
if (packageChain.has(packagePath)) {
|
|
176
222
|
return {
|
|
177
223
|
resolvedPath: null,
|
|
178
224
|
status: "unavailable",
|
|
179
225
|
limitations: [
|
|
180
|
-
`Directory package
|
|
226
|
+
`Directory package entrypoint cycle includes ${packagePath}.`,
|
|
181
227
|
],
|
|
182
228
|
};
|
|
229
|
+
}
|
|
183
230
|
if (main.status === "missing")
|
|
184
|
-
return
|
|
185
|
-
|
|
231
|
+
return (resolveFileCandidates(input, indexCandidates(candidate)) ??
|
|
232
|
+
notFoundCandidate());
|
|
233
|
+
const entryInput = {
|
|
186
234
|
declaredPath: main.value,
|
|
187
235
|
sourcePath: packagePath,
|
|
188
236
|
context: "package-entrypoint",
|
|
189
237
|
files: input.files,
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
238
|
+
};
|
|
239
|
+
const chain = new Set([...packageChain, packagePath]);
|
|
240
|
+
if (main.source === "legacy") {
|
|
241
|
+
const entry = resolvePackagePath(entryInput, chain, "files-and-index");
|
|
242
|
+
if (entry.resolution_status !== "not-found")
|
|
243
|
+
return candidateOutcome(entry);
|
|
244
|
+
const index = resolveFileCandidates(input, indexCandidates(candidate));
|
|
245
|
+
if (index !== null)
|
|
246
|
+
return index;
|
|
247
|
+
}
|
|
248
|
+
// Preserve recursive artifact package lookup only after legacy file/index fallbacks.
|
|
249
|
+
return candidateOutcome(resolvePackagePath(entryInput, chain));
|
|
250
|
+
};
|
|
251
|
+
const candidateOutcome = (nested) => nested.resolution_status === "resolved"
|
|
252
|
+
? {
|
|
253
|
+
resolvedPath: nested.resolved_path,
|
|
254
|
+
status: nested.resolution_status,
|
|
255
|
+
limitations: nested.limitations,
|
|
256
|
+
}
|
|
257
|
+
: {
|
|
258
|
+
resolvedPath: null,
|
|
259
|
+
status: nested.resolution_status,
|
|
260
|
+
limitations: nested.limitations,
|
|
261
|
+
};
|
|
262
|
+
const resolveFileCandidates = (input, candidates) => {
|
|
263
|
+
const source = input.files.get(input.sourcePath);
|
|
264
|
+
for (const path of candidates) {
|
|
265
|
+
const target = input.files.get(path);
|
|
266
|
+
if (target !== undefined &&
|
|
267
|
+
(source === undefined ||
|
|
268
|
+
target.container_sha256 === source.container_sha256))
|
|
269
|
+
return { resolvedPath: path, status: "resolved", limitations: [] };
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
202
272
|
};
|
|
203
|
-
const
|
|
273
|
+
const fileCandidates = (candidate) => [
|
|
204
274
|
candidate,
|
|
205
275
|
...EXTENSIONS.map((extension) => `${candidate}${extension}`),
|
|
206
|
-
...EXTENSIONS.map((extension) => posix.join(candidate, `index${extension}`)),
|
|
207
276
|
];
|
|
208
|
-
const
|
|
277
|
+
const indexCandidates = (candidate) => EXTENSIONS.map((extension) => posix.join(candidate, `index${extension}`));
|
|
278
|
+
const packageEntry = (text, moduleKind, useExports) => {
|
|
209
279
|
try {
|
|
210
280
|
const value = JSON.parse(text);
|
|
211
281
|
if (typeof value !== "object" || value === null)
|
|
212
282
|
return { status: "invalid" };
|
|
213
283
|
const rawExports = Reflect.get(value, "exports");
|
|
214
|
-
if (rawExports !== undefined)
|
|
215
|
-
|
|
284
|
+
if (useExports && rawExports !== undefined && rawExports !== null) {
|
|
285
|
+
const exported = packageExport(rawExports, moduleKind);
|
|
286
|
+
return exported.status === "value"
|
|
287
|
+
? { ...exported, source: "exports" }
|
|
288
|
+
: exported;
|
|
289
|
+
}
|
|
216
290
|
const preferred = moduleKind === "import"
|
|
217
291
|
? [Reflect.get(value, "module"), Reflect.get(value, "main")]
|
|
218
292
|
: [Reflect.get(value, "main"), Reflect.get(value, "module")];
|
|
219
293
|
const entry = preferred.find((candidate) => candidate !== undefined);
|
|
220
294
|
if (entry === undefined)
|
|
221
295
|
return { status: "missing" };
|
|
222
|
-
|
|
296
|
+
const legacy = packagePathValue(entry);
|
|
297
|
+
return legacy.status === "value" ? { ...legacy, source: "legacy" } : legacy;
|
|
223
298
|
}
|
|
224
299
|
catch {
|
|
225
300
|
return { status: "invalid" };
|
|
@@ -235,9 +310,66 @@ const packageExport = (value, moduleKind) => {
|
|
|
235
310
|
return packagePathValue(root);
|
|
236
311
|
if (typeof root !== "object" || root === null || Array.isArray(root))
|
|
237
312
|
return { status: "invalid" };
|
|
238
|
-
const
|
|
239
|
-
|
|
313
|
+
const flattened = exportTargets(root, packageExportConditions(moduleKind));
|
|
314
|
+
if (flattened.kind === "invalid")
|
|
315
|
+
return { status: "invalid" };
|
|
316
|
+
const first = flattened.kind === "unmatched" ? undefined : flattened.values[0];
|
|
317
|
+
return first === undefined
|
|
318
|
+
? { status: "unmatched", declared: Object.keys(root) }
|
|
319
|
+
: { status: "value", value: first };
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Resolve a target in Node's declared order. Explicit null blocks an active
|
|
323
|
+
* condition, whereas an unmatched nested object permits the next condition.
|
|
324
|
+
* An array skips unmatched and invalid entries, stops at its first string, and
|
|
325
|
+
* preserves the final invalid-versus-null refusal if no string is selected.
|
|
326
|
+
*/
|
|
327
|
+
const exportTargets = (value, conditions) => {
|
|
328
|
+
if (typeof value === "string")
|
|
329
|
+
return value.startsWith("./")
|
|
330
|
+
? { kind: "targets", values: [value] }
|
|
331
|
+
: { kind: "invalid" };
|
|
332
|
+
if (value === null)
|
|
333
|
+
return { kind: "targets", values: [] };
|
|
334
|
+
if (Array.isArray(value)) {
|
|
335
|
+
let invalid = false;
|
|
336
|
+
for (const entry of value) {
|
|
337
|
+
const nested = exportTargets(entry, conditions);
|
|
338
|
+
if (nested.kind === "invalid") {
|
|
339
|
+
invalid = true;
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
if (nested.kind === "unmatched")
|
|
343
|
+
continue;
|
|
344
|
+
invalid = false;
|
|
345
|
+
if (nested.values.length > 0)
|
|
346
|
+
return nested;
|
|
347
|
+
}
|
|
348
|
+
return invalid ? { kind: "invalid" } : { kind: "targets", values: [] };
|
|
349
|
+
}
|
|
350
|
+
if (typeof value !== "object")
|
|
351
|
+
return { kind: "invalid" };
|
|
352
|
+
for (const [condition, target] of Object.entries(value)) {
|
|
353
|
+
if (!conditions.has(condition))
|
|
354
|
+
continue;
|
|
355
|
+
const nested = exportTargets(target, conditions);
|
|
356
|
+
if (nested.kind !== "unmatched")
|
|
357
|
+
return nested;
|
|
358
|
+
}
|
|
359
|
+
return { kind: "unmatched" };
|
|
240
360
|
};
|
|
361
|
+
/**
|
|
362
|
+
* Node selects an exports target by walking the declared keys in order and
|
|
363
|
+
* taking the first whose condition is active for the calling resolver.
|
|
364
|
+
* "default" is always active, and "node" plus "node-addons" are active for the
|
|
365
|
+
* built-in resolver that owns installed-package imports and requires.
|
|
366
|
+
*/
|
|
367
|
+
const packageExportConditions = (moduleKind) => new Set([
|
|
368
|
+
"node",
|
|
369
|
+
"node-addons",
|
|
370
|
+
...(moduleKind === undefined ? [] : [moduleKind]),
|
|
371
|
+
"default",
|
|
372
|
+
]);
|
|
241
373
|
const packagePathValue = (value) => typeof value === "string" && value.length > 0
|
|
242
374
|
? { status: "value", value }
|
|
243
375
|
: { status: "invalid" };
|
|
@@ -13,11 +13,14 @@ export const createJavaScriptRuntimeObservationEvidence = (operation, input, res
|
|
|
13
13
|
authority: "external-service",
|
|
14
14
|
environment: {
|
|
15
15
|
id: `${result.runtime.product}@${result.runtime.protocol_version}`,
|
|
16
|
-
platform:
|
|
17
|
-
architecture:
|
|
16
|
+
platform: "unknown",
|
|
17
|
+
architecture: "unknown",
|
|
18
18
|
isolation: "none",
|
|
19
19
|
},
|
|
20
|
-
limitations:
|
|
20
|
+
limitations: [
|
|
21
|
+
...result.limitations,
|
|
22
|
+
"Runtime host platform and architecture were not observed.",
|
|
23
|
+
],
|
|
21
24
|
});
|
|
22
25
|
const parameters = (input) => ({
|
|
23
26
|
inspector_endpoint: input.inspector_endpoint,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { projectPermissionFailure } from "./PermissionFailure.js";
|
|
2
1
|
import { createJavaScriptRuntimeObservationEvidence } from "./JavaScriptRuntimeObservationEvidence.js";
|
|
3
2
|
import { AnalysisCapabilityUnavailableError, } from "../domain/errors.js";
|
|
4
3
|
import { err, ok } from "../domain/result.js";
|
|
5
|
-
/**
|
|
6
|
-
export const listJavaScriptRuntimeTargets = async (provider,
|
|
7
|
-
const ready =
|
|
4
|
+
/** List targets exposed by the explicitly selected loopback Inspector. */
|
|
5
|
+
export const listJavaScriptRuntimeTargets = async (provider, input, options = {}) => {
|
|
6
|
+
const ready = requireProvider(provider, "list_javascript_runtime_targets");
|
|
8
7
|
if (!ready.ok)
|
|
9
8
|
return ready;
|
|
10
9
|
const result = await ready.value.listTargets(input, options);
|
|
@@ -12,9 +11,9 @@ export const listJavaScriptRuntimeTargets = async (provider, authority, input, o
|
|
|
12
11
|
? ok(createJavaScriptRuntimeObservationEvidence("list_javascript_runtime_targets", input, result.value, ready.value.identity()))
|
|
13
12
|
: result;
|
|
14
13
|
};
|
|
15
|
-
/**
|
|
16
|
-
export const observeJavaScriptRuntime = async (provider,
|
|
17
|
-
const ready =
|
|
14
|
+
/** Observe one attach-only Inspector target selected by the request. */
|
|
15
|
+
export const observeJavaScriptRuntime = async (provider, input, options = {}) => {
|
|
16
|
+
const ready = requireProvider(provider, "observe_javascript_runtime");
|
|
18
17
|
if (!ready.ok)
|
|
19
18
|
return ready;
|
|
20
19
|
const result = await ready.value.observe(input, options);
|
|
@@ -22,21 +21,6 @@ export const observeJavaScriptRuntime = async (provider, authority, input, optio
|
|
|
22
21
|
? ok(createJavaScriptRuntimeObservationEvidence("observe_javascript_runtime", input, result.value, ready.value.identity()))
|
|
23
22
|
: result;
|
|
24
23
|
};
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const authorized = await authority.authorize({
|
|
29
|
-
capability: "v8_inspector_observe",
|
|
30
|
-
roots: [],
|
|
31
|
-
executables: [],
|
|
32
|
-
environment_names: [],
|
|
33
|
-
network: "loopback",
|
|
34
|
-
mount: false,
|
|
35
|
-
operation_identity: `${operation}:${"target_id" in input ? input.target_id : input.inspector_endpoint}`,
|
|
36
|
-
}, "read");
|
|
37
|
-
if (!authorized.ok)
|
|
38
|
-
return err(projectPermissionFailure(authorized.error));
|
|
39
|
-
return provider === undefined
|
|
40
|
-
? err(new AnalysisCapabilityUnavailableError("rea-v8-inspector", operation, "V8 Inspector observation provider is not configured"))
|
|
41
|
-
: ok(provider);
|
|
42
|
-
};
|
|
24
|
+
const requireProvider = (provider, operation) => provider === undefined
|
|
25
|
+
? err(new AnalysisCapabilityUnavailableError("rea-v8-inspector", operation, "V8 Inspector observation provider is not configured"))
|
|
26
|
+
: ok(provider);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { AnalysisInputError, AnalysisProtocolError, } from "../domain/errors.js";
|
|
3
4
|
import { projectInputIssues } from "../domain/inputIssueProjection.js";
|
|
@@ -14,14 +15,54 @@ export const reconcileJavaScriptRuntimeEvidence = (rawInput) => {
|
|
|
14
15
|
return reconcileJavaScriptRuntimeEvidenceValidated(parsed.data);
|
|
15
16
|
};
|
|
16
17
|
/** Reconcile input already parsed by a trusted adapter boundary. */
|
|
17
|
-
export const reconcileJavaScriptRuntimeEvidenceValidated = (
|
|
18
|
+
export const reconcileJavaScriptRuntimeEvidenceValidated = (parsedInput) => {
|
|
18
19
|
try {
|
|
20
|
+
const input = reconcileJavaScriptRuntimeInputSchema.parse(normalizeRuntimeMappingRoots(parsedInput));
|
|
19
21
|
const result = reconcileJavaScriptRuntime(input);
|
|
20
22
|
return ok(createJavaScriptRuntimeReconciliationEvidence(input, result));
|
|
21
23
|
}
|
|
22
24
|
catch (cause) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
if (cause instanceof z.ZodError)
|
|
26
|
+
return err(new AnalysisInputError(OPERATION, undefined, projectInputIssues(cause.issues, parsedInput)));
|
|
27
|
+
if (cause instanceof TypeError &&
|
|
28
|
+
SAFE_RECONCILIATION_INPUT_CONSTRAINTS.has(cause.message))
|
|
29
|
+
return err(new AnalysisInputError(OPERATION, undefined, [
|
|
30
|
+
{ path: [], reason: "invalid_value", message: cause.message },
|
|
31
|
+
]));
|
|
32
|
+
return err(new AnalysisProtocolError("JavaScript runtime reconciliation produced an invalid result", { cause }));
|
|
26
33
|
}
|
|
27
34
|
};
|
|
35
|
+
const normalizeRuntimeMappingRoots = (input) => ({
|
|
36
|
+
...input,
|
|
37
|
+
static_layers: input.static_layers.map((layer) => ({
|
|
38
|
+
...layer,
|
|
39
|
+
runtime_mappings: layer.runtime_mappings.map((mapping) => mapping.kind === "file-root"
|
|
40
|
+
? {
|
|
41
|
+
...mapping,
|
|
42
|
+
root: isPortableAbsolutePath(mapping.root)
|
|
43
|
+
? mapping.root
|
|
44
|
+
: resolve(mapping.root),
|
|
45
|
+
}
|
|
46
|
+
: mapping),
|
|
47
|
+
})),
|
|
48
|
+
});
|
|
49
|
+
const isPortableAbsolutePath = (path) => path.startsWith("/") ||
|
|
50
|
+
/^[a-z]:[\\/]/iu.test(path) ||
|
|
51
|
+
/^(?:\\\\|\/\/)[^\\/]+[\\/][^\\/]+(?:[\\/]|$)/u.test(path);
|
|
52
|
+
const SAFE_RECONCILIATION_INPUT_CONSTRAINTS = new Set([
|
|
53
|
+
"Evidence semantic identifier does not match its record",
|
|
54
|
+
"JavaScript application Evidence subject disagrees with its result",
|
|
55
|
+
"Runtime reconciliation requires inspect_web_page, inspect_electron_page, observe_javascript_runtime, or capture_electron_scenario Evidence",
|
|
56
|
+
"Runtime Evidence target or declared role disagrees with its result",
|
|
57
|
+
"Runtime Evidence contains an invalid builtin location",
|
|
58
|
+
"Runtime Evidence target disagrees with its captured result",
|
|
59
|
+
"Browser Evidence target is outside its recorded origin scope",
|
|
60
|
+
"Runtime Evidence contains source without source-capture selection",
|
|
61
|
+
"Active Electron Evidence application path disagrees with its configured root",
|
|
62
|
+
...[
|
|
63
|
+
"inspect_web_page",
|
|
64
|
+
"inspect_electron_page",
|
|
65
|
+
"observe_javascript_runtime",
|
|
66
|
+
"capture_electron_scenario",
|
|
67
|
+
].map((operation) => `Evidence does not match the supported ${operation} contract`),
|
|
68
|
+
]);
|
|
@@ -121,6 +121,17 @@ const projectTimerSchedule = (context, operation, timerNodes) => {
|
|
|
121
121
|
relation: "schedules-timer",
|
|
122
122
|
resolution: "resolved",
|
|
123
123
|
});
|
|
124
|
+
for (const projected of operation.projectedResultBindings)
|
|
125
|
+
addSemanticGraphRelation(context.state, {
|
|
126
|
+
source: timerNodes.get(operation.timerId),
|
|
127
|
+
target: context.bindingNodes.get(projected.bindingId),
|
|
128
|
+
relation: "destructures",
|
|
129
|
+
resolution: projected.resolution === "complete" ? "resolved" : "candidate",
|
|
130
|
+
properties: {
|
|
131
|
+
projection_path: [...projected.projectionPath],
|
|
132
|
+
projection_resolution: projected.resolution,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
124
135
|
};
|
|
125
136
|
const projectTimerCancellation = (context, operation, timerNodes) => {
|
|
126
137
|
const callSite = semanticCallSiteAt(context, operation.location);
|
|
@@ -42,6 +42,17 @@ const projectSpawn = (context, spawn, child) => {
|
|
|
42
42
|
relation: "spawns",
|
|
43
43
|
resolution: spawn.resolution === "complete" ? "resolved" : "candidate",
|
|
44
44
|
});
|
|
45
|
+
for (const projected of spawn.projectedResultBindings)
|
|
46
|
+
addSemanticGraphRelation(context.state, {
|
|
47
|
+
source: child,
|
|
48
|
+
target: context.bindingNodes.get(projected.bindingId),
|
|
49
|
+
relation: "destructures",
|
|
50
|
+
resolution: projected.resolution === "complete" ? "resolved" : "candidate",
|
|
51
|
+
properties: {
|
|
52
|
+
projection_path: [...projected.projectionPath],
|
|
53
|
+
projection_resolution: projected.resolution,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
45
56
|
if (spawn.argvCount !== null)
|
|
46
57
|
addSemanticGraphRelation(context.state, {
|
|
47
58
|
source: callSite,
|
|
@@ -117,6 +117,17 @@ const projectRequestConstruction = (context, operation, request) => {
|
|
|
117
117
|
relation: "constructs-request",
|
|
118
118
|
resolution: operation.resolution === "complete" ? "resolved" : "candidate",
|
|
119
119
|
});
|
|
120
|
+
for (const projected of operation.projectedResultBindings)
|
|
121
|
+
addSemanticGraphRelation(context.state, {
|
|
122
|
+
source: request,
|
|
123
|
+
target: context.bindingNodes.get(projected.bindingId),
|
|
124
|
+
relation: "destructures",
|
|
125
|
+
resolution: projected.resolution === "complete" ? "resolved" : "candidate",
|
|
126
|
+
properties: {
|
|
127
|
+
projection_path: [...projected.projectionPath],
|
|
128
|
+
projection_resolution: projected.resolution,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
120
131
|
for (const field of operation.fields)
|
|
121
132
|
addSemanticGraphRelation(context.state, {
|
|
122
133
|
source: field.sourceBindingId === null
|
|
@@ -158,18 +158,27 @@ export const projectSemanticClosureCaptures = (context) => {
|
|
|
158
158
|
evidence: inferredSemanticEvidenceAt(context.file, capture.referenceLocation),
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
|
-
/** Retain bounded unresolved dynamic-call and dynamic-
|
|
161
|
+
/** Retain bounded unresolved dynamic-call, dynamic-property and dynamic-scope frontiers. */
|
|
162
162
|
export const projectSemanticFrontiers = (context) => {
|
|
163
163
|
for (const frontier of context.ir.frontiers) {
|
|
164
|
+
// Dynamic environments leave identifier reads and writes unresolved.
|
|
165
|
+
const family = frontier.kind === "dynamic-call"
|
|
166
|
+
? "call-flow"
|
|
167
|
+
: frontier.kind === "dynamic-scope"
|
|
168
|
+
? "data-flow"
|
|
169
|
+
: "object-flow";
|
|
170
|
+
const relationKinds = frontier.kind === "dynamic-call"
|
|
171
|
+
? ["calls"]
|
|
172
|
+
: frontier.kind === "dynamic-scope"
|
|
173
|
+
? ["reads", "writes"]
|
|
174
|
+
: ["reads-property", "writes-property"];
|
|
164
175
|
const unknown = createJavaScriptSemanticGraphUnknown({
|
|
165
176
|
node_id: frontier.callableId === null
|
|
166
177
|
? context.moduleNode.node_id
|
|
167
178
|
: (context.callableNodes.get(frontier.callableId)?.node_id ??
|
|
168
179
|
context.moduleNode.node_id),
|
|
169
|
-
family
|
|
170
|
-
relation_kinds:
|
|
171
|
-
? ["calls"]
|
|
172
|
-
: ["reads-property", "writes-property"],
|
|
180
|
+
family,
|
|
181
|
+
relation_kinds: [...relationKinds],
|
|
173
182
|
reason: frontier.kind,
|
|
174
183
|
detail: frontier.reason,
|
|
175
184
|
candidate_node_ids: [],
|
|
@@ -13,7 +13,7 @@ export const readJsonFile = async (path) => {
|
|
|
13
13
|
const encoded = await readFile(canonicalPath);
|
|
14
14
|
let decoded;
|
|
15
15
|
try {
|
|
16
|
-
decoded = JSON.parse(
|
|
16
|
+
decoded = JSON.parse(new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(encoded));
|
|
17
17
|
}
|
|
18
18
|
catch (cause) {
|
|
19
19
|
return err(new EvidenceFileError("read", "invalid-json", { cause }));
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { AnalysisCancelledError, AnalysisError, ProviderAdapterError, } from "../domain/errors.js";
|
|
2
|
+
import { err } from "../domain/result.js";
|
|
3
|
+
import { ABORTED, waitForAbortable } from "./AbortablePromise.js";
|
|
4
|
+
const isAborted = (signal) => signal?.aborted === true;
|
|
1
5
|
/**
|
|
2
6
|
* Preserve synchronous provider discovery while loading implementation modules
|
|
3
7
|
* only when a target-bound client first executes.
|
|
@@ -25,7 +29,7 @@ export class LazyAnalysisProvider {
|
|
|
25
29
|
return new LazyAnalysisClient(async () => {
|
|
26
30
|
const provider = await this.#load();
|
|
27
31
|
return provider.createClient(target, profile, context);
|
|
28
|
-
});
|
|
32
|
+
}, this.#providerIdentity.id);
|
|
29
33
|
}
|
|
30
34
|
async #load() {
|
|
31
35
|
this.#provider ??= this.#loadProvider().catch((cause) => {
|
|
@@ -37,15 +41,30 @@ export class LazyAnalysisProvider {
|
|
|
37
41
|
}
|
|
38
42
|
class LazyAnalysisClient {
|
|
39
43
|
#loadClient;
|
|
44
|
+
#providerId;
|
|
40
45
|
#client;
|
|
41
46
|
#loading;
|
|
42
47
|
#closed = false;
|
|
43
|
-
constructor(loadClient) {
|
|
48
|
+
constructor(loadClient, providerId) {
|
|
44
49
|
this.#loadClient = loadClient;
|
|
50
|
+
this.#providerId = providerId;
|
|
45
51
|
}
|
|
46
52
|
execute = async (operation, parameters, options) => {
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
try {
|
|
54
|
+
if (isAborted(options?.signal))
|
|
55
|
+
return err(new AnalysisCancelledError(operation));
|
|
56
|
+
const loaded = await waitForAbortable(this.#load(operation), options?.signal);
|
|
57
|
+
if (loaded === ABORTED)
|
|
58
|
+
return err(new AnalysisCancelledError(operation));
|
|
59
|
+
return await loaded.execute(operation, parameters, options);
|
|
60
|
+
}
|
|
61
|
+
catch (cause) {
|
|
62
|
+
if (cause instanceof AnalysisError)
|
|
63
|
+
return err(cause);
|
|
64
|
+
return err(new ProviderAdapterError(this.#providerId, operation, {
|
|
65
|
+
cause,
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
49
68
|
};
|
|
50
69
|
runtimeLineageSnapshots() {
|
|
51
70
|
return this.#client?.runtimeLineageSnapshots?.() ?? [];
|
|
@@ -60,9 +79,11 @@ class LazyAnalysisClient {
|
|
|
60
79
|
const client = await this.#loading;
|
|
61
80
|
await client.close();
|
|
62
81
|
}
|
|
63
|
-
async #load() {
|
|
82
|
+
async #load(operation) {
|
|
64
83
|
if (this.#closed)
|
|
65
|
-
throw new
|
|
84
|
+
throw new ProviderAdapterError(this.#providerId, operation, {
|
|
85
|
+
diagnostics: { reason: "client_closed" },
|
|
86
|
+
});
|
|
66
87
|
this.#loading ??= this.#loadClient()
|
|
67
88
|
.then((client) => {
|
|
68
89
|
this.#client = client;
|