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.

Keep Devices chat visible and hide unreachable devices (#582)

Dee187e618d66f6
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 659fdbaa2..56633d748 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -81,6 +81,11 @@ project on the machine where you installed it. Ask:
The agent should change `index.html` to say `Hello, Ada!`. Watch it update in the viewer beside
the terminal. You have now run an agent and a viewer together as your own harness.
+The workspace opens **70% viewer on the left, 30% agent chat on the right**.
+Both slots remain visible during loading and errors. See the
+[DSH workspace contract](desktop/design/dsh-workspace.md) before building a new
+dashboard or changing how a harness opens.
+
`--link` keeps the installed package connected to your checkout. Edit the instructions and start
a fresh harness in a new project to try them; instructions already copied into an existing
project are preserved. You can remove this example with `harness dsh remove examples/hello-world`;
diff --git a/desktop/AGENTS.md b/desktop/AGENTS.md
index d8654d75c..1e5d5eb60 100644
--- a/desktop/AGENTS.md
+++ b/desktop/AGENTS.md
@@ -2,6 +2,11 @@
Use [CLAUDE.md](CLAUDE.md) for architecture, build commands, and testing.
+For every DSH dashboard, follow the [DSH workspace contract](design/dsh-workspace.md):
+70% viewer on the left, 30% real agent chat on the right, including loading,
+missing dependencies, failures, retries, and restoration. Reserve the chat slot
+before startup; never let an unavailable conversation become a full-width viewer.
+
For all UI outside terminal panes, follow the
[desktop design system](design/desktop-design-system.md). The user's current
Mac-friendly direction supersedes earlier BIOS, fixed-cell, bracket-button,
diff --git a/desktop/design/desktop-ui-migration.md b/desktop/design/desktop-ui-migration.md
index 10d7951f9..6d5ec96bc 100644
--- a/desktop/design/desktop-ui-migration.md
+++ b/desktop/design/desktop-ui-migration.md
@@ -566,8 +566,9 @@ unmerged.
travel through that computer's authenticated daemon, with encrypted requests,
results and device-status events. Duplicate USB ids on different computers
stay separate. Shared harness access does not grant device control. Offline
- computers and unsupported daemons keep last readings visible with controls
- disabled; edits are never queued for later. Gestures remain local to the desk.
+ computers and unsupported daemons retain readings internally for reconnection;
+ their devices and connection errors are hidden from the dashboard. Edits are
+ never queued for later. Gestures remain local to the desk.
- Original [product photography](https://www.autonomous.ai/harness-device), shared
settings rows and light/dark surfaces frame the library, selected device,
USB setup and empty-state Shop entry. Names and model labels are saved locally
diff --git a/desktop/design/dsh-workspace.md b/desktop/design/dsh-workspace.md
new file mode 100644
index 000000000..7307e42a9
--- /dev/null
+++ b/desktop/design/dsh-workspace.md
@@ -0,0 +1,42 @@
+# DSH workspace contract
+
+Every domain-specific harness with a dashboard or viewer opens as one workspace:
+**viewer on the left at 70%, agent chat on the right at 30%.** This includes
+native utility harnesses such as Devices and companions, not just Store web
+viewers. The chat is the real agent terminal, with its existing input, approval,
+session, and resume behavior. Do not build a second chat implementation.
+
+Use the shared `PaneGrid` and `PaneArrangement.viewerBesideTerminal`. Reserve
+both slots before asynchronous setup starts. Keep the chat slot visible while
+loading, when its package or engine is missing, when launch fails, and while
+retrying or reconnecting. A short explanation and recovery action belong in
+that slot until the terminal can attach. `HarnessConversationPlaceholder` is the
+shared setup surface. Never expand the viewer because chat is not ready.
+
+Preserve the split when attaching or resuming the agent, restoring the tab,
+switching tabs, and retrying an uncertain creation. Reuse creation receipts;
+retry must not start a second conversation. Explicit user resizing and pane
+zoom remain available and must not be overwritten by automatic refreshes.
+
+For Devices, show devices only after their owning computer has answered and
+supports device management. Hide devices belonging to unreachable, unlinked,
+offline, or unsupported computers. Keep saved identities internally so they
+return after reconnection. Do not list fleet connection failures, package IDs,
+or transport errors above the dashboard. An empty result gets a calm connection
+instruction. A failed edit stays beside the affected device control.
+
+Verify the actual workspace, not a dashboard rendered alone:
+
+- Measure left/right placement and the 70/30 split before startup, after failure,
+ after a successful retry, and after restore. Check user-resized layouts too.
+- Test a missing bundled package and an unavailable engine. A ready-agent-only
+ preview misses the failure that previously removed Devices chat.
+- Check disconnected hosts disappear without messages, and reconnect with their
+ saved names. Unavailable hosts must never accept a setting change.
+- Review both light and dark appearance, a narrow window, and enlarged text.
+- For bundled harnesses, verify the released CLI actually includes the package
+ and required commands. A backend feature flag and a desktop build alone do
+ not ship a CLI bundle. Release required runtime support before exposing it.
+
+Packages without a viewer can remain terminal-only; they must not create a
+dashboard that takes over the terminal's workspace.
diff --git a/desktop/integration_test/devices_native_test.dart b/desktop/integration_test/devices_native_test.dart
index e1baa979e..8770b30cb 100644
--- a/desktop/integration_test/devices_native_test.dart
+++ b/desktop/integration_test/devices_native_test.dart
@@ -28,13 +28,16 @@ void main() {
await windowManager.focus();
});
testWidgets(
- 'Devices opens its native DSH, routes remote edits, and renders offline settings',
+ 'Devices opens its native DSH, routes remote edits, and hides unreachable devices',
(tester) async {
final app = DevicesReviewApp();
await app.prepare();
final projects = SwarmProjectStore();
final boundary = GlobalKey();
- Future<void> mount(Brightness brightness) async {
+ Future<void> mount(
+ Brightness brightness, {
+ DevicesReviewApp? notifier,
+ }) async {
grid.AppTheme.palette.value = brightness == Brightness.light
? HarnessPalette.paper
: HarnessPalette.graphite;
@@ -47,7 +50,7 @@ void main() {
theme: grid.buildAppTheme(brightness: brightness),
builder: (_, child) => grid.BrightnessScope(child: child!),
home: SwarmScreen(
- notifier: app,
+ notifier: notifier ?? app,
nativeTabs: true,
projectStore: projects,
),
@@ -67,6 +70,7 @@ void main() {
Future<void> capture(String name) async {
final directory = Platform.environment['HARNESS_DEVICES_CAPTURE_DIR'];
if (directory == null) return;
+ await tester.pump(const Duration(milliseconds: 120));
final image =
await (boundary.currentContext!.findRenderObject()
as RenderRepaintBoundary)
@@ -115,12 +119,9 @@ void main() {
(d) => d.machineId == 'workshop-pc',
);
final offlineCard = find.byKey(ValueKey('device-card-${offline.key}'));
- await tester.ensureVisible(offlineCard);
- await tester.tap(offlineCard);
- await tester.pumpAndSettle();
+ expect(offlineCard, findsNothing);
expect(controller.device(offline.key)!.canEdit, isFalse);
expect(controller.device(offline.key)!.status.settings, isNotNull);
- await capture('offline-devices-dsh');
await mount(Brightness.dark);
await tester.ensureVisible(find.byKey(const Key('devices-add')));
await tester.pumpAndSettle();
@@ -132,8 +133,30 @@ void main() {
expect(find.byType(DevicesScreen), findsNothing);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
- projects.dispose();
app.dispose();
+ final waiting = DevicesReviewApp();
+ await waiting.prepare(conversationReady: false);
+ await mount(Brightness.dark, notifier: waiting);
+ expect(find.text('Devices chat'), findsOneWidget);
+ expect(
+ find.byKey(const ValueKey('devices-conversation-setup')),
+ findsOneWidget,
+ );
+ final left = tester.getRect(
+ find.byKey(ValueKey('pane-frame:${waiting.panes.first.id}')),
+ );
+ final right = tester.getRect(
+ find.byKey(ValueKey('pane-frame:${waiting.panes.last.id}')),
+ );
+ expect(left.right, lessThan(right.left));
+ expect(left.width / (left.width + right.width), closeTo(.7, .01));
+ await capture('dark-devices-chat-unavailable');
+ await mount(Brightness.light, notifier: waiting);
+ await capture('light-devices-chat-unavailable');
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ waiting.dispose();
+ projects.dispose();
},
);
}
diff --git a/desktop/lib/devices/device_setup_dialog.dart b/desktop/lib/devices/device_setup_dialog.dart
index 15aeec364..53167ba70 100644
--- a/desktop/lib/devices/device_setup_dialog.dart
+++ b/desktop/lib/devices/device_setup_dialog.dart
@@ -66,7 +66,12 @@ class _DeviceSetupState extends State<_DeviceSetup> {
listenable: widget.controller,
builder: (context, _) {
final connected = widget.controller.devices
- .where((d) => d.hostOnline && d.status.attached)
+ .where(
+ (d) =>
+ d.hostOnline &&
+ d.hostAvailable &&
+ d.status.attached,
+ )
.toList();
final selected =
widget.editing ??
diff --git a/desktop/lib/devices/devices_harness_controller.dart b/desktop/lib/devices/devices_harness_controller.dart
index 8abea4d08..2dcbc50a9 100644
--- a/desktop/lib/devices/devices_harness_controller.dart
+++ b/desktop/lib/devices/devices_harness_controller.dart
@@ -105,7 +105,14 @@ class DevicesHarnessController extends ChangeNotifier {
);
if (!_current(owner)) return;
if (failure != null) {
- error = failure;
+ // This package ships with the CLI and is deliberately absent from
+ // dsh_list/the Store. A missing bundle requires a Harness update,
+ // not a Store install or a raw INVALID_DSH message in the dashboard.
+ error = switch (_creation!.refusal) {
+ 'INVALID_DSH' || 'UNSUPPORTED' || 'UNSUPPORTED_ON_REMOTE' => 'Update Harness on this computer to use Devices chat, then try again.',
+ _ when _creation!.awaitingConfirmation => 'Still waiting for your chat to start. Check again to reconnect to the same conversation.',
+ _ => 'Couldn’t start Devices chat. Try again in a moment.',
+ };
return;
}
agent = existing();
@@ -118,7 +125,7 @@ class DevicesHarnessController extends ChangeNotifier {
final resumed = await app.resumeAgent(machineId, agent.id);
if (!_current(owner)) return;
if (resumed.error != null) {
- error = resumed.error;
+ error = 'Couldn’t resume Devices chat. Try again in a moment.';
return;
}
}
diff --git a/desktop/lib/devices/devices_screen.dart b/desktop/lib/devices/devices_screen.dart
index 6bfe5863e..bc7885fb0 100644
--- a/desktop/lib/devices/devices_screen.dart
+++ b/desktop/lib/devices/devices_screen.dart
@@ -21,17 +21,8 @@ final harnessDeviceShopUrl = Uri.parse(
);
class DevicesTab extends StatefulWidget {
- const DevicesTab({
- super.key,
- required this.notifier,
- this.conversationOpening = false,
- this.conversationError,
- this.onOpenConversation,
- });
+ const DevicesTab({super.key, required this.notifier});
final AppNotifier notifier;
- final bool conversationOpening;
- final String? conversationError;
- final VoidCallback? onOpenConversation;
@override
State<DevicesTab> createState() => _DevicesTabState();
}
@@ -67,9 +58,6 @@ class _DevicesTabState extends State<DevicesTab> {
Widget build(BuildContext context) => DevicesScreen(
controller: controller,
onRefresh: widget.notifier.refreshDevices,
- conversationOpening: widget.conversationOpening,
- conversationError: widget.conversationError,
- onOpenConversation: widget.onOpenConversation,
);
}
@@ -79,16 +67,10 @@ class DevicesScreen extends StatefulWidget {
required this.controller,
this.openShop,
this.onRefresh,
- this.conversationOpening = false,
- this.conversationError,
- this.onOpenConversation,
});
final DevicesController controller;
final Future<bool> Function(Uri)? openShop;
final Future<void> Function()? onRefresh;
- final bool conversationOpening;
- final String? conversationError;
- final VoidCallback? onOpenConversation;
@override
State<DevicesScreen> createState() => _DevicesScreenState();
}
@@ -147,12 +129,16 @@ class _DevicesScreenState extends State<DevicesScreen> {
listenable: widget.controller,
builder: (context, _) => LayoutBuilder(
builder: (context, bounds) {
- final devices = widget.controller.devices;
+ // Keep saved identities for reconnection, but only present devices
+ // whose host has answered. Other machines do not belong in this UI.
+ final devices = widget.controller.devices
+ .where((device) => device.hostOnline && device.hostAvailable)
+ .toList();
final selected =
devices.where((d) => d.key == _selectedKey).firstOrNull ??
devices.where((d) => d.status.attached).firstOrNull ??
devices.firstOrNull;
- _selectedKey ??= selected?.key;
+ _selectedKey = selected?.key;
final pad = bounds.maxWidth < 640 ? 20.0 : 40.0;
return SingleChildScrollView(
key: const PageStorageKey('devices-page'),
@@ -226,26 +212,6 @@ class _DevicesScreenState extends State<DevicesScreen> {
),
),
],
- if (widget.conversationOpening ||
- widget.conversationError != null) ...[
- const SizedBox(height: 16),
- Wrap(
- spacing: 12,
- crossAxisAlignment: WrapCrossAlignment.center,
- children: [
- Text(
- widget.conversationError ??
- 'Opening the Devices conversation…',
- style: DesktopChrome.metadata(),
- ),
- if (!widget.conversationOpening)
- TextButton(
- onPressed: widget.onOpenConversation,
- child: const Text('Retry'),
- ),
- ],
- ),
- ],
if (widget.controller.error case final error?) ...[
const SizedBox(height: 16),
Wrap(
@@ -261,14 +227,6 @@ class _DevicesScreenState extends State<DevicesScreen> {
),
],
const SizedBox(height: 32),
- for (final host in widget.controller.computers)
- if (host.error != null) ...[
- Text(
- '${host.name}: ${host.error}',
- style: DesktopChrome.metadata(),
- ),
- const SizedBox(height: 12),
- ],
if (!widget.controller.loaded)
const SkeletonBlock(
child: Skeleton(
@@ -278,7 +236,11 @@ class _DevicesScreenState extends State<DevicesScreen> {
),
)
else if (selected == null)
- _EmptyDevices(onAdd: () => _setup(), onShop: _shop)
+ _EmptyDevices(
+ onAdd: () => _setup(),
+ onShop: _shop,
+ returning: widget.controller.devices.isNotEmpty,
+ )
else ...[
Text(
'${devices.length} ${devices.length == 1 ? 'device' : 'devices'}',
@@ -556,8 +518,13 @@ class _DeviceShowcase extends StatelessWidget {
}
class _EmptyDevices extends StatelessWidget {
- const _EmptyDevices({required this.onAdd, required this.onShop});
+ const _EmptyDevices({
+ required this.onAdd,
+ required this.onShop,
+ this.returning = false,
+ });
final VoidCallback onAdd, onShop;
+ final bool returning;
@override
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, constraints) {
@@ -568,12 +535,16 @@ class _EmptyDevices extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'A little closer\nto your work.',
+ returning
+ ? 'No devices connected'
+ : 'A little closer\nto your work.',
style: grid.AppType.display(),
),
const SizedBox(height: 18),
Text(
- 'Your agents, at a glance. A quiet chime when they need you. Make a home for every Harness on your desk.',
+ returning
+ ? 'Connect a device by USB-C to a computer running Harness. It will appear here automatically.'
+ : 'Your agents, at a glance. A quiet chime when they need you. Make a home for every Harness on your desk.',
style: DesktopChrome.text(color: DesktopChrome.muted),
),
const SizedBox(height: 28),
@@ -583,7 +554,9 @@ class _EmptyDevices extends StatelessWidget {
children: [
FilledButton(
onPressed: onAdd,
- child: const Text('Add your first device'),
+ child: Text(
+ returning ? 'Add device' : 'Add your first device',
+ ),
),
TextButton(
onPressed: onShop,
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 5a1cf9b20..6cb38565b 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -93,6 +93,7 @@ import '../widgets/workspace_subscription_usage.dart';
import '../store/store_mark.dart';
import '../store/store_screen.dart';
import '../devices/devices_screen.dart';
+import '../widgets/harness_conversation_placeholder.dart';
import '../devices/devices_harness_controller.dart';
import '../widgets/harness_start_page.dart';
import '../state/toolbar_notices.dart';
@@ -3671,18 +3672,23 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
});
}
- return ListenableBuilder(
- listenable: _devicesHarness,
- builder: (context, _) => DevicesTab(
- key: ValueKey('devices-tab:${app.currentUser?.id}'),
- notifier: app,
- conversationOpening: _devicesHarness.opening,
- conversationError: _devicesHarness.error,
- onOpenConversation: _devicesHarness.open,
- ),
+ return DevicesTab(
+ key: ValueKey('devices-tab:${app.currentUser?.id}'),
+ notifier: app,
);
}
+ Widget _devicesConversation(BuildContext context) => ListenableBuilder(
+ listenable: _devicesHarness,
+ builder: (context, _) => HarnessConversationPlaceholder(
+ key: const ValueKey('devices-conversation-setup'),
+ name: 'Devices',
+ opening: _devicesHarness.opening,
+ error: _devicesHarness.error,
+ onRetry: () => unawaited(_devicesHarness.open()),
+ ),
+ );
+
void _openDevices() {
if (!_routeIsCurrent ||
_dialogOpen ||
@@ -6865,6 +6871,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
devicesViewer: app.devicesEnabled
? _devicesViewer
: null,
+ devicesConversation:
+ app.devicesEnabled
+ ? _devicesConversation
+ : null,
companionViewer:
_creatureEnabled &&
_zoo.loaded
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index af6c44329..4216cd66f 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1645,14 +1645,25 @@ class AppNotifier extends ChangeNotifier {
}
void _ensureDevicesViewer(Swarm tab) {
- if (!devicesEnabled || tab.panes.any((pane) => pane.isDevices)) return;
- final pane = TerminalPane(
- id: _nextPaneId++,
- machineId: '',
- kind: PaneKind.devices,
+ if (!devicesEnabled) return;
+ if (!tab.panes.any((pane) => pane.isDevices)) {
+ final pane = TerminalPane(
+ id: _nextPaneId++,
+ machineId: '',
+ kind: PaneKind.devices,
+ );
+ tab.panes.insert(0, pane);
+ tab.focusedPaneId ??= pane.id;
+ }
+ // Reserve the conversation before any network or launch work. Setup and
+ // failures belong in this same right-hand pane, never above the dashboard.
+ if (!tab.panes.any((pane) => !pane.isViewer)) {
+ tab.panes.add(TerminalPane(id: _nextPaneId++, machineId: ''));
+ }
+ tab.paneSizes.putIfAbsent(
+ '2:manual',
+ () => PaneArrangement.viewerBesideTerminal,
);
- tab.panes.insert(0, pane);
- tab.focusedPaneId ??= pane.id;
}
Future<void> showDevicesTerminal(String machineId, String agentId) async {
@@ -1668,7 +1679,10 @@ class AppNotifier extends ChangeNotifier {
() => PaneArrangement.viewerBesideTerminal,
);
await assignAgentToPane(
- null,
+ tab.panes
+ .where((pane) => !pane.isViewer && pane.agentId == null)
+ .firstOrNull
+ ?.id,
machineId,
agentId,
swarmId: tab.id,
@@ -12230,6 +12244,10 @@ class AppNotifier extends ChangeNotifier {
? targetPanes.length
: split.paneIds.indexOf(split.paneId) + 1
: targetPanes.indexOf(replaced);
+ final pendingLayout =
+ replaced != null && !replaced.isViewer && replaced.agentId == null
+ ? target.manualLayout
+ : null;
if (existing != null) target.remove(existing);
if (replaced != null) target.remove(replaced);
final pane =
@@ -12243,6 +12261,11 @@ class AppNotifier extends ChangeNotifier {
pane.sharedOwnerName = machine.machine.ownerName;
}
targetPanes.insert(insertion.clamp(0, targetPanes.length), pane);
+ // Attaching a conversation to a reserved slot is not a layout removal.
+ if (pendingLayout != null &&
+ pendingLayout.tiles.length == targetPanes.length) {
+ target.savePaneSizes('${targetPanes.length}:manual', pendingLayout);
+ }
if (autoTile && split == null) {
// A new pane reflows the whole tab. Old manual splits and remembered
// sizes for this count must not silently override automatic placement.
diff --git a/desktop/lib/widgets/harness_conversation_placeholder.dart b/desktop/lib/widgets/harness_conversation_placeholder.dart
new file mode 100644
index 000000000..ee72a6a7a
--- /dev/null
+++ b/desktop/lib/widgets/harness_conversation_placeholder.dart
@@ -0,0 +1,72 @@
+import 'package:flutter/material.dart';
+
+import 'desktop_chrome.dart';
+
+/// Setup occupies the same canvas slot as the eventual agent terminal. A DSH
+/// must not lose its conversation pane when its machine or agent is unavailable.
+class HarnessConversationPlaceholder extends StatelessWidget {
+ const HarnessConversationPlaceholder({
+ super.key,
+ required this.name,
+ required this.opening,
+ required this.onRetry,
+ this.error,
+ });
+
+ final String name;
+ final bool opening;
+ final String? error;
+ final VoidCallback onRetry;
+
+ @override
+ Widget build(BuildContext context) => Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
+ child: Text('$name chat', style: DesktopChrome.control(medium: true)),
+ ),
+ const Divider(height: 1),
+ Expanded(
+ child: Center(
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.all(24),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ opening ? 'Opening your chat…' : 'Chat isn’t ready yet',
+ style: DesktopChrome.heading(),
+ ),
+ const SizedBox(height: 12),
+ Semantics(
+ liveRegion: true,
+ child: Text(
+ opening
+ ? 'Your conversation will appear here. You can keep using the dashboard.'
+ : error ??
+ 'Start a conversation to work with your agent.',
+ style: DesktopChrome.text(color: DesktopChrome.muted),
+ ),
+ ),
+ const SizedBox(height: 20),
+ if (opening)
+ const SizedBox(
+ width: 20,
+ height: 20,
+ child: CircularProgressIndicator(strokeWidth: 2),
+ )
+ else
+ FilledButton(
+ onPressed: onRetry,
+ child: const Text('Try again'),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ],
+ );
+}
diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dart
index 676364a5f..55ce1a88e 100644
--- a/desktop/lib/widgets/pane_grid.dart
+++ b/desktop/lib/widgets/pane_grid.dart
@@ -58,6 +58,7 @@ class PaneGrid extends StatelessWidget {
this.soloFocused = false,
this.companionViewer,
this.devicesViewer,
+ this.devicesConversation,
});
final AppNotifier notifier;
@@ -75,6 +76,7 @@ class PaneGrid extends StatelessWidget {
/// The built-in companion DSH viewer; its agent uses the ordinary terminal.
final WidgetBuilder? companionViewer;
final WidgetBuilder? devicesViewer;
+ final WidgetBuilder? devicesConversation;
@override
Widget build(BuildContext context) {
@@ -92,6 +94,7 @@ class PaneGrid extends StatelessWidget {
soloFocused: soloFocused,
companionViewer: companionViewer,
devicesViewer: devicesViewer,
+ devicesConversation: devicesConversation,
);
}
final panes = notifier.panes;
@@ -110,6 +113,7 @@ class PaneGrid extends StatelessWidget {
onSplitPane: onSplitPane,
companionViewer: companionViewer,
devicesViewer: devicesViewer,
+ devicesConversation: devicesConversation,
);
final cells = <Widget>[
for (final pane in visible) cell(pane),
@@ -261,6 +265,7 @@ class _SwarmCanvas extends StatefulWidget {
this.soloFocused = false,
this.companionViewer,
this.devicesViewer,
+ this.devicesConversation,
});
final AppNotifier notifier;
final AgentDragRef? dragging;
@@ -271,6 +276,7 @@ class _SwarmCanvas extends StatefulWidget {
final bool soloFocused;
final WidgetBuilder? companionViewer;
final WidgetBuilder? devicesViewer;
+ final WidgetBuilder? devicesConversation;
@override
State<_SwarmCanvas> createState() => _SwarmCanvasState();
}
@@ -615,6 +621,8 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
solo: widget.soloFocused,
companionViewer: widget.companionViewer,
devicesViewer: widget.devicesViewer,
+ devicesConversation:
+ widget.devicesConversation,
),
),
),
@@ -1217,6 +1225,7 @@ class _PaneCell extends StatelessWidget {
this.solo = false,
this.companionViewer,
this.devicesViewer,
+ this.devicesConversation,
});
final AppNotifier notifier;
@@ -1229,6 +1238,7 @@ class _PaneCell extends StatelessWidget {
final void Function(int paneId, PaneResizeAxis axis)? onSplitPane;
final WidgetBuilder? companionViewer;
final WidgetBuilder? devicesViewer;
+ final WidgetBuilder? devicesConversation;
/// Drawn alone under [PaneGrid.soloFocused]: it reads as the only view — no
/// dimming or zoom, since it already fills the screen. The focused rim still
@@ -1368,6 +1378,13 @@ class _PaneCell extends StatelessWidget {
: pane.isCompanion
? companionViewer?.call(context) ??
const SizedBox.shrink()
+ : pane.agentId == null &&
+ devicesConversation != null &&
+ notifier.swarms.any(
+ (tab) =>
+ tab.isDevices && tab.panes.contains(pane),
+ )
+ ? devicesConversation!(context)
: _PaneContent(
notifier: notifier,
pane: pane,
diff --git a/desktop/test/devices_harness_test.dart b/desktop/test/devices_harness_test.dart
index e73e82749..e74ca6442 100644
--- a/desktop/test/devices_harness_test.dart
+++ b/desktop/test/devices_harness_test.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'dart:ui';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/engine_availability.dart';
@@ -6,17 +7,19 @@ import 'package:harness/core/models.dart';
import 'package:harness/devices/devices_harness_controller.dart';
import 'package:harness/settings/experimental_features.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/state/pane_arrangement.dart';
+import 'package:harness/ws/ws_conn.dart';
import 'experimental_features_test.dart' show AccountSettings;
import 'support/model_manager.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
- late ModelManagerConnection connection;
+ late _DevicesConnection connection;
late ModelManagerTestApp app;
late DevicesHarnessController devices;
setUp(() async {
- connection = ModelManagerConnection();
+ connection = _DevicesConnection();
app = ModelManagerTestApp(connection);
app.stateOf('m')!.engines.replace([
const EngineAvailability(engine: 'codex', installed: true),
@@ -36,6 +39,50 @@ void main() {
app.dispose();
});
+ test(
+ 'missing bundle keeps chat at 30 percent and recovers in the same tab',
+ () async {
+ final tab = app.activeSwarm;
+ connection.refusal = 'INVALID_DSH';
+ await devices.open();
+ expect(devices.error, contains('Update Harness'));
+ expect(devices.error, isNot(contains('autonomous/devices')));
+ expect(tab.panes, hasLength(2));
+ expect(tab.panes.first.isDevices, isTrue);
+ expect(tab.panes.last.agentId, isNull);
+ expect(tab.manualLayout!.tiles.first.width, .7);
+ connection.refusal = null;
+ await devices.open();
+ expect(devices.error, isNull);
+ expect(app.activeSwarm, same(tab));
+ expect(tab.panes, hasLength(2));
+ expect(tab.panes.last.agentId, 'manager');
+ expect(tab.manualLayout!.tiles.last.width, closeTo(.3, .001));
+ },
+ );
+
+ test(
+ 'startup reserves chat and respects resizing while the launch is pending',
+ () async {
+ connection.holdCreation = Completer<void>();
+ final opening = devices.open();
+ expect(app.panes, hasLength(2));
+ expect(app.activeSwarm.manualLayout!.tiles.first.width, .7);
+ final resized = PaneArrangement(const [
+ Rect.fromLTRB(0, 0, .6, 1),
+ Rect.fromLTRB(.6, 0, 1, 1),
+ ]);
+ app.activeSwarm.savePaneSizes('2:manual', resized);
+ connection.holdCreation!.complete();
+ await opening;
+ expect(app.panes, hasLength(2));
+ expect(app.activeSwarm.manualLayout, same(resized));
+ await devices.open();
+ expect(app.activeSwarm.manualLayout, same(resized));
+ expect(connection.creations, hasLength(1));
+ },
+ );
+
test(
'waits for the existing inventory before deciding to create a conversation',
() async {
@@ -122,3 +169,23 @@ void main() {
},
);
}
+
+class _DevicesConnection extends ModelManagerConnection {
+ String? refusal;
+
+ @override
+ Future<Map<String, dynamic>> request(
+ String type, {
+ Map<String, dynamic> payload = const {},
+ Duration timeout = const Duration(seconds: 20),
+ }) {
+ if (type == 'agent_create' && refusal != null) {
+ throw WsRequestFailure(
+ responseType: 'agent_create_result',
+ code: refusal!,
+ detail: 'autonomous/devices is not installed on this machine',
+ );
+ }
+ return super.request(type, payload: payload, timeout: timeout);
+ }
+}
diff --git a/desktop/test/devices_screen_test.dart b/desktop/test/devices_screen_test.dart
index 97efd0e9f..21a7a450c 100644
--- a/desktop/test/devices_screen_test.dart
+++ b/desktop/test/devices_screen_test.dart
@@ -6,6 +6,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/devices/device_settings.dart';
+import 'package:harness/devices/device_hosts.dart';
import 'package:harness/devices/devices_controller.dart';
import 'package:harness/devices/devices_screen.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
@@ -69,7 +70,10 @@ void main() {
final context = tester.element(find.byType(DevicesScreen));
await Future.wait([
for (final image in ['front', 'side', 'desk'])
- precacheImage(AssetImage('assets/devices/harness-$image.webp'), context),
+ precacheImage(
+ AssetImage('assets/devices/harness-$image.webp'),
+ context,
+ ),
]);
});
await tester.pumpAndSettle();
@@ -151,6 +155,77 @@ void main() {
}
}
+ testWidgets(
+ 'unreachable computers have no cards or errors and return with saved names',
+ (tester) async {
+ final hosts = DeviceHosts();
+ const inventory = [
+ DeviceHost(id: 'local', name: 'This Mac', online: true, local: true),
+ DeviceHost(id: 'remote', name: 'Remote Mac', online: true),
+ ];
+ hosts.reconcile(inventory);
+ final controller = DevicesController(
+ hosts: hosts,
+ accountId: 'review',
+ sendHostSettings: (_, _, _) async => true,
+ );
+ await controller.load();
+ hosts.receive('local', deviceStatus('local'));
+ hosts.receive('remote', deviceStatus('remote'));
+ final remote = controller.devices.firstWhere(
+ (device) => device.machineId == 'remote',
+ );
+ controller.rename(remote.key, 'Studio dial', HarnessDeviceModel.pro);
+ await pump(tester, controller);
+ await tester.tap(find.byKey(ValueKey('device-card-${remote.key}')));
+ await tester.pumpAndSettle();
+ expect(find.text('2 devices'), findsOneWidget);
+
+ for (final reason in [
+ 'Couldn’t reach Remote Mac.',
+ 'Link this computer in Machines.',
+ 'Update Harness on Remote Mac.',
+ ]) {
+ hosts.failed('remote', reason);
+ await tester.pumpAndSettle();
+ expect(find.byKey(ValueKey('device-card-${remote.key}')), findsNothing);
+ expect(find.textContaining(reason), findsNothing);
+ expect(find.text('1 device'), findsOneWidget);
+ expect(find.text('Studio dial'), findsNothing);
+ expect(find.text('Remote Mac'), findsNothing);
+ hosts.receive('remote', deviceStatus('remote'));
+ await tester.pumpAndSettle();
+ expect(
+ find.byKey(ValueKey('device-card-${remote.key}')),
+ findsOneWidget,
+ );
+ expect(controller.device(remote.key)!.name, 'Studio dial');
+ }
+
+ hosts.reconcile([
+ const DeviceHost(
+ id: 'local',
+ name: 'This Mac',
+ online: false,
+ local: true,
+ ),
+ const DeviceHost(id: 'remote', name: 'Remote Mac', online: false),
+ ]);
+ await tester.pumpAndSettle();
+ expect(find.text('No devices connected'), findsOneWidget);
+ expect(find.textContaining('Computer offline'), findsNothing);
+ expect(find.byType(DeviceSettingsPanel), findsNothing);
+ expect(
+ controller.devices,
+ hasLength(2),
+ reason: 'Names are retained for reconnection',
+ );
+ await tester.pumpWidget(const SizedBox());
+ controller.dispose();
+ hosts.dispose();
+ },
+ );
+
testWidgets('narrow layouts and 200 percent text remain scrollable', (
tester,
) async {
diff --git a/desktop/test/devices_tab_test.dart b/desktop/test/devices_tab_test.dart
index f0611ab10..670a422b6 100644
--- a/desktop/test/devices_tab_test.dart
+++ b/desktop/test/devices_tab_test.dart
@@ -71,7 +71,20 @@ void main() {
)
.first;
expect(tester.widget<ExcludeFocus>(canvasFocus).excluding, isFalse);
- expect(app.activeSwarm.panes.single.isDevices, isTrue);
+ expect(app.activeSwarm.panes, hasLength(2));
+ final viewer = app.activeSwarm.panes.first;
+ final chat = app.activeSwarm.panes.last;
+ expect(viewer.isDevices, isTrue);
+ expect(chat.isViewer, isFalse);
+ expect(find.text('Devices chat'), findsOneWidget);
+ final left = tester.getRect(
+ find.byKey(ValueKey('pane-frame:${viewer.id}')),
+ );
+ final right = tester.getRect(
+ find.byKey(ValueKey('pane-frame:${chat.id}')),
+ );
+ expect(left.right, lessThan(right.left));
+ expect(left.width / (left.width + right.width), closeTo(.7, .01));
await app.experimentalFeatures.set(
ExperimentalFeature.devicesTab,
false,
@@ -115,6 +128,30 @@ void main() {
},
);
+ test(
+ 'restoring a Devices tab reserves chat before its conversation loads',
+ () async {
+ final storage = MemoryStore();
+ await PaneLayoutStore(storage: storage).saveSwarms([
+ Swarm(id: 'devices', name: 'Devices', kind: 'devices'),
+ ], 'devices');
+ final app = createApp(store: storage);
+ app.experimentalFeatures.bind(
+ 'u1',
+ transport: MemoryExperimentalTransport(storage),
+ );
+ await app.experimentalFeatures.refresh();
+ await app.experimentalFeatures.set(ExperimentalFeature.devicesTab, true);
+ await app.restorePaneLayoutForTest();
+ final tab = app.swarms.singleWhere((tab) => tab.isDevices);
+ expect(tab.panes, hasLength(2));
+ expect(tab.panes.first.isDevices, isTrue);
+ expect(tab.panes.last.agentId, isNull);
+ expect(tab.manualLayout!.tiles.first.width, .7);
+ app.dispose();
+ },
+ );
+
test(
'older servers keep existing experiments working with Devices unavailable',
() async {
diff --git a/desktop/tool/devices_preview.dart b/desktop/tool/devices_preview.dart
index 7e45e6d27..1b62409cf 100644
--- a/desktop/tool/devices_preview.dart
+++ b/desktop/tool/devices_preview.dart
@@ -145,7 +145,10 @@ class DevicesReviewApp extends AppNotifier {
final writes = <(String, String, Map<String, Object?>)>[];
bool _ended = false;
- Future<void> prepare({bool empty = false}) async {
+ Future<void> prepare({
+ bool empty = false,
+ bool conversationReady = true,
+ }) async {
await experimentalFeatures.refresh();
if (!empty) {
for (var i = 0; i < 5; i++) {
@@ -183,6 +186,7 @@ class DevicesReviewApp extends AppNotifier {
);
}
openDevices();
+ if (!conversationReady) return;
machineStates['studio-mac']!.agents = [
const Agent(
id: 'review-devices',
@@ -199,6 +203,9 @@ class DevicesReviewApp extends AppNotifier {
Future<void> showDevicesTerminal(String machineId, String agentId) async {
final tab = swarms.where((tab) => tab.isDevices).firstOrNull;
if (tab == null || tab.panes.any((pane) => pane.agentId == agentId)) return;
+ tab.panes.firstWhere((pane) => pane.isDevices)
+ ..machineId = machineId
+ ..ownerAgentId = agentId;
final session =
TerminalSession(
machineId: machineId,
@@ -213,10 +220,20 @@ class DevicesReviewApp extends AppNotifier {
session.terminal.write(
'Devices\r\n\r\nYour Harness hardware, across your computers.\r\n\r\nTry the controls in the dashboard.\r\n\r\nThis review uses sample hardware and a\r\nsample conversation. No agent is running.\r\n',
);
- tab.panes.add(
- TerminalPane(id: 900001, machineId: machineId, agentId: agentId)
- ..session = session,
- );
+ final pane = tab.panes
+ .where((pane) => !pane.isViewer && pane.agentId == null)
+ .firstOrNull;
+ if (pane != null) {
+ pane
+ ..machineId = machineId
+ ..agentId = agentId
+ ..session = session;
+ } else {
+ tab.panes.add(
+ TerminalPane(id: 900001, machineId: machineId, agentId: agentId)
+ ..session = session,
+ );
+ }
tab.paneSizes['2:manual'] = PaneArrangement.viewerBesideTerminal;
notifyListeners();
}
diff --git a/docs/research/2026-10-01-devices-workspace/README.md b/docs/research/2026-10-01-devices-workspace/README.md
new file mode 100644
index 000000000..32096a20c
--- /dev/null
+++ b/docs/research/2026-10-01-devices-workspace/README.md
@@ -0,0 +1,19 @@
+# Devices workspace review
+
+Native macOS captures from `desktop/integration_test/devices_native_test.dart`,
+using Flutter 3.47.2 on Apple Silicon with Impeller. The fixture uses sample
+hardware and terminal traffic; it does not run an agent or change a USB device.
+
+Devices from unavailable computers are absent, with no fleet error list. The
+viewer keeps 70% of the workspace and chat keeps the right 30%, including when
+no supported engine is available. Both themes use the actual shared pane grid.
+
+| State | Light | Dark |
+| --- | --- | --- |
+| Conversation attached | [Screenshot](light-devices-dsh.png) | [Screenshot](dark-devices-dsh.png) |
+| Conversation unavailable | [Screenshot](light-devices-chat-unavailable.png) | [Screenshot](dark-devices-chat-unavailable.png) |
+
+Focused tests cover missing-package recovery, retained creation receipts,
+restoration, user resizing during startup, hiding unavailable devices and
+their details, and restoring saved device names on reconnection. Existing
+narrow-window and 200% text checks remain part of the Devices screen suite.
diff --git a/docs/research/2026-10-01-devices-workspace/dark-devices-chat-unavailable.png b/docs/research/2026-10-01-devices-workspace/dark-devices-chat-unavailable.png
new file mode 100644
index 000000000..d50db532a
Binary files /dev/null and b/docs/research/2026-10-01-devices-workspace/dark-devices-chat-unavailable.png differ
diff --git a/docs/research/2026-10-01-devices-workspace/dark-devices-dsh.png b/docs/research/2026-10-01-devices-workspace/dark-devices-dsh.png
new file mode 100644
index 000000000..e6d3df12f
Binary files /dev/null and b/docs/research/2026-10-01-devices-workspace/dark-devices-dsh.png differ
diff --git a/docs/research/2026-10-01-devices-workspace/light-devices-chat-unavailable.png b/docs/research/2026-10-01-devices-workspace/light-devices-chat-unavailable.png
new file mode 100644
index 000000000..87f1ccf4e
Binary files /dev/null and b/docs/research/2026-10-01-devices-workspace/light-devices-chat-unavailable.png differ
diff --git a/docs/research/2026-10-01-devices-workspace/light-devices-dsh.png b/docs/research/2026-10-01-devices-workspace/light-devices-dsh.png
new file mode 100644
index 000000000..3169cbef3
Binary files /dev/null and b/docs/research/2026-10-01-devices-workspace/light-devices-dsh.png differ
diff --git a/store/AGENTS.md b/store/AGENTS.md
new file mode 100644
index 000000000..0c2e8b07a
--- /dev/null
+++ b/store/AGENTS.md
@@ -0,0 +1,10 @@
+# Building domain-specific harnesses
+
+Before creating or changing a DSH, read [the authoring guide](README.md) and the
+[DSH workspace contract](../desktop/design/dsh-workspace.md).
+
+A DSH dashboard always has the real agent chat to its right, initially 70% viewer
+and 30% chat. Loading or failed setup must keep that chat slot and show recovery
+there. Verify the whole workspace, including failures, rather than only the
+viewer. Package `AGENTS.md` files describe the materialized agent's job; they do
+not replace this desktop integration contract.
diff --git a/store/README.md b/store/README.md
index ba7cd7b54..5fd4414b8 100644
--- a/store/README.md
+++ b/store/README.md
@@ -51,6 +51,14 @@ what lets hundreds of packages exist without any of them touching the app or the
## Build one
+**Workspace layout is required:** every DSH with a viewer opens with the viewer
+on the left at **70%** and the real agent chat on the right at **30%**. Keep both
+slots during loading and failed setup; show chat recovery in the chat slot.
+Use the shared canvas and preserve user resizing. Follow the
+[DSH workspace contract](../desktop/design/dsh-workspace.md), including its
+failure, reconnect, and release checks. This applies equally to native utility
+dashboards and web viewers.
+
**First time?** Follow [Hello World](../CONTRIBUTING.md#your-first-harness): copy a tiny package,
install it locally, and change a greeting in a live HTML preview. It includes the viewer in
`harness.json` with `"viewer": { "use": "autonomous/web-viewer" }`. No app changes are needed.
diff --git a/store/agents/devices/README.md b/store/agents/devices/README.md
index d6fcf842f..b0754d35c 100644
--- a/store/agents/devices/README.md
+++ b/store/agents/devices/README.md
@@ -1,8 +1,9 @@
# Devices
Manage physical Harness and Harness Pro devices across computers linked to your
-account. The native dashboard opens beside an ordinary agent conversation, with
-each USB device labeled by its host computer.
+account. The native dashboard opens on the left at 70%, with the ordinary agent
+chat on the right at 30%. Chat setup and recovery stay in that right pane.
+Each visible USB device is labeled by its reachable host computer.
Devices is bundled with the Harness CLI, unlisted in the Store, and off by
default. With an updated backend, desktop app, and daemons, enable **Settings →
@@ -16,8 +17,10 @@ Try asking:
The agent reads live inventory and reports the owning computers, available
devices, and unavailable hosts. A requested settings change targets one host
-and one device and waits for the device to report the requested values. Offline
-controls are disabled; changes are never queued for later.
+and one device and waits for the device to report the requested values. The
+dashboard hides devices from unreachable, unlinked, or unsupported computers,
+without listing connection errors. Saved names return when the computer
+reconnects. Changes are never queued for later.
The dashboard supports brightness, sound, reverse scrolling, voice language,
and the initial Focus face. Add device guides USB connection, naming, and model