Skip to content

Commit f30f919

Browse files
committed
Add Muse Code agent support for agentic search
- add support for muse code https://dev.meta.ai/docs/muse-code/extending#headless ├── README.md └── apps └── editor └── src └── features └── search-files └── search-modes └── perform-agent-search-mode ├── agents │ ├── antigravity.ts │ ├── claude.ts │ ├── codex.ts │ ├── cursor.ts │ ├── grok.ts │ └── opencode.ts ├── index.ts ├── types.ts └── utils.ts
1 parent fe31c8a commit f30f919

3 files changed

Lines changed: 87 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
- Grok Build
4646
- Antigravity
4747
- OpenCode
48+
- Muse Code
4849

4950
### File editing
5051

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { agentic_file_search_instructions } from '@/constants/instructions'
2+
import { CodingAgent } from '../types'
3+
import { check_command_exists } from '../utils'
4+
5+
let accumulated_output = ''
6+
7+
export const muse_agent: CodingAgent = {
8+
id: 'muse',
9+
label: 'Muse Code',
10+
cmd: 'muse',
11+
is_installed: () => check_command_exists('muse'),
12+
get_documentation_url: () => 'https://dev.meta.ai/docs/muse-code/extending#headless',
13+
get_args: (query: string) => {
14+
accumulated_output = ''
15+
return [
16+
'exec',
17+
'--json',
18+
'--yolo',
19+
`${agentic_file_search_instructions}\n\n${query}`
20+
]
21+
},
22+
parse_stream_line: (parsed, report_progress) => {
23+
const payload = parsed.payload || parsed
24+
25+
if (
26+
parsed.type === 'tool.result' ||
27+
parsed.type === 'tool_call' ||
28+
payload.type === 'tool_call'
29+
) {
30+
const tool = payload.tool_name || payload.tool || payload.name
31+
if (tool) report_progress(typeof tool === 'string' ? tool : JSON.stringify(tool))
32+
} else if (
33+
parsed.type === 'status' ||
34+
payload.type === 'status' ||
35+
parsed.type === 'run.model.configured'
36+
) {
37+
const msg = payload.message || payload.status || parsed.type
38+
if (msg) report_progress(msg)
39+
} else if (payload.tool) {
40+
report_progress(payload.tool.name || payload.tool)
41+
}
42+
43+
if (parsed.type === 'streamed' || payload.type === 'streamed') {
44+
if (payload.text) {
45+
accumulated_output += payload.text
46+
return { output: accumulated_output }
47+
}
48+
} else if (parsed.type === 'result' || payload.type === 'result') {
49+
const res = payload.result || payload
50+
if (res) {
51+
return {
52+
output: typeof res === 'string' ? res : res.text || res.response || ''
53+
}
54+
}
55+
}
56+
57+
if (payload.text && typeof payload.text === 'string') {
58+
return { output: payload.text }
59+
} else if (payload.output) {
60+
return {
61+
output:
62+
typeof payload.output === 'string'
63+
? payload.output
64+
: payload.output.text || ''
65+
}
66+
}
67+
},
68+
parse_final_output: (parsed, current_output) => {
69+
const payload = parsed.payload || parsed
70+
if (parsed.type === 'result' || payload.type === 'result') {
71+
const res = payload.result || payload
72+
if (res) {
73+
return typeof res === 'string' ? res : res.text || res.response || ''
74+
}
75+
} else if (payload.text) {
76+
return payload.text
77+
} else if (payload.output) {
78+
return typeof payload.output === 'string'
79+
? payload.output
80+
: payload.output.text || ''
81+
}
82+
return current_output || accumulated_output
83+
}
84+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { codex_agent } from './agents/codex'
2020
import { cursor_agent } from './agents/cursor'
2121
import { opencode_agent } from './agents/opencode'
2222
import { grok_agent } from './agents/grok'
23+
import { muse_agent } from './agents/muse'
2324
import { CodingAgent } from './types'
2425
import { format_duration } from './utils'
2526

@@ -29,6 +30,7 @@ const AGENTS: CodingAgent[] = [
2930
claude_agent,
3031
cursor_agent,
3132
grok_agent,
33+
muse_agent,
3234
opencode_agent
3335
]
3436

0 commit comments

Comments
 (0)