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.

fix(desktop): separate creature counts from Git context (#428)

Dee317d665c3417
diff --git a/desktop/design/daemons.md b/desktop/design/daemons.md
index 1f24a2574..612075b2e 100644
--- a/desktop/design/daemons.md
+++ b/desktop/design/daemons.md
@@ -174,7 +174,7 @@ the night began). The app does not measure a guest's turn minutes, so long
turns count once.
The paired daemon draws at its `version`. A new egg sits in the status slot for
-3 s (an ack blink, no line), then the daemon returns and `+1 egg` stays beside
+3 s (an ack blink, no line), then the daemon returns and `1 egg` stays after
it until the egg is opened; the tooltip shows one egg look and a count
(`\_O_/ x2 waiting`). A level-up is a slow blink, no line. Before the first
hatch the slot shows the waiting egg itself: the first egg's ready face, or
@@ -240,14 +240,25 @@ daemon has one now; else the colour brighter and more saturated) on the
terminal background: panel, zoo, card and reveal; the card reads
`SHINY <RARITY>`.
-**Tally.** Dim, left of the cells: `+3` turns finished since you looked,
+**Tally.** Dim, after the creature: `3 done, 1 egg`. The sprite separates these
+counts from the Git context, and each count has its own label. Finished turns
+are counted since you looked,
cleared by a hover, opening the panel, or coming back to the window (after
-4 s in front); `+1 egg` while eggs wait, until they are opened. With a pair
-brain the `+n` is its `daemon_state.done.count` (every machine; the tooltip
+4 s in front); `1 egg` stays until it is opened. Bar counts above 999 read
+`999+`; tooltips and accessibility details retain the exact counts. With a pair
+brain the done count is its `daemon_state.done.count` (every machine; the tooltip
names the last few) and a look sends `daemon_presence { doneSeen: true }`;
without one the window counts what it sees (a turn in the pane in front of you
is already seen). Native lays out again only when the tally's width changes.
+![The native bar separates Git from labeled creature counts](images/daemon-status-counts.png)
+
+Render the combined Git/creature fixture with `HARNESS_DAEMON_CAPTURE_DIR=/tmp/daemon-counts
+flutter test test/daemon_review_render_test.dart --plain-name 'creature counts'`.
+Then use `HARNESS_NATIVE_STATUS_CAPTURE_DIR=/tmp/daemon-counts
+bash tool/check_swarm_titlebar.sh /path/to/flutter --status-preview` for the
+actual AppKit controls. Both use synthetic state without launching the app.
+
Clicking a ready egg hatches it; nothing hatches on its own. Otherwise a click
boops the daemon and opens its panel. Hover is a look. Native updates carry the
face in `daemonState` (`glyph`, `cell`, `tally`, `foreground`, `tallyColor`,
@@ -318,7 +329,7 @@ from the loopback socket bound to this computer's own harnessd
needs (same ids as the window's own questions,
`machineId/agentId#requestId`), work and failures across every machine;
`asks` and `confirms` make the face `need` (it asks you something);
- `done.count` is the `+n`; the dial is the badge. `pair: null` keeps the
+ `done.count` is the labeled done count; the dial is the badge. `pair: null` keeps the
roster's lines (a harnessd with no consent yet pairs nothing).
- **Shown, then armed** (BRAIN.md, "Security" 1). A key counts only on a
line this connection was sent and acknowledged as drawn with `daemon_shown
diff --git a/desktop/design/images/daemon-status-counts.png b/desktop/design/images/daemon-status-counts.png
new file mode 100644
index 000000000..862e8d200
Binary files /dev/null and b/desktop/design/images/daemon-status-counts.png differ
diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.md
index f2999aa76..eff856f84 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -270,20 +270,22 @@ Leave a window drag area between tabs and context and prevent overlap in
narrow windows. Native menus and commands remain available.
Only while daemons are on (the account's `GET /api/zoo` answered 200, or a
-person enabled the hidden local preview with Command-Option-Shift-D), the daemon sits at the far right, directly
+person enabled Settings → Experimental → Focus-bar creature), the daemon sits at the far right, directly
after the focused context and PR. Off, or before that is known, nothing is
reserved for it and the bar is exactly the one described above; when it turns
on, the slot waits for a quiet moment (no button held, the pointer off the
bar) so tabs never move under a click. On:
the paired daemon's sprite, or the nest while the first egg incubates
-(`\_O_/` `~\_O_/~` `\_.._/` `\_o.o_/`). Its one-cell inner gutters provide
+(`\_( )_/` `\_(/\)_/` `\_(*')_/` `\_(oo)_/`). Its one-cell inner gutters provide
separation; add no extra gap or divider. Use the same 13 pt workspace font as
the status line with ligatures off, and reserve eight character cells plus
one-cell gutters, the sprite centred on its version's base sprite, so moods,
work frames and a nap's `z` never move nearby text. It draws in the status
line's own text colour, never its daemon colour (those fail contrast on a
-status bar). A shiny daemon's `*` sits in the left gutter. To its left, dim, a
-small tally: `+3` turns finished since you looked, `+1 egg` while eggs wait.
+status bar). A shiny daemon's `*` sits in the left gutter. After the sprite, dim,
+show labeled counts: `3 done, 1 egg`. The creature separates its counts from
+the Git branch count; never put an unlabeled `+N` beside the branch context.
+Done means turns finished since you looked, and eggs means unhatched eggs.
Its name and progress belong in the tooltip and panel, never beside the
sprite. Clicking a ready egg hatches it; otherwise a click boops the daemon and
opens its panel. When something needs you or failed, its one line replaces the
diff --git a/desktop/lib/daemons/daemon_face.dart b/desktop/lib/daemons/daemon_face.dart
index 929e4418d..1149db504 100644
--- a/desktop/lib/daemons/daemon_face.dart
+++ b/desktop/lib/daemons/daemon_face.dart
@@ -14,7 +14,7 @@
/// - **Interruptions**: only a harness waiting on you and a failure take over
/// the status line, in the message yellow, at most one line nobody asked for
/// every two minutes, never about the pane in front of you, and only after
-/// Enter, a pane switch or 8 s without a key. Finished turns become `+3`
+/// Enter, a pane switch or 8 s without a key. Finished turns become `3 done`
/// beside the daemon, cleared when you look. Replies (a boop, its first
/// words, why an answer failed, the pair answering you) are dim. Quiet
/// silences everything.
@@ -230,11 +230,11 @@ class DaemonFace extends ChangeNotifier {
int _doneCount = 0, _doneWhileAway = 0;
Timer? _seenTimer;
- /// You looked at the `+n`: the brain hears `doneSeen`.
+ /// You looked at the finished-turn count: the brain hears `doneSeen`.
VoidCallback? onSeen;
- /// Coming back to the window is a look at the `+n`, once it has been in
- /// front this long.
+ /// Coming back to the window is a look at the finished-turn count, once it
+ /// has been in front this long.
static const seenAfterFocus = Duration(seconds: 4);
// Held faces.
@@ -449,17 +449,19 @@ class DaemonFace extends ChangeNotifier {
return daemonShown && shiny ? '*${c.substring(1)}' : c;
}
- /// Beside the slot: `+3` turns finished since you looked, `+1 egg` while
- /// eggs wait to be opened. Empty before the first hatch (the slot is the
- /// egg then) and while a reveal runs.
+ /// After the creature: `3 done, 1 egg`. Label both counts so they cannot
+ /// be mistaken for the neighboring Git branch count. Keep the bar bounded;
+ /// the tooltip and accessibility detail retain the exact counts. Empty
+ /// before the first hatch (the slot is the egg) and during a reveal.
String get tally {
if (!visible || _revealing || def == null) return '';
final eggs = eggsWaiting;
final done = doneCount;
+ String count(int value) => value > 999 ? '999+' : '$value';
return [
- if (done > 0) '+$done',
- if (eggs > 0) '+$eggs ${eggs == 1 ? 'egg' : 'eggs'}',
- ].join(' ');
+ if (done > 0) '${count(done)} done',
+ if (eggs > 0) '${count(eggs)} ${eggs == 1 ? 'egg' : 'eggs'}',
+ ].join(', ');
}
/// `tim: bell in codex@office: run the migration?` while it speaks; a line
@@ -679,7 +681,7 @@ class DaemonFace extends ChangeNotifier {
} else {
look(force: true);
}
- // Back at the window: the `+n` has been seen once it had a moment.
+ // Back at the window: finished turns are seen after a moment in front.
_seenTimer?.cancel();
_seenTimer = doneCount == 0
? null
@@ -979,7 +981,7 @@ class DaemonFace extends ChangeNotifier {
}
/// A new egg or a level-up, here or on another client. Neither is a line:
- /// the egg waits beside the slot (`+1 egg`) until it is opened, and a
+ /// the egg waits after the slot (`1 egg`) until it is opened, and a
/// level-up is a slow blink.
void _zooEvent(ZooEvent event) {
if (_disposed) return;
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index fba005057..ac94702d0 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -487,7 +487,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
_zooPushes = app.zooPushes.listen(_zoo.pushed);
// The pair brain, when this computer's harnessd has one.
_brain.addListener(_brainChanged);
- // A look at the `+n` clears the brain's count too.
+ // A look at the finished-turn count clears the brain's count too.
_face.onSeen = () => unawaited(_brain.doneSeen());
_face.plates = _plates;
_brainSubscriptions.addAll([
@@ -3250,7 +3250,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
'visible': _slotShown,
'glyph': _face.glyph,
// The ten cells as drawn (centred on the base sprite, a shiny `*` in
- // the gutter) and the tally beside them (`+3 +1 egg`).
+ // the gutter), followed by the labeled tally (`3 done, 1 egg`).
'cell': _face.cell,
'tally': _face.tally,
'foreground': daemonSlotInk(_face, theme).withValues(alpha: 1).toARGB32(),
diff --git a/desktop/lib/widgets/daemon_slot.dart b/desktop/lib/widgets/daemon_slot.dart
index 3091ed00a..e317fd278 100644
--- a/desktop/lib/widgets/daemon_slot.dart
+++ b/desktop/lib/widgets/daemon_slot.dart
@@ -269,14 +269,14 @@ Color? daemonSlotPatch(DaemonFace face, TerminalTheme theme) {
return daemonBackdrop(def);
}
-/// The tally's ink (`+3`, `+1 egg`) and a reply's: the status line's text,
+/// The tally's ink (`3 done`, `1 egg`) and a reply's: the status line's text,
/// dimmer. Never the alert yellow.
Color daemonDimInk(TerminalTheme theme) =>
theme.foreground.withValues(alpha: .62);
-/// The status line's daemon: its tally (`+3 +1 egg`), then ten cells (eight
-/// and a one-cell gutter each side) in the workspace bar's font. Only this
-/// widget repaints when the face changes.
+/// The status line's daemon: ten cells (eight and a one-cell gutter each
+/// side), followed by its labeled tally (`3 done, 1 egg`). The creature
+/// separates these counts from Git. Only this widget repaints on a new face.
class DaemonSlotButton extends StatelessWidget {
const DaemonSlotButton({
super.key,
@@ -325,19 +325,6 @@ class DaemonSlotButton extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
- if (tally.isNotEmpty) ...[
- SizedBox(width: cell.width),
- Text(
- tally,
- key: const ValueKey('daemon-slot-tally'),
- maxLines: 1,
- softWrap: false,
- style: workspaceBarTextStyle(
- color: daemonDimInk(theme),
- emphasized: emphasized,
- ).copyWith(fontFeatures: daemonTextFeatures),
- ),
- ],
SizedBox(
width: cell.width * (face.roster.rules.statusCells + 2),
child: Stack(
@@ -367,6 +354,19 @@ class DaemonSlotButton extends StatelessWidget {
],
),
),
+ if (tally.isNotEmpty) ...[
+ Text(
+ tally,
+ key: const ValueKey('daemon-slot-tally'),
+ maxLines: 1,
+ softWrap: false,
+ style: workspaceBarTextStyle(
+ color: daemonDimInk(theme),
+ emphasized: emphasized,
+ ).copyWith(fontFeatures: daemonTextFeatures),
+ ),
+ SizedBox(width: cell.width),
+ ],
],
),
),
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 0684863cd..1287dc3d1 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -975,7 +975,7 @@ private func validDaemonGlyph(_ value: String?) -> String? {
/// Printable ASCII of at most [cells] cells, or nothing: the slot's ten cells
/// (the glyph centred on its base sprite, a gutter each side, a shiny `*`) and
-/// the tally beside them (`+3 +1 egg`).
+/// the labeled tally after them (`3 done, 1 egg`).
private func validDaemonText(_ value: String?, cells: Int) -> String? {
guard let value, value.unicodeScalars.count <= cells,
value.unicodeScalars.allSatisfy({ $0.value >= 0x20 && $0.value <= 0x7e }) else { return nil }
@@ -1261,7 +1261,7 @@ private final class SwarmContextButton: SwarmIconButton {
}
/// Plain terminal symbols with fixed cell gutters: the daemon's eight cells plus a
-/// one-cell gutter each side, and its tally (`+3 +1 egg`) to their left. Only this
+/// one-cell gutter each side, and its tally (`3 done, 1 egg`) to their right. Only this
/// control repaints when its face changes; it lays out again only when the tally's
/// width does.
private final class SwarmSymbolButton: SwarmIconButton {
@@ -1302,7 +1302,7 @@ private final class SwarmSymbolButton: SwarmIconButton {
withAttributes: attributes)
return
}
- let slotX = bounds.width - cellWidth * CGFloat(columns + 2)
+ let slotX: CGFloat = 0
let height = (cells as NSString).size(withAttributes: attributes).height
if let patch {
patch.setFill()
@@ -1310,7 +1310,7 @@ private final class SwarmSymbolButton: SwarmIconButton {
}
if !tally.isEmpty {
let tallyInk = isEnabled || busy ? tallyColor : tallyColor.withAlphaComponent(0.35)
- (tally as NSString).draw(at: NSPoint(x: cellWidth, y: bounds.midY - height / 2),
+ (tally as NSString).draw(at: NSPoint(x: cellWidth * CGFloat(columns + 2), y: bounds.midY - height / 2),
withAttributes: [.font: drawFont, .foregroundColor: tallyInk, .ligature: 0])
}
(cells as NSString).draw(at: NSPoint(x: slotX, y: bounds.midY - height / 2), withAttributes: attributes)
@@ -1679,7 +1679,7 @@ private final class SwarmTabStrip: NSView {
daemonButton.glyph = validDaemonGlyph(state["glyph"] as? String) ?? ""
let previousWidth = daemonButton.preferredWidth
daemonButton.cells = validDaemonText(state["cell"] as? String, cells: daemonButton.columns + 2) ?? ""
- daemonButton.tally = validDaemonText(state["tally"] as? String, cells: 16) ?? ""
+ daemonButton.tally = validDaemonText(state["tally"] as? String, cells: 24) ?? ""
daemonButton.foreground = statusColor(state["foreground"], fallback: terminalForeground)
daemonButton.tallyColor = statusColor(state["tallyColor"], fallback: terminalForeground.withAlphaComponent(0.62))
daemonButton.patch = state["patch"] is NSNumber ? statusColor(state["patch"], fallback: .black) : nil
diff --git a/desktop/test/daemon_review_render_test.dart b/desktop/test/daemon_review_render_test.dart
index c90a7e776..3d0a29bad 100644
--- a/desktop/test/daemon_review_render_test.dart
+++ b/desktop/test/daemon_review_render_test.dart
@@ -23,7 +23,11 @@ import 'package:harness/daemons/render.dart';
import 'package:harness/daemons/roster.dart';
import 'package:harness/daemons/zoo.dart';
import 'package:harness/daemons/zoo_controller.dart';
-import 'package:harness/core/models.dart' show CurrentUserProfile;
+import 'package:harness/core/models.dart' show CurrentUserProfile, ConnectionStatus;
+import 'package:harness/core/agent_git_context.dart';
+import 'package:harness/shared/theme/appearance_prefs_store.dart';
+import 'package:harness/shared/theme/prompt_style.dart';
+import 'package:harness/shared/theme/status_line_style.dart';
import 'package:harness/screens/swarm_screen.dart';
import 'package:harness/state/swarm_catalog.dart' show SwarmProjectStore;
import 'package:harness/shared/theme/app_theme.dart' as grid;
@@ -41,6 +45,7 @@ import 'package:harness/settings/experimental_features.dart';
import 'support/real_fonts.dart';
import 'support/status_bar_layout.dart' show seedStatusBarWorkspace;
import 'swarm_state_test.dart' show MemoryStore, createApp;
+import 'session_git_context_test.dart' show gitFixture;
class _Memory implements LocalKeyValueStore {
final values = <String, String>{};
@@ -359,9 +364,9 @@ void main() {
done
..sync(const DaemonWatch(turns: {'m': 0}))
..sync(const DaemonWatch(turns: {'m': 3}));
- rows.add(('tim +3 done', done));
+ rows.add(('tim 3 done', done));
rows.add((
- 'lynx +1 egg',
+ 'lynx 1 egg',
await _face(
tester,
_paired(
@@ -867,7 +872,7 @@ void main() {
// ── round 3: the pair brain in the window, and economy v2 ───────────────
- testWidgets('status line: the pair brain keys first, and the +n', (
+ testWidgets('status line: the pair brain keys first, and finished turns', (
tester,
) async {
const need = DaemonSay(
@@ -972,7 +977,7 @@ void main() {
doneLast: ['api@office finished: tests pass.'],
),
);
- rows.add(('+3 from the brain', done));
+ rows.add(('3 done from the brain', done));
await _capture(
tester,
'status-brain',
@@ -985,7 +990,7 @@ void main() {
);
expect(find.text('api@office Bash: npm test'), findsOneWidget);
expect(find.byKey(const ValueKey('daemon-answer-y')), findsWidgets);
- expect(find.text('+3'), findsOneWidget);
+ expect(find.text('3 done'), findsOneWidget);
await tester.pumpWidget(const SizedBox());
for (final (_, face) in rows) {
face.sync(const DaemonWatch());
@@ -1977,6 +1982,93 @@ void main() {
});
}
+ for (final (native, width) in [(false, 640.0), (false, 1280.0), (true, 1280.0)]) {
+ testWidgets('creature counts separate from Git at $width native=$native', (tester) async {
+ final appearance = appearancePrefsStore.value;
+ appearancePrefsStore.value = appearance.copyWith(
+ prompt: const PromptPrefs(statusStyle: StatusLineStyle.powerlevel10kRainbow),
+ );
+ addTearDown(() => appearancePrefsStore.value = appearance);
+ final app = createApp();
+ addTearDown(app.dispose);
+ seedStatusBarWorkspace(app);
+ final git = gitFixture(branch: 'continue-daemons');
+ final project = git['current'] as Map<String, dynamic>;
+ git['state'] = 'multiple';
+ git['current'] = null;
+ git['checkouts'] = [
+ project,
+ for (var i = 0; i < 3; i++)
+ {...project, 'cwd': '/fixture-$i', 'root': '/fixture-$i', 'branch': 'work-$i'},
+ ];
+ git['recentWork'] = {'project': project, 'at': '2026-09-27T13:00:00Z'};
+ final machine = app.stateOf('m')!;
+ machine.nodeOnline = true;
+ machine.connectionStatus = ConnectionStatus.connected;
+ machine.agents = [
+ for (final agent in machine.agents)
+ agent.copyWith(gitContext: AgentGitContext.fromJson(git)),
+ ];
+ final zoo = ZooController(storage: _Memory());
+ addTearDown(zoo.dispose);
+ final remote = FakeZooTransport()
+ ..zoo = _paired('gnu', version: '0.1', eggs: const [
+ ZooEgg(id: 'one', kind: 'turn', grantedAt: ''),
+ ZooEgg(id: 'two', kind: 'week', grantedAt: ''),
+ ]);
+ const channel = MethodChannel('harness/swarm_tabs');
+ Map<String, dynamic>? state;
+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (call) async {
+ if (call.method == 'update') state = Map<String, dynamic>.from(call.arguments as Map);
+ if (call.method == 'daemonState') state?['daemon'] = call.arguments;
+ return null;
+ });
+ addTearDown(() async {
+ await tester.pumpWidget(const SizedBox());
+ await tester.pump();
+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, null);
+ });
+ await _capture(
+ tester,
+ 'creature-counts-${width.toInt()}-${native ? 'native' : 'flutter'}',
+ Size(width, 240),
+ (_) => SwarmScreen(
+ notifier: app,
+ nativeTabs: native,
+ projectStore: SwarmProjectStore(),
+ zoo: zoo,
+ zooTransport: remote,
+ daemonClock: () => tester.binding.clock.now(),
+ ),
+ act: () async {
+ app.notifyListeners();
+ await tester.pump();
+ await app.handleMachineEventForTest('m', {'type': 'turn_ended', 'agentId': 'a0'});
+ await tester.pump(const Duration(milliseconds: 3100));
+ },
+ );
+ if (native) {
+ expect((state!['daemon'] as Map)['tally'], '1 done, 2 eggs');
+ if (_output case final output?) {
+ await tester.runAsync(() async {
+ await File('$output/creature-counts-native.json').writeAsString(jsonEncode(state));
+ await File('$output/catalog.json').writeAsString(jsonEncode([
+ {'id': 'creature-counts-native', 'label': 'Git branches | creature | completed turns and unhatched eggs'},
+ ]));
+ });
+ }
+ } else {
+ final count = find.byKey(const ValueKey('daemon-slot-tally'));
+ expect(tester.widget<Text>(count).data, '1 done, 2 eggs');
+ expect(tester.getRect(find.byKey(const ValueKey('daemon-slot-glyph'))).right,
+ lessThanOrEqualTo(tester.getRect(count).left));
+ expect(tester.getRect(count).right, lessThanOrEqualTo(width));
+ }
+ await tester.pumpWidget(const SizedBox());
+ await tester.pump(const Duration(seconds: 11));
+ });
+ }
+
// The whole workspace bar, as the window draws it: daemons off (the
// server's 404, or a guest who has not turned on the preview) is the bar
// from before daemons existed; on (200, or a guest who turned it on) keeps
diff --git a/desktop/test/daemon_workspace_test.dart b/desktop/test/daemon_workspace_test.dart
index f92959e42..96db7a593 100644
--- a/desktop/test/daemon_workspace_test.dart
+++ b/desktop/test/daemon_workspace_test.dart
@@ -766,7 +766,7 @@ void main() {
await unmount(tester);
});
- testWidgets('finished turns are a +N beside the slot, cleared when you '
+ testWidgets('finished turns are labeled after the creature, cleared when you '
'look; Quiet and Motion are switches in the panel', (tester) async {
app.stateOf('m')!
..nodeOnline = true
@@ -792,7 +792,14 @@ void main() {
expect(focused, isNotNull);
expect(
tester.widget<Text>(find.byKey(const ValueKey('daemon-slot-tally'))).data,
- '+1',
+ '1 done',
+ );
+ expect(
+ tester.getRect(find.byKey(const ValueKey('daemon-slot-glyph'))).right,
+ lessThanOrEqualTo(
+ tester.getRect(find.byKey(const ValueKey('daemon-slot-tally'))).left,
+ ),
+ reason: 'the creature separates its counts from Git context',
);
expect(find.byKey(const ValueKey('daemon-voice')), findsNothing);
await tester.tap(slot);
@@ -882,7 +889,7 @@ void main() {
await tester.pump();
expect(
tester.widget<Text>(find.byKey(const ValueKey('daemon-slot-tally'))).data,
- '+1 egg',
+ '1 egg',
reason: 'an egg waits beside the slot until it is opened',
);
await tester.tap(slot);
@@ -934,7 +941,7 @@ void main() {
);
await tester.pump();
expect(states.last['cell'], '* (o o) ');
- expect(states.last['tally'], '+1 egg');
+ expect(states.last['tally'], '1 egg');
expect(states.last['patch'], isNull, reason: 'a dark theme');
await unmount(tester);
});
@@ -1202,7 +1209,7 @@ void main() {
await unmount(tester);
});
- testWidgets('+n is the brain\'s count of finished turns; a look sends '
+ testWidgets('done is the brain\'s count of finished turns; a look sends '
'doneSeen; auto is done and journaled; asleep is calm', (tester) async {
await mount(tester, seed: zooWithTim);
await tester.pump();
@@ -1234,7 +1241,7 @@ void main() {
tester
.widget<Text>(find.byKey(const ValueKey('daemon-slot-tally')))
.data,
- '+3',
+ '3 done',
);
expect(glyph(tester), '(o o)', reason: 'asleep is never a failure');
// It acted within rules: drawn like done.
diff --git a/desktop/test/daemons/daemon_face_test.dart b/desktop/test/daemons/daemon_face_test.dart
index da127430e..09b1390d6 100644
--- a/desktop/test/daemons/daemon_face_test.dart
+++ b/desktop/test/daemons/daemon_face_test.dart
@@ -258,7 +258,7 @@ void main() {
await settle(tester);
});
- testWidgets('a finished turn: ack blink, done for 3 s, a +1 beside the '
+ testWidgets('a finished turn: ack blink, done for 3 s, a labeled count by the '
'slot and no line', (tester) async {
await mount(tester);
face.sync(const DaemonWatch(turns: {'m': 4}));
@@ -266,7 +266,7 @@ void main() {
face.sync(const DaemonWatch(turns: {'m': 5}));
expect(face.mood, DaemonMood.done);
expect(face.voice, isNull, reason: 'a finished turn never takes over');
- expect(face.tally, '+1');
+ expect(face.tally, '1 done');
expect(face.lid, isNull);
await pass(tester, const Duration(milliseconds: 170));
expect(face.lid, '-');
@@ -277,7 +277,7 @@ void main() {
expect(face.mood, DaemonMood.idle);
face.sync(const DaemonWatch(turns: {'m': 7}));
expect(face.mood, DaemonMood.idle, reason: 'the 20 s cooldown');
- expect(face.tally, '+3', reason: 'every finish counts');
+ expect(face.tally, '3 done', reason: 'every finish counts');
expect(face.detail, contains('3 finished since you looked'));
face.seen();
expect(face.tally, '', reason: 'cleared when you look');
@@ -303,7 +303,7 @@ void main() {
focus: 'm/a1',
),
);
- expect(face.tally, '+1', reason: 'only the one you were not looking at');
+ expect(face.tally, '1 done', reason: 'only the one you were not looking at');
face.sync(
const DaemonWatch(
turns: {'m': 2},
@@ -666,7 +666,7 @@ void main() {
});
testWidgets('a new egg shows in the slot for a moment, then waits beside '
- 'it as +1 egg until it is opened', (tester) async {
+ 'it as 1 egg until it is opened', (tester) async {
// At 1.0 (150 xp), two days of turns (200 xp) stay below the next level.
await mount(tester, version: '1.0');
// A guest's 40th counted turn earns a turn egg; two days at the cap
@@ -680,11 +680,11 @@ void main() {
expect(zoo.zoo.eggs.single.kind, 'turn');
expect(face.glyph, r'\_(oo)_/');
expect(face.voice, isNull, reason: 'an egg is not an interruption');
- expect(face.tally, '+1 egg');
+ expect(face.tally, '1 egg');
expect(face.tooltip, contains(r'\_(oo)_/ x1 waiting'));
await pass(tester, const Duration(seconds: 3));
expect(face.glyph, ',(o o),', reason: 'the daemon comes back');
- expect(face.tally, '+1 egg', reason: 'the egg still waits');
+ expect(face.tally, '1 egg', reason: 'the egg still waits');
await zoo.hatch(zoo.zoo.eggs.single.id);
expect(face.tally, '', reason: 'opened');
await pass(tester, const Duration(seconds: 6));
@@ -901,6 +901,36 @@ void main() {
await settle(tester);
});
+ testWidgets('completed turns and unhatched eggs have distinct labels', (
+ tester,
+ ) async {
+ await mount(
+ tester,
+ custom: Zoo(
+ daemons: [ZooDaemon(id: 'gnu', hatched: '', egg: 'first')],
+ pair: 'gnu',
+ firstEgg: true,
+ eggs: const [
+ ZooEgg(id: 'one', kind: 'turn', grantedAt: ''),
+ ZooEgg(id: 'two', kind: 'week', grantedAt: ''),
+ ],
+ ),
+ );
+ face.sync(const DaemonWatch(doneCount: 1));
+ expect(face.tally, '1 done, 2 eggs');
+ face.sync(const DaemonWatch(doneCount: 1234));
+ expect(face.tally, '999+ done, 2 eggs');
+ expect(face.tooltip, contains('1234'));
+ expect(face.detail, contains('1234 finished'));
+ face.seen();
+ expect(
+ face.tally,
+ '2 eggs',
+ reason: 'looking clears work, never unhatched eggs',
+ );
+ await settle(tester);
+ });
+
testWidgets('the brain counts finished turns everywhere; a look clears it '
'and tells the brain', (tester) async {
await mount(tester);
@@ -912,7 +942,7 @@ void main() {
doneLast: ['api@office finished: tests pass.'],
),
);
- expect(face.tally, '+3');
+ expect(face.tally, '3 done');
expect(face.tooltip, contains('api@office finished: tests pass.'));
face.seen();
expect(face.tally, '');
@@ -924,9 +954,9 @@ void main() {
face.setEnvironment(foreground: false, reduceMotion: false);
await pass(tester, const Duration(minutes: 1));
face.setEnvironment(foreground: true, reduceMotion: false);
- expect(face.tally, '+2');
+ expect(face.tally, '2 done');
await pass(tester, const Duration(seconds: 3));
- expect(face.tally, '+2');
+ expect(face.tally, '2 done');
await pass(tester, const Duration(seconds: 2));
expect(face.tally, '');
expect(told, 2);
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 44764fbb5..3f96320cf 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -514,13 +514,31 @@ private extension SwarmTabStrip {
daemon["cell"] = "* [o o] "
updateDaemon(daemon)
try checkTitlebar(daemonButton.cells.hasPrefix("*") && unmoved(), "A shiny daemon's * sits in the gutter")
- daemon["tally"] = "+3 +1 egg"
+ daemon["tally"] = "3 done, 1 egg"
+ daemon["foreground"] = 0xffffffff
daemon["tallyColor"] = 0xff808080
updateDaemon(daemon)
- try checkTitlebar(abs(daemonButton.frame.width - cellWidth * CGFloat(10 + 1 + 9)) < 0.5 &&
+ try checkTitlebar(abs(daemonButton.frame.width - cellWidth * CGFloat(10 + 1 + 13)) < 0.5 &&
daemonButton.frame.maxX == daemonFrame.maxX && contextButton.frame.maxX <= daemonButton.frame.minX,
- "The tally widens the control to the left and the status makes room")
- daemon["tally"] = "+3 and far too many words"
+ "The labeled tally widens the control and the status makes room")
+ let counted = daemonButton.renderedBitmap()
+ var brightColumns = Set<Int>(), mutedColumns = Set<Int>()
+ for y in 0..<counted.pixelsHigh {
+ for x in 0..<counted.pixelsWide {
+ guard let color = counted.colorAt(x: x, y: y)?.usingColorSpace(.deviceRGB),
+ color.alphaComponent > 0.8 else { continue }
+ if color.redComponent > 0.8 { brightColumns.insert(x) }
+ if (0.45...0.55).contains(color.redComponent) { mutedColumns.insert(x) }
+ }
+ }
+ try checkTitlebar(!brightColumns.isEmpty && !mutedColumns.isEmpty &&
+ brightColumns.max()! < Int(cellWidth * 10) && mutedColumns.min()! >= Int(cellWidth * 10),
+ "The native creature draws before its dim counts, separating them from Git")
+ daemon["tally"] = "999+ done, 999+ eggs"
+ updateDaemon(daemon)
+ try checkTitlebar(daemonButton.tally == "999+ done, 999+ eggs",
+ "The largest bounded labeled tally is retained by native validation")
+ daemon["tally"] = "3 done, and far too many words for this slot"
updateDaemon(daemon)
try checkTitlebar(daemonButton.tally.isEmpty && daemonButton.frame == daemonFrame,
"A tally that is not short printable ASCII draws nothing")