mirror of
https://github.com/stablyai/orca.git
synced 2026-11-01 09:37:33 +00:00
Route terminal-backed OMP question cards to the owning terminal and refuse automated ask answer/cancel writes. Preserve structured semantic answers and recognize OMP multi-select metadata. Verified against the real OMP selector source; automatic semantic card answering remains tracked in #26692. Co-authored-by: jairuspace <jairusbpace@gmail.com> Co-authored-by: Daniel Lopez <dafeloru@gmail.com>
65 lines
2.4 KiB
TypeScript
65 lines
2.4 KiB
TypeScript
import type { TuiAgent } from './tui-agent'
|
|
|
|
export type NativeChatTranscriptAgent = 'claude' | 'codex' | 'grok' | 'omp' | 'opencode'
|
|
|
|
/** Agents whose transcripts the native chat view can parse and render. */
|
|
export const NATIVE_CHAT_SUPPORTED_AGENT_LIST: readonly TuiAgent[] = [
|
|
'claude',
|
|
'openclaude',
|
|
'codex',
|
|
'grok',
|
|
'omp',
|
|
'opencode',
|
|
'opencode2',
|
|
'zcode'
|
|
]
|
|
|
|
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 Model-A SSH transcript reader is not supported. A hook path alone
|
|
* does not establish owning-host reads, so OMP remains gated even with metadata. */
|
|
export function nativeChatRequiresLocalTranscript(agent: string | null | undefined): boolean {
|
|
const transcriptAgent = resolveNativeChatTranscriptAgent(agent)
|
|
return transcriptAgent === 'grok' || transcriptAgent === 'omp' || transcriptAgent === 'opencode'
|
|
}
|
|
|
|
/** Selector TUIs require key steps rather than pasted option labels. */
|
|
export function shouldStepNativeChatAskAnswer(agent: string | null | undefined): boolean {
|
|
const transcriptAgent = resolveNativeChatTranscriptAgent(agent)
|
|
return (
|
|
transcriptAgent === 'claude' || transcriptAgent === 'codex' || transcriptAgent === 'opencode'
|
|
)
|
|
}
|
|
|
|
/** OMP's configurable keys and existing checkbox state cannot be replaced through PTY input. */
|
|
export function nativeChatAskRequiresTerminal(agent: string | null | undefined): boolean {
|
|
return resolveNativeChatTranscriptAgent(agent) === 'omp'
|
|
}
|
|
|
|
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 === 'opencode' || agent === 'opencode2' || agent === 'zcode') {
|
|
return 'opencode'
|
|
}
|
|
if (agent === 'codex' || agent === 'grok' || agent === 'omp') {
|
|
return agent
|
|
}
|
|
return null
|
|
}
|
|
|
|
export function nativeChatApprovalAcceptKey(agent: string | null | undefined): string {
|
|
return resolveNativeChatTranscriptAgent(agent) === 'opencode' ? '\r' : '1'
|
|
}
|