A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
fix fullscreen login url copying (#336)
ktcd981e6500f3
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.mdindex 713484406a..c5b3be3d9d 100644--- a/packages/coding-agent/CHANGELOG.md+++ b/packages/coding-agent/CHANGELOG.md@@ -2,6 +2,7 @@## [Unreleased]+- Fixed login dialogs in fullscreen so sign-in URLs can be selected natively ([ENG-4480](https://linear.app/primeintellect/issue/ENG-4480/new-fullscreen-tui-makes-it-impossible-to-copy-login-url)).- Fixed provider auth failures leaving stale credentials shown as connected in `/login` ([ENG-4491](https://linear.app/primeintellect/issue/ENG-4491/mark-provider-stale-after-repeated-401s)).## [0.2.6] - 2026-07-06diff --git a/packages/coding-agent/src/modes/interactive/auth-flows.ts b/packages/coding-agent/src/modes/interactive/auth-flows.tsindex cda0c15edc..8f5f4c047f 100644--- a/packages/coding-agent/src/modes/interactive/auth-flows.ts+++ b/packages/coding-agent/src/modes/interactive/auth-flows.ts@@ -527,7 +527,10 @@ export class ProviderAuthFlows {PRIME_INFERENCE_PROVIDER_NAME,);- const handle = showFullPaneOverlay(this.host.ui, dialog, 88);+ const handle = showFullPaneOverlay(this.host.ui, dialog, {+ maxContentWidth: 88,+ suspendFullscreenMouse: true,+ });const closeDialog = () => {handle.hide();@@ -643,7 +646,10 @@ export class ProviderAuthFlows {PRIME_AGENT_TRACES_PROVIDER_NAME,);- const handle = showFullPaneOverlay(this.host.ui, dialog, 88);+ const handle = showFullPaneOverlay(this.host.ui, dialog, {+ maxContentWidth: 88,+ suspendFullscreenMouse: true,+ });const closeDialog = () => {handle.hide();@@ -828,7 +834,10 @@ export class ProviderAuthFlows {providerName,);- const dialogHandle = showFullPaneOverlay(this.host.ui, dialog, 88);+ const dialogHandle = showFullPaneOverlay(this.host.ui, dialog, {+ maxContentWidth: 88,+ suspendFullscreenMouse: true,+ });// Promise for manual code input (racing with callback server)let manualCodeResolve: ((code: string) => void) | undefined;diff --git a/packages/coding-agent/src/modes/interactive/components/centered-overlay.ts b/packages/coding-agent/src/modes/interactive/components/centered-overlay.tsindex f8a990ffa3..8c9e16d1a3 100644--- a/packages/coding-agent/src/modes/interactive/components/centered-overlay.ts+++ b/packages/coding-agent/src/modes/interactive/components/centered-overlay.ts@@ -3,6 +3,7 @@ import {type Focusable,isFocusable,type OverlayHandle,+ type OverlayOptions,type TUI,truncateToWidth,visibleWidth,@@ -18,23 +19,39 @@ interface InputHandler {handleInput(data: string): void;}+interface FullPaneOverlayOptions {+ maxContentWidth?: number;+ suspendFullscreenMouse?: boolean;+}+function hasInputHandler(component: Component): component is Component & InputHandler {return typeof (component as { handleInput?: unknown }).handleInput === "function";}/** Shows a component as a full-pane centered overlay on the given TUI. */-export function showFullPaneOverlay(ui: TUI, component: Component, maxContentWidth = 80): OverlayHandle {+export function showFullPaneOverlay(+ ui: TUI,+ component: Component,+ options: number | FullPaneOverlayOptions = 80,+): OverlayHandle {+ const { maxContentWidth = 80, suspendFullscreenMouse } =+ typeof options === "number" ? { maxContentWidth: options } : options;+ const overlayOptions: OverlayOptions = {+ width: "100%",+ maxHeight: "100%",+ row: 0,+ col: 0,+ };+ if (suspendFullscreenMouse) {+ overlayOptions.suspendFullscreenMouse = true;+ }+return ui.showOverlay(new CenteredOverlayComponent(component, {getRows: () => ui.terminal.rows,maxContentWidth,}),- {- width: "100%",- maxHeight: "100%",- row: 0,- col: 0,- },+ overlayOptions,);}diff --git a/packages/coding-agent/src/modes/interactive/components/login-dialog.ts b/packages/coding-agent/src/modes/interactive/components/login-dialog.tsindex 7c6fcde8c4..91e0c4fd38 100644--- a/packages/coding-agent/src/modes/interactive/components/login-dialog.ts+++ b/packages/coding-agent/src/modes/interactive/components/login-dialog.ts@@ -148,6 +148,7 @@ export class LoginDialogComponent extends Container implements Focusable {this.addLabel("Sign-in link");const linkedUrl = getCapabilities().hyperlinks ? `\x1b]8;;${url}\x07${url}\x1b]8;;\x07` : url;this.contentContainer.addChild(new Text(theme.fg("text", linkedUrl), 0, 0));+ this.contentContainer.addChild(new Text(theme.fg("muted", keyHint("tui.select.cancel", "cancel")), 0, 0));if (instructions) {this.contentContainer.addChild(new Spacer(1));diff --git a/packages/tui/CHANGELOG.md b/packages/tui/CHANGELOG.mdindex 73f1789654..544a667503 100644--- a/packages/tui/CHANGELOG.md+++ b/packages/tui/CHANGELOG.md@@ -2,6 +2,8 @@## [Unreleased]+- Fixed fullscreen overlays that request native mouse behavior suspending mouse tracking while visible.+## [0.2.6] - 2026-07-06- Fixed fullscreen overlay selection so login URLs can be copied.diff --git a/packages/tui/src/tui.ts b/packages/tui/src/tui.tsindex 4d33569781..e8e7c851c5 100644--- a/packages/tui/src/tui.ts+++ b/packages/tui/src/tui.ts@@ -192,6 +192,8 @@ export interface OverlayOptions {visible?: (termWidth: number, termHeight: number) => boolean;/** If true, don't capture keyboard focus when shown */nonCapturing?: boolean;+ /** If true, temporarily disable fullscreen mouse tracking while the overlay is visible. */+ suspendFullscreenMouse?: boolean;}/**@@ -381,6 +383,7 @@ export class TUI extends Container {if (!options?.nonCapturing && this.isOverlayVisible(entry)) {this.setFocus(component);}+ this.syncFullscreenMouseTracking();this.terminal.hideCursor();this.requestRender();@@ -396,6 +399,7 @@ export class TUI extends Container {this.setFocus(topVisible?.component ?? entry.preFocus);}if (this.overlayStack.length === 0) this.terminal.hideCursor();+ this.syncFullscreenMouseTracking();this.requestRender();}},@@ -416,6 +420,7 @@ export class TUI extends Container {this.setFocus(component);}}+ this.syncFullscreenMouseTracking();this.requestRender();},isHidden: () => entry.hidden,@@ -425,12 +430,14 @@ export class TUI extends Container {this.setFocus(component);}entry.focusOrder = ++this.focusOrderCounter;+ this.syncFullscreenMouseTracking();this.requestRender();},unfocus: () => {if (this.focusedComponent !== component) return;const topVisible = this.getTopmostVisibleOverlay();this.setFocus(topVisible && topVisible !== entry ? topVisible.component : entry.preFocus);+ this.syncFullscreenMouseTracking();this.requestRender();},isFocused: () => this.focusedComponent === component,@@ -447,6 +454,7 @@ export class TUI extends Container {this.setFocus(topVisible?.component ?? overlay.preFocus);}if (this.overlayStack.length === 0) this.terminal.hideCursor();+ this.syncFullscreenMouseTracking();this.requestRender();}@@ -475,6 +483,17 @@ export class TUI extends Container {return undefined;}+ private shouldEnableFullscreenMouseTracking(): boolean {+ if (!this.fullscreen?.mouse) return false;+ return !this.overlayStack.some(+ (entry) => entry.options?.suspendFullscreenMouse === true && this.isOverlayVisible(entry),+ );+ }++ private syncFullscreenMouseTracking(): void {+ this.terminal.setMouseTracking(this.shouldEnableFullscreenMouseTracking());+ }+override invalidate(): void {super.invalidate();for (const overlay of this.overlayStack) overlay.component.invalidate?.();@@ -606,9 +625,7 @@ export class TUI extends Container {};this.terminal.enterAltScreen();this.terminal.hideCursor();- if (options.mouse !== false) {- this.terminal.setMouseTracking(true);- }+ this.syncFullscreenMouseTracking();this.requestRender();}@@ -620,7 +637,7 @@ export class TUI extends Container {if (!this.fullscreen) return;const { inlineState } = this.fullscreen;this.fullscreen = null;- this.terminal.setMouseTracking(false);+ this.syncFullscreenMouseTracking();this.terminal.leaveAltScreen();this.previousLines = inlineState.previousLines;this.previousKittyImageIds = inlineState.previousKittyImageIds;@@ -764,7 +781,7 @@ export class TUI extends Container {if (isMouseSequence(data)) {// consumed even when disabled — mouse reports are garbage downstream- const event = fullscreen.mouse ? parseSgrMouseEvent(data) : null;+ const event = this.terminal.mouseTrackingActive ? parseSgrMouseEvent(data) : null;if (event && !overlayFocused) {const viewport = fullscreen.viewport;if (isWheelUp(event)) {@@ -1239,6 +1256,7 @@ export class TUI extends Container {if (!fullscreen) return;const width = this.terminal.columns;const height = this.terminal.rows;+ this.syncFullscreenMouseTracking();this.overlaySelectionRegions = [];const transcript: string[] = [];diff --git a/packages/tui/test/fullscreen.test.ts b/packages/tui/test/fullscreen.test.tsindex 1b5b7ec7f1..7f1b7728f3 100644--- a/packages/tui/test/fullscreen.test.ts+++ b/packages/tui/test/fullscreen.test.ts@@ -256,6 +256,37 @@ describe("TUI fullscreen mode", () => {tui.stop();});+ it("suspends fullscreen mouse tracking while a visible overlay requests native mouse", async () => {+ const { terminal, tui, chat, dock } = setup(lines(20), 80, 10);+ tui.enterFullscreen({ scroll: [chat], dock });+ await terminal.waitForRender();+ assert.strictEqual(terminal.mouseTrackingActive, true);++ const overlay = new InputComponent();+ overlay.lines = ["https://example.com/login"];+ const handle = tui.showOverlay(overlay, {+ anchor: "center",+ width: 40,+ suspendFullscreenMouse: true,+ });+ await terminal.waitForRender();+ assert.strictEqual(terminal.mouseTrackingActive, false);++ handle.setHidden(true);+ await terminal.waitForRender();+ assert.strictEqual(terminal.mouseTrackingActive, true);++ handle.setHidden(false);+ await terminal.waitForRender();+ assert.strictEqual(terminal.mouseTrackingActive, false);++ handle.hide();+ await terminal.waitForRender();+ assert.strictEqual(terminal.mouseTrackingActive, true);++ tui.stop();+ });+it("drag-selecting focused overlay text copies from the fullscreen frame", async () => {const { terminal, tui, chat, dock } = setup(lines(20), 80, 10);const copies: string[] = [];