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.

Mobile: Computer use on a Harness OS computer; Set up Intern 3 calls the computer Intern 3 (#2138)

Bubu-Dudu-52hz6faddbf878e5
diff --git a/mobile/lib/phone/add_device/add_device_page.dart b/mobile/lib/phone/add_device/add_device_page.dart
index d13887f95..1dd7be4fd 100644
--- a/mobile/lib/phone/add_device/add_device_page.dart
+++ b/mobile/lib/phone/add_device/add_device_page.dart
@@ -56,20 +56,20 @@ class _Steps extends StatelessWidget {
static const steps = [
(
- 'Turn the computer on',
+ 'Turn Intern 3 on',
'Plug it in and switch it on. In about a minute it opens a Wi-Fi named "Harness-…".',
),
(
'Find it',
- 'This phone looks for that Wi-Fi and joins it. Stay close to the computer.',
+ 'This phone looks for that Wi-Fi and joins it. Stay close to Intern 3.',
),
(
'Its password',
- 'If it asks: the computer\'s password, the one set when it was installed.',
+ 'If it asks: Intern 3\'s password, the one set when it was installed.',
),
(
'Its Wi-Fi',
- 'Choose the Wi-Fi the computer should use, and type its password.',
+ 'Choose the Wi-Fi Intern 3 should use, and type its password.',
),
(
'Online',
@@ -361,7 +361,7 @@ class _AddDevicePageState extends State<AddDevicePage> {
if (joined.state == 'unavailable') {
_show(
_Step.join,
- error: 'No device was chosen. Check it is plugged in and nearby: its Wi-Fi is named "Harness-…".',
+ error: 'Intern 3 was not chosen. Check it is plugged in and nearby: its Wi-Fi is named "Harness-…".',
);
return;
}
@@ -461,7 +461,7 @@ class _AddDevicePageState extends State<AddDevicePage> {
Future<void> _unlock() async {
final secret = _secret.text;
if (secret.isEmpty) {
- _show(_Step.unlock, error: 'Enter the computer\'s password.');
+ _show(_Step.unlock, error: 'Enter Intern 3\'s password.');
return;
}
setState(() => _busy = true);
@@ -782,7 +782,7 @@ class _AddDevicePageState extends State<AddDevicePage> {
_show(
_Step.waiting,
error:
- 'The device did not come online on "$ssid". If its hotspot is back, it tells why: '
+ 'Intern 3 did not come online on "$ssid". If its hotspot is back, it tells why: '
'join it again.',
);
}
@@ -856,17 +856,17 @@ class _AddDevicePageState extends State<AddDevicePage> {
case _Step.start:
return [
if (_begun)
- say('Getting ready to sign the computer in…')
+ say('Getting ready to sign Intern 3 in…')
else
say(
- 'When the computer is on and its Wi-Fi "Harness-…" is up, tap Find the device.',
+ 'When Intern 3 is on and its Wi-Fi "Harness-…" is up, tap Find Intern 3.',
),
];
case _Step.join:
return [
if (SetupHotspot.joinsByItself)
say(
- 'Choose the device, "Harness-…", from the Wi-Fi list. Then wait here.',
+ 'Choose Intern 3, "Harness-…", from the Wi-Fi list. Then wait here.',
)
else
say(
@@ -875,7 +875,7 @@ class _AddDevicePageState extends State<AddDevicePage> {
if (_retrying) ...[
const SizedBox(height: 12),
say(
- 'The device is still trying the Wi-Fi. Its hotspot comes back within a minute.',
+ 'Intern 3 is still trying the Wi-Fi. Its hotspot comes back within a minute.',
),
],
if (_unlocked) ...[
@@ -890,7 +890,7 @@ class _AddDevicePageState extends State<AddDevicePage> {
_Line(
done: _progress.index > _Progress.choosing.index,
text: _progress.index > _Progress.choosing.index
- ? 'Joined the device\'s Wi-Fi${_address == null ? '' : ' · address $_address'}'
+ ? 'Joined Intern 3\'s Wi-Fi${_address == null ? '' : ' · address $_address'}'
: SetupHotspot.joinsByItself
? 'Choose "Harness-…" from the list…'
: 'Waiting for this phone to join "Harness-…"…',
@@ -899,32 +899,29 @@ class _AddDevicePageState extends State<AddDevicePage> {
_Line(
done: _progress.index > _Progress.talking.index,
text: _progress.index > _Progress.talking.index
- ? 'The device answered'
- : 'Talking to the device…',
+ ? 'Intern 3 answered'
+ : 'Talking to Intern 3…',
),
if (_progress == _Progress.reading)
- const _Line(
- done: false,
- text: 'Reading the Wi-Fi the device sees…',
- ),
+ const _Line(done: false, text: 'Reading the Wi-Fi Intern 3 sees…'),
];
case _Step.unlock:
return [
say(
_checkFirst
- ? '$name is locked. Enter the computer\'s password — the one set when it was '
+ ? '$name is locked. Enter Intern 3\'s password — the one set when it was '
'installed. It is checked first; then you choose its Wi-Fi.'
: _lockedSetup
- ? 'Last, the computer\'s password — the one set when it was installed. $name '
+ ? 'Last, Intern 3\'s password — the one set when it was installed. $name '
'starts with it, joins "${_ssid.text.trim()}" and signs in to your account.'
- : '$name is locked. Enter the computer\'s password — the one set when it was '
+ : '$name is locked. Enter Intern 3\'s password — the one set when it was '
'installed — to start it.',
),
const SizedBox(height: 8),
TtyField(
key: const Key('add-device-unlock-password'),
controller: _secret,
- hint: 'Computer password',
+ hint: 'Intern 3 password',
autofocus: true,
keyboardType: TextInputType.visiblePassword,
obscure: !_reveal,
@@ -943,9 +940,7 @@ class _AddDevicePageState extends State<AddDevicePage> {
];
case _Step.networks:
return [
- say(
- 'Choose the Wi-Fi for the device. It is the list the device sees.',
- ),
+ say('Choose the Wi-Fi for Intern 3. It is the list Intern 3 sees.'),
const SizedBox(height: 12),
SettingsGroup(
children: [
@@ -1058,7 +1053,7 @@ class _AddDevicePageState extends State<AddDevicePage> {
return [
TtyPrimaryButton(
key: const Key('add-device-continue'),
- label: _begun ? 'Try again' : 'Find the device',
+ label: _begun ? 'Try again' : 'Find Intern 3',
busy: _busy,
busyLabel: 'Preparing…',
onPressed: () => unawaited(_start()),
@@ -1135,7 +1130,7 @@ class _AddDevicePageState extends State<AddDevicePage> {
if (_error.isNotEmpty)
TtyPrimaryButton(
key: const Key('add-device-rejoin'),
- label: 'Join the device again',
+ label: 'Join Intern 3 again',
onPressed: () => unawaited(_join()),
)
else ...[
diff --git a/mobile/lib/phone/add_device/setup_hotspot.dart b/mobile/lib/phone/add_device/setup_hotspot.dart
index 9bd404f4b..fdd335b0a 100644
--- a/mobile/lib/phone/add_device/setup_hotspot.dart
+++ b/mobile/lib/phone/add_device/setup_hotspot.dart
@@ -89,7 +89,7 @@ class SetupHotspot {
);
final list = (res.data is Map ? (res.data as Map)['networks'] : null);
if (res.statusCode != 200 || list is! List) {
- throw const SetupException('The device did not send its Wi-Fi list.');
+ throw const SetupException('Intern 3 did not send its Wi-Fi list.');
}
return [
for (final row in list)
@@ -119,13 +119,13 @@ class SetupHotspot {
);
} on DioException {
throw const SetupException(
- 'Lost the device\'s Wi-Fi. Stay close to it and try again.',
+ 'Lost Intern 3\'s Wi-Fi. Stay close to it and try again.',
);
}
if (res.statusCode == 200) return null;
final body = res.data is Map ? res.data as Map : const {};
return body['message'] as String? ??
- 'The device said no (${res.statusCode}).';
+ 'Intern 3 said no (${res.statusCode}).';
}
/// The computer's password, for a device still locked as it starts: its disk opens with it, and
@@ -155,7 +155,7 @@ class SetupHotspot {
// The page could not even be reached: the phone is off its hotspot.
if (e.type == DioExceptionType.connectionTimeout) {
throw const SetupException(
- 'Lost the device\'s Wi-Fi. Stay close to it and try again.',
+ 'Lost Intern 3\'s Wi-Fi. Stay close to it and try again.',
);
}
// Sent, and the hotspot went before the answer: most likely it opened, and the device is
@@ -165,7 +165,7 @@ class SetupHotspot {
if (res.statusCode == 200) return null;
final body = res.data is Map ? res.data as Map : const {};
return body['message'] as String? ??
- 'The device said no (${res.statusCode}).';
+ 'Intern 3 said no (${res.statusCode}).';
}
/// Hands the device the Wi-Fi and the ticket, or on a cable ([ssid] empty) the ticket alone.
@@ -185,13 +185,13 @@ class SetupHotspot {
);
} on DioException {
throw const SetupException(
- 'Lost the device\'s Wi-Fi. Stay close to it and try again.',
+ 'Lost Intern 3\'s Wi-Fi. Stay close to it and try again.',
);
}
final body = res.data is Map ? res.data as Map : const {};
if (res.statusCode != 202) {
throw SetupException(
- body['message'] as String? ?? 'The device said no (${res.statusCode}).',
+ body['message'] as String? ?? 'Intern 3 said no (${res.statusCode}).',
);
}
return (body['run'] as num?)?.toInt() ?? 0;
diff --git a/mobile/lib/phone/computer_use_page.dart b/mobile/lib/phone/computer_use_page.dart
new file mode 100644
index 000000000..5efce9ea9
--- /dev/null
+++ b/mobile/lib/phone/computer_use_page.dart
@@ -0,0 +1,252 @@
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:lucide_icons_flutter/lucide_icons.dart';
+
+import 'package:harness_mobile/core/models.dart' show Agent;
+import 'package:harness_mobile/state/app_state.dart';
+
+import 'phone_navigation.dart' show openAgent;
+import 'phone_search_catalog.dart' show phoneAgentId;
+import 'settings_row.dart';
+import 'tty.dart';
+import 'tty_controls.dart';
+
+/// Computers ▸ a Harness OS computer ▸ Computer use: on or off (off as installed). On, every agent Harness starts
+/// there gets Playwright's browser tools and the desktop's (CLI osDevice.ts `computer_use`, agentClient/computerUse.ts),
+/// to try what it builds as a person would. An agent reads its tools when it starts, so the harnesses running there
+/// are listed to restart, as Connections does for a new connection.
+class ComputerUsePage extends StatefulWidget {
+ const ComputerUsePage({
+ super.key,
+ required this.notifier,
+ required this.machineId,
+ });
+
+ final AppNotifier notifier;
+ final String machineId;
+
+ @override
+ State<ComputerUsePage> createState() => _ComputerUsePageState();
+}
+
+class _ComputerUsePageState extends State<ComputerUsePage> {
+ bool? _on;
+ bool _busy = true;
+ String _error = '';
+
+ /// Turned on or off from here: the harnesses running there are offered a restart.
+ bool _changed = false;
+
+ /// The engines that get them (CLI agentClient/computerUse.ts): Claude Code and Codex at launch, OpenCode
+ /// through its own config.
+ static const _engines = {'claude', 'codex', 'opencode'};
+
+ /// A restart takes seconds and the daemon queues each one: tapped twice, restarted twice.
+ static final Set<String> _restarting = {};
+
+ AppNotifier get _app => widget.notifier;
+ String get _id => widget.machineId;
+ String get _name => _app.stateOf(_id)?.machine.displayName ?? 'The computer';
+
+ @override
+ void initState() {
+ super.initState();
+ _app.addListener(_listChanged);
+ unawaited(_ask(null));
+ }
+
+ @override
+ void dispose() {
+ _app.removeListener(_listChanged);
+ super.dispose();
+ }
+
+ void _listChanged() {
+ if (mounted) setState(() {});
+ }
+
+ Future<void> _ask(String? state) async {
+ setState(() {
+ _busy = true;
+ _error = '';
+ });
+ final reply = await _app.osDevice(_id, {
+ 'action': 'computer_use',
+ 'state': ?state,
+ });
+ if (!mounted) return;
+ setState(() {
+ _busy = false;
+ if (reply['on'] is bool) {
+ _on = reply['on'] as bool;
+ if (state != null) _changed = true;
+ } else {
+ _error =
+ reply['message'] as String? ??
+ 'Could not reach $_name. Pull down to try again.';
+ }
+ });
+ }
+
+ /// The harnesses running there on an engine that gets the tools, the one last opened on this phone first.
+ List<Agent> get _running {
+ final agents = [
+ for (final agent in _app.stateOf(_id)?.agents ?? const <Agent>[])
+ if (!agent.isStopped && _engines.contains(agent.engine)) agent,
+ ];
+ final recent = _app.searchHistory.recent.toList();
+ int rank(Agent agent) {
+ final at = recent.indexOf(phoneAgentId(_id, agent.id));
+ return at < 0 ? recent.length : at;
+ }
+
+ agents.sort((a, b) => rank(a).compareTo(rank(b)));
+ return agents;
+ }
+
+ /// Opens the harness, then restarts it there, so the person watches it come back with (or without) the tools.
+ void _restart(Agent agent) {
+ final key = phoneAgentId(_id, agent.id);
+ if (!_restarting.add(key)) return;
+ final messenger = ScaffoldMessenger.maybeOf(context);
+ openAgent(context, _app, _id, agent.id);
+ unawaited(
+ _app
+ .restartAgent(_id, agent.id)
+ .then((result) {
+ final error = result.error;
+ if (error != null) {
+ messenger?.showSnackBar(SnackBar(content: Text(error)));
+ }
+ })
+ .whenComplete(() => _restarting.remove(key)),
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final tty = Tty.of(context);
+ Text say(String text, {Color? color}) =>
+ Text(text, style: tty.style(color: color ?? tty.dim));
+ final on = _on == true;
+ final running = _running;
+ return Scaffold(
+ backgroundColor: tty.ground,
+ body: SafeArea(
+ bottom: false,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TtyBackButton(
+ onPressed: () => Navigator.of(context).maybePop(),
+ ),
+ ),
+ Expanded(
+ child: RefreshIndicator(
+ onRefresh: () => _ask(null),
+ child: ListView(
+ padding: EdgeInsets.fromLTRB(
+ Tty.origin,
+ 8,
+ Tty.origin,
+ MediaQuery.paddingOf(context).bottom + 24,
+ ),
+ children: [
+ const TtyText(
+ 'Computer use',
+ size: TtySize.display,
+ weight: FontWeight.w600,
+ ),
+ const SizedBox(height: 8),
+ say(
+ 'Tools for the agents on $_name to try what they build as a person would, '
+ 'and fix what they find. Off until you turn them on.',
+ ),
+ const SizedBox(height: 12),
+ if (_error.isNotEmpty)
+ say(_error, color: tty.red)
+ else if (_on == null)
+ const Center(
+ child: CircularProgressIndicator(strokeWidth: 2),
+ )
+ else ...[
+ SettingsGroup(
+ children: [
+ SettingsRow(
+ key: const Key('computer-use-state'),
+ title: 'Computer use',
+ value: on ? 'On' : 'Off',
+ ),
+ const SettingsRow(
+ leading: Icon(LucideIcons.globe300, size: 20),
+ title: 'Browser',
+ detail: 'A website: opens it in a Chromium window, clicks, types, reads the page and its console.',
+ ),
+ const SettingsRow(
+ leading: Icon(LucideIcons.monitor300, size: 20),
+ title: 'Desktop',
+ detail: 'A desktop app: screenshots of the screen, and the mouse and keyboard on them.',
+ ),
+ ],
+ ),
+ const SizedBox(height: 8),
+ say(
+ 'Claude Code, Codex and OpenCode agents get them, and ask you before they use them.',
+ ),
+ const SizedBox(height: 20),
+ TtyPrimaryButton(
+ key: const Key('computer-use-toggle'),
+ label: on
+ ? 'Turn computer use off'
+ : 'Turn computer use on',
+ busy: _busy,
+ busyLabel: on ? 'Turning off…' : 'Turning on…',
+ onPressed: () => unawaited(_ask(on ? 'off' : 'on')),
+ ),
+ // An agent reads its tools when it starts: one running already gets them, or loses
+ // them, only on a restart.
+ if (_changed) ...[
+ const SizedBox(height: 20),
+ say(
+ on
+ ? 'New harnesses get them. Restart a running one to give it them.'
+ : 'New harnesses don\'t get them. Restart a running one to take them away.',
+ color: tty.text,
+ ),
+ if (running.isNotEmpty) ...[
+ const SizedBox(height: 12),
+ SettingsGroup(
+ children: [
+ for (final agent in running)
+ SettingsRow(
+ key: ValueKey(
+ 'computer-use-restart-${agent.id}',
+ ),
+ leading: const Icon(
+ LucideIcons.refreshCw300,
+ size: 20,
+ ),
+ title: 'Restart "${agent.displayName}"',
+ detail: on
+ ? 'Restart to use computer use.'
+ : 'Restart without computer use.',
+ onTap: () => _restart(agent),
+ ),
+ ],
+ ),
+ ],
+ ],
+ ],
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/mobile/lib/phone/machine_actions.dart b/mobile/lib/phone/machine_actions.dart
index 040c64f42..e47c8a638 100644
--- a/mobile/lib/phone/machine_actions.dart
+++ b/mobile/lib/phone/machine_actions.dart
@@ -11,6 +11,7 @@ import 'change_wifi_page.dart';
import 'computer_github_page.dart';
import 'computer_password_page.dart';
import 'computer_ssh_page.dart';
+import 'computer_use_page.dart';
import 'computer_version_page.dart';
import 'link_page.dart';
import 'phone_navigation.dart';
@@ -250,6 +251,18 @@ PhoneSheetRows? _machineRows(
),
),
),
+ if (notifier.osFeature(machineId, 'computer_use'))
+ PhoneSheetAction(
+ icon: LucideIcons.flaskConical300,
+ label: 'Computer use',
+ chevron: true,
+ onTap: () => Navigator.of(context).push(
+ phoneRoute(
+ (_) =>
+ ComputerUsePage(notifier: notifier, machineId: machineId),
+ ),
+ ),
+ ),
if (notifier.osFeature(machineId, 'ssh'))
PhoneSheetAction(
icon: LucideIcons.terminal300,
diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dart
index 010212c71..810d801b4 100644
--- a/mobile/lib/state/app_state.dart
+++ b/mobile/lib/state/app_state.dart
@@ -6160,8 +6160,8 @@ class AppNotifier extends ChangeNotifier {
osStatus[machineId]?['harnessOs'] == true;
/// What a Harness OS computer's daemon does for a phone beyond its update and Wi-Fi, as its status
- /// says (CLI osDevice.ts `features`): `sign_out`, `password`, `ssh`, `github`, `check_update`. An older
- /// one says none.
+ /// says (CLI osDevice.ts `features`): `sign_out`, `password`, `ssh`, `github`, `check_update`, and
+ /// `computer_use` on one that carries them. An older one says none.
bool osFeature(String machineId, String feature) {
final features = osStatus[machineId]?['features'];
return features is List && features.contains(feature);