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 batch 11-02 ap: #2643 #2628 (#2645)

0xken1559beccc24ecc
diff --git a/cli/src/lib/authSession.spec.ts b/cli/src/lib/authSession.spec.ts
index 3680e879f..5313452d8 100644
--- a/cli/src/lib/authSession.spec.ts
+++ b/cli/src/lib/authSession.spec.ts
@@ -13,6 +13,7 @@ const {
AuthSessionManager,
clearAuthSession,
ensureSignInEpoch,
+ teamSignInEpoch,
hasAuthSession,
markSignedOut,
newSignInEpoch,
@@ -80,6 +81,13 @@ describe('sign-in epoch', () => {
expect(readAuthSession()).toMatchObject({ machineId: 'machine-new' })
})
+ it('is dropped by a Team sign-in when the lookup started with no epoch, though its epoch reads as adopted', async () => {
+ writeAuthSession({ ...baseSession(), machineId: 'machine-new', signInEpoch: teamSignInEpoch() })
+ await manager().updateMachineId('machine-old', undefined)
+ expect(readAuthSession()).toMatchObject({ machineId: 'machine-new' })
+ expect(signInOf(readAuthSession()!.signInEpoch)?.adopted).toBe(true)
+ })
+
it('is kept when the session from before epochs was only given one meanwhile', async () => {
const { signInEpoch: _none, ...old } = { ...baseSession(), signInEpoch: undefined }
writeAuthSession(old)
diff --git a/cli/src/lib/authSession.ts b/cli/src/lib/authSession.ts
index 402dc662f..9489beffb 100644
--- a/cli/src/lib/authSession.ts
+++ b/cli/src/lib/authSession.ts
@@ -93,6 +93,12 @@ export const newSignInEpoch = (now = Date.now()): string => `${randomBytes(16).t
* being made here, so the device key log may take its file over for it but never starts one over. */
export const ADOPTED_SIGN_IN = 'adopted:'
+/** A Team sign-in's epoch, made as it signs in. Adopted, so the device key log treats it as it always has (a Team session was
+ * given an adopted epoch at its first read), and can never start over for another account on it; and its own form, as it is a
+ * new sign-in, never an old session given an epoch meanwhile ([sameSignIn]). */
+const TEAM_SIGN_IN = `${ADOPTED_SIGN_IN}team:`
+export const teamSignInEpoch = (now = Date.now()): string => TEAM_SIGN_IN + newSignInEpoch(now)
+
/** Give a session from before epochs existed one (`ADOPTED_SIGN_IN`), under the refresh lock so a
* rotated refresh token is never written back over. The session's epoch; null when signed out. */
export async function ensureSignInEpoch(): Promise<string | null> {
@@ -220,10 +226,14 @@ export function updateAuthSession(change: (latest: AuthSession) => AuthSession |
* when there is none, or it is marked signed out.
*/
export function recordMachineId(machineId: string, startedUnder: string | undefined): Promise<AuthSession | null> {
- return updateAuthSession((latest) => {
- const same = latest.signInEpoch === startedUnder || (startedUnder === undefined && signInOf(latest.signInEpoch)?.adopted === true)
- return !same || latest.machineId === machineId ? null : { ...latest, machineId, updatedAt: Date.now() }
- })
+ return updateAuthSession((latest) => !sameSignIn(latest, startedUnder) || latest.machineId === machineId
+ ? null : { ...latest, machineId, updatedAt: Date.now() })
+}
+
+/** Whether [latest] is still the sign-in a lookup started under ([recordMachineId]). */
+export function sameSignIn(latest: AuthSession, startedUnder: string | undefined): boolean {
+ if (latest.signInEpoch === startedUnder) return true
+ return startedUnder === undefined && signInOf(latest.signInEpoch)?.adopted === true && !latest.signInEpoch?.startsWith(TEAM_SIGN_IN)
}
/** The first wait before a refused refresh is tried again, and the longest. The app asks `auth status` often,
diff --git a/cli/src/team/command.spec.ts b/cli/src/team/command.spec.ts
index d0f0315e2..3ef1f781b 100644
--- a/cli/src/team/command.spec.ts
+++ b/cli/src/team/command.spec.ts
@@ -627,6 +627,46 @@ describe('internal verbs', () => {
expect(unsafe.status.get(STATUS)?.signIn).toMatchObject({ state: 'failed', detail: 'not this account\'s private file' })
})
+ // Echo, reviewing #2637: the Team side of a lookup that outlives its sign-in.
+ describe('a Team machine lookup that outlives its sign-in', () => {
+ const start = async (startedUnder: string | undefined, meanwhile: Partial<AuthSession>) => {
+ const f = inTeam({ takeHandoff: () => null })
+ f.setSession({ ...computer, kind: 'team', refreshToken: 'htr_first', machineId: undefined, signInEpoch: startedUnder })
+ const answer = f.post.getMockImplementation()!
+ f.post.mockImplementation(async (path: string, body: unknown, headers?: Record<string, string>) => {
+ if (path === '/api/machines/resolve-computer') f.setSession({ ...f.session()!, ...meanwhile })
+ return answer(path, body, headers)
+ })
+ expect(await teamCommand(['__start', '/Users/harnessteam/.harness/team-handoff'], f.deps)).toBe(0)
+ return f
+ }
+ const SWITCHED = { refreshToken: 'htr_other_owner', signInEpoch: 'adopted:team:next@2' }
+
+ it('an owner switch while it is out: the old answer writes nothing and claims nothing', async () => {
+ const f = await start('adopted:team:first@1', SWITCHED)
+ expect(f.session()).toMatchObject(SWITCHED)
+ expect(f.session()?.machineId).toBeUndefined()
+ expect(f.out.join('\n')).not.toContain('runs as machine')
+ })
+
+ it('a switch away from a Team sign-in from before epochs: dropped too', async () => {
+ const f = await start(undefined, SWITCHED)
+ expect(f.session()?.machineId).toBeUndefined()
+ expect(f.out.join('\n')).not.toContain('runs as machine')
+ })
+
+ it('the same sign-in, refreshed while it is out: the answer is kept', async () => {
+ const f = await start('adopted:team:first@1', { accessToken: 'hna_refreshed' })
+ expect(f.session()).toMatchObject({ machineId: 'm-team', accessToken: 'hna_refreshed', signInEpoch: 'adopted:team:first@1' })
+ expect(f.out.join('\n')).toContain('runs as machine m-team')
+ })
+
+ it('a sign-in from before epochs, only given one meanwhile: the answer is kept', async () => {
+ const f = await start(undefined, { signInEpoch: 'adopted:abc@1' })
+ expect(f.session()).toMatchObject({ machineId: 'm-team', signInEpoch: 'adopted:abc@1' })
+ })
+ })
+
it('__start records the machine of a team sign-in that has none, once, and starts the daemon when it cannot', async () => {
// A team account set up before this: signed in, but its daemon ran as its computer id (third VM run).
const older = inTeam({ takeHandoff: () => null })
diff --git a/cli/src/team/command.ts b/cli/src/team/command.ts
index 83e73f63d..13a023e5a 100644
--- a/cli/src/team/command.ts
+++ b/cli/src/team/command.ts
@@ -14,7 +14,7 @@
* team work does not run as the owner instead.
*/
import type { AgentTmpState } from '../lib/agentTmp.js'
-import type { AuthSession } from '../lib/authSession.js'
+import { sameSignIn, type AuthSession } from '../lib/authSession.js'
import { SIGN_OUT_BUTTON_FLAG, type SignOutAsked } from '../lib/signOut.js'
import type { AdminVia, RunAdmin } from './admin.js'
import { teamConfigJson, type TeamConfig } from './config.js'
@@ -731,10 +731,11 @@ async function recordTeamMachine(deps: TeamCommandDeps, label: string, log: (lin
{ computerId: session.computerId, label }, headers)
const machineId = answer?.machine?.machineId
if (typeof machineId !== 'string' || !machineId) throw new Error('Harness answered without a machine id')
- // A refresh may have rewritten the session meanwhile: the machine id goes into the newest one.
+ // A refresh may have rewritten the session meanwhile: the machine id goes into the newest one, while it is still the sign-in
+ // this asked for. A new owner's sign-in drops it, and its own start looks up its own.
const kept = await deps.updateSession((latest) => latest.kind !== 'team' || latest.computerId !== session.computerId
- || latest.machineId === machineId ? null : { ...latest, machineId, updatedAt: deps.now() })
- if (kept?.kind !== 'team' || kept.computerId !== session.computerId) return
+ || !sameSignIn(latest, session.signInEpoch) || latest.machineId === machineId ? null : { ...latest, machineId, updatedAt: deps.now() })
+ if (kept?.machineId !== machineId) return
log(`runs as machine ${machineId}`)
} catch (error) {
log(`could not look up this account's machine yet (${(error as Error).message}); the next start tries again`)
diff --git a/cli/src/team/handoff.spec.ts b/cli/src/team/handoff.spec.ts
index f06aee03c..7010dc717 100644
--- a/cli/src/team/handoff.spec.ts
+++ b/cli/src/team/handoff.spec.ts
@@ -1,3 +1,4 @@
+import { signInOf } from '../lib/authSession.js'
import { chmodSync, existsSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
@@ -173,9 +174,18 @@ describe('redeemTeamHandoff', () => {
})
describe('team session and revoke', () => {
+ // A lookup checks this before it writes a machine id. Adopted, so the device key log treats a Team sign-in as it always has:
+ // it gets an adopted epoch at its first read today, and an adopted one can never start the log over for another account.
+ it('gives each team sign-in its own adopted epoch', () => {
+ const one = teamSession({ token: 'hna_t' }, 'id', 'stag', 1_000), two = teamSession({ token: 'hna_t' }, 'id', 'stag', 1_000)
+ expect(one.signInEpoch).toBeTruthy()
+ expect(one.signInEpoch).not.toBe(two.signInEpoch)
+ expect(signInOf(one.signInEpoch)).toMatchObject({ adopted: true, at: 1_000 })
+ })
+
it('marks the stored session as a team one, keeping what it is given', () => {
expect(teamSession({ token: 'hna_t', refreshToken: 'hnr_r', expiresIn: 10 }, 'id', 'stag', 1_000, { machineId: 'm' })).toEqual({
- version: 1, accessToken: 'hna_t', refreshToken: 'hnr_r', expiresAt: 11_000, autonomousEnv: 'stag', computerId: 'id', machineId: 'm', kind: 'team', updatedAt: 1_000,
+ version: 1, accessToken: 'hna_t', refreshToken: 'hnr_r', expiresAt: 11_000, autonomousEnv: 'stag', computerId: 'id', machineId: 'm', signInEpoch: expect.any(String), kind: 'team', updatedAt: 1_000,
})
expect(teamSession({ token: 'hna_t', autonomousEnv: 'prod' }, 'id', 'stag', 1)).toMatchObject({ autonomousEnv: 'prod', kind: 'team' })
})
diff --git a/cli/src/team/handoff.ts b/cli/src/team/handoff.ts
index 12a95dfd7..5a4edd23e 100644
--- a/cli/src/team/handoff.ts
+++ b/cli/src/team/handoff.ts
@@ -16,7 +16,7 @@
*/
import { constants, fstatSync, openSync, readSync, closeSync, unlinkSync } from 'node:fs'
import { b64e, sign, utf8 } from '../lib/e2ee/core.js'
-import type { AuthSession } from '../lib/authSession.js'
+import { teamSignInEpoch, type AuthSession } from '../lib/authSession.js'
import { HANDOFF_CODE } from './layout.js'
import { TeamSignInError } from './signInError.js'
@@ -195,6 +195,7 @@ export function teamSession(tokens: TeamTokens, computerId: string, fallbackEnv:
...(tokens.expiresIn ? { expiresAt: now + tokens.expiresIn * 1000 } : {}),
autonomousEnv: tokens.autonomousEnv ?? fallbackEnv,
computerId,
+ signInEpoch: teamSignInEpoch(now),
...extra,
kind: 'team',
updatedAt: now,
diff --git a/desktop/lib/super_tabs/catch_up.dart b/desktop/lib/super_tabs/catch_up.dart
deleted file mode 100644
index 93403e134..000000000
--- a/desktop/lib/super_tabs/catch_up.dart
+++ /dev/null
@@ -1,131 +0,0 @@
-import 'model.dart';
-
-/// One row the catch-up card links to (backend catchUp.ts): who wrote it and
-/// what it says, shortened by the server.
-class SuperTabCatchUpItem {
- const SuperTabCatchUpItem({
- required this.messageId,
- required this.author,
- required this.text,
- });
-
- factory SuperTabCatchUpItem.fromJson(Map<String, dynamic> row) =>
- SuperTabCatchUpItem(
- messageId: row['messageId'] as String? ?? '',
- author: row['author'] as String? ?? '',
- text: row['text'] as String? ?? '',
- );
-
- final String messageId, author, text;
-}
-
-/// One list of the card: its newest items, and how many there are in all.
-class SuperTabCatchUpList {
- const SuperTabCatchUpList({this.total = 0, this.items = const []});
-
- /// A list missing from the answer, or a row that is not one, reads as
- /// nothing, never a failed read.
- factory SuperTabCatchUpList.fromJson(Object? value) {
- final row = value is Map ? superTabMap(value) : const <String, dynamic>{};
- final items = [
- for (final item in row['items'] as List? ?? const [])
- if (item is Map) SuperTabCatchUpItem.fromJson(superTabMap(item)),
- ].where((item) => item.messageId.isNotEmpty).toList();
- final total = (row['total'] as num?)?.toInt() ?? items.length;
- return SuperTabCatchUpList(
- total: total < items.length ? items.length : total,
- items: List.unmodifiable(items),
- );
- }
-
- final int total;
- final List<SuperTabCatchUpItem> items;
-
- /// The items counted but not shown.
- int get more => total - items.length;
-}
-
-/// "While you were away": what the reader missed in one conversation since
-/// their read mark, as the backend summarizes it from the rows they may read
-/// (catchUp.ts).
-class SuperTabCatchUp {
- const SuperTabCatchUp({
- this.more = false,
- this.unread = 0,
- this.decisions = 0,
- this.landed = const SuperTabCatchUpList(),
- this.blocked = const SuperTabCatchUpList(),
- this.needsYou = const SuperTabCatchUpList(),
- });
-
- factory SuperTabCatchUp.fromJson(Map<String, dynamic> row) => SuperTabCatchUp(
- more: row['more'] == true,
- unread: (row['unread'] as num?)?.toInt() ?? 0,
- decisions: (row['decisions'] as num?)?.toInt() ?? 0,
- landed: SuperTabCatchUpList.fromJson(row['landed']),
- blocked: SuperTabCatchUpList.fromJson(row['blocked']),
- needsYou: SuperTabCatchUpList.fromJson(row['needsYou']),
- );
-
- /// The span is longer than one summary reads (backend CATCH_UP_SCAN): the
- /// lists and [unread] cover only its first part, and no status is listed.
- final bool more;
-
- final int unread, decisions;
- final SuperTabCatchUpList landed, blocked, needsYou;
-
- /// Nothing landed, is blocked or needs the reader: no card, since a count
- /// of new messages alone is what the New messages line already says. A
- /// partial summary always shows, so the reader learns it is partial.
- bool get isEmpty =>
- !more &&
- decisions == 0 &&
- landed.items.isEmpty &&
- blocked.items.isEmpty &&
- needsYou.items.isEmpty;
-}
-
-/// Each conversation's catch-up card for this visit: read once, when its New
-/// messages line is placed, and gone with the line (Esc, leaving the
-/// conversation) or when closed. A read that fails or comes back empty shows
-/// no card; the line is unchanged either way.
-class SuperTabCatchUps {
- final _shown = <String, SuperTabCatchUp>{};
-
- /// The read under way or done this visit, by conversation: a reply to an
- /// earlier visit's read is never shown in this one.
- final _asked = <String, Object>{};
-
- /// [id]'s card, or null.
- SuperTabCatchUp? of(String id) => _shown[id];
-
- /// Reads [id]'s summary with [read], once a visit; true when a card is now
- /// shown.
- Future<bool> load(String id, Future<SuperTabCatchUp> Function() read) async {
- if (_asked.containsKey(id)) return false;
- final visit = _asked[id] = Object();
- try {
- final summary = await read();
- if (!identical(_asked[id], visit) || summary.isEmpty) return false;
- _shown[id] = summary;
- return true;
- } catch (_) {
- // Offline, or an older backend: the New messages line says enough.
- return false;
- }
- }
-
- /// Closed by the reader, or read with Esc: not read again this visit.
- void dismiss(String id) => _shown.remove(id);
-
- /// [id] was left: the next visit reads again.
- void forget(String? id) {
- _asked.remove(id);
- _shown.remove(id);
- }
-
- void reset() {
- _asked.clear();
- _shown.clear();
- }
-}
diff --git a/desktop/lib/super_tabs/catch_up_card.dart b/desktop/lib/super_tabs/catch_up_card.dart
deleted file mode 100644
index 895b50591..000000000
--- a/desktop/lib/super_tabs/catch_up_card.dart
+++ /dev/null
@@ -1,278 +0,0 @@
-import 'package:flutter/material.dart';
-
-import '../shared/theme/app_icons.dart';
-import '../shared/theme/app_theme.dart' as grid;
-import '../shared/widgets/app_icon_button.dart';
-import '../widgets/desktop_chrome.dart';
-import 'catch_up.dart';
-import 'message_row.dart' show SuperTabLink;
-
-/// "While you were away", under the New messages line: what needs the reader,
-/// what is blocked and what landed, each item opening its message
-/// ([onOpen]), and Close ([onClose]). Each list has its words as well as its
-/// mark, so colour is never the only signal.
-///
-/// A count with a list of its own elsewhere opens it: the decisions waiting
-/// ([onOpenDecisions]) and the tags beyond Needs you's ([onOpenMentions]).
-/// Blocked's and Landed's counts have no such list and stay words, as does a
-/// count whose callback is null.
-class SuperTabCatchUpCard extends StatelessWidget {
- const SuperTabCatchUpCard({
- super.key,
- required this.summary,
- required this.onOpen,
- required this.onClose,
- this.onOpenDecisions,
- this.onOpenMentions,
- });
-
- final SuperTabCatchUp summary;
- final ValueChanged<String> onOpen;
- final VoidCallback onClose;
- final VoidCallback? onOpenDecisions;
- final VoidCallback? onOpenMentions;
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- final decisions = summary.decisions;
- return Padding(
- padding: const EdgeInsets.fromLTRB(
- grid.AppDesktop.panelPadding,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.panelPadding,
- grid.AppDesktop.controlGap,
- ),
- child: Semantics(
- container: true,
- label: 'While you were away',
- child: DecoratedBox(
- key: const ValueKey('super-catch-up'),
- decoration: BoxDecoration(
- color: DesktopChrome.surface,
- border: Border.all(color: DesktopChrome.rim),
- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
- ),
- child: Padding(
- padding: const EdgeInsets.fromLTRB(
- grid.AppDesktop.groupGap,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.groupGap,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _header(),
- _section(
- 'Needs you',
- AppIcons.hand,
- DesktopChrome.accent,
- summary.needsYou,
- onMore: onOpenMentions,
- moreKey: const ValueKey('super-catch-up-mentions'),
- ),
- _section(
- 'Blocked',
- AppIcons.triangleAlert,
- grid.AppPalette.warn,
- summary.blocked,
- ),
- _section(
- 'Landed',
- AppIcons.circleCheck,
- grid.AppPalette.online,
- summary.landed,
- ),
- if (decisions > 0)
- _note(
- decisions == 1
- ? '1 decision waits for you'
- : '$decisions decisions wait for you',
- onTap: onOpenDecisions,
- linkKey: const ValueKey('super-catch-up-decisions'),
- ),
- // Never a partial summary read as the whole absence.
- if (summary.more)
- _note(
- 'Covers only the first part of what you missed. '
- 'Newer messages are below.',
- ),
- ],
- ),
- ),
- ),
- ),
- );
- }
-
- Widget _note(String text, {VoidCallback? onTap, Key? linkKey}) => Padding(
- padding: const EdgeInsets.only(top: grid.AppDesktop.controlGap),
- child: _count(text, onTap: onTap, linkKey: linkKey),
- );
-
- /// [text] as a link to what it counts, or as words with nowhere to go.
- Widget _count(String text, {VoidCallback? onTap, Key? linkKey}) =>
- onTap == null
- ? Text(text, style: DesktopChrome.metadata())
- : _SuperTabCatchUpLink(key: linkKey, text: text, onTap: onTap);
-
- Widget _header() => Row(
- children: [
- Icon(
- AppIcons.sparkles,
- size: grid.AppDesktop.iconSize,
- color: DesktopChrome.accent,
- ),
- const SizedBox(width: grid.AppDesktop.controlGap),
- Text('While you were away', style: DesktopChrome.control(medium: true)),
- const SizedBox(width: grid.AppDesktop.controlGap),
- // The count takes the spare width, so Close sits at the card's end.
- Expanded(
- child: Text(
- switch ((summary.unread, summary.more)) {
- (0, _) => '',
- (final count, true) => '$count+ new messages',
- (1, false) => '1 new message',
- (final count, false) => '$count new messages',
- },
- style: DesktopChrome.metadata(),
- overflow: TextOverflow.ellipsis,
- ),
- ),
- AppIconButton(
- key: const ValueKey('super-catch-up-close'),
- tooltip: 'Close',
- icon: AppIcons.close,
- onPressed: onClose,
- ),
- ],
- );
-
- Widget _section(
- String heading,
- IconData icon,
- Color color,
- SuperTabCatchUpList list, {
- VoidCallback? onMore,
- Key? moreKey,
- }) {
- if (list.items.isEmpty) return const SizedBox.shrink();
- return Padding(
- padding: const EdgeInsets.only(top: grid.AppDesktop.controlGap),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- heading,
- style: DesktopChrome.metadata().copyWith(
- fontWeight: grid.AppFont.semibold,
- ),
- ),
- for (final item in list.items)
- _SuperTabCatchUpRow(
- item: item,
- icon: icon,
- color: color,
- onOpen: () => onOpen(item.messageId),
- ),
- if (list.more > 0)
- _count('${list.more} more', onTap: onMore, linkKey: moreKey),
- ],
- ),
- );
- }
-}
-
-/// One item: its mark, who wrote it and what it says; opens its message.
-class _SuperTabCatchUpRow extends StatelessWidget {
- const _SuperTabCatchUpRow({
- required this.item,
- required this.icon,
- required this.color,
- required this.onOpen,
- });
-
- final SuperTabCatchUpItem item;
- final IconData icon;
- final Color color;
- final VoidCallback onOpen;
-
- @override
- Widget build(BuildContext context) => InkWell(
- key: ValueKey('super-catch-up-${item.messageId}'),
- onTap: onOpen,
- hoverColor: grid.AppSurface.hoverFill,
- borderRadius: BorderRadius.circular(DesktopChrome.controlRadius),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: grid.AppDesktop.listRowGap),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: const EdgeInsets.only(top: grid.AppDesktop.listRowGap),
- child: Icon(icon, size: grid.AppDesktop.iconSize, color: color),
- ),
- const SizedBox(width: grid.AppDesktop.controlGap),
- Expanded(
- child: Text.rich(
- TextSpan(
- children: [
- if (item.author.isNotEmpty)
- TextSpan(
- text: '${item.author} ',
- style: DesktopChrome.control(medium: true),
- ),
- TextSpan(text: item.text, style: DesktopChrome.control()),
- ],
- ),
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- ),
- );
-}
-
-/// A count that opens what it counts: accent words, a hand cursor and an
-/// underline under the pointer, reached by Tab and pressed with Enter or
-/// Space, the focus rim drawn as on the chat's other links ([SuperTabLink]).
-class _SuperTabCatchUpLink extends StatefulWidget {
- const _SuperTabCatchUpLink({
- super.key,
- required this.text,
- required this.onTap,
- });
-
- final String text;
- final VoidCallback onTap;
-
- @override
- State<_SuperTabCatchUpLink> createState() => _SuperTabCatchUpLinkState();
-}
-
-class _SuperTabCatchUpLinkState extends State<_SuperTabCatchUpLink> {
- var _hovered = false;
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- return SuperTabLink(
- onTap: widget.onTap,
- label: widget.text,
- child: MouseRegion(
- onEnter: (_) => setState(() => _hovered = true),
- onExit: (_) => setState(() => _hovered = false),
- child: Text(
- widget.text,
- style: DesktopChrome.metadata(color: DesktopChrome.accent).copyWith(
- decoration: _hovered ? TextDecoration.underline : null,
- decorationColor: DesktopChrome.accent,
- ),
- ),
- ),
- );
- }
-}
diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dart
index c3ddfb581..dd68630dd 100644
--- a/desktop/lib/super_tabs/controller.dart
+++ b/desktop/lib/super_tabs/controller.dart
@@ -17,7 +17,6 @@ import 'identity.dart' show superTabMachineName;
import 'machine_status.dart' show kSuperTabMachineOfflineAfter;
import 'model.dart';
import 'buddy_chat.dart';
-import 'catch_up.dart';
import 'project_github.dart';
import 'parts.dart';
import 'read_marks.dart';
@@ -205,9 +204,6 @@ class SuperTabController extends ChangeNotifier {
_decisionsAside.addAll(
(initial['decisionsAside'] as List? ?? const []).whereType<String>(),
);
- _statusFolded.addAll(
- (initial['statusFolded'] as List? ?? const []).whereType<String>(),
- );
devicesSelected = initial['devicesSelected'] == true;
projectsGroupOpen = initial['projectsGroupOpen'] as bool? ?? true;
unreadOnly = initial['unreadOnly'] == true;
@@ -945,26 +941,6 @@ class SuperTabController extends ChangeNotifier {
if (_decisionsAside.length != before) _saveSoon();
}
- /// The projects whose status card the reader folded to its heading line:
- /// saved on this computer for this reader. Only the newest
- /// [statusFoldedKept] are kept, so the set cannot grow without end.
- final _statusFolded = <String>{};
- static const statusFoldedKept = 200;
- bool statusFolded(String projectId) => _statusFolded.contains(projectId);
-
- void setStatusFolded(String projectId, {required bool folded}) {
- // Folded again moves it to the newest end.
- _statusFolded.remove(projectId);
- if (folded) {
- _statusFolded.add(projectId);
- while (_statusFolded.length > statusFoldedKept) {
- _statusFolded.remove(_statusFolded.first);
- }
- }
- _saveSoon();
- _changed();
- }
-
void toggleProjectsGroup() {
projectsGroupOpen = !projectsGroupOpen;
_saveSoon();
@@ -1624,6 +1600,8 @@ class SuperTabController extends ChangeNotifier {
bool newSession = false,
VoidCallback? onSending,
({String conversationId, String root})? to,
+ bool plain = false,
+ List<String> recipients = const [],
}) async {
final open = to ?? openedThread;
if (open == null || accessRevoked) return null;
@@ -1670,8 +1648,9 @@ class SuperTabController extends ChangeNotifier {
'type': 'message.send',
'conversationId': open.conversationId,
'text': text,
- 'replyTo': open.root,
- 'recipientIds': addressed,
+ // With [plain], a message of [to]'s conversation, not a reply in a thread.
+ 'replyTo': plain ? null : open.root,
+ 'recipientIds': addressed.isEmpty ? recipients : addressed,
if (tagged.isNotEmpty) 'mentions': tagged,
// A session's thread stays in the thread: never also sent.
if (alsoSend && !newSession) 'alsoSend': true,
@@ -1896,6 +1875,23 @@ class SuperTabController extends ChangeNotifier {
final _merges = <String, SuperTabStepsMerge>{};
+ /// A number that moves when [id] or one of its steps has something new.
+ int? taskProgress(String id) {
+ final state = snapshot;
+ final task = state?.conversation(id);
+ if (state == null || task == null) return null;
+ return superTabStepsOf(state, task).fold<int>(
+ task.lastMessageSequence,
+ (sum, step) => sum + step.lastMessageSequence,
+ );
+ }
+
+ /// Reads a task that is not the selected conversation, with its steps.
+ Future<void> loadTaskMessages(String id) async {
+ await loadMessages(id);
+ if (!_disposed) _readSteps(id, light: false);
+ }
+
/// The name of the step [message] was written in; null for a task's own.
String? stepNameOf(SuperTabMessage message) {
final group = snapshot?.conversation(message.conversationId);
@@ -2100,19 +2096,6 @@ class SuperTabController extends ChangeNotifier {
),
);
- /// What the reader missed in [id] after [after] (backend catchUp.ts).
- Future<SuperTabCatchUp> readCatchUp(
- String id,
- int after,
- ) async => SuperTabCatchUp.fromJson(
- superTabMap(
- await request(
- 'GET',
- '$_path/conversations/${Uri.encodeComponent(id)}/catch-up?after=$after',
- ),
- ),
- );
-
late final _serverMarks = SuperTabReadMarkSender<String>(
(id, sequence) => request(
'POST',
@@ -2504,7 +2487,6 @@ class SuperTabController extends ChangeNotifier {
'expandedProjects': expandedProjects.toList(),
'expandedMachines': expandedMachines.toList(),
'decisionsAside': _decisionsAside.toList(),
- 'statusFolded': _statusFolded.toList(),
'devicesSelected': devicesSelected,
'projectsGroupOpen': projectsGroupOpen,
'unreadOnly': unreadOnly,
@@ -3870,6 +3852,7 @@ class SuperTabController extends ChangeNotifier {
for (var i = 0; i < next.length; i++) {
final a = shown[i], b = next[i];
if (a.id != b.id ||
+ a.text != b.text ||
a.deliveries.length != b.deliveries.length ||
!_sameReactions(a.reactions, b.reactions)) {
return false;
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dart
index aace944df..8dcc05dfb 100644
--- a/desktop/lib/super_tabs/model.dart
+++ b/desktop/lib/super_tabs/model.dart
@@ -1237,6 +1237,10 @@ class SuperTabMessage {
/// The line the server writes in a thread when its session ends.
bool get sessionEnded => source['kind'] == 'buddy-session-ended';
+ /// A task's own message, the server keeps current as the task moves (Quiet
+ /// Swarm 2/6): its text is the task's name.
+ bool get isTaskLine => source['kind'] == 'task-line';
+
/// Why its session ended, for [sessionEnded] rows: `ended`, `idle`,
/// `stopped` or `failed`.
String? get sessionEndReason =>
diff --git a/desktop/lib/super_tabs/project_options.dart b/desktop/lib/super_tabs/project_options.dart
index 929346443..ffcb7c09d 100644
--- a/desktop/lib/super_tabs/project_options.dart
+++ b/desktop/lib/super_tabs/project_options.dart
@@ -79,6 +79,43 @@ Future<void> _showProjectDetails(
),
);
+/// The project menu's Project settings… (Quiet Swarm, screen 9): the rows the
+/// reader may use, each closing the dialog and then doing its work.
+Future<void> showProjectSettings(
+ BuildContext context,
+ SuperTabController c,
+ SuperTabProject project,
+ List<(String, VoidCallback)> rows, {
+ double rowHeight = 32,
+}) => showAppDialog<void>(
+ context: context,
+ builder: (context) => SuperTabDialogScope(
+ controller: c,
+ projectId: project.id,
+ requireWrite: false,
+ child: SuperTabDetailDialog(
+ title: 'Project settings',
+ body: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ for (final (label, action) in rows)
+ InkWell(
+ onTap: () {
+ Navigator.of(context).pop();
+ action();
+ },
+ child: Container(
+ constraints: BoxConstraints(minHeight: rowHeight),
+ alignment: Alignment.centerLeft,
+ child: Text(label, style: DesktopChrome.control()),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+);
+
Future<void> showProjectAction(
BuildContext context,
SuperTabController c,
diff --git a/desktop/lib/super_tabs/project_status.dart b/desktop/lib/super_tabs/project_status.dart
new file mode 100644
index 000000000..267dff443
--- /dev/null
+++ b/desktop/lib/super_tabs/project_status.dart
@@ -0,0 +1,159 @@
+import 'package:flutter/gestures.dart';
+import 'package:flutter/material.dart';
+
+import '../core/open_in_browser.dart';
+import '../shared/theme/app_theme.dart' as grid;
+import '../shared/widgets/app_dialog.dart';
+import '../widgets/desktop_chrome.dart';
+import 'controller.dart';
+import 'detail_dialog.dart';
+import 'dialog_scope.dart';
+import 'message_text.dart';
+
+/// "8:33 PM" today, "Oct 30, 8:33 PM" before, in this computer's time.
+String superTabStatusTime(DateTime at, DateTime now) {
+ final local = at.toLocal(), today = now.toLocal();
+ final hour = local.hour % 12 == 0 ? 12 : local.hour % 12;
+ final minute = local.minute.toString().padLeft(2, '0');
+ final clock = '$hour:$minute ${local.hour < 12 ? 'AM' : 'PM'}';
+ if (local.year == today.year &&
+ local.month == today.month &&
+ local.day == today.day) {
+ return clock;
+ }
+ const months = [
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', //
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
+ ];
+ final year = local.year == today.year ? '' : ' ${local.year}';
+ return '${months[local.month - 1]} ${local.day}$year, $clock';
+}
+
+/// The project menu's Status (Quiet Swarm, screen 9b): what the coordinator
+/// last reported, replaced in place by each report. It reads nothing of its
+/// own: the text comes with the Swarm read. What waits on the reader is in
+/// Activity.
+Future<void> showSuperTabProjectStatus(
+ BuildContext context,
+ SuperTabController c,
+ String projectId, {
+ DateTime Function() now = DateTime.now,
+}) => showAppDialog<void>(
+ context: context,
+ builder: (context) => SuperTabDialogScope(
+ controller: c,
+ projectId: projectId,
+ requireWrite: false,
+ child: ListenableBuilder(
+ listenable: c,
+ builder: (context, _) {
+ final status = c.snapshot?.projectById(projectId)?.status;
+ final at = status?.at;
+ return SuperTabDetailDialog(
+ title: at == null
+ ? 'Status'
+ : 'Status · updated ${superTabStatusTime(at, now())}',
+ body: status == null
+ ? const SizedBox.shrink()
+ : _StatusText(status.text),
+ );
+ },
+ ),
+ ),
+);
+
+/// The report as the coordinator wrote it, line for line, with its web links
+/// clickable. Not Markdown: the card is a glance, not a message.
+class _StatusText extends StatefulWidget {
+ const _StatusText(this.text);
+ final String text;
+
+ @override
+ State<_StatusText> createState() => _StatusTextState();
+}
+
+class _StatusTextState extends State<_StatusText> {
+ static final _link = RegExp(r'https?://[^\s<>()\[\]]+');
+
+ /// The text cut into plain pieces and links, with one tap per link: made
+ /// again only when the text changes, so a rebuild (a theme flip, a Swarm
+ /// read) never drops a tap under the pointer.
+ var _pieces = <(String, TapGestureRecognizer?)>[];
+
+ @override
+ void initState() {
+ super.initState();
+ _cut();
+ }
+
+ @override
+ void didUpdateWidget(_StatusText old) {
+ super.didUpdateWidget(old);
+ if (old.text != widget.text) _cut();
+ }
+
+ @override
+ void dispose() {
+ _release();
+ super.dispose();
+ }
+
+ void _release() {
+ for (final (_, tap) in _pieces) {
+ tap?.dispose();
+ }
+ }
+
+ void _cut() {
+ _release();
+ final text = widget.text.trimRight();
+ final pieces = <(String, TapGestureRecognizer?)>[];
+ var at = 0;
+ for (final match in _link.allMatches(text)) {
+ // A sentence's closing punctuation is not part of its link.
+ var url = match[0]!;
+ while (url.isNotEmpty && '.,;:!?\'"'.contains(url[url.length - 1])) {
+ url = url.substring(0, url.length - 1);
+ }
+ final uri = SuperTabMessageText.webLink(url);
+ if (uri == null) continue;
+ if (match.start > at) pieces.add((text.substring(at, match.start), null));
+ pieces.add((
+ url,
+ TapGestureRecognizer()..onTap = () => openInBrowser(uri),
+ ));
+ at = match.start + url.length;
+ }
+ if (at < text.length) pieces.add((text.substring(at), null));
+ _pieces = pieces;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final link = TextStyle(
+ color: DesktopChrome.accent,
+ decoration: TextDecoration.underline,
+ decorationColor: DesktopChrome.accent,
+ );
+ return Padding(
+ padding: const EdgeInsets.only(top: grid.AppDesktop.listRowGap),
+ child: Text.rich(
+ key: const ValueKey('super-project-status-text'),
+ TextSpan(
+ style: DesktopChrome.text(),
+ children: [
+ for (final (text, tap) in _pieces)
+ tap == null
+ ? TextSpan(text: text)
+ : TextSpan(
+ text: text,
+ style: link,
+ recognizer: tap,
+ mouseCursor: SystemMouseCursors.click,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/desktop/lib/super_tabs/project_status_card.dart b/desktop/lib/super_tabs/project_status_card.dart
deleted file mode 100644
index d18414da6..000000000
--- a/desktop/lib/super_tabs/project_status_card.dart
+++ /dev/null
@@ -1,342 +0,0 @@
-import 'package:flutter/gestures.dart';
-import 'package:flutter/material.dart';
-
-import '../core/open_in_browser.dart';
-import '../shared/theme/app_icons.dart';
-import '../shared/theme/app_theme.dart' as grid;
-import '../shared/widgets/app_icon_button.dart';
-import '../widgets/desktop_chrome.dart';
-import 'controller.dart';
-import 'decisions.dart';
-import 'message_text.dart';
-import 'model.dart';
-
-/// The status card at the top of a project's chat (Dee, 2026-10-31): what the
-/// coordinator last reported, replaced in place by each report instead of a
-/// post, and the decisions in this project waiting on the reader, each with
-/// Answer. Hidden while there is neither; folded to its heading line by the
-/// reader, remembered on this computer ([SuperTabController.statusFolded]).
-///
-/// It reads nothing of its own: the text comes with the Swarm read, the
-/// decisions are the reader's own list ([SuperTabDecisions]).
-class SuperTabProjectStatusCard extends StatelessWidget {
- const SuperTabProjectStatusCard({
- super.key,
- required this.controller,
- required this.projectId,
- this.now = DateTime.now,
- });
-
- final SuperTabController controller;
- final String projectId;
- final DateTime Function() now;
-
- /// The decisions [decisions] holds that wait on the reader in [projectId]:
- /// each asked in a conversation of that project the reader still reads, so
- /// one from another project, or whose conversation they lost, never shows.
- static List<SuperTabDecision> needsYou(
- SuperTabController c,
- SuperTabDecisions decisions,
- String projectId,
- ) {
- final snapshot = c.snapshot;
- if (snapshot == null || c.accessRevoked) return const [];
- return [
- for (final d in decisions.open)
- if (d.projectId == projectId &&
- snapshot.conversation(d.conversationId)?.projectId == projectId)
- d,
- ];
- }
-
- /// "16:52" today, "Oct 30, 16:52" before, in this computer's time.
- static String updatedAt(DateTime at, DateTime now) {
- final local = at.toLocal(), today = now.toLocal();
- String two(int n) => n.toString().padLeft(2, '0');
- final clock = '${two(local.hour)}:${two(local.minute)}';
- if (local.year == today.year &&
- local.month == today.month &&
- local.day == today.day) {
- return clock;
- }
- const months = [
- 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', //
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
- ];
- final year = local.year == today.year ? '' : ' ${local.year}';
- return '${months[local.month - 1]} ${local.day}$year, $clock';
- }
-
- @override
- Widget build(BuildContext context) {
- final decisions = SuperTabDecisions.of(controller);
- return ListenableBuilder(
- listenable: Listenable.merge([controller, decisions]),
- builder: (context, _) {
- grid.AppTheme.watch(context);
- final c = controller;
- final project = c.accessRevoked
- ? null
- : c.snapshot?.projectById(projectId);
- if (project == null) return const SizedBox.shrink();
- final status = project.status;
- final waiting = needsYou(c, decisions, projectId);
- if (status == null && waiting.isEmpty) return const SizedBox.shrink();
- final folded = c.statusFolded(projectId);
- return Padding(
- padding: const EdgeInsets.fromLTRB(
- grid.AppDesktop.panelPadding,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.panelPadding,
- grid.AppDesktop.controlGap,
- ),
- child: Semantics(
- container: true,
- label: 'Project status',
- child: DecoratedBox(
- key: ValueKey('super-project-status-$projectId'),
- decoration: BoxDecoration(
- color: DesktopChrome.surface,
- border: Border.all(color: DesktopChrome.rim),
- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
- ),
- child: Padding(
- padding: EdgeInsets.fromLTRB(
- grid.AppDesktop.groupGap,
- grid.AppDesktop.listRowGap,
- grid.AppDesktop.controlGap,
- folded
- ? grid.AppDesktop.listRowGap
- : grid.AppDesktop.groupGap,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- _heading(status, waiting.length, folded),
- if (!folded)
- // A long report scrolls inside the card, so the chat
- // keeps its room.
- ConstrainedBox(
- constraints: const BoxConstraints(maxHeight: 240),
- child: SingleChildScrollView(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- if (status != null) _StatusText(status.text),
- for (final (i, d) in waiting.indexed)
- _NeedsYouRow(
- decision: d,
- first: i == 0,
- reader: c.snapshot?.people
- .where((p) => p.id == c.accountId)
- .firstOrNull
- ?.username,
- onAnswer: () =>
- c.openNotice('decision', d.id),
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- );
- },
- );
- }
-
- Widget _heading(SuperTabProjectStatus? status, int waiting, bool folded) {
- final at = status?.at;
- return Row(
- children: [
- Expanded(
- child: Text.rich(
- TextSpan(
- children: [
- TextSpan(
- text: 'Status',
- style: DesktopChrome.control(medium: true),
- ),
- if (at != null)
- TextSpan(
- text: ' · updated ${updatedAt(at, now())}',
- style: DesktopChrome.metadata(),
- ),
- // Folded, the heading still says something waits.
- if (folded && waiting > 0)
- TextSpan(
- text: ' · $waiting ${waiting == 1 ? 'needs' : 'need'} you',
- style: DesktopChrome.metadata(color: DesktopChrome.accent),
- ),
- ],
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- AppIconButton(
- key: ValueKey('super-project-status-fold-$projectId'),
- tooltip: folded ? 'Show status' : 'Fold status',
- icon: folded ? AppIcons.chevronDown : AppIcons.chevronUp,
- onPressed: () =>
- controller.setStatusFolded(projectId, folded: !folded),
- ),
- ],
- );
- }
-}
-
-/// The report as the coordinator wrote it, line for line, with its web links
-/// clickable. Not Markdown: the card is a glance, not a message.
-class _StatusText extends StatefulWidget {
- const _StatusText(this.text);
- final String text;
-
- @override
- State<_StatusText> createState() => _StatusTextState();
-}
-
-class _StatusTextState extends State<_StatusText> {
- static final _link = RegExp(r'https?://[^\s<>()\[\]]+');
-
- /// The text cut into plain pieces and links, with one tap per link: made
- /// again only when the text changes, so a rebuild (a theme flip, a Swarm
- /// read) never drops a tap under the pointer.
- var _pieces = <(String, TapGestureRecognizer?)>[];
-
- @override
- void initState() {
- super.initState();
- _cut();
- }
-
- @override
- void didUpdateWidget(_StatusText old) {
- super.didUpdateWidget(old);
- if (old.text != widget.text) _cut();
- }
-
- @override
- void dispose() {
- _release();
- super.dispose();
- }
-
- void _release() {
- for (final (_, tap) in _pieces) {
- tap?.dispose();
- }
- }
-
- void _cut() {
- _release();
- final text = widget.text.trimRight();
- final pieces = <(String, TapGestureRecognizer?)>[];
- var at = 0;
- for (final match in _link.allMatches(text)) {
- // A sentence's closing punctuation is not part of its link.
- var url = match[0]!;
- while (url.isNotEmpty && '.,;:!?\'"'.contains(url[url.length - 1])) {
- url = url.substring(0, url.length - 1);
- }
- final uri = SuperTabMessageText.webLink(url);
- if (uri == null) continue;
- if (match.start > at) pieces.add((text.substring(at, match.start), null));
- pieces.add((
- url,
- TapGestureRecognizer()..onTap = () => openInBrowser(uri),
- ));
- at = match.start + url.length;
- }
- if (at < text.length) pieces.add((text.substring(at), null));
- _pieces = pieces;
- }
-
- @override
- Widget build(BuildContext context) {
- final link = TextStyle(
- color: DesktopChrome.accent,
- decoration: TextDecoration.underline,
- decorationColor: DesktopChrome.accent,
- );
- return Padding(
- padding: const EdgeInsets.only(top: grid.AppDesktop.listRowGap),
- child: Text.rich(
- key: const ValueKey('super-project-status-text'),
- TextSpan(
- style: DesktopChrome.text(),
- children: [
- for (final (text, tap) in _pieces)
- tap == null
- ? TextSpan(text: text)
- : TextSpan(
- text: text,
- style: link,
- recognizer: tap,
- mouseCursor: SystemMouseCursors.click,
- ),
- ],
- ),
- ),
- );
- }
-}
-
-/// One decision waiting on the reader: who it waits on, the question, and
-/// Answer, which opens it where Notifications answers it.
-class _NeedsYouRow extends StatelessWidget {
- const _NeedsYouRow({
- required this.decision,
- required this.first,
- required this.reader,
- required this.onAnswer,
- });
-
- final SuperTabDecision decision;
-
- /// The first row carries the "Needs you" label; the rest line up under it.
- final bool first;
- final String? reader;
- final VoidCallback onAnswer;
-
- static const _labelWidth = 88.0;
-
- @override
- Widget build(BuildContext context) => Padding(
- padding: const EdgeInsets.only(top: grid.AppDesktop.controlGap),
- child: Row(
- key: ValueKey('super-project-status-needs-${decision.id}'),
- children: [
- SizedBox(
- width: _labelWidth,
- child: first
- ? Text(
- 'Needs you',
- style: DesktopChrome.metadata(color: DesktopChrome.accent)
- .copyWith(fontWeight: grid.AppFont.semibold),
- )
- : null,
- ),
- Expanded(
- child: Text(
- reader == null
- ? decision.question
- : '$reader: ${decision.question}',
- style: DesktopChrome.text(),
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- const SizedBox(width: grid.AppDesktop.controlGap),
- OutlinedButton(
- key: ValueKey('super-project-status-answer-${decision.id}'),
- onPressed: onAnswer,
- child: const Text('Answer'),
- ),
- ],
- ),
- );
-}
diff --git a/desktop/lib/super_tabs/task_line.dart b/desktop/lib/super_tabs/task_line.dart
new file mode 100644
index 000000000..40d76ec9c
--- /dev/null
+++ b/desktop/lib/super_tabs/task_line.dart
@@ -0,0 +1,431 @@
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+
+import '../shared/theme/app_icons.dart';
+import '../shared/theme/app_theme.dart' as grid;
+import '../shared/widgets/app_icon_button.dart';
+import '../widgets/desktop_chrome.dart';
+import '../widgets/laid_out_list.dart';
+import 'controller.dart';
+import 'model.dart';
+import 'reply_box.dart';
+
+/// A row too narrow for a task's name and word on one line keeps the name whole
+/// and puts the word under it (Quiet Swarm, screen 12).
+const _narrow = 360.0;
+
+/// What a task's message says of its state (Quiet Swarm, screen 2): one word,
+/// or Answer for the person asked. [readerId] is who is reading. A state this
+/// build does not know says nothing rather than a word it cannot stand behind.
+String superTabTaskWord(SuperTabMessage message, String readerId) =>
+ switch (message.source['state']) {
+ 'planned' => 'planned',
+ 'working' => 'working',
+ 'waiting' =>
+ message.source['answerFor'] == readerId ? 'Answer' : 'working',
+ 'review' => 'in review',
+ 'shipped' => 'shipped',
+ 'stopped' => 'stopped',
+ _ => '',
+ };
+
+/// A task's name, from the line's title. Its text is for older apps, which
+/// read it whole ("name · word"), and is the name only on a line with no title.
+String superTabTaskName(SuperTabMessage message) =>
+ switch (message.source['title']) {
+ final String title when title.isNotEmpty => title,
+ _ => message.text,
+ };
+
+IconData superTabTaskMark(SuperTabMessage message) =>
+ switch (message.source['state']) {
+ 'planned' => AppIcons.circleDashed,
+ 'shipped' => AppIcons.check,
+ 'stopped' => AppIcons.circleSlash,
+ _ => AppIcons.circleDot,
+ };
+
+/// What a proposal is for: its goal, as the server writes it (backend
+/// buddies.ts, under its own opening line), else its first line.
+String _proposalName(String text) {
+ final lines = text.split('\n').map((line) => line.trim());
+ for (final line in lines) {
+ if (line.startsWith('Goal: ')) return line.substring(6).trim();
+ }
+ return lines.first;
+}
+
+/// One line that opens: the row both a task's and a proposal's message are.
+class _OpeningRow extends StatelessWidget {
+ const _OpeningRow({required this.child, required this.label, this.onOpen});
+
+ final Widget child;
+ final String label;
+ final VoidCallback? onOpen;
+
+ @override
+ Widget build(BuildContext context) => Semantics(
+ button: onOpen != null,
+ label: label,
+ excludeSemantics: true,
+ child: InkWell(
+ onTap: onOpen,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: grid.AppDesktop.panelPadding,
+ vertical: grid.AppDesktop.menuInset,
+ ),
+ child: child,
+ ),
+ ),
+ );
+}
+
+/// A task's message in a project's chat (Quiet Swarm, screen 2; the server's
+/// `task-line`, edited in place as the task moves): its mark, name and one word.
+class SuperTabTaskLine extends StatelessWidget {
+ const SuperTabTaskLine({
+ super.key,
+ required this.message,
+ required this.readerId,
+ this.onOpen,
+ });
+
+ final SuperTabMessage message;
+ final String readerId;
+
+ /// Null when the reader's read does not hold the task: the line stays, and
+ /// opens nothing.
+ final VoidCallback? onOpen;
+
+ @override
+ Widget build(BuildContext context) {
+ final word = superTabTaskWord(message, readerId);
+ final answer = word == 'Answer';
+ final title = superTabTaskName(message);
+ final name = Text(
+ title,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(medium: answer),
+ );
+ final said = Text(
+ word,
+ maxLines: 1,
+ style: answer
+ ? DesktopChrome.text(medium: true)
+ : DesktopChrome.metadata(),
+ );
+ return _OpeningRow(
+ label: word.isEmpty ? title : '$title, $word',
+ onOpen: onOpen,
+ child: LayoutBuilder(
+ builder: (context, constraints) {
+ final mark = Icon(
+ superTabTaskMark(message),
+ size: AppIcons.inlineSize,
+ color: DesktopChrome.muted,
+ );
+ const gap = SizedBox(width: grid.AppDesktop.controlGap);
+ if (constraints.maxWidth < _narrow && word.isNotEmpty) {
+ return Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ mark,
+ gap,
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [name, said],
+ ),
+ ),
+ ],
+ );
+ }
+ return Row(
+ children: [
+ mark,
+ gap,
+ Expanded(child: name),
+ if (word.isNotEmpty) ...[gap, said],
+ ],
+ );
+ },
+ ),
+ );
+ }
+}
+
+/// A Buddy's proposal in a project's chat (Quiet Swarm, screen 1): whose it is
+/// and its first line; opening it shows the whole message.
+class SuperTabProposalLine extends StatelessWidget {
+ const SuperTabProposalLine({
+ super.key,
+ required this.message,
+ required this.owner,
+ this.onOpen,
+ });
+
+ final SuperTabMessage message;
+ final String owner;
+ final VoidCallback? onOpen;
+
+ @override
+ Widget build(BuildContext context) {
+ final text = 'Proposal from $owner: ${_proposalName(message.text)}';
+ return _OpeningRow(
+ label: text,
+ onOpen: onOpen,
+ child: Row(
+ children: [
+ Icon(
+ AppIcons.chevronRight,
+ size: AppIcons.inlineSize,
+ color: DesktopChrome.muted,
+ ),
+ const SizedBox(width: grid.AppDesktop.controlGap),
+ Expanded(
+ child: Text(
+ text,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+/// A task's own conversation beside the project's chat (Quiet Swarm, screen 3):
+/// its name, who has it and its word, its messages as the chat draws them, and
+/// a reply. Open in full gives it the main column.
+class SuperTabTaskPanel extends StatefulWidget {
+ const SuperTabTaskPanel({
+ super.key,
+ required this.controller,
+ required this.taskId,
+ required this.word,
+ this.mark,
+ required this.rows,
+ required this.row,
+ required this.outgoing,
+ required this.onClose,
+ required this.onOpenInFull,
+ });
+
+ final SuperTabController controller;
+ final String taskId;
+
+ /// The word its line says.
+ final String word;
+
+ /// The mark its line shows; null once the line is out of the chat's rows.
+ final IconData? mark;
+
+ /// The task's whole conversation in time order: its steps' rows and every
+ /// thread's replies, without hidden notices.
+ final List<SuperTabMessage> Function() rows;
+
+ final Widget Function(SuperTabMessage message) row;
+
+ /// A reply on its way, or refused with its Retry, as the chat draws one.
+ final Widget Function(SuperTabOutgoing sent) outgoing;
+
+ final VoidCallback onClose;
+ final VoidCallback onOpenInFull;
+
+ @override
+ State<SuperTabTaskPanel> createState() => _SuperTabTaskPanelState();
+}
+
+class _SuperTabTaskPanelState extends State<SuperTabTaskPanel> {
+ int _read = -1;
+ final _reply = TextEditingController();
+ final _focus = FocusNode();
+
+ SuperTabController get c => widget.controller;
+
+ @override
+ void initState() {
+ super.initState();
+ c.addListener(_follow);
+ _reply.text = c.threadDraft(widget.taskId);
+ _follow();
+ }
+
+ @override
+ void didUpdateWidget(SuperTabTaskPanel old) {
+ super.didUpdateWidget(old);
+ if (old.controller != c) {
+ old.controller.removeListener(_follow);
+ c.addListener(_follow);
+ }
+ if (old.taskId != widget.taskId) {
+ _read = -1;
+ _reply.text = c.threadDraft(widget.taskId);
+ _follow();
+ }
+ }
+
+ @override
+ void dispose() {
+ c.removeListener(_follow);
+ _reply.dispose();
+ _focus.dispose();
+ super.dispose();
+ }
+
+ /// Reads the task once, then only when it or a step has something new.
+ void _follow() {
+ final newest = c.taskProgress(widget.taskId);
+ if (newest == null || newest == _read) return;
+ _read = newest;
+ unawaited(c.loadTaskMessages(widget.taskId));
+ }
+
+ bool get _busy => c.uploading || c.saving || c.hasPendingAction;
+
+ /// A plain message in the task's own conversation, to the agent with the
+ /// task. Refused while something else saves: the words stay in the box.
+ Future<void> _send() async {
+ final id = widget.taskId;
+ final files = c.threadAttachments(id, id);
+ if (_busy || (_reply.text.trim().isEmpty && files.isEmpty)) return;
+ final task = c.snapshot?.conversation(id);
+ final assignee = task?.assignment?['agentId'];
+ c.setThreadDraft(id, _reply.text, conversationId: id);
+ await c.sendThreadReply(
+ to: (conversationId: id, root: id),
+ plain: true,
+ recipients: [
+ if (assignee is String && task!.agentIds.contains(assignee)) assignee,
+ ],
+ onSending: () {
+ if (mounted && widget.taskId == id) _reply.clear();
+ },
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) => ListenableBuilder(
+ listenable: c,
+ builder: (context, _) {
+ grid.AppTheme.watch(context);
+ final task = c.snapshot?.conversation(widget.taskId);
+ final assignee = task?.assignment?['agentId'];
+ final who = assignee is String ? c.snapshot?.agent(assignee)?.name : null;
+ final rows = widget.rows();
+ final pending = [
+ for (final sent in c.outgoing(widget.taskId))
+ if (sent.thread == null) sent,
+ ];
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ grid.AppDesktop.groupGap,
+ grid.AppDesktop.controlGap,
+ grid.AppDesktop.controlGap,
+ grid.AppDesktop.controlGap,
+ ),
+ child: Row(
+ children: [
+ Expanded(
+ child: Semantics(
+ header: true,
+ child: Text('Thread', style: DesktopChrome.heading()),
+ ),
+ ),
+ TextButton(
+ key: const ValueKey('super-task-panel-full'),
+ onPressed: widget.onOpenInFull,
+ child: const Text('Open in full'),
+ ),
+ AppIconButton(
+ key: const ValueKey('super-task-panel-close'),
+ icon: AppIcons.close,
+ tooltip: 'Close thread',
+ onPressed: widget.onClose,
+ ),
+ ],
+ ),
+ ),
+ Divider(height: 1, thickness: 1, color: DesktopChrome.rim),
+ Padding(
+ padding: const EdgeInsets.all(grid.AppDesktop.groupGap),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ if (widget.mark case final mark?) ...[
+ Icon(
+ mark,
+ size: AppIcons.inlineSize,
+ color: DesktopChrome.muted,
+ ),
+ const SizedBox(width: grid.AppDesktop.controlGap),
+ ],
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ task?.title ?? '',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(medium: true),
+ ),
+ Text(
+ [
+ ?who,
+ if (widget.word.isNotEmpty) widget.word,
+ ].join(' · '),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: LaidOutListView.builder(
+ itemCount: rows.length + pending.length,
+ itemBuilder: (context, index) => index < rows.length
+ ? widget.row(rows[index])
+ : widget.outgoing(pending[index - rows.length]),
+ ),
+ ),
+ if (c.canWrite && task?.archived == false)
+ SuperTabReplyBox(
+ controller: c,
+ text: _reply,
+ focus: _focus,
+ files: c.threadAttachments(widget.taskId, widget.taskId),
+ enabled: true,
+ writable: true,
+ busy: _busy,
+ error:
+ c.composerError(widget.taskId) ??
+ c.threadComposerError(widget.taskId, widget.taskId),
+ onEdited: (text) => c.setThreadDraft(
+ widget.taskId,
+ text,
+ conversationId: widget.taskId,
+ ),
+ onSend: () => unawaited(_send()),
+ surfaceKey: const ValueKey('super-task-reply-surface'),
+ fieldKey: const ValueKey('super-task-reply'),
+ sendKey: const ValueKey('super-task-send'),
+ ),
+ ],
+ );
+ },
+ );
+}
diff --git a/desktop/lib/super_tabs/unread_line.dart b/desktop/lib/super_tabs/unread_line.dart
index 4efb3afbd..83fd255f3 100644
--- a/desktop/lib/super_tabs/unread_line.dart
+++ b/desktop/lib/super_tabs/unread_line.dart
@@ -4,7 +4,6 @@ import 'package:flutter/rendering.dart';
import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../widgets/desktop_chrome.dart';
-import 'catch_up.dart';
import 'model.dart';
/// The first message of [shown] the reader has not read, for the New messages line: in the main stream (a reply
@@ -46,9 +45,6 @@ class SuperTabUnreadLines {
final _failed = <String, int>{};
static const _tries = 3;
- /// The catch-up card under each line, kept and forgotten with it.
- final catchUps = SuperTabCatchUps();
-
/// The line on screen, to tell whether it is scrolled out of view.
final key = GlobalKey(debugLabel: 'New messages line');
@@ -134,14 +130,12 @@ class SuperTabUnreadLines {
_loaded.remove(id);
_failed.remove(id);
_seen.remove(id);
- catchUps.forget(id);
away = below = false;
}
- /// Read with Esc: no line or card until the next visit.
+ /// Read with Esc: no line until the next visit.
void clear(String id) {
_at[id] = null;
- catchUps.dismiss(id);
away = below = false;
}
@@ -151,7 +145,6 @@ class SuperTabUnreadLines {
_loaded.clear();
_failed.clear();
_seen.clear();
- catchUps.reset();
away = below = false;
}
}
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 7395c59bd..ca3a58ea3 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -20,7 +20,6 @@ import '../state/harness_attachments.dart';
import '../state/workspace_chrome.dart';
import 'chat_scroll.dart';
import 'leaderboard/reader.dart';
-import 'catch_up_card.dart';
import 'jump_to_latest.dart';
import 'unread_line.dart';
import 'roster.dart';
@@ -56,7 +55,6 @@ import 'buddies.dart';
import 'decisions.dart';
import 'decisions_view.dart';
import 'route_row.dart';
-import 'ship_row.dart';
import 'terminal_row.dart';
import 'thread_panel.dart';
import 'threads_view.dart';
@@ -65,8 +63,10 @@ import 'project_sidebar.dart';
import 'buddy_sessions.dart';
import 'swarm_switcher.dart' show fallBackToPersonal;
import 'project_options.dart';
+import 'project_status.dart';
+import 'ship_row.dart';
import 'switch_pm.dart';
-import 'project_status_card.dart';
+import 'task_line.dart';
import 'pane_layout.dart';
import 'view_room.dart';
import 'visible_tick.dart';
@@ -408,7 +408,6 @@ class _SuperTabViewState extends State<SuperTabView>
// The line is placed once the messages reach back to the mark.
} else if (_unread.decide(id, shown, mark, own: c.isOwn)) {
if (_openedAtMessage != id) _revealUnreadLine(id);
- _loadCatchUp(id, mark);
} else if (firstView || (grew && atEnd)) {
_followEnd(id);
} else if (atEnd) {
@@ -570,8 +569,8 @@ class _SuperTabViewState extends State<SuperTabView>
arrived: (row) {
// A link or tag opened since takes the reader to its message instead.
if (request != _scrollRequest) return;
- // The line itself, not its row: with the catch-up card under it the
- // row can be taller than the view, and its top would go above it.
+ // The line itself, not its row, which can be taller than the view:
+ // its top would go above it.
final line = _unread.key.currentContext;
unawaited(
Scrollable.ensureVisible(
@@ -583,14 +582,6 @@ class _SuperTabViewState extends State<SuperTabView>
);
}
- /// Reads [id]'s catch-up card for the span after [mark], shown under its
- /// line once it arrives.
- void _loadCatchUp(String id, int mark) => unawaited(
- _unread.catchUps.load(id, () => c.readCatchUp(id, mark)).then((shown) {
- if (shown && mounted) setState(() {});
- }),
- );
-
/// Shows the jump pill while the reader is away from a line not yet seen,
/// and Jump to latest while the list is away from its newest message.
void _checkUnreadLine() {
@@ -1662,7 +1653,7 @@ class _SuperTabViewState extends State<SuperTabView>
}
/// Shows Activity in the main pane, as its sidebar row does; with [filter],
- /// on that list (the catch-up card's counts). [from] is the controller the
+ /// on that list. [from] is the controller the
/// asking widget was built for: a press arriving once the view has moved to
/// another Swarm opens nothing.
void _openActivity({
@@ -1963,14 +1954,27 @@ class _SuperTabViewState extends State<SuperTabView>
/// The messages [id]'s list shows, in order.
/// A thread reply shows in its thread, and here only when also sent.
- List<SuperTabMessage> _shownMessages(String id) {
+ List<SuperTabMessage> _shownMessages(String id, {bool replies = false}) {
final messages = c.taskMessages(id);
final answered = answeredPromptAlerts(
messages,
(agentId) => c.snapshot?.agent(agentId),
);
+ // A task's line says it shipped: its Shipped card, from before it had the
+ // line, leaves. One with no line stays (Quiet Swarm, part 2).
+ final lined = {
+ for (final m in messages)
+ if (m.isTaskLine) m.source['taskId'],
+ };
return messages
- .where((m) => _shown(m) && m.inMainStream && !answered.contains(m.id))
+ .where(
+ (m) =>
+ _shown(m) &&
+ (replies || m.inMainStream) &&
+ !answered.contains(m.id) &&
+ !(SuperTabShipRow.shows(m) &&
+ lined.contains(m.source['conversationId'])),
+ )
.toList();
}
@@ -1981,9 +1985,26 @@ class _SuperTabViewState extends State<SuperTabView>
if (m.conversationId == id) m,
];
- /// A message waiting for an agent is never announced; notices older
- /// backends stored stay hidden, in the list and as a reply's quote.
- static bool _shown(SuperTabMessage m) => m.source['kind'] != 'delivery-hold';
+ /// What people never read in a chat, in the list and as a reply's quote: a
+ /// message waiting for an agent, notices older backends stored, the PM's own
+ /// notices about the work (backend NOTICE_READERS).
+ static const _neverShown = {
+ 'delivery-hold',
+ 'work-stalled',
+ 'work-lost',
+ 'work-resumed',
+ 'idle-stop',
+ 'idle',
+ 'review-failed',
+ 'update-request',
+ 'digest-request',
+ 'overlap',
+ 'pair-loop',
+ 'notice-digest',
+ };
+
+ static bool _shown(SuperTabMessage m) =>
+ !_neverShown.contains(m.source['kind']);
/// The row of [id]'s list that shows [messageId]: its own, or the notice
/// that folds it in. Null while the message is not loaded.
@@ -2195,6 +2216,13 @@ class _SuperTabViewState extends State<SuperTabView>
? 'Your Buddy'
: '${_buddyName(group)} · Your Buddy';
if (name == null) return SuperTabWorkgroupName(group!, style: style);
+ if (group != null &&
+ c.snapshot!.isProjectLead(group.id) &&
+ !_devicesVisible &&
+ !_notificationsVisible &&
+ !_threadsVisible) {
+ return _projectMenu(group, name, style);
+ }
return Text(
name,
maxLines: 1,
@@ -2369,72 +2397,75 @@ class _SuperTabViewState extends State<SuperTabView>
);
}
- Widget _header(SuperTabConversation? group, bool narrow, bool showRoster) =>
- Container(
- constraints: const BoxConstraints(minHeight: 52),
- // A phone's rows line up (Huy, 2026-11-02): the sidebar icon starts at
- // the top bar's edge, and the people icon sits under its avatar.
- padding: _phone
- ? kPhoneBarRowPadding
- : const EdgeInsets.symmetric(horizontal: 20, vertical: 6),
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: DesktopChrome.rim)),
- ),
- child: Row(
- children: [
- if (narrow)
- fingerTarget(
- enabled: _phone,
- AppIconButton(
- icon: AppIcons.columns2,
- tooltip: 'Conversations',
- onPressed: () => setState(() => _sidebarOpen = !_sidebarOpen),
- ),
+ Widget _header(SuperTabConversation? group, bool narrow, bool showRoster) {
+ final isProject =
+ group != null && c.snapshot?.isProjectLead(group.id) == true;
+ return Container(
+ constraints: const BoxConstraints(minHeight: 52),
+ // A phone's rows line up (Huy, 2026-11-02): the sidebar icon starts at
+ // the top bar's edge, and the people icon sits under its avatar.
+ padding: _phone
+ ? kPhoneBarRowPadding
+ : const EdgeInsets.symmetric(horizontal: 20, vertical: 6),
+ decoration: BoxDecoration(
+ border: Border(bottom: BorderSide(color: DesktopChrome.rim)),
+ ),
+ child: Row(
+ children: [
+ if (narrow)
+ fingerTarget(
+ enabled: _phone,
+ AppIconButton(
+ icon: AppIcons.columns2,
+ tooltip: 'Conversations',
+ onPressed: () => setState(() => _sidebarOpen = !_sidebarOpen),
),
- Expanded(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 8),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- // A view saved on this device, until the first read
- // replaces it ([SuperTabReading.drawsSaved]).
- if (c.showingSaved)
- Row(
- children: [
- Flexible(child: _title(group)),
- const SizedBox(width: 8),
- // Where the copy is; how long it stays and where
- // it is cleared, a hover or a long press away.
- Flexible(
- child: Tooltip(
- message:
- 'This browser keeps a copy of the Super '
- 'Tabs you open until you sign out. '
- 'Settings ▸ Account clears it now.',
- child: Text(
- 'Saved in this browser · Updating…',
- key: const ValueKey('super-updating'),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(),
- ),
+ ),
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 8),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ // A view saved on this device, until the first read
+ // replaces it ([SuperTabReading.drawsSaved]).
+ if (c.showingSaved)
+ Row(
+ children: [
+ Flexible(child: _title(group)),
+ const SizedBox(width: 8),
+ // Where the copy is; how long it stays and where
+ // it is cleared, a hover or a long press away.
+ Flexible(
+ child: Tooltip(
+ message:
+ 'This browser keeps a copy of the Super '
+ 'Tabs you open until you sign out. '
+ 'Settings ▸ Account clears it now.',
+ child: Text(
+ 'Saved in this browser · Updating…',
+ key: const ValueKey('super-updating'),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(),
),
),
- ],
- )
- else
- _title(group),
- if (!_devicesVisible && !_listViewHoldsThePane)
- ?_subtitle(group),
- ],
- ),
+ ),
+ ],
+ )
+ else
+ _title(group),
+ if (!_devicesVisible && !_listViewHoldsThePane)
+ ?_subtitle(group),
+ ],
),
),
- if (group != null &&
- !_devicesVisible &&
- !_listViewHoldsThePane) ...[
+ ),
+ if (group != null && !_devicesVisible && !_listViewHoldsThePane) ...[
+ // A project's chat is where its header rests: the button back
+ // to it shows only from another view (Quiet Swarm, screen 1).
+ if (!isProject || _terminalsVisible || _showPullRequests)
fingerTarget(
enabled: _phone,
AppIconButton(
@@ -2456,8 +2487,10 @@ class _SuperTabViewState extends State<SuperTabView>
},
),
),
- if (!_menuNamesViews) ...[
- const SizedBox(width: 4),
+ if (isProject || !_menuNamesViews) ...[
+ const SizedBox(width: 4),
+ fingerTarget(
+ enabled: _phone,
AppIconButton(
key: const ValueKey('super-terminals'),
icon: AppIcons.terminal,
@@ -2469,6 +2502,10 @@ class _SuperTabViewState extends State<SuperTabView>
: DesktopChrome.muted,
onPressed: _openTerminals(group),
),
+ ),
+ ],
+ if (!isProject) ...[
+ if (!_menuNamesViews) ...[
const SizedBox(width: 4),
AppIconButton(
key: const ValueKey('super-pull-requests'),
@@ -2488,45 +2525,188 @@ class _SuperTabViewState extends State<SuperTabView>
_options(group, views: _menuNamesViews),
),
],
- if (!showRoster)
- fingerTarget(
- enabled: _phone,
- AppIconButton(
- icon: AppIcons.users,
- tooltip: 'Members and machines',
- selected: _rosterOpen,
- onPressed: _toggleRoster,
+ ],
+ if (!showRoster)
+ fingerTarget(
+ enabled: _phone,
+ AppIconButton(
+ icon: AppIcons.users,
+ tooltip: 'Members and machines',
+ selected: _rosterOpen,
+ onPressed: _toggleRoster,
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ static const _menuStyle = MenuStyle(
+ minimumSize: WidgetStatePropertyAll(Size(220, 0)),
+ padding: WidgetStatePropertyAll(EdgeInsets.all(grid.AppDesktop.menuInset)),
+ );
+
+ ButtonStyle _menuRowStyle({bool finger = false}) => ButtonStyle(
+ minimumSize: WidgetStatePropertyAll(Size(208, finger ? kFingerTarget : 32)),
+ side: WidgetStatePropertyAll(BorderSide.none),
+ padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 12)),
+ alignment: Alignment.centerLeft,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ );
+
+ /// A menu's row, a finger's height on a phone.
+ Widget _menuItem(
+ String label,
+ VoidCallback? action, {
+ bool finger = false,
+ Widget? trailing,
+ }) => MenuItemButton(
+ style: _menuRowStyle(finger: finger),
+ trailingIcon: trailing,
+ onPressed: action,
+ child: Text(label),
+ );
+
+ /// The reader's own setting for a chat, kept on every device (Slack's channel
+ /// notifications); a viewer has one too.
+ Widget _notifyMenu(SuperTabConversation group, {bool asRow = false}) =>
+ SubmenuButton(
+ key: const ValueKey('super-notify-menu'),
+ style: asRow ? _menuRowStyle(finger: _phone) : null,
+ submenuIcon: asRow
+ ? const WidgetStatePropertyAll(
+ Icon(AppIcons.chevronRight, size: 14),
+ )
+ : null,
+ menuChildren: [
+ for (final (level, label) in const [
+ (SuperTabNotify.all, 'All new messages'),
+ (SuperTabNotify.mentions, 'Mentions only'),
+ (SuperTabNotify.muted, 'Muted'),
+ ])
+ MenuItemButton(
+ key: ValueKey('super-notify-${level.name}'),
+ leadingIcon: SizedBox(
+ width: 16,
+ child: c.notifyOf(group.id) == level
+ ? const Icon(AppIcons.check, size: 14)
+ : null,
+ ),
+ onPressed: () => unawaited(_setNotify(group.id, level)),
+ child: Text(label),
+ ),
+ ],
+ child: const Text('Notifications'),
+ );
+
+ /// Until all of the project's closed groups are read, it may have archived
+ /// ones: the list reads them when it opens.
+ bool _mayHaveArchived(String projectId) =>
+ !c.dormantLoaded(projectId) ||
+ c.hasEarlierDormant(projectId) ||
+ c.snapshot?.conversations.any(
+ (g) => g.archived && g.projectId == projectId,
+ ) ==
+ true;
+
+ /// A project's chat header, `# name ▾`, which opens its menu (Quiet Swarm,
+ /// screen 9).
+ Widget _projectMenu(
+ SuperTabConversation group,
+ String name,
+ TextStyle style,
+ ) {
+ final project = c.snapshot!.projectFor(group.id)!;
+ final editable = c.canWrite && !c.saving && !c.hasPendingAction;
+ final owner = project.ownerId == c.accountId;
+ Widget item(String label, VoidCallback? action, {Widget? trailing}) =>
+ _menuItem(label, action, finger: _phone, trailing: trailing);
+ return MenuAnchor(
+ style: _menuStyle,
+ menuChildren: [
+ item(
+ 'Status',
+ project.status == null
+ ? null
+ : () => unawaited(
+ showSuperTabProjectStatus(context, c, project.id),
+ ),
+ trailing: const Icon(AppIcons.chevronRight, size: 14),
+ ),
+ item('Pull requests', _openPullRequests),
+ // Every member reads the project's instructions; a backend without
+ // them sends no coordinatorName.
+ if (project.hasInstructions)
+ item('Instructions', () => _groupAction('instructions', group)),
+ if (editable && owner)
+ item('Sharing', () => _groupAction('sharing', group)),
+ _notifyMenu(group, asRow: true),
+ const Divider(height: 9),
+ item(
+ 'Project settings…',
+ () => unawaited(_projectSettings(group, project)),
+ ),
+ ],
+ builder: (context, menu, _) => Tooltip(
+ message: 'Project options',
+ child: InkWell(
+ key: const ValueKey('super-project-menu'),
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ onTap: () => menu.isOpen ? menu.close() : menu.open(),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Flexible(
+ child: Text(
+ name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: style,
),
),
- ],
+ const SizedBox(width: 4),
+ Icon(
+ AppIcons.chevronDown,
+ size: AppIcons.inlineSize,
+ color: DesktopChrome.muted,
+ ),
+ ],
+ ),
),
- );
+ ),
+ );
+ }
+
+ Future<void> _projectSettings(
+ SuperTabConversation group,
+ SuperTabProject project,
+ ) {
+ final editable = c.canWrite && !c.saving && !c.hasPendingAction;
+ final owner = project.ownerId == c.accountId;
+ void act(String action) => unawaited(_groupAction(action, group));
+ return showProjectSettings(context, c, project, [
+ if (editable && owner) ('Rename project', () => act('rename')),
+ ('Project details', () => act('details')),
+ // While the PM has a switch under way, there is nothing to ask for.
+ if (editable &&
+ c.snapshot?.maySwitchLead(project.id, c.accountId) == true &&
+ c.snapshot?.leadOf(project.id)?.switchRequest == null)
+ ('Switch PM…', () => act('switch-pm')),
+ if (_mayHaveArchived(group.projectId))
+ ('Archived conversations', () => act('archived')),
+ if (editable && owner) ('Delete Project', () => act('delete')),
+ ], rowHeight: _phone ? kFingerTarget : 32);
+ }
/// The group's ⋮ menu. With [views] (a phone) it opens on the views the
/// header has no room for — the group's terminals and its pull requests —
/// each a finger's height.
Widget _options(SuperTabConversation group, {bool views = false}) {
- final project = c.snapshot?.projectFor(group.id);
- final isProject = c.snapshot?.isProjectLead(group.id) == true;
final editable = c.canWrite && !c.saving && !c.hasPendingAction;
- Widget item(String label, VoidCallback? action) => MenuItemButton(
- style: ButtonStyle(
- minimumSize: WidgetStatePropertyAll(
- Size(208, views ? kFingerTarget : 32),
- ),
- side: WidgetStatePropertyAll(BorderSide.none),
- padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 12)),
- alignment: Alignment.centerLeft,
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- onPressed: action,
- child: Text(label),
- );
+ Widget item(String label, VoidCallback? action) =>
+ _menuItem(label, action, finger: views);
return MenuAnchor(
- style: const MenuStyle(
- minimumSize: WidgetStatePropertyAll(Size(220, 0)),
- padding: WidgetStatePropertyAll(EdgeInsets.all(6)),
- ),
+ style: _menuStyle,
menuChildren: [
if (views) ...[
item(
@@ -2536,25 +2716,7 @@ class _SuperTabViewState extends State<SuperTabView>
item('Pull requests', _openPullRequests),
const Divider(height: 9),
],
- if (isProject) ...[
- if (editable && project?.ownerId == c.accountId)
- item('Rename project', () => _groupAction('rename', group)),
- item('Project details', () => _groupAction('details', group)),
- if (editable && project?.ownerId == c.accountId)
- item('Sharing', () => _groupAction('sharing', group)),
- // Every member reads the project's instructions; a backend without
- // them sends no coordinatorName.
- if (project?.hasInstructions == true)
- item('Instructions', () => _groupAction('instructions', group)),
- // While the PM has a switch under way, there is nothing to ask for.
- if (editable &&
- project != null &&
- c.snapshot?.maySwitchLead(project.id, c.accountId) == true &&
- c.snapshot?.leadOf(project.id)?.switchRequest == null)
- item('Switch PM…', () => _groupAction('switch-pm', group)),
- if (editable && project?.ownerId == c.accountId)
- item('Delete Project', () => _groupAction('delete', group)),
- ] else if (_isBuddyChat(group)) ...[
+ if (_isBuddyChat(group)) ...[
// A Buddy chat is the reader's own: the Buddy itself to name, any
// time, and to remove. Nothing to archive, and no way to a Chat with
// PM (Ken, 10-28).
@@ -2600,48 +2762,14 @@ class _SuperTabViewState extends State<SuperTabView>
),
],
],
- // The reader's own setting for this chat, kept on every device
- // (Slack's channel notifications); a viewer has one too.
- SubmenuButton(
- key: const ValueKey('super-notify-menu'),
- menuChildren: [
- for (final (level, label) in const [
- (SuperTabNotify.all, 'All new messages'),
- (SuperTabNotify.mentions, 'Mentions only'),
- (SuperTabNotify.muted, 'Muted'),
- ])
- MenuItemButton(
- key: ValueKey('super-notify-${level.name}'),
- leadingIcon: SizedBox(
- width: 16,
- child: c.notifyOf(group.id) == level
- ? const Icon(AppIcons.check, size: 14)
- : null,
- ),
- onPressed: () => unawaited(_setNotify(group.id, level)),
- child: Text(label),
- ),
- ],
- child: const Text('Notifications'),
- ),
- // Until all of the project's closed groups are read, it may have
- // archived ones: the list reads them when it opens.
- if (!c.dormantLoaded(group.projectId) ||
- c.hasEarlierDormant(group.projectId) ||
- c.snapshot?.conversations.any(
- (g) => g.archived && g.projectId == group.projectId,
- ) ==
- true)
+ _notifyMenu(group),
+ if (_mayHaveArchived(group.projectId))
item('Archived conversations', () => _groupAction('archived', group)),
],
builder: (context, menu, _) => AppIconButton(
key: const ValueKey('super-group-options'),
icon: AppIcons.ellipsisVertical,
- tooltip: isProject
- ? 'Project options'
- : _isBuddyChat(group)
- ? 'Buddy options'
- : 'Workgroup options',
+ tooltip: _isBuddyChat(group) ? 'Buddy options' : 'Workgroup options',
onPressed: () => menu.isOpen ? menu.close() : menu.open(),
),
);
@@ -2796,8 +2924,33 @@ class _SuperTabViewState extends State<SuperTabView>
bool inThread = false,
}) {
_index();
- if (message.terminalEvent || message.source['kind'] == 'overlap') {
- return SuperTabTerminalRow(
+ // A task's message and a Buddy's proposal are one line that opens (Quiet
+ // Swarm, screens 1 and 2); inside its own thread, a proposal reads whole.
+ if (message.isTaskLine) {
+ final taskId = message.source['taskId'];
+ return SuperTabTaskLine(
+ key: ValueKey('super-message-${message.id}'),
+ message: message,
+ readerId: c.accountId,
+ onOpen: taskId is String && c.snapshot?.conversation(taskId) != null
+ ? () => _openTask(taskId, message.id)
+ : null,
+ );
+ }
+ final proposer = inThread ? null : _proposalOwner(message);
+ if (proposer != null) {
+ return SuperTabProposalLine(
+ key: ValueKey('super-message-${message.id}'),
+ message: message,
+ owner: proposer,
+ onOpen: () {
+ setState(() => _openedTask = null);
+ c.openThread(message.id);
+ },
+ );
+ }
+ if (SuperTabShipRow.shows(message)) {
+ return SuperTabShipRow(
key: ValueKey(
'${inThread ? 'super-thread-message' : 'super-message'}-${message.id}',
),
@@ -2805,8 +2958,8 @@ class _SuperTabViewState extends State<SuperTabView>
controller: c,
);
}
- if (SuperTabShipRow.shows(message)) {
- return SuperTabShipRow(
+ if (message.terminalEvent) {
+ return SuperTabTerminalRow(
key: ValueKey(
'${inThread ? 'super-thread-message' : 'super-message'}-${message.id}',
),
@@ -2986,6 +3139,9 @@ class _SuperTabViewState extends State<SuperTabView>
/// The open thread of the selected conversation, beside the chat.
Widget? _threadPanel() {
final open = c.openedThread;
+ // A thread opened from anywhere takes the panel's place, for good.
+ if (open != null) _openedTask = null;
+ if (_taskPanel() case final panel?) return panel;
if (open == null || open.conversationId != c.selectedId) return null;
final rows = c.threadMessages(open.root);
final byId = {for (final m in rows) m.id: m};
@@ -3002,6 +3158,42 @@ class _SuperTabViewState extends State<SuperTabView>
);
}
+ /// The task a line opened beside its project's chat (Quiet Swarm, screen 3):
+ /// which, and the line, whose word the panel says.
+ ({String id, String line, String chat})? _openedTask;
+
+ void _openTask(String taskId, String line) {
+ c.closeThread();
+ setState(() => _openedTask = (id: taskId, line: line, chat: c.selectedId));
+ }
+
+ Widget? _taskPanel() {
+ final open = _openedTask;
+ final task = open == null ? null : c.snapshot?.conversation(open.id);
+ if (open == null || task == null || open.chat != c.selectedId) return null;
+ final line = c
+ .messages(open.chat)
+ .where((m) => m.id == open.line)
+ .firstOrNull;
+ final byId = {for (final m in c.taskMessages(open.id)) m.id: m};
+ return SuperTabTaskPanel(
+ key: ValueKey('super-task-panel-${open.id}'),
+ controller: c,
+ taskId: open.id,
+ word: line == null ? '' : superTabTaskWord(line, c.accountId),
+ mark: line == null ? null : superTabTaskMark(line),
+ // The whole conversation (screen 3): agents answer with replies.
+ rows: () => _shownMessages(open.id, replies: true),
+ row: (message) => _message(message, false, byId, inThread: true),
+ outgoing: (sent) => _outgoingRow(sent, byId, grouped: false),
+ onClose: () => setState(() => _openedTask = null),
+ onOpenInFull: () {
+ setState(() => _openedTask = null);
+ unawaited(c.select(open.id));
+ },
+ );
+ }
+
/// On the web a conversation is read before anything else is drawn
/// ([WorkspaceChrome.superTabRecovers]); Desktop keeps "Loading" meanwhile.
bool get _readsFirst => WorkspaceChrome.of(context).superTabRecovers;
@@ -3284,8 +3476,6 @@ class _SuperTabViewState extends State<SuperTabView>
_ => false,
},
);
- // The controller these rows were built for, read when a row is pressed.
- final shownFor = c;
Widget row(int index) {
final entry = entries[index];
final message = entry.message;
@@ -3304,26 +3494,8 @@ class _SuperTabViewState extends State<SuperTabView>
previous?.createdAt?.toLocal(),
))
_date(time),
- if (message.id == _unread.lineAt(c.selectedId)) ...[
+ if (message.id == _unread.lineAt(c.selectedId))
SuperTabNewMessagesLine(key: _unread.key),
- if (_unread.catchUps.of(c.selectedId) case final summary?)
- SuperTabCatchUpCard(
- summary: summary,
- onOpen: (messageId) =>
- unawaited(_openMessage(c.selectedId, messageId)),
- onClose: () =>
- setState(() => _unread.catchUps.dismiss(c.selectedId)),
- // Activity lists only the reader's own decisions and tags.
- onOpenDecisions: () => _openActivity(
- filter: SuperTabActivityFilter.decisions,
- from: shownFor,
- ),
- onOpenMentions: () => _openActivity(
- filter: SuperTabActivityFilter.mentions,
- from: shownFor,
- ),
- ),
- ],
// The message itself is kept in place: its
// date moves above earlier ones as they come.
_BuiltRow(
@@ -3424,16 +3596,6 @@ class _SuperTabViewState extends State<SuperTabView>
decisions: SuperTabDecisions.of(c),
projectId: group.projectId,
),
- // A project's chat opens with its status card: the coordinator's
- // progress, replaced in place, and what waits on the reader there.
- if (group != null && c.snapshot?.isProjectLead(group.id) == true)
- for (final project in c.snapshot!.projects)
- if (project.leadConversationId == group.id)
- SuperTabProjectStatusCard(
- key: ValueKey('super-project-status-card-${project.id}'),
- controller: c,
- projectId: project.id,
- ),
Expanded(
child: c.loading
? const Center(child: CircularProgressIndicator())
@@ -4217,7 +4379,10 @@ class _SuperTabViewState extends State<SuperTabView>
Positioned.fill(
child: BlockSemantics(
child: GestureDetector(
- onTap: c.closeThread,
+ onTap: () {
+ setState(() => _openedTask = null);
+ c.closeThread();
+ },
child: ColoredBox(
color: grid.AppDesktop.veil(Theme.of(context).brightness),
child: Align(
diff --git a/desktop/test/super_tab_buddies_test.dart b/desktop/test/super_tab_buddies_test.dart
index ef1f5042c..0d1f241ad 100644
--- a/desktop/test/super_tab_buddies_test.dart
+++ b/desktop/test/super_tab_buddies_test.dart
@@ -1545,7 +1545,7 @@ void main() {
group('a proposal in the project chat', () {
testWidgets(
- "is labelled from the server's tag, with whose behalf it is on",
+ "opens labelled from the server's tag, with whose behalf it is on",
(tester) async {
final server = buddySwarm();
giveBuddy(server);
@@ -1559,16 +1559,22 @@ void main() {
'ownerMessageId': 'message-1',
},
);
+ // The server gives a top-level message itself as its thread.
+ final proposal = server.messages.last;
+ proposal['thread'] = proposal['id'];
// A Buddy's ordinary message carries no label, whatever it says.
buddyReply(server, 'lead', 'Proposal · on ken.tran\'s behalf');
final c = await show(tester, server);
await c.select('lead');
await tester.pumpAndSettle();
+ // In the chat it is one line; opened, it reads whole, labelled.
expect(
find.byKey(const ValueKey('super-proposal-label')),
- findsOneWidget,
+ findsNothing,
);
+ await tester.tap(find.textContaining('Proposal from'));
+ await tester.pumpAndSettle();
expect(
find.descendant(
of: find.byKey(const ValueKey('super-proposal-label')),
diff --git a/desktop/test/super_tab_catch_up_shots_test.dart b/desktop/test/super_tab_catch_up_shots_test.dart
deleted file mode 100644
index f062d9f7e..000000000
--- a/desktop/test/super_tab_catch_up_shots_test.dart
+++ /dev/null
@@ -1,144 +0,0 @@
-import 'dart:io';
-import 'dart:ui' as ui;
-
-import 'package:flutter/gestures.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:harness/shared/theme/app_theme.dart' as grid;
-import 'package:harness/super_tabs/view.dart';
-
-import 'box_render_preview_test.dart' show loadPreviewFonts;
-import 'support/super_tab_fixture.dart';
-
-/// Set to a folder to write the PR's screenshots there.
-final shots = Platform.environment['SUPER_TAB_CATCH_UP_SHOTS'];
-
-const _updates = [
- 'Reading the offline queue before the reconnect.',
- 'The reconnect keeps every queued edit in order.',
- 'Two devices editing at once settle on the newest edit.',
- 'Pushed the branch; the checks are running.',
-];
-
-Map<String, dynamic> _item(int sequence, String author, String text) => {
- 'messageId': 'message-$sequence',
- 'sequence': sequence,
- 'author': author,
- 'text': text,
-};
-
-/// The chat opened after a while away: the New messages line with the
-/// catch-up card under it, at normal and enlarged text, and with the pointer
-/// on its decisions link.
-void main() {
- setUpAll(() async {
- if (shots != null) await loadPreviewFonts();
- });
-
- for (final (brightness, scale, hovered) in [
- (Brightness.light, 1.0, false),
- (Brightness.dark, 1.0, false),
- (Brightness.dark, 1.8, false),
- (Brightness.light, 1.0, true),
- (Brightness.dark, 1.0, true),
- ]) {
- final name =
- '${brightness.name}${scale > 1 ? '-large-text' : ''}'
- '${hovered ? '-decisions-hover' : ''}';
- testWidgets('screenshots for review ($name)', (tester) async {
- final picture = GlobalKey();
- final server = ConversationServer();
- for (var i = 1; i <= 80; i++) {
- server.append('${_updates[i % _updates.length]} ($i)');
- server.messages.last['author'] = {
- 'kind': 'agent',
- 'id': 'lead-agent',
- 'name': 'Lead',
- };
- }
- server.markReadElsewhere('lead', 30);
- server.catchUps['lead'] = {
- 'after': 30,
- 'through': 80,
- 'unread': 50,
- 'more': false,
- 'decisions': 1,
- 'needsYou': {
- 'total': 2,
- 'items': [
- _item(
- 52,
- 'River',
- 'Dee, the reconnect can keep the newest edit or ask the person. Which one should ship first?',
- ),
- _item(61, 'River', 'Dee, can you try the phone build tonight?'),
- ],
- },
- 'blocked': {
- 'total': 1,
- 'items': [
- _item(74, 'Iris', 'Stuck: No iPhone simulator on this Mac.'),
- ],
- },
- 'landed': {
- 'total': 4,
- 'items': [
- _item(44, 'River', 'Offline queue keeps edits in order'),
- _item(58, 'River', 'Done: Merged #2201.'),
- ],
- },
- };
- final c = server.controller();
- addTearDown(c.dispose);
- await c.refresh();
- grid.AppTheme.brightness.value = brightness;
- addTearDown(() => grid.AppTheme.brightness.value = Brightness.light);
- tester.view.physicalSize = const Size(1200, 860);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- await tester.pumpWidget(
- MaterialApp(
- theme: grid.buildAppTheme(brightness: brightness),
- builder: (context, child) => MediaQuery(
- data: MediaQuery.of(context)
- .copyWith(textScaler: TextScaler.linear(scale)),
- child: RepaintBoundary(key: picture, child: child),
- ),
- home: Scaffold(
- body: SuperTabView(
- controller: c,
- onInvite: () {},
- onAddAgent: (_) {},
- onOpenTerminal: (_) {},
- machineName: (_) => 'Mac Studio',
- ),
- ),
- ),
- );
- await tester.pumpAndSettle();
- expect(find.byKey(const ValueKey('super-catch-up')), findsOne);
- if (hovered) {
- final link = find.byKey(const ValueKey('super-catch-up-decisions'));
- expect(link, findsOne);
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: tester.getCenter(link));
- addTearDown(mouse.removePointer);
- await tester.pumpAndSettle();
- }
- expect(tester.takeException(), isNull);
- if (shots == null) return;
- await tester.runAsync(() async {
- final boundary =
- picture.currentContext!.findRenderObject()!
- as RenderRepaintBoundary;
- final image = await boundary.toImage(pixelRatio: 1.5);
- final bytes = await image.toByteData(format: ui.ImageByteFormat.png);
- await Directory(shots!).create(recursive: true);
- await File('$shots/catch-up-$name.png')
- .writeAsBytes(bytes!.buffer.asUint8List());
- image.dispose();
- });
- });
- }
-}
diff --git a/desktop/test/super_tab_catch_up_test.dart b/desktop/test/super_tab_catch_up_test.dart
deleted file mode 100644
index 8babf88ed..000000000
--- a/desktop/test/super_tab_catch_up_test.dart
+++ /dev/null
@@ -1,489 +0,0 @@
-import 'dart:async';
-
-import 'package:flutter/gestures.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
-import 'package:flutter/services.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:harness/shared/theme/app_theme.dart' as grid;
-import 'package:harness/super_tabs/activity.dart';
-import 'package:harness/super_tabs/activity_view.dart';
-import 'package:harness/super_tabs/catch_up.dart';
-import 'package:harness/super_tabs/catch_up_card.dart';
-import 'package:harness/super_tabs/controller.dart';
-import 'package:harness/super_tabs/message_row.dart';
-import 'package:harness/super_tabs/view.dart';
-
-import 'support/super_tab_fixture.dart';
-
-const _card = ValueKey('super-catch-up');
-const _close = ValueKey('super-catch-up-close');
-const _line = ValueKey('super-new-messages-line');
-const _decisions = ValueKey('super-catch-up-decisions');
-const _mentions = ValueKey('super-catch-up-mentions');
-
-/// [count] messages in the Lead conversation from the Lead agent.
-ConversationServer _server(int count) {
- final server = ConversationServer();
- for (var i = 1; i <= count; i++) {
- server.append('Update $i');
- server.messages.last['author'] = {
- 'kind': 'agent',
- 'id': 'lead-agent',
- 'name': 'Lead',
- };
- }
- return server;
-}
-
-Map<String, dynamic> _item(int sequence, String text, {String by = 'River'}) =>
- {
- 'messageId': 'message-$sequence',
- 'sequence': sequence,
- 'author': by,
- 'text': text,
- };
-
-Map<String, dynamic> _list(List<Map<String, dynamic>> items, {int? total}) => {
- 'total': total ?? items.length,
- 'items': items,
-};
-
-/// What the backend answers for the Lead conversation read after message 10.
-Map<String, dynamic> _summary({
- List<Map<String, dynamic>> landed = const [],
- List<Map<String, dynamic>> blocked = const [],
- List<Map<String, dynamic>> needsYou = const [],
- int needsYouTotal = 0,
- int decisions = 0,
- bool more = false,
-}) => {
- 'after': 10,
- 'through': 40,
- 'unread': 30,
- 'more': more,
- 'decisions': decisions,
- 'landed': _list(landed),
- 'blocked': _list(blocked),
- 'needsYou': _list(needsYou, total: needsYouTotal > 0 ? needsYouTotal : null),
-};
-
-/// Every list with more than it shows, and two decisions: Needs you 3 more,
-/// Blocked 2 more, Landed 4 more.
-Map<String, dynamic> _counted() => {
- ..._summary(decisions: 2),
- 'needsYou': _list([_item(25, 'Question 3')], total: 4),
- 'blocked': _list([_item(26, 'Stuck: no simulator', by: 'Iris')], total: 3),
- 'landed': _list([_item(27, 'Avatars')], total: 5),
-};
-
-void main() {
- Future<SuperTabController> show(
- WidgetTester tester,
- ConversationServer server,
- ) async {
- final c = server.controller();
- await c.refresh();
- await tester.pumpWidget(
- MaterialApp(
- theme: grid.buildAppTheme(brightness: Brightness.dark),
- home: Scaffold(
- body: SuperTabView(
- controller: c,
- onInvite: () {},
- onAddAgent: (_) {},
- onOpenTerminal: (_) {},
- machineName: (_) => 'Team Mac',
- ),
- ),
- ),
- );
- await tester.pumpAndSettle();
- addTearDown(c.dispose);
- return c;
- }
-
- Finder inCard(String text) =>
- find.descendant(of: find.byKey(_card), matching: find.text(text));
-
- /// An item row, whose words follow its author's name.
- Finder rowSaying(String text) => find.descendant(
- of: find.byKey(_card),
- matching: find.textContaining(text),
- );
-
- group('SuperTabCatchUp', () {
- test('reads the backend summary, and is empty with nothing listed', () {
- final summary = SuperTabCatchUp.fromJson(
- _summary(
- needsYou: [_item(12, 'Dee, which colour?')],
- needsYouTotal: 7,
- decisions: 2,
- ),
- );
- expect(summary.unread, 30);
- expect(summary.decisions, 2);
- expect(summary.needsYou.total, 7);
- expect(summary.needsYou.items.single.messageId, 'message-12');
- expect(summary.needsYou.items.single.author, 'River');
- expect(summary.needsYou.items.single.text, 'Dee, which colour?');
- expect(summary.isEmpty, isFalse);
- expect(SuperTabCatchUp.fromJson(_summary()).isEmpty, isTrue);
- // Decisions alone are something that needs the reader.
- expect(SuperTabCatchUp.fromJson(_summary(decisions: 1)).isEmpty, isFalse);
- // A span longer than one summary reads is shown even with nothing
- // listed: the reader is told it is partial.
- final partial = SuperTabCatchUp.fromJson(_summary(more: true));
- expect(partial.more, isTrue);
- expect(partial.isEmpty, isFalse);
- // A malformed answer is empty, never a crash.
- expect(SuperTabCatchUp.fromJson(const {}).isEmpty, isTrue);
- });
- });
-
- for (final late in [false, true]) {
- testWidgets('shows what the reader missed just under the New messages '
- 'line (${late ? 'answered late' : 'answered at once'})', (
- tester,
- ) async {
- // A window and a span as long as a real return's: the card arrives
- // once the view has opened at the line.
- tester.view.physicalSize = const Size(1200, 860);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- final server = _server(80)..markReadElsewhere('lead', 30);
- server.catchUps['lead'] = _summary(
- landed: [_item(40, 'Avatars'), _item(44, 'Done: Merged #2201.')],
- blocked: [_item(50, 'Stuck: No simulator on this Mac.', by: 'Iris')],
- needsYou: [_item(45, 'Dee, which colour?')],
- );
- final hold = late ? server.holdCatchUp = Completer<void>() : null;
- await show(tester, server);
- if (hold != null) {
- expect(find.byKey(_card), findsNothing);
- hold.complete();
- await tester.pumpAndSettle();
- }
- expect(server.catchUpReads, [
- '/api/super-tabs/tab/conversations/lead/catch-up?after=30',
- ]);
- expect(find.byKey(_card), findsOneWidget);
- // Whenever it arrives, the line and the card's top are in view: the card
- // makes the line's row taller than the view.
- final list = tester.getRect(
- find.byKey(const PageStorageKey('super-messages-tab-lead')),
- );
- expect(tester.getTopLeft(find.byKey(_line)).dy, greaterThan(list.top));
- expect(
- tester.getTopLeft(inCard('While you were away')).dy,
- lessThan(list.bottom),
- );
- expect(inCard('While you were away'), findsOneWidget);
- expect(inCard('30 new messages'), findsOneWidget);
- for (final heading in ['Needs you', 'Blocked', 'Landed']) {
- expect(inCard(heading), findsOneWidget);
- }
- expect(rowSaying('Dee, which colour?'), findsOneWidget);
- expect(rowSaying('Stuck: No simulator on this Mac.'), findsOneWidget);
- expect(rowSaying('Avatars'), findsOneWidget);
- // Needs you first: what the reader has to act on.
- final top = tester.getTopLeft(inCard('Needs you')).dy;
- expect(top, lessThan(tester.getTopLeft(inCard('Blocked')).dy));
- expect(
- tester.getTopLeft(inCard('Blocked')).dy,
- lessThan(tester.getTopLeft(inCard('Landed')).dy),
- );
- // At the top of the new messages: below the line, above the first unread.
- expect(
- tester.getTopLeft(find.byKey(_card)).dy,
- greaterThan(tester.getTopLeft(find.byKey(_line)).dy),
- );
- expect(
- tester.getTopLeft(find.byKey(_card)).dy,
- lessThan(tester.getTopLeft(find.text('Update 31')).dy),
- );
- });
- }
-
- testWidgets('an item opens its message, lit', (tester) async {
- final server = _server(40)..markReadElsewhere('lead', 10);
- server.catchUps['lead'] = _summary(needsYou: [_item(38, 'Update 38')]);
- await show(tester, server);
- await tester.tap(find.byKey(const ValueKey('super-catch-up-message-38')));
- await tester.pumpAndSettle();
- final lit = find.byWidgetPredicate(
- (w) => w is SuperTabMessageHighlight && w.on,
- );
- expect(
- find.descendant(of: lit, matching: find.text('Update 38')),
- findsOneWidget,
- );
- });
-
- testWidgets('says how many more each list has, and the decisions waiting', (
- tester,
- ) async {
- final server = _server(40)..markReadElsewhere('lead', 10);
- server.catchUps['lead'] = _summary(
- needsYou: [_item(25, 'Question 3'), _item(26, 'Question 4')],
- needsYouTotal: 5,
- decisions: 2,
- );
- await show(tester, server);
- expect(inCard('3 more'), findsOneWidget);
- expect(inCard('2 decisions wait for you'), findsOneWidget);
- });
-
- testWidgets('says when it covers only the first part of a long absence', (
- tester,
- ) async {
- final server = _server(40)..markReadElsewhere('lead', 10);
- server.catchUps['lead'] = _summary(more: true);
- await show(tester, server);
- expect(find.byKey(_card), findsOneWidget);
- // Never a count that reads as complete.
- expect(inCard('30+ new messages'), findsOneWidget);
- expect(inCard('30 new messages'), findsNothing);
- expect(
- inCard(
- 'Covers only the first part of what you missed. '
- 'Newer messages are below.',
- ),
- findsOneWidget,
- );
- });
-
- testWidgets('Close dismisses it for this visit, without reading again', (
- tester,
- ) async {
- final server = _server(40)..markReadElsewhere('lead', 10);
- server.catchUps['lead'] = _summary(landed: [_item(20, 'Avatars')]);
- final c = await show(tester, server);
- await tester.tap(find.byKey(_close));
- await tester.pumpAndSettle();
- expect(find.byKey(_card), findsNothing);
- // The line stays: only the card was dismissed.
- expect(find.byKey(_line), findsOneWidget);
- server.append('Later');
- await c.refresh();
- await tester.pumpAndSettle();
- expect(find.byKey(_card), findsNothing);
- expect(server.catchUpReads, hasLength(1));
- });
-
- testWidgets('Esc reads everything, card and line together', (tester) async {
- final server = _server(40)..markReadElsewhere('lead', 10);
- server.catchUps['lead'] = _summary(landed: [_item(20, 'Avatars')]);
- await show(tester, server);
- await tester.tap(find.byType(TextField).last);
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await tester.pumpAndSettle();
- expect(find.byKey(_card), findsNothing);
- expect(find.byKey(_line), findsNothing);
- });
-
- testWidgets('no card when nothing landed, is blocked or needs the reader', (
- tester,
- ) async {
- final server = _server(40)..markReadElsewhere('lead', 10);
- await show(tester, server);
- expect(server.catchUpReads, hasLength(1));
- expect(find.byKey(_line), findsOneWidget);
- expect(find.byKey(_card), findsNothing);
- });
-
- testWidgets('nothing unread reads no summary', (tester) async {
- final server = _server(40)..markReadElsewhere('lead', 40);
- await show(tester, server);
- expect(server.catchUpReads, isEmpty);
- expect(find.byKey(_card), findsNothing);
- });
-
- testWidgets('a failed read leaves the New messages line as it was', (
- tester,
- ) async {
- final server = _server(40)
- ..markReadElsewhere('lead', 10)
- ..failCatchUp = true;
- await show(tester, server);
- expect(find.byKey(_card), findsNothing);
- expect(find.byKey(_line), findsOneWidget);
- });
-
- group('the counts open what they count', () {
- Future<SuperTabController> showCounted(WidgetTester tester) async {
- tester.view.physicalSize = const Size(1200, 860);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- final server = _server(40)..markReadElsewhere('lead', 10);
- server.catchUps['lead'] = _counted();
- return show(tester, server);
- }
-
- Finder activityView() => find.byType(SuperTabActivityView);
-
- testWidgets('the decisions line opens Activity on Decisions', (
- tester,
- ) async {
- final c = await showCounted(tester);
- expect(
- find.descendant(
- of: find.byKey(_decisions),
- matching: find.text('2 decisions wait for you'),
- ),
- findsOneWidget,
- );
- expect(activityView(), findsNothing);
- await tester.tap(find.byKey(_decisions));
- await tester.pumpAndSettle();
- expect(activityView(), findsOneWidget);
- expect(SuperTabActivity.of(c).filter, SuperTabActivityFilter.decisions);
- });
-
- testWidgets(
- 'Activity opened from the sidebar starts on All after a Decisions visit',
- (tester) async {
- final c = await showCounted(tester);
- await tester.tap(find.byKey(_decisions));
- await tester.pumpAndSettle();
- expect(SuperTabActivity.of(c).filter, SuperTabActivityFilter.decisions);
- // The row, with Activity still showing.
- await tester.tap(find.byKey(const ValueKey('super-activity')));
- await tester.pumpAndSettle();
- expect(activityView(), findsOneWidget);
- expect(SuperTabActivity.of(c).filter, SuperTabActivityFilter.all);
- },
- );
-
- testWidgets("Needs you's more opens Activity on Mentions", (tester) async {
- final c = await showCounted(tester);
- expect(
- find.descendant(
- of: find.byKey(_mentions),
- matching: find.text('3 more'),
- ),
- findsOneWidget,
- );
- await tester.tap(find.byKey(_mentions));
- await tester.pumpAndSettle();
- expect(activityView(), findsOneWidget);
- expect(SuperTabActivity.of(c).filter, SuperTabActivityFilter.mentions);
- });
-
- for (final (key, filter, press, name) in [
- (
- _decisions,
- SuperTabActivityFilter.decisions,
- LogicalKeyboardKey.enter,
- 'Enter',
- ),
- (
- _mentions,
- SuperTabActivityFilter.mentions,
- LogicalKeyboardKey.space,
- 'Space',
- ),
- ]) {
- testWidgets('$name on the focused ${filter.name} link opens '
- 'it, the focus drawn', (tester) async {
- final c = await showCounted(tester);
- expect(find.byKey(key), findsOneWidget);
- // The link takes keyboard focus as the app's other controls do.
- final node = Focus.of(
- tester.element(
- find.descendant(of: find.byKey(key), matching: find.byType(Text)),
- ),
- );
- node.requestFocus();
- await tester.pumpAndSettle();
- expect(node.hasPrimaryFocus, isTrue);
- final rim = tester.widget<DecoratedBox>(
- find
- .descendant(
- of: find.byKey(key),
- matching: find.byType(DecoratedBox),
- )
- .first,
- );
- expect(
- (rim.decoration as BoxDecoration).border!.top.color,
- grid.AppDesktop.focus,
- );
- await tester.sendKeyEvent(press);
- await tester.pumpAndSettle();
- expect(activityView(), findsOneWidget);
- expect(SuperTabActivity.of(c).filter, filter);
- });
- }
-
- testWidgets('a hand over the link, which underlines it in the accent', (
- tester,
- ) async {
- await showCounted(tester);
- final text = find.descendant(
- of: find.byKey(_decisions),
- matching: find.text('2 decisions wait for you'),
- );
- TextStyle style() => tester.widget<Text>(text).style!;
- expect(style().decoration, isNot(TextDecoration.underline));
- expect(style().color, grid.AppPalette.accentOnSurface);
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: Offset.zero);
- addTearDown(mouse.removePointer);
- await mouse.moveTo(tester.getCenter(text));
- await tester.pumpAndSettle();
- expect(
- RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1),
- SystemMouseCursors.click,
- );
- expect(style().decoration, TextDecoration.underline);
- });
-
- testWidgets("Blocked's and Landed's more are words, not links", (
- tester,
- ) async {
- await showCounted(tester);
- for (final more in ['2 more', '4 more']) {
- expect(inCard(more), findsOneWidget);
- expect(
- find.ancestor(of: inCard(more), matching: find.byType(SuperTabLink)),
- findsNothing,
- );
- expect(
- find.ancestor(of: inCard(more), matching: find.byType(InkWell)),
- findsNothing,
- );
- }
- // Only the two that have somewhere to go.
- expect(
- find.descendant(
- of: find.byKey(_card),
- matching: find.byType(SuperTabLink),
- ),
- findsNWidgets(2),
- );
- });
- });
-
- testWidgets('with nowhere to open, the counts are plain words', (
- tester,
- ) async {
- await tester.pumpWidget(
- MaterialApp(
- theme: grid.buildAppTheme(brightness: Brightness.dark),
- home: Scaffold(
- body: SuperTabCatchUpCard(
- summary: SuperTabCatchUp.fromJson(_counted()),
- onOpen: (_) {},
- onClose: () {},
- ),
- ),
- ),
- );
- expect(inCard('2 decisions wait for you'), findsOneWidget);
- expect(inCard('3 more'), findsOneWidget);
- expect(find.byKey(_decisions), findsNothing);
- expect(find.byKey(_mentions), findsNothing);
- expect(find.byType(SuperTabLink), findsNothing);
- });
-}
diff --git a/desktop/test/super_tab_chat_test.dart b/desktop/test/super_tab_chat_test.dart
index 296427e2a..5cee20911 100644
--- a/desktop/test/super_tab_chat_test.dart
+++ b/desktop/test/super_tab_chat_test.dart
@@ -196,7 +196,9 @@ void main() {
(tester) async {
final server = ConversationServer()..append('First update');
final c = await show(tester, server);
- await tester.tap(find.byKey(const ValueKey('super-pull-requests')));
+ await tester.tap(find.byTooltip('Project options'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));
await tester.pumpAndSettle();
server.append('The review is ready.');
await c.refresh();
@@ -233,7 +235,9 @@ void main() {
) async {
final server = ConversationServer()..append('Visible update');
final c = await show(tester, server);
- await tester.tap(find.byKey(const ValueKey('super-pull-requests')));
+ await tester.tap(find.byTooltip('Project options'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));
await tester.pumpAndSettle();
server.append('Not yet fetched');
c.snapshot = SuperTabSnapshot.fromJson(server.state);
@@ -617,7 +621,9 @@ void main() {
expect(scroll().offset, reading);
expect(find.text('2 new messages'), findsOneWidget);
expect(c.unread(c.selected!), isTrue);
- await tester.tap(find.byKey(const ValueKey('super-pull-requests')));
+ await tester.tap(find.byTooltip('Project options'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('super-chat')));
await tester.pumpAndSettle();
diff --git a/desktop/test/super_tab_heartbeat_widgets_test.dart b/desktop/test/super_tab_heartbeat_widgets_test.dart
index 48ddcf696..93193a9d6 100644
--- a/desktop/test/super_tab_heartbeat_widgets_test.dart
+++ b/desktop/test/super_tab_heartbeat_widgets_test.dart
@@ -4,7 +4,6 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/super_tabs/controller.dart';
import 'package:harness/super_tabs/machines.dart';
-import 'package:harness/super_tabs/project_status_card.dart';
import 'package:harness/super_tabs/reading.dart';
import 'package:harness/super_tabs/roster.dart';
import 'package:harness/super_tabs/view.dart';
@@ -86,10 +85,6 @@ class _Screen {
onAnswer: (_) {},
),
),
- SuperTabProjectStatusCard(
- controller: c,
- projectId: c.snapshot?.projects.firstOrNull?.id ?? 'p',
- ),
Expanded(
child: ValueListenableBuilder(
valueListenable: collapsed!,
@@ -138,7 +133,6 @@ class _Screen {
for (final type in const [
SuperTabView,
SuperTabRoster,
- SuperTabProjectStatusCard,
SuperTabMachines,
]) {
if (element.widget.runtimeType == type) bump(type);
@@ -147,7 +141,6 @@ class _Screen {
final type = up.widget.runtimeType;
if (type == SuperTabView ||
type == SuperTabRoster ||
- type == SuperTabProjectStatusCard ||
type == SuperTabMachines) {
bump(type);
return false;
@@ -187,7 +180,6 @@ void main() {
'roster list builds ${s.rosterBuilds}',
);
expect(s.rebuilt[SuperTabView] ?? 0, 0);
- expect(s.rebuilt[SuperTabProjectStatusCard] ?? 0, 0);
// Only its own 30-second clock, for ages and leases on a quiet Swarm.
expect(s.rosterBuilds, lessThanOrEqualTo(2));
await s.close();
diff --git a/desktop/test/super_tab_instructions_test.dart b/desktop/test/super_tab_instructions_test.dart
index 4b8c28f29..6deeb7802 100644
--- a/desktop/test/super_tab_instructions_test.dart
+++ b/desktop/test/super_tab_instructions_test.dart
@@ -280,7 +280,7 @@ void main() {
testWidgets('an older Swarm shows no Instructions', (tester) async {
final (server, controller) = await mount(tester, instructions: false);
await openMenu(tester);
- expect(menuItem('Project details'), findsOneWidget);
+ expect(menuItem('Project settings…'), findsOneWidget);
expect(menuItem('Instructions'), findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
diff --git a/desktop/test/super_tab_phone_header_test.dart b/desktop/test/super_tab_phone_header_test.dart
index d3212069c..b9241ee35 100644
--- a/desktop/test/super_tab_phone_header_test.dart
+++ b/desktop/test/super_tab_phone_header_test.dart
@@ -1,8 +1,7 @@
-// The Super Tab's header on a phone (the web below compactBelow): Chat, the
-// people and machines and the ⋮ menu stay in the bar, a finger's size each,
-// and the menu names what the bar drew as bare icons — the group's terminals
-// and its pull requests — while the header says which of them is open. A
-// wider window keeps the icons.
+// The Super Tab's header on a phone (the web below compactBelow): the project
+// menu, the terminal and the people and machines stay in the bar, a finger's
+// size each, and the menu names pull requests, while the header says which
+// view is open.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -11,36 +10,36 @@ import 'package:harness/super_tabs/roster.dart';
import 'support/super_tab_phone.dart';
-final _options = find.byKey(const ValueKey('super-group-options'));
+final _menu = find.byTooltip('Project options');
final _people = find.byTooltip('Members and machines');
final _openView = find.byKey(const ValueKey('super-open-view'));
void main() {
- testWidgets('a phone keeps Chat and the menu in the bar, a finger each', (
+ testWidgets('a phone keeps the menu, the terminal and people in the bar', (
tester,
) async {
final (_, controller) = await mountPhoneSuperTab(
tester,
const Size(390, 844),
);
- expect(find.byKey(const ValueKey('super-terminals')), findsNothing);
expect(find.byKey(const ValueKey('super-pull-requests')), findsNothing);
+ expect(find.byKey(const ValueKey('super-chat')), findsNothing);
for (final control in [
find.byTooltip('Conversations'),
- find.byKey(const ValueKey('super-chat')),
+ find.byKey(const ValueKey('super-terminals')),
_people,
- _options,
]) {
expect(control, findsOneWidget);
final size = tester.getSize(control);
expect(size.width, greaterThanOrEqualTo(44));
expect(size.height, greaterThanOrEqualTo(44));
}
+ expect(_menu, findsOneWidget);
expect(tester.takeException(), isNull);
await unmountPhoneSuperTab(tester, controller);
});
- testWidgets('the phone menu names terminals and pull requests', (
+ testWidgets('the phone menu\'s rows are a finger high, and name the views', (
tester,
) async {
var terminals = 0;
@@ -49,20 +48,17 @@ void main() {
const Size(390, 844),
onOpenGroupTerminals: () => terminals++,
);
- Future<void> choose(String label) async {
- await tester.tap(_options);
- await tester.pumpAndSettle();
- final row = find.widgetWithText(MenuItemButton, label);
- expect(tester.getSize(row).height, greaterThanOrEqualTo(44));
- await tester.tap(row);
- await tester.pumpAndSettle();
- }
-
- await choose('Group terminals (1)');
+ await tester.tap(find.byKey(const ValueKey('super-terminals')));
+ await tester.pumpAndSettle();
expect(terminals, 1);
- await choose('Pull requests');
- // Chat is no longer the view: the pull requests are.
+ await tester.tap(_menu);
+ await tester.pumpAndSettle();
+ final row = find.widgetWithText(MenuItemButton, 'Pull requests');
+ expect(tester.getSize(row).height, greaterThanOrEqualTo(44));
+ await tester.tap(row);
+ await tester.pumpAndSettle();
+ // Chat is no longer the view: the pull requests are, and it comes back.
expect(
tester
.widget<AppIconButton>(find.byKey(const ValueKey('super-chat')))
@@ -73,16 +69,16 @@ void main() {
await unmountPhoneSuperTab(tester, controller);
});
- testWidgets('a wide window keeps the icons in the header', (tester) async {
+ testWidgets('a wide window draws the same header', (tester) async {
final (_, controller) = await mountPhoneSuperTab(
tester,
const Size(1280, 800),
);
expect(find.byKey(const ValueKey('super-terminals')), findsOneWidget);
- expect(find.byKey(const ValueKey('super-pull-requests')), findsOneWidget);
- await tester.tap(_options);
+ expect(find.byKey(const ValueKey('super-pull-requests')), findsNothing);
+ await tester.tap(_menu);
await tester.pumpAndSettle();
- expect(find.text('Pull requests'), findsNothing);
+ expect(find.text('Pull requests'), findsOneWidget);
expect(find.text('Members and machines'), findsNothing);
await unmountPhoneSuperTab(tester, controller);
});
@@ -111,7 +107,7 @@ void main() {
testWidgets('a phone header says which view is open', (tester) async {
final (_, chat) = await mountPhoneSuperTab(tester, const Size(390, 844));
expect(_openView, findsNothing, reason: 'the chat is the default view');
- await tester.tap(_options);
+ await tester.tap(_menu);
await tester.pumpAndSettle();
await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));
await tester.pumpAndSettle();
diff --git a/desktop/test/super_tab_phone_targets_test.dart b/desktop/test/super_tab_phone_targets_test.dart
index fba3b489d..8afcb83d6 100644
--- a/desktop/test/super_tab_phone_targets_test.dart
+++ b/desktop/test/super_tab_phone_targets_test.dart
@@ -143,7 +143,7 @@ void main() {
seed: _agentMessages,
);
expect(find.byKey(const ValueKey('super-terminals')), findsOneWidget);
- expect(find.byKey(const ValueKey('super-pull-requests')), findsOneWidget);
+ expect(find.byTooltip('Project options'), findsOneWidget);
const mouse = {
'Reply': Size(32, 32),
'Copy message': Size(32, 32),
diff --git a/desktop/test/super_tab_project_delete_test.dart b/desktop/test/super_tab_project_delete_test.dart
index 89bf1b253..90a9216d5 100644
--- a/desktop/test/super_tab_project_delete_test.dart
+++ b/desktop/test/super_tab_project_delete_test.dart
@@ -42,7 +42,9 @@ void main() {
Future<void> openDelete(WidgetTester tester) async {
await tester.tap(find.byTooltip('Project options'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(MenuItemButton, 'Delete Project'));
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Project settings…'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Delete Project'));
await tester.pumpAndSettle();
}
@@ -224,6 +226,8 @@ void main() {
await mount(tester, server: server, account: 'peer');
await tester.tap(find.byTooltip('Project options'));
await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Project settings…'));
+ await tester.pumpAndSettle();
expect(find.text('Delete Project'), findsNothing);
expect(server.posts, isEmpty);
await finish(tester);
diff --git a/desktop/test/super_tab_project_menu_test.dart b/desktop/test/super_tab_project_menu_test.dart
new file mode 100644
index 000000000..76afbb725
--- /dev/null
+++ b/desktop/test/super_tab_project_menu_test.dart
@@ -0,0 +1,195 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_icons.dart';
+
+import 'super_tab_mentions_test.dart' show showView;
+import 'support/super_tab_fixture.dart';
+
+// 20:33 on this computer, whatever its zone.
+final reported = DateTime(2026, 11, 2, 20, 33);
+
+ConversationServer swarm({bool status = true, String owner = 'owner'}) {
+ final server = ConversationServer();
+ server.state['projects'] = [
+ {
+ ...projectFixture('lead', 'openharness', 'lead'),
+ 'ownerId': owner,
+ 'coordinatorName': 'Product Manager',
+ if (status)
+ 'status': {
+ 'text': 'Three fixes are on main tonight.',
+ 'at': reported.toUtc().toIso8601String(),
+ 'by': 'kai',
+ },
+ },
+ ];
+ return server;
+}
+
+Finder get menu => find.byTooltip('Project options');
+Finder item(String label) => find.widgetWithText(MenuItemButton, label);
+
+Future<void> open(WidgetTester tester) async {
+ await tester.tap(menu);
+ await tester.pumpAndSettle();
+}
+
+Future<void> openSettings(WidgetTester tester) async {
+ await open(tester);
+ await tester.tap(item('Project settings…'));
+ await tester.pumpAndSettle();
+}
+
+void main() {
+ testWidgets('a project\'s header is its name, its menu and the terminal', (
+ tester,
+ ) async {
+ await showView(tester, swarm());
+ expect(find.text('# openharness'), findsOneWidget);
+ expect(
+ find.descendant(of: menu, matching: find.byIcon(AppIcons.chevronDown)),
+ findsOneWidget,
+ );
+ expect(find.byKey(const ValueKey('super-terminals')), findsOneWidget);
+ // Nothing else sits at rest: the views and the old ⋮ moved to the menu.
+ expect(find.byKey(const ValueKey('super-chat')), findsNothing);
+ expect(find.byKey(const ValueKey('super-pull-requests')), findsNothing);
+ expect(find.byKey(const ValueKey('super-group-options')), findsNothing);
+ });
+
+ testWidgets('the menu says what the design draws, in its order', (
+ tester,
+ ) async {
+ await showView(tester, swarm());
+ await open(tester);
+ final labels = [
+ 'Status',
+ 'Pull requests',
+ 'Instructions',
+ 'Sharing',
+ 'Notifications',
+ 'Project settings…',
+ ];
+ final tops = [
+ for (final label in labels)
+ tester
+ .getTopLeft(
+ find.ancestor(
+ of: find.text(label),
+ matching: find.byWidgetPredicate(
+ (w) => w is MenuItemButton || w is SubmenuButton,
+ ),
+ ),
+ )
+ .dy,
+ ];
+ expect(tops, [...tops]..sort());
+ for (final gone in [
+ 'Rename project',
+ 'Project details',
+ 'Switch PM…',
+ 'Archived conversations',
+ 'Delete Project',
+ ]) {
+ expect(find.text(gone), findsNothing, reason: gone);
+ }
+ });
+
+ testWidgets('Status opens the report with its time, and closes', (
+ tester,
+ ) async {
+ await showView(tester, swarm());
+ await open(tester);
+ await tester.tap(item('Status'));
+ await tester.pumpAndSettle();
+ expect(find.text('Status · updated 8:33 PM'), findsOneWidget);
+ expect(find.text('Three fixes are on main tonight.'), findsOneWidget);
+ await tester.tap(find.byTooltip('Close'));
+ await tester.pumpAndSettle();
+ expect(find.text('Three fixes are on main tonight.'), findsNothing);
+ });
+
+ testWidgets('with no report, Status is there and opens nothing', (
+ tester,
+ ) async {
+ await showView(tester, swarm(status: false));
+ await open(tester);
+ expect(tester.widget<MenuItemButton>(item('Status')).onPressed, isNull);
+ });
+
+ testWidgets('Pull requests opens the view, and the chat button comes back', (
+ tester,
+ ) async {
+ await showView(tester, swarm());
+ await open(tester);
+ await tester.tap(item('Pull requests'));
+ await tester.pumpAndSettle();
+ final chat = find.byKey(const ValueKey('super-chat'));
+ expect(chat, findsOneWidget);
+ await tester.tap(chat);
+ await tester.pumpAndSettle();
+ expect(chat, findsNothing);
+ });
+
+ testWidgets('Project settings… holds rename, switch PM, archived, delete', (
+ tester,
+ ) async {
+ final server = swarm();
+ (server.state['conversations'] as List).add({
+ ...conversationFixture('old', 'Old work'),
+ 'archived': true,
+ 'projectId': 'lead',
+ });
+ await showView(tester, server);
+ await openSettings(tester);
+ for (final label in [
+ 'Rename project',
+ 'Project details',
+ 'Archived conversations',
+ 'Delete Project',
+ ]) {
+ expect(find.text(label), findsOneWidget, reason: label);
+ }
+ });
+
+ testWidgets('a settings row closes the dialog and does its work', (
+ tester,
+ ) async {
+ await showView(tester, swarm());
+ await openSettings(tester);
+ await tester.tap(find.text('Delete Project'));
+ await tester.pumpAndSettle();
+ expect(find.text('Project settings'), findsNothing);
+ expect(find.textContaining('Delete'), findsWidgets);
+ });
+
+ testWidgets('someone else\'s project offers them no owner\'s rows', (
+ tester,
+ ) async {
+ await showView(tester, swarm(owner: 'someone-else'));
+ await open(tester);
+ expect(find.text('Sharing'), findsNothing);
+ await tester.tap(item('Project settings…'));
+ await tester.pumpAndSettle();
+ expect(find.text('Rename project'), findsNothing);
+ expect(find.text('Delete Project'), findsNothing);
+ expect(find.text('Project details'), findsOneWidget);
+ });
+
+ testWidgets('another conversation\'s header is unchanged', (tester) async {
+ final server = swarm();
+ (server.state['conversations'] as List).add(
+ conversationFixture('group-1', 'Offline drafts'),
+ );
+ final c = await showView(tester, server);
+ await c.select('group-1');
+ await tester.pumpAndSettle();
+ expect(c.selectedId, 'group-1');
+ expect(find.byKey(const ValueKey('super-chat')), findsOneWidget);
+ expect(find.byKey(const ValueKey('super-pull-requests')), findsOneWidget);
+ expect(find.byKey(const ValueKey('super-group-options')), findsOneWidget);
+ expect(menu, findsNothing);
+ await c.flush();
+ await tester.pump(const Duration(seconds: 5));
+ });
+}
diff --git a/desktop/test/super_tab_project_status_test.dart b/desktop/test/super_tab_project_status_test.dart
index 827cbe735..23dd32ab7 100644
--- a/desktop/test/super_tab_project_status_test.dart
+++ b/desktop/test/super_tab_project_status_test.dart
@@ -10,7 +10,7 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/super_tabs/controller.dart';
import 'package:harness/super_tabs/decisions_view.dart';
import 'package:harness/super_tabs/model.dart';
-import 'package:harness/super_tabs/project_status_card.dart';
+import 'package:harness/super_tabs/project_status.dart';
import 'package:harness/super_tabs/view.dart';
import 'box_render_preview_test.dart' show loadPreviewFonts;
@@ -106,23 +106,7 @@ Future<void> shot(WidgetTester tester, String name) async {
});
}
-Finder card(String projectId) =>
- find.byKey(ValueKey('super-project-status-$projectId'));
Finder statusText() => find.byKey(const ValueKey('super-project-status-text'));
-Finder needs(String id) =>
- find.byKey(ValueKey('super-project-status-needs-$id'));
-Finder answer(String id) =>
- find.byKey(ValueKey('super-project-status-answer-$id'));
-Finder fold(String projectId) =>
- find.byKey(ValueKey('super-project-status-fold-$projectId'));
-
-String plain(WidgetTester tester, Finder text) =>
- tester.widget<Text>(text).textSpan!.toPlainText();
-
-String heading(WidgetTester tester, String projectId) => plain(
- tester,
- find.descendant(of: card(projectId), matching: find.byType(Text)).first,
-);
Future<void> change(
WidgetTester tester,
@@ -186,390 +170,90 @@ void main() {
expect(odd.text, 'x');
expect(odd.at, isNull);
});
+ });
- test('the time reads as a clock today and with its date before', () {
- final now = DateTime(2026, 10, 31, 18);
- expect(
- SuperTabProjectStatusCard.updatedAt(
- DateTime(2026, 10, 31, 16, 52),
- now,
- ),
- '16:52',
- );
- expect(
- SuperTabProjectStatusCard.updatedAt(DateTime(2026, 10, 30, 9, 5), now),
- 'Oct 30, 09:05',
- );
+ group('the Status dialog', () {
+ Future<void> openStatus(WidgetTester tester) async {
+ await tester.tap(find.byTooltip('Project options'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Status'));
+ await tester.pumpAndSettle();
+ }
+
+ testWidgets('shows the report and when it was updated, links clickable', (
+ tester,
+ ) async {
+ await showView(tester, swarm());
+ expect(statusText(), findsNothing, reason: 'not over the chat');
+ await openStatus(tester);
+ expect(find.textContaining('Status · updated '), findsOneWidget);
+ final spans = <TextSpan>[];
+ tester.widget<Text>(statusText()).textSpan!.visitChildren((span) {
+ if (span is TextSpan && span.recognizer != null) spans.add(span);
+ return true;
+ });
+ // The link is its own span, without the sentence's full stop.
expect(
- SuperTabProjectStatusCard.updatedAt(DateTime(2025, 12, 1, 9, 5), now),
- 'Dec 1 2025, 09:05',
+ spans.single.text,
+ 'https://github.com/autonomous-ai/openharness/pull/4750',
);
+ expect(spans.single.recognizer, isA<TapGestureRecognizer>());
});
- });
-
- group('the status card', () {
- testWidgets(
- 'shows the coordinator\'s text and when it was updated, links clickable',
- (tester) async {
- await showView(tester, swarm());
- expect(card('lead'), findsOneWidget);
- expect(heading(tester, 'lead'), 'Status · updated 16:52');
- expect(plain(tester, statusText()), _report);
- // The link is its own span, without the sentence's full stop.
- final spans = <TextSpan>[];
- tester.widget<Text>(statusText()).textSpan!.visitChildren((span) {
- if (span is TextSpan && span.recognizer != null) spans.add(span);
- return true;
- });
- expect(
- spans.single.text,
- 'https://github.com/autonomous-ai/openharness/pull/4750',
- );
- expect(spans.single.recognizer, isA<TapGestureRecognizer>());
- // It sits above the chat, not in it.
- expect(find.byType(SuperTabProjectStatusCard), findsOneWidget);
- },
- );
-
- testWidgets(
- 'a Swarm read that leaves the text keeps the same link tap, so a click in progress is not lost',
- (tester) async {
- final server = swarm();
- final c = await showView(tester, server);
- GestureRecognizer? tap() {
- GestureRecognizer? found;
- tester.widget<Text>(statusText()).textSpan!.visitChildren((span) {
- if (span is TextSpan && span.recognizer != null) {
- found = span.recognizer;
- }
- return true;
- });
- return found;
- }
- final before = tap();
- expect(before, isNotNull);
- await change(tester, server, c, () => server.ask(['Ship how?']));
- expect(needs('decision-1'), findsOneWidget);
- expect(identical(tap(), before), isTrue);
- },
- );
-
- testWidgets(
- 'Needs you lists only the reader\'s open decisions in this project, and Answer opens it where Notifications answers it',
- (tester) async {
- final server = swarm()
- // decision-1: asked here, open.
- ..ask(['Model keys for live runs?'])
- // decision-2: asked in the other project.
- ..ask(['Logo?'], projectId: 'design', conversationId: 'design-lead')
- // decision-3: says this project, but its conversation is Design's.
- ..ask(['Mismatch?'], conversationId: 'design-lead')
- // decision-4: in a conversation the reader cannot read.
- ..ask(['Hidden?'], conversationId: 'private-elsewhere')
- // decision-5: asked here, already answered.
- ..ask(['Done already?']);
- server.answerDecision('decision-5', 0);
- await showView(tester, server);
-
- expect(needs('decision-1'), findsOneWidget);
- for (final id in [
- 'decision-2',
- 'decision-3',
- 'decision-4',
- 'decision-5',
- ]) {
- expect(needs(id), findsNothing, reason: id);
- }
- expect(find.text('Logo?'), findsNothing);
- expect(find.text('Hidden?'), findsNothing);
- expect(
- find.descendant(
- of: needs('decision-1'),
- matching: find.text('dee: Model keys for live runs?'),
- ),
- findsOneWidget,
- );
- expect(
- find.descendant(
- of: needs('decision-1'),
- matching: find.text('Needs you'),
- ),
- findsOneWidget,
- );
-
- await tester.tap(answer('decision-1'));
- await tester.pumpAndSettle();
- // The Activity page (Notifications' place), with the decision's own
- // option buttons.
- expect(
- find.descendant(
- of: find.byType(SuperTabDecisionList),
- matching: find.text('Decisions'),
- ),
- findsOneWidget,
- );
- expect(
- find.byKey(const ValueKey('super-decision-decision-1-0')),
- findsOneWidget,
- );
- expect(server.posts, isEmpty);
- },
- );
-
- testWidgets(
- 'hidden while there is no report and nothing waits; a decision alone shows it',
- (tester) async {
- final server = swarm(status: {});
- final c = await showView(tester, server);
- expect(card('lead'), findsNothing);
-
- // A decision in the other project changes nothing here.
- await change(tester, server, c, () {
- server.ask(
- ['Logo?'],
- projectId: 'design',
- conversationId: 'design-lead',
- );
- });
- expect(card('lead'), findsNothing);
-
- await change(tester, server, c, () => server.ask(['Ship how?']));
- expect(card('lead'), findsOneWidget);
- expect(heading(tester, 'lead'), 'Status');
- expect(statusText(), findsNothing);
- expect(needs('decision-2'), findsOneWidget);
-
- await change(
- tester,
- server,
- c,
- () => server.answerDecision('decision-2', 0),
- );
- expect(card('lead'), findsNothing);
- },
- );
-
- testWidgets(
- 'folding is remembered per project on this computer, and the heading still says what waits',
- (tester) async {
- final server = swarm()..ask(['Ship how?']);
- (server.state['projects'] as List)[1]['status'] = _status(
- 'Logo drafts',
- );
- final c = await showView(tester, server);
-
- await tester.tap(fold('lead'));
- await tester.pumpAndSettle();
- expect(statusText(), findsNothing);
- expect(needs('decision-1'), findsNothing);
- expect(heading(tester, 'lead'), 'Status · updated 16:52 · 1 needs you');
- expect(c.statusFolded('lead'), isTrue);
-
- await c.flush();
- final saved = server.saved!;
- expect(saved['statusFolded'], ['lead']);
-
- // Restarted: still folded here; the other project's card is not.
- await tester.pumpWidget(const SizedBox());
- final again = await showView(tester, server, initial: saved);
- expect(statusText(), findsNothing);
- expect(heading(tester, 'lead'), 'Status · updated 16:52 · 1 needs you');
- again.select('design-lead');
- await tester.pumpAndSettle();
- expect(plain(tester, statusText()), 'Logo drafts');
-
- // Shown again, and that is remembered too.
- again.select('lead');
- await tester.pumpAndSettle();
- await tester.tap(fold('lead'));
- await tester.pumpAndSettle();
- expect(plain(tester, statusText()), _report);
- await again.flush();
- expect(server.saved!['statusFolded'], isEmpty);
- },
- );
-
- test('the folded set keeps only the newest projects', () async {
+ testWidgets('a new report replaces the text in place', (tester) async {
final server = swarm();
- final c = server.controller(account: 'peer');
- addTearDown(c.dispose);
- for (var i = 0; i <= SuperTabController.statusFoldedKept; i++) {
- c.setStatusFolded('p$i', folded: true);
- }
- expect(c.statusFolded('p0'), isFalse);
- expect(c.statusFolded('p1'), isTrue);
- expect(c.statusFolded('p${SuperTabController.statusFoldedKept}'), isTrue);
- // Another account's saved view on this computer is not read.
- await c.flush();
- final other = SuperTabController(
- tabId: 'tab',
- accountId: 'someone-else',
- request: (_, _, {body}) async => const {},
- save: (_) async {},
- initial: server.saved!,
+ final c = await showView(tester, server);
+ await openStatus(tester);
+ await change(tester, server, c, () {
+ ((server.state['projects'] as List).first as Map)['status'] = _status(
+ 'All merged.',
+ );
+ });
+ expect(
+ tester.widget<Text>(statusText()).textSpan!.toPlainText(),
+ 'All merged.',
);
- addTearDown(other.dispose);
- expect(other.statusFolded('p1'), isFalse);
});
- testWidgets(
- 'a new report replaces the card in place and adds nothing to the chat',
- (tester) async {
- final server = swarm();
- final c = await showView(tester, server);
- final messages = c.messages('lead').length;
- await change(tester, server, c, () {
- (server.state['projects'] as List)[0]['status'] = _status(
- 'Memory engine merged #4750',
- at: _at.add(const Duration(minutes: 30)),
- );
- });
- expect(plain(tester, statusText()), 'Memory engine merged #4750');
- expect(heading(tester, 'lead'), 'Status · updated 17:22');
- expect(find.byType(SuperTabProjectStatusCard), findsOneWidget);
- expect(c.messages('lead').length, messages);
- },
- );
-
- testWidgets(
- 'each project\'s chat shows its own card, never the one opened before',
- (tester) async {
- final server = swarm();
- (server.state['projects'] as List)[1]['status'] = _status(
- 'Logo drafts',
- );
- final c = await showView(tester, server);
- c.select('design-lead');
- await tester.pumpAndSettle();
- expect(card('design'), findsOneWidget);
- expect(card('lead'), findsNothing);
- expect(plain(tester, statusText()), 'Logo drafts');
- },
- );
-
- testWidgets('access lost while the card is open hides it at once', (
+ testWidgets('access lost while it is open closes it at once', (
tester,
) async {
- final server = swarm()..ask(['Ship how?']);
- final c = await showView(tester, server);
- expect(needs('decision-1'), findsOneWidget);
+ final c = await showView(tester, swarm());
+ await openStatus(tester);
c.revokeAccess('You no longer have access to this Swarm.');
- await tester.pump();
- expect(card('lead'), findsNothing);
- expect(find.textContaining('Ship how?'), findsNothing);
- expect(find.textContaining('Memory engine'), findsNothing);
+ await tester.pumpAndSettle();
+ expect(statusText(), findsNothing);
});
- testWidgets(
- 'the card on its own forgets the project once access is lost, never showing what it read before',
- (tester) async {
- final server = swarm()..ask(['Ship how?']);
- final c = server.controller(account: 'peer');
- addTearDown(c.dispose);
- await c.refresh();
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: SuperTabProjectStatusCard(controller: c, projectId: 'lead'),
- ),
- ),
- );
- await tester.pumpAndSettle();
- expect(card('lead'), findsOneWidget);
- expect(needs('decision-1'), findsOneWidget);
-
- c.revokeAccess('You no longer have access to this Swarm.');
- await tester.pump();
- expect(card('lead'), findsNothing);
- expect(find.textContaining('Memory engine'), findsNothing);
- expect(find.textContaining('Ship how?'), findsNothing);
- },
- );
-
- testWidgets(
- 'losing the project drops its card, and a changed audience drops Needs you rows before the new list arrives',
- (tester) async {
- final server = swarm();
- (server.state['conversations'] as List).add({
- ...conversationFixture('plans', 'Plans'),
- 'projectId': 'lead',
- });
- server.ask(['Ship how?'], conversationId: 'plans');
- final c = await showView(tester, server);
- expect(needs('decision-1'), findsOneWidget);
-
- // The reader loses the workgroup; the new list is slow to come.
- final slow = server.holdDecisions = Completer<void>();
- await change(tester, server, c, () {
- (server.state['conversations'] as List).removeWhere(
- (g) => (g as Map)['id'] == 'plans',
- );
- server.hideDecision('decision-1');
- server.parts.epoch++;
- });
- expect(needs('decision-1'), findsNothing);
- expect(find.textContaining('Ship how?'), findsNothing);
- server.holdDecisions = null;
- slow.complete();
- await tester.pumpAndSettle();
- expect(needs('decision-1'), findsNothing);
-
- // The project itself goes: no card, no text left behind.
- await change(tester, server, c, () {
- (server.state['projects'] as List).removeAt(0);
- });
- expect(card('lead'), findsNothing);
- expect(find.textContaining('Memory engine'), findsNothing);
- },
- );
-
- testWidgets(
- 'a failed first decisions read shows the report alone, and the rows once a read succeeds',
- (tester) async {
- final server = swarm()..ask(['Ship how?']);
- server.failDecisions = true;
- final c = await showView(tester, server);
- expect(card('lead'), findsOneWidget);
- expect(needs('decision-1'), findsNothing);
- expect(find.byType(CircularProgressIndicator), findsNothing);
-
- server.failDecisions = false;
- await change(tester, server, c, () {
- (server.state['projects'] as List)[0]['status'] = _status('Later');
- });
- expect(needs('decision-1'), findsOneWidget);
- },
- );
-
- testWidgets('a report at the limit scrolls inside the card', (
+ testWidgets('the project going closes it, leaving no text behind', (
tester,
) async {
- final long = List.filled(40, 'Line of progress ' * 3).join('\n');
- final text = long.substring(0, SuperTabProjectStatus.maxText);
- await showView(tester, swarm(status: _status(text)));
- expect(tester.getSize(card('lead')).height, lessThan(320));
+ final server = swarm();
+ final c = await showView(tester, server);
+ await openStatus(tester);
+ await change(tester, server, c, () {
+ (server.state['projects'] as List).removeAt(0);
+ });
+ expect(statusText(), findsNothing);
+ });
+ });
+
+ group('the time it says', () {
+ final now = DateTime(2026, 11, 2, 21);
+ test('today is the clock, on a 12-hour dial', () {
+ expect(superTabStatusTime(DateTime(2026, 11, 2, 20, 33), now), '8:33 PM');
+ expect(superTabStatusTime(DateTime(2026, 11, 2, 0, 5), now), '12:05 AM');
+ expect(superTabStatusTime(DateTime(2026, 11, 2, 12), now), '12:00 PM');
+ });
+ test('before today says the date', () {
expect(
- find.descendant(
- of: card('lead'),
- matching: find.byType(SingleChildScrollView),
- ),
- findsOneWidget,
+ superTabStatusTime(DateTime(2026, 10, 30, 16, 52), now),
+ 'Oct 30, 4:52 PM',
+ );
+ expect(
+ superTabStatusTime(DateTime(2025, 10, 30, 16, 52), now),
+ 'Oct 30 2025, 4:52 PM',
);
- expect(tester.takeException(), isNull);
});
-
- for (final brightness in Brightness.values) {
- testWidgets('screenshot, ${brightness.name}', (tester) async {
- final server = swarm()..ask(['Model keys for live runs?']);
- final c = await showView(tester, server, brightness: brightness);
- expect(card('lead'), findsOneWidget);
- await shot(tester, 'project-status-${brightness.name}');
- await tester.tap(fold('lead'));
- await tester.pumpAndSettle();
- await shot(tester, 'project-status-folded-${brightness.name}');
- await c.flush();
- });
- }
});
}
diff --git a/desktop/test/super_tab_quiet_chat_test.dart b/desktop/test/super_tab_quiet_chat_test.dart
new file mode 100644
index 000000000..677ada496
--- /dev/null
+++ b/desktop/test/super_tab_quiet_chat_test.dart
@@ -0,0 +1,152 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/super_tabs/ship_row.dart';
+import 'package:harness/super_tabs/unread_line.dart';
+
+import 'super_tab_mentions_test.dart' show showView;
+import 'support/super_tab_fixture.dart';
+
+final at = DateTime.utc(2026, 11, 2, 9);
+
+Map<String, dynamic> row(
+ String id,
+ int sequence,
+ String text, {
+ String? kind,
+ Map<String, Object?> source = const {},
+}) => {
+ 'id': id,
+ 'conversationId': 'lead',
+ 'sequence': sequence,
+ 'text': text,
+ 'createdAt': at.toIso8601String(),
+ 'author': {'kind': 'agent', 'id': 'kai', 'name': 'Kai'},
+ 'source': {'kind': ?kind, ...source},
+};
+
+ConversationServer project(List<Map<String, dynamic>> rows, {int read = 0}) {
+ final server = ConversationServer();
+ server.state['projects'] = [
+ {
+ ...projectFixture('lead', 'openharness', 'lead'),
+ 'status': {
+ 'text': 'Three fixes are on main tonight.',
+ 'at': at.toIso8601String(),
+ 'by': 'kai',
+ },
+ },
+ ];
+ server.messages.addAll(rows);
+ final lead = (server.state['conversations'] as List)
+ .cast<Map<String, dynamic>>()
+ .firstWhere((g) => g['id'] == 'lead');
+ lead['lastMessageSequence'] = rows.length;
+ if (read > 0) {
+ server.state['readMarks'] = {
+ 'owner': {'lead': read},
+ };
+ }
+ return server;
+}
+
+void main() {
+ testWidgets('the PM\'s report no longer sits over a project\'s chat', (
+ tester,
+ ) async {
+ await showView(tester, project([row('m1', 1, 'Hello')]));
+ expect(find.text('Three fixes are on main tonight.'), findsNothing);
+ expect(find.textContaining('Three fixes'), findsNothing);
+ });
+
+ Map<String, dynamic> shipped() => row(
+ 's1',
+ 1,
+ 'Shipped: Avatars',
+ kind: 'ship',
+ source: {'title': 'Avatars', 'conversationId': 'task-1'},
+ );
+
+ testWidgets('a Shipped card stays while no line says the task shipped', (
+ tester,
+ ) async {
+ final c = await showView(tester, project([shipped()]));
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabShipRow), findsOneWidget);
+ });
+
+ testWidgets('a Shipped card leaves the chat once the task has its line', (
+ tester,
+ ) async {
+ final c = await showView(
+ tester,
+ project([
+ shipped(),
+ row(
+ 'l1',
+ 2,
+ 'Avatars · shipped',
+ kind: 'task-line',
+ source: {'taskId': 'task-1', 'title': 'Avatars', 'state': 'shipped'},
+ ),
+ ]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabShipRow), findsNothing);
+ expect(find.text('Avatars'), findsOneWidget);
+ });
+
+ for (final kind in [
+ 'work-stalled',
+ 'work-lost',
+ 'work-resumed',
+ 'idle',
+ 'idle-stop',
+ 'review-failed',
+ 'update-request',
+ 'digest-request',
+ 'overlap',
+ 'pair-loop',
+ 'notice-digest',
+ ]) {
+ testWidgets(
+ 'the PM\'s notice "$kind" never shows in the chat people read',
+ (tester) async {
+ final c = await showView(
+ tester,
+ project([
+ row('m1', 1, 'A message'),
+ row('n1', 2, 'This notice is for the PM', kind: kind),
+ ]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(find.text('A message'), findsOneWidget);
+ expect(find.text('This notice is for the PM'), findsNothing);
+ },
+ );
+ }
+
+ testWidgets('the New line stays, on the first message people see', (
+ tester,
+ ) async {
+ final c = await showView(
+ tester,
+ project([
+ row('m1', 1, 'Read already'),
+ row('n1', 2, 'This notice is for the PM', kind: 'work-stalled'),
+ row('m2', 3, 'New to the reader'),
+ ], read: 1),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabNewMessagesLine), findsOneWidget);
+ expect(
+ tester.getTopLeft(find.byType(SuperTabNewMessagesLine)).dy,
+ lessThan(tester.getTopLeft(find.text('New to the reader')).dy),
+ );
+ expect(find.text('While you were away'), findsNothing);
+ expect(find.textContaining('While you'), findsNothing);
+ });
+}
diff --git a/desktop/test/super_tab_switch_pm_test.dart b/desktop/test/super_tab_switch_pm_test.dart
index 080b679c4..3b4c94a99 100644
--- a/desktop/test/super_tab_switch_pm_test.dart
+++ b/desktop/test/super_tab_switch_pm_test.dart
@@ -108,9 +108,11 @@ void main() {
Future<void> openMenu(WidgetTester tester) async {
await tester.tap(find.byTooltip('Project options'));
await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Project settings…'));
+ await tester.pumpAndSettle();
}
- final item = find.widgetWithText(MenuItemButton, 'Switch PM…');
+ final item = find.text('Switch PM…');
Future<void> finish(WidgetTester tester) async {
await tester.pump(const Duration(milliseconds: 250));
diff --git a/desktop/test/super_tab_task_line_test.dart b/desktop/test/super_tab_task_line_test.dart
new file mode 100644
index 000000000..969f75b7b
--- /dev/null
+++ b/desktop/test/super_tab_task_line_test.dart
@@ -0,0 +1,517 @@
+import 'dart:typed_data';
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_icons.dart';
+import 'package:harness/state/harness_attachments.dart';
+import 'package:harness/super_tabs/controller.dart';
+import 'package:harness/super_tabs/message_row.dart';
+import 'package:harness/super_tabs/task_line.dart';
+import 'package:harness/super_tabs/thread_panel.dart';
+
+import 'super_tab_mentions_test.dart' show showView;
+import 'support/super_tab_fixture.dart';
+
+final at = DateTime.utc(2026, 11, 2, 9);
+
+Map<String, dynamic> taskRow(
+ String state, {
+ String id = 'line-1',
+ String? answerFor,
+ String taskId = 'group-1',
+ int sequence = 5,
+ String? title = 'Phone Activity opens the right message',
+ String? text,
+}) => {
+ 'id': id,
+ 'conversationId': 'lead',
+ 'sequence': sequence,
+ 'text': text ?? 'Phone Activity opens the right message · $state',
+ 'createdAt': at.toIso8601String(),
+ 'author': {'kind': 'agent', 'id': 'kai', 'name': 'Kai'},
+ 'source': {
+ 'kind': 'task-line',
+ 'taskId': taskId,
+ 'title': ?title,
+ 'state': state,
+ 'answerFor': ?answerFor,
+ },
+};
+
+Map<String, dynamic> proposalRow() => {
+ 'id': 'proposal-1',
+ 'conversationId': 'lead',
+ 'thread': 'proposal-1',
+ 'sequence': 6,
+ 'text': 'Activity read fix\n\nA second line of detail the row leaves out.',
+ 'createdAt': at.toIso8601String(),
+ 'author': {'kind': 'agent', 'id': 'kai', 'name': 'Kai'},
+ 'source': {'kind': 'buddy-proposal', 'personId': 'owner'},
+};
+
+ConversationServer serverWith(List<Map<String, dynamic>> rows) {
+ final server = ConversationServer();
+ server.state['agents'] = [
+ {
+ 'id': 'kai',
+ 'name': 'Kai',
+ 'machineId': 'm',
+ 'harnessId': 'h',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'codex'},
+ },
+ ];
+ server.messages.addAll(rows);
+ final conversations = (server.state['conversations'] as List)
+ .cast<Map<String, dynamic>>();
+ final lead = conversations.firstWhere((g) => g['id'] == 'lead');
+ lead['lastMessageSequence'] = rows.length + 5;
+ // The task a line opens.
+ conversations.add({
+ ...lead,
+ 'id': 'group-1',
+ 'title': 'Phone Activity opens the right message',
+ 'lastMessageSequence': 1,
+ 'leadId': null,
+ });
+ return server;
+}
+
+Finder get line => find.byType(SuperTabTaskLine);
+
+void main() {
+ for (final (state, word, icon) in [
+ ('planned', 'planned', AppIcons.circleDashed),
+ ('working', 'working', AppIcons.circleDot),
+ ('review', 'in review', AppIcons.circleDot),
+ ('shipped', 'shipped', AppIcons.check),
+ ('stopped', 'stopped', AppIcons.circleSlash),
+ ]) {
+ testWidgets('a $state task is one line: its mark, name and "$word"', (
+ tester,
+ ) async {
+ final c = await showView(tester, serverWith([taskRow(state)]));
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(line, findsOneWidget);
+ expect(
+ find.descendant(of: line, matching: find.text(word)),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: line, matching: find.byIcon(icon)),
+ findsOneWidget,
+ );
+ expect(
+ tester.getSize(line).height,
+ lessThan(48),
+ reason: 'one line, not a card',
+ );
+ // Not also drawn as a message, with its author.
+ expect(find.byType(SuperTabMessageRow), findsNothing);
+ });
+ }
+
+ testWidgets('the name comes from the title, not the text older apps read', (
+ tester,
+ ) async {
+ final c = await showView(
+ tester,
+ serverWith([
+ taskRow(
+ 'review',
+ title: 'Offline drafts',
+ text: 'Offline drafts · in review',
+ ),
+ ]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(find.text('Offline drafts'), findsOneWidget);
+ expect(find.text('Offline drafts · in review'), findsNothing);
+ });
+
+ testWidgets('a line with no title still reads, as its text says it', (
+ tester,
+ ) async {
+ final c = await showView(
+ tester,
+ serverWith([taskRow('review', title: null, text: 'Offline drafts')]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(find.text('Offline drafts'), findsOneWidget);
+ });
+
+ testWidgets('an edited line redraws in place at the next read', (
+ tester,
+ ) async {
+ final server = serverWith([
+ taskRow(
+ 'working',
+ text: 'Offline drafts · working',
+ title: 'Offline drafts',
+ ),
+ ]);
+ final c = await showView(tester, server);
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(
+ find.descendant(of: line, matching: find.text('working')),
+ findsOneWidget,
+ );
+
+ // The server edits the one message, and moves the chat's reaction counter.
+ server.messages.first
+ ..['text'] = 'Offline drafts · in review'
+ ..['source'] = {
+ ...server.messages.first['source'] as Map,
+ 'state': 'review',
+ };
+ final group = (server.state['conversations'] as List)
+ .cast<Map<String, dynamic>>()
+ .firstWhere((g) => g['id'] == 'lead');
+ group['reactionSeq'] = ((group['reactionSeq'] as int?) ?? 0) + 1;
+ await c.loadMessages('lead');
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(
+ find.descendant(of: line, matching: find.text('in review')),
+ findsOneWidget,
+ );
+ expect(line, findsOneWidget);
+ });
+
+ testWidgets('a task waiting on the reader says Answer', (tester) async {
+ final c = await showView(
+ tester,
+ serverWith([taskRow('waiting', answerFor: 'owner')]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(
+ find.descendant(of: line, matching: find.text('Answer')),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets(
+ 'a task waiting on someone else never says Answer to the reader',
+ (tester) async {
+ final c = await showView(
+ tester,
+ serverWith([taskRow('waiting', answerFor: 'someone-else')]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(
+ find.descendant(of: line, matching: find.text('Answer')),
+ findsNothing,
+ );
+ expect(
+ find.descendant(of: line, matching: find.text('working')),
+ findsOneWidget,
+ );
+ },
+ );
+
+ testWidgets('an unknown state keeps the line and says nothing it cannot', (
+ tester,
+ ) async {
+ final c = await showView(tester, serverWith([taskRow('later')]));
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(line, findsOneWidget);
+ expect(find.text('later'), findsNothing);
+ });
+
+ testWidgets('clicking a task opens its conversation on the right', (
+ tester,
+ ) async {
+ final server = serverWith([taskRow('working')]);
+ server.messages.add({
+ 'id': 'in-task',
+ 'conversationId': 'group-1',
+ 'sequence': 1,
+ 'text': 'Ready: PR #2605.',
+ 'createdAt': at.toIso8601String(),
+ 'author': {'kind': 'agent', 'id': 'kai', 'name': 'Kai'},
+ });
+ final c = await showView(tester, server);
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ await tester.tap(line);
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabTaskPanel), findsOneWidget);
+ expect(find.text('Ready: PR #2605.'), findsOneWidget);
+ // Headed as the line reads, with its mark (screen 3).
+ expect(
+ find.descendant(
+ of: find.byType(SuperTabTaskPanel),
+ matching: find.byIcon(AppIcons.circleDot),
+ ),
+ findsOneWidget,
+ );
+ // The project stays open beside it.
+ expect(c.selectedId, 'lead');
+ await tester.tap(find.byKey(const ValueKey('super-task-panel-close')));
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabTaskPanel), findsNothing);
+ });
+
+ testWidgets('the panel shows the whole conversation, without hidden rows', (
+ tester,
+ ) async {
+ final server = serverWith([taskRow('review')]);
+ (server.state['conversations'] as List).add({
+ ...conversationFixture('step-1', 'Review'),
+ 'projectId': 'lead',
+ 'reviewOf': 'group-1',
+ 'step': 'Review',
+ 'number': 7,
+ 'lastMessageSequence': 2,
+ });
+ Map<String, dynamic> inTask(
+ String id,
+ String conversation,
+ int sequence,
+ String text, {
+ Map<String, Object?> source = const {},
+ String? thread,
+ }) => {
+ 'id': id,
+ 'conversationId': conversation,
+ 'sequence': sequence,
+ 'thread': thread ?? id,
+ 'text': text,
+ 'createdAt': at.toIso8601String(),
+ 'author': {'kind': 'agent', 'id': 'kai', 'name': 'Kai'},
+ 'source': source,
+ };
+ server.messages.addAll([
+ inTask('t1', 'group-1', 1, 'Ready: PR #2605.'),
+ inTask(
+ 't2',
+ 'group-1',
+ 2,
+ 'Kai has gone quiet.',
+ source: {'kind': 'work-stalled'},
+ ),
+ inTask('t3', 'group-1', 3, 'A reply in a thread.', thread: 't1'),
+ inTask('v1', 'step-1', 1, 'Please review.'),
+ inTask('v2', 'step-1', 2, 'With fixes: one Important.', thread: 'v1'),
+ ]);
+ final c = await showView(tester, server);
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ await tester.tap(line);
+ await tester.pumpAndSettle();
+ expect(find.text('Ready: PR #2605.'), findsOneWidget);
+ expect(find.text('With fixes: one Important.'), findsOneWidget);
+ expect(find.text('Kai has gone quiet.'), findsNothing);
+ // Agents answer with replies: a verdict is one (screen 3 lists them all).
+ expect(find.text('A reply in a thread.'), findsOneWidget);
+ });
+
+ testWidgets('a thread opened takes the task panel\'s place for good', (
+ tester,
+ ) async {
+ final server = serverWith([taskRow('working'), proposalRow()]);
+ final c = await showView(tester, server);
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ await tester.tap(line);
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabTaskPanel), findsOneWidget);
+ c.openThread('proposal-1');
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabThreadPanel), findsOneWidget);
+ expect(find.byType(SuperTabTaskPanel), findsNothing);
+ c.closeThread();
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabTaskPanel), findsNothing);
+ });
+
+ testWidgets('on a narrow window, a click outside closes the task panel', (
+ tester,
+ ) async {
+ final c = await showView(tester, serverWith([taskRow('working')]));
+ await c.loadMessages('lead');
+ await tester.binding.setSurfaceSize(const Size(900, 800));
+ await tester.pumpAndSettle();
+ await tester.tap(line);
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabTaskPanel), findsOneWidget);
+ await tester.tapAt(const Offset(20, 400));
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabTaskPanel), findsNothing);
+ });
+
+ group('the panel\'s reply', () {
+ final field = find.byKey(const ValueKey('super-task-reply'));
+ final send = find.byKey(const ValueKey('super-task-send'));
+
+ ConversationServer assigned() {
+ final server = serverWith([taskRow('working')]);
+ final task = (server.state['conversations'] as List)
+ .cast<Map<String, dynamic>>()
+ .firstWhere((g) => g['id'] == 'group-1');
+ task['agentIds'] = ['kai'];
+ task['assignment'] = {'agentId': 'kai', 'status': 'working'};
+ return server;
+ }
+
+ Future<SuperTabController> open(
+ WidgetTester tester,
+ ConversationServer server,
+ ) async {
+ final c = await showView(tester, server);
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ await tester.tap(line);
+ await tester.pumpAndSettle();
+ return c;
+ }
+
+ testWidgets('goes to the agent with the task, as a plain message', (
+ tester,
+ ) async {
+ final server = assigned();
+ await open(tester, server);
+ await tester.enterText(field, 'Yes, ship it.');
+ await tester.pump();
+ await tester.tap(send);
+ await tester.pumpAndSettle();
+ final sent =
+ server.posts.lastWhere(
+ (p) => (p['command'] as Map?)?['type'] == 'message.send',
+ )['command']
+ as Map;
+ expect(sent['conversationId'], 'group-1');
+ expect(sent['text'], 'Yes, ship it.');
+ expect(sent['replyTo'], isNull);
+ expect(sent['recipientIds'], ['kai']);
+ expect(tester.widget<TextField>(field).controller!.text, isEmpty);
+ });
+
+ testWidgets('a file with no words goes too', (tester) async {
+ final server = assigned();
+ final c = await open(tester, server);
+ c.threadAttachments('group-1', 'group-1').add([
+ HarnessAttachment('a.txt', Uint8List.fromList([104, 105])),
+ ]);
+ await tester.pump();
+ await tester.tap(send);
+ await tester.pumpAndSettle();
+ final sent =
+ server.posts.lastWhere(
+ (p) => (p['command'] as Map?)?['type'] == 'message.send',
+ )['command']
+ as Map;
+ expect(sent['conversationId'], 'group-1');
+ expect(sent['attachmentIds'], hasLength(1));
+ });
+
+ testWidgets('while something else is saving, the words stay in the box', (
+ tester,
+ ) async {
+ final server = assigned();
+ final c = await open(tester, server);
+ final hold = server.holdCommands = Completer<void>();
+ final other = c.command({
+ 'type': 'conversation.rename',
+ 'conversationId': 'lead',
+ 'title': 'x',
+ });
+ await tester.pump();
+ await tester.enterText(field, 'Do not lose me.');
+ await tester.pump();
+ await tester.tap(send, warnIfMissed: false);
+ await tester.pump();
+ expect(
+ tester.widget<TextField>(field).controller!.text,
+ 'Do not lose me.',
+ );
+ server.holdCommands = null;
+ hold.complete();
+ await other;
+ await tester.pumpAndSettle();
+ await tester.tap(send);
+ await tester.pumpAndSettle();
+ expect(
+ server.posts.map((p) => (p['command'] as Map?)?['text']),
+ contains('Do not lose me.'),
+ );
+ });
+
+ testWidgets('a reply on its way shows in the panel', (tester) async {
+ final server = assigned();
+ await open(tester, server);
+ final hold = server.holdCommands = Completer<void>();
+ await tester.enterText(field, 'On its way.');
+ await tester.pump();
+ await tester.tap(send);
+ await tester.pump();
+ expect(
+ find.descendant(
+ of: find.byType(SuperTabTaskPanel),
+ matching: find.textContaining('On its way.'),
+ ),
+ findsWidgets,
+ );
+ server.holdCommands = null;
+ hold.complete();
+ await tester.pumpAndSettle();
+ });
+ });
+
+ testWidgets('a task the reader\'s read does not hold opens nothing', (
+ tester,
+ ) async {
+ final c = await showView(
+ tester,
+ serverWith([taskRow('working', taskId: 'not-readable')]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ await tester.tap(line);
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabTaskPanel), findsNothing);
+ });
+
+ testWidgets('a proposal says its goal, not the server\'s opening words', (
+ tester,
+ ) async {
+ final c = await showView(
+ tester,
+ serverWith([
+ {
+ ...proposalRow(),
+ 'text':
+ "Proposal from diego's Buddy, on diego's behalf.\n\n"
+ 'Goal: Activity read fix\nScope: The app\nPriority: high',
+ },
+ ]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(find.textContaining(': Activity read fix'), findsOneWidget);
+ expect(find.textContaining('behalf'), findsNothing);
+ expect(find.textContaining('Scope'), findsNothing);
+ });
+
+ testWidgets('a proposal is one line that opens', (tester) async {
+ final c = await showView(tester, serverWith([proposalRow()]));
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ final row = find.byType(SuperTabProposalLine);
+ expect(row, findsOneWidget);
+ expect(tester.getSize(row).height, lessThan(48));
+ expect(find.textContaining('second line of detail'), findsNothing);
+ await tester.tap(row);
+ await tester.pumpAndSettle();
+ expect(c.openedThread?.root, 'proposal-1');
+ expect(find.textContaining('second line of detail'), findsOneWidget);
+ });
+}
diff --git a/desktop/test/super_tab_view_test.dart b/desktop/test/super_tab_view_test.dart
index 69dad3c05..54a7e1a8a 100644
--- a/desktop/test/super_tab_view_test.dart
+++ b/desktop/test/super_tab_view_test.dart
@@ -153,6 +153,10 @@ void main() {
Future<void> openList() async {
await tester.tap(find.byTooltip('Project options'));
await tester.pumpAndSettle();
+ await tester.tap(
+ find.widgetWithText(MenuItemButton, 'Project settings…'),
+ );
+ await tester.pumpAndSettle();
await tester.tap(find.text('Archived conversations'));
await tester.pumpAndSettle();
}
@@ -210,6 +214,8 @@ void main() {
expect(find.byKey(const ValueKey('super-group-offline')), findsNothing);
await tester.tap(find.byTooltip('Project options'));
await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Project settings…'));
+ await tester.pumpAndSettle();
await tester.tap(find.text('Archived conversations'));
await tester.pumpAndSettle();
final search = find.descendant(
@@ -590,14 +596,7 @@ void main() {
.selected,
isFalse,
);
- expect(
- tester
- .widget<AppIconButton>(
- find.byKey(const ValueKey('super-pull-requests')),
- )
- .selected,
- isFalse,
- );
+ expect(find.byKey(const ValueKey('super-pull-requests')), findsNothing);
expect(find.byTooltip('Conversation options'), findsNothing);
await tester.binding.setSurfaceSize(const Size(800, 700));
await tester.pumpAndSettle();
diff --git a/desktop/test/support/super_tab_fixture.dart b/desktop/test/support/super_tab_fixture.dart
index 30651245f..b8bab7a3c 100644
--- a/desktop/test/support/super_tab_fixture.dart
+++ b/desktop/test/support/super_tab_fixture.dart
@@ -644,32 +644,6 @@ class ConversationServer {
final fileLinkReads = <String>[];
FutureOr<Map<String, dynamic>> Function(String attachmentId)? fileLink;
- /// The catch-up summary the backend answers per conversation (catchUp.ts);
- /// one not set answers an empty summary.
- final catchUps = <String, Map<String, dynamic>>{};
-
- /// Every catch-up read, by path; [failCatchUp] makes them fail as offline.
- final catchUpReads = <String>[];
- bool failCatchUp = false;
-
- /// While set, catch-up reads wait for it: a summary that arrives late.
- Completer<void>? holdCatchUp;
-
- Map<String, dynamic> _catchUp(String conversationId, int after) {
- const empty = {'total': 0, 'items': <dynamic>[]};
- return catchUps[conversationId] ??
- {
- 'after': after,
- 'through': after,
- 'unread': 0,
- 'more': false,
- 'decisions': 0,
- 'landed': empty,
- 'blocked': empty,
- 'needsYou': empty,
- };
- }
-
/// Every read-mark write fails, as offline.
bool failReadMarks = false;
@@ -1514,15 +1488,6 @@ class ConversationServer {
}
return {'attachment': await answer(uri.pathSegments.last)};
}
- if (uri.pathSegments.last == 'catch-up') {
- catchUpReads.add(path);
- if (holdCatchUp case final hold?) await hold.future;
- if (failCatchUp) throw StateError('Offline');
- final id = uri.pathSegments[uri.pathSegments.length - 2];
- final after = int.parse(uri.queryParameters['after']!);
- return jsonDecode(jsonEncode(_catchUp(id, after)))
- as Map<String, dynamic>;
- }
if (uri.pathSegments.last == 'threads' ||
uri.pathSegments.last == 'inbox') {
threadListReads.add(path);
diff --git a/desktop/test/swarm_projects_test.dart b/desktop/test/swarm_projects_test.dart
index 0069f3d5f..5ab51303a 100644
--- a/desktop/test/swarm_projects_test.dart
+++ b/desktop/test/swarm_projects_test.dart
@@ -184,14 +184,18 @@ void main() {
conversationId: 'design-lead',
);
await mount(tester, c);
- await tester.tap(find.byTooltip('Pull requests'));
+ await tester.tap(find.byTooltip('Project options'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));
await tester.pumpAndSettle();
expect(find.text('example/lamp #12'), findsOneWidget);
expect(find.text('example/design #8'), findsNothing);
expect(find.text('This project'), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('super-group-design-lead')));
await tester.pumpAndSettle();
- await tester.tap(find.byTooltip('Pull requests'));
+ await tester.tap(find.byTooltip('Project options'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));
await tester.pumpAndSettle();
expect(find.text('example/design #8'), findsOneWidget);
expect(find.text('example/lamp #12'), findsNothing);
@@ -234,7 +238,10 @@ void main() {
await mount(tester, c);
await tester.tap(find.byTooltip('Project options'));
await tester.pumpAndSettle();
- expect(find.byIcon(AppIcons.ellipsisVertical), findsOneWidget);
+ await tester.tap(
+ find.widgetWithText(MenuItemButton, 'Project settings…'),
+ );
+ await tester.pumpAndSettle();
expect(find.text('Project details'), findsOneWidget);
expect(find.text('Update cadence'), findsNothing);
expect(find.textContaining('Every 5 minutes'), findsNothing);
diff --git a/desktop/test/web/release/quiet_chat_app.dart b/desktop/test/web/release/quiet_chat_app.dart
new file mode 100644
index 000000000..44adc74eb
--- /dev/null
+++ b/desktop/test/web/release/quiet_chat_app.dart
@@ -0,0 +1,63 @@
+// A release-build page holding the real Swarm view on made-up data, for the
+// Quiet Swarm chat's screenshots: `?screen=1`, `?screen=2`. It publishes where
+// its rows are, for the driving script to click. Never shipped: nothing in lib/
+// imports it. Build: flutter build web -t test/web/release/quiet_chat_app.dart
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/view.dart';
+import 'package:web/web.dart' as web;
+
+import 'quiet_chat_data.dart';
+
+/// Publishes where the keyed rows and menu words are, for the script.
+void _publish() {
+ final rects = <String>[];
+ void visit(Element element) {
+ final widget = element.widget;
+ final key = widget.key;
+ final name = key is ValueKey<String>
+ ? key.value
+ : widget is Text && widget.data != null
+ ? 'text:${widget.data}'
+ : null;
+ if (name != null) {
+ final box = element.findRenderObject();
+ if (box is RenderBox && box.hasSize && box.attached) {
+ final at = box.localToGlobal(Offset.zero);
+ rects.add(
+ '$name=${at.dx},${at.dy},${box.size.width},${box.size.height}',
+ );
+ }
+ }
+ element.visitChildren(visit);
+ }
+
+ WidgetsBinding.instance.rootElement?.visitChildren(visit);
+ web.document.body?.setAttribute('data-rects', rects.join('\n'));
+}
+
+Future<void> main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+ final server = quietChatServer(Uri.base.queryParameters['screen'] ?? '1');
+ final controller = server.controller();
+ await controller.refresh();
+ await controller.select('lead');
+ runApp(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: controller,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Studio',
+ ),
+ ),
+ ),
+ );
+ Timer.periodic(const Duration(milliseconds: 200), (_) => _publish());
+}
diff --git a/desktop/test/web/release/quiet_chat_data.dart b/desktop/test/web/release/quiet_chat_data.dart
new file mode 100644
index 000000000..36dfe4be8
--- /dev/null
+++ b/desktop/test/web/release/quiet_chat_data.dart
@@ -0,0 +1,254 @@
+// The made-up Swarm behind quiet_chat_app.dart.
+import '../../support/super_tab_fixture.dart';
+
+final _today = DateTime.now();
+String _at(int hour, int minute) => DateTime(
+ _today.year,
+ _today.month,
+ _today.day,
+ hour,
+ minute,
+).toUtc().toIso8601String();
+
+Map<String, dynamic> _author(String id, String name, {bool person = false}) => {
+ 'kind': person ? 'person' : 'agent',
+ 'id': id,
+ 'name': name,
+};
+
+Map<String, dynamic> _message(
+ String id,
+ String conversation,
+ int sequence,
+ Map<String, dynamic> author,
+ String text,
+ String at, {
+ Map<String, Object?> source = const {},
+}) => {
+ 'id': id,
+ 'thread': id,
+ 'conversationId': conversation,
+ 'sequence': sequence,
+ 'text': text,
+ 'createdAt': at,
+ 'author': author,
+ 'source': source,
+};
+
+Map<String, dynamic> _line(
+ String id,
+ int sequence,
+ String task,
+ String title,
+ String state, {
+ String? answerFor,
+}) => _message(
+ id,
+ 'lead',
+ sequence,
+ _author('river', 'River'),
+ '$title · $state',
+ _at(8, sequence),
+ source: {
+ 'kind': 'task-line',
+ 'taskId': task,
+ 'title': title,
+ 'state': state,
+ 'answerFor': ?answerFor,
+ },
+);
+
+ConversationServer quietChatServer(String screen) {
+ final server = ConversationServer();
+ const projects = ['computer', 'lamp', 'physical-router', 'spaceship'];
+ final conversations = server.state['conversations'] as List;
+ server.state['projects'] = [
+ for (final name in projects) projectFixture(name, name, 'lead-$name'),
+ {
+ ...projectFixture('lead', 'openharness', 'lead'),
+ 'coordinatorName': 'Product Manager',
+ 'status': {
+ 'text':
+ 'Three fixes are on main tonight. Windows credential fix: last '
+ "real Windows run going. Ken's five database fixes: one ready, "
+ "four in review. Dee's calmer app: design out for review.",
+ 'at': _at(20, 33),
+ 'by': 'river',
+ },
+ },
+ ];
+ for (final name in projects) {
+ conversations.add({
+ ...conversationFixture('lead-$name', name),
+ 'projectId': name,
+ });
+ }
+ for (final (id, title) in [
+ ('task-closed', 'Closed agents leave the list'),
+ ('task-windows', 'Windows credential fix'),
+ ('task-phone', 'Phone Activity opens the right message'),
+ ]) {
+ conversations.add({
+ ...conversationFixture(id, title),
+ 'projectId': 'lead',
+ 'leadId': 'theo',
+ 'assignment': {
+ 'agentId': 'theo',
+ 'builderAgentId': 'theo',
+ 'status': 'review',
+ },
+ 'agentIds': ['theo'],
+ });
+ }
+ (server.state['agents'] as List? ?? (server.state['agents'] = [])).addAll([
+ for (final (id, name) in [
+ ('river', 'River'),
+ ('theo', 'Theo'),
+ ('reed', 'Reed'),
+ ])
+ {
+ 'id': id,
+ 'name': name,
+ 'machineId': 'studio',
+ 'harnessId': 'h',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'claude'},
+ },
+ ]);
+ final rows = screen == '2'
+ ? [
+ _line(
+ 'a',
+ 1,
+ 'task-phone',
+ 'Phone Activity opens the right message',
+ 'planned',
+ ),
+ _line(
+ 'b',
+ 2,
+ 'task-phone',
+ 'Phone Activity opens the right message',
+ 'working',
+ ),
+ _line(
+ 'c',
+ 3,
+ 'task-phone',
+ 'Phone Activity opens the right message',
+ 'waiting',
+ answerFor: 'owner',
+ ),
+ _line(
+ 'd',
+ 4,
+ 'task-phone',
+ 'Phone Activity opens the right message',
+ 'review',
+ ),
+ _line(
+ 'e',
+ 5,
+ 'task-phone',
+ 'Phone Activity opens the right message',
+ 'shipped',
+ ),
+ _line(
+ 'f',
+ 6,
+ 'task-phone',
+ 'Phone Activity opens the right message',
+ 'stopped',
+ ),
+ ]
+ : [
+ _message(
+ 'm1',
+ 'lead',
+ 1,
+ _author('ken', 'ken15', person: true),
+ 'Prod DB profile: five slow reads to fix.',
+ _at(18, 50),
+ ),
+ _line(
+ 'l1',
+ 2,
+ 'task-closed',
+ 'Closed agents leave the list',
+ 'shipped',
+ ),
+ _line('l2', 3, 'task-windows', 'Windows credential fix', 'review'),
+ _message(
+ 'p1',
+ 'lead',
+ 4,
+ _author('buddy', "diego's Buddy"),
+ "Proposal from diego's Buddy, on diego's behalf.\n\nGoal: Activity read fix\nScope: The app\nPriority: high",
+ _at(20, 2),
+ source: {
+ 'kind': 'buddy-proposal',
+ 'personId': 'diego',
+ 'ownerMessageId': 'x',
+ },
+ ),
+ _message(
+ 'm2',
+ 'lead',
+ 5,
+ _author('river', 'River'),
+ 'Three fixes are on main.',
+ _at(20, 9),
+ ),
+ _message(
+ 'n1',
+ 'lead',
+ 6,
+ _author('river', 'River'),
+ 'Theo has gone quiet on a task.',
+ _at(20, 20),
+ source: {'kind': 'work-stalled'},
+ ),
+ _message(
+ 'm3',
+ 'lead',
+ 7,
+ _author('dee', 'dee', person: true),
+ "ok i like a. let's make it perfect.",
+ _at(20, 41),
+ ),
+ ];
+ server.messages.addAll(rows);
+ (conversations.firstWhere((g) => (g as Map)['id'] == 'lead')
+ as Map)['lastMessageSequence'] =
+ rows.length;
+ server.state['people'] = [
+ ...(server.state['people'] as List? ?? const []),
+ for (final name in ['diego', 'ken', 'dee'])
+ {
+ 'id': name,
+ 'email': '[email protected]',
+ 'username': name,
+ 'role': 'member',
+ },
+ ];
+ if (screen == '1') {
+ server.state['readMarks'] = {
+ 'owner': {'lead': 5},
+ };
+ }
+ final thread = [
+ (_author('theo', 'Theo'), 'Ready: PR #2605.', _at(20, 12)),
+ (_author('reed', 'Reed'), 'With fixes: one Important.', _at(20, 20)),
+ (_author('theo', 'Theo'), 'Fixed at 98bcfd21c.', _at(20, 31)),
+ ];
+ for (final (i, (author, text, at)) in thread.indexed) {
+ server.messages.add(
+ _message('t$i', 'task-windows', i + 1, author, text, at),
+ );
+ }
+ (conversations.firstWhere((g) => (g as Map)['id'] == 'task-windows')
+ as Map)['lastMessageSequence'] =
+ thread.length;
+
+ return server;
+}
diff --git a/docs/plans/2026-11-02-quiet-swarm-chat-plan.md b/docs/plans/2026-11-02-quiet-swarm-chat-plan.md
new file mode 100644
index 000000000..ed520e6c7
--- /dev/null
+++ b/docs/plans/2026-11-02-quiet-swarm-chat-plan.md
@@ -0,0 +1,86 @@
+# Quiet Swarm 3/6: the chat Implementation Plan
+
+> **Way of working:** by this project's instructions: each failing test committed before its code, then one independent review of the pull request.
+
+**Goal:** The project chat shows one-line tasks and proposals, no stacked cards and no PM notices, under a `# name ▾` header with the project menu.
+
+**Architecture:** One new row widget draws a task's message and another a proposal, chosen in the chat's message builder. The Status card becomes a dialog from the menu, and the catch-up and shipped cards leave the chat. The header and its menu change only for a project's chat; every other conversation stays as it is.
+
+**Tech Stack:** Flutter (Dart), widget tests with a memory store and a fake sign-in, the browser build for screenshots.
+
+**Spec:** `docs/plans/2026-11-02-quiet-swarm-design.md`, screens 1, 2, 3, 9, 9b, 11, 12.
+
+## Global Constraints
+
+- PR body starts with: Requested by [email protected] through Harness.
+- Follow `desktop/design/desktop-design-system.md`: no new colors, icons or controls; one line per row; fewer words.
+- Anything the design doesn't draw stays as it is. No on/off switch.
+- Desktop tests use a memory store and a fake sign-in, and never sign this Mac out of the real CLI.
+- Stay inside `view.dart`'s chat body and header, the three cards, `project_options.dart` and their tests. Other Engineers build the other parts in parallel.
+- Dee's look at the screenshots is the merge gate. Reviewer: Quinn 2.
+
+## Contract with part 2/6
+
+The server's task message has source kind `task-line`, with `taskId`, `state` (`planned`, `working`, `waiting`, `review`, `shipped`) and `answerFor`. Its text is the task's name. Until it lands, today's live cards stay; a message without that source draws as it does now.
+
+## Review Focus
+
+- A task the reader may not read: its line must not open anything or show more than the message itself.
+- A person who isn't the one asked sees `working`-style wording, never Answer, on a task waiting on someone else.
+- A hidden notice that something replies to or that holds the New line: the line and the quote must not point at a row that isn't there.
+- The project menu for a viewer and for a non-owner: each item only if they may use it, as today's menu has it.
+- A narrow window: the header and the task line must fit with no overflow.
+
+---
+
+### Task 1: One-line tasks and proposals
+
+**Files:**
+- Create: `desktop/lib/super_tabs/task_line.dart`
+- Modify: `desktop/lib/super_tabs/view.dart`, `desktop/lib/super_tabs/model.dart`
+- Test: `desktop/test/super_tab_task_line_test.dart`
+
+**Interfaces:**
+- Produces: `SuperTabTaskLine(message, readerId, onOpen)` and `SuperTabProposalLine(message, owner, onOpen)`; `SuperTabMessage.taskLine`.
+
+- [x] **Step 1: Write the failing tests:** each state draws its mark and word on one row; `waiting` says Answer only to the person asked; clicking opens the task; a proposal is one row that opens.
+- [x] **Step 2: Run to verify they fail.** Run: `flutter test test/super_tab_task_line_test.dart`. Expected: FAIL.
+- [x] **Step 3: Implement** both rows, and use them in the chat's message builder.
+- [x] **Step 4: Run to verify they pass.**
+- [x] **Step 5: Commit.**
+
+### Task 2: Nothing stacked over the chat
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/view.dart`; `project_status_card.dart`, `catch_up_card.dart`, `ship_row.dart`
+- Test: `desktop/test/super_tab_quiet_chat_test.dart`
+
+- [x] **Step 1: Write the failing tests:** no Status card, While you were away or Shipped card in a project's chat; the New line stays; `work-stalled`, `work-lost`, `idle` and the other PM notices never show.
+- [x] **Step 2: Run to verify they fail.**
+- [x] **Step 3: Implement.**
+- [x] **Step 4: Run to verify they pass.**
+- [x] **Step 5: Commit.**
+
+### Task 3: The header and project menu
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/view.dart`, `desktop/lib/super_tabs/project_options.dart`
+- Test: `desktop/test/super_tab_project_menu_test.dart`
+
+- [x] **Step 1: Write the failing tests:** a project's header is `# name ▾`, Members and the terminal; the menu holds Status, Pull requests, Instructions, Sharing, Notifications, then Project settings…; Status opens the report with its time; Project settings… holds rename, switch PM, archived and delete; another conversation's header is unchanged.
+- [x] **Step 2: Run to verify they fail.**
+- [x] **Step 3: Implement.**
+- [x] **Step 4: Run to verify they pass.**
+- [x] **Step 5: Commit, then push.**
+
+### Task 4: Screenshots
+
+- [x] **Step 1:** Render screens 1, 2, 3, 9 and 9b from a browser build on made-up data, and put them in the PR.
+
+## Design
+
+- **Growth, concurrency, read cost, scale, migration:** N/A because this only changes how Desktop draws what it already reads.
+- **Compatibility:** an older backend sends no `task-line` message, and today's cards stay for it.
+- **Audience:** the server decides what a reader gets; a line opens only a conversation the reader's Swarm read includes.
+- **Failure:** a task not in the read keeps its line and opens nothing.
+- **Platforms:** Desktop and the web build, narrow windows included.
diff --git a/scripts/ui-style-allowlist/desktop.json b/scripts/ui-style-allowlist/desktop.json
index b50a4f8f3..a20e07d09 100644
--- a/scripts/ui-style-allowlist/desktop.json
+++ b/scripts/ui-style-allowlist/desktop.json
@@ -83,7 +83,7 @@
"edge-insets": 2
},
"desktop/lib/super_tabs/view.dart": {
- "edge-insets": 20,
+ "edge-insets": 19,
"border-radius": 1
}
}