Skip to content

Commit f1f8dac

Browse files
MarcoDotIOclaude
andcommitted
Merge upstream main
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 parents 5dd0f62 + 9bc0c33 commit f1f8dac

303 files changed

Lines changed: 13110 additions & 7900 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/ci-changes.cjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const RUST = /^native\/(resource-monitor|kde-snap-shot|hyprland-snap-shot)\//;
3232

3333
// These tests read other packages without declaring dependencies.
3434
const TEST_ONLY_DEPS = {
35+
// Evals import the server's source to test its real model-facing text.
36+
"@t3tools/evals": ["t3"],
3537
"@t3tools/provider-pi": ["@t3tools/client-runtime"],
3638
"@t3tools/scripts": [
3739
"@t3tools/desktop",

‎AGENTS.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
136136

137137
For authorized mobile verification, a missing or outdated native client is an install step, not a blocker. Run `vp run mobile:install <ios|android> [device-id]` on the device host before starting Metro; it targets the only booted simulator or connected Android device when the id is omitted. It installs the dev client for this checkout's native fingerprint from the shared cache in seconds and builds only when no machine has built it yet, so prefer it over `expo run:*`, `xcodebuild`, or `gradlew`, which rebuild from scratch. Its stdout is one JSON line; build output goes to the log it names. See `test-t3-mobile` for the full workflow.
138138

139+
## Evals
140+
141+
`evals/` checks how real models behave with T3 Code's model-facing text: agent instructions, MCP tool descriptions and schemas, and generated titles. Before you change that text, read [evals/README.md](evals/README.md) and run the evals it names. When you fix a model behavior bug, add a case that fails before the fix.
142+
139143
## Pull requests
140144

141145
- Never make a PR unless the developer explicitly asks you to do so.

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ We are (mostly) not accepting contributions yet. Small fixes may be considered.
9494

9595
Full docs live in [docs/](./docs). There's no docs site yet.
9696

97+
- [FAQ](./docs/user/faq.md)
9798
- [Install and first run](./docs/user/install.md)
9899
- [Permission modes](./docs/user/permission-modes.md)
99100
- [Keyboard shortcuts](./docs/user/keybindings.md)

‎apps/desktop/src/backend/DesktopBackendPool.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const layer = Layer.effect(
132132
});
133133
yield* electronDialog.showErrorBox(
134134
"WSL backend couldn't start",
135-
`${reason}\n\nFalling back to the Windows backend so T3 Code can open. Re-enable the WSL backend from Settings > Connections once the WSL distro is fixed.`,
135+
`${reason}\n\nFalling back to the Windows backend so T3 Code can open. Re-enable the WSL backend from Settings > Sharing & access once the WSL distro is fixed.`,
136136
);
137137
// Clear wslOnly too so enabling WSL cannot restore a failed mode.
138138
// Keep the in-memory fallback if persistence fails.

‎apps/mobile/src/App.tsx‎

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { installPermissionUpdateNotice } from "./features/connection/permissionUpdateNotice";
2+
import { installComposerAttachmentUploads } from "./state/composer-attachment-uploads";
3+
import { installThreadOutboxDelivery } from "./state/threadOutboxDelivery";
24
import * as Linking from "expo-linking";
35
import * as SplashScreen from "expo-splash-screen";
46
import { useEffect } from "react";
@@ -40,7 +42,6 @@ import {
4042
import { useMobileNavigationTheme } from "./lib/useMobileNavigationTheme";
4143
import { useUiRuntimeMemoryWarningGc } from "./lib/useUiRuntimeMemoryWarningGc";
4244
import { SubscriptionUsageCoordinator } from "./widgets/SubscriptionUsageCoordinator";
43-
import { VoiceInputProvider } from "./features/voice-input/VoiceInputProvider";
4445
import { GlobalVoiceInputControl } from "./features/voice-input/GlobalVoiceInputControl";
4546
import { restoreSettingsLinkState } from "./features/settings/settings-navigation";
4647
import {
@@ -87,11 +88,14 @@ const navigationRef = createNavigationContainerRef();
8788

8889
declare const module: { readonly hot?: FoundationHotModule } | undefined;
8990

90-
const disposePermissionUpdateNotice = installPermissionUpdateNotice();
91-
disposeOnFoundationReplace(
92-
typeof module === "undefined" ? undefined : module.hot,
93-
disposePermissionUpdateNotice,
94-
);
91+
const appServiceDisposers = [
92+
installPermissionUpdateNotice(),
93+
installThreadOutboxDelivery(),
94+
installComposerAttachmentUploads(),
95+
];
96+
disposeOnFoundationReplace(typeof module === "undefined" ? undefined : module.hot, () => {
97+
for (const dispose of appServiceDisposers) dispose();
98+
});
9599

96100
function SplashScreenCoordinator() {
97101
const { isReady } = useAppearancePreferences();
@@ -138,27 +142,25 @@ function AppContent() {
138142
<GestureHandlerRootView className="flex-1">
139143
<KeyboardProvider statusBarTranslucent>
140144
<SafeAreaProvider>
141-
<VoiceInputProvider>
142-
<StatusBar barStyle={themeAppearance === "dark" ? "light-content" : "dark-content"} />
143-
{/* native-stack needs the theme's dark flag to select dark native headers. */}
144-
<GlobalVoiceInputControl>
145-
<NativeLayoutMetricsProvider>
146-
<IncomingShareProvider>
147-
<Navigation
148-
ref={navigationRef}
149-
linking={appLinking}
150-
onReady={() => recordWorkspaceSelections(navigationRef.getRootState())}
151-
theme={navigationTheme}
152-
onStateChange={recordWorkspaceSelections}
153-
/>
154-
</IncomingShareProvider>
155-
<Dialog.Host />
156-
<ThreadArrangementHost />
157-
<ProjectChipIconRasterizer />
158-
</NativeLayoutMetricsProvider>
159-
</GlobalVoiceInputControl>
160-
<OverlayPortalHost />
161-
</VoiceInputProvider>
145+
<StatusBar barStyle={themeAppearance === "dark" ? "light-content" : "dark-content"} />
146+
{/* native-stack needs the theme's dark flag to select dark native headers. */}
147+
<GlobalVoiceInputControl>
148+
<NativeLayoutMetricsProvider>
149+
<IncomingShareProvider>
150+
<Navigation
151+
ref={navigationRef}
152+
linking={appLinking}
153+
onReady={() => recordWorkspaceSelections(navigationRef.getRootState())}
154+
theme={navigationTheme}
155+
onStateChange={recordWorkspaceSelections}
156+
/>
157+
</IncomingShareProvider>
158+
<Dialog.Host />
159+
<ThreadArrangementHost />
160+
<ProjectChipIconRasterizer />
161+
</NativeLayoutMetricsProvider>
162+
</GlobalVoiceInputControl>
163+
<OverlayPortalHost />
162164
</SafeAreaProvider>
163165
</KeyboardProvider>
164166
</GestureHandlerRootView>

‎apps/mobile/src/Stack.tsx‎

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ import { SettingsEnvironmentDetailRouteScreen } from "./features/settings/Settin
9797
import { SettingsEnvironmentsRouteScreen } from "./features/settings/SettingsEnvironmentsRouteScreen";
9898
import { SettingsFollowUpRouteScreen } from "./features/settings/SettingsFollowUpRouteScreen";
9999
import {
100-
SettingsEnvironmentAgentBehaviorRouteScreen,
101100
SettingsEnvironmentMaintenanceRouteScreen,
102-
SettingsEnvironmentNewThreadsRouteScreen,
101+
SettingsThreadsRouteScreen,
102+
SettingsWorktreesRouteScreen,
103103
SettingsEnvironmentSourceControlRouteScreen,
104104
} from "./features/settings/SettingsServerControlsRouteScreen";
105105
import {
@@ -125,7 +125,7 @@ import { UsageRouteScreen } from "./features/usage/UsageRouteScreen";
125125
import { SettingsAboutRouteScreen } from "./features/settings/SettingsAboutRouteScreen";
126126
import { SettingsNotificationsRouteScreen } from "./features/settings/SettingsNotificationsRouteScreen";
127127
import { SettingsRouteScreen } from "./features/settings/SettingsRouteScreen";
128-
import { SettingsThreadsRouteScreen } from "./features/settings/SettingsThreadsRouteScreen";
128+
import { SettingsLabsRouteScreen } from "./features/settings/ThreadSettingsSections";
129129
import { SettingsEnvironmentFilterProvider } from "./features/settings/settings-environment-filter";
130130
import { openSettings, settingsOpenIn } from "./features/settings/settings-navigation";
131131
import { DEFAULT_SETTINGS_PAGE } from "./features/workspace/workspace-tab-navigation";
@@ -149,8 +149,6 @@ import { deriveLayout } from "./lib/layout";
149149
import { useNativeLayoutMetrics } from "./native/native-layout-metrics";
150150
import { nativeHeaderScrollEdgeEffects } from "./native/StackHeader";
151151
import { HORIZONTAL_FORM_SHEET_OPTIONS, formSheetDetents } from "./native/sheet-surface";
152-
import { useThreadOutboxDrain } from "./state/use-thread-outbox-drain";
153-
import { useComposerAttachmentUploadWorker } from "./state/composer-attachment-uploads";
154152
import {
155153
selectWorkspaceDetail,
156154
workspaceDetailRouter,
@@ -263,25 +261,36 @@ const SETTINGS_SCREENS = {
263261
linking: "settings/environments/:environmentId",
264262
options: { ...SETTINGS_PAGE_OPTIONS, title: "Environment" },
265263
}),
264+
// Old links to New threads and Agent behavior open Threads, which absorbed them.
266265
SettingsEnvironmentNewThreads: createNativeStackScreen({
267-
screen: SettingsEnvironmentNewThreadsRouteScreen,
266+
screen: SettingsThreadsRouteScreen,
268267
linking: "settings/new-threads",
269-
options: { ...SETTINGS_PAGE_OPTIONS, title: "New threads" },
268+
options: { ...SETTINGS_PAGE_OPTIONS, title: "Threads" },
270269
}),
271270
SettingsEnvironmentSourceControl: createNativeStackScreen({
272271
screen: SettingsEnvironmentSourceControlRouteScreen,
273272
linking: "settings/source-control",
274273
options: { ...SETTINGS_PAGE_OPTIONS, title: "Source control" },
275274
}),
276275
SettingsEnvironmentAgentBehavior: createNativeStackScreen({
277-
screen: SettingsEnvironmentAgentBehaviorRouteScreen,
276+
screen: SettingsThreadsRouteScreen,
278277
linking: "settings/agent-behavior",
279-
options: { ...SETTINGS_PAGE_OPTIONS, title: "Agent behavior" },
278+
options: { ...SETTINGS_PAGE_OPTIONS, title: "Threads" },
279+
}),
280+
SettingsWorktrees: createNativeStackScreen({
281+
screen: SettingsWorktreesRouteScreen,
282+
linking: "settings/worktrees",
283+
options: { ...SETTINGS_PAGE_OPTIONS, title: "Worktrees" },
284+
}),
285+
SettingsLabs: createNativeStackScreen({
286+
screen: SettingsLabsRouteScreen,
287+
linking: "settings/labs",
288+
options: { ...SETTINGS_PAGE_OPTIONS, title: "Labs" },
280289
}),
281290
SettingsProviderAccounts: createNativeStackScreen({
282291
screen: SettingsProviderAccountsRouteScreen,
283292
linking: "settings/provider-accounts",
284-
options: { ...SETTINGS_PAGE_OPTIONS, title: "Provider accounts" },
293+
options: { ...SETTINGS_PAGE_OPTIONS, title: "Providers" },
285294
}),
286295
SettingsEnvironmentMaintenance: createNativeStackScreen({
287296
screen: SettingsEnvironmentMaintenanceRouteScreen,
@@ -296,12 +305,12 @@ const SETTINGS_SCREENS = {
296305
SettingsThreads: createNativeStackScreen({
297306
screen: SettingsThreadsRouteScreen,
298307
linking: "settings/thread-preferences",
299-
options: { ...SETTINGS_PAGE_OPTIONS, title: "Thread behavior" },
308+
options: { ...SETTINGS_PAGE_OPTIONS, title: "Threads" },
300309
}),
301310
SettingsAbout: createNativeStackScreen({
302311
screen: SettingsAboutRouteScreen,
303312
linking: "settings/about",
304-
options: { ...SETTINGS_PAGE_OPTIONS, title: "About T3 Code" },
313+
options: { ...SETTINGS_PAGE_OPTIONS, title: "About" },
305314
}),
306315
SettingsEnvironmentNew: createNativeStackScreen({
307316
screen: ConnectionsNewRouteScreen,
@@ -316,7 +325,7 @@ const SETTINGS_SCREENS = {
316325
linking: "settings/archive",
317326
options: {
318327
...SETTINGS_PAGE_OPTIONS,
319-
title: "Archived Threads",
328+
title: "Archive",
320329
},
321330
}),
322331
SettingsNavigation: createNativeStackScreen({
@@ -337,21 +346,21 @@ const SETTINGS_SCREENS = {
337346
linking: "settings/project-grouping",
338347
options: {
339348
...SETTINGS_PAGE_OPTIONS,
340-
title: "Organization",
349+
title: "General",
341350
},
342351
}),
343352
SettingsOrganization: createNativeStackScreen({
344353
screen: SettingsProjectGroupingRouteScreen,
345354
linking: "settings/organization",
346355
options: {
347356
...SETTINGS_PAGE_OPTIONS,
348-
title: "Organization",
357+
title: "General",
349358
},
350359
}),
351360
SettingsProjectOverview: createNativeStackScreen({
352361
screen: SettingsProjectOverviewRouteScreen,
353362
linking: "settings/project",
354-
options: { ...SETTINGS_PAGE_OPTIONS, title: "Project overview" },
363+
options: { ...SETTINGS_PAGE_OPTIONS, title: "Projects" },
355364
}),
356365
SettingsKeyboard: createNativeStackScreen({
357366
screen: SettingsKeyboardRouteScreen,
@@ -374,15 +383,15 @@ const SETTINGS_SCREENS = {
374383
linking: "settings/follow-ups",
375384
options: {
376385
...SETTINGS_PAGE_OPTIONS,
377-
title: "Follow-ups",
386+
title: "Chat",
378387
},
379388
}),
380389
SettingsScheduledTasks: createNativeStackScreen({
381390
screen: SettingsScheduledTasksRouteScreen,
382391
linking: "settings/scheduled-tasks",
383392
options: {
384393
...SETTINGS_PAGE_OPTIONS,
385-
title: "Scheduled Tasks",
394+
title: "Scheduled tasks",
386395
headerTitleStyle: { fontSize: 16, fontWeight: "800" },
387396
},
388397
}),
@@ -485,13 +494,6 @@ function workspaceLocationFromState(state: NavigationState) {
485494
};
486495
}
487496

488-
// Isolate subscriptions so streaming updates cannot re-render RootStackLayout and every screen.
489-
function ThreadOutboxDrainWorker() {
490-
useThreadOutboxDrain();
491-
useComposerAttachmentUploadWorker();
492-
return null;
493-
}
494-
495497
function RootStackLayout(props: {
496498
readonly children: React.ReactNode;
497499
readonly state: NavigationState;
@@ -509,16 +511,11 @@ function RootStackLayout(props: {
509511
);
510512
const draftRoute = props.state.routes.findLast((route) => route.name === "Thread");
511513
const draftParams = (
512-
draftRoute?.params as
513-
| { draft?: { draftId?: string | string[]; pendingTaskId?: string | string[] } }
514-
| undefined
514+
draftRoute?.params as { draft?: { draftId?: string | string[] } } | undefined
515515
)?.draft;
516516
const routeDraftId = Array.isArray(draftParams?.draftId)
517517
? draftParams.draftId[0]
518518
: draftParams?.draftId;
519-
const routePendingTaskId = Array.isArray(draftParams?.pendingTaskId)
520-
? draftParams.pendingTaskId[0]
521-
: draftParams?.pendingTaskId;
522519
useAgentNotificationNavigation(workspaceLocation.pathname);
523520
useConnectOnboardingNavigation();
524521
useAppShortcuts(props.state);
@@ -540,13 +537,8 @@ function RootStackLayout(props: {
540537
}, [navigation, pendingShare, props.state]);
541538

542539
return (
543-
<NewTaskFlowProvider
544-
active={isDraftThreadRoute(draftRoute)}
545-
routeDraftId={routeDraftId}
546-
routePendingTaskId={routePendingTaskId}
547-
>
540+
<NewTaskFlowProvider active={isDraftThreadRoute(draftRoute)} routeDraftId={routeDraftId}>
548541
<HardwareKeyboardCommandProvider pathname={pathname}>
549-
<ThreadOutboxDrainWorker />
550542
<ShowcaseCaptureCoordinator pathname={pathname} />
551543
<SettingsEnvironmentFilterProvider open={settingsOpen}>
552544
<WorkspaceConnectionStatusProvider>

‎apps/mobile/src/components/ComposerContextAttachment.tsx‎

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import * as Dialog from "./ui/Dialog";
55
import type { ComposerContextRecord, EnvironmentId } from "@t3tools/contracts";
66
import { Pressable, View } from "react-native";
77
import { Image } from "expo-image";
8-
import { useEffect, useId, useState } from "react";
8+
import { useId, useState } from "react";
99
import type { DraftComposerAttachment } from "../lib/composerImages";
1010
import { composerAttachmentInlineUri, isFileBackedComposerAttachment } from "../lib/composerImages";
11-
import { loadLocalAttachmentPreview } from "../lib/localAttachmentPreview";
11+
import {
12+
loadLocalAttachmentPreview,
13+
useLocalAttachmentPreview,
14+
} from "../lib/localAttachmentPreview";
1215
import { downloadAndShareAttachment } from "../lib/attachmentDownload";
1316
import { assetImageSource } from "../lib/assetImageSource";
1417
import { useAssetUrlState, useRefreshAssetUrl } from "../state/assets";
@@ -35,31 +38,13 @@ export function ComposerContextAttachment(props: {
3538
const remoteEnvironmentId = local || inlineUri ? null : (props.environmentId ?? null);
3639
const asset = useAssetUrlState(remoteEnvironmentId, resource);
3740
const refresh = useRefreshAssetUrl(remoteEnvironmentId, resource);
38-
const [localUri, setLocalUri] = useState<string | null>(null);
39-
const [error, setError] = useState<string | null>(null);
41+
const localPreview = useLocalAttachmentPreview(local ?? null);
42+
const error = localPreview.error ? "The local file is unavailable. Attach it again." : null;
4043
const [sharing, setSharing] = useState(false);
4144
const [previewOpen, setPreviewOpen] = useState(false);
42-
useEffect(() => {
43-
if (!local) return;
44-
const controller = new AbortController();
45-
let dispose: (() => void) | undefined;
46-
void loadLocalAttachmentPreview(local, controller.signal)
47-
.then((preview) => {
48-
if (!preview) return;
49-
if (controller.signal.aborted) return preview.dispose();
50-
dispose = preview.dispose;
51-
setLocalUri(preview.uri);
52-
setError(null);
53-
})
54-
.catch(() => {
55-
if (!controller.signal.aborted) setError("The local file is unavailable. Attach it again.");
56-
});
57-
return () => {
58-
controller.abort();
59-
dispose?.();
60-
};
61-
}, [local]);
62-
const uri = local ? localUri : (inlineUri ?? (asset._tag === "Success" ? asset.url : null));
45+
const uri = local
46+
? localPreview.uri
47+
: (inlineUri ?? (asset._tag === "Success" ? asset.url : null));
6348
const share = async () => {
6449
if (sharing) return;
6550
setSharing(true);

0 commit comments

Comments
 (0)