Skip to content

Commit 5640b2e

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr-23443
2 parents 34e7142 + 96fc7b9 commit 5640b2e

573 files changed

Lines changed: 26346 additions & 11892 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",
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Agent Context Budget
2+
3+
# Fails when a PR raises a value in agentContextBudget.json above main's. AgentContextBudget.test.ts
4+
# keeps that file equal to the measured context, so the context cannot grow by editing the file.
5+
# To accept growth on purpose, a maintainer adds the agent-context-increase label.
6+
on:
7+
pull_request:
8+
types: [opened, synchronize, reopened, labeled, unlabeled]
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: agent-context-budget-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
budget:
19+
name: Agent context budget
20+
runs-on: ubuntu-24.04
21+
timeout-minutes: 5
22+
env:
23+
BUDGET: apps/server/src/provider/agentContextBudget.json
24+
ALLOW_INCREASE: ${{ contains(github.event.pull_request.labels.*.name, 'agent-context-increase') }}
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v6
28+
with:
29+
sparse-checkout: apps/server/src/provider/agentContextBudget.json
30+
sparse-checkout-cone-mode: false
31+
32+
- name: Compare with main
33+
run: |
34+
git fetch --quiet --depth=1 origin main
35+
if ! git cat-file -e "FETCH_HEAD:$BUDGET" 2>/dev/null; then
36+
echo "main has no agent context budget yet."
37+
exit 0
38+
fi
39+
git show "FETCH_HEAD:$BUDGET" > "$RUNNER_TEMP/main.json"
40+
grown=$(jq -r --slurpfile main "$RUNNER_TEMP/main.json" '
41+
to_entries[]
42+
| select($main[0][.key] != null and .value > $main[0][.key])
43+
| "\(.key): \($main[0][.key]) -> \(.value) (+\(.value - $main[0][.key]))"
44+
' "$BUDGET")
45+
if [ -z "$grown" ]; then
46+
echo "Agent context is not larger than main."
47+
exit 0
48+
fi
49+
printf 'Agent context grew compared to main:\n%s\n' "$grown"
50+
if [ "$ALLOW_INCREASE" = "true" ]; then
51+
echo "Accepted by the agent-context-increase label."
52+
exit 0
53+
fi
54+
echo "::error file=$BUDGET::Agent context grew compared to main. Cut the added text, or ask a maintainer to add the agent-context-increase label."
55+
exit 1

‎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/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/boot.cjs",

‎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/desktop/src/window/DesktopWindow.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function getIconOption(
131131
}
132132

133133
function getInitialWindowBackgroundColor(shouldUseDarkColors: boolean): string {
134-
return shouldUseDarkColors ? "#0a0a0a" : "#ffffff";
134+
return shouldUseDarkColors ? "#000000" : "#ffffff";
135135
}
136136

137137
type DisplayBounds = Pick<Electron.Rectangle, "x" | "y" | "width" | "height">;

‎apps/mobile/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@t3tools/provider-acp-registry": "workspace:*",
7777
"@t3tools/provider-core": "workspace:*",
7878
"@t3tools/provider-cursor": "workspace:*",
79+
"@t3tools/provider-fx": "workspace:*",
7980
"@t3tools/provider-grok": "workspace:*",
8081
"@t3tools/provider-muse": "workspace:*",
8182
"@t3tools/provider-opencode": "workspace:*",

‎apps/mobile/src/App.tsx‎

Lines changed: 105 additions & 51 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";
@@ -7,10 +9,13 @@ import { GestureHandlerRootView } from "react-native-gesture-handler";
79
import { KeyboardProvider } from "react-native-keyboard-controller";
810
import { SafeAreaProvider } from "react-native-safe-area-context";
911
import {
10-
createNavigationContainerRef,
12+
CommonActions,
13+
createPathConfigForStaticNavigation,
1114
createStaticNavigation,
1215
getActionFromState,
1316
getStateFromPath,
17+
type NavigationAction,
18+
type NavigationState,
1419
} from "@react-navigation/native";
1520

1621
import { RegistryContext } from "@effect/atom-react";
@@ -19,12 +24,24 @@ import { ThreadArrangementHost } from "./features/threads/ThreadArrangementSheet
1924
import * as Dialog from "./components/ui/Dialog";
2025
import { CloudAuthProvider } from "./features/cloud/CloudAuthProvider";
2126
import { prepareNativeShowcaseCapture } from "./features/showcase/nativeShowcaseScene";
22-
import { IncomingShareProvider } from "./features/sharing/IncomingShareProvider";
27+
import {
28+
presentPendingIncomingShare,
29+
startIncomingShareInbox,
30+
} from "./features/sharing/IncomingShareProvider";
31+
import {
32+
installAgentNotificationNavigation,
33+
setAgentNotificationPathname,
34+
} from "./features/agent-awareness/notificationNavigation";
35+
import {
36+
installAppShortcuts,
37+
recordAppShortcutNavigationState,
38+
} from "./features/shortcuts/appShortcutsRuntime";
2339
import {
2440
AppearancePreferencesProvider,
41+
installAppearanceRuntime,
2542
useAppearancePreferences,
2643
} from "./features/settings/appearance/AppearancePreferencesProvider";
27-
import { RootStack } from "./Stack";
44+
import { RootStack, workspaceLocationFromState } from "./Stack";
2845
import { appAtomRegistry } from "./state/atom-registry";
2946
import { subscribeComposerDraftModelReconciliation } from "./state/use-composer-drafts";
3047
import { environmentThreadShells } from "./state/threads";
@@ -38,9 +55,9 @@ import {
3855
type FoundationHotModule,
3956
} from "./lib/foundation-fast-refresh";
4057
import { useMobileNavigationTheme } from "./lib/useMobileNavigationTheme";
41-
import { useUiRuntimeMemoryWarningGc } from "./lib/useUiRuntimeMemoryWarningGc";
58+
import { installUiRuntimeMemoryWarningGc } from "./lib/useUiRuntimeMemoryWarningGc";
4259
import { SubscriptionUsageCoordinator } from "./widgets/SubscriptionUsageCoordinator";
43-
import { VoiceInputProvider } from "./features/voice-input/VoiceInputProvider";
60+
import { installSubscriptionUsageRefresh } from "./widgets/useSubscriptionUsage";
4461
import { GlobalVoiceInputControl } from "./features/voice-input/GlobalVoiceInputControl";
4562
import { restoreSettingsLinkState } from "./features/settings/settings-navigation";
4663
import {
@@ -51,6 +68,13 @@ import {
5168
} from "./features/workspace/workspace-selection-store";
5269
import { workspaceDetailLinkAction } from "./features/workspace/workspace-detail-selection";
5370
import { NativeLayoutMetricsProvider } from "./native/native-layout-metrics";
71+
import {
72+
attachRootNavigation,
73+
flushRootNavigationQueue,
74+
linkToRootPath,
75+
rootNavigationRef,
76+
} from "./lib/rootNavigation";
77+
import { pruneNewTaskBranchCheckouts } from "./features/threads/NewTaskDraftRouteScreen";
5478

5579
import "../global.css";
5680

@@ -61,6 +85,20 @@ if (process.env.EXPO_PUBLIC_SHOWCASE === "1") {
6185
void SplashScreen.preventAutoHideAsync().catch(() => {});
6286
void hydrateWorkspaceSelections();
6387

88+
const linkingConfig = {
89+
initialRouteName: "Home",
90+
screens: createPathConfigForStaticNavigation(RootStack, { initialRouteName: "Home" }) ?? {},
91+
} as const;
92+
93+
function getAppStateFromPath(path: string, options: Parameters<typeof getStateFromPath>[1]) {
94+
return takeScheduledTaskNewLink(
95+
restoreSettingsLinkState(
96+
restoreDraftLinkState(getStateFromPath(path, options), path),
97+
settingsLinkPage(),
98+
),
99+
);
100+
}
101+
64102
const appLinking = {
65103
prefixes: [Linking.createURL("/"), "t3code://", "t3code-dev://", "t3code-preview://"],
66104
config: { initialRouteName: "Home" },
@@ -73,25 +111,57 @@ const appLinking = {
73111
// Our router handles the selection; React Navigation's type only lists its own actions.
74112
(workspaceDetailLinkAction(state) as ReturnType<typeof getActionFromState>) ??
75113
getActionFromState(state, options),
76-
getStateFromPath: (path: string, options: Parameters<typeof getStateFromPath>[1]) =>
77-
takeScheduledTaskNewLink(
78-
restoreSettingsLinkState(
79-
restoreDraftLinkState(getStateFromPath(path, options), path),
80-
settingsLinkPage(),
81-
),
82-
),
114+
getStateFromPath: getAppStateFromPath,
83115
};
84116

117+
function appLinkAction(href: string): NavigationAction {
118+
const state = getAppStateFromPath(href, linkingConfig);
119+
if (!state) throw new Error(`Failed to parse the href to a navigation state (${href}).`);
120+
return appLinking.getActionFromState(state, linkingConfig) ?? CommonActions.reset(state);
121+
}
122+
123+
function linkToAppPath(href: string): void {
124+
linkToRootPath(href, appLinkAction);
125+
}
126+
85127
const Navigation = createStaticNavigation(RootStack);
86-
const navigationRef = createNavigationContainerRef();
128+
129+
function handleNavigationStateChange(state: NavigationState | undefined): void {
130+
recordWorkspaceSelections(state);
131+
presentPendingIncomingShare();
132+
if (!state) return;
133+
setAgentNotificationPathname(workspaceLocationFromState(state).pathname);
134+
recordAppShortcutNavigationState(state);
135+
pruneNewTaskBranchCheckouts(state);
136+
}
137+
138+
function handleNavigationReady(): void {
139+
handleNavigationStateChange(rootNavigationRef.getRootState());
140+
flushRootNavigationQueue();
141+
}
87142

88143
declare const module: { readonly hot?: FoundationHotModule } | undefined;
89144

90-
const disposePermissionUpdateNotice = installPermissionUpdateNotice();
91-
disposeOnFoundationReplace(
92-
typeof module === "undefined" ? undefined : module.hot,
93-
disposePermissionUpdateNotice,
94-
);
145+
const appServiceDisposers = [
146+
installUiRuntimeMemoryWarningGc(),
147+
subscribeComposerDraftModelReconciliation({
148+
registry: appAtomRegistry,
149+
threadShellAtom: environmentThreadShells.threadShellAtom,
150+
threadRefsAtom: environmentThreadShells.threadRefsAtom,
151+
shellStateAtom: environmentShell.stateAtom,
152+
}),
153+
installAppearanceRuntime(),
154+
installSubscriptionUsageRefresh(),
155+
installPermissionUpdateNotice(),
156+
installThreadOutboxDelivery(),
157+
installComposerAttachmentUploads(),
158+
startIncomingShareInbox(),
159+
installAgentNotificationNavigation(linkToAppPath),
160+
installAppShortcuts(linkToAppPath),
161+
];
162+
disposeOnFoundationReplace(typeof module === "undefined" ? undefined : module.hot, () => {
163+
for (const dispose of appServiceDisposers) dispose();
164+
});
95165

96166
function SplashScreenCoordinator() {
97167
const { isReady } = useAppearancePreferences();
@@ -104,18 +174,6 @@ function SplashScreenCoordinator() {
104174
}
105175

106176
export default function App() {
107-
useUiRuntimeMemoryWarningGc();
108-
useEffect(
109-
() =>
110-
subscribeComposerDraftModelReconciliation({
111-
registry: appAtomRegistry,
112-
threadShellAtom: environmentThreadShells.threadShellAtom,
113-
threadRefsAtom: environmentThreadShells.threadRefsAtom,
114-
shellStateAtom: environmentShell.stateAtom,
115-
}),
116-
[],
117-
);
118-
119177
return (
120178
<RegistryContext.Provider value={appAtomRegistry}>
121179
<CloudAuthProvider>
@@ -138,27 +196,23 @@ function AppContent() {
138196
<GestureHandlerRootView className="flex-1">
139197
<KeyboardProvider statusBarTranslucent>
140198
<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>
199+
<StatusBar barStyle={themeAppearance === "dark" ? "light-content" : "dark-content"} />
200+
{/* native-stack needs the theme's dark flag to select dark native headers. */}
201+
<GlobalVoiceInputControl>
202+
<NativeLayoutMetricsProvider>
203+
<Navigation
204+
ref={attachRootNavigation}
205+
linking={appLinking}
206+
onReady={handleNavigationReady}
207+
theme={navigationTheme}
208+
onStateChange={handleNavigationStateChange}
209+
/>
210+
<Dialog.Host />
211+
<ThreadArrangementHost />
212+
<ProjectChipIconRasterizer />
213+
</NativeLayoutMetricsProvider>
214+
</GlobalVoiceInputControl>
215+
<OverlayPortalHost />
162216
</SafeAreaProvider>
163217
</KeyboardProvider>
164218
</GestureHandlerRootView>

0 commit comments

Comments
 (0)