@@ -380,8 +380,7 @@ impl ServerRuntime {
380380 let command = command_display_from_input ( & name, & input) ;
381381 let preparation_feedback =
382382 runtime. deps . registry . preparation_feedback ( & name) ;
383- let item_kind = if preparation_feedback
384- == ToolPreparationFeedback :: LiveOnly
383+ let item_kind = if preparation_feedback == ToolPreparationFeedback :: LiveOnly
385384 {
386385 ItemKind :: ToolCall
387386 } else if is_file_change_tool ( & name) {
@@ -393,70 +392,68 @@ impl ServerRuntime {
393392 } else {
394393 ItemKind :: ToolCall
395394 } ;
396- let started_payload = if preparation_feedback
397- == ToolPreparationFeedback :: LiveOnly
398- {
399- serde_json:: to_value ( ToolCallPayload {
400- tool_call_id : id. clone ( ) ,
401- tool_name : name. clone ( ) ,
402- parameters : input. clone ( ) ,
403- command_actions : command_actions_from_tool_input (
404- & name, & command, & input,
405- ) ,
406- } )
407- . expect ( "serialize tool call payload" )
408- } else if is_file_change_tool ( & name) {
409- serde_json:: to_value ( FileChangePayload {
410- tool_call_id : id. clone ( ) ,
411- tool_name : Some ( name. clone ( ) ) ,
412- changes : Vec :: new ( ) ,
413- is_error : false ,
414- } )
415- . expect ( "serialize file change payload" )
416- } else if is_command_execution {
417- serde_json:: to_value ( CommandExecutionPayload {
418- tool_call_id : id. clone ( ) ,
419- tool_name : name. clone ( ) ,
420- command : command. clone ( ) ,
421- source : devo_protocol:: protocol:: ExecCommandSource :: Agent ,
422- command_actions : command_actions_from_tool_input (
423- & name, & command, & input,
424- ) ,
425- output : None ,
426- is_error : false ,
427- } )
428- . expect ( "serialize command execution payload" )
429- } else if is_plan_tool ( & name) {
430- serde_json:: json!( {
431- "title" : "Plan" ,
432- "text" : ""
433- } )
434- } else {
435- serde_json:: to_value ( ToolCallPayload {
436- tool_call_id : id. clone ( ) ,
437- tool_name : name. clone ( ) ,
438- parameters : input. clone ( ) ,
439- command_actions : command_actions_from_tool_input (
440- & name, & command, & input,
441- ) ,
442- } )
443- . expect ( "serialize tool call payload" )
444- } ;
445- let ( item_id, item_seq) = if preparation_feedback
446- == ToolPreparationFeedback :: LiveOnly
447- {
448- let ( item_id, item_seq) = runtime
449- . start_item (
450- session_id,
451- turn_for_events. turn_id ,
452- item_kind,
453- started_payload,
454- )
455- . await ;
456- ( Some ( item_id) , Some ( item_seq) )
457- } else {
458- ( None , None )
459- } ;
395+ let started_payload =
396+ if preparation_feedback == ToolPreparationFeedback :: LiveOnly {
397+ serde_json:: to_value ( ToolCallPayload {
398+ tool_call_id : id. clone ( ) ,
399+ tool_name : name. clone ( ) ,
400+ parameters : input. clone ( ) ,
401+ command_actions : command_actions_from_tool_input (
402+ & name, & command, & input,
403+ ) ,
404+ } )
405+ . expect ( "serialize tool call payload" )
406+ } else if is_file_change_tool ( & name) {
407+ serde_json:: to_value ( FileChangePayload {
408+ tool_call_id : id. clone ( ) ,
409+ tool_name : Some ( name. clone ( ) ) ,
410+ changes : Vec :: new ( ) ,
411+ is_error : false ,
412+ } )
413+ . expect ( "serialize file change payload" )
414+ } else if is_command_execution {
415+ serde_json:: to_value ( CommandExecutionPayload {
416+ tool_call_id : id. clone ( ) ,
417+ tool_name : name. clone ( ) ,
418+ command : command. clone ( ) ,
419+ source : devo_protocol:: protocol:: ExecCommandSource :: Agent ,
420+ command_actions : command_actions_from_tool_input (
421+ & name, & command, & input,
422+ ) ,
423+ output : None ,
424+ is_error : false ,
425+ } )
426+ . expect ( "serialize command execution payload" )
427+ } else if is_plan_tool ( & name) {
428+ serde_json:: json!( {
429+ "title" : "Plan" ,
430+ "text" : ""
431+ } )
432+ } else {
433+ serde_json:: to_value ( ToolCallPayload {
434+ tool_call_id : id. clone ( ) ,
435+ tool_name : name. clone ( ) ,
436+ parameters : input. clone ( ) ,
437+ command_actions : command_actions_from_tool_input (
438+ & name, & command, & input,
439+ ) ,
440+ } )
441+ . expect ( "serialize tool call payload" )
442+ } ;
443+ let ( item_id, item_seq) =
444+ if preparation_feedback == ToolPreparationFeedback :: LiveOnly {
445+ let ( item_id, item_seq) = runtime
446+ . start_item (
447+ session_id,
448+ turn_for_events. turn_id ,
449+ item_kind,
450+ started_payload,
451+ )
452+ . await ;
453+ ( Some ( item_id) , Some ( item_seq) )
454+ } else {
455+ ( None , None )
456+ } ;
460457 pending_tool_calls. insert (
461458 id,
462459 PendingToolCall {
@@ -481,22 +478,20 @@ impl ServerRuntime {
481478 if let Some ( mut pending) = pending_tool_calls. remove ( & tool_use_id) {
482479 if pending. item_id . is_none ( ) || pending. item_seq . is_none ( ) {
483480 let started_payload = if let Some ( tool_name) = tool_name. clone ( ) {
484- let item_kind = if runtime
485- . deps
486- . registry
487- . preparation_feedback ( & tool_name)
488- == ToolPreparationFeedback :: LiveOnly
489- {
490- ItemKind :: ToolCall
491- } else if is_file_change_tool ( & tool_name) {
492- ItemKind :: FileChange
493- } else if pending. is_command_execution {
494- ItemKind :: CommandExecution
495- } else if is_plan_tool ( & tool_name) {
496- ItemKind :: Plan
497- } else {
498- ItemKind :: ToolCall
499- } ;
481+ let item_kind =
482+ if runtime. deps . registry . preparation_feedback ( & tool_name)
483+ == ToolPreparationFeedback :: LiveOnly
484+ {
485+ ItemKind :: ToolCall
486+ } else if is_file_change_tool ( & tool_name) {
487+ ItemKind :: FileChange
488+ } else if pending. is_command_execution {
489+ ItemKind :: CommandExecution
490+ } else if is_plan_tool ( & tool_name) {
491+ ItemKind :: Plan
492+ } else {
493+ ItemKind :: ToolCall
494+ } ;
500495 let payload = if runtime
501496 . deps
502497 . registry
@@ -527,7 +522,8 @@ impl ServerRuntime {
527522 tool_call_id : tool_use_id. clone ( ) ,
528523 tool_name : tool_name. clone ( ) ,
529524 command : pending. command . clone ( ) ,
530- source : devo_protocol:: protocol:: ExecCommandSource :: Agent ,
525+ source :
526+ devo_protocol:: protocol:: ExecCommandSource :: Agent ,
531527 command_actions : command_actions_from_tool_input (
532528 & tool_name,
533529 & pending. command ,
@@ -555,14 +551,14 @@ impl ServerRuntime {
555551 } )
556552 . expect ( "serialize tool call payload" )
557553 } ;
558- let ( item_id, item_seq) = runtime
559- . start_item (
560- session_id,
561- turn_for_events. turn_id ,
562- item_kind. clone ( ) ,
563- payload,
564- )
565- . await ;
554+ let ( item_id, item_seq) = runtime
555+ . start_item (
556+ session_id,
557+ turn_for_events. turn_id ,
558+ item_kind. clone ( ) ,
559+ payload,
560+ )
561+ . await ;
566562 pending. item_id = Some ( item_id) ;
567563 pending. item_seq = Some ( item_seq) ;
568564 item_kind
@@ -678,15 +674,19 @@ impl ServerRuntime {
678674 . get ( "content" )
679675 . and_then ( serde_json:: Value :: as_str)
680676 . map ( ToOwned :: to_owned)
681- . unwrap_or_else ( || "\n " . repeat ( additions as usize ) ) ,
677+ . unwrap_or_else ( || {
678+ "\n " . repeat ( additions as usize )
679+ } ) ,
682680 } ,
683681 "delete" => {
684682 devo_protocol:: protocol:: FileChange :: Delete {
685683 content : file
686684 . get ( "content" )
687685 . and_then ( serde_json:: Value :: as_str)
688686 . map ( ToOwned :: to_owned)
689- . unwrap_or_else ( || "\n " . repeat ( deletions as usize ) ) ,
687+ . unwrap_or_else ( || {
688+ "\n " . repeat ( deletions as usize )
689+ } ) ,
690690 }
691691 }
692692 "update" | "move" => {
0 commit comments