Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
feat(web): add provider accounts from the provider page (#350)
Leo4c23d3ead619
diff --git a/.changeset/provider-add-account.md b/.changeset/provider-add-account.mdnew file mode 100644index 000000000..5929888b9--- /dev/null+++ b/.changeset/provider-add-account.md@@ -0,0 +1,5 @@+---+"akeru-bot": minor+---++Add a second account from a provider's page with **Add account**. The dialog no longer asks which provider to use or lists providers Akeru does not support. Adding a ChatGPT, Claude, Grok, Kimi, or OpenCode Go account only asks for a name; sign in from the new account's card.diff --git a/apps/web/src/components/Icons.tsx b/apps/web/src/components/Icons.tsxindex 239a991d5..1900837bd 100644--- a/apps/web/src/components/Icons.tsx+++ b/apps/web/src/components/Icons.tsx@@ -11,15 +11,6 @@ export {OpenCodeIcon,} from "./icons/ProviderIcons";-export {- ACPRegistryIcon,- ANTIGRAVITY_ICON_DATA_URL,- AntigravityIcon,- Gemini,- GithubCopilotIcon,- PiAgentIcon,-} from "./icons/AgentCatalogIcons";-export {DiscordIcon,IMessageIcon,diff --git a/apps/web/src/components/icons/AgentCatalogIcons.tsx b/apps/web/src/components/icons/AgentCatalogIcons.tsxdeleted file mode 100644index ef357a40c..000000000--- a/apps/web/src/components/icons/AgentCatalogIcons.tsx+++ /dev/null@@ -1,187 +0,0 @@-import { cn } from "~/lib/utils";-import { type Icon } from "./iconTypes";--export const ANTIGRAVITY_ICON_DATA_URL =- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAgKADAAQAAAABAAAAgAAAAABIjgR3AAAjOElEQVR4Ae1dCYxkV3W9tfdW3T0z3bMvPcxge2zGy2BjY0MwxEAWEBACihSCEiMUSFCiRJEsRygIiIKySUlYAkmMQSxJQAKi4AQngDcMAe87nsF4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IyrcIvNtkEAG7Oj5t+rpJtZmX47TfP9v9tVpxWeBtrbgAAAABJRU5ErkJggg==";--export const Gemini: Icon = (props) => (- <svg {...props} viewBox="0 0 296 298" fill="none">- <mask- id="gemini__a"- width="296"- height="298"- x="0"- y="0"- maskUnits="userSpaceOnUse"- className="mask-type-alpha"- >- <path- fill="var(--color-brand-gemini-blue)"- d="M141.201 4.886c2.282-6.17 11.042-6.071 13.184.148l5.985 17.37a184.004 184.004 0 0 0 111.257 113.049l19.304 6.997c6.143 2.227 6.156 10.91.02 13.155l-19.35 7.082a184.001 184.001 0 0 0-109.495 109.385l-7.573 20.629c-2.241 6.105-10.869 6.121-13.133.025l-7.908-21.296a184 184 0 0 0-109.02-108.658l-19.698-7.239c-6.102-2.243-6.118-10.867-.025-13.132l20.083-7.467A183.998 183.998 0 0 0 133.291 26.28l7.91-21.394Z"- />- </mask>- <g mask="url(#gemini__a)">- <g filter="url(#gemini__b)">- <ellipse cx="163" cy="149" fill="var(--color-brand-gemini-blue-soft)" rx="196" ry="159" />- </g>- <g filter="url(#gemini__c)">- <ellipse cx="33.5" cy="142.5" fill="var(--color-brand-gemini-yellow)" rx="68.5" ry="72.5" />- </g>- <g filter="url(#gemini__d)">- <ellipse cx="19.5" cy="148.5" fill="var(--color-brand-gemini-yellow)" rx="68.5" ry="72.5" />- </g>- <g filter="url(#gemini__e)">- <path- fill="var(--color-brand-gemini-red)"- d="M194 10.5C172 82.5 65.5 134.333 22.5 135L144-66l50 76.5Z"- />- </g>- <g filter="url(#gemini__f)">- <path- fill="var(--color-brand-gemini-red)"- d="M190.5-12.5C168.5 59.5 62 111.333 19 112L140.5-89l50 76.5Z"- />- </g>- <g filter="url(#gemini__g)">- <path- fill="var(--color-brand-gemini-green)"- d="M194.5 279.5C172.5 207.5 66 155.667 23 155l121.5 201 50-76.5Z"- />- </g>- <g filter="url(#gemini__h)">- <path- fill="var(--color-brand-gemini-green)"- d="M196.5 320.5C174.5 248.5 68 196.667 25 196l121.5 201 50-76.5Z"- />- </g>- </g>- <defs>- <filter- id="gemini__b"- width="464"- height="390"- x="-69"- y="-46"- colorInterpolationFilters="sRGB"- filterUnits="userSpaceOnUse"- >- <feFlood floodOpacity="0" result="BackgroundImageFix" />- <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />- <feGaussianBlur result="effect1_foregroundBlur_69_17998" stdDeviation="18" />- </filter>- <filter- id="gemini__c"- width="265"- height="273"- x="-99"- y="6"- colorInterpolationFilters="sRGB"- filterUnits="userSpaceOnUse"- >- <feFlood floodOpacity="0" result="BackgroundImageFix" />- <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />- <feGaussianBlur result="effect1_foregroundBlur_69_17998" stdDeviation="32" />- </filter>- <filter- id="gemini__d"- width="265"- height="273"- x="-113"- y="12"- colorInterpolationFilters="sRGB"- filterUnits="userSpaceOnUse"- >- <feFlood floodOpacity="0" result="BackgroundImageFix" />- <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />- <feGaussianBlur result="effect1_foregroundBlur_69_17998" stdDeviation="32" />- </filter>- <filter- id="gemini__e"- width="299.5"- height="329"- x="-41.5"- y="-130"- colorInterpolationFilters="sRGB"- filterUnits="userSpaceOnUse"- >- <feFlood floodOpacity="0" result="BackgroundImageFix" />- <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />- <feGaussianBlur result="effect1_foregroundBlur_69_17998" stdDeviation="32" />- </filter>- <filter- id="gemini__f"- width="299.5"- height="329"- x="-45"- y="-153"- colorInterpolationFilters="sRGB"- filterUnits="userSpaceOnUse"- >- <feFlood floodOpacity="0" result="BackgroundImageFix" />- <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />- <feGaussianBlur result="effect1_foregroundBlur_69_17998" stdDeviation="32" />- </filter>- <filter- id="gemini__g"- width="299.5"- height="329"- x="-41"- y="91"- colorInterpolationFilters="sRGB"- filterUnits="userSpaceOnUse"- >- <feFlood floodOpacity="0" result="BackgroundImageFix" />- <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />- <feGaussianBlur result="effect1_foregroundBlur_69_17998" stdDeviation="32" />- </filter>- <filter- id="gemini__h"- width="299.5"- height="329"- x="-39"- y="132"- colorInterpolationFilters="sRGB"- filterUnits="userSpaceOnUse"- >- <feFlood floodOpacity="0" result="BackgroundImageFix" />- <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />- <feGaussianBlur result="effect1_foregroundBlur_69_17998" stdDeviation="32" />- </filter>- </defs>- </svg>-);--export const AntigravityIcon: Icon = (props) => (- <svg {...props} viewBox="0 0 128 128" fill="none">- <image href={ANTIGRAVITY_ICON_DATA_URL} width="128" height="128" />- </svg>-);--export const GithubCopilotIcon: Icon = ({ className, ...props }) => (- <svg- {...props}- preserveAspectRatio="xMidYMid"- viewBox="0 0 256 208"- className={cn("fill-tint", className)}- >- <path d="M205.3 31.4c14 14.8 20 35.2 22.5 63.6 6.6 0 12.8 1.5 17 7.2l7.8 10.6c2.2 3 3.4 6.6 3.4 10.4v28.7a12 12 0 0 1-4.8 9.5C215.9 187.2 172.3 208 128 208c-49 0-98.2-28.3-123.2-46.6a12 12 0 0 1-4.8-9.5v-28.7c0-3.8 1.2-7.4 3.4-10.5l7.8-10.5c4.2-5.7 10.4-7.2 17-7.2 2.5-28.4 8.4-48.8 22.5-63.6C77.3 3.2 112.6 0 127.6 0h.4c14.7 0 50.4 2.9 77.3 31.4ZM128 78.7c-3 0-6.5.2-10.3.6a27.1 27.1 0 0 1-6 12.1 45 45 0 0 1-32 13c-6.8 0-13.9-1.5-19.7-5.2-5.5 1.9-10.8 4.5-11.2 11-.5 12.2-.6 24.5-.6 36.8 0 6.1 0 12.3-.2 18.5 0 3.6 2.2 6.9 5.5 8.4C79.9 185.9 105 192 128 192s48-6 74.5-18.1a9.4 9.4 0 0 0 5.5-8.4c.3-18.4 0-37-.8-55.3-.4-6.6-5.7-9.1-11.2-11-5.8 3.7-13 5.1-19.7 5.1a45 45 0 0 1-32-12.9 27.1 27.1 0 0 1-6-12.1c-3.4-.4-6.9-.5-10.3-.6Zm-27 44c5.8 0 10.5 4.6 10.5 10.4v19.2a10.4 10.4 0 0 1-20.8 0V133c0-5.8 4.6-10.4 10.4-10.4Zm53.4 0c5.8 0 10.4 4.6 10.4 10.4v19.2a10.4 10.4 0 0 1-20.8 0V133c0-5.8 4.7-10.4 10.4-10.4Zm-73-94.4c-11.2 1.1-20.6 4.8-25.4 10-10.4 11.3-8.2 40.1-2.2 46.2A31.2 31.2 0 0 0 75 91.7c6.8 0 19.6-1.5 30.1-12.2 4.7-4.5 7.5-15.7 7.2-27-.3-9.1-2.9-16.7-6.7-19.9-4.2-3.6-13.6-5.2-24.2-4.3Zm69 4.3c-3.8 3.2-6.4 10.8-6.7 19.9-.3 11.3 2.5 22.5 7.2 27a41.7 41.7 0 0 0 30 12.2c8.9 0 17-2.9 21.3-7.2 6-6.1 8.2-34.9-2.2-46.3-4.8-5-14.2-8.8-25.4-9.9-10.6-1-20 .7-24.2 4.3ZM128 56c-2.6 0-5.6.2-9 .5.4 1.7.5 3.7.7 5.7 0 1.5 0 3-.2 4.5 3.2-.3 6-.3 8.5-.3 2.6 0 5.3 0 8.5.3-.2-1.6-.2-3-.2-4.5.2-2 .3-4 .7-5.7-3.4-.3-6.4-.5-9-.5Z" />- </svg>-);--export const ACPRegistryIcon: Icon = ({ className, ...props }) => (- <svg {...props} viewBox="0 0 576 220" fill="none" className={cn("fill-tint", className)}>- <path d="M568.003 115.821L517.278 27.9661C507.183 10.4816 489.084 0.0227367 468.894 0.0227367C448.727 0.0227367 430.674 10.4361 420.556 27.8752L343.251 161.749H242.755C236.23 161.749 230.386 158.384 227.135 152.745C223.861 147.106 223.861 140.376 227.135 134.715L277.861 46.8603C281.112 41.2216 286.955 37.8338 293.481 37.8338C300.006 37.8338 305.827 41.1988 309.101 46.8603L312.125 52.0897C313.353 54.2042 315.604 55.5002 318.036 55.5002C320.469 55.5002 322.743 54.1815 323.948 52.067L337.385 28.5118C338.795 26.0335 338.522 22.9413 336.703 20.7586C325.699 7.57131 309.874 0 293.322 0C292.662 0 292.003 0 291.321 0.0454733C272.04 0.75031 254.76 11.1864 245.074 27.9434L200.215 105.657L155.81 29.1484C145.465 11.2092 126.594 0.0227367 106.608 0.0227367C105.949 0.0227367 105.289 0.0227367 104.607 0.06821C85.3265 0.773047 68.0467 11.2092 58.3608 27.9661L7.65806 115.821C-6.25678 139.899 -0.868187 168.82 21.05 187.759C29.8945 195.422 41.6039 199.628 54.0181 199.628H148.648C151.081 199.628 153.332 198.332 154.56 196.217L168.52 172.026C169.748 169.911 169.748 167.319 168.52 165.205C167.292 163.09 165.041 161.794 162.608 161.794H56.0417C49.5163 161.794 43.6729 158.429 40.4216 152.79C37.1475 147.152 37.1475 140.422 40.4216 134.76L91.1471 46.9057C94.3985 41.2671 100.242 37.8793 106.767 37.8793C113.293 37.8793 119.113 41.2443 122.387 46.9057L194.826 172.526C195.031 172.89 195.258 173.208 195.531 173.526C198.76 178.665 202.83 183.485 207.786 187.782C216.631 195.444 228.34 199.651 240.754 199.651H321.424L315.581 209.769C314.353 211.883 314.353 214.475 315.581 216.59C316.809 218.704 319.059 220 321.492 220H349.436C351.868 220 354.119 218.704 355.347 216.59L364.396 200.901L367.17 196.468C367.17 196.468 367.261 196.331 367.284 196.263L453.274 46.9285C456.525 41.2898 462.369 37.902 468.894 37.902C475.42 37.902 481.263 41.2671 484.514 46.9285L535.24 134.783C538.491 140.422 538.514 147.174 535.24 152.813C531.988 158.452 526.145 161.84 519.62 161.84H418.669C416.236 161.84 413.985 163.136 412.757 165.25L398.774 189.442C397.546 191.556 397.546 194.148 398.774 196.263C400.002 198.377 402.253 199.673 404.686 199.673H518.21C539.81 199.673 559.295 188.237 569.026 169.843C578.053 152.79 577.666 132.623 567.981 115.843L568.003 115.821Z" />- </svg>-);--export const PiAgentIcon: Icon = ({ className, ...props }) => (- <svg {...props} viewBox="0 0 800 800" fill="none" className={className}>- <rect width="800" height="800" rx="160" fill="var(--color-black)" />- <path- fill="var(--color-white)"- fillRule="evenodd"- d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"- />- <path fill="var(--color-white)" d="M517.36 400H634.72V634.72H517.36Z" />- </svg>-);diff --git a/apps/web/src/components/settings/AddProviderInstanceDialog.environment.test.tsx b/apps/web/src/components/settings/AddProviderInstanceDialog.environment.test.tsxindex 83370ecc5..eba167867 100644--- a/apps/web/src/components/settings/AddProviderInstanceDialog.environment.test.tsx+++ b/apps/web/src/components/settings/AddProviderInstanceDialog.environment.test.tsx@@ -31,6 +31,7 @@ vi.mock("../../hooks/useSettings", () => ({}));import { AddProviderInstanceDialog } from "./AddProviderInstanceDialog";+import { DRIVER_OPTIONS } from "./providerDriverMeta";const remoteEnvironmentId = EnvironmentId.make("remote-device");@@ -47,6 +48,7 @@ describe("AddProviderInstanceDialog environment routing", () => {open: true,environmentId: remoteEnvironmentId,environmentLabel: "Remote device",+ driverOption: DRIVER_OPTIONS[0]!,onOpenChange: vi.fn(),});diff --git a/apps/web/src/components/settings/AddProviderInstanceDialog.logic.ts b/apps/web/src/components/settings/AddProviderInstanceDialog.logic.tsindex fdffa9a19..d9dc0f054 100644--- a/apps/web/src/components/settings/AddProviderInstanceDialog.logic.ts+++ b/apps/web/src/components/settings/AddProviderInstanceDialog.logic.ts@@ -1,36 +1,81 @@-export type WizardNavigation =- | { readonly kind: "navigate"; readonly step: number }- | { readonly kind: "blocked"; readonly step: number; readonly error: string };+export type AddAccountWizardStep = "Service" | "Name" | "Connect";-const IDENTITY_STEP = 1;+/**+ * Steps of the add-account dialog. The dialog is opened from one provider's+ * page, so it never asks which provider. Custom API asks which service and+ * how to reach it; a subscription account only needs a name, and the user+ * signs in from its card afterwards.+ */+export function addAccountWizardSteps(options: {+ readonly choosesService: boolean;+}): readonly AddAccountWizardStep[] {+ return options.choosesService ? ["Service", "Name", "Connect"] : ["Name"];+}++// `ProviderInstanceId` in `@akeru/contracts` caps ids at 64 characters.+const MAX_INSTANCE_ID_LENGTH = 64;++// Room kept for a `_{n}` suffix when the name is already taken.+const SUFFIX_RESERVE = "_99999".length;++/**+ * Normalize a name into the slug part of an account id, so "Work" on driver+ * "codex" becomes `codex_work`. The slug is cut short enough that the driver+ * prefix and a collision suffix still fit the id length cap.+ */+function slugifyLabel(driver: string, value: string): string {+ const maxLength = Math.min(48, MAX_INSTANCE_ID_LENGTH - driver.length - 1 - SUFFIX_RESERVE);++ return value+ .trim()+ .toLowerCase()+ .replace(/[^a-z0-9]+/g, "_")+ .replace(/^_+|_+$/g, "")+ .slice(0, maxLength)+ .replace(/_+$/, "");+}-export const ADD_PROVIDER_WIZARD_STEPS = ["Driver", "Identity", "Config"] as const;+/**+ * First free `{driver}_{n}` number, starting at 2; the default account is+ * `{driver}`. `nameTaken` skips numbers whose display name another account+ * already uses, so a blank name never repeats a visible one.+ */+export function nextAccountNumber(+ driver: string,+ existing: ReadonlySet<string>,+ nameTaken: (index: number) => boolean = () => false,+): number {+ let index = 2;++ while (existing.has(`${driver}_${index}`) || nameTaken(index)) index += 1;++ return index;+}/**- * Resolve navigation within the add-provider wizard.- *- * Moving forward past Identity requires a valid instance id, whether the user- * advances one step at a time or skips directly to Config from a step header.- * A blocked skip lands on Identity so its existing inline validation is- * visible. Backward navigation is always preserved.+ * Account id from the name, or `{driver}_{n}` when the name is empty, with the+ * first free `_{n}` suffix when that id is taken.*/-export function resolveWizardNavigation(- currentStep: number,- requestedStep: number,- stepCount: number,- validation: { readonly instanceIdError: string | null },-): WizardNavigation {- const lastStep = Math.max(0, stepCount - 1);- const targetStep = Math.max(0, Math.min(lastStep, requestedStep));- const movesForwardPastIdentity = currentStep <= IDENTITY_STEP && targetStep > IDENTITY_STEP;-- if (movesForwardPastIdentity && validation.instanceIdError !== null) {- return {- kind: "blocked",- step: Math.min(IDENTITY_STEP, lastStep),- error: validation.instanceIdError,- };- }-- return { kind: "navigate", step: targetStep };+export function deriveInstanceId(+ driver: string,+ label: string,+ existing: ReadonlySet<string>,+ nameTaken?: (index: number) => boolean,+): string {+ const slug = slugifyLabel(driver, label);++ if (!slug) return `${driver}_${nextAccountNumber(driver, existing, nameTaken)}`;++ const base = `${driver}_${slug}`;++ return existing.has(base) ? `${base}_${nextAccountNumber(base, existing)}` : base;+}++/** Enter that submits, not one that confirms an IME candidate. */+export function isSubmitEnter(event: {+ readonly key: string;+ readonly keyCode: number;+ readonly isComposing: boolean;+}): boolean {+ return event.key === "Enter" && !event.isComposing && event.keyCode !== 229;}diff --git a/apps/web/src/components/settings/AddProviderInstanceDialog.test.ts b/apps/web/src/components/settings/AddProviderInstanceDialog.test.tsindex 594d2e453..0f16d1d5c 100644--- a/apps/web/src/components/settings/AddProviderInstanceDialog.test.ts+++ b/apps/web/src/components/settings/AddProviderInstanceDialog.test.ts@@ -1,44 +1,78 @@+import { ProviderInstanceId } from "@akeru/contracts";import { describe, expect, it } from "vite-plus/test";-import { resolveWizardNavigation } from "./AddProviderInstanceDialog.logic";+import {+ addAccountWizardSteps,+ deriveInstanceId,+ isSubmitEnter,+ nextAccountNumber,+} from "./AddProviderInstanceDialog.logic";-describe("resolveWizardNavigation", () => {- const invalidId = { instanceIdError: "Instance ID is required." };- const validId = { instanceIdError: null };+describe("addAccountWizardSteps", () => {+ it("asks Custom API which service before naming it", () => {+ expect(addAccountWizardSteps({ choosesService: true })).toEqual(["Service", "Name", "Connect"]);+ });++ it("only names a subscription account", () => {+ expect(addAccountWizardSteps({ choosesService: false })).toEqual(["Name"]);+ });+});- it("allows moving from Driver to Identity before the instance id is valid", () => {- expect(resolveWizardNavigation(0, 1, 3, invalidId)).toEqual({ kind: "navigate", step: 1 });+describe("deriveInstanceId", () => {+ it("builds the id from the name", () => {+ expect(deriveInstanceId("codex", "Work Laptop!", new Set())).toBe("codex_work_laptop");});- it("blocks Next from Identity to Config while the instance id is invalid", () => {- expect(resolveWizardNavigation(1, 2, 3, invalidId)).toEqual({- kind: "blocked",- step: 1,- error: "Instance ID is required.",- });+ it("numbers an unnamed account", () => {+ expect(deriveInstanceId("codex", " ", new Set(["codex"]))).toBe("codex_2");+ expect(deriveInstanceId("codex", "", new Set(["codex", "codex_2"]))).toBe("codex_3");});- it("stops a direct Driver-to-Config skip at Identity and surfaces its error", () => {- expect(resolveWizardNavigation(0, 2, 3, invalidId)).toEqual({- kind: "blocked",- step: 1,- error: "Instance ID is required.",- });+ it("numbers the fallback name like the id", () => {+ expect(nextAccountNumber("claudeAgent", new Set(["claudeAgent_2"]))).toBe(3);+ });++ it("skips a number whose name another account already shows", () => {+ // "ChatGPT 2" was typed by hand, so its id is codex_chatgpt_2, not codex_2.+ const nameTaken = (index: number) => index === 2;+ const existing = new Set(["codex", "codex_chatgpt_2"]);++ expect(nextAccountNumber("codex", existing, nameTaken)).toBe(3);+ expect(deriveInstanceId("codex", "", existing, nameTaken)).toBe("codex_3");});- it("allows advancing and skipping forward once the instance id is valid", () => {- expect(resolveWizardNavigation(1, 2, 3, validId)).toEqual({ kind: "navigate", step: 2 });- expect(resolveWizardNavigation(0, 2, 3, validId)).toEqual({ kind: "navigate", step: 2 });+ it("takes the first free suffix when the name is taken", () => {+ expect(+ deriveInstanceId(+ "customOpenai",+ "OpenRouter",+ new Set(["customOpenai_openrouter", "customOpenai_openrouter_2"]),+ ),+ ).toBe("customOpenai_openrouter_3");+ });++ it("keeps long names valid even after many collisions", () => {+ const label = "x".repeat(200);+ const first = deriveInstanceId("customOpenai", label, new Set());+ const taken = new Set([first, ...Array.from({ length: 98 }, (_, i) => `${first}_${i + 2}`)]);+ const id = deriveInstanceId("customOpenai", label, taken);++ expect(id).toBe(`${first}_100`);+ expect(ProviderInstanceId.make(id)).toBe(id);+ });+});++describe("isSubmitEnter", () => {+ it("submits on a plain Enter", () => {+ expect(isSubmitEnter({ key: "Enter", keyCode: 13, isComposing: false })).toBe(true);});- it("always preserves backward Driver and Identity navigation", () => {- expect(resolveWizardNavigation(2, 1, 3, invalidId)).toEqual({ kind: "navigate", step: 1 });- expect(resolveWizardNavigation(2, 0, 3, invalidId)).toEqual({ kind: "navigate", step: 0 });- expect(resolveWizardNavigation(1, 0, 3, invalidId)).toEqual({ kind: "navigate", step: 0 });+ it("ignores Enter that confirms an IME candidate", () => {+ expect(isSubmitEnter({ key: "Enter", keyCode: 13, isComposing: true })).toBe(false);+ expect(isSubmitEnter({ key: "Process", keyCode: 229, isComposing: false })).toBe(false);});- it("clamps requested steps to the wizard bounds", () => {- expect(resolveWizardNavigation(2, 8, 3, validId)).toEqual({ kind: "navigate", step: 2 });- expect(resolveWizardNavigation(0, -1, 3, invalidId)).toEqual({ kind: "navigate", step: 0 });+ it("ignores other keys", () => {+ expect(isSubmitEnter({ key: "a", keyCode: 65, isComposing: false })).toBe(false);});});diff --git a/apps/web/src/components/settings/AddProviderInstanceDialog.tsx b/apps/web/src/components/settings/AddProviderInstanceDialog.tsxindex 50125c4d1..daaf382f0 100644--- a/apps/web/src/components/settings/AddProviderInstanceDialog.tsx+++ b/apps/web/src/components/settings/AddProviderInstanceDialog.tsx@@ -2,9 +2,7 @@import type { ProviderConfig } from "./providerConfig";-import { Radio as RadioPrimitive } from "@base-ui/react/radio";-import { CheckIcon } from "lucide-react";-import { useMemo, useState } from "react";+import { type KeyboardEvent, useMemo, useState } from "react";import {ProviderInstanceId,ProviderDriverKind,@@ -14,9 +12,7 @@ import {import { useEnvironmentSettings, useUpdateEnvironmentSettings } from "../../hooks/useSettings";import { cn } from "../../lib/utils";-import { normalizeProviderAccentColor } from "../../providerInstances";import { Button } from "../ui/button";-import { ACPRegistryIcon, Gemini, GithubCopilotIcon, PiAgentIcon, type Icon } from "../Icons";import {Dialog,DialogDescription,@@ -25,17 +21,16 @@ import {DialogPopup,DialogTitle,} from "../ui/dialog";-import { Badge } from "../ui/badge";import { Input } from "../ui/input";-import { RadioGroup } from "../ui/radio-group";import { toastManager } from "../ui/toast";-import { DRIVER_OPTION_BY_VALUE, DRIVER_OPTIONS } from "./providerDriverMeta";-import { ProviderSettingsForm, deriveProviderSettingsFields } from "./ProviderSettingsForm";+import type { DriverOption } from "./providerDriverMeta";+import { ProviderSettingsForm, readProviderConfigString } from "./ProviderSettingsForm";import { AnimatedHeight } from "../AnimatedHeight";import {- ADD_PROVIDER_WIZARD_STEPS,- resolveWizardNavigation,- type WizardNavigation,+ addAccountWizardSteps,+ deriveInstanceId,+ isSubmitEnter,+ nextAccountNumber,} from "./AddProviderInstanceDialog.logic";import { AddProviderInstanceWizardSteps } from "./AddProviderInstanceWizardSteps";import { CustomApiKeyDraftField } from "./CustomApiKeyField";@@ -47,101 +42,16 @@ import {type CustomApiPreset,} from "./customApiPresets";-const PROVIDER_ACCENT_SWATCHES = [- "#2563eb",- "#16a34a",- "#ea580c",- "#dc2626",- "#7c3aed",- "#0891b2",-] as const;--/**- * Normalize a user-provided label into a slug suffix for the instance id.- * The full id is formed by prefixing the driver slug — e.g. label "Work" on- * driver "codex" becomes `codex_work`. Output is trimmed to 48 chars so the- * final composed id stays under the 64-char slug cap enforced by- * `ProviderInstanceId` in `@akeru/contracts`.- */-function slugifyLabel(value: string): string {- return value- .trim()- .toLowerCase()- .replace(/[^a-z0-9]+/g, "_")- .replace(/^_+|_+$/g, "")- .slice(0, 48);-}--function deriveInstanceId(driver: ProviderDriverKind, label: string): string {- const slug = slugifyLabel(label);-- return slug ? `${driver}_${slug}` : "";-}--const INSTANCE_ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*$/;--const DEFAULT_DRIVER_KIND = ProviderDriverKind.make("codex");-const CUSTOM_API_DRIVER_KIND = ProviderDriverKind.make("customOpenai");-const DEFAULT_DRIVER_OPTION = DRIVER_OPTIONS[0]!;--const EMPTY_CONFIG_DRAFT: ProviderConfig = {};--interface ComingSoonDriverOption {- readonly value: ProviderDriverKind;- readonly label: string;- readonly icon: Icon;-}--const COMING_SOON_DRIVER_OPTIONS: readonly ComingSoonDriverOption[] = [- {- value: ProviderDriverKind.make("githubCopilot"),- label: "Github Copilot",- icon: GithubCopilotIcon,- },- {- value: ProviderDriverKind.make("gemini"),- label: "Gemini",- icon: Gemini,- },- {- value: ProviderDriverKind.make("acpRegistry"),- label: "ACP Registry",- icon: ACPRegistryIcon,- },- {- value: ProviderDriverKind.make("piAgent"),- label: "Pi Agent",- icon: PiAgentIcon,- },-];--/**- * Validate an instance id against the same slug rules the server applies in- * `ProviderInstanceId` (see `packages/contracts/src/providerInstance.ts`).- * Returns a user-facing error string, or `null` if valid.- */-function validateInstanceId(id: string, existing: ReadonlySet<string>): string | null {- if (id.length === 0) return "Instance ID is required.";-- if (id.length > 64) return "Instance ID must be 64 characters or fewer.";-- if (!INSTANCE_ID_PATTERN.test(id)) {- return "Instance ID must start with a letter and use only letters, digits, '-', or '_'.";- }-- if (existing.has(id)) return `An instance named '${id}' already exists.`;-- return null;-}-interface AddProviderInstanceDialogProps {readonly open: boolean;readonly environmentId: EnvironmentId;readonly environmentLabel: string;- /** Driver preselected in the first step, such as the provider whose page opened the dialog. */- readonly initialDriver?: ProviderDriverKind;+ /** Name of the provider page that opened the dialog, such as ChatGPT. */+ readonly providerLabel?: string;+ /** Provider whose page opened the dialog. The new account uses its driver. */+ readonly driverOption: DriverOption;readonly onOpenChange: (open: boolean) => void;}@@ -149,7 +59,8 @@ export function AddProviderInstanceDialog({open,environmentId,environmentLabel,- initialDriver,+ providerLabel,+ driverOption,onOpenChange,}: AddProviderInstanceDialogProps) {const settings = useEnvironmentSettings(environmentId);@@ -157,57 +68,57 @@ export function AddProviderInstanceDialog({const [wizardStep, setWizardStep] = useState(0);- const [driver, setDriver] = useState<ProviderDriverKind>(- initialDriver && DRIVER_OPTION_BY_VALUE[initialDriver] ? initialDriver : DEFAULT_DRIVER_KIND,- );+ const driver = driverOption.value;++ const isCustomApi = driver === CUSTOM_API_DRIVER_KIND;const [label, setLabel] = useState("");// A preset names the instance until the user types a label of their own.const [labelEdited, setLabelEdited] = useState(false);const [customApiPreset, setCustomApiPreset] = useState<CustomApiPreset>(OTHER_CUSTOM_API_PRESET);const [customApiKey, setCustomApiKey] = useState("");- const [accentColor, setAccentColor] = useState<string>("");- const [instanceIdOverride, setInstanceIdOverride] = useState<string | null>(null);- // Driver-specific config drafts keyed by driver so toggling between drivers- // during the same dialog session does not lose in-progress input.- const [configByDriver, setConfigByDriver] = useState<Record<string, ProviderConfig>>({});- // Errors are suppressed until the user has tried to submit once. After that- // they update live so fixing the problem clears the message in place.- const [hasAttemptedSubmit, setHasAttemptedSubmit] = useState(false);+ const [configDraft, setConfigDraftState] = useState<ProviderConfig>({});const existingIds = useMemo(() => new Set(Object.keys(settings.providerInstances ?? {})),[settings.providerInstances],);- const driverOption = DRIVER_OPTION_BY_VALUE[driver] ?? DEFAULT_DRIVER_OPTION;- const instanceId = instanceIdOverride ?? deriveInstanceId(driver, label);+ const accountLabel = providerLabel ?? driverOption.label;- const driverSettingsFields = useMemo(- () => deriveProviderSettingsFields(driverOption),- [driverOption],+ const usedNames = useMemo(+ () =>+ new Set(+ Object.values(settings.providerInstances ?? {}).flatMap((instance) =>+ instance.displayName ? [instance.displayName.trim()] : [],+ ),+ ),+ [settings.providerInstances],);- const instanceIdError = validateInstanceId(instanceId, existingIds);- const showInstanceIdError = hasAttemptedSubmit && instanceIdError !== null;- const previewLabel = label.trim() || `${driverOption.label} Workspace`;- const wizardStepSummaries = [driverOption.label, previewLabel, null] as const;+ const nameTaken = (index: number) => usedNames.has(`${accountLabel} ${index}`);+ const instanceId = deriveInstanceId(driver, label, existingIds, nameTaken);+ // A blank name still gets one, so the new account never shares another's.+ const fallbackName = `${accountLabel} ${nextAccountNumber(driver, existingIds, nameTaken)}`;+ const accountName = label.trim() || fallbackName;- const configDraft = configByDriver[driver] ?? EMPTY_CONFIG_DRAFT;+ // The driver cannot reach a Custom API service without its address.+ const canSave =+ !isCustomApi || readProviderConfigString(configDraft, "baseUrl").trim().length > 0;- const setConfigDraft = (config: ProviderConfig | undefined) => {- setConfigByDriver((existing) => {- const next = { ...existing };+ const wizardSteps = addAccountWizardSteps({ choosesService: isCustomApi });- if (config === undefined || Object.keys(config).length === 0) {- delete next[driver];- } else {- next[driver] = config;- }+ const lastStep = wizardSteps.length - 1;+ const currentStepName = wizardSteps[wizardStep];+ const nameSummary = label.trim() || null;- return next;- });- };+ const wizardStepSummaries = wizardSteps.map((step) => {+ if (step === "Service") return customApiPreset.label;++ return step === "Name" ? nameSummary : null;+ });++ const setConfigDraft = (config: ProviderConfig | undefined) => setConfigDraftState(config ?? {});const chooseCustomApiPreset = (preset: CustomApiPreset) => {// A key belongs to one service; never send it to the next endpoint.@@ -217,56 +128,29 @@ export function AddProviderInstanceDialog({if (!labelEdited) setLabel(preset === OTHER_CUSTOM_API_PRESET ? "" : preset.label);- setConfigByDriver((existing) => {- const { baseUrl: _omit, ...rest } = existing[CUSTOM_API_DRIVER_KIND] ?? {};-- return {- ...existing,- [CUSTOM_API_DRIVER_KIND]: preset.baseUrl ? { ...rest, baseUrl: preset.baseUrl } : rest,- };- });- };-- const applyWizardNavigation = (navigation: WizardNavigation) => {- if (navigation.kind === "blocked") {- setHasAttemptedSubmit(true);- }-- setWizardStep(navigation.step);- };-- const navigateToStep = (requestedStep: number) => {- applyWizardNavigation(- resolveWizardNavigation(wizardStep, requestedStep, ADD_PROVIDER_WIZARD_STEPS.length, {- instanceIdError,- }),+ setConfigDraftState(({ baseUrl: _omit, ...rest }) =>+ preset.baseUrl ? { ...rest, baseUrl: preset.baseUrl } : rest,);};const handleSave = () => {- setHasAttemptedSubmit(true);-- if (instanceIdError !== null) return;+ if (!canSave) return;- const config = configByDriver[driver] ?? {};+ const config = configDraft;const hasConfig = Object.keys(config).length > 0;- const normalizedAccentColor = normalizeProviderAccentColor(accentColor);- const environment = driver === CUSTOM_API_DRIVER_KIND ? withCustomApiKey([], customApiKey) : [];+ const environment = isCustomApi ? withCustomApiKey([], customApiKey) : [];const nextInstance: ProviderInstanceConfig = {driver,enabled: true,- ...(label.trim().length > 0 ? { displayName: label.trim() } : {}),- ...(normalizedAccentColor ? { accentColor: normalizedAccentColor } : {}),+ displayName: accountName,...(hasConfig ? { config } : {}),...(environment.length > 0 ? { environment } : {}),};- // `ProviderInstanceId.make` revalidates the slug; we've already checked- // it via `validateInstanceId`, but going through the brand constructor- // keeps the type boundary honest and guards against any future drift in- // the slug rules.+ // The id is derived from the name and always fits the slug rules;+ // the brand constructor keeps the type boundary honest.const brandedId = ProviderInstanceId.make(instanceId);const nextMap = {@@ -278,35 +162,55 @@ export function AddProviderInstanceDialog({updateSettings({ providerInstances: nextMap });toastManager.add({type: "success",- title: "Provider instance added",- description: `${driverOption.label} instance '${instanceId}' was added.`,+ title: "Account added",+ description: `${accountName} was added. Sign in or connect it from its card.`,});onOpenChange(false);} catch (error) {toastManager.add({type: "error",- title: "Could not add provider instance",+ title: "Could not add account",description: error instanceof Error ? error.message : "Update failed.",});}};+ const advanceOnEnter = (event: KeyboardEvent<HTMLElement>) => {+ const isSubmit = isSubmitEnter({+ key: event.key,+ keyCode: event.keyCode,+ isComposing: event.nativeEvent.isComposing,+ });++ if (!isSubmit || !(event.target instanceof HTMLInputElement)) return;++ event.preventDefault();++ if (wizardStep < lastStep) setWizardStep(wizardStep + 1);+ else handleSave();+ };+return (<Dialog open={open} onOpenChange={onOpenChange}><DialogPopup className="max-w-xl overflow-hidden"><div className="flex min-h-0 flex-col overflow-hidden"><DialogHeader>- <DialogTitle>Add provider instance</DialogTitle>+ <DialogTitle>+ {isCustomApi ? "Connect a service" : `Add ${accountLabel} account`}+ </DialogTitle><DialogDescription>- Configure an additional provider instance on {environmentLabel}, such as a second- Codex install pointed at a different workspace.+ {isCustomApi+ ? `Add another OpenAI-compatible service on ${environmentLabel}. Each one keeps its own address and key.`+ : `Add another ${accountLabel} account on ${environmentLabel}. Each account keeps its own sign-in and settings.`}</DialogDescription>- <AddProviderInstanceWizardSteps- currentStep={wizardStep}- summaries={wizardStepSummaries}- instanceIdError={instanceIdError}- onNavigation={applyWizardNavigation}- />+ {wizardSteps.length > 1 ? (+ <AddProviderInstanceWizardSteps+ steps={wizardSteps}+ currentStep={wizardStep}+ summaries={wizardStepSummaries}+ onStepChange={setWizardStep}+ />+ ) : null}</DialogHeader><div@@ -314,173 +218,48 @@ export function AddProviderInstanceDialog({className="space-y-4 bg-inset-surface/80 px-6 py-5 ring-1 ring-tint/5 dark:bg-tint/2"><AnimatedHeight>- <div className={cn("grid gap-2", wizardStep !== 0 && "hidden")}>- <div id="add-instance-driver-label" className="text-sm font-medium text-foreground">- Driver- </div>- <RadioGroup- value={driver}- onValueChange={(value) => setDriver(ProviderDriverKind.make(value))}- aria-labelledby="add-instance-driver-label"- className="grid grid-cols-1 gap-2 sm:grid-cols-2"- >- {DRIVER_OPTIONS.map((option) => {- const IconComponent = option.icon;-- return (- <RadioPrimitive.Root- key={option.value}- value={option.value}- className="relative flex cursor-pointer items-center gap-3 rounded-lg bg-card px-3 py-3 text-left text-muted-foreground outline-none ring-1 ring-tint/5 dark:ring-tint/5 hover:bg-option-hover focus-visible:ring-2 focus-visible:ring-ring data-checked:bg-primary/8 data-checked:text-foreground data-checked:ring-2 data-checked:ring-primary data-checked:hover:bg-primary/8 dark:bg-tint/3 dark:hover:bg-tint/5 dark:data-checked:bg-primary/15 dark:data-checked:ring-primary dark:data-checked:hover:bg-primary/15"- >- <IconComponent className="size-4 shrink-0" aria-hidden />- <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">- {option.label}- </span>- <RadioPrimitive.Indicator- className="grid size-5 shrink-0 place-items-center rounded-full bg-primary text-primary-foreground"- aria-hidden- >- <CheckIcon className="size-3.5 shrink-0" />- </RadioPrimitive.Indicator>- {option.badgeLabel ? (- <Badge variant="warning" size="sm">- {option.badgeLabel}- </Badge>- ) : null}- </RadioPrimitive.Root>- );- })}- {COMING_SOON_DRIVER_OPTIONS.map((option) => {- const IconComponent = option.icon;-- return (- <RadioPrimitive.Root- key={option.value}- value={option.value}- disabled- className={cn(- "relative flex cursor-not-allowed items-center gap-3 rounded-lg bg-card/60 px-3 py-3 text-left opacity-55 outline-none ring-1 ring-tint/5 dark:bg-tint/2",- )}- >- <IconComponent- className="size-4 shrink-0 text-muted-foreground"- aria-hidden- />- <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">- {option.label}- </span>- <Badge variant="warning" size="sm">- Coming Soon- </Badge>- </RadioPrimitive.Root>- );- })}- </RadioGroup>- {driver === CUSTOM_API_DRIVER_KIND ? (- <div className="mt-3">+ <div className="grid gap-4">+ {isCustomApi ? (+ <div className={cn(currentStepName !== "Service" && "hidden")}><CustomApiPresetPickervalue={customApiPreset.id}onChange={chooseCustomApiPreset}/></div>) : null}- </div>- <label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>- <span className="text-xs font-medium text-foreground">Label</span>- <Input- surface="background"- placeholder="e.g. Work"- value={label}- onChange={(event) => {- setLabel(event.target.value);- setLabelEdited(true);- }}- />- <span className="text-11px text-muted-foreground">- Shown in the provider list. Optional.- </span>- </label>-- <label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>- <span className="text-xs font-medium text-foreground">Instance ID</span>- <Input- surface="background"- placeholder={`${driver}_work`}- value={instanceId}- onChange={(event) => {- setInstanceIdOverride(event.target.value);- }}- aria-invalid={showInstanceIdError}- />- {showInstanceIdError ? (- <span className="text-11px text-destructive">{instanceIdError}</span>- ) : (- <span className="text-11px text-muted-foreground">- Routing key used by threads and sessions. Letters, digits, '-', or '_'.+ <label className={cn("grid gap-2", currentStepName !== "Name" && "hidden")}>+ <span className="text-xs font-medium text-foreground">+ Name <span className="font-normal text-muted-foreground">(optional)</span></span>- )}- </label>-- <div className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>- <span className="text-xs font-medium text-foreground">Accent color</span>- <div className="flex min-w-0 flex-wrap items-center gap-2">- <input- type="color"- value={normalizeProviderAccentColor(accentColor) ?? PROVIDER_ACCENT_SWATCHES[0]}- onChange={(event) => setAccentColor(event.target.value)}- aria-label="Provider instance accent color"- className="h-8 w-10 cursor-pointer rounded-xl border border-input bg-background p-0.5"- />- <div className="flex flex-wrap gap-1.5">- {PROVIDER_ACCENT_SWATCHES.map((swatch) => {- const selected = accentColor.toLowerCase() === swatch;-- return (- <button- key={swatch}- type="button"- className={cn(- "size-6 cursor-pointer rounded-full border swatch-fill transition",- selected- ? "scale-110 border-foreground ring-2 ring-ring ring-offset-1 ring-offset-background"- : "border-tint/10 hover:scale-105 dark:border-tint/20",- )}- style={{ "--swatch": swatch }}- onClick={() => setAccentColor(swatch)}- aria-label={`Use ${swatch} accent`}- />- );- })}- </div>- {accentColor ? (- <Button- type="button"- size="sm"- variant="ghost"- presentation="wizard-preview-action"- onClick={() => setAccentColor("")}- >- Clear- </Button>- ) : null}- </div>- <span className="text-11px text-muted-foreground">- Optional marker shown in the picker.- </span>- </div>-- {driverSettingsFields.length > 0 ? (- <div className={cn("grid gap-4", wizardStep !== 2 && "hidden")}>- <ProviderSettingsForm- definition={driverOption}- value={configDraft}- idPrefix={`add-provider-${driver}`}- variant="dialog"- onChange={setConfigDraft}+ <Input+ surface="background"+ placeholder={fallbackName}+ value={label}+ autoFocus={!isCustomApi}+ onChange={(event) => {+ setLabel(event.target.value);+ setLabelEdited(true);+ }}+ onKeyDown={advanceOnEnter}/>- {driver === CUSTOM_API_DRIVER_KIND ? (+ <span className="text-11px text-muted-foreground">+ Leave it blank to call it {fallbackName}. Press Enter to continue.+ </span>+ </label>++ {isCustomApi ? (+ <div+ className={cn("grid gap-4", currentStepName !== "Connect" && "hidden")}+ onKeyDown={advanceOnEnter}+ >+ <ProviderSettingsForm+ definition={driverOption}+ value={configDraft}+ idPrefix={`add-provider-${driver}`}+ variant="dialog"+ onChange={setConfigDraft}+ /><CustomApiKeyDraftFieldid="add-provider-custom-api-key"value={customApiKey}@@ -488,15 +267,9 @@ export function AddProviderInstanceDialog({hint={customApiKeyHint(customApiPreset)}onChange={setCustomApiKey}/>- ) : null}- </div>- ) : wizardStep === 2 ? (- <div className="grid gap-2">- <p className="text-sm text-muted-foreground">- This driver has no required configuration. You can add the instance now.- </p>- </div>- ) : null}+ </div>+ ) : null}+ </div></AnimatedHeight></div>@@ -516,13 +289,13 @@ export function AddProviderInstanceDialog({>{wizardStep === 0 ? "Cancel" : "Back"}</Button>- {wizardStep < ADD_PROVIDER_WIZARD_STEPS.length - 1 ? (- <Button size="sm" onClick={() => navigateToStep(wizardStep + 1)}>+ {wizardStep < lastStep ? (+ <Button size="sm" onClick={() => setWizardStep(wizardStep + 1)}>Next</Button>) : (- <Button size="sm" onClick={handleSave}>- Add instance+ <Button size="sm" disabled={!canSave} onClick={handleSave}>+ {isCustomApi ? "Connect" : "Add account"}</Button>)}</DialogFooter>diff --git a/apps/web/src/components/settings/AddProviderInstanceWizardSteps.test.tsx b/apps/web/src/components/settings/AddProviderInstanceWizardSteps.test.tsxindex cec11163f..7a0f80863 100644--- a/apps/web/src/components/settings/AddProviderInstanceWizardSteps.test.tsx+++ b/apps/web/src/components/settings/AddProviderInstanceWizardSteps.test.tsx@@ -1,7 +1,7 @@import { Children, isValidElement, type ReactElement } from "react";import { describe, expect, it, vi } from "vite-plus/test";-import { ADD_PROVIDER_WIZARD_STEPS } from "./AddProviderInstanceDialog.logic";+import { addAccountWizardSteps } from "./AddProviderInstanceDialog.logic";import { AddProviderInstanceWizardSteps } from "./AddProviderInstanceWizardSteps";interface StepButtonProps {@@ -13,16 +13,17 @@ interface StepListItemProps {readonly children: ReactElement<StepButtonProps>;}+const CUSTOM_API_STEPS = addAccountWizardSteps({ choosesService: true });+function renderStepButtons(currentStep: number,- instanceIdError: string | null,- onNavigation: Parameters<typeof AddProviderInstanceWizardSteps>[0]["onNavigation"],+ onStepChange: (step: number) => void,): ReactElement<StepButtonProps>[] {const header = AddProviderInstanceWizardSteps({+ steps: CUSTOM_API_STEPS,currentStep,- summaries: ["Codex", "Codex Workspace", null],- instanceIdError,- onNavigation,+ summaries: ["OpenRouter", "OpenRouter", null],+ onStepChange,});return Children.toArray(header.props.children)@@ -31,35 +32,22 @@ function renderStepButtons(}describe("AddProviderInstanceWizardSteps", () => {- it("gates the actual Config header click through Identity validation", () => {- const onNavigation = vi.fn();- const buttons = renderStepButtons(0, "Instance ID is required.", onNavigation);+ it("moves to the clicked step in either direction", () => {+ const onStepChange = vi.fn();+ const buttons = renderStepButtons(1, onStepChange);- expect(buttons).toHaveLength(ADD_PROVIDER_WIZARD_STEPS.length);+ expect(buttons).toHaveLength(CUSTOM_API_STEPS.length);buttons[2]!.props.onClick();+ buttons[0]!.props.onClick();- expect(onNavigation).toHaveBeenCalledOnce();- expect(onNavigation).toHaveBeenCalledWith({- kind: "blocked",- step: 1,- error: "Instance ID is required.",- });+ expect(onStepChange.mock.calls).toEqual([[2], [0]]);});it("marks the wizard step separately from the clicked button focus", () => {- const buttons = renderStepButtons(1, "Instance ID is required.", vi.fn());+ const buttons = renderStepButtons(1, vi.fn());expect(buttons[0]!.props["aria-current"]).toBeUndefined();expect(buttons[1]!.props["aria-current"]).toBe("step");expect(buttons[2]!.props["aria-current"]).toBeUndefined();});-- it("preserves the actual backward header click", () => {- const onNavigation = vi.fn();- const buttons = renderStepButtons(2, "Instance ID is required.", onNavigation);-- buttons[0]!.props.onClick();-- expect(onNavigation).toHaveBeenCalledWith({ kind: "navigate", step: 0 });- });});diff --git a/apps/web/src/components/settings/AddProviderInstanceWizardSteps.tsx b/apps/web/src/components/settings/AddProviderInstanceWizardSteps.tsxindex 99f97cb5b..bbe69b0e6 100644--- a/apps/web/src/components/settings/AddProviderInstanceWizardSteps.tsx+++ b/apps/web/src/components/settings/AddProviderInstanceWizardSteps.tsx@@ -2,31 +2,27 @@ import { Button } from "../ui/button";import { CheckIcon } from "lucide-react";import { cn } from "../../lib/utils";-import {- ADD_PROVIDER_WIZARD_STEPS,- resolveWizardNavigation,- type WizardNavigation,-} from "./AddProviderInstanceDialog.logic";+import type { AddAccountWizardStep } from "./AddProviderInstanceDialog.logic";interface AddProviderInstanceWizardStepsProps {+ readonly steps: readonly AddAccountWizardStep[];readonly currentStep: number;readonly summaries: readonly (string | null)[];- readonly instanceIdError: string | null;- readonly onNavigation: (navigation: WizardNavigation) => void;+ readonly onStepChange: (step: number) => void;}export function AddProviderInstanceWizardSteps({+ steps,currentStep,summaries,- instanceIdError,- onNavigation,+ onStepChange,}: AddProviderInstanceWizardStepsProps) {return (<olclassName="grid grid-cols-3 gap-1 rounded-xl bg-inset-surface p-1 ring-1 ring-tint/5"role="list">- {ADD_PROVIDER_WIZARD_STEPS.map((step, index) => (+ {steps.map((step, index) => (<li key={step} className="min-w-0"><Buttontype="button"@@ -34,13 +30,7 @@ export function AddProviderInstanceWizardSteps({presentation={index === currentStep ? "wizard-step-current" : "wizard-step"}aria-current={index === currentStep ? "step" : undefined}aria-label={`${step}, step ${index + 1}${index < currentStep && summaries[index] ? `, ${summaries[index]}` : ""}`}- onClick={() =>- onNavigation(- resolveWizardNavigation(currentStep, index, ADD_PROVIDER_WIZARD_STEPS.length, {- instanceIdError,- }),- )- }+ onClick={() => onStepChange(index)}><spanclassName={cn(diff --git a/apps/web/src/components/settings/ProviderInstanceCard.tsx b/apps/web/src/components/settings/ProviderInstanceCard.tsxindex e05bd4cf7..40eed0d13 100644--- a/apps/web/src/components/settings/ProviderInstanceCard.tsx+++ b/apps/web/src/components/settings/ProviderInstanceCard.tsx@@ -348,13 +348,13 @@ export function ProviderInstanceCard({variant="ghost"presentation="provider-remove"onClick={onDelete}- aria-label={`Delete provider instance ${instanceId}`}+ aria-label={`Delete account ${instanceId}`}><Trash2Icon className="size-3" /></Button>}/>- <TooltipPopup side="top">Delete instance</TooltipPopup>+ <TooltipPopup side="top">Delete account</TooltipPopup></Tooltip></span>) : null}@@ -517,7 +517,7 @@ export function ProviderInstanceCard({className="mt-1.5"value={instance.displayName ?? ""}onCommit={updateDisplayName}- placeholder={driverOption?.label ?? "Instance label"}+ placeholder={driverOption?.label ?? "Account name"}spellCheck={false}/><span className="mt-1 block text-xs text-muted-foreground">@@ -532,7 +532,7 @@ export function ProviderInstanceCard({value={accentColor}onCommit={updateAccentColor}commitDelayMs={120}- description="Used to distinguish this instance in picker rails and model lists."+ description="Tells this account apart in the model picker."/></div>diff --git a/apps/web/src/components/settings/ProviderInstancesSection.tsx b/apps/web/src/components/settings/ProviderInstancesSection.tsxindex 39b836cb8..c64b19594 100644--- a/apps/web/src/components/settings/ProviderInstancesSection.tsx+++ b/apps/web/src/components/settings/ProviderInstancesSection.tsx@@ -164,6 +164,8 @@ export function ProviderInstancesSection({const updatingDriversRef = useRef<Set<ProviderDriverKind>>(new Set());const rows = instanceRowsForDrivers(settings, drivers);+ // New accounts use the page's primary driver; pages without a known driver cannot add one.+ const addDriverOption = getDriverOption(drivers[0]);const updateCandidateByInstanceId = useMemo(() =>@@ -325,7 +327,7 @@ export function ProviderInstancesSection({<><SettingsSectionid="provider-instances"- title={rows.length > 1 ? t("Instances") : t("Configuration")}+ title={rows.length > 1 ? t("Accounts") : t("Configuration")}headerAction={<div className="flex items-center gap-1"><Button@@ -342,10 +344,12 @@ export function ProviderInstancesSection({)}{t("Refresh")}</Button>- <Button size="xs" variant="ghost-muted" onClick={() => setIsAddDialogOpen(true)}>- <PlusIcon className="size-3.5" />- {t("Add instance")}- </Button>+ {addDriverOption ? (+ <Button size="xs" variant="ghost-muted" onClick={() => setIsAddDialogOpen(true)}>+ <PlusIcon className="size-3.5" />+ {t("Add account")}+ </Button>+ ) : null}</div>}>@@ -452,12 +456,13 @@ export function ProviderInstancesSection({)}</SettingsSection>- {isAddDialogOpen ? (+ {isAddDialogOpen && addDriverOption ? (<AddProviderInstanceDialogopenenvironmentId={environmentId}environmentLabel={environment?.label ?? t("this environment")}- {...(drivers[0] ? { initialDriver: drivers[0] } : {})}+ providerLabel={providerLabel}+ driverOption={addDriverOption}onOpenChange={setIsAddDialogOpen}/>) : null}diff --git a/apps/web/src/components/settings/SettingsPanels.zh-CN.test.tsx b/apps/web/src/components/settings/SettingsPanels.zh-CN.test.tsxindex 79126e1fd..3ce7d364e 100644--- a/apps/web/src/components/settings/SettingsPanels.zh-CN.test.tsx+++ b/apps/web/src/components/settings/SettingsPanels.zh-CN.test.tsx@@ -157,8 +157,8 @@ describe("settings panels in Simplified Chinese", () => {environment.id = ENVIRONMENT_ID;expectTranslated(renderInChinese(<ProviderDetailPage entry={PROVIDER_CATALOG[0]!} />),- [">配置<", "添加实例", "刷新 ChatGPT 状态", ">刷新<"],- [">Configuration<", "Add instance", ">Refresh<", "Refresh ChatGPT status"],+ [">配置<", "添加账户", "刷新 ChatGPT 状态", ">刷新<"],+ [">Configuration<", "Add account", ">Refresh<", "Refresh ChatGPT status"],);});@@ -177,7 +177,7 @@ describe("settings panels in Simplified Chinese", () => {"This environment has no {provider} runtime. Update the environment server to configure it here."]!.replace("{provider}", "Example"),],- [">Configuration<", "This environment has no", "Add instance"],+ [">Configuration<", "This environment has no", "Add account"],);});});diff --git a/docs/internals/providers.md b/docs/internals/providers.mdindex 302dac673..c40d76938 100644--- a/docs/internals/providers.md+++ b/docs/internals/providers.md@@ -28,6 +28,12 @@ transport, config, and event shapes are mapped.## Registry and routing+Settings calls a provider instance an account. **Add account** on a provider's page creates another+instance of that page's driver; it never asks for a driver. Subscription accounts only take a name and+sign in from their card afterwards. The dialog does not show the inherited CLI fields (binary path,+home paths, launch arguments), because Mastra-routed drivers do not start the CLI to run turns.+Custom API asks for a service, a name, then its address and key.+Two registries separate configuration from live processes:- [`ProviderInstanceRegistry`][instances] keys configured instances by `ProviderInstanceId`. Creatingdiff --git a/docs/user/providers.md b/docs/user/providers.mdindex e261d0070..f37f2d929 100644--- a/docs/user/providers.md+++ b/docs/user/providers.md@@ -12,8 +12,10 @@ Model lists update on their own. The environment server checks models.dev for neabout once an hour, and open clients pick them up within a few minutes, with no reload or appupdate. Older models move to the picker's legacy section when a newer one in the same line ships.-An instance configured with its own credentials uses those credentials rather than the shared-connection. A custom configuration directory alone does not connect an account to Akeru's runtime.+Use **Add account** on a provider's page to connect a second account of the same provider, such as a+work and a personal subscription. Give it a name, then sign in from its card. An account configured with its own credentials uses those+credentials rather than the shared connection. A custom configuration directory alone does not+connect an account to Akeru's runtime.## Custom API endpoints@@ -21,15 +23,15 @@ connection. A custom configuration directory alone does not connect an account thosted service, a gateway, or a server you run yourself. There is no account to connect and nosign-in flow.-When you add a Custom API instance, pick what you are connecting to. OpenRouter, Groq, Together AI,+Use **Add account** on the Custom API page and pick what you are connecting to. OpenRouter, Groq, Together AI,DeepSeek, Mistral, Fireworks, LM Studio, Ollama, and vLLM fill in their base URL and a name for you.Choose **Other** to type the URL of anything else. Local servers such as LM Studio and Ollama resolveon the machine running the environment, not on the device you are using.Paste the service's key into **API key**. Hosted services need one; local servers usually do not, anda base URL alone is enough for them. The key is stored outside the settings file, never sent back to-a client, and sent to the configured endpoint as a bearer token. On a saved instance the field shows-that a key is stored. Type a new key to replace it, or use **Remove key**. A key belongs to its+a client, and sent to the configured endpoint as a bearer token. Once saved, the field shows that a+key is stored. Type a new key to replace it, or use **Remove key**. A key belongs to itsservice: changing the base URL to a different host, or from HTTPS to HTTP, removes the stored key,so paste the new service's key afterwards. If the endpoint refuses to list models with that key, theinstance shows **Needs attention** with the reason until a later check succeeds. You can still chat@@ -39,8 +41,8 @@ The model list comes from the endpoint's `/models` response. Models you add by hit, and a model disappears from the picker once the endpoint stops listing it. If Akeru cannot read theendpoint, the last successful list stays and the provider row explains what went wrong.-Use **Add instance** on the Custom API page to keep several endpoints side by side, such as a local-server and a hosted gateway.+Add one account per endpoint to keep several side by side, such as a local server and a hosted+gateway.The environment sends requests to the URL you configure. Point it only at an endpoint you trust, andprefer HTTPS for anything outside your machine.diff --git a/packages/client-runtime/src/i18n/catalogs/en/common-labels.ts b/packages/client-runtime/src/i18n/catalogs/en/common-labels.tsindex bf2d28eb0..413daf735 100644--- a/packages/client-runtime/src/i18n/catalogs/en/common-labels.ts+++ b/packages/client-runtime/src/i18n/catalogs/en/common-labels.ts@@ -497,9 +497,9 @@ export const commonLabelsCatalog = {"Auto-idle": "Auto-idle","Leave blank to keep the saved value": "Leave blank to keep the saved value",Account: "Account",- Instances: "Instances",+ Accounts: "Accounts",Refresh: "Refresh",- "Add instance": "Add instance",+ "Add account": "Add account","Version pill": "Version pill","Follow system": "Follow system",Checking: "Checking",diff --git a/packages/client-runtime/src/i18n/catalogs/zh-CN/common-labels.ts b/packages/client-runtime/src/i18n/catalogs/zh-CN/common-labels.tsindex 33058bada..6294a17ef 100644--- a/packages/client-runtime/src/i18n/catalogs/zh-CN/common-labels.ts+++ b/packages/client-runtime/src/i18n/catalogs/zh-CN/common-labels.ts@@ -497,9 +497,9 @@ export const commonLabelsCatalog = {"Auto-idle": "自动空闲","Leave blank to keep the saved value": "留空以保留已保存的值",Account: "账户",- Instances: "实例",+ Accounts: "账户",Refresh: "刷新",- "Add instance": "添加实例",+ "Add account": "添加账户","Version pill": "版本标签","Follow system": "跟随系统",Checking: "正在检查",