Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import type { AgentType } from './agent-status-types'
import type { AgentChoiceCliForm } from './agent-launch-choices'
import type { CatalogOptionApply } from './agent-session-option-catalog-types'
import { mergeAgentChoiceSettings, withoutInlineAgentChoiceSettings } from './agent-choice-settings'
import { removeAgentArgOption } from './agent-session-option-agent-args'
type ChoiceCliArgumentForm = Exclude<AgentChoiceCliForm, { kind: 'recipe' }>
export function agentChoiceConfigValue(value: string, key: string): string | undefined {
const separator = value.indexOf('=')
return separator !== -1 && value.slice(0, separator).trim() === key
? value.slice(separator + 1)
: undefined
}
/** The declared grammar owns both forward spelling and conflicting argument removal. */
export function agentChoiceCliApply(
agent: AgentType,
forms: readonly [ChoiceCliArgumentForm, ...ChoiceCliArgumentForm[]],
emitted: string
): CatalogOptionApply {
const encoder = forms.find((form) => form.names.includes(emitted)) ?? forms[0]
return {
cli: forms,
launchArgs: (value, trailing = []) =>
encoder.kind === 'settings'
? mergeAgentChoiceSettings(agent, encoder.names, trailing, encoder.key, value)
: encoder.kind === 'config'
? [emitted, `${encoder.key}=${String(value)}`]
: [emitted, String(value)],
removeAgentArgs: (tokens) =>
forms.reduce(
(kept, form) =>
form.kind === 'settings'
? withoutInlineAgentChoiceSettings(agent, form.names, kept)
: removeAgentArgOption(
agent,
kept,
form.names,
form.kind === 'config'
? (value) => agentChoiceConfigValue(value ?? '', form.key) !== undefined
: undefined
),
[...tokens]
)
}
}