Skip to content
Merged
1 change: 1 addition & 0 deletions mobile/src/components/mobile-agent-icon-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const MOBILE_AGENT_ICON_ASSETS: Partial<Record<TuiAgent, ImageSourcePropT
opencode: require('../../../src/shared/agent-icons/opencode.png'),
'mimo-code': require('../../../src/shared/agent-icons/mimo-code.png'),
ante: require('../../../src/shared/agent-icons/ante.png'),
trae: require('../../../src/shared/agent-icons/trae.png'),
gemini: require('../../../src/shared/agent-icons/gemini.png'),
antigravity: require('../../../src/shared/agent-icons/antigravity.png'),
goose: require('../../../src/shared/agent-icons/goose.png'),
Expand Down
3 changes: 3 additions & 0 deletions mobile/src/tasks/mobile-tui-agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const MOBILE_TUI_AGENT_AUTO_PICK_ORDER = [
'opencode',
'mimo-code',
'ante',
'trae',
'pi',
'omp',
'gemini',
Expand Down Expand Up @@ -50,6 +51,7 @@ export const MOBILE_TUI_AGENT_LABELS: Record<TuiAgent, string> = {
opencode: 'OpenCode',
'mimo-code': 'MiMo Code',
ante: 'Ante',
trae: 'Trae',
pi: 'Pi',
omp: 'OMP',
gemini: 'Gemini',
Expand Down Expand Up @@ -84,6 +86,7 @@ export const MOBILE_TUI_AGENT_FAVICON_DOMAINS: Partial<Record<TuiAgent, string>>
opencode: 'opencode.ai',
'mimo-code': 'mimo.xiaomi.com',
ante: 'antigma.ai',
trae: 'www.trae.cn',
omp: 'omp.sh',
gemini: 'gemini.google.com',
antigravity: 'antigravity.google',
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@
"0708ed89f1": "Claude",
"fc80296033": "Devin",
"da41abbdd4": "Ante",
"060d152fb5": "Trae",
"mimo_code_label": "MiMo Code"
},
"skill": {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@
"0708ed89f1": "Claude",
"fc80296033": "Devin",
"da41abbdd4": "Ante",
"060d152fb5": "Trae",
"mimo_code_label": "MiMo Code"
},
"skill": {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@
"0708ed89f1": "Claude",
"fc80296033": "Devin",
"da41abbdd4": "Ante",
"060d152fb5": "Trae",
"mimo_code_label": "MiMo Code"
},
"skill": {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@
"0708ed89f1": "Claude",
"fc80296033": "Devin",
"da41abbdd4": "Ante",
"060d152fb5": "Trae",
"mimo_code_label": "MiMo Code"
},
"skill": {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@
"0708ed89f1": "Claude",
"fc80296033": "Devin",
"da41abbdd4": "Ante",
"060d152fb5": "Trae",
"mimo_code_label": "MiMo Code"
},
"skill": {
Expand Down
9 changes: 9 additions & 0 deletions src/renderer/src/lib/agent-catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ export const getAgentCatalog = createLocalizedCatalog((): AgentCatalogEntry[] =>
faviconDomain: 'antigma.ai',
homepageUrl: 'https://github.com/AntigmaLabs/ante-preview'
},
{
id: 'trae',
label: translate('auto.lib.agent.catalog.060d152fb5', 'Trae'),
// Why: matches TUI_AGENT_CONFIG.trae.detectCmd, not the ambiguous `trae-cli` — see the Why there.
cmd: 'traecli',
// Why: bare `trae.cn` 404s on Google's favicon service.
faviconDomain: 'www.trae.cn',
homepageUrl: 'https://docs.trae.cn/cli_get-started-with-trae-cli'
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
{
id: 'pi',
label: translate('auto.lib.agent.catalog.302934c5d9', 'Pi'),
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/src/lib/agent-favicon-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { TuiAgent } from '../../../shared/types'
import grokUrl from '../../../shared/agent-icons/grok.png?url'
import mimoCodeUrl from '../../../shared/agent-icons/mimo-code.png?url'
import anteUrl from '../../../shared/agent-icons/ante.png?url'
import traeUrl from '../../../shared/agent-icons/trae.png?url'
import geminiUrl from '../../../shared/agent-icons/gemini.png?url'
import antigravityUrl from '../../../shared/agent-icons/antigravity.png?url'
import gooseUrl from '../../../shared/agent-icons/goose.png?url'
Expand Down Expand Up @@ -34,6 +35,7 @@ export const AGENT_FAVICON_ASSETS: Partial<Record<TuiAgent, string>> = {
grok: grokUrl,
'mimo-code': mimoCodeUrl,
ante: anteUrl,
trae: traeUrl,
gemini: geminiUrl,
antigravity: antigravityUrl,
goose: gooseUrl,
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/src/lib/agent-status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,10 @@ describe('formatAgentTypeLabel', () => {
expect(formatAgentTypeLabel('ante')).toBe('Ante')
})

it("maps 'trae' to 'Trae'", () => {
expect(formatAgentTypeLabel('trae')).toBe('Trae')
})

it('passes through arbitrary custom agent names as-is', () => {
expect(formatAgentTypeLabel('weirdo')).toBe('weirdo')
})
Expand All @@ -884,6 +888,7 @@ describe('agentTypeToIconAgent', () => {
expect(agentTypeToIconAgent('antigravity')).toBe('antigravity')
expect(agentTypeToIconAgent('command-code')).toBe('command-code')
expect(agentTypeToIconAgent('ante')).toBe('ante')
expect(agentTypeToIconAgent('trae')).toBe('trae')
})

it('returns null for arbitrary non-iconable strings', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/lib/agent-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ const ICONABLE_AGENT_TYPES: Record<TuiAgent, true> = {
copilot: true,
grok: true,
devin: true,
ante: true
ante: true,
trae: true
}

// Why: return null (not a 'claude' fallback) for unknown so Codex panes don't flash the Claude icon before the hook fires.
Expand Down
29 changes: 29 additions & 0 deletions src/renderer/src/lib/tui-agent-startup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,35 @@
})
})

it('passes the prompt to Trae as a positional argv behind a `--` separator', () => {
expect(
buildAgentStartupPlan({
agent: 'trae',
prompt: 'Summarize the failing tests',
cmdOverrides: {},
platform: 'linux'
})
).toEqual({
agent: 'trae',
launchCommand: "traecli -- 'Summarize the failing tests'",
expectedProcess: 'traecli',
followupPrompt: null,
launchConfig: emptyLaunchConfig('traecli')
})
})

// Why: without the separator these dispatch to Trae's `help`/`config` subcommands instead.
it('keeps subcommand-shaped Trae prompts as the positional prompt', () => {
expect(
buildAgentStartupPlan({

Check failure on line 138 in src/renderer/src/lib/tui-agent-startup.test.ts

View workflow job for this annotation

GitHub Actions / typecheck

Object is possibly 'null'.
agent: 'trae',
prompt: 'help me name this config',
cmdOverrides: {},
platform: 'linux'
}).launchCommand
).toBe("traecli -- 'help me name this config'")
})

it('uses cursor-agent as the actual launch binary', () => {
expect(
buildAgentStartupPlan({
Expand Down
17 changes: 12 additions & 5 deletions src/shared/agent-headless-command.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { isAnteHeadlessOneShotCommand } from './ante-headless-command'
import { isClaudeHeadlessOneShotCommand } from './claude-headless-command'
import { isPrintModeHeadlessOneShotCommand } from './print-mode-headless-command'
import type { TuiAgent } from './types'

// Why: a table (not an if-chain) so adding an agent is one entry; Claude and Trae share
// the same `--print` one-shot contract, Ante's `--prompt` form needs its own matcher.
const HEADLESS_ONE_SHOT_MATCHERS: Partial<
Record<TuiAgent, (tokens: readonly string[]) => boolean>
> = {
claude: isPrintModeHeadlessOneShotCommand,
trae: isPrintModeHeadlessOneShotCommand,
ante: isAnteHeadlessOneShotCommand
}

export function isHeadlessOneShotAgentCommand(agent: TuiAgent, tokens: readonly string[]): boolean {
if (agent === 'claude') {
return isClaudeHeadlessOneShotCommand(tokens)
}
return agent === 'ante' && isAnteHeadlessOneShotCommand(tokens)
return HEADLESS_ONE_SHOT_MATCHERS[agent]?.(tokens) ?? false
}

type AgentCommandRecognition = { agent: TuiAgent } | null
Expand Down
Binary file added src/shared/agent-icons/trae.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/shared/agent-kind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const TUI_AGENT_KIND_BY_AGENT = {
copilot: 'copilot',
grok: 'grok',
devin: 'devin',
ante: 'ante'
ante: 'ante',
trae: 'trae'
} satisfies Record<TuiAgent, ConcreteAgentKind>

// Why: `satisfies Record<TuiAgent, …>` makes the lookup exhaustive at compile
Expand Down
36 changes: 36 additions & 0 deletions src/shared/agent-process-recognition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,42 @@ describe('agent process recognition', () => {
})
})

it('recognizes Trae by its traecli binary, not the ambiguous trae-cli name', () => {
expect(recognizeAgentProcess('traecli')).toEqual({
agent: 'trae',
processName: 'traecli'
})
expect(recognizeAgentProcess('/Users/dev/.local/bin/traecli')).toEqual({
agent: 'trae',
processName: 'traecli'
})
expect(isExpectedAgentProcess('/Users/dev/.local/bin/traecli', 'traecli')).toBe(true)
expect(isRecognizedAgentType('traecli')).toBe(true)
// Why: `trae-cli` and `trae-agent` both name the unrelated open-source bytedance/trae-agent.
expect(recognizeAgentProcess('trae-cli')).toBeNull()
expect(recognizeAgentProcess('trae-agent')).toBeNull()
})

it('does not recognize Trae headless one-shot commands as interactive agents', () => {
expect(recognizeAgentProcessFromCommandLine('traecli -p "summarize this diff"')).toBeNull()
expect(recognizeAgentProcessFromCommandLine('traecli --print "review this"')).toBeNull()
expect(
recognizeAgentProcessFromCommandLine('traecli --output-format json "review this"')
).toBeNull()
expect(
recognizeAgentProcessFromCommandLine('traecli --output-format=stream-json review')
).toBeNull()
expect(recognizeAgentProcessFromCommandLine('traecli --resume AUTO')).toEqual({
agent: 'trae',
processName: 'traecli'
})
// Why: past `--` nothing is a flag, so this is the interactive pane Orca itself launches.
expect(recognizeAgentProcessFromCommandLine('traecli -- "--print the release notes"')).toEqual({
agent: 'trae',
processName: 'traecli'
})
})

it('recognizes Mistral Vibe by its installed executable and legacy alias', () => {
expect(recognizeAgentProcess('/home/dev/.local/bin/vibe')).toEqual({
agent: 'mistral-vibe',
Expand Down
1 change: 1 addition & 0 deletions src/shared/agent-status-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type WellKnownAgentType =
| 'hermes'
| 'devin'
| 'ante'
| 'trae'
| 'unknown'
export type AgentType = WellKnownAgentType | (string & {})

Expand Down
1 change: 1 addition & 0 deletions src/shared/agent-type-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const WELL_KNOWN_LABELS: Record<string, string> = {
hermes: 'Hermes',
devin: 'Devin',
ante: 'Ante',
trae: 'Trae',
kimi: 'Kimi'
}

Expand Down
7 changes: 2 additions & 5 deletions src/shared/ante-headless-command.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const ANTE_HEADLESS_PROMPT_FLAGS = new Set(['--prompt', '-p'])
import { optionName } from './print-mode-headless-command'

function optionName(token: string): string {
const eq = token.indexOf('=')
return eq === -1 ? token : token.slice(0, eq)
}
const ANTE_HEADLESS_PROMPT_FLAGS = new Set(['--prompt', '-p'])

function isAnteHeadlessPromptFlag(token: string): boolean {
const name = optionName(token)
Expand Down
32 changes: 0 additions & 32 deletions src/shared/claude-headless-command.ts

This file was deleted.

38 changes: 38 additions & 0 deletions src/shared/print-mode-headless-command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const PRINT_MODE_FLAGS = new Set(['--print', '-p'])
const HEADLESS_OUTPUT_FORMATS = new Set(['json', 'stream-json'])

export function optionName(token: string): string {
const eq = token.indexOf('=')
return eq === -1 ? token : token.slice(0, eq)
}

function optionValue(tokens: readonly string[], index: number): string | null {
const token = tokens[index]
const eq = token.indexOf('=')
if (eq !== -1) {
return token.slice(eq + 1)
}
return tokens[index + 1] ?? null
}

// Why: `--print`/`-p` prints one response and exits, and `--output-format json|stream-json`
// is only meaningful there — either means a headless run, not the interactive TUI Orca hosts.
export function isPrintModeHeadlessOneShotCommand(tokens: readonly string[]): boolean {
for (let index = 1; index < tokens.length; index += 1) {
// Why: `--` ends option parsing, so a prompt that reads like `--print` is still a prompt.
if (tokens[index] === '--') {
return false
}
const name = optionName(tokens[index])
if (PRINT_MODE_FLAGS.has(name)) {
return true
}
if (name === '--output-format') {
const value = optionValue(tokens, index)?.toLowerCase()
if (value && HEADLESS_OUTPUT_FORMATS.has(value)) {
return true
}
}
}
return false
}
1 change: 1 addition & 0 deletions src/shared/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const AGENT_KIND_VALUES = [
'grok',
'devin',
'ante',
'trae',
'other'
] as const
export const agentKindSchema = z.enum(AGENT_KIND_VALUES)
Expand Down
12 changes: 12 additions & 0 deletions src/shared/tui-agent-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ export const TUI_AGENT_CONFIG: Record<TuiAgent, TuiAgentConfig> = {
// Why: `ante --prompt` is headless (runs once and exits), so launch the bare TUI and inject after startup.
promptInjectionMode: 'stdin-after-start'
},
trae: {
// Why: two unrelated CLIs ship a `trae-cli` binary — this one and the open-source
// bytedance/trae-agent — so detect on `traecli`, an alias only this one installs.
detectCmd: 'traecli',
launchCmd: 'traecli',
expectedProcess: 'traecli',
// Why: `traecli [prompt]` takes the task as a positional argv, same as Claude/Codex.
promptInjectionMode: 'argv',
// Why: separator so prompts starting with `help`/`config`/`-…` aren't parsed as a
// Trae subcommand or flag — `--` stops both in its Cobra parser.
argvPromptSeparator: '--'
},
opencode: {
detectCmd: 'opencode',
launchCmd: 'opencode',
Expand Down
1 change: 1 addition & 0 deletions src/shared/tui-agent-display-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const TUI_AGENT_DISPLAY_NAMES: Record<TuiAgent, string> = {
codex: 'Codex',
devin: 'Devin',
ante: 'Ante',
trae: 'Trae',
autohand: 'Autohand Code',
opencode: 'OpenCode',
'mimo-code': 'MiMo Code',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/tui-agent-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export const YOLO_TUI_AGENT_ARGS: Partial<Record<TuiAgent, string>> = {
copilot: '--yolo',
grok: '--permission-mode bypassPermissions',
devin: '--permission-mode bypass',
ante: '--yolo'
ante: '--yolo',
trae: '--yolo'
}

export const YOLO_TUI_AGENT_ENV: Partial<Record<TuiAgent, Record<string, string>>> = {
Expand Down
1 change: 1 addition & 0 deletions src/shared/tui-agent-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const TUI_AGENT_AUTO_PICK_ORDER = [
'opencode',
'mimo-code',
'ante',
'trae',
'pi',
'omp',
'gemini',
Expand Down
Loading
Loading