import * as dom from "../../../../../base/browser/dom.js"; import { IAction } from "../../../../../base/common/actions.js"; import * as event from "../../../../../base/common/event.js"; import { Disposable, IDisposable } from "../../../../../base/common/lifecycle.js"; import { ResourceMap } from "../../../../../base/common/map.js"; import { URI } from "../../../../../base/common/uri.js"; import { IRange } from "../../../../../editor/common/core/range.js"; import { Location, SymbolKind } from "../../../../../editor/common/languages.js"; import { ILanguageService } from "../../../../../editor/common/languages/language.service.js"; import { IModelService } from "../../../../../editor/common/services/model.service.js"; import { MenuId } from "../../../../../platform/actions/common/actions.js"; import { ICommandService } from "../../../../../platform/commands/common/commands.service.js"; import { IConfigurationService } from "../../../../../platform/configuration/common/configuration.service.js"; import { RawContextKey } from "../../../../../platform/contextkey/common/contextkey.js"; import { IContextKeyService } from "../../../../../platform/contextkey/common/contextkey.service.js"; import { IFileDialogService } from "../../../../../platform/dialogs/common/dialogs.service.js"; import { IOpenEditorOptions } from "../../../../../platform/editor/browser/editor.js"; import { IFileService } from "../../../../../platform/files/common/files.service.js"; import { IHoverService } from "../../../../../platform/hover/browser/hover.service.js"; import { IInstantiationService, ServicesAccessor } from "../../../../../platform/instantiation/common/instantiation.js"; import { ILabelService } from "../../../../../platform/label/common/label.service.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IMarkdownRendererService } from "../../../../../platform/markdown/browser/markdownRenderer.service.js"; import { INotificationService } from "../../../../../platform/notification/common/notification.service.js"; import { IOpenerService } from "../../../../../platform/opener/common/opener.service.js"; import { IThemeService } from "../../../../../platform/theme/common/themeService.service.js"; import { IResourceLabel, ResourceLabels } from "../../../../browser/labels.js"; import { IEditorService } from "../../../../services/editor/common/editorService.service.js"; import { IPreferencesService } from "../../../../services/preferences/common/preferences.service.js"; import { INotebookService } from "../../../notebook/common/notebookService.service.js"; import { ITerminalService } from "../../../terminal/browser/terminal.service.js"; import { IBrowserViewWorkbenchService } from "../../../browserView/common/browserView.service.js"; import { IChatContentReference } from "../../common/chatService/chatService.js"; import { IAgentHostConnectionsService } from "../../../../../platform/agentHost/common/agentHostConnectionsService.service.js"; import { IChatRequestPasteVariableEntry, IChatRequestVariableEntry, IBrowserViewVariableEntry, IChatRequestChatReferenceVariableEntry, IChatRequestTranscriptContextVariableEntry, IElementVariableEntry, INotebookOutputVariableEntry, IPromptFileVariableEntry, IPromptTextVariableEntry, ISCMHistoryItemVariableEntry, OmittedState, ChatRequestToolReferenceEntry, ISCMHistoryItemChangeVariableEntry, ISCMHistoryItemChangeRangeVariableEntry, ITerminalVariableEntry } from "../../common/attachments/chatVariableEntries.js"; import { ILanguageModelChatMetadataAndIdentifier } from "../../common/languageModels.js"; import { ILanguageModelsService } from "../../common/languageModels.service.js"; import { ILanguageModelToolsService } from "../../common/tools/languageModelToolsService.service.js"; import { IChatImageCarouselService } from "../chatImageCarouselService.service.js"; import { IChatImageRevealOrigin } from "./chatImageReveal.js"; declare abstract class AbstractChatAttachmentWidget extends Disposable { protected readonly attachment: IChatRequestVariableEntry; private readonly options; protected readonly currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined; protected readonly commandService: ICommandService; protected readonly openerService: IOpenerService; protected readonly configurationService: IConfigurationService; protected readonly terminalService?: ITerminalService | undefined; readonly element: HTMLElement; readonly label: IResourceLabel; private readonly _onDidDelete; get onDidDelete(): event.Event; private readonly _onDidOpen; get onDidOpen(): event.Event; constructor(attachment: IChatRequestVariableEntry, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, terminalService?: ITerminalService | undefined); protected modelSupportsVision(): boolean; private _hasClearButton; protected appendDeletionHint(ariaLabel: string): string; protected attachClearButton(): void; protected addResourceOpenHandlers(resource: URI, range: IRange | undefined): void; protected openResource(resource: URI, options: Partial, isDirectory: true): Promise; protected openResource(resource: URI, options: Partial, isDirectory: false, range: IRange | undefined): Promise; } export declare function getEffectiveImageOmittedState(omittedState: OmittedState | undefined, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, isCurrentInput: boolean | undefined): OmittedState | undefined; export declare class FileAttachmentWidget extends AbstractChatAttachmentWidget { private readonly themeService; private readonly hoverService; private readonly languageModelsService; private readonly instantiationService; private readonly fileDialogService; private readonly fileService; private readonly notificationService; constructor(resource: URI, range: IRange | undefined, attachment: IChatRequestVariableEntry, correspondingContentReference: IChatContentReference | undefined, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, themeService: IThemeService, hoverService: IHoverService, languageModelsService: ILanguageModelsService, instantiationService: IInstantiationService, fileDialogService: IFileDialogService, fileService: IFileService, notificationService: INotificationService); private attachSaveButton; private renderOmittedWarning; private renderFolderImageLimitWarning; } export declare class TerminalCommandAttachmentWidget extends AbstractChatAttachmentWidget { private readonly hoverService; protected readonly terminalService: ITerminalService; constructor(attachment: ITerminalVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, hoverService: IHoverService, terminalService: ITerminalService); } export interface IChatImageBase64Data { readonly data: string; readonly mimeType: string; } export declare class ImageAttachmentWidget extends AbstractChatAttachmentWidget { private readonly hoverService; private readonly languageModelsService; private readonly instantiationService; private readonly labelService; private readonly chatImageCarouselService; private readonly fileDialogService; private readonly fileService; private readonly notificationService; constructor(resource: URI | undefined, attachment: IChatRequestVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; isCurrentInput?: boolean; showImageInHover?: boolean; imagePresentation?: "thumbnail" | "inline"; imageReveal?: IChatImageRevealOrigin; imageDimensions?: ResourceMap; imageBase64Data?: IChatImageBase64Data; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, hoverService: IHoverService, languageModelsService: ILanguageModelsService, instantiationService: IInstantiationService, labelService: ILabelService, chatImageCarouselService: IChatImageCarouselService, fileDialogService: IFileDialogService, fileService: IFileService, notificationService: INotificationService); private renderInlineImage; private loadImageBytes; private openInCarousel; private attachSaveButton; } /** * Opens a pasted-text attachment so its full contents can be reviewed; the * attachment pill is otherwise the only handle on that text. The contents are * derived from the attachment on demand — so nothing is held for an artifact * that is never opened — and backed by a read-only resource keyed on the * attachment, which keeps one editor per artifact and prevents edits that would * not reach the attachment. The association is dropped once the editor closes. */ export declare function openPastedTextArtifact(accessor: ServicesAccessor, attachment: IChatRequestPasteVariableEntry): Promise; export declare class PasteAttachmentWidget extends AbstractChatAttachmentWidget { private readonly hoverService; private readonly instantiationService; constructor(attachment: IChatRequestPasteVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, hoverService: IHoverService, instantiationService: IInstantiationService); } export declare class DefaultChatAttachmentWidget extends AbstractChatAttachmentWidget { private readonly contextKeyService; private readonly instantiationService; private readonly hoverService; private readonly modelService; private readonly languageService; private readonly themeService; private readonly _tooltipHover; constructor(resource: URI | undefined, range: IRange | undefined, attachment: IChatRequestVariableEntry, correspondingContentReference: IChatContentReference | undefined, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, instantiationService: IInstantiationService, hoverService: IHoverService, modelService: IModelService, languageService: ILanguageService, themeService: IThemeService); private _applyLabel; private _setupTooltipHover; } export declare class PromptFileAttachmentWidget extends AbstractChatAttachmentWidget { private readonly labelService; private readonly instantiationService; private hintElement; constructor(attachment: IPromptFileVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, labelService: ILabelService, instantiationService: IInstantiationService); private updateLabel; } export declare class PromptTextAttachmentWidget extends AbstractChatAttachmentWidget { constructor(attachment: IPromptTextVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, preferencesService: IPreferencesService, hoverService: IHoverService); } export declare class ToolSetOrToolItemAttachmentWidget extends AbstractChatAttachmentWidget { constructor(attachment: ChatRequestToolReferenceEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, toolsService: ILanguageModelToolsService, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, hoverService: IHoverService); } /** * Renders an agent-host {@link IChatRequestChatReferenceVariableEntry chat-reference} * attachment (`#chat:`) as a clickable chip. Clicking (or pressing * Enter/Space) opens the referenced chat in the Agents window by handing an * `agent-host-session://` link to the {@link IOpenerService}. A chat reference * never crosses agent hosts, so the referenced chat is resolved, and the link * scoped, on the host connection of the chat that shows the chip * (`sessionResource`). When that session has no agent host connection, the link * cannot be built, or the opener declines it (e.g. the chat was deleted or * lives in another window) the chip degrades gracefully and still renders its * label. */ export declare class ChatReferenceAttachmentWidget extends AbstractChatAttachmentWidget { private readonly _sessionResource; private readonly _connectionsService; private readonly _logService; constructor(attachment: IChatRequestChatReferenceVariableEntry, _sessionResource: URI | undefined, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, hoverService: IHoverService, _connectionsService: IAgentHostConnectionsService, _logService: ILogService); private _openReferencedChat; } export declare class TranscriptContextAttachmentWidget extends AbstractChatAttachmentWidget { constructor(attachment: IChatRequestTranscriptContextVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, hoverService: IHoverService); } export declare function openTranscriptContextAttachment(openerService: IOpenerService, attachment: IChatRequestTranscriptContextVariableEntry): Promise<boolean>; export declare class NotebookCellOutputChatAttachmentWidget extends AbstractChatAttachmentWidget { private readonly hoverService; private readonly languageModelsService; private readonly notebookService; private readonly instantiationService; constructor(resource: URI, attachment: INotebookOutputVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; isCurrentInput?: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, hoverService: IHoverService, languageModelsService: ILanguageModelsService, notebookService: INotebookService, instantiationService: IInstantiationService); getAriaLabel(attachment: INotebookOutputVariableEntry): string; private renderErrorOutput; private renderGenericOutput; private renderImageOutput; private getOutputItem; } export declare class ElementChatAttachmentWidget extends AbstractChatAttachmentWidget { private readonly editorService; private readonly hoverService; private readonly fileService; private readonly logService; private readonly markdownRendererService; private readonly chatImageCarouselService; constructor(attachment: IElementVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, editorService: IEditorService, hoverService: IHoverService, fileService: IFileService, logService: ILogService, markdownRendererService: IMarkdownRendererService, chatImageCarouselService: IChatImageCarouselService); private getHoverContent; private shouldRenderRichElementHover; private appendImagePreview; private getSimpleHoverContent; private getComputedStyleEntriesForHover; private getBoxShorthandValue; private openElementAttachment; private formatElementTag; private formatAncestorTag; } export declare class SCMHistoryItemAttachmentWidget extends AbstractChatAttachmentWidget { constructor(attachment: ISCMHistoryItemVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, markdownRendererService: IMarkdownRendererService, hoverService: IHoverService, openerService: IOpenerService, configurationService: IConfigurationService, themeService: IThemeService); private _openAttachment; } export declare class SCMHistoryItemChangeAttachmentWidget extends AbstractChatAttachmentWidget { private readonly editorService; constructor(attachment: ISCMHistoryItemChangeVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, hoverService: IHoverService, markdownRendererService: IMarkdownRendererService, openerService: IOpenerService, configurationService: IConfigurationService, themeService: IThemeService, editorService: IEditorService); protected openResource(resource: URI, options: IOpenEditorOptions, isDirectory: true): Promise<void>; protected openResource(resource: URI, options: IOpenEditorOptions, isDirectory: false, range: IRange | undefined): Promise<void>; } export declare class SCMHistoryItemChangeRangeAttachmentWidget extends AbstractChatAttachmentWidget { private readonly editorService; constructor(attachment: ISCMHistoryItemChangeRangeVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, editorService: IEditorService); protected openResource(resource: URI, options: IOpenEditorOptions, isDirectory: true): Promise<void>; protected openResource(resource: URI, options: IOpenEditorOptions, isDirectory: false, range: IRange | undefined): Promise<void>; } export declare class BrowserViewAttachmentWidget extends AbstractChatAttachmentWidget { private readonly _attachment; private readonly _options; private readonly _browserViewService; private readonly _hoverService; private readonly _editorService; private readonly _instantiationService; private readonly _inputListeners; private _input; constructor(_attachment: IBrowserViewVariableEntry, currentLanguageModel: ILanguageModelChatMetadataAndIdentifier | undefined, _options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }, container: HTMLElement, contextResourceLabels: ResourceLabels, commandService: ICommandService, openerService: IOpenerService, configurationService: IConfigurationService, _browserViewService: IBrowserViewWorkbenchService, _hoverService: IHoverService, _editorService: IEditorService, _instantiationService: IInstantiationService); /** * Look up the current BrowserEditorInput for this attachment's browser ID, bind listeners, and refresh the UI. */ private _resolveInput; private _updateLabel; protected openResource(resource: URI, options: IOpenEditorOptions, isDirectory: true): Promise<void>; protected openResource(resource: URI, options: IOpenEditorOptions, isDirectory: false, range: IRange | undefined): Promise<void>; } export declare function hookUpResourceAttachmentDragAndContextMenu(accessor: ServicesAccessor, widget: HTMLElement, resource: URI, additionalActions?: () => IAction[], menuId?: MenuId): IDisposable; /** * Shows the actions of {@link menuId} for {@link resource} when {@link widget} opens a context menu, * using resource context keys scoped to the widget. */ export declare function hookUpResourceContextMenu(accessor: ServicesAccessor, widget: HTMLElement, resource: URI | undefined, menuId: MenuId, additionalActions?: () => IAction[], fallbackFocusTarget?: HTMLElement): IDisposable; export declare function hookUpSymbolAttachmentDragAndContextMenu(accessor: ServicesAccessor, widget: HTMLElement, parentContextKeyService: IContextKeyService, attachment: { name: string; value: Location; kind: SymbolKind; }, contextMenuId: MenuId): IDisposable; export declare const chatAttachmentResourceContextKey: RawContextKey<string>; export {};