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 'main' into feat/mobile-ios-android

tony935cdf36a63f
diff --cc mobile/lib/phone/device_detail_page.dart
index 6e965f557,7ae6a6f68..038ec763a
--- a/mobile/lib/phone/device_detail_page.dart
+++ b/mobile/lib/phone/device_detail_page.dart
@@@ -99,114 -98,100 +99,123 @@@ class _DeviceDetailPageState extends St
backgroundColor: tty.ground,
body: SafeArea(
bottom: false,
- child: ListView(
- padding: EdgeInsets.fromLTRB(
- Tty.origin,
- 12,
- Tty.origin,
- MediaQuery.paddingOf(context).bottom + 24,
- ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- TtyText(_name, size: TtySize.title, weight: FontWeight.w600),
- const SizedBox(height: 12),
- SettingsGroup(
- children: [
- SettingsRow(
- title: 'Kind',
- value: isMachine ? 'Computer' : 'App',
+ // Always pushed — from Your devices, the new-device banner or its notification — so it
+ // carries the way back as Your devices does: above the title, outside the list.
+ if (canPop)
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TtyBackButton(
+ onPressed: () => Navigator.of(context).maybePop(),
),
- SettingsRow(
- title: 'Added',
- value: fullDateTime(
- DateTime.fromMillisecondsSinceEpoch(member.addedAt),
- ),
+ ),
+ Expanded(
+ child: ListView(
+ padding: EdgeInsets.fromLTRB(
+ Tty.origin,
+ canPop ? 8 : 12,
+ Tty.origin,
+ MediaQuery.paddingOf(context).bottom + 24,
),
- if (lastSeen != null)
- SettingsRow(
- title: 'Last active',
- value: relativeAgo(
- DateTime.fromMillisecondsSinceEpoch(lastSeen),
- now,
- ),
+ children: [
+ TtyText(_name, size: TtySize.title, weight: FontWeight.w600),
+ const SizedBox(height: 12),
+ SettingsGroup(
+ children: [
+ SettingsRow(
+ title: 'Kind',
+ value: isMachine ? 'Computer' : 'App',
+ ),
+ SettingsRow(
+ title: 'Added',
+ value: fullDateTime(
+ DateTime.fromMillisecondsSinceEpoch(member.addedAt),
+ ),
+ ),
+ if (lastSeen != null)
+ SettingsRow(
+ title: 'Last active',
+ value: relativeAgo(
+ DateTime.fromMillisecondsSinceEpoch(lastSeen),
+ now,
+ ),
+ ),
+ if (isMachine && member.machineId.isNotEmpty)
+ SettingsRow(
+ title: 'Machine',
+ value: member.machineId.substring(
+ 0,
+ member.machineId.length < 8
+ ? member.machineId.length
+ : 8,
+ ),
+ ),
++ // Another of the person's devices said "It's mine" for it while it was new
++ // here: where the banner would have been, the page says where it was settled.
++ if (_row.confirmed case final confirmed?)
++ SettingsRow(
++ key: const Key('device-detail-confirmed'),
++ title: 'Confirmed',
++ value:
++ 'on ${confirmed.label.trim().isEmpty ? 'another device' : confirmed.label.trim()}',
++ ),
+ ],
),
- if (isMachine && member.machineId.isNotEmpty)
- SettingsRow(
- title: 'Machine',
- value: member.machineId.substring(
- 0,
- member.machineId.length < 8 ? member.machineId.length : 8,
+ if (fp.isNotEmpty) ...[
+ const SizedBox(height: 16),
+ FingerprintBlock(
+ fp,
+ large: true,
+ copyKey: const Key('device-detail-copy'),
),
- ),
- // Another of the person's devices said "It's mine" for it while it was new here: where
- // the banner would have been, the page says where it was settled.
- if (_row.confirmed case final confirmed?)
- SettingsRow(
- key: const Key('device-detail-confirmed'),
- title: 'Confirmed',
- value: 'on ${confirmed.label.trim().isEmpty ? 'another device' : confirmed.label.trim()}',
- ),
- ],
- ),
- if (fp.isNotEmpty) ...[
- const SizedBox(height: 16),
- FingerprintBlock(
- fp,
- large: true,
- copyKey: const Key('device-detail-copy'),
- ),
- const SizedBox(height: 8),
- // Wraps: the explanation is a sentence, not a terminal line.
- Text(
- fingerprintHowToCompare(computer: isMachine),
- style: tty.style(color: tty.dim),
- ),
- ],
- if (_row.suspended) ...[
- const SizedBox(height: 12),
- Text(
- 'Not trusted here: added after this device’s list and another’s split. '
- 'Review the list to trust it again.',
- style: tty.style(color: tty.red),
- ),
- ],
- if (_error case final error?) ...[
- const SizedBox(height: 12),
- Text(error, style: tty.style(color: tty.red)),
- ],
- if (widget.isNew || !_row.self) ...[
- const SizedBox(height: 16),
- SettingsGroup(
- children: [
- if (widget.isNew)
- SettingsRow(
- key: const Key('device-detail-mine'),
- title: 'It’s mine',
- onTap: _removing ? null : _mine,
+ const SizedBox(height: 8),
+ // Wraps: the explanation is a sentence, not a terminal line.
+ Text(
+ fingerprintHowToCompare(computer: isMachine),
+ style: tty.style(color: tty.dim),
+ ),
+ ],
+ if (_row.suspended) ...[
+ const SizedBox(height: 12),
+ Text(
+ 'Not trusted here: added after this device’s list and another’s split. '
+ 'Review the list to trust it again.',
+ style: tty.style(color: tty.red),
),
- if (!_row.self)
- SettingsRow(
- key: const Key('device-detail-remove'),
- title: _removing ? 'Removing…' : 'Remove this device',
- destructive: true,
- onTap: _removing ? null : () => unawaited(_remove()),
+ ],
+ if (_error case final error?) ...[
+ const SizedBox(height: 12),
+ Text(error, style: tty.style(color: tty.red)),
+ ],
+ if (widget.isNew || !_row.self) ...[
+ const SizedBox(height: 16),
+ SettingsGroup(
+ children: [
+ if (widget.isNew)
+ SettingsRow(
+ key: const Key('device-detail-mine'),
+ title: 'It’s mine',
+ onTap: _removing ? null : _mine,
+ ),
+ if (!_row.self)
+ SettingsRow(
+ key: const Key('device-detail-remove'),
+ title: _removing
+ ? 'Removing…'
+ : 'Remove this device',
+ destructive: true,
+ onTap: _removing
+ ? null
+ : () => unawaited(_remove()),
+ ),
+ ],
),
+ ],
],
),
- ],
+ ),
],
),
),
diff --cc mobile/lib/phone/machine_actions.dart
index aea7be4f4,3ba40b404..7f6275ee8
--- a/mobile/lib/phone/machine_actions.dart
+++ b/mobile/lib/phone/machine_actions.dart
@@@ -11,20 -9,13 +11,19 @@@ import 'link_page.dart'
import 'phone_navigation.dart';
import 'phone_sheet.dart';
import 'phone_status.dart';
+import 'remove_machine.dart';
import 'unlink_machine.dart';
- import 'team_page.dart';
-/// A machine that wants its password opens the form for it. One that is linked opens a sheet of
-/// what can be done TO it — reload its agents, re-enter its password, unlink this phone.
+/// The sheet of what can be done TO a computer — Settings ▸ Computers.
///
-/// Read at the tap, not when the row was drawn, so a machine that got linked in between gets the
-/// sheet rather than a form it no longer needs.
+/// Every computer opens it, whatever it reads, because what the account can do to a computer does
+/// not wait on the computer: a rename and a removal are the backend's (`AppNotifier.renameMachine`,
+/// `deleteMachine`), and an asleep or locked one is as likely as any to be the one somebody wants to
- /// rename or take off the account. What its own socket can do — its swarms, its harnesses, its
- /// password — is offered only where it answers.
++/// rename or take off the account. What its own socket can do — its harnesses, its password — is
++/// offered only where it answers.
+///
+/// Read at the tap, not when the row was drawn, so a computer that got linked in between gets the
+/// sheet for what it is now.
void openMachineActions(
BuildContext context,
AppNotifier notifier,
@@@ -32,100 -23,14 +31,90 @@@
) {
final machine = notifier.stateOf(machineId);
if (machine == null) return;
- switch (phoneMachineStatusOf(machine)) {
+ final status = phoneMachineStatusOf(machine);
+ final retrying = notifier.machineRetrying(machineId);
+ final removing = notifier.machineRemoving(machineId);
+
+ // Asleep or stuck connecting: the one thing worth a tap is asking it again.
+ final tryAgain = PhoneSheetAction(
+ icon: LucideIcons.refreshCw300,
+ label: 'Try again',
+ value: retrying ? 'trying…' : null,
+ enabled: !retrying && !removing,
+ onTap: () => unawaited(retryComputer(context, notifier, machineId)),
+ );
+ final rename = PhoneSheetAction(
+ icon: LucideIcons.pencil300,
+ label: 'Rename…',
+ enabled: !removing,
+ onTap: () =>
+ unawaited(showMachineRenameDialog(context, notifier, machineId)),
+ );
+ final remove = PhoneSheetAction(
+ icon: LucideIcons.trash2300,
+ label: 'Remove from account…',
+ destructive: true,
+ value: removing ? 'removing…' : null,
+ enabled: !removing,
+ onTap: () => unawaited(confirmRemoveMachine(context, notifier, machineId)),
+ );
+
+ final List<PhoneSheetAction> actions;
+ final List<PhoneSheetAction> destructive;
+ switch (status) {
case PhoneMachineStatus.offline:
- return;
+ actions = [tryAgain, rename];
+ destructive = [remove];
case PhoneMachineStatus.needsPassword:
- openMachine(context, notifier, machineId);
- return;
+ actions = [
+ // First, because it is what the row said a tap would do.
+ PhoneSheetAction(
+ icon: LucideIcons.lockOpen300,
+ label: 'Unlock…',
+ chevron: true,
+ enabled: !removing,
+ onTap: () => Navigator.of(context).push(
+ phoneRoute(
+ (_) => LinkPage(notifier: notifier, machineId: machineId),
+ ),
+ ),
+ ),
+ rename,
+ ];
+ destructive = [remove];
case PhoneMachineStatus.connecting || PhoneMachineStatus.ready:
- break;
+ actions = [
- PhoneSheetAction(
- icon: LucideIcons.users300,
- label: 'Swarms',
- chevron: true,
- onTap: () => Navigator.of(context).push(
- phoneRoute(
- (_) => TeamPage(notifier: notifier, machineId: machineId),
- ),
- ),
- ),
+ if (status == PhoneMachineStatus.connecting)
+ tryAgain
+ else
+ PhoneSheetAction(
+ icon: LucideIcons.refreshCw300,
+ label: 'Reload harnesses',
+ onTap: () => unawaited(notifier.reloadMachineData(machineId)),
+ ),
+ rename,
+ PhoneSheetAction(
+ icon: LucideIcons.keyRound300,
+ label: 'Re-enter password…',
+ onTap: () => Navigator.of(context).push(
+ phoneRoute(
+ (_) => LinkPage(notifier: notifier, machineId: machineId),
+ ),
+ ),
+ ),
+ ];
+ destructive = [
+ // No confirmation, the same as before: this sheet is the step between the tap and the
+ // unlink. Removing from the account asks, because it reaches every device.
+ PhoneSheetAction(
+ icon: LucideIcons.unlink300,
+ label: 'Unlink this phone',
+ destructive: true,
+ enabled: !removing,
+ onTap: () => unawaited(unlinkThisPhone(context, notifier, machine)),
+ ),
+ remove,
+ ];
}
showPhoneSheet(
context,
diff --cc mobile/lib/phone/terminal_page.dart
index 644674e43,25fb8d1bf..46bed1931
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@@ -48,11 -47,8 +48,10 @@@ import 'phone_status.dart'
import 'settings_page.dart';
import 'session_work_page.dart';
import 'terminal_action_column.dart';
- import 'team_page.dart';
import 'terminal_chrome_scroll.dart';
import 'terminal_input_dock.dart';
+import 'terminal_copy.dart';
+import 'terminal_paste.dart';
import 'terminal_search.dart';
import 'tty.dart';
import 'tty_controls.dart';
@@@ -2032,11 -1877,8 +2029,8 @@@ class _TerminalPageState extends State<
_pickAnotherAgent,
)
: pane == null || session == null
- ? _Attaching(key: _skeletonKey)
+ ? placeholder
: TerminalPanel(
- tabId: widget
- .notifier
- .activeSwarmId,
key: ValueKey(pane.id),
notifier: widget.notifier,
session: session,
diff --cc mobile/lib/phone/welcome/how_it_works.dart
index 53f5dd701,db3054fe5..e957b32ed
--- a/mobile/lib/phone/welcome/how_it_works.dart
+++ b/mobile/lib/phone/welcome/how_it_works.dart
@@@ -26,8 -26,6 +26,8 @@@ class HowItWorksPage extends StatelessW
'context. You can run several harnesses with the same agent. '
'They keep going when you close the app.',
),
+ // "Tab", not "Swarm": the naming system's word for a group of harnesses
- // (`docs/naming-system.md`), and the desktop's setting is Tab collaboration now.
++ // (`docs/naming-system.md`), and Agent Messages is what lets a tab's agents talk.
(
'Tab',
'A group of harnesses, shown together in the workspace. Add a harness to '
diff --cc mobile/lib/state/app_state.dart
index 03f84347c,1dba0a282..83b5c407c
--- a/mobile/lib/state/app_state.dart
+++ b/mobile/lib/state/app_state.dart
@@@ -8497,17 -6358,7 +8450,9 @@@ class AppNotifier extends ChangeNotifie
@override
void dispose() {
- for (final controller in _teamControllers.values) {
- controller.dispose();
- }
- _teamControllers.clear();
- for (final controller in _channelControllers.values) {
- controller.dispose();
- }
- _channelControllers.clear();
_disposed = true;
+ // A sign-in page still up has nobody left to come back to: its listener goes.
+ if (signInProvider != null) viewer.login.cancel();
_closedHistory.clear();
_stopAccountTimers();
_stopAllOfflineRetries();
diff --cc mobile/lib/terminal/terminal_session.dart
index b978b48b9,1b5dd55b6..8a85861a8
--- a/mobile/lib/terminal/terminal_session.dart
+++ b/mobile/lib/terminal/terminal_session.dart
@@@ -1694,21 -1296,8 +1687,16 @@@ class TerminalSession extends ChangeNot
}
void _onTerminalOutput(String data) {
+ if (kTypingTrace && data.isNotEmpty) {
+ typingTrace(
+ acceptsInput
+ ? 'pty in "${traceText(data)}"'
+ : 'pty in DROPPED — not taking input (status=${status.name}'
+ ' stream=${streamId != null} watching=$watching) "${traceText(data)}"',
+ );
+ }
if (!acceptsInput || data.isEmpty) return;
data = _spendArmedControl(data);
- final origin = _swarmInput ? inputTabId : null;
- if (_inputBytes.isNotEmpty && _bufferedInputTabId != origin) {
- unawaited(_flushInput());
- }
- _bufferedInputTabId = origin;
final bytes = utf8.encode(data);
final isBoundary =
data.contains('\r') ||
diff --cc mobile/lib/widgets/terminal_panel.dart
index 67e35c8cf,cc2685dc5..d9dccaf36
--- a/mobile/lib/widgets/terminal_panel.dart
+++ b/mobile/lib/widgets/terminal_panel.dart
@@@ -530,8 -453,6 +525,7 @@@ class _TerminalPanelState extends State
}
void _handleFocusChange() {
+ if (kTypingTrace) typingEvent('panel focus=${_focusNode.hasFocus}');
- if (_focusNode.hasFocus) widget.session.inputTabId = widget.tabId;
_syncCursorBlink();
}