@@ -100,14 +100,36 @@ declare module 'vscode' {
100100 readonly command ?: string ;
101101 } ;
102102
103+ /**
104+ * @deprecated Use `inputState` instead
105+ */
103106 readonly sessionOptions : ReadonlyArray < { optionId : string ; value : string | ChatSessionProviderOptionItem } > ;
107+
108+ readonly inputState : ChatSessionInputState ;
104109 }
105110
106111 /**
107112 * Extension callback invoked when a new chat session is started.
108113 */
109114 export type ChatSessionItemControllerNewItemHandler = ( context : ChatSessionItemControllerNewItemHandlerContext , token : CancellationToken ) => Thenable < ChatSessionItem > ;
110115
116+ /**
117+ * Extension callback invoked to get the input state for a chat session.
118+ *
119+ * @param sessionResource The resource of the chat session to get the input state for. `undefined` indicates this is
120+ * for a blank chat editor that is not yet associated with a session.
121+ * @param context Additional context
122+ * @param token Cancellation token.
123+ *
124+ * @return A new chat session input state. This should be created using {@link ChatSessionItemController.createChatSessionInputState}.
125+ */
126+ export type ChatSessionControllerGetInputState = ( sessionResource : Uri | undefined , context : {
127+ /**
128+ * The previous input state for the session.
129+ */
130+ readonly previousInputState : ChatSessionInputState | undefined ;
131+ } , token : CancellationToken ) => Thenable < ChatSessionInputState > | ChatSessionInputState ;
132+
111133 /**
112134 * Extension callback invoked to fork an existing chat session item managed by a {@linkcode ChatSessionItemController}.
113135 *
@@ -150,6 +172,11 @@ declare module 'vscode' {
150172 */
151173 readonly refreshHandler : ChatSessionItemControllerRefreshHandler ;
152174
175+ /**
176+ * Fired when an item's archived state changes.
177+ */
178+ readonly onDidChangeChatSessionItemState : Event < ChatSessionItem > ;
179+
153180 /**
154181 * Invoked when a new chat session is started.
155182 *
@@ -168,9 +195,14 @@ declare module 'vscode' {
168195 forkHandler ?: ChatSessionItemControllerForkHandler ;
169196
170197 /**
171- * Fired when an item's archived state changes .
198+ * Gets the input state for a chat session .
172199 */
173- readonly onDidChangeChatSessionItemState : Event < ChatSessionItem > ;
200+ getChatSessionInputState ?: ChatSessionControllerGetInputState ;
201+
202+ /**
203+ * Create a new managed ChatSessionInputState object.
204+ */
205+ createChatSessionInputState ( groups : ChatSessionProviderOptionGroup [ ] ) : ChatSessionInputState ;
174206 }
175207
176208 /**
@@ -321,6 +353,9 @@ declare module 'vscode' {
321353 metadata ?: { readonly [ key : string ] : any } ;
322354 }
323355
356+ /**
357+ * @deprecated Use `ChatSessionChangedFile2` instead
358+ */
324359 export class ChatSessionChangedFile {
325360 /**
326361 * URI of the file.
@@ -468,11 +503,15 @@ declare module 'vscode' {
468503 */
469504 export interface ChatSessionContentProvider {
470505 /**
506+ * @deprecated
507+ *
471508 * Event that the provider can fire to signal that the options for a chat session have changed.
472509 */
473510 readonly onDidChangeChatSessionOptions ?: Event < ChatSessionOptionChangeEvent > ;
474511
475512 /**
513+ * @deprecated
514+ *
476515 * Event that the provider can fire to signal that the available provider options have changed.
477516 *
478517 * When fired, the editor will re-query {@link ChatSessionContentProvider.provideChatSessionProviderOptions}
@@ -492,17 +531,26 @@ declare module 'vscode' {
492531 * @return The {@link ChatSession chat session} associated with the given URI.
493532 */
494533 provideChatSessionContent ( resource : Uri , token : CancellationToken , context : {
534+ readonly inputState : ChatSessionInputState ;
535+
536+ /**
537+ * @deprecated Use `inputState` instead
538+ */
495539 readonly sessionOptions : ReadonlyArray < { optionId : string ; value : string | ChatSessionProviderOptionItem } > ;
496540 } ) : Thenable < ChatSession > | ChatSession ;
497541
498542 /**
543+ * @deprecated
544+ *
499545 * @param resource Identifier of the chat session being updated.
500546 * @param updates Collection of option identifiers and their new values. Only the options that changed are included.
501547 * @param token A cancellation token that can be used to cancel the notification if the session is disposed.
502548 */
503549 provideHandleOptionsChange ?( resource : Uri , updates : ReadonlyArray < ChatSessionOptionUpdate > , token : CancellationToken ) : void ;
504550
505551 /**
552+ * @deprecated
553+ *
506554 * Called as soon as you register (call me once)
507555 */
508556 provideChatSessionProviderOptions ?( token : CancellationToken ) : Thenable < ChatSessionProviderOptions > ;
@@ -614,10 +662,15 @@ declare module 'vscode' {
614662 */
615663 readonly description ?: string ;
616664
665+ /**
666+ * The currently selected option for this group. This must be one of the items provided in the `items` array.
667+ */
668+ readonly selected ?: ChatSessionProviderOptionItem ;
669+
617670 /**
618671 * The selectable items within this option group.
619672 */
620- readonly items : ChatSessionProviderOptionItem [ ] ;
673+ readonly items : readonly ChatSessionProviderOptionItem [ ] ;
621674
622675 /**
623676 * A context key expression that controls when this option group picker is visible.
@@ -654,6 +707,9 @@ declare module 'vscode' {
654707 * Optional commands.
655708 *
656709 * These commands will be displayed at the bottom of the group.
710+ *
711+ * For extensions that use the new `provideChatSessionInputState` API, these commands are passed a context object
712+ * `{ inputState: ChatSessionInputState; sessionResource: Uri | undefined }` that they can use to determine which session and options they are being invoked for.
657713 */
658714 readonly commands ?: Command [ ] ;
659715 }
@@ -672,4 +728,21 @@ declare module 'vscode' {
672728 */
673729 readonly newSessionOptions ?: Record < string , string | ChatSessionProviderOptionItem > ;
674730 }
731+
732+ /**
733+ * Represents the current state of user inputs for a chat session.
734+ */
735+ export interface ChatSessionInputState {
736+ /**
737+ * Fired when the input state is changed by the user.
738+ */
739+ readonly onDidChange : Event < void > ;
740+
741+ /**
742+ * The groups of options to show in the UI for user input.
743+ *
744+ * To update the groups you must replace the entire `groups` array with a new array.
745+ */
746+ groups : readonly ChatSessionProviderOptionGroup [ ] ;
747+ }
675748}
0 commit comments