@@ -60,7 +60,7 @@ const definition: AgentDefinition = {
6060 // Handle tool messages with new object format
6161 if (
6262 message . role === 'tool' &&
63- message . content . toolName === 'run_terminal_command'
63+ message . toolName === 'run_terminal_command'
6464 ) {
6565 const toolMessage =
6666 message as CodebuffToolMessage < 'run_terminal_command' >
@@ -73,19 +73,15 @@ const definition: AgentDefinition = {
7373 const simplifiedMessage : CodebuffToolMessage < 'run_terminal_command' > =
7474 {
7575 ...toolMessage ,
76- content : {
77- ...toolMessage . content ,
78- output : [
79- {
80- type : 'json' ,
81- value : {
82- command :
83- toolMessage . content . output [ 0 ] ?. value ?. command || '' ,
84- stdoutOmittedForLength : true ,
85- } ,
76+ content : [
77+ {
78+ type : 'json' ,
79+ value : {
80+ command : toolMessage . content [ 0 ] ?. value ?. command || '' ,
81+ stdoutOmittedForLength : true ,
8682 } ,
87- ] ,
88- } ,
83+ } ,
84+ ] ,
8985 }
9086 afterTerminalPass . unshift ( simplifiedMessage )
9187 }
@@ -110,24 +106,21 @@ const definition: AgentDefinition = {
110106 // PASS 2: Remove large tool results (any tool result output > 1000 chars when stringified)
111107 const afterToolResultsPass = afterTerminalPass . map ( ( message ) => {
112108 if ( message . role === 'tool' ) {
113- const outputSize = JSON . stringify ( message . content . output ) . length
109+ const outputSize = JSON . stringify ( message . content ) . length
114110
115111 if ( outputSize > 1000 ) {
116112 // Replace with simplified output
117113 const simplifiedMessage : ToolMessage = {
118114 ...message ,
119- content : {
120- ...message . content ,
121- output : [
122- {
123- type : 'json' ,
124- value : {
125- message : '[LARGE_TOOL_RESULT_OMITTED]' ,
126- originalSize : outputSize ,
127- } ,
115+ content : [
116+ {
117+ type : 'json' ,
118+ value : {
119+ message : '[LARGE_TOOL_RESULT_OMITTED]' ,
120+ originalSize : outputSize ,
128121 } ,
129- ] ,
130- } ,
122+ } ,
123+ ] ,
131124 }
132125 return simplifiedMessage
133126 }
0 commit comments