Skip to content

Commit 45d6d23

Browse files
committed
Merge remote-tracking branch 'origin/main' into brandon/tui
# Conflicts: # backend/src/run-programmatic-step.ts
2 parents 8a248d9 + f4c65dc commit 45d6d23

File tree

5 files changed

+134
-11
lines changed

5 files changed

+134
-11
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { publisher } from '../constants'
2+
3+
import {
4+
PLACEHOLDER,
5+
type SecretAgentDefinition,
6+
} from '../types/secret-agent-definition'
7+
import { AssistantMessage } from 'types/util-types'
8+
9+
const definition: SecretAgentDefinition = {
10+
id: 'file-lister-max',
11+
displayName: 'Liszt the File Lister',
12+
publisher,
13+
model: 'anthropic/claude-haiku-4.5',
14+
spawnerPrompt: 'Lists files that are relevant to the prompt',
15+
inputSchema: {
16+
prompt: {
17+
type: 'string',
18+
description: 'A coding task to complete',
19+
},
20+
},
21+
outputMode: 'last_message',
22+
includeMessageHistory: false,
23+
toolNames: [],
24+
spawnableAgents: [],
25+
26+
systemPrompt: `You are an expert at finding relevant files in a codebase and listing them out. ${PLACEHOLDER.FILE_TREE_PROMPT}`,
27+
instructionsPrompt: `PHASE 1 Instructions:
28+
- Do not use any tools.
29+
- Do not write any analysis.
30+
- List out the full paths of up to 12 files that are relevant to the prompt, separated by newlines.
31+
- Write out the following string to signal the end of this phase:
32+
"cb_easp": true
33+
34+
Do not write an introduction. Do not use any tools. Do not write anything else other than the file paths.
35+
36+
PHASE 2 Instructions:
37+
- Do not use any tools.
38+
- Do not write any analysis.
39+
- After reading those files, give your new best guess at the most relevant files, separated by newlines.
40+
`.trim(),
41+
42+
handleSteps: function* ({ logger }) {
43+
const { agentState } = yield 'STEP_ALL'
44+
const { messageHistory } = agentState
45+
const lastAssistantMessage = messageHistory.findLast(
46+
(message) => message.role === 'assistant',
47+
) as AssistantMessage
48+
const lastMessageContent = lastAssistantMessage.content
49+
const lastMessageStr = Array.isArray(lastMessageContent)
50+
? lastMessageContent[0].type === 'text'
51+
? lastMessageContent[0].text
52+
: ''
53+
: lastMessageContent
54+
55+
const files = lastMessageStr.split('\n').filter(Boolean)
56+
57+
yield {
58+
toolName: 'read_files',
59+
input: {
60+
paths: files,
61+
},
62+
}
63+
64+
yield 'STEP_ALL'
65+
},
66+
}
67+
68+
export default definition
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { publisher } from '../constants'
2+
import {
3+
PLACEHOLDER,
4+
type SecretAgentDefinition,
5+
} from '../types/secret-agent-definition'
6+
7+
const definition: SecretAgentDefinition = {
8+
id: 'file-lister',
9+
displayName: 'Liszt the File Lister',
10+
publisher,
11+
model: 'anthropic/claude-haiku-4.5',
12+
spawnerPrompt: 'Lists files that are relevant to the prompt',
13+
inputSchema: {
14+
prompt: {
15+
type: 'string',
16+
description: 'A coding task to complete',
17+
},
18+
},
19+
outputMode: 'last_message',
20+
includeMessageHistory: false,
21+
toolNames: [],
22+
spawnableAgents: [],
23+
24+
systemPrompt: `You are an expert at finding relevant files in a codebase and listing them out. ${PLACEHOLDER.FILE_TREE_PROMPT}`,
25+
instructionsPrompt: `Instructions:
26+
- Do not use any tools.
27+
- Do not write any analysis.
28+
- List out the full paths of up to 12 files that are relevant to the prompt, separated by newlines.
29+
30+
Do not write an introduction. Do not use any tools. Do not write anything else other than the file paths.
31+
`.trim(),
32+
}
33+
34+
export default definition

.agents/file-explorer/file-picker-max.ts

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,43 @@ const definition: SecretAgentDefinition = {
2121
},
2222
outputMode: 'last_message',
2323
includeMessageHistory: false,
24-
toolNames: [],
25-
spawnableAgents: [],
24+
toolNames: ['spawn_agents'],
25+
spawnableAgents: ['file-lister'],
2626

2727
systemPrompt: `You are an expert at finding relevant files in a codebase. ${PLACEHOLDER.FILE_TREE_PROMPT_SMALL}`,
2828
instructionsPrompt: `Instructions:
2929
- Don't use any tools.
30-
- Provide a short report of the locations in the codebase that could be helpful. Focus on the files that are most relevant to the user prompt.
30+
- Provide a short report of the locations in the codebase that could be helpful. Focus on the files that are most relevant to the user prompt. Leave out irrelevant locations.
3131
In your report, please give a very concise analysis that includes the full paths of files that are relevant and (briefly) how they could be useful.
3232
`.trim(),
3333

34-
handleSteps: function* ({ agentState, prompt, params }) {
35-
yield {
36-
toolName: 'find_files',
37-
input: { prompt: prompt ?? '' },
34+
handleSteps: function* ({ prompt, logger }) {
35+
const { toolResult: fileListerResults } = yield {
36+
toolName: 'spawn_agents',
37+
input: {
38+
agents: [
39+
{
40+
agent_type: 'file-lister',
41+
prompt: prompt ?? '',
42+
},
43+
],
44+
},
3845
} satisfies ToolCall
46+
47+
const fileListerResult = fileListerResults?.[0]
48+
const filesStr =
49+
fileListerResult && fileListerResult.type === 'json'
50+
? ((fileListerResult.value as any)?.[0]?.value?.value as string)
51+
: ''
52+
const files = filesStr.split('\n').filter(Boolean)
53+
54+
yield {
55+
toolName: 'read_files',
56+
input: {
57+
paths: files,
58+
},
59+
}
60+
3961
yield 'STEP_ALL'
4062
},
4163
}

.agents/file-explorer/file-picker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const definition: SecretAgentDefinition = {
1010
id: 'file-picker',
1111
displayName: 'Fletcher the File Fetcher',
1212
publisher,
13-
model: 'x-ai/grok-4-fast',
13+
model: 'google/gemini-2.5-flash',
1414
spawnerPrompt:
1515
'Spawn to find relevant files in a codebase related to the prompt. Cannot do string searches on the codebase.',
1616
inputSchema: {
@@ -25,6 +25,7 @@ const definition: SecretAgentDefinition = {
2525
spawnableAgents: [],
2626

2727
systemPrompt: `You are an expert at finding relevant files in a codebase. ${PLACEHOLDER.FILE_TREE_PROMPT_SMALL}`,
28+
2829
instructionsPrompt: `Instructions:
2930
Provide a short report of the locations in the codebase that could be helpful. Focus on the files that are most relevant to the user prompt.
3031
In your report, please give a very concise analysis that includes the full paths of files that are relevant and (briefly) how they could be useful.

backend/src/run-agent-step.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,7 @@ export const loopAgentSteps = async (
620620
currentAgentState = programmaticAgentState
621621
totalSteps = stepNumber
622622

623-
if (endTurn) {
624-
shouldEndTurn = true
625-
}
623+
shouldEndTurn = endTurn
626624
}
627625

628626
// Check if output is required but missing

0 commit comments

Comments
 (0)