The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Merge branch 'main' into feat/mobile-ios-android
Dev jacobfc896beaa0bd
diff --cc desktop/lib/app_shell.dartindex fee9893a6,000000000..4702363b6mode 100644,000000..100644--- a/desktop/lib/app_shell.dart+++ b/desktop/lib/app_shell.dart@@@ -1,330 -1,0 +1,338 @@@+import 'dart:async';+import 'dart:ui' show AppExitResponse;++import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_riverpod/flutter_riverpod.dart';++import 'analytics/analytics_lifecycle.dart';+import 'core/crash_log.dart';+import 'core/desktop_window.dart';+import 'screens/login_screen.dart';+import 'state/app_state.dart';+import 'viewer/viewer_services.dart';+import 'ws/terminal_transport_plugin.dart';+import 'shared/theme/app_theme.dart' as grid;+import 'shared/theme/appearance_prefs_store.dart';+import 'terminal/terminal_font_store.dart';+import 'widgets/bootstrapping_screen.dart';+import 'widgets/layout_palette.dart';+import 'widgets/environment_preflight_screen.dart';+import 'widgets/environment_setup_screen.dart';+import 'widgets/export_logs_dialog.dart';+import 'widgets/flash_firmware_dialog.dart';+import 'core/startup.dart';+import 'logging/app_log.dart';+import 'logging/install.dart';+import 'shortcuts/app_keymap.dart';+import 'widgets/shortcuts_sheet.dart';+import 'widgets/update_notice.dart';+import 'widgets/window_chrome.dart';++/// The screen an app puts up once someone is signed in — the desktop's swarm of+/// panes, or the phone's one-agent-at-a-time shell. It is the only thing the two+/// entry points disagree about; everything below is shared.+typedef AuthenticatedScreenBuilder = Widget Function(AppNotifier app);++/// Everything both entry points do before their first frame: file logs, the+/// crash log, the keyboard config, the saved appearance, and the native window+/// where there is one.+///+/// Lives here rather than in `main.dart` so every screen up to sign-in has one+/// definition of what precedes it. `../mobile` carries its own vendored copy of+/// this file — it depended on this package until it was made standalone — so a+/// change here that belongs on the phone too has to be carried across; the two+/// trees are otherwise byte-identical outside `lib/phone/` and `lib/p2p/`.+Future<void> startHarness({+ required AuthenticatedScreenBuilder authenticatedScreen,+ /// A viewer build's second wire to each machine (see+ /// [TerminalTransportPlugin]); the desktop passes none.+ TerminalTransportPluginFactory? transportPlugins,+}) async {+ WidgetsFlutterBinding.ensureInitialized();+ harnessTransportPlugins = transportPlugins;+ // Before anything else can fail. The file sinks come first so CrashLog's own+ // install has somewhere to mirror to — see CrashLog.record.+ installFileLogs();+ CrashLog.install();+ appLog.info('app', 'launched');+ final keymap = AppKeymap(store: AppKeymap.fileStore());+ // Keyboard configuration has its own file and watchers. It can load beside+ // the appearance, but both must be ready before the window becomes usable.+ await Future.wait([loadPersistedSettings(), keymap.start()]);+ // Apply the saved palette to native chrome as well as the Flutter theme.+ await configureDesktopWindow(palette: appearancePrefsStore.value.palette);+ runApp(+ ProviderScope(+ child: HarnessApp(keymap: keymap, authenticatedScreen: authenticatedScreen),+ ),+ );+}++class HarnessApp extends StatelessWidget {+ const HarnessApp({+ super.key,+ this.keymap,+ required this.authenticatedScreen,+ });+ final AppKeymap? keymap;+ final AuthenticatedScreenBuilder authenticatedScreen;++ @override+ Widget build(BuildContext context) {+ // Rebuilds MaterialApp on a font/size change, which is what re-resolves+ // every Grid token with it.+ //+ // `buildAppTheme` bakes `AppControl.*Scaled` into plain numbers at the+ // moment it runs, so a UI size that changed without rebuilding this would+ // repaint nothing at all.+ return ValueListenableBuilder<AppearancePrefs>(+ valueListenable: appearancePrefsStore,+ builder: (context, prefs, _) => _app(prefs),+ );+ }++ Widget _app(AppearancePrefs prefs) {+ grid.AppTheme.palette.value = prefs.palette;+ // ⚠️ ORDER MATTERS, and it is why this is a statement rather than something+ // tucked into the tree below: `buildAppTheme` reads `AppFont.sans` and+ // `AppControl.*Scaled`, so the settings have to be on `AppFont` BEFORE the+ // theme is built, in this same frame.+ //+ // Pushed through the notifier rather than calling `AppFont.apply` directly,+ // so widgets past a `const` boundary — which a top-down rebuild never+ // reaches — are marked dirty too.+ //+ // `codeSize` is passed through unchanged: code type is not on this screen+ // yet, and `apply` takes the whole set, so reading the current value back is+ // how "leave it alone" is spelled.+ final scale = prefs.uiSize / grid.AppFont.uiSizeDefault;+ grid.AppTheme.fonts.apply(+ uiFamily: prefs.uiFamily,+ uiScale: scale,+ codeSize: grid.AppFont.codeSize,+ );+ return MaterialApp(+ title: 'Harness',- debugShowCheckedModeBanner: false,++ // Flutter's DEBUG ribbon stays on a debug build: it is how a locally built++ // app is told apart from the installed release at a glance (owner,++ // 2026-09-16). It never appears in a release build whatever this says.++ // A preview capture that wants a clean corner passes++ // `--dart-define=HARNESS_CLEAN_PREVIEW=true` instead of turning it off++ // for everyone.++ debugShowCheckedModeBanner: !const bool.fromEnvironment(++ 'HARNESS_CLEAN_PREVIEW',++ ),+ // The design system's own `buildAppTheme` — see the note where a second,+ // hand-written `ThemeData` used to shadow it, in `lib/theme/app_theme.dart`.+ // Harness Desktop is dark-only: one theme, no `darkTheme`/`themeMode` to+ // resolve between.+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ // The UI size reaches every `Text` as a text SCALE rather than as hundreds+ // of edited call sites. `withClampedTextScaling` with both bounds equal IS+ // the way to force a factor — MediaQuery has no "set the scale"+ // constructor that still inherits the platform's other metrics.+ //+ // ⚠️ It is a matched pair with the `AppControl.*Scaled` reads above, not a+ // separate nicety: those grow the BOXES and this grows the TYPE, and+ // `AppControl.fontSize` deliberately has no scaled twin so that the factor+ // is applied exactly once. Ship one without the other and a 19px setting+ // gives 19px-tall buttons wrapped around 13pt labels.+ //+ // ⚠️ The terminal is fenced out of this at five seams — see+ // `terminal_panel.dart`, `terminal_composer.dart`, `engine_identity.dart`+ // and `terminal_section.dart`, and the regression test in+ // `test/terminal_ui_scale_isolation_test.dart`. The terminal keeps its own+ // font settings because its type is a grid a remote program draws into.+ //+ // Outermost inside `builder`, with `_GridTokenScope` inside it: the clamp+ // has to be an ancestor of everything that lays out text, while the scope+ // only reads `Theme.of`, which comes from above the builder either way.+ builder: (context, child) => MediaQuery.withClampedTextScaling(+ minScaleFactor: scale,+ maxScaleFactor: scale,+ child: _GridTokenScope(+ child: keymap == null+ ? child ?? const SizedBox.shrink()+ : KeymapProvider(+ keymap: keymap!,+ child: child ?? const SizedBox.shrink(),+ ),+ ),+ ),+ home: AnalyticsLifecycle(+ child: RootShell(authenticatedScreen: authenticatedScreen),+ ),+ );+ }+}++/// Carries Grid's design tokens past this app's `const` chrome.+///+/// A `const` widget is reference-identical across its parent's rebuild, so a+/// top-down rebuild never reaches one — it would keep the palette it first+/// mounted with. [grid.BrightnessScope] marks the ones that called+/// `AppTheme.watch` dirty directly, across that boundary.+///+/// Pinned to [Brightness.dark] rather than read from `Theme.of(context)`:+/// Harness Desktop is dark-only, and there is no other theme for `Theme.of`+/// to ever resolve to here.+class _GridTokenScope extends StatelessWidget {+ const _GridTokenScope({required this.child});++ final Widget child;++ @override+ Widget build(BuildContext context) {+ grid.AppTheme.brightness.value = Brightness.dark;+ return grid.BrightnessScope(child: child);+ }+}++/// Carries "Check for Updates…" from the macOS application menu into Dart.+///+/// The item is installed natively (MainFlutterWindow.swift) so the rest of the+/// menu bar keeps coming from the nib; all this side does is act on the tap.+const _appMenuChannel = MethodChannel('harness/app_menu');++class RootShell extends ConsumerStatefulWidget {+ const RootShell({super.key, required this.authenticatedScreen});++ final AuthenticatedScreenBuilder authenticatedScreen;++ @override+ ConsumerState<RootShell> createState() => _RootShellState();+}++class _RootShellState extends ConsumerState<RootShell>+ with WidgetsBindingObserver {+ bool _menuDialogOpen = false;++ @override+ void initState() {+ super.initState();+ WidgetsBinding.instance.addObserver(this);+ _appMenuChannel.setMethodCallHandler(_onAppMenu);+ }++ @override+ void dispose() {+ WidgetsBinding.instance.removeObserver(this);+ _appMenuChannel.setMethodCallHandler(null);+ super.dispose();+ }++ @override+ Future<AppExitResponse> didRequestAppExit() async {+ // Save the final arrangement, with a bound so an unavailable disk cannot+ // trap the user in the app. Input and tab switching never wait for disk.+ await ref+ .read(appStateProvider)+ .flushPaneLayout()+ .timeout(const Duration(seconds: 1), onTimeout: () {});+ return AppExitResponse.exit;+ }++ Future<void> _onAppMenu(MethodCall call) async {+ if (!mounted) return;+ switch (call.method) {+ case 'checkForUpdates':+ final app = ref.read(appStateProvider);+ await _menuDialog(() async {+ final result = await app.checkForUpdates();+ if (!mounted) return;+ await showUpdateCheckDialog(context, app, result);+ });+ case 'flashFirmware':+ await _menuDialog(() => showFlashFirmwareDialog(context));+ case 'exportLogs':+ await _menuDialog(() => showExportLogsDialog(context));+ case 'showLayout':+ if (advanceLayoutPalette()) return;+ await _menuDialog(+ () => showLayoutPalette(context, ref.read(appStateProvider)),+ );+ case 'showShortcuts':+ await _menuDialog(() => showShortcutsSheet(context));+ case 'increaseTerminalFontSize':+ await terminalFontStore.increaseSize();+ case 'decreaseTerminalFontSize':+ await terminalFontStore.decreaseSize();+ case 'resetTerminalFontSize':+ await terminalFontStore.reset();+ }+ }++ Future<void> _menuDialog(Future<void> Function() action) async {+ if (_menuDialogOpen || ModalRoute.isCurrentOf(context) == false) return;+ // Reserve before the first frame too: held menu shortcuts can arrive+ // before the new dialog has changed the route's current state.+ _menuDialogOpen = true;+ try {+ await action();+ } finally {+ _menuDialogOpen = false;+ }+ }++ @override+ Widget build(BuildContext context) {+ final app = ref.watch(appStateProvider);+ return ListenableBuilder(+ listenable: app,+ builder: (context, _) {+ final Widget screen;+ switch (app.status) {+ case AppStatus.bootstrapping:+ // `bootstrapping` covers two unrelated moments: the app starting+ // cold, and a sign-in the user just began. The second keeps+ // LoginScreen, which carries the wait as a state of its own+ // button; swapping the window for a separate screen there was a+ // hard cut in the middle of a flow, and it is why that button's+ // spinner was almost never seen.+ //+ // ⚠️ Keyed on `signingIn`, NOT on `pendingAuthorizeUrl`. The URL+ // only exists for the middle stretch of the flow — the CLI has to+ // start before it can print one, and it is cleared again while+ // the post-login restore is still running — so keying on it blew+ // the user's own screen away twice per sign-in: once on the click+ // and again on success.+ screen = app.signingIn+ ? LoginScreen(notifier: app)+ : BootstrappingScreen(statusMessage: app.bootStatusMessage);+ case AppStatus.checkingEnvironment:+ screen = EnvironmentPreflightScreen(+ readiness: app.environmentReadiness,+ );+ case AppStatus.preparingEnvironment:+ screen = EnvironmentSetupScreen(notifier: app);+ case AppStatus.unauthenticated:+ screen = LoginScreen(notifier: app);+ case AppStatus.authenticated:+ screen = widget.authenticatedScreen(app);+ }+ // Only the home shell carries its own drag handle and traffic-light+ // clearance (the rail's head). Every other screen fills the window+ // with a centred card, so the strip goes over it here, once, instead+ // of inside each of them.+ final framed = app.status == AppStatus.authenticated+ ? screen+ : FullWindowScreen(child: screen);+ // The band takes a row of its own rather than floating over one. As an+ // overlay it landed on the rail's head — covering the wordmark and the+ // three buttons beside it, which is the one strip of this window that+ // must stay reachable.+ return Column(+ children: [+ if (app.hasAvailableUpdate &&+ app.status != AppStatus.bootstrapping &&+ app.status != AppStatus.checkingEnvironment &&+ app.status != AppStatus.preparingEnvironment)+ UpdateNotice(notifier: app),+ Expanded(child: framed),+ ],+ );+ },+ );+ }+}diff --cc desktop/lib/state/app_state.dartindex adee97154,d65a46750..0c3848ecd--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@@ -19,9 -16,9 +19,10 @@@ import '../auth/sign_in_client.dart'import '../auth/cli_link.dart';import '../auth/cli_login.dart';import '../bootstrap/environment_provisioner.dart';+import '../core/viewer_mode.dart';import '../core/config.dart';import '../core/agent_preference.dart';+ import '../core/dsh_catalog.dart';import '../core/engine_availability.dart';import '../core/local_hostname.dart';import '../core/local_git_projects.dart';diff --cc desktop/lib/widgets/engine_identity.dartindex 86390a55f,27cffe217..442b38fba--- a/desktop/lib/widgets/engine_identity.dart+++ b/desktop/lib/widgets/engine_identity.dart@@@ -1,8 -1,8 +1,9 @@@import 'dart:math' as math;+import 'package:flutter/material.dart';+ import '../core/models.dart';import '../theme/app_theme.dart';class EngineIdentity {diff --cc desktop/pubspec.lockindex 48c575b11,bd07cc942..9ab3bc942--- a/desktop/pubspec.lock+++ b/desktop/pubspec.lock@@@ -704,10 -696,42 +704,42 @@@ packagesdependency: transitivedescription:name: webdriver- sha256: "2f3a14ca026957870cfd9c635b83507e0e51d8091568e90129fbf805aba7cade"+ sha256: "28b82ec894fed45dd71c23ba62d1af973ed97dd59a4f5790a4d38b0b13e5657e"url: "https://pub.dev"source: hosted- version: "3.1.0"+ version: "3.2.0"+ webview_flutter:+ dependency: "direct main"+ description:+ name: webview_flutter+ sha256: d53e1ccf5516f25017e3c9d44c39034db352d20fa34fe200674270242c2c5111+ url: "https://pub.dev"+ source: hosted+ version: "4.14.1"+ webview_flutter_android:+ dependency: transitive+ description:+ name: webview_flutter_android+ sha256: "4de8b3d1ff4ebe1bdb42e68a5e4f809194a3cb0117a8f495f590004f00da3964"+ url: "https://pub.dev"+ source: hosted+ version: "4.14.1"+ webview_flutter_platform_interface:+ dependency: transitive+ description:+ name: webview_flutter_platform_interface+ sha256: "1221c1b12f5278791042f2ec2841743784cf25c5a644e23d6680e5d718824f04"+ url: "https://pub.dev"+ source: hosted+ version: "2.15.1"+ webview_flutter_wkwebview:+ dependency: transitive+ description:+ name: webview_flutter_wkwebview+ sha256: fe359c7fac1002124b5b9e2ba3a41906bbb9b2d029ccb4a0067404d8f3704730+ url: "https://pub.dev"+ source: hosted+ version: "3.26.1"win32:dependency: transitivedescription: