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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Default new agents to the local machine
deehwe68c893c2115
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex ce054f1f2..561c8b4b8 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -521,8 +521,13 @@ class _SwarmScreenState extends State<SwarmScreen> {bool cloneRepositoryFirst = false,}) => _dialog(() async {final focused = app.focusedPane;+ // A general New Agent action starts on this computer. Most launches are+ // local, and silently inheriting a remote focused pane makes the uncommon+ // destination look like the default. Splitting a pane is contextual by+ // definition, so it keeps the focused agent's machine and folder.final inherit =machineId == null &&+ split != null &&!chooseFolderFirst &&!cloneRepositoryFirst &&focused?.agentId != null;diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dartindex 864020c8e..3b1a3e14a 100644--- a/desktop/lib/widgets/new_agent_dialog.dart+++ b/desktop/lib/widgets/new_agent_dialog.dart@@ -310,6 +310,15 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {widget.notifier.stateOf(_machineId)?.machine.displayName ??'this machine';+ String _machineLabel(MachineState machine) => [+ machine.machine.displayName,+ machine.isLocalMachine ? 'This computer' : 'Remote',+ if (machine.nodeOnline == false)+ 'Offline'+ else if (machine.needsLink)+ 'Link required',+ ].join(' — ');+Future<void> _browse() async {if (_picking) return;final restoreFocus = _folderFocus.hasFocus;@@ -522,7 +531,11 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {],),)- : const Text('Create agent'),+ : Text(+ _machineIsThisComputer+ ? 'Create agent'+ : 'Create on $_machineName',+ ),),],);@@ -546,14 +559,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {for (final machine in widget.notifier.machineStates.values)SelectOption(value: machine.machine.machineId,- label: machine.isLocalMachine- ? 'This computer'- : machine.machine.displayName,- note: machine.nodeOnline == false- ? 'Offline'- : machine.needsLink- ? 'Link required'- : null,+ label: _machineLabel(machine),),],onChanged: (id) {@@ -1107,8 +1113,8 @@ class _FolderControl extends StatelessWidget {if (!machineIsThisComputer) ...[const SizedBox(height: _gapTight),Text(- '$machineName is another computer — this browses its folders '- "through the CLI, not this Mac's.",+ 'This agent will run on $machineName. Its folders are browsed '+ 'through the remote CLI.',style: theme.textTheme.bodySmall,),],diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dartindex b5b170023..7c9546a64 100644--- a/desktop/test/first_workspace_test.dart+++ b/desktop/test/first_workspace_test.dart@@ -13,6 +13,7 @@ import 'package:harness/state/app_state.dart';import 'package:harness/state/pane_arrangement.dart';import 'package:harness/state/swarm_catalog.dart';import 'package:harness/terminal/terminal_binary.dart';+import 'package:harness/terminal/terminal_session.dart';import 'package:harness/widgets/clone_repository_dialog.dart';import 'package:xterm/xterm.dart';@@ -243,6 +244,16 @@ void main() {.value,'m',);+ expect(+ tester+ .widget<AppSelectField<String>>(+ find.byKey(const Key('new-agent-machine-field')),+ )+ .options+ .last+ .label,+ 'Remote computer — Remote — Offline',+ );expect(app.launches, isEmpty);await tester.tap(find.text('Cancel'));await tester.pump();@@ -339,7 +350,7 @@ void main() {for (final native in [false, true]) {testWidgets(- 'new agent ${native ? 'native menu' : 'floating picker'} action inherits the focused working folder',+ 'new agent ${native ? 'native menu' : 'floating picker'} defaults to this computer',(tester) async {tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(const MethodChannel('harness/swarm_tabs'),@@ -356,16 +367,41 @@ void main() {app.machineStates['m']!.engines.replace(const [EngineAvailability(engine: 'codex', installed: true),]);- app.machineStates['m']!.agents = const [- Agent(- id: 'existing',- name: 'Existing work',- engine: 'codex',- terminalAvailable: true,- project: AgentProject(name: 'Workspace', cwd: '/work/existing'),- ),- ];- final pane = app.adoptSessionForTest(terminal('existing', app.input));+ const remote = Machine(+ machineId: 'remote',+ name: 'Remote computer',+ authMode: MachineAuthMode.remote,+ );+ app.machines = [...app.machines, remote];+ app.machineStates['remote'] = MachineState(remote)+ ..nodeOnline = true+ ..agentLoadStatus = AgentLoadStatus.loaded+ ..agents = const [+ Agent(+ id: 'existing',+ name: 'Existing work',+ engine: 'codex',+ terminalAvailable: true,+ project: AgentProject(name: 'Workspace', cwd: '/work/existing'),+ ),+ ];+ final pane = app.adoptSessionForTest(+ TerminalSession(+ machineId: 'remote',+ agentId: 'existing',+ agentName: 'Existing work',+ engineId: 'codex',+ send: (_, _) async => true,+ sendBinary: (frame) async {+ if (frame.kind == TerminalBinaryKind.input) {+ app.input.add(frame);+ }+ return true;+ },+ )+ ..status = TerminalSessionStatus.controlling+ ..streamId = 'stream-existing',+ );await runtime.mount(tester, app, map, native: native);if (native) {final opening = runtime.native(tester, 'newAgent');@@ -393,8 +429,16 @@ void main() {await tester.pump();}expect(find.byType(AlertDialog), findsOneWidget);- expect(find.text('/work/existing'), findsOneWidget);- expect(find.byKey(const Key('new-agent-machine-field')), findsNothing);+ expect(find.text('/work/existing'), findsNothing);+ expect(find.text('Choose a folder…'), findsOneWidget);+ final machineField = tester.widget<AppSelectField<String>>(+ find.byKey(const Key('new-agent-machine-field')),+ );+ expect(machineField.value, 'm');+ expect(machineField.options.map((option) => option.label), [+ 'My computer — This computer',+ 'Remote computer — Remote',+ ]);expect(tester.widget<AppSelectField<String>>(diff --git a/desktop/test/new_agent_codex_profile_test.dart b/desktop/test/new_agent_codex_profile_test.dartindex 5c7dbcc4c..a2df96095 100644--- a/desktop/test/new_agent_codex_profile_test.dart+++ b/desktop/test/new_agent_codex_profile_test.dart@@ -231,6 +231,18 @@ void main() {local: false,initialPaths: const ['/custom/work-login'],);+ final machineField = tester.widget<AppSelectField<String>>(+ find.byKey(const Key('new-agent-machine-field')),+ );+ expect(machineField.options.single.label, 'This Mac — Remote');+ expect(find.text('Create on This Mac'), findsOneWidget);+ expect(+ find.text(+ 'This agent will run on This Mac. Its folders are browsed through '+ 'the remote CLI.',+ ),+ findsOneWidget,+ );expect(find.byKey(const Key('new-agent-codex-profile-field')),findsOneWidget,