import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { IObservable, ITransaction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service"; /** * In-memory representation of an installed plugin entry. */ export interface IStoredInstalledPlugin { readonly pluginUri: URI; readonly marketplace: 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 only the plugin URI (as a string) and the * marketplace identifier. Plugin metadata (name, description, etc.) is * read from the plugin manifest on disk 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 _installed; private readonly _fileUri; private readonly _writeDelayer; private _suppressFileWatch; private _initialized; readonly value: IObservable; constructor(_agentPluginsHome: URI, _oldCacheRoot: URI | undefined, _fileService: IFileService, _logService: ILogService, _storageService: IStorageService); get(): readonly IStoredInstalledPlugin[]; set(newValue: readonly IStoredInstalledPlugin[], tx: ITransaction | undefined): void; private _initialize; private _readFromFile; private _scheduleWrite; private _writeToFile; private _setupFileWatcher; private _onFileChanged; private _setValue; private _migrateFromStorage; /** * 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; }