import { Disposable } from "../../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../../base/common/observable.js"; import { IInstantiationService } from "../../../../../platform/instantiation/common/instantiation.js"; import { IFileService } from "../../../../../platform/files/common/files.service.js"; import { ILabelService } from "../../../../../platform/label/common/label.service.js"; import { IProductService } from "../../../../../platform/product/common/productService.service.js"; import { IWorkspaceContextService } from "../../../../../platform/workspace/common/workspace.service.js"; import { IPathService } from "../../../../services/path/common/pathService.js"; import { IAICustomizationWorkspaceService } from "../../common/aiCustomizationWorkspaceService.service.js"; import { ICustomizationHarnessService } from "../../common/customizationHarnessService.service.js"; import { ICustomizationMarketplaceInstallService } from "../../common/customizationMarketplaceInstallService.service.js"; import { IAgentPluginService } from "../../common/plugins/agentPluginService.service.js"; import { IPromptsService } from "../../common/promptSyntax/service/promptsService.service.js"; import { IAICustomizationItemSource, IAICustomizationListItem } from "./aiCustomizationItemSource.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IAICustomizationItemsModel } from "./aiCustomizationItemsModel.service.js"; /** * The set of sections whose items are sourced from the customization * harness pipeline (extension-contributed providers, sync providers, * and the prompts-service fallback). McpServers / Models have their * own dedicated services and are not modeled here. Plugins keep a * dedicated count observable because remote harnesses can contribute * plugin rows through the same provider pipeline. */ export declare const ITEMS_MODEL_SECTIONS: readonly [ "agents", "skills", "instructions", "prompts", "hooks" ]; export type ItemsModelSection = typeof ITEMS_MODEL_SECTIONS[number]; export declare class AICustomizationItemsModel extends Disposable implements IAICustomizationItemsModel { private readonly harnessService; private readonly promptsService; private readonly workspaceService; private readonly agentPluginService; private readonly fileService; private readonly pathService; private readonly logService; private readonly marketplaceInstallService; private readonly instantiationService; readonly _serviceBrand: undefined; private readonly itemNormalizer; /** * Cached source per active descriptor. Keyed by descriptor reference (not id) so that * an external harness re-registering under the same id (e.g. extension reload) gets a * fresh source bound to the new provider. Pruned when its descriptor is no longer * present in `availableHarnesses`. */ private readonly sourceCache; /** The descriptor bound to `sourceCache`'s current source, used to detect a late-registering harness. */ private sourceDescriptor; private pendingRefetchSource; private readonly refetchObservedScheduler; private readonly perSectionSource; private readonly perSection; private readonly perSectionCount; private readonly fetchSeq; /** Promise of the most recent fetch per section (resolves regardless of stale-discard). */ private readonly perSectionPending; private readonly remotePlugins; private readonly pluginCount; private pluginCountObserved; private pluginFetchSeq; /** * Sections that have been observed at least once. The model only fetches on * demand: first `getItems`/`getCount` for a section triggers an initial fetch, * and subsequent harness/source/workspace change events refetch only sections * that have already been read. This avoids 5x provider enumeration on startup. */ private readonly observedSections; constructor(harnessService: ICustomizationHarnessService, promptsService: IPromptsService, workspaceService: IAICustomizationWorkspaceService, workspaceContextService: IWorkspaceContextService, labelService: ILabelService, agentPluginService: IAgentPluginService, productService: IProductService, fileService: IFileService, pathService: IPathService, logService: ILogService, marketplaceInstallService: ICustomizationMarketplaceInstallService, instantiationService: IInstantiationService); getItems(section: ItemsModelSection): IObservable; getCount(section: ItemsModelSection): IObservable; getPluginCount(): IObservable; getActiveItemSource(): IAICustomizationItemSource; whenSectionLoaded(section: ItemsModelSection): Promise; private markObserved; private markPluginCountObserved; private getOrCreateSource; private scheduleRefetchObserved; private refetchObserved; private refetchSection; private refetchPluginCount; }