Skip to content

Commit ad98157

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-25639
2 parents 7bfb5b6 + 2ad853a commit ad98157

364 files changed

Lines changed: 18794 additions & 7307 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.

‎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: 47 additions & 30 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,10 @@ 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,
1112
createStaticNavigation,
1213
getActionFromState,
1314
getStateFromPath,
15+
type NavigationState,
1416
} from "@react-navigation/native";
1517

1618
import { RegistryContext } from "@effect/atom-react";
@@ -19,9 +21,13 @@ import { ThreadArrangementHost } from "./features/threads/ThreadArrangementSheet
1921
import * as Dialog from "./components/ui/Dialog";
2022
import { CloudAuthProvider } from "./features/cloud/CloudAuthProvider";
2123
import { prepareNativeShowcaseCapture } from "./features/showcase/nativeShowcaseScene";
22-
import { IncomingShareProvider } from "./features/sharing/IncomingShareProvider";
24+
import {
25+
presentPendingIncomingShare,
26+
startIncomingShareInbox,
27+
} from "./features/sharing/IncomingShareProvider";
2328
import {
2429
AppearancePreferencesProvider,
30+
installAppearanceRuntime,
2531
useAppearancePreferences,
2632
} from "./features/settings/appearance/AppearancePreferencesProvider";
2733
import { RootStack } from "./Stack";
@@ -38,8 +44,9 @@ import {
3844
type FoundationHotModule,
3945
} from "./lib/foundation-fast-refresh";
4046
import { useMobileNavigationTheme } from "./lib/useMobileNavigationTheme";
41-
import { useUiRuntimeMemoryWarningGc } from "./lib/useUiRuntimeMemoryWarningGc";
47+
import { installUiRuntimeMemoryWarningGc } from "./lib/useUiRuntimeMemoryWarningGc";
4248
import { SubscriptionUsageCoordinator } from "./widgets/SubscriptionUsageCoordinator";
49+
import { installSubscriptionUsageRefresh } from "./widgets/useSubscriptionUsage";
4350
import { GlobalVoiceInputControl } from "./features/voice-input/GlobalVoiceInputControl";
4451
import { restoreSettingsLinkState } from "./features/settings/settings-navigation";
4552
import {
@@ -50,6 +57,8 @@ import {
5057
} from "./features/workspace/workspace-selection-store";
5158
import { workspaceDetailLinkAction } from "./features/workspace/workspace-detail-selection";
5259
import { NativeLayoutMetricsProvider } from "./native/native-layout-metrics";
60+
import { attachRootNavigation, rootNavigationRef } from "./lib/rootNavigation";
61+
import { pruneNewTaskBranchCheckouts } from "./features/threads/NewTaskDraftRouteScreen";
5362

5463
import "../global.css";
5564

@@ -82,15 +91,37 @@ const appLinking = {
8291
};
8392

8493
const Navigation = createStaticNavigation(RootStack);
85-
const navigationRef = createNavigationContainerRef();
94+
95+
function handleNavigationStateChange(state: NavigationState | undefined): void {
96+
recordWorkspaceSelections(state);
97+
if (state) pruneNewTaskBranchCheckouts(state);
98+
presentPendingIncomingShare();
99+
}
100+
101+
function handleNavigationReady(): void {
102+
handleNavigationStateChange(rootNavigationRef.getRootState());
103+
}
86104

87105
declare const module: { readonly hot?: FoundationHotModule } | undefined;
88106

89-
const disposePermissionUpdateNotice = installPermissionUpdateNotice();
90-
disposeOnFoundationReplace(
91-
typeof module === "undefined" ? undefined : module.hot,
92-
disposePermissionUpdateNotice,
93-
);
107+
const appServiceDisposers = [
108+
installUiRuntimeMemoryWarningGc(),
109+
subscribeComposerDraftModelReconciliation({
110+
registry: appAtomRegistry,
111+
threadShellAtom: environmentThreadShells.threadShellAtom,
112+
threadRefsAtom: environmentThreadShells.threadRefsAtom,
113+
shellStateAtom: environmentShell.stateAtom,
114+
}),
115+
installAppearanceRuntime(),
116+
installSubscriptionUsageRefresh(),
117+
installPermissionUpdateNotice(),
118+
installThreadOutboxDelivery(),
119+
installComposerAttachmentUploads(),
120+
startIncomingShareInbox(),
121+
];
122+
disposeOnFoundationReplace(typeof module === "undefined" ? undefined : module.hot, () => {
123+
for (const dispose of appServiceDisposers) dispose();
124+
});
94125

95126
function SplashScreenCoordinator() {
96127
const { isReady } = useAppearancePreferences();
@@ -103,18 +134,6 @@ function SplashScreenCoordinator() {
103134
}
104135

105136
export default function App() {
106-
useUiRuntimeMemoryWarningGc();
107-
useEffect(
108-
() =>
109-
subscribeComposerDraftModelReconciliation({
110-
registry: appAtomRegistry,
111-
threadShellAtom: environmentThreadShells.threadShellAtom,
112-
threadRefsAtom: environmentThreadShells.threadRefsAtom,
113-
shellStateAtom: environmentShell.stateAtom,
114-
}),
115-
[],
116-
);
117-
118137
return (
119138
<RegistryContext.Provider value={appAtomRegistry}>
120139
<CloudAuthProvider>
@@ -141,15 +160,13 @@ function AppContent() {
141160
{/* native-stack needs the theme's dark flag to select dark native headers. */}
142161
<GlobalVoiceInputControl>
143162
<NativeLayoutMetricsProvider>
144-
<IncomingShareProvider>
145-
<Navigation
146-
ref={navigationRef}
147-
linking={appLinking}
148-
onReady={() => recordWorkspaceSelections(navigationRef.getRootState())}
149-
theme={navigationTheme}
150-
onStateChange={recordWorkspaceSelections}
151-
/>
152-
</IncomingShareProvider>
163+
<Navigation
164+
ref={attachRootNavigation}
165+
linking={appLinking}
166+
onReady={handleNavigationReady}
167+
theme={navigationTheme}
168+
onStateChange={handleNavigationStateChange}
169+
/>
153170
<Dialog.Host />
154171
<ThreadArrangementHost />
155172
<ProjectChipIconRasterizer />

0 commit comments

Comments
 (0)