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
Fix review: "in this tab" means contributed, distinguish not-linked from offline
bitcoinbuilderf98a0ff21c5c
diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dartindex eb5ba300f..2afe84208 100644--- a/desktop/lib/super_tabs/machines.dart+++ b/desktop/lib/super_tabs/machines.dart@@ -129,6 +129,14 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {final existingId = existing?['machineId'] as String?;bool isExisting(MachineState m) =>existingId != null && m.machine.machineId == existingId;+ // "Already in this tab" means already CONTRIBUTED — an agent already+ // running there (unconfirmed) does not count, or a freshly created tab+ // whose lead runs on this Mac could never contribute it. `_ids` (agents+ // too) is for the machine-card panel below, not this dialog.+ final contributed = {+ for (final m in c.snapshot?.machines ?? const <Map<String, dynamic>>[])+ m['machineId'] as String,+ };// Only this account's own, reachable computers can be offered — a machine// already in the tab would duplicate its entry, and one offline or// unlinked cannot actually be contributed right now. The machine being@@ -141,20 +149,31 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {.where((m) =>isExisting(m) ||- (!_ids.contains(m.machine.machineId) &&+ (!contributed.contains(m.machine.machineId) &&!m.needsLink &&!m.isOffline),).toList();final alreadyInTab = own- .where((m) => !isExisting(m) && _ids.contains(m.machine.machineId))+ .where(+ (m) => !isExisting(m) && contributed.contains(m.machine.machineId),+ )+ .toList();+ final notLinked = own+ .where(+ (m) =>+ !isExisting(m) &&+ !contributed.contains(m.machine.machineId) &&+ m.needsLink,+ ).toList();final offline = own.where((m) =>!isExisting(m) &&- !_ids.contains(m.machine.machineId) &&- (m.needsLink || m.isOffline),+ !contributed.contains(m.machine.machineId) &&+ !m.needsLink &&+ m.isOffline,).toList();String labelFor(MachineState m) => m.isLocalMachine@@ -274,9 +293,18 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {}final canAdd = addable.isNotEmpty;+ // Only in Add mode: Configure already names the one machine it+ // edits, so the picker's "already in the tab"/"can't reach it"+ // bookkeeping about every OTHER machine is noise there.+ final showStatus = !isConfigure;+ final singleAlreadyInTab =+ !canAdd &&+ alreadyInTab.length == 1 &&+ notLinked.isEmpty &&+ offline.isEmpty;final String emptyStatement = own.isEmpty? 'No computer is connected to this account yet.'- : alreadyInTab.length == 1 && offline.isEmpty+ : singleAlreadyInTab? '${labelFor(alreadyInTab.single)} is already in this tab.': 'No other computer can be added to this tab right now.';return AlertDialog(@@ -295,7 +323,10 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {semanticLabel: 'Machine',options: [for (final m in addable)- SelectOption(value: m.machine.machineId, label: labelFor(m)),+ SelectOption(+ value: m.machine.machineId,+ label: labelFor(m),+ ),],onChanged: (id) {if (busy) return;@@ -309,20 +340,31 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {)elseText(emptyStatement, style: DesktopChrome.text()),- if (alreadyInTab.isNotEmpty) ...[+ if (showStatus &&+ !singleAlreadyInTab &&+ alreadyInTab.isNotEmpty) ...[const SizedBox(height: 12),Text('Already in this tab: ${alreadyInTab.map(labelFor).join(', ')}',style: DesktopChrome.metadata(),),],- for (final m in offline) ...[- const SizedBox(height: 4),- Text(- 'Offline: ${labelFor(m)}. Start Harness on it to add it.',- style: DesktopChrome.metadata(),- ),- ],+ if (showStatus)+ for (final m in notLinked) ...[+ const SizedBox(height: 4),+ Text(+ 'Not linked: ${labelFor(m)}. Link it from Machines.',+ style: DesktopChrome.metadata(),+ ),+ ],+ if (showStatus)+ for (final m in offline) ...[+ const SizedBox(height: 4),+ Text(+ 'Offline: ${labelFor(m)}. Start Harness on it to add it.',+ style: DesktopChrome.metadata(),+ ),+ ],const SizedBox(height: 16),if (canAdd)Text(diff --git a/desktop/test/super_tab_machines_test.dart b/desktop/test/super_tab_machines_test.dartindex 1f6e6cd75..a80643121 100644--- a/desktop/test/super_tab_machines_test.dart+++ b/desktop/test/super_tab_machines_test.dart@@ -110,31 +110,45 @@ void main() {);testWidgets(- 'Add machine: only This Mac, already in the tab, offers no picker and no Add machine button',+ 'Add machine: the lead runs on This Mac but it is not contributed yet, so "+" still offers it',(tester) async {final f = SuperTabLaunchFixture();f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');- f.connection.server.state['machines'] = [- {'machineId': 'm', 'contributorId': 'owner'},+ f.connection.server.state['agents'] = [+ {+ 'id': 'lead-agent',+ 'name': 'Lead',+ 'machineId': 'm',+ 'harnessId': 'native-lead',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'codex'},+ },];+ (f.connection.server.state['conversations'] as List)[0]['leadId'] =+ 'lead-agent';+ (f.connection.server.state['conversations'] as List)[0]['agentIds'] = [+ 'lead-agent',+ ];+ f.connection.server.state['project'] = {+ 'machineId': 'm',+ 'cwd': '/work/project',+ 'repositoryUrl': null,+ };+ // No 'machines' entry: an agent running on This Mac does not mean it+ // was ever contributed to this tab.final c = await f.app.superTabs.open(tabId);await c.refresh();await _openAddMachineDialog(tester, f, c);- expect(find.byType(AppSelectField<String>), findsNothing);- expect(find.widgetWithText(FilledButton, 'Add machine'), findsNothing);+ expect(find.byType(AppSelectField<String>), findsOneWidget);expect(- find.text(- 'This Mac (${f.app.stateOf('m')!.machine.displayName}) is already in this tab.',- ),+ find.text('This Mac (${f.app.stateOf('m')!.machine.displayName})'),findsOneWidget,);- expect(- find.textContaining('install Harness on it and sign in'),- findsOneWidget,+ final button = tester.widget<FilledButton>(+ find.widgetWithText(FilledButton, 'Add machine'),);- expect(find.widgetWithText(TextButton, 'Close'), findsOneWidget);- expect(find.widgetWithText(TextButton, 'Open Machines'), findsOneWidget);+ expect(button.onPressed, isNotNull);await tester.pumpWidget(const SizedBox());await c.flush();@@ -144,44 +158,31 @@ void main() {);testWidgets(- 'Add machine: with This Mac already in the tab, the picker offers only another online own '- 'machine, preselected, and keeps Add machine enabled',+ 'Add machine: only This Mac, already in the tab, offers no picker and no Add machine button',(tester) async {final f = SuperTabLaunchFixture();f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');f.connection.server.state['machines'] = [{'machineId': 'm', 'contributorId': 'owner'},];- const other = Machine(- machineId: 'm2',- authMode: MachineAuthMode.remote,- name: 'Other Mac',- );- f.app.machines = [...f.app.machines, other];- f.app.machineStates['m2'] = MachineState(other)- ..nodeOnline = true- ..connectionStatus = ConnectionStatus.connected- ..agentLoadStatus = AgentLoadStatus.loaded;final c = await f.app.superTabs.open(tabId);await c.refresh();await _openAddMachineDialog(tester, f, c);- expect(find.byType(AppSelectField<String>), findsOneWidget);- expect(find.text('Other Mac'), findsOneWidget);+ expect(find.byType(AppSelectField<String>), findsNothing);+ expect(find.widgetWithText(FilledButton, 'Add machine'), findsNothing);expect(find.text(- 'This Mac (${f.app.stateOf('m')!.machine.displayName})',+ 'This Mac (${f.app.stateOf('m')!.machine.displayName}) is already in this tab.',),- findsNothing,+ findsOneWidget,);expect(- find.textContaining('Already in this tab:'),+ find.textContaining('install Harness on it and sign in'),findsOneWidget,);- final button = tester.widget<FilledButton>(- find.widgetWithText(FilledButton, 'Add machine'),- );- expect(button.onPressed, isNotNull);+ expect(find.widgetWithText(TextButton, 'Close'), findsOneWidget);+ expect(find.widgetWithText(TextButton, 'Open Machines'), findsOneWidget);await tester.pumpWidget(const SizedBox());await c.flush();@@ -190,39 +191,75 @@ void main() {},);- testWidgets(- 'Add machine: an offline own machine is not offered in the picker and is named as offline '- 'with a next step',- (tester) async {- final f = SuperTabLaunchFixture();- f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');- const offline = Machine(- machineId: 'm3',- authMode: MachineAuthMode.remote,- name: 'macbok test local',- );- f.app.machines = [...f.app.machines, offline];- f.app.machineStates['m3'] = MachineState(offline)- ..nodeOnline = false- ..connectionStatus = ConnectionStatus.disconnected- ..agentLoadStatus = AgentLoadStatus.loaded;- final c = await f.app.superTabs.open(tabId);- await c.refresh();- await _openAddMachineDialog(tester, f, c);+ testWidgets('Add machine: with This Mac already in the tab, the picker offers only another online own '+ 'machine, preselected, and keeps Add machine enabled', (tester) async {+ final f = SuperTabLaunchFixture();+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ f.connection.server.state['machines'] = [+ {'machineId': 'm', 'contributorId': 'owner'},+ ];+ const other = Machine(+ machineId: 'm2',+ authMode: MachineAuthMode.remote,+ name: 'Other Mac',+ );+ f.app.machines = [...f.app.machines, other];+ f.app.machineStates['m2'] = MachineState(other)+ ..nodeOnline = true+ ..connectionStatus = ConnectionStatus.connected+ ..agentLoadStatus = AgentLoadStatus.loaded;+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ await _openAddMachineDialog(tester, f, c);- expect(find.byType(AppSelectField<String>), findsOneWidget);- expect(find.text('macbok test local'), findsNothing);- expect(- find.text('Offline: macbok test local. Start Harness on it to add it.'),- findsOneWidget,- );+ expect(find.byType(AppSelectField<String>), findsOneWidget);+ expect(find.text('Other Mac'), findsOneWidget);+ expect(+ find.text('This Mac (${f.app.stateOf('m')!.machine.displayName})'),+ findsNothing,+ );+ expect(find.textContaining('Already in this tab:'), findsOneWidget);+ final button = tester.widget<FilledButton>(+ find.widgetWithText(FilledButton, 'Add machine'),+ );+ expect(button.onPressed, isNotNull);- await tester.pumpWidget(const SizedBox());- await c.flush();- f.app.superTabs.dispose();- await tester.pump();- },- );+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ f.app.superTabs.dispose();+ await tester.pump();+ });++ testWidgets('Add machine: an offline own machine is not offered in the picker and is named as offline '+ 'with a next step', (tester) async {+ final f = SuperTabLaunchFixture();+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ const offline = Machine(+ machineId: 'm3',+ authMode: MachineAuthMode.remote,+ name: 'macbok test local',+ );+ f.app.machines = [...f.app.machines, offline];+ f.app.machineStates['m3'] = MachineState(offline)+ ..nodeOnline = false+ ..connectionStatus = ConnectionStatus.disconnected+ ..agentLoadStatus = AgentLoadStatus.loaded;+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ await _openAddMachineDialog(tester, f, c);++ expect(find.byType(AppSelectField<String>), findsOneWidget);+ expect(find.text('macbok test local'), findsNothing);+ expect(+ find.text('Offline: macbok test local. Start Harness on it to add it.'),+ findsOneWidget,+ );++ await tester.pumpWidget(const SizedBox());+ await c.flush();+ f.app.superTabs.dispose();+ await tester.pump();+ });testWidgets('Configure on a machine card reads as editing: title "Configure machine", button "Save"',