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
|
@@ -7,6 +7,7 @@ import { promisify } from "node:util";
|
|
|
7
7
|
import { isPathWithinRoot } from "../domain/localPath.js";
|
|
8
8
|
import { BinaryTargetError } from "../domain/errors.js";
|
|
9
9
|
import { err, ok } from "../domain/result.js";
|
|
10
|
+
import { mzWindowsHeaderOffset } from "../domain/dosMz.js";
|
|
10
11
|
import { hasZipSignature, zipPackageFormatForPath, } from "../domain/zipPackageFormat.js";
|
|
11
12
|
import { parseExecutableHeader, parsePeRecord, } from "../domain/binaryTarget.js";
|
|
12
13
|
const execFileAsync = promisify(execFile);
|
|
@@ -64,7 +65,30 @@ export const parseBinaryTarget = async (input, cwd = process.cwd(), hostArchitec
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
catch (cause) {
|
|
67
|
-
|
|
68
|
+
if (!(cause instanceof Error))
|
|
69
|
+
throw cause;
|
|
70
|
+
const code = filesystemErrorCode(cause);
|
|
71
|
+
if (code === undefined)
|
|
72
|
+
throw cause;
|
|
73
|
+
return err(new BinaryTargetError(candidate, targetFailureReason(code, cause.message), { cause }));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const filesystemErrorCode = (cause) => {
|
|
77
|
+
const code = Reflect.get(cause, "code");
|
|
78
|
+
return typeof code === "string" ? code : undefined;
|
|
79
|
+
};
|
|
80
|
+
const targetFailureReason = (code, detail) => {
|
|
81
|
+
switch (code) {
|
|
82
|
+
case "ENOENT":
|
|
83
|
+
case "ENOTDIR":
|
|
84
|
+
return `target does not exist or a path component is not a directory: ${detail}`;
|
|
85
|
+
case "EACCES":
|
|
86
|
+
case "EPERM":
|
|
87
|
+
return `permission denied while reading target: ${detail}`;
|
|
88
|
+
case "EISDIR":
|
|
89
|
+
return `target is a directory, not a readable file: ${detail}`;
|
|
90
|
+
default:
|
|
91
|
+
return `target could not be read (${code}): ${detail}`;
|
|
68
92
|
}
|
|
69
93
|
};
|
|
70
94
|
const detectArtifactFormat = async (path, handle) => {
|
|
@@ -181,9 +205,28 @@ const readExecutableMetadata = async (handle, hostArchitecture) => {
|
|
|
181
205
|
const prefix = Buffer.alloc(4096);
|
|
182
206
|
const prefixRead = await handle.read(prefix, 0, prefix.length, 0);
|
|
183
207
|
const bytes = prefix.subarray(0, prefixRead.bytesRead);
|
|
184
|
-
if (bytes.length >=
|
|
185
|
-
const offset = bytes
|
|
186
|
-
|
|
208
|
+
if (bytes.length >= 2 && bytes[0] === 0x4d && bytes[1] === 0x5a) {
|
|
209
|
+
const offset = mzWindowsHeaderOffset(bytes);
|
|
210
|
+
if (offset !== null) {
|
|
211
|
+
if (offset < 64)
|
|
212
|
+
return err("invalid Windows new-header offset in MZ image");
|
|
213
|
+
return readPeMetadata(handle, offset);
|
|
214
|
+
}
|
|
215
|
+
// MZ relocation records may extend past the initial probe; their format
|
|
216
|
+
// bounds are at most 65535 records inside a 65535-paragraph header.
|
|
217
|
+
const tableEnd = bytes.length >= 28
|
|
218
|
+
? bytes.readUInt16LE(24) + bytes.readUInt16LE(6) * 4
|
|
219
|
+
: 0;
|
|
220
|
+
const headerBytes = bytes.length >= 28 ? bytes.readUInt16LE(8) * 16 : 0;
|
|
221
|
+
const fileSize = (await handle.stat()).size;
|
|
222
|
+
if (tableEnd > bytes.length &&
|
|
223
|
+
tableEnd <= headerBytes &&
|
|
224
|
+
tableEnd <= fileSize) {
|
|
225
|
+
const table = Buffer.alloc(tableEnd);
|
|
226
|
+
const observed = await handle.read(table, 0, table.length, 0);
|
|
227
|
+
return parseExecutableHeader(table.subarray(0, observed.bytesRead), hostArchitecture, fileSize);
|
|
228
|
+
}
|
|
229
|
+
return parseExecutableHeader(bytes, hostArchitecture, fileSize);
|
|
187
230
|
}
|
|
188
231
|
if (bytes.length >= 8) {
|
|
189
232
|
const magic = bytes.readUInt32BE(0);
|
|
@@ -205,6 +248,9 @@ const readPeMetadata = async (handle, offset) => {
|
|
|
205
248
|
const fileHeaderRead = await handle.read(fileHeader, 0, fileHeader.length, offset);
|
|
206
249
|
if (fileHeaderRead.bytesRead !== fileHeader.length)
|
|
207
250
|
return err("invalid or truncated PE header");
|
|
251
|
+
const signature = fileHeader.toString("ascii", 0, 2);
|
|
252
|
+
if (["NE", "LE", "LX"].includes(signature))
|
|
253
|
+
return err(`unsupported ${signature} executable in MZ image`);
|
|
208
254
|
const optionalHeaderSize = fileHeader.readUInt16LE(20);
|
|
209
255
|
if (optionalHeaderSize > 4096)
|
|
210
256
|
return err("invalid PE optional header size");
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import { createEvidence, } from "../domain/evidence.js";
|
|
2
2
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
3
|
+
import { sanitizeBrowserUrl } from "../domain/browserObservation.js";
|
|
3
4
|
import { commitBrowserScenarioNormalization } from "../domain/browserScenarioNormalization.js";
|
|
4
|
-
/** Create Evidence for
|
|
5
|
+
/** Create Evidence for one request-scoped external browser observation. */
|
|
5
6
|
export const createBrowserEvidence = (operation, input, result, provider) => createEvidence(undefined, provider, {
|
|
6
7
|
predicateType: browserPredicate(operation),
|
|
7
8
|
operation,
|
|
8
|
-
parameters: browserParameters(input),
|
|
9
|
+
parameters: browserParameters(input, result),
|
|
9
10
|
result: jsonValueSchema.parse(result),
|
|
10
11
|
confidence: "observed",
|
|
11
12
|
authority: "external-service",
|
|
12
13
|
environment: "browser" in result
|
|
13
14
|
? {
|
|
14
15
|
id: `${result.browser.product}@${result.browser.revision}`,
|
|
15
|
-
platform:
|
|
16
|
-
architecture:
|
|
16
|
+
platform: "unknown",
|
|
17
|
+
architecture: "unknown",
|
|
17
18
|
isolation: "none",
|
|
18
19
|
}
|
|
19
20
|
: null,
|
|
20
|
-
limitations:
|
|
21
|
+
limitations: [
|
|
22
|
+
...result.limitations,
|
|
23
|
+
...("browser" in result
|
|
24
|
+
? ["Browser host platform and architecture were not observed."]
|
|
25
|
+
: []),
|
|
26
|
+
],
|
|
21
27
|
});
|
|
22
|
-
const browserParameters = (input) => {
|
|
28
|
+
const browserParameters = (input, result) => {
|
|
23
29
|
if (!("cdp_endpoint" in input)) {
|
|
24
30
|
if ("before_scenario" in input &&
|
|
25
31
|
input.before_scenario !== undefined &&
|
|
@@ -50,9 +56,14 @@ const browserParameters = (input) => {
|
|
|
50
56
|
};
|
|
51
57
|
throw new Error("Browser comparison input did not match a comparison type");
|
|
52
58
|
}
|
|
59
|
+
const observedOrigin = browserResultTargetOrigin(result);
|
|
53
60
|
const scope = {
|
|
54
61
|
cdp_endpoint: input.cdp_endpoint,
|
|
55
|
-
allowed_origins: input.allowed_origins
|
|
62
|
+
allowed_origins: input.allowed_origins.length > 0
|
|
63
|
+
? input.allowed_origins
|
|
64
|
+
: "target_id" in input && observedOrigin !== undefined
|
|
65
|
+
? [observedOrigin]
|
|
66
|
+
: [],
|
|
56
67
|
};
|
|
57
68
|
if (!("target_id" in input))
|
|
58
69
|
return scope;
|
|
@@ -80,6 +91,24 @@ const browserParameters = (input) => {
|
|
|
80
91
|
: {}),
|
|
81
92
|
};
|
|
82
93
|
};
|
|
94
|
+
const browserResultTargetOrigin = (result) => {
|
|
95
|
+
if ("inspection" in result &&
|
|
96
|
+
typeof result.inspection === "object" &&
|
|
97
|
+
result.inspection !== null &&
|
|
98
|
+
"target" in result.inspection &&
|
|
99
|
+
typeof result.inspection.target === "object" &&
|
|
100
|
+
result.inspection.target !== null &&
|
|
101
|
+
"origin" in result.inspection.target &&
|
|
102
|
+
typeof result.inspection.target.origin === "string")
|
|
103
|
+
return result.inspection.target.origin;
|
|
104
|
+
if (!("target" in result))
|
|
105
|
+
return undefined;
|
|
106
|
+
if ("origin" in result.target)
|
|
107
|
+
return result.target.origin;
|
|
108
|
+
if ("initial_url" in result.target)
|
|
109
|
+
return sanitizeBrowserUrl(result.target.initial_url).origin ?? undefined;
|
|
110
|
+
return undefined;
|
|
111
|
+
};
|
|
83
112
|
const isScreenshotComparison = (input) => "channel_threshold" in input;
|
|
84
113
|
const browserPredicate = (operation) => {
|
|
85
114
|
switch (operation) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { projectPermissionFailure } from "./PermissionFailure.js";
|
|
2
|
-
import { isLiteralLoopbackHostname, } from "../domain/browserObservation.js";
|
|
3
1
|
import { AnalysisCapabilityUnavailableError, } from "../domain/errors.js";
|
|
4
2
|
import { err, ok } from "../domain/result.js";
|
|
5
3
|
import { createBrowserEvidence } from "./BrowserEvidence.js";
|
|
6
|
-
/**
|
|
7
|
-
export const listBrowserTargets = async (browser,
|
|
8
|
-
const ready =
|
|
4
|
+
/** List browser targets within the endpoint and origin scope in the request. */
|
|
5
|
+
export const listBrowserTargets = async (browser, input, options = {}) => {
|
|
6
|
+
const ready = requireBrowser(browser, "list_browser_targets");
|
|
9
7
|
if (!ready.ok)
|
|
10
8
|
return ready;
|
|
11
9
|
const result = await ready.value.listTargets(input, options);
|
|
@@ -13,9 +11,9 @@ export const listBrowserTargets = async (browser, authority, input, options = {}
|
|
|
13
11
|
? ok(createBrowserEvidence("list_browser_targets", input, result.value, ready.value.identity()))
|
|
14
12
|
: result;
|
|
15
13
|
};
|
|
16
|
-
/**
|
|
17
|
-
export const inspectWebPage = async (browser,
|
|
18
|
-
const ready =
|
|
14
|
+
/** Inspect one page within the endpoint and origin scope in the request. */
|
|
15
|
+
export const inspectWebPage = async (browser, input, options = {}) => {
|
|
16
|
+
const ready = requireBrowser(browser, "inspect_web_page");
|
|
19
17
|
if (!ready.ok)
|
|
20
18
|
return ready;
|
|
21
19
|
const result = await ready.value.inspectPage(input, options);
|
|
@@ -23,9 +21,9 @@ export const inspectWebPage = async (browser, authority, input, options = {}) =>
|
|
|
23
21
|
? ok(createBrowserEvidence("inspect_web_page", input, result.value, ready.value.identity()))
|
|
24
22
|
: result;
|
|
25
23
|
};
|
|
26
|
-
/** Capture
|
|
27
|
-
export const analyzeWebBundle = async (browser,
|
|
28
|
-
const ready =
|
|
24
|
+
/** Capture requested sources and derive static web-bundle evidence. */
|
|
25
|
+
export const analyzeWebBundle = async (browser, input, options = {}) => {
|
|
26
|
+
const ready = requireBrowser(browser, "analyze_web_bundle");
|
|
29
27
|
if (!ready.ok)
|
|
30
28
|
return ready;
|
|
31
29
|
const analyzed = await ready.value.analyzeBundle(input, options);
|
|
@@ -34,8 +32,8 @@ export const analyzeWebBundle = async (browser, authority, input, options = {})
|
|
|
34
32
|
return ok(createBrowserEvidence("analyze_web_bundle", input, analyzed.value, ready.value.identity()));
|
|
35
33
|
};
|
|
36
34
|
/** Observe navigation caused by external user actions during one armed window. */
|
|
37
|
-
export const observeWebSession = async (browser,
|
|
38
|
-
const ready =
|
|
35
|
+
export const observeWebSession = async (browser, input, options = {}) => {
|
|
36
|
+
const ready = requireBrowser(browser, "observe_web_session");
|
|
39
37
|
if (!ready.ok)
|
|
40
38
|
return ready;
|
|
41
39
|
const observed = await ready.value.observeSession(input, options);
|
|
@@ -44,8 +42,8 @@ export const observeWebSession = async (browser, authority, input, options = {})
|
|
|
44
42
|
: observed;
|
|
45
43
|
};
|
|
46
44
|
/** Discover WebMCP declarations without exposing an invocation surface. */
|
|
47
|
-
export const discoverWebMcpTools = async (browser,
|
|
48
|
-
const ready =
|
|
45
|
+
export const discoverWebMcpTools = async (browser, input, options = {}) => {
|
|
46
|
+
const ready = requireBrowser(browser, "discover_webmcp_tools");
|
|
49
47
|
if (!ready.ok)
|
|
50
48
|
return ready;
|
|
51
49
|
const discovered = await ready.value.discoverWebMcpTools(input, options);
|
|
@@ -63,9 +61,9 @@ export const compareWebCaptureEvidence = async (browser, input) => {
|
|
|
63
61
|
? ok(createBrowserEvidence("compare_web_captures", input, compared.value, ready.value.identity()))
|
|
64
62
|
: compared;
|
|
65
63
|
};
|
|
66
|
-
/** Capture one
|
|
67
|
-
export const captureWebScreenshot = async (browser,
|
|
68
|
-
const ready =
|
|
64
|
+
/** Capture one visible-viewport screenshot for the requested target. */
|
|
65
|
+
export const captureWebScreenshot = async (browser, input, options = {}) => {
|
|
66
|
+
const ready = requireBrowser(browser, "capture_web_screenshot");
|
|
69
67
|
if (!ready.ok)
|
|
70
68
|
return ready;
|
|
71
69
|
const captured = await ready.value.captureScreenshot(input, options);
|
|
@@ -83,31 +81,6 @@ export const compareWebScreenshotEvidence = async (browser, input) => {
|
|
|
83
81
|
? ok(createBrowserEvidence("compare_web_screenshots", input, compared.value, ready.value.identity()))
|
|
84
82
|
: compared;
|
|
85
83
|
};
|
|
86
|
-
const prepare = async (browser, authority, input, operation) => {
|
|
87
|
-
if (authority === undefined)
|
|
88
|
-
return err(new AnalysisCapabilityUnavailableError("rea-cdp-browser", operation, "browser observation permission policy is not configured"));
|
|
89
|
-
const authorized = await authority.authorize({
|
|
90
|
-
capability: "browser_observe",
|
|
91
|
-
roots: [],
|
|
92
|
-
executables: [],
|
|
93
|
-
environment_names: [],
|
|
94
|
-
origins: [input.cdp_endpoint, ...input.allowed_origins],
|
|
95
|
-
network: browserNetworkScope(input.allowed_origins),
|
|
96
|
-
mount: false,
|
|
97
|
-
operation_identity: `${operation}:${input.target_id ?? input.cdp_endpoint}`,
|
|
98
|
-
}, "read");
|
|
99
|
-
if (!authorized.ok)
|
|
100
|
-
return err(projectPermissionFailure(authorized.error));
|
|
101
|
-
return browser === undefined
|
|
102
|
-
? err(new AnalysisCapabilityUnavailableError("rea-cdp-browser", operation, "browser observation provider is not configured"))
|
|
103
|
-
: ok(browser);
|
|
104
|
-
};
|
|
105
84
|
const requireBrowser = (browser, operation) => browser === undefined
|
|
106
|
-
? err(new AnalysisCapabilityUnavailableError("rea-cdp-browser", operation, "browser
|
|
85
|
+
? err(new AnalysisCapabilityUnavailableError("rea-cdp-browser", operation, "browser observation provider is not configured"))
|
|
107
86
|
: ok(browser);
|
|
108
|
-
const browserNetworkScope = (allowedOrigins) => allowedOrigins.every((origin) => {
|
|
109
|
-
const hostname = new URL(origin).hostname;
|
|
110
|
-
return isLiteralLoopbackHostname(hostname);
|
|
111
|
-
})
|
|
112
|
-
? "loopback"
|
|
113
|
-
: "external";
|
|
@@ -1,43 +1,10 @@
|
|
|
1
|
-
import { projectPermissionFailure } from "./PermissionFailure.js";
|
|
2
1
|
import { createBrowserScenarioEvidence } from "./BrowserScenarioEvidence.js";
|
|
3
|
-
import { digestJson } from "./JavaScriptReplayPlanning.js";
|
|
4
2
|
import { AnalysisCapabilityUnavailableError, } from "../domain/errors.js";
|
|
5
|
-
import { isLiteralLoopbackHostname } from "../domain/browserObservation.js";
|
|
6
3
|
import { err } from "../domain/result.js";
|
|
7
4
|
const OPERATION = "capture_browser_scenario";
|
|
8
5
|
const PROVIDER_ID = "rea-playwright-browser-scenario";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
: "external";
|
|
12
|
-
const authorizeScenario = async (authority, scenario) => {
|
|
13
|
-
if (authority === undefined)
|
|
14
|
-
return err(new AnalysisCapabilityUnavailableError(PROVIDER_ID, OPERATION, "browser scenario permission policy is not configured"));
|
|
15
|
-
const authorized = await authority.authorize({
|
|
16
|
-
capability: "browser_automate",
|
|
17
|
-
roots: [],
|
|
18
|
-
executables: scenario.browser.mode === "launch"
|
|
19
|
-
? [scenario.browser.executable_path]
|
|
20
|
-
: [],
|
|
21
|
-
environment_names: scenario.secrets.map(({ environment_variable: name }) => name),
|
|
22
|
-
origins: [
|
|
23
|
-
...(scenario.browser.mode === "connect"
|
|
24
|
-
? [scenario.browser.cdp_endpoint]
|
|
25
|
-
: []),
|
|
26
|
-
...scenario.allowed_origins,
|
|
27
|
-
],
|
|
28
|
-
network: networkScope(scenario.allowed_origins),
|
|
29
|
-
mount: false,
|
|
30
|
-
operation_identity: `${OPERATION}:${digestJson(scenario)}`,
|
|
31
|
-
}, "write");
|
|
32
|
-
if (!authorized.ok)
|
|
33
|
-
return err(projectPermissionFailure(authorized.error));
|
|
34
|
-
return { ok: true, value: true };
|
|
35
|
-
};
|
|
36
|
-
/** Authorize and execute one controlled browser scenario. */
|
|
37
|
-
export const captureBrowserScenario = async (provider, authority, scenario, options = {}) => {
|
|
38
|
-
const authorized = await authorizeScenario(authority, scenario);
|
|
39
|
-
if (!authorized.ok)
|
|
40
|
-
return authorized;
|
|
6
|
+
/** Execute one controlled browser scenario using its explicit request scope. */
|
|
7
|
+
export const captureBrowserScenario = async (provider, scenario, options = {}) => {
|
|
41
8
|
if (provider === undefined)
|
|
42
9
|
return err(new AnalysisCapabilityUnavailableError(PROVIDER_ID, OPERATION, "browser scenario provider is not configured"));
|
|
43
10
|
const captured = await provider.captureScenario(scenario, options);
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { sanitizeBrowserUrl } from "../domain/browserObservation.js";
|
|
2
2
|
import { createEvidence, } from "../domain/evidence.js";
|
|
3
3
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
4
|
-
import {
|
|
4
|
+
import { digestCanonicalJson } from "../domain/browserScenarioNormalization.js";
|
|
5
5
|
const browserScenarioParameters = (scenario) => ({
|
|
6
|
-
scenario_sha256:
|
|
6
|
+
scenario_sha256: digestCanonicalJson(scenario),
|
|
7
7
|
browser_mode: scenario.browser.mode,
|
|
8
|
+
...(scenario.browser.mode === "launch"
|
|
9
|
+
? { browser_headless: scenario.browser.headless }
|
|
10
|
+
: {}),
|
|
8
11
|
start_url: sanitizeBrowserUrl(scenario.start_url.url),
|
|
9
|
-
|
|
12
|
+
environment: scenario.environment,
|
|
10
13
|
actions: scenario.actions.map(({ step_id, action }) => ({
|
|
11
14
|
step_id,
|
|
12
15
|
action,
|
|
13
16
|
})),
|
|
14
17
|
action_timeouts_ms: scenario.actions.map((item) => "timeout_ms" in item ? (item.timeout_ms ?? null) : null),
|
|
15
|
-
secret_declarations: scenario.secrets.map(({ secret_id, environment_variable
|
|
18
|
+
secret_declarations: scenario.secrets.map(({ secret_id, environment_variable }) => ({
|
|
16
19
|
secret_id,
|
|
17
20
|
environment_variable,
|
|
18
|
-
purpose,
|
|
19
|
-
redaction,
|
|
20
21
|
})),
|
|
21
22
|
capture: scenario.capture,
|
|
22
23
|
});
|
|
@@ -30,11 +31,14 @@ export const createBrowserScenarioEvidence = (scenario, capture, provider) => cr
|
|
|
30
31
|
authority: "controlled-replay",
|
|
31
32
|
environment: {
|
|
32
33
|
id: `${capture.browser.product}@${capture.browser.version}`,
|
|
33
|
-
platform:
|
|
34
|
-
architecture:
|
|
34
|
+
platform: "unknown",
|
|
35
|
+
architecture: "unknown",
|
|
35
36
|
isolation: capture.browser.process_ownership === "provider-owned"
|
|
36
37
|
? "process"
|
|
37
38
|
: "none",
|
|
38
39
|
},
|
|
39
|
-
limitations:
|
|
40
|
+
limitations: [
|
|
41
|
+
...capture.limitations,
|
|
42
|
+
"Browser host platform and architecture were not observed.",
|
|
43
|
+
],
|
|
40
44
|
});
|
|
@@ -5,18 +5,9 @@ export const NO_CLIENT_FEATURES = {
|
|
|
5
5
|
roots: false,
|
|
6
6
|
sampling: false,
|
|
7
7
|
};
|
|
8
|
-
const CLIENT_FEATURE_REQUIREMENTS = {
|
|
9
|
-
capture_process_scenario: {
|
|
10
|
-
required: [],
|
|
11
|
-
optional: ["elicitation_form"],
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
8
|
/** Project a tool's client requirements against the negotiated feature set. */
|
|
15
|
-
export const clientRequirementsFor = (
|
|
16
|
-
const requirements =
|
|
17
|
-
required: [],
|
|
18
|
-
optional: [],
|
|
19
|
-
};
|
|
9
|
+
export const clientRequirementsFor = (_name, clientFeatures) => {
|
|
10
|
+
const requirements = { required: [], optional: [] };
|
|
20
11
|
return {
|
|
21
12
|
required: [...requirements.required],
|
|
22
13
|
optional: [...requirements.optional],
|
|
@@ -9,6 +9,7 @@ const statusSchema = z.object({
|
|
|
9
9
|
capabilities: z.array(providerCapability),
|
|
10
10
|
});
|
|
11
11
|
const ENHANCED_REQUIREMENTS = {
|
|
12
|
+
trace_native_values: ["analyze_function", "resolve_native_call_targets"],
|
|
12
13
|
trace_native_ui_action: [
|
|
13
14
|
"decode_interface_builder",
|
|
14
15
|
"list_names",
|
|
@@ -111,9 +112,9 @@ const availabilityFor = (context) => {
|
|
|
111
112
|
const javascriptApplication = javascriptApplicationAvailability(context);
|
|
112
113
|
if (javascriptApplication !== null)
|
|
113
114
|
return javascriptApplication;
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
116
|
-
return
|
|
115
|
+
const workflowAvailability = workflowAvailabilityFor(context);
|
|
116
|
+
if (workflowAvailability !== null)
|
|
117
|
+
return workflowAvailability;
|
|
117
118
|
const targetDecision = targetAvailability(context);
|
|
118
119
|
if (targetDecision !== null)
|
|
119
120
|
return targetDecision;
|
|
@@ -126,78 +127,63 @@ const javascriptApplicationAvailability = ({ name, }) => {
|
|
|
126
127
|
? { reason: "available", remediation: null }
|
|
127
128
|
: null;
|
|
128
129
|
};
|
|
129
|
-
const
|
|
130
|
-
const browser =
|
|
130
|
+
const workflowAvailabilityFor = ({ name, kind, policy, }) => {
|
|
131
|
+
const browser = browserProviderAvailability(name, kind, policy);
|
|
131
132
|
if (browser !== null)
|
|
132
133
|
return browser;
|
|
133
134
|
if (name === "capture_process_scenario" && !policy.processCaptureEnabled)
|
|
134
135
|
return {
|
|
135
|
-
reason: "
|
|
136
|
-
remediation: "
|
|
137
|
-
};
|
|
138
|
-
if (name === "run_controlled_replay" && !policy.javascriptReplayEnabled)
|
|
139
|
-
return {
|
|
140
|
-
reason: "policy_disabled",
|
|
141
|
-
remediation: "Enable javascript_replay with exact source roots and sandbox executables.",
|
|
142
|
-
};
|
|
143
|
-
if (name === "run_controlled_replay")
|
|
144
|
-
return { reason: "available", remediation: null };
|
|
145
|
-
if (name === "plan_managed_runtime_correlation" &&
|
|
146
|
-
!policy.managedRuntimeEnabled)
|
|
147
|
-
return {
|
|
148
|
-
reason: "policy_disabled",
|
|
149
|
-
remediation: "Enable managed_runtime with exact artifact roots and a runtime executable.",
|
|
136
|
+
reason: "unsupported_host",
|
|
137
|
+
remediation: "Run process capture on a supported Linux or macOS host.",
|
|
150
138
|
};
|
|
151
|
-
if (name === "plan_managed_runtime_correlation")
|
|
152
|
-
return { reason: "available", remediation: null };
|
|
153
139
|
if (kind === "application")
|
|
154
140
|
return { reason: "available", remediation: null };
|
|
155
|
-
const electron =
|
|
141
|
+
const electron = electronProviderAvailability(name, kind, policy);
|
|
156
142
|
if (electron !== null)
|
|
157
143
|
return electron;
|
|
158
144
|
if (kind === "runtime-provider")
|
|
159
145
|
return policy.v8InspectorObservationEnabled === true
|
|
160
146
|
? { reason: "available", remediation: null }
|
|
161
147
|
: {
|
|
162
|
-
reason: "
|
|
163
|
-
remediation: "
|
|
148
|
+
reason: "provider_missing",
|
|
149
|
+
remediation: "Start REA with its JavaScript runtime provider available.",
|
|
164
150
|
};
|
|
165
151
|
if (kind === "session")
|
|
166
152
|
return { reason: "available", remediation: null };
|
|
167
153
|
return null;
|
|
168
154
|
};
|
|
169
|
-
const
|
|
155
|
+
const electronProviderAvailability = (name, kind, policy) => {
|
|
170
156
|
if (kind !== "electron-provider")
|
|
171
157
|
return null;
|
|
172
158
|
if (name === "capture_electron_scenario")
|
|
173
159
|
return policy.electronAutomationEnabled === true
|
|
174
160
|
? { reason: "available", remediation: null }
|
|
175
161
|
: {
|
|
176
|
-
reason: "
|
|
177
|
-
remediation: "
|
|
162
|
+
reason: "provider_missing",
|
|
163
|
+
remediation: "Start REA with the Electron scenario provider available.",
|
|
178
164
|
};
|
|
179
165
|
return policy.electronObservationEnabled === true
|
|
180
166
|
? { reason: "available", remediation: null }
|
|
181
167
|
: {
|
|
182
|
-
reason: "
|
|
183
|
-
remediation: "
|
|
168
|
+
reason: "provider_missing",
|
|
169
|
+
remediation: "Start REA with its Electron observation provider available.",
|
|
184
170
|
};
|
|
185
171
|
};
|
|
186
|
-
const
|
|
172
|
+
const browserProviderAvailability = (name, kind, policy) => {
|
|
187
173
|
if (name === "capture_browser_scenario")
|
|
188
174
|
return policy.browserScenarioEnabled === true
|
|
189
175
|
? { reason: "available", remediation: null }
|
|
190
176
|
: {
|
|
191
|
-
reason: "
|
|
192
|
-
remediation: "
|
|
177
|
+
reason: "provider_missing",
|
|
178
|
+
remediation: "Start REA with its browser scenario provider available.",
|
|
193
179
|
};
|
|
194
180
|
if (kind !== "browser-provider")
|
|
195
181
|
return null;
|
|
196
182
|
return policy.browserObservationEnabled === true
|
|
197
183
|
? { reason: "available", remediation: null }
|
|
198
184
|
: {
|
|
199
|
-
reason: "
|
|
200
|
-
remediation: "
|
|
185
|
+
reason: "provider_missing",
|
|
186
|
+
remediation: "Start REA with its browser observation provider available.",
|
|
201
187
|
};
|
|
202
188
|
};
|
|
203
189
|
const targetAvailability = ({ kind, targetKind, targetOpen, }) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
2
2
|
import { isDeepStrictEqual } from "node:util";
|
|
3
|
+
import { applyEdits, modify, parse as parseJsonc, printParseErrorCode, } from "jsonc-parser";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
const objectSchema = z.record(z.string(), z.unknown());
|
|
5
6
|
/** Compare parsed configuration values without depending on parser prototypes. */
|
|
@@ -13,15 +14,91 @@ const normalizeConfigurationValue = (value) => {
|
|
|
13
14
|
.sort(([left], [right]) => left.localeCompare(right))
|
|
14
15
|
.map(([key, nested]) => [key, normalizeConfigurationValue(nested)]));
|
|
15
16
|
};
|
|
16
|
-
/**
|
|
17
|
+
/** Return the top-level object used for MCP server registrations by a client. */
|
|
18
|
+
export const clientConfigurationServersKey = (format) => {
|
|
19
|
+
switch (format) {
|
|
20
|
+
case "toml":
|
|
21
|
+
return "mcp_servers";
|
|
22
|
+
case "opencode":
|
|
23
|
+
return "mcp";
|
|
24
|
+
case "vscode":
|
|
25
|
+
return "servers";
|
|
26
|
+
default:
|
|
27
|
+
return "mcpServers";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const parseDocument = (text, format) => {
|
|
31
|
+
if (format === "toml")
|
|
32
|
+
return objectSchema.parse(parseToml(text));
|
|
33
|
+
const errors = [];
|
|
34
|
+
const document = parseJsonc(text, errors, { allowTrailingComma: true });
|
|
35
|
+
const firstError = errors[0];
|
|
36
|
+
if (firstError !== undefined)
|
|
37
|
+
throw new SyntaxError(`Invalid JSON/JSONC at offset ${firstError.offset}: ${printParseErrorCode(firstError.error)}`);
|
|
38
|
+
return objectSchema.parse(document);
|
|
39
|
+
};
|
|
40
|
+
/** Parse a client document and reject malformed roots or MCP server tables. */
|
|
17
41
|
export const parseClientConfiguration = (text, format) => {
|
|
18
|
-
|
|
19
|
-
|
|
42
|
+
if (format === undefined || format === "unsupported")
|
|
43
|
+
throw new TypeError("client does not have a supported MCP config format");
|
|
44
|
+
const document = parseDocument(text, format);
|
|
45
|
+
const serversKey = clientConfigurationServersKey(format);
|
|
20
46
|
const value = document[serversKey];
|
|
21
47
|
const servers = value === undefined ? {} : objectSchema.parse(value);
|
|
22
48
|
return { document, servers, serversKey };
|
|
23
49
|
};
|
|
24
|
-
/** Serialize a validated client document
|
|
25
|
-
export const serializeClientConfiguration = (document, format) =>
|
|
26
|
-
|
|
27
|
-
|
|
50
|
+
/** Serialize a validated client document, retaining JSONC comments. */
|
|
51
|
+
export const serializeClientConfiguration = (document, format, originalText, editedServerName) => {
|
|
52
|
+
if (format === undefined || format === "unsupported")
|
|
53
|
+
throw new TypeError("client does not have a supported MCP config format");
|
|
54
|
+
if (format === "toml")
|
|
55
|
+
return stringifyToml(document);
|
|
56
|
+
if (originalText !== undefined && editedServerName !== undefined) {
|
|
57
|
+
const serversKey = clientConfigurationServersKey(format);
|
|
58
|
+
const servers = objectSchema.parse(document[serversKey] ?? {});
|
|
59
|
+
const editedValue = Object.hasOwn(servers, editedServerName)
|
|
60
|
+
? servers[editedServerName]
|
|
61
|
+
: undefined;
|
|
62
|
+
const edits = modify(originalText, [serversKey, editedServerName], editedValue, {
|
|
63
|
+
formattingOptions: { insertSpaces: true, tabSize: 2, eol: "\n" },
|
|
64
|
+
});
|
|
65
|
+
return applyEdits(originalText, edits);
|
|
66
|
+
}
|
|
67
|
+
return `${JSON.stringify(document, null, 2)}\n`;
|
|
68
|
+
};
|
|
69
|
+
/** Build the stdio entry shape expected by one client's configuration dialect. */
|
|
70
|
+
export const clientRegistrationEntry = (format, command, environment) => {
|
|
71
|
+
const [executable = "rea", ...args] = command;
|
|
72
|
+
switch (format) {
|
|
73
|
+
case "opencode":
|
|
74
|
+
return {
|
|
75
|
+
type: "local",
|
|
76
|
+
command: [...command],
|
|
77
|
+
enabled: true,
|
|
78
|
+
...(Object.keys(environment).length === 0
|
|
79
|
+
? {}
|
|
80
|
+
: { environment: { ...environment } }),
|
|
81
|
+
};
|
|
82
|
+
case "vscode":
|
|
83
|
+
return {
|
|
84
|
+
type: "stdio",
|
|
85
|
+
command: executable,
|
|
86
|
+
args,
|
|
87
|
+
...(Object.keys(environment).length === 0 ? {} : { env: environment }),
|
|
88
|
+
};
|
|
89
|
+
case "copilot_cli":
|
|
90
|
+
return {
|
|
91
|
+
type: "stdio",
|
|
92
|
+
command: executable,
|
|
93
|
+
args,
|
|
94
|
+
tools: ["*"],
|
|
95
|
+
...(Object.keys(environment).length === 0 ? {} : { env: environment }),
|
|
96
|
+
};
|
|
97
|
+
default:
|
|
98
|
+
return {
|
|
99
|
+
command: executable,
|
|
100
|
+
args,
|
|
101
|
+
...(Object.keys(environment).length === 0 ? {} : { env: environment }),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { basename, isAbsolute, resolve } from "node:path";
|
|
2
|
+
import { valid } from "semver";
|
|
3
|
+
import { PRODUCT_IDENTITY } from "../identity.js";
|
|
4
|
+
/** Check that one parsed command points to REA's MCP entry point. */
|
|
5
|
+
export const isOwnedClientRegistrationCommand = (command, currentCommandPath = resolve(process.argv[1] ?? "unknown")) => {
|
|
6
|
+
if (command.length === 3 &&
|
|
7
|
+
command[2] === "mcp" &&
|
|
8
|
+
resolve(command[0] ?? "") === resolve(process.execPath) &&
|
|
9
|
+
resolve(command[1] ?? "") === currentCommandPath)
|
|
10
|
+
return true;
|
|
11
|
+
if (command.length === 2 && command[1] === "mcp") {
|
|
12
|
+
const executable = command[0] ?? "";
|
|
13
|
+
if (executable === PRODUCT_IDENTITY.cliBinary ||
|
|
14
|
+
(isAbsolute(executable) &&
|
|
15
|
+
basename(executable) === PRODUCT_IDENTITY.cliBinary) ||
|
|
16
|
+
resolve(executable) === currentCommandPath)
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (command.length !== 4 ||
|
|
20
|
+
command[0] !== "npx" ||
|
|
21
|
+
command[1] !== "-y" ||
|
|
22
|
+
command[3] !== "mcp")
|
|
23
|
+
return false;
|
|
24
|
+
const packageReference = command[2] ?? "";
|
|
25
|
+
if (packageReference === PRODUCT_IDENTITY.packageName ||
|
|
26
|
+
packageReference === PRODUCT_IDENTITY.packageSpecifier ||
|
|
27
|
+
packageReference === PRODUCT_IDENTITY.registrationPackageSpecifier)
|
|
28
|
+
return true;
|
|
29
|
+
const versionPrefix = `${PRODUCT_IDENTITY.packageName}@`;
|
|
30
|
+
return (packageReference.startsWith(versionPrefix) &&
|
|
31
|
+
valid(packageReference.slice(versionPrefix.length)) !== null);
|
|
32
|
+
};
|