import { Disposable } from "../../../../../base/common/lifecycle.js"; import { IObservable, ITransaction } from "../../../../../base/common/observable.js"; import { URI } from "../../../../../base/common/uri.js"; import { IFileService } from "../../../../../platform/files/common/files.service.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IStorageService } from "../../../../../platform/storage/common/storage.service.js"; import { IAgentPluginEnablementService } from "./agentPluginService.service.js"; /** * In-memory representation of an installed plugin entry. */ export interface IStoredInstalledPlugin { readonly pluginUri: URI; readonly enablementUri?: URI; readonly marketplace: string; readonly name?: string; } /** * An observable store for installed agent plugins that is backed by a * `installed.json` file within the agent-plugins directory. This makes * the installed-plugin manifest discoverable by external tools (CLIs, * other editors, etc.) without depending on VS Code internals. * * The on-disk format stores the plugin URI, a relative path for managed * plugins, marketplace identifier, and plugin name. Full plugin metadata * (description, source descriptor, etc.) is read by the discovery layer - * keeping a single source of truth. * * On construction the store: * 1. Attempts to read `installed.json` from the agent-plugins directory. * 2. If no file exists, migrates data from the legacy {@link StorageService} * key (`chat.plugins.installed.v1`), rebasing plugin URIs from the old * cache directory to the new agent-plugins directory. * 3. Sets up a correlated file watcher so that external edits to * `installed.json` are picked up automatically. * * Write operations update the in-memory observable synchronously and * schedule a debounced file write so that rapid successive mutations * (e.g. batch enables) are coalesced into a single I/O operation. */ export declare class FileBackedInstalledPluginsStore extends Disposable { private readonly _agentPluginsHome; private readonly _oldCacheRoot; private readonly _fileService; private readonly _logService; private readonly _storageService; private readonly _pluginEnablementService; private readonly _installed; private readonly _fileUri; private readonly _writeDelayer; private readonly _reloadScheduler; private readonly _fileOperationQueue; private _hasPendingChanges; private _suppressFileWatch; private _initialized; readonly value: IObservable; constructor(_agentPluginsHome: URI, _oldCacheRoot: URI | undefined, _fileService: IFileService, _logService: ILogService, _storageService: IStorageService, _pluginEnablementService: IAgentPluginEnablementService); get(): readonly IStoredInstalledPlugin[]; set(newValue: readonly IStoredInstalledPlugin[], tx: ITransaction | undefined): void; private _initialize; private _readAndMigrateFromFile; private _readFromFile; private _scheduleWrite; private _writeToFile; private _setupFileWatcher; private _onFileChanged; private _migrateFromStorage; private _getRelativePath; /** * If the plugin URI was under the old cache root, rebase it to the * new agent-plugins directory. Otherwise, return `undefined` to keep * the original. */ private _rebasePluginUri; }