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.

Show only the creature in the focus bar (#434)

Deedafb0cab8c8b
diff --git a/desktop/design/daemons.md b/desktop/design/daemons.md
index 4a3dcc024..f552e5299 100644
--- a/desktop/design/daemons.md
+++ b/desktop/design/daemons.md
@@ -111,7 +111,7 @@ daemons are on.
| zoo shape, rules, local draw | `lib/daemons/zoo.dart` |
| zoo state: account, guest, seed; on, off or not known yet | `lib/daemons/zoo_controller.dart` |
| Experimental local preview | `lib/settings/experimental_features.dart`; `lib/settings/sections/experimental_section.dart`; `SwarmScreen._experimentalFeaturesChanged`; `ZooController.showPreview` |
-| moods, blinks, work steps, tally, voice | `lib/daemons/daemon_face.dart` |
+| moods, blinks, work steps, activity details, voice | `lib/daemons/daemon_face.dart` |
| the pair brain's frames, shown and armed, confirms, talk and `pair` requests | `lib/daemons/daemon_brain.dart` |
| lessons (list, show, skip, revert; taught only by the live line's key) | `lib/daemons/daemon_lessons.dart` |
| `pair.jsonc`: where it is, the file written when missing, what a rules confirmation turns on | `lib/daemons/pair_rules_file.dart` |
@@ -240,30 +240,29 @@ 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, 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` 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.
-While the pointer is over the creature, clearing a count retains its former
-space so the click target stays still. That space collapses on pointer exit.
-
-![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
+**Focus bar.** Only the egg or creature occupies its ten-cell slot. Do not put
+completed-turn counts, egg counts, or labels beside it. Its expression and work
+frames communicate activity; additional eggs, progress, and activity details
+live in the panel. Tooltips and accessibility retain details on demand. Counts
+never widen the slot or move its neighbors, including during hover.
+
+The underlying finished-turn details are cleared by a hover, opening the panel,
+or coming back to the window (after 4 s in front). With a pair brain the 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).
+
+![The native bar shows Git context and the creature alone](images/daemon-status-counts.png)
+
+Render the combined Git/creature fixture with `HARNESS_DAEMON_CAPTURE_DIR=/tmp/daemon-focus-bar
+flutter test test/daemon_review_render_test.dart --plain-name 'creature alone'`.
+Then use `HARNESS_NATIVE_STATUS_CAPTURE_DIR=/tmp/daemon-focus-bar
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`,
+face in `daemonState` (`glyph`, `cell`, `foreground`,
`patch`, voice, `voiceArmed`) and repaint only the slot and the line; hover comes back as `daemonLook`.
While a hatch reveal runs, the slot keeps the egg and neither the Flutter bar
@@ -287,8 +286,8 @@ Silent by default. **Only a harness waiting on you and a failure take over the
status line**, in the terminal's yellow for 5.2 s, as tmux's message line
does. A reply to something you did (a boop, the first words after a hatch, why
an answer failed) speaks at once, dim, in the status line's own ink. Finished
-turns, new eggs, level-ups and returns are never a line: they are the tally, a
-blink, the wave and the brief.
+turns, new eggs, level-ups and returns are never a line: they are a blink,
+the wave, the panel and the brief.
A line nobody asked for:
@@ -377,7 +376,7 @@ from the loopback socket bound to this computer's own harnessd
the pair acted) holds `done` with an ack blink and says it dimly, counted as
a line nobody asked for; it is also in "what tim did". `say` (the pair
answering you, or a setting that changed) is a dim reply and draws idle. `done` and `back` are never a
- line: the tally and the brief carry them.
+ line: the expression and the brief carry them.
- **What waits for you** (the now tab) keeps what the line could not: every
confirmation in `daemon_state.confirms`, every proposal in
`daemon_state.asks` (a proposal's keys work for its ten minutes; one
diff --git a/desktop/design/images/daemon-status-counts.png b/desktop/design/images/daemon-status-counts.png
index 862e8d200..69debc7fd 100644
Binary files a/desktop/design/images/daemon-status-counts.png 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 eaec240b9..1a01e31bd 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -292,12 +292,11 @@ 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. 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.
-Keep the creature's click target still while hovered, retaining cleared count
-space until the pointer leaves.
+status bar). A shiny daemon's `*` sits in the left gutter. Show only the egg
+or creature in this fixed slot: no completed-turn count, egg count, or label
+beside it. Additional eggs, progress, and activity details belong in the panel.
+The slot keeps the same width while work finishes, eggs arrive, and the pointer
+enters or leaves, so neither the creature nor its neighbors move.
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 359a594c4..1c3858034 100644
--- a/desktop/lib/daemons/daemon_face.dart
+++ b/desktop/lib/daemons/daemon_face.dart
@@ -1,6 +1,5 @@
/// The paired daemon's face in the status line: its mood, its blinks, the
-/// frames it steps through while agents work, the small tally beside it and
-/// the one line it says.
+/// frames it steps through while agents work and the one line it says.
///
/// The rules are the README's (`daemons/README.md`, Moods, Motion and blinks,
/// Voice). Moods come from work, never from the clock: there is no idle timer.
@@ -226,7 +225,7 @@ class DaemonFace extends ChangeNotifier {
final _turns = <String, int>{}, _fails = <String, int>{};
bool _baselined = false;
- // The tally: finished turns since you looked, and while you were away.
+ // Activity details: finished turns since you looked, and while you were away.
int _doneCount = 0, _doneWhileAway = 0;
Timer? _seenTimer;
@@ -449,36 +448,6 @@ class DaemonFace extends ChangeNotifier {
return daemonShown && shiny ? '*${c.substring(1)}' : c;
}
- /// 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) '${count(done)} done',
- if (eggs > 0) '${count(eggs)} ${eggs == 1 ? 'egg' : 'eggs'}',
- ].join(', ');
- }
-
- bool _pointerInside = false;
- int _heldTallyCells = 0;
-
- /// Keep the click target still when looking clears a count. Empty space
- /// is released once the pointer leaves; new counts can still grow it.
- int get tallyCells =>
- _heldTallyCells > tally.length ? _heldTallyCells : tally.length;
-
- void setPointerInside(bool inside) {
- if (_pointerInside == inside) return;
- _pointerInside = inside;
- _heldTallyCells = inside ? tally.length : 0;
- _update(force: true);
- }
-
/// `tim: bell in codex@office: run the migration?` while it speaks; a line
/// from the pair brain exactly as sent (`[y/n/g] api@office: npm test`).
String? get voice => _voice.value;
@@ -1120,7 +1089,7 @@ class DaemonFace extends ChangeNotifier {
/// the window's own alerts; `ask` (the pair wants your key) is yellow and at
/// once; `say` (the pair answering you) is a dim reply; `auto` (a rule or
/// the pair acted) is dim, and the face shows it as done. A finished turn
- /// or a return is never a line (the tally and the brief carry them). A
+ /// or a return is never a line (the expression and brief carry them). A
/// second line with the same id replaces it in place, with the time the
/// brain says it has left.
void sayFromBrain(DaemonSay say) {
@@ -1302,12 +1271,6 @@ class DaemonFace extends ChangeNotifier {
void _update({DaemonMood? before, bool force = false}) {
if (_disposed) return;
- if (!visible) {
- _pointerInside = false;
- _heldTallyCells = 0;
- } else if (_pointerInside && tally.length > _heldTallyCells) {
- _heldTallyCells = tally.length;
- }
final now = mood;
_runMotion(now);
final glyph = this.glyph;
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 1d4fcd2a2..7e584bece 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -1901,15 +1901,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
if (call.method == 'daemonLook') {
if (!_zoo.loaded) return;
- _face.setPointerInside(true);
_face.look();
_face.seen();
return;
}
- if (call.method == 'daemonLeave') {
- _face.setPointerInside(false);
- return;
- }
if (call.method == 'daemonAnswer') {
final key = (call.arguments as Map?)?['key'];
if (key is String && _shortcutsEnabled && _zoo.loaded) {
@@ -3255,12 +3250,9 @@ 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), followed by the labeled tally (`3 done, 1 egg`).
+ // the gutter). Counts and progress stay out of the focus bar.
'cell': _face.cell,
- 'tally': _face.tally,
- 'tallyCells': _face.tallyCells,
'foreground': daemonSlotInk(_face, theme).withValues(alpha: 1).toARGB32(),
- 'tallyColor': daemonDimInk(theme).toARGB32(),
'patch': daemonSlotPatch(_face, theme)?.toARGB32(),
'open': _daemonOverlay != null,
'busy': _face.revealing || _zoo.hatchingEgg != null,
@@ -6252,12 +6244,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
];
// No space is kept for the slot until it is shown: off (or not decided
// yet) the bar is exactly the one it was before daemons existed.
- final tallyCells = _slotShown ? _face.tallyCells : 0;
final daemonSpace = _slotShown
- ? cell.width *
- (_face.roster.rules.statusCells +
- 2 +
- (tallyCells == 0 ? 0 : tallyCells + 1))
+ ? cell.width * (_face.roster.rules.statusCells + 2)
: 0.0;
final toolHeight = workspaceBarControlHeight(context);
final pr = _pullRequest.value;
diff --git a/desktop/lib/widgets/daemon_slot.dart b/desktop/lib/widgets/daemon_slot.dart
index f0fae4c13..9d77d48be 100644
--- a/desktop/lib/widgets/daemon_slot.dart
+++ b/desktop/lib/widgets/daemon_slot.dart
@@ -269,14 +269,13 @@ Color? daemonSlotPatch(DaemonFace face, TerminalTheme theme) {
return daemonBackdrop(def);
}
-/// The tally's ink (`3 done`, `1 egg`) and a reply's: the status line's text,
-/// dimmer. Never the alert yellow.
+/// A reply's ink: the status line's text, dimmer. Never the alert yellow.
Color daemonDimInk(TerminalTheme theme) =>
theme.foreground.withValues(alpha: .62);
/// 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.
+/// side). Counts and progress belong in its panel. Only this widget
+/// repaints on a new face.
class DaemonSlotButton extends StatelessWidget {
const DaemonSlotButton({
super.key,
@@ -303,15 +302,12 @@ class DaemonSlotButton extends StatelessWidget {
if (!face.visible) return const SizedBox.shrink();
final cell = workspaceBarCellSizeOf(context);
final theme = currentTerminalTheme();
- final tally = face.tally;
final patch = daemonSlotPatch(face, theme);
return MouseRegion(
onEnter: (_) {
- face.setPointerInside(true);
face.look();
face.seen();
},
- onExit: (_) => face.setPointerInside(false),
child: Semantics(
value: face.detail,
child: WorkspaceBarControl(
@@ -324,57 +320,31 @@ class DaemonSlotButton extends StatelessWidget {
: onPressed,
builder: (context, emphasized) => SizedBox(
height: workspaceBarControlHeight(context),
- child: Row(
- mainAxisSize: MainAxisSize.min,
+ width: cell.width * (face.roster.rules.statusCells + 2),
+ child: Stack(
+ alignment: Alignment.centerLeft,
children: [
- SizedBox(
- width: cell.width * (face.roster.rules.statusCells + 2),
- child: Stack(
- alignment: Alignment.centerLeft,
- children: [
- if (patch != null)
- Positioned(
- left: cell.width,
- width: cell.width * face.roster.rules.statusCells,
- height: cell.height,
- child: ColoredBox(
- key: const ValueKey('daemon-slot-patch'),
- color: patch,
- ),
- ),
- Text(
- face.cell,
- key: const ValueKey('daemon-slot-glyph'),
- maxLines: 1,
- softWrap: false,
- overflow: TextOverflow.clip,
- style: workspaceBarTextStyle(
- color: daemonSlotInk(face, theme),
- emphasized: emphasized,
- ).copyWith(fontFeatures: daemonTextFeatures),
- ),
- ],
+ if (patch != null)
+ Positioned(
+ left: cell.width,
+ width: cell.width * face.roster.rules.statusCells,
+ height: cell.height,
+ child: ColoredBox(
+ key: const ValueKey('daemon-slot-patch'),
+ color: patch,
+ ),
),
+ Text(
+ face.cell,
+ key: const ValueKey('daemon-slot-glyph'),
+ maxLines: 1,
+ softWrap: false,
+ overflow: TextOverflow.clip,
+ style: workspaceBarTextStyle(
+ color: daemonSlotInk(face, theme),
+ emphasized: emphasized,
+ ).copyWith(fontFeatures: daemonTextFeatures),
),
- if (face.tallyCells > 0)
- SizedBox(
- width: cell.width * (face.tallyCells + 1),
- child: tally.isEmpty
- ? null
- : Align(
- alignment: Alignment.centerLeft,
- child: Text(
- tally,
- key: const ValueKey('daemon-slot-tally'),
- maxLines: 1,
- softWrap: false,
- style: workspaceBarTextStyle(
- color: daemonDimInk(theme),
- emphasized: emphasized,
- ).copyWith(fontFeatures: daemonTextFeatures),
- ),
- ),
- ),
],
),
),
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 5038e5848..635d326f3 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -974,8 +974,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 labeled tally after them (`3 done, 1 egg`).
+/// (the glyph centred on its base sprite, a gutter each side, a shiny `*`).
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,31 +1260,25 @@ 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 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.
+/// one-cell gutter each side. Counts and progress stay in the panel. Only this
+/// control repaints when its face changes, with no layout changes.
private final class SwarmSymbolButton: SwarmIconButton {
var glyph = ""
/// The ten cells as Flutter drew them: the glyph centred on its version's base
/// sprite (so a baton never moves the face) and a shiny `*` in the left gutter.
var cells = ""
- var tally = ""
- var tallyCells = 0
let columns = 8
/// A hatch in flight or its reveal running: drawn at full ink, not clickable.
var busy = false
var foreground = NSColor.white
- var tallyColor = NSColor.secondaryLabelColor
/// The grue on a light theme: a black patch behind its eight cells.
var patch: NSColor?
/// The pointer arrived: "I see you". Never moves keyboard focus.
var onEnter: (() -> Void)?
- var onExit: (() -> Void)?
private var textFont: NSFont { font ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular) }
private var cellWidth: CGFloat { ceil(workspaceBarTextWidth("m", font: textFont)) }
var preferredWidth: CGFloat {
- let count = max(tally.count, tallyCells)
- return cellWidth * CGFloat(columns + 2 + (count == 0 ? 0 : count + 1))
+ cellWidth * CGFloat(columns + 2)
}
override func mouseEntered(with event: NSEvent) {
@@ -1293,11 +1286,6 @@ private final class SwarmSymbolButton: SwarmIconButton {
if !isHidden { onEnter?() }
}
- override func mouseExited(with event: NSEvent) {
- super.mouseExited(with: event)
- onExit?()
- }
-
override func draw(_ dirtyRect: NSRect) {
guard !glyph.isEmpty || !cells.isEmpty else { return }
let ink = isEnabled || busy ? foreground : foreground.withAlphaComponent(0.35)
@@ -1316,11 +1304,6 @@ private final class SwarmSymbolButton: SwarmIconButton {
patch.setFill()
NSRect(x: slotX + cellWidth, y: bounds.midY - height / 2, width: cellWidth * CGFloat(columns), height: height).fill()
}
- if !tally.isEmpty {
- let tallyInk = isEnabled || busy ? tallyColor : tallyColor.withAlphaComponent(0.35)
- (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)
}
}
@@ -1509,10 +1492,6 @@ private final class SwarmTabStrip: NSView {
guard let self, self.actionsEnabled, !self.daemonButton.isHidden else { return }
self.emit?("daemonLook", nil)
}
- daemonButton.onExit = { [weak self] in
- guard let self, !self.daemonButton.isHidden else { return }
- self.emit?("daemonLeave", nil)
- }
addSubview(daemonButton)
shareButton.isBordered = false
shareButton.title = "[ Share ]"
@@ -1689,13 +1668,8 @@ private final class SwarmTabStrip: NSView {
daemonButton.isEnabled = actionsEnabled && !daemonButton.isHidden && !daemonButton.busy
daemonButton.state = state["open"] as? Bool == true ? .on : .off
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: 24) ?? ""
- let heldCells = (state["tallyCells"] as? NSNumber)?.intValue ?? 0
- daemonButton.tallyCells = max(daemonButton.tally.count, min(24, max(0, heldCells)))
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
let label = state["label"] as? String ?? "Daemon"
let detail = state["detail"] as? String ?? ""
@@ -1714,8 +1688,8 @@ private final class SwarmTabStrip: NSView {
voiceLabel.armed = state["voiceArmed"] as? Bool ?? true
voiceActive = !voice.isEmpty
applyStatusVisibility()
- // Layout runs only when the slot appears or goes, or its tally changes width.
- if wasHidden != daemonButton.isHidden || previousWidth != daemonButton.preferredWidth {
+ // The slot always keeps ten cells; layout runs only when it appears or goes.
+ if wasHidden != daemonButton.isHidden {
needsLayout = true
needsDisplay = true
layoutSubtreeIfNeeded()
diff --git a/desktop/test/daemon_review_render_test.dart b/desktop/test/daemon_review_render_test.dart
index 3d0a29bad..6bf2e4333 100644
--- a/desktop/test/daemon_review_render_test.dart
+++ b/desktop/test/daemon_review_render_test.dart
@@ -1,5 +1,5 @@
// Real-font review captures of the daemon: the status slot in every mood and
-// nest stage (with its tally, a shiny `*`, alerts and replies), the hatch
+// nest stage (with a shiny `*`, alerts and replies), the hatch
// reveal's frames and rarity tells (drop init's plates at the reveal size),
// and the panel (the zoo's box back with a portrait plate, the card, a calm
// unreachable machine, light themes). Always checks that nothing overflows;
@@ -287,7 +287,7 @@ Widget _bar(
void main() {
setUpAll(_fonts);
- testWidgets('status slot: nest stages, versions, moods, tally and voice', (
+ testWidgets('status slot: nest stages, versions, moods and voice', (
tester,
) async {
final rows = <(String, DaemonFace)>[];
@@ -359,7 +359,7 @@ void main() {
'gopher shiny',
await _face(tester, _paired('gopher', shiny: true)),
));
- // Finished turns: a count beside the slot, never a line.
+ // Finished turns: the face reacts without adding a count or a line.
final done = await _face(tester, _paired('tim'));
done
..sync(const DaemonWatch(turns: {'m': 0}))
@@ -990,7 +990,8 @@ void main() {
);
expect(find.text('api@office Bash: npm test'), findsOneWidget);
expect(find.byKey(const ValueKey('daemon-answer-y')), findsWidgets);
- expect(find.text('3 done'), findsOneWidget);
+ expect(find.text('3 done'), findsNothing,
+ reason: 'finished turns affect the face without adding a bar count');
await tester.pumpWidget(const SizedBox());
for (final (_, face) in rows) {
face.sync(const DaemonWatch());
@@ -1983,7 +1984,7 @@ 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 {
+ testWidgets('creature alone beside Git at $width native=$native', (tester) async {
final appearance = appearancePrefsStore.value;
appearancePrefsStore.value = appearance.copyWith(
prompt: const PromptPrefs(statusStyle: StatusLineStyle.powerlevel10kRainbow),
@@ -2030,7 +2031,7 @@ void main() {
});
await _capture(
tester,
- 'creature-counts-${width.toInt()}-${native ? 'native' : 'flutter'}',
+ 'creature-only-${width.toInt()}-${native ? 'native' : 'flutter'}',
Size(width, 240),
(_) => SwarmScreen(
notifier: app,
@@ -2048,21 +2049,24 @@ void main() {
},
);
if (native) {
- expect((state!['daemon'] as Map)['tally'], '1 done, 2 eggs');
+ final daemon = state!['daemon'] as Map;
+ expect((daemon['cell'] as String).length, 10);
+ expect(daemon.containsKey('tally'), isFalse);
+ expect(daemon.containsKey('tallyCells'), isFalse);
if (_output case final output?) {
await tester.runAsync(() async {
- await File('$output/creature-counts-native.json').writeAsString(jsonEncode(state));
+ await File('$output/creature-only-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'},
+ {'id': 'creature-only-native', 'label': 'Git branches | creature'},
]));
});
}
} 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));
+ final slot = find.byKey(const ValueKey('daemon-slot'));
+ final cell = workspaceBarCellSizeOf(tester.element(slot));
+ expect(find.descendant(of: slot, matching: find.byType(Text)), findsOneWidget);
+ expect(tester.getRect(slot).width, cell.width * 10);
+ expect(tester.getRect(slot).right, lessThanOrEqualTo(width));
}
await tester.pumpWidget(const SizedBox());
await tester.pump(const Duration(seconds: 11));
diff --git a/desktop/test/daemon_workspace_test.dart b/desktop/test/daemon_workspace_test.dart
index 51163bafa..3bd720334 100644
--- a/desktop/test/daemon_workspace_test.dart
+++ b/desktop/test/daemon_workspace_test.dart
@@ -767,8 +767,8 @@ void main() {
await unmount(tester);
});
- testWidgets('finished turns are labeled after the creature, cleared when you '
- 'look; Quiet and Motion are switches in the panel', (tester) async {
+ testWidgets('finished turns keep the creature alone and still in the bar; '
+ 'Quiet and Motion are switches in the panel', (tester) async {
app.stateOf('m')!
..nodeOnline = true
..connectionStatus = ConnectionStatus.connected;
@@ -777,6 +777,7 @@ void main() {
app.adoptSessionForTest(terminal('a0', []));
app.adoptSessionForTest(terminal('a1', []));
await tester.pump();
+ final beforeTurns = tester.getRect(slot);
// a1 is in front: its turn is seen already; a0's is not.
for (final id in ['a0', 'a1']) {
await app.handleMachineEventForTest('m', {
@@ -791,17 +792,10 @@ void main() {
await tester.pump();
final focused = app.focusedPane!.agentId;
expect(focused, isNotNull);
- expect(
- tester.widget<Text>(find.byKey(const ValueKey('daemon-slot-tally'))).data,
- '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(tester.getRect(slot), beforeTurns,
+ reason: 'finished turns do not take more focus-bar space');
+ expect(find.descendant(of: slot, matching: find.byType(Text)), findsOneWidget,
+ reason: 'only the creature is drawn, without labels or counts');
expect(find.byKey(const ValueKey('daemon-voice')), findsNothing);
final glyphTarget = find.byKey(const ValueKey('daemon-slot-glyph'));
final beforeHover = tester.getRect(glyphTarget);
@@ -812,13 +806,13 @@ void main() {
await tester.pump();
expect(find.byKey(const ValueKey('daemon-slot-tally')), findsNothing);
expect(tester.getRect(glyphTarget), beforeHover,
- reason: 'reading a count must not move the creature away from the click');
+ reason: 'hover must not move the creature away from the click');
await tester.tapAt(beforeHover.center);
await tester.pump();
await mouse.moveTo(Offset.zero);
await tester.pump();
- expect(tester.getRect(glyphTarget).left, greaterThan(beforeHover.left),
- reason: 'the unused count space is released after the pointer leaves');
+ expect(tester.getRect(glyphTarget), beforeHover,
+ reason: 'leaving the creature keeps the same fixed slot');
expect(find.byKey(const ValueKey('daemon-slot-tally')), findsNothing);
// The switches are on the settings tab: 4.
await key(tester, LogicalKeyboardKey.digit4);
@@ -902,11 +896,8 @@ void main() {
),
);
await tester.pump();
- expect(
- tester.widget<Text>(find.byKey(const ValueKey('daemon-slot-tally'))).data,
- '1 egg',
- reason: 'an egg waits beside the slot until it is opened',
- );
+ expect(find.descendant(of: slot, matching: find.byType(Text)), findsOneWidget,
+ reason: 'additional eggs wait in the panel, without a bar count');
await tester.tap(slot);
await tester.pump();
await tester.tap(find.byKey(const ValueKey('daemon-egg:turn')));
@@ -924,7 +915,7 @@ void main() {
await unmount(tester);
});
- testWidgets('native hears the ten cells and the tally', (tester) async {
+ testWidgets('native hears only the ten cells, without count labels', (tester) async {
final states = <Map>[];
const channel = MethodChannel('harness/swarm_tabs');
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (
@@ -956,7 +947,9 @@ void main() {
);
await tester.pump();
expect(states.last['cell'], '* (o o) ');
- expect(states.last['tally'], '1 egg');
+ expect(states.last.containsKey('tally'), isFalse);
+ expect(states.last.containsKey('tallyCells'), isFalse);
+ expect(states.last.containsKey('tallyColor'), isFalse);
expect(states.last['patch'], isNull, reason: 'a dark theme');
await unmount(tester);
});
@@ -1252,12 +1245,8 @@ void main() {
],
),
);
- expect(
- tester
- .widget<Text>(find.byKey(const ValueKey('daemon-slot-tally')))
- .data,
- '3 done',
- );
+ expect(find.descendant(of: slot, matching: find.byType(Text)), findsOneWidget,
+ reason: 'remote completions do not add a focus-bar count');
expect(glyph(tester), '(o o)', reason: 'asleep is never a failure');
// It acted within rules: drawn like done.
await frame(tester, 'daemon_say', {
diff --git a/desktop/test/daemons/daemon_face_test.dart b/desktop/test/daemons/daemon_face_test.dart
index f0b419451..03d8bd16f 100644
--- a/desktop/test/daemons/daemon_face_test.dart
+++ b/desktop/test/daemons/daemon_face_test.dart
@@ -1,5 +1,5 @@
// The daemon's face: moods in the README's order, blinks only as answers,
-// work frames stepped by agent events, the tally beside the slot, and the
+// work frames stepped by agent events, activity details, and the
// interruption rules for its one line. Every test runs in fake time and ends
// with no timer left: nothing runs on its own.
import 'dart:convert';
@@ -129,7 +129,7 @@ void main() {
await tester.pump();
expect(face.visible, isTrue);
expect(face.glyph, r'\_( )_/');
- expect(face.tally, '', reason: 'before the first hatch the slot is the egg');
+ expect(face.cell.length, 10, reason: 'the first egg uses the same fixed slot');
});
testWidgets('moods follow the README precedence', (tester) async {
@@ -258,15 +258,15 @@ void main() {
await settle(tester);
});
- testWidgets('a finished turn: ack blink, done for 3 s, a labeled count by the '
- 'slot and no line', (tester) async {
+ testWidgets('a finished turn: ack blink, done for 3 s, activity details '
+ 'and no line', (tester) async {
await mount(tester);
face.sync(const DaemonWatch(turns: {'m': 4}));
expect(face.mood, DaemonMood.idle, reason: 'a first count is a baseline');
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 done');
+ expect(face.doneCount, 1);
expect(face.lid, isNull);
await pass(tester, const Duration(milliseconds: 170));
expect(face.lid, '-');
@@ -277,10 +277,10 @@ 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 done', reason: 'every finish counts');
+ expect(face.doneCount, 3, reason: 'every finish counts');
expect(face.detail, contains('3 finished since you looked'));
face.seen();
- expect(face.tally, '', reason: 'cleared when you look');
+ expect(face.doneCount, 0, reason: 'cleared when you look');
await pass(tester, const Duration(seconds: 20));
face.sync(const DaemonWatch(turns: {'m': 8}));
expect(face.mood, DaemonMood.done);
@@ -303,7 +303,7 @@ void main() {
focus: 'm/a1',
),
);
- expect(face.tally, '1 done', reason: 'only the one you were not looking at');
+ expect(face.doneCount, 1, reason: 'only the one you were not looking at');
face.sync(
const DaemonWatch(
turns: {'m': 2},
@@ -680,13 +680,13 @@ 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.eggsWaiting, 1);
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.eggsWaiting, 1, reason: 'the egg still waits');
await zoo.hatch(zoo.zoo.eggs.single.id);
- expect(face.tally, '', reason: 'opened');
+ expect(face.eggsWaiting, 0, reason: 'opened');
await pass(tester, const Duration(seconds: 6));
});
@@ -901,7 +901,7 @@ void main() {
await settle(tester);
});
- testWidgets('completed turns and unhatched eggs have distinct labels', (
+ testWidgets('activity details and waiting eggs keep the same ten-cell sprite', (
tester,
) async {
await mount(
@@ -917,25 +917,22 @@ void main() {
),
);
face.sync(const DaemonWatch(doneCount: 1));
- expect(face.tally, '1 done, 2 eggs');
- face.setPointerInside(true);
+ final cell = face.cell;
+ expect(cell.length, 10);
+ expect(face.doneCount, 1);
+ expect(face.eggsWaiting, 2);
face.sync(const DaemonWatch(doneCount: 1234));
- expect(face.tally, '999+ done, 2 eggs');
- final heldCells = face.tallyCells;
+ expect(face.cell, cell);
expect(face.tooltip, contains('1234'));
expect(face.detail, contains('1234 finished'));
face.seen();
expect(
- face.tally,
- '2 eggs',
+ face.eggsWaiting,
+ 2,
reason: 'looking clears work, never unhatched eggs',
);
- expect(face.tallyCells, heldCells, reason: 'hover keeps the click target still');
- face.setPointerInside(false);
- expect(face.tallyCells, '2 eggs'.length);
- face.setPointerInside(true);
- zoo.bind(null);
- expect(face.tallyCells, 0, reason: 'off reserves no space');
+ expect(face.doneCount, 0);
+ expect(face.cell, cell);
await settle(tester);
});
@@ -950,10 +947,10 @@ void main() {
doneLast: ['api@office finished: tests pass.'],
),
);
- expect(face.tally, '3 done');
+ expect(face.doneCount, 3);
expect(face.tooltip, contains('api@office finished: tests pass.'));
face.seen();
- expect(face.tally, '');
+ expect(face.doneCount, 0);
expect(told, 1);
face.seen();
expect(told, 1, reason: 'nothing left to clear');
@@ -962,11 +959,11 @@ 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 done');
+ expect(face.doneCount, 2);
await pass(tester, const Duration(seconds: 3));
- expect(face.tally, '2 done');
+ expect(face.doneCount, 2);
await pass(tester, const Duration(seconds: 2));
- expect(face.tally, '');
+ expect(face.doneCount, 0);
expect(told, 2);
await settle(tester);
});
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index a858e9dd9..eb342b4d5 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -398,8 +398,7 @@ private extension SwarmTabStrip {
daemonButton.mouseEntered(with: pointer)
daemonButton.mouseExited(with: pointer)
daemonButton.mouseEntered(with: pointer)
- try checkTitlebar(events == ["daemonLook", "daemonLeave", "daemonLook"],
- "Each hover entry emits one look and each exit releases the held count width")
+ try checkTitlebar(events == ["daemonLook", "daemonLook"], "Each hover entry emits one look")
daemonButton.mouseExited(with: pointer)
// Voice: tmux's message line replaces the status, and nothing moves.
daemon["voice"] = "pip: two agents idle. nothing needs you."
@@ -500,7 +499,7 @@ private extension SwarmTabStrip {
try checkTitlebar(voiceLabel.isHidden && !contextButton.isHidden && !pullRequestButton.isHidden &&
!focusedModelButton.isHidden && unmoved(),
"Silence restores the status exactly where it was")
- // The ten cells as Flutter drew them, the tally beside them, the grue's patch.
+ // The ten cells as Flutter drew them and the grue's patch. No count labels.
let cellWidth = ceil(workspaceBarTextWidth("m", font: daemonButton.font!))
daemon["glyph"] = "[o o]"
daemon["cell"] = " [o o] "
@@ -515,48 +514,18 @@ private extension SwarmTabStrip {
daemon["cell"] = "* [o o] "
updateDaemon(daemon)
try checkTitlebar(daemonButton.cells.hasPrefix("*") && unmoved(), "A shiny daemon's * sits in the gutter")
+ let spriteOnly = daemonButton.renderedPixels()
+ // Obsolete count fields cannot widen the slot or draw extra labels.
daemon["tally"] = "3 done, 1 egg"
- daemon["foreground"] = 0xffffffff
- daemon["tallyColor"] = 0xff808080
- updateDaemon(daemon)
- 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 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")
- let countedFrame = daemonButton.frame
daemon["tallyCells"] = 13
- daemon["tally"] = "1 egg"
- updateDaemon(daemon)
- try checkTitlebar(daemonButton.frame == countedFrame,
- "Clearing done on hover preserves the native creature's click target")
- events.removeAll()
- daemonButton.mouseExited(with: pointer)
- try checkTitlebar(events == ["daemonLeave"], "Pointer exit lets Flutter release the held count width")
- daemon["tallyCells"] = nil
- updateDaemon(daemon)
- try checkTitlebar(daemonButton.frame.width < countedFrame.width,
- "The count's empty space is released when hover ends")
- 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"
+ daemon["tallyColor"] = 0xff808080
updateDaemon(daemon)
- try checkTitlebar(daemonButton.tally.isEmpty && daemonButton.frame == daemonFrame,
- "A tally that is not short printable ASCII draws nothing")
+ try checkTitlebar(abs(daemonButton.frame.width - cellWidth * 10) < 0.5 && unmoved() &&
+ daemonButton.renderedPixels() == spriteOnly,
+ "Only the creature occupies the native focus bar, without count labels or reserved space")
daemon["tally"] = nil
+ daemon["tallyCells"] = nil
+ daemon["tallyColor"] = nil
daemon["cell"] = " . . "
daemon["patch"] = 0xff000000
updateDaemon(daemon)
@@ -588,8 +557,8 @@ private extension SwarmTabStrip {
daemonButton.performClick(nil)
daemonButton.mouseEntered(with: pointer)
daemonButton.mouseExited(with: pointer)
- try checkTitlebar(events == ["daemonLeave"] && !daemonButton.isEnabled,
- "A modal disables the daemon's click and look but still releases held width on exit")
+ try checkTitlebar(events.isEmpty && !daemonButton.isEnabled,
+ "A modal disables the daemon's click and look")
update([:])
try checkTitlebar(daemonButton.isHidden && !daemonButton.isEnabled && voiceLabel.isHidden,
"Workspace teardown hides the daemon")
@@ -1025,10 +994,9 @@ private extension SwarmTabStrip {
let beforeLook = messenger.calls.count, pendingReplies = messenger.replies.count
daemonButton.mouseEntered(with: hover)
daemonButton.mouseExited(with: hover)
- try checkTitlebar(messenger.calls.count == beforeLook + 2 &&
- messenger.calls.suffix(2).map(\.method) == ["daemonLook", "daemonLeave"] &&
+ try checkTitlebar(messenger.calls.count == beforeLook + 1 && messenger.calls.last?.method == "daemonLook" &&
messenger.replies.count == pendingReplies && window.firstResponder === window.contentInput,
- "Hovering the daemon sends entry and exit without moving keyboard focus")
+ "Hovering the daemon sends one look and never moves keyboard focus")
updateDaemon([:])
let current = tabs[0].accessibilityChildren()!.first as! NSButton
window.makeFirstResponder(current)