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
feat(mobile): Settings from the terminal menu, and a choice of voice or keyboard input
bubu-dudua9e9c976c3fb
diff --git a/mobile/lib/core/startup.dart b/mobile/lib/core/startup.dartindex 45c4ddbe8..e036b24e8 100644--- a/mobile/lib/core/startup.dart+++ b/mobile/lib/core/startup.dart@@ -1,3 +1,4 @@+import '../phone/phone_input_mode_store.dart';import '../shared/theme/appearance_prefs_store.dart';import '../stats/harness_stats.dart';import '../terminal/terminal_font_store.dart';@@ -20,6 +21,7 @@ Future<void> loadPersistedSettings({TerminalThemeStore? terminalTheme,AppearancePrefsStore? appearance,HarnessStats? stats,+ PhoneInputModeStore? inputMode,}) async {// Independent stores may load together, but all must finish before runApp.// Font and appearance share a serialized file store; each reads its related@@ -36,5 +38,8 @@ Future<void> loadPersistedSettings({// Counters begin moving with the first agent event. Loading them later// could overwrite a new event with the old count from disk.(stats ?? harnessStats).load(),+ // What the first tap on a terminal opens. Read late, that tap could open voice input for+ // somebody who chose the keyboard.+ (inputMode ?? phoneInputModeStore).load(),]);}diff --git a/mobile/lib/phone/phone_input_mode_store.dart b/mobile/lib/phone/phone_input_mode_store.dartnew file mode 100644index 000000000..1a239c080--- /dev/null+++ b/mobile/lib/phone/phone_input_mode_store.dart@@ -0,0 +1,62 @@+import 'package:flutter/foundation.dart';++import '../core/harness_file_store.dart';+import '../core/local_key_value_store.dart';++/// What a tap on a terminal brings up.+enum PhoneInputMode {+ /// Voice input with its mic button, and a Keyboard button beside it for typing. The default: on a+ /// phone, talking to an agent is quicker than thumbing a prompt.+ voice('Voice', 'Tap the terminal to talk; Keyboard is one tap away'),++ /// The software keyboard straight away, the way the phone worked before voice input.+ keyboard('Keyboard', 'Tap the terminal to type');++ const PhoneInputMode(this.label, this.detail);++ final String label;+ final String detail;++ static const fallback = voice;+}++/// The chosen [PhoneInputMode], remembered across launches.+///+/// Loaded by `loadPersistedSettings()` before the first frame, like the terminal's other+/// preferences: a terminal that opened voice input on its first tap and the keyboard on its second+/// would look like a bug rather than a late read.+class PhoneInputModeStore extends ValueNotifier<PhoneInputMode> {+ PhoneInputModeStore({LocalKeyValueStore? storage})+ : _storage = storage ?? HarnessFileStore.shared,+ super(PhoneInputMode.fallback);++ static const _key = 'phone_input_mode';++ final LocalKeyValueStore _storage;++ /// An unreadable file, or a mode name this build does not know, lands on the default.+ Future<void> load() async {+ try {+ final saved = await _storage.readMany([_key]);+ value =+ PhoneInputMode.values+ .where((mode) => mode.name == saved[_key])+ .firstOrNull ??+ PhoneInputMode.fallback;+ } catch (_) {+ value = PhoneInputMode.fallback;+ }+ }++ Future<void> set(PhoneInputMode mode) async {+ if (mode == value) return;+ value = mode;+ try {+ await _storage.write(_key, mode.name);+ } catch (_) {+ // Kept in memory for this run.+ }+ }+}++final phoneInputModeStore = PhoneInputModeStore();diff --git a/mobile/lib/phone/settings_page.dart b/mobile/lib/phone/settings_page.dartindex acfe705ee..d1148bd08 100644--- a/mobile/lib/phone/settings_page.dart+++ b/mobile/lib/phone/settings_page.dart@@ -13,6 +13,7 @@ import 'package:harness_mobile/terminal/terminal_font_store.dart';import 'package:harness_mobile/terminal/terminal_theme_store.dart';import 'phone_header.dart';+import 'phone_input_mode_store.dart';import 'phone_sheet.dart';import 'settings_row.dart';import 'stats_entry.dart';@@ -51,10 +52,14 @@ import 'usage_entry.dart';/// What a phone adds instead is the account and the machine links, which the desktop keeps in its/// rail footer — on a phone there is no rail, so this is the only way to reach either.class SettingsPage extends StatelessWidget {- const SettingsPage({super.key, required this.notifier});+ const SettingsPage({super.key, required this.notifier, this.large = true});final AppNotifier notifier;+ /// The tab's big title. Off when the page is pushed from a terminal's menu, where it needs the+ /// back chevron a large header does not draw.+ final bool large;+@overrideWidget build(BuildContext context) => ListenableBuilder(listenable: notifier,@@ -66,7 +71,7 @@ class SettingsPage extends StatelessWidget {bottom: false,child: Column(children: [- const PhoneHeader(large: true, title: 'Settings'),+ PhoneHeader(large: large, title: 'Settings'),Expanded(child: _Body(notifier: notifier)),],),@@ -116,7 +121,14 @@ class _Body extends StatelessWidget {],),const SettingsCaption('Terminal'),- SettingsGroup(children: [_FontRow(), _SizeRow(), _TerminalThemeRow()]),+ SettingsGroup(+ children: [+ _InputModeRow(),+ _FontRow(),+ _SizeRow(),+ _TerminalThemeRow(),+ ],+ ),const SettingsCaption('Appearance'),SettingsGroup(children: [_PaletteRow(), _TextSizeRow()]),const SettingsNote(@@ -181,6 +193,38 @@ class _Avatar extends StatelessWidget {}}+/// What a tap on the terminal opens: voice input (the default) or the keyboard, as before voice.+class _InputModeRow extends StatelessWidget {+ @override+ Widget build(BuildContext context) => ValueListenableBuilder(+ valueListenable: phoneInputModeStore,+ builder: (context, mode, _) {+ AppTheme.watch(context);+ return SettingsRow(+ title: 'Input',+ value: mode.label,+ onTap: () => showPhoneSheet(+ context,+ title: 'Tapping the terminal opens',+ actions: [+ for (final choice in PhoneInputMode.values)+ PhoneSheetAction(+ icon: choice == mode+ ? LucideIcons.check300+ : switch (choice) {+ PhoneInputMode.voice => LucideIcons.mic300,+ PhoneInputMode.keyboard => LucideIcons.keyboard300,+ },+ label: choice.label,+ onTap: () => unawaited(phoneInputModeStore.set(choice)),+ ),+ ],+ ),+ );+ },+ );+}+/// The terminal typeface. A sheet rather than a dropdown: a phone has room for the whole list.class _FontRow extends StatelessWidget {@overridediff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dartindex 700c29148..26dc4d8a9 100644--- a/mobile/lib/phone/terminal_page.dart+++ b/mobile/lib/phone/terminal_page.dart@@ -19,9 +19,12 @@ import 'package:harness_mobile/widgets/terminal_panel.dart';import 'agents_page.dart' show openNewAgent;import 'delete_agent.dart';import 'phone_header.dart';+import 'phone_input_mode_store.dart';+import 'phone_navigation.dart' show phoneRoute;import 'phone_search_page.dart' show openPhoneSearch;import 'phone_sheet.dart';import 'phone_status.dart';+import 'settings_page.dart';import 'status_pill.dart';import 'terminal_input_dock.dart';import 'voice_input_controller.dart';@@ -246,7 +249,19 @@ class _TerminalPageState extends State<TerminalPage>/// A tap on the terminal while no keyboard is up or coming: voice input,/// waiting on its mic button. Null while the keyboard is, so the tap is/// xterm's and the keyboard stays.- VoidCallback? get _onInputTap => _shouldFocus ? null : widget.voice.open;+ ///+ /// In [PhoneInputMode.keyboard] the same tap asks for the keyboard instead, the way the phone+ /// worked before voice input — through [_keyboardRequested], the path the Keyboard button in voice+ /// input already takes, so the two ways of getting a keyboard behave identically once it is up.+ VoidCallback? get _onInputTap {+ if (_shouldFocus) return null;+ return switch (phoneInputModeStore.value) {+ PhoneInputMode.voice => widget.voice.open,+ PhoneInputMode.keyboard => () => setState(+ () => _keyboardRequested = true,+ ),+ };+ }/// The Keyboard button in voice input. What was heard is typed into the/// prompt rather than dropped, so the keyboard picks up where the voice left@@ -367,7 +382,13 @@ class _TerminalPageState extends State<TerminalPage>return ListenableBuilder(// The panel opening or closing hides or shows the machine row — see// [_ownsInput]. Its open STATE only: what it hears repaints the panel.- listenable: Listenable.merge([widget.notifier, widget.voice.openState]),+ // The input mode too: Settings is pushed over this page, and what a tap opens has to follow a+ // change made there the moment the person comes back.+ listenable: Listenable.merge([+ widget.notifier,+ widget.voice.openState,+ phoneInputModeStore,+ ]),builder: (context, _) {AppTheme.watch(context);final pane = widget.notifier.panes@@ -687,6 +708,17 @@ class _TerminalPageState extends State<TerminalPage>label: 'Restart agent',onTap: () => unawaited(_restart()),),+ // Settings lives here now that the tab bar is hidden and the phone opens into a terminal:+ // this sheet is the one menu every screen the person actually sits on reaches.+ PhoneSheetAction(+ icon: LucideIcons.settings300,+ label: 'Settings',+ onTap: () => Navigator.of(context).push(+ phoneRoute(+ (_) => SettingsPage(notifier: widget.notifier, large: false),+ ),+ ),+ ),// Last, and alone in red: the two above are recoverable and this one is// not, so it does not sit where a thumb lands on the way to them.//