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(mobile): opening an agent reads its news, whichever road opened it
Dev jacobb24091d6da92
diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dartindex 3b6298784..f29223eb1 100644--- a/mobile/lib/state/app_state.dart+++ b/mobile/lib/state/app_state.dart@@ -1119,12 +1119,7 @@ class AppNotifier extends ChangeNotifier {/// no pointer behind it: the dial's scroll and focus frames, and which agent/// the rail draws as current.int? get focusedPaneId => activeSwarm.focusedPaneId;- set focusedPaneId(int? value) {- activeSwarm.focusedPaneId = value;- // Every route onto an agent ends here, so none of them has to remember- // that going to an agent is what reads its news.- _seeWatchedAgent();- }+ set focusedPaneId(int? value) => activeSwarm.focusedPaneId = value;int _paneFocusRequest = 0;@@ -7175,6 +7170,22 @@ class AppNotifier extends ChangeNotifier {if (watched != null) agentNotices.seen(watched);}+ /// Every change the screens hear about is also a chance that the agent on+ /// screen is a different one — and going to an agent is what reads its news.+ ///+ /// ⚠️ **Here, and not in the `focusedPaneId` setter where it first went.**+ /// Half the roads onto an agent never touch that setter: a NEW pane — a row+ /// tapped, a notice tapped — is focused on its swarm directly, and so are a+ /// restored layout and a swarm switched to. Hooked there, the mark outlived+ /// the person opening the very agent it pointed at. Every one of those roads+ /// ends by notifying, so this is the one place none of them can miss. It+ /// costs a lookup: [AgentAnnouncer.seen] is silent for an agent with no mark.+ @override+ void notifyListeners() {+ _seeWatchedAgent();+ super.notifyListeners();+ }+/// [agent] on [machine], as a notice names it.NoticeAgent _noticeAgent(MachineState machine, Agent agent) => (ref: (machineId: machine.machine.machineId, agentId: agent.id),diff --git a/mobile/test/notify/app_notice_test.dart b/mobile/test/notify/app_notice_test.dartindex 867c5e276..e3e7a4e49 100644--- a/mobile/test/notify/app_notice_test.dart+++ b/mobile/test/notify/app_notice_test.dart@@ -96,6 +96,23 @@ void main() {expect(unread(app, 'b'), isFalse);});+ test('opening an agent that has no pane yet reads its news', () async {+ // The phone's ordinary road: a row tapped, a notice tapped — a NEW pane,+ // focused on its swarm directly rather than through `focusPane`.+ await turn(app, 'c');+ expect(app.paneOfAgent('m', 'c'), isNull);+ await app.selectAgent('m', 'c');+ expect(unread(app, 'c'), isFalse);+ });++ test('coming back to an agent already open reads its news', () async {+ await app.selectAgent('m', 'b');+ await app.selectAgent('m', 'a');+ await turn(app, 'b');+ await app.selectAgent('m', 'b');+ expect(unread(app, 'b'), isFalse);+ });+test('a deleted agent takes its mark with it', () async {await turn(app, 'b');await app.handleEventForTest('m', {