Skip to content

Commit 7d752f1

Browse files
authored
Merge branch 'main' into fix/claude-fresh-session-resume
2 parents 54333b1 + eac52f0 commit 7d752f1

250 files changed

Lines changed: 12474 additions & 2320 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.

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,34 @@ describe("DesktopSettings", () => {
357357
),
358358
);
359359

360+
it.effect("saves through a symlinked settings file without replacing the link", () =>
361+
withSettings(
362+
Effect.gen(function* () {
363+
const environment = yield* DesktopEnvironment.DesktopEnvironment;
364+
const fileSystem = yield* FileSystem.FileSystem;
365+
const settings = yield* DesktopAppSettings.DesktopAppSettings;
366+
const dotfiles = yield* fileSystem.makeTempDirectoryScoped({
367+
prefix: "t3-desktop-settings-dotfiles-",
368+
});
369+
const linkedSettingsPath = `${dotfiles}/desktop-settings.json`;
370+
yield* fileSystem.writeFileString(linkedSettingsPath, "{}\n");
371+
yield* fileSystem.makeDirectory(environment.stateDir, { recursive: true });
372+
yield* fileSystem.symlink(linkedSettingsPath, environment.desktopSettingsPath);
373+
374+
yield* settings.setServerExposureMode("network-accessible");
375+
376+
assert.equal(
377+
yield* fileSystem.readLink(environment.desktopSettingsPath),
378+
linkedSettingsPath,
379+
);
380+
const persisted = yield* decodeDesktopSettingsPatch(
381+
yield* fileSystem.readFileString(linkedSettingsPath),
382+
);
383+
assert.equal(persisted.serverExposureMode, "network-accessible");
384+
}),
385+
),
386+
);
387+
360388
it.effect("migrates legacy implicit update channels to the runtime default", () =>
361389
withSettings(
362390
Effect.gen(function* () {

‎apps/desktop/src/settings/DesktopAppSettings.ts‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
type DesktopUpdateChannel,
66
} from "@t3tools/contracts";
77
import { fromLenientJson } from "@t3tools/shared/schemaJson";
8+
import { resolveSymlinkTarget } from "@t3tools/shared/symlink";
89
import * as Context from "effect/Context";
910
import * as Crypto from "effect/Crypto";
1011
import * as Effect from "effect/Effect";
@@ -130,6 +131,7 @@ const settingsChange = (settings: DesktopSettings, changed: boolean): DesktopSet
130131

131132
const DesktopSettingsWriteOperation = Schema.Literals([
132133
"create-temporary-file-name",
134+
"resolve-symlink",
133135
"encode-document",
134136
"create-directory",
135137
"write-temporary-file",
@@ -421,8 +423,20 @@ const writeSettings = Effect.fn("desktop.settings.writeSettings")(function* (inp
421423
readonly defaultSettings: DesktopSettings;
422424
readonly suffix: string;
423425
}): Effect.fn.Return<void, DesktopSettingsWriteError> {
424-
const directory = input.path.dirname(input.settingsPath);
425-
const tempPath = `${input.settingsPath}.${process.pid}.${input.suffix}.tmp`;
426+
const targetPath = yield* resolveSymlinkTarget(input.settingsPath).pipe(
427+
Effect.provideService(FileSystem.FileSystem, input.fileSystem),
428+
Effect.provideService(Path.Path, input.path),
429+
Effect.mapError(
430+
(cause) =>
431+
new DesktopSettingsWriteError({
432+
operation: "resolve-symlink",
433+
path: input.settingsPath,
434+
cause,
435+
}),
436+
),
437+
);
438+
const directory = input.path.dirname(targetPath);
439+
const tempPath = `${targetPath}.${process.pid}.${input.suffix}.tmp`;
426440
const encoded = yield* encodeDesktopSettingsJson(
427441
toDesktopSettingsDocument(input.settings, input.defaultSettings),
428442
).pipe(
@@ -455,7 +469,7 @@ const writeSettings = Effect.fn("desktop.settings.writeSettings")(function* (inp
455469
}),
456470
),
457471
);
458-
yield* input.fileSystem.rename(tempPath, input.settingsPath).pipe(
472+
yield* input.fileSystem.rename(tempPath, targetPath).pipe(
459473
Effect.mapError(
460474
(cause) =>
461475
new DesktopSettingsWriteError({

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,34 @@ describe("DesktopClientSettings", () => {
149149
),
150150
);
151151

152+
it.effect("saves through a symlinked client settings file without replacing the link", () =>
153+
withClientSettings(
154+
Effect.gen(function* () {
155+
const environment = yield* DesktopEnvironment.DesktopEnvironment;
156+
const fileSystem = yield* FileSystem.FileSystem;
157+
const settings = yield* DesktopClientSettings.DesktopClientSettings;
158+
const dotfiles = yield* fileSystem.makeTempDirectoryScoped({
159+
prefix: "t3-desktop-client-settings-dotfiles-",
160+
});
161+
const linkedSettingsPath = `${dotfiles}/client-settings.json`;
162+
yield* fileSystem.writeFileString(linkedSettingsPath, "{}\n");
163+
yield* fileSystem.makeDirectory(environment.stateDir, { recursive: true });
164+
yield* fileSystem.symlink(linkedSettingsPath, environment.clientSettingsPath);
165+
166+
yield* settings.set(clientSettings);
167+
168+
assert.equal(
169+
yield* fileSystem.readLink(environment.clientSettingsPath),
170+
linkedSettingsPath,
171+
);
172+
assert.deepEqual(
173+
yield* decodeClientSettingsJson(yield* fileSystem.readFileString(linkedSettingsPath)),
174+
clientSettings,
175+
);
176+
}),
177+
),
178+
);
179+
152180
it.effect.each([
153181
{ label: "permission", reason: "PermissionDenied" },
154182
{ label: "I/O", reason: "Unknown" },

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ClientSettingsSchema, type ClientSettings } from "@t3tools/contracts";
22
import { fromLenientJson } from "@t3tools/shared/schemaJson";
3+
import { resolveSymlinkTarget } from "@t3tools/shared/symlink";
34
import * as Context from "effect/Context";
45
import * as Crypto from "effect/Crypto";
56
import * as Effect from "effect/Effect";
@@ -41,6 +42,7 @@ export class DesktopClientSettingsReadError extends Schema.TaggedError<DesktopCl
4142

4243
const DesktopClientSettingsWriteOperation = Schema.Literals([
4344
"create-temporary-file-name",
45+
"resolve-symlink",
4446
"encode-document",
4547
"create-directory",
4648
"write-temporary-file",
@@ -126,8 +128,20 @@ const writeClientSettings = Effect.fnUntraced(function* (input: {
126128
readonly settings: ClientSettings;
127129
readonly suffix: string;
128130
}): Effect.fn.Return<void, DesktopClientSettingsWriteError> {
129-
const directory = input.path.dirname(input.settingsPath);
130-
const tempPath = `${input.settingsPath}.${process.pid}.${input.suffix}.tmp`;
131+
const targetPath = yield* resolveSymlinkTarget(input.settingsPath).pipe(
132+
Effect.provideService(FileSystem.FileSystem, input.fileSystem),
133+
Effect.provideService(Path.Path, input.path),
134+
Effect.mapError(
135+
(cause) =>
136+
new DesktopClientSettingsWriteError({
137+
operation: "resolve-symlink",
138+
path: input.settingsPath,
139+
cause,
140+
}),
141+
),
142+
);
143+
const directory = input.path.dirname(targetPath);
144+
const tempPath = `${targetPath}.${process.pid}.${input.suffix}.tmp`;
131145
const encoded = yield* encodeClientSettingsJson(input.settings).pipe(
132146
Effect.mapError(
133147
(cause) =>
@@ -158,7 +172,7 @@ const writeClientSettings = Effect.fnUntraced(function* (input: {
158172
}),
159173
),
160174
);
161-
yield* input.fileSystem.rename(tempPath, input.settingsPath).pipe(
175+
yield* input.fileSystem.rename(tempPath, targetPath).pipe(
162176
Effect.mapError(
163177
(cause) =>
164178
new DesktopClientSettingsWriteError({

‎apps/mobile/app.config.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ const config: ExpoConfig = {
306306
// JS back handling survives it via react-native's Android 16 shim plus
307307
// withAndroidPredictiveBackCompat on Android 13-15.
308308
predictiveBackGestureEnabled: true,
309+
// expo-sensors declares this for its pedometer, which the app does not use.
310+
blockedPermissions: ["android.permission.ACTIVITY_RECOGNITION"],
309311
},
310312
web: {
311313
favicon: variant.assets.appIcon,
@@ -418,7 +420,16 @@ const config: ExpoConfig = {
418420
minSdkVersion: 24,
419421
// kotlinx-io uses Kotlin 2.3's return-value checker annotation, while
420422
// SDK 58 builds with Kotlin 2.2. It has no runtime behavior.
421-
extraProguardRules: "-dontwarn kotlin.MustUseReturnValues",
423+
//
424+
// WorkManager 2.9 keeps InputMerger classes but not their constructors,
425+
// and R8 full mode no longer keeps a default constructor implicitly.
426+
// Without it no work request can start, so the Glance session behind
427+
// the widget never renders and it stays on "Loading widget". WorkManager
428+
// 2.10 ships this rule itself; drop it once the resolved version gets there.
429+
extraProguardRules: [
430+
"-dontwarn kotlin.MustUseReturnValues",
431+
"-keep class * extends androidx.work.InputMerger { <init>(); }",
432+
].join("\n"),
422433
},
423434
ios: {
424435
deploymentTarget: "18.0",
@@ -431,6 +442,9 @@ const config: ExpoConfig = {
431442
},
432443
],
433444
"./plugins/withIosCocoaPodsUuidCache.cjs",
445+
// Only the accelerometer is used (device viewer shake). Compile out the
446+
// pedometer so iOS needs no motion purpose string.
447+
["expo-sensors", { motionPermission: false }],
434448
// Must be listed BEFORE expo-widgets: same-type mods run last-registered-
435449
// first, so registering earlier makes this plugin's mods run AFTER
436450
// expo-widgets' — its dangerous mod wipes ios/ExpoWidgetsTarget/ (which

‎apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3KeyboardCommandsModule.kt‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,21 @@ class T3KeyboardCommandsView(
2929
var enabledCommands = emptySet<String>()
3030

3131
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
32-
val copiesThreadReference =
33-
event.action == KeyEvent.ACTION_DOWN &&
34-
event.repeatCount == 0 &&
35-
event.keyCode == KeyEvent.KEYCODE_C &&
36-
event.isCtrlPressed &&
37-
event.isShiftPressed &&
38-
!event.isAltPressed &&
39-
enabledCommands.contains("copyThreadReference")
40-
if (copiesThreadReference) {
41-
onCommand(mapOf("command" to "copyThreadReference"))
42-
return true
32+
val command = commandFor(event)?.takeIf { enabledCommands.contains(it) }
33+
if (command != null) onCommand(mapOf("command" to command))
34+
return command != null || super.dispatchKeyEvent(event)
35+
}
36+
37+
private fun commandFor(event: KeyEvent): String? {
38+
if (event.action != KeyEvent.ACTION_DOWN || event.repeatCount != 0 || !event.isCtrlPressed) {
39+
return null
40+
}
41+
return when {
42+
event.keyCode == KeyEvent.KEYCODE_C && event.isShiftPressed && !event.isAltPressed ->
43+
"copyThreadReference"
44+
event.keyCode == KeyEvent.KEYCODE_H && event.isShiftPressed && !event.isAltPressed ->
45+
"cycleHost"
46+
else -> null
4347
}
44-
return super.dispatchKeyEvent(event)
4548
}
4649
}

‎apps/mobile/modules/t3-native-controls/ios/T3KeyboardCommandsModule.swift‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public final class T3KeyboardCommandsView: ExpoView {
5252
title: "Copy PR Link or Thread ID"
5353
),
5454
enabledCommand("toggleSidebar", input: "\\", modifiers: .command, action: #selector(handleToggleSidebar), title: "Toggle Sidebar"),
55+
enabledCommand("cycleHost", input: "h", modifiers: [.command, .shift], action: #selector(cycleHost), title: "Next Machine"),
5556
].compactMap { $0 }
5657
if isPad {
5758
commands += (1...9).compactMap { index in
@@ -150,6 +151,7 @@ public final class T3KeyboardCommandsView: ExpoView {
150151
@objc private func openReview() { emit("review") }
151152
@objc private func copyThreadReference() { emit("copyThreadReference") }
152153
@objc private func handleToggleSidebar() { emit("toggleSidebar") }
154+
@objc private func cycleHost() { emit("cycleHost") }
153155

154156
private func emit(_ command: String) {
155157
onCommand(["command": command])

‎apps/mobile/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"expo-paste-input": "^0.1.15",
102102
"expo-quick-actions": "^6.0.2",
103103
"expo-secure-store": "~58.0.2",
104+
"expo-sensors": "~58.0.1",
104105
"expo-sharing": "58.0.13",
105106
"expo-splash-screen": "~58.0.4",
106107
"expo-sqlite": "~58.0.8",

‎apps/mobile/src/App.tsx‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Linking from "expo-linking";
22
import * as SplashScreen from "expo-splash-screen";
33
import { useEffect } from "react";
4-
import { StatusBar, View } from "react-native";
4+
import { StatusBar } from "react-native";
55
import { GestureHandlerRootView } from "react-native-gesture-handler";
66
import { KeyboardProvider } from "react-native-keyboard-controller";
77
import { SafeAreaProvider } from "react-native-safe-area-context";
@@ -23,6 +23,8 @@ import { OverlayPortalHost } from "./components/OverlayPortal";
2323
import { shouldHandleAppLink } from "./lib/appLinking";
2424
import { useMobileNavigationTheme } from "./lib/useMobileNavigationTheme";
2525
import { SubscriptionUsageCoordinator } from "./widgets/SubscriptionUsageCoordinator";
26+
import { VoiceInputProvider } from "./features/voice-input/VoiceInputProvider";
27+
import { GlobalVoiceInputControl } from "./features/voice-input/GlobalVoiceInputControl";
2628

2729
import "../global.css";
2830

@@ -76,22 +78,24 @@ function AppContent() {
7678
<GestureHandlerRootView className="flex-1">
7779
<KeyboardProvider statusBarTranslucent>
7880
<SafeAreaProvider>
79-
<StatusBar barStyle={themeAppearance === "dark" ? "light-content" : "dark-content"} />
80-
{/* The navigation theme drives the NATIVE header appearance: native-stack
81+
<VoiceInputProvider>
82+
<StatusBar barStyle={themeAppearance === "dark" ? "light-content" : "dark-content"} />
83+
{/* The navigation theme drives the NATIVE header appearance: native-stack
8184
forwards `dark` as the nav bar's overrideUserInterfaceStyle. Without
8285
this, React Navigation defaults to its light theme and every native
8386
header (glass buttons, title, materials) is forced light even when
8487
the system is in dark mode. */}
85-
<View style={{ flex: 1 }}>
86-
<IncomingShareProvider>
87-
<Navigation linking={appLinking} theme={navigationTheme} />
88-
</IncomingShareProvider>
89-
<ConfirmDialogHost />
90-
<ThreadArrangementHost />
91-
</View>
92-
{/* Anchored-menu overlays render here — in-window, so the
88+
<GlobalVoiceInputControl>
89+
<IncomingShareProvider>
90+
<Navigation linking={appLinking} theme={navigationTheme} />
91+
</IncomingShareProvider>
92+
<ConfirmDialogHost />
93+
<ThreadArrangementHost />
94+
</GlobalVoiceInputControl>
95+
{/* Anchored-menu overlays render here — in-window, so the
9396
keyboard stays up while a dropdown is open. */}
94-
<OverlayPortalHost />
97+
<OverlayPortalHost />
98+
</VoiceInputProvider>
9599
</SafeAreaProvider>
96100
</KeyboardProvider>
97101
</GestureHandlerRootView>

‎apps/mobile/src/Stack.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,8 @@ const RootStackConfig = createNativeStackNavigator({
701701
presentation: "fullScreenModal",
702702
headerShown: false,
703703
gestureEnabled: false,
704+
autoHideHomeIndicator: true,
705+
navigationBarHidden: true,
704706
},
705707
}),
706708
ThreadReview: createNativeStackScreen({

0 commit comments

Comments
 (0)