Skip to content

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.

Welcome page: your recent sessions beside the shortcuts (#382)

Deec266b5f39082
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 24bd67fad..8422f66aa 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -265,6 +265,17 @@ class _SwarmScreenState extends State<SwarmScreen> {
Widget _startGuide() => WorkspaceWelcome(
key: ValueKey('welcome:${app.activeSwarmId}'),
onCommand: _runShortcut,
+ // What to pick up, opened into this tab the way Cmd-P opens it: a harness
+ // as itself, a conversation Harness did not start as a harness resuming it.
+ app: app,
+ projects: _projects.projects,
+ onOpen: (row) => unawaited(
+ _activateSearch(
+ SwarmSearchSelection(row),
+ app.activeSwarmId,
+ placement: HarnessPlacement.currentTab,
+ ),
+ ),
);
void _showKeyboardShortcuts() {
diff --git a/desktop/lib/state/welcome_sessions.dart b/desktop/lib/state/welcome_sessions.dart
new file mode 100644
index 000000000..dc1b8873e
--- /dev/null
+++ b/desktop/lib/state/welcome_sessions.dart
@@ -0,0 +1,119 @@
+import 'package:flutter/foundation.dart';
+
+import 'app_state.dart';
+import 'session_content_search.dart';
+import 'swarm_catalog.dart';
+import 'swarm_navigation.dart';
+import 'swarm_search.dart' show externalSessionDestination;
+
+/// What the welcome page offers to pick up: the harnesses you were just with,
+/// and the Claude Code and Codex conversations on your machines that Harness
+/// did not start — the latest [limit] of them by activity, whatever machine.
+///
+/// Read once when the page shows, like Cmd-P: the rows keep their order and
+/// numbers while the page is on screen, and the next showing reads again.
+/// Harnesses are in the app already; the others are asked of each machine's
+/// session index (`session_search` with a time and no words).
+class WelcomeSessions extends ChangeNotifier {
+ WelcomeSessions(
+ this.app, {
+ this.projects = const [],
+ this.limit = 9,
+ this.window = const Duration(days: 30),
+ DateTime Function()? now,
+ }) : _now = now ?? DateTime.now;
+
+ final AppNotifier app;
+ final List<SavedSwarmProject> projects;
+ final int limit;
+
+ /// How far back a conversation Harness did not start is offered.
+ final Duration window;
+ final DateTime Function() _now;
+
+ List<SwarmDestination> _rows = const [];
+ List<SwarmDestination> get rows => _rows;
+
+ /// Still asking the machines for their conversations.
+ bool loading = false;
+ late DateTime readAt = _now();
+ bool _disposed = false;
+ final _asked = <String>{};
+ bool _hadAgents = false;
+ List<SwarmDestination> _external = const [];
+
+ /// The app changed. At launch the page shows before machines connect and
+ /// their harnesses arrive — before most of what it offers exists — so a
+ /// machine not yet asked, or the first harnesses, read the list again. Nothing
+ /// else does: activity alone never reorders it while it is on screen.
+ void appChanged() {
+ if (loading || _disposed) return;
+ final unasked = app.searchableMachineIds.any(
+ (machine) => !_asked.contains(machine),
+ );
+ if (unasked || (!_hadAgents && _anyAgents)) load();
+ }
+
+ Future<void> load() async {
+ readAt = _now();
+ final harnesses = [
+ for (final row in SwarmSearchCatalog().read(app, projects))
+ if (row.agentId != null &&
+ row.lastActivityAt != null &&
+ app.stateOf(row.machineId ?? '')?.nodeOnline != false)
+ row,
+ ];
+ _hadAgents = _anyAgents;
+ // What the machines said last stays until they answer again.
+ _rows = _latest([...harnesses, ..._external]);
+ loading = true;
+ notifyListeners();
+ final when = (
+ from: readAt.subtract(window),
+ to: readAt,
+ phrase: 'last ${window.inDays} days',
+ );
+ final machines = app.searchableMachineIds.toList();
+ _asked.addAll(machines);
+ final answers = await Future.wait([
+ for (final machine in machines)
+ app.searchSessions(machine, '', when: when, limit: 30),
+ ]);
+ if (_disposed) return;
+ final external = <SwarmDestination>[
+ for (final hits in answers)
+ for (final hit in hits ?? const <SessionContentHit>[])
+ // One a terminal still has is not offered: it cannot be opened here.
+ if (hit.external case final ref? when !ref.open)
+ externalSessionDestination(
+ hit,
+ ref,
+ machineLabel:
+ app.stateOf(hit.machineId)?.machine.displayName ?? '',
+ ),
+ ];
+ _external = external;
+ _rows = _latest([...harnesses, ...external]);
+ loading = false;
+ notifyListeners();
+ }
+
+ bool get _anyAgents =>
+ app.machineStates.values.any((machine) => machine.agents.isNotEmpty);
+
+ List<SwarmDestination> _latest(List<SwarmDestination> all) {
+ final sorted = [...all]
+ ..sort(
+ (a, b) => (b.lastActivityAt ?? DateTime(0)).compareTo(
+ a.lastActivityAt ?? DateTime(0),
+ ),
+ );
+ return List.unmodifiable(sorted.take(limit));
+ }
+
+ @override
+ void dispose() {
+ _disposed = true;
+ super.dispose();
+ }
+}
diff --git a/desktop/lib/widgets/workspace_welcome.dart b/desktop/lib/widgets/workspace_welcome.dart
index 9b8237e7b..2ec809ba4 100644
--- a/desktop/lib/widgets/workspace_welcome.dart
+++ b/desktop/lib/widgets/workspace_welcome.dart
@@ -1,6 +1,13 @@
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import '../shared/theme/app_theme.dart' as grid;
+import '../state/app_state.dart';
+import '../state/harness_sessions.dart';
+import '../state/swarm_catalog.dart';
+import '../state/swarm_navigation.dart';
+import '../state/welcome_sessions.dart';
+import 'engine_identity.dart';
import '../shared/theme/appearance_prefs_store.dart';
import '../shared/theme/harness_background.dart';
import 'swarm_wallpaper.dart';
@@ -11,10 +18,102 @@ import '../shortcuts/keymap_commands.dart';
import '../terminal/terminal_text.dart';
/// A quiet terminal welcome. Opening a command is always an explicit action.
-class WorkspaceWelcome extends StatelessWidget {
- const WorkspaceWelcome({super.key, required this.onCommand});
+///
+/// With [app], it also offers what to pick up: the harnesses you were just
+/// with and the Claude Code and Codex conversations on your machines that
+/// Harness did not start ([WelcomeSessions]), numbered 1–9 like the terminal
+/// client's home. [onOpen] opens one in this tab, as Cmd-P would.
+class WorkspaceWelcome extends StatefulWidget {
+ const WorkspaceWelcome({
+ super.key,
+ required this.onCommand,
+ this.app,
+ this.projects = const [],
+ this.onOpen,
+ });
final ValueChanged<String> onCommand;
+ final AppNotifier? app;
+ final List<SavedSwarmProject> projects;
+ final ValueChanged<SwarmDestination>? onOpen;
+
+ @override
+ State<WorkspaceWelcome> createState() => _WorkspaceWelcomeState();
+}
+
+class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {
+ WelcomeSessions? _sessions;
+ int _cursor = 0;
+
+ ValueChanged<String> get onCommand => widget.onCommand;
+
+ @override
+ void initState() {
+ super.initState();
+ final app = widget.app;
+ if (app != null && widget.onOpen != null) {
+ _sessions = WelcomeSessions(app, projects: widget.projects)
+ ..addListener(_changed);
+ _sessions!.load();
+ app.addListener(_appChanged);
+ }
+ }
+
+ void _appChanged() => _sessions?.appChanged();
+
+ void _changed() {
+ if (mounted) setState(() {});
+ }
+
+ @override
+ void dispose() {
+ if (_sessions != null) widget.app?.removeListener(_appChanged);
+ _sessions
+ ?..removeListener(_changed)
+ ..dispose();
+ super.dispose();
+ }
+
+ void _open(int index) {
+ final rows = _sessions?.rows ?? const [];
+ if (index < 0 || index >= rows.length) return;
+ widget.onOpen?.call(rows[index]);
+ }
+
+ /// A tab with nothing in it has no pane to take keys: plain ones work here,
+ /// as on the terminal client's home. Anything else goes on to the shortcuts.
+ KeyEventResult _key(FocusNode node, KeyEvent event) {
+ if (event is! KeyDownEvent && event is! KeyRepeatEvent) {
+ return KeyEventResult.ignored;
+ }
+ final rows = _sessions?.rows ?? const [];
+ if (rows.isEmpty ||
+ HardwareKeyboard.instance.isMetaPressed ||
+ HardwareKeyboard.instance.isControlPressed ||
+ HardwareKeyboard.instance.isAltPressed) {
+ return KeyEventResult.ignored;
+ }
+ final key = event.logicalKey;
+ final digit = key.keyLabel.length == 1 ? int.tryParse(key.keyLabel) : null;
+ if (digit != null && digit >= 1 && digit <= rows.length) {
+ _open(digit - 1);
+ return KeyEventResult.handled;
+ }
+ if (key == LogicalKeyboardKey.arrowDown) {
+ setState(() => _cursor = (_cursor + 1).clamp(0, rows.length - 1));
+ return KeyEventResult.handled;
+ }
+ if (key == LogicalKeyboardKey.arrowUp) {
+ setState(() => _cursor = (_cursor - 1).clamp(0, rows.length - 1));
+ return KeyEventResult.handled;
+ }
+ if (key == LogicalKeyboardKey.enter ||
+ key == LogicalKeyboardKey.numpadEnter) {
+ _open(_cursor.clamp(0, rows.length - 1));
+ return KeyEventResult.handled;
+ }
+ return KeyEventResult.ignored;
+ }
static const _actions = [
('agent.new', 'Start an agent'),
@@ -81,35 +180,46 @@ class WorkspaceWelcome extends StatelessWidget {
.map((row) => widthOf(row.description))
.reduce((a, b) => a > b ? a : b);
final line = MediaQuery.textScalerOf(context).scale(style.fontSize!) * 1.5;
+ final cell = widthOf('M');
+ final commandsWidth = keyWidth + descriptionWidth;
+ // The sessions to pick up, beside the commands: a fixed measure, so a long
+ // title gives way rather than the page.
+ final listWidth = cell * 44;
+ final gap = cell * 2;
+ final sessions = _sessionsList(
+ style: style,
+ ink: ink,
+ accent: accent,
+ cell: cell,
+ );
final footerInset = line + 52;
- return Material(
- key: const ValueKey('workspace-welcome'),
- color: grid.AppPalette.swarmWelcome,
- child: Stack(
- fit: StackFit.expand,
- children: [
- RepaintBoundary(
- key: const ValueKey('welcome-wallpaper'),
- child: SwarmWallpaper(background: background),
- ),
- LayoutBuilder(
- // Keep the text centered when it fits, but let large text scroll
- // above the fixed Customize button rather than underneath it.
- builder: (context, constraints) => Padding(
- padding: EdgeInsets.only(bottom: footerInset),
- child: SingleChildScrollView(
- key: const ValueKey('welcome-scroll'),
- padding: EdgeInsets.fromLTRB(24, footerInset + 24, 24, 24),
- child: ConstrainedBox(
- constraints: BoxConstraints(
- minHeight: (constraints.maxHeight - footerInset * 2 - 48)
- .clamp(0, double.infinity),
- ),
- child: Center(
- child: ConstrainedBox(
- constraints: BoxConstraints(
- maxWidth: keyWidth + descriptionWidth,
- ),
+ return Focus(
+ autofocus: _sessions != null,
+ onKeyEvent: _key,
+ child: Material(
+ key: const ValueKey('workspace-welcome'),
+ color: grid.AppPalette.swarmWelcome,
+ child: Stack(
+ fit: StackFit.expand,
+ children: [
+ RepaintBoundary(
+ key: const ValueKey('welcome-wallpaper'),
+ child: SwarmWallpaper(background: background),
+ ),
+ LayoutBuilder(
+ // Keep the text centered when it fits, but let large text scroll
+ // above the fixed Customize button rather than underneath it.
+ builder: (context, constraints) => Padding(
+ padding: EdgeInsets.only(bottom: footerInset),
+ child: SingleChildScrollView(
+ key: const ValueKey('welcome-scroll'),
+ padding: EdgeInsets.fromLTRB(24, footerInset + 24, 24, 24),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: (constraints.maxHeight - footerInset * 2 - 48)
+ .clamp(0, double.infinity),
+ ),
+ child: Center(
child: DefaultTextStyle(
style: style,
textAlign: TextAlign.center,
@@ -122,41 +232,55 @@ class WorkspaceWelcome extends StatelessWidget {
key: const ValueKey('welcome-tagline'),
),
SizedBox(height: line),
- for (final row in rows)
- TextButton(
- key: ValueKey('welcome-${row.command}'),
- onPressed: () => onCommand(row.command),
- style: TextButton.styleFrom(
- foregroundColor: ink,
- textStyle: style,
- padding: const EdgeInsets.symmetric(
- vertical: 2,
- ),
- minimumSize: Size.zero,
- tapTargetSize:
- MaterialTapTargetSize.shrinkWrap,
- shape: const RoundedRectangleBorder(),
- ),
+ if (sessions == null)
+ _commands(
+ rows,
+ commandsWidth,
+ keyWidth,
+ style,
+ ink,
+ accent,
+ )
+ // Side by side when both fit; the commands go under
+ // the list in a narrow window.
+ else if (constraints.maxWidth - 48 >=
+ listWidth + gap * 2 + 1 + commandsWidth)
+ IntrinsicHeight(
child: Row(
+ mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- SizedBox(
- width: keyWidth,
- child: Text(
- row.hint ?? '',
- style: TextStyle(color: accent),
- textAlign: TextAlign.left,
- ),
+ SizedBox(width: listWidth, child: sessions),
+ SizedBox(width: gap),
+ Container(
+ key: const ValueKey('welcome-rule'),
+ width: 1,
+ color: ink.withValues(alpha: .15),
),
- Expanded(
- child: Text(
- row.description,
- textAlign: TextAlign.left,
- ),
+ SizedBox(width: gap),
+ _commands(
+ rows,
+ commandsWidth,
+ keyWidth,
+ style,
+ ink,
+ accent,
),
],
),
+ )
+ else ...[
+ SizedBox(width: listWidth, child: sessions),
+ SizedBox(height: line),
+ _commands(
+ rows,
+ commandsWidth,
+ keyWidth,
+ style,
+ ink,
+ accent,
),
+ ],
],
),
),
@@ -165,15 +289,176 @@ class WorkspaceWelcome extends StatelessWidget {
),
),
),
+ Positioned(
+ right: 20,
+ bottom: 16,
+ child: TerminalTextAction(
+ key: const ValueKey('welcome-customize'),
+ onPressed: () => onCommand('app.customize'),
+ label: 'Customize Harness',
+ overArtwork: hasArtwork,
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ /// The commands, each with its shortcut: the whole page before there is
+ /// anything to pick up, and the column beside the list after.
+ Widget _commands(
+ List<({String command, String description, String? hint})> rows,
+ double width,
+ double keyWidth,
+ TextStyle style,
+ Color ink,
+ Color accent,
+ ) => SizedBox(
+ width: width,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ for (final row in rows)
+ TextButton(
+ key: ValueKey('welcome-${row.command}'),
+ onPressed: () => onCommand(row.command),
+ style: TextButton.styleFrom(
+ foregroundColor: ink,
+ textStyle: style,
+ padding: const EdgeInsets.symmetric(vertical: 2),
+ minimumSize: Size.zero,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ shape: const RoundedRectangleBorder(),
+ ),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox(
+ width: keyWidth,
+ child: Text(
+ row.hint ?? '',
+ style: TextStyle(color: accent),
+ textAlign: TextAlign.left,
+ ),
+ ),
+ Expanded(
+ child: Text(row.description, textAlign: TextAlign.left),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ );
+
+ /// What to pick up, numbered: null when there is nothing to offer. Every row
+ /// is alike — a harness or a conversation Harness did not start, its name
+ /// and how long ago; where it came from is not this page's business.
+ Widget? _sessionsList({
+ required TextStyle style,
+ required Color ink,
+ required Color accent,
+ required double cell,
+ }) {
+ final sessions = _sessions;
+ if (sessions == null) return null;
+ final rows = sessions.rows;
+ final muted = ink.withValues(alpha: .55);
+ if (rows.isEmpty) {
+ return sessions.loading && widget.app!.searchableMachineIds.isNotEmpty
+ ? Text(
+ 'Finding your sessions…',
+ textAlign: TextAlign.left,
+ style: TextStyle(color: muted),
+ )
+ : null;
+ }
+ return Column(
+ key: const ValueKey('welcome-sessions'),
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ for (final (index, row) in rows.indexed)
+ _sessionRow(
+ index,
+ row,
+ style: style,
+ ink: ink,
+ muted: muted,
+ accent: accent,
+ cell: cell,
+ ),
+ ],
+ );
+ }
+
+ Widget _sessionRow(
+ int index,
+ SwarmDestination row, {
+ required TextStyle style,
+ required Color ink,
+ required Color muted,
+ required Color accent,
+ required double cell,
+ }) {
+ final machine = widget.app!.stateOf(row.machineId ?? '');
+ final agent = row.agentId == null
+ ? null
+ : machine?.agents.where((agent) => agent.id == row.agentId).firstOrNull;
+ final at = row.lastActivityAt;
+ final readAt = _sessions!.readAt;
+ final age = at == null
+ ? ''
+ : readAt.difference(at).inMinutes < 1
+ ? 'now'
+ : harnessActivityAge(at, readAt);
+ final selected = index == _cursor;
+ return TextButton(
+ key: ValueKey('welcome-session-${row.id}'),
+ onPressed: () => _open(index),
+ style: TextButton.styleFrom(
+ foregroundColor: ink,
+ backgroundColor: selected
+ ? Colors.white.withValues(alpha: .07)
+ : Colors.transparent,
+ textStyle: style,
+ padding: const EdgeInsets.symmetric(vertical: 2),
+ minimumSize: Size.zero,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ shape: const RoundedRectangleBorder(),
+ ),
+ child: Row(
+ children: [
+ SizedBox(
+ width: cell * 3,
+ child: Text(
+ '${index + 1}',
+ textAlign: TextAlign.left,
+ style: TextStyle(color: accent),
+ ),
+ ),
+ Padding(
+ padding: EdgeInsets.only(right: cell),
+ child: EngineMark(
+ engine: agent?.identityEngine ?? row.engine,
+ displayName: agent?.identityDisplayName,
+ size: (style.fontSize ?? 13) * 1.1,
+ ),
+ ),
+ Expanded(
+ child: Text(
+ row.title,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ textAlign: TextAlign.left,
+ ),
),
- Positioned(
- right: 20,
- bottom: 16,
- child: TerminalTextAction(
- key: const ValueKey('welcome-customize'),
- onPressed: () => onCommand('app.customize'),
- label: 'Customize Harness',
- overArtwork: hasArtwork,
+ SizedBox(
+ width: cell * 5,
+ child: Text(
+ age,
+ textAlign: TextAlign.right,
+ style: TextStyle(color: muted),
),
),
],
diff --git a/desktop/test/welcome_sessions_test.dart b/desktop/test/welcome_sessions_test.dart
new file mode 100644
index 000000000..00dd82086
--- /dev/null
+++ b/desktop/test/welcome_sessions_test.dart
@@ -0,0 +1,233 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/state/swarm_navigation.dart';
+import 'package:harness/state/welcome_sessions.dart';
+import 'package:harness/widgets/workspace_welcome.dart';
+
+import 'session_content_search_test.dart' show SearchConnection;
+import 'swarm_state_test.dart' show createApp;
+
+final _now = DateTime(2026, 9, 27, 12);
+
+Map<String, dynamic> _external(
+ String id,
+ String title,
+ Duration ago, {
+ bool open = false,
+}) => {
+ 'agentId': '',
+ 'sessionId': id,
+ 'engine': 'codex',
+ 'field': 'ask',
+ 'snippet': '',
+ 'together': true,
+ 'score': .5,
+ 'lastAt': _now.subtract(ago).millisecondsSinceEpoch,
+ 'external': {
+ 'title': title,
+ 'cwd': '/work/$id',
+ 'origin': 'codex-app',
+ 'open': open,
+ },
+};
+
+Agent _agent(String id, String name, Duration ago) => Agent(
+ id: id,
+ sessionId: 's-$id',
+ name: name,
+ engine: 'claude',
+ terminalAvailable: true,
+ lastActivityAt: _now.subtract(ago),
+);
+
+/// A machine with three harnesses and, on its disk, three conversations
+/// Harness did not start — one of them still open in a terminal.
+({SearchConnection connection, WelcomeSessions sessions}) _setup() {
+ final connection = SearchConnection({
+ '': [
+ _external('e-nfc', 'Continue NFC device chat', const Duration(hours: 2)),
+ _external(
+ 'e-open',
+ 'Still open elsewhere',
+ const Duration(minutes: 1),
+ open: true,
+ ),
+ _external('e-old', 'Research local AI', const Duration(days: 6)),
+ ],
+ });
+ final app = createApp(connected: true, connectionForTest: (_) => connection);
+ app.machineStates['m']!.agents = [
+ _agent('a1', 'Command palette search results', const Duration(minutes: 5)),
+ _agent('a2', 'Deploy latest firmware', const Duration(days: 1)),
+ _agent('a3', 'Landing page redesign', const Duration(days: 9)),
+ ];
+ addTearDown(app.dispose);
+ final sessions = WelcomeSessions(app, now: () => _now, limit: 4);
+ addTearDown(sessions.dispose);
+ return (connection: connection, sessions: sessions);
+}
+
+void main() {
+ test('offers harnesses and conversations Harness did not start, latest first, never one open elsewhere', () async {
+ final (:connection, :sessions) = _setup();
+ final loading = sessions.load();
+ // The harnesses are there at once; the machines answer after.
+ expect(sessions.rows.map((row) => row.agentId), ['a1', 'a2', 'a3']);
+ expect(sessions.loading, isTrue);
+ await loading;
+ expect(sessions.loading, isFalse);
+ expect(connection.asked, ['']);
+ expect(sessions.rows.map((row) => row.external?.sessionId ?? row.agentId), [
+ 'a1',
+ 'e-nfc',
+ 'a2',
+ 'e-old',
+ ], reason: 'by activity, capped, and not the one a terminal still has');
+ final nfc = sessions.rows[1];
+ expect(nfc.title, 'Continue NFC device chat');
+ expect(nfc.id, externalDestinationId('m', 'e-nfc'));
+ });
+
+ testWidgets(
+ 'numbers, arrows, Enter and a click each open a row; other keys go on',
+ (tester) async {
+ final (connection: _, :sessions) = _setup();
+ final app = sessions.app;
+ final opened = <String>[];
+ await tester.pumpWidget(
+ MaterialApp(
+ home: WorkspaceWelcome(
+ onCommand: (_) {},
+ app: app,
+ onOpen: (row) =>
+ opened.add(row.external?.sessionId ?? row.agentId!),
+ ),
+ ),
+ );
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 50));
+ expect(find.byKey(const ValueKey('welcome-sessions')), findsOneWidget);
+ expect(find.text('Continue NFC device chat'), findsOneWidget);
+ expect(find.text('Still open elsewhere'), findsNothing);
+
+ await tester.sendKeyEvent(LogicalKeyboardKey.digit2);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.tap(find.text('Command palette search results'));
+ // A number past the list, and a shortcut, are not the list's.
+ await tester.sendKeyEvent(LogicalKeyboardKey.digit9);
+ await tester.sendKeyDownEvent(LogicalKeyboardKey.metaLeft);
+ await tester.sendKeyEvent(LogicalKeyboardKey.digit1);
+ await tester.sendKeyUpEvent(LogicalKeyboardKey.metaLeft);
+ expect(opened, ['e-nfc', 'a2', 'a1']);
+ },
+ );
+
+ testWidgets(
+ 'the list beside the commands when both fit, above them when not, and only the commands with nothing to offer',
+ (tester) async {
+ final (connection: _, :sessions) = _setup();
+ Future<void> show(Size size, WelcomeSessions? offered) async {
+ tester.view.physicalSize = size;
+ tester.view.devicePixelRatio = 1;
+ await tester.pumpWidget(
+ MaterialApp(
+ key: UniqueKey(),
+ home: WorkspaceWelcome(
+ onCommand: (_) {},
+ app: offered?.app,
+ onOpen: (_) {},
+ ),
+ ),
+ );
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 50));
+ }
+
+ addTearDown(tester.view.reset);
+ final list = find.byKey(const ValueKey('welcome-sessions'));
+ final rule = find.byKey(const ValueKey('welcome-rule'));
+ final start = find.byKey(const ValueKey('welcome-agent.new'));
+
+ await show(const Size(1600, 900), sessions);
+ expect(rule, findsOneWidget);
+ expect(
+ tester.getTopLeft(start).dx,
+ greaterThan(tester.getTopRight(list).dx),
+ );
+
+ await show(const Size(560, 900), sessions);
+ expect(rule, findsNothing);
+ expect(
+ tester.getTopLeft(start).dy,
+ greaterThan(tester.getBottomLeft(list).dy),
+ );
+
+ await show(const Size(1600, 900), null);
+ expect(list, findsNothing);
+ expect(rule, findsNothing);
+ expect(start, findsOneWidget);
+ },
+ );
+
+ testWidgets(
+ 'without an app it is the welcome it was: no list, no keys taken',
+ (tester) async {
+ await tester.pumpWidget(
+ MaterialApp(home: WorkspaceWelcome(onCommand: (_) {})),
+ );
+ expect(find.byKey(const ValueKey('welcome-sessions')), findsNothing);
+ expect(find.text('Harness like a boss.'), findsOneWidget);
+ },
+ );
+
+ test('fills in as machines connect and harnesses arrive at launch, and only then', () async {
+ final connection = SearchConnection({
+ '': [
+ _external(
+ 'e-nfc',
+ 'Continue NFC device chat',
+ const Duration(hours: 2),
+ ),
+ ],
+ });
+ // Launch: the machine is not connected yet, and has told us of no harness.
+ final app = createApp(connectionForTest: (_) => connection);
+ addTearDown(app.dispose);
+ final sessions = WelcomeSessions(app, now: () => _now);
+ addTearDown(sessions.dispose);
+ await sessions.load();
+ expect(sessions.rows, isEmpty);
+ expect(connection.asked, isEmpty);
+
+ // It connects, and its harnesses arrive.
+ final machine = app.machineStates['m']!
+ ..nodeOnline = true
+ ..connectionStatus = ConnectionStatus.connected
+ ..agents = [
+ _agent(
+ 'a1',
+ 'Command palette search results',
+ const Duration(minutes: 5),
+ ),
+ ];
+ sessions.appChanged();
+ await pumpEventQueue();
+ expect(connection.asked, ['']);
+ expect(sessions.rows.map((row) => row.external?.sessionId ?? row.agentId), [
+ 'a1',
+ 'e-nfc',
+ ]);
+
+ // After that, activity alone does not read it again.
+ machine.agents = [
+ _agent('a1', 'Command palette search results', Duration.zero),
+ ];
+ sessions.appChanged();
+ await pumpEventQueue();
+ expect(connection.asked, ['']);
+ });
+}
diff --git a/docs/research/2026-09-26-session-search.md b/docs/research/2026-09-26-session-search.md
index d63171c43..9a5aaae2c 100644
--- a/docs/research/2026-09-26-session-search.md
+++ b/docs/research/2026-09-26-session-search.md
@@ -303,6 +303,12 @@ Enter opens one as a harness resuming it (`lib/sessionSearch/external.ts`).
session is open elsewhere, is already a harness, or its folder is gone (Codex app threads live in
folders people tidy away).
- ChatGPT conversations and Codex cloud tasks are not on disk, so they cannot be found.
+- **The welcome page lists them too.** An empty tab shows up to nine rows beside its shortcuts,
+ numbered like the terminal client's home: the harnesses you were just with and these
+ conversations from every machine (a `session_search` with the last 30 days and no words), each
+ just a name and an age. A narrow window puts the shortcuts under the list; with nothing to offer
+ the page is the shortcuts alone. A new user's first screen is their existing Claude Code and
+ Codex work, one key away.
Checked on one machine's real folders through a sandboxed daemon: the Codex app's threads and
terminal sessions were found by what was said in them. A session open in a terminal was refused.