Skip to content

Commit ea7d98f

Browse files
authored
revert: revert add support for pinned context and rules
This reverts commit ce49c30.
1 parent 5b29354 commit ea7d98f

File tree

6 files changed

+179
-2
lines changed

6 files changed

+179
-2
lines changed

runtimes/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,17 @@ The runtime supports chat by default
191191
| Send chat messages and tab state update to specific tab. Depending on new vs existing`messageId` within `ChatMessage` message, the massgage will be added or updated. | `aws/chat/sendChatUpdate` | `ChatUpdateParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Server to Client | n/a |
192192
| Send file or file action click event. | `aws/chat/fileClick` | `FileClickParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Client to Server | n/a |
193193
| Send or update context commands that customer can attach to their prompt request (available via `@` in chat UI). | `aws/chat/sendContextCommands` | `ContextCommandParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Server to Client | n/a |
194-
| Send create prompt event that triggers new prompt creation flow on server. | `aws/chat/createPrompt` | `CreatePromptParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Client to Server | n/a |
194+
| Send create prompt event that triggers new prompt or rule creation flow on server. | `aws/chat/createPrompt` | `CreatePromptParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Client to Server | n/a |
195195
| 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` |
196196
| 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` |
197197
| Send request to list the MCP servers available: all or based on filter if provided. Similar to conversations, the filter in the request is a map of filter option ids to corresponding values. | `aws/chat/listMcpServers` | `ListMcpServersParams` | [Request](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#requestMessage) Client to Server | `ListMcpServersResult` |
198198
| Send MCP server or MCP server action click event. If no action is provided, the default action is "select". | `aws/chat/mcpServerClick` | `McpServerClickParams` | [Request](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#requestMessage) Client to Server | `McpServerClickResult` |
199+
| Send pinned context to client. Pinned context contains context commands that are pinned to the current tab. | `aws/chat/sendPinnedContext` | `PinnedContextParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Server to Client | n/a |
200+
| Notify server that pinned context has been added by the client. | `aws/chat/pinnedContextAdd` | `PinnedContextParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Client to Server | n/a |
201+
| Notify server that pinned context has been removed by the client. | `aws/chat/pinnedContextRemove` | `PinnedContextParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Client to Server | n/a |
202+
| Notify server that active editor has changed. | `aws/chat/activeEditorChanged` | `ActiveEditorChangedParams` | [Notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notificationMessage) Client to Server | n/a |
203+
| Send request to list the rules available for a specific tab. | `aws/chat/listRules` | `ListRulesParams` | [Request](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#requestMessage) Client to Server | `ListRulesResult` |
204+
| Send rule or rule folder click event. | `aws/chat/ruleClick` | `RuleClickParams` | [Request](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#requestMessage) Client to Server | `RuleClickResult` |
199205
| 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 |
200206
| 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 |
201207

runtimes/protocol/chat.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import {
4747
CREATE_PROMPT_NOTIFICATION_METHOD,
4848
CreatePromptParams,
4949
INLINE_CHAT_RESULT_NOTIFICATION_METHOD,
50+
PINNED_CONTEXT_NOTIFICATION_METHOD,
5051
InlineChatResultParams,
5152
ListConversationsParams,
5253
ListConversationsResult,
@@ -73,6 +74,17 @@ import {
7374
McpServerClickParams,
7475
McpServerClickResult,
7576
MCP_SERVER_CLICK_REQUEST_METHOD,
77+
ListRulesParams,
78+
RuleClickParams,
79+
RULE_CLICK_REQUEST_METHOD,
80+
LIST_RULES_REQUEST_METHOD,
81+
ListRulesResult,
82+
RuleClickResult,
83+
PinnedContextParams,
84+
PINNED_CONTEXT_ADD_NOTIFICATION_METHOD,
85+
PINNED_CONTEXT_REMOVE_NOTIFICATION_METHOD,
86+
ActiveEditorChangedParams,
87+
ACTIVE_EDITOR_CHANGED_NOTIFICATION_METHOD,
7688
} from './lsp'
7789

7890
export const chatRequestType = new AutoParameterStructuresProtocolRequestType<
@@ -154,6 +166,36 @@ export const inlineChatResultNotificationType = new ProtocolNotificationType<Inl
154166
INLINE_CHAT_RESULT_NOTIFICATION_METHOD
155167
)
156168

169+
// pinned context
170+
export const pinnedContextNotificationType = new ProtocolNotificationType<PinnedContextParams, void>(
171+
PINNED_CONTEXT_NOTIFICATION_METHOD
172+
)
173+
export const onPinnedContextAddNotificationType = new ProtocolNotificationType<PinnedContextParams, void>(
174+
PINNED_CONTEXT_ADD_NOTIFICATION_METHOD
175+
)
176+
export const onPinnedContextRemoveNotificationType = new ProtocolNotificationType<PinnedContextParams, void>(
177+
PINNED_CONTEXT_REMOVE_NOTIFICATION_METHOD
178+
)
179+
export const activeEditorChangedNotificationType = new ProtocolNotificationType<ActiveEditorChangedParams, void>(
180+
ACTIVE_EDITOR_CHANGED_NOTIFICATION_METHOD
181+
)
182+
183+
// rules
184+
export const listRulesRequestType = new AutoParameterStructuresProtocolRequestType<
185+
ListRulesParams,
186+
ListRulesResult,
187+
never,
188+
void,
189+
void
190+
>(LIST_RULES_REQUEST_METHOD)
191+
192+
export const ruleClickRequestType = new AutoParameterStructuresProtocolRequestType<
193+
RuleClickParams,
194+
RuleClickResult,
195+
never,
196+
void,
197+
void
198+
>(RULE_CLICK_REQUEST_METHOD)
157199
// history
158200
export const listConversationsRequestType = new AutoParameterStructuresProtocolRequestType<
159201
ListConversationsParams,

runtimes/runtimes/base-runtime.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ import {
5151
buttonClickRequestType,
5252
listMcpServersRequestType,
5353
mcpServerClickRequestType,
54+
ruleClickRequestType,
55+
listRulesRequestType,
56+
pinnedContextNotificationType,
57+
activeEditorChangedNotificationType,
58+
onPinnedContextAddNotificationType,
59+
onPinnedContextRemoveNotificationType,
5460
} from '../protocol'
5561
import { createConnection } from 'vscode-languageserver/browser'
5662
import {
@@ -167,16 +173,24 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
167173
sendChatUpdate: params => lspConnection.sendNotification(chatUpdateNotificationType.method, params),
168174
onFileClicked: handler => lspConnection.onNotification(fileClickNotificationType.method, handler),
169175
sendContextCommands: params => lspConnection.sendNotification(contextCommandsNotificationType.method, params),
176+
sendPinnedContext: params => lspConnection.sendNotification(pinnedContextNotificationType.method, params),
177+
onPinnedContextAdd: params => lspConnection.sendNotification(onPinnedContextAddNotificationType.method, params),
178+
onPinnedContextRemove: params =>
179+
lspConnection.sendNotification(onPinnedContextRemoveNotificationType.method, params),
180+
onActiveEditorChanged: handler =>
181+
lspConnection.onNotification(activeEditorChangedNotificationType.method, handler),
170182
onCreatePrompt: handler => lspConnection.onNotification(createPromptNotificationType.method, handler),
171183
onInlineChatResult: handler => lspConnection.onNotification(inlineChatResultNotificationType.method, handler),
172184
onListConversations: handler => lspConnection.onRequest(listConversationsRequestType.method, handler),
185+
onListRules: handler => lspConnection.onRequest(listRulesRequestType.method, handler),
173186
onConversationClick: handler => lspConnection.onRequest(conversationClickRequestType.method, handler),
174187
onListMcpServers: handler => lspConnection.onRequest(listMcpServersRequestType.method, handler),
175188
onMcpServerClick: handler => lspConnection.onRequest(mcpServerClickRequestType.method, handler),
176189
getSerializedChat: params => lspConnection.sendRequest(getSerializedChatRequestType.method, params),
177190
onTabBarAction: handler => lspConnection.onRequest(tabBarActionRequestType.method, handler),
178191
onPromptInputOptionChange: handler =>
179192
lspConnection.onNotification(promptInputOptionChangeNotificationType.method, handler),
193+
onRuleClick: handler => lspConnection.onRequest(ruleClickRequestType.method, handler),
180194
}
181195

182196
const identityManagement: IdentityManagement = {

runtimes/runtimes/chat/baseChat.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ import {
7070
McpServerClickParams,
7171
McpServerClickResult,
7272
mcpServerClickRequestType,
73+
RuleClickParams,
74+
ruleClickRequestType,
75+
ListRulesParams,
76+
ListRulesResult,
77+
listRulesRequestType,
78+
RuleClickResult,
79+
PinnedContextParams,
80+
pinnedContextNotificationType,
81+
ActiveEditorChangedParams,
82+
activeEditorChangedNotificationType,
83+
onPinnedContextAddNotificationType,
84+
onPinnedContextRemoveNotificationType,
7385
} from '../../protocol'
7486
import { Chat } from '../../server-interface'
7587

@@ -158,6 +170,22 @@ export class BaseChat implements Chat {
158170
this.connection.sendNotification(contextCommandsNotificationType.method, params)
159171
}
160172

173+
public sendPinnedContext(params: PinnedContextParams) {
174+
this.connection.sendNotification(pinnedContextNotificationType.method, params)
175+
}
176+
177+
public onPinnedContextAdd(handler: NotificationHandler<PinnedContextParams>) {
178+
this.connection.onNotification(onPinnedContextAddNotificationType.method, handler)
179+
}
180+
181+
public onPinnedContextRemove(handler: NotificationHandler<PinnedContextParams>) {
182+
this.connection.onNotification(onPinnedContextRemoveNotificationType.method, handler)
183+
}
184+
185+
public onActiveEditorChanged(handler: NotificationHandler<ActiveEditorChangedParams>) {
186+
this.connection.onNotification(activeEditorChangedNotificationType.method, handler)
187+
}
188+
161189
public onCreatePrompt(handler: NotificationHandler<CreatePromptParams>) {
162190
this.connection.onNotification(createPromptNotificationType.method, handler)
163191
}
@@ -170,6 +198,10 @@ export class BaseChat implements Chat {
170198
this.connection.onRequest(listConversationsRequestType.method, handler)
171199
}
172200

201+
public onListRules(handler: RequestHandler<ListRulesParams, ListRulesResult, void>) {
202+
this.connection.onRequest(listRulesRequestType.method, handler)
203+
}
204+
173205
public onConversationClick(handler: RequestHandler<ConversationClickParams, ConversationClickResult, void>) {
174206
this.connection.onRequest(conversationClickRequestType.method, handler)
175207
}
@@ -193,4 +225,8 @@ export class BaseChat implements Chat {
193225
public onPromptInputOptionChange(handler: NotificationHandler<PromptInputOptionChangeParams>) {
194226
this.connection.onNotification(promptInputOptionChangeNotificationType.method, handler)
195227
}
228+
229+
public onRuleClick(handler: RequestHandler<RuleClickParams, RuleClickResult, void>) {
230+
this.connection.onRequest(ruleClickRequestType.method, handler)
231+
}
196232
}

runtimes/server-interface/chat.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ import {
4141
ListMcpServersResult,
4242
McpServerClickResult,
4343
McpServerClickParams,
44+
RuleClickParams,
45+
ListRulesParams,
46+
ListRulesResult,
47+
RuleClickResult,
48+
PinnedContextParams,
49+
ActiveEditorChangedParams,
4450
} from '../protocol'
4551

4652
/**
@@ -62,6 +68,9 @@ export type Chat = {
6268
onConversationClick: (handler: RequestHandler<ConversationClickParams, ConversationClickResult, void>) => void
6369
onTabBarAction: (handler: RequestHandler<TabBarActionParams, TabBarActionResult, void>) => void
6470
getSerializedChat: (params: GetSerializedChatParams) => Promise<GetSerializedChatResult>
71+
onListRules: (handler: RequestHandler<ListRulesParams, ListRulesResult, void>) => void
72+
onRuleClick: (handler: RequestHandler<RuleClickParams, RuleClickResult, void>) => void
73+
6574
// Notifications
6675
onSendFeedback: (handler: NotificationHandler<FeedbackParams>) => void
6776
onReady: (handler: NotificationHandler<void>) => void
@@ -77,6 +86,10 @@ export type Chat = {
7786
onFileClicked: (handler: NotificationHandler<FileClickParams>) => void
7887
chatOptionsUpdate: (params: ChatOptionsUpdateParams) => void
7988
sendContextCommands: (params: ContextCommandParams) => void
89+
sendPinnedContext: (params: PinnedContextParams) => void
90+
onPinnedContextAdd: (handler: NotificationHandler<PinnedContextParams>) => void
91+
onPinnedContextRemove: (handler: NotificationHandler<PinnedContextParams>) => void
92+
onActiveEditorChanged: (handler: NotificationHandler<ActiveEditorChangedParams>) => void
8093
onCreatePrompt: (handler: NotificationHandler<CreatePromptParams>) => void
8194
onInlineChatResult: (handler: NotificationHandler<InlineChatResultParams>) => void
8295
onPromptInputOptionChange: (handler: NotificationHandler<PromptInputOptionChangeParams>) => void

types/chat.ts

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ export const PROMPT_INPUT_OPTION_CHANGE_METHOD = 'aws/chat/promptInputOptionChan
2626
export const CONTEXT_COMMAND_NOTIFICATION_METHOD = 'aws/chat/sendContextCommands'
2727
export const CREATE_PROMPT_NOTIFICATION_METHOD = 'aws/chat/createPrompt'
2828
export const INLINE_CHAT_RESULT_NOTIFICATION_METHOD = 'aws/chat/inlineChatResult'
29+
30+
// pinned context
31+
export const PINNED_CONTEXT_ADD_NOTIFICATION_METHOD = 'aws/chat/pinnedContextAdd'
32+
export const PINNED_CONTEXT_REMOVE_NOTIFICATION_METHOD = 'aws/chat/pinnedContextRemove'
33+
export const RULE_CLICK_REQUEST_METHOD = 'aws/chat/ruleClick'
34+
35+
export const PINNED_CONTEXT_NOTIFICATION_METHOD = 'aws/chat/sendPinnedContext'
36+
export const LIST_RULES_REQUEST_METHOD = 'aws/chat/listRules'
37+
38+
//active tab
39+
export const ACTIVE_EDITOR_CHANGED_NOTIFICATION_METHOD = 'aws/chat/activeEditorChanged'
40+
2941
// history
3042
export const LIST_CONVERSATIONS_REQUEST_METHOD = 'aws/chat/listConversations'
3143
export const CONVERSATION_CLICK_REQUEST_METHOD = 'aws/chat/conversationClick'
@@ -294,7 +306,9 @@ export interface TabEventParams {
294306
tabId: string
295307
}
296308

297-
export interface TabAddParams extends TabEventParams {}
309+
export interface TabAddParams extends TabEventParams {
310+
restoredTab?: boolean
311+
}
298312

299313
export interface TabChangeParams extends TabEventParams {}
300314

@@ -411,8 +425,15 @@ export interface ContextCommandParams {
411425
contextCommandGroups: ContextCommandGroup[]
412426
}
413427

428+
export interface PinnedContextParams extends ContextCommandParams {
429+
tabId: string
430+
textDocument?: TextDocumentIdentifier
431+
showRules?: boolean
432+
}
433+
414434
export interface CreatePromptParams {
415435
promptName: string
436+
isRule?: boolean
416437
}
417438

418439
export interface ProgrammingLanguage {
@@ -486,6 +507,51 @@ export interface ListMcpServersParams {
486507
filter?: Record<string, FilterValue>
487508
}
488509

510+
export interface ListRulesParams {
511+
tabId: string
512+
}
513+
514+
export interface ListRulesResult {
515+
tabId: string
516+
header?: { title: string }
517+
filterOptions?: FilterOption[]
518+
rules: RulesFolder[]
519+
}
520+
521+
export interface RulesFolder {
522+
folderName?: string
523+
/**
524+
* Represents the active state of the folder:
525+
* - true: all rules in the folder are active
526+
* - false: all rules in the folder are inactive
527+
* - 'indeterminate': rules inside the folder have mixed active states (some active, some inactive),
528+
* similar to a parent checkbox in a nested checkbox list having an indeterminate state
529+
*/
530+
active: boolean | 'indeterminate'
531+
rules: Rule[]
532+
}
533+
534+
export interface Rule {
535+
active: boolean
536+
name: string
537+
id: string
538+
}
539+
540+
export interface RuleClickParams {
541+
tabId: string
542+
type: 'folder' | 'rule'
543+
id: string
544+
}
545+
546+
export interface RuleClickResult extends RuleClickParams {
547+
success: boolean
548+
}
549+
550+
export interface ActiveEditorChangedParams {
551+
cursorState?: CursorState[]
552+
textDocument?: TextDocumentIdentifier
553+
}
554+
489555
export interface ConversationsList {
490556
header?: { title: string }
491557
filterOptions?: FilterOption[]

0 commit comments

Comments
 (0)