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
Leads see each other's work and talk: CLI status, Leads deliveries, skill line (#1657)
0xken1507657ac73122
diff --git a/cli/src/lib/swarmSkills.spec.ts b/cli/src/lib/swarmSkills.spec.tsindex 4350598be..169cf9060 100644--- a/cli/src/lib/swarmSkills.spec.ts+++ b/cli/src/lib/swarmSkills.spec.ts@@ -43,6 +43,8 @@ describe('built-in Swarm skills', () => {const sha = (text: string) => createHash('sha256').update(text).digest('hex')// The approved terminal line (spec/2026-10-23-lead-sees-agent-terminal.md), the Lead's alone, in both modes.const terminal = '- When a worker seems stuck, read its terminal; answer prompts within its task; ask the owner before approving anything risky.\n'+ // The approved overlap line (spec/2026-10-23-leads-see-and-talk.md, call 6), the Lead's alone, in both modes.+ const overlap = '- Before assigning, look at other projects\' active work; if your task touches the same code, say so in the Leads conversation and agree an order first.\n'const twoHours = '- A Builder or Reviewer that has been down for 2 hours (machine offline, session gone or stopped): cancel its task with the reason, route it, and assign it to another agent with what the first one left (branch, last revision, last report).\n'it.each([['lead', '5fc83d8c43b66b44cdab27b48235dbc86b7ab11a57153edc1ae7e92831642a8e'],@@ -57,7 +59,8 @@ describe('built-in Swarm skills', () => {expect(text.startsWith(`---\nname: swarm-${role}\n`)).toBe(true)expect(text.split(twoHours)).toHaveLength(role === 'lead' ? 2 : 1)expect(text.split(terminal)).toHaveLength(role === 'lead' ? 2 : 1)- expect(sha(text.replace(twoHours, '').replace(terminal, ''))).toBe(sha256)+ expect(text.split(overlap)).toHaveLength(role === 'lead' ? 2 : 1)+ expect(sha(text.replace(twoHours, '').replace(terminal, '').replace(overlap, ''))).toBe(sha256)}})it('adds the 2-hour line to section 7 right after the 6-hour rule', () => {@@ -70,6 +73,12 @@ describe('built-in Swarm skills', () => {const plain = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session', mode: 'default' }).file, 'utf8')expect(plain).toContain(`- A worker with active work that has said nothing for 20 minutes: ask it.\n${terminal}- A Builder or Reviewer`)})+ it('adds the overlap line last in each Lead skill\'s "Route, start, assign"', () => {+ const orchestration = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session' }).file, 'utf8')+ expect(orchestration).toContain(`Never pass your chat history; put everything needed in the brief.\n${overlap}\n## 7. Run the work`)+ const plain = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session', mode: 'default' }).file, 'utf8')+ expect(plain).toContain(`- The brief is all a Builder gets; never rely on chat history.\n${overlap}\n## 4. Keep work moving`)+ })// The owner's approved Default texts (attached to the spec, 2026-10-23), byte for byte.it.each([['lead', 'a7b8aed240f38edda8a461d87ce83499696588b2da41ed261821985caa63e415'],@@ -80,7 +89,8 @@ describe('built-in Swarm skills', () => {const prepared = prepareSwarmSkill(fixture(), { role, key: 'session', mode: 'default' })const text = readFileSync(prepared.file, 'utf8')expect(text.split(terminal)).toHaveLength(role === 'lead' ? 2 : 1)- expect(sha(text.replace(terminal, ''))).toBe(sha256)+ expect(text.split(overlap)).toHaveLength(role === 'lead' ? 2 : 1)+ expect(sha(text.replace(terminal, '').replace(overlap, ''))).toBe(sha256)expect(prepared.instructions).toBe(`Use the swarm-${role} skill for this session: the team process; otherwise work your usual way. Before working, read ${JSON.stringify(prepared.file)} with your file or shell tool.`)})diff --git a/cli/src/lib/swarmSkills.ts b/cli/src/lib/swarmSkills.tsindex 29086b950..144015c22 100644--- a/cli/src/lib/swarmSkills.ts+++ b/cli/src/lib/swarmSkills.ts@@ -109,6 +109,7 @@ For large work, post the group plan and get the owner's ok before assigning; onc- Match strength to work: mechanical → cheaper; integration and judgment → standard; design or subtle risk → strongest. A review is at least as strong as the build. Don't go below the standard tier for Reviewers, or for Builders working from prose; the cheapest models take more turns and end up costing more.- Reuse an idle agent before starting a new one. Start only on the Swarm's listed machines, from the branch the work builds on.- The brief is all a Builder gets. Never pass your chat history; put everything needed in the brief.+- Before assigning, look at other projects' active work; if your task touches the same code, say so in the Leads conversation and agree an order first.## 7. Run the work- When a restart interrupts active work, read the recovery notice and its last recorded checkpoint, then check the agent’s actual session and saved work. Ask it to continue from that checkpoint and report working; either you or the assigned agent can clear the recovery block. Never replay old input or commands: they may already have taken effect. A delayed recording gap after fresh progress is not a new interruption. Keep work already in review in review while you inspect the session. Ordinary typed input, an expired recording view, a missing recorded prompt, or an unclassified gap from an older recorder does not establish that work was interrupted.@@ -382,6 +383,7 @@ Keep each Builder's list a few tasks deep; do the easy, self-contained parts fir## 3. Route, start, assign- Route each group; reuse an idle agent before starting one; start only on the Swarm's machines.- The brief is all a Builder gets; never rely on chat history.+- Before assigning, look at other projects' active work; if your task touches the same code, say so in the Leads conversation and agree an order first.## 4. Keep work moving- Each time you are woken, look at active work.diff --git a/cli/src/superTabs/host.spec.ts b/cli/src/superTabs/host.spec.tsindex 599f549fc..8fb7e0426 100644--- a/cli/src/superTabs/host.spec.ts+++ b/cli/src/superTabs/host.spec.ts@@ -16,7 +16,10 @@ afterEach(() => { for (const host of hosts.splice(0)) host.stop(); for (const rofunction setup(messageFields: Record<string, unknown> = {}) {const dir = mkdtempSync(join(tmpdir(), 'super-tab-host-')); roots.push(dir)const listeners = new Set<(e: TurnDelivery) => void>()- const row = { tabId: 'tab', agent: { id: 'agent', harnessId: 'harness', machineId: 'machine-1' } }+ const row: { tabId: string; agent: { id: string; harnessId: string; machineId: string }; lead?: boolean } = { tabId: 'tab', agent: { id: 'agent', harnessId: 'harness', machineId: 'machine-1' } }+ /** The conversation the delivery comes from, and the ones the agent's own view of the tab lists. */+ let from = 'lead'+ const views = ['lead']let removed = false, revoked = false, status = 'queued', claimId: string | null = nullconst receipts: Record<string, unknown>[] = []const holds: Record<string, unknown>[] = []@@ -24,8 +27,9 @@ function setup(messageFields: Record<string, unknown> = {}) {const call: CoreApi['account']['backend'] = vi.fn(async (method, path, body) => {let data: unknownif (path.includes('/hosts/')) data = removed ? [] : [row]+ else if (path.includes('?asAgentId=')) data = { state: { conversations: views.map(id => ({ id })) } }else if (revoked) return { status: 403, body: { success: false, error: { code: 'FORBIDDEN', message: 'Grant removed' } } }- else if (method === 'GET') data = status === 'delivered' ? [] : [{ id: 'delivery', claimId, status }]+ else if (method === 'GET') data = status === 'delivered' ? [] : [{ id: 'delivery', conversationId: from, claimId, status }]else {const command = body as Record<string, unknown>if (command.type === 'claim') { claimId = command.claimId as string; status = 'claimed' }@@ -46,7 +50,7 @@ function setup(messageFields: Record<string, unknown> = {}) {for (const fn of listeners) fn({ deliveryId: 'team:service:superTabs:delivery', sessionId: 'harness', state, reason })}const saved = () => JSON.parse(readFileSync(hostJournalFile(dir, 'machine-1'), 'utf8'))- return { core, call, open, event, receipts, holds, log, row, wait: (ms: number) => { clock += ms }, saved, dir, remove: () => { removed = true }, revoke: (value = true) => { revoked = value }, foreignClaim: () => { claimId = 'another-process' } }+ return { core, call, open, event, receipts, holds, log, row, wait: (ms: number) => { clock += ms }, saved, dir, remove: () => { removed = true }, revoke: (value = true) => { revoked = value }, foreignClaim: () => { claimId = 'another-process' }, from: (id: string) => { from = id }, views }}describe('current Swarm role lookup', () => {@@ -131,6 +135,49 @@ describe('Super Tab native delivery handoff', () => {expect(t.saved().entries.delivery.stage).toBe('uncertain')expect(t.core.turns.deliver).toHaveBeenCalledTimes(2)})+ // Leads see each other's work and talk (spec 2026-10-23): the Leads conversation reaches Leads alone. The server+ // delivers it only to them; this host also types into an agent that leads nothing only what its own view can read.+ it('never types a Leads conversation message into an agent that leads nothing, and says so once', async () => {+ const t = setup(), host = t.open()+ t.from('leads')+ for (let i = 0; i < 3; i++) await host.tick()+ expect(t.core.turns.deliver).not.toHaveBeenCalled()+ expect(t.call).not.toHaveBeenCalledWith('POST', expect.stringContaining('/deliveries/delivery'), expect.anything())+ expect(t.log.mock.calls.filter(([line]) => String(line).includes('not in a conversation'))).toHaveLength(1)+ t.views.push('leads')+ await host.tick()+ expect(t.core.turns.deliver).toHaveBeenCalledTimes(1)+ })+ // The review of #1657: a Leads message held for a busy Lead must not be typed once that agent no longer leads.+ it('rechecks a held Leads conversation message after its agent stops being a Lead', async () => {+ const t = setup(), host = t.open()+ t.row.lead = true+ t.from('leads')+ await host.tick()+ expect(t.core.turns.deliver).toHaveBeenCalledTimes(1)+ t.event('rejected', 'team_waiting_busy')+ expect(t.saved().entries.delivery.stage).toBe('prepared')+ t.row.lead = false+ for (let i = 0; i < 3; i++) await host.tick()+ expect(t.core.turns.deliver).toHaveBeenCalledTimes(1)+ expect(t.saved().entries.delivery.stage).toBe('prepared')+ })+ it('reads an agent\'s view once for its own conversation, and never for a Lead', async () => {+ const t = setup(), host = t.open()+ await host.tick()+ expect(t.core.turns.deliver).toHaveBeenCalledTimes(1)+ const views = () => vi.mocked(t.call).mock.calls.filter(([, path]) => path === '/api/super-tabs/tab?asAgentId=agent').length+ expect(views()).toBe(1)+ t.event('rejected', 'team_waiting_busy')+ await host.tick()+ expect(views()).toBe(1)+ const lead = setup()+ lead.row.lead = true+ lead.from('leads')+ await lead.open().tick()+ expect(lead.core.turns.deliver).toHaveBeenCalledTimes(1)+ expect(vi.mocked(lead.call).mock.calls.some(([, path]) => path.includes('?asAgentId='))).toBe(false)+ })it('names all five task parts in the worker delivery header', async () => {const t = setup()await t.open().tick()@@ -242,7 +289,7 @@ describe('Super Tab native delivery handoff', () => {const original = vi.mocked(t.core.account.backend).getMockImplementation()!vi.mocked(t.core.account.backend).mockImplementation(async (method, path, body) => {if (method === 'GET' && path.endsWith('/deliveries')) {- return { status: 200, body: { success: true, data: [{ id: 'delivery', claimId: null, status: 'queued' }, { id: 'second', claimId: null, status: 'queued' }] } }+ return { status: 200, body: { success: true, data: [{ id: 'delivery', conversationId: 'lead', claimId: null, status: 'queued' }, { id: 'second', conversationId: 'lead', claimId: null, status: 'queued' }] } }}if (method === 'POST' && path.endsWith('/deliveries/delivery')) {return { status: 409, body: { success: false, error: { code: 'DELIVERY_RESOLVED', message: 'This message was already answered.' } } }diff --git a/cli/src/superTabs/host.ts b/cli/src/superTabs/host.tsindex 291dc5eb8..8d53d65b9 100644--- a/cli/src/superTabs/host.ts+++ b/cli/src/superTabs/host.ts@@ -83,7 +83,7 @@ interface Entry {}interface Journal { version: 1; machineId: string; entries: Record<string, Entry> }/** `skillMode` is the agent's project's skills; a row without it (an older backend, a project from before modes) is orchestration. */-interface HostAgent { tabId: string; agent: { id: string; harnessId: string; machineId: string; releaseId?: string }; skillMode?: unknown }+interface HostAgent { tabId: string; agent: { id: string; harnessId: string; machineId: string; releaseId?: string }; skillMode?: unknown; lead?: unknown }export interface SuperTabHostOptions {now?: () => numberwrite?: (file: string, journal: Journal) => void@@ -198,6 +198,9 @@ export class SuperTabHost {private readonly keepAlives = new Map<string, { running: boolean; failures: number; retryAt: number; reason?: string }>()/** Per session the backend ends: a close or acknowledgement in progress, how far it got, and when the next try may run. */private readonly endings = new Map<string, { running: boolean; closed: boolean; acked: boolean; failures: number; retryAt: number }>()+ /** Per agent that leads nothing (tab:agent): the conversations its own view of the tab lists, and the deliveries refused. */+ private readonly readable = new Map<string, Set<string>>()+ private readonly unreadable = new Set<string>()/** A Lead's reads of and typing into this machine's agents' terminals, and the stuck and usage-limit alerts. */private readonly terminal: TerminalHost@@ -537,6 +540,10 @@ export class SuperTabHost {const delivery = object(item)if (!identifier(delivery.id)) continueseen.add(delivery.id)+ // Checked before anything is typed: a new delivery, or one held while its agent may since have stopped leading. A+ // claimed one with no journal is never typed, only reported as uncertain; a delivered one only acknowledged.+ const entry = this.journal.entries[delivery.id]+ if ((entry ? entry.stage === 'prepared' : !delivery.claimId) && !await this.mayRead(target, delivery)) continuetry { await this.accept(target, delivery, path) } catch (error) {// Answered (or resolved by a person) between the roster read and this call: nothing is owed, and the// agent's other deliveries go on.@@ -553,6 +560,8 @@ export class SuperTabHost {// A Lead the roster no longer marks (its project deleted) is never reopened again.for (const [harnessId, state] of this.keepAlives) if (!leads.has(harnessId) && !state.running) this.keepAlives.delete(harnessId)for (const [key, state] of this.endings) if (!ended.has(key) && !state.running) this.endings.delete(key)+ for (const key of this.readable.keys()) if (!running.some(target => `${target.tabId}:${target.agent.id}` === key)) this.readable.delete(key)+ for (const deliveryId of this.unreadable) if (!seen.has(deliveryId)) this.unreadable.delete(deliveryId)for (const deliveryId of this.files.keys()) if (!this.journal.entries[deliveryId]) this.files.delete(deliveryId)for (const entry of Object.values(this.journal.entries)) {const id = typedId(entry)@@ -739,6 +748,24 @@ export class SuperTabHost {this.persist()}+ /** Leads see each other's work and talk (spec 2026-10-23): the Leads conversation reaches Leads alone. The server+ * delivers it only to them; an agent that leads nothing is also given only what its own view of the tab lists. */+ private async mayRead(target: HostAgent, delivery: Json): Promise<boolean> {+ if (target.lead === true) return true+ const key = `${target.tabId}:${target.agent.id}`+ if (this.readable.get(key)?.has(String(delivery.conversationId))) return true+ const state = object(object(await backend(this.core, 'GET', `/api/super-tabs/${target.tabId}?asAgentId=${target.agent.id}`)).state)+ const readable = new Set((Array.isArray(state.conversations) ? state.conversations.map(object) : [])+ .filter(c => identifier(c.id) && c.kind !== 'leads' && c.id !== state.leadsConversationId).map(c => c.id as string))+ this.readable.set(key, readable)+ if (readable.has(String(delivery.conversationId))) return true+ if (!this.unreadable.has(delivery.id as string)) {+ this.unreadable.add(delivery.id as string)+ this.log(`Withheld delivery ${String(delivery.id)}: it is not in a conversation ${target.agent.harnessId} can read.`)+ }+ return false+ }+private async accept(target: HostAgent, delivery: Json, path: string): Promise<void> {const deliveryId = delivery.id as stringlet entry = this.journal.entries[deliveryId]diff --git a/cli/src/superTabs/service.spec.ts b/cli/src/superTabs/service.spec.tsindex 153c6049a..4cdd34d00 100644--- a/cli/src/superTabs/service.spec.ts+++ b/cli/src/superTabs/service.spec.ts@@ -3,6 +3,9 @@ import { describe, expect, it, vi } from 'vitest'import { fakeCore } from '../testing/fakeCore.js'import type { CoreApi } from '../core/api.js'import { superTabService } from './service.js'+import { object } from './wire.js'++const list = (value: unknown) => Array.isArray(value) ? value.map(object) : []import { SuperTabHostError, type SuperTabHost, type SuperTabHostOptions } from './host.js'const owner = { local: true, owner: true }, visitor = { local: false, owner: false }@@ -190,6 +193,13 @@ it('tells the Lead that start works only on a machine in the Swarm\'s Machines lexpect(answer.help.start).toContain('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.')expect(answer.help.start).toContain('Repeat exactly after an interruption')})+it('explains to a Lead other projects\' work and the Leads conversation', async () => {+ const answer = await setup().ask({ action: 'help' }, owner) as { help: { status: string; leads: string } }+ expect(answer.help.status).toContain('A Lead\'s status also lists otherProjectsWork: the active work of the Swarm\'s other projects')+ expect(answer.help.leads).toContain('leadsConversationId')+ expect(answer.help.leads).toContain('Only Leads and people post there, and only Leads among agents receive it.')+ expect(answer.help.leads).toContain('if your task touches the same code, say so there and agree an order first')+})it('resolves a native caller to its exact contribution and rechecks it before every agent command', async () => {const t = setup()expect(await t.ask({ action: 'status', tabId: 'tab', harnessId: 'native' }, owner)).toMatchObject({ ok: true })@@ -205,6 +215,57 @@ it('resolves a native caller to its exact contribution and rechecks it before evexpect(await t.ask({ action: 'status', tabId: 'tab', agentId: t.agentId }, owner)).toMatchObject({ error: 'AGENT_UNAVAILABLE' })})+// Leads see each other's work and talk (spec 2026-10-23): a Lead's status carries other projects' active work, in the+// backend's own fields and nothing more; an agent that leads nothing never sees it nor the Leads conversation.+describe('other projects\' work in status', () => {+ const work = { conversationId: 'docs-roster', projectName: 'Docs', title: 'Roster', owns: ['desktop/lib/super_tabs'], status: 'review',+ agentName: 'Builder', pr: 'https://github.com/example/project/pull/12' }+ /** A Swarm whose project Pilot is led, through its Lead conversation, by [leadId]; [groups] are further conversations. */+ const swarm = (t: ReturnType<typeof setup>, leadId: string | null, groups: Record<string, unknown>[] = [], legacy = false) => {+ const lead = legacy ? 'lead' : 'pilot'+ const state = { agents: [t.agent], leadsConversationId: 'leads', ...(legacy ? {} : { projects: [{ id: 'pilot', name: 'Pilot', leadConversationId: 'pilot' }] }),+ conversations: [{ id: lead, leadId, agentIds: [t.agentId] }, ...groups, { id: 'leads', kind: 'leads', title: 'Leads', leadId: null, agentIds: [t.agentId] }],+ otherProjectsWork: [{ ...work, assignmentId: 'internal', brief: 'The whole brief' }] }+ t.call.mockImplementation(async () => ({ status: 200, body: { success: true, data: { revision: 7, state } } }))+ }+ const status = async (t: ReturnType<typeof setup>) => object(object(object(await t.ask({ action: 'status', tabId: 'tab', agentId: t.agentId }, owner)).value).state)++ it('shows a Lead each other project\'s active work in the agreed fields alone', async () => {+ const t = setup()+ swarm(t, t.agentId)+ const state = await status(t)+ expect(state.otherProjectsWork).toEqual([work])+ expect(state.leadsConversationId).toBe('leads')+ expect(list(state.conversations).map(c => c.id)).toEqual(['pilot', 'leads'])+ })++ it('shows the Lead of a Swarm from before projects that work too', async () => {+ const t = setup()+ swarm(t, t.agentId, [], true)+ expect((await status(t)).otherProjectsWork).toEqual([work])+ })++ // The review of #1657: the backend's Lead is its project's Lead conversation's. A former Lead still named on an older+ // work group is not one.+ it('shows a former Lead that still leads an older work group neither that work nor the Leads conversation', async () => {+ const t = setup()+ swarm(t, 'new-lead', [{ id: 'older-work', projectId: 'pilot', leadId: t.agentId, agentIds: [t.agentId] }])+ const state = await status(t)+ expect(state).not.toHaveProperty('otherProjectsWork')+ expect(state).not.toHaveProperty('leadsConversationId')+ expect(list(state.conversations).map(c => c.id)).toEqual(['pilot', 'older-work'])+ })++ it('shows an agent that leads nothing neither that work nor the Leads conversation, whatever the server sends', async () => {+ const t = setup()+ swarm(t, 'another-lead')+ const state = await status(t)+ expect(state).not.toHaveProperty('otherProjectsWork')+ expect(state).not.toHaveProperty('leadsConversationId')+ expect(list(state.conversations).map(c => c.id)).toEqual(['pilot'])+ })+})+it('resolves a replacement terminal to the original stable member', async () => {const t = setup()t.agent.harnessId = 'replacement'diff --git a/cli/src/superTabs/service.ts b/cli/src/superTabs/service.tsindex 75b863f91..756b32756 100644--- a/cli/src/superTabs/service.ts+++ b/cli/src/superTabs/service.ts@@ -12,7 +12,8 @@ import { messageIdOf } from './attach.js'import { cardId, SwarmCards } from './cards.js'const HELP = {- status: 'Read the shared tab roster and work. Its rules are the project owners\' routing rules, each in the owner\'s own words; each binds only the agents of its projectId.',+ status: 'Read the shared tab roster and work. Its rules are the project owners\' routing rules, each in the owner\'s own words; each binds only the agents of its projectId. A Lead\'s status also lists otherProjectsWork: the active work of the Swarm\'s other projects (group, project, title, owned code, status, Engineer, PR), read only.',+ leads: 'The Leads conversation (leadsConversationId in a Lead\'s status) is one conversation for the whole Swarm, outside every project. Only Leads and people post there, and only Leads among agents receive it. Before assigning, look at otherProjectsWork; if your task touches the same code, say so there and agree an order first, then tell your own project. The Swarm posts there by itself when two projects\' active tasks own the same code.',messages: 'messages GROUP: read recent messages in a conversation.',message: 'message GROUP MESSAGE_ID: read one exact message, including an earlier question or result referenced by a reply.',post: 'post GROUP TEXT OPERATION_ID [--reply-to MESSAGE_ID] [--attach PATH]...: reply in that conversation. Use a unique ID per message and reuse it after an interrupted request. Answer a message once, with --reply-to its ID. --attach sends a file (a screenshot, a log; up to 10 files of 10 MB each), and TEXT may then be empty.',@@ -54,6 +55,21 @@ const HELP = {}const list = (value: unknown) => Array.isArray(value) ? value.map(object) : []+const OTHER_WORK_FIELDS = ['conversationId', 'projectName', 'title', 'owns', 'status', 'agentName', 'pr'] as const++/** Leads see each other's work and talk (spec 2026-10-23): a Lead reads other projects' active work in the backend's+ * fields alone; any other agent reads neither it nor the Leads conversation, even from a server that sent it. */+function statusView(answer: Record<string, unknown>, agentId: string): Record<string, unknown> {+ const { otherProjectsWork, leadsConversationId, ...state } = object(answer.state)+ // A project's Lead is its Lead conversation's, as the backend reads it; a Swarm from before projects has one, 'lead'.+ const leads = Array.isArray(state.projects) ? list(state.projects).map(p => p.leadConversationId) : ['lead']+ if (list(state.conversations).some(c => leads.includes(c.id) && c.leadId === agentId)) {+ return { ...answer, state: { ...state, ...(leadsConversationId !== undefined ? { leadsConversationId } : {}),+ ...(Array.isArray(otherProjectsWork) ? { otherProjectsWork: list(otherProjectsWork).map(work =>+ Object.fromEntries(OTHER_WORK_FIELDS.filter(key => key in work).map(key => [key, work[key]]))) } : {}) } }+ }+ return { ...answer, state: { ...state, conversations: list(state.conversations).filter(c => c.kind !== 'leads' && c.id !== leadsConversationId) } }+}function taskCommand(command: Record<string, unknown>): Record<string, unknown> {if (command.type !== 'conversation.create' && command.type !== 'work.define') return command@@ -208,7 +224,7 @@ export function superTabService(core: CoreApi, options: SuperTabServiceOptions =if (payload.action === 'startStatus' && identifier(payload.startId)) {return { ok: true, value: await backend(core, 'GET', `${path}/starts/${payload.startId}?${identity}`) }}- if (payload.action === 'status') return { ok: true, value: answer }+ if (payload.action === 'status') return { ok: true, value: statusView(answer, agentId) }// A Lead's terminal read or typing (`screen`, `type`): the backend answers only the agent that asked.if (payload.action === 'terminalResult') {if (!identifier(payload.terminalRequestId)) return { error: 'INVALID_REQUEST' }