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
fix(backend): a terminal on a confidential session or another person's Lead is revoked and refused (#1940)
0xken1565df230a647e
diff --git a/backend/integration/superTabIndexes.test.ts b/backend/integration/superTabIndexes.test.tsindex 02b9b7479..f0d26ec68 100644--- a/backend/integration/superTabIndexes.test.ts+++ b/backend/integration/superTabIndexes.test.ts@@ -210,6 +210,22 @@ describe('terminal context revoke', () => {expect((await db.superTabDelivery.findUniqueOrThrow({ where: { id: 'turn' } })).status).toBe('cancelled')})+ // A session in a private conversation reads it (projects.ts confidentialSession): only its machine's owner may watch or drive it+ // from then on. A command can no longer put a Builder there; a session marked before that rule, or made so by the shared+ // rule's next change, is revoked through the same watchersLost comparison.+ it('revokes at once everyone\'s terminals on an agent that joins a private conversation, but its machine\'s owner\'s', async () => {+ await db.superTabNativeContext.deleteMany({})+ const { s, open } = scene()+ const worker = s.add('builder-harness', open, false, peer, 'host', peer.userId)+ await db.superTabNativeContext.createMany({ data: [{ ...context('peer-worker', open, peer.userId), agentId: worker },+ { ...context('outsider-worker', open, outsider.userId), agentId: worker }, { ...context('owner-worker', open, s.state.ownerId), agentId: worker }] })+ const before = structuredClone(s.state) as SuperTabState+ const chat = s.run({ type: 'conversation.create', title: 'Private', brief: '', checks: [], audience: { personIds: [peer.userId] } }, peer).conversationId as string+ s.edit(state => { state.conversations.find(c => c.id === chat)!.agentIds.push(worker) })+ await revokeNativeContexts(db, before, s.state)+ expect(await revoked()).toEqual(['outsider-worker', 'owner-worker'])+ })+it('revokes the contexts of a person made a viewer', async () => {await db.superTabNativeContext.deleteMany({})const { s, open } = scene()diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.tsindex 5844c787d..30b943ae3 100644--- a/backend/integration/superTabs.test.ts+++ b/backend/integration/superTabs.test.ts@@ -87,6 +87,11 @@ async function invite(tab: string, role: 'collaborator' | 'viewer' = 'collaboratconst invitation = await run(tab, { type: 'invite.create', email: peer.email, role, conversationId: 'lead' })await run(tab, { type: 'invite.accept', inviteId: invitation.result.inviteId as string }, peer)}+/** `host`, whose machine runs the fixture's agents, as a member: the one person who drives a Lead's terminal (terminal.ts mayDrive). */+async function joinHost(tab: string) {+ const invitation = await run(tab, { type: 'invite.create', email: host.email, role: 'collaborator', conversationId: 'lead' })+ await run(tab, { type: 'invite.accept', inviteId: invitation.result.inviteId as string }, host)+}beforeAll(async () => {replica = await MongoMemoryReplSet.create({ binary: { version: '7.0.24', downloadDir: join(tmpdir(), 'harness-super-tab-mongodb-binaries') },@@ -338,7 +343,8 @@ describe('native recording restart recovery', () => {const { tab, lead } = await fixture()await run(tab, { type: 'work.define', conversationId: 'lead', brief: 'Lead task', checks: [{ description: 'Checked', independent: false }] })await run(tab, { type: 'work.assign', conversationId: 'lead', agentId: lead })- const { contextId } = await store.native.open(owner, tab, { operationId: randomUUID(), conversationId: 'lead', agentId: lead })+ await joinHost(tab)+ const { contextId } = await store.native.open(host, tab, { operationId: randomUUID(), conversationId: 'lead', agentId: lead })const receipt = await store.native.append(host, tab, contextId, { turnId: 'lead_restart', kind: 'gap', previousEventId: null,text: '', truncated: false, interrupted: false,gap: { incidentId: 'lead_restart', reason: 'recording_restarted', detectedAt: Date.now() + 1000 } }) as { eventId: string }@@ -568,7 +574,9 @@ describe('deleting abandoned swarm projects', () => {const harnessId = randomUUID()const agentId = String((await run(tab, { type: 'agent.add', conversationId, machineId: 'test-host', harnessId,name: 'Private lead', configuration: config, lead: true })).result.agentId)- const context = await store.native.open(owner, tab, { operationId: randomUUID(), conversationId, agentId })+ await joinHost(tab)+ await run(tab, { type: 'project.sharing', projectId, visibility: 'private', memberIds: [host.sub] })+ const context = await store.native.open(host, tab, { operationId: randomUUID(), conversationId, agentId })await run(tab, { type: 'project.delete', projectId })await expect(store.native.read(host, tab, context.contextId)).rejects.toMatchObject({ code: 'NATIVE_CONTEXT_REVOKED' })expect(await store.mayObserve(owner, tab, 'test-host', harnessId, host.sub)).toBe(false)@@ -658,7 +666,7 @@ describe('private swarm projects on the real control API', () => {await run(tab, { ...message('Private result'), conversationId } as Command)expect((await store.read(peer, tab)).state.projects!.map(p => p.id)).not.toContain(projectId)await expect(store.messages(peer, tab, conversationId, {})).rejects.toMatchObject({ code: 'NOT_FOUND' })- await expect(store.native.open(peer, tab, { operationId: randomUUID(), conversationId, agentId })).rejects.toMatchObject({ code: 'NOT_FOUND' })+ await expect(store.native.open(peer, tab, { operationId: randomUUID(), conversationId, agentId: workerId })).rejects.toMatchObject({ code: 'NOT_FOUND' })expect(await store.mayObserve(peer, tab, 'test-host', workerHarness, host.sub)).toBe(false)expect((await rosterRows(store, host, 'test-host')).find(t => t.agent?.id === workerId)!.observers.map(p => p.userId)).not.toContain(peer.sub)await expect(store.messages(host, tab, 'lead', {}, agentId)).rejects.toMatchObject({ code: 'NOT_FOUND' })@@ -666,7 +674,8 @@ describe('private swarm projects on the real control API', () => {await run(tab, { type: 'project.sharing', projectId, visibility: 'private', memberIds: [peer.sub] })expect((await store.messages(peer, tab, conversationId, {})).messages.map(m => m.text)).toContain('Private result')expect(await store.mayObserve(peer, tab, 'test-host', workerHarness, host.sub)).toBe(true)- const context = await store.native.open(peer, tab, { operationId: randomUUID(), conversationId, agentId })+ // A member's terminal, also on the Builder: only its machine's owner drives a Lead.+ const context = await store.native.open(peer, tab, { operationId: randomUUID(), conversationId, agentId: workerId })const command = { ...message('Shared review'), conversationId } as Commandconst operationId = randomUUID()await run(tab, command, peer, undefined, operationId)@@ -910,12 +919,14 @@ describe('Super Tabs on a real Mongo replica set', () => {it('records native turns once, in order, with verified source metadata and no input echo', async () => {const { tab, lead } = await fixture()await invite(tab)+ // Only the Lead's machine's owner drives it (terminal.ts mayDrive); the execution host alone records and reads it.+ await joinHost(tab)const request = { operationId: randomUUID(), conversationId: 'lead', agentId: lead }- const { contextId } = await store.native.open(peer, tab, request)- expect(await store.native.open(peer, tab, request)).toEqual({ contextId })+ const { contextId } = await store.native.open(host, tab, request)+ expect(await store.native.open(host, tab, request)).toEqual({ contextId })await expect(store.native.read(peer, tab, contextId)).rejects.toMatchObject({ code: 'FORBIDDEN' })expect(await store.native.read(host, tab, contextId)).toMatchObject({ agentId: lead, machineId: 'test-host',- operator: { id: peer.sub, kind: 'person' }, lastEventId: null })+ operator: { id: host.sub, kind: 'person' }, lastEventId: null })const prompt = { turnId: randomUUID(), kind: 'prompt' as const, previousEventId: null,text: 'A native intervention', truncated: false, interrupted: false }await expect(store.native.append(owner, tab, contextId, prompt)).rejects.toMatchObject({ code: 'FORBIDDEN' })@@ -932,7 +943,7 @@ describe('Super Tabs on a real Mongo replica set', () => {const rows = (await store.messages(owner, tab, 'lead', {})).messagesexpect(rows).toHaveLength(2)expect(rows[0]).toMatchObject({ text: prompt.text, author: { kind: 'agent', id: lead },- source: { kind: 'native', phase: 'prompt', operator: { id: peer.sub, kind: 'person' } } })+ source: { kind: 'native', phase: 'prompt', operator: { id: host.sub, kind: 'person' } } })expect(rows[1]).toMatchObject({ replyTo: first.eventId, text: answer.text, source: { interrupted: true, phase: 'answer' } })expect(rows[0]!.source).not.toHaveProperty('contextId')expect(rows[1]!.sequence).toBeGreaterThan(rows[0]!.sequence)@@ -970,9 +981,13 @@ describe('Super Tabs on a real Mongo replica set', () => {})it('requires machine control as well as collaboration and fences removal, re-invitation and changed machine grants', async () => {- const { tab, lead } = await fixture()+ const { tab } = await fixture()await invite(tab, 'viewer')- const request = { operationId: randomUUID(), conversationId: 'lead', agentId: lead }+ // A member's terminal on a Builder: only its machine's owner drives a Lead (terminal.ts mayDrive).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Build', brief: '', checks: [] })).result.conversationId)+ const worker = String((await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),+ name: 'Builder', configuration: config, lead: false })).result.agentId)+ const request = { operationId: randomUUID(), conversationId: group, agentId: worker }await expect(store.native.open(peer, tab, request)).rejects.toMatchObject({ code: 'READ_ONLY' })await run(tab, { type: 'member.remove', userId: peer.sub })await invite(tab)@@ -980,7 +995,7 @@ describe('Super Tabs on a real Mongo replica set', () => {const event = { turnId: randomUUID(), kind: 'gap' as const, previousEventId: null,text: 'Caller text must not impersonate a gap explanation', truncated: false, interrupted: false }await store.native.append(host, tab, contextId, event)- expect((await store.messages(owner, tab, 'lead', {})).messages[0]!.text).toContain('Some terminal activity could not be recorded')+ expect((await store.messages(owner, tab, group, {})).messages[0]!.text).toContain('Some terminal activity could not be recorded')const original = (await db.machineShare.findUnique({ where: { machineId: 'test-host' } }))!await db.machineShare.update({ where: { machineId: 'test-host' }, data: { emails: [owner.email],grantVersions: nextMachineShareGrants(original, [owner.email], null) } })@@ -3217,6 +3232,37 @@ describe('the PM\'s terminal after a private chat (final review, Critical 1)', (}const observers = async (agentId: string) => (await rosterRows(store, host, 'test-host')).find(t => t.agent?.id === agentId)!.observers.map(p => p.userId)+ // A terminal drives its session and its answers land in the conversation. Driving another person's Lead needs its machine's+ // owner (terminal.ts mayDrive), so a member's terminal on a Builder made a Lead is refused from then on, whether or not it+ // was revoked with the change.+ it('refuses a member\'s terminal on a Builder made its project\'s Lead, at use and at open, and keeps the machine owner\'s', async () => {+ const { tab } = await fixture()+ await invite(tab)+ const asHost = await run(tab, { type: 'invite.create', email: host.email, role: 'collaborator', conversationId: 'lead' })+ await run(tab, { type: 'invite.accept', inviteId: asHost.result.inviteId as string }, host)+ const second = (await run(tab, { type: 'project.create', name: 'Second', visibility: 'public', brief: '' })).result as { projectId: string; conversationId: string }+ const group = String((await run(tab, { type: 'conversation.create', projectId: second.projectId, title: 'Build', brief: 'Build it', checks: [] })).result.conversationId)+ const worker = String((await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),+ name: 'Builder', configuration: config, lead: false })).result.agentId)+ const opened = (user: AuthUser) => store.native.open(user, tab, { operationId: randomUUID(), conversationId: group, agentId: worker })+ const { contextId: peers } = await opened(peer)+ const { contextId: hosts } = await opened(host)+ const typed = (contextId: string, turnId: string) => store.native.append(host, tab, contextId, { turnId, kind: 'prompt', previousEventId: null,+ text: 'Typed into the Builder', truncated: false, interrupted: false })+ await typed(peers, 'before')++ await run(tab, { type: 'conversation.agent', conversationId: second.conversationId, agentId: worker, present: true, lead: true })+ await expect(typed(peers, 'after')).rejects.toMatchObject({ code: 'NATIVE_CONTEXT_REVOKED' })+ await expect(store.native.read(host, tab, peers)).rejects.toMatchObject({ code: 'NATIVE_CONTEXT_REVOKED' })+ await expect(opened(peer)).rejects.toMatchObject({ code: 'TERMINAL_PRIVATE' })+ // Even a terminal the change left unrevoked is refused at use.+ await db.superTabNativeContext.update({ where: { id: peers }, data: { revoked: false } })+ await expect(typed(peers, 'unrevoked')).rejects.toMatchObject({ code: 'NATIVE_CONTEXT_REVOKED' })+ expect((await db.superTabNativeContext.findUniqueOrThrow({ where: { id: hosts } })).revoked).toBe(false)+ await expect(typed(hosts, 'owner')).resolves.toMatchObject({ eventId: expect.any(String) })+ await expect(opened(host)).resolves.toMatchObject({ contextId: expect.any(String) })+ })+it('lets nobody but its machine\'s owner watch it: not a reader outside the chat, not the Swarm owner, not with an earlier share', async () => {const { tab, lead, harnessId } = await privateChat()expect(await observers(lead)).toEqual([])diff --git a/backend/src/superTabs/native.ts b/backend/src/superTabs/native.tsindex 04794a5af..30b51e787 100644--- a/backend/src/superTabs/native.ts+++ b/backend/src/superTabs/native.ts@@ -5,7 +5,8 @@ import type { AuthUser } from '../lib/ssoAuth.js'import { isTeamSession, TEAM_SESSION_LIMITED, TEAM_SESSION_MESSAGE } from '../lib/teamSession.js'import { activeWork, agent, appendPullRequestUrls, author, conversation, fail, isLeads, stableId, SuperTabError,type Actor, type Agent, type Author, type Conversation, type SuperTabState } from './model.js'-import { canReadGroup, groupProject, readConversation } from './projects.js'+import { canReadGroup, groupProject, readConversation, watchersLost } from './projects.js'+import { mayDrive } from './terminal.js'import { noteProjectReports } from './projectUpdates.js'import { numberMessages, type Touch } from './parts/commit.js'import { redactCredentials } from './credentials.js'@@ -70,6 +71,11 @@ export class SuperTabNativeStore {const operator = author(state, { kind: 'person', userId: binding.operator.id, email: binding.operator.name }, true)const target = agent(state, record.agentId)const group = readConversation(state, { kind: 'person', userId: binding.operator.id, email: binding.operator.name }, record.conversationId)+ // A terminal drives its session and its answers land in the conversation: only those who may drive it may use it.+ try { mayDrive(state, { kind: 'person', userId: binding.operator.id, email: binding.operator.name }, target) } catch (error) {+ if (error instanceof SuperTabError) fail('NATIVE_CONTEXT_REVOKED', 'Only this agent\'s machine\'s owner can use its terminal now.', 403)+ throw error+ }if (operator.membershipGeneration !== binding.operator.membershipGeneration || group.archived || !group.agentIds.includes(target.id)|| target.harnessId !== binding.harnessId || target.machineId !== binding.machineId || target.machineOwnerId !== binding.machineOwnerId|| target.contributorId !== binding.contributorId || target.membershipGeneration !== binding.contributionGeneration@@ -110,6 +116,7 @@ export class SuperTabNativeStore {await this.validate(tx, state, prior)return { contextId }}+ mayDrive(state, { kind: 'person', userId: user.sub, email: user.email }, target)const binding: Binding = { tabId, conversationId: group.id, agentId: target.id, harnessId: target.harnessId,machineId: target.machineId, machineOwnerId: target.machineOwnerId, operator,contributorId: target.contributorId, contributionGeneration: target.membershipGeneration,@@ -264,6 +271,8 @@ export async function revokeNativeContexts(tx: Transaction, before: SuperTabStatconst current = after.agents.find(a => a.id === target.id)if (!current || current.harnessId !== target.harnessId) conditions.push({ agentId: target.id })}+ // Those who may no longer watch an agent, such as everyone but its machine's owner once it reads private chats.+ for (const { agentId, personIds } of watchersLost(before, after)) conditions.push({ agentId, userId: { in: personIds } })for (const group of before.conversations) {const current = after.conversations.find(c => c.id === group.id)if (!current || (current.archived && !group.archived)) conditions.push({ conversationId: group.id })diff --git a/backend/src/superTabs/projects.test.ts b/backend/src/superTabs/projects.test.tsindex 867f1d121..44ec56b3c 100644--- a/backend/src/superTabs/projects.test.ts+++ b/backend/src/superTabs/projects.test.ts@@ -2,7 +2,7 @@ import { createHash } from 'node:crypto'import { describe, expect, it } from 'vitest'import { applyCommand, commandSchema, type Command, type CommandContext } from './commands.js'import { createSuperTab, visibleState, type Actor, type MessageDraft } from './model.js'-import { canReadAgent, canWatchAgent, markConfidential, projectOf, projectsOf, readConversation, skillModeOf, skillSetOf, watchingNarrowed } from './projects.js'+import { canReadAgent, canWatchAgent, markConfidential, projectOf, projectsOf, readConversation, skillModeOf, skillSetOf, watchersLost, watchingNarrowed } from './projects.js'const owner: Actor = { kind: 'person', userId: 'owner', email: '[email protected]' }const peer: Actor = { kind: 'person', userId: 'peer', email: '[email protected]' }@@ -582,6 +582,15 @@ describe('whether a commit narrows who may watch a terminal', () => {expect(narrowed()).toBe(true)})+ it('names each agent and the people who lost sight of it, never its machine\'s owner', () => {+ const { f, builder, before } = watched()+ f.state.people.push({ id: 'host', email: '[email protected]', role: 'collaborator', generation: 'first' })+ before.people.push({ id: 'host', email: '[email protected]', role: 'collaborator', generation: 'first' })+ expect(watchersLost(before, f.state)).toEqual([])+ f.run({ type: 'conversation.agent', conversationId: 'lead', agentId: builder, present: true, lead: true })+ expect(watchersLost(before, f.state)).toEqual([{ agentId: builder, personIds: ['owner', 'peer'] }])+ })+it('is not narrowed by a change that leaves every watcher watching', () => {const { f, narrowed } = watched()f.run({ type: 'conversation.create', title: 'Another task', brief: '', checks: [] })diff --git a/backend/src/superTabs/projects.ts b/backend/src/superTabs/projects.tsindex 0b6ee53bd..384d708bb 100644--- a/backend/src/superTabs/projects.ts+++ b/backend/src/superTabs/projects.ts@@ -190,10 +190,11 @@ export function canWatchAgent(state: SuperTabState, actor: Actor, target: Agent,return canReadAgent(state, actor, target) && (!isConfidential(state, target, elsewhere) || ownSession(actor, target))}-/** Whether someone who could watch an agent's terminal before a commit cannot after it (canWatchAgent, by the session the- * observer relay watches: machine, harness and machine owner): a person left, the agent left, its project stopped being- * shared with them, or the session turned confidential, by whatever command. Its observer sockets then check again. */-export function watchingNarrowed(before: SuperTabState, after: SuperTabState): boolean {+/** Who could watch an agent's terminal before a commit and cannot after it (canWatchAgent, by the session the observer relay+ * watches: machine, harness and machine owner): a person left, the agent left, its project stopped being shared with them,+ * or the session turned confidential, by whatever command. Each such agent, with the people who lost it. Its observer+ * sockets then check again (watchingNarrowed), and those people's terminals on it are revoked (native.ts). */+export function watchersLost(before: SuperTabState, after: SuperTabState): Array<{ agentId: string; personIds: string[] }> {const session = (a: Agent) => `${a.machineId}\n${a.harnessId}\n${a.machineOwnerId}`const now = new Map(after.agents.map(a => [session(a), a]))// canWatchAgent per person, with the agent's confidentiality read once per state.@@ -202,16 +203,19 @@ export function watchingNarrowed(before: SuperTabState, after: SuperTabState): breturn state.people.map(p => ({ kind: 'person' as const, userId: p.id, email: p.email })).filter(actor => canReadAgent(state, actor, target) && (!confidential || ownSession(actor, target)))}- return before.agents.some(target => {+ return before.agents.flatMap(target => {const was = watchers(before, target)- if (!was.length) return false+ if (!was.length) return []const still = now.get(session(target))- if (!still) return true- const is = new Set(watchers(after, still).map(actor => actor.userId))- return was.some(actor => !is.has(actor.userId))+ const is = new Set(still ? watchers(after, still).map(actor => actor.userId) : [])+ const lost = was.filter(actor => !is.has(actor.userId)).map(actor => actor.userId)+ return lost.length ? [{ agentId: target.id, personIds: lost }] : []})}+/** Whether a commit narrows who may watch any agent's terminal (watchersLost). */+export const watchingNarrowed = (before: SuperTabState, after: SuperTabState): boolean => watchersLost(before, after).length > 0+/** The only actors a confidential session admits: the person whose machine runs it, or the session itself. */export const ownSession = (actor: Actor, target: Agent): boolean =>actor.kind === 'person' ? actor.userId === target.machineOwnerId : actor.agentId === target.iddiff --git a/backend/src/superTabs/terminal.test.ts b/backend/src/superTabs/terminal.test.tsindex 80b7f274a..62c31963f 100644--- a/backend/src/superTabs/terminal.test.ts+++ b/backend/src/superTabs/terminal.test.ts@@ -56,6 +56,19 @@ describe('reading and typing in an agent terminal', () => {}})+ // Ken (2026-10-28): members may watch the Lead, but driving another person's Lead needs its machine's owner, whether or not+ // its session counts as private.+ it('lets only its machine\'s owner read or type in a Lead\'s terminal, for being the Lead', () => {+ const s = swarm()+ for (const command of [{ type: 'agent.screen', agentId: s.lead }, { type: 'agent.input', agentId: s.lead, keys: ['Enter'] }] as Command[]) {+ expect(() => s.run(command, peer)).toThrow('in a Product Manager’s terminal')+ }+ const hostOwner: Actor = { kind: 'person', userId: 'host-owner', email: '[email protected]' }+ const invited = s.run({ type: 'invite.create', email: '[email protected]', role: 'collaborator', conversationId: 'lead' })+ s.run({ type: 'invite.accept', inviteId: invited.result.inviteId as string }, hostOwner)+ expect(s.run({ type: 'agent.input', agentId: s.lead, keys: ['Enter'] }, hostOwner).terminal).toMatchObject({ requesterKey: 'person:host-owner' })+ })+it('logs typed input as a terminal-input row in the agent\'s current group, delivered to nobody', () => {const s = swarm()s.run({ type: 'work.assign', conversationId: s.group, agentId: s.worker })diff --git a/backend/src/superTabs/terminal.ts b/backend/src/superTabs/terminal.tsindex 158286fa4..cbb94f275 100644--- a/backend/src/superTabs/terminal.ts+++ b/backend/src/superTabs/terminal.ts@@ -2,7 +2,7 @@ import type { PrismaClient } from '@prisma/client'import { activeWork, actorKey, agent, author, conversation, fail, isLeads, stableId, type Actor, type Agent, type Author, type Conversation, type MessageDraft,type SuperTabState } from './model.js'import { downSince } from './machines.js'-import { agentProjectId, isConfidential, ownSession, projectOf, readAgent } from './projects.js'+import { agentProjectId, isConfidential, ledProject, ownSession, projectOf, readAgent } from './projects.js'import { redactCredentials } from './credentials.js'/** The Lead reads and types in an agent's terminal through the host of the agent's machine (spec/2026-10-23-lead-sees-agent-terminal.md).@@ -36,6 +36,10 @@ export interface TerminalRequest { id: string; agentId: string; harnessId: strinexport function mayDrive(state: SuperTabState, actor: Actor, target: Agent, elsewhere = false): void {// For both kinds of requester: no person or agent reads a confidential session but its own (final review, Critical 1).const closed = () => {+ // Members may watch a Lead, but only its machine's owner drives it, whether or not its session counts as private (Ken, 2026-10-28).+ if (ledProject(state, target.id) && !ownSession(actor, target)) {+ fail('TERMINAL_PRIVATE', 'Only the person whose machine runs this agent can read or type in a Product Manager’s terminal.', 403)+ }if (isConfidential(state, target, elsewhere) && !ownSession(actor, target)) {fail('TERMINAL_PRIVATE', 'Only the person whose machine runs this agent can read or type in its terminal: it holds people’s private chats with the Product Manager.', 403)}