TypeScript
fix(web): provider updates no longer pop toasts on launch (#23233)
oliverb9aaff46e0e2
diff --git a/apps/web/src/components/ProviderUpdateEnvironmentRows.tsx b/apps/web/src/components/ProviderUpdateEnvironmentRows.tsxdeleted file mode 100644index eecea9a1465..00000000000--- a/apps/web/src/components/ProviderUpdateEnvironmentRows.tsx+++ /dev/null@@ -1,356 +0,0 @@-import { CheckIcon } from "lucide-react";-import { type ReactNode, useRef, useState } from "react";-import {- AuthProvidersManageScope,- type EnvironmentId,- type ServerProvider,-} from "@t3tools/contracts";-import {- isAtomCommandInterrupted,- settlePromise,- squashAtomCommandFailure,- type AtomCommandResult,-} from "@t3tools/client-runtime/state/runtime";--import { cn } from "~/lib/utils";-import { serverEnvironment } from "~/state/server";-import { readEnvironmentScope, useEnvironmentScope } from "~/state/session";-import { useAtomCommand } from "~/state/use-atom-command";-import { useLocalEnvironmentUpdateGroups } from "./ProviderUpdateLaunchNotification.environments";-import {- collectProviderUpdateOutcomeSnapshots,- firstRejectedProviderUpdateMessage,- getProviderUpdateProgressToastView,- getProviderUpdateSidebarPillView,- isTerminalProviderUpdatePhase,- resolveEnvironmentUpdateRowStatus,- type LocalEnvironmentUpdateGroup,- type LocalProviderUpdateOutcome,- type ProviderUpdateRowStatus,- type ProviderUpdateRowStatusKind,- type ProviderUpdateToastView,-} from "./ProviderUpdateLaunchNotification.logic";-import { Button } from "./ui/button";-import { Spinner } from "./ui/spinner";--type ProviderUpdateCommandResult = AtomCommandResult<- { readonly providers: ReadonlyArray<ServerProvider> },- unknown->;--function toProviderUpdateOutcome(input: {- readonly environmentId: EnvironmentId;- readonly isPrimary: boolean;- readonly target: {- readonly driver: ServerProvider["driver"];- readonly instanceId: ServerProvider["instanceId"];- };- readonly result: ProviderUpdateCommandResult;-}): PromiseSettledResult<LocalProviderUpdateOutcome> {- if (input.result._tag === "Failure") {- if (isAtomCommandInterrupted(input.result)) {- return {- status: "fulfilled",- value: {- environmentId: input.environmentId,- isPrimary: input.isPrimary,- driver: input.target.driver,- instanceId: input.target.instanceId,- provider: null,- },- };- }- const error = squashAtomCommandFailure(input.result);- return {- status: "rejected",- reason: error instanceof Error ? error : new Error("Provider update failed."),- };- }-- const provider =- input.result.value.providers.find(- (candidate) => candidate.instanceId === input.target.instanceId,- ) ?? null;- return {- status: "fulfilled",- value: {- environmentId: input.environmentId,- isPrimary: input.isPrimary,- driver: input.target.driver,- instanceId: input.target.instanceId,- provider,- },- };-}--// Keep it well beyond the server's own update timeout (5 min) so a legitimately-// slow update (npm installs routinely run tens of seconds) is never cut off and-// left showing a dead, unresponsive Update button.-const PENDING_EXPIRY_MS = 6 * 60_000;--function rowToneClass(kind: ProviderUpdateRowStatusKind): string {- switch (kind) {- case "failed":- return "text-destructive";- case "unchanged":- return "text-warning";- case "success":- return "text-success";- default:- return "text-muted-foreground";- }-}--function EnvironmentUpdateRow({- group,- status,- onUpdate,-}: {- readonly group: LocalEnvironmentUpdateGroup;- readonly status: ProviderUpdateRowStatus;- readonly onUpdate: () => void;-}) {- const canManageProviders = useEnvironmentScope(group.environmentId, AuthProvidersManageScope);- let trailing: ReactNode;- switch (status.kind) {- case "loading":- trailing = <Spinner size="md" tone="muted" />;- break;- case "success":- trailing = <CheckIcon aria-hidden="true" className="size-4 text-success" />;- break;- case "failed":- case "unchanged":- trailing = (- <Button size="xs" variant="outline" disabled={!canManageProviders} onClick={onUpdate}>- Retry- </Button>- );- break;- default:- trailing = (- <Button size="xs" variant="outline" disabled={!canManageProviders} onClick={onUpdate}>- Update- </Button>- );- break;- }-- return (- <div className="flex items-center justify-between gap-3 py-0.5">- <div className="flex min-w-0 flex-col">- <span className="truncate font-medium text-foreground">{group.label}</span>- <span className={cn("truncate text-xs", rowToneClass(status.kind))}>{status.text}</span>- {!canManageProviders ? (- <span className="text-xs text-muted-foreground">- This connection cannot manage provider accounts.- </span>- ) : null}- </div>- <div className="shrink-0">{trailing}</div>- </div>- );-}--export function ProviderUpdateEnvironmentRows({- onInteract,-}: {- readonly onInteract?: () => void;-}) {- const { groups } = useLocalEnvironmentUpdateGroups();- const updateProvider = useAtomCommand(serverEnvironment.updateProvider, {- reportFailure: false,- });- const groupByEnvironment = new Map(groups.map((group) => [group.environmentId, group] as const));-- const [visibleAfterIso] = useState(() => new Date().toISOString());-- // setPendingEnvironments is an async state update, and PENDING_EXPIRY_MS can- // clear the spinner while a request is still in flight, so a rapid- // double-click (or a click after the expiry fires mid- request) would- // otherwise dispatch a second full round of updates. A ref updates- // synchronously, so we can bail before doing any work.- const inFlightEnvironmentsRef = useRef<Set<EnvironmentId>>(new Set());-- // Bumped on each dispatch and captured locally, so an attempt that was- // superseded -- e.g. one that already tripped the expiry safety net and was- // retried -- detects it is no longer current and skips every state write when- // it finally resolves, instead of clobbering the newer attempt's- // spinner/result/error or its in-flight guard.- const requestVersionRef = useRef<Map<EnvironmentId, number>>(new Map());-- const [pendingEnvironments, setPendingEnvironments] = useState<ReadonlySet<EnvironmentId>>(- () => new Set(),- );- const [errorByEnvironment, setErrorByEnvironment] = useState<ReadonlyMap<EnvironmentId, string>>(- () => new Map(),- );- const [resultByEnvironment, setResultByEnvironment] = useState<- ReadonlyMap<EnvironmentId, ProviderUpdateToastView>- >(() => new Map());-- const clearPending = (environmentId: EnvironmentId) => {- setPendingEnvironments((previous) => {- if (!previous.has(environmentId)) {- return previous;- }- const next = new Set(previous);- next.delete(environmentId);- return next;- });- };-- const handleUpdate = async (environmentId: EnvironmentId) => {- if (!readEnvironmentScope(environmentId, AuthProvidersManageScope)) return;- const group = groupByEnvironment.get(environmentId);- if (!group || group.candidates.length === 0) {- return;- }- if (inFlightEnvironmentsRef.current.has(environmentId)) {- return;- }- inFlightEnvironmentsRef.current.add(environmentId);- const requestVersion = (requestVersionRef.current.get(environmentId) ?? 0) + 1;- requestVersionRef.current.set(environmentId, requestVersion);- const isCurrentRequest = () => requestVersionRef.current.get(environmentId) === requestVersion;- onInteract?.();- const providerCount = group.candidates.length;- const targets = group.candidates.map((candidate) => ({- driver: candidate.driver,- instanceId: candidate.instanceId,- }));-- setPendingEnvironments((previous) => new Set(previous).add(environmentId));- setErrorByEnvironment((previous) => {- if (!previous.has(environmentId)) {- return previous;- }- const next = new Map(previous);- next.delete(environmentId);- return next;- });- setResultByEnvironment((previous) => {- if (!previous.has(environmentId)) {- return previous;- }- const next = new Map(previous);- next.delete(environmentId);- return next;- });-- const expiry = setTimeout(() => {- if (!isCurrentRequest()) {- return;- }- inFlightEnvironmentsRef.current.delete(environmentId);- clearPending(environmentId);- setErrorByEnvironment((previous) =>- new Map(previous).set(environmentId, "Update timed out — try again."),- );- }, PENDING_EXPIRY_MS);- const settled = await settlePromise(async () => {- const results = await Promise.all(- targets.map(async (target): Promise<PromiseSettledResult<LocalProviderUpdateOutcome>> => {- try {- const result = await updateProvider({- environmentId,- input: { provider: target.driver, instanceId: target.instanceId },- });- return toProviderUpdateOutcome({- environmentId,- isPrimary: group.isPrimary,- target,- result,- });- } catch (error) {- return {- status: "rejected",- reason: error instanceof Error ? error : new Error("Provider update failed."),- };- }- }),- );- if (!isCurrentRequest()) {- return;- }- setErrorByEnvironment((previous) => {- if (!previous.has(environmentId)) {- return previous;- }- const next = new Map(previous);- next.delete(environmentId);- return next;- });- if (results.length === 0) {- setErrorByEnvironment((previous) =>- new Map(previous).set(- environmentId,- "This environment isn’t connected — try again once it reconnects.",- ),- );- return;- }- const rejectedMessage = firstRejectedProviderUpdateMessage(results);- if (rejectedMessage) {- setErrorByEnvironment((previous) => new Map(previous).set(environmentId, rejectedMessage));- return;- }- const view = getProviderUpdateProgressToastView({- providers: collectProviderUpdateOutcomeSnapshots(results),- providerCount,- });- // A stored view never re-polls, so persisting it would pin the row's- // spinner forever once the pending flag expires. Drop it and let the- // live per-environment provider state (pill) plus the pending expiry- // drive the row, so it self-heals to whatever the backend actually did.- if (isTerminalProviderUpdatePhase(view.phase)) {- setResultByEnvironment((previous) => new Map(previous).set(environmentId, view));- }- });- clearTimeout(expiry);- if (!isCurrentRequest()) return;- if (settled._tag === "Failure") {- const error = squashAtomCommandFailure(settled);- setErrorByEnvironment((previous) =>- new Map(previous).set(- environmentId,- error instanceof Error ? error.message : "Provider update failed.",- ),- );- }- clearPending(environmentId);- inFlightEnvironmentsRef.current.delete(environmentId);- };-- const rows = groups- .map((group) => ({- group,- status: resolveEnvironmentUpdateRowStatus({- group,- error: errorByEnvironment.get(group.environmentId),- result: resultByEnvironment.get(group.environmentId),- pill: getProviderUpdateSidebarPillView(group.candidates, {- visibleAfterIso,- }),- isPending: pendingEnvironments.has(group.environmentId),- }),- }))- .filter(({ group, status }) => group.candidates.length > 0 || status.kind !== "idle");-- if (rows.length === 0) {- return null;- }-- return (- <div className="mt-0.5 flex flex-col gap-1">- {rows.map(({ group, status }) => (- <EnvironmentUpdateRow- key={group.environmentId}- group={group}- status={status}- onUpdate={() => handleUpdate(group.environmentId)}- />- ))}- </div>- );-}diff --git a/apps/web/src/components/ProviderUpdateLaunchNotification.environments.ts b/apps/web/src/components/ProviderUpdateLaunchNotification.environments.tsdeleted file mode 100644index 4fa45a39d21..00000000000--- a/apps/web/src/components/ProviderUpdateLaunchNotification.environments.ts+++ /dev/null@@ -1,75 +0,0 @@-import type { ConnectionCatalogEntry } from "@t3tools/client-runtime/connection";--import {- useEnvironmentProviders,- useEnvironments,- usePrimaryEnvironmentId,-} from "~/state/environments";-import { isDesktopLocalConnectionTarget } from "~/connection/desktopLocal";-import {- buildLocalEnvironmentUpdateGroups,- deriveEnvironmentDisplayLabel,- type EnvironmentUpdateConnectionState,- type LocalEnvironmentProvidersInput,- type LocalEnvironmentUpdateGroup,-} from "./ProviderUpdateLaunchNotification.logic";--function isLocalConnectionTarget(target: ConnectionCatalogEntry["target"]): boolean {- return target._tag === "PrimaryConnectionTarget" || isDesktopLocalConnectionTarget(target);-}--function normalizeConnectionState(phase: string | undefined): EnvironmentUpdateConnectionState {- switch (phase) {- case "connected":- return "ready";- case "connecting":- case "reconnecting":- return "connecting";- case "unsupported":- case "error":- return "error";- case "offline":- return "disconnected";- default:- return "connecting";- }-}--export function useLocalEnvironmentUpdateGroups(): {- readonly groups: LocalEnvironmentUpdateGroup[];- readonly isAnySettling: boolean;-} {- const { environments } = useEnvironments();- const providersByEnvironment = useEnvironmentProviders();- const primaryEnvironmentId = usePrimaryEnvironmentId();-- const inputs: LocalEnvironmentProvidersInput[] = [];-- for (const environment of environments) {- if (!isLocalConnectionTarget(environment.entry.target)) {- continue;- }-- const isPrimary = environment.environmentId === primaryEnvironmentId;- const serverConfig = environment.serverConfig;-- inputs.push({- environmentId: environment.environmentId,- label: isPrimary- ? deriveEnvironmentDisplayLabel({- isWsl: false,- wslDistro: null,- platformOs: serverConfig?.environment.platform.os,- fallbackLabel: environment.label,- })- : environment.label,- isPrimary,- connectionState: isPrimary ? "ready" : normalizeConnectionState(environment.connection.phase),- providers: providersByEnvironment.get(environment.environmentId) ?? [],- });- }-- inputs.sort((left, right) => Number(right.isPrimary) - Number(left.isPrimary));-- return buildLocalEnvironmentUpdateGroups(inputs);-}diff --git a/apps/web/src/components/ProviderUpdateLaunchNotification.logic.test.ts b/apps/web/src/components/ProviderUpdateLaunchNotification.logic.test.tsindex 66b8ff5318a..d6e283fec8d 100644--- a/apps/web/src/components/ProviderUpdateLaunchNotification.logic.test.ts+++ b/apps/web/src/components/ProviderUpdateLaunchNotification.logic.test.ts@@ -9,25 +9,13 @@ import * as Cause from "effect/Cause";import { AsyncResult } from "effect/reactivity";import {- buildLocalEnvironmentUpdateGroups,canOneClickUpdateProviderCandidate,- collectProviderUpdateOutcomeSnapshots,- collectUpdatedProviderSnapshots,- firstRejectedProviderUpdateMessage,- getProviderUpdateProgressToastView,getProviderUpdateRunToastView,getProviderUpdateSidebarPillView,hasOneClickUpdateProviderCandidate,isProviderUpdateCandidate,isProviderSettingsUpdateCandidate,- providerUpdateNotificationKey,- resolveEnvironmentUpdateRowStatus,- type LocalEnvironmentProvidersInput,- type LocalEnvironmentUpdateGroup,- type LocalProviderUpdateOutcome,type ProviderUpdateCandidate,- type ProviderUpdateSidebarPillView,- type ProviderUpdateToastView,} from "./ProviderUpdateLaunchNotification.logic";const checkedAt = "2026-04-23T10:00:00.000Z";@@ -158,67 +146,6 @@ describe("provider update launch notification logic", () => {expect(canOneClickUpdateProviderCandidate(candidate, [candidate])).toBe(false);});- it("keeps the same notification key while the published update version is unchanged", () => {- const first = updateCandidate({- driver: driver("codex"),- version: "1.0.0",- latestVersion: "1.2.0",- });- const second = updateCandidate({- driver: driver("codex"),- version: "1.1.0",- latestVersion: "1.2.0",- });- const nextPublishedVersion = updateCandidate({- driver: driver("codex"),- version: "1.1.0",- latestVersion: "1.3.0",- });-- expect(providerUpdateNotificationKey([first])).toBe(providerUpdateNotificationKey([second]));- expect(providerUpdateNotificationKey([nextPublishedVersion])).not.toBe(- providerUpdateNotificationKey([first]),- );- });-- it("tracks updated provider snapshots by instance instead of collapsing to a sibling driver", () => {- const targetInstanceId = instanceId("codex_personal");- const siblingInstanceId = instanceId("codex");- const updatedPersonal = provider({- driver: driver("codex"),- instanceId: targetInstanceId,- version: "1.1.0",- latestVersion: "1.1.0",- advisoryStatus: "current",- updateState: {- status: "succeeded",- startedAt: checkedAt,- finishedAt: checkedAt,- message: "Provider updated.",- output: null,- },- });- const currentDefaultSibling = provider({- driver: driver("codex"),- instanceId: siblingInstanceId,- version: "1.1.0",- latestVersion: "1.1.0",- advisoryStatus: "current",- updateState: undefined,- });-- expect(- collectUpdatedProviderSnapshots({- results: [- AsyncResult.success({- providers: [updatedPersonal, currentDefaultSibling],- }),- ],- providerInstanceIds: new Set([targetInstanceId]),- }),- ).toEqual([updatedPersonal]);- });-it("shows the active sidebar pill for an update on a non-default instance", () => {const view = getProviderUpdateSidebarPillView([provider({ driver: driver("claudeAgent") }),@@ -347,140 +274,6 @@ describe("provider update launch notification logic", () => {title: "Claude v1.1.0 update failed",});});-- describe("multi-backend update outcomes", () => {- const terminalState = (- status: "succeeded" | "failed" | "unchanged",- message: string,- ): NonNullable<ServerProvider["updateState"]> => ({- status,- startedAt: checkedAt,- finishedAt: checkedAt,- message,- output: null,- });-- const fulfilledOutcome = (- isPrimary: boolean,- snapshot: ServerProvider | null,- environment = "env",- ): PromiseSettledResult<LocalProviderUpdateOutcome> => ({- status: "fulfilled",- value: {- environmentId: environment as LocalProviderUpdateOutcome["environmentId"],- isPrimary,- driver: snapshot?.driver ?? driver("codex"),- instanceId: snapshot?.instanceId ?? instanceId("codex"),- provider: snapshot,- },- });-- it("surfaces a secondary backend's failed update over the primary's success", () => {- const snapshots = collectProviderUpdateOutcomeSnapshots([- fulfilledOutcome(- true,- provider({- driver: driver("codex"),- updateState: terminalState("succeeded", "Provider updated."),- }),- ),- fulfilledOutcome(- false,- provider({- driver: driver("codex"),- updateState: terminalState("failed", "npm: NotFound"),- }),- ),- ]);-- expect(snapshots).toHaveLength(1);- expect(snapshots[0]?.updateState?.status).toBe("failed");- expect(- getProviderUpdateProgressToastView({ providers: snapshots, providerCount: 1 }),- ).toMatchObject({ phase: "failed" });- });-- it("treats a rejected dispatch as not contributing a snapshot", () => {- const primary = provider({- driver: driver("codex"),- updateState: terminalState("succeeded", "Provider updated."),- });- const results: PromiseSettledResult<LocalProviderUpdateOutcome>[] = [- fulfilledOutcome(true, primary),- { status: "rejected", reason: new Error("WebSocket closed") },- ];-- expect(collectProviderUpdateOutcomeSnapshots(results)).toEqual([primary]);- expect(firstRejectedProviderUpdateMessage(results)).toBe("WebSocket closed");- });- });-- describe("per-environment update grouping", () => {- const environment = (- input: {- readonly environmentId: string;- readonly providers: ReadonlyArray<ServerProvider>;- } & Partial<Omit<LocalEnvironmentProvidersInput, "environmentId" | "providers">>,- ): LocalEnvironmentProvidersInput => ({- environmentId: input.environmentId as EnvironmentId,- label: input.label ?? input.environmentId,- isPrimary: input.isPrimary ?? false,- connectionState: input.connectionState ?? "ready",- providers: input.providers,- });-- it("flags settling while a secondary backend is still connecting", () => {- const result = buildLocalEnvironmentUpdateGroups([- environment({- environmentId: "env-windows",- isPrimary: true,- providers: [provider({ driver: driver("codex") })],- }),- environment({ environmentId: "env-wsl", connectionState: "connecting", providers: [] }),- ]);-- expect(result.isAnySettling).toBe(true);- expect(- result.groups.find((group) => group.environmentId === ("env-wsl" as EnvironmentId))- ?.isSettling,- ).toBe(true);- });- });-- describe("resolveEnvironmentUpdateRowStatus", () => {- const group: LocalEnvironmentUpdateGroup = {- environmentId: "env-wsl" as EnvironmentId,- label: "WSL",- isPrimary: false,- isSettling: false,- candidates: [updateCandidate({ driver: driver("codex"), latestVersion: "1.1.0" })],- providers: [],- };- const succeededResult: ProviderUpdateToastView = {- phase: "succeeded",- type: "success",- title: "Provider updated",- description: "New sessions will use the updated provider.",- };- const successPill: ProviderUpdateSidebarPillView = {- key: "succeeded:codex",- tone: "success",- title: "Codex updated",- description: "New sessions will use the updated provider.",- };-- it("prefers a transport error", () => {- expect(- resolveEnvironmentUpdateRowStatus({- group,- error: "boom",- result: succeededResult,- pill: successPill,- isPending: true,- }),- ).toMatchObject({ kind: "failed", text: "boom" });- });- });});it("does not offer incompatible latest versions and restores suggestions after policy relaxation", () => {diff --git a/apps/web/src/components/ProviderUpdateLaunchNotification.logic.ts b/apps/web/src/components/ProviderUpdateLaunchNotification.logic.tsindex 8c657651117..9ff55048541 100644--- a/apps/web/src/components/ProviderUpdateLaunchNotification.logic.ts+++ b/apps/web/src/components/ProviderUpdateLaunchNotification.logic.ts@@ -2,7 +2,6 @@ import {defaultInstanceIdForDriver,PROVIDER_DISPLAY_NAMES,type EnvironmentId,- type ExecutionEnvironmentPlatformOs,type ProviderDriverKind,type ProviderInstanceId,type ServerProvider,@@ -27,27 +26,6 @@ export type ProviderSettingsUpdateCandidate = ServerProvider & {};};-export type ProviderUpdateToastType = "warning" | "loading" | "error" | "success";-export type ProviderUpdateToastPhase = "initial" | "running" | "failed" | "unchanged" | "succeeded";--export interface ProviderUpdateToastView {- readonly phase: ProviderUpdateToastPhase;- readonly type: ProviderUpdateToastType;- readonly title: string;- readonly description: string;- readonly dismissAfterVisibleMs?: number;-}--/**- * A non-terminal ("initial"/"running") snapshot never re-polls itself, so- * storing one pins an update row's spinner indefinitely once its pending flag- * expires; such phases must be dropped in favor of the live per-environment- * provider state instead of being persisted.- */-export function isTerminalProviderUpdatePhase(phase: ProviderUpdateToastPhase): boolean {- return phase === "succeeded" || phase === "failed" || phase === "unchanged";-}-export type ProviderUpdateSidebarPillTone = "loading" | "warning" | "error" | "success";export interface ProviderUpdateSidebarPillView {@@ -100,19 +78,6 @@ function dedupeProvidersByDriver<T extends ServerProvider>(providers: ReadonlyArreturn [...latestProviderByDriver.values()];}-function dedupeProvidersByInstanceId<T extends ServerProvider>(providers: ReadonlyArray<T>): T[] {- const latestProviderByInstanceId = new Map<ProviderInstanceId, T>();-- for (const provider of providers) {- const current = latestProviderByInstanceId.get(provider.instanceId);- if (!current || provider.checkedAt.localeCompare(current.checkedAt) >= 0) {- latestProviderByInstanceId.set(provider.instanceId, provider);- }- }-- return [...latestProviderByInstanceId.values()];-}-function getProviderUpdatedTitle(provider: Pick<ServerProvider, "driver" | "version">): string {const providerName = PROVIDER_DISPLAY_NAMES[provider.driver] ?? provider.driver;return provider.version@@ -211,19 +176,6 @@ export function canOneClickUpdateProviderCandidate();}-export function providerUpdateNotificationKey(- providers: ReadonlyArray<ProviderUpdateCandidate>,-): string | null {- const parts = dedupeProvidersByDriver(providers)- .map((provider) => {- const advisory = provider.versionAdvisory;- return [provider.driver, advisory.latestVersion].join(":");- })- .toSorted();-- return parts.length > 0 ? parts.join("|") : null;-}-function formatProviderList(providers: ReadonlyArray<Pick<ServerProvider, "driver">>) {const names = providers.map((provider) => PROVIDER_DISPLAY_NAMES[provider.driver] ?? provider.driver,@@ -234,126 +186,6 @@ function formatProviderList(providers: ReadonlyArray<Pick<ServerProvider, "drivereturn `${names.slice(0, -1).join(", ")}, and ${names[names.length - 1]}`;}-/**- * Install and provider settings reach only installs the server can update.- * The rest are updated by the app or tool that installed them, so they get- * their own sentence whatever else the notice offers.- */-function describeInitialUpdates(input: {- readonly updateProviders: ReadonlyArray<ProviderUpdateCandidate>;- readonly oneClickProviders: ReadonlyArray<ProviderUpdateCandidate>;-}): string {- const fromSettings = input.updateProviders.filter(- (provider) => provider.versionAdvisory.canUpdate,- );- const manual = input.updateProviders.filter((provider) => !provider.versionAdvisory.canUpdate);- return [- input.oneClickProviders.length > 0- ? "Install the update now or review provider settings."- : fromSettings.length > 0- ? `${formatProviderList(fromSettings)} can be updated from provider settings.`- : null,- manual.length > 0- ? `Update ${formatProviderList(manual)} with the app or tool that installed ${manual.length === 1 ? "it" : "them"}.`- : null,- ]- .filter((sentence) => sentence !== null)- .join(" ");-}--export function getProviderUpdateInitialToastView(input: {- readonly updateProviders: ReadonlyArray<ProviderUpdateCandidate>;- readonly oneClickProviders: ReadonlyArray<ProviderUpdateCandidate>;-}): ProviderUpdateToastView {- return {- phase: "initial",- type: "warning",- title: getProviderUpdateInitialToastTitle(input.updateProviders),- description: describeInitialUpdates(input),- };-}--export function shouldShowPrimaryProviderUpdateToast(view: ProviderUpdateToastView): boolean {- return view.phase !== "running";-}--function getProviderUpdateRunningToastView(providerCount: number): ProviderUpdateToastView {- return {- phase: "running",- type: "loading",- title: providerCount === 1 ? "Updating provider" : "Updating providers",- description: "Running provider update command.",- };-}--export function getProviderUpdateRejectedToastView(- providerCount: number,- message: string,-): ProviderUpdateToastView {- return {- phase: "failed",- type: "error",- title: providerCount === 1 ? "Provider update failed" : "Provider updates failed",- description: message,- };-}--export function getProviderUpdateProgressToastView(input: {- readonly providers: ReadonlyArray<ServerProvider>;- readonly providerCount: number;-}): ProviderUpdateToastView {- const providers = dedupeProvidersByDriver(input.providers);- const failedProviders = providers.filter((provider) => provider.updateState?.status === "failed");- if (failedProviders.length > 0) {- return {- phase: "failed",- type: "error",- title: failedProviders.length === 1 ? "Provider update failed" : "Provider updates failed",- description: getFailedProviderUpdateDescription(failedProviders),- };- }-- const unchangedProviders = providers.filter(- (provider) => provider.updateState?.status === "unchanged",- );- if (unchangedProviders.length > 0) {- return {- phase: "unchanged",- type: "warning",- title:- unchangedProviders.length === 1- ? "Provider still needs an update"- : "Providers still need updates",- description: `${formatProviderList(unchangedProviders)} ${- unchangedProviders.length === 1 ? "still appears" : "still appear"- } outdated. Check provider settings for details.`,- };- }-- if (providers.some(isProviderUpdateActive)) {- return getProviderUpdateRunningToastView(input.providerCount);- }-- const hasCompleteProviderSnapshots = providers.length >= input.providerCount;- const allProvidersUpdated =- hasCompleteProviderSnapshots &&- providers.every(- (provider) =>- provider.updateState?.status === "succeeded" || !isProviderUpdateCandidate(provider),- );- if (allProvidersUpdated) {- return {- phase: "succeeded",- type: "success",- title: input.providerCount === 1 ? "Provider updated" : "Provider updates finished",- description: getProviderUpdatedDescription(input.providerCount),- dismissAfterVisibleMs: PROVIDER_UPDATE_SUCCESS_VISIBLE_MS,- };- }-- return getProviderUpdateRunningToastView(input.providerCount);-}-export interface ProviderUpdateRun {readonly environmentId: EnvironmentId;readonly machineLabel: string;@@ -390,9 +222,11 @@ export function getProviderUpdateRunOutcome(};}-export function getProviderUpdateRunToastView(- runs: ReadonlyArray<ProviderUpdateRun>,-): Pick<ProviderUpdateToastView, "type" | "title" | "description"> | null {+export function getProviderUpdateRunToastView(runs: ReadonlyArray<ProviderUpdateRun>): {+ readonly type: "success" | "error";+ readonly title: string;+ readonly description: string;+} | null {const settled = runs.map(getProviderUpdateRunOutcome).filter((outcome) => outcome.status !== "interrupted");@@ -421,39 +255,6 @@ export function getProviderUpdateRunToastView(};}-export function collectUpdatedProviderSnapshots(input: {- readonly results: ReadonlyArray<- AtomCommandResult<{ readonly providers: ReadonlyArray<ServerProvider> }, unknown>- >;- readonly providerInstanceIds: ReadonlySet<ProviderInstanceId>;-}): ServerProvider[] {- const matchedProviders: ServerProvider[] = [];-- for (const result of input.results) {- if (result._tag === "Failure") {- continue;- }- for (const provider of result.value.providers) {- if (input.providerInstanceIds.has(provider.instanceId)) {- matchedProviders.push(provider);- }- }- }-- return dedupeProvidersByInstanceId(matchedProviders);-}--export function firstFailedProviderUpdateMessage(- results: ReadonlyArray<AtomCommandResult<unknown, unknown>>,-): string | null {- const failed = results.find((result) => result._tag === "Failure");- if (!failed || failed._tag !== "Failure") {- return null;- }- const error = squashAtomCommandFailure(failed);- return error instanceof Error ? error.message : "Provider update failed.";-}-function getUpdateFinishedAt(provider: ServerProvider): string | null {return provider.updateState?.finishedAt ?? null;}@@ -630,17 +431,6 @@ export function getProviderUpdateSidebarPillView();}-function getProviderUpdateInitialToastTitle(- providers: ReadonlyArray<ProviderUpdateCandidate>,-): string {- if (providers.length === 1) {- const provider = providers[0]!;- const providerName = PROVIDER_DISPLAY_NAMES[provider.driver] ?? provider.driver;- return `Update Available: ${providerName} ${formatVersion(provider.versionAdvisory.latestVersion)}`;- }- return `Updates Available: ${providers.length} providers`;-}-function getFailedProviderUpdateDescription(providers: ReadonlyArray<ServerProvider>): string {if (providers.length === 1) {const provider = providers[0]!;@@ -650,184 +440,3 @@ function getFailedProviderUpdateDescription(providers: ReadonlyArray<ServerProvi}return `${formatProviderList(providers)} failed to update. Check provider settings for details.`;}--export interface LocalProviderUpdateOutcome {- readonly environmentId: EnvironmentId;- readonly isPrimary: boolean;- readonly driver: ProviderDriverKind;- readonly instanceId: ProviderInstanceId;- readonly provider: ServerProvider | null;-}--const PROVIDER_UPDATE_STATUS_SEVERITY: Record<string, number> = {- succeeded: 1,- queued: 2,- running: 2,- unchanged: 3,- failed: 4,-};--function providerUpdateOutcomeSeverity(provider: ServerProvider): number {- return PROVIDER_UPDATE_STATUS_SEVERITY[provider.updateState?.status ?? ""] ?? 0;-}--export function firstRejectedProviderUpdateMessage(- results: ReadonlyArray<PromiseSettledResult<unknown>>,-): string | null {- const rejected = results.find((result) => result.status === "rejected");- if (!rejected) {- return null;- }- return rejected.reason instanceof Error ? rejected.reason.message : "Provider update failed.";-}--export function collectProviderUpdateOutcomeSnapshots(- results: ReadonlyArray<PromiseSettledResult<LocalProviderUpdateOutcome>>,-): ServerProvider[] {- const worstByDriver = new Map<ProviderDriverKind, ServerProvider>();- for (const result of results) {- if (result.status !== "fulfilled" || result.value.provider === null) {- continue;- }- const provider = result.value.provider;- const current = worstByDriver.get(provider.driver);- if (- !current ||- providerUpdateOutcomeSeverity(provider) > providerUpdateOutcomeSeverity(current)- ) {- worstByDriver.set(provider.driver, provider);- }- }- return [...worstByDriver.values()];-}--export function deriveEnvironmentDisplayLabel(input: {- readonly isWsl: boolean;- readonly wslDistro: string | null;- readonly platformOs: ExecutionEnvironmentPlatformOs | undefined;- readonly fallbackLabel: string;-}): string {- if (input.isWsl) {- return input.wslDistro ? `WSL · ${input.wslDistro}` : "WSL";- }- switch (input.platformOs) {- case "windows":- return "Windows";- case "darwin":- return "macOS";- case "linux":- return "Linux";- default:- return input.fallbackLabel;- }-}--export type EnvironmentUpdateConnectionState = "connecting" | "ready" | "disconnected" | "error";--export interface LocalEnvironmentProvidersInput {- readonly environmentId: EnvironmentId;- readonly label: string;- readonly isPrimary: boolean;- readonly connectionState: EnvironmentUpdateConnectionState;- readonly providers: ReadonlyArray<ServerProvider>;-}--export interface LocalEnvironmentUpdateGroup {- readonly environmentId: EnvironmentId;- readonly label: string;- readonly isPrimary: boolean;- readonly isSettling: boolean;- readonly candidates: ProviderUpdateCandidate[];- readonly providers: ReadonlyArray<ServerProvider>;-}--export function buildLocalEnvironmentUpdateGroups(- environments: ReadonlyArray<LocalEnvironmentProvidersInput>,-): { groups: LocalEnvironmentUpdateGroup[]; isAnySettling: boolean } {- const groups = environments.map((environment) => ({- environmentId: environment.environmentId,- label: environment.label,- isPrimary: environment.isPrimary,- isSettling: environment.connectionState === "connecting",- candidates: collectProviderUpdateCandidates(environment.providers).filter((candidate) =>- canOneClickUpdateProviderCandidate(candidate, environment.providers),- ),- providers: environment.providers,- }));- const isAnySettling = environments.some(- (environment) => environment.connectionState === "connecting",- );- return { groups, isAnySettling };-}--export function environmentGroupsWithUpdates(- groups: ReadonlyArray<LocalEnvironmentUpdateGroup>,-): LocalEnvironmentUpdateGroup[] {- return groups.filter((group) => group.candidates.length > 0);-}--export function localEnvironmentUpdateNotificationKey(- groups: ReadonlyArray<LocalEnvironmentUpdateGroup>,-): string | null {- const parts = environmentGroupsWithUpdates(groups)- .map((group) => {- const providerParts = group.candidates- .map((candidate) => `${candidate.driver}:${candidate.versionAdvisory.latestVersion}`)- .toSorted()- .join(",");- return `${group.environmentId}=${providerParts}`;- })- .toSorted();- return parts.length > 0 ? parts.join("|") : null;-}--export type ProviderUpdateRowStatusKind = "idle" | "loading" | "success" | "failed" | "unchanged";--export interface ProviderUpdateRowStatus {- readonly kind: ProviderUpdateRowStatusKind;- readonly text: string;-}--function environmentProviderNames(group: LocalEnvironmentUpdateGroup): string {- return group.candidates- .map((candidate) => PROVIDER_DISPLAY_NAMES[candidate.driver] ?? candidate.driver)- .join(", ");-}--export function resolveEnvironmentUpdateRowStatus(input: {- readonly group: LocalEnvironmentUpdateGroup;- readonly error: string | undefined;- readonly result: ProviderUpdateToastView | undefined;- readonly pill: ProviderUpdateSidebarPillView | null;- readonly isPending: boolean;-}): ProviderUpdateRowStatus {- if (input.error) {- return { kind: "failed", text: input.error };- }- if (input.result) {- switch (input.result.phase) {- case "succeeded":- return { kind: "success", text: "Updated" };- case "failed":- return { kind: "failed", text: input.result.description };- case "unchanged":- return { kind: "unchanged", text: input.result.description };- }- }- if (input.pill) {- switch (input.pill.tone) {- case "success":- return { kind: "success", text: "Updated" };- case "error":- return { kind: "failed", text: input.pill.description };- case "warning":- return { kind: "unchanged", text: input.pill.description };- default:- return { kind: "loading", text: "Updating…" };- }- }- if (input.result || input.isPending) {- return { kind: "loading", text: "Updating…" };- }- return { kind: "idle", text: environmentProviderNames(input.group) };-}diff --git a/apps/web/src/components/ProviderUpdateLaunchNotification.tsx b/apps/web/src/components/ProviderUpdateLaunchNotification.tsxdeleted file mode 100644index dc46e7f927a..00000000000--- a/apps/web/src/components/ProviderUpdateLaunchNotification.tsx+++ /dev/null@@ -1,168 +0,0 @@-import { useNavigate } from "@tanstack/react-router";-import { DownloadIcon } from "lucide-react";-import { useEffect, useRef, useState } from "react";--import { useStableCallback } from "~/hooks/useStableCallback";-import { useEnvironments } from "~/state/environments";-import { isDesktopLocalConnectionTarget } from "~/connection/desktopLocal";-import { useDismissedProviderUpdateNotificationKeys } from "../providerUpdateDismissal";-import { ProviderUpdateEnvironmentRows } from "./ProviderUpdateEnvironmentRows";-import { useLocalEnvironmentUpdateGroups } from "./ProviderUpdateLaunchNotification.environments";-import {- collectProviderUpdateCandidates,- environmentGroupsWithUpdates,- getProviderUpdateInitialToastView,- localEnvironmentUpdateNotificationKey,-} from "./ProviderUpdateLaunchNotification.logic";-import { ProviderUpdatePrimaryNotification } from "./ProviderUpdatePrimaryNotification";-import { stackedThreadToast, toastManager } from "./ui/toast";--function useHasLocalSecondaryEnvironment(): boolean {- const { environments } = useEnvironments();- return environments.some((environment) =>- isDesktopLocalConnectionTarget(environment.entry.target),- );-}--export function ProviderUpdateLaunchNotification() {- const hasLocalSecondary = useHasLocalSecondaryEnvironment();-- return hasLocalSecondary ? (- <ProviderUpdateEnvironmentsNotification />- ) : (- <ProviderUpdatePrimaryNotification />- );-}--const seenProviderUpdateNotificationKeys = new Set<string>();-type ProviderUpdateToastId = ReturnType<typeof toastManager.add>;--// While a local backend (e.g. WSL) is still connecting, defer the popover so it-// reflects every environment. Cap the wait so a stuck or failed backend can't-// suppress the primary's updates indefinitely.-const SETTLING_GRACE_MS = 30_000;--function ProviderUpdateEnvironmentsNotification() {- const navigate = useNavigate();- const { groups, isAnySettling } = useLocalEnvironmentUpdateGroups();- const { dismissedNotificationKeys, dismissNotificationKey } =- useDismissedProviderUpdateNotificationKeys();-- const activeToastRef = useRef<{- readonly toastId: ProviderUpdateToastId;- readonly key: string;- } | null>(null);- // Whether the user has triggered an update from the current toast. Until they- // do, the prompt is replaced when the available updates change; afterward it- // is kept so in-progress rows are not torn down.- const hasInteractedRef = useRef(false);-- useEffect(() => {- return () => {- if (activeToastRef.current !== null) {- toastManager.close(activeToastRef.current.toastId);- activeToastRef.current = null;- }- };- }, []);-- const updateGroups = environmentGroupsWithUpdates(groups);- const notificationKey = localEnvironmentUpdateNotificationKey(groups);- const candidateUnion = collectProviderUpdateCandidates(- updateGroups.flatMap((group) => group.candidates),- );-- const [settleGraceElapsed, setSettleGraceElapsed] = useState(false);- // The grace period restarts with the next settling phase.- if (!isAnySettling && settleGraceElapsed) {- setSettleGraceElapsed(false);- }- useEffect(() => {- if (!isAnySettling) return;- const timer = setTimeout(() => setSettleGraceElapsed(true), SETTLING_GRACE_MS);- return () => clearTimeout(timer);- }, [isAnySettling]);- const isGated = isAnySettling && !settleGraceElapsed;-- const openProviderSettings = () => {- const active = activeToastRef.current;- if (active !== null) {- toastManager.close(active.toastId);- activeToastRef.current = null;- }- void navigate({ to: "/settings/providers" });- };-- // The toast closes long after the effect that opened it, so it dismisses the key- // the updates have moved to by then.- const dismissPrompt = useStableCallback(() => {- if (notificationKey) {- dismissNotificationKey(notificationKey);- }- activeToastRef.current = null;- });-- useEffect(() => {- const canShowPrompt =- notificationKey !== null &&- !isGated &&- !dismissedNotificationKeys.has(notificationKey) &&- !seenProviderUpdateNotificationKeys.has(notificationKey);-- const active = activeToastRef.current;- if (- active &&- active.key !== notificationKey &&- !hasInteractedRef.current &&- (notificationKey === null || !isGated)- ) {- toastManager.close(active.toastId);- activeToastRef.current = null;- }-- if (!notificationKey || !canShowPrompt || activeToastRef.current !== null) {- return;- }-- seenProviderUpdateNotificationKeys.add(notificationKey);- hasInteractedRef.current = false;-- const toastId = toastManager.add(- stackedThreadToast({- type: "warning",- title: getProviderUpdateInitialToastView({- updateProviders: candidateUnion,- oneClickProviders: candidateUnion,- }).title,- description: (- <ProviderUpdateEnvironmentRows- onInteract={() => {- hasInteractedRef.current = true;- }}- />- ),- timeout: 0,- actionProps: {- children: "Settings",- onClick: openProviderSettings,- },- actionVariant: "outline",- data: {- hideCopyButton: true,- leadingIcon: <DownloadIcon aria-hidden="true" className="size-4 text-success" />,- onClose: dismissPrompt,- },- }),- );- activeToastRef.current = { toastId, key: notificationKey };- }, [- notificationKey,- isGated,- candidateUnion,- dismissedNotificationKeys,- dismissPrompt,- openProviderSettings,- ]);-- return null;-}diff --git a/apps/web/src/components/ProviderUpdatePrimaryNotification.tsx b/apps/web/src/components/ProviderUpdatePrimaryNotification.tsxdeleted file mode 100644index 74040e171c5..00000000000--- a/apps/web/src/components/ProviderUpdatePrimaryNotification.tsx+++ /dev/null@@ -1,340 +0,0 @@-import { useNavigate } from "@tanstack/react-router";-import { useAtomValue } from "@effect/atom-react";-import { DownloadIcon } from "lucide-react";-import { useEffect, useRef } from "react";-import {- AuthProvidersManageScope,- type ServerProvider,- type ProviderInstanceId,-} from "@t3tools/contracts";--import { primaryServerProvidersAtom, serverEnvironment } from "../state/server";-import { usePrimaryEnvironment } from "../state/environments";-import { readEnvironmentScope, useEnvironmentScope } from "../state/session";-import { useDismissedProviderUpdateNotificationKeys } from "../providerUpdateDismissal";-import { ProviderInstanceIcon } from "./chat/ProviderInstanceIcon";-import {- canOneClickUpdateProviderCandidate,- collectProviderUpdateCandidates,- collectUpdatedProviderSnapshots,- firstFailedProviderUpdateMessage,- getProviderUpdateInitialToastView,- getProviderUpdateProgressToastView,- getProviderUpdateRejectedToastView,- providerUpdateNotificationKey,- shouldShowPrimaryProviderUpdateToast,- type ProviderUpdateToastView,-} from "./ProviderUpdateLaunchNotification.logic";-import { hiddenToastActionProps, stackedThreadToast, toastManager } from "./ui/toast";-import { useAtomCommand } from "../state/use-atom-command";--const seenProviderUpdateNotificationKeys = new Set<string>();-type ProviderUpdateToastId = ReturnType<typeof toastManager.add>;--type ActiveProviderUpdateToast =- | {- readonly kind: "prompt";- readonly key: string;- readonly toastId: ProviderUpdateToastId;- readonly canManageProviders: boolean;- }- | {- readonly kind: "update";- readonly key: string;- readonly providerInstanceIds: ReadonlySet<ProviderInstanceId>;- readonly providerCount: number;- };--function ProviderUpdateToastIcon({ provider }: { provider: ServerProvider }) {- return (- <span className="relative inline-flex size-4 shrink-0 items-center justify-center">- <ProviderInstanceIcon- driverKind={provider.driver}- displayName={provider.displayName ?? provider.driver}- acpRegistryIconUrl={provider.iconUrl}- iconClassName="size-4"- />- <span className="absolute -right-1 -bottom-1 z-40 inline-flex size-3 items-center justify-center rounded-full bg-popover">- <DownloadIcon aria-hidden="true" className="size-2.5 text-success" strokeWidth={2.5} />- </span>- </span>- );-}--function addProviderUpdateToast(input: {- readonly view: ProviderUpdateToastView;- readonly openSettings: (toastId: ProviderUpdateToastId) => void;-}) {- if (input.view.type === "loading" || input.view.type === "success") {- return toastManager.add({- type: input.view.type,- title: input.view.title,- description: input.view.description,- timeout: 0,- actionProps: hiddenToastActionProps,- data: {- hideCopyButton: true,- ...(input.view.dismissAfterVisibleMs !== undefined- ? { dismissAfterVisibleMs: input.view.dismissAfterVisibleMs }- : {}),- },- });- }-- let toastId!: ProviderUpdateToastId;- toastId = toastManager.add(- stackedThreadToast({- type: input.view.type,- title: input.view.title,- description: input.view.description,- timeout: 0,- actionProps: {- children: "Settings",- onClick: () => input.openSettings(toastId),- },- actionVariant: "outline",- data: {- hideCopyButton: true,- },- }),- );- return toastId;-}--export function ProviderUpdatePrimaryNotification() {- const navigate = useNavigate();- const providers = useAtomValue(primaryServerProvidersAtom);- const primaryEnvironment = usePrimaryEnvironment();- const canManageProviders = useEnvironmentScope(- primaryEnvironment?.environmentId ?? null,- AuthProvidersManageScope,- );- const updateProvider = useAtomCommand(serverEnvironment.updateProvider, {- reportFailure: false,- });- const activeToastRef = useRef<ActiveProviderUpdateToast | null>(null);- const { dismissedNotificationKeys, dismissNotificationKey } =- useDismissedProviderUpdateNotificationKeys();-- useEffect(() => {- return () => {- const activeToast = activeToastRef.current;- if (activeToast?.kind === "prompt") {- toastManager.close(activeToast.toastId);- }- activeToastRef.current = null;- };- }, []);-- const updateProviders = collectProviderUpdateCandidates(providers);- const notificationKey = providerUpdateNotificationKey(updateProviders);- const oneClickProviders = updateProviders.filter((provider) =>- canOneClickUpdateProviderCandidate(provider, providers),- );-- const openProviderSettings = (toastId?: ProviderUpdateToastId) => {- const activeToast = activeToastRef.current;- if (toastId !== undefined) {- toastManager.close(toastId);- } else if (activeToast?.kind === "prompt") {- toastManager.close(activeToast.toastId);- }- if (- activeToast &&- (toastId === undefined || (activeToast.kind === "prompt" && activeToast.toastId === toastId))- ) {- activeToastRef.current = null;- }- void navigate({ to: "/settings/providers" });- };-- useEffect(() => {- const activeToast = activeToastRef.current;- if (activeToast?.kind !== "update") {- return;- }-- const activeProviders = providers.filter((provider) =>- activeToast.providerInstanceIds.has(provider.instanceId),- );- const view = getProviderUpdateProgressToastView({- providers: activeProviders,- providerCount: activeToast.providerCount,- });- if (!shouldShowPrimaryProviderUpdateToast(view)) {- return;- }-- addProviderUpdateToast({ view, openSettings: openProviderSettings });- activeToastRef.current = null;- }, [providers, openProviderSettings]);-- useEffect(() => {- const activeToast = activeToastRef.current;- if (activeToast?.kind === "prompt" && activeToast.key !== notificationKey) {- toastManager.close(activeToast.toastId);- activeToastRef.current = null;- }-- const updateExistingPrompt =- activeToast?.kind === "prompt" &&- activeToast.key === notificationKey &&- activeToast.canManageProviders !== canManageProviders;- if (- !notificationKey ||- dismissedNotificationKeys.has(notificationKey) ||- (seenProviderUpdateNotificationKeys.has(notificationKey) && !updateExistingPrompt) ||- (activeToastRef.current && !updateExistingPrompt)- ) {- return;- }-- seenProviderUpdateNotificationKeys.add(notificationKey);-- const initialView = getProviderUpdateInitialToastView({ updateProviders, oneClickProviders });-- let toastId!: ProviderUpdateToastId;- let updateStarted = false;- const openSettings = () => openProviderSettings(toastId);- const dismissPrompt = () => {- dismissNotificationKey(notificationKey);- };-- const runUpdates = () => {- if (- updateStarted ||- oneClickProviders.length === 0 ||- !primaryEnvironment ||- !readEnvironmentScope(primaryEnvironment.environmentId, AuthProvidersManageScope)- ) {- return;- }- updateStarted = true;-- const providerCount = oneClickProviders.length;- const providerInstanceIds = new Set(oneClickProviders.map((provider) => provider.instanceId));- const activeUpdate: ActiveProviderUpdateToast = {- kind: "update",- key: notificationKey,- providerInstanceIds,- providerCount,- };- activeToastRef.current = activeUpdate;-- toastManager.close(toastId);-- void (async () => {- const results = [];- for (const provider of oneClickProviders) {- if (!readEnvironmentScope(primaryEnvironment.environmentId, AuthProvidersManageScope)) {- if (activeToastRef.current === activeUpdate) {- addProviderUpdateToast({- view: getProviderUpdateRejectedToastView(- providerCount,- "This connection cannot manage provider accounts.",- ),- openSettings: openProviderSettings,- });- activeToastRef.current = null;- }- return;- }- results.push(- await updateProvider({- environmentId: primaryEnvironment.environmentId,- input: {- provider: provider.driver,- instanceId: provider.instanceId,- },- }),- );- }-- const activeUpdateToast = activeToastRef.current;- if (activeUpdateToast !== activeUpdate) {- return;- }-- const failedMessage = firstFailedProviderUpdateMessage(results);- if (failedMessage) {- addProviderUpdateToast({- view: getProviderUpdateRejectedToastView(providerCount, failedMessage),- openSettings: openProviderSettings,- });- activeToastRef.current = null;- return;- }-- const updatedProviderSnapshots = collectUpdatedProviderSnapshots({- results,- providerInstanceIds,- });- const view = getProviderUpdateProgressToastView({- providers: updatedProviderSnapshots,- providerCount,- });- if (shouldShowPrimaryProviderUpdateToast(view)) {- addProviderUpdateToast({ view, openSettings: openProviderSettings });- activeToastRef.current = null;- }- })();- };-- const toastOptions = stackedThreadToast({- type: initialView.type,- title: initialView.title,- description: canManageProviders- ? initialView.description- : "This connection cannot manage provider accounts. View provider settings for update details.",- timeout: 0,- actionProps:- oneClickProviders.length > 0- ? {- children: "Update",- disabled: !canManageProviders,- onClick: runUpdates,- }- : {- children: "Settings",- onClick: openSettings,- },- actionVariant: "outline",- data: {- leadingIcon:- updateProviders.length === 1 ? (- <ProviderUpdateToastIcon provider={updateProviders[0]!} />- ) : undefined,- hideCopyButton: true,- onClose: dismissPrompt,- ...(oneClickProviders.length > 0- ? {- secondaryActionProps: {- children: "Settings",- onClick: openSettings,- },- secondaryActionVariant: "outline" as const,- }- : {}),- },- });- if (updateExistingPrompt && activeToast?.kind === "prompt") {- toastId = activeToast.toastId;- toastManager.update(toastId, toastOptions);- } else {- toastId = toastManager.add(toastOptions);- }- activeToastRef.current = { kind: "prompt", key: notificationKey, toastId, canManageProviders };- }, [- canManageProviders,- updateProvider,- dismissNotificationKey,- dismissedNotificationKeys,- notificationKey,- oneClickProviders,- openProviderSettings,- primaryEnvironment,- updateProviders,- ]);-- return null;-}diff --git a/apps/web/src/components/ui/toast.tsx b/apps/web/src/components/ui/toast.tsxindex 617d4e5e505..3982b96b1c1 100644--- a/apps/web/src/components/ui/toast.tsx+++ b/apps/web/src/components/ui/toast.tsx@@ -760,7 +760,7 @@ function AnchoredToasts() {);}-export { hiddenToastActionProps, stackedThreadToast } from "./toastHelpers";+export { stackedThreadToast } from "./toastHelpers";export type { StackedThreadToastOptions } from "./toastHelpers";export {diff --git a/apps/web/src/components/ui/toastHelpers.ts b/apps/web/src/components/ui/toastHelpers.tsindex 27a51dcdd24..8917fffeadf 100644--- a/apps/web/src/components/ui/toastHelpers.ts+++ b/apps/web/src/components/ui/toastHelpers.ts@@ -14,14 +14,6 @@ export type StackedThreadToastOptions = {data?: Omit<ThreadToastData, "actionLayout">;};-/**- * Defined `actionProps` that hide a previous toast CTA on `toastManager.update`.- * Passing `actionProps: undefined` is a no-op because updates omit undefined keys.- */-export const hiddenToastActionProps = {- children: null,-} as const satisfies Pick<ComponentPropsWithoutRef<"button">, "children">;-export function stackedThreadToast(options: StackedThreadToastOptions,): ToastManagerAddOptions<ThreadToastData> {diff --git a/apps/web/src/providerUpdateDismissal.ts b/apps/web/src/providerUpdateDismissal.tsdeleted file mode 100644index 0a1617f07a6..00000000000--- a/apps/web/src/providerUpdateDismissal.ts+++ /dev/null@@ -1,36 +0,0 @@-import * as Schema from "effect/Schema";--import { useLocalStorage } from "./hooks/useLocalStorage";--const PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY = "t3code:provider-update-dismissals:v1";--const ProviderUpdateDismissalsSchema = Schema.Struct({- keys: Schema.Array(Schema.String),-});--export function useDismissedProviderUpdateNotificationKeys() {- const [dismissals, setDismissals] = useLocalStorage(- PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY,- { keys: [] },- ProviderUpdateDismissalsSchema,- );- const dismissedKeys = dismissals.keys;-- const dismissedKeySet = new Set(dismissedKeys);-- const dismissNotificationKey = (key: string) => {- const trimmedKey = key.trim();- if (trimmedKey.length === 0 || dismissedKeySet.has(trimmedKey)) {- return;- }-- setDismissals({- keys: [...dismissedKeys, trimmedKey],- });- };-- return {- dismissedNotificationKeys: dismissedKeySet,- dismissNotificationKey,- };-}diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsxindex 31f944ef7fd..3d73c01104a 100644--- a/apps/web/src/routes/__root.tsx+++ b/apps/web/src/routes/__root.tsx@@ -30,7 +30,6 @@ import { SnapShotCoordinator } from "../components/desktop/SnapShotCoordinator";import { DesktopAppActivationCoordinator } from "../components/desktop/DesktopAppActivationCoordinator";import { DesktopWebLinkCoordinator } from "../components/desktop/DesktopWebLinkCoordinator";import { RunningThreadKeepAlive } from "../components/desktop/RunningThreadKeepAlive";-import { ProviderUpdateLaunchNotification } from "../components/ProviderUpdateLaunchNotification";import { DesktopUpdateLaunchNotice } from "../components/sidebar/updateEverythingRun";import { LegacyThreadMigrationToast } from "../components/LegacyThreadMigrationToast";import { ThreadNotificationCoordinator } from "../components/ThreadNotificationCoordinator";@@ -254,7 +253,6 @@ function RootRouteView() {{primaryEnvironmentAuthenticated ? (<EventRouter skipInitialBootstrapNavigation={returningFromWelcome} />) : null}- {primaryEnvironmentAuthenticated ? <ProviderUpdateLaunchNotification /> : null}{isElectron ? <DesktopUpdateLaunchNotice /> : null}{appShell}{/* Above the router: a theme draft is judged by walking the app, so the