@@ -286,6 +286,7 @@ export class Agent implements ACPAgent {
286286 return
287287
288288 case "running" :
289+ const input = this . toolInput ( part )
289290 const output = this . bashOutput ( part )
290291 const content : ToolCallContent [ ] = [ ]
291292 if ( output ) {
@@ -300,9 +301,9 @@ export class Agent implements ACPAgent {
300301 toolCallId : part . callID ,
301302 status : "in_progress" ,
302303 kind : toToolKind ( part . tool ) ,
303- title : part . tool ,
304- locations : toLocations ( part . tool , part . state . input ) ,
305- rawInput : part . state . input ,
304+ title : this . toolTitle ( part ) ,
305+ locations : toLocations ( part . tool , input ) ,
306+ rawInput : input ,
306307 } ,
307308 } )
308309 . catch ( ( error ) => {
@@ -328,9 +329,9 @@ export class Agent implements ACPAgent {
328329 toolCallId : part . callID ,
329330 status : "in_progress" ,
330331 kind : toToolKind ( part . tool ) ,
331- title : part . tool ,
332- locations : toLocations ( part . tool , part . state . input ) ,
333- rawInput : part . state . input ,
332+ title : this . toolTitle ( part ) ,
333+ locations : toLocations ( part . tool , input ) ,
334+ rawInput : input ,
334335 ...( content . length > 0 && { content } ) ,
335336 } ,
336337 } )
@@ -431,8 +432,8 @@ export class Agent implements ACPAgent {
431432 toolCallId : part . callID ,
432433 status : "failed" ,
433434 kind : toToolKind ( part . tool ) ,
434- title : part . tool ,
435- rawInput : part . state . input ,
435+ title : this . toolTitle ( part ) ,
436+ rawInput : this . toolInput ( part ) ,
436437 content : [
437438 {
438439 type : "content" ,
@@ -839,6 +840,7 @@ export class Agent implements ACPAgent {
839840 this . bashSnapshots . delete ( part . callID )
840841 break
841842 case "running" :
843+ const input = this . toolInput ( part )
842844 const output = this . bashOutput ( part )
843845 const runningContent : ToolCallContent [ ] = [ ]
844846 if ( output ) {
@@ -858,9 +860,9 @@ export class Agent implements ACPAgent {
858860 toolCallId : part . callID ,
859861 status : "in_progress" ,
860862 kind : toToolKind ( part . tool ) ,
861- title : part . tool ,
862- locations : toLocations ( part . tool , part . state . input ) ,
863- rawInput : part . state . input ,
863+ title : this . toolTitle ( part ) ,
864+ locations : toLocations ( part . tool , input ) ,
865+ rawInput : input ,
864866 ...( runningContent . length > 0 && { content : runningContent } ) ,
865867 } ,
866868 } )
@@ -959,8 +961,8 @@ export class Agent implements ACPAgent {
959961 toolCallId : part . callID ,
960962 status : "failed" ,
961963 kind : toToolKind ( part . tool ) ,
962- title : part . tool ,
963- rawInput : part . state . input ,
964+ title : this . toolTitle ( part ) ,
965+ rawInput : this . toolInput ( part ) ,
964966 content : [
965967 {
966968 type : "content" ,
@@ -1112,20 +1114,30 @@ export class Agent implements ACPAgent {
11121114 return output
11131115 }
11141116
1117+ private toolInput ( part : ToolPart ) {
1118+ return part . state . input ?? { }
1119+ }
1120+
1121+ private toolTitle ( part : ToolPart ) {
1122+ if ( "title" in part . state && typeof part . state . title === "string" ) return part . state . title
1123+ return part . tool
1124+ }
1125+
11151126 private async toolStart ( sessionId : string , part : ToolPart ) {
11161127 if ( this . toolStarts . has ( part . callID ) ) return
11171128 this . toolStarts . add ( part . callID )
1129+ const input = this . toolInput ( part )
11181130 await this . connection
11191131 . sessionUpdate ( {
11201132 sessionId,
11211133 update : {
11221134 sessionUpdate : "tool_call" ,
11231135 toolCallId : part . callID ,
1124- title : part . tool ,
1136+ title : this . toolTitle ( part ) ,
11251137 kind : toToolKind ( part . tool ) ,
11261138 status : "pending" ,
1127- locations : [ ] ,
1128- rawInput : { } ,
1139+ locations : toLocations ( part . tool , input ) ,
1140+ rawInput : input ,
11291141 } ,
11301142 } )
11311143 . catch ( ( error ) => {
0 commit comments