TypeScript
fix(web): clean up provider settings list and editor (#8504)
Wout Stiens5e63aea2df03
diff --git a/apps/web/src/components/settings/ProviderInstanceCard.test.ts b/apps/web/src/components/settings/ProviderInstanceCard.test.tsindex 83ddc4c5a88..ed62ff055b0 100644--- a/apps/web/src/components/settings/ProviderInstanceCard.test.ts+++ b/apps/web/src/components/settings/ProviderInstanceCard.test.ts@@ -41,7 +41,7 @@ describe("deriveProviderModelsForDisplay", () => {).toEqual(["server-model", "kept-custom"]);});- it("shows a redacted provider email in Configuration", () => {+ it("shows a redacted provider email in the editor header status line", () => {const instanceId = ProviderInstanceId.make("codex");const driver = ProviderDriverKind.make("codex");const liveProvider: ServerProvider = {@@ -75,9 +75,48 @@ describe("deriveProviderModelsForDisplay", () => {}),);- expect(markup).toContain("Account email");+ expect(markup).toContain("Authenticated as");expect(markup).toContain('aria-label="Toggle account email visibility"');expect(markup).toContain("blur-[2px]");expect(markup).not.toContain("[email protected]");});+ it("surfaces a failed probe message in both the list row and the editor", () => {+ const instanceId = ProviderInstanceId.make("codex_work");+ const driver = ProviderDriverKind.make("codex");+ const message =+ "Codex app-server provider probe failed: Cannot create Codex shadow home entry 'auth.json' because '/home/me/.codex-t3/work/auth.json' already exists and is not a symlink.";+ const liveProvider: ServerProvider = {+ instanceId,+ driver,+ enabled: true,+ installed: true,+ version: null,+ status: "error",+ auth: { status: "unknown" },+ checkedAt: "2026-08-28T12:00:00.000Z",+ models: [],+ slashCommands: [],+ skills: [],+ message,+ };+ const props = {+ instanceId,+ instance: { driver },+ driverOption: undefined,+ liveProvider,+ onUpdate: () => undefined,+ hiddenModels: [],+ favoriteModels: [],+ modelOrder: [],+ onHiddenModelsChange: () => undefined,+ onFavoriteModelsChange: () => undefined,+ onModelOrderChange: () => undefined,+ } as const;++ for (const mode of ["list", "editor"] as const) {+ const markup = renderToStaticMarkup(createElement(ProviderInstanceCard, { ...props, mode }));+ expect(markup).toContain("Unavailable");+ expect(markup).toContain("is not a symlink");+ }+ });});diff --git a/apps/web/src/components/settings/ProviderInstanceCard.tsx b/apps/web/src/components/settings/ProviderInstanceCard.tsxindex 4e2d2b7f43a..a82cc2f4adf 100644--- a/apps/web/src/components/settings/ProviderInstanceCard.tsx+++ b/apps/web/src/components/settings/ProviderInstanceCard.tsx@@ -426,18 +426,26 @@ export function ProviderInstanceCard({onRunUpdate,isUpdating = false,}: ProviderInstanceCardProps) {- const [activeTab, setActiveTab] = useState<"models" | "configuration">("configuration");+ const [activeTab, setActiveTab] = useState<"configuration" | "models">("configuration");const enabled = resolveProviderInstanceEnabled(instance);- // A locally disabled provider stays neutral even if its last server status- // is stale. Enabled providers use the server status when one is available.+ // A locally disabled provider reads "Disabled" with a muted dot even if its+ // last server status is stale. Enabled providers use the server status.const statusKey: ProviderStatusKey = enabled? ((liveProvider?.status as ProviderStatusKey | undefined) ?? "warning"): "disabled";const statusStyle = PROVIDER_STATUS_STYLES[statusKey];- const rawSummary = getProviderSummary(liveProvider);- const summary = enabled ? rawSummary : { headline: "Disabled", detail: null };- const authEmail = liveProvider?.auth.email;- const showEditorStatus = enabled && (statusKey === "warning" || statusKey === "error");+ const summary = enabled+ ? getProviderSummary(liveProvider)+ : { headline: "Disabled", detail: null };+ const authEmail = liveProvider?.auth.email?.trim();+ // The editor header folds the account email into the status line —+ // "Authenticated as <email> · <plan>" — with the email redacted until its+ // reveal toggle is clicked.+ const isAuthenticated = enabled && liveProvider?.auth.status === "authenticated";+ const authLabel =+ enabled && liveProvider?.auth.status === "authenticated"+ ? (liveProvider.auth.label ?? liveProvider.auth.type ?? null)+ : null;const versionLabel = getProviderVersionLabel(liveProvider?.version);const versionAdvisory = getProviderVersionAdvisoryPresentation(liveProvider?.versionAdvisory);const updateCommand = versionAdvisory?.updateCommand ?? null;@@ -607,19 +615,34 @@ export function ProviderInstanceCard({<code className="text-xs text-muted-foreground">{versionLabel}</code>) : null;+ // Healthy and disabled rows read fine from their text; only trouble gets a dot.+ const statusDotNode =+ statusKey === "warning" || statusKey === "error" ? (+ <span className={cn("size-1.5 shrink-0 rounded-full", statusStyle.dot)} aria-hidden />+ ) : null;+ const statusHeadlineNode = <span>{summary.headline}</span>;+ // Trouble states carry the server's explanation (a failed probe, a shadow+ // home entry that is not a symlink, a missing binary). Show it wherever the+ // headline shows so the user can act without opening the editor.+ const needsAttention = statusKey === "warning" || statusKey === "error";+ const statusLineClassName =+ "flex min-w-0 flex-wrap items-center gap-x-1.5 text-[13px] leading-[1.45] text-muted-foreground/80";+if (mode === "list") {return (<divclassName={cn(- "group relative flex min-h-16 items-center gap-3 border-b border-border/60 px-3 py-2.5 transition-colors last:border-b-0",- selected ? "bg-muted/50" : "hover:bg-muted/25",+ // Sidebar-style selection with a fixed row height so the list stays+ // even; the status line clamps to two lines instead of growing.+ "group flex h-19 items-start gap-3 rounded-md px-3 py-2 transition-colors",+ // Foreground-alpha tint so the fill reads the same in light and dark themes.+ selected ? "bg-foreground/8" : "hover:bg-foreground/4",)}>- {selected ? <span className="absolute inset-y-0 left-0 w-0.5 bg-primary" /> : null}<buttontype="button"className={cn(- "flex min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-sm text-left outline-none transition-opacity focus-visible:ring-2 focus-visible:ring-ring",+ "flex min-w-0 flex-1 cursor-pointer items-start gap-3 rounded-sm text-left outline-none transition-opacity focus-visible:ring-2 focus-visible:ring-ring",!enabled && !selected && "opacity-60 group-hover:opacity-100",)}onClick={onSelect}@@ -629,150 +652,185 @@ export function ProviderInstanceCard({<span className="min-w-0 flex-1"><span className="flex min-w-0 items-center gap-2"><span className="truncate text-sm font-medium text-foreground">{displayName}</span>+ {String(instanceId) !== String(instance.driver) ? (+ <code className="min-w-0 truncate rounded bg-muted/60 px-1 py-0.5 text-[10px] text-muted-foreground">+ {instanceId}+ </code>+ ) : null}{versionCodeNode}+ {versionAdvisory ? (+ <span role="img" aria-label="Update available" className="inline-flex shrink-0">+ <ArrowUpCircleIcon className="size-3.5 text-update-foreground" />+ </span>+ ) : null}</span>- <span className="mt-0.5 flex items-center gap-1.5 text-[11px] text-muted-foreground">- <span className={cn("size-1.5 shrink-0 rounded-full", statusStyle.dot)} />- <span className="truncate">{summary.headline}</span>+ <span className="mt-0.5 flex items-start gap-1.5 text-[13px] leading-[1.45] text-muted-foreground/80">+ {statusDotNode ? (+ <span className="flex h-[1.45em] shrink-0 items-center">{statusDotNode}</span>+ ) : null}+ <span className="line-clamp-2 [overflow-wrap:anywhere]">+ {summary.headline}+ {needsAttention && summary.detail ? ` · ${summary.detail}` : null}+ </span></span>- {String(instanceId) !== String(instance.driver) ? (- <code className="mt-0.5 block truncate text-[10px] text-muted-foreground/70">- {instanceId}- </code>- ) : null}</span></button>- <Switch- checked={enabled}- disabled={readOnly}- onCheckedChange={(checked) => updateEnabled(Boolean(checked))}- aria-label={`Enable ${displayName}`}- />+ <span className="flex h-5 shrink-0 items-center">+ <Switch+ checked={enabled}+ disabled={readOnly}+ onCheckedChange={(checked) => updateEnabled(Boolean(checked))}+ aria-label={`Enable ${displayName}`}+ />+ </span></div>);}return (<div className="min-w-0 lg:flex lg:h-full lg:min-h-0 lg:flex-col">- <div- inert={readOnly}- aria-disabled={readOnly || undefined}- className={cn(- "flex min-h-16 shrink-0 items-center justify-between gap-3 border-b border-border/70 px-4 py-3",- readOnly && "opacity-50 select-none",- )}- >+ <div className="flex min-h-16 shrink-0 items-start justify-between gap-3 border-b border-border/70 px-4 py-3"><div className="min-w-0 flex-1 space-y-1"><div className="flex min-w-0 flex-wrap items-center gap-2">{titleHeadNode}{versionCodeNode}- {versionAdvisory ? (- <Popover>- <PopoverTrigger- render={- <Button- type="button"- size="icon-xs"- variant="ghost"- className={cn(- "size-5 rounded-sm p-0",- versionAdvisory.emphasis === "strong"- ? "text-warning hover:text-warning"- : "text-update-foreground hover:text-update-foreground",- )}- aria-label="Update available — view details"- >- <ArrowUpCircleIcon className="size-3.5" />- </Button>- }- />- <PopoverPopup- side="bottom"- align="start"- className="w-[min(21rem,calc(100vw-1.5rem))] [--popup-width:min(21rem,calc(100vw-1.5rem))]"- >- <div className="grid min-w-0 gap-3">- <div className="grid gap-0.5">- <p className="text-[13px] font-semibold leading-tight text-foreground">- Update available- </p>- <p+ {/*+ Only the write actions go inert on read-only sessions; the+ status line below keeps its email reveal clickable.+ */}+ <span+ inert={readOnly}+ aria-disabled={readOnly || undefined}+ className={cn("inline-flex items-center gap-2", readOnly && "opacity-50")}+ >+ {versionAdvisory ? (+ <Popover>+ <PopoverTrigger+ render={+ <Button+ type="button"+ size="icon-xs"+ variant="ghost"className={cn(- "text-xs leading-snug",+ "size-5 rounded-sm p-0",versionAdvisory.emphasis === "strong"- ? "text-warning"- : "text-muted-foreground",+ ? "text-warning hover:text-warning"+ : "text-update-foreground hover:text-update-foreground",)}+ aria-label="Update available — view details">- {versionAdvisory.detail}- </p>- </div>- {onRunUpdate ? (- <Button- type="button"- size="xs"- variant="default"- className="w-full"- disabled={isUpdating}- onClick={onRunUpdate}- >- {isUpdating ? <LoaderIcon className="animate-spin" /> : <DownloadIcon />}- {isUpdating ? "Updating" : "Update now"}+ <ArrowUpCircleIcon className="size-3.5" /></Button>- ) : null}- {onRunUpdate && updateCommand ? (- <div className="flex items-center gap-2 text-[10px] font-medium uppercase tracking-wider text-muted-foreground">- <span aria-hidden className="h-px flex-1 bg-border" />- or, update manually using- <span aria-hidden className="h-px flex-1 bg-border" />- </div>- ) : null}- {updateCommand ? (- <div className="flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-muted/40 py-0.5 pr-0.5 pl-2">- <ScrollArea scrollFade className="h-8 min-w-0 flex-1 rounded-none">- <code className="flex h-full w-max items-center whitespace-nowrap pr-3 font-mono text-[11px] text-foreground">- {updateCommand}- </code>- </ScrollArea>- <Tooltip>- <TooltipTrigger- render={- <Button- type="button"- size="icon-xs"- variant="ghost"- className="size-6 shrink-0 rounded-sm p-0 text-muted-foreground hover:text-foreground"- onClick={() =>- copyToClipboard(updateCommand, {- providerName: displayName,- })- }- aria-label="Copy update command"- >- <CopyIcon className="size-3" />- </Button>- }- />- <TooltipPopup side="top">Copy command</TooltipPopup>- </Tooltip>+ }+ />+ <PopoverPopup+ side="bottom"+ align="start"+ className="w-[min(21rem,calc(100vw-1.5rem))] [--popup-width:min(21rem,calc(100vw-1.5rem))]"+ >+ <div className="grid min-w-0 gap-3">+ <div className="grid gap-0.5">+ <p className="text-[13px] font-semibold leading-tight text-foreground">+ Update available+ </p>+ <p+ className={cn(+ "text-xs leading-snug",+ versionAdvisory.emphasis === "strong"+ ? "text-warning"+ : "text-muted-foreground",+ )}+ >+ {versionAdvisory.detail}+ </p></div>- ) : null}- </div>- </PopoverPopup>- </Popover>- ) : null}- {titleTailNode}+ {onRunUpdate ? (+ <Button+ type="button"+ size="xs"+ variant="default"+ className="w-full"+ disabled={isUpdating}+ onClick={onRunUpdate}+ >+ {isUpdating ? <LoaderIcon className="animate-spin" /> : <DownloadIcon />}+ {isUpdating ? "Updating" : "Update now"}+ </Button>+ ) : null}+ {onRunUpdate && updateCommand ? (+ <div className="flex items-center gap-2 text-[10px] font-medium uppercase tracking-wider text-muted-foreground">+ <span aria-hidden className="h-px flex-1 bg-border" />+ or, update manually using+ <span aria-hidden className="h-px flex-1 bg-border" />+ </div>+ ) : null}+ {updateCommand ? (+ <div className="flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-muted/40 py-0.5 pr-0.5 pl-2">+ <ScrollArea scrollFade className="h-8 min-w-0 flex-1 rounded-none">+ <code className="flex h-full w-max items-center whitespace-nowrap pr-3 font-mono text-[11px] text-foreground">+ {updateCommand}+ </code>+ </ScrollArea>+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ type="button"+ size="icon-xs"+ variant="ghost"+ className="size-6 shrink-0 rounded-sm p-0 text-muted-foreground hover:text-foreground"+ onClick={() =>+ copyToClipboard(updateCommand, {+ providerName: displayName,+ })+ }+ aria-label="Copy update command"+ >+ <CopyIcon className="size-3" />+ </Button>+ }+ />+ <TooltipPopup side="top">Copy command</TooltipPopup>+ </Tooltip>+ </div>+ ) : null}+ </div>+ </PopoverPopup>+ </Popover>+ ) : null}+ {titleTailNode}+ </span></div>- {showEditorStatus ? (- <p className="flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground">- <span>{summary.headline}</span>- {summary.detail ? <span>· {summary.detail}</span> : null}+ <p className={statusLineClassName}>+ {statusDotNode}+ {isAuthenticated && authEmail ? (+ <>+ <span>Authenticated as</span>+ <ProviderAuthEmail email={authEmail} />+ {authLabel ? <span>· {authLabel}</span> : null}+ </>+ ) : (+ statusHeadlineNode+ )}+ {summary.detail && !needsAttention ? <span>· {summary.detail}</span> : null}+ </p>+ {summary.detail && needsAttention ? (+ <p className="text-[13px] leading-[1.45] text-muted-foreground/80 [overflow-wrap:anywhere]">+ {summary.detail}</p>) : null}</div></div><div className="flex h-11 shrink-0 border-b border-border/70 px-1">+ <button+ type="button"+ aria-pressed={visibleTab === "configuration"}+ className={providerSettingsTabClassName(visibleTab === "configuration")}+ onClick={() => setActiveTab("configuration")}+ >+ Configuration+ </button>{driverOption !== undefined ? (<buttontype="button"@@ -783,91 +841,83 @@ export function ProviderInstanceCard({Models</button>) : null}- <button- type="button"- aria-pressed={visibleTab === "configuration"}- className={providerSettingsTabClassName(visibleTab === "configuration")}- onClick={() => setActiveTab("configuration")}- >- Configuration- </button></div>- <div- inert={readOnly}- aria-disabled={readOnly || undefined}- className={cn("lg:min-h-0 lg:flex-1", readOnly && "opacity-50 select-none")}- >- <div- className="space-y-5 px-4 py-5 lg:h-full lg:overflow-y-auto"+ <div className="lg:min-h-0 lg:flex-1">+ <ScrollArea+ scrollFade+ chainVerticalScroll+ className="lg:h-full"hidden={visibleTab !== "configuration"}>- {authEmail?.trim() ? (- <div className="min-w-0">- <div className="text-xs font-medium text-foreground">Account email</div>- <div className="mt-1.5 flex min-h-8 min-w-0 items-center">- <ProviderAuthEmail email={authEmail} />- </div>+ <div+ inert={readOnly}+ aria-disabled={readOnly || undefined}+ className={cn("space-y-5 px-4 py-5", readOnly && "opacity-50 select-none")}+ >+ <div>+ <label htmlFor={`provider-instance-${instanceId}-display-name`} className="block">+ <span className="text-xs font-medium text-foreground">Display name</span>+ <DraftInput+ id={`provider-instance-${instanceId}-display-name`}+ className="mt-1.5"+ value={instance.displayName ?? ""}+ onCommit={updateDisplayName}+ placeholder={driverOption?.label ?? "Instance label"}+ spellCheck={false}+ />+ <span className="mt-1 block text-xs text-muted-foreground">+ Optional label shown in the provider list.+ </span>+ </label></div>- ) : null}- <div>- <label htmlFor={`provider-instance-${instanceId}-display-name`} className="block">- <span className="text-xs font-medium text-foreground">Display name</span>- <DraftInput- id={`provider-instance-${instanceId}-display-name`}- className="mt-1.5"- value={instance.displayName ?? ""}- onCommit={updateDisplayName}- placeholder={driverOption?.label ?? "Instance label"}- spellCheck={false}+ <div>+ <ProviderAccentColorPicker+ displayName={displayName}+ value={accentColor}+ onCommit={updateAccentColor}+ commitDelayMs={120}+ description="Used to distinguish this instance in picker rails and model lists."/>- <span className="mt-1 block text-xs text-muted-foreground">- Optional label shown in the provider list.- </span>- </label>- </div>-- <div>- <ProviderAccentColorPicker- displayName={displayName}- value={accentColor}- onCommit={updateAccentColor}- commitDelayMs={120}- description="Used to distinguish this instance in picker rails and model lists."- />- </div>-- <div>- <ProviderEnvironmentSection- environment={instance.environment ?? []}- onChange={updateEnvironment}- />- </div>-- {driverOption ? (- <ProviderSettingsForm- definition={driverOption}- value={instance.config}- idPrefix={`provider-instance-${instanceId}`}- variant="card"- onChange={updateConfig}- />- ) : null}+ </div>- {driverOption === undefined ? (<div>- <p className="text-xs text-muted-foreground">- This instance uses a driver (- <code className="text-foreground">{String(instance.driver)}</code>) that is not- shipped with the current build. Configuration values are preserved but cannot be- edited from this surface.- </p>+ <ProviderEnvironmentSection+ environment={instance.environment ?? []}+ onChange={updateEnvironment}+ /></div>- ) : null}- </div>++ {driverOption ? (+ <ProviderSettingsForm+ definition={driverOption}+ value={instance.config}+ idPrefix={`provider-instance-${instanceId}`}+ variant="card"+ onChange={updateConfig}+ />+ ) : null}++ {driverOption === undefined ? (+ <div>+ <p className="text-xs text-muted-foreground">+ This instance uses a driver (+ <code className="text-foreground">{String(instance.driver)}</code>) that is not+ shipped with the current build. Configuration values are preserved but cannot be+ edited from this surface.+ </p>+ </div>+ ) : null}+ </div>+ </ScrollArea>{driverOption !== undefined ? (- <div className="px-4 py-5 lg:h-full lg:min-h-0" hidden={visibleTab !== "models"}>+ <div+ inert={readOnly}+ aria-disabled={readOnly || undefined}+ className={cn("px-4 py-5 lg:h-full lg:min-h-0", readOnly && "opacity-50 select-none")}+ hidden={visibleTab !== "models"}+ ><ProviderModelsSectioninstanceId={instanceId}driverKind={driverKind}diff --git a/apps/web/src/components/settings/ProviderSettingsPanel.environment.test.tsx b/apps/web/src/components/settings/ProviderSettingsPanel.environment.test.tsxindex bf79929f197..dd5e5d00397 100644--- a/apps/web/src/components/settings/ProviderSettingsPanel.environment.test.tsx+++ b/apps/web/src/components/settings/ProviderSettingsPanel.environment.test.tsx@@ -127,6 +127,10 @@ function renderPanel(options?: {}) as ReactElement<Record<string, unknown>>;}+function isAddProviderButton(element: ReactElement<Record<string, unknown>>): boolean {+ return element.props["aria-label"] === "Add provider";+}+async function flushPromises(): Promise<void> {await Promise.resolve();await Promise.resolve();@@ -212,14 +216,10 @@ describe("EnvironmentProviderSettings routing", () => {const notice = visitElements(panel, (element) => element.props.title === "Limited permissions");expect(notice).not.toBeNull();- const providersSection = visitElements(- panel,- (element) => element.props.title === "Providers" && "headerAction" in element.props,- );- expect(providersSection?.props.headerAction).toBeNull();expect(visitElements(panel, (element) => element.props["aria-label"] === "Refresh provider status"),).toBeNull();+ expect(visitElements(panel, isAddProviderButton)).toBeNull();});it("keeps the editable layout interactive when not read only", () => {@@ -229,11 +229,10 @@ describe("EnvironmentProviderSettings routing", () => {expect(visitElements(panel, (element) => element.props.title === "Limited permissions"),).toBeNull();- const providersSection = visitElements(- panel,- (element) => element.props.title === "Providers" && "headerAction" in element.props,- );- expect(providersSection?.props.headerAction).not.toBeNull();+ expect(+ visitElements(panel, (element) => element.props["aria-label"] === "Refresh provider status"),+ ).not.toBeNull();+ expect(visitElements(panel, isAddProviderButton)).not.toBeNull();});it("deletes and resets provider configuration without erasing shared preferences", () => {diff --git a/apps/web/src/components/settings/ProviderSettingsPanel.tsx b/apps/web/src/components/settings/ProviderSettingsPanel.tsxindex 395aa7c61e8..3fb193fe107 100644--- a/apps/web/src/components/settings/ProviderSettingsPanel.tsx+++ b/apps/web/src/components/settings/ProviderSettingsPanel.tsx@@ -220,11 +220,11 @@ export function ProviderSettingsPanel() {options.length === 1 && options[0]?.entry.target._tag === "PrimaryConnectionTarget";const deviceTabs =!onlyPrimaryDevice && options.length > 0 ? (- <ScrollArea hideScrollbars scrollFade className="h-11 min-w-0 rounded-none">+ <ScrollArea hideScrollbars scrollFade className="mx-3 h-11 min-w-0 rounded-none sm:mx-4"><divrole="group"aria-label="Devices"- className="flex h-full w-max min-w-full border-b border-border/70 px-3 sm:px-4"+ className="flex h-full w-max min-w-full border-b border-border/70 px-1">{options.map((environment) => {const Icon = providerEnvironmentIcon(environment);@@ -243,10 +243,12 @@ export function ProviderSettingsPanel() {><Icon className="size-3.5 shrink-0" aria-hidden /><span className="max-w-40 truncate">{environment.label}</span>- <ConnectionStatusDot- dotClassName={connectionPhaseDotClassName(environment.connection.phase)}- pingClassName={connectionPhasePingClassName(environment.connection.phase)}- />+ {environment.connection.phase !== "connected" ? (+ <ConnectionStatusDot+ dotClassName={connectionPhaseDotClassName(environment.connection.phase)}+ pingClassName={connectionPhasePingClassName(environment.connection.phase)}+ />+ ) : null}<span className="sr-only">{detail}, {statusText}</span>@@ -264,7 +266,7 @@ export function ProviderSettingsPanel() {) : null;return (- <SettingsPageContainer width="expanded" className="gap-8">+ <SettingsPageContainer className="gap-8">{options.length === 0 ? (<SettingsSection title="Providers"><SettingsRow@@ -405,10 +407,11 @@ export function EnvironmentProviderSettings({readonly environmentLabel: string;readonly deviceTabs?: ReactNode;/**- * Render the full provider layout, greyed out and inert, when this session's- * credential lacks `orchestration:operate` on the environment. Showing the- * real configuration keeps the view honest; disabling interaction keeps- * every one of its writes from being offered and then rejected.+ * Grey out and freeze every write control when this session's credential+ * lacks `orchestration:operate` on the environment. Selecting providers and+ * opening Advanced still work so the real configuration stays readable;+ * switches, forms, and the health interval are inert so no write is+ * offered and then rejected.*/readonly readOnly?: boolean;}) {@@ -426,7 +429,6 @@ export function EnvironmentProviderSettings({const [isAddInstanceDialogOpen, setIsAddInstanceDialogOpen] = useState(false);const [selectedInstanceId, setSelectedInstanceId] = useState<ProviderInstanceId | null>(null);const [advancedOpen, setAdvancedOpen] = useState(false);- const advancedVisible = readOnly || advancedOpen;const [updatingProviderDrivers, setUpdatingProviderDrivers] = useState<ReadonlySet<ProviderDriverKind>>(() => new Set());@@ -817,16 +819,56 @@ export function EnvironmentProviderSettings({<SettingsSection{...searchableSetting("providers")}headerAction={- !readOnly ? (- <Button- size="compact"- variant="outline"- onClick={() => setIsAddInstanceDialogOpen(true)}- >- <PlusIcon className="size-3.5" />- Add provider- </Button>- ) : null+ <div className="flex min-w-0 items-center gap-1.5">+ {/*+ The 11px size must sit on this flex item, not just the span+ inside: the item's line box is struck from its own font size,+ and an inherited 16px strut hangs the smaller text below the+ vertical center of the row.+ */}+ <span className="hidden min-w-0 truncate text-[11px] sm:inline">+ <ProviderLastChecked lastCheckedAt={lastCheckedAt} />+ </span>+ {!readOnly ? (+ <>+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ size="icon-micro"+ variant="ghost-muted"+ disabled={isRefreshingProviders}+ onClick={() => void refreshProviders()}+ aria-label="Refresh provider status"+ >+ {isRefreshingProviders ? (+ <LoaderIcon className="size-3 animate-spin" />+ ) : (+ <RefreshCwIcon className="size-3" />+ )}+ </Button>+ }+ />+ <TooltipPopup side="top">Refresh provider status</TooltipPopup>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ size="icon-micro"+ variant="ghost-muted"+ onClick={() => setIsAddInstanceDialogOpen(true)}+ aria-label="Add provider"+ >+ <PlusIcon className="size-3" />+ </Button>+ }+ />+ <TooltipPopup side="top">Add provider</TooltipPopup>+ </Tooltip>+ </>+ ) : null}+ </div>}>{deviceTabs}@@ -837,45 +879,17 @@ export function EnvironmentProviderSettings({/>) : null}<div className="space-y-1">- <div className="overflow-hidden rounded-lg border border-border/70 lg:grid lg:h-[min(38rem,calc(100dvh-16rem))] lg:min-h-[30rem] lg:grid-cols-[20rem_minmax(0,1fr)]">+ <div className="mx-3 overflow-hidden rounded-lg border border-border/70 sm:mx-4 lg:grid lg:h-[min(38rem,calc(100dvh-16rem))] lg:min-h-[30rem] lg:grid-cols-[20rem_minmax(0,1fr)]"><div className="border-b border-border/70 lg:flex lg:min-h-0 lg:flex-col lg:border-r lg:border-b-0">- <div className="flex min-h-9 shrink-0 items-center justify-between border-b border-border/70 px-3 text-[11px] font-medium text-muted-foreground">- <span>Provider</span>- <span>On</span>- </div>- <div className="lg:min-h-0 lg:flex-1 lg:overflow-y-auto">- {rows.map((row) => renderProviderInstance(row, "list"))}- </div>- <div- className={cn(- "flex min-h-10 shrink-0 items-center justify-between px-3",- rows.length > 0 && "border-t border-border/60",- )}- >- <ProviderLastChecked lastCheckedAt={lastCheckedAt} />- {!readOnly ? (- <Tooltip>- <TooltipTrigger- render={- <Button- size="icon-micro"- variant="ghost-muted"- disabled={isRefreshingProviders}- onClick={() => void refreshProviders()}- aria-label="Refresh provider status"- >- {isRefreshingProviders ? (- <LoaderIcon className="size-3 animate-spin" />- ) : (- <RefreshCwIcon className="size-3" />- )}- </Button>- }- />- <TooltipPopup side="top">Refresh provider status</TooltipPopup>- </Tooltip>- ) : null}- </div>+ <ScrollArea scrollFade chainVerticalScroll className="lg:min-h-0 lg:flex-1">+ <div className="divide-y divide-border/60">+ {rows.map((row) => (+ <div key={row.instanceId} className="p-1">+ {renderProviderInstance(row, "list")}+ </div>+ ))}+ </div>+ </ScrollArea></div><div className="min-w-0 lg:min-h-0">@@ -887,23 +901,19 @@ export function EnvironmentProviderSettings({</div></div>- <div- inert={readOnly}- aria-disabled={readOnly || undefined}- className={readOnly ? "opacity-50 select-none" : undefined}- >- <Collapsible- open={advancedVisible}- onOpenChange={setAdvancedOpen}- className="mt-2 border-t border-border/70"- >- <CollapsibleTrigger className="flex h-10 w-full items-center gap-2 px-3 text-xs text-muted-foreground hover:text-foreground sm:px-4">- <ChevronDownIcon- className={cn("size-3 transition-transform", advancedVisible && "rotate-180")}- />- Advanced- </CollapsibleTrigger>- <CollapsibleContent>+ <Collapsible open={advancedOpen} onOpenChange={setAdvancedOpen} className="mt-1">+ <CollapsibleTrigger className="flex h-10 w-full items-center gap-2 px-3 text-xs text-muted-foreground hover:text-foreground sm:px-4">+ <ChevronDownIcon+ className={cn("size-3 transition-transform", advancedOpen && "rotate-180")}+ />+ Advanced+ </CollapsibleTrigger>+ <CollapsibleContent>+ <div+ inert={readOnly}+ aria-disabled={readOnly || undefined}+ className={readOnly ? "opacity-50 select-none" : undefined}+ ><SettingsRowtitle={<span className="inline-flex items-center gap-1.5">@@ -915,7 +925,7 @@ export function EnvironmentProviderSettings({</PolicyTooltip></span>}- description="Set this to 0 seconds to use manual refresh only."+ description="Refresh availability, versions, auth state, and models in the background. 0 seconds turns background checks off."resetAction={providerHealthRefreshIntervalSeconds !==defaultProviderHealthRefreshIntervalSeconds ? (@@ -965,9 +975,9 @@ export function EnvironmentProviderSettings({</div>}/>- </CollapsibleContent>- </Collapsible>- </div>+ </div>+ </CollapsibleContent>+ </Collapsible></div></SettingsSection>