rea-agents 3.2.1 → 4.0.1
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
package/dist/cliSetup.js
CHANGED
|
@@ -9,37 +9,36 @@ const promptStreams = {
|
|
|
9
9
|
output: process.stderr,
|
|
10
10
|
withGuide: true,
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
/** Select agent targets, then review the resolved plan before consent. */
|
|
13
|
+
export const confirmInteractiveSetup = async (actions, accessible, context) => {
|
|
14
|
+
if (context?.stage === "select" || context === undefined) {
|
|
15
|
+
intro("REA setup", promptStreams);
|
|
16
|
+
writeLine("│ Understand local apps and binaries from your terminal or agent.");
|
|
17
|
+
renderDetectedSummary(context?.clientStates ?? []);
|
|
18
|
+
renderKeyboardHelp(accessible);
|
|
19
|
+
}
|
|
20
|
+
if (context?.stage === "select") {
|
|
21
|
+
const selected = await selectSetupActions(actions, accessible, context);
|
|
22
|
+
return selected === undefined
|
|
23
|
+
? cancelledDecision()
|
|
24
|
+
: { approved: false, selectedActionIds: selected };
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
renderPreflight(
|
|
26
|
+
if (actions.length === 0)
|
|
27
|
+
return { approved: true, selectedActionIds: [] };
|
|
28
|
+
renderPreflight(actions);
|
|
29
29
|
const approved = await confirm({
|
|
30
30
|
...promptStreams,
|
|
31
|
-
message:
|
|
31
|
+
message: actions.length === 1
|
|
32
32
|
? "Apply this change?"
|
|
33
|
-
: `Apply these ${String(
|
|
33
|
+
: `Apply these ${String(actions.length)} changes?`,
|
|
34
34
|
initialValue: true,
|
|
35
35
|
active: "Yes, apply",
|
|
36
36
|
inactive: "No, cancel",
|
|
37
|
+
vertical: accessible,
|
|
37
38
|
});
|
|
38
|
-
if (isCancel(approved) || !approved)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
return { approved: true, selectedActionIds };
|
|
39
|
+
if (isCancel(approved) || !approved)
|
|
40
|
+
return cancelledDecision();
|
|
41
|
+
return { approved: true, selectedActionIds: actions.map(({ id }) => id) };
|
|
43
42
|
};
|
|
44
43
|
/** Render stable, append-only progress for real setup operations. */
|
|
45
44
|
export const renderSetupProgress = (event) => {
|
|
@@ -66,156 +65,101 @@ export const renderInteractiveSetupResult = (result) => {
|
|
|
66
65
|
: `Restart ${changedClients.join(", ")} to load REA.`, promptStreams);
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
|
-
if (result.status === "planned")
|
|
68
|
+
if (result.status === "planned" || result.status === "cancelled")
|
|
70
69
|
return;
|
|
71
70
|
writeLine(`! ${result.remediation ?? "Setup needs attention."}`);
|
|
72
|
-
outro(
|
|
73
|
-
};
|
|
74
|
-
const selectSetupActions = async (actions, accessible) => {
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
: await selectCapabilities(capabilities, preselectedCapabilityIds);
|
|
82
|
-
if (selectedCapabilities === undefined)
|
|
83
|
-
return undefined;
|
|
84
|
-
const selectedCapabilityIds = new Set(selectedCapabilities);
|
|
85
|
-
const bundledSkillAction = componentActions.find(({ kind }) => kind === "install_skill");
|
|
86
|
-
const selectedActionIds = componentActions
|
|
87
|
-
.filter(({ id }) => id !== bundledSkillAction?.id && selectedCapabilityIds.has(id))
|
|
88
|
-
.map(({ id }) => id);
|
|
89
|
-
if (!selectedCapabilityIds.has(agentIntegrationCapabilityId))
|
|
90
|
-
return selectedActionIds;
|
|
91
|
-
const bundledSkillId = bundledSkillAction === undefined ? undefined : bundledSkillAction.id;
|
|
92
|
-
if (clientActions.length === 0)
|
|
93
|
-
return [
|
|
94
|
-
...(bundledSkillId === undefined ? [] : [bundledSkillId]),
|
|
95
|
-
...selectedActionIds,
|
|
96
|
-
];
|
|
97
|
-
const preselectedClientIds = clientActions.map(({ id }) => id);
|
|
98
|
-
const selectedClients = accessible
|
|
99
|
-
? await selectClientsAccessibly(clientActions, preselectedClientIds)
|
|
100
|
-
: await selectClients(clientActions, preselectedClientIds);
|
|
101
|
-
if (selectedClients === undefined)
|
|
71
|
+
outro(`Run \`${cliInvocation()} doctor\` for the remaining checks.`, promptStreams);
|
|
72
|
+
};
|
|
73
|
+
const selectSetupActions = async (actions, accessible, context) => {
|
|
74
|
+
const clientStates = context.clientStates.filter(({ client }) => client.format !== "unsupported");
|
|
75
|
+
const initial = new Set(context.selectedClientIds);
|
|
76
|
+
const selectedClientIds = accessible
|
|
77
|
+
? await selectClientsAccessibly(clientStates, initial)
|
|
78
|
+
: await selectClients(clientStates, initial);
|
|
79
|
+
if (selectedClientIds === undefined)
|
|
102
80
|
return undefined;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
hint: clientActions.length === 0
|
|
124
|
-
? "MCP registrations are aligned; installs the matching bundled skill"
|
|
125
|
-
: `${String(clientActions.length)} detected ${clientActions.length === 1 ? "agent" : "agents"}; installs the bundled skill when needed`,
|
|
126
|
-
},
|
|
127
|
-
]),
|
|
128
|
-
...componentActions
|
|
129
|
-
.filter(({ kind }) => kind !== "install_skill")
|
|
130
|
-
.map((action) => ({
|
|
131
|
-
id: action.id,
|
|
132
|
-
label: `${action.label} (${actionModality(action)})`,
|
|
133
|
-
hint: `${action.operation} · ${action.target}`,
|
|
134
|
-
})),
|
|
135
|
-
];
|
|
136
|
-
const selectCapabilities = async (capabilities, initialValues) => {
|
|
137
|
-
const selection = await multiselect({
|
|
138
|
-
...promptStreams,
|
|
139
|
-
message: "What should REA set up?",
|
|
140
|
-
options: capabilities.map((capability) => ({
|
|
141
|
-
value: capability.id,
|
|
142
|
-
label: capability.label,
|
|
143
|
-
hint: capability.hint,
|
|
144
|
-
})),
|
|
145
|
-
initialValues: [...initialValues],
|
|
146
|
-
required: false,
|
|
147
|
-
maxItems: Math.max(3, Math.min(capabilities.length, (process.stderr.rows ?? 24) - 8)),
|
|
148
|
-
showInstructions: true,
|
|
149
|
-
});
|
|
150
|
-
return isCancel(selection) ? undefined : selection;
|
|
151
|
-
};
|
|
152
|
-
const selectCapabilitiesAccessibly = async (capabilities, preselectedIds) => {
|
|
153
|
-
const preselected = new Set(preselectedIds);
|
|
154
|
-
const selected = [];
|
|
155
|
-
for (const capability of capabilities) {
|
|
81
|
+
const selectedActionIds = selectedClientIds.map((id) => `configure_client:${id}`);
|
|
82
|
+
const skill = actions.find(({ kind }) => kind === "install_skill");
|
|
83
|
+
if (skill !== undefined) {
|
|
84
|
+
if (selectedClientIds.length > 0)
|
|
85
|
+
selectedActionIds.push(skill.id);
|
|
86
|
+
else {
|
|
87
|
+
const included = await confirm({
|
|
88
|
+
...promptStreams,
|
|
89
|
+
message: "Install the guided REA skill for CLI use?",
|
|
90
|
+
initialValue: false,
|
|
91
|
+
vertical: accessible,
|
|
92
|
+
});
|
|
93
|
+
if (isCancel(included))
|
|
94
|
+
return undefined;
|
|
95
|
+
if (included)
|
|
96
|
+
selectedActionIds.push(skill.id);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const hopper = actions.find(({ kind }) => kind === "install_hopper");
|
|
100
|
+
if (hopper !== undefined) {
|
|
156
101
|
const included = await confirm({
|
|
157
102
|
...promptStreams,
|
|
158
|
-
message:
|
|
159
|
-
initialValue:
|
|
160
|
-
vertical:
|
|
103
|
+
message: "Install Hopper for deep binary analysis?",
|
|
104
|
+
initialValue: false,
|
|
105
|
+
vertical: accessible,
|
|
161
106
|
});
|
|
162
107
|
if (isCancel(included))
|
|
163
108
|
return undefined;
|
|
164
109
|
if (included)
|
|
165
|
-
|
|
110
|
+
selectedActionIds.push(hopper.id);
|
|
166
111
|
}
|
|
167
|
-
return
|
|
168
|
-
};
|
|
169
|
-
const
|
|
112
|
+
return selectedActionIds;
|
|
113
|
+
};
|
|
114
|
+
const clientHint = (state) => state.configured
|
|
115
|
+
? "REA already configured · selected from existing configuration"
|
|
116
|
+
: state.status === "invalid"
|
|
117
|
+
? "Existing configuration needs repair before setup"
|
|
118
|
+
: state.detected
|
|
119
|
+
? "Detected · choose to configure"
|
|
120
|
+
: "Not detected · configuration is still available";
|
|
121
|
+
const selectClients = async (states, initial) => {
|
|
122
|
+
if (states.length === 0)
|
|
123
|
+
return [];
|
|
170
124
|
const selection = await multiselect({
|
|
171
125
|
...promptStreams,
|
|
172
126
|
message: "Which agents should use REA?",
|
|
173
|
-
options:
|
|
174
|
-
value:
|
|
175
|
-
label:
|
|
176
|
-
hint:
|
|
127
|
+
options: states.map((state) => ({
|
|
128
|
+
value: state.client.name,
|
|
129
|
+
label: clientDisplayNames.get(state.client.name) ?? state.client.name,
|
|
130
|
+
hint: clientHint(state),
|
|
177
131
|
})),
|
|
178
|
-
initialValues:
|
|
132
|
+
initialValues: states
|
|
133
|
+
.filter(({ client }) => initial.has(client.name))
|
|
134
|
+
.map(({ client }) => client.name),
|
|
179
135
|
required: false,
|
|
180
|
-
maxItems: Math.max(3, Math.min(
|
|
136
|
+
maxItems: Math.max(3, Math.min(states.length, (process.stderr.rows ?? 24) - 8)),
|
|
181
137
|
showInstructions: true,
|
|
182
138
|
});
|
|
183
139
|
return isCancel(selection) ? undefined : selection;
|
|
184
140
|
};
|
|
185
|
-
const selectClientsAccessibly = async (
|
|
186
|
-
const preselected = new Set(initialValues);
|
|
141
|
+
const selectClientsAccessibly = async (states, initial) => {
|
|
187
142
|
const selected = [];
|
|
188
|
-
for (const
|
|
143
|
+
for (const state of states) {
|
|
189
144
|
const included = await confirm({
|
|
190
145
|
...promptStreams,
|
|
191
|
-
message: `Configure ${
|
|
192
|
-
initialValue:
|
|
146
|
+
message: `Configure ${clientDisplayNames.get(state.client.name) ?? state.client.name}? ${clientHint(state)}`,
|
|
147
|
+
initialValue: initial.has(state.client.name),
|
|
193
148
|
vertical: true,
|
|
194
149
|
});
|
|
195
150
|
if (isCancel(included))
|
|
196
151
|
return undefined;
|
|
197
152
|
if (included)
|
|
198
|
-
selected.push(
|
|
153
|
+
selected.push(state.client.name);
|
|
199
154
|
}
|
|
200
155
|
return selected;
|
|
201
156
|
};
|
|
202
|
-
const
|
|
203
|
-
|
|
157
|
+
const renderDetectedSummary = (states) => {
|
|
158
|
+
const detected = states.filter(({ detected }) => detected);
|
|
204
159
|
writeLine("│");
|
|
205
|
-
writeLine(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
};
|
|
209
|
-
const renderDetectedSummary = (actions) => {
|
|
210
|
-
const clients = actions.filter(({ kind }) => kind === "configure_client");
|
|
211
|
-
writeLine("│");
|
|
212
|
-
if (clients.length === 0) {
|
|
213
|
-
writeLine("◆ No agent integrations need configuration");
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
writeLine(`◆ Found ${String(clients.length)} supported ${clients.length === 1 ? "agent" : "agents"}`);
|
|
217
|
-
writeLine(`│ ${humanList(clients.map(({ label }) => label))}`);
|
|
218
|
-
}
|
|
160
|
+
writeLine(detected.length === 0
|
|
161
|
+
? "◆ No agents detected. Choose any supported agent below."
|
|
162
|
+
: `◆ Detected: ${humanList(detected.map(({ client }) => clientDisplayNames.get(client.name) ?? client.name))}`);
|
|
219
163
|
};
|
|
220
164
|
const renderKeyboardHelp = (accessible) => {
|
|
221
165
|
writeLine("│");
|
|
@@ -223,6 +167,7 @@ const renderKeyboardHelp = (accessible) => {
|
|
|
223
167
|
? "│ Keys: Enter answer · Ctrl-C cancel"
|
|
224
168
|
: "│ Keys: ↑/↓ navigate · Space toggle · Enter confirm · Ctrl-C cancel");
|
|
225
169
|
};
|
|
170
|
+
const cliInvocation = () => process.env.npm_command === "exec" ? "npx rea-agents" : "rea";
|
|
226
171
|
const renderReadyCapabilities = (result, readyClients) => {
|
|
227
172
|
writeLine("◆ What you can do now");
|
|
228
173
|
const providers = readyProviders(result);
|
|
@@ -232,8 +177,7 @@ const renderReadyCapabilities = (result, readyClients) => {
|
|
|
232
177
|
writeLine(`│ Agent access: ${humanList(readyClients)}`);
|
|
233
178
|
if (result.doctor.identity?.skill.state === "aligned")
|
|
234
179
|
writeLine("│ Guided reverse-engineering workflows: installed");
|
|
235
|
-
|
|
236
|
-
writeLine("│ CLI: rea analyze /path/to/app");
|
|
180
|
+
writeLine(`│ CLI: ${cliInvocation()} ${providers.length > 0 ? "analyze /path/to/app" : "capabilities"}`);
|
|
237
181
|
const firstClient = readyClients[0];
|
|
238
182
|
if (firstClient !== undefined)
|
|
239
183
|
writeLine(`│ Try in ${firstClient}: "Explain how a feature works in /path/to/app and show the evidence."`);
|
|
@@ -244,23 +188,8 @@ const readyAgentClients = (result, changedClients) => {
|
|
|
244
188
|
.map(({ client }) => clientDisplayNames.get(client) ?? client);
|
|
245
189
|
return [...new Set([...alignedClients, ...changedClients])];
|
|
246
190
|
};
|
|
247
|
-
const readyProviders = (result) =>
|
|
248
|
-
const providers = [
|
|
249
|
-
...(result.doctor.hopperPath === undefined ? [] : ["Hopper"]),
|
|
250
|
-
...(result.doctor.providerInspections ?? [])
|
|
251
|
-
.filter(({ available }) => available)
|
|
252
|
-
.map(({ id }) => displayProviderId(id)),
|
|
253
|
-
];
|
|
254
|
-
return [...new Set(providers)];
|
|
255
|
-
};
|
|
191
|
+
const readyProviders = (result) => result.doctor.availableProviders.map(displayProviderId);
|
|
256
192
|
const displayProviderId = (id) => id.length === 0 ? id : `${id[0]?.toUpperCase() ?? ""}${id.slice(1)}`;
|
|
257
|
-
const actionModality = (action) => {
|
|
258
|
-
if (action.kind === "configure_client")
|
|
259
|
-
return "MCP";
|
|
260
|
-
if (action.kind === "install_hopper")
|
|
261
|
-
return "provider";
|
|
262
|
-
return "skill";
|
|
263
|
-
};
|
|
264
193
|
const humanList = (values) => {
|
|
265
194
|
if (values.length < 2)
|
|
266
195
|
return values[0] ?? "";
|
|
@@ -295,6 +224,7 @@ const cancelledDecision = () => {
|
|
|
295
224
|
return {
|
|
296
225
|
approved: false,
|
|
297
226
|
selectedActionIds: [],
|
|
227
|
+
cancelled: true,
|
|
298
228
|
};
|
|
299
229
|
};
|
|
300
230
|
const writeLine = (line) => {
|
|
@@ -3,8 +3,7 @@ import { isAbsolute } from "node:path";
|
|
|
3
3
|
import { ConfigurationError } from "../domain/errors.js";
|
|
4
4
|
import { err, ok } from "../domain/result.js";
|
|
5
5
|
import { analysisProviderSelectorSchema } from "../contracts/providerSelection.js";
|
|
6
|
-
const environmentSchema = z
|
|
7
|
-
.object({
|
|
6
|
+
const environmentSchema = z.object({
|
|
8
7
|
REA_ANALYSIS_PROVIDER: analysisProviderSelectorSchema.default("auto"),
|
|
9
8
|
GHIDRA_INSTALL_DIR: z
|
|
10
9
|
.string()
|
|
@@ -23,87 +22,12 @@ const environmentSchema = z
|
|
|
23
22
|
.optional(),
|
|
24
23
|
HOPPER_LAUNCHER_PATH: z.string().min(1).optional(),
|
|
25
24
|
HOPPER_TARGET_PATH: z.string().min(1).optional(),
|
|
26
|
-
HOPPER_TARGET_KIND: z
|
|
27
|
-
.enum(["executable", "database"])
|
|
28
|
-
.default("executable"),
|
|
25
|
+
HOPPER_TARGET_KIND: z.enum(["executable", "database"]).default("executable"),
|
|
29
26
|
HOPPER_LOADER_ARGS_JSON: z.string().optional(),
|
|
30
27
|
REA_LOG_LEVEL: z
|
|
31
28
|
.enum(["trace", "debug", "info", "warn", "error", "fatal", "silent"])
|
|
32
29
|
.default("info"),
|
|
33
|
-
REA_PROCESS_CAPTURE_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
34
|
-
REA_PROCESS_CAPTURE_AUTO_GRANT: z.enum(["true", "false"]).default("true"),
|
|
35
|
-
REA_ARTIFACT_NATIVE_MOUNT_ENABLED: z
|
|
36
|
-
.enum(["true", "false"])
|
|
37
|
-
.default("false"),
|
|
38
|
-
REA_ARTIFACT_INTEGRITY_CONTINUE_ENABLED: z
|
|
39
|
-
.enum(["true", "false"])
|
|
40
|
-
.default("false"),
|
|
41
|
-
REA_PROCESS_ALLOW_EXTERNAL_NETWORK: z
|
|
42
|
-
.enum(["true", "false"])
|
|
43
|
-
.default("false"),
|
|
44
|
-
REA_PROCESS_EXECUTABLE_ROOTS_JSON: z.string().default("[]"),
|
|
45
|
-
REA_PROCESS_WORKING_ROOTS_JSON: z.string().default("[]"),
|
|
46
|
-
REA_PROCESS_ALLOWED_ENV_JSON: z.string().default("[]"),
|
|
47
30
|
REA_REFERENCE_SECRET_PATTERNS_JSON: z.string().default("[]"),
|
|
48
|
-
REA_BROWSER_OBSERVE_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
49
|
-
REA_BROWSER_CDP_ENDPOINTS_JSON: z.string().default("[]"),
|
|
50
|
-
REA_BROWSER_ALLOWED_ORIGINS_JSON: z.string().default("[]"),
|
|
51
|
-
REA_BROWSER_SCENARIO_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
52
|
-
REA_BROWSER_SCENARIO_AUTO_GRANT: z.enum(["true", "false"]).default("false"),
|
|
53
|
-
REA_BROWSER_SCENARIO_EXECUTABLE_ROOTS_JSON: z.string().default("[]"),
|
|
54
|
-
REA_BROWSER_SCENARIO_CDP_ENDPOINTS_JSON: z.string().default("[]"),
|
|
55
|
-
REA_BROWSER_SCENARIO_ALLOWED_ORIGINS_JSON: z.string().default("[]"),
|
|
56
|
-
REA_BROWSER_SCENARIO_ALLOWED_ENV_JSON: z.string().default("[]"),
|
|
57
|
-
REA_ELECTRON_OBSERVE_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
58
|
-
REA_ELECTRON_AUTOMATE_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
59
|
-
REA_ELECTRON_AUTOMATE_AUTO_GRANT: z
|
|
60
|
-
.enum(["true", "false"])
|
|
61
|
-
.default("false"),
|
|
62
|
-
REA_ELECTRON_AUTOMATE_EXECUTABLE_ROOTS_JSON: z.string().default("[]"),
|
|
63
|
-
REA_ELECTRON_AUTOMATE_APPLICATION_ROOTS_JSON: z.string().default("[]"),
|
|
64
|
-
REA_V8_INSPECTOR_OBSERVE_ENABLED: z
|
|
65
|
-
.enum(["true", "false"])
|
|
66
|
-
.default("false"),
|
|
67
|
-
REA_JAVASCRIPT_REPLAY_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
68
|
-
REA_JAVASCRIPT_REPLAY_ROOTS_JSON: z.string().default("[]"),
|
|
69
|
-
REA_JAVASCRIPT_REPLAY_NODE_PATH: z
|
|
70
|
-
.string()
|
|
71
|
-
.min(1)
|
|
72
|
-
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_NODE_PATH must be absolute")
|
|
73
|
-
.default(process.execPath),
|
|
74
|
-
REA_JAVASCRIPT_REPLAY_BWRAP_PATH: z
|
|
75
|
-
.string()
|
|
76
|
-
.min(1)
|
|
77
|
-
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_BWRAP_PATH must be absolute")
|
|
78
|
-
.default("/usr/bin/bwrap"),
|
|
79
|
-
REA_JAVASCRIPT_REPLAY_SYSTEMD_RUN_PATH: z
|
|
80
|
-
.string()
|
|
81
|
-
.min(1)
|
|
82
|
-
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_SYSTEMD_RUN_PATH must be absolute")
|
|
83
|
-
.default("/usr/bin/systemd-run"),
|
|
84
|
-
REA_JAVASCRIPT_REPLAY_SYSTEMCTL_PATH: z
|
|
85
|
-
.string()
|
|
86
|
-
.min(1)
|
|
87
|
-
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_SYSTEMCTL_PATH must be absolute")
|
|
88
|
-
.default("/usr/bin/systemctl"),
|
|
89
|
-
REA_JAVASCRIPT_REPLAY_SHELL_PATH: z
|
|
90
|
-
.string()
|
|
91
|
-
.min(1)
|
|
92
|
-
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_SHELL_PATH must be absolute")
|
|
93
|
-
.default("/usr/bin/bash"),
|
|
94
|
-
REA_MANAGED_RUNTIME_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
95
|
-
REA_MANAGED_RUNTIME_ROOTS_JSON: z.string().default("[]"),
|
|
96
|
-
REA_MANAGED_RUNTIME_EXECUTABLE_PATH: z
|
|
97
|
-
.string()
|
|
98
|
-
.min(1)
|
|
99
|
-
.refine(isAbsolute, "REA_MANAGED_RUNTIME_EXECUTABLE_PATH must be absolute")
|
|
100
|
-
.default("/usr/bin/dotnet"),
|
|
101
|
-
REA_PERMISSION_PROJECT_ROOT: z.string().min(1).optional(),
|
|
102
|
-
REA_PERMISSION_PROJECT_STORE: z.string().min(1).optional(),
|
|
103
|
-
})
|
|
104
|
-
.refine((value) => (value.REA_PERMISSION_PROJECT_ROOT === undefined) ===
|
|
105
|
-
(value.REA_PERMISSION_PROJECT_STORE === undefined), {
|
|
106
|
-
message: "REA_PERMISSION_PROJECT_ROOT and REA_PERMISSION_PROJECT_STORE must be configured together",
|
|
107
31
|
});
|
|
108
32
|
export const parseEnvironment = (environment) => {
|
|
109
33
|
const parsed = environmentSchema.safeParse(environment);
|
|
@@ -1,123 +1,32 @@
|
|
|
1
1
|
import { ConfigurationError } from "../domain/errors.js";
|
|
2
2
|
import { ok } from "../domain/result.js";
|
|
3
3
|
import { parseEnvironment } from "./environment.js";
|
|
4
|
-
import { parseStringArray,
|
|
5
|
-
import { permissionScope, administratorGrants } from "./permissions.js";
|
|
6
|
-
import { appendElectronAutomationCeiling, parseElectronAutomationPolicy, } from "./electronAutomation.js";
|
|
7
|
-
import { appendBrowserScenarioCeiling, parseBrowserScenarioPolicy, } from "./browserScenario.js";
|
|
8
|
-
import { appendManagedRuntimeCeiling, parseManagedRuntimePolicy, } from "./managedRuntime.js";
|
|
9
|
-
import { appendJavaScriptReplayCeiling, parseJavaScriptReplayPolicy, } from "./javascriptReplay.js";
|
|
10
|
-
import { appendProcessCaptureCeiling, parseProcessExecutionPolicy, } from "./processCapture.js";
|
|
11
|
-
import { appendPassiveObservationCeilings, parsePassiveObservationPolicies, } from "./passiveObservation.js";
|
|
12
|
-
const DEFAULT_HOPPER_LAUNCHER_PATH = "/Applications/Hopper Disassembler.app/Contents/MacOS/hopper";
|
|
4
|
+
import { parseStringArray, parseLoaderArgs } from "./parsers.js";
|
|
13
5
|
const defaultHopperLauncherPath = () => process.platform === "linux"
|
|
14
6
|
? "/opt/hopper/bin/Hopper"
|
|
15
|
-
:
|
|
16
|
-
|
|
7
|
+
: "/Applications/Hopper Disassembler.app/Contents/MacOS/hopper";
|
|
8
|
+
/** Parse provider configuration and runtime prerequisites at the composition root. */
|
|
9
|
+
export const parseConfig = (environment) => {
|
|
10
|
+
const parsed = parseEnvironment(environment);
|
|
11
|
+
if (!parsed.ok)
|
|
12
|
+
return parsed;
|
|
13
|
+
const env = parsed.value;
|
|
17
14
|
const loaderArgs = parseLoaderArgs(env.HOPPER_LOADER_ARGS_JSON);
|
|
18
15
|
if (!loaderArgs.ok)
|
|
19
16
|
return loaderArgs;
|
|
20
17
|
const secretPatterns = parseStringArray(env.REA_REFERENCE_SECRET_PATTERNS_JSON, "REA_REFERENCE_SECRET_PATTERNS_JSON");
|
|
21
18
|
if (!secretPatterns.ok)
|
|
22
19
|
return secretPatterns;
|
|
23
|
-
const managedRuntimeRoots = parseAbsoluteRoots(env.REA_MANAGED_RUNTIME_ROOTS_JSON, "REA_MANAGED_RUNTIME_ROOTS_JSON");
|
|
24
|
-
if (!managedRuntimeRoots.ok)
|
|
25
|
-
return managedRuntimeRoots;
|
|
26
20
|
return ok({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
analysisProvider: env.REA_ANALYSIS_PROVIDER,
|
|
22
|
+
ghidraInstallDir: env.GHIDRA_INSTALL_DIR,
|
|
23
|
+
ghidraJavaHome: env.JAVA_HOME,
|
|
24
|
+
ilspyCmdPath: env.REA_ILSPY_CMD_PATH,
|
|
25
|
+
hopperLauncherPath: env.HOPPER_LAUNCHER_PATH ?? defaultHopperLauncherPath(),
|
|
26
|
+
hopperTargetPath: env.HOPPER_TARGET_PATH,
|
|
27
|
+
hopperTargetKind: env.HOPPER_TARGET_KIND,
|
|
28
|
+
hopperLoaderArgs: loaderArgs.value,
|
|
29
|
+
logLevel: env.REA_LOG_LEVEL,
|
|
30
|
+
referenceSourcePolicy: { secretPatterns: secretPatterns.value },
|
|
30
31
|
});
|
|
31
32
|
};
|
|
32
|
-
const appendNativeMountCeiling = (ceilings, env) => {
|
|
33
|
-
if (env.REA_ARTIFACT_NATIVE_MOUNT_ENABLED === "true")
|
|
34
|
-
ceilings.push(permissionScope("native_mount", [], { mount: true }));
|
|
35
|
-
};
|
|
36
|
-
const buildPermissionCeilings = (env, arrays, policies) => {
|
|
37
|
-
const ceilings = [
|
|
38
|
-
permissionScope("artifact_extract", ["/"]),
|
|
39
|
-
];
|
|
40
|
-
appendProcessCaptureCeiling(ceilings, policies.processCapture);
|
|
41
|
-
appendPassiveObservationCeilings(ceilings, policies.passiveObservation);
|
|
42
|
-
appendBrowserScenarioCeiling(ceilings, policies.browserScenario);
|
|
43
|
-
appendElectronAutomationCeiling(ceilings, policies.electronAutomation);
|
|
44
|
-
appendNativeMountCeiling(ceilings, env);
|
|
45
|
-
appendJavaScriptReplayCeiling(ceilings, policies.javascriptReplay);
|
|
46
|
-
appendManagedRuntimeCeiling(ceilings, policies.managedRuntime);
|
|
47
|
-
return ceilings;
|
|
48
|
-
};
|
|
49
|
-
const buildAppConfig = (env, arrays, permissionCeilings, policies) => ({
|
|
50
|
-
analysisProvider: env.REA_ANALYSIS_PROVIDER,
|
|
51
|
-
ghidraInstallDir: env.GHIDRA_INSTALL_DIR,
|
|
52
|
-
ghidraJavaHome: env.JAVA_HOME,
|
|
53
|
-
ilspyCmdPath: env.REA_ILSPY_CMD_PATH,
|
|
54
|
-
hopperLauncherPath: env.HOPPER_LAUNCHER_PATH ?? defaultHopperLauncherPath(),
|
|
55
|
-
hopperTargetPath: env.HOPPER_TARGET_PATH,
|
|
56
|
-
hopperTargetKind: env.HOPPER_TARGET_KIND,
|
|
57
|
-
hopperLoaderArgs: arrays.loaderArgs,
|
|
58
|
-
logLevel: env.REA_LOG_LEVEL,
|
|
59
|
-
processExecutionPolicy: policies.processCapture,
|
|
60
|
-
artifactNativeMountEnabled: env.REA_ARTIFACT_NATIVE_MOUNT_ENABLED === "true",
|
|
61
|
-
artifactIntegrityContinueEnabled: env.REA_ARTIFACT_INTEGRITY_CONTINUE_ENABLED === "true",
|
|
62
|
-
referenceSourcePolicy: {
|
|
63
|
-
secretPatterns: arrays.secretPatterns,
|
|
64
|
-
},
|
|
65
|
-
browserObservationPolicy: policies.passiveObservation.browser,
|
|
66
|
-
browserScenarioPolicy: policies.browserScenario,
|
|
67
|
-
electronObservationPolicy: policies.passiveObservation.electron,
|
|
68
|
-
electronAutomationPolicy: policies.electronAutomation,
|
|
69
|
-
v8InspectorObservationPolicy: policies.passiveObservation.v8Inspector,
|
|
70
|
-
javascriptReplayPolicy: policies.javascriptReplay,
|
|
71
|
-
managedRuntimePolicy: policies.managedRuntime,
|
|
72
|
-
permissionCeilings,
|
|
73
|
-
administratorPermissionGrants: administratorGrants(permissionCeilings.filter(({ capability }) => (capability !== "process_capture" ||
|
|
74
|
-
env.REA_PROCESS_CAPTURE_AUTO_GRANT === "true") &&
|
|
75
|
-
(capability !== "browser_automate" ||
|
|
76
|
-
env.REA_BROWSER_SCENARIO_AUTO_GRANT === "true") &&
|
|
77
|
-
(capability !== "electron_automate" ||
|
|
78
|
-
env.REA_ELECTRON_AUTOMATE_AUTO_GRANT === "true"))),
|
|
79
|
-
permissionProjectRoot: env.REA_PERMISSION_PROJECT_ROOT,
|
|
80
|
-
permissionProjectStore: env.REA_PERMISSION_PROJECT_STORE,
|
|
81
|
-
});
|
|
82
|
-
/**
|
|
83
|
-
* Parse provider and authority configuration once at the composition root.
|
|
84
|
-
* Explicit loader arguments override REA's header-derived defaults for a
|
|
85
|
-
* supported target, allowing callers to refine Hopper's loader behavior without
|
|
86
|
-
* bypassing REA's path and executable-header checks.
|
|
87
|
-
*/
|
|
88
|
-
export const parseConfig = (environment) => {
|
|
89
|
-
const envResult = parseEnvironment(environment);
|
|
90
|
-
if (!envResult.ok)
|
|
91
|
-
return envResult;
|
|
92
|
-
const arraysResult = parseAllArrays(envResult.value);
|
|
93
|
-
if (!arraysResult.ok)
|
|
94
|
-
return arraysResult;
|
|
95
|
-
const passiveObservationPolicies = parsePassiveObservationPolicies(envResult.value);
|
|
96
|
-
if (!passiveObservationPolicies.ok)
|
|
97
|
-
return passiveObservationPolicies;
|
|
98
|
-
const processCapturePolicy = parseProcessExecutionPolicy(envResult.value);
|
|
99
|
-
if (!processCapturePolicy.ok)
|
|
100
|
-
return processCapturePolicy;
|
|
101
|
-
const browserScenarioPolicy = parseBrowserScenarioPolicy(envResult.value);
|
|
102
|
-
if (!browserScenarioPolicy.ok)
|
|
103
|
-
return browserScenarioPolicy;
|
|
104
|
-
const electronAutomationPolicy = parseElectronAutomationPolicy(envResult.value);
|
|
105
|
-
if (!electronAutomationPolicy.ok)
|
|
106
|
-
return electronAutomationPolicy;
|
|
107
|
-
const javascriptReplayPolicy = parseJavaScriptReplayPolicy(envResult.value);
|
|
108
|
-
if (!javascriptReplayPolicy.ok)
|
|
109
|
-
return javascriptReplayPolicy;
|
|
110
|
-
const managedRuntimePolicy = parseManagedRuntimePolicy(envResult.value, arraysResult.value.managedRuntimeRoots);
|
|
111
|
-
if (!managedRuntimePolicy.ok)
|
|
112
|
-
return managedRuntimePolicy;
|
|
113
|
-
const policies = {
|
|
114
|
-
passiveObservation: passiveObservationPolicies.value,
|
|
115
|
-
processCapture: processCapturePolicy.value,
|
|
116
|
-
browserScenario: browserScenarioPolicy.value,
|
|
117
|
-
electronAutomation: electronAutomationPolicy.value,
|
|
118
|
-
javascriptReplay: javascriptReplayPolicy.value,
|
|
119
|
-
managedRuntime: managedRuntimePolicy.value,
|
|
120
|
-
};
|
|
121
|
-
const permissionCeilings = buildPermissionCeilings(envResult.value, arraysResult.value, policies);
|
|
122
|
-
return ok(buildAppConfig(envResult.value, arraysResult.value, permissionCeilings, policies));
|
|
123
|
-
};
|
package/dist/config/parsers.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { isAbsolute } from "node:path";
|
|
3
2
|
import { ConfigurationError } from "../domain/errors.js";
|
|
4
3
|
import { err, ok } from "../domain/result.js";
|
|
5
4
|
export const parseStringArray = (encoded, name) => {
|
|
@@ -15,28 +14,6 @@ export const parseStringArray = (encoded, name) => {
|
|
|
15
14
|
return err(new ConfigurationError(`${name} must be valid JSON`, { cause }));
|
|
16
15
|
}
|
|
17
16
|
};
|
|
18
|
-
/** Parse a JSON string array whose members must all be absolute paths. */
|
|
19
|
-
export const parseAbsoluteRoots = (encoded, name) => {
|
|
20
|
-
const parsed = parseStringArray(encoded, name);
|
|
21
|
-
if (!parsed.ok)
|
|
22
|
-
return parsed;
|
|
23
|
-
return parsed.value.some((root) => !isAbsolute(root))
|
|
24
|
-
? err(new ConfigurationError(`${name} must encode absolute roots`))
|
|
25
|
-
: parsed;
|
|
26
|
-
};
|
|
27
|
-
export const parseBrowserArray = (encoded, name, itemSchema) => {
|
|
28
|
-
try {
|
|
29
|
-
const parsed = z.array(itemSchema).safeParse(JSON.parse(encoded));
|
|
30
|
-
return parsed.success
|
|
31
|
-
? ok([...new Set(parsed.data)].sort())
|
|
32
|
-
: err(new ConfigurationError(`${name} must encode valid browser scopes`, {
|
|
33
|
-
cause: parsed.error,
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
catch (cause) {
|
|
37
|
-
return err(new ConfigurationError(`${name} must be valid JSON`, { cause }));
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
17
|
export const parseLoaderArgs = (encoded) => {
|
|
41
18
|
if (encoded === undefined)
|
|
42
19
|
return ok([]);
|