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.

fix: align experimental swarm settings and contain guidance (#427)

Dee15a9469cda86
diff --git a/.github/assets/swarm-collaboration/settings.png b/.github/assets/swarm-collaboration/settings.png
index 4e68c02fb..6e01aaeb3 100644
Binary files a/.github/assets/swarm-collaboration/settings.png and b/.github/assets/swarm-collaboration/settings.png differ
diff --git a/desktop/lib/settings/sections/experimental_section.dart b/desktop/lib/settings/sections/experimental_section.dart
index 5323c7073..78e349d67 100644
--- a/desktop/lib/settings/sections/experimental_section.dart
+++ b/desktop/lib/settings/sections/experimental_section.dart
@@ -99,61 +99,55 @@ class _SwarmCollaborationSetting extends StatelessWidget {
@override
Widget build(BuildContext context) {
final state = controller;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- MergeSemantics(
- child: SettingRow(
- title: 'Swarm collaboration',
- detail:
- 'Let agents in the same tab automatically consult each other. '
- 'Off by default. This setting applies to your account.',
- control: SizedBox(
- width: SettingRow.controlWidth,
- child: Row(
- children: [
- Switch(
- key: const Key('experimental-swarm-collaboration'),
- value: state.enabled,
- onChanged: state.loaded && !state.saving
- ? (on) => unawaited(state.setEnabled(on))
- : null,
- ),
- Flexible(
- child: Text(
- state.saving
- ? 'Saving…'
- : !state.loaded
- ? state.error == null
- ? 'Loading…'
- : 'Unavailable'
- : state.enabled
- ? 'On'
- : 'Off',
- ),
- ),
- ],
- ),
- ),
+ final status = state.saving
+ ? 'Saving…'
+ : !state.loaded && state.error == null
+ ? 'Loading…'
+ : null;
+ return SettingRow(
+ title: 'Swarm collaboration',
+ detail:
+ 'Let agents automatically consult only peers in the same tab. '
+ 'Off by default. This setting applies to your account.',
+ control: Semantics(
+ label: 'Swarm collaboration',
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Switch(
+ key: const Key('experimental-swarm-collaboration'),
+ value: state.enabled,
+ onChanged: state.loaded && !state.saving
+ ? (on) => unawaited(state.setEnabled(on))
+ : null,
),
),
- const SizedBox(height: 16),
- const Text(
- 'Agents consult only peers in their tab. '
- 'Use “Swarm conversation” in the command palette to inspect their questions and replies.',
- ),
- if (state.error case final error?) ...[
- const SizedBox(height: 12),
- Semantics(liveRegion: true, child: Text(error)),
- Align(
- alignment: Alignment.centerLeft,
- child: TextButton(
- onPressed: state.saving ? null : () => unawaited(state.refresh()),
- child: const Text('Refresh setting'),
+ ),
+ footer: DefaultTextStyle.merge(
+ style: Theme.of(context).textTheme.bodySmall,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const Text(
+ 'Use “Swarm conversation” in the command palette to inspect '
+ 'their questions and replies.',
),
- ),
- ],
- ],
+ if (status != null) ...[
+ const SizedBox(height: 8),
+ Semantics(liveRegion: true, child: Text(status)),
+ ],
+ if (state.error case final error?) ...[
+ const SizedBox(height: 8),
+ Semantics(liveRegion: true, child: Text(error)),
+ TextButton(
+ onPressed: state.saving
+ ? null
+ : () => unawaited(state.refresh()),
+ child: const Text('Refresh setting'),
+ ),
+ ],
+ ],
+ ),
+ ),
);
}
}
diff --git a/desktop/lib/shared/widgets/setting_row.dart b/desktop/lib/shared/widgets/setting_row.dart
index 34da2c32d..17112b87d 100644
--- a/desktop/lib/shared/widgets/setting_row.dart
+++ b/desktop/lib/shared/widgets/setting_row.dart
@@ -16,6 +16,7 @@ class SettingRow extends StatelessWidget {
required this.title,
this.detail,
required this.control,
+ this.footer,
this.alignTop = false,
});
@@ -23,6 +24,9 @@ class SettingRow extends StatelessWidget {
final String? detail;
final Widget control;
+ /// Guidance or feedback that belongs inside this setting's block.
+ final Widget? footer;
+
/// Align taller controls with the title; compact controls stay centered.
final bool alignTop;
@@ -62,24 +66,31 @@ class SettingRow extends StatelessWidget {
padding: detail == null
? const EdgeInsets.symmetric(vertical: 8)
: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
- child: LayoutBuilder(
- builder: (context, constraints) =>
- constraints.maxWidth <
- MediaQuery.textScalerOf(context).scale(_stackBelow)
- ? Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [text, const SizedBox(height: 10), control],
- )
- : Row(
- crossAxisAlignment: alignTop
- ? CrossAxisAlignment.start
- : CrossAxisAlignment.center,
- children: [
- Expanded(child: text),
- const SizedBox(width: 20),
- control,
- ],
- ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ LayoutBuilder(
+ builder: (context, constraints) =>
+ constraints.maxWidth <
+ MediaQuery.textScalerOf(context).scale(_stackBelow)
+ ? Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [text, const SizedBox(height: 10), control],
+ )
+ : Row(
+ crossAxisAlignment: alignTop
+ ? CrossAxisAlignment.start
+ : CrossAxisAlignment.center,
+ children: [
+ Expanded(child: text),
+ const SizedBox(width: 20),
+ control,
+ ],
+ ),
+ ),
+ if (footer case final footer?) ...[const SizedBox(height: 8), footer],
+ ],
),
);
}