Skip to content

Commit 88dcfe9

Browse files
committed
merge: adapt idle release settings to current T3 settings pages
2 parents b7bd5b8 + 28286d5 commit 88dcfe9

663 files changed

Lines changed: 29563 additions & 12849 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.

‎.coderabbit.config.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,19 @@ export default defineConfig((ctx) => ({
2626
path: "apps/web/src/**/*.{tsx,css}",
2727
instructions: "Hold changed code to the rules in docs/internals/web-ui.md.",
2828
},
29+
{
30+
path: "**/*.test.{ts,tsx}",
31+
instructions:
32+
"Hold changed tests to the rules in docs/internals/testing.md. Request tests only as those rules allow.",
33+
},
2934
],
3035
},
3136
knowledge_base: {
3237
code_guidelines: {
3338
filePatterns: [
3439
{ files: "docs/internals/effect-services.md", applyTo: "{apps,packages,infra}/**/*.ts" },
3540
{ files: "docs/internals/web-ui.md", applyTo: "apps/web/src/**/*.{tsx,css}" },
41+
{ files: "docs/internals/testing.md", applyTo: "{apps,packages,infra}/**/*.{ts,tsx}" },
3642
],
3743
},
3844
},

‎.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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
103103
- Use `vp run typecheck`, not `npx tsc`; it caches per package. Both run tsc-rs (`typescript` is the `@tsc-rs/typescript` drop-in).
104104
- Run `node -e` snippets from `apps/server` or the owning package. `effect` does not resolve from the repo root.
105105
- Test meaningful logic or observable behavior. Do not render components to static markup to assert props or attributes, or add tests that merely assert callback wiring or mirror the implementation.
106+
- [Testing](docs/internals/testing.md) carries these same test rules, plus review guidance, for review bots. Change both together.
106107
- **Do not run repo-wide checks.** No `vp check`, no `vp run -r test`, no `vp run -r typecheck` unless I ask. CI owns the full suite.
107108
- Backend behavior changes ship with focused tests for that behavior.
108109
- Proof for a bug fix depends on the bug. Logic, data, state, and protocol bugs get a failing test first (the fewest that fail on `main` for that reason, in the module's existing test file), then the fix. Purely visual bugs (spacing, colour, alignment, a layout shift) get before/after captures as their proof and no test: do not add UI tests for nitpicks, and do not ask for one in review when a capture already shows it. A server-only fix with no visible surface ships the test plus a short runtime transcript.
@@ -136,6 +137,10 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
136137

137138
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.
138139

140+
## Evals
141+
142+
`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.
143+
139144
## Pull requests
140145

141146
- 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: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@
7373
"@t3tools/mobile-review-diff-native": "file:./modules/t3-review-diff",
7474
"@t3tools/mobile-source-text": "file:./modules/t3-source-text",
7575
"@t3tools/mobile-terminal-native": "file:./modules/t3-terminal",
76-
"@t3tools/provider-acp-registry": "workspace:*",
77-
"@t3tools/provider-core": "workspace:*",
78-
"@t3tools/provider-cursor": "workspace:*",
79-
"@t3tools/provider-grok": "workspace:*",
80-
"@t3tools/provider-muse": "workspace:*",
81-
"@t3tools/provider-opencode": "workspace:*",
82-
"@t3tools/provider-pi": "workspace:*",
8376
"@t3tools/shared": "workspace:*",
8477
"@tabler/icons-react-native": "^3.44.0",
8578
"clsx": "^2.1.1",

‎apps/mobile/src/App.tsx‎

Lines changed: 107 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,25 @@ 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+
pruneIncomingShareImports,
30+
startIncomingShareInbox,
31+
} from "./features/sharing/IncomingShareProvider";
32+
import {
33+
installAgentNotificationNavigation,
34+
setAgentNotificationPathname,
35+
} from "./features/agent-awareness/notificationNavigation";
36+
import {
37+
installAppShortcuts,
38+
recordAppShortcutNavigationState,
39+
} from "./features/shortcuts/appShortcutsRuntime";
2340
import {
2441
AppearancePreferencesProvider,
42+
installAppearanceRuntime,
2543
useAppearancePreferences,
2644
} from "./features/settings/appearance/AppearancePreferencesProvider";
27-
import { RootStack } from "./Stack";
45+
import { RootStack, workspaceLocationFromState } from "./Stack";
2846
import { appAtomRegistry } from "./state/atom-registry";
2947
import { subscribeComposerDraftModelReconciliation } from "./state/use-composer-drafts";
3048
import { environmentThreadShells } from "./state/threads";
@@ -38,9 +56,9 @@ import {
3856
type FoundationHotModule,
3957
} from "./lib/foundation-fast-refresh";
4058
import { useMobileNavigationTheme } from "./lib/useMobileNavigationTheme";
41-
import { useUiRuntimeMemoryWarningGc } from "./lib/useUiRuntimeMemoryWarningGc";
59+
import { installUiRuntimeMemoryWarningGc } from "./lib/useUiRuntimeMemoryWarningGc";
4260
import { SubscriptionUsageCoordinator } from "./widgets/SubscriptionUsageCoordinator";
43-
import { VoiceInputProvider } from "./features/voice-input/VoiceInputProvider";
61+
import { installSubscriptionUsageRefresh } from "./widgets/useSubscriptionUsage";
4462
import { GlobalVoiceInputControl } from "./features/voice-input/GlobalVoiceInputControl";
4563
import { restoreSettingsLinkState } from "./features/settings/settings-navigation";
4664
import {
@@ -51,6 +69,13 @@ import {
5169
} from "./features/workspace/workspace-selection-store";
5270
import { workspaceDetailLinkAction } from "./features/workspace/workspace-detail-selection";
5371
import { NativeLayoutMetricsProvider } from "./native/native-layout-metrics";
72+
import {
73+
attachRootNavigation,
74+
flushRootNavigationQueue,
75+
linkToRootPath,
76+
rootNavigationRef,
77+
} from "./lib/rootNavigation";
78+
import { pruneNewTaskBranchCheckouts } from "./features/threads/NewTaskDraftRouteScreen";
5479

5580
import "../global.css";
5681

@@ -61,6 +86,20 @@ if (process.env.EXPO_PUBLIC_SHOWCASE === "1") {
6186
void SplashScreen.preventAutoHideAsync().catch(() => {});
6287
void hydrateWorkspaceSelections();
6388

89+
const linkingConfig = {
90+
initialRouteName: "Home",
91+
screens: createPathConfigForStaticNavigation(RootStack, { initialRouteName: "Home" }) ?? {},
92+
} as const;
93+
94+
function getAppStateFromPath(path: string, options: Parameters<typeof getStateFromPath>[1]) {
95+
return takeScheduledTaskNewLink(
96+
restoreSettingsLinkState(
97+
restoreDraftLinkState(getStateFromPath(path, options), path),
98+
settingsLinkPage(),
99+
),
100+
);
101+
}
102+
64103
const appLinking = {
65104
prefixes: [Linking.createURL("/"), "t3code://", "t3code-dev://", "t3code-preview://"],
66105
config: { initialRouteName: "Home" },
@@ -73,25 +112,58 @@ const appLinking = {
73112
// Our router handles the selection; React Navigation's type only lists its own actions.
74113
(workspaceDetailLinkAction(state) as ReturnType<typeof getActionFromState>) ??
75114
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-
),
115+
getStateFromPath: getAppStateFromPath,
83116
};
84117

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

88145
declare const module: { readonly hot?: FoundationHotModule } | undefined;
89146

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

96168
function SplashScreenCoordinator() {
97169
const { isReady } = useAppearancePreferences();
@@ -104,18 +176,6 @@ function SplashScreenCoordinator() {
104176
}
105177

106178
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-
119179
return (
120180
<RegistryContext.Provider value={appAtomRegistry}>
121181
<CloudAuthProvider>
@@ -138,27 +198,23 @@ function AppContent() {
138198
<GestureHandlerRootView className="flex-1">
139199
<KeyboardProvider statusBarTranslucent>
140200
<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>
201+
<StatusBar barStyle={themeAppearance === "dark" ? "light-content" : "dark-content"} />
202+
{/* native-stack needs the theme's dark flag to select dark native headers. */}
203+
<GlobalVoiceInputControl>
204+
<NativeLayoutMetricsProvider>
205+
<Navigation
206+
ref={attachRootNavigation}
207+
linking={appLinking}
208+
onReady={handleNavigationReady}
209+
theme={navigationTheme}
210+
onStateChange={handleNavigationStateChange}
211+
/>
212+
<Dialog.Host />
213+
<ThreadArrangementHost />
214+
<ProjectChipIconRasterizer />
215+
</NativeLayoutMetricsProvider>
216+
</GlobalVoiceInputControl>
217+
<OverlayPortalHost />
162218
</SafeAreaProvider>
163219
</KeyboardProvider>
164220
</GestureHandlerRootView>

0 commit comments

Comments
 (0)