@@ -14,14 +14,18 @@ import type {
1414 StepGenerator ,
1515 PublicAgentState ,
1616} from '@codebuff/common/types/agent-template'
17+ import type { HandleStepsLogChunkFn } from '@codebuff/common/types/contracts/client'
18+ import type { Logger } from '@codebuff/common/types/contracts/logger'
19+ import type {
20+ ParamsExcluding ,
21+ ParamsOf ,
22+ } from '@codebuff/common/types/function-params'
1723import type {
1824 ToolResultOutput ,
1925 ToolResultPart ,
2026} from '@codebuff/common/types/messages/content-part'
2127import type { PrintModeEvent } from '@codebuff/common/types/print-mode'
2228import type { AgentState } from '@codebuff/common/types/session-state'
23- import type { ParamsExcluding , ParamsOf } from '@codebuff/common/types/function-params'
24- import type { Logger } from '@codebuff/common/types/contracts/logger'
2529import type { WebSocket } from 'ws'
2630
2731// Global sandbox manager for QuickJS contexts
@@ -59,6 +63,7 @@ export async function runProgrammaticStep(
5963 localAgentTemplates : Record < string , AgentTemplate >
6064 stepsComplete : boolean
6165 stepNumber : number
66+ handleStepsLogChunk : HandleStepsLogChunkFn
6267 logger : Logger
6368 } & ParamsExcluding <
6469 typeof executeToolCall ,
@@ -89,6 +94,7 @@ export async function runProgrammaticStep(
8994 ws,
9095 localAgentTemplates,
9196 stepsComplete,
97+ handleStepsLogChunk,
9298 logger,
9399 } = params
94100 let { stepNumber } = params
@@ -111,10 +117,9 @@ export async function runProgrammaticStep(
111117 ( level : 'debug' | 'info' | 'warn' | 'error' ) =>
112118 ( data : any , msg ?: string ) => {
113119 logger [ level ] ( data , msg ) // Log to backend
114- sendAction ( ws , {
115- type : 'handlesteps-log-chunk' ,
120+ handleStepsLogChunk ( {
116121 userInputId,
117- agentId : agentState . agentId ,
122+ runId : agentState . runId ?? 'undefined' ,
118123 level,
119124 data,
120125 message : msg ,
0 commit comments