rea-agents 3.2.0 → 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
|
@@ -1,9 +1,134 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { PRODUCT_IDENTITY } from "../identity.js";
|
|
4
|
+
import { isOwnedClientRegistrationCommand } from "./ClientRegistrationIdentity.js";
|
|
4
5
|
import { linuxHopperInstallDisclosure, } from "./LinuxHopper.js";
|
|
5
6
|
import { macHopperInstallDisclosure } from "./MacHopper.js";
|
|
6
|
-
/**
|
|
7
|
+
/** Discover supported clients and current registrations without mutation. */
|
|
8
|
+
export const discoverSetupState = async (input) => {
|
|
9
|
+
const initialDoctor = await input.host.doctor(input.doctorScope);
|
|
10
|
+
const linuxHopperRepairNeeded = initialDoctor.checks.some(({ name, ok, detail }) => !ok &&
|
|
11
|
+
(name === "hopper-demo-runtime" ||
|
|
12
|
+
(name === "hopper-version" && detail === "/opt/hopper/bin/Hopper")));
|
|
13
|
+
const linuxDistribution = input.host.platform === "linux"
|
|
14
|
+
? await input.host.linuxDistribution()
|
|
15
|
+
: undefined;
|
|
16
|
+
const hopperInstallSupported = (input.host.platform === "darwin" &&
|
|
17
|
+
majorVersion((await input.host.macosVersion()) ?? "0") >= 12) ||
|
|
18
|
+
(input.host.platform === "linux" && linuxDistribution?.supported === true);
|
|
19
|
+
const installHopper = input.forceHopperInstall ||
|
|
20
|
+
(hopperInstallSupported &&
|
|
21
|
+
input.proposeHopper &&
|
|
22
|
+
(Object.keys(input.providerEnvironment).length === 0 ||
|
|
23
|
+
linuxHopperRepairNeeded));
|
|
24
|
+
const [clients, detectedClients, skillNeedsInstall] = await Promise.all([
|
|
25
|
+
input.host.supportedClients?.() ?? input.host.detectedClients(),
|
|
26
|
+
input.host.detectedClients(),
|
|
27
|
+
input.host.skillNeedsInstall(),
|
|
28
|
+
]);
|
|
29
|
+
const detectedIds = new Set(detectedClients.map(({ name }) => name));
|
|
30
|
+
const registrations = initialDoctor.identity?.registrations ?? [];
|
|
31
|
+
const registrationByClient = new Map(registrations.map((registration) => [registration.client, registration]));
|
|
32
|
+
const clientStates = clients.map((client) => {
|
|
33
|
+
const registration = registrationByClient.get(client.name);
|
|
34
|
+
const ownedRegistration = (registration?.state === "aligned" || registration?.state === "stale") &&
|
|
35
|
+
isOwnedClientRegistrationCommand(registration.command);
|
|
36
|
+
const configured = ownedRegistration;
|
|
37
|
+
const status = registration?.state === "invalid"
|
|
38
|
+
? "invalid"
|
|
39
|
+
: ownedRegistration && registration.state === "aligned"
|
|
40
|
+
? "configured"
|
|
41
|
+
: ownedRegistration && registration.state === "stale"
|
|
42
|
+
? "needs_configuration"
|
|
43
|
+
: detectedIds.has(client.name)
|
|
44
|
+
? "needs_configuration"
|
|
45
|
+
: "missing";
|
|
46
|
+
return {
|
|
47
|
+
client,
|
|
48
|
+
detected: detectedIds.has(client.name),
|
|
49
|
+
configured,
|
|
50
|
+
status,
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
const defaultClientIds = registrations
|
|
54
|
+
.filter((registration) => (registration.state === "aligned" || registration.state === "stale") &&
|
|
55
|
+
isOwnedClientRegistrationCommand(registration.command))
|
|
56
|
+
.map(({ client }) => client);
|
|
57
|
+
return {
|
|
58
|
+
initialDoctor,
|
|
59
|
+
installHopper,
|
|
60
|
+
skillNeedsInstall,
|
|
61
|
+
clients,
|
|
62
|
+
detectedClientIds: [...detectedIds],
|
|
63
|
+
defaultClientIds,
|
|
64
|
+
clientStates,
|
|
65
|
+
...(linuxDistribution?.packageFamily === undefined
|
|
66
|
+
? {}
|
|
67
|
+
: { linuxPackageFamily: linuxDistribution.packageFamily }),
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/** Preflight exactly the selected clients and produce their concrete actions. */
|
|
71
|
+
export const planSetupActions = async (input) => {
|
|
72
|
+
const byId = new Map(input.discovery.clients.map((client) => [client.name, client]));
|
|
73
|
+
const unknownClient = input.clientIds.find((id) => !byId.has(id));
|
|
74
|
+
if (unknownClient !== undefined) {
|
|
75
|
+
return {
|
|
76
|
+
plannedActions: [],
|
|
77
|
+
selectedClients: [],
|
|
78
|
+
clientsToConfigure: [],
|
|
79
|
+
blocker: `Unsupported setup client: ${unknownClient}.`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const selectedClients = input.clientIds.flatMap((id) => {
|
|
83
|
+
const client = byId.get(id);
|
|
84
|
+
return client === undefined ? [] : [client];
|
|
85
|
+
});
|
|
86
|
+
const inspections = await Promise.all(selectedClients.map(async (client) => ({
|
|
87
|
+
client,
|
|
88
|
+
inspection: (await input.host.inspectClientConfiguration?.(client, input.providerEnvironment, input.command)) ?? { status: "update" },
|
|
89
|
+
})));
|
|
90
|
+
const invalid = inspections.find(({ inspection }) => inspection.status === "invalid");
|
|
91
|
+
if (invalid?.inspection.status === "invalid") {
|
|
92
|
+
return {
|
|
93
|
+
plannedActions: [],
|
|
94
|
+
selectedClients,
|
|
95
|
+
clientsToConfigure: [],
|
|
96
|
+
blocker: `${invalid.client.displayName ?? invalid.client.name}: ${invalid.inspection.remediation}`,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const clientPlans = inspections.flatMap(({ client, inspection }) => inspection.status === "create" ||
|
|
100
|
+
inspection.status === "update" ||
|
|
101
|
+
(input.discovery.installHopper && inspection.status === "already_current")
|
|
102
|
+
? [
|
|
103
|
+
{
|
|
104
|
+
client,
|
|
105
|
+
operation: inspection.status === "already_current"
|
|
106
|
+
? "update"
|
|
107
|
+
: inspection.status,
|
|
108
|
+
...(inspection.status !== "already_current" &&
|
|
109
|
+
inspection.backupPath !== undefined
|
|
110
|
+
? { backupPath: inspection.backupPath }
|
|
111
|
+
: {}),
|
|
112
|
+
},
|
|
113
|
+
]
|
|
114
|
+
: []);
|
|
115
|
+
return {
|
|
116
|
+
plannedActions: setupPlan({
|
|
117
|
+
platform: input.host.platform,
|
|
118
|
+
installHopper: input.discovery.installHopper,
|
|
119
|
+
installSkill: input.installSkill,
|
|
120
|
+
clients: clientPlans,
|
|
121
|
+
providerEnvironment: input.providerEnvironment,
|
|
122
|
+
...(input.discovery.linuxPackageFamily === undefined
|
|
123
|
+
? {}
|
|
124
|
+
: { linuxPackageFamily: input.discovery.linuxPackageFamily }),
|
|
125
|
+
command: input.command,
|
|
126
|
+
}),
|
|
127
|
+
selectedClients,
|
|
128
|
+
clientsToConfigure: selectedClients.filter((client) => clientPlans.some(({ client: planned }) => planned.name === client.name)),
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
/** Describe every selected setup mutation before user approval. */
|
|
7
132
|
const setupPlan = (input) => [
|
|
8
133
|
...(input.installHopper
|
|
9
134
|
? [
|
|
@@ -37,7 +162,7 @@ const setupPlan = (input) => [
|
|
|
37
162
|
kind: "configure_client",
|
|
38
163
|
label: client.displayName ?? client.name,
|
|
39
164
|
target: client.configPath,
|
|
40
|
-
detail: clientConfigurationDetail(client.displayName ?? client.name, input.providerEnvironment),
|
|
165
|
+
detail: clientConfigurationDetail(client.displayName ?? client.name, input.command, input.providerEnvironment, input.installHopper),
|
|
41
166
|
external: false,
|
|
42
167
|
operation,
|
|
43
168
|
...(backupPath === undefined ? {} : { backupPath }),
|
|
@@ -56,87 +181,6 @@ const setupPlan = (input) => [
|
|
|
56
181
|
]
|
|
57
182
|
: []),
|
|
58
183
|
];
|
|
59
|
-
/** Discover and preflight the complete set of selectable setup actions. */
|
|
60
|
-
export const discoverSetupActions = async (input) => {
|
|
61
|
-
const { host, providerEnvironment, command } = input;
|
|
62
|
-
const initialDoctor = await host.doctor(input.doctorScope);
|
|
63
|
-
const linuxHopperRepairNeeded = initialDoctor.checks.some(({ name, ok, detail }) => !ok &&
|
|
64
|
-
(name === "hopper-demo-runtime" ||
|
|
65
|
-
(name === "hopper-version" && detail === "/opt/hopper/bin/Hopper")));
|
|
66
|
-
const installHopper = input.forceHopperInstall ||
|
|
67
|
-
(input.proposeHopper &&
|
|
68
|
-
(Object.keys(providerEnvironment).length === 0 ||
|
|
69
|
-
linuxHopperRepairNeeded));
|
|
70
|
-
const [allDetectedClients, skillNeedsInstall] = await Promise.all([
|
|
71
|
-
host.detectedClients(),
|
|
72
|
-
host.skillNeedsInstall(),
|
|
73
|
-
]);
|
|
74
|
-
const selectedClientIdSet = input.selectedClientIds === undefined
|
|
75
|
-
? undefined
|
|
76
|
-
: new Set(input.selectedClientIds);
|
|
77
|
-
const detectedClients = allDetectedClients.filter(({ name }) => selectedClientIdSet === undefined || selectedClientIdSet.has(name));
|
|
78
|
-
const installSkill = input.installSkillSelection === false ? false : skillNeedsInstall;
|
|
79
|
-
const clients = installHopper
|
|
80
|
-
? detectedClients
|
|
81
|
-
: await filterClientsNeedingConfigure({
|
|
82
|
-
host,
|
|
83
|
-
clients: detectedClients,
|
|
84
|
-
providerEnvironment,
|
|
85
|
-
command,
|
|
86
|
-
});
|
|
87
|
-
const inspections = await inspectClients({
|
|
88
|
-
host,
|
|
89
|
-
clients,
|
|
90
|
-
providerEnvironment,
|
|
91
|
-
command,
|
|
92
|
-
});
|
|
93
|
-
const invalid = inspections.find(({ inspection }) => inspection.status === "invalid");
|
|
94
|
-
const blocker = invalid?.inspection.status === "invalid"
|
|
95
|
-
? `${invalid.client.displayName ?? invalid.client.name}: ${invalid.inspection.remediation}`
|
|
96
|
-
: undefined;
|
|
97
|
-
const clientPlans = inspections.flatMap(({ client, inspection }) => inspection.status === "create" ||
|
|
98
|
-
inspection.status === "update" ||
|
|
99
|
-
(installHopper && inspection.status === "already_current")
|
|
100
|
-
? [
|
|
101
|
-
{
|
|
102
|
-
client,
|
|
103
|
-
operation: inspection.status === "already_current"
|
|
104
|
-
? "update"
|
|
105
|
-
: inspection.status,
|
|
106
|
-
...(inspection.status !== "already_current" &&
|
|
107
|
-
inspection.backupPath !== undefined
|
|
108
|
-
? { backupPath: inspection.backupPath }
|
|
109
|
-
: {}),
|
|
110
|
-
},
|
|
111
|
-
]
|
|
112
|
-
: []);
|
|
113
|
-
const linuxDistribution = host.platform === "linux" ? await host.linuxDistribution() : undefined;
|
|
114
|
-
return {
|
|
115
|
-
initialDoctor,
|
|
116
|
-
installHopper,
|
|
117
|
-
installSkill,
|
|
118
|
-
detectedClients: clientPlans.map(({ client }) => client),
|
|
119
|
-
plannedActions: setupPlan({
|
|
120
|
-
platform: host.platform,
|
|
121
|
-
installHopper,
|
|
122
|
-
installSkill,
|
|
123
|
-
clients: clientPlans,
|
|
124
|
-
providerEnvironment,
|
|
125
|
-
...(linuxDistribution?.packageFamily === undefined
|
|
126
|
-
? {}
|
|
127
|
-
: { linuxPackageFamily: linuxDistribution.packageFamily }),
|
|
128
|
-
}),
|
|
129
|
-
blocker,
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
const inspectClients = async (input) => Promise.all(input.clients.map(async (client) => ({
|
|
133
|
-
client,
|
|
134
|
-
inspection: (await input.host.inspectClientConfiguration?.(client, input.providerEnvironment, input.command)) ?? { status: "update" },
|
|
135
|
-
})));
|
|
136
|
-
const filterClientsNeedingConfigure = async (input) => {
|
|
137
|
-
const needs = await Promise.all(input.clients.map((client) => input.host.clientNeedsConfigure(client, input.providerEnvironment, input.command)));
|
|
138
|
-
return input.clients.filter((_, index) => needs[index]);
|
|
139
|
-
};
|
|
140
184
|
const linuxDisclosure = (family) => {
|
|
141
185
|
const disclosure = linuxHopperInstallDisclosure(family, process.getuid?.() === 0);
|
|
142
186
|
return {
|
|
@@ -145,10 +189,18 @@ const linuxDisclosure = (family) => {
|
|
|
145
189
|
integrity: `${String(disclosure.expectedBytes)} bytes · SHA-1 ${disclosure.expectedSha1}`,
|
|
146
190
|
};
|
|
147
191
|
};
|
|
148
|
-
const
|
|
192
|
+
const majorVersion = (version) => Number.parseInt(version.split(".")[0] ?? "0", 10);
|
|
193
|
+
const clientConfigurationDetail = (client, command, environment, installHopper) => {
|
|
149
194
|
const entries = Object.entries(environment)
|
|
150
195
|
.sort(([left], [right]) => left.localeCompare(right))
|
|
151
196
|
.map(([name, value]) => `${name}=${value}`);
|
|
152
|
-
const
|
|
153
|
-
|
|
197
|
+
const environmentDetail = entries.length === 0
|
|
198
|
+
? " No additional environment variables."
|
|
199
|
+
: ` Environment: ${entries.join(", ")}.`;
|
|
200
|
+
const hopperDetail = installHopper
|
|
201
|
+
? environment.HOPPER_LAUNCHER_PATH === undefined
|
|
202
|
+
? " If this plan installs Hopper, REA will add HOPPER_LAUNCHER_PATH using the launcher path reported by that installation."
|
|
203
|
+
: " The HOPPER_LAUNCHER_PATH value shown above is the current fallback; if this plan installs Hopper, REA will replace it with the launcher path reported by that installation."
|
|
204
|
+
: "";
|
|
205
|
+
return `Add the REA MCP registration for ${client}; preserve unrelated configuration. Command: ${command.map((part) => JSON.stringify(part)).join(" ")}.${environmentDetail}${hopperDetail}`;
|
|
154
206
|
};
|
|
@@ -8,7 +8,6 @@ const SKILL_FILES = [
|
|
|
8
8
|
"references/javascript-applications.md",
|
|
9
9
|
"references/runtime-observation.md",
|
|
10
10
|
"references/evidence-workflows.md",
|
|
11
|
-
"references/controlled-replay.md",
|
|
12
11
|
];
|
|
13
12
|
const skillRoot = (home) => join(home, ".agents/skills", PRODUCT_IDENTITY.skillName);
|
|
14
13
|
const readOptionalText = async (path) => {
|
|
@@ -1,30 +1,72 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { lstatSync } from "node:fs";
|
|
3
|
+
const vscodeUserDirectory = ({ home, platform, env, }) => {
|
|
4
|
+
if (platform === "win32")
|
|
5
|
+
return join(env.APPDATA ?? join(home, "AppData", "Roaming"), "Code", "User");
|
|
6
|
+
if (platform === "darwin")
|
|
7
|
+
return join(home, "Library", "Application Support", "Code", "User");
|
|
8
|
+
return join(env.XDG_CONFIG_HOME ?? join(home, ".config"), "Code", "User");
|
|
9
|
+
};
|
|
10
|
+
const claudeDesktopDirectory = ({ home, platform, env, }) => {
|
|
11
|
+
if (platform === "win32")
|
|
12
|
+
return join(env.APPDATA ?? join(home, "AppData", "Roaming"), "Claude");
|
|
13
|
+
if (platform === "linux")
|
|
14
|
+
return join(env.XDG_CONFIG_HOME ?? join(home, ".config"), "Claude");
|
|
15
|
+
return join(home, "Library", "Application Support", "Claude");
|
|
16
|
+
};
|
|
17
|
+
const claudeCodeConfigDirectory = ({ home, env }) => env.CLAUDE_CONFIG_DIR ?? home;
|
|
18
|
+
const claudeCodeMarkerDirectory = ({ home, env }) => env.CLAUDE_CONFIG_DIR ?? join(home, ".claude");
|
|
19
|
+
const codexDirectory = ({ home, env }) => env.CODEX_HOME ?? join(home, ".codex");
|
|
20
|
+
const copilotDirectory = ({ home, env }) => env.COPILOT_HOME ?? join(home, ".copilot");
|
|
21
|
+
const opencodeDirectory = ({ home, env }) => join(env.XDG_CONFIG_HOME ?? join(home, ".config"), "opencode");
|
|
22
|
+
const existingOpenCodeConfigPath = (context) => {
|
|
23
|
+
if (context.env.OPENCODE_CONFIG !== undefined)
|
|
24
|
+
return context.env.OPENCODE_CONFIG;
|
|
25
|
+
const directory = opencodeDirectory(context);
|
|
26
|
+
const candidates = [
|
|
27
|
+
"opencode.json",
|
|
28
|
+
"opencode.jsonc",
|
|
29
|
+
".opencode.json",
|
|
30
|
+
".opencode.jsonc",
|
|
31
|
+
].map((filename) => join(directory, filename));
|
|
32
|
+
return (candidates.find((path) => {
|
|
33
|
+
try {
|
|
34
|
+
lstatSync(path);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch (cause) {
|
|
38
|
+
return !(cause instanceof Error &&
|
|
39
|
+
"code" in cause &&
|
|
40
|
+
cause.code === "ENOENT");
|
|
41
|
+
}
|
|
42
|
+
}) ??
|
|
43
|
+
candidates[0] ??
|
|
44
|
+
join(directory, "opencode.json"));
|
|
45
|
+
};
|
|
46
|
+
const devinDirectory = ({ home, platform, env }) => platform === "win32"
|
|
47
|
+
? join(env.APPDATA ?? join(home, "AppData", "Roaming"), "devin")
|
|
48
|
+
: join(home, ".config", "devin");
|
|
2
49
|
/** Stable product metadata used to derive setup discovery and documentation. */
|
|
3
50
|
export const SUPPORTED_CLIENT_DEFINITIONS = [
|
|
4
51
|
{
|
|
5
52
|
name: "claude_code",
|
|
6
53
|
displayName: "Claude Code",
|
|
7
|
-
configPath:
|
|
8
|
-
markerPath:
|
|
54
|
+
configPath: (context) => join(claudeCodeConfigDirectory(context), ".claude.json"),
|
|
55
|
+
markerPath: claudeCodeMarkerDirectory,
|
|
9
56
|
format: "json",
|
|
10
57
|
},
|
|
11
58
|
{
|
|
12
59
|
name: "claude_desktop",
|
|
13
60
|
displayName: "Claude Desktop",
|
|
14
|
-
configPath:
|
|
15
|
-
|
|
16
|
-
"Application Support",
|
|
17
|
-
"Claude",
|
|
18
|
-
"claude_desktop_config.json",
|
|
19
|
-
],
|
|
20
|
-
markerPath: ["Library", "Application Support", "Claude"],
|
|
61
|
+
configPath: (context) => join(claudeDesktopDirectory(context), "claude_desktop_config.json"),
|
|
62
|
+
markerPath: claudeDesktopDirectory,
|
|
21
63
|
format: "json",
|
|
22
64
|
},
|
|
23
65
|
{
|
|
24
66
|
name: "codex",
|
|
25
67
|
displayName: "Codex",
|
|
26
|
-
configPath:
|
|
27
|
-
markerPath:
|
|
68
|
+
configPath: (context) => join(codexDirectory(context), "config.toml"),
|
|
69
|
+
markerPath: codexDirectory,
|
|
28
70
|
format: "toml",
|
|
29
71
|
},
|
|
30
72
|
{
|
|
@@ -51,16 +93,55 @@ export const SUPPORTED_CLIENT_DEFINITIONS = [
|
|
|
51
93
|
{
|
|
52
94
|
name: "devin",
|
|
53
95
|
displayName: "Devin",
|
|
54
|
-
configPath:
|
|
55
|
-
markerPath:
|
|
56
|
-
format: "
|
|
96
|
+
configPath: ({ home, platform, env }) => join(devinDirectory({ home, platform, env }), "mcp_config.json"),
|
|
97
|
+
markerPath: devinDirectory,
|
|
98
|
+
format: "json",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "opencode",
|
|
102
|
+
displayName: "OpenCode",
|
|
103
|
+
configPath: existingOpenCodeConfigPath,
|
|
104
|
+
markerPath: opencodeDirectory,
|
|
105
|
+
format: "opencode",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "antigravity",
|
|
109
|
+
displayName: "Antigravity",
|
|
110
|
+
configPath: [".gemini", "config", "mcp_config.json"],
|
|
111
|
+
markerPath: [".gemini", "config"],
|
|
112
|
+
format: "json",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "copilot_cli",
|
|
116
|
+
displayName: "GitHub Copilot CLI",
|
|
117
|
+
configPath: (context) => join(copilotDirectory(context), "mcp-config.json"),
|
|
118
|
+
markerPath: copilotDirectory,
|
|
119
|
+
format: "copilot_cli",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "vscode",
|
|
123
|
+
displayName: "VS Code",
|
|
124
|
+
configPath: (context) => join(vscodeUserDirectory(context), "mcp.json"),
|
|
125
|
+
markerPath: vscodeUserDirectory,
|
|
126
|
+
format: "vscode",
|
|
57
127
|
},
|
|
58
128
|
];
|
|
129
|
+
const resolvePath = (path, context) => typeof path === "function" ? path(context) : join(context.home, ...path);
|
|
59
130
|
/** Describe every client location that setup, doctor, or uninstall may inspect. */
|
|
60
|
-
export const supportedClients = (home
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
131
|
+
export const supportedClients = (home, platform = process.platform, env = {
|
|
132
|
+
APPDATA: process.env.APPDATA,
|
|
133
|
+
CLAUDE_CONFIG_DIR: process.env.CLAUDE_CONFIG_DIR,
|
|
134
|
+
CODEX_HOME: process.env.CODEX_HOME,
|
|
135
|
+
COPILOT_HOME: process.env.COPILOT_HOME,
|
|
136
|
+
OPENCODE_CONFIG: process.env.OPENCODE_CONFIG,
|
|
137
|
+
XDG_CONFIG_HOME: process.env.XDG_CONFIG_HOME,
|
|
138
|
+
}) => {
|
|
139
|
+
const context = { home, platform, env };
|
|
140
|
+
return SUPPORTED_CLIENT_DEFINITIONS.map((definition) => ({
|
|
141
|
+
name: definition.name,
|
|
142
|
+
displayName: definition.displayName,
|
|
143
|
+
configPath: resolvePath(definition.configPath, context),
|
|
144
|
+
markerPath: resolvePath(definition.markerPath, context),
|
|
145
|
+
format: definition.format,
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { parseClientConfiguration, serializeClientConfiguration, } from "./ClientConfigurationDocument.js";
|
|
2
2
|
import { copyFile, lstat, readFile, realpath, rm } from "node:fs/promises";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
import {
|
|
4
|
+
import { join } from "node:path";
|
|
5
5
|
import writeFileAtomic from "write-file-atomic";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { PRODUCT_IDENTITY } from "../identity.js";
|
|
8
|
+
import { isOwnedClientRegistrationCommand } from "./ClientRegistrationIdentity.js";
|
|
8
9
|
import { resolveClientConfigTransactionPath } from "./ClientConfigPath.js";
|
|
9
10
|
import { supportedClients } from "./SupportedClients.js";
|
|
10
11
|
const systemFileSystem = {
|
|
@@ -15,6 +16,20 @@ const systemFileSystem = {
|
|
|
15
16
|
realpath: (path) => realpath(path),
|
|
16
17
|
remove: (path) => rm(path, { recursive: true }),
|
|
17
18
|
};
|
|
19
|
+
/** Whether any requested REA-owned uninstall action failed. */
|
|
20
|
+
export const isUninstallFailure = (result) => {
|
|
21
|
+
const status = result.status;
|
|
22
|
+
switch (status) {
|
|
23
|
+
case "complete":
|
|
24
|
+
return false;
|
|
25
|
+
case "failed":
|
|
26
|
+
return true;
|
|
27
|
+
default: {
|
|
28
|
+
const exhaustive = status;
|
|
29
|
+
throw new TypeError(`Unhandled uninstall result status: ${String(exhaustive)}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
18
33
|
/** Remove only REA-owned registrations and managed files, optionally including local state. */
|
|
19
34
|
export const runUninstall = async (purgeData, host = systemUninstallHost()) => {
|
|
20
35
|
const items = [];
|
|
@@ -72,12 +87,12 @@ const removeClient = async (client, fileSystem) => {
|
|
|
72
87
|
} = parseClientConfiguration(original, client.format));
|
|
73
88
|
}
|
|
74
89
|
catch {
|
|
75
|
-
return item(client.name, "failed", `Configuration is not valid ${client.format === "toml" ? "TOML" : "JSON"} and was not changed. Repair it, then rerun uninstall.`);
|
|
90
|
+
return item(client.name, "failed", `Configuration is not valid ${client.format === "toml" ? "TOML" : client.format === "opencode" ? "JSONC" : "JSON"} and was not changed. Repair it, then rerun uninstall.`);
|
|
76
91
|
}
|
|
77
92
|
const registration = servers[PRODUCT_IDENTITY.mcpServerKey];
|
|
78
93
|
if (registration === undefined)
|
|
79
94
|
return item(client.name, "skipped", "REA registration is absent.");
|
|
80
|
-
if (!isOwnedRegistration(registration))
|
|
95
|
+
if (!isOwnedRegistration(registration, client))
|
|
81
96
|
return item(client.name, "retained", "The rea-named registration is not REA-owned.");
|
|
82
97
|
const remaining = { ...servers };
|
|
83
98
|
delete remaining[PRODUCT_IDENTITY.mcpServerKey];
|
|
@@ -90,7 +105,7 @@ const removeClient = async (client, fileSystem) => {
|
|
|
90
105
|
return item(client.name, "failed", "Configuration could not be backed up, so no change was made. Check file permissions, then rerun uninstall.");
|
|
91
106
|
}
|
|
92
107
|
try {
|
|
93
|
-
await fileSystem.writeText(transactionPath, serializeClientConfiguration(document, client.format));
|
|
108
|
+
await fileSystem.writeText(transactionPath, serializeClientConfiguration(document, client.format, original, PRODUCT_IDENTITY.mcpServerKey));
|
|
94
109
|
const readback = parseClientConfiguration(await fileSystem.readText(transactionPath), client.format);
|
|
95
110
|
if (PRODUCT_IDENTITY.mcpServerKey in readback.servers)
|
|
96
111
|
throw new Error("registration readback mismatch");
|
|
@@ -114,26 +129,22 @@ const resolveUninstallConfigPath = async (client, fileSystem) => {
|
|
|
114
129
|
item(client.name, "failed", "Configuration path could not be safely verified. Check its permissions and, if it is a symbolic link, verify that the link resolves to a regular file owned by the current user, then rerun uninstall."));
|
|
115
130
|
};
|
|
116
131
|
/** Ownership rule for persistent MCP registrations created by REA setup. */
|
|
117
|
-
const isOwnedRegistration = (value) => {
|
|
132
|
+
const isOwnedRegistration = (value, client) => {
|
|
133
|
+
if (client.format === "opencode") {
|
|
134
|
+
const parsed = z
|
|
135
|
+
.object({ type: z.literal("local"), command: z.array(z.string()).min(1) })
|
|
136
|
+
.passthrough()
|
|
137
|
+
.safeParse(value);
|
|
138
|
+
if (!parsed.success)
|
|
139
|
+
return false;
|
|
140
|
+
const command = parsed.data.command;
|
|
141
|
+
return isOwnedClientRegistrationCommand(command);
|
|
142
|
+
}
|
|
118
143
|
const parsed = registrationSchema.safeParse(value);
|
|
119
144
|
if (!parsed.success)
|
|
120
145
|
return false;
|
|
121
146
|
const { command, args } = parsed.data;
|
|
122
|
-
return (
|
|
123
|
-
(isAbsolute(command) && basename(command) === "rea")) &&
|
|
124
|
-
args.length === 1 &&
|
|
125
|
-
args[0] === "mcp") ||
|
|
126
|
-
(command === "npx" &&
|
|
127
|
-
(JSON.stringify(args) ===
|
|
128
|
-
JSON.stringify([
|
|
129
|
-
"-y",
|
|
130
|
-
PRODUCT_IDENTITY.registrationPackageSpecifier,
|
|
131
|
-
"mcp",
|
|
132
|
-
]) ||
|
|
133
|
-
JSON.stringify(args) ===
|
|
134
|
-
JSON.stringify(["-y", PRODUCT_IDENTITY.packageSpecifier, "mcp"]) ||
|
|
135
|
-
JSON.stringify(args) ===
|
|
136
|
-
JSON.stringify(["-y", PRODUCT_IDENTITY.packageName, "mcp"]))));
|
|
147
|
+
return isOwnedClientRegistrationCommand([command, ...args]);
|
|
137
148
|
};
|
|
138
149
|
const removeManagedPath = async (path, name, fileSystem) => {
|
|
139
150
|
try {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { gt, valid } from "semver";
|
|
2
|
+
import { PRODUCT_IDENTITY } from "../identity.js";
|
|
3
|
+
/** Whether the update command left the requested release unapplied. */
|
|
4
|
+
export const isUpdateFailure = (result) => {
|
|
5
|
+
const status = result.status;
|
|
6
|
+
switch (status) {
|
|
7
|
+
case "current":
|
|
8
|
+
case "updated":
|
|
9
|
+
return false;
|
|
10
|
+
case "failed":
|
|
11
|
+
return true;
|
|
12
|
+
default: {
|
|
13
|
+
const exhaustive = status;
|
|
14
|
+
throw new TypeError(`Unhandled update result status: ${String(exhaustive)}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/** Resolve the exact npm command for the identified prefix and release. */
|
|
19
|
+
export const updateInstallCommand = (installation, version) => [
|
|
20
|
+
"npm",
|
|
21
|
+
"install",
|
|
22
|
+
"--global",
|
|
23
|
+
"--ignore-scripts",
|
|
24
|
+
"--prefix",
|
|
25
|
+
installation.prefix,
|
|
26
|
+
`${PRODUCT_IDENTITY.packageName}@${version}`,
|
|
27
|
+
];
|
|
28
|
+
/** Identify, resolve, install, and verify REA without applying setup changes. */
|
|
29
|
+
export const runUpdate = async (currentVersion, host, output = "human") => {
|
|
30
|
+
const installation = await host.installation();
|
|
31
|
+
const release = await host.latestVersion(installation);
|
|
32
|
+
const latestVersion = release.ok ? release.value : null;
|
|
33
|
+
const targetVersion = release.ok ? valid(release.value) : null;
|
|
34
|
+
if (!release.ok || valid(currentVersion) === null || targetVersion === null)
|
|
35
|
+
return {
|
|
36
|
+
status: "failed",
|
|
37
|
+
currentVersion,
|
|
38
|
+
latestVersion,
|
|
39
|
+
reason: "version-check",
|
|
40
|
+
remediation: release.ok
|
|
41
|
+
? "REA received invalid version metadata. Check the installed version and npm registry, then rerun rea update."
|
|
42
|
+
: `REA could not resolve the latest release: ${release.error}. Retry rea update when registry access is available.`,
|
|
43
|
+
};
|
|
44
|
+
if (!gt(targetVersion, currentVersion))
|
|
45
|
+
return {
|
|
46
|
+
status: "current",
|
|
47
|
+
currentVersion,
|
|
48
|
+
latestVersion: targetVersion,
|
|
49
|
+
installMethod: installation === undefined ? "unknown" : "npm",
|
|
50
|
+
};
|
|
51
|
+
if (installation === undefined)
|
|
52
|
+
return {
|
|
53
|
+
status: "failed",
|
|
54
|
+
currentVersion,
|
|
55
|
+
latestVersion: targetVersion,
|
|
56
|
+
reason: "unknown-install-method",
|
|
57
|
+
remediation: "Update this installation with the package manager or source checkout that owns it. For a one-off latest invocation, use npx rea-agents@latest.",
|
|
58
|
+
};
|
|
59
|
+
const installed = await host.installVersion(installation, targetVersion, output);
|
|
60
|
+
if (!installed.ok)
|
|
61
|
+
return {
|
|
62
|
+
status: "failed",
|
|
63
|
+
currentVersion,
|
|
64
|
+
latestVersion: targetVersion,
|
|
65
|
+
reason: "install",
|
|
66
|
+
remediation: `REA could not install ${targetVersion} in ${installation.prefix}: ${installed.error}. Repair this npm installation, then rerun rea update.`,
|
|
67
|
+
};
|
|
68
|
+
const verified = await host.installedVersion(installation);
|
|
69
|
+
if (!verified.ok || verified.value !== targetVersion)
|
|
70
|
+
return {
|
|
71
|
+
status: "failed",
|
|
72
|
+
currentVersion,
|
|
73
|
+
latestVersion: targetVersion,
|
|
74
|
+
reason: "verification",
|
|
75
|
+
...(verified.ok ? { installedVersion: verified.value } : {}),
|
|
76
|
+
remediation: `npm completed, but REA could not verify ${targetVersion} in ${installation.packageRoot}: ${verified.ok ? `the executable reported ${verified.value}` : verified.error}. The installation may have changed; repair it before retrying.`,
|
|
77
|
+
};
|
|
78
|
+
const maintenance = await host.planMaintenance(installation);
|
|
79
|
+
return {
|
|
80
|
+
status: "updated",
|
|
81
|
+
previousVersion: currentVersion,
|
|
82
|
+
latestVersion: targetVersion,
|
|
83
|
+
installedVersion: verified.value,
|
|
84
|
+
installMethod: "npm",
|
|
85
|
+
command: updateInstallCommand(installation, targetVersion),
|
|
86
|
+
maintenance,
|
|
87
|
+
remediation: maintenance.status === "planned"
|
|
88
|
+
? "REA is updated. Run the maintenance command to review and approve changes to existing REA integrations, then restart affected agents."
|
|
89
|
+
: maintenance.status === "unavailable"
|
|
90
|
+
? "REA is updated. Integration maintenance could not be planned; inspect the maintenance diagnostic before changing configuration."
|
|
91
|
+
: "REA is updated. Restart agents running this installation to load the new version.",
|
|
92
|
+
};
|
|
93
|
+
};
|