Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3322fedc5a | ||
|
|
3be7de0663 | ||
|
|
7b9eef7ac2 | ||
|
|
9d66b104fe | ||
|
|
51ea084c87 | ||
|
|
0615fd7df1 | ||
|
|
2e5b83f4ce | ||
|
|
03cebdff1d | ||
|
|
e61d5909ae | ||
|
|
f55639d0eb |
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,
|
||||
|
||||
@@ -34,6 +34,30 @@ Build and run the local iOS dev client:
|
||||
vp run ios:dev
|
||||
```
|
||||
|
||||
If your Xcode account only has a Personal Team, use a bundle identifier you control and opt into the
|
||||
reduced-capability local build. Personal Team builds omit the widget extension, push entitlement, and
|
||||
native Sign in with Apple entitlement; builds without this opt-in are unchanged.
|
||||
|
||||
```bash
|
||||
T3CODE_IOS_PERSONAL_TEAM=1 \
|
||||
T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID=com.example.t3code.dev \
|
||||
vp run ios:dev
|
||||
```
|
||||
|
||||
Build and install a self-contained Release app that does not need Metro:
|
||||
|
||||
```bash
|
||||
vp run ios:release
|
||||
```
|
||||
|
||||
The Personal Team equivalent also needs a unique bundle identifier:
|
||||
|
||||
```bash
|
||||
T3CODE_IOS_PERSONAL_TEAM=1 \
|
||||
T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID=com.example.t3code \
|
||||
vp run ios:release
|
||||
```
|
||||
|
||||
Build and run the local iOS preview app:
|
||||
|
||||
```bash
|
||||
|
||||
+41
-18
@@ -8,6 +8,20 @@ const repoEnv = loadRepoEnv();
|
||||
Object.assign(process.env, repoEnv);
|
||||
|
||||
const APP_VARIANT = resolveAppVariant(repoEnv.APP_VARIANT);
|
||||
const isIosPersonalTeamBuild = repoEnv.T3CODE_IOS_PERSONAL_TEAM === "1";
|
||||
|
||||
const personalTeamBundleIdentifier = repoEnv.T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID?.trim();
|
||||
const IOS_BUNDLE_IDENTIFIER_PATTERN = /^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/;
|
||||
|
||||
if (
|
||||
isIosPersonalTeamBuild &&
|
||||
(!personalTeamBundleIdentifier ||
|
||||
!IOS_BUNDLE_IDENTIFIER_PATTERN.test(personalTeamBundleIdentifier))
|
||||
) {
|
||||
throw new Error(
|
||||
"T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID must be a reverse-DNS identifier such as com.example.t3code when T3CODE_IOS_PERSONAL_TEAM=1.",
|
||||
);
|
||||
}
|
||||
|
||||
const VARIANT_CONFIG: Record<
|
||||
AppVariant,
|
||||
@@ -54,6 +68,27 @@ function resolveAppVariant(value: string | undefined): AppVariant {
|
||||
}
|
||||
|
||||
const variant = VARIANT_CONFIG[APP_VARIANT];
|
||||
const iosBundleIdentifier =
|
||||
isIosPersonalTeamBuild && personalTeamBundleIdentifier
|
||||
? personalTeamBundleIdentifier
|
||||
: variant.iosBundleIdentifier;
|
||||
|
||||
const widgetsPlugin = [
|
||||
"expo-widgets",
|
||||
{
|
||||
bundleIdentifier: `${iosBundleIdentifier}.widgets`,
|
||||
groupIdentifier: `group.${iosBundleIdentifier}`,
|
||||
enablePushNotifications: true,
|
||||
widgets: [
|
||||
{
|
||||
name: "AgentActivity",
|
||||
displayName: "Agent Activity",
|
||||
description: "Shows the current state of active T3 Code agents.",
|
||||
supportedFamilies: ["systemSmall", "systemMedium", "accessoryRectangular"],
|
||||
},
|
||||
],
|
||||
},
|
||||
] satisfies NonNullable<ExpoConfig["plugins"]>[number];
|
||||
|
||||
const config: ExpoConfig = {
|
||||
name: variant.appName,
|
||||
@@ -76,7 +111,7 @@ const config: ExpoConfig = {
|
||||
ios: {
|
||||
icon: variant.iosIcon,
|
||||
supportsTablet: true,
|
||||
bundleIdentifier: variant.iosBundleIdentifier,
|
||||
bundleIdentifier: iosBundleIdentifier,
|
||||
infoPlist: {
|
||||
NSAppTransportSecurity: {
|
||||
NSAllowsArbitraryLoads: true,
|
||||
@@ -102,9 +137,10 @@ const config: ExpoConfig = {
|
||||
},
|
||||
plugins: [
|
||||
"expo-router",
|
||||
"expo-asset",
|
||||
"expo-font",
|
||||
"expo-secure-store",
|
||||
["@clerk/expo", { theme: "./clerk-theme.json" }],
|
||||
["@clerk/expo", { theme: "./clerk-theme.json", appleSignIn: !isIosPersonalTeamBuild }],
|
||||
"expo-web-browser",
|
||||
[
|
||||
"expo-camera",
|
||||
@@ -139,26 +175,13 @@ const config: ExpoConfig = {
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
"expo-widgets",
|
||||
{
|
||||
bundleIdentifier: `${variant.iosBundleIdentifier}.widgets`,
|
||||
groupIdentifier: `group.${variant.iosBundleIdentifier}`,
|
||||
enablePushNotifications: true,
|
||||
widgets: [
|
||||
{
|
||||
name: "AgentActivity",
|
||||
displayName: "Agent Activity",
|
||||
description: "Shows the current state of active T3 Code agents.",
|
||||
supportedFamilies: ["systemSmall", "systemMedium", "accessoryRectangular"],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
...(!isIosPersonalTeamBuild ? [widgetsPlugin] : []),
|
||||
"./plugins/withAndroidCleartextTraffic.cjs",
|
||||
...(isIosPersonalTeamBuild ? ["./plugins/withoutIosPersonalTeamCapabilities.cjs"] : []),
|
||||
],
|
||||
extra: {
|
||||
appVariant: APP_VARIANT,
|
||||
iosPersonalTeamBuild: isIosPersonalTeamBuild,
|
||||
relay: {
|
||||
url: repoEnv.T3CODE_RELAY_URL ?? null,
|
||||
},
|
||||
|
||||
+20
-18
@@ -22,6 +22,7 @@
|
||||
"ios:dev": "APP_VARIANT=development EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform ios && expo run:ios",
|
||||
"ios:preview": "APP_VARIANT=preview EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform ios && expo run:ios",
|
||||
"ios:prod": "APP_VARIANT=production EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform ios && expo run:ios",
|
||||
"ios:release": "APP_VARIANT=production EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform ios && expo run:ios --configuration Release --no-bundler",
|
||||
"eas:ios:dev": "eas build --profile development -p ios",
|
||||
"eas:ios:preview": "eas build --profile preview -p ios",
|
||||
"eas:ios:preview:dev": "eas build --profile preview:dev -p ios",
|
||||
@@ -43,7 +44,7 @@
|
||||
"@clerk/expo": "catalog:",
|
||||
"@effect/atom-react": "catalog:",
|
||||
"@expo-google-fonts/dm-sans": "^0.4.2",
|
||||
"@expo/ui": "~56.0.8",
|
||||
"@expo/ui": "~56.0.18",
|
||||
"@legendapp/list": "3.2.0",
|
||||
"@noble/curves": "catalog:",
|
||||
"@noble/hashes": "catalog:",
|
||||
@@ -59,34 +60,35 @@
|
||||
"@t3tools/mobile-review-diff-native": "file:./modules/t3-review-diff",
|
||||
"@t3tools/mobile-terminal-native": "file:./modules/t3-terminal",
|
||||
"@t3tools/shared": "workspace:*",
|
||||
"@tabler/icons-react-native": "^3.44.0",
|
||||
"clsx": "^2.1.1",
|
||||
"diff": "8.0.3",
|
||||
"effect": "catalog:",
|
||||
"expo": "^56.0.0",
|
||||
"expo-asset": "~56.0.15",
|
||||
"expo-auth-session": "~56.0.12",
|
||||
"expo-build-properties": "~56.0.15",
|
||||
"expo-camera": "~56.0.7",
|
||||
"expo-clipboard": "~56.0.3",
|
||||
"expo-constants": "~56.0.16",
|
||||
"expo": "^56.0.12",
|
||||
"expo-asset": "~56.0.17",
|
||||
"expo-auth-session": "~56.0.14",
|
||||
"expo-build-properties": "~56.0.19",
|
||||
"expo-camera": "~56.0.8",
|
||||
"expo-clipboard": "~56.0.4",
|
||||
"expo-constants": "~56.0.18",
|
||||
"expo-crypto": "~56.0.4",
|
||||
"expo-dev-client": "~56.0.16",
|
||||
"expo-file-system": "~56.0.7",
|
||||
"expo-font": "~56.0.5",
|
||||
"expo-dev-client": "~56.0.20",
|
||||
"expo-file-system": "~56.0.8",
|
||||
"expo-font": "~56.0.7",
|
||||
"expo-glass-effect": "~56.0.4",
|
||||
"expo-haptics": "~56.0.3",
|
||||
"expo-image-picker": "~56.0.14",
|
||||
"expo-linking": "~56.0.12",
|
||||
"expo-image-picker": "~56.0.18",
|
||||
"expo-linking": "~56.0.14",
|
||||
"expo-network": "~56.0.5",
|
||||
"expo-notifications": "~56.0.14",
|
||||
"expo-notifications": "~56.0.18",
|
||||
"expo-paste-input": "^0.1.15",
|
||||
"expo-router": "~56.2.7",
|
||||
"expo-router": "~56.2.11",
|
||||
"expo-secure-store": "~56.0.4",
|
||||
"expo-splash-screen": "~56.0.10",
|
||||
"expo-symbols": "~56.0.5",
|
||||
"expo-updates": "~56.0.17",
|
||||
"expo-symbols": "~56.0.6",
|
||||
"expo-updates": "~56.0.19",
|
||||
"expo-web-browser": "~56.0.5",
|
||||
"expo-widgets": "~56.0.15",
|
||||
"expo-widgets": "~56.0.19",
|
||||
"punycode": "^2.3.1",
|
||||
"react": "19.2.3",
|
||||
"react-dom": "19.2.3",
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
const { withEntitlementsPlist } = require("expo/config-plugins");
|
||||
|
||||
module.exports = function withoutIosPersonalTeamCapabilities(config) {
|
||||
return withEntitlementsPlist(config, (modConfig) => {
|
||||
delete modConfig.modResults["aps-environment"];
|
||||
delete modConfig.modResults["com.apple.developer.applesignin"];
|
||||
delete modConfig.modResults["com.apple.security.application-groups"];
|
||||
return modConfig;
|
||||
});
|
||||
};
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
DMSans_700Bold,
|
||||
useFonts,
|
||||
} from "@expo-google-fonts/dm-sans";
|
||||
import { RegistryContext } from "@effect/atom-react";
|
||||
import { usePathname } from "expo-router";
|
||||
import Stack from "expo-router/stack";
|
||||
import { useCallback } from "react";
|
||||
@@ -18,7 +19,6 @@ import { LoadingScreen } from "../components/LoadingScreen";
|
||||
|
||||
import { useWorkspaceState } from "../state/workspace";
|
||||
import { useThreadOutboxDrain } from "../state/use-thread-outbox-drain";
|
||||
import { RegistryContext } from "@effect/atom-react";
|
||||
import { appAtomRegistry } from "../state/atom-registry";
|
||||
import { CloudAuthProvider } from "../features/cloud/CloudAuthProvider";
|
||||
import {
|
||||
|
||||
@@ -84,6 +84,7 @@ export default function HomeRouteScreen() {
|
||||
<>
|
||||
<HomeHeader
|
||||
environments={environments}
|
||||
searchQuery={searchQuery}
|
||||
selectedEnvironmentId={selectedEnvironmentId}
|
||||
projectSortOrder={listOptions.projectSortOrder}
|
||||
threadSortOrder={listOptions.threadSortOrder}
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
squashAtomCommandFailure,
|
||||
} from "@t3tools/client-runtime/state/runtime";
|
||||
import { AppText as Text } from "../../components/AppText";
|
||||
import { supportsAgentAwarenessPush } from "../../features/agent-awareness/capabilities";
|
||||
import { setLiveActivityUpdatesEnabled } from "../../features/agent-awareness/liveActivityPreferences";
|
||||
import { requestAgentNotificationPermission } from "../../features/agent-awareness/notificationPermissions";
|
||||
import { refreshAgentAwarenessRegistration } from "../../features/agent-awareness/remoteRegistration";
|
||||
@@ -74,6 +75,7 @@ function LocalSettingsRouteScreen() {
|
||||
}
|
||||
|
||||
function ConfiguredSettingsRouteScreen() {
|
||||
const agentAwarenessPushAvailable = supportsAgentAwarenessPush();
|
||||
const insets = useSafeAreaInsets();
|
||||
const { push } = useRouter();
|
||||
const { expand: expandClerkSheet } = useClerkSettingsSheetDetent();
|
||||
@@ -361,17 +363,27 @@ function ConfiguredSettingsRouteScreen() {
|
||||
<SettingsSwitchRow
|
||||
icon="bell.badge"
|
||||
label="Device Notifications"
|
||||
disabled={notificationStatus === "checking" || notificationStatus === "unsupported"}
|
||||
value={notificationStatus === "enabled"}
|
||||
disabled={
|
||||
!agentAwarenessPushAvailable ||
|
||||
notificationStatus === "checking" ||
|
||||
notificationStatus === "unsupported"
|
||||
}
|
||||
value={agentAwarenessPushAvailable && notificationStatus === "enabled"}
|
||||
onValueChange={handleDeviceNotificationsChange}
|
||||
/>
|
||||
<SettingsSwitchRow
|
||||
disabled={
|
||||
!isLoaded || liveActivityStatus === "checking" || liveActivityStatus === "linking"
|
||||
!agentAwarenessPushAvailable ||
|
||||
!isLoaded ||
|
||||
liveActivityStatus === "checking" ||
|
||||
liveActivityStatus === "linking"
|
||||
}
|
||||
icon="bolt.circle"
|
||||
label="Live Activity Updates"
|
||||
value={liveActivityStatus === "enabled" || liveActivityStatus === "linking"}
|
||||
value={
|
||||
agentAwarenessPushAvailable &&
|
||||
(liveActivityStatus === "enabled" || liveActivityStatus === "linking")
|
||||
}
|
||||
onValueChange={handleLiveActivitiesChange}
|
||||
/>
|
||||
</SettingsSection>
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
import {
|
||||
IconAdjustmentsHorizontal,
|
||||
IconAlertTriangle,
|
||||
IconArchive,
|
||||
IconArrowBackUp,
|
||||
IconArrowDownCircle,
|
||||
IconArrowRightCircle,
|
||||
IconArrowUp,
|
||||
IconArrowUpRight,
|
||||
IconBellRinging,
|
||||
IconBolt,
|
||||
IconCamera,
|
||||
IconCheck,
|
||||
IconChevronDown,
|
||||
IconChevronRight,
|
||||
IconChevronUp,
|
||||
IconCircleCheck,
|
||||
IconCircleXFilled,
|
||||
IconCopy,
|
||||
IconDeviceDesktop,
|
||||
IconDots,
|
||||
IconDotsCircleHorizontal,
|
||||
IconEdit,
|
||||
IconExternalLink,
|
||||
IconEye,
|
||||
IconFileText,
|
||||
IconFilter,
|
||||
IconFolder,
|
||||
IconFolderPlus,
|
||||
IconGitBranch,
|
||||
IconGitMerge,
|
||||
IconInfoCircle,
|
||||
IconLayoutColumns,
|
||||
IconLink,
|
||||
IconMessage,
|
||||
IconNetwork,
|
||||
IconPlayerPlay,
|
||||
IconPlayerStopFilled,
|
||||
IconPlus,
|
||||
IconRefresh,
|
||||
IconSearch,
|
||||
IconServer,
|
||||
IconSettings,
|
||||
IconTerminal2,
|
||||
IconTrash,
|
||||
IconTypography,
|
||||
IconUserCircle,
|
||||
IconWifiOff,
|
||||
IconX,
|
||||
type Icon,
|
||||
} from "@tabler/icons-react-native";
|
||||
import { Platform } from "react-native";
|
||||
import { SymbolView as ExpoSymbolView, type SFSymbol, type SymbolViewProps } from "expo-symbols";
|
||||
|
||||
const ANDROID_ICON_BY_SF_SYMBOL: Partial<Record<SFSymbol, Icon>> = {
|
||||
"arrow.branch": IconGitBranch,
|
||||
"arrow.clockwise": IconRefresh,
|
||||
"arrow.down.circle": IconArrowDownCircle,
|
||||
"arrow.right.circle": IconArrowRightCircle,
|
||||
"arrow.triangle.branch": IconGitBranch,
|
||||
"arrow.turn.left.up": IconArrowBackUp,
|
||||
"arrow.up": IconArrowUp,
|
||||
"arrow.up.right": IconArrowUpRight,
|
||||
archivebox: IconArchive,
|
||||
"archivebox.fill": IconArchive,
|
||||
"bell.badge": IconBellRinging,
|
||||
"bolt.circle": IconBolt,
|
||||
"bolt.horizontal.circle": IconBolt,
|
||||
camera: IconCamera,
|
||||
checkmark: IconCheck,
|
||||
"checkmark.circle": IconCircleCheck,
|
||||
"chevron.down": IconChevronDown,
|
||||
"chevron.right": IconChevronRight,
|
||||
"chevron.up": IconChevronUp,
|
||||
desktopcomputer: IconDeviceDesktop,
|
||||
"doc.on.doc": IconCopy,
|
||||
"doc.text": IconFileText,
|
||||
ellipsis: IconDots,
|
||||
"ellipsis.circle": IconDotsCircleHorizontal,
|
||||
"exclamationmark.triangle": IconAlertTriangle,
|
||||
eye: IconEye,
|
||||
folder: IconFolder,
|
||||
"folder.badge.plus": IconFolderPlus,
|
||||
"folder.fill": IconFolder,
|
||||
gearshape: IconSettings,
|
||||
"info.circle": IconInfoCircle,
|
||||
link: IconLink,
|
||||
"line.3.horizontal.decrease.circle": IconFilter,
|
||||
"line.3.horizontal.decrease.circle.fill": IconFilter,
|
||||
magnifyingglass: IconSearch,
|
||||
"person.crop.circle": IconUserCircle,
|
||||
play: IconPlayerPlay,
|
||||
plus: IconPlus,
|
||||
"point.3.connected.trianglepath.dotted": IconNetwork,
|
||||
"point.topleft.down.curvedto.point.bottomright.up": IconGitMerge,
|
||||
safari: IconExternalLink,
|
||||
"server.rack": IconServer,
|
||||
"slider.horizontal.3": IconAdjustmentsHorizontal,
|
||||
"square.and.pencil": IconEdit,
|
||||
"square.split.2x1": IconLayoutColumns,
|
||||
"stop.fill": IconPlayerStopFilled,
|
||||
terminal: IconTerminal2,
|
||||
"text.bubble": IconMessage,
|
||||
"textformat.size": IconTypography,
|
||||
trash: IconTrash,
|
||||
"wifi.slash": IconWifiOff,
|
||||
xmark: IconX,
|
||||
"xmark.circle.fill": IconCircleXFilled,
|
||||
};
|
||||
|
||||
export type { SFSymbol } from "expo-symbols";
|
||||
export type AppSymbolName = SymbolViewProps["name"];
|
||||
|
||||
export function SymbolView(props: SymbolViewProps) {
|
||||
if (Platform.OS !== "android") {
|
||||
return <ExpoSymbolView {...props} />;
|
||||
}
|
||||
|
||||
if (typeof props.name === "object" && props.name.android) {
|
||||
return <ExpoSymbolView {...props} />;
|
||||
}
|
||||
|
||||
const sfSymbol = typeof props.name === "string" ? props.name : props.name.ios;
|
||||
const AndroidIcon = sfSymbol ? ANDROID_ICON_BY_SF_SYMBOL[sfSymbol] : undefined;
|
||||
|
||||
if (!AndroidIcon) {
|
||||
return props.fallback ?? null;
|
||||
}
|
||||
|
||||
return (
|
||||
<AndroidIcon
|
||||
accessibilityLabel={props.accessibilityLabel}
|
||||
color={props.tintColor}
|
||||
size={props.size}
|
||||
strokeWidth={2}
|
||||
style={props.style}
|
||||
testID={props.testID}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import { MenuView } from "@react-native-menu/menu";
|
||||
import type { ComponentProps, ReactNode } from "react";
|
||||
import { Pressable, useColorScheme, View } from "react-native";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import { useThemeColor } from "../lib/useThemeColor";
|
||||
|
||||
import { cn } from "../lib/cn";
|
||||
import { SymbolView } from "./AppSymbol";
|
||||
import { AppText as Text } from "./AppText";
|
||||
|
||||
export function ControlPill(props: {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import Constants from "expo-constants";
|
||||
|
||||
export function supportsAgentAwarenessPush() {
|
||||
return Constants.expoConfig?.extra?.iosPersonalTeamBuild !== true;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { RelayDeviceRegistrationRequest } from "@t3tools/contracts/relay";
|
||||
|
||||
import type { Preferences } from "../../lib/storage";
|
||||
import { supportsAgentAwarenessPush } from "./capabilities";
|
||||
|
||||
export function makeRelayDeviceRegistrationRequest(input: {
|
||||
readonly deviceId: string;
|
||||
@@ -12,7 +13,8 @@ export function makeRelayDeviceRegistrationRequest(input: {
|
||||
readonly notificationsEnabled: boolean;
|
||||
readonly preferences: Preferences;
|
||||
}): RelayDeviceRegistrationRequest {
|
||||
const liveActivitiesEnabled = input.preferences.liveActivitiesEnabled !== false;
|
||||
const pushAvailable = supportsAgentAwarenessPush();
|
||||
const liveActivitiesEnabled = pushAvailable && input.preferences.liveActivitiesEnabled !== false;
|
||||
return {
|
||||
deviceId: input.deviceId,
|
||||
label: input.label,
|
||||
@@ -23,7 +25,7 @@ export function makeRelayDeviceRegistrationRequest(input: {
|
||||
...(input.pushToStartToken ? { pushToStartToken: input.pushToStartToken } : {}),
|
||||
preferences: {
|
||||
liveActivitiesEnabled,
|
||||
notificationsEnabled: input.notificationsEnabled,
|
||||
notificationsEnabled: pushAvailable && input.notificationsEnabled,
|
||||
notifyOnApproval: true,
|
||||
notifyOnInput: true,
|
||||
notifyOnCompletion: true,
|
||||
|
||||
@@ -213,6 +213,26 @@ describe("makeRelayDeviceRegistrationRequest", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("disables push features in Personal Team relay registrations", () => {
|
||||
Constants.expoConfig!.extra = { iosPersonalTeamBuild: true };
|
||||
|
||||
expect(
|
||||
makeRelayDeviceRegistrationRequest({
|
||||
deviceId: "device-1",
|
||||
label: "Julius's iPhone",
|
||||
iosMajorVersion: 18,
|
||||
appVersion: "1.0.0",
|
||||
pushToken: "apns-token",
|
||||
pushToStartToken: "push-to-start-token",
|
||||
notificationsEnabled: true,
|
||||
preferences: {},
|
||||
}).preferences,
|
||||
).toMatchObject({
|
||||
liveActivitiesEnabled: false,
|
||||
notificationsEnabled: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("marks notification delivery disabled when APNs permission is unavailable", () => {
|
||||
expect(
|
||||
makeRelayDeviceRegistrationRequest({
|
||||
|
||||
@@ -8,9 +8,15 @@ import {
|
||||
DEFAULT_SIDEBAR_PROJECT_SORT_ORDER,
|
||||
DEFAULT_SIDEBAR_THREAD_SORT_ORDER,
|
||||
} from "@t3tools/contracts";
|
||||
import type { MenuAction } from "@react-native-menu/menu";
|
||||
import { Stack } from "expo-router";
|
||||
import { Text as RNText, View } from "react-native";
|
||||
import { useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { Platform, Pressable, Text as RNText, TextInput, View } from "react-native";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import type { SearchBarCommands } from "react-native-screens";
|
||||
|
||||
import { ControlPill, ControlPillMenu } from "../../components/ControlPill";
|
||||
import { SymbolView } from "../../components/AppSymbol";
|
||||
import { useThemeColor } from "../../lib/useThemeColor";
|
||||
import { MOBILE_TYPOGRAPHY } from "../../lib/typography";
|
||||
import type { HomeProjectSortOrder } from "./homeThreadList";
|
||||
@@ -60,6 +66,7 @@ const PROJECT_GROUPING_OPTIONS: ReadonlyArray<{
|
||||
|
||||
export function HomeHeader(props: {
|
||||
readonly environments: ReadonlyArray<HomeHeaderEnvironment>;
|
||||
readonly searchQuery: string;
|
||||
readonly selectedEnvironmentId: EnvironmentId | null;
|
||||
readonly projectSortOrder: HomeProjectSortOrder;
|
||||
readonly threadSortOrder: SidebarThreadSortOrder;
|
||||
@@ -72,6 +79,271 @@ export function HomeHeader(props: {
|
||||
readonly onOpenSettings: () => void;
|
||||
readonly onStartNewTask: () => void;
|
||||
}) {
|
||||
if (Platform.OS === "android") {
|
||||
return <AndroidHomeHeader {...props} />;
|
||||
}
|
||||
|
||||
return <IosHomeHeader {...props} />;
|
||||
}
|
||||
|
||||
type HomeHeaderProps = Parameters<typeof HomeHeader>[0];
|
||||
|
||||
function checkedMenuTitle(checked: boolean, title: string) {
|
||||
return checked ? `✓ ${title}` : title;
|
||||
}
|
||||
|
||||
function AndroidHomeHeader(props: HomeHeaderProps) {
|
||||
const insets = useSafeAreaInsets();
|
||||
const iconColor = useThemeColor("--color-icon");
|
||||
const mutedColor = useThemeColor("--color-foreground-muted");
|
||||
const subtleColor = useThemeColor("--color-subtle");
|
||||
const headerColor = useThemeColor("--color-header");
|
||||
const headerBorderColor = useThemeColor("--color-header-border");
|
||||
const inputColor = useThemeColor("--color-input");
|
||||
const inputBorderColor = useThemeColor("--color-input-border");
|
||||
const placeholderColor = useThemeColor("--color-placeholder");
|
||||
const hasCustomListOptions =
|
||||
props.selectedEnvironmentId !== null ||
|
||||
props.projectSortOrder !== DEFAULT_SIDEBAR_PROJECT_SORT_ORDER ||
|
||||
props.threadSortOrder !== DEFAULT_SIDEBAR_THREAD_SORT_ORDER ||
|
||||
props.projectGroupingMode !== DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE;
|
||||
const menuActions = useMemo<MenuAction[]>(
|
||||
() => [
|
||||
{
|
||||
id: "environment",
|
||||
title: "Environment",
|
||||
subactions: [
|
||||
{
|
||||
id: "environment:all",
|
||||
title: checkedMenuTitle(props.selectedEnvironmentId === null, "All environments"),
|
||||
},
|
||||
...props.environments.map((environment) => ({
|
||||
id: `environment:${environment.environmentId}`,
|
||||
title: checkedMenuTitle(
|
||||
props.selectedEnvironmentId === environment.environmentId,
|
||||
environment.label,
|
||||
),
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "project-sort",
|
||||
title: "Sort projects",
|
||||
subactions: PROJECT_SORT_OPTIONS.map((option) => ({
|
||||
id: `project-sort:${option.value}`,
|
||||
title: checkedMenuTitle(props.projectSortOrder === option.value, option.label),
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "thread-sort",
|
||||
title: "Sort threads",
|
||||
subactions: THREAD_SORT_OPTIONS.map((option) => ({
|
||||
id: `thread-sort:${option.value}`,
|
||||
title: checkedMenuTitle(props.threadSortOrder === option.value, option.label),
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "project-grouping",
|
||||
title: "Group projects",
|
||||
subactions: PROJECT_GROUPING_OPTIONS.map((option) => ({
|
||||
id: `project-grouping:${option.value}`,
|
||||
title: checkedMenuTitle(props.projectGroupingMode === option.value, option.label),
|
||||
})),
|
||||
},
|
||||
],
|
||||
[
|
||||
props.environments,
|
||||
props.projectGroupingMode,
|
||||
props.projectSortOrder,
|
||||
props.selectedEnvironmentId,
|
||||
props.threadSortOrder,
|
||||
],
|
||||
);
|
||||
const handleMenuAction = useCallback(
|
||||
(event: { nativeEvent: { event: string } }) => {
|
||||
const id = event.nativeEvent.event;
|
||||
if (id === "environment:all") {
|
||||
props.onEnvironmentChange(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id.startsWith("environment:")) {
|
||||
const environmentId = id.slice("environment:".length);
|
||||
const environment = props.environments.find(
|
||||
(candidate) => candidate.environmentId === environmentId,
|
||||
);
|
||||
if (environment) {
|
||||
props.onEnvironmentChange(environment.environmentId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const projectSort = PROJECT_SORT_OPTIONS.find(
|
||||
(option) => id === `project-sort:${option.value}`,
|
||||
);
|
||||
if (projectSort) {
|
||||
props.onProjectSortOrderChange(projectSort.value);
|
||||
return;
|
||||
}
|
||||
|
||||
const threadSort = THREAD_SORT_OPTIONS.find((option) => id === `thread-sort:${option.value}`);
|
||||
if (threadSort) {
|
||||
props.onThreadSortOrderChange(threadSort.value);
|
||||
return;
|
||||
}
|
||||
|
||||
const grouping = PROJECT_GROUPING_OPTIONS.find(
|
||||
(option) => id === `project-grouping:${option.value}`,
|
||||
);
|
||||
if (grouping) {
|
||||
props.onProjectGroupingModeChange(grouping.value);
|
||||
}
|
||||
},
|
||||
[props],
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen options={{ headerShown: false }} />
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: headerColor,
|
||||
borderBottomColor: headerBorderColor,
|
||||
borderBottomWidth: 1,
|
||||
paddingTop: Math.max(insets.top, 12),
|
||||
paddingBottom: 12,
|
||||
paddingHorizontal: 16,
|
||||
}}
|
||||
>
|
||||
<View style={{ alignSelf: "center", gap: 12, maxWidth: 720, width: "100%" }}>
|
||||
<View style={{ alignItems: "center", flexDirection: "row", gap: 10 }}>
|
||||
<View style={{ alignItems: "center", flexDirection: "row", flex: 1, gap: 8 }}>
|
||||
<RNText
|
||||
style={{
|
||||
color: iconColor,
|
||||
fontFamily: "DMSans_700Bold",
|
||||
fontSize: MOBILE_TYPOGRAPHY.title.fontSize,
|
||||
letterSpacing: -0.5,
|
||||
}}
|
||||
>
|
||||
T3 Code
|
||||
</RNText>
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: subtleColor,
|
||||
borderRadius: 99,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 3,
|
||||
}}
|
||||
>
|
||||
<RNText
|
||||
style={{
|
||||
color: mutedColor,
|
||||
fontFamily: "DMSans_700Bold",
|
||||
fontSize: MOBILE_TYPOGRAPHY.micro.fontSize,
|
||||
letterSpacing: 1.1,
|
||||
textTransform: "uppercase",
|
||||
}}
|
||||
>
|
||||
Alpha
|
||||
</RNText>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<ControlPillMenu
|
||||
actions={menuActions}
|
||||
isAnchoredToRight
|
||||
onPressAction={handleMenuAction}
|
||||
>
|
||||
<Pressable
|
||||
accessibilityLabel="Filter and sort threads"
|
||||
accessibilityRole="button"
|
||||
style={{
|
||||
alignItems: "center",
|
||||
backgroundColor: subtleColor,
|
||||
borderRadius: 99,
|
||||
height: 44,
|
||||
justifyContent: "center",
|
||||
width: 44,
|
||||
}}
|
||||
>
|
||||
<SymbolView
|
||||
name={
|
||||
hasCustomListOptions
|
||||
? "line.3.horizontal.decrease.circle.fill"
|
||||
: "line.3.horizontal.decrease.circle"
|
||||
}
|
||||
size={18}
|
||||
tintColor={iconColor}
|
||||
type="monochrome"
|
||||
/>
|
||||
</Pressable>
|
||||
</ControlPillMenu>
|
||||
<ControlPill
|
||||
accessibilityLabel="Open settings"
|
||||
icon="gearshape"
|
||||
onPress={props.onOpenSettings}
|
||||
/>
|
||||
<ControlPill
|
||||
accessibilityLabel="New task"
|
||||
icon="square.and.pencil"
|
||||
onPress={props.onStartNewTask}
|
||||
variant="primary"
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View
|
||||
style={{
|
||||
alignItems: "center",
|
||||
backgroundColor: inputColor,
|
||||
borderColor: inputBorderColor,
|
||||
borderRadius: 16,
|
||||
borderWidth: 1,
|
||||
flexDirection: "row",
|
||||
gap: 10,
|
||||
minHeight: 48,
|
||||
paddingHorizontal: 14,
|
||||
}}
|
||||
>
|
||||
<SymbolView name="magnifyingglass" size={17} tintColor={mutedColor} type="monochrome" />
|
||||
<TextInput
|
||||
accessibilityLabel="Search threads"
|
||||
autoCapitalize="none"
|
||||
onChangeText={props.onSearchQueryChange}
|
||||
placeholder="Search threads"
|
||||
placeholderTextColor={placeholderColor}
|
||||
style={{
|
||||
color: iconColor,
|
||||
flex: 1,
|
||||
fontFamily: "DMSans_400Regular",
|
||||
fontSize: MOBILE_TYPOGRAPHY.body.fontSize,
|
||||
paddingVertical: 10,
|
||||
}}
|
||||
value={props.searchQuery}
|
||||
/>
|
||||
{props.searchQuery.length > 0 ? (
|
||||
<Pressable
|
||||
accessibilityLabel="Clear search"
|
||||
hitSlop={10}
|
||||
onPress={() => props.onSearchQueryChange("")}
|
||||
>
|
||||
<SymbolView
|
||||
name="xmark.circle.fill"
|
||||
size={17}
|
||||
tintColor={mutedColor}
|
||||
type="monochrome"
|
||||
/>
|
||||
</Pressable>
|
||||
) : null}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function IosHomeHeader(props: HomeHeaderProps) {
|
||||
const searchBarRef = useRef<SearchBarCommands>(null);
|
||||
const iconColor = useThemeColor("--color-icon");
|
||||
const mutedColor = useThemeColor("--color-foreground-muted");
|
||||
const subtleColor = useThemeColor("--color-subtle");
|
||||
@@ -81,6 +353,10 @@ export function HomeHeader(props: {
|
||||
props.threadSortOrder !== DEFAULT_SIDEBAR_THREAD_SORT_ORDER ||
|
||||
props.projectGroupingMode !== DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE;
|
||||
|
||||
useEffect(() => {
|
||||
searchBarRef.current?.setText(props.searchQuery);
|
||||
}, [props.searchQuery]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
@@ -92,6 +368,7 @@ export function HomeHeader(props: {
|
||||
headerTintColor: iconColor,
|
||||
headerTitle: "",
|
||||
headerSearchBarOptions: {
|
||||
ref: searchBarRef,
|
||||
placeholder: "Search threads",
|
||||
hideNavigationBar: false,
|
||||
onChangeText: (event) => {
|
||||
|
||||
@@ -8,9 +8,15 @@ import type {
|
||||
SidebarThreadSortOrder,
|
||||
} from "@t3tools/contracts";
|
||||
import * as Haptics from "expo-haptics";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import { useCallback, useMemo, useRef, useState } from "react";
|
||||
import { ActivityIndicator, Pressable, ScrollView, useWindowDimensions, View } from "react-native";
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Platform,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
useWindowDimensions,
|
||||
View,
|
||||
} from "react-native";
|
||||
import ReanimatedSwipeable, {
|
||||
type SwipeableMethods,
|
||||
} from "react-native-gesture-handler/ReanimatedSwipeable";
|
||||
@@ -25,6 +31,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { useThemeColor } from "../../lib/useThemeColor";
|
||||
|
||||
import { AppText as Text } from "../../components/AppText";
|
||||
import { SymbolView } from "../../components/AppSymbol";
|
||||
import { EmptyState } from "../../components/EmptyState";
|
||||
import { ProjectFavicon } from "../../components/ProjectFavicon";
|
||||
import type { WorkspaceState } from "../../state/workspaceModel";
|
||||
@@ -507,16 +514,19 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
return (
|
||||
<View className="flex-1 bg-screen">
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
|
||||
showsVerticalScrollIndicator={false}
|
||||
keyboardDismissMode="on-drag"
|
||||
keyboardShouldPersistTaps="handled"
|
||||
onScrollBeginDrag={() => openSwipeableRef.current?.close()}
|
||||
className="flex-1"
|
||||
contentContainerStyle={{
|
||||
alignSelf: "center",
|
||||
width: "100%",
|
||||
maxWidth: 720,
|
||||
paddingHorizontal: 16,
|
||||
paddingTop: 8,
|
||||
paddingBottom: 24,
|
||||
paddingTop: Platform.OS === "android" ? 16 : 8,
|
||||
paddingBottom: Math.max(insets.bottom, 24),
|
||||
gap: 20,
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -5,18 +5,7 @@ import {
|
||||
} from "@t3tools/contracts";
|
||||
import { resolveSelectableModel } from "@t3tools/shared/model";
|
||||
import { LegendList, type LegendListRef } from "@legendapp/list/react";
|
||||
import {
|
||||
type ChangeEvent,
|
||||
type KeyboardEvent as ReactKeyboardEvent,
|
||||
memo,
|
||||
useMemo,
|
||||
useState,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
type RefObject,
|
||||
} from "react";
|
||||
import { memo, useMemo, useState, useCallback, useEffect, useLayoutEffect, useRef } from "react";
|
||||
import { SearchIcon } from "lucide-react";
|
||||
import { ModelListRow } from "./ModelListRow";
|
||||
import { ModelPickerSidebar } from "./ModelPickerSidebar";
|
||||
@@ -54,8 +43,6 @@ type ModelPickerItem = {
|
||||
|
||||
const EMPTY_MODEL_JUMP_LABELS = new Map<string, string>();
|
||||
|
||||
const normalizeModelSearchQuery = (value: string): string => value.trim();
|
||||
|
||||
// Split a `${instanceId}:${slug}` combobox key back into its pieces. Slugs
|
||||
// can contain colons (e.g. some vendor model ids), so we only split on the
|
||||
// first colon — anything after that is the slug.
|
||||
@@ -70,70 +57,6 @@ function splitInstanceModelKey(key: string): { instanceId: ProviderInstanceId; s
|
||||
};
|
||||
}
|
||||
|
||||
const ModelPickerSearchInput = memo(function ModelPickerSearchInput(props: {
|
||||
inputRef: RefObject<HTMLInputElement | null>;
|
||||
onSearchQueryChange: (query: string) => void;
|
||||
onRequestClose?: () => void;
|
||||
onSubmitHighlightedModel: () => boolean;
|
||||
}) {
|
||||
const { inputRef, onRequestClose, onSearchQueryChange, onSubmitHighlightedModel } = props;
|
||||
const [inputValue, setInputValue] = useState("");
|
||||
const lastNormalizedQueryRef = useRef("");
|
||||
|
||||
const handleChange = useCallback(
|
||||
(event: ChangeEvent<HTMLInputElement>) => {
|
||||
const nextValue = event.target.value;
|
||||
const nextNormalizedQuery = normalizeModelSearchQuery(nextValue);
|
||||
setInputValue(nextValue);
|
||||
if (lastNormalizedQueryRef.current === nextNormalizedQuery) {
|
||||
return;
|
||||
}
|
||||
lastNormalizedQueryRef.current = nextNormalizedQuery;
|
||||
onSearchQueryChange(nextNormalizedQuery);
|
||||
},
|
||||
[onSearchQueryChange],
|
||||
);
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(event: ReactKeyboardEvent<HTMLInputElement>) => {
|
||||
if (event.key === "Escape") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
onRequestClose?.();
|
||||
return;
|
||||
}
|
||||
if (event.key === "Enter" && onSubmitHighlightedModel()) {
|
||||
(event as typeof event & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
event.stopPropagation();
|
||||
},
|
||||
[onRequestClose, onSubmitHighlightedModel],
|
||||
);
|
||||
|
||||
return (
|
||||
<ComboboxInput
|
||||
ref={inputRef}
|
||||
className="[&_input]:h-6.5 [&_input]:font-sans [&_input]:leading-6.5"
|
||||
inputClassName="rounded-none bg-transparent text-sm"
|
||||
placeholder="Search models..."
|
||||
showTrigger={false}
|
||||
startAddon={
|
||||
<SearchIcon className="-translate-x-0.5 size-4 shrink-0 text-muted-foreground/55" />
|
||||
}
|
||||
value={inputValue}
|
||||
onChange={handleChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
onMouseDown={(event) => event.stopPropagation()}
|
||||
onTouchStart={(event) => event.stopPropagation()}
|
||||
size="sm"
|
||||
unstyled
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
export const ModelPickerContent = memo(function ModelPickerContent(props: {
|
||||
/** The instance currently selected in the composer (combobox "value"). */
|
||||
activeInstanceId: ProviderInstanceId;
|
||||
@@ -595,15 +518,6 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
|
||||
};
|
||||
}, [filteredModelKeys, updateModelListScrollFades]);
|
||||
|
||||
const submitHighlightedModel = useCallback(() => {
|
||||
if (!highlightedModelKeyRef.current) {
|
||||
return false;
|
||||
}
|
||||
const { instanceId, slug } = splitInstanceModelKey(highlightedModelKeyRef.current);
|
||||
handleModelSelect(slug, instanceId);
|
||||
return true;
|
||||
}, [handleModelSelect]);
|
||||
|
||||
return (
|
||||
<TooltipProvider delay={0}>
|
||||
<div
|
||||
@@ -663,11 +577,42 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
|
||||
{/* Search bar */}
|
||||
<div className="px-4 pt-2.5">
|
||||
<div className="-translate-y-px border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring">
|
||||
<ModelPickerSearchInput
|
||||
inputRef={searchInputRef}
|
||||
onSearchQueryChange={setSearchQuery}
|
||||
onSubmitHighlightedModel={submitHighlightedModel}
|
||||
{...(props.onRequestClose ? { onRequestClose: props.onRequestClose } : {})}
|
||||
<ComboboxInput
|
||||
ref={searchInputRef}
|
||||
className="[&_input]:h-6.5 [&_input]:font-sans [&_input]:leading-6.5"
|
||||
inputClassName="rounded-none bg-transparent text-sm"
|
||||
placeholder="Search models..."
|
||||
showTrigger={false}
|
||||
startAddon={
|
||||
<SearchIcon className="-translate-x-0.5 size-4 shrink-0 text-muted-foreground/55" />
|
||||
}
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
props.onRequestClose?.();
|
||||
return;
|
||||
}
|
||||
if (e.key === "Enter" && highlightedModelKeyRef.current) {
|
||||
(
|
||||
e as typeof e & { preventBaseUIHandler?: () => void }
|
||||
).preventBaseUIHandler?.();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const { instanceId, slug } = splitInstanceModelKey(
|
||||
highlightedModelKeyRef.current,
|
||||
);
|
||||
handleModelSelect(slug, instanceId);
|
||||
return;
|
||||
}
|
||||
e.stopPropagation();
|
||||
}}
|
||||
onMouseDown={(e) => e.stopPropagation()}
|
||||
onTouchStart={(e) => e.stopPropagation()}
|
||||
size="sm"
|
||||
unstyled
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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",
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,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(
|
||||
|
||||
Generated
+544
-426
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user