an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
feat: agent providers - spawn Gemini workers via the Antigravity CLI
Gulumbd2a83453ffe
diff --git a/src/main/hive.ts b/src/main/hive.tsindex 5b040cdb..c27f8415 100644--- a/src/main/hive.ts+++ b/src/main/hive.ts@@ -26,6 +26,7 @@ import { spawnSync } from 'node:child_process';import { randomBytes, createHash } from 'node:crypto';import type { AgentUsageSample } from './usage';import { COMMAND_GROUPS } from '../shared/claudeCommands';+import { isHiveAwareProvider, type AgentProvider } from '../shared/agentProvider';// ─── Types ──────────────────────────────────────────────────────────────────@@ -60,6 +61,8 @@ export interface HiveTask {export interface AgentMeta {id: string;name: string;+ /** Which CLI this agent runs on. Defaults to 'claude' when unset (legacy). */+ provider?: AgentProvider;role?: string;capabilities?: string[];cwd: string;@@ -284,6 +287,15 @@ export class HiveManager {AGENT_DIR: dir};+ // Non-Claude providers (e.g. Antigravity's `agy`) don't understand Claude+ // Code's flags or hook protocol. They still get a hive workspace + the+ // shared AGENT_* env above, but no telemetry/prompt/settings injection —+ // and direct hive mail to them bounces to the god (router). This is what+ // makes the floor runnable without Claude installed at all.+ if (!isHiveAwareProvider(meta.provider)) {+ return { args: [], env };+ }+// Stage 7A — first-party Claude Code telemetry → the embedded loopback OTLP// collector (telemetry.ts). Pure env, no --settings change. Only injected// once the collector is up (otelEndpoint set), so telemetry-off installs and@@ -553,6 +565,19 @@ export class HiveManager {}, godId);continue;}+ // Non-Claude workers (e.g. Antigravity's `agy`) don't run the hive's Stop+ // hook, so they never drain their inbox — direct mail would rot unread.+ // Bounce it to the god (the same way assistant mail bounces) so the+ // orchestrator relays it as a live prompt instead. God himself is exempt+ // (he may legitimately run on any provider and is the bounce target).+ if (t !== godId && !isHiveAwareProvider(reg.agents[t]?.provider)) {+ this.deliver({+ ...msg,+ to: godId,+ subject: `[bounced — "${t}" runs ${reg.agents[t]?.provider ?? 'a non-Claude CLI'} and can't read its hive inbox; relay this to it] ${msg.subject}`+ }, godId);+ continue;+ }this.deliver(msg, t);}this.appendLog({ kind: 'message', from: msg.from, to: msg.to, act: msg.act, subject: msg.subject, id: msg.id });diff --git a/src/main/index.ts b/src/main/index.tsindex 053454bf..89e64f38 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -25,6 +25,7 @@ import { listIssues, listCIRuns } from './github';import { SlackWebhookServer } from './slack';import { TelemetryCollector } from './telemetry';import { ControlRegistry } from './control';+import { inferAgentProvider, isClaudeProvider, type AgentProvider } from '../shared/agentProvider';const isDev = !!process.env.ELECTRON_RENDERER_URL;const ptyManager = new PtyManager();@@ -637,10 +638,14 @@ function createWindow(): void {}// ─── IPC: pty lifecycle ─────────────────────────────────────────────────────-ipcMain.handle('pty:spawn', async (_evt, opts: SpawnOptions & { hive?: AgentMeta; isolate?: boolean; resume?: boolean }) => {+ipcMain.handle('pty:spawn', async (_evt, opts: SpawnOptions & { hive?: AgentMeta; isolate?: boolean; resume?: boolean; provider?: AgentProvider }) => {if (!opts || typeof opts.id !== 'string' || typeof opts.cwd !== 'string' || typeof opts.command !== 'string') {return { ok: false, error: 'invalid SpawnOptions' };}+ // Which CLI is this? Explicit wins; else inferred from the binary (claude/agy).+ // Non-Claude providers skip every Claude-only spawn step below.+ const provider = inferAgentProvider(opts.command, opts.provider ?? opts.hive?.provider);+ const claudeProvider = isClaudeProvider(provider);// Git isolation: when requested and the cwd is a real repo, give this agent// its own worktree on an `agent/<id>` branch so it can't clobber other agents'// (or the user's) working tree. Best-effort — a failure falls back to the@@ -678,7 +683,7 @@ ipcMain.handle('pty:spawn', async (_evt, opts: SpawnOptions & { hive?: AgentMetaif (opts.hive && hive.enabled()) {try {const inj = hive.ensureAgent(- { ...opts.hive, cwd: opts.cwd },+ { ...opts.hive, cwd: opts.cwd, provider },{ semanticMemory: memory.active(), theme: readConfig().terminalTheme ?? 'light' });opts.args = [...(opts.args ?? []), ...inj.args];@@ -691,7 +696,9 @@ ipcMain.handle('pty:spawn', async (_evt, opts: SpawnOptions & { hive?: AgentMeta}// Long-run guardrails + tiering (Lane A #6.4/#6.6). All additive to the args// already assembled (incl. the hive injection); an explicit choice always wins.- if (opts.hive) {+ // Claude-only — these are Claude Code flags; other CLIs carry their own flags+ // in the command string the renderer already built.+ if (opts.hive && claudeProvider) {const cfg = readConfig();const args = opts.args ?? [];// Model precedence: an explicit per-agent --model (from the renderer) wins;@@ -718,7 +725,10 @@ ipcMain.handle('pty:spawn', async (_evt, opts: SpawnOptions & { hive?: AgentMeta// Pre-accept Claude Code's bypass-mode warning + folder-trust dialog so the// agent (spawned with --permission-mode bypassPermissions) doesn't stall on an// interactive prompt it can't answer and exit code 1. Best-effort, never blocks.- try { ensureClaudePermissionsAccepted(opts.cwd); } catch { /* never block spawn */ }+ // Claude-only — other CLIs handle their own permission UX.+ if (claudeProvider) {+ try { ensureClaudePermissionsAccepted(opts.cwd); } catch { /* never block spawn */ }+ }const res = ptyManager.spawn(opts);syncKeepAwake(); // arm the power-save blocker while ≥1 agent PTY is alive (#18)return res;diff --git a/src/preload/index.ts b/src/preload/index.tsindex 2e224ddd..4b26bf48 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -1,8 +1,11 @@import { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron';+import type { AgentProvider } from '../shared/agentProvider';export interface HiveAgentMeta {id: string;name: string;+ /** Which CLI this agent runs on (claude/antigravity/custom); defaults claude. */+ provider?: AgentProvider;role?: string;capabilities?: string[];cwd: string;@@ -62,6 +65,8 @@ export interface SpawnPtyOptions {id: string;cwd: string;command: string;+ /** Which CLI to spawn; usually inferred from `command` in the main process. */+ provider?: AgentProvider;args?: string[];cols?: number;rows?: number;diff --git a/src/renderer/src/components/AddAgentModal.tsx b/src/renderer/src/components/AddAgentModal.tsxindex d6d50b35..e9765b25 100644--- a/src/renderer/src/components/AddAgentModal.tsx+++ b/src/renderer/src/components/AddAgentModal.tsx@@ -6,7 +6,16 @@ import { Icon } from './Icon';import { useStore, type Agent } from '@/store/store';import { OFFICE_CAST, DEFAULT_CHARACTER, type OfficeCharacterName } from '@/scene/office/cast';import { type AccentColorName } from '@/design/tokens';-import { type HarnessConfig, buildSpawnCommand, AGENT_MODELS } from '@/store/config';+import {+ type HarnessConfig,+ type AgentProvider,+ buildSpawnCommand,+ modelsForProvider,+ inferAgentProvider,+ providerPreset,+ isClaudeProvider+} from '@/store/config';+import { AGENT_PROVIDER_PRESETS } from '@shared/agentProvider';const ACCENTS: AccentColorName[] = ['coral', 'mint', 'sky', 'lemon', 'lilac', 'peach'];@@ -26,20 +35,36 @@ export interface AddAgentModalProps {export function AddAgentModal({ onClose, config }: AddAgentModalProps) {const addAgent = useStore(s => s.addAgent);+ // Default provider follows whatever the global default command is (claude+ // unless the user reconfigured it); the model only carries over for Claude.+ const initialProvider = inferAgentProvider(config.defaultCommand);+ const initialModel = isClaudeProvider(initialProvider) ? config.defaultModel : undefined;+const [name, setName] = useState('Jim');const [character, setCharacter] = useState<OfficeCharacterName>(DEFAULT_CHARACTER);const [accent, setAccent] = useState<AccentColorName>('sky');const [cwd, setCwd] = useState<string>(config.registeredRepos[0] ?? '');- const [model, setModel] = useState<string | undefined>(config.defaultModel);- const [command, setCommand] = useState(buildSpawnCommand(config, config.defaultModel));+ const [provider, setProvider] = useState<AgentProvider>(initialProvider);+ const [model, setModel] = useState<string | undefined>(initialModel);+ const [command, setCommand] = useState(buildSpawnCommand(config, initialModel, initialProvider));const [description, setDescription] = useState('a fresh harness');// Picking a model rebuilds the command; the command field stays editable for// power users (it's the source of truth for the actual spawn).const pickModel = (id?: string) => {setModel(id);- setCommand(buildSpawnCommand(config, id));+ setCommand(buildSpawnCommand(config, id, provider));+ };+ // Switching provider resets the model to that CLI's default and rebuilds the+ // command from the provider's preset binary (so Antigravity spawns `agy`, not+ // the configured `claude`).+ const pickProvider = (id: AgentProvider) => {+ setProvider(id);+ const nextModel = isClaudeProvider(id) ? config.defaultModel : undefined;+ setModel(nextModel);+ setCommand(buildSpawnCommand(config, nextModel, id));};+ const preset = providerPreset(provider);const [goal, setGoal] = useState('');const [isolate, setIsolate] = useState(false);const [error, setError] = useState<string | undefined>();@@ -69,6 +94,7 @@ export function AddAgentModal({ onClose, config }: AddAgentModalProps) {cwd,command: exe,args,+ provider,cols: 100,rows: 30,// When set, the main process spawns this agent in its own git worktree.@@ -78,6 +104,7 @@ export function AddAgentModal({ onClose, config }: AddAgentModalProps) {id,name: name.trim(),cwd,+ provider,role: description.trim() || undefined}});@@ -103,6 +130,7 @@ export function AddAgentModal({ onClose, config }: AddAgentModalProps) {currentStation: 'desk',ptyId,command: command.trim(),+ provider,model,recentTextTs: Date.now()};@@ -178,9 +206,41 @@ export function AddAgentModal({ onClose, config }: AddAgentModalProps) {</div></Row>- <Row label="Model">+ <Row label="Provider">+ <div style={{ display: 'flex', gap: 6, flexWrap: 'wrap' }}>+ {AGENT_PROVIDER_PRESETS.map((p) => {+ const active = provider === p.id;+ return (+ <button+ key={p.id}+ onClick={() => pickProvider(p.id)}+ title={+ p.id === 'antigravity'+ ? 'Spawn the Antigravity CLI (agy) with a Gemini model'+ : p.id === 'custom'+ ? 'Run any command — no Claude-only flags'+ : p.label+ }+ style={{+ padding: '3px 8px 1px',+ background: active ? `var(--cth-${accent}-light)` : 'var(--cth-cream-100)',+ boxShadow: active+ ? 'inset 0 0 0 2px var(--cth-ink-900)'+ : 'inset 0 0 0 1px var(--cth-ink-700)',+ fontFamily: 'var(--cth-font-ui)', fontSize: 13,+ color: 'var(--cth-ink-900)', cursor: 'pointer', border: 'none'+ }}+ >+ {p.label}+ </button>+ );+ })}+ </div>+ </Row>++ {preset.supportsModel && <Row label="Model"><div style={{ display: 'flex', gap: 6, flexWrap: 'wrap' }}>- {AGENT_MODELS.map((m) => {+ {modelsForProvider(provider).map((m) => {const active = (model ?? '') === (m.id ?? '');return (<button@@ -202,13 +262,13 @@ export function AddAgentModal({ onClose, config }: AddAgentModalProps) {);})}</div>- </Row>+ </Row>}- <Row label={config.autoMode ? 'Command (auto mode on)' : 'Command'}>+ <Row label={config.autoMode && preset.autoFlag ? 'Command (auto mode on)' : 'Command'}><inputvalue={command}onChange={(e) => setCommand(e.target.value)}- placeholder="claude"+ placeholder={provider === 'antigravity' ? 'agy' : provider === 'custom' ? 'your-agent-cli' : 'claude'}style={{ ...inputStyle, fontFamily: 'var(--cth-font-mono)' }}/></Row>diff --git a/src/renderer/src/components/CommandCenterPanel.tsx b/src/renderer/src/components/CommandCenterPanel.tsxindex 30a2073f..3ec14933 100644--- a/src/renderer/src/components/CommandCenterPanel.tsx+++ b/src/renderer/src/components/CommandCenterPanel.tsx@@ -13,7 +13,7 @@ import { useFleetTelemetry } from '@/hooks/useTelemetry';import { COMMAND_GROUPS } from '@shared/claudeCommands';import { useStore, type Agent } from '@/store/store';import { usePtyParser } from '@/hooks/usePtyParser';-import { buildSpawnCommand, AGENT_MODELS } from '@/store/config';+import { buildSpawnCommand, AGENT_MODELS, modelsForProvider, inferAgentProvider, isClaudeProvider } from '@/store/config';/** Michael's control surface. Shown instead of the plain terminal/files panel* when the god agent is selected: terminal + queue, the floor roster (with@@ -297,15 +297,18 @@ function FloorTab({ seed }: { seed: { text: string; seq: number } }) {const cfg = await window.cth.getConfig();await window.cth.killPty(a.ptyId);disposeTerminal(a.ptyId);- const command = buildSpawnCommand(cfg, model);+ // Respawn on the same CLI this agent already runs on (inferred from its+ // command if not explicitly tagged) so an Antigravity worker stays `agy`.+ const provider = inferAgentProvider(a.command, a.provider);+ const command = buildSpawnCommand(cfg, model, provider);const [exe, ...args] = command.trim().split(/\s+/);const hive = a.isGod- ? { id: a.id, name: a.name, cwd: a.cwd, isGod: true, role: 'orchestrator (god)' }+ ? { id: a.id, name: a.name, cwd: a.cwd, provider, isGod: true, role: 'orchestrator (god)' }: a.isAssistant- ? { id: a.id, name: a.name, cwd: a.cwd, isAssistant: true, role: "Michael's prep assistant" }- : { id: a.id, name: a.name, cwd: a.cwd, role: a.description };- const res = await window.cth.spawnPty({ id: a.ptyId, cwd: a.cwd, command: exe, args, cols: 100, rows: 30, hive });- if (res.ok) updateAgent(a.id, { command: command.trim(), model, status: 'idle', action: 'restarting…' });+ ? { id: a.id, name: a.name, cwd: a.cwd, provider, isAssistant: true, role: "Michael's prep assistant" }+ : { id: a.id, name: a.name, cwd: a.cwd, provider, role: a.description };+ const res = await window.cth.spawnPty({ id: a.ptyId, cwd: a.cwd, command: exe, args, provider, cols: 100, rows: 30, hive });+ if (res.ok) updateAgent(a.id, { command: command.trim(), provider, model, status: 'idle', action: 'restarting…' });} catch { /* noop */ } finally {setRestarting(null);}@@ -525,12 +528,16 @@ function FloorTab({ seed }: { seed: { text: string; seq: number } }) {disabled={restarting === a.id}onChange={(v) => restartWithModel(a, v || undefined)}>- {AGENT_MODELS.map((m) => (+ {modelsForProvider(inferAgentProvider(a.command, a.provider)).map((m) => (<option key={m.label} value={m.id ?? ''}>{m.label}</option>))}</Select><span style={{ fontSize: 11, color: 'var(--cth-ink-500)' }}>- {restarting === a.id ? 'restarting…' : 'model (restarts agent)'}+ {restarting === a.id+ ? 'restarting…'+ : isClaudeProvider(inferAgentProvider(a.command, a.provider))+ ? 'model (restarts agent)'+ : `${inferAgentProvider(a.command, a.provider)} · model (restarts agent)`}</span></div></div>diff --git a/src/renderer/src/store/config.ts b/src/renderer/src/store/config.tsindex 6f77596c..5ac2a5d1 100644--- a/src/renderer/src/store/config.ts+++ b/src/renderer/src/store/config.ts@@ -1,6 +1,22 @@// Mirrors src/main/config.ts. Kept as a renderer-side type-only module// so we don't have to reach into the preload package to type-check.+import {+ AGENT_PROVIDER_PRESETS,+ providerPreset,+ inferAgentProvider,+ isClaudeProvider,+ type AgentProvider+} from '@shared/agentProvider';++export {+ AGENT_PROVIDER_PRESETS,+ providerPreset,+ inferAgentProvider,+ isClaudeProvider,+ type AgentProvider+};+/** A recurring auto-dispatched mission (mirrors src/main/config.ts). */export interface ScheduledMission {id: string;@@ -75,13 +91,40 @@ export const AGENT_MODELS: ModelOption[] = [{ id: 'claude-haiku-4-5-20251001', label: 'Haiku 4.5' }];-/** Build the command line to feed into spawnPty, honoring autoMode and an- * optional per-agent model override (injected as `--model <model>`). */+/** Gemini models offered when an agent runs on the Antigravity CLI (`agy`).+ * `--model` is free-form, so these are presets — the command field stays+ * editable. Run `agy models` (once logged in) for the live list. */+export const ANTIGRAVITY_MODELS: ModelOption[] = [+ { id: undefined, label: 'default' },+ { id: 'gemini-3-pro', label: 'Gemini 3 Pro' },+ { id: 'gemini-3-flash', label: 'Gemini 3 Flash' },+ { id: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro' },+ { id: 'gemini-2.5-flash', label: 'Gemini 2.5 Flash' }+];++/** The model preset list for a given provider's picker. */+export function modelsForProvider(provider: AgentProvider): ModelOption[] {+ return provider === 'antigravity' ? ANTIGRAVITY_MODELS : AGENT_MODELS;+}++/** Build the command line to feed into spawnPty, honoring the provider's flags,+ * autoMode, and an optional per-agent model override. Claude keeps the user's+ * configured `defaultCommand`; other providers use their preset binary so the+ * app works without Claude installed. */export function buildSpawnCommand(config: Pick<HarnessConfig, 'defaultCommand' | 'autoMode'>,- model?: string+ model?: string,+ provider: AgentProvider = inferAgentProvider(config.defaultCommand)): string {- const base = config.defaultCommand || 'claude';- const withModel = model ? `${base} --model ${model}` : base;- return config.autoMode ? `${withModel} --permission-mode bypassPermissions` : withModel;+ const preset = providerPreset(provider);+ const base =+ provider === 'claude'+ ? config.defaultCommand || preset.defaultCommand+ : provider === 'custom'+ ? config.defaultCommand || ''+ : preset.defaultCommand;+ let cmd = base;+ if (preset.supportsModel && model && preset.modelFlag) cmd = `${cmd} ${preset.modelFlag} ${model}`;+ if (config.autoMode && preset.autoFlag) cmd = `${cmd} ${preset.autoFlag}`;+ return cmd;}diff --git a/src/renderer/src/store/store.ts b/src/renderer/src/store/store.tsindex 17cd2575..24f80495 100644--- a/src/renderer/src/store/store.ts+++ b/src/renderer/src/store/store.ts@@ -2,6 +2,7 @@ import { create } from 'zustand';import type { AccentColorName } from '@/design/tokens';import type { OfficeCharacterName } from '@/scene/office/cast';import type { StatusKind } from '@/components/PixelBadge';+import type { AgentProvider } from '@shared/agentProvider';export type ToolKind =| 'Read' | 'Edit' | 'Write' | 'Bash' | 'WebFetch' | 'WebSearch'@@ -48,10 +49,13 @@ export interface Agent {blockReason?: BlockReason;/** present iff this agent has a real PTY in the main process */ptyId?: string;- /** the command being run in the PTY (e.g. 'claude') */+ /** the command being run in the PTY (e.g. 'claude' or 'agy') */command?: string;- /** the model this agent runs on (e.g. 'claude-sonnet-4-6[1m]'); drives the- * model selector + the --model arg used when (re)spawning the agent */+ /** which CLI this agent runs on; drives the model picker + spawn flags.+ * Defaults to 'claude' when unset (legacy agents / inferred from command). */+ provider?: AgentProvider;+ /** the model this agent runs on (e.g. 'claude-sonnet-4-6[1m]' or 'gemini-3-pro');+ * drives the model selector + the --model arg used when (re)spawning the agent */model?: string;/** the last prompt the user submitted to this agent in Claude Code —* shown on the floor as a card above the seated avatar */diff --git a/src/shared/agentProvider.ts b/src/shared/agentProvider.tsnew file mode 100644index 00000000..8af13d82--- /dev/null+++ b/src/shared/agentProvider.ts@@ -0,0 +1,102 @@+/**+ * Agent providers — the CLI a worker runs on. The app is no longer Claude-only:+ * a worker can run Claude Code or the Antigravity CLI (`agy`, Gemini models), or+ * any custom command. Each provider declares how to build its spawn command+ * (model flag, auto-mode flag) and whether it accepts the hive's Claude-specific+ * identity injection (`--append-system-prompt` + `--settings`).+ *+ * Shared between main and renderer; keep it dependency-free (no electron, no UI).+ * Mirrors the shape of the upstream provider-preset work (PR #47 / issue #21) so+ * the two reconcile cleanly — this build adds the `antigravity` preset.+ */++export type AgentProvider = 'claude' | 'antigravity' | 'custom';++export interface AgentProviderPreset {+ id: AgentProvider;+ label: string;+ /** The binary spawned when the user hasn't typed a custom command. */+ defaultCommand: string;+ /** Show a model picker and splice the model into the command. */+ supportsModel: boolean;+ /** Flag that selects the session model, e.g. `--model`. */+ modelFlag?: string;+ /** Flag appended when the floor is in auto (skip-permissions) mode. */+ autoFlag?: string;+ /** Claude Code accepts the hive identity injection (`--append-system-prompt`+ * + hook `--settings`). Other CLIs don't — they spawn with the shared AGENT_*+ * env only, and direct hive mail to them bounces to the god. */+ hiveAware: boolean;+}++export const AGENT_PROVIDER_PRESETS: AgentProviderPreset[] = [+ {+ id: 'claude',+ label: 'Claude Code',+ defaultCommand: 'claude',+ supportsModel: true,+ modelFlag: '--model',+ autoFlag: '--permission-mode bypassPermissions',+ hiveAware: true+ },+ {+ id: 'antigravity',+ label: 'Antigravity · Gemini',+ defaultCommand: 'agy',+ supportsModel: true,+ modelFlag: '--model',+ autoFlag: '--dangerously-skip-permissions',+ hiveAware: false+ },+ {+ id: 'custom',+ label: 'Custom',+ defaultCommand: '',+ supportsModel: false,+ hiveAware: false+ }+];++export function isAgentProvider(value: unknown): value is AgentProvider {+ return value === 'claude' || value === 'antigravity' || value === 'custom';+}++export function normalizeAgentProvider(value: unknown): AgentProvider | undefined {+ return isAgentProvider(value) ? value : undefined;+}++export function providerPreset(provider: AgentProvider): AgentProviderPreset {+ return AGENT_PROVIDER_PRESETS.find((p) => p.id === provider) ?? AGENT_PROVIDER_PRESETS[0];+}++export function isClaudeProvider(provider: AgentProvider | undefined): boolean {+ return provider === 'claude';+}++/** Whether this provider takes the hive's Claude-only identity injection. */+export function isHiveAwareProvider(provider: AgentProvider | undefined): boolean {+ return providerPreset(provider ?? 'claude').hiveAware;+}++/** The bare executable from a command string ('agy --model x' → 'agy'). */+function commandBinary(command: string | undefined): string {+ const first = (command ?? '').trim().split(/\s+/)[0] ?? '';+ // strip a path + extension so 'C:\...\agy.exe' and '/usr/bin/claude' both map+ const leaf = first.split(/[\\/]/).pop() ?? first;+ return leaf.replace(/\.(exe|cmd|bat|ps1)$/i, '').toLowerCase();+}++/** Infer the provider from a command (or honor an explicit override). */+export function inferAgentProvider(command: string | undefined, explicit?: unknown): AgentProvider {+ const normalized = normalizeAgentProvider(explicit);+ if (normalized) return normalized;+ const bin = commandBinary(command);+ if (bin === 'agy' || bin === 'antigravity') return 'antigravity';+ if (bin === 'claude' || !bin) return 'claude';+ return 'custom';+}++export function defaultCommandForProvider(provider: AgentProvider, fallback = ''): string {+ if (provider === 'custom') return fallback;+ return providerPreset(provider).defaultCommand || fallback;+}