Skip to content
Merged
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
2 changes: 1 addition & 1 deletion chat-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@aws/chat-client-ui-types": "^0.1.56",
"@aws/language-server-runtimes": "^0.2.123",
"@aws/language-server-runtimes-types": "^0.1.50",
"@aws/mynah-ui": "^4.36.2"
"@aws/mynah-ui": "^4.36.4"
},
"devDependencies": {
"@types/jsdom": "^21.1.6",
Expand Down
16 changes: 12 additions & 4 deletions chat-client/src/client/mynahUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1353,10 +1353,15 @@ export const createMynahUi = (
fileTreeTitle: '',
hideFileCount: true,
details: toDetailsWithoutIcon(header.fileList.details),
renderAsPills:
!header.fileList.details ||
(Object.values(header.fileList.details).every(detail => !detail.changes) &&
(!header.buttons || !header.buttons.some(button => button.id === 'undo-changes')) &&
!header.status?.icon),
}
}
if (!isPartialResult) {
if (processedHeader) {
if (processedHeader && !message.header?.status) {
processedHeader.status = undefined
}
}
Expand All @@ -1369,7 +1374,8 @@ export const createMynahUi = (
processedHeader.buttons !== null &&
processedHeader.buttons.length > 0) ||
processedHeader.status !== undefined ||
processedHeader.icon !== undefined)
processedHeader.icon !== undefined ||
processedHeader.fileList !== undefined)

const padding =
message.type === 'tool' ? (fileList ? true : message.messageId?.endsWith('_permission')) : undefined
Expand All @@ -1380,8 +1386,10 @@ export const createMynahUi = (
// Adding this conditional check to show the stop message in the center.
const contentHorizontalAlignment: ChatItem['contentHorizontalAlignment'] = undefined

// If message.header?.status?.text is Stopped or Rejected or Ignored or Completed etc.. card should be in disabled state.
const shouldMute = message.header?.status?.text !== undefined && message.header?.status?.text !== 'Completed'
// If message.header?.status?.text is Stopped or Rejected or Ignored etc.. card should be in disabled state.
const shouldMute =
message.header?.status?.text !== undefined &&
['Stopped', 'Rejected', 'Ignored', 'Failed', 'Error'].includes(message.header.status.text)

return {
body: message.body,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ describe('Q Agentic Chat Server Integration Tests', async () => {

expect(decryptedResult.additionalMessages).to.be.an('array')
const fsReadMessage = decryptedResult.additionalMessages?.find(
msg => msg.type === 'tool' && msg.fileList?.rootFolderTitle === '1 file read'
msg => msg.type === 'tool' && msg.header?.body === '1 file read'
)
expect(fsReadMessage).to.exist
const expectedPath = path.join(rootPath, 'test.py')
const actualPaths = fsReadMessage?.fileList?.filePaths?.map(normalizePath) || []
const actualPaths = fsReadMessage?.header?.fileList?.filePaths?.map(normalizePath) || []
expect(actualPaths).to.include.members([normalizePath(expectedPath)])
expect(fsReadMessage?.messageId?.startsWith('tooluse_')).to.be.true
})
Expand All @@ -191,10 +191,10 @@ describe('Q Agentic Chat Server Integration Tests', async () => {

expect(decryptedResult.additionalMessages).to.be.an('array')
const listDirectoryMessage = decryptedResult.additionalMessages?.find(
msg => msg.type === 'tool' && msg.fileList?.rootFolderTitle === '1 directory listed'
msg => msg.type === 'tool' && msg.header?.body === '1 directory listed'
)
expect(listDirectoryMessage).to.exist
const actualPaths = listDirectoryMessage?.fileList?.filePaths?.map(normalizePath) || []
const actualPaths = listDirectoryMessage?.header?.fileList?.filePaths?.map(normalizePath) || []
expect(actualPaths).to.include.members([normalizePath(rootPath)])
expect(listDirectoryMessage?.messageId?.startsWith('tooluse_')).to.be.true
})
Expand Down Expand Up @@ -371,11 +371,12 @@ describe('Q Agentic Chat Server Integration Tests', async () => {

expect(decryptedResult.additionalMessages).to.be.an('array')
const fileSearchMessage = decryptedResult.additionalMessages?.find(
msg => msg.type === 'tool' && msg.fileList?.rootFolderTitle === '1 directory searched'
msg => msg.type === 'tool' && msg.header?.body === 'Searched for `test` in '
)
expect(fileSearchMessage).to.exist
expect(fileSearchMessage?.messageId?.startsWith('tooluse_')).to.be.true
const actualPaths = fileSearchMessage?.fileList?.filePaths?.map(normalizePath) || []
expect(fileSearchMessage?.header?.status?.text).to.equal('3 results found')
const actualPaths = fileSearchMessage?.header?.fileList?.filePaths?.map(normalizePath) || []
expect(actualPaths).to.include.members([normalizePath(rootPath)])
})
})
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { McpManager } from './tools/mcp/mcpManager'
import { AgenticChatResultStream } from './agenticChatResultStream'
import { AgenticChatError } from './errors'
import * as sharedUtils from '../../shared/utils'
import { IdleWorkspaceManager } from '../workspaceContext/IdleWorkspaceManager'

describe('AgenticChatController', () => {
let mcpInstanceStub: sinon.SinonStub
Expand Down Expand Up @@ -450,7 +451,7 @@ describe('AgenticChatController', () => {

assert.deepStrictEqual(chatResult, {
additionalMessages: [],
body: '\n\nHello World!',
body: '\nHello World!',
messageId: 'mock-message-id',
buttons: [],
codeReference: [],
Expand All @@ -475,6 +476,15 @@ describe('AgenticChatController', () => {
assert.strictEqual(typeof session.conversationId, 'string')
})

it('invokes IdleWorkspaceManager recordActivityTimestamp', async () => {
const recordActivityTimestampStub = sinon.stub(IdleWorkspaceManager, 'recordActivityTimestamp')

await chatController.onChatPrompt({ tabId: mockTabId, prompt: { prompt: 'Hello' } }, mockCancellationToken)

sinon.assert.calledOnce(recordActivityTimestampStub)
recordActivityTimestampStub.restore()
})

it('includes chat history from the database in the request input', async () => {
// Mock chat history
const mockHistory = [
Expand Down Expand Up @@ -1140,7 +1150,7 @@ describe('AgenticChatController', () => {
sinon.assert.callCount(testFeatures.lsp.sendProgress, mockChatResponseList.length + 1) // response length + 1 loading messages
assert.deepStrictEqual(chatResult, {
additionalMessages: [],
body: '\n\nHello World!',
body: '\nHello World!',
messageId: 'mock-message-id',
codeReference: [],
buttons: [],
Expand All @@ -1159,7 +1169,7 @@ describe('AgenticChatController', () => {
sinon.assert.callCount(testFeatures.lsp.sendProgress, mockChatResponseList.length + 1) // response length + 1 loading message
assert.deepStrictEqual(chatResult, {
additionalMessages: [],
body: '\n\nHello World!',
body: '\nHello World!',
messageId: 'mock-message-id',
buttons: [],
codeReference: [],
Expand Down
Loading
Loading