Compare commits

...
Author SHA1 Message Date
Ben DavisandClaude Fable 5 67aedfcc2b style(mobile): fix formatting in new/_layout.tsx
Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-02 04:11:16 -07:00
Ben DavisandClaude Fable 5 d327c77e10 refactor(mobile): share push animation, cover missed transparent headers
Review follow-ups:
- Extract the iOS push-animation choice into lib/pushScreenAnimation and
  use it in every stack that pushed with slide_from_right (root, thread,
  git, settings, connections, new) so the black-void workaround cannot
  drift between files.
- Apply useHeaderBlurEffect to the two transparent headers the first
  pass missed: the review sheet and the files tree screen.
- Drop String() around ColorValue contentStyle backgrounds; an
  unresolved CSS variable would otherwise stringify to the invalid
  color "undefined" instead of a harmless no-op.
- Document why the terminal screen intentionally omits
  fullScreenGestureEnabled.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-02 04:04:58 -07:00
Ben DavisandClaude Fable 5 e03abb3a61 fix(mobile): dark header blur and remove black void on swipe-back
The trait-adaptive systemChromeMaterial blur resolves to its light
variant on the new iOS beta even while the app renders dark, washing
the header out white. Pick systemChromeMaterialLight/Dark explicitly
from the app color scheme via a shared useHeaderBlurEffect hook.

The black void revealed behind the outgoing screen during swipe-back
came from the custom slide_from_right animator combined with
transparent screen content. Keep the native default push animation on
iOS (identical look, proper parallax with the previous screen visible
underneath) and give stack screens an opaque themed background.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-02 03:51:20 -07:00
Ben DavisandClaude Fable 5 bfbc14ce3c fix(mobile): restore header blur and reliable swipe-back on iOS beta
Recent iOS betas stopped drawing the implicit blur behind transparent
navigation bars, leaving white header text over raw scrolling content.
Set headerBlurEffect: systemChromeMaterial explicitly on the three
transparent headers (home, thread detail, thread index layout).

Swipe-back was also unreliable on thread detail: the drawer-open pan
gesture's hit slop covered the entire left edge, stealing touches from
the native interactive-pop gesture below the header. Confine that pan
to the top strip where it can actually complete, and enable
fullScreenGestureEnabled on the thread, review, and files screens so
back-swipe works from anywhere on the screen.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-02 03:50:19 -07:00
Julius Marminge 7b9eef7ac2 Restore the ultrathink frame border effect (#3625) 2026-07-01 00:25:36 +00:00
Julius Marminge 9d66b104fe Add Claude Sonnet 5 as the default Claude model (#3620) 2026-06-30 11:40:35 -07:00
Utkarsh Patil 51ea084c87 fix: warm WSL before preflight in WSL-only backend mode (#3588) 2026-06-30 11:27:34 -07:00
Hugo BlomandJulius Marminge 0615fd7df1 Add middle-click close for right panel tabs (#3161)
Co-authored-by: Julius Marminge <[email protected]>
2026-06-30 17:13:38 +00:00
20 changed files with 172 additions and 114 deletions

No files matched your search

@@ -607,6 +607,7 @@ export const make = Effect.gen(function* () {
const backendExposure = yield* serverExposure.backendConfig;
const persistedSettings = yield* settings.get;
const shared = yield* sharedInputs;
yield* wslEnvironment.preWarm(persistedSettings.wslDistro);
return yield* resolveWslStartConfig({
...shared,
port: backendExposure.port,
+9 -3
View File
@@ -26,6 +26,8 @@ import {
useClerkSettingsSheetDetent,
} from "../features/cloud/ClerkSettingsSheetDetent";
import { useAgentNotificationNavigation } from "../features/agent-awareness/notificationNavigation";
import { pushScreenAnimation } from "../lib/pushScreenAnimation";
import { useHeaderBlurEffect } from "../lib/useHeaderBlurEffect";
import { useThemeColor } from "../lib/useThemeColor";
function AppNavigator() {
@@ -45,7 +47,9 @@ function AppNavigatorContent() {
const { collapse, isExpanded } = useClerkSettingsSheetDetent();
const colorScheme = useColorScheme();
const statusBarBg = useThemeColor("--color-status-bar");
const screenColor = useThemeColor("--color-screen");
const sheetStyle = useResolveClassNames("bg-sheet");
const headerBlurEffect = useHeaderBlurEffect();
useAgentNotificationNavigation();
useThreadOutboxDrain();
@@ -96,9 +100,10 @@ function AppNavigatorContent() {
<Stack.Screen
name="index"
options={{
contentStyle: { backgroundColor: "transparent" },
contentStyle: { backgroundColor: screenColor },
headerShown: true,
headerTransparent: true,
headerBlurEffect,
headerShadowVisible: false,
}}
/>
@@ -112,9 +117,10 @@ function AppNavigatorContent() {
<Stack.Screen
name="threads/[environmentId]/[threadId]"
options={{
animation: "slide_from_right",
contentStyle: { backgroundColor: "transparent" },
animation: pushScreenAnimation,
contentStyle: { backgroundColor: screenColor },
gestureEnabled: true,
fullScreenGestureEnabled: true,
headerShown: false,
}}
/>
+2 -1
View File
@@ -1,5 +1,6 @@
import Stack from "expo-router/stack";
import { useResolveClassNames } from "uniwind";
import { pushScreenAnimation } from "../../lib/pushScreenAnimation";
import { useThemeColor } from "../../lib/useThemeColor";
export const unstable_settings = {
@@ -23,7 +24,7 @@ export default function ConnectionsLayout() {
}}
>
<Stack.Screen name="index" options={{ animation: "none" }} />
<Stack.Screen name="new" options={{ animation: "slide_from_right" }} />
<Stack.Screen name="new" options={{ animation: pushScreenAnimation }} />
</Stack>
);
}
+9 -5
View File
@@ -2,6 +2,7 @@ import Stack from "expo-router/stack";
import { useResolveClassNames } from "uniwind";
import { NewTaskFlowProvider } from "../../features/threads/new-task-flow-provider";
import { pushScreenAnimation } from "../../lib/pushScreenAnimation";
import { useThemeColor } from "../../lib/useThemeColor";
export const unstable_settings = {
@@ -29,21 +30,24 @@ export default function NewTaskLayout() {
<Stack.Screen name="index" options={{ animation: "none", title: "Choose project" }} />
<Stack.Screen
name="add-project/index"
options={{ animation: "slide_from_right", title: "New project" }}
options={{ animation: pushScreenAnimation, title: "New project" }}
/>
<Stack.Screen
name="add-project/repository"
options={{ animation: "slide_from_right", title: "Repository" }}
options={{ animation: pushScreenAnimation, title: "Repository" }}
/>
<Stack.Screen
name="add-project/destination"
options={{ animation: "slide_from_right", title: "Clone destination" }}
options={{ animation: pushScreenAnimation, title: "Clone destination" }}
/>
<Stack.Screen
name="add-project/local"
options={{ animation: "slide_from_right", title: "Local folder" }}
options={{ animation: pushScreenAnimation, title: "Local folder" }}
/>
<Stack.Screen
name="draft"
options={{ animation: pushScreenAnimation, title: "New task" }}
/>
<Stack.Screen name="draft" options={{ animation: "slide_from_right", title: "New task" }} />
</Stack>
</NewTaskFlowProvider>
);
+6 -5
View File
@@ -3,6 +3,7 @@ import { useCallback } from "react";
import { useResolveClassNames } from "uniwind";
import { useClerkSettingsSheetDetent } from "../../features/cloud/ClerkSettingsSheetDetent";
import { pushScreenAnimation } from "../../lib/pushScreenAnimation";
import { useThemeColor } from "../../lib/useThemeColor";
export const unstable_settings = {
@@ -37,25 +38,25 @@ export default function SettingsLayout() {
<Stack.Screen name="index" options={{ animation: "none", title: "Settings" }} />
<Stack.Screen
name="environments"
options={{ animation: "slide_from_right", title: "Environments" }}
options={{ animation: pushScreenAnimation, title: "Environments" }}
/>
<Stack.Screen
name="environment-new"
options={{ animation: "slide_from_right", title: "Add Environment" }}
options={{ animation: pushScreenAnimation, title: "Add Environment" }}
/>
<Stack.Screen
name="waitlist"
options={{ animation: "slide_from_right", title: "Join the waitlist" }}
options={{ animation: pushScreenAnimation, title: "Join the waitlist" }}
/>
<Stack.Screen
name="archive"
listeners={{ transitionEnd: handleExpandedRouteTransitionEnd }}
options={{ animation: "slide_from_right", title: "Archived Threads" }}
options={{ animation: pushScreenAnimation, title: "Archived Threads" }}
/>
<Stack.Screen
name="auth"
listeners={{ transitionEnd: handleExpandedRouteTransitionEnd }}
options={{ animation: "slide_from_right", title: "Sign in" }}
options={{ animation: pushScreenAnimation, title: "Sign in" }}
/>
</Stack>
);
@@ -2,7 +2,11 @@ import Stack from "expo-router/stack";
import { StyleSheet } from "react-native";
import { useResolveClassNames } from "uniwind";
import { pushScreenAnimation } from "../../../../lib/pushScreenAnimation";
import { useHeaderBlurEffect } from "../../../../lib/useHeaderBlurEffect";
export default function ThreadLayout() {
const headerBlurEffect = useHeaderBlurEffect();
const sheetStyle = StyleSheet.flatten(useResolveClassNames("bg-sheet"));
const headerBg = {
backgroundColor: (sheetStyle as { backgroundColor?: string })?.backgroundColor,
@@ -16,6 +20,7 @@ export default function ThreadLayout() {
contentStyle: { backgroundColor: "transparent" },
headerShown: true,
headerTransparent: true,
headerBlurEffect,
headerShadowVisible: false,
headerTitle: "",
}}
@@ -45,8 +50,9 @@ export default function ThreadLayout() {
<Stack.Screen
name="review"
options={{
animation: "slide_from_right",
animation: pushScreenAnimation,
contentStyle: sheetStyle,
fullScreenGestureEnabled: true,
headerBackButtonDisplayMode: "minimal",
headerShown: true,
headerTitle: "Files changed",
@@ -58,8 +64,9 @@ export default function ThreadLayout() {
<Stack.Screen
name="files/index"
options={{
animation: "slide_from_right",
animation: pushScreenAnimation,
contentStyle: sheetStyle,
fullScreenGestureEnabled: true,
headerBackButtonDisplayMode: "minimal",
headerShown: true,
headerTitle: "Files",
@@ -71,8 +78,9 @@ export default function ThreadLayout() {
<Stack.Screen
name="files/[...path]"
options={{
animation: "slide_from_right",
animation: pushScreenAnimation,
contentStyle: sheetStyle,
fullScreenGestureEnabled: true,
headerBackButtonDisplayMode: "minimal",
headerShown: true,
headerTitle: "File",
@@ -95,8 +103,11 @@ export default function ThreadLayout() {
<Stack.Screen
name="terminal"
options={{
animation: "slide_from_right",
animation: pushScreenAnimation,
contentStyle: { backgroundColor: "#050505" },
// No fullScreenGestureEnabled here: the terminal consumes
// horizontal pans (readline editing, mouse reporting), so
// back-swipe stays confined to the screen edge.
headerBackButtonDisplayMode: "minimal",
headerShown: true,
headerShadowVisible: false,
@@ -2,6 +2,8 @@ import Stack from "expo-router/stack";
import { StyleSheet } from "react-native";
import { useResolveClassNames } from "uniwind";
import { pushScreenAnimation } from "../../../../../lib/pushScreenAnimation";
export const unstable_settings = {
anchor: "index",
};
@@ -23,7 +25,7 @@ export default function GitSheetLayout() {
<Stack.Screen
name="commit"
options={{
animation: "slide_from_right",
animation: pushScreenAnimation,
headerShown: true,
headerTitle: "Commit changes",
headerBackTitle: "",
@@ -34,7 +36,7 @@ export default function GitSheetLayout() {
<Stack.Screen
name="branches"
options={{
animation: "slide_from_right",
animation: pushScreenAnimation,
headerShown: true,
headerTitle: "Branches & worktrees",
headerBackTitle: "",
@@ -45,7 +47,7 @@ export default function GitSheetLayout() {
<Stack.Screen
name="review"
options={{
animation: "slide_from_right",
animation: pushScreenAnimation,
headerShown: true,
headerTitle: "Review changes",
headerBackTitle: "",
@@ -19,6 +19,7 @@ import { cn } from "../../lib/cn";
import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
import { buildThreadFilesNavigation } from "../../lib/routes";
import { MOBILE_TYPOGRAPHY } from "../../lib/typography";
import { useHeaderBlurEffect } from "../../lib/useHeaderBlurEffect";
import { useThemeColor } from "../../lib/useThemeColor";
import { useThreadSelection } from "../../state/use-thread-selection";
import { useSelectedThreadWorktree } from "../../state/use-selected-thread-worktree";
@@ -444,6 +445,7 @@ function FilesToolbarBottomFade() {
export function ThreadFilesTreeScreen() {
const router = useRouter();
const headerBlurEffect = useHeaderBlurEffect();
const [searchQuery, setSearchQuery] = useState("");
const { cwd, environmentId, projectName, selectedThread, threadId } = useThreadFilesWorkspace();
const entriesQuery = useEnvironmentQuery(
@@ -481,6 +483,7 @@ export function ThreadFilesTreeScreen() {
title: "Files",
headerShown: true,
headerTransparent: true,
headerBlurEffect,
headerStyle: { backgroundColor: "transparent" },
headerShadowVisible: false,
headerTitle: () => <FilesHeaderTitle projectName={projectName} />,
@@ -11,6 +11,7 @@ import {
import { Stack } from "expo-router";
import { Text as RNText, View } from "react-native";
import { useHeaderBlurEffect } from "../../lib/useHeaderBlurEffect";
import { useThemeColor } from "../../lib/useThemeColor";
import { MOBILE_TYPOGRAPHY } from "../../lib/typography";
import type { HomeProjectSortOrder } from "./homeThreadList";
@@ -72,6 +73,7 @@ export function HomeHeader(props: {
readonly onOpenSettings: () => void;
readonly onStartNewTask: () => void;
}) {
const headerBlurEffect = useHeaderBlurEffect();
const iconColor = useThemeColor("--color-icon");
const mutedColor = useThemeColor("--color-foreground-muted");
const subtleColor = useThemeColor("--color-subtle");
@@ -88,6 +90,7 @@ export function HomeHeader(props: {
headerShown: true,
headerTransparent: true,
headerStyle: { backgroundColor: "transparent" },
headerBlurEffect,
headerShadowVisible: false,
headerTintColor: iconColor,
headerTitle: "",
@@ -19,6 +19,7 @@ import { AppText as Text } from "../../components/AppText";
import { environmentCatalog } from "../../connection/catalog";
import { useEnvironmentPresentation } from "../../state/presentation";
import { useAtomCommand } from "../../state/use-atom-command";
import { useHeaderBlurEffect } from "../../lib/useHeaderBlurEffect";
import { useThemeColor } from "../../lib/useThemeColor";
import { MOBILE_TYPOGRAPHY } from "../../lib/typography";
import { useThreadDraftForThread } from "../../state/use-thread-composer-state";
@@ -113,6 +114,7 @@ function ReviewSelectionActionBar(props: {
export function ReviewSheet() {
const insets = useSafeAreaInsets();
const colorScheme = useColorScheme();
const headerBlurEffect = useHeaderBlurEffect();
const headerForeground = String(useThemeColor("--color-foreground"));
const headerMuted = String(useThemeColor("--color-foreground-muted"));
const headerIcon = String(useThemeColor("--color-icon"));
@@ -241,6 +243,7 @@ export function ReviewSheet() {
<Stack.Screen
options={{
headerTransparent: true,
headerBlurEffect,
headerShadowVisible: false,
headerTintColor: headerIcon,
headerStyle: {
@@ -253,7 +253,11 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
() =>
Gesture.Pan()
.enabled(!isSplitLayout)
.hitSlop({ left: 0, width: 40 })
// Confine the drawer pan to the top-left corner where it completes
// (see the `event.y` check below). Covering the full left edge stole
// the touch from the native swipe-back gesture, leaving back
// navigation dead below the header.
.hitSlop({ left: 0, width: 40, top: 0, height: drawerGestureThreshold })
.activeOffsetX([10, 999])
.failOffsetY([-24, 24])
.onEnd((event) => {
@@ -5,6 +5,7 @@ import { EnvironmentId, type ProjectScript } from "@t3tools/contracts";
import { projectScriptCwd, projectScriptRuntimeEnv } from "@t3tools/shared/projectScripts";
import { Pressable, ScrollView, Text as RNText, View } from "react-native";
import { useWorkspaceState } from "../../state/workspace";
import { useHeaderBlurEffect } from "../../lib/useHeaderBlurEffect";
import { useThemeColor } from "../../lib/useThemeColor";
import { useEnvironmentQuery } from "../../state/query";
import { dismissGitActionResult, useGitActionProgress } from "../../state/use-vcs-action-state";
@@ -104,6 +105,7 @@ export function ThreadRouteScreen() {
const iconColor = String(useThemeColor("--color-icon"));
const foregroundColor = String(useThemeColor("--color-foreground"));
const secondaryFg = String(useThemeColor("--color-foreground-secondary"));
const headerBlurEffect = useHeaderBlurEffect();
/* ─── Git status for native header trigger ───────────────────────── */
const gitStatus = useEnvironmentQuery(
@@ -326,6 +328,7 @@ export function ThreadRouteScreen() {
headerShown: true,
headerTransparent: true,
headerStyle: { backgroundColor: "transparent" },
headerBlurEffect,
headerShadowVisible: false,
headerTintColor: iconColor,
headerBackTitle: "",
@@ -0,0 +1,12 @@
import { Platform } from "react-native";
/**
* Stack animation for pushed (non-sheet) screens.
*
* iOS keeps the default push animation: forcing `slide_from_right` switches
* react-native-screens to its custom swipe animator, which paints a black
* void behind the outgoing screen during interactive swipe-back. The native
* default is visually the same slide with proper parallax over the previous
* screen. Android has no interactive pop, so it keeps `slide_from_right`.
*/
export const pushScreenAnimation = Platform.OS === "ios" ? "default" : "slide_from_right";
@@ -0,0 +1,15 @@
import { useColorScheme } from "react-native";
/**
* Blur effect for transparent navigation headers.
*
* Recent iOS betas stopped drawing the implicit material behind transparent
* navigation bars, and the trait-adaptive `systemChromeMaterial` resolves to
* its light variant there even while the app renders in dark mode — so pick
* the light/dark variant explicitly from the app color scheme.
*/
export function useHeaderBlurEffect() {
return useColorScheme() === "dark"
? ("systemChromeMaterialDark" as const)
: ("systemChromeMaterialLight" as const);
}
@@ -193,6 +193,36 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
],
}),
},
{
slug: "claude-sonnet-5",
name: "Claude Sonnet 5",
isCustom: false,
capabilities: createModelCapabilities({
optionDescriptors: [
buildSelectOptionDescriptor({
id: "effort",
label: "Reasoning",
options: [
{ value: "low", label: "Low" },
{ value: "medium", label: "Medium" },
{ value: "high", label: "High", isDefault: true },
{ value: "xhigh", label: "Extra High" },
{ value: "max", label: "Max" },
{ value: "ultrathink", label: "Ultrathink" },
],
promptInjectedValues: ["ultrathink"],
}),
buildSelectOptionDescriptor({
id: "contextWindow",
label: "Context Window",
options: [
{ value: "200k", label: "200k", isDefault: true },
{ value: "1m", label: "1M" },
],
}),
],
}),
},
{
slug: "claude-sonnet-4-6",
name: "Claude Sonnet 4.6",
@@ -322,7 +352,12 @@ export function normalizeClaudeCliEffort(
if (effort === "ultracode") {
return "xhigh";
}
if (effort === "xhigh" && model !== "claude-fable-5" && model !== "claude-opus-4-8") {
if (
effort === "xhigh" &&
model !== "claude-fable-5" &&
model !== "claude-opus-4-8" &&
model !== "claude-sonnet-5"
) {
return "max";
}
if (effort === "max" && model === "claude-sonnet-4-6") {
@@ -331,6 +331,19 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
},
[props],
);
const handleTabMouseDown = useCallback((event: ReactMouseEvent) => {
if (event.button !== 1) return;
event.preventDefault();
}, []);
const handleTabAuxClick = useCallback(
(event: ReactMouseEvent, surface: RightPanelSurface) => {
if (event.button !== 1) return;
event.preventDefault();
event.stopPropagation();
props.onCloseSurface(surface);
},
[props],
);
useEffect(() => {
const activeTab = tabListRef.current?.querySelector<HTMLElement>("[data-active-tab='true']");
@@ -367,6 +380,8 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
<div
key={surface.id}
data-active-tab={active}
onMouseDown={handleTabMouseDown}
onAuxClick={(event) => handleTabAuxClick(event, surface)}
onContextMenu={(event) => void handleTabContextMenu(event, surface)}
className={cn(
"group flex h-7 min-w-25 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-sm",
@@ -32,7 +32,7 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
*/
const CUSTOM_MODEL_PLACEHOLDER_BY_KIND: Partial<Record<ProviderDriverKind, string>> = {
[ProviderDriverKind.make("codex")]: "gpt-6.7-codex-ultra-preview",
[ProviderDriverKind.make("claudeAgent")]: "claude-sonnet-5-0",
[ProviderDriverKind.make("claudeAgent")]: "claude-sonnet-5",
[ProviderDriverKind.make("cursor")]: "claude-sonnet-4-6",
[ProviderDriverKind.make("opencode")]: "openai/gpt-5",
};
+23
View File
@@ -812,12 +812,35 @@ label:has(> select#reasoning-effort) select {
#ec4899 90%,
#ff6b6b 100%
);
position: relative;
background: transparent;
}
.ultrathink-frame::before {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
padding: 2px;
background-image: var(--ultrathink-spectrum);
background-size: 220% 220%;
pointer-events: none;
filter: saturate(0.82) brightness(0.92);
-webkit-mask:
linear-gradient(#000 0 0) content-box,
linear-gradient(#000 0 0);
-webkit-mask-composite: xor;
mask:
linear-gradient(#000 0 0) content-box,
linear-gradient(#000 0 0);
mask-composite: exclude;
animation: ultrathink-rainbow 10s linear infinite;
}
.ultrathink-frame > * {
position: relative;
}
.ultrathink-chroma {
animation: ultrathink-chroma-shift 10s linear infinite;
}
+5 -2
View File
@@ -138,7 +138,7 @@ export const DEFAULT_GIT_TEXT_GENERATION_MODEL = "gpt-5.4-mini";
export const DEFAULT_MODEL_BY_PROVIDER: Partial<Record<ProviderDriverKind, string>> = {
[CODEX_DRIVER_KIND]: DEFAULT_MODEL,
[CLAUDE_DRIVER_KIND]: "claude-sonnet-4-6",
[CLAUDE_DRIVER_KIND]: "claude-sonnet-5",
[CURSOR_DRIVER_KIND]: "auto",
[GROK_DRIVER_KIND]: "grok-build",
[OPENCODE_DRIVER_KIND]: "openai/gpt-5",
@@ -174,7 +174,10 @@ export const MODEL_SLUG_ALIASES_BY_PROVIDER: Partial<
"opus-4.6": "claude-opus-4-6",
"claude-opus-4.6": "claude-opus-4-6",
"claude-opus-4-6-20251117": "claude-opus-4-6",
sonnet: "claude-sonnet-4-6",
sonnet: "claude-sonnet-5",
"sonnet-5": "claude-sonnet-5",
"claude-sonnet-5.0": "claude-sonnet-5",
"claude-sonnet-5-0": "claude-sonnet-5",
"sonnet-4.6": "claude-sonnet-4-6",
"claude-sonnet-4.6": "claude-sonnet-4-6",
"claude-sonnet-4-6-20251117": "claude-sonnet-4-6",
+1 -88
View File
@@ -1,13 +1,7 @@
import { describe, expect, it } from "vite-plus/test";
import {
DEFAULT_MODEL,
ProviderDriverKind,
ProviderInstanceId,
type ModelCapabilities,
} from "@t3tools/contracts";
import { ProviderInstanceId, type ModelCapabilities } from "@t3tools/contracts";
import {
applyClaudePromptEffortPrefix,
buildProviderOptionSelectionsFromDescriptors,
createModelCapabilities,
createModelSelection,
@@ -16,11 +10,6 @@ import {
getProviderOptionDescriptors,
getProviderOptionBooleanSelectionValue,
getProviderOptionStringSelectionValue,
isClaudeUltrathinkPrompt,
normalizeModelSlug,
resolveModelSlugForProvider,
resolveSelectableModel,
trimOrNull,
} from "./model.ts";
const codexCaps: ModelCapabilities = createModelCapabilities({
@@ -70,82 +59,6 @@ const claudeCaps: ModelCapabilities = createModelCapabilities({
],
});
describe("normalizeModelSlug", () => {
it("maps known aliases to canonical slugs", () => {
const claude = ProviderDriverKind.make("claudeAgent");
expect(normalizeModelSlug("gpt-5-codex")).toBe("gpt-5.4");
expect(normalizeModelSlug("5.3")).toBe("gpt-5.3-codex");
expect(normalizeModelSlug("sonnet", claude)).toBe("claude-sonnet-4-6");
});
it("returns null for empty or missing values", () => {
expect(normalizeModelSlug("")).toBeNull();
expect(normalizeModelSlug(" ")).toBeNull();
expect(normalizeModelSlug(null)).toBeNull();
expect(normalizeModelSlug(undefined)).toBeNull();
});
});
describe("resolveModelSlugForProvider", () => {
it("returns defaults when the model is missing", () => {
expect(resolveModelSlugForProvider(ProviderDriverKind.make("codex"), undefined)).toBe(
DEFAULT_MODEL,
);
expect(resolveModelSlugForProvider(ProviderDriverKind.make("ollama"), undefined)).toBe(
DEFAULT_MODEL,
);
expect(resolveModelSlugForProvider(ProviderDriverKind.make("grok"), undefined)).toBe(
"grok-build",
);
});
it("preserves normalized unknown models", () => {
expect(
resolveModelSlugForProvider(ProviderDriverKind.make("codex"), "custom/internal-model"),
).toBe("custom/internal-model");
});
});
describe("resolveSelectableModel", () => {
it("resolves exact slugs, labels, and aliases", () => {
const options = [
{ slug: "gpt-5.3-codex", name: "GPT-5.3 Codex" },
{ slug: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
];
expect(resolveSelectableModel(ProviderDriverKind.make("codex"), "gpt-5.3-codex", options)).toBe(
"gpt-5.3-codex",
);
expect(resolveSelectableModel(ProviderDriverKind.make("codex"), "gpt-5.3 codex", options)).toBe(
"gpt-5.3-codex",
);
expect(resolveSelectableModel(ProviderDriverKind.make("claudeAgent"), "sonnet", options)).toBe(
"claude-sonnet-4-6",
);
});
});
describe("misc helpers", () => {
it("detects ultrathink prompts", () => {
expect(isClaudeUltrathinkPrompt("Please ultrathink about this")).toBe(true);
expect(isClaudeUltrathinkPrompt("Ultrathink:\nInvestigate")).toBe(true);
expect(isClaudeUltrathinkPrompt("Investigate")).toBe(false);
});
it("prefixes ultrathink prompts once", () => {
expect(applyClaudePromptEffortPrefix("Investigate", "ultrathink")).toBe(
"Ultrathink:\nInvestigate",
);
expect(applyClaudePromptEffortPrefix("Ultrathink:\nInvestigate", "ultrathink")).toBe(
"Ultrathink:\nInvestigate",
);
});
it("trims strings to null", () => {
expect(trimOrNull(" hi ")).toBe("hi");
expect(trimOrNull(" ")).toBeNull();
});
});
describe("descriptor helpers", () => {
it("applies selection values to capability descriptors", () => {
expect(