Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix: expose Antigravity effort levels
Ahmar2f604bb86e93
diff --git a/server/drivers/antigravity-acp.ts b/server/drivers/antigravity-acp.tsindex 855a88bfc4..b36a4927ea 100644--- a/server/drivers/antigravity-acp.ts+++ b/server/drivers/antigravity-acp.ts@@ -10,6 +10,7 @@ import { killCliTree, spawnCli } from "../procs.ts";import type { ModelCatalog } from "../contracts.ts";import type { ChildProcess } from "node:child_process";import type { AntigravityRuntime } from "./antigravity-runtime.ts";+import { acpVariantOption } from "./acp/config-options.ts";import {VERIFICATION_TEMP_KEY,antigravityTempDir,@@ -525,7 +526,13 @@ export function catalogFromAntigravityConfigOptions(const options = modelOptions(model?.options);if (!options.length) return null;const current = typeof model?.currentValue === "string" ? model.currentValue : "";- return { default: options.some((option) => option.id === fallbackDefault) ? fallbackDefault : current || options[0]!.id, options };+ const defaultModel = options.some((option) => option.id === fallbackDefault) ? fallbackDefault : current || options[0]!.id;+ const selectedModel = current || defaultModel;+ const variants = acpVariantOption({ configOptions })?.options;+ return {+ default: defaultModel,+ options: options.map((option) => option.id === selectedModel && variants?.length ? { ...option, variants } : option),+ };}export async function probeAntigravityModels(input: {diff --git a/server/drivers/antigravity.test.ts b/server/drivers/antigravity.test.tsindex 24507dba1e..bce4df22d6 100644--- a/server/drivers/antigravity.test.ts+++ b/server/drivers/antigravity.test.ts@@ -92,12 +92,30 @@ describe("official Antigravity catalog", () => {{ value: "account-high", name: "Account High" },{ group: "More", options: [{ value: "account-low", name: "Account Low" }] },],+ }, {+ id: "thinking_level",+ category: "thought_level",+ type: "select",+ currentValue: "high",+ options: [+ { value: "low", name: "Low" },+ { value: "medium", name: "Medium" },+ { value: "high", name: "High" },+ ],}];expect(catalogFromAntigravityConfigOptions(options, "missing")).toEqual({default: "account-low",options: [{ id: "account-high", label: "Account High" },- { id: "account-low", label: "Account Low" },+ {+ id: "account-low",+ label: "Account Low",+ variants: [+ { id: "low", label: "Low" },+ { id: "medium", label: "Medium" },+ { id: "high", label: "High" },+ ],+ },],});});@@ -700,6 +718,16 @@ describe("Antigravity driver over shared ACP", () => {GOOGLE_API_KEY: "also-must-not-leak",FAKE_ACP_AUTH_METHOD: "oauth-personal",FAKE_ACP_MODELS: "gemini-3.8-flash-high,gemini-3.8-flash-low",+ FAKE_ACP_VARIANTS: JSON.stringify({+ "gemini-3.8-flash-low": {+ currentValue: "medium",+ options: [+ { value: "low", name: "Low" },+ { value: "medium", name: "Medium" },+ { value: "high", name: "High" },+ ],+ },+ }),FAKE_ACP_MODES: "default,yolo,auto_edit",FAKE_ACP_DUMP: dump,// Inherited temp folders: replaced on Windows, passed through elsewhere.@@ -716,6 +744,7 @@ describe("Antigravity driver over shared ACP", () => {approvalMode,resumeCursor: "fake-acp-session",model: "gemini-3.8-flash-low",+ variant: "high",integrations: {custom: { docs: { command: "docs-mcp", args: ["serve"], env: { TOKEN: "scoped" } } },},@@ -735,6 +764,7 @@ describe("Antigravity driver over shared ACP", () => {expect(calls).toEqual([{ method: "session/set_config_option", params: { sessionId: "fake-acp-session", configId: "model", value: "gemini-3.8-flash-low" } },{ method: "session/set_config_option", params: { sessionId: "fake-acp-session", configId: "mode", value: approvalMode === "full" ? "yolo" : approvalMode === "edits" ? "auto_edit" : "default" } },+ { method: "session/set_config_option", params: { sessionId: "fake-acp-session", configId: "effort", value: "high" } },]);const mcp = JSON.parse(readFileSync(`${dump}.mcp.json`, "utf8"));expect(mcp).toEqual([{ name: "docs", command: "docs-mcp", args: ["serve"], env: [{ name: "TOKEN", value: "scoped" }] }]);diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.tsindex 9939cba0a0..01828dcfcb 100644--- a/server/drivers/antigravity.ts+++ b/server/drivers/antigravity.ts@@ -60,6 +60,7 @@ const support: AcpSupport = {images: true,spawnArgs: () => [],selectModel: { configId: "model" },+ modelVariants: true,// Google's server reads its new-session default from this variable (agy_acp_server 1.4.3// model_selection.get_default_model_id); a later switch re-fetches the model list (1.3-1.8 s).sessionModelEnv: "AGY_ACP_DEFAULT_MODEL",diff --git a/src/components/ModelPicker.tsx b/src/components/ModelPicker.tsxindex 66e3616ba2..b4e20dd405 100644--- a/src/components/ModelPicker.tsx+++ b/src/components/ModelPicker.tsx@@ -7,6 +7,7 @@ import type { ModelVariantOption } from "../../shared/runtime-events";import { filterCustomModels, partitionCustomModels, suggestedModels } from "@/lib/custom-models";import { configuredModelInstances, isClaudeAccount, isCustomOnly, SIGN_IN_FAMILY_LABEL, signInFamily } from "@/lib/engine-rail";import { modelName, simpleModelMenu } from "@/lib/simple-model-menu";+import { choiceIsSelected, modelChoices, type ModelChoice } from "@/lib/model-choices";import { pickerPlacement, type PickerPlacement } from "@/lib/picker-placement";import { isTypeaheadKey, TYPEAHEAD_RESET_MS, typeaheadMatch, typeaheadText, type Typeahead } from "@/lib/menu-keys";import { usePopoverDismiss } from "@/hooks/use-popover-dismiss";@@ -32,7 +33,6 @@ import { threadsOnOwnModel } from "../../shared/thread-model";import { ThreadModelsLine } from "./ThreadModelsLine";import { Select } from "./Select";-type ModelOption = InstanceInfo["models"]["options"][number];const COMPACT_MODEL_COUNT = 5;function modelLabel(instance: InstanceInfo | undefined, model: string): string {@@ -510,9 +510,10 @@ export function ModelPicker({dispatch({ type: "setModel", botId: bot.id, threadId: threadId ?? bot.threadId, updateBotDefault: false, selection: profile.modelSelection });};- const pick = (instance: InstanceInfo, model: string) => {+ const pick = (instance: InstanceInfo, model: string, variant?: string) => {if (bot.busy || instance.policy) return;const nextSelection = modelSelectionForPick(selection, instance, model);+ if (variant !== undefined) nextSelection.variant = variant;const updateBotDefault = !threadId || (simpleView ? simpleUpdatesBotDefault : scope === "bot");const targets = updateBotDefault ? [currentTaskBot(profile, threadId ?? bot.threadId), profile] : [bot];if (targets.some((target) => modelSwitchNeedsAsk(approvalModeFor(target),@@ -534,9 +535,10 @@ export function ModelPicker({close(true);};- const official = railInstance?.models.options.filter((option) => !option.custom) ?? [];+ const official = railInstance ? modelChoices(railInstance, railInstance.models.options.filter((option) => !option.custom)) : [];const custom = railInstance?.models.options.filter((option) => option.custom) ?? [];- const currentModel = selection.instanceId === railInstance?.instanceId ? selection.model : undefined;+ const currentModel = selection.instanceId === railInstance?.instanceId+ ? official.find((option) => choiceIsSelected(option, selection))?.id : undefined;const filteredOfficial = filterCustomModels(official, query);const compactOfficial = railInstance? suggestedModels(official, railInstance.models.default, currentModel, COMPACT_MODEL_COUNT)@@ -576,16 +578,16 @@ export function ModelPicker({: levels.length > 0 && !shown.busy ? { levels, current: selection.effort, onPick: writeEffort, onReset: () => writeEffort(undefined) }: null;- const botModelId = follows !== undefined && profile.modelSelection.instanceId === railInstance?.instanceId- ? profile.modelSelection.model : undefined;- const renderRow = (option: ModelOption) => (+ const botModelSelection = follows !== undefined && profile.modelSelection.instanceId === railInstance?.instanceId+ ? profile.modelSelection : undefined;+ const renderRow = (option: ModelChoice) => (<ModelRowkey={option.id}option={option}- current={selection.instanceId === railInstance?.instanceId && selection.model === option.id}+ current={selection.instanceId === railInstance?.instanceId && choiceIsSelected(option, selection)}defaultId={railInstance?.models.default ?? ""}- botModel={option.id === botModelId}- onPick={() => railInstance && pick(railInstance, option.id)}+ botModel={botModelSelection ? choiceIsSelected(option, botModelSelection) : false}+ onPick={() => railInstance && pick(railInstance, option.nativeModel ?? option.id, option.variant)}/>);diff --git a/src/components/SimpleModelMenu.tsx b/src/components/SimpleModelMenu.tsxindex 0ca2b2e2c4..7a08fc2d7c 100644--- a/src/components/SimpleModelMenu.tsx+++ b/src/components/SimpleModelMenu.tsx@@ -17,7 +17,7 @@ export type SimpleThinking =export interface SimpleMenuActions {onQuery: (query: string) => void;- onPick: (instance: InstanceInfo, model: string) => void;+ onPick: (instance: InstanceInfo, model: string, variant?: string) => void;onPickCurrent: () => void;onFollowBot: () => void;onToggle: (instance: InstanceInfo) => void;@@ -48,7 +48,7 @@ function MenuModel({ instance, row, onPick }: { instance: InstanceInfo; row: Menaria-label={[option.label, option.provider].filter(Boolean).join(" · ")}title={[option.label, option.provider, modelBlurb(option)].filter(Boolean).join(" · ")}tabIndex={-1}- onClick={() => onPick(instance, option.id)}+ onClick={() => onPick(instance, row.model ?? option.id, row.variant)}className={MENU_ROW}><Gutter />diff --git a/src/lib/model-choices.test.ts b/src/lib/model-choices.test.tsnew file mode 100644index 0000000000..0518f41f91--- /dev/null+++ b/src/lib/model-choices.test.ts@@ -0,0 +1,25 @@+import { describe, expect, it } from "vitest";++import type { InstanceInfo } from "@/state/store";+import { choiceIsSelected, modelChoices } from "./model-choices";++const antigravity = {+ instanceId: "google",+ driverKind: "antigravityAgent",+ displayName: "Google Gemini (Antigravity)",+ snapshot: { state: "available", version: "1.4.3" },+ models: { default: "gemini-3.8-flash", options: [{+ id: "gemini-3.8-flash", label: "Gemini 3.8 Flash",+ variants: [{ id: "low", label: "Low" }, { id: "medium", label: "Medium" }, { id: "high", label: "High" }],+ }] },+} as InstanceInfo;++describe("Antigravity model choices", () => {+ it("presents each advertised thinking level as a selectable model row", () => {+ const choices = modelChoices(antigravity, antigravity.models.options);+ expect(choices.map((choice) => choice.label)).toEqual([+ "Gemini 3.8 Flash · Low", "Gemini 3.8 Flash · Medium", "Gemini 3.8 Flash · High",+ ]);+ expect(choiceIsSelected(choices[1]!, { instanceId: "google", model: "gemini-3.8-flash", variant: "medium" })).toBe(true);+ });+});diff --git a/src/lib/model-choices.ts b/src/lib/model-choices.tsnew file mode 100644index 0000000000..50941a47bf--- /dev/null+++ b/src/lib/model-choices.ts@@ -0,0 +1,23 @@+import type { InstanceInfo, ModelSelection } from "@/state/store";++type ModelOption = InstanceInfo["models"]["options"][number];++export type ModelChoice = ModelOption & { nativeModel?: string; variant?: string };++/** Antigravity exposes one model plus a thinking level; present its levels wherever models are picked. */+export function modelChoices(instance: InstanceInfo, options: readonly ModelOption[]): ModelChoice[] {+ if (instance.driverKind !== "antigravityAgent") return [...options];+ return options.flatMap((option) => option.variants?.length+ ? option.variants.map((variant) => ({+ ...option,+ id: JSON.stringify([option.id, variant.id]),+ label: `${option.label} · ${variant.label}`,+ nativeModel: option.id,+ variant: variant.id,+ }))+ : [option]);+}++export function choiceIsSelected(choice: ModelChoice, selection: ModelSelection): boolean {+ return (choice.nativeModel ?? choice.id) === selection.model && choice.variant === selection.variant;+}diff --git a/src/lib/simple-model-menu.ts b/src/lib/simple-model-menu.tsindex 3e4e037c75..367110aaab 100644--- a/src/lib/simple-model-menu.ts+++ b/src/lib/simple-model-menu.ts@@ -4,6 +4,7 @@ import { t } from "./i18n";import { filterCustomModels, partitionCustomModels, suggestedModels } from "./custom-models";import { isCustomOnly, SIGN_IN_FAMILY_LABEL, signInFamily, splitEngineRail } from "./engine-rail";import { displayModelLabel, shortModelLabel } from "./model-friendly";+import { choiceIsSelected, modelChoices, type ModelChoice } from "./model-choices";export type ModelOption = InstanceInfo["models"]["options"][number];@@ -12,7 +13,9 @@ export const CURRENT_GROUP_SUGGESTIONS = 4;export const GROUP_SUGGESTIONS = 3;export interface MenuModelRow {- option: ModelOption;+ option: ModelChoice;+ model?: string;+ variant?: string;label: string;route?: string;current: boolean;@@ -95,7 +98,7 @@ export function repeatedModelLabels(options: readonly ModelOption[]): Set<stringfunction listedModels(instance: InstanceInfo) {const signedOut = !isCustomOnly(instance) && needsSignIn(instance);- const own = isCustomOnly(instance) || signedOut ? [] : instance.models.options.filter((option) => !option.custom);+ const own = isCustomOnly(instance) || signedOut ? [] : modelChoices(instance, instance.models.options.filter((option) => !option.custom));const local = partitionCustomModels(instance.models.options.filter((option) => option.custom));return { signedOut, own, all: [...own, ...local.pinned, ...local.rest] };}@@ -149,14 +152,16 @@ export function simpleModelMenu(input: SimpleMenuInput): SimpleMenu {if (needsCli(instance)) return query ? null : { kind: "setUp" };const { signedOut, own, all } = models.get(instance.instanceId)!;if (all.length === 0) return query ? null : signedOut ? { kind: "signIn" } : { kind: "empty", loading: input.refreshing === instance.instanceId };- const currentId = instance.instanceId === selection.instanceId ? selection.model : undefined;+ const currentSelection = instance.instanceId === selection.instanceId ? selection : undefined;const repeated = repeatedModelLabels(all);- const botModel = bot.follows === false && bot.selection.instanceId === instance.instanceId ? bot.selection.model : undefined;- const row = (option: ModelOption): MenuModelRow => ({+ const botSelection = bot.follows === false && bot.selection.instanceId === instance.instanceId ? bot.selection : undefined;+ const row = (option: ModelChoice): MenuModelRow => ({option,+ ...(option.nativeModel ? { model: option.nativeModel } : {}),+ ...(option.variant ? { variant: option.variant } : {}),label: shortModelLabel(option.label, provider),...(repeated.has(option.label) && option.provider ? { route: option.provider } : {}),- current: option.id === currentId,+ current: currentSelection ? choiceIsSelected(option, currentSelection) : false,});const mixed = own.length > 0 && own.length < all.length;if (query) {@@ -164,9 +169,10 @@ export function simpleModelMenu(input: SimpleMenuInput): SimpleMenu {return rows.length === 0 ? null: { kind: "models", rows, total: all.length, toggle: null, localFrom: localFrom(rows, mixed), signInForOwn: false, probing: false };}- const others = all.filter((option) => option.id !== currentId && option.id !== botModel);+ const others = all.filter((option) => (!currentSelection || !choiceIsSelected(option, currentSelection))+ && (!botSelection || !choiceIsSelected(option, botSelection)));const suggested = suggestedModels(others, instance.models.default, undefined,- currentId === undefined ? GROUP_SUGGESTIONS : CURRENT_GROUP_SUGGESTIONS);+ currentSelection === undefined ? GROUP_SUGGESTIONS : CURRENT_GROUP_SUGGESTIONS);const rest = others.filter((option) => !suggested.includes(option));const open = expanded.has(instance.instanceId) || rest.length === 1;const rows = (open ? [...suggested, ...rest] : suggested).map(row);