Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chat-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"dependencies": {
"@aws/chat-client-ui-types": "^0.1.56",
"@aws/language-server-runtimes": "^0.2.121",
"@aws/language-server-runtimes-types": "^0.1.50",
"@aws/mynah-ui": "^4.36.2"
"@aws/language-server-runtimes-types": "^0.1.52",
"@aws/mynah-ui": "^4.36.4"
},
"devDependencies": {
"@types/jsdom": "^21.1.6",
Expand Down
29 changes: 29 additions & 0 deletions chat-client/src/client/mynahUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
MynahIcons,
CustomQuickActionCommand,
ConfigTexts,
DropdownListOption,
} from '@aws/mynah-ui'
import { VoteParams } from '../contracts/telemetry'
import { Messager } from './messager'
Expand Down Expand Up @@ -675,6 +676,30 @@ export const createMynahUi = (

throw new Error(`Unhandled tab bar button id: ${buttonId}`)
},
onDropDownOptionChange: (tabId: string, messageId: string, value: DropdownListOption[]) => {
// process data before sending
// map data to Record <string, string>
// value: `${serverName}@${toolName}`
const metadata: Record<string, string> = {}
const option = value[0]
const [serverName, toolName] = option.value.split('@')
const new_permission = option.id

metadata['toolName'] = toolName
metadata['serverName'] = serverName
metadata['permission'] = new_permission

const payload: ButtonClickParams = {
tabId,
messageId,
buttonId: 'trust-command',
metadata,
}
messager.onButtonClick(payload)
},
onDropDownLinkClick: (tabId: string, actionId: string, destination: string) => {
messager.onMcpServerClick(actionId, destination)
},
onPromptInputOptionChange: (tabId, optionsValues) => {
if (agenticMode) {
handlePromptInputChange(mynahUi, tabId, optionsValues)
Expand Down Expand Up @@ -1305,6 +1330,9 @@ export const createMynahUi = (
fileList: undefined,
}
: undefined,
quickSettings: message.summary.content.quickSettings
? message.summary.content.quickSettings
: undefined,
}
: undefined,
collapsedContent:
Expand Down Expand Up @@ -1400,6 +1428,7 @@ export const createMynahUi = (
? { 'insert-to-cursor': null }
: undefined,
...(shouldMute ? { muted: true } : {}),
quickSettings: message.quickSettings ? message.quickSettings : undefined,
}
}

Expand Down
2 changes: 1 addition & 1 deletion chat-client/src/client/tabs/tabFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Select code & ask me to explain, debug or optimize it, or type \`/\` for quick a
tabBarButtons.push({
id: McpServerTabButtonId,
icon: MynahIcons.TOOLS,
description: 'Configure MCP servers',
description: 'Configure MCP servers and Built-in tools',
})
}

Expand Down
2 changes: 2 additions & 0 deletions chat-client/src/client/withAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export const withAdapter = (
onPromptTopBarItemAdded: addDefaultRouting('onPromptTopBarItemAdded'),
onPromptTopBarItemRemoved: addDefaultRouting('onPromptTopBarItemRemoved'),
onPromptTopBarButtonClick: addDefaultRouting('onPromptTopBarButtonClick'),
onDropDownOptionChange: addDefaultRouting('onDropDownOptionChange'),
onDropDownLinkClick: addDefaultRouting('onDropDownLinkClick'),

/**
* Handler with special routing logic
Expand Down
2 changes: 2 additions & 0 deletions chat-client/src/contracts/chatClientAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export interface ChatEventHandler
| 'onPromptTopBarItemAdded'
| 'onPromptTopBarItemRemoved'
| 'onPromptTopBarButtonClick'
| 'onDropDownOptionChange'
| 'onDropDownLinkClick'
> {}

/**
Expand Down
Loading