1- import { ToolName , toolNames } from '@codebuff/common/constants/tools'
2- import { CodebuffMessage } from '@codebuff/common/types/message'
3- import {
1+ import type { ToolName } from '@codebuff/common/constants/tools'
2+ import type { CodebuffMessage } from '@codebuff/common/types/message'
3+ import type { PrintModeObject } from '@codebuff/common/types/print-mode'
4+ import type {
45 AgentState ,
56 Subgoal ,
67 ToolResult ,
78} from '@codebuff/common/types/session-state'
9+ import type { ProjectFileContext } from '@codebuff/common/util/file'
10+ import type { ToolCallPart } from 'ai'
11+ import type { WebSocket } from 'ws'
12+ import type { AgentTemplate } from '../templates/types'
13+ import type { CodebuffToolCall } from './constants'
14+
15+ import { toolNames } from '@codebuff/common/constants/tools'
816import { buildArray } from '@codebuff/common/util/array'
9- import { ProjectFileContext } from '@codebuff/common/util/file'
1017import { generateCompactId } from '@codebuff/common/util/string'
11- import { ToolCallPart } from 'ai'
12- import { WebSocket } from 'ws'
13- import { AgentTemplate } from '../templates/types'
1418import { expireMessages } from '../util/messages'
1519import { sendAction } from '../websockets/websocket-action'
1620import { processStreamWithTags } from '../xml-stream-parser'
17- import { CodebuffToolCall } from './constants'
1821import { executeToolCall } from './tool-executor'
1922
2023export type ToolCallError = {
@@ -37,7 +40,7 @@ export async function processStreamWithTools<T extends string>(options: {
3740 messages : CodebuffMessage [ ]
3841 agentState : AgentState
3942 agentContext : Record < string , Subgoal >
40- onResponseChunk : ( chunk : string ) => void
43+ onResponseChunk : ( chunk : string | PrintModeObject ) => void
4144 fullResponse : string
4245} ) {
4346 const {
@@ -126,6 +129,7 @@ export async function processStreamWithTools<T extends string>(options: {
126129 result : error ,
127130 } )
128131 } ,
132+ onResponseChunk ,
129133 {
130134 userId,
131135 model : agentTemplate . model ,
0 commit comments