GeezerVison is showing github.com — Merge branch 'main' into fix/copy-in-terminal · pingdotgg/t3code@7a0d12c
File treeExpand file treeCollapse file tree Open diff view settings modules/t3-composer-editor android/src/main/java/expo/modules/t3composereditor
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/mobile/modules/t3-composer-editor/android/src/main/java/expo/modules/t3composereditor/T3ComposerEditorView.kt +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -252,6 +252,9 @@ class T3ComposerEditorView(context: Context, appContext: AppContext) : ExpoView( | 252 | 252 | val textLength = editor.text?.length ?: 0 | 253 | 253 | val safeStart = start.coerceIn(0, textLength) | 254 | 254 | val safeEnd = end.coerceIn(0, textLength) | | 255 | + // Re-applying an unchanged selection resets the keyboard's suggestion | | 256 | + // state, so a no-op assignment must be skipped. | | 257 | + if (editor.selectionStart == safeStart && editor.selectionEnd == safeEnd) return | 255 | 258 | editor.setSelection(safeStart, safeEnd) | 256 | 259 | } | 257 | 260 |
| @@ -281,6 +284,10 @@ class T3ComposerEditorView(context: Context, appContext: AppContext) : ExpoView( | 281 | 284 | ) | 282 | 285 |
| 283 | 286 | private fun emitSelectionChange(start: Int, end: Int) { | | 287 | + // Caret moves advance the revision counter like text edits do: a | | 288 | + // controlled payload computed before this move is stale and must fail the | | 289 | + // revision guard instead of yanking the caret back mid-typing. | | 290 | + nativeEventCount += 1 | 284 | 291 | onComposerSelectionChange( | 285 | 292 | mapOf( | 286 | 293 | "value" to editor.text.toString(), | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/modules/t3-composer-editor/ios/T3ComposerEditorView.swift +17-1Lines changed: 17 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -489,6 +489,12 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro | 489 | 489 | return | 490 | 490 | } | 491 | 491 | restoreBaseTypingAttributes() | | 492 | + // UIKit moves the selection before textViewDidChange runs. Emitting here | | 493 | + // would pair the post-edit text with a pre-edit revision counter, so let | | 494 | + // the change event that follows carry both; only pure caret moves emit. | | 495 | + guard self.textView.serializedText() == value else { | | 496 | + return | | 497 | + } | 492 | 498 | emitSelection() | 493 | 499 | } | 494 | 500 |
| @@ -774,8 +780,12 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro | 774 | 780 | } | 775 | 781 |
| 776 | 782 | private func emitSelection() { | | 783 | + // Caret moves advance the revision counter like text edits do: a | | 784 | + // controlled payload computed before this move is stale and must fail the | | 785 | + // revision guard instead of yanking the caret back mid-typing. | 777 | 786 | let currentValue = textView.serializedText() | 778 | 787 | let selection = sourceSelection() | | 788 | + nativeEventCount += 1 | 779 | 789 | onComposerSelectionChange([ | 780 | 790 | "value": currentValue, | 781 | 791 | "selection": ["start": selection.start, "end": selection.end], | @@ -817,10 +827,16 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro | 817 | 827 | NSMaxRange(nextRange) <= textView.attributedText.length else { | 818 | 828 | return | 819 | 829 | } | | 830 | + self.requestedSelection = nil | | 831 | + // Programmatically assigning selectedRange resets the keyboard's | | 832 | + // autocorrect and predictive-text context even when the range is | | 833 | + // unchanged, so a no-op assignment must be skipped. | | 834 | + guard !NSEqualRanges(nextRange, textView.selectedRange) else { | | 835 | + return | | 836 | + } | 820 | 837 | isApplyingControlledValue = true | 821 | 838 | textView.selectedRange = nextRange | 822 | 839 | isApplyingControlledValue = false | 823 | | - self.requestedSelection = nil | 824 | 840 | } | 825 | 841 |
| 826 | 842 | private func updatePlaceholderVisibility() { | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/agent-awareness/remoteRegistration.test.ts +76Lines changed: 76 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,12 +20,15 @@ import { | 20 | 20 | clearAgentAwarenessRegistrationRecord, | 21 | 21 | loadAgentAwarenessRegistrationRecord, | 22 | 22 | loadOrCreateAgentAwarenessDeviceId, | | 23 | + loadPreferences, | 23 | 24 | saveAgentAwarenessRegistrationRecord, | 24 | 25 | } from "../../persistence/imperative"; | | 26 | +import type { Preferences } from "../../persistence/mobile-preferences"; | 25 | 27 | import { makeRelayDeviceRegistrationRequest, resolveApsEnvironment } from "./registrationPayload"; | 26 | 28 | import { | 27 | 29 | AgentAwarenessOperationError, | 28 | 30 | __resetAgentAwarenessRemoteRegistrationForTest, | | 31 | + armAgentAwarenessLiveActivityForLocalWork, | 29 | 32 | getAgentAwarenessRegistrationStatus, | 30 | 33 | mergeAgentAwarenessRegistrationPreferences, | 31 | 34 | refreshActiveLiveActivityRemoteRegistration, | @@ -43,6 +46,13 @@ import * as Notifications from "expo-notifications"; | 43 | 46 | const secureStore = vi.hoisted(() => new Map<string, string>()); | 44 | 47 | const widgetMocks = vi.hoisted(() => ({ | 45 | 48 | getInstances: vi.fn(() => []), | | 49 | + start: vi.fn(() => ({})), | | 50 | +})); | | 51 | +const environmentConfigsMock = vi.hoisted(() => ({ | | 52 | + configs: new Map< | | 53 | + string, | | 54 | + { environment: { capabilities: { agentActivityPublishing?: boolean } } } | | 55 | + >(), | 46 | 56 | })); | 47 | 57 | const backgroundRuntime = vi.hoisted(() => ({ | 48 | 58 | pending: [] as Array<{ | @@ -77,9 +87,22 @@ vi.mock("expo-widgets", () => ({ | 77 | 87 | vi.mock("../../widgets/AgentActivity", () => ({ | 78 | 88 | default: { | 79 | 89 | getInstances: widgetMocks.getInstances, | | 90 | + start: widgetMocks.start, | 80 | 91 | }, | 81 | 92 | })); | 82 | 93 |
| | 94 | +// The state modules pull the whole connection stack (and native expo modules) | | 95 | +// into the import graph; the arming gate only needs the configs map. | | 96 | +vi.mock("../../state/atom-registry", () => ({ | | 97 | + appAtomRegistry: { | | 98 | + get: () => environmentConfigsMock.configs, | | 99 | + }, | | 100 | +})); | | 101 | + | | 102 | +vi.mock("../../state/server", () => ({ | | 103 | + environmentServerConfigsAtom: Symbol("environmentServerConfigsAtom"), | | 104 | +})); | | 105 | + | 83 | 106 | vi.mock("expo-notifications", () => ({ | 84 | 107 | addPushTokenListener: vi.fn(() => ({ remove: vi.fn() })), | 85 | 108 | getDevicePushTokenAsync: vi.fn(() => Promise.resolve({ type: "ios", data: "apns-token" })), | @@ -227,6 +250,8 @@ describe("makeRelayDeviceRegistrationRequest", () => { | 227 | 250 | vi.mocked(loadOrCreateAgentAwarenessDeviceId).mockResolvedValue("device-1"); | 228 | 251 | widgetMocks.getInstances.mockReset(); | 229 | 252 | widgetMocks.getInstances.mockReturnValue([]); | | 253 | + widgetMocks.start.mockClear(); | | 254 | + environmentConfigsMock.configs.clear(); | 230 | 255 | }); | 231 | 256 |
| 232 | 257 | it("preserves disabled Live Activity preferences in relay registrations", () => { | @@ -856,4 +881,55 @@ describe("makeRelayDeviceRegistrationRequest", () => { | 856 | 881 | }).pipe(Effect.provide(relayTestLayer)); | 857 | 882 | }, | 858 | 883 | ); | | 884 | + | | 885 | + it("skips the Live Activity seed when the environment reports publishing disabled", async () => { | | 886 | + setAgentAwarenessRelayTokenProvider(() => Promise.resolve("clerk-token-user-a")); | | 887 | + vi.mocked(loadPreferences).mockResolvedValueOnce({ | | 888 | + liveActivitiesEnabled: true, | | 889 | + } as Preferences); | | 890 | + environmentConfigsMock.configs.set("env-1", { | | 891 | + environment: { capabilities: { agentActivityPublishing: false } }, | | 892 | + }); | | 893 | + | | 894 | + armAgentAwarenessLiveActivityForLocalWork({ | | 895 | + environmentId: "env-1" as EnvironmentId, | | 896 | + threadTitle: "Fix the flaky test", | | 897 | + projectTitle: "t3code", | | 898 | + }); | | 899 | + await new Promise((resolve) => setTimeout(resolve, 0)); | | 900 | + | | 901 | + expect(widgetMocks.start).not.toHaveBeenCalled(); | | 902 | + }); | | 903 | + | | 904 | + it("seeds the Live Activity for publishing and pre-capability environments", async () => { | | 905 | + setAgentAwarenessRelayTokenProvider(() => Promise.resolve("clerk-token-user-a")); | | 906 | + environmentConfigsMock.configs.set("env-publishing", { | | 907 | + environment: { capabilities: { agentActivityPublishing: true } }, | | 908 | + }); | | 909 | + | | 910 | + vi.mocked(loadPreferences).mockResolvedValueOnce({ | | 911 | + liveActivitiesEnabled: true, | | 912 | + } as Preferences); | | 913 | + armAgentAwarenessLiveActivityForLocalWork({ | | 914 | + environmentId: "env-publishing" as EnvironmentId, | | 915 | + threadTitle: "Fix the flaky test", | | 916 | + projectTitle: "t3code", | | 917 | + }); | | 918 | + await new Promise((resolve) => setTimeout(resolve, 0)); | | 919 | + expect(widgetMocks.start).toHaveBeenCalledTimes(1); | | 920 | + | | 921 | + // An environment without the capability may run an older server that | | 922 | + // still publishes; only an explicit false skips the seed. | | 923 | + widgetMocks.start.mockClear(); | | 924 | + vi.mocked(loadPreferences).mockResolvedValueOnce({ | | 925 | + liveActivitiesEnabled: true, | | 926 | + } as Preferences); | | 927 | + armAgentAwarenessLiveActivityForLocalWork({ | | 928 | + environmentId: "env-pre-capability" as EnvironmentId, | | 929 | + threadTitle: "Fix the flaky test", | | 930 | + projectTitle: "t3code", | | 931 | + }); | | 932 | + await new Promise((resolve) => setTimeout(resolve, 0)); | | 933 | + expect(widgetMocks.start).toHaveBeenCalledTimes(1); | | 934 | + }); | 859 | 935 | }); |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/agent-awareness/remoteRegistration.ts +23-1Lines changed: 23 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,6 +20,8 @@ import { | 20 | 20 |
| 21 | 21 | import type { SavedRemoteConnection } from "../../lib/connection"; | 22 | 22 | import { runtime } from "../../lib/runtime"; | | 23 | +import { appAtomRegistry } from "../../state/atom-registry"; | | 24 | +import { environmentServerConfigsAtom } from "../../state/server"; | 23 | 25 | import type { Preferences } from "../../persistence/mobile-preferences"; | 24 | 26 | import { | 25 | 27 | clearAgentAwarenessRegistrationRecord, | @@ -448,18 +450,38 @@ function unregisterDeviceWithRelay(input: { | 448 | 450 | }); | 449 | 451 | } | 450 | 452 |
| | 453 | +// The environment descriptor advertises whether agent-activity publishes | | 454 | +// currently leave that server (`capabilities.agentActivityPublishing`). Only | | 455 | +// an explicit false skips the seed card: older servers omit the capability | | 456 | +// but may still publish. | | 457 | +function environmentPublishesAgentActivity(environmentId: EnvironmentId): boolean { | | 458 | + return ( | | 459 | + appAtomRegistry.get(environmentServerConfigsAtom).get(environmentId)?.environment.capabilities | | 460 | + .agentActivityPublishing !== false | | 461 | + ); | | 462 | +} | | 463 | + | 451 | 464 | // Arms the lock-screen card the moment the user starts agent work from this | 452 | 465 | // phone, while the app is still foregrounded and the fresh activity's token | 453 | 466 | // can be registered immediately. The seeded row is a best-effort placeholder; | 454 | 467 | // the relay's registration replay repaints it with the authoritative | 455 | | -// aggregate within seconds. No-ops when a card is already armed. | | 468 | +// aggregate within seconds. No-ops when a card is already armed, and skips | | 469 | +// environments that report publishing disabled — the seed would sit on | | 470 | +// "Connecting" forever with no update ever arriving to repaint or end it. | 456 | 471 | export function armAgentAwarenessLiveActivityForLocalWork(input: { | | 472 | + readonly environmentId: EnvironmentId; | 457 | 473 | readonly threadTitle: string; | 458 | 474 | readonly projectTitle: string; | 459 | 475 | }): void { | 460 | 476 | if (!canRegisterRemoteLiveActivities() || !relayTokenProvider) { | 461 | 477 | return; | 462 | 478 | } | | 479 | + if (!environmentPublishesAgentActivity(input.environmentId)) { | | 480 | + logRegistrationDebug("live activity arming skipped; environment does not publish", { | | 481 | + environmentId: input.environmentId, | | 482 | + }); | | 483 | + return; | | 484 | + } | 463 | 485 | void loadPreferences() | 464 | 486 | .catch(() => null) | 465 | 487 | .then((preferences) => { | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/files/FileTreeBrowser.tsx +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,6 +8,7 @@ import { AppText as Text } from "../../components/AppText"; | 8 | 8 | import { PierreEntryIcon } from "../../components/PierreEntryIcon"; | 9 | 9 | import { cn } from "../../lib/cn"; | 10 | 10 | import { useThemeColor } from "../../lib/useThemeColor"; | | 11 | +import { IOS_NAV_BAR_HEIGHT } from "../../lib/layoutMetrics"; | 11 | 12 | import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass"; | 12 | 13 | import { | 13 | 14 | buildFileTree, | @@ -123,7 +124,7 @@ export function FileTreeBrowser(props: { | 123 | 124 | const insets = useSafeAreaInsets(); | 124 | 125 | // Native transparent-header height ≈ safe-area top + nav bar (~44). Matches the | 125 | 126 | // observed adjustedContentInset bottom (~102) seen in the native trace. | 126 | | - const headerInset = NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 44 : 0; | | 127 | + const headerInset = NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + IOS_NAV_BAR_HEIGHT : 0; | 127 | 128 | const iconColor = String(useThemeColor("--color-icon-muted")); | 128 | 129 | const { onPreviewFile, onSelectFile, selectedPath: controlledSelectedPath } = props; | 129 | 130 | const controlledSelectedPathRef = useRef(controlledSelectedPath); | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/home/HomeRouteScreen.tsx +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,7 +11,7 @@ import { useSavedRemoteConnections } from "../../state/use-remote-environment-re | 11 | 11 | import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout"; | 12 | 12 | import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail"; | 13 | 13 | import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar"; | 14 | | -import { checkForAppUpdateOnLaunch } from "../updates/app-updates"; | | 14 | +import { checkForAppUpdateOnLaunch, startAppUpdateForegroundRecheck } from "../updates/app-updates"; | 15 | 15 | import { AndroidHomeFabLayout } from "./AndroidHomeFab"; | 16 | 16 | import { HomeScreen } from "./HomeScreen"; | 17 | 17 | import { HomeHeader } from "./HomeHeader"; | @@ -34,6 +34,7 @@ export function HomeRouteScreen() { | 34 | 34 |
| 35 | 35 | useEffect(() => { | 36 | 36 | void checkForAppUpdateOnLaunch(); | | 37 | + startAppUpdateForegroundRecheck(); | 37 | 38 | }, []); | 38 | 39 |
| 39 | 40 | const { | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/review/ReviewSheet.tsx +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,6 +39,7 @@ import { environmentCatalog } from "../../connection/catalog"; | 39 | 39 | import { useEnvironmentPresentation } from "../../state/presentation"; | 40 | 40 | import { useAtomCommand } from "../../state/use-atom-command"; | 41 | 41 | import { useThemeColor } from "../../lib/useThemeColor"; | | 42 | +import { IOS_NAV_BAR_HEIGHT } from "../../lib/layoutMetrics"; | 42 | 43 | import { useThreadDraftForThread } from "../../state/use-thread-composer-state"; | 43 | 44 | import { EnvironmentConnectionNotice } from "../connection/EnvironmentConnectionNotice"; | 44 | 45 | import { | @@ -277,9 +278,11 @@ function ReviewFileNavigator({ | 277 | 278 | // The nested native header is translucent; start the list below it so | 278 | 279 | // the scroll-edge effect can sample the content (same treatment as | 279 | 280 | // FileTreeBrowser in the Files pane). | 280 | | - paddingTop: Platform.OS === "ios" ? insets.top + 44 + 8 : 8, | | 281 | + paddingTop: Platform.OS === "ios" ? insets.top + IOS_NAV_BAR_HEIGHT + 8 : 8, | 281 | 282 | }} | 282 | | - scrollIndicatorInsets={Platform.OS === "ios" ? { top: insets.top + 44 } : undefined} | | 283 | + scrollIndicatorInsets={ | | 284 | + Platform.OS === "ios" ? { top: insets.top + IOS_NAV_BAR_HEIGHT } : undefined | | 285 | + } | 283 | 286 | renderItem={renderFile} | 284 | 287 | /> | 285 | 288 | ); | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/settings/SettingsRouteScreen.tsx +12-5Lines changed: 12 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -608,7 +608,10 @@ function AppSettingsSection() { | 608 | 608 | if (updateInFlight.current) return; | 609 | 609 | updateInFlight.current = true; | 610 | 610 | try { | | 611 | + // The user asked for this restart by tapping the version row, so it may | | 612 | + // apply immediately instead of prompting. | 611 | 613 | await runAppUpdateCheck({ | | 614 | + applyMode: "immediate", | 612 | 615 | onFailure: (message) => Alert.alert("Update failed", message), | 613 | 616 | onStateChange: setUpdateState, | 614 | 617 | }); | @@ -631,11 +634,15 @@ function AppSettingsSection() { | 631 | 634 | ? "Checking…" | 632 | 635 | : updateState === "downloading" | 633 | 636 | ? "Downloading…" | 634 | | - : updateState === "restarting" | 635 | | - ? "Restarting…" | 636 | | - : updateState === "current" | 637 | | - ? "Up to date" | 638 | | - : null; | | 637 | + : // "ready" appears only when this check joined an in-flight background-mode | | 638 | + // check; that download installs at the next backgrounding. | | 639 | + updateState === "ready" | | 640 | + ? "Update ready" | | 641 | + : updateState === "restarting" | | 642 | + ? "Restarting…" | | 643 | + : updateState === "current" | | 644 | + ? "Up to date" | | 645 | + : null; | 639 | 646 |
| 640 | 647 | const versionRow = ( | 641 | 648 | <View className="flex-row items-center gap-4 p-4"> | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/GitActionProgressOverlay.tsx +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,11 +7,13 @@ import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanim | 7 | 7 | import { useSafeAreaInsets } from "react-native-safe-area-context"; | 8 | 8 |
| 9 | 9 | import { AppText as Text } from "../../components/AppText"; | | 10 | +import { APP_BAR_HEIGHT } from "../../lib/layoutMetrics"; | 10 | 11 | import { tryOpenExternalUrl } from "../../lib/openExternalUrl"; | 11 | 12 | import { useThemeColor } from "../../lib/useThemeColor"; | 12 | 13 | import type { GitActionProgress } from "../../state/use-vcs-action-state"; | 13 | 14 |
| 14 | 15 | const OVERLAY_LAYOUT_TRANSITION = LinearTransition.duration(220); | | 16 | +const OVERLAY_TOP_GAP = 8; | 15 | 17 | const AnimatedLiquidGlassView = Animated.createAnimatedComponent(LiquidGlassView); | 16 | 18 |
| 17 | 19 | export function GitActionProgressOverlay(props: { | @@ -52,7 +54,7 @@ export function GitActionProgressOverlay(props: { | 52 | 54 | entering={isLiquidGlassSupported ? undefined : FadeIn.duration(200)} | 53 | 55 | exiting={FadeOut.duration(150)} | 54 | 56 | className="absolute inset-x-3 z-[100]" | 55 | | - style={{ top: insets.top + 48 }} | | 57 | + style={{ top: insets.top + APP_BAR_HEIGHT + OVERLAY_TOP_GAP }} | 56 | 58 | pointerEvents="box-none" | 57 | 59 | > | 58 | 60 | <Pressable onPress={handlePress}> | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/NewTaskDraftScreen.tsx +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -709,6 +709,7 @@ export function NewTaskDraftScreen(props: { | 709 | 709 | // -only Activity start. If creation fails, the token registration's replay | 710 | 710 | // finds no work and ends the card within seconds. | 711 | 711 | armAgentAwarenessLiveActivityForLocalWork({ | | 712 | + environmentId: selectedProject.environmentId, | 712 | 713 | threadTitle: deriveThreadTitleFromPrompt(initialMessageText), | 713 | 714 | projectTitle: selectedProject.title, | 714 | 715 | }); | |
|