Multiplayer agent harness for work.
Show readable gateway model names and provider icons (#1176)
Regan Bellbfb1ed1ed175
diff --git a/docs/screenshots/gateway-models/after.jpg b/docs/screenshots/gateway-models/after.jpgnew file mode 100644index 000000000..1b040cf9dBinary files /dev/null and b/docs/screenshots/gateway-models/after.jpg differdiff --git a/docs/screenshots/gateway-models/before.png b/docs/screenshots/gateway-models/before.pngnew file mode 100644index 000000000..7e1f53394Binary files /dev/null and b/docs/screenshots/gateway-models/before.png differdiff --git a/plugins/web-ui/src/composer.ts b/plugins/web-ui/src/composer.tsindex 0d969b262..b9cee9d6f 100644--- a/plugins/web-ui/src/composer.ts+++ b/plugins/web-ui/src/composer.ts@@ -971,8 +971,11 @@ export function createComposerSurface(ctx: ConvCtx): ComposerSurface {}function modelGlyph(option: ModelOption): TemplateResult {- const provider = String(option.model.provider);- const mark = modelMark(provider, 16) ?? modelMark(option.harnessId, 16);+ const provider = option.displayProvider ?? String(option.model.provider);+ const mark =+ option.harnessId === "codex"+ ? modelMark("codex", 16)+ : (modelMark(provider, 16) ?? modelMark(option.harnessId, 16));return html`<span class="loadout-icon" data-provider=${provider} aria-hidden="true">${mark ?? icon(Sparkles, 16)}</span>`;diff --git a/plugins/web-ui/src/model-options.ts b/plugins/web-ui/src/model-options.tsindex 1f6c6679b..8cd40ddb8 100644--- a/plugins/web-ui/src/model-options.ts+++ b/plugins/web-ui/src/model-options.ts@@ -12,6 +12,7 @@ export interface ModelOption {label: string;buttonLabel: string;groupLabel: string;+ displayProvider?: string;}const HARNESS_LABELS: Record<string, string> = {@@ -49,6 +50,24 @@ function providerLabel(id: string, name: string, provider: string): string {);}+function gatewayPresentation(id: string, provider: string): { label: string; provider: string } | null {+ if (provider !== "qm:gateway" || !id.startsWith("gateway/")) return null;+ const name = id.split("/").at(-1)!;+ const family = /^(claude|gpt|gemini)-(.+)$/.exec(name);+ if (!family) return null;+ const words = family[2]!.replace(/^((?:[a-z]+-)*)(\d+)-(\d+)(?=-|$)/, "$1$2.$3").split("-");+ const title = words.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");+ const brand = {+ claude: { prefix: "", provider: "anthropic" },+ gpt: { prefix: "GPT-", provider: "openai" },+ gemini: { prefix: "Gemini ", provider: "google" },+ }[family[1] as "claude" | "gpt" | "gemini"];+ return {+ label: brand.prefix + title,+ provider: brand.provider,+ };+}+function buildOption(id: string,harnessId = "pi",@@ -60,13 +79,27 @@ function buildOption(const meta = dynamic ? { label: dynamic.label, buttonLabel: dynamic.buttonLabel } : null;if (!meta) return null;const model = getBaseModel(id, dynamic);+ const presentation = gatewayPresentation(id, String(model.provider));return {value: qualified ? `${harnessId}:${id}` : id,harnessId,harnessLabel: HARNESS_LABELS[harnessId] ?? harnessId,model,...meta,- groupLabel: providerLabel(id, meta.label, dynamic?.provider ?? String(model?.provider ?? model?.api ?? "other")),+ ...(presentation+ ? {+ label: [id, id.slice("gateway/".length)].includes(meta.label) ? presentation.label : meta.label,+ buttonLabel: [id, id.slice("gateway/".length)].includes(meta.buttonLabel)+ ? presentation.label+ : meta.buttonLabel,+ displayProvider: presentation.provider,+ }+ : {}),+ groupLabel: providerLabel(+ id,+ meta.label,+ presentation?.provider ?? dynamic?.provider ?? String(model?.provider ?? model?.api ?? "other"),+ ),};} catch {return null;diff --git a/plugins/web-ui/src/ui.ts b/plugins/web-ui/src/ui.tsindex 992560f37..e5dd2e7f7 100644--- a/plugins/web-ui/src/ui.ts+++ b/plugins/web-ui/src/ui.ts@@ -78,6 +78,9 @@ export function slackMark(size = 14): TemplateResult {const CLAUDE_MARK ="M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z";+const OPENAI_MARK =+ "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z";+const CODEX_FRAME ="M19.503 0H4.496A4.496 4.496 0 000 4.496v15.007A4.496 4.496 0 004.496 24h15.007A4.496 4.496 0 0024 19.503V4.496A4.496 4.496 0 0019.503 0z";@@ -92,18 +95,47 @@ const OPENCODE_FRAME = "M180 60H60V240H180V60ZM240 300H0V0H240V300Z";const OPENCODE_SCREEN = "M180 240H60V120H180V240Z";-const MARK_KEYS: Record<string, "claude" | "codex" | "pi" | "opencode"> = {+const MARK_KEYS: Record<string, "claude" | "codex" | "pi" | "opencode" | "gemini" | "openai"> = {anthropic: "claude",+ google: "gemini",+ gemini: "gemini",opencode: "opencode",pi: "pi",claude: "claude",- openai: "codex",+ openai: "openai",codex: "codex",};export function modelMark(key: string, size = 16): TemplateResult | null {const mark = MARK_KEYS[key.toLocaleLowerCase()];if (!mark) return null;+ if (mark === "openai")+ return html`<svg+ class="model-mark"+ width=${size}+ height=${size}+ viewBox="0 0 24 24"+ role="img"+ aria-label="OpenAI"+ focusable="false"+ >+ <path fill="currentColor" d=${OPENAI_MARK} />+ </svg>`;+ if (mark === "gemini")+ return html`<svg+ class="model-mark"+ width=${size}+ height=${size}+ viewBox="0 0 24 24"+ role="img"+ aria-label="Gemini"+ focusable="false"+ >+ <path+ fill="#4285f4"+ d="M12 1C10.5 8.5 8.5 10.5 1 12c7.5 1.5 9.5 3.5 11 11 1.5-7.5 3.5-9.5 11-11C15.5 10.5 13.5 8.5 12 1Z"+ />+ </svg>`;if (mark === "opencode")return html`<svgclass="model-mark"diff --git a/plugins/web-ui/test/composer-picker.test.ts b/plugins/web-ui/test/composer-picker.test.tsindex c6f271ce6..2051157a1 100644--- a/plugins/web-ui/test/composer-picker.test.ts+++ b/plugins/web-ui/test/composer-picker.test.ts@@ -124,7 +124,7 @@ test("the model picker remembers compatible harnesses without duplicating or chamodelCatalog: {alpha: model("alpha", "Alpha"),beta: model("beta", "Beta", "openai"),- gamma: model("gamma", "Gamma"),+ gamma: model("gamma", "Gamma", "openai"),delta: model("delta", "Delta"),epsilon: model("epsilon", "Epsilon"),},@@ -237,6 +237,9 @@ test("the model picker remembers compatible harnesses without duplicating or chabutton(".loadout-button").click();await tick();assert.deepEqual(names(), ["Beta", "Alpha", "Gamma"]);+ assert.ok(pick("Beta").querySelector('[aria-label="Codex"]'));+ assert.ok(pick("Gamma").querySelector('[aria-label="OpenAI"]'));+ assert.equal(pick("Gamma").querySelector('[aria-label="Codex"]'), null);assert.equal(pick("Alpha").querySelector(".loadout-harness")?.textContent, "Claude Code");assert.equal(host.querySelectorAll(".loadout-default").length, 1);assert.equal(pick("Alpha").querySelector(".loadout-default")?.textContent, "my default");diff --git a/plugins/web-ui/test/model-options.test.ts b/plugins/web-ui/test/model-options.test.tsindex 8f7cebe25..f41e94bd3 100644--- a/plugins/web-ui/test/model-options.test.ts+++ b/plugins/web-ui/test/model-options.test.ts@@ -111,3 +111,44 @@ test("deleted selection retains identity and transcript rendering does not borroassert.equal(defaultModelValue("scope:deleted"), "pi:custom");assert.equal(transcriptModel("scope:deleted")?.id, "custom");});++test("gateway choices display model names and brands without changing serving identity", () => {+ const cases = [+ ["anthropic/claude-sonnet-5", "Sonnet 5", "anthropic", "Anthropic"],+ ["anthropic/claude-fable-5-1", "Fable 5.1", "anthropic", "Anthropic"],+ ["openai/gpt-6-astra", "GPT-6 Astra", "openai", "OpenAI"],+ ["openai/gpt-5.6-terra", "GPT-5.6 Terra", "openai", "OpenAI"],+ ["openai/gpt-5.6-1", "GPT-5.6 1", "openai", "OpenAI"],+ ["gemini/gemini-3.8-flash", "Gemini 3.8 Flash", "google", "Google"],+ ];+ for (const [route, label, provider, group] of cases) {+ const id = `gateway/${route}`;+ const data = metadata(id!, route!, "qm:gateway");+ const [option] = runtimeModelOptions(["pi"], { pi: [id] }, { [id]: data });+ assert.equal(option?.label, label);+ assert.equal(option?.buttonLabel, label);+ assert.equal(option?.displayProvider, provider);+ assert.equal(option?.groupLabel, group);+ assert.equal(option?.value, `pi:${id}`);+ assert.equal(option?.model.provider, "qm:gateway");+ assert.equal(option?.model.id, id);+ assert.deepEqual(option?.model.cost, data.cost);+ }+});++test("gateway display preserves explicit labels and leaves unknown families alone", () => {+ const id = "gateway/anthropic/claude-sonnet-5";+ const custom = { ...metadata(id, "Writing model", "qm:gateway"), buttonLabel: "Writer" };+ const unknownId = "gateway/vendor/special-model";+ const unknown = metadata(unknownId, "Special", "qm:gateway");+ const [knownOption, unknownOption] = runtimeModelOptions(+ ["pi"],+ { pi: [id, unknownId] },+ { [id]: custom, [unknownId]: unknown },+ );+ assert.equal(knownOption?.label, "Writing model");+ assert.equal(knownOption?.buttonLabel, "Writer");+ assert.equal(knownOption?.displayProvider, "anthropic");+ assert.equal(unknownOption?.label, "Special");+ assert.equal(unknownOption?.displayProvider, undefined);+});