@@ -108,6 +108,20 @@ declare module 'vscode' {
108108 */
109109 export type ChatSessionItemControllerNewItemHandler = ( context : ChatSessionItemControllerNewItemHandlerContext , token : CancellationToken ) => Thenable < ChatSessionItem > ;
110110
111+ /**
112+ * Extension callback invoked to fork an existing chat session item managed by a {@linkcode ChatSessionItemController}.
113+ *
114+ * The handler should create a new session on the provider's backend and
115+ * return the new {@link ChatSessionItem} representing the forked session.
116+ *
117+ * @param sessionResource The resource of the chat session being forked.
118+ * @param request The request turn that marks the fork point. The forked session includes all turns
119+ * upto this request turn and includes this request turn itself. If undefined, fork the full session.
120+ * @param token A cancellation token.
121+ * @returns The forked session item.
122+ */
123+ export type ChatSessionItemControllerForkHandler = ( sessionResource : Uri , request : ChatRequestTurn2 | undefined , token : CancellationToken ) => Thenable < ChatSessionItem > | ChatSessionItem ;
124+
111125 /**
112126 * Manages chat sessions for a specific chat session type
113127 */
@@ -145,6 +159,14 @@ declare module 'vscode' {
145159 */
146160 newChatSessionItemHandler ?: ChatSessionItemControllerNewItemHandler ;
147161
162+ /**
163+ * Invoked when an existing chat session is forked.
164+ *
165+ * When both this handler and {@linkcode ChatSession.forkHandler} are registered,
166+ * this handler takes precedence.
167+ */
168+ forkHandler ?: ChatSessionItemControllerForkHandler ;
169+
148170 /**
149171 * Fired when an item's archived state changes.
150172 */
@@ -399,6 +421,22 @@ declare module 'vscode' {
399421 // TODO: Revisit this to align with code.
400422 // TODO: pass in options?
401423 readonly requestHandler : ChatRequestHandler | undefined ;
424+
425+ /**
426+ * Handles a request to fork the session.
427+ *
428+ * The handler should create a new session on the provider's backend and
429+ * return the new {@link ChatSessionItem} representing the forked session.
430+ *
431+ * @deprecated Use {@linkcode ChatSessionItemController.forkHandler} instead. This remains supported for backwards compatibility.
432+ *
433+ * @param sessionResource The resource of the chat session being forked.
434+ * @param request The request turn that marks the fork point. The forked session includes all turns
435+ * until this request turn and includes this request turn itself. If undefined, fork the full session.
436+ * @param token A cancellation token.
437+ * @returns The forked session item.
438+ */
439+ readonly forkHandler ?: ChatSessionItemControllerForkHandler ;
402440 }
403441
404442 /**
@@ -488,10 +526,11 @@ declare module 'vscode' {
488526 *
489527 * @param scheme The uri-scheme to register for. This must be unique.
490528 * @param provider The provider to register.
529+ * @param defaultChatParticipant The default {@link ChatParticipant chat participant} used in sessions provided by this provider.
491530 *
492531 * @returns A disposable that unregisters the provider when disposed.
493532 */
494- export function registerChatSessionContentProvider ( scheme : string , provider : ChatSessionContentProvider , chatParticipant : ChatParticipant , capabilities ?: ChatSessionCapabilities ) : Disposable ;
533+ export function registerChatSessionContentProvider ( scheme : string , provider : ChatSessionContentProvider , defaultChatParticipant : ChatParticipant , capabilities ?: ChatSessionCapabilities ) : Disposable ;
495534 }
496535
497536 export interface ChatContext {
0 commit comments