import { IStringDictionary } from "../../../../../../base/common/collections.js"; import { IMarkdownString } from "../../../../../../base/common/htmlContent.js"; import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { ThemeIcon } from "../../../../../../base/common/themables.js"; import { URI } from "../../../../../../base/common/uri.js"; import { ILogService } from "../../../../../../platform/log/common/log.service.js"; import { IStorageService } from "../../../../../../platform/storage/common/storage.service.js"; import { ILanguageModelChatMetadataAndIdentifier } from "../../../common/languageModels.js"; import { IChatInputNotificationService } from "./chatInputNotificationService.service.js"; export declare enum ChatInputNotificationSeverity { Info = 0, Warning = 1, Error = 2 } export declare enum ChatInputNotificationActionKind { Command = "command", OpenModelPicker = "openModelPicker", SwitchToModel = "switchToModel" } interface IChatInputNotificationActionBase { readonly label: string; /** Accessible label for actions whose visual label is an icon. */ readonly ariaLabel?: string; /** Whether the visible label contains only an icon. */ readonly iconOnly?: boolean; /** Whether the action anchors to the leading edge of a split action row. */ readonly leading?: boolean; /** Whether a secondary action uses the standard filled button style instead of a ghost button. */ readonly filled?: boolean; /** Whether a secondary action keeps a theme-aware border. */ readonly outlined?: boolean; readonly tooltip?: string; readonly primary?: boolean; /** Shows the action but it can't be chosen, e.g. while a request it sent takes effect; progress updates can change it in place. */ readonly disabled?: boolean; readonly keepOpen?: boolean; /** Stable id reported to telemetry, so two actions of the same kind can be told apart. */ readonly telemetryActionId?: string; } export interface IChatInputNotificationCommandAction extends IChatInputNotificationActionBase { readonly kind: ChatInputNotificationActionKind.Command; readonly commandId: string; readonly commandArgs?: unknown[]; } export interface IChatInputNotificationOpenModelPickerAction extends IChatInputNotificationActionBase { readonly kind: ChatInputNotificationActionKind.OpenModelPicker; } export interface IChatInputNotificationSwitchToModelAction extends IChatInputNotificationActionBase { readonly kind: ChatInputNotificationActionKind.SwitchToModel; /** Matches the target against models available to the rendering input. */ readonly matchesModel: (model: ILanguageModelChatMetadataAndIdentifier) => boolean; /** Applied to the target model once switched. Keys its schema does not declare are dropped. */ readonly config?: IStringDictionary; /** Requires the target to match exactly one model, rather than taking the first match. */ readonly requireUniqueModel?: boolean; } export type IChatInputNotificationAction = IChatInputNotificationCommandAction | IChatInputNotificationOpenModelPickerAction | IChatInputNotificationSwitchToModelAction; export interface IChatInputNotificationMuteAction { /** Command executed when the user clicks the mute (bell-slash) button. */ readonly commandId: string; readonly commandArgs?: unknown[]; /** Tooltip and accessible label for the mute button. */ readonly tooltip: string; } /** Input state used to choose notification content. */ export interface IChatInputNotificationModelState { readonly currentModel: ILanguageModelChatMetadataAndIdentifier | undefined; readonly models: readonly ILanguageModelChatMetadataAndIdentifier[]; } export interface IChatInputNotificationContext { readonly inputUri?: URI; readonly sessionType: string | undefined; readonly sessionResource: URI | undefined; readonly deferredNotificationsEnabled: boolean; readonly isTransientChat: boolean; readonly sessionStarted: boolean; readonly modelState: IChatInputNotificationModelState; } /** A complete notification body selected for one input. */ export interface IChatInputNotificationBody { readonly description: string | IMarkdownString | undefined; readonly actions: readonly IChatInputNotificationAction[]; } /** Progress of the operation a notification reports, rendered as the standard progress bar under its message. */ export interface IChatInputNotificationProgress { /** Completed percentage, from 0 to 100. `undefined` renders an animated indeterminate bar. */ readonly percent?: number; } /** Notifications of one feature that must not compete: only the highest-priority applicable members are considered; the rest wait. */ export interface IChatInputNotificationGroup { readonly id: string; readonly priority: number; } export interface IChatInputNotificationSetOptions { /** Updates the content of a set notification (e.g. progress) without moving it in front of newer ones or undoing a dismissal; sets it as usual otherwise. */ readonly inPlace?: boolean; } export interface IChatInputNotification { readonly id: string; /** Targets one input instance, including when several inputs show the same session. */ readonly inputUri?: URI; readonly telemetryId?: string; readonly severity: ChatInputNotificationSeverity; /** Optional header icon. Defaults to the severity icon. */ readonly icon?: ThemeIcon; readonly message: string | IMarkdownString; /** What assistive technology reads and hears when the message changes too often to announce, e.g. a countdown. Defaults to the message. */ readonly ariaMessage?: string; readonly description: string | IMarkdownString | undefined; readonly actions: readonly IChatInputNotificationAction[]; /** Controls whether this notification applies to an input. */ readonly when?: (context: IChatInputNotificationContext) => boolean; /** Called with the rendering input's context when first visible in each input. Must be idempotent. */ readonly onDidShow?: (context: IChatInputNotificationContext) => void; /** Resolves the description and actions for an input. */ readonly resolveBody?: (context: IChatInputNotificationContext) => IChatInputNotificationBody; readonly dismissible: boolean; /** Handles dismissal of this rendered notice, even if another input has since replaced it. */ readonly onDismiss?: () => void; readonly autoDismissOnMessage: boolean; /** * Optional allow-list of chat session types that should display this * notification. When undefined, the notification renders in every chat * input. When set, only chat inputs whose current session type is in the * list will render it. */ readonly sessionTypes?: readonly string[]; /** Optional allow-list of concrete chat session resources that should display this notification. */ readonly sessionResources?: readonly URI[]; /** * Optional "mute" affordance rendered as a bell-slash icon button next to * the dismiss (X) button. Use for a "stop showing this entirely" action * that is distinct from a one-off dismissal. Omit to hide the button. */ readonly mute?: IChatInputNotificationMuteAction; /** Shows a progress bar under the message; while the id and layout stay the same, updates change the message, bar and actions in place so focus stays. */ readonly progress?: IChatInputNotificationProgress; /** Shows the in-progress indicator of an active agent session in place of the icon while the operation runs, kept through updates in place. */ readonly busy?: boolean; /** When set, screen readers hear the notification again only when this key changes (a new phase, a pause, a failure), not on every text change. */ readonly announcementKey?: string; /** Defers this notification to higher-priority members of the same group. */ readonly group?: IChatInputNotificationGroup; } /** Creates a matcher for a fixed model identifier. */ export declare function matchesModelIdentifier(identifier: string): (model: ILanguageModelChatMetadataAndIdentifier) => boolean; /** Resolves one complete notification body for an input. */ export declare function resolveChatInputNotificationBody(notification: IChatInputNotification, context: IChatInputNotificationContext, onError: (error: unknown) => void): IChatInputNotificationBody | undefined; /** Returns the text signature used to de-duplicate announcements. */ export declare function getChatInputNotificationAnnouncementSignature(notification: IChatInputNotification, body: IChatInputNotificationBody): string; /** Returns whether a notification applies to the concrete model-target session type. */ export declare function isChatInputNotificationApplicableToSessionType(notification: IChatInputNotification, sessionType: string | undefined): boolean; export declare function isChatInputNotificationApplicableToSession(notification: IChatInputNotification, sessionType: string | undefined, sessionResource: URI | undefined, inputUri?: URI): boolean; export declare class ChatInputNotificationService extends Disposable implements IChatInputNotificationService { private readonly _logService; readonly _serviceBrand: undefined; private readonly _notifications; private readonly _dismissed; /** Insertion order tracking — higher index = more recently set. */ private readonly _insertionOrder; private _insertionCounter; private readonly _onDidChange; readonly onDidChange: import("../../../../../../base/common/event.js").Event; private readonly _onDidDismiss; readonly onDidDismiss: import("../../../../../../base/common/event.js").Event; private readonly _announcedById; constructor(_logService: ILogService); setNotification(notification: IChatInputNotification, options?: IChatInputNotificationSetOptions): void; refresh(): void; deleteNotification(id: string): void; dismissNotification(id: string, notification?: IChatInputNotification | undefined): void; private _handleDismiss; getActiveNotification(filter?: (notification: IChatInputNotification) => boolean): IChatInputNotification | undefined; handleMessageSent(context?: IChatInputNotificationContext): void; private _fireDidChange; announceRendered(notification: IChatInputNotification | undefined, body?: IChatInputNotificationBody): void; } /** * Reads the ids a user has dismissed for good, kept in application storage so a dismissal in one * window applies to every other. Returns an empty set for absent or corrupt data. * * The set is stored under one key, so two windows dismissing different notices in the same * instant can leave the later write without the earlier id. Re-reading before each write keeps * that to a genuine race, and the cost is only that a notice may appear once more. */ export declare function readDismissedNotificationIds(storageService: IStorageService, key: string): Set; /** Records one id as dismissed for good. */ export declare function addDismissedNotificationId(storageService: IStorageService, key: string, id: string): void; export {};