Skip to content

Commit ac217cc

Browse files
shivamhwpclaude
andcommitted
Merge remote-tracking branch 'origin/main' into issue-watch/31702
Upstream removed plan-mode interaction normalization from mobile model picks, so selectThreadModel no longer takes providers or resets the interaction mode; it keeps the durable thread pick and reply release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 parents 3ea3576 + 521ac7c commit ac217cc

349 files changed

Lines changed: 10752 additions & 3582 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ jobs:
478478
shell: bash
479479
run: |
480480
sudo apt-get update
481-
sudo apt-get install -y libsecret-1-dev pkg-config
481+
sudo apt-get install -y libsecret-1-dev pkg-config libgtk-3-0t64 libnss3 libasound2t64 libgbm1
482482
if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then
483483
sudo apt-get install -y imagemagick
484484
fi

‎apps/desktop/src/electron/ElectronShell.test.ts‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,67 @@ describe("ElectronShell", () => {
5454
}).pipe(Effect.provide(ElectronShell.layer)),
5555
);
5656

57+
it.effect("opens local editor file deep links", () =>
58+
Effect.gen(function* () {
59+
openExternalMock.mockResolvedValue(undefined);
60+
61+
const urls = [
62+
"cursor://file/Users/me/repo/file.md:186",
63+
"vscode://file/Users/me/repo/file.md:3:7",
64+
"vscode-insiders://file/Users/me/repo/file.md",
65+
"vscodium://file/C:/Users/me/repo/file.md:3",
66+
];
67+
const electronShell = yield* ElectronShell.ElectronShell;
68+
const results = yield* Effect.forEach(urls, (url) => electronShell.openExternal(url));
69+
70+
assert.deepEqual(results, [true, true, true, true]);
71+
assert.deepEqual(
72+
openExternalMock.mock.calls,
73+
urls.map((url) => [url]),
74+
);
75+
}).pipe(Effect.provide(ElectronShell.layer)),
76+
);
77+
78+
it.effect("normalizes the scheme case of local editor file deep links", () =>
79+
Effect.gen(function* () {
80+
openExternalMock.mockResolvedValue(undefined);
81+
82+
const electronShell = yield* ElectronShell.ElectronShell;
83+
const result = yield* electronShell.openExternal("VSCode://file/Users/me/repo/file.md:3");
84+
85+
assert.equal(result, true);
86+
assert.deepEqual(openExternalMock.mock.calls, [["vscode://file/Users/me/repo/file.md:3"]]);
87+
}).pipe(Effect.provide(ElectronShell.layer)),
88+
);
89+
90+
it.effect("does not open editor URLs that are not absolute local file links", () =>
91+
Effect.gen(function* () {
92+
openExternalMock.mockResolvedValue(undefined);
93+
94+
const electronShell = yield* ElectronShell.ElectronShell;
95+
const results = yield* Effect.forEach(
96+
[
97+
"cursor://user@file/Users/me/repo/file.md",
98+
"cursor://:secret@file/Users/me/repo/file.md",
99+
"cursor://file:8080/Users/me/repo/file.md",
100+
"cursor://anysphere.cursor-deeplink/prompt?text=hi",
101+
"vscode://vscode.git/clone?url=https%3A%2F%2Fexample.com%2Frepo.git",
102+
"cursor://file",
103+
"cursor://file/",
104+
"cursor:file/Users/me/repo/file.md",
105+
"foo://file/Users/me/repo/file.md",
106+
"zed://file/Users/me/repo/file.md",
107+
"jetbrains://file/Users/me/repo/file.md",
108+
"javascript:alert(1)",
109+
],
110+
(url) => electronShell.openExternal(url),
111+
);
112+
113+
assert.deepEqual(results, Array(12).fill(false));
114+
assert.equal(openExternalMock.mock.calls.length, 0);
115+
}).pipe(Effect.provide(ElectronShell.layer)),
116+
);
117+
57118
it.effect("does not open editor URLs that mix up link shapes", () =>
58119
Effect.gen(function* () {
59120
openExternalMock.mockResolvedValue(undefined);

‎apps/desktop/src/electron/ElectronShell.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { MAC_PERMISSION_SETTINGS_URLS } from "../permissions/MacPermission.ts";
22
import {
3+
isLocalEditorFileUrl,
34
REMOTE_CAPABLE_EDITOR_IDS,
45
remoteSchemeForEditor,
56
type SystemSettingsPane,
@@ -11,7 +12,7 @@ import * as Option from "effect/Option";
1112

1213
import * as Electron from "electron";
1314

14-
// Remote editor deep links must reach the OS handler.
15+
// Remote editor deep links and local editor file links must reach the OS handler.
1516
const SAFE_WEB_PROTOCOLS = new Set(["http:", "https:"]);
1617
const REMOTE_EDITOR_PROTOCOLS = new Set(
1718
REMOTE_CAPABLE_EDITOR_IDS.flatMap((id) => {
@@ -44,7 +45,9 @@ export function parseSafeExternalUrl(rawUrl: unknown): Option.Option<string> {
4445

4546
try {
4647
const url = new URL(rawUrl);
47-
return SAFE_WEB_PROTOCOLS.has(url.protocol) || isRemoteEditorUrl(url)
48+
return SAFE_WEB_PROTOCOLS.has(url.protocol) ||
49+
isRemoteEditorUrl(url) ||
50+
isLocalEditorFileUrl(url)
4851
? Option.some(url.href)
4952
: Option.none();
5053
} catch {

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const clientSettings: ClientSettings = {
3434
confirmThreadArchive: true,
3535
confirmThreadDelete: false,
3636
confirmThreadUnpin: false,
37-
contextWindowMeterEnabled: false,
3837
diffFilesCollapsed: true,
3938
diffIgnoreWhitespace: true,
4039
diffLayout: "stacked",
@@ -52,7 +51,6 @@ const clientSettings: ClientSettings = {
5251
glassOpacity: 80,
5352
onboardingCompletedAt: null,
5453
panelAnimationDurationMs: 0,
55-
planModeEnabled: false,
5654
proactivePanelsEnabled: true,
5755
showSkillsInSlashMenu: false,
5856
persistComposerContextStrip: true,
@@ -67,7 +65,6 @@ const clientSettings: ClientSettings = {
6765
boringSidebarMultilineRows: false,
6866
threadDetailsUsageEnabled: false,
6967
threadDetailsItems: {},
70-
legacySidebarEnabled: false,
7168
sidebarWorkingShelfEnabled: false,
7269
loadBalancingEnabled: false,
7370
loadBalancingWeights: { "environment-1": 75, "environment-2": 0 },

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
package expo.modules.t3nativecontrols
22

3+
import android.content.ContentValues
4+
import android.content.Context
35
import android.content.Intent
6+
import android.net.Uri
7+
import android.os.Build
8+
import android.os.Environment
9+
import android.provider.MediaStore
410
import android.text.format.DateFormat
11+
import androidx.annotation.RequiresApi
512
import androidx.core.content.FileProvider
613
import expo.modules.kotlin.Promise
714
import expo.modules.kotlin.modules.Module
@@ -44,6 +51,15 @@ class T3NativeControlsModule : Module() {
4451
}
4552
}
4653

54+
AsyncFunction("saveImageToLibrary") { uri: String, mimeType: String, name: String ->
55+
val context = appContext.reactContext ?: error("The app is not active.")
56+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
57+
saveImageToPictures(context, Uri.parse(uri), mimeType, name)
58+
} else {
59+
error("Saving images needs Android 10 or later.")
60+
}
61+
}
62+
4763
OnActivityResult { _, (requestCode) ->
4864
if (requestCode == 7343) {
4965
filePreviewPromise?.resolve(null)
@@ -84,3 +100,32 @@ class T3NativeControlsModule : Module() {
84100
}
85101
}
86102
}
103+
104+
// Android 10+ lets apps add their own media without a storage permission.
105+
@RequiresApi(Build.VERSION_CODES.Q)
106+
private fun saveImageToPictures(context: Context, source: Uri, mimeType: String, name: String) {
107+
val resolver = context.contentResolver
108+
val values = ContentValues().apply {
109+
put(MediaStore.Images.Media.DISPLAY_NAME, name)
110+
put(MediaStore.Images.Media.MIME_TYPE, mimeType)
111+
put(MediaStore.Images.Media.RELATIVE_PATH, "${Environment.DIRECTORY_PICTURES}/T3 Code")
112+
put(MediaStore.Images.Media.IS_PENDING, 1)
113+
}
114+
val target = resolver.insert(
115+
MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY),
116+
values
117+
) ?: error("Could not create the image in Pictures.")
118+
runCatching {
119+
val input = resolver.openInputStream(source) ?: error("The image is no longer available.")
120+
input.use { from ->
121+
val output = resolver.openOutputStream(target) ?: error("Could not write the image.")
122+
output.use { from.copyTo(it) }
123+
}
124+
resolver.update(
125+
target,
126+
ContentValues().apply { put(MediaStore.Images.Media.IS_PENDING, 0) },
127+
null,
128+
null
129+
)
130+
}.onFailure { resolver.delete(target, null, null) }.getOrThrow()
131+
}

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import AVFoundation
22
import ExpoModulesCore
3+
import Photos
34
import Security
45
import UIKit
6+
import UniformTypeIdentifiers
57

68
@ExpoModule("T3NativeControls")
79
public final class T3NativeControlsModule: Module {
@@ -123,6 +125,11 @@ public final class T3NativeControlsModule: Module {
123125
AsyncFunction("shareFileFromSource") { (url: URL, title: String, identifier: String, promise: Promise) in
124126
try self.shareFile(url: url, title: title, sourceIdentifier: identifier, promise: promise)
125127
}.runOnQueue(.main)
128+
129+
// Photos names the asset itself, so iOS ignores the Android display name.
130+
AsyncFunction("saveImageToLibrary") { (url: URL, mimeType: String, name: String, promise: Promise) in
131+
Self.saveImageToLibrary(url: url, mimeType: mimeType, name: name, promise: promise)
132+
}
126133
}
127134

128135
// UIKit presenters are main-actor isolated rather than run on the JS thread
@@ -297,6 +304,35 @@ public final class T3NativeControlsModule: Module {
297304
if filePresentation?.identifier == identifier { filePresentation?.dismiss() }
298305
}
299306

307+
private static func saveImageToLibrary(url: URL, mimeType: String, name: String, promise: Promise) {
308+
PHPhotoLibrary.requestAuthorization(for: .addOnly) { status in
309+
guard status == .authorized || status == .limited else {
310+
promise.reject(NSError(
311+
domain: "T3NativePhotos",
312+
code: 1,
313+
userInfo: [NSLocalizedDescriptionKey: "Allow T3 Code to add photos in Settings."]
314+
))
315+
return
316+
}
317+
PHPhotoLibrary.shared().performChanges({
318+
let options = PHAssetResourceCreationOptions()
319+
options.uniformTypeIdentifier = UTType(mimeType: mimeType)?.identifier
320+
options.originalFilename = name
321+
PHAssetCreationRequest.forAsset().addResource(with: .photo, fileURL: url, options: options)
322+
}, completionHandler: { saved, error in
323+
if saved {
324+
promise.resolve(nil)
325+
} else {
326+
promise.reject(error ?? NSError(
327+
domain: "T3NativePhotos",
328+
code: 2,
329+
userInfo: [NSLocalizedDescriptionKey: "Photos could not save this image."]
330+
))
331+
}
332+
})
333+
}
334+
}
335+
300336
private func shareFile(url: URL, title: String, sourceIdentifier: String, promise: Promise) throws {
301337
guard let presenter = appContext?.utilities?.currentViewController() else {
302338
throw NSError(

‎apps/mobile/modules/t3-terminal/android/src/main/java/expo/modules/t3terminal/T3TerminalView.kt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,10 @@ class T3TerminalView(context: Context, appContext: AppContext) : ExpoView(contex
286286
onInput(mapOf("data" to "\r"))
287287
},
288288
)
289+
val navigationKeys = TerminalNavigationKeyListener { onInput(mapOf("data" to it)) }
289290
inputView.setOnKeyListener { _, keyCode, event ->
290291
if (readOnly) return@setOnKeyListener true
292+
if (navigationKeys.onKey(inputView, keyCode, event)) return@setOnKeyListener true
291293
if (event.action != KeyEvent.ACTION_DOWN) return@setOnKeyListener false
292294
when {
293295
keyCode == KeyEvent.KEYCODE_DEL -> {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package expo.modules.t3terminal
2+
3+
import android.view.KeyEvent
4+
import android.view.View
5+
6+
internal class TerminalNavigationKeyListener(
7+
private val send: (String) -> Unit
8+
) : View.OnKeyListener {
9+
override fun onKey(view: View?, keyCode: Int, event: KeyEvent): Boolean {
10+
val sequence = sequenceFor(keyCode, event) ?: return false
11+
if (event.action == KeyEvent.ACTION_DOWN) send(sequence)
12+
// Unconsumed arrow and Tab key events move focus off the terminal input.
13+
return true
14+
}
15+
16+
// Matches iOS: these keys only without modifiers, plus Shift+Tab.
17+
private fun sequenceFor(keyCode: Int, event: KeyEvent): String? = when {
18+
keyCode == KeyEvent.KEYCODE_TAB && event.hasModifiers(KeyEvent.META_SHIFT_ON) -> "\u001b[Z"
19+
!event.hasNoModifiers() -> null
20+
keyCode == KeyEvent.KEYCODE_DPAD_UP -> "\u001b[A"
21+
keyCode == KeyEvent.KEYCODE_DPAD_DOWN -> "\u001b[B"
22+
keyCode == KeyEvent.KEYCODE_DPAD_RIGHT -> "\u001b[C"
23+
keyCode == KeyEvent.KEYCODE_DPAD_LEFT -> "\u001b[D"
24+
keyCode == KeyEvent.KEYCODE_TAB -> "\t"
25+
keyCode == KeyEvent.KEYCODE_ESCAPE -> "\u001b"
26+
else -> null
27+
}
28+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package expo.modules.t3terminal
2+
3+
import android.app.Activity
4+
import android.view.KeyEvent
5+
import android.view.View
6+
import android.widget.Button
7+
import android.widget.EditText
8+
import android.widget.LinearLayout
9+
import org.junit.Assert.assertEquals
10+
import org.junit.Assert.assertTrue
11+
import org.junit.Test
12+
import org.junit.runner.RunWith
13+
import org.robolectric.Robolectric
14+
import org.robolectric.RobolectricTestRunner
15+
import org.robolectric.annotation.Config
16+
17+
@RunWith(RobolectricTestRunner::class)
18+
@Config(sdk = [36], manifest = Config.NONE)
19+
class TerminalNavigationKeyListenerTest {
20+
@Test
21+
fun hardwareNavigationKeysReachThePtyAndKeepFocus() {
22+
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
23+
val sent = StringBuilder()
24+
val input = EditText(activity).apply {
25+
setSingleLine(true)
26+
isFocusableInTouchMode = true
27+
setOnKeyListener(TerminalNavigationKeyListener { sent.append(it) })
28+
}
29+
val nextControl = Button(activity).apply { isFocusableInTouchMode = true }
30+
val root = LinearLayout(activity).apply {
31+
orientation = LinearLayout.VERTICAL
32+
addView(input)
33+
addView(nextControl)
34+
}
35+
activity.setContentView(root)
36+
// Focus search below the input only finds controls that have bounds.
37+
root.measure(
38+
View.MeasureSpec.makeMeasureSpec(1080, View.MeasureSpec.EXACTLY),
39+
View.MeasureSpec.makeMeasureSpec(1920, View.MeasureSpec.EXACTLY),
40+
)
41+
root.layout(0, 0, 1080, 1920)
42+
assertTrue(input.requestFocus())
43+
44+
val shift = KeyEvent.META_SHIFT_ON or KeyEvent.META_SHIFT_LEFT_ON
45+
val keys = listOf(
46+
Triple(KeyEvent.KEYCODE_DPAD_UP, 0, "\u001b[A"),
47+
Triple(KeyEvent.KEYCODE_DPAD_DOWN, 0, "\u001b[B"),
48+
Triple(KeyEvent.KEYCODE_DPAD_RIGHT, 0, "\u001b[C"),
49+
Triple(KeyEvent.KEYCODE_DPAD_LEFT, 0, "\u001b[D"),
50+
Triple(KeyEvent.KEYCODE_TAB, 0, "\t"),
51+
Triple(KeyEvent.KEYCODE_TAB, shift, "\u001b[Z"),
52+
Triple(KeyEvent.KEYCODE_ESCAPE, 0, "\u001b"),
53+
)
54+
for ((keyCode, meta, expected) in keys) {
55+
sent.clear()
56+
input.dispatchKeyEvent(KeyEvent(0, 0, KeyEvent.ACTION_DOWN, keyCode, 0, meta))
57+
input.dispatchKeyEvent(KeyEvent(0, 0, KeyEvent.ACTION_UP, keyCode, 0, meta))
58+
assertEquals("bytes for key $keyCode meta $meta", expected, sent.toString())
59+
assertTrue("focus left the input after key $keyCode meta $meta", input.isFocused)
60+
}
61+
62+
sent.clear()
63+
val ctrl = KeyEvent.META_CTRL_ON or KeyEvent.META_CTRL_LEFT_ON
64+
input.dispatchKeyEvent(KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_UP, 0, ctrl))
65+
assertEquals("modified arrows are left to the app, as on iOS", "", sent.toString())
66+
}
67+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"platforms": ["apple"],
3+
"apple": { "modules": ["T3WebSocketModule"] }
4+
}

0 commit comments

Comments
 (0)