The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Restore terminal input immediately when Find closes
dee8d754dba5dbe
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dartindex 2d059bab2..cd7a27732 100644--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@ -769,7 +769,16 @@ class _TerminalPanelState extends State<TerminalPanel>_findOriginLine = null;_findOriginBuffer = null;if (rebuild && mounted) setState(() {});- if (focus) _claimFocusAfterFrame();+ if (focus) {+ // The retained terminal is already mounted. Return its input connection+ // now: the next key can arrive before Find's removal is painted.+ final view = _laidOutTerminalView();+ if (view != null) {+ _claimFocus(view);+ } else {+ _claimFocusAfterFrame();+ }+ }}@overridediff --git a/desktop/test/terminal_find_test.dart b/desktop/test/terminal_find_test.dartindex 946186472..9784b91b0 100644--- a/desktop/test/terminal_find_test.dart+++ b/desktop/test/terminal_find_test.dart@@ -6,6 +6,7 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/terminal/terminal_binary.dart';import 'package:harness/terminal/terminal_session.dart';import 'package:harness/terminal/terminal_search.dart';+import 'package:harness/widgets/terminal_composer.dart';import 'package:harness/widgets/terminal_find_bar.dart';import 'package:xterm/xterm.dart';@@ -57,6 +58,87 @@ Future<void> output();void main() {+ for (final closeWithEscape in [true, false]) {+ testWidgets(+ 'closing Find returns the next key before a frame (Escape=$closeWithEscape)',+ (tester) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ final input = <TerminalBinaryFrame>[];+ final session = terminal('a0', input);+ await output(session, 0, 'first marker\r\n', keyframe: true);+ app.adoptSessionForTest(session);+ try {+ await mount(tester, app);+ await chord(tester, LogicalKeyboardKey.keyF);+ await tester.enterText(findField, 'marker');+ await finishFind(tester);+ final view = terminalView(tester, session);+ final renderer = view.renderTerminal;+ if (closeWithEscape) {+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ } else {+ await tester.tap(find.byTooltip('Close find (Esc)'));+ }+ // Two input events can arrive before the next frame. Search should+ // have relinquished both hardware keys and the native text client.+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);+ tester.testTextInput.enterText('resume');+ await tester.pump(const Duration(milliseconds: 10));+ expect(findField, findsNothing);+ expect(view.renderTerminal, same(renderer));+ expect(+ input.expand((frame) => frame.bytes).toList(),+ [27, 91, 68, ...utf8.encode('resume')],+ );+ await chord(tester, LogicalKeyboardKey.keyF);+ expect(tester.widget<TextField>(findField).controller!.text, 'marker');+ } finally {+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ }+ },+ );+ }++ testWidgets('closing Find returns rapid typing to the visible composer', (+ tester,+ ) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ final input = <TerminalBinaryFrame>[];+ final session = terminal('a0', input);+ await output(session, 0, 'first marker\r\n', keyframe: true);+ app.adoptSessionForTest(session);+ app.toggleComposer(app.focusedPaneId!);+ final composer = find.descendant(+ of: find.byType(TerminalComposer),+ matching: find.byType(TextField),+ );+ try {+ await mount(tester, app);+ await tester.enterText(composer, 'draft');+ final controller = tester.widget<TextField>(composer).controller!;+ await chord(tester, LogicalKeyboardKey.keyF);+ await tester.enterText(findField, 'marker');+ await finishFind(tester);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);+ expect(controller.selection, const TextSelection.collapsed(offset: 4));+ tester.testTextInput.enterText('draft continued');+ await tester.pump(const Duration(milliseconds: 10));+ expect(findField, findsNothing);+ expect(controller.text, 'draft continued');+ expect(tester.widget<TextField>(composer).focusNode!.hasFocus, isTrue);+ expect(input, isEmpty, reason: 'the composer sends only on submission');+ await chord(tester, LogicalKeyboardKey.keyF);+ expect(tester.widget<TextField>(findField).controller!.text, 'marker');+ } finally {+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ }+ });+testWidgets('live output refreshes matches without rebuilding the Find editor',(tester) async {diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.mdindex c197667b6..39cc87de2 100644--- a/docs/harness-agent-first-tabs.md+++ b/docs/harness-agent-first-tabs.md@@ -129,6 +129,10 @@ output without scheduling paints. Regression fixtures cover delayed history andreconnects for local and remote sessions, multi-pane resize, retained-pane reuse,hidden output, and input arriving between output and the next layout.+Closing Find returns keyboard and text input to the retained terminal or visible+message composer immediately, without waiting for another frame. The next key+cannot be lost in the closing search field or replace its remembered query.+A relayout request also reaches panes whose dimensions are unchanged, includingneighbors of an added pane and a reapplied preset. Returning to live output cancelsin-flight scroll animation and dial inertia, so their next tick cannot pull thediff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.mdindex 3a1552b6e..58fb07e19 100644--- a/docs/harness-v2-handoff.md+++ b/docs/harness-v2-handoff.md@@ -76,11 +76,13 @@ are:## Current source and verification-The latest application change is **8b73106**; **d5785d6** records its verified-Release. The application sources are unchanged by this documentation checkpoint.+The current continuation restores keyboard/text input immediately when Find+closes. All affected checks, analysis and full desktop regressions pass. The+prepared Release still contains **8b73106** and needs rebuilding for this change.| Checkpoint | Verified change || --- | --- |+| **Current source** — Find dismissal | Escape or the close button previously lost an arrow key and text arriving before the next frame. Dismissal now immediately restores the retained terminal's input connection, or the visible composer's field and draft. The renderer and remembered Find query stay intact. || **8b73106** — terminal Find | Ten output updates now rebuild the editor zero times instead of ten. Results update around it while match, caret, composition and focus remain stable. Enter/keypad Enter and Escape return to the platform input method during composition; normal navigation/dismissal resumes afterward. || **99d1ac9** — workspace events | Routine heartbeats and dial scrolling no longer rebuild the workspace or visit unrelated retained terminal JSON handlers. Busy-state transitions, watchdog expiry, dial status, hidden ready replies and machine transport failures retain their routing. || **d5756ab** — Layout | Repeating the configured Layout chord cycles choices; modified digits/arrows cannot accidentally apply a shape. Highlighting preserves geometry. Large text gets readable, scrollable choices and navigation follows actual wrapped rows. Confirmation retains the agent and latest output. |@@ -91,17 +93,17 @@ Release. The application sources are unchanged by this documentation checkpoint.Current checks:-- **1,435 desktop unit/widget checks pass**, with one optional CLI-media- placeholder skipped. Log: /private/tmp/harness-find-editor-full.log.-- All **39 affected Find/search/reconnect/keymap checks pass**. Both changed- files analyze cleanly. Logs: /private/tmp/harness-find-editor-after.log and- /private/tmp/harness-find-editor-analyze.log. The before-fix failures are in- /private/tmp/harness-find-editor-before.log.+- **1,438 desktop unit/widget checks pass**, with one optional CLI-media+ placeholder skipped. Log: /private/tmp/harness-find-focus-full.log.+- All **70 affected Find/focus/composer/viewport/keymap checks pass**. Both+ changed files analyze cleanly. Logs: /private/tmp/harness-find-focus-checks.log+ and /private/tmp/harness-find-focus-analyze.log. The two before-fix terminal+ failures are in /private/tmp/harness-find-focus-before.log.- The current exported Dart bindings pass **84 native keyboard checks** and**363 AppKit titlebar checks**, including hidden native window layout.Log: /private/tmp/harness-current-native-contract.log. The script completed;it displayed no windows and opened no agents.-- The normal arm64 **Release build succeeds** through 8b73106. Both rebuilt+- The preceding arm64 **Release build succeeds** through 8b73106. Both rebuiltframeworks verified before refreshing the outer ad-hoc signature; the fullbundle passed deep, strict signature verification.Build log: /private/tmp/harness-find-editor-release.log.@@ -205,7 +207,8 @@ to another computer with Git.initially unfocused search, expansion/dismissal, command mode, Tab-focusedrows, composition and the first key after activation through both nativemenu and keyboard entry. Check New Harness folder focus/cancellation,- Layout repeated chords and confirmation, and Find during output/composition.+ Layout repeated chords and confirmation, and Find during output/composition,+ including the immediate next key after closing it.Observe fresh dependencies, provider sign-in/browser return, native folderchoice, clone, first task and a second harness. Record actual steps, errorsand time to a usable agent. Public GitHub cloning passed a direct disposablediff --git a/docs/harness-v2-performance.md b/docs/harness-v2-performance.mdindex dc6d08fad..238b86bff 100644--- a/docs/harness-v2-performance.md+++ b/docs/harness-v2-performance.md@@ -12,6 +12,26 @@ It prints `SWARM_BENCH` JSON records. Its filename deliberately does not end in## Current continuation benchmark (2026-09-14)+### Immediate input after closing terminal Find++Find previously waited for the next frame to return focus to the retained+terminal. In the current SwarmScreen fixture, Escape or the close button followed+immediately by an arrow key and committed text lost both inputs. The closing+field could also receive text intended for the terminal and change the saved+search query.++Dismissal now returns input to the already-mounted terminal immediately. If a+remote message composer is visible, its existing field gets focus instead, keeps+its draft, and accepts the next edit without submitting it. The renderer and+remembered Find query remain intact. The three regression checks exercise the+hardware-key and text-input paths without an intervening frame; they do not+measure native latency or qualify a live input-method session.++All **70 affected Find/focus/composer/viewport/keymap checks** pass in+`/private/tmp/harness-find-focus-checks.log`. Both changed files analyze cleanly+in `/private/tmp/harness-find-focus-analyze.log`. The two failing-before terminal+cases are recorded in `/private/tmp/harness-find-focus-before.log`.+### Terminal Find editor work and composition keysTen matching output updates caused ten rebuilds of the Find text field even