Skip to content

Commit 3927a1d

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-26400
2 parents da17a0e + 5211acf commit 3927a1d

111 files changed

Lines changed: 3590 additions & 1906 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/workflows/release-desktop.yml‎

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,29 @@ jobs:
163163
env:
164164
pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
165165

166+
# The CLI archive and the staged app install without a lockfile, so they
167+
# ask the registry about every package and fetch platform packages the
168+
# workspace store lacks. They share this registry metadata and store. A
169+
# new week starts cold, which bounds how stale cached ranges can get.
170+
- name: Resolve staged install cache
171+
id: stage_pnpm
172+
shell: bash
173+
run: |
174+
echo "dir=$RUNNER_TEMP/desktop-stage-pnpm" >> "$GITHUB_OUTPUT"
175+
echo "prefix=desktop-stage-pnpm-v2-${{ inputs.platform }}-${{ inputs.arch }}-$(date -u +%G-%V)-" >> "$GITHUB_OUTPUT"
176+
177+
- name: Restore staged install cache
178+
id: stage_pnpm_cache
179+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
180+
with:
181+
path: ${{ steps.stage_pnpm.outputs.dir }}
182+
key: ${{ steps.stage_pnpm.outputs.prefix }}${{ github.run_id }}-${{ github.run_attempt }}
183+
restore-keys: ${{ steps.stage_pnpm.outputs.prefix }}
184+
185+
- name: Mark staged install cache
186+
shell: bash
187+
run: mkdir -p "${{ steps.stage_pnpm.outputs.dir }}" && touch "$RUNNER_TEMP/desktop-stage-pnpm.marker"
188+
166189
- name: Cache resource monitor
167190
id: resource_monitor_cache
168191
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
@@ -371,6 +394,9 @@ jobs:
371394
if: inputs.cli_archive
372395
shell: bash
373396
env:
397+
pnpm_config_cache_dir: ${{ steps.stage_pnpm.outputs.dir }}/cache
398+
pnpm_config_store_dir: ${{ steps.stage_pnpm.outputs.dir }}/store
399+
pnpm_config_prefer_offline: "true"
374400
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
375401
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
376402
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
@@ -490,7 +516,10 @@ jobs:
490516
- name: Build desktop artifact
491517
shell: bash
492518
env:
493-
pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
519+
# pnpm only goes to the registry for packages or versions the cache lacks.
520+
pnpm_config_cache_dir: ${{ steps.stage_pnpm.outputs.dir }}/cache
521+
pnpm_config_store_dir: ${{ steps.stage_pnpm.outputs.dir }}/store
522+
pnpm_config_prefer_offline: "true"
494523
T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR: true
495524
T3CODE_DESKTOP_REUSE_LINUX_CAPTURE_HELPERS: ${{ steps.capture_helper_cache.outputs.cache-hit == 'true' }}
496525
CSC_LINK: ${{ secrets.CSC_LINK }}
@@ -575,6 +604,23 @@ jobs:
575604
576605
vp run dist:desktop:artifact "${args[@]}"
577606
607+
# Warm installs only touch the store index, so new content means a fetch.
608+
- name: Check staged install cache for new content
609+
id: stage_pnpm_changed
610+
shell: bash
611+
run: |
612+
dir="${{ steps.stage_pnpm.outputs.dir }}"
613+
new=$(find "$dir/cache/v12" "$dir/store/v11/files" -type f -newer "$RUNNER_TEMP/desktop-stage-pnpm.marker" 2>/dev/null | wc -l | tr -d ' ')
614+
echo "Staged installs added $new cached files."
615+
echo "changed=$([[ "$new" -gt 0 ]] && echo true || echo false)" >> "$GITHUB_OUTPUT"
616+
617+
- name: Save staged install cache
618+
if: steps.stage_pnpm_changed.outputs.changed == 'true'
619+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
620+
with:
621+
path: ${{ steps.stage_pnpm.outputs.dir }}
622+
key: ${{ steps.stage_pnpm_cache.outputs.cache-primary-key }}
623+
578624
# A build can package fine and still not open (a missing module in the
579625
# backend or the bundle). This launches the app from the shipped
580626
# AppImage or DMG.

‎apps/desktop/src/settings/DesktopClientSettings.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const clientSettings: ClientSettings = {
3434
confirmThreadDelete: false,
3535
confirmThreadUnpin: false,
3636
contextWindowMeterEnabled: false,
37-
composerCollapseOnScroll: true,
3837
diffFilesCollapsed: true,
3938
diffIgnoreWhitespace: true,
4039
diffLayout: "stacked",
@@ -64,6 +63,7 @@ const clientSettings: ClientSettings = {
6463
sidebarProjectSortOrder: "manual",
6564
sidebarThreadSortOrder: "created_at",
6665
boringSidebarEnabled: false,
66+
boringSidebarMultilineRows: false,
6767
legacySidebarEnabled: false,
6868
sidebarWorkingShelfEnabled: false,
6969
loadBalancingEnabled: false,

‎apps/mobile/metro.config.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ async function generateMobileThirdPartyLicenses() {
5656
const manifest = await generateThirdPartyLicenseManifest({
5757
configFile: path.join(workspaceRoot, "third-party-licenses.config.json"),
5858
packageManifests: [{ bundle: "mobile", path: path.join(__dirname, "package.json") }],
59-
allowMissingGeneratedNotices:
60-
process.env.NODE_ENV !== "production" &&
61-
process.env.EAS_BUILD !== "true" &&
62-
process.env.T3CODE_LICENSES_STRICT !== "1",
6359
});
6460

6561
await Promise.all([

‎apps/mobile/src/features/threads/LinkRequestCard.tsx‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
3030
import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
3131
import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
3232
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
33-
import { useLinkableMachines } from "../../state/peerLinks";
33+
import { peerLinkEnvironment, useLinkableMachines } from "../../state/peerLinks";
3434
import { mintPairingCodeOn } from "../../state/peerPairingCode";
35-
import { serverEnvironment } from "../../state/server";
3635
import { useEnvironmentScope, usePreparedConnection } from "../../state/session";
3736
import { useAtomCommand } from "../../state/use-atom-command";
3837
import { ListChoiceRow as SettingsChoiceRow } from "../../components/ui/ListChoiceRow";
@@ -107,13 +106,13 @@ function PendingLinkRequest(props: {
107106
const [open, setOpen] = useState(false);
108107
const [declining, setDeclining] = useState(false);
109108
const [error, setError] = useState<string | null>(null);
110-
const answer = useAtomCommand(serverEnvironment.answerLinkRequest, {
109+
const answer = useAtomCommand(peerLinkEnvironment.answerRequest, {
111110
label: "decline link request",
112111
reportFailure: false,
113112
reportDefect: false,
114113
});
115114
const canAnswer = useAtomValue(
116-
serverEnvironment.answerLinkRequest.permissionAtom(props.environmentId),
115+
peerLinkEnvironment.answerRequest.permissionAtom(props.environmentId),
117116
);
118117
const target = linkRequestTargetName(item);
119118

@@ -244,7 +243,7 @@ function LinkRequestSheet(props: {
244243
const [mintFailed, setMintFailed] = useState<ReadonlySet<EnvironmentId>>(new Set());
245244
// Submit then a tap can both run before a re-render; this guard is synchronous.
246245
const inFlight = useRef(false);
247-
const answer = useAtomCommand(serverEnvironment.answerLinkRequest, {
246+
const answer = useAtomCommand(peerLinkEnvironment.answerRequest, {
248247
label: "answer link request",
249248
// The failure cause holds the request, and with it the code; keep it out of the console.
250249
reportFailure: false,

‎apps/mobile/src/features/threads/ThreadFeed.tsx‎

Lines changed: 95 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,92 @@ function compactionLabel(label: string, title: string | undefined) {
12081208
: label;
12091209
}
12101210

1211+
function RunFoldButton({
1212+
entry,
1213+
environmentId,
1214+
threadId,
1215+
onToggle,
1216+
rowSizing,
1217+
iconColor,
1218+
}: {
1219+
entry: Extract<ThreadFeedEntry, { type: "run-fold" }>;
1220+
environmentId: EnvironmentId;
1221+
threadId: ThreadId;
1222+
onToggle: (runId: RunId) => void;
1223+
rowSizing: ReturnType<typeof deriveThreadWorkLogSizing>;
1224+
iconColor: ColorValue;
1225+
}) {
1226+
const loadWork = useAtomCommand(threadEnvironment.loadEarlierHistory, { reportFailure: false });
1227+
const anchorsKey = entry.deferredWorkItemIds?.join("\n") ?? "";
1228+
const [failed, setFailed] = useState(false);
1229+
const load = () => {
1230+
if (!anchorsKey) return;
1231+
void Promise.all(
1232+
anchorsKey
1233+
.split("\n")
1234+
.map((workAnchorId) => loadWork({ environmentId, input: { threadId, workAnchorId } })),
1235+
).then((results) =>
1236+
setFailed(
1237+
results.some((result) => result._tag === "Failure" || result.value._tag === "error"),
1238+
),
1239+
);
1240+
};
1241+
const loadOnExpand = useEffectEvent(load);
1242+
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Restored expanded folds load their deferred server history on mount.
1243+
useEffect(() => {
1244+
if (entry.expanded && anchorsKey && environmentId && threadId) loadOnExpand();
1245+
}, [entry.expanded, anchorsKey, environmentId, threadId]);
1246+
const error = anchorsKey && failed ? "Couldn't load work. Tap to retry." : null;
1247+
const loading = entry.expanded && anchorsKey !== "" && !failed;
1248+
const toggle = () => {
1249+
setFailed(false);
1250+
if (error && entry.expanded) load();
1251+
else onToggle(entry.runId);
1252+
};
1253+
1254+
return (
1255+
<View className="min-w-0 flex-1">
1256+
<Pressable
1257+
accessibilityRole="button"
1258+
accessibilityState={{ expanded: entry.expanded, busy: loading }}
1259+
onPress={toggle}
1260+
hitSlop={4}
1261+
className="min-h-11 min-w-0 flex-1 flex-row items-center gap-2"
1262+
style={{ minHeight: Math.max(TURN_FOLD_HEIGHT - 3.5, rowSizing.estimatedRowHeight) }}
1263+
>
1264+
<Text
1265+
key={rowSizing.textSizeKey}
1266+
numberOfLines={1}
1267+
className="shrink font-t3-medium text-sm tabular-nums text-foreground-muted"
1268+
>
1269+
{entry.label}
1270+
{error ? ` · ${error}` : ""}
1271+
</Text>
1272+
<ThreadDisclosureChevron
1273+
expanded={entry.expanded}
1274+
collapsedDirection="right"
1275+
size={15}
1276+
tintColor={iconColor}
1277+
/>
1278+
</Pressable>
1279+
{loading ? (
1280+
<View
1281+
accessible={false}
1282+
importantForAccessibility="no-hide-descendants"
1283+
className="gap-2 px-1 pb-2"
1284+
>
1285+
{(["40%", "60%", "33%"] as const).map((width) => (
1286+
<View key={width} className="flex-row items-center gap-2">
1287+
<View className="size-3 rounded bg-subtle-strong" />
1288+
<View className="h-2.5 rounded-full bg-subtle-strong" style={{ width }} />
1289+
</View>
1290+
))}
1291+
</View>
1292+
) : null}
1293+
</View>
1294+
);
1295+
}
1296+
12111297
function renderFeedEntry(
12121298
info: { item: ThreadFeedRow; index: number },
12131299
props: Pick<
@@ -1279,30 +1365,15 @@ function renderFeedEntry(
12791365
if (entry.type === "run-fold") {
12801366
return (
12811367
<View className="mb-1 flex-row items-center border-b border-border-subtle px-2">
1282-
<Pressable
1283-
accessibilityRole="button"
1284-
accessibilityState={{ expanded: entry.expanded }}
1285-
onPress={() => props.onToggleTurnFold(entry.runId)}
1286-
hitSlop={4}
1287-
className="min-h-11 min-w-0 flex-1 flex-row items-center gap-2"
1288-
style={{
1289-
minHeight: Math.max(TURN_FOLD_HEIGHT - 3.5, props.workRowSizing.estimatedRowHeight),
1290-
}}
1291-
>
1292-
<Text
1293-
key={props.workRowSizing.textSizeKey}
1294-
numberOfLines={1}
1295-
className="shrink font-t3-medium text-sm tabular-nums text-foreground-muted"
1296-
>
1297-
{entry.label}
1298-
</Text>
1299-
<ThreadDisclosureChevron
1300-
expanded={entry.expanded}
1301-
collapsedDirection="right"
1302-
size={15}
1303-
tintColor={iconSubtleColor}
1304-
/>
1305-
</Pressable>
1368+
<RunFoldButton
1369+
key={entry.id}
1370+
entry={entry}
1371+
environmentId={props.environmentId}
1372+
threadId={props.threadId}
1373+
onToggle={props.onToggleTurnFold}
1374+
rowSizing={props.workRowSizing}
1375+
iconColor={iconSubtleColor}
1376+
/>
13061377
{entry.checkpointSummary ? (
13071378
<TurnDiffStat
13081379
checkpoint={entry.checkpointSummary}

‎apps/mobile/src/features/threads/thread-subagent-group.tsx‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
EnvironmentId,
88
OrchestrationV2Subagent,
99
OrchestrationV2TurnItem,
10+
ServerProvider,
1011
} from "@t3tools/contracts";
1112
import { Pressable, View, type ColorValue } from "react-native";
1213

@@ -41,14 +42,22 @@ function SubagentElapsed({ agents }: { readonly agents: ReadonlyArray<AgentTimin
4142

4243
function SubagentAvatar(props: {
4344
readonly item: SubagentItem;
44-
readonly iconUrl?: string | null | undefined;
45+
readonly provider: ServerProvider | undefined;
4546
}) {
47+
// A remote task's own driver is only a "remote" label.
48+
const driver =
49+
props.provider?.driver ??
50+
(props.item.remoteChild === undefined ? props.item.driver : undefined);
4651
return (
4752
<View
4853
accessible={false}
4954
className="h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border bg-card"
5055
>
51-
<ProviderIcon provider={props.item.driver} iconUrl={props.iconUrl} size={15} />
56+
{driver === undefined ? (
57+
<SymbolView name="sparkles" size={13} tintColorClassName="accent-icon-muted" />
58+
) : (
59+
<ProviderIcon provider={driver} iconUrl={props.provider?.iconUrl} size={15} />
60+
)}
5261
</View>
5362
);
5463
}
@@ -91,11 +100,11 @@ export function ThreadSubagentGroup(props: {
91100
const expanded = props.expandedRows[props.anchorKey] ?? false;
92101
const serverConfigs = useServerConfigs();
93102
// A task in a linked environment runs a provider instance of that environment.
94-
const iconUrl = (item: SubagentItem) =>
103+
const providerOf = (item: SubagentItem) =>
95104
(item.remoteChild === undefined
96105
? config
97106
: serverConfigs.get(item.remoteChild.environmentId)
98-
)?.providers.find((provider) => provider.instanceId === item.providerInstanceId)?.iconUrl;
107+
)?.providers.find((provider) => provider.instanceId === item.providerInstanceId);
99108
return (
100109
<WorkLogBlock>
101110
{grouped ? (
@@ -109,7 +118,7 @@ export function ThreadSubagentGroup(props: {
109118
<View className="flex-row items-center">
110119
{agents.slice(0, 3).map((agent, index) => (
111120
<View key={agent.item.id} style={{ marginLeft: index === 0 ? 0 : -7 }}>
112-
<SubagentAvatar item={agent.item} iconUrl={iconUrl(agent.item)} />
121+
<SubagentAvatar item={agent.item} provider={providerOf(agent.item)} />
113122
</View>
114123
))}
115124
{agents.length > 3 ? (

‎apps/mobile/src/lib/threadActivity.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,21 @@ describe("buildThreadFeed", () => {
809809
"message",
810810
"message",
811811
]);
812+
const anchor = {
813+
...command(),
814+
deferredWork: { cursor: "old-work", itemCount: 100, lastOrdinal: 100 },
815+
};
816+
const deferredFeed = buildThreadFeed([projected(userMessage(), 0), projected(anchor, 1)]);
817+
const running = { ...latestRun, status: "running" as const, completedAt: null };
818+
const deferredRows = deriveThreadFeedPresentation(deferredFeed, running, new Set());
819+
const disclosure = deferredRows.find((entry) => entry.type === "run-fold");
820+
expect(disclosure).toMatchObject({ deferredWorkItemIds: [anchor.id], expanded: false });
821+
if (disclosure?.type !== "run-fold") throw new Error("Expected deferred work disclosure");
822+
expect(
823+
deriveThreadFeedPresentation(deferredFeed, running, new Set([disclosure.runId])).some(
824+
(entry) => entry.type === "activity-group",
825+
),
826+
).toBe(true);
812827
expect(expanded[4]).toMatchObject({ message: { id: middle.messageId, text: middle.text } });
813828

814829
const active = deriveThreadFeedPresentation(

0 commit comments

Comments
 (0)