import { Disposable } from "../../../../base/common/lifecycle.js"; import { IObservable, IReader, ITransaction } from "../../../../base/common/observable.js"; import { IStorageService } from "../../../../platform/storage/common/storage.service.js"; export declare enum ContributionEnablementState { DisabledProfile = 0, DisabledWorkspace = 1, EnabledProfile = 2, EnabledWorkspace = 3 } export declare function isContributionEnabled(state: ContributionEnablementState): boolean; export declare function isContributionDisabled(state: ContributionEnablementState): boolean; export interface IEnablementModel { readEnabled(key: string, reader?: IReader): ContributionEnablementState; /** * Reads the global (non-workspace) enablement for `key`. Despite the name, * this state is shared by every profile and window; see {@link EnablementModel}. */ readProfileEnabled(key: string, reader?: IReader): boolean; /** Whether a transition is permitted before starting an external mutation. */ canSetEnabled?(key: string, state: ContributionEnablementState): boolean; setEnabled(key: string, state: ContributionEnablementState, tx?: ITransaction): void; setDefaultEnabled?(key: string, enabled: boolean, tx?: ITransaction): void; remove(key: string): void; } /** * A reusable enablement model for string-keyed contributions. Uses * `observableMemento` to persist enable/disable state in both * application-scoped and workspace-scoped storage. * * The global ("Profile") state is stored in {@link StorageScope.APPLICATION} * so every window and profile, including the Agents Window, shares the same * switches. The `*Profile` names are kept for compatibility. * * Resolution order: if a workspace-scoped entry exists for a key, it wins. * Otherwise, the global entry is used. The default (absence of any * entry) is {@link ContributionEnablementState.EnabledProfile}. */ export declare class EnablementModel extends Disposable implements IEnablementModel { private readonly _globalState; private readonly _workspaceState; private readonly _defaultState; constructor(storageKey: string, storageService: IStorageService); readEnabled(key: string, reader?: IReader): ContributionEnablementState; readProfileEnabled(key: string, reader?: IReader): boolean; readEnabledWithWorkspaceKey(profileKey: string, workspaceKey: string | undefined, reader?: IReader): ContributionEnablementState; setEnabled(key: string, state: ContributionEnablementState, tx?: ITransaction): void; setEnabledWithWorkspaceKey(profileKey: string, workspaceKey: string | undefined, state: ContributionEnablementState, tx?: ITransaction): void; setDefaultEnabled(key: string, enabled: boolean, tx?: ITransaction): void; remove(key: string): void; private _setOrDeleteFromMap; private _setInMap; private _deleteFromMap; } export declare class CollisionEnablementModel implements IEnablementModel { private readonly _base; private readonly _collisionGroups; constructor(_base: IEnablementModel, _collisionGroups: IObservable>); readEnabled(key: string, reader?: IReader): ContributionEnablementState; readProfileEnabled(key: string, reader?: IReader): boolean; canSetEnabled(key: string, state: ContributionEnablementState): boolean; setEnabled(key: string, state: ContributionEnablementState, tx?: ITransaction): void; setDefaultEnabled(key: string, enabled: boolean, tx?: ITransaction): void; remove(key: string): void; }