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 agent attention in the desktop app: pane frames, a fleet overview and a boot logo

bubu-dudu56deae6cb9a3
diff --git a/desktop/design/attention-motion.md b/desktop/design/attention-motion.md
new file mode 100644
index 000000000..7f69e0989
--- /dev/null
+++ b/desktop/design/attention-motion.md
@@ -0,0 +1,56 @@
+# Attention motion and branding
+
+The pane frame, the spend ring, the fleet overview and the boot splash share one visual language.
+They were designed and first built by Fred Nix ([@nixfred](https://github.com/nixfred)) in his fork,
+[github.com/nixfred/openharness](https://github.com/nixfred/openharness) (MIT). His rule: a lot of
+graphics are welcome, but never a graphic that carries no function. Every ring, arc or glow here
+answers a question a person has at that moment; where a screen is only text, it stays text.
+
+## The language
+
+- **One ring per agent, everywhere.** Its colour and motion are the agent's attention state, as the
+ daemon reports it (`cli/src/lib/attention.ts`, the local `attention` frame): working, waiting on
+ you, needs permission, failed, done (unreviewed), idle, offline.
+- **Arcs are quantities.** Spend runs from 0 to 100 percent of a cap, turns amber at 80 percent and
+ holds red at the cap. Never a bare number where an arc can be read.
+- **Glow is urgency.** Only what needs a person next glows.
+- **Scanlines and grain** only on idle or transition screens, at 6 to 10 percent, never over text.
+- **Colour is never the only signal.** Every state also has a glyph (`~ ? ! x * - .`) and a word.
+- **Motion never moves the layout.** Every painter draws over or around its child at the child's
+ size. Every animation sits behind one reduced-motion switch (`Motion` in `lib/fleet/neon.dart`):
+ the platform's setting or `HARNESS_REDUCED_MOTION=1`. Loops stop while the window is unfocused
+ and whenever nothing is live.
+- **Neon follows the palette.** Accent comes from the app palette; with the Omarchy palette chosen,
+ yellow, red and green come from the Omarchy theme file when they still read as those colours.
+
+## Surfaces
+
+- **Pane frame** (`lib/widgets/attention_glow.dart`): working sweeps an accent comet around the border
+ (2.4 s a lap), waiting breathes yellow, permission and failed pulse red with a scan band down the
+ side edges (inside the border, never over text; failed opens with a double flash), done draws its
+ border once in green, then holds. Colours cross-fade over 280 ms. Idle and offline draw nothing.
+- **Spend ring** (`lib/fleet/spend_ring.dart`): rings the engine mark in the pane header once a
+ per-agent cap is set (`harness spend set`). While the agent waits on you, the mark becomes your
+ avatar inside a ring in the state colour.
+- **Fleet overview** (`lib/fleet/`, command bar "Fleet overview" or Ctrl+Shift+G): a hub, one hexagon
+ per machine, agents as rings around it. Agents orbit only while one works there; packets flow out
+ along a link while work runs and back in the state colour while an agent there waits on you.
+ Click an agent to open it.
+- **Boot splash** (`lib/branding/boot_splash.dart`): off by default. With a boot logo chosen in
+ Settings ▸ Appearance it lights up once on a cold launch, 1.5 s, skippable by a click or any key;
+ reduced motion shows a still logo. `HARNESS_NO_SPLASH=1` turns it off regardless.
+
+## Settings keys (`state.json`, written by Settings ▸ Appearance)
+
+| Key | Values | Default |
+|---|---|---|
+| `brand_boot_logo` | `omarchy`, `harness`, `custom`, `none` | unset: no splash |
+| `brand_boot_logo_path` | copy of the chosen SVG or PNG under `~/.harness/desktop-app-v2/brand/` | unset |
+| `brand_avatar` | `generic`, `initials`, `system`, `custom` | `generic` (a neutral person glyph) |
+| `brand_avatar_path` | cached copy of the chosen image under the same `brand/` folder | unset |
+| `brand_avatar_initials` | up to three letters, upper case | empty |
+
+Custom files must be SVG or PNG, at most 2 MB, with real content (PNG signature, `<svg` tag). A
+rejected file leaves the previous choice in place; a chosen file that has gone means no splash. The
+Omarchy logo is offered only where `/usr/share/omarchy/logo.svg` exists, and `system` (the avatar from
+`~/.face`) only where that file exists. Nothing of Omarchy's is bundled.
diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dart
index da647d110..b6dd25a6d 100644
--- a/desktop/lib/app_shell.dart
+++ b/desktop/lib/app_shell.dart
@@ -38,6 +38,7 @@ import 'widgets/new_device_notice.dart';
import 'widgets/update_notice.dart';
import 'widgets/window_chrome.dart';
import 'sharing/shared_agent_location.dart';
+import 'branding/boot_splash.dart';
import 'sharing/shared_agent_page.dart';
import 'viewer/viewer_location.dart';
import 'viewer/viewer_page.dart';
@@ -154,10 +155,14 @@ class HarnessApp extends StatelessWidget {
builder: (context, child) {
final app = child ?? const SizedBox.shrink();
final framed = frame?.call(app) ?? app;
- return _GridTokenScope(
- child: keymap == null
- ? framed
- : KeymapProvider(keymap: keymap!, child: framed),
+ // The chosen boot logo lights up once on a cold launch while the app
+ // builds underneath (lib/branding/boot_splash.dart); off by default.
+ return BootSplash(
+ child: _GridTokenScope(
+ child: keymap == null
+ ? framed
+ : KeymapProvider(keymap: keymap!, child: framed),
+ ),
);
},
home: StatsLifecycle(
diff --git a/desktop/lib/branding/boot_splash.dart b/desktop/lib/branding/boot_splash.dart
new file mode 100644
index 000000000..c65a85cd3
--- /dev/null
+++ b/desktop/lib/branding/boot_splash.dart
@@ -0,0 +1,224 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:async';
+import 'dart:io' show Platform;
+import 'dart:math' as math;
+import 'dart:ui' as ui;
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'brand_mark.dart';
+import 'brand_prefs.dart';
+import '../fleet/neon.dart';
+
+/// The cold-launch splash, off until a boot logo is chosen in Settings, Appearance (the Harness
+/// icon, the system's own Omarchy wordmark read from /usr/share/omarchy at runtime, or a picture)
+/// lights up in the theme's accent: a bloom that breathes, a shimmer band cut at the Omarchy
+/// chamfer's 45 degrees, one scan line down the screen, then a quick handoff.
+///
+/// It says one thing, "the app is up and following your theme", and gets out of the way:
+/// - the app builds and runs underneath from the first frame, so nothing waits on the splash;
+/// - 1.5 s end to end, a click or any key skips it to a 180 ms fade;
+/// - once per process: a window re-opened (the widget rebuilt) never shows it again;
+/// - reduced motion: a static, lit logo held for 0.9 s, still skippable;
+/// - boot logo "None", or `HARNESS_NO_SPLASH=1`, turns it off.
+class BootSplash extends StatefulWidget {
+ const BootSplash({super.key, required this.child, this.brand});
+
+ final Widget child;
+
+ /// Where the logo choice comes from; the app's [brandPrefsStore] when null.
+ final BrandPrefsStore? brand;
+
+ static const overlayKey = ValueKey('boot-splash');
+ static const total = Duration(milliseconds: 1500);
+ static const reducedHold = Duration(milliseconds: 900);
+
+ static bool _shown = false;
+ static final bool _disabled = const bool.fromEnvironment('HARNESS_NO_SPLASH') || (!kIsWeb && Platform.environment['HARNESS_NO_SPLASH'] == '1');
+
+ @visibleForTesting
+ static void debugReset() => _shown = false;
+
+ @override
+ State<BootSplash> createState() => BootSplashState();
+}
+
+class BootSplashState extends State<BootSplash> with SingleTickerProviderStateMixin {
+ late final AnimationController _c = AnimationController(vsync: this, duration: BootSplash.total);
+ bool _visible = false;
+ bool _animated = true;
+ Timer? _hold;
+ late ResolvedLogo _logo;
+
+ /// False under reduced motion: the logo is drawn once and held.
+ bool get animated => _animated;
+
+ @override
+ void initState() {
+ super.initState();
+ _logo = (widget.brand ?? brandPrefsStore).resolveBootLogo();
+ if (!BootSplash._shown && !BootSplash._disabled && _logo.kind != BootLogo.none) {
+ BootSplash._shown = true;
+ _visible = true;
+ HardwareKeyboard.instance.addHandler(_onKey);
+ _c.addStatusListener((s) {
+ if (s == AnimationStatus.completed) _finish();
+ });
+ }
+ }
+
+ @override
+ void didChangeDependencies() {
+ super.didChangeDependencies();
+ if (!_visible || _c.isAnimating || _hold != null) return;
+ _animated = !Motion.reducedOf(context);
+ if (_animated) {
+ _c.forward();
+ } else {
+ _c.value = 0.6; // a lit, settled frame
+ _hold = Timer(BootSplash.reducedHold, _finish);
+ }
+ }
+
+ bool _onKey(KeyEvent e) {
+ if (!_visible) return false;
+ if (e is KeyDownEvent) skip();
+ return true; // the skipping key never reaches the app underneath
+ }
+
+ /// Jump to the handoff; a no-op once it is under way.
+ void skip() {
+ if (!_visible) return;
+ _hold?.cancel();
+ if (!_animated) return _finish();
+ if (_c.value >= 0.84) return;
+ _c.animateTo(1, duration: const Duration(milliseconds: 180), curve: Curves.easeOut);
+ }
+
+ void _finish() {
+ if (!_visible) return;
+ HardwareKeyboard.instance.removeHandler(_onKey);
+ if (mounted) setState(() => _visible = false);
+ }
+
+ @override
+ void dispose() {
+ _hold?.cancel();
+ HardwareKeyboard.instance.removeHandler(_onKey);
+ _c.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ if (!_visible) return widget.child;
+ return Stack(
+ fit: StackFit.expand,
+ children: [
+ widget.child,
+ GestureDetector(
+ key: BootSplash.overlayKey,
+ behavior: HitTestBehavior.opaque,
+ onTap: skip,
+ child: RepaintBoundary(
+ child: AnimatedBuilder(animation: _c, builder: (context, _) => _frame(_c.value)),
+ ),
+ ),
+ ],
+ );
+ }
+
+ Widget _frame(double t) {
+ final neon = Neon.current();
+ double seg(double a, double b) => ((t - a) / (b - a)).clamp(0.0, 1.0);
+ final enter = Curves.easeOutCubic.transform(seg(0, 0.28));
+ final exit = Curves.easeInCubic.transform(seg(0.82, 1));
+ final breath = 0.5 - 0.5 * math.cos(seg(0.1, 0.82) * 2 * math.pi * 1.5);
+ final bloom = _animated ? enter * (0.45 + 0.4 * breath) : 0.7;
+ final shimmer = _animated ? seg(0.22, 0.7) : -1.0;
+ final scan = _animated ? seg(0.05, 0.62) : -1.0;
+ const h = 100.0;
+ BrandLogo mark(double glow) => BrandLogo(logo: _logo, accent: neon.accent, glow: glow, height: h);
+ final aspect = mark(0).aspect;
+ return Opacity(
+ opacity: 1 - exit,
+ child: ColoredBox(
+ color: neon.background,
+ child: CustomPaint(
+ painter: _SplashPainter(accent: neon.accent, scan: scan, frame: _animated ? seg(0.08, 0.5) : 1, box: Size(h * aspect + 60, h + 60)),
+ child: Center(
+ child: Transform.scale(
+ scale: (_animated ? 0.94 + 0.06 * enter : 1) + 0.05 * exit,
+ child: Opacity(
+ opacity: _animated ? enter : 1,
+ child: Stack(
+ clipBehavior: Clip.none,
+ children: [
+ // The chosen logo with its bloom breathing.
+ mark(bloom),
+ if (shimmer >= 0 && shimmer < 1)
+ Positioned.fill(
+ child: ShaderMask(
+ blendMode: BlendMode.srcATop,
+ shaderCallback: (r) => LinearGradient(
+ begin: Alignment.topLeft,
+ end: Alignment.bottomRight,
+ colors: [Colors.transparent, Colors.white.withValues(alpha: 0.85), Colors.transparent],
+ stops: [(shimmer * 1.4 - 0.25).clamp(0.0, 1.0), (shimmer * 1.4 - 0.15).clamp(0.0, 1.0), (shimmer * 1.4 - 0.05).clamp(0.0, 1.0)],
+ ).createShader(Rect.fromLTWH(0, 0, r.width, r.width)), // square rect: the band runs at 45 degrees
+ child: mark(0),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class _SplashPainter extends CustomPainter {
+ const _SplashPainter({required this.accent, required this.scan, required this.frame, required this.box});
+
+ final Size box;
+
+ final Color accent;
+ final double scan; // 0..1 down the screen, <0 when none
+ final double frame; // 0..1 how much of the chamfered frame is drawn
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ // Scanlines at 7 percent: a transition screen, and they stay off the wordmark's own pixels
+ // only by being faint (design/attention-motion.md allows them on transition screens).
+ final lines = Paint()..color = accent.withValues(alpha: 0.07);
+ for (var y = 0.0; y < size.height; y += 3) {
+ canvas.drawRect(Rect.fromLTWH(0, y, size.width, 1), lines);
+ }
+ if (scan >= 0 && scan < 1) {
+ final y = size.height * scan;
+ canvas.drawRect(
+ Rect.fromLTWH(0, y - 24, size.width, 48),
+ Paint()
+ ..shader = ui.Gradient.linear(Offset(0, y - 24), Offset(0, y + 24), [accent.withValues(alpha: 0), accent.withValues(alpha: 0.18), accent.withValues(alpha: 0)], const [0, 0.5, 1]),
+ );
+ }
+ // The chamfered frame around the wordmark draws itself, the Omarchy bevel as the border.
+ final rect = Rect.fromCenter(center: size.center(Offset.zero), width: box.width, height: box.height);
+ final metric = chamferPath(rect, 18).computeMetrics().first;
+ canvas.drawPath(
+ metric.extractPath(0, metric.length * frame),
+ Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 1.5
+ ..color = accent.withValues(alpha: 0.55),
+ );
+ }
+
+ @override
+ bool shouldRepaint(_SplashPainter old) => old.accent != accent || old.scan != scan || old.frame != frame || old.box != box;
+}
diff --git a/desktop/lib/branding/brand_mark.dart b/desktop/lib/branding/brand_mark.dart
new file mode 100644
index 000000000..ec1dffda4
--- /dev/null
+++ b/desktop/lib/branding/brand_mark.dart
@@ -0,0 +1,95 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:io';
+import 'dart:ui' as ui;
+
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+
+import 'brand_prefs.dart';
+
+/// The bundled stock Harness icon: the fallback everywhere a logo cannot be drawn.
+const harnessIconAsset = 'assets/app_icon.png';
+
+/// A boot logo with the glow treatment, whichever logo was chosen. A monochrome system
+/// wordmark (Omarchy's ships black) is tinted with the accent; a custom or stock image keeps its own
+/// colours. The glow is always the accent: a blurred silhouette behind the mark at [glow] strength.
+/// Any file that fails to load draws the Harness icon instead.
+class BrandLogo extends StatelessWidget {
+ const BrandLogo({super.key, required this.logo, required this.accent, this.glow = 0.6, this.height = 100});
+
+ final ResolvedLogo logo;
+ final Color accent;
+ final double glow;
+ final double height;
+
+ /// Width over height the logo is laid out at (Omarchy's wordmark is 1215 x 285).
+ double get aspect => logo.kind == BootLogo.omarchy ? 1215 / 285 : 1;
+
+ Widget _harness() => Image.asset(harnessIconAsset, fit: BoxFit.contain);
+
+ Widget _mark({required bool tint}) {
+ final path = logo.path;
+ final filter = tint ? ColorFilter.mode(accent, BlendMode.srcIn) : null;
+ if (logo.kind == BootLogo.harness || path == null) {
+ return tint ? ColorFiltered(colorFilter: filter!, child: _harness()) : _harness();
+ }
+ if (logo.isSvg) {
+ return SvgPicture.file(File(path), fit: BoxFit.contain, colorFilter: filter, errorBuilder: (_, _, _) => _harness());
+ }
+ final img = Image.file(File(path), fit: BoxFit.contain, errorBuilder: (_, _, _) => _harness());
+ return tint ? ColorFiltered(colorFilter: filter!, child: img) : img;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ if (logo.kind == BootLogo.none) return const SizedBox.shrink();
+ return SizedBox(
+ width: height * aspect,
+ height: height,
+ child: Stack(
+ clipBehavior: Clip.none,
+ fit: StackFit.expand,
+ children: [
+ Opacity(
+ opacity: glow.clamp(0.0, 1.0),
+ child: ImageFiltered(imageFilter: ui.ImageFilter.blur(sigmaX: 14, sigmaY: 14, tileMode: TileMode.decal), child: _mark(tint: true)),
+ ),
+ _mark(tint: logo.kind == BootLogo.omarchy),
+ ],
+ ),
+ );
+ }
+}
+
+/// The person an agent is waiting on, as a circle: their picture cropped to the circle,
+/// their initials, or a neutral glyph. Never anyone's real face by default.
+class AvatarBadge extends StatelessWidget {
+ const AvatarBadge({super.key, required this.avatar, required this.size, required this.color, required this.background});
+
+ final ResolvedAvatar avatar;
+ final double size;
+ final Color color, background;
+
+ @override
+ Widget build(BuildContext context) {
+ final generic = Icon(Icons.person_outline, size: size * 0.78, color: color);
+ final Widget inner = switch (avatar.kind) {
+ AvatarSource.initials => FittedBox(
+ child: Padding(
+ padding: const EdgeInsets.all(2),
+ child: Text(avatar.initials, style: TextStyle(fontFamily: 'monospace', fontWeight: FontWeight.w700, color: color)),
+ ),
+ ),
+ AvatarSource.system || AvatarSource.custom when avatar.path != null => avatar.path!.toLowerCase().endsWith('.svg')
+ ? SvgPicture.file(File(avatar.path!), fit: BoxFit.cover, errorBuilder: (_, _, _) => generic)
+ // Decoded at the size it is drawn (cached by Flutter's image cache), cropped to the circle.
+ : Image.file(File(avatar.path!), fit: BoxFit.cover, cacheWidth: (size * 3).round(), errorBuilder: (_, _, _) => generic),
+ _ => generic,
+ };
+ return SizedBox.square(
+ dimension: size,
+ child: ClipOval(child: ColoredBox(color: background, child: Center(child: inner))),
+ );
+ }
+}
diff --git a/desktop/lib/branding/brand_prefs.dart b/desktop/lib/branding/brand_prefs.dart
new file mode 100644
index 000000000..badb48c72
--- /dev/null
+++ b/desktop/lib/branding/brand_prefs.dart
@@ -0,0 +1,220 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:async';
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:flutter/foundation.dart';
+
+import '../core/harness_file_store.dart';
+import '../core/local_key_value_store.dart';
+
+/// What the cold-launch splash shows. [omarchy] reads the system's own wordmark at runtime
+/// (`/usr/share/omarchy/logo.svg`); nothing of Omarchy's is bundled in this repo.
+enum BootLogo { omarchy, harness, custom, none }
+
+/// What sits inside the ring of an agent that waits on you.
+enum AvatarSource { generic, initials, system, custom }
+
+@immutable
+class BrandPrefs {
+ const BrandPrefs({this.bootLogo, this.customLogoPath, this.avatar = AvatarSource.generic, this.avatarPath, this.initials = ''});
+
+ /// Null until chosen, which means no splash: a person turns it on in Settings ▸ Appearance.
+ final BootLogo? bootLogo;
+ final String? customLogoPath;
+ final AvatarSource avatar;
+ final String? avatarPath;
+ final String initials;
+
+ BrandPrefs copyWith({BootLogo? bootLogo, String? customLogoPath, AvatarSource? avatar, String? avatarPath, String? initials}) => BrandPrefs(
+ bootLogo: bootLogo ?? this.bootLogo,
+ customLogoPath: customLogoPath ?? this.customLogoPath,
+ avatar: avatar ?? this.avatar,
+ avatarPath: avatarPath ?? this.avatarPath,
+ initials: initials ?? this.initials,
+ );
+
+ @override
+ bool operator ==(Object other) =>
+ other is BrandPrefs && other.bootLogo == bootLogo && other.customLogoPath == customLogoPath && other.avatar == avatar && other.avatarPath == avatarPath && other.initials == initials;
+ @override
+ int get hashCode => Object.hash(bootLogo, customLogoPath, avatar, avatarPath, initials);
+}
+
+/// The logo the splash will actually draw, after every fallback.
+@immutable
+class ResolvedLogo {
+ const ResolvedLogo(this.kind, [this.path]);
+ final BootLogo kind;
+
+ /// A file on disk for [BootLogo.omarchy] and [BootLogo.custom]; null for the bundled Harness icon.
+ final String? path;
+ bool get isSvg => path?.toLowerCase().endsWith('.svg') ?? false;
+}
+
+@immutable
+class ResolvedAvatar {
+ const ResolvedAvatar(this.kind, {this.path, this.initials = ''});
+ final AvatarSource kind;
+ final String? path;
+ final String initials;
+}
+
+/// Boot logo and personal avatar, stored beside the other appearance settings. Keys:
+/// `brand_boot_logo`, `brand_boot_logo_path`, `brand_avatar`, `brand_avatar_path`,
+/// `brand_avatar_initials`. Picked files are validated (SVG or PNG, at most 2 MB, real content) and
+/// copied into `<data dir>/brand/`, so moving or deleting the original never breaks the app. Every
+/// read falls back: a missing file means the default, never an error.
+class BrandPrefsStore extends ValueNotifier<BrandPrefs> {
+ BrandPrefsStore({LocalKeyValueStore? storage, Directory? dataDir, this.omarchyLogoPath = '/usr/share/omarchy/logo.svg', String? systemAvatarPath})
+ : _storage = storage ?? HarnessFileStore.shared,
+ _dataDir = dataDir ?? Directory('${_home()}/.harness/desktop-app-v2/brand'),
+ systemAvatarPath = systemAvatarPath ?? '${_home()}/.face',
+ super(const BrandPrefs());
+
+ static String _home() => kIsWeb ? '' : (Platform.environment['HOME'] ?? Platform.environment['USERPROFILE'] ?? '');
+
+ static const bootLogoKey = 'brand_boot_logo';
+ static const bootLogoPathKey = 'brand_boot_logo_path';
+ static const avatarKey = 'brand_avatar';
+ static const avatarPathKey = 'brand_avatar_path';
+ static const initialsKey = 'brand_avatar_initials';
+ static const maxBytes = 2 * 1024 * 1024;
+
+ final LocalKeyValueStore _storage;
+ final Directory _dataDir;
+ final String omarchyLogoPath;
+ final String systemAvatarPath;
+
+ bool get omarchyAvailable => !kIsWeb && File(omarchyLogoPath).existsSync();
+ bool get systemAvatarAvailable => !kIsWeb && File(systemAvatarPath).existsSync();
+
+ Future<void> load() async {
+ try {
+ final saved = <String, String?>{};
+ for (final k in [bootLogoKey, bootLogoPathKey, avatarKey, avatarPathKey, initialsKey]) {
+ saved[k] = await _storage.read(k);
+ }
+ value = BrandPrefs(
+ bootLogo: BootLogo.values.where((e) => e.name == saved[bootLogoKey]).firstOrNull,
+ customLogoPath: saved[bootLogoPathKey],
+ avatar: AvatarSource.values.where((e) => e.name == saved[avatarKey]).firstOrNull ?? AvatarSource.generic,
+ avatarPath: saved[avatarPathKey],
+ initials: saved[initialsKey] ?? '',
+ );
+ } catch (_) {
+ // Unreadable settings leave the defaults in place.
+ }
+ }
+
+ ResolvedLogo resolveBootLogo() {
+ // No splash until somebody picks a logo; a picked image that has gone shows none either.
+ const fallback = ResolvedLogo(BootLogo.none);
+ switch (value.bootLogo) {
+ case null:
+ case BootLogo.none:
+ return fallback;
+ case BootLogo.harness:
+ return const ResolvedLogo(BootLogo.harness);
+ case BootLogo.omarchy:
+ return omarchyAvailable ? ResolvedLogo(BootLogo.omarchy, omarchyLogoPath) : const ResolvedLogo(BootLogo.harness);
+ case BootLogo.custom:
+ final p = value.customLogoPath;
+ return p != null && !kIsWeb && File(p).existsSync() ? ResolvedLogo(BootLogo.custom, p) : fallback;
+ }
+ }
+
+ ResolvedAvatar resolveAvatar() {
+ const generic = ResolvedAvatar(AvatarSource.generic);
+ switch (value.avatar) {
+ case AvatarSource.generic:
+ return generic;
+ case AvatarSource.initials:
+ return value.initials.isEmpty ? generic : ResolvedAvatar(AvatarSource.initials, initials: value.initials);
+ case AvatarSource.system:
+ return systemAvatarAvailable ? ResolvedAvatar(AvatarSource.system, path: systemAvatarPath) : generic;
+ case AvatarSource.custom:
+ final p = value.avatarPath;
+ return p != null && !kIsWeb && File(p).existsSync() ? ResolvedAvatar(AvatarSource.custom, path: p) : generic;
+ }
+ }
+
+ Future<void> setBootLogo(BootLogo logo) async {
+ value = value.copyWith(bootLogo: logo);
+ await _storage.write(bootLogoKey, logo.name);
+ }
+
+ /// Validates and copies [source]; returns a message for the person on failure (choice unchanged).
+ Future<String?> setCustomLogo(String source) async {
+ final copied = await _import(source, 'boot-logo');
+ if (copied.error != null) return copied.error;
+ value = value.copyWith(bootLogo: BootLogo.custom, customLogoPath: copied.path);
+ await _storage.write(bootLogoPathKey, copied.path!);
+ await _storage.write(bootLogoKey, BootLogo.custom.name);
+ return null;
+ }
+
+ Future<void> setAvatar(AvatarSource source) async {
+ value = value.copyWith(avatar: source);
+ await _storage.write(avatarKey, source.name);
+ }
+
+ /// Up to three letters, upper case. Empty goes back to the generic glyph.
+ Future<void> setInitials(String raw) async {
+ final clean = raw.replaceAll(RegExp(r'\s+'), '').toUpperCase();
+ final initials = clean.length > 3 ? clean.substring(0, 3) : clean;
+ value = value.copyWith(initials: initials, avatar: initials.isEmpty ? AvatarSource.generic : AvatarSource.initials);
+ await _storage.write(initialsKey, initials);
+ await _storage.write(avatarKey, value.avatar.name);
+ }
+
+ Future<String?> setCustomAvatar(String source) async {
+ final copied = await _import(source, 'avatar');
+ if (copied.error != null) return copied.error;
+ value = value.copyWith(avatar: AvatarSource.custom, avatarPath: copied.path);
+ await _storage.write(avatarPathKey, copied.path!);
+ await _storage.write(avatarKey, AvatarSource.custom.name);
+ return null;
+ }
+
+ /// A problem with [path] as an image, or null when it is a real SVG or PNG under [maxBytes].
+ static Future<String?> validateImage(String path) async {
+ final f = File(path);
+ if (!await f.exists()) return 'That file no longer exists.';
+ final ext = path.toLowerCase().split('.').last;
+ if (ext != 'svg' && ext != 'png') return 'Choose an SVG or PNG image.';
+ final size = await f.length();
+ if (size > maxBytes) return 'That image is larger than 2 MB.';
+ final head = await f.openRead(0, 512).fold<List<int>>([], (a, b) => a..addAll(b));
+ final ok = ext == 'png'
+ ? head.length >= 8 && listEquals(head.sublist(0, 8), const [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])
+ : utf8.decode(head, allowMalformed: true).contains('<svg');
+ return ok ? null : 'That is not a valid ${ext.toUpperCase()} file.';
+ }
+
+ Future<({String? path, String? error})> _import(String source, String name) async {
+ try {
+ final problem = await validateImage(source);
+ if (problem != null) return (path: null, error: problem);
+ await _dataDir.create(recursive: true);
+ final ext = source.toLowerCase().split('.').last;
+ // A fresh name each time, so a cached decode of the previous image is never shown again.
+ final dest = File('${_dataDir.path}/$name-${DateTime.now().microsecondsSinceEpoch}.$ext');
+ await File(source).copy(dest.path);
+ for (final old in _dataDir.listSync().whereType<File>()) {
+ if (old.path != dest.path && old.uri.pathSegments.last.startsWith('$name-')) {
+ try {
+ old.deleteSync();
+ } catch (_) {}
+ }
+ }
+ return (path: dest.path, error: null);
+ } catch (e) {
+ return (path: null, error: 'Could not use that file: $e');
+ }
+ }
+}
+
+/// The app's one instance, loaded in `loadPersistedSettings()`.
+final brandPrefsStore = BrandPrefsStore();
diff --git a/desktop/lib/branding/brand_section.dart b/desktop/lib/branding/brand_section.dart
new file mode 100644
index 000000000..dbec5f734
--- /dev/null
+++ b/desktop/lib/branding/brand_section.dart
@@ -0,0 +1,154 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:async';
+
+import 'package:file_selector/file_selector.dart';
+import 'package:flutter/material.dart';
+
+import '../shared/theme/app_theme.dart' as grid;
+import '../shared/widgets/section_heading.dart';
+import 'brand_mark.dart';
+import 'brand_prefs.dart';
+import '../fleet/neon.dart';
+
+/// Picks an image file; replaced in tests.
+typedef ImagePicker = Future<String?> Function();
+
+Future<String?> pickSvgOrPng() async {
+ final file = await openFile(acceptedTypeGroups: const [XTypeGroup(label: 'SVG or PNG image', extensions: ['svg', 'png'])]);
+ return file?.path;
+}
+
+/// Settings, Appearance: the boot logo and the avatar shown to agents waiting on you.
+class BrandSection extends StatefulWidget {
+ const BrandSection({super.key, this.store, this.pick = pickSvgOrPng});
+
+ final BrandPrefsStore? store;
+ final ImagePicker pick;
+
+ @override
+ State<BrandSection> createState() => _BrandSectionState();
+}
+
+class _BrandSectionState extends State<BrandSection> {
+ BrandPrefsStore get _store => widget.store ?? brandPrefsStore;
+ String? _logoError, _avatarError;
+ late final _initials = TextEditingController(text: _store.value.initials);
+
+ @override
+ void dispose() {
+ _initials.dispose();
+ super.dispose();
+ }
+
+ Future<void> _pickLogo() async {
+ final path = await widget.pick();
+ if (path == null) return;
+ final error = await _store.setCustomLogo(path);
+ if (mounted) setState(() => _logoError = error);
+ }
+
+ Future<void> _pickAvatar() async {
+ final path = await widget.pick();
+ if (path == null) return;
+ final error = await _store.setCustomAvatar(path);
+ if (mounted) setState(() => _avatarError = error);
+ }
+
+ Widget _chip(String label, bool selected, VoidCallback? onTap, {String? tooltip}) {
+ final chip = ChoiceChip(label: Text(label), selected: selected, onSelected: onTap == null ? null : (_) => onTap());
+ return tooltip == null ? chip : Tooltip(message: tooltip, child: chip);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ final neon = Neon.current();
+ final muted = TextStyle(fontSize: 12, color: neon.foreground.withValues(alpha: 0.6));
+ final error = TextStyle(fontSize: 12, color: neon.red);
+ return ValueListenableBuilder<BrandPrefs>(
+ valueListenable: _store,
+ builder: (context, prefs, _) {
+ final logo = _store.resolveBootLogo();
+ final avatar = _store.resolveAvatar();
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SectionHeading('Boot logo'),
+ const SizedBox(height: 6),
+ Text('Off by default. Pick a logo to show it for about a second and a half when the app starts; click or press any key to skip it.', style: muted),
+ const SizedBox(height: 12),
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Wrap(spacing: 8, runSpacing: 8, children: [
+ // Offered only where Omarchy is installed: its wordmark is read from the system.
+ if (_store.omarchyAvailable)
+ _chip('Omarchy', logo.kind == BootLogo.omarchy, () => unawaited(_store.setBootLogo(BootLogo.omarchy))),
+ _chip('Harness', logo.kind == BootLogo.harness, () => unawaited(_store.setBootLogo(BootLogo.harness))),
+ _chip('Custom…', logo.kind == BootLogo.custom, () => unawaited(_pickLogo()), tooltip: 'An SVG or PNG, up to 2 MB'),
+ _chip('None', logo.kind == BootLogo.none, () => unawaited(_store.setBootLogo(BootLogo.none))),
+ ]),
+ ),
+ const SizedBox(width: 16),
+ // Preview with the same glow the splash uses.
+ Container(
+ width: 200,
+ height: 72,
+ color: neon.background,
+ alignment: Alignment.center,
+ child: logo.kind == BootLogo.none
+ ? Text('no splash', style: muted)
+ : FittedBox(child: Padding(padding: const EdgeInsets.all(14), child: BrandLogo(logo: logo, accent: neon.accent, height: 44))),
+ ),
+ ],
+ ),
+ if (_logoError != null) Padding(padding: const EdgeInsets.only(top: 8), child: Text(_logoError!, style: error)),
+ const SizedBox(height: 24),
+ const SectionHeading('Your avatar'),
+ const SizedBox(height: 6),
+ Text('Drawn inside the ring of any agent that is waiting on you.', style: muted),
+ const SizedBox(height: 12),
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Wrap(spacing: 8, runSpacing: 8, crossAxisAlignment: WrapCrossAlignment.center, children: [
+ _chip('Generic', avatar.kind == AvatarSource.generic, () => unawaited(_store.setAvatar(AvatarSource.generic))),
+ _chip('Initials', prefs.avatar == AvatarSource.initials, () => unawaited(_store.setAvatar(AvatarSource.initials))),
+ if (_store.systemAvatarAvailable)
+ _chip('System avatar', avatar.kind == AvatarSource.system, () => unawaited(_store.setAvatar(AvatarSource.system)), tooltip: 'Use ${_store.systemAvatarPath}'),
+ _chip('Custom image…', avatar.kind == AvatarSource.custom, () => unawaited(_pickAvatar()), tooltip: 'An SVG or PNG, up to 2 MB, cropped to a circle'),
+ if (prefs.avatar == AvatarSource.initials)
+ SizedBox(
+ width: 90,
+ child: TextField(
+ controller: _initials,
+ maxLength: 3,
+ decoration: const InputDecoration(isDense: true, counterText: '', hintText: 'AB'),
+ onChanged: (v) => unawaited(_store.setInitials(v)),
+ ),
+ ),
+ ]),
+ ),
+ const SizedBox(width: 16),
+ SizedBox(
+ width: 200,
+ child: Center(
+ child: DecoratedBox(
+ decoration: BoxDecoration(shape: BoxShape.circle, border: Border.all(color: neon.yellow, width: 2)),
+ child: Padding(padding: const EdgeInsets.all(3), child: AvatarBadge(avatar: avatar, size: 40, color: neon.yellow, background: neon.background)),
+ ),
+ ),
+ ),
+ ],
+ ),
+ if (_avatarError != null) Padding(padding: const EdgeInsets.only(top: 8), child: Text(_avatarError!, style: error)),
+ const SizedBox(height: 24),
+ ],
+ );
+ },
+ );
+ }
+}
diff --git a/desktop/lib/core/startup.dart b/desktop/lib/core/startup.dart
index 352cf9fdd..dc7dc2fdb 100644
--- a/desktop/lib/core/startup.dart
+++ b/desktop/lib/core/startup.dart
@@ -1,3 +1,4 @@
+import '../branding/brand_prefs.dart';
import '../shared/theme/appearance_prefs_store.dart';
import '../stats/harness_stats.dart';
import '../terminal/terminal_font_store.dart';
@@ -25,6 +26,7 @@ Future<void> loadPersistedSettings({
AlertSoundStore? alertSounds,
ScreenAlertStore? screenAlerts,
DesktopNotificationStore? desktopNotifications,
+ BrandPrefsStore? brand,
}) async {
// Independent stores may load together, but all must finish before runApp.
// Font and appearance share a serialized file store; each reads its related
@@ -46,5 +48,7 @@ Future<void> loadPersistedSettings({
(alertSounds ?? alertSoundStore).load(),
(screenAlerts ?? screenAlertStore).load(),
(desktopNotifications ?? desktopNotificationStore).load(),
+ // Before the first frame, so the boot splash knows whether, and which logo, to draw.
+ (brand ?? brandPrefsStore).load(),
]);
}
diff --git a/desktop/lib/desktop_workspace.dart b/desktop/lib/desktop_workspace.dart
index 8320c2502..9d9f5da32 100644
--- a/desktop/lib/desktop_workspace.dart
+++ b/desktop/lib/desktop_workspace.dart
@@ -1,12 +1,15 @@
import 'package:flutter/widgets.dart';
+import 'fleet/fleet_overview.dart';
import 'screens/swarm_screen.dart';
import 'state/app_state.dart';
/// The signed-in screen of a native build. A browser build compiles
/// `web/web_entry.dart` in its place (the conditional import in `main.dart`),
-/// so native code never reaches `lib/web/`.
-Widget authenticatedWorkspace(AppNotifier app) => SwarmScreen(notifier: app);
+/// so native code never reaches `lib/web/`. The fleet overview (Ctrl+Shift+G)
+/// wraps the native workspace only.
+Widget authenticatedWorkspace(AppNotifier app) =>
+ FleetOverviewHost(app: app, child: SwarmScreen(notifier: app));
/// A native build draws nothing around its screens.
Widget appFrame(Widget app) => app;
diff --git a/desktop/lib/fleet/fleet_graph.dart b/desktop/lib/fleet/fleet_graph.dart
new file mode 100644
index 000000000..b255a168e
--- /dev/null
+++ b/desktop/lib/fleet/fleet_graph.dart
@@ -0,0 +1,390 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:math' as math;
+
+import 'package:flutter/material.dart';
+
+import '../state/attention_state.dart';
+import '../branding/brand_mark.dart';
+import '../branding/brand_prefs.dart';
+import 'neon.dart';
+
+/// One agent as the fleet graph draws it.
+@immutable
+class FleetAgent {
+ const FleetAgent({required this.id, required this.name, required this.state, this.lane, this.spendFraction});
+ final String id, name;
+ final AgentAttention state;
+ final String? lane;
+ final double? spendFraction;
+
+ @override
+ bool operator ==(Object other) => other is FleetAgent && other.id == id && other.name == name && other.state == state && other.lane == lane && other.spendFraction == spendFraction;
+ @override
+ int get hashCode => Object.hash(id, name, state, lane, spendFraction);
+}
+
+/// One machine and its agents.
+@immutable
+class FleetMachine {
+ const FleetMachine({required this.id, required this.name, required this.connected, this.local = false, this.agents = const []});
+ final String id, name;
+ final bool connected, local;
+ final List<FleetAgent> agents;
+
+ @override
+ bool operator ==(Object other) =>
+ other is FleetMachine && other.id == id && other.name == name && other.connected == connected && other.local == local && _listEq(other.agents, agents);
+ @override
+ int get hashCode => Object.hash(id, name, connected, local, Object.hashAll(agents));
+}
+
+bool _listEq<T>(List<T> a, List<T> b) {
+ if (a.length != b.length) return false;
+ for (var i = 0; i < a.length; i++) {
+ if (a[i] != b[i]) return false;
+ }
+ return true;
+}
+
+const _priority = [AgentAttention.permission, AgentAttention.waiting, AgentAttention.failed, AgentAttention.done, AgentAttention.working, AgentAttention.idle, AgentAttention.offline];
+
+bool _live(AgentAttention s) => s == AgentAttention.working || s == AgentAttention.waiting || s == AgentAttention.permission || s == AgentAttention.failed;
+
+/// Where every node sits at phase 0. Machines on an ellipse around the hub, agents on a small orbit
+/// around their machine; all inside the canvas whatever its size.
+class FleetLayout {
+ FleetLayout._(this.hub, this.machines, this.agents, this.machineRadius, this.orbit);
+
+ final Offset hub;
+ final Map<String, Offset> machines;
+ final Map<String, Offset> agents;
+ final double machineRadius, orbit;
+
+ static FleetLayout compute(Size size, List<FleetMachine> fleet, {double phase = 0}) {
+ final hub = size.center(Offset.zero);
+ final n = math.max(1, fleet.length);
+ final most = fleet.fold<int>(1, (m, f) => math.max(m, f.agents.length));
+ final machineRadius = (math.min(size.width, size.height) * 0.07).clamp(14.0, 30.0);
+ final orbit = machineRadius + (most > 6 ? 30.0 : 24.0);
+ final margin = orbit + 12;
+ final rx = math.max(0.0, size.width / 2 - margin), ry = math.max(0.0, size.height / 2 - margin - 10);
+ final machines = <String, Offset>{};
+ final agents = <String, Offset>{};
+ for (var i = 0; i < fleet.length; i++) {
+ final m = fleet[i];
+ final a = -math.pi / 2 + 2 * math.pi * i / n;
+ final c = fleet.length == 1 ? hub + Offset(0, ry * 0.35) : hub + Offset(rx * math.cos(a), ry * math.sin(a));
+ machines[m.id] = c;
+ final k = m.agents.length;
+ // Busy machines turn: the orbit's motion is the machine's activity.
+ final spin = m.agents.any((g) => g.state == AgentAttention.working) ? phase * 2 * math.pi : 0.0;
+ for (var j = 0; j < k; j++) {
+ final b = -math.pi / 2 + 2 * math.pi * j / k + spin;
+ agents[m.agents[j].id] = c + Offset(orbit * math.cos(b), orbit * math.sin(b));
+ }
+ }
+ return FleetLayout._(hub, machines, agents, machineRadius, orbit);
+ }
+}
+
+/// The fleet at a glance. The hub is this window; each hexagon a machine (dashed link when
+/// it is not connected); each ring an agent in its attention colour and glyph.
+///
+/// Motion carries the state, nothing else moves:
+/// - a machine's agents orbit it only while one of them is working;
+/// - packets flow hub to machine along a link while work runs there, and machine to hub, in the
+/// state colour, while an agent there waits on you or needs permission (direction = who waits on whom);
+/// - waiting rings breathe, permission and failed rings pulse, working rings carry a sweep arc.
+/// The whole graph stops (one static frame) when nothing is live, the window is unfocused, or
+/// reduced motion is on. Tapping an agent calls [onAgentTap].
+class FleetGraph extends StatefulWidget {
+ const FleetGraph({super.key, required this.machines, this.onAgentTap, this.hubLabel = 'this app', this.brand});
+
+ /// The avatar drawn inside the ring of an agent waiting on you; the app's store when null.
+ final BrandPrefsStore? brand;
+
+ final List<FleetMachine> machines;
+ final ValueChanged<String>? onAgentTap;
+ final String hubLabel;
+
+ @override
+ State<FleetGraph> createState() => _FleetGraphState();
+}
+
+class _FleetGraphState extends State<FleetGraph> with SingleTickerProviderStateMixin {
+ late final AnimationController _clock = AnimationController(vsync: this, duration: const Duration(seconds: 12));
+ bool _reduced = false;
+ Size _size = Size.zero;
+
+ bool get _anyLive => widget.machines.any((m) => m.agents.any((a) => _live(a.state)));
+
+ @override
+ void initState() {
+ super.initState();
+ WindowFocus.instance.addListener(_sync);
+ }
+
+ @override
+ void didChangeDependencies() {
+ super.didChangeDependencies();
+ _reduced = Motion.reducedOf(context);
+ _sync();
+ }
+
+ @override
+ void didUpdateWidget(FleetGraph old) {
+ super.didUpdateWidget(old);
+ _sync();
+ }
+
+ void _sync() {
+ final run = _anyLive && !_reduced && WindowFocus.instance.value;
+ if (run && !_clock.isAnimating) {
+ _clock.repeat();
+ } else if (!run && _clock.isAnimating) {
+ _clock.stop();
+ }
+ }
+
+ @override
+ void dispose() {
+ WindowFocus.instance.removeListener(_sync);
+ _clock.dispose();
+ super.dispose();
+ }
+
+ void _tap(TapUpDetails d) {
+ final cb = widget.onAgentTap;
+ if (cb == null) return;
+ final l = FleetLayout.compute(_size, widget.machines, phase: _clock.value);
+ String? best;
+ var bestD = 18.0;
+ l.agents.forEach((id, p) {
+ final dd = (p - d.localPosition).distance;
+ if (dd < bestD) {
+ bestD = dd;
+ best = id;
+ }
+ });
+ if (best != null) cb(best!);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final neon = Neon.current();
+ final all = [for (final m in widget.machines) ...m.agents];
+ final counts = <AgentAttention, int>{};
+ for (final a in all) {
+ counts[a.state] = (counts[a.state] ?? 0) + 1;
+ }
+ final top = _priority.where((s) => (counts[s] ?? 0) > 0).firstOrNull;
+ final mono = TextStyle(fontFamily: 'monospace', fontSize: 12, color: neon.foreground.withValues(alpha: 0.85));
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(12, 8, 12, 4),
+ child: Row(
+ children: [
+ if (top != null)
+ Text('${attentionGlyph(top)} ${counts[top]} ${attentionLabel(top)}', style: mono.copyWith(color: neon.of(top), fontWeight: FontWeight.w700))
+ else
+ Text('- 0 no agents', style: mono),
+ const Spacer(),
+ // Legend: glyph and word for every state on screen, so colour is never the only signal.
+ for (final s in _priority)
+ if (s != top && (counts[s] ?? 0) > 0)
+ Padding(
+ padding: const EdgeInsets.only(left: 12),
+ child: Text('${attentionGlyph(s)} ${counts[s]} ${attentionLabel(s)}', style: mono.copyWith(color: neon.of(s).withValues(alpha: 1))),
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: LayoutBuilder(builder: (context, c) {
+ _size = c.biggest;
+ final asking = [for (final m in widget.machines) ...m.agents.where((a) => a.state == AgentAttention.waiting || a.state == AgentAttention.permission)];
+ final avatar = (widget.brand ?? brandPrefsStore).resolveAvatar();
+ return Stack(
+ children: [
+ GestureDetector(
+ onTapUp: _tap,
+ child: RepaintBoundary(
+ child: CustomPaint(
+ size: c.biggest,
+ painter: FleetPainter(machines: widget.machines, clock: _clock, neon: neon, hubLabel: widget.hubLabel, reduced: _reduced),
+ ),
+ ),
+ ),
+ // Who they wait on: the person's avatar inside each asking agent's ring.
+ if (asking.isNotEmpty)
+ IgnorePointer(
+ child: AnimatedBuilder(
+ animation: _clock,
+ builder: (context, _) {
+ final l = FleetLayout.compute(c.biggest, widget.machines, phase: _reduced ? 0 : _clock.value);
+ return Stack(children: [
+ for (final a in asking)
+ if (l.agents[a.id] case final p?)
+ Positioned(
+ left: p.dx - 7,
+ top: p.dy - 7,
+ child: AvatarBadge(avatar: avatar, size: 14, color: neon.of(a.state), background: neon.background),
+ ),
+ ]);
+ },
+ ),
+ ),
+ ],
+ );
+ }),
+ ),
+ ],
+ );
+ }
+}
+
+class FleetPainter extends CustomPainter {
+ FleetPainter({required this.machines, required this.clock, required this.neon, required this.hubLabel, required this.reduced}) : super(repaint: clock);
+
+ final List<FleetMachine> machines;
+ final Animation<double> clock;
+ final Neon neon;
+ final String hubLabel;
+ final bool reduced;
+
+ Path _hex(Offset c, double r) {
+ final p = Path();
+ for (var i = 0; i < 6; i++) {
+ final a = math.pi / 6 + i * math.pi / 3;
+ final v = c + Offset(r * math.cos(a), r * math.sin(a));
+ i == 0 ? p.moveTo(v.dx, v.dy) : p.lineTo(v.dx, v.dy);
+ }
+ return p..close();
+ }
+
+ void _label(Canvas canvas, String text, Offset at, Color color, {double size = 11, bool bold = false, double max = 120}) {
+ final tp = TextPainter(
+ text: TextSpan(text: text, style: TextStyle(fontFamily: 'monospace', fontSize: size, color: color, fontWeight: bold ? FontWeight.w700 : FontWeight.w400)),
+ textDirection: TextDirection.ltr,
+ maxLines: 1,
+ ellipsis: '…',
+ )..layout(maxWidth: max);
+ tp.paint(canvas, at - Offset(tp.width / 2, 0));
+ tp.dispose();
+ }
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ final t = reduced ? 0.0 : clock.value;
+ final l = FleetLayout.compute(size, machines, phase: t);
+ // Faint scanlines behind the graph (design/attention-motion.md: 6 to 10 percent, never over text).
+ final scan = Paint()..color = neon.accent.withValues(alpha: 0.06);
+ for (var y = 0.0; y < size.height; y += 4) {
+ canvas.drawRect(Rect.fromLTWH(0, y, size.width, 1), scan);
+ }
+
+ // Links and their packets.
+ for (final m in machines) {
+ final c = l.machines[m.id]!;
+ final link = Paint()
+ ..strokeWidth = 1.5
+ ..color = (m.connected ? neon.accent : neon.foreground).withValues(alpha: m.connected ? 0.45 : 0.18);
+ if (m.connected) {
+ canvas.drawLine(l.hub, c, link);
+ } else {
+ final d = c - l.hub;
+ final len = d.distance;
+ for (var s = 0.0; s < len; s += 10) {
+ canvas.drawLine(l.hub + d * (s / len), l.hub + d * (math.min(s + 5, len) / len), link);
+ }
+ }
+ if (!m.connected) continue;
+ final working = m.agents.any((a) => a.state == AgentAttention.working);
+ final asking = m.agents.map((a) => a.state).where((s) => s == AgentAttention.permission || s == AgentAttention.waiting || s == AgentAttention.failed).toList()
+ ..sort((a, b) => _priority.indexOf(a) - _priority.indexOf(b));
+ void packets(Offset from, Offset to, Color color, double speed) {
+ for (var k = 0; k < 3; k++) {
+ final u = ((t * speed) + k / 3) % 1.0;
+ final p = Offset.lerp(from, to, u)!;
+ canvas.drawCircle(p, 3, Paint()..color = color.withValues(alpha: 0.9 * math.sin(u * math.pi))..maskFilter = const MaskFilter.blur(BlurStyle.normal, 2));
+ }
+ }
+
+ if (working && !reduced) packets(l.hub, c, neon.accent, 6);
+ if (asking.isNotEmpty && !reduced) packets(c, l.hub, neon.of(asking.first), 8);
+ }
+
+ // Hub.
+ final hubR = l.machineRadius * 0.75;
+ canvas.drawPath(chamferPath(Rect.fromCircle(center: l.hub, radius: hubR), hubR * 0.4), Paint()..color = neon.background);
+ canvas.drawPath(chamferPath(Rect.fromCircle(center: l.hub, radius: hubR), hubR * 0.4), Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 1.5
+ ..color = neon.accent);
+ _label(canvas, hubLabel, l.hub + Offset(0, hubR + 4), neon.foreground.withValues(alpha: 0.7));
+
+ // Machines and agents.
+ for (final m in machines) {
+ final c = l.machines[m.id]!;
+ final top = m.agents.map((a) => a.state).fold<AgentAttention?>(null, (best, s) => best == null || _priority.indexOf(s) < _priority.indexOf(best) ? s : best);
+ final hex = _hex(c, l.machineRadius);
+ canvas.drawPath(hex, Paint()..color = neon.background);
+ if (top != null && (top == AgentAttention.permission || top == AgentAttention.waiting || top == AgentAttention.failed)) {
+ // Glow is urgency: only a machine with an agent waiting on you glows.
+ canvas.drawPath(hex, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 6
+ ..color = neon.of(top).withValues(alpha: 0.35)
+ ..maskFilter = const MaskFilter.blur(BlurStyle.outer, 10));
+ }
+ canvas.drawPath(hex, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = m.local ? 2.5 : 1.5
+ ..color = m.connected ? neon.accent : neon.foreground.withValues(alpha: 0.3));
+ _label(canvas, m.name, c - const Offset(0, 7), m.connected ? neon.foreground : neon.foreground.withValues(alpha: 0.4), bold: true, max: l.machineRadius * 2 - 4, size: 10);
+ _label(canvas, '${m.agents.length}', c + const Offset(0, 1), neon.foreground.withValues(alpha: 0.6), size: 10);
+ for (final a in m.agents) {
+ _agent(canvas, l.agents[a.id]!, a, t);
+ }
+ }
+ }
+
+ void _agent(Canvas canvas, Offset p, FleetAgent a, double t) {
+ const r = 9.0;
+ final color = neon.of(a.state);
+ final ring = Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 2
+ ..color = color;
+ canvas.drawCircle(p, r, Paint()..color = neon.background);
+ final wave = 0.5 - 0.5 * math.cos(t * 2 * math.pi * 6); // ~2 s breaths on a 12 s clock
+ switch (a.state) {
+ case AgentAttention.working:
+ canvas.drawCircle(p, r, ring..color = color.withValues(alpha: 0.3));
+ canvas.drawArc(Rect.fromCircle(center: p, radius: r), t * 2 * math.pi * 12, math.pi * 0.8, false, ring..color = color);
+ case AgentAttention.waiting || AgentAttention.permission || AgentAttention.failed:
+ final k = reduced ? 1.0 : wave;
+ canvas.drawCircle(p, r + 2 + 3 * k, Paint()..color = color.withValues(alpha: 0.18 + 0.25 * k)..maskFilter = const MaskFilter.blur(BlurStyle.normal, 5));
+ canvas.drawCircle(p, r, ring);
+ case AgentAttention.done:
+ canvas.drawCircle(p, r, Paint()..color = color.withValues(alpha: 0.85));
+ case AgentAttention.idle || AgentAttention.offline:
+ canvas.drawCircle(p, r, ring..strokeWidth = 1);
+ }
+ final f = a.spendFraction;
+ if (f != null) {
+ canvas.drawArc(Rect.fromCircle(center: p, radius: r + 3.5), -math.pi / 2, 2 * math.pi * f.clamp(0.0, 1.0), false, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 1.5
+ ..color = neon.spend(f));
+ }
+ _label(canvas, attentionGlyph(a.state), p - const Offset(0, 7), a.state == AgentAttention.done ? neon.background : color, size: 11, bold: true);
+ _label(canvas, a.lane == null ? a.name : '${a.name} ${a.lane![0].toUpperCase()}', p + const Offset(0, r + 3), neon.foreground.withValues(alpha: 0.75), size: 9, max: 90);
+ }
+
+ @override
+ bool shouldRepaint(FleetPainter old) => old.machines != machines && !_listEq(old.machines, machines) || old.neon != neon || old.reduced != reduced || old.hubLabel != hubLabel;
+}
diff --git a/desktop/lib/fleet/fleet_overview.dart b/desktop/lib/fleet/fleet_overview.dart
new file mode 100644
index 000000000..6de8acbd4
--- /dev/null
+++ b/desktop/lib/fleet/fleet_overview.dart
@@ -0,0 +1,183 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+
+import '../core/models.dart' show ConnectionStatus;
+import '../state/app_state.dart';
+import '../state/attention_state.dart';
+import 'fleet_graph.dart';
+import 'neon.dart';
+
+/// The fleet as [FleetGraph] reads it, built from the machines this window knows and the
+/// local daemon's attention frame. A machine's agents take their state from the frame; an agent the
+/// frame does not cover (another machine's, until that daemon's frame is relayed) reads idle when
+/// its machine is connected and offline when not, which is all this window can honestly say.
+List<FleetMachine> fleetFrom(AppNotifier app) {
+ final attention = app.attention;
+ final seen = <String>{};
+ final out = <FleetMachine>[];
+ for (final m in app.machines) {
+ final st = app.stateOf(m.machineId);
+ if (st == null) continue;
+ final connected = st.connectionStatus == ConnectionStatus.connected;
+ final agents = <FleetAgent>[];
+ for (final a in st.agents) {
+ final row = attention.of(a.id);
+ seen.add(a.id);
+ agents.add(FleetAgent(
+ id: a.id,
+ name: row?.name.isNotEmpty == true ? row!.name : a.name,
+ state: row?.state ?? (connected ? AgentAttention.idle : AgentAttention.offline),
+ lane: row?.lane,
+ spendFraction: row?.spendFraction,
+ ));
+ }
+ out.add(FleetMachine(id: m.machineId, name: m.displayName, connected: connected, local: st.isLocalMachine, agents: agents));
+ }
+ // Rows the frame carries that no machine lists yet (a session starting up) go on the local machine.
+ final orphans = [for (final r in attention.rows) if (!seen.contains(r.agentId)) FleetAgent(id: r.agentId, name: r.name.isEmpty ? r.agentId : r.name, state: r.state, lane: r.lane, spendFraction: r.spendFraction)];
+ if (orphans.isNotEmpty) {
+ final i = out.indexWhere((m) => m.local);
+ if (i >= 0) {
+ final m = out[i];
+ out[i] = FleetMachine(id: m.id, name: m.name, connected: m.connected, local: true, agents: [...m.agents, ...orphans]);
+ } else {
+ out.add(FleetMachine(id: 'local', name: attention.hostname.isEmpty ? 'this machine' : attention.hostname, connected: true, local: true, agents: orphans));
+ }
+ }
+ return out;
+}
+
+/// Hosts the fleet overview above the workspace. Opened from the command bar ("Fleet overview") or
+/// Ctrl+Shift+G; Escape, the close button or a click outside the panel closes it. The panel is a
+/// fixed size inside the window: nothing in it scrolls (motion never moves the layout).
+class FleetOverviewHost extends StatelessWidget {
+ const FleetOverviewHost({super.key, required this.app, required this.child});
+
+ final AppNotifier app;
+ final Widget child;
+
+ @override
+ Widget build(BuildContext context) {
+ return CallbackShortcuts(
+ bindings: {
+ const SingleActivator(LogicalKeyboardKey.keyG, control: true, shift: true): () => app.fleetOverviewOpen.value = !app.fleetOverviewOpen.value,
+ },
+ child: Stack(
+ fit: StackFit.expand,
+ children: [
+ child,
+ ValueListenableBuilder<bool>(
+ valueListenable: app.fleetOverviewOpen,
+ builder: (context, open, _) => open ? _FleetPanel(app: app) : const SizedBox.shrink(),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+class _FleetPanel extends StatelessWidget {
+ const _FleetPanel({required this.app});
+ final AppNotifier app;
+
+ void _close() => app.fleetOverviewOpen.value = false;
+
+ @override
+ Widget build(BuildContext context) {
+ final neon = Neon.current();
+ return CallbackShortcuts(
+ bindings: {const SingleActivator(LogicalKeyboardKey.escape): _close},
+ child: Focus(
+ autofocus: true,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: _close,
+ child: ColoredBox(
+ color: Colors.black.withValues(alpha: 0.55),
+ child: Center(
+ child: GestureDetector(
+ onTap: () {}, // clicks inside the panel stay inside
+ child: FractionallySizedBox(
+ widthFactor: 0.78,
+ heightFactor: 0.78,
+ child: CustomPaint(
+ foregroundPainter: _ChamferFrame(neon.accent),
+ child: ClipPath(
+ clipper: _ChamferClip(),
+ child: ColoredBox(
+ color: neon.background,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 10, 6, 0),
+ child: Row(
+ children: [
+ Text('FLEET', style: TextStyle(fontFamily: 'monospace', fontSize: 12, letterSpacing: 3, fontWeight: FontWeight.w700, color: neon.accent)),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Text('machines, their agents and what each needs; click an agent to open it',
+ maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(fontSize: 12, color: neon.foreground.withValues(alpha: 0.55))),
+ ),
+ IconButton(tooltip: 'Close (Esc)', icon: const Icon(Icons.close, size: 16), color: neon.foreground, onPressed: _close),
+ ],
+ ),
+ ),
+ Expanded(
+ child: ListenableBuilder(
+ listenable: Listenable.merge([app, app.attention]),
+ builder: (context, _) => FleetGraph(
+ machines: fleetFrom(app),
+ hubLabel: 'this window',
+ onAgentTap: (agentId) {
+ final m = fleetFrom(app).where((m) => m.agents.any((a) => a.id == agentId)).firstOrNull;
+ _close();
+ if (m != null && m.id != 'local') app.openAgentFromDial(m.id, agentId, intent: AttachIntent.person);
+ },
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class _ChamferClip extends CustomClipper<Path> {
+ @override
+ Path getClip(Size size) => chamferPath(Offset.zero & size, 18);
+ @override
+ bool shouldReclip(_ChamferClip old) => false;
+}
+
+class _ChamferFrame extends CustomPainter {
+ const _ChamferFrame(this.color);
+ final Color color;
+ @override
+ void paint(Canvas canvas, Size size) {
+ final p = chamferPath((Offset.zero & size).deflate(0.75), 18);
+ canvas.drawPath(p, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 6
+ ..color = color.withValues(alpha: 0.25)
+ ..maskFilter = const MaskFilter.blur(BlurStyle.outer, 12));
+ canvas.drawPath(p, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 1.5
+ ..color = color);
+ }
+
+ @override
+ bool shouldRepaint(_ChamferFrame old) => old.color != color;
+}
diff --git a/desktop/lib/fleet/neon.dart b/desktop/lib/fleet/neon.dart
new file mode 100644
index 000000000..26c8e5e6f
--- /dev/null
+++ b/desktop/lib/fleet/neon.dart
@@ -0,0 +1,108 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:io' show Platform;
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/widgets.dart';
+
+import '../shared/theme/color_palette.dart';
+import '../state/attention_state.dart';
+import '../shared/theme/app_theme.dart' as grid;
+
+/// The neon every animated surface in the app draws with (design/attention-motion.md, "the language").
+///
+/// Accent comes from the app palette (the Omarchy palette follows the live theme). Yellow, red and
+/// green come from the Omarchy theme file when the theme's colour still reads as that colour, else
+/// from fixed fallbacks: a theme that maps `red` to a green (some do) would otherwise make a
+/// permission request look like a working agent, and the colour is the state.
+@immutable
+class Neon {
+ const Neon({required this.accent, required this.yellow, required this.red, required this.green, required this.foreground, required this.background});
+
+ final Color accent, yellow, red, green, foreground, background;
+
+ static const fallbackYellow = Color(0xFFEAB308);
+ static const fallbackRed = Color(0xFFEF4444);
+ static const fallbackGreen = Color(0xFF22C55E);
+
+ static Neon current() {
+ final p = grid.AppTheme.palette.value;
+ return Neon(
+ accent: p.accent,
+ yellow: themed('yellow', fallbackYellow, 35, 70),
+ red: themed('red', fallbackRed, 335, 20),
+ green: themed('green', fallbackGreen, 90, 170),
+ foreground: p.foreground,
+ background: p.background,
+ );
+ }
+
+ /// The theme's [key] colour when its hue sits in [lo]..[hi] degrees (wrapping) and it is not grey.
+ @visibleForTesting
+ static Color themed(String key, Color fallback, double lo, double hi, {Color? Function(String)? read}) {
+ final c = (read ?? OmarchyLivePalette.color)(key);
+ if (c == null) return fallback;
+ final hsv = HSVColor.fromColor(c);
+ if (hsv.saturation < 0.35) return fallback;
+ final h = hsv.hue;
+ final inRange = lo <= hi ? (h >= lo && h <= hi) : (h >= lo || h <= hi);
+ return inRange ? c : fallback;
+ }
+
+ /// The one colour per attention state, shared by pane borders, rings and the fleet graph.
+ Color of(AgentAttention s) => switch (s) {
+ AgentAttention.working => accent,
+ AgentAttention.waiting => yellow,
+ AgentAttention.permission || AgentAttention.failed => red,
+ AgentAttention.done => green,
+ AgentAttention.idle => foreground.withValues(alpha: 0.35),
+ AgentAttention.offline => foreground.withValues(alpha: 0.15),
+ };
+
+ /// Spend arc colour: accent, amber from 80 percent, red at the cap (design/attention-motion.md "arcs are quantities").
+ Color spend(double fraction) => fraction >= 1 ? red : fraction >= 0.8 ? yellow : accent;
+
+ @override
+ bool operator ==(Object other) =>
+ other is Neon && other.accent == accent && other.yellow == yellow && other.red == red && other.green == green && other.foreground == foreground && other.background == background;
+
+ @override
+ int get hashCode => Object.hash(accent, yellow, red, green, foreground, background);
+}
+
+/// The one reduced-motion switch (design/attention-motion.md: "every animation sits behind one switch").
+/// On when the platform asks for no animations, or when `HARNESS_REDUCED_MOTION=1` is set in the
+/// environment or at build time. Tests set [override].
+abstract final class Motion {
+ static bool? override;
+ static final bool _env = const bool.fromEnvironment('HARNESS_REDUCED_MOTION') || (!kIsWeb && Platform.environment['HARNESS_REDUCED_MOTION'] == '1');
+
+ static bool reducedOf(BuildContext context) => override ?? (_env || (MediaQuery.maybeDisableAnimationsOf(context) ?? false));
+}
+
+/// Whether the window has focus, so looping animations can stop while nobody is looking.
+/// Driven by the app lifecycle (desktop embedders report focus loss as `inactive`). Starts true.
+class WindowFocus extends ValueNotifier<bool> with WidgetsBindingObserver {
+ WindowFocus._() : super(true) {
+ WidgetsBinding.instance.addObserver(this);
+ final s = WidgetsBinding.instance.lifecycleState;
+ if (s != null) value = s == AppLifecycleState.resumed;
+ }
+
+ static WindowFocus? _instance;
+ static WindowFocus get instance => _instance ??= WindowFocus._();
+
+ @override
+ void didChangeAppLifecycleState(AppLifecycleState state) => value = state == AppLifecycleState.resumed;
+}
+
+/// The Omarchy chamfer (two-step bevel on the top-left and bottom-right corners) as a path, the shape
+/// the wordmark's letters carry. Used for hexagon-free tiles and the splash frame.
+Path chamferPath(Rect r, double c) => Path()
+ ..moveTo(r.left + c, r.top)
+ ..lineTo(r.right, r.top)
+ ..lineTo(r.right, r.bottom - c)
+ ..lineTo(r.right - c, r.bottom)
+ ..lineTo(r.left, r.bottom)
+ ..lineTo(r.left, r.top + c)
+ ..close();
diff --git a/desktop/lib/fleet/spend_ring.dart b/desktop/lib/fleet/spend_ring.dart
new file mode 100644
index 000000000..459fee60b
--- /dev/null
+++ b/desktop/lib/fleet/spend_ring.dart
@@ -0,0 +1,230 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:math' as math;
+
+import 'package:flutter/material.dart';
+
+import '../state/attention_state.dart';
+import '../branding/brand_mark.dart';
+import '../branding/brand_prefs.dart';
+import 'neon.dart';
+
+/// The per-agent spend arc drawn around the pane header's engine mark (design/attention-motion.md, "arcs
+/// are quantities"). Present only when a per-agent cap is set (the daemon sends `spend.fraction`).
+/// Accent below 80 percent, amber from 80, red at the cap. The child keeps its size: the arc is
+/// painted outside it, so the header's layout never moves.
+///
+/// While the agent waits on you (a question or a permission request) the mark is replaced by your
+/// avatar inside a ring in the state colour: the header says who it is waiting on, not just that it
+/// waits. The avatar is the one chosen in Settings, Appearance ([BrandPrefsStore]).
+class SpendRing extends StatefulWidget {
+ const SpendRing({super.key, required this.attention, required this.agentId, required this.child, this.gap = 3, this.brand});
+
+ final AttentionState attention;
+ final String agentId;
+ final Widget child;
+ final double gap;
+ final BrandPrefsStore? brand;
+
+ @override
+ State<SpendRing> createState() => _SpendRingState();
+}
+
+class _SpendRingState extends State<SpendRing> {
+ double? _fraction;
+ double? _usd;
+ AgentAttention? _state;
+
+ BrandPrefsStore get _brand => widget.brand ?? brandPrefsStore;
+
+ bool get _asking => _state == AgentAttention.waiting || _state == AgentAttention.permission;
+
+ @override
+ void initState() {
+ super.initState();
+ widget.attention.addListener(_onFrame);
+ _brand.addListener(_onBrand);
+ _read();
+ }
+
+ void _onBrand() {
+ if (_asking && mounted) setState(() {});
+ }
+
+ @override
+ void didUpdateWidget(SpendRing old) {
+ super.didUpdateWidget(old);
+ if (!identical(old.attention, widget.attention)) {
+ old.attention.removeListener(_onFrame);
+ widget.attention.addListener(_onFrame);
+ }
+ _read();
+ }
+
+ bool _read() {
+ final row = widget.attention.of(widget.agentId);
+ final f = row?.spendFraction, u = row?.spendUsd, st = row?.state;
+ if (f == _fraction && u == _usd && st == _state) return false;
+ _fraction = f;
+ _usd = u;
+ _state = st;
+ return true;
+ }
+
+ void _onFrame() {
+ if (_read() && mounted) setState(() {});
+ }
+
+ @override
+ void dispose() {
+ widget.attention.removeListener(_onFrame);
+ _brand.removeListener(_onBrand);
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final f = _fraction;
+ if (_asking) return _avatar(context, f);
+ if (f == null) return widget.child;
+ final pct = (f * 100).round();
+ final usd = _usd == null ? '' : '\$${_usd!.toStringAsFixed(2)} spent, ';
+ return Tooltip(
+ message: '$usd$pct% of the cap',
+ child: Stack(
+ clipBehavior: Clip.none,
+ alignment: Alignment.center,
+ children: [
+ widget.child,
+ Positioned(
+ left: -widget.gap - 2,
+ top: -widget.gap - 2,
+ right: -widget.gap - 2,
+ bottom: -widget.gap - 2,
+ child: IgnorePointer(child: SpendArc(fraction: f)),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+extension on _SpendRingState {
+ Widget _avatar(BuildContext context, double? f) {
+ final neon = Neon.current();
+ final color = neon.of(_state!);
+ final label = _state == AgentAttention.permission ? 'Needs your permission' : 'Waiting on you';
+ return Tooltip(
+ message: f == null ? label : '$label, ${(f * 100).round()}% of the spend cap',
+ child: Stack(
+ clipBehavior: Clip.none,
+ alignment: Alignment.center,
+ children: [
+ // Same footprint as the mark it replaces, so the header does not move.
+ Opacity(opacity: 0, child: widget.child),
+ Positioned.fill(
+ child: AvatarBadge(avatar: _brand.resolveAvatar(), size: 17, color: color, background: neon.background),
+ ),
+ Positioned(
+ left: -widget.gap - 2,
+ top: -widget.gap - 2,
+ right: -widget.gap - 2,
+ bottom: -widget.gap - 2,
+ child: IgnorePointer(
+ child: f == null
+ ? CustomPaint(painter: SpendArcPainter(fraction: 1, color: color, track: color, stroke: 2))
+ : SpendArc(fraction: f),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+/// A 0..100 percent arc that eases to its new value, turns amber at 80 percent and holds red at the
+/// cap, where it pulses once (the moment it crosses) and then stays still.
+class SpendArc extends StatefulWidget {
+ const SpendArc({super.key, required this.fraction, this.stroke = 2});
+
+ final double fraction;
+ final double stroke;
+
+ @override
+ State<SpendArc> createState() => _SpendArcState();
+}
+
+class _SpendArcState extends State<SpendArc> with SingleTickerProviderStateMixin {
+ late final AnimationController _pulse = AnimationController(vsync: this, duration: const Duration(milliseconds: 700), value: 1);
+
+ @override
+ void didUpdateWidget(SpendArc old) {
+ super.didUpdateWidget(old);
+ if (old.fraction < 1 && widget.fraction >= 1 && !Motion.reducedOf(context)) _pulse.forward(from: 0);
+ }
+
+ @override
+ void dispose() {
+ _pulse.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final neon = Neon.current();
+ final reduced = Motion.reducedOf(context);
+ return RepaintBoundary(
+ child: TweenAnimationBuilder<double>(
+ tween: Tween(end: widget.fraction),
+ duration: reduced ? Duration.zero : const Duration(milliseconds: 450),
+ curve: Curves.easeOutCubic,
+ builder: (context, f, _) => AnimatedBuilder(
+ animation: _pulse,
+ builder: (context, _) => CustomPaint(
+ painter: SpendArcPainter(
+ fraction: f,
+ color: neon.spend(f),
+ track: neon.foreground.withValues(alpha: 0.12),
+ stroke: widget.stroke,
+ pulse: _pulse.value,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class SpendArcPainter extends CustomPainter {
+ const SpendArcPainter({required this.fraction, required this.color, required this.track, required this.stroke, this.pulse = 1});
+
+ final double fraction;
+ final Color color, track;
+ final double stroke;
+
+ /// 0..1 through the cap-crossing pulse; 1 when none is running.
+ final double pulse;
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ final r = Rect.fromCircle(center: size.center(Offset.zero), radius: math.min(size.width, size.height) / 2 - stroke / 2);
+ final p = Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = stroke
+ ..strokeCap = StrokeCap.round;
+ canvas.drawArc(r, 0, 2 * math.pi, false, p..color = track);
+ final sweep = 2 * math.pi * fraction.clamp(0.0, 1.0);
+ if (pulse < 1) {
+ final t = math.sin(pulse * math.pi);
+ canvas.drawArc(r.inflate(2 * t), -math.pi / 2, sweep, false, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = stroke + 3 * t
+ ..color = color.withValues(alpha: 0.5 * t)
+ ..maskFilter = MaskFilter.blur(BlurStyle.normal, 4 * t + 0.01));
+ }
+ canvas.drawArc(r, -math.pi / 2, sweep, false, p..color = color);
+ }
+
+ @override
+ bool shouldRepaint(SpendArcPainter old) => old.fraction != fraction || old.color != color || old.track != track || old.stroke != stroke || old.pulse != pulse;
+}
diff --git a/desktop/lib/settings/sections/appearance_section.dart b/desktop/lib/settings/sections/appearance_section.dart
index 6ae4370b4..ad7fdabb8 100644
--- a/desktop/lib/settings/sections/appearance_section.dart
+++ b/desktop/lib/settings/sections/appearance_section.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
+import '../../branding/brand_section.dart';
import '../../shared/theme/app_theme.dart' as grid;
import '../appearance/palette_section.dart';
import '../../shared/theme/appearance_prefs_store.dart';
@@ -21,6 +22,8 @@ class AppearanceSection extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PaletteSection(store: store),
+ // Boot logo (off by default) and the avatar shown to agents waiting on you.
+ const BrandSection(),
// Room under the last card so a scrolled-to-bottom pane does not end
// flush against the window edge.
const SizedBox(height: 8),
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index b8a3261f7..034f7f498 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -76,6 +76,7 @@ import 'take_over.dart';
import '../widgets/engine_identity.dart'
show allEngines, engineIdentity, isTerminalEngine;
import '../store/store_screen.dart' show openStoreAgent;
+import 'attention_state.dart';
import 'dial_status.dart';
import 'grid_pictures.dart';
import 'model_start_watch.dart';
@@ -2939,6 +2940,13 @@ class AppNotifier extends ChangeNotifier {
/// frames from the local daemon; its own notifier, so the row rebuilds
/// without dragging the whole rail through a machine-list rebuild.
final DialState dial;
+
+ /// Per-agent attention from the local daemon's `attention` frame (cli/src/fleet/control.ts):
+ /// drives the pane frame and the fleet overview.
+ final AttentionState attention = AttentionState();
+
+ /// Whether the fleet overview panel is showing (lib/fleet/fleet_overview.dart).
+ final ValueNotifier<bool> fleetOverviewOpen = ValueNotifier(false);
final AgentPreference agentPreference;
final ProjectHistory projectHistory;
@@ -14985,6 +14993,10 @@ class AppNotifier extends ChangeNotifier {
// ── the dial, over the cable, forwarded by the local daemon ──────────────────────────────────
// Local-only frames (backend.sendLocal in the harness CLI): they describe a hand at THIS desk, so
// they never reach the cloud web audience, who may be sitting at another computer entirely.
+ case 'attention':
+ // What each agent needs from a person; drives the pane frame and the fleet overview.
+ attention.apply(payload);
+ return;
case 'dial_status':
// The dial came, went, or started taking an update. Its own notifier —
// see [dial] — so nothing else in the window rebuilds for it.
diff --git a/desktop/lib/state/attention_state.dart b/desktop/lib/state/attention_state.dart
new file mode 100644
index 000000000..b931d9750
--- /dev/null
+++ b/desktop/lib/state/attention_state.dart
@@ -0,0 +1,130 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'package:flutter/foundation.dart';
+
+/// What each agent needs from a person, as the local daemon's `attention` frame reports it
+/// (cli/src/lib/attention.ts). Its own notifier, like [DialState], so a state change only
+/// rebuilds the panes that draw it.
+enum AgentAttention { working, waiting, permission, failed, done, idle, offline }
+
+AgentAttention attentionFromWire(Object? v) => switch (v) {
+ 'working' => AgentAttention.working,
+ 'waiting' => AgentAttention.waiting,
+ 'permission' => AgentAttention.permission,
+ 'failed' => AgentAttention.failed,
+ 'done' => AgentAttention.done,
+ 'offline' => AgentAttention.offline,
+ _ => AgentAttention.idle,
+ };
+
+/// Same glyphs and words as cli/src/lib/attention.ts (ATTENTION_GLYPH, ATTENTION_LABEL).
+String attentionGlyph(AgentAttention s) => switch (s) {
+ AgentAttention.working => '~',
+ AgentAttention.waiting => '?',
+ AgentAttention.permission => '!',
+ AgentAttention.failed => 'x',
+ AgentAttention.done => '*',
+ AgentAttention.idle => '-',
+ AgentAttention.offline => '.',
+ };
+
+String attentionLabel(AgentAttention s) => switch (s) {
+ AgentAttention.working => 'working',
+ AgentAttention.waiting => 'waiting on you',
+ AgentAttention.permission => 'needs permission',
+ AgentAttention.failed => 'failed',
+ AgentAttention.done => 'done, unreviewed',
+ AgentAttention.idle => 'idle',
+ AgentAttention.offline => 'offline',
+ };
+
+@immutable
+class AttentionRow {
+ const AttentionRow({
+ required this.agentId,
+ required this.state,
+ this.detail = '',
+ this.spendFraction,
+ this.spendUsd,
+ this.name = '',
+ this.machine = '',
+ this.lane,
+ });
+ final String agentId;
+ final AgentAttention state;
+ final String detail;
+ final double? spendFraction;
+ final double? spendUsd;
+
+ /// Display name, host name and policy lane as the daemon sends them (empty or null when absent).
+ final String name;
+ final String machine;
+ final String? lane;
+
+ /// The glyph and word every state carries so colour is never the only signal (design/attention-motion.md).
+ String get glyph => attentionGlyph(state);
+ String get label => attentionLabel(state);
+
+ /// Needs a person now: the pane glows for these and only these.
+ bool get needsYou => state == AgentAttention.waiting || state == AgentAttention.permission || state == AgentAttention.failed;
+
+ // Value equality, so an identical frame (one arrives every second) does not repaint every pane.
+ @override
+ bool operator ==(Object other) =>
+ other is AttentionRow &&
+ other.agentId == agentId &&
+ other.state == state &&
+ other.detail == detail &&
+ other.spendFraction == spendFraction &&
+ other.spendUsd == spendUsd &&
+ other.name == name &&
+ other.machine == machine &&
+ other.lane == lane;
+
+ @override
+ int get hashCode => Object.hash(agentId, state, detail, spendFraction, spendUsd, name, machine, lane);
+}
+
+class AttentionState extends ChangeNotifier {
+ final Map<String, AttentionRow> _rows = {};
+
+ AttentionRow? of(String agentId) => _rows[agentId];
+
+ /// Every row from the last frame, in the daemon's priority order.
+ Iterable<AttentionRow> get rows => _rows.values;
+
+ /// The host that sent the last frame (`hostname` on the payload), empty before the first one.
+ String get hostname => _hostname;
+ String _hostname = '';
+
+ /// Replace from one `attention` frame payload. Unknown shapes are ignored, never thrown.
+ void apply(Map<String, dynamic> payload) {
+ final agents = payload['agents'];
+ if (agents is! List) return;
+ final next = <String, AttentionRow>{};
+ for (final a in agents) {
+ if (a is! Map) continue;
+ final id = a['agentId'];
+ if (id is! String || id.isEmpty) continue;
+ final spend = a['spend'];
+ String str(Object? v) => v is String ? v : '';
+ next[id] = AttentionRow(
+ agentId: id,
+ state: attentionFromWire(a['state']),
+ detail: str(a['detail']),
+ spendFraction: spend is Map && spend['fraction'] is num ? (spend['fraction'] as num).toDouble() : null,
+ spendUsd: spend is Map && spend['usd'] is num ? (spend['usd'] as num).toDouble() : null,
+ name: str(a['name']),
+ machine: str(a['machine']),
+ lane: a['lane'] is String ? a['lane'] as String : null,
+ );
+ }
+ final host = payload['hostname'] is String ? payload['hostname'] as String : _hostname;
+ if (mapEquals(_rows, next) && host == _hostname) return;
+ _hostname = host;
+ _rows
+ ..clear()
+ ..addAll(next);
+ notifyListeners();
+ }
+}
diff --git a/desktop/lib/state/command_bar_catalog.dart b/desktop/lib/state/command_bar_catalog.dart
index 1427c371d..e88759526 100644
--- a/desktop/lib/state/command_bar_catalog.dart
+++ b/desktop/lib/state/command_bar_catalog.dart
@@ -170,6 +170,24 @@ List<CommandBarAction> buildCommandBarCatalog(
return null;
},
),
+ CommandBarAction(
+ id: 'app:fleet',
+ kind: CommandKind.command,
+ title: 'Fleet overview',
+ detail:
+ 'Every machine and its agents as a live graph, coloured by what each one needs from you. Ctrl+Shift+G.',
+ automatic: true,
+ phrases: [
+ 'fleet',
+ 'fleet overview',
+ 'show the fleet',
+ 'machines and agents',
+ ],
+ perform: (_) async {
+ app.fleetOverviewOpen.value = true;
+ return null;
+ },
+ ),
CommandBarAction(
id: 'create:general',
kind: CommandKind.create,
diff --git a/desktop/lib/widgets/attention_glow.dart b/desktop/lib/widgets/attention_glow.dart
new file mode 100644
index 000000000..16ef0c1e7
--- /dev/null
+++ b/desktop/lib/widgets/attention_glow.dart
@@ -0,0 +1,304 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:math' as math;
+import 'dart:ui' as ui;
+
+import 'package:flutter/material.dart';
+
+import '../fleet/neon.dart';
+import '../state/attention_state.dart';
+
+/// What a pane's frame does for one attention state. Each motion answers one question:
+/// sweep "is it still working?", breathe "is it waiting on me?", alarm "is something blocked or
+/// broken?", fill "did it just finish?". Idle and offline draw nothing, so a quiet desk stays quiet.
+enum AttentionMotion { sweep, breathe, alarm, fill, none }
+
+/// The pane's attention frame, painted over the child and never resizing it (motion never moves the layout).
+///
+/// - working: a short accent gradient runs around the border, 2.4 s a lap.
+/// - waiting: the border and an outer glow breathe in yellow.
+/// - permission / failed: a red pulse with a bright scan band that travels down the two side
+/// edges. The band lives in the border, never over the terminal's text (design/attention-motion.md). Failed opens
+/// with the device's double flash.
+/// - done: the border draws itself once around the pane in green, then holds still.
+/// - Colour changes between states cross-fade over 280 ms instead of snapping.
+///
+/// Loops stop while the window is unfocused or reduced motion is on (then every state is a steady
+/// border). The painter sits in its own layer, so the terminal repainting never repaints the frame
+/// and a frame tick never repaints the terminal. [AttentionState] rows are value-equal, so the
+/// once-a-second frame that changes nothing rebuilds nothing here.
+class AttentionGlow extends StatefulWidget {
+ const AttentionGlow({super.key, required this.attention, required this.agentId, required this.child, this.reducedMotion = false});
+
+ final AttentionState attention;
+ final String agentId;
+ final Widget child;
+
+ /// Forces reduced motion on; the platform setting and HARNESS_REDUCED_MOTION also turn it on.
+ final bool reducedMotion;
+
+ static AttentionMotion motionFor(AgentAttention s) => switch (s) {
+ AgentAttention.working => AttentionMotion.sweep,
+ AgentAttention.waiting => AttentionMotion.breathe,
+ AgentAttention.permission || AgentAttention.failed => AttentionMotion.alarm,
+ AgentAttention.done => AttentionMotion.fill,
+ AgentAttention.idle || AgentAttention.offline => AttentionMotion.none,
+ };
+
+ /// Kept for callers of the first version (the bar legend, tests).
+ static Color colorFor(AgentAttention s, ColorScheme scheme) => switch (s) {
+ AgentAttention.permission || AgentAttention.failed => scheme.error,
+ AgentAttention.waiting => Neon.fallbackYellow,
+ _ => Colors.transparent,
+ };
+
+ @override
+ State<AttentionGlow> createState() => _AttentionGlowState();
+}
+
+class _AttentionGlowState extends State<AttentionGlow> with TickerProviderStateMixin {
+ // One loop clock for sweep, breathe and alarm; one one-shot clock for the done fill and the
+ // failed double flash; one for the colour cross-fade. All three sit idle unless a state needs them.
+ late final AnimationController _loop = AnimationController(vsync: this, duration: const Duration(milliseconds: 2400));
+ late final AnimationController _once = AnimationController(vsync: this, duration: const Duration(milliseconds: 900), value: 1);
+ late final AnimationController _fade = AnimationController(vsync: this, duration: const Duration(milliseconds: 280), value: 1);
+ late final Listenable _tick = Listenable.merge([_loop, _once, _fade]);
+
+ AttentionRow? _row;
+ Color _from = Colors.transparent, _to = Colors.transparent;
+ bool _reduced = false;
+
+ @override
+ void initState() {
+ super.initState();
+ _row = widget.attention.of(widget.agentId);
+ widget.attention.addListener(_onFrame);
+ WindowFocus.instance.addListener(_syncLoop);
+ // Once a fade out of the last state ends, drop the painter layer altogether.
+ _fade.addStatusListener((s) {
+ if (s == AnimationStatus.completed && mounted) setState(() {});
+ });
+ }
+
+ @override
+ void didChangeDependencies() {
+ super.didChangeDependencies();
+ _reduced = widget.reducedMotion || Motion.reducedOf(context);
+ _to = _colorOf(_row);
+ if (_fade.value == 1) _from = _to;
+ _syncLoop();
+ }
+
+ @override
+ void didUpdateWidget(AttentionGlow old) {
+ super.didUpdateWidget(old);
+ if (!identical(old.attention, widget.attention)) {
+ old.attention.removeListener(_onFrame);
+ widget.attention.addListener(_onFrame);
+ }
+ _reduced = widget.reducedMotion || Motion.reducedOf(context);
+ if (old.agentId != widget.agentId || !identical(old.attention, widget.attention)) _onFrame();
+ _syncLoop();
+ }
+
+ Color _colorOf(AttentionRow? r) =>
+ r == null || AttentionGlow.motionFor(r.state) == AttentionMotion.none ? Colors.transparent : Neon.current().of(r.state);
+
+ void _onFrame() {
+ final next = widget.attention.of(widget.agentId);
+ if (next == _row) return; // value-equal: nothing changed, nothing repaints
+ final prev = _row?.state;
+ _row = next;
+ if (next?.state != prev) {
+ // Cross-fade from whatever colour is on screen now.
+ _from = Color.lerp(_from, _to, _fade.value) ?? _to;
+ _to = _colorOf(next);
+ if (_reduced) {
+ _fade.value = 1;
+ } else {
+ _fade.forward(from: 0);
+ }
+ final s = next?.state;
+ if (!_reduced && (s == AgentAttention.done || s == AgentAttention.failed)) {
+ _once.duration = Duration(milliseconds: s == AgentAttention.done ? 900 : 520);
+ _once.forward(from: 0);
+ } else {
+ _once.value = 1;
+ }
+ }
+ _syncLoop();
+ if (mounted) setState(() {});
+ }
+
+ void _syncLoop() {
+ final motion = _row == null ? AttentionMotion.none : AttentionGlow.motionFor(_row!.state);
+ final loops = motion == AttentionMotion.sweep || motion == AttentionMotion.breathe || motion == AttentionMotion.alarm;
+ final run = loops && !_reduced && WindowFocus.instance.value;
+ if (run && !_loop.isAnimating) {
+ _loop.duration = Duration(milliseconds: switch (motion) { AttentionMotion.sweep => 2400, AttentionMotion.alarm => 1100, _ => 2200 });
+ _loop.repeat();
+ } else if (!run && _loop.isAnimating) {
+ _loop.stop();
+ }
+ }
+
+ @override
+ void dispose() {
+ widget.attention.removeListener(_onFrame);
+ WindowFocus.instance.removeListener(_syncLoop);
+ _loop.dispose();
+ _once.dispose();
+ _fade.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final row = _row;
+ final motion = row == null ? AttentionMotion.none : AttentionGlow.motionFor(row.state);
+ final child = RepaintBoundary(child: widget.child);
+ if (motion == AttentionMotion.none && _fade.value == 1) return child;
+ return RepaintBoundary(
+ child: AnimatedBuilder(
+ animation: _tick,
+ child: child,
+ builder: (context, child) => CustomPaint(
+ foregroundPainter: AttentionBorderPainter(
+ motion: motion,
+ color: Color.lerp(_from, _to, Curves.easeOut.transform(_fade.value)) ?? _to,
+ phase: _loop.value,
+ progress: _once.value,
+ failed: row?.state == AgentAttention.failed,
+ reduced: _reduced,
+ ),
+ child: child,
+ ),
+ ),
+ );
+ }
+}
+
+/// Paints one pane's attention frame. Value-equal, so an unchanged frame is never repainted.
+class AttentionBorderPainter extends CustomPainter {
+ const AttentionBorderPainter({required this.motion, required this.color, required this.phase, required this.progress, this.failed = false, this.reduced = false});
+
+ final AttentionMotion motion;
+ final Color color;
+
+ /// 0..1 around the loop clock.
+ final double phase;
+
+ /// 0..1 through a one-shot (done fill, failed flash); 1 when none is running.
+ final double progress;
+ final bool failed;
+ final bool reduced;
+
+ static const double width = 2;
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ if (color.a == 0) return;
+ final rect = (Offset.zero & size).deflate(width / 2);
+ final stroke = Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = width;
+ if (reduced) {
+ if (motion == AttentionMotion.none) return;
+ canvas.drawRect(rect, stroke..color = color.withValues(alpha: motion == AttentionMotion.sweep ? 0.5 : 0.9));
+ return;
+ }
+ switch (motion) {
+ case AttentionMotion.none:
+ // Only reached while the colour fades out of a previous state.
+ canvas.drawRect(rect, stroke..color = color.withValues(alpha: 0.6));
+ case AttentionMotion.sweep:
+ _sweep(canvas, rect, stroke);
+ case AttentionMotion.breathe:
+ final t = 0.5 - 0.5 * math.cos(phase * 2 * math.pi);
+ _glow(canvas, rect, 0.18 + 0.30 * t, 8 + 10 * t);
+ canvas.drawRect(rect, stroke..color = color.withValues(alpha: 0.55 + 0.4 * t));
+ case AttentionMotion.alarm:
+ _alarm(canvas, rect, stroke);
+ case AttentionMotion.fill:
+ _fill(canvas, rect, stroke);
+ }
+ }
+
+ void _glow(Canvas canvas, Rect rect, double alpha, double blur) {
+ canvas.drawRect(
+ rect,
+ Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 4
+ ..color = color.withValues(alpha: alpha)
+ ..maskFilter = MaskFilter.blur(BlurStyle.outer, blur),
+ );
+ }
+
+ void _sweep(Canvas canvas, Rect rect, Paint stroke) {
+ // A dim steady frame so the pane reads as "live", and a bright comet running around it.
+ canvas.drawRect(rect, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 1
+ ..color = color.withValues(alpha: 0.22));
+ final a = phase * 2 * math.pi;
+ final shader = SweepGradient(
+ center: Alignment.center,
+ transform: GradientRotation(a),
+ colors: [color.withValues(alpha: 0), color.withValues(alpha: 0), color.withValues(alpha: 0.35), color, color.withValues(alpha: 0)],
+ stops: const [0, 0.72, 0.9, 0.985, 1],
+ ).createShader(rect);
+ canvas.drawRect(rect, stroke..shader = shader);
+ }
+
+ void _alarm(Canvas canvas, Rect rect, Paint stroke) {
+ // Failed opens with two quick flashes, then settles into the pulse (design/attention-motion.md, device failed screen).
+ if (failed && progress < 1) {
+ final on = (progress * 4).floor().isEven;
+ canvas.drawRect(rect, stroke..color = color.withValues(alpha: on ? 1 : 0.15));
+ if (on) _glow(canvas, rect, 0.6, 18);
+ return;
+ }
+ final t = math.pow(0.5 - 0.5 * math.cos(phase * 2 * math.pi), 2).toDouble();
+ _glow(canvas, rect, 0.25 + 0.4 * t, 10 + 8 * t);
+ canvas.drawRect(rect, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = width
+ ..color = color.withValues(alpha: 0.7 + 0.3 * t));
+ // The scan band: a bright 48 px segment sliding down both side edges, inside the border only.
+ final y = rect.top + (rect.height + 96) * phase - 48;
+ final band = Rect.fromLTRB(rect.left - 2, y - 48, rect.right + 2, y + 48);
+ final shader = ui.Gradient.linear(band.topCenter, band.bottomCenter, [color.withValues(alpha: 0), Colors.white.withValues(alpha: 0.9), color.withValues(alpha: 0)], const [0, 0.5, 1]);
+ final edge = Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = width + 1
+ ..shader = shader;
+ canvas.save();
+ canvas.clipRect(band);
+ canvas.drawLine(rect.topLeft, rect.bottomLeft, edge);
+ canvas.drawLine(rect.topRight, rect.bottomRight, edge);
+ canvas.restore();
+ }
+
+ void _fill(Canvas canvas, Rect rect, Paint stroke) {
+ final p = Curves.easeInOutCubic.transform(progress.clamp(0.0, 1.0));
+ // Drawn clockwise from the top-left corner, like the device's done ring filling.
+ final path = Path()..addRect(rect);
+ final metric = path.computeMetrics().first;
+ canvas.drawPath(metric.extractPath(0, metric.length * p), stroke..color = color);
+ if (p < 1) {
+ final head = metric.getTangentForOffset(metric.length * p)?.position;
+ if (head != null) canvas.drawCircle(head, 3.5, Paint()..color = Colors.white.withValues(alpha: 0.9)..maskFilter = const MaskFilter.blur(BlurStyle.normal, 3));
+ } else {
+ // Settled: a quieter green frame that says "finished, not yet looked at".
+ canvas.drawRect(rect, Paint()
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 1
+ ..color = color.withValues(alpha: 0.35));
+ }
+ }
+
+ @override
+ bool shouldRepaint(AttentionBorderPainter old) =>
+ old.motion != motion || old.color != color || old.phase != phase || old.progress != progress || old.failed != failed || old.reduced != reduced;
+}
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index 9ec137277..c043ef07f 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -35,6 +35,8 @@ import '../terminal/terminal_text.dart';
import '../terminal/terminal_link_opener.dart';
import '../terminal/remote_media_download.dart';
import '../terminal/terminal_links.dart';
+import 'attention_glow.dart';
+import '../fleet/spend_ring.dart';
import '../terminal/terminal_session.dart';
import '../terminal/terminal_theme.dart';
import '../terminal/terminal_theme_store.dart';
@@ -2120,7 +2122,11 @@ class _TerminalPanelState extends State<TerminalPanel>
// underneath them all would stack with theirs.
final paneOpacity = PaneOpacity.of(context);
final chromeFill = PaneOpacity.fill(context, grid.AppPalette.windowBg);
- return KeymapRegion(
+ // The pane frame follows what its agent needs from a person (the daemon's attention frame).
+ return AttentionGlow(
+ attention: widget.notifier.attention,
+ agentId: session.agentId,
+ child: KeymapRegion(
contextKind: KeymapContext.terminal,
composing: () =>
_focusNode.hasFocus &&
@@ -2398,6 +2404,7 @@ class _TerminalPanelState extends State<TerminalPanel>
],
),
),
+ ),
);
}
@@ -2820,10 +2827,15 @@ class _TerminalHeader extends StatelessWidget {
children: [
if (leadingStatus)
statusButton()
- else if (agent != null && showIdentityMark)
- EngineMark.forAgent(agent, size: 17)
else if (showIdentityMark)
- EngineMark(engine: session.engineId, size: 17),
+ // The spend arc rings the engine mark when a per-agent cap is set.
+ SpendRing(
+ attention: notifier.attention,
+ agentId: session.agentId,
+ child: agent != null
+ ? EngineMark.forAgent(agent, size: 17)
+ : EngineMark(engine: session.engineId, size: 17),
+ ),
if (leadingStatus || showIdentityMark)
SizedBox(width: leadingStatus ? 6 : 10),
Expanded(
diff --git a/desktop/test/attention_glow_test.dart b/desktop/test/attention_glow_test.dart
new file mode 100644
index 000000000..1f23c4bd4
--- /dev/null
+++ b/desktop/test/attention_glow_test.dart
@@ -0,0 +1,52 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/state/attention_state.dart';
+import 'package:harness/widgets/attention_glow.dart';
+
+Map<String, dynamic> frame(String state, {num? fraction}) => {
+ 'agents': [
+ {'agentId': 'a', 'state': state, 'detail': 'Which branch?', if (fraction != null) 'spend': {'fraction': fraction}},
+ ],
+ };
+
+void main() {
+ test('AttentionState parses a frame, notifies once per real change, ignores junk', () {
+ final s = AttentionState();
+ var n = 0;
+ s.addListener(() => n++);
+ s.apply(frame('waiting', fraction: 0.5));
+ s.apply(frame('waiting', fraction: 0.5));
+ expect(n, 1);
+ expect(s.of('a')?.state, AgentAttention.waiting);
+ expect(s.of('a')?.spendFraction, 0.5);
+ expect(s.of('a')?.needsYou, isTrue);
+ s.apply({'agents': 'nope'});
+ expect(n, 1);
+ s.apply(frame('working'));
+ expect(s.of('a')?.needsYou, isFalse);
+ expect(attentionFromWire('mystery'), AgentAttention.idle);
+ });
+
+ testWidgets('AttentionGlow paints a steady 2 px frame under reduced motion, nothing when idle', (tester) async {
+ final s = AttentionState();
+ await tester.pumpWidget(MaterialApp(
+ home: Center(child: AttentionGlow(attention: s, agentId: 'a', reducedMotion: true, child: const SizedBox(width: 100, height: 60))),
+ ));
+ AttentionBorderPainter? painter() => tester
+ .widgetList<CustomPaint>(find.byType(CustomPaint))
+ .map((w) => w.foregroundPainter)
+ .whereType<AttentionBorderPainter>()
+ .firstOrNull;
+ expect(painter(), isNull);
+ s.apply(frame('permission'));
+ await tester.pump();
+ expect(painter()!.reduced, isTrue);
+ expect(AttentionBorderPainter.width, 2);
+ expect(tester.getSize(find.byType(SizedBox)), const Size(100, 60));
+ s.apply(frame('idle'));
+ await tester.pump();
+ expect(painter(), isNull);
+ });
+}
diff --git a/desktop/test/attention_motion_test.dart b/desktop/test/attention_motion_test.dart
new file mode 100644
index 000000000..25a8b35c5
--- /dev/null
+++ b/desktop/test/attention_motion_test.dart
@@ -0,0 +1,259 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/branding/boot_splash.dart';
+import 'package:harness/branding/brand_prefs.dart';
+import 'package:harness/fleet/fleet_graph.dart';
+import 'package:harness/fleet/neon.dart';
+import 'package:harness/fleet/spend_ring.dart';
+import 'package:harness/state/attention_state.dart';
+import 'package:harness/widgets/attention_glow.dart';
+
+Map<String, dynamic> frame(String state, {num? fraction, num? usd, int at = 1}) => {
+ 'hostname': 'host-a',
+ 'at': at,
+ 'agents': [
+ {
+ 'agentId': 'a',
+ 'name': 'planner-1',
+ 'machine': 'host-a',
+ 'lane': 'planner',
+ 'state': state,
+ 'detail': 'Which branch?',
+ if (fraction != null || usd != null) 'spend': {'fraction': fraction, 'usd': usd},
+ },
+ ],
+ };
+
+AttentionBorderPainter? borderPainter(WidgetTester tester) {
+ for (final w in tester.widgetList<CustomPaint>(find.byType(CustomPaint))) {
+ if (w.foregroundPainter is AttentionBorderPainter) return w.foregroundPainter as AttentionBorderPainter;
+ }
+ return null;
+}
+
+Widget pane(AttentionState s, {bool reduced = false}) => MaterialApp(
+ home: Center(
+ child: AttentionGlow(attention: s, agentId: 'a', reducedMotion: reduced, child: const SizedBox(width: 200, height: 120)),
+ ),
+ );
+
+void main() {
+ tearDown(() => Motion.override = null);
+
+ group('attention rows', () {
+ test('carry name, machine, lane and usd; a frame that only moves `at` notifies nobody', () {
+ final s = AttentionState();
+ var n = 0;
+ s.addListener(() => n++);
+ s.apply(frame('working', fraction: 0.4, usd: 2.5, at: 1));
+ s.apply(frame('working', fraction: 0.4, usd: 2.5, at: 2));
+ expect(n, 1);
+ final r = s.of('a')!;
+ expect((r.name, r.machine, r.lane, r.spendUsd, r.glyph, r.label), ('planner-1', 'host-a', 'planner', 2.5, '~', 'working'));
+ expect(s.hostname, 'host-a');
+ });
+ });
+
+ group('neon', () {
+ test('a theme colour is used only while it still reads as that colour', () {
+ Color? greenRed(String _) => const Color(0xFF50F872);
+ Color? realRed(String _) => const Color(0xFFFF3355);
+ expect(Neon.themed('red', Neon.fallbackRed, 335, 20, read: greenRed), Neon.fallbackRed);
+ expect(Neon.themed('red', Neon.fallbackRed, 335, 20, read: realRed), const Color(0xFFFF3355));
+ expect(Neon.themed('red', Neon.fallbackRed, 335, 20, read: (_) => null), Neon.fallbackRed);
+ });
+
+ test('spend colour: accent, amber from 80 percent, red at the cap', () {
+ const n = Neon(accent: Color(0xFF00FFFF), yellow: Color(0xFFFFFF00), red: Color(0xFFFF0000), green: Color(0xFF00FF00), foreground: Colors.white, background: Colors.black);
+ expect(n.spend(0.5), n.accent);
+ expect(n.spend(0.8), n.yellow);
+ expect(n.spend(1.0), n.red);
+ expect(n.spend(1.4), n.red);
+ });
+ });
+
+ group('pane attention', () {
+ test('every state maps to one motion', () {
+ expect(AttentionGlow.motionFor(AgentAttention.working), AttentionMotion.sweep);
+ expect(AttentionGlow.motionFor(AgentAttention.waiting), AttentionMotion.breathe);
+ expect(AttentionGlow.motionFor(AgentAttention.permission), AttentionMotion.alarm);
+ expect(AttentionGlow.motionFor(AgentAttention.failed), AttentionMotion.alarm);
+ expect(AttentionGlow.motionFor(AgentAttention.done), AttentionMotion.fill);
+ expect(AttentionGlow.motionFor(AgentAttention.idle), AttentionMotion.none);
+ expect(AttentionGlow.motionFor(AgentAttention.offline), AttentionMotion.none);
+ });
+
+ testWidgets('idle paints nothing and schedules no frames', (tester) async {
+ final s = AttentionState();
+ await tester.pumpWidget(pane(s));
+ expect(borderPainter(tester), isNull);
+ s.apply(frame('idle'));
+ await tester.pump();
+ await tester.pump(const Duration(seconds: 1));
+ expect(borderPainter(tester), isNull);
+ expect(tester.binding.hasScheduledFrame, isFalse);
+ });
+
+ testWidgets('working sweeps, waiting breathes, permission alarms; child never resized', (tester) async {
+ final s = AttentionState();
+ await tester.pumpWidget(pane(s));
+ for (final (wire, motion) in [('working', AttentionMotion.sweep), ('waiting', AttentionMotion.breathe), ('permission', AttentionMotion.alarm)]) {
+ s.apply(frame(wire));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ final p = borderPainter(tester)!;
+ expect(p.motion, motion, reason: wire);
+ expect(tester.binding.hasScheduledFrame, isTrue, reason: '$wire loops');
+ expect(tester.getSize(find.byType(SizedBox).last), const Size(200, 120));
+ }
+ });
+
+ testWidgets('done plays its fill once, then stops asking for frames', (tester) async {
+ final s = AttentionState();
+ await tester.pumpWidget(pane(s));
+ s.apply(frame('working'));
+ await tester.pump();
+ s.apply(frame('done'));
+ await tester.pump();
+ expect(borderPainter(tester)!.motion, AttentionMotion.fill);
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(borderPainter(tester)!.progress, inExclusiveRange(0, 1));
+ await tester.pumpAndSettle();
+ expect(borderPainter(tester)!.progress, 1);
+ expect(tester.binding.hasScheduledFrame, isFalse);
+ });
+
+ testWidgets('reduced motion: a steady border, no looping frames', (tester) async {
+ final s = AttentionState();
+ await tester.pumpWidget(pane(s, reduced: true));
+ s.apply(frame('permission'));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ final p = borderPainter(tester)!;
+ expect(p.reduced, isTrue);
+ await tester.pumpAndSettle();
+ expect(tester.binding.hasScheduledFrame, isFalse);
+ });
+
+ testWidgets('loops pause while the window is unfocused', (tester) async {
+ final s = AttentionState();
+ await tester.pumpWidget(pane(s));
+ s.apply(frame('working'));
+ await tester.pump();
+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);
+ await tester.pump();
+ await tester.pumpAndSettle();
+ expect(tester.binding.hasScheduledFrame, isFalse);
+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);
+ await tester.pump();
+ expect(tester.binding.hasScheduledFrame, isTrue);
+ });
+ });
+
+ group('spend ring', () {
+ testWidgets('hidden without a cap, drawn with the right colour when there is one', (tester) async {
+ final s = AttentionState();
+ await tester.pumpWidget(MaterialApp(home: Center(child: SpendRing(attention: s, agentId: 'a', child: const SizedBox(width: 17, height: 17)))));
+ expect(find.byType(SpendArc), findsNothing);
+ s.apply(frame('working', fraction: 0.9, usd: 4.5));
+ await tester.pump();
+ await tester.pumpAndSettle();
+ final arc = tester.widget<SpendArc>(find.byType(SpendArc));
+ expect(arc.fraction, 0.9);
+ expect(tester.getSize(find.byType(SpendRing)), const Size(17, 17));
+ expect(find.byTooltip(r'$4.50 spent, 90% of the cap'), findsOneWidget);
+ });
+ });
+
+ group('fleet graph', () {
+ final machines = [
+ const FleetMachine(id: 'host-a', name: 'host-a', connected: true, local: true, agents: [
+ FleetAgent(id: 'a', name: 'planner-1', state: AgentAttention.working, lane: 'planner'),
+ FleetAgent(id: 'b', name: 'checker', state: AgentAttention.waiting),
+ ]),
+ const FleetMachine(id: 'host-b', name: 'host-b', connected: false, agents: [FleetAgent(id: 'c', name: 'drafter', state: AgentAttention.offline)]),
+ ];
+
+ test('layout keeps every node inside the canvas', () {
+ const size = Size(640, 420);
+ final l = FleetLayout.compute(size, machines);
+ expect(l.machines.length, 2);
+ expect(l.agents.length, 3);
+ for (final p in [...l.machines.values, ...l.agents.values]) {
+ expect((Offset.zero & size).contains(p), isTrue, reason: '$p');
+ }
+ });
+
+ testWidgets('animates only while some agent is live, and has a word for every state', (tester) async {
+ await tester.pumpWidget(MaterialApp(home: Scaffold(body: FleetGraph(machines: machines))));
+ await tester.pump(const Duration(milliseconds: 100));
+ expect(tester.binding.hasScheduledFrame, isTrue);
+ expect(find.textContaining('? 1'), findsOneWidget);
+ await tester.pumpWidget(MaterialApp(home: Scaffold(body: FleetGraph(machines: [machines[1]]))));
+ await tester.pumpAndSettle();
+ expect(tester.binding.hasScheduledFrame, isFalse);
+ });
+ });
+
+ group('boot splash', () {
+ // The splash is off until a logo is chosen; these cover a person who picked the Harness icon.
+ setUp(() {
+ BootSplash.debugReset();
+ brandPrefsStore.value = const BrandPrefs(bootLogo: BootLogo.harness);
+ });
+ tearDown(() => brandPrefsStore.value = const BrandPrefs());
+
+ testWidgets('stays off when no logo has been chosen', (tester) async {
+ brandPrefsStore.value = const BrandPrefs();
+ await tester.pumpWidget(const MaterialApp(home: BootSplash(child: Text('app'))));
+ expect(find.byKey(BootSplash.overlayKey), findsNothing);
+ expect(find.text('app'), findsOneWidget);
+ });
+
+ testWidgets('shows once per process, then hands off inside 1.8 s', (tester) async {
+ await tester.pumpWidget(const MaterialApp(home: BootSplash(child: Text('app'))));
+ expect(find.byKey(BootSplash.overlayKey), findsOneWidget);
+ expect(find.text('app'), findsOneWidget, reason: 'the app builds underneath, never delayed');
+ await tester.pump(const Duration(milliseconds: 1800));
+ await tester.pump();
+ expect(find.byKey(BootSplash.overlayKey), findsNothing);
+ await tester.pumpWidget(const MaterialApp(home: BootSplash(key: ValueKey(2), child: Text('app'))));
+ expect(find.byKey(BootSplash.overlayKey), findsNothing, reason: 'a re-opened window is not a cold launch');
+ });
+
+ testWidgets('a click skips it', (tester) async {
+ await tester.pumpWidget(const MaterialApp(home: BootSplash(child: Text('app'))));
+ await tester.pump(const Duration(milliseconds: 200));
+ await tester.tap(find.byKey(BootSplash.overlayKey));
+ // The fade starts on the next frame and takes 180 ms, far short of the full 1.5 s.
+ await tester.pump(const Duration(milliseconds: 16));
+ await tester.pump(const Duration(milliseconds: 200));
+ await tester.pump();
+ expect(find.byKey(BootSplash.overlayKey), findsNothing);
+ });
+
+ testWidgets('a key skips it', (tester) async {
+ await tester.pumpWidget(const MaterialApp(home: BootSplash(child: Text('app'))));
+ await tester.pump(const Duration(milliseconds: 200));
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ // The fade starts on the next frame and takes 180 ms, far short of the full 1.5 s.
+ await tester.pump(const Duration(milliseconds: 16));
+ await tester.pump(const Duration(milliseconds: 200));
+ await tester.pump();
+ expect(find.byKey(BootSplash.overlayKey), findsNothing);
+ });
+
+ testWidgets('reduced motion shows a static logo', (tester) async {
+ Motion.override = true;
+ await tester.pumpWidget(const MaterialApp(home: BootSplash(child: Text('app'))));
+ await tester.pump(const Duration(milliseconds: 100));
+ expect(tester.state<BootSplashState>(find.byType(BootSplash)).animated, isFalse);
+ await tester.pump(const Duration(milliseconds: 1800));
+ await tester.pump();
+ expect(find.byKey(BootSplash.overlayKey), findsNothing);
+ });
+ });
+}
diff --git a/desktop/test/brand_prefs_test.dart b/desktop/test/brand_prefs_test.dart
new file mode 100644
index 000000000..657480b0f
--- /dev/null
+++ b/desktop/test/brand_prefs_test.dart
@@ -0,0 +1,169 @@
+// Originally written by Fred Nix (@nixfred) in github.com/nixfred/openharness (MIT).
+
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/local_key_value_store.dart';
+import 'package:harness/branding/boot_splash.dart';
+import 'package:harness/branding/brand_prefs.dart';
+import 'package:harness/branding/brand_section.dart';
+
+class _Memory implements LocalKeyValueStore {
+ final Map<String, String> data = {};
+ @override
+ Future<String?> read(String key) async => data[key];
+ @override
+ Future<void> write(String key, String value) async => data[key] = value;
+ @override
+ Future<void> delete(String key) async => data.remove(key);
+}
+
+// Generic placeholders only: an 8x8 PNG header and a tiny SVG. No personal assets.
+final _png = [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, ...List.filled(64, 0)];
+const _svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><rect width="10" height="10"/></svg>';
+
+void main() {
+ late Directory tmp;
+ late _Memory mem;
+ var n = 0;
+ BrandPrefsStore store({bool omarchy = true, bool face = false}) {
+ final sys = Directory('${tmp.path}/sys${n++}')..createSync(recursive: true);
+ final logo = File('${sys.path}/logo.svg');
+ final faceFile = File('${sys.path}/.face');
+ if (omarchy) logo.writeAsStringSync(_svg);
+ if (face) faceFile.writeAsBytesSync(_png);
+ return BrandPrefsStore(storage: mem, dataDir: Directory('${tmp.path}/data'), omarchyLogoPath: logo.path, systemAvatarPath: faceFile.path);
+ }
+
+ setUp(() {
+ tmp = Directory.systemTemp.createTempSync('brand');
+ mem = _Memory();
+ });
+ tearDown(() => tmp.deleteSync(recursive: true));
+
+ group('boot logo', () {
+ test('is off until chosen, with or without Omarchy on the machine', () async {
+ final a = store();
+ await a.load();
+ expect(a.value.bootLogo, isNull, reason: 'nothing chosen yet');
+ expect(a.resolveBootLogo().kind, BootLogo.none);
+ final b = store(omarchy: false);
+ await b.load();
+ expect(b.resolveBootLogo().kind, BootLogo.none);
+ expect(b.omarchyAvailable, isFalse);
+ });
+
+ test('a saved Omarchy choice falls back to Harness on a machine without Omarchy', () async {
+ mem.data[BrandPrefsStore.bootLogoKey] = 'omarchy';
+ final s = store(omarchy: false);
+ await s.load();
+ expect(s.resolveBootLogo().kind, BootLogo.harness);
+ });
+
+ test('custom: validated, copied into the data dir, and a missing copy falls back', () async {
+ final s = store();
+ await s.load();
+ final src = File('${tmp.path}/mine.png')..writeAsBytesSync(_png);
+ expect(await s.setCustomLogo(src.path), isNull);
+ expect(s.value.bootLogo, BootLogo.custom);
+ final r = s.resolveBootLogo();
+ expect(r.kind, BootLogo.custom);
+ expect(r.path, startsWith('${tmp.path}/data'));
+ expect(mem.data[BrandPrefsStore.bootLogoKey], 'custom');
+ File(r.path!).deleteSync();
+ expect(s.resolveBootLogo().kind, BootLogo.none, reason: 'no splash when the custom file is gone');
+ });
+
+ test('custom files are rejected by size and type, and the old choice is kept', () async {
+ final s = store();
+ await s.load();
+ final big = File('${tmp.path}/big.png')..writeAsBytesSync([..._png, ...List.filled(BrandPrefsStore.maxBytes, 0)]);
+ final txt = File('${tmp.path}/notes.txt')..writeAsStringSync('hello');
+ final fake = File('${tmp.path}/fake.png')..writeAsStringSync('not a png');
+ expect(await s.setCustomLogo(big.path), contains('2 MB'));
+ expect(await s.setCustomLogo(txt.path), contains('SVG or PNG'));
+ expect(await s.setCustomLogo(fake.path), contains('not a valid'));
+ expect(await s.setCustomLogo('${tmp.path}/missing.svg'), isNotNull);
+ expect(s.value.bootLogo, isNull);
+ });
+
+ test('an SVG custom logo is accepted; None is remembered', () async {
+ final s = store();
+ await s.load();
+ final src = File('${tmp.path}/mark.svg')..writeAsStringSync(_svg);
+ expect(await s.setCustomLogo(src.path), isNull);
+ expect(s.resolveBootLogo().isSvg, isTrue);
+ await s.setBootLogo(BootLogo.none);
+ final again = store();
+ await again.load();
+ expect(again.resolveBootLogo().kind, BootLogo.none);
+ });
+ });
+
+ group('avatar', () {
+ test('default is the generic glyph; initials are kept short and upper case', () async {
+ final s = store();
+ await s.load();
+ expect(s.resolveAvatar().kind, AvatarSource.generic);
+ await s.setInitials(' ab c ');
+ expect(s.resolveAvatar().kind, AvatarSource.initials);
+ expect(s.resolveAvatar().initials, 'ABC');
+ await s.setInitials('');
+ expect(s.resolveAvatar().kind, AvatarSource.generic);
+ });
+
+ test('the system avatar is offered only when ~/.face exists, and falls back when it goes', () async {
+ final none = store();
+ await none.load();
+ expect(none.systemAvatarAvailable, isFalse);
+ final s = store(face: true);
+ await s.load();
+ expect(s.systemAvatarAvailable, isTrue);
+ await s.setAvatar(AvatarSource.system);
+ expect(s.resolveAvatar().kind, AvatarSource.system);
+ File(s.systemAvatarPath).deleteSync();
+ expect(s.resolveAvatar().kind, AvatarSource.generic);
+ });
+
+ test('a custom avatar is validated and cached in the data dir', () async {
+ final s = store();
+ await s.load();
+ final src = File('${tmp.path}/me.png')..writeAsBytesSync(_png);
+ expect(await s.setCustomAvatar(src.path), isNull);
+ final r = s.resolveAvatar();
+ expect(r.kind, AvatarSource.custom);
+ expect(r.path, startsWith('${tmp.path}/data'));
+ expect(await s.setCustomAvatar('${tmp.path}/nope.gif'), isNotNull);
+ expect(s.resolveAvatar().kind, AvatarSource.custom);
+ });
+ });
+
+ group('widgets', () {
+ testWidgets('the splash never shows when the choice is None', (tester) async {
+ BootSplash.debugReset();
+ final s = store();
+ await tester.runAsync(() async {
+ await s.load();
+ await s.setBootLogo(BootLogo.none);
+ });
+ await tester.pumpWidget(MaterialApp(home: BootSplash(brand: s, child: const Text('app'))));
+ expect(find.byKey(BootSplash.overlayKey), findsNothing);
+ });
+
+ testWidgets('the Appearance pickers list the choices; Omarchy only where it is installed', (tester) async {
+ final s = store(omarchy: false);
+ await tester.runAsync(s.load);
+ await tester.pumpWidget(MaterialApp(home: Scaffold(body: SingleChildScrollView(child: BrandSection(store: s)))));
+ for (final label in ['Harness', 'Custom…', 'None', 'Generic', 'Initials', 'Custom image…']) {
+ expect(find.text(label), findsWidgets, reason: label);
+ }
+ expect(find.text('System avatar'), findsNothing, reason: 'no ~/.face here');
+ expect(find.widgetWithText(ChoiceChip, 'Omarchy'), findsNothing, reason: 'no Omarchy logo here');
+ await tester.tap(find.widgetWithText(ChoiceChip, 'None'));
+ await tester.runAsync(() => Future<void>.delayed(const Duration(milliseconds: 20)));
+ await tester.pump();
+ expect(s.value.bootLogo, BootLogo.none);
+ });
+ });
+}