Skip to content

Commit 62928a8

Browse files
committed
Merge conflicts cleanup
1 parent 80906aa commit 62928a8

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

packages/core/src/amazonq/webview/ui/main.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,6 @@ export const createMynahUI = (
704704
onTabChange: connector.onTabChange,
705705
// TODO: update mynah-ui this type doesn't seem correct https://github.com/aws/mynah-ui/blob/3777a39eb534a91fd6b99d6cf421ce78ee5c7526/src/main.ts#L372
706706
onStopChatResponse: (tabID: string) => {
707-
console.log('stop response started')
708707
mynahUI.updateStore(tabID, {
709708
loadingChat: false,
710709
promptInputDisabledState: false,
@@ -756,8 +755,6 @@ export const createMynahUI = (
756755
return
757756
}
758757

759-
console.log('prompt entered: ', prompt)
760-
761758
/**
762759
* Update the tab title if coming from the welcome page
763760
* non cwc panels will have this updated automatically

packages/core/src/codewhispererChat/controllers/chat/controller.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ export class ChatController {
408408
private async processStopResponseMessage(message: StopResponseMessage) {
409409
const session = this.sessionStorage.getSession(message.tabID)
410410
session.tokenSource.cancel()
411-
console.log('process stop has been triggered')
412411
session.setAgenticLoopInProgress(false)
413412
session.setToolUseWithError(undefined)
414413

@@ -700,7 +699,6 @@ export class ChatController {
700699
this.editorContextExtractor
701700
.extractContextForTrigger('ChatMessage')
702701
.then(async (context) => {
703-
console.log('message in controller for tool use:', message)
704702
const triggerID = message.triggerId
705703

706704
// Check if this trigger has already been cancelled
@@ -726,7 +724,6 @@ export class ChatController {
726724

727725
const toolUseWithError = session.toolUseWithError
728726
if (!toolUseWithError || !toolUseWithError.toolUse || !toolUseWithError.toolUse.input) {
729-
// Turn off AgentLoop flag if there's no tool use
730727
return
731728
}
732729
session.setToolUseWithError(undefined)
@@ -762,7 +759,7 @@ export class ChatController {
762759
requiresAcceptance: false,
763760
}
764761
)
765-
762+
766763
if (tool.type === ToolType.FsWrite && toolUse.toolUseId) {
767764
const backup = await tool.tool.getBackup()
768765
session.setFsWriteBackup(toolUse.toolUseId, backup)

packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export class Messenger {
281281
let toolError = undefined
282282
try {
283283
if (this.isTriggerCancelled(triggerID)) {
284-
return
284+
return
285285
}
286286
toolUse.toolUseId = cwChatEvent.toolUseEvent.toolUseId ?? ''
287287
toolUse.name = cwChatEvent.toolUseEvent.name ?? ''
@@ -530,17 +530,25 @@ export class Messenger {
530530
)
531531
)
532532
}
533-
533+
534534
// Check if this trigger has been cancelled before sending final message
535535
if (this.isTriggerCancelled(triggerID)) {
536536
return
537537
}
538-
538+
539+
if (!eventCounts.has('toolUseEvent')) {
540+
session.setAgenticLoopInProgress(false)
541+
session.setContext(undefined)
542+
543+
// Mark the trigger as completed when the agentic loop ends
544+
conversationTracker.markTriggerCompleted(triggerID)
545+
}
546+
539547
this.dispatcher.sendChatMessage(
540548
new ChatMessage(
541549
{
542550
message: undefined,
543-
messageType: agenticLoopEnded ? 'answer' : 'answer-stream',
551+
messageType: !session.agenticLoopInProgress ? 'answer' : 'answer-stream',
544552
followUps: followUps,
545553
followUpsHeader: undefined,
546554
relatedSuggestions: undefined,
@@ -566,13 +574,6 @@ export class Messenger {
566574
},
567575
})
568576
}
569-
if (!eventCounts.has('toolUseEvent')) {
570-
session.setAgenticLoopInProgress(false)
571-
session.setContext(undefined)
572-
573-
// Mark the trigger as completed when the agentic loop ends
574-
conversationTracker.markTriggerCompleted(triggerID)
575-
}
576577

577578
getLogger().info(
578579
`All events received. requestId=%s counts=%s`,
@@ -687,7 +688,7 @@ export class Messenger {
687688
getLogger().debug(`Tool log sending cancelled for tabID: ${tabID}, triggerID: ${triggerID}`)
688689
return
689690
}
690-
691+
691692
// Handle read tool and list directory messages
692693
if (toolUse?.name === ToolType.FsRead || toolUse?.name === ToolType.ListDirectory) {
693694
return this.sendReadAndListDirToolMessage(toolUse, session, tabID, triggerID, messageIdToUpdate)

packages/core/src/codewhispererChat/tools/chatStream.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { Writable } from 'stream'
7+
import { getLogger } from '../../shared/logger/logger'
78
import { Messenger } from '../controllers/chat/messenger/messenger'
89
import { ToolUse } from '@amzn/codewhisperer-streaming'
910
import { CommandValidation } from './executeBash'
@@ -28,7 +29,8 @@ export class ChatStream extends Writable {
2829
// emitEvent decides to show the streaming message or read/list directory tool message to the user.
2930
private readonly emitEvent: boolean,
3031
private readonly validation: CommandValidation,
31-
private readonly changeList?: Change[]
32+
private readonly changeList?: Change[],
33+
private readonly logger = getLogger('chatStream')
3234
) {
3335
super()
3436
this.logger.debug(
@@ -52,6 +54,7 @@ export class ChatStream extends Writable {
5254

5355
const text = chunk.toString()
5456
this.accumulatedLogs += text
57+
this.logger.debug(`ChatStream received chunk: ${text}, emitEvent to mynahUI: ${this.emitEvent}`)
5558
this.messenger.sendPartialToolLog(
5659
this.accumulatedLogs,
5760
this.tabID,

0 commit comments

Comments
 (0)