Skip to content

Commit fdcf43b

Browse files
Merge remote-tracking branch 'origin/main' into pr-25666
2 parents 34668f0 + 401b017 commit fdcf43b

26 files changed

Lines changed: 611 additions & 494 deletions
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

‎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/mobile/src/App.tsx‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ import { ThreadArrangementHost } from "./features/threads/ThreadArrangementSheet
2121
import * as Dialog from "./components/ui/Dialog";
2222
import { CloudAuthProvider } from "./features/cloud/CloudAuthProvider";
2323
import { prepareNativeShowcaseCapture } from "./features/showcase/nativeShowcaseScene";
24-
import { IncomingShareProvider } from "./features/sharing/IncomingShareProvider";
24+
import {
25+
presentPendingIncomingShare,
26+
startIncomingShareInbox,
27+
} from "./features/sharing/IncomingShareProvider";
2528
import {
2629
AppearancePreferencesProvider,
30+
installAppearanceRuntime,
2731
useAppearancePreferences,
2832
} from "./features/settings/appearance/AppearancePreferencesProvider";
2933
import { RootStack } from "./Stack";
@@ -91,6 +95,7 @@ const Navigation = createStaticNavigation(RootStack);
9195
function handleNavigationStateChange(state: NavigationState | undefined): void {
9296
recordWorkspaceSelections(state);
9397
if (state) pruneNewTaskBranchCheckouts(state);
98+
presentPendingIncomingShare();
9499
}
95100

96101
function handleNavigationReady(): void {
@@ -107,10 +112,12 @@ const appServiceDisposers = [
107112
threadRefsAtom: environmentThreadShells.threadRefsAtom,
108113
shellStateAtom: environmentShell.stateAtom,
109114
}),
115+
installAppearanceRuntime(),
110116
installSubscriptionUsageRefresh(),
111117
installPermissionUpdateNotice(),
112118
installThreadOutboxDelivery(),
113119
installComposerAttachmentUploads(),
120+
startIncomingShareInbox(),
114121
];
115122
disposeOnFoundationReplace(typeof module === "undefined" ? undefined : module.hot, () => {
116123
for (const dispose of appServiceDisposers) dispose();
@@ -153,15 +160,13 @@ function AppContent() {
153160
{/* native-stack needs the theme's dark flag to select dark native headers. */}
154161
<GlobalVoiceInputControl>
155162
<NativeLayoutMetricsProvider>
156-
<IncomingShareProvider>
157-
<Navigation
158-
ref={attachRootNavigation}
159-
linking={appLinking}
160-
onReady={handleNavigationReady}
161-
theme={navigationTheme}
162-
onStateChange={handleNavigationStateChange}
163-
/>
164-
</IncomingShareProvider>
163+
<Navigation
164+
ref={attachRootNavigation}
165+
linking={appLinking}
166+
onReady={handleNavigationReady}
167+
theme={navigationTheme}
168+
onStateChange={handleNavigationStateChange}
169+
/>
165170
<Dialog.Host />
166171
<ThreadArrangementHost />
167172
<ProjectChipIconRasterizer />

‎apps/mobile/src/Stack.tsx‎

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
createNativeStackScreen,
1616
type NativeStackNavigationOptions,
1717
} from "@react-navigation/native-stack";
18-
import { useEffect, useRef, type ReactNode } from "react";
18+
import type { ReactNode } from "react";
1919
import { Platform, Pressable, ScrollView, StyleSheet, useWindowDimensions } from "react-native";
2020
import { useResolveClassNames } from "uniwind";
2121

@@ -139,20 +139,12 @@ import {
139139
SettingsLegalDocumentExternalHeaderButton,
140140
} from "./features/settings/components/SettingsLegalDocumentRouteScreen";
141141
import { useAppShortcuts } from "./features/shortcuts/useAppShortcuts";
142-
import { useIncomingShare } from "./features/sharing/IncomingShareProvider";
143-
import {
144-
EMPTY_INCOMING_SHARE_PRESENTATION_STATE,
145-
transitionIncomingSharePresentation,
146-
} from "./features/sharing/incoming-share-presentation";
147142
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native/native-glass";
148143
import { deriveLayout } from "./lib/layout";
149144
import { useNativeLayoutMetrics } from "./native/native-layout-metrics";
150145
import { nativeHeaderScrollEdgeEffects } from "./native/StackHeader";
151146
import { HORIZONTAL_FORM_SHEET_OPTIONS, formSheetDetents } from "./native/sheet-surface";
152-
import {
153-
selectWorkspaceDetail,
154-
workspaceDetailRouter,
155-
} from "./features/workspace/workspace-detail-selection";
147+
import { workspaceDetailRouter } from "./features/workspace/workspace-detail-selection";
156148

157149
const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
158150

@@ -498,9 +490,6 @@ function RootStackLayout(props: {
498490
readonly children: React.ReactNode;
499491
readonly state: NavigationState;
500492
}) {
501-
const navigation = useNavigation();
502-
const { pendingShare } = useIncomingShare();
503-
const sharePresentationRef = useRef(EMPTY_INCOMING_SHARE_PRESENTATION_STATE);
504493
const path = getPathFromState(props.state, navigationPathConfig);
505494
const pathname = path.startsWith("/") ? path : `/${path}`;
506495
const workspaceLocation = workspaceLocationFromState(props.state);
@@ -519,22 +508,6 @@ function RootStackLayout(props: {
519508
useAgentNotificationNavigation(workspaceLocation.pathname);
520509
useConnectOnboardingNavigation();
521510
useAppShortcuts(props.state);
522-
useEffect(() => {
523-
const transition = transitionIncomingSharePresentation(sharePresentationRef.current, {
524-
isShareSheetPresented: isDraftThreadRoute(props.state.routes[props.state.index]),
525-
pendingShareId: pendingShare?.id ?? null,
526-
});
527-
sharePresentationRef.current = transition.state;
528-
if (!transition.shareIdToPresent) {
529-
return;
530-
}
531-
navigation.dispatch(
532-
selectWorkspaceDetail({
533-
name: "Thread",
534-
params: { draft: { incomingShareId: transition.shareIdToPresent } },
535-
}),
536-
);
537-
}, [navigation, pendingShare, props.state]);
538511

539512
return (
540513
<NewTaskFlowProvider active={isDraftThreadRoute(draftRoute)} routeDraftId={routeDraftId}>

0 commit comments

Comments
 (0)