rea-agents 6.4.0 → 6.7.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/DISCLAIMER.md +136 -0
- package/README.md +76 -16
- package/THIRD_PARTY_NOTICES.md +135 -0
- package/bridge/android/ReaJadxBridge.java +281 -25
- package/bridge/cutter/rea_bridge.py +825 -0
- package/bridge/ghidra/ReaGhidraAnalysisOptions.java +38 -0
- package/bridge/ghidra/ReaGhidraBridge.java +1232 -142
- package/bridge/ghidra/ReaGhidraBundleActivator.java +14 -0
- package/bridge/ghidra/ReaGhidraMipsSoftFloat.java +176 -0
- package/bridge/ghidra/ReaGhidraPrepareRaw.java +49 -0
- package/bridge/hopper_bridge.py +111 -69
- package/bridge/mitmproxy/capture.py +189 -13
- package/bridge/native/rea_lldb_tracer.py +88 -10
- package/bridge/process/ProcessRunTokenReader.swift +76 -34
- package/bridge/pwndbg/core_context.py +15 -2
- package/bridge/pwntools/layout_impl.py +5 -0
- package/bridge/pwntools/recorded_crash_impl.py +31 -10
- package/dist/adb/AdbCommand.js +148 -0
- package/dist/adb/AdbConfiguration.js +41 -7
- package/dist/adb/AdbDeviceOutput.js +59 -37
- package/dist/adb/AdbDirectoryListing.js +80 -0
- package/dist/adb/AdbHostFileName.js +34 -0
- package/dist/adb/AdbInputSnapshot.js +126 -0
- package/dist/adb/AdbProvider.js +1106 -346
- package/dist/adb/AdbShellOutput.js +146 -77
- package/dist/android/AndroidTargetSnapshot.js +7 -7
- package/dist/android/JadxAnalysis.js +53 -33
- package/dist/android/JadxConfiguration.js +283 -145
- package/dist/android/JadxDoctor.js +123 -0
- package/dist/android/JadxFailure.js +154 -0
- package/dist/android/JadxInterruption.js +13 -0
- package/dist/android/JadxJavaProbe.js +246 -0
- package/dist/android/JadxMcpTransport.js +53 -18
- package/dist/android/JadxProtocol.js +43 -2
- package/dist/android/JadxProvider.js +183 -102
- package/dist/android/JadxRelease.js +17 -2
- package/dist/android/JadxSession.js +35 -14
- package/dist/android/JadxWorkspaceRoot.js +157 -0
- package/dist/apktool/ApktoolCommandCleanup.js +134 -0
- package/dist/apktool/ApktoolCommandOutput.js +22 -0
- package/dist/apktool/ApktoolConfiguration.js +306 -45
- package/dist/apktool/ApktoolDecodeOutput.js +131 -42
- package/dist/apktool/ApktoolDecodedInventory.js +52 -0
- package/dist/apktool/ApktoolProvider.js +296 -340
- package/dist/apktool/ApktoolStringTables.js +178 -0
- package/dist/apktool/ApktoolWorkspace.js +162 -0
- package/dist/application/AnalysisContextQueries.js +5 -8
- package/dist/application/AnalysisDocument.js +19 -4
- package/dist/application/AnalysisProvider.js +36 -18
- package/dist/application/AppBundleExecutable.js +16 -9
- package/dist/application/BinaryTargetResolver.js +204 -40
- package/dist/application/BrowserEvidence.js +1 -1
- package/dist/application/BrowserObservationService.js +54 -9
- package/dist/application/BrowserScenarioCaptureService.js +26 -7
- package/dist/application/CallPathTracing.js +52 -13
- package/dist/application/CapabilityInventory.js +182 -36
- package/dist/application/ClaudeDesktopConfigLocation.js +152 -0
- package/dist/application/ClientConfigurationCleanup.js +73 -0
- package/dist/application/ClientConfigurationDocument.js +270 -151
- package/dist/application/ClientConfigurationFiles.js +51 -14
- package/dist/application/ClientConfigurationPublication.js +167 -0
- package/dist/application/ClientRegistrationEnvironment.js +40 -4
- package/dist/application/ClientRegistrationIdentity.js +112 -32
- package/dist/application/ClientRegistrationStatus.js +280 -84
- package/dist/application/DirectAnalysis.js +98 -30
- package/dist/application/DirectAnalysisCleanup.js +5 -1
- package/dist/application/DirectAnalysisStatus.js +13 -1
- package/dist/application/Doctor.js +192 -37
- package/dist/application/DoctorDiagnostics.js +59 -16
- package/dist/application/DoctorProviderIds.js +8 -0
- package/dist/application/DoctorScope.js +11 -2
- package/dist/application/DshCordisPatch.js +355 -0
- package/dist/application/DshCordisYaml.js +155 -0
- package/dist/application/EnhancedLiteralTracing.js +30 -16
- package/dist/application/EnhancedToolTypes.js +0 -1
- package/dist/application/EnhancedTools.js +154 -56
- package/dist/application/EvidenceBundleCommands.js +30 -7
- package/dist/application/EvidenceBundleFiles.js +29 -7
- package/dist/application/FunctionAnalysisEvidence.js +3 -0
- package/dist/application/GeminiClientSettings.js +25 -13
- package/dist/application/HermesClientHome.js +20 -0
- package/dist/application/HermesConfigurationYaml.js +312 -0
- package/dist/application/HopperDownload.js +11 -3
- package/dist/application/HopperReleaseFeed.js +71 -0
- package/dist/application/InventoryProjectionEvidence.js +0 -1
- package/dist/application/InvestigationProviders.js +14 -3
- package/dist/application/JsonFiles.js +110 -20
- package/dist/application/JsonInputFile.js +220 -62
- package/dist/application/LinuxHopper.js +218 -115
- package/dist/application/LinuxHopperPublisher.js +656 -0
- package/dist/application/MacHopper.js +203 -83
- package/dist/application/MacHopperPaths.js +40 -0
- package/dist/application/{MipsElfAbiFlags.js → MipsElfMetadata.js} +71 -10
- package/dist/application/MipsElfSharedLoad.js +164 -0
- package/dist/application/MipsGnuAttributes.js +90 -0
- package/dist/application/MsixPackageStorage.js +140 -0
- package/dist/application/ProgressReporter.js +1 -1
- package/dist/application/ProviderOperationExecution.js +15 -14
- package/dist/application/ReconstructionCoverageService.js +0 -1
- package/dist/application/ReconstructionObligationCandidates.js +20 -4
- package/dist/application/ReconstructionObligationLedgerDiagnostics.js +2 -2
- package/dist/application/ReconstructionObligationLedgerEvaluation.js +19 -33
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -72
- package/dist/application/ReconstructionObligationLedgerService.js +6 -2
- package/dist/application/ReconstructionObligationOriginalCases.js +10 -1
- package/dist/application/ReferenceSourceImport.js +24 -8
- package/dist/application/ReferenceSourceImportEntries.js +180 -37
- package/dist/application/ReferenceSourceImportPolicy.js +5 -3
- package/dist/application/ReferenceSourceImportTypes.js +0 -1
- package/dist/application/ReferenceSourceVcsAdapter.js +36 -17
- package/dist/application/RegularFileRead.js +117 -70
- package/dist/application/Setup.js +59 -21
- package/dist/application/SetupClientConfiguration.js +301 -66
- package/dist/application/SetupClients.js +25 -10
- package/dist/application/SetupHost.js +149 -51
- package/dist/application/SetupInstallFailure.js +58 -3
- package/dist/application/SetupPlan.js +94 -55
- package/dist/application/SetupRecoveryBackup.js +93 -0
- package/dist/application/SetupRegistrationEnvironment.js +14 -1
- package/dist/application/SetupSkill.js +303 -76
- package/dist/application/SourceLimitations.js +35 -0
- package/dist/application/SupportedClients.js +166 -32
- package/dist/application/TypeScriptEmittedSourceCandidates.js +26 -0
- package/dist/application/Uninstall.js +356 -110
- package/dist/application/UninstallFailure.js +14 -0
- package/dist/application/Update.js +54 -25
- package/dist/application/UpdateCommandProgress.js +66 -0
- package/dist/application/UpdateFailure.js +17 -0
- package/dist/application/UpdateMaintenance.js +18 -31
- package/dist/application/UpdateRuntime.js +198 -54
- package/dist/application/WebModuleTraceService.js +42 -22
- package/dist/application/WebNetworkCaptureService.js +24 -12
- package/dist/application/WebRuntimeService.js +41 -8
- package/dist/application/WebScriptExportService.js +6 -4
- package/dist/application/WebSourceLocationService.js +23 -8
- package/dist/application/WindowsCapabilities.js +18 -15
- package/dist/application/WorkflowEvidence.js +31 -1
- package/dist/application/analysisView/AnalysisViewService.js +46 -11
- package/dist/application/android/AndroidAnalysisService.js +5 -4
- package/dist/application/android/AndroidPackageInspection.js +25 -0
- package/dist/application/android/AndroidSearchEvidenceSummary.js +98 -0
- package/dist/application/artifacts/ArtifactComparisonEvidence.js +32 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +14 -11
- package/dist/application/binary/AnalysisProviderRegistry.js +365 -60
- package/dist/application/binary/AnalysisSnapshotCache.js +41 -20
- package/dist/application/binary/AnalysisSnapshotFiles.js +75 -9
- package/dist/application/binary/BinarySession.js +308 -117
- package/dist/application/binary/BinarySessionExecution.js +5 -4
- package/dist/application/binary/BinarySessionOpen.js +13 -6
- package/dist/application/binary/BinarySessionRecords.js +36 -7
- package/dist/application/binary/BinarySessionStatus.js +96 -27
- package/dist/application/binary/BinaryTargetSummary.js +9 -0
- package/dist/application/binary/CompositeProvider.js +116 -28
- package/dist/application/binary/LazyAnalysisProvider.js +6 -66
- package/dist/application/binary/SessionProviderRouter.js +16 -4
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +14 -5
- package/dist/application/binaryDiagnostics/PeResourcesService.js +25 -5
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +17 -7
- package/dist/application/captures/PacketCaptureService.js +84 -0
- package/dist/application/closeOwnedWebResources.js +37 -0
- package/dist/application/electron/ElectronFusePort.js +1 -0
- package/dist/application/electron/ElectronFuseService.js +45 -0
- package/dist/application/evm/EvmInterfaceEvidence.js +11 -0
- package/dist/application/evm/EvmInterfaceService.js +5 -15
- package/dist/application/firmware/FirmwareAnalysisService.js +4 -3
- package/dist/application/flutter/DartAotInspection.js +26 -0
- package/dist/application/flutter/FlutterBuildAnalysisPort.js +1 -0
- package/dist/application/flutter/FlutterBuildAnalysisService.js +13 -0
- package/dist/application/frida/FridaInstrumentationPort.js +8 -0
- package/dist/application/frida/FridaInstrumentationService.js +310 -0
- package/dist/application/frida/fridaInputErrors.js +17 -0
- package/dist/application/go/GoBinaryPort.js +1 -0
- package/dist/application/go/GoBinaryService.js +79 -0
- package/dist/application/harmony/HarmonyApplicationService.js +17 -0
- package/dist/application/investigation/EvidenceLedger.js +43 -18
- package/dist/application/investigation/InvestigationRecords.js +12 -21
- package/dist/application/investigation/UnknownEvidence.js +22 -18
- package/dist/application/javascript/ElectronActiveObservationService.js +55 -25
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +17 -3
- package/dist/application/javascript/ElectronBoundaryGraph.js +2 -0
- package/dist/application/javascript/ElectronBoundaryGraphCallPaths.js +144 -0
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +26 -7
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +1 -1
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +61 -11
- package/dist/application/javascript/ElectronEvidence.js +1 -2
- package/dist/application/javascript/ElectronObservationService.js +41 -8
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +21 -0
- package/dist/application/javascript/JavaScriptApplicationService.js +29 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +119 -49
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +30 -1
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +51 -21
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +31 -7
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +28 -6
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +25 -14
- package/dist/application/javascript/JavaScriptArtifactGraphEvidence.js +3 -3
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +186 -50
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +173 -14
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +959 -188
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +57 -32
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +2 -0
- package/dist/application/javascript/JavaScriptModuleRelationships.js +34 -12
- package/dist/application/javascript/JavaScriptRecoveryService.js +29 -9
- package/dist/application/javascript/JavaScriptRuntimeObservationEvidence.js +1 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +33 -9
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +0 -1
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +4 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +138 -43
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +13 -4
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +23 -3
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +18 -5
- package/dist/application/javascript/JavaScriptSemanticGraphElectronProjection.js +67 -0
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +4 -6
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +5 -8
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +0 -1
- package/dist/application/managed/ManagedApplicationGraphService.js +0 -1
- package/dist/application/managed/ManagedMemberComparisonService.js +72 -54
- package/dist/application/managed/ManagedNativeVerificationService.js +0 -1
- package/dist/application/managed/ManagedReconstructionService.js +0 -1
- package/dist/application/native/NativeCallRoutes.js +78 -41
- package/dist/application/native/NativeDispatchMetadataInspection.js +6 -2
- package/dist/application/native/NativeUiActionTrace.js +43 -22
- package/dist/application/native/NativeValueTrace.js +65 -23
- package/dist/application/pcap/PcapAnalysisPort.js +1 -0
- package/dist/application/pcap/PcapAnalysisService.js +24 -0
- package/dist/application/process/ProcessCli.js +33 -13
- package/dist/application/reverse/ReverseEngineeringCommandPort.js +1 -0
- package/dist/application/reverse/ReverseEngineeringService.js +688 -0
- package/dist/application/rust/RustBinaryPort.js +1 -0
- package/dist/application/rust/RustBinaryService.js +82 -0
- package/dist/application/signals/SignalRecordingService.js +84 -0
- package/dist/application/sqlite/SqliteDatabaseCapability.js +30 -0
- package/dist/application/sqlite/SqliteDatabasePort.js +1 -0
- package/dist/application/sqlite/SqliteDatabaseService.js +76 -0
- package/dist/application/wasm/WasmArtifactPort.js +1 -0
- package/dist/application/wasm/WasmArtifactService.js +76 -0
- package/dist/application/wasm/WasmInterfaceComparisonService.js +188 -0
- package/dist/artifacts/AnalysisCleanupLease.js +119 -0
- package/dist/artifacts/ArtifactFileOperation.js +150 -0
- package/dist/artifacts/ArtifactHash.js +15 -3
- package/dist/artifacts/ArtifactPaths.js +4 -7
- package/dist/artifacts/ArtifactProvider.js +24 -9
- package/dist/artifacts/ArtifactReader.js +63 -5
- package/dist/artifacts/ArtifactResourceScope.js +92 -9
- package/dist/artifacts/AsarArtifactReader.js +186 -120
- package/dist/artifacts/AsarEntryStream.js +49 -17
- package/dist/artifacts/AsarListing.js +78 -0
- package/dist/artifacts/DirectoryArtifactReader.js +119 -28
- package/dist/artifacts/MachOSliceArtifactReader.js +153 -23
- package/dist/artifacts/NativeDmgArtifactReader.js +264 -62
- package/dist/artifacts/OrderedReads.js +57 -0
- package/dist/artifacts/SafeOutputTree.js +24 -7
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +1 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +10 -16
- package/dist/artifacts/ZipArtifactReader.js +150 -25
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +79 -68
- package/dist/artifacts/apple/DylibFileAccess.js +106 -0
- package/dist/artifacts/apple/DylibResolutionReader.js +72 -157
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +108 -29
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +81 -28
- package/dist/artifacts/apple/KeyedArchiveReader.js +23 -13
- package/dist/artifacts/apple/MachoLoadCommandReader.js +77 -61
- package/dist/artifacts/apple/NibArchive.js +11 -4
- package/dist/artifacts/apple/PlistNumberLiterals.js +106 -118
- package/dist/artifacts/extraction/ArtifactExtraction.js +21 -19
- package/dist/artifacts/hostExecutableMarking.js +16 -0
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +139 -41
- package/dist/artifacts/inventory/classify.js +36 -17
- package/dist/artifacts/inventory/hashStableRootArtifact.js +14 -7
- package/dist/artifacts/inventory/reader.js +36 -21
- package/dist/artifacts/inventory/scanCanonical.js +27 -21
- package/dist/artifacts/inventory/scanReader.js +36 -10
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +166 -8
- package/dist/artifacts/readArtifactFileChunks.js +9 -0
- package/dist/artifacts/readStableArtifact.js +13 -11
- package/dist/browser/BrowserProcessStartup.js +20 -9
- package/dist/browser/BrowserScenarioPartialObservation.js +74 -92
- package/dist/browser/BrowserScenarioSecrets.js +176 -46
- package/dist/browser/CdpBrowserProvider.js +124 -102
- package/dist/browser/CdpCaptureDocuments.js +232 -102
- package/dist/browser/CdpCaptureDomSvg.js +80 -76
- package/dist/browser/CdpCaptureEventBodyShapes.js +9 -5
- package/dist/browser/CdpCaptureEventHandlers.js +23 -12
- package/dist/browser/CdpCaptureEvents.js +49 -10
- package/dist/browser/CdpCaptureStorage.js +22 -5
- package/dist/browser/CdpCaptureStorageFingerprints.js +54 -11
- package/dist/browser/CdpCaptureValues.js +12 -1
- package/dist/browser/CdpConnection.js +135 -30
- package/dist/browser/CdpElectronInspection.js +74 -64
- package/dist/browser/CdpElectronProvider.js +63 -6
- package/dist/browser/CdpElectronScriptEvents.js +4 -1
- package/dist/browser/CdpElectronScripts.js +4 -6
- package/dist/browser/CdpElectronWorkers.js +20 -4
- package/dist/browser/CdpEndpoint.js +143 -17
- package/dist/browser/CdpObservationSession.js +24 -8
- package/dist/browser/CdpPageCapture.js +68 -17
- package/dist/browser/CdpPageCaptureScripts.js +18 -13
- package/dist/browser/CdpPageCaptureWorkers.js +46 -11
- package/dist/browser/CdpSafeMetadata.js +32 -24
- package/dist/browser/CdpScreenshot.js +5 -14
- package/dist/browser/CdpSnapshotNodes.js +103 -0
- package/dist/browser/CdpSnapshotStrings.js +15 -0
- package/dist/browser/CdpTargetSession.js +76 -7
- package/dist/browser/CdpTargetSessionOwner.js +198 -0
- package/dist/browser/CdpWebMcpDiscovery.js +23 -6
- package/dist/browser/ElectronCaptureCleanup.js +82 -0
- package/dist/browser/ElectronProcessCleanup.js +91 -0
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +75 -20
- package/dist/browser/PlaywrightElectronActiveActions.js +57 -9
- package/dist/browser/PlaywrightElectronActiveFuses.js +86 -0
- package/dist/browser/PlaywrightElectronActiveProjection.js +21 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +237 -175
- package/dist/browser/PlaywrightExecutionBoundary.js +6 -4
- package/dist/browser/PlaywrightScenarioBrowser.js +240 -91
- package/dist/browser/PlaywrightScenarioEvents.js +287 -38
- package/dist/browser/PlaywrightScenarioServiceWorkers.js +336 -0
- package/dist/browser/PlaywrightScenarioSession.js +151 -46
- package/dist/browser/PlaywrightScenarioStorage.js +15 -7
- package/dist/browser/StructuredFieldToken.js +53 -0
- package/dist/browser/WebArtifactCleanup.js +53 -0
- package/dist/browser/WebSourceMapFetcher.js +181 -89
- package/dist/browser/assets/LocalWebScriptArtifacts.js +24 -3
- package/dist/browser/assets/PublishWebScripts.js +13 -2
- package/dist/browser/assets/ScenarioScriptCapture.js +2 -1
- package/dist/browser/assets/WebArtifactReads.js +15 -3
- package/dist/browser/assets/WebSourceLocationArtifacts.js +47 -3
- package/dist/browser/execution/CdpRuntimeSession.js +36 -7
- package/dist/browser/execution/CdpWebRuntimeProvider.js +22 -4
- package/dist/browser/history/CaptureFailures.js +29 -10
- package/dist/browser/history/CaptureFormatError.js +2 -2
- package/dist/browser/history/{HarJson.js → CaptureJson.js} +14 -4
- package/dist/browser/history/CaptureRedaction.js +16 -3
- package/dist/browser/history/CaptureRelease.js +20 -2
- package/dist/browser/history/HarCapture.js +54 -30
- package/dist/browser/history/HarSchema.js +36 -36
- package/dist/browser/history/HistoricalCaptureDecoder.js +93 -25
- package/dist/browser/history/NodeCaptureAdapter.js +48 -0
- package/dist/browser/history/{HarCaptureProcess.js → NodeCaptureProcess.js} +18 -9
- package/dist/browser/history/QlogCapture.js +385 -0
- package/dist/browser/history/SazCapture.js +130 -0
- package/dist/browser/history/SazHttp.js +61 -0
- package/dist/browser/history/SazMetadata.js +55 -0
- package/dist/browser/history/SazProjection.js +90 -0
- package/dist/browser/modules/NativeModuleResolver.js +248 -131
- package/dist/browser/modules/WebModuleArtifacts.js +49 -3
- package/dist/browser/network/PlaywrightNetworkContent.js +67 -9
- package/dist/browser/network/PlaywrightScenarioNetwork.js +249 -26
- package/dist/captures/TsharkCaptureProvider.js +377 -0
- package/dist/captures/parseFieldDiscovery.js +66 -0
- package/dist/captures/parsePacketOutput.js +21 -0
- package/dist/catalogIdentity.js +58 -42
- package/dist/cli/adbCommands.js +20 -21
- package/dist/cli/analysisViewCommands.js +1 -1
- package/dist/cli/androidCommands.js +13 -16
- package/dist/cli/apktoolCommands.js +14 -25
- package/dist/cli/applicationCommands.js +44 -17
- package/dist/cli/artifactCommands.js +1 -1
- package/dist/cli/binaryDiagnosticsCommands.js +17 -13
- package/dist/cli/browserAdvancedCommands.js +46 -26
- package/dist/cli/browserCommands.js +59 -33
- package/dist/cli/captureCommands.js +72 -0
- package/dist/cli/cliResultOutput.js +274 -0
- package/dist/cli/coreBinaryCommands.js +77 -30
- package/dist/cli/coreNativeCommands.js +53 -31
- package/dist/cli/cutterCommands.js +88 -0
- package/dist/cli/electronCommands.js +76 -13
- package/dist/cli/evmCommands.js +9 -19
- package/dist/cli/finishAnalysisCommand.js +52 -0
- package/dist/cli/firmwareCommands.js +20 -50
- package/dist/cli/flutterCommands.js +53 -0
- package/dist/cli/fridaCommands.js +219 -0
- package/dist/cli/goCommands.js +20 -0
- package/dist/cli/interactiveSetup.js +11 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/javascriptRecoveryCommands.js +18 -23
- package/dist/cli/jebCommands.js +2 -14
- package/dist/cli/jsonOutput.js +2 -2
- package/dist/cli/managedCommands.js +31 -3
- package/dist/cli/options.js +26 -2
- package/dist/cli/pcapCommands.js +29 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/reverseEngineeringCommands.js +268 -0
- package/dist/cli/rustCommands.js +20 -0
- package/dist/cli/setupCommands.js +41 -12
- package/dist/cli/signalCommands.js +72 -0
- package/dist/cli/sqliteCommands.js +52 -0
- package/dist/cli/utilityCommands.js +116 -74
- package/dist/cli/wasmCommands.js +50 -0
- package/dist/cli/webModuleCommands.js +27 -38
- package/dist/cli/webNetworkCaptureCommands.js +10 -9
- package/dist/cli/webRuntimeCommands.js +15 -6
- package/dist/cli/webSourceLocationCommands.js +14 -33
- package/dist/cli-runtime/AnalysisCleanupLease-CWfTGYKd.js +103 -0
- package/dist/cli-runtime/AnalysisProvider-BGrYaMVo.js +38 -0
- package/dist/cli-runtime/AnalysisSnapshotCache-BjRlXeUS.js +711 -0
- package/dist/cli-runtime/ArtifactFileOperation-Dg4BcoEM.js +122 -0
- package/dist/cli-runtime/ArtifactReader-DMwm42bk.js +78 -0
- package/dist/cli-runtime/ArtifactResourceScope-CokZGcII.js +175 -0
- package/dist/cli-runtime/AsarHeader-BxwU17DJ.js +31 -0
- package/dist/cli-runtime/BinarySessionStatus-DRhjr7Vb.js +212 -0
- package/dist/cli-runtime/BinaryTargetResolver-tuCTjBlQ.js +1238 -0
- package/dist/cli-runtime/BoundedFileBytes-DRtiQNAQ.js +43 -0
- package/dist/cli-runtime/CdpTargetSession-CQ08KHbh.js +925 -0
- package/dist/cli-runtime/ClientConfigPath-Dn-V_GUf.js +255 -0
- package/dist/cli-runtime/ClientConfigurationDocument-C9T8MNGc.js +2021 -0
- package/dist/cli-runtime/ClientRegistrationStatus-PnD29RTX.js +585 -0
- package/dist/cli-runtime/CurrentEntrypointPath-m7QCIVN0.js +14 -0
- package/dist/cli-runtime/DirectAnalysis-C5NyUryV.js +581 -0
- package/dist/cli-runtime/DirectoryArtifactReader-CokAJ8vo.js +448 -0
- package/dist/cli-runtime/Doctor-DrkWsav4.js +668 -0
- package/dist/cli-runtime/ElectronFileScope-AP7VoVr7.js +1109 -0
- package/dist/cli-runtime/ElectronFuseFailures-DsjXR7Xp.js +609 -0
- package/dist/cli-runtime/ExecFileOutput-D6KLYTve.js +119 -0
- package/dist/cli-runtime/InterfaceBuilderDecodeBudget-CW1IO3dG.js +298 -0
- package/dist/cli-runtime/InventoryProjectionEvidence-DTH5QAqL.js +49 -0
- package/dist/cli-runtime/InvestigationProviders-CFh4a64d.js +118 -0
- package/dist/cli-runtime/JavaScriptApplicationEvidenceGraph-gOmPB2L6.js +160 -0
- package/dist/cli-runtime/JavaScriptApplicationWorkflowEvidence-WZgtK_Ok.js +75 -0
- package/dist/cli-runtime/JavaScriptWorkerMemoryLimit-B1bwMM1a.js +86 -0
- package/dist/cli-runtime/JebMcpEndpoint-BEalGZh9.js +710 -0
- package/dist/cli-runtime/JsonFiles-uvd6ZyQi.js +600 -0
- package/dist/cli-runtime/KunaInstallation-P0j3x851.js +1781 -0
- package/dist/cli-runtime/MacCodeSignature-MgYbRK_H.js +24 -0
- package/dist/cli-runtime/MacHopperPaths-bGzqjF1Z.js +34 -0
- package/dist/cli-runtime/MachoLoadCommandReader-CZm6N5vF.js +330 -0
- package/dist/cli-runtime/ManagedSnapshot-CPE9C3OD.js +4481 -0
- package/dist/cli-runtime/OwnedCommandCleanup-BN_V6Erc.js +187 -0
- package/dist/cli-runtime/OwnedRegularFile-D1f5nUCx.js +256 -0
- package/dist/cli-runtime/OwnedStagedOutput-D31dOozz.js +126 -0
- package/dist/cli-runtime/PrivateRuntimeRoot-Cd23u6jd.js +296 -0
- package/dist/cli-runtime/ProcessOwnership-CtrNr6ee.js +545 -0
- package/dist/cli-runtime/ProcessOwnershipObservation-C006iCtZ.js +920 -0
- package/dist/cli-runtime/ProviderDeadline-rSuH4Pm8.js +148 -0
- package/dist/cli-runtime/ProviderOperationExecution-CmU-XrQr.js +38 -0
- package/dist/cli-runtime/ProviderProcess-D87A7ctp.js +770 -0
- package/dist/cli-runtime/RegularFileRead-mbgGYtxe.js +125 -0
- package/dist/cli-runtime/SafeOutputTree-i904hd_2.js +525 -0
- package/dist/cli-runtime/SetupHost-CMPmPraB.js +1268 -0
- package/dist/cli-runtime/SharedStartupAttempt-BxKyf3Uv.js +1424 -0
- package/dist/cli-runtime/StableFileHash-Ame_h3lY.js +61 -0
- package/dist/cli-runtime/SupportedClients-DMafjitv.js +1066 -0
- package/dist/cli-runtime/UninstallFailure-1blyKXHE.js +22 -0
- package/dist/cli-runtime/Update-DAsASWlE.js +143 -0
- package/dist/cli-runtime/UpdateFailure-BcFNxEZZ.js +24 -0
- package/dist/cli-runtime/WindowsBatchCommand-Cx9kaVNf.js +97 -0
- package/dist/cli-runtime/WindowsNativeLoader-BqyZO0ZD.js +142 -0
- package/dist/cli-runtime/ZipArtifactReader-Jed69LEL.js +252 -0
- package/dist/cli-runtime/analysisErrorCleanup-COdAmDsb.js +33 -0
- package/dist/cli-runtime/appleArchiveFormat-Bb3G5CCI.js +269 -0
- package/dist/cli-runtime/application__DirectAnalysisStatus-F74bu9oy.js +150 -0
- package/dist/cli-runtime/application__EnhancedTools-Bg51b0Yp.js +1820 -0
- package/dist/cli-runtime/application__FunctionAnalysisEvidence-DBWIaYCh.js +41 -0
- package/dist/cli-runtime/application__ReconstructionCoverageService-AEPNpZqJ.js +32 -0
- package/dist/cli-runtime/application__ReconstructionObligationLedgerService-Cl9cPEZf.js +828 -0
- package/dist/cli-runtime/application__Setup-DwQzEewK.js +526 -0
- package/dist/cli-runtime/application__Uninstall-BOf9oyvQ.js +468 -0
- package/dist/cli-runtime/application__UpdateRuntime-CzWkRJHa.js +435 -0
- package/dist/cli-runtime/application__android__AndroidApplicationService-shW_aKlj.js +31 -0
- package/dist/cli-runtime/application__apple__AppleApplicationService-DIv6d3wB.js +31 -0
- package/dist/cli-runtime/application__harmony__HarmonyApplicationService-OIUFVQFV.js +31 -0
- package/dist/cli-runtime/application__javascript__ElectronActiveObservationService-wvCh72hK.js +118 -0
- package/dist/cli-runtime/application__javascript__ElectronObservationService-SydXPCwM.js +88 -0
- package/dist/cli-runtime/application__javascript__JavaScriptApplicationService-o0uEsjEc.js +12254 -0
- package/dist/cli-runtime/application__javascript__JavaScriptApplicationWorkflowService-BAheG_71.js +2336 -0
- package/dist/cli-runtime/application__javascript__JavaScriptRuntimeReconciliationService-Cnn4GP8q.js +88 -0
- package/dist/cli-runtime/application__javascript__JavaScriptSemanticTraceService-CmvLfV1A.js +299 -0
- package/dist/cli-runtime/artifacts__ArtifactProvider-wx2K0F2I.js +2205 -0
- package/dist/cli-runtime/binary-CWVNJhAC.js +19608 -0
- package/dist/cli-runtime/catalogIdentity-DAEEsOdX.js +1112 -0
- package/dist/cli-runtime/cli.js +44469 -0
- package/dist/cli-runtime/cliOutput-CgSuw782.js +163 -0
- package/dist/cli-runtime/cliOutput.js +5 -0
- package/dist/cli-runtime/cliResultOutput-10sd6xGx.js +1453 -0
- package/dist/cli-runtime/cliResultOutput.js +6 -0
- package/dist/cli-runtime/composition__browserScenario-BtPb1c1y.js +3414 -0
- package/dist/cli-runtime/composition__electronObservation-Bk8R6DJo.js +614 -0
- package/dist/cli-runtime/composition__electronScenario-BVF0qStH.js +916 -0
- package/dist/cli-runtime/cutterToolContracts-BQtG_Nzo.js +5267 -0
- package/dist/cli-runtime/doctorRuntime-B__SIpm-.js +478 -0
- package/dist/cli-runtime/dotnet__ManagedStaticProvider-DO5Yzcp4.js +5 -0
- package/dist/cli-runtime/errorSchemas-Ixz_q7qt.js +655 -0
- package/dist/cli-runtime/homeDirectory-DC_DeJIg.js +18 -0
- package/dist/cli-runtime/javascriptApplicationAnalysis-Dk6yBV8g.js +2088 -0
- package/dist/cli-runtime/javascriptExportReturnShapeProjection-CObOIiQ6.js +78 -0
- package/dist/cli-runtime/javascriptExportShapeComparisonSchemas-DpwuBenh.js +1244 -0
- package/dist/cli-runtime/javascriptRuntimeReconciliation-C6ZgWMys.js +1509 -0
- package/dist/cli-runtime/javascriptRuntimeReconciliationSchemas-D6tZKUQs.js +247 -0
- package/dist/cli-runtime/javascriptSemanticTraceSchemas-C7m0b6_w.js +126 -0
- package/dist/cli-runtime/lipo-DPQ6qurH.js +394 -0
- package/dist/cli-runtime/logger-BuDJ9xxO.js +48 -0
- package/dist/cli-runtime/machoContainer-Cy98bkFm.js +352 -0
- package/dist/cli-runtime/managedApplicationGraph-BazVqpJv.js +1136 -0
- package/dist/cli-runtime/managedToolContracts-BuFkMBH5.js +99 -0
- package/dist/cli-runtime/mcpDoctor.js +361 -0
- package/dist/cli-runtime/mcpStartupPolicy-imCbM3qo.js +28 -0
- package/dist/cli-runtime/native__NativeMacOSProvider-DTcRhuGA.js +5502 -0
- package/dist/cli-runtime/officialToolContracts-CzzVLx8I.js +1522 -0
- package/dist/cli-runtime/peMachine-B9ggfSJJ.js +95 -0
- package/dist/cli-runtime/propertyListKeys-D5dSASEy.js +355 -0
- package/dist/cli-runtime/providerCleanupError-BhsJyAhk.js +25 -0
- package/dist/cli-runtime/providerIdentities-Ao1XTvwx.js +31 -0
- package/dist/cli-runtime/providerStartupTimeout-B2tF2LtZ.js +17 -0
- package/dist/cli-runtime/readArtifactFileChunks-BbTL_PtB.js +129 -0
- package/dist/cli-runtime/reconstructionObligationLedgerSchemas-Bi6sect1.js +22156 -0
- package/dist/cli-runtime/rolldown-runtime-DXoylpqc.js +121 -0
- package/dist/cli-runtime/runtimeVersion-CMGd0bDu.js +23 -0
- package/dist/cli-runtime/safeJson-DKKACtdy.js +25 -0
- package/dist/cli-runtime/scanCanonical-CcDFUr-w.js +2594 -0
- package/dist/cli-runtime/snapshotEnvironment-Yvx5qwsl.js +196 -0
- package/dist/cli-runtime/toolContracts-CJzEyZ38.js +3795 -0
- package/dist/cli-runtime/toolOutputSchemaGroups-BqdSzySu.js +12249 -0
- package/dist/cli-runtime/workflowInputError-BP8z9Wxl.js +26 -0
- package/dist/cli.js +48 -5
- package/dist/cliBrowserScenarioCommands.js +41 -7
- package/dist/cliCommandNames.js +48 -0
- package/dist/cliEvidenceCommands.js +0 -1
- package/dist/cliJavaScriptRuntimeCommands.js +16 -14
- package/dist/cliJsonInput.js +12 -4
- package/dist/cliLogging.js +66 -15
- package/dist/cliObservationOptions.js +9 -0
- package/dist/cliOutput.js +105 -7
- package/dist/composition/binary.js +19 -2
- package/dist/composition/captures.js +3 -0
- package/dist/composition/directAnalysis.js +36 -11
- package/dist/composition/electronFuses.js +4 -0
- package/dist/composition/evm.js +12 -0
- package/dist/composition/flutter.js +3 -0
- package/dist/composition/go.js +4 -0
- package/dist/composition/javascriptAnalysisWorkerProcess.js +8 -8
- package/dist/composition/jeb.js +45 -5
- package/dist/composition/pcap.js +3 -0
- package/dist/composition/resolveWindowsProviderExecutable.js +61 -0
- package/dist/composition/reverseEngineering.js +29 -0
- package/dist/composition/rust.js +4 -0
- package/dist/composition/signals.js +3 -0
- package/dist/composition/sqlite.js +4 -0
- package/dist/composition/wasm.js +22 -0
- package/dist/composition/webNetworkCaptures.js +7 -2
- package/dist/config/environment.js +79 -4
- package/dist/config/ghidraDisabledAnalyzers.js +25 -0
- package/dist/config/homeDirectory.js +9 -6
- package/dist/config/mcpInputSchemaProfile.js +5 -1
- package/dist/config/mcpOutputSchemaProfile.js +22 -0
- package/dist/config/parseConfig.js +28 -34
- package/dist/config/parsers.js +4 -3
- package/dist/config/{ghidraStartupTimeout.js → providerStartupTimeout.js} +7 -3
- package/dist/contracts/adb/adbToolContracts.js +8 -8
- package/dist/contracts/analysisDetail.js +6 -3
- package/dist/contracts/analysisViewApiSurfaceExample.js +68 -0
- package/dist/contracts/analysisViewToolContracts.js +65 -3
- package/dist/contracts/android/androidToolContracts.js +17 -8
- package/dist/contracts/apktool/apktoolToolContracts.js +5 -1
- package/dist/contracts/applicationToolContracts.js +17 -2
- package/dist/contracts/artifactComparisonExample.js +18 -14
- package/dist/contracts/artifactToolContracts.js +16 -3
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +13 -1
- package/dist/contracts/captures/captureToolContracts.js +42 -0
- package/dist/contracts/compactInputSchema.js +39 -12
- package/dist/contracts/cutterToolContracts.js +84 -0
- package/dist/contracts/enhancedToolContracts.js +2 -2
- package/dist/contracts/evm/evmToolContracts.js +30 -15
- package/dist/contracts/firmware/firmwareToolContracts.js +1 -1
- package/dist/contracts/flutter/flutterToolContracts.js +47 -0
- package/dist/contracts/fridaRemoteAddress.js +23 -0
- package/dist/contracts/fridaToolContracts.js +274 -0
- package/dist/contracts/functionComparisonExample.js +12 -1
- package/dist/contracts/gdbToolContracts.js +102 -0
- package/dist/contracts/go/goToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +15 -0
- package/dist/contracts/inputSchemaPresentation.js +199 -38
- package/dist/contracts/investigationExamples.js +1 -0
- package/dist/contracts/javascript/electronToolContracts.js +27 -2
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +1 -0
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +13 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +1 -0
- package/dist/contracts/jsonSchemaKeywords.js +29 -0
- package/dist/contracts/managed/managedToolContracts.js +43 -4
- package/dist/contracts/managed/managedWorkflowExamples.js +10 -1
- package/dist/contracts/managed/managedWorkflowToolContracts.js +4 -30
- package/dist/contracts/mobileApplicationGraphExamples.js +27 -12
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +3 -2
- package/dist/contracts/native/nativeToolContracts.js +10 -6
- package/dist/contracts/officialToolContracts.js +7 -7
- package/dist/contracts/pcap/pcapToolContracts.js +33 -0
- package/dist/contracts/providerSelection.js +1 -0
- package/dist/contracts/reconstructionReadinessExample.js +126 -119
- package/dist/contracts/reverseEngineeringToolContracts.js +52 -0
- package/dist/contracts/rizinDebugToolContracts.js +97 -0
- package/dist/contracts/rust/rustToolContracts.js +20 -0
- package/dist/contracts/sessionLifecycleInputs.js +34 -2
- package/dist/contracts/sessionToolContracts.js +4 -4
- package/dist/contracts/sessionToolSchemas.js +14 -0
- package/dist/contracts/signals/signalToolContracts.js +40 -0
- package/dist/contracts/sqlite/sqliteToolContracts.js +36 -0
- package/dist/contracts/toolContractExamples.js +29 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +26 -0
- package/dist/contracts/toolEffects.js +252 -9
- package/dist/contracts/toolOutputSchemaGroups.js +78 -32
- package/dist/contracts/toolOutputSchemaPrimitives.js +118 -10
- package/dist/contracts/toolSchemaMetadata.js +102 -16
- package/dist/contracts/unknownContractExamples.js +1 -1
- package/dist/contracts/wasm/wasmComparisonContracts.js +52 -0
- package/dist/contracts/wasm/wasmToolContracts.js +33 -0
- package/dist/contracts/webNetworkCaptureToolContracts.js +15 -4
- package/dist/cutter/CutterBridgeClient.js +760 -0
- package/dist/cutter/CutterBridgeService.js +187 -0
- package/dist/doctorRuntime.js +41 -8
- package/dist/domain/adb/adbDeviceAnalysis.js +45 -5
- package/dist/domain/analysisErrorBase.js +79 -2
- package/dist/domain/analysisErrorCleanup.js +4 -2
- package/dist/domain/analysisErrorCore.js +32 -0
- package/dist/domain/analysisErrorPresentation.js +80 -20
- package/dist/domain/analysisErrorProjection.js +72 -37
- package/dist/domain/analysisProfile.js +7 -3
- package/dist/domain/analysisSearch.js +26 -0
- package/dist/domain/analysisSnapshot.js +312 -185
- package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +353 -0
- package/dist/domain/analysisView/analysisView.js +391 -44
- package/dist/domain/analysisView/analysisViewCoverage.js +32 -0
- package/dist/domain/analysisView/analysisViewDataAdmission.js +86 -0
- package/dist/domain/analysisView/analysisViewErrors.js +4 -0
- package/dist/domain/analysisView/analysisViewParent.js +12 -0
- package/dist/domain/analysisView/analysisViewText.js +29 -0
- package/dist/domain/analysisView/androidPackageView.js +102 -0
- package/dist/domain/analysisView/artifactInventoryView.js +126 -0
- package/dist/domain/analysisView/binaryLayoutView.js +11 -4
- package/dist/domain/analysisView/dartAotView.js +93 -0
- package/dist/domain/analysisView/evmInterfaceView.js +105 -0
- package/dist/domain/analysisView/interfaceBuilderView.js +182 -0
- package/dist/domain/analysisView/javascriptApplicationCoverage.js +27 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +123 -49
- package/dist/domain/analysisView/javascriptFactsView.js +92 -0
- package/dist/domain/analysisView/javascriptModuleReferences.js +37 -0
- package/dist/domain/analysisView/machoView.js +186 -0
- package/dist/domain/analysisView/managedArtifactView.js +108 -0
- package/dist/domain/analysisView/managedMemberView.js +215 -0
- package/dist/domain/analysisView/nativeFunctionView.js +20 -25
- package/dist/domain/analysisView/pcapCaptureView.js +264 -0
- package/dist/domain/analysisView/qlogCaptureView.js +198 -0
- package/dist/domain/analysisView/wasmArtifactView.js +162 -0
- package/dist/domain/analysisView/webNetworkApiSurfaceView.js +123 -0
- package/dist/domain/analysisView/webNetworkCaptureView.js +388 -0
- package/dist/domain/android/androidAnalysis.js +36 -2
- package/dist/domain/android/androidApplication.js +37 -64
- package/dist/domain/apktool/apktoolResourceAnalysis.js +70 -8
- package/dist/domain/apple/appleApplication.js +70 -87
- package/dist/domain/apple/appleArchiveFormat.js +184 -0
- package/dist/domain/apple/appleAssetCatalog.js +15 -0
- package/dist/domain/apple/appleBundleAnatomy.js +57 -69
- package/dist/domain/apple/dyldPaths.js +9 -2
- package/dist/domain/apple/dylibResolution.js +24 -10
- package/dist/domain/apple/dylibResolutionFindings.js +8 -9
- package/dist/domain/apple/interfaceBuilderGraph.js +78 -33
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +39 -12
- package/dist/domain/apple/jvmClassFile.js +226 -0
- package/dist/domain/apple/keyedArchive.js +39 -17
- package/dist/domain/apple/machoContainer.js +123 -8
- package/dist/domain/apple/machoCpuIdentity.js +4 -0
- package/dist/domain/apple/plistNumbers.js +67 -5
- package/dist/domain/apple/plistValue.js +95 -19
- package/dist/domain/artifactComparison.js +116 -37
- package/dist/domain/artifactDecompressionBudget.js +26 -0
- package/dist/domain/artifactGraph.js +18 -9
- package/dist/domain/artifactIdentity.js +4 -1
- package/dist/domain/artifactInspection.js +34 -3
- package/dist/domain/artifactInventoryEvidence.js +146 -40
- package/dist/domain/binaryTarget.js +251 -109
- package/dist/domain/binaryTargetTypes.js +24 -1
- package/dist/domain/browserNetworkEvidence.js +24 -3
- package/dist/domain/browserObservation.js +92 -56
- package/dist/domain/browserObservationError.js +4 -4
- package/dist/domain/browserObservationSchemas.js +4 -1
- package/dist/domain/browserScenarioCapture.js +11 -1
- package/dist/domain/browserScenarioCaptureLimits.js +34 -0
- package/dist/domain/browserScenarioCaptureValues.js +76 -2
- package/dist/domain/browserScenarioDiff.js +120 -11
- package/dist/domain/browserScenarioDiffEvidence.js +44 -13
- package/dist/domain/browserScenarioDiffValues.js +10 -3
- package/dist/domain/browserScenarioNetworkComparison.js +158 -0
- package/dist/domain/browserScenarioNormalization.js +10 -13
- package/dist/domain/browserScenarioValues.js +7 -13
- package/dist/domain/browserSession.js +2 -2
- package/dist/domain/bundleComparison.js +1 -5
- package/dist/domain/callPath.js +40 -3
- package/dist/domain/captures/packetCapture.js +139 -0
- package/dist/domain/captures/packetFields.js +81 -0
- package/dist/domain/changedBehavior.js +43 -41
- package/dist/domain/comparisonSourceEvidence.js +6 -0
- package/dist/domain/dosCom.js +2 -2
- package/dist/domain/dosMz.js +66 -19
- package/dist/domain/electron/electronFuseEvidence.js +42 -0
- package/dist/domain/electron/electronFuses.js +360 -0
- package/dist/domain/elfFixedHeader.js +66 -0
- package/dist/domain/evidence.js +105 -39
- package/dist/domain/evidenceBundle.js +67 -22
- package/dist/domain/evidenceErrors.js +5 -0
- package/dist/domain/evm/evmInterface.js +18 -4
- package/dist/domain/evm/solidityMetadata.js +70 -0
- package/dist/domain/explicitSensitiveFailure.js +44 -23
- package/dist/domain/fileSnapshotObservation.js +25 -0
- package/dist/domain/firmware/firmwareAnalysis.js +29 -0
- package/dist/domain/fixedTupleSchema.js +9 -0
- package/dist/domain/flutter/flutterBuildAnalysis.js +141 -0
- package/dist/domain/functionCallCoverage.js +60 -0
- package/dist/domain/functionComparisonDimensions.js +136 -18
- package/dist/domain/functionComparisonNormalization.js +83 -19
- package/dist/domain/functionComparisonResults.js +7 -6
- package/dist/domain/functionComparisonSchemas.js +14 -3
- package/dist/domain/functionDossierEvidence.js +4 -0
- package/dist/domain/go/goBinary.js +96 -0
- package/dist/domain/harmony/harmonyApplication.js +156 -0
- package/dist/domain/hopperErrors.js +19 -18
- package/dist/domain/hopperPublisher.js +12 -0
- package/dist/domain/hopperValues.js +135 -34
- package/dist/domain/javascript/electronActiveObservation.js +1 -0
- package/dist/domain/javascript/electronObservation.js +4 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +94 -33
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +3 -1
- package/dist/domain/javascript/electronStaticAnalysisNative.js +19 -5
- package/dist/domain/javascript/electronStaticAnalysisValues.js +14 -28
- package/dist/domain/javascript/electronStaticOptionObjects.js +45 -0
- package/dist/domain/javascript/electronWrappedCallPaths.js +551 -0
- package/dist/domain/javascript/htmlArtifactReferences.js +94 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +37 -1
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +7 -0
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +10 -2
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +1 -1
- package/dist/domain/javascript/javascriptApplicationGraph.js +17 -1
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +8 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +3 -1
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +49 -21
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +31 -18
- package/dist/domain/javascript/javascriptArtifactFiles.js +2 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +89 -24
- package/dist/domain/javascript/javascriptAstValues.js +132 -5
- package/dist/domain/javascript/javascriptBootstrap.js +94 -0
- package/dist/domain/javascript/javascriptBootstrapIntegrity.js +372 -0
- package/dist/domain/javascript/javascriptBuiltinResourceMethods.js +8 -0
- package/dist/domain/javascript/javascriptBundledRequireOrigin.js +278 -0
- package/dist/domain/javascript/javascriptCommonJsExportReceivers.js +231 -0
- package/dist/domain/javascript/javascriptContextBridgeExposure.js +23 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +96 -22
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +6 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +1 -1
- package/dist/domain/javascript/javascriptFeatureSeed.js +34 -17
- package/dist/domain/javascript/javascriptFeatureTrace.js +9 -3
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +42 -11
- package/dist/domain/javascript/javascriptGraphqlOperations.js +382 -0
- package/dist/domain/javascript/javascriptIntrinsicInvocation.js +132 -0
- package/dist/domain/javascript/javascriptModuleDeclaration.js +48 -0
- package/dist/domain/javascript/javascriptModuleInterop.js +618 -0
- package/dist/domain/javascript/javascriptModuleResolutionMode.js +18 -0
- package/dist/domain/javascript/javascriptModuleSpecifier.js +5 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +7 -12
- package/dist/domain/javascript/javascriptPackageImportAliases.js +58 -0
- package/dist/domain/javascript/javascriptRecovery.js +12 -5
- package/dist/domain/javascript/javascriptRpcEndpoints.js +7 -93
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +16 -0
- package/dist/domain/javascript/javascriptRuntimeObservation.js +4 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +45 -16
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +65 -47
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +5 -4
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +113 -11
- package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +511 -0
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +706 -204
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +54 -54
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +59 -30
- package/dist/domain/javascript/javascriptSemanticCallableStack.js +52 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +10 -15
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +163 -92
- package/dist/domain/javascript/javascriptSemanticCoverage.js +5 -1
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +435 -45
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +46 -29
- package/dist/domain/javascript/javascriptSemanticDependencies.js +69 -0
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +1 -1
- package/dist/domain/javascript/javascriptSemanticEvaluationOrder.js +126 -0
- package/dist/domain/javascript/javascriptSemanticExpressionShapes.js +111 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +11 -14
- package/dist/domain/javascript/javascriptSemanticGetterQueries.js +147 -0
- package/dist/domain/javascript/javascriptSemanticGetterResults.js +264 -0
- package/dist/domain/javascript/javascriptSemanticGraph.js +22 -1
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +13 -1
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +5 -4
- package/dist/domain/javascript/javascriptSemanticMapOperations.js +51 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +421 -154
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +500 -27
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +377 -174
- package/dist/domain/javascript/javascriptSemanticObjects.js +53 -43
- package/dist/domain/javascript/javascriptSemanticOpaqueEffects.js +163 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +11 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +180 -95
- package/dist/domain/javascript/javascriptSemanticPromises.js +6 -9
- package/dist/domain/javascript/javascriptSemanticProvenance.js +5 -1
- package/dist/domain/javascript/javascriptSemanticQuery.js +7 -2
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +2 -1
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +1 -1
- package/dist/domain/javascript/javascriptSemanticReferenceSources.js +25 -0
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +369 -8
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +3 -19
- package/dist/domain/javascript/javascriptSemanticResources.js +33 -44
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +81 -26
- package/dist/domain/javascript/javascriptSemanticReturns.js +37 -30
- package/dist/domain/javascript/javascriptSemanticState.js +225 -39
- package/dist/domain/javascript/javascriptSemanticTraversal.js +6 -4
- package/dist/domain/javascript/javascriptSemanticValues.js +379 -56
- package/dist/domain/javascript/javascriptSourceMapPaths.js +44 -17
- package/dist/domain/javascript/javascriptSourceParser.js +121 -7
- package/dist/domain/javascript/javascriptSourceSelection.js +11 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +69 -24
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +97 -23
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +488 -48
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +196 -78
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +4 -0
- package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +2 -1
- package/dist/domain/javascript/javascriptSymbolicBindings.js +1118 -0
- package/dist/domain/javascript/javascriptSymbolicControlFlow.js +44 -0
- package/dist/domain/javascript/javascriptSymbolicValues.js +45 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +3 -1
- package/dist/domain/javascript/sourceToBundleComparisonSchemas.js +2 -0
- package/dist/domain/javascript/sourceToBundleSignals.js +50 -13
- package/dist/domain/jsonValue.js +37 -12
- package/dist/domain/localPath.js +6 -3
- package/dist/domain/managed/managedApplicationGraph.js +5 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +6 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +14 -10
- package/dist/domain/managed/managedArtifact.js +77 -1
- package/dist/domain/managed/managedInspectionEvidence.js +5 -6
- package/dist/domain/managed/managedMemberComparison.js +6 -0
- package/dist/domain/managed/managedMemberComparisonCoverage.js +36 -3
- package/dist/domain/managed/managedMemberComparisonItems.js +135 -59
- package/dist/domain/managed/managedMemberComparisonMatch.js +237 -42
- package/dist/domain/managed/managedMemberSignatureIdentity.js +40 -0
- package/dist/domain/managed/managedNativeVerificationMatch.js +54 -31
- package/dist/domain/managed/managedNativeVerificationSchemas.js +15 -4
- package/dist/domain/managed/managedReconstruction.js +5 -8
- package/dist/domain/mobileApplicationGraphProjection.js +95 -0
- package/dist/domain/native/addressCoordinate.js +11 -0
- package/dist/domain/native/binaryLayout.js +2 -4
- package/dist/domain/native/bytePattern.js +121 -0
- package/dist/domain/native/nativeAotPe.js +31 -4
- package/dist/domain/native/nativeAotSnapshotObservation.js +18 -0
- package/dist/domain/native/nativeCallPartialObservation.js +14 -12
- package/dist/domain/native/nativeInspection.js +38 -4
- package/dist/domain/native/nativeInstruction.js +17 -2
- package/dist/domain/native/nativeInvestigationGraph.js +9 -5
- package/dist/domain/native/nativeLoadImage.js +32 -1
- package/dist/domain/native/nativeUiObservation.js +5 -6
- package/dist/domain/native/objcSwiftMetadata.js +19 -9
- package/dist/domain/native/peResources.js +14 -4
- package/dist/domain/native/recordedCrash.js +79 -10
- package/dist/domain/offsetDateTime.js +60 -0
- package/dist/domain/pcap/pcapAnalysis.js +91 -0
- package/dist/domain/pcap/pcapEvidence.js +15 -0
- package/dist/domain/peMachine.js +38 -0
- package/dist/domain/pngHeader.js +18 -0
- package/dist/domain/process/processCaptureCoverage.js +26 -3
- package/dist/domain/process/processCaptureExample.js +2 -0
- package/dist/domain/process/processCaptureValidation.js +33 -8
- package/dist/domain/process/processComparison.js +41 -13
- package/dist/domain/process/processScenario.js +7 -0
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +119 -74
- package/dist/domain/process/processTraceSpecification.js +243 -89
- package/dist/domain/propertyListKeys.js +238 -23
- package/dist/domain/propertyListXml.js +149 -0
- package/dist/domain/propertyListXmlText.js +20 -4
- package/dist/domain/providerAdapterError.js +2 -5
- package/dist/domain/providerCleanupError.js +2 -4
- package/dist/domain/providerConfigurationRefusal.js +12 -0
- package/dist/domain/providerSelectionError.js +2 -1
- package/dist/domain/qlogCapture.js +62 -0
- package/dist/domain/rawBinary.js +105 -0
- package/dist/domain/reconstructionCoverage.js +40 -24
- package/dist/domain/reconstructionCoverageEvaluation.js +50 -47
- package/dist/domain/reconstructionCoverageEvidence.js +26 -0
- package/dist/domain/reconstructionCoverageVerifierResults.js +35 -0
- package/dist/domain/reconstructionObligationLedgerIntegrity.js +114 -0
- package/dist/domain/reconstructionObligationLedgerSchemas.js +104 -1
- package/dist/domain/reconstructionReadiness.js +4 -8
- package/dist/domain/reconstructionReadinessJourneyFindings.js +4 -1
- package/dist/domain/reconstructionUnknowns.js +9 -1
- package/dist/domain/reconstructionVerification.js +86 -43
- package/dist/domain/recordedTransportUrl.js +59 -0
- package/dist/domain/referenceSourceClassification.js +27 -23
- package/dist/domain/referenceSourceGraph.js +51 -13
- package/dist/domain/referenceSourceImportParsing.js +27 -13
- package/dist/domain/referenceSourcePathIdentity.js +13 -1
- package/dist/domain/referenceSourceRequireBindings.js +40 -108
- package/dist/domain/referenceSourceSummary.js +92 -0
- package/dist/domain/relationshipCoverage.js +43 -0
- package/dist/domain/residualUnknown.js +93 -26
- package/dist/domain/reverseEngineering.js +31 -0
- package/dist/domain/runtimeVersion.js +8 -0
- package/dist/domain/rust/rustBinary.js +200 -0
- package/dist/domain/signals/annotationTextWindow.js +31 -0
- package/dist/domain/signals/signalDecoders.js +69 -0
- package/dist/domain/signals/signalRecording.js +115 -0
- package/dist/domain/sourceMapContents.js +10 -3
- package/dist/domain/sourceMapEnvelope.js +17 -11
- package/dist/domain/sqlite/sqliteDatabase.js +189 -0
- package/dist/domain/staticRuntimeCorrelation.js +7 -9
- package/dist/domain/swiftSymbolClassification.js +17 -0
- package/dist/domain/symbolAnalysis.js +20 -7
- package/dist/domain/urlComponents.js +6 -0
- package/dist/domain/wasm/wasmArtifact.js +119 -0
- package/dist/domain/wasm/wasmInterface.js +89 -0
- package/dist/domain/webBundleAnalysis.js +14 -3
- package/dist/domain/webBundleAnalyzerAst.js +7 -2
- package/dist/domain/webBundleAnalyzerInspection.js +113 -57
- package/dist/domain/webBundleAnalyzerResult.js +18 -6
- package/dist/domain/webCaptureDiff.js +235 -51
- package/dist/domain/webCaptureFrameComparison.js +49 -0
- package/dist/domain/webInventory.js +28 -14
- package/dist/domain/webMcpDiscovery.js +5 -2
- package/dist/domain/webModuleImports.js +22 -27
- package/dist/domain/webModuleTrace.js +25 -8
- package/dist/domain/webNetworkCapture.js +101 -39
- package/dist/domain/webNetworkCaptureCoordinates.js +21 -0
- package/dist/domain/webRuntime.js +0 -1
- package/dist/domain/webScreenshot.js +2 -2
- package/dist/domain/webScriptArtifacts.js +2 -4
- package/dist/domain/webScriptExport.js +6 -8
- package/dist/domain/webScriptExportError.js +2 -3
- package/dist/domain/webScriptExportPlan.js +2 -2
- package/dist/domain/webSourceLocation.js +20 -9
- package/dist/domain/xmlDocument.js +41 -0
- package/dist/domain/zipPackageFormat.js +25 -3
- package/dist/dotnet/ManagedArtifactInspector.js +25 -12
- package/dist/dotnet/ManagedDecodeBudget.js +87 -9
- package/dist/dotnet/ManagedMemberInspector.js +127 -22
- package/dist/dotnet/ManagedMemberInspectorCore.js +408 -141
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +109 -37
- package/dist/dotnet/ManagedMemberOwnership.js +65 -0
- package/dist/dotnet/ManagedMemberPointers.js +69 -0
- package/dist/dotnet/ManagedMemberRows.js +181 -48
- package/dist/dotnet/ManagedMetadataHeaps.js +110 -25
- package/dist/dotnet/ManagedMetadataInventory.js +5 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +36 -52
- package/dist/dotnet/ManagedMetadataLayout.js +26 -16
- package/dist/dotnet/ManagedMetadataRowSizes.js +1 -1
- package/dist/dotnet/ManagedMethodBodyReader.js +29 -11
- package/dist/dotnet/ManagedMethodSpecs.js +78 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +20 -19
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +13 -21
- package/dist/dotnet/ManagedPeReader.js +60 -27
- package/dist/dotnet/ManagedReaderFailure.js +9 -0
- package/dist/dotnet/ManagedSnapshot.js +93 -0
- package/dist/dotnet/ManagedStaticProvider.js +55 -64
- package/dist/dotnet/ManagedTypeMemberLists.js +105 -0
- package/dist/dotnet/ManagedTypeNameDigests.js +177 -0
- package/dist/dotnet/ManagedTypeNames.js +58 -0
- package/dist/dotnet/ManagedTypeNesting.js +25 -0
- package/dist/dotnet/ManagedTypeReferences.js +94 -0
- package/dist/dotnet/ManagedUserStrings.js +75 -0
- package/dist/electron/ElectronFuseFailures.js +105 -0
- package/dist/electron/ElectronFusePath.js +248 -0
- package/dist/electron/ElectronFuseProvider.js +88 -0
- package/dist/electron/ElectronFuseReader.js +333 -0
- package/dist/evaluation/AgentEvaluationFixtures.js +194 -11
- package/dist/evaluation/CodexAgentEval.js +19 -40
- package/dist/evaluation/KnownAnswerEvaluation.js +126 -57
- package/dist/evm/EvmoleFailures.js +20 -14
- package/dist/evm/EvmoleInterfaceAdapter.js +5 -1
- package/dist/evm/EvmoleInterfaceProvider.js +142 -35
- package/dist/evm/EvmoleInterfaceWorker.js +2 -0
- package/dist/evm/SolidityMetadata.js +139 -0
- package/dist/filesystem/OwnedRegularFile.js +116 -0
- package/dist/filesystem/OwnedStagedOutput.js +155 -0
- package/dist/filesystem/RegularFile.js +65 -9
- package/dist/filesystem/StableFileHash.js +56 -38
- package/dist/filesystem/callerPath.js +26 -0
- package/dist/filesystem/readFileHandleChunks.js +72 -13
- package/dist/filesystem/readStableFileBytes.js +85 -0
- package/dist/firmware/FirmwareCommand.js +15 -9
- package/dist/firmware/FirmwareFailures.js +56 -0
- package/dist/firmware/FirmwareFiles.js +136 -110
- package/dist/firmware/FirmwareProvider.js +122 -65
- package/dist/firmware/FirmwarePublication.js +244 -12
- package/dist/firmware/FirmwareReports.js +202 -12
- package/dist/flutter/DartElf.js +445 -0
- package/dist/flutter/ElfBuildId.js +137 -0
- package/dist/flutter/ElfLoadMap.js +91 -0
- package/dist/flutter/FlutterBuildProvider.js +866 -0
- package/dist/flutter/FlutterPayloadScan.js +180 -0
- package/dist/frida/FridaInstrumentationManager.js +1104 -0
- package/dist/gdb/GdbSessionManager.js +1639 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +146 -14
- package/dist/ghidra/GhidraAnalysisSeeds.js +39 -55
- package/dist/ghidra/GhidraBridgeSources.js +12 -0
- package/dist/ghidra/GhidraClient.js +501 -180
- package/dist/ghidra/GhidraClientStartup.js +5 -3
- package/dist/ghidra/GhidraClientWire.js +5 -2
- package/dist/ghidra/GhidraDiagnostics.js +23 -5
- package/dist/ghidra/GhidraDoctor.js +60 -26
- package/dist/ghidra/GhidraDosSnapshot.js +83 -0
- package/dist/ghidra/GhidraExecutableHeader.js +54 -0
- package/dist/ghidra/GhidraFileArtifacts.js +93 -0
- package/dist/ghidra/GhidraFunctionValues.js +50 -2
- package/dist/ghidra/GhidraInstallation.js +305 -108
- package/dist/ghidra/GhidraInstallationPolicy.js +94 -103
- package/dist/ghidra/GhidraInstallationProperties.js +57 -0
- package/dist/ghidra/GhidraInventoryValues.js +52 -6
- package/dist/ghidra/GhidraJavaLaunch.js +99 -11
- package/dist/ghidra/GhidraJavaProbe.js +267 -0
- package/dist/ghidra/GhidraJavaProperties.js +119 -0
- package/dist/ghidra/GhidraLanguageCatalog.js +83 -8
- package/dist/ghidra/GhidraLauncher.js +325 -85
- package/dist/ghidra/GhidraLoadImageAttest.js +82 -65
- package/dist/ghidra/GhidraLoadImageValues.js +109 -27
- package/dist/ghidra/GhidraMipsProfile.js +258 -14
- package/dist/ghidra/GhidraNativeAotSnapshotOwner.js +221 -0
- package/dist/ghidra/GhidraPeProfile.js +91 -0
- package/dist/ghidra/GhidraPowerPcProfile.js +51 -0
- package/dist/ghidra/GhidraProvider.js +267 -42
- package/dist/ghidra/GhidraProviderCapabilities.js +29 -15
- package/dist/ghidra/GhidraProviderClient.js +439 -276
- package/dist/ghidra/GhidraPspExtension.js +210 -0
- package/dist/ghidra/GhidraPspProfile.js +62 -0
- package/dist/ghidra/GhidraRawBinaryLanguage.js +49 -0
- package/dist/ghidra/GhidraReleasePolicy.js +93 -0
- package/dist/ghidra/GhidraRequestQueue.js +64 -40
- package/dist/ghidra/GhidraRiscvProfile.js +100 -0
- package/dist/ghidra/GhidraSessionError.js +301 -24
- package/dist/ghidra/GhidraSessionValues.js +76 -0
- package/dist/ghidra/GhidraSocketConnection.js +25 -11
- package/dist/ghidra/GhidraTargetSnapshot.js +67 -50
- package/dist/ghidra/GhidraTransport.js +86 -62
- package/dist/ghidra/extensions/GhidraExtensions.js +30 -45
- package/dist/go/GoBinaryContainer.js +140 -0
- package/dist/go/GoBinaryImage.js +210 -0
- package/dist/go/GoBinaryProvider.js +180 -0
- package/dist/go/GoElfImage.js +211 -0
- package/dist/go/GoMachoImage.js +164 -0
- package/dist/go/GoModuleText.js +217 -0
- package/dist/go/GoPeImage.js +124 -0
- package/dist/hopper/BridgeLauncher.js +78 -6
- package/dist/hopper/HopperAnalysisProfile.js +23 -11
- package/dist/hopper/HopperCleanup.js +29 -4
- package/dist/hopper/HopperClient.js +317 -93
- package/dist/hopper/HopperMacPublisher.js +29 -0
- package/dist/hopper/HopperMachOImage.js +61 -29
- package/dist/hopper/HopperProcessDiagnostic.js +27 -0
- package/dist/hopper/HopperProvider.js +57 -29
- package/dist/hopper/HopperProviderCapabilities.js +9 -4
- package/dist/hopper/HopperRegexSearch.js +21 -60
- package/dist/hopper/HopperRequestQueue.js +17 -5
- package/dist/hopper/HopperSessionValues.js +10 -1
- package/dist/ida/IdaBusyHealth.js +78 -0
- package/dist/ida/IdaCallGraph.js +134 -0
- package/dist/ida/IdaConfiguration.js +7 -2
- package/dist/ida/IdaDiagnosticRedactor.js +199 -0
- package/dist/ida/IdaDiagnosticWriter.js +62 -0
- package/dist/ida/IdaDoctor.js +7 -5
- package/dist/ida/IdaJsonDiagnostic.js +138 -0
- package/dist/ida/IdaMcpConnection.js +308 -32
- package/dist/ida/IdaNativeProtocol.js +85 -0
- package/dist/ida/IdaOperationRunner.js +246 -61
- package/dist/ida/IdaProtocolValues.js +88 -5
- package/dist/ida/IdaProvider.js +45 -10
- package/dist/ida/IdaProviderCapabilities.js +37 -8
- package/dist/ida/IdaSessionClient.js +379 -60
- package/dist/ida/IdaWorkspace.js +54 -6
- package/dist/inspector/V8InspectorCaptureProjection.js +14 -2
- package/dist/inspector/V8InspectorEndpoint.js +15 -13
- package/dist/inspector/V8InspectorProvider.js +43 -7
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +44 -12
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +107 -32
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +7 -4
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +85 -10
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +16 -6
- package/dist/javascript/recovery/RecoveryFiles.js +107 -13
- package/dist/javascript/recovery/WakaruExecution.js +19 -11
- package/dist/javascript/recovery/WakaruProvider.js +12 -9
- package/dist/javascript/recovery/WakaruPublication.js +24 -10
- package/dist/javascript/recovery/WakaruRelease.js +1 -1
- package/dist/javascript/recovery/WakaruReport.js +3 -2
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +2 -16
- package/dist/javascript/sourceMaps/SourceMapCommand.js +22 -4
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +22 -4
- package/dist/javascript/sourceMaps/SourceMapFormat.js +25 -38
- package/dist/javascript/sourceMaps/TraceSourceMap.js +34 -6
- package/dist/jeb/JebMcpConnection.js +148 -82
- package/dist/jeb/JebMcpConnectionOwner.js +116 -0
- package/dist/jeb/JebMcpDeadline.js +46 -0
- package/dist/jeb/JebMcpEndpoint.js +6 -1
- package/dist/jeb/JebProvider.js +82 -58
- package/dist/kuna/KunaAddress.js +11 -0
- package/dist/kuna/KunaCommand.js +217 -0
- package/dist/kuna/KunaConfiguration.js +90 -0
- package/dist/kuna/KunaDoctor.js +198 -0
- package/dist/kuna/KunaInstallation.js +137 -0
- package/dist/kuna/KunaJson.js +23 -0
- package/dist/kuna/KunaJsonStream.js +433 -0
- package/dist/kuna/KunaLimits.js +5 -0
- package/dist/kuna/KunaProjectCache.js +804 -0
- package/dist/kuna/KunaProjectExport.js +202 -0
- package/dist/kuna/KunaProjectFiles.js +191 -0
- package/dist/kuna/KunaProjectReader.js +115 -0
- package/dist/kuna/KunaProvider.js +217 -0
- package/dist/kuna/KunaProviderCapabilities.js +102 -0
- package/dist/kuna/KunaQueryErrors.js +12 -0
- package/dist/kuna/KunaQueryWork.js +113 -0
- package/dist/kuna/KunaReferenceFiles.js +258 -0
- package/dist/kuna/KunaReferenceQueries.js +211 -0
- package/dist/kuna/KunaRelease.js +10 -0
- package/dist/kuna/KunaRunSlots.js +56 -0
- package/dist/kuna/KunaSessionClient.js +1162 -0
- package/dist/kuna/KunaStringInventory.js +145 -0
- package/dist/kuna/KunaStringQueries.js +133 -0
- package/dist/kuna/KunaTargetCommands.js +205 -0
- package/dist/kuna/KunaUnavailable.js +11 -0
- package/dist/logger.js +14 -1
- package/dist/main/processShutdown.js +17 -0
- package/dist/main/shutdown.js +3 -0
- package/dist/main/transport.js +68 -4
- package/dist/main.js +16 -15
- package/dist/mcp/AnalysisProvider-BABWbLoM.js +38 -0
- package/dist/mcp/AnalysisSnapshotFiles-BXz0c37-.js +1423 -0
- package/dist/mcp/ArtifactFileOperation-64cQKI7B.js +1704 -0
- package/dist/mcp/ArtifactProvider-Dx6pmil1.js +2200 -0
- package/dist/mcp/ArtifactProviderMetadata-UCJr2oZW.js +167 -0
- package/dist/mcp/ArtifactReader-BrnwNaKY.js +78 -0
- package/dist/mcp/ArtifactResourceScope-zi3Dkqzy.js +175 -0
- package/dist/mcp/AsarHeader-B_IbppTz.js +31 -0
- package/dist/mcp/BinarySessionStatus-CZ9nnXMt.js +213 -0
- package/dist/mcp/BinaryTargetResolver-BUncASDP.js +1358 -0
- package/dist/mcp/BoundedFileBytes-DYt5q9G2.js +43 -0
- package/dist/mcp/CdpCaptureDocuments-Y2uFcBpl.js +795 -0
- package/dist/mcp/CdpCaptureValues-tNIg-gQK.js +97 -0
- package/dist/mcp/CdpEndpoint-BrhMhpSi.js +641 -0
- package/dist/mcp/CdpOptionalCommand-PZZhlqxv.js +120 -0
- package/dist/mcp/CdpTargetSession-BmmDC3XO.js +290 -0
- package/dist/mcp/DirectAnalysis-B9KuCHTG.js +417 -0
- package/dist/mcp/DirectAnalysisStatus-BgzopkIt.js +44 -0
- package/dist/mcp/ElectronFileScope-FXtK0d6I.js +110 -0
- package/dist/mcp/ElectronFuseFailures-uZ_wOV6T.js +610 -0
- package/dist/mcp/MachoLoadCommandReader-C2VGgHA3.js +330 -0
- package/dist/mcp/ManagedStaticProvider-CZuoPme2.js +5326 -0
- package/dist/mcp/NativeMacOSProvider-CMguKrvN.js +5495 -0
- package/dist/mcp/NativeMacOSProviderMetadata-B_RH4KXF.js +397 -0
- package/dist/mcp/OwnedCommand-BW1jBSt9.js +1241 -0
- package/dist/mcp/ProcedureAddressResolution-H6Qwpb_Y.js +59 -0
- package/dist/mcp/WorkflowEvidence-CO4C7ALz.js +118 -0
- package/dist/mcp/analysisErrorCleanup-Q344SnTO.js +34 -0
- package/dist/mcp/analysisErrorCore-BIEP7tvF.js +509 -0
- package/dist/mcp/analysisErrorProjection-B8teQwwD.js +942 -0
- package/dist/mcp/artifactToolContracts-C9dRDo-D.js +74 -0
- package/dist/mcp/browserObservation-DUraZs62.js +4633 -0
- package/dist/mcp/browserObservationError-C5okJ5el.js +63 -0
- package/dist/mcp/browserObservationSchemas-DwGGxBpu.js +573 -0
- package/dist/mcp/browserScenario-BRUz7yN0.js +3415 -0
- package/dist/mcp/browserScenarioCapture-CiMAsMx8.js +595 -0
- package/dist/mcp/callerPath-CpPnMZyN.js +678 -0
- package/dist/mcp/canonicalDigest-Bi_0_zGi.js +71 -0
- package/dist/mcp/electronActiveObservation-DV0Ffy9X.js +227 -0
- package/dist/mcp/electronFuses-D5SS7XXw.js +367 -0
- package/dist/mcp/electronObservation-DsN-NqY1.js +621 -0
- package/dist/mcp/electronObservation-wOYWwqgF.js +112 -0
- package/dist/mcp/electronScenario-CYrt2zBK.js +913 -0
- package/dist/mcp/emptyArraySchema-C0o2Sxwp.js +140 -0
- package/dist/mcp/enhancedInputs-6CCgB3VB.js +56 -0
- package/dist/mcp/javascriptRuntimeObservation-BVbhkO2-.js +693 -0
- package/dist/mcp/javascriptRuntimeObservation-Cu0Yedqq.js +121 -0
- package/dist/mcp/jsonSerialization-V-wWiFRE.js +152 -0
- package/dist/mcp/lipo-DSTgUqL1.js +395 -0
- package/dist/mcp/localPath-AxvW9aPe.js +19 -0
- package/dist/mcp/logger-BGdGHadX.js +48 -0
- package/dist/mcp/machoContainer-CMSxUBlK.js +605 -0
- package/dist/mcp/main-Cx-Z7m_n.js +80276 -0
- package/dist/mcp/main.js +6 -0
- package/dist/mcp/managedToolContracts-CSlbKJP-.js +101 -0
- package/dist/mcp/nativeValueTrace-BEZbDieM.js +3601 -0
- package/dist/mcp/officialToolContracts-CauCcSsc.js +1432 -0
- package/dist/mcp/peMachine-aP1iYnHq.js +95 -0
- package/dist/mcp/pngHeader-DQ-ObyY2.js +147 -0
- package/dist/mcp/propertyListKeys-BfCo0k4w.js +356 -0
- package/dist/mcp/providerCleanupError-DIRHxzWo.js +125 -0
- package/dist/mcp/providerIdentities--ptAh481.js +31 -0
- package/dist/mcp/providerIdentity-BCQ5n5tw.js +16 -0
- package/dist/mcp/providerOperationHealth-9DRSGM8N.js +71 -0
- package/dist/mcp/rolldown-runtime-BjeaiXFo.js +121 -0
- package/dist/mcp/safeJson-NeGfpkrI.js +25 -0
- package/dist/mcp/scanCanonical-CF3ATd1V.js +3788 -0
- package/dist/mcp/serverIdentity-BK0Ejd_Y.js +1507 -0
- package/dist/mcp/sourceMapEnvelope-DAaRUIGj.js +94 -0
- package/dist/mcp/toolContracts-BPoHQdlC.js +12414 -0
- package/dist/mcp/toolOutputSchemaGroups-MJ_f-PMK.js +17730 -0
- package/dist/mcp/webContentArtifact-DfGkgDcI.js +269 -0
- package/dist/mcp/webRuntime-ccyhkRru.js +74 -0
- package/dist/mcp/webSourceLocation-DKIum0vJ.js +13167 -0
- package/dist/mcpDoctor.js +95 -70
- package/dist/mcpStartupPolicy.js +20 -2
- package/dist/native/AppleDispatchCoverage.js +57 -17
- package/dist/native/AppleDispatchMetadata.js +82 -29
- package/dist/native/AppleMachoFixups.js +208 -35
- package/dist/native/AppleMachoSelection.js +30 -23
- package/dist/native/AppleObjcCategories.js +13 -3
- package/dist/native/AppleObjcDispatchFacets.js +95 -17
- package/dist/native/AppleObjcProperties.js +61 -17
- package/dist/native/AppleObjcProtocols.js +25 -7
- package/dist/native/AppleSwiftVtables.js +2 -0
- package/dist/native/CommandRunner.js +146 -32
- package/dist/native/LldbCallTracer.js +235 -179
- package/dist/native/LldbReadbackFiles.js +70 -0
- package/dist/native/LldbRetainedObservations.js +28 -56
- package/dist/native/MachoArchitectureSelection.js +50 -0
- package/dist/native/NativeCallObservation.js +55 -53
- package/dist/native/NativeCallTarget.js +95 -0
- package/dist/native/NativeMacOSProvider.js +318 -188
- package/dist/native/NativeMachoInspection.js +155 -81
- package/dist/native/NativePlistSource.js +179 -0
- package/dist/native/NativeUiCleanupError.js +30 -0
- package/dist/native/NativeUiHelperRuntime.js +48 -35
- package/dist/native/NativeUiObservation.js +69 -47
- package/dist/native/SignatureTargetBinding.js +147 -65
- package/dist/native/parsers/codesign.js +27 -10
- package/dist/native/parsers/demangle.js +22 -12
- package/dist/native/parsers/dyldInfo.js +73 -4
- package/dist/native/parsers/lipo.js +53 -19
- package/dist/native/parsers/machoUuid.js +150 -0
- package/dist/native/parsers/otool.js +275 -32
- package/dist/native/parsers/plist.js +40 -25
- package/dist/native/pe/PeResourceLayout.js +22 -7
- package/dist/native/pe/PeResourceParser.js +10 -9
- package/dist/native/pe/PeResourcesProvider.js +76 -15
- package/dist/native/pwndbg/CoreFileMappingAuthority.js +51 -0
- package/dist/native/pwndbg/PwndbgCoreContext.js +39 -28
- package/dist/native/pwntools/PwntoolsDecoder.js +339 -52
- package/dist/native/pwntools/PwntoolsFailures.js +19 -4
- package/dist/native/pwntools/PwntoolsInputLimit.js +27 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +38 -16
- package/dist/native/pwntools/PwntoolsResourceLimits.js +3 -3
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +12 -8
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +3 -1
- package/dist/objdump/ObjdumpCommand.js +24 -0
- package/dist/pcap/PcapCommand.js +146 -0
- package/dist/pcap/PcapConfiguration.js +93 -0
- package/dist/pcap/PcapNativeBound.js +58 -0
- package/dist/pcap/PcapOutput.js +276 -0
- package/dist/pcap/PcapProvider.js +454 -0
- package/dist/pcap/PcapSnapshot.js +191 -0
- package/dist/process/ArtifactAnalysisResources.js +306 -0
- package/dist/process/BoundedFileBytes.js +8 -3
- package/dist/process/CurrentEntrypointPath.js +8 -0
- package/dist/process/DarwinProcessRunTokenReader.js +276 -61
- package/dist/process/DetachedPgpSignature.js +57 -0
- package/dist/process/ExecFileBoundedOutput.js +44 -0
- package/dist/process/ExecFileOutput.js +44 -17
- package/dist/{hopper/HopperTargetLease.js → process/HopperLease.js} +76 -19
- package/dist/process/JavaScriptWorkerMemoryLimit.js +25 -0
- package/dist/process/LinuxResourceLimits.js +60 -0
- package/dist/process/MacCodeSignature.js +3 -0
- package/dist/process/OwnedCommand.js +144 -25
- package/dist/process/PrivateRuntimeRoot.js +9 -19
- package/dist/process/PrivateRuntimeRootUnavailableError.js +10 -0
- package/dist/process/ProcessOwnership.js +70 -17
- package/dist/process/ProcessOwnershipObservation.js +35 -4
- package/dist/process/ProviderDeadline.js +58 -12
- package/dist/process/ProviderProcess.js +233 -17
- package/dist/process/RegexMatcher.js +96 -0
- package/dist/process/SharedStartupAttempt.js +59 -0
- package/dist/process/WindowsAuthority.js +48 -39
- package/dist/process/WindowsBatchCommand.js +46 -0
- package/dist/process/boundedUtf8Text.js +13 -0
- package/dist/process/capture/FilesystemSnapshot.js +63 -11
- package/dist/process/capture/ProcessCaptureClock.js +2 -0
- package/dist/process/capture/ProcessCaptureError.js +64 -7
- package/dist/process/capture/ProcessCaptureJournal.js +2 -1
- package/dist/process/capture/ProcessCaptureLifecycle.js +104 -56
- package/dist/process/capture/ProcessCaptureProgress.js +7 -4
- package/dist/process/capture/ProcessHarness.js +34 -17
- package/dist/process/capture/ProcessNormalization.js +278 -36
- package/dist/process/capture/ProcessSampling.js +3 -2
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +13 -13
- package/dist/process/capture/TerminalRenderer.js +31 -10
- package/dist/process/ownedDebuggerSession.js +203 -0
- package/dist/process/snapshotEnvironment.js +8 -8
- package/dist/{application/binary → providers}/AnalysisClientCleanup.js +3 -3
- package/dist/providers/AnalysisClientCreation.js +193 -0
- package/dist/providers/AnalysisClientFailure.js +191 -0
- package/dist/providers/DeferredAnalysisClient.js +48 -0
- package/dist/providers/OwnedCommandCleanup.js +65 -0
- package/dist/providers/ProviderInspectionScope.js +10 -0
- package/dist/recordedCatalogDigests.js +2 -0
- package/dist/reference/ReferenceSourceReader.js +64 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +79 -56
- package/dist/reference/ReferenceSourceReaderErrors.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +2 -2
- package/dist/reference/ReferenceSourceReaderTypes.js +1 -2
- package/dist/reference/ReferenceSourceReaderValidate.js +0 -1
- package/dist/rizin/RizinCommand.js +14 -0
- package/dist/rizin/RizinDebugSessionManager.js +1111 -0
- package/dist/rust/RustAuditableReader.js +309 -0
- package/dist/rust/RustBinaryImage.js +116 -0
- package/dist/rust/RustBinaryProvider.js +194 -0
- package/dist/server/EvidenceMcpServer.js +160 -37
- package/dist/server/admittedToolOperation.js +7 -2
- package/dist/server/contractToolHandler.js +17 -4
- package/dist/server/createServer.js +179 -30
- package/dist/server/externalMutationAdmission.js +50 -0
- package/dist/server/mcpProgress.js +4 -2
- package/dist/server/promptCompletion.js +43 -28
- package/dist/server/providerEnvironment.js +3 -0
- package/dist/server/registerAnalysisViewTool.js +6 -2
- package/dist/server/registerAndroidTools.js +22 -4
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +8 -1
- package/dist/server/registerArtifactComparisonTool.js +13 -2
- package/dist/server/registerArtifactTools.js +21 -1
- package/dist/server/registerBrowserScenarioTool.js +7 -5
- package/dist/server/registerBrowserTools.js +4 -8
- package/dist/server/registerBundleComparisonTool.js +4 -4
- package/dist/server/registerCaptureTools.js +12 -0
- package/dist/server/registerCutterTools.js +32 -0
- package/dist/server/registerElectronTools.js +13 -21
- package/dist/server/registerEnhancedTools.js +7 -6
- package/dist/server/registerEvidenceTools.js +14 -10
- package/dist/server/registerEvmTools.js +22 -4
- package/dist/server/registerFlutterTools.js +17 -0
- package/dist/server/registerFridaTools.js +201 -0
- package/dist/server/registerFunctionComparisonTool.js +29 -9
- package/dist/server/registerGdbTools.js +64 -0
- package/dist/server/registerGoTools.js +9 -0
- package/dist/server/registerInvestigationTools/helpers.js +2 -2
- package/dist/server/registerInvestigationTools.js +31 -27
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +3 -9
- package/dist/server/registerManagedTools.js +11 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +14 -7
- package/dist/server/registerNativeTools.js +14 -0
- package/dist/server/registerOfficialTools.js +5 -0
- package/dist/server/registerPcapTools.js +35 -0
- package/dist/server/registerProcessComparisonTool.js +12 -2
- package/dist/server/registerReverseEngineeringTools.js +86 -0
- package/dist/server/registerRizinDebugTools.js +53 -0
- package/dist/server/registerRustTools.js +9 -0
- package/dist/server/registerSessionRecordTools.js +19 -13
- package/dist/server/registerSessionStatusTool.js +33 -8
- package/dist/server/registerSessionTools.js +31 -31
- package/dist/server/registerSignalTools.js +12 -0
- package/dist/server/registerSqliteTools.js +9 -0
- package/dist/server/registerWasmTools.js +46 -0
- package/dist/server/registerWebNetworkCaptureTool.js +24 -10
- package/dist/server/retainedSummaryDelivery.js +28 -0
- package/dist/server/runDerivedOperation.js +2 -0
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/toolRegistrationOptions.js +8 -0
- package/dist/server/toolResult.js +52 -19
- package/dist/server/toolResultEncoding.js +36 -3
- package/dist/serverIdentity.js +17 -8
- package/dist/signals/SigrokRecordingProvider.js +346 -0
- package/dist/signals/parseDecoderDiscovery.js +65 -0
- package/dist/sqlite/SqliteDatabaseFailures.js +147 -0
- package/dist/sqlite/SqliteDatabaseInspection.js +436 -0
- package/dist/sqlite/SqliteDatabaseLimits.js +16 -0
- package/dist/sqlite/SqliteDatabaseProvider.js +295 -0
- package/dist/sqlite/SqliteDatabaseSnapshot.js +182 -0
- package/dist/sqlite/SqliteDatabaseWorker.js +46 -0
- package/dist/sqlite/SqliteDatabaseWorkerExecution.js +127 -0
- package/dist/wasm/WabtArtifactProvider.js +358 -0
- package/dist/wasm/WabtFailures.js +119 -0
- package/dist/wasm/WabtInterface.js +309 -0
- package/dist/wasm/WabtOutput.js +60 -0
- package/dist/wasm/WabtRelease.js +12 -0
- package/dist/wasm/WabtRuntime.js +58 -0
- package/dist/wasm/WabtString.js +48 -0
- package/dist/wasm/WabtWat.js +147 -0
- package/dist/wasm/WasmGlueAdapter.js +66 -0
- package/dist/wasm/WasmInterfaceBudget.js +11 -0
- package/dist/windows/WindowsNativeLoader.js +53 -9
- package/dist/windows/WindowsOwnedProcess.js +150 -17
- package/dist/windows/WindowsPrivateRuntime.js +66 -2
- package/install.sh +157 -98
- package/licenses/Apache-2.0.txt +202 -0
- package/licenses/GCC-Runtime-Library-Exception-3.1.txt +73 -0
- package/licenses/GPL-3.0.txt +674 -0
- package/licenses/LGPL-2.0.txt +480 -0
- package/licenses/MIT-template.txt +18 -0
- package/licenses/MinGW-w64-runtime.txt +240 -0
- package/licenses/Node-22.19.0-LICENSE.txt +2666 -0
- package/licenses/README.md +68 -0
- package/licenses/cfworker-MIT.txt +21 -0
- package/licenses/dotnet-runtime-MIT.txt +23 -0
- package/licenses/frida-17.23.2-COPYING.txt +50 -0
- package/licenses/ghidra-12.1.4-DISCLAIMER.txt +13 -0
- package/licenses/ghidra-12.1.4-LICENSE.txt +201 -0
- package/licenses/ghidra-12.1.4-NOTICE.txt +49 -0
- package/licenses/npm-dependencies.txt +3757 -0
- package/licenses/npm-runtime-notices.txt +8722 -0
- package/licenses/upstream-sources.json +72 -0
- package/licenses/xterm-MIT.txt +21 -0
- package/native/windows/README.md +130 -12
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +97 -22
- package/scripts/electron-active-hook-boundaries.cjs +15 -2
- package/scripts/electron-active-hook.cjs +412 -47
- package/scripts/hopper-demo-x11.py +65 -13
- package/scripts/prepack.mjs +5 -0
- package/scripts/rea-android-workspace-guardian.mjs +46 -0
- package/scripts/rea.mjs +89 -26
- package/scripts/verify-windows-native-artifact.mjs +2 -2
- package/skills/reverse-engineer-anything/SKILL.md +146 -11
- package/skills/reverse-engineer-anything/references/android-applications.md +3 -1
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +10 -10
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +23 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +72 -3
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +149 -19
- package/skills/reverse-engineer-anything/references/runtime-observation.md +57 -7
- package/third_party/README.md +1 -1
- package/third_party/wabt/README.md +24 -0
- package/dist/browser/history/HarCaptureAdapter.js +0 -20
- package/dist/cli/streamedJsonOutput.js +0 -135
- package/dist/hopper/HopperRegexWorker.js +0 -27
- /package/dist/{application/binary → process}/AbortablePromise.js +0 -0
|
@@ -0,0 +1,2021 @@
|
|
|
1
|
+
import { __esmMin } from "./rolldown-runtime-DXoylpqc.js";
|
|
2
|
+
import { PRODUCT_IDENTITY, compareUnicodeCodePoints, err, init_identity, init_result, init_unicodeCodePointOrder, ok } from "./reconstructionObligationLedgerSchemas-Bi6sect1.js";
|
|
3
|
+
import { ConfigurationError, init_configurationErrors } from "./errorSchemas-Ixz_q7qt.js";
|
|
4
|
+
import { NonRegularFileReadError, RegularFileChangedError, RegularFileCleanupFailure, init_OwnedRegularFile, init_RegularFile } from "./OwnedRegularFile-D1f5nUCx.js";
|
|
5
|
+
import { ArtifactReaderFailure, init_ArtifactReader } from "./ArtifactReader-DMwm42bk.js";
|
|
6
|
+
import { init_BoundedFileBytes, readBoundedFileBytes } from "./BoundedFileBytes-DRtiQNAQ.js";
|
|
7
|
+
import { init_RegularFileRead, readRegularFile, withRegularFile } from "./RegularFileRead-mbgGYtxe.js";
|
|
8
|
+
import { clientSkillDirectories, init_SupportedClients, init_environment, parseEnvironment, parseEnvironmentValues } from "./SupportedClients-DMafjitv.js";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
import { createHash } from "node:crypto";
|
|
12
|
+
import { isDeepStrictEqual } from "node:util";
|
|
13
|
+
import { constants } from "node:fs";
|
|
14
|
+
import { copyFile, lstat, mkdir, readFile, rm } from "node:fs/promises";
|
|
15
|
+
import { Document, Schema, isAlias, isMap, isNode, isScalar, isSeq, parseDocument, visit } from "yaml";
|
|
16
|
+
import writeFileAtomic from "write-file-atomic";
|
|
17
|
+
import { applyEdits, createScanner, format, parse, parseTree, printParseErrorCode } from "jsonc-parser";
|
|
18
|
+
import { parse as parse$1, stringify } from "smol-toml";
|
|
19
|
+
|
|
20
|
+
//#region dist/application/SetupRecoveryBackup.js
|
|
21
|
+
var isMissing, errorDetail, selectCurrentRecoveryBackup, copyExclusive, preserveCurrentRecoveryBackup;
|
|
22
|
+
function init_SetupRecoveryBackup() {
|
|
23
|
+
return (init_SetupRecoveryBackup = __esmMin((() => {
|
|
24
|
+
init_result();
|
|
25
|
+
init_RegularFileRead();
|
|
26
|
+
isMissing = (cause) => cause instanceof Error && "code" in cause && cause.code === "ENOENT";
|
|
27
|
+
errorDetail = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
28
|
+
selectCurrentRecoveryBackup = async (firstBackupPath, original, resources) => {
|
|
29
|
+
const read = (path) => readRegularFile(path, {
|
|
30
|
+
symlinks: "reject",
|
|
31
|
+
...resources === undefined ? {} : { resources }
|
|
32
|
+
});
|
|
33
|
+
const expected = Buffer.isBuffer(original) ? original : Buffer.from(original, "utf8");
|
|
34
|
+
let firstBackup;
|
|
35
|
+
try {
|
|
36
|
+
firstBackup = await read(firstBackupPath);
|
|
37
|
+
} catch (cause) {
|
|
38
|
+
if (cause instanceof RegularFileCleanupFailure) throw cause;
|
|
39
|
+
if (!isMissing(cause)) return err({
|
|
40
|
+
kind: "unreadable",
|
|
41
|
+
path: firstBackupPath,
|
|
42
|
+
detail: `The recovery backup could not be checked: ${errorDetail(cause)}`
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (firstBackup === undefined) return ok({
|
|
46
|
+
backupPath: firstBackupPath,
|
|
47
|
+
present: false
|
|
48
|
+
});
|
|
49
|
+
if (firstBackup.equals(expected)) return ok({
|
|
50
|
+
backupPath: firstBackupPath,
|
|
51
|
+
present: true
|
|
52
|
+
});
|
|
53
|
+
const digest = createHash("sha256").update(expected).digest("hex");
|
|
54
|
+
const recoveryPath = `${firstBackupPath}.${digest}.recovery`;
|
|
55
|
+
let recovery;
|
|
56
|
+
try {
|
|
57
|
+
recovery = await read(recoveryPath);
|
|
58
|
+
} catch (cause) {
|
|
59
|
+
if (cause instanceof RegularFileCleanupFailure) throw cause;
|
|
60
|
+
if (!isMissing(cause)) return err({
|
|
61
|
+
kind: "unreadable",
|
|
62
|
+
path: recoveryPath,
|
|
63
|
+
detail: `The recovery backup could not be checked: ${errorDetail(cause)}`
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (recovery !== undefined && !recovery.equals(expected)) return err({
|
|
67
|
+
kind: "occupied",
|
|
68
|
+
path: recoveryPath,
|
|
69
|
+
detail: `The recovery path already contains different data: ${recoveryPath}`
|
|
70
|
+
});
|
|
71
|
+
return ok({
|
|
72
|
+
backupPath: recoveryPath,
|
|
73
|
+
present: recovery !== undefined
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
copyExclusive = (source, destination) => copyFile(source, destination, constants.COPYFILE_EXCL);
|
|
77
|
+
preserveCurrentRecoveryBackup = async (firstBackupPath, source, original, { copy = copyExclusive, resources } = {}) => {
|
|
78
|
+
const selection = await selectCurrentRecoveryBackup(firstBackupPath, original, resources);
|
|
79
|
+
if (!selection.ok) return selection;
|
|
80
|
+
const { backupPath } = selection.value;
|
|
81
|
+
if (!selection.value.present) {
|
|
82
|
+
try {
|
|
83
|
+
await copy(source, backupPath);
|
|
84
|
+
} catch (cause) {
|
|
85
|
+
if (!(cause instanceof Error && "code" in cause && cause.code === "EEXIST")) return err({
|
|
86
|
+
kind: "copy",
|
|
87
|
+
path: backupPath,
|
|
88
|
+
detail: `The recovery backup could not be written: ${errorDetail(cause)}`
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const verified = await selectCurrentRecoveryBackup(firstBackupPath, original, resources);
|
|
93
|
+
if (!verified.ok) return verified;
|
|
94
|
+
if (verified.value.backupPath !== backupPath || !verified.value.present) return err({
|
|
95
|
+
kind: "unverified",
|
|
96
|
+
path: backupPath,
|
|
97
|
+
detail: `The recovery backup does not match the configuration it preserves: ${backupPath}`
|
|
98
|
+
});
|
|
99
|
+
return ok(backupPath);
|
|
100
|
+
};
|
|
101
|
+
})))();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region dist/application/SetupSkill.js
|
|
106
|
+
var MANAGED_SKILL_FILES, isManagedSkillManifest, readSkillFile, readSkillFileState, canonicalSkillContent, SetupSkillInstallError, systemSkillInstallFileOperations, skillDestinations, existingSkillDestinations, readOptionalSkillState, inspectSkillDirectory, skillDirectoryIssues, skillDirectoryFailure, validateCanonicalSkillDirectories, canonicalSkillFiles, inspectCanonicalSkill, canonicalSkillNeedsInstall, causeReason, causePath, restoreSkillFiles, installCanonicalSkill, readInstalledSkillIdentity;
|
|
107
|
+
function init_SetupSkill() {
|
|
108
|
+
return (init_SetupSkill = __esmMin((() => {
|
|
109
|
+
init_result();
|
|
110
|
+
init_BoundedFileBytes();
|
|
111
|
+
init_ArtifactReader();
|
|
112
|
+
init_identity();
|
|
113
|
+
init_RegularFile();
|
|
114
|
+
init_RegularFileRead();
|
|
115
|
+
init_SupportedClients();
|
|
116
|
+
init_SetupRecoveryBackup();
|
|
117
|
+
MANAGED_SKILL_FILES = [
|
|
118
|
+
"SKILL.md",
|
|
119
|
+
"references/connection-and-recovery.md",
|
|
120
|
+
"references/native-and-artifacts.md",
|
|
121
|
+
"references/javascript-applications.md",
|
|
122
|
+
"references/android-applications.md",
|
|
123
|
+
"references/runtime-observation.md",
|
|
124
|
+
"references/evidence-workflows.md"
|
|
125
|
+
];
|
|
126
|
+
isManagedSkillManifest = (content) => content.startsWith(`---\nname: ${PRODUCT_IDENTITY.skillName}\n`) || content.startsWith(`---\r\nname: ${PRODUCT_IDENTITY.skillName}\r\n`);
|
|
127
|
+
readSkillFile = (path, resources) => readSkillFileState(path, resources).then(({ bytes }) => bytes.toString("utf8"));
|
|
128
|
+
readSkillFileState = async (path, resources) => withRegularFile(path, async (handle, stats) => {
|
|
129
|
+
const bytes = await readBoundedFileBytes(handle, stats.size, undefined, stats.size);
|
|
130
|
+
if (bytes === undefined || bytes.length !== stats.size) throw new RegularFileChangedError(path);
|
|
131
|
+
return {
|
|
132
|
+
bytes,
|
|
133
|
+
mode: stats.mode & 4095
|
|
134
|
+
};
|
|
135
|
+
}, {
|
|
136
|
+
symlinks: "reject",
|
|
137
|
+
...resources === undefined ? {} : { resources }
|
|
138
|
+
});
|
|
139
|
+
canonicalSkillContent = (relativePath) => readFile(new URL(`../../skills/${PRODUCT_IDENTITY.skillName}/${relativePath}`, new URL("../application/SetupSkill.js", import.meta.url).href), "utf8");
|
|
140
|
+
SetupSkillInstallError = class extends Error {
|
|
141
|
+
_tag = "SetupSkillInstallError";
|
|
142
|
+
path;
|
|
143
|
+
stage;
|
|
144
|
+
reason;
|
|
145
|
+
rollbackFailures;
|
|
146
|
+
recoveryBackupPaths;
|
|
147
|
+
constructor(input) {
|
|
148
|
+
const message = [`REA skill ${input.stage} failed at ${input.path}: ${input.reason}.`, ...input.rollbackFailures.length === 0 ? [] : [`Rollback also failed for ${input.rollbackFailures.map(({ path, reason }) => `${path} (${reason})`).join(", ")}.`, ...input.recoveryBackupPaths.length === 0 ? [] : [`Existing-file backups remain at ${input.recoveryBackupPaths.join(", ")}.`]]].join(" ");
|
|
149
|
+
super(message, { cause: input.cause });
|
|
150
|
+
this.path = input.path;
|
|
151
|
+
this.stage = input.stage;
|
|
152
|
+
this.reason = input.reason;
|
|
153
|
+
this.rollbackFailures = input.rollbackFailures;
|
|
154
|
+
this.recoveryBackupPaths = input.recoveryBackupPaths;
|
|
155
|
+
}
|
|
156
|
+
get remediation() {
|
|
157
|
+
return `${this.message} Check permissions and rerun setup.`;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
systemSkillInstallFileOperations = {
|
|
161
|
+
mkdir: async (path) => {
|
|
162
|
+
await mkdir(path, { recursive: true });
|
|
163
|
+
},
|
|
164
|
+
backup: (source, destination) => copyFile(source, destination, constants.COPYFILE_EXCL),
|
|
165
|
+
write: (path, content, mode) => writeFileAtomic(path, content, {
|
|
166
|
+
encoding: "utf8",
|
|
167
|
+
mode
|
|
168
|
+
}),
|
|
169
|
+
remove: (path) => rm(path, { force: true })
|
|
170
|
+
};
|
|
171
|
+
skillDestinations = (home, clientIds, environment = {}, platform = process.platform) => clientSkillDirectories(home, clientIds, environment, platform).map(({ client, directory }) => ({
|
|
172
|
+
client,
|
|
173
|
+
path: join(directory, PRODUCT_IDENTITY.skillName)
|
|
174
|
+
}));
|
|
175
|
+
existingSkillDestinations = async (home, environment = {}, platform = process.platform, resources) => {
|
|
176
|
+
const existing = [];
|
|
177
|
+
for (const destination of skillDestinations(home, undefined, environment, platform)) {
|
|
178
|
+
try {
|
|
179
|
+
const issues = await skillDirectoryIssues([destination]);
|
|
180
|
+
if (issues.some(({ kind }) => kind === "unreadable")) throw skillDirectoryFailure(issues);
|
|
181
|
+
if (issues.length > 0) continue;
|
|
182
|
+
const manifest = join(destination.path, "SKILL.md");
|
|
183
|
+
const content = await readSkillFile(manifest, resources);
|
|
184
|
+
if (isManagedSkillManifest(content)) existing.push(destination);
|
|
185
|
+
} catch (cause) {
|
|
186
|
+
if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") continue;
|
|
187
|
+
if (cause instanceof RegularFileCleanupFailure || cause instanceof ArtifactReaderFailure) throw cause;
|
|
188
|
+
if (cause instanceof NonRegularFileReadError) continue;
|
|
189
|
+
throw cause;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return existing;
|
|
193
|
+
};
|
|
194
|
+
readOptionalSkillState = async (path, resources) => {
|
|
195
|
+
try {
|
|
196
|
+
return await readSkillFileState(path, resources);
|
|
197
|
+
} catch (cause) {
|
|
198
|
+
if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") return undefined;
|
|
199
|
+
throw cause;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
inspectSkillDirectory = async (path) => {
|
|
203
|
+
try {
|
|
204
|
+
const directory = await lstat(path);
|
|
205
|
+
if (directory.isSymbolicLink()) return err({
|
|
206
|
+
path,
|
|
207
|
+
kind: "symbolic_link",
|
|
208
|
+
detail: "Skill directory is a symbolic link."
|
|
209
|
+
});
|
|
210
|
+
if (!directory.isDirectory()) return err({
|
|
211
|
+
path,
|
|
212
|
+
kind: "not_directory",
|
|
213
|
+
detail: "Skill path is not a directory."
|
|
214
|
+
});
|
|
215
|
+
return ok(undefined);
|
|
216
|
+
} catch (cause) {
|
|
217
|
+
if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") return ok(undefined);
|
|
218
|
+
return err({
|
|
219
|
+
path,
|
|
220
|
+
kind: "unreadable",
|
|
221
|
+
detail: cause instanceof Error ? cause.message : String(cause)
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
skillDirectoryIssues = async (destinations) => {
|
|
226
|
+
const issues = [];
|
|
227
|
+
for (const { path } of destinations) {
|
|
228
|
+
const root = await inspectSkillDirectory(path);
|
|
229
|
+
if (!root.ok) {
|
|
230
|
+
issues.push(root.error);
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const references = await inspectSkillDirectory(join(path, "references"));
|
|
234
|
+
if (!references.ok) issues.push(references.error);
|
|
235
|
+
}
|
|
236
|
+
return issues;
|
|
237
|
+
};
|
|
238
|
+
skillDirectoryFailure = (issues) => new SetupSkillInstallError({
|
|
239
|
+
path: issues[0]?.path ?? "skill bundle",
|
|
240
|
+
stage: "prepare",
|
|
241
|
+
reason: `${issues.map(({ path, detail }) => `${detail} (${path})`).join(" ")} Use a regular skill directory, or run setup with --skill=false to configure the client without installing the skill`,
|
|
242
|
+
rollbackFailures: [],
|
|
243
|
+
recoveryBackupPaths: [],
|
|
244
|
+
cause: issues
|
|
245
|
+
});
|
|
246
|
+
validateCanonicalSkillDirectories = async (home, clientIds, environment = {}, platform = process.platform) => {
|
|
247
|
+
const issues = await skillDirectoryIssues(skillDestinations(home, clientIds, environment, platform));
|
|
248
|
+
return issues.length === 0 ? ok(undefined) : err(skillDirectoryFailure(issues));
|
|
249
|
+
};
|
|
250
|
+
canonicalSkillFiles = async (home, clientIds, environment = {}, platform = process.platform, resources) => {
|
|
251
|
+
const destinations = skillDestinations(home, clientIds, environment, platform);
|
|
252
|
+
const admission = await validateCanonicalSkillDirectories(home, clientIds, environment, platform);
|
|
253
|
+
if (!admission.ok) throw admission.error;
|
|
254
|
+
return Promise.all(destinations.flatMap(({ path: root }) => MANAGED_SKILL_FILES.map(async (relativePath) => {
|
|
255
|
+
const destination = join(root, relativePath);
|
|
256
|
+
return {
|
|
257
|
+
destination,
|
|
258
|
+
content: await canonicalSkillContent(relativePath),
|
|
259
|
+
original: await readOptionalSkillState(destination, resources)
|
|
260
|
+
};
|
|
261
|
+
})));
|
|
262
|
+
};
|
|
263
|
+
inspectCanonicalSkill = async (home, clientIds, environment, platform, resources) => {
|
|
264
|
+
const destinations = skillDestinations(home, clientIds, environment, platform);
|
|
265
|
+
const issues = clientIds === undefined ? [] : [...await skillDirectoryIssues(destinations)];
|
|
266
|
+
if (issues.length > 0) return err({
|
|
267
|
+
_tag: "SkillInspectionFailure",
|
|
268
|
+
issues,
|
|
269
|
+
cause: issues,
|
|
270
|
+
manifest: undefined
|
|
271
|
+
});
|
|
272
|
+
let canonical = true;
|
|
273
|
+
let manifest;
|
|
274
|
+
let failureCause;
|
|
275
|
+
let installedDestination = false;
|
|
276
|
+
for (const destination of destinations) {
|
|
277
|
+
const { path: root } = destination;
|
|
278
|
+
const pathIssues = clientIds === undefined ? await skillDirectoryIssues([destination]) : [];
|
|
279
|
+
if (pathIssues.length > 0) {
|
|
280
|
+
issues.push(...pathIssues);
|
|
281
|
+
if (failureCause === undefined) failureCause = pathIssues;
|
|
282
|
+
installedDestination = true;
|
|
283
|
+
canonical = false;
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
let rootCanonical = true;
|
|
287
|
+
let rootHasFiles = false;
|
|
288
|
+
const rootIssues = [];
|
|
289
|
+
for (const relativePath of MANAGED_SKILL_FILES) {
|
|
290
|
+
const destination = join(root, relativePath);
|
|
291
|
+
let original;
|
|
292
|
+
try {
|
|
293
|
+
original = await readOptionalSkillState(destination, resources);
|
|
294
|
+
} catch (cause) {
|
|
295
|
+
if (cause instanceof RegularFileCleanupFailure || cause instanceof ArtifactReaderFailure) throw cause;
|
|
296
|
+
rootIssues.push({
|
|
297
|
+
path: destination,
|
|
298
|
+
kind: "unreadable",
|
|
299
|
+
detail: causeReason(cause)
|
|
300
|
+
});
|
|
301
|
+
if (failureCause === undefined) failureCause = cause;
|
|
302
|
+
rootCanonical = false;
|
|
303
|
+
rootHasFiles = true;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (original !== undefined) rootHasFiles = true;
|
|
307
|
+
if (relativePath === "SKILL.md" && manifest === undefined) manifest = original?.bytes.toString("utf8");
|
|
308
|
+
if (original === undefined) rootCanonical = false;
|
|
309
|
+
else if (rootCanonical) {
|
|
310
|
+
const content = await canonicalSkillContent(relativePath);
|
|
311
|
+
rootCanonical = original.bytes.equals(Buffer.from(content, "utf8"));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (clientIds !== undefined || rootHasFiles || rootIssues.length > 0) {
|
|
315
|
+
installedDestination ||= rootHasFiles;
|
|
316
|
+
canonical = canonical && rootCanonical;
|
|
317
|
+
issues.push(...rootIssues);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return issues.length === 0 ? ok({
|
|
321
|
+
canonical,
|
|
322
|
+
manifest,
|
|
323
|
+
installedDestination
|
|
324
|
+
}) : err({
|
|
325
|
+
_tag: "SkillInspectionFailure",
|
|
326
|
+
issues,
|
|
327
|
+
cause: failureCause,
|
|
328
|
+
manifest
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
canonicalSkillNeedsInstall = async (home, clientIds = [], environment = {}, platform = process.platform, resources) => {
|
|
332
|
+
try {
|
|
333
|
+
const inspection = await inspectCanonicalSkill(home, clientIds, environment, platform, resources);
|
|
334
|
+
return !inspection.ok || !inspection.value.canonical;
|
|
335
|
+
} catch (cause) {
|
|
336
|
+
if (cause instanceof RegularFileCleanupFailure || cause instanceof ArtifactReaderFailure) throw cause;
|
|
337
|
+
void cause;
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
causeReason = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
342
|
+
causePath = (cause) => cause instanceof Error && "path" in cause && typeof cause.path === "string" ? cause.path : undefined;
|
|
343
|
+
restoreSkillFiles = async (attempted, operations) => {
|
|
344
|
+
const failures = [];
|
|
345
|
+
for (const { destination, original } of [...attempted].reverse()) {
|
|
346
|
+
try {
|
|
347
|
+
if (original === undefined) await operations.remove(destination);
|
|
348
|
+
else await operations.write(destination, original.bytes, original.mode);
|
|
349
|
+
} catch (cause) {
|
|
350
|
+
failures.push({
|
|
351
|
+
path: destination,
|
|
352
|
+
reason: causeReason(cause)
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return failures;
|
|
357
|
+
};
|
|
358
|
+
installCanonicalSkill = async (home, clientIds = [], environment = {}, platform = process.platform, operations = systemSkillInstallFileOperations, resources) => {
|
|
359
|
+
let attempted = [];
|
|
360
|
+
let stage = "prepare";
|
|
361
|
+
let failingPath = "skill bundle";
|
|
362
|
+
const recoveryPaths = new Map();
|
|
363
|
+
try {
|
|
364
|
+
const canonical = await canonicalSkillFiles(home, clientIds, environment, platform, resources);
|
|
365
|
+
const changed = canonical.filter(({ content, original }) => original?.bytes.equals(Buffer.from(content, "utf8")) !== true);
|
|
366
|
+
if (changed.length === 0) return ok("unchanged");
|
|
367
|
+
stage = "backup";
|
|
368
|
+
for (const { destination, original } of changed) {
|
|
369
|
+
failingPath = destination;
|
|
370
|
+
await operations.mkdir(dirname(destination));
|
|
371
|
+
if (original !== undefined) {
|
|
372
|
+
const preserved = await preserveCurrentRecoveryBackup(`${destination}.rea.backup`, destination, original.bytes, {
|
|
373
|
+
copy: operations.backup,
|
|
374
|
+
...resources === undefined ? {} : { resources }
|
|
375
|
+
});
|
|
376
|
+
if (!preserved.ok) throw new Error(preserved.error.detail);
|
|
377
|
+
recoveryPaths.set(destination, preserved.value);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
stage = "write";
|
|
381
|
+
for (const file of changed) {
|
|
382
|
+
failingPath = file.destination;
|
|
383
|
+
attempted.push(file);
|
|
384
|
+
await operations.write(file.destination, file.content, file.original?.mode ?? 384);
|
|
385
|
+
}
|
|
386
|
+
stage = "readback";
|
|
387
|
+
for (const { destination, content } of changed) {
|
|
388
|
+
failingPath = destination;
|
|
389
|
+
if (!(await readSkillFileState(destination, resources)).bytes.equals(Buffer.from(content, "utf8"))) throw new Error(`skill readback mismatch: ${destination}`);
|
|
390
|
+
}
|
|
391
|
+
return ok("installed");
|
|
392
|
+
} catch (cause) {
|
|
393
|
+
if (stage === "prepare" && cause instanceof SetupSkillInstallError) return err(cause);
|
|
394
|
+
failingPath = causePath(cause) ?? failingPath;
|
|
395
|
+
const rollbackFailures = await restoreSkillFiles(attempted, operations);
|
|
396
|
+
return err(new SetupSkillInstallError({
|
|
397
|
+
path: failingPath,
|
|
398
|
+
stage,
|
|
399
|
+
reason: causeReason(cause),
|
|
400
|
+
rollbackFailures,
|
|
401
|
+
recoveryBackupPaths: attempted.flatMap(({ destination, original }) => original === undefined || recoveryPaths.get(destination) === undefined ? [] : [recoveryPaths.get(destination)]),
|
|
402
|
+
cause
|
|
403
|
+
}));
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
readInstalledSkillIdentity = async (home, clientIds, environment = {}, platform = process.platform, resources) => {
|
|
407
|
+
const inspection = await inspectCanonicalSkill(home, clientIds, environment, platform, resources);
|
|
408
|
+
if (inspection.ok && !inspection.value.installedDestination) return undefined;
|
|
409
|
+
const content = inspection.ok ? inspection.value.manifest : inspection.error.manifest;
|
|
410
|
+
const issues = inspection.ok ? [] : inspection.error.issues;
|
|
411
|
+
const toolCount = content === undefined ? undefined : /^\s{2}tool_count:\s*(\d+)\s*$/mu.exec(content)?.[1];
|
|
412
|
+
return {
|
|
413
|
+
canonical: inspection.ok && inspection.value.canonical,
|
|
414
|
+
version: content === undefined ? null : /^\s{2}version:\s*"([^"]+)"\s*$/mu.exec(content)?.[1] ?? null,
|
|
415
|
+
toolCount: toolCount === undefined ? null : Number.parseInt(toolCount, 10),
|
|
416
|
+
...issues.length === 0 ? {} : { issues }
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
})))();
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region dist/application/DshCordisYaml.js
|
|
424
|
+
var CordisExpression, DshCordisYaml;
|
|
425
|
+
function init_DshCordisYaml() {
|
|
426
|
+
return (init_DshCordisYaml = __esmMin((() => {
|
|
427
|
+
init_configurationErrors();
|
|
428
|
+
CordisExpression = class {
|
|
429
|
+
source;
|
|
430
|
+
kind = "cordis-expression";
|
|
431
|
+
constructor(source) {
|
|
432
|
+
this.source = source;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
DshCordisYaml = class {
|
|
436
|
+
document;
|
|
437
|
+
#values = new Map();
|
|
438
|
+
#visiting = new Set();
|
|
439
|
+
constructor(text) {
|
|
440
|
+
this.document = parseDocument(text, {
|
|
441
|
+
customTags: [{
|
|
442
|
+
tag: "tag:yaml.org,2002:js",
|
|
443
|
+
resolve: (source) => source
|
|
444
|
+
}],
|
|
445
|
+
logLevel: "silent"
|
|
446
|
+
});
|
|
447
|
+
if (this.document.errors.length > 0 || this.document.warnings.length > 0) throw new ConfigurationError("Invalid or unsupported Cordis YAML", { cause: this.document.errors[0] ?? this.document.warnings[0] });
|
|
448
|
+
if (this.document.contents === null) this.document.contents = this.document.createNode([]);
|
|
449
|
+
if (!isSeq(this.document.contents)) throw new ConfigurationError("Cordis patches must be a YAML operation list");
|
|
450
|
+
this.value(this.document.contents);
|
|
451
|
+
try {
|
|
452
|
+
this.document.toJS();
|
|
453
|
+
} catch (cause) {
|
|
454
|
+
throw new ConfigurationError("Unsafe Cordis YAML alias expansion", { cause });
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
resolve(node) {
|
|
458
|
+
if (!isAlias(node)) return node;
|
|
459
|
+
const resolved = node.resolve(this.document);
|
|
460
|
+
if (resolved === undefined) throw new ConfigurationError("Cordis YAML contains an unresolved alias");
|
|
461
|
+
return resolved;
|
|
462
|
+
}
|
|
463
|
+
value(node) {
|
|
464
|
+
const resolved = this.resolve(node);
|
|
465
|
+
if (!isNode(resolved)) return resolved;
|
|
466
|
+
if (this.#values.has(resolved)) return this.#values.get(resolved);
|
|
467
|
+
if (this.#visiting.has(resolved)) throw new ConfigurationError("Cyclic Cordis YAML cannot be safely edited");
|
|
468
|
+
this.#visiting.add(resolved);
|
|
469
|
+
let value;
|
|
470
|
+
if (isScalar(resolved)) value = resolved.tag === "tag:yaml.org,2002:js" ? new CordisExpression(String(resolved.value)) : resolved.value;
|
|
471
|
+
else if (isSeq(resolved)) value = resolved.items.map((item) => this.value(item));
|
|
472
|
+
else if (isMap(resolved)) {
|
|
473
|
+
const entries = [];
|
|
474
|
+
for (const pair of resolved.items) {
|
|
475
|
+
entries.push([this.#key(pair.key), this.value(pair.value)]);
|
|
476
|
+
}
|
|
477
|
+
value = Object.fromEntries(entries);
|
|
478
|
+
}
|
|
479
|
+
this.#visiting.delete(resolved);
|
|
480
|
+
this.#values.set(resolved, value);
|
|
481
|
+
return value;
|
|
482
|
+
}
|
|
483
|
+
#key(node) {
|
|
484
|
+
const key = this.value(node);
|
|
485
|
+
if (typeof key === "object" && key !== null) throw new ConfigurationError("Cordis YAML mapping keys must be literal scalars");
|
|
486
|
+
return key === null ? "" : String(key);
|
|
487
|
+
}
|
|
488
|
+
field(map, key) {
|
|
489
|
+
return map?.items.findLast((pair) => this.#key(pair.key) === key)?.value;
|
|
490
|
+
}
|
|
491
|
+
/** Preserve unchanged nodes and carry their comments when replacing values. */
|
|
492
|
+
setValue(map, key, value) {
|
|
493
|
+
const original = this.field(map, key);
|
|
494
|
+
if (isDeepStrictEqual(this.value(original), value)) return;
|
|
495
|
+
const replacement = this.document.createNode(value);
|
|
496
|
+
if (isNode(original) && isNode(replacement)) {
|
|
497
|
+
if (original.comment !== undefined) replacement.comment = original.comment;
|
|
498
|
+
if (original.commentBefore !== undefined) replacement.commentBefore = original.commentBefore;
|
|
499
|
+
}
|
|
500
|
+
map.set(key, replacement);
|
|
501
|
+
}
|
|
502
|
+
/** Copy from the source before edits; materialized nodes own no anchors. */
|
|
503
|
+
copy(node, invalidated) {
|
|
504
|
+
if (isAlias(node)) {
|
|
505
|
+
const target = this.resolve(node);
|
|
506
|
+
return invalidated === undefined || isNode(target) && invalidated.has(target) ? this.copy(target) : node.clone();
|
|
507
|
+
}
|
|
508
|
+
if (!isNode(node)) return node;
|
|
509
|
+
const copied = node.clone();
|
|
510
|
+
if ((invalidated === undefined || invalidated.has(node)) && (isScalar(copied) || isMap(copied) || isSeq(copied))) delete copied.anchor;
|
|
511
|
+
if (isSeq(node) && isSeq(copied)) copied.items = node.items.map((item) => this.copy(item, invalidated));
|
|
512
|
+
if (isMap(node) && isMap(copied)) copied.items.forEach((pair, index) => {
|
|
513
|
+
pair.key = this.copy(node.items[index].key, invalidated);
|
|
514
|
+
pair.value = this.copy(node.items[index].value, invalidated);
|
|
515
|
+
});
|
|
516
|
+
return copied;
|
|
517
|
+
}
|
|
518
|
+
/** Replacing an anchor must not change untouched consumers of its old value. */
|
|
519
|
+
detach(node, invalidated) {
|
|
520
|
+
const copied = this.copy(node, invalidated);
|
|
521
|
+
if (isNode(copied)) visit(copied, {
|
|
522
|
+
Pair: (_key, pair) => {
|
|
523
|
+
if (isAlias(pair.key)) pair.key = this.copy(this.resolve(pair.key));
|
|
524
|
+
},
|
|
525
|
+
Value: (_key, value) => {
|
|
526
|
+
delete value.anchor;
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
return copied;
|
|
530
|
+
}
|
|
531
|
+
anchors(node) {
|
|
532
|
+
if (!isNode(node)) return [];
|
|
533
|
+
const anchors = [];
|
|
534
|
+
visit(node, { Value: (_key, value) => {
|
|
535
|
+
if (value.anchor) anchors.push(value);
|
|
536
|
+
} });
|
|
537
|
+
return anchors;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
})))();
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
//#endregion
|
|
544
|
+
//#region dist/application/DshCordisPatch.js
|
|
545
|
+
var DSH_ENTRY_ID, DSH_CLIENT_PACKAGE, LAUNCHER_KEYS, SELECTOR_KEYS, isRecord, DshCordisDocument, DshCordisEdit, dshDocument, parseDshCordisDocument, editDshDocument, serializeDshDocument, dshClientRegistrationEntry;
|
|
546
|
+
function init_DshCordisPatch() {
|
|
547
|
+
return (init_DshCordisPatch = __esmMin((() => {
|
|
548
|
+
init_environment();
|
|
549
|
+
init_configurationErrors();
|
|
550
|
+
init_result();
|
|
551
|
+
init_DshCordisYaml();
|
|
552
|
+
DSH_ENTRY_ID = "rea-mcp";
|
|
553
|
+
DSH_CLIENT_PACKAGE = "@deepseek-ai/dsh-mcp-client";
|
|
554
|
+
LAUNCHER_KEYS = new Set([
|
|
555
|
+
"serverName",
|
|
556
|
+
"transport",
|
|
557
|
+
"command",
|
|
558
|
+
"args"
|
|
559
|
+
]);
|
|
560
|
+
SELECTOR_KEYS = new Set(["id", "name"]);
|
|
561
|
+
isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof CordisExpression);
|
|
562
|
+
DshCordisDocument = class {
|
|
563
|
+
#yaml;
|
|
564
|
+
#operations;
|
|
565
|
+
#fields = new Map();
|
|
566
|
+
#entryNode;
|
|
567
|
+
#insertions;
|
|
568
|
+
#unknownSelector = false;
|
|
569
|
+
#unknownStructure = false;
|
|
570
|
+
#editabilityError;
|
|
571
|
+
config;
|
|
572
|
+
constructor(text) {
|
|
573
|
+
this.#yaml = new DshCordisYaml(text);
|
|
574
|
+
const root = this.#yaml.document.contents;
|
|
575
|
+
if (!isSeq(root)) throw new ConfigurationError("Cordis patches must be a list");
|
|
576
|
+
const operations = [];
|
|
577
|
+
let insertions = 0;
|
|
578
|
+
let malformedStructure = false;
|
|
579
|
+
for (const source of root.items) {
|
|
580
|
+
const map = this.#map(source);
|
|
581
|
+
if (map === undefined) {
|
|
582
|
+
if (this.#yaml.value(source) instanceof CordisExpression) this.#unknownStructure = true;
|
|
583
|
+
else malformedStructure = true;
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
const inserted = this.#yaml.resolve(this.#yaml.field(map, "insert"));
|
|
587
|
+
const targetId = this.#id(map);
|
|
588
|
+
const unknownApplicability = targetId !== undefined;
|
|
589
|
+
const insertedValue = this.#yaml.value(inserted);
|
|
590
|
+
const invalidEntries = isSeq(inserted) ? inserted.items.filter((entry) => this.#map(entry) === undefined) : [];
|
|
591
|
+
if (insertedValue instanceof CordisExpression || invalidEntries.some((entry) => this.#yaml.value(entry) instanceof CordisExpression)) this.#unknownStructure = true;
|
|
592
|
+
else if (insertedValue != null && !isSeq(inserted)) malformedStructure = true;
|
|
593
|
+
else if (invalidEntries.length > 0) malformedStructure = true;
|
|
594
|
+
const ownedRows = isSeq(inserted) ? inserted.items.flatMap((entry, index) => this.#id(entry) === "rea-mcp" ? [index] : []) : [];
|
|
595
|
+
const direct = !isSeq(inserted) && targetId === "rea-mcp";
|
|
596
|
+
operations.push({
|
|
597
|
+
source,
|
|
598
|
+
map,
|
|
599
|
+
ownedRows,
|
|
600
|
+
direct,
|
|
601
|
+
unknownApplicability
|
|
602
|
+
});
|
|
603
|
+
if (isSeq(inserted)) {
|
|
604
|
+
for (const index of ownedRows) {
|
|
605
|
+
const entry = this.#map(inserted.items[index]);
|
|
606
|
+
if (entry === undefined) continue;
|
|
607
|
+
insertions += 1;
|
|
608
|
+
this.#entryNode = entry;
|
|
609
|
+
this.#fields.clear();
|
|
610
|
+
this.#unknownSelector = false;
|
|
611
|
+
this.#readFields(entry);
|
|
612
|
+
}
|
|
613
|
+
} else if (direct) {
|
|
614
|
+
if (insertions === 0) continue;
|
|
615
|
+
const selector = this.#yaml.value(this.#yaml.field(map, "name"));
|
|
616
|
+
if (selector instanceof CordisExpression || selector && this.#field("name") instanceof CordisExpression) {
|
|
617
|
+
this.#unknownSelector = true;
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
if (selector && selector !== this.#field("name")) continue;
|
|
621
|
+
this.#readFields(map, new Set(["id", "name"]));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
this.#operations = operations;
|
|
625
|
+
this.#insertions = insertions;
|
|
626
|
+
this.#editabilityError = this.#unknownStructure ? new ConfigurationError("Expression-backed Cordis patches have unknown structure; use literal patches before setup") : malformedStructure ? new ConfigurationError("Malformed Cordis patches cannot be edited safely; use mapping entries and insert lists before setup") : operations.some((op) => op.unknownApplicability && op.ownedRows.length > 0) ? new ConfigurationError("Cordis REA insertion targets a group with unknown activity; use a direct insertion before setup") : this.#unknownSelector ? new ConfigurationError("Expression-backed Cordis name selectors have unknown applicability; use literal selectors before setup", { settings: [{
|
|
627
|
+
setting: "name",
|
|
628
|
+
constraint: "Use literal selectors before setup"
|
|
629
|
+
}] }) : undefined;
|
|
630
|
+
const config = this.#field("config");
|
|
631
|
+
this.config = insertions === 0 ? undefined : isRecord(config) ? config : {};
|
|
632
|
+
}
|
|
633
|
+
#map(node) {
|
|
634
|
+
const map = this.#yaml.resolve(node);
|
|
635
|
+
return isMap(map) ? map : undefined;
|
|
636
|
+
}
|
|
637
|
+
#id(node) {
|
|
638
|
+
const id = this.#yaml.value(this.#yaml.field(this.#map(node), "id"));
|
|
639
|
+
if (id instanceof CordisExpression) throw new ConfigurationError("Expression-backed Cordis IDs have unknown ownership; use literal IDs before changing registrations");
|
|
640
|
+
return id;
|
|
641
|
+
}
|
|
642
|
+
#field(key) {
|
|
643
|
+
return this.#yaml.value(this.#fields.get(key));
|
|
644
|
+
}
|
|
645
|
+
#readFields(map, omitted = new Set()) {
|
|
646
|
+
for (const pair of map.items) {
|
|
647
|
+
const key = this.#yaml.value(pair.key);
|
|
648
|
+
if (typeof key === "string" && !omitted.has(key)) this.#fields.set(key, pair.value);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
get carriesEntry() {
|
|
652
|
+
return this.#operations.some((op) => op.direct || op.ownedRows.length > 0);
|
|
653
|
+
}
|
|
654
|
+
get hasUnknownStructure() {
|
|
655
|
+
return this.#unknownStructure;
|
|
656
|
+
}
|
|
657
|
+
get editabilityError() {
|
|
658
|
+
return this.#editabilityError;
|
|
659
|
+
}
|
|
660
|
+
get ready() {
|
|
661
|
+
const disabled = this.#field("disabled");
|
|
662
|
+
return this.#insertions === 1 && this.#editabilityError === undefined && this.#field("name") === "@deepseek-ai/dsh-mcp-client" && (disabled === undefined || disabled === false);
|
|
663
|
+
}
|
|
664
|
+
/** Validate literals without treating expression source as an environment value. */
|
|
665
|
+
environment(overrides = {}, validation = "effective") {
|
|
666
|
+
const config = this.#field("config");
|
|
667
|
+
if (config instanceof CordisExpression) return err(new ConfigurationError("Expression-backed Cordis config cannot be safely edited", { settings: [{
|
|
668
|
+
setting: "config",
|
|
669
|
+
constraint: "Use a literal mapping to preserve caller fields during setup"
|
|
670
|
+
}] }));
|
|
671
|
+
if (config !== undefined && !isRecord(config)) return err(new ConfigurationError("Cordis REA config must be a mapping", { settings: [{
|
|
672
|
+
setting: "config",
|
|
673
|
+
constraint: "Use a literal mapping before setup"
|
|
674
|
+
}] }));
|
|
675
|
+
const raw = this.config?.env;
|
|
676
|
+
if (raw !== undefined && !isRecord(raw)) return err(new ConfigurationError("Cordis server environment must be a mapping"));
|
|
677
|
+
const literals = {};
|
|
678
|
+
const unresolvedSettings = new Set();
|
|
679
|
+
for (const [key, value] of Object.entries(raw ?? {})) {
|
|
680
|
+
if (value instanceof CordisExpression) {
|
|
681
|
+
if (overrides[key] === undefined) unresolvedSettings.add(key);
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
684
|
+
if (typeof value !== "string") return err(new ConfigurationError("Invalid Cordis server environment", { settings: [{
|
|
685
|
+
setting: `env.${key}`,
|
|
686
|
+
constraint: "Environment values must be strings or Cordis expressions"
|
|
687
|
+
}] }));
|
|
688
|
+
literals[key] = value;
|
|
689
|
+
}
|
|
690
|
+
const environment = {
|
|
691
|
+
...literals,
|
|
692
|
+
...overrides
|
|
693
|
+
};
|
|
694
|
+
const validated = validation === "fragment" ? parseEnvironmentValues(environment, unresolvedSettings) : parseEnvironment(environment, unresolvedSettings);
|
|
695
|
+
return validated.ok ? ok(environment) : validated;
|
|
696
|
+
}
|
|
697
|
+
desired(command, overrides) {
|
|
698
|
+
if (this.#editabilityError !== undefined) return err(this.#editabilityError);
|
|
699
|
+
const environment = this.environment(overrides);
|
|
700
|
+
if (!environment.ok) return environment;
|
|
701
|
+
const env = {
|
|
702
|
+
...isRecord(this.config?.env) ? this.config.env : {},
|
|
703
|
+
...overrides
|
|
704
|
+
};
|
|
705
|
+
const desired = {
|
|
706
|
+
...this.config,
|
|
707
|
+
...dshClientRegistrationEntry(command)
|
|
708
|
+
};
|
|
709
|
+
delete desired.env;
|
|
710
|
+
if (Object.keys(env).length > 0) desired.env = env;
|
|
711
|
+
return ok(desired);
|
|
712
|
+
}
|
|
713
|
+
/** Plan every replacement from source snapshots before changing an output tree. */
|
|
714
|
+
serialize(desired) {
|
|
715
|
+
if (this.#editabilityError !== undefined && (this.#unknownStructure || desired !== undefined)) throw this.#editabilityError;
|
|
716
|
+
const root = this.#yaml.document.contents;
|
|
717
|
+
if (!isSeq(root)) throw new ConfigurationError("Cordis patches must be a list");
|
|
718
|
+
const replacements = new Map();
|
|
719
|
+
const invalidated = new Set(this.#operations.flatMap((op) => op.direct || op.ownedRows.length > 0 ? this.#yaml.anchors(op.source) : []));
|
|
720
|
+
let carried = false;
|
|
721
|
+
for (const op of this.#operations) {
|
|
722
|
+
if (op.direct) {
|
|
723
|
+
replacements.set(op.source, undefined);
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
if (op.ownedRows.length === 0) continue;
|
|
727
|
+
const copy = this.#yaml.detach(op.map, invalidated);
|
|
728
|
+
if (!isMap(copy)) throw new ConfigurationError("Cordis operation is not a mapping");
|
|
729
|
+
const inserted = this.#yaml.detach(this.#yaml.resolve(this.#yaml.field(op.map, "insert")), invalidated);
|
|
730
|
+
if (!isSeq(inserted)) throw new ConfigurationError("Cordis insertion is not a list");
|
|
731
|
+
copy.set("insert", inserted);
|
|
732
|
+
const owned = new Set(op.ownedRows);
|
|
733
|
+
inserted.items = inserted.items.flatMap((entry, index) => {
|
|
734
|
+
if (!owned.has(index)) return [entry];
|
|
735
|
+
if (carried || desired === undefined) return [];
|
|
736
|
+
carried = true;
|
|
737
|
+
return [this.#entry(desired, invalidated)];
|
|
738
|
+
});
|
|
739
|
+
if (inserted.items.length === 0) copy.delete("insert");
|
|
740
|
+
const kept = inserted.items.length > 0 || this.#id(op.map) !== "rea-mcp" && copy.items.some((pair) => !SELECTOR_KEYS.has(this.#yaml.value(pair.key)));
|
|
741
|
+
replacements.set(op.source, kept ? copy : undefined);
|
|
742
|
+
}
|
|
743
|
+
const output = this.#yaml.document.clone();
|
|
744
|
+
const outputRoot = output.contents;
|
|
745
|
+
if (!isSeq(outputRoot)) throw new ConfigurationError("Cordis patches must be a list");
|
|
746
|
+
outputRoot.items = root.items.flatMap((source) => {
|
|
747
|
+
const copy = replacements.has(source) ? replacements.get(source) : this.#yaml.copy(source, invalidated);
|
|
748
|
+
return copy === undefined ? [] : [copy];
|
|
749
|
+
});
|
|
750
|
+
if (!carried && desired !== undefined) outputRoot.items.push(output.createNode({ insert: [{
|
|
751
|
+
id: DSH_ENTRY_ID,
|
|
752
|
+
name: DSH_CLIENT_PACKAGE,
|
|
753
|
+
config: desired
|
|
754
|
+
}] }));
|
|
755
|
+
return output.toString({ lineWidth: 0 });
|
|
756
|
+
}
|
|
757
|
+
#entry(desired, invalidated) {
|
|
758
|
+
const entry = this.#yaml.detach(this.#entryNode, invalidated);
|
|
759
|
+
if (!isMap(entry)) throw new ConfigurationError("Cordis entry is not a mapping");
|
|
760
|
+
this.#yaml.setValue(entry, "id", DSH_ENTRY_ID);
|
|
761
|
+
this.#yaml.setValue(entry, "name", DSH_CLIENT_PACKAGE);
|
|
762
|
+
entry.delete("disabled");
|
|
763
|
+
for (const [key, value] of this.#fields) {
|
|
764
|
+
if ([
|
|
765
|
+
"id",
|
|
766
|
+
"name",
|
|
767
|
+
"config",
|
|
768
|
+
"disabled"
|
|
769
|
+
].includes(key)) continue;
|
|
770
|
+
entry.set(key, this.#yaml.detach(value, invalidated));
|
|
771
|
+
}
|
|
772
|
+
const sourceConfig = this.#map(this.#fields.get("config"));
|
|
773
|
+
const config = sourceConfig === undefined ? this.#yaml.document.createNode({}) : this.#yaml.detach(sourceConfig, invalidated);
|
|
774
|
+
if (!isMap(config)) throw new ConfigurationError("Cordis registration config is not a mapping");
|
|
775
|
+
for (const key of LAUNCHER_KEYS) this.#yaml.setValue(config, key, desired[key]);
|
|
776
|
+
const env = this.#map(this.#yaml.field(sourceConfig, "env"));
|
|
777
|
+
const desiredEnv = desired.env;
|
|
778
|
+
if (isRecord(desiredEnv)) {
|
|
779
|
+
const nextEnv = env === undefined ? this.#yaml.document.createNode({}) : this.#yaml.detach(env, invalidated);
|
|
780
|
+
if (!isMap(nextEnv)) throw new ConfigurationError("Cordis environment is not a mapping");
|
|
781
|
+
for (const [key, value] of Object.entries(desiredEnv)) {
|
|
782
|
+
this.#yaml.setValue(nextEnv, key, value);
|
|
783
|
+
}
|
|
784
|
+
config.set("env", nextEnv);
|
|
785
|
+
} else config.delete("env");
|
|
786
|
+
entry.set("config", config);
|
|
787
|
+
return entry;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
DshCordisEdit = class {
|
|
791
|
+
source;
|
|
792
|
+
desired;
|
|
793
|
+
constructor(source, desired) {
|
|
794
|
+
this.source = source;
|
|
795
|
+
this.desired = desired;
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
dshDocument = (document) => {
|
|
799
|
+
if (!(document.cordis instanceof DshCordisDocument)) throw new ConfigurationError("Missing Cordis document owner");
|
|
800
|
+
return document.cordis;
|
|
801
|
+
};
|
|
802
|
+
parseDshCordisDocument = (text) => {
|
|
803
|
+
const source = new DshCordisDocument(text);
|
|
804
|
+
return {
|
|
805
|
+
document: { cordis: source },
|
|
806
|
+
servers: source.config === undefined ? {} : { rea: source.config },
|
|
807
|
+
serversPath: [],
|
|
808
|
+
dialect: "dsh",
|
|
809
|
+
legacyServers: {}
|
|
810
|
+
};
|
|
811
|
+
};
|
|
812
|
+
editDshDocument = (parsed, desired) => ({ cordis: new DshCordisEdit(dshDocument(parsed.document), desired) });
|
|
813
|
+
serializeDshDocument = (document) => {
|
|
814
|
+
if (!(document.cordis instanceof DshCordisEdit)) throw new ConfigurationError("Missing Cordis edit plan");
|
|
815
|
+
return document.cordis.source.serialize(document.cordis.desired);
|
|
816
|
+
};
|
|
817
|
+
dshClientRegistrationEntry = (command, environment = {}) => {
|
|
818
|
+
const [executable = "rea", ...args] = command;
|
|
819
|
+
return {
|
|
820
|
+
serverName: "rea",
|
|
821
|
+
transport: "stdio",
|
|
822
|
+
command: executable,
|
|
823
|
+
args,
|
|
824
|
+
...Object.keys(environment).length === 0 ? {} : { env: { ...environment } }
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
})))();
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region dist/application/HermesConfigurationYaml.js
|
|
832
|
+
var SOURCE_SCALAR_TAGS, timestampTag, timestampSource, hermesTimestampImplicit, floorDivide, civilDay, parseHermesTimestamp, numericValue, numericValuesEqual, sameResolvedScalarValue, keepScalarSource, createHermesYamlOptions, stringifyHermesConfigurationYaml, isEmptyYamlRoot, parseHermesDocument, parseHermesConfigurationYaml, retainHermesScalarSource, editHermesConfigurationYaml;
|
|
833
|
+
function init_HermesConfigurationYaml() {
|
|
834
|
+
return (init_HermesConfigurationYaml = __esmMin((() => {
|
|
835
|
+
SOURCE_SCALAR_TAGS = new Set([
|
|
836
|
+
"tag:yaml.org,2002:int",
|
|
837
|
+
"tag:yaml.org,2002:float",
|
|
838
|
+
"tag:yaml.org,2002:timestamp"
|
|
839
|
+
]);
|
|
840
|
+
timestampTag = new Schema({ schema: "yaml-1.1" }).tags.find((tag) => tag.tag === "tag:yaml.org,2002:timestamp" && tag.collection === undefined);
|
|
841
|
+
if (timestampTag === undefined) throw new Error("The YAML 1.1 schema must provide its timestamp tag");
|
|
842
|
+
timestampSource = /^(\d{4})-(\d{1,2})-(\d{1,2})(?:(?:[Tt]|[ \t]+)(\d{1,2}):(\d{2}):(\d{2})(?:\.([0-9]*))?(?:[ \t]*(Z|([-+])(\d{1,2})(?::(\d{2}))?))?)?$/;
|
|
843
|
+
hermesTimestampImplicit = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}(?:[Tt]|[ \t]+)\d{1,2}:\d{2}:\d{2}(?:\.[0-9]*)?(?:[ \t]*(?:Z|[-+]\d{1,2}(?::\d{2})?))?)$/;
|
|
844
|
+
floorDivide = (value, divisor) => Math.floor(value / divisor);
|
|
845
|
+
civilDay = (year, month, day) => {
|
|
846
|
+
const adjustedYear = year - (month <= 2 ? 1 : 0);
|
|
847
|
+
const era = floorDivide(adjustedYear, 400);
|
|
848
|
+
const yearOfEra = adjustedYear - era * 400;
|
|
849
|
+
const adjustedMonth = month + (month > 2 ? -3 : 9);
|
|
850
|
+
const dayOfYear = floorDivide(153 * adjustedMonth + 2, 5) + day - 1;
|
|
851
|
+
const dayOfEra = yearOfEra * 365 + floorDivide(yearOfEra, 4) - floorDivide(yearOfEra, 100) + dayOfYear;
|
|
852
|
+
return era * 146097 + dayOfEra - 719468;
|
|
853
|
+
};
|
|
854
|
+
parseHermesTimestamp = (source) => {
|
|
855
|
+
const match = timestampSource.exec(source);
|
|
856
|
+
if (match === null) return undefined;
|
|
857
|
+
const [, yearText, monthText, dayText, hourText, minuteText, secondText, fraction, zone, sign, zoneHourText, zoneMinuteText] = match;
|
|
858
|
+
if (yearText === undefined || monthText === undefined || dayText === undefined) return undefined;
|
|
859
|
+
const year = Number(yearText);
|
|
860
|
+
const month = Number(monthText);
|
|
861
|
+
const dayOfMonth = Number(dayText);
|
|
862
|
+
if (year < 1 || year > 9999 || month < 1 || month > 12) return undefined;
|
|
863
|
+
const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
864
|
+
const monthDays = [
|
|
865
|
+
31,
|
|
866
|
+
leapYear ? 29 : 28,
|
|
867
|
+
31,
|
|
868
|
+
30,
|
|
869
|
+
31,
|
|
870
|
+
30,
|
|
871
|
+
31,
|
|
872
|
+
31,
|
|
873
|
+
30,
|
|
874
|
+
31,
|
|
875
|
+
30,
|
|
876
|
+
31
|
|
877
|
+
];
|
|
878
|
+
if (dayOfMonth < 1 || dayOfMonth > (monthDays[month - 1] ?? 0)) return undefined;
|
|
879
|
+
const date = `${yearText}-${monthText.padStart(2, "0")}-${dayText.padStart(2, "0")}`;
|
|
880
|
+
const day = civilDay(year, month, dayOfMonth);
|
|
881
|
+
if (hourText === undefined) {
|
|
882
|
+
const micros = BigInt(day) * 86400000000n;
|
|
883
|
+
return {
|
|
884
|
+
key: `date:${date}`,
|
|
885
|
+
value: new Date(Number(micros / 1000n))
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
const hour = Number(hourText);
|
|
889
|
+
const minute = Number(minuteText);
|
|
890
|
+
const second = Number(secondText);
|
|
891
|
+
if (hour > 23 || minute > 59 || second > 59) return undefined;
|
|
892
|
+
const zoneHour = Number(zoneHourText ?? 0);
|
|
893
|
+
const zoneMinute = Number(zoneMinuteText ?? 0);
|
|
894
|
+
if (zoneHour > 23 || zoneMinute > 59) return undefined;
|
|
895
|
+
let microseconds = 0;
|
|
896
|
+
if (fraction !== undefined && fraction.length > 0) {
|
|
897
|
+
microseconds = Number((fraction.slice(0, 6) + "000000").slice(0, 6));
|
|
898
|
+
if (fraction.length > 6 && Number(fraction[6]) > 4) microseconds += 1;
|
|
899
|
+
}
|
|
900
|
+
const wholeSeconds = hour * 3600 + minute * 60 + second;
|
|
901
|
+
if (year === 9999 && month === 12 && dayOfMonth === 31 && wholeSeconds === 86399 && microseconds === 1e6) return undefined;
|
|
902
|
+
let micros = BigInt(day) * 86400000000n + BigInt(wholeSeconds) * 1000000n + BigInt(microseconds);
|
|
903
|
+
if (zone !== undefined && zone !== "Z") {
|
|
904
|
+
const offset = (zoneHour * 60 + zoneMinute) * (sign === "+" ? 1 : -1);
|
|
905
|
+
micros -= BigInt(offset) * 60000000n;
|
|
906
|
+
}
|
|
907
|
+
return {
|
|
908
|
+
key: zone === undefined ? `datetime-local:${micros}` : `datetime-utc:${micros}`,
|
|
909
|
+
value: new Date(Number(micros / 1000n - (micros % 1000n < 0n ? 1n : 0n)))
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
numericValue = (value) => {
|
|
913
|
+
if (typeof value === "boolean") return value ? 1n : 0n;
|
|
914
|
+
if (typeof value === "bigint" || typeof value === "number") return value;
|
|
915
|
+
return undefined;
|
|
916
|
+
};
|
|
917
|
+
numericValuesEqual = (left, right) => {
|
|
918
|
+
if (typeof left === "bigint" && typeof right === "bigint") return left === right;
|
|
919
|
+
if (typeof left === "number" && typeof right === "number") return left === right || Number.isNaN(left) && Number.isNaN(right);
|
|
920
|
+
const integer = typeof left === "bigint" ? left : right;
|
|
921
|
+
const number = typeof left === "number" ? left : right;
|
|
922
|
+
return Number.isFinite(number) && Number.isInteger(number) && BigInt(number) === integer;
|
|
923
|
+
};
|
|
924
|
+
sameResolvedScalarValue = (left, right) => Object.is(left, right) || left instanceof Date && right instanceof Date && left.getTime() === right.getTime();
|
|
925
|
+
keepScalarSource = (tag) => {
|
|
926
|
+
if (typeof tag === "string" || tag.collection !== undefined) return tag;
|
|
927
|
+
const { stringify } = tag;
|
|
928
|
+
if (!SOURCE_SCALAR_TAGS.has(tag.tag) || stringify === undefined) return tag;
|
|
929
|
+
return {
|
|
930
|
+
...tag,
|
|
931
|
+
stringify: (item, context, ...rest) => {
|
|
932
|
+
const { source } = item;
|
|
933
|
+
if (source === undefined) return stringify(item, context, ...rest);
|
|
934
|
+
const reader = context.doc.schema.tags.find((candidate) => candidate.default === true && candidate.test?.test(source) === true);
|
|
935
|
+
const read = reader?.resolve(source, () => undefined, context.doc.options);
|
|
936
|
+
return sameResolvedScalarValue(isScalar(read) ? read.value : read, item.value) ? source : stringify(item, context, ...rest);
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
};
|
|
940
|
+
createHermesYamlOptions = () => {
|
|
941
|
+
const timestamps = new Map();
|
|
942
|
+
const timestampFacts = (source) => {
|
|
943
|
+
if (timestamps.has(source)) return timestamps.get(source);
|
|
944
|
+
const facts = parseHermesTimestamp(source);
|
|
945
|
+
timestamps.set(source, facts);
|
|
946
|
+
return facts;
|
|
947
|
+
};
|
|
948
|
+
const hermesTimestampTag = {
|
|
949
|
+
...timestampTag,
|
|
950
|
+
test: hermesTimestampImplicit,
|
|
951
|
+
resolve: (source) => {
|
|
952
|
+
const facts = timestampFacts(source);
|
|
953
|
+
if (facts === undefined) throw new Error(`Invalid Hermes YAML timestamp: ${source}`);
|
|
954
|
+
return facts.value;
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
const keyFacts = new WeakMap();
|
|
958
|
+
const hermesKey = (node) => {
|
|
959
|
+
const cached = keyFacts.get(node);
|
|
960
|
+
if (cached !== undefined) return cached;
|
|
961
|
+
if (!isScalar(node)) return {
|
|
962
|
+
kind: "other",
|
|
963
|
+
value: node
|
|
964
|
+
};
|
|
965
|
+
const numeric = numericValue(node.value);
|
|
966
|
+
const key = numeric !== undefined ? {
|
|
967
|
+
kind: "numeric",
|
|
968
|
+
value: numeric
|
|
969
|
+
} : node.value instanceof Date ? {
|
|
970
|
+
kind: "timestamp",
|
|
971
|
+
value: timestampFacts(node.source ?? "")?.key ?? `invalid:${node.source ?? ""}`
|
|
972
|
+
} : {
|
|
973
|
+
kind: "other",
|
|
974
|
+
value: node.value
|
|
975
|
+
};
|
|
976
|
+
keyFacts.set(node, key);
|
|
977
|
+
return key;
|
|
978
|
+
};
|
|
979
|
+
/** Python dict key equality is Hermes' duplicate-key behavior (bool is int). */
|
|
980
|
+
const hermesKeysEqual = (leftNode, rightNode) => {
|
|
981
|
+
const left = hermesKey(leftNode);
|
|
982
|
+
const right = hermesKey(rightNode);
|
|
983
|
+
if (left.kind !== right.kind) return false;
|
|
984
|
+
if (left.kind === "numeric" && right.kind === "numeric") return numericValuesEqual(left.value, right.value);
|
|
985
|
+
return left.value === right.value;
|
|
986
|
+
};
|
|
987
|
+
return {
|
|
988
|
+
version: "1.1",
|
|
989
|
+
intAsBigInt: true,
|
|
990
|
+
customTags: (tags) => {
|
|
991
|
+
const hasTimestamp = tags.some((tag) => typeof tag !== "string" && tag.tag === timestampTag.tag);
|
|
992
|
+
const withHermesTimestamp = hasTimestamp ? tags.map((tag) => typeof tag !== "string" && tag.tag === timestampTag.tag ? hermesTimestampTag : tag) : [...tags, hermesTimestampTag];
|
|
993
|
+
return withHermesTimestamp.map(keepScalarSource);
|
|
994
|
+
},
|
|
995
|
+
uniqueKeys: hermesKeysEqual
|
|
996
|
+
};
|
|
997
|
+
};
|
|
998
|
+
stringifyHermesConfigurationYaml = (document) => new Document(document, createHermesYamlOptions()).toString({ lineWidth: 0 });
|
|
999
|
+
isEmptyYamlRoot = (root) => root === null || isScalar(root) && root.value === null && root.source === "" && root.tag === undefined && root.anchor === undefined;
|
|
1000
|
+
parseHermesDocument = (text) => {
|
|
1001
|
+
const document = parseDocument(text, createHermesYamlOptions());
|
|
1002
|
+
const error = document.errors[0];
|
|
1003
|
+
if (error !== undefined) throw error;
|
|
1004
|
+
return document;
|
|
1005
|
+
};
|
|
1006
|
+
parseHermesConfigurationYaml = (text) => {
|
|
1007
|
+
const document = parseHermesDocument(text);
|
|
1008
|
+
return isEmptyYamlRoot(document.contents) ? {} : document.toJS({ reviver: (_key, value) => typeof value === "bigint" ? Number(value) : value });
|
|
1009
|
+
};
|
|
1010
|
+
retainHermesScalarSource = (previous, next) => {
|
|
1011
|
+
if (isScalar(previous) && isScalar(next) && previous.value === next.value) return previous;
|
|
1012
|
+
if (isMap(previous) && isMap(next)) {
|
|
1013
|
+
const entries = new Map(previous.items.flatMap((pair) => isScalar(pair.key) && typeof pair.key.value === "string" ? [[pair.key.value, pair]] : []));
|
|
1014
|
+
for (const pair of next.items) {
|
|
1015
|
+
const key = isScalar(pair.key) ? pair.key.value : undefined;
|
|
1016
|
+
const prior = typeof key === "string" ? entries.get(key) : undefined;
|
|
1017
|
+
if (prior === undefined) continue;
|
|
1018
|
+
pair.key = prior.key;
|
|
1019
|
+
if (isNode(pair.value)) pair.value = retainHermesScalarSource(prior.value, pair.value);
|
|
1020
|
+
}
|
|
1021
|
+
} else if (isSeq(previous) && isSeq(next)) {
|
|
1022
|
+
next.items = next.items.map((item, index) => isNode(item) ? retainHermesScalarSource(previous.items[index], item) : item);
|
|
1023
|
+
}
|
|
1024
|
+
return next;
|
|
1025
|
+
};
|
|
1026
|
+
editHermesConfigurationYaml = (text, path, value) => {
|
|
1027
|
+
const document = parseHermesDocument(text);
|
|
1028
|
+
const root = document.contents;
|
|
1029
|
+
if (isEmptyYamlRoot(root)) {
|
|
1030
|
+
const map = document.createNode({});
|
|
1031
|
+
if (isScalar(root)) map.commentBefore = [root.commentBefore, root.comment].filter((comment) => comment !== undefined).join("\n");
|
|
1032
|
+
document.contents = map;
|
|
1033
|
+
}
|
|
1034
|
+
if (value === undefined) document.deleteIn(path);
|
|
1035
|
+
else {
|
|
1036
|
+
for (let length = 1; length < path.length; length++) {
|
|
1037
|
+
const parent = path.slice(0, length);
|
|
1038
|
+
if (!document.hasIn(parent)) document.setIn(parent, document.createNode({}));
|
|
1039
|
+
}
|
|
1040
|
+
const previous = document.getIn(path, true);
|
|
1041
|
+
document.setIn(path, isMap(previous) || isSeq(previous) ? retainHermesScalarSource(previous, document.createNode(value)) : value);
|
|
1042
|
+
}
|
|
1043
|
+
return document.toString({
|
|
1044
|
+
lineWidth: 0,
|
|
1045
|
+
...document.directives?.yaml.version === "1.2" ? {
|
|
1046
|
+
defaultStringType: "QUOTE_DOUBLE",
|
|
1047
|
+
defaultKeyType: "QUOTE_DOUBLE"
|
|
1048
|
+
} : {}
|
|
1049
|
+
});
|
|
1050
|
+
};
|
|
1051
|
+
})))();
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
//#endregion
|
|
1055
|
+
//#region dist/application/ClientConfigurationDocument.js
|
|
1056
|
+
var objectSchema, clientConfigurationValuesEqual, normalizeConfigurationValue, clientConfigurationServersKey, isEmptyClientConfigurationText, INT64_MIN, INT64_MAX, parseClientToml, parseDocument$1, ClientConfigurationShapeError, requireObject, parseZcodeFallbackConfiguration, OPENCODE_V2_MCP_SETTINGS, parseClientConfiguration, effectiveClientServer, withClientServers, valueAt, TOML_BASIC_ESCAPES, skipHorizontalSpace, decodeBasicEscape, parseQuotedKey, parseBareKey, parseTomlTableHeader, tomlStringModeAfter, closeMultiline, isBlankOrComment, looksLikeTomlHeader, isTomlServerTable, parseKeyPath, parseAssignment, skipWsAndComments, endOfTomlValue, endOfContainer, tomlBasicString, tomlInlineKey, tomlInlineValue, readTrivia, commasOutsideComments, hasSeparatorComma, editInlineServerTable, rebuildInlineTable, rebuildDelimitedEntries, tomlStringValue, tomlArrayWithoutString, disabledServerListEdit, disabledServerListLines, withoutTrailingLineFeeds, upsertTomlServerSection, tomlServerEntry, grokServerListedDisabled, OMP_DISABLED_SERVERS_KEY, ompServerListedDisabled, OMP_ENABLED_SERVERS_KEY, clientServerForcedEnabled, clientServerListedDisabled, serializeGrokConfiguration, withoutEmptyServerTable, serializeCodexConfiguration, tomlTextHolds, JSON_COMMA, nextJsoncToken, isJsonMember, effectiveJsonProperty, applyFormattedJsonEdit, deleteJsonProperty, editJsonMember, serializeClientConfiguration, clientServerPath, legacyClientServerPath, serializeHermesConfiguration, clientRegistrationEntry, parseGeminiMcpPolicy, normalizeGeminiServerName, geminiServerPolicyBlock;
|
|
1057
|
+
function init_ClientConfigurationDocument() {
|
|
1058
|
+
return (init_ClientConfigurationDocument = __esmMin((() => {
|
|
1059
|
+
init_DshCordisPatch();
|
|
1060
|
+
init_HermesConfigurationYaml();
|
|
1061
|
+
init_result();
|
|
1062
|
+
init_identity();
|
|
1063
|
+
init_unicodeCodePointOrder();
|
|
1064
|
+
objectSchema = z.record(z.string(), z.unknown());
|
|
1065
|
+
clientConfigurationValuesEqual = (left, right) => isDeepStrictEqual(normalizeConfigurationValue(left), normalizeConfigurationValue(right));
|
|
1066
|
+
normalizeConfigurationValue = (value) => {
|
|
1067
|
+
if (Array.isArray(value)) return value.map(normalizeConfigurationValue);
|
|
1068
|
+
if (typeof value !== "object" || value === null || value instanceof Date) return value;
|
|
1069
|
+
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => compareUnicodeCodePoints(left, right)).map(([key, nested]) => [key, normalizeConfigurationValue(nested)]));
|
|
1070
|
+
};
|
|
1071
|
+
clientConfigurationServersKey = (format) => {
|
|
1072
|
+
switch (format) {
|
|
1073
|
+
case "toml":
|
|
1074
|
+
case "grok":
|
|
1075
|
+
case "hermes": return "mcp_servers";
|
|
1076
|
+
case "opencode":
|
|
1077
|
+
case "zcode": return "mcp";
|
|
1078
|
+
case "vscode": return "servers";
|
|
1079
|
+
default: return "mcpServers";
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
isEmptyClientConfigurationText = (text) => text.replace(/^\uFEFF/, "").trim() === "";
|
|
1083
|
+
INT64_MIN = -(2n ** 63n);
|
|
1084
|
+
INT64_MAX = 2n ** 63n - 1n;
|
|
1085
|
+
parseClientToml = (text) => {
|
|
1086
|
+
const parsed = parse$1(text, { integersAsBigInt: "asNeeded" });
|
|
1087
|
+
const pending = [parsed];
|
|
1088
|
+
for (let value = pending.pop(); value !== undefined; value = pending.pop()) {
|
|
1089
|
+
if (typeof value === "bigint") {
|
|
1090
|
+
if (value < INT64_MIN || value > INT64_MAX) throw new SyntaxError(`Invalid TOML document: integer ${String(value)} is outside the signed 64-bit range`);
|
|
1091
|
+
} else if (typeof value === "object" && value !== null && !(value instanceof Date)) for (const nested of Object.values(value)) pending.push(nested);
|
|
1092
|
+
}
|
|
1093
|
+
return parsed;
|
|
1094
|
+
};
|
|
1095
|
+
parseDocument$1 = (text, format) => {
|
|
1096
|
+
if (format === "toml" || format === "grok") return requireObject(parseClientToml(text), "The configuration root");
|
|
1097
|
+
if (format === "pi" || format === "kimi") {
|
|
1098
|
+
if (format === "kimi" && text.trim().length === 0) return {};
|
|
1099
|
+
return requireObject(JSON.parse(text), "The configuration root");
|
|
1100
|
+
}
|
|
1101
|
+
if (isEmptyClientConfigurationText(text)) return {};
|
|
1102
|
+
if (format === "hermes") return requireObject(parseHermesConfigurationYaml(text), "The configuration root");
|
|
1103
|
+
if (format === "zcode") return requireObject(JSON.parse(text), "The configuration root");
|
|
1104
|
+
if (format === "claude_code") return requireObject(JSON.parse(text.replace(/^\uFEFF/, "")), "The configuration root");
|
|
1105
|
+
const errors = [];
|
|
1106
|
+
const jsonText = text.startsWith("") ? ` ${text.slice(1)}` : text;
|
|
1107
|
+
const document = parse(jsonText, errors, { allowTrailingComma: true });
|
|
1108
|
+
const firstError = errors[0];
|
|
1109
|
+
if (firstError !== undefined) throw new SyntaxError(`Invalid JSON/JSONC at offset ${firstError.offset}: ${printParseErrorCode(firstError.error)}`);
|
|
1110
|
+
return requireObject(document, "The configuration root");
|
|
1111
|
+
};
|
|
1112
|
+
ClientConfigurationShapeError = class extends TypeError {};
|
|
1113
|
+
requireObject = (value, description) => {
|
|
1114
|
+
const parsed = objectSchema.safeParse(value);
|
|
1115
|
+
if (parsed.success) return parsed.data;
|
|
1116
|
+
throw new ClientConfigurationShapeError(`${description} must be an object`, { cause: parsed.error });
|
|
1117
|
+
};
|
|
1118
|
+
parseZcodeFallbackConfiguration = (text) => {
|
|
1119
|
+
const document = requireObject(JSON.parse(text), "ZCode fallback root");
|
|
1120
|
+
return {
|
|
1121
|
+
document,
|
|
1122
|
+
servers: document.mcpServers === undefined ? {} : requireObject(document.mcpServers, "ZCode fallback mcpServers"),
|
|
1123
|
+
serversPath: ["mcpServers"],
|
|
1124
|
+
dialect: "zcode_fallback",
|
|
1125
|
+
legacyServers: {}
|
|
1126
|
+
};
|
|
1127
|
+
};
|
|
1128
|
+
OPENCODE_V2_MCP_SETTINGS = new Set(["servers", "timeout"]);
|
|
1129
|
+
parseClientConfiguration = (text, format) => {
|
|
1130
|
+
if (format === undefined || format === "unsupported") throw new TypeError("client does not have a supported MCP config format");
|
|
1131
|
+
if (format === "zcode_fallback") return parseZcodeFallbackConfiguration(text);
|
|
1132
|
+
if (format === "dsh") return parseDshCordisDocument(text);
|
|
1133
|
+
const document = parseDocument$1(text, format);
|
|
1134
|
+
const serversKey = clientConfigurationServersKey(format);
|
|
1135
|
+
const value = document[serversKey];
|
|
1136
|
+
const servers = value === undefined ? {} : requireObject(value, `"${serversKey}"`);
|
|
1137
|
+
if (format === "zcode") {
|
|
1138
|
+
const nested = servers.servers;
|
|
1139
|
+
return {
|
|
1140
|
+
document,
|
|
1141
|
+
servers: nested === undefined ? {} : requireObject(nested, `"${serversKey}.servers"`),
|
|
1142
|
+
serversPath: [serversKey, "servers"],
|
|
1143
|
+
dialect: format,
|
|
1144
|
+
legacyServers: {}
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
const native = servers.servers;
|
|
1148
|
+
if (format !== "opencode" || native === undefined || typeof native === "object" && native !== null && "type" in native && typeof native.type === "string") return {
|
|
1149
|
+
document,
|
|
1150
|
+
servers,
|
|
1151
|
+
serversPath: [serversKey],
|
|
1152
|
+
dialect: format,
|
|
1153
|
+
legacyServers: {}
|
|
1154
|
+
};
|
|
1155
|
+
return {
|
|
1156
|
+
document,
|
|
1157
|
+
servers: requireObject(native, `"${serversKey}.servers"`),
|
|
1158
|
+
serversPath: [serversKey, "servers"],
|
|
1159
|
+
dialect: "opencode_v2",
|
|
1160
|
+
legacyServers: Object.fromEntries(Object.entries(servers).filter(([name]) => !OPENCODE_V2_MCP_SETTINGS.has(name)))
|
|
1161
|
+
};
|
|
1162
|
+
};
|
|
1163
|
+
effectiveClientServer = (parsed, name) => Object.hasOwn(parsed.servers, name) ? parsed.servers[name] : parsed.legacyServers[name];
|
|
1164
|
+
withClientServers = (parsed, servers, removeLegacy) => {
|
|
1165
|
+
if (parsed.dialect === "dsh") return Object.hasOwn(servers, PRODUCT_IDENTITY.mcpServerKey) ? editDshDocument(parsed, objectSchema.parse(servers[PRODUCT_IDENTITY.mcpServerKey])) : editDshDocument(parsed);
|
|
1166
|
+
const [key = "", nested] = parsed.serversPath;
|
|
1167
|
+
if (nested === undefined) return {
|
|
1168
|
+
...parsed.document,
|
|
1169
|
+
[key]: servers
|
|
1170
|
+
};
|
|
1171
|
+
const outerValue = parsed.document[key];
|
|
1172
|
+
const outer = outerValue === undefined ? {} : { ...objectSchema.parse(outerValue) };
|
|
1173
|
+
if (parsed.dialect === "opencode_v2" && removeLegacy !== undefined && !OPENCODE_V2_MCP_SETTINGS.has(removeLegacy)) delete outer[removeLegacy];
|
|
1174
|
+
return {
|
|
1175
|
+
...parsed.document,
|
|
1176
|
+
[key]: {
|
|
1177
|
+
...outer,
|
|
1178
|
+
[nested]: servers
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
};
|
|
1182
|
+
valueAt = (document, path) => {
|
|
1183
|
+
let current = document;
|
|
1184
|
+
for (const key of path) {
|
|
1185
|
+
const object = objectSchema.safeParse(current);
|
|
1186
|
+
if (!object.success || !Object.hasOwn(object.data, key)) return undefined;
|
|
1187
|
+
current = object.data[key];
|
|
1188
|
+
}
|
|
1189
|
+
return current;
|
|
1190
|
+
};
|
|
1191
|
+
TOML_BASIC_ESCAPES = {
|
|
1192
|
+
b: "\b",
|
|
1193
|
+
t: " ",
|
|
1194
|
+
n: "\n",
|
|
1195
|
+
f: "\f",
|
|
1196
|
+
r: "\r",
|
|
1197
|
+
e: "\x1B",
|
|
1198
|
+
"\"": "\"",
|
|
1199
|
+
"\\": "\\"
|
|
1200
|
+
};
|
|
1201
|
+
skipHorizontalSpace = (line, index) => {
|
|
1202
|
+
let next = index;
|
|
1203
|
+
while (line[next] === " " || line[next] === " ") next += 1;
|
|
1204
|
+
return next;
|
|
1205
|
+
};
|
|
1206
|
+
decodeBasicEscape = (line, slash) => {
|
|
1207
|
+
const escape = line[slash + 1];
|
|
1208
|
+
if (escape === undefined) return undefined;
|
|
1209
|
+
const simple = TOML_BASIC_ESCAPES[escape];
|
|
1210
|
+
if (simple !== undefined) return {
|
|
1211
|
+
value: simple,
|
|
1212
|
+
next: slash + 2
|
|
1213
|
+
};
|
|
1214
|
+
if (escape === "x") {
|
|
1215
|
+
const hex = line.slice(slash + 2, slash + 4);
|
|
1216
|
+
if (!/^[0-9A-Fa-f]{2}$/u.test(hex)) return undefined;
|
|
1217
|
+
return {
|
|
1218
|
+
value: String.fromCodePoint(Number.parseInt(hex, 16)),
|
|
1219
|
+
next: slash + 4
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
if (escape !== "u" && escape !== "U") return undefined;
|
|
1223
|
+
const length = escape === "u" ? 4 : 8;
|
|
1224
|
+
const hex = line.slice(slash + 2, slash + 2 + length);
|
|
1225
|
+
if (!new RegExp(`^[0-9A-Fa-f]{${String(length)}}$`, "u").test(hex)) return undefined;
|
|
1226
|
+
const code = Number.parseInt(hex, 16);
|
|
1227
|
+
if (code > 1114111 || code >= 55296 && code <= 57343) return undefined;
|
|
1228
|
+
return {
|
|
1229
|
+
value: String.fromCodePoint(code),
|
|
1230
|
+
next: slash + 2 + length
|
|
1231
|
+
};
|
|
1232
|
+
};
|
|
1233
|
+
parseQuotedKey = (line, start) => {
|
|
1234
|
+
const quote = line[start];
|
|
1235
|
+
if (quote !== "\"" && quote !== "'" || line.startsWith(quote === "\"" ? "\"\"\"" : "'''", start)) return undefined;
|
|
1236
|
+
if (quote === "'") {
|
|
1237
|
+
const end = line.indexOf("'", start + 1);
|
|
1238
|
+
if (end < 0 || line.slice(start + 1, end).includes("\n")) return undefined;
|
|
1239
|
+
return {
|
|
1240
|
+
value: line.slice(start + 1, end),
|
|
1241
|
+
next: end + 1
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
let value = "";
|
|
1245
|
+
let index = start + 1;
|
|
1246
|
+
while (index < line.length) {
|
|
1247
|
+
const char = line[index];
|
|
1248
|
+
if (char === "\n" || char === "\r") return undefined;
|
|
1249
|
+
if (char === "\"") return {
|
|
1250
|
+
value,
|
|
1251
|
+
next: index + 1
|
|
1252
|
+
};
|
|
1253
|
+
if (char !== "\\") {
|
|
1254
|
+
value += char ?? "";
|
|
1255
|
+
index += 1;
|
|
1256
|
+
continue;
|
|
1257
|
+
}
|
|
1258
|
+
const decoded = decodeBasicEscape(line, index);
|
|
1259
|
+
if (decoded === undefined) return undefined;
|
|
1260
|
+
value += decoded.value;
|
|
1261
|
+
index = decoded.next;
|
|
1262
|
+
}
|
|
1263
|
+
return undefined;
|
|
1264
|
+
};
|
|
1265
|
+
parseBareKey = (line, start) => {
|
|
1266
|
+
let index = start;
|
|
1267
|
+
while (/[A-Za-z0-9_-]/u.test(line[index] ?? "")) index += 1;
|
|
1268
|
+
if (index === start) return undefined;
|
|
1269
|
+
return {
|
|
1270
|
+
value: line.slice(start, index),
|
|
1271
|
+
next: index
|
|
1272
|
+
};
|
|
1273
|
+
};
|
|
1274
|
+
parseTomlTableHeader = (line) => {
|
|
1275
|
+
let index = skipHorizontalSpace(line, 0);
|
|
1276
|
+
const array = line.startsWith("[[", index);
|
|
1277
|
+
if (!array && line[index] !== "[") return undefined;
|
|
1278
|
+
index += array ? 2 : 1;
|
|
1279
|
+
const path = [];
|
|
1280
|
+
for (;;) {
|
|
1281
|
+
index = skipHorizontalSpace(line, index);
|
|
1282
|
+
const key = line[index] === "\"" || line[index] === "'" ? parseQuotedKey(line, index) : parseBareKey(line, index);
|
|
1283
|
+
if (key === undefined) return undefined;
|
|
1284
|
+
path.push(key.value);
|
|
1285
|
+
index = skipHorizontalSpace(line, key.next);
|
|
1286
|
+
if (line[index] !== ".") break;
|
|
1287
|
+
index += 1;
|
|
1288
|
+
}
|
|
1289
|
+
const close = array ? "]]" : "]";
|
|
1290
|
+
if (!line.startsWith(close, index)) return undefined;
|
|
1291
|
+
index = skipHorizontalSpace(line, index + close.length);
|
|
1292
|
+
if (index < line.length && line[index] !== "#") return undefined;
|
|
1293
|
+
return { path };
|
|
1294
|
+
};
|
|
1295
|
+
tomlStringModeAfter = (line, mode, start = 0) => {
|
|
1296
|
+
if (mode === "ml-basic" || mode === "ml-literal") {
|
|
1297
|
+
const delimiter = mode === "ml-basic" ? "\"\"\"" : "'''";
|
|
1298
|
+
const closed = closeMultiline(line, start, delimiter, mode === "ml-basic");
|
|
1299
|
+
if (closed === undefined) return mode;
|
|
1300
|
+
return tomlStringModeAfter(line, "none", closed);
|
|
1301
|
+
}
|
|
1302
|
+
let index = start;
|
|
1303
|
+
while (index < line.length) {
|
|
1304
|
+
if (line[index] === "#") return "none";
|
|
1305
|
+
if (line.startsWith("\"\"\"", index)) {
|
|
1306
|
+
const closed = closeMultiline(line, index + 3, "\"\"\"", true);
|
|
1307
|
+
if (closed === undefined) return "ml-basic";
|
|
1308
|
+
index = closed;
|
|
1309
|
+
continue;
|
|
1310
|
+
}
|
|
1311
|
+
if (line.startsWith("'''", index)) {
|
|
1312
|
+
const closed = closeMultiline(line, index + 3, "'''", false);
|
|
1313
|
+
if (closed === undefined) return "ml-literal";
|
|
1314
|
+
index = closed;
|
|
1315
|
+
continue;
|
|
1316
|
+
}
|
|
1317
|
+
const quote = line[index];
|
|
1318
|
+
if (quote === "\"" || quote === "'") {
|
|
1319
|
+
const quoted = parseQuotedKey(line, index);
|
|
1320
|
+
if (quoted === undefined) return "none";
|
|
1321
|
+
index = quoted.next;
|
|
1322
|
+
continue;
|
|
1323
|
+
}
|
|
1324
|
+
index += 1;
|
|
1325
|
+
}
|
|
1326
|
+
return "none";
|
|
1327
|
+
};
|
|
1328
|
+
closeMultiline = (line, start, delimiter, escapes) => {
|
|
1329
|
+
let index = start;
|
|
1330
|
+
while (index < line.length) {
|
|
1331
|
+
if (escapes && line[index] === "\\") {
|
|
1332
|
+
if (line[index + 1] === undefined) return undefined;
|
|
1333
|
+
index += 2;
|
|
1334
|
+
continue;
|
|
1335
|
+
}
|
|
1336
|
+
if (line.startsWith(delimiter, index)) {
|
|
1337
|
+
let end = index + delimiter.length;
|
|
1338
|
+
const quote = delimiter[0];
|
|
1339
|
+
let extra = 0;
|
|
1340
|
+
while (extra < 2 && line[end] === quote) {
|
|
1341
|
+
extra += 1;
|
|
1342
|
+
end += 1;
|
|
1343
|
+
}
|
|
1344
|
+
return end;
|
|
1345
|
+
}
|
|
1346
|
+
index += 1;
|
|
1347
|
+
}
|
|
1348
|
+
return undefined;
|
|
1349
|
+
};
|
|
1350
|
+
isBlankOrComment = (line) => {
|
|
1351
|
+
const trimmed = line.trimStart();
|
|
1352
|
+
return trimmed === "" || trimmed.startsWith("#");
|
|
1353
|
+
};
|
|
1354
|
+
looksLikeTomlHeader = (line) => line.trimStart().startsWith("[");
|
|
1355
|
+
isTomlServerTable = (path, serverKey) => path[0] === "mcp_servers" && path[1] === serverKey;
|
|
1356
|
+
parseKeyPath = (text, start) => {
|
|
1357
|
+
const segments = [];
|
|
1358
|
+
let index = start;
|
|
1359
|
+
for (;;) {
|
|
1360
|
+
index = skipHorizontalSpace(text, index);
|
|
1361
|
+
const current = text[index];
|
|
1362
|
+
if (current === undefined || current === "\n" || current === "\r") return undefined;
|
|
1363
|
+
const key = current === "\"" || current === "'" ? parseQuotedKey(text, index) : parseBareKey(text, index);
|
|
1364
|
+
if (key === undefined) return undefined;
|
|
1365
|
+
segments.push(key.value);
|
|
1366
|
+
index = skipHorizontalSpace(text, key.next);
|
|
1367
|
+
if (text[index] !== ".") return {
|
|
1368
|
+
segments,
|
|
1369
|
+
next: index
|
|
1370
|
+
};
|
|
1371
|
+
index += 1;
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
parseAssignment = (line) => {
|
|
1375
|
+
const key = parseKeyPath(line, 0);
|
|
1376
|
+
if (key === undefined) return undefined;
|
|
1377
|
+
const equals = skipHorizontalSpace(line, key.next);
|
|
1378
|
+
if (line[equals] !== "=") return undefined;
|
|
1379
|
+
return {
|
|
1380
|
+
segments: key.segments,
|
|
1381
|
+
equals
|
|
1382
|
+
};
|
|
1383
|
+
};
|
|
1384
|
+
skipWsAndComments = (text, start) => {
|
|
1385
|
+
let index = start;
|
|
1386
|
+
while (index < text.length) {
|
|
1387
|
+
const char = text[index];
|
|
1388
|
+
if (char === " " || char === " " || char === "\n" || char === "\r") {
|
|
1389
|
+
index += 1;
|
|
1390
|
+
continue;
|
|
1391
|
+
}
|
|
1392
|
+
if (char === "#") {
|
|
1393
|
+
while (index < text.length && text[index] !== "\n") index += 1;
|
|
1394
|
+
continue;
|
|
1395
|
+
}
|
|
1396
|
+
return index;
|
|
1397
|
+
}
|
|
1398
|
+
return index;
|
|
1399
|
+
};
|
|
1400
|
+
endOfTomlValue = (text, start) => {
|
|
1401
|
+
const index = skipWsAndComments(text, start);
|
|
1402
|
+
if (index >= text.length) return index;
|
|
1403
|
+
if (text.startsWith("\"\"\"", index)) {
|
|
1404
|
+
const closed = closeMultiline(text, index + 3, "\"\"\"", true);
|
|
1405
|
+
return closed ?? text.length;
|
|
1406
|
+
}
|
|
1407
|
+
if (text.startsWith("'''", index)) {
|
|
1408
|
+
const closed = closeMultiline(text, index + 3, "'''", false);
|
|
1409
|
+
return closed ?? text.length;
|
|
1410
|
+
}
|
|
1411
|
+
const quote = text[index];
|
|
1412
|
+
if (quote === "\"" || quote === "'") {
|
|
1413
|
+
const quoted = parseQuotedKey(text, index);
|
|
1414
|
+
return quoted === undefined ? text.length : quoted.next;
|
|
1415
|
+
}
|
|
1416
|
+
if (quote === "{" || quote === "[") return endOfContainer(text, index);
|
|
1417
|
+
let cursor = index;
|
|
1418
|
+
while (cursor < text.length) {
|
|
1419
|
+
const char = text[cursor];
|
|
1420
|
+
if (char === "\n" || char === "#" || char === "," || char === "}" || char === "]") break;
|
|
1421
|
+
cursor += 1;
|
|
1422
|
+
}
|
|
1423
|
+
return cursor;
|
|
1424
|
+
};
|
|
1425
|
+
endOfContainer = (text, open) => {
|
|
1426
|
+
const closers = [text[open] === "{" ? "}" : "]"];
|
|
1427
|
+
let index = open + 1;
|
|
1428
|
+
while (index < text.length && closers.length > 0) {
|
|
1429
|
+
if (text.startsWith("\"\"\"", index)) {
|
|
1430
|
+
const closed = closeMultiline(text, index + 3, "\"\"\"", true);
|
|
1431
|
+
if (closed === undefined) return text.length;
|
|
1432
|
+
index = closed;
|
|
1433
|
+
continue;
|
|
1434
|
+
}
|
|
1435
|
+
if (text.startsWith("'''", index)) {
|
|
1436
|
+
const closed = closeMultiline(text, index + 3, "'''", false);
|
|
1437
|
+
if (closed === undefined) return text.length;
|
|
1438
|
+
index = closed;
|
|
1439
|
+
continue;
|
|
1440
|
+
}
|
|
1441
|
+
const quote = text[index];
|
|
1442
|
+
if (quote === "\"" || quote === "'") {
|
|
1443
|
+
const quoted = parseQuotedKey(text, index);
|
|
1444
|
+
if (quoted === undefined) return text.length;
|
|
1445
|
+
index = quoted.next;
|
|
1446
|
+
continue;
|
|
1447
|
+
}
|
|
1448
|
+
if (quote === "#") {
|
|
1449
|
+
while (index < text.length && text[index] !== "\n") index += 1;
|
|
1450
|
+
continue;
|
|
1451
|
+
}
|
|
1452
|
+
if (quote === "{" || quote === "[") {
|
|
1453
|
+
closers.push(quote === "{" ? "}" : "]");
|
|
1454
|
+
index += 1;
|
|
1455
|
+
continue;
|
|
1456
|
+
}
|
|
1457
|
+
if (quote === closers[closers.length - 1]) {
|
|
1458
|
+
closers.pop();
|
|
1459
|
+
index += 1;
|
|
1460
|
+
continue;
|
|
1461
|
+
}
|
|
1462
|
+
index += 1;
|
|
1463
|
+
}
|
|
1464
|
+
return index;
|
|
1465
|
+
};
|
|
1466
|
+
tomlBasicString = (value) => JSON.stringify(value).replaceAll("", "\\u007f");
|
|
1467
|
+
tomlInlineKey = (key) => /^[A-Za-z0-9_-]+$/u.test(key) ? key : tomlBasicString(key);
|
|
1468
|
+
tomlInlineValue = (value) => {
|
|
1469
|
+
if (typeof value === "string") return tomlBasicString(value);
|
|
1470
|
+
if (typeof value === "boolean") return value ? "true" : "false";
|
|
1471
|
+
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
|
1472
|
+
if (typeof value === "bigint") return String(value);
|
|
1473
|
+
if (Array.isArray(value)) return `[${value.map((item) => tomlInlineValue(item)).join(", ")}]`;
|
|
1474
|
+
if (typeof value === "object" && value !== null) {
|
|
1475
|
+
const body = Object.entries(value).map(([key, nested]) => `${tomlInlineKey(key)} = ${tomlInlineValue(nested)}`).join(", ");
|
|
1476
|
+
return `{ ${body} }`;
|
|
1477
|
+
}
|
|
1478
|
+
return "\"\"";
|
|
1479
|
+
};
|
|
1480
|
+
readTrivia = (text, start, limit) => {
|
|
1481
|
+
let index = start;
|
|
1482
|
+
while (index < limit) {
|
|
1483
|
+
const char = text[index];
|
|
1484
|
+
if (char === " " || char === " " || char === "\n" || char === "\r" || char === ",") {
|
|
1485
|
+
index += 1;
|
|
1486
|
+
continue;
|
|
1487
|
+
}
|
|
1488
|
+
if (char === "#") {
|
|
1489
|
+
while (index < limit && text[index] !== "\n") index += 1;
|
|
1490
|
+
continue;
|
|
1491
|
+
}
|
|
1492
|
+
break;
|
|
1493
|
+
}
|
|
1494
|
+
return {
|
|
1495
|
+
text: text.slice(start, index),
|
|
1496
|
+
next: index
|
|
1497
|
+
};
|
|
1498
|
+
};
|
|
1499
|
+
commasOutsideComments = (trivia) => trivia.split("\n").map((part) => {
|
|
1500
|
+
const comment = part.indexOf("#");
|
|
1501
|
+
if (comment < 0) return part.replaceAll(",", "");
|
|
1502
|
+
return `${part.slice(0, comment).replaceAll(",", "")}${part.slice(comment)}`;
|
|
1503
|
+
}).join("\n");
|
|
1504
|
+
hasSeparatorComma = (trivia) => trivia.split("\n").some((part) => {
|
|
1505
|
+
const comment = part.indexOf("#");
|
|
1506
|
+
const code = comment < 0 ? part : part.slice(0, comment);
|
|
1507
|
+
return code.includes(",");
|
|
1508
|
+
});
|
|
1509
|
+
editInlineServerTable = (table, serverKey, entry) => {
|
|
1510
|
+
if (!table.startsWith("{")) return undefined;
|
|
1511
|
+
const end = endOfContainer(table, 0);
|
|
1512
|
+
if (table[end - 1] !== "}") return undefined;
|
|
1513
|
+
const pairs = [];
|
|
1514
|
+
let index = 1;
|
|
1515
|
+
let trailing = "";
|
|
1516
|
+
while (index < end - 1) {
|
|
1517
|
+
const trivia = readTrivia(table, index, end - 1);
|
|
1518
|
+
if (trivia.next >= end - 1) {
|
|
1519
|
+
trailing = trivia.text;
|
|
1520
|
+
break;
|
|
1521
|
+
}
|
|
1522
|
+
const key = parseKeyPath(table, trivia.next);
|
|
1523
|
+
if (key === undefined) return undefined;
|
|
1524
|
+
const equals = skipWsAndComments(table, key.next);
|
|
1525
|
+
if (table[equals] !== "=") return undefined;
|
|
1526
|
+
const valueEnd = endOfTomlValue(table, equals + 1);
|
|
1527
|
+
if (valueEnd > end - 1) return undefined;
|
|
1528
|
+
pairs.push({
|
|
1529
|
+
leading: trivia.text,
|
|
1530
|
+
text: table.slice(trivia.next, valueEnd),
|
|
1531
|
+
drop: key.segments[0] === serverKey
|
|
1532
|
+
});
|
|
1533
|
+
index = valueEnd;
|
|
1534
|
+
}
|
|
1535
|
+
const insertion = entry === undefined ? undefined : `${tomlInlineKey(serverKey)} = ${tomlInlineValue(entry)}`;
|
|
1536
|
+
if (insertion === undefined && pairs.every((pair) => !pair.drop)) return table;
|
|
1537
|
+
return rebuildInlineTable(pairs, trailing, insertion);
|
|
1538
|
+
};
|
|
1539
|
+
rebuildInlineTable = (pairs, trailing, insertion) => rebuildDelimitedEntries(pairs, trailing, insertion, "{", "}");
|
|
1540
|
+
rebuildDelimitedEntries = (pairs, trailing, insertion, open, close) => {
|
|
1541
|
+
const parts = [open];
|
|
1542
|
+
let emitted = false;
|
|
1543
|
+
let separatorPending = false;
|
|
1544
|
+
for (const pair of pairs) {
|
|
1545
|
+
if (pair.drop) {
|
|
1546
|
+
if (!pair.leading.includes("#")) continue;
|
|
1547
|
+
const dropped = !emitted || separatorPending ? commasOutsideComments(pair.leading) : pair.leading;
|
|
1548
|
+
parts.push(dropped);
|
|
1549
|
+
separatorPending = separatorPending || hasSeparatorComma(dropped);
|
|
1550
|
+
continue;
|
|
1551
|
+
}
|
|
1552
|
+
const kept = emitted ? pair.leading : commasOutsideComments(pair.leading);
|
|
1553
|
+
parts.push(separatorPending ? commasOutsideComments(kept) : kept);
|
|
1554
|
+
if (emitted && !separatorPending && !pair.leading.includes(",")) parts.push(", ");
|
|
1555
|
+
separatorPending = false;
|
|
1556
|
+
parts.push(pair.text);
|
|
1557
|
+
emitted = true;
|
|
1558
|
+
}
|
|
1559
|
+
if (insertion !== undefined) {
|
|
1560
|
+
if (!(emitted && separatorPending)) parts.push(emitted ? ", " : " ");
|
|
1561
|
+
parts.push(insertion);
|
|
1562
|
+
emitted = true;
|
|
1563
|
+
}
|
|
1564
|
+
if (!emitted) {
|
|
1565
|
+
const retained = `${parts.slice(1).join("")}${commasOutsideComments(trailing)}`;
|
|
1566
|
+
return retained.includes("#") ? `${open}${retained}${close}` : `${open}${close}`;
|
|
1567
|
+
}
|
|
1568
|
+
const tail = commasOutsideComments(trailing);
|
|
1569
|
+
parts.push(tail);
|
|
1570
|
+
if (tail === "" && open === "{") parts.push(" ");
|
|
1571
|
+
parts.push(close);
|
|
1572
|
+
return parts.join("");
|
|
1573
|
+
};
|
|
1574
|
+
tomlStringValue = (text) => {
|
|
1575
|
+
try {
|
|
1576
|
+
const value = parseClientToml(`value = ${text}`)["value"];
|
|
1577
|
+
return typeof value === "string" ? value : undefined;
|
|
1578
|
+
} catch (cause) {
|
|
1579
|
+
void cause;
|
|
1580
|
+
return undefined;
|
|
1581
|
+
}
|
|
1582
|
+
};
|
|
1583
|
+
tomlArrayWithoutString = (array, serverKey) => {
|
|
1584
|
+
if (!array.startsWith("[")) return undefined;
|
|
1585
|
+
const end = endOfContainer(array, 0);
|
|
1586
|
+
if (end !== array.length || array[end - 1] !== "]") return undefined;
|
|
1587
|
+
const pairs = [];
|
|
1588
|
+
let index = 1;
|
|
1589
|
+
let trailing = "";
|
|
1590
|
+
while (index < end - 1) {
|
|
1591
|
+
const trivia = readTrivia(array, index, end - 1);
|
|
1592
|
+
if (trivia.next >= end - 1) {
|
|
1593
|
+
trailing = trivia.text;
|
|
1594
|
+
break;
|
|
1595
|
+
}
|
|
1596
|
+
const valueEnd = endOfTomlValue(array, trivia.next);
|
|
1597
|
+
if (valueEnd > end - 1) return undefined;
|
|
1598
|
+
const text = array.slice(trivia.next, valueEnd);
|
|
1599
|
+
pairs.push({
|
|
1600
|
+
leading: trivia.text,
|
|
1601
|
+
text,
|
|
1602
|
+
drop: tomlStringValue(text) === serverKey
|
|
1603
|
+
});
|
|
1604
|
+
index = valueEnd;
|
|
1605
|
+
}
|
|
1606
|
+
if (pairs.every((pair) => !pair.drop)) return array;
|
|
1607
|
+
const rebuilt = rebuildDelimitedEntries(pairs, trailing, undefined, "[", "]");
|
|
1608
|
+
return rebuilt === "[]" ? "" : rebuilt;
|
|
1609
|
+
};
|
|
1610
|
+
disabledServerListEdit = (input) => {
|
|
1611
|
+
if (input.entry === undefined || input.tablePath.length !== 0 || input.segments.length !== 1 || input.segments[0] !== "disabled_mcp_servers") return { kind: "ignore" };
|
|
1612
|
+
const open = skipWsAndComments(input.text, input.valueOffset);
|
|
1613
|
+
if (input.text[open] !== "[") return { kind: "ignore" };
|
|
1614
|
+
const arrayText = input.text.slice(open, input.valueEnd);
|
|
1615
|
+
const edited = tomlArrayWithoutString(arrayText, input.serverKey);
|
|
1616
|
+
if (edited === undefined || edited === arrayText) return { kind: "keep" };
|
|
1617
|
+
if (edited === "") {
|
|
1618
|
+
const suffix = input.text.slice(input.valueEnd, input.statementEnd);
|
|
1619
|
+
const hash = suffix.indexOf("#");
|
|
1620
|
+
return {
|
|
1621
|
+
kind: "delete",
|
|
1622
|
+
comment: hash < 0 ? undefined : suffix.slice(hash)
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
return {
|
|
1626
|
+
kind: "replace",
|
|
1627
|
+
text: `${input.text.slice(input.lineStart, open)}${edited}${input.text.slice(input.valueEnd, input.statementEnd)}`
|
|
1628
|
+
};
|
|
1629
|
+
};
|
|
1630
|
+
disabledServerListLines = (edit, lines, lineIndex, endLine) => {
|
|
1631
|
+
switch (edit.kind) {
|
|
1632
|
+
case "ignore": return undefined;
|
|
1633
|
+
case "keep": return lines.slice(lineIndex, endLine + 1);
|
|
1634
|
+
case "replace": return edit.text.split("\n");
|
|
1635
|
+
case "delete": return edit.comment === undefined ? [] : [edit.comment];
|
|
1636
|
+
default: {
|
|
1637
|
+
const unreachable = edit;
|
|
1638
|
+
return unreachable;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
withoutTrailingLineFeeds = (text) => {
|
|
1643
|
+
let end = text.length;
|
|
1644
|
+
while (end > 0 && text.charCodeAt(end - 1) === 10) end -= 1;
|
|
1645
|
+
return text.slice(0, end);
|
|
1646
|
+
};
|
|
1647
|
+
upsertTomlServerSection = (originalText, serverKey, entry, format) => {
|
|
1648
|
+
const bom = originalText.startsWith("");
|
|
1649
|
+
const source = bom ? originalText.slice(1) : originalText;
|
|
1650
|
+
const crlf = source.includes("\r\n") && !source.replaceAll("\r\n", "").includes("\n");
|
|
1651
|
+
const text = source;
|
|
1652
|
+
const lines = text.split("\n");
|
|
1653
|
+
const lineStarts = [];
|
|
1654
|
+
let cursor = 0;
|
|
1655
|
+
for (const line of lines) {
|
|
1656
|
+
lineStarts.push(cursor);
|
|
1657
|
+
cursor += line.length + 1;
|
|
1658
|
+
}
|
|
1659
|
+
const kept = [];
|
|
1660
|
+
const pending = [];
|
|
1661
|
+
let skipping = false;
|
|
1662
|
+
let inlineServerTable = false;
|
|
1663
|
+
let mode = "none";
|
|
1664
|
+
let tablePath = [];
|
|
1665
|
+
const discardPending = () => {
|
|
1666
|
+
pending.length = 0;
|
|
1667
|
+
};
|
|
1668
|
+
const appendLines = (lines) => {
|
|
1669
|
+
for (const line of lines) kept.push(line);
|
|
1670
|
+
};
|
|
1671
|
+
const flushPending = () => {
|
|
1672
|
+
appendLines(pending);
|
|
1673
|
+
pending.length = 0;
|
|
1674
|
+
};
|
|
1675
|
+
let lineIndex = 0;
|
|
1676
|
+
while (lineIndex < lines.length) {
|
|
1677
|
+
const physical = lines[lineIndex] ?? "";
|
|
1678
|
+
const line = physical.endsWith("\r") ? physical.slice(0, -1) : physical;
|
|
1679
|
+
if (mode !== "none") {
|
|
1680
|
+
mode = tomlStringModeAfter(line, mode);
|
|
1681
|
+
if (skipping) discardPending();
|
|
1682
|
+
else kept.push(physical);
|
|
1683
|
+
lineIndex += 1;
|
|
1684
|
+
continue;
|
|
1685
|
+
}
|
|
1686
|
+
const header = parseTomlTableHeader(line);
|
|
1687
|
+
if (header !== undefined) {
|
|
1688
|
+
tablePath = header.path;
|
|
1689
|
+
if (isTomlServerTable(header.path, serverKey)) {
|
|
1690
|
+
discardPending();
|
|
1691
|
+
skipping = true;
|
|
1692
|
+
lineIndex += 1;
|
|
1693
|
+
continue;
|
|
1694
|
+
}
|
|
1695
|
+
skipping = false;
|
|
1696
|
+
flushPending();
|
|
1697
|
+
kept.push(physical);
|
|
1698
|
+
lineIndex += 1;
|
|
1699
|
+
continue;
|
|
1700
|
+
}
|
|
1701
|
+
const assignment = parseAssignment(line);
|
|
1702
|
+
if (assignment !== undefined) {
|
|
1703
|
+
const lineStart = lineStarts[lineIndex] ?? 0;
|
|
1704
|
+
const valueOffset = lineStart + assignment.equals + 1;
|
|
1705
|
+
const valueEnd = endOfTomlValue(text, valueOffset);
|
|
1706
|
+
let statementEnd = valueEnd;
|
|
1707
|
+
while (statementEnd < text.length && text[statementEnd] !== "\n") statementEnd += 1;
|
|
1708
|
+
const lastOffset = Math.max(statementEnd - 1, lineStart);
|
|
1709
|
+
let endLine = lineIndex;
|
|
1710
|
+
while (endLine + 1 < lineStarts.length && (lineStarts[endLine + 1] ?? 0) <= lastOffset) endLine += 1;
|
|
1711
|
+
if (skipping) {
|
|
1712
|
+
discardPending();
|
|
1713
|
+
lineIndex = endLine + 1;
|
|
1714
|
+
mode = "none";
|
|
1715
|
+
continue;
|
|
1716
|
+
}
|
|
1717
|
+
const disabledLines = format === "grok" ? disabledServerListLines(disabledServerListEdit({
|
|
1718
|
+
text,
|
|
1719
|
+
lineStart,
|
|
1720
|
+
valueOffset,
|
|
1721
|
+
valueEnd,
|
|
1722
|
+
statementEnd,
|
|
1723
|
+
tablePath,
|
|
1724
|
+
segments: assignment.segments,
|
|
1725
|
+
serverKey,
|
|
1726
|
+
entry
|
|
1727
|
+
}), lines, lineIndex, endLine) : undefined;
|
|
1728
|
+
if (disabledLines !== undefined) {
|
|
1729
|
+
flushPending();
|
|
1730
|
+
appendLines(disabledLines);
|
|
1731
|
+
lineIndex = endLine + 1;
|
|
1732
|
+
mode = "none";
|
|
1733
|
+
continue;
|
|
1734
|
+
}
|
|
1735
|
+
const absolute = [...tablePath, ...assignment.segments];
|
|
1736
|
+
const open = skipWsAndComments(text, valueOffset);
|
|
1737
|
+
const closesServerTable = absolute.length === 1 && absolute[0] === "mcp_servers" && text[open] === "{";
|
|
1738
|
+
if (closesServerTable || isTomlServerTable(absolute, serverKey)) {
|
|
1739
|
+
if (closesServerTable) {
|
|
1740
|
+
flushPending();
|
|
1741
|
+
const edited = editInlineServerTable(text.slice(open, valueEnd), serverKey, entry);
|
|
1742
|
+
const prefix = text.slice(lineStart, open);
|
|
1743
|
+
const suffix = text.slice(valueEnd, statementEnd);
|
|
1744
|
+
const replacement = edited === undefined ? text.slice(lineStart, statementEnd) : `${prefix}${edited}${suffix}`;
|
|
1745
|
+
appendLines(replacement.split("\n"));
|
|
1746
|
+
inlineServerTable = true;
|
|
1747
|
+
} else discardPending();
|
|
1748
|
+
} else {
|
|
1749
|
+
flushPending();
|
|
1750
|
+
for (let index = lineIndex; index <= endLine; index += 1) kept.push(lines[index] ?? "");
|
|
1751
|
+
}
|
|
1752
|
+
lineIndex = endLine + 1;
|
|
1753
|
+
mode = "none";
|
|
1754
|
+
continue;
|
|
1755
|
+
}
|
|
1756
|
+
if (isBlankOrComment(line)) {
|
|
1757
|
+
if (format === "toml" && line.trimStart().startsWith("#")) {
|
|
1758
|
+
flushPending();
|
|
1759
|
+
kept.push(physical);
|
|
1760
|
+
} else pending.push(physical);
|
|
1761
|
+
lineIndex += 1;
|
|
1762
|
+
continue;
|
|
1763
|
+
}
|
|
1764
|
+
mode = tomlStringModeAfter(line, "none");
|
|
1765
|
+
if (skipping) {
|
|
1766
|
+
if (looksLikeTomlHeader(line)) {
|
|
1767
|
+
flushPending();
|
|
1768
|
+
skipping = false;
|
|
1769
|
+
tablePath = ["\0"];
|
|
1770
|
+
kept.push(physical);
|
|
1771
|
+
} else discardPending();
|
|
1772
|
+
} else {
|
|
1773
|
+
flushPending();
|
|
1774
|
+
kept.push(physical);
|
|
1775
|
+
}
|
|
1776
|
+
lineIndex += 1;
|
|
1777
|
+
}
|
|
1778
|
+
if (!skipping) flushPending();
|
|
1779
|
+
let body = kept.join("\n");
|
|
1780
|
+
if (body.endsWith("\r")) body += "\n";
|
|
1781
|
+
if (entry !== undefined && !inlineServerTable) {
|
|
1782
|
+
let fragment = withoutTrailingLineFeeds(stringify({ mcp_servers: { [serverKey]: entry } }));
|
|
1783
|
+
if (crlf) fragment = fragment.replaceAll("\n", "\r\n");
|
|
1784
|
+
const nl = crlf ? "\r\n" : "\n";
|
|
1785
|
+
const endedWithNewline = body.endsWith("\n");
|
|
1786
|
+
const base = withoutTrailingLineFeeds(body);
|
|
1787
|
+
const trimmed = endedWithNewline && base.endsWith("\r") ? base.slice(0, -1) : base;
|
|
1788
|
+
body = trimmed.length === 0 ? `${fragment}${nl}` : `${trimmed}${nl}${nl}${fragment}${nl}`;
|
|
1789
|
+
}
|
|
1790
|
+
return bom ? `\uFEFF${body}` : body;
|
|
1791
|
+
};
|
|
1792
|
+
tomlServerEntry = (document, serverKey) => {
|
|
1793
|
+
const servers = objectSchema.safeParse(document.mcp_servers);
|
|
1794
|
+
if (!servers.success || !Object.hasOwn(servers.data, serverKey)) return undefined;
|
|
1795
|
+
return servers.data[serverKey];
|
|
1796
|
+
};
|
|
1797
|
+
grokServerListedDisabled = (document, serverKey) => Array.isArray(document.disabled_mcp_servers) && document.disabled_mcp_servers.includes(serverKey);
|
|
1798
|
+
OMP_DISABLED_SERVERS_KEY = "disabledServers";
|
|
1799
|
+
ompServerListedDisabled = (document, serverKey) => {
|
|
1800
|
+
const listed = document[OMP_DISABLED_SERVERS_KEY];
|
|
1801
|
+
return Array.isArray(listed) && listed.includes(serverKey);
|
|
1802
|
+
};
|
|
1803
|
+
OMP_ENABLED_SERVERS_KEY = "enabledServers";
|
|
1804
|
+
clientServerForcedEnabled = (parsed, serverKey) => {
|
|
1805
|
+
if (parsed.dialect !== "omp") return false;
|
|
1806
|
+
const listed = parsed.document[OMP_ENABLED_SERVERS_KEY];
|
|
1807
|
+
return Array.isArray(listed) && listed.includes(serverKey);
|
|
1808
|
+
};
|
|
1809
|
+
clientServerListedDisabled = (parsed, serverKey) => parsed.dialect === "grok" && grokServerListedDisabled(parsed.document, serverKey) || parsed.dialect === "omp" && ompServerListedDisabled(parsed.document, serverKey);
|
|
1810
|
+
serializeGrokConfiguration = (document, originalText) => {
|
|
1811
|
+
const entry = tomlServerEntry(document, PRODUCT_IDENTITY.mcpServerKey);
|
|
1812
|
+
if (originalText === undefined) return stringify(document);
|
|
1813
|
+
return upsertTomlServerSection(originalText, PRODUCT_IDENTITY.mcpServerKey, entry, "grok");
|
|
1814
|
+
};
|
|
1815
|
+
withoutEmptyServerTable = (document) => {
|
|
1816
|
+
const servers = objectSchema.safeParse(document.mcp_servers);
|
|
1817
|
+
if (!servers.success || Object.keys(servers.data).length > 0) return document;
|
|
1818
|
+
const { mcp_servers: empty, ...rest } = document;
|
|
1819
|
+
void empty;
|
|
1820
|
+
return rest;
|
|
1821
|
+
};
|
|
1822
|
+
serializeCodexConfiguration = (document, originalText) => {
|
|
1823
|
+
if (originalText === undefined || isEmptyClientConfigurationText(originalText)) return stringify(document);
|
|
1824
|
+
const upserted = upsertTomlServerSection(originalText, PRODUCT_IDENTITY.mcpServerKey, tomlServerEntry(document, PRODUCT_IDENTITY.mcpServerKey), "toml");
|
|
1825
|
+
const edited = originalText.endsWith("\n") && !upserted.endsWith("\n") ? `${upserted}${originalText.endsWith("\r\n") ? "\r\n" : "\n"}` : upserted;
|
|
1826
|
+
return tomlTextHolds(edited, document) ? edited : stringify(document);
|
|
1827
|
+
};
|
|
1828
|
+
tomlTextHolds = (text, document) => {
|
|
1829
|
+
try {
|
|
1830
|
+
return clientConfigurationValuesEqual(withoutEmptyServerTable(objectSchema.parse(parseClientToml(text))), withoutEmptyServerTable(document));
|
|
1831
|
+
} catch (cause) {
|
|
1832
|
+
void cause;
|
|
1833
|
+
return false;
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
JSON_COMMA = 5;
|
|
1837
|
+
nextJsoncToken = (text, offset) => {
|
|
1838
|
+
const scanner = createScanner(text, true);
|
|
1839
|
+
scanner.setPosition(offset);
|
|
1840
|
+
const kind = scanner.scan();
|
|
1841
|
+
return {
|
|
1842
|
+
kind,
|
|
1843
|
+
offset: scanner.getTokenOffset()
|
|
1844
|
+
};
|
|
1845
|
+
};
|
|
1846
|
+
isJsonMember = (property, key) => property.children?.length === 2 && property.children[0]?.value === key;
|
|
1847
|
+
effectiveJsonProperty = (object, key) => object.children?.findLast((property) => isJsonMember(property, key));
|
|
1848
|
+
applyFormattedJsonEdit = (text, edit) => {
|
|
1849
|
+
const edited = applyEdits(text, [edit]);
|
|
1850
|
+
let begin = edit.offset;
|
|
1851
|
+
let end = edit.offset + edit.content.length;
|
|
1852
|
+
if (edit.length === 0) {
|
|
1853
|
+
while (begin > 0 && !"\r\n".includes(edited.charAt(begin - 1))) begin -= 1;
|
|
1854
|
+
while (end < edited.length && !"\r\n".includes(edited.charAt(end))) end += 1;
|
|
1855
|
+
}
|
|
1856
|
+
return applyEdits(edited, format(edited, {
|
|
1857
|
+
offset: begin,
|
|
1858
|
+
length: end - begin
|
|
1859
|
+
}, {
|
|
1860
|
+
insertSpaces: true,
|
|
1861
|
+
tabSize: 2,
|
|
1862
|
+
eol: "\n",
|
|
1863
|
+
keepLines: false
|
|
1864
|
+
}));
|
|
1865
|
+
};
|
|
1866
|
+
deleteJsonProperty = (text, object, property) => {
|
|
1867
|
+
const siblings = object.children ?? [];
|
|
1868
|
+
const propertyIndex = siblings.indexOf(property);
|
|
1869
|
+
const previous = siblings[propertyIndex - 1];
|
|
1870
|
+
const next = siblings[propertyIndex + 1];
|
|
1871
|
+
const comma = nextJsoncToken(text, previous === undefined ? property.offset + property.length : previous.offset + previous.length);
|
|
1872
|
+
if (propertyIndex < 0 || comma.kind !== JSON_COMMA && (previous !== undefined || next !== undefined)) throw new TypeError("JSON property separator was not found");
|
|
1873
|
+
const edits = [{
|
|
1874
|
+
offset: property.offset,
|
|
1875
|
+
length: property.length,
|
|
1876
|
+
content: ""
|
|
1877
|
+
}, ...comma.kind === JSON_COMMA ? [{
|
|
1878
|
+
offset: comma.offset,
|
|
1879
|
+
length: 1,
|
|
1880
|
+
content: ""
|
|
1881
|
+
}] : []];
|
|
1882
|
+
return applyEdits(text, edits);
|
|
1883
|
+
};
|
|
1884
|
+
editJsonMember = (text, path, value) => {
|
|
1885
|
+
let object = parseTree(text, [], { allowTrailingComma: true });
|
|
1886
|
+
for (const [index, key] of path.entries()) {
|
|
1887
|
+
if (object?.type !== "object") throw new TypeError("JSON edit parent is not an object");
|
|
1888
|
+
const property = effectiveJsonProperty(object, key);
|
|
1889
|
+
const member = property?.children?.[1];
|
|
1890
|
+
if (property === undefined || member === undefined) {
|
|
1891
|
+
if (value === undefined) return ok(text);
|
|
1892
|
+
const content = `${JSON.stringify(key)}: ${JSON.stringify(path.slice(index + 1).reduceRight((nested, name) => ({ [name]: nested }), value))}`;
|
|
1893
|
+
const previous = object.children?.at(-1);
|
|
1894
|
+
return ok(applyFormattedJsonEdit(text, previous === undefined ? {
|
|
1895
|
+
offset: object.offset + 1,
|
|
1896
|
+
length: 0,
|
|
1897
|
+
content
|
|
1898
|
+
} : {
|
|
1899
|
+
offset: previous.offset + previous.length,
|
|
1900
|
+
length: 0,
|
|
1901
|
+
content: `,${content}`
|
|
1902
|
+
}));
|
|
1903
|
+
}
|
|
1904
|
+
if (index < path.length - 1) {
|
|
1905
|
+
object = member;
|
|
1906
|
+
continue;
|
|
1907
|
+
}
|
|
1908
|
+
if (value !== undefined) return ok(applyFormattedJsonEdit(text, {
|
|
1909
|
+
offset: member.offset,
|
|
1910
|
+
length: member.length,
|
|
1911
|
+
content: JSON.stringify(value)
|
|
1912
|
+
}));
|
|
1913
|
+
if (object.children?.some((sibling) => sibling !== property && isJsonMember(sibling, key))) return err({
|
|
1914
|
+
kind: "shadowed_member",
|
|
1915
|
+
path
|
|
1916
|
+
});
|
|
1917
|
+
return ok(deleteJsonProperty(text, object, property));
|
|
1918
|
+
}
|
|
1919
|
+
throw new TypeError("JSON edit path is empty");
|
|
1920
|
+
};
|
|
1921
|
+
serializeClientConfiguration = (document, format, originalText, editedPaths) => {
|
|
1922
|
+
if (format === undefined || format === "unsupported") throw new TypeError("client does not have a supported MCP config format");
|
|
1923
|
+
if (format === "toml") return ok(serializeCodexConfiguration(document, originalText));
|
|
1924
|
+
if (format === "grok") return ok(serializeGrokConfiguration(document, originalText));
|
|
1925
|
+
if (format === "hermes") return ok(serializeHermesConfiguration(document, originalText));
|
|
1926
|
+
if (format === "dsh") return ok(serializeDshDocument(document));
|
|
1927
|
+
if (originalText === undefined || isEmptyClientConfigurationText(originalText) || editedPaths === undefined) return ok(`${JSON.stringify(document, null, 2)}\n`);
|
|
1928
|
+
let text = originalText;
|
|
1929
|
+
for (const path of editedPaths) {
|
|
1930
|
+
const edited = editJsonMember(text, path, valueAt(document, path));
|
|
1931
|
+
if (!edited.ok) return edited;
|
|
1932
|
+
text = edited.value;
|
|
1933
|
+
}
|
|
1934
|
+
return ok(text);
|
|
1935
|
+
};
|
|
1936
|
+
clientServerPath = (parsed, name) => [...parsed.serversPath, name];
|
|
1937
|
+
legacyClientServerPath = (parsed, name) => Object.hasOwn(parsed.legacyServers, name) ? [parsed.serversPath[0] ?? "mcp", name] : undefined;
|
|
1938
|
+
serializeHermesConfiguration = (document, originalText) => {
|
|
1939
|
+
if (originalText === undefined || isEmptyClientConfigurationText(originalText)) return stringifyHermesConfigurationYaml(document);
|
|
1940
|
+
const serversKey = clientConfigurationServersKey("hermes");
|
|
1941
|
+
const servers = document[serversKey];
|
|
1942
|
+
const entry = typeof servers === "object" && servers !== null ? servers[PRODUCT_IDENTITY.mcpServerKey] : undefined;
|
|
1943
|
+
return editHermesConfigurationYaml(originalText, [serversKey, PRODUCT_IDENTITY.mcpServerKey], entry);
|
|
1944
|
+
};
|
|
1945
|
+
clientRegistrationEntry = (format, command, environment) => {
|
|
1946
|
+
const [executable = "rea", ...args] = command;
|
|
1947
|
+
switch (format) {
|
|
1948
|
+
case "opencode": return {
|
|
1949
|
+
type: "local",
|
|
1950
|
+
command: [...command],
|
|
1951
|
+
enabled: true,
|
|
1952
|
+
...Object.keys(environment).length === 0 ? {} : { environment: { ...environment } }
|
|
1953
|
+
};
|
|
1954
|
+
case "kimi": return {
|
|
1955
|
+
command: executable,
|
|
1956
|
+
args,
|
|
1957
|
+
...Object.keys(environment).length === 0 ? {} : { env: environment }
|
|
1958
|
+
};
|
|
1959
|
+
case "opencode_v2": return {
|
|
1960
|
+
type: "local",
|
|
1961
|
+
command: [...command],
|
|
1962
|
+
...Object.keys(environment).length === 0 ? {} : { environment: { ...environment } }
|
|
1963
|
+
};
|
|
1964
|
+
case "vscode":
|
|
1965
|
+
case "omp":
|
|
1966
|
+
case "pi": return {
|
|
1967
|
+
type: "stdio",
|
|
1968
|
+
command: executable,
|
|
1969
|
+
args,
|
|
1970
|
+
...Object.keys(environment).length === 0 ? {} : { env: environment }
|
|
1971
|
+
};
|
|
1972
|
+
case "copilot_cli": return {
|
|
1973
|
+
type: "stdio",
|
|
1974
|
+
command: executable,
|
|
1975
|
+
args,
|
|
1976
|
+
tools: ["*"],
|
|
1977
|
+
...Object.keys(environment).length === 0 ? {} : { env: environment }
|
|
1978
|
+
};
|
|
1979
|
+
case "commandcode": return {
|
|
1980
|
+
transport: "stdio",
|
|
1981
|
+
enabled: true,
|
|
1982
|
+
command: executable,
|
|
1983
|
+
args,
|
|
1984
|
+
...Object.keys(environment).length === 0 ? {} : { env: environment }
|
|
1985
|
+
};
|
|
1986
|
+
case "dsh": return dshClientRegistrationEntry(command, environment);
|
|
1987
|
+
case "hermes": return {
|
|
1988
|
+
command: executable,
|
|
1989
|
+
args,
|
|
1990
|
+
...Object.keys(environment).length === 0 ? {} : { env: environment },
|
|
1991
|
+
enabled: true
|
|
1992
|
+
};
|
|
1993
|
+
default: return {
|
|
1994
|
+
command: executable,
|
|
1995
|
+
args,
|
|
1996
|
+
...Object.keys(environment).length === 0 ? {} : { env: environment }
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
};
|
|
2000
|
+
parseGeminiMcpPolicy = (parsed) => z.object({
|
|
2001
|
+
allowed: z.array(z.string()).optional(),
|
|
2002
|
+
excluded: z.array(z.string()).optional()
|
|
2003
|
+
}).passthrough().parse(parsed.document.mcp ?? {});
|
|
2004
|
+
normalizeGeminiServerName = (name) => name.toLowerCase().trim();
|
|
2005
|
+
geminiServerPolicyBlock = (policies, serverKey) => {
|
|
2006
|
+
const key = normalizeGeminiServerName(serverKey);
|
|
2007
|
+
if (policies.some(({ excluded }) => excluded?.some((name) => normalizeGeminiServerName(name) === key))) return `Gemini mcp.excluded blocks ${serverKey}. Review the selected settings policies before rerunning setup.`;
|
|
2008
|
+
const allowlists = policies.flatMap(({ allowed }) => allowed === undefined ? [] : [allowed]);
|
|
2009
|
+
const allowed = allowlists.reduce((previous, current) => {
|
|
2010
|
+
if (previous === undefined) return current;
|
|
2011
|
+
const normalized = new Set(current.map(normalizeGeminiServerName));
|
|
2012
|
+
return previous.filter((name) => normalized.has(normalizeGeminiServerName(name)));
|
|
2013
|
+
}, undefined);
|
|
2014
|
+
if (allowed !== undefined && allowed.length > 0 && !allowed.some((name) => normalizeGeminiServerName(name) === key)) return `Gemini mcp.allowed does not include ${serverKey}. Review the selected settings policies before rerunning setup.`;
|
|
2015
|
+
return undefined;
|
|
2016
|
+
};
|
|
2017
|
+
})))();
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
//#endregion
|
|
2021
|
+
export { ClientConfigurationShapeError, DshCordisDocument, MANAGED_SKILL_FILES, OMP_DISABLED_SERVERS_KEY, canonicalSkillNeedsInstall, clientConfigurationValuesEqual, clientRegistrationEntry, clientServerForcedEnabled, clientServerListedDisabled, clientServerPath, dshDocument, effectiveClientServer, existingSkillDestinations, geminiServerPolicyBlock, init_ClientConfigurationDocument, init_DshCordisPatch, init_SetupRecoveryBackup, init_SetupSkill, installCanonicalSkill, isManagedSkillManifest, legacyClientServerPath, parseClientConfiguration, parseGeminiMcpPolicy, parseZcodeFallbackConfiguration, preserveCurrentRecoveryBackup, readInstalledSkillIdentity, readSkillFile, selectCurrentRecoveryBackup, serializeClientConfiguration, skillDestinations, validateCanonicalSkillDirectories, withClientServers };
|