Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Swarm view-only terminals: keep members' views across owner restarts, and say when a terminal is private (#1924)

0xken158582964ac2e7
diff --git a/cli/src/services/sharing.spec.ts b/cli/src/services/sharing.spec.ts
index 04f928dde..66bfc250b 100644
--- a/cli/src/services/sharing.spec.ts
+++ b/cli/src/services/sharing.spec.ts
@@ -34,11 +34,13 @@ describe('who a Super Tab lets watch a harness here', () => {
expect(on.allows(grant('member', 'super:tab'))).toBe(true)
expect(on.allows(grant('lead'))).toBe(false)
expect(on.allows(grant('ordinary'))).toBe(true)
+ expect(on.paused(grant('member', 'super:tab'))).toBe(false)
const off = shareObservers(core())
expect(off.known()).toBeNull()
expect(off.allows(grant('member', 'super:tab'))).toBe(false)
expect(off.allows(grant('lead'))).toBe(false)
expect(off.allows(grant('ordinary'))).toBe(true)
+ expect(off.paused(grant('member', 'super:tab'))).toBe(false)
})
})
diff --git a/cli/src/services/sharing.ts b/cli/src/services/sharing.ts
index 789f56e3f..2f44fe0d4 100644
--- a/cli/src/services/sharing.ts
+++ b/cli/src/services/sharing.ts
@@ -73,6 +73,7 @@ export function startSharing(core: CoreApi, ports: CorePorts, options: SharingOp
const owner = new HarnessShareOwner({
derivedGrants: superTabs.known,
allowsGrant: superTabs.allows,
+ pausedGrant: superTabs.paused,
machineId: () => core.daemon.machineId(),
key: {
publicKey: async () => b64d(await core.account.observerKey.publicKey()),
diff --git a/cli/src/sharing/owner.ts b/cli/src/sharing/owner.ts
index 33fccdf2e..0d7e6234a 100644
--- a/cli/src/sharing/owner.ts
+++ b/cli/src/sharing/owner.ts
@@ -44,6 +44,9 @@ export interface ShareOwnerDeps {
* `known`): their invitations are then kept as they are, neither withdrawn nor sent again. */
derivedGrants?: () => Array<Omit<DerivedGrant, 'ownerPublicKey'>> | null
allowsGrant?: (grant: HarnessGrant) => boolean
+ /** Whether a grant `allowsGrant` refuses is only waiting for the Swarm's next roster (superTabs/observers.ts `paused`):
+ * its viewer is then told to retry. Without it every refusal is final. */
+ pausedGrant?: (grant: HarnessGrant) => boolean
now?: () => number
}
@@ -75,7 +78,7 @@ export class HarnessShareOwner {
let ticks = 0
this.timer = setInterval(() => {
for (const [id, observer] of this.observers) {
- if (!this.authorized(observer)) this.close(id, 'Sharing ended or invitation expired')
+ if (!this.authorized(observer)) this.close(id, 'Sharing ended or invitation expired', this.paused(observer.grant))
}
// Derived again every 30 s: the renewals fall due, and a roster change whose nudge never came is caught here. A
// refused grant is tried again at most hourly from here: up to 256 of them every 30 s would hammer the backend.
@@ -102,6 +105,11 @@ export class HarnessShareOwner {
&& (this.deps.allowsGrant?.(observer.grant) ?? true)
&& !!this.deps.resolveAgent(observer.grant.agentId)
}
+ /** A view refused only until the Swarm host's next roster: after a restart a viewer reconnects within a second or two,
+ * before that roster, and a final refusal there left their pane closed for good (Ken, 2026-10-28). */
+ private paused(grant: HarnessGrant): boolean {
+ return !!this.deps.grants.active(grant.id, grant.recipientEmail, this.deps.machineId()) && (this.deps.pausedGrant?.(grant) ?? false)
+ }
private invited(agentId: string, email: string): boolean {
return this.deps.grants.list(this.deps.machineId(), agentId)
.some(g => !!this.deps.grants.active(g.id, email, this.deps.machineId()))
@@ -142,7 +150,8 @@ export class HarnessShareOwner {
? { ...link, recipientEmail: email, createdAt: '', expiresAt: '', revoked: false, publicationError: null, tab: null, failedAt: null }
: payload.linkId ? null : this.deps.grants.active(String(payload.shareId), email, this.deps.machineId())
if (!grant || !(this.deps.allowsGrant?.(grant) ?? true) || !this.deps.resolveAgent(grant.agentId) || this.observers.size >= 100) {
- this.deps.send(connId, 'observer_closed', { reason: 'Sharing ended or invitation expired' }); return
+ this.deps.send(connId, 'observer_closed', { reason: 'Sharing ended or invitation expired',
+ retry: !!grant && !!this.deps.resolveAgent(grant.agentId) && this.paused(grant) }); return
}
try {
const { cipher, welcome } = this.deps.key
@@ -155,7 +164,7 @@ export class HarnessShareOwner {
}
const observer = this.observers.get(connId)
if (!observer) return
- if (!this.authorized(observer)) { this.close(connId, 'Sharing ended or invitation expired'); return }
+ if (!this.authorized(observer)) { this.close(connId, 'Sharing ended or invitation expired', this.paused(observer.grant)); return }
const frame = type === 'observer_frame' ? observer.cipher.open(payload) : null
if (!frame || typeof frame.type !== 'string' || !frame.payload || typeof frame.payload !== 'object') {
this.close(connId, 'Invalid observer message'); return
diff --git a/cli/src/sharing/swarmMarks.spec.ts b/cli/src/sharing/swarmMarks.spec.ts
index 722faa593..e96e12cd1 100644
--- a/cli/src/sharing/swarmMarks.spec.ts
+++ b/cli/src/sharing/swarmMarks.spec.ts
@@ -39,5 +39,7 @@ describe('the Swarm\'s marks on Share, read with the Swarm off', () => {
expect(marks.allows(grant('lead'))).toBe(false)
expect(marks.allows(grant('member', 'super:tab'))).toBe(false)
expect(marks.allows(grant('member'))).toBe(true)
+ // The Swarm off is no restart: a Super Tab's viewer is not told to retry.
+ expect(marks.paused(grant('member', 'super:tab'))).toBe(false)
})
})
diff --git a/cli/src/sharing/swarmMarks.ts b/cli/src/sharing/swarmMarks.ts
index de174b347..aa2cae4bf 100644
--- a/cli/src/sharing/swarmMarks.ts
+++ b/cli/src/sharing/swarmMarks.ts
@@ -41,5 +41,7 @@ export function withoutSwarm(dataDir: string, machine: () => string) {
known: (): null => null,
allows: (grant: HarnessGrant): boolean => !superTabOf(grant)
&& !savedConfidential(observerSnapshotFile(dataDir, machine()), machine()).includes(grant.agentId),
+ /** The Swarm off is no restart: no roster is coming, so a refused viewer is not told to retry. */
+ paused: (_grant: HarnessGrant): boolean => false,
}
}
diff --git a/cli/src/superTabs/host.spec.ts b/cli/src/superTabs/host.spec.ts
index dae826ea9..b50395a85 100644
--- a/cli/src/superTabs/host.spec.ts
+++ b/cli/src/superTabs/host.spec.ts
@@ -1566,12 +1566,15 @@ describe('the members a host lets watch its agents', () => {
clock += 1_000; await read(); clock += 201
expect(source.allows(peer)).toBe(false)
expect(source.known()).toEqual([])
- // A host that stops publishes nobody, in force: Share withdraws the invitations rather than keeping them.
+ // A host that stops (its backend link dropped, or the daemon restarting for an update) pauses viewing at once, but no
+ // roster is in force: Share keeps the invitations. Withdrawing them took the computer out of every member's machine
+ // list until their app next read it, up to 5 minutes later (Ken, 2026-10-28).
rows = [member]
clock += 1_000; await read(); clock += 201
expect(source.known()).toHaveLength(1)
host.stop(); clock += 201
- expect(source.known()).toEqual([])
+ expect(source.known()).toBeNull()
+ expect(source.allows(peer)).toBe(false)
expect(superTabs.shareObservers).toHaveBeenCalledOnce()
})
})
diff --git a/cli/src/superTabs/host.ts b/cli/src/superTabs/host.ts
index 0786b6f9b..82adf9f2d 100644
--- a/cli/src/superTabs/host.ts
+++ b/cli/src/superTabs/host.ts
@@ -338,9 +338,12 @@ export class SuperTabHost {
this.native?.stop()
this.machines?.stop()
this.authorized.clear()
- // An empty roster in force, which Share reads as everyone gone and withdraws their invitations; a lapsed one
- // would only pause their views (superTabs/observers.ts `known`).
- try { this.observers(this.core.dataDir, this.machineId, [], this.now() + OBSERVER_VALID_MS, this.stillRuns) } catch { /* The old snapshot expires. */ }
+ // A roster that lapses now: viewing pauses at once, and Share keeps the invitations (superTabs/observers.ts `known`)
+ // until the next host's first roster says who is still a member. A host stops when its backend link drops and when
+ // the daemon restarts for an update; an empty roster in force here withdrew every member's invitation each time,
+ // which took this computer out of their machine lists until their apps next read them, up to 5 minutes later, and
+ // their panes said Harness here was out of date (Ken, 2026-10-28). The confidential marks are kept as they are.
+ try { this.observers(this.core.dataDir, this.machineId, [], this.now(), this.stillRuns) } catch { /* The old snapshot expires. */ }
// Signed out or another machine: this host's alerts are no longer anyone's. A core that is gone heard nothing, and
// the next host's first roster replaces them anyway.
if (this.attention !== null && this.attention !== '[]') {
diff --git a/cli/src/superTabs/observers.spec.ts b/cli/src/superTabs/observers.spec.ts
index ebb9ea186..f1cf3c868 100644
--- a/cli/src/superTabs/observers.spec.ts
+++ b/cli/src/superTabs/observers.spec.ts
@@ -99,3 +99,40 @@ it('refuses every share of a session a roster marks confidential, an ordinary on
expect(source.allows(pm)).toBe(true)
} finally { rmSync(dir, { recursive: true, force: true }) }
})
+
+it('tells a member to retry, not that sharing ended, while the roster has lapsed, and refuses for good otherwise', async () => {
+ const dir = mkdtempSync(join(tmpdir(), 'super-observer-')), key = newIdentity()
+ const grants = new HarnessGrantStore(join(dir, 'grants.json'))
+ let now = Date.now()
+ const source = observerSource(dir, () => 'machine', () => now)
+ const row = (harnessId: string, email: string, confidential = false) => ({ tabId: 'tab', confidential,
+ agent: { machineId: 'machine', harnessId, name: harnessId, configuration: {} }, observers: [{ email }] })
+ const sent: Array<{ id: string; type: string; payload: Record<string, unknown> }> = []
+ const owner = new HarnessShareOwner({ machineId: () => 'machine', identity: key, grants, now: () => now,
+ derivedGrants: source.known, allowsGrant: source.allows, pausedGrant: source.paused,
+ resolveAgent: id => ['builder', 'pm'].includes(id) ? { agentId: id, active: true } as never : undefined,
+ streams: () => ({ handleFrame: vi.fn(async () => true), closeConnection: vi.fn(), stop: async () => {} }),
+ send: (id, type, payload) => { sent.push({ id, type, payload }); return true }, publish: vi.fn(async () => ({ status: 200, body: {} })) })
+ const open = async (conn: string, agentId: string, email: string) => {
+ const grant = grants.all().find(g => g.agentId === agentId && g.recipientEmail === email)!
+ await owner.receive(conn, 'observer_open', { shareId: grant.id, email, ephemeral: b64e(newEphemeral().pub) })
+ return sent.filter(f => f.id === conn).at(-1)
+ }
+ try {
+ publishObservers(dir, 'machine', [row('builder', '[email protected]'), row('builder', '[email protected]'), row('pm', '[email protected]')], now + OBSERVER_VALID_MS)
+ now += 201; await owner.manage('harness_share_rosters', {})
+ expect(await open('observer:1', 'builder', '[email protected]')).toMatchObject({ type: 'observer_welcome' })
+ // The host stops (its daemon restarts for an update): the member's open view is closed, to be opened again.
+ publishObservers(dir, 'machine', [], now); now += 201
+ await vi.waitFor(() => expect(sent.filter(f => f.id === 'observer:1').at(-1)).toMatchObject({ type: 'observer_closed', payload: { retry: true } }), { timeout: 3_000 })
+ // Their app reconnects before the next host's first roster: told to try again, not that sharing ended.
+ expect(await open('observer:2', 'builder', '[email protected]')).toMatchObject({ type: 'observer_closed', payload: { retry: true } })
+ // A confidential session is refused for good, roster or not.
+ publishObservers(dir, 'machine', [row('pm', '[email protected]', true)], now); now += 201
+ expect(await open('observer:3', 'pm', '[email protected]')).toMatchObject({ type: 'observer_closed', payload: { retry: false } })
+ // The next roster is in force: the member watches again, and one it no longer lists is refused for good.
+ publishObservers(dir, 'machine', [row('builder', '[email protected]')], now + OBSERVER_VALID_MS); now += 201
+ expect(await open('observer:4', 'builder', '[email protected]')).toMatchObject({ type: 'observer_welcome' })
+ expect(await open('observer:5', 'builder', '[email protected]')).toMatchObject({ type: 'observer_closed', payload: { retry: false } })
+ } finally { await owner.stop(); rmSync(dir, { recursive: true, force: true }) }
+})
diff --git a/cli/src/superTabs/observers.ts b/cli/src/superTabs/observers.ts
index 641c64d98..bf96b4659 100644
--- a/cli/src/superTabs/observers.ts
+++ b/cli/src/superTabs/observers.ts
@@ -71,13 +71,17 @@ export function observerSource(dataDir: string, machine: () => string, now = Dat
const current = (): Wanted[] => { const rows = read(); return live() ? rows : [] }
return {
current,
- /** What the host's last roster wants, or null when no roster is in force (its host stalled, or the file cannot be
- * read): that says nothing about who is a member, so Share keeps the invitations it holds rather than withdrawing
- * and sending them all again. Viewing is still withheld meanwhile (`allows`). A host that stops publishes an
- * empty roster that is in force, which does withdraw them. */
+ /** What the host's last roster wants, or null when no roster is in force (its host stalled or stopped, or the file
+ * cannot be read): that says nothing about who is a member, so Share keeps the invitations it holds rather than
+ * withdrawing and sending them all again. Viewing is still withheld meanwhile (`allows`). The next roster in force
+ * withdraws those of members it no longer lists. */
known: (): Wanted[] | null => { const rows = read(); return live() ? rows : null },
/** A confidential session refuses every share, Swarm or ordinary; another Swarm share needs the roster in force. */
allows: (grant: HarnessGrant): boolean => { read(); return !confidential.includes(grant.agentId) && (!superTabOf(grant) || current().some(w =>
w.tab === grant.tab && w.agentId === grant.agentId && w.email === grant.recipientEmail)) },
+ /** A Swarm share withheld only because no roster is in force (its host is starting, or restarting for an update): the
+ * next roster decides it, so its viewer is told to try again rather than that sharing ended. A confidential session's
+ * is refused for good. */
+ paused: (grant: HarnessGrant): boolean => { read(); return !!superTabOf(grant) && !confidential.includes(grant.agentId) && !live() },
}
}
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dart
index a01613692..e50ba33af 100644
--- a/desktop/lib/super_tabs/model.dart
+++ b/desktop/lib/super_tabs/model.dart
@@ -66,6 +66,7 @@ class SuperTabAgent {
limitedUntil = DateTime.tryParse(row['limitedUntil'] as String? ?? ''),
avatar = SuperTabAvatarPicture.fromJson(row['avatar']),
downSince = DateTime.tryParse(row['downSince'] as String? ?? ''),
+ confidential = row['confidential'] == true,
configuration = Map.unmodifiable(superTabMap(row['configuration']));
final String id, projectId, name, machineId, harnessId, contributorId;
@@ -82,6 +83,10 @@ class SuperTabAgent {
/// The account whose computer runs it; a contributor may run agents on a computer another account shared with them.
final String machineOwnerId;
+
+ /// Its session read private chats: a Product Manager, now or before, or an agent in a private chat. Only the person
+ /// whose computer runs it may watch it; its computer refuses every share (backend projects.ts `canWatchAgent`).
+ final bool confidential;
// Keep the legacy default for callers while allowing group-based roster ownership.
final bool hasProjectId;
final String? displayName;
diff --git a/desktop/lib/super_tabs/terminal_unavailable.dart b/desktop/lib/super_tabs/terminal_unavailable.dart
index 4bece7cc7..bdab8ea91 100644
--- a/desktop/lib/super_tabs/terminal_unavailable.dart
+++ b/desktop/lib/super_tabs/terminal_unavailable.dart
@@ -30,6 +30,13 @@ String superTabTerminalUnavailable({
final computer =
machine?.machine.displayName ?? row?['name'] as String? ?? 'a computer';
final name = snapshot.agentName(agent.id);
+ // A private session is never shared, so no update or Retry brings it here. River, Ken's Product Manager, read
+ // "update and restart Harness" to every member while that Mac ran the latest Harness (2026-10-28).
+ if (superTabTerminalPrivate(snapshot, agent)) {
+ return snapshot.isLead(agent.id)
+ ? '$name is the Product Manager and reads private chats, so only $owner can watch its terminal.'
+ : '$name reads private chats, so only $owner can watch its terminal.';
+ }
final where = '$name runs on $computer, $owner’s computer';
if (_swarmOffline(row, now ?? DateTime.now())) {
return '$where, which is offline. Its terminal shows here once that computer is back.';
@@ -38,6 +45,10 @@ String superTabTerminalUnavailable({
'once it is up to date and running. Ask $owner to update and restart Harness, then Retry.';
}
+/// Whether an agent's terminal is private to the person whose computer runs it: it reads private chats.
+bool superTabTerminalPrivate(SuperTabSnapshot snapshot, SuperTabAgent agent) =>
+ agent.confidential || snapshot.isLead(agent.id);
+
/// Whether the Swarm last heard from this machine long enough ago to call it offline. A machine the Swarm does not
/// list is not called offline: what is known of it then is only that this account cannot see it.
bool _swarmOffline(Map<String, dynamic>? row, DateTime now) {
diff --git a/desktop/lib/super_tabs/workspace.dart b/desktop/lib/super_tabs/workspace.dart
index f9308b5b1..84dfd259d 100644
--- a/desktop/lib/super_tabs/workspace.dart
+++ b/desktop/lib/super_tabs/workspace.dart
@@ -221,12 +221,20 @@ class _SuperTabWorkspaceState extends State<SuperTabWorkspace> {
final tab = app.swarms.where((s) => s.id == swarmId).firstOrNull;
if (tab == null) return;
var machine = app.stateOf(agent.machineId);
- if (machine?.agents.any((a) => a.id == agent.harnessId) != true) {
+ final snapshot = controller.snapshot;
+ // Another person's private session never arrives as an invitation: re-reading the machine list for one is wasted.
+ final private =
+ snapshot != null &&
+ agent.machineOwnerId != controller.accountId &&
+ superTabTerminalPrivate(snapshot, agent);
+ if (!private &&
+ machine?.agents.any((a) => a.id == agent.harnessId) != true) {
await app.refreshMachines();
if (!current() || !app.swarms.any((s) => s.id == swarmId)) return;
machine = app.stateOf(agent.machineId);
}
- if (machine?.agents.any((a) => a.id == agent.harnessId) != true) {
+ if (private ||
+ machine?.agents.any((a) => a.id == agent.harnessId) != true) {
throw SuperTabFailure(
'TERMINAL_UNAVAILABLE',
superTabTerminalUnavailable(
diff --git a/desktop/test/super_tab_teammate_terminal_test.dart b/desktop/test/super_tab_teammate_terminal_test.dart
index 6c36682af..5fe2ef3cc 100644
--- a/desktop/test/super_tab_teammate_terminal_test.dart
+++ b/desktop/test/super_tab_teammate_terminal_test.dart
@@ -76,6 +76,7 @@ Machine _teammate(int day) => Machine(
/// A Swarm where River runs on scholes' computer, contributed by scholes, and this account is another member.
Future<(SuperTabLaunchFixture, _Machines, SuperTabController)> _swarm({
Duration lastHeard = const Duration(seconds: 5),
+ bool confidential = false,
}) async {
final f = SuperTabLaunchFixture(discovery: _Discovery());
final api = _Machines();
@@ -105,6 +106,7 @@ Future<(SuperTabLaunchFixture, _Machines, SuperTabController)> _swarm({
'harnessId': 'river-native',
'contributorId': 'scholes',
'machineOwnerId': 'scholes',
+ if (confidential) 'confidential': true,
'configuration': {'engine': 'claude'},
},
];
@@ -182,51 +184,75 @@ void main() {
if (_shots != null) await loadPreviewFonts();
});
group('why a member’s terminal is unavailable', () {
- SuperTabSnapshot snapshot({int? receivedAt, bool ownerListed = true}) =>
- SuperTabSnapshot.fromJson({
- 'version': 1,
- 'id': tabId,
- 'name': 'Pilot',
- 'ownerId': 'owner',
- 'people': [
- {'id': 'owner', 'email': '[email protected]', 'role': 'owner'},
- if (ownerListed)
- {
- 'id': 'scholes',
- 'email': '[email protected]',
- 'role': 'collaborator',
- },
- ],
- 'agents': [
- {
- 'id': 'river',
- 'name': 'Builder',
- 'displayName': 'River',
- 'machineId': 'mate',
- 'harnessId': 'river-native',
- 'contributorId': 'scholes',
- 'machineOwnerId': 'scholes',
- 'configuration': {'engine': 'claude'},
- },
- {
- 'id': 'mine',
- 'name': 'Builder',
- 'machineId': 'm',
- 'harnessId': 'mine-native',
- 'contributorId': 'owner',
- 'configuration': {'engine': 'codex'},
- },
- ],
- 'machines': [
- {
- 'machineId': 'mate',
- 'name': _computer,
- if (receivedAt != null) 'observation': {'receivedAt': receivedAt},
- },
- ],
- 'conversations': const [],
- 'invitations': const [],
- });
+ SuperTabSnapshot snapshot({
+ int? receivedAt,
+ bool ownerListed = true,
+ bool confidential = false,
+ bool lead = false,
+ }) => SuperTabSnapshot.fromJson({
+ 'version': 1,
+ 'id': tabId,
+ 'name': 'Pilot',
+ 'ownerId': 'owner',
+ 'people': [
+ {'id': 'owner', 'email': '[email protected]', 'role': 'owner'},
+ if (ownerListed)
+ {
+ 'id': 'scholes',
+ 'email': '[email protected]',
+ 'role': 'collaborator',
+ },
+ ],
+ 'agents': [
+ {
+ 'id': 'river',
+ 'name': 'Builder',
+ 'displayName': 'River',
+ 'machineId': 'mate',
+ 'harnessId': 'river-native',
+ 'contributorId': 'scholes',
+ 'machineOwnerId': 'scholes',
+ if (confidential) 'confidential': true,
+ 'configuration': {'engine': 'claude'},
+ },
+ {
+ 'id': 'mine',
+ 'name': 'Builder',
+ 'machineId': 'm',
+ 'harnessId': 'mine-native',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'codex'},
+ },
+ ],
+ 'machines': [
+ {
+ 'machineId': 'mate',
+ 'name': _computer,
+ if (receivedAt != null) 'observation': {'receivedAt': receivedAt},
+ },
+ ],
+ if (lead)
+ 'projects': [
+ {
+ 'id': 'p',
+ 'name': 'Pilot',
+ 'ownerId': 'owner',
+ 'leadConversationId': 'pm',
+ },
+ ],
+ 'conversations': [
+ if (lead)
+ {
+ 'id': 'pm',
+ 'projectId': 'p',
+ 'title': 'Product Manager',
+ 'brief': 'Product Manager',
+ 'leadId': 'river',
+ 'agentIds': ['river'],
+ },
+ ],
+ 'invitations': const [],
+ });
final now = DateTime.utc(2026, 10, 23, 4, 11);
String reason(SuperTabSnapshot s, String agentId) =>
superTabTerminalUnavailable(
@@ -257,6 +283,37 @@ void main() {
expect(text, isNot(contains('must be online')));
});
+ test('says a private session’s terminal is only its owner’s to watch, '
+ 'never that the owner must update Harness', () {
+ final heard = now
+ .subtract(const Duration(seconds: 4))
+ .millisecondsSinceEpoch;
+ // River (Ken's Lead, 2026-10-28): a Product Manager reads people's private chats, so no share ever opens it.
+ expect(
+ reason(snapshot(receivedAt: heard, lead: true), 'river'),
+ 'River is the Product Manager and reads private chats, so only '
+ '[email protected] can watch its terminal.',
+ );
+ // Marked confidential by the backend: in a private chat, or a Product Manager before.
+ final private = reason(
+ snapshot(receivedAt: heard, confidential: true),
+ 'river',
+ );
+ expect(
+ private,
+ 'River reads private chats, so only [email protected] can watch '
+ 'its terminal.',
+ );
+ // Its computer offline changes nothing: the terminal stays private once it is back.
+ final silent = now
+ .subtract(const Duration(minutes: 3))
+ .millisecondsSinceEpoch;
+ expect(
+ reason(snapshot(receivedAt: silent, confidential: true), 'river'),
+ private,
+ );
+ });
+
test('says a teammate’s computer is offline only when the Swarm stopped '
'hearing from it', () {
final silent = now
@@ -341,6 +398,26 @@ void main() {
},
);
+ testWidgets(
+ 'a teammate’s private session says only its owner watches it, without '
+ 're-reading the machine list for an invitation that never comes',
+ (tester) async {
+ final (f, api, c) = await _swarm(confidential: true);
+ await _show(tester, f);
+ final reads = api.reads;
+ c.selectTerminal('lead', 'river');
+ await _settle(tester);
+ expect(
+ find.textContaining('only [email protected] can watch'),
+ findsOneWidget,
+ );
+ expect(find.textContaining('update and restart'), findsNothing);
+ expect(find.byType(SharedHarnessPanel), findsNothing);
+ expect(api.reads, reads);
+ await _close(tester, f, c);
+ },
+ );
+
testWidgets(
'a teammate’s read-only terminal stays the same connection across '
'machine-list refreshes, renewed invitations included',