Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const TITLE_AGENT_LABEL_TO_TYPE: Record<string, AgentType> = {
Jcode: 'jcode',
Antigravity: 'antigravity',
OpenCode: 'opencode',
'Qwen Code': 'qwen-code',
Aider: 'aider',
Cursor: 'cursor',
Droid: 'droid',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,28 @@ describe('buildWorktreeAgentRows', () => {

expect(rows.map((row) => [row.paneKey, row.state])).toEqual([[childPaneKey, 'done']])
})

it('adds title-derived rows for hook-less Qwen Code panes', () => {
const rows = buildWorktreeAgentRows({
tabs: [makeTab('tab-1')],
entries: [],
retained: [],
runtimePaneTitlesByTabId: {
'tab-1': {
1: 'Qwen Code',
2: '⠋ Qwen Code'
}
},
ptyIdsByTabId: { 'tab-1': ['pty-left', 'pty-right'] },
terminalLayoutsByTabId: {
'tab-1': makeSplitPaneLayout(LEAF_ID_1, LEAF_ID_1_SECOND)
},
now: 2000
})

expect(rows.map((row) => [row.agentType, row.state, row.entry.lastAssistantMessage])).toEqual([
['qwen-code', 'idle', 'Idle'],
['qwen-code', 'working', 'Running']
])
})
})
1 change: 1 addition & 0 deletions src/shared/agent-status/presentation/agent-type-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const WELL_KNOWN_LABELS: Record<string, string> = {
opencode: 'OpenCode',
opencode2: 'OpenCode 2',
'mimo-code': 'MiMo Code',
'qwen-code': 'Qwen Code',
cursor: 'Cursor',
aider: 'Aider',
pi: 'Pi',
Expand Down
5 changes: 4 additions & 1 deletion src/shared/agent-status/title/agent-name-token-match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export const AGENT_NAMES = [
'grok',
'devin',
'zcode',
'jcode'
'jcode',
// Why: Qwen Code installs as `qwen`; token-match is safe (uncommon in cwd names)
// and keeps the hook-less title-derived sidebar path aligned with process recognition.
'qwen'
]

// Allow Windows launcher suffixes such as openclaude.exe while rejecting arbitrary dotted paths.
Expand Down
5 changes: 5 additions & 0 deletions src/shared/agent-status/title/agent-title-identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ function computeAgentLabel(title: string): string | null {
if (HERMES_AGENT_NAME_RE.test(title)) {
return 'Hermes'
}
// Why: after other named agents so mixed titles like "Aider: compare qwen output"
// keep the owner identity; still before Claude's braille fallback.
if (titleHasAgentName(title, 'qwen')) {
return 'Qwen Code'
}
if (isClaudeAgent(title)) {
return 'Claude Code'
}
Expand Down
7 changes: 5 additions & 2 deletions src/shared/agent-status/title/agent-title-name-anchoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const NAME_TOKENS: readonly (readonly [string, TerminalAgent])[] = [
['openclaw', 'openclaw'],
['aider', 'aider'],
['grok', 'grok'],
['devin', 'devin']
['devin', 'devin'],
// Qwen Code's hook-less sidebar row reads the `qwen` process title, not only the display label.
['qwen', 'qwen-code']
]

/** Agents whose name is matched by a dedicated pattern rather than a plain token. */
Expand All @@ -39,7 +41,8 @@ const EMITTED_DISPLAY_LABEL_AGENTS = [
'mimo-code',
'prime-agent',
'command-code',
'copilot'
'copilot',
'qwen-code'
] as const satisfies readonly TerminalAgent[]

const DISPLAY_LABELS = [
Expand Down
45 changes: 45 additions & 0 deletions src/shared/agent-status/title/qwen-code-title-identity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { describe, expect, it } from 'vitest'
import { formatAgentTypeLabel } from '../presentation/agent-type-label'
import { getAgentLabel as getSharedAgentLabel } from './agent-title-identity'
import { detectAgentStatusFromTitle } from './agent-title-status'
import { getAgentLabel, resolveTerminalTitleAgentType } from './terminal-title-agent-type'

describe('Qwen Code title identity', () => {
it('maps Qwen Code product titles to qwen-code', () => {
expect(resolveTerminalTitleAgentType('Qwen Code')).toBe('qwen-code')
expect(resolveTerminalTitleAgentType('⠋ Qwen Code')).toBe('qwen-code')
expect(resolveTerminalTitleAgentType('qwen ready')).toBe('qwen-code')
expect(getAgentLabel('Qwen Code')).toBe('Qwen Code')
expect(getAgentLabel('⠋ Qwen Code')).toBe('Qwen Code')
expect(getAgentLabel('qwen ready')).toBe('Qwen Code')
})

it.each([
['Qwen Code', 'idle'],
['qwen ready', 'idle'],
['qwen working', 'working'],
['\u280b Qwen Code', 'working']
] as const)('classifies %s', (title, expectedStatus) => {
expect(getAgentLabel(title)).toBe('Qwen Code')
expect(detectAgentStatusFromTitle(title)).toBe(expectedStatus)
})

it.each(['~/qwen/working', 'qwen-code-fixtures ready'])(
'does not classify path or hyphen false positive %s',
(title) => {
expect(getAgentLabel(title)).toBeNull()
expect(detectAgentStatusFromTitle(title)).toBeNull()
}
)

it("maps 'qwen-code' to 'Qwen Code'", () => {
expect(formatAgentTypeLabel('qwen-code')).toBe('Qwen Code')
})

it('does not let a qwen mention reclassify another named agent title', () => {
expect(resolveTerminalTitleAgentType('Aider: compare qwen output')).toBe('aider')
expect(resolveTerminalTitleAgentType('⠋ Aider: compare qwen output')).toBe('aider')
expect(getAgentLabel('Aider: compare qwen output')).toBe('Aider')
expect(getSharedAgentLabel('Aider: compare qwen output')).toBe('Aider')
})
})
6 changes: 6 additions & 0 deletions src/shared/agent-status/title/terminal-title-agent-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ function computeAgentLabel(title: string): string | null {
if (HERMES_AGENT_NAME_RE.test(title)) {
return 'Hermes'
}
// Why: after other named agents so mixed titles keep the owner; still before
// Claude's braille fallback (keep in sync with agent-title-identity.ts).
if (titleHasAgentName(title, 'qwen')) {
return 'Qwen Code'
}
if (isClaudeAgent(title)) {
return 'Claude Code'
}
Expand Down Expand Up @@ -238,6 +243,7 @@ const TITLE_LABEL_TO_AGENT: Partial<Record<string, TerminalAgent>> = {
OpenCode: 'opencode',
'OpenCode 2': 'opencode2',
'MiMo Code': 'mimo-code',
'Qwen Code': 'qwen-code',
Aider: 'aider',
Cursor: 'cursor',
Droid: 'droid',
Expand Down