Files
orca/src/shared/native-chat-agent-support.ts
T
Brennan Benson 0121f571e4 fix(agent-status): map codex request_user_input questions to Needs You (#9861)
* fix(agent-status): map codex request_user_input questions to waiting

Codex 0.145 asks user questions via the auto-allowed request_user_input
tool (experimental default_mode_request_user_input): PreToolUse fires
while blocked on the answer with no Stop, so Orca showed the pane as
working/idle instead of Needs You. Map that PreToolUse to waiting
(mirrors grok's ask_user_question), exempt question waits from the codex
yolo auto-approval suppressor, and deliver native-chat answers to the
digit-commit selector by option number (typed labels are ignored and
Enter commits the highlighted first option). Older codex versions emit
no such event and are unchanged.

* fix(native-chat): preserve codex question answer semantics
2026-07-22 12:00:14 -07:00

38 lines
1.4 KiB
TypeScript

export type NativeChatTranscriptAgent = 'claude' | 'codex' | 'grok'
/** Agents whose transcripts the native chat view can parse and render. */
export const NATIVE_CHAT_SUPPORTED_AGENTS: ReadonlySet<string> = new Set([
'claude',
'openclaude',
'codex',
'grok'
])
export function isNativeChatSupportedAgent(agent: string | null | undefined): boolean {
return agent != null && NATIVE_CHAT_SUPPORTED_AGENTS.has(agent)
}
/** 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') {
return agent
}
return null
}