fix(agent-status): limit emitted display evidence

This commit is contained in:
Brennan Benson
2026-08-24 11:26:23 -07:00
parent 076bd1bbb7
commit 00675b93af
2 changed files with 30 additions and 16 deletions
+17 -13
View File
@@ -1,6 +1,5 @@
import { describe, expect, it } from 'vitest'
import { collectAgentTitleEvidence } from './agent-title-evidence'
import { ALL_TUI_AGENTS, TUI_AGENT_DISPLAY_NAMES } from './tui-agent-display-names'
const agentFor = (title: string) => collectAgentTitleEvidence(title).agent
const reasonFor = (title: string) => collectAgentTitleEvidence(title).reason
@@ -113,27 +112,32 @@ describe('collectAgentTitleEvidence', () => {
})
})
it.each(ALL_TUI_AGENTS)('recognizes the canonical whole-title label for %s', (agent) => {
const title = TUI_AGENT_DISPLAY_NAMES[agent]
expect(collectAgentTitleEvidence(title)).toMatchObject({
agent,
reason: 'anchored'
})
})
it('does not treat an exact display name as free text', () => {
expect(collectAgentTitleEvidence('Grok').freeTextNames).toEqual([])
})
it.each([
['Claude Code', 'claude'],
['Gemini CLI', 'gemini'],
['Claude Agent Teams', 'claude-agent-teams'],
['MiMo Code', 'mimo-code'],
['Prime Agent', 'prime-agent'],
['Command Code', 'command-code'],
['GitHub Copilot', 'copilot'],
['Agent Teams', 'claude-agent-teams']
] as const)('recognizes the emitted whole-title alias %s', (title, agent) => {
expect(agentFor(title)).toBe(agent)
expect(reasonFor(title)).toBe('anchored')
})
it.each(['Continue', 'Charm', 'Goose', 'Amp'])(
'does not treat the UI-only display label %s as identity',
(title) => {
expect(agentFor(title)).toBeNull()
expect(reasonFor(title)).toBe('no-evidence')
}
)
it('does not treat an emitted label as free text', () => {
expect(collectAgentTitleEvidence('Prime Agent').freeTextNames).toEqual([])
})
it.each([
['Codex ready', 'codex'],
['Codex - action required', 'codex'],
+13 -3
View File
@@ -18,7 +18,7 @@ import {
SYNTHETIC_AGENT_TITLE_PROFILES
} from './synthetic-agent-title'
import type { TuiAgent } from './tui-agent'
import { ALL_TUI_AGENTS, TUI_AGENT_DISPLAY_NAMES } from './tui-agent-display-names'
import { TUI_AGENT_DISPLAY_NAMES } from './tui-agent-display-names'
/**
* Order-independent identity evidence from a terminal title.
@@ -78,9 +78,19 @@ const PATTERN_NAMES: readonly (readonly [RegExp, TuiAgent])[] = [
[HERMES_AGENT_NAME_RE, 'hermes']
]
/** Exact whole-title labels are strong evidence even for agents unsafe to match in free text. */
/** Catalog labels known to be emitted as terminal titles, not merely presented in Orca's UI. */
const EMITTED_DISPLAY_LABEL_AGENTS = [
'claude-agent-teams',
'mimo-code',
'prime-agent',
'command-code',
'copilot'
] as const satisfies readonly TuiAgent[]
const DISPLAY_LABELS = [
...ALL_TUI_AGENTS.map((agent) => [TUI_AGENT_DISPLAY_NAMES[agent].toLowerCase(), agent] as const),
...EMITTED_DISPLAY_LABEL_AGENTS.map(
(agent) => [TUI_AGENT_DISPLAY_NAMES[agent].toLowerCase(), agent] as const
),
['claude code', 'claude'],
['gemini cli', 'gemini'],
['agent teams', 'claude-agent-teams']