// Launchable agents/CLIs offered when opening a new panel. Only the installed
// ones are surfaced (probed via whichAgents); "shell" and "custom…" are always
// available. Keep this list as the single source of truth — Wizard and
// SurfacePicker both consume it.
export const KNOWN_AGENTS = ["claude", "codex", "gemini", "deepseek", "opencode"];
export const SHELL = "shell";
export const CUSTOM = "custom…";

/** Human label for an agent choice (the shell is presented as "Terminal"). */
export function agentLabel(choice: string): string {
  return choice === SHELL ? "Terminal" : choice;
}

/** Map a picker choice (+ optional custom command line) to an applyPreset slot spec. */
export function specForChoice(choice: string, custom: string): { command?: string; args?: string[] } {
  if (choice === SHELL) return {};
  if (choice === CUSTOM) {
    const parts = (custom ?? "").trim().split(/\s+/).filter(Boolean);
    return parts.length ? { command: parts[0], args: parts.slice(1) } : {};
  }
  return { command: choice };
}
