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
Keep useful existing context visible after session commit receipts
dee08f4c9839a37
diff --git a/desktop/lib/state/session_preview.dart b/desktop/lib/state/session_preview.dartindex e5c6bb6f4..ea2195c39 100644--- a/desktop/lib/state/session_preview.dart+++ b/desktop/lib/state/session_preview.dart@@ -12,6 +12,7 @@ typedef SessionPreviewKey = ({/// transcript, attaches a terminal, or sends input to an agent.class SessionPreview {final List<String> requests = [];+ final List<String> earlierResponses = [];String? currentRequest, liveText, completedText, savedText, activity;String _streamText = '';bool turnOpen = false,@@ -32,6 +33,18 @@ class SessionPreview {? requests.skip(1).firstOrNull: null;String? get response => completedText ?? savedText;+ // A commit receipt often follows the actual explanation. Reuse an earlier+ // existing response for compact group context, keeping the receipt available+ // as the latest response in the full preview. This is text selection only.+ String? get contextResponse =>+ response != null &&+ RegExp(+ r"^(?:(?:i['’]ll|i will|i['’]m)\s+)?(?:commit(?:ted|ting)?|push(?:ed|ing)?)\b",+ caseSensitive: false,+ ).hasMatch(response!.trimLeft()) &&+ earlierResponses.isNotEmpty+ ? earlierResponses.first+ : response;bool get hasContent =>latestRequest != null || liveText != null || response != null;@@ -139,16 +152,20 @@ class SessionPreviewStore extends ChangeNotifier {}final events = reply['events'];if (events is List) {+ final responses = <String>[];for (final event in events.take(3)) {if (event is! Map || event['kind'] != 'summary') continue;final text =previewText(event['fullText'], limit: 6000) ??previewText(event['text'], limit: 6000) ??previewText(event['recap'], limit: 6000);- if (text != null) {- entry.savedText = text;- break;- }+ if (text != null && !responses.contains(text)) responses.add(text);+ }+ if (responses.isNotEmpty) {+ entry.savedText = responses.first;+ entry.earlierResponses+ ..clear()+ ..addAll(responses.skip(1));}}// Asks and summaries are independent lists, with no shared turn id.diff --git a/desktop/lib/widgets/swarm_search_preview.dart b/desktop/lib/widgets/swarm_search_preview.dartindex 55f9a8b1d..533845af8 100644--- a/desktop/lib/widgets/swarm_search_preview.dart+++ b/desktop/lib/widgets/swarm_search_preview.dart@@ -249,7 +249,9 @@ class _AgentPreview extends StatelessWidget {final response = record?.response ?? (!working ? record?.liveText : null);final excerpt =waiting?.prompt ??- (working ? request ?? activity ?? response : response ?? request);+ (working+ ? request ?? activity ?? response+ : record?.contextResponse ?? response ?? request);return Column(crossAxisAlignment: CrossAxisAlignment.start,@@ -383,6 +385,32 @@ class _AgentPreview extends StatelessWidget {? 'Last response · interrupted': 'Latest response',response,+ maxLines: record?.earlierResponses.isNotEmpty == true+ ? 6+ : null,+ ),+ if (record?.earlierResponses.isNotEmpty == true)+ Padding(+ padding: const EdgeInsets.only(bottom: 24),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ 'Earlier in this session',+ style: _muted.copyWith(fontWeight: FontWeight.w500),+ ),+ for (final text in record!.earlierResponses)+ Padding(+ padding: const EdgeInsets.only(top: 10),+ child: Text(+ _displayText(text),+ maxLines: 4,+ overflow: TextOverflow.ellipsis,+ style: _body,+ ),+ ),+ ],+ ),),if (request != null) _Section('Recent request', request),if (record?.earlierRequest case final earlier?)@@ -426,8 +454,9 @@ class _AgentPreview extends StatelessWidget {}class _Section extends StatelessWidget {- const _Section(this.label, this.text);+ const _Section(this.label, this.text, {this.maxLines});final String label, text;+ final int? maxLines;@overrideWidget build(BuildContext context) => Padding(padding: const EdgeInsets.only(bottom: 24),@@ -436,7 +465,12 @@ class _Section extends StatelessWidget {children: [Text(label, style: _muted.copyWith(fontWeight: FontWeight.w500)),const SizedBox(height: 7),- Text(_displayText(text), style: _body),+ Text(+ _displayText(text),+ style: _body,+ maxLines: maxLines,+ overflow: maxLines == null ? null : TextOverflow.ellipsis,+ ),],),);diff --git a/desktop/test/session_preview_test.dart b/desktop/test/session_preview_test.dartindex f85294065..295d97b3a 100644--- a/desktop/test/session_preview_test.dart+++ b/desktop/test/session_preview_test.dart@@ -49,6 +49,46 @@ void main() {},);+ test(+ 'a commit receipt retains the existing explanation for context',+ () async {+ final store = SessionPreviewStore(+ canFetch: (_) => true,+ fetchRecent: (_) async => {+ 'events': [+ {+ 'kind': 'summary',+ 'fullText': 'I’ll commit the prototype.\n\nCommitted and pushed.',+ },+ {+ 'kind': 'summary',+ 'fullText':+ 'Highlight any message to add a shared comment thread.',+ },+ {+ 'kind': 'summary',+ 'fullText':+ 'Teammates can reply without sending a prompt to the agent.',+ },+ ],+ },+ );+ addTearDown(store.dispose);+ store.warm([a]);+ await Future<void>.delayed(Duration.zero);+ final preview = store.read(a)!;+ expect(+ preview.response,+ 'I’ll commit the prototype.\n\nCommitted and pushed.',+ );+ expect(+ preview.contextResponse,+ 'Highlight any message to add a shared comment thread.',+ );+ expect(preview.earlierResponses, hasLength(2));+ },+ );+test('background work is bounded and late replies cannot replace another session', () async {final pending = <SessionPreviewKey, Completer<Map<String, dynamic>>>{};final valid = {a, b, c};diff --git a/desktop/test/swarm_search_preview_test.dart b/desktop/test/swarm_search_preview_test.dartindex 9b7c4fbd2..003a2238b 100644--- a/desktop/test/swarm_search_preview_test.dart+++ b/desktop/test/swarm_search_preview_test.dart@@ -212,6 +212,40 @@ void main() {);}+ testWidgets(+ 'existing earlier explanations stay visible after a commit receipt',+ (tester) async {+ final app = createApp();+ await seedPreviews(app);+ final agent = app.machineStates['m']!.agents.first;+ final record = app.sessionPreviews.read(app.previewKey('m', agent))!;+ record.completedText =+ 'I’ll commit the checkout changes.\n\nCommitted and pushed.';+ record.earlierResponses.add(+ 'Retrying a checkout now reuses the original payment and receipt.',+ );+ app.adoptSessionForTest(terminal('a69', []));+ await mount(tester, app);+ await chord(tester, LogicalKeyboardKey.keyO);+ await tester.enterText(+ find.byKey(const ValueKey('swarm-search-input')),+ 'Checkout',+ );+ await tester.pump();+ final explanation = find.text(+ 'Retrying a checkout now reuses the original payment and receipt.',+ );+ expect(explanation, findsOneWidget);+ expect(find.text('Earlier in this session'), findsOneWidget);+ final preview = tester.getRect(+ find.byKey(const ValueKey('swarm-search-preview')),+ );+ expect(tester.getRect(explanation).bottom, lessThan(preview.bottom));+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );+for (final size in [const Size(1280, 800),const Size(760, 650),diff --git a/docs/harness-search-preview.md b/docs/harness-search-preview.mdindex 3c6d5c470..e0b16348f 100644--- a/docs/harness-search-preview.md+++ b/docs/harness-search-preview.md@@ -63,6 +63,14 @@ For example, the useful distinction is between “app v2” as a name and an excthat explains it is working on keeping only one empty New Harness tab. The actualrequest and response can establish that without generating a new summary.+The live UI check found a common exception: the newest answer can be only a+commit receipt, while an earlier saved answer explains the feature. The preview+therefore retains the three responses already returned by `agent_recent`,+showing short, explicitly labeled earlier excerpts alongside the latest one.+Compact group previews can use the earlier explanation when the latest answer+starts with a commit/push receipt. This selects existing text without generating+a task description or claiming an earlier answer belongs to the latest request.+Selection rules matter:- Preserve the substantive request when the most recent message is only “ok” ordiff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.mdindex 29d93ee4c..11062d6be 100644--- a/docs/harness-v2-handoff.md+++ b/docs/harness-v2-handoff.md@@ -46,8 +46,9 @@ are:precedence. Cmd-R splits right and Cmd-D splits down. Native menus, help and actualdispatch must agree; native menu and titlebar hover hints are removed.- New Tab uses the Google-like page with a **solid selected-tab background**,- lower centered controls and generous whitespace. Search is at most 640 logical- pixels wide, blank and focused initially. Typing, clicking, or pressing an arrow+ lower centered controls and generous whitespace. Resting search is at most 640 logical+ pixels wide, blank and focused initially. Its expanded preview can grow to 1120 pixels.+ Typing, clicking, or pressing an arrowreveals the same results, selection, arrows and Enter behavior as Cmd-O.Focus alone leaves results hidden and builds no catalog. Open Harness andaccented **+ New Harness** sit below it; a small official device image and@@ -60,6 +61,13 @@ are:**Open Harness / Open N Harnesses**, or the explicit split action. The modalhas a 90% black backdrop and no Commands footer, creation CTA or “or” divider.Commands remain available through Shift-Cmd-P or typing **>**.+- Both search entry points show existing session excerpts. Working sessions lead+ with the observed request and activity; idle sessions show an existing response.+ Pending questions are prominent and group previews put waiting agents first.+ No model calls or generated summaries: only `agent_recent` and ordinary live+ events. No `session_get`, full-history read, or terminal attachment. Cached+ selection is immediate; cold data fills asynchronously. Disconnected records+ retain saved text without claiming a live working/waiting state.- Creation uses **New Harness** for its title and CTA, with no ordinary Cancel.Escape or one outside click dismisses it directly. A pending launch cannot bedismissed accidentally; an uncertain outcome retains Close and Check status.@@ -90,25 +98,25 @@ Recent pushed checkpoints:| Checkpoint | Change || --- | --- |+| **76bdf6e** | Disconnected previews retain text with honest state; all preview and existing desktop checks verified together. |+| **91cfb6a** | Shared responsive previews in Cmd-O and inline search, waiting-first groups, retained keyboard ownership and visible actions after expansion. |+| **7da0c12** | Bounded existing-content cache, two background reads at a time, independent request/response records, stale-session guards and live event isolation. || **300f04d** | Every New Tab entry reuses the existing unused page, including at capacity. Restore collapses old duplicates without changing named or populated tabs. Rebases cleanly on 051ea5b, the separate link-prompt revisit fix. || **804eb93** | Clearer cropped official device image, hand cursors, pill buttons and transparent outlined Open buttons; consistent native/pane zoom and close icons; Rename Tab and Close Tab wording. || **518977c** | Roomier unified titlebar, hover-only tab close marks, minimal plus/group/branch icons, split shortcuts, and unique useful layout choices through the supported pane limit. || **f25e5a2** and preceding input checkpoints | Readable large-text entry choices, visible selected results after resize, retained renderer/input ownership, and immediate navigation/Find transitions. |-The current follow-up focuses start-page search on entry and when reusing an-unused page, while keeping results lazy. The surrounding shell no longer wins-initial autofocus. Pane controls now say Zoom Pane, Stop Harness and Close Pane;-the Stop confirmation accurately distinguishes stopping from deleting files or-pausing a process. The legacy CLI protocol is unchanged.--The final full run passed **1,540 desktop tests**, with one optional media-placeholder skipped. Six assertions in the keymap fixture incorrectly expected-autofocus after deliberate dismissal; after restoring those expectations, all-**20 keymap runtime tests pass**, covering the remaining six cases. Logs:-/private/tmp/harness-focus-stop-full-final.log and-/private/tmp/harness-focus-stop-keymap-final.log. The earlier single-empty-tab-checkpoint passed all 1,545 then-current tests in one run; main subsequently-added the link-prompt revisit case. The latest native contract run passes+The current preview uses existing session data only. A read-only local audit+found useful requests and full saved answers in several Codex sessions, and no+meaningful text in one Claude session. It does not invent missing content or+promise complete coverage for every engine. The protocol is unchanged.++The final full run passed **1,562 desktop tests**, with one optional media+placeholder skipped: /private/tmp/harness-preview-context-verified.log. All **13 changed+Dart files analyze cleanly**: /private/tmp/harness-preview-context-analyze.log.+The focused regression pass also covers large-text resize, remapped keyboard+actions, retained focus, first-use actions, caching and session identity.+The last unchanged native contract run passes**373 AppKit checks**, including hidden window layout,in /private/tmp/harness-one-start-tab-native.log; the prior keyboard exportpasses **85 native keymap checks**. Native latency benchmarking remains deferred.@@ -151,10 +159,11 @@ project would create its own folder, requiring no picker or typing. Do not inferthe project from the current pane in a multiproject workspace. The user has beentold candidly that entry/chrome polish is separate from this form redesign.-The user has now explicitly approved **building a useful, beautiful, fast search-preview** in Cmd-O and New Tab. Validate real excerpt content first, then build-the shared UI and cache. The [preview proposal](harness-search-preview.md) records-the acceptance criteria. The [Rex study](mitchellh-rex-study.md) is saved, pushed,+The user approved **building a useful, beautiful, fast search preview** in Cmd-O+and New Tab. The shared UI and cache are now implemented. The user explicitly+forbids generating new summaries: display available data only. The+[preview design](harness-search-preview.md) records the implementation and+coverage limits. The [Rex study](mitchellh-rex-study.md) is saved, pushed,and open for the user in Chrome. The following audit remains relevant:The old implementation at f04f6d3 read only already-attached terminal buffers,showed at most twelve nonblank tail lines, provided no group preview, and froze@@ -162,21 +171,23 @@ the snapshot while the selection stayed put. Terminal prompts/tool noise rarelyanswered which task this was or what happened. The failure was content selectionand availability, not simply insufficient preview width.-Current metadata is locally cached, but desktop Agent objects have no actual-prompt/reply excerpts. CLI normalization already yields user messages and replies;-`session_get` can read bounded registered-session windows. `agent_recent` exposes+The app owns a separate bounded session-excerpt cache; Agent metadata itself+still has no prompt/reply fields. CLI normalization yields user messages and replies.+`session_get` can return small windows but still read the entire transcript,+so it is intentionally excluded from the preview. `agent_recent` exposesasks and recaps, but recaps can be device-gated and absent. Do not treat nth askand nth recap as paired turns or assume coverage for every engine/remote daemon.-Proposed useful content: latest substantive request, latest meaningful answer or-result, and any waiting question, with project/branch/machine context. Groups-could show one useful line per member, waiting agents first. Precompute bounded-records as events arrive, cache by machine/agent/session revision, and render-cached content immediately on highlight. Refresh in the background, discarding-stale replies. Do not read full transcripts, query remotes, or invoke a model-on each arrow. Fresh uncached remote content cannot have literal zero latency;-keep selection responsive and make stale/offline content honest. Inspect real-examples across engines and cold/remote sessions before implementing this UI.+The preview shows existing requests, responses and waiting questions with+project/branch/machine context. Groups render visible members, waiting first.+The live check found commit receipts hiding useful older explanations, so the+preview now retains and displays the existing earlier response excerpts too.+The latest and earlier answers remain separately labeled; none are generated.+Bounded records update as events arrive and render from memory on highlight.+Background refresh discards stale session replies. A settled cold selection may+schedule the lightweight cache read; no arrow waits for it. Fresh uncached remote+content cannot have literal zero latency. More engine/remote coverage remains+useful; missing content must remain explicit.The three Rex posts and demo visuals/full captions have been reviewed, with nopost-inspired implementation: