File tree Expand file tree Collapse file tree 4 files changed +8
-6
lines changed
Expand file tree Collapse file tree 4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1+ import { MAX_AGENT_STEPS_DEFAULT } from '@codebuff/common/constants/agents'
12import { mainPrompt } from './main-prompt'
23
34import type { MainPromptOptions } from './main-prompt'
@@ -9,8 +10,6 @@ import type {
910} from '@codebuff/common/types/session-state'
1011import type { WebSocket } from 'ws'
1112
12- const DEFAULT_MAX_ITERATIONS = 20
13-
1413export async function loopMainPrompt (
1514 ws : WebSocket ,
1615 action : ClientAction < 'prompt' > ,
@@ -20,7 +19,7 @@ export async function loopMainPrompt(
2019 toolCalls : Array < ClientToolCall >
2120 toolResults : Array < ToolResult >
2221} > {
23- const maxIterations = options . maxIterations ?? DEFAULT_MAX_ITERATIONS
22+ const maxIterations = options . maxIterations ?? MAX_AGENT_STEPS_DEFAULT
2423 let { sessionState, toolResults, toolCalls } = await mainPrompt (
2524 ws ,
2625 action ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import type {
1515} from '@codebuff/common/types/session-state'
1616import type { ProjectFileContext } from '@codebuff/common/util/file'
1717import type { WebSocket } from 'ws'
18+ import { MAX_AGENT_STEPS_DEFAULT } from '@codebuff/common/constants/agents'
1819
1920export const handleSpawnAgentInline = ( ( params : {
2021 previousToolCallFinished : Promise < void >
@@ -135,7 +136,7 @@ export const handleSpawnAgentInline = ((params: {
135136 agentContext : agentState ! . agentContext , // Inherit parent context directly
136137 subagents : [ ] ,
137138 messageHistory : getLatestState ( ) . messages , // Share the same message array
138- stepsRemaining : 20 , // MAX_AGENT_STEPS
139+ stepsRemaining : MAX_AGENT_STEPS_DEFAULT ,
139140 output : undefined ,
140141 parentId : agentState ! . agentId ,
141142 }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import type {
1818} from '@codebuff/common/types/session-state'
1919import type { ProjectFileContext } from '@codebuff/common/util/file'
2020import type { WebSocket } from 'ws'
21+ import { MAX_AGENT_STEPS_DEFAULT } from '@codebuff/common/constants/agents'
2122
2223export const handleSpawnAgentsAsync = ( ( params : {
2324 previousToolCallFinished : Promise < void >
@@ -184,7 +185,7 @@ export const handleSpawnAgentsAsync = ((params: {
184185 agentContext : { } ,
185186 subagents : [ ] ,
186187 messageHistory : subAgentMessages ,
187- stepsRemaining : 20 , // MAX_AGENT_STEPS
188+ stepsRemaining : MAX_AGENT_STEPS_DEFAULT ,
188189 output : undefined ,
189190 // Add parent ID to agent state for communication
190191 parentId : agentState ! . agentId ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import type {
1414} from '@codebuff/common/types/session-state'
1515import type { ProjectFileContext } from '@codebuff/common/util/file'
1616import type { WebSocket } from 'ws'
17+ import { MAX_AGENT_STEPS_DEFAULT } from '@codebuff/common/constants/agents'
1718
1819export type SendSubagentChunk = ( data : {
1920 userInputId : string
@@ -163,7 +164,7 @@ export const handleSpawnAgents = ((params: {
163164 agentContext : { } ,
164165 subagents : [ ] ,
165166 messageHistory : subAgentMessages ,
166- stepsRemaining : 20 , // MAX_AGENT_STEPS
167+ stepsRemaining : MAX_AGENT_STEPS_DEFAULT ,
167168 output : undefined ,
168169 parentId : agentState ! . agentId ,
169170 }
You can’t perform that action at this time.
0 commit comments