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-03 by: #2726 #2298 (#2752)

0xken150e03f990bfb7
diff --git a/cli/src/cable/cableSession.spec.ts b/cli/src/cable/cableSession.spec.ts
index d33a6c334..5f5b7ca3e 100644
--- a/cli/src/cable/cableSession.spec.ts
+++ b/cli/src/cable/cableSession.spec.ts
@@ -4706,6 +4706,69 @@ describe('swarm cards', () => {
} finally { await session.stop() }
})
+ describe('a Pro that says swarmChat speaks to the Lead conversation, whatever chat the desktop has open', () => {
+ const PRO_CHAT = { ...ROUND, board: 'pro' }
+ const buddyFace = { kind: 'buddy' as const, id: 'pm1', name: "diego's Buddy", working: false }
+ const spoken = async (leads: SwarmLead[], over: Partial<CableHost> = {}, agentId = 'a1', said: SaidOnCard = { said: true }) => {
+ const swarmSay = vi.fn(async () => said)
+ const host = cardHost({ cards: [card('st1', leads)] }, { transcribe: vi.fn(async () => 'ship it'), route: vi.fn(), swarmSay, ...over })
+ const { session, port } = await connect(host)
+ try {
+ port.say(PRO_CHAT)
+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))
+ voice(port, agentId)
+ await vi.waitFor(() => expect(port.types().some((t) => t === 'voice.transcript' || t === 'voice.error') || vi.mocked(host.sendTurn).mock.calls.length > 0).toBe(true))
+ return { swarmSay, host, errors: ofType(port, 'voice.error').map((e) => e.message), transcripts: ofType(port, 'voice.transcript') }
+ } finally { await session.stop() }
+ }
+
+ it.each([['a group', group], ['the PM chat', pmChat], ['the Buddy chat', buddyFace]])('with %s open on the desktop', async (_, chat) => {
+ const { swarmSay, transcripts } = await spoken([lead(1, { local: 'a1', chat })])
+ // Exactly the Lead conversation's call: no chat flag and no chat id, so no chat of the desktop's is named or followed.
+ expect(swarmSay.mock.calls).toEqual([['a1', 'ship it']])
+ expect(transcripts).toHaveLength(1)
+ })
+
+ it('from a plain agent room (not a Lead), where the Pro shows no chat', async () => {
+ const { swarmSay } = await spoken([lead(1, { local: 'a1', chat: group })], {}, 'other-harness')
+ expect(swarmSay.mock.calls).toEqual([['other-harness', 'ship it']])
+ })
+
+ it('to a Lead on another machine: no chat named, and no terminal here takes the words when it fails', async () => {
+ const remote = 'a'.repeat(24)
+ const { swarmSay, host, errors } = await spoken([lead(1, { id: remote, chat: group })], {}, remote, { said: false })
+ expect(swarmSay.mock.calls).toEqual([[remote, 'ship it']])
+ expect(host.sendTurn).not.toHaveBeenCalled()
+ expect(errors).toEqual(['Could not reach the Swarm. Try again.'])
+ })
+
+ it('after the Swarm is gone from the machine\'s cards (access lost): still no chat', async () => {
+ const { swarmSay } = await spoken([], {})
+ expect(swarmSay.mock.calls).toEqual([['a1', 'ship it']])
+ })
+
+ it('a post the backend refused is the refusal, not a turn', async () => {
+ const refused: SaidOnCard = { said: false, refused: { code: 'READ_ONLY', message: 'This chat is read-only.' } }
+ const { swarmSay, host, errors } = await spoken([lead(1, { local: 'a1', chat: pmChat })], {}, 'a1', refused)
+ expect(swarmSay.mock.calls).toEqual([['a1', 'ship it']])
+ expect(host.sendTurn).not.toHaveBeenCalled()
+ expect(errors).toEqual(['This chat is read-only.'])
+ })
+
+ it('a round dial still posts in its face chat', async () => {
+ const swarmSay = vi.fn(async () => ({ said: true as const }))
+ const host = cardHost({ cards: [card('st1', [lead(1, { local: 'a1', chat: group })])] }, { transcribe: vi.fn(async () => 'ship it'), route: vi.fn(), swarmSay })
+ const { session, port } = await connect(host)
+ try {
+ port.say(ROUND)
+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))
+ voice(port, 'a1')
+ await vi.waitFor(() => expect(swarmSay).toHaveBeenCalled())
+ expect(swarmSay.mock.calls[0]).toEqual(['a1', 'ship it', true, 'g1'])
+ } finally { await session.stop() }
+ })
+ })
+
it('12 Leads with chats stay under the device\'s 512-token guard', async () => {
const wide = 'é'.repeat(24) // 48 bytes
const cards = [card('st1', Array.from({ length: 13 }, (_, l) => lead(l, {
@@ -4746,6 +4809,47 @@ describe('swarm cards', () => {
return isSupertab
})
+ /** Tokens as the Pro's guard counts them: every object, array, string (keys too) and bare value is one. */
+ const tokens = (v: unknown): number => Array.isArray(v) ? 1 + v.reduce((n: number, x) => n + tokens(x), 0)
+ : v && typeof v === 'object' ? 1 + Object.entries(v).reduce((n, [, x]) => n + 1 + tokens(x), 0) : 1
+ const big = (n: number) => lead(n, { project: `p${n}`.padEnd(48, 'p'), owner: `o${n}`.padEnd(48, 'o'), chat: { ...pmChat, name: `c${n}`.padEnd(48, 'c') },
+ sideChat: { ...buddyChat, name: `s${n}`.padEnd(48, 's') }, buddies: true, buddy: { ...buddy, name: `b${n}`.padEnd(48, 'b') } })
+ const twelve = () => [card('st1', Array.from({ length: 12 }, (_, i) => big(i + 1)))]
+
+ it('a Pro\'s swarmBuddy supertab frame stays within 480 JSON tokens with 12 Leads and a Buddy each', async () => {
+ const log = vi.fn()
+ const { session, port } = await connect(cardHost({ cards: twelve() }, { log }))
+ try {
+ port.say({ ...BUDDY, board: 'pro' })
+ await vi.waitFor(() => expect(ofType(port, 'supertab').length).toBeGreaterThan(0))
+ const frames = ofType(port, 'supertab')
+ // 483 tokens with every Buddy: at least one block goes, and no name is shortened for it.
+ expect((frames.at(-1)!.leads as Array<Record<string, unknown>>).some((l) => !('buddy' in l))).toBe(true)
+ expect((frames.at(-1)!.leads as Array<Record<string, unknown>>).every((l) => String(l.project).length === 48 && String(l.chatName).length === 48)).toBe(true)
+ // The spec's known limit says so in the log, with how many went.
+ expect(log).toHaveBeenCalledWith(expect.stringMatching(/supertab st1 too large — \d+ Buddy block\(s\) dropped/))
+ for (const f of frames) {
+ expect(tokens(f)).toBeLessThanOrEqual(480)
+ const has = (f.leads as Array<Record<string, unknown>>).map((l) => 'buddy' in l)
+ // Buddy blocks go from the last Lead up: those kept are a prefix.
+ expect(has).toEqual([...has].sort((a, b) => Number(b) - Number(a)))
+ }
+ } finally { await session.stop() }
+ })
+
+ it('a round\'s swarmBuddy supertab frame is unchanged by the Pro budget', async () => {
+ const log = vi.fn()
+ const { session, port } = await connect(cardHost({ cards: twelve() }, { log }))
+ try {
+ port.say(BUDDY)
+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))
+ const leads = ofType(port, 'supertab')[0].leads as Array<Record<string, unknown>>
+ expect(leads).toHaveLength(12)
+ expect(leads.every((l) => 'buddy' in l)).toBe(true)
+ expect(log).not.toHaveBeenCalledWith(expect.stringContaining('Buddy block'))
+ } finally { await session.stop() }
+ })
+
it('a swarmBuddy dial gets each Lead\'s buddy block and buddies flag', async () => {
const cards = [card('st1', [withBuddy(), lead(2, { chat: pmChat, sideChat: { kind: 'lead', id: 'lead-c2', name: 'Lead', working: false }, buddies: true }), lead(3)])]
const { session, port } = await connect(cardHost({ cards }))
diff --git a/cli/src/cable/cableSession.ts b/cli/src/cable/cableSession.ts
index 473f16fdd..07a36e91c 100644
--- a/cli/src/cable/cableSession.ts
+++ b/cli/src/cable/cableSession.ts
@@ -203,19 +203,25 @@ const NAME_CUTS = [24, 12, 6, 3, 1, 0]
* doubles, past it even with no Buddy names at all (review of #2146). Last, whole Buddy blocks go, from the least urgent Lead
* up: engines of control characters (six bytes each in JSON) leave a Buddy frame at 8,275 bytes with every name empty, and
* without its Buddies a frame is today's swarmChat one, about 5.3 KB at most. A frame that fits is sent as it is.
+ * With `tokens`, as for the Harness Pro, whose guard refuses a JSON frame over 512 tokens, a frame fits only if it is also
+ * within that many JSON tokens. Shorter names do not lower that count, so only the Buddy blocks go for it.
+ * Returns how many Buddy blocks went, for the caller's log.
*/
-function fitFrame(frame: { name: string; leads: Array<Record<string, unknown>> }): void {
- const fits = () => Buffer.byteLength(JSON.stringify(frame)) < CABLE_MAX_PAYLOAD
+function fitFrame(frame: { name: string; leads: Array<Record<string, unknown>> }, tokens?: number): number {
+ const small = () => Buffer.byteLength(JSON.stringify(frame)) < CABLE_MAX_PAYLOAD
+ const fits = () => small() && (tokens === undefined || jsonTokens(frame) <= tokens)
type Named = { [key: string]: unknown }
const buddies: Array<[Named, string]> = frame.leads.map((l) => l.buddy as Named | undefined).filter((b) => b !== undefined).map((b) => [b, 'name'])
const names: Array<[Named, string]> = [[frame, 'name'], ...frame.leads.flatMap((l) => ['project', 'owner', 'chatName'].filter((key) => key in l).map((key): [Named, string] => [l, key]))]
for (const fields of [buddies, [...buddies, ...names]]) {
for (const bytes of NAME_CUTS) {
- if (fits()) return
+ if (small()) break
for (const [holder, key] of fields) holder[key] = truncateUtf8(String(holder[key]), bytes)
}
}
- for (let i = frame.leads.length - 1; i >= 0 && !fits(); i--) delete frame.leads[i].buddy
+ let dropped = 0
+ for (let i = frame.leads.length - 1; i >= 0 && !fits(); i--) if (frame.leads[i].buddy !== undefined) { delete frame.leads[i].buddy; dropped++ }
+ return dropped
}
/** A Lead's new message as the round dial's alert, sized as the recap is. */
function noticeFrame(tab: string, lead: string, n: LeadNotice): Message {
@@ -1750,13 +1756,13 @@ export class CableSession {
// start. Quoted text, carried text, questions and edits already have their own pinned targets.
// Except words for a Swarm face's chat: the dial shows that chat, so a pane focused in the window never takes them.
const plain = str('agentId') && !formVoice && !searchVoice && !draftVoice && !questionVoice && !carryVoice && !('selectionId' in msg)
- const dialFace = plain ? this.swarmFaceOf(str('agentId')!) : undefined
+ const dialFace = plain ? this.voiceFaceOf(str('agentId')!) : undefined
// A Swarm Lead's id (the backend's 24 hex; a harness's is a UUID) with no card here yet (the devices process just
// restarted) or any more: words for a Lead on another machine, which the focused pane must not take (review of #2232).
const swarmId = plain && !dialFace && SWARM_AGENT_ID.test(str('agentId')!)
const focused = plain && !dialFace && !swarmId ? this.host.appFocus?.() : undefined
const agentId = focused?.agentId ?? str('agentId')
- const swarmFace = dialFace ?? (agentId ? this.swarmFaceOf(agentId) : undefined)
+ const swarmFace = dialFace ?? (agentId ? this.voiceFaceOf(agentId) : undefined)
this.voice = {
agentId,
...(swarmFace ? { swarmFace } : {}),
@@ -2785,6 +2791,16 @@ export class CableSession {
return undefined
}
+ /**
+ * The chat words spoken to this Lead are posted in: its face chat, for a dial that names where words go. Never for a Pro:
+ * it shows the face chat but no "Sending to", and its plain agent room shows no chat at all, so following the desktop's
+ * open chat would post the person's words in a group or PM chat they cannot see they are talking to (review of #2298). Its
+ * words go to the Lead conversation, as before it said swarmChat, until voice comes to the Pro (Swarm parity, part 3).
+ */
+ private voiceFaceOf(harnessId: string): SwarmFace | undefined {
+ return this.seqOn ? undefined : this.swarmFaceOf(harnessId)
+ }
+
/** Whether `harnessId` is a Swarm Lead's harness on this machine. */
private swarmLeadHere(harnessId: string): boolean {
return (this.host.swarmCards?.() ?? []).some((card) => card.leads.some((l) => l.local === harnessId))
@@ -2792,6 +2808,8 @@ export class CableSession {
/** The extra arguments of words spoken to a Swarm Lead: the dial's chat flag, and the chat they were spoken to. */
private sayArgs(face: SwarmFace | undefined): [chat?: CardChat, chatId?: string] {
+ // A chat flag with no id means "the chat open on the desktop" to the Swarm service: a Pro sends neither (voiceFaceOf).
+ if (this.seqOn) return []
const [chat] = this.chatFlag()
if (chat === undefined) return []
return face ? [chat, face.id] : [chat]
@@ -2885,10 +2903,12 @@ export class CableSession {
const frame = { t: 'supertab', id: card.id, tab, name: card.name, count: card.count, ...(this.swarmBuddy ? { side: card.side ?? 'pm' } : {}),
leads: card.leads.slice(0, SWARM_LEADS_MAX).map((l) => this.swarmBuddy ? buddyLead(l) : this.swarmChat ? chatLead(l) : { id: l.id, projectId: l.projectId, project: l.project,
engine: l.engine, owner: l.owner, local: l.local, state: l.state, order: l.order, ...(l.since === undefined ? {} : { since: l.since }) }) }
- fitFrame(frame)
+ const buddiesDropped = fitFrame(frame, this.seqOn ? SWARM_TOKENS_MAX : undefined)
const key = JSON.stringify(frame)
if (this.cardKeys.get(card.id) === key) continue
this.cardKeys.set(card.id, key)
+ // Once per frame sent: those Leads show "No Buddy here yet" though they have one (spec 2026-10-30-harness-pro-swarm-parity, Scale).
+ if (buddiesDropped) this.log(`cable: supertab ${card.id.slice(0, 8)} too large — ${buddiesDropped} Buddy block(s) dropped`)
await this.send(frame)
}
if (this.swarmChat) await this.pushNotices(cards, force)
diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dart
index bcca30e71..0850c4483 100644
--- a/desktop/lib/super_tabs/roster.dart
+++ b/desktop/lib/super_tabs/roster.dart
@@ -91,6 +91,10 @@ class _SuperTabRosterState extends State<SuperTabRoster>
/// this visit.
bool _idleOpen = false;
+ /// Whether the people folded under Others (N) show; folded at first, for
+ /// this visit.
+ bool _othersOpen = false;
+
SuperTabController get c => widget.controller;
/// The board read here when the view shares none.
@@ -538,8 +542,9 @@ class _SuperTabRosterState extends State<SuperTabRoster>
if (scoped == null || personInProject(scoped, person.id, board: board))
person,
];
- final scores = {
- for (final score in board?.people ?? const []) score.personId: score,
+ final scores = <String, SuperTabPersonScore>{
+ for (final score in board?.people ?? const <SuperTabPersonScore>[])
+ score.personId: score,
};
// The selected week's points, highest first; equal points, and no points
// at all, by name, letter case aside (Dee, 2026-10-29).
@@ -553,6 +558,12 @@ class _SuperTabRosterState extends State<SuperTabRoster>
final byName = sortName(a).compareTo(sortName(b));
return byName != 0 ? byName : a.id.compareTo(b.id);
});
+ // This project lists who is active in it; everyone else who can read it
+ // folds under Others (Dee, 2026-11-03). Only on its own board's numbers:
+ // before they land there is nothing to tell the two apart.
+ final split = scoped != null && board != null
+ ? splitProjectPeople(sorted, scores)
+ : (active: sorted, others: const <SuperTabPerson>[]);
// Most urgent first, as the tabs order their marks: needs input, working,
// idle, offline; within a mark, the most recent progress first (Dee,
// 2026-10-30). Equals keep today's order, the Lead first. Each agent's
@@ -609,14 +620,19 @@ class _SuperTabRosterState extends State<SuperTabRoster>
),
// Points are the last 7 days, the period on hover; who waits on whom is
// Activity's Needs you (Quiet Swarm, 2026-11-02).
- for (final person in sorted)
- LeaderboardPersonRow(
- person: person,
- score: scores[person.id],
- columns: columns,
- own: person.id == c.accountId,
- onTap: () => _person(person, scores[person.id]),
+ for (final person in split.active) _personRow(person, scores, columns),
+ if (split.others case final others when others.isNotEmpty) ...[
+ SuperTabSectionHeading(
+ 'Others (${others.length})',
+ key: const ValueKey('super-members-others'),
+ // In line with the rows, as Idle (N) is under Agents.
+ startInset: 16,
+ collapsed: !_othersOpen,
+ onToggleCollapsed: () => setState(() => _othersOpen = !_othersOpen),
),
+ if (_othersOpen)
+ for (final person in others) _personRow(person, scores, columns),
+ ],
const SizedBox(height: DesktopChrome.groupGap),
SuperTabSectionHeading(
'Agents',
@@ -645,6 +661,18 @@ class _SuperTabRosterState extends State<SuperTabRoster>
];
}
+ Widget _personRow(
+ SuperTabPerson person,
+ Map<String, SuperTabPersonScore> scores,
+ LeaderboardColumns? columns,
+ ) => LeaderboardPersonRow(
+ person: person,
+ score: scores[person.id],
+ columns: columns,
+ own: person.id == c.accountId,
+ onTap: () => _person(person, scores[person.id]),
+ );
+
/// The column's heading: the project-or-Swarm choice while a project is
/// open ([narrowed] says which is chosen), All projects alone otherwise,
/// and its close at the right as a thread's has.
diff --git a/desktop/lib/super_tabs/roster_scope.dart b/desktop/lib/super_tabs/roster_scope.dart
index 6c0332307..226cf0fec 100644
--- a/desktop/lib/super_tabs/roster_scope.dart
+++ b/desktop/lib/super_tabs/roster_scope.dart
@@ -96,3 +96,18 @@ bool personInProject(
if (!project.isPrivate) return true;
return project.ownerId == personId || project.memberIds.contains(personId);
}
+
+/// The people "This project" lists ([active]: points above 0 on the open
+/// project's own board, which counts only its work) and those it folds under
+/// Others (N): everyone else who can read the project (Dee, 2026-11-03). Each
+/// keeps the order [people] came in.
+({List<SuperTabPerson> active, List<SuperTabPerson> others}) splitProjectPeople(
+ List<SuperTabPerson> people,
+ Map<String, SuperTabPersonScore> scores,
+) {
+ bool active(SuperTabPerson person) => (scores[person.id]?.points ?? 0) > 0;
+ return (
+ active: people.where(active).toList(),
+ others: people.where((person) => !active(person)).toList(),
+ );
+}
diff --git a/desktop/test/super_tab_roster_scope_test.dart b/desktop/test/super_tab_roster_scope_test.dart
index f842dd3f9..b2ed79872 100644
--- a/desktop/test/super_tab_roster_scope_test.dart
+++ b/desktop/test/super_tab_roster_scope_test.dart
@@ -445,6 +445,192 @@ void main() {
});
});
+ group(
+ 'This project: the active people, the rest under Others (Dee, 11-03)',
+ () {
+ final others = find.byKey(const ValueKey('super-members-others'));
+ // The heading's words toggle it, as Idle (N)'s do.
+ final othersLabel = find.descendant(
+ of: others,
+ matching: find.textContaining('Others ('),
+ );
+
+ /// openharness's board names all three; Tony did nothing there yet.
+ Future<RosterFixture> withIdlePerson(WidgetTester tester) async {
+ final f = await swarm(tester);
+ f.server.leaderboard = {
+ ...f.server.leaderboard!,
+ 'people': [
+ score('owner', 30, 1),
+ score('dee', 12, 2),
+ score('tony', 0, 3),
+ ],
+ };
+ await f.controller.refresh();
+ return f;
+ }
+
+ testWidgets(
+ 'lists the active people busiest first, the rest folded under '
+ 'Others',
+ (tester) async {
+ final f = await withIdlePerson(tester);
+ await f.show(tester);
+ await choose(tester, 'This project');
+ expect(person('owner'), findsOneWidget);
+ expect(person('dee'), findsOneWidget);
+ expect(
+ tester.getTopLeft(person('owner')).dy,
+ lessThan(tester.getTopLeft(person('dee')).dy),
+ reason: 'busiest first',
+ );
+ // Tony can read the project but did nothing in it: folded at first.
+ expect(person('tony'), findsNothing);
+ expect(
+ find.descendant(of: others, matching: find.text('Others (1)')),
+ findsOneWidget,
+ );
+ expect(
+ tester.getTopLeft(others).dy,
+ lessThan(tester.getTopLeft(find.text('Agents')).dy),
+ reason: 'Others closes People, above Agents',
+ );
+ await tester.tap(othersLabel);
+ await tester.pumpAndSettle();
+ expect(person('tony'), findsOneWidget);
+ expect(
+ tester.getTopLeft(person('tony')).dy,
+ greaterThan(tester.getTopLeft(others).dy),
+ );
+ await tester.tap(othersLabel);
+ await tester.pumpAndSettle();
+ expect(person('tony'), findsNothing);
+ await f.close(tester);
+ },
+ );
+
+ testWidgets('All projects folds nobody', (tester) async {
+ final f = await withIdlePerson(tester);
+ await f.show(tester);
+ expectWholeSwarm();
+ expect(others, findsNothing);
+ await f.close(tester);
+ });
+
+ testWidgets(
+ 'while the board is not in, everyone who can read it is listed',
+ (tester) async {
+ final f = await swarm(tester, board: false);
+ await f.show(tester);
+ await choose(tester, 'This project');
+ for (final id in ['owner', 'dee', 'tony']) {
+ expect(person(id), findsOneWidget, reason: id);
+ }
+ expect(others, findsNothing);
+ await f.close(tester);
+ },
+ );
+
+ testWidgets(
+ 'a private project lists only its members, the idle ones under '
+ 'Others',
+ (tester) async {
+ final f = await swarm(tester, open: false);
+ f.server.state['projects'] = [
+ {
+ ...projectFixture(
+ 'lead',
+ 'openharness',
+ 'lead',
+ visibility: 'private',
+ ),
+ 'members': [
+ {'id': 'dee'},
+ ],
+ },
+ projectFixture('os', 'autonomous-os', 'os-lead'),
+ ];
+ // The board names who can read it: the owner and Dee, never Tony.
+ f.server.leaderboard = {
+ ...f.server.leaderboard!,
+ 'people': [score('owner', 30, 1), score('dee', 0, 2)],
+ };
+ await f.controller.refresh();
+ await f.controller.select('lead');
+ await f.show(tester);
+ await choose(tester, 'This project');
+ expect(person('owner'), findsOneWidget);
+ expect(person('dee'), findsNothing);
+ expect(
+ find.descendant(of: others, matching: find.text('Others (1)')),
+ findsOneWidget,
+ );
+ await tester.tap(othersLabel);
+ await tester.pumpAndSettle();
+ expect(person('dee'), findsOneWidget);
+ expect(
+ person('tony'),
+ findsNothing,
+ reason: 'not a member: not even under Others',
+ );
+ await f.close(tester);
+ },
+ );
+
+ test(
+ 'splitProjectPeople keeps the order and splits on points above 0',
+ () {
+ SuperTabPerson p(String id) => SuperTabPerson.fromJson({
+ 'id': id,
+ 'email': '[email protected]',
+ 'role': 'collaborator',
+ });
+ final people = [p('a'), p('b'), p('c'), p('d')];
+ final scores = {
+ for (final (id, points) in [('a', 9), ('b', 0), ('c', 3)])
+ id: SuperTabPersonScore.fromJson(score(id, points, 1)),
+ };
+ final split = splitProjectPeople(people, scores);
+ expect(split.active.map((x) => x.id), ['a', 'c']);
+ expect(split.others.map((x) => x.id), ['b', 'd']);
+ },
+ );
+
+ testWidgets('light and dark, Others folded and open', (tester) async {
+ final f = await withIdlePerson(tester);
+ final saved = grid.AppTheme.brightness.value;
+ addTearDown(() => grid.AppTheme.brightness.value = saved);
+ for (final brightness in Brightness.values) {
+ grid.AppTheme.brightness.value = brightness;
+ await f.show(tester, brightness: brightness);
+ await choose(tester, 'This project');
+ for (final open in [false, true]) {
+ FocusManager.instance.primaryFocus?.unfocus();
+ await tester.pumpAndSettle();
+ expect(tester.takeException(), isNull);
+ if (captureDir != null) {
+ await captureBoundary(
+ tester,
+ f.boundary.currentContext!.findRenderObject()!
+ as RenderRepaintBoundary,
+ captureDir,
+ 'roster-others-${open ? 'open' : 'folded'}-${brightness.name}',
+ );
+ }
+ if (!open) {
+ await tester.tap(othersLabel);
+ await tester.pumpAndSettle();
+ }
+ }
+ await tester.tap(othersLabel);
+ await tester.pumpAndSettle();
+ await choose(tester, 'All projects');
+ }
+ await f.close(tester);
+ });
+ },
+ );
+
test("another project's board never decides who is in this one", () {
final project = SuperTabProject.fromJson({
...projectFixture(
diff --git a/devices/harness-pro/docs/cable.md b/devices/harness-pro/docs/cable.md
index b83fea077..00d4102cf 100644
--- a/devices/harness-pro/docs/cable.md
+++ b/devices/harness-pro/docs/cable.md
@@ -30,6 +30,7 @@ Full key list, in the order the Pro sends it:
| `player` | `"library-v1"` | capability |
| `superTab` | `"wait-v1"` | capability: Super Tab waits on `question` (below) |
| `swarmCard` | `"v1"` | capability: the Swarm cards and the Lead view (frames below) |
+| `swarmChat` | `"v1"` | capability: the chat the desktop has open on each Lead's face, and its notices (the round dial's, spec 2026-10-30-harness-pro-swarm-parity) |
| `ota` | `"v1"` | capability: the Pro takes firmware offers |
| `mac` | `aa:bb:...` | existing |
| `settings` | object | existing: brightness, character, face, voiceLang, muted, quiet, straightTitle, focusFace, scrollReversed, round |
@@ -202,7 +203,7 @@ Daemon to Pro:
"leads":[{"id":"<leadAgentId>","projectId":"<projectId>","project":"mobile","engine":"claude","owner":"","local":"<harnessId or empty>",
"state":"ask|stuck|work|done","order":1,"since":134}]} one per Swarm, replacing it; `leads` in card order
{"t":"supertab.recap","tab":"<superTabId>","lead":"<leadAgentId>","text":"...","at":1792560000,"none":false} a Lead's last message (answers recap.get, and is pushed while that Lead is open)
-{"t":"supertab.focus","tab":"<superTabId>","lead":"<leadAgentId>"} the desktop opened this Swarm project
+{"t":"supertab.focus","tab":"<superTabId>","lead":"<leadAgentId or empty>"} the desktop opened this Swarm project (empty: the Swarm, no project)
```
- `tab` links a Swarm to the desk tab of the same Swarm (empty: the desktop has none open); a linked desk tab shows the Swarm's card, an unlinked Swarm is one more Home page after the tabs.
@@ -233,3 +234,24 @@ Pro to daemon:
- After a link drop nothing is sent until the Swarm list is back; then an open view sends `supertab.open` and `supertab.recap.get` again.
- A Lead that leaves the list while its view is open moves the view to the Lead that took its place (the next, else the last); with none left, or the Swarm gone, the view goes Home.
- Frames are sent without waiting: a busy link loses one.
+
+### The face chat and its notices (`swarmChat: "v1"`)
+
+With `swarmChat`, the daemon sends the round dial's frames (`docs/device-voice-swarm-chat.md`, spec `2026-10-28-round-dial-swarm-chat-design.md`):
+
+```
+"leads":[{..., "chat":"lead|pm|group", "chatId":"<conversationId>", "chatName":"PM"}] the chat the desktop has open in that project, else the Lead's
+{"t":"supertab.recap", ..., "chatId":"<conversationId>"} the last message of that chat
+{"t":"supertab.notice","tab":"<superTabId>","lead":"<leadAgentId>","chat":"lead|pm","chatId":"<conversationId>","id":"<messageId>","text":"...","at":1792560000}
+{"t":"supertab.notice.read","tab":"<superTabId>","lead":"<leadAgentId>","chatId":"<conversationId>"}
+```
+
+- A `pm` or `group` chat is named under the project on the Lead view; `lead` (or none) draws the view as before.
+- A recap whose `chatId` is not the Lead's current chat is dropped. When a Lead's chat changes, an open Lead shows "..." until the new chat's message arrives.
+- `supertab.notice` files one Notices row per Lead (its project, tagged "· <Swarm name>") and toasts, unless that Lead's view is on screen. A tap on either opens the
+ Lead and sends `supertab.select`. `supertab.notice.read` removes the row whose `chatId` matches.
+ A Swarm that leaves `supertabs`, or a Lead that leaves its Swarm's `supertab` frame, takes its rows and their toast with it: access lost sends no read.
+- `state` is `work` only for a working group and otherwise `done`; `ask` and `stuck` are not sent to a `swarmChat` device.
+- `supertab.focus` with an empty `lead` (the desktop opened the Swarm with no project, e.g. its Chat with PM) opens the Lead last shown in that Swarm, else its first.
+- Voice does not follow the face. The daemon treats a `board:"pro"` hello's `voice.begin` as it did before `swarmChat`: spoken words post in the Lead conversation, never in the
+ group, PM or Buddy chat the desktop has open, because the Pro's rooms do not show where words go. Voice comes to the face chat in Phase 3 of the parity spec.
diff --git a/devices/harness-pro/firmware/main/app/pod_glue.c b/devices/harness-pro/firmware/main/app/pod_glue.c
index d6d77bbb8..0a1ea3a04 100644
--- a/devices/harness-pro/firmware/main/app/pod_glue.c
+++ b/devices/harness-pro/firmware/main/app/pod_glue.c
@@ -38,6 +38,7 @@ void pod_ui_render(pod_ui_t *u, ht_scene_t *scene, uint32_t now_ms)
if (u->ban_on && !u->ban_stay && (int32_t)(now_ms - u->ban_until) >= 0) u->ban_on = false;
if (u->ban_on && u->ban_stay && top(u) && top(u)->view == POD_V_INBOX) u->ban_on = false;
if (u->ban_on && !(ban = pod_model_unread_find(&u->model, u->ban_agent))) u->ban_on = false;
+ if (ban && strcmp(ban->tab, u->ban_tab)) { ban = NULL; u->ban_on = false; } // the entry was replaced by another kind
u->frame.banner = ban && u->model.linked && !pod_ui_talking(u) && toast_fits(u); // the toast, only over a room
pod_render(&u->frame, &u->nav, &u->model, now_ms);
if (u->frame.banner) { // over everything, with the hit on top
@@ -75,7 +76,7 @@ pod_out_t pod_ui_link(pod_ui_t *u, bool up)
if (!up) pod_ui_sweep_abort(u);
if (!up || !u->model.linked) { // the daemon forgets the open recap and any focus with its link: nothing queued or open carries over
u->sup_qn = 0;
- u->sup_tab[0] = u->sup_lead[0] = 0;
+ u->sup_tab[0] = u->sup_lead[0] = u->sup_chat[0] = 0;
u->lead_wait = false;
}
if (up && !u->model.linked) { // a real down -> up transition: the start runs again on this link on swarms this link brings
@@ -201,9 +202,9 @@ pod_out_t pod_ui_supertab(pod_ui_t *u, const pod_swarm_t *s, uint32_t now_ms)
return synced(u);
}
-pod_out_t pod_ui_supertab_recap(pod_ui_t *u, const char *tab, const char *lead, const char *text, uint32_t at, bool none)
+pod_out_t pod_ui_supertab_recap(pod_ui_t *u, const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t at, bool none)
{
- pod_model_supertab_recap(&u->model, tab, lead, text, at, none);
+ pod_model_supertab_recap(&u->model, tab, lead, chat_id, text, at, none);
return synced(u);
}
@@ -238,6 +239,9 @@ static int iabs(int v) { return v < 0 ? -v : v; }
static bool toast_fits(const pod_ui_t *u)
{
const pod_frame_t *f = top(u);
+ if (u->ban_tab[0]) // a Swarm chat's notice: also over another Lead's view, never over the Lead it is from
+ return u->ban_on && !u->ota && f && (f->view == POD_V_AGENT || f->view == POD_V_RECAP ||
+ (f->view == POD_V_LEAD && (strcmp(f->swarm, u->ban_tab) || strcmp(f->lead_id, u->ban_agent))));
return u->ban_on && !u->ota && f && (f->view == POD_V_AGENT || f->view == POD_V_RECAP) && strcmp(f->agent, u->ban_agent);
}
@@ -316,10 +320,19 @@ void pod_ui_scroll_sink(pod_ui_t *u, ht_scroll_emit_t emit, void *ctx, bool reve
u->scroll_reversed = reversed;
}
-// A tap on the toast: open Notices, which lists the entry.
+static void swarm_entry_open(pod_ui_t *u, const pod_unread_t *e);
+
+// A tap on the toast: open Notices, which lists the entry. A Swarm chat's notice opens its Lead instead.
static pod_out_t banner_open(pod_ui_t *u, uint32_t now_ms)
{
+ const pod_unread_t *e = pod_model_unread_find(&u->model, u->ban_agent);
u->ban_on = false;
+ if (e && e->tab[0]) {
+ pod_out_t none;
+ memset(&none, 0, sizeof none);
+ swarm_entry_open(u, e);
+ return none;
+ }
return pod_nav_act(&u->nav, &u->model, POD_A_INBOX, 0, now_ms); // the toast opens Notices, which lists the entry
}
@@ -361,6 +374,21 @@ static bool sup_push(pod_ui_t *u, const char *t, const char *tab, const char *le
return true;
}
+// A tap on a Swarm chat's notice (its toast or its Notices row): read the entry and open that Lead's view, the desktop told to select it. Not Notices.
+static void swarm_entry_open(pod_ui_t *u, const pod_unread_t *e)
+{
+ char tab[ID_MAX], lead[ID_MAX], chat[ID_MAX];
+ pod_copy_str(tab, sizeof tab, e->tab); // the read drops the entry
+ pod_copy_str(lead, sizeof lead, e->agent);
+ pod_copy_str(chat, sizeof chat, e->chat_id);
+ pod_model_swarm_notice_read(&u->model, tab, lead, chat);
+ if (pod_nav_follow_lead(&u->nav, &u->model, tab, lead)) {
+ sup_push(u, "supertab.select", tab, lead);
+ u->scroll_px = 0;
+ }
+ u->dirty = true;
+}
+
// A Notices row whose harness is a Swarm's local Lead: read the entry and open that Lead's view the way supertab.focus does (over Home, on the Swarm's card), the
// desktop told to select it. Not the plain agent: agent.open would make the desktop open the Lead's harness in a new tab. False when no Swarm leads from it.
static bool notice_lead(pod_ui_t *u, const char *agent_id)
@@ -599,6 +627,7 @@ pod_out_t pod_ui_touch(pod_ui_t *u, bool down, int x, int y, uint32_t now_ms, bo
}
}
if (arg == -1 && u->hit.id[0]) { *changed = true; return none; } // what it named is gone: redraw, open nothing
+ if (u->hit.action == POD_A_OPEN_NOTIF && arg >= 0 && arg < u->model.unread_count && u->model.unread[arg].tab[0]) { swarm_entry_open(u, &u->model.unread[arg]); *changed = true; return none; }
if (u->hit.action == POD_A_OPEN_NOTIF && arg >= 0 && arg < u->model.unread_count && notice_lead(u, u->model.unread[arg].agent)) { *changed = true; return none; }
if (u->hit.action == POD_A_TALK && u->nav.depth) { // an agent of an offline machine cannot be talked to: say why
const pod_agent_t *ag = pod_model_find(&u->model, top(u)->agent);
@@ -913,6 +942,7 @@ bool pod_ui_notify_text(pod_ui_t *u, const char *agent_id, pod_tier_t tier, cons
const bool room = t && (t->view == POD_V_AGENT || t->view == POD_V_RECAP);
if (room && strcmp(t->agent, a->id)) {
pod_copy_str(u->ban_agent, sizeof u->ban_agent, a->id);
+ u->ban_tab[0] = 0;
u->ban_until = now_ms + POD_TOAST_MS;
u->ban_on = true;
u->ban_stay = question && pod_model_attention(&u->model, a) != POD_ATTN_NONE; // a Super Tab's question waits for you
@@ -921,7 +951,37 @@ bool pod_ui_notify_text(pod_ui_t *u, const char *agent_id, pod_tier_t tier, cons
return tier == POD_TIER_ALERT;
}
-void pod_ui_notif_begin(pod_ui_t *u) { pod_model_unread_clear(&u->model); }
+bool pod_ui_swarm_notice(pod_ui_t *u, const char *tab, const char *lead, const char *chat_id, const char *text, bool awake, uint32_t now_ms)
+{
+ pod_model_clock(&u->model, now_ms);
+ const pod_swarm_t *sw = pod_model_swarm(&u->model, tab);
+ if (!sw || pod_model_lead_index(sw, lead) < 0) return false;
+ const pod_frame_t *t = top(u);
+ pod_model_swarm_notice(&u->model, sw->id, lead, chat_id, text, now_ms); // filed first, so a seen one also replaces this Lead's older row
+ const pod_lead_t *face = awake && t && t->view == POD_V_LEAD && !strcmp(t->swarm, sw->id) && !strcmp(t->lead_id, lead) ? &sw->leads[pod_model_lead_index(sw, lead)] : NULL;
+ if (face && !strcmp(face->chat_id, chat_id ? chat_id : "")) { // the face shows that very chat: seen at once
+ pod_ui_swarm_notice_read(u, sw->id, lead, chat_id);
+ return false;
+ }
+ u->dirty = true;
+ if (!pod_ui_talking(u) && !u->ota && t && (t->view == POD_V_AGENT || t->view == POD_V_RECAP || t->view == POD_V_LEAD)) {
+ pod_copy_str(u->ban_agent, sizeof u->ban_agent, lead);
+ pod_copy_str(u->ban_tab, sizeof u->ban_tab, sw->id);
+ u->ban_until = now_ms + POD_TOAST_MS;
+ u->ban_on = true;
+ u->ban_stay = false;
+ }
+ return true;
+}
+
+void pod_ui_swarm_notice_read(pod_ui_t *u, const char *tab, const char *lead, const char *chat_id)
+{
+ if (!pod_model_swarm_notice_read(&u->model, tab, lead, chat_id)) return;
+ if (u->ban_on && !strcmp(u->ban_tab, tab) && !strcmp(u->ban_agent, lead)) u->ban_on = false;
+ u->dirty = true;
+}
+
+void pod_ui_notif_begin(pod_ui_t *u) { pod_model_unread_clear_agents(&u->model); } // notif.replace lists only the harness entries: a Swarm notice stays
void pod_ui_notif_row(pod_ui_t *u, const char *agent_id, const char *name, const char *token, const char *summary, uint32_t now_ms)
{
@@ -942,21 +1002,47 @@ int pod_ui_take_reads(pod_ui_t *u, pod_read_out_t out[], int max) { return pod_m
// ---- the Swarm cards: following the desktop, and what the daemon is told ---------------------------------------------
-// supertab.focus (the model's focus_pending): open that Lead's recap the way a host focus opens an agent. Dropped, not kept, while recording or updating or when the
-// person is driving (a touch within the quiet window, a finger down); a Lead the Swarm list does not hold yet waits POD_FOLLOW_PENDING_MS for it.
+// The Lead a focus names: itself, or for an empty one (the desktop opened the Swarm with no project) the Lead last on screen in that Swarm while it is still
+// there, else the Swarm's first. NULL when the Swarm or the Lead is not in the model (yet).
+static const char *focus_lead_of(const pod_ui_t *u)
+{
+ const pod_model_t *m = &u->model;
+ const pod_swarm_t *sw = pod_model_swarm(m, m->focus_tab);
+ if (m->focus_lead[0]) return pod_model_lead_index(sw, m->focus_lead) < 0 ? NULL : m->focus_lead;
+ if (!sw || sw->lead_n == 0) return NULL;
+ for (int i = 0; i < SWARMS_CARD_MAX; i++)
+ if (!strcmp(u->lead_seen[i].swarm, sw->id) && pod_model_lead_index(sw, u->lead_seen[i].lead) >= 0) return u->lead_seen[i].lead;
+ return sw->leads[0].id;
+}
+
+// Remember the Lead on screen in its Swarm: that Swarm's slot, else the first free one, else (all used) the oldest, slots being taken in turn.
+static void lead_seen_note(pod_ui_t *u, const char *swarm, const char *lead)
+{
+ int k = -1;
+ for (int i = 0; i < SWARMS_CARD_MAX && k < 0; i++) if (!strcmp(u->lead_seen[i].swarm, swarm)) k = i;
+ for (int i = 0; i < SWARMS_CARD_MAX && k < 0; i++) if (!u->lead_seen[i].swarm[0]) k = i;
+ if (k < 0) { k = u->lead_seen_next; u->lead_seen_next = (uint8_t)((k + 1) % SWARMS_CARD_MAX); }
+ pod_copy_str(u->lead_seen[k].swarm, ID_MAX, swarm);
+ pod_copy_str(u->lead_seen[k].lead, ID_MAX, lead);
+}
+
+// supertab.focus (the model's focus_pending): open that Lead's recap the way a host focus opens an agent; an empty Lead opens the Swarm on the Lead last shown
+// there, else its first. Dropped, not kept, while recording or updating or when the person is driving (a touch within the quiet window, a finger down); a Lead
+// (or Swarm) the Swarm list does not hold yet waits POD_FOLLOW_PENDING_MS for it.
static void apply_lead_focus(pod_ui_t *u)
{
pod_model_t *m = &u->model;
if (!m->focus_pending) return;
const uint32_t now_ms = m->clock_ms;
if (!u->lead_wait) { u->lead_wait = true; u->lead_wait_ms = now_ms; }
- if (pod_model_lead_index(pod_model_swarm(m, m->focus_tab), m->focus_lead) < 0) {
+ const char *want = focus_lead_of(u);
+ if (!want) {
if ((int32_t)(now_ms - u->lead_wait_ms) > (int32_t)POD_FOLLOW_PENDING_MS) { m->focus_pending = false; u->lead_wait = false; }
return;
}
char tab[ID_MAX], lead[ID_MAX];
memcpy(tab, m->focus_tab, ID_MAX);
- memcpy(lead, m->focus_lead, ID_MAX);
+ memcpy(lead, want, ID_MAX);
m->focus_pending = false;
u->lead_wait = false;
if (pod_ui_talking(u) || u->ota || u->down) return;
@@ -979,6 +1065,7 @@ static void sup_sync(pod_ui_t *u)
const pod_swarm_t *sw = NULL;
const pod_lead_t *l = on ? pod_nav_lead(&u->nav, m, &sw) : NULL;
if (on && !l) return; // its Lead is not in the model (yet): neither open nor closed, wait for it
+ if (l) lead_seen_note(u, sw->id, l->id);
const char *lead = l ? l->id : "";
if (!strcmp(u->sup_lead, lead) && (!l || !strcmp(u->sup_tab, sw->id))) { // already what the daemon was told: a frame that may have been lost is re-sent
if (!l) { // nothing open: a close the link dropped goes again
@@ -986,6 +1073,14 @@ static void sup_sync(pod_ui_t *u)
return;
}
const uint32_t now_ms = m->clock_ms;
+ if (l->recap == POD_RECAP_LOADING && strcmp(u->sup_chat, l->chat_id) && u->sup_qn + 2 <= POD_SUPERTAB_OUT_MAX) { // the chat switched: ask for its message at once
+ u->sup_tries = 0;
+ sup_push(u, "supertab.open", sw->id, lead);
+ sup_push(u, "supertab.recap.get", sw->id, lead);
+ pod_copy_str(u->sup_chat, sizeof u->sup_chat, l->chat_id);
+ u->sup_at = now_ms;
+ return;
+ }
if ((uint32_t)(now_ms - u->sup_at) < POD_SUPERTAB_RETRY_MS || u->sup_qn + 2 > POD_SUPERTAB_OUT_MAX) return;
if (l->recap == POD_RECAP_LOADING) { // no reply yet: ask again, a few times; then the "…" stays and nothing more is sent
if (u->sup_tries >= POD_SUPERTAB_RETRIES) return;
@@ -1003,7 +1098,7 @@ static void sup_sync(pod_ui_t *u)
if (!l) { // closed: the frame still names the Swarm it was open in
if (!sup_push(u, "supertab.open", u->sup_tab, "")) return; // no room: still open as far as the daemon knows, the next sync closes it
if (u->sup_lead[0]) pod_model_supertab_close(m, u->sup_tab, u->sup_lead); // only the open Lead is pushed to: a closed one's text would go stale
- u->sup_tab[0] = u->sup_lead[0] = 0;
+ u->sup_tab[0] = u->sup_lead[0] = u->sup_chat[0] = 0;
return;
}
const char *tab = sw->id;
@@ -1017,6 +1112,7 @@ static void sup_sync(pod_ui_t *u)
}
pod_copy_str(u->sup_tab, sizeof u->sup_tab, tab);
pod_copy_str(u->sup_lead, sizeof u->sup_lead, lead);
+ pod_copy_str(u->sup_chat, sizeof u->sup_chat, l->chat_id);
u->sup_close[0] = 0; // the open replaces any close still owed
u->sup_at = m->clock_ms;
u->sup_tries = 0;
diff --git a/devices/harness-pro/firmware/main/app/pod_glue.h b/devices/harness-pro/firmware/main/app/pod_glue.h
index db82ce927..845b0396c 100644
--- a/devices/harness-pro/firmware/main/app/pod_glue.h
+++ b/devices/harness-pro/firmware/main/app/pod_glue.h
@@ -58,6 +58,7 @@ typedef struct {
// ban_stay: a Super Tab question's toast (pod_model_attention), which does not run out: it goes when swiped up, when the question
// closes (its entry goes) or once Notices is on screen; ban_until then only dates its slide-in.
char ban_agent[ID_MAX];
+ char ban_tab[ID_MAX]; // a Swarm chat's notice (pod_ui_swarm_notice): the Swarm it is from, with ban_agent = the Lead; "" for an agent's
uint32_t ban_until;
bool ban_on, ban_touch, ban_stay;
// player.library sweep: see pod_ui_sweep_*.
@@ -96,6 +97,9 @@ typedef struct {
// The Swarm cards' Lead view (see pod_ui_take_supertab): the Lead the daemon was last told is open (empty: none), the frames waiting to go, and when a
// supertab.focus began waiting for its Swarm list.
char sup_tab[ID_MAX], sup_lead[ID_MAX];
+ char sup_chat[ID_MAX]; // the open Lead's chat_id when open + recap.get were last pushed for it: a different one asks again at once
+ struct { char swarm[ID_MAX], lead[ID_MAX]; } lead_seen[SWARMS_CARD_MAX]; // the Lead last on screen in each Swarm
+ uint8_t lead_seen_next; // the slot a new Swarm takes once all are used: the oldest, as slots fill in order
char sup_close[ID_MAX]; // a "closed" frame the link dropped, owed for this Swarm until sent (empty: none), unless a Lead opens first
pod_supertab_out_t sup_q[POD_SUPERTAB_OUT_MAX];
uint8_t sup_qn;
@@ -129,7 +133,7 @@ pod_out_t pod_ui_turn_stats(pod_ui_t *, const char *id, int32_t passed, int32_t
// The Swarm cards: the model's lists (pod_model_supertab_ids / _supertab / _recap / _focus) behind the same sync as every feed.
pod_out_t pod_ui_supertab_ids(pod_ui_t *, const char (*ids)[ID_MAX], int n);
pod_out_t pod_ui_supertab(pod_ui_t *, const pod_swarm_t *s, uint32_t now_ms);
-pod_out_t pod_ui_supertab_recap(pod_ui_t *, const char *tab, const char *lead, const char *text, uint32_t at, bool none);
+pod_out_t pod_ui_supertab_recap(pod_ui_t *, const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t at, bool none);
pod_out_t pod_ui_supertab_focus(pod_ui_t *, const char *tab, const char *lead, uint32_t now_ms); // now_ms: the quiet-window and waiting clocks, as pod_ui_focus's
pod_out_t pod_ui_question(pod_ui_t *, const char *id, const char *text, const char *super_tab, pod_attention_t attention);
// The daemon took a recording for this agent (voice.result): Working now, before its turn starts (pod_model_sent).
@@ -210,6 +214,12 @@ uint32_t pod_ui_banner_shown_ms(const pod_ui_t *);
// question closes).
bool pod_ui_notify_text(pod_ui_t *, const char *agent_id, pod_tier_t tier, const char *text, bool question, bool awake, uint32_t now_ms);
bool pod_ui_notify(pod_ui_t *, const char *agent_id, pod_tier_t tier, bool awake, uint32_t now_ms);
+// A Swarm chat's notice (supertab.notice), the alert tier: files the entry (one per Lead, the newest) and toasts over a room or another Lead's view; a tap on the toast
+// or on its Notices row opens that Lead (and selects it on the desktop) instead of Notices. Returns true when the caller must wake the glass and beep. Nothing
+// is filed for a Swarm or Lead the model does not hold. If that Lead's own view is on screen and the glass is lit, it is read at once: no entry, no toast, false.
+// The read (supertab.notice.read) drops the entry of that chat only, and ends its toast if that is the one showing.
+bool pod_ui_swarm_notice(pod_ui_t *, const char *tab, const char *lead, const char *chat_id, const char *text, bool awake, uint32_t now_ms);
+void pod_ui_swarm_notice_read(pod_ui_t *, const char *tab, const char *lead, const char *chat_id);
// notif.replace: begin (clears the list), one row per item, end. The toast is not shown for these.
void pod_ui_notif_begin(pod_ui_t *);
void pod_ui_notif_row(pod_ui_t *, const char *agent_id, const char *name, const char *token, const char *summary, uint32_t now_ms);
diff --git a/devices/harness-pro/firmware/main/app/pro_app.c b/devices/harness-pro/firmware/main/app/pro_app.c
index 0f4a50600..b78d84c6e 100644
--- a/devices/harness-pro/firmware/main/app/pro_app.c
+++ b/devices/harness-pro/firmware/main/app/pro_app.c
@@ -388,10 +388,10 @@ void pro_app_supertab(const pod_swarm_t *sw)
leave();
}
-void pro_app_supertab_recap(const char *tab, const char *lead, const char *text, uint32_t at, bool none)
+void pro_app_supertab_recap(const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t at, bool none)
{
pro_app_lock();
- settle(pod_ui_supertab_recap(&s_pod, tab, lead, text, at, none));
+ settle(pod_ui_supertab_recap(&s_pod, tab, lead, chat_id, text, at, none));
leave();
}
@@ -402,6 +402,23 @@ void pro_app_supertab_focus(const char *tab, const char *lead)
leave();
}
+void pro_app_supertab_notice(const char *tab, const char *lead, const char *chat, const char *chat_id, const char *text)
+{
+ if (chat && !strcmp(chat, "buddy")) return; // the Buddy's quiet notice is a dot on its button, not a row or a toast
+ pro_app_lock();
+ if (pod_ui_swarm_notice(&s_pod, tab, lead, chat_id, text, !pro_app_asleep(), ms())) alert_locked();
+ settle((pod_out_t){0});
+ leave();
+}
+
+void pro_app_supertab_notice_read(const char *tab, const char *lead, const char *chat_id)
+{
+ pro_app_lock();
+ pod_ui_swarm_notice_read(&s_pod, tab, lead, chat_id);
+ settle((pod_out_t){0});
+ leave();
+}
+
_Static_assert(sizeof(pro_library_row_t) == sizeof(pod_library_row_t) &&
offsetof(pro_library_row_t, id) == offsetof(pod_library_row_t, id) &&
offsetof(pro_library_row_t, name) == offsetof(pod_library_row_t, name) &&
diff --git a/devices/harness-pro/firmware/main/cable/cable_types.h b/devices/harness-pro/firmware/main/cable/cable_types.h
index 2a7d86f90..c8836de57 100644
--- a/devices/harness-pro/firmware/main/cable/cable_types.h
+++ b/devices/harness-pro/firmware/main/cable/cable_types.h
@@ -75,11 +75,14 @@ typedef struct {
*/
enum { SWARMS_CARD_MAX = 16, SWARM_LEADS_MAX = 12, SWARM_TEXT_MAX = 1501 }; // text: 1,500 bytes + NUL
typedef enum { POD_LEAD_ASK, POD_LEAD_STUCK, POD_LEAD_WORK, POD_LEAD_DONE } pod_lead_state_t; // needs you, stuck, working, done
+typedef enum { POD_CHAT_NONE, POD_CHAT_LEAD, POD_CHAT_PM, POD_CHAT_GROUP, POD_CHAT_BUDDY } pod_chat_t; // the chat the Lead's face shows
typedef enum { POD_RECAP_NONE, POD_RECAP_LOADING, POD_RECAP_LOADED, POD_RECAP_EMPTY } pod_recap_state_t;
typedef struct {
char id[ID_MAX], projectId[ID_MAX], project[49], engine[16], owner[49], local[ID_MAX]; // owner: another person's machine; local: the harness to talk to
pod_lead_state_t state;
uint32_t since_s, since_at_ms; // seconds into the turn when the frame arrived (local Lead in a turn), and the device clock then
+ pod_chat_t chat; // NONE: the frame named no chat (an older daemon): today's Lead view
+ char chat_id[ID_MAX], chat_name[49]; // chat_name as project: 48 bytes + NUL, cut on a codepoint
pod_recap_state_t recap;
char *text; // the Lead's last message, PSRAM, owned by the model (NULL unless LOADED); the cable side leaves it NULL
uint32_t text_at; // when it was written (epoch seconds)
diff --git a/devices/harness-pro/firmware/main/cable/pro_cable.c b/devices/harness-pro/firmware/main/cable/pro_cable.c
index bf0d88bbb..795aec53c 100644
--- a/devices/harness-pro/firmware/main/cable/pro_cable.c
+++ b/devices/harness-pro/firmware/main/cable/pro_cable.c
@@ -229,6 +229,7 @@ static void send_hello(void)
msg_string(&root, "player", "library-v1");
msg_string(&root, "superTab", "wait-v1"); // a question with superTab + attention is shown as a wait (handle_question)
msg_string(&root, "swarmCard", "v1"); // supertabs / supertab.recap / supertab.focus: the Swarm cards (handle_supertab)
+ msg_string(&root, "swarmChat", "v1"); // each Lead's face chat (chat, chatId, chatName), recaps by chatId, supertab.notice / .read; voice stays in the Lead conversation (cable.md)
msg_string(&root, "ota", "v1");
char mac[24] = "";
device_mac_str(mac, sizeof(mac));
@@ -593,6 +594,12 @@ static void read_leads(const cJSON *it, pod_swarm_t *sw)
ld->state = lead_state(str_of(l, "state"));
const cJSON *since = cJSON_GetObjectItemCaseSensitive(l, "since");
if (cJSON_IsNumber(since) && since->valuedouble > 0) ld->since_s = since->valuedouble > 2592000 ? 2592000u : (uint32_t)since->valuedouble;
+ const char *chat = str_of(l, "chat");
+ if (chat) ld->chat = !strcmp(chat, "lead") ? POD_CHAT_LEAD : !strcmp(chat, "pm") ? POD_CHAT_PM :
+ !strcmp(chat, "group") ? POD_CHAT_GROUP : !strcmp(chat, "buddy") ? POD_CHAT_BUDDY : POD_CHAT_NONE;
+ const char *cid = str_of(l, "chatId");
+ if (cid && strlen(cid) < sizeof ld->chat_id) snprintf(ld->chat_id, sizeof ld->chat_id, "%s", cid); // whole or none
+ cut_of(l, "chatName", ld->chat_name, sizeof ld->chat_name);
ld->recap = POD_RECAP_NONE;
}
}
@@ -635,30 +642,62 @@ static void handle_supertab(const cJSON *p)
// `supertab.recap`: one Lead's last message, cut to 1,500 bytes on a UTF-8 boundary. `none` (or no text) is "No message yet".
static void handle_supertab_recap(const cJSON *p)
{
- char tab[ID_MAX], lead[ID_MAX];
- const char *t = str_of(p, "tab"), *l = str_of(p, "lead");
+ char tab[ID_MAX], lead[ID_MAX], chat_id[ID_MAX];
+ const char *t = str_of(p, "tab"), *l = str_of(p, "lead"), *c = str_of(p, "chatId");
if (!id_fits(t) || !id_fits(l)) return;
snprintf(tab, sizeof tab, "%s", t);
snprintf(lead, sizeof lead, "%s", l);
+ snprintf(chat_id, sizeof chat_id, "%s", c && strlen(c) < sizeof chat_id ? c : ""); // whole or none
const cJSON *none = cJSON_GetObjectItemCaseSensitive(p, "none"), *at = cJSON_GetObjectItemCaseSensitive(p, "at");
const char *text = cut_of(p, "text", s_card_text, sizeof s_card_text);
if (!text) s_card_text[0] = 0;
const bool empty = cJSON_IsTrue(none);
if (empty) s_card_text[0] = 0;
const double secs = cJSON_IsNumber(at) && at->valuedouble > 0 ? at->valuedouble : 0;
- pro_app_supertab_recap(tab, lead, s_card_text, secs > 4294967295.0 ? 0xFFFFFFFFu : (uint32_t)secs, empty);
+ pro_app_supertab_recap(tab, lead, chat_id, s_card_text, secs > 4294967295.0 ? 0xFFFFFFFFu : (uint32_t)secs, empty);
}
+// `supertab.focus`: the desktop opened that Swarm's project. An empty or missing `lead` (a Swarm tab with no project open) is kept, meaning "the Lead
+// last shown there, else its first"; a `lead` that is present but too long is ignored, as is a missing `tab`.
static void handle_supertab_focus(const cJSON *p)
{
char tab[ID_MAX], lead[ID_MAX];
const char *t = str_of(p, "tab"), *l = str_of(p, "lead");
- if (!id_fits(t) || !id_fits(l)) return;
+ if (!l && cJSON_GetObjectItemCaseSensitive(p, "lead")) return; // present but not a string: dropped, not read as "open the Swarm"
+ if (!id_fits(t) || (l && *l && !id_fits(l))) return;
+ if (!l) l = "";
snprintf(tab, sizeof tab, "%s", t);
snprintf(lead, sizeof lead, "%s", l);
pro_app_supertab_focus(tab, lead);
}
+// supertab.notice / supertab.notice.read: a Swarm chat's new message, and that chat read on the desktop. The ids must fit; a frame with a bad one is dropped
+// (chatId may be empty: an older daemon names none, and the read then matches the same).
+static bool notice_ids(const cJSON *p, char tab[ID_MAX], char lead[ID_MAX], char chat_id[ID_MAX])
+{
+ const char *t = str_of(p, "tab"), *l = str_of(p, "lead"), *c = str_of(p, "chatId");
+ if (!id_fits(t) || !id_fits(l) || (c && strlen(c) >= ID_MAX)) return false;
+ snprintf(tab, ID_MAX, "%s", t);
+ snprintf(lead, ID_MAX, "%s", l);
+ snprintf(chat_id, ID_MAX, "%s", c ? c : "");
+ return true;
+}
+
+static void handle_supertab_notice(const cJSON *p)
+{
+ char tab[ID_MAX], lead[ID_MAX], chat_id[ID_MAX], chat[16], text[POD_UNREAD_TEXT];
+ if (!notice_ids(p, tab, lead, chat_id)) return;
+ copy_cut(chat, sizeof chat, str_of(p, "chat") ? str_of(p, "chat") : "");
+ copy_cut(text, sizeof text, str_of(p, "text") ? str_of(p, "text") : "");
+ pro_app_supertab_notice(tab, lead, chat, chat_id, text);
+}
+
+static void handle_supertab_notice_read(const cJSON *p)
+{
+ char tab[ID_MAX], lead[ID_MAX], chat_id[ID_MAX];
+ if (notice_ids(p, tab, lead, chat_id)) pro_app_supertab_notice_read(tab, lead, chat_id);
+}
+
// ── the machine list ────────────────────────────────────────────────────────────────────────────────
// Streamed like the agents. cable_machines_end() answers "did anything change" before pro_app is touched, so the
// daemon re-sending an identical list (its own diff key resets on every port reopen) costs one comparison.
@@ -1016,6 +1055,8 @@ static void handle_message(const cJSON *root)
if (!strcmp(t, "supertab")) { handle_supertab(p); return; }
if (!strcmp(t, "supertab.recap")) { handle_supertab_recap(p); return; }
if (!strcmp(t, "supertab.focus")) { handle_supertab_focus(p); return; }
+ if (!strcmp(t, "supertab.notice")) { handle_supertab_notice(p); return; }
+ if (!strcmp(t, "supertab.notice.read")) { handle_supertab_notice_read(p); return; }
if (!strcmp(t, "player.library")) { handle_library(p); return; }
if (!strcmp(t, "player.context")) { handle_context(p); return; }
if (!strcmp(t, "settings.set")) { handle_settings_set(p); return; }
diff --git a/devices/harness-pro/firmware/main/pod/home/ph_inbox.c b/devices/harness-pro/firmware/main/pod/home/ph_inbox.c
index d0d2460f5..9b907045e 100644
--- a/devices/harness-pro/firmware/main/pod/home/ph_inbox.c
+++ b/devices/harness-pro/firmware/main/pod/home/ph_inbox.c
@@ -9,6 +9,8 @@
// (amber #FFB340 / red #FF5C5C: the bubble less a copy of itself 6 px to the right, so it follows the corners; the tail, here a whole turned square,
// is drawn over it as in the mockup), and on the avatar's bottom right corner a 40 px badge (#3B2E55, radius 12, a 3 px ring of the room's ground)
// holding a diamond 16 px across in the room's ink (two triangles; the mockup's ◆ inherits that colour).
+// A Swarm chat's notice (an entry with `tab`; owner's mockup pro-swarm-parity 1E) is a plain row with that same name line, "<project> · <Swarm name>" in purple,
+// the Lead's pet as the avatar, and none of the question's marks (no edge, no badge); the Swarm gone from the model: no tag. A tap is POD_A_OPEN_NOTIF by the Lead's id.
#include <stdio.h>
#include <string.h>
@@ -32,6 +34,14 @@ static const ht_pro_font_t *const MSG = &ph_sb_32, *const META_F = &ph_sb_22;
typedef struct { const pod_agent_t *a; const pod_unread_t *u; int unread_index; } item_t;
+// A Swarm chat's notice names no agent (its `agent` is a Lead's id, which no roster row owns): the Lead and its Swarm, either NULL when gone.
+static const pod_swarm_t *notice_swarm(const pod_model_t *m, const pod_unread_t *u) { return u && u->tab[0] ? pod_model_swarm(m, u->tab) : NULL; }
+static const pod_lead_t *notice_lead(const pod_swarm_t *sw, const pod_unread_t *u)
+{
+ const int j = sw ? pod_model_lead_index(sw, u->agent) : -1;
+ return j < 0 ? NULL : &sw->leads[j];
+}
+
static int collect(const pod_model_t *m, item_t out[MAX_ITEMS])
{
int n = 0;
@@ -39,7 +49,7 @@ static int collect(const pod_model_t *m, item_t out[MAX_ITEMS])
if (pod_model_eff(m, &m->agents[i]) == POD_ASKING) out[n++] = (item_t){&m->agents[i], NULL, -1};
const int first = n;
for (int i = 0; i < m->unread_count && n < MAX_ITEMS; i++) {
- const pod_agent_t *ag = pod_model_find(m, m->unread[i].agent);
+ const pod_agent_t *ag = m->unread[i].tab[0] ? NULL : pod_model_find(m, m->unread[i].agent);
if (ag && pod_model_eff(m, ag) == POD_ASKING) continue; // it is listed above by its question; the entry waits for when it stops asking
out[n++] = (item_t){ag, &m->unread[i], i};
}
@@ -73,7 +83,8 @@ int ph_notices_top(const pod_model_t *m, int max, ph_notice_line_t *out)
const int n = collect(m, it);
int k = 0;
for (; k < n && k < max; k++) {
- out[k].engine = it[k].a ? it[k].a->engine : NULL;
+ const pod_lead_t *ld = it[k].u ? notice_lead(notice_swarm(m, it[k].u), it[k].u) : NULL;
+ out[k].engine = it[k].a ? it[k].a->engine : ld ? ld->engine : NULL;
out[k].name = it[k].a ? it[k].a->name : it[k].u ? it[k].u->name : "";
item_line(&it[k], out[k].text, sizeof out[k].text);
}
@@ -124,13 +135,15 @@ static void row(pod_out_frame_t *f, const pod_model_t *m, const item_t *it, int
ht_scene_t *s = f->scene;
const pod_agent_t *a = it->a;
char text[POD_UNREAD_TEXT > 320 ? POD_UNREAD_TEXT : 320], rows[3][POD_ROW_MAX], age[12];
- const char *name;
+ const char *name, *engine = a ? a->engine : NULL;
+ const pod_swarm_t *sw = notice_swarm(m, it->u); // a Swarm chat's notice: the Lead's pet and "· <Swarm name>"
const pod_attention_t attn = it->u ? POD_ATTN_NONE : pod_model_attention(m, a);
if (it->u) {
ph_first_sentence(text, sizeof text, it->u->text);
int32_t d = (int32_t)(m->clock_ms - it->u->at_ms);
pod_fmt_age(age, sizeof age, d > 0 ? (uint32_t)d / 1000 : 0);
name = a && a->name[0] ? a->name : it->u->name[0] ? it->u->name : "Agent";
+ if (it->u->tab[0]) { const pod_lead_t *ld = notice_lead(sw, it->u); engine = ld ? ld->engine : NULL; }
} else {
snprintf(text, sizeof text, "%s", a->question);
for (char *c = text; *c; c++) if (*c == '\n' || *c == '\r' || *c == '\t') *c = ' ';
@@ -141,7 +154,7 @@ static void row(pod_out_frame_t *f, const pod_model_t *m, const item_t *it, int
const int h = PAD_TOP + NAME_H + 4 + n * MSG_PITCH + PAD_BOT;
ht_pro_rect_aa(s, AV_X, y + AV_Y, AV, AV, 28, C(AV_FILL));
- face_art(s, AV_X + AV / 2, y + AV_Y + AV / 2, a ? a->engine : NULL);
+ face_art(s, AV_X + AV / 2, y + AV_Y + AV / 2, engine);
if (attn != POD_ATTN_NONE) { // the Super Tab badge: a ring of the ground, the purple square, the white diamond
const int bx = AV_X + AV + BADGE_OUT - BADGE, by = y + AV_Y + AV + BADGE_OUT - BADGE, cx = bx + BADGE / 2, cy = by + BADGE / 2;
ht_pro_rect_aa(s, bx, by, BADGE, BADGE, BADGE_R, C(BG));
@@ -162,8 +175,8 @@ static void row(pod_out_frame_t *f, const pod_model_t *m, const item_t *it, int
int aw = ht_pro_width(META_F, age), nw = ht_pro_width(META_F, name), room = tw - aw - 16;
char tag[SUPER_TAB_MAX + 4] = "";
int gw = 0;
- if (attn != POD_ATTN_NONE) { // "name · Super Tab": the name keeps at least half the room, the Super Tab the rest (cut with dots)
- snprintf(tag, sizeof tag, "\xc2\xb7 %s", a->super_tab);
+ if (attn != POD_ATTN_NONE || sw) { // "name · Super Tab" (a Swarm's notice: "project · Swarm"): the name keeps at least half the room, the tag the rest (cut with dots)
+ snprintf(tag, sizeof tag, "\xc2\xb7 %s", sw ? sw->name : a->super_tab);
const int want = ht_pro_width(META_F, tag);
int keep = room - TAG_GAP - want; // what the name may take beside the whole tag
if (keep < room / 2) keep = room / 2;
diff --git a/devices/harness-pro/firmware/main/pod/home/ph_lead.c b/devices/harness-pro/firmware/main/pod/home/ph_lead.c
index 1ae3b08f8..a0a83565b 100644
--- a/devices/harness-pro/firmware/main/pod/home/ph_lead.c
+++ b/devices/harness-pro/firmware/main/pod/home/ph_lead.c
@@ -1,5 +1,5 @@
// The Lead view (Swarm cards; the owner's mockup swarm-card.html B1-B3), built from ph_recap.c: a tap on a Lead's pet on the Swarm card opens the Lead's last
-// message in the Swarm chat. On the navy ground: the Swarm's name (small, purple) and the project (the title) centred at the top, then the message in the
+// message in the Swarm chat. On the navy ground: the Swarm's name (small, purple) and the project (the title) centred at the top, a PM or group chat the desktop has open named in a small muted line under the project (the bubble stays where it is), then the message in the
// paper bubble (x 60, 600 wide, top 150, only as tall as its text: 28 px above and below, 34 at the sides, rows 46 px apart), a tail under its bottom left and
// the "who" row: the Lead's pet (150 px box at x 16, the scene of its state: WORK, ASK, REST) with "Lead" (bold) and its status line in the status colour
// ("working . m:ss" green, "needs you" orange, "stuck" red, "done" grey), a remote Lead adding its owner in a smaller muted line.
@@ -23,7 +23,7 @@ enum { BG = PH_ROOM_BG, BX = 60, BW = 600, BY = 150, RAD = 34, PAD_X = 34, PAD_Y
EDGE = 8, EDGE_W = 120, // the inner edge: a rounded block of this width in the edge colour, the bubble drawn 8 px in over it
TAIL_CX = BX + 48 + 18, TAIL_HALF = 24, TAIL_DROP = 23,
ROW_GAP = 18, PET_X = 16, PET_SIDE = 150, PET_UP = 10, NAME_X = 160, NAME_MAX_X = 660, HEAD_W = 640,
- SW_CY = 42, PROJ_CY = 84, NOMSG_CY = 330,
+ SW_CY = 42, PROJ_CY = 84, CHAT_CY = 120, NOMSG_CY = 330,
EDGE_ASK = 0xFF9A52, EDGE_STUCK = 0xE5484D, SWARM_INK = 0xB79CFF }; // the mockup's #ff9a52 and a red; the Swarm name's purple
static const ht_pro_font_t *const FONT = &ph_rg_36;
@@ -141,6 +141,10 @@ void ph_view_lead(pod_out_frame_t *f, const pod_nav_t *nav, pod_model_t *m, uint
centred(s, SW_CY, &ph_sb_22, SWARM_INK, line);
fit_line(line, sizeof line, l->project, &ph_sb_34, HEAD_W);
centred(s, PROJ_CY, &ph_sb_34, PH_ROOM_INK, line);
+ if ((l->chat == POD_CHAT_PM || l->chat == POD_CHAT_GROUP) && l->chat_name[0]) { // the chat the desktop has open (a PM or a group; the Lead's own chat adds nothing)
+ fit_line(line, sizeof line, l->chat_name, &ph_sb_22, HEAD_W);
+ centred(s, CHAT_CY, &ph_sb_22, PH_ROOM_MUTED, line);
+ }
// The bubble: the text (loaded), "..." (loading) or nothing (no message yet, or not asked yet: the same "..." as loading)
const bool empty = l->recap == POD_RECAP_EMPTY, loaded = l->recap == POD_RECAP_LOADED;
diff --git a/devices/harness-pro/firmware/main/pod/home/ph_toast.c b/devices/harness-pro/firmware/main/pod/home/ph_toast.c
index f147e6669..21900a242 100644
--- a/devices/harness-pro/firmware/main/pod/home/ph_toast.c
+++ b/devices/harness-pro/firmware/main/pod/home/ph_toast.c
@@ -7,6 +7,8 @@
// run out: the name is followed, a 10 px gap on, by "· <Super Tab>" (ph_sb_22, #8EA3BD, centred on the name's line), the line is the question as asked,
// and in place of the timer a still bar fills the whole inset (no track): amber #FFB340 with a #6A4A1C edge for a decision, red #FF5C5C with a
// #6A2626 edge and the name in #FF8F8F for a stuck agent. The glue keeps it up until it is swiped away, the question closes or Notices opens.
+// A Swarm chat's notice (an entry with `tab`; mockup pro-swarm-parity 1D) takes the same name line, the Lead's project then "· <Swarm name>" (Swarm gone from the
+// model: no tag), the Lead's engine logo, and the normal running timer. The hit is the same POD_A_BANNER; the glue opens that Lead on a tap.
// One POD_A_BANNER hit over the card (the glue opens Notices on a tap, a swipe up dismisses it). At most 9 runs.
#include <stdio.h>
#include <string.h>
@@ -32,22 +34,24 @@ int ph_toast(pod_out_frame_t *f, const pod_model_t *m, const pod_unread_t *u, ui
const int e = 1000 - (int)((long)q * q * q / 1000000);
y = FROM_Y + (TY - FROM_Y) * e / 1000;
}
- const pod_agent_t *a = pod_model_find(m, u->agent);
+ const pod_swarm_t *sw = u->tab[0] ? pod_model_swarm(m, u->tab) : NULL;
+ const int lj = sw ? pod_model_lead_index(sw, u->agent) : -1;
+ const pod_agent_t *a = u->tab[0] ? NULL : pod_model_find(m, u->agent); // a Swarm notice's `agent` is a Lead's id, not a roster row
const pod_attention_t attn = u->ask ? pod_model_attention(m, a) : POD_ATTN_NONE; // a Super Tab's question: the toast stays
const bool stuck = attn == POD_ATTN_STUCK;
ht_pro_rect_aa(s, TX, y, TW, TH, TR, C(attn == POD_ATTN_NONE ? PH_TOAST_EDGE : stuck ? STUCK_EDGE : DECIDE_EDGE));
ht_pro_rect_aa(s, TX + EDGE, y + EDGE, TW - 2 * EDGE, TH - 2 * EDGE, TR - EDGE, C(PH_TOAST_FILL));
- ph_engine_logo(s, TX + PAD + (SLOT - LOGO) / 2, y + (TH - LOGO) / 2, LOGO, a ? a->engine : NULL, PH_TOAST_FILL);
+ ph_engine_logo(s, TX + PAD + (SLOT - LOGO) / 2, y + (TH - LOGO) / 2, LOGO, a ? a->engine : lj >= 0 ? sw->leads[lj].engine : NULL, PH_TOAST_FILL);
const int tx = TX + PAD + SLOT + GAP, tw = TX + TW - PAD - tx;
const char *name = a && a->name[0] ? a->name : u->name[0] ? u->name : "Agent";
char line[160];
ph_first_sentence(line, sizeof line, u->text);
if (!line[0]) snprintf(line, sizeof line, "%s", u->kind == POD_UNREAD_FAILED ? "Failed" : "Done");
- if (attn == POD_ATTN_NONE) {
+ if (attn == POD_ATTN_NONE && !sw) {
ph_text(s, tx, y + 42, tw, &ph_sb_26, PH_TOAST_NAME, name);
- } else { // "name · Super Tab": the name keeps at least half the line; the Super Tab takes what is left, cut with an ellipsis
+ } else { // "name · Super Tab" (a Swarm's notice: "project · Swarm"): the name keeps at least half the line; the tag takes what is left, cut with an ellipsis
char tag[SUPER_TAB_MAX + 4];
- snprintf(tag, sizeof tag, "\xc2\xb7 %s", a->super_tab);
+ snprintf(tag, sizeof tag, "\xc2\xb7 %s", sw ? sw->name : a->super_tab);
const int tagw = ht_pro_width(&ph_sb_22, tag), want = ht_pro_width(&ph_sb_26, name);
int nw = tw - TAG_GAP - tagw;
if (nw < tw / 2) nw = tw / 2;
diff --git a/devices/harness-pro/firmware/main/pod/pod_model.c b/devices/harness-pro/firmware/main/pod/pod_model.c
index eb87c557f..c0cfd36dc 100644
--- a/devices/harness-pro/firmware/main/pod/pod_model.c
+++ b/devices/harness-pro/firmware/main/pod/pod_model.c
@@ -767,6 +767,10 @@ void pod_model_supertab_ids(pod_model_t *m, const char (*ids)[ID_MAX], int n) {
if (!ids[i][0] || memchr(ids[i], 0, ID_MAX) == NULL || want_idx(m, ids[i]) >= 0) continue;
memcpy(m->want[m->want_n++], ids[i], ID_MAX);
}
+ // A Swarm off the list is access lost as often as not (removed from its project, signed out on the Mac), and no read frame comes: its Notices rows hold chat
+ // text and the project's name, so they go with it. A listed Swarm keeps its rows, its card here or not (the frame may be on its way).
+ for (int i = m->unread_count - 1; i >= 0; i--)
+ if (m->unread[i].tab[0] && want_idx(m, m->unread[i].tab) < 0) unread_drop(m, i);
int k = 0; // keep the listed ones, free the rest
for (int i = 0; i < m->swarm_n; i++) {
if (want_idx(m, m->swarms[i].id) < 0) {
@@ -815,6 +819,11 @@ void pod_model_supertab(pod_model_t *m, const pod_swarm_t *s, uint32_t now_ms) {
pod_lead_t *ol = &d->leads[k]; // taken over: the old copy no longer owns the text
carry[j].recap = ol->recap; carry[j].text = ol->text; carry[j].text_at = ol->text_at;
ol->text = NULL;
+ if (strcmp(ol->chat_id, s->leads[j].chat_id)) { // another chat: the old message is not its message
+ free(carry[j].text);
+ carry[j].text = NULL; carry[j].text_at = 0;
+ if (carry[j].recap != POD_RECAP_NONE) carry[j].recap = POD_RECAP_LOADING; // asked for (open): "…" until the daemon pushes the new chat's
+ }
}
for (int j = 0; j < d->lead_n; j++) lead_free_text(&d->leads[j]); // the ones that left
*d = *s;
@@ -827,14 +836,18 @@ void pod_model_supertab(pod_model_t *m, const pod_swarm_t *s, uint32_t now_ms) {
l->text_at = carry[j].text_at;
l->since_at_ms = now_ms;
}
+ // The same for a Lead that left this Swarm. The same id in another Swarm is another row's business.
+ for (int i = m->unread_count - 1; i >= 0; i--)
+ if (!strcmp(m->unread[i].tab, d->id) && pod_model_lead_index(d, m->unread[i].agent) < 0) unread_drop(m, i);
m->revision++;
}
-void pod_model_supertab_recap(pod_model_t *m, const char *tab, const char *lead, const char *text, uint32_t at, bool none) {
+void pod_model_supertab_recap(pod_model_t *m, const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t at, bool none) {
const pod_swarm_t *s = pod_model_swarm(m, tab);
const int j = pod_model_lead_index(s, lead);
if (j < 0) return;
pod_lead_t *l = &((pod_swarm_t *)s)->leads[j];
+ if (chat_id && chat_id[0] && l->chat_id[0] && strcmp(chat_id, l->chat_id)) return; // a reply for a chat the face has left (both name one)
if (l->recap == POD_RECAP_NONE) return; // a Lead nobody asked for or has left: a late reply would only sit there stale
lead_free_text(l);
l->text_at = at;
@@ -868,7 +881,7 @@ void pod_model_supertab_close(pod_model_t *m, const char *tab, const char *lead)
}
void pod_model_supertab_focus(pod_model_t *m, const char *tab, const char *lead) {
- if (!tab || !*tab || !lead || !*lead) return;
+ if (!tab || !*tab || !lead) return; // an empty lead is kept: the Swarm opens on the Lead last shown there
pod_copy_str(m->focus_tab, sizeof m->focus_tab, tab);
pod_copy_str(m->focus_lead, sizeof m->focus_lead, lead);
m->focus_pending = true;
@@ -999,6 +1012,26 @@ void pod_model_unread_ask(pod_model_t *m, const char *agent, const char *name, c
if (i >= 0) m->unread[i].ask = true;
}
+void pod_model_swarm_notice(pod_model_t *m, const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t now_ms) {
+ if (!tab || !*tab || !lead || !*lead) return;
+ const pod_swarm_t *sw = pod_model_swarm(m, tab);
+ const int j = pod_model_lead_index(sw, lead);
+ if (j < 0) return;
+ char project[CABLE_NAME_MAX];
+ pod_copy_str(project, sizeof project, sw->leads[j].project);
+ pod_model_unread_add(m, lead, project, text, -1, now_ms);
+ pod_unread_t *u = &m->unread[0]; // add puts it on top
+ pod_copy_str(u->tab, sizeof u->tab, sw->id);
+ pod_copy_str(u->chat_id, sizeof u->chat_id, chat_id);
+}
+
+bool pod_model_swarm_notice_read(pod_model_t *m, const char *tab, const char *lead, const char *chat_id) {
+ int i = unread_idx(m, lead);
+ if (i < 0 || !tab || strcmp(m->unread[i].tab, tab) || strcmp(m->unread[i].chat_id, chat_id ? chat_id : "")) return false;
+ unread_drop(m, i);
+ return true;
+}
+
int pod_notice_count(const pod_model_t *m) {
int n = 0;
for (int i = 0; i < m->agent_count; i++) n += pod_model_eff(m, &m->agents[i]) == POD_ASKING;
@@ -1014,6 +1047,14 @@ void pod_model_unread_clear(pod_model_t *m) {
m->revision++;
}
+void pod_model_unread_clear_agents(pod_model_t *m) { // a Swarm notice (tab set) is not in a notif.replace list: it stays
+ int k = 0;
+ for (int i = 0; i < m->unread_count; i++)
+ if (m->unread[i].tab[0]) m->unread[k++] = m->unread[i];
+ m->unread_count = k;
+ m->revision++;
+}
+
void pod_model_unread_append(pod_model_t *m, const char *agent, const char *name, const char *token, const char *text, uint32_t now_ms) {
if (!agent || !*agent || strnlen(agent, ID_MAX) >= ID_MAX || m->unread_count >= POD_UNREAD_MAX || unread_idx(m, agent) >= 0) return;
pod_model_clock(m, now_ms);
diff --git a/devices/harness-pro/firmware/main/pod/pod_model.h b/devices/harness-pro/firmware/main/pod/pod_model.h
index 75d6784d9..b806c7ed0 100644
--- a/devices/harness-pro/firmware/main/pod/pod_model.h
+++ b/devices/harness-pro/firmware/main/pod/pod_model.h
@@ -98,6 +98,7 @@ typedef struct {
typedef enum { POD_UNREAD_FINISHED, POD_UNREAD_FAILED } pod_unread_kind_t;
typedef struct {
char agent[ID_MAX], name[CABLE_NAME_MAX], token[POD_TOKEN_MAX], text[POD_UNREAD_TEXT];
+ char tab[ID_MAX], chat_id[ID_MAX]; // a Swarm chat's notice (tab set): agent = the Lead's id, name = its project, tab = the Swarm's id, chat_id = the chat it is about
bool ask; // filed by a question (not a finished turn): it goes when the question closes
pod_unread_kind_t kind; // FAILED when the agent's last turn ended in an error
uint32_t at_ms;
@@ -191,7 +192,7 @@ void pod_model_supertab_ids(pod_model_t *, const char (*ids)[ID_MAX], int n);
// keeps its recap state and text; the texts of Leads that left are freed. Stamps since_at_ms with now_ms. Ignored when the id is not in the list.
void pod_model_supertab(pod_model_t *, const pod_swarm_t *s, uint32_t now_ms);
// A Lead's last message: LOADED with a copy of `text` (cut to SWARM_TEXT_MAX - 1 on a codepoint), or EMPTY when `none`. Unknown Swarm/Lead: dropped.
-void pod_model_supertab_recap(pod_model_t *, const char *tab, const char *lead, const char *text, uint32_t at, bool none);
+void pod_model_supertab_recap(pod_model_t *, const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t at, bool none);
// The Lead view asks for / lets go of a Lead's last message: loading puts a cold one (NONE) to LOADING (the texts arrive as pod_model_supertab_recap);
// close sends a LOADING, LOADED or EMPTY one back to NONE and frees its text (only the open Lead gets pushes, so a closed one would go stale).
void pod_model_supertab_loading(pod_model_t *, const char *tab, const char *lead);
@@ -232,6 +233,7 @@ void pod_model_unread_add(pod_model_t *, const char *agent, const char *name, co
// The whole list at once (notif.replace): clear, then append in the order given (first = newest). One per agent, at most
// POD_UNREAD_MAX; an append past that or for an agent already listed is dropped.
void pod_model_unread_clear(pod_model_t *);
+void pod_model_unread_clear_agents(pod_model_t *); // as clear, but the Swarm notices stay
void pod_model_unread_append(pod_model_t *, const char *agent, const char *name, const char *token, const char *text, uint32_t now_ms);
// Read elsewhere (notif.seen): drop the agent's entry. With a token, only an entry that has that token or none. True if dropped.
bool pod_model_unread_seen(pod_model_t *, const char *agent, const char *token);
@@ -240,6 +242,11 @@ bool pod_model_unread_read(pod_model_t *, const char *agent);
const pod_unread_t *pod_model_unread_find(const pod_model_t *, const char *agent);
// How many notices Pets lists (the Notices screen and Home's Notices card): the asking agents, then the unread entries of agents that are not asking.
int pod_notice_count(const pod_model_t *);
+// A Swarm chat's notice (supertab.notice): an entry like an agent's, keyed by its Lead (one per Lead, the newest replacing, the 16 cap shared), named by the Lead's
+// project. Nothing is filed for a Swarm or Lead the model does not hold. The read drops only the entry of that tab, Lead AND chat (true when it did), so one that
+// arrives before its notice, or for another chat, leaves the row alone.
+void pod_model_swarm_notice(pod_model_t *, const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t now_ms);
+bool pod_model_swarm_notice_read(pod_model_t *, const char *tab, const char *lead, const char *chat_id);
// The entry of a question that was just asked (the toast needs one): like pod_model_unread_add, marked `ask`.
void pod_model_unread_ask(pod_model_t *, const char *agent, const char *name, const char *text, uint32_t now_ms);
// Take the queued notif.read frames (at most max); returns the count.
diff --git a/devices/harness-pro/firmware/main/pro_app_api.h b/devices/harness-pro/firmware/main/pro_app_api.h
index d4c0b64f9..d96c7bfc2 100644
--- a/devices/harness-pro/firmware/main/pro_app_api.h
+++ b/devices/harness-pro/firmware/main/pro_app_api.h
@@ -46,9 +46,15 @@ void pro_app_supertab_ids(const char (*ids)[ID_MAX], int n);
// when its id is not in the last id list. `since_at_ms` and every Lead's `text` are 0/NULL here: the model stamps the clock and keeps the cached texts.
void pro_app_supertab(const pod_swarm_t *s);
// `supertab.recap`: the Lead's last message (<= SWARM_TEXT_MAX - 1 bytes; "" when `none`), `at` its epoch seconds.
-void pro_app_supertab_recap(const char *tab, const char *lead, const char *text, uint32_t at, bool none);
-// `supertab.focus`: the desktop opened this Swarm project. Both ids are non-empty.
+void pro_app_supertab_recap(const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t at, bool none);
+// `supertab.focus`: the desktop opened this Swarm project. `tab` is non-empty; an empty `lead` (the desktop has the Swarm open with no project, e.g. its Chat with PM)
+// means the Lead last shown in that Swarm, else its first.
void pro_app_supertab_focus(const char *tab, const char *lead);
+// `supertab.notice`: a new message in one of that Lead's chats (`chat` "lead" | "pm" | "group" | "buddy"; `text` is cut to POD_UNREAD_TEXT). The alert tier of an agent's
+// notice: an entry, the toast, a wake and a beep. A Buddy's chat is ignored. `supertab.notice.read`: that chat was read on the desktop; its entry and toast go.
+// They also go when the Swarm leaves `supertabs` or the Lead leaves its Swarm: access lost sends no read.
+void pro_app_supertab_notice(const char *tab, const char *lead, const char *chat, const char *chat_id, const char *text);
+void pro_app_supertab_notice_read(const char *tab, const char *lead, const char *chat_id);
// ---- library ----
// Same layout as pod_library_row_t (pod_glue.h). `machine` is the machine NAME ("" when the machine list does not
diff --git a/devices/harness-pro/firmware/test/golden-liberation.txt b/devices/harness-pro/firmware/test/golden-liberation.txt
index 841d5259e..071896ffc 100644
--- a/devices/harness-pro/firmware/test/golden-liberation.txt
+++ b/devices/harness-pro/firmware/test/golden-liberation.txt
@@ -1,11 +1,13 @@
000f6304ad48675b64e6ebf526afe23fb4226d3c68c045bd67cac3edb57345fd talk:cur@5000
01535e909a381104ef05c14c3256b08e1ee0f64b8ad03b82467e1cde2c0a9386 recap:desk:short@0
+01aee5a032c20f0368cefcebbb472675cda822457a1443712ea7a1c9fbf5b7a8 lead:pm@600
02189dc3e875a29df7de3e0eb6f16f924e63cef450da37c0fa759566716e5e48 home:swarm:stuck@1234
0530ece601530070f933b4e44323095b2220de6c1ea770e4781b9753c5015f0e home:swarm:p1@5000
069886efabcda8daf892b54a130cb6246545c2b498991b1a87d98d3141284a2b agent:cli:banner@0
069886efabcda8daf892b54a130cb6246545c2b498991b1a87d98d3141284a2b agent:cli@0
07147d6cae375442998f503bd23b1153ac9930de2adbc648e7169ba925bef80b home:swarm:many@5000
074b239676cdd60e628712bc94a200b5560c844fd6680dccec74b48653edc10c tabs:none@0
+075aef14c31b5cb7b3d71a4bba271808c01e14967483d702a98637171e49034c lead:pm@5000
0a4957aade389b7bf80949d8f804d1fc08ec566cebdc4926773f926baa102c38 home:swarm:p2@1234
0af8281888248c31cd8db0bdbc1c33f4e74fe323f374ca3eee3c43b53e69495b recap:docs:long@1234
0cd4cf539f2f3f8dcc17f28478d50ea641f5a0f6f1a3aa27674ba268e2705e0b agent:desk@5000
@@ -24,10 +26,20 @@
1467a0558ff261ee1580e2ab811f1d59ed1418cf0566b084ba6697eb487a9618 tabs:bell@5000
1467a0558ff261ee1580e2ab811f1d59ed1418cf0566b084ba6697eb487a9618 tabs:linkdown@5000
1467a0558ff261ee1580e2ab811f1d59ed1418cf0566b084ba6697eb487a9618 tabs@5000
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@0
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@1234
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@2500
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@5000
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@600
205286ce60f1fdf5c5b6cefee707eaf71a3384cda456415cdac103fc574c4ebf agent:fw:banner@1234
205286ce60f1fdf5c5b6cefee707eaf71a3384cda456415cdac103fc574c4ebf agent:fw:unread@1234
205286ce60f1fdf5c5b6cefee707eaf71a3384cda456415cdac103fc574c4ebf agent:fw@1234
2169e2fd626fffa09f4f18655ba58804ba1a69e406d54bc055106a904c079e9f lead:none@2500
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@0
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@1234
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@2500
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@5000
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@600
22083bf5827695add306905a71f6e07a70ec12872d2d4ed3cc043e47de7205cd talk:fw:quiet@600
22083bf5827695add306905a71f6e07a70ec12872d2d4ed3cc043e47de7205cd talk:fw@600
24e4b487e56cee7639400ebd1ed0d473a12cf553c31c0f3029edf019e1f36bc0 tabs:5@5000
@@ -52,6 +64,11 @@
2f173481962b8eb473ea0e84bf0410232e3fd3a03d6f294d8c9cd0d651406ecc agent:fw@600
2f2ffd099b07287467951b45636eb38f503a2a158b412b4ddbb8df6609e6e8a5 tabs:none@5000
30aeef066c7ad64c06c65a85288a8ded1bbf8ac698de0abffdd32e25a7217f8d agent:cli:long@0
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@0
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@1234
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@2500
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@5000
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@600
3205a1a991fc7511c32453b9e99120fe5290da6a07c91102bc0a5b73843d353b inbox:failed@0
3205a1a991fc7511c32453b9e99120fe5290da6a07c91102bc0a5b73843d353b inbox:failed@1234
3205a1a991fc7511c32453b9e99120fe5290da6a07c91102bc0a5b73843d353b inbox:failed@2500
@@ -91,6 +108,7 @@
3bcdfa6e218c2e1999bce65a891884f93737cd2aa62534e0f42538422db352d3 home:swarm:stuck@0
3c50228ed125d5138821ae678ebc8267734a5e79c8878b4e4813ebbcb80b3164 agent:fw:long@1234
3d43bb7cb2ab0102944745f80af971677a75bec05d5dbc01baaf9003fa4111f9 tabs:5@1234
+447afe7920f02e419734787791934e1785fc29309ee26a1566b5005fb31bee79 lead:group@2500
44c082278989b9844c91c372d51a9f2b29430bf083fcb2794698e189fe8f2e3d tabs:none@600
45de9aa8132e2d8f8e14853abb8ee563e660be15078bc812aa6d4795c95c7cfb tabs:long@5000
45e5e20264186932fd58d679d5b05c0871332b1f675ac6b4fd34c5496f2dfea9 lead:remote@2500
@@ -104,6 +122,7 @@
4b798d9a8d9cd51399c2c1b992ddc49feb856e48d49fe2c116270482b09a3637 home:swarm:many@1234
4c575da9f9c644d41a714b210cb66c11e141a9e945d9771097a05ace169de6c7 tabs:long@600
4c8a296f6b98079851622cf9bbfdd436814be30b4f75ba819c41b3b7a699552b home:swarm:stuck@2500
+4dc1739ed1ab03cc819960461d4c61a4005e75863afc41170c3ae8f82b1d0390 lead:pm@1234
4e1055e7920922bf2c1ba0212b5860b7cdcc162784a16e1d9abd6c586d38cec0 recap:docs:toast@4900@0
4e1055e7920922bf2c1ba0212b5860b7cdcc162784a16e1d9abd6c586d38cec0 recap:docs:toast@4900@1234
4e1055e7920922bf2c1ba0212b5860b7cdcc162784a16e1d9abd6c586d38cec0 recap:docs:toast@4900@2500
@@ -130,6 +149,11 @@
6b6f4d5ec0fca4a424bbf414120c01447324f801eee022d81472bb400f0b0c5f agent:be:offline@5000
6c3389eb1064d6b347bc85f3bda88ead51eb6a0884b92db0d27afb43547e9fe4 recap:docs@600
6e8bcfa83ea6eaa08d60fd95be555efbbc0c7e6b5c82c93996f8d1a18d51dc99 home:swarm:p1@2500
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@0
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@1234
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@2500
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@5000
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@600
71ab48d28570b32591d93f305e3a1c95d00b3ca6026359dd630b3f5da6c78ac1 lead:loaded@1234
72ba008ee35e9d149fd6952d48cf85ea5898d0875786251d4199b69d53ab2d49 agent:fw:toast@4900@0
72ba008ee35e9d149fd6952d48cf85ea5898d0875786251d4199b69d53ab2d49 agent:fw:toast@4900@1234
@@ -193,11 +217,17 @@
94eb6bf3635f7305ed492c7cba44478c3d5e25121297436cefd0e37d95bec843 tabs:bell@0
94eb6bf3635f7305ed492c7cba44478c3d5e25121297436cefd0e37d95bec843 tabs:linkdown@0
94eb6bf3635f7305ed492c7cba44478c3d5e25121297436cefd0e37d95bec843 tabs@0
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@0
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@1234
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@2500
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@5000
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@600
9569396d08f53a25947caa402456c5a4b9bfe8dbdd37663d52fc7ce6aed5ccb9 lead:loading@5000
97096110794ece76a2ab0b9f8d01618e360541a3acf1bd584d8fbaa95b0d0d67 lead:ask@0
977bddb50cbd047bb41ea02dc9d04f75518bfefe9e25944de93d0fce40b7e51a talk:cur:send@5000
97cf9dd9e3d5e04d7b553aa767fc765a3bd47cc1160f327538f227b2fd0fcd5b recap:desk:short@5000
9a206f39596831defafff0aff579c7b4f52fd61029620d3beb2833b56b8ebb67 lead:loading@600
+9d4fe63cb69c23d6b2426944145e2b17ce8040e73c703944bc507366a6c40126 lead:group@0
9d7bd2ae8f98c5cb55f9d571084fd299b57d613a4a8fb76618bf96e81dfce21e agent:desk@0
9d7bd2ae8f98c5cb55f9d571084fd299b57d613a4a8fb76618bf96e81dfce21e recap:desk:banner@0
9d7bd2ae8f98c5cb55f9d571084fd299b57d613a4a8fb76618bf96e81dfce21e recap:desk:extreme@0
@@ -238,6 +268,7 @@ aa7d385e2f538e370781e40d71d58313259312909691e844e8ef8e0758f38b6d ota:100@1234
aa7d385e2f538e370781e40d71d58313259312909691e844e8ef8e0758f38b6d ota:100@2500
aa7d385e2f538e370781e40d71d58313259312909691e844e8ef8e0758f38b6d ota:100@5000
aa7d385e2f538e370781e40d71d58313259312909691e844e8ef8e0758f38b6d ota:100@600
+aac274bbc831d5272a17f000c8bc41872acb82de5416bb553411f38006d05faa lead:pm@2500
aaebdaf7d0702af2b27e9042c7ac089ba59d891ab94d54028d59f66a2d14c7c8 home:swarm:stuck@600
ac53464a1d840500d54ddfceb2360ebe43552e456b85807c997b22a9aa2f622b tabs:mock@600
ad007cd4fdc4676271ee900e07647d470675012997b1e9d6c1cfb625ee25df2b recap:docs@0
@@ -245,6 +276,7 @@ ad007cd4fdc4676271ee900e07647d470675012997b1e9d6c1cfb625ee25df2b recap:docs@250
adcb50470a8227a85b07078ba541f2078628ba8f30fe657d90c699ac28bd36c4 home:swarm:p2@600
ae9a89417055592a7468dfc3a7ea64b58cd85df877f197f8948e2b47a9124eb3 tabs:long@1234
aed7a76df17848d6d044e7343c0cf44f63cf71ed10c0cb9252a8d43e963003d0 home:swarm:done@5000
+b069b9fae5c0937be68f807243453fc0f51899d4b25f3fb12f79e2f8bef9c791 lead:pm@0
b13776fc7d712241ba716efb51747a1cd43cd0d009b8f2a20fbf1c8e36153be7 talk:be@5000
b2987fbea14e51cc7b4ddfcc7bc767ee6e7d4a09857ddabb9d0a5a680be6a714 recap:docs@5000
b31f451d884e5af7e9120f0456f994e049d8fafda4b014a76af3cf751cd96705 recap:docs:unreadfail@600
@@ -261,6 +293,7 @@ bc92dbc7694b741e98f74a47554b9e40581c98efc715b713b1feaa73d90e390b recap:desk:med
bea341256b62baa2f37ad783b5921ce770c2a3342e9d5a999322be7c60c5f9ff talk:cur@2500
beea941441c90a67801395000a40ac5ae7b3bf55377c95e70b4fa0751b973d95 agent:be:offline@600
c158dad57e29a9df5ca9b0169c6f1367dac791a7126326aeca42ee6cfc67e090 tabs:1@2500
+c1e1d9556d4df93eda80a18f0956e5e1a76ac8cc2f3b3a452f2295a27eb0df1e lead:group@1234
c443af989eb93dc9f11d473e90a91bf613767f903f194bea8b0079d707a631dd tabs:working@600
c4af0eaee2c62b423f4d3bcb3a8539098c4ffb95f64dd94b1665ea8112fb1e51 tabs:long@2500
c535233a8ccffe6e34bd2767b32fc79e8cfd0929967fcb3b6a515479700804d9 recap:desk:viet@0
@@ -290,6 +323,8 @@ ce89ce6b7c64cb11f77919520d579d4ed011230cc7fd3a802e1c568aa54ea5cd ota:0@1234
ce89ce6b7c64cb11f77919520d579d4ed011230cc7fd3a802e1c568aa54ea5cd ota:0@2500
ce89ce6b7c64cb11f77919520d579d4ed011230cc7fd3a802e1c568aa54ea5cd ota:0@5000
ce89ce6b7c64cb11f77919520d579d4ed011230cc7fd3a802e1c568aa54ea5cd ota:0@600
+cf23d17ac575cfb3e7979287b0afd5fd4d58349facc7db2f393159884cc8802f lead:group@5000
+d02a53b8220a2b6b92b93079b115ce82ff3d52af2aac02501a34a4631ed37fea lead:group@600
d0565d9cf3e07977095a0908f5598ce0904b51b97e14f6959fcbb3afaa57de71 recap:desk:long@2500
d0d1825a2e3100dc03362657abb086bc64a9d5bde8b8f66a17f60d7cce000d39 ota:62@0
d0d1825a2e3100dc03362657abb086bc64a9d5bde8b8f66a17f60d7cce000d39 ota:62@1234
diff --git a/devices/harness-pro/firmware/test/golden.sh b/devices/harness-pro/firmware/test/golden.sh
index dd79cd6c7..0597f6dd1 100644
--- a/devices/harness-pro/firmware/test/golden.sh
+++ b/devices/harness-pro/firmware/test/golden.sh
@@ -30,13 +30,13 @@ python3 "$fw/scripts/gen_fonts.py" ${font_args[@]+"${font_args[@]}"} --out "$out
cc -std=c11 -D_DEFAULT_SOURCE -Wall -Wextra -Werror -O1 -g -DHT_FACE_PX=720 -I"$disp" -I"$fw/main" \
-o "$out/pod_render" "$here/pod_render.c" "$fw"/main/pod/*.c "$fw"/main/pod/home/*.c "$disp/pro_canvas.c" "$disp/terminal.c" "$out/pro_fonts.c"
-screens=(tabs tabs:bell tabs:mock tabs:0+2 tabs:2+2 tabs:long tabs:9 tabs:linkdown tabs:1 tabs:3 tabs:5 tabs:seven tabs:single tabs:notices tabs:working tabs:none home:swarm:p1 home:swarm:p2 home:swarm:stuck home:swarm:done home:swarm:many home:swarm:remote lead:loaded lead:ask lead:loading lead:none lead:remote
+screens=(tabs tabs:bell tabs:mock tabs:0+2 tabs:2+2 tabs:long tabs:9 tabs:linkdown tabs:1 tabs:3 tabs:5 tabs:seven tabs:single tabs:notices tabs:working tabs:none home:swarm:p1 home:swarm:p2 home:swarm:stuck home:swarm:done home:swarm:many home:swarm:remote lead:loaded lead:ask lead:loading lead:none lead:remote lead:group lead:pm
agent:fw agent:cli agent:be agent:desk agent:kilo agent:fw:long agent:cli:long agent:be:offline agent:fw:banner agent:cli:banner tabs:banner agent:fw:toast@0 agent:fw:toast@200 agent:fw:toast@2500 agent:fw:toast@4900
agent:fw:toast:decision@2500 agent:fw:toast:stuck@9000
recap:desk:toast@200 recap:desk:toast@2500 recap:docs:toast@4900
recap:desk recap:desk:unread recap:desk:long recap:desk:viet recap:desk:short recap:desk:medium recap:docs:long recap:docs:unreadfail agent:fw:unread recap:docs recap:kilo recap:desk:testfail recap:desk:extreme recap:desk:banner
talk:fw talk:fw:quiet talk:fw:send talk:cur talk:cur:send talk:be talk:be:send
- inbox inbox:viet inbox:quiet inbox:failed inbox:supertab ota:0 ota:62 ota:100 ota:restart)
+ inbox inbox:viet inbox:quiet inbox:failed inbox:supertab inbox:swarm toast:swarm@0 toast:swarm@200 toast:swarm@2500 toast:swarm@4900 ota:0 ota:62 ota:100 ota:restart)
for s in "${screens[@]}"; do
for now in 0 600 1234 2500 5000; do
"$out/pod_render" "$s" "$out/r.ppm" "$now" >/dev/null
diff --git a/devices/harness-pro/firmware/test/golden.txt b/devices/harness-pro/firmware/test/golden.txt
index 841d5259e..071896ffc 100644
--- a/devices/harness-pro/firmware/test/golden.txt
+++ b/devices/harness-pro/firmware/test/golden.txt
@@ -1,11 +1,13 @@
000f6304ad48675b64e6ebf526afe23fb4226d3c68c045bd67cac3edb57345fd talk:cur@5000
01535e909a381104ef05c14c3256b08e1ee0f64b8ad03b82467e1cde2c0a9386 recap:desk:short@0
+01aee5a032c20f0368cefcebbb472675cda822457a1443712ea7a1c9fbf5b7a8 lead:pm@600
02189dc3e875a29df7de3e0eb6f16f924e63cef450da37c0fa759566716e5e48 home:swarm:stuck@1234
0530ece601530070f933b4e44323095b2220de6c1ea770e4781b9753c5015f0e home:swarm:p1@5000
069886efabcda8daf892b54a130cb6246545c2b498991b1a87d98d3141284a2b agent:cli:banner@0
069886efabcda8daf892b54a130cb6246545c2b498991b1a87d98d3141284a2b agent:cli@0
07147d6cae375442998f503bd23b1153ac9930de2adbc648e7169ba925bef80b home:swarm:many@5000
074b239676cdd60e628712bc94a200b5560c844fd6680dccec74b48653edc10c tabs:none@0
+075aef14c31b5cb7b3d71a4bba271808c01e14967483d702a98637171e49034c lead:pm@5000
0a4957aade389b7bf80949d8f804d1fc08ec566cebdc4926773f926baa102c38 home:swarm:p2@1234
0af8281888248c31cd8db0bdbc1c33f4e74fe323f374ca3eee3c43b53e69495b recap:docs:long@1234
0cd4cf539f2f3f8dcc17f28478d50ea641f5a0f6f1a3aa27674ba268e2705e0b agent:desk@5000
@@ -24,10 +26,20 @@
1467a0558ff261ee1580e2ab811f1d59ed1418cf0566b084ba6697eb487a9618 tabs:bell@5000
1467a0558ff261ee1580e2ab811f1d59ed1418cf0566b084ba6697eb487a9618 tabs:linkdown@5000
1467a0558ff261ee1580e2ab811f1d59ed1418cf0566b084ba6697eb487a9618 tabs@5000
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@0
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@1234
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@2500
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@5000
+1c6e50dd33838720a245cbfd6fe04539f057cb81232241b66efbe259837f6ee4 toast:swarm@2500@600
205286ce60f1fdf5c5b6cefee707eaf71a3384cda456415cdac103fc574c4ebf agent:fw:banner@1234
205286ce60f1fdf5c5b6cefee707eaf71a3384cda456415cdac103fc574c4ebf agent:fw:unread@1234
205286ce60f1fdf5c5b6cefee707eaf71a3384cda456415cdac103fc574c4ebf agent:fw@1234
2169e2fd626fffa09f4f18655ba58804ba1a69e406d54bc055106a904c079e9f lead:none@2500
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@0
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@1234
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@2500
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@5000
+2172692ba9bd2b3b70c08b164e96151763672fbb42893a79755fcefc052720d9 toast:swarm@0@600
22083bf5827695add306905a71f6e07a70ec12872d2d4ed3cc043e47de7205cd talk:fw:quiet@600
22083bf5827695add306905a71f6e07a70ec12872d2d4ed3cc043e47de7205cd talk:fw@600
24e4b487e56cee7639400ebd1ed0d473a12cf553c31c0f3029edf019e1f36bc0 tabs:5@5000
@@ -52,6 +64,11 @@
2f173481962b8eb473ea0e84bf0410232e3fd3a03d6f294d8c9cd0d651406ecc agent:fw@600
2f2ffd099b07287467951b45636eb38f503a2a158b412b4ddbb8df6609e6e8a5 tabs:none@5000
30aeef066c7ad64c06c65a85288a8ded1bbf8ac698de0abffdd32e25a7217f8d agent:cli:long@0
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@0
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@1234
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@2500
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@5000
+31265f04ed2036e41f51d9812f1ee5e70d1a37cadb58932c33c8cb122f9349ee toast:swarm@4900@600
3205a1a991fc7511c32453b9e99120fe5290da6a07c91102bc0a5b73843d353b inbox:failed@0
3205a1a991fc7511c32453b9e99120fe5290da6a07c91102bc0a5b73843d353b inbox:failed@1234
3205a1a991fc7511c32453b9e99120fe5290da6a07c91102bc0a5b73843d353b inbox:failed@2500
@@ -91,6 +108,7 @@
3bcdfa6e218c2e1999bce65a891884f93737cd2aa62534e0f42538422db352d3 home:swarm:stuck@0
3c50228ed125d5138821ae678ebc8267734a5e79c8878b4e4813ebbcb80b3164 agent:fw:long@1234
3d43bb7cb2ab0102944745f80af971677a75bec05d5dbc01baaf9003fa4111f9 tabs:5@1234
+447afe7920f02e419734787791934e1785fc29309ee26a1566b5005fb31bee79 lead:group@2500
44c082278989b9844c91c372d51a9f2b29430bf083fcb2794698e189fe8f2e3d tabs:none@600
45de9aa8132e2d8f8e14853abb8ee563e660be15078bc812aa6d4795c95c7cfb tabs:long@5000
45e5e20264186932fd58d679d5b05c0871332b1f675ac6b4fd34c5496f2dfea9 lead:remote@2500
@@ -104,6 +122,7 @@
4b798d9a8d9cd51399c2c1b992ddc49feb856e48d49fe2c116270482b09a3637 home:swarm:many@1234
4c575da9f9c644d41a714b210cb66c11e141a9e945d9771097a05ace169de6c7 tabs:long@600
4c8a296f6b98079851622cf9bbfdd436814be30b4f75ba819c41b3b7a699552b home:swarm:stuck@2500
+4dc1739ed1ab03cc819960461d4c61a4005e75863afc41170c3ae8f82b1d0390 lead:pm@1234
4e1055e7920922bf2c1ba0212b5860b7cdcc162784a16e1d9abd6c586d38cec0 recap:docs:toast@4900@0
4e1055e7920922bf2c1ba0212b5860b7cdcc162784a16e1d9abd6c586d38cec0 recap:docs:toast@4900@1234
4e1055e7920922bf2c1ba0212b5860b7cdcc162784a16e1d9abd6c586d38cec0 recap:docs:toast@4900@2500
@@ -130,6 +149,11 @@
6b6f4d5ec0fca4a424bbf414120c01447324f801eee022d81472bb400f0b0c5f agent:be:offline@5000
6c3389eb1064d6b347bc85f3bda88ead51eb6a0884b92db0d27afb43547e9fe4 recap:docs@600
6e8bcfa83ea6eaa08d60fd95be555efbbc0c7e6b5c82c93996f8d1a18d51dc99 home:swarm:p1@2500
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@0
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@1234
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@2500
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@5000
+6efbf890109e2da7e92c25cafab64d6997dd5bc958a1540fc3fbec7ec551a156 inbox:swarm@600
71ab48d28570b32591d93f305e3a1c95d00b3ca6026359dd630b3f5da6c78ac1 lead:loaded@1234
72ba008ee35e9d149fd6952d48cf85ea5898d0875786251d4199b69d53ab2d49 agent:fw:toast@4900@0
72ba008ee35e9d149fd6952d48cf85ea5898d0875786251d4199b69d53ab2d49 agent:fw:toast@4900@1234
@@ -193,11 +217,17 @@
94eb6bf3635f7305ed492c7cba44478c3d5e25121297436cefd0e37d95bec843 tabs:bell@0
94eb6bf3635f7305ed492c7cba44478c3d5e25121297436cefd0e37d95bec843 tabs:linkdown@0
94eb6bf3635f7305ed492c7cba44478c3d5e25121297436cefd0e37d95bec843 tabs@0
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@0
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@1234
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@2500
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@5000
+954a76c01498ec143cbfc7e7edd83fafcf0d87f050cf372fc4966b2676618aa2 toast:swarm@200@600
9569396d08f53a25947caa402456c5a4b9bfe8dbdd37663d52fc7ce6aed5ccb9 lead:loading@5000
97096110794ece76a2ab0b9f8d01618e360541a3acf1bd584d8fbaa95b0d0d67 lead:ask@0
977bddb50cbd047bb41ea02dc9d04f75518bfefe9e25944de93d0fce40b7e51a talk:cur:send@5000
97cf9dd9e3d5e04d7b553aa767fc765a3bd47cc1160f327538f227b2fd0fcd5b recap:desk:short@5000
9a206f39596831defafff0aff579c7b4f52fd61029620d3beb2833b56b8ebb67 lead:loading@600
+9d4fe63cb69c23d6b2426944145e2b17ce8040e73c703944bc507366a6c40126 lead:group@0
9d7bd2ae8f98c5cb55f9d571084fd299b57d613a4a8fb76618bf96e81dfce21e agent:desk@0
9d7bd2ae8f98c5cb55f9d571084fd299b57d613a4a8fb76618bf96e81dfce21e recap:desk:banner@0
9d7bd2ae8f98c5cb55f9d571084fd299b57d613a4a8fb76618bf96e81dfce21e recap:desk:extreme@0
@@ -238,6 +268,7 @@ aa7d385e2f538e370781e40d71d58313259312909691e844e8ef8e0758f38b6d ota:100@1234
aa7d385e2f538e370781e40d71d58313259312909691e844e8ef8e0758f38b6d ota:100@2500
aa7d385e2f538e370781e40d71d58313259312909691e844e8ef8e0758f38b6d ota:100@5000
aa7d385e2f538e370781e40d71d58313259312909691e844e8ef8e0758f38b6d ota:100@600
+aac274bbc831d5272a17f000c8bc41872acb82de5416bb553411f38006d05faa lead:pm@2500
aaebdaf7d0702af2b27e9042c7ac089ba59d891ab94d54028d59f66a2d14c7c8 home:swarm:stuck@600
ac53464a1d840500d54ddfceb2360ebe43552e456b85807c997b22a9aa2f622b tabs:mock@600
ad007cd4fdc4676271ee900e07647d470675012997b1e9d6c1cfb625ee25df2b recap:docs@0
@@ -245,6 +276,7 @@ ad007cd4fdc4676271ee900e07647d470675012997b1e9d6c1cfb625ee25df2b recap:docs@250
adcb50470a8227a85b07078ba541f2078628ba8f30fe657d90c699ac28bd36c4 home:swarm:p2@600
ae9a89417055592a7468dfc3a7ea64b58cd85df877f197f8948e2b47a9124eb3 tabs:long@1234
aed7a76df17848d6d044e7343c0cf44f63cf71ed10c0cb9252a8d43e963003d0 home:swarm:done@5000
+b069b9fae5c0937be68f807243453fc0f51899d4b25f3fb12f79e2f8bef9c791 lead:pm@0
b13776fc7d712241ba716efb51747a1cd43cd0d009b8f2a20fbf1c8e36153be7 talk:be@5000
b2987fbea14e51cc7b4ddfcc7bc767ee6e7d4a09857ddabb9d0a5a680be6a714 recap:docs@5000
b31f451d884e5af7e9120f0456f994e049d8fafda4b014a76af3cf751cd96705 recap:docs:unreadfail@600
@@ -261,6 +293,7 @@ bc92dbc7694b741e98f74a47554b9e40581c98efc715b713b1feaa73d90e390b recap:desk:med
bea341256b62baa2f37ad783b5921ce770c2a3342e9d5a999322be7c60c5f9ff talk:cur@2500
beea941441c90a67801395000a40ac5ae7b3bf55377c95e70b4fa0751b973d95 agent:be:offline@600
c158dad57e29a9df5ca9b0169c6f1367dac791a7126326aeca42ee6cfc67e090 tabs:1@2500
+c1e1d9556d4df93eda80a18f0956e5e1a76ac8cc2f3b3a452f2295a27eb0df1e lead:group@1234
c443af989eb93dc9f11d473e90a91bf613767f903f194bea8b0079d707a631dd tabs:working@600
c4af0eaee2c62b423f4d3bcb3a8539098c4ffb95f64dd94b1665ea8112fb1e51 tabs:long@2500
c535233a8ccffe6e34bd2767b32fc79e8cfd0929967fcb3b6a515479700804d9 recap:desk:viet@0
@@ -290,6 +323,8 @@ ce89ce6b7c64cb11f77919520d579d4ed011230cc7fd3a802e1c568aa54ea5cd ota:0@1234
ce89ce6b7c64cb11f77919520d579d4ed011230cc7fd3a802e1c568aa54ea5cd ota:0@2500
ce89ce6b7c64cb11f77919520d579d4ed011230cc7fd3a802e1c568aa54ea5cd ota:0@5000
ce89ce6b7c64cb11f77919520d579d4ed011230cc7fd3a802e1c568aa54ea5cd ota:0@600
+cf23d17ac575cfb3e7979287b0afd5fd4d58349facc7db2f393159884cc8802f lead:group@5000
+d02a53b8220a2b6b92b93079b115ce82ff3d52af2aac02501a34a4631ed37fea lead:group@600
d0565d9cf3e07977095a0908f5598ce0904b51b97e14f6959fcbb3afaa57de71 recap:desk:long@2500
d0d1825a2e3100dc03362657abb086bc64a9d5bde8b8f66a17f60d7cce000d39 ota:62@0
d0d1825a2e3100dc03362657abb086bc64a9d5bde8b8f66a17f60d7cce000d39 ota:62@1234
diff --git a/devices/harness-pro/firmware/test/pod_render.c b/devices/harness-pro/firmware/test/pod_render.c
index 6ae7d75fd..0e0df65dc 100644
--- a/devices/harness-pro/firmware/test/pod_render.c
+++ b/devices/harness-pro/firmware/test/pod_render.c
@@ -4,7 +4,7 @@
// agent:<id>, recap:<id>, talk:<id> (ids: fw ota be cli web desk docs vault site cur notes2 kilo; suffixes :long :offline :unread :viet ...),
// talk:listen|send, inbox[:viet|:quiet|:failed], ota:<pct>|ota:restart (the update screen), notice:updated|notice:failed (the Home screen with that pill),
// <room>:toast[@<ms after it showed>] (the notice toast; <room>:toast:decision / :stuck: a Super Tab question's staying toast, backend deciding or
-// desktop stuck), inbox:supertab (Notices with those two asking rows above a plain entry), and ":bell" / ":banner" on a screen (unread entries; banner adds the toast). The demo is the
+// desktop stuck), inbox:supertab (Notices with those two asking rows above a plain entry), toast:swarm[@<ms>] / inbox:swarm (a Swarm chat's notice: the toast over a Lead view, and its row in Notices), and ":bell" / ":banner" on a screen (unread entries; banner adds the toast). The demo is the
// HTML mockup's: the same agents, tabs and times. `--skin pets` is accepted and ignored (Pets is the only interface).
#include <stdio.h>
#include <stdlib.h>
@@ -19,7 +19,7 @@
static void asked_recap(pod_model_t *m, const char *tab, const char *lead, const char *text, uint32_t at, bool none)
{
pod_model_supertab_loading(m, tab, lead);
- pod_model_supertab_recap(m, tab, lead, text, at, none);
+ pod_model_supertab_recap(m, tab, lead, "", text, at, none);
}
#define T0 100000u
@@ -297,7 +297,9 @@ static void overlay(bool banner, bool toast, uint32_t now)
const pod_unread_t *bn = pod_model_unread_find(&M, s_toast_agent);
if (!bn) return;
const pod_frame_t *top = N.depth ? &N.stack[N.depth - 1] : NULL;
- if ((banner || toast) && top && (top->view == POD_V_AGENT || top->view == POD_V_RECAP) && strcmp(top->agent, s_toast_agent)) ph_toast(&F, &M, bn, T0, now);
+ const bool room = top && (top->view == POD_V_AGENT || top->view == POD_V_RECAP) && strcmp(top->agent, s_toast_agent);
+ const bool lead = top && top->view == POD_V_LEAD && bn->tab[0] && strcmp(top->lead_id, bn->agent); // a Swarm chat's notice also toasts over another Lead's view
+ if ((banner || toast) && (room || lead)) ph_toast(&F, &M, bn, T0, now);
}
// A Super Tab ("Launch v2") question: the agent asks with that attention and the question's entry is filed, as pro_app does.
@@ -350,17 +352,23 @@ static void swarm_fixture(const char *kind)
}
}
-// lead:<loaded|ask|loading|none|remote>: the Lead view over Home (the mockup swarm-card.html B1, B2, and the loading, no-message and remote-Lead states). loaded: the working
+// lead:<loaded|ask|loading|none|remote|group|pm>: the Lead view over Home (the mockup swarm-card.html B1, B2, and the loading, no-message and remote-Lead states). loaded: the working
// "harness" Lead (B1); ask: "mobile", which needs you (B2, the orange edge); loading: "website" before its message came; none: "backend", which has said nothing; remote:
-// a Lead on another person's machine (its owner shown, no talk).
+// a Lead on another person's machine (its owner shown, no talk); group / pm: the loaded Lead with its chat named ("review-cable-fit", "PM").
static void lead_fixture(const char *kind)
{
- const bool remote = !strcmp(kind, "remote");
+ const bool group = !strcmp(kind, "group"), pm = !strcmp(kind, "pm"), remote = !strcmp(kind, "remote");
+ if (group || pm) kind = "loaded"; // the loaded Lead, with the chat the desktop has open named under the project
swarm_fixture(remote ? "remote" : "p1");
const pod_swarm_t *sw = pod_model_swarm(&M, remote ? "sw2" : "sw1");
const int at = remote ? 0 : !strcmp(kind, "loaded") ? 1 : !strcmp(kind, "ask") ? 0 : !strcmp(kind, "loading") ? 2 : 3;
if (!pod_nav_open_lead(&N, &M, sw->id, at)) { fprintf(stderr, "lead:%s: the Lead view did not open\n", kind); exit(2); }
const char *id = sw->leads[at].id;
+ if (group || pm) {
+ pod_lead_t *cl = &M.swarms[0].leads[at];
+ cl->chat = group ? POD_CHAT_GROUP : POD_CHAT_PM;
+ snprintf(cl->chat_name, sizeof cl->chat_name, "%s", group ? "review-cable-fit" : "PM");
+ }
if (!strcmp(kind, "loaded")) asked_recap(&M, sw->id, id, "PR #1492 is merged and backend 1.2.100 is on production. The Pro took the test flash. Next: waiting for you to try it on the device.", 1792560000u, false);
else if (!strcmp(kind, "ask")) asked_recap(&M, sw->id, id, "iOS 1.0.9 finished building. Do you want it on TestFlight now, or wait for the Android banner fix?", 1792560000u, false);
else if (remote) asked_recap(&M, sw->id, id, "Staging is up on the new region. I am moving the queue workers over now; the first batch should land within the hour.", 1792560000u, false);
@@ -412,8 +420,17 @@ int main(int argc, char **argv)
supertab_ask("be", "backend", "Run the migration on staging first, or straight to prod?", POD_ATTN_DECISION);
supertab_ask("desk", "desktop", "e2e failed 3 times, no write access to staging", POD_ATTN_STUCK);
}
- if (inbox) pod_nav_act(&N, &M, POD_A_INBOX, 0, T0);
- else if (!strcmp(screen, "tabs:notices")) { // Home on the Notices card (the entries are added above; the asking agent counts too)
+ if (inbox) {
+ if (strstr(screen, "swarm")) { // inbox:swarm, the mockup pro-swarm-parity 1E: a Lead's notice among the agents' (a minute old, so it sits second)
+ swarm_fixture("p1");
+ pod_model_swarm_notice(&M, "sw1", "l2", "c1", "Cable fit now counts JSON tokens for the Pro.", T0 - 60000u);
+ }
+ pod_nav_act(&N, &M, POD_A_INBOX, 0, T0);
+ } else if (!strncmp(screen, "toast:swarm", 11)) { // the mockup 1D: Lead l1's view with a notice from the "harness" Lead (l2) over it
+ lead_fixture("ask");
+ pod_model_swarm_notice(&M, "sw1", "l2", "c1", "Cable fit now counts JSON tokens for the Pro.", T0);
+ s_toast_agent = "l2";
+ } else if (!strcmp(screen, "tabs:notices")) { // Home on the Notices card (the entries are added above; the asking agent counts too)
pod_nav_act(&N, &M, POD_A_SCROLL, POD_HOME_NOTICES, T0);
} else if (!strncmp(screen, "tabs:working", 12)) { // Home on the Working card (fw, be, web, cur work: three pets on page 0); :codex has be, web (Muse), site (Codex) work
if (strstr(screen, ":codex")) {
diff --git a/devices/harness-pro/firmware/test/test_ph_glue.c b/devices/harness-pro/firmware/test/test_ph_glue.c
index 251846a83..d616584cc 100644
--- a/devices/harness-pro/firmware/test/test_ph_glue.c
+++ b/devices/harness-pro/firmware/test/test_ph_glue.c
@@ -12,7 +12,7 @@
static void asked_recap(pod_model_t *m, const char *tab, const char *lead, const char *text, uint32_t at, bool none)
{
pod_model_supertab_loading(m, tab, lead);
- pod_model_supertab_recap(m, tab, lead, text, at, none);
+ pod_model_supertab_recap(m, tab, lead, "", text, at, none);
}
static int checks;
@@ -1763,6 +1763,182 @@ static void notice_opens_lead(void) {
CHECK(o.fx == POD_FX_AGENT_OPEN && !strcmp(o.agent, "a2") && top()->view != POD_V_LEAD);
}
+// ---- a Swarm chat's notice: the alert tier of the glue (toast + Notices row), read by its chat, opening its Lead ----
+static void swarm_lead_open(int k) { // sw1 on Home, the Lead at index k open
+ swarm_home(4);
+ tap_lead(k, 3000);
+ CHECK(top()->view == POD_V_LEAD && top()->lead == k);
+ take();
+ render(3300);
+}
+static void swarm_notice_toasts_and_beeps(void) {
+ swarm_lead_open(1); // l1's view: a notice from l2 is for another screen
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l2", "c1", "Cable fit now counts tokens. More.", true, 3400));
+ const pod_unread_t *e = pod_model_unread_find(&U.model, "l2");
+ CHECK(e && !strcmp(e->tab, "sw1") && !strcmp(e->chat_id, "c1") && !strcmp(e->name, "proj2") && U.model.unread_count == 1);
+ CHECK(U.ban_on && U.ban_until == 3400 + POD_TOAST_MS && !U.ban_stay);
+ render(3400);
+ CHECK(U.frame.banner && hits_of_banner() == 1 && !strcmp(find(POD_A_BANNER)->id, "l2"));
+ // it runs out like any toast; the row stays
+ render(3400 + POD_TOAST_MS);
+ CHECK(!U.frame.banner && !U.ban_on && pod_model_unread_find(&U.model, "l2"));
+ // a room is a place for it too, and a notice for a Lead the model does not hold is dropped
+ fresh();
+ to_agent(0, 2);
+ CHECK(!pod_ui_swarm_notice(&U, "sw1", "l9", "c1", "x", true, 4000) && U.model.unread_count == 0);
+ swarm_home(4);
+ to_agent(0, 2);
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l0", "c1", "Hi.", true, 4000) && U.ban_on);
+ render(4000);
+ CHECK(U.frame.banner);
+ // a dark glass is news: the row, and the caller wakes
+ swarm_lead_open(1);
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l1", "c1", "Hi.", false, 4000) && pod_model_unread_find(&U.model, "l1"));
+}
+static bool select_taken(void) {
+ const int n = take();
+ for (int i = 0; i < n; i++) if (!strcmp(Q[i].t, "supertab.select")) return true;
+ return false;
+}
+// Access lost sends no read frame: the row, its toast and a finger already on either must not outlive the Swarm or the Lead (review of #2298).
+static void swarm_notice_goes_with_its_swarm(void) {
+ // the Swarm leaves the list while its toast shows
+ swarm_lead_open(1);
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l2", "c1", "Private words.", true, 3400));
+ render(3400);
+ CHECK(U.frame.banner);
+ pod_ui_supertab_ids(&U, NULL, 0);
+ render(3500);
+ CHECK(!U.frame.banner && !U.ban_on && !pod_model_unread_find(&U.model, "l2") && U.model.unread_count == 0);
+
+ // a Lead leaves its Swarm while its toast shows; a finger on the toast opens no Lead and sends no select
+ swarm_lead_open(1);
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l2", "c1", "Private words.", true, 3400));
+ render(3400);
+ const pod_hit_t *h = find(POD_A_BANNER);
+ CHECK(h);
+ const int x = h->x + h->w / 2, y = h->y + h->h / 2;
+ take();
+ t_(true, x, y, 3450);
+ static pod_swarm_t without;
+ without = *pod_model_swarm(&U.model, "sw1");
+ memmove(&without.leads[2], &without.leads[3], (size_t)(without.lead_n - 3) * sizeof without.leads[0]);
+ without.lead_n--;
+ pod_ui_supertab(&U, &without, 3460);
+ t_(false, x, y, 3500);
+ CHECK(!pod_model_unread_find(&U.model, "l2") && U.model.unread_count == 0 && !U.ban_on);
+ CHECK(top()->view != POD_V_LEAD || top()->lead == 1);
+ CHECK(!select_taken());
+
+ // a finger on a Notices row when the Swarm goes: nothing opens, and the row is off the next frame
+ swarm_home(4);
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l2", "c1", "Private words.", true, 3400));
+ act(POD_A_INBOX, 0);
+ render(3420);
+ CHECK(top()->view == POD_V_INBOX);
+ h = find(POD_A_OPEN_NOTIF);
+ CHECK(h && !strcmp(h->id, "l2"));
+ const int rx = h->x + h->w / 2, ry = h->y + h->h / 2;
+ take();
+ t_(true, rx, ry, 3450);
+ pod_ui_supertab_ids(&U, NULL, 0);
+ t_(false, rx, ry, 3500);
+ CHECK(top()->view == POD_V_INBOX && !select_taken());
+ render(3600);
+ CHECK(!find(POD_A_OPEN_NOTIF));
+}
+static void notif_replace_keeps_swarm_notices(void) {
+ swarm_lead_open(1);
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l2", "c1", "Merged.", true, 3400));
+ pod_model_unread_add(&U.model, "a2", "Beta", "Done.", 20, 3410);
+ pod_ui_notif_begin(&U);
+ CHECK(pod_model_unread_find(&U.model, "l2") && !pod_model_unread_find(&U.model, "a2") && U.model.unread_count == 1);
+ pod_ui_notif_end(&U);
+}
+static void swarm_notice_on_its_lead_view_reads_at_once(void) {
+ swarm_lead_open(1);
+ snprintf(U.model.swarms[0].leads[1].chat_id, ID_MAX, "c1"); // the face shows the chat the notice is for
+ CHECK(!pod_ui_swarm_notice(&U, "sw1", "l1", "c1", "Seen already.", true, 3400));
+ CHECK(U.model.unread_count == 0 && !U.ban_on);
+ render(3500);
+ CHECK(!U.frame.banner);
+}
+static void notice_for_other_chat_on_lead_view_files_row(void) {
+ swarm_lead_open(1);
+ snprintf(U.model.swarms[0].leads[1].chat_id, ID_MAX, "g1"); // the face shows g1; the notice is for c1
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l1", "c1", "Elsewhere.", true, 3400));
+ const pod_unread_t *e = pod_model_unread_find(&U.model, "l1");
+ CHECK(e && !strcmp(e->chat_id, "c1"));
+}
+static void notice_for_face_chat_on_lead_view_clears_old_row(void) {
+ swarm_lead_open(1);
+ snprintf(U.model.swarms[0].leads[1].chat_id, ID_MAX, "g1");
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l1", "c1", "Older.", true, 3300)); // an older row of this Lead
+ CHECK(!pod_ui_swarm_notice(&U, "sw1", "l1", "g1", "Seen.", true, 3400));
+ CHECK(!pod_model_unread_find(&U.model, "l1") && U.model.unread_count == 0);
+}
+static void chat_switch_asks_recap_at_once(void) {
+ swarm_lead_open(1);
+ take();
+ U.model.clock_ms += 10 * POD_SUPERTAB_RETRY_MS;
+ for (int i = 0; i < POD_SUPERTAB_RETRIES + 2; i++) { U.model.clock_ms += POD_SUPERTAB_RETRY_MS; take(); } // retries exhausted, the bubble is "..."
+ CHECK(U.model.swarms[0].leads[1].recap == POD_RECAP_LOADING && take() == 0);
+ static pod_swarm_t sw;
+ memset(&sw, 0, sizeof sw);
+ snprintf(sw.id, ID_MAX, "sw1"); snprintf(sw.tab, ID_MAX, "s1"); snprintf(sw.name, sizeof sw.name, "openharness"); sw.count = 4; sw.lead_n = 4;
+ for (int i = 0; i < 4; i++) { snprintf(sw.leads[i].id, ID_MAX, "l%d", i); snprintf(sw.leads[i].project, sizeof sw.leads[i].project, "proj"); snprintf(sw.leads[i].engine, sizeof sw.leads[i].engine, "claude"); }
+ snprintf(sw.leads[1].chat_id, ID_MAX, "g9");
+ pod_ui_supertab(&U, &sw, U.model.clock_ms);
+ int n = take();
+ bool got = false;
+ for (int i = 0; i < n; i++) got |= is_q(i, "supertab.recap.get", "sw1", "l1");
+ CHECK(got);
+}
+static void swarm_toast_tap_opens_lead_and_selects(void) {
+ swarm_lead_open(1);
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l2", "c1", "Merged.", true, 3400));
+ render(3400);
+ CHECK(U.frame.banner);
+ pod_out_t o = tap_(360, 80, 3500);
+ CHECK(o.fx == POD_FX_NONE && top()->view == POD_V_LEAD && !strcmp(top()->swarm, "sw1") && !strcmp(top()->lead_id, "l2") && U.nav.depth == 2);
+ CHECK(!U.ban_on && U.model.unread_count == 0);
+ CHECK(take() >= 1 && is_q(0, "supertab.select", "sw1", "l2"));
+}
+static void swarm_row_tap_opens_lead_and_selects(void) {
+ swarm_home(4);
+ pod_model_unread_add(&U.model, "a2", "Beta", "Done.", 20, 2100);
+ CHECK(pod_ui_swarm_notice(&U, "sw1", "l3", "c1", "Merged.", true, 2200));
+ act(POD_A_INBOX, 0);
+ render(2500);
+ const pod_hit_t *h = NULL;
+ for (int i = 0; i < U.frame.hit_count; i++) if (U.frame.hits[i].action == POD_A_OPEN_NOTIF && !strcmp(U.frame.hits[i].id, "l3")) h = &U.frame.hits[i];
+ CHECK(h);
+ take();
+ pod_out_t o = tap_(h->x + h->w / 2, h->y + h->h / 2, 3000);
+ CHECK(o.fx == POD_FX_NONE && top()->view == POD_V_LEAD && !strcmp(top()->swarm, "sw1") && !strcmp(top()->lead_id, "l3"));
+ CHECK(U.nav.depth == 2 && U.nav.stack[0].view == POD_V_TABS && !pod_model_unread_find(&U.model, "l3") && pod_model_unread_find(&U.model, "a2"));
+ CHECK(take() >= 1 && is_q(0, "supertab.select", "sw1", "l3"));
+}
+static void swarm_notice_read_ends_toast(void) {
+ swarm_lead_open(1);
+ pod_ui_swarm_notice(&U, "sw1", "l2", "c1", "Merged.", true, 3400);
+ render(3400);
+ CHECK(U.frame.banner);
+ pod_ui_swarm_notice_read(&U, "sw1", "l2", "c2"); // another chat's read: the row and the toast stay
+ render(3500);
+ CHECK(U.frame.banner && pod_model_unread_find(&U.model, "l2"));
+ pod_ui_swarm_notice_read(&U, "sw1", "l2", "c1");
+ render(3600);
+ CHECK(!U.ban_on && !U.frame.banner && !pod_model_unread_find(&U.model, "l2"));
+ // a read of an entry that is not the toast's leaves that toast up
+ pod_ui_swarm_notice(&U, "sw1", "l2", "c1", "Merged.", true, 3700);
+ pod_model_unread_add(&U.model, "a1", "Alpha", "x", 1, 3700);
+ pod_ui_swarm_notice(&U, "sw1", "l0", "c5", "Other.", true, 3750); // the newer toast is l0's
+ pod_ui_swarm_notice_read(&U, "sw1", "l2", "c1");
+ render(3800);
+ CHECK(U.ban_on && !strcmp(U.ban_agent, "l0") && U.frame.banner);
+}
+
// ---- the Lead view ----
static void lead_tap_sends(void) {
swarm_home(4);
@@ -1773,7 +1949,7 @@ static void lead_tap_sends(void) {
render(3500);
CHECK(U.frame.hit_count == 0);
// the text arrives: LOADED, nothing more is sent
- pod_ui_supertab_recap(&U, "sw1", "l1", "Merged.", 1792560000u, false);
+ pod_ui_supertab_recap(&U, "sw1", "l1", "", "Merged.", 1792560000u, false);
CHECK(U.model.swarms[0].leads[1].recap == POD_RECAP_LOADED && take() == 0);
pod_nav_act(&U.nav, &U.model, POD_A_BACK, 0, 4000);
CHECK(take() == 1 && is_q(0, "supertab.open", "sw1", ""));
@@ -1812,7 +1988,7 @@ static void lead_retry(void) {
render(9000);
CHECK(take() == 2 && U.sup_tries == 1);
// a Lead that answered is told once more that it is open, then left alone
- pod_ui_supertab_recap(&U, "sw1", "l1", "Merged.", 1792560000u, false);
+ pod_ui_supertab_recap(&U, "sw1", "l1", "", "Merged.", 1792560000u, false);
render(12000);
CHECK(take() == 1 && is_q(0, "supertab.open", "sw1", "l1"));
render(20000);
@@ -1839,7 +2015,7 @@ static void lead_swipe_steps(void) {
swarm_home(4);
tap_lead(1, 3000);
CHECK(take() == 3);
- pod_ui_supertab_recap(&U, "sw1", "l1", "One.", 1, false);
+ pod_ui_supertab_recap(&U, "sw1", "l1", "", "One.", 1, false);
render(3500);
swipe(600, 400, 200, 410, 4000); // left: the next Lead, in card order
CHECK(top()->view == POD_V_LEAD && top()->lead == 2 && !strcmp(top()->lead_id, "l2") && U.nav.depth == 2);
@@ -1892,7 +2068,7 @@ static void lead_scrolls(void) {
swarm_home(4);
tap_lead(0, 3000);
take();
- pod_ui_supertab_recap(&U, "sw1", "l0", "one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty "
+ pod_ui_supertab_recap(&U, "sw1", "l0", "", "one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty "
"twenty-one twenty-two twenty-three twenty-four twenty-five twenty-six twenty-seven twenty-eight twenty-nine thirty thirty-one thirty-two", 1, false);
render(3500);
CHECK(pod_scroll_max(&U.nav, &U.model) > 1 && top()->scroll == 0);
@@ -1988,6 +2164,49 @@ static void lead_focus(void) {
pod_ui_supertab_ids(&U, ids, 2);
CHECK(!U.model.focus_pending && U.nav.depth == 1);
}
+static void empty_focus_opens_last_lead(void) {
+ swarm_home(4);
+ pod_ui_supertab_focus(&U, "sw1", "l2", NOW);
+ take(); // the Lead view is on screen: the sync remembers it
+ U.nav.depth = 1; U.dirty = true; // back at Home
+ take();
+ pod_ui_supertab_focus(&U, "sw1", "", NOW); // the desktop opened the Swarm with no project: the Lead last shown here
+ CHECK(U.nav.depth == 2 && top()->view == POD_V_LEAD && top()->lead == 2 && !strcmp(top()->swarm, "sw1") && !U.model.focus_pending);
+}
+static void empty_focus_opens_first_without_history(void) {
+ swarm_home(4);
+ pod_ui_supertab_focus(&U, "sw1", "", NOW);
+ CHECK(U.nav.depth == 2 && top()->view == POD_V_LEAD && top()->lead == 0 && !strcmp(top()->swarm, "sw1") && !U.model.focus_pending);
+}
+static void empty_focus_last_lead_gone_opens_first(void) {
+ swarm_home(4);
+ pod_ui_supertab_focus(&U, "sw1", "l3", NOW);
+ take();
+ U.nav.depth = 1; U.dirty = true;
+ take();
+ static pod_swarm_t sw; // l3 leaves the Swarm
+ memset(&sw, 0, sizeof sw);
+ snprintf(sw.id, ID_MAX, "sw1"); snprintf(sw.tab, ID_MAX, "s1"); snprintf(sw.name, sizeof sw.name, "openharness"); sw.count = 3; sw.lead_n = 3;
+ for (int i = 0; i < 3; i++) { snprintf(sw.leads[i].id, ID_MAX, "l%d", i); snprintf(sw.leads[i].project, sizeof sw.leads[i].project, "proj"); snprintf(sw.leads[i].engine, sizeof sw.leads[i].engine, "claude"); }
+ pod_ui_supertab(&U, &sw, 3000);
+ pod_ui_supertab_focus(&U, "sw1", "", NOW);
+ CHECK(U.nav.depth == 2 && top()->view == POD_V_LEAD && top()->lead == 0 && !U.model.focus_pending);
+}
+static void empty_focus_unknown_swarm_waits_then_drops(void) {
+ swarm_home(4);
+ pod_ui_supertab_focus(&U, "swX", "", NOW);
+ CHECK(U.model.focus_pending && U.nav.depth == 1);
+ U.model.clock_ms += POD_FOLLOW_PENDING_MS + 100;
+ static const char ids[2][ID_MAX] = {"sw1", "sw2"};
+ pod_ui_supertab_ids(&U, ids, 2);
+ CHECK(!U.model.focus_pending && U.nav.depth == 1);
+}
+static void empty_focus_respects_quiet_window(void) {
+ swarm_home(4);
+ U.touched = true; U.last_touch_ms = 1400; // a touch 100 ms ago
+ pod_ui_supertab_focus(&U, "sw1", "", 1500);
+ CHECK(U.nav.depth == 1 && !U.model.focus_pending);
+}
static void lead_removed(void) {
swarm_home(4);
tap_lead(1, 3000);
@@ -2071,6 +2290,16 @@ int main(void) {
swarm_card_few_leads();
swarm_card_tap();
notice_opens_lead();
+ swarm_notice_toasts_and_beeps();
+ swarm_notice_on_its_lead_view_reads_at_once();
+ notice_for_other_chat_on_lead_view_files_row();
+ notice_for_face_chat_on_lead_view_clears_old_row();
+ chat_switch_asks_recap_at_once();
+ swarm_notice_goes_with_its_swarm();
+ notif_replace_keeps_swarm_notices();
+ swarm_toast_tap_opens_lead_and_selects();
+ swarm_row_tap_opens_lead_and_selects();
+ swarm_notice_read_ends_toast();
lead_tap_sends();
lead_retry();
lead_swipe_steps();
@@ -2078,6 +2307,11 @@ int main(void) {
lead_scrolls();
lead_talk();
lead_focus();
+ empty_focus_opens_last_lead();
+ empty_focus_opens_first_without_history();
+ empty_focus_last_lead_gone_opens_first();
+ empty_focus_unknown_swarm_waits_then_drops();
+ empty_focus_respects_quiet_window();
lead_removed();
lead_relink();
swarm_card_shrinks();
diff --git a/devices/harness-pro/firmware/test/test_ph_views.c b/devices/harness-pro/firmware/test/test_ph_views.c
index ed708c1e2..bbadae39a 100644
--- a/devices/harness-pro/firmware/test/test_ph_views.c
+++ b/devices/harness-pro/firmware/test/test_ph_views.c
@@ -14,7 +14,7 @@
static void asked_recap(pod_model_t *m, const char *tab, const char *lead, const char *text, uint32_t at, bool none)
{
pod_model_supertab_loading(m, tab, lead);
- pod_model_supertab_recap(m, tab, lead, text, at, none);
+ pod_model_supertab_recap(m, tab, lead, "", text, at, none);
}
static int checks;
@@ -1608,11 +1608,85 @@ int main(void) {
N.stack[1].scroll = 9999; // past the end: the view clamps
fresh(); ph_view_lead(&F, &N, &M, 1000);
CHECK(text_prefix("forty") || text_run("Lead"));
+ { // lead_view_group_shows_chat_name / lead_view_lead_chat_unchanged / lead_view_chat_name_capped: the chat the desktop has open is named under the project (PM and group chats only)
+ pod_lead_t *cl = &M.swarms[0].leads[2];
+ asked_recap(&M, "sw1", "l2", "Deployed.", 1792560000u, false);
+ cl->chat = POD_CHAT_NONE; cl->chat_name[0] = 0;
+ fresh(); ph_view_lead(&F, &N, &M, 1000);
+ static ht_run_t base[HT_RUNS]; const int nbase = S.count; memcpy(base, S.runs, sizeof(ht_run_t) * (size_t)nbase);
+ cl->chat = POD_CHAT_LEAD; snprintf(cl->chat_name, sizeof cl->chat_name, "ignored"); // lead_view_lead_chat_unchanged: even with a name, a Lead chat draws today's view
+ fresh(); ph_view_lead(&F, &N, &M, 1000);
+ CHECK(S.count == nbase && !memcmp(base, S.runs, sizeof(ht_run_t) * (size_t)nbase) && !text_run("ignored"));
+ cl->chat = POD_CHAT_BUDDY;
+ fresh(); ph_view_lead(&F, &N, &M, 1000);
+ CHECK(S.count == nbase && !text_run("ignored"));
+ cl->chat = POD_CHAT_GROUP; snprintf(cl->chat_name, sizeof cl->chat_name, "review-cable-fit"); // lead_view_group_shows_chat_name
+ fresh(); ph_view_lead(&F, &N, &M, 1000);
+ const ht_run_t *cn = text_run("review-cable-fit");
+ CHECK(cn && cn->fg == ht_rgb(PH_ROOM_MUTED) && centred_run(cn) && cn->y + ph_sb_22.height * 15 / 32 >= 118 && cn->y + ph_sb_22.height * 15 / 32 <= 122 && S.count == nbase + 1);
+ cl->chat = POD_CHAT_PM; snprintf(cl->chat_name, sizeof cl->chat_name, "PM");
+ fresh(); ph_view_lead(&F, &N, &M, 1000);
+ CHECK(text_run("PM") && text_run("PM")->fg == ht_rgb(PH_ROOM_MUTED));
+ cl->chat = POD_CHAT_GROUP; cl->chat_name[0] = 0; // no name: nothing extra
+ fresh(); ph_view_lead(&F, &N, &M, 1000);
+ CHECK(S.count == nbase);
+ memset(cl->chat_name, 'W', 48); cl->chat_name[48] = 0; // lead_view_chat_name_capped
+ fresh(); ph_view_lead(&F, &N, &M, 1000);
+ const ht_run_t *cap = text_prefix("WWW");
+ CHECK(cap && cap->w <= 640 + 2 && strstr(cap->text, "\xe2\x80\xa6") && strlen(cap->text) < 48);
+ cl->chat = POD_CHAT_NONE; cl->chat_name[0] = 0;
+ }
// The model does not hold the Lead (a dropped link): nothing is drawn, nothing breaks
pod_model_link(&M, false);
fresh(); ph_view_lead(&F, &N, &M, 1000);
CHECK(S.count == 0 && pod_nav_lead(&N, &M, NULL) == NULL && ph_lead_next_ms(&N, &M, 1000) > 0 && ph_lead_max_row(&N, &M) == 0);
}
+ { // A Swarm chat's notice (mockup pro-swarm-parity 1D / 1E): "<project> · <Swarm>", the Lead's pet, no ask marks; the toast keeps its running timer
+ static pod_model_t M;
+ static pod_nav_t N;
+ static pod_swarm_t S1;
+ static const char ids[1][ID_MAX] = {"sw1"};
+ pod_model_reset(&M);
+ pod_model_link(&M, true);
+ pod_model_supertab_ids(&M, ids, 1);
+ memset(&S1, 0, sizeof S1);
+ snprintf(S1.id, ID_MAX, "sw1"); snprintf(S1.name, sizeof S1.name, "openharness");
+ S1.count = 1; S1.lead_n = 1;
+ snprintf(S1.leads[0].id, ID_MAX, "l1"); snprintf(S1.leads[0].project, sizeof S1.leads[0].project, "harness"); snprintf(S1.leads[0].engine, sizeof S1.leads[0].engine, "claude");
+ pod_model_supertab(&M, &S1, 1000);
+ pod_model_swarm_notice(&M, "sw1", "l1", "c1", "Cable fit now counts JSON tokens for the Pro. More.", 2000);
+ pod_model_clock(&M, 2000);
+ const pod_unread_t *u = pod_model_unread_find(&M, "l1");
+ CHECK(u && !strcmp(u->tab, "sw1"));
+
+ // inbox_swarm_row_name_line
+ pod_nav_init(&N);
+ N.depth = 2; N.stack[0].view = POD_V_TABS; N.stack[1].view = POD_V_INBOX;
+ fresh();
+ ph_view_inbox(&F, &N, &M, 2000);
+ const ht_run_t *nm = text_run("harness"), *tag = text_run("\xc2\xb7 openharness"), *msg = text_prefix("Cable fit now counts");
+ CHECK(nm && tag && msg && nm->fg == ht_rgb(PH_LETTER_WHO) && tag->fg == ht_rgb(0x6B4FA3) && tag->pro_font == &ph_sb_22 && tag->y == nm->y && tag->x > nm->x + ht_pro_width(&ph_sb_22, "harness") - 2);
+ CHECK(text_run("now") && !text_run("asks") && !text_run("needs you") && !text_run("stuck"));
+ { int edge = 0, badge = 0; for (int i = 0; i < S.count; i++) { edge += S.runs[i].pro_kind == K_RECT_AA && S.runs[i].w == 470 && S.runs[i].x == 190 && S.runs[i].fg != ht_rgb(PH_LETTER); badge += S.runs[i].pro_kind == K_RECT_AA && S.runs[i].fg == ht_rgb(0x3B2E55); } CHECK(!edge && !badge); }
+ CHECK(hits_of(POD_A_OPEN_NOTIF) == 1 && !strcmp(nth_hit(POD_A_OPEN_NOTIF, 0)->id, "l1"));
+
+ // toast_swarm_name_line
+ const uint32_t t0 = 5000;
+ fresh();
+ ph_toast(&F, &M, u, t0, t0 + 1000);
+ nm = text_run("harness"); tag = text_run("\xc2\xb7 openharness");
+ CHECK(nm && tag && nm->fg == ht_rgb(PH_TOAST_NAME) && tag->fg == ht_rgb(0x8EA3BD) && tag->pro_font == &ph_sb_22 && tag->x == nm->x + ht_pro_width(&ph_sb_26, "harness") + 7);
+ CHECK(text_prefix("Cable fit now counts") && S.runs[0].fg == ht_rgb(PH_TOAST_EDGE)); // the plain card, not the question's edge
+ { int bars = 0, full = 0; for (int i = 0; i < S.count; i++) if (S.runs[i].pro_kind == K_RECT && S.runs[i].pro_height == 7) { bars++; full += S.runs[i].w == 588 && S.runs[i].fg == ht_rgb(PH_TOAST_BAR); } CHECK(bars == 2 && full == 0); } // a track and a shrunk fill
+ CHECK(hits_of(POD_A_BANNER) == 1 && !strcmp(nth_hit(POD_A_BANNER, 0)->id, "l1"));
+
+ // inbox_swarm_row_goes_with_its_swarm: no project name, tag or text is left to draw once access is lost
+ pod_model_supertab_ids(&M, ids, 0);
+ CHECK(!pod_model_unread_find(&M, "l1"));
+ fresh();
+ ph_view_inbox(&F, &N, &M, 2000);
+ CHECK(!text_run("harness") && !text_prefix("\xc2\xb7") && !text_prefix("Cable fit now counts") && hits_of(POD_A_OPEN_NOTIF) == 0);
+ }
printf("test_ph_views: %d checks ok\n", checks);
return 0;
}
diff --git a/devices/harness-pro/firmware/test/test_pod_model.c b/devices/harness-pro/firmware/test/test_pod_model.c
index 98a702e9a..1a21798c4 100644
--- a/devices/harness-pro/firmware/test/test_pod_model.c
+++ b/devices/harness-pro/firmware/test/test_pod_model.c
@@ -1161,25 +1161,25 @@ static void pod_model_test_swarm_cards(void) {
// a recap for a Lead: LOADED with the text; none:true is EMPTY; an unknown Lead is dropped. Only a Lead that was asked for (LOADING) takes one: a late reply
// for a Lead already left (NONE) is ignored, not kept stale
- pod_model_supertab_recap(&M, "S1", "b", "late", 1, false);
+ pod_model_supertab_recap(&M, "S1", "b", "", "late", 1, false);
CHECK(M.swarms[0].leads[1].recap == POD_RECAP_NONE && M.swarms[0].leads[1].text == NULL);
pod_model_supertab_loading(&M, "S1", "b");
pod_model_supertab_loading(&M, "S1", "c");
- pod_model_supertab_recap(&M, "S1", "b", "hello there", 1792560000u, false);
+ pod_model_supertab_recap(&M, "S1", "b", "", "hello there", 1792560000u, false);
CHECK(M.swarms[0].leads[1].recap == POD_RECAP_LOADED && !strcmp(M.swarms[0].leads[1].text, "hello there") && M.swarms[0].leads[1].text_at == 1792560000u);
- pod_model_supertab_recap(&M, "S1", "c", "", 5, true);
+ pod_model_supertab_recap(&M, "S1", "c", "", "", 5, true);
CHECK(M.swarms[0].leads[2].recap == POD_RECAP_EMPTY && M.swarms[0].leads[2].text == NULL);
- pod_model_supertab_recap(&M, "S1", "zz", "x", 1, false);
- pod_model_supertab_recap(&M, "S9", "a", "x", 1, false);
+ pod_model_supertab_recap(&M, "S1", "zz", "", "x", 1, false);
+ pod_model_supertab_recap(&M, "S9", "a", "", "x", 1, false);
CHECK(M.swarms[0].leads[0].recap == POD_RECAP_NONE);
- pod_model_supertab_recap(&M, "S1", "b", "newer", 6, false); // an open (LOADED) Lead takes a refresh: replaces, no leak (the sanitizer build sees one)
+ pod_model_supertab_recap(&M, "S1", "b", "", "newer", 6, false); // an open (LOADED) Lead takes a refresh: replaces, no leak (the sanitizer build sees one)
CHECK(!strcmp(M.swarms[0].leads[1].text, "newer"));
pod_model_supertab_loading(&M, "S2", "x");
- pod_model_supertab_recap(&M, "S2", "x", "second", 7, false);
+ pod_model_supertab_recap(&M, "S2", "x", "", "second", 7, false);
// out of memory: the Lead stays LOADING (the retry asks again), not cold
pod_model_supertab_loading(&M, "S1", "a");
pod_big_alloc_fail = 1;
- pod_model_supertab_recap(&M, "S1", "a", "no room", 8, false);
+ pod_model_supertab_recap(&M, "S1", "a", "", "no room", 8, false);
pod_big_alloc_fail = 0;
CHECK(M.swarms[0].leads[0].recap == POD_RECAP_LOADING && M.swarms[0].leads[0].text == NULL);
pod_model_supertab_close(&M, "S1", "a");
@@ -1217,7 +1217,7 @@ static void pod_model_test_swarm_cards(void) {
// focus is kept as a pending request; the link dropping forgets the list, the texts and the focus
pod_model_supertab_loading(&M, "s0", "x");
- pod_model_supertab_recap(&M, "s0", "x", "kept?", 1, false);
+ pod_model_supertab_recap(&M, "s0", "x", "", "kept?", 1, false);
pod_model_supertab_focus(&M, "s0", "x");
CHECK(M.focus_pending && !strcmp(M.focus_tab, "s0") && !strcmp(M.focus_lead, "x"));
pod_model_link(&M, true);
@@ -1225,6 +1225,150 @@ static void pod_model_test_swarm_cards(void) {
CHECK(M.swarm_n == 0 && M.want_n == 0 && !M.focus_pending);
pod_model_reset(&M); // frees whatever a list still holds
}
+// A Lead's recap belongs to its face chat: a recap for another chat is dropped, a chat switch resets it, a frame without chat fields clears it.
+static void pod_model_test_lead_chat(void) {
+ pod_model_reset(&M);
+ const char *l1[] = {"a"};
+ pod_swarm_t s = card("S1", "T1", l1, 1);
+ s.leads[0].chat = POD_CHAT_GROUP;
+ snprintf(s.leads[0].chat_id, sizeof s.leads[0].chat_id, "g1");
+ snprintf(s.leads[0].chat_name, sizeof s.leads[0].chat_name, "review-cable-fit");
+ ids_of("S1", NULL, NULL, NULL);
+ pod_model_supertab(&M, &s, 100);
+ pod_model_supertab_loading(&M, "S1", "a");
+
+ // recap_for_old_chat_dropped
+ pod_model_supertab_recap(&M, "S1", "a", "lead-c1", "old chat", 1, false);
+ CHECK(M.swarms[0].leads[0].recap == POD_RECAP_LOADING && M.swarms[0].leads[0].text == NULL);
+ pod_model_supertab_recap(&M, "S1", "a", "g1", "this chat", 2, false);
+ CHECK(M.swarms[0].leads[0].recap == POD_RECAP_LOADED && !strcmp(M.swarms[0].leads[0].text, "this chat"));
+ pod_model_supertab_recap(&M, "S1", "a", "", "no id", 3, false); // an older daemon names none: taken
+ CHECK(!strcmp(M.swarms[0].leads[0].text, "no id"));
+
+ // chat_switch_resets_recap (and the same chat keeps it)
+ pod_model_supertab(&M, &s, 200);
+ CHECK(M.swarms[0].leads[0].recap == POD_RECAP_LOADED && !strcmp(M.swarms[0].leads[0].text, "no id"));
+ snprintf(s.leads[0].chat_id, sizeof s.leads[0].chat_id, "g2");
+ pod_model_supertab(&M, &s, 300);
+ // An asked-for Lead (the open one) waits for its new chat's message: LOADING takes the daemon's push, NONE would drop it.
+ CHECK(M.swarms[0].leads[0].recap == POD_RECAP_LOADING && M.swarms[0].leads[0].text == NULL);
+ pod_model_supertab_recap(&M, "S1", "a", "g2", "the new chat", 301, false);
+ CHECK(M.swarms[0].leads[0].recap == POD_RECAP_LOADED && !strcmp(M.swarms[0].leads[0].text, "the new chat"));
+
+ // frame_without_chat_clears_it
+ pod_swarm_t bare = card("S1", "T1", l1, 1);
+ pod_model_supertab(&M, &bare, 400);
+ CHECK(M.swarms[0].leads[0].chat == POD_CHAT_NONE && M.swarms[0].leads[0].chat_name[0] == 0 && M.swarms[0].leads[0].chat_id[0] == 0);
+
+ // recap_with_chat_id_for_lead_without_chat_is_taken
+ pod_model_supertab_loading(&M, "S1", "a");
+ pod_model_supertab_recap(&M, "S1", "a", "g1", "named", 401, false);
+ CHECK(M.swarms[0].leads[0].recap == POD_RECAP_LOADED && !strcmp(M.swarms[0].leads[0].text, "named"));
+ pod_model_reset(&M);
+}
+// A Swarm chat's notice is an unread entry keyed by its Lead: it shares the order and the cap with agent entries, and a read must match its chat.
+static void swarm_card_for_notices(void) {
+ pod_model_reset(&M);
+ const char *l1[] = {"L1", "L2"};
+ pod_swarm_t s = card("S1", "openharness", l1, 2);
+ snprintf(s.leads[0].project, sizeof s.leads[0].project, "harness");
+ ids_of("S1", NULL, NULL, NULL);
+ pod_model_supertab(&M, &s, 100);
+}
+static void pod_model_test_swarm_notice(void) {
+ // swarm_notice_replaces_per_lead
+ swarm_card_for_notices();
+ pod_model_swarm_notice(&M, "S1", "L1", "c1", "First. More.", 1000);
+ pod_model_swarm_notice(&M, "S1", "L2", "c9", "Other.", 1500);
+ pod_model_swarm_notice(&M, "S1", "L1", "c2", "Second.", 2000);
+ CHECK(M.unread_count == 2);
+ CHECK(!strcmp(M.unread[0].agent, "L1") && !strcmp(M.unread[0].tab, "S1") && !strcmp(M.unread[0].chat_id, "c2") &&
+ !strcmp(M.unread[0].text, "Second.") && !strcmp(M.unread[0].name, "harness") && M.unread[0].at_ms == 2000);
+ CHECK(!strcmp(M.unread[1].agent, "L2") && !strcmp(M.unread[1].chat_id, "c9"));
+ pod_model_swarm_notice(&M, "S1", "NOPE", "c1", "x", 2100); // a Lead the model does not hold: nothing filed
+ pod_model_swarm_notice(&M, "S9", "L1", "c1", "x", 2100);
+ CHECK(M.unread_count == 2);
+
+ // swarm_notice_cap_16 (shared with agent entries)
+ swarm_card_for_notices();
+ for (int i = 0; i < POD_UNREAD_MAX; i++) {
+ char id[8];
+ snprintf(id, sizeof id, "a%d", i);
+ pod_model_unread_add(&M, id, id, "x", 1, 1000 + (uint32_t)i);
+ }
+ CHECK(M.unread_count == POD_UNREAD_MAX);
+ pod_model_swarm_notice(&M, "S1", "L1", "c1", "News.", 3000);
+ CHECK(M.unread_count == POD_UNREAD_MAX && !strcmp(M.unread[0].agent, "L1") && !strcmp(M.unread[POD_UNREAD_MAX - 1].agent, "a1")); // the oldest (a0) went
+ CHECK(!pod_model_unread_find(&M, "a0"));
+
+ // notice_read_other_chat_keeps_row
+ swarm_card_for_notices();
+ pod_model_swarm_notice(&M, "S1", "L1", "c1", "News.", 1000);
+ CHECK(!pod_model_swarm_notice_read(&M, "S1", "L1", "c2"));
+ CHECK(!pod_model_swarm_notice_read(&M, "S2", "L1", "c1"));
+ CHECK(M.unread_count == 1);
+ CHECK(pod_model_swarm_notice_read(&M, "S1", "L1", "c1") && M.unread_count == 0);
+
+ // notice_read_before_notice_is_noop
+ swarm_card_for_notices();
+ uint32_t rev = M.revision;
+ CHECK(!pod_model_swarm_notice_read(&M, "S1", "L1", "c1"));
+ CHECK(M.unread_count == 0 && M.revision == rev);
+ pod_model_unread_add(&M, "a1", "Alpha", "x", 1, 1000); // an agent entry is never a Swarm notice's read target
+ CHECK(!pod_model_swarm_notice_read(&M, "S1", "a1", ""));
+ CHECK(M.unread_count == 1);
+
+ // swarm_leaving_the_list_drops_its_rows: access lost (removed from a project, signed out on the Mac) sends no read frame, and the row holds chat text
+ {
+ const char *l1[] = {"L1", "L2"}, *l2[] = {"L3", "L4"};
+ pod_swarm_t s1 = card("S1", "one", l1, 2), s2 = card("S2", "two", l2, 2);
+ pod_model_reset(&M);
+ ids_of("S1", "S2", NULL, NULL);
+ pod_model_supertab(&M, &s1, 100);
+ pod_model_supertab(&M, &s2, 100);
+ pod_model_swarm_notice(&M, "S1", "L1", "c1", "private one", 1000);
+ pod_model_unread_add(&M, "a1", "Alpha", "a harness's own", 1, 1100);
+ pod_model_swarm_notice(&M, "S2", "L3", "c3", "still mine", 1200);
+ pod_model_swarm_notice(&M, "S1", "L2", "c2", "private two", 1300);
+ rev = M.revision;
+ ids_of("S2", NULL, NULL, NULL);
+ CHECK(M.revision != rev);
+ CHECK(M.unread_count == 2 && !pod_model_unread_find(&M, "L1") && !pod_model_unread_find(&M, "L2"));
+ CHECK(pod_model_unread_find(&M, "L3") && pod_model_unread_find(&M, "a1")); // the Swarm still listed, and a harness's own entry
+ ids_of(NULL, NULL, NULL, NULL); // signed out: no Swarms at all
+ CHECK(M.unread_count == 1 && pod_model_unread_find(&M, "a1") && !pod_model_unread_find(&M, "L3"));
+
+ // a_listed_swarm_whose_card_has_not_come_keeps_its_row: a reorder, or the frame still on its way, is not a loss
+ pod_model_reset(&M);
+ ids_of("S1", "S2", NULL, NULL);
+ pod_model_supertab(&M, &s1, 100);
+ pod_model_swarm_notice(&M, "S1", "L1", "c1", "kept", 1000);
+ ids_of("S2", "S1", NULL, NULL);
+ CHECK(pod_model_unread_find(&M, "L1"));
+ }
+
+ // lead_leaving_its_swarm_drops_its_row
+ {
+ const char *both[] = {"L1", "L2"}, *one[] = {"L1"}, *other[] = {"L2"};
+ pod_swarm_t s1 = card("S1", "one", both, 2), s1b = card("S1", "one", one, 1), s2 = card("S2", "two", other, 1);
+ pod_model_reset(&M);
+ ids_of("S1", "S2", NULL, NULL);
+ pod_model_supertab(&M, &s1, 100);
+ pod_model_supertab(&M, &s2, 100);
+ pod_model_swarm_notice(&M, "S1", "L1", "c1", "stays", 1000);
+ pod_model_swarm_notice(&M, "S1", "L2", "c2", "private", 1100);
+ pod_model_supertab(&M, &s1, 1200); // the same Leads again: nothing goes
+ CHECK(M.unread_count == 2);
+ pod_model_supertab(&M, &s1b, 1300);
+ CHECK(M.unread_count == 1 && pod_model_unread_find(&M, "L1") && !pod_model_unread_find(&M, "L2"));
+
+ // the_same_lead_id_in_another_swarm_keeps_its_row: only the row of the Swarm it left goes
+ pod_model_swarm_notice(&M, "S2", "L2", "c9", "of the other Swarm", 1400);
+ pod_model_supertab(&M, &s1b, 1500);
+ CHECK(pod_model_unread_find(&M, "L2") && !strcmp(pod_model_unread_find(&M, "L2")->tab, "S2"));
+ }
+}
+
int main(void) {
pod_model_test_work_alt();
pod_model_test_states();
@@ -1258,6 +1402,8 @@ int main(void) {
pod_model_test_console_data();
pod_model_test_step_total_and_fresh();
pod_model_test_swarm_cards();
+ pod_model_test_lead_chat();
+ pod_model_test_swarm_notice();
printf("Pod model: PASS (%d checks)\n", checks);
return 0;
}
diff --git a/devices/harness-pro/firmware/test/test_pro_app.py b/devices/harness-pro/firmware/test/test_pro_app.py
index 7b6ad314e..7d2438bcb 100644
--- a/devices/harness-pro/firmware/test/test_pro_app.py
+++ b/devices/harness-pro/firmware/test/test_pro_app.py
@@ -350,7 +350,7 @@ static void lead_view_via_app(void) {
CHECK(top() == POD_V_LEAD && U.nav.depth == 2);
CHECK(SUP.n == 3 && !strcmp(SUP.t[0], "supertab.select") && !strcmp(SUP.t[1], "supertab.open") && !strcmp(SUP.t[2], "supertab.recap.get"));
CHECK(!strcmp(SUP.tab[2], "sw1") && !strcmp(SUP.lead[2], "l1") && !strcmp(SUP.lead[0], "l1"));
- pro_app_supertab_recap("sw1", "l1", "Merged and shipped.", 1792560000u, false); // the answer lands: drawn, nothing more sent
+ pro_app_supertab_recap("sw1", "l1", "", "Merged and shipped.", 1792560000u, false); // the answer lands: drawn, nothing more sent
render();
CHECK(U.model.swarms[0].leads[1].recap == POD_RECAP_LOADED && SUP.n == 3);
memset(&SUP, 0, sizeof SUP);
@@ -385,7 +385,7 @@ static void lead_view_scrolls_via_app(void) {
swarm_home_page();
tap(POD_A_LEAD, 1);
CHECK(top() == POD_V_LEAD && !strcmp(U.nav.stack[1].agent, "a1"));
- pro_app_supertab_recap("sw1", "l1", LONG_LEAD, 1792560000u, false);
+ pro_app_supertab_recap("sw1", "l1", "", LONG_LEAD, 1792560000u, false);
render();
CHECK(pod_scroll_max(&U.nav, &U.model) >= 2 && first_text_y("one") >= 0);
now += 2000;
@@ -2011,6 +2011,24 @@ static void notify_banner_beep_and_expiry(void) {
CHECK(BEEPS == 1 && U.model.unread_count == 1 && !pro_app_asleep());
}
+// A Swarm chat's notice through the app: an entry, the toast, one beep and a wake (a muted Pro is silent); a read removes it. Phase 1 ignores the Buddy's chat.
+static void swarm_notice_and_buddy_chat(void) {
+ notif_room();
+ swarm_feed(3);
+ pro_app_supertab_notice("sw1", "l1", "buddy", "b1", "The Buddy answered."); // buddy_chat_notice_ignored_in_phase_1
+ CHECK(BEEPS == 0 && U.model.unread_count == 0 && !U.ban_on);
+ pro_app_supertab_notice("sw1", "l1", "lead", "c1", "The Lead answered. More.");
+ CHECK(BEEPS == 1 && U.model.unread_count == 1 && U.ban_on && !strcmp(U.model.unread[0].tab, "sw1") && !strcmp(U.model.unread[0].agent, "l1"));
+ render();
+ CHECK(banner() && !strcmp(banner()->id, "l1"));
+ pro_app_supertab_notice_read("sw1", "l1", "c1");
+ render();
+ CHECK(U.model.unread_count == 0 && !U.ban_on && banner() == NULL);
+ MUTED = true; now += 40000;
+ pro_app_supertab_notice("sw1", "l2", "group", "g1", "Muted.");
+ CHECK(BEEPS == 1 && U.model.unread_count == 1);
+}
+
// The tiers: alert = entry + toast + beep + wake; list = entry only; silent = nothing. One beep per 30 s; one entry per agent.
static void notify_tiers(void) {
notif_room(); // a1's room, now = 5300
@@ -2632,7 +2650,7 @@ int main(int argc, char **argv) {
{"pro_app_test_sweep_retries", pro_app_test_sweep_retries}, {"pro_app_test_voice_gate", pro_app_test_voice_gate},
{"pro_app_test_voice_paths", pro_app_test_voice_paths}, {"pro_app_test_touch_rules", pro_app_test_touch_rules},
{"pro_app_test_roster_and_swarms", pro_app_test_roster_and_swarms}, {"side_button", side_button}, {"side_button_console", side_button_console}, {"question_needs_the_link", question_needs_the_link},
- {"notify_banner_beep_and_expiry", notify_banner_beep_and_expiry}, {"notify_tap_opens_and_swipe_dismisses", notify_tap_opens_and_swipe_dismisses},
+ {"notify_banner_beep_and_expiry", notify_banner_beep_and_expiry}, {"swarm_notice_and_buddy_chat", swarm_notice_and_buddy_chat}, {"notify_tap_opens_and_swipe_dismisses", notify_tap_opens_and_swipe_dismisses},
{"notify_never_over_talk", notify_never_over_talk}, {"notify_tiers", notify_tiers}, {"notify_question_and_error", notify_question_and_error}, {"notify_supertab_question_stays", notify_supertab_question_stays}, {"supertab_question_survives_turns", supertab_question_survives_turns}, {"supertab_question_link_drop", supertab_question_link_drop}, {"supertab_question_close_and_failure", supertab_question_close_and_failure}, {"notify_entries_expire", notify_entries_expire}, {"notify_question_entry_ends_with_question", notify_question_entry_ends_with_question}, {"notify_question_resent_after_relink_is_quiet", notify_question_resent_after_relink_is_quiet}, {"notify_question_same_prompt_new_request_beeps", notify_question_same_prompt_new_request_beeps}, {"notify_replace_seen_and_read", notify_replace_seen_and_read},
{"ota_screen_and_touch", ota_screen_and_touch}, {"voice_refused_while_updating", voice_refused_while_updating},
{"update_gate", update_gate}, {"ota_failed_returns", ota_failed_returns}, {"ota_keeps_awake", ota_keeps_awake},
diff --git a/devices/harness-pro/firmware/test/test_pro_cable.c b/devices/harness-pro/firmware/test/test_pro_cable.c
index 9cfcbcdce..4f0f8a872 100644
--- a/devices/harness-pro/firmware/test/test_pro_cable.c
+++ b/devices/harness-pro/firmware/test/test_pro_cable.c
@@ -35,7 +35,7 @@ static int checks;
// ---- the recorder --------------------------------------------------------------------------------------
enum { EV_STATS, EV_LINK, EV_AGENTS, EV_SWARMS, EV_LIBRARY, EV_CONTEXT, EV_TURN, EV_SUMMARY, EV_QUESTION, EV_QCLOSE, EV_FOCUS,
- EV_VOICE, EV_MACHINES, EV_NREPLACE, EV_NSEEN, EV_STIDS, EV_SUPERTAB, EV_STRECAP, EV_STFOCUS };
+ EV_VOICE, EV_MACHINES, EV_NREPLACE, EV_NSEEN, EV_STIDS, EV_SUPERTAB, EV_STRECAP, EV_STFOCUS, EV_STNOTICE, EV_STNOTICE_READ };
typedef struct { int kind; char id[64]; char a[2400], b[2400], c[2400], d[128]; long n1, n2, n3, n4, n5; } ev_t;
#define EV_MAX 64
static ev_t evs[EV_MAX];
@@ -88,11 +88,19 @@ void pro_app_supertab(const pod_swarm_t *sw)
rec_card = *sw;
e->n1 = sw->lead_n;
}
-void pro_app_supertab_recap(const char *tab, const char *lead, const char *text, uint32_t at, bool none)
+void pro_app_supertab_recap(const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t at, bool none)
{
- ev_t *e = add(EV_STRECAP, tab); put(e->a, lead); put(e->b, text); e->n1 = at; e->n2 = none;
+ ev_t *e = add(EV_STRECAP, tab); put(e->a, lead); put(e->b, text); snprintf(e->d, sizeof e->d, "%s", chat_id); e->n1 = at; e->n2 = none;
}
void pro_app_supertab_focus(const char *tab, const char *lead) { ev_t *e = add(EV_STFOCUS, tab); put(e->a, lead); }
+void pro_app_supertab_notice(const char *tab, const char *lead, const char *chat, const char *chat_id, const char *text)
+{
+ ev_t *e = add(EV_STNOTICE, tab); put(e->a, lead); put(e->b, chat); put(e->c, text); snprintf(e->d, sizeof e->d, "%s", chat_id);
+}
+void pro_app_supertab_notice_read(const char *tab, const char *lead, const char *chat_id)
+{
+ ev_t *e = add(EV_STNOTICE_READ, tab); put(e->a, lead); snprintf(e->d, sizeof e->d, "%s", chat_id);
+}
void pro_app_library(const pro_library_row_t *rows, int count, int offset, int total)
{
ev_t *e = add(EV_LIBRARY, NULL);
@@ -1097,6 +1105,42 @@ static void seq_gaps(void)
end_session();
}
+// Each Lead's face chat: chat / chatId / chatName on the Lead; a bad field leaves the chat NONE, never drops the Lead or the frame.
+static void test_swarm_chat(void)
+{
+ welcome();
+ reset(); // supertab_reads_chat_fields
+ feed("{\"t\":\"supertab\",\"id\":\"S1\",\"leads\":[{\"id\":\"L1\",\"chat\":\"group\",\"chatId\":\"g1\",\"chatName\":\"review-cable-fit\"},"
+ "{\"id\":\"L2\",\"chat\":\"pm\",\"chatId\":\"p1\",\"chatName\":\"Mai\"},{\"id\":\"L3\",\"chat\":\"lead\"},"
+ "{\"id\":\"L4\",\"chat\":\"buddy\"},{\"id\":\"L5\",\"chat\":\"other\",\"chatId\":\"x\"},{\"id\":\"L6\"}]}");
+ CHECK(nev == 1 && rec_card.lead_n == 6);
+ CHECK(rec_card.leads[0].chat == POD_CHAT_GROUP && !strcmp(rec_card.leads[0].chat_id, "g1") && !strcmp(rec_card.leads[0].chat_name, "review-cable-fit"));
+ CHECK(rec_card.leads[1].chat == POD_CHAT_PM && !strcmp(rec_card.leads[1].chat_id, "p1") && !strcmp(rec_card.leads[1].chat_name, "Mai"));
+ CHECK(rec_card.leads[2].chat == POD_CHAT_LEAD && rec_card.leads[3].chat == POD_CHAT_BUDDY);
+ CHECK(rec_card.leads[4].chat == POD_CHAT_NONE && rec_card.leads[5].chat == POD_CHAT_NONE &&
+ rec_card.leads[5].chat_id[0] == 0 && rec_card.leads[5].chat_name[0] == 0);
+
+ reset(); // chat_name_cut_on_codepoint: 60 bytes of "é" cut to 48 whole letters
+ char *name = repeat("\xc3\xa9", 30);
+ feedf("{\"t\":\"supertab\",\"id\":\"S1\",\"leads\":[{\"id\":\"L1\",\"chat\":\"group\",\"chatName\":\"%s\"}]}", name);
+ free(name);
+ CHECK(nev == 1 && strlen(rec_card.leads[0].chat_name) == 48);
+
+ reset(); // bad_chat_types_keep_frame
+ feed("{\"t\":\"supertab\",\"id\":\"S1\",\"leads\":[{\"id\":\"L1\",\"chat\":7,\"chatId\":9,\"chatName\":[]},"
+ "{\"id\":\"L2\",\"chat\":\"group\",\"chatId\":\"0123456789012345678901234567890123456789012345678\"}]}");
+ CHECK(nev == 1 && rec_card.lead_n == 2 && !strcmp(rec_card.leads[0].id, "L1"));
+ CHECK(rec_card.leads[0].chat == POD_CHAT_NONE && rec_card.leads[0].chat_id[0] == 0 && rec_card.leads[0].chat_name[0] == 0);
+ CHECK(rec_card.leads[1].chat == POD_CHAT_GROUP && rec_card.leads[1].chat_id[0] == 0); // an id that does not fit is empty, whole or none
+
+ reset(); // supertab_recap_reads_chat_id
+ feed("{\"t\":\"supertab.recap\",\"tab\":\"S1\",\"lead\":\"L1\",\"chatId\":\"g1\",\"text\":\"hi\",\"at\":5}");
+ CHECK(nev == 1 && evs[0].kind == EV_STRECAP && !strcmp(evs[0].d, "g1") && !strcmp(evs[0].b, "hi"));
+ reset();
+ feed("{\"t\":\"supertab.recap\",\"tab\":\"S1\",\"lead\":\"L1\",\"text\":\"hi\",\"at\":5}");
+ CHECK(nev == 1 && evs[0].d[0] == 0);
+}
+
// The Swarm cards (the hello's swarmCard:v1 is checked in test_pro_hello.py): supertabs {ids} + one supertab per Swarm +
// supertab.recap / supertab.focus in, pro_app_supertab* out.
static void test_swarm_cards(void)
@@ -1220,8 +1264,21 @@ static void test_swarm_cards(void)
// supertab.focus
reset();
feed("{\"t\":\"supertab.focus\",\"tab\":\"S1\",\"lead\":\"L2\"}");
- feed("{\"t\":\"supertab.focus\",\"tab\":\"S1\"}");
CHECK(nev == 1 && evs[0].kind == EV_STFOCUS && !strcmp(evs[0].id, "S1") && !strcmp(evs[0].a, "L2"));
+ // an empty or missing lead: open that Swarm on the Lead last shown (the app decides); an empty tab is still nothing
+ reset();
+ feed("{\"t\":\"supertab.focus\",\"tab\":\"S1\",\"lead\":\"\"}"); // focus_empty_lead_reaches_app
+ CHECK(nev == 1 && evs[0].kind == EV_STFOCUS && !strcmp(evs[0].id, "S1") && !strcmp(evs[0].a, ""));
+ reset();
+ feed("{\"t\":\"supertab.focus\",\"tab\":\"S1\"}");
+ CHECK(nev == 1 && evs[0].kind == EV_STFOCUS && !strcmp(evs[0].id, "S1") && !strcmp(evs[0].a, ""));
+ reset();
+ feed("{\"t\":\"supertab.focus\",\"tab\":\"\",\"lead\":\"L2\"}");
+ feed("{\"t\":\"supertab.focus\",\"lead\":\"\"}");
+ CHECK(nev == 0);
+ reset();
+ feed("{\"t\":\"supertab.focus\",\"tab\":\"S1\",\"lead\":5}"); // focus_non_string_lead_ignored
+ CHECK(nev == 0);
// the send helper
reset();
@@ -1332,6 +1389,38 @@ static void replug_spares_a_frame_in_flight(void)
host_present = false;
}
+// A Swarm chat's notice and its read reach the app with every field; a bad id drops the frame.
+static void test_swarm_notice(void)
+{
+ char big[ID_MAX + 8], frame[400];
+ memset(big, 'x', sizeof big - 1);
+ big[sizeof big - 1] = 0;
+
+ // supertab_notice_reaches_app
+ reset();
+ feed("{\"t\":\"supertab.notice\",\"tab\":\"S1\",\"lead\":\"L1\",\"chat\":\"lead\",\"chatId\":\"c1\",\"id\":\"n1\",\"text\":\"Done. Tests pass.\",\"at\":1}");
+ CHECK(nev == 1 && evs[0].kind == EV_STNOTICE && !strcmp(evs[0].id, "S1") && !strcmp(evs[0].a, "L1") && !strcmp(evs[0].b, "lead") &&
+ !strcmp(evs[0].d, "c1") && !strcmp(evs[0].c, "Done. Tests pass."));
+
+ // supertab_notice_read_reaches_app
+ reset();
+ feed("{\"t\":\"supertab.notice.read\",\"tab\":\"S1\",\"lead\":\"L1\",\"chatId\":\"c1\"}");
+ CHECK(nev == 1 && evs[0].kind == EV_STNOTICE_READ && !strcmp(evs[0].id, "S1") && !strcmp(evs[0].a, "L1") && !strcmp(evs[0].d, "c1"));
+
+ // notice_with_bad_ids_ignored
+ reset();
+ feed("{\"t\":\"supertab.notice\",\"tab\":\"\",\"lead\":\"L1\",\"chat\":\"lead\",\"chatId\":\"c1\",\"text\":\"x\"}");
+ feed("{\"t\":\"supertab.notice\",\"lead\":\"L1\",\"chat\":\"lead\",\"chatId\":\"c1\",\"text\":\"x\"}");
+ snprintf(frame, sizeof frame, "{\"t\":\"supertab.notice\",\"tab\":\"S1\",\"lead\":\"%s\",\"chat\":\"lead\",\"chatId\":\"c1\",\"text\":\"x\"}", big);
+ feed(frame);
+ snprintf(frame, sizeof frame, "{\"t\":\"supertab.notice\",\"tab\":\"S1\",\"lead\":\"L1\",\"chat\":\"lead\",\"chatId\":\"%s\",\"text\":\"x\"}", big);
+ feed(frame);
+ feed("{\"t\":\"supertab.notice.read\",\"tab\":\"S1\",\"lead\":\"\",\"chatId\":\"c1\"}");
+ snprintf(frame, sizeof frame, "{\"t\":\"supertab.notice.read\",\"tab\":\"%s\",\"lead\":\"L1\",\"chatId\":\"c1\"}", big);
+ feed(frame);
+ CHECK(nev == 0);
+}
+
int main(void)
{
pro_cable_start(); // the lock and the machine table; no tasks run on the host
@@ -1356,6 +1445,8 @@ int main(void)
link_resync();
seq_gaps();
test_swarm_cards();
+ test_swarm_chat();
+ test_swarm_notice();
self_replug();
replug_spares_a_frame_in_flight();
printf("test_pro_cable: %d checks passed\n", checks);
diff --git a/devices/harness-pro/firmware/test/test_pro_hello.py b/devices/harness-pro/firmware/test/test_pro_hello.py
index acc31365f..214e3e905 100644
--- a/devices/harness-pro/firmware/test/test_pro_hello.py
+++ b/devices/harness-pro/firmware/test/test_pro_hello.py
@@ -81,6 +81,7 @@ assert pairs == [
("player", "library-v1"),
("superTab", "wait-v1"),
("swarmCard", "v1"),
+ ("swarmChat", "v1"),
("ota", "v1"),
("mac", "aa"),
("settings", "{"),
diff --git a/docs/plans/2026-11-03-members-project-people-plan.md b/docs/plans/2026-11-03-members-project-people-plan.md
new file mode 100644
index 000000000..22a41c411
--- /dev/null
+++ b/docs/plans/2026-11-03-members-project-people-plan.md
@@ -0,0 +1,86 @@
+# Members, This project: active people first, the rest under Others — Implementation Plan
+
+> **For agentic workers:** this plan is carried out by the task's Engineer, task by task, test first, as the project's
+> instructions (Engineer role) say. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** With a project open and "This project" chosen, Members' People lists the people active in that project,
+busiest first, and folds everyone else who can read it under "Others (N)", folded by default; "All projects" is unchanged.
+
+**Architecture:** The open project's board already names exactly who can read the project (a private project: its
+owner and members) and counts only that project's work in each person's points. A person is active when their score
+there is above 0. A pure split in `roster_scope.dart` divides the roster's already sorted people into active and
+others; `roster.dart` lists the active ones and adds an "Others (N)" heading that folds as Idle (N) does. Until the
+board lands (or when it failed) there are no numbers to split by, so the list stays as it is today.
+
+**Tech Stack:** Flutter 3.47.2 (Desktop; the web app is the same Flutter build), flutter_test widget tests.
+
+**Spec:** Task #2319 brief (Super Tab conversation 5c8e500bb03f6e300f0a9dec), Dee's mockup in it, requested by
+
+```
+This project ▾
+People
+ (K) ken15 👑 38
+ (D) dee 30
+ (D) diego 3
+ (T) tony 3
+ (P) phamngochuy.1989 2
+ Others (2) ▸
+Agents
+ Idle (1) ▾
+ Wren idle
+```
+
+## Global Constraints
+
+- PR body first line: "Requested by [email protected] through Harness."
+- Harness design language; Dee's look is the merge gate. Screenshots in the PR, light and dark.
+- Before Ready: a test that fails without the change for each risk (active/others split, the fold, a private
+ project's members), red/green evidence in a PR comment. No backend change: the client already knows who can read
+ a private project.
+- Desktop tests use a memory store and a fake sign-in; never sign the Mac out of the real CLI.
+- Owns: desktop/lib/super_tabs/roster.dart, roster_scope.dart, desktop/test. The phone has no Members scope
+ (mobile/lib/swarm has no "This project" choice), so nothing changes there.
+
+## Review Focus
+
+- "All projects" never folds anyone: Others appears only under "This project" with a board of that project.
+- The reader themselves with 0 points folds under Others like anyone else (no special case).
+- A board still loading or failed: everyone who can read the project is listed as today, no Others heading.
+- A private project: a Swarm person who is not a member shows neither in the list nor under Others, opened.
+- Others' count and fold survive a board refresh; switching to All projects and back keeps the fold as it was.
+
+---
+
+### Task 1: Active people listed, the rest under a folded Others
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/roster_scope.dart` (add the split)
+- Modify: `desktop/lib/super_tabs/roster.dart` (`_members`: list active, then the Others heading and rows)
+- Test: `desktop/test/super_tab_roster_scope_test.dart`
+
+**Interfaces:**
+- Produces: `({List<SuperTabPerson> active, List<SuperTabPerson> others}) splitProjectPeople(List<SuperTabPerson>
+ people, Map<String, SuperTabPersonScore> scores)` — keeps the given order; active = `scores[id]?.points ?? 0` > 0.
+- Produces: key `ValueKey('super-members-others')` on the "Others (N)" heading (`SuperTabSectionHeading`,
+ `startInset: 16`, `collapsed`, `onToggleCollapsed`, as `super-members-idle`).
+
+- [ ] **Step 1: Write the failing tests** in `super_tab_roster_scope_test.dart`:
+ - `This project lists the active people busiest first, the rest folded under Others`: board owner 30, dee 12,
+ tony 0 (tony can read the project); under This project, owner above dee, tony not shown,
+ `Others (1)` shown; tap it: tony shown; tap again: hidden.
+ - `All projects folds nobody`: same Swarm, All projects: owner, dee, tony shown, no `super-members-others`.
+ - `a private project lists only its members, the idle ones under Others`: openharness private with member dee,
+ Swarm has tony too; board names owner 30, dee 0; This project: owner shown, `Others (1)`; opened: dee shown,
+ tony never shown.
+ - `splitProjectPeople keeps the order and splits on points above 0` (unit test).
+- [ ] **Step 2: Run, watch them fail** — `flutter test test/super_tab_roster_scope_test.dart`. Expected: the split
+ and private cases FAIL (no `Others` heading; tony/dee listed), All projects passes; the unit test fails to compile
+ until the function exists (stub it to return everyone as active first, so it fails on the assertion).
+- [ ] **Step 3: Commit the failing tests.**
+- [ ] **Step 4: Implement** `splitProjectPeople` and the Others heading in `_members` (only when `scoped != null &&
+ board != null`); `_othersOpen` per visit, false at first.
+- [ ] **Step 5: Run the file, then the whole `flutter test` and `flutter analyze`.** Expected: all PASS, no issues.
+- [ ] **Step 6: Screenshots** — `HARNESS_ROSTER_CAPTURE_DIR=… flutter test test/super_tab_roster_scope_test.dart
+ --name 'light and dark'` (with Others folded and opened), attach to the PR.
+- [ ] **Step 7: Commit, push, red/green comment.**
diff --git a/docs/plans/assets/members-project-people/roster-others-folded-dark.png b/docs/plans/assets/members-project-people/roster-others-folded-dark.png
new file mode 100644
index 000000000..025f875e1
Binary files /dev/null and b/docs/plans/assets/members-project-people/roster-others-folded-dark.png differ
diff --git a/docs/plans/assets/members-project-people/roster-others-folded-light.png b/docs/plans/assets/members-project-people/roster-others-folded-light.png
new file mode 100644
index 000000000..4b569f5cc
Binary files /dev/null and b/docs/plans/assets/members-project-people/roster-others-folded-light.png differ
diff --git a/docs/plans/assets/members-project-people/roster-others-open-dark.png b/docs/plans/assets/members-project-people/roster-others-open-dark.png
new file mode 100644
index 000000000..8942dfb1b
Binary files /dev/null and b/docs/plans/assets/members-project-people/roster-others-open-dark.png differ
diff --git a/docs/plans/assets/members-project-people/roster-others-open-light.png b/docs/plans/assets/members-project-people/roster-others-open-light.png
new file mode 100644
index 000000000..a45505058
Binary files /dev/null and b/docs/plans/assets/members-project-people/roster-others-open-light.png differ
diff --git a/docs/superpowers/plans/2026-10-30-harness-pro-swarm-parity.md b/docs/superpowers/plans/2026-10-30-harness-pro-swarm-parity.md
new file mode 100644
index 000000000..7ac20550c
--- /dev/null
+++ b/docs/superpowers/plans/2026-10-30-harness-pro-swarm-parity.md
@@ -0,0 +1,470 @@
+# Harness Pro Swarm Parity Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** The Harness Pro shows and alerts on the chat the desktop has open in each Swarm project, switches PM | Buddy,
+follows the desktop into a Swarm with no project open, and talks to remote Leads and Buddies, exactly as the round dial
+does.
+
+**Architecture:** The Pro adopts the round's cable protocol (hello `swarmChat v1`, then `swarmBuddy v1`, then honours
+the welcome's `swarm.remote`). The daemon already speaks all of it. Its only change is a token budget in `fitFrame`
+for the Pro's 512-token JSON guard. Three PRs, one per phase. Tasks 1–6 are PR 1, tasks 7–10 are PR 2 and task 11 is
+PR 3.
+
+**Tech Stack:**
+- Firmware: C11, ESP-IDF 5.5.4 at `~/esp/esp-idf-5.5.4`, ESP32-P4. Host tests through `test/run.sh`, using cJSON from
+ that IDF tree.
+- Daemon: TypeScript with vitest.
+
+**Spec:** `docs/superpowers/specs/2026-10-30-harness-pro-swarm-parity-design.md`.
+Mockup: `devices/harness-pro/mockup/pro-swarm-parity/index.html` in the main checkout (gitignored), screens 1A–3D.
+
+## Global Constraints
+
+- **Wire:** no new frame types and no new daemon frames. The Pro says `swarmChat: "v1"` (PR 1) and `swarmBuddy: "v1"`
+ (PR 2), never `swarmReview`.
+- **Round:** gets byte-identical frames. Every daemon change is gated on `hello.board === 'pro'` (`seqOn`).
+- **Copy, verbatim:**
+ - "No Buddy here yet"
+ - "Add one in the Harness app."
+ - "offline"
+ - "PM"
+ - "Buddy"
+- **Colours:**
+ - room ground `#221F1D` (`PH_ROOM_BG`), ink `PH_ROOM_INK`, muted `PH_ROOM_MUTED`;
+ - Swarm purple `#B79CFF`, Buddy lilac `#C49BFF`, pill track `#34302C`;
+ - inbox tag `#6B4FA3`, toast tag `#8EA3BD`.
+- **Group chat name:** the title only, with no "#".
+- **Stack caps:** every function on the cable task (`pod_model.c`, `pod_nav.c`, `pod_glue.c`, `pro_cable.c`) is
+ ≤ 1024 B and `pod/home/*.c` ≤ 4096 B (`-Wframe-larger-than`, enforced by `run.sh`).
+- **No device features beyond the spec.** Do not edit `cli/src/lib/e2ee/core.ts`.
+- **Device:**
+ - Flash only Diego's Pro, only with the repo scripts, dev build `-DPROJECT_VER=0.0.99`, and only after Diego says
+ yes. Never force-flash: the P4 bricks on a wrong-revision image.
+ - Never upload or publish firmware.
+- **Git:**
+ - Commit and push only when Diego asks. Stage only this plan's files.
+ - One PR per phase. Merge with `make merge-pr` once `ci/required` is green.
+- **Comments:** match the surrounding density. These files carry a long header comment and one-line field comments;
+ update the header comment of each view you change.
+
+## Review Focus
+
+1. **A 48-byte chat or Buddy name of multi-byte UTF-8** must be cut on a character, never mid-codepoint. Pinned in
+ Task 2 (`chat_name_cut_on_codepoint`) and Task 7.
+2. **A `supertab` frame that drops a Lead's `chat` fields** (an older daemon, or a frame resent after reconnect) must
+ not leave the last chat's name or recap on screen. Pinned in Task 2 (`frame_without_chat_clears_it`).
+3. **A `notice.read` that arrives before its `notice`** (reordered on reconnect) must not remove another chat's row or
+ crash. Pinned in Task 4 (`notice_read_other_chat_keeps_row`).
+4. **An unplug while the Buddy side is shown:** on relink the side comes from the daemon's next `supertab`, and no
+ lilac dot sticks. Pinned in Task 9 (`relink_clears_buddy_dot`).
+5. **A tap on the pill while a talk is armed** must switch side and never start a voice turn. Pinned in Task 9
+ (`pill_tap_never_talks`).
+
+---
+
+## PR 1: the chat the desktop has open (spec § Phase 1)
+
+### Task 1: Daemon token budget for the Pro
+
+**Files:**
+- Modify: `cli/src/cable/cableSession.ts:203-217` (`fitFrame`) and its caller at `:2869`
+- Test: `cli/src/cable/cableSession.spec.ts`, in `describe('swarmBuddy')` (`:4551`)
+
+**Interfaces:**
+- Produces: `fitFrame(frame, tokens?: number)`. When `tokens` is given, a frame fits only if
+ `jsonTokens(frame) <= tokens` as well as being under `CABLE_MAX_PAYLOAD`. The caller passes `SWARM_TOKENS_MAX` (480)
+ when `this.seqOn` (a Pro), else nothing.
+
+- [ ] **Step 1: Write the failing tests**
+ - `it('a Pro's swarmBuddy supertab frame stays within 480 JSON tokens with 12 Leads and a Buddy each')`
+ - 12 `withBuddy`-style Leads, every `project`, `owner`, `chatName` and `buddy.name` at 48 bytes.
+ - Hello `{ ...BUDDY, board: 'pro' }`.
+ - Assert `jsonTokens(frame) <= 480` for every `supertab` frame.
+ - Assert that when any `buddy` was dropped, the remaining ones are on the most urgent Leads (lowest indexes).
+ - `it('a round's swarmBuddy supertab frame is unchanged by the Pro budget')`
+ - The same cards with the `BUDDY` hello.
+ - Assert all 12 `buddy` blocks are present and the bytes equal the frame built before this change: snapshot the
+ `supertabBytes(port)` hex.
+ - `jsonTokens` is module-private. Export it as `export function jsonTokens` for the test only if the spec file cannot
+ reach it; otherwise count in the test with the same rule.
+- [ ] **Step 2: Run them.** `cd cli && npx vitest run src/cable/cableSession.spec.ts -t "480 JSON tokens"`.
+ Expected: the Pro test FAILs with a token count over 480. If it passes, record the measured count in the PR (spec
+ § Unverified) and keep the change as a guard.
+- [ ] **Step 3: Implement.** Add the `tokens` parameter to `fitFrame`. `fits()` becomes the byte test AND (no `tokens`
+ OR `jsonTokens(frame) <= tokens`). The existing order of cuts stands: Buddy names, then all names, then `buddy`
+ blocks from the last Lead up.
+- [ ] **Step 4: Run the tests.** `npx vitest run src/cable/cableSession.spec.ts` → PASS. Then
+ `npm run typecheck && npm run test:harnessd` → PASS.
+- [ ] **Step 5: Commit** `fix(cable): a Pro's Swarm frame fits its 512-token guard`.
+
+### Task 2: Parse and keep each Lead's face chat; gate the recap on it
+
+**Files:**
+- Modify:
+ - `devices/harness-pro/firmware/main/cable/cable_types.h:77-92`
+ - `cable/pro_cable.c` (`read_leads`, `handle_supertab_recap`)
+ - `pro_app_api.h:49`, `app/pro_app.c`
+ - `app/pod_glue.{h,c}` (`pod_ui_supertab_recap`)
+ - `pod/pod_model.{h,c}` (`pod_model_supertab`, `pod_model_supertab_recap`)
+- Test: `test/test_pro_cable.c` (the Swarm cards block, `:1100`), `test/test_pod_model.c`, and the stub in
+ `test/test_pro_cable.c:91`
+
+**Interfaces:**
+- Produces in `cable_types.h`:
+ ```c
+ typedef enum { POD_CHAT_NONE, POD_CHAT_LEAD, POD_CHAT_PM, POD_CHAT_GROUP, POD_CHAT_BUDDY } pod_chat_t;
+ // pod_lead_t gains:
+ pod_chat_t chat; // NONE: the frame named no chat (an older daemon): today's Lead view
+ char chat_id[ID_MAX], chat_name[49]; // chat_name as project: 48 bytes + NUL, cut on a codepoint
+ ```
+- Produces: `void pro_app_supertab_recap(const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t at, bool none)`,
+ with `chat_id` "" when absent. The same parameter is added to `pod_ui_supertab_recap` and `pod_model_supertab_recap`.
+- Rule in `pod_model_supertab_recap`: a non-empty `chat_id` different from the Lead's `chat_id` is dropped. In
+ `pod_model_supertab`, a Lead whose incoming `chat_id` differs from the kept one has its text freed and its recap set
+ to `POD_RECAP_NONE`, so the view asks again and shows "…".
+
+- [ ] **Step 1: Write the failing tests**
+ - In `test_pro_cable.c`:
+ - `supertab_reads_chat_fields`: feed a `supertab` whose Lead has
+ `"chat":"group","chatId":"g1","chatName":"review-cable-fit"` and check `chat == POD_CHAT_GROUP`,
+ `chat_id == "g1"` and `chat_name == "review-cable-fit"`.
+ - `chat_name_cut_on_codepoint`: a 60-byte name of "é" (2 bytes each) gives `strlen(chat_name) == 48`.
+ - `bad_chat_types_keep_frame`: `"chat":7` gives `POD_CHAT_NONE` and the Lead is still there.
+ - `supertab_recap_reads_chat_id`.
+ - In `test_pod_model.c`:
+ - `recap_for_old_chat_dropped`: Lead on `g1`, recap with `chat_id` `"lead-c1"`, so the recap stays LOADING.
+ - `chat_switch_resets_recap`: a LOADED Lead gets a frame with a new `chat_id`, so it becomes `POD_RECAP_NONE` and
+ `text == NULL`.
+ - `frame_without_chat_clears_it`: a Lead on `g1` gets a frame without chat fields, so `chat == POD_CHAT_NONE` and
+ `chat_name[0] == 0`.
+- [ ] **Step 2: Run.** `bash devices/harness-pro/firmware/test/run.sh`. Expected: compile errors on the new fields,
+ then CHECK failures.
+- [ ] **Step 3: Implement.** Add the fields. In `read_leads`, map `"lead"/"pm"/"group"/"buddy"` and anything else to
+ NONE, and copy with the file's existing UTF-8-safe copier, as for `project`. Thread `chat_id` through the four recap
+ functions. Apply the two model rules above.
+- [ ] **Step 4: Run** `run.sh` → all PASS (including `test_pro_app.py` and the golden check; no view changed yet).
+- [ ] **Step 5: Commit** `feat(pro): each Swarm Lead's face chat, and its recap only for that chat`.
+
+### Task 3: The chat name line on the Lead view
+
+**Files:**
+- Modify: `devices/harness-pro/firmware/main/pod/home/ph_lead.c` (header comment, enum, `ph_view_lead`)
+- Test:
+ - `test/test_ph_views.c`
+ - `test/pod_render.c`: new scenes `lead:group` and `lead:pm`
+ - `test/golden.txt`, regenerated
+
+**Interfaces:**
+- Consumes: Task 2's `chat`, `chat_name`.
+- Produces: `CHAT_CY = 120` in `ph_lead.c`'s enum (Task 9 moves it to 130 under the pill).
+
+- [ ] **Step 1: Write the failing tests**
+ - `lead_view_group_shows_chat_name`: a Lead with `chat = POD_CHAT_GROUP` and `chat_name = "review-cable-fit"`
+ renders a text run whose string is `"review-cable-fit"`, with its vertical centre at 120 ± 2 and colour
+ `PH_ROOM_MUTED`.
+ - `lead_view_lead_chat_unchanged`: `chat = POD_CHAT_LEAD` gives the same run list as `POD_CHAT_NONE`.
+ - `lead_view_chat_name_capped`: a 48-byte "W…" name is cut with "…" at 640 px.
+ - Add scenes `lead:group` and `lead:pm` to `pod_render.c`.
+- [ ] **Step 2: Run** `run.sh` → FAIL on the new CHECKs, and `test/golden.sh --check` → exit 1 (new scenes).
+- [ ] **Step 3: Implement.** When `chat` is `POD_CHAT_PM` or `POD_CHAT_GROUP`, draw `chat_name` with
+ `centred(s, CHAT_CY, &ph_sb_22, PH_ROOM_MUTED, …)` after `fit_line` at `HEAD_W`.
+- [ ] **Step 4: Run** `run.sh` → PASS. Run `test/golden.sh` and confirm `git diff test/golden.txt` adds only the two
+ new scenes, with every existing hash unchanged. Render both with `test/pod_render.py` and compare with mockup 1B/1C.
+- [ ] **Step 5: Commit** `feat(pro): the Lead view names the chat the desktop has open`.
+
+### Task 4: Swarm notices: toast, Notices row, read
+
+**Files:**
+- Modify:
+ - `pod/pod_model.{h,c}` (`pod_unread_t`, new functions)
+ - `cable/pro_cable.c` (dispatch at `:1014-1018`, new handlers)
+ - `pro_app_api.h`, `app/pro_app.c`
+ - `app/pod_glue.{h,c}` (notify, the toast tap and the inbox row tap for a Swarm entry)
+ - `pod/home/ph_inbox.c` (`row`: name line), `pod/home/ph_toast.c` (name line)
+- Test: `test/test_pro_cable.c`, `test/test_pod_model.c`, `test/test_ph_glue.c`, `test/test_ph_views.c`, `pod_render.c`
+ scenes `inbox:swarm` and `toast:swarm`
+
+**Interfaces:**
+- Produces in `pod_unread_t`: `char tab[ID_MAX], chat_id[ID_MAX];`. A non-empty `tab` marks a Swarm notice whose
+ `agent` is the Lead id and whose `name` is the project.
+- Produces:
+ - `void pod_model_swarm_notice(pod_model_t *, const char *tab, const char *lead, const char *chat_id, const char *text, uint32_t now_ms)`:
+ replace by `agent == lead`, move it to the top, and keep the 16 cap.
+ - `bool pod_model_swarm_notice_read(pod_model_t *, const char *tab, const char *lead, const char *chat_id)`: drop
+ only an entry with that tab, lead and chat_id. Returns true if one was dropped.
+ - `pro_app_supertab_notice(tab, lead, chat, chat_id, text)` and `pro_app_supertab_notice_read(tab, lead, chat_id)`.
+ - Glue: `bool pod_ui_swarm_notice(pod_ui_t *, const char *tab, const char *lead, const char *chat_id, const char *text, bool awake, uint32_t now_ms)`.
+ It is an alert tier: it toasts and returns true when the caller must wake and beep, unless that Lead's view is on
+ screen and the glass is lit, in which case it is read at once.
+ - `pod_ui_swarm_notice_read(pod_ui_t *, tab, lead, chat_id)` also ends that entry's toast.
+- Taps: on a Swarm entry, the toast tap and the Notices row tap open that Lead with `pod_nav_follow_lead` and queue
+ `supertab.select` through `sup_push`. They do not open Notices.
+- Phase 1 has no Buddy side. A notice with `"chat":"buddy"` is ignored until Task 9.
+
+- [ ] **Step 1: Write the failing tests**
+ - `test_pro_cable.c`:
+ - `supertab_notice_reaches_app`: `{"t":"supertab.notice","tab":"S1","lead":"L1","chat":"lead","chatId":"c1","id":"n1","text":"Done. Tests pass.","at":1}`
+ gives one `EV_STNOTICE` event with those fields.
+ - `supertab_notice_read_reaches_app`.
+ - `notice_with_bad_ids_ignored`: empty tab, or lead over `ID_MAX`.
+ - `test_pod_model.c`:
+ - `swarm_notice_replaces_per_lead`;
+ - `swarm_notice_cap_16`, shared with agent entries;
+ - `notice_read_other_chat_keeps_row`: read with chat `c2` while the entry is `c1`, so the entry stays;
+ - `notice_read_before_notice_is_noop`.
+ - `test_ph_glue.c`:
+ - `swarm_notice_toasts_and_beeps`;
+ - `swarm_notice_on_its_lead_view_reads_at_once`;
+ - `swarm_toast_tap_opens_lead_and_selects`: the top frame is `POD_V_LEAD` for L1, and `pod_ui_take_supertab`
+ yields `supertab.select S1 L1`;
+ - `swarm_row_tap_opens_lead_and_selects`;
+ - `swarm_notice_read_ends_toast`;
+ - `buddy_chat_notice_ignored_in_phase_1`.
+ - `test_ph_views.c`:
+ - `inbox_swarm_row_name_line`: the name run is `"harness"`, followed by a run `"· openharness"` in `0x6B4FA3`.
+ - `toast_swarm_name_line`: `"· openharness"` in `0x8EA3BD`, and the timer bar is drawn.
+- [ ] **Step 2: Run** `run.sh` → FAIL.
+- [ ] **Step 3: Implement.**
+ - The handlers parse with `id_fits` and the cJSON helpers.
+ - The Swarm name for the tag is looked up with `pod_model_swarm(m, entry->tab)->name` at draw time. If the Swarm is
+ gone, draw no tag.
+ - The inbox row's avatar is the Lead's engine pet (`pod_pet_for(lead->engine)`, falling back to the logo as today).
+- [ ] **Step 4: Run** `run.sh` → PASS. Run `test/golden.sh` and confirm only the new scenes were added.
+- [ ] **Step 5: Commit** `feat(pro): a Swarm chat's new message toasts and waits in Notices`.
+
+### Task 5: Follow the desktop into a Swarm with no project open
+
+**Files:**
+- Modify:
+ - `cable/pro_cable.c:652-660` (`handle_supertab_focus`)
+ - `pod/pod_model.c:874` (`pod_model_supertab_focus` keeps an empty lead)
+ - `app/pod_glue.{h,c}` (`pod_ui_t.lead_seen`, `apply_lead_focus`, `sup_sync`)
+- Test: `test/test_pro_cable.c`, `test/test_ph_glue.c`
+
+**Interfaces:**
+- Produces in `pod_ui_t`: `struct { char swarm[ID_MAX], lead[ID_MAX]; } lead_seen[SWARMS_CARD_MAX];`. It is set in
+ `sup_sync` whenever a Lead view is on screen. A new Swarm takes the first free slot, or the oldest when full.
+- Rule in `apply_lead_focus`: for an empty `focus_lead`, resolve the lead to `lead_seen` for that Swarm if it is still
+ in the Swarm, else `leads[0].id`. A Swarm not in the model waits `POD_FOLLOW_PENDING_MS`, then is dropped. The rest
+ of the function is unchanged.
+
+- [ ] **Step 1: Write the failing tests**
+ - `test_pro_cable.c`:
+ - `focus_empty_lead_reaches_app`: `{"t":"supertab.focus","tab":"S1","lead":""}` gives `EV_STFOCUS` with lead "".
+ - A missing `lead` key is treated the same.
+ - An empty `tab` is still ignored.
+ - `test_ph_glue.c`:
+ - `empty_focus_opens_last_lead`: view L2 of S1, go Home, focus S1 with "", so the top frame is L2.
+ - `empty_focus_opens_first_without_history`.
+ - `empty_focus_last_lead_gone_opens_first`.
+ - `empty_focus_unknown_swarm_waits_then_drops`.
+ - `empty_focus_respects_quiet_window`: a touch 100 ms ago means no move.
+- [ ] **Step 2: Run** `run.sh` → FAIL.
+- [ ] **Step 3: Implement** as in the Interfaces block.
+- [ ] **Step 4: Run** `run.sh` → PASS.
+- [ ] **Step 5: Commit** `fix(pro): follow the desktop into a Swarm whose Chat with PM is open`.
+
+### Task 6: Say `swarmChat v1`; PR 1 verification
+
+**Files:**
+- Modify: `cable/pro_cable.c:229` (`send_hello`), `test/test_pro_hello.py:83` (expected keys),
+ `devices/harness-pro/docs/cable.md` (the Swarm section: new fields and frames)
+
+- [ ] **Step 1: Write the failing test.** In `test_pro_hello.py`, add `("swarmChat", "v1")` after
+ `("swarmCard", "v1")`. Leave `swarmBuddy` and `swarmReview` absent.
+- [ ] **Step 2: Run** `python3 devices/harness-pro/firmware/test/test_pro_hello.py` → FAIL.
+- [ ] **Step 3: Implement.** Add `msg_string(&root, "swarmChat", "v1");` with a one-line comment naming the frames
+ it brings. Update `cable.md`.
+- [ ] **Step 4: Verify**
+ - `bash test/run.sh` → PASS, `make device-test` → PASS.
+ - `idf.py build` in `devices/harness-pro/firmware` with `-DPROJECT_VER=0.0.99` → builds. Record the image size
+ against main's.
+- [ ] **Step 5: Device check (ask Diego first).** Flash with the repo script and run spec § Testing "On Diego's Pro"
+ steps 1–3 and 6. Record `raster_max_us` before and after from the alive line.
+- [ ] **Step 6: Commit** `feat(pro): say swarmChat v1`. Open PR 1 when Diego asks: Tasks 1–6 plus the spec, with the
+ device numbers in the body.
+
+## PR 2: PM | Buddy (spec § Phase 2)
+
+### Task 7: Parse the Buddy fields and the side; send `supertab.side`
+
+**Files:**
+- Modify:
+ - `cable/cable_types.h`
+ - `cable/pro_cable.c` (`read_leads`, `handle_supertab`, `pro_cable_supertab_send`)
+ - `app/pod_glue.h:24` (`pod_supertab_out_t`)
+ - `app/pro_app.c` (the drain of `pod_ui_take_supertab`)
+- Test: `test/test_pro_cable.c`, `test/test_ph_glue.c`
+
+**Interfaces:**
+- Produces in `cable_types.h`:
+ ```c
+ typedef enum { POD_SIDE_NONE, POD_SIDE_PM, POD_SIDE_BUDDY } pod_side_t;
+ typedef struct { char chat_id[ID_MAX], name[49], engine[16]; uint16_t cells; uint32_t color; bool live; } pod_buddy_t; // color 0xRRGGBB
+ // pod_lead_t gains: bool buddies, has_buddy, buddy_unread; pod_buddy_t buddy;
+ // pod_swarm_t gains: pod_side_t side;
+ ```
+- Produces in `pod_supertab_out_t`: `char side[8]`. `t` may be `"supertab.side"`, with `lead` unused and `side`
+ `"pm"` or `"buddy"`. `pro_cable_supertab_send(t, tab, lead)` gains the allowed `"supertab.side"`, and a new
+ `bool pro_cable_supertab_side(const char *tab, const char *side)` writes `{t, tab, side}`. `pro_app.c` calls it for
+ those frames.
+- Produces: `bool pod_ui_supertab_side(pod_ui_t *, const char *tab, pod_side_t side)` queues it through `sup_push`.
+- Parse rules:
+ - `cells` must be an integer in 0..32767, else `has_buddy` is false.
+ - `color` must be `#rrggbb`, else `0xC49BFF`.
+ - `side` other than "pm"/"buddy" means NONE.
+
+- [ ] **Step 1: Write the failing tests**
+ - `supertab_reads_buddy_block`: the spec test's `buddy` object gives the matching fields, with `cells == 25513` and
+ `color == 0xD6A79A`.
+ - `buddy_bad_cells_dropped`.
+ - `buddy_name_cut_on_codepoint`.
+ - `supertab_reads_side`.
+ - `side_frame_sent`: `pod_ui_supertab_side(u, "S1", POD_SIDE_BUDDY)`, then drain, gives one
+ `{"t":"supertab.side","tab":"S1","side":"buddy"}` on the cable stub.
+- [ ] **Step 2: Run** `run.sh` → FAIL.
+- [ ] **Step 3: Implement.**
+- [ ] **Step 4: Run** `run.sh` → PASS.
+- [ ] **Step 5: Commit** `feat(pro): read each Lead's Buddy and the Swarm's side; send supertab.side`.
+
+### Task 8: The Buddy avatar
+
+**Files:**
+- Create: `devices/harness-pro/firmware/main/pod/home/ph_avatar.c`
+- Modify: `pod/home/ph.h` (declaration)
+- Test: `test/test_ph_views.c`
+
+**Interfaces:**
+- Produces: `void ph_buddy_avatar(ht_scene_t *s, int x, int y, int d, uint16_t cells, uint32_t color, unsigned bg)`.
+ - It draws a disc of diameter `d` at (x, y), filled with `color` mixed 22 % over `bg` (`ph_mix`), with a 3 px ring
+ of `color` at 33 %.
+ - The 5 × 5 pattern spans `d * 56 / 100`, centred. Cell `i` is lit when bit `row * 3 + [0,1,2,1,0][col]` of `cells`
+ is set (desktop `superTabAgentPattern`). Each lit cell is `ht_pro_rect_aa` with radius `cell / 5`, in `color`.
+ - At most 27 runs (disc, ring and 25 cells).
+
+- [ ] **Step 1: Write the failing tests**
+ - `avatar_cells_mirror`: `cells` with only bit 0 lights columns 0 and 4 of row 0, so exactly 2 cell rects.
+ - `avatar_bit7_centre`: bit 7 lights only row 2 col 2.
+ - `avatar_parity_with_desktop`: `cells = 25513` (the daemon spec's Buddy) lights exactly the cells of this grid,
+ rows top to bottom, which is desktop `superTabAgentPattern`'s mirror of those bits:
+ `#...#`, `#.#.#`, `.###.`, `#...#`, `.###.` (17 cell rects).
+- [ ] **Step 2: Run** `run.sh` → FAIL (undefined symbol).
+- [ ] **Step 3: Implement** with `pod_draw` / `pro_canvas` primitives only, staying under the 4096 B frame cap.
+- [ ] **Step 4: Run** `run.sh` → PASS.
+- [ ] **Step 5: Commit** `feat(pro): the desktop's agent pattern as the Buddy's avatar`.
+
+### Task 9: PM | Buddy on the Lead view
+
+**Files:**
+- Modify:
+ - `pod/home/ph_lead.c`: header comment; the pill; header A; `CHAT_CY` 130 under the pill; the Buddy who row; the
+ no-Buddy view; the dot
+ - `pod/pod_nav.h` (new hit `POD_A_SIDE`)
+ - `app/pod_glue.c` (the hit, `talk_target`, the quiet notice, relink)
+ - `pod/pod_model.c` (`buddy_unread`)
+- Test: `test/test_ph_views.c`, `test/test_ph_glue.c`, `pod_render.c` scenes `lead:pill`, `lead:buddy`,
+ `lead:buddy-offline`, `lead:nobuddy` and `lead:buddy-dot`, golden
+
+**Interfaces:**
+- Consumes: Task 7 fields, Task 8 `ph_buddy_avatar`, Task 4 notice path.
+- Produces: `POD_A_SIDE`, a hit only, with `arg = POD_SIDE_PM | POD_SIDE_BUDDY` and hit id = the Swarm id. The glue
+ calls `pod_ui_supertab_side`, clears `buddy_unread` on BUDDY, and sets a pressed segment that holds until the next
+ `supertab` frame for that Swarm.
+- Geometry (spec § Phase 2):
+ - pill 300 × 44 at (210, 16), radius 22, segments 150 wide, `ph_sb_22`;
+ - header line at cy 94: the Swarm name `ph_sb_26` `#B79CFF`, " · " muted, project `ph_sb_34` ink, cut at 640 px with
+ the project's end last;
+ - bubble at y 150 with 7 rows;
+ - Buddy who row: avatar d 120 centred in the 150 box at x 16, name `ph_sb_34` lilac, "offline" `ph_sb_22` muted
+ when `!buddy.live`;
+ - no-Buddy view: a dashed circle d 120 centred at x 360, cy = 150 + 100, "+" in it, "No Buddy here yet"
+ `ph_sb_34` muted at cy 364, "Add one in the Harness app." `ph_rg_28` muted at cy 412;
+ - dot: 12 px lilac at the Buddy segment's top right (x 454, y 24) with a 3 px track-coloured ring.
+- Which screen draws:
+ - the Buddy screen when the Lead's `chat == POD_CHAT_BUDDY`;
+ - no-Buddy when `buddies && side == POD_SIDE_BUDDY && !has_buddy`;
+ - the pill only when `buddies`.
+- Quiet notice: in `pod_ui_swarm_notice`, `chat == "buddy"` sets `buddy_unread` on the Lead. No toast, no entry, no
+ beep, and it returns false.
+- Relink: `pod_model_link(false)` clears every `buddy_unread`.
+
+- [ ] **Step 1: Write the failing tests**
+ - `test_ph_views.c`:
+ - `pill_absent_without_buddies`: run list equal to Task 3's.
+ - `pill_pm_selected`: segment fill `PH_ROOM_INK`.
+ - `pill_buddy_selected`: fill `0xC49BFF`.
+ - `header_a_one_line`: the project's run is centred at cy 94, and there is no run at cy 42.
+ - `chat_name_at_130_under_pill`.
+ - `buddy_screen_name_lilac`.
+ - `buddy_offline_line`: a text run "offline".
+ - `nobuddy_copy`: runs "No Buddy here yet" and "Add one in the Harness app." and no bubble fill.
+ - `buddy_dot_drawn`.
+ - `test_ph_glue.c`:
+ - `pill_tap_sends_side`: a tap at (435, 38) queues `supertab.side S1 buddy`.
+ - `pill_tap_never_talks`: an armed talk stays unfired and no `voice.begin`.
+ - `pill_pressed_until_frame`.
+ - `buddy_notice_sets_dot_only`: no toast, no unread entry, `pod_ui_swarm_notice` returns false.
+ - `opening_buddy_clears_dot`.
+ - `relink_clears_buddy_dot`.
+ - `side_kept_across_swipe`: NEXT to L2 keeps `side`.
+- [ ] **Step 2: Run** `run.sh` → FAIL. `golden.sh --check` → exit 1.
+- [ ] **Step 3: Implement.** The pill and the who row are drawn by two static functions in `ph_lead.c` to stay under
+ the frame cap. The run count must be constant per screen state; `test_ph_views.c` checks it.
+- [ ] **Step 4: Run** `run.sh` → PASS. Run `golden.sh`: new scenes are added, `lead:loaded`, `lead:remote`,
+ `lead:none` and `lead:ask` are unchanged, and Task 3's scenes are unchanged. Render the five scenes and compare with
+ mockup 2A, 3A–3D.
+- [ ] **Step 5: Commit** `feat(pro): PM | Buddy on the Lead view`.
+
+### Task 10: Say `swarmBuddy v1`; PR 2 verification
+
+**Files:** `cable/pro_cable.c` (`send_hello`), `test/test_pro_hello.py`, `devices/harness-pro/docs/cable.md`
+
+- [ ] **Step 1:** In `test_pro_hello.py`, add `("swarmBuddy", "v1")` after `swarmChat`. Run it → FAIL.
+- [ ] **Step 2:** Add the key to `send_hello` and update `cable.md`. Run → PASS.
+- [ ] **Step 3: Verify.** `run.sh`, `make device-test` and `idf.py build` (0.0.99) all pass. Device steps 4 and 6,
+ with Diego's yes.
+- [ ] **Step 4: Commit** `feat(pro): say swarmBuddy v1`. PR 2 is opened when Diego asks.
+
+## PR 3: voice (spec § Phase 3)
+
+### Task 11: Talk to a remote Lead and to the Buddy
+
+**Files:**
+- Modify:
+ - `cable/cable_features.{h,c}` (`CABLE_FEATURE_SWARM_REMOTE = 1u << 2`, name `"swarm.remote"`)
+ - `app/pod_glue.c` (`talk_target`)
+ - `cable/pro_cable.c:935` (after `cable_features_parse`: `pro_app_features(features)`)
+ - `pro_app_api.h`, `app/pro_app.c`, `app/pod_glue.h` (`pod_ui_t.swarm_remote`)
+ - `pod/home/ph_talk.c` (the name on top and the pet, for the Buddy side)
+- Test: `test/test_ph_talk.c`, `test/test_pro_cable.c` (welcome features), `test/test_pro_app.py`
+
+**Interfaces:**
+- Produces: `talk_target` returns the following for a Lead view:
+ - `l->local` when it is non-empty;
+ - else `l->id` when `u->swarm_remote`, set by `void pod_ui_set_swarm_remote(pod_ui_t *, bool on)`. `pro_app` calls
+ it from the new `void pro_app_features(uint32_t features)`, which `pro_cable.c` calls with
+ `features & CABLE_FEATURE_SWARM_REMOTE` after each welcome. It is cleared on unlink;
+ - else NULL, as today.
+ - The device never names the side. The daemon's `swarmFaceOf` picks the Buddy chat from the side it holds.
+- Pets and name: on the Buddy screen (`chat == POD_CHAT_BUDDY`), the talk view's pet engine is `buddy.engine` and its
+ name on top is `buddy.name` in lilac. Otherwise both are as today. The Pro's talk view has no "Sending to" label, so
+ none is added; the round's "Sending to your Buddy" maps to the Buddy's name here.
+
+- [ ] **Step 1: Write the failing tests**
+ - `welcome_swarm_remote_feature` (`test_pro_cable.c`): a welcome with `"features":["swarm.remote"]` gives an
+ `EV_FEATURES` event with the bit set; without it, the bit is clear.
+ - `remote_lead_talks_with_swarm_remote`: a tap on a remote Lead's view starts `voice.begin` with
+ `agentId == l->id`.
+ - `remote_lead_no_talk_without_feature`.
+ - `buddy_screen_talks_with_lead_id`: the same id as the PM side.
+ - `buddy_talk_uses_buddy_engine_pet`.
+ - `buddy_talk_names_buddy`: the name run on top is the Buddy's name, in `0xC49BFF`.
+ - `voice_error_ends_buddy_talk`: `{"t":"voice.error","message":"Could not reach your Buddy. Try again."}` ends the
+ voice state with that message (the existing path).
+- [ ] **Step 2: Run** `run.sh` → FAIL.
+- [ ] **Step 3: Implement.**
+- [ ] **Step 4: Verify.** `run.sh`, `make device-test` and `idf.py build` (0.0.99) all pass. Device step 5 with
+ Diego's yes, and step 6.
+- [ ] **Step 5: Commit** `feat(pro): talk to a Lead on another machine and to your Buddy`. PR 3 is opened when Diego
+ asks.
diff --git a/docs/superpowers/specs/2026-10-30-harness-pro-swarm-parity-design.md b/docs/superpowers/specs/2026-10-30-harness-pro-swarm-parity-design.md
new file mode 100644
index 000000000..11e462f42
--- /dev/null
+++ b/docs/superpowers/specs/2026-10-30-harness-pro-swarm-parity-design.md
@@ -0,0 +1,269 @@
+# Harness Pro: the round dial's Swarm chat, PM and Buddy
+
+Status: spec · 2026-10-30 · requester: Diego · base: `origin/main` 5754fc4b7
+Mockup: `devices/harness-pro/mockup/pro-swarm-parity/index.html` (main checkout, gitignored), screens 1A–3D, header A chosen.
+Builds on: `2026-10-28-round-dial-swarm-chat-design.md` (the chat on a project's face) and
+`2026-10-29-round-dial-pm-buddy-spec.md` (the PM and the Buddy). Wire reference: `devices/harness-pro/docs/cable.md`.
+
+## Why
+
+Since 2026-10-28 the round dial has shown the chat the desktop has open in each Swarm project. It alerts on that chat's
+new messages, and since 2026-10-29 it has had a Buddy screen per project. The Harness Pro has none of this:
+
+- Its hello (`pro_cable.c:220-240`) says `swarmCard v1` and `superTab wait-v1`, but not `swarmChat` or `swarmBuddy`. The
+ daemon therefore sends it the older frames: the Lead's last message only, and no notices.
+- It ignores `supertab.focus` with an empty Lead (`handle_supertab_focus`, `pro_cable.c:656`, `id_fits` needs a
+ non-empty id). The daemon sends that frame when the desktop opens a Swarm tab with no project open, such as its Chat
+ with PM or a DM (`cableSession.ts` `pushSwarmFocus`). So a Pro does not follow the desktop into that Swarm.
+- A tap on a Lead that runs on another machine does nothing (`pod_glue.c` `talk_target`: "empty for a remote Lead: no
+ talk"). The round posts those words into the Lead's chat by its Swarm id (`swarm.remote`, #2232).
+
+## Decisions (Diego, 2026-10-29/30)
+
+1. **Scope: the round's Swarm work, all of it.** That is the face chat, alerts, PM | Buddy, voice to a remote Lead or a
+ Buddy, and the empty-Lead focus. Nothing that the round does not do. No new device features.
+2. **Approach A: the Pro speaks the round's protocol.** Its hello adds `swarmChat: "v1"` and `swarmBuddy: "v1"`, and it
+ honours the same frames. The daemon gets no new frames. Its one change is a token budget for the Pro (§ Daemon).
+3. **Three phases, one PR each, mockup first** (this spec covers all three):
+ 1. the face chat, notices and the empty-Lead focus;
+ 2. PM | Buddy;
+ 3. voice.
+4. **PM | Buddy is two buttons at the top of the Lead view**, not a vertical swipe. A vertical drag on the Pro already
+ scrolls the message.
+5. **Header A** (mockup 2A): with Buddies on, the pill takes the top band. The Swarm and project names share one line,
+ and the bubble keeps its 7 rows at y 150.
+6. **A group chat's name is shown as its title alone**, with no "#".
+7. **A Buddy that is down shows "offline"** under its name (mockup 3B).
+
+## Behaviour
+
+### Phase 1: the chat the desktop has open
+
+- **Face chat.** The Lead view shows the chat the daemon names for the Lead (`chat`, `chatId`, `chatName` in
+ `supertab`). The daemon decides it, as for the round: the conversation the desktop has open in this project, else the
+ Lead conversation.
+- **Chat name** (mockup 1B, 1C). When `chat` is not `lead`, `chatName` is drawn under the project:
+ - `ph_sb_22`, `PH_ROOM_MUTED`, centred at cy 120, cut with "…" at 640 px.
+ - The bubble does not move. When `chat` is `lead`, the view is exactly today's (1A).
+- **Who row.** It stays the Lead's: pet, "Lead" and the status line.
+ - For a `swarmChat` device the daemon sends `state: work` only for a working group, and never `ask` or `stuck`
+ (`chatLead`).
+ - The bubble's ask/stuck edge therefore no longer appears for these Leads, as on the round.
+- **Recap.**
+ - `supertab.recap` carries `chatId`. A recap whose `chatId` is not the Lead's current `chat_id` is dropped.
+ - After a chat switch, the bubble shows "…" until the new chat's recap arrives. This is the race the round fixed in
+ #2232.
+- **Notices** (mockup 1D, 1E). `supertab.notice {tab, lead, chat, chatId, id, text, at}`:
+ - **Toast:** the `ph_toast` card. The name is the project, followed by "· <Swarm name>" in the Super Tab tag style
+ (`ph_sb_22`, `#8EA3BD`). The line is the text's first sentence, and the timer runs as for an agent's notice.
+ - **Notices row:** one per Lead, keyed by (tab, lead), with the newest replacing the older one.
+ - It uses the inbox bubble. The name line is "<project> · <Swarm name>" (tag in `#6B4FA3`), with the age at the
+ right.
+ - The avatar is the Lead's pet.
+ - It has no ask edge and no diamond badge, because those mark a Super Tab question.
+ - Order: after the asking agents, merged with the agent entries newest first.
+ - **Tap** on the toast or the row: open that Lead's view (`pod_nav_follow_lead`) and send `supertab.select`, as a tap
+ on a Swarm card's pet does.
+ - **`supertab.notice.read {tab, lead, chatId}`:** remove the row whose `chatId` matches, and end its toast if it is
+ up.
+ - **Sound:** a notice uses the beep and wake of an agent's alert notice. A Pro that is muted stays silent.
+- **Empty-Lead focus.** `supertab.focus {tab, lead: ""}` opens that Swarm's Lead view:
+ - on the Lead it last showed in that Swarm (kept in RAM per Swarm id, lost on reboot);
+ - else on its first Lead.
+ - A Swarm not in the list yet waits `POD_FOLLOW_PENDING_MS`, as a named Lead does today.
+ - The quiet-window and talking rules of `apply_lead_focus` apply unchanged.
+
+### Phase 2: PM | Buddy
+
+- **The pill** (mockup 2A). It is shown only when the Lead carries `buddies: true`.
+ - Geometry: 300 × 44 at (210, 16), radius 22, track `#34302C`. It has two 150 px segments, "PM" and "Buddy"
+ (`ph_sb_22`).
+ - The selected segment is filled: PM in `PH_ROOM_INK` with dark text, Buddy in lilac `#C49BFF` with dark text. The
+ Swarm purple `#B79CFF` is too close to lilac to mark PM.
+ - With the pill, the header is one line centred at cy 94: the Swarm name in Swarm purple (`ph_sb_26`), " · " muted,
+ then the project (`ph_sb_34`). Cut with "…" at 640 px, the project's end last.
+ - The chat name, when shown, moves to cy 130. The bubble stays at y 150, 7 rows.
+ - With Buddies off the view is exactly phase 1's.
+- **Switching.**
+ - A tap on a segment sends `supertab.side {tab, side: "pm" | "buddy"}`. The view changes when the daemon's next
+ `supertab` frame says so (`side`, and the face chat it carries).
+ - The pressed segment shows pressed at once, so the tap is seen.
+ - The newest of the dial and the desktop wins. That is the daemon's rule (`cards.ts` `side()`, cleared when the
+ desktop's open chat changes).
+ - The side is per Swarm and kept across a horizontal swipe to another Lead.
+ - The pill is a hit, so `talk_target` skips it as it skips `POD_A_BACK`.
+- **Buddy screen** (mockup 3A–3C). It shows when the face chat is `chat: "buddy"`.
+ - **Avatar.** The Buddy's avatar replaces the pet:
+ - the desktop pattern (`desktop/lib/super_tabs/avatar_art.dart`), from `buddy.cells` (15-bit half, mirrored
+ `[0,1,2,1,0]` over 5 rows) and `buddy.color`;
+ - a disc of 120 px centred in the pet's 150 px box, the pattern at 56 % with cells rounded at 20 %;
+ - no engine badge.
+ - It is a port of the round's drawing (`supertab.c` / `ui_habitat.c`) to `ht_pro` primitives.
+ - **Name.** In place of "Lead", the Buddy's `name` in lilac (`ph_sb_34`).
+ - **Status.** Under the name, "offline" in `PH_ROOM_MUTED` while `live` is false, else nothing.
+ - **Bubble.** The Buddy's last message in that chat (the recap).
+ - **No Buddy** (`buddies: true`, no `buddy`):
+ - no bubble and no who row;
+ - a dashed 120 px circle with "+" centred at x 360;
+ - "No Buddy here yet" (`ph_sb_34`, muted) and "Add one in the Harness app." (`ph_rg_28`, muted) under it.
+ - The Pro cannot add a Buddy.
+- **The Buddy's quiet notice** (mockup 3D). A `supertab.notice` with `chat: "buddy"` raises:
+ - no toast, no Notices row and no beep;
+ - a 12 px lilac dot at the Buddy segment's top right, while the PM side is shown.
+ - Opening the Buddy side clears the dot. The daemon reads the notice when the Buddy chat becomes the open chat and
+ sends `supertab.notice.read`. The Pro also clears the dot locally on the tap, so it never lingers on a lost frame.
+
+### Phase 3: voice
+
+- **Tap target.** Tapping the Lead view starts listening, as today, with these targets:
+ - **PM side, local Lead:** its harness id, as today. The daemon posts into the face chat (`swarmSay`).
+ - **PM side, remote Lead:** the Lead's Swarm id. This is sent only when the daemon's welcome lists `swarm.remote`
+ (new `CABLE_FEATURE_SWARM_REMOTE` in the Pro's `cable_features`). An older daemon gets no target, as today.
+ - **Buddy side:** the same id as on the PM side. The device names no chat. The daemon finds the Lead by that id
+ and posts into the face of the side it holds for the Swarm (`swarmFaceOf`: `lead.sideChat ?? lead.chat` for a
+ `swarmBuddy` session), which is the Buddy chat, as the person.
+ - A Buddy post that fails is a voice error ("Could not reach your Buddy. Try again."), never a terminal turn.
+- **Pet and name.** While listening and sending, the pet is the engine of the chat being spoken to: the Lead's on the
+ PM side, `buddy.engine` on the Buddy side. The Pro's talk view shows a name on top and no "Sending to" label, so on
+ the Buddy side the name is the Buddy's, in lilac. That is the Pro's form of the round's "Sending to your Buddy".
+- **Refusals.** A post the backend refused comes back as `voice.error` and shows through the existing
+ `handle_voice_error` → `PRO_VOICE_ERROR` path. It never becomes a terminal turn; that rule is in the daemon already.
+
+## Wire
+
+No new frame types. Everything below is what the daemon already sends to a round with the same hello.
+
+| Hello flag (Pro → daemon) | Phase | Effect |
+|---|---|---|
+| `swarmChat: "v1"` | 1 | Lead entries carry `chat`, `chatId`, `chatName`; `supertab.recap` carries `chatId`; `supertab.notice` and `supertab.notice.read` are sent |
+| `swarmBuddy: "v1"` | 2 | Lead entries carry `buddies` and `buddy {chatId, name, engine, cells, color, live}`; the face may be `chat: "buddy"`; the Pro may send `supertab.side` |
+| welcome `features: swarm.remote` (daemon → Pro) | 3 | the Pro may name a remote Lead by its Swarm id in `voice.begin` |
+
+- The Pro never sends `swarmReview`; the round does not either.
+- A daemon from before ignores the hello flags it does not know, and the Pro gets today's frames. The Pro then behaves
+ as today, because every new field is optional when parsed.
+
+## Daemon
+
+The one change is in `cli/src/cable/cableSession.ts` `fitFrame`:
+
+- **Problem.** The Pro's JSON guard rejects any frame over 512 tokens whole (`cable_json_guard.c`, `CABLE_JSON_TOKENS`).
+ `fitFrame` sizes the `supertab` frame by bytes only.
+ - A `swarmBuddy` frame with 12 Leads, each with a Buddy, comes to about 440–480 tokens: 12 × (chatLead fields, plus
+ `buddies`, plus a `buddy` object of 7 keys).
+ - A Swarm with many Leads could therefore blank the Pro's Swarm view.
+- **Fix.** For a device whose hello says `board: pro`, `fits()` also requires `jsonTokens(frame) <= SWARM_TOKENS_MAX`
+ (480, the budget the `swarms` frame already uses). Its last step already deletes `buddy` blocks from the least
+ urgent Lead up, and that step is what brings the token count down.
+- The round keeps byte-only fitting and gets byte-identical frames.
+
+## Firmware
+
+All changes are in `devices/harness-pro/firmware/main/`.
+
+| File | Change |
+|---|---|
+| `cable/pro_cable.c` | hello flags (phase 1: `swarmChat`, phase 2: `swarmBuddy`); `read_leads` parses `chat`, `chatId`, `chatName`, `buddies`, `buddy`; `handle_supertab` reads `side`; `handle_supertab_recap` reads `chatId`; new `handle_supertab_notice`, `handle_supertab_notice_read`; `handle_supertab_focus` accepts an empty Lead; `supertab.side` sender |
+| `cable/cable_features.{h,c}` | `CABLE_FEATURE_SWARM_REMOTE` for `swarm.remote` (phase 3), handed to the glue through `pro_app_features` |
+| `cable/cable_types.h`, `pod/pod_model.{h,c}` | `pod_lead_t`: `chat` (enum lead/pm/group/buddy), `chat_id[ID_MAX]`, `chat_name[49]` (as `project`), `buddies`, `has_buddy`, `buddy {chat_id, name, engine, cells, color, live}`, `buddy_unread`; `pod_swarm_t`: `side`; `pod_unread_t` gains `tab[ID_MAX]` and `chat_id[ID_MAX]`: a Swarm notice is an unread entry whose `agent` is the Lead id and whose `tab` is set, so the 16 cap, the order, the toast and the inbox rows are shared with agent notices |
+| `pod/home/ph_lead.c` | chat name line, pill and header A, Buddy who row, no-Buddy view, lilac dot |
+| `pod/home/ph_avatar.c` (new) | the Buddy avatar disc and pattern |
+| `pod/home/ph_inbox.c` | Swarm notice rows merged into the list |
+| `pod/home/ph_toast.c` | a Swarm notice's toast (project · Swarm name) |
+| `app/pod_glue.{h,c}` | the last Lead shown per Swarm (`pod_ui_t.lead_seen[SWARMS_CARD_MAX]`, set while a Lead view is on); empty-Lead focus in `apply_lead_focus`; pill hits; notice taps; `talk_target` for a remote Lead and the Buddy side |
+| `app/pro_app.c`, `pro_app_api.h` | the new model entry points under the app lock |
+
+The limits are the existing ones: `SWARM_LEADS_MAX`, `ID_MAX` 48, `CABLE_NAME_MAX` 40. A 48-byte `chatName` fits `chat_name[49]`; anything longer is cut on a character.
+
+## What does not change
+
+- The Swarm card on Home, its pages and its pets.
+- The horizontal swipe between Leads, the vertical scroll of the message, and `supertab.open` / `supertab.select` and
+ their echo suppression.
+- Agent notices, Super Tab questions and their toasts.
+- The round dial, which gets byte-identical frames.
+
+## Design (docs/feature-design-rules.md)
+
+Reviewed revision: ______ Reviewer (another engine): ______
+
+1. **Growth:**
+ - Swarm notices share the unread list's `POD_UNREAD_MAX` (16) and its 6 h TTL, the oldest going first. The glue
+ keeps one last Lead per Swarm in a fixed array of `SWARMS_CARD_MAX`.
+ - The daemon keeps nothing new. [ ]
+2. **Concurrency:**
+ - Frames are parsed on the cable task into staging, and the model is changed under `pro_app_lock`, as for
+ `supertab` today.
+ - A pill tap and a desktop change can race. The daemon's newest-wins rule settles it, and the Pro draws what the
+ next `supertab` says. [ ]
+3. **Read cost:**
+ - No new reads. The daemon already computes the face chat, recaps and notices for the round.
+ - With both a round and a Pro attached, each session reads as it does today for one round. [ ]
+4. **Scale:** 12 Leads with Buddies stay at or under 480 tokens (test). Beyond that, Buddy blocks drop first, then the
+ view shows "No Buddy here yet" for those Leads. That is a known limit, logged by `fitFrame`. [ ]
+5. **Compatibility:**
+ - A new Pro with an old daemon gets today's frames.
+ - An old Pro with a new daemon is unchanged, because it does not say the flags.
+ - The round is unchanged.
+ - Readers of the frames: `cableSession.ts`, `cable_client.c` (round), `pro_cable.c`. [ ]
+6. **Migration and rollback:**
+ - CLI first (the token budget), then firmware. Each is safe alone.
+ - Rolling back the Pro firmware stops the flags, and the Pro returns to today's view. [ ]
+7. **Audience:**
+ - The face chat, PM recaps and Buddy chats are the signed-in person's own (`visibleState`, `groupView`).
+ - The daemon owns the USB device only for the console user, never the Team account. [ ]
+8. **Identity:** reads and voice posts run as the signed-in person (`backend(this.core, …)`), as for the round. [ ]
+9. **Failure:**
+ - A lost `supertab.side` leaves the old side, and the pressed segment returns to it on the next frame.
+ - A lost `notice.read` leaves a row the person can tap, and the next replay drops it.
+ - A frame over the guard is rejected whole. The daemon budget prevents that, and the guard's log line names it. [ ]
+10. **Platforms:** daemons on macOS, Linux and Windows alike. Firmware ESP32-P4 only. [ ]
+
+## Testing
+
+Each phase is one PR, with the failing test first.
+
+- **Daemon** (`cli/src/cable/cableSession.spec.ts`), phase 1 PR:
+ - A `board: pro` `swarmBuddy` session with 12 Leads, every name at 48 bytes and a Buddy each: every `supertab` frame
+ has `jsonTokens` ≤ 480. The least urgent Leads' `buddy` blocks go first.
+ - A round session with the same data gets byte-identical frames to today.
+- **Firmware host tests** (`devices/harness-pro/firmware/test`: `test_pod_model.c`, `test_ph_glue.c`, `test_ph_views.c`,
+ `test_pro_app.py`, golden):
+ - **Parse:** `chat`, `chatId`, `chatName`, `buddies`, `buddy`, `side`. Over-long strings are cut on a character, and
+ wrong types are skipped without losing the frame. A frame without the fields parses as today.
+ - **Recap:** a recap for another `chatId` is dropped, and the bubble shows "…" after a chat switch.
+ - **Focus:**
+ - an empty Lead opens the Swarm on its last Lead, else the first;
+ - an unknown Swarm waits, then drops;
+ - the quiet window still holds a focus.
+ - **Notices:**
+ - add, replace per Lead and the 16 cap;
+ - `notice.read` removes the matching `chatId` only;
+ - a tap opens the Lead and sends `supertab.select`;
+ - a Buddy notice adds no row and no toast, and sets only the dot.
+ - **Pill:** a tap sends `supertab.side` with the right side and does not start a talk. The pill is absent without
+ `buddies`.
+ - **Voice:**
+ - a remote Lead's tap names its Swarm id only with `swarm.remote`;
+ - the Buddy side names the Lead with the Buddy side;
+ - `voice.error` ends the voice state with the message.
+ - **Views (golden, run count constant per screen):** 1A–1C, 2A, 3A–3D, and Notices with a Swarm row. Ink stays
+ inside 720 × 720.
+ - `bash test/run.sh` and `make device-test`.
+- **On Diego's Pro** (dev build 0.0.99, flashed with the repo scripts after Diego's yes, never force-flashed):
+ 1. The desktop opens a group, then the Lead chat: the Pro follows, and the name line comes and goes.
+ 2. The desktop opens another Swarm's Chat with PM: the Pro moves into that Swarm.
+ 3. A new Lead message makes a toast and a row. Opening the chat on the desktop removes both.
+ 4. The PM and Buddy buttons work both ways with the desktop, and the lilac dot shows and clears.
+ 5. Voice works for a remote Lead and for the Buddy. A refused post shows as a voice error.
+ 6. `raster_max_us` in the alive line is no higher than before, and the link shows corrupt 0.
+
+## Unverified
+
+- That 12 Leads with Buddies and 48-byte names exceed 480 tokens. The estimate is 440–480. The daemon test measures it
+ first, and if it fits, the budget is kept as a guard.
+- ~~How a voice turn names the Buddy side.~~ Checked 2026-10-30: it does not. `voice.begin` carries the Lead's id
+ (its local harness, or its Swarm id when remote), and the daemon takes the side it holds (`swarmFaceOf`,
+ `cableSession.ts:2758`).
+- ~~Whether the fonts exist.~~ Checked 2026-10-30: `ph_sb_22`, `ph_sb_26`, `ph_sb_34` and `ph_rg_28` are in the Pro's
+ set.