Skip to content

Commit d3bc411

Browse files
committed
Extract progress dots logic into shared get_progress_dots helper across agent search modes
- the dot progress indication should change to 'show file...' -> 'show file....' -> 'show file..' -> 'show file...' -> 'show file....' -> 'show file..', and so on └── apps └── editor └── src └── features └── search-files └── search-modes └── perform-agent-search-mode ├── agents │ ├── antigravity.ts │ ├── claude.ts │ ├── codex.ts │ ├── cursor.ts │ ├── grok.ts │ ├── muse.ts │ └── opencode.ts ├── index.ts ├── perform-agent-search-mode.ts ├── types.ts └── utils.ts
1 parent 98b2bae commit d3bc411

5 files changed

Lines changed: 15 additions & 20 deletions

File tree

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/agents/antigravity.ts‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CodingAgent } from '../types'
2-
import { build_agent_prompt, check_command_exists } from '../utils'
2+
import { build_agent_prompt, check_command_exists, get_progress_dots } from '../utils'
33

44
let last_action_name = ''
55
let action_count = 0
@@ -21,12 +21,10 @@ export const antigravity_agent: CodingAgent = {
2121
if (parsed.event == 'step_update' && parsed.step_update) {
2222
const step = parsed.step_update
2323
let action_name = ''
24-
let has_dots = false
2524

2625
if (step.step_type == 'tool') {
2726
if (step.tool_name) {
2827
action_name = step.tool_name.replace(/_/g, ' ')
29-
has_dots = true
3028
}
3129
} else if (step.subagent_info?.subagents?.length > 0) {
3230
const subagent = step.subagent_info.subagents[0]
@@ -40,11 +38,7 @@ export const antigravity_agent: CodingAgent = {
4038
last_action_name = action_name
4139
action_count = 1
4240
}
43-
const extra_dots =
44-
action_count > 1
45-
? (has_dots ? ' ' : '') + '.'.repeat(action_count - 1)
46-
: ''
47-
report_progress(`${action_name}${has_dots ? '...' : ''}${extra_dots}`)
41+
report_progress(`${action_name}${get_progress_dots(action_count)}`)
4842
}
4943
} else if (parsed.event == 'result' && parsed.result) {
5044
last_action_name = ''

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/agents/codex.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CodingAgent } from '../types'
2-
import { build_agent_prompt, check_command_exists } from '../utils'
2+
import { build_agent_prompt, check_command_exists, get_progress_dots } from '../utils'
33

44
let last_action_name = ''
55
let action_count = 0
@@ -50,9 +50,7 @@ export const codex_agent: CodingAgent = {
5050
last_action_name = action_name
5151
action_count = 1
5252
}
53-
const extra_dots =
54-
action_count > 1 ? ' ' + '.'.repeat(action_count - 1) : ''
55-
report_progress(`${action_name}...${extra_dots}`)
53+
report_progress(`${action_name}${get_progress_dots(action_count)}`)
5654
}
5755
} else if (parsed.type == 'item.completed' && parsed.item) {
5856
if (parsed.item.type == 'agent_message' && parsed.item.text) {

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/agents/muse.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CodingAgent } from '../types'
2-
import { build_agent_prompt, check_command_exists } from '../utils'
2+
import { build_agent_prompt, check_command_exists, get_progress_dots } from '../utils'
33

44
let accumulated_output = ''
55
let last_action_name = ''
@@ -48,9 +48,7 @@ export const muse_agent: CodingAgent = {
4848
last_action_name = action_name
4949
action_count = 1
5050
}
51-
const extra_dots =
52-
action_count > 1 ? ' ' + '.'.repeat(action_count - 1) : ''
53-
report_progress(`${action_name}...${extra_dots}`)
51+
report_progress(`${action_name}${get_progress_dots(action_count)}`)
5452
} else if (
5553
parsed.type === 'status' ||
5654
payload.type === 'status' ||

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/agents/opencode.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CodingAgent } from '../types'
2-
import { build_agent_prompt, check_command_exists } from '../utils'
2+
import { build_agent_prompt, check_command_exists, get_progress_dots } from '../utils'
33

44
let last_action_name = ''
55
let action_count = 0
@@ -33,9 +33,7 @@ export const opencode_agent: CodingAgent = {
3333
last_action_name = action_name
3434
action_count = 1
3535
}
36-
const extra_dots =
37-
action_count > 1 ? ' ' + '.'.repeat(action_count - 1) : ''
38-
report_progress(`${action_name}...${extra_dots}`)
36+
report_progress(`${action_name}${get_progress_dots(action_count)}`)
3937
} else if (parsed.type == 'result' && parsed.result) {
4038
last_action_name = ''
4139
action_count = 0

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/utils.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,10 @@ export const format_duration = (ms: number): string => {
4040

4141
return parts.join(' ')
4242
}
43+
44+
export const get_progress_dots = (action_count: number): string => {
45+
const cycle = (action_count - 1) % 3
46+
if (cycle === 0) return '...'
47+
if (cycle === 1) return '....'
48+
return '..'
49+
}

0 commit comments

Comments
 (0)