Compare commits

...
Author SHA1 Message Date
Julius Marmingeandcodex f446519d78 Fix OpenCode compatibility cap
Co-authored-by: codex <[email protected]>
2026-05-20 13:28:35 +02:00
Julius Marmingeandcodex 8927c26748 Share provider advisory update logic
Co-authored-by: codex <[email protected]>
2026-05-20 13:25:15 +02:00
Julius Marminge 97201a866b Tighten provider compatibility ranges
- Require t3Code 0.0.24+ for bundled drivers
- Pin OpenCode recommendation to 1.14.40 and flag newer harness versions
2026-05-20 11:26:36 +02:00
Julius Marminge 693ee1ac0f Simplify provider compatibility mirroring script
- Decode the source JSON inline before copying
- Switch logging to `Effect.logInfo` and remove unused console import
2026-05-20 11:20:34 +02:00
Julius Marmingeandcodex 89d3b8fb5f Fix Codex browser test update command fixture
Co-authored-by: codex <[email protected]>
2026-05-20 11:11:28 +02:00
12 changed files with 600 additions and 442 deletions

No files matched your search

@@ -203,6 +203,17 @@ describe("provider compatibility", () => {
expect(classify(cursorDriver, "2026.05.08")).toBe("unknown");
});
it("marks OpenCode versions above the recommended compatibility cap as broken", () => {
const classify = (currentVersion: string) =>
ProviderCompatibility.createProviderCompatibilityAdvisory({
driver: opencodeDriver,
currentVersion,
})?.status;
expect(classify("1.14.40")).toBe("supported");
expect(classify("1.14.41")).toBe("broken");
});
it("matches T3 Code nightly versions against their base release policy", () => {
const document: ProviderCompatibility.ProviderCompatibilityDocument = {
version: 1,
+49 -78
View File
@@ -22,10 +22,18 @@ import {
TerminalOpenInput,
} from "@t3tools/contracts";
import {
beginProviderCompatibilityUpdate,
canRunProviderCompatibilityUpdate,
createProviderCompatibilityUpdateTracker,
endProviderCompatibilityUpdate,
getProviderCompatibilityUpdateCommand,
getProviderCompatibilityUpdateRequest,
isProviderCompatibilityUpdateRunning,
parseScopedThreadKey,
scopedThreadKey,
scopeProjectRef,
scopeThreadRef,
stripProviderCompatibilityInstallHint,
} from "@t3tools/client-runtime";
import {
applyClaudePromptEffortPrefix,
@@ -104,14 +112,7 @@ import { BranchToolbar } from "./BranchToolbar";
import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";
import PlanSidebar from "./PlanSidebar";
import ThreadTerminalDrawer from "./ThreadTerminalDrawer";
import {
ChevronDownIcon,
CircleAlertIcon,
DownloadIcon,
LoaderIcon,
TriangleAlertIcon,
WifiOffIcon,
} from "lucide-react";
import { ChevronDownIcon, CircleAlertIcon, TriangleAlertIcon, WifiOffIcon } from "lucide-react";
import { cn, randomUUID } from "~/lib/utils";
import { stackedThreadToast, toastManager } from "./ui/toast";
import { decodeProjectScriptKeybindingRule } from "~/lib/projectScriptKeybindings";
@@ -192,11 +193,7 @@ import { sanitizeThreadErrorMessage } from "~/rpc/transportError";
import { retainThreadDetailSubscription } from "../environments/runtime/service";
import { RightPanelSheet } from "./RightPanelSheet";
import { Button } from "./ui/button";
import { Popover, PopoverPopup, PopoverTrigger } from "./ui/popover";
import {
canRunProviderCompatibilityUpdate,
getProviderCompatibilityUpdateCommand,
} from "./settings/providerStatus";
import { ProviderUpdateActionPopover } from "./ProviderUpdateActionPopover";
import {
buildVersionMismatchDismissalKey,
dismissVersionMismatch,
@@ -212,14 +209,6 @@ const EMPTY_PROVIDERS: ServerProvider[] = [];
const EMPTY_PROVIDER_SKILLS: ServerProvider["skills"] = [];
const EMPTY_PENDING_USER_INPUT_ANSWERS: Record<string, PendingUserInputDraftAnswer> = {};
function stripProviderCompatibilityInstallHint(message: string, recommendedVersion: string | null) {
if (!recommendedVersion) {
return message;
}
const escapedVersion = recommendedVersion.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
return message.replace(new RegExp(`\\s*Use\\s+${escapedVersion}\\.?\\s*$`, "i"), "").trim();
}
function ProviderCompatibilityBannerAction({
providerLabel,
recommendedVersion,
@@ -236,47 +225,23 @@ function ProviderCompatibilityBannerAction({
readonly onRunUpdate: () => void;
}) {
return (
<Popover>
<PopoverTrigger
render={
<Button type="button" size="xs" variant="outline">
Install {recommendedVersion}
</Button>
}
/>
<PopoverPopup side="top" align="end" className="w-84">
<div className="grid gap-3">
<div className="grid gap-0.5">
<p className="text-[13px] font-semibold leading-tight text-foreground">
Install compatible {providerLabel}
</p>
<p className="text-xs leading-snug text-muted-foreground">
Install provider harness version {recommendedVersion}.
</p>
</div>
{canRunUpdate ? (
<Button
type="button"
size="xs"
variant="default"
className="w-full"
disabled={updating}
onClick={onRunUpdate}
>
{updating ? <LoaderIcon className="animate-spin" /> : <DownloadIcon />}
{updating ? "Installing" : "Install now"}
</Button>
) : null}
{updateCommand ? (
<div className="rounded-md border border-border/70 bg-muted/40 px-2 py-1.5">
<code className="block overflow-x-auto whitespace-nowrap font-mono text-[11px] text-foreground [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
{updateCommand}
</code>
</div>
) : null}
</div>
</PopoverPopup>
</Popover>
<ProviderUpdateActionPopover
trigger={
<Button type="button" size="xs" variant="outline">
Install {recommendedVersion}
</Button>
}
title={`Install compatible ${providerLabel}`}
detail={`Install provider harness version ${recommendedVersion}.`}
updateCommand={updateCommand}
canRunUpdate={canRunUpdate}
isUpdating={updating}
runLabel="Install now"
runningLabel="Installing"
onRunUpdate={onRunUpdate}
side="top"
align="end"
/>
);
}
@@ -1230,8 +1195,9 @@ export default function ChatView(props: ChatViewProps) {
const [dismissedVersionMismatchKey, setDismissedVersionMismatchKey] = useState<string | null>(
null,
);
const [compatibilityUpdatingProviderId, setCompatibilityUpdatingProviderId] =
useState<ProviderInstanceId | null>(null);
const [compatibilityUpdateTracker, setCompatibilityUpdateTracker] = useState(() =>
createProviderCompatibilityUpdateTracker(),
);
const versionMismatchDismissed =
versionMismatchDismissKey === dismissedVersionMismatchKey ||
isVersionMismatchDismissed(versionMismatchDismissKey);
@@ -1287,18 +1253,23 @@ export default function ChatView(props: ChatViewProps) {
}, [activeProviderInstanceId, providerStatuses, selectedProvider]);
const runActiveProviderCompatibilityUpdate = useCallback(async () => {
const provider = activeProviderStatus;
const targetVersion = provider?.compatibilityAdvisory?.recommendedVersion ?? null;
if (!provider || !targetVersion) {
const request = getProviderCompatibilityUpdateRequest(provider);
if (!provider || !request) {
return;
}
let started = false;
setCompatibilityUpdateTracker((previous) => {
const result = beginProviderCompatibilityUpdate(previous, provider);
started = result.started;
return result.tracker;
});
if (!started) {
return;
}
setCompatibilityUpdatingProviderId(provider.instanceId);
try {
await ensureLocalApi().server.updateProvider({
provider: provider.driver,
instanceId: provider.instanceId,
targetVersion,
});
await ensureLocalApi().server.updateProvider(request);
} catch (error) {
toastManager.add(
stackedThreadToast({
@@ -1311,9 +1282,7 @@ export default function ChatView(props: ChatViewProps) {
}),
);
} finally {
setCompatibilityUpdatingProviderId((current) =>
current === provider.instanceId ? null : current,
);
setCompatibilityUpdateTracker((current) => endProviderCompatibilityUpdate(current, provider));
}
}, [activeProviderStatus]);
const composerBannerItems = useMemo<ComposerBannerStackItem[]>(() => {
@@ -1332,8 +1301,10 @@ export default function ChatView(props: ChatViewProps) {
const compatibilityUpdateCommand =
getProviderCompatibilityUpdateCommand(activeProviderStatus);
const canRunCompatibilityUpdate = canRunProviderCompatibilityUpdate(activeProviderStatus);
const compatibilityUpdating =
compatibilityUpdatingProviderId === activeProviderStatus.instanceId;
const compatibilityUpdating = isProviderCompatibilityUpdateRunning(
compatibilityUpdateTracker,
activeProviderStatus,
);
const hasCompatibilityInstallAction =
activeProviderStatus.compatibilityAdvisory?.status !== "supported" &&
recommendedVersion !== null &&
@@ -1435,7 +1406,7 @@ export default function ChatView(props: ChatViewProps) {
}, [
activeEnvironmentUnavailableState,
activeProviderStatus,
compatibilityUpdatingProviderId,
compatibilityUpdateTracker,
handleReconnectActiveEnvironment,
navigate,
reconnectingEnvironmentId,
@@ -0,0 +1,110 @@
import type { ReactElement, ReactNode } from "react";
import { CopyIcon, DownloadIcon, LoaderIcon } from "lucide-react";
import { Button } from "./ui/button";
import { Popover, PopoverPopup, PopoverTrigger } from "./ui/popover";
import { ScrollArea } from "./ui/scroll-area";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
interface ProviderUpdateActionPopoverProps {
readonly trigger: ReactElement;
readonly title: ReactNode;
readonly detail: ReactNode;
readonly updateCommand: string | null;
readonly canRunUpdate?: boolean;
readonly isUpdating?: boolean;
readonly runLabel?: string;
readonly runningLabel?: string;
readonly manualDividerLabel?: string;
readonly copyLabel?: string;
readonly onRunUpdate?: (() => void) | undefined;
readonly onCopyCommand?: ((command: string) => void) | undefined;
readonly side?: "top" | "right" | "bottom" | "left";
readonly align?: "start" | "center" | "end";
}
export function ProviderUpdateActionPopover({
trigger,
title,
detail,
updateCommand,
canRunUpdate = false,
isUpdating = false,
runLabel = "Update now",
runningLabel = "Updating",
manualDividerLabel = "or, update manually using",
copyLabel = "Copy update command",
onRunUpdate,
onCopyCommand,
side = "bottom",
align = "start",
}: ProviderUpdateActionPopoverProps) {
const showRunButton = canRunUpdate && onRunUpdate !== undefined;
const showManualDivider = showRunButton && updateCommand !== null;
return (
<Popover>
<PopoverTrigger render={trigger} />
<PopoverPopup
side={side}
align={align}
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">{title}</p>
<p className="text-xs leading-snug text-muted-foreground">{detail}</p>
</div>
{showRunButton ? (
<Button
type="button"
size="xs"
variant="default"
className="w-full"
disabled={isUpdating}
onClick={onRunUpdate}
>
{isUpdating ? <LoaderIcon className="animate-spin" /> : <DownloadIcon />}
{isUpdating ? runningLabel : runLabel}
</Button>
) : null}
{showManualDivider ? (
<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" />
{manualDividerLabel}
<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>
{onCopyCommand ? (
<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={() => onCopyCommand(updateCommand)}
aria-label={copyLabel}
>
<CopyIcon className="size-3" />
</Button>
}
/>
<TooltipPopup side="top">Copy command</TooltipPopup>
</Tooltip>
) : null}
</div>
) : null}
</div>
</PopoverPopup>
</Popover>
);
}
@@ -4,9 +4,6 @@ import {
AlertTriangleIcon,
ArrowUpCircleIcon,
ChevronDownIcon,
CopyIcon,
DownloadIcon,
LoaderIcon,
PlusIcon,
Trash2Icon,
XIcon,
@@ -29,11 +26,10 @@ import { Badge } from "../ui/badge";
import { Button } from "../ui/button";
import { Collapsible, CollapsibleContent } from "../ui/collapsible";
import { DraftInput } from "../ui/draft-input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
import { ScrollArea } from "../ui/scroll-area";
import { Switch } from "../ui/switch";
import { stackedThreadToast, toastManager } from "../ui/toast";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
import { ProviderUpdateActionPopover } from "../ProviderUpdateActionPopover";
import type { DriverOption } from "./providerDriverMeta";
import { ProviderSettingsForm } from "./ProviderSettingsForm";
import { ProviderModelsSection } from "./ProviderModelsSection";
@@ -696,204 +692,89 @@ export function ProviderInstanceCard({
{versionCodeNode}
{compatibilityAdvisory ? (
<span className={ADVISORY_ICON_SLOT_CLASS}>
<Popover>
<PopoverTrigger
render={
<Button
type="button"
size="icon-xs"
variant="ghost"
className={cn(
"size-5 rounded-sm p-0",
compatibilityAdvisory.emphasis === "strong"
? "text-destructive hover:text-destructive"
: "text-warning hover:text-warning",
)}
aria-label={`${compatibilityAdvisory.title} — view details`}
>
<AlertTriangleIcon 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">
{compatibilityAdvisory.title}
</p>
<p
className={cn(
"text-xs leading-snug",
compatibilityAdvisory.emphasis === "strong"
? "text-destructive"
: "text-warning",
)}
>
{compatibilityAdvisory.detail}
</p>
</div>
{onRunCompatibilityUpdate ? (
<Button
type="button"
size="xs"
variant="default"
className="w-full"
disabled={isCompatibilityUpdating}
onClick={onRunCompatibilityUpdate}
>
{isCompatibilityUpdating ? (
<LoaderIcon className="animate-spin" />
) : (
<DownloadIcon />
)}
{isCompatibilityUpdating ? "Updating" : "Update now"}
</Button>
) : null}
{onRunCompatibilityUpdate && compatibilityUpdateCommand ? (
<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}
{compatibilityUpdateCommand ? (
<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">
{compatibilityUpdateCommand}
</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(compatibilityUpdateCommand, {
providerName: displayName,
})
}
aria-label="Copy compatibility update command"
>
<CopyIcon className="size-3" />
</Button>
}
/>
<TooltipPopup side="top">Copy command</TooltipPopup>
</Tooltip>
</div>
) : null}
</div>
</PopoverPopup>
</Popover>
<ProviderUpdateActionPopover
trigger={
<Button
type="button"
size="icon-xs"
variant="ghost"
className={cn(
"size-5 rounded-sm p-0",
compatibilityAdvisory.emphasis === "strong"
? "text-destructive hover:text-destructive"
: "text-warning hover:text-warning",
)}
aria-label={`${compatibilityAdvisory.title} — view details`}
>
<AlertTriangleIcon className="size-3.5" />
</Button>
}
title={compatibilityAdvisory.title}
detail={
<span
className={
compatibilityAdvisory.emphasis === "strong"
? "text-destructive"
: "text-warning"
}
>
{compatibilityAdvisory.detail}
</span>
}
updateCommand={compatibilityUpdateCommand}
canRunUpdate={onRunCompatibilityUpdate !== undefined}
isUpdating={isCompatibilityUpdating}
onRunUpdate={onRunCompatibilityUpdate}
copyLabel="Copy compatibility update command"
onCopyCommand={(command) =>
copyToClipboard(command, {
providerName: displayName,
})
}
/>
</span>
) : null}
{versionAdvisory ? (
<span className={ADVISORY_ICON_SLOT_CLASS}>
<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-primary hover:text-primary",
)}
aria-label="Update available — view details"
>
<ArrowUpCircleIcon className="size-3.5 [animation:bounce_2.4s_ease-in-out_infinite] motion-reduce:animate-none" />
</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
className={cn(
"text-xs leading-snug",
versionAdvisory.emphasis === "strong"
? "text-warning"
: "text-muted-foreground",
)}
>
{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"}
</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>
<ProviderUpdateActionPopover
trigger={
<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-primary hover:text-primary",
)}
aria-label="Update available — view details"
>
<ArrowUpCircleIcon className="size-3.5 [animation:bounce_2.4s_ease-in-out_infinite] motion-reduce:animate-none" />
</Button>
}
title="Update available"
detail={
<span
className={
versionAdvisory.emphasis === "strong"
? "text-warning"
: "text-muted-foreground"
}
>
{versionAdvisory.detail}
</span>
}
updateCommand={updateCommand}
canRunUpdate={onRunUpdate !== undefined}
isUpdating={isUpdating}
onRunUpdate={onRunUpdate}
onCopyCommand={(command) =>
copyToClipboard(command, {
providerName: displayName,
})
}
/>
</span>
) : null}
</span>
@@ -239,7 +239,7 @@ function createBaseServerConfig(): ServerConfig {
function createOutdatedProvider(
driver: string,
updateCommand = "npm install -g openai/codex@latest",
updateCommand = "npm install -g @openai/codex@latest",
): ServerProvider {
return {
instanceId: ProviderInstanceId.make(driver),
@@ -1204,6 +1204,7 @@ describe("GeneralSettingsPanel observability", () => {
"This provider harness version 0.128.0 is known to be incompatible with this T3 Code release. Use 0.129.0.",
recommendedRange: ">=0.129.0",
recommendedVersion: "0.129.0",
canUpdate: true,
ranges: [{ status: "broken", range: "<0.129.0" }],
},
};
@@ -12,7 +12,14 @@ import {
type ScopedThreadRef,
type ServerProvider,
} from "@t3tools/contracts";
import { scopeThreadRef } from "@t3tools/client-runtime";
import {
beginProviderCompatibilityUpdate,
createProviderCompatibilityUpdateTracker,
endProviderCompatibilityUpdate,
getProviderCompatibilityUpdateRequest,
isProviderCompatibilityUpdateRunning,
scopeThreadRef,
} from "@t3tools/client-runtime";
import { DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts/settings";
import { createModelSelection } from "@t3tools/shared/model";
import * as Duration from "effect/Duration";
@@ -928,6 +935,9 @@ export function ProviderSettingsPanel() {
const [updatingProviderDrivers, setUpdatingProviderDrivers] = useState<
ReadonlySet<ProviderDriverKind>
>(() => new Set());
const [compatibilityUpdateTracker, setCompatibilityUpdateTracker] = useState(() =>
createProviderCompatibilityUpdateTracker(),
);
const [openInstanceDetails, setOpenInstanceDetails] = useState<Record<string, boolean>>({});
const refreshingRef = useRef(false);
@@ -1016,31 +1026,23 @@ export function ProviderSettingsPanel() {
}, []);
const runProviderCompatibilityUpdate = useCallback(async (provider: ServerProvider) => {
const targetVersion = provider.compatibilityAdvisory?.recommendedVersion ?? null;
if (!targetVersion) {
const request = getProviderCompatibilityUpdateRequest(provider);
if (!request) {
return;
}
let started = false;
setUpdatingProviderDrivers((previous) => {
if (previous.has(provider.driver)) {
return previous;
}
started = true;
const next = new Set(previous);
next.add(provider.driver);
return next;
setCompatibilityUpdateTracker((previous) => {
const result = beginProviderCompatibilityUpdate(previous, provider);
started = result.started;
return result.tracker;
});
if (!started) {
return;
}
try {
await ensureLocalApi().server.updateProvider({
provider: provider.driver,
instanceId: provider.instanceId,
targetVersion,
});
await ensureLocalApi().server.updateProvider(request);
} catch (error) {
toastManager.add(
stackedThreadToast({
@@ -1053,14 +1055,9 @@ export function ProviderSettingsPanel() {
}),
);
} finally {
setUpdatingProviderDrivers((previous) => {
if (!previous.has(provider.driver)) {
return previous;
}
const next = new Set(previous);
next.delete(provider.driver);
return next;
});
setCompatibilityUpdateTracker((previous) =>
endProviderCompatibilityUpdate(previous, provider),
);
}
}, []);
@@ -1306,15 +1303,12 @@ export function ProviderSettingsPanel() {
Boolean(liveProvider?.compatibilityAdvisory?.recommendedVersion);
const isCompatibilityUpdateRunning =
liveProvider !== undefined &&
(updatingProviderDrivers.has(liveProvider.driver) ||
serverProviders.some(
(provider) =>
provider.driver === liveProvider.driver && isProviderUpdateActive(provider),
));
(isProviderCompatibilityUpdateRunning(compatibilityUpdateTracker, liveProvider) ||
isProviderUpdateActive(liveProvider));
const canRunInlineCompatibilityUpdate =
showInlineCompatibilityUpdateButton &&
liveProvider !== undefined &&
!updatingProviderDrivers.has(liveProvider.driver);
!isCompatibilityUpdateRunning;
const modelPreferences = settings.providerModelPreferences?.[row.instanceId] ?? {
hiddenModels: [],
modelOrder: [],
@@ -1,8 +1,14 @@
import type {
ServerProvider,
ServerProviderCompatibilityAdvisory,
ServerProviderVersionAdvisory,
} from "@t3tools/contracts";
import type { ServerProvider } from "@t3tools/contracts";
export {
canRunProviderCompatibilityUpdate,
getProviderCompatibilityAdvisoryPresentation,
getProviderCompatibilityUpdateCommand,
getProviderCompatibilityUpdateRequest,
getProviderVersionAdvisoryPresentation,
getProviderVersionLabel,
stripProviderCompatibilityInstallHint,
} from "@t3tools/client-runtime";
/**
* Visual treatment for each server-reported provider status. Centralized so
@@ -83,121 +89,3 @@ export function getProviderSummary(provider: ServerProvider | undefined) {
detail: provider.message ?? "Installed and ready, but authentication could not be verified.",
};
}
/**
* Normalize a version string for display. Adds the `v` prefix when the
* driver reported a bare version (e.g. `1.2.3`) so cards render
* consistently regardless of driver.
*/
export function getProviderVersionLabel(version: string | null | undefined) {
if (!version) return null;
return version.startsWith("v") ? version : `v${version}`;
}
export function getProviderVersionAdvisoryPresentation(
advisory: ServerProviderVersionAdvisory | undefined,
): {
readonly detail: string;
readonly updateCommand: string | null;
readonly emphasis: "normal" | "strong";
} | null {
if (!advisory || advisory.status === "current" || advisory.status === "unknown") {
return null;
}
const label = "Update available";
const version = advisory.latestVersion;
const versionLabel = getProviderVersionLabel(version);
return {
detail:
advisory.message ??
(versionLabel
? `${label}: install ${versionLabel}.`
: `${label}: install the latest provider version.`),
updateCommand: advisory.updateCommand,
emphasis: "normal" as const,
};
}
function makeTargetedUpdateCommand(input: {
readonly updateCommand: string | null | undefined;
readonly recommendedVersion: string | null | undefined;
}): string | null {
if (!input.updateCommand || !input.recommendedVersion) {
return null;
}
if (!input.updateCommand.includes("@latest")) {
const packageNameMatch = input.updateCommand.match(
/(?:^|\s)(@[^\s]+\/[^\s@]+|[^\s@]+)(?=\s*$)/,
);
if (!packageNameMatch?.[1]) {
return null;
}
return input.updateCommand.replace(
packageNameMatch[1],
`${packageNameMatch[1]}@${input.recommendedVersion}`,
);
}
return input.updateCommand.replace("@latest", `@${input.recommendedVersion}`);
}
export function getProviderCompatibilityUpdateCommand(
provider: Pick<ServerProvider, "compatibilityAdvisory" | "versionAdvisory"> | null | undefined,
): string | null {
const compatibilityAdvisory = provider?.compatibilityAdvisory;
if (!compatibilityAdvisory || compatibilityAdvisory.status === "supported") {
return null;
}
return (
compatibilityAdvisory.updateCommand ??
makeTargetedUpdateCommand({
updateCommand: provider.versionAdvisory?.updateCommand,
recommendedVersion: compatibilityAdvisory.recommendedVersion,
})
);
}
export function canRunProviderCompatibilityUpdate(
provider: Pick<ServerProvider, "compatibilityAdvisory" | "versionAdvisory"> | null | undefined,
): boolean {
const compatibilityAdvisory = provider?.compatibilityAdvisory;
if (!compatibilityAdvisory || compatibilityAdvisory.status === "supported") {
return false;
}
return (
compatibilityAdvisory.canUpdate === true ||
(provider?.versionAdvisory?.canUpdate === true &&
getProviderCompatibilityUpdateCommand(provider) !== null)
);
}
export function getProviderCompatibilityAdvisoryPresentation(
advisory: ServerProviderCompatibilityAdvisory | undefined,
): {
readonly title: string;
readonly detail: string;
readonly updateCommand: string | null;
readonly canUpdate: boolean;
readonly emphasis: "normal" | "strong";
} | null {
if (!advisory || advisory.status === "supported") {
return null;
}
const recommendedTarget = advisory.recommendedVersion ?? advisory.recommendedRange;
const recommended = recommendedTarget ? ` Recommended: ${recommendedTarget}.` : "";
const fallback =
advisory.status === "unknown"
? `Compatibility unknown.${recommended}`
: `This provider harness is outside the supported range.${recommended}`;
return {
title:
advisory.status === "broken" ? "Incompatible provider version" : "Provider version warning",
detail: advisory.message ?? fallback,
updateCommand: advisory.updateCommand ?? null,
canUpdate: advisory.canUpdate === true,
emphasis: advisory.severity === "error" ? "strong" : "normal",
};
}
+1
View File
@@ -1,4 +1,5 @@
export * from "./advertisedEndpoint.ts";
export * from "./knownEnvironment.ts";
export * from "./providerAdvisory.ts";
export * from "./scoped.ts";
export * from "./sourceControlDiscoveryState.ts";
@@ -0,0 +1,92 @@
import { ProviderDriverKind, ProviderInstanceId, type ServerProvider } from "@t3tools/contracts";
import { describe, expect, it } from "vitest";
import {
beginProviderCompatibilityUpdate,
canRunProviderCompatibilityUpdate,
createProviderCompatibilityUpdateTracker,
endProviderCompatibilityUpdate,
getProviderCompatibilityUpdateCommand,
getProviderCompatibilityUpdateRequest,
isProviderCompatibilityUpdateRunning,
} from "./providerAdvisory.ts";
const codexProvider = {
driver: ProviderDriverKind.make("codex"),
instanceId: ProviderInstanceId.make("codex"),
compatibilityAdvisory: {
status: "broken",
severity: "error",
currentVersion: "0.128.0",
message: "Known incompatible.",
recommendedRange: ">=0.129.0",
recommendedVersion: "0.129.0",
canUpdate: true,
updateCommand: "npm install -g @openai/[email protected]",
ranges: [],
},
versionAdvisory: {
status: "behind_latest",
currentVersion: "0.128.0",
latestVersion: "0.130.0",
checkedAt: "2026-05-13T00:00:00.000Z",
message: "Update available.",
updateCommand: "vp i -g @openai/codex",
canUpdate: true,
},
} satisfies Pick<
ServerProvider,
"driver" | "instanceId" | "compatibilityAdvisory" | "versionAdvisory"
>;
describe("provider advisory runtime", () => {
it("derives manual targeted compatibility update commands from package install commands", () => {
expect(
getProviderCompatibilityUpdateCommand({
...codexProvider,
compatibilityAdvisory: {
...codexProvider.compatibilityAdvisory,
updateCommand: null,
},
}),
).toBe("vp i -g @openai/[email protected]");
});
it("uses server capability, not manual command derivation, for one-click compatibility updates", () => {
const provider = {
...codexProvider,
compatibilityAdvisory: {
...codexProvider.compatibilityAdvisory,
canUpdate: false,
updateCommand: null,
},
};
expect(getProviderCompatibilityUpdateCommand(provider)).toBe("vp i -g @openai/[email protected]");
expect(canRunProviderCompatibilityUpdate(provider)).toBe(false);
expect(getProviderCompatibilityUpdateRequest(provider)).toBeNull();
});
it("builds targeted update requests when the server reports a runnable compatibility update", () => {
expect(getProviderCompatibilityUpdateRequest(codexProvider)).toEqual({
provider: ProviderDriverKind.make("codex"),
instanceId: ProviderInstanceId.make("codex"),
targetVersion: "0.129.0",
});
});
it("tracks compatibility update state by provider instance", () => {
const tracker = createProviderCompatibilityUpdateTracker();
const started = beginProviderCompatibilityUpdate(tracker, codexProvider);
expect(started.started).toBe(true);
expect(isProviderCompatibilityUpdateRunning(started.tracker, codexProvider)).toBe(true);
expect(beginProviderCompatibilityUpdate(started.tracker, codexProvider).started).toBe(false);
expect(
isProviderCompatibilityUpdateRunning(
endProviderCompatibilityUpdate(started.tracker, codexProvider),
codexProvider,
),
).toBe(false);
});
});
@@ -0,0 +1,205 @@
import type {
ProviderDriverKind,
ProviderInstanceId,
ServerProvider,
ServerProviderCompatibilityAdvisory,
ServerProviderVersionAdvisory,
} from "@t3tools/contracts";
export interface ProviderVersionAdvisoryPresentation {
readonly detail: string;
readonly updateCommand: string | null;
readonly emphasis: "normal" | "strong";
}
export interface ProviderCompatibilityAdvisoryPresentation {
readonly title: string;
readonly detail: string;
readonly updateCommand: string | null;
readonly canUpdate: boolean;
readonly emphasis: "normal" | "strong";
}
export interface ProviderCompatibilityUpdateRequest {
readonly provider: ProviderDriverKind;
readonly instanceId: ProviderInstanceId;
readonly targetVersion: string;
}
export interface ProviderCompatibilityUpdateTracker {
readonly updatingInstanceIds: ReadonlySet<ProviderInstanceId>;
}
/**
* Normalize a version string for display. Adds the `v` prefix when the driver
* reported a bare version (e.g. `1.2.3`) so clients render consistently.
*/
export function getProviderVersionLabel(version: string | null | undefined) {
if (!version) return null;
return version.startsWith("v") ? version : `v${version}`;
}
export function getProviderVersionAdvisoryPresentation(
advisory: ServerProviderVersionAdvisory | undefined,
): ProviderVersionAdvisoryPresentation | null {
if (!advisory || advisory.status === "current" || advisory.status === "unknown") {
return null;
}
const label = "Update available";
const version = advisory.latestVersion;
const versionLabel = getProviderVersionLabel(version);
return {
detail:
advisory.message ??
(versionLabel
? `${label}: install ${versionLabel}.`
: `${label}: install the latest provider version.`),
updateCommand: advisory.updateCommand,
emphasis: "normal",
};
}
function makeTargetedUpdateCommand(input: {
readonly updateCommand: string | null | undefined;
readonly recommendedVersion: string | null | undefined;
}): string | null {
if (!input.updateCommand || !input.recommendedVersion) {
return null;
}
if (!input.updateCommand.includes("@latest")) {
const packageNameMatch = input.updateCommand.match(
/(?:^|\s)(@[^\s]+\/[^\s@]+|[^\s@]+)(?=\s*$)/,
);
if (!packageNameMatch?.[1]) {
return null;
}
return input.updateCommand.replace(
packageNameMatch[1],
`${packageNameMatch[1]}@${input.recommendedVersion}`,
);
}
return input.updateCommand.replace("@latest", `@${input.recommendedVersion}`);
}
export function getProviderCompatibilityUpdateCommand(
provider: Pick<ServerProvider, "compatibilityAdvisory" | "versionAdvisory"> | null | undefined,
): string | null {
const compatibilityAdvisory = provider?.compatibilityAdvisory;
if (!compatibilityAdvisory || compatibilityAdvisory.status === "supported") {
return null;
}
return (
compatibilityAdvisory.updateCommand ??
makeTargetedUpdateCommand({
updateCommand: provider.versionAdvisory?.updateCommand,
recommendedVersion: compatibilityAdvisory.recommendedVersion,
})
);
}
export function canRunProviderCompatibilityUpdate(
provider: Pick<ServerProvider, "compatibilityAdvisory"> | null | undefined,
): boolean {
const compatibilityAdvisory = provider?.compatibilityAdvisory;
return Boolean(
compatibilityAdvisory &&
compatibilityAdvisory.status !== "supported" &&
compatibilityAdvisory.canUpdate === true &&
compatibilityAdvisory.recommendedVersion,
);
}
export function getProviderCompatibilityUpdateRequest(
provider:
| Pick<ServerProvider, "driver" | "instanceId" | "compatibilityAdvisory">
| null
| undefined,
): ProviderCompatibilityUpdateRequest | null {
const targetVersion = provider?.compatibilityAdvisory?.recommendedVersion ?? null;
if (!provider || !targetVersion || !canRunProviderCompatibilityUpdate(provider)) {
return null;
}
return {
provider: provider.driver,
instanceId: provider.instanceId,
targetVersion,
};
}
export function getProviderCompatibilityAdvisoryPresentation(
advisory: ServerProviderCompatibilityAdvisory | undefined,
): ProviderCompatibilityAdvisoryPresentation | null {
if (!advisory || advisory.status === "supported") {
return null;
}
const recommendedTarget = advisory.recommendedVersion ?? advisory.recommendedRange;
const recommended = recommendedTarget ? ` Recommended: ${recommendedTarget}.` : "";
const fallback =
advisory.status === "unknown"
? `Compatibility unknown.${recommended}`
: `This provider harness is outside the supported range.${recommended}`;
return {
title:
advisory.status === "broken" ? "Incompatible provider version" : "Provider version warning",
detail: advisory.message ?? fallback,
updateCommand: advisory.updateCommand ?? null,
canUpdate: advisory.canUpdate === true,
emphasis: advisory.severity === "error" ? "strong" : "normal",
};
}
export function stripProviderCompatibilityInstallHint(
message: string,
recommendedVersion: string | null,
) {
if (!recommendedVersion) {
return message;
}
const escapedVersion = recommendedVersion.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
return message.replace(new RegExp(`\\s*Use\\s+${escapedVersion}\\.?\\s*$`, "i"), "").trim();
}
export function createProviderCompatibilityUpdateTracker(
updatingInstanceIds: Iterable<ProviderInstanceId> = [],
): ProviderCompatibilityUpdateTracker {
return { updatingInstanceIds: new Set(updatingInstanceIds) };
}
export function isProviderCompatibilityUpdateRunning(
tracker: ProviderCompatibilityUpdateTracker,
provider: Pick<ServerProvider, "instanceId"> | null | undefined,
): boolean {
return Boolean(provider && tracker.updatingInstanceIds.has(provider.instanceId));
}
export function beginProviderCompatibilityUpdate(
tracker: ProviderCompatibilityUpdateTracker,
provider: Pick<ServerProvider, "instanceId">,
): { readonly tracker: ProviderCompatibilityUpdateTracker; readonly started: boolean } {
if (tracker.updatingInstanceIds.has(provider.instanceId)) {
return { tracker, started: false };
}
return {
tracker: createProviderCompatibilityUpdateTracker([
...tracker.updatingInstanceIds,
provider.instanceId,
]),
started: true,
};
}
export function endProviderCompatibilityUpdate(
tracker: ProviderCompatibilityUpdateTracker,
provider: Pick<ServerProvider, "instanceId">,
): ProviderCompatibilityUpdateTracker {
if (!tracker.updatingInstanceIds.has(provider.instanceId)) {
return tracker;
}
const next = new Set(tracker.updatingInstanceIds);
next.delete(provider.instanceId);
return createProviderCompatibilityUpdateTracker(next);
}
+12 -7
View File
@@ -2,7 +2,7 @@
"version": 1,
"policies": [
{
"t3CodeRange": ">=0.0.0",
"t3CodeRange": ">=0.0.24",
"driver": "codex",
"recommendedRange": ">=0.129.0",
"recommendedVersion": "0.129.0",
@@ -20,7 +20,7 @@
]
},
{
"t3CodeRange": ">=0.0.0",
"t3CodeRange": ">=0.0.24",
"driver": "claudeAgent",
"recommendedRange": ">=0.2.111",
"recommendedVersion": "0.2.111",
@@ -33,14 +33,19 @@
]
},
{
"t3CodeRange": ">=0.0.0",
"t3CodeRange": ">=0.0.24",
"driver": "opencode",
"recommendedRange": ">=1.14.19",
"recommendedVersion": "1.14.19",
"recommendedRange": ">=1.14.19 <1.14.41",
"recommendedVersion": "1.14.40",
"ranges": [
{
"status": "broken",
"range": ">1.14.40",
"label": "Known incompatible OpenCode harness"
},
{
"status": "supported",
"range": ">=1.14.19",
"range": ">=1.14.19 <=1.14.40",
"label": "Known working OpenCode harness"
},
{
@@ -51,7 +56,7 @@
]
},
{
"t3CodeRange": ">=0.0.0",
"t3CodeRange": ">=0.0.24",
"driver": "cursor",
"recommendedRange": ">=2026.05.09",
"recommendedVersion": "2026.05.09",
+3 -4
View File
@@ -2,7 +2,6 @@
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
import * as NodeServices from "@effect/platform-node/NodeServices";
import * as Console from "effect/Console";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
@@ -13,6 +12,7 @@ const decodeJson = Schema.decodeEffect(Schema.UnknownFromJsonString);
const program = Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const repoRoot = path.resolve(import.meta.dirname, "..");
const sourcePath = path.join(repoRoot, "provider-compatibility.v1.json");
const destinationPath = path.join(
@@ -23,13 +23,12 @@ const program = Effect.gen(function* () {
"provider-compatibility.v1.json",
);
const source = yield* fs.readFileString(sourcePath);
yield* decodeJson(source);
yield* Effect.flatMap(fs.readFileString(sourcePath), decodeJson);
yield* fs.makeDirectory(path.dirname(destinationPath), { recursive: true });
yield* fs.copyFile(sourcePath, destinationPath);
yield* Console.log(
yield* Effect.logInfo(
`Mirrored ${path.relative(repoRoot, sourcePath)} to ${path.relative(repoRoot, destinationPath)}.`,
);
});