11import { CodingAgent } from '../types'
22import { build_agent_prompt , check_command_exists } from '../utils'
33
4+ let last_action_name = ''
5+ let action_count = 0
6+
47export const antigravity_agent : CodingAgent = {
58 id : 'antigravity' ,
69 label : 'Antigravity' ,
@@ -17,64 +20,38 @@ export const antigravity_agent: CodingAgent = {
1720 parse_stream_line : ( parsed , report_progress ) => {
1821 if ( parsed . event == 'step_update' && parsed . step_update ) {
1922 const step = parsed . step_update
20- if ( step . step_type == 'tool' ) {
21- const tool_name = step . tool_name || step . tool_info ?. name
22- if ( tool_name ) {
23- let msg = tool_name
24- const params = step . tool_info ?. parameters
25-
26- if ( params ) {
27- const formatted_name = tool_name . toLowerCase ( )
28-
29- if (
30- ( formatted_name . includes ( 'run' ) ||
31- formatted_name . includes ( 'command' ) ||
32- formatted_name . includes ( 'bash' ) ) &&
33- ( params . CommandLine || params . command || params . cmd )
34- ) {
35- msg = params . CommandLine || params . command || params . cmd
36- } else if ( formatted_name . includes ( 'read' ) && params . path ) {
37- msg = params . path
38- } else if (
39- ( formatted_name . includes ( 'write' ) ||
40- formatted_name . includes ( 'edit' ) ) &&
41- params . path
42- ) {
43- msg = params . path
44- } else if ( formatted_name . includes ( 'list' ) && params . path ) {
45- msg = params . path
46- } else if (
47- ( formatted_name . includes ( 'search' ) ||
48- formatted_name . includes ( 'find' ) ||
49- formatted_name . includes ( 'grep' ) ) &&
50- ( params . query ||
51- params . pattern ||
52- params . description ||
53- params . keyword )
54- ) {
55- msg =
56- params . query ||
57- params . pattern ||
58- params . description ||
59- params . keyword
60- } else if ( params . path ) {
61- msg = params . path
62- } else if ( params . command || params . cmd || params . CommandLine ) {
63- msg = params . command || params . cmd || params . CommandLine
64- }
65- }
23+ let action_name = ''
24+ let has_dots = false
6625
67- report_progress ( msg )
26+ if ( step . step_type == 'tool' ) {
27+ if ( step . tool_name ) {
28+ action_name = step . tool_name . replace ( / _ / g, ' ' )
29+ has_dots = true
6830 }
6931 } else if ( step . subagent_info ?. subagents ?. length > 0 ) {
7032 const subagent = step . subagent_info . subagents [ 0 ]
71- report_progress ( subagent . role || subagent . type_name )
33+ action_name = subagent . role || subagent . type_name
34+ }
35+
36+ if ( action_name ) {
37+ if ( action_name === last_action_name ) {
38+ action_count ++
39+ } else {
40+ last_action_name = action_name
41+ action_count = 1
42+ }
43+ const counter = action_count > 1 ? ` (${ action_count } )` : ''
44+ report_progress ( `${ action_name } ${ has_dots ? '...' : '' } ${ counter } ` )
7245 }
7346 } else if ( parsed . event == 'result' && parsed . result ) {
47+ last_action_name = ''
48+ action_count = 0
7449 return { output : parsed . result . response || '' }
7550 }
7651 } ,
7752 parse_final_output : ( parsed , current_output ) => {
53+ last_action_name = ''
54+ action_count = 0
7855 if ( parsed . event == 'result' && parsed . result ) {
7956 return parsed . result . response || ''
8057 } else if ( parsed . response ) {
0 commit comments