Skip to content

Commit bc1b535

Browse files
authored
Merge branch 'main' into fix/pull-failure-detail
2 parents bdee946 + 54084ae commit bc1b535

22 files changed

Lines changed: 944 additions & 557 deletions

‎apps/desktop/src/preview/Manager.test.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ describe("PreviewManager", () => {
16011601
),
16021602
);
16031603

1604-
effectIt.effect("emulates prefers-color-scheme and re-applies it across webview swaps", () =>
1604+
effectIt.effect("re-applies opaque base and color scheme across webview swaps", () =>
16051605
withManager((manager) =>
16061606
Effect.gen(function* () {
16071607
const makeWebContents = (id: number) => {
@@ -1650,6 +1650,16 @@ describe("PreviewManager", () => {
16501650
yield* manager.registerWebview("tab_scheme", 42);
16511651
yield* Effect.yieldNow;
16521652

1653+
// Guests start with a transparent base; dark-scheme pages need an opaque
1654+
// one or Chromium skips their dark canvas.
1655+
const opaqueBase = {
1656+
color: { r: 255, g: 255, b: 255, a: 1 },
1657+
};
1658+
expect(first.sendCommand).toHaveBeenCalledWith(
1659+
"Emulation.setDefaultBackgroundColorOverride",
1660+
opaqueBase,
1661+
);
1662+
16531663
yield* manager.setColorScheme("tab_scheme", "dark");
16541664

16551665
expect(first.sendCommand).toHaveBeenCalledWith("Emulation.setEmulatedMedia", {
@@ -1662,6 +1672,10 @@ describe("PreviewManager", () => {
16621672
yield* manager.registerWebview("tab_scheme", 43);
16631673
yield* Effect.yieldNow;
16641674

1675+
expect(replacement.sendCommand).toHaveBeenCalledWith(
1676+
"Emulation.setDefaultBackgroundColorOverride",
1677+
opaqueBase,
1678+
);
16651679
expect(replacement.sendCommand).toHaveBeenCalledWith("Emulation.setEmulatedMedia", {
16661680
features: [{ name: "prefers-color-scheme", value: "dark" }],
16671681
});

‎apps/desktop/src/preview/Manager.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,19 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
14181418
),
14191419
{ concurrency: "unbounded", discard: true },
14201420
);
1421+
// Electron gives `<webview>` guests a transparent base background, and
1422+
// Chromium only paints a dark canvas for dark color-scheme pages over an
1423+
// opaque base. Without this, dark-scheme pages with no background of
1424+
// their own (text/plain, e.g. .md files) render white text on white.
1425+
// White matches the webview's existing white backing, so light pages look
1426+
// the same; Chromium still swaps in its dark canvas for dark-scheme pages.
1427+
yield* attemptPromise(
1428+
{ operation: "initializeDebugger.defaultBackground", webContentsId: wc.id },
1429+
() =>
1430+
wcDebugger.sendCommand("Emulation.setDefaultBackgroundColorOverride", {
1431+
color: { r: 255, g: 255, b: 255, a: 1 },
1432+
}),
1433+
);
14211434
return [
14221435
control,
14231436
replaceMap(sessions, (copy) => {

‎apps/mobile/package.json‎

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
"@clerk/expo": "catalog:",
5050
"@effect/atom-react": "catalog:",
5151
"@expo-google-fonts/dm-sans": "^0.4.2",
52-
"@expo/metro-runtime": "~58.0.9",
53-
"@expo/ui": "~58.0.9",
52+
"@expo/metro-runtime": "~58.0.10",
53+
"@expo/ui": "~58.0.11",
5454
"@legendapp/list": "catalog:",
5555
"@material/material-color-utilities": "0.3.0",
5656
"@noble/curves": "catalog:",
@@ -74,41 +74,41 @@
7474
"clsx": "^2.1.1",
7575
"diff": "8.0.3",
7676
"effect": "catalog:",
77-
"expo": "58.0.0",
78-
"expo-asset": "~58.0.9",
79-
"expo-audio": "58.0.3",
80-
"expo-auth-session": "~58.0.6",
81-
"expo-blur": "58.0.2",
77+
"expo": "58.0.2",
78+
"expo-asset": "~58.0.10",
79+
"expo-audio": "58.0.4",
80+
"expo-auth-session": "~58.0.7",
81+
"expo-blur": "58.0.3",
8282
"expo-build-properties": "~58.0.9",
83-
"expo-camera": "~58.0.5",
84-
"expo-clipboard": "~58.0.2",
83+
"expo-camera": "~58.0.7",
84+
"expo-clipboard": "~58.0.3",
8585
"expo-constants": "~58.0.9",
86-
"expo-crypto": "~58.0.3",
87-
"expo-dev-client": "~58.0.9",
88-
"expo-device": "~58.0.3",
89-
"expo-document-picker": "~58.0.3",
90-
"expo-file-system": "~58.0.4",
91-
"expo-font": "~58.0.4",
86+
"expo-crypto": "~58.0.4",
87+
"expo-dev-client": "~58.0.10",
88+
"expo-device": "~58.0.5",
89+
"expo-document-picker": "~58.0.4",
90+
"expo-file-system": "~58.0.5",
91+
"expo-font": "~58.0.5",
9292
"expo-glass-effect": "58.0.3",
93-
"expo-haptics": "~58.0.3",
94-
"expo-image": "~58.0.8",
95-
"expo-image-manipulator": "~58.0.10",
96-
"expo-image-picker": "~58.0.9",
97-
"expo-keep-awake": "~58.0.2",
98-
"expo-linking": "~58.0.9",
99-
"expo-network": "~58.0.2",
100-
"expo-notifications": "~58.0.9",
93+
"expo-haptics": "~58.0.4",
94+
"expo-image": "~58.0.10",
95+
"expo-image-manipulator": "~58.0.11",
96+
"expo-image-picker": "~58.0.10",
97+
"expo-keep-awake": "~58.0.3",
98+
"expo-linking": "~58.0.10",
99+
"expo-network": "~58.0.3",
100+
"expo-notifications": "~58.0.11",
101101
"expo-paste-input": "^0.1.15",
102102
"expo-quick-actions": "^6.0.2",
103-
"expo-secure-store": "~58.0.1",
104-
"expo-sharing": "58.0.12",
105-
"expo-splash-screen": "~58.0.2",
106-
"expo-sqlite": "~58.0.7",
103+
"expo-secure-store": "~58.0.2",
104+
"expo-sharing": "58.0.13",
105+
"expo-splash-screen": "~58.0.4",
106+
"expo-sqlite": "~58.0.8",
107107
"expo-symbols": "~58.0.3",
108-
"expo-updates": "~58.0.11",
109-
"expo-video": "~58.0.5",
110-
"expo-web-browser": "~58.0.3",
111-
"expo-widgets": "58.0.9",
108+
"expo-updates": "~58.0.13",
109+
"expo-video": "~58.0.6",
110+
"expo-web-browser": "~58.0.4",
111+
"expo-widgets": "58.0.11",
112112
"react": "19.3.0",
113113
"react-dom": "19.3.0",
114114
"react-native": "0.88.0-rc.3",
@@ -133,14 +133,15 @@
133133
"@pierre/trees": "1.0.0-beta.4",
134134
"@types/react": "~19.3.0",
135135
"@types/react-dom": "~19.2.3",
136-
"babel-preset-expo": "~58.0.6",
136+
"babel-preset-expo": "~58.0.8",
137137
"tailwindcss": "^4.0.0",
138138
"typescript": "catalog:"
139139
},
140140
"expo": {
141141
"install": {
142142
"exclude": [
143-
"react-native-keyboard-controller"
143+
"react-native-keyboard-controller",
144+
"typescript"
144145
]
145146
},
146147
"autolinking": {

‎apps/mobile/src/features/cloud/cloudDebugLog.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ const logger = createDebugLogger("cloud", {
55
legacyGlobalFlag: "__T3_CLOUD_DEBUG__",
66
});
77

8-
export function isCloudDebugEnabled(): boolean {
9-
return logger.isEnabled();
10-
}
11-
128
export function cloudDebugLog(event: string, data?: Record<string, unknown>): void {
139
logger.log(event, data);
1410
}

‎apps/mobile/src/features/terminal/terminalDebugLog.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ const logger = createDebugLogger("terminal", {
1212
legacyGlobalFlag: "__T3_TERMINAL_DEBUG__",
1313
});
1414

15-
export function isTerminalDebugEnabled(): boolean {
16-
return logger.isEnabled();
17-
}
18-
1915
export function terminalDebugLog(message: string, data?: Record<string, unknown>): void {
2016
logger.log(message, data);
2117
}

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

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { MaterialListRow } from "../../components/MaterialListRow";
22
import type { VcsRef } from "@t3tools/client-runtime/state/vcs";
3-
import { resolveEnvironmentMachineKind } from "@t3tools/contracts";
3+
import { type EnvironmentId, resolveEnvironmentMachineKind } from "@t3tools/contracts";
4+
import * as Cause from "effect/Cause";
5+
import { AsyncResult } from "effect/unstable/reactivity";
46
import { LegendList } from "@legendapp/list/react-native";
57
import {
68
isAtomCommandInterrupted,
@@ -28,7 +30,8 @@ import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSym
2830
import { ThemedSwitch } from "../../components/ThemedSwitch";
2931
import { cn } from "../../lib/cn";
3032
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
31-
import { useServerConfigs } from "../../state/entities";
33+
import { useServerConfigs, waitForProject } from "../../state/entities";
34+
import { projectEnvironment } from "../../state/projects";
3235
import { useAtomCommand } from "../../state/use-atom-command";
3336
import { vcsEnvironment } from "../../state/vcs";
3437
import {
@@ -203,6 +206,38 @@ export function NewTaskEnvironmentPickerRouteScreen() {
203206
const navigation = useNavigation();
204207
const insets = useSafeAreaInsets();
205208
const serverConfigs = useServerConfigs();
209+
const ensureScratch = useAtomCommand(projectEnvironment.ensureScratch, {
210+
reportFailure: false,
211+
});
212+
const [movingToEnvironmentId, setMovingToEnvironmentId] = useState<EnvironmentId | null>(null);
213+
214+
// A thread without a project moves to the other machine's own Scratch
215+
// project, which is created there first if it does not exist yet.
216+
async function moveScratchDraft(environmentId: EnvironmentId): Promise<void> {
217+
setMovingToEnvironmentId(environmentId);
218+
try {
219+
const result = await ensureScratch({ environmentId, input: {} });
220+
if (AsyncResult.isFailure(result)) {
221+
const error = Cause.squash(result.cause);
222+
Alert.alert(
223+
"Could not switch machine",
224+
error instanceof Error
225+
? error.message
226+
: "The folder for threads without a project could not be created.",
227+
);
228+
return;
229+
}
230+
const project = await waitForProject({ environmentId, projectId: result.value.projectId });
231+
if (project === null) {
232+
Alert.alert("Could not switch machine", "It has not reached this device yet. Try again.");
233+
return;
234+
}
235+
flow.setProject(project);
236+
navigation.goBack();
237+
} finally {
238+
setMovingToEnvironmentId(null);
239+
}
240+
}
206241

207242
return (
208243
<View className="flex-1 bg-sheet" collapsable={false}>
@@ -243,9 +278,17 @@ export function NewTaskEnvironmentPickerRouteScreen() {
243278
/>
244279
}
245280
isLast={index === flow.environments.length - 1}
281+
disabled={movingToEnvironmentId !== null}
246282
onPress={() => {
247283
void Haptics.selectionAsync();
248-
flow.selectEnvironment(environment.environmentId);
284+
if (flow.isScratchDraft) {
285+
if (environment.environmentId !== flow.selectedEnvironmentId) {
286+
void moveScratchDraft(environment.environmentId);
287+
return;
288+
}
289+
} else {
290+
flow.selectEnvironment(environment.environmentId);
291+
}
249292
navigation.goBack();
250293
}}
251294
selected={flow.selectedEnvironmentId === environment.environmentId}

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

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,49 @@ export function NewTaskDraftScreen(props: {
14551455
navigation.dispatch(StackActions.push(routeName));
14561456
};
14571457

1458-
const hero = (
1458+
const environmentControl = (
1459+
<ComposerInlineControl
1460+
accessibilityLabel={`Environment: ${selectedEnvironmentLabel}`}
1461+
chevronDirection="right"
1462+
disabled={isComposerInteractionLocked || voiceInput.isBusy}
1463+
renderIcon={(size) => (
1464+
<EnvironmentMachineSymbol
1465+
kind={resolveEnvironmentMachineKind(selectedEnvironmentServerConfig)}
1466+
size={size}
1467+
tintColorClassName="accent-icon-muted"
1468+
/>
1469+
)}
1470+
label={`on ${selectedEnvironmentLabel}`}
1471+
maxWidth={flow.isScratchDraft ? 170 : 260}
1472+
onPress={
1473+
flow.environments.length > 1 ? () => openContextPicker("NewTaskEnvironment") : undefined
1474+
}
1475+
showChevron={flow.environments.length > 1}
1476+
static={flow.environments.length <= 1}
1477+
/>
1478+
);
1479+
// A thread without a project has no project to name, so it asks plainly,
1480+
// like web, and puts the project picker beside the machine as a control.
1481+
const hero = flow.isScratchDraft ? (
1482+
<View className="items-center gap-2 px-6" testID="new-task-hero">
1483+
<Text className="text-center text-2xl font-t3-medium tracking-tight text-foreground">
1484+
What should we work on?
1485+
</Text>
1486+
{/* Wraps onto two lines only when a long machine name leaves no room. */}
1487+
<View className="flex-row flex-wrap items-center justify-center gap-x-1">
1488+
<ComposerInlineControl
1489+
accessibilityHint="Opens the project picker"
1490+
accessibilityLabel="Choose a project"
1491+
chevronDirection="right"
1492+
disabled={isComposerInteractionLocked}
1493+
icon="folder"
1494+
label="Choose a project"
1495+
onPress={chooseProject}
1496+
/>
1497+
{environmentControl}
1498+
</View>
1499+
</View>
1500+
) : (
14591501
<View className="items-center gap-6 px-6" testID="new-task-hero">
14601502
<View className="w-full items-center gap-1.5">
14611503
<Text className="text-center text-2xl font-t3-medium tracking-tight text-foreground">
@@ -1482,25 +1524,7 @@ export function NewTaskDraftScreen(props: {
14821524
</View>
14831525
</View>
14841526

1485-
<ComposerInlineControl
1486-
accessibilityLabel={`Environment: ${selectedEnvironmentLabel}`}
1487-
chevronDirection="right"
1488-
disabled={isComposerInteractionLocked || voiceInput.isBusy}
1489-
renderIcon={(size) => (
1490-
<EnvironmentMachineSymbol
1491-
kind={resolveEnvironmentMachineKind(selectedEnvironmentServerConfig)}
1492-
size={size}
1493-
tintColorClassName="accent-icon-muted"
1494-
/>
1495-
)}
1496-
label={`on ${selectedEnvironmentLabel}`}
1497-
maxWidth={260}
1498-
onPress={
1499-
flow.environments.length > 1 ? () => openContextPicker("NewTaskEnvironment") : undefined
1500-
}
1501-
showChevron={flow.environments.length > 1}
1502-
static={flow.environments.length <= 1}
1503-
/>
1527+
{environmentControl}
15041528
</View>
15051529
);
15061530
const heroViewport = (

0 commit comments

Comments
 (0)