mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(agent-status): limit emitted display evidence
This commit is contained in:
@@ -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'],
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user