import { isAnteHeadlessOneShotCommand } from './ante-headless-command' import { isPrimeAgentHeadlessOneShotCommand } from './prime-agent-headless-command' import { isPrintModeHeadlessOneShotCommand } from './print-mode-headless-command' import type { TuiAgent } from './tui-agent' // Why: a table (not an if-chain) so adding an agent is one entry; Claude and Trae share // the same `--print` one-shot contract, Ante's `--prompt` form and Prime Agent's // `--mode` forms need their own matchers. const HEADLESS_ONE_SHOT_MATCHERS: Partial< Record boolean> > = { claude: isPrintModeHeadlessOneShotCommand, trae: isPrintModeHeadlessOneShotCommand, 'prime-agent': isPrimeAgentHeadlessOneShotCommand, ante: isAnteHeadlessOneShotCommand } export function isHeadlessOneShotAgentCommand(agent: TuiAgent, tokens: readonly string[]): boolean { return HEADLESS_ONE_SHOT_MATCHERS[agent]?.(tokens) ?? false } type AgentCommandRecognition = { agent: TuiAgent } | null export function filterHeadlessOneShotAgentCommand( recognition: T, tokens: readonly string[] ): T | null { if (recognition && isHeadlessOneShotAgentCommand(recognition.agent, tokens)) { return null } return recognition }