Files
orca/src/shared/native-chat-agent-support.ts
Brennan Benson 0665c758d1 feat(settings): name the agents the Chat UI supports (#16830)
The Chat UI setting described itself in terms of "supported agent terminal panes" without naming them, and an unsupported agent falls back to the terminal silently — no toast, no toggle, no explanation. A user on OpenCode reported this as a bug in Discord.

Adds a "Supported agents:" icon row under the toggle, matching the existing StatusBarUsageEmptyCta legend pattern, driven by the same list the availability predicate uses so it cannot drift from actual support. Icons carry role="img" plus a tooltip for identification. Also adds the missing openclaude/omp settings-search keywords.
2026-08-27 15:49:52 -07:00

55 lines
2.2 KiB
TypeScript

import type { TuiAgent } from './tui-agent'
export type NativeChatTranscriptAgent = 'claude' | 'codex' | 'grok' | 'omp'
/** Agents whose transcripts the native chat view can parse and render, in the
* order the settings pane advertises them. */
export const NATIVE_CHAT_SUPPORTED_AGENT_LIST: readonly TuiAgent[] = [
'claude',
'openclaude',
'codex',
'grok',
'omp'
]
export const NATIVE_CHAT_SUPPORTED_AGENTS: ReadonlySet<string> = new Set(
NATIVE_CHAT_SUPPORTED_AGENT_LIST
)
export function isNativeChatSupportedAgent(agent: string | null | undefined): boolean {
return agent != null && NATIVE_CHAT_SUPPORTED_AGENTS.has(agent)
}
/** Agents whose hook discloses no transcript path (`extractAgentProviderSession`),
* so native chat can only reach the session file by scanning a sessions root on
* a disk THIS process can read. Under Model-A SSH that disk is the wrong host,
* so the chat view must stay closed instead of loading forever. */
export function nativeChatRequiresLocalTranscript(agent: string | null | undefined): boolean {
const transcriptAgent = resolveNativeChatTranscriptAgent(agent)
return transcriptAgent === 'grok' || transcriptAgent === 'omp'
}
/** True when the agent renders a digit-commit question selector that ignores
* typed label text (pasting "Blue" + Enter commits the highlighted FIRST
* option — STA-1860): Claude's AskUserQuestion and Codex 0.145's
* request_user_input card both behave this way, so answers must be delivered
* as per-option keystrokes. Other agents commit a pasted answer. */
export function shouldStepNativeChatAskAnswer(agent: string | null | undefined): boolean {
const transcriptAgent = resolveNativeChatTranscriptAgent(agent)
return transcriptAgent === 'claude' || transcriptAgent === 'codex'
}
export function resolveNativeChatTranscriptAgent(
agent: string | null | undefined
): NativeChatTranscriptAgent | null {
// Why: OpenClaude writes the Claude transcript format and layout even though
// Orca preserves its distinct agent identity for launch and UI behavior.
if (agent === 'claude' || agent === 'openclaude') {
return 'claude'
}
if (agent === 'codex' || agent === 'grok' || agent === 'omp') {
return agent
}
return null
}