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.

Merge branch 'feat/mobile-ios-android' of https://github.com/autonomous-ai/autonomous-harness into feat/mobile-ios-android

Dev jacob15c11feb0b29
diff --cc mobile/lib/phone/terminal_page.dart
index a69fead6d,997b3344e..e1e3495ca
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@@ -235,49 -277,36 +235,49 @@@ class _TerminalPageState extends State<
});
}
- /// Whether [TerminalPanel] should hold the input connection.
- ///
- /// Two different questions, and [_claimSpent] alone can only answer one:
- ///
- /// - **Raise a keyboard that is down.** One chance per page, spent the
- /// moment the keyboard appears, so Back can put it away without the claim
- /// fetching it straight back — see [_claimSpent].
- /// - **Hold a keyboard that is already up.** What swiping between agents
- /// needs: the outgoing page releases focus, and unless the incoming one
- /// takes it in the same frame the platform closes the keyboard.
+ /// Whether [TerminalPanel] should hold the input connection: while the
+ /// keyboard is up, and while one is on its way — see [_keyboardRequested].
///
- /// ⚠️ The second case reads [_keyboardIsUp], the one screen-wide fact, rather
- /// than anything this page remembers. Per-page flags get the pager wrong in
- /// both directions: [_claimSpent] is armed by a parked neighbour merely
- /// WATCHING the keyboard rise, and it is never armed at all on a page built
- /// while the keyboard was down — so a page coming back for its second turn
- /// was indistinguishable from one opened fresh, and summoned a keyboard the
- /// person had dismissed two agents away. [_hasHadATurn] closes that: the
- /// summon belongs to a page's first turn only.
+ /// ⚠️ Holding reads [_keyboardIsUp], the one screen-wide fact, rather than
+ /// anything this page remembers — see that flag for why swiping needs it.
bool get _shouldFocus =>
- widget.isActive &&
- (_keyboardIsUp || (!_claimSpent && !_hasHadATurn && !_keyboardDismissed));
+ widget.isActive && (_keyboardIsUp || _keyboardRequested);
+
+ /// 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;
+
+ /// 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
+ /// off — to correct a word, or to finish the sentence. A take still being
+ /// recorded is transcribed first: pressing Keyboard mid-sentence is asking to
+ /// fix that sentence, not to lose it.
+ Future<void> _useKeyboard(TerminalSession session) async {
+ final heard = await widget.voice.takeTranscript();
+ if (!mounted) return;
+ widget.voice.close();
+ if (heard.isNotEmpty && session.acceptsInput) {
+ session.terminal.textInput(heard);
+ }
+ setState(() => _keyboardRequested = true);
+ }
- /// Puts the keyboard away without leaving the page — the `⌄` key on
- /// [TerminalKeyBar]. Dropping focus is what closes the input connection;
- /// xterm reopens it on the next tap in the pane.
- void _dismissKeyboard() => FocusManager.instance.primaryFocus?.unfocus();
+ /// Puts away whichever input is up without leaving the page — the `⌄` key on
+ /// [TerminalKeyBar]. Dropping focus is what closes the input connection.
+ void _dismissInput() {
+ widget.voice.close();
+ FocusManager.instance.primaryFocus?.unfocus();
+ if (_keyboardRequested) setState(() => _keyboardRequested = false);
+ }
- /// Whether the keyboard on screen is THIS page's — the question the header
- /// chrome asks, which [_keyboardUp] alone answers wrongly.
+ /// Whether an input on screen is THIS page's — the keyboard, or voice input
- /// in its place — the question the header chrome asks, which [_keyboardUp]
- /// alone answers wrongly.
++ /// in its place — the question the machine row at the foot of the page asks,
++ /// which [_keyboardUp] alone answers wrongly.
+ ///
+ /// Voice input counts for the same reason the keyboard does: the panel takes
- /// the keyboard's place, and the header actions and the machine row are
- /// chrome the page does not need while someone is talking to the agent.
++ /// the keyboard's place, and a status line under it is a row the terminal
++ /// loses while someone is talking to the agent.
///
/// ⚠️ [_keyboardUp] means "an inset exists", not "this page raised it". A
/// pushed page with a text field — search, rename — raises one of its own,
@@@ -285,7 -314,7 +285,7 @@@
/// and so still records the keyboard as up. It then stops receiving ticks
/// once it is no longer the route being laid out, so the fall back to zero
/// after that page closes never reaches it: the flag stays true forever and
-- /// the header controls it hides never come back.
++ /// the row it hides never comes back.
///
/// [ModalRoute.isCurrent] is what separates the two. False while anything is
/// stacked above, so an inset belonging to that page is not read as this
@@@ -365,9 -393,7 +365,9 @@@
@override
Widget build(BuildContext context) {
return ListenableBuilder(
- // The panel opening or closing moves the header chrome — see
- listenable: widget.notifier,
++ // 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]),
builder: (context, _) {
AppTheme.watch(context);
final pane = widget.notifier.panes
@@@ -482,25 -507,30 +481,30 @@@
// [openPhoneSearch] is the same search that spans agents
// and machines.
//
- // ⚠️ Hidden while the keyboard or voice input is up, with
- // `+`. The header is one row, and a terminal being typed or
- // talked into is the one moment neither is what the thumb is
- // reaching for.
+ // ⚠️ Shown while the keyboard is up, and so is `+`. Both
- // were once hidden on `!_ownsKeyboard`, to spare a one-row
++ // were once hidden on `!_ownsInput`, to spare a one-row
+ // header while typing — but the row is not what was short.
+ // The title ellipses at the same width either way, so
+ // hiding them bought the title nothing and only left a gap,
+ // while the header's controls jumped position on every
+ // keyboard raise. A header that holds still is worth more
+ // than two columns of unused space.
+ //
// ⚠️ Not [PhoneSearchButton], which pushes and forgets. A
// page that pops back onto the top gets no rebuild of its
- // own, so [_ownsInput] would keep answering with what
- // was true while the search was covering it. Awaiting the
- // push is what turns "the search closed" into a frame.
- if (!_ownsInput)
- _HeaderAction(
- icon: LucideIcons.search300,
- size: 21,
- tooltip: 'Search',
- onPressed: () async {
- await openPhoneSearch(context, widget.notifier);
- if (mounted) setState(() {});
- },
- ),
- // own, so anything read from [_ownsKeyboard] — the machine
++ // own, so anything read from [_ownsInput] — the machine
+ // bar below still does — would keep answering with what was
+ // true while the search was covering it. Awaiting the push
+ // is what turns "the search closed" into a frame.
+ _HeaderAction(
+ icon: LucideIcons.search300,
+ size: 21,
+ tooltip: 'Search',
+ onPressed: () async {
+ await openPhoneSearch(context, widget.notifier);
+ if (mounted) setState(() {});
+ },
+ ),
// Null while the agent is not loaded: there is nothing to act on yet, and a
// menu of actions that all fail is worse than no menu.
if (agent != null)