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 jacob7ecf2ec28ac3
diff --cc mobile/lib/phone/terminal_page.dart
index c93824db3,0216dcd18..e465a5c03
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@@ -236,50 -277,36 +235,50 @@@ 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,
+ /// already recording. Null while the keyboard is, so the tap is xterm's and
+ /// the keyboard stays.
+ VoidCallback? get _onInputTap =>
+ _shouldFocus ? null : () => unawaited(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.
+ ///
+ /// Voice input counts for the same reason the keyboard does: the panel takes
- /// the keyboard's place, so the fab would float over its Send button and the
- /// machine row would sit under it.
++ /// 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.
///
/// ⚠️ [_keyboardUp] means "an inset exists", not "this page raised it". A
/// pushed page with a text field — search, rename — raises one of its own,
@@@ -476,34 -462,66 +437,66 @@@
widget.agentId,
),
),
+ // New agent, search and the actions menu: the three the
+ // page offers, in the order they are reached for — create,
+ // find, then everything else.
+ //
+ // ⚠️ They are spaced by [_HeaderAction], not drawn bare.
+ // [AppIconButton] is a fixed 24px box whatever glyph size
+ // it is given, so a 22px search glyph fills its box edge to
+ // edge while a 20px ellipsis sits inside one — three
+ // buttons butted together then read as unevenly spaced
+ // when the gaps are in fact identical. One glyph size and
+ // one padding across the three is what evens the rhythm.
+ //
+ // ⚠️ `+` here rather than floating over the terminal. A fab
+ // covers the last line of output — the line being read —
+ // and this page has no list to scroll it clear of.
+ //
+ // Gated on the machine ANSWERING, the same gate the Agents
+ // tab puts on its fab: creating needs the machine to list
+ // its folders and name its engines, so one that is offline
+ // or still wants its password cannot host a new agent.
- if (!_ownsKeyboard &&
++ if (!_ownsInput &&
+ machine != null &&
+ phoneMachineStatusOf(machine) ==
+ PhoneMachineStatus.ready)
+ _HeaderAction(
+ icon: LucideIcons.plus300,
+ size: 21,
+ tooltip: 'New agent',
+ // Awaited for the same reason search is: the form may
+ // be backed out of rather than completed, and this page
+ // gets no rebuild when it lands back on top.
+ onPressed: () async {
+ await openNewAgent(
+ context,
+ widget.notifier,
+ widget.machineId,
+ );
+ if (mounted) setState(() {});
+ },
+ ),
// Search is here because this page is where the phone now
// opens, so what the list screens offered has to be
// reachable without going back to them first:
// [openPhoneSearch] is the same search that spans agents
// and machines.
//
- // ⚠️ `+` is NOT beside it any more — it is the [PhoneFab]
- // over the terminal. Two bare glyphs at the end of a row
- // whose other end is a whole back band gave the corner
- // three targets and told the eye nothing about which one
- // creates something; the fab says that by being the only
- // filled thing on the page.
- //
- // ⚠️ Still hidden while the keyboard or voice input is
- // up. The header is one row, and a terminal being typed or
- // talked into is the one moment search is not what the
- // thumb is reaching for.
- // ⚠️ Hidden while the keyboard is up, with `+`. The header
- // is one row, and a terminal being typed into is the one
- // moment neither is what the thumb is reaching for — the
- // key bar directly under it is.
++ // ⚠️ 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.
// ⚠️ Not [PhoneSearchButton], which pushes and forgets. A
// page that pops back onto the top gets no rebuild of its
- // own, so [_ownsKeyboard] would keep answering with what
+ // 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 (!_ownsKeyboard)
+ if (!_ownsInput)
- AppIconButton(
+ _HeaderAction(
icon: LucideIcons.search300,
- size: 22,
+ size: 21,
tooltip: 'Search',
- color: AppPalette.textSecondary,
onPressed: () async {
await openPhoneSearch(context, widget.notifier);
if (mounted) setState(() {});