import { CancellationToken } from "../../../../base/common/cancellation.js"; import { Event } from "../../../../base/common/event.js"; import { IDisposable } from "../../../../base/common/lifecycle.js"; import { URI } from "../../../../base/common/uri.js"; import { IChatSessionItemsDelta, IChatSessionCommitEvent, ResolvedChatSessionsExtensionPoint, IChatSessionsExtensionPoint, IChatSessionItemController, IChatSessionItem, IChatSessionContentProvider, IChatSession, ReadonlyChatSessionOptionsMap, IChatSessionProviderOptionItem, IChatSessionOptionsChangeEvent, IChatSessionRequestHistoryItem, IChatSessionProviderOptionGroup, IChatNewSessionRequest, IChatSessionCustomizationsProvider, IChatSessionCustomizationItemGroup } from "./chatSessionsService.js"; import { IChatAgentAttachmentCapabilities } from "./participants/chatAgents.js"; import { Target } from "./promptSyntax/promptTypes.js"; export declare const IChatSessionsService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; export interface IChatSessionsService { readonly _serviceBrand: undefined; readonly onDidChangeItemsProviders: Event<{ readonly chatSessionType: string; }>; readonly onDidChangeSessionItems: Event; /** * Fired when an untitled session is committed (URI swapped to a real resource) * after the first turn completes. */ readonly onDidCommitSession: Event; readonly onDidChangeAvailability: Event; readonly onDidChangeInProgress: Event; getChatSessionContribution(chatSessionType: string): ResolvedChatSessionsExtensionPoint | undefined; getAllChatSessionContributions(): ResolvedChatSessionsExtensionPoint[]; /** * Programmatically register a chat session contribution (for internal session types * that don't go through the extension point). */ registerChatSessionContribution(contribution: IChatSessionsExtensionPoint): IDisposable; registerChatSessionItemController(chatSessionType: string, controller: IChatSessionItemController): IDisposable; getRegisteredChatSessionItemProviders(): readonly string[]; activateChatSessionItemProvider(chatSessionType: string): Promise; /** * Get the list of current chat session items grouped by session type. * * @param providerTypeFilter If specified, only returns items from the given providers. If undefined, returns items from all providers. * * @returns An async iterable that produces the list of session items for each provider. The order is not guaranteed. Some provider may take a long time to resolve. */ getChatSessionItems(providerTypeFilter: readonly string[] | undefined, token: CancellationToken): AsyncIterable<{ readonly chatSessionType: string; readonly items: readonly IChatSessionItem[]; }>; /** * Forces the controllers to refresh their session items, optionally filtered by provider type. */ refreshChatSessionItems(providerTypeFilter: readonly string[] | undefined, token: CancellationToken): Promise; /** @deprecated Use `getChatSessionItems` */ getInProgress(): { chatSessionType: string; count: number; }[]; readonly onDidChangeContentProviderSchemes: Event<{ readonly added: string[]; readonly removed: string[]; }>; getContentProviderSchemes(): string[]; registerChatSessionContentProvider(scheme: string, provider: IChatSessionContentProvider): IDisposable; canResolveChatSession(sessionType: string): Promise; getOrCreateChatSession(sessionResource: URI, token: CancellationToken): Promise; getSessionOptions(sessionResource: URI): ReadonlyChatSessionOptionsMap | undefined; getSessionOption(sessionResource: URI, optionId: string): string | IChatSessionProviderOptionItem | undefined; setSessionOption(sessionResource: URI, optionId: string, value: string | IChatSessionProviderOptionItem): boolean; updateSessionOptions(sessionResource: URI, updates: ReadonlyChatSessionOptionsMap): boolean; /** * Fired when options for a chat session change. */ readonly onDidChangeSessionOptions: Event; /** * Get the capabilities for a specific session type */ getCapabilitiesForSessionType(chatSessionType: string): IChatAgentAttachmentCapabilities | undefined; /** * Get the customAgentTarget for a specific session type. * When the Target is not `Target.Undefined`, the mode picker should show filtered custom agents matching this target. */ getCustomAgentTargetForSessionType(chatSessionType: string): Target; /** * Returns whether the session type requires custom models. When true, the model picker should show filtered custom models. */ requiresCustomModelsForSessionType(chatSessionType: string): boolean; /** * Returns whether the session type supports delegation. * Defaults to true when not explicitly set. */ supportsDelegationForSessionType(chatSessionType: string): boolean; /** * Returns whether the loaded session supports forking conversations. */ sessionSupportsFork(sessionResource: URI): boolean; /** * Forks a contributed chat session from the given request point. * @param sessionResource The session resource to fork. * @param request The request history item to fork from, or undefined to fork from the end. * @param token Cancellation token. * @returns The forked session item, or undefined if forking failed. */ forkChatSession(sessionResource: URI, request: IChatSessionRequestHistoryItem | undefined, token: CancellationToken): Promise; readonly onDidChangeOptionGroups: Event; getOptionGroupsForSessionType(chatSessionType: string): IChatSessionProviderOptionGroup[] | undefined; setOptionGroupsForSessionType(chatSessionType: string, handle: number, optionGroups?: IChatSessionProviderOptionGroup[]): void; getNewSessionOptionsForSessionType(chatSessionType: string): ReadonlyChatSessionOptionsMap | undefined; setNewSessionOptionsForSessionType(chatSessionType: string, options: ReadonlyChatSessionOptionsMap): void; /** * Creates a new chat session item using the controller's newChatSessionItemHandler. * Returns undefined if the controller doesn't have a handler or if no controller is registered. */ createNewChatSessionItem(chatSessionType: string, request: IChatNewSessionRequest, token: CancellationToken): Promise; /** * Registers an alias so that session-option lookups by the real resource * are redirected to the canonical (untitled) resource in the internal session map. */ registerSessionResourceAlias(untitledResource: URI, realResource: URI): void; /** * Fires {@link onDidCommitSession} to notify listeners that an untitled * session has been committed with a real resource URI. */ fireSessionCommitted(original: URI, committed: URI): void; readonly onDidChangeCustomizations: Event<{ readonly chatSessionType: string; }>; registerCustomizationsProvider(chatSessionType: string, provider: IChatSessionCustomizationsProvider): IDisposable; hasCustomizationsProvider(chatSessionType: string): boolean; getCustomizations(chatSessionType: string, token: CancellationToken): Promise; }