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
feat(mobile): a desk tab says which of its agents finished or is asking
Dev jacob6db3a260f92e
diff --git a/mobile/lib/notify/agent_unread.dart b/mobile/lib/notify/agent_unread.dartindex bfc654476..da029ebe2 100644--- a/mobile/lib/notify/agent_unread.dart+++ b/mobile/lib/notify/agent_unread.dart@@ -29,6 +29,19 @@ class AgentUnread extends ChangeNotifier {/// What this agent's mark says, or null when it has none.NoticeKind? kindFor(AgentRef ref) => _unread[_key(ref)];+ /// The most urgent news among [refs] — a question over a finished turn — or+ /// null when none of them carries any. What a desk tab's pill says about the+ /// agents in it, so a person can see WHICH tab to open before opening it.+ NoticeKind? mostUrgentOf(Iterable<AgentRef> refs) {+ NoticeKind? found;+ for (final ref in refs) {+ final kind = kindFor(ref);+ if (kind == NoticeKind.question) return kind;+ found ??= kind;+ }+ return found;+ }+/// The NEWEST kind wins — see [NoticeKind].void mark(AgentRef ref, NoticeKind kind) {final key = _key(ref);diff --git a/mobile/lib/phone/desk_tab_strip.dart b/mobile/lib/phone/desk_tab_strip.dartindex 82f3f7177..d72b17e57 100644--- a/mobile/lib/phone/desk_tab_strip.dart+++ b/mobile/lib/phone/desk_tab_strip.dart@@ -4,6 +4,8 @@ import 'package:flutter/services.dart';import 'package:flutter/widgets.dart';import 'package:lucide_icons_flutter/lucide_icons.dart';+import 'package:harness_mobile/notify/agent_notice.dart';+import 'package:harness_mobile/notify/unread_marks.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';import 'desk_groups.dart';@@ -43,6 +45,7 @@ class DeskTabStrip extends StatefulWidget {required this.onPick,this.onAddTab,this.onRename,+ this.unreadFor,});/// Every tab, in the desk's own order — see [deskGroups]. Never empty.@@ -63,6 +66,13 @@ class DeskTabStrip extends StatefulWidget {/// desk this phone may write to.final void Function(DeskGroup group)? onRename;+ /// The news the agents of a tab carry that nobody has gone to yet — see+ /// `AgentUnread.mostUrgentOf`. Drawn as the rows' own [UnreadDot] before the+ /// tab's name: an agent finishing in a tab you are not reading has to say+ /// which tab it is in, or the dot is only found by opening every one of them.+ /// Null draws no marks.+ final NoticeKind? Function(DeskGroup group)? unreadFor;+/// The row's height: a 32pt pill with 6pt either side of it, which a tap/// still lands in — a pill is short for a thumb, the row around it is not.static const double height = 44;@@ -170,6 +180,7 @@ class _DeskTabStripState extends State<DeskTabStrip> {name: group.name,selected: selected,reachable: !group.isEmpty,+ unread: widget.unreadFor?.call(group),onTap: () => onPick(group),// ⚠️ **Only the tab being SHOWN can be double-tapped, and// that is a decision about the other tabs rather than about@@ -263,6 +274,7 @@ class _DeskTabPill extends StatelessWidget {required this.name,required this.selected,required this.reachable,+ required this.unread,required this.onTap,required this.onRename,});@@ -270,6 +282,9 @@ class _DeskTabPill extends StatelessWidget {final String name;final bool selected;+ /// What its agents are carrying — see [DeskTabStrip.unreadFor].+ final NoticeKind? unread;+/// False for a tab whose agents are all out of reach — drawn dim, and still/// pickable. See [DeskTabStrip].final bool reachable;@@ -329,21 +344,30 @@ class _DeskTabPill extends StatelessWidget {borderRadius: BorderRadius.circular(height / 2),border: Border.all(color: selected ? fill : AppGlass.hair),),- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: _maxLabelWidth),- child: Text(- name,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- color: ink,- fontSize: 14.5,- // The tab being shown is a weight heavier as well as filled,- // which is what carries it to someone who cannot see the- // fill — the same pairing [PhoneTabBar] uses below.- fontWeight: selected ? FontWeight.w600 : FontWeight.w500,+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ // Before the name, as on the agent rows below it: the same+ // mark in the same place, one level up.+ if (unread case final kind?) UnreadDot(kind: kind),+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: _maxLabelWidth),+ child: Text(+ name,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyle(+ color: ink,+ fontSize: 14.5,+ // The tab being shown is a weight heavier as well as+ // filled, which is what carries it to someone who cannot+ // see the fill — the same pairing [PhoneTabBar] uses+ // below.+ fontWeight: selected ? FontWeight.w600 : FontWeight.w500,+ ),+ ),),- ),+ ],),),),diff --git a/mobile/lib/phone/desk_tabs_panel.dart b/mobile/lib/phone/desk_tabs_panel.dartindex 36c6c6b8d..64d8293be 100644--- a/mobile/lib/phone/desk_tabs_panel.dart+++ b/mobile/lib/phone/desk_tabs_panel.dart@@ -315,6 +315,9 @@ class _DeskTabsPanelState extends State<DeskTabsPanel> {// [AppNotifier.deskWritable].onAddTab: widget.notifier.deskWritable ? _addTab : null,onRename: widget.notifier.deskWritable ? _rename : null,+ unreadFor: (tab) => widget.notifier.agentNotices.unread.mostUrgentOf(+ tab.entries.map(_refOf),+ ),),SheetCaption(label: group.name,diff --git a/mobile/test/notify/desk_tab_unread_test.dart b/mobile/test/notify/desk_tab_unread_test.dartnew file mode 100644index 000000000..f42b0a108--- /dev/null+++ b/mobile/test/notify/desk_tab_unread_test.dart@@ -0,0 +1,68 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';++import 'package:harness_mobile/notify/agent_notice.dart';+import 'package:harness_mobile/notify/agent_unread.dart';+import 'package:harness_mobile/notify/unread_marks.dart';+import 'package:harness_mobile/phone/desk_groups.dart';+import 'package:harness_mobile/phone/desk_tab_strip.dart';++/// A tab says what its agents are carrying, so the person can tell WHICH tab+/// an agent finished in without opening every one of them.+void main() {+ const a = (machineId: 'm', agentId: 'a');+ const b = (machineId: 'm', agentId: 'b');+ const c = (machineId: 'm', agentId: 'c');++ group('mostUrgentOf', () {+ test('a question outranks a finished turn, wherever it sits', () {+ final unread = AgentUnread()+ ..mark(a, NoticeKind.done)+ ..mark(b, NoticeKind.question);+ addTearDown(unread.dispose);+ expect(unread.mostUrgentOf([a, b]), NoticeKind.question);+ expect(unread.mostUrgentOf([a, c]), NoticeKind.done);+ expect(unread.mostUrgentOf([c]), isNull);+ expect(unread.mostUrgentOf(const []), isNull);+ });+ });++ testWidgets('each pill carries its own tab\'s mark, in its kind\'s colour', (+ tester,+ ) async {+ const kinds = {'desk': NoticeKind.done, 'docker': NoticeKind.question};+ await tester.pumpWidget(+ MaterialApp(+ home: Scaffold(+ body: DeskTabStrip(+ groups: const [+ DeskGroup(id: 'desk', name: 'Desktop', entries: []),+ DeskGroup(id: 'docker', name: 'Docker', entries: []),+ DeskGroup(id: 'other', name: 'Other', entries: []),+ ],+ selectedId: 'desk',+ onPick: (_) {},+ unreadFor: (tab) => kinds[tab.id],+ ),+ ),+ ),+ );++ UnreadDot? dotIn(String name) {+ final dot = find.descendant(+ // The pill's own row — the nearest one — not the strip's around it.+ of: find+ .ancestor(of: find.text(name), matching: find.byType(Row))+ .first,+ matching: find.byType(UnreadDot),+ );+ return dot.evaluate().isEmpty+ ? null+ : tester.widget<UnreadDot>(dot.first);+ }++ expect(dotIn('Desktop')?.kind, NoticeKind.done);+ expect(dotIn('Docker')?.kind, NoticeKind.question);+ expect(dotIn('Other'), isNull);+ });+}