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 github.com:autonomous-ai/autonomous-harness into feat/mobile-ios-android

tony57340e3d186f
diff --cc mobile/lib/phone/terminal_page.dart
index 02903642b,5b383e673..94619195e
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@@ -7,16 -7,11 +7,16 @@@ import 'package:flutter/services.dart'
import 'package:image_picker/image_picker.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
- import 'package:harness_mobile/core/models.dart' show Agent;
+ import 'package:harness_mobile/core/models.dart' show AgentProject;
import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'package:harness_mobile/shared/widgets/app_icon_button.dart';
+import 'package:harness_mobile/shared/widgets/pulse.dart';
+import 'package:harness_mobile/shared/widgets/skeleton.dart';
import 'package:harness_mobile/state/app_state.dart';
import 'package:harness_mobile/terminal/image_transcode.dart';
+import 'package:harness_mobile/terminal/terminal_font_store.dart';
+import 'package:harness_mobile/terminal/terminal_theme.dart';
+import 'package:harness_mobile/terminal/terminal_theme_store.dart';
import 'package:harness_mobile/terminal/terminal_session.dart';
import 'package:harness_mobile/widgets/rename_agent_dialog.dart';
import 'package:harness_mobile/widgets/terminal_panel.dart';
@@@ -660,51 -569,13 +581,37 @@@ class _TerminalPageState extends State<
final agent = machine?.agents
.where((a) => a.id == widget.agentId)
.firstOrNull;
+ // ⚠️ **The agent this page opened on is not in the machine's own list.**
+ // Only ever true of a page opened from the cache (see [_AgentGone]): the
+ // list is the machine's — `agentsFromCache` is false, so a real
+ // `agents_list` has landed — it has been LOADED rather than merely
+ // attempted, and the agent it named is not in it.
+ //
+ // Every one of those conditions matters. Without `loaded` this would
+ // fire during the window the cache exists to cover; without
+ // `!agentsFromCache` it would fire against the cached list itself, which
+ // is where the agent came from; and a machine that errored or went
+ // offline has not disowned anything — it simply has not answered, and
+ // its pane keeps the terminal's own reconnect behaviour.
+ //
+ // Note this deliberately ignores `_hadPane`/`_leave` above: that path
+ // handles a pane REMOVED while the page was live. This one is about a
+ // page that should never have been built, answered before its pane
+ // could be.
+ final agentGone =
+ agent == null &&
+ machine != null &&
+ !machine.agentsFromCache &&
+ machine.agentLoadStatus == AgentLoadStatus.loaded;
+ // Captured while the agent is still listed, for the sentence above.
+ if (agent != null) _cachedAgentName = agent.name;
final reclaim = phoneReclaimAction(session);
- // The header's trailing controls, counted before they are built: their
- // slot is sized from this, and the search field is laid out against
- // that same width. The conditions must match the ones guarding each
- // control below — see [_TrailingFade.extentFor].
- //
- // ⚠️ [reclaim] is counted too, though it is a labelled button rather
- // than one of the fixed 24px icon boxes. It cannot be measured from a
- // constant — its width is its label's — so the slot treats it as a
- // MINIMUM rather than a fixed size: see [_TrailingFade], which floors
- // the width it is given instead of forcing it. Sizing it exactly is not
- // worth a second TextPainter for a button that shows only on a
- // read-only stream.
- final headerActions =
- (machine != null &&
- phoneMachineStatusOf(machine) == PhoneMachineStatus.ready
- ? 1
- : 0) +
- (agent != null ? 1 : 0) +
- (reclaim != null ? 1 : 0);
- final trailingExtent = _TrailingFade.extentFor(context, headerActions);
+ // 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 — the same gate the Agents tab puts on its fab.
+ final canCreate =
+ machine != null &&
+ phoneMachineStatusOf(machine) == PhoneMachineStatus.ready;
return Scaffold(
backgroundColor: AppPalette.windowBg,
// ⚠️ No fab. New agent is the `+` in the header — see the note there.
@@@ -809,52 -675,26 +716,50 @@@
),
),
),
+ // ⚠️ **The skeleton is laid OVER the live panel, not
+ // swapped in for it, and that is not a stylistic
+ // choice.** [TerminalPanel.initState] calls
+ // `session.attachViewport`, which is how the machine
+ // learns how many rows and columns to draw; a page
+ // that showed a skeleton INSTEAD would leave the
+ // session with no viewport, and the first keyframe
+ // would arrive sized for nothing.
+ //
+ // So the panel mounts, measures and resizes as always,
+ // and this covers the empty emulator buffer it paints
+ // meanwhile. `session == null` upstream keeps its own
+ // branch for the frames before a session exists at all.
+ //
+ // ⚠️ **This is also the bug that made the skeleton
+ // invisible.** The only gate used to be `session ==
+ // null`, and `selectAgent` creates the pane and the
+ // session in one frame — so the branch above was
+ // essentially never taken, and what a person actually
+ // waited in front of was a mounted terminal with an
+ // empty buffer: a black rectangle, for as long as the
+ // keyframe took.
+ if (session != null && !session.hasRenderedFrame)
+ const Positioned.fill(child: _Attaching()),
- // The mic — the one voice control the page has,
- // floating over the terminal's bottom right corner
- // rather than sitting in a row of its own.
+ // The mic, Search and New agent, floating in the
+ // terminal's bottom-right corner — see
+ // [TerminalActionColumn].
//
- // ⚠️ Hidden while this page owns the keyboard, the
- // same gate the foot row takes. Typing is the other
- // way of saying the same thing, the key bar is
- // already under the thumb, and a button floating
- // over it would be in the way of both.
- if (session != null && !_ownsInput)
+ // ⚠️ Hidden while this page owns the keyboard.
+ // Typing is the other way of saying what the mic
+ // says, the key bar is already under the thumb, and
+ // a column floating over the prompt being typed into
+ // would be in the way of both.
+ if (!_ownsInput)
Positioned(
- right: VoiceMicFab.inset,
- bottom: VoiceMicFab.inset,
- child: VoiceMicFab(
+ right: TerminalActionColumn.inset,
+ bottom: TerminalActionColumn.bottomInset,
+ child: TerminalActionColumn(
voice: widget.voice,
session: session,
- onSlipChanged: (off) {
- if (!mounted || off == _micSlippedOff) {
- return;
- }
- setState(() => _micSlippedOff = off);
- },
+ onSearch: _openSearch,
+ onNewAgent: canCreate
+ ? () => unawaited(_newAgent())
+ : null,
),
),
],