The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Merge batch 10-29 ac: 6 reviewed PRs (#2137, #2141, #2146, #2147, #2148, #2150) (#2164)
0xken15f8fd3b1fbc31
diff --git a/backend/integration/superTabTidy.test.ts b/backend/integration/superTabTidy.test.tsindex 3590f0ad9..c5704593f 100644--- a/backend/integration/superTabTidy.test.ts+++ b/backend/integration/superTabTidy.test.ts@@ -253,7 +253,8 @@ describe('a review the Swarm opens by itself', () => {const builder = await f.add(reviewed, 'test-host', randomUUID(), 'Builder')const work = String((await f.execute({ type: 'work.assign', conversationId: reviewed, agentId: builder })).result.assignmentId)const reviewer = await f.add('lead', 'test-host', randomUUID(), 'Reviewer')- await f.started(reviewer, { role: 'reviewer' })+ // On another engine than the Builder's: a review never runs on the reviewed Builder's own (rules.ts reviewRefusal).+ await f.started(reviewer, { role: 'reviewer', configuration: { ...config, engine: config.engine === 'claude' ? 'codex' : 'claude', model: config.engine === 'claude' ? 'default' : 'opus' } })await f.delivered()await f.execute({ type: 'work.status', conversationId: reviewed, assignmentId: work, status: 'review',result: 'Ready: yes, revision abc..def. https://github.com/example/parser/pull/9' }, host, builder)diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.tsindex f335ef25a..68c6054f5 100644--- a/backend/integration/superTabs.test.ts+++ b/backend/integration/superTabs.test.ts@@ -1999,6 +1999,23 @@ describe('Super Tabs on a real Mongo replica set', () => {}})+ it('judges a review verdict\'s step up by the tab\'s own ratings', async () => {+ const { tab } = await fixture()+ const group = (await run(tab, { type: 'conversation.create', title: 'Docs', brief: 'Fix the docs.', checks: [{ description: 'Reviewed', independent: true }] })).result.conversationId as string+ const sonnet = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(), name: 'Sonnet',+ configuration: { ...config, engine: 'claude', model: 'claude-sonnet-4-5' }, lead: false })).result.agentId as string+ const assignmentId = (await run(tab, { type: 'work.assign', conversationId: group, agentId: sonnet })).result.assignmentId as string+ // The task stepped up to Sonnet before; this tab's owner rates Sonnet at the top tier, so its failed review steps nothing up.+ const part = await db.swarmGroup.findFirstOrThrow({ where: { tabId: tab, key: group } })+ await db.swarmGroup.update({ where: { id: part.id }, data: { version: part.version + 1,+ data: { ...part.data as object, stepUp: { attempt: 2, floor: 2, reason: 'Its first review said Ready no.', at: 1, carry: '' } } } })+ await run(tab, { type: 'tab.routingPolicy', policy: { models: DEFAULT_ROUTING_POLICY.models.map(m => m.model === 'sonnet' ? { ...m, quality: 3 } : m) } })+ const checkId = (await store.read(owner, tab)).state.conversations.find(c => c.id === group)!.checks[0]!.id+ await run(tab, { type: 'work.check', conversationId: group, assignmentId, checkId, passed: false, evidence: 'Ready: no.' })+ const after = (await store.read(owner, tab)).state.conversations.find(c => c.id === group)!+ expect(after.assignment).toMatchObject({ id: assignmentId, status: 'working' })+ })+it('stores the account routing policy with revisions and merges the owner policy into each tab', async () => {const initial = await store.accountPolicy(owner)expect(initial).toEqual({ policy: DEFAULT_ROUTING_POLICY, revision: 0, isDefault: true })diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.tsindex c898f98a0..23b4655e7 100644--- a/backend/src/superTabs/commands.test.ts+++ b/backend/src/superTabs/commands.test.ts@@ -1192,11 +1192,81 @@ describe('Reviewer role', () => {expect(() => f.run(start, leadActor, { contribution })).toThrow('Route this task first')const startId = f.run({ ...start, ...via } as Command, leadActor, { contribution, ...decisionIn(group) }).result.startId as stringf.run({ type: 'agent.startDispatch', startId }, leadActor, { contribution })- const reviewer = f.run({ type: 'agent.started', startId, harnessId: 'native-reviewer', configuration: { ...config, engine: 'claude' } }, leadActor, { contribution }).result.agentId as string+ // A review needs a model the policy names at quality 2 or more (rules.ts reviewRefusal).+ const reviewer = f.run({ type: 'agent.started', startId, harnessId: 'native-reviewer', configuration: { ...config, engine: 'claude', model: 'claude-opus-4-7' } }, leadActor, { contribution }).result.agentId as stringconst builder = f.add('builder', 'owner', group)return { f, lead, leadActor, group, reviewer, builder }}+ it('refuses an agent\'s review pick on the grid, below quality 2 or on the Builder\'s engine, whatever the soft rules; a person gets a warning', () => {+ const { f, leadActor, group, reviewer, builder } = reviewed()+ f.run({ type: 'work.assign', conversationId: group, agentId: builder })+ f.run({ type: 'rule.set', rule: { kind: 'preferEngine', taskKind: 'review', engine: 'codex' }, text: 'Codex reviews.' } as Command)+ const review = f.run({ type: 'conversation.create', title: 'Review', brief: 'Review it.', reviewOf: group, checks: [{ description: 'Verdict', independent: false }] },+ leadActor).result.conversationId as string+ const route = (pick: Record<string, unknown>) => f.run({ type: 'route.record', conversationId: review, decision: record({ candidates: [candidate('c0', pick)], pick: 'c0' }) } as Command, leadActor)+ expect(() => route({ model: 'default', effort: 'default', quality: 2, cost: 1, gridModel: 'moonshotai/kimi-k3', gridName: 'swarm-g' }))+ .toThrow('A review never runs on a model served on the Swarm\'s grid. Route again.')+ expect(() => route({ model: 'haiku', effort: 'auto', quality: 3 })).toThrow('A review needs a model of quality 2 or more, and Claude haiku is 1. Route again.')+ // The Builder runs Codex.+ expect(() => route({ engine: 'codex', model: 'default', effort: 'default' })).toThrow('A review runs on another engine than the reviewed Builder\'s, Codex. Route again.')+ expect(route({}).result.routeDecisionId).toBeTruthy()+ // A model the policy does not name is rated 1.+ expect(() => route({ model: 'default', effort: 'default' })).toThrow('Claude default is 1.')+ // A person assigning a grid Reviewer by hand is told.+ f.state.agents.find(a => a.id === reviewer)!.gridModel = 'qwen3'+ const byHand = f.run({ type: 'work.assign', conversationId: review, agentId: reviewer })+ expect(byHand.result.warnings).toEqual(['A review never runs on a model served on the Swarm\'s grid.'])+ })++ it('lets a Claude-only Swarm review a Claude Builder\'s work on Opus, never below the top tier, and records why on the decision', () => {+ const { f, leadActor, group, builder } = reviewed()+ // Every agent runs Claude and no machine offers Codex: no Reviewer of another engine can run here.+ for (const a of f.state.agents) a.configuration = { ...a.configuration, engine: 'claude' }+ f.run({ type: 'work.assign', conversationId: group, agentId: builder })+ const review = f.run({ type: 'conversation.create', title: 'Review', brief: 'Review it.', reviewOf: group, checks: [{ description: 'Verdict', independent: false }] },+ leadActor).result.conversationId as string+ const route = (pick: Record<string, unknown>) => f.run({ type: 'route.record', conversationId: review, decision: record({ candidates: [candidate('c0', pick)], pick: 'c0' }) } as Command, leadActor)+ expect(route({}).routeDecisions[0]).toMatchObject({ record: { sameEngine: 'No Reviewer on another engine than the Builder\'s (Claude) can run in this Swarm, so the review runs on it at the top tier.' } })+ expect(() => route({ model: 'sonnet', effort: 'medium', quality: 2 }))+ .toThrow('A review on the reviewed Builder\'s engine, Claude, needs its top tier (quality 3): no Reviewer on another engine can run in this Swarm. Route again.')+ expect(() => route({ model: 'default', effort: 'default' })).toThrow('Claude default is 1.')+ expect(() => route({ model: 'default', effort: 'default', gridModel: 'moonshotai/kimi-k3', gridName: 'swarm-g' })).toThrow('never runs on a model served on the Swarm\'s grid')+ // A machine that offers Codex makes the other engine available, and the same engine is refused again.+ f.state.machines = [{ machineId: 'codex-box', contributorId: 'owner', engines: ['codex'] } as never]+ expect(() => route({})).toThrow('A review runs on another engine than the reviewed Builder\'s, Claude. Route again.')+ // Unless that machine may not run the review: the owner's rules, or the task's own machine (review of ee4ee6c9a).+ f.run({ type: 'rule.set', rule: { kind: 'machines', machineIds: ['host', 'machine'] }, text: 'Only our machines.' } as Command)+ expect(route({}).routeDecisions[0]).toMatchObject({ record: { sameEngine: expect.stringContaining('top tier') } })+ f.run({ type: 'rule.remove', ruleId: f.state.rules!.at(-1)!.id } as Command)+ f.state.conversations.find(c => c.id === review)!.task = { goal: 'g', changes: 'c', constraints: 'k', owns: [], requires: { machines: ['machine'] } }+ expect(route({}).routeDecisions[0]).toMatchObject({ record: { sameEngine: expect.stringContaining('top tier') } })+ })++ it('never lets a small or unnamed model review: a review needs a model the policy names at quality 2 or more', () => {+ const { f, leadActor, group, builder, reviewer } = reviewed()+ // The Builder runs Claude; Codex, the other engine, is free to review.+ f.state.agents.find(a => a.id === builder)!.configuration.engine = 'claude'+ f.run({ type: 'work.assign', conversationId: group, agentId: builder })+ const review = f.run({ type: 'conversation.create', title: 'Review', brief: 'Review it.', reviewOf: group, checks: [{ description: 'Verdict', independent: false }] },+ leadActor).result.conversationId as string+ const route = (pick: Record<string, unknown>) => f.run({ type: 'route.record', conversationId: review, decision: record({ candidates: [candidate('c0', pick)], pick: 'c0' }) } as Command, leadActor)+ expect(() => route({ engine: 'codex', model: 'gpt-5.5-mini', effort: 'high' })).toThrow('A review needs a model of quality 2 or more, and Codex gpt-5.5-mini is 1.')+ expect(() => route({ engine: 'codex', model: 'gpt-5-nano', effort: 'high' })).toThrow('Codex gpt-5-nano is 1.')+ expect(route({ engine: 'codex', model: 'default', effort: 'default' }).result.routeDecisionId).toBeTruthy()+ // A member is rated by what it runs; one launched on the engine's own model by that model's row.+ const member = (configuration: Record<string, unknown>) => {+ Object.assign(f.state.agents.find(a => a.id === reviewer)!.configuration, configuration)+ return () => route({ kind: 'member', agentId: reviewer, machineId: 'host' })+ }+ expect(member({ engine: 'codex', model: 'gpt-6.1-sol' })).not.toThrow()+ // A known small model it reports is never promoted by its launch (review of ee4ee6c9a).+ expect(member({ engine: 'codex', model: 'gpt-5.5-mini' })).toThrow('Codex gpt-5.5-mini is 1.')+ expect(member({ engine: 'codex', model: 'gpt-5-nano' })).toThrow('Codex gpt-5-nano is 1.')+ f.state.starts!.find(s => s.harnessId === 'native-reviewer')!.request.model = 'gpt-6.1-sol'+ expect(member({ engine: 'codex', model: 'gpt-6.1-sol' })).toThrow('Codex gpt-6.1-sol is 1.')+ })+it('stores the role chosen at start and reads agents without one as Builders', () => {const { f, reviewer, builder } = reviewed()expect(f.state.agents.find(a => a.id === reviewer)).toHaveProperty('role', 'reviewer')@@ -1292,7 +1362,7 @@ describe('Reviewer role', () => {const startId = f.run({ type: 'agent.start', request: request('lead', { role: 'reviewer', engine, name: 'Second reviewer' }), ...via } as Command, leadActor,{ contribution, ...decisionIn('lead') }).result.startId as stringf.run({ type: 'agent.startDispatch', startId }, leadActor, { contribution })- const fresh = f.run({ type: 'agent.started', startId, harnessId: 'native-fresh', configuration: { ...config, engine } }, leadActor, { contribution }).result.agentId as string+ const fresh = f.run({ type: 'agent.started', startId, harnessId: 'native-fresh', configuration: { ...config, engine, ...engine === 'claude' ? { model: 'claude-opus-4-7' } : {} } }, leadActor, { contribution }).result.agentId as stringconst built = f.run({ type: 'work.assign', conversationId: group, agentId: builder }).result.assignmentId as stringconst builderActor: Actor = { kind: 'agent', agentId: builder, machineOwnerId: 'host-owner' }const markReady = (result: string | null, actor: Actor = builderActor) =>@@ -1393,7 +1463,7 @@ describe('Reviewer role', () => {})it('gives a delta review to the Reviewer of the earlier head while it is still free', () => {- const { f, group, builderActor, built, reviewer, fresh, markReady, reviews } = ready('codex')+ const { f, group, builderActor, built, reviewer, fresh, markReady, reviews } = ready()markReady(`Ready. ${pr}`)const first = reviews()[0]!expect(first.assignment!.agentId).toBe(reviewer)@@ -1403,9 +1473,8 @@ describe('Reviewer role', () => {evidence: 'Ready: with fixes — revision d4e5f6, one Important finding.' }, reviewerActor)f.run({ type: 'work.status', conversationId: first.id, assignmentId: first.assignment!.id, status: 'done', result: 'Changes needed.' }, reviewerActor)f.run({ type: 'work.status', conversationId: group, assignmentId: built, status: 'working', result: null }, builderActor)- // Now only `fresh` runs on another engine than the Engineer's; the earlier head's Reviewer is still preferred.- f.state.agents.find(a => a.id === reviewer)!.configuration.engine = 'codex'- f.state.agents.find(a => a.id === fresh)!.configuration.engine = 'claude'+ // Now `fresh` comes first among the free Reviewers; the earlier head's Reviewer is still preferred.+ f.state.agents.sort((x, y) => Number(y.id === fresh) - Number(x.id === fresh))markReady(`Fixed: one finding, head 778899. ${pr}`)const delta = reviews().find(c => c.id !== first.id)!expect(delta.assignment!.agentId).toBe(reviewer)@@ -1414,7 +1483,7 @@ describe('Reviewer role', () => {it.each([['machines', { kind: 'machines', machineIds: ['elsewhere'] }],- ['model', { kind: 'forbidModel', model: 'test-model' }],+ ['model', { kind: 'forbidModel', model: 'opus' }],['effort', { kind: 'minEffort', effort: 'max' }],])('gives the review to no Reviewer the owner\'s %s rule rules out, and leaves it for the Lead', (_, rule) => {const { f, lead, markReady, reviews } = ready()@@ -1426,17 +1495,49 @@ describe('Reviewer role', () => {})it('passes over a Reviewer the owner\'s rules rule out for one they allow', () => {- // On Codex the Engineer's engine would make `reviewer` (Claude) the pick; only `fresh`'s machine is allowed.- const { f, fresh, markReady, reviews } = ready('codex')+ // `reviewer` comes first; only `fresh`'s machine is allowed.+ const { f, fresh, markReady, reviews } = ready()f.state.agents.find(a => a.id === fresh)!.machineId = 'allowed'f.run({ type: 'rule.set', rule: { kind: 'machines', machineIds: ['allowed'] }, text: 'Only allowed.' } as Command)markReady(`Ready. ${pr}`)expect(reviews()[0]!.assignment!.agentId).toBe(fresh)})+ it.each([+ ['on the grid', { gridModel: 'moonshotai/kimi-k3' }],+ ['below quality 2', { configuration: { ...config, engine: 'claude', model: 'claude-haiku-4-5' } }],+ ['on the Engineer\'s own engine', { configuration: { ...config, engine: 'codex' } }],+ ])('never gives the review to a Reviewer %s (Ken, 2026-10-29), and leaves it for the Lead', (_, patch) => {+ // The Engineer runs Codex; `fresh` is the only free Reviewer.+ const { f, leadActor, reviewer, fresh, markReady, reviews } = ready()+ f.run({ type: 'agent.release', agentId: reviewer, decision: 'stop' }, leadActor)+ Object.assign(f.state.agents.find(a => a.id === fresh)!, patch)+ markReady(`Ready. ${pr}`)+ expect(reviews()[0]!.assignment).toBeNull()+ })++ it('gives a Claude-only Swarm\'s review to its free Opus Reviewer, and to no weaker one of the same engine', () => {+ const { f, reviewer, fresh, markReady, reviews } = ready()+ for (const a of f.state.agents) a.configuration = { ...a.configuration, engine: 'claude' }+ f.state.agents.find(a => a.id === reviewer)!.configuration.model = 'claude-sonnet-4-5'+ f.state.agents.find(a => a.id === fresh)!.configuration.model = 'claude-opus-4-7'+ markReady(`Ready. ${pr}`)+ expect(reviews()[0]!.assignment!.agentId).toBe(fresh)+ })++ it('gives the review to a strong Reviewer on another engine, and to an Engineer on the grid even a Reviewer on its relay engine', () => {+ const { f, builder, fresh, reviewer, markReady, reviews } = ready()+ f.state.agents.find(a => a.id === reviewer)!.gridModel = 'qwen3'+ f.state.agents.find(a => a.id === fresh)!.configuration.model = 'claude-opus-4-7'+ // Claude Code drives the Engineer's grid model: its model family is that model, not Claude's.+ Object.assign(f.state.agents.find(a => a.id === builder)!, { configuration: { ...config, engine: 'claude' }, gridModel: 'deepseek/deepseek-v4.1-flash' })+ markReady(`Ready. ${pr}`)+ expect(reviews()[0]!.assignment!.agentId).toBe(fresh)+ })+it('passes over a Reviewer that is down for one that is up, and waits when none is up', () => {- // `reviewer` would be the pick on another engine than the Engineer's, but its session is gone.- const { f, leadActor, lead, reviewer, fresh, markReady, reviews } = ready('codex')+ // `reviewer` would be the pick, but its session is gone.+ const { f, leadActor, lead, reviewer, fresh, markReady, reviews } = ready()f.state.agents.find(a => a.id === reviewer)!.downSince = new Date(500).toISOString()markReady(`Ready. ${pr}`)expect(reviews()[0]!.assignment!.agentId).toBe(fresh)@@ -2762,11 +2863,12 @@ describe('the Local models add-on', () => {})it('reads the policy\'s local quality, low by default, from policies saved before the add-on', () => {- expect(effectivePolicy(null, null).policy.localModels).toEqual({ quality: 1, enabled: true })+ const builtIn = DEFAULT_ROUTING_POLICY.localModels!.models+ expect(effectivePolicy(null, null).policy.localModels).toEqual({ quality: 1, enabled: true, models: builtIn })const saved = { ...DEFAULT_ROUTING_POLICY } as Record<string, unknown>delete saved.localModels- expect(effectivePolicy(saved, null).policy.localModels).toEqual({ quality: 1, enabled: true })- expect(effectivePolicy(saved, { localModels: { quality: 2, enabled: true } }).policy.localModels).toEqual({ quality: 2, enabled: true })+ expect(effectivePolicy(saved, null).policy.localModels).toEqual({ quality: 1, enabled: true, models: builtIn })+ expect(effectivePolicy(saved, { localModels: { quality: 2, enabled: true } }).policy.localModels).toEqual({ quality: 2, enabled: true, models: builtIn })})})@@ -3184,3 +3286,116 @@ describe('agent.stopRefused', () => {expect(t.member().workDecision).toBe('stop')})})++// Ken, 2026-10-29: simple work runs on a grid model first, and a failed first review or a grid host that never starts the+// agent steps it up a tier (Sonnet, then Opus), at most twice per group.+describe('stepping up from a cheap model', () => {+ const pr = 'https://github.com/example/project/pull/41'+ function cheap() {+ const f = routed(), group = f.group()+ f.run({ type: 'conversation.agent', conversationId: group, agentId: f.lead, present: true, lead: true })+ f.run({ type: 'work.define', conversationId: group, brief: 'Fix the docs.', checks: [{ description: 'Reviewed.', independent: true }] })+ const builder = (name: string, model: string | null, gridModel?: string) => {+ const id = f.add(name, 'owner', group)+ Object.assign(f.state.agents.find(a => a.id === id)!, { configuration: { ...config, engine: 'claude', model }, ...(gridModel ? { gridModel } : {}) })+ return id+ }+ const assign = (agentId: string) => {+ const effects = f.run({ type: 'work.assign', conversationId: group, agentId })+ return { assignmentId: effects.result.assignmentId as string, brief: effects.messages.find(m => m.recipients.includes(agentId))!.text }+ }+ const fail = (assignmentId: string, agentId: string) => {+ f.run({ type: 'work.status', conversationId: group, assignmentId, status: 'review', result: `Ready: yes. Branch fix/docs. ${pr}` }, { kind: 'agent', agentId, machineOwnerId: 'host-owner' })+ const check = f.state.conversations.find(c => c.id === group)!.checks[0]!+ return f.run({ type: 'work.check', conversationId: group, assignmentId, checkId: check.id, passed: false, evidence: 'Ready: no. Two links are broken.' })+ }+ const g = () => f.state.conversations.find(c => c.id === group)!+ return { f, group, builder, assign, fail, g }+ }++ it('steps a grid attempt up when its first review says Ready no: closes it, keeps the branch and findings, and wakes the Lead', () => {+ const { f, group, builder, assign, fail, g } = cheap()+ const kimi = builder('kimi', 'default', 'moonshotai/kimi-k3')+ const first = assign(kimi)+ const effects = fail(first.assignmentId, kimi)+ expect(g().assignment).toMatchObject({ id: first.assignmentId, status: 'cancelled', result: 'Stepped up: its first review said Ready no.' })+ expect(g().stepUp).toMatchObject({ attempt: 2, floor: 2, reason: 'Its first review said Ready no.', at: 1000 })+ expect(g().stepUp!.carry).toContain(pr)+ expect(g().stepUp!.carry).toContain('Ready: no. Two links are broken.')+ expect(g().stepUp!.carry).toContain('Ready: yes. Branch fix/docs.')+ expect(effects.messages.find(m => m.recipients.includes(kimi))!.text).toContain('Stop working on it.')+ // Each row its own: one write stores them all.+ expect(new Set(effects.messages.map(m => m.id)).size).toBe(effects.messages.length)+ expect(effects.messages.find(m => m.recipients.includes(f.lead))!.text)+ .toBe(`#${g().number} stepped up to attempt 2: its first review said Ready no. Route it again: the route leaves out models on the grid and below quality 2, and the new attempt's brief carries the branch, the last result and the findings.`)+ // The next attempt may not go back to the grid; a stronger model takes the carry-over in its brief and the step in its record.+ f.run({ type: 'agent.release', agentId: kimi, decision: 'stop' }, f.leadActor)+ const route = (pick: Record<string, unknown>) => f.run({ type: 'route.record', conversationId: group, decision: record({ candidates: [candidate('c0', pick)], pick: 'c0' }) } as Command, f.leadActor)+ expect(() => route({ model: 'default', effort: 'default', quality: 2, gridModel: 'deepseek/deepseek-v4.1', gridName: 'swarm-g' }))+ .toThrow('This task stepped up from a cheaper model: it runs on no model on the grid and nothing below quality 2. Route again.')+ expect(() => route({ model: 'haiku', effort: 'auto', quality: 1 })).toThrow('nothing below quality 2')+ expect(route({ model: 'sonnet', effort: 'medium', quality: 2 }).routeDecisions[0]).toMatchObject({ op: 'create', record: { stepUp: { attempt: 2, reason: 'Its first review said Ready no.' } } })+ const sonnet = builder('sonnet', 'claude-sonnet-4-5')+ const second = assign(sonnet)+ expect(second.brief).toContain(`Carry-over from attempt 1:\n${g().stepUp!.carry}`)+ expect(g().ledger!.runs!.at(-1)).toMatchObject({ assignmentId: second.assignmentId, stepUp: { attempt: 2, reason: 'Its first review said Ready no.' } })+ // Sonnet fails its first review too: Opus next, and that is the last step.+ fail(second.assignmentId, sonnet)+ expect(g().stepUp).toMatchObject({ attempt: 3, floor: 3 })+ const opus = builder('opus', 'claude-opus-4-7'), third = assign(opus)+ expect(fail(third.assignmentId, opus).messages.some(m => m.text.includes('stepped up'))).toBe(false)+ expect(g().assignment).toMatchObject({ id: third.assignmentId, status: 'review' })+ })++ it('stops after two steps, and never steps up work that did not start on the grid', () => {+ const { builder, assign, fail, g } = cheap()+ const opus = builder('opus', 'claude-opus-4-7')+ const first = assign(opus)+ fail(first.assignmentId, opus)+ expect(g().stepUp).toBeUndefined()+ expect(g().assignment!.status).toBe('review')+ // At the cap a failed Sonnet attempt stays with its Builder.+ const { builder: other, assign: give, fail: failIt, g: group } = cheap()+ group().stepUp = { attempt: 3, floor: 3, reason: 'Earlier.', at: 1, carry: '' }+ const sonnet = other('sonnet', 'claude-sonnet-4-5')+ failIt(give(sonnet).assignmentId, sonnet)+ expect(group().stepUp!.attempt).toBe(3)+ expect(group().assignment!.status).toBe('review')+ })++ it('steps up a group whose grid start failed, and not one whose subscription start failed', () => {+ const { f, group, g } = cheap()+ const start = (id: string, gridModel?: string) => ({ id, actorKey: 'person:owner', contributorId: 'owner', membershipGeneration: f.state.people[0]!.generation,+ request: { conversationId: group, machineId: 'mac', name: 'Builder', engine: 'claude', ...(gridModel ? { gridModel, gridName: 'swarm-g' } : {}) }, error: null })+ f.state.starts = [start('s1'), start('s2', 'moonshotai/kimi-k3')] as never+ f.run({ type: 'agent.startFailed', startId: 's1', error: 'Launch refused.' })+ expect(g().stepUp).toBeUndefined()+ const effects = f.run({ type: 'agent.startFailed', startId: 's2', error: 'Launch refused.' })+ expect(g().stepUp).toMatchObject({ attempt: 2, floor: 2, reason: 'Its grid host did not start the agent.' })+ expect(new Set(effects.messages.map(m => m.id)).size).toBe(effects.messages.length)+ expect(effects.messages.map(m => m.text)).toContain(`#${g().number} stepped up to attempt 2: its grid host did not start the agent. Route it again: the route leaves out models on the grid and below quality 2, and the new attempt's brief carries the branch, the last result and the findings.`)+ })++ it('never steps up again from a top-tier attempt that its ledger names by a slug the policy does not', () => {+ const { f, builder, assign, fail, g } = cheap()+ g().stepUp = { attempt: 2, floor: 2, reason: 'Its first review said Ready no.', at: 1, carry: '' }+ // Launched on Codex's own model, it reports its slug: rated by the default row, the top tier.+ const codex = builder('codex', 'gpt-6.1-sol')+ Object.assign(f.state.agents.find(a => a.id === codex)!.configuration, { engine: 'codex' })+ f.state.starts = [...f.state.starts ?? [], { harnessId: 'codex', request: { machineId: 'host', engine: 'codex', model: 'default' } } as never]+ const attempt = assign(codex)+ fail(attempt.assignmentId, codex)+ expect(g().stepUp!.attempt).toBe(2)+ expect(g().assignment).toMatchObject({ id: attempt.assignmentId, status: 'review' })+ })++ it('steps up once for one failed grid start, however often its failure is reported', () => {+ const { f, group, g } = cheap()+ f.state.starts = [{ id: 's1', actorKey: 'person:owner', contributorId: 'owner', membershipGeneration: f.state.people[0]!.generation,+ request: { conversationId: group, machineId: 'mac', name: 'Builder', engine: 'claude', gridModel: 'moonshotai/kimi-k3', gridName: 'swarm-g' }, error: null }] as never+ f.run({ type: 'agent.startFailed', startId: 's1', error: 'Launch refused.' })+ const again = f.run({ type: 'agent.startFailed', startId: 's1', error: 'Launch refused again.' })+ expect(g().stepUp).toMatchObject({ attempt: 2, startId: 's1' })+ expect(again.messages.some(m => m.text.includes('stepped up'))).toBe(false)+ })+})diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex b6ed63c20..977e2e5ed 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -8,8 +8,8 @@ import {type Actor, type AgentStartRequest, type WorkTask, type Agent, type Author, type CommandEffects, type Conversation, type SuperTabState,} from './model.js'import { routeRecordSchema, routeTitle, startedAs, type RouteCandidate, type RouteDecision, type RouteFinal, type RouteOverride } from './routeRecord.js'-import { routingOverrideSchema } from './routingPolicy.js'-import { agentTarget, askedInSchema, broken, MAX_RULES, RULE_MESSAGE_MS, ruleSchema, ruleTextSchema, startTarget, unmet, type RunTarget } from './rules.js'+import { DEFAULT_ROUTING_POLICY, routingOverrideSchema, type RoutingPolicy } from './routingPolicy.js'+import { agentTarget, askedInSchema, broken, MAX_RULES, reviewRefusal, RULE_MESSAGE_MS, sameEngineReview, ruleSchema, ruleTextSchema, startTarget, unmet, type RunTarget } from './rules.js'import { MAX_ATTACHMENTS, type Attachment } from './attachments.js'import { checkMentions, MAX_MENTIONS, type MentionTarget } from './mentions.js'import { answerDecision, askDecisions, checkAsker, decisionChoices, decisionQuestion, MAX_OPEN_DECISIONS, MAX_QUESTIONS, type DecisionTarget } from './decisions.js'@@ -26,6 +26,7 @@ import { WEEK_MS } from './leaderboard/week.js'import { react, reactionSchema, type ReactionTarget } from './reactions.js'import { shipNotice, shippedAt } from './ship.js'import { openReview, openReviewOf, projectPullRequest, verdictPending } from './autoReview.js'+import { carryOver, cheapAttempt, GRID_START_FAILED, REVIEW_FAILED, stepUp, stepUpRefusal } from './stepUp.js'import { avatarChoice, setAgentAvatar, setMemberAvatar, setStatus, statusSchema, type AvatarUpload } from './profile.js'import { agentKind, agentProjectId, audienceOf, agentSetRole, canReadProject, deleteProject, isConfidential, markConfidential, onTeamAccount, requireSingleRegistration, groupProject, inviteLanding, ledProject, manageProject, MAX_ROLES, mutableProjects, placeRules, projectMembers, projectOf, projectRules, projectsOf, readAgent, readConversation, readProject, roleVersion, sameProject, sharedWithLeads, SKILL_SET_NAMES, skillSetOf, type ProjectRole, type RoleKind, type SwarmProject } from './projects.js'import { BUDDY_REQUIREMENTS, buddyChatId, buddyReady, isBuddy, isBuddyChat, MAX_PROPOSAL_ASKS, MAX_PROPOSAL_ATTACHMENTS, openBuddyChat, PROPOSAL_ASK_MS, proposalText, requireBuddyCommand } from './buddies.js'@@ -303,6 +304,9 @@ export interface CommandContext {/** Route decisions this tab recorded in the last hour, counted by the store. *//** The decision a command names, read from SuperTabRouteDecision by the store. */routeDecision?: RouteDecision+ /** The tab's effective routing policy, read by the store for commands that start, assign or route work: who may review+ * is judged by it (rules.ts reviewRefusal). The built-in default without it. */+ routingPolicy?: RoutingPolicy/** Starts on the machine being contributed that the store found abandoned: never contributed, never dispatched,* and older than ABANDONED_START_MS by their operation receipt. */abandonedStartIds?: string[]@@ -626,20 +630,42 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma}/** The owner's rules for the group's project, then the group's own requirement, each with its own code so a caller can tell* an owner's rule from where the task can be done at all. */- const refusal = (target: RunTarget, conversationId: string): { code: string; why: string } | null => {+ const policy = context.routingPolicy ?? DEFAULT_ROUTING_POLICY+ /** Whether a new agent may run [target] for group [conversationId]: the owner's rules, the task's own machine+ * ([requirement]) and team access. Whether another engine could review is judged by it (rules.ts reviewRefusal). */+ const mayRun = (conversationId: string, requirement: boolean) => (target: RunTarget, contributorId: string) =>+ !broken(groupRules(conversationId), target, machineName, macOf) && (!requirement || !unmet(conversation(state, conversationId).task?.requires, target, macOf))+ && !teamWorkCheck(state, target.machineId, contributorId, groupProject(state, conversation(state, conversationId)), context.now, context.teamMachines, context.otherWorkspaceMachines)+ /** [builds]: the target would do the group's work, so a step up's floor holds too (stepUp.ts). */+ const refusal = (target: RunTarget, conversationId: string, builds = true): { code: string; why: string } | null => {const rule = broken(groupRules(conversationId), target, machineName, macOf)if (rule) return { code: 'RULE_BROKEN', why: rule }const requirement = unmet(conversation(state, conversationId).task?.requires, target, macOf)- return requirement ? { code: 'REQUIREMENT_UNMET', why: requirement } : null+ if (requirement) return { code: 'REQUIREMENT_UNMET', why: requirement }+ const review = reviewRefusal(state, conversation(state, conversationId).reviewOf, target, policy, mayRun(conversationId, true))+ if (review) return { code: 'REVIEW_REFUSED', why: review }+ const stepped = builds ? stepUpRefusal(conversation(state, conversationId), target, policy) : null+ return stepped ? { code: 'STEPPED_UP', why: stepped } : null}- const ruled = (target: RunTarget, conversationId: string, done: string, personChose = false) => {- const refused = refusal(target, conversationId)+ const ruled = (target: RunTarget, conversationId: string, done: string, personChose = false, builds = true) => {+ const refused = refusal(target, conversationId, builds)if (!refused) returnconst { code, why } = refusedif (actor.kind === 'agent' && !personChose) fail(code, `${why} Route again.`, 403)result.warnings = [why]effects.messages.push({ id: stableId(operationId, 'rule'), conversationId, author: sender, text: `${done} anyway. ${why}`, replyTo: null, recipients: [], source: RULE_ROW })}+ /** Steps [group] up a tier, tells the worker it stopped to stop and wakes the Lead (stepUp.ts); [startId]: the failed start+ * that did, which steps up once. Rows of their own beside the command's. */+ const steppedUp = (group: Conversation, reason: string, startId?: string) => {+ const stepped = stepUp(state, group, reason, context.now, startId)+ if (!stepped) return+ const row = (key: string, text: string, recipients: string[]) => effects.messages.push({ id: stableId(operationId, 'step-up', key),+ conversationId: group.id, author: sender, text, replyTo: null, recipients, source: SYSTEM_ROW })+ if (stepped.stopped) row('worker', `The Swarm stepped this task up to a stronger model: ${reason.replace(/^./, c => c.toLowerCase()).replace(/\.$/, '')}. Stop working on it.`, [stepped.stopped])+ const lead = group.leadId && group.agentIds.includes(group.leadId) ? group.leadId : null+ row('lead', stepped.notice, lead ? [lead] : [])+ }/** Rules are per project. Only its owner changes them, or its Lead quoting a message the project owner wrote in its chat in* the last day (review of #1586: any owner row, a rule row included, could otherwise be quoted at any time). One message* may ask for several rules. The project is the one named, else the quoted chat's, else the actor's: the person's remaining@@ -1531,6 +1557,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Commaconst group = conversation(state, start.request.conversationId)const lead = group.leadId && group.agentIds.includes(group.leadId) ? group.leadId : nullmessage(group.id, failureNotice(start.request.name, command.error), lead ? [lead] : [], null, SYSTEM_ROW)+ if (start.request.gridModel && !activeWork(group)) steppedUp(group, GRID_START_FAILED, start.id)break}if (start.error) fail('START_FAILED', 'This start failed. Use a new start request.')@@ -1717,7 +1744,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma}// A Reviewer added to a group is handed its review, as an assignment hands a Builder its task.if (reviewer) requireTeamWork(state, member.machineId, member.contributorId, groupProject(state, group), context.now, context.teamMachines, context.otherWorkspaceMachines)- ruled(agentTarget(state, member), group.id, `${who} added ${member.name}`)+ ruled(agentTarget(state, member), group.id, `${who} added ${member.name}`, false, false)if (!group.agentIds.includes(command.agentId)) group.agentIds.push(command.agentId)// Adding a Reviewer to a group reuses it, as assigning work reuses a Builder.if (reviewer) delete member.workDecision@@ -1862,7 +1889,13 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: CommarequireWorkerDecisions(state, actor, open(state, command.conversationId), chosen.kind === 'member' ? chosen.agentId : undefined)const via = decision.via === 'jev' ? `Jev ${Math.round((decision.p ?? 0) * 100)}%`: decision.via === 'only' ? 'only candidate' : 'by policy order'- effects.routeDecisions.push({ op: 'create', id: operationId, conversationId: command.conversationId, record: decision })+ // The step this attempt is comes from the group alone (stepUp.ts), and why a review stays on its Builder's engine from+ // the server's own judgement (rules.ts).+ const step = conversation(state, command.conversationId).stepUp+ const sameEngine = sameEngineReview(state, conversation(state, command.conversationId).reviewOf, member ? agentTarget(state, member) : chosen, policy, mayRun(command.conversationId, true))+ const { stepUp: _sent, sameEngine: _said, ...made } = decision+ effects.routeDecisions.push({ op: 'create', id: operationId, conversationId: command.conversationId,+ record: { ...made, ...step ? { stepUp: { attempt: step.attempt, reason: step.reason } } : {}, ...sameEngine ? { sameEngine } : {} } })result.routeDecisionId = operationId// The row quotes the Lead's reason for the task; the verdict's own text stays in the decision record.const reason = decision.assessment.why@@ -1977,7 +2010,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: CommapersonChose = !override && decision.override?.by === 'person'}ruled(agentTarget(state, worker), group.id, `${who} assigned ${worker.name}`, personChose)- message(group.id, `${group.brief}\n\nAcceptance checks:\n${group.checks.map(c => `- ${c.description}`).join('\n')}`, [worker.id], null, SYSTEM_ROW)+ message(group.id, `${group.brief}${carryOver(group)}\n\nAcceptance checks:\n${group.checks.map(c => `- ${c.description}`).join('\n')}`, [worker.id], null, SYSTEM_ROW)if (routeNote) effects.messages.push({ id: stableId(operationId, 'route-override'), conversationId: group.id, author: sender,text: routeNote.text, replyTo: null, recipients: [], source: { kind: 'route-override', decisionId: routeNote.decisionId, by: 'lead' } })break@@ -2035,7 +2068,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Commaconst opened = pullRequest && openReview(state, group, command.result!, pullRequest, { operationId, now: context.now, engineer: sender,// The owner's hard rules hold as for work.assign; the reviewed task's own requirement is its Engineer's, not its Reviewer's.mayWork: a => !teamWorkCheck(state, a.machineId, a.contributorId, groupProject(state, group), context.now, context.teamMachines, context.otherWorkspaceMachines)- && !broken(groupRules(group.id), agentTarget(state, a), machineName, macOf) })+ && !broken(groupRules(group.id), agentTarget(state, a), machineName, macOf) && !reviewRefusal(state, group.id, agentTarget(state, a), policy, mayRun(group.id, false)) })if (opened) effects.messages.push(...opened.messages)// Shipped before this command: the leaderboard marks this Done as shipped just above (recordStatus).if (command.status === 'done' && shippedAt(conversation(original, group.id)) == null) {@@ -2106,9 +2139,12 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Commaif (check.independent && actor.kind === 'agent' && actor.agentId === group.assignment.agentId) fail('INDEPENDENT_REVIEW', 'Another agent or a person must perform this check.')check.evidence = command.evidencecheck.passedBy = command.passed ? actorKey(actor) : null+ const run = group.ledger?.runs?.find(r => r.assignmentId === group.assignment!.id), reviewed = run?.firstReview// Before the review's first verdict is kept: a check's verdict counts once per attempt.if (actor.kind === 'agent') recordVerdict(state, group, check, agent(state, actor.agentId), context.now)recordReview(group, check, command.passed)+ // A cheap attempt whose first review just said Ready no steps up a tier (stepUp.ts).+ if (reviewed === undefined && run?.firstReview === false && cheapAttempt(group, policy)) steppedUp(group, REVIEW_FAILED)if (actor.kind === 'agent') renewOwnTask(group, actor.agentId, context.now)break}diff --git a/backend/src/superTabs/costs/read.test.ts b/backend/src/superTabs/costs/read.test.tsindex 217150279..d2066048d 100644--- a/backend/src/superTabs/costs/read.test.ts+++ b/backend/src/superTabs/costs/read.test.ts@@ -25,10 +25,10 @@ describe('the cost summary', () => {expect(summary.rows).toEqual([{ engine: 'claude', model: 'opus', effort: 'high', kind: 'parser', attempts: 3, firstReviews: 2, firstReviewPassed: 1, firstReviewPassRate: 0.5,shipped: 2, outcomes: { done: 2, lost: 1 }, billing: { subscription: 2, api: 1 }, medianMinutesToShip: 30,- tokens: { input: 2.5e6, output: 0, cacheRead: 0, cacheWrite: 0 }, tokensKnown: 3, apiCost: 10, spend: 4, costKnown: 3, costPerShipped: 5 },+ tokens: { input: 2.5e6, output: 0, cacheRead: 0, cacheWrite: 0 }, tokensKnown: 3, apiCost: 10, spend: 4, costKnown: 3, costPerShipped: 5, stepUps: 0 },{ engine: 'claude', model: 'opus', effort: 'xhigh', kind: 'unspecified', attempts: 1, firstReviews: 0, firstReviewPassed: 0, firstReviewPassRate: null,shipped: 1, outcomes: { done: 1 }, billing: { subscription: 1 }, medianMinutesToShip: 30,- tokens: { input: 1e6, output: 0, cacheRead: 0, cacheWrite: 0 }, tokensKnown: 1, apiCost: 4, spend: 0, costKnown: 1, costPerShipped: 4 },+ tokens: { input: 1e6, output: 0, cacheRead: 0, cacheWrite: 0 }, tokensKnown: 1, apiCost: 4, spend: 0, costKnown: 1, costPerShipped: 4, stepUps: 0 },])expect(summary.totals).toMatchObject({ attempts: 4, shipped: 3, apiCost: 14, spend: 4, costPerShipped: 14 / 3 })})@@ -57,6 +57,25 @@ describe('the cost summary', () => {])})+ it('rolls the rows up per model, across efforts and kinds, with pass rate, cost per shipped change and step-ups, to compare week over week', () => {+ const rows = [+ row('k1', { conversationId: 'g1', run: run({ grid: 'moonshotai/kimi-k3', effort: 'default', billing: 'api' }) }),+ row('k2', { conversationId: 'g2', kind: 'docs', run: run({ grid: 'moonshotai/kimi-k3', effort: 'default', billing: 'api' }) }),+ row('s1', { conversationId: 'g2', kind: 'docs', stepUp: { attempt: 2, reason: 'Its first review said Ready no.' }, run: run({ model: 'sonnet', effort: 'medium', startedAt: 10 * MINUTE }) }),+ row('o1', { conversationId: 'g3', run: run({ effort: 'xhigh' }) }),+ ]+ const summary = summarizeCosts(rows, [group('g1', [{ assignmentId: 'k1', firstReview: true }], 30 * MINUTE),+ group('g2', [{ assignmentId: 'k2', firstReview: false }, { assignmentId: 's1', firstReview: true }], 30 * MINUTE), group('g3', [])])+ expect(summary.models.map(m => [m.engine, m.model, m.attempts, m.firstReviewPassRate, m.shipped, m.stepUps])).toEqual([+ ['claude', 'moonshotai/kimi-k3', 2, 0.5, 1, 0],+ ['claude', 'opus', 1, null, 0, 0],+ ['claude', 'sonnet', 1, 1, 1, 1],+ ])+ expect(summary.models[2]!.costPerShipped).toBe(summary.models[2]!.apiCost)+ expect(summary.rows.find(r => r.model === 'sonnet')).toMatchObject({ stepUps: 1 })+ expect(summary.totals).toMatchObject({ attempts: 4, stepUps: 1 })+ })+it('shows which prices it used, with their sources and dates', () => {expect(summarizeCosts([row('a1')], []).prices).toEqual([{ model: 'claude-opus-5-5', source: 'https://platform.claude.com/docs/en/about-claude/pricing', checked: '2026-10-29' }])})diff --git a/backend/src/superTabs/costs/read.ts b/backend/src/superTabs/costs/read.tsindex d78fa90a8..cf09efd09 100644--- a/backend/src/superTabs/costs/read.ts+++ b/backend/src/superTabs/costs/read.ts@@ -17,8 +17,10 @@ export const MAX_ROWS = 3000export const MAX_DAYS = 90export const DEFAULT_DAYS = 7-/** One attempt as the summary reads it. `fresh`: its agent was started for it (costs/attempts.ts attemptTokens). */-export interface CostRow { conversationId: string; assignmentId: string; outcome: string | null; kind: string | null; fresh: boolean; run: RouteRun }+/** One attempt as the summary reads it. `fresh`: its agent was started for it (costs/attempts.ts attemptTokens). `stepUp`: the+ * step up from a cheaper model it was (stepUp.ts), as its decision keeps it. */+export interface CostRow { conversationId: string; assignmentId: string; outcome: string | null; kind: string | null; fresh: boolean; run: RouteRun+ stepUp?: { attempt: number; reason: string } }/** The attempts routed since `since`: decisions with an assignment and a run, by the tabId+createdAt index. A plain $match,* as recentDecisions does: Prisma's own filters reach Mongo as $expr, which its planner does not serve from the index. Only@@ -27,14 +29,16 @@ export async function costRows(tx: Tx, tabId: string, since: number): Promise<{const found = await tx.superTabRouteDecision.aggregateRaw({ pipeline: [{ $match: { tabId, createdAt: { $gte: { $date: new Date(since).toISOString() } } } },{ $sort: { createdAt: -1 } }, { $limit: MAX_ROWS + 1 },- { $project: { conversationId: 1, assignmentId: 1, outcome: 1, run: 1, 'final.kind': 1, 'record.assessment.kind': 1 } },+ { $project: { conversationId: 1, assignmentId: 1, outcome: 1, run: 1, 'final.kind': 1, 'record.assessment.kind': 1, 'record.stepUp': 1 } },] }) as unknown as Array<Record<string, unknown>>const rows = found.slice(0, MAX_ROWS).flatMap(row => {const run = row.run as RouteRun | null | undefinedif (!run || typeof row.assignmentId !== 'string') return []- const kind = ((row.record as { assessment?: { kind?: unknown } } | undefined)?.assessment?.kind)+ const record = row.record as { assessment?: { kind?: unknown }; stepUp?: CostRow['stepUp'] } | undefined+ const kind = record?.assessment?.kindreturn [{ conversationId: String(row.conversationId), assignmentId: row.assignmentId, outcome: (row.outcome ?? null) as string | null,- kind: typeof kind === 'string' ? kind : null, fresh: (row.final as { kind?: unknown } | null | undefined)?.kind === 'new', run }]+ kind: typeof kind === 'string' ? kind : null, fresh: (row.final as { kind?: unknown } | null | undefined)?.kind === 'new', run,+ ...(record?.stepUp ? { stepUp: record.stepUp } : {}) }]})return { rows, truncated: found.length > MAX_ROWS }}@@ -59,10 +63,15 @@ export interface CostSummaryRow {apiCost: number | null; spend: number | null; costKnown: number/** apiCost over shipped, only when every ended attempt's cost is known: a partial sum would read cheaper than it was. */costPerShipped: number | null+ /** Attempts that were a step up from a cheaper model (stepUp.ts). */+ stepUps: number}export interface CostSummary {rows: CostSummaryRow[]+ /** The same per model alone (a grid model by its own name), across efforts and kinds: what a model's first-review pass+ * rate and cost per shipped change are, week over week (Ken, 2026-10-29). */+ models: Array<Omit<CostSummaryRow, 'effort' | 'kind'>>totals: Omit<CostSummaryRow, 'engine' | 'model' | 'effort' | 'kind'>/** The prices the costs used, with their sources and the day each was read. */prices: Array<{ model: string; source: string; checked: string }>@@ -91,8 +100,9 @@ function shipping(rows: CostRow[], groups: Conversation[]): Map<string, number>function summarize(rows: CostRow[], firstReview: Map<string, boolean>, shippedAt: Map<string, number>, prices: Set<string>): CostSummary['totals'] {const tokens: ModelTokens = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }const outcomes: Record<string, number> = {}, billing: Partial<Record<Billing, number>> = {}, toShip: number[] = []- let firstReviews = 0, firstReviewPassed = 0, shipped = 0, tokensKnown = 0, costKnown = 0, apiCost = 0, spend = 0, spendKnown = 0, endedUnknown = 0+ let firstReviews = 0, firstReviewPassed = 0, shipped = 0, tokensKnown = 0, costKnown = 0, apiCost = 0, spend = 0, spendKnown = 0, endedUnknown = 0, stepUps = 0for (const row of rows) {+ if (row.stepUp) stepUps++const verdict = firstReview.get(row.assignmentId)if (verdict !== undefined) { firstReviews++; if (verdict) firstReviewPassed++ }const outcome = row.outcome ?? 'open'@@ -120,7 +130,7 @@ function summarize(rows: CostRow[], firstReview: Map<string, boolean>, shippedAtreturn { attempts: rows.length, firstReviews, firstReviewPassed, firstReviewPassRate: firstReviews ? firstReviewPassed / firstReviews : null,shipped, outcomes, billing, medianMinutesToShip: median(toShip), tokens, tokensKnown,apiCost: costKnown ? apiCost : null, spend: spendKnown ? spend : null, costKnown,- costPerShipped: costKnown && shipped && !endedUnknown ? apiCost / shipped : null }+ costPerShipped: costKnown && shipped && !endedUnknown ? apiCost / shipped : null, stepUps }}/** The summary of these attempts; `groups` are the groups they belong to, for their ledgers' first reviews. */@@ -128,16 +138,16 @@ export function summarizeCosts(rows: CostRow[], groups: Conversation[]): CostSumconst firstReview = new Map<string, boolean>()for (const group of groups) for (const run of group.ledger?.runs ?? []) if (run.firstReview !== undefined) firstReview.set(run.assignmentId, run.firstReview)const keyOf = (row: CostRow) => [row.run.engine, row.run.grid ?? row.run.model, row.run.effort, row.kind ?? 'unspecified'] as const- const byKey = new Map<string, CostRow[]>()- for (const row of rows) {- const key = JSON.stringify(keyOf(row))- byKey.set(key, [...byKey.get(key) ?? [], row])+ /** The rows grouped by [key], in key order. */+ const grouped = <K extends readonly string[]>(key: (row: CostRow) => K) => {+ const byKey = new Map<string, CostRow[]>()+ for (const row of rows) byKey.set(JSON.stringify(key(row)), [...byKey.get(JSON.stringify(key(row))) ?? [], row])+ return [...byKey.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([, group]) => [key(group[0]!), group] as const)}const prices = new Set<string>(), shippedAt = shipping(rows, groups)- const summary = [...byKey.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([, group]) => {- const [engine, model, effort, kind] = keyOf(group[0]!)- return { engine, model, effort, kind, ...summarize(group, firstReview, shippedAt, prices) }- })- return { rows: summary, totals: summarize(rows, firstReview, shippedAt, new Set()),+ const summary = grouped(keyOf).map(([[engine, model, effort, kind], group]) => ({ engine, model, effort, kind, ...summarize(group, firstReview, shippedAt, prices) }))+ const models = grouped(row => [row.run.engine, row.run.grid ?? row.run.model] as const)+ .map(([[engine, model], group]) => ({ engine, model, ...summarize(group, firstReview, shippedAt, new Set()) }))+ return { rows: summary, models, totals: summarize(rows, firstReview, shippedAt, new Set()),prices: [...prices].sort().map(model => { const p = priceOf(model)!; return { model: p.model, source: p.source, checked: p.checked } }) }}diff --git a/backend/src/superTabs/leaderboard/record.ts b/backend/src/superTabs/leaderboard/record.tsindex 1a119f448..ebdca0c24 100644--- a/backend/src/superTabs/leaderboard/record.ts+++ b/backend/src/superTabs/leaderboard/record.ts@@ -5,6 +5,7 @@import { isLeads, type Actor, type Agent, type AgentConfiguration, type Assignment, type Author, type Check, type Conversation, type SuperTabState, type WorkStatus } from '../model.js'import { groupProject, ledProject } from '../projects.js'import { WEEK_MS, weekStart } from './week.js'+import { agentTarget } from '../rules.js'import type { UnblockKind } from './contract.js'/** How a person unblocked work (Dee, 2026-10-28): answered a decision, approved the Lead's plan, answered work waiting on them,@@ -16,7 +17,12 @@ export interface Unblock { personId: string; at: number; waitedMs: number; kind?* reports none of its own. `firstVerdicts`: each independent check's first verdict during this attempt, by check id.* `firstReview`: false once any of them failed, true once every independent check passed its first, absent until then. */export interface Run extends RanOn { assignmentId: string; at: number- firstVerdicts?: Record<string, boolean>; firstReview?: boolean }+ firstVerdicts?: Record<string, boolean>; firstReview?: boolean+ /** The step up from a cheaper model this attempt is (stepUp.ts): its attempt number and why. */+ stepUp?: { attempt: number; reason: string }+ /** Its agent was launched on the engine's own model, which Codex reports by a slug the policy may not name: it is rated by+ * the engine's `default` row (rules.ts policyQuality; review of ee4ee6c9a). */+ engineDefault?: true }/** What an agent ran on: its engine, the model (a grid model's own name, `grid` set), and its effort when it names one;* absent from attempts recorded before efforts were (Lead, 2026-10-29: never guessed afterwards). */export interface RanOn { engine: string; model: string | null; effort?: string; grid?: true }@@ -194,7 +200,9 @@ export function waitsNow(group: Conversation): boolean {/** An assignment records what its agent runs on (ranOn), for the board's models. */export function recordRun(state: SuperTabState, group: Conversation, assignment: Assignment, worker: Agent, now: number): void {- const run: Run = { assignmentId: assignment.id, ...ranOn(state, worker, assignment.configuration), at: now }+ const run: Run = { assignmentId: assignment.id, ...ranOn(state, worker, assignment.configuration), at: now,+ ...(group.stepUp ? { stepUp: { attempt: group.stepUp.attempt, reason: group.stepUp.reason } } : {}),+ ...(agentTarget(state, worker).launchedDefault ? { engineDefault: true as const } : {}) }const ledger = group.ledger ??= {}ledger.firstAssignedAt ??= firstAssignedAt(ledger) ?? nowledger.runs = [...ledger.runs ?? [], run].slice(-MAX_RUNS)diff --git a/backend/src/superTabs/liveness.test.ts b/backend/src/superTabs/liveness.test.tsindex 281083712..6ff2794ff 100644--- a/backend/src/superTabs/liveness.test.ts+++ b/backend/src/superTabs/liveness.test.ts@@ -87,6 +87,15 @@ describe('a start its machine has launched', () => {expect(sweep(launched(), at + 1).error).toBe('Worker Mac did not start it within 3 minutes')})+ it('steps its group up when it ran a grid model, and tells the Lead in the same notice', () => {+ const at = LAUNCHED + 3 * MINUTE + 1+ const state = launched([{ receivedAt: at }], { request: { conversationId: 'lead', machineId: 'm', name: 'Builder', gridModel: 'moonshotai/kimi-k3' } })+ Object.assign(state.conversations[0]!, { number: 7 })+ expect(sweep(state, at).told).toEqual(['Could not start Builder: its machine did not start it within 3 minutes.\n\n#7 stepped up to attempt 2: its grid host did not start the agent. '+ + 'Route it again: the route leaves out models on the grid and below quality 2, and the new attempt\'s brief carries the branch, the last result and the findings.'])+ expect(state.conversations[0]!.stepUp).toMatchObject({ attempt: 2, floor: 2 })+ })+it('waits while its machine\'s reports say it is preparing, and fails it 15 minutes after launch', () => {const at = LAUNCHED + 15 * MINUTEexpect(sweep(launched([{ receivedAt: LAUNCHED + 5 * MINUTE, preparingStartIds: ['s1'] }]), LAUNCHED + 5 * MINUTE).error).toBeNull()diff --git a/backend/src/superTabs/liveness.ts b/backend/src/superTabs/liveness.tsindex fec775542..5b2127dac 100644--- a/backend/src/superTabs/liveness.ts+++ b/backend/src/superTabs/liveness.ts@@ -3,6 +3,7 @@ import { activeWork, stableId, type Agent, type AgentStart, type Assignment, typimport { machineOffline, sessionStopped } from './lostReason.js'import { agentDisplayName } from './agentNames.js'import { failureNotice, LEAD_PICKUP_SUFFIX, STILL_PREPARING_SUFFIX, STOPPED_REPORTING_SUFFIX, TIMED_OUT_SUFFIX } from './startFailure.js'+import { GRID_START_FAILED, stepUp } from './stepUp.js'import { leadOf, toLead } from './terminal.js'import { MACHINE_FRESH_MS } from './machines.js'import { leadStartFailed } from './leadStart.js'@@ -368,10 +369,12 @@ function failStalledStarts(state: SuperTabState, now: number): MessageDraft[] {const group = state.conversations.find(c => c.id === start.request.conversationId)// Recorded in this write: once the start has ended, no later poll loads it.if (group) recordTaskState(state, group, now)+ // A grid host that never started the agent steps the work up a tier (stepUp.ts).+ const stepped = group && start.request.gridModel && !activeWork(group) ? stepUp(state, group, GRID_START_FAILED, now, start.id) : nullconst lead = group?.leadId ? state.agents.find(a => a.id === group.leadId) : undefinedif (!group || !lead) return []return [reachable(state, { id: stableId('start-timeout', start.id), conversationId: group.id, replyTo: null,recipients: group.agentIds.includes(lead.id) ? [lead.id] : [], author: writtenBy(state, lead),- text: failureNotice(start.request.name, start.error), source: { kind: 'start-timeout', startId: start.id } })]+ text: `${failureNotice(start.request.name, start.error)}${stepped ? `\n\n${stepped.notice}` : ''}`, source: { kind: 'start-timeout', startId: start.id } })]})}diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.tsindex c80f7afbc..4359e9907 100644--- a/backend/src/superTabs/model.ts+++ b/backend/src/superTabs/model.ts@@ -237,6 +237,8 @@ export interface Conversation {ledger?: import('./leaderboard/record.js').GroupLedger/** Whether its task is moving, waiting on purpose or stuck, as the time checks last found it (liveness.ts recordTaskStates). */liveness?: TaskLiveness+ /** Its last step up from a cheaper model (stepUp.ts); absent until one. */+ stepUp?: import('./stepUp.js').StepUp/** The Lead's last action on its task: an assignment, route, start or post here (commands.ts). */leadAction?: { kind: 'assign' | 'route' | 'start' | 'post'; at: number }}diff --git a/backend/src/superTabs/parts/light.test.ts b/backend/src/superTabs/parts/light.test.tsindex 0649c5ea7..9fbe29bea 100644--- a/backend/src/superTabs/parts/light.test.ts+++ b/backend/src/superTabs/parts/light.test.ts@@ -14,6 +14,7 @@ const conversation: Required<Conversation> = {task: { goal: '', changes: '', constraints: '', owns: [] }, reviewOf: 'r', checks: [], assignment, lastMessageSequence: 0, lastMainSequence: 0, pullRequestUrls: [],messageSeq: 0, reportSeq: 0, dormant: false, lastActivityAt: '', audience: { people: [] }, lostAttempt: { id: 'w', agentId: 'a' }, reactionSeq: 0,requesterId: 'p', ledger: {}, proposals: [], liveness: { state: 'quiet', why: 'silent', since: 1 }, leadAction: { kind: 'post', at: 1 },+ stepUp: { attempt: 2, floor: 2, reason: 'r', at: 1, carry: '' },}describe('the light conversation projection (parts/light.ts)', () => {diff --git a/backend/src/superTabs/parts/light.ts b/backend/src/superTabs/parts/light.tsindex 441aa8105..a07e99df2 100644--- a/backend/src/superTabs/parts/light.ts+++ b/backend/src/superTabs/parts/light.ts@@ -27,7 +27,7 @@ export const GROUP_FIELDS = {always: ['id', 'kind', 'projectId', 'leadId', 'agentIds', 'archived', 'audience', 'dormant', 'assignment.id', 'assignment.agentId', 'assignment.status','assignment.lost'],whenRunning: ['title', 'task.owns', 'assignment.execution', 'assignment.result'],- unread: ['number', 'brief', 'reviewOf', 'checks', 'lastMessageSequence', 'lastMainSequence', 'pullRequestUrls', 'messageSeq', 'reportSeq', 'lastActivityAt', 'lostAttempt', 'requesterId', 'ledger', 'reactionSeq', 'proposals', 'liveness', 'leadAction',+ unread: ['number', 'brief', 'reviewOf', 'checks', 'lastMessageSequence', 'lastMainSequence', 'pullRequestUrls', 'messageSeq', 'reportSeq', 'lastActivityAt', 'lostAttempt', 'requesterId', 'ledger', 'reactionSeq', 'proposals', 'liveness', 'leadAction', 'stepUp','assignment.configuration', 'assignment.recordingProgress', 'assignment.leaseUntil', 'assignment.progressAt', 'assignment.askedOf'],} as constconst LIGHT_GROUP = {diff --git a/backend/src/superTabs/parts/touches.test.ts b/backend/src/superTabs/parts/touches.test.tsindex 864f18091..c1fda1219 100644--- a/backend/src/superTabs/parts/touches.test.ts+++ b/backend/src/superTabs/parts/touches.test.ts@@ -54,7 +54,8 @@ describe('the parts a command touches (design section 1.2, column T)', () => {it('makes two reviews the Swarm opens at once meet on the Reviewer both would take, and on the head that numbers them', () => {const f = swarm(), a = f.group('A')- const reviewer = f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'host', harnessId: 'reviewer', name: 'Reviewer', configuration: config, lead: false },+ // On another engine than the Engineer's: a review never runs on the reviewed Builder's own (rules.ts reviewRefusal).+ const reviewer = f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'host', harnessId: 'reviewer', name: 'Reviewer', configuration: { ...config, engine: config.engine === 'claude' ? 'codex' : 'claude', model: config.engine === 'claude' ? 'default' : 'opus' }, lead: false },owner, { contribution: { machineOwnerId: 'host-owner', contributorId: 'owner' } }).effects.result.agentId as stringf.state.agents.find(x => x.id === reviewer)!.role = 'reviewer'f.state.projects![0]!.repository = { machineId: 'host', cwd: '/repo', repositoryUrl: 'https://github.com/example/project' }diff --git a/backend/src/superTabs/reviewRules.test.ts b/backend/src/superTabs/reviewRules.test.tsnew file mode 100644index 000000000..c25f66cfc--- /dev/null+++ b/backend/src/superTabs/reviewRules.test.ts@@ -0,0 +1,36 @@+import { describe, it, expect } from 'vitest'+import { DEFAULT_ROUTING_POLICY as policy } from './routingPolicy.js'+import { agentTarget, broken, reviewRefusal, targetQuality } from './rules.js'+import { cheapAttempt } from './stepUp.js'+import { recordRun } from './leaderboard/record.js'+const builder = { id: 'builder', machineId: 'allowed', harnessId: 'hb', configuration: { engine: 'claude', model: 'opus', effort: 'high' } }+const stateOf = (reviewer: any) => ({ agents: [builder, reviewer], conversations: [{ id: 'work', projectId: 'p', assignment: { agentId: 'builder', configuration: builder.configuration } }], machines: [], starts: [{ harnessId: reviewer.harnessId, request: { machineId: reviewer.machineId, engine: reviewer.configuration.engine, model: 'default' } }] } as any)+// The Reviewer's probes of ee4ee6c9a (PR #2137): who may review, and when a verdict steps a task up.+describe('reviews and step-ups by what each attempt runs on', () => {+ it('refuses a reported mini model even when its old start requested default', () => {+ const mini = { id: 'reviewer', machineId: 'allowed', harnessId: 'hr', configuration: { engine: 'codex', model: 'gpt-5.5-mini', effort: 'high' } }+ const state = stateOf(mini), target = agentTarget(state, mini as any)+ const server = targetQuality(policy, target)+ expect(reviewRefusal(state, 'work', target, policy), 'A known small reported model must never review').not.toBeNull()+ })+ it('does not block a permitted top-tier same-engine review for an alternative forbidden by the owner', () => {+ const opus = { id: 'reviewer', machineId: 'allowed', harnessId: 'hr', configuration: { engine: 'claude', model: 'opus', effort: 'high' } }+ const state = stateOf(opus)+ state.machines = [{ machineId: 'forbidden', engines: ['codex'] }]+ state.rules = [{ projectId: 'p', rule: { kind: 'machines', machineIds: ['allowed'] }, text: 'Only the approved machine.' }]+ const target = agentTarget(state, opus as any)+ const other = { machineId: 'forbidden', engine: 'codex', model: 'default', effort: 'default' }+ expect(broken(state.rules, other)).not.toBeNull()+ expect(broken(state.rules, target)).toBeNull()+ expect(reviewRefusal(state, 'work', target, policy), 'No alternative engine may run under the owner hard rule').toBeNull()+ })+ it('does not step up a top-tier Codex attempt merely because its ledger retains the reported slug', () => {+ const worker = { id: 'codex', machineId: 'allowed', harnessId: 'hc', configuration: { engine: 'codex', model: 'gpt-6.1-sol', effort: 'high' } }+ const state = stateOf(worker)+ const group = { id: 'work', assignment: { id: 'attempt-2', agentId: worker.id, configuration: worker.configuration }, stepUp: { attempt: 2, floor: 2, reason: 'Grid failed', at: 1, carry: '' } } as any+ expect(targetQuality(policy, agentTarget(state, worker as any))).toBe(3)+ recordRun(state, group, group.assignment, worker as any, 100)+ expect(cheapAttempt(group, policy), 'The attempt was admitted at quality 3 and must not step to the same tier again').toBe(false)+ })+})+diff --git a/backend/src/superTabs/routeRecord.ts b/backend/src/superTabs/routeRecord.tsindex 890e96580..8f4029cd2 100644--- a/backend/src/superTabs/routeRecord.ts+++ b/backend/src/superTabs/routeRecord.ts@@ -55,6 +55,10 @@ export const routeRecordSchema = z.object({why: z.string().trim().min(1).max(300),/** How much context Jev was given and which sources could not be read, so pick quality can later be compared with completeness. */context: z.object({ chars: z.number().int().min(0).max(30_000), missing: z.array(z.string().min(1).max(40)).max(10) }).strict().optional(),+ /** The step up this attempt is (stepUp.ts), written by the server from its group, never taken from the route. */+ stepUp: z.object({ attempt: z.number().int().min(2).max(3), reason: z.string().min(1).max(200) }).strict().optional(),+ /** Why a review runs on its Builder's own engine (rules.ts sameEngineReview), written by the server, never taken from the route. */+ sameEngine: z.string().min(1).max(300).optional(),}).strict().refine(d => d.candidates.some(c => c.id === d.pick), 'The pick must be one of the candidates.').refine(d => new Set(d.candidates.map(c => c.id)).size === d.candidates.length, 'Candidate ids must be unique.')diff --git a/backend/src/superTabs/routingPolicy.test.ts b/backend/src/superTabs/routingPolicy.test.tsindex 13f01987e..a3af4a1cb 100644--- a/backend/src/superTabs/routingPolicy.test.ts+++ b/backend/src/superTabs/routingPolicy.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { DEFAULT_ROUTING_POLICY, effectivePolicy, routingOverrideSchema, routingPolicySchema } from './routingPolicy.js'+import { DEFAULT_ROUTING_POLICY, effectivePolicy, gridQuality, routingOverrideSchema, routingPolicySchema } from './routingPolicy.js'describe('routing policy', () => {it('ships a valid default that needs no setup', () => {@@ -39,4 +39,19 @@ describe('routing policy', () => {expect(bad({ models: [] })).toBe(false)expect(routingOverrideSchema.safeParse({ version: 1 }).success).toBe(false)})++ it('rates Kimi K3 and DeepSeek v4.1 at Sonnet\'s tier and every other grid model at the local quality, from the policy', () => {+ const { policy } = effectivePolicy(null, null)+ expect(gridQuality(policy, 'moonshotai/kimi-k3')).toBe(2)+ expect(gridQuality(policy, 'deepseek/deepseek-v4.1-flash-1017', 'deepseek/deepseek-v4.1-flash-1017 · OpenRouter')).toBe(2)+ expect(gridQuality(policy, 'qwen3:4b', 'Qwen 3 4B')).toBe(1)+ // A policy saved before per-model rows reads the built-in ones; the owner's own rows replace them, first match first.+ const saved = { ...DEFAULT_ROUTING_POLICY, localModels: { quality: 1, enabled: true } }+ expect(gridQuality(effectivePolicy(saved, null).policy, 'moonshotai/kimi-k3')).toBe(2)+ const owner = effectivePolicy(saved, { localModels: { quality: 2, enabled: true, models: [{ model: 'qwen 3', quality: 3 }, { model: 'qwen', quality: 1 }] } }).policy+ expect(gridQuality(owner, 'qwen3:4b', 'Qwen 3 4B')).toBe(3)+ expect(gridQuality(owner, 'moonshotai/kimi-k3')).toBe(2)+ expect(gridQuality({ ...owner, localModels: { quality: 1, enabled: true, models: [] } }, 'moonshotai/kimi-k3')).toBe(1)+ expect(routingPolicySchema.safeParse({ ...DEFAULT_ROUTING_POLICY, localModels: { quality: 1, enabled: true, models: [{ model: 'x', quality: 4 }] } }).success).toBe(false)+ })})diff --git a/backend/src/superTabs/routingPolicy.ts b/backend/src/superTabs/routingPolicy.tsindex 1507779bb..4e21d494e 100644--- a/backend/src/superTabs/routingPolicy.ts+++ b/backend/src/superTabs/routingPolicy.ts@@ -18,9 +18,10 @@ const fields = {floor: z.object({ low: quality, medium: quality, high: quality }).strict(),quotaReserve: z.number().int().min(0).max(90),notes: z.string().trim().max(500),- /** How strong a model served on the Swarm's grid counts (the Local models add-on). Optional: policies saved before it- * still parse, and read the default. */- localModels: z.object({ quality, enabled: z.boolean() }).strict().optional(),+ /** How strong a model served on the Swarm's grid counts (the Local models add-on): `quality` for any model, `models` for+ * those named, first match first (gridQuality). Optional: policies saved before them still parse, and read the defaults. */+ localModels: z.object({ quality, enabled: z.boolean(),+ models: z.array(z.object({ model: z.string().trim().min(1).max(200), quality }).strict()).max(40).optional() }).strict().optional(),}export const routingPolicySchema = z.object({ version: z.literal(1), ...fields }).strict()export const routingOverrideSchema = z.object(fields).partial().strict()@@ -39,8 +40,9 @@ export const DEFAULT_ROUTING_POLICY: RoutingPolicy = {floor: { low: 1, medium: 2, high: 3 },quotaReserve: 10,notes: '',- // Local models are free but weaker: low-difficulty, well-specified work unless the owner says otherwise.- localModels: { quality: 1, enabled: true },+ // Local models are free but weaker: low-difficulty, well-specified work unless the owner says otherwise. Kimi K3 and+ // DeepSeek v4.1 do Sonnet's work (Ken, 2026-10-29: they were offered only for low work and rarely ran).+ localModels: { quality: 1, enabled: true, models: [{ model: 'kimi k3', quality: 2 }, { model: 'deepseek v4.1', quality: 2 }] },}export function effectivePolicy(account: unknown, override: unknown) {@@ -60,6 +62,17 @@ export function effectivePolicy(account: unknown, override: unknown) {overridden.push(...(Object.keys(parsed.data) as Array<keyof RoutingOverride>))}}- policy = { ...policy, localModels: policy.localModels ?? DEFAULT_ROUTING_POLICY.localModels }+ const local = policy.localModels ?? DEFAULT_ROUTING_POLICY.localModels!+ policy = { ...policy, localModels: { ...local, models: local.models ?? DEFAULT_ROUTING_POLICY.localModels!.models } }return { policy, warnings, overridden }}++/** A name's words for matching: lowercase letters and digits, "4.1" read as "41" (cli superTabs/route.ts `words`). */+const words = (text: string) => text.toLowerCase().split(/[^a-z0-9.]+/).map(w => w.replace(/\./g, '')).filter(Boolean)+/** How strong a grid model counts: the first of the policy's named rows whose every word is in its id or label, else the+ * policy's local quality. The CLI's route rates the same way (cli superTabs/route.ts gridQuality). */+export function gridQuality(policy: RoutingPolicy, model: string, label = ''): number {+ const name = words(`${model} ${label}`).join('')+ const local = policy.localModels ?? DEFAULT_ROUTING_POLICY.localModels!+ return local.models?.find(row => words(row.model).every(w => name.includes(w)))?.quality ?? local.quality+}diff --git a/backend/src/superTabs/rules.ts b/backend/src/superTabs/rules.tsindex 30374a78c..8b2e0eb2b 100644--- a/backend/src/superTabs/rules.ts+++ b/backend/src/superTabs/rules.ts@@ -4,6 +4,7 @@* half the time on 2026-10-22 (Haiku, a stopping agent, low effort) because it did not know the owner's rules. */import { z } from 'zod'import type { Agent, SuperTabState, TaskRequirement } from './model.js'+import type { RoutingPolicy } from './routingPolicy.js'const id = z.string().min(1).max(160).regex(/^[A-Za-z0-9_-]+$/)const engine = z.enum(['claude', 'codex'])@@ -39,8 +40,10 @@ export interface SwarmRule {}/** What would run: a start request, an agent's configuration, or a routed pick. Null when not known. `devices` are those its* machine checked are connected: a start's, or the start that launched an agent; absent only for a new agent's pick, whose- * start is checked when it is made. */-export interface RunTarget { machineId: string; engine: string; model: string | null; effort: string | null; devices?: string[] }+ * start is checked when it is made. `gridModel`: a model served on the Swarm's grid that its engine drives. */+export interface RunTarget { machineId: string; engine: string; model: string | null; effort: string | null; devices?: string[]; gridModel?: string+ /** An agent its start launched on the engine's own model: rated by the policy's `default` row (targetQuality). */+ launchedDefault?: true }const ENGINE: Record<string, string> = { claude: 'Claude', codex: 'Codex' }/** `default` and `auto` say nothing about the effort, so they never meet a minimum. */@@ -87,9 +90,9 @@ export function unmet(requires: TaskRequirement | undefined, target: RunTarget,return missing.length ? `This task needs ${missing.join(', ')}: only an agent whose start names ${one ? 'it' : 'them'} in its required devices, so its machine checks ${one ? 'it is' : 'they are'} connected, may take it.` : null}-export const startTarget = (request: { machineId: string; engine: string; model?: string; effort?: string; requirements?: { devices: string[] } }): RunTarget =>+export const startTarget = (request: { machineId: string; engine: string; model?: string; effort?: string; requirements?: { devices: string[] }; gridModel?: string }): RunTarget =>({ machineId: request.machineId, engine: request.engine, model: request.model ?? null, effort: request.effort ?? null,- ...(request.requirements ? { devices: request.requirements.devices } : {}) })+ ...(request.requirements ? { devices: request.requirements.devices } : {}), ...(request.gridModel ? { gridModel: request.gridModel } : {}) })/** A started agent was launched with `--effort`, which Claude never reports back, so its configuration may say `auto`; its* start record still holds what it was launched with (manual run 2026-10-19). */@@ -98,5 +101,83 @@ export function agentTarget(state: SuperTabState, worker: Agent): RunTarget {const start = state.starts?.find(s => s.harnessId === worker.harnessId && s.request.machineId === worker.machineId)const launched = start?.request.effortreturn { machineId: worker.machineId, engine: worker.configuration.engine, model: worker.configuration.model,- effort: reported && reported !== 'auto' ? reported : launched ?? reported, devices: start?.request.requirements?.devices ?? [] }+ effort: reported && reported !== 'auto' ? reported : launched ?? reported, devices: start?.request.requirements?.devices ?? [],+ ...(worker.gridModel ? { gridModel: worker.gridModel } : {}), ...(start && !worker.gridModel && !start.request.gridModel && (start.request.model ?? 'default') === 'default' ? { launchedDefault: true as const } : {}) }+}++/** The policy's strength of a subscription model, as the CLI's route rates it (cli superTabs/route.ts rateFor): its named row+ * (a Claude id by its family), else the engine's `default` row for the engine's own model ([engineDefault]: launched on it),+ * else 1: a model the policy does not name, a small Codex variant among them, is never taken for a strong one (review of+ * #2137). */+export function policyQuality(policy: RoutingPolicy, engine: string, model: string | null, effort: string | null, engineDefault = false): number {+ const name = model === null ? 'default' : engine === 'claude' ? FAMILY.exec(model.toLowerCase())?.[0] ?? model : model+ const rowOf = (named: string) => {+ const rows = policy.models.filter(m => m.engine === engine && m.model === named)+ return rows.find(m => m.effort === (effort ?? 'default')) ?? rows[0]+ }+ // A small model it reports is never promoted by its launch (review of ee4ee6c9a).+ return (rowOf(name) ?? (engineDefault && !SMALL.test(model ?? '') ? rowOf('default') : undefined))?.quality ?? 1+}+/** A small variant by its name: a mini or a nano. */+const SMALL = /(^|[^a-z0-9])(mini|nano)([^a-z0-9]|$)/i+/** A target's strength: an agent launched on the engine's own model falls back to the `default` row (Codex reports its slug). */+export const targetQuality = (policy: RoutingPolicy, t: RunTarget) => policyQuality(policy, t.engine, t.model, t.effort, !!t.launchedDefault)+/** A model family: a grid model's own, else its engine's. */+const familyOf = (t: { engine: string; gridModel?: string }) => t.gridModel ? `grid:${t.gridModel}` : t.engine++/** Whether a new Reviewer may run [target] for [contributorId]'s machine: its owner's rules, the task's machine and team+ * access, as the command judges them. Busy, offline or short of quota still counts as able, within its start window. */+export type MayRun = (target: RunTarget, contributorId: string) => boolean+/** Whether a strong Reviewer of another family than [builder]'s can run in this Swarm: on a machine an agent runs on or a+ * contributed machine offers, with an engine other than the Builder's and an enabled policy row of quality 2 or more that+ * [mayRun] allows there (review of ee4ee6c9a: an engine the owner rules out blocked the fallback). */+function otherFamilyReviews(state: SuperTabState, builder: { engine: string; gridModel?: string }, policy: RoutingPolicy, mayRun: MayRun): boolean {+ const places = [...state.agents.filter(a => !a.gridModel && !a.buddyOf).map(a => ({ machineId: a.machineId, contributorId: a.contributorId, engines: [a.configuration.engine] })),+ ...(state.machines ?? []).map(m => ({ machineId: m.machineId, contributorId: m.contributorId, engines: m.engines }))]+ return places.some(place => place.engines.some(engine => familyOf({ engine }) !== familyOf(builder) && policy.models.some(row => row.enabled && row.engine === engine+ && row.quality >= 2 && mayRun({ machineId: place.machineId, engine, model: row.model, effort: liftEffort(state.rules, engine, row.effort) }, place.contributorId))))+}+/** The effort a new agent on a row starts at: the row's, or the owner's minimum when the row leaves it to the engine (cli+ * superTabs/route.ts liftEffort). */+function liftEffort(rules: SwarmRule[] | undefined, engine: string, effort: string): string {+ if (rank(effort) >= 0) return effort+ const least = Math.max(-1, ...(rules ?? []).flatMap(({ rule }) => rule.kind === 'minEffort' && (!rule.engine || rule.engine === engine) ? [rank(rule.effort)] : []))+ return least < 0 ? effort : EFFORTS[least]!+}++/** How [target] may review the work of group [reviewed] (Ken, 2026-10-29: a small model never reviews again): never on a model+ * served on the Swarm's grid or one the policy rates below 2, and on another model family than the reviewed Builder's while+ * a strong Reviewer of another family can run here. With none, the Builder's own engine at its top tier, noted (Lead,+ * 2026-10-29: a Swarm of one engine keeps its automatic reviews). */+function judgeReview(state: SuperTabState, reviewed: string | undefined, target: RunTarget, policy: RoutingPolicy, mayRun: MayRun): { refusal: string } | { note: string } | null {+ if (!reviewed) return null+ if (target.gridModel) return { refusal: 'A review never runs on a model served on the Swarm\'s grid.' }+ const quality = targetQuality(policy, target)+ const engine = ENGINE[target.engine] ?? target.engine+ if (quality < 2) return { refusal: `A review needs a model of quality 2 or more, and ${engine} ${target.model} is ${quality}.` }+ const assignment = state.conversations.find(c => c.id === reviewed)?.assignment+ const worker = assignment && state.agents.find(a => a.id === assignment.agentId)+ const builder = worker ? agentTarget(state, worker) : assignment ? { engine: assignment.configuration.engine } : null+ // A grid target was refused above, so the same family is the target's engine.+ if (!builder || familyOf(builder) !== familyOf(target)) return null+ if (otherFamilyReviews(state, builder, policy, mayRun)) return { refusal: `A review runs on another engine than the reviewed Builder's, ${engine}.` }+ return quality === 3 ? { note: `No Reviewer on another engine than the Builder's (${engine}) can run in this Swarm, so the review runs on it at the top tier.` }+ : { refusal: `A review on the reviewed Builder's engine, ${engine}, needs its top tier (quality 3): no Reviewer on another engine can run in this Swarm.` }+}+/** Why [target] may not review the work of group [reviewed]; null when it may, or nothing is reviewed. */+/** Without the command's own judgement, a machine may run a review where the owner's rules for the reviewed group's project+ * allow it. */+const ownerAllows = (state: SuperTabState, reviewed: string | undefined): MayRun => {+ const projectId = state.conversations.find(c => c.id === reviewed)?.projectId+ const rules = (state.rules ?? []).filter(r => !r.projectId || !projectId || r.projectId === projectId)+ return target => !broken(rules, target)+}+export function reviewRefusal(state: SuperTabState, reviewed: string | undefined, target: RunTarget, policy: RoutingPolicy, mayRun: MayRun = ownerAllows(state, reviewed)): string | null {+ const judged = judgeReview(state, reviewed, target, policy, mayRun)+ return judged && 'refusal' in judged ? judged.refusal : null+}+/** Why [target] reviews on the reviewed Builder's own engine, when it may only because no other engine can; null otherwise. */+export function sameEngineReview(state: SuperTabState, reviewed: string | undefined, target: RunTarget, policy: RoutingPolicy, mayRun: MayRun = ownerAllows(state, reviewed)): string | null {+ const judged = judgeReview(state, reviewed, target, policy, mayRun)+ return judged && 'note' in judged ? judged.note : null}diff --git a/backend/src/superTabs/stepUp.ts b/backend/src/superTabs/stepUp.tsnew file mode 100644index 000000000..1d1a7373e--- /dev/null+++ b/backend/src/superTabs/stepUp.ts@@ -0,0 +1,67 @@+/** Cheap first, step up on failure (Ken, 2026-10-29). Simple work runs on a model served on the Swarm's grid first (cli+ * superTabs/route.ts softOf); when that attempt's first review says Ready no, or its grid host never starts its agent, the+ * group steps up a tier: no grid and quality 2 (Sonnet), then quality 3 (Opus), at most twice. The server records the step,+ * closes the failed attempt and wakes the Lead; the Lead's route and start run the next attempt, since only its machine can+ * probe the others (autoReview.ts, the same ruling for Reviewers). */+import { activeWork, finishWorker, type Conversation, type SuperTabState } from './model.js'+import { policyQuality, targetQuality, type RunTarget } from './rules.js'+import type { RoutingPolicy } from './routingPolicy.js'++/** Grid, then Sonnet, then Opus; after that it is the Lead's decision (Lead, 2026-10-29). */+export const MAX_STEP_UPS = 2+/** What of the failed attempt a brief keeps: conversation.create takes briefs up to 8,000 characters. */+const CARRY_CHARS = 2000+export const REVIEW_FAILED = 'Its first review said Ready no.'+export const GRID_START_FAILED = 'Its grid host did not start the agent.'++/** A group's last step up: the attempt it opened (2 or 3), the least quality from then on, why, when, and what the failed+ * attempt left for the next one's brief. */+export interface StepUp { attempt: number; floor: number; reason: string; at: number; carry: string+ /** The failed start that stepped it up, so another report of that failure steps nothing up. */+ startId?: string }++const lower = (text: string) => `${text[0]!.toLowerCase()}${text.slice(1)}`++/** Whether [group]'s current attempt is on the cheap path: on a grid model, or already stepped up and below the top tier as+ * its ledger rates it, its launch on the engine's own model included (review of ee4ee6c9a). */+export function cheapAttempt(group: Conversation, policy: RoutingPolicy): boolean {+ const run = group.ledger?.runs?.find(r => r.assignmentId === group.assignment?.id)+ if (!run) return false+ if (run.grid) return true+ return !!group.stepUp && policyQuality(policy, run.engine, run.model, run.effort ?? null, !!run.engineDefault) < 3+}++/** Steps [group] up for [reason]: records the step, closes its attempt if one is going, and says what to tell its Lead and+ * whom it stopped. Null for a review, once it stepped up [MAX_STEP_UPS] times, or for a failed start ([startId]) that+ * stepped it up already. */+export function stepUp(state: SuperTabState, group: Conversation, reason: string, now: number, startId?: string): { notice: string; stopped: string | null } | null {+ const attempt = (group.stepUp?.attempt ?? 1) + 1+ if (group.reviewOf || attempt > MAX_STEP_UPS + 1 || (startId && group.stepUp?.startId === startId)) return null+ const assignment = group.assignment+ const findings = group.checks.filter(c => c.independent && c.evidence && !c.passedBy).map(c => c.evidence!)+ const carry = [...group.pullRequestUrls?.length ? [`Pull requests: ${group.pullRequestUrls.join(' ')}`] : [],+ ...assignment?.result ? [`Last result: ${assignment.result}`] : [], ...findings.length ? [`Findings:\n${findings.join('\n')}`] : []]+ .join('\n').slice(0, CARRY_CHARS)+ const floor = attempt === 2 ? 2 : 3+ group.stepUp = { attempt, floor, reason, at: now, carry, ...startId ? { startId } : {} }+ let stopped: string | null = null+ if (assignment && activeWork(group)) {+ assignment.status = 'cancelled'+ assignment.result = `Stepped up: ${lower(reason)}`+ finishWorker(state, assignment.agentId, group)+ stopped = assignment.agentId+ }+ return { stopped, notice: `#${group.number} stepped up to attempt ${attempt}: ${lower(reason)} Route it again: the route leaves out models on the grid and `+ + `below quality ${floor}, and the new attempt's brief carries the branch, the last result and the findings.` }+}++/** Why [target] may not take a stepped-up group's work: a grid model, or one the policy rates below the step's floor. */+export function stepUpRefusal(group: Conversation, target: RunTarget, policy: RoutingPolicy): string | null {+ const step = group.stepUp+ if (!step) return null+ return target.gridModel || targetQuality(policy, target) < step.floor+ ? `This task stepped up from a cheaper model: it runs on no model on the grid and nothing below quality ${step.floor}.` : null+}++/** The next attempt's brief: what the failed one left. */+export const carryOver = (group: Conversation) => group.stepUp?.carry ? `\n\nCarry-over from attempt ${group.stepUp.attempt - 1}:\n${group.stepUp.carry}` : ''diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.tsindex 31e6bc395..b920ccd4b 100644--- a/backend/src/superTabs/store.ts+++ b/backend/src/superTabs/store.ts@@ -548,13 +548,18 @@ export class SuperTabStore {const actor = await this.actor(tx, user, state, asAgentId)author(state, actor)refuseBuddyRouting(state, actor)- const account = await tx.routingPolicy.findUnique({ where: { id: stableId('routing-policy', state.ownerId, state.environment) } })- // The owner's account policy alone, so a field reset to "use account default" can show its value.- return { ...effectivePolicy(account?.policy ?? null, state.routingPolicy ?? null), override: state.routingPolicy ?? null,- account: effectivePolicy(account?.policy ?? null, null).policy }+ return this.policyOf(tx, state)})}+ /** The tab's effective policy: its owner's account policy with the tab's override. */+ private async policyOf(tx: Transaction, state: SuperTabState) {+ const account = await tx.routingPolicy.findUnique({ where: { id: stableId('routing-policy', state.ownerId, state.environment) } })+ // The owner's account policy alone, so a field reset to "use account default" can show its value.+ return { ...effectivePolicy(account?.policy ?? null, state.routingPolicy ?? null), override: state.routingPolicy ?? null,+ account: effectivePolicy(account?.policy ?? null, null).policy }+ }+/** Shared with the read API (superTabs/read, design section 7.2). */async row(tx: Transaction, user: AuthUser, tabId: string) {return requireParts(await tx.superTab.findFirst({ where: { id: tabId, autonomousEnv: user.autonomousEnv }, select: SWARM_ROW }) ??@@ -1153,6 +1158,10 @@ export class SuperTabStore {const member = await activeMember(tx, original.workspaceId, actor.userId)if (member) context.workspaceRole = member.role as WorkspaceRole}+ // Who may review, and whether a verdict steps a task up, is judged by the tab's policy (rules.ts,+ // stepUp.ts).+ if (TEAM_WORK_COMMANDS.has(command.type) || command.type === 'work.check'+ || (command.type === 'work.status' && command.status === 'review')) context.routingPolicy = (await this.policyOf(tx, original)).policy// A Ready for review may assign a Reviewer by itself (autoReview.ts), as work.assign does.if (TEAM_WORK_COMMANDS.has(command.type) || (command.type === 'work.status' && command.status === 'review')) {context.teamMachines = await this.teamMachines(tx, original)diff --git a/cli/src/cable/cableHost.spec.ts b/cli/src/cable/cableHost.spec.tsindex 90bf2f95b..3ed104af1 100644--- a/cli/src/cable/cableHost.spec.ts+++ b/cli/src/cable/cableHost.spec.ts@@ -1017,7 +1017,7 @@ describe('Swarm cards', () => {it('hands the wiring what a device asks, and answers nothing when the wiring has none', async () => {const w = wiring({- swarmCardsWanted: vi.fn(), swarmCardOpen: vi.fn(), superTabSelected: vi.fn(), swarmSay: vi.fn(async () => true),+ swarmCardsWanted: vi.fn(), swarmCardOpen: vi.fn(), swarmCardSide: vi.fn(), superTabSelected: vi.fn(), swarmSay: vi.fn(async () => ({ said: true as const })),swarmCardRecap: vi.fn(async (tabId: string, leadId: string) => ({ tabId, leadId, text: 'hi', at: 1, none: false })),})const host = new DaemonCableHost(w)@@ -1031,13 +1031,21 @@ describe('Swarm cards', () => {expect(w.swarmCardOpen).toHaveBeenLastCalledWith('c1', 'st1', 'l1', true)await host.swarmCardRecap('st1', 'l1', true)expect(w.swarmCardRecap).toHaveBeenLastCalledWith('st1', 'l1', true)- expect(await host.swarmSay('h1', 'ship it', true)).toBe(true)+ expect(await host.swarmSay('h1', 'ship it', true)).toEqual({ said: true })expect(w.swarmSay).toHaveBeenLastCalledWith('h1', 'ship it', true)await host.swarmSay('h1', 'ship it')expect(w.swarmSay).toHaveBeenLastCalledWith('h1', 'ship it', false)+ // A dial that speaks swarmBuddy asks for the face on its side, and says which side it swiped to.+ await host.swarmCardRecap('st1', 'l1', 'buddy')+ expect(w.swarmCardRecap).toHaveBeenLastCalledWith('st1', 'l1', 'buddy')+ host.swarmCardSide('st1', 'buddy')+ expect(w.swarmCardSide).toHaveBeenLastCalledWith('st1', 'buddy')+ await host.swarmSay('h1', 'ship it', 'buddy', 'pm1')+ expect(w.swarmSay).toHaveBeenLastCalledWith('h1', 'ship it', 'buddy', 'pm1')const bare = new DaemonCableHost(wiring())- bare.swarmCardsWanted(false); bare.swarmCardOpen('c1', 'st1', null); bare.superTabSelected('st1', 'p1')+ bare.swarmCardsWanted(false); bare.swarmCardOpen('c1', 'st1', null); bare.swarmCardSide('st1', 'pm'); bare.superTabSelected('st1', 'p1')expect(await bare.swarmCardRecap('st1', 'l1')).toBeNull()+ expect(await bare.swarmSay('h1', 'ship it')).toEqual({ said: false })})})diff --git a/cli/src/cable/cableHost.ts b/cli/src/cable/cableHost.tsindex 4640df63a..120828850 100644--- a/cli/src/cable/cableHost.ts+++ b/cli/src/cable/cableHost.ts@@ -28,7 +28,7 @@ import type { FleetRouting } from '../services/fleet.js'import { ServiceUnavailableError } from '../core/serviceHost.js'import { PLAYER_STATES, type PlayerSession } from './playerLibrary.js'-import type { LeadRecap, SwarmCard } from '../superTabs/cards.js'+import type { CardChat, CardSide, LeadRecap, SaidOnCard, SwarmCard } from '../superTabs/cards.js'import type { ActivitySnapshot, AppSwarms, SuperTabAsk, CableAgent, CableHost, CableMachine, CableMachineSource, CableSwarm, CableTile, DialStatus, OpenReason, RouteDecision } from './cableSession.js'import type { WindowRoute } from './windowRoute.js'import type { SelectionCommand, SelectionResult } from './windowSelection.js'@@ -108,11 +108,14 @@ export interface CableHostWiring {/** A Harness Pro came with Swarm cards (true) or the last one went (false): the core reads the Swarms only meanwhile. */swarmCardsWanted?: (on: boolean) => void/** One Lead's last message, read on request; null when it could not be read. */- swarmCardRecap?: (tabId: string, leadId: string, chat?: boolean) => Promise<LeadRecap | null>+ swarmCardRecap?: (tabId: string, leadId: string, chat?: CardChat) => Promise<LeadRecap | null>/** The recap a device (one cable `session`) has open, or null once closed. */- swarmCardOpen?: (session: string, tabId: string, leadId: string | null, chat?: boolean) => void- /** Words for a Lead that runs here, posted as the person in its Swarm chat; false when the harness leads no project. */- swarmSay?: (harnessId: string, text: string, chat?: boolean) => Promise<boolean>+ swarmCardOpen?: (session: string, tabId: string, leadId: string | null, chat?: CardChat) => void+ /** A round dial that speaks swarmBuddy swiped to a side of a Swarm (spec 2026-10-29-round-dial-pm-buddy). */+ swarmCardSide?: (tabId: string, side: CardSide) => void+ /** Words for a Lead that runs here, posted as the person in its Swarm chat; not `said` when the harness leads no project,+ * `refused` with the backend's reason when it refused the post. */+ swarmSay?: (harnessId: string, text: string, chat?: CardChat, chatId?: string) => Promise<SaidOnCard>/** A device picked a Lead: the window opens that Swarm tab and project. */superTabSelected?: (superTabId: string, projectId: string) => void/** A finger on the dial's glass, in pieces, while it is down; `superTabId` when it scrolls that Swarm's chat (a Pro's Lead view). */@@ -429,16 +432,20 @@ export class DaemonCableHost implements CableHost {this.wiring.swarmCardsWanted?.(on)}- swarmCardRecap(tabId: string, leadId: string, chat = false): Promise<LeadRecap | null> {+ swarmCardRecap(tabId: string, leadId: string, chat: CardChat = false): Promise<LeadRecap | null> {return this.wiring.swarmCardRecap?.(tabId, leadId, chat) ?? Promise.resolve(null)}- swarmCardOpen(session: string, tabId: string, leadId: string | null, chat = false): void {+ swarmCardOpen(session: string, tabId: string, leadId: string | null, chat: CardChat = false): void {this.wiring.swarmCardOpen?.(session, tabId, leadId, chat)}- swarmSay(harnessId: string, text: string, chat = false): Promise<boolean> {- return this.wiring.swarmSay?.(harnessId, text, chat) ?? Promise.resolve(false)+ swarmCardSide(tabId: string, side: CardSide): void {+ this.wiring.swarmCardSide?.(tabId, side)+ }++ swarmSay(harnessId: string, text: string, chat: CardChat = false, chatId?: string): Promise<SaidOnCard> {+ return this.wiring.swarmSay?.(harnessId, text, chat, ...(chatId ? [chatId] : [])) ?? Promise.resolve({ said: false })}superTabSelected(superTabId: string, projectId: string): void {diff --git a/cli/src/cable/cableSession.spec.ts b/cli/src/cable/cableSession.spec.tsindex 3c4e33074..ae330a22d 100644--- a/cli/src/cable/cableSession.spec.ts+++ b/cli/src/cable/cableSession.spec.ts@@ -14,7 +14,7 @@ import { describe, expect, it, vi } from 'vitest'import { CABLE_MAX_FRAME, CableDecoder, CableType, encodeCableFrame } from './cableFrame.js'import { CableSession, recapFrame, type CableAgent, type CableHost, type CableMachine, type CablePort } from './cableSession.js'import { DialLog } from './dialLog.js'-import type { SwarmCard, SwarmLead } from '../superTabs/cards.js'+import type { SaidOnCard, SwarmCard, SwarmLead } from '../superTabs/cards.js'import type { PetStore } from './pets/store.js'/** A port whose two ends are both in this process. */@@ -798,7 +798,7 @@ describe('cable session', () => {})it('posts words spoken to a Swarm Lead in its Swarm chat, and types them for any other harness', async () => {- const swarmSay = vi.fn(async (id: string) => id === 'a1')+ const swarmSay = vi.fn(async (id: string) => ({ said: id === 'a1' }))const host = makeHost({ transcribe: vi.fn(async () => 'ship it'), route: vi.fn(), swarmSay })const { session, port } = await connect(host)try {@@ -4249,7 +4249,7 @@ describe('swarm cards', () => {it('a device without swarmChat gets today\'s frames', async () => {for (const hello of [PRO, { ...ROUND, swarmChat: undefined }]) {const cards = [card('st1', [lead(1, { state: 'ask', chat: pmChat, notice: notice() }), lead(2, { chat: group })])]- const swarmSay = vi.fn(async () => true)+ const swarmSay = vi.fn(async () => ({ said: true as const }))const host = cardHost({ cards }, { transcribe: vi.fn(async () => 'ship it'), route: vi.fn(), swarmSay })const { session, port } = await connect(host)try {@@ -4404,7 +4404,7 @@ describe('swarm cards', () => {})it('asks recaps and talks with chat, and passes chatId on the recap', async () => {- const swarmSay = vi.fn(async () => true)+ const swarmSay = vi.fn(async () => ({ said: true as const }))const host = cardHost({ cards: [card('st1', [lead(1, { chat: group })])] }, {transcribe: vi.fn(async () => 'ship it'), route: vi.fn(), swarmSay,swarmCardRecap: vi.fn(async (tabId: string, leadId: string) => ({ tabId, leadId, text: 'From the group', at: 7, none: false, chatId: 'g1' })),@@ -4446,4 +4446,309 @@ describe('swarm cards', () => {} finally { await session.stop() }})})++ // ── swarmBuddy: 'v1' (the round dial's PM and Buddy screens, spec 2026-10-29-round-dial-pm-buddy) ─────────────+ describe('swarmBuddy', () => {+ const ROUND = { t: 'hello', product: 'harness', mac: 'cc:dd', swarmCard: 'v1', superTab: 'wait-v1', swarmChat: 'v1' }+ const BUDDY = { ...ROUND, swarmBuddy: 'v1' }+ const pmChat = { kind: 'pm' as const, id: 'pm1', name: 'PM', working: false }+ const buddyChat = { kind: 'buddy' as const, id: 'pm1', name: "diego's Buddy", working: false }+ const buddy = { chatId: 'pm1', name: "diego's Buddy", engine: 'codex', cells: 25513, color: '#d6a79a', live: true }+ const pmNotice = (id: string) => ({ chat: 'pm' as const, chatId: 'pm1', id, text: `From the PM ${id}`, at: 1792560000 })+ const buddyNotice = (id: string) => ({ chat: 'buddy' as const, chatId: 'pm1', id, text: `From the Buddy ${id}`, at: 1792560000 })+ /** Lead 1 as the cards say it with Buddies on: today's face (`chat`) beside the swarmBuddy dial's (`sideChat`). */+ const withBuddy = (over: Partial<SwarmLead> = {}) => lead(1, { chat: pmChat, sideChat: buddyChat, buddies: true, buddy, ...over })+ const voice = (port: LoopbackPort, agentId: string) => {+ port.say({ t: 'voice.begin', uploadId: `u-${agentId}`, agentId })+ port.pcm(Buffer.alloc(3200)); port.say({ t: 'voice.end' })+ }+ /** The raw bytes of every `supertab…` frame written, in order. */+ const supertabBytes = (port: LoopbackPort): Buffer[] => port.frames.map((f) => Buffer.from(f)).filter((f) => {+ let isSupertab = false+ new CableDecoder().feed(f, (frame) => {+ if (frame.type === CableType.Json) isSupertab = String(JSON.parse(Buffer.from(frame.payload).toString('utf8')).t).startsWith('supertab')+ })+ return isSupertab+ })++ 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 }))+ try {+ port.say(BUDDY)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ const base = (n: number) => ({ id: `lead${n}`, projectId: `proj${n}`, project: `Project ${n}`, engine: 'claude', owner: '', local: '', state: 'done', order: n })+ expect(ofType(port, 'supertab')[0].leads).toEqual([+ { ...base(1), chat: 'buddy', chatId: 'pm1', chatName: "diego's Buddy", buddies: true, buddy },+ // No Buddy in this project: the flag alone, and the face the side shows.+ { ...base(2), chat: 'lead', chatId: 'lead-c2', chatName: 'Lead', buddies: true },+ // Buddies off: exactly a swarmChat dial's Lead.+ { ...base(3) },+ ])+ } finally { await session.stop() }+ })++ it('a swarmChat dial without swarmBuddy gets today\'s frame, byte for byte, whatever the Buddy fields', async () => {+ const run = async (leads: () => SwarmLead[]) => {+ const state = { cards: [card('st1', leads())] }+ const { session, port } = await connect(cardHost(state))+ try {+ port.say(ROUND)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ await settle(); await settle()+ state.cards = [card('st1', leads().map((l) => ({ ...l, notice: pmNotice('n2') })))]+ await session.syncSwarmCards()+ await vi.waitFor(() => expect(ofType(port, 'supertab.notice')).toHaveLength(2))+ port.say({ t: 'supertab.recap.get', tab: 'st1', lead: 'lead1' })+ await vi.waitFor(() => expect(ofType(port, 'supertab.recap')).toHaveLength(1))+ return supertabBytes(port)+ } finally { await session.stop() }+ }+ const today = await run(() => [lead(1, { chat: pmChat }), lead(2, { chat: pmChat })])+ const buddies = await run(() => [withBuddy({ buddyNotice: buddyNotice('b1') }), lead(2, { chat: pmChat, sideChat: buddyChat, buddies: true })])+ expect(today.length).toBeGreaterThan(2)+ expect(buddies).toEqual(today)+ })++ it('supertab.side reaches the cards as cardSide, and only from a swarmBuddy dial', async () => {+ for (const hello of [BUDDY, ROUND, PRO]) {+ const swarmCardSide = vi.fn()+ const { session, port } = await connect(cardHost({ cards: [card('st1', [withBuddy()])] }, { swarmCardSide }))+ try {+ port.say(hello)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ port.say({ t: 'supertab.side', tab: 'st1', side: 'buddy' })+ port.say({ t: 'supertab.side', tab: 'st1', side: 'pm' })+ for (const bad of [{ tab: 'bad id', side: 'pm' }, { tab: 'x'.repeat(48), side: 'pm' }, { tab: 'st1', side: 'up' }, { tab: 'st1' }, { side: 'pm' }]) port.say({ t: 'supertab.side', ...bad })+ await settle(); await settle()+ expect(swarmCardSide.mock.calls).toEqual(hello === BUDDY ? [['st1', 'buddy'], ['st1', 'pm']] : [])+ } finally { await session.stop() }+ }+ })++ it('a buddy notice reaches only a swarmBuddy dial, apart from the Lead\'s', async () => {+ for (const hello of [BUDDY, ROUND]) {+ const state = { cards: [card('st1', [withBuddy()])] }+ const { session, port } = await connect(cardHost(state))+ try {+ port.say(hello)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ await settle(); await settle()+ state.cards = [card('st1', [withBuddy({ notice: pmNotice('n1'), buddyNotice: buddyNotice('b1') })])]+ await session.syncSwarmCards()+ await vi.waitFor(() => expect(ofType(port, 'supertab.notice').length).toBeGreaterThan(0))+ await new Promise((r) => setTimeout(r, 350))+ const pm = { t: 'supertab.notice', tab: 'st1', lead: 'lead1', chat: 'pm', chatId: 'pm1', id: 'n1', text: 'From the PM n1', at: 1792560000 }+ const quiet = { t: 'supertab.notice', tab: 'st1', lead: 'lead1', chat: 'buddy', chatId: 'pm1', id: 'b1', text: 'From the Buddy b1', at: 1792560000 }+ expect(ofType(port, 'supertab.notice')).toEqual(hello === BUDDY ? [pm, quiet] : [pm])+ // The Buddy's next word is sent once more; the Lead's held notice is not sent again.+ state.cards = [card('st1', [withBuddy({ notice: pmNotice('n1'), buddyNotice: buddyNotice('b2') })])]+ await session.syncSwarmCards()+ await new Promise((r) => setTimeout(r, 350))+ expect(ofType(port, 'supertab.notice').map((n) => n.id)).toEqual(hello === BUDDY ? ['n1', 'b1', 'b2'] : ['n1'])+ } finally { await session.stop() }+ }+ })++ it('asks recaps, opens and talks for the face on its side, and takes only the recaps of that face', async () => {+ const swarmSay = vi.fn(async () => ({ said: true as const }))+ const host = cardHost({ cards: [card('st1', [withBuddy()])] }, {+ transcribe: vi.fn(async () => 'an idea'), route: vi.fn(), swarmSay,+ swarmCardRecap: vi.fn(async (tabId: string, leadId: string) => ({ tabId, leadId, text: 'From the Buddy', at: 7, none: false, chatId: 'pm1', buddy: true as const })),+ })+ const { session, port } = await connect(host)+ try {+ port.say(BUDDY)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ port.say({ t: 'supertab.recap.get', tab: 'st1', lead: 'lead1' })+ await vi.waitFor(() => expect(ofType(port, 'supertab.recap')).toEqual([+ { t: 'supertab.recap', tab: 'st1', lead: 'lead1', text: 'From the Buddy', at: 7, none: false, chatId: 'pm1' }]))+ expect(vi.mocked(host.swarmCardRecap!).mock.calls).toEqual([['st1', 'lead1', 'buddy']])+ port.say({ t: 'supertab.open', tab: 'st1', lead: 'lead1' }); await settle()+ expect(vi.mocked(host.swarmCardOpen!).mock.calls.at(-1)).toEqual([expect.stringMatching(/^c\d+$/), 'st1', 'lead1', 'buddy'])+ // An older dial's recap of the same chat is not this dial's.+ await session.swarmCardRecap({ tabId: 'st1', leadId: 'lead1', text: 'the PM', at: 8, none: false, chatId: 'pm1' })+ await session.swarmCardRecap({ tabId: 'st1', leadId: 'lead1', text: 'the Buddy again', at: 9, none: false, chatId: 'pm1', buddy: true })+ expect(ofType(port, 'supertab.recap').map((r) => r.text)).toEqual(['From the Buddy', 'the Buddy again'])+ voice(port, 'a1')+ await vi.waitFor(() => expect(swarmSay).toHaveBeenCalled())+ expect(swarmSay.mock.calls[0]).toEqual(['a1', 'an idea', 'buddy'])+ } finally { await session.stop() }+ })++ // Review Focus 5: a post the backend refuses (a read-only Chat with PM, Buddies off, a Buddy chat not the reader's) was+ // typed into the Lead's terminal instead.+ const spoken = async (hello: Record<string, unknown>, leads: SwarmLead[], swarmSay: CableHost['swarmSay']) => {+ const host = cardHost({ cards: [card('st1', leads)] }, { transcribe: vi.fn(async () => 'ship it'), route: vi.fn(), swarmSay })+ const { session, port } = await connect(host)+ try {+ port.say(hello); await settle()+ voice(port, 'h1')+ await vi.waitFor(() => expect(port.sent.some((m) => m.t === 'voice.error' || m.t === 'voice.transcript') || vi.mocked(host.sendTurn).mock.calls.length > 0).toBe(true))+ await settle()+ return { errors: ofType(port, 'voice.error').map((m) => m.message), turns: vi.mocked(host.sendTurn).mock.calls }+ } finally { await session.stop() }+ }+ const refused = { said: false as const, refused: { code: 'PM_CHAT_READ_ONLY', message: 'Chat with PM is read-only.' } }++ it('a refused voice post shows voice.error and types nothing', async () => {+ for (const hello of [{ t: 'hello', product: 'harness', mac: 'aa:bb' }, PRO, ROUND, BUDDY]) {+ const swarmSay = vi.fn(async () => refused)+ expect(await spoken(hello, [withBuddy({ local: 'h1', sideChat: { kind: 'lead', id: 'lead-c1', name: 'Lead', working: false } })], swarmSay))+ .toEqual({ errors: ['Chat with PM is read-only.'], turns: [] })+ expect(swarmSay).toHaveBeenCalledOnce()+ }+ })++ it('on the Buddy face an unreachable post shows voice.error and types nothing', async () => {+ const offline = vi.fn(async (): Promise<SaidOnCard> => { throw new Error('offline') })+ expect(await spoken(BUDDY, [withBuddy({ local: 'h1' })], offline)).toEqual({ errors: ['Could not reach your Buddy. Try again.'], turns: [] })+ // Nor when the Swarm no longer lists that Lead as one: the Buddy face never falls back to a terminal.+ expect(await spoken(BUDDY, [withBuddy({ local: 'h1' })], vi.fn(async () => ({ said: false as const })))).toEqual({ errors: ['Could not reach your Buddy. Try again.'], turns: [] })+ })++ it('on the PM face an unreachable post still falls back to the turn', async () => {+ const offline = vi.fn(async (): Promise<SaidOnCard> => { throw new Error('offline') })+ const leadFace = { kind: 'lead' as const, id: 'lead-c1', name: 'Lead', working: false }+ expect(await spoken(BUDDY, [withBuddy({ local: 'h1', sideChat: leadFace })], offline)).toEqual({ errors: [], turns: [['h1', 'ship it']] })+ // An older dial's face is today's, whatever a newer dial's side says.+ expect(await spoken(ROUND, [withBuddy({ local: 'h1', chat: leadFace })], offline)).toEqual({ errors: [], turns: [['h1', 'ship it']] })+ })++ it('an older dial\'s words for the Buddy chat (its PM face) never fall back to the Lead\'s terminal either', async () => {+ // The PM cannot read the reader's Buddy chat: typing what was said there into the PM's terminal would show it.+ const offline = vi.fn(async (): Promise<SaidOnCard> => { throw new Error('offline') })+ expect(await spoken(ROUND, [withBuddy({ local: 'h1' })], offline)).toEqual({ errors: ['Could not reach the Swarm. Try again.'], turns: [] })+ })++ it('a Buddy utterance never falls back after desktop focus changes during its post', async () => {+ const state = { cards: [card('st1', [withBuddy({ local: 'h1' })])] }+ let rejectPost!: (error: Error) => void+ const pending = new Promise<SaidOnCard>((_resolve, reject) => { rejectPost = reject })+ const swarmSay = vi.fn(() => pending)+ const host = cardHost(state, { transcribe: vi.fn(async () => 'private Buddy idea'), route: vi.fn(), swarmSay })+ const { session, port } = await connect(host)+ try {+ port.say(BUDDY)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ voice(port, 'h1')+ await vi.waitFor(() => expect(swarmSay).toHaveBeenCalledOnce())+ // The window opens the Lead while the private post is on its way.+ state.cards = [card('st1', [withBuddy({ local: 'h1', sideChat: { kind: 'lead', id: 'lead-c1', name: 'Lead', working: false } })])]+ await session.syncSwarmCards()+ rejectPost(new Error('backend unreachable'))+ await vi.waitFor(() => expect(port.sent.some(m => m.t === 'voice.error' || m.t === 'voice.transcript')).toBe(true))+ expect(host.sendTurn).not.toHaveBeenCalled()+ expect(ofType(port, 'voice.error').map(m => m.message)).toEqual(['Could not reach your Buddy. Try again.'])+ } finally { await session.stop() }+ })++ it('posts the words into the chat on the face when they were spoken, whatever the face shows by the time they are sent', async () => {+ const state = { cards: [card('st1', [withBuddy({ local: 'h1' })])] }+ const swarmSay = vi.fn(async (): Promise<SaidOnCard> => ({ said: true }))+ const host = cardHost(state, { transcribe: vi.fn(async () => 'private Buddy idea'), route: vi.fn(), swarmSay })+ const { session, port } = await connect(host)+ try {+ port.say(BUDDY)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ port.say({ t: 'voice.begin', uploadId: 'u-h1', agentId: 'h1' })+ // The window opens the Lead while the person is still speaking.+ state.cards = [card('st1', [withBuddy({ local: 'h1', sideChat: { kind: 'lead', id: 'lead-c1', name: 'Lead', working: false } })])]+ port.pcm(Buffer.alloc(3200)); port.say({ t: 'voice.end' })+ await vi.waitFor(() => expect(swarmSay).toHaveBeenCalledOnce())+ expect(swarmSay.mock.calls[0]).toEqual(['h1', 'private Buddy idea', 'buddy', 'pm1'])+ } finally { await session.stop() }+ })++ /** 13 Leads (12 are sent), every name at its 48-byte cut, each working in a group with a Buddy; `id(kind, l)` names the ids. */+ const fullCards = (id: (kind: string, l: number) => string) => {+ const wide = 'é'.repeat(24) // 48 bytes+ return [card('st1', Array.from({ length: 13 }, (_, l) => lead(l, {+ project: wide, owner: wide, local: id('h', l), engine: 'codex', id: id('l', l), projectId: id('p', l), order: 100 + l,+ chat: { kind: 'group', id: id('g', l), name: wide, working: true, since: 4000 },+ sideChat: { kind: 'group', id: id('g', l), name: wide, working: true, since: 4000 }, buddies: true,+ buddy: { chatId: id('b', l), name: wide, engine: 'codex', cells: 32767, color: '#d6a79a', live: false } })), { name: wide, count: 40 })]+ }+ const sent = async (cards: SwarmCard[]) => {+ const { session, port } = await connect(cardHost({ cards }))+ try {+ port.say(BUDDY)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ expect(port.isOpen).toBe(true)+ return ofType(port, 'supertab')[0] as { leads: Array<{ buddy: { name: string } }> }+ } finally { await session.stop() }+ }++ it('the supertab frame with 12 Leads, 48-byte names and a Buddy each stays under 8192 bytes', async () => {+ // The backend's ids: 24 hex characters, a harness's a UUID.+ const frame = await sent(fullCards((kind, l) => kind === 'h' ? `${'0'.repeat(28)}-${String(l).padStart(7, '0')}` : `${kind}${'0'.repeat(21)}${String(l).padStart(2, '0')}`))+ expect(frame.leads).toHaveLength(12)+ expect(Buffer.byteLength(JSON.stringify(frame))).toBeLessThan(8192)+ // And under the dial's JSON guard (cable_json_guard.h, 512 tokens), which today's firmware applies to every frame.+ expect(tokens(frame)).toBeLessThan(512)+ expect(frame.leads.map((l) => l.buddy.name)).toEqual(Array(12).fill('é'.repeat(24)))+ })++ it('shortens the Buddies\' names, on a character, rather than send a frame the cable cannot carry', async () => {+ // Every id at the 47 characters a dial holds: 8,211 bytes with whole names, and a frame over the cap closes the link.+ const frame = await sent(fullCards((kind, l) => `${kind}${'x'.repeat(44)}${String(l).padStart(2, '0')}`))+ expect(frame.leads).toHaveLength(12)+ expect(Buffer.byteLength(JSON.stringify(frame))).toBeLessThan(8192)+ expect(tokens(frame)).toBeLessThan(512)+ // The Buddies' names go first: the avatar still tells them apart, and every other name is whole.+ for (const l of frame.leads as unknown as Array<{ buddy: { name: string }; project: string; chatName: string }>) {+ expect([l.buddy.name, l.project, l.chatName]).toEqual(['é'.repeat(12), 'é'.repeat(24), 'é'.repeat(24)])+ }+ })++ it('12 Leads with 48-byte JSON-escaped names fit without dropping the dial', async () => {+ const cards = fullCards((kind, l) => `${kind}${'x'.repeat(44)}${String(l).padStart(2, '0')}`)+ const wide = '"'.repeat(48)+ for (const c of cards) {+ c.name = wide+ for (const l of c.leads) {+ l.project = l.owner = wide+ l.chat!.name = l.sideChat!.name = l.buddy!.name = wide+ }+ }+ // These same valid names fit the existing legacy frame.+ for (const hello of [ROUND, BUDDY]) {+ const { session, port } = await connect(cardHost({ cards }))+ try {+ port.say(hello)+ await vi.waitFor(() => expect(ofType(port, 'supertab').length > 0 || !port.isOpen).toBe(true))+ expect(port.isOpen, hello === BUDDY ? 'new dial must stay connected' : 'legacy baseline must fit').toBe(true)+ expect(Buffer.byteLength(JSON.stringify(ofType(port, 'supertab')[0]))).toBeLessThan(8192)+ } finally { await session.stop() }+ }+ })++ it('fits the fullest frame a dial can be sent: every id at 47 characters, every name and engine escaping at its cut', async () => {+ const cards = fullCards((kind, l) => `${kind}${'x'.repeat(44)}${String(l).padStart(2, '0')}`)+ const wide = '"'.repeat(48), engine = '\u0001'.repeat(16)+ for (const c of cards) {+ c.name = wide+ for (const l of c.leads) {+ l.project = l.owner = wide+ l.engine = l.buddy!.engine = engine+ l.chat!.name = l.sideChat!.name = l.buddy!.name = wide+ }+ }+ for (const hello of [ROUND, BUDDY]) {+ const { session, port } = await connect(cardHost({ cards }))+ try {+ port.say(hello)+ await vi.waitFor(() => expect(ofType(port, 'supertab').length > 0 || !port.isOpen).toBe(true))+ expect(port.isOpen).toBe(true)+ const [frame] = ofType(port, 'supertab') as Array<{ leads: Array<{ id: string; projectId: string; chatId: string; engine: string }> }>+ expect(Buffer.byteLength(JSON.stringify(frame))).toBeLessThan(8192)+ // Every id and engine still names what it names; the Buddies of the least urgent Leads went last, the rest kept theirs.+ expect(frame.leads.map((l) => [l.id, l.projectId, l.chatId, l.engine])).toEqual(cards[0].leads.slice(0, 12).map((l) => [l.id, l.projectId, l.chat!.id, engine]))+ const kept = frame.leads.map((l) => 'buddy' in l)+ if (hello === BUDDY) expect(kept.slice(0, 6)).toEqual(Array(6).fill(true))+ expect(kept.indexOf(false) === -1 || kept.slice(kept.indexOf(false)).every((k) => !k)).toBe(true)+ } finally { await session.stop() }+ }+ })+ })})diff --git a/cli/src/cable/cableSession.ts b/cli/src/cable/cableSession.tsindex c1a237ab5..07a82fc22 100644--- a/cli/src/cable/cableSession.ts+++ b/cli/src/cable/cableSession.ts@@ -174,11 +174,40 @@ export function recapFrame(r: LeadRecap): Message {}/** A Lead's entry for a swarmChat dial: its face chat, `work` only for a working group (with that group's clock), and never* `ask` or `stuck`, which a group's state used to raise. A Lead whose chat did not come through reads as its Lead chat. */-function chatLead(l: SwarmLead): Record<string, unknown> {- const working = l.chat?.kind === 'group' && l.chat.working+function chatLead(l: SwarmLead, chat = l.chat): Record<string, unknown> {+ const working = chat?.kind === 'group' && chat.workingreturn { id: l.id, projectId: l.projectId, project: l.project, engine: l.engine, owner: l.owner, local: l.local,- state: working ? 'work' : 'done', order: l.order, ...(working && l.chat!.since !== undefined ? { since: l.chat!.since } : {}),- ...(l.chat ? { chat: l.chat.kind, chatId: l.chat.id, chatName: l.chat.name } : {}) }+ state: working ? 'work' : 'done', order: l.order, ...(working && chat.since !== undefined ? { since: chat.since } : {}),+ ...(chat ? { chat: chat.kind, chatId: chat.id, chatName: chat.name } : {}) }+}+/** A Lead's entry for a swarmBuddy dial (spec 2026-10-29-round-dial-pm-buddy): the face on the side it keeps, and while the+ * Swarm has Buddies on, `buddies` and the reader's Buddy. With Buddies off it is a swarmChat dial's entry. */+function buddyLead(l: SwarmLead): Record<string, unknown> {+ return { ...chatLead(l, l.sideChat ?? l.chat), ...(l.buddies ? { buddies: true } : {}), ...(l.buddies && l.buddy ? { buddy: { ...l.buddy } } : {}) }+}+/** The byte cuts a name is shortened through, on a character, when a frame would not fit. */+const NAME_CUTS = [24, 12, 6, 3, 1, 0]+/**+ * A `supertab` frame shortened until it fits the cable's payload: a frame over the cap fails the write and closes the link.+ * The Buddies' names go first (their avatars still tell them apart), then every name together; ids and engines, which the+ * dial routes and draws by, are never touched. With the backend's ids, 12 Leads with every name at 48 bytes and a Buddy each+ * fit whole; with every id at the 47 characters a dial holds they came to 8,211 bytes, and names of quotes, which JSON+ * 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.+ */+function fitFrame(frame: { name: string; leads: Array<Record<string, unknown>> }): void {+ const fits = () => Buffer.byteLength(JSON.stringify(frame)) < CABLE_MAX_PAYLOAD+ 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+ 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}/** 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 {@@ -323,7 +352,7 @@ import type { FormCommand, FormResult } from './windowForm.js'import { deriveLongRecap, extendShortRecap } from '../lib/deviceRecap.js'import type { TurnStatsFields } from './turnStats.js'import type { Tier } from '../lib/notifyTier.js'-import type { LeadNotice, LeadRecap, SwarmCard, SwarmLead } from '../superTabs/cards.js'+import type { CardChat, CardSide, LeadNotice, LeadRecap, SaidOnCard, SwarmCard, SwarmChat, SwarmLead } from '../superTabs/cards.js'import { truncateUtf8 } from '../lib/deviceRecentTrim.js'export interface RouteDecision {@@ -359,11 +388,15 @@ export interface CableHost {/** A device that speaks `swarmCard: 'v1'` is attached (true) or gone (false): the core starts or stops reading the Swarms. */swarmCardsWanted?(on: boolean): void/** One Lead's last message, read on request; null when it could not be read. */- swarmCardRecap?(tabId: string, leadId: string, chat?: boolean): Promise<LeadRecap | null>+ swarmCardRecap?(tabId: string, leadId: string, chat?: CardChat): Promise<LeadRecap | null>/** The recap a device has open (its Lead), or null once it closes: the only one pushed when its text changes. */- swarmCardOpen?(session: string, tabId: string, leadId: string | null, chat?: boolean): void- /** Words for a Lead that runs here: posted as the person in its Swarm chat. False: not a Lead, send the turn as before. */- swarmSay?(harnessId: string, text: string, chat?: boolean): Promise<boolean>+ swarmCardOpen?(session: string, tabId: string, leadId: string | null, chat?: CardChat): void+ /** A round dial that speaks swarmBuddy swiped to a side of a Swarm: the cards show that side's face. */+ swarmCardSide?(tabId: string, side: CardSide): void+ /** Words for a Lead that runs here: posted as the person in its Swarm chat. Not `said`: not a Lead, send the turn as before;+ * `refused`: the backend refused the post, whose words are never typed anywhere instead. `chatId`: the chat they were+ * spoken to, the only one they may be posted in. */+ swarmSay?(harnessId: string, text: string, chat?: CardChat, chatId?: string): Promise<SaidOnCard>/** A device picked a Lead: the window opens that Swarm tab and project. */superTabSelected?(superTabId: string, projectId: string): void/** The Swarm tab the window has on screen and the project open in it ('' when none is); null when the active tab is not a Swarm or there is no window. */@@ -686,6 +719,10 @@ export class CableSession {* open in its project, its recap is that chat's, `work` only for a working group, and the alerts are the Lead's new* messages (`supertab.notice`). Any other device gets today's frames byte for byte. */private swarmChat = false+ /** `swarmBuddy: 'v1'` beside swarmChat (spec 2026-10-29-round-dial-pm-buddy): the dial keeps a PM and a Buddy side per Swarm+ * (`supertab.side`), each Lead carries `buddies` and the reader's Buddy, and the Buddy's word is a quiet notice. A+ * swarmChat dial without it gets today's frames byte for byte. */+ private swarmBuddy = falseprivate playerOffset = 0private playerRequest = 0private playerLibraryKey = ''@@ -699,14 +736,14 @@ export class CableSession {/** For the greeting's log line: which capabilities this hello named, or nothing. */private capabilitiesNamed(): string {- const named = [this.swarmMembers && 'swarms', this.longRecap && 'recap', this.stepsActivity && 'activity', this.statsTurn && 'stats', this.playerCapable && 'player', this.superTabWaits && 'superTab', this.swarmCard && 'swarmCard', this.swarmChat && 'swarmChat']+ const named = [this.swarmMembers && 'swarms', this.longRecap && 'recap', this.stepsActivity && 'activity', this.statsTurn && 'stats', this.playerCapable && 'player', this.superTabWaits && 'superTab', this.swarmCard && 'swarmCard', this.swarmChat && 'swarmChat', this.swarmBuddy && 'swarmBuddy'].filter(Boolean)return named.length ? ` caps ${named.join(',')}` : ''}private resetCapabilities(): void {this.swarmMembers = this.longRecap = this.stepsActivity = this.statsTurn = this.playerCapable = this.superTabWaits = false- this.swarmCard = this.swarmChat = false+ this.swarmCard = this.swarmChat = this.swarmBuddy = falsethis.dropCards()this.seqOn = falsethis.seq = 0@@ -826,7 +863,10 @@ export class CableSession {question?: { pin?: QuestionSpeech };draft?: { pin?: DraftPin };search?: { command?: SelectionCommand; pin: Promise<SelectionResult> };- form?: { command?: FormCommand; pin: Promise<FormResult> } } | null = null+ form?: { command?: FormCommand; pin: Promise<FormResult> };+ /** The chat on this dial's face for that agent's Swarm project as the person began to speak: the words go there or+ * nowhere, and a Buddy chat's never reach a terminal (review of #2146). */+ swarmFace?: SwarmChat } | null = nullprivate voiceSearch?: SelectionCommandprivate voiceForm?: FormCommandprivate voiceCarryId?: string@@ -1269,6 +1309,7 @@ export class CableSession {this.superTabWaits = str('superTab') === 'wait-v1'this.swarmCard = str('swarmCard') === 'v1'this.swarmChat = this.swarmCard && str('swarmChat') === 'v1'+ this.swarmBuddy = this.swarmChat && str('swarmBuddy') === 'v1'this.wantCards(this.swarmCard)this.seqOn = str('board') === 'pro'this.seq = 0@@ -1379,6 +1420,12 @@ export class CableSession {case 'supertab.select':await this.onSuperTab(msg.t, str('tab') ?? '', str('lead') ?? '')return+ case 'supertab.side': {+ // Only a dial that keeps sides, for a Swarm id it can hold; anything else is a frame this daemon cannot use.+ const tab = str('tab') ?? '', side = str('side')+ if (this.swarmBuddy && CARD_ID.test(tab) && (side === 'pm' || side === 'buddy')) this.host.swarmCardSide?.(tab, side)+ return+ }case 'swarm.select':// Not answered here: the window switches, its desk changes, and the new `swarms` and ring// pushes are the answer — the same shape as `machine.select`, minus the refusal, because the@@ -1666,8 +1713,11 @@ export class CableSession {// start. Quoted text, carried text, questions and edits already have their own pinned targets.const focused = str('agentId') && !formVoice && !searchVoice && !draftVoice && !questionVoice &&!carryVoice && !('selectionId' in msg) ? this.host.appFocus?.() : undefined+ const agentId = focused?.agentId ?? str('agentId')+ const swarmFace = agentId ? this.swarmFaceOf(agentId) : undefinedthis.voice = {- agentId: focused?.agentId ?? str('agentId'),+ agentId,+ ...(swarmFace ? { swarmFace } : {}),cmd: str('cmd'),lang: str('lang') ?? this.host.voiceLang(),// The DIAL's rate, never this side's guess. Describing 8 kHz audio as 16 kHz does not make the@@ -2290,12 +2340,26 @@ export class CableSession {await reply({ t: 'voice.draft', ...state }); return}// Spoken to a Swarm Lead (its card or its tile): the words go to the Swarm chat as the person's, where everyone in the- // tab sees them, not typed into the Lead's terminal. Any other harness, or a failed post, gets the turn as before.- if (turn.agentId && !carried && !selection?.ok && await this.host.swarmSay?.(agentId, instruction, ...this.chatFlag()).catch(() => false)) {+ // tab sees them, not typed into the Lead's terminal. Any other harness, or a backend that could not be reached, gets the+ // turn as before; a post the backend refused, and any word for the reader's Buddy, never does (spec 2026-10-29 Voice): a+ // refused post for a read-only Chat with PM was typed into the PM's terminal.+ if (turn.agentId && !carried && !selection?.ok && this.host.swarmSay) {+ const face = turn.swarmFace+ const said = await this.host.swarmSay(agentId, instruction, ...this.sayArgs(face)).catch((): SaidOnCard => ({ said: false }))if (!current()) return- this.log(`cable: voice → Swarm chat of ${agentId.slice(0, 8)}`)- await reply({ t: 'voice.transcript', routeId: '', text: transcript, agentId, agentName, needsConfirm: false })- return+ if (said.said) {+ this.log(`cable: voice → Swarm chat of ${agentId.slice(0, 8)}`)+ await reply({ t: 'voice.transcript', routeId: '', text: transcript, agentId, agentName, needsConfirm: false })+ return+ }+ if (said.refused) {+ this.log(`cable: voice → Swarm chat of ${agentId.slice(0, 8)} refused (${said.refused.code})`)+ await reply({ t: 'voice.error', message: said.refused.message })+ return+ }+ // Words for the reader's Buddy chat (a swarmBuddy dial's Buddy face, an older dial's PM face), which the PM cannot read.+ if (face?.kind === 'buddy') { await reply({ t: 'voice.error', message: 'Could not reach your Buddy. Try again.' }); return }+ if (face?.kind === 'pm') { await reply({ t: 'voice.error', message: 'Could not reach the Swarm. Try again.' }); return }}const text = carried ? withCarriedPassage(instruction, carried): selection?.ok && selection.text ? withSelectedPassage(instruction, selection.text) : instruction@@ -2640,8 +2704,26 @@ export class CableSession {* ordinary push, whose notices are old. */private noticesReplay = true- /** The extra argument a swarmChat dial's requests carry; none for any other device, whose calls stay as they were. */- private chatFlag(): [] | [true] { return this.swarmChat ? [true] : [] }+ /** The chat on this dial's face for the Lead that runs as `harnessId` here; none for a device without chats. */+ private swarmFaceOf(harnessId: string): SwarmChat | undefined {+ if (!this.swarmChat) return undefined+ for (const card of this.host.swarmCards?.() ?? []) {+ const lead = card.leads.find((l) => l.local === harnessId)+ if (lead) return this.swarmBuddy ? lead.sideChat ?? lead.chat : lead.chat+ }+ return undefined+ }++ /** 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: SwarmChat | undefined): [chat?: CardChat, chatId?: string] {+ const [chat] = this.chatFlag()+ if (chat === undefined) return []+ return face ? [chat, face.id] : [chat]+ }++ /** The extra argument a swarmChat dial's requests carry ('buddy' for a swarmBuddy dial's); none for any other device, whose+ * calls stay as they were. */+ private chatFlag(): [] | [CardChat] { return this.swarmBuddy ? ['buddy'] : this.swarmChat ? [true] : [] }/** Tell the core a capable device is here (or gone), once per change: it reads the Swarms only while one is. */private wantCards(on: boolean): void {@@ -2703,8 +2785,9 @@ export class CableSession {// The desk tab of the same Swarm, when the window has one: empty when it is closed or never opened it.const tab = desk.find((s) => s.superTabId === card.id)?.id ?? ''const frame = { t: 'supertab', id: card.id, tab, name: card.name, count: card.count,- leads: card.leads.slice(0, SWARM_LEADS_MAX).map((l) => this.swarmChat ? chatLead(l) : { id: l.id, projectId: l.projectId, project: l.project,+ 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 key = JSON.stringify(frame)if (this.cardKeys.get(card.id) === key) continuethis.cardKeys.set(card.id, key)@@ -2726,28 +2809,37 @@ export class CableSession {const live = new Set<string>()for (const card of cards) {for (const lead of card.leads.slice(0, SWARM_LEADS_MAX)) {- const key = `${card.id}:${lead.id}`- live.add(key)- const notice = lead.notice- const opened = open?.superTabId === card.id && open.conversationId === notice?.chatId- const held = this.notices.get(key)- if (!notice) { this.notices.delete(key); continue }- if (held?.id !== notice.id) {- // Replayed or read on the desktop: noted as not open on the dial, so nothing is sent for it now or later.- const sent = !replay && !opened- this.notices.set(key, { id: notice.id, chatId: notice.chatId, open: sent })- if (sent) await this.send(noticeFrame(card.id, lead.id, notice))- continue- }- if (held.open && opened) {- held.open = false- await this.send({ t: 'supertab.notice.read', tab: card.id, lead: lead.id, chatId: held.chatId })+ // The Buddy's quiet notice is held apart (spec 2026-10-29 Alerts), and only a swarmBuddy dial hears it.+ const notices: Array<[string, LeadNotice | undefined]> = [[`${card.id}:${lead.id}`, lead.notice]]+ if (this.swarmBuddy) notices.push([`${card.id}:${lead.id}:buddy`, lead.buddyNotice])+ for (const [key, notice] of notices) {+ live.add(key)+ await this.pushNotice(key, card.id, lead.id, notice, replay, open?.superTabId === card.id ? open.conversationId : undefined)}}}for (const key of [...this.notices.keys()]) if (!live.has(key)) this.notices.delete(key)}+ /** One alert of a Lead (held at `key`): sent once when it is new, unless replayed or read on the desktop (`openChat`, the+ * conversation the window has open in that Swarm); read on the dial once the desktop opens the chat of one it was sent. */+ private async pushNotice(key: string, tab: string, lead: string, notice: LeadNotice | undefined, replay: boolean, openChat: string | undefined): Promise<void> {+ const held = this.notices.get(key)+ if (!notice) { this.notices.delete(key); return }+ const opened = openChat !== undefined && openChat === notice.chatId+ if (held?.id !== notice.id) {+ // Replayed or read on the desktop: noted as not open on the dial, so nothing is sent for it now or later.+ const sent = !replay && !opened+ this.notices.set(key, { id: notice.id, chatId: notice.chatId, open: sent })+ if (sent) await this.send(noticeFrame(tab, lead, notice))+ return+ }+ if (held.open && opened) {+ held.open = false+ await this.send({ t: 'supertab.notice.read', tab, lead, chatId: held.chatId })+ }+ }+/*** Point the Pro at the Lead of the project the window has open, once per change and never at its own pick. A Swarm tab* with no project open (its Chat with PM, a DM) still takes the device into that Swarm: `lead: ''` lets it open on the@@ -2790,8 +2882,8 @@ export class CableSession {/** A Lead's changed text, for the Pro that has that Lead's recap open. */async swarmCardRecap(recap: LeadRecap): Promise<void> {if (!this.swarmCard || this.openLead?.tabId !== recap.tabId || this.openLead.leadId !== recap.leadId) return- // The service pushes a Lead's recap and its face chat's apart: each device takes only the kind it asked for.- if (this.swarmChat !== (recap.chatId !== undefined)) return+ // The service pushes a Lead's recap and each dial's face chat's apart: each device takes only the kind it asked for.+ if (this.swarmChat !== (recap.chatId !== undefined) || this.swarmBuddy !== (recap.buddy === true)) returnreturn this.queued(async () => { await this.send(recapFrame(recap)) })}diff --git a/cli/src/core/api.ts b/cli/src/core/api.tsindex 45f55393c..00f06afa5 100644--- a/cli/src/core/api.ts+++ b/cli/src/core/api.ts@@ -359,7 +359,7 @@ export interface CoreApi {/** The Super Tab service's door into the core (superTabs/attention.ts): absent from a core or a process that offers it none. */superTabs?: SuperTabsCore/** The devices' way to the Super Tab service's `super_tabs` requests, for the Swarm cards alone (`cardsWanted`, `cardRecap`,- * `cardOpen`; core/devicesLink.ts refuses any other action): its answer, or SERVICE_UNAVAILABLE. Absent from a core or a+ * `cardOpen`, `cardSay`, `cardSide`, `cardWorker`; superTabs/inCore/cards.ts refuses any other action): its answer, or SERVICE_UNAVAILABLE. Absent from a core or a* process that offers none. */superTabRequest?: (payload: Record<string, unknown>) => Promise<Record<string, unknown>>/** The Wi-Fi device's doors into the core (services/wifi.ts): each one call it made when it ran here. */@@ -1220,19 +1220,47 @@ export type AdoptSwarmSkill = (session: RegisteredSession, current: () => booleaexport type LeadState = 'ask' | 'stuck' | 'work' | 'done'/** One Swarm's Lead on a Harness Pro's card (superTabs/cards.ts). `order`: the project's index in the Swarm (the app's* order), so a dial can show the Leads as the app does whatever their urgency. */-export interface SwarmLead { id: string; projectId: string; project: string; engine: string; owner: string; local: string; state: LeadState; order: number; since?: number; chat?: SwarmChat; notice?: LeadNotice }+export interface SwarmLead {+ id: string; projectId: string; project: string; engine: string; owner: string; local: string; state: LeadState; order: number; since?: number+ /** The face of a round dial without swarmBuddy: today's rule, whatever a newer dial swiped to. */+ chat?: SwarmChat+ notice?: LeadNotice+ /** While the Swarm has Buddies on: the face of a dial that speaks swarmBuddy, on the side it keeps for this Swarm. */+ sideChat?: SwarmChat+ /** Present only while the Swarm has Buddies on. */+ buddies?: true+ /** The reader's own Buddy in this project, when it has one. */+ buddy?: SwarmBuddy+ /** The newest message the reader's Buddy wrote in its chat since the baseline: the dial's quiet alert. */+ buddyNotice?: LeadNotice+}/** One Swarm this account is in, as a Harness Pro's card: its Leads, most urgent first. */export interface SwarmCard { id: string; name: string; count: number; leads: SwarmLead[] }-/** A Lead's last message, for its card; `chatId` when it is the last message of the chat on the round dial's face. */-export interface LeadRecap { tabId: string; leadId: string; text: string; at: number; none: boolean; chatId?: string }-/** A project's three places to chat (design 2026-10-28-round-dial-swarm-chat): its Lead conversation, the reader's private- * chat (`pm`: their Buddy chat, where the PM's private lines land since Buddies replaced Chat with PM), and a group. */-export type ChatKind = 'lead' | 'pm' | 'group'-/** The chat on a project's face on the round dial: the Lead's, unless the window has the project's PM chat or a group- * open. `working` only for a working group, `since` from one of its agents' turn here. */+/** A Lead's last message, for its card; `chatId` when it is the last message of the chat on the round dial's face, and+ * `buddy` when that face is a swarmBuddy dial's (`CardChat` 'buddy'), so each dial takes only the recaps it asked for. */+export interface LeadRecap { tabId: string; leadId: string; text: string; at: number; none: boolean; chatId?: string; buddy?: true }+/** A project's places to chat (designs 2026-10-28-round-dial-swarm-chat and 2026-10-29-round-dial-pm-buddy): its Lead+ * conversation, the reader's Buddy chat, and a group. A dial without swarmBuddy calls the Buddy chat `pm`, where the PM's+ * private lines land since Buddies replaced Chat with PM; a swarmBuddy dial calls it `buddy` and hears the Buddy there. */+export type ChatKind = 'lead' | 'pm' | 'group' | 'buddy'+/** The chat on a project's face on the round dial: the Lead's, unless the window has the project's Buddy chat or a group+ * open (or a swarmBuddy dial's side says the Buddy's). `working` only for a working group, `since` from one of its agents'+ * turn here. */export interface SwarmChat { kind: ChatKind; id: string; name: string; working: boolean; since?: number }-/** The newest message the project's Lead wrote in its Lead conversation or the reader's Buddy chat since the baseline: the dial's alert. */-export interface LeadNotice { chat: 'lead' | 'pm'; chatId: string; id: string; text: string; at: number }+/** The newest message the project's Lead wrote in its Lead conversation or the reader's Buddy chat since the baseline (the+ * dial's alert), or the reader's Buddy wrote in its chat (`buddy`, the quiet one). */+export interface LeadNotice { chat: 'lead' | 'pm' | 'buddy'; chatId: string; id: string; text: string; at: number }+/** The reader's own Buddy in a project, for a round dial's Buddy screen: its chat, name and engine, Desktop's pattern for+ * its name (`cells`, the 15 half bits; `color`, `#rrggbb`), and `live` false while it is down. */+export interface SwarmBuddy { chatId: string; name: string; engine: string; cells: number; color: string; live: boolean }+/** The screen a round dial shows of each project of a Swarm: the PM's (today's face) or the reader's Buddy's. */+export type CardSide = 'pm' | 'buddy'+/** Which chat a card request is about: the Lead's conversation (false, the Pro), today's face (true, a swarmChat dial), or+ * the face on a swarmBuddy dial's side ('buddy'). */+export type CardChat = boolean | 'buddy'+/** What became of words spoken on a device for a Lead: posted, not a Lead here (`said` false, so the turn goes as before), or+ * refused by the backend with its code and message, which must never become a terminal turn instead. */+export type SaidOnCard = { said: true } | { said: false; refused?: { code: string; message: string } }/** The conversation the window has open in a Swarm tab. */export interface CardFocus { tabId: string; conversationId: string }diff --git a/cli/src/core/devicesLink.spec.ts b/cli/src/core/devicesLink.spec.tsindex ad81fd9b4..e1f5a2ae0 100644--- a/cli/src/core/devicesLink.spec.ts+++ b/cli/src/core/devicesLink.spec.ts@@ -252,4 +252,16 @@ describe('the devices\' Swarm card requests to the Super Tab service', () => {expect((await devices.answer('super_tabs', { action: 'cardRecap', tabId: 't1', leadId: 'l1', chat: 'yes' })).echoed).toEqual({ action: 'cardRecap', tabId: 't1', leadId: 'l1' })expect((await devices.answer('super_tabs', { action: 'cardsWanted', on: true, include: [] })).echoed).toEqual({ action: 'cardsWanted', on: true, include: [] })})++ it('passes a swarmBuddy dial\'s buddy flag and its side (cardSide), as it passes the other card requests', async () => {+ const superTabRequest = vi.fn(async (payload: Record<string, unknown>) => ({ ok: true, echoed: payload }))+ const core = fakeCore()+ core.superTabRequest = superTabRequest+ const devices = createDevicesLink({ core, notify: () => true, call: vi.fn(), state: () => STATE })+ expect((await devices.answer('super_tabs', { action: 'cardRecap', tabId: 't1', leadId: 'l1', chat: 'buddy' })).echoed).toEqual({ action: 'cardRecap', tabId: 't1', leadId: 'l1', chat: 'buddy' })+ expect((await devices.answer('super_tabs', { action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy' })).echoed).toEqual({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy' })+ expect((await devices.answer('super_tabs', { action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy', chatId: 'pm1' })).echoed).toEqual({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy', chatId: 'pm1' })+ expect((await devices.answer('super_tabs', { action: 'cardSay', harnessId: 'h1', text: 'ship it', chatId: 7 })).echoed).toEqual({ action: 'cardSay', harnessId: 'h1', text: 'ship it' })+ expect((await devices.answer('super_tabs', { action: 'cardSide', tabId: 't1', side: 'buddy', leadId: 'l1', text: 'x' })).echoed).toEqual({ action: 'cardSide', tabId: 't1', side: 'buddy' })+ })})diff --git a/cli/src/core/devicesLink.ts b/cli/src/core/devicesLink.tsindex 336d1f21c..d6018fe77 100644--- a/cli/src/core/devicesLink.ts+++ b/cli/src/core/devicesLink.ts@@ -125,12 +125,14 @@ export function createDevicesLink(deps: DevicesLinkDeps) {// The Swarm cards' requests (core/main.ts `superTabRequest` allows those and no other action of the Super Tab service).super_tabs: async (payload) => {if (!core.superTabRequest) return { error: 'SERVICE_UNAVAILABLE' }- const { action, tabId, leadId, on, include, session, harnessId, machineId, text, focus } = payload- // A round dial that speaks swarmChat asks for the chat on the face, and the window's open conversation rides with the- // wish (superTabs/inCore/cards.ts checks both); absent, the request is today's.- const chat = payload.chat === true ? { chat: true } : {}+ const { action, tabId, leadId, on, include, session, harnessId, machineId, text, focus, side } = payload+ // A round dial that speaks swarmChat asks for the chat on the face (one that speaks swarmBuddy, 'buddy'), and the+ // window's open conversation rides with the wish (superTabs/inCore/cards.ts checks them); absent, the request is today's.+ const chat = payload.chat === true || payload.chat === 'buddy' ? { chat: payload.chat } : {}return core.superTabRequest(action === 'cardsWanted' ? { action, on: on === true, include, ...(focus !== undefined ? { focus } : {}) }- : action === 'cardSay' ? { action, harnessId, text, ...chat } : action === 'cardWorker' ? { action, machineId, harnessId }+ : action === 'cardSay' ? { action, harnessId, text, ...chat, ...(typeof payload.chatId === 'string' ? { chatId: payload.chatId } : {}) }+ : action === 'cardWorker' ? { action, machineId, harnessId }+ : action === 'cardSide' ? { action, tabId, side }: { action, tabId, leadId, session, ...chat })},// The transcriber's and the fleet's lane's sign-in, and the lane's sealing, asked of the core at everydiff --git a/cli/src/services/devices.spec.ts b/cli/src/services/devices.spec.tsindex 95218fb8a..75091117e 100644--- a/cli/src/services/devices.spec.ts+++ b/cli/src/services/devices.spec.ts@@ -659,7 +659,7 @@ describe('what the windows say, reaching the dial', () => {// Without the flag, today's recap: no chat asked for, none passed on.expect(await seen.host.swarmCardRecap!('st1', 'lead1')).toEqual({ tabId: 'st1', leadId: 'lead1', text: 'lead', at: 3, none: false })expect(superTabRequest).toHaveBeenLastCalledWith({ action: 'cardRecap', tabId: 'st1', leadId: 'lead1' })- expect(await seen.host.swarmSay!('h1', 'ship it', true)).toBe(true)+ expect(await seen.host.swarmSay!('h1', 'ship it', true)).toEqual({ said: true })expect(superTabRequest).toHaveBeenLastCalledWith({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: true })seen.host.swarmCardOpen!('c1', 'st1', 'lead1', true)expect(superTabRequest).toHaveBeenLastCalledWith({ action: 'cardOpen', session: 'c1', tabId: 'st1', leadId: 'lead1', chat: true })@@ -667,6 +667,25 @@ describe('what the windows say, reaching the dial', () => {expect(superTabRequest).toHaveBeenLastCalledWith({ action: 'cardOpen', session: 'c1', tabId: 'st1', leadId: null })})+ it('asks for a swarmBuddy dial\'s face with the buddy flag, says so on its recap, and sends its side as cardSide', async () => {+ const answers: Array<Record<string, unknown>> = [+ { ok: true, text: 'from the Buddy', at: 3, none: false, chatId: 'b1', buddy: true },+ { ok: true, text: 'no chat named', at: 3, none: false, buddy: true },+ { ok: true, said: true },+ ]+ const superTabRequest = vi.fn(async (_payload: Record<string, unknown>) => answers.shift() ?? { ok: true })+ withRequest(superTabRequest)+ expect(await seen.host.swarmCardRecap!('st1', 'lead1', 'buddy')).toEqual({ tabId: 'st1', leadId: 'lead1', text: 'from the Buddy', at: 3, none: false, chatId: 'b1', buddy: true })+ expect(superTabRequest).toHaveBeenLastCalledWith({ action: 'cardRecap', tabId: 'st1', leadId: 'lead1', chat: 'buddy' })+ expect(await seen.host.swarmCardRecap!('st1', 'lead1', 'buddy')).toBeNull()+ expect(await seen.host.swarmSay!('h1', 'ship it', 'buddy', 'pm1')).toEqual({ said: true })+ expect(superTabRequest).toHaveBeenLastCalledWith({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy', chatId: 'pm1' })+ seen.host.swarmCardOpen!('c1', 'st1', 'lead1', 'buddy')+ expect(superTabRequest).toHaveBeenLastCalledWith({ action: 'cardOpen', session: 'c1', tabId: 'st1', leadId: 'lead1', chat: 'buddy' })+ seen.host.swarmCardSide!('st1', 'buddy')+ expect(superTabRequest).toHaveBeenLastCalledWith({ action: 'cardSide', tabId: 'st1', side: 'buddy' })+ })+it('reads a recap through the service, cut to 1,500 bytes on a character; anything unusable is null', async () => {const answers: Array<Record<string, unknown> | 'throw'> = [{ ok: true, tabId: 'st1', leadId: 'lead1', text: 'é'.repeat(1000), at: 1792560000, none: false },@@ -688,9 +707,24 @@ describe('what the windows say, reaching the dial', () => {const answers: Array<Record<string, unknown> | 'throw'> = [{ ok: true, said: true }, { ok: true, said: false }, { error: 'NOT_FOUND' }, 'throw']const superTabRequest = vi.fn(async () => { const next = answers.shift()!; if (next === 'throw') throw new Error('gone'); return next })withRequest(superTabRequest)- expect(await seen.host.swarmSay!('h1', 'ship it')).toBe(true)+ expect(await seen.host.swarmSay!('h1', 'ship it')).toEqual({ said: true })expect(superTabRequest).toHaveBeenCalledWith({ action: 'cardSay', harnessId: 'h1', text: 'ship it' })- for (let i = 0; i < 3; i++) expect(await seen.host.swarmSay!('h1', 'ship it')).toBe(false)+ for (let i = 0; i < 3; i++) expect(await seen.host.swarmSay!('h1', 'ship it')).toEqual({ said: false })+ })++ it('passes a refused post on, its message cut to what a dial shows; a malformed refusal is none', async () => {+ const answers: Array<Record<string, unknown>> = [+ { ok: true, said: false, refused: { code: 'PM_CHAT_READ_ONLY', message: 'Chat with PM is read-only.' } },+ { ok: true, said: false, refused: { code: 'BUDDY_FORBIDDEN', message: 'é'.repeat(400) } },+ { ok: true, said: false, refused: { code: 7, message: 'x' } }, { ok: true, said: false, refused: 'no' },+ { ok: true, said: true, refused: { code: 'X', message: 'x' } },+ ]+ withRequest(vi.fn(async () => answers.shift()!))+ expect(await seen.host.swarmSay!('h1', 'ship it')).toEqual({ said: false, refused: { code: 'PM_CHAT_READ_ONLY', message: 'Chat with PM is read-only.' } })+ expect(await seen.host.swarmSay!('h1', 'ship it')).toEqual({ said: false, refused: { code: 'BUDDY_FORBIDDEN', message: 'é'.repeat(150) } })+ expect(await seen.host.swarmSay!('h1', 'ship it')).toEqual({ said: false })+ expect(await seen.host.swarmSay!('h1', 'ship it')).toEqual({ said: false })+ expect(await seen.host.swarmSay!('h1', 'ship it')).toEqual({ said: true })})it('answers no recap when the core has no service to ask', async () => {diff --git a/cli/src/services/devices.ts b/cli/src/services/devices.tsindex aeaea38db..2cdc474f6 100644--- a/cli/src/services/devices.ts+++ b/cli/src/services/devices.ts@@ -19,7 +19,7 @@import { existsSync, writeFileSync } from 'node:fs'import { join } from 'node:path'import { env } from '../config/env.js'-import { DEVICES_REQUESTS, SUPER_TAB_REQUEST_PREFIX, type CoreApi, type CorePorts, type DevicesPort, type RouteAnswer, type SendResult, type ServiceRequests, type WindowFocus } from '../core/api.js'+import { DEVICES_REQUESTS, SUPER_TAB_REQUEST_PREFIX, type CardChat, type CoreApi, type SaidOnCard, type CorePorts, type DevicesPort, type RouteAnswer, type SendResult, type ServiceRequests, type WindowFocus } from '../core/api.js'import { CableFleet, testDialDiscovery, type CableFleetOptions } from '../cable/cableFleet.js'import { isLocalOnly } from '../lib/cardUpdate.js'import { TurnStats, type TurnStatsFields } from '../cable/turnStats.js'@@ -83,6 +83,8 @@ export interface DevicesDeps {const NO_AGENT_LIST = 'no agent list yet'/** A Super Tab conversation id as the dials hold one (48 bytes with its NUL). */const CHAT_ID = /^[A-Za-z0-9_-]{1,47}$/+/** A backend's refusal as a dial's voice error: a sentence or two, never a page. */+const VOICE_ERROR_BYTES = 300const unrouted = (reason: string): RouteAnswer => ({ agentId: '', machineId: '', name: '', confidence: 0, reason, candidates: [], weighed: 0, machines: 0, via: '' })const sid = (id: string): string => id.slice(0, 8)/** A card for the dial, and the machine it came from when another machine sent it (services/fleet.ts). */@@ -171,6 +173,16 @@ export function startDevices(core: CoreApi, ports: CorePorts, deps: DevicesDeps)// The assistant's latest paragraph per agent, as the processing cards carry it; gone when the turn ends.const latestUpdate = new Map<string, string>()// The Swarm cards' requests to the Super Tab service, through the core (core/devicesLink.ts). An error is an answer too.+ /** What became of words for a Lead, as the service answered: a refusal keeps its code and its message, cut to what a dial+ * shows in a voice error. */+ const saidOf = (answer: Record<string, unknown>): SaidOnCard => {+ if (answer.said === true) return { said: true }+ const refused = answer.refused && typeof answer.refused === 'object' ? answer.refused as Record<string, unknown> : {}+ if (typeof refused.code !== 'string' || typeof refused.message !== 'string') return { said: false }+ return { said: false, refused: { code: refused.code, message: truncateUtf8(refused.message, VOICE_ERROR_BYTES) } }+ }+ /** A card request's chat, as the core passes it on: none for the Pro, whose requests stay as they were. */+ const chatFlag = (chat: CardChat | undefined): { chat?: true | 'buddy' } => chat ? { chat } : {}const askCards = async (payload: Record<string, unknown>): Promise<Record<string, unknown>> => {try { return await core.superTabRequest!(payload) } catch { return { error: 'SERVICE_UNAVAILABLE' } }}@@ -240,17 +252,19 @@ export function startDevices(core: CoreApi, ports: CorePorts, deps: DevicesDeps)if ((before === 0) !== (cardDevices === 0)) tellCards()},// The text is the service's to read and not validated by the core: cut here, on a character, to what the Pro takes.- // With `chat` (a round dial that speaks swarmChat), the chat on the face's, which must name that chat by an id: a dial- // never shows it for another one.+ // With `chat` (a round dial that speaks swarmChat, or 'buddy' for swarmBuddy), the chat on that dial's face's, which must+ // name that chat by an id: a dial never shows it for another one.swarmCardRecap: async (tabId, leadId, chat) => {- const r = await askCards({ action: 'cardRecap', tabId, leadId, ...(chat ? { chat: true } : {}) })+ const r = await askCards({ action: 'cardRecap', tabId, leadId, ...chatFlag(chat) })if (r.ok !== true || typeof r.text !== 'string' || typeof r.at !== 'number' || !Number.isInteger(r.at) || r.at < 0 || typeof r.none !== 'boolean') return nullif (chat && !(typeof r.chatId === 'string' && CHAT_ID.test(r.chatId))) return null- return { tabId, leadId, text: truncateUtf8(r.text, 1500), at: r.at, none: r.none, ...(chat ? { chatId: r.chatId as string } : {}) }+ return { tabId, leadId, text: truncateUtf8(r.text, 1500), at: r.at, none: r.none, ...(chat ? { chatId: r.chatId as string } : {}),+ ...(chat === 'buddy' ? { buddy: true as const } : {}) }},- swarmCardOpen: (session, tabId, leadId, chat) => { void askCards({ action: 'cardOpen', session, tabId, leadId, ...(chat ? { chat: true } : {}) }) },+ swarmCardOpen: (session, tabId, leadId, chat) => { void askCards({ action: 'cardOpen', session, tabId, leadId, ...chatFlag(chat) }) },+ swarmCardSide: (tabId, side) => { void askCards({ action: 'cardSide', tabId, side }) },// An error (no service, a refused post) is not `said`: the words go to the harness instead, never lost.- swarmSay: async (harnessId, text, chat) => (await askCards({ action: 'cardSay', harnessId, text, ...(chat ? { chat: true } : {}) })).said === true,+ swarmSay: async (harnessId, text, chat, chatId) => saidOf(await askCards({ action: 'cardSay', harnessId, text, ...chatFlag(chat), ...(chatId ? { chatId } : {}) })),// The Pro picked a Lead: the window opens that Swarm tab and project. Harmless with no window.superTabSelected: (superTabId, projectId) => core.clients.sendLocal({ type: 'dial_super_tab', payload: { superTabId, projectId } }),scrolled: (phase, dy, velocity, superTabId) => core.clients.sendLocal({ type: 'dial_scroll', payload: { phase, dy, velocity, ...(superTabId ? { superTabId } : {}) } }),diff --git a/cli/src/superTabs/buddyAvatar.spec.ts b/cli/src/superTabs/buddyAvatar.spec.tsnew file mode 100644index 000000000..0bf771ddf--- /dev/null+++ b/cli/src/superTabs/buddyAvatar.spec.ts@@ -0,0 +1,14 @@+import { describe, expect, it } from 'vitest'+import { buddyAvatar } from './buddyAvatar.js'++describe('buddyAvatar', () => {+ it('draws Desktop\'s pattern and dark tone for a Buddy name', () => {+ expect(buddyAvatar("diego's Buddy")).toEqual({ cells: 25513, color: '#d6a79a' })+ expect(buddyAvatar(" KEN's Buddy ")).toEqual({ cells: 30735, color: '#d69abb' })+ })++ it('never draws an empty pattern', () => {+ // FNV-1a of "buddy 535" is 0x99d90000: its low 15 bits are all off, hue 145.+ expect(buddyAvatar('buddy 535')).toEqual({ cells: 1 << 7, color: '#9ad6b3' })+ })+})diff --git a/cli/src/superTabs/buddyAvatar.ts b/cli/src/superTabs/buddyAvatar.tsnew file mode 100644index 000000000..5400e1029--- /dev/null+++ b/cli/src/superTabs/buddyAvatar.ts@@ -0,0 +1,50 @@+/**+ * A Buddy's face on the round dial: Desktop's agent pattern+ * (`desktop/lib/super_tabs/avatar_art.dart`, `superTabAgentPattern`), ported+ * exactly so the dial and the app draw the same Buddy. The dial has no uploaded+ * or preset pictures, so this is the only face it shows.+ */+export interface BuddyAvatar {+ /** The 15 half bits of the 5×5 grid; bit `i` is `half[i]`, mirrored on the dial. */+ cells: number+ /** HSL(hue, 42 %, 72 %), Desktop's dark-mode tone, as `#rrggbb`. */+ color: string+}++const HALF_MASK = 0x7fff+/** Desktop lights the centre column's middle cell when every half bit is off. */+const FALLBACK_CELL = 1 << 7+const SATURATION = 0.42+const LIGHTNESS = 0.72++/** FNV-1a, 32 bits, over UTF-16 code units, as Dart's `String.codeUnits`. */+function fnv1a(text: string): number {+ let hash = 0x811c9dc5+ for (let i = 0; i < text.length; i++) hash = Math.imul(hash ^ text.charCodeAt(i), 0x01000193) >>> 0+ return hash+}++/** The channels of a hue at the dial's tone, ordered as Flutter's `HSLColor.toColor()` picks them. */+function channels(hue: number, chroma: number, secondary: number): [number, number, number] {+ if (hue < 60) return [chroma, secondary, 0]+ if (hue < 120) return [secondary, chroma, 0]+ if (hue < 180) return [0, chroma, secondary]+ if (hue < 240) return [0, secondary, chroma]+ if (hue < 300) return [secondary, 0, chroma]+ return [chroma, 0, secondary]+}++/** Flutter's HSL to RGB, with its rounding, so a colour never differs from the app's by one step. */+function toneOf(hue: number): string {+ const chroma = (1 - Math.abs(2 * LIGHTNESS - 1)) * SATURATION+ const secondary = chroma * (1 - Math.abs(((hue / 60) % 2) - 1))+ const match = LIGHTNESS - chroma / 2+ return `#${channels(hue, chroma, secondary)+ .map(channel => Math.round((channel + match) * 0xff).toString(16).padStart(2, '0'))+ .join('')}`+}++export function buddyAvatar(name: string): BuddyAvatar {+ const hash = fnv1a(name.trim().toLowerCase())+ return { cells: hash & HALF_MASK || FALLBACK_CELL, color: toneOf((hash >>> 16) % 360) }+}diff --git a/cli/src/superTabs/cards.spec.ts b/cli/src/superTabs/cards.spec.tsindex f7b291523..d499ed363 100644--- a/cli/src/superTabs/cards.spec.ts+++ b/cli/src/superTabs/cards.spec.ts@@ -128,6 +128,8 @@ describe('leadsOf', () => {/** `web`'s three kinds of chat: its Lead conversation, the reader's Buddy chat (where the PM's private lines land since* Buddies replaced Chat with PM, 10-29), and a group. The backend sends a Buddy chat to its owner alone. */const pm = (over: Record<string, unknown> = {}) => conv('pm-web', null, { projectId: 'web', kind: 'buddy', buddyOwnerId: 'me', agentIds: [], ...over })+/** The reader's Buddy, as the backend names it (buddies.ts). */+const buddy = (over: Record<string, unknown> = {}) => agent('y1', { name: "diego's Buddy", buddyOf: { personId: 'me', generation: 'g1' }, configuration: { engine: 'codex' }, ...over })const group = (over: Record<string, unknown> = {}) => conv('g-web', null, { projectId: 'web', title: 'Fix login', agentIds: ['b1'], assignment: { status: 'working' }, ...over })const chats = (over: Record<string, unknown> = {}) => swarm({agents: [agent('a1'), agent('a2'), agent('b1', { projectId: 'web' })],@@ -206,7 +208,7 @@ describe('lastAgentMessage', () => {})/** A fake backend: tabs by id with the time each last changed, a message store per conversation, and call counting. */-function setup(tabs: Record<string, { lastChangedAt: number; state: Record<string, unknown> }>, extra: { activity?: Record<string, 'working' | 'idle'>; elapsed?: number; messages?: (path: string) => unknown } = {}) {+function setup(tabs: Record<string, { lastChangedAt: number; state: Record<string, unknown> }>, extra: { activity?: Record<string, 'working' | 'idle'>; elapsed?: number; messages?: (path: string) => unknown; post?: () => { status: number; body: Record<string, unknown> } } = {}) {const calls: string[] = []const failing = new Map<string, number>()let listFails = false@@ -214,6 +216,7 @@ function setup(tabs: Record<string, { lastChangedAt: number; state: Record<strinlet pageSize = 0const call = vi.fn(async (method: string, path: string, _body?: unknown) => {calls.push(`${method} ${path}`)+ if (method === 'POST' && extra.post) return extra.post()const [route, query] = path.split('?')if (route === '/api/super-tabs/list') {if (listFails) throw new Error('offline')@@ -444,16 +447,31 @@ describe('SwarmCards.say', () => {it('posts the words as the person in the Lead\'s conversation of a harness here, and is false for any other harness', async () => {const t = setup({ t1: { lastChangedAt: 1, state: swarm({ agents: [agent('a1', { machineId: 'm2' }), agent('a2')] }) } })await t.cards.tick()- expect(await t.cards.say('h-a2', 'ship it')).toBe(true)+ expect(await t.cards.say('h-a2', 'ship it')).toEqual({ said: true })const post = t.call.mock.calls.find(c => c[0] === 'POST')!expect(post[1]).toBe('/api/super-tabs/t1/commands')expect(post[2]).toMatchObject({ operationId: expect.stringMatching(/^pro-voice-/),command: { type: 'message.send', conversationId: 'lead-mobile', text: 'ship it', replyTo: null, recipientIds: [] } })expect(post[2]).not.toHaveProperty('asAgentId')- expect(await t.cards.say('h-a1', 'x')).toBe(false) // that Lead runs on another machine- expect(await t.cards.say('h-zz', 'x')).toBe(false)+ expect(await t.cards.say('h-a1', 'x')).toEqual({ said: false }) // that Lead runs on another machine+ expect(await t.cards.say('h-zz', 'x')).toEqual({ said: false })expect(t.call.mock.calls.filter(c => c[0] === 'POST')).toHaveLength(1)})++ // A refused post was typed into the Lead's terminal instead (spec 2026-10-29 Voice): the dial is told the refusal now.+ it('say reports a 403 as refused with the backend\'s message', async () => {+ let answer = { status: 403, body: { success: false, error: { code: 'PM_CHAT_READ_ONLY', message: 'Chat with PM is read-only.' } } }+ const t = setup({ t1: { lastChangedAt: 1, state: swarm() } }, { post: () => answer })+ await t.cards.tick()+ expect(await t.cards.say('h-a1', 'ship it')).toEqual({ said: false, refused: { code: 'PM_CHAT_READ_ONLY', message: 'Chat with PM is read-only.' } })+ answer = { status: 409, body: { success: false, error: { code: 'BUDDIES_OFF', message: 'Buddies are off in this Swarm.' } } }+ expect(await t.cards.say('h-a1', 'ship it', 'buddy')).toEqual({ said: false, refused: { code: 'BUDDIES_OFF', message: 'Buddies are off in this Swarm.' } })+ // An unreachable backend is not a refusal: it fails as before, and the caller may fall back.+ answer = { status: 503, body: { success: false, error: { code: 'BACKEND_UNAVAILABLE', message: 'down' } } }+ await expect(t.cards.say('h-a1', 'ship it')).rejects.toThrow('down')+ t.call.mockImplementationOnce(async () => { throw new Error('offline') })+ await expect(t.cards.say('h-a1', 'ship it')).rejects.toThrow('offline')+ })})describe('SwarmCards.want', () => {@@ -598,10 +616,13 @@ describe('SwarmCards open recaps and recap reads', () => {})/** `web` with its three chats at the given sequences, each conversation's page served from `pages` (newest first or not: the code orders). */-function chatSwarm(pages: Record<string, unknown[] | (() => unknown[])>) {- const state = (lead = 1, pmSeq = 1, groupSeq = 1) => chats({ conversations: [- conv('lead-web', 'a1', { projectId: 'web', lastMessageSequence: lead }), conv('lead-mobile', 'a2', { projectId: 'mobile' }),- pm({ lastMessageSequence: pmSeq }), group({ lastMessageSequence: groupSeq })] })+/** With `withBuddy`, the Swarm has Buddies on and the reader's Buddy (`y1`, "diego's Buddy" on Codex) is in their `web` chat. */+function chatSwarm(pages: Record<string, unknown[] | (() => unknown[])>, withBuddy = false) {+ const state = (lead = 1, pmSeq = 1, groupSeq = 1) => chats({+ ...(withBuddy ? { buddies: true, agents: [...chats().agents as object[], buddy()] } : {}),+ conversations: [+ conv('lead-web', 'a1', { projectId: 'web', lastMessageSequence: lead }), conv('lead-mobile', 'a2', { projectId: 'mobile' }),+ pm({ lastMessageSequence: pmSeq, ...(withBuddy ? { agentIds: ['y1'] } : {}) }), group({ lastMessageSequence: groupSeq })] })const t = setup({ t1: { lastChangedAt: 1, state: state() } }, { messages: path => {const page = pages[/conversations\/([^/]+)\/messages/.exec(path)?.[1] ?? ''] ?? []return { messages: typeof page === 'function' ? page() : page, next: null }@@ -779,8 +800,8 @@ describe('SwarmCards chats', () => {const t = chatSwarm({})t.cards.want(true, [], { tabId: 't1', conversationId: 'pm-web' })await vi.waitFor(() => expect(t.seen).toHaveLength(1))- expect(await t.cards.say('h-a1', 'to the PM', true)).toBe(true)- expect(await t.cards.say('h-a1', 'to the Lead')).toBe(true)+ expect(await t.cards.say('h-a1', 'to the PM', true)).toEqual({ said: true })+ expect(await t.cards.say('h-a1', 'to the Lead')).toEqual({ said: true })const posts = t.call.mock.calls.filter(c => c[0] === 'POST').map(c => (c[2] as { command: { conversationId: string; text: string } }).command)expect(posts.map(p => [p.conversationId, p.text])).toEqual([['pm-web', 'to the PM'], ['lead-web', 'to the Lead']])t.cards.want(false)@@ -843,3 +864,300 @@ describe('SwarmCards.worker', () => {expect(t.cards.worker('m2', 'h-nobody')).toBe(false)})})++// Round dial PM and Buddy screens (spec 2026-10-29-round-dial-pm-buddy): a dial that speaks swarmBuddy keeps a side per+// Swarm, sees the reader's own Buddy chat as `buddy`, and gets each Lead's buddy block; every other dial keeps today's face.+describe('leadsOf Buddies', () => {+ const on = (over: Record<string, unknown> = {}) => chats({ buddies: true, agents: [...chats().agents as object[], buddy()],+ conversations: [...swarm().conversations, pm({ agentIds: ['y1'] }), group()], ...over })+ const web = (state: Record<string, unknown>, focus?: string, side?: 'pm' | 'buddy') =>+ leadsOf(state, 'm1', idle, 'me', focus, side).leads.find(l => l.projectId === 'web')!++ it('gives each Lead a buddy block for the reader\'s own Buddy, with Desktop\'s avatar', () => {+ expect(web(on()).buddy).toEqual({ chatId: 'pm-web', name: "diego's Buddy", engine: 'codex', cells: 25513, color: '#d6a79a', live: true })+ // The project with no Buddy chat has no block.+ expect(leadsOf(on(), 'm1', idle, 'me').leads.find(l => l.projectId === 'mobile')).not.toHaveProperty('buddy')+ // A Buddy that is down is still the Buddy; its display name is the one Desktop draws and shows.+ const down = on({ agents: [...chats().agents as object[], buddy({ downSince: '2026-10-29T00:00:00.000Z', displayName: "ken's Buddy" })] })+ expect(web(down).buddy).toEqual({ chatId: 'pm-web', name: "ken's Buddy", engine: 'codex', cells: 30735, color: '#d69abb', live: false })+ })++ it('marks buddies only while the Swarm has them on', () => {+ expect(leadsOf(on(), 'm1', idle, 'me').leads.map(l => l.buddies)).toEqual([true, true])+ const off = on({ buddies: undefined })+ expect(web(off)).not.toHaveProperty('buddies')+ expect(web(off)).not.toHaveProperty('buddy')+ expect(web(off)).not.toHaveProperty('sideChat')+ // And with Buddies off a dial's side changes nothing: the face is today's.+ expect(web(off, undefined, 'buddy').chat).toEqual({ kind: 'lead', id: 'lead-web', name: 'Lead', working: false })+ })++ it('shows no buddy block for a Buddy chat with no Buddy agent', () => {+ const removed = on({ agents: chats().agents })+ expect(web(removed)).not.toHaveProperty('buddy')+ // Its screen is still the Buddy chat (the dial draws the empty state), and nothing is said there.+ expect(web(removed, undefined, 'buddy').sideChat).toEqual({ kind: 'buddy', id: 'pm-web', name: 'Buddy', working: false })+ })++ it('never takes another person\'s Buddy chat or Buddy for a face or a block', () => {+ const sams = (over: Record<string, unknown> = {}) => on({ agents: [...chats().agents as object[], buddy({ buddyOf: { personId: 'sam', generation: 'g2' } })],+ conversations: [...swarm().conversations, pm({ agentIds: ['y1'], buddyOwnerId: 'sam' }), group()], ...over })+ const lead = { kind: 'lead', id: 'lead-web', name: 'Lead', working: false }+ for (const side of [undefined, 'pm', 'buddy'] as const) {+ const l = web(sams(), 'pm-web', side)+ expect([l.chat, l.sideChat]).toEqual([lead, lead])+ expect(l).not.toHaveProperty('buddy')+ }+ // Sam's Buddy in the reader's own chat (an agent id reused or misfiled) is not the reader's Buddy either.+ const misfiled = on({ agents: [...chats().agents as object[], buddy({ buddyOf: { personId: 'sam', generation: 'g2' } })] })+ expect(web(misfiled)).not.toHaveProperty('buddy')+ // With nobody signed in, no Buddy chat is anyone's.+ expect(leadsOf(on(), 'm1', idle, undefined, 'pm-web').leads.find(l => l.projectId === 'web')).toMatchObject({ chat: lead, sideChat: lead })+ })++ it('never puts a read-only Chat with PM on the face while Buddies are on', () => {+ const chatWithPm = conv('cpm-web', null, { projectId: 'web', agentIds: ['a1'], audience: { people: [{ id: 'me' }] } })+ const state = on({ conversations: [...swarm().conversations, pm({ agentIds: ['y1'] }), chatWithPm] })+ expect(web(state, 'cpm-web')).toMatchObject({ chat: { kind: 'lead' }, sideChat: { kind: 'lead' } })+ // With Buddies off it is today's: a conversation of the project the window has open.+ expect(web(on({ buddies: undefined, conversations: state.conversations }), 'cpm-web').chat).toMatchObject({ kind: 'group', id: 'cpm-web' })+ })++ it('keeps today\'s face for a dial without swarmBuddy: the Buddy chat the window has open is `pm`, whatever the side', () => {+ for (const side of [undefined, 'pm', 'buddy'] as const) {+ expect(web(on(), 'pm-web', side).chat).toEqual({ kind: 'pm', id: 'pm-web', name: 'PM', working: false })+ expect(web(on(), undefined, side).chat).toEqual({ kind: 'lead', id: 'lead-web', name: 'Lead', working: false })+ }+ })++ it('shows a swarmBuddy dial the Buddy chat the window has open as `buddy`, unless the dial swiped back to the PM', () => {+ expect(web(on(), 'pm-web').sideChat).toEqual({ kind: 'buddy', id: 'pm-web', name: "diego's Buddy", working: false })+ expect(web(on(), 'pm-web', 'pm').sideChat).toEqual({ kind: 'lead', id: 'lead-web', name: 'Lead', working: false })+ // A group the window has open stays the PM screen's face on the PM side, and the Buddy side shows the Buddy chat.+ expect(web(on(), 'g-web').sideChat).toMatchObject({ kind: 'group', id: 'g-web' })+ expect(web(on(), 'g-web', 'buddy').sideChat).toMatchObject({ kind: 'buddy', id: 'pm-web' })+ })+})++describe('SwarmCards Buddy side', () => {+ const buddySays = [said(1, 'a1', { text: 'from the PM' }), said(2, 'y1', { text: 'from the Buddy' }), said(3, 'me', { author: { kind: 'person', id: 'me' }, text: 'mine' })]++ it('puts the Buddy chat on the face on the buddy side, and its recap is the Buddy\'s last message', async () => {+ const t = chatSwarm({ 'pm-web': buddySays }, true)+ t.cards.want(true, [], null)+ await vi.waitFor(() => expect(t.seen).toHaveLength(1))+ t.calls.length = 0+ t.cards.side('t1', 'buddy')+ expect(t.webLead()?.sideChat).toEqual({ kind: 'buddy', id: 'pm-web', name: "diego's Buddy", working: false })+ // Rebuilt from the last reads, with no request; an older dial's face did not move.+ expect(t.calls).toEqual([])+ expect(t.webLead()?.chat).toMatchObject({ kind: 'lead' })+ expect(await t.cards.recap('t1', 'a1', 'buddy')).toEqual({ tabId: 't1', leadId: 'a1', text: 'from the Buddy', at: saidAt, none: false, chatId: 'pm-web', buddy: true })+ t.cards.want(false)+ })++ it('keeps the Lead face on the buddy side when the project has no Buddy chat', async () => {+ const t = chatSwarm({}, true)+ t.cards.want(true, [], null)+ await vi.waitFor(() => expect(t.seen).toHaveLength(1))+ t.cards.side('t1', 'buddy')+ expect(t.seen.at(-1)?.[0].leads.find(l => l.id === 'a2')?.sideChat).toEqual({ kind: 'lead', id: 'lead-mobile', name: 'Lead', working: false })+ t.cards.want(false)+ })++ it('a later desktop focus clears the dial\'s side', async () => {+ const t = chatSwarm({}, true)+ t.cards.want(true, [], null)+ await vi.waitFor(() => expect(t.seen).toHaveLength(1))+ t.cards.side('t1', 'buddy')+ t.cards.want(true, [], { tabId: 't1', conversationId: 'lead-web' })+ expect(t.webLead()?.sideChat).toMatchObject({ kind: 'lead' })+ // Review Focus 1: the desktop opens the Buddy chat (the Buddy screen), then the person swipes down: the swipe wins.+ t.cards.want(true, [], { tabId: 't1', conversationId: 'pm-web' })+ expect(t.webLead()?.sideChat).toMatchObject({ kind: 'buddy' })+ t.cards.side('t1', 'pm')+ expect(t.webLead()?.sideChat).toMatchObject({ kind: 'lead', id: 'lead-web' })+ // The same focus said again is no change; the desktop's next one clears the side.+ t.cards.want(true, [], { tabId: 't1', conversationId: 'pm-web' })+ expect(t.webLead()?.sideChat).toMatchObject({ kind: 'lead' })+ t.cards.want(true, [], { tabId: 't1', conversationId: 'g-web' })+ t.cards.want(true, [], { tabId: 't1', conversationId: 'pm-web' })+ expect(t.webLead()?.sideChat).toMatchObject({ kind: 'buddy' })+ t.cards.want(false)+ })++ it('keeps the side per Swarm, refuses a bad tab or side, and forgets every side when the devices go', async () => {+ const t = chatSwarm({}, true)+ t.cards.want(true, [], null)+ await vi.waitFor(() => expect(t.seen).toHaveLength(1))+ t.cards.side('t2', 'buddy')+ t.cards.side('bad id', 'buddy')+ t.cards.side('t1', 'sideways' as 'pm')+ expect(t.webLead()?.sideChat).toMatchObject({ kind: 'lead' })+ t.cards.side('t1', 'buddy')+ expect(t.webLead()?.sideChat).toMatchObject({ kind: 'buddy' })+ t.cards.want(false)+ t.cards.want(true, [], null)+ await vi.waitFor(() => expect(t.webLead()?.sideChat).toMatchObject({ kind: 'lead' }))+ t.cards.want(false)+ })++ it('keeps an older dial\'s recap of the Buddy chat on the PM\'s lines, and the new dial\'s on the Buddy\'s', async () => {+ const t = chatSwarm({ 'pm-web': buddySays }, true)+ t.cards.want(true, [], { tabId: 't1', conversationId: 'pm-web' })+ await vi.waitFor(() => expect(t.seen).toHaveLength(1))+ expect(await t.cards.recap('t1', 'a1', true)).toEqual({ tabId: 't1', leadId: 'a1', text: 'from the PM', at: saidAt, none: false, chatId: 'pm-web' })+ expect(await t.cards.recap('t1', 'a1', 'buddy')).toMatchObject({ text: 'from the Buddy', chatId: 'pm-web', buddy: true })+ // Each answer is remembered apart: asking again reads nothing.+ const reads = t.reads('pm-web')+ expect(await t.cards.recap('t1', 'a1', true)).toMatchObject({ text: 'from the PM' })+ expect(await t.cards.recap('t1', 'a1', 'buddy')).toMatchObject({ text: 'from the Buddy' })+ expect(t.reads('pm-web')).toBe(reads)+ t.cards.want(false)+ })++ it('pushes the Buddy face\'s recap to the dial that has it open when the side changes, and only that one', async () => {+ const t = chatSwarm({ 'lead-web': [said(1, 'a1', { text: 'lead says' })], 'pm-web': buddySays }, true)+ const pushed: Array<{ text: string; buddy?: true }> = []+ t.cards.onRecap = r => pushed.push({ text: r.text, ...(r.buddy ? { buddy: r.buddy } : {}) })+ t.cards.want(true, [], null)+ await vi.waitFor(() => expect(t.seen).toHaveLength(1))+ t.cards.open('s1', 't1', 'a1', 'buddy')+ t.cards.open('s2', 't1', 'a1', true)+ t.cards.side('t1', 'buddy')+ await vi.waitFor(() => expect(pushed).toEqual([{ text: 'from the Buddy', buddy: true }]))+ t.cards.want(false)+ })++ it('say on the buddy side posts message.send to the Buddy chat', async () => {+ const t = chatSwarm({}, true)+ t.cards.want(true, [], null)+ await vi.waitFor(() => expect(t.seen).toHaveLength(1))+ t.cards.side('t1', 'buddy')+ expect(await t.cards.say('h-a1', 'to my Buddy', 'buddy')).toEqual({ said: true })+ expect(await t.cards.say('h-a1', 'to the Lead', true)).toEqual({ said: true })+ const posts = t.call.mock.calls.filter(c => c[0] === 'POST').map(c => (c[2] as { command: { conversationId: string; text: string } }).command)+ expect(posts.map(p => [p.conversationId, p.text])).toEqual([['pm-web', 'to my Buddy'], ['lead-web', 'to the Lead']])+ t.cards.want(false)+ })++ it('say posts only into the chat the words were spoken to, and refuses them once the face moved on', async () => {+ const t = chatSwarm({}, true)+ t.cards.want(true, [], null)+ await vi.waitFor(() => expect(t.seen).toHaveLength(1))+ t.cards.side('t1', 'buddy')+ expect(await t.cards.say('h-a1', 'to my Buddy', 'buddy', 'pm-web')).toEqual({ said: true })+ // The window opened the Lead after the words were spoken to the Buddy: they are not posted in the project's chat.+ t.cards.want(true, [], { tabId: 't1', conversationId: 'lead-web' })+ expect(await t.cards.say('h-a1', 'still for my Buddy', 'buddy', 'pm-web')).toEqual({ said: false,+ refused: { code: 'CHAT_MOVED', message: 'That chat is no longer on the dial. Say it again.' } })+ const posts = t.call.mock.calls.filter(c => c[0] === 'POST').map(c => (c[2] as { command: { conversationId: string } }).command.conversationId)+ expect(posts).toEqual(['pm-web'])+ t.cards.want(false)+ })+})++// Privacy edges reviews keep finding (Lead, 10-29): an answer read for one reader, or while access lasted, is never given+// after it ended.+describe('SwarmCards access ending while a read is out', () => {+ const buddySays = [said(1, 'a1', { text: 'from the PM' }), said(2, 'y1', { text: 'from the Buddy' })]+ /** The next messages read waits until `release`. */+ const held = (t: ReturnType<typeof chatSwarm>) => {+ let release!: () => void+ const gate = new Promise<void>(resolve => { release = resolve })+ t.call.mockImplementationOnce(async () => { await gate; return { status: 200, body: { success: true, data: { messages: buddySays, next: null } } } })+ return () => release()+ }++ it('drops a recap read in flight when access to its Swarm is lost, and keeps nothing of it', async () => {+ const t = chatSwarm({ 'pm-web': buddySays }, true)+ await t.cards.tick()+ t.cards.side('t1', 'buddy')+ const release = held(t)+ const pending = t.cards.recap('t1', 'a1', 'buddy')+ t.failing.set('t1', 403)+ t.tabs.t1.lastChangedAt+++ await t.cards.tick()+ release()+ expect(await pending).toEqual({ tabId: 't1', leadId: 'a1', text: '', at: 0, none: true })+ // Access back: the side is forgotten with the Swarm, and the recap is read again, never served from the dropped one.+ t.failing.delete('t1')+ t.tabs.t1.lastChangedAt+++ await t.cards.tick()+ const reads = t.reads('pm-web')+ expect(await t.cards.recap('t1', 'a1', 'buddy')).toMatchObject({ chatId: 'lead-web', none: true })+ t.cards.side('t1', 'buddy')+ expect(await t.cards.recap('t1', 'a1', 'buddy')).toMatchObject({ text: 'from the Buddy', chatId: 'pm-web' })+ expect(t.reads('pm-web')).toBe(reads + 1)+ })++ it('drops a recap read in flight when another person signs in', async () => {+ const t = chatSwarm({ 'pm-web': buddySays }, true)+ await t.cards.tick()+ t.cards.side('t1', 'buddy')+ const release = held(t)+ const pending = t.cards.recap('t1', 'a1', 'buddy')+ vi.mocked(t.core.account.identity).mockResolvedValue({ accountId: 'sam', email: '[email protected]' } as never)+ t.tabs.t1.lastChangedAt+++ await t.cards.tick()+ release()+ expect(await pending).toEqual({ tabId: 't1', leadId: 'a1', text: '', at: 0, none: true })+ })+})++describe('SwarmCards Buddy notices', () => {+ it('raises a buddy notice for the Buddy\'s new message, never for the owner\'s', async () => {+ const t = chatSwarm({ 'pm-web': [said(2, 'y1', { text: 'an idea' }), said(3, 'me', { author: { kind: 'person', id: 'me' } })] }, true)+ await t.cards.tick()+ await t.move(1, 3)+ expect(t.webLead()?.buddyNotice).toEqual({ chat: 'buddy', chatId: 'pm-web', id: 'x2', text: 'an idea', at: saidAt })+ // The Buddy's word is quiet: it is not the Lead's notice.+ expect(t.webLead()).not.toHaveProperty('notice')+ const mine = chatSwarm({ 'pm-web': [said(2, 'me', { author: { kind: 'person', id: 'me' } })] }, true)+ await mine.cards.tick()+ await mine.move(1, 2)+ expect(mine.webLead()).not.toHaveProperty('buddyNotice')+ })++ it('keeps the PM\'s private line as the Lead\'s notice when the Buddy speaks after it', async () => {+ const t = chatSwarm({ 'pm-web': [said(2, 'a1', { text: 'from the PM' }), said(3, 'y1', { text: 'from the Buddy' })] }, true)+ await t.cards.tick()+ await t.move(1, 3)+ expect(t.webLead()).toMatchObject({ notice: { chat: 'pm', id: 'x2' }, buddyNotice: { chat: 'buddy', id: 'x3' } })+ })++ it('raises no buddy notice while Buddies are off, or from another person\'s Buddy chat', async () => {+ const off = chatSwarm({ 'pm-web': [said(2, 'y1')] })+ await off.cards.tick()+ await off.move(1, 2)+ expect(off.webLead()).not.toHaveProperty('buddyNotice')+ // Sam's Buddy chat, were it ever sent here: not watched, not read.+ const t = setup({ t1: { lastChangedAt: 1, state: chats({ buddies: true, agents: [...chats().agents as object[], buddy({ buddyOf: { personId: 'sam', generation: 'g2' } })],+ conversations: [...swarm().conversations, pm({ agentIds: ['y1'], buddyOwnerId: 'sam', lastMessageSequence: 1 })] }) } },+ { messages: () => ({ messages: [said(2, 'y1'), said(3, 'a1')], next: null }) })+ await t.cards.tick()+ t.tabs.t1.lastChangedAt+++ t.tabs.t1.state = chats({ buddies: true, agents: [...chats().agents as object[], buddy({ buddyOf: { personId: 'sam', generation: 'g2' } })],+ conversations: [...swarm().conversations, pm({ agentIds: ['y1'], buddyOwnerId: 'sam', lastMessageSequence: 3 })] })+ await t.cards.tick()+ const lead = t.seen.at(-1)?.[0].leads.find(l => l.id === 'a1')+ expect(lead).not.toHaveProperty('buddyNotice')+ expect(lead).not.toHaveProperty('notice')+ expect(t.calls.filter(c => c.includes('/conversations/pm-web/messages'))).toEqual([])+ })++ it('drops a held buddy notice when access to the Swarm is lost', async () => {+ const t = chatSwarm({ 'pm-web': [said(2, 'y1')] }, true)+ await t.cards.tick()+ await t.move(1, 2)+ expect(t.webLead()?.buddyNotice).toMatchObject({ id: 'x2' })+ t.failing.set('t1', 403)+ t.tabs.t1.lastChangedAt+++ await t.cards.tick()+ expect(t.seen.at(-1)).toEqual([])+ t.failing.delete('t1')+ t.tabs.t1.lastChangedAt+++ await t.cards.tick()+ expect(t.webLead()).not.toHaveProperty('buddyNotice')+ })+})diff --git a/cli/src/superTabs/cards.ts b/cli/src/superTabs/cards.tsindex 8f6393c69..2214cd681 100644--- a/cli/src/superTabs/cards.ts+++ b/cli/src/superTabs/cards.ts@@ -21,11 +21,12 @@ import type { CoreApi } from '../core/api.js'import { backend, SuperTabHostError } from './host.js'import { identifier, object } from './wire.js'import { SwarmReads, type SwarmRead } from './swarmReads.js'+import { buddyAvatar } from './buddyAvatar.js'type Json = Record<string, unknown>/** The cards' shapes are the core's contract with the Swarm (core/api.ts), which the core declares and the Swarm imports. */-import type { CardFocus, ChatKind, LeadNotice, LeadRecap, LeadState, SwarmCard, SwarmChat, SwarmLead } from '../core/api.js'-export type { CardFocus, LeadNotice, LeadRecap, LeadState, SwarmCard, SwarmChat, SwarmLead } from '../core/api.js'+import type { CardChat, CardFocus, CardSide, ChatKind, LeadNotice, LeadRecap, LeadState, SaidOnCard, SwarmBuddy, SwarmCard, SwarmChat, SwarmLead } from '../core/api.js'+export type { CardChat, CardFocus, CardSide, LeadNotice, LeadRecap, LeadState, SaidOnCard, SwarmBuddy, SwarmCard, SwarmChat, SwarmLead } from '../core/api.js'const MAX_CARDS = 16, MAX_LEADS = 12, NAME_BYTES = 48, RECAP_BYTES = 1500, MAX_LIST_PAGES = 10, MAX_RECAPS_IN_FLIGHT = 2/** The Pro keeps an id in 48 bytes with its NUL: 47 characters at most reach it. */@@ -46,25 +47,68 @@ function cut(text: string, bytes: number): string {const list = (v: unknown): Json[] => Array.isArray(v) ? v.map(object) : []const projectKey = (project: Json): string => String(project.id ?? 'lead')const inProject = (conversation: Json, projectId: string): boolean => (conversation.projectId ?? 'lead') === projectId-/** The reader's own private chat in a project: their Buddy chat, where the PM's private lines land since Buddies replaced- * Chat with PM (backend buddies.ts, 10-29). The backend sends a Buddy chat to its owner alone. The dial still calls it `pm`. */-const isPmChat = (conversation: Json): boolean => conversation.kind === 'buddy'+/** A Buddy chat (backend buddies.ts), where the PM's private lines land since Buddies replaced Chat with PM (10-29). */+const isBuddyChat = (conversation: Json): boolean => conversation.kind === 'buddy'+/** A Chat with PM: a private conversation with an audience that is not a Buddy chat. Read-only once Buddies are on+ * (backend commands.ts `PM_CHAT_READ_ONLY`), so words spoken to it on the dial would only be refused. */+const isChatWithPm = (conversation: Json): boolean => conversation.audience != null && !isBuddyChat(conversation)+/** The reader's own: the backend sends a Buddy chat to its owner alone (read/views.ts `groupView`), and the dial checks it+ * again, so another person's Buddy chat never becomes a face, a buddy block or a notice whatever a read holds. */+const isReadersBuddyChat = (conversation: Json, me: string | undefined): boolean =>+ isBuddyChat(conversation) && me !== undefined && conversation.buddyOwnerId === meconst sequenceOf = (conversation: Json): number => typeof conversation.lastMessageSequence === 'number' ? conversation.lastMessageSequence : 0+const idsOf = (v: unknown): string[] => Array.isArray(v) ? v.filter((id): id is string => typeof id === 'string') : []-/** The conversation on a project's face and its kind: the one the window has open when it is a live conversation of this- * project, else the project's Lead conversation; null when that one's id is not one a dial can hold. An archived group is- * over: the face stays on the Lead (Ruling on the plan, 2026-10-28). */-function faceOf(conversations: Json[], projectId: string, lead: Json, focus?: string): { conversation: Json; kind: ChatKind } | null {+/** The reader's live Buddy chat in a project, when its id is one a dial can hold. */+function buddyChatOf(conversations: Json[], projectId: string, me: string | undefined): Json | undefined {+ return conversations.find(c => isReadersBuddyChat(c, me) && inProject(c, projectId) && c.archived !== true && cardId(c.id))+}+/** The reader's Buddies in their chat: the chat's agents that are a Buddy of the reader. One whose `buddyOf` names someone+ * else (an agent id reused or misfiled) is not. */+function buddiesIn(agents: Json[], chat: Json, me: string | undefined): Json[] {+ const ids = idsOf(chat.agentIds)+ return agents.filter(a => typeof a.id === 'string' && ids.includes(a.id) && me !== undefined && object(a.buddyOf).personId === me)+}+/** The name Desktop shows and draws an agent by (super_tabs/identity.dart). */+const agentName = (agent: Json): string => String(agent.displayName ?? agent.name ?? '')++type Face = { conversation: Json; kind: ChatKind }+const leadFace = (lead: Json): Face | null => cardId(lead.id) ? { conversation: lead, kind: 'lead' } : null++/** Today's face of a project (a round dial without swarmBuddy): the conversation the window has open when it is a live+ * conversation of this project, else the project's Lead conversation; null when that one's id is not one a dial can hold.+ * The reader's Buddy chat reads `pm`. An archived group is over: the face stays on the Lead (Ruling on the plan,+ * 2026-10-28), and so it does for another person's Buddy chat and, while Buddies are on, a read-only Chat with PM. */+function faceOf(conversations: Json[], projectId: string, lead: Json, focus: string | undefined, me: string | undefined, buddies: boolean): Face | null {const open = focus !== undefined && focus !== lead.id? conversations.find(c => c.id === focus && inProject(c, projectId) && c.archived !== true && cardId(c.id)) : undefined- if (open) return { conversation: open, kind: isPmChat(open) ? 'pm' : 'group' }- return cardId(lead.id) ? { conversation: lead, kind: 'lead' } : null+ if (!open || (isBuddyChat(open) && !isReadersBuddyChat(open, me)) || (buddies && isChatWithPm(open))) return leadFace(lead)+ return { conversation: open, kind: isBuddyChat(open) ? 'pm' : 'group' }}-/** Whose messages are the chat's recap: the Lead's in its conversation and in the reader's Buddy chat (its private lines),- * the group's agents' in a group. */-function voicesOf(face: { conversation: Json; kind: ChatKind }, leadId: string): Set<string> {+/** A swarmBuddy dial's face (spec 2026-10-29 Switching): on the Buddy side the reader's Buddy chat; otherwise today's face,+ * where the Buddy chat the window has open is the Buddy screen, unless the dial swiped back to the PM since (the newest+ * wins: a swipe sets the side, and the window's next focus change clears it). */+function sideFaceOf(conversations: Json[], projectId: string, lead: Json, focus: string | undefined, me: string | undefined, side: CardSide | undefined): Face | null {+ const buddyChat = buddyChatOf(conversations, projectId, me)+ if (side === 'buddy' && buddyChat) return { conversation: buddyChat, kind: 'buddy' }+ const face = faceOf(conversations, projectId, lead, focus, me, true)+ if (face?.kind !== 'pm') return face+ return side === 'pm' ? leadFace(lead) : { conversation: face.conversation, kind: 'buddy' }+}+/** Whose messages are the chat's recap: the Lead's in its conversation and, for an older dial, in the reader's Buddy chat+ * (its private lines); the reader's Buddy's on a swarmBuddy dial's Buddy face; the group's agents' in a group. */+function voicesOf(face: Face, leadId: string, agents: Json[], me: string | undefined): Set<string> {+ if (face.kind === 'buddy') return new Set(buddiesIn(agents, face.conversation, me).map(a => a.id as string))if (face.kind !== 'group') return new Set([leadId])- return new Set(Array.isArray(face.conversation.agentIds) ? face.conversation.agentIds.filter((id): id is string => typeof id === 'string') : [])+ return new Set(idsOf(face.conversation.agentIds))+}+/** The reader's Buddy in a project as a dial draws it, from Desktop's pattern for its whole name. */+function buddyOf(agents: Json[], chat: Json, me: string | undefined): SwarmBuddy | undefined {+ const [found] = buddiesIn(agents, chat, me)+ if (!found) return undefined+ const name = agentName(found)+ return { chatId: chat.id as string, name: cut(name, NAME_BYTES), engine: String(object(found.configuration).engine ?? ''), ...buddyAvatar(name),+ live: typeof found.downSince !== 'string' }}/**@@ -73,8 +117,9 @@ function voicesOf(face: { conversation: Json; kind: ChatKind }, leadId: string):* harness and whether it is in a turn (null: not here); `me` is the signed-in person's id, so a Lead on someone else's* machine names that owner (people[] has an email, which is the name a Swarm shows a person by).*/-export function leadsOf(state: Json, machineId: string, live: (harnessId: string) => { inTurn: boolean; since?: number } | null, me?: string, focus?: string): { count: number; leads: SwarmLead[] } {+export function leadsOf(state: Json, machineId: string, live: (harnessId: string) => { inTurn: boolean; since?: number } | null, me?: string, focus?: string, side?: CardSide): { count: number; leads: SwarmLead[] } {const agents = list(state.agents), conversations = list(state.conversations), people = list(state.people)+ const buddies = state.buddies === true// An old tab has no `projects`: its one project is the tab itself, `lead`, led by the conversation `lead`.const projects = Array.isArray(state.projects) ? list(state.projects) : [{ id: 'lead', name: state.name, leadConversationId: 'lead' }]const paused = state.paused === true@@ -108,22 +153,17 @@ export function leadsOf(state: Json, machineId: string, live: (harnessId: string}const ownerId = agent.machineOwnerIdconst owner = me && typeof ownerId === 'string' && ownerId !== me ? people.find(p => p.id === ownerId) : undefined- const face = faceOf(conversations, projectKey(project), lead, focus)- let chat: SwarmChat | undefined- if (face) {- const { conversation, kind } = face- // Only a group works on the dial, and only while its assignment works: Lead and PM chats never do (design decision 4).- const working = kind === 'group' && object(conversation.assignment).status === 'working'- const voices = voicesOf(face, String(agent.id))- const turns = working ? agents.filter(a => voices.has(a.id as string)).map(turnHere).filter(t => t?.inTurn) : []- const secs = turns.map(t => t!.since).filter((v): v is number => typeof v === 'number')- chat = { kind, id: conversation.id as string, name: kind === 'lead' ? 'Lead' : kind === 'pm' ? 'PM' : cut(String(conversation.title ?? ''), NAME_BYTES), working,- ...(secs.length ? { since: Math.max(...secs) } : {}) }- }+ const projectId = projectKey(project)+ const chatOf = (face: Face | null): SwarmChat | undefined => face ? faceChat(face, String(agent.id), agents, me, turnHere) : undefined+ const chat = chatOf(faceOf(conversations, projectId, lead, focus, me, buddies))+ const buddyChat = buddies ? buddyChatOf(conversations, projectId, me) : undefined+ const sideChat = buddies ? chatOf(sideFaceOf(conversations, projectId, lead, focus, me, side)) : undefined+ const buddy = buddyChat && buddyOf(agents, buddyChat, me)leads.push({id: String(agent.id), projectId: String(project.id ?? 'lead'), project: cut(String(project.name ?? ''), NAME_BYTES), engine: String(object(agent.configuration).engine ?? ''),owner: owner && typeof owner.email === 'string' ? cut(owner.email, NAME_BYTES) : '',local: here && cardId(harnessId) ? harnessId : '', state, order, ...(since !== undefined ? { since } : {}), ...(chat ? { chat } : {}),+ ...(sideChat ? { sideChat } : {}), ...(buddies ? { buddies: true as const } : {}), ...(buddy ? { buddy } : {}),})}// Array.sort is stable: equal urgency keeps the project order.@@ -131,6 +171,20 @@ export function leadsOf(state: Json, machineId: string, live: (harnessId: stringreturn { count: ordered.length, leads: ordered.slice(0, MAX_LEADS) }}+/** A face as the dial names it. Only a group works on the dial, and only while its assignment works: Lead, PM and Buddy+ * chats never do (design decision 4). A Buddy face is named for the reader's Buddy, or plainly while it has none. */+function faceChat(face: Face, leadId: string, agents: Json[], me: string | undefined, turnHere: (a: Json) => { inTurn: boolean; since?: number } | null): SwarmChat {+ const { conversation, kind } = face+ const working = kind === 'group' && object(conversation.assignment).status === 'working'+ const voices = voicesOf(face, leadId, agents, me)+ const turns = working ? agents.filter(a => voices.has(a.id as string)).map(turnHere).filter(t => t?.inTurn) : []+ const secs = turns.map(t => t!.since).filter((v): v is number => typeof v === 'number')+ const [buddy] = kind === 'buddy' ? buddiesIn(agents, conversation, me) : []+ const name = kind === 'lead' ? 'Lead' : kind === 'pm' ? 'PM' : kind === 'buddy' ? (buddy ? cut(agentName(buddy), NAME_BYTES) : 'Buddy')+ : cut(String(conversation.title ?? ''), NAME_BYTES)+ return { kind, id: conversation.id as string, name, working, ...(secs.length ? { since: Math.max(...secs) } : {}) }+}+/** The newest row one of the chat's agents wrote: a person-visible message, not a system row (`source`), the person's or* another agent's. `at` in seconds; `id` the message's, or '' when it has none. */export function lastAgentMessage(messages: Json[], agentIds: ReadonlySet<string>): { text: string; at: number; id: string; sequence: number } | null {@@ -150,11 +204,15 @@ export function lastAgentMessage(messages: Json[], agentIds: ReadonlySet<string>interface TabCache { lastChangedAt: number | null; state: Json }interface Cached { sequence: number; recap: LeadRecap }/** A Lead some Harness Pro has the recap of open, and the sessions (one per Pro) that have it open. With `chat` (a round dial- * that speaks `swarmChat`), the recap is the face chat's, and `chatId` the chat it was last told of. */-interface Opened { tabId: string; leadId: string; chat: boolean; chatId: string | null; sequence: number | null; sessions: Set<string> }+ * that speaks `swarmChat`, or 'buddy' for one that speaks swarmBuddy), the recap is that dial's face chat's, and `chatId`+ * the chat it was last told of. */+interface Opened { tabId: string; leadId: string; chat: CardChat; chatId: string | null; sequence: number | null; sessions: Set<string> }/** Where a recap is read, or talk is posted: a conversation, how far it has gone, and whose messages are its recap. */interface Target { id: string; sequence: number; voices: Set<string>; chatId?: string }const recapKey = (tabId: string, leadId: string, chatId?: string) => chatId === undefined ? `${tabId}:${leadId}` : `${tabId}:${leadId}:${chatId}`+/** A recap's cache key: an older dial's and a swarmBuddy dial's recap of one Buddy chat hear different voices. */+const cachedKey = (tabId: string, leadId: string, chatId: string | undefined, chat: CardChat) => `${recapKey(tabId, leadId, chatId)}${chat === 'buddy' ? ':buddy' : ''}`+const isSide = (v: unknown): v is CardSide => v === 'pm' || v === 'buddy'const tabOf = (read: SwarmRead): TabCache => ({ lastChangedAt: read.lastChangedAt, state: read.state })export class SwarmCards {@@ -189,6 +247,10 @@ export class SwarmCards {private seen = new Map<string, number>()/** Each Lead's newest notice (`${tab}:${lead}`), carried on its card. */private notices = new Map<string, LeadNotice>()+ /** Each Lead's newest quiet notice from the reader's Buddy (`${tab}:${lead}`): apart, so it never hides the Lead's. */+ private buddyNotices = new Map<string, LeadNotice>()+ /** The side a swarmBuddy dial swiped to, per Swarm; cleared by the window's next focus change (the newest wins). */+ private sides = new Map<string, CardSide>()/** Watched conversations whose last read failed, so a run of failures is logged once. */private failed = new Set<string>()private readonly reads: SwarmReads@@ -207,9 +269,9 @@ export class SwarmCards {if (!on) {if (this.timer) clearInterval(this.timer)this.timer = undefined- this.opened.clear(); this.openBy.clear(); this.include = []; this.focus = null+ this.opened.clear(); this.openBy.clear(); this.include = []; this.focus = null; this.sides.clear()// A device that attaches again starts a fresh baseline: what was said while none was here never alerts.- this.seen.clear(); this.notices.clear(); this.failed.clear()+ this.seen.clear(); this.forgetNotices()return}const wanted = include.filter(cardId).slice(0, MAX_CARDS)@@ -218,6 +280,7 @@ export class SwarmCards {const next = focus && cardId(focus.tabId) && cardId(focus.conversationId) ? { tabId: focus.tabId, conversationId: focus.conversationId } : nullconst refocused = `${next?.tabId}/${next?.conversationId}` !== `${this.focus?.tabId}/${this.focus?.conversationId}`this.focus = next+ if (refocused) this.sides.clear()if (this.timer) {if (refocused && this.live) { this.emit(); void this.pushOpen() }if (moved) void this.tick()@@ -228,9 +291,17 @@ export class SwarmCards {void this.tick()}+ /** A swarmBuddy dial swiped to a side of a Swarm (spec 2026-10-29): every project of it shows that side until the window+ * opens another conversation. The cards are rebuilt at once from the last reads, as a focus change does. */+ side(tabId: string, side: CardSide): void {+ if (!cardId(tabId) || !isSide(side) || this.sides.get(tabId) === side) return+ this.sides.set(tabId, side)+ if (this.timer && this.live) { this.emit(); void this.pushOpen() }+ }+/** The recap on a Pro's screen (leadId null: closed), per Pro `session`: a change in that Lead's conversation is pushed once.* With `chat`, the face chat's: a change in it, or another chat on the face, is pushed once. */- open(session: string, tabId: string, leadId: string | null, chat = false): void {+ open(session: string, tabId: string, leadId: string | null, chat: CardChat = false): void {const before = this.openBy.get(session)if (before) {const held = this.opened.get(before)@@ -239,13 +310,13 @@ export class SwarmCards {this.openBy.delete(session)}if (!leadId || !cardId(session) || !cardId(tabId) || !cardId(leadId)) return- const key = `${recapKey(tabId, leadId)}${chat ? ':chat' : ''}`+ const key = `${recapKey(tabId, leadId)}${chat === 'buddy' ? ':buddy' : chat ? ':chat' : ''}`let entry = this.opened.get(key)if (!entry) {// From what the Pro was shown when there is a recap read, else from the first read of the tab: the next change is pushed.const target = this.target(tabId, leadId, chat)entry = { tabId, leadId, chat, chatId: target?.chatId ?? null,- sequence: target ? this.recaps.get(recapKey(tabId, leadId, target.chatId))?.sequence ?? target.sequence : null, sessions: new Set() }+ sequence: target ? this.recaps.get(cachedKey(tabId, leadId, target.chatId, chat))?.sequence ?? target.sequence : null, sessions: new Set() }this.opened.set(key, entry)}entry.sessions.add(session)@@ -302,10 +373,12 @@ export class SwarmCards {}}))this.tabs = known+ // A Swarm that left the cards (access lost) takes the dial's side with it.+ for (const tabId of [...this.sides.keys()]) if (!known.has(tabId)) this.sides.delete(tabId)this.rows = rows.map(row => ({ id: row.id as string, name: row.name }))const me = (await this.core.account.identity().catch(() => null))?.accountId// Another person signed in: nothing of the last account's is kept, and the list is said again whatever it is.- if (this.me !== undefined && me !== this.me) { this.last = null; this.recaps.clear(); this.seen.clear(); this.notices.clear(); this.failed.clear() }+ if (this.me !== undefined && me !== this.me) { this.last = null; this.recaps.clear(); this.seen.clear(); this.forgetNotices(); this.sides.clear() }this.me = me ?? this.meconst turns = await this.turnsHere()this.live = (harnessId: string) => this.core.agents.byAgent(harnessId) ? turns.get(harnessId) ?? { inTurn: false } : null@@ -323,10 +396,10 @@ export class SwarmCards {const tab = this.tabs.get(row.id)if (!tab) continueconst focus = this.focus?.tabId === row.id ? this.focus.conversationId : undefined- const { count, leads } = leadsOf(tab.state, this.machineId, live, this.me, focus)+ const { count, leads } = leadsOf(tab.state, this.machineId, live, this.me, focus, this.sides.get(row.id))const noticed = leads.map(lead => {- const notice = this.notices.get(recapKey(row.id, lead.id))- return notice ? { ...lead, notice } : lead+ const notice = this.notices.get(recapKey(row.id, lead.id)), buddyNotice = this.buddyNotices.get(recapKey(row.id, lead.id))+ return { ...lead, ...(notice ? { notice } : {}), ...(buddyNotice ? { buddyNotice } : {}) }})cards.push({ id: row.id, name: cut(String(tab.state.name ?? row.name ?? ''), NAME_BYTES), count, leads: noticed })}@@ -345,16 +418,18 @@ export class SwarmCards {* the tab reads already carry. A conversation first seen sets the baseline and is not read; one that moved past it has its* newest page read once, under the recaps' limit, and the newest message its Lead wrote after the baseline becomes the* Lead's notice. Two messages between two reads make one notice, for the newest. The baseline moves only after a read- * that worked, so a failed one is tried again at the next poll. Groups are never watched.+ * that worked, so a failed one is tried again at the next poll. Groups are never watched, nor another person's Buddy chat.+ * While Buddies are on, the same read of the Buddy chat gives the newest message of the reader's Buddy as the Lead's+ * quiet notice (spec 2026-10-29 Alerts), kept apart from its notice.*/private async watchNotices(): Promise<void> {const watched = new Set<string>()for (const [tabId, { state }] of this.tabs) {- const conversations = list(state.conversations)+ const conversations = list(state.conversations), agents = list(state.agents), buddies = state.buddies === truefor (const { project, lead, leadId } of leadProjects(state)) {const projectId = projectKey(project)- const chats: Array<{ conversation: Json; chat: LeadNotice['chat'] }> = [{ conversation: lead, chat: 'lead' },- ...conversations.filter(c => inProject(c, projectId) && isPmChat(c) && c.archived !== true).map(conversation => ({ conversation, chat: 'pm' as const }))]+ const chats: Array<{ conversation: Json; chat: 'lead' | 'pm' }> = [{ conversation: lead, chat: 'lead' },+ ...conversations.filter(c => inProject(c, projectId) && isReadersBuddyChat(c, this.me) && c.archived !== true).map(conversation => ({ conversation, chat: 'pm' as const }))]for (const { conversation, chat } of chats) {if (!cardId(conversation.id) || typeof conversation.lastMessageSequence !== 'number') continueconst key = `${tabId}:${conversation.id}`, sequence = conversation.lastMessageSequence@@ -366,11 +441,10 @@ export class SwarmCards {try {const page = object(await backend(this.core, 'GET', `/api/super-tabs/${tabId}/conversations/${conversation.id}/messages`))const after = list(page.messages).filter(m => typeof m.sequence === 'number' && m.sequence > baseline)- const said = lastAgentMessage(after, new Set([leadId]))- if (said && cardId(said.id)) {- const notice: LeadNotice = { chat, chatId: conversation.id, id: said.id, text: cut(said.text, RECAP_BYTES), at: said.at }- const held = this.notices.get(recapKey(tabId, leadId))- if (!held || held.at <= notice.at) this.notices.set(recapKey(tabId, leadId), notice)+ raise(this.notices, recapKey(tabId, leadId), chat, conversation.id, lastAgentMessage(after, new Set([leadId])))+ if (chat === 'pm' && buddies) {+ const voices = new Set(buddiesIn(agents, conversation, this.me).map(a => a.id as string))+ raise(this.buddyNotices, recapKey(tabId, leadId), 'buddy', conversation.id, lastAgentMessage(after, voices))}this.seen.set(key, sequence)this.failed.delete(key)@@ -386,9 +460,13 @@ export class SwarmCards {// A Swarm or project that left the cards takes its baseline and notices with it.for (const key of [...this.seen.keys()]) if (!watched.has(key)) this.seen.delete(key)for (const key of [...this.failed]) if (!watched.has(key)) this.failed.delete(key)- for (const [key, notice] of this.notices) if (!watched.has(`${key.slice(0, key.indexOf(':'))}:${notice.chatId}`)) this.notices.delete(key)+ for (const held of [this.notices, this.buddyNotices]) {+ for (const [key, notice] of held) if (!watched.has(`${key.slice(0, key.indexOf(':'))}:${notice.chatId}`)) held.delete(key)+ }}+ private forgetNotices(): void { this.notices.clear(); this.buddyNotices.clear(); this.failed.clear() }+/** Which of the Leads that run here are in a turn, and since when (the core's windows' own measure of "working"). */private async turnsHere(): Promise<Map<string, { inTurn: boolean; since?: number }>> {const ids = new Set<string>()@@ -412,23 +490,26 @@ export class SwarmCards {}/** Where the Lead's recap is read and its talk posted, from the tab as last read: its Lead conversation, or with `chat` the- * chat on its project's face (`chatId` set). */- private target(tabId: string, leadId: string, chat: boolean): Target | null {+ * chat on its project's face for that dial (`chatId` set): today's, or with 'buddy' the side a swarmBuddy dial keeps+ * while the Swarm has Buddies on. */+ private target(tabId: string, leadId: string, chat: CardChat): Target | null {const state = this.tabs.get(tabId)?.stateif (!state) return nullconst found = leadProjects(state).find(p => p.leadId === leadId)if (!found || !identifier(found.lead.id)) return nullif (!chat) return { id: found.lead.id, sequence: sequenceOf(found.lead), voices: new Set([leadId]) }const focus = this.focus?.tabId === tabId ? this.focus.conversationId : undefined- const face = faceOf(list(state.conversations), projectKey(found.project), found.lead, focus)+ const conversations = list(state.conversations), projectId = projectKey(found.project), buddies = state.buddies === true+ const face = chat === 'buddy' && buddies ? sideFaceOf(conversations, projectId, found.lead, focus, this.me, this.sides.get(tabId))+ : faceOf(conversations, projectId, found.lead, focus, this.me, buddies)if (!face) return nullconst id = face.conversation.id as string- return { id, sequence: sequenceOf(face.conversation), voices: voicesOf(face, leadId), chatId: id }+ return { id, sequence: sequenceOf(face.conversation), voices: voicesOf(face, leadId, list(state.agents), this.me), chatId: id }}/** What the Lead last said: the newest page of its conversation, then one page back; `none` when neither holds a row of its own.* With `chat`, what the chat on its face last heard from its agents, naming that chat. */- async recap(tabId: string, leadId: string, chat = false): Promise<LeadRecap> {+ async recap(tabId: string, leadId: string, chat: CardChat = false): Promise<LeadRecap> {if (!cardId(tabId) || !cardId(leadId)) return { tabId, leadId, text: '', at: 0, none: true }let found = this.target(tabId, leadId, chat)if (!found) {@@ -438,12 +519,13 @@ export class SwarmCards {found = this.target(tabId, leadId, chat)}if (!found) return { tabId, leadId, text: '', at: 0, none: true }- const named = found.chatId === undefined ? {} : { chatId: found.chatId }- const key = recapKey(tabId, leadId, found.chatId), held = this.recaps.get(key)+ const named = found.chatId === undefined ? {} : { chatId: found.chatId, ...(chat === 'buddy' ? { buddy: true as const } : {}) }+ const key = cachedKey(tabId, leadId, found.chatId, chat), held = this.recaps.get(key)if (held && held.sequence === found.sequence) return held.recap// At most two backend reads of recaps run at once: a Pro that asks in a loop cannot flood the backend.if (this.recapsRunning >= MAX_RECAPS_IN_FLIGHT) throw new Error('too many recap reads at once')this.recapsRunning+++ const reader = this.metry {const path = `/api/super-tabs/${tabId}/conversations/${found.id}/messages`const newest = object(await backend(this.core, 'GET', path))@@ -453,6 +535,9 @@ export class SwarmCards {if (!said && typeof before.sequence === 'number' && identifier(before.id)) {said = lastAgentMessage(list(object(await backend(this.core, 'GET', `${path}?before=${before.sequence}&beforeId=${before.id}`)).messages), found.voices)}+ // Access to the Swarm ended, another person signed in, or the face moved on while the read was out: the answer is not+ // this reader's to have now (a Buddy chat is its owner's alone), so it is neither given nor kept.+ if (this.me !== reader || this.target(tabId, leadId, chat)?.id !== found.id) return { tabId, leadId, text: '', at: 0, none: true }const recap: LeadRecap = said ? { tabId, leadId, text: cut(said.text, RECAP_BYTES), at: said.at, none: false, ...named } : { tabId, leadId, text: '', at: 0, none: true, ...named }this.recaps.set(key, { sequence: found.sequence, recap })return recap@@ -460,25 +545,35 @@ export class SwarmCards {}/** Words spoken on a Pro to a Lead that runs here (its harness): posted as the person in that Lead's conversation, as typed in- * the Swarm chat; with `chat`, in the chat on its face. False when that harness leads no project in the Swarms as last read,- * so the caller sends the turn as before. */- async say(harnessId: string, text: string, chat = false): Promise<boolean> {+ * the Swarm chat; with `chat`, in the chat on its face. Not `said` when that harness leads no project in the Swarms as last+ * read, so the caller sends the turn as before; `refused` when the backend refused the post (a 4xx: a read-only Chat with+ * PM, Buddies off, a Buddy chat not the reader's), whose words must never become a terminal turn instead (spec 2026-10-29+ * Voice). Any other failure (the network, a 5xx) throws as before. `chatId`: the chat on the dial's face when the words+ * were spoken; they go there or nowhere, so words for the reader's Buddy never land in the project's chat because the+ * window moved on while they were said (review of #2146). */+ async say(harnessId: string, text: string, chat: CardChat = false, chatId?: string): Promise<SaidOnCard> {for (const [tabId, { state }] of this.tabs) {const agent = list(state.agents).find(a => a.machineId === this.machineId && a.harnessId === harnessId)const found = agent && cardId(agent.id) ? this.target(tabId, agent.id, chat) : nullif (!found) continue- await backend(this.core, 'POST', `/api/super-tabs/${tabId}/commands`, { operationId: `pro-voice-${randomUUID()}`,- command: { type: 'message.send', conversationId: found.id, text, replyTo: null, recipientIds: [] } })- return true+ if (chatId !== undefined && found.id !== chatId) return { said: false, refused: { code: 'CHAT_MOVED', message: 'That chat is no longer on the dial. Say it again.' } }+ try {+ await backend(this.core, 'POST', `/api/super-tabs/${tabId}/commands`, { operationId: `pro-voice-${randomUUID()}`,+ command: { type: 'message.send', conversationId: found.id, text, replyTo: null, recipientIds: [] } })+ } catch (error) {+ if (error instanceof SuperTabHostError && error.status >= 400 && error.status < 500) return { said: false, refused: { code: error.code, message: error.message } }+ throw error+ }+ return { said: true }}- return false+ return { said: false }}/** Remembered recaps are kept only for Leads that are still in a tab, and a chat's only while it is on the face. */private prune(): void {for (const [key, held] of this.recaps) {- const { tabId, leadId, chatId } = held.recap- const now = this.target(tabId, leadId, chatId !== undefined)+ const { tabId, leadId, chatId, buddy } = held.recap+ const now = this.target(tabId, leadId, buddy ? 'buddy' : chatId !== undefined)if (!now || now.chatId !== chatId) this.recaps.delete(key)}}@@ -505,6 +600,14 @@ export class SwarmCards {}}+/** The newest message said becomes the held notice at `key`, unless one held is newer. */+function raise(held: Map<string, LeadNotice>, key: string, chat: LeadNotice['chat'], chatId: string, said: ReturnType<typeof lastAgentMessage>): void {+ if (!said || !cardId(said.id)) return+ const notice: LeadNotice = { chat, chatId, id: said.id, text: cut(said.text, RECAP_BYTES), at: said.at }+ const before = held.get(key)+ if (!before || before.at <= notice.at) held.set(key, notice)+}+/** Each project of a tab whose Lead conversation names its Lead: the project, that conversation and the Lead agent's id. */function leadProjects(state: Json): Array<{ project: Json; lead: Json; leadId: string }> {const conversations = list(state.conversations)diff --git a/cli/src/superTabs/inCore/cards.spec.ts b/cli/src/superTabs/inCore/cards.spec.tsindex 7e655e8e5..60cc3a5dc 100644--- a/cli/src/superTabs/inCore/cards.spec.ts+++ b/cli/src/superTabs/inCore/cards.spec.ts@@ -119,6 +119,31 @@ describe('the Swarm cards on the devices', () => {cards.recap(recap({ chatId: 'bad id' }))expect(swarmCardRecap).toHaveBeenCalledOnce()})+ // Round dial PM and Buddy screens (spec 2026-10-29): the swarmBuddy dial's fields, checked as the chat and notice are.+ it('keeps a sound side chat, buddies flag, buddy block and buddy notice, drops a malformed one', () => {+ const { cards, swarmCards, swarmCardRecap } = setup()+ const buddy = (over: Record<string, unknown> = {}) => ({ chatId: 'b1', name: "diego's Buddy", engine: 'codex', cells: 25513, color: '#d6a79a', live: true, ...over })+ const quiet = (over: Record<string, unknown> = {}) => ({ chat: 'buddy', chatId: 'b1', id: 'm2', text: 'An idea', at: 1792560000, ...over })+ const side = { kind: 'buddy', id: 'b1', name: "diego's Buddy", working: false }+ cards.cards([card('t1', [lead('l1', { sideChat: side, buddies: true, buddy: buddy({ name: 'b'.repeat(60), engine: 'e'.repeat(20) }), buddyNotice: quiet({ text: '日'.repeat(600) }), notice: quiet() })])])+ const [sent] = swarmCards.mock.calls[0][0][0].leads+ expect(sent).toMatchObject({ sideChat: side, buddies: true, buddy: buddy({ name: 'b'.repeat(48), engine: 'e'.repeat(16) }), buddyNotice: quiet({ text: '日'.repeat(500) }) })+ // The Buddy's word never rides in the Lead's notice, which an older dial reads.+ expect(sent).not.toHaveProperty('notice')+ swarmCards.mockClear()+ const badBuddies = [buddy({ chatId: 'bad id' }), buddy({ name: 5 }), buddy({ engine: null }), buddy({ cells: 32768 }), buddy({ cells: -1 }), buddy({ cells: 1.5 }),+ buddy({ color: '#D6A79A' }), buddy({ color: 'red' }), buddy({ live: 'yes' }), 'buddy']+ for (const bad of badBuddies) cards.cards([card('t1', [lead('l1', { buddy: bad, buddies: 'yes', sideChat: { ...side, kind: 'other' }, buddyNotice: quiet({ chat: 'lead' }) })])])+ expect(swarmCards).toHaveBeenCalledTimes(badBuddies.length)+ for (const [list] of swarmCards.mock.calls) {+ for (const field of ['buddy', 'buddies', 'sideChat', 'buddyNotice']) expect(list[0].leads[0]).not.toHaveProperty(field)+ }+ // A swarmBuddy dial's recap says so; anything but a literal true is not.+ cards.recap(recap({ chatId: 'b1', buddy: true }))+ expect(swarmCardRecap).toHaveBeenLastCalledWith(recap({ chatId: 'b1', buddy: true }))+ cards.recap(recap({ chatId: 'b1', buddy: 'yes' }))+ expect(swarmCardRecap).toHaveBeenLastCalledWith(recap({ chatId: 'b1' }))+ })})describe('whether the Swarm cards are wanted, which the core owns', () => {@@ -232,6 +257,21 @@ describe('whether the Swarm cards are wanted, which the core owns', () => {expect(request.mock.calls).toEqual([[{ action: 'cardRecap', tabId: 't1', leadId: 'l1', chat: true }], [{ action: 'cardOpen', session: 's1', tabId: 't1', leadId: 'l1', chat: true }],[{ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: true }], [{ action: 'cardRecap', tabId: 't1', leadId: 'l1' }]])})+ it('passes a swarmBuddy dial\'s buddy flag, and its side as cardSide with a sound side only', async () => {+ const { cards, request } = wanting()+ await cards.ask({ action: 'cardRecap', tabId: 't1', leadId: 'l1', chat: 'buddy' })+ await cards.ask({ action: 'cardOpen', session: 's1', tabId: 't1', leadId: 'l1', chat: 'buddy' })+ await cards.ask({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy', chatId: 'pm1' })+ expect(await cards.ask({ action: 'cardSide', tabId: 't1', side: 'buddy', extra: 1 })).toEqual({ ok: true })+ await cards.ask({ action: 'cardSide', tabId: 't1', side: 'pm' })+ await cards.ask({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: true, chatId: 'bad id' })+ expect(request.mock.calls).toEqual([[{ action: 'cardRecap', tabId: 't1', leadId: 'l1', chat: 'buddy' }], [{ action: 'cardOpen', session: 's1', tabId: 't1', leadId: 'l1', chat: 'buddy' }],+ [{ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy', chatId: 'pm1' }], [{ action: 'cardSide', tabId: 't1', side: 'buddy' }], [{ action: 'cardSide', tabId: 't1', side: 'pm' }],+ [{ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: true }]])+ request.mockClear()+ for (const side of ['up', null, undefined, true]) expect(await cards.ask({ action: 'cardSide', tabId: 't1', side })).toEqual({ error: 'INVALID_REQUEST' })+ expect(request).not.toHaveBeenCalled()+ })it('on an account change with no device wanting cards only clears the list', () => {const { cards, request, swarmCards } = wanting()cards.cards([card('t1')])diff --git a/cli/src/superTabs/inCore/cards.ts b/cli/src/superTabs/inCore/cards.tsindex 6ca50401b..03afb136c 100644--- a/cli/src/superTabs/inCore/cards.ts+++ b/cli/src/superTabs/inCore/cards.ts@@ -13,7 +13,7 @@* whether a capable Pro is attached and which Swarms the desktop has tabs for (`want`), and the core says it to the Super Tab* service, again whenever that service (re)connects (`serviceUp`), and takes it back when the devices go (`devicesGone`).*/-import type { LeadNotice, LeadRecap, SwarmCard, SwarmChat, SwarmLead } from '../../core/api.js'+import type { LeadNotice, LeadRecap, SwarmBuddy, SwarmCard, SwarmChat, SwarmLead } from '../../core/api.js'export interface SuperTabCardsDeps {/** The devices' door for the list (`ports.devices.swarmCards`). */@@ -27,8 +27,14 @@ export interface SuperTabCardsDeps {const MAX_CARDS = 16, MAX_LEADS = 12, NAME_BYTES = 48, ENGINE_BYTES = 16, RECAP_BYTES = 1500const STATES: ReadonlySet<string> = new Set(['ask', 'stuck', 'work', 'done'])-const CHATS: ReadonlySet<string> = new Set(['lead', 'pm', 'group'])+const CHATS: ReadonlySet<string> = new Set(['lead', 'pm', 'group', 'buddy'])+/** The Lead's notice comes from its Lead or Buddy chat, the Buddy's quiet one from its chat alone: an older dial reads only+ * the first, so the Buddy's words never reach it. */const NOTICE_CHATS: ReadonlySet<string> = new Set(['lead', 'pm'])+const BUDDY_NOTICE_CHATS: ReadonlySet<string> = new Set(['buddy'])+/** Desktop's pattern is the 15 half bits of a 5×5 grid (superTabs/buddyAvatar.ts). */+const MAX_CELLS = 0x7fff+const COLOR = /^#[0-9a-f]{6}$//** The Pro keeps an id in 48 bytes with its NUL. */const ID = /^[A-Za-z0-9_-]{1,47}$/const id = (value: unknown): value is string => typeof value === 'string' && ID.test(value)@@ -54,13 +60,21 @@ function chatIn(value: unknown): SwarmChat | null {return { kind: chat.kind as SwarmChat['kind'], id: chat.id, name: cut(chat.name, NAME_BYTES), working: chat.working, ...(chat.since === undefined ? {} : { since: chat.since }) }}-/** A Lead's notice, checked and cut; null when it is not one, and the Lead goes on without it. */-function noticeIn(value: unknown): LeadNotice | null {+/** A Lead's notice from one of `chats`, checked and cut; null when it is not one, and the Lead goes on without it. */+function noticeIn(value: unknown, chats: ReadonlySet<string>): LeadNotice | null {const notice = object(value)- if (typeof notice.chat !== 'string' || !NOTICE_CHATS.has(notice.chat) || !id(notice.chatId) || !id(notice.id) || typeof notice.text !== 'string' || !whole(notice.at)) return null+ if (typeof notice.chat !== 'string' || !chats.has(notice.chat) || !id(notice.chatId) || !id(notice.id) || typeof notice.text !== 'string' || !whole(notice.at)) return nullreturn { chat: notice.chat as LeadNotice['chat'], chatId: notice.chatId, id: notice.id, text: cut(notice.text, RECAP_BYTES), at: notice.at }}+/** The reader's Buddy on a Lead, checked and cut; null when it is not one. */+function buddyIn(value: unknown): SwarmBuddy | null {+ const buddy = object(value)+ if (!id(buddy.chatId) || typeof buddy.name !== 'string' || typeof buddy.engine !== 'string' || typeof buddy.live !== 'boolean') return null+ if (!whole(buddy.cells) || buddy.cells > MAX_CELLS || typeof buddy.color !== 'string' || !COLOR.test(buddy.color)) return null+ return { chatId: buddy.chatId, name: cut(buddy.name, NAME_BYTES), engine: cut(buddy.engine, ENGINE_BYTES), cells: buddy.cells, color: buddy.color, live: buddy.live }+}+/** A Lead the service sent, checked and cut; null when it is not one. */function leadIn(value: unknown): SwarmLead | null {const lead = object(value)@@ -73,11 +87,17 @@ function leadIn(value: unknown): SwarmLead | null {if (!whole(lead.order)) return null// The round dial's chat and alert are additions: one that is not sound is left out, and the Lead is kept as today's.const chat = lead.chat === undefined ? null : chatIn(lead.chat)- const notice = lead.notice === undefined ? null : noticeIn(lead.notice)+ const notice = lead.notice === undefined ? null : noticeIn(lead.notice, NOTICE_CHATS)+ // And so are the Buddy screen's (spec 2026-10-29-round-dial-pm-buddy).+ const sideChat = lead.sideChat === undefined ? null : chatIn(lead.sideChat)+ const buddy = lead.buddy === undefined ? null : buddyIn(lead.buddy)+ const buddyNotice = lead.buddyNotice === undefined ? null : noticeIn(lead.buddyNotice, BUDDY_NOTICE_CHATS)return {id: lead.id, projectId: lead.projectId, project: cut(lead.project, NAME_BYTES), engine: cut(lead.engine, ENGINE_BYTES),owner: cut(lead.owner, NAME_BYTES), local: lead.local, state: lead.state as SwarmLead['state'], order: lead.order,...(lead.since === undefined ? {} : { since: lead.since }), ...(chat ? { chat } : {}), ...(notice ? { notice } : {}),+ ...(sideChat ? { sideChat } : {}), ...(lead.buddies === true ? { buddies: true as const } : {}), ...(buddy ? { buddy } : {}),+ ...(buddyNotice ? { buddyNotice } : {}),}}@@ -100,7 +120,8 @@ function recapIn(value: unknown): LeadRecap | null {if (!id(recap.tabId) || !id(recap.leadId) || typeof recap.text !== 'string' || !whole(recap.at) || typeof recap.none !== 'boolean') return null// A chat's recap names its chat or is not one: a dial must never show it for another chat.if (recap.chatId !== undefined && !id(recap.chatId)) return null- return { tabId: recap.tabId, leadId: recap.leadId, text: cut(recap.text, RECAP_BYTES), at: recap.at, none: recap.none, ...(recap.chatId === undefined ? {} : { chatId: recap.chatId }) }+ return { tabId: recap.tabId, leadId: recap.leadId, text: cut(recap.text, RECAP_BYTES), at: recap.at, none: recap.none, ...(recap.chatId === undefined ? {} : { chatId: recap.chatId }),+ ...(recap.buddy === true ? { buddy: true as const } : {}) }}export function createSuperTabCards({ swarmCards, swarmCardRecap, request, log = (line) => console.log(line) }: SuperTabCardsDeps) {@@ -165,13 +186,19 @@ export function createSuperTabCards({ swarmCards, swarmCardRecap, request, log =swarmCardRecap(recap)},/** What the devices may ask of the Super Tab service, and nothing else of it: `cardsWanted` is kept here, `cardRecap`,- * `cardOpen`, `cardSay` and `cardWorker` go to the service; any other action is refused. */+ * `cardOpen`, `cardSay`, `cardSide` and `cardWorker` go to the service; any other action is refused. */ask(payload: Record<string, unknown>): Promise<Record<string, unknown>> {if (payload.action === 'cardsWanted') { api.want(payload.on === true, payload.include, payload.focus); return Promise.resolve({ ok: true }) }- // A round dial that speaks swarmChat asks for the chat on its face; without the flag, the request is today's.- const chat = payload.chat === true ? { chat: true } : {}+ // A round dial that speaks swarmChat asks for the chat on its face, and one that speaks swarmBuddy for the face on its+ // side ('buddy'); without the flag, the request is today's.+ const chat = payload.chat === true || payload.chat === 'buddy' ? { chat: payload.chat } : {}+ // The side a swarmBuddy dial swiped to.+ if (payload.action === 'cardSide') {+ return payload.side === 'pm' || payload.side === 'buddy' ? route({ action: 'cardSide', tabId: payload.tabId, side: payload.side }) : Promise.resolve({ error: 'INVALID_REQUEST' })+ }if (payload.action === 'cardRecap') return route({ action: 'cardRecap', tabId: payload.tabId, leadId: payload.leadId, ...chat })- if (payload.action === 'cardSay') return route({ action: 'cardSay', harnessId: payload.harnessId, text: payload.text, ...chat })+ // The chat on the dial's face when the words were spoken, which they may be posted in and no other.+ if (payload.action === 'cardSay') return route({ action: 'cardSay', harnessId: payload.harnessId, text: payload.text, ...chat, ...(id(payload.chatId) ? { chatId: payload.chatId } : {}) })if (payload.action === 'cardOpen') return route({ action: 'cardOpen', session: payload.session, tabId: payload.tabId, leadId: payload.leadId, ...chat })// A card's failure from another computer: whether its agent is a Swarm's worker (services/devices.ts asks; it decides).if (payload.action === 'cardWorker') return route({ action: 'cardWorker', machineId: payload.machineId, harnessId: payload.harnessId })diff --git a/cli/src/superTabs/planInput.ts b/cli/src/superTabs/planInput.tsindex ee20bb72c..21bff69b9 100644--- a/cli/src/superTabs/planInput.ts+++ b/cli/src/superTabs/planInput.ts@@ -4,7 +4,7 @@* rules are applied per task, as each binds only its own project's groups, with the same checks the route makes* (routeCommand.ts), so the plan never offers what the route would refuse. Only new agents are planned, not idle members. */import { requiredToolReason, startRequirements } from './capacity.js'-import { API_BUILDERS, breaks, floorFor, KIND_WORD, liftEffort, quotaOf2, SIZES, type Assessment, type Level, type Policy, type Size, type SwarmRule } from './route.js'+import { API_BUILDERS, breaks, floorFor, gridQuality, KIND_WORD, liftEffort, quotaOf2, SIZES, type Assessment, type Level, type Policy, type Size, type SwarmRule } from './route.js'import { LOCAL_FRESH_MS, OFFLINE, servedModels, STALLED, stalled, takesBuilder, taskRequirement, unreadyPool } from './routeCommand.js'import { identifier, object } from './wire.js'@@ -140,7 +140,7 @@ export function planSetup(input: { state: Json; policy: Policy; leadId: string;gridRows.add(id)rows[id] = { engine: 'claude', model: 'default', effort: 'default', gridModel: s.model, gridName: s.grid }// A Claude Code Builder drives it through the grid relay; an API answers four at once, a local engine one.- models.push({ id, engine: 'claude', cost: 1, quality: { default: policy.localModels?.quality ?? 1 },+ models.push({ id, engine: 'claude', cost: 1, quality: { default: gridQuality(policy, s.model, s.label) },concurrency: (s.kind === 'api' ? API_BUILDERS : 1) - s.holders.length, subscription: false, remote: s.kind === 'api' || s.kind === 'shared',family: s.model, label: `Claude on ${s.label} (${KIND_WORD[s.kind]})`, ...(s.machines ? { machines: [...s.machines].filter(m => pools.has(m)) } : {}) })}diff --git a/cli/src/superTabs/route.spec.ts b/cli/src/superTabs/route.spec.tsindex 5afe3e8be..7a03a1a35 100644--- a/cli/src/superTabs/route.spec.ts+++ b/cli/src/superTabs/route.spec.ts@@ -1,6 +1,6 @@// cli/src/superTabs/route.spec.tsimport { describe, expect, it } from 'vitest'-import { API_BUILDERS, LOCAL_NONE, breaks, choose, decide, floorFor, parseAssessment, quotaOf2, rateFor, recordOf, repoMatch, repositoryKey, type Assessment, type Commitment, type MemberFrame, type Policy, type Probe, type SwarmRule, type TaskFolder } from './route.js'+import { API_BUILDERS, LOCAL_NONE, breaks, choose, gridQuality, otherFamilyReviews, reviewRefusals, decide, floorFor, parseAssessment, quotaOf2, rateFor, recordOf, repoMatch, repositoryKey, type Assessment, type Commitment, type MemberFrame, type Policy, type Probe, type SwarmRule, type TaskFolder } from './route.js'const object = (v: unknown) => v as Record<string, unknown>@@ -58,6 +58,12 @@ describe('quota and rates', () => {expect(rateFor(policy, 'claude', 'opus', 'high')).toEqual({ quality: 3, cost: 3 })expect(rateFor(policy, 'claude', 'opus', 'max')).toEqual({ quality: 3, cost: 3 })expect(rateFor(policy, 'claude', null, null)).toEqual({ quality: 1, cost: 1 })+ // A model the policy does not name, a small Codex variant among them, is rated 1 (review of #2137); one launched on the+ // engine's own model takes the `default` row, whatever slug it reports.+ expect(rateFor(policy, 'codex', 'gpt-5.5-mini', 'high')).toEqual({ quality: 1, cost: 1 })+ expect(rateFor(policy, 'codex', 'gpt-6.1-sol', 'high', true)).toEqual({ quality: 3, cost: 2 })+ expect(rateFor(policy, 'codex', 'default', 'default')).toEqual({ quality: 3, cost: 2 })+ expect(rateFor(policy, 'claude', 'claude-opus-4-7', 'high', true)).toEqual({ quality: 3, cost: 3 })})})@@ -276,7 +282,12 @@ describe('edges', () => {it('rates default models, unknown models and unknown engines', () => {expect(rateFor(policy, 'codex', null, null)).toEqual({ quality: 3, cost: 2 })expect(rateFor(policy, 'claude', 'sonnet', null)).toEqual({ quality: 2, cost: 2 })- expect(rateFor(policy, 'codex', 'gpt-x', 'high')).toEqual({ quality: 3, cost: 2 })+ expect(rateFor(policy, 'codex', 'gpt-x', 'high')).toEqual({ quality: 1, cost: 1 })+ expect(rateFor(policy, 'codex', 'gpt-x', 'high', true)).toEqual({ quality: 3, cost: 2 })+ // A small model it reports is never promoted by its launch (review of ee4ee6c9a).+ expect(rateFor(policy, 'codex', 'gpt-5.5-mini', 'high', true)).toEqual({ quality: 1, cost: 1 })+ expect(rateFor(policy, 'codex', 'gpt-5-nano', 'high', true)).toEqual({ quality: 1, cost: 1 })+ expect(rateFor(policy, 'claude', null, null, true)).toEqual({ quality: 1, cost: 1 })expect(rateFor(policy, 'other', 'gpt-x', 'high')).toEqual({ quality: 1, cost: 1 })})it('rates a working member by the model its engine reported, not only by the catalog alias', () => {@@ -285,8 +296,9 @@ describe('edges', () => {expect(rateFor(policy, 'claude', 'claude-sonnet-4-5[1m]', 'medium')).toEqual({ quality: 2, cost: 2 })expect(rateFor(policy, 'claude', 'sonnet[1m]', null)).toEqual({ quality: 2, cost: 2 })expect(rateFor(policy, 'claude', 'claude-haiku-4-5', 'auto')).toEqual({ quality: 1, cost: 1 })- // Codex reports a real slug; its catalog row is `default`.- expect(rateFor(policy, 'codex', 'gpt-5.5', 'high')).toEqual({ quality: 3, cost: 2 })+ // Codex reports a real slug; its catalog row is `default`, for an agent launched on the engine's own model.+ expect(rateFor(policy, 'codex', 'gpt-5.5', 'high', true)).toEqual({ quality: 3, cost: 2 })+ expect(rateFor(policy, 'codex', 'gpt-5.5', 'high')).toEqual({ quality: 1, cost: 1 })// A model that matches nothing and an engine without a default row stay at the floor.expect(rateFor(policy, 'claude', 'claude-mystery-1', 'high')).toEqual({ quality: 1, cost: 1 })})@@ -603,6 +615,17 @@ describe('local models on the Swarm\'s grid', () => {expect(firstOf(choose([expiring, haiku, grid], policy, simple, NOW))).toBe('qwen3')expect(firstOf(choose([idle, grid], policy, simple, NOW, [], [{ rule: { kind: 'preferIdle' }, text: 'Idle first.' }]))).toBe('qwen3')})+ it('ranks a strong grid model first for medium docs, copy, tests, fixtures, a specified fix or a mechanical refactor (Ken, 2026-10-29)', () => {+ const kimi = local({ machineName: 'mac', quality: 2, gridModel: 'moonshotai/kimi-k3', gridLabel: 'Kimi K3' })+ for (const kind of ['docs', 'copy', 'tests', 'fixtures', 'fix', 'refactor']) {+ expect(firstOf(choose([expiring, kimi], policy, { ...simple, difficulty: 'medium', kind }, NOW))).toBe('moonshotai/kimi-k3')+ }+ // A small model stays under the medium floor, and other kinds keep the policy order.+ expect(firstOf(choose([expiring, grid], policy, { ...simple, difficulty: 'medium', kind: 'docs' }, NOW))).toBe('opus')+ expect(firstOf(choose([expiring, kimi], policy, { ...simple, difficulty: 'medium', kind: 'ui' }, NOW))).toBe('opus')+ expect(firstOf(choose([expiring, kimi], policy, { ...simple, difficulty: 'medium', kind: 'docs', risk: 'medium' }, NOW))).toBe('opus')+ expect(firstOf(choose([expiring, kimi], policy, { ...simple, difficulty: 'high', kind: 'docs' }, NOW))).toBe('opus')+ })it('keeps the policy order for anything harder, riskier or a review', () => {expect(firstOf(choose([expiring, haiku, grid], policy, { ...simple, risk: 'medium' }, NOW))).toBe('opus')expect(firstOf(choose([expiring, haiku, grid], policy, { ...simple, difficulty: 'medium' }, NOW))).toBe('opus')@@ -617,6 +640,37 @@ describe('local models on the Swarm\'s grid', () => {})})+ it('rates a grid model by the policy\'s first named row it matches, else its local quality, else 1', () => {+ const rows = { ...policy, localModels: { quality: 1, enabled: true, models: [{ model: 'kimi k3', quality: 2 }, { model: 'deepseek v4.1', quality: 3 }] } }+ expect(gridQuality(rows, 'moonshotai/kimi-k3')).toBe(2)+ expect(gridQuality(rows, 'ds-1017', 'DeepSeek V4.1 Flash')).toBe(3)+ expect(gridQuality(rows, 'qwen3:4b')).toBe(1)+ expect(gridQuality({ ...policy, localModels: { quality: 2, enabled: true } }, 'moonshotai/kimi-k3')).toBe(2)+ expect(gridQuality(policy, 'moonshotai/kimi-k3')).toBe(1)+ })+ it('never lets a grid model, a model below quality 2 or the reviewed Builder\'s own family review (Ken, 2026-10-29)', () => {+ const codex = { engine: 'codex' }+ expect(reviewRefusals(local({ quality: 2 }), codex, true)).toEqual(['A review never runs on a model served on the Swarm\'s grid.'])+ expect(reviewRefusals(probe({ model: 'haiku', quality: 1 }), codex, true)).toEqual(['A review needs a model of quality 2 or more, and Claude haiku is 1.'])+ expect(reviewRefusals(probe({ engine: 'codex', model: 'default', quality: 3 }), codex, true)).toEqual(['A review runs on another engine than the reviewed Builder\'s, Codex.'])+ // A Builder on a grid model is its own family: Claude reviews it, even though Claude Code drove it.+ expect(reviewRefusals(probe(), { engine: 'claude', gridModel: 'moonshotai/kimi-k3' }, true)).toEqual([])+ expect(reviewRefusals(probe(), { engine: 'claude' }, true)).toEqual(['A review runs on another engine than the reviewed Builder\'s, Claude.'])+ expect(reviewRefusals(probe(), null, true)).toEqual([])+ // Another engine counts only where the owner's rules let it run, at the effort a new agent starts at (review of ee4ee6c9a).+ const codexElsewhere = probe({ machineId: 'm2', engine: 'codex', model: 'default', effort: 'default', quality: 3 })+ const only = (machineIds: string[]) => [{ rule: { kind: 'machines', machineIds }, text: 'Only ours.' } as SwarmRule]+ expect(otherFamilyReviews([probe(), codexElsewhere], { engine: 'claude' }, [])).toBe(true)+ expect(otherFamilyReviews([probe(), codexElsewhere], { engine: 'claude' }, only(['m1']))).toBe(false)+ expect(otherFamilyReviews([probe(), codexElsewhere], { engine: 'claude' }, [{ rule: { kind: 'minEffort', effort: 'high' }, text: 'High.' }])).toBe(true)+ expect(otherFamilyReviews([probe(), probe({ engine: 'codex', model: 'gpt-5.5-mini', quality: 1 })], { engine: 'claude' }, [])).toBe(false)+ expect(otherFamilyReviews([codexElsewhere], null, [])).toBe(false)+ // With no Reviewer of another engine anywhere, the Builder's own engine reviews at its top tier only (Lead, 2026-10-29).+ expect(reviewRefusals(probe({ model: 'opus', quality: 3 }), { engine: 'claude' }, false)).toEqual([])+ expect(reviewRefusals(probe(), { engine: 'claude' }, false))+ .toEqual(['A review on the reviewed Builder\'s engine, Claude, needs its top tier (quality 3): no Reviewer on another engine can run in this Swarm.'])+ })+it('says why a named model the Swarm has is never offered to Builders, rather than to share it', () => {const llama = { model: 'llama3.2:3b', label: 'llama3.2:3b', kind: 'local' as const, holders: [],refused: 'llama3.2:3b is too small for a coding agent (about 3B parameters; Builders need 7B or more).' }diff --git a/cli/src/superTabs/route.ts b/cli/src/superTabs/route.tsindex faa3c0b05..7c63a259a 100644--- a/cli/src/superTabs/route.ts+++ b/cli/src/superTabs/route.ts@@ -25,8 +25,9 @@ export type Rule =export interface SwarmRule { rule: Rule; text: string }export interface PolicyModel { engine: 'claude' | 'codex'; model: string; effort: string; quality: number; cost: number; enabled: boolean }export interface Policy { version: 1; models: PolicyModel[]; floor: Record<Level, number>; quotaReserve: number; notes: string;- /** How strong a model served on the Swarm's grid counts; absent from a backend before it, which serves none. */- localModels?: { quality: number; enabled: boolean } }+ /** How strong a model served on the Swarm's grid counts ([gridQuality]); absent from a backend before it, which serves+ * none, and `models` from one before per-model rows. */+ localModels?: { quality: number; enabled: boolean; models?: Array<{ model: string; quality: number }> } }/** One usage window, named by the reader (`5-hour`, `weekly`); `leftPercent` is what remains of it. */export interface QuotaWindow { name: string | null; leftPercent: number; resetsAt: number | null }/** `leftPercent` and `resetsAt` are the tightest window's; `windows` is every window. `account` is the reading's hashed@@ -115,13 +116,19 @@ export function liftEffort(rules: SwarmRule[], engine: string, effort: string):/** The soft rules for this task: the engine preferred for its kind (a rule for the kind before one for every task),* whether idle agents come first, and whether a model on the Swarm's grid comes first. */interface Soft { engine: string | null; idle: boolean; grid: boolean }+/** Kinds of build a quality-2 grid model takes first at medium difficulty: docs, copy, tests, fixtures, a small specified fix,+ * a mechanical refactor. */+export const CHEAP_KINDS = ['docs', 'copy', 'tests', 'fixtures', 'fix', 'refactor']function softOf(rules: SwarmRule[], a: Assessment): Soft {const prefer = rules.flatMap(({ rule }) => rule.kind === 'preferEngine' ? [rule] : [])const engine = (prefer.find(r => a.kind && r.taskKind === a.kind) ?? prefer.find(r => r.taskKind === null))?.engine ?? null// Simple work goes to the free models first (roadmap, Dec: about 30% of work on cheaper models without lower quality).// A grid model counts as cost 1 like Haiku, so an expiring 5-hour window or an idle member ranked above it and it was// rarely picked. Reviews keep the other model family, and the owner can opt out.- const grid = a.difficulty === 'low' && a.risk === 'low' && a.kind !== 'review' && !rules.some(r => r.rule.kind === 'noGridFirst')+ // Since 2026-10-29 (Ken) also medium work of a kind a strong grid model does well, which steps up when it fails (backend+ // superTabs/stepUp.ts); the floor still keeps a small model off it.+ const simple = a.difficulty === 'low' || (a.difficulty === 'medium' && CHEAP_KINDS.includes(a.kind ?? ''))+ const grid = simple && a.risk === 'low' && a.kind !== 'review' && !rules.some(r => r.rule.kind === 'noGridFirst')return { engine, idle: rules.some(r => r.rule.kind === 'preferIdle'), grid }}@@ -201,19 +208,59 @@ export function repositoryKey(url: string): string | null {/** A member's model is what its engine reported after work: Claude's full id (`claude-opus-4-7`, `claude-sonnet-4-5[1m]`),* Codex's slug (`gpt-5.5`). The policy names Claude families and a Codex `default`, so the id is reduced to its family- * first, and an id with no row of its own takes the engine's `default` row before the floor. */-export function rateFor(policy: Policy, engine: string, model: string | null, effort: string | null): { quality: number; cost: number } {+ * first. An id with no row of its own takes the engine's `default` row only when the agent was launched on the engine's own+ * model ([engineDefault]); otherwise it is rated 1, so a small Codex variant is never taken for a strong one (review of+ * #2137; backend superTabs/rules.ts policyQuality). */+export function rateFor(policy: Policy, engine: string, model: string | null, effort: string | null, engineDefault = false): { quality: number; cost: number } {const name = engine === 'claude' && model ? claudeAliasForModel(model.replace(/\[1m\]$/i, '')) ?? model : model ?? 'default'- const row = policy.models.find(m => m.engine === engine && m.model === name && m.effort === (effort ?? 'default'))- ?? policy.models.find(m => m.engine === engine && m.model === name)- ?? policy.models.find(m => m.engine === engine && m.model === 'default')+ const rowOf = (named: string) => policy.models.find(m => m.engine === engine && m.model === named && m.effort === (effort ?? 'default'))+ ?? policy.models.find(m => m.engine === engine && m.model === named)+ // A small model it reports is never promoted by its launch (review of ee4ee6c9a).+ const row = rowOf(name) ?? (engineDefault && !SMALL.test(model ?? '') ? rowOf('default') : undefined)return row ? { quality: row.quality, cost: row.cost } : { quality: 1, cost: 1 }}+/** A small variant by its name: a mini or a nano (backend superTabs/rules.ts). */+const SMALL = /(^|[^a-z0-9])(mini|nano)([^a-z0-9]|$)/i++/** What a reviewed Builder ran: its engine, and the grid model its engine drove. */+export interface Reviewed { engine: string; gridModel?: string }+/** A model family: a grid model's own, else its engine's. */+const familyOf = (t: Reviewed) => t.gridModel ? `grid:${t.gridModel}` : t.engine+/** Why [p] may not review (Ken, 2026-10-29: a small model never reviews again): a model served on the Swarm's grid, one rated+ * below 2, or the reviewed Builder's own model family while a strong Reviewer of another family can run here ([otherFamily]).+ * With none, the Builder's own engine at its top tier (Lead, 2026-10-29). The server judges the same (backend+ * superTabs/rules.ts reviewRefusal). */+export function reviewRefusals(p: Probe, builder: Reviewed | null, otherFamily: boolean): string[] {+ if (p.gridModel) return ['A review never runs on a model served on the Swarm\'s grid.']+ if (p.quality < 2) return [`A review needs a model of quality 2 or more, and ${ENGINE[p.engine]} ${p.model} is ${p.quality}.`]+ if (!builder || familyOf(builder) !== familyOf(p)) return []+ if (otherFamily) return [`A review runs on another engine than the reviewed Builder's, ${ENGINE[p.engine]}.`]+ return p.quality < 3 ? [`A review on the reviewed Builder's engine, ${ENGINE[p.engine]}, needs its top tier (quality 3): no Reviewer on another engine can run in this Swarm.`] : []+}+/** Whether a strong Reviewer of another family than [builder]'s can run: a candidate off the grid, rated 2 or more, of+ * another family, that the owner's [rules] let run at the effort it would start at. Busy, offline or short of quota it+ * still counts, within its start window; the caller leaves out the machines the task or its access rules out (review of+ * ee4ee6c9a: an engine the owner ruled out blocked the fallback). */+export const otherFamilyReviews = (probes: Probe[], builder: Reviewed | null, rules: SwarmRule[]) =>+ !!builder && probes.some(p => !p.gridModel && p.quality >= 2 && familyOf(p) !== familyOf(builder) && !breaks(rules, lifted(rules, p)))++/** A task that stepped up from a cheaper model takes no grid model and nothing below the step's floor; the server refuses+ * the same (backend superTabs/stepUp.ts stepUpRefusal). */+export function stepUpRefusals(p: Probe, step: { floor: number } | null): string[] {+ return step && (p.gridModel || p.quality < step.floor)+ ? [`This task stepped up from a cheaper model: it runs on no model on the grid and nothing below quality ${step.floor}.`] : []+}export const KIND_WORD = { local: 'local', api: 'API', shared: 'shared' } as constconst runs = (p: Probe) => p.gridModel ? `${ENGINE[p.engine]} on ${p.gridLabel ?? p.gridModel} (${KIND_WORD[p.gridKind ?? 'local']})` : `${ENGINE[p.engine]} ${p.model} ${p.effort}`/** A name's words for matching: lowercase letters and digits, "4.1" read as "41". */const words = (text: string) => text.toLowerCase().split(/[^a-z0-9.]+/).map(w => w.replace(/\./g, '')).filter(Boolean)+/** How strong a grid model counts: the first of the policy's named rows whose every word is in its id or label (Kimi K3+ * and DeepSeek v4.1 at 2 by default, backend superTabs/routingPolicy.ts gridQuality), else the policy's local quality. */+export function gridQuality(policy: Policy, model: string, label = ''): number {+ const name = words(`${model} ${label}`).join('')+ return policy.localModels?.models?.find(row => words(row.model).every(w => name.includes(w)))?.quality ?? policy.localModels?.quality ?? 1+}/** Whether [p] runs the model a person named: every word of theirs is in its model's name. */function runsNamed(p: Probe, named: string): boolean {const name = words([p.gridModel ?? p.model, p.gridLabel ?? '', ENGINE[p.engine]].join(' ')).join('')diff --git a/cli/src/superTabs/routeCommand.spec.ts b/cli/src/superTabs/routeCommand.spec.tsindex 2b2d0d5e7..3f7b411de 100644--- a/cli/src/superTabs/routeCommand.spec.ts+++ b/cli/src/superTabs/routeCommand.spec.ts@@ -3,7 +3,7 @@ import type { openDaemon } from '../agentClient/daemon.js'import { mkdtemp, rm, writeFile } from 'node:fs/promises'import { tmpdir } from 'node:os'import { join } from 'node:path'-import { heldLocalModels, localProbes, routeTask } from './routeCommand.js'+import { heldLocalModels, localProbes, offlineModels, routeTask } from './routeCommand.js'import type { describeScmProject } from '../scm/scmProjects.js'import { admission, quotaOf } from './capacity.js'import type { Assessment, Policy, Probe } from './route.js'@@ -243,6 +243,51 @@ describe('routeTask', () => {expect(fresh.next).toContain('"name":"Reviewer","role":"reviewer"')expect((await offered(false, false)).next).not.toContain('"role"')})+ it('leaves out of a review the reviewed Builder\'s engine while another engine can review, and says why', async () => {+ const t = tab(); t.state.agents = agents.map(a => a.id === 'a1' ? { ...a, role: 'reviewer' } : a)+ t.state.conversations.push({ id: 'g0', title: 'Built', leadId: 'lead', agentIds: ['lead'], archived: false, brief: '', checks: [],+ assignment: { id: 'b', agentId: 'gone', status: 'review', configuration: { engine: 'claude' } } } as never)+ Object.assign(t.state.conversations[1]!, { reviewOf: 'g0' })+ // Codex is on in the policy, so a Codex Reviewer can run.+ const both = { ...policy, models: policy.models.map(m => ({ ...m, enabled: true })) }+ const context = { ok: true, value: { agentId: 'lead', tab: t, policy: { policy: both, warnings: [] }, machines: [{ machineId: 'm1', name: 'remote-1' }] } }+ const twoEngines = await routeTask(input, scoped({ context }), where as never, opener(id => daemon(id, { agents: ['h1'],+ engines: [{ engine: 'claude', installed: true, signedIn: true }, { engine: 'codex', installed: true, signedIn: true }] })), () => 'op')+ expect(twoEngines).toMatchObject({ ok: true, pick: { engine: 'codex' } })+ // A Claude-only Swarm reviews a Claude Builder's work on its top tier alone.+ const s = scoped({ tab: t })+ expect(await routeTask(input, s, where as never, opener(), () => 'op')).toMatchObject({ ok: true, pick: { kind: 'new', engine: 'claude', model: 'opus' } })+ expect(recorded(s).command.decision.excluded).toEqual(expect.arrayContaining([{ title: 'Multiply · Claude sonnet medium · remote-1',+ reason: 'A review on the reviewed Builder\'s engine, Claude, needs its top tier (quality 3): no Reviewer on another engine can run in this Swarm.' }]))+ // A Builder still in the Swarm is read from its agent: on a grid model, Claude may review it.+ t.state.agents.push({ id: 'b1', name: 'Kimi', machineId: 'm1', harnessId: 'hb', configuration: { engine: 'claude', model: 'default', effort: 'default' }, gridModel: 'moonshotai/kimi-k3' } as never)+ Object.assign(t.state.conversations[2]!, { assignment: { id: 'b', agentId: 'b1', status: 'review' } })+ expect(await routeTask(input, scoped({ tab: t }), where as never, opener(), () => 'op')).toMatchObject({ ok: true, pick: { kind: 'member', agentId: 'a1' } })+ // Nothing reviewed yet, nothing to keep apart.+ Object.assign(t.state.conversations[2]!, { assignment: null })+ expect(await routeTask(input, scoped({ tab: t }), where as never, opener(), () => 'op')).toMatchObject({ ok: true })+ })+ it('lets the Builder\'s engine review at its top tier when the only other engine is on a machine the task may not use', async () => {+ const pool = (machineId: string, engines: string[], patch: Record<string, unknown> = {}) => ({ machineId, name: machineId, cwd: '/w', engines, paused: false, contributorId: 'owner',+ observation: { receivedAt: Date.now(), resources: { memoryTotalBytes: 32e9, memoryUsedBytes: 2e9, projectDiskFreeBytes: 200e9 }, tools: { git: true }, runningHarnessIds: [],+ quotas: engines.map(engine => ({ engine, known: true, windows: [{ name: '5-hour', usedPercent: 20, resetsAt: Date.now() + 3600000 }, { name: 'weekly', usedPercent: 10, resetsAt: Date.now() + 5 * 86400000 }] })) }, ...patch })+ const both = { ...policy, models: policy.models.map(m => ({ ...m, enabled: true })) }+ const routeWith = async (codexBox: Record<string, unknown>, requires?: string[]) => {+ const t = tab(); t.state.agents = [agents[1]] as never+ t.state.conversations.push({ id: 'g0', title: 'Built', leadId: 'lead', agentIds: ['lead'], archived: false, brief: '', checks: [],+ assignment: { id: 'b', agentId: 'gone', status: 'review', configuration: { engine: 'claude' } } } as never)+ Object.assign(t.state.conversations[1]!, { reviewOf: 'g0', ...requires ? { task: { goal: 'g', changes: 'c', constraints: 'k', owns: [], requires: { machines: requires } } } : {} })+ Object.assign(t.state, { machines: [pool('m1', ['claude']), codexBox] })+ const s = scoped({ context: { ok: true, value: { agentId: 'lead', tab: t, policy: { policy: both, warnings: [] }, machines: [] } } })+ return routeTask(input, s, where as never, opener(), () => 'op')+ }+ // Codex on m2 reviews, so Claude may not.+ expect(await routeWith(pool('m2', ['codex']))).toMatchObject({ ok: true, pick: { engine: 'codex', machineId: 'm2' } })+ // The task runs only on m1, or m2 may not take a teammate's project: Claude reviews at its top tier on m1.+ expect(await routeWith(pool('m2', ['codex']), ['m1'])).toMatchObject({ ok: true, pick: { engine: 'claude', model: 'opus', machineId: 'm1' } })+ expect(await routeWith(pool('m2', ['codex'], { contributorId: 'mate', teamWork: { allowed: false, code: 'TEAM_ACCOUNT_REQUIRED', reason: 'Not a Team machine.' } })))+ .toMatchObject({ ok: true, pick: { engine: 'claude', model: 'opus', machineId: 'm1' } })+ })it('tells the Lead how to assign a member or start a new agent with the decision', async () => {const member = await routeTask(input, scoped(), where as never, opener(), () => 'op')// Cheapest first: the member on sonnet.@@ -432,13 +477,18 @@ describe('routeTask', () => {{ id: 'a1', name: 'Opus hand', machineId: 'm1', harnessId: 'h1', configuration: { engine: 'claude', model: 'claude-opus-4-7', effort: 'high' } },{ id: 'a3', name: 'Sonnet hand', machineId: 'm1', harnessId: 'h3', configuration: { engine: 'claude', model: 'claude-sonnet-4-5[1m]', effort: 'medium' } },{ id: 'a4', name: 'Codex hand', machineId: 'm1', harnessId: 'h4', configuration: { engine: 'codex', model: 'gpt-5.5', effort: 'high' } },+ { id: 'a5', name: 'Mini hand', machineId: 'm1', harnessId: 'h5', configuration: { engine: 'codex', model: 'gpt-5.5-mini', effort: 'high' } },agents[1]] as never+ // Codex hand was launched on the engine's own model, which it reports by its slug; Mini hand was launched on a model the+ // policy does not name (review of #2137).+ Object.assign(working.state, { starts: [{ harnessId: 'h4', request: { model: 'default' } }, { harnessId: 'h5', request: { model: 'gpt-5.5-mini' } }] })const s = scoped({ tab: working })- const open = opener(id => daemon(id, { agents: id === 'm1' ? ['h1', 'h3', 'h4'] : [], usage: { providers: [] }, engines: [{ engine: 'claude', installed: true, signedIn: true }, { engine: 'codex', installed: true, signedIn: true }] }))- await routeTask(input, s, where as never, open)+ const open = opener(id => daemon(id, { agents: id === 'm1' ? ['h1', 'h3', 'h4', 'h5'] : [], usage: { providers: [] }, engines: [{ engine: 'claude', installed: true, signedIn: true }, { engine: 'codex', installed: true, signedIn: true }] }))+ // Low work, so a model rated 1 is shown too.+ await routeTask({ ...input, assessment: { ...input.assessment, difficulty: 'low' } }, s, where as never, open)const rated = Object.fromEntries((recorded(s).command.decision.candidates as Array<{ title: string; quality: number; cost: number }>).filter(c => /hand/.test(c.title)).map(c => [c.title.split(' · ')[0], [c.quality, c.cost]]))- expect(rated).toEqual({ 'Opus hand': [3, 3], 'Sonnet hand': [2, 2], 'Codex hand': [3, 2] })+ expect(rated).toEqual({ 'Opus hand': [3, 3], 'Sonnet hand': [2, 2], 'Codex hand': [3, 2], 'Mini hand': [1, 1] })})it('counts the quota open picks hold on the same account, and tells the Lead when nobody is expected to cover the task', async () => {const pick = { conversationId: 'g1', title: 'Pick', outcome: null, assignmentId: 'as1', createdAt: new Date().toISOString(), final: { kind: 'new', engine: 'claude', model: 'opus' } }@@ -1199,6 +1249,13 @@ describe('local models on the Swarm\'s grid', () => {const unnamed = state({ machines: [served([{ grid: GRID, model: 'qwen3' }])] })expect(offered(unnamed)[0]).toMatchObject({ quality: 1, gridLabel: 'qwen3' })})+ it('rates each served model by the policy\'s named rows: Kimi K3 and DeepSeek v4.1 at 2, a small Qwen at the local quality', () => {+ const models = [{ model: 'kimi k3', quality: 2 }, { model: 'deepseek v4.1', quality: 2 }]+ const three = state({ machines: [served([{ grid: GRID, model: 'moonshotai/kimi-k3', kind: 'api' }, { grid: GRID, model: 'deepseek/deepseek-v4.1-flash-1017', kind: 'api' },+ { grid: GRID, model: 'qwen3:4b', name: 'Qwen 3 4B' }])] })+ const rows = offered(three, { policy: { ...routing, localModels: { quality: 1, enabled: true, models } } })+ expect(rows.map(r => [r.gridModel, r.quality])).toEqual([['moonshotai/kimi-k3', 2], ['deepseek/deepseek-v4.1-flash-1017', 2], ['qwen3:4b', 1]])+ })it('offers nothing with the add-on off, for a review, or when the owner turned local models off and nobody asked for one', () => {expect(offered(state({ localModels: undefined }))).toEqual([])expect(offered(state({ localModels: { grid: GRID, enabled: false } }))).toEqual([])@@ -1270,6 +1327,43 @@ describe('local models on the Swarm\'s grid', () => {{ model: 'tiny', label: 'Tiny 1B', kind: 'local', holders: [], refused: 'small' },])})+ it('leaves out a model whose host is offline, with that reason, unless another host serves it', async () => {+ const t = tab(); Object.assign(t.state, { localModels: { grid: GRID, enabled: true }, machines: [+ { machineId: 'm1', name: 'remote-1', observation: { receivedAt: Date.now(), localModels: [{ grid: GRID, model: 'deepseek/deepseek-v4.1', kind: 'api' }] } },+ { machineId: 'rig', name: '2x 4090 Rig', observation: { receivedAt: Date.now() - 10 * 60_000, localModels: [{ grid: GRID, model: 'moonshotai/kimi-k3', name: 'Kimi K3' },+ { grid: GRID, model: 'deepseek/deepseek-v4.1', kind: 'api' }, { grid: GRID, model: 'starting', starting: true }, { grid: 7, model: 'odd' }] } },+ { machineId: 'old', observation: { receivedAt: 'never', localModels: [{ grid: GRID, model: 'unnamed-host' }] } }] })+ const s = scoped({ tab: t })+ const result = await routeTask({ ...input, assessment: { ...input.assessment, difficulty: 'low' } }, s, where as never, opener(), () => 'op')+ const excluded = recorded(s).command.decision.excluded as Array<{ title: string; reason: string }>+ expect(excluded.filter(e => /offline/.test(e.reason))).toEqual([+ { title: 'Kimi K3', reason: 'Its host 2x 4090 Rig is offline, so a Builder on it would never start.' },+ { title: 'unnamed-host', reason: 'Its host, a machine of this Swarm, is offline, so a Builder on it would never start.' },+ ])+ expect(result).toMatchObject({ ok: true, pick: { gridModel: 'deepseek/deepseek-v4.1' } })+ // Nothing offline is said for a review, which never runs on the grid, or with the add-on off.+ Object.assign(t.state.conversations[1]!, { reviewOf: 'lead' })+ const review = scoped({ tab: t })+ await routeTask(input, review, where as never, opener(), () => 'op')+ expect(JSON.stringify(recorded(review).command.decision.excluded)).not.toContain('offline, so a Builder')+ const off = { ...routing, localModels: { quality: 1, enabled: false } }+ expect(offlineModels(t.state, off, assessment, false)).toEqual([])+ expect(offlineModels(t.state, off, { ...assessment, local: true }, false)).toHaveLength(2)+ expect(offlineModels({ ...t.state, localModels: { grid: GRID, enabled: false } }, routing, assessment, false)).toEqual([])+ expect(offlineModels({ ...t.state, localModels: undefined }, routing, assessment, false)).toEqual([])+ })+ it('leaves the grid and anything under its floor out of a task that stepped up, and says why', async () => {+ const t = tab(); Object.assign(t.state, { localModels: { grid: GRID, enabled: true },+ machines: [{ machineId: 'm1', observation: { receivedAt: Date.now(), localModels: [{ grid: GRID, model: 'moonshotai/kimi-k3', kind: 'api' }] } }] })+ Object.assign(t.state.conversations[1]!, { stepUp: { attempt: 3, floor: 3, reason: 'Its first review said Ready no.', at: 1, carry: '' } })+ const s = scoped({ tab: t })+ const result = await routeTask({ ...input, assessment: { ...input.assessment, difficulty: 'low', kind: 'docs' } }, s, where as never, opener(), () => 'op')+ expect(result).toMatchObject({ ok: true, pick: { model: 'opus' } })+ const why = 'This task stepped up from a cheaper model: it runs on no model on the grid and nothing below quality 3.'+ const excluded = recorded(s).command.decision.excluded as Array<{ title: string; reason: string }>+ expect(excluded.filter(e => e.reason.includes(why)).map(e => e.title)).toEqual([expect.stringMatching(/^Multiply · Claude sonnet/),+ expect.stringMatching(/^New agent · Claude sonnet/), expect.stringMatching(/^New agent · Claude on moonshotai\/kimi-k3/)])+ })it('routes a low task to a served model and starts it on the grid, with no subscription model', async () => {const t = tab(); Object.assign(t.state, { localModels: { grid: GRID, enabled: true },machines: [{ machineId: 'm1', observation: { receivedAt: Date.now(), localModels: [{ grid: GRID, model: 'qwen3', name: 'Qwen 3' }] } }] })diff --git a/cli/src/superTabs/routeCommand.ts b/cli/src/superTabs/routeCommand.tsindex 6137e0cf4..2c32c4c9d 100644--- a/cli/src/superTabs/routeCommand.ts+++ b/cli/src/superTabs/routeCommand.ts@@ -7,7 +7,7 @@ import { openDaemon, type Daemon, type Where } from '../agentClient/daemon.js'import { requiredToolReason, startRequirements } from './capacity.js'import { inspectCapacity, type ScopedRequest } from './start.js'import { ENDED_WORK, object, within } from './wire.js'-import { accountOf, API_BUILDERS, choose, decide, parseAssessment, quotaOf2, rateFor, recordOf, repoMatch, repositoryKey, type Assessment, type RecordShape, type Commitment, type HeldModel, type MemberFrame, type Policy, type Probe, type SwarmRule, type TaskFolder } from './route.js'+import { accountOf, API_BUILDERS, choose, decide, gridQuality, parseAssessment, quotaOf2, rateFor, recordOf, otherFamilyReviews, repoMatch, repositoryKey, reviewRefusals, stepUpRefusals, type Assessment, type Reviewed, type RecordShape, type Commitment, type HeldModel, type MemberFrame, type Policy, type Probe, type SwarmRule, type TaskFolder } from './route.js'import { stat } from 'node:fs/promises'import { describeScmProject } from '../scm/scmProjects.js'@@ -111,9 +111,12 @@ const text = (value: unknown) => typeof value === 'string' ? value : null* does report is kept. */function withLaunchEffort(member: Json, starts: Json[]): Json {const configuration = object(member.configuration)- if (configuration.effort && configuration.effort !== 'auto') return member- const launched = object(starts.find(s => s.harnessId === member.harnessId)?.request).effort- return typeof launched === 'string' && launched !== 'default' ? { ...member, configuration: { ...configuration, effort: launched } } : member+ const start = starts.find(s => s.harnessId === member.harnessId)+ // Launched on the engine's own model: rated by the policy's `default` row, whatever slug it reports (route.ts rateFor).+ const engineDefault = start && (object(start.request).model ?? 'default') === 'default' ? { engineDefault: true } : {}+ if (configuration.effort && configuration.effort !== 'auto') return { ...member, ...engineDefault }+ const launched = object(start?.request).effort+ return typeof launched === 'string' && launched !== 'default' ? { ...member, ...engineDefault, configuration: { ...configuration, effort: launched } } : { ...member, ...engineDefault }}const finite = (value: unknown): value is number => typeof value === 'number' && Number.isFinite(value)@@ -281,8 +284,14 @@ export async function routeTask(input: { tabId: string; conversationId: string;const devices = object(object(start?.request).requirements).devicesreturn required.devices.every(d => Array.isArray(devices) && devices.includes(d))}+ const builder = review ? reviewedBuilder(conversations.find(c => c.id === group.reviewOf), agents) : null+ // Another engine counts only on a machine the task may run on, and that its access lets take this project's work.+ const teamRefused = (p: Probe) => { const why = machines.get(p.machineId)?.pool?.teammatesRefused; return typeof why === 'string' && p.refusals.includes(why) }+ const otherFamily = otherFamilyReviews(probes.filter(p => !outside(p.machineId) && !teamRefused(p)), builder, rules)+ const step = finite(object(group.stepUp).floor) ? { floor: object(group.stepUp).floor as number } : nullfor (const [i, p] of probes.entries()) {- const refusals = [...(outside(p.machineId) ? [ELSEWHERE] : []), ...(p.kind === 'member' && !checked(p.agentId) ? [UNCHECKED_DEVICE] : [])]+ const refusals = [...(outside(p.machineId) ? [ELSEWHERE] : []), ...(p.kind === 'member' && !checked(p.agentId) ? [UNCHECKED_DEVICE] : []),+ ...(review ? reviewRefusals(p, builder, otherFamily) : []), ...stepUpRefusals(p, step)]if (refusals.length) probes[i] = { ...p, refusals: [...p.refusals, ...refusals] }}// Picks started or assigned and still at work hold part of their account's quota; the log, and so this, is per Swarm.@@ -296,6 +305,7 @@ export async function routeTask(input: { tabId: string; conversationId: string;const avoid = failedOn && failedEngine ? [...new Set([`${failedOn}:${failedEngine}`,...probes.filter(p => p.machineId === failedOn && p.engine === failedEngine && !p.gridModel).map(accountOf)])] : []const choice = choose(probes, policy, assessment, Date.now(), working, rules, heldLocalModels(state), avoid)+ choice.excluded.push(...offlineModels(state, policy, assessment, review))// The task stays in the Lead's queue rather than going where it cannot be done.if ('error' in choice) return required.machines || required.devices.length ? { ...choice, waiting: true, detail: WAITING } : choiceconst verdict = decide(choice)@@ -329,6 +339,16 @@ export async function routeTask(input: { tabId: string; conversationId: string;}}+/** What the reviewed group's last attempt ran on: its agent's engine and grid model while it is here, else its assignment's+ * engine. Null before any attempt. */+function reviewedBuilder(reviewed: Json | undefined, agents: Json[]): Reviewed | null {+ const assignment = object(reviewed?.assignment)+ if (!assignment.id) return null+ const agent = agents.find(a => a.id === assignment.agentId)+ const gridModel = text(agent?.gridModel)+ return { engine: String(object(agent?.configuration ?? assignment.configuration).engine), ...(gridModel ? { gridModel } : {}) }+}+/** The next two rows, and the best row of every other machine, so the Lead can choose another machine with an overrideReason. */function alternativesTo<T extends { id: string; machineId: string }>(pick: T, shown: T[]): T[] {const seen = new Set([pick.machineId])@@ -405,12 +425,31 @@ export function localProbes(state: Json, policy: Policy, probes: Probe[], a: Ass// One base per machine and engine: the first new-agent row the policy offers there, which carries the machine's refusals.const bases = new Map<string, Probe>()for (const p of probes) if (p.kind === 'new' && !p.gridModel && !bases.has(`${p.machineId}\0${p.engine}`)) bases.set(`${p.machineId}\0${p.engine}`, p)- const quality = policy.localModels?.quality ?? 1return [...bases.values()].flatMap(base => [...served.values()].filter(m => !m.machines || m.machines.has(base.machineId))- .map((m): Probe => ({ ...base, model: 'default', effort: 'default', quality, cost: 1, quota: UNKNOWN_QUOTA, known: true,+ .map((m): Probe => ({ ...base, model: 'default', effort: 'default', quality: gridQuality(policy, m.model, m.label), cost: 1, quota: UNKNOWN_QUOTA, known: true,refusals: base.refusals.filter(r => !SUBSCRIPTION.test(r)), gridModel: m.model, gridName: m.grid, gridLabel: m.label, gridKind: m.kind })))}+/** The models a machine served for the Swarm when it last reported, while it is offline now and no other machine serves them:+ * left out with that reason, so no Builder is sent to a dead host (Kimi K3 on a 4090 rig, offered 15 times and never run,+ * 2026-10-29). Only where [localProbes] would offer them. */+export function offlineModels(state: Json, policy: Policy, a: Assessment, review: boolean, now: number = Date.now()): Array<{ title: string; reason: string }> {+ const addOn = object(state.localModels)+ if (addOn.enabled !== true || typeof addOn.grid !== 'string' || review || (policy.localModels?.enabled === false && !a.local)) return []+ const served = servedModels(state, addOn.grid, now), out: Array<{ title: string; reason: string }> = []+ for (const machine of list(state.machines)) {+ const observed = object(machine.observation)+ if (finite(observed.receivedAt) && now - observed.receivedAt <= LOCAL_FRESH_MS) continue+ const host = text(machine.name)+ for (const l of list(observed.localModels)) {+ if (typeof l.grid !== 'string' || typeof l.model !== 'string' || l.starting === true || served.has(`${l.grid}\0${l.model}`)) continue+ const title = text(l.name) ?? l.model+ if (!out.some(o => o.title === title)) out.push({ title, reason: `Its host${host ? ` ${host}` : ', a machine of this Swarm,'} is offline, so a Builder on it would never start.` })+ }+ }+ return out+}+async function probeMachine(machineId: string, { name: machineName, status, account, pool, folded, unready = READY, stalled: stuck = false }: { name: string; status: string; account: boolean; pool?: Json; folded?: boolean; unready?: Unready; stalled?: boolean },members: Json[], allModels: Policy['models'], policy: Policy, a: Assessment, where: Where, open: typeof openDaemon): Promise<Probe[]> {const listedEngines = Array.isArray(pool?.engines) ? pool.engines.filter((engine): engine is string => typeof engine === 'string') : []@@ -423,7 +462,7 @@ async function probeMachine(machineId: string, { name: machineName, status, accoconst c = object(m.configuration), engine = String(c.engine) as 'claude' | 'codex'const model = typeof c.model === 'string' ? c.model : null, effort = typeof c.effort === 'string' ? c.effort : nullreturn { kind: 'member', agentId: String(m.id), name: String(m.name ?? 'Member'), machineId, machineName, engine,- model: model ?? 'default', effort: effort ?? 'default', ...rateFor(policy, engine, model, effort),+ model: model ?? 'default', effort: effort ?? 'default', ...rateFor(policy, engine, model, effort, m.engineDefault === true),quota, activity: 'idle', known: quota.known, refusals, frame, terminalUnverified }}const newProbe = (m: Policy['models'][number], refusals: string[], quota: Probe['quota'], known: boolean, load: Probe['load'] = UNKNOWN_LOAD): Probe => ({diff --git a/cli/src/superTabs/service.spec.ts b/cli/src/superTabs/service.spec.tsindex 8e9d5b3d0..5f2947690 100644--- a/cli/src/superTabs/service.spec.ts+++ b/cli/src/superTabs/service.spec.ts@@ -5,6 +5,7 @@ import { dirname, join } from 'node:path'import { describe, expect, it, vi } from 'vitest'import { fakeCore } from '../testing/fakeCore.js'import type { CoreApi } from '../core/api.js'+import type { SaidOnCard } from './cards.js'import { sharedSwarm, superTabService } from './service.js'import { object } from './wire.js'import { hostForm, swarmReply } from './fixtures/read/index.js'@@ -767,7 +768,7 @@ it('documents finished worker decisions and explains an older backend without redescribe('the Swarm cards the devices ask for', () => {function withCards() {- const cards = { want: vi.fn(), open: vi.fn(), say: vi.fn(async () => true), worker: vi.fn((machineId: string, harnessId: string) => machineId === 'm2' && harnessId === 'h-r1'), recap: vi.fn(async (tabId: string, leadId: string) => ({ tabId, leadId, text: 'Shipped', at: 5, none: false })), onCards: undefined as unknown, onRecap: undefined as unknown }+ const cards = { want: vi.fn(), open: vi.fn(), side: vi.fn(), say: vi.fn(async (): Promise<SaidOnCard> => ({ said: true })), worker: vi.fn((machineId: string, harnessId: string) => machineId === 'm2' && harnessId === 'h-r1'), recap: vi.fn(async (tabId: string, leadId: string) => ({ tabId, leadId, text: 'Shipped', at: 5, none: false })), onCards: undefined as unknown, onRecap: undefined as unknown }const superTabs = { attention: vi.fn(), cards: vi.fn(), cardRecap: vi.fn(), shareObservers: vi.fn(), screen: vi.fn(), input: vi.fn(), inputIfScreen: vi.fn() }const core = fakeCore({ superTabs })const make = vi.fn(() => cards as never)@@ -830,6 +831,38 @@ describe('the Swarm cards the devices ask for', () => {await t.ask({ action: 'cardSay', harnessId: 'h1', text: 'ship it' }, owner)expect(t.cards.say).toHaveBeenLastCalledWith('h1', 'ship it', false)})+ it('cardSide sets a swarmBuddy dial\'s side, and the buddy flag reaches recap, open and say', async () => {+ const t = withCards()+ expect(await t.ask({ action: 'cardSide', tabId: 't1', side: 'buddy' }, owner)).toEqual({ ok: true })+ expect(t.cards.side).toHaveBeenLastCalledWith('t1', 'buddy')+ expect(await t.ask({ action: 'cardSide', tabId: 't1', side: 'pm' }, owner)).toEqual({ ok: true })+ expect(t.cards.side).toHaveBeenLastCalledWith('t1', 'pm')+ for (const bad of [{ tabId: 'bad id', side: 'pm' }, { tabId: 'x'.repeat(48), side: 'pm' }, { tabId: 't1', side: 'up' }, { tabId: 't1' }]) {+ expect(await t.ask({ action: 'cardSide', ...bad }, owner)).toEqual({ error: 'INVALID_REQUEST' })+ }+ // Only this computer's own devices set it.+ expect(await t.ask({ action: 'cardSide', tabId: 't1', side: 'buddy' }, visitor)).toEqual({ error: 'OWNER_REQUIRED' })+ expect(t.cards.side).toHaveBeenCalledTimes(2)+ await t.ask({ action: 'cardRecap', tabId: 't1', leadId: 'l1', chat: 'buddy' }, owner)+ expect(t.cards.recap).toHaveBeenLastCalledWith('t1', 'l1', 'buddy')+ await t.ask({ action: 'cardOpen', session: 's1', tabId: 't1', leadId: 'l1', chat: 'buddy' }, owner)+ expect(t.cards.open).toHaveBeenLastCalledWith('s1', 't1', 'l1', 'buddy')+ await t.ask({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy' }, owner)+ expect(t.cards.say).toHaveBeenLastCalledWith('h1', 'ship it', 'buddy')+ // The chat the words were spoken to rides with them; one that is not an id is none.+ await t.ask({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy', chatId: 'pm1' }, owner)+ expect(t.cards.say).toHaveBeenLastCalledWith('h1', 'ship it', 'buddy', 'pm1')+ await t.ask({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: 'buddy', chatId: 'bad id' }, owner)+ expect(t.cards.say).toHaveBeenLastCalledWith('h1', 'ship it', 'buddy')+ })+ it('cardSay passes a refused post\'s code and message on, and says nothing of a refusal otherwise', async () => {+ const t = withCards()+ t.cards.say.mockResolvedValueOnce({ said: false, refused: { code: 'PM_CHAT_READ_ONLY', message: 'Chat with PM is read-only.' } })+ expect(await t.ask({ action: 'cardSay', harnessId: 'h1', text: 'ship it', chat: true }, owner))+ .toEqual({ ok: true, said: false, refused: { code: 'PM_CHAT_READ_ONLY', message: 'Chat with PM is read-only.' } })+ t.cards.say.mockResolvedValueOnce({ said: false })+ expect(await t.ask({ action: 'cardSay', harnessId: 'h1', text: 'ship it' }, owner)).toEqual({ ok: true, said: false })+ })it('cardWorker says whether a machine\'s harness is one of a Swarm\'s workers, for the devices to keep its failure quiet', async () => {const t = withCards()expect(await t.ask({ action: 'cardWorker', machineId: 'm2', harnessId: 'h-r1' }, owner)).toEqual({ ok: true, worker: true })diff --git a/cli/src/superTabs/service.ts b/cli/src/superTabs/service.tsindex 02453787d..35a863654 100644--- a/cli/src/superTabs/service.ts+++ b/cli/src/superTabs/service.ts@@ -13,7 +13,7 @@ import { START_REQUIREMENTS } from './capacity.js'import { CapacityReservations, type ReservationBook } from './reservations.js'import { ContributionPreparations, ownerRequest, prepareContribution, setMachineAgents } from './contribution.js'import { messageIdOf } from './attach.js'-import { cardId, SwarmCards } from './cards.js'+import { cardId, SwarmCards, type CardChat } from './cards.js'import { GitHubTokenRefresher, githubToken } from './github.js'import { teamEngineReporter, type TeamEngineReporter } from '../team/engines.js'import { AUTO_SETUP_REASONS, realTeamAutoSetup, type AutoSetupReason, type TeamAutoSetup } from '../team/autoSetup.js'@@ -54,7 +54,7 @@ const HELP = {messages: 'messages GROUP: read recent messages in a conversation, thread replies included: each names its thread, the root message it answers there. A post with --reply-to lands in that message\'s thread.',message: 'message GROUP MESSAGE_ID: read one exact message, including an earlier question or result referenced by a reply.',decisions: 'decisions [--answered]: the decisions you asked of people, still open, or with --answered those answered (each with its choice and note). A Lead also sees those asked in its project. When your work needs a person to decide, ask through work.status needs_human with ask: the question as its result, 2 to 5 options, the one you recommend and what the answer unblocks. Keep working on your recommendation, marked provisional, until a notice in that conversation says it was answered; then read the answer here with --answered. The notice carries none of the answer. A decision is not a private channel: to tell one person something directly, a Lead sends person.tell; it lands in their Buddy chat, which the Lead cannot read. Project members watching the Lead\'s terminal see what it sends: put nothing there you would not say in the project chat.',- costs: 'costs [--days N]: what the attempts routed in the last N days (7 unless set, at most 90) cost and how they went, per engine, model, effort and kind of job: attempts, first-review pass rate, shipped, median minutes to ship, tokens, API-equivalent cost and actual per-token spend in US dollars, and cost per shipped change, with the prices and their sources. Only attempts routed since cost records began, in the groups you may read.',+ costs: 'costs [--days N]: what the attempts routed in the last N days (7 unless set, at most 90) cost and how they went, per engine, model, effort and kind of job: attempts, first-review pass rate, shipped, median minutes to ship, tokens, API-equivalent cost and actual per-token spend in US dollars, and cost per shipped change, with the prices and their sources; models has the same per engine and model alone (a grid model by its own name), and stepUps counts the attempts that stepped up from a cheaper model. Only attempts routed since cost records began, in the groups you may read.',post: `post GROUP TEXT OPERATION_ID [--reply-to MESSAGE_ID] [--attach PATH]...: ${POST_HELP}`,start: 'start OPERATION_ID JSON: create one agent in a conversation on a machine in this Swarm\'s Machines list; to use another machine, a person adds it to the Swarm first. Repeat exactly after an interruption; it follows the same native creation receipt. It does not assign work. With worktree true, the agent starts from the repository\'s default branch, fetched first, unless you set branchRef (refs/heads/BRANCH, or refs/remotes/origin/BRANCH to fetch it first) to start from another branch, such as the one this work builds on. Set role "reviewer" to start a Reviewer; leave role out for a Builder. The role is kept for the session. On Custom skills, add "roleId" to the start request to start the agent in that role of its kind (a builder or reviewer role from status); without it the agent takes the first role of its kind. A Reviewer runs on claude or codex and is assigned only review groups (conversation.create with reviewOf naming the group it reviews); a review group is assigned only to a Reviewer. Add the Reviewer to the reviewed group with conversation.agent so it is told when that work is ready for review and can pass its independent check. Start one with a routeDecisionId like any agent.',release: 'When a Builder finishes, decide reuse, keep or stop; prefer stop unless more work is coming soon. Reuse assigns new work; agent.release records keep or requests stop. Wait for the execution host to confirm a stop. A person can withdraw a stuck stop; the session cannot receive new work in that Swarm. Its native capacity stays reserved until its host confirms stopping. Other Swarms wait up to two minutes for an in-flight close, then may reuse it.',@@ -70,7 +70,7 @@ const HELP = {capacity: 'capacity MACHINE_ID JSON: inspect machine, engine and quota headroom. JSON uses the start request fields below. Unknown allowances are not reported as free tokens.',startRequest: { conversationId: 'GROUP', machineId: 'MACHINE', engine: 'codex', name: 'Builder', cwd: '/absolute/repo/on/that/machine', worktree: true, branchRef: 'refs/remotes/origin/BASE_BRANCH', requirements: START_REQUIREMENTS,model: 'opus', effort: 'high', routeDecisionId: 'DECISION' },- command: 'command OPERATION_ID JSON: send one of the commands below. Reuse exactly the same ID and JSON after an interrupted request. On Custom skills, work.assign takes "roleId" too, a role of the agent\'s kind. When your assignment needs a person to decide, set work.status needs_human; when you cannot go on, blocked. Set working again once it moves. rule.set and rule.remove change one project\'s routing rules: only the project owner does (naming projectId), or that project\'s Lead passing on the project owner\'s request, with askedIn naming the project owner\'s message in that project\'s chat. project.skills switches a project between the Default, Harness orchestration and Custom skills (Custom once its owner has made the project\'s roles): only its project owner does, or its Lead passing on that owner\'s own chat message, with askedIn naming it. tab.tidy turns off, or back on, the Swarm\'s tidying: workers idle for 15 minutes stop and finished groups archive once their pull requests are merged or closed. Only the Swarm owner does, or a Lead passing on the owner\'s own chat message, with askedIn naming it. A start, assignment or route that breaks a hard rule (forbidModel, machines, minEffort) is refused for agents; preferEngine, preferIdle and noGridFirst only rank. Low-difficulty, low-risk work that is not a review ranks models on the Swarm\'s grid first unless the owner set noGridFirst.',+ command: 'command OPERATION_ID JSON: send one of the commands below. Reuse exactly the same ID and JSON after an interrupted request. On Custom skills, work.assign takes "roleId" too, a role of the agent\'s kind. When your assignment needs a person to decide, set work.status needs_human; when you cannot go on, blocked. Set working again once it moves. rule.set and rule.remove change one project\'s routing rules: only the project owner does (naming projectId), or that project\'s Lead passing on the project owner\'s request, with askedIn naming the project owner\'s message in that project\'s chat. project.skills switches a project between the Default, Harness orchestration and Custom skills (Custom once its owner has made the project\'s roles): only its project owner does, or its Lead passing on that owner\'s own chat message, with askedIn naming it. tab.tidy turns off, or back on, the Swarm\'s tidying: workers idle for 15 minutes stop and finished groups archive once their pull requests are merged or closed. Only the Swarm owner does, or a Lead passing on the owner\'s own chat message, with askedIn naming it. A start, assignment or route that breaks a hard rule (forbidModel, machines, minEffort) is refused for agents; preferEngine, preferIdle and noGridFirst only rank. Low-risk work that is not a review ranks models on the Swarm\'s grid first unless the owner set noGridFirst: low-difficulty work, and medium work of kind docs, copy, tests, fixtures, fix or refactor (a grid model rated 2, such as Kimi K3 or DeepSeek v4.1). A review never runs on a grid model, below quality 2 or on the reviewed Builder\'s engine. When a grid attempt\'s first review says Ready no, or its grid host never starts the agent, the Swarm closes it and steps the task up (no grid and quality 2, then quality 3, at most twice) and tells you: route it again, and the route and the server keep to the new floor.',commands: [{ type: 'project.report', projectId: 'PROJECT', through: { GROUP: 214031 }, text: 'What changed, what is blocked, and what comes next. Use null when nothing merits repeating.' },{ type: 'project.repository', projectId: 'PROJECT', repositoryUrl: 'https://github.com/OWNER/REPOSITORY' },@@ -402,10 +402,11 @@ export function superTabService(core: CoreApi, options: SuperTabServiceOptions =// The devices' (core/devicesLink.ts): a Harness Pro that shows the Swarm cards is attached or gone, wants a Lead's recap, or// has one open. They read the account's Swarms as the person, and need no agent.// Only this computer's own devices ask: an account owner on another machine does not make this one read the Swarms.- if (payload.action === 'cardsWanted' || payload.action === 'cardRecap' || payload.action === 'cardOpen' || payload.action === 'cardSay' || payload.action === 'cardWorker') {+ if (payload.action === 'cardsWanted' || payload.action === 'cardRecap' || payload.action === 'cardOpen' || payload.action === 'cardSay' || payload.action === 'cardWorker' || payload.action === 'cardSide') {if (!asker.local) return { error: 'OWNER_REQUIRED' }- // A round dial that speaks swarmChat asks for the chat on its face (design 2026-10-28-round-dial-swarm-chat).- const chat = payload.chat === true+ // A round dial that speaks swarmChat asks for the chat on its face (design 2026-10-28-round-dial-swarm-chat), and one+ // that speaks swarmBuddy for the face on the side it keeps ('buddy', spec 2026-10-29-round-dial-pm-buddy).+ const chat: CardChat = payload.chat === 'buddy' ? 'buddy' : payload.chat === trueif (payload.action === 'cardsWanted') {const include = Array.isArray(payload.include) ? payload.include.filter(cardId) : []const asked = payload.focus && typeof payload.focus === 'object' ? payload.focus as Record<string, unknown> : {}@@ -415,12 +416,18 @@ export function superTabService(core: CoreApi, options: SuperTabServiceOptions =}if (payload.action === 'cardRecap' && cardId(payload.tabId) && cardId(payload.leadId)) return { ok: true, ...await cards().recap(payload.tabId, payload.leadId, chat) }if (payload.action === 'cardSay' && cardId(payload.harnessId) && typeof payload.text === 'string' && payload.text.trim() && payload.text.length <= 32_000) {- return { ok: true, said: await cards().say(payload.harnessId, payload.text.trim(), chat) }+ const result = await cards().say(payload.harnessId, payload.text.trim(), chat, ...(cardId(payload.chatId) ? [payload.chatId] : []))+ // A refusal travels with its code and message, which the dial shows instead of typing the words anywhere.+ return { ok: true, said: result.said, ...(!result.said && result.refused ? { refused: result.refused } : {}) }}// A card's failure from another computer: whether its agent is a Swarm's Builder or Reviewer, from the Swarms read last.if (payload.action === 'cardWorker' && identifier(payload.machineId) && identifier(payload.harnessId)) {return { ok: true, worker: cards().worker(payload.machineId, payload.harnessId) }}+ if (payload.action === 'cardSide' && cardId(payload.tabId) && (payload.side === 'pm' || payload.side === 'buddy')) {+ cards().side(payload.tabId, payload.side)+ return { ok: true }+ }if (payload.action === 'cardOpen' && cardId(payload.session) && cardId(payload.tabId) && (payload.leadId === null || cardId(payload.leadId))) {cards().open(payload.session, payload.tabId, payload.leadId, chat)return { ok: true }diff --git a/desktop/lib/shared/widgets/app_select_field.dart b/desktop/lib/shared/widgets/app_select_field.dartindex 69879becd..666f27e92 100644--- a/desktop/lib/shared/widgets/app_select_field.dart+++ b/desktop/lib/shared/widgets/app_select_field.dart@@ -89,6 +89,44 @@ class AppSelectField<T> extends StatefulWidget {this.semanticLabel,});+ /// The gap between the label and the chevron in the closed control.+ static const double chevronGap = 6;++ /// The width at which the closed control shows its widest of [labels] whole:+ /// the labels as [textStyle] sets them at the current text scale, then the+ /// control's own padding, chevron gap, chevron and border. For a field+ /// that is as wide as its choices (pass it as [width]) rather than its row.+ static double fitWidth(+ BuildContext context, {+ required Iterable<String> labels,+ TextStyle? textStyle,+ EdgeInsetsGeometry padding = const EdgeInsets.only(left: 10, right: 8),+ }) {+ final style =+ textStyle ??+ AppType.label(+ fontWeight: AppControl.fontWeight,+ color: AppPalette.textPrimary,+ );+ var widest = 0.0;+ for (final label in labels) {+ final painter = TextPainter(+ text: TextSpan(text: label, style: style),+ textDirection: Directionality.of(context),+ textScaler: MediaQuery.textScalerOf(context),+ maxLines: 1,+ )..layout();+ widest = math.max(widest, painter.width);+ painter.dispose();+ }+ final border = MediaQuery.highContrastOf(context) ? 2.0 : 1.5;+ return widest.ceilToDouble() ++ padding.horizontal ++ chevronGap ++ AppControl.iconSize ++ 2 * border;+ }+final T value;final List<SelectOption<T>> options;final ValueChanged<T> onChanged;@@ -689,7 +727,7 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {],),),- const SizedBox(width: 6),+ const SizedBox(width: AppSelectField.chevronGap),Icon(AppIcons.chevronDown,size: AppControl.iconSize,diff --git a/desktop/lib/shortcuts/keyboard_practice.dart b/desktop/lib/shortcuts/keyboard_practice.dartindex 1839c76c5..b1946fbac 100644--- a/desktop/lib/shortcuts/keyboard_practice.dart+++ b/desktop/lib/shortcuts/keyboard_practice.dart@@ -92,6 +92,7 @@ class KeyboardLesson {'task \nCtrl-U removes text back to the start of this line.','edit.restore' => 'task fix the tests\nCtrl-Y restores the last text removed with Ctrl-W/U.','edit.newline' => 'task fix the tests\n keep the patch small',+ 'edit.chat_newline' => 'message first line\n second line\nEnter sends; Shift-Enter or Option-Enter adds a line.','edit.backspace' =>'task tes\nCtrl-H removes the character before the cursor.','edit.delete' =>@@ -101,6 +102,23 @@ class KeyboardLesson {};}+/// The Swarm chat box writes this line itself, so it is no keymap command: no binding to move,+/// and nothing for the workspace to take (`SuperTabView` composer key handler).+final _chatBoxNewlineLesson = KeyboardLesson(+ 'edit.chat_newline',+ 'New line in a chat message',+ 'Swarm chat box',+ KeymapContext.swarmChat,+ [+ for (final key in ['shift+enter', 'alt+enter'])+ KeyBinding(+ keys: [KeyStroke.parse(key)],+ command: 'edit.chat_newline',+ context: KeymapContext.swarmChat,+ ),+ ],+);+/// The catalog and live bindings are the source of truth, including aliases,/// user sequences, unbindings, and terminal-only overrides.List<KeyboardLesson> keyboardLessons(AppKeymap keymap) {@@ -189,6 +207,7 @@ List<KeyboardLesson> keyboardLessons(AppKeymap keymap) {),);}+ result.add(_chatBoxNewlineLesson);return [for (final id in essentials)...result.where((lesson) => lesson.command == id),diff --git a/desktop/lib/state/harness_launch_integration.dart b/desktop/lib/state/harness_launch_integration.dartindex 9999cc1fb..a4bedbeb9 100644--- a/desktop/lib/state/harness_launch_integration.dart+++ b/desktop/lib/state/harness_launch_integration.dart@@ -1,6 +1,22 @@import 'harness_attachments.dart';import 'lead_placement.dart';+/// A new project's Product Manager the Swarm starts rather than this+/// Desktop: on [machineId], or with none the first free machine.+class LeadSwarmStart {+ const LeadSwarmStart({+ required this.machineId,+ required this.engine,+ required this.repositoryUrl,+ required this.title,+ required this.task,+ this.files = const [],+ });+ final String? machineId, repositoryUrl, title;+ final String engine, task;+ final List<HarnessAttachment> files;+}+class HarnessLaunchRole {const HarnessLaunchRole({required this.id,@@ -34,6 +50,7 @@ class HarnessLaunchIntegration {this.swarmSkillMode,this.roles,this.roleId,+ this.startInSwarm,});final String creationId, actionLabel;String? swarmRole;@@ -63,6 +80,10 @@ class HarnessLaunchIntegration {/// the ordinary machine, agent and folder controls.List<LeadMachine>? leadMachines;+ /// With [leadMachines]: creates the project and has the Swarm start its+ /// Product Manager, when this Desktop does not start it itself.+ final Future<void> Function(LeadSwarmStart start)? startInSwarm;+/// With [leadMachines]: the Swarm's model list for its engine and model.LeadModelList? leadModels;final Future<String> Function(String machineId, String task) prepare;diff --git a/desktop/lib/state/lead_placement.dart b/desktop/lib/state/lead_placement.dartindex 3d8fa671f..3c85b9286 100644--- a/desktop/lib/state/lead_placement.dart+++ b/desktop/lib/state/lead_placement.dart@@ -11,6 +11,9 @@ class LeadMachine {this.maySleep = false,this.unavailable,this.inSwarm = true,+ this.own = true,+ this.native = true,+ this.team = false,});final String id, name;final bool online;@@ -23,6 +26,17 @@ class LeadMachine {/// Manager on another machine of theirs, as before.final bool inSwarm;+ /// One of the person's own machines. Another person's runs the Product+ /// Manager only in its Mac's Harness Team account ([team]).+ final bool own;++ /// This Desktop starts the Product Manager itself, on a machine of the+ /// person's it is connected to; otherwise the Swarm starts it there.+ final bool native;++ /// It runs in that machine's Harness Team account.+ final bool team;+/// The repositories the Swarm already checked out there, as/// [leadRepositoryKey] reads them.final Set<String> repositories;@@ -61,10 +75,11 @@ String? leadRepositoryKey(String? remote) {return value.isEmpty ? null : value;}-/// Best first: one the Product Manager can start on now (the Swarm's machines-/// before the person's others, always on with laptops that may sleep last,-/// with [repository] already there, with the most room); then the ones it-/// cannot use yet (full), then other people's, then offline ones.+/// Best first: one the Product Manager can start on now (the person's own+/// before a teammate's, the Swarm's machines before the person's others,+/// always on with laptops that may sleep last, one this Desktop starts, with+/// [repository] already there, with the most room); then the ones it cannot+/// use yet (full), then unavailable ones, then offline ones.List<LeadMachine> rankLeadMachines(Iterable<LeadMachine> machines,String? repository,@@ -80,8 +95,13 @@ List<LeadMachine> rankLeadMachines(return [...machines]..sort((a, b) => [tier(a).compareTo(tier(b)),+ // The person's own first, as the Swarm places a waiting one.+ flag(a.own).compareTo(flag(b.own)),flag(a.inSwarm).compareTo(flag(b.inSwarm)),flag(!a.maySleep).compareTo(flag(!b.maySleep)),+ // Started by this Desktop: its files go in directly, its result is+ // known at once.+ flag(a.native).compareTo(flag(b.native)),flag(a.has(repository)).compareTo(flag(b.has(repository))),(b.freeAgents ?? 0).compareTo(a.freeAgents ?? 0),a.name.toLowerCase().compareTo(b.name.toLowerCase()),@@ -110,6 +130,7 @@ String leadMachineDetail(LeadMachine machine, String? repository) {free <= 0? 'No agents free': '$free ${free == 1 ? 'agent' : 'agents'} free',+ if (free > 0 && machine.team) 'Team account',if (free > 0 && machine.has(repository)) 'Has repo',if (free > 0 && machine.maySleep) 'May sleep',].join(' · ');diff --git a/desktop/lib/state/new_harness.dart b/desktop/lib/state/new_harness.dartindex 7bc9db41a..a8228b7b8 100644--- a/desktop/lib/state/new_harness.dart+++ b/desktop/lib/state/new_harness.dart@@ -1577,43 +1577,127 @@ class NewHarnessController extends ChangeNotifier {/// task, repo and visibility.bool get placesLead => integration?.leadMachines != null;+ /// The machine the Swarm starts the Product Manager on, rather than this+ /// Desktop: a teammate's Team account, or a machine of the person's this+ /// Desktop is not connected to. The repo stays the one chosen on+ /// [machineId]; that machine clones it. Null when this Desktop starts it on+ /// [machineId], or when it waits ([leadQueued]).+ String? _swarmLeadMachine;+ String? get leadSwarmMachine => _swarmLeadMachine;+/// The machine the Product Manager starts on, as the Swarm lists it.- LeadMachine? get leadMachine =>- integration?.leadMachines?.where((m) => m.id == _machineId).firstOrNull;+ LeadMachine? get leadMachine => integration?.leadMachines+ ?.where((m) => m.id == (_swarmLeadMachine ?? _machineId))+ .firstOrNull;++ bool _paused(List<LeadMachine> machines) =>+ machines.isNotEmpty &&+ machines.every((m) => m.unavailable == kLeadSwarmPaused);++ /// No machine can take the Product Manager now: New Project asks the+ /// Swarm to start it on the first one that frees up.+ bool get leadQueued {+ final machines = integration?.leadMachines;+ return machines != null &&+ _swarmLeadMachine == null &&+ leadMachine?.startable != true &&+ !_paused(machines) &&+ bestLeadMachine(machines, cloudRepository) == null;+ }++ /// The Swarm starts the Product Manager, on [leadSwarmMachine] or the first+ /// free machine; this Desktop does not.+ bool get leadThroughSwarm =>+ placesLead && (_swarmLeadMachine != null || leadQueued);++ /// The address the Swarm clones the chosen repo from, or null when it is+ /// not known.+ String? get leadRepositoryUrl => switch (_remoteOf(_machineId, _project)) {+ final String remote when remote.startsWith('github.com/') =>+ 'https://$remote',+ final remote => remote,+ };++ String? get _leadRepositoryName =>+ _project.repository?.name ??+ switch (_project.folder) {+ final String folder => _pathsFor(_machineId, folder).basename(folder),+ null => null,+ };++ /// The Product Manager line: where it starts, its engine and model, and a+ /// repo cloned there first.+ String get leadLine {+ if (leadQueued) {+ return 'All Swarm machines are busy. The project starts on the first '+ 'one that frees up.';+ }+ final target = leadMachine;+ final name = target == null+ ? machineLabel+ : target.team+ ? '${target.name}’s Team account'+ : target.name;+ final clones = leadThroughSwarm+ ? target != null && !target.has(leadRepositoryUrl)+ : _project.repository != null;+ return [+ 'Product Manager: $name',+ agentLabel,+ leadModelLabel,+ if (clones && _leadRepositoryName != null)+ '$_leadRepositoryName will be cloned there',+ ].join(' · ');+ }/// Why New Project cannot start its Product Manager now, or null.String? get leadBlocked {final machines = integration?.leadMachines;if (machines == null) return null;- if (leadMachine?.startable == true) return _leadModelListRefusal;- if (machines.isNotEmpty &&- machines.every((m) => m.unavailable == kLeadSwarmPaused)) {+ if (_paused(machines)) {return '$kLeadSwarmPaused. New Project can start once it resumes.';}- if (bestLeadMachine(machines, cloudRepository) == null) {- return 'No machine of yours in this Swarm is free. New Project can start once one is.';+ if (leadMachine?.startable != true && !leadQueued) {+ final name = leadMachine?.name ?? machineLabel;+ return '$name cannot start the Product Manager. Choose another machine.';}- final name = leadMachine?.name ?? machineLabel;- return '$name cannot start the Product Manager. Choose another machine.';+ if (leadThroughSwarm) {+ if (leadRepositoryUrl == null) {+ return 'Choose a repo with a remote, so the Swarm can clone it for '+ 'the Product Manager.';+ }+ if (_model != null) {+ return 'Models on the grid run only where this Desktop starts the '+ 'Product Manager. Choose the default model under Advanced.';+ }+ }+ return _leadModelListRefusal;}/// Moves the Product Manager to the best machine the Swarm lists, unless- /// it is already there or nothing can take it.+ /// it is already there; with none free, it waits ([leadQueued]).void placeLead() {final machines = integration?.leadMachines;if (machines == null || locked) return;final best = bestLeadMachine(machines, cloudRepository);- if (best == null || best.id == _machineId) return;+ if (best == null || best.id == leadMachine?.id) return;chooseLeadMachine(best.id);}- /// Starts the Product Manager on [id], one of the person's own machines the- /// list can start it on now. Anything else is refused with its reason.+ /// Starts the Product Manager on [id], a machine the list can start it on+ /// now: this Desktop starts it on one of the person's it is connected to,+ /// the Swarm on any other. Anything else is refused with its reason.void chooseLeadMachine(String id) {if (locked) return;final listed = integration?.leadMachines?.where((m) => m.id == id).firstOrNull;+ if (listed != null && listed.startable && !listed.native) {+ error = null;+ _swarmLeadMachine = id;+ notifyListeners();+ return;+ }final choice = machineChoices.where((m) => m.id == id).firstOrNull;if (listed == null ||!listed.startable ||@@ -1627,6 +1711,7 @@ class NewHarnessController extends ChangeNotifier {return;}error = null;+ _swarmLeadMachine = null;final remote = _remoteOf(_machineId, _project);_selectMachine(id);if (remote != null) _keepRepository(id, remote, listed.name);@@ -1662,10 +1747,6 @@ class NewHarnessController extends ChangeNotifier {return why == null ? null : '$why Choose another model under Advanced.';}- /// The repo the Product Manager starts in is cloned on its machine first:- /// that machine has no checkout of it.- bool get leadClones => placesLead && _project.repository != null;-/// The remote [project] on [machineId] has, when anything says so: a/// repository to clone, an agent that ran in that folder, or the Swarm's/// own checkout there.@@ -4080,6 +4161,7 @@ class NewHarnessController extends ChangeNotifier {);}if (isCloud) return _createCloud();+ if (leadThroughSwarm) return _startInSwarm();if (!checking) {_syncGitProject();if (gitError != null) retryGitProject();@@ -4406,6 +4488,46 @@ class NewHarnessController extends ChangeNotifier {/// A cloud harness: made by the cloud service on this machine (CLI/// services/cloud.ts), which starts it at its maker; no folder, no install.+ /// New Project's Product Manager the Swarm starts+ /// ([HarnessLaunchIntegration.startInSwarm]): on [leadSwarmMachine], or on+ /// the first machine that frees up.+ Future<NewHarnessOutcome> _startInSwarm() async {+ final start = integration?.startInSwarm;+ if (start == null) {+ return _fail(+ 'Update Harness to start a Product Manager on another machine.',+ );+ }+ if (leadBlocked case final why?) return _fail(why);+ busy = true;+ error = null;+ status = leadQueued+ ? 'Asking the Swarm to start the Product Manager…'+ : 'Asking ${leadMachine?.name ?? 'the machine'} to start the Product Manager…';+ notifyListeners();+ try {+ await start(+ LeadSwarmStart(+ machineId: _swarmLeadMachine,+ engine: _engine,+ repositoryUrl: leadRepositoryUrl,+ title: _leadRepositoryName,+ task: task.trim(),+ files: attachments?.files ?? const [],+ ),+ );+ } catch (failure) {+ return _fail(failure.toString());+ }+ integration?.completed = true;+ if (_disposed) return NewHarnessOutcome.created;+ busy = false;+ status = null;+ attachments?.clear();+ notifyListeners();+ return NewHarnessOutcome.created;+ }+Future<NewHarnessOutcome> _createCloud() async {busy = true;error = null;diff --git a/desktop/lib/super_tabs/buddies.dart b/desktop/lib/super_tabs/buddies.dartindex adb30e519..54f08a21d 100644--- a/desktop/lib/super_tabs/buddies.dart+++ b/desktop/lib/super_tabs/buddies.dart@@ -2,16 +2,15 @@ import 'dart:async';import 'package:flutter/material.dart';-import '../models/model_search_catalog.dart' show thisComputerName;import '../shared/theme/app_theme.dart' as grid;import '../shared/widgets/app_dialog.dart';import '../shared/widgets/app_select_field.dart';import '../state/app_state.dart';import '../widgets/desktop_chrome.dart';import 'controller.dart';+import 'buddy_machines.dart';import 'dialog_scope.dart';import 'identity.dart';-import 'machines.dart';import 'model.dart';/// The engines a Buddy runs on (spec: Buddies, 10-28).@@ -46,24 +45,6 @@ List<SuperTabProject> buddyProjects(SuperTabController c) => [if (c.buddy(project.id) == null) project,];-/// A machine a Buddy may be added on, as the add dialog lists it.-typedef BuddyMachine = ({String id, String name});--/// The reader's own machines in the Swarm: a Buddy runs only there, like a-/// Lead, whatever its engine (Ken, 10-28). Not a machine the reader may use-/// but someone else owns, and not a Harness Team account. The backend-/// refuses any other.-List<BuddyMachine> buddyMachines(SuperTabController c) => [- for (final m in c.snapshot?.machines ?? const <Map<String, dynamic>>[])- if (m['hostMachineId'] == null &&- m['contributorId'] == c.accountId &&- m['machineId'] is String)- (- id: m['machineId'] as String,- name: superTabMachineName(m['name'] as String? ?? ''),- ),-];-/// A person by the name the Swarm shows: their address before the @.String buddyPersonName(SuperTabController c, String personId) {final email = c.snapshot?.people@@ -85,8 +66,8 @@ String buddyMachineName(SuperTabController c, String machineId) {}/// Add a Buddy: project, one of the reader's own machines, and engine. With-/// [app], a reader with no machine in the Swarm can add this computer from-/// the dialog.+/// [app], this computer is offered first, even before it is in the Swarm: Add+/// Buddy then adds it.Future<void> showAddBuddy(BuildContext context,SuperTabController c, {@@ -118,9 +99,8 @@ class _AddBuddyDialogState extends State<_AddBuddyDialog> {String? _project, _machine;String _engine = 'claude';bool _busy = false;-- /// This computer's Add machine form is open over the dialog.String? _error;+ late final _adder = BuddyMachineAdder(widget.controller, widget.app);@overridevoid initState() {@@ -130,7 +110,7 @@ class _AddBuddyDialogState extends State<_AddBuddyDialog> {projects.where((p) => p.id == widget.projectId).firstOrNull?.id ??projects.where((p) => p.id == c.currentProjectId).firstOrNull?.id ??projects.firstOrNull?.id;- _machine = buddyMachines(c).firstOrNull?.id;+ _machine = _machines.firstOrNull?.id;c.addListener(_swarmChanged);}@@ -145,25 +125,34 @@ class _AddBuddyDialogState extends State<_AddBuddyDialog> {if (mounted) setState(() {});}- /// The chosen machine while it is still one of the reader's, else the+ List<BuddyMachine> get _machines => buddyMachines(c, app: widget.app);++ /// The chosen machine while it is still one the reader may use, else the/// first that is; null when none is left.- String? get _listedMachine {- final machines = buddyMachines(c);- return machines.any((m) => m.id == _machine)- ? _machine- : machines.firstOrNull?.id;- }+ BuddyMachine? get _picked => pickedBuddyMachine(_machines, _machine);Future<void> _submit() async {- final project = _project, machine = _listedMachine;+ final project = _project, machine = _picked;if (_busy || project == null || machine == null) return;setState(() {_busy = true;_error = null;});+ final (:id, error: addError) = await _adder.resolve(+ machine,+ alive: () => mounted,+ );+ if (!mounted) return;+ if (id == null) {+ setState(() {+ _busy = false;+ _error = addError;+ });+ return;+ }final added = await c.addBuddy(projectId: project,- machineId: machine,+ machineId: id,engine: _engine,);if (!mounted) return;@@ -177,20 +166,11 @@ class _AddBuddyDialogState extends State<_AddBuddyDialog> {});}- /// The Machine field when none of the reader's machines is in the Swarm:- /// this computer can be added from here.- Widget _noMachine() => BuddyNoMachine(- controller: c,- app: widget.app,- enabled: !_busy,- onAdded: (id) => setState(() => _machine = id),- );-@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);final projects = buddyProjects(c);- final machines = buddyMachines(c);+ final machines = _machines;final projectName =projects.where((p) => p.id == _project).firstOrNull?.name ?? '';Widget label(String text) => SizedBox(@@ -246,16 +226,12 @@ class _AddBuddyDialogState extends State<_AddBuddyDialog> {label('Machine'),Expanded(child: machines.isEmpty- ? _noMachine()- : AppSelectField<String>(+ ? BuddyNoMachine(controller: c, app: widget.app)+ : BuddyMachineField(key: const ValueKey('super-buddy-machine'),- value: _listedMachine ?? '',- semanticLabel: 'Machine',- textStyle: DesktopChrome.control(),- options: [- for (final m in machines)- SelectOption(value: m.id, label: m.name),- ],+ machines: machines,+ value: _picked!.id,+ action: 'Add Buddy',onChanged: (value) {if (!_busy) setState(() => _machine = value);},@@ -263,6 +239,17 @@ class _AddBuddyDialogState extends State<_AddBuddyDialog> {),],),+ if (_picked?.joins == true) ...[+ const SizedBox(height: 4),+ Padding(+ padding: const EdgeInsets.only(left: _labelWidth),+ child: Text(+ buddyJoinsNote('Add Buddy'),+ key: const ValueKey('super-buddy-joins'),+ style: DesktopChrome.control(color: DesktopChrome.muted),+ ),+ ),+ ],const SizedBox(height: 12),Row(children: [@@ -308,7 +295,11 @@ class _AddBuddyDialogState extends State<_AddBuddyDialog> {],if (_error case final error?) ...[const SizedBox(height: 12),- Text(error, style: DesktopChrome.control()),+ Text(+ error,+ key: const ValueKey('super-buddy-error'),+ style: DesktopChrome.control(),+ ),],],),@@ -320,7 +311,7 @@ class _AddBuddyDialogState extends State<_AddBuddyDialog> {child: const Text('Cancel'),),FilledButton(- onPressed: _busy || _project == null || _listedMachine == null+ onPressed: _busy || _project == null || _picked == null? null: () => unawaited(_submit()),child: Text(_busy ? 'Adding…' : 'Add Buddy'),@@ -514,17 +505,37 @@ class _BuddyStart extends StatefulWidget {class _BuddyStartState extends State<_BuddyStart> {SuperTabController get c => widget.controller;- String? _machine;+ late final _adder = BuddyMachineAdder(widget.controller, widget.app);+ String? _machine, _error;String _engine = 'claude';+ bool _adding = false;++ /// Starts the Buddy on [machine], first adding it to the Swarm when it is+ /// this Mac and not in it yet. A failed add says why and starts nothing.+ Future<void> _start(BuddyMachine machine) async {+ if (_adding) return;+ setState(() {+ _adding = true;+ _error = null;+ });+ final (:id, :error) = await _adder.resolve(machine, alive: () => mounted);+ if (!mounted) return;+ setState(() {+ _adding = false;+ _error = error;+ });+ if (id == null) return;+ unawaited(+ c.addBuddy(projectId: widget.projectId, machineId: id, engine: _engine),+ );+ }@overrideWidget build(BuildContext context) {if (!c.canWrite) return const SizedBox.shrink();- final machines = buddyMachines(c);- final machine = machines.any((m) => m.id == _machine)- ? _machine- : machines.firstOrNull?.id;- final busy = c.saving || c.hasPendingAction;+ final machines = buddyMachines(c, app: widget.app);+ final machine = pickedBuddyMachine(machines, _machine);+ final busy = c.saving || c.hasPendingAction || _adding;return Padding(key: const ValueKey('super-buddy-start'),padding: widget.padding,@@ -538,29 +549,19 @@ class _BuddyStartState extends State<_BuddyStart> {),const SizedBox(height: 8),if (machine == null)- BuddyNoMachine(- controller: c,- app: widget.app,- enabled: !busy,- onAdded: (id) => setState(() => _machine = id),- )+ BuddyNoMachine(controller: c, app: widget.app)elseRow(children: [- Expanded(- child: AppSelectField<String>(- key: const ValueKey('super-buddy-start-machine'),- value: machine,- semanticLabel: 'Machine',- textStyle: DesktopChrome.control(),- options: [- for (final m in machines)- SelectOption(value: m.id, label: m.name),- ],- onChanged: (value) {- if (!busy) setState(() => _machine = value);- },- ),+ BuddyMachineField(+ key: const ValueKey('super-buddy-start-machine'),+ machines: machines,+ value: machine.id,+ action: 'Start',+ fitNames: true,+ onChanged: (value) {+ if (!busy) setState(() => _machine = value);+ },),const SizedBox(width: 8),SizedBox(@@ -585,19 +586,27 @@ class _BuddyStartState extends State<_BuddyStart> {),const SizedBox(width: 8),FilledButton(- onPressed: busy- ? null- : () => unawaited(- c.addBuddy(- projectId: widget.projectId,- machineId: machine,- engine: _engine,- ),- ),+ onPressed: busy ? null : () => unawaited(_start(machine)),child: const Text('Start'),),],),+ if (machine?.joins == true) ...[+ const SizedBox(height: 4),+ Text(+ buddyJoinsNote('Start'),+ key: const ValueKey('super-buddy-start-joins'),+ style: DesktopChrome.control(color: DesktopChrome.muted),+ ),+ ],+ if (_error case final error?) ...[+ const SizedBox(height: 4),+ Text(+ error,+ key: const ValueKey('super-buddy-start-error'),+ style: DesktopChrome.control(),+ ),+ ],if (machine != null)for (final refusal in kBuddyEngineRefusals.values) ...[const SizedBox(height: 4),@@ -611,78 +620,3 @@ class _BuddyStartState extends State<_BuddyStart> {);}}--/// What Add a Buddy and the Buddy chat's Start bar show when none of the-/// reader's machines is in the Swarm: with [app], this computer can be added-/// through the Add machine flow (#2105), and [onAdded] gets the machine it-/// added; without, where to add one.-class BuddyNoMachine extends StatefulWidget {- const BuddyNoMachine({- super.key,- required this.controller,- required this.app,- required this.enabled,- required this.onAdded,- });- final SuperTabController controller;- final AppNotifier? app;- final bool enabled;- final ValueChanged<String> onAdded;-- @override- State<BuddyNoMachine> createState() => _BuddyNoMachineState();-}--class _BuddyNoMachineState extends State<BuddyNoMachine> {- SuperTabController get c => widget.controller;- bool _adding = false;-- /// Runs the Add machine form for this computer, then passes on what it added.- Future<void> _addThisComputer(AppNotifier app) async {- if (!widget.enabled || _adding) return;- setState(() => _adding = true);- String? added;- try {- added = await showAddMachine(context, c, app);- } finally {- if (mounted) setState(() => _adding = false);- }- if (added != null && mounted) widget.onAdded(added);- }-- @override- Widget build(BuildContext context) {- final app = widget.app;- if (app == null) {- return Text(- 'A Buddy runs on one of your own machines. Add one of yours to this '- 'Swarm first.',- style: DesktopChrome.metadata(),- );- }- return ListenableBuilder(- listenable: app,- builder: (context, _) {- final refusal = thisComputerRefusal(app, c);- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- 'None of your machines is in this Swarm yet.',- style: DesktopChrome.metadata(),- ),- const SizedBox(height: 4),- TextButton(- onPressed:- !widget.enabled || _adding || !c.canWrite || refusal != null- ? null- : () => unawaited(_addThisComputer(app)),- child: Text('Add ${thisComputerName()}'),- ),- if (refusal != null) Text(refusal, style: DesktopChrome.metadata()),- ],- );- },- );- }-}diff --git a/desktop/lib/super_tabs/buddy_machines.dart b/desktop/lib/super_tabs/buddy_machines.dartnew file mode 100644index 000000000..34d3c4091--- /dev/null+++ b/desktop/lib/super_tabs/buddy_machines.dart@@ -0,0 +1,196 @@+import 'package:flutter/material.dart';++import '../models/model_search_catalog.dart' show thisComputerName;+import '../shared/widgets/app_select_field.dart';+import '../state/app_state.dart';+import '../widgets/desktop_chrome.dart';+import 'controller.dart';+import 'identity.dart';+import 'machines.dart';++/// A machine a Buddy may be started on, as the pickers list it. [joins] marks+/// this Mac while it is not in the Swarm yet: starting there adds it first.+typedef BuddyMachine = ({String id, String name, bool joins});++/// What the pickers say about this Mac while [action] would add it to the+/// Swarm: `Start` in the Buddy chat's bar, `Add Buddy` in the dialog.+String buddyJoinsNote(String action) =>+ 'Not in this Swarm yet: $action adds it';++/// The reader's own machines in the Swarm: a Buddy runs only there, like a+/// Lead, whatever its engine (Ken, 10-28). Not a machine the reader may use+/// but someone else owns, and not a Harness Team account. The backend refuses+/// any other. With [app], the Mac running Harness comes first: by name when it+/// is in the Swarm, else as `This Mac · NAME` when the Add machine flow would+/// take it now (Dee, 10-29).+List<BuddyMachine> buddyMachines(SuperTabController c, {AppNotifier? app}) {+ final own = [+ for (final m in c.snapshot?.machines ?? const <Map<String, dynamic>>[])+ if (m['hostMachineId'] == null &&+ m['contributorId'] == c.accountId &&+ m['machineId'] is String)+ (+ id: m['machineId'] as String,+ name: superTabMachineName(m['name'] as String? ?? ''),+ joins: false,+ ),+ ];+ final here = app?.machineStates.values+ .where((m) => m.isLocalMachine)+ .firstOrNull;+ if (app == null || here == null) return own;+ final hereId = here.machine.machineId;+ final inSwarm = own.where((m) => m.id == hereId).firstOrNull;+ if (inSwarm != null) {+ return [inSwarm, ...own.where((m) => m.id != hereId)];+ }+ // Only this account's own Mac, only while the Add machine flow takes it.+ if (thisComputerRefusal(app, c) != null) return own;+ final label = thisComputerName();+ return [+ (+ id: hereId,+ name:+ '${label[0].toUpperCase()}${label.substring(1)} · '+ '${superTabMachineName(here.machine.displayName)}',+ joins: true,+ ),+ ...own,+ ];+}++/// The machine of [machines] that [chosen] names, else the first.+BuddyMachine? pickedBuddyMachine(List<BuddyMachine> machines, String? chosen) =>+ machines.where((m) => m.id == chosen).firstOrNull ?? machines.firstOrNull;++/// The Machine field of the Buddy pickers. With [fitNames] it is as wide as+/// its longest name rather than the row. [action] is the button that adds+/// this Mac when it is picked, named in its note.+class BuddyMachineField extends StatelessWidget {+ const BuddyMachineField({+ super.key,+ required this.machines,+ required this.value,+ required this.action,+ required this.onChanged,+ this.fitNames = false,+ });+ final List<BuddyMachine> machines;+ final String value;+ final String action;+ final ValueChanged<String> onChanged;+ final bool fitNames;++ /// Wide enough for the note whole under a name, which a menu only as wide as+ /// a fitted field would cut off.+ static const _joinsMenuWidth = 320.0;++ @override+ Widget build(BuildContext context) {+ final style = DesktopChrome.control();+ return AppSelectField<String>(+ value: value,+ semanticLabel: 'Machine',+ textStyle: style,+ width: fitNames+ ? AppSelectField.fitWidth(+ context,+ labels: [for (final m in machines) m.name],+ textStyle: style,+ )+ : null,+ menuWidth: machines.any((m) => m.joins) ? _joinsMenuWidth : null,+ options: [+ for (final m in machines)+ SelectOption(+ value: m.id,+ label: m.name,+ detail: m.joins ? buddyJoinsNote(action) : null,+ ),+ ],+ onChanged: onChanged,+ );+ }+}++/// Why nothing was added when the reader's write access ended during the add.+const kBuddyAccessLost =+ 'You can no longer change this Swarm, so this Mac was not added.';++/// Where a Buddy starts, once the person has clicked Start: the picked+/// machine, added to the Swarm first when it is this Mac and not in it yet.+/// Keeps the Add machine setup between tries, as that form does, so a setup+/// still running is joined rather than started again.+class BuddyMachineAdder {+ BuddyMachineAdder(this.controller, this.app);+ final SuperTabController controller;+ final AppNotifier? app;+ String? _setupId;++ /// The id of the machine to start on; null with no [error] when [alive] ended+ /// first, in which case nothing more is done for a gone dialog or bar.+ Future<({String? id, String? error})> resolve(+ BuddyMachine machine, {+ required bool Function() alive,+ }) async {+ final app = this.app;+ if (!machine.joins || app == null) return (id: machine.id, error: null);+ _setupId ??= superTabOperationId();+ try {+ final id = await contributeComputer(+ controller,+ app,+ machine.id,+ setupId: _setupId!,+ alive: alive,+ );+ _setupId = null;+ // Nothing was added though nobody gave up: write access is gone.+ if (id == null && alive()) return (id: null, error: kBuddyAccessLost);+ return (id: id, error: null);+ } catch (failure) {+ if (failure is! SuperTabFailure || failure.code != 'SETUP_PENDING') {+ _setupId = null;+ }+ return (id: null, error: failure.toString());+ }+ }+}++/// What the Buddy pickers show when none of the reader's machines can run a+/// Buddy: where to add one, and why this computer cannot be added from here.+class BuddyNoMachine extends StatelessWidget {+ const BuddyNoMachine({+ super.key,+ required this.controller,+ required this.app,+ });+ final SuperTabController controller;+ final AppNotifier? app;++ @override+ Widget build(BuildContext context) {+ final app = this.app;+ if (app == null) {+ return Text(+ 'A Buddy runs on one of your own machines. Add one of yours to this '+ 'Swarm first.',+ style: DesktopChrome.metadata(),+ );+ }+ return ListenableBuilder(+ listenable: app,+ builder: (context, _) => Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ 'None of your machines is in this Swarm yet.',+ style: DesktopChrome.metadata(),+ ),+ if (thisComputerRefusal(app, controller) case final refusal?)+ Text(refusal, style: DesktopChrome.metadata()),+ ],+ ),+ );+ }+}diff --git a/desktop/lib/super_tabs/composer_newline.dart b/desktop/lib/super_tabs/composer_newline.dartnew file mode 100644index 000000000..c2e724593--- /dev/null+++ b/desktop/lib/super_tabs/composer_newline.dart@@ -0,0 +1,21 @@+import 'package:flutter/services.dart';++/// The most the Swarm chat box holds; the field's own limit and [withNewline]'s.+const kComposerMaxLength = 32000;++/// [value] with a line break at the cursor, replacing a selection.+///+/// Null when the box has no room for it: a value set from code skips the field's length limit,+/// so the limit is kept here.+TextEditingValue? withNewline(TextEditingValue value) {+ final selection = value.selection.isValid+ ? value.selection+ : TextSelection.collapsed(offset: value.text.length);+ final text =+ '${selection.textBefore(value.text)}\n${selection.textAfter(value.text)}';+ if (text.length > kComposerMaxLength) return null;+ return TextEditingValue(+ text: text,+ selection: TextSelection.collapsed(offset: selection.start + 1),+ );+}diff --git a/desktop/lib/super_tabs/launch.dart b/desktop/lib/super_tabs/launch.dartindex b16a2f554..d2c791f9b 100644--- a/desktop/lib/super_tabs/launch.dart+++ b/desktop/lib/super_tabs/launch.dart@@ -1,6 +1,8 @@import 'dart:convert';import 'dart:math' as math;+import 'package:dio/dio.dart' show CancelToken;+import 'package:flutter/foundation.dart' show visibleForTesting;import 'package:path/path.dart' as p;import '../core/first_task.dart';@@ -10,6 +12,7 @@ import '../state/harness_attachments.dart';import '../state/harness_launch_integration.dart';import '../state/lead_placement.dart';import '../state/swarm.dart';+import 'attachment_upload.dart';import 'controller.dart';import 'machine_icon.dart';import 'machine_status.dart';@@ -94,6 +97,41 @@ class SuperTabLaunch {integration =HarnessLaunchIntegration(forcedPermissionMode: 'full',+ startInSwarm: leadMachines == null+ ? null+ : (start) async {+ if (saved['projectPrepared'] != true &&+ saved['creationRequest'] == null) {+ saved['visibility'] =+ integration.projectVisibility ?? 'public';+ }+ try {+ // A start already sent is repeated as it is: the server may+ // have committed it and taken the machine's last slot, so+ // its answer decides, not a fresh check.+ if (start.machineId case final machine?+ when saved['leadStartRequest'] == null) {+ await launch.recheckLeadMachine(integration, machine);+ }+ await launch.startInSwarm(start);+ } on SuperTabFailure catch (failure) {+ // As prepare: a request validation refused leaves no project.+ if (saved['projectPrepared'] != true &&+ const {+ 'VALIDATION_ERROR',+ 'UPDATE_REQUIRED',+ }.contains(failure.code)) {+ saved.remove('creationRequest');+ saved['operationId'] = superTabOperationId();+ await launch.persist();+ }+ rethrow;+ } finally {+ integration.projectVisibilityLocked =+ saved['projectPrepared'] == true ||+ saved['creationRequest'] != null;+ }+ },creationId: saved['creationId'] as String? ?? superTabOperationId(),initialTask: saved['initialMessage'] as String?,swarmRole: saved['lead'] == true@@ -119,33 +157,7 @@ class SuperTabLaunch {saved['creationRequest'] != null,prepare: (machine, task) async {if (integration.leadMachines != null) {- // The list from when the form opened may be stale by now. With- // no fresh read nothing is created: the machine is unchecked.- final name =- integration.leadMachines!- .where((m) => m.id == machine)- .firstOrNull- ?.name ??- launch.machineNameOf(machine);- final SuperTabSnapshot fresh;- try {- fresh = await app.superTabs.readSnapshot(tab.superTabId!);- } on SuperTabFailure catch (failure) {- if (failure.code == 'ACCOUNT_CHANGED') rethrow;- throw SuperTabFailure(- 'SWARM_UNREADABLE',- 'Couldn’t check $name for the '- 'Product Manager: ${failure.message} Try again.',- );- } catch (_) {- throw SuperTabFailure(- 'SWARM_UNREADABLE',- 'Couldn’t check $name for the '- 'Product Manager: the Swarm didn’t answer. Try again.',- );- }- integration.leadMachines = launch.leadMachinesOf(fresh);- launch.checkLeadMachine(integration.leadMachines!, machine);+ await launch.recheckLeadMachine(integration, machine);}if (integration.roles != null) {final chosen = integration.roles!@@ -293,6 +305,17 @@ class SuperTabLaunch {LeadMachine row(String id, Map<String, dynamic> pool) {final reading = snapshot.readingPoolOf(id, accountId) ?? pool;final observation = part(reading['observation']);+ final name = pool['name'] as String? ?? id;+ final own = pool['contributorId'] == accountId;+ final connected = app.stateOf(id) != null;+ // Its host says it can start a Product Manager (backend leadStart.ts).+ final capable =+ (observation['capabilities'] as List?)?.contains('leadStart') == true;+ // Another person's Mac runs one only in its Harness Team account.+ final team =+ !own &&+ (reading['hostMachineId'] != null ||+ observation['sessionKind'] == 'team');final received = observation['receivedAt'];final online =received is num &&@@ -303,7 +326,7 @@ class SuperTabLaunch {final device = part(observation['resources'])['deviceType'];return LeadMachine(id: id,- name: pool['name'] as String? ?? id,+ name: name,online: online,// The server's count: it also holds pending starts and the Team// account sharing a Mac. A backend without it: slots minus running.@@ -344,15 +367,26 @@ class SuperTabLaunch {maySleep:superTabMachineSymbol(device is String ? device : null) =='laptopcomputer',+ own: own,+ native: own && connected,+ team: team,unavailable: snapshot.paused? kLeadSwarmPaused- : pool['contributorId'] != accountId- ? 'Another person’s machine'- : app.stateOf(id) == null- ? 'Not connected to this computer'- : pool['paused'] == true- ? 'Paused in this Swarm'- : null,+ : own+ ? (connected+ ? (pool['paused'] == true ? 'Paused in this Swarm' : null)+ : capable+ ? null+ : 'Not connected to this computer')+ : !team+ ? '$name has no Harness Team account yet, so it runs only its '+ 'owner’s projects.'+ : switch (reading['teamWork']) {+ {'allowed': false, 'reason': final String reason} => reason,+ _ when !capable =>+ 'Update Harness on $name to run a Product Manager there.',+ _ => null,+ },);}@@ -394,6 +428,161 @@ class SuperTabLaunch {}}+ /// Reads the Swarm again and refuses [machine] when it cannot take the+ /// Product Manager now: the list from when the form opened may be stale.+ /// With no fresh read nothing is created, since the machine is unchecked.+ Future<void> recheckLeadMachine(+ HarnessLaunchIntegration integration,+ String machine,+ ) async {+ final name =+ integration.leadMachines+ ?.where((m) => m.id == machine)+ .firstOrNull+ ?.name ??+ machineNameOf(machine);+ final SuperTabSnapshot fresh;+ try {+ fresh = await app.superTabs.readSnapshot(saved['tabId'] as String);+ } on SuperTabFailure catch (failure) {+ if (failure.code == 'ACCOUNT_CHANGED') rethrow;+ throw SuperTabFailure(+ 'SWARM_UNREADABLE',+ 'Couldn’t check $name for the Product Manager: ${failure.message} '+ 'Try again.',+ );+ } catch (_) {+ throw SuperTabFailure(+ 'SWARM_UNREADABLE',+ 'Couldn’t check $name for the Product Manager: the Swarm didn’t '+ 'answer. Try again.',+ );+ }+ checkAccount();+ integration.leadMachines = leadMachinesOf(fresh);+ checkLeadMachine(integration.leadMachines!, machine);+ }++ /// The upload a Swarm-started Product Manager's files take, in tests.+ @visibleForTesting+ static SuperTabUpload? uploadForTest;++ /// New Project's Product Manager started by the Swarm, not this Desktop+ /// (backend leadStart.ts): creates the project, posts the task and files+ /// to its chat, where such a Product Manager reads its request, and asks+ /// the Swarm to start it on [LeadSwarmStart.machineId], or on the first+ /// free machine. Each step keeps its receipt in the journal, so a retry+ /// repeats none of them.+ Future<void> startInSwarm(LeadSwarmStart start) async {+ checkAccount();+ saved['initialMessage'] = start.task;+ await _createProject(start.task);+ final tabId = saved['tabId'] as String;+ final conversationId = saved['conversationId'] as String;+ Future<Map<String, dynamic>> send(String operationId, Map command) =>+ app.superTabs.map(+ 'POST',+ '/api/super-tabs/$tabId/commands',+ body: {'operationId': operationId, 'command': command},+ );+ if (saved['taskPosted'] != true &&+ (start.task.isNotEmpty || start.files.isNotEmpty)) {+ // Written once, with its files' ids: a retry after a lost reply sends+ // this very request, so nothing is uploaded again.+ if (saved['taskRequest'] == null) {+ final upload = uploadForTest ?? app.superTabs.upload;+ final ids = [+ for (final file in start.files)+ superTabMap(+ (await upload(+ tabId: tabId,+ conversationId: conversationId,+ name: file.name,+ mime: mimeForName(file.name),+ bytes: file.bytes,+ cancel: CancelToken(),+ onProgress: (_) {},+ ))['attachment'],+ )['id']+ as String,+ ];+ checkAccount();+ saved['taskRequest'] = {+ 'operationId': superTabOperationId(),+ 'command': {+ 'type': 'message.send',+ 'conversationId': conversationId,+ 'text': start.task,+ 'replyTo': null,+ 'recipientIds': const <String>[],+ if (ids.isNotEmpty) 'attachmentIds': ids,+ },+ };+ await persist();+ }+ await _replay('taskRequest');+ saved['taskPosted'] = true;+ saved.remove('taskRequest');+ await persist();+ }+ // Kept as first sent until the Swarm answers it: after an unclear failure+ // a retry repeats it, perhaps already committed, rather than asking again.+ saved['leadStartRequest'] ??= {+ 'operationId': superTabOperationId(),+ 'command': {+ 'type': 'lead.start',+ 'projectId': saved['projectId'],+ 'machineId': start.machineId,+ 'engine': start.engine,+ 'repositoryUrl': ?start.repositoryUrl,+ },+ };+ await persist();+ await _replay('leadStartRequest');+ final title = start.title ?? 'New project';+ saved['title'] = title;+ await persist();+ await send('${saved['joinId']}-name', {+ 'type': 'project.rename',+ 'projectId': saved['projectId'],+ 'name': title,+ });+ final controller = await app.superTabs.open(tabId);+ await controller.refresh();+ checkAccount();+ controller.select(conversationId);+ await app.superTabs.storage.delete(key);+ }++ /// Sends the journal's request [key] exactly as it was first written: the+ /// server answers a repeated operation with its receipt, and refuses one+ /// whose request changed. Only a definite refusal drops it, so the next+ /// attempt (perhaps to another machine) is a new request; any other failure+ /// may have been committed and keeps it.+ Future<void> _replay(String key) async {+ try {+ await app.superTabs.map(+ 'POST',+ '/api/super-tabs/${saved['tabId']}/commands',+ body: superTabMap(saved[key]),+ );+ } on SuperTabFailure catch (failure) {+ if (_refusedOutright(failure)) {+ saved.remove(key);+ await persist();+ }+ rethrow;+ }+ }++ /// The Swarm said no and wrote nothing: a 4xx answer other than a timeout+ /// or a rate limit. A transport failure or a 5xx may have been committed.+ static bool _refusedOutright(SuperTabFailure failure) =>+ failure.statusCode >= 400 &&+ failure.statusCode < 500 &&+ failure.statusCode != 408 &&+ failure.statusCode != 429;+/// Refuses a machine the list cannot start the Product Manager on now.void checkLeadMachine(List<LeadMachine> machines, String machine) {final chosen = machines.where((m) => m.id == machine).firstOrNull;@@ -454,28 +643,7 @@ class SuperTabLaunch {app.superTabs.deferTabDiscovery(saved['tabId'] as String);await persist();}- if (saved['newProject'] == true && saved['projectPrepared'] != true) {- saved['creationRequest'] ??= {- 'operationId': saved['operationId'],- 'command': {- 'type': 'project.create',- 'name': 'New project',- 'visibility': saved['visibility'] ?? 'public',- 'brief': String.fromCharCodes(task.runes.take(4000)),- },- };- await persist();- final created = await app.superTabs.map(- 'POST',- '/api/super-tabs/${saved['tabId']}/commands',- body: superTabMap(saved['creationRequest']),- );- final result = superTabMap(created['result']);- saved['projectId'] = result['projectId'];- saved['conversationId'] = result['conversationId'];- saved['projectPrepared'] = true;- await persist();- }+ await _createProject(task);app.superTabs.deferTabDiscovery(saved['tabId'] as String);// Revalidate a journal's destination before native submission. A project// deleted on another computer must not leave an unattached native session.@@ -520,6 +688,32 @@ class SuperTabLaunch {return prompt;}+ /// A new project's creation, once: its receipt stays in the journal.+ Future<void> _createProject(String task) async {+ if (saved['newProject'] == true && saved['projectPrepared'] != true) {+ saved['creationRequest'] ??= {+ 'operationId': saved['operationId'],+ 'command': {+ 'type': 'project.create',+ 'name': 'New project',+ 'visibility': saved['visibility'] ?? 'public',+ 'brief': String.fromCharCodes(task.runes.take(4000)),+ },+ };+ await persist();+ final created = await app.superTabs.map(+ 'POST',+ '/api/super-tabs/${saved['tabId']}/commands',+ body: superTabMap(saved['creationRequest']),+ );+ final result = superTabMap(created['result']);+ saved['projectId'] = result['projectId'];+ saved['conversationId'] = result['conversationId'];+ saved['projectPrepared'] = true;+ await persist();+ }+ }+// A started request's journal stays until the person discards it.static const projectUnavailable = SuperTabFailure('PROJECT_UNAVAILABLE',diff --git a/desktop/lib/super_tabs/leaderboard/models_section.dart b/desktop/lib/super_tabs/leaderboard/models_section.dartnew file mode 100644index 000000000..69e70532d--- /dev/null+++ b/desktop/lib/super_tabs/leaderboard/models_section.dart@@ -0,0 +1,207 @@+import 'package:flutter/material.dart';++import '../../core/runtime_model_name.dart';+import '../../shared/theme/app_theme.dart' as grid;+import '../../widgets/desktop_chrome.dart';+import '../../widgets/engine_identity.dart';+import '../section_heading.dart';+import 'format.dart';+import 'model.dart';+import 'person_row.dart';+import 'reader.dart';++/// The spacing scale's 8, and the sidebar rows' height.+const _gap = DesktopChrome.controlGap;+const _rowHeight = 36.0;++/// Fewer first reviews than this say nothing about a model.+const leaderboardModelMinReviewed = 3;++/// How many models the sidebar lists until its heading shows them all.+const leaderboardModelsShown = 3;++/// A model as the sidebar's Models lists it: every engine and effort it ran+/// at as one, and how many of its attempts reviewers approved on first review.+class LeaderboardModelShare {+ const LeaderboardModelShare({+ required this.name,+ required this.reviewed,+ required this.passed,+ });++ /// "Opus 5.5", "GPT-6.1 Sol"; the engine's name when it reported no model.+ final String name;+ final int reviewed, passed;++ int get percent => (passed * 100 / reviewed).round();+}++/// The week's models with at least [leaderboardModelMinReviewed] first+/// reviews, the most often approved first; of two alike, the one reviewed+/// more, then by name.+List<LeaderboardModelShare> leaderboardModelShares(SuperTabLeaderboard board) {+ final merged = <String, ({String name, int reviewed, int passed})>{};+ for (final score in board.byModel) {+ final name = switch (score.model) {+ final String model => modelDisplayName(model),+ null => engineIdentity(score.engine).label,+ };+ // One row per model, whichever engine ran it at whichever effort:+ // rows are keyed by name.+ final before = merged[name];+ merged[name] = (+ name: name,+ reviewed: (before?.reviewed ?? 0) + score.reviewed,+ passed: (before?.passed ?? 0) + score.passed,+ );+ }+ final shares = [+ for (final model in merged.values)+ if (model.reviewed >= leaderboardModelMinReviewed)+ LeaderboardModelShare(+ name: model.name,+ reviewed: model.reviewed,+ passed: model.passed,+ ),+ ];+ shares.sort((a, b) {+ final share = b.passed * a.reviewed - a.passed * b.reviewed;+ if (share != 0) return share;+ final reviewed = b.reviewed - a.reviewed;+ return reviewed != 0 ? reviewed : a.name.compareTo(b.name);+ });+ return shares;+}++/// The left sidebar's Models, after Machines (Dee, 2026-10-29): the models+/// whose work reviewers approved most often on first review in the week the+/// right pane shows, each as a bare percentage, the counts in words on hover+/// and to a screen reader. The heading shows them all. Nothing shows without+/// a board of [projectId], or when no model has enough first reviews.+class LeaderboardModelsSection extends StatefulWidget {+ const LeaderboardModelsSection({+ super.key,+ required this.board,+ required this.projectId,+ this.now = DateTime.now,+ });+ final SuperTabLeaderboardReader board;++ /// The open project; a board of any other shows nothing.+ final String? projectId;+ final DateTime Function() now;++ @override+ State<LeaderboardModelsSection> createState() =>+ _LeaderboardModelsSectionState();+}++class _LeaderboardModelsSectionState extends State<LeaderboardModelsSection> {+ var _all = false;++ @override+ Widget build(BuildContext context) => ListenableBuilder(+ listenable: widget.board,+ builder: (context, _) {+ final board = widget.board.board;+ if (board == null || board.projectId != widget.projectId) {+ return const SizedBox.shrink();+ }+ final shares = leaderboardModelShares(board);+ if (shares.isEmpty) return const SizedBox.shrink();+ final more = shares.length > leaderboardModelsShown;+ final week = weekName(widget.board.week, leaderboardWeekOf(widget.now()));+ final style = leaderboardPointsStyle();+ final column = _width(context, '100%', style);+ return Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ SuperTabSectionHeading(+ 'Models',+ key: const ValueKey('super-models-heading'),+ endInset: 0,+ startInset: SuperTabSectionHeading.indentFor(0),+ collapsed: more ? !_all : null,+ onToggleCollapsed: more ? () => setState(() => _all = !_all) : null,+ ),+ for (final share+ in _all ? shares : shares.take(leaderboardModelsShown))+ _row(share, week, style, column),+ ],+ );+ },+ );++ Widget _row(+ LeaderboardModelShare share,+ String week,+ TextStyle style,+ double column,+ ) {+ final words =+ '${share.passed} of ${share.reviewed} approved on first review $week';+ return Tooltip(+ key: ValueKey('super-model-${share.name}'),+ message: words,+ excludeFromSemantics: true,+ child: Semantics(+ container: true,+ label: '${share.name}: $words',+ excludeSemantics: true,+ child: Padding(+ padding: const EdgeInsets.only(bottom: grid.AppDesktop.listRowGap),+ child: ConstrainedBox(+ constraints: const BoxConstraints(minHeight: _rowHeight),+ child: Padding(+ // The sidebar's rows: names after the icon column, the number+ // where their badges end.+ padding: EdgeInsets.fromLTRB(+ SuperTabSectionHeading.indentFor(0) ++ SuperTabSectionHeading.actionWidth,+ _gap,+ _gap + _gap / 2,+ _gap,+ ),+ child: Row(+ children: [+ Expanded(+ child: Text(+ share.name,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.control(+ color: DesktopChrome.foreground,+ ),+ ),+ ),+ const SizedBox(width: DesktopChrome.controlGap),+ SizedBox(+ width: column,+ child: Text(+ '${share.percent}%',+ maxLines: 1,+ textAlign: TextAlign.right,+ style: style,+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ ),+ );+ }++ /// The widest percentage at the current text size, so the column holds.+ static double _width(BuildContext context, String text, TextStyle style) {+ final painter = TextPainter(+ text: TextSpan(text: text, style: style),+ textDirection: TextDirection.ltr,+ textScaler: MediaQuery.textScalerOf(context),+ )..layout();+ final width = painter.width;+ painter.dispose();+ return width;+ }+}diff --git a/desktop/lib/super_tabs/leaderboard/reader.dart b/desktop/lib/super_tabs/leaderboard/reader.dartindex f719f763e..d5cd818b8 100644--- a/desktop/lib/super_tabs/leaderboard/reader.dart+++ b/desktop/lib/super_tabs/leaderboard/reader.dart@@ -51,6 +51,17 @@ class SuperTabLeaderboardReader extends ChangeNotifier {return refresh();}+ /// Forgets the board: no project is open, or the reader lost it. A read in+ /// flight is dropped, so its answer never shows.+ void clear() {+ _projectId = null;+ _read++;+ board = null;+ error = null;+ hide();+ _notify();+ }+/// Stops the refresh while Humans are not shown; the board stays.void hide() {_timer?.cancel();@@ -74,7 +85,9 @@ class SuperTabLeaderboardReader extends ChangeNotifier {} on SuperTabFailure catch (failure) {if (read != _read) return;// A server from before the leaderboard has none: Humans just list names.- if (failure.statusCode == 404) {+ // A project the reader may no longer read is forgotten alike, its+ // numbers and the server's words about it.+ if (failure.statusCode == 404 || failure.statusCode == 403) {board = null;error = null;} else {@@ -98,3 +111,44 @@ class SuperTabLeaderboardReader extends ChangeNotifier {super.dispose();}}++/// The board of the open conversation's project, read once for the right+/// pane's members and the sidebar's Models, so both show one project and one+/// week. No project open, or the project gone from the Swarm the reader+/// sees, clears it.+class SuperTabProjectBoard extends SuperTabLeaderboardReader {+ /// The board moves only as work ships, is answered or runs: every five+ /// minutes is fresh enough, and keeps every open window's reads rare.+ SuperTabProjectBoard(+ this.controller, {+ super.every = const Duration(minutes: 5),+ }) : super(tabId: controller.tabId, request: controller.request) {+ controller.addListener(_follow);+ _follow();+ }++ final SuperTabController controller;+ String? _following;++ /// The project whose board this is; null while none is open.+ String? get projectId => _following;++ void _follow() {+ final projectId = controller.snapshot+ ?.projectFor(controller.selectedId)+ ?.id;+ if (projectId == _following) return;+ _following = projectId;+ if (projectId == null) {+ clear();+ } else {+ unawaited(show(projectId));+ }+ }++ @override+ void dispose() {+ controller.removeListener(_follow);+ super.dispose();+ }+}diff --git a/desktop/lib/super_tabs/leaderboard/tabs.dart b/desktop/lib/super_tabs/leaderboard/tabs.dartdeleted file mode 100644index 066512242..000000000--- a/desktop/lib/super_tabs/leaderboard/tabs.dart+++ /dev/null@@ -1,84 +0,0 @@-import 'package:flutter/material.dart';--import '../../shared/theme/app_theme.dart' as grid;-import '../../widgets/desktop_chrome.dart';-import '../../widgets/finger_target.dart';--/// The leaderboard's three lists (Dee, 2026-10-29): people, the permanent-/// agents (the PM and Buddies), and the temporary workers by model.-enum LeaderboardTab { humans, agents, models }--extension LeaderboardTabLabel on LeaderboardTab {- String get label => switch (this) {- LeaderboardTab.humans => 'Humans',- LeaderboardTab.agents => 'Agents',- LeaderboardTab.models => 'Models',- };-}--/// The board's heading: Humans, Agents and Models as scope pills, the-/// chosen one selected (the design system's scope selector), then [actions]-/// (the week, Invite people) at the trailing edge. In a pane too narrow for-/// one line the actions take the next one.-class LeaderboardHeader extends StatelessWidget {- const LeaderboardHeader({- super.key,- required this.selected,- required this.onSelect,- this.actions = const [],- });- final LeaderboardTab selected;- final ValueChanged<LeaderboardTab> onSelect;- final List<Widget> actions;-- static const _gap = grid.AppDesktop.controlGap;-- @override- Widget build(BuildContext context) => Padding(- // The section headings' insets: the spacing scale's 16, 12 and 4.- padding: const EdgeInsets.fromLTRB(- DesktopChrome.groupGap,- 0,- _gap + _gap / 2,- _gap / 2,- ),- child: ConstrainedBox(- constraints: const BoxConstraints(minHeight: DesktopChrome.controlHeight),- child: Wrap(- alignment: WrapAlignment.spaceBetween,- crossAxisAlignment: WrapCrossAlignment.center,- spacing: _gap,- runSpacing: _gap / 2,- children: [- // Enlarged text in a narrow pane scrolls the pills rather than- // cutting a name short.- SingleChildScrollView(- scrollDirection: Axis.horizontal,- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- for (final tab in LeaderboardTab.values) ...[- if (tab != LeaderboardTab.values.first)- const SizedBox(width: _gap / 2),- // A phone's pill is a finger's height.- fingerTarget(- enabled: workspaceIsCompact(context),- DesktopPill(- key: ValueKey('leaderboard-tab-${tab.name}'),- label: tab.label,- compact: true,- selected: tab == selected,- onPressed: () => onSelect(tab),- ),- ),- ],- ],- ),- ),- if (actions.isNotEmpty)- Row(mainAxisSize: MainAxisSize.min, children: actions),- ],- ),- ),- );-}diff --git a/desktop/lib/super_tabs/leaderboard/worker_rows.dart b/desktop/lib/super_tabs/leaderboard/worker_rows.dartdeleted file mode 100644index cebbaccc2..000000000--- a/desktop/lib/super_tabs/leaderboard/worker_rows.dart+++ /dev/null@@ -1,281 +0,0 @@-import 'package:flutter/material.dart';--import '../../core/runtime_model_name.dart';-import '../../shared/theme/app_theme.dart' as grid;-import '../../widgets/desktop_chrome.dart';-import '../../widgets/engine_identity.dart';-import '../../widgets/finger_target.dart';-import '../identity.dart';-import '../model.dart';-import 'format.dart';-import 'model.dart';-import 'person_row.dart';--/// The gap between a row's columns, and half of it: the spacing scale's 8-/// and 4.-const _gap = grid.AppDesktop.controlGap;-const _halfGap = _gap / 2;--/// One ranked row of the Agents or Models list, built like a person's-/// (Numbers and rankings): the rank as a bold numeral in its column, the-/// identity, the name with a quiet tag and, for number one, the crown, a quiet-/// line of non-zero numbers in words, and the points at the trailing edge.-class _ScoreRow extends StatelessWidget {- const _ScoreRow({- required this.id,- required this.rank,- required this.points,- required this.columns,- required this.identity,- required this.name,- required this.tag,- required this.numbers,- required this.crowned,- required this.weekName,- this.numbersTooltip,- this.numberLines = 1,- });- final String id, name, weekName;- final int rank, points;- final LeaderboardColumns columns;- final Widget identity;-- /// Quietly after the name: "PM · Mac Studio", "grid".- final String? tag;- final List<String> numbers;- final String? numbersTooltip;- final int numberLines;- final bool crowned;-- @override- Widget build(BuildContext context) => Padding(- key: ValueKey('leaderboard-row-$id'),- padding: const EdgeInsets.symmetric(horizontal: _gap),- child: ConstrainedBox(- constraints: BoxConstraints(- minHeight: fingerHeight(- grid.AppControl.heightField,- enabled: workspaceIsCompact(context),- ),- ),- child: Padding(- padding: const EdgeInsets.symmetric(- horizontal: _gap,- vertical: _halfGap,- ),- child: Row(- children: [- SizedBox(- width: columns.rank,- child: Text(- '$rank',- maxLines: 1,- textAlign: TextAlign.right,- style: leaderboardRankStyle(),- ),- ),- const SizedBox(width: _gap),- SizedBox.square(- dimension: SuperTabAvatar.rowSize,- child: Center(child: identity),- ),- const SizedBox(width: _gap),- Expanded(- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text.rich(- TextSpan(- text: name,- children: [- if (crowned)- WidgetSpan(- alignment: PlaceholderAlignment.middle,- child: LeaderboardCrown(id: id, weekName: weekName),- ),- if (tag case final tag?)- TextSpan(- text: ' $tag',- style: DesktopChrome.metadata(),- ),- ],- ),- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: DesktopChrome.control(),- ),- if (numbers.isNotEmpty)- LeaderboardNumbers(- key: ValueKey('leaderboard-numbers-$id'),- parts: numbers,- tooltip: numbersTooltip,- lines: numberLines,- ),- ],- ),- ),- Padding(- padding: const EdgeInsets.only(left: _gap),- child: SizedBox(- width: columns.points,- child: Align(- alignment: Alignment.centerRight,- child: Semantics(- label: plural(points, 'point'),- excludeSemantics: true,- child: Text(- '$points',- maxLines: 1,- style: leaderboardPointsStyle(),- ),- ),- ),- ),- ),- ],- ),- ),- ),- );-}--/// The PM or a Buddy, by name like a person: "PM · openharness" (the project-/// it leads) or "Buddy · dee" beside the name, and what they shipped beneath.-class LeaderboardAgentRow extends StatelessWidget {- const LeaderboardAgentRow({- super.key,- required this.score,- required this.agent,- required this.columns,- required this.weekName,- this.projectName,- this.ownerName,- });- final SuperTabAgentScore score;-- /// The agent as the Swarm shows it, for its avatar; null once it left.- final SuperTabAgent? agent;- final LeaderboardColumns columns;- final String weekName;-- /// The project the PM leads, and a Buddy's person, as the Swarm names them.- final String? projectName, ownerName;-- @override- Widget build(BuildContext context) {- final agent = this.agent;- return _ScoreRow(- id: 'agent-${score.agentId}',- rank: score.rank,- points: score.points,- columns: columns,- weekName: weekName,- crowned: score.rank == 1 && score.points > 0,- identity: agent == null- ? SuperTabAvatar(- identity: 'agent:${score.agentId}',- name: score.displayName,- size: SuperTabAvatar.rowSize,- pattern: true,- )- : SuperTabAvatar.agent(agent, size: SuperTabAvatar.rowSize),- name: score.displayName,- tag: score.buddy- ? ['Buddy', ?ownerName].join(' · ')- : ['PM', ?projectName].join(' · '),- numbers: [- if (score.shipped > 0)- score.buddy- ? plural(score.shipped, 'proposal shipped', 'proposals shipped')- : '${score.shipped} shipped',- ],- );- }-}--/// A model the temporary workers ran on, never an agent: "Opus · high", its-/// engine's mark, and its numbers in words; the time from the request's first-/// attempt on hover.-class LeaderboardModelRow extends StatelessWidget {- const LeaderboardModelRow({- super.key,- required this.score,- required this.columns,- required this.weekName,- });- final SuperTabModelScore score;- final LeaderboardColumns columns;- final String weekName;-- @override- Widget build(BuildContext context) {- final score = this.score;- final name = [- switch (score.model) {- final String model => modelDisplayName(model),- null => engineIdentity(score.engine).label,- },- ?score.effort,- ].join(' · ');- return _ScoreRow(- id: score.key,- rank: score.rank,- points: score.points,- columns: columns,- weekName: weekName,- // Crowns are for people and agents, not models (full review of #2097).- crowned: false,- identity: EngineMark(engine: score.engine),- name: name,- tag: score.grid ? 'grid' : null,- numbers: leaderboardModelNumbers(score),- numbersTooltip: leaderboardModelNumbers(score, full: true).join(' · '),- numberLines: 2,- );- }-}--/// A model's numbers in words, each left out at zero: "31 shipped", "82%-/// passed first review", "47 min to ship", "5 reviews". [full] is the hover-/// text: the counts behind the share, and the time from the request's first-/// attempt beside the shipping attempt's.-List<String> leaderboardModelNumbers(- SuperTabModelScore score, {- bool full = false,-}) {- final attempt = score.medianAttemptMs, request = score.medianRequestMs;- return [- if (score.shipped > 0) '${score.shipped} shipped',- if (score.reviewed > 0)- full- ? '${score.passed} of ${score.reviewed} passed first review'- : '${(score.passed * 100 / score.reviewed).round()}% passed first review',- if (attempt != null)- full- ? [- '${leaderboardDuration(attempt)} from the shipping attempt',- if (request != null)- '${leaderboardDuration(request)} from the first',- ].join(', ')- : '${leaderboardDuration(attempt)} to ship',- if (score.reviews > 0) plural(score.reviews, 'review'),- ];-}--/// A list with nothing to show this week, said as quiet text.-class LeaderboardEmpty extends StatelessWidget {- const LeaderboardEmpty(this.text, {super.key});- final String text;-- @override- Widget build(BuildContext context) => Padding(- padding: const EdgeInsets.fromLTRB(- DesktopChrome.groupGap,- 0,- DesktopChrome.groupGap,- DesktopChrome.controlGap / 2,- ),- child: Text(text, style: DesktopChrome.metadata()),- );-}diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dartindex d8df4c481..18a8ef237 100644--- a/desktop/lib/super_tabs/machines.dart+++ b/desktop/lib/super_tabs/machines.dart@@ -1,5 +1,6 @@import 'dart:async';+import 'package:clock/clock.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';@@ -517,23 +518,159 @@ class _MachinePickerState extends State<_MachinePicker> {}}-/// Adds a machine of the reader's to the Swarm through the Add machine form,-/// for Add a Buddy. Resolves to the added machine's id, null when it was not.-Future<String?> showAddMachine(- BuildContext context,+/// Sets [machineId]'s project up for the Swarm and asks what it offers+/// (`prepareContribution`), a second apart for up to five minutes. Null when+/// [alive] says the asker is gone or the reader can no longer write. [setupId]+/// names the setup, so asking again joins the one under way.+Future<Map<String, dynamic>?> _prepareContribution(SuperTabController c,- AppNotifier app, {- Future<MachineResources?> Function(String machineId)? readLocal,-}) => _contributeDialog(- context,- c,- app,- sampleOf: (_) => null,- canRemove: (_) => false,- removeReason: (_) => null,- remove: (_) {},- readLocal: readLocal,-);+ AppNotifier app,+ String machineId, {+ required String setupId,+ required bool Function() alive,+}) async {+ final deadline = clock.now().add(const Duration(minutes: 5));+ while (true) {+ if (!alive() || !c.canWrite) return null;+ final prepared = await app.superTabMachineRequest(machineId, {+ 'action': 'prepareContribution',+ 'tabId': c.tabId,+ 'scope': 'swarm',+ 'operationId': setupId,+ });+ if (prepared['state'] == 'ready' && prepared['scope'] == 'swarm') {+ return prepared;+ }+ if (prepared['state'] != 'preparing') {+ throw const SuperTabFailure(+ 'UPDATE_REQUIRED',+ 'Update Harness on this machine, then try again.',+ );+ }+ if (clock.now().isAfter(deadline)) {+ throw const SuperTabFailure(+ 'SETUP_PENDING',+ 'Project setup is still running. Try again to check its progress.',+ );+ }+ await Future<void>.delayed(const Duration(seconds: 1));+ }+}++/// The engines a prepared machine offers the Swarm.+List<String> _contributedEngines(Map<String, dynamic> prepared) {+ final engines =+ (prepared['engines'] as List?)+ ?.whereType<String>()+ .where((engine) => _chipEngines.contains(engine))+ .toSet()+ .toList() ??+ <String>[];+ if (engines.isEmpty) {+ throw const SuperTabFailure(+ 'NO_SWARM_ENGINE',+ 'Install Claude Code or Codex on this machine, then try again.',+ );+ }+ return engines;+}++/// Adds the prepared [machineId] to the Swarm, offering [maxAgents] slots.+/// False when [alive] says the asker is gone or the reader can no longer+/// write, in which case nothing was added.+Future<bool> _sendContribution(+ SuperTabController c,+ AppNotifier app,+ String machineId,+ Map<String, dynamic> prepared,+ List<String> engines, {+ required int maxAgents,+ required bool Function() alive,+}) async {+ // An earlier lost reply leaves an uncertain attempt holding its own+ // receipt, and only one action may be in flight: check that one first, then+ // send the number the owner is looking at — the stored attempt cannot know+ // it was changed.+ if (c.pendingCommand?['type'] == 'machine.contribute') {+ // If that attempt cannot be confirmed, its own error is the one worth+ // showing: it says why it is still unclear.+ if (await c.retry() == null) {+ if (!alive()) return false;+ throw SuperTabFailure(+ c.operationErrorCode ?? 'CONTRIBUTION_FAILED',+ c.operationError ?? 'The earlier attempt is still not confirmed. Try again to check it.',+ );+ }+ if (!alive() || !c.canWrite) return false;+ }+ final result = await c.command({+ 'type': 'machine.contribute',+ 'machineId': machineId,+ 'name': app.stateOf(machineId)!.machine.displayName,+ 'cwd': prepared['cwd'],+ if (prepared['scope'] != null) 'scope': prepared['scope'],+ 'engines': engines,+ 'maxAgents': maxAgents,+ });+ if (result == null) {+ throw SuperTabFailure(+ 'CONTRIBUTION_FAILED',+ c.operationError ?? 'Could not add this machine.',+ );+ }+ await app.wakeSuperTabHost(machineId);+ // This Mac, added while its person is here: macOS asks once for the Harness+ // Team account (cli/src/team/autoSetup.ts).+ if (app.stateOf(machineId)?.isLocalMachine == true) {+ unawaited(app.offerTeamAccount('contribute', tabId: c.tabId));+ }+ return true;+}++/// Adds the reader's own computer [machineId] to the Swarm as the Add machine+/// form does when its Add machine is clicked untouched: the slots its memory+/// suggests, else what preparation offered. Resolves to [machineId], null when+/// [alive] ended first. Throws a [SuperTabFailure] saying why it could not.+/// [setupId] is the caller's to keep between tries: a setup still running+/// answers the next try with the same one.+Future<String?> contributeComputer(+ SuperTabController c,+ AppNotifier app,+ String machineId, {+ required String setupId,+ required bool Function() alive,+}) async {+ final prepared = await _prepareContribution(+ c,+ app,+ machineId,+ setupId: setupId,+ alive: alive,+ );+ if (prepared == null) return null;+ final engines = _contributedEngines(prepared);+ MachineResources? resources;+ try {+ resources = await app.readMachineResources(machineId);+ } catch (_) {+ // The suggestion only sizes the offer; preparation's own number stands in.+ }+ final offered = prepared['maxAgents'];+ final slots =+ _suggestedAgentSlots(resources) ??+ (offered is num ? _clampAgentSlots(offered) : _agentSlotsMin);+ if (!alive() || !c.canWrite) return null;+ final added = await _sendContribution(+ c,+ app,+ machineId,+ prepared,+ engines,+ maxAgents: slots,+ alive: alive,+ );+ return added ? machineId : null;+}/// Why [m] cannot be added to the Swarm now, in the Add machine form's words;/// null when it can.@@ -817,49 +954,16 @@ Future<String?> _contributeDialog(});try {setupId ??= superTabOperationId();- final deadline = DateTime.now().add(const Duration(minutes: 5));- Map<String, dynamic> prepared;- while (true) {- if (!context.mounted || !c.canWrite) return;- prepared = await app.superTabMachineRequest(selected, {- 'action': 'prepareContribution',- 'tabId': c.tabId,- 'scope': 'swarm',- 'operationId': setupId,- });- if (prepared['state'] == 'ready' &&- prepared['scope'] == 'swarm') {- break;- }- if (prepared['state'] != 'preparing') {- throw const SuperTabFailure(- 'UPDATE_REQUIRED',- 'Update Harness on this machine, then try again.',- );- }- if (DateTime.now().isAfter(deadline)) {- throw const SuperTabFailure(- 'SETUP_PENDING',- 'Project setup is still running. Try again to check its progress.',- );- }- await Future<void>.delayed(const Duration(seconds: 1));- }+ final prepared = await _prepareContribution(+ c,+ app,+ selected,+ setupId: setupId!,+ alive: () => context.mounted,+ );+ if (prepared == null) return;if (!context.mounted || !c.canWrite) return;- final machine = app.stateOf(selected);- final engines =- (prepared['engines'] as List?)- ?.whereType<String>()- .where((engine) => _chipEngines.contains(engine))- .toSet()- .toList() ??- <String>[];- if (engines.isEmpty) {- throw const SuperTabFailure(- 'NO_SWARM_ENGINE',- 'Install Claude Code or Codex on this machine, then try again.',- );- }+ final engines = _contributedEngines(prepared);// A machine with no number of its own whose reading failed,// or had not answered yet, is showing the floor rather than// a suggestion. The owner never chose that, so send what@@ -876,46 +980,18 @@ Future<String?> _contributeDialog(offered is num) {slots = _clampAgentSlots(offered);}- // An earlier lost reply leaves an uncertain attempt holding- // its own receipt, and only one action may be in flight:- // check that one first, then send the number the owner is- // looking at — the stored attempt cannot know it was changed.- if (c.pendingCommand?['type'] == 'machine.contribute') {- // If that attempt cannot be confirmed, its own error is- // the one worth showing: it says why it is still unclear.- if (await c.retry() == null) {- if (!context.mounted) return;- throw SuperTabFailure(- c.operationErrorCode ?? 'CONTRIBUTION_FAILED',- c.operationError ??- 'The earlier attempt is still not confirmed. '- 'Try again to check it.',- );- }- if (!context.mounted || !c.canWrite) return;- }- final result = await c.command({- 'type': 'machine.contribute',- 'machineId': selected,- 'name': machine!.machine.displayName,- 'cwd': prepared['cwd'],- if (prepared['scope'] != null) 'scope': prepared['scope'],- 'engines': engines,- 'maxAgents': !isConfigure+ if (!await _sendContribution(+ c,+ app,+ selected,+ prepared,+ engines,+ maxAgents: !isConfigure? slots: atMost ?? memoryLimit(prepared),- });- if (result == null) {- throw SuperTabFailure(- 'CONTRIBUTION_FAILED',- c.operationError ?? 'Could not add this machine.',- );- }- await app.wakeSuperTabHost(selected);- // This Mac, added while its person is here: macOS asks once- // for the Harness Team account (cli/src/team/autoSetup.ts).- if (app.stateOf(selected)?.isLocalMachine == true) {- unawaited(app.offerTeamAccount('contribute', tabId: c.tabId));+ alive: () => context.mounted,+ )) {+ return;}added = selected;if (context.mounted) Navigator.pop(context);diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dartindex 0248a0657..223776fc7 100644--- a/desktop/lib/super_tabs/project_sidebar.dart+++ b/desktop/lib/super_tabs/project_sidebar.dart@@ -16,6 +16,8 @@ import '../widgets/desktop_chrome.dart';import '../widgets/harness_activity_mark.dart';import 'controller.dart';import 'identity.dart';+import 'leaderboard/models_section.dart';+import 'leaderboard/reader.dart';import 'local_models.dart';import 'buddies.dart';import 'machines.dart';@@ -45,6 +47,7 @@ class ProjectSidebar extends StatelessWidget {this.onOpenAgent,this.onOpenBuddyChat,this.readLocal,+ this.board,this.now = DateTime.now,});final SuperTabController controller;@@ -65,6 +68,10 @@ class ProjectSidebar extends StatelessWidget {/// controller's [SuperTabController.openBuddyChat] when not given.final ValueChanged<String>? onOpenBuddyChat;+ /// The open project's week board the right pane shows, for Models; none+ /// without it.+ final SuperTabLeaderboardReader? board;+/// Forwarded to the embedded [SuperTabMachines]; a test gives it to have/// the Machines group's readings taken without a real machine.@visibleForTesting@@ -876,6 +883,14 @@ class ProjectSidebar extends StatelessWidget {);},),+ if (board case final board?) ...[+ const SizedBox(height: 16),+ LeaderboardModelsSection(+ board: board,+ projectId: snapshot?.projectFor(controller.selectedId)?.id,+ now: now,+ ),+ ],],),);diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dartindex 7ab927636..067746a45 100644--- a/desktop/lib/super_tabs/roster.dart+++ b/desktop/lib/super_tabs/roster.dart@@ -1,19 +1,17 @@import 'dart:async';+import 'package:collection/collection.dart' show mergeSort;import 'package:flutter/material.dart';-import '../shared/theme/app_icons.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/theme/appearance_prefs_store.dart';import '../shared/widgets/app_dialog.dart';-import '../shared/widgets/app_icon_button.dart';import '../shared/widgets/app_select_field.dart';import '../state/app_state.dart';import '../state/harness_activity.dart';import '../terminal/terminal_theme.dart';import '../terminal/terminal_theme_store.dart';import '../widgets/desktop_chrome.dart';-import '../widgets/finger_target.dart';import '../widgets/engine_identity.dart';import '../widgets/harness_activity_mark.dart';import 'agent_details.dart';@@ -25,9 +23,7 @@ import 'leaderboard/format.dart';import 'leaderboard/model.dart';import 'leaderboard/person_row.dart';import 'leaderboard/reader.dart';-import 'leaderboard/tabs.dart';import 'leaderboard/waiting_line.dart';-import 'leaderboard/worker_rows.dart';import 'model.dart';import 'profile_sheet.dart';import 'section_heading.dart';@@ -45,6 +41,7 @@ class SuperTabRoster extends StatefulWidget {required this.onAddAgent,required this.onAnswer,this.app,+ this.board,this.now = DateTime.now,});final SuperTabController controller;@@ -55,6 +52,10 @@ class SuperTabRoster extends StatefulWidget {/// Opens a conversation where an agent waits on a person.final ValueChanged<String> onAnswer;++ /// The open project's week board, shared with the sidebar's Models; the+ /// roster reads its own when not given.+ final SuperTabLeaderboardReader? board;final DateTime Function() now;@overrideState<SuperTabRoster> createState() => _SuperTabRosterState();@@ -63,39 +64,14 @@ class SuperTabRoster extends StatefulWidget {class _SuperTabRosterState extends State<SuperTabRoster> {SuperTabController get c => widget.controller;- /// The board moves only as work ships, is answered or runs: every five- /// minutes is fresh enough, and keeps every open roster's reads rare.- late final _board = SuperTabLeaderboardReader(- tabId: c.tabId,- request: c.request,- every: const Duration(minutes: 5),- );- String? _boardProject;-- /// Which of the board's lists shows: people, agents or models.- var _tab = LeaderboardTab.humans;-- /// The project of the open conversation, whose board Humans show.- String get _projectId => c.snapshot?.projectFor(c.selectedId)?.id ?? 'lead';-- void _followProject() {- final projectId = _projectId;- if (projectId == _boardProject) return;- _boardProject = projectId;- unawaited(_board.show(projectId));- }-- @override- void initState() {- super.initState();- c.addListener(_followProject);- _followProject();- }+ /// The board read here when the view shares none.+ SuperTabProjectBoard? _ownBoard;+ late final SuperTabLeaderboardReader _board =+ widget.board ?? (_ownBoard = SuperTabProjectBoard(c));@overridevoid dispose() {- c.removeListener(_followProject);- _board.dispose();+ _ownBoard?.dispose();super.dispose();}@@ -356,7 +332,15 @@ class _SuperTabRosterState extends State<SuperTabRoster> {},);- Widget _agent(SuperTabAgent agent) {+ /// An agent's row: today's identity and status line, and on a board its+ /// [rank] at the start and [points] at the end, in the people's columns.+ /// An agent the board does not score keeps both columns empty.+ Widget _agent(+ SuperTabAgent agent, {+ LeaderboardColumns? columns,+ int? rank,+ int? points,+ }) {final name = c.snapshot!.agentName(agent.id), activity = _activity(agent);final info = SuperTabAgentInfo(c, widget.app, agent, activity: activity);// One line, readable in a second (Dee, 2026-10-27): state, machine, model and effort. The task is in the tooltip.@@ -436,6 +420,21 @@ class _SuperTabRosterState extends State<SuperTabRoster> {contentPadding: const EdgeInsets.symmetric(horizontal: 16),title: Row(children: [+ if (columns != null) ...[+ SizedBox(+ width: columns.rank,+ child: rank == null+ ? null+ : Text(+ '$rank',+ key: ValueKey('super-member-rank-${agent.id}'),+ maxLines: 1,+ textAlign: TextAlign.right,+ style: leaderboardRankStyle(),+ ),+ ),+ const SizedBox(width: DesktopChrome.controlGap),+ ],SuperTabAvatar.agent(agent,name: name,@@ -446,10 +445,42 @@ class _SuperTabRosterState extends State<SuperTabRoster> {Expanded(child: _agentIdentity(name, role, badge)),const SizedBox(width: 8),EngineMark(engine: agent.engine, size: 14),+ if (columns != null)+ Padding(+ padding: const EdgeInsets.only(+ left: DesktopChrome.controlGap,+ ),+ child: SizedBox(+ width: columns.points,+ child: points == null+ ? null+ : Align(+ alignment: Alignment.centerRight,+ child: Semantics(+ label: plural(points, 'point'),+ excludeSemantics: true,+ child: Text(+ '$points',+ key: ValueKey(+ 'super-member-points-${agent.id}',+ ),+ maxLines: 1,+ style: leaderboardPointsStyle(),+ ),+ ),+ ),+ ),+ ),],),subtitle: Padding(- padding: const EdgeInsets.only(left: 32),+ padding: EdgeInsets.only(+ left:+ 32 ++ (columns == null+ ? 0+ : columns.rank + DesktopChrome.controlGap),+ ),child: Row(children: [ActivityMark(@@ -510,7 +541,13 @@ class _SuperTabRosterState extends State<SuperTabRoster> {.where((p) => audience == null || audience.contains(p.id)).toList() ??const <SuperTabPerson>[];- final board = _board.board;+ // Only the open project's board: an answer for any other never lends+ // its numbers to these rows.+ final board = switch (_board.board) {+ final board? when projectId != null && board.projectId == projectId =>+ board,+ _ => null,+ };final scores = {for (final score in board?.people ?? const []) score.personId: score,};@@ -523,16 +560,44 @@ class _SuperTabRosterState extends State<SuperTabRoster> {.nonNulls,...people.where((p) => !scores.containsKey(p.id)),];+ // The agents the board scores (the PM; Buddies are not listed here) by+ // their points, ranked among themselves, then the rest in today's order+ // with no rank and no number: a column of zeros means nothing (Lead,+ // 2026-10-29). Matched by id, never by name.+ final agentPoints = {+ for (final score in board?.agents ?? const <SuperTabAgentScore>[])+ score.agentId: score.points,+ };+ final listed = [...leads, ...agents];+ final scored = listed.where((a) => agentPoints.containsKey(a.id)).toList();+ mergeSort(+ scored,+ compare: (a, b) => agentPoints[b.id]! - agentPoints[a.id]!,+ );+ final agentRanks = <String, int>{};+ for (var i = 0; i < scored.length; i++) {+ final points = agentPoints[scored[i].id]!;+ agentRanks[scored[i].id] =+ i > 0 && points == agentPoints[scored[i - 1].id]+ ? agentRanks[scored[i - 1].id]!+ : i + 1;+ }final current = leaderboardWeekOf(widget.now());- // One set of numeric columns for every row.- final columns = board == null || board.people.isEmpty+ // One set of numeric columns for every row, people's and agents'.+ final columns = board == null || (board.people.isEmpty && scored.isEmpty)? null- : LeaderboardColumns.of(context, board.people);+ : LeaderboardColumns.measure(+ context,+ ranks: [...board.people.map((s) => s.rank), ...agentRanks.values],+ points: [+ ...board.people.map((s) => s.points),+ for (final agent in scored) agentPoints[agent.id]!,+ ],+ );final week = weekName(_board.week, current);return [- LeaderboardHeader(- selected: _tab,- onSelect: (tab) => setState(() => _tab = tab),+ SuperTabSectionHeading(+ 'Humans',actions: [if (board != null || _board.week != null)AppSelectField<int>(@@ -553,17 +618,9 @@ class _SuperTabRosterState extends State<SuperTabRoster> {onChanged: (week) =>unawaited(_board.showWeek(week == current ? null : week)),),- if (c.isOwner && _tab == LeaderboardTab.humans)- // A phone's add action is a finger's size, as the headings' is.- fingerTarget(- enabled: workspaceIsCompact(context),- AppIconButton(- icon: AppIcons.plus,- tooltip: 'Invite people',- onPressed: widget.onInvite,- ),- ),],+ onAdd: c.isOwner ? widget.onInvite : null,+ addTooltip: 'Invite people',),if (_board.error case final error?)Padding(@@ -575,33 +632,27 @@ class _SuperTabRosterState extends State<SuperTabRoster> {),child: Text(error, style: DesktopChrome.metadata()),),- if (_tab == LeaderboardTab.agents)- ..._agentScores(board, week)- else if (_tab == LeaderboardTab.models)- ..._modelScores(board, week)- else ...[- for (final person in ranked)- LeaderboardPersonRow(- person: person,- score: scores[person.id],- columns: columns,- own: person.id == c.accountId,- weekName: week,- onTap: () => _person(person, scores[person.id]),- ),- if (board != null && board.waiting.total > 0)- LeaderboardWaitingLine(- waiting: board.waiting,- viewerId: c.accountId,- nameOf: (id) {- final person = state?.people.where((p) => p.id == id).firstOrNull;- return person == null- ? 'Former member'- : leaderboardName(person, scores[id]);- },- onAnswer: widget.onAnswer,- ),- ],+ for (final person in ranked)+ LeaderboardPersonRow(+ person: person,+ score: scores[person.id],+ columns: columns,+ own: person.id == c.accountId,+ weekName: week,+ onTap: () => _person(person, scores[person.id]),+ ),+ if (board != null && board.waiting.total > 0)+ LeaderboardWaitingLine(+ waiting: board.waiting,+ viewerId: c.accountId,+ nameOf: (id) {+ final person = state?.people.where((p) => p.id == id).firstOrNull;+ return person == null+ ? 'Former member'+ : leaderboardName(person, scores[id]);+ },+ onAnswer: widget.onAnswer,+ ),const SizedBox(height: DesktopChrome.groupGap),SuperTabSectionHeading('Agents',@@ -616,62 +667,19 @@ class _SuperTabRosterState extends State<SuperTabRoster> {: null,addTooltip: 'Add agent',),- for (final agent in [...leads, ...agents]) _agent(agent),- ];- }-- /// The project's PM and Buddies, ranked like people (Dee, 2026-10-29).- List<Widget> _agentScores(SuperTabLeaderboard? board, String week) {- final scores = board?.agents ?? const <SuperTabAgentScore>[];- if (board == null) return const [];- if (scores.isEmpty) {- return const [LeaderboardEmpty('No PM or Buddy in this project yet')];- }- final snapshot = c.snapshot;- final columns = LeaderboardColumns.measure(- context,- ranks: scores.map((s) => s.rank),- points: scores.map((s) => s.points),- );- return [- for (final score in scores)- LeaderboardAgentRow(- score: score,- agent: snapshot?.agents- .where((a) => a.id == score.agentId)- .firstOrNull,+ for (final agent in [+ ...scored,+ ...listed.where((a) => !agentPoints.containsKey(a.id)),+ ])+ _agent(+ agent,columns: columns,- weekName: week,- projectName: snapshot?.projects- .where((p) => p.id == board.projectId)- .firstOrNull- ?.name,- ownerName: switch (snapshot?.people- .where((p) => p.id == score.personId)- .firstOrNull) {- final person? => superTabPersonName(person.email),- null => null,- },+ rank: agentRanks[agent.id],+ points: agentPoints[agent.id],),];}- /// The models the Builders and Reviewers ran on, never the agents.- List<Widget> _modelScores(SuperTabLeaderboard? board, String week) {- final scores = board?.byModel ?? const <SuperTabModelScore>[];- if (board == null) return const [];- if (scores.isEmpty) return [LeaderboardEmpty('No model worked $week')];- final columns = LeaderboardColumns.measure(- context,- ranks: scores.map((s) => s.rank),- points: scores.map((s) => s.points),- );- return [- for (final score in scores)- LeaderboardModelRow(score: score, columns: columns, weekName: week),- ];- }-@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex 8e13a2f0f..05ada8f7b 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -19,12 +19,14 @@ import '../state/app_state.dart';import '../state/harness_attachments.dart';import '../state/workspace_chrome.dart';import 'chat_scroll.dart';+import 'leaderboard/reader.dart';import 'unread_line.dart';import 'roster.dart';import 'recording_notice.dart';import 'identity.dart' show superTabPersonName;import 'profile_actions.dart';import 'pull_requests.dart';+import 'composer_newline.dart';import 'controller.dart';import 'dialog_scope.dart';import 'folder_zip.dart';@@ -157,6 +159,10 @@ class _SuperTabViewState extends State<SuperTabView>final _completionKeys = List.generate(6, (_) => GlobalKey());SuperTabController get c => widget.controller;+ /// The open project's week board, read once for the right pane's members+ /// and the left sidebar's Models, so both show one week.+ late SuperTabProjectBoard _board = SuperTabProjectBoard(c);+/// A device with a Lead of this Swarm open scrolls the chat on screen.late final _dial = DialListScroll(() => _scroll[c.selectedId]);VoidCallback? _unregisterDial;@@ -228,6 +234,8 @@ class _SuperTabViewState extends State<SuperTabView>_registerDial();}if (oldWidget.controller != c) {+ _board.dispose();+ _board = SuperTabProjectBoard(c);oldWidget.controller.removeListener(_changed);if (oldWidget.controller.buddyChatOpener == _openBuddyChat) {oldWidget.controller.buddyChatOpener = null;@@ -529,6 +537,7 @@ class _SuperTabViewState extends State<SuperTabView>@overridevoid dispose() {WidgetsBinding.instance.removeObserver(this);+ _board.dispose();c.removeListener(_changed);for (final source in _linkSources) {source.removeListener(_linkSourceChanged);@@ -703,6 +712,22 @@ class _SuperTabViewState extends State<SuperTabView>);}+ /// The box was edited: keep it as this chat's draft and drop the pick state.+ void _composerEdited(String text) {+ c.setDraft(c.selectedId, text);+ _mentionIndex.value = 0;+ _dismissedMention.value = null;+ }++ /// A line break at the cursor. The field only calls [_composerEdited] for+ /// edits that come from the platform, so this reports its own.+ void _insertNewline() {+ final value = withNewline(_composer.value);+ if (value == null) return;+ _composer.value = value;+ _composerEdited(value.text);+ }+void _composerMoved() {if (!mounted) return;final value = _composer.value;@@ -1210,6 +1235,7 @@ class _SuperTabViewState extends State<SuperTabView>Widget _sidebar() => ProjectSidebar(controller: c,app: widget.app,+ board: _board,onAddAgent: widget.onAddAgent,onNewProject: widget.onNewProject,devicesSelected: _devicesVisible,@@ -3124,18 +3150,23 @@ class _SuperTabViewState extends State<SuperTabView>_readAll()) {return KeyEventResult.handled;}- if (_focus.hasFocus &&+ final enterDown =+ _focus.hasFocus &&event is KeyDownEvent &&event.logicalKey == LogicalKeyboardKey.enter &&- !keys.isShiftPressed &&- !keys.isControlPressed &&- !keys.isMetaPressed &&- !keys.isAltPressed &&- !(composing.isValid && !composing.isCollapsed)) {- unawaited(_send());+ !(composing.isValid && !composing.isCollapsed);+ if (!enterDown) return KeyEventResult.ignored;+ if (keys.isControlPressed || keys.isMetaPressed) {+ return KeyEventResult.ignored;+ }+ // Shift+Enter and Alt+Enter write the line themselves: the platform+ // gives Option+Return none, and a handled key never reaches it.+ if (keys.isShiftPressed || keys.isAltPressed) {+ _insertNewline();return KeyEventResult.handled;}- return KeyEventResult.ignored;+ unawaited(_send());+ return KeyEventResult.handled;},child: DecoratedBox(key: const ValueKey('super-message-composer-surface'),@@ -3206,7 +3237,7 @@ class _SuperTabViewState extends State<SuperTabView>600? 3: 8,- maxLength: 32000,+ maxLength: kComposerMaxLength,inputFormatters: [_tagBackspace],keyboardType: TextInputType.multiline,textAlignVertical:@@ -3237,11 +3268,7 @@ class _SuperTabViewState extends State<SuperTabView>filled: false,counterText: '',),- onChanged: (text) {- c.setDraft(c.selectedId, text);- _mentionIndex.value = 0;- _dismissedMention.value = null;- },+ onChanged: _composerEdited,),),),@@ -3350,8 +3377,11 @@ class _SuperTabViewState extends State<SuperTabView>}_chatCovered = chatCovered;final roster = SuperTabRoster(+ // A new board is a new roster: the old one read another Swarm.+ key: ObjectKey(_board),controller: c,app: widget.app,+ board: _board,onInvite: widget.onInvite,onOpenAgent: (agent) {setState(() {diff --git a/desktop/lib/widgets/new_harness_form.dart b/desktop/lib/widgets/new_harness_form.dartindex f54fd999b..08abd5585 100644--- a/desktop/lib/widgets/new_harness_form.dart+++ b/desktop/lib/widgets/new_harness_form.dart@@ -2163,20 +2163,12 @@ class NewHarnessFormState extends State<NewHarnessForm> {/// New Project waits.Widget _desktopLeadLine() {final blocked = box.leadBlocked;- final machine = box.leadMachine?.name ?? box.machineLabel;return Row(key: const ValueKey('new-harness-lead-line'),children: [Flexible(child: Text(- blocked ??- [- 'Product Manager: $machine',- box.agentLabel,- box.leadModelLabel,- if (box.leadClones)- '${box.project.repository!.name} will be cloned there',- ].join(' · '),+ blocked ?? box.leadLine,maxLines: 2,overflow: TextOverflow.ellipsis,style: DesktopChrome.text(size: 12, color: DesktopChrome.muted),@@ -2281,7 +2273,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {child: _desktopChoiceButton(_Row.model, AppIcons.brain),),),- if (box.usesProfile)+ // Your machine's account and branches say nothing about a+ // machine the Swarm starts it on.+ if (box.usesProfile && !box.leadThroughSwarm)setting('Account',_desktopField(@@ -2290,7 +2284,8 @@ class NewHarnessFormState extends State<NewHarnessForm> {child: _desktopChoiceButton(_Row.profile, AppIcons.user),),),- if (box.isGitProject || box.checkingGit || box.gitError != null)+ if (!box.leadThroughSwarm &&+ (box.isGitProject || box.checkingGit || box.gitError != null))setting('Start from',_desktopField(@@ -2318,7 +2313,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {String? repository,double order,) {- final chosen = machine.id == box.machineId;+ final chosen = machine.id == box.leadMachine?.id && !box.leadQueued;final enabled = machine.startable && !box.locked;final detail = leadMachineDetail(machine, repository);return KeyedSubtree(diff --git a/desktop/test/keyboard_practice_test.dart b/desktop/test/keyboard_practice_test.dartindex 8874bf22b..9e1189d2d 100644--- a/desktop/test/keyboard_practice_test.dart+++ b/desktop/test/keyboard_practice_test.dart@@ -533,4 +533,18 @@ void main() {await tester.pumpWidget(const SizedBox());},);++ test('the shortcut list names the Swarm chat box newline keys', () {+ final map = MemoryKeymap();+ addTearDown(map.dispose);+ final lesson = keyboardLessons(map)+ .singleWhere((l) => l.command == 'edit.chat_newline');+ expect(lesson.label, 'New line in a chat message');+ expect(lesson.group, 'Swarm chat box');+ expect(lesson.bindings.map((b) => b.sequence), [+ 'shift+enter',+ 'alt+enter',+ ]);+ expect(lesson.result, contains('Enter sends'));+ });}diff --git a/desktop/test/super_tab_avatar_test.dart b/desktop/test/super_tab_avatar_test.dartindex 6f7581489..8ecc2a872 100644--- a/desktop/test/super_tab_avatar_test.dart+++ b/desktop/test/super_tab_avatar_test.dart@@ -60,6 +60,26 @@ void main() {},);+ // The round dial draws Buddies from cli/src/superTabs/buddyAvatar.ts; these+ // vectors pin both to the same half bits and dark-mode tone.+ test('a Buddy\'s pattern matches the dial\'s vectors', () {+ int halfBits(List<bool> cells) {+ var bits = 0;+ for (var i = 0; i < 15; i++) {+ if (cells[(i ~/ 3) * 5 + i % 3]) bits |= 1 << i;+ }+ return bits;+ }++ Color darkTone(double hue) => HSLColor.fromAHSL(1, hue, .42, .72).toColor();+ final diego = superTabAgentPattern("diego's Buddy");+ expect((halfBits(diego.cells), diego.hue), (25513, 13.0));+ expect(darkTone(diego.hue), const Color(0xffd6a79a));+ final ken = superTabAgentPattern("ken's Buddy");+ expect((halfBits(ken.cells), ken.hue), (30735, 327.0));+ expect(darkTone(ken.hue), const Color(0xffd69abb));+ });+testWidgets('an agent without a picture shows its pattern and engine badge', (tester,) async {diff --git a/desktop/test/super_tab_buddy_add_machine_test.dart b/desktop/test/super_tab_buddy_add_machine_test.dartdeleted file mode 100644index bbe310f4c..000000000--- a/desktop/test/super_tab_buddy_add_machine_test.dart+++ /dev/null@@ -1,220 +0,0 @@-import 'dart:io';--import 'package:flutter/foundation.dart';-import 'package:flutter/material.dart';-import 'package:flutter_test/flutter_test.dart';-import 'package:harness/shared/theme/app_theme.dart' as grid;-import 'package:harness/super_tabs/buddies.dart';-import 'package:harness/super_tabs/controller.dart';-import 'package:harness/super_tabs/identity.dart';-import 'package:harness/super_tabs/view.dart';--import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;-import 'support/capture.dart';--/// Add a Buddy for a person with no machine in the Swarm (Scholes, 10-29): the-/// dialog offers this computer through the Add machine flow instead of ending.-/// Set to a folder to write the PR's pictures there.-final shots = Platform.environment['SUPER_TAB_BUDDY_SHOTS'];--void main() {- setUpAll(() => loadCaptureFonts(shots));-- Future<({SuperTabLaunchFixture f, SuperTabController c})> open(- WidgetTester tester, {- Brightness brightness = Brightness.light,- void Function(SuperTabLaunchFixture f)? prepare,- }) async {- debugDefaultTargetPlatformOverride = TargetPlatform.macOS;- final f = SuperTabLaunchFixture();- f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');- final server = f.connection.server;- server.state['buddies'] = true;- server.state['machines'] = <dynamic>[];- server.state['project'] = {- 'machineId': 'm',- 'cwd': '/work/project',- 'scope': 'swarm',- 'repositoryUrl': null,- };- prepare?.call(f);- final c = await f.app.superTabs.open(tabId);- await c.refresh();- await tester.binding.setSurfaceSize(const Size(1280, 800));- addTearDown(() => tester.binding.setSurfaceSize(null));- await tester.pumpWidget(- MaterialApp(- theme: grid.buildAppTheme(brightness: brightness),- home: Scaffold(- body: Builder(- builder: (context) => TextButton(- onPressed: () => showAddBuddy(context, c, app: f.app),- child: const Text('Open'),- ),- ),- ),- ),- );- await tester.tap(find.text('Open'));- await tester.pumpAndSettle();- return (f: f, c: c);- }-- Future<void> close(- WidgetTester tester,- SuperTabLaunchFixture f,- SuperTabController c,- ) async {- debugDefaultTargetPlatformOverride = null;- await tester.pumpWidget(const SizedBox());- await c.flush();- f.app.superTabs.dispose();- await tester.pump();- }-- final addThisMac = find.widgetWithText(TextButton, 'Add this Mac');- final submit = find.widgetWithText(FilledButton, 'Add Buddy');-- testWidgets(- 'with no machine of theirs in the Swarm, it offers to add this Mac',- (tester) async {- final (:f, :c) = await open(tester);-- expect(- find.text('None of your machines is in this Swarm yet.'),- findsOneWidget,- );- expect(addThisMac, findsOneWidget);- expect(- find.textContaining('Add one of yours to this Swarm first'),- findsNothing,- );- expect(tester.widget<FilledButton>(submit).onPressed, isNull);- await close(tester, f, c);- },- );-- testWidgets('adding this Mac returns to Add a Buddy with it selected', (- tester,- ) async {- final (:f, :c) = await open(tester);- final name = f.app.stateOf('m')!.machine.displayName;-- await tester.tap(addThisMac);- await tester.pumpAndSettle();- expect(find.text('Add machine'), findsWidgets);- await tester.tap(find.widgetWithText(FilledButton, 'Add machine'));- for (var i = 0; i < 20; i++) {- await tester.pump(const Duration(seconds: 1));- }- await tester.pumpAndSettle();-- expect(find.text('Add a Buddy'), findsOneWidget);- expect(find.text('Add machine'), findsNothing);- expect(- find.descendant(- of: find.byKey(const ValueKey('super-buddy-machine')),- matching: find.text(superTabMachineName(name)),- ),- findsOneWidget,- );- expect(tester.widget<FilledButton>(submit).onPressed, isNotNull);- expect(addThisMac, findsNothing);- await close(tester, f, c);- });-- testWidgets('a computer that cannot be added shows the flow\'s own reason', (- tester,- ) async {- final (:f, :c) = await open(- tester,- prepare: (f) => f.app.machineStates['m']!.nodeOnline = false,- );-- expect(- find.text('Offline. Open Harness on this computer to add it.'),- findsOneWidget,- );- expect(tester.widget<TextButton>(addThisMac).onPressed, isNull);- expect(tester.widget<FilledButton>(submit).onPressed, isNull);- await close(tester, f, c);- });-- for (final brightness in Brightness.values) {- testWidgets('pictures in ${brightness.name}', (tester) async {- if (shots == null) return;- final previous = grid.AppTheme.brightness.value;- grid.AppTheme.brightness.value = brightness;- addTearDown(() => grid.AppTheme.brightness.value = previous);- final (:f, :c) = await open(tester, brightness: brightness);- await captureWindow(tester, shots, 'buddy-no-machine-${brightness.name}');- await tester.tap(addThisMac);- await tester.pumpAndSettle();- await captureWindow(- tester,- shots,- 'buddy-add-machine-${brightness.name}',- );- await tester.tap(find.widgetWithText(FilledButton, 'Add machine'));- for (var i = 0; i < 20; i++) {- await tester.pump(const Duration(seconds: 1));- }- await tester.pumpAndSettle();- await captureWindow(tester, shots, 'buddy-added-${brightness.name}');- await close(tester, f, c);- });- }-- testWidgets(- "the Buddy chat's Start bar offers this Mac too, for a person with no machine in the Swarm (merge review of #2090)",- (tester) async {- debugDefaultTargetPlatformOverride = TargetPlatform.macOS;- final f = SuperTabLaunchFixture();- f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');- f.connection.server.state['machines'] = <dynamic>[];- final c = await f.app.superTabs.open(tabId);- await c.refresh();- await tester.binding.setSurfaceSize(const Size(1280, 800));- addTearDown(() => tester.binding.setSurfaceSize(null));- await tester.pumpWidget(- MaterialApp(- theme: grid.buildAppTheme(brightness: Brightness.light),- home: Scaffold(- body: SuperTabView(- controller: c,- app: f.app,- onInvite: () {},- onAddAgent: (_) {},- onOpenTerminal: (_) {},- machineName: (_) => 'Team Mac',- ),- ),- ),- );- await tester.pumpAndSettle();- // What the shortcut does: the Buddy chat, even with no Buddy.- expect(await c.openCurrentBuddyChat(), isTrue);- await tester.pumpAndSettle();-- final start = find.byKey(const ValueKey('super-buddy-start'));- expect(- find.descendant(- of: start,- matching: find.text('None of your machines is in this Swarm yet.'),- ),- findsOneWidget,- );- expect(- find.descendant(- of: start,- matching: find.textContaining('Add one of yours'),- ),- findsNothing,- );- await tester.tap(find.descendant(of: start, matching: addThisMac));- await tester.pumpAndSettle();- expect(find.text('Add machine'), findsWidgets);- await close(tester, f, c);- },- );-}diff --git a/desktop/test/super_tab_buddy_this_mac_test.dart b/desktop/test/super_tab_buddy_this_mac_test.dartnew file mode 100644index 000000000..6cf324139--- /dev/null+++ b/desktop/test/super_tab_buddy_this_mac_test.dart@@ -0,0 +1,635 @@+import 'dart:io';++import 'package:flutter/foundation.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/core/models.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/buddies.dart';+import 'package:harness/super_tabs/buddy_machines.dart';+import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/identity.dart';+import 'package:harness/super_tabs/view.dart';++import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;+import 'support/capture.dart';++/// The Buddy picker offers the Mac running Harness (Dee, 10-29): when it is+/// the reader's own and not in the Swarm yet, Start adds it and then starts the+/// Buddy there, in one click.+/// Set to a folder to write the PR's pictures there.+final shots = Platform.environment['SUPER_TAB_BUDDY_SHOTS'];++void main() {+ setUpAll(() => loadCaptureFonts(shots));++ const notInSwarm = 'Not in this Swarm yet: Start adds it';+ const notInSwarmDialog = 'Not in this Swarm yet: Add Buddy adds it';++ /// Another machine of the reader's, already in the Swarm.+ Map<String, dynamic> rig() => {+ 'machineId': 'rig',+ 'name': '2x 4090 Rig',+ 'contributorId': 'owner',+ 'scope': 'swarm',+ 'engines': <dynamic>['claude'],+ 'maxAgents': 4,+ 'availableSlots': 4,+ };++ Future<({SuperTabLaunchFixture f, SuperTabController c, String mac})> open(+ WidgetTester tester, {+ List<Map<String, dynamic>> machines = const [],+ bool bar = true,+ Brightness brightness = Brightness.light,+ void Function(SuperTabLaunchFixture f)? prepare,++ /// Changes the Mac once the Swarm is open, as the account's machine list+ /// does while the app runs.+ void Function(SuperTabLaunchFixture f)? afterOpen,+ }) async {+ debugDefaultTargetPlatformOverride = TargetPlatform.macOS;+ final f = SuperTabLaunchFixture();+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ final server = f.connection.server;+ server.state['buddies'] = true;+ server.state['machines'] = <dynamic>[...machines];+ prepare?.call(f);+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ await tester.binding.setSurfaceSize(const Size(1280, 800));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: brightness),+ home: Scaffold(+ body: bar+ ? SuperTabView(+ controller: c,+ app: f.app,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Team Mac',+ )+ : Builder(+ builder: (context) => TextButton(+ onPressed: () => showAddBuddy(context, c, app: f.app),+ child: const Text('Open'),+ ),+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ if (bar) {+ expect(await c.openCurrentBuddyChat(), isTrue);+ } else {+ await tester.tap(find.text('Open'));+ }+ await tester.pumpAndSettle();+ if (afterOpen != null) {+ afterOpen(f);+ await c.refresh();+ await tester.pumpAndSettle();+ }+ return (+ f: f,+ c: c,+ mac: superTabMachineName(f.app.stateOf('m')!.machine.displayName),+ );+ }++ Future<void> close(+ WidgetTester tester,+ SuperTabLaunchFixture f,+ SuperTabController c,+ ) async {+ debugDefaultTargetPlatformOverride = null;+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ f.app.superTabs.dispose();+ await tester.pump();+ }++ /// Lets the Add machine setup poll (it waits a second between asks) finish.+ Future<void> settle(WidgetTester tester) async {+ for (var i = 0; i < 20; i++) {+ await tester.pump(const Duration(seconds: 1));+ }+ await tester.pumpAndSettle();+ }++ List<String> sent(SuperTabLaunchFixture f) => [+ for (final post in f.connection.server.posts)+ if ((post['command'] as Map)['type'] case final String type+ when type == 'machine.contribute' || type == 'buddy.create')+ '$type ${(post['command'] as Map)['machineId']}',+ ];++ final barMachine = find.byKey(const ValueKey('super-buddy-start-machine'));+ final dialogMachine = find.byKey(const ValueKey('super-buddy-machine'));+ final start = find.widgetWithText(FilledButton, 'Start');+ final addBuddy = find.widgetWithText(FilledButton, 'Add Buddy');++ /// The open menu's rows, top to bottom.+ List<String> menuRows(WidgetTester tester, List<String> names) =>+ (names.where((n) => find.text(n).evaluate().isNotEmpty).toList()..sort(+ (a, b) => tester+ .getTopLeft(find.text(a).last)+ .dy+ .compareTo(tester.getTopLeft(find.text(b).last).dy),+ ));++ group('the Start bar', () {+ testWidgets('lists this Mac first, picked, with what Start does', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);++ expect(+ find.descendant(of: barMachine, matching: find.text('This Mac · $mac')),+ findsOneWidget,+ );+ await tester.tap(barMachine);+ await tester.pumpAndSettle();+ // Beside the Mac's row in the menu, as well as under the bar.+ expect(find.text(notInSwarm), findsNWidgets(2));+ expect(menuRows(tester, ['This Mac · $mac', '2x 4090 Rig']), [+ 'This Mac · $mac',+ '2x 4090 Rig',+ ]);+ await close(tester, f, c);+ });++ testWidgets('says Start adds this Mac before the menu is opened', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);++ expect(find.text(notInSwarm), findsOneWidget);+ // Under the bar's row, not inside the field.+ expect(+ tester.getTopLeft(find.text(notInSwarm)).dy,+ greaterThan(tester.getBottomLeft(barMachine).dy),+ );+ await close(tester, f, c);+ });++ testWidgets(+ 'says nothing when the picked machine is already in the Swarm',+ (tester) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);++ await tester.tap(barMachine);+ await tester.pumpAndSettle();+ await tester.tap(find.text('2x 4090 Rig').last);+ await tester.pumpAndSettle();++ expect(find.text(notInSwarm), findsNothing);+ await close(tester, f, c);+ },+ );++ testWidgets('a retry while setup is still running joins that setup', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);+ f.connection.keepPreparing = true;+ List<Object?> setups() => [+ for (final call in f.connection.calls)+ if (call.$2['action'] == 'prepareContribution')+ call.$2['operationId'],+ ];++ await tester.tap(start);+ await settle(tester);+ for (var i = 0; i < 6; i++) {+ await tester.pump(const Duration(seconds: 60));+ }+ await tester.pumpAndSettle();+ expect(find.textContaining('still running'), findsOneWidget);+ final first = setups().toSet();+ expect(first, hasLength(1));++ f.connection.keepPreparing = false;+ await tester.tap(start);+ await settle(tester);++ // The same setup was asked again, not a second one started.+ expect(setups().toSet(), first);+ expect(sent(f), ['machine.contribute m', 'buddy.create m']);+ await close(tester, f, c);+ });++ testWidgets('Start adds this Mac, then starts the Buddy on it', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);++ await tester.tap(start);+ await settle(tester);++ expect(sent(f), ['machine.contribute m', 'buddy.create m']);+ expect(c.buddy('lead'), isNotNull);+ await close(tester, f, c);+ });++ testWidgets('with no other machine, this Mac is the one to start on', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester);++ expect(+ find.text('None of your machines is in this Swarm yet.'),+ findsNothing,+ );+ await tester.tap(start);+ await settle(tester);++ expect(sent(f), ['machine.contribute m', 'buddy.create m']);+ await close(tester, f, c);+ });++ testWidgets('another machine picked starts there and adds nothing', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);++ await tester.tap(barMachine);+ await tester.pumpAndSettle();+ await tester.tap(find.text('2x 4090 Rig').last);+ await tester.pumpAndSettle();+ await tester.tap(start);+ await settle(tester);++ expect(sent(f), ['buddy.create rig']);+ await close(tester, f, c);+ });++ testWidgets('an add that fails shows its error and starts nothing', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);+ f.connection.server.reject = true;++ await tester.tap(start);+ await settle(tester);++ expect(sent(f).where((s) => s.startsWith('buddy.create')), isEmpty);+ expect(+ find.byKey(const ValueKey('super-buddy-start-error')),+ findsOneWidget,+ );+ // Still there to try again, and still this Mac.+ expect(tester.widget<FilledButton>(start).onPressed, isNotNull);+ expect(+ find.descendant(of: barMachine, matching: find.text('This Mac · $mac')),+ findsOneWidget,+ );+ await close(tester, f, c);+ });++ testWidgets('a second click while it adds sends one add', (tester) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);++ await tester.tap(start);+ await tester.pump();+ expect(tester.widget<FilledButton>(start).onPressed, isNull);+ await settle(tester);++ expect(sent(f), ['machine.contribute m', 'buddy.create m']);+ await close(tester, f, c);+ });++ testWidgets(+ 'access revoked while it adds adds nothing and starts nothing',+ (tester) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);++ await tester.tap(start);+ await tester.pump();+ for (final person in f.connection.server.state['people'] as List) {+ if ((person as Map)['id'] == 'owner') person['role'] = 'viewer';+ }+ await c.refresh();+ await settle(tester);++ expect(c.canWrite, isFalse);+ expect(sent(f), isEmpty);+ await close(tester, f, c);+ },+ );++ testWidgets(+ 'a Mac already in the Swarm is listed first by name, the rest follow',+ (tester) async {+ final (:f, :c, :mac) = await open(+ tester,+ machines: [+ rig(),+ {+ 'machineId': 'm',+ 'name': 'Office.local',+ 'contributorId': 'owner',+ 'scope': 'swarm',+ 'engines': <dynamic>['claude'],+ 'maxAgents': 4,+ 'availableSlots': 4,+ },+ ],+ );++ expect(+ find.descendant(of: barMachine, matching: find.text('Office')),+ findsOneWidget,+ );+ await tester.tap(barMachine);+ await tester.pumpAndSettle();+ expect(find.textContaining('This Mac'), findsNothing);+ expect(find.text(notInSwarm), findsNothing);+ expect(menuRows(tester, ['Office', '2x 4090 Rig']), [+ 'Office',+ '2x 4090 Rig',+ ]);+ await close(tester, f, c);+ },+ );++ testWidgets('a Mac that cannot be added now is not offered', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(+ tester,+ machines: [rig()],+ prepare: (f) => f.app.machineStates['m']!.nodeOnline = false,+ );++ expect(+ find.descendant(of: barMachine, matching: find.text('2x 4090 Rig')),+ findsOneWidget,+ );+ await tester.tap(barMachine);+ await tester.pumpAndSettle();+ expect(find.textContaining('This Mac'), findsNothing);+ await close(tester, f, c);+ });++ testWidgets('a Mac someone else already added is not offered again', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(+ tester,+ machines: [+ rig(),+ {+ ...rig(),+ 'machineId': 'm',+ 'name': 'Office.local',+ 'contributorId': 'other',+ },+ ],+ );++ expect(+ find.descendant(of: barMachine, matching: find.text('2x 4090 Rig')),+ findsOneWidget,+ );+ await tester.tap(barMachine);+ await tester.pumpAndSettle();+ expect(find.textContaining('This Mac'), findsNothing);+ expect(find.text('Office'), findsNothing);+ expect(find.text(notInSwarm), findsNothing);+ await close(tester, f, c);+ });++ testWidgets("a Mac signed in to another account is never offered", (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(+ tester,+ machines: [rig()],+ afterOpen: (f) {+ final own = f.app.machineStates['m']!;+ own.machine = Machine(+ machineId: 'm',+ authMode: own.machine.authMode,+ name: own.machine.name,+ isShared: true,+ );+ },+ );++ await tester.tap(barMachine);+ await tester.pumpAndSettle();+ expect(find.textContaining('This Mac'), findsNothing);+ await close(tester, f, c);+ });++ testWidgets('the machine field is as wide as its names, not the row', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);++ final field = tester.getSize(barMachine).width;+ final bar = tester.getSize(+ find.byKey(const ValueKey('super-buddy-start')),+ );+ expect(field, lessThan(bar.width / 2));+ // And wide enough to read the longest name whole.+ expect(+ tester.getSize(find.text('This Mac · $mac').last).width,+ lessThan(field),+ );+ await close(tester, f, c);+ });+ });++ testWidgets('the field fits its longest name at large text', (tester) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);+ tester.platformDispatcher.textScaleFactorTestValue = 2;+ addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);+ await tester.pumpAndSettle();++ final text = tester.widget<Text>(+ find.descendant(of: barMachine, matching: find.text('This Mac · $mac')),+ );+ final painter = TextPainter(+ text: TextSpan(text: text.data, style: text.style),+ textDirection: TextDirection.ltr,+ textScaler: const TextScaler.linear(2),+ )..layout();+ // Whole, not cut to an ellipsis.+ expect(+ tester.getSize(find.text('This Mac · $mac').last).width,+ closeTo(painter.width, 1),+ );+ await close(tester, f, c);+ });++ group('Add a Buddy', () {+ testWidgets('says Add Buddy adds this Mac before the menu is opened', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()], bar: false);++ expect(find.text(notInSwarmDialog), findsOneWidget);+ expect(find.text(notInSwarm), findsNothing);+ await tester.tap(dialogMachine);+ await tester.pumpAndSettle();+ await tester.tap(find.text('2x 4090 Rig').last);+ await tester.pumpAndSettle();+ expect(find.text(notInSwarmDialog), findsNothing);+ await close(tester, f, c);+ });++ testWidgets('write access lost while it adds says so and adds nothing', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()], bar: false);++ await tester.tap(addBuddy);+ await tester.pump();+ for (final person in f.connection.server.state['people'] as List) {+ if ((person as Map)['id'] == 'owner') person['role'] = 'viewer';+ }+ await c.refresh();+ await settle(tester);++ // The dialog's scope swaps the form for its own message, so the person+ // is not left looking at Adding….+ expect(sent(f), isEmpty);+ expect(find.text('This action is no longer available.'), findsOneWidget);+ expect(find.text('Adding…'), findsNothing);+ await close(tester, f, c);+ });++ testWidgets('an add that loses write access gives the reason', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()]);+ for (final person in f.connection.server.state['people'] as List) {+ if ((person as Map)['id'] == 'owner') person['role'] = 'viewer';+ }+ await c.refresh();+ await tester.pumpAndSettle();+ expect(c.canWrite, isFalse);++ final (:id, :error) = await BuddyMachineAdder(+ c,+ f.app,+ ).resolve(buddyMachines(c, app: f.app).first, alive: () => true);++ expect(id, isNull);+ expect(error, kBuddyAccessLost);+ expect(sent(f), isEmpty);+ await close(tester, f, c);+ });++ testWidgets('lists this Mac first and picked', (tester) async {+ final (:f, :c, :mac) = await open(tester, machines: [rig()], bar: false);++ expect(+ find.descendant(+ of: dialogMachine,+ matching: find.text('This Mac · $mac'),+ ),+ findsOneWidget,+ );+ expect(tester.widget<FilledButton>(addBuddy).onPressed, isNotNull);+ await tester.tap(dialogMachine);+ await tester.pumpAndSettle();+ expect(find.text(notInSwarmDialog), findsNWidgets(2));+ await close(tester, f, c);+ });++ testWidgets('Add Buddy adds this Mac, then starts the Buddy on it', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, bar: false);++ await tester.tap(addBuddy);+ await settle(tester);++ expect(sent(f), ['machine.contribute m', 'buddy.create m']);+ expect(find.text('Add a Buddy'), findsNothing);+ await close(tester, f, c);+ });++ testWidgets('an add that fails keeps the dialog open with its error', (+ tester,+ ) async {+ final (:f, :c, :mac) = await open(tester, bar: false);+ f.connection.server.reject = true;++ await tester.tap(addBuddy);+ await settle(tester);++ expect(sent(f).where((s) => s.startsWith('buddy.create')), isEmpty);+ expect(find.text('Add a Buddy'), findsOneWidget);+ expect(find.byKey(const ValueKey('super-buddy-error')), findsOneWidget);+ await close(tester, f, c);+ });+ });++ group('a Mac that cannot be added, and no other machine', () {+ Future<({SuperTabLaunchFixture f, SuperTabController c, String mac})>+ offline(WidgetTester tester, {required bool bar}) => open(+ tester,+ bar: bar,+ prepare: (f) => f.app.machineStates['m']!.nodeOnline = false,+ );+ const reason = 'Offline. Open Harness on this computer to add it.';++ testWidgets('the Start bar says why and offers no Start', (tester) async {+ final (:f, :c, :mac) = await offline(tester, bar: true);++ expect(+ find.text('None of your machines is in this Swarm yet.'),+ findsOneWidget,+ );+ expect(find.text(reason), findsOneWidget);+ expect(start, findsNothing);+ await close(tester, f, c);+ });++ testWidgets('Add a Buddy says why and cannot be submitted', (tester) async {+ final (:f, :c, :mac) = await offline(tester, bar: false);++ expect(find.text(reason), findsOneWidget);+ expect(tester.widget<FilledButton>(addBuddy).onPressed, isNull);+ await close(tester, f, c);+ });+ });++ for (final brightness in Brightness.values) {+ testWidgets('pictures in ${brightness.name}', (tester) async {+ if (shots == null) return;+ final previous = grid.AppTheme.brightness.value;+ grid.AppTheme.brightness.value = brightness;+ addTearDown(() => grid.AppTheme.brightness.value = previous);+ var (:f, :c, :mac) = await open(+ tester,+ machines: [rig()],+ brightness: brightness,+ );+ await captureWindow(tester, shots, 'buddy-start-${brightness.name}');+ await tester.tap(barMachine);+ await tester.pumpAndSettle();+ await captureWindow(tester, shots, 'buddy-start-menu-${brightness.name}');+ await close(tester, f, c);++ (:f, :c, :mac) = await open(+ tester,+ machines: [rig()],+ bar: false,+ brightness: brightness,+ );+ await captureWindow(tester, shots, 'buddy-add-${brightness.name}');+ await tester.tap(dialogMachine);+ await tester.pumpAndSettle();+ await captureWindow(tester, shots, 'buddy-add-menu-${brightness.name}');+ await close(tester, f, c);+ });+ }+}diff --git a/desktop/test/super_tab_completions_test.dart b/desktop/test/super_tab_completions_test.dartindex bcbdf4696..9782e42a1 100644--- a/desktop/test/super_tab_completions_test.dart+++ b/desktop/test/super_tab_completions_test.dart@@ -155,19 +155,20 @@ void main() {await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);await tester.pump(const Duration(milliseconds: 250));- expect(c.draft('lead'), '#off');+ // The box writes the line itself; the open reference is not accepted.+ expect(c.draft('lead'), '#off\n');expect(server.posts, isEmpty);- // The native text-input client delivers the newline separately from its- // key event. The completion handler must leave that edit untouched.+ // A newline the native text-input client delivers is another edit the+ // completion handler must leave untouched.await tester.showKeyboard(composer);tester.testTextInput.updateEditingValue(const TextEditingValue(- text: '#off\n',- selection: TextSelection.collapsed(offset: 5),+ text: '#off\nmore',+ selection: TextSelection.collapsed(offset: 9),),);await tester.pump(const Duration(milliseconds: 250));- expect(c.draft('lead'), '#off\n');+ expect(c.draft('lead'), '#off\nmore');expect(server.posts, isEmpty);expect(picker, findsNothing);});diff --git a/desktop/test/super_tab_composer_newline_test.dart b/desktop/test/super_tab_composer_newline_test.dartnew file mode 100644index 000000000..e7548cb9c--- /dev/null+++ b/desktop/test/super_tab_composer_newline_test.dart@@ -0,0 +1,204 @@+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/composer_newline.dart';+import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/view.dart';++import 'support/super_tab_fixture.dart';++/// The Swarm chat box: Enter sends, Shift+Enter and Alt/Option+Enter start another line and keep+/// the cursor in the box. The newline is written by the box itself, because a widget test's raw+/// key events never reach the platform text-input channel and macOS gives Option+Return no line.+void main() {+ final desktops = TargetPlatformVariant({+ TargetPlatform.macOS,+ TargetPlatform.windows,+ TargetPlatform.linux,+ });+ final composer = find.byKey(const ValueKey('super-message-composer'));+ TextEditingController controller(WidgetTester tester) =>+ tester.widget<TextField>(composer).controller!;++ late SuperTabController shown;+ String draft() => shown.draft(shown.selectedId);++ Future<ConversationServer> show(WidgetTester tester) async {+ final server = ConversationServer()..append('Which build?');+ final c = shown = server.controller();+ await c.refresh();+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ body: SuperTabView(+ controller: c,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Team Mac',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ addTearDown(c.dispose);+ return server;+ }++ Future<void> type(WidgetTester tester, String text) async {+ await tester.tap(composer);+ await tester.enterText(composer, text);+ await tester.pump();+ }++ Future<void> press(+ WidgetTester tester,+ LogicalKeyboardKey key, {+ LogicalKeyboardKey? holding,+ }) async {+ if (holding != null) await tester.sendKeyDownEvent(holding);+ await tester.sendKeyEvent(key);+ if (holding != null) await tester.sendKeyUpEvent(holding);+ await tester.pump();+ }++ for (final (name, modifier) in [+ ('Shift', LogicalKeyboardKey.shiftLeft),+ ('Alt/Option', LogicalKeyboardKey.altLeft),+ ]) {+ testWidgets('$name+Enter adds a line at the cursor and does not send', (+ tester,+ ) async {+ final server = await show(tester);+ await type(tester, 'firstsecond');+ controller(tester).selection = const TextSelection.collapsed(offset: 5);++ await press(tester, LogicalKeyboardKey.enter, holding: modifier);++ expect(controller(tester).text, 'first\nsecond');+ // The saved draft follows the box, so switching chats keeps the line.+ expect(draft(), 'first\nsecond');+ expect(+ controller(tester).selection,+ const TextSelection.collapsed(offset: 6),+ );+ expect(server.posts, isEmpty);+ // The cursor stays in the box, so the next key goes on the new line.+ expect(+ tester.widget<TextField>(composer).focusNode!.hasPrimaryFocus,+ isTrue,+ );+ await tester.pump(const Duration(seconds: 1));+ }, variant: desktops);++ testWidgets('$name+Enter replaces the selection with the line', (+ tester,+ ) async {+ final server = await show(tester);+ await type(tester, 'one two three');+ controller(tester).selection = const TextSelection(+ baseOffset: 3,+ extentOffset: 8,+ );++ await press(tester, LogicalKeyboardKey.enter, holding: modifier);++ expect(controller(tester).text, 'one\nthree');+ expect(draft(), 'one\nthree');+ expect(+ controller(tester).selection,+ const TextSelection.collapsed(offset: 4),+ );+ expect(server.posts, isEmpty);+ await tester.pump(const Duration(seconds: 1));+ }, variant: desktops);++ testWidgets('$name+Enter during composition neither inserts nor sends', (+ tester,+ ) async {+ final server = await show(tester);+ await type(tester, 'xin chào');+ controller(tester).value = const TextEditingValue(+ text: 'xin chao',+ selection: TextSelection.collapsed(offset: 8),+ composing: TextRange(start: 4, end: 8),+ );++ await press(tester, LogicalKeyboardKey.enter, holding: modifier);++ expect(controller(tester).text, 'xin chao');+ expect(server.posts, isEmpty);+ await tester.pump(const Duration(seconds: 1));+ }, variant: desktops);+ }++ testWidgets('Enter alone sends and clears the box', (tester) async {+ final server = await show(tester);+ await type(tester, 'The arm64 one');++ await press(tester, LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();++ expect(server.posts, hasLength(1));+ expect(controller(tester).text, isEmpty);+ await tester.pump(const Duration(seconds: 1));+ }, variant: desktops);++ testWidgets('Enter during composition commits it and does not send', (+ tester,+ ) async {+ final server = await show(tester);+ await type(tester, 'xin chào');+ controller(tester).value = const TextEditingValue(+ text: 'xin chao',+ selection: TextSelection.collapsed(offset: 8),+ composing: TextRange(start: 4, end: 8),+ );++ await press(tester, LogicalKeyboardKey.enter);++ expect(server.posts, isEmpty);+ expect(controller(tester).text, 'xin chao');+ await tester.pump(const Duration(seconds: 1));+ }, variant: desktops);++ testWidgets('a full box takes no further line', (tester) async {+ final server = await show(tester);+ final full = 'a' * kComposerMaxLength;+ await type(tester, full);+ controller(tester).selection = TextSelection.collapsed(+ offset: kComposerMaxLength,+ );++ await press(+ tester,+ LogicalKeyboardKey.enter,+ holding: LogicalKeyboardKey.shiftLeft,+ );++ expect(controller(tester).text, full);+ expect(server.posts, isEmpty);+ await tester.pump(const Duration(seconds: 1));+ });++ group('withNewline', () {+ test('a box that was never placed in appends the line', () {+ final value = withNewline(const TextEditingValue(text: 'hi'));+ expect(value!.text, 'hi\n');+ expect(value.selection, const TextSelection.collapsed(offset: 3));+ });++ test('a selection that makes room lets the line in at the limit', () {+ final value = withNewline(+ TextEditingValue(+ text: 'a' * kComposerMaxLength,+ selection: const TextSelection(baseOffset: 0, extentOffset: 1),+ ),+ );+ expect(value!.text.length, kComposerMaxLength);+ expect(value.text.startsWith('\n'), isTrue);+ });+ });+}diff --git a/desktop/test/super_tab_launch_retry_test.dart b/desktop/test/super_tab_launch_retry_test.dartnew file mode 100644index 000000000..5f4304433--- /dev/null+++ b/desktop/test/super_tab_launch_retry_test.dart@@ -0,0 +1,202 @@+import 'dart:convert';+import 'dart:typed_data';++import 'package:flutter_test/flutter_test.dart';+import 'package:harness/core/models.dart';+import 'package:harness/state/new_harness.dart';+import 'package:harness/state/harness_attachments.dart';+import 'package:harness/super_tabs/launch.dart';+import 'package:harness/ws/ws_conn.dart';++import 'super_tab_launch_test.dart'+ show SuperTabLaunchFixture, SuperTabFixtureConnection, tabId;++// From the review of #2147 (Reviewer, 10-29). Transport fault after a+// committed response. Enforce the real backend's+// request-hash contract (store.ts:983-986) and lead-start guard (commands.ts:895),+// both of which ConversationServer omits.+class LostReplyConnection extends SuperTabFixtureConnection {+ LostReplyConnection(super.store, this.loseType);+ final String loseType;+ bool lost = false;+ final hashes = <String, String>{};+ final started = <String>{};+ final attempts = <Map<String, dynamic>>[];+ @override+ Future<Map<String, dynamic>> request(+ String type, {+ Map<String, dynamic> payload = const {},+ Duration timeout = const Duration(seconds: 20),+ }) async {+ final body = payload['body'];+ final command = body is Map ? body['command'] : null;+ final commandType = command is Map ? command['type'] : null;+ if (type == 'super_tabs' && payload['method'] == 'POST' && command is Map) {+ final id = body['operationId'] as String;+ attempts.add(Map<String, dynamic>.from(body));+ final hash = jsonEncode(command);+ if (hashes.containsKey(id) && hashes[id] != hash) {+ throw const WsRequestFailure(+ responseType: 'super_tabs_result',+ code: 'OPERATION_REUSED',+ detail: 'Use a new operation ID for a different request.',+ );+ }+ if (commandType == 'lead.start' &&+ !hashes.containsKey(id) &&+ started.contains(command['projectId'])) {+ throw const WsRequestFailure(+ responseType: 'super_tabs_result',+ code: 'LEAD_STARTING',+ detail: 'This project’s Product Manager is already starting.',+ );+ }+ final result = await super.request(+ type,+ payload: payload,+ timeout: timeout,+ );+ hashes[id] = hash;+ if (commandType == 'lead.start' && command['machineId'] != null) {+ started.add(command['projectId'] as String);+ }+ if (commandType == loseType && !lost) {+ lost = true;+ throw const WsRequestFailure(+ responseType: 'super_tabs_result',+ code: 'BACKEND_TIMEOUT',+ detail: 'The backend response timed out.',+ payload: {'status': 504},+ );+ }+ return result;+ }+ return super.request(type, payload: payload, timeout: timeout);+ }+}++void configure(SuperTabLaunchFixture f) {+ f.app.machineStates['m']!.agents = [+ const Agent(+ id: 'old',+ name: 'Earlier',+ engine: 'codex',+ terminalAvailable: true,+ project: AgentProject(+ name: 'project',+ cwd: '/work/project',+ root: '/work/project',+ remote: '[email protected]:autonomous-ai/lamp-os.git',+ ),+ ),+ ];+ f.connection.server.state['machines'] = [+ {+ 'machineId': 'm',+ 'name': 'Mac Studio',+ 'contributorId': 'owner',+ 'maxAgents': 8,+ 'availableSlots': 0,+ 'paused': false,+ 'observation': {+ 'receivedAt': DateTime.now().millisecondsSinceEpoch,+ 'runningHarnessIds': <String>[],+ },+ },+ ];+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+}++void main() {+ TestWidgetsFlutterBinding.ensureInitialized();+ test(+ 'a task with files recovers after its committed message reply is lost',+ () async {+ final f = SuperTabLaunchFixture(+ connectionFactory: (store) =>+ LostReplyConnection(store, 'message.send'),+ );+ configure(f);+ SuperTabLaunch.uploadForTest = f.connection.server.upload;+ addTearDown(() => SuperTabLaunch.uploadForTest = null);+ final files = HarnessAttachments()+ ..add([+ HarnessAttachment('plan.md', Uint8List.fromList([1, 2, 3])),+ ]);+ final box = await f.box(newProject: true, attachments: files);+ expect(await box.create(), NewHarnessOutcome.failed);+ final recovered = await box.create();+ final c = f.connection as LostReplyConnection;+ // The retry replays the committed message: nothing is uploaded again.+ expect(c.server.uploads, hasLength(1));+ expect(recovered, NewHarnessOutcome.created, reason: box.error);+ },+ );+ test('a Swarm start recovers after its committed reply is lost', () async {+ final f = SuperTabLaunchFixture(+ connectionFactory: (store) => LostReplyConnection(store, 'lead.start'),+ );+ configure(f);+ (f.connection.server.state['machines'] as List).add({+ 'machineId': 'far',+ 'name': 'Office Mini',+ 'contributorId': 'owner',+ 'maxAgents': 8,+ 'availableSlots': 3,+ 'paused': false,+ 'observation': {+ 'receivedAt': DateTime.now().millisecondsSinceEpoch,+ 'runningHarnessIds': <String>[],+ 'capabilities': ['leadStart'],+ },+ });+ final box = await f.box(newProject: true);+ box.chooseLeadMachine('far');+ expect(await box.create(), NewHarnessOutcome.failed);+ final recovered = await box.create();+ final c = f.connection as LostReplyConnection;+ final starts = c.attempts+ .where((p) => (p['command'] as Map)['type'] == 'lead.start')+ .map((p) => p['operationId'])+ .toList();+ // The retry repeats the committed start under its original operation.+ expect(starts.toSet(), hasLength(1));+ expect(recovered, NewHarnessOutcome.created, reason: box.error);+ });++ test('a start that took its machine’s last slot recovers after its reply is lost', () async {+ final f = SuperTabLaunchFixture(+ connectionFactory: (store) => LostReplyConnection(store, 'lead.start'),+ );+ configure(f);+ final machine = <String, Object>{+ 'machineId': 'far',+ 'name': 'Office Mini',+ 'contributorId': 'owner',+ 'maxAgents': 1,+ 'availableSlots': 1,+ 'paused': false,+ 'observation': {+ 'receivedAt': DateTime.now().millisecondsSinceEpoch,+ 'runningHarnessIds': <String>[],+ 'capabilities': ['leadStart'],+ },+ };+ (f.connection.server.state['machines'] as List).add(machine);+ final box = await f.box(newProject: true);+ box.chooseLeadMachine('far');+ expect(await box.create(), NewHarnessOutcome.failed);+ // The server holds capacity for the start it just committed.+ machine['availableSlots'] = 0;+ final recovered = await box.create();+ expect(recovered, NewHarnessOutcome.created, reason: box.error);+ final c = f.connection as LostReplyConnection;+ final starts = c.attempts+ .where((p) => (p['command'] as Map)['type'] == 'lead.start')+ .map((p) => p['operationId'])+ .toList();+ // The same start, repeated: the server's receipt decides.+ expect(starts, hasLength(2));+ expect(starts.toSet(), hasLength(1));+ });+}diff --git a/desktop/test/super_tab_launch_test.dart b/desktop/test/super_tab_launch_test.dartindex 824b2e901..588f04561 100644--- a/desktop/test/super_tab_launch_test.dart+++ b/desktop/test/super_tab_launch_test.dart@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/first_task.dart';import 'package:harness/core/models.dart';+import 'package:harness/core/project_folder.dart';import 'package:harness/core/launch_setup.dart';import 'package:harness/state/app_state.dart';import 'package:harness/state/new_harness.dart';@@ -53,6 +54,10 @@ class SuperTabFixtureConnection extends WsConn {/// after one answer never sees anything ready.final prepared = <Object?>{};+ /// Preparation never finishes: every ask is answered `preparing`, as a setup+ /// still running on the machine answers.+ bool keepPreparing = false;+/// The most agents preparation says this machine may run; null for a Harness/// from before setup reported it.int? maxAvailableAgents = 16;@@ -172,7 +177,7 @@ class SuperTabFixtureConnection extends WsConn {}if (payload['action'] == 'wake') return {'ok': true};if (payload['action'] == 'prepareContribution') {- if (prepared.add(payload['operationId'])) {+ if (prepared.add(payload['operationId']) || keepPreparing) {return {'ok': true, 'state': 'preparing'};}return {@@ -377,6 +382,7 @@ class SuperTabLaunchFixture {bool local = false,SuperTabFixtureConnection Function(MemoryStore)? connectionFactory,LocalCliDiscovery? discovery,+ Future<String> Function(ProjectFolderRequest request)? prepareFolder,}) {connection =connectionFactory?.call(store) ??@@ -386,6 +392,7 @@ class SuperTabLaunchFixture {connectionForTest: (_) => connection,connected: true,localCliDiscovery: discovery,+ prepareFolder: prepareFolder,);app.machineStates['m']!..localOnly = true@@ -671,7 +678,8 @@ void main() {f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');final box = await f.box(newProject: true);final machines = box.integration!.leadMachines!;- expect(machines.map((m) => m.id), ['m', 'rig', 'laptop', 'old']);+ // Your own first, the unavailable ones included.+ expect(machines.map((m) => m.id), ['m', 'laptop', 'rig', 'old']);final studio = machines.first;expect(studio.name, 'Mac Studio');expect(studio.startable, isTrue);@@ -684,36 +692,49 @@ void main() {expect(studio.folders, {'github.com/autonomous-ai/autonomous-os': '/swarm/m/p1',});- expect(machines[1].unavailable, 'Another person’s machine');- expect(machines[2].maySleep, isTrue);- expect(machines[2].unavailable, 'Not connected to this computer');+ expect(machines[1].maySleep, isTrue);+ expect(machines[1].unavailable, 'Not connected to this computer');+ // Its Team account's host has not said it can start a PM.+ expect(+ machines[2].unavailable,+ 'Update Harness on 2x 4090 Rig to run a Product Manager there.',+ );expect(machines[3].online, isFalse);expect(bestLeadMachine(machines, null)?.id, 'm');},);- test('New Project refuses a machine its list cannot start', () async {- final f = SuperTabLaunchFixture();- f.connection.server.state['machines'] = [- {- 'machineId': 'm',- 'name': 'Mac Studio',- 'contributorId': 'owner',- 'maxAgents': 2,- 'paused': false,- 'observation': {- 'receivedAt': DateTime.now().millisecondsSinceEpoch,- 'runningHarnessIds': ['a', 'b'],+ test(+ 'with its only machine full, New Project queues, and needs a remote',+ () async {+ final f = SuperTabLaunchFixture();+ f.connection.server.state['machines'] = [+ {+ 'machineId': 'm',+ 'name': 'Mac Studio',+ 'contributorId': 'owner',+ 'maxAgents': 2,+ 'paused': false,+ 'observation': {+ 'receivedAt': DateTime.now().millisecondsSinceEpoch,+ 'runningHarnessIds': ['a', 'b'],+ },},- },- ];- f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');- final box = await f.box(newProject: true);- expect(box.integration!.leadMachines!.single.startable, isFalse);- expect(await box.create(), NewHarnessOutcome.failed);- expect(box.error, 'Mac Studio has no free agents. Choose another machine.');- expect(f.connection.calls.where((c) => c.$1 == 'agent_create'), isEmpty);- });+ ];+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final box = await f.box(newProject: true);+ expect(box.integration!.leadMachines!.single.startable, isFalse);+ expect(box.leadQueued, isTrue);+ expect(await box.create(), NewHarnessOutcome.failed);+ // The Swarm clones the repo wherever it starts the PM.+ expect(+ box.error,+ 'Choose a repo with a remote, so the Swarm can clone it for the Product Manager.',+ );+ expect(f.connection.calls.where((c) => c.$1 == 'agent_create'), isEmpty);+ expect(f.connection.server.posts, isEmpty);+ },+ );Map<String, dynamic> studioPool({int available = 3,@@ -734,6 +755,297 @@ void main() {},};+ /// A machine row as the Swarm read sends it, with its derived figures.+ Map<String, dynamic> machineRow(+ String id,+ String name, {+ String contributor = 'diego',+ String? host,+ String kind = 'computer',+ int available = 4,+ bool lead = false,+ Map<String, dynamic> teamWork = const {'allowed': true},+ }) => {+ 'machineId': id,+ 'name': name,+ 'cwd': '/swarm/$id',+ 'contributorId': contributor,+ 'maxAgents': 8,+ 'availableSlots': available,+ 'paused': false,+ 'hostMachineId': ?host,+ 'teamWork': teamWork,+ 'observation': {+ 'receivedAt': DateTime.now().millisecondsSinceEpoch,+ 'sessionKind': kind,+ 'runningHarnessIds': <String>[],+ if (lead) 'capabilities': ['leadStart'],+ },+ };++ void addDiego(SuperTabLaunchFixture f) =>+ (f.connection.server.state['people'] as List).add({+ 'id': 'diego',+ 'email': '[email protected]',+ 'role': 'collaborator',+ });++ test('a teammate’s Mac takes the PM in its Team account', () async {+ final f = SuperTabLaunchFixture();+ addDiego(f);+ f.connection.server.state['machines'] = [+ machineRow('diego-mac', 'Diego MacBook'),+ machineRow(+ 'diego-team',+ 'Diego MacBook',+ host: 'diego-mac',+ kind: 'team',+ available: 3,+ lead: true,+ ),+ ];+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final box = await f.box(newProject: true);+ final diego = box.integration!.leadMachines!+ .where((m) => m.id == 'diego-mac')+ .single;+ expect(diego.unavailable, isNull);+ expect(diego.startable, isTrue);+ expect(diego.freeAgents, 3);+ expect(diego.own, isFalse);+ expect(diego.native, isFalse);+ expect(diego.team, isTrue);+ });++ for (final (what, rows, reason) in [+ (+ 'has no Team account',+ [machineRow('rig', '2x 4090 Rig', lead: true)],+ '2x 4090 Rig has no Harness Team account yet, so it runs only its owner’s projects.',+ ),+ (+ 'fails its Team account’s privacy check',+ [+ machineRow('diego-mac', 'Diego MacBook'),+ machineRow(+ 'diego-team',+ 'Diego MacBook',+ host: 'diego-mac',+ kind: 'team',+ lead: true,+ teamWork: {+ 'allowed': false,+ 'code': 'PRIVACY_CHECK_FAILED',+ 'reason': 'The Harness Team account on Diego MacBook is not private (sharing), so it runs only its owner’s projects.',+ },+ ),+ ],+ 'The Harness Team account on Diego MacBook is not private (sharing), so it runs only its owner’s projects.',+ ),+ (+ 'runs an older Harness',+ [+ machineRow('diego-mac', 'Diego MacBook'),+ machineRow(+ 'diego-team',+ 'Diego MacBook',+ host: 'diego-mac',+ kind: 'team',+ ),+ ],+ 'Update Harness on Diego MacBook to run a Product Manager there.',+ ),+ ]) {+ test('a teammate’s machine that $what says why', () async {+ final f = SuperTabLaunchFixture();+ addDiego(f);+ f.connection.server.state['machines'] = rows;+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final box = await f.box(newProject: true);+ final row = box.integration!.leadMachines!.where((m) => !m.own).single;+ expect(row.unavailable, reason);+ expect(row.startable, isFalse);+ });+ }++ test('your own machines come before a teammate’s with more room', () async {+ final f = SuperTabLaunchFixture();+ addDiego(f);+ f.connection.server.state['machines'] = [+ machineRow('diego-mac', 'Diego MacBook'),+ machineRow(+ 'diego-team',+ 'Diego MacBook',+ host: 'diego-mac',+ kind: 'team',+ available: 30,+ lead: true,+ ),+ machineRow('m', 'Mac Studio', contributor: 'owner', available: 2),+ // Yours, but this Desktop has no connection to it: the Swarm starts it.+ machineRow('far', 'Office Mini', contributor: 'owner', lead: true),+ machineRow('old', 'Old Mini', contributor: 'owner'),+ ];+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final box = await f.box(newProject: true);+ final machines = box.integration!.leadMachines!;+ expect(machines.map((m) => m.id).take(3), ['m', 'far', 'diego-mac']);+ expect(machines.first.native, isTrue);+ final far = machines[1];+ expect((far.native, far.startable, far.team), (false, true, false));+ final old = machines.where((m) => m.id == 'old').single;+ expect(old.unavailable, 'Not connected to this computer');+ });++ /// Your machine knows the project folder's remote: an agent ran there.+ void knownRepo(SuperTabLaunchFixture f) =>+ f.app.machineStates['m']!.agents = [+ const Agent(+ id: 'earlier',+ name: 'Earlier',+ engine: 'codex',+ terminalAvailable: true,+ project: AgentProject(+ name: 'project',+ cwd: '/work/project',+ root: '/work/project',+ remote: '[email protected]:autonomous-ai/lamp-os.git',+ ),+ ),+ ];++ List<Map> commandsOf(SuperTabLaunchFixture f, String type) => [+ for (final post in f.connection.server.posts)+ if ((post['command'] as Map)['type'] == type) post['command'] as Map,+ ];++ test(+ 'New Project asks the Swarm to start the PM in a teammate’s Team account',+ () async {+ final f = SuperTabLaunchFixture();+ addDiego(f);+ knownRepo(f);+ f.connection.server.state['machines'] = [+ machineRow('diego-mac', 'Diego MacBook'),+ machineRow(+ 'diego-team',+ 'Diego MacBook',+ host: 'diego-mac',+ kind: 'team',+ lead: true,+ ),+ ];+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final box = await f.box(newProject: true);+ box.chooseLeadMachine('diego-mac');+ expect(box.leadThroughSwarm, isTrue);+ expect(await box.create(), NewHarnessOutcome.created, reason: box.error);+ final project = commandsOf(f, 'project.create').single;+ expect(project['brief'], 'Discuss the architecture.');+ final created = f.app.superTabs.peek(tabId)!.snapshot!.projects.last;+ // The PM the Swarm starts reads its request in its project's chat.+ final task = commandsOf(f, 'message.send').single;+ expect(task['conversationId'], created.leadConversationId);+ expect(task['text'], 'Discuss the architecture.');+ final start = commandsOf(f, 'lead.start').single;+ expect(start, {+ 'type': 'lead.start',+ 'projectId': created.id,+ 'machineId': 'diego-mac',+ 'engine': 'codex',+ 'repositoryUrl': '[email protected]:autonomous-ai/lamp-os.git',+ });+ expect(created.name, 'project');+ expect(f.connection.calls.where((c) => c.$1 == 'agent_create'), isEmpty);+ expect(+ f.app.superTabs.peek(tabId)!.selectedId,+ created.leadConversationId,+ );+ },+ );++ test('with no machine free New Project queues the PM', () async {+ final f = SuperTabLaunchFixture();+ knownRepo(f);+ f.connection.server.state['machines'] = [+ machineRow('m', 'Mac Studio', contributor: 'owner', available: 0),+ ];+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final box = await f.box(newProject: true);+ expect(box.leadQueued, isTrue);+ expect(await box.create(), NewHarnessOutcome.created, reason: box.error);+ final start = commandsOf(f, 'lead.start').single;+ expect(start['machineId'], isNull);+ expect(start.containsKey('machineId'), isTrue);+ expect(f.connection.calls.where((c) => c.$1 == 'agent_create'), isEmpty);+ });++ test(+ 'a refused Swarm start says why, and a retry posts the task once',+ () async {+ final f = SuperTabLaunchFixture();+ addDiego(f);+ knownRepo(f);+ f.connection.server.state['machines'] = [+ machineRow('diego-mac', 'Diego MacBook'),+ machineRow(+ 'diego-team',+ 'Diego MacBook',+ host: 'diego-mac',+ kind: 'team',+ lead: true,+ ),+ ];+ f.connection.server.leadRefusal = {+ 'code': 'TEAM_ACCOUNT_REQUIRED',+ 'message': 'Harness Team accounts take no work in this Swarm yet, so Diego MacBook runs only its owner’s projects.',+ };+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final box = await f.box(newProject: true);+ box.chooseLeadMachine('diego-mac');+ expect(await box.create(), NewHarnessOutcome.failed);+ expect(+ box.error,+ 'Harness Team accounts take no work in this Swarm yet, so Diego MacBook runs only its owner’s projects.',+ );+ expect(await box.create(), NewHarnessOutcome.created, reason: box.error);+ expect(commandsOf(f, 'project.create'), hasLength(1));+ expect(commandsOf(f, 'message.send'), hasLength(1));+ final starts = [+ for (final post in f.connection.server.posts)+ if ((post['command'] as Map)['type'] == 'lead.start')+ post['operationId'],+ ];+ expect(starts, hasLength(2));+ expect(starts.toSet(), hasLength(2), reason: 'a refusal wrote nothing');+ },+ );++ test('files go to the PM’s chat with the task', () async {+ final f = SuperTabLaunchFixture();+ knownRepo(f);+ f.connection.server.state['machines'] = [+ machineRow('m', 'Mac Studio', contributor: 'owner', available: 0),+ ];+ SuperTabLaunch.uploadForTest = f.connection.server.upload;+ addTearDown(() => SuperTabLaunch.uploadForTest = null);+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final files = HarnessAttachments()+ ..add([+ HarnessAttachment('plan.md', Uint8List.fromList([1, 2, 3])),+ ]);+ final box = await f.box(newProject: true, attachments: files);+ expect(await box.create(), NewHarnessOutcome.created, reason: box.error);+ final created = f.app.superTabs.peek(tabId)!.snapshot!.projects.last;+ expect(+ f.connection.server.uploads.single['conversationId'],+ created.leadConversationId,+ );+ expect(commandsOf(f, 'message.send').single['attachmentIds'], [+ 'attachment-1',+ ]);+ });+test('free agents are the server’s count, not slots minus running', () async {final f = SuperTabLaunchFixture();// Eight slots and two running, but the server counts one free: its count@@ -916,6 +1228,36 @@ void main() {},);+ test('a PM’s forced worktree is not saved as the person’s setting', () async {+ final prepared = <ProjectFolderRequest>[];+ final f = SuperTabLaunchFixture(+ prepareFolder: (request) async {+ prepared.add(request);+ return '/work/project-pm';+ },+ );+ f.app.gitProjectReaderForTest = (_, _) async => {+ 'isGit': true,+ 'refreshed': true,+ 'branch': 'main',+ 'branches': [+ {'ref': 'refs/heads/main', 'name': 'main'},+ ],+ };+ f.app.agentPreference.successfulWorktree = false;+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');+ final box = await f.box(newProject: true);+ // What the form does when it opens: Desktop choices read Git there.+ box.useDesktopChoices(true);+ await Future<void>.delayed(Duration.zero);+ expect(box.isGitProject, isTrue);+ expect(box.worktree, isTrue);+ expect(await box.create(), NewHarnessOutcome.created, reason: box.error);+ expect(prepared.single.createsWorktree, isTrue);+ // Their next New Harness keeps their own setting.+ expect(f.app.agentPreference.successfulWorktree, isFalse);+ });+test('a new Swarm keeps choosing among the person’s own machines', () async {final f = SuperTabLaunchFixture();final box = await f.box();diff --git a/desktop/test/super_tab_leaderboard_shots_test.dart b/desktop/test/super_tab_leaderboard_shots_test.dartindex 17df794fb..3147846b2 100644--- a/desktop/test/super_tab_leaderboard_shots_test.dart+++ b/desktop/test/super_tab_leaderboard_shots_test.dart@@ -7,18 +7,24 @@ import 'package:harness/super_tabs/view.dart';import 'support/capture.dart';import 'support/humans_fixture.dart';+import 'support/super_tab_fixture.dart';/// Set to a folder to write the Humans leaderboard's screenshots there: the/// real right pane over the in-memory Swarm, never a backend or the live app.final shots = Platform.environment['SUPER_TAB_LEADERBOARD_SHOTS'];-Future<void> showHumans(WidgetTester tester, Brightness brightness) async {- await tester.binding.setSurfaceSize(const Size(1300, 900));+Future<void> showHumans(+ WidgetTester tester,+ Brightness brightness, {+ ConversationServer Function() swarm = humansSwarm,+ Size size = const Size(1300, 900),+}) async {+ await tester.binding.setSurfaceSize(size);addTearDown(() => tester.binding.setSurfaceSize(null));// The app sets the design tokens' brightness from its theme at startup.grid.AppTheme.brightness.value = brightness;addTearDown(() => grid.AppTheme.brightness.value = Brightness.dark);- final c = humansSwarm().controller(+ final c = swarm().controller(account: 'peer',initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},);@@ -58,4 +64,20 @@ void main() {await tester.pumpWidget(const SizedBox());}}, skip: shots == null);++ testWidgets('member list and Models screenshots for review', (tester) async {+ for (final (brightness, name) in [+ (Brightness.light, 'light'),+ (Brightness.dark, 'dark'),+ ]) {+ await showHumans(+ tester,+ brightness,+ swarm: () => modelsSwarm(membersSwarm()),+ size: const Size(1300, 1000),+ );+ await captureWindow(tester, shots, 'members-$name');+ await tester.pumpWidget(const SizedBox());+ }+ }, skip: shots == null);}diff --git a/desktop/test/super_tab_leaderboard_tabs_test.dart b/desktop/test/super_tab_leaderboard_tabs_test.dartdeleted file mode 100644index b62a4c19b..000000000--- a/desktop/test/super_tab_leaderboard_tabs_test.dart+++ /dev/null@@ -1,315 +0,0 @@-import 'package:flutter/material.dart';-import 'package:flutter_test/flutter_test.dart';-import 'package:harness/shared/theme/app_theme.dart' as grid;-import 'package:harness/super_tabs/controller.dart';-import 'package:harness/super_tabs/leaderboard/model.dart';-import 'package:harness/super_tabs/leaderboard/worker_rows.dart';-import 'package:harness/super_tabs/view.dart';--import 'support/humans_fixture.dart';-import 'support/super_tab_fixture.dart';--/// Agents and Models beside Humans on the leaderboard (Dee, 2026-10-29):-/// "permanent and temp workers, just like humans". Agents are the PM and the-/// Buddies by name; Models are the Builders and Reviewers by what they ran on,-/// never by agent. Both keep the one-number rows and the crown.-ConversationServer tabsSwarm({bool empty = false}) {- final server = humansSwarm();- final agents = server.state['agents'] as List;- (agents.first as Map)['machineId'] = 'studio';- server.state['agents'] = <Object>[- ...agents,- <String, dynamic>{- ...(agents.first as Map).cast<String, dynamic>(),- 'id': 'sparky',- 'harnessId': 'h-sparky',- 'name': 'Sparky',- 'displayName': 'Sparky',- 'buddyOf': {'personId': 'peer', 'generation': 'g'},- },- ];- server.leaderboard!['agents'] = empty- ? <Map<String, dynamic>>[]- : [- {- 'agentId': 'lead-agent',- 'displayName': 'River',- 'kind': 'pm',- 'personId': null,- 'machineId': 'studio',- 'points': 36,- 'rank': 1,- 'shipped': 12,- },- {- 'agentId': 'sparky',- 'displayName': 'Sparky',- 'kind': 'buddy',- 'personId': 'peer',- 'machineId': 'studio',- 'points': 12,- 'rank': 2,- 'shipped': 4,- },- ];- Map<String, dynamic> model(- String engine,- String? model,- String? effort,- int points,- int rank, {- int shipped = 0,- int? attemptMs,- int? requestMs,- int reviewed = 0,- int passed = 0,- int reviews = 0,- }) => {- 'engine': engine,- 'model': model,- 'effort': effort,- 'grid': false,- 'points': points,- 'rank': rank,- 'shipped': {- 'count': shipped,- 'medianAttemptMs': attemptMs,- 'medianRequestMs': requestMs,- },- 'firstReview': {'reviewed': reviewed, 'passed': passed},- 'reviews': reviews,- };- server.leaderboard!['byModel'] = empty- ? <Map<String, dynamic>>[]- : [- model(- 'claude',- 'opus',- 'high',- 93,- 1,- shipped: 31,- attemptMs: 47 * 60000,- requestMs: 3 * 3600000,- reviewed: 34,- passed: 28,- ),- model('codex', 'gpt-5.5', null, 52, 2, shipped: 17),- model('codex', 'gpt-5.5', 'medium', 5, 3, reviews: 5),- ];- return server;-}--void main() {- Future<SuperTabController> show(- WidgetTester tester,- ConversationServer server,- ) async {- await tester.binding.setSurfaceSize(const Size(1300, 900));- addTearDown(() => tester.binding.setSurfaceSize(null));- final controller = server.controller(- account: 'peer',- initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},- );- await controller.refresh();- await tester.pumpWidget(- MaterialApp(- theme: grid.buildAppTheme(brightness: Brightness.light),- home: Scaffold(- body: SuperTabView(- controller: controller,- onInvite: () {},- onAddAgent: (_) {},- onOpenTerminal: (_) {},- machineName: (_) => 'Mac Studio',- ),- ),- ),- );- await tester.pumpAndSettle();- return controller;- }-- Future<void> close(WidgetTester tester, SuperTabController controller) async {- await tester.pumpWidget(const SizedBox());- await controller.flush();- controller.dispose();- }-- Finder tab(String name) => find.byKey(ValueKey('leaderboard-tab-$name'));- Finder row(String id) => find.byKey(ValueKey('leaderboard-row-$id'));- Finder inRow(String id, Finder finder) =>- find.descendant(of: row(id), matching: finder);- Future<void> open(WidgetTester tester, String name) async {- await tester.ensureVisible(tab(name));- await tester.tap(tab(name));- await tester.pumpAndSettle();- }-- testWidgets(- 'offers Humans, Agents and Models beside the week, Humans first',- (tester) async {- final semantics = tester.ensureSemantics();- final controller = await show(tester, tabsSwarm());- for (final name in ['humans', 'agents', 'models']) {- expect(tab(name), findsOneWidget, reason: name);- }- expect(tester.getSemantics(tab('humans')), isSemantics(isSelected: true));- expect(find.byKey(const ValueKey('super-person-peer')), findsOneWidget);- await open(tester, 'agents');- expect(find.byKey(const ValueKey('super-person-peer')), findsNothing);- expect(row('agent-lead-agent'), findsOneWidget);- expect(tester.getSemantics(tab('agents')), isSemantics(isSelected: true));- // The week stays where it was.- expect(find.byKey(const ValueKey('leaderboard-week')), findsOneWidget);- semantics.dispose();- await close(tester, controller);- },- );-- testWidgets(- 'lists the PM and Buddies by name: role, what they shipped, one number, a crown for #1',- (tester) async {- final semantics = tester.ensureSemantics();- final controller = await show(tester, tabsSwarm());- await open(tester, 'agents');- expect(- inRow('agent-lead-agent', find.textContaining('River')),- findsOneWidget,- );- expect(- inRow('agent-lead-agent', find.textContaining('PM · Pilot')),- findsOneWidget,- );- expect(- inRow('agent-lead-agent', find.text('12 shipped')),- findsOneWidget,- );- expect(inRow('agent-lead-agent', find.text('36')), findsOneWidget);- expect(- inRow('agent-sparky', find.textContaining('Buddy · ken.tran')),- findsNothing,- );- expect(- inRow('agent-sparky', find.textContaining('Buddy · dee')),- findsOneWidget,- );- expect(- inRow('agent-sparky', find.text('4 proposals shipped')),- findsOneWidget,- );- expect(- find.byKey(const ValueKey('leaderboard-crown-agent-lead-agent')),- findsOneWidget,- );- expect(- find.byKey(const ValueKey('leaderboard-crown-agent-sparky')),- findsNothing,- );- expect(- find.bySemanticsLabel(RegExp('Number one this week')),- findsOneWidget,- );- // The points share one right-aligned column.- expect(- tester.getTopRight(inRow('agent-lead-agent', find.text('36'))).dx,- tester.getTopRight(inRow('agent-sparky', find.text('12'))).dx,- );- semantics.dispose();- await close(tester, controller);- },- );-- testWidgets(- 'lists models by what they ran on, never an agent\'s name, with their numbers in words',- (tester) async {- final controller = await show(tester, tabsSwarm());- await open(tester, 'models');- final opus = 'model-claude-opus-high', codex = 'model-codex-gpt-5.5-';- final reviewer = 'model-codex-gpt-5.5-medium';- expect(inRow(opus, find.textContaining('Opus · high')), findsOneWidget);- // What fits of the line, whole items from its start; all of it on hover.- const line = '31 shipped · 82% passed first review · 47 min to ship';- final shown = tester- .widget<Text>(- find.descendant(- of: find.byKey(ValueKey('leaderboard-numbers-$opus')),- matching: find.byType(Text),- ),- )- .data!;- expect(shown, startsWith('31 shipped'));- expect(- shown == line || line.substring(shown.length).startsWith(' · '),- isTrue,- reason: shown,- );- expect(inRow(opus, find.text('93')), findsOneWidget);- expect(inRow(codex, find.textContaining('GPT-5.5')), findsOneWidget);- expect(inRow(codex, find.text('17 shipped')), findsOneWidget);- expect(- inRow(reviewer, find.textContaining('GPT-5.5 · medium')),- findsOneWidget,- );- expect(inRow(reviewer, find.text('5 reviews')), findsOneWidget);- // The time from the request's first attempt is on hover.- expect(- find.byTooltip(- '31 shipped · 28 of 34 passed first review · 47 min from the shipping attempt, 3 h from the first',- ),- findsOneWidget,- );- // Crowns are for people and agents, not models (full review of #2097).- expect(find.byKey(ValueKey('leaderboard-crown-$opus')), findsNothing);- // Workers are never named: no agent's name in the list.- for (final id in [opus, codex, reviewer]) {- expect(inRow(id, find.textContaining('River')), findsNothing);- }- expect(- tester.getTopRight(inRow(opus, find.text('93'))).dx,- tester.getTopRight(inRow(reviewer, find.text('5'))).dx,- );- await close(tester, controller);- },- );-- testWidgets('says so when no agent or model has anything this week', (- tester,- ) async {- final controller = await show(tester, tabsSwarm(empty: true));- await open(tester, 'agents');- expect(find.text('No PM or Buddy in this project yet'), findsOneWidget);- await open(tester, 'models');- expect(find.text('No model worked this week'), findsOneWidget);- await close(tester, controller);- });-- test('writes a model\'s numbers in words, a share as a whole percent, zeros left out', () {- SuperTabModelScore score(Map<String, dynamic> extra) =>- SuperTabModelScore.fromJson({- 'engine': 'claude',- 'model': 'opus',- ...extra,- });- final opus = score({- 'shipped': {- 'count': 31,- 'medianAttemptMs': 47 * 60000,- 'medianRequestMs': 3 * 3600000,- },- 'firstReview': {'reviewed': 34, 'passed': 28},- });- expect(leaderboardModelNumbers(opus), [- '31 shipped',- '82% passed first review',- '47 min to ship',- ]);- expect(leaderboardModelNumbers(opus, full: true), [- '31 shipped',- '28 of 34 passed first review',- '47 min from the shipping attempt, 3 h from the first',- ]);- expect(leaderboardModelNumbers(score({'reviews': 1})), ['1 review']);- expect(leaderboardModelNumbers(score({})), isEmpty);- });-}diff --git a/desktop/test/super_tab_leaderboard_test.dart b/desktop/test/super_tab_leaderboard_test.dartindex 3b57ce229..cb90c43ee 100644--- a/desktop/test/super_tab_leaderboard_test.dart+++ b/desktop/test/super_tab_leaderboard_test.dart@@ -313,6 +313,48 @@ void main() {},);+ test('forgets the board once the reader may not read the project, without naming why', () async {+ final requests = FakeRequests();+ final reader = SuperTabLeaderboardReader(+ tabId: 'tab',+ request: requests.call,+ );+ addTearDown(reader.dispose);+ await reader.show('lead');+ expect(reader.board, isNotNull);+ requests.respond = (_) => const SuperTabFailure(+ 'FORBIDDEN',+ 'Not a member of Pilot.',+ statusCode: 403,+ );+ await reader.refresh();+ expect(reader.board, isNull);+ expect(reader.error, isNull);+ });++ test(+ 'clears the board and drops a read in flight once no project is shown',+ () async {+ final late = Completer<Map<String, dynamic>>();+ var reads = 0;+ final reader = SuperTabLeaderboardReader(+ tabId: 'tab',+ request: (method, path, {body}) async {+ reads++;+ return reads == 1 ? answer() : late.future;+ },+ );+ addTearDown(reader.dispose);+ await reader.show('lead');+ final inFlight = reader.refresh();+ reader.clear();+ expect(reader.board, isNull);+ late.complete(answer());+ await inFlight;+ expect(reader.board, isNull);+ },+ );+test('drops a board read for another project once the project changes',() async {diff --git a/desktop/test/super_tab_members_list_test.dart b/desktop/test/super_tab_members_list_test.dartnew file mode 100644index 000000000..b5b6d93b1--- /dev/null+++ b/desktop/test/super_tab_members_list_test.dart@@ -0,0 +1,226 @@+import 'package:flutter/material.dart';+import 'package:flutter/rendering.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/view.dart';++import 'support/humans_fixture.dart';+import 'support/super_tab_fixture.dart';++/// One member list again (Dee, 2026-10-29): Humans ranked under a heading that+/// carries the week, then the Agents with today's status line, a rank and the+/// week's points. Only the agents the board scores (the PM, Buddies) are+/// ranked; the others follow in today's order with no rank and no number.+void main() {+ Future<SuperTabController> show(+ WidgetTester tester,+ ConversationServer server,+ ) async {+ await tester.binding.setSurfaceSize(const Size(1300, 900));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final controller = server.controller(+ account: 'peer',+ initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},+ );+ await controller.refresh();+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.light),+ home: Scaffold(+ body: SuperTabView(+ controller: controller,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Mac Studio',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return controller;+ }++ Future<void> close(WidgetTester tester, SuperTabController controller) async {+ await tester.pumpWidget(const SizedBox());+ await controller.flush();+ controller.dispose();+ }++ Finder member(String id) => find.byKey(ValueKey('super-member-$id'));+ Finder rank(String id) => find.byKey(ValueKey('super-member-rank-$id'));+ Finder points(String id) => find.byKey(ValueKey('super-member-points-$id'));+ String text(WidgetTester tester, Finder finder) =>+ tester.widget<Text>(finder).data!;++ testWidgets('shows Humans under a heading with the week, and no list pills', (+ tester,+ ) async {+ final controller = await show(tester, membersSwarm());+ for (final pill in ['humans', 'agents', 'models']) {+ expect(find.byKey(ValueKey('leaderboard-tab-$pill')), findsNothing);+ }+ expect(find.text('Humans'), findsOneWidget);+ final week = find.byKey(const ValueKey('leaderboard-week'));+ expect(week, findsOneWidget);+ // The week sits on the Humans heading's line, at its trailing edge.+ expect(+ (tester.getCenter(week).dy - tester.getCenter(find.text('Humans')).dy)+ .abs(),+ lessThan(8),+ );+ expect(+ tester.getCenter(week).dx,+ greaterThan(tester.getCenter(find.text('Humans')).dx),+ );+ // People ranked as before, then the Agents below them.+ expect(find.byKey(const ValueKey('super-person-peer')), findsOneWidget);+ expect(+ tester.getTopLeft(member('lead-agent')).dy,+ greaterThan(+ tester.getTopLeft(find.byKey(const ValueKey('super-person-peer'))).dy,+ ),+ );+ await close(tester, controller);+ });++ testWidgets(+ 'ranks the agents the board scores, with their points, and keeps their status line',+ (tester) async {+ final semantics = tester.ensureSemantics();+ final controller = await show(tester, membersSwarm());+ expect(text(tester, rank('lead-agent')), '1');+ expect(text(tester, points('lead-agent')), '212');+ expect(find.bySemanticsLabel(RegExp(r'\b212 points')), findsOneWidget);+ // Today's one status line stays under the name.+ expect(+ find.byKey(const ValueKey('super-member-line-lead-agent')),+ findsOneWidget,+ );+ // The agents' points share the people's column.+ expect(+ tester.getTopRight(points('lead-agent')).dx,+ tester+ .getTopRight(find.byKey(const ValueKey('leaderboard-points-peer')))+ .dx,+ );+ semantics.dispose();+ await close(tester, controller);+ },+ );++ testWidgets(+ 'lists an agent without a score after the ranked ones, with no rank and no number',+ (tester) async {+ final controller = await show(tester, membersSwarm());+ expect(member('luna'), findsOneWidget);+ expect(rank('luna'), findsNothing);+ expect(points('luna'), findsNothing);+ // A score under another agent's id is not Luna's, though it bears her name.+ expect(+ find.descendant(of: member('luna'), matching: find.text('88')),+ findsNothing,+ );+ expect(+ find.byKey(const ValueKey('super-member-line-luna')),+ findsOneWidget,+ );+ expect(+ tester.getTopLeft(member('luna')).dy,+ greaterThan(tester.getTopLeft(member('lead-agent')).dy),+ );+ // A Buddy is not in the Agents list, so its score shows nowhere.+ expect(member('sparky'), findsNothing);+ await close(tester, controller);+ },+ );++ testWidgets('shows nothing of a board answered for another project', (+ tester,+ ) async {+ final server = membersSwarm();+ server.leaderboard!['projectId'] = 'other';+ final controller = await show(tester, server);+ expect(rank('lead-agent'), findsNothing);+ expect(points('lead-agent'), findsNothing);+ expect(find.byKey(const ValueKey('leaderboard-points-peer')), findsNothing);+ expect(find.text('212'), findsNothing);+ await close(tester, controller);+ });++ testWidgets('clears the numbers once the reader loses the project', (+ tester,+ ) async {+ final server = membersSwarm();+ final controller = await show(tester, server);+ expect(points('lead-agent'), findsOneWidget);+ server.state['projects'] = <Object>[];+ await controller.refresh();+ await tester.pumpAndSettle();+ expect(points('lead-agent'), findsNothing);+ expect(find.text('212'), findsNothing);+ expect(find.byKey(const ValueKey('leaderboard-points-peer')), findsNothing);+ await close(tester, controller);+ });++ testWidgets(+ 'reads a board without agents or models as people only, with no Models',+ (tester) async {+ final server = modelsSwarm(membersSwarm());+ server.leaderboard!+ ..remove('agents')+ ..remove('byModel');+ final controller = await show(tester, server);+ expect(+ find.byKey(const ValueKey('leaderboard-points-peer')),+ findsOneWidget,+ );+ expect(points('lead-agent'), findsNothing);+ expect(rank('lead-agent'), findsNothing);+ expect(find.byKey(const ValueKey('super-models-heading')), findsNothing);+ expect(find.textContaining('Loading'), findsNothing);+ await close(tester, controller);+ },+ );++ testWidgets('holds at 200% text: names give way, numbers stay whole', (+ tester,+ ) async {+ // Both side panes show at this size only in a wide window.+ await tester.binding.setSurfaceSize(const Size(2400, 1800));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final controller = modelsSwarm(membersSwarm()).controller(+ account: 'peer',+ initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},+ );+ await controller.refresh();+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.light),+ builder: (context, child) => MediaQuery(+ data: MediaQuery.of(context)+ .copyWith(textScaler: const TextScaler.linear(2)),+ child: child!,+ ),+ home: Scaffold(+ body: SuperTabView(+ controller: controller,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Mac Studio',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ expect(tester.takeException(), isNull);+ for (final number in ['212', '92%']) {+ expect(find.text(number), findsOneWidget, reason: number);+ final paragraph = tester.renderObject<RenderParagraph>(find.text(number));+ expect(paragraph.didExceedMaxLines, isFalse, reason: number);+ }+ await close(tester, controller);+ });+}diff --git a/desktop/test/super_tab_sidebar_models_test.dart b/desktop/test/super_tab_sidebar_models_test.dartnew file mode 100644index 000000000..a4a3d90e8--- /dev/null+++ b/desktop/test/super_tab_sidebar_models_test.dart@@ -0,0 +1,199 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/view.dart';++import 'support/humans_fixture.dart';+import 'support/super_tab_fixture.dart';++/// Models in the left sidebar, after Machines (Dee, 2026-10-29): the models+/// whose work reviewers approved most often on first review in the week the+/// right pane shows, as a bare percentage, the counts in words on hover and+/// for a screen reader. A model needs 3 first reviews to be listed.+void main() {+ Future<SuperTabController> show(+ WidgetTester tester,+ ConversationServer server,+ ) async {+ await tester.binding.setSurfaceSize(const Size(1300, 1400));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final controller = server.controller(+ account: 'peer',+ initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},+ );+ await controller.refresh();+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.light),+ home: Scaffold(+ body: SuperTabView(+ controller: controller,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Mac Studio',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return controller;+ }++ Future<void> close(WidgetTester tester, SuperTabController controller) async {+ await tester.pumpWidget(const SizedBox());+ await controller.flush();+ controller.dispose();+ }++ final heading = find.byKey(const ValueKey('super-models-heading'));+ Finder row(String name) => find.byKey(ValueKey('super-model-$name'));+ Finder inRow(String name, Finder finder) =>+ find.descendant(of: row(name), matching: finder);++ testWidgets(+ 'lists the top three by first-review approval after Machines, as a bare percentage',+ (tester) async {+ final controller = await show(tester, modelsSwarm());+ expect(heading, findsOneWidget);+ expect(+ tester.getTopLeft(heading).dy,+ greaterThan(tester.getTopLeft(find.text('Machines')).dy),+ );+ expect(inRow('Opus 5.5', find.text('92%')), findsOneWidget);+ expect(inRow('GPT-6.1 Sol', find.text('81%')), findsOneWidget);+ expect(inRow('Sonnet 5.5', find.text('70%')), findsOneWidget);+ // Fourth, so not shown until asked for; too few reviews, never.+ expect(row('Haiku 5.5'), findsNothing);+ expect(row('GPT-6.1 Luna'), findsNothing);+ final top = tester.getTopLeft(row('Opus 5.5')).dy;+ final second = tester.getTopLeft(row('GPT-6.1 Sol')).dy;+ expect(top, lessThan(second));+ expect(second, lessThan(tester.getTopLeft(row('Sonnet 5.5')).dy));+ // No effort split, no rank, no other number.+ expect(find.textContaining('Opus 5.5 ·'), findsNothing);+ // The percentages line up at their trailing edge.+ expect(+ tester.getTopRight(find.text('92%')).dx,+ tester.getTopRight(find.text('70%')).dx,+ );+ await close(tester, controller);+ },+ );++ testWidgets('says the counts in words on hover and to a screen reader', (+ tester,+ ) async {+ final semantics = tester.ensureSemantics();+ final controller = await show(tester, modelsSwarm());+ expect(+ find.byTooltip('11 of 12 approved on first review this week'),+ findsOneWidget,+ );+ expect(+ find.bySemanticsLabel(+ 'Opus 5.5: 11 of 12 approved on first review this week',+ ),+ findsOneWidget,+ );+ semantics.dispose();+ await close(tester, controller);+ });++ testWidgets('shows the whole list from its heading, and back', (+ tester,+ ) async {+ final controller = await show(tester, modelsSwarm());+ await tester.tap(+ find.descendant(of: heading, matching: find.text('Models')),+ );+ await tester.pumpAndSettle();+ expect(inRow('Haiku 5.5', find.text('50%')), findsOneWidget);+ expect(row('GPT-6.1 Luna'), findsNothing);+ await tester.tap(+ find.descendant(of: heading, matching: find.text('Models')),+ );+ await tester.pumpAndSettle();+ expect(row('Haiku 5.5'), findsNothing);+ await close(tester, controller);+ });++ testWidgets('follows the week the right pane shows', (tester) async {+ final server = modelsSwarm();+ final controller = await show(tester, server);+ server.leaderboard!['byModel'] = [+ modelScore('claude', 'claude-sonnet-5-5', 'high', reviewed: 4, passed: 4),+ ];+ await tester.tap(find.byKey(const ValueKey('leaderboard-week')));+ await tester.pumpAndSettle();+ await tester.tap(find.text('Last week').last);+ await tester.pumpAndSettle();+ expect(server.leaderboardReads.last, contains('&week='));+ expect(row('Opus 5.5'), findsNothing);+ expect(inRow('Sonnet 5.5', find.text('100%')), findsOneWidget);+ expect(+ find.byTooltip('4 of 4 approved on first review last week'),+ findsOneWidget,+ );+ await close(tester, controller);+ });++ testWidgets(+ 'lists a model run through two engines once, its reviews together',+ (tester) async {+ // Review of e4b70e9: one grid model through Claude Code and Codex drew+ // two rows with one key ("Duplicate keys found").+ final server = modelsSwarm();+ server.leaderboard!['byModel'] = [+ modelScore('claude', 'qwen3', 'high', reviewed: 4, passed: 3),+ modelScore('codex', 'qwen3', null, reviewed: 4, passed: 4),+ ];+ final controller = await show(tester, server);+ expect(tester.takeException(), isNull);+ expect(row('qwen3'), findsOneWidget);+ expect(inRow('qwen3', find.text('88%')), findsOneWidget);+ expect(+ find.byTooltip('7 of 8 approved on first review this week'),+ findsOneWidget,+ );+ await close(tester, controller);+ },+ );++ testWidgets('hides Models when no model has three first reviews', (+ tester,+ ) async {+ final server = modelsSwarm();+ server.leaderboard!['byModel'] = [+ modelScore('claude', 'claude-opus-5-5', 'high', reviewed: 2, passed: 2),+ ];+ final controller = await show(tester, server);+ expect(heading, findsNothing);+ await close(tester, controller);+ });++ testWidgets('clears Models once the reader loses the project', (+ tester,+ ) async {+ final server = modelsSwarm();+ final controller = await show(tester, server);+ expect(row('Opus 5.5'), findsOneWidget);+ server.state['projects'] = <Object>[];+ await controller.refresh();+ await tester.pumpAndSettle();+ expect(heading, findsNothing);+ expect(find.text('92%'), findsNothing);+ await close(tester, controller);+ });++ testWidgets('shows no Models from a board answered for another project', (+ tester,+ ) async {+ final server = modelsSwarm();+ server.leaderboard!['projectId'] = 'other';+ final controller = await show(tester, server);+ expect(heading, findsNothing);+ await close(tester, controller);+ });+}diff --git a/desktop/test/support/humans_fixture.dart b/desktop/test/support/humans_fixture.dartindex fefbf08b6..07ae0d4a5 100644--- a/desktop/test/support/humans_fixture.dart+++ b/desktop/test/support/humans_fixture.dart@@ -123,3 +123,106 @@ void addNumberedWorkgroups(ConversationServer server, int count) {});}}++/// The Pilot project's PM River (212 points), a Builder Luna the board does+/// not score, and Dee's Buddy Sparky; another project's Buddy is named Luna.+ConversationServer membersSwarm() {+ final server = humansSwarm();+ final agents = server.state['agents'] as List;+ final lead = (agents.first as Map).cast<String, dynamic>()+ ..['machineId'] = 'studio';+ server.state['agents'] = <Object>[+ lead,+ {+ ...lead,+ 'id': 'luna',+ 'harnessId': 'h-luna',+ 'name': 'Luna',+ 'displayName': 'Luna',+ 'projectId': 'lead',+ },+ {+ ...lead,+ 'id': 'sparky',+ 'harnessId': 'h-sparky',+ 'name': 'Sparky',+ 'displayName': 'Sparky',+ 'buddyOf': {'personId': 'peer', 'generation': 'g'},+ },+ ];+ server.leaderboard!['agents'] = [+ {+ 'agentId': 'lead-agent',+ 'displayName': 'River',+ 'kind': 'pm',+ 'personId': null,+ 'machineId': 'studio',+ 'points': 212,+ 'rank': 1,+ 'shipped': 70,+ },+ {+ 'agentId': 'sparky',+ 'displayName': 'Sparky',+ 'kind': 'buddy',+ 'personId': 'peer',+ 'machineId': 'studio',+ 'points': 12,+ 'rank': 2,+ 'shipped': 4,+ },+ // Another agent named like one in the list is never taken for it.+ {+ 'agentId': 'elsewhere',+ 'displayName': 'Luna',+ 'kind': 'buddy',+ 'personId': 'owner',+ 'machineId': 'studio',+ 'points': 88,+ 'rank': 3,+ 'shipped': 3,+ },+ ];+ return server;+}++/// One model's week on the board: its first reviews and how many passed.+Map<String, dynamic> modelScore(+ String engine,+ String? model,+ String? effort, {+ required int reviewed,+ required int passed,+}) => {+ 'engine': engine,+ 'model': model,+ 'effort': effort,+ 'grid': false,+ 'points': 0,+ 'rank': 1,+ 'shipped': {'count': 0, 'medianAttemptMs': null, 'medianRequestMs': null},+ 'firstReview': {'reviewed': reviewed, 'passed': passed},+ 'reviews': 0,+};++/// The week's models (Dee, 2026-10-29): Opus at two efforts, 11 of 12 together.+ConversationServer modelsSwarm([ConversationServer? base]) {+ final server = base ?? humansSwarm();+ server.leaderboard!['byModel'] = [+ // One model at two efforts is one row: 11 of 12.+ modelScore('claude', 'claude-opus-5-5', 'high', reviewed: 10, passed: 9),+ modelScore('claude', 'claude-opus-5-5', 'xhigh', reviewed: 2, passed: 2),+ modelScore('codex', 'gpt-6.1-sol', null, reviewed: 16, passed: 13),+ modelScore(+ 'claude',+ 'claude-sonnet-5-5',+ 'medium',+ reviewed: 10,+ passed: 7,+ ),+ modelScore('claude', 'claude-haiku-5-5', 'low', reviewed: 4, passed: 2),+ // Too few first reviews to say anything, however good.+ modelScore('codex', 'gpt-6.1-luna', null, reviewed: 2, passed: 2),+ ];+ return server;+}diff --git a/desktop/test/support/super_tab_fixture.dart b/desktop/test/support/super_tab_fixture.dartindex 1b59a9da1..bed8922c5 100644--- a/desktop/test/support/super_tab_fixture.dart+++ b/desktop/test/support/super_tab_fixture.dart@@ -412,6 +412,10 @@ class ConversationServer {// fields such as `credentialNotice`.final commandResult = <String, dynamic>{};final posts = <Map<String, dynamic>>[];++ /// Refuses the next lead.start with this code and message, as the backend+ /// refuses a machine that cannot take the Product Manager (leadStart.ts).+ Map<String, String>? leadRefusal;final receipts = <String, Map<String, dynamic>>{};final messages = <Map<String, dynamic>>[];// Route decisions by id, answered by GET .../route-decisions/:id.@@ -960,6 +964,31 @@ class ConversationServer {},});output['conversationId'] = id;+ } else if (command['type'] == 'lead.start') {+ if (leadRefusal case final refusal?) {+ leadRefusal = null;+ throw SuperTabFailure(+ refusal['code']!,+ refusal['message']!,+ statusCode: 409,+ );+ }+ revision++;+ final machineId = command['machineId'] as String?;+ output.addAll(+ machineId == null+ ? {'waiting': true}+ : {'startId': 'lead-start-$revision', 'machineId': machineId},+ );+ final project = (state['projects'] as List?)+ ?.cast<Map<String, dynamic>>()+ .where((p) => p['id'] == command['projectId'])+ .firstOrNull;+ project?['lead'] = {+ 'status': machineId == null ? 'waiting' : 'starting',+ 'machineId': ?machineId,+ 'requestedAt': revision,+ };} else if (command['type'] == 'project.create') {revision++;final projects = state['projects'] ??= <dynamic>[diff --git a/desktop/test/swarm_creation_form_test.dart b/desktop/test/swarm_creation_form_test.dartindex 0b12c44db..b986337ad 100644--- a/desktop/test/swarm_creation_form_test.dart+++ b/desktop/test/swarm_creation_form_test.dart@@ -318,6 +318,26 @@ void main() {..agents = [];}+ void agentIn(+ SuperTabLaunchFixture f, {+ String? model,+ String remote = '[email protected]:autonomous-ai/lamp-os.git',+ }) => f.app.machineStates['m']!.agents = [+ Agent(+ id: 'earlier',+ name: 'Earlier',+ engine: 'codex',+ modelName: model,+ terminalAvailable: true,+ project: AgentProject(+ name: 'lamp-os',+ cwd: '/work/lamp-os',+ root: '/work/lamp-os',+ remote: remote,+ ),+ ),+ ];+final leadLine = find.byKey(const ValueKey('new-harness-lead-line'));final change = find.byKey(const ValueKey('new-harness-lead-change'));@@ -511,33 +531,43 @@ void main() {await unmount(tester);});+ const studioFull = LeadMachine(+ id: 'm',+ name: 'Mac Studio',+ online: true,+ freeAgents: 0,+ );+ const diegoTeam = LeadMachine(+ id: 'diego-mac',+ name: 'Diego MacBook',+ online: true,+ freeAgents: 3,+ own: false,+ native: false,+ team: true,+ );+for (final brightness in Brightness.values) {testWidgets(- 'With no machine free New Project says so and waits in ${brightness.name}',+ 'With no machine free New Project queues the PM in ${brightness.name}',(tester) async {final (box, boundary) = await mount(tester,brightness: brightness,- leadMachines: [- const LeadMachine(- id: 'm',- name: 'Mac Studio',- online: true,- freeAgents: 0,- ),- rig,- ],+ leadMachines: [studioFull, rig],+ setup: agentIn,);+ expect(box.leadQueued, isTrue);+ expect(box.leadThroughSwarm, isTrue);expect(find.text(- 'No machine of yours in this Swarm is free. New Project can start once one is.',+ 'All Swarm machines are busy. The project starts on the first one that frees up.',),findsOneWidget,);- expect(tester.widget<FilledButton>(_start).onPressed, isNull);box.setTask('Plan the launch');await tester.pump();- expect(tester.widget<FilledButton>(_start).onPressed, isNull);+ expect(tester.widget<FilledButton>(_start).onPressed, isNotNull);await shot(tester,boundary,@@ -548,6 +578,100 @@ void main() {);}+ testWidgets('A queued PM needs a repo the Swarm can clone', (tester) async {+ final (box, _) = await mount(tester, leadMachines: [studioFull, rig]);+ expect(+ box.leadBlocked,+ 'Choose a repo with a remote, so the Swarm can clone it for the Product Manager.',+ );+ expect(tester.widget<FilledButton>(_start).onPressed, isNull);+ await unmount(tester);+ });++ for (final brightness in Brightness.values) {+ testWidgets(+ 'A teammate’s Team account takes the PM when yours are full in ${brightness.name}',+ (tester) async {+ final (box, boundary) = await mount(+ tester,+ brightness: brightness,+ leadMachines: [studioFull, diegoTeam],+ setup: agentIn,+ );+ expect(box.leadThroughSwarm, isTrue);+ expect(box.leadQueued, isFalse);+ expect(box.leadSwarmMachine, 'diego-mac');+ // The repo stays the one chosen on your machine; Diego's Mac clones it.+ expect(box.machineId, 'm');+ final line = find.descendant(of: leadLine, matching: find.byType(Text));+ expect(+ tester.widget<Text>(line.first).data,+ 'Product Manager: Diego MacBook’s Team account · Codex · '+ 'Default model · lamp-os will be cloned there',+ );+ box.setTask('Plan the launch');+ await tester.pump();+ expect(tester.widget<FilledButton>(_start).onPressed, isNotNull);+ await tester.tap(change);+ await tester.pumpAndSettle();+ expect(+ find.descendant(+ of: find.byKey(+ const ValueKey('new-harness-lead-machine-diego-mac'),+ ),+ matching: find.byIcon(AppIcons.check),+ ),+ findsOneWidget,+ );+ await tester.tap(+ find.byKey(const ValueKey('new-harness-lead-advanced')),+ );+ await tester.pumpAndSettle();+ // Your machine's account and branches say nothing about Diego's Mac.+ expect(+ find.byKey(const ValueKey('new-harness-field-profile')),+ findsNothing,+ );+ expect(+ find.byKey(const ValueKey('new-harness-field-branch')),+ findsNothing,+ );+ expect(+ find.byKey(const ValueKey('new-harness-field-agent')),+ findsOneWidget,+ );+ await shot(+ tester,+ boundary,+ 'new-project-lead-${brightness.name}-team',+ );+ await unmount(tester);+ },+ );+ }++ testWidgets('Choosing your machine again starts the PM here', (tester) async {+ final (box, _) = await mount(+ tester,+ leadMachines: [studio, diegoTeam],+ setup: agentIn,+ );+ expect(box.leadThroughSwarm, isFalse);+ await tester.tap(change);+ await tester.pumpAndSettle();+ await tester.tap(+ find.byKey(const ValueKey('new-harness-lead-machine-diego-mac')),+ );+ await tester.pumpAndSettle();+ expect(box.leadSwarmMachine, 'diego-mac');+ await tester.tap(find.byKey(const ValueKey('new-harness-lead-machine-m')));+ await tester.pumpAndSettle();+ expect(box.leadThroughSwarm, isFalse);+ expect(box.leadSwarmMachine, isNull);+ expect(box.machineId, 'm');+ await unmount(tester);+ });+testWidgets('The Product Manager line stays usable at 2x text in a compact window',(tester) async {@@ -583,26 +707,6 @@ void main() {},);- void agentIn(- SuperTabLaunchFixture f, {- String? model,- String remote = '[email protected]:autonomous-ai/lamp-os.git',- }) => f.app.machineStates['m']!.agents = [- Agent(- id: 'earlier',- name: 'Earlier',- engine: 'codex',- modelName: model,- terminalAvailable: true,- project: AgentProject(- name: 'lamp-os',- cwd: '/work/lamp-os',- root: '/work/lamp-os',- remote: remote,- ),- ),- ];-testWidgets('The line never guesses the model from other agents', (tester,) async {@@ -719,6 +823,53 @@ void main() {await unmount(tester);});+ testWidgets('Moving the PM drops the old machine’s branch at once', (+ tester,+ ) async {+ final reads = <(String, String)>[];+ final (box, _) = await mount(+ tester,+ setup: (f) {+ addLaptop(f);+ agentIn(f);+ f.app.gitProjectReaderForTest = (machine, folder) async {+ reads.add((machine, folder));+ return {+ 'isGit': true,+ 'branch': 'main',+ 'branches': [+ {'ref': 'refs/heads/main', 'name': 'main'},+ {'ref': 'refs/heads/$machine-only', 'name': '$machine-only'},+ ],+ };+ };+ },+ leadMachines: [+ studio,+ const LeadMachine(+ id: 'laptop',+ name: 'Ken MacBook',+ online: true,+ freeAgents: 2,+ folders: {+ 'github.com/autonomous-ai/lamp-os': '/Users/ken/swarm/lamp-os',+ },+ ),+ ],+ );+ await tester.pumpAndSettle();+ box.focusField(NewHarnessField.branch);+ box.accept(box.options.firstWhere((o) => o.id == 'refs/heads/m-only'));+ final before = reads.length;+ // No frame and no refresh in between: the move itself re-reads Git.+ box.chooseLeadMachine('laptop');+ expect(box.branchRef, isNot('refs/heads/m-only'));+ expect(box.checkingGit, isTrue);+ await tester.pumpAndSettle();+ expect(reads.skip(before).first, ('laptop', '/Users/ken/swarm/lamp-os'));+ await unmount(tester);+ });+testWidgets('Moving the PM drops a branch of the old machine, repo unknown', (tester,) async {diff --git a/desktop/test/swarm_state_test.dart b/desktop/test/swarm_state_test.dartindex d3aeb5fb2..74e72f97e 100644--- a/desktop/test/swarm_state_test.dart+++ b/desktop/test/swarm_state_test.dart@@ -3,6 +3,7 @@ import 'package:harness/auth/auth_session.dart';import 'package:harness/core/config.dart';import 'package:harness/core/local_key_value_store.dart';import 'package:harness/core/models.dart';+import 'package:harness/core/project_folder.dart';import 'package:harness/measurement/product_measurement.dart';import 'package:harness/state/app_state.dart';import 'package:harness/state/pane_layout_store.dart';@@ -29,22 +30,63 @@ class MemoryStore implements LocalKeyValueStore {}}+/// An app whose local project folders are prepared by [prepare] instead of+/// Git on this computer.+class _PreparingApp extends AppNotifier {+ _PreparingApp(+ this.prepare, {+ required super.config,+ required super.authSession,+ super.configStore,+ super.connectionForTest,+ super.localCliDiscovery,+ super.productMeasurement,+ super.paneLayoutStore,+ });+ final Future<String> Function(ProjectFolderRequest request) prepare;+ @override+ Future<String> prepareLocalProjectFolder(+ ProjectFolderRequest request, {+ String label = 'harness',+ }) => prepare(request);+}++/// [prepareFolder]: prepares local project folders (worktrees, clones)+/// instead of Git on this computer.AppNotifier createApp({MemoryStore? store,WsConn Function(String)? connectionForTest,bool connected = false,ProductMeasurement? productMeasurement,LocalCliDiscovery? localCliDiscovery,+ Future<String> Function(ProjectFolderRequest request)? prepareFolder,}) {- final app = AppNotifier(- config: AppConfig.dev,- authSession: AuthSession(),- configStore: null,- connectionForTest: connectionForTest,- localCliDiscovery: localCliDiscovery,- productMeasurement: productMeasurement,- paneLayoutStore: store == null ? null : PaneLayoutStore(storage: store),- )..hasNavigationRail = false;+ final app =+ (prepareFolder == null+ ? AppNotifier(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ connectionForTest: connectionForTest,+ localCliDiscovery: localCliDiscovery,+ productMeasurement: productMeasurement,+ paneLayoutStore: store == null+ ? null+ : PaneLayoutStore(storage: store),+ )+ : _PreparingApp(+ prepareFolder,+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ connectionForTest: connectionForTest,+ localCliDiscovery: localCliDiscovery,+ productMeasurement: productMeasurement,+ paneLayoutStore: store == null+ ? null+ : PaneLayoutStore(storage: store),+ ))+ ..hasNavigationRail = false;const machine = Machine(machineId: 'm',authMode: MachineAuthMode.remote,diff --git a/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-mockup.html b/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-mockup.htmlnew file mode 100644index 000000000..bdffdf791--- /dev/null+++ b/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-mockup.html@@ -0,0 +1,218 @@+<!doctype html>+<html lang="vi">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>Round PM and Buddy</title>+<style>+:root { --bg: #f4f4f6; --panel: #fff; --ink: #1c1d22; --muted: #6b6d78; --line: #e3e4ea; --chip: #eef0f5; }+@media (prefers-color-scheme: dark) {+ :root:not([data-theme="light"]) { --bg: #0f1014; --panel: #17181e; --ink: #eaeaf0; --muted: #8a8a99; --line: #2a2c35; --chip: #22242c; }+}+:root[data-theme="dark"] { --bg: #0f1014; --panel: #17181e; --ink: #eaeaf0; --muted: #8a8a99; --line: #2a2c35; --chip: #22242c; }+* { box-sizing: border-box; }+body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }+main { max-width: 1280px; margin: 0 auto; padding: 28px 16px 64px; }+h1 { font-size: 22px; margin: 0 0 6px; }+h2 { font-size: 17px; margin: 40px 0 6px; }+p.note, ul.note { color: var(--muted); margin: 0 0 14px; max-width: 900px; }+ul.note { padding-left: 18px; }+code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--chip); padding: 1px 5px; border-radius: 5px; }+.flow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }+.step { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 240px; }+.step .cap { font-size: 12.5px; color: var(--muted); text-align: center; min-height: 38px; }+.arrow { color: var(--muted); font-size: 12px; text-align: center; width: 64px; }+.arrow b { display: block; font-size: 22px; color: var(--ink); }+.dial { width: 230px; height: 230px; border-radius: 50%; background: #000; box-shadow: 0 0 0 8px #2a2b31, 0 8px 24px rgba(0,0,0,.35); overflow: hidden; position: relative; }+.dial svg { width: 100%; height: 100%; display: block; }+.demoWrap { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }+.demo { width: 400px; height: 400px; cursor: grab; touch-action: none; user-select: none; }+.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }+.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }+.btns button { border: 1px solid var(--line); background: var(--chip); color: var(--ink); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 13px; }+</style>+</head>+<body>+<main>+ <h1>Round dial, phương án A: vuốt dọc giữa PM và Buddy</h1>+ <p class="note">Bản sửa theo góp ý: không còn chữ "PM". Màn PM vẫn như hôm nay (pet của engine PM và recap). Sang Buddy thì giữa màn là avatar của Buddy, đúng avatar Desktop đang vẽ cho Buddy (lưới 5×5 lấy từ tên "<người>'s Buddy"), không có huy hiệu engine, có viền tím. Cách nói giữ nguyên như hôm nay: chạm vào mặt dial để bắt đầu, chạm lại để gửi. Lúc đang nghe và đang gửi vẫn dùng pet Claude hoặc Codex, theo engine của chat đang nói tới.</p>++ <h2>Thử trực tiếp</h2>+ <div class="demoWrap">+ <div class="dial demo" id="demo"></div>+ <div class="panel" style="max-width:540px">+ <b>Kéo chuột trên dial</b> (chạm là nói): ngang để đổi project, dọc để chuyển PM ↔ Buddy (lên là Buddy, xuống là PM). Chạm vào dial (hoặc nút "Chạm để nói") để bắt đầu nói, chạm lại để gửi, như hôm nay.+ <div class="btns">+ <button data-a="prev">‹ project</button><button data-a="next">project ›</button>+ <button data-a="up">↑ Buddy</button><button data-a="down">↓ PM</button>+ <button id="talk">Chạm để nói</button>+ <button data-a="reply">Giả lập Buddy vừa trả lời</button>+ </div>+ <p class="note" style="margin-top:10px">web-api: PM chạy Claude, Buddy chạy Claude. firmware: PM chạy Codex, Buddy chạy Codex. docs: chưa có Buddy.</p>+ </div>+ </div>++ <h2>Chuyển màn</h2>+ <div class="flow" id="flow"></div>++ <h2>Nói ở màn Buddy: dùng pet của engine</h2>+ <p class="note">Cử chỉ và màn nghe, màn gửi giống hệt hôm nay (chạm để nói, chạm lại để gửi), chỉ khác viền tím và dòng chữ ở cung dưới nói rõ đang gửi cho Buddy. Gửi xong thì quay về avatar Buddy.</p>+ <div class="flow" id="voiceClaude"></div>+ <div class="flow" id="voiceCodex" style="margin-top:14px"></div>++ <h2>Nói ở màn PM</h2>+ <div class="flow" id="voicePm"></div>++ <h2>Các trạng thái khác</h2>+ <div class="flow" id="states"></div>+</main>+<script>+const IMG = {"claude-face": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABfCAIAAACrwYhbAAAACXBIWXMAAAAAAAAAAQCEeRdzAAADuElEQVR4nO2dMWvbQBiGr+DhBBkk8GBDAtZQqCEdFLqkZGg7ZvSYZvJfCJ3yGzKmY5dCl0LHTiUtFJoOIRkdaKGGBuQhIEEDukFD5RpMEteW5Po7v0rfByKMkHTf3SPpJJ0+5Z4iANSWHQAZQg0QUAME1AABNUBADRBQAwTUAAE1QEANEFADBNQAATVAIKWhs95quI7Qxi2RKpNm0ySbxsa8/z6QK0pEw95WsBP4Wkts2ypDAXGU+UhS0657B197QgWJaOhu+qMfTtVUZM2dNfoYXVNuzYnTxKnp7fuNimkY4a24uu7JbV8CbZJoMPXk06q7/ctYolzJLnqlYodChtZOtuMPjwm7CGowl7Guy21eBGOUfQdKVMOwPtkBXqvSMbEUB0r6viHJ/pZUsWrB2zcIlqDhbBD1whvXG76ng9WmthsLSBgjbJf5IzaHn3vZ9PpMT+v9p1kT2Lu6BQljjG0NsUluVT4jMiaMTLD634Uxhn0DBNQAATVAQA0QUAME1ABBvobOg5ZbpcdCgjxf96NSz2aMenlSaIgiR8P+VntzreEs9pipqetDK8UCEaB8GJ3AL3ePnarH7c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DbQjF15QY4wDBIXQTyo8EZOVLSyAkJCEEQi+hiGawDe6WMbjKXdeyZfV+dXXrac8zs9f6/bH23jNHNqlX7XK2Xkfn3KfM7JlZ5bM6bK2ttbW21tbaWltra22trbW1ttbW2lpba2ttra21tbbW1tpaW2trba2ttbW21tbaWltra22trbW1ttbW2lpba2ttra21tbbW1tpaW2trba2ttbW21tbaWltra22trbW1ttbW2lpba2ttra21tbbW1tpaW2trba2ttbW21tbaWltra22trbW1ttbW2lpba2ttrYdvySO9gUfZ+hz34yoBuPji97W33H7L+zWtnQO63Sw2SDAkACIQzb8tYH0ABTEDMQwDwCyI9PMzz33SS+6++a/f/qAT2UN6ZQ/PEh5j19E80ht4FKzPSfRXXklYWblH1i9EFm++p7nnKF+a+vWzCGERaUUI6sQPTumGYGCKCWk4ljl/AIgqhhxfOfIUrvj2d3HdmWnfvv1yzTWXG1ydP/yYXo+5/f9D1wCf8/r37dsXXvfXN71eSOfHJsaUdHG2dnCnIBGZNEgTkCCYYShYwp+9Aeq/jUz44r8t/21GE5fnzeKOj4UmHA/CehOam77g5V/1I3/9n7939rBd+dYCtjSAS6x9++KVBy6X007bbwDv+kj3Hanf+EJITd8lweYhNi2v/JE/DRvH7sVsJimts7G6IceOHTSdrXP0yANghkhkvr7KvOsJdMznc9A5XdrAUk9KcOTQwaabrz3D5rjG0D7c+Dcffifsez1co5v2trUe0vUPXQMAJjJ94h+CnR/aSYhNM+021i4McSGYqUAvYjNpF7bJD/6na0EmoiYgIo5szC2AEAhF2FfadUisikmAJgj0PT//L/dx+NDdoIbZ3LCZBUhnXfykXzH0vWb6wbs++YbPsMUED/n6h8oAAlcJ+/bLU29fetxHP/R3H5EQF0WagAhNA99y1f/g+L0PcHzluHTdBhc//snsOesCDEMFCSIEkQrvx3fSKtkakj8TghGDM8g73vAnduzoUdaOHaOfHeLYA3dwxw3XWoiaDLrtO8758xd98fmvuuaaqg0evMYcNlpXCVz9v8M0W4yV1z8EBvgsIjnnspsub5cWdocJZ9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r0+O8y/De1ogBdGwlyHjyYIfiug1s7vBmgYY0S3F5DnPWfY5hwvlPLNKRc7BOxogB16hdOOAOzQK5p2BGCHXtG0IwA79IqmHQHYoVc07QjADr2iaUcAdugVTf9/ENaMRvlEe3AAAAAASUVORK5CYII="};+const TONE = 72; // the dial is dark: Desktop's dark-mode lightness for agent patterns+const LILAC = '#c49bff', BLUE = '#0a6cff', FG = '#eaeaf0', MUTED = '#8a8a99', GREEN = '#00ff2f';+let uid = 0;+const esc = s => String(s).replace(/[&<>]/g, c => ({ '&': '&', '<': '<', '>': '>' }[c]));++// Desktop's agent pattern (avatar_art.dart superTabAgentPattern), ported exactly.+function fnv(text) { let h = 0x811c9dc5; for (let i = 0; i < text.length; i++) h = Math.imul(h ^ text.charCodeAt(i), 0x01000193) >>> 0; return h >>> 0; }+function pattern(name) {+ const h = fnv(name.trim().toLowerCase()), half = Array.from({ length: 15 }, (_, b) => ((h >>> b) & 1) === 1);+ if (!half.includes(true)) half[7] = true;+ const cells = []; for (let r = 0; r < 5; r++) for (const c of [0, 1, 2, 1, 0]) cells.push(half[r * 3 + c]);+ return { cells, hue: (h >>> 16) % 360 };+}+function buddyAvatar(name, engine, cx, cy, r) {+ const { cells, hue } = pattern(name), color = `hsl(${hue} 42% ${TONE}%)`, inner = r * 2 * .56, cell = inner / 5;+ let s = `<circle cx="${cx}" cy="${cy}" r="${r}" fill="${color}" fill-opacity=".16"/>`;+ cells.forEach((on, i) => { if (on) s += `<rect x="${cx - inner / 2 + (i % 5) * cell}" y="${cy - inner / 2 + Math.floor(i / 5) * cell}" width="${cell}" height="${cell}" rx="${cell * .2}" fill="${color}"/>`; });+ return s;+}++function wrap(text, max = 26, lines = 3) {+ const out = []; let line = '';+ for (const w of text.split(' ')) { if ((line + ' ' + w).trim().length > max) { out.push(line.trim()); line = w; } else line += ' ' + w; }+ if (line.trim()) out.push(line.trim());+ if (out.length > lines) { out.length = lines; out[lines - 1] = out[lines - 1].replace(/.{0,2}$/, '…'); }+ return out;+}++// o: { project, side, engine (of the chat on the face), owner, recap, hasBuddy, buddies, unreadBuddy, bell, bottom, bottomColor, voice: 'listen'|'send' }+function face(o) {+ const id = 'arc' + (uid++), id2 = 'arcb' + uid, buddy = o.side === 'buddy';+ let s = `<svg viewBox="0 0 466 466" xmlns="http://www.w3.org/2000/svg">+ <defs><path id="${id}" d="M 63 233 A 170 170 0 0 1 403 233"/><path id="${id2}" d="M 78 300 A 160 160 0 0 0 388 300"/></defs>+ <rect width="466" height="466" fill="#000"/>`;+ if (buddy) s += `<circle cx="233" cy="233" r="230" fill="none" stroke="${LILAC}" stroke-opacity=".32" stroke-width="3"/>`;+ s += `<text font-family="-apple-system, Geist, sans-serif" font-size="30" font-weight="500" fill="${FG}"><textPath href="#${id}" startOffset="50%" text-anchor="middle">${esc(o.project)}</textPath></text>`;+ if (o.voice) {+ // Today's voice screens: the engine's pet, larger, no recap card.+ const img = IMG[`${o.engine}-${o.voice}`], codex = o.engine === 'codex';+ const w = codex ? 150 : 210, h = codex ? 162 : 162;+ s += `<image href="${img}" x="${233 - w / 2}" y="${150}" width="${w}" height="${h}"/>`;+ const text = o.voice === 'listen' ? 'Listening' : buddy ? 'Sending to your Buddy' : `Sending to ${o.project}`;+ s += `<text font-family="-apple-system, sans-serif" font-size="24" fill="${o.voice === 'listen' ? '#1f7a33' : buddy ? LILAC : GREEN}"><textPath href="#${id2}" startOffset="50%" text-anchor="middle">${esc(text)}</textPath></text>`;+ } else if (buddy && !o.hasBuddy) {+ s += `<circle cx="233" cy="168" r="44" fill="none" stroke="#3a3b44" stroke-width="3" stroke-dasharray="7 7"/>+ <text x="233" y="181" text-anchor="middle" font-family="-apple-system, sans-serif" font-size="40" fill="#55565f">+</text>+ <text x="233" y="262" text-anchor="middle" font-family="-apple-system, sans-serif" font-size="27" fill="#8a8a99">No Buddy here yet</text>+ <text x="233" y="298" text-anchor="middle" font-family="-apple-system, sans-serif" font-size="21" fill="#6b6d78">Add one in the Harness app.</text>`;+ } else {+ if (buddy) s += buddyAvatar(`${o.owner}'s Buddy`, o.engine, 233, 158, 46);+ else {+ const codex = o.engine === 'codex', w = codex ? 74 : 98, h = codex ? 74 : 72;+ s += `<image href="${IMG[`${o.engine}-face`]}" x="${233 - w / 2}" y="${codex ? 116 : 122}" width="${w}" height="${h}"/>`;+ }+ const lines = wrap(o.recap || ''), h = 26 + lines.length * 38, top = 216;+ s += `<rect x="41" y="${top}" width="384" height="${h}" rx="28" fill="#23252f" stroke="${buddy ? LILAC : '#3d3f47'}" stroke-opacity="${buddy ? .5 : 1}" stroke-width="1.5"/>`;+ lines.forEach((l, i) => { s += `<text x="233" y="${top + 44 + i * 38}" text-anchor="middle" font-family="-apple-system, Geist, sans-serif" font-size="27" fill="${FG}">${esc(l)}</text>`; });+ }+ if (o.buddies !== false) {+ const top = !buddy;+ s += `<circle cx="442" cy="218" r="${top ? 6 : 4.5}" fill="${top ? FG : '#55565f'}"/><circle cx="442" cy="248" r="${top ? 4.5 : 6}" fill="${top ? '#55565f' : LILAC}"/>`;+ if (o.unreadBuddy && !buddy) s += `<circle cx="449" cy="241" r="5" fill="${LILAC}" stroke="#000" stroke-width="2"/>`;+ }+ if (!o.voice && o.bell) s += `<rect x="198" y="392" width="70" height="32" rx="16" fill="${BLUE}"/><text x="233" y="415" text-anchor="middle" font-family="-apple-system, sans-serif" font-size="20" fill="${FG}">🔔 ${o.bell}</text>`;+ else if (!o.voice && o.bottom) s += `<text font-family="-apple-system, sans-serif" font-size="22" fill="${o.bottomColor || MUTED}"><textPath href="#${id2}" startOffset="50%" text-anchor="middle">${esc(o.bottom)}</textPath></text>`;+ return s + `</svg>`;+}+const step = (o, cap) => `<div class="step"><div class="dial">${face(o)}</div><div class="cap">${cap}</div></div>`;+const arrow = (g, t) => `<div class="arrow"><b>${g}</b>${t}</div>`;++const PM_RECAP = "Assigned #2083 to web-api. I'll post here when the PR is up.";+const BUDDY_RECAP = "Two ways: cache the read, or move it to the host. I'd cache it. Send to the PM?";+const web = { project: 'web-api', owner: 'diego', hasBuddy: true };+const fw = { project: 'firmware', owner: 'diego', hasBuddy: true };++document.getElementById('flow').innerHTML =+ step({ ...web, side: 'pm', engine: 'claude', recap: PM_RECAP }, 'Màn PM: pet của PM và recap, không còn chữ "PM". Hai chấm ở mép phải.') ++ arrow('↑', 'vuốt lên') ++ step({ ...web, side: 'buddy', engine: 'claude', recap: BUDDY_RECAP }, 'Màn Buddy: avatar của Buddy, viền tím, chấm dưới sáng.') ++ arrow('←', 'vuốt ngang') ++ step({ ...fw, side: 'buddy', engine: 'codex', recap: 'The key lives on the build Mac only. Want a plan to share it safely?' }, 'Sang project khác vẫn ở màn Buddy (Buddy này chạy Codex).') ++ arrow('↓', 'vuốt xuống') ++ step({ ...fw, side: 'pm', engine: 'codex', recap: 'Stuck: the release key is missing.' }, 'Về PM của project đó.');++document.getElementById('voiceClaude').innerHTML =+ step({ ...web, side: 'buddy', engine: 'claude', recap: BUDDY_RECAP }, 'Buddy (Claude)') + arrow('👆', 'chạm') ++ step({ ...web, side: 'buddy', engine: 'claude', voice: 'listen' }, 'Đang nghe: pet Claude đeo tai nghe như hôm nay, viền tím.') + arrow('👆', 'chạm lại') ++ step({ ...web, side: 'buddy', engine: 'claude', voice: 'send' }, 'Đang gửi: pet Claude và hộp thư, "Sending to your Buddy".') + arrow('→', 'gửi xong') ++ step({ ...web, side: 'buddy', engine: 'claude', recap: 'Got it. Goal and scope are written. Say "send" and it goes to the PM.' }, 'Về avatar Buddy với câu trả lời mới.');+document.getElementById('voiceCodex').innerHTML =+ step({ ...fw, side: 'buddy', engine: 'codex', recap: 'The key lives on the build Mac only. Want a plan to share it safely?' }, 'Buddy (Codex)') + arrow('👆', 'chạm') ++ step({ ...fw, side: 'buddy', engine: 'codex', voice: 'listen' }, 'Đang nghe: robot Codex (listening) như hôm nay.') + arrow('👆', 'chạm lại') ++ step({ ...fw, side: 'buddy', engine: 'codex', voice: 'send' }, 'Đang gửi: robot Codex vẫy tay (waving).') + arrow('→', 'gửi xong') ++ step({ ...fw, side: 'buddy', engine: 'codex', recap: 'Sure. Three steps, none of them touch the build Mac. Want them?' }, 'Về avatar Buddy.');+document.getElementById('voicePm').innerHTML =+ step({ ...web, side: 'pm', engine: 'claude', voice: 'listen' }, 'Ở màn PM: không viền, như hôm nay.') + arrow('👆', 'chạm lại') ++ step({ ...web, side: 'pm', engine: 'claude', voice: 'send' }, 'Gửi vào chat project (ai trong project cũng thấy), "Sending to web-api".');++document.getElementById('states').innerHTML =+ step({ ...web, side: 'pm', engine: 'claude', recap: PM_RECAP, unreadBuddy: true, bottom: 'Your Buddy replied', bottomColor: LILAC }, 'Buddy vừa trả lời khi mày đang ở PM: badge tím trên chấm dưới và một dòng ở cung dưới, không rung chuông.') ++ step({ ...web, side: 'pm', engine: 'claude', recap: PM_RECAP, bell: 2 }, 'PM có thông báo: chuông xanh như hôm nay, kéo xuống vẫn mở inbox.') ++ step({ project: 'docs', side: 'buddy', hasBuddy: false }, 'Project chưa có Buddy: chỗ avatar là vòng nét đứt, kèm hướng dẫn thêm trong app.') ++ step({ ...web, side: 'pm', engine: 'claude', recap: PM_RECAP, buddies: false }, 'Swarm tắt Buddies: không có chấm, y như hôm nay.');++// The live demo.+const projects = [+ { project: 'web-api', owner: 'diego', pm: 'claude', engine: 'claude', recap: PM_RECAP, hasBuddy: true, buddy: BUDDY_RECAP },+ { project: 'firmware', owner: 'diego', pm: 'codex', engine: 'codex', recap: 'Stuck: the release key is missing.', hasBuddy: true, buddy: 'The key lives on the build Mac only. Want a plan to share it safely?' },+ { project: 'docs', owner: 'diego', pm: 'claude', engine: 'claude', recap: 'Release notes are merged. Nothing waits for you.', hasBuddy: false },+];+const demo = { at: 0, side: 'pm', unread: false, voice: null };+const el = document.getElementById('demo');+function draw(anim) {+ const p = projects[demo.at], onPm = demo.side === 'pm', unread = demo.unread && onPm && p.hasBuddy;+ el.innerHTML = face({ project: p.project, owner: p.owner, side: demo.side, engine: onPm ? p.pm : p.engine, recap: onPm ? p.recap : p.buddy,+ hasBuddy: p.hasBuddy, unreadBuddy: unread, bottom: unread ? 'Your Buddy replied' : '', bottomColor: LILAC,+ voice: demo.voice && (onPm || p.hasBuddy) ? demo.voice : null });+ if (anim) el.firstChild.animate([{ transform: anim, opacity: .2 }, { transform: 'none', opacity: 1 }], { duration: 220, easing: 'ease-out' });+}+function act(a) {+ if (a === 'next') { demo.at = (demo.at + 1) % projects.length; draw('translateX(40%)'); }+ if (a === 'prev') { demo.at = (demo.at + projects.length - 1) % projects.length; draw('translateX(-40%)'); }+ if (a === 'up' && demo.side === 'pm') { demo.side = 'buddy'; if (projects[demo.at].hasBuddy) demo.unread = false; draw('translateY(40%)'); }+ if (a === 'down' && demo.side === 'buddy') { demo.side = 'pm'; draw('translateY(-40%)'); }+ if (a === 'reply') { demo.unread = true; projects[0].buddy = 'Got it. Goal and scope are written. Say "send" and it goes to the PM.'; draw(); }+}+document.querySelectorAll('.btns button[data-a]').forEach(b => b.onclick = () => act(b.dataset.a));+const talk = document.getElementById('talk');+function tapVoice() {+ if (demo.voice === 'send') return;+ if (!demo.voice) { demo.voice = 'listen'; draw(); return; }+ demo.voice = 'send'; draw();+ setTimeout(() => { demo.voice = null; draw(); }, 1400);+}+talk.onclick = tapVoice;+let start = null;+el.onpointerdown = e => { start = [e.clientX, e.clientY]; el.setPointerCapture(e.pointerId); };+el.onpointerup = e => {+ if (!start) return;+ const dx = e.clientX - start[0], dy = e.clientY - start[1]; start = null;+ if (Math.abs(dx) > 40 && Math.abs(dx) > Math.abs(dy)) act(dx < 0 ? 'next' : 'prev');+ else if (Math.abs(dy) > 40) act(dy < 0 ? 'up' : 'down');+ else if (Math.abs(dx) < 8 && Math.abs(dy) < 8) tapVoice();+};+draw();+</script>+</body>+</html>diff --git a/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-plan.md b/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-plan.mdnew file mode 100644index 000000000..dc8756017--- /dev/null+++ b/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-plan.md@@ -0,0 +1,329 @@+# Round dial PM ↔ Buddy 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:** On the round dial, each Swarm project gets a PM screen and a Buddy screen. Swipe up opens the Buddy screen+and swipe down returns to the PM screen. Voice works as today, and a refused post never becomes a terminal turn.++**Architecture:** As in the 10-28 swarm-chat design, the daemon decides and the firmware draws.+- `cli/src/superTabs/cards.ts` learns a per-Swarm *side* (`pm`/`buddy`) set by the dial. It picks the reader's Buddy+ chat as the face on the Buddy side, adds a `buddy` block to each Lead, and watches the Buddy chat for a quiet+ notice.+- The cable session negotiates `swarmBuddy: 'v1'`, carries the new fields and passes `supertab.side` through.+- The firmware keeps the side per Swarm, maps the vertical swipe, and draws the dots, the lilac ring, the avatar, the+ empty state and the quiet badge.++**Tech Stack:** TypeScript (cli, vitest), C (ESP-IDF 5.5 firmware, host tests through `make device-test`), Dart (one+parity test).++**Spec:** `2026-10-29-round-dial-pm-buddy-spec.md` (beside this file). The mockup is+`2026-10-29-round-dial-pm-buddy-mockup.html`. Read both before Task 1.++## Global Constraints++- Base on current `origin/main`; this plan was read at 5df861254. Follow `AGENTS.md` and `cli/AGENTS.md`.+- Merge with `make merge-pr ARGS="N --reviewed-head SHA --reviewed-base SHA --merge"` once `ci/required` is green and+ a Reviewer approved that exact head. Do not rerun CI except for a recorded flaky test.+- `cli/src/core/` and `cli/src/services/` keep 100 % per-file coverage: run `npm run test:core` locally and record it+ in the PR.+- The firmware gate is `idf.py build` plus `make device-test`.+ - Dev images to flash are built with `-DPROJECT_VER=0.0.99` and flashed only by the repo procedure, with the chip and+ MAC checked. Never force-flash.+ - Never publish firmware (`make upload-circle`) without the owner.+- A device without `swarmBuddy` must receive byte-identical frames to today (spec, acceptance 5).+- Device UI text is English, exactly:+ - "No Buddy here yet"+ - "Add one in the Harness app."+ - "Your Buddy replied"+ - "Sending to your Buddy"+- Colours:+ - lilac `#c49bff`: the ring at 32 % on the glass edge (r 230, 3 px), the active lower dot, and the badge;+ - inactive dot `#55565f`; active upper dot `#eaeaf0`;+ - dots at x 442, y 218 and 248; radius 6 when active, 4.5 when not;+ - badge at (449, 241), r 5, with a 2 px black stroke.+- The avatar algorithm is Desktop's `superTabAgentPattern`, unchanged. Colour is HSL(hue, 42 %, 72 %); disc at 16 %+ alpha, radius 46, centred at (233, 158). Test vectors:+ - `"diego's Buddy"`: half 25513, hue 13, `#d6a79a`;+ - `"ken's Buddy"`: half 30735, hue 327, `#d69abb`.++## Review Focus++1. **Desktop opens the Buddy chat while the dial is on PM, then the person swipes down.** The newest action wins: the+ swipe sets `pm` and the face goes to the Lead conversation, even though the Desktop focus still names the Buddy+ chat. The desktop's next focus change clears the side. Test in Task 2.+2. **A Buddy removed while its screen is open.** Its chat is still in the state, but no agent. Expected: the empty+ state, no crash, and voice not offered (there is no recipient). Test in Task 2 (`buddy.live` and the absent block)+ and Task 6.+3. **Buddies turned off while on the Buddy side.** Expected: `buddies` is absent and the dial snaps to the PM face+ with no dots. Test in Task 6.+4. **A `supertab` frame with 12 Leads, every name at 48 bytes, and a Buddy on each.** Expected: it stays under 8192 bytes.+ Test in Task 3.+5. **Voice on the Buddy side when the backend refuses** (`BUDDIES_OFF`, `BUDDY_FORBIDDEN`). Expected: `voice.error` with+ the backend's message, and `sendTurn` is never called. Test in Task 4.++---++### Task 1: The avatar pattern in TypeScript, pinned to Desktop++**Files:**+- Create: `cli/src/superTabs/buddyAvatar.ts`+- Test: `cli/src/superTabs/buddyAvatar.spec.ts`+- Modify: `desktop/test/super_tab_avatar_test.dart`, to add the two vectors++**Interfaces:**+- Produces: `buddyAvatar(name: string): { cells: number; color: string }`. `cells` holds the 15 half bits (bit `i` =+ `half[i]`); `color` is `#rrggbb` lower-case.++- [ ] **Step 1: Write the failing tests**+```ts+it('draws Desktop\'s pattern and dark tone for a Buddy name', () => {+ expect(buddyAvatar("diego's Buddy")).toEqual({ cells: 25513, color: '#d6a79a' })+ expect(buddyAvatar(" KEN's Buddy ")).toEqual({ cells: 30735, color: '#d69abb' })+})+it('never draws an empty pattern', () => { /* find or construct a name whose low 15 bits are 0; expect bit 7 set */ })+```+In Dart, `superTabAgentPattern("diego's Buddy")` has hue 13, and its first 15 `cells` read as half bits give 25513.+Check the same for `"ken's Buddy"`.+- [ ] **Step 2:** `cd cli && npx vitest run src/superTabs/buddyAvatar.spec.ts` should FAIL (module not found).+- [ ] **Step 3: Implement.** FNV-1a over UTF-16 code units, using `Math.imul` and `>>> 0`. The HSL to RGB rounding must+ match Flutter's `HSLColor.toColor()`, so check against the Dart test. If the Dart vectors disagree, the Dart output is+ the truth: fix the TS and update both specs.+- [ ] **Step 4:** run both tests; both PASS: `npx vitest run src/superTabs/buddyAvatar.spec.ts`, then `cd desktop && flutter test test/super_tab_avatar_test.dart`.+- [ ] **Step 5:** Commit: `feat(swarm): the Buddy avatar pattern for the dial, pinned to Desktop's`.++### Task 2: Cards: the side, the Buddy face, the Buddy block, the quiet notice++**Files:**+- Modify: `cli/src/core/api.ts`+ - `ChatKind` becomes `'lead' | 'pm' | 'group' | 'buddy'`;+ - new `SwarmBuddy`;+ - `SwarmLead.buddy?` and `SwarmLead.buddies?`;+ - `LeadNotice.chat` gains `'buddy'`;+ - new `CardSide = 'pm' | 'buddy'`.+- Modify: `cli/src/superTabs/cards.ts`: `faceOf`, `leadsOf`, `target`, `watchNotices`, `want`, and a new `side()`.+- Test: `cli/src/superTabs/cards.spec.ts`++**Interfaces:**+- Consumes: `buddyAvatar` (Task 1).+- Produces:+ - `export interface SwarmBuddy { chatId: string; name: string; engine: string; cells: number; color: string; live: boolean }`+ - `SwarmLead.buddies?: true` (present only while the Swarm's `buddies` is true).+ - `SwarmLead.buddy?: SwarmBuddy` (present only when the reader has a Buddy agent in the project).+ - `cards.side(tabId: string, side: CardSide): void`. It rebuilds the cards at once (as a focus change does) and+ pushes the open recap.+ - `faceOf(conversations, projectId, lead, focus?, side?, buddyChat?)`, returning kind `'buddy'` when+ `side === 'buddy'` and a Buddy chat exists.++- [ ] **Step 1: Write the failing tests** in `cards.spec.ts`, reusing its `roster`, `agent` and `conv` helpers.+ Use a Buddy chat `conv('buddy-p1', null, { projectId: 'web', kind: 'buddy', agentIds: ['y1'], buddyOwnerId: 'p1' })`+ and a Buddy agent `agent('y1', { buddyOf: { personId: 'p1', generation: 'g1' }, name: "diego's Buddy", configuration: { engine: 'codex' } })`.+ The tests are:+ - `'gives each Lead a buddy block for the reader\'s own Buddy, with Desktop\'s avatar'`:+ `lead.buddy` equals `{ chatId: 'buddy-p1', name: "diego's Buddy", engine: 'codex', cells: buddyAvatar("diego's Buddy").cells, color: …, live: true }`.+ - `'marks buddies only while the Swarm has them on'`: with `state.buddies` true, `lead.buddies === true`; when it is+ absent, so are `buddies` and `buddy`.+ - `'shows no buddy block for a Buddy chat with no Buddy agent'`: the chat is present but no agent, so `buddy` is+ undefined.+ - `'puts the Buddy chat on the face on the buddy side, and its recap is the Buddy\'s last message'`: call+ `cards.side('t1', 'buddy')`. Then `lead.chat` equals `{ kind: 'buddy', id: 'buddy-p1', name: "diego's Buddy", working: false }`,+ and `recap('t1', lead, true)` returns the Buddy's newest message, not the owner's.+ - `'keeps the Lead face on the buddy side when the project has no Buddy chat'`.+ - `'a later desktop focus clears the dial\'s side'`: `side('t1','buddy')`, then `want(true, [], { tabId: 't1', conversationId: 'lead-web' })`,+ so `chat.kind === 'lead'`. Also: with focus on `buddy-p1`, `side('t1','pm')` gives `chat.kind === 'lead'`. Review+ Focus 1.+ - `'never puts a read-only Chat with PM on the face while Buddies are on'`: with focus on a PM chat (`audience` set)+ and `state.buddies` true, `chat.kind === 'lead'`.+ - `'raises a buddy notice for the Buddy\'s new message, never for the owner\'s'`: the notice is+ `{ chat: 'buddy', chatId: 'buddy-p1', … }`, and an owner's message raises none.+- [ ] **Step 2:** `cd cli && npx vitest run src/superTabs/cards.spec.ts` FAILS on the new cases only.+- [ ] **Step 3: Implement.**+ - **Helpers:**+ - `isBuddyChat(c)`: `c.kind === 'buddy'`.+ - The reader's Buddy chat in a project: `isBuddyChat(c) && inProject(c, projectId) && c.buddyOwnerId === me`.+ - The Buddy agent: the first agent whose id is in that chat's `agentIds` and that has `buddyOf`.+ - **`want()`:** when `refocused`, clear `this.sides` (a `Map<tabId, CardSide>`).+ - **`voicesOf`:** for `'buddy'`, the chat's `agentIds`.+ - **`chat.name`** for `'buddy'`: the Buddy agent's `displayName ?? name`, cut to `NAME_BYTES`.+ - **`watchNotices`:** add the reader's Buddy chat of each project as `chat: 'buddy'`, with voices = its Buddy+ agent ids.+- [ ] **Step 4:** run the same file; all PASS. Also run `npx vitest run src/superTabs` for the neighbours.+- [ ] **Step 5:** Commit: `feat(swarm): cards know the dial's side and the reader's Buddy`.++### Task 3: Cable and services: `swarmBuddy`, `supertab.side`, the frames++**Files:**+- Modify: `cli/src/cable/cableSession.ts`:+ - hello parsing next to `swarmChat` (around :1271);+ - the `named` caps list (:702);+ - `chatLead` (:177);+ - `noticeFrame` (:184);+ - the frame switch (:1377);+ - `onSuperTab`.+- Modify: `cli/src/cable/cableHost.ts`: the new wiring `swarmCardSide?: (tabId: string, side: 'pm' | 'buddy') => void`.+- Modify: `cli/src/services/devices.ts`: wiring → `askCards({ action: 'cardSide', tabId, side })`.+- Modify: `cli/src/core/devicesLink.ts`: pass `side` for `cardSide`.+- Modify: `cli/src/superTabs/inCore/cards.ts`: route `cardSide`.+- Modify: `cli/src/superTabs/service.ts`: accept `cardSide` when `cardId(tabId)` and `side ∈ {pm, buddy}`, then call+ `cards().side()`.+- Check `cli/src/core/main.ts` `superTabRequest`: its allowlist must let `cardSide` through, if it filters actions.+- Test: `cli/src/cable/cableSession.spec.ts`, `cli/src/core/devicesLink.spec.ts`, `cli/src/superTabs/service.spec.ts`+ (or the files that test those paths today).++**Interfaces:**+- Consumes: `SwarmLead.buddy`, `buddies`, `cards.side` (Task 2).+- Produces:+ - **Device → daemon:** `{"t":"supertab.side","tab":"<id>","side":"pm"|"buddy"}`. It is ignored unless the device+ said `swarmBuddy: 'v1'` and `tab` matches `CARD_ID`.+ - **The Lead entry** for a `swarmBuddy` device: `chatLead` output plus `buddies: true` and+ `buddy: { chatId, name, engine, cells, color, live }`. `chat` may be `'buddy'`.+ - **A `swarmChat` device without `swarmBuddy`:** a `'buddy'` face chat is sent as today's `'group'` (so older+ firmware keeps working), and no `buddy` or `buddies` fields are sent.+ - **`supertab.notice`** with `chat: 'buddy'` goes only to `swarmBuddy` devices.++- [ ] **Step 1: Write the failing tests:**+ - `'a swarmBuddy dial gets each Lead\'s buddy block and buddies flag'`;+ - `'a swarmChat dial without swarmBuddy gets today\'s frame, a Buddy face reading as a group'`: byte-compare against+ today's output for the same input;+ - `'supertab.side reaches the cards as cardSide, and only from a swarmBuddy dial'`;+ - `'a buddy notice reaches only a swarmBuddy dial'`;+ - `'the supertab frame with 12 Leads, 48-byte names and a Buddy each stays under 8192 bytes'`: assert+ `Buffer.byteLength(JSON.stringify(frame)) < 8192` (Review Focus 4);+ - the core link and service forward `cardSide` with `side`, and refuse a bad `side`.+- [ ] **Step 2:** `npx vitest run src/cable/cableSession.spec.ts src/core/devicesLink.spec.ts src/superTabs/service.spec.ts` FAILS on the new cases.+- [ ] **Step 3:** Implement as the Interfaces block says.+- [ ] **Step 4:** run the same files and PASS. Then `npm run test:core` must report 100 % (devicesLink.ts is a core+ file), and `npx tsc --noEmit -p .` must be clean.+- [ ] **Step 5:** Commit: `feat(cable): swarmBuddy dials get the Buddy block and send supertab.side`.++### Task 4: A refused Swarm post is never typed into a terminal++**Files:**+- Modify: `cli/src/superTabs/cards.ts` `say()`. It returns+ `Promise<{ said: true } | { said: false; refused?: { code: string; message: string } }>`: a `SuperTabHostError` with+ status 400–499 is `refused`, and any other failure rethrows as today.+- Modify: `cli/src/superTabs/service.ts`: `cardSay` returns `{ ok: true, said, ...(refused ? { refused } : {}) }`.+- Modify: `cli/src/services/devices.ts`, `cli/src/cable/cableHost.ts`: `swarmSay` resolves to+ `{ said: boolean; refused?: { code: string; message: string } }`.+- Modify: `cli/src/cable/cableSession.ts`, the voice path around :2294:+ - when `refused`, reply `{ t: 'voice.error', message: refused.message }` and return;+ - on a `buddy` face, never fall back to `sendTurn`; reply `voice.error` "Could not reach your Buddy. Try again."+ instead.+- Test: `cards.spec.ts`, `cableSession.spec.ts`.++- [ ] **Step 1: Write the failing tests:**+ - `'say reports a 403 as refused with the backend\'s message'`, using a stub backend that answers 403+ `PM_CHAT_READ_ONLY`;+ - `'a refused voice post shows voice.error and types nothing'`: assert the host's `sendTurn` spy has 0 calls (fails+ today: it is called once);+ - `'on the Buddy face an unreachable post shows voice.error and types nothing'`;+ - `'on the PM face an unreachable post still falls back to the turn'` (today's behaviour, kept).+- [ ] **Step 2:** run the two spec files; the new cases FAIL.+- [ ] **Step 3:** Implement.+- [ ] **Step 4:** PASS, plus `npm run test:core` and `npx tsc --noEmit -p .`.+- [ ] **Step 5:** Commit: `fix(cable): a Swarm post the backend refuses is shown on the dial, never typed into a terminal`.++### Task 5: Firmware model and wire++**Files:**+- Modify: `devices/harness-device/firmware/main/ui/habitat/supertab.h` and `supertab.c`:+ - `ht_chat_kind_t` gains `HT_CHAT_BUDDY`;+ - `ht_lead_t` gains `bool buddies;` and+ `struct { bool has, live; char chat_id[ID_MAX], name[HT_SUPERTAB_NAME], engine[16]; uint16_t cells; uint16_t color565; } buddy;`;+ - `ht_lead_in_t` gains the parsed inputs.+- Modify: `main/cable_client.c`:+ - hello adds `msg_string(&root, "swarmBuddy", "v1")` after `swarmChat` (:326);+ - `handle_supertab` parses `buddies` and the `buddy` object, with `color` `#rrggbb` → RGB565 and `cells` 0..32767;+ - `handle_supertab_notice` maps `"buddy"` → `HT_CHAT_BUDDY`;+ - new `cable_client_supertab_side(const char *tab, bool buddy)` sends `supertab.side`.+- Modify: `main/cable_client.h`.+- Test: `test/test_cable_supertab.py`, `test/test_supertab.c`.++- [ ] **Step 1: Write the failing tests:**+ - **parse:** a lead with `buddies:true` and `buddy:{chatId:"b1",name:"diego's Buddy",engine:"codex",cells:25513,color:"#d6a79a",live:true}`+ yields `has`, `live`, `cells == 25513`, and `color565` equal to RGB565 of (0xd6,0xa7,0x9a);+ - **parse:** a `chat:"buddy"` lead reads `HT_CHAT_BUDDY`;+ - **parse:** a bad `color` or `cells > 32767` drops the block (`has == false`);+ - **frame:** `cable_client_supertab_side("t1", true)` emits `{"t":"supertab.side","tab":"t1","side":"buddy"}`, and an+ over-long tab emits nothing;+ - **hello:** carries `swarmBuddy: v1`;+ - **notice:** `chat:"buddy"` reaches the UI as `HT_CHAT_BUDDY`.+- [ ] **Step 2:** `make device-test`: the new cases FAIL.+- [ ] **Step 3:** Implement. Keep the `supertab` card in `EXT_RAM_BSS_ATTR`, and check that `sizeof(ht_supertab_t)` still+ fits the static.+- [ ] **Step 4:** `make device-test` is all green, and `idf.py build` passes.+- [ ] **Step 5:** Commit: `feat(round): the dial reads each project's Buddy and can name its side`.++### Task 6: Firmware UI: side, gestures, face, voice++**Files:**+- Modify: `devices/harness-device/firmware/main/ui/habitat/ui_habitat.c`:+ - `sw` gains `bool buddy_side[HT_SUPERTABS_MAX]`, keyed like `sw.focus`, or a per-tab entry next to it;+ - the vertical-swipe branch (around :3516);+ - `render_swarm_face` (:1293);+ - the voice view render;+ - `swarm_show` and `swarm_enter`: re-send the side on entering a Swarm.+- Modify: `main/ui/habitat/focus.c` / `terminal.c` only as needed:+ - an avatar draw helper `ht_buddy_avatar(scene, cx, cy, r, cells, color565)`, drawn as rounded 5×5 cells over a disc+ at 16 % alpha;+ - the lilac ring;+ - the two dots and the badge.+- Test: `test/test_touch_ui.py` (screens and gestures).++**Interfaces:**+- Consumes: `ht_lead_t.buddies` and `.buddy`, `cable_client_supertab_side` (Task 5).++- [ ] **Step 1: Write the failing tests** in `test_touch_ui.py`:+ - **Gestures:**+ - With `buddies` and a Buddy, swipe up on the face sends `supertab.side buddy`, and the scene has the lilac ring+ and the avatar at (233, 158).+ - Swipe down on the Buddy face sends `supertab.side pm` and the PM face returns.+ - On the PM face with an unread Lead notice, swipe down still opens INBOX.+ - Swipe up on the Buddy face does nothing.+ - **Side and project:**+ - The side is kept across a horizontal swipe to the next project.+ - A project without a Buddy shows "No Buddy here yet" / "Add one in the Harness app.", and a tap there starts no+ voice.+ - **Buddies off:** with `buddies` absent, there are no dots, swipe up is inert, and the face is pixel-identical to+ today's golden. When `buddies` turns off while on the Buddy side, the dial snaps to PM (Review Focus 3).+ - **Quiet notice:** a buddy notice on the PM side draws the badge at (449, 241) and "Your Buddy replied" on the lower+ arc, makes no `audio_notify_done` call and adds no inbox entry. Opening the Buddy side reads it.+ - **Voice:** a tap on the Buddy face starts voice with the Buddy engine's pet: Codex's `listening` frames for a Codex+ Buddy, Claude's `listen` for Claude. Sending shows "Sending to your Buddy" and keeps the lilac ring.+ - **Run counts:** constant per screen, as the Focus tests require.+- [ ] **Step 2:** `make device-test`: the new cases FAIL.+- [ ] **Step 3:** Implement using the numbers in Global Constraints. The Buddy-side recap uses today's card geometry.+ Voice uses today's screens, with the engine taken from `l->buddy.engine` on the Buddy side.+- [ ] **Step 4:** `make device-test` is green, and `idf.py -DPROJECT_VER=0.0.99 build` passes. Rasterise the PM, Buddy,+ empty, badge, listening and sending screens, and compare them with the mockup.+- [ ] **Step 5:** Commit: `feat(round): swipe up for your Buddy, down for the PM`.++### Task 7: Docs and the on-device check++**Files:**+- Modify: `docs/swarms.md` § Buddies: one paragraph on the round dial.+- Modify: `devices/harness-device/firmware/README.md`, only if it lists gestures.++- [ ] **Step 1:** Write the docs paragraph: swipe up or down on the dial, the Buddy screen, voice, and the quiet notice.+- [ ] **Step 2:** Flash a dev build (0.0.99) on a dev round dial by the repo procedure, checking the chip and the MAC.+ Go through acceptance 1–8 in the spec with a Swarm that has Buddies on. Record the results in the PR.+- [ ] **Step 3:** Commit: `docs: the round dial's PM and Buddy screens`.++## Pre-flight (shared interfaces)++| Producer → consumer | Contract | Check |+|---|---|---|+| Task 1 → 2 | `buddyAvatar(name) → {cells, color}` | Task 2 imports it, nothing else |+| Task 2 → 3 | `SwarmLead.buddy` / `buddies`, `cards.side(tab, side)`, `ChatKind 'buddy'`, `LeadNotice.chat 'buddy'` | Task 3 maps them to wire fields one to one |+| Task 3 → 5 | wire: `buddies`, `buddy{chatId,name,engine,cells,color,live}`, `chat:'buddy'`, `supertab.side{tab,side}`, `swarmBuddy:'v1'` | Task 5 parses exactly these names |+| Task 4 ↔ 3 | both edit `cableSession.ts` and `devices.ts` | run Task 4 after Task 3 to avoid conflicts |+| Task 5 → 6 | `ht_lead_t.buddy`, `HT_CHAT_BUDDY`, `cable_client_supertab_side` | Task 6 uses only these |++**Order:**+- Tasks 1 → 2 → 3 → 4 go in one CLI PR.+- Tasks 5 → 6 → 7 go in one firmware PR, opened after the CLI PR merges.+- The firmware without the daemon change is harmless: an old daemon ignores `supertab.side` and never sends `buddies`.++## Execution handoff++The plan is complete. The recommendation is **subagent-driven**: there are two PRs in two languages, and the frames+are a cross-process contract, so a review after each task is worth its cost.diff --git a/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-spec.md b/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-spec.mdnew file mode 100644index 000000000..b74ce9135--- /dev/null+++ b/docs/superpowers/specs/2026-10-29-round-dial-pm-buddy-spec.md@@ -0,0 +1,127 @@+# Round dial: the PM and the Buddy in each Swarm project++Status: spec · 2026-10-29 · requester: Diego · base: `origin/main` 5df861254+Mockup: `2026-10-29-round-dial-pm-buddy-mockup.html` (beside this file), approved option A.+Builds on: `docs/superpowers/specs/2026-10-28-round-dial-swarm-chat-design.md` (the chat on a project's face).++## Why++On the round dial each Swarm project is one face. A horizontal swipe moves to the next project (`ui_habitat.c`,+`swarm_show`). The face shows the chat the desktop has open (`cli/src/superTabs/cards.ts`, `faceOf`), so the only way to+see your Buddy on the dial is to open its chat in the app. With Buddies on (`docs/swarms.md` § Buddies), a person+cares about two places per project: the project chat, where the PM answers, and their own Buddy chat.++## Decisions (Diego, 2026-10-29)++1. **Two screens per project, stacked vertically.** Swipe up: the Buddy screen. Swipe down: back to the PM screen. The+ horizontal swipe still changes project.+2. **The PM screen is today's face, unchanged:** no "PM" label, the PM's engine pet, the recap. It adds only two page+ dots at the right edge.+3. **The Buddy screen** shows the Buddy's avatar in place of the pet, a lilac ring at the glass edge and the Buddy's+ last message as the recap. **No engine badge** on the avatar and no "Your Buddy" label.+4. **Voice is unchanged:** tap the face to start, tap again to send. While listening and sending, the screen shows the+ engine's pet as today (Claude, Codex), for the engine of the chat being spoken to. On the Buddy screen the ring stays+ lilac and the sending label reads "Sending to your Buddy".+5. Swiping on the dial does not require clicking in the app.++## Behaviour++### Screens+- **PM screen.** The chat on the face is today's rule: the conversation the desktop has open in this project, else the+ project's Lead conversation. One exception is new: while the Swarm has Buddies on, a Chat with PM is never the face,+ because it is read-only (`commands.ts` `PM_CHAT_READ_ONLY`). The face falls back to the Lead conversation.+- **Buddy screen.** The chat on the face is the signed-in person's own Buddy chat in this project (`kind: 'buddy'`, and+ `buddyOwnerId` is the reader). The backend only ever sends a Buddy chat to its owner (`read/views.ts` `groupView`), so+ another person's Buddy chat can never reach the dial.+ - **The Buddy exists** (its agent is in the Swarm): show its avatar and the recap, which is the Buddy's last message+ in that chat.+ - **No Buddy** in this project: show a dashed circle with "+", then "No Buddy here yet" and "Add one in the Harness+ app." The dial cannot add a Buddy.+- **Buddies off** in the Swarm: no dots, swiping up does nothing, and the face is exactly today's.++### Switching+- On the PM screen, swipe up opens the Buddy screen. Swipe down keeps today's meaning: it opens the inbox when there+ is an unread notice (Focus skin).+- On the Buddy screen, swipe down returns to the PM screen. Swipe up does nothing.+- The side (PM or Buddy) is kept per Swarm. Moving to another project keeps the side.+- **Who wins between the dial and the desktop:** the newest of the two. A swipe on the dial sets the side. A later change+ of the conversation the desktop has open clears the dial's choice, and the face follows the desktop again. Opening+ the Buddy chat on the desktop therefore shows the Buddy screen, as today.++### Avatar+- It is the Desktop agent pattern, ported exactly (`desktop/lib/super_tabs/avatar_art.dart`,+ `superTabAgentPattern`):+ - FNV-1a (32 bits) of the Buddy's display name, trimmed and lower-cased;+ - 15 bits form the left half of a 5×5 grid, mirrored;+ - the hue is `(hash >> 16) % 360`;+ - the colour is HSL(hue, 42 %, 72 %), the dark-mode tone.+- The disc behind it is the same colour at 16 %. There is no uploaded or preset picture on the dial.+- Test vectors:+ - `"diego's Buddy"`: half bits 25513, hue 13, colour #d6a79a;+ - `"ken's Buddy"`: half bits 30735, hue 327, colour #d69abb.+- **Known consequence:** a person's Buddies in different projects share a name, so they share an avatar. This matches+ Desktop. Changing it is out of scope (see Open).++### Alerts+- A new message from the Buddy in its chat raises a **quiet** notice:+ - no beep and no inbox entry;+ - on the PM screen, a lilac badge on the lower dot, and "Your Buddy replied" on the lower arc;+ - opening the Buddy screen reads it.+- Lead and PM notices are unchanged (beep, bell, inbox).++### Voice+- Tapping the face starts listening, as today.+- On the PM screen, the words post into the face's chat (today's rule).+- On the Buddy screen, the words post into the Buddy chat as the person.+- The listening and sending pets are the engine's:+ - the PM's engine on the PM screen;+ - the Buddy's engine (`claude` or `codex`) on the Buddy screen.+- **A refused post never becomes a terminal turn.**+ - Today a failed Swarm post falls back to typing the words into the Lead's terminal (`cableSession.ts` voice path,+ `swarmSay(...).catch(() => false)`, then `sendTurn`). With Buddies on, that types words meant for a read-only Chat+ with PM into the PM's terminal.+ - From now on, a post the backend refused (any 4xx) shows the refusal as a voice error on the dial.+ - Only an unreachable backend (network, 5xx, timeout) may use the old fallback, and never from the Buddy screen.++## Wire (cable)++- **Capability:** the round dial's hello adds `swarmBuddy: 'v1'` next to `swarmChat: 'v1'`. A device without it gets+ byte-identical frames to today.+- **Lead entry** (in `supertab`), for a `swarmBuddy` device:+ - The chat on the face may now be `chat: 'buddy'` (with `chatId` and `chatName` = the Buddy's name).+ - New `buddies: true` when the Swarm has Buddies on.+ - New `buddy`, when the reader has a Buddy in that project:+ `{ chatId, name, engine, cells, color, live }`.+ - `cells` is the 15-bit half pattern.+ - `color` is `#rrggbb`.+ - `live` is false while the Buddy is down (its agent is in the Swarm but not running).+- **Device → daemon:** `supertab.side {tab, side: 'pm' | 'buddy'}` sets the side for that Swarm.+- **`supertab.notice`** may carry `chat: 'buddy'`.+- **Frame size:** the `supertab` frame must stay under `CABLE_MAX_PAYLOAD` (8192) with 12 Leads, names at their+ 48-byte cut and a Buddy on every project.++## Out of scope+- The Harness Pro (it keeps its Swarm cards).+- Desktop changes, other than a parity test of the avatar vectors.+- Making the desktop follow a swipe on the dial.+- Adding, removing or restarting a Buddy from the dial.+- Proposals from the dial.++## Open+- Per-project Buddy avatars (hash the project id in). This would need the same change on Desktop. Default: no.++## Acceptance+1. With Buddies on and a Buddy in project P:+ - swipe up on P's face shows the Buddy avatar, the lilac ring and the Buddy's last message;+ - swipe down returns to the PM face;+ - the dots show which screen is open.+2. Moving to project Q keeps the side. Where Q has no Buddy, its Buddy screen shows "No Buddy here yet".+3. Tapping on the Buddy screen listens with the Buddy engine's pet, posts the words into the Buddy chat, and the+ Buddy's reply becomes the recap.+4. The Buddy's reply while the PM screen is open shows the lilac badge and "Your Buddy replied", without a beep or an+ inbox entry.+5. With Buddies off, every frame and face is as today. A device without `swarmBuddy` gets today's frames.+6. A voice post the backend refuses shows the error on the dial and types nothing into any terminal.+7. With Buddies on, a desktop open on a Chat with PM leaves the PM face on the Lead conversation.+8. Opening the Buddy chat on the desktop shows the Buddy screen. A later swipe on the dial wins until the desktop opens+ another conversation.diff --git a/docs/swarms.md b/docs/swarms.mdindex edf983005..605e65cac 100644--- a/docs/swarms.md+++ b/docs/swarms.md@@ -355,6 +355,67 @@ never records what anyone wrote. The only text it shows is the title of aconversation the reader can read. Private conversations, Buddy chats amongthem, never count and never appear in it.+## Routing++The Lead routes each task before starting or assigning an agent. The route+leaves out what cannot run it or breaks one of the owner's hard rules, then+orders the rest by the owner's soft rules and the routing policy (strength,+quota fit, effective cost).++**Grid models.** A model served on the Swarm's grid counts as strong as the+policy says. Kimi K3 and DeepSeek v4.1 are rated 2, Sonnet's tier; every other+grid or local model takes the policy's local quality (1). An owner can change+both, and add rows of their own, in the policy's local models (`models`: a name+and a quality, first match first). A model whose host is offline is left out+with that reason, so no Builder is sent to a machine that cannot start it.++**Cheap first.** Low-risk work that is not a review ranks a grid model first:+low-difficulty work, and medium work of kind `docs`, `copy`, `tests`,+`fixtures`, `fix` or `refactor`. The floor still keeps a small model off medium+work. An owner opts out with the `noGridFirst` rule.++**Stepping up.** When a grid attempt's first review says Ready no, or its grid+host never starts the agent (the start fails or misses its window), the Swarm+steps the task up: it closes the attempt, tells its Builder to stop, and wakes+the Lead to route it again. The next attempt runs on no grid model and nothing+below quality 2 (Sonnet), and after a second failure nothing below 3 (Opus). A+task steps up at most twice; after that the Lead decides. The route and the+server both keep to the new floor. The next attempt's brief carries the pull+request, the last result and the review's findings, and the step (attempt+number and why) is kept on the attempt and its route decision.++**Reviews.** A review never runs on a grid model or on a model the policy rates+below 2. A model the policy does not name, a small Codex variant such as a mini+or nano among them, is rated 1; an agent launched on its engine's own model is+rated by that engine's `default` row. A review runs on another engine than the+reviewed Builder's while a strong Reviewer of another engine can run in the+Swarm (a Builder on a grid model counts as that model's family). A Swarm with+one engine keeps its automatic reviews: the Builder's own engine reviews at its+top tier (quality 3) only, and the route decision records why. The server+refuses such a start, assignment or pick from an agent, whatever the soft rules+say, and lets a person through with a warning.++Design:++- Growth: one step record per task, replaced at each step; it goes with its+ group. Policy rows are capped at 40.+- Concurrency: a step is recorded in the write that saw the failure (the+ review's verdict, the failed start or the start timeout), so a newer write+ retries on current data like every other Swarm write.+- Read cost: no new reads beyond the tab's policy, which work commands read once.+- Scale: at most two steps per task; a Swarm's 300 tasks a week add at most 600+ small records. The step-up rate in `costs` is the first warning.+- Compatibility: a policy saved before per-model rows reads the built-in rows.+ An older CLI routes without the new exclusions, and the server still refuses+ a grid or weak Reviewer and a pick below a step's floor.+- Migration and rollback: additive fields, no migration. Rolling back leaves+ them unread; a stepped-up task is then routed as before.+- Audience: the step is part of its group, read by whoever reads the group.+- Identity: steps are the Swarm's own notices, written as the project's Lead.+- Failure: a step is told to the Lead and the Builder; a step that cannot be+ taken (the cap) leaves the attempt with its Builder.+- Platforms: server-side; the same on every host.+## Cost recordsEvery task a Lead routes records what it ran on, what it cost and how it ended,@@ -399,7 +460,9 @@ and what was actually spent per token (nothing on a plan or on own GPUs).set, at most 90), for the Product Manager, and later for the leaderboard and thenightly reflection. Per engine, model, effort and kind of job it gives:attempts, first-review pass rate, shipped, median minutes to ship, tokens,-API-equivalent cost, actual spend, and cost per shipped change. A request ships+API-equivalent cost, actual spend, cost per shipped change, and how many+attempts stepped up from a cheaper model. The same figures per model alone (a+grid model by its own name) compare models week over week. A request shipsonce, at its merge or first Done as the leaderboard records it, by the attemptthat was running then; more attempts done afterwards ship nothing new. Time toship runs from that attempt's start to when the request shipped. Cost per shipped change is shown only when every ended attempt's cost is