import { CancellationToken } from "../../../../base/common/cancellation.js"; import { IStringDictionary } from "../../../../base/common/collections.js"; import { Event } from "../../../../base/common/event.js"; import { IMarkdownString } from "../../../../base/common/htmlContent.js"; import { IDisposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import { ThemeIcon } from "../../../../base/common/themables.js"; import { URI } from "../../../../base/common/uri.js"; import { IPosition } from "../../../../editor/common/core/position.js"; import type { IAgentModelConfigurationReport } from "../../../../platform/agentHost/common/agentModelConfiguration.js"; import { ServicesAccessor } from "../../../../platform/instantiation/common/instantiation.js"; import { IChatAgentAttachmentCapabilities, IChatAgentRequest } from "./participants/chatAgents.js"; import { IChatRequestVariableEntry } from "./attachments/chatVariableEntries.js"; import { IChatSideChatOrigin, IChatSideChatSelection } from "@codingame/monaco-vscode-chat-service-override/vscode/vs/workbench/contrib/chat/common/chatSideChatService"; import { IChatEditingSession } from "./editing/chatEditingService.js"; import { ChatRequestSource, IChatRequestModeInstructions, IChatRequestModel, IChatRequestVariableData, ISerializableChatModelInputState } from "./model/chatModel.js"; import { IChatRequestOrigin } from "./chatRequestOrigin.js"; import { IChatProgress, IChatResponseErrorDetails, IChatSendRequestOptions, IChatSessionTiming } from "./chatService/chatService.js"; import { ChatAgentLocation } from "./constants.js"; import { Target } from "./promptSyntax/promptTypes.js"; import type { ICanvasContext } from "../../canvases/common/canvas.js"; import type { IChatSessionHistoryStatus } from "../../../../platform/chat/common/chatSessionHistory.js"; import { IChatSessionsService } from "./chatSessionsService.service.js"; export declare const NEW_SESSION_IN_AGENTS_WINDOW_COMMAND_ID = "workbench.action.sessions.newChat"; export interface INewSessionInAgentsWindowOptions { toSide?: boolean; prompt?: string; prefillPrompt?: boolean; noWorkspace?: boolean; /** Local Agent Host provider to use for a workspace-less session instead of inheriting the active target. */ agentHostProvider?: string; } export declare enum ChatSessionsExtensions { AsyncActivation = "workbench.contrib.chatSessions.asyncActivation" } export interface IAsyncChatSessionActivationContribution { /** Higher priorities activate first. Defaults to 0, with registration order breaking ties. */ readonly priority?: number; matchSessionType(sessionType: string): boolean; /** Optional owner lifetime, captured before activation; cancellation also ends provider-registration waits. */ getActivationToken?(sessionType: string): CancellationToken; waitForActivation(accessor: ServicesAccessor, sessionType: string): Promise; } export interface IAsyncChatSessionActivationRegistry { register(contribution: IAsyncChatSessionActivationContribution): IDisposable; getActivators(sessionType: string): readonly IAsyncChatSessionActivationContribution[]; } export declare enum ChatSessionStatus { Failed = 0, Completed = 1, InProgress = 2, NeedsInput = 3 } export interface IChatSessionCommandContribution { readonly name: string; readonly description: string; readonly when?: string; } export interface IChatSessionProviderOptionModelMetadata { readonly name: string; readonly id: string; readonly vendor?: string; readonly version?: string; readonly family?: string; readonly tooltip?: string; readonly pricing?: string; readonly multiplierNumeric?: number; readonly inputCost?: number; readonly outputCost?: number; readonly cacheCost?: number; readonly cacheWriteCost?: number; readonly longContextInputCost?: number; readonly longContextOutputCost?: number; readonly longContextCacheCost?: number; readonly longContextCacheWriteCost?: number; readonly priceCategory?: string; readonly promo?: { readonly id: string; readonly discountPercent: number; readonly endsAt?: string; readonly message: string; }; readonly maxInputTokens?: number; readonly maxOutputTokens?: number; readonly maxContextWindowTokens?: number; readonly capabilities?: { readonly vision?: boolean; readonly toolCalling?: boolean; }; } export interface IChatSessionProviderOptionItem { readonly id: string; readonly name: string; readonly description?: string; readonly detail?: string; readonly locked?: boolean; readonly icon?: ThemeIcon; readonly default?: boolean; readonly slashCommand?: string; readonly tooltip?: string; readonly modelMetadata?: IChatSessionProviderOptionModelMetadata; } export interface IChatSessionProviderOptionGroupCommand { readonly command: string; readonly title: string; readonly tooltip?: string; readonly arguments?: readonly unknown[]; } export interface IChatSessionProviderOptionGroup { readonly id: string; readonly name: string; readonly description?: string; readonly detail?: string; readonly selected?: IChatSessionProviderOptionItem; readonly items: readonly IChatSessionProviderOptionItem[]; /** * A context key expression that controls visibility of this option group picker. * When specified, the picker is only visible when the expression evaluates to true. * The expression can reference other option group values via `chatSessionOption.`. * Example: `"chatSessionOption.models == 'gpt-4'"` */ readonly when?: string; readonly icon?: ThemeIcon; /** * Custom commands to show in the option group's picker UI. * These will be shown in a separate section at the end of the picker. */ readonly commands?: readonly IChatSessionProviderOptionGroupCommand[]; /** * Optional kind hint that controls how the group is presented. * - `'permissions'`: the group's items are surfaced inside the chat permission picker * instead of being rendered as a standalone picker. At most one group per provider * may use this kind; if multiple are declared, the first one (in declaration order) * wins. The group has no UI of its own — it is invisible when the permission * picker is hidden by its own `when` clauses. */ readonly kind?: "permissions"; } export interface IChatSessionsExtensionPoint { readonly type: string; readonly name: string; readonly displayName: string; readonly description: string; /** Groups session-list filters without changing this type's resource or content routing. */ readonly sessionListGroup?: string; /** Hides this type from the Editor harness picker and automatic new-chat selection without affecting existing sessions. */ readonly hideFromSessionTypePicker?: boolean; readonly when?: string; readonly icon?: string | { light: string; dark: string; }; readonly order?: number; readonly alternativeIds?: string[]; readonly welcomeTitle?: string; readonly welcomeMessage?: string; readonly welcomeTips?: string; readonly inputPlaceholder?: string; readonly capabilities?: IChatAgentAttachmentCapabilities; readonly commands?: IChatSessionCommandContribution[]; /** * Chat surfaces where this session type's agent can be selected. * Defaults to the primary Chat surface. */ readonly locations?: ChatAgentLocation[]; readonly canDelegate?: boolean; readonly isReadOnly?: boolean; /** * When set, the chat session will show a filtered mode picker with custom agents * that have a matching `target` property. This enables contributed chat sessions * to reuse the standard agent/mode dropdown with filtered custom agents. * Custom agents without a `target` property are also shown in all filtered lists */ readonly customAgentTarget?: Target; readonly requiresCustomModels?: boolean; /** * Whether this session type supports the synthetic "Auto" model fallback. * Defaults to true. When false and no models are available, the picker * shows a "No models available" state instead of "Auto". * * This is distinct from {@link requiresCustomModels}, which only controls * whether the picker is filtered to the session's own model pool — a * session can own a custom pool yet still support Auto (e.g. the Copilot * CLI agent host). */ readonly supportsAutoModel?: boolean; /** * Logical Agent Host provider ID for Agent Host-backed chat sessions. * For example, both local `agent-host-copilotcli` and remote * `remote-{authority}-copilotcli` sessions use `copilotcli`. */ readonly agentHostProviderId?: string; /** * Whether this type needs a GitHub Copilot account and so is unusable until the user signs in. Set by * Copilot-backed types (Copilot CLI / agent host, cloud agent) where BYOK isn't supported. Defaults to false, so * third-party types that don't depend on Copilot stay usable while signed out. * * May be a function for programmatically-registered types (e.g. agent host) that derive the requirement * dynamically — for instance from the agent's currently-advertised protected resources, re-evaluated whenever * {@link IChatSessionAvailabilityNotifier.notifyChanged} fires. Declaratively-contributed extensions can only * supply a static boolean (parsed from JSON). */ readonly requiresCopilotSignIn?: boolean | (() => boolean); /** * Fires when a functional {@link requiresCopilotSignIn} would return a * different value (e.g. an agent-host agent flipped between proxy and native). * The sessions service re-fires {@link IChatSessionsService.onDidChangeAvailability} * in response. Only meaningful for programmatically-registered contributions — * declaratively-contributed extensions supply a static boolean and omit this. */ readonly onDidChangeRequiresCopilotSignIn?: Event; /** * Whether this session type can delegate to another session. * Defaults to true. */ readonly supportsDelegation?: boolean; /** * Decides whether to automatically attach instruction files to chat requests * for this session type. Defaults to false when not specified. */ readonly autoAttachReferences?: boolean; } export interface IChatSessionItem { readonly resource: URI; readonly label: string; /** * Child chats to present under this session. The parent remains openable as * the session's routing or default chat. */ readonly children?: readonly IChatSessionItem[]; readonly iconPath?: ThemeIcon; readonly badge?: string | IMarkdownString; readonly description?: string | IMarkdownString; readonly status?: ChatSessionStatus; readonly tooltip?: string | IMarkdownString; readonly timing: IChatSessionTiming; readonly changes?: { readonly files: number; readonly insertions: number; readonly deletions: number; } | readonly IChatSessionFileChange[] | readonly IChatSessionFileChange2[]; readonly archived?: boolean; /** Whether a child chat supports archiving independently of its parent. */ readonly canArchive?: boolean; /** * Authoritative read state, set by controllers that own it (see * {@link IChatSessionItemController.setChatSessionItemRead}). Otherwise * `undefined`, and the workbench falls back to its own read tracking. */ readonly isRead?: boolean; readonly metadata?: IChatSessionItemMetadata; /** * Resource identifier the item was previously known by. When set, host-stored * per-resource state (archive, pin, read) recorded under that URI is adopted * forward onto {@link resource} on first state read, and the legacy entry is * removed. Scheme must match {@link resource}'s scheme; otherwise ignored. */ readonly legacyResource?: URI; } export interface IChatSessionItemMetadata { readonly repositoryPath?: string; readonly workingDirectoryPath?: string; readonly firstCheckpointRef?: string; readonly lastCheckpointRef?: string; readonly worktreePath?: string; readonly uncommittedChanges?: number; readonly baseRefOid?: string; readonly headRefOid?: string; readonly branchName?: string; readonly branch?: string; readonly baseBranchName?: string; readonly baseBranch?: string; readonly baseBranchProtected?: boolean; readonly hasGitHubRemote?: boolean; readonly upstreamBranchName?: string; readonly incomingChanges?: number; readonly outgoingChanges?: number; readonly [key: string]: unknown; } export interface IChatSessionFileChange { readonly modifiedUri: URI; readonly originalUri?: URI; readonly insertions: number; readonly deletions: number; readonly reviewed?: boolean; } export interface IChatSessionFileChange2 { readonly uri: URI; readonly originalUri?: URI; readonly modifiedUri?: URI; readonly insertions: number; readonly deletions: number; readonly reviewed?: boolean; } export type IChatSessionHistoryItem = { id?: string; type: "request"; prompt: string; participant: string; metadata?: Record; command?: string; variableData?: IChatRequestVariableData; modelId?: string; modelConfiguration?: IStringDictionary; timestamp?: number; modeInstructions?: IChatRequestModeInstructions; isSystemInitiated?: boolean; /** The feature that submitted this request on the user's behalf. */ requestSource?: ChatRequestSource; artifactRequest?: IChatRequestModel["artifactRequest"]; isHidden?: boolean; isRequestHidden?: boolean; systemInitiatedLabel?: string; isTerminalRequest?: boolean; origin?: IChatRequestOrigin; } | { type: "response"; parts: IChatProgress[]; participant: string; details?: string; elapsedMs?: number; completedAt?: number; /** * Error details for a failed response. Rendered as a proper chat error * (including the quota-exceeded upgrade affordance), mirroring the live * agent result's `errorDetails`. */ errorDetails?: IChatResponseErrorDetails; }; export type IChatSessionRequestHistoryItem = Extract; /** Excludes model and usage decoration when comparing recorded and live transcript content. */ export declare function getChatSessionHistoryContent(history: readonly IChatSessionHistoryItem[]): readonly IChatSessionHistoryItem[]; export interface IChatSessionServerRequest { readonly metadata?: Record; /** * Identifier of the backing provider turn. */ readonly id: string; readonly prompt: string; readonly variableData?: IChatRequestVariableData; readonly modelId?: string; readonly modelConfiguration?: IStringDictionary; readonly timestamp?: number; readonly isSystemInitiated?: boolean; /** The feature that submitted this request on the user's behalf. */ readonly requestSource?: ChatRequestSource; readonly artifactRequest?: IChatRequestModel["artifactRequest"]; readonly isHidden?: boolean; readonly isRequestHidden?: boolean; readonly systemInitiatedLabel?: string; readonly isTerminalRequest?: boolean; /** Reopen the existing request with this id instead of adding another request. */ readonly resume?: boolean; /** An earlier request that the provider removed and this request replaces; it is removed when this request is added. */ readonly replacesRequestId?: string; readonly origin?: IChatRequestOrigin; } /** * Whether `text` runs as a terminal command for the given command `prefix` * (e.g. `!`) — it starts with the prefix and has a non-empty command after it. * Mirrors the agent host's bang parser, where a lone `!` (or `!` followed only * by whitespace) is forwarded to the agent rather than executed. */ export declare function isTerminalCommandPrompt(text: string, prefix: string | undefined): boolean; /** * A set of well-known session types */ export declare namespace SessionType { const CopilotCLI = "copilotcli"; const CopilotCloud = "copilot-cloud-agent"; /** Cloud sessions created in a new sandbox; replaces {@link CopilotCloud} in the picker while registered. */ const CloudSandbox = "cloud-sandbox"; const Local = "local"; const Codex = "openai-codex"; const Growth = "copilot-growth"; const AgentHostCopilot = "agent-host-copilotcli"; const AgentHostClaude = "agent-host-claude"; const AgentHostCodex = "agent-host-codex"; } /** * Returns whether the given session type is a local agent host target. */ export declare function isLocalAgentHostTarget(target: string): boolean; /** * Returns whether the given session type is a remote agent host target. * * Note: The `remote-` prefix convention is established by * `RemoteAgentHostContribution` which generates session types as * `remote-{sanitizedAddress}-{provider}`. If future remote providers that * are NOT agent hosts need a different prefix, this function must be updated. */ export declare function isRemoteAgentHostTarget(target: string): boolean; /** * Returns whether the given session type is an agent host target. * Matches the local agent host (`agent-host-*`) and remote agent hosts (`remote-*`). */ export declare function isAgentHostTarget(target: string): boolean; export declare function isAgentHostSessionResource(resource: URI): boolean; /** * Returns why models cannot be added for the given chat session type (harness), or `undefined` when they can. * Added models are extension-provided BYOK models, which a remotely running Copilot agent host cannot reach: * either a remote agent host session type, or the Copilot harness of a remote editor window. */ export declare function getAddModelsUnavailableReason(sessionType: string | undefined, remoteAuthority: string | undefined): string | undefined; /** Returns the registered agent implementation handling the session. */ export declare function getAgentHostProviderForTelemetry(sessionType: string | undefined, chatSessionsService: IChatSessionsService): string | undefined; /** * The session type used for local agent chat sessions. */ export declare const localChatSessionType = "local"; /** * Provider-neutral intent for the first user message in a forked session. * * The session provider translates this into its own transport message only * after it has performed its normal client-side message preparation. */ export interface IChatSessionInitialMessage { readonly text: string; /** * The original input offset at which {@link text} starts. Providers use it * solely to rebase attachment text-reference ranges after a command prefix * has been removed; it never changes resource-selection coordinates. */ readonly textOffset?: number; /** * Context captured from the source composer before navigation or reset. * Model and agent selection deliberately do not live here: providers inherit * those from the source conversation's actual turns. */ readonly requestOptions?: Pick; } /** * Returns the composer variables that belong to an initial fork message. * Text references are rebased after the fork command prefix is removed; resource * selections have no text coordinate and are retained. */ export declare function getChatSessionInitialMessageVariables(intent: IChatSessionInitialMessage): IChatRequestVariableEntry[]; export interface IChatSessionForkOptions { readonly title?: string; readonly initialMessage?: IChatSessionInitialMessage; /** * Exact last source turn to include, overriding the request-item's exclusive boundary. * An active request resolves to the last completed turn; other explicit selections must be preserved. */ readonly sourceRequestId?: string; } /** * A fork with an unknown outcome and a client-selected target to inspect. * The initial message must never be retried automatically. */ export declare class ChatSessionForkError extends Error { readonly target: URI; readonly cause: unknown; constructor(target: URI, cause: unknown); } export interface IChatSession extends IDisposable { readonly onWillDispose: Event; readonly sessionResource: URI; readonly title?: string; readonly history: readonly IChatSessionHistoryItem[]; /** Initial history loading failed; any rendered error or partial history is not an authoritative snapshot. */ readonly historyLoadError?: { readonly message: string; /** A missing root session may be initialized only after recorded history confirms it has no conversation. */ readonly canInitializeSession?: boolean; }; /** * Updated persisted transcript; applying it must preserve the draft and locally running requests. * Unchanged turns must not resurrect locally removed requests. */ readonly onDidChangeHistory?: Event; /** Updates model and usage decoration in place for otherwise unchanged turns with stable request IDs. */ readonly preserveHistoryItemIdentity?: boolean; readonly options?: ReadonlyChatSessionOptionsMap; readonly progressObs?: IObservable; readonly isCompleteObs?: IObservable; /** Active shells across all turns, or undefined when the provider does not report them. */ readonly backgroundShellCount?: IObservable; readonly isReadOnly?: IObservable; /** Temporarily prevents sending while keeping the draft visible and editable. */ readonly isInputBlocked?: IObservable; readonly historyStatus?: IObservable; readonly modelConfigurationState?: IObservable; readonly canvasContext?: IObservable; /** Persisted source metadata for a side chat, including live source title updates. */ readonly sideChatOrigin?: IObservable; /** Recheck a temporary input restriction without sending a message. */ readonly retryInput?: () => Promise; readonly interruptActiveResponseCallback?: () => Promise; /** Claims this client's tools before an approved background request is queued directly on the host. */ prepareForClientTools?: (token: CancellationToken) => Promise; /** * Event fired when the server initiates a new request (e.g. from a consumed * queued message). The consumer should create a new request+response pair in * the model and prepare to receive progress via {@link progressObs}. */ readonly onDidStartServerRequest?: Event; /** * Editing session transferred from a previously-untitled chat session in `onDidCommitChatSessionItem`. */ transferredState?: { readonly editingSession: IChatEditingSession | undefined; readonly inputState: ISerializableChatModelInputState | undefined; }; requestHandler?: (request: IChatAgentRequest, progress: (progress: IChatProgress[]) => void, history: any[], // TODO: Nail down types token: CancellationToken) => Promise; /** * Forks the session from the given request point. * @param request The request history item to fork from, or undefined to fork from the end. * @param token Cancellation token. * @param options Optional fork options. * @returns The forked session item. The promise is rejected if forking fails. */ forkSession?: (request: IChatSessionRequestHistoryItem | undefined, token: CancellationToken, options?: IChatSessionForkOptions) => Promise; /** Creates a side chat anchored to the given source turn, without adding to the source conversation. */ createSideChat?: (turnId: string, token: CancellationToken, selection?: IChatSideChatSelection) => Promise; /** * Renames the session. * @param title The new title for the session. * @param token Cancellation token. * @returns A promise that resolves once the rename has been dispatched. The promise is rejected if renaming fails. */ renameSession?: (title: string, token: CancellationToken) => Promise; } export interface IChatSessionContentProvider { /** Each returned session is independently disposable and must be released by its caller. */ provideChatSessionContent(sessionResource: URI, token: CancellationToken): Promise; /** Updates provider-owned metadata for a session. */ updateChatSessionMetadata?(sessionResource: URI, metadata: Record): void; /** Resolves a parsed response Markdown URI in its owning session, including file image paths, before sanitization. */ resolveChatResponseUri?(sessionResource: URI, href: string, kind: "link" | "image"): string; /** * Optional. Compute completion items for an input being composed in this * session. Returning `undefined` lets the workbench fall back to its * default in-process completion providers. */ provideChatInputCompletions?(sessionResource: URI, params: IChatInputCompletionsParams, token: CancellationToken): Promise; /** * Optional. Trigger characters that, when typed in the chat input, * SHOULD cause the workbench to issue a `provideChatInputCompletions` * request. Used to register a Monaco completion provider scoped to * sessions handled by this content provider. */ provideChatInputCompletionTriggerCharacters?(): Promise; } /** * Inputs for {@link IChatSessionContentProvider.provideChatInputCompletions} * and {@link IChatSessionsService.provideChatInputCompletions}. */ export interface IChatInputCompletionsParams { /** * The complete text of the input being completed (e.g. the user message * the user is currently composing). */ readonly text: string; /** * The character offset within {@link text} at which the completion is * requested, measured in UTF-16 code units. MUST satisfy * `0 <= offset <= text.length`. */ readonly offset: number; } /** * A neutral completion-item shape returned by * {@link IChatSessionContentProvider.provideChatInputCompletions}. The * workbench-side completion glue maps these into Monaco completion items * and the corresponding chat-input attachment. */ export interface IChatInputCompletionItem { /** Text inserted into the input when this item is accepted. */ readonly insertText: string; /** * Optional display label shown in the completion picker. When omitted, the * workbench displays {@link insertText}. Set this when the inserted text * differs from the label — e.g. an action item that inserts nothing * (`insertText: ''`) but should still be shown to the user. */ readonly label?: string; /** * Half-open range `[start, end)` in the *current* input text that * {@link insertText} replaces. Positions use 1-based `lineNumber` and * `column` to match Monaco. When omitted, the workbench replaces the * word at the cursor. */ readonly start?: IPosition; readonly end?: IPosition; /** Attachment associated with the item. */ readonly attachment: IChatInputCompletionTextAttachment | IChatInputCompletionResourceAttachment | IChatInputCompletionCommandAttachment | IChatInputCompletionSkillAttachment | IChatInputCompletionChatAttachment; } /** * Plain text associated with a completion item. */ export interface IChatInputCompletionTextAttachment { readonly kind: "text"; } /** * Resource attachment associated with a completion item. The workbench * adds it to the input's variable model when the item is accepted. */ export interface IChatInputCompletionResourceAttachment { readonly kind: "resource"; readonly uri: URI; readonly displayName?: string; readonly isDirectory?: boolean; /** * Implementation-defined metadata that MUST be preserved by the * workbench when the accepted completion is sent back as part of a * user message attachment. */ readonly _meta?: Record; } /** * Command attachment associated with a completion item. */ export interface IChatInputCompletionCommandAttachment { readonly kind: "command"; readonly command: string; readonly isSkill?: true; readonly description: string; readonly retriggerSuggestions?: true; readonly submitOnAccept?: true; /** * Implementation-defined metadata that MUST be preserved by the * workbench when the accepted completion is sent back as part of a * user message attachment. */ readonly _meta?: Record; } /** * Skill attachment associated with a completion item. The workbench * adds it to the input's variable model when the item is accepted. */ export interface IChatInputCompletionSkillAttachment { readonly kind: "skill"; readonly uri: URI; readonly displayName?: string; readonly description?: string; /** * Implementation-defined metadata that MUST be preserved by the * workbench when the accepted completion is sent back as part of a * user message attachment. */ readonly _meta?: Record; } /** * Chat attachment associated with a completion item. References another chat's * transcript through a fixed completed turn. The workbench adds it to the * input's variable model when the item is accepted so it round-trips back to * the provider as a chat attachment on the outgoing user message. */ export interface IChatInputCompletionChatAttachment { readonly kind: "chat"; /** * The opaque **backend** chat URI of the referenced chat — the exact value * carried on `MessageChatAttachment.resource`. The workbench stores it * verbatim on the accepted reference entry (`value`) and round-trips it back * on send; it never parses or constructs it. */ readonly uri: URI; /** * The last completed turn included in the referenced transcript, when the * reference is pinned to a specific turn. Omitted for references that resolve * to the referenced chat's latest completed turn at accept time (e.g. a * reference produced by dragging a chat into the input). */ readonly endTurn?: string; /** The chat title, used as the display label. */ readonly title: string; /** Display label shown in the completion picker; defaults to {@link title}. */ readonly displayName?: string; /** * Implementation-defined metadata that MUST be preserved by the * workbench when the accepted completion is sent back as part of a * user message attachment. */ readonly _meta?: Record; } /** * Result of {@link IChatSessionContentProvider.provideChatInputCompletions}. */ export interface IChatInputCompletionsResult { readonly items: readonly IChatInputCompletionItem[]; } export interface IChatNewSessionRequest { readonly prompt: string; readonly command?: string; readonly initialSessionOptions?: ReadonlyChatSessionOptionsMap; /** VS Code-specific metadata forwarded to Agent Host session creation. */ readonly _meta?: Record; /** * Marks this session as a throwaway UI surface that must not be retained or listed. */ readonly isEphemeral?: boolean; /** * The chat-input session resource the user was typing into when this * request was issued. Set when the chat infrastructure is rewriting an * untitled session URI to a real one on first send. Controllers can use * this to bridge any pre-creation state they tracked under the old URI * (e.g. provisional agent-host sessions) to the new resource that the * controller returns. */ readonly untitledResource?: URI; } export interface IChatSessionItemsDelta { readonly addedOrUpdated?: readonly IChatSessionItem[]; /** Sessions no longer provided by the controller. Retained content is disposed and pending resolutions are cancelled. */ readonly removed?: readonly URI[]; } /** Automatic refreshes may reuse fresh data instead of starting another fetch. */ export type ChatSessionRefreshReason = "initial" | "automatic" | "manual"; export interface IChatSessionItemController { readonly onDidChangeChatSessionItems: Event; get items(): readonly IChatSessionItem[]; refresh(token: CancellationToken, reason?: ChatSessionRefreshReason): Promise; newChatSessionItem?(request: IChatNewSessionRequest, token: CancellationToken): Promise; /** * Notifies the controller that a locally-created session now exists on its backend. */ notifySessionMaterialized?(resource: URI): void; getNewChatSessionInputState?(sessionResource: URI, token: CancellationToken): Promise; resolveChatSessionItem?(resource: URI, token: CancellationToken): Promise; /** * Permanently delete the session identified by `resource`. Implementations should tear down any backend state for * the session. The controller is expected to fire an `onDidChangeChatSessionItems` event with the removed resource * as a result of the deletion. */ deleteChatSessionItem?(resource: URI, token: CancellationToken): Promise; /** * Set the authoritative archived state for the session identified by `resource`. */ setChatSessionItemArchived?(resource: URI, archived: boolean): void; /** * Set the authoritative read state for the session identified by `resource`. * Implementing this declares that the controller, not the workbench, owns read * state — letting it be shared with other clients on the same backend. The * controller reflects the new value back via {@link IChatSessionItem.isRead}. */ setChatSessionItemRead?(resource: URI, isRead: boolean): void; } export interface IChatSessionOptionsChangeEvent { readonly sessionResource: URI; readonly updates: ReadonlyMap; } export type ResolvedChatSessionsExtensionPoint = Omit & { readonly icon: ThemeIcon | URI | undefined; }; /** * Session options as key-value pairs. * * Keys correspond to option group IDs (e.g., 'models', 'subagents') and values are either the selected option item IDs (string) or full option items (for locked state). */ export type ChatSessionOptionsMap = Map; export declare namespace ChatSessionOptionsMap { function fromRecord(obj: { [key: string]: string | IChatSessionProviderOptionItem; }): ChatSessionOptionsMap; function toRecord(map: ReadonlyChatSessionOptionsMap): Record; function toStrValueArray(map: ReadonlyChatSessionOptionsMap | undefined): Array<{ optionId: string; value: string; }> | undefined; } /** * Readonly version of {@link ChatSessionOptionsMap} */ export type ReadonlyChatSessionOptionsMap = ReadonlyMap; export interface IChatSessionCustomizationItem { readonly label: string; readonly description?: string; readonly uri: URI; readonly storageLocation: number; readonly icon?: ThemeIcon; } export interface IChatSessionCustomizationItemGroup { readonly id: string; readonly items: IChatSessionCustomizationItem[]; readonly commands?: readonly { readonly id: string; readonly title: string; readonly arguments?: readonly unknown[]; }[]; readonly itemCommands?: readonly { readonly id: string; readonly title: string; readonly arguments?: readonly unknown[]; }[]; } export interface IChatSessionCustomizationsProvider { readonly onDidChangeCustomizations: Event; provideCustomizations(token: CancellationToken): Promise; } export interface IChatSessionCommitEvent { /** The original (untitled) session resource. */ readonly original: URI; /** The committed (real) session resource. */ readonly committed: URI; } export declare function isSessionInProgressStatus(state: ChatSessionStatus): boolean; export declare function isIChatSessionFileChange2(obj: unknown): obj is IChatSessionFileChange2;