Skip to content

Commit dea0fb9

Browse files
authored
feat(types): add prompt input option change (#449)
1 parent d914bec commit dea0fb9

File tree

6 files changed

+26
-0
lines changed

6 files changed

+26
-0
lines changed

runtimes/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ The runtime supports chat by default
189189
| Send request to list the conversations available in history: all or based on filter if provided. As there can be several filter options used, the filter in the request is a map of filter option ids to corresponding values. Possible filter options are expected to be provided in the previous `listConversations` result before filter can be used. | `aws/chat/listConversations` | `ListConversationsParams` | [Request](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#requestMessage) Client to Server | `ListConversationsResult` |
190190
| Send conversation or conversation action click event. If no action is provided, the default action is "open". | `aws/chat/conversationClick` | `ConversationClickParams` | [Request](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#requestMessage) Client to Server | `ConversationClickResult` |
191191
| Send server-initiated chat metadata updates. The interface is designed to be extensible for future chat options, currently focused on notification for developer profile changes. | `aws/chat/chatOptionsUpdate` | `ChatOptionsUpdateParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Server to Client | n/a |
192+
| Send prompt input option event changes | `aws/chat/promptInputOptionChange` | `PromptInputOptionChangeParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Client to Server | n/a |
192193
193194
194195
```ts

runtimes/protocol/chat.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ import {
6262
TAB_BAR_ACTION_REQUEST_METHOD,
6363
ChatOptionsUpdateParams,
6464
CHAT_OPTIONS_UPDATE_NOTIFICATION_METHOD,
65+
PromptInputOptionChangeParams,
66+
PROMPT_INPUT_OPTION_CHANGE_METHOD,
6567
} from './lsp'
6668

6769
export const chatRequestType = new AutoParameterStructuresProtocolRequestType<
@@ -180,3 +182,8 @@ export const getSerializedChatRequestType = new ProtocolRequestType<
180182
void,
181183
void
182184
>(GET_SERIALIZED_CHAT_REQUEST_METHOD)
185+
186+
export const promptInputOptionChangeNotificationType = new ProtocolNotificationType<
187+
PromptInputOptionChangeParams,
188+
void
189+
>(PROMPT_INPUT_OPTION_CHANGE_METHOD)

runtimes/runtimes/base-runtime.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import {
5252
getSerializedChatRequestType,
5353
tabBarActionRequestType,
5454
chatOptionsUpdateType,
55+
promptInputOptionChangeNotificationType,
5556
} from '../protocol'
5657
import { createConnection } from 'vscode-languageserver/browser'
5758
import {
@@ -173,6 +174,8 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
173174
onConversationClick: handler => lspConnection.onRequest(conversationClickRequestType.method, handler),
174175
getSerializedChat: params => lspConnection.sendRequest(getSerializedChatRequestType.method, params),
175176
onTabBarAction: handler => lspConnection.onRequest(tabBarActionRequestType.method, handler),
177+
onPromptInputOptionChange: handler =>
178+
lspConnection.onNotification(promptInputOptionChangeNotificationType.method, handler),
176179
}
177180

178181
const identityManagement: IdentityManagement = {

runtimes/runtimes/chat/baseChat.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ import {
5959
tabBarActionRequestType,
6060
chatOptionsUpdateType,
6161
ChatOptionsUpdateParams,
62+
PromptInputOptionChangeParams,
63+
promptInputOptionChangeNotificationType,
6264
} from '../../protocol'
6365
import { Chat } from '../../server-interface'
6466

@@ -166,4 +168,8 @@ export class BaseChat implements Chat {
166168
public onTabBarAction(handler: RequestHandler<TabBarActionParams, TabBarActionResult, void>) {
167169
this.connection.onRequest(tabBarActionRequestType.method, handler)
168170
}
171+
172+
public onPromptInputOptionChange(handler: NotificationHandler<PromptInputOptionChangeParams>) {
173+
this.connection.onNotification(promptInputOptionChangeNotificationType.method, handler)
174+
}
169175
}

runtimes/server-interface/chat.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
TabBarActionParams,
3535
TabBarActionResult,
3636
ChatOptionsUpdateParams,
37+
PromptInputOptionChangeParams,
3738
} from '../protocol'
3839

3940
/**
@@ -69,4 +70,5 @@ export type Chat = {
6970
sendContextCommands: (params: ContextCommandParams) => void
7071
onCreatePrompt: (handler: NotificationHandler<CreatePromptParams>) => void
7172
onInlineChatResult: (handler: NotificationHandler<InlineChatResultParams>) => void
73+
onPromptInputOptionChange: (handler: NotificationHandler<PromptInputOptionChangeParams>) => void
7274
}

types/chat.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const FILE_CLICK_NOTIFICATION_METHOD = 'aws/chat/fileClick'
1919
export const INLINE_CHAT_REQUEST_METHOD = 'aws/chat/sendInlineChatPrompt'
2020
export const TAB_BAR_ACTION_REQUEST_METHOD = 'aws/chat/tabBarAction'
2121
export const CHAT_OPTIONS_UPDATE_NOTIFICATION_METHOD = 'aws/chat/chatOptionsUpdate'
22+
export const PROMPT_INPUT_OPTION_CHANGE_METHOD = 'aws/chat/promptInputOptionChange'
2223
// context
2324
export const CONTEXT_COMMAND_NOTIFICATION_METHOD = 'aws/chat/sendContextCommands'
2425
export const CREATE_PROMPT_NOTIFICATION_METHOD = 'aws/chat/createPrompt'
@@ -416,3 +417,9 @@ export interface GetSerializedChatParams extends TabEventParams {
416417
export interface GetSerializedChatResult {
417418
content: string
418419
}
420+
421+
export interface PromptInputOptionChangeParams {
422+
tabId: string
423+
optionsValues: Record<string, string>
424+
eventId?: string
425+
}

0 commit comments

Comments
 (0)