rea-agents 6.2.0 → 6.4.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 +24 -23
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/bridge/hopper_bridge.py +2 -0
- package/dist/adb/AdbConfiguration.js +88 -0
- package/dist/adb/AdbDeviceOutput.js +186 -0
- package/dist/adb/AdbProvider.js +1190 -0
- package/dist/adb/AdbShellOutput.js +309 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxConfiguration.js +44 -24
- package/dist/android/JadxProvider.js +59 -21
- package/dist/android/JadxSession.js +51 -9
- package/dist/apktool/ApktoolConfiguration.js +84 -0
- package/dist/apktool/ApktoolDecodeOutput.js +59 -0
- package/dist/apktool/ApktoolProvider.js +506 -0
- package/dist/application/AnalysisProvider.js +8 -2
- package/dist/application/AppBundleExecutable.js +27 -22
- package/dist/application/BinaryTargetResolver.js +85 -19
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +98 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +75 -27
- package/dist/application/DirectAnalysis.js +14 -8
- package/dist/application/DirectAnalysisCleanup.js +1 -2
- package/dist/application/DirectAnalysisStatus.js +3 -6
- package/dist/application/Doctor.js +27 -34
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/GeminiClientSettings.js +139 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InvestigationProviders.js +10 -4
- package/dist/application/JsonFiles.js +16 -15
- package/dist/application/JsonInputFile.js +252 -0
- package/dist/application/LinuxHopper.js +6 -13
- package/dist/application/MacHopper.js +172 -149
- package/dist/application/MipsElfAbiFlags.js +140 -0
- package/dist/application/ProviderOperationExecution.js +31 -0
- package/dist/application/ReconstructionObligationCandidates.js +16 -3
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -1
- package/dist/application/ReferenceSourceImport.js +76 -29
- package/dist/application/ReferenceSourceImportEntries.js +18 -9
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -22
- package/dist/application/ReferenceSourceVcsAdapter.js +145 -30
- package/dist/application/RegularFileRead.js +103 -0
- package/dist/application/Setup.js +69 -10
- package/dist/application/SetupClientConfiguration.js +134 -23
- package/dist/application/SetupHost.js +102 -22
- package/dist/application/SetupPlan.js +18 -17
- package/dist/application/SetupSkill.js +81 -13
- package/dist/application/SupportedClients.js +305 -37
- package/dist/application/Uninstall.js +172 -8
- package/dist/application/UpdateMaintenance.js +23 -23
- package/dist/application/Utf8JsonInput.js +71 -0
- package/dist/application/WebScriptExportService.js +130 -57
- package/dist/application/WebSourceLocationService.js +3 -0
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +40 -2
- package/dist/application/android/AndroidAnalysisService.js +1 -1
- package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
- package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
- package/dist/application/binary/AnalysisClientCleanup.js +0 -24
- package/dist/application/binary/AnalysisSnapshotCache.js +5 -4
- package/dist/application/binary/BinarySession.js +18 -1
- package/dist/application/binary/BinarySessionOpen.js +9 -1
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +2 -1
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +2 -1
- package/dist/application/evm/EvmInterfaceService.js +3 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/javascript/ElectronActiveEvidence.js +2 -2
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +20 -3
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +1 -0
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +107 -46
- package/dist/application/javascript/JavaScriptApplicationService.js +23 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +59 -45
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -36
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +74 -36
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +53 -42
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +293 -238
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +120 -28
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -0
- package/dist/application/javascript/JavaScriptJsonModules.js +2 -2
- package/dist/application/javascript/JavaScriptModuleRelationships.js +10 -20
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +11 -27
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +11 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +206 -66
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +18 -23
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +5 -2
- package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +7 -5
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +6 -4
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +29 -15
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +15 -10
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -1
- package/dist/application/native/NativeCallRoutes.js +2 -4
- package/dist/application/native/NativeUiActionTrace.js +16 -8
- package/dist/application/native/NativeValueTrace.js +23 -6
- package/dist/application/process/ProcessCli.js +25 -20
- package/dist/artifacts/ArtifactPaths.js +129 -8
- package/dist/artifacts/ArtifactProvider.js +34 -31
- package/dist/artifacts/ArtifactProviderMetadata.js +1 -4
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +218 -80
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/DirectoryArtifactReader.js +168 -65
- package/dist/artifacts/MachOSliceArtifactReader.js +116 -39
- package/dist/artifacts/NativeDmgArtifactReader.js +179 -87
- package/dist/artifacts/NativeDmgOwnership.js +109 -0
- package/dist/artifacts/SafeOutputTree.js +245 -70
- package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
- package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
- package/dist/artifacts/ZipArtifactReader.js +77 -27
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +58 -18
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +62 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +76 -49
- package/dist/artifacts/apple/MachoLoadCommandReader.js +36 -6
- package/dist/artifacts/extraction/ArtifactExtraction.js +134 -92
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +116 -50
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +87 -25
- package/dist/artifacts/inventory/hashStableRootArtifact.js +70 -0
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +73 -30
- package/dist/artifacts/inventory/scanReader.js +43 -20
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +72 -28
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/browser/BrowserScenarioPartialObservation.js +8 -2
- package/dist/browser/BrowserScenarioSecrets.js +52 -37
- package/dist/browser/CdpBrowserProvider.js +9 -3
- package/dist/browser/CdpCaptureDocuments.js +40 -6
- package/dist/browser/CdpCaptureDomSvg.js +210 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +4 -8
- package/dist/browser/CdpCaptureEventHandlers.js +26 -9
- package/dist/browser/CdpCaptureEvents.js +4 -9
- package/dist/browser/CdpCaptureStorageFingerprints.js +3 -3
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpElectronInspection.js +2 -2
- package/dist/browser/CdpElectronProvider.js +4 -3
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +48 -23
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +63 -7
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +208 -43
- package/dist/browser/PlaywrightScenarioSession.js +130 -65
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +35 -9
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/ScenarioScriptCapture.js +8 -12
- package/dist/browser/assets/WebArtifactReads.js +23 -1
- package/dist/browser/assets/WebSourceLocationArtifacts.js +1 -0
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/HarCapture.js +14 -0
- package/dist/browser/history/HarCaptureProcess.js +2 -10
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/modules/WebModuleArtifacts.js +1 -0
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/apktoolCommands.js +53 -0
- package/dist/cli/artifactCommands.js +8 -11
- package/dist/cli/binaryDiagnosticsCommands.js +19 -1
- package/dist/cli/browserAdvancedCommands.js +65 -36
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +12 -13
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +14 -10
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +19 -13
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +12 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/streamedJsonOutput.js +83 -4
- package/dist/cli/utilityCommands.js +68 -22
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +11 -2
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +47 -34
- package/dist/cliObservationOptions.js +7 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +5 -4
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/browserScenario.js +2 -2
- package/dist/composition/directAnalysis.js +14 -7
- package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
- package/dist/composition/jeb.js +6 -0
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/mcpInputSchemaProfile.js +27 -0
- package/dist/config/parseConfig.js +28 -1
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +10 -0
- package/dist/contracts/analysisViewToolContracts.js +17 -2
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/artifactComparisonExample.js +5 -5
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/errorSchemas.js +3 -1
- package/dist/contracts/functionComparisonExample.js +8 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +104 -13
- package/dist/contracts/javascript/electronToolContracts.js +16 -3
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +3 -2
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +6 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +8 -7
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/managed/managedToolContracts.js +3 -2
- package/dist/contracts/mobileApplicationGraphExamples.js +5 -5
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/native/nativeToolContracts.js +1 -1
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionLifecycleInputs.js +4 -3
- package/dist/contracts/sessionStatusContract.js +3 -2
- package/dist/contracts/sessionToolContracts.js +5 -4
- package/dist/contracts/sessionToolSchemas.js +9 -4
- package/dist/contracts/toolContractExamples.js +6 -0
- package/dist/contracts/toolContractTypes.js +3 -0
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +167 -0
- package/dist/contracts/toolOutputSchemaGroups.js +7 -5
- package/dist/contracts/toolOutputSchemaPrimitives.js +2 -5
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorBase.js +5 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -4
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +5 -2
- package/dist/domain/analysisView/analysisView.js +53 -5
- package/dist/domain/analysisView/binaryLayoutView.js +2 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +2 -0
- package/dist/domain/analysisView/nativeFunctionView.js +155 -0
- package/dist/domain/android/androidApplication.js +25 -20
- package/dist/domain/android/androidPartialObservation.js +36 -0
- package/dist/domain/apktool/apktoolResourceAnalysis.js +77 -0
- package/dist/domain/apple/appleApplication.js +40 -23
- package/dist/domain/apple/appleBundleAnatomy.js +95 -28
- package/dist/domain/apple/dyldPaths.js +9 -1
- package/dist/domain/apple/dylibResolution.js +3 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +39 -11
- package/dist/domain/artifactGraph.js +6 -4
- package/dist/domain/artifactIdentity.js +37 -9
- package/dist/domain/artifactInspection.js +10 -50
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +16 -17
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserCompleteness.js +3 -2
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/browserScenarioCaptureValues.js +2 -2
- package/dist/domain/browserScenarioNormalization.js +3 -3
- package/dist/domain/browserScenarioValues.js +3 -2
- package/dist/domain/callPath.js +8 -10
- package/dist/domain/canonicalDigest.js +7 -1
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/canonicalOrdering.js +1 -13
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/comparisonSemantics.js +0 -5
- package/dist/domain/digests.js +0 -3
- package/dist/domain/evidence.js +12 -6
- package/dist/domain/evidenceBundle.js +51 -33
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/firmware/firmwareAnalysis.js +4 -3
- package/dist/domain/functionComparison.js +2 -1
- package/dist/domain/functionComparisonNormalization.js +4 -3
- package/dist/domain/functionComparisonResults.js +2 -2
- package/dist/domain/functionDossierEvidence.js +2 -1
- package/dist/domain/hopperValues.js +11 -15
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronActiveObservation.js +4 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +14 -15
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +20 -21
- package/dist/domain/javascript/electronStaticAnalysisNative.js +73 -41
- package/dist/domain/javascript/electronStaticAnalysisValues.js +24 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +6 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +18 -14
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +4 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +91 -28
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparison.js +4 -4
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +37 -22
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +72 -45
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +16 -8
- package/dist/domain/javascript/javascriptAstFingerprint.js +60 -33
- package/dist/domain/javascript/javascriptAstValues.js +54 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +3 -2
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +31 -23
- package/dist/domain/javascript/javascriptExportShapeSelection.js +2 -2
- package/dist/domain/javascript/javascriptExportShapeVariants.js +3 -2
- package/dist/domain/javascript/javascriptFeatureSeed.js +5 -3
- package/dist/domain/javascript/javascriptFeatureTrace.js +7 -6
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +17 -9
- package/dist/domain/javascript/javascriptFeatureTraversal.js +4 -4
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +12 -7
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeObservation.js +8 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliation.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationActive.js +9 -8
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +212 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +5 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +12 -223
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +15 -17
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +379 -30
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +9 -7
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +20 -0
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -9
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +4 -11
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +43 -42
- package/dist/domain/javascript/javascriptSemanticGraph.js +205 -52
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +21 -11
- package/dist/domain/javascript/javascriptSemanticIr.js +0 -4
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +139 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +774 -136
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +98 -41
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +9 -7
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +7 -2
- package/dist/domain/javascript/javascriptSemanticProjection.js +72 -28
- package/dist/domain/javascript/javascriptSemanticPromises.js +15 -21
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +100 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +3 -3
- package/dist/domain/javascript/javascriptSemanticQuery.js +33 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +4 -5
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -9
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +16 -10
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +34 -48
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +25 -2
- package/dist/domain/javascript/javascriptSemanticValues.js +169 -30
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptSourceMapPaths.js +11 -1
- package/dist/domain/javascript/javascriptSourceParser.js +34 -9
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +13 -12
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +26 -15
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +7 -5
- package/dist/domain/javascript/sourceToBundleSignals.js +7 -7
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonSerialization.js +109 -55
- package/dist/domain/jsonShape.js +69 -31
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/localPath.js +10 -4
- package/dist/domain/managed/managedApplicationGraph.js +47 -6
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +94 -59
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +6 -7
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeCallObservation.js +2 -4
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/nativeValueFlow.js +5 -11
- package/dist/domain/native/objcSwiftMetadata.js +15 -17
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +102 -11
- package/dist/domain/process/processCaptureCoverage.js +8 -5
- package/dist/domain/process/processCaptureExample.js +67 -0
- package/dist/domain/process/processCaptureValidation.js +83 -3
- package/dist/domain/process/processComparison.js +0 -23
- package/dist/domain/process/processScenario.js +62 -10
- package/dist/domain/process/processTraceEvaluation.js +4 -4
- package/dist/domain/process/processTraceSpecification.js +1 -3
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/providerCleanupError.js +6 -2
- package/dist/domain/reconstructionCoverage.js +2 -1
- package/dist/domain/reconstructionUnknowns.js +4 -3
- package/dist/domain/reconstructionVerification.js +3 -2
- package/dist/domain/referenceSourceGraph.js +32 -23
- package/dist/domain/referenceSourceImportParsing.js +40 -48
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +2 -1
- package/dist/domain/swiftSymbolClassification.js +6 -1
- package/dist/domain/symbolAnalysis.js +17 -2
- package/dist/domain/unicodeCodePointOrder.js +6 -0
- package/dist/domain/webBundleAnalyzerInspection.js +23 -3
- package/dist/domain/webCaptureDiff.js +170 -30
- package/dist/domain/webCaptureDiffSchemas.js +2 -8
- package/dist/domain/webInventory.js +3 -2
- package/dist/domain/webMcpDiscovery.js +4 -3
- package/dist/domain/webScriptExport.js +1 -1
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +7 -13
- package/dist/domain/zipPackageFormat.js +4 -1
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +55 -43
- package/dist/dotnet/ManagedDecodeBudget.js +80 -0
- package/dist/dotnet/ManagedMemberInspector.js +13 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +2 -2
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +5 -4
- package/dist/dotnet/ManagedMemberRows.js +9 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +15 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +20 -11
- package/dist/dotnet/ManagedMetadataLayout.js +10 -4
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +3 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +49 -34
- package/dist/dotnet/ManagedPeReader.js +41 -25
- package/dist/dotnet/ManagedReaderFailure.js +2 -1
- package/dist/dotnet/ManagedStaticProvider.js +65 -31
- package/dist/dotnet/ManagedStaticProviderMetadata.js +1 -4
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +43 -13
- package/dist/evm/EvmoleFailures.js +0 -2
- package/dist/evm/EvmoleInterfaceProvider.js +67 -2
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/RegularFile.js +73 -0
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +26 -0
- package/dist/firmware/FirmwareCommand.js +25 -3
- package/dist/firmware/FirmwareFiles.js +23 -8
- package/dist/firmware/FirmwareProvider.js +156 -32
- package/dist/firmware/FirmwarePublication.js +24 -3
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +55 -4
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +90 -8
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +111 -10
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +123 -58
- package/dist/ghidra/GhidraLoadImageAttest.js +49 -2
- package/dist/ghidra/GhidraMipsProfile.js +79 -0
- package/dist/ghidra/GhidraProvider.js +57 -9
- package/dist/ghidra/GhidraProviderCapabilities.js +18 -8
- package/dist/ghidra/GhidraProviderClient.js +282 -21
- package/dist/ghidra/GhidraSessionValues.js +9 -2
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperCleanup.js +1 -1
- package/dist/hopper/HopperClient.js +15 -6
- package/dist/hopper/HopperMachOImage.js +2 -0
- package/dist/hopper/HopperProvider.js +13 -2
- package/dist/ida/IdaOperationRunner.js +10 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +7 -3
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -5
- package/dist/inspector/V8InspectorCaptureProjection.js +46 -13
- package/dist/inspector/V8InspectorProvider.js +60 -8
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +326 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +520 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +63 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +521 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +116 -0
- package/dist/javascript/recovery/RecoveryFiles.js +18 -7
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +11 -7
- package/dist/javascript/recovery/WakaruProvider.js +139 -16
- package/dist/javascript/recovery/WakaruPublication.js +14 -4
- package/dist/javascript/recovery/WakaruRelease.js +10 -3
- package/dist/javascript/recovery/WakaruReport.js +12 -7
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -3
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +63 -7
- package/dist/javascript/sourceMaps/SourceMapFormat.js +15 -4
- package/dist/jeb/JebMcpConnection.js +179 -0
- package/dist/jeb/JebMcpEndpoint.js +40 -0
- package/dist/jeb/JebProvider.js +299 -0
- package/dist/main/shutdown.js +76 -32
- package/dist/main/transport.js +1 -1
- package/dist/mcpDoctor.js +15 -6
- package/dist/native/AppleDispatchCoverage.js +25 -12
- package/dist/native/AppleDispatchMetadata.js +14 -7
- package/dist/native/AppleMachoFixups.js +71 -15
- package/dist/native/AppleMachoSelection.js +23 -3
- package/dist/native/AppleObjcDispatchFacets.js +3 -3
- package/dist/native/AppleObjcProperties.js +17 -7
- package/dist/native/LldbCallTracer.js +241 -75
- package/dist/native/NativeMacOSProvider.js +100 -20
- package/dist/native/NativeMacOSProviderMetadata.js +1 -2
- package/dist/native/NativeMachoInspection.js +11 -7
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +4 -3
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +63 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/DarwinProcessRunTokenReader.js +8 -3
- package/dist/process/OwnedCommand.js +4 -3
- package/dist/process/ProcessOwnership.js +104 -112
- package/dist/process/ProcessOwnershipObservation.js +104 -51
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +4 -3
- package/dist/process/capture/FilesystemSnapshot.js +116 -22
- package/dist/process/capture/ProcessCaptureLifecycle.js +363 -86
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessFilesystemEffects.js +19 -4
- package/dist/process/capture/ProcessHarness.js +202 -47
- package/dist/process/capture/ProcessNormalization.js +3 -1
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +5 -2
- package/dist/process/capture/TerminalRenderer.js +24 -7
- package/dist/reference/ReferenceSourceReader.js +22 -5
- package/dist/reference/ReferenceSourceReaderEntries.js +114 -51
- package/dist/reference/ReferenceSourceReaderErrors.js +12 -0
- package/dist/reference/ReferenceSourceReaderFile.js +50 -10
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -4
- package/dist/server/EvidenceMcpServer.js +36 -1
- package/dist/server/admittedToolOperation.js +9 -0
- package/dist/server/analysisAdmission.js +8 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +118 -47
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +4 -9
- package/dist/server/registerAndroidTools.js +3 -12
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +6 -7
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +3 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -2
- package/dist/server/registerApplicationTools/helpers.js +3 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +3 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +5 -2
- package/dist/server/registerArtifactTools.js +2 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +12 -9
- package/dist/server/registerBundleComparisonTool.js +16 -2
- package/dist/server/registerCloseLifecycleTool.js +36 -5
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEnhancedTools.js +78 -73
- package/dist/server/registerEvidenceTools.js +54 -46
- package/dist/server/registerEvmTools.js +4 -9
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFunctionComparisonTool.js +5 -2
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -6
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedTools.js +7 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
- package/dist/server/registerOfficialTools.js +31 -25
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerSessionRecordTools.js +2 -1
- package/dist/server/registerSessionTools.js +58 -21
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +4 -9
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/toolResult.js +21 -2
- package/dist/windows/WindowsPrivateRuntime.js +12 -5
- package/install.sh +7 -4
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -7
- package/scripts/rea.mjs +16 -1
- package/skills/reverse-engineer-anything/SKILL.md +52 -51
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +92 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +31 -1
- package/dist/artifacts/inventory/policy.js +0 -2
- package/dist/domain/managed/managedApplicationGraphNodeCoverage.js +0 -6
- package/dist/server/registerNativeTools.js +0 -6
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { isAbsolute, join } from "node:path";
|
|
1
|
+
import { dirname, isAbsolute, join, resolve, win32 } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
2
3
|
import { lstatSync } from "node:fs";
|
|
4
|
+
import { err, ok } from "../domain/result.js";
|
|
5
|
+
import { HermesClientPathError, resolveHermesClientHome, } from "./HermesClientHome.js";
|
|
3
6
|
const vscodeUserDirectory = ({ home, platform, env, }) => {
|
|
4
7
|
if (platform === "win32")
|
|
5
8
|
return join(env.APPDATA ?? join(home, "AppData", "Roaming"), "Code", "User");
|
|
@@ -16,8 +19,24 @@ const claudeDesktopDirectory = ({ home, platform, env, }) => {
|
|
|
16
19
|
};
|
|
17
20
|
const claudeCodeConfigDirectory = ({ home, env }) => env.CLAUDE_CONFIG_DIR ?? home;
|
|
18
21
|
const claudeCodeMarkerDirectory = ({ home, env }) => env.CLAUDE_CONFIG_DIR ?? join(home, ".claude");
|
|
19
|
-
const codexDirectory = ({ home, env }) => env.CODEX_HOME
|
|
20
|
-
|
|
22
|
+
const codexDirectory = ({ home, env }) => env.CODEX_HOME || join(home, ".codex");
|
|
23
|
+
/** Match Qwen Code's home override, including tilde and cwd-relative paths. */
|
|
24
|
+
const qwenCodeDirectory = ({ home, env }) => {
|
|
25
|
+
const override = env.QWEN_HOME;
|
|
26
|
+
if (!override)
|
|
27
|
+
return join(home, ".qwen");
|
|
28
|
+
const expanded = override === "~"
|
|
29
|
+
? home
|
|
30
|
+
: override.startsWith("~/") || override.startsWith("~\\")
|
|
31
|
+
? join(home, ...override
|
|
32
|
+
.slice(2)
|
|
33
|
+
.split(/[/\\]+/)
|
|
34
|
+
.filter(Boolean))
|
|
35
|
+
: override;
|
|
36
|
+
return isAbsolute(expanded) ? expanded : resolve(expanded);
|
|
37
|
+
};
|
|
38
|
+
const grokDirectory = ({ home, env }) => env.GROK_HOME || join(home, ".grok");
|
|
39
|
+
const hermesDirectory = ({ home, platform, env }) => resolveHermesClientHome(home, platform, env);
|
|
21
40
|
/** Grok Bot uses an absolute SAND_DATA_ROOT; anything else stays ~/.grokbot. */
|
|
22
41
|
const grokBotDirectory = ({ home, env }) => {
|
|
23
42
|
const root = env.SAND_DATA_ROOT;
|
|
@@ -34,20 +53,102 @@ export const GROK_BOT_MANUAL_REGISTRATION_REMEDIATION = "Grok Bot keeps connecto
|
|
|
34
53
|
export const manualRegistrationRemediation = (clientName) => clientName === "grok_bot"
|
|
35
54
|
? GROK_BOT_MANUAL_REGISTRATION_REMEDIATION
|
|
36
55
|
: undefined;
|
|
56
|
+
const OMP_PROFILE_NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/u;
|
|
57
|
+
const OMP_RESERVED_PROFILE = /^(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:\..*)?$/iu;
|
|
58
|
+
/**
|
|
59
|
+
* The OMP agent directory whose `mcp.json` holds user-scope MCP servers. OMP
|
|
60
|
+
* joins PI_CONFIG_DIR to the home directory, and a named profile ignores
|
|
61
|
+
* PI_CODING_AGENT_DIR. Relative overrides use the setup process working directory.
|
|
62
|
+
*/
|
|
63
|
+
const ompAgentDirectory = (context) => {
|
|
64
|
+
const root = join(context.home, context.env.PI_CONFIG_DIR || ".omp");
|
|
65
|
+
// OMP_PROFILE wins even when empty. Match OMP's validation on every host.
|
|
66
|
+
const profile = (context.env.OMP_PROFILE ?? context.env.PI_PROFILE)?.trim();
|
|
67
|
+
if (profile !== undefined && profile !== "" && profile !== "default") {
|
|
68
|
+
if (!OMP_PROFILE_NAME.test(profile) ||
|
|
69
|
+
profile.endsWith(".") ||
|
|
70
|
+
OMP_RESERVED_PROFILE.test(profile))
|
|
71
|
+
return err({
|
|
72
|
+
path: root,
|
|
73
|
+
message: `Invalid OMP profile ${JSON.stringify(profile)}: names must match ^[a-z0-9][a-z0-9._-]{0,63}$, cannot end with ".", and cannot be a Windows reserved device name (CON, PRN, AUX, NUL, COM0-9, LPT0-9, including extensions). Repair OMP_PROFILE or PI_PROFILE before configuring OMP.`,
|
|
74
|
+
});
|
|
75
|
+
return ok(join(root, "profiles", profile, "agent"));
|
|
76
|
+
}
|
|
77
|
+
const override = context.env.PI_CODING_AGENT_DIR;
|
|
78
|
+
return ok(override ? resolve(override) : join(root, "agent"));
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Pi's public getAgentDir()/normalizePath semantics, not OMP's profiles.
|
|
82
|
+
* Keep relative overrides relative: filesystem consumers resolve them in cwd.
|
|
83
|
+
*/
|
|
84
|
+
const piAgentDirectory = ({ home, platform, env, }) => {
|
|
85
|
+
const paths = platform === "win32" ? win32 : { join };
|
|
86
|
+
let directory = env.PI_CODING_AGENT_DIR;
|
|
87
|
+
if (!directory)
|
|
88
|
+
return paths.join(home, ".pi", "agent");
|
|
89
|
+
if (platform === "win32" &&
|
|
90
|
+
directory.startsWith("/") &&
|
|
91
|
+
!directory.startsWith("//") &&
|
|
92
|
+
!directory.includes("\\")) {
|
|
93
|
+
const drive = /^\/(?:mnt\/|cygdrive\/)?([a-z])(?:\/(.*))?$/iu.exec(directory);
|
|
94
|
+
if (drive !== null)
|
|
95
|
+
directory = `${drive[1]?.toUpperCase()}:\\${drive[2]?.replaceAll("/", "\\") ?? ""}`;
|
|
96
|
+
}
|
|
97
|
+
if (directory === "~")
|
|
98
|
+
return home;
|
|
99
|
+
if (directory.startsWith("~/") ||
|
|
100
|
+
(platform === "win32" && directory.startsWith("~\\")))
|
|
101
|
+
return paths.join(home, directory.slice(2));
|
|
102
|
+
if (directory.startsWith("file://"))
|
|
103
|
+
return fileURLToPath(directory, { windows: platform === "win32" });
|
|
104
|
+
return directory;
|
|
105
|
+
};
|
|
37
106
|
const copilotDirectory = ({ home, env }) => env.COPILOT_HOME ?? join(home, ".copilot");
|
|
38
107
|
const commandCodeDirectory = ({ home }) => join(home, ".commandcode");
|
|
39
|
-
|
|
108
|
+
/**
|
|
109
|
+
* OpenCode appends `OPENCODE_CONFIG_DIR` only when the value is non-empty.
|
|
110
|
+
* An empty variable is the same as unset and leaves the XDG directory in place.
|
|
111
|
+
*/
|
|
112
|
+
const openCodeOverrideDirectory = (env) => {
|
|
113
|
+
const directory = env.OPENCODE_CONFIG_DIR;
|
|
114
|
+
return directory === undefined || directory === "" ? undefined : directory;
|
|
115
|
+
};
|
|
116
|
+
const opencodeDirectory = (context) => openCodeOverrideDirectory(context.env) ??
|
|
117
|
+
join(context.env.XDG_CONFIG_HOME ?? join(context.home, ".config"), "opencode");
|
|
118
|
+
/** OpenCode loads global JSON before JSONC, then explicit file and directory overrides. */
|
|
119
|
+
const openCodeConfigurationPaths = (context) => {
|
|
120
|
+
const directory = join(context.env.XDG_CONFIG_HOME ?? join(context.home, ".config"), "opencode");
|
|
121
|
+
const overrideDirectory = openCodeOverrideDirectory(context.env);
|
|
122
|
+
const paths = [
|
|
123
|
+
join(directory, "config.json"),
|
|
124
|
+
join(directory, "opencode.json"),
|
|
125
|
+
join(directory, "opencode.jsonc"),
|
|
126
|
+
...(context.env.OPENCODE_CONFIG ? [context.env.OPENCODE_CONFIG] : []),
|
|
127
|
+
...(overrideDirectory !== undefined
|
|
128
|
+
? [
|
|
129
|
+
join(overrideDirectory, "opencode.json"),
|
|
130
|
+
join(overrideDirectory, "opencode.jsonc"),
|
|
131
|
+
]
|
|
132
|
+
: []),
|
|
133
|
+
];
|
|
134
|
+
const resolved = paths.map((path) => resolve(path));
|
|
135
|
+
return resolved.filter((path, index) => resolved.lastIndexOf(path) === index);
|
|
136
|
+
};
|
|
40
137
|
const existingOpenCodeConfigPath = (context) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
138
|
+
// The selected directory is loaded after an explicit file by OpenCode V1.
|
|
139
|
+
const overrideDirectory = openCodeOverrideDirectory(context.env);
|
|
140
|
+
const candidates = overrideDirectory !== undefined
|
|
141
|
+
? [
|
|
142
|
+
join(overrideDirectory, "opencode.json"),
|
|
143
|
+
join(overrideDirectory, "opencode.jsonc"),
|
|
144
|
+
].map((path) => resolve(path))
|
|
145
|
+
: context.env.OPENCODE_CONFIG
|
|
146
|
+
? [resolve(context.env.OPENCODE_CONFIG)]
|
|
147
|
+
: [
|
|
148
|
+
join(opencodeDirectory(context), "opencode.json"),
|
|
149
|
+
join(opencodeDirectory(context), "opencode.jsonc"),
|
|
150
|
+
].map((path) => resolve(path));
|
|
151
|
+
return ([...candidates].reverse().find((path) => {
|
|
51
152
|
try {
|
|
52
153
|
lstatSync(path);
|
|
53
154
|
return true;
|
|
@@ -58,17 +159,44 @@ const existingOpenCodeConfigPath = (context) => {
|
|
|
58
159
|
cause.code === "ENOENT");
|
|
59
160
|
}
|
|
60
161
|
}) ??
|
|
61
|
-
|
|
62
|
-
|
|
162
|
+
resolve(overrideDirectory !== undefined
|
|
163
|
+
? join(overrideDirectory, "opencode.json")
|
|
164
|
+
: context.env.OPENCODE_CONFIG ||
|
|
165
|
+
join(opencodeDirectory(context), "opencode.json")));
|
|
166
|
+
};
|
|
167
|
+
const geminiSettings = ({ home, platform, env, }) => {
|
|
168
|
+
const system = env.GEMINI_CLI_SYSTEM_SETTINGS_PATH ||
|
|
169
|
+
(platform === "darwin"
|
|
170
|
+
? "/Library/Application Support/GeminiCli/settings.json"
|
|
171
|
+
: platform === "win32"
|
|
172
|
+
? "C:\\ProgramData\\gemini-cli\\settings.json"
|
|
173
|
+
: "/etc/gemini-cli/settings.json");
|
|
174
|
+
const trustOverride = env.GEMINI_RESTRICTED_MODE === "true" ||
|
|
175
|
+
env.GEMINI_CLI_TRUST_WORKSPACE === "false"
|
|
176
|
+
? false
|
|
177
|
+
: env.GEMINI_CLI_TRUST_WORKSPACE === "true"
|
|
178
|
+
? true
|
|
179
|
+
: undefined;
|
|
180
|
+
return {
|
|
181
|
+
systemPath: system,
|
|
182
|
+
defaultsPath: env.GEMINI_CLI_SYSTEM_DEFAULTS_PATH ||
|
|
183
|
+
join(dirname(system), "system-defaults.json"),
|
|
184
|
+
workspaceDirectory: process.cwd(),
|
|
185
|
+
trustedFoldersPath: env.GEMINI_CLI_TRUSTED_FOLDERS_PATH ||
|
|
186
|
+
join(env.GEMINI_CLI_HOME || home, ".gemini", "trustedFolders.json"),
|
|
187
|
+
...(trustOverride === undefined ? {} : { trustOverride }),
|
|
188
|
+
platform,
|
|
189
|
+
};
|
|
63
190
|
};
|
|
64
191
|
const devinDirectory = ({ home, platform, env }) => platform === "win32"
|
|
65
192
|
? join(env.APPDATA ?? join(home, "AppData", "Roaming"), "devin")
|
|
66
|
-
: join(home, ".config", "devin");
|
|
193
|
+
: join(env.XDG_CONFIG_HOME || join(home, ".config"), "devin");
|
|
67
194
|
/** Stable product metadata used to derive setup discovery and documentation. */
|
|
68
195
|
export const SUPPORTED_CLIENT_DEFINITIONS = [
|
|
69
196
|
{
|
|
70
197
|
name: "claude_code",
|
|
71
198
|
displayName: "Claude Code",
|
|
199
|
+
skillPath: ({ home, env }) => join(env.CLAUDE_CONFIG_DIR ?? join(home, ".claude"), "skills"),
|
|
72
200
|
configPath: (context) => join(claudeCodeConfigDirectory(context), ".claude.json"),
|
|
73
201
|
markerPath: claudeCodeMarkerDirectory,
|
|
74
202
|
format: "json",
|
|
@@ -97,8 +225,10 @@ export const SUPPORTED_CLIENT_DEFINITIONS = [
|
|
|
97
225
|
{
|
|
98
226
|
name: "gemini_cli",
|
|
99
227
|
displayName: "Gemini CLI",
|
|
100
|
-
|
|
101
|
-
|
|
228
|
+
geminiSettings,
|
|
229
|
+
configPath: ({ home, env }) => join(env.GEMINI_CLI_HOME || home, ".gemini", "settings.json"),
|
|
230
|
+
markerPath: ({ home, env }) => join(env.GEMINI_CLI_HOME || home, ".gemini"),
|
|
231
|
+
skillPath: ({ home, env }) => join(env.GEMINI_CLI_HOME || home, ".agents", "skills"),
|
|
102
232
|
format: "json",
|
|
103
233
|
},
|
|
104
234
|
{
|
|
@@ -119,12 +249,14 @@ export const SUPPORTED_CLIENT_DEFINITIONS = [
|
|
|
119
249
|
name: "opencode",
|
|
120
250
|
displayName: "OpenCode",
|
|
121
251
|
configPath: existingOpenCodeConfigPath,
|
|
252
|
+
configPaths: openCodeConfigurationPaths,
|
|
122
253
|
markerPath: opencodeDirectory,
|
|
123
254
|
format: "opencode",
|
|
124
255
|
},
|
|
125
256
|
{
|
|
126
257
|
name: "antigravity",
|
|
127
258
|
displayName: "Antigravity",
|
|
259
|
+
skillPath: [".gemini", "config", "skills"],
|
|
128
260
|
configPath: [".gemini", "config", "mcp_config.json"],
|
|
129
261
|
markerPath: [".gemini", "config"],
|
|
130
262
|
format: "json",
|
|
@@ -143,6 +275,13 @@ export const SUPPORTED_CLIENT_DEFINITIONS = [
|
|
|
143
275
|
markerPath: commandCodeDirectory,
|
|
144
276
|
format: "commandcode",
|
|
145
277
|
},
|
|
278
|
+
{
|
|
279
|
+
name: "qwen_code",
|
|
280
|
+
displayName: "Qwen Code",
|
|
281
|
+
configPath: (context) => join(qwenCodeDirectory(context), "settings.json"),
|
|
282
|
+
markerPath: qwenCodeDirectory,
|
|
283
|
+
format: "json",
|
|
284
|
+
},
|
|
146
285
|
{
|
|
147
286
|
name: "vscode",
|
|
148
287
|
displayName: "VS Code",
|
|
@@ -157,6 +296,31 @@ export const SUPPORTED_CLIENT_DEFINITIONS = [
|
|
|
157
296
|
markerPath: grokDirectory,
|
|
158
297
|
format: "grok",
|
|
159
298
|
},
|
|
299
|
+
{
|
|
300
|
+
name: "omp",
|
|
301
|
+
displayName: "OMP",
|
|
302
|
+
configPath: (context) => {
|
|
303
|
+
const directory = ompAgentDirectory(context);
|
|
304
|
+
return directory.ok ? ok(join(directory.value, "mcp.json")) : directory;
|
|
305
|
+
},
|
|
306
|
+
markerPath: ompAgentDirectory,
|
|
307
|
+
format: "omp",
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: "pi",
|
|
311
|
+
displayName: "Pi",
|
|
312
|
+
configPath: (context) => (context.platform === "win32" ? win32 : { join }).join(piAgentDirectory(context), "mcp.json"),
|
|
313
|
+
markerPath: piAgentDirectory,
|
|
314
|
+
format: "pi",
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: "hermes",
|
|
318
|
+
displayName: "Hermes",
|
|
319
|
+
skillPath: (context) => join(hermesDirectory(context), "skills"),
|
|
320
|
+
configPath: (context) => join(hermesDirectory(context), "config.yaml"),
|
|
321
|
+
markerPath: hermesDirectory,
|
|
322
|
+
format: "hermes",
|
|
323
|
+
},
|
|
160
324
|
{
|
|
161
325
|
name: "grok_bot",
|
|
162
326
|
displayName: "Grok Bot",
|
|
@@ -165,24 +329,128 @@ export const SUPPORTED_CLIENT_DEFINITIONS = [
|
|
|
165
329
|
format: "unsupported",
|
|
166
330
|
},
|
|
167
331
|
];
|
|
168
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Paths whose presence means doctor and setup should inspect the client.
|
|
334
|
+
* Layered sources count: OpenCode still loads its XDG files when a custom
|
|
335
|
+
* directory override does not exist.
|
|
336
|
+
*/
|
|
337
|
+
export const clientEvidencePaths = (client) => [
|
|
338
|
+
...new Set([
|
|
339
|
+
client.configPath,
|
|
340
|
+
...(client.configPaths ?? []),
|
|
341
|
+
client.markerPath,
|
|
342
|
+
].filter((path) => path !== undefined && path.length > 0)),
|
|
343
|
+
];
|
|
344
|
+
const resolvePath = (path, context) => {
|
|
345
|
+
const resolved = typeof path === "function" ? path(context) : join(context.home, ...path);
|
|
346
|
+
return typeof resolved === "string" ? ok(resolved) : resolved;
|
|
347
|
+
};
|
|
169
348
|
/** Describe every client location that setup, doctor, or uninstall may inspect. */
|
|
170
|
-
export const supportedClients = (home, platform = process.platform, env = {
|
|
171
|
-
APPDATA: process.env.APPDATA,
|
|
172
|
-
CLAUDE_CONFIG_DIR: process.env.CLAUDE_CONFIG_DIR,
|
|
173
|
-
CODEX_HOME: process.env.CODEX_HOME,
|
|
174
|
-
COPILOT_HOME: process.env.COPILOT_HOME,
|
|
175
|
-
GROK_HOME: process.env.GROK_HOME,
|
|
176
|
-
OPENCODE_CONFIG: process.env.OPENCODE_CONFIG,
|
|
177
|
-
SAND_DATA_ROOT: process.env.SAND_DATA_ROOT,
|
|
178
|
-
XDG_CONFIG_HOME: process.env.XDG_CONFIG_HOME,
|
|
179
|
-
}) => {
|
|
349
|
+
export const supportedClients = (home, platform = process.platform, env = process.env) => {
|
|
180
350
|
const context = { home, platform, env };
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
351
|
+
const definitions = SUPPORTED_CLIENT_DEFINITIONS;
|
|
352
|
+
return definitions.map((definition) => {
|
|
353
|
+
try {
|
|
354
|
+
const config = resolvePath(definition.configPath, context);
|
|
355
|
+
const marker = config.ok
|
|
356
|
+
? resolvePath(definition.markerPath, context)
|
|
357
|
+
: config;
|
|
358
|
+
if (!config.ok)
|
|
359
|
+
return {
|
|
360
|
+
name: definition.name,
|
|
361
|
+
displayName: definition.displayName,
|
|
362
|
+
format: definition.format,
|
|
363
|
+
configPath: config.error.path,
|
|
364
|
+
configPathError: config.error.message,
|
|
365
|
+
};
|
|
366
|
+
if (!marker.ok)
|
|
367
|
+
return {
|
|
368
|
+
name: definition.name,
|
|
369
|
+
displayName: definition.displayName,
|
|
370
|
+
format: definition.format,
|
|
371
|
+
configPath: marker.error.path,
|
|
372
|
+
configPathError: marker.error.message,
|
|
373
|
+
};
|
|
374
|
+
const configPath = config.value;
|
|
375
|
+
return {
|
|
376
|
+
name: definition.name,
|
|
377
|
+
displayName: definition.displayName,
|
|
378
|
+
configPath,
|
|
379
|
+
...(definition.geminiSettings === undefined
|
|
380
|
+
? {}
|
|
381
|
+
: { geminiSettings: definition.geminiSettings(context) }),
|
|
382
|
+
...(definition.configPaths === undefined
|
|
383
|
+
? {}
|
|
384
|
+
: {
|
|
385
|
+
configPaths: [
|
|
386
|
+
...new Set([...definition.configPaths(context), configPath]),
|
|
387
|
+
],
|
|
388
|
+
}),
|
|
389
|
+
markerPath: marker.value,
|
|
390
|
+
format: definition.format,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
catch (cause) {
|
|
394
|
+
if (cause instanceof HermesClientPathError)
|
|
395
|
+
return {
|
|
396
|
+
name: definition.name,
|
|
397
|
+
displayName: definition.displayName,
|
|
398
|
+
format: definition.format,
|
|
399
|
+
configPath: cause.path,
|
|
400
|
+
configPathError: cause.message,
|
|
401
|
+
};
|
|
402
|
+
if (definition.name !== "pi")
|
|
403
|
+
throw cause;
|
|
404
|
+
return {
|
|
405
|
+
name: definition.name,
|
|
406
|
+
displayName: definition.displayName,
|
|
407
|
+
format: definition.format,
|
|
408
|
+
configPath: env.PI_CODING_AGENT_DIR ?? "",
|
|
409
|
+
configPathError: `Invalid PI_CODING_AGENT_DIR: ${cause instanceof Error ? cause.message : String(cause)}. Repair the override before configuring Pi.`,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
/** Resolve personal skill roots using the same client environment as setup. */
|
|
415
|
+
export const clientSkillDirectories = (home, clientIds, environment = {}, platform = process.platform) => {
|
|
416
|
+
const definitions = SUPPORTED_CLIENT_DEFINITIONS;
|
|
417
|
+
const selected = clientIds === undefined
|
|
418
|
+
? [
|
|
419
|
+
"shared",
|
|
420
|
+
...definitions
|
|
421
|
+
.filter(({ skillPath }) => skillPath !== undefined)
|
|
422
|
+
.map(({ name }) => name),
|
|
423
|
+
]
|
|
424
|
+
: clientIds.length === 0
|
|
425
|
+
? ["shared"]
|
|
426
|
+
: clientIds;
|
|
427
|
+
const destinations = new Map();
|
|
428
|
+
for (const client of selected) {
|
|
429
|
+
const definition = definitions.find(({ name }) => name === client);
|
|
430
|
+
let directory;
|
|
431
|
+
try {
|
|
432
|
+
const resolved = definition?.skillPath === undefined
|
|
433
|
+
? ok(join(home, ".agents", "skills"))
|
|
434
|
+
: resolvePath(definition.skillPath, {
|
|
435
|
+
home,
|
|
436
|
+
platform,
|
|
437
|
+
env: environment,
|
|
438
|
+
});
|
|
439
|
+
if (!resolved.ok)
|
|
440
|
+
continue;
|
|
441
|
+
directory = resolved.value;
|
|
442
|
+
}
|
|
443
|
+
catch (cause) {
|
|
444
|
+
// Registration diagnostics own an unresolved profile; never fall back to another skill root.
|
|
445
|
+
if (cause instanceof HermesClientPathError)
|
|
446
|
+
continue;
|
|
447
|
+
throw cause;
|
|
448
|
+
}
|
|
449
|
+
if (!destinations.has(directory))
|
|
450
|
+
destinations.set(directory, {
|
|
451
|
+
client: directory === join(home, ".agents", "skills") ? "shared" : client,
|
|
452
|
+
directory,
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
return [...destinations.values()].sort((left, right) => left.directory.localeCompare(right.directory));
|
|
188
456
|
};
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { parseClientConfiguration, serializeClientConfiguration, clientServerPath, legacyClientServerPath, withClientServers, } from "./ClientConfigurationDocument.js";
|
|
2
|
-
import { copyFile, lstat,
|
|
2
|
+
import { copyFile, lstat, realpath, rm } from "node:fs/promises";
|
|
3
3
|
import { constants as fsConstants } from "node:fs";
|
|
4
4
|
import { homeDirectoryFromEnvironment } from "../config/homeDirectory.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import writeFileAtomic from "write-file-atomic";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { PRODUCT_IDENTITY } from "../identity.js";
|
|
9
|
+
import { isManagedSkillManifest, MANAGED_SKILL_FILES, readSkillFile, skillDestinations, } from "./SetupSkill.js";
|
|
9
10
|
import { isOwnedClientRegistrationCommand } from "./ClientRegistrationIdentity.js";
|
|
10
11
|
import { resolveClientConfigTransactionPath } from "./ClientConfigPath.js";
|
|
12
|
+
import { readRegularFileText } from "./RegularFileRead.js";
|
|
11
13
|
import { manualRegistrationRemediation, supportedClients, } from "./SupportedClients.js";
|
|
12
14
|
const systemFileSystem = {
|
|
13
|
-
readText: (path) =>
|
|
15
|
+
readText: (path) => readRegularFileText(path),
|
|
16
|
+
readRegularText: readSkillFile,
|
|
14
17
|
copy: (source, destination) => copyFile(source, destination, fsConstants.COPYFILE_EXCL),
|
|
15
18
|
writeText: (path, contents) => writeFileAtomic(path, contents, { encoding: "utf8" }),
|
|
16
19
|
stat: (path) => lstat(path),
|
|
17
20
|
realpath: (path) => realpath(path),
|
|
18
|
-
remove: (path) => rm(path, { recursive
|
|
21
|
+
remove: (path, recursive = true) => rm(path, { recursive }),
|
|
19
22
|
};
|
|
20
23
|
/** Whether any requested REA-owned uninstall action failed. */
|
|
21
24
|
export const isUninstallFailure = (result) => {
|
|
@@ -56,11 +59,12 @@ export const runUninstall = async (purgeData, host = systemUninstallHost()) => {
|
|
|
56
59
|
status: "retained",
|
|
57
60
|
detail: "Hopper is not owned by REA uninstall.",
|
|
58
61
|
});
|
|
62
|
+
const reported = collapseUninstallItems(items);
|
|
59
63
|
return {
|
|
60
|
-
status:
|
|
64
|
+
status: reported.some(({ status }) => status === "failed")
|
|
61
65
|
? "failed"
|
|
62
66
|
: "complete",
|
|
63
|
-
items,
|
|
67
|
+
items: reported,
|
|
64
68
|
};
|
|
65
69
|
};
|
|
66
70
|
/**
|
|
@@ -87,7 +91,12 @@ const removeAll = async (clients, purgeData, host) => {
|
|
|
87
91
|
export const systemUninstallHost = (selectedHome = undefined, fileSystem = systemFileSystem, environment = process.env, platform = process.platform) => {
|
|
88
92
|
const home = selectedHome ?? homeDirectoryFromEnvironment(environment, platform);
|
|
89
93
|
return {
|
|
90
|
-
clients: () => Promise.resolve(supportedClients(home, platform, environment))
|
|
94
|
+
clients: () => Promise.resolve(supportedClients(home, platform, environment).flatMap((client) => client.configPaths === undefined
|
|
95
|
+
? [client]
|
|
96
|
+
: client.configPaths.map((configPath) => ({
|
|
97
|
+
...client,
|
|
98
|
+
configPath,
|
|
99
|
+
})))),
|
|
91
100
|
inspectClient: async (client) => {
|
|
92
101
|
const read = await readClientConfiguration(client, fileSystem);
|
|
93
102
|
return read.kind === "item" && read.item.status === "failed"
|
|
@@ -95,7 +104,7 @@ export const systemUninstallHost = (selectedHome = undefined, fileSystem = syste
|
|
|
95
104
|
: undefined;
|
|
96
105
|
},
|
|
97
106
|
removeClient: (client) => removeClient(client, fileSystem),
|
|
98
|
-
removeSkill: () => removeManagedSkills(home, fileSystem),
|
|
107
|
+
removeSkill: () => removeManagedSkills(home, fileSystem, environment, platform),
|
|
99
108
|
purgeData: async () => [
|
|
100
109
|
await removeManagedPath(join(home, ".rea/cache"), "cache", fileSystem),
|
|
101
110
|
await removeManagedPath(join(home, ".rea/state"), "state", fileSystem),
|
|
@@ -103,6 +112,8 @@ export const systemUninstallHost = (selectedHome = undefined, fileSystem = syste
|
|
|
103
112
|
};
|
|
104
113
|
};
|
|
105
114
|
const readClientConfiguration = async (client, fileSystem) => {
|
|
115
|
+
if (client.configPathError !== undefined)
|
|
116
|
+
return itemRead(item(client.name, "failed", client.configPathError));
|
|
106
117
|
if (client.format === "unsupported")
|
|
107
118
|
return itemRead(item(client.name, "skipped", manualRegistrationRemediation(client.name) ??
|
|
108
119
|
"This client has no documented local MCP configuration boundary."));
|
|
@@ -224,8 +235,161 @@ const removeManagedPath = async (path, name, fileSystem) => {
|
|
|
224
235
|
: item(name, "failed", "This item could not be removed. Check file permissions, then rerun uninstall.");
|
|
225
236
|
}
|
|
226
237
|
};
|
|
227
|
-
const removeManagedSkills = async (home, fileSystem
|
|
238
|
+
const removeManagedSkills = async (home, fileSystem, environment, platform) => {
|
|
239
|
+
const results = await Promise.all(skillDestinations(home, undefined, environment, platform).map(({ client, path }) => removeManagedSkill(path, client === "claude_code" ? "Claude Code skill" : "skill", fileSystem)));
|
|
240
|
+
const failed = results.find(({ status }) => status === "failed");
|
|
241
|
+
if (failed !== undefined)
|
|
242
|
+
return item("skill", "failed", results
|
|
243
|
+
.map(({ name, status, detail }) => `${name}: ${status} (${detail})`)
|
|
244
|
+
.join(" "));
|
|
245
|
+
const status = results.some(({ status: resultStatus }) => resultStatus === "removed")
|
|
246
|
+
? "removed"
|
|
247
|
+
: results.some(({ status: resultStatus }) => resultStatus === "retained")
|
|
248
|
+
? "retained"
|
|
249
|
+
: "skipped";
|
|
250
|
+
return item("skill", status, results
|
|
251
|
+
.map(({ name, status: resultStatus, detail }) => `${name}: ${resultStatus} (${detail})`)
|
|
252
|
+
.join(" "));
|
|
253
|
+
};
|
|
254
|
+
const removeManagedSkill = async (path, name, fileSystem) => {
|
|
255
|
+
let root;
|
|
256
|
+
try {
|
|
257
|
+
root = await fileSystem.stat(path);
|
|
258
|
+
}
|
|
259
|
+
catch (cause) {
|
|
260
|
+
return isMissing(cause)
|
|
261
|
+
? item(name, "skipped", "Skill directory does not exist.")
|
|
262
|
+
: item(name, "failed", "Skill directory could not be inspected.");
|
|
263
|
+
}
|
|
264
|
+
if (root.isSymbolicLink())
|
|
265
|
+
return item(name, "retained", "Skill directory is a symbolic link.");
|
|
266
|
+
if (root.isDirectory?.() !== true)
|
|
267
|
+
return item(name, "retained", "Skill path is not a directory.");
|
|
268
|
+
const manifestPath = join(path, "SKILL.md");
|
|
269
|
+
try {
|
|
270
|
+
const manifest = await fileSystem.stat(manifestPath);
|
|
271
|
+
if (manifest.isSymbolicLink())
|
|
272
|
+
return item(name, "retained", "Skill manifest is a symbolic link.");
|
|
273
|
+
if (manifest.isFile?.() !== true)
|
|
274
|
+
return item(name, "retained", "Skill manifest is not a regular file.");
|
|
275
|
+
}
|
|
276
|
+
catch (cause) {
|
|
277
|
+
return isMissing(cause)
|
|
278
|
+
? item(name, "retained", "Skill ownership could not be established.")
|
|
279
|
+
: item(name, "failed", "Skill manifest could not be inspected.");
|
|
280
|
+
}
|
|
281
|
+
let content;
|
|
282
|
+
try {
|
|
283
|
+
content = await (fileSystem.readRegularText?.(manifestPath) ??
|
|
284
|
+
fileSystem.readText(manifestPath));
|
|
285
|
+
}
|
|
286
|
+
catch (cause) {
|
|
287
|
+
return isMissing(cause)
|
|
288
|
+
? item(name, "retained", "Skill ownership could not be established.")
|
|
289
|
+
: item(name, "failed", "Skill manifest could not be read.");
|
|
290
|
+
}
|
|
291
|
+
if (!isManagedSkillManifest(content))
|
|
292
|
+
return item(name, "retained", "Skill manifest is not REA-owned.");
|
|
293
|
+
const manifestName = "SKILL.md";
|
|
294
|
+
const otherFiles = MANAGED_SKILL_FILES.filter((relativePath) => relativePath !== manifestName);
|
|
295
|
+
const results = [];
|
|
296
|
+
for (const relativePath of otherFiles)
|
|
297
|
+
results.push(await removeManagedSkillFile(path, relativePath, name, fileSystem));
|
|
298
|
+
if (results.some(({ status }) => status === "failed" || status === "retained"))
|
|
299
|
+
results.push(item(name, "retained", "REA ownership manifest was retained because a managed file could not be safely removed."));
|
|
300
|
+
else
|
|
301
|
+
results.push(await removeManagedSkillFile(path, manifestName, name, fileSystem));
|
|
302
|
+
const failed = results.find(({ status }) => status === "failed");
|
|
303
|
+
if (failed !== undefined)
|
|
304
|
+
return item(name, "failed", results.map(({ detail }) => detail).join(" "));
|
|
305
|
+
const removed = results.some(({ status }) => status === "removed");
|
|
306
|
+
return item(name, removed ? "removed" : "skipped", "REA-managed skill files were removed; other files were preserved.");
|
|
307
|
+
};
|
|
308
|
+
const removeManagedSkillFile = async (root, relativePath, name, fileSystem) => {
|
|
309
|
+
const segments = relativePath.split(/[\\/]/u);
|
|
310
|
+
let parent = root;
|
|
311
|
+
for (const segment of segments.slice(0, -1)) {
|
|
312
|
+
parent = join(parent, segment);
|
|
313
|
+
try {
|
|
314
|
+
const stats = await fileSystem.stat(parent);
|
|
315
|
+
if (stats.isSymbolicLink() || stats.isDirectory?.() !== true)
|
|
316
|
+
return item(name, "retained", `Managed path parent was retained: ${parent}.`);
|
|
317
|
+
}
|
|
318
|
+
catch (cause) {
|
|
319
|
+
return isMissing(cause)
|
|
320
|
+
? item(name, "skipped", `${join(parent, segments.at(-1) ?? "")} does not exist.`)
|
|
321
|
+
: item(name, "failed", `Managed path parent could not be inspected: ${parent}.`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const target = join(root, relativePath);
|
|
325
|
+
let stats;
|
|
326
|
+
try {
|
|
327
|
+
stats = await fileSystem.stat(target);
|
|
328
|
+
}
|
|
329
|
+
catch (cause) {
|
|
330
|
+
return isMissing(cause)
|
|
331
|
+
? item(name, "skipped", `${target} does not exist.`)
|
|
332
|
+
: item(name, "failed", `Managed file could not be inspected: ${target}.`);
|
|
333
|
+
}
|
|
334
|
+
if (stats.isSymbolicLink())
|
|
335
|
+
return item(name, "retained", `Managed file is a symbolic link: ${target}.`);
|
|
336
|
+
if (stats.isFile?.() !== true)
|
|
337
|
+
return item(name, "retained", `Managed path is not a regular file: ${target}.`);
|
|
338
|
+
try {
|
|
339
|
+
await fileSystem.remove(target, false);
|
|
340
|
+
return item(name, "removed", `Removed ${target}.`);
|
|
341
|
+
}
|
|
342
|
+
catch (cause) {
|
|
343
|
+
return isMissing(cause)
|
|
344
|
+
? item(name, "skipped", `${target} does not exist.`)
|
|
345
|
+
: item(name, "failed", `Managed file could not be removed: ${target}.`);
|
|
346
|
+
}
|
|
347
|
+
};
|
|
228
348
|
const item = (name, status, detail) => ({ name, status, detail });
|
|
349
|
+
/**
|
|
350
|
+
* Layered clients are removed file by file, but callers look up one status by
|
|
351
|
+
* client name. A missing earlier file must not hide a later removal.
|
|
352
|
+
*/
|
|
353
|
+
const collapseUninstallItems = (items) => {
|
|
354
|
+
const collapsed = [];
|
|
355
|
+
for (const next of items) {
|
|
356
|
+
const index = collapsed.findIndex(({ name }) => name === next.name);
|
|
357
|
+
const current = collapsed[index];
|
|
358
|
+
if (current === undefined) {
|
|
359
|
+
collapsed.push(next);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
collapsed[index] = mergeUninstallItems(current, next);
|
|
363
|
+
}
|
|
364
|
+
return collapsed;
|
|
365
|
+
};
|
|
366
|
+
const mergeUninstallItems = (current, next) => {
|
|
367
|
+
const status = preferredUninstallStatus(current.status, next.status);
|
|
368
|
+
const details = [current, next]
|
|
369
|
+
.filter((entry) => entry.status === status ||
|
|
370
|
+
(status === "removed" && entry.status === "retained"))
|
|
371
|
+
.map(({ detail }) => detail);
|
|
372
|
+
return item(current.name, status, [...new Set(details)].join(" "));
|
|
373
|
+
};
|
|
374
|
+
const preferredUninstallStatus = (current, next) => uninstallStatusPriority(next) > uninstallStatusPriority(current)
|
|
375
|
+
? next
|
|
376
|
+
: current;
|
|
377
|
+
const uninstallStatusPriority = (status) => {
|
|
378
|
+
switch (status) {
|
|
379
|
+
case "failed":
|
|
380
|
+
return 3;
|
|
381
|
+
case "removed":
|
|
382
|
+
return 2;
|
|
383
|
+
case "retained":
|
|
384
|
+
return 1;
|
|
385
|
+
case "skipped":
|
|
386
|
+
return 0;
|
|
387
|
+
default: {
|
|
388
|
+
const exhaustive = status;
|
|
389
|
+
throw new TypeError(`Unhandled uninstall item status: ${String(exhaustive)}`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
229
393
|
const registrationSchema = z
|
|
230
394
|
.object({ command: z.string(), args: z.array(z.string()) })
|
|
231
395
|
.passthrough();
|