Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(renderer): the LIVE chip and its popover on the node, card, card modal and sidebar
reviewb39b2eac1137
diff --git a/src/renderer/components/LiveLinkChip.surfaces.test.tsx b/src/renderer/components/LiveLinkChip.surfaces.test.tsxnew file mode 100644index 000000000..6df950214--- /dev/null+++ b/src/renderer/components/LiveLinkChip.surfaces.test.tsx@@ -0,0 +1,185 @@+// @vitest-environment jsdom+//+// The LIVE chip on the surfaces that show a node — the kanban card, the card modal header and the+// sessions sidebar row (the canvas node header is pinned at source level by lib/live-link.guard.test.ts:+// TerminalNode is too large to mount here). Each renders the SAME component, and each keeps the+// popover's clicks away from what the surface itself does with a click.+import { act } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import type { ProjectKanban } from '@shared/types'+import type { WatchLinkView } from '@shared/watch-link-types'+import { resetDialogStack } from './dialog-stack'+import { useWatchLinks } from '../state/watchLinks'+import { useAgentStatus } from '../state/agentStatus'+import { useProjects } from '../state/projects'+import { SessionCard } from './kanban/SessionCard'+import { CardModal } from './kanban/CardModal'+import { SessionRow } from './SessionRow'+import type { KanbanSession } from './kanban/KanbanView'+import type { SessionRowVM } from '../lib/sessionList'++vi.mock('../session/session', () => ({+ useSession: () => ({ api: { pty: {}, shell: { openExternal: vi.fn(async () => {}) } } }),+ sessionForProject: () => ({ source: 'local', api: {} })+}))+vi.mock('./kanban/BoardLogPanel', () => ({ BoardLogPanel: () => null }))+vi.mock('./ContextMeter', () => ({ ContextMeter: () => null }))+vi.mock('./kanban/ModalTerminal', () => ({ ModalTerminal: () => <div className="kanban-modal__term" /> }))+vi.mock('../nodes/BrowserSurface', () => ({ BrowserSurface: () => null }))++;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++const link = (over: Partial<WatchLinkView> = {}): WatchLinkView => ({+ linkId: 'L',+ nodeId: 'n1',+ role: 'viewer',+ label: 'Ada',+ title: 'build',+ createdAt: 0,+ expiresAt: Date.now() + 3_600_000,+ url: 'u',+ status: 'live',+ viewers: [{ viewerId: 'v', name: null, joinedAt: 0 }],+ ...over+})+const session: KanbanSession = { id: 'n1', title: 'build', color: '#fff', kind: 'terminal', spawn: {} } as KanbanSession+const row: SessionRowVM = {+ id: 'n1',+ title: 'build',+ color: '#888',+ isAgent: false,+ statusKind: 'unknown',+ stateLabel: 'Unknown',+ unread: false,+ usesContext: false,+ projectId: 'p1'+} as SessionRowVM+const board = { columns: [], assignments: [] } as unknown as ProjectKanban++let host: HTMLDivElement+let root: Root+beforeEach(() => {+ resetDialogStack()+ useWatchLinks.setState({ links: [], byNode: {}, chats: {}, unread: {} })+ useAgentStatus.setState({ byId: {} } as never)+ useProjects.setState({ activeProjectId: 'p1', projects: [] } as never)+ vi.stubGlobal('ResizeObserver', class { observe(): void {} unobserve(): void {} disconnect(): void {} })+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {+ onMarkdownToggle: () => () => {},+ boardLog: { list: async () => [], onChanged: () => () => {} },+ watchLink: { revoke: async () => {}, kick: async () => true, chatHistory: async () => [], sendChat: async () => null },+ clipboard: { writeText: () => {} }+ }+ host = document.createElement('div')+ document.body.append(host)+ root = createRoot(host)+})+afterEach(() => {+ act(() => root.unmount())+ document.body.innerHTML = ''+ resetDialogStack()+ vi.unstubAllGlobals()+})++const render = (ui: React.ReactElement): void => act(() => root.render(ui))+const setLinks = (links: WatchLinkView[]): void => act(() => useWatchLinks.getState().setLinks(links))+const click = (el: Element): void => act(() => void el.dispatchEvent(new MouseEvent('click', { bubbles: true })))+const pop = (): HTMLElement | null => document.querySelector<HTMLElement>('.live-pop')++function card(onOpen = vi.fn()) {+ return (+ <SessionCard+ session={session}+ onOpen={onOpen}+ onDragStart={vi.fn()}+ onDragEnd={vi.fn()}+ onDropAt={vi.fn()}+ onContext={vi.fn()}+ />+ )+}++describe('LIVE chip — kanban card', () => {+ it('a link alone is detail enough to show; no link, no chip and no empty detail row', () => {+ render(card())+ expect(host.querySelector('.live-chip')).toBeNull()+ expect(host.querySelector('.kanban-card__detail')).toBeNull()+ setLinks([link()])+ const chip = host.querySelector('.kanban-card__detail .live-chip.kanban-card__live')+ expect(chip?.textContent).toBe('LIVE · 1')+ setLinks([])+ expect(host.querySelector('.kanban-card__detail')).toBeNull()+ })++ it('opening the popover and clicking inside it never opens the card', () => {+ const onOpen = vi.fn()+ render(card(onOpen))+ setLinks([link()])+ click(host.querySelector('.live-chip')!)+ expect(pop()).not.toBeNull()+ click(pop()!)+ click(document.querySelector('.live-pop__scrim')!)+ expect(onOpen).not.toHaveBeenCalled()+ })+})++describe('LIVE chip — card modal header', () => {+ it('shows in the header, and Escape closes the popover, not the modal', () => {+ const onClose = vi.fn()+ render(+ <CardModal+ session={session}+ columnTitle="Doing"+ board={board}+ onChangeBoard={vi.fn()}+ onClose={onClose}+ onOpenCanvas={vi.fn()}+ onRename={vi.fn()}+ onEditSticky={vi.fn()}+ onSetIcon={vi.fn()}+ onBrowserNav={vi.fn()}+ />+ )+ expect(document.querySelector('.kanban-modal__header .live-chip')).toBeNull()+ setLinks([link({ status: 'reconnecting' })])+ const chip = document.querySelector('.kanban-modal__header .live-chip.kanban-modal__live')!+ expect(chip.textContent).toBe('LIVE · offline')+ click(chip)+ expect(pop()).not.toBeNull()+ act(() => void window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })))+ expect(pop()).toBeNull()+ expect(onClose).not.toHaveBeenCalled()+ // With the popover gone, Escape is the modal's again.+ act(() => void window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })))+ expect(onClose).toHaveBeenCalledTimes(1)+ })+})++describe('LIVE chip — sessions sidebar row', () => {+ it('shows on the row; a click or a middle press in the popover neither travels nor ends the session', () => {+ const onClick = vi.fn()+ const onClose = vi.fn()+ render(+ <SessionRow+ row={row}+ onClick={onClick}+ onClose={onClose}+ onRename={vi.fn()}+ onAiName={vi.fn()}+ onContextMenu={vi.fn()}+ onDragStart={vi.fn()}+ onDragEnd={vi.fn()}+ />+ )+ expect(host.querySelector('.live-chip')).toBeNull()+ setLinks([link({ status: 'refused' })])+ const chip = host.querySelector('.ss-row .live-chip.ss-live')!+ expect(chip.textContent).toBe('LIVE · refused')+ click(chip)+ act(() => void pop()!.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, button: 1 })))+ click(pop()!)+ expect(onClick).not.toHaveBeenCalled()+ expect(onClose).not.toHaveBeenCalled()+ })+})diff --git a/src/renderer/components/LiveLinkChip.test.tsx b/src/renderer/components/LiveLinkChip.test.tsxnew file mode 100644index 000000000..0ea99fdce--- /dev/null+++ b/src/renderer/components/LiveLinkChip.test.tsx@@ -0,0 +1,328 @@+// @vitest-environment jsdom+import { act } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import { renderToStaticMarkup } from 'react-dom/server'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import type { WatchChatMessage, WatchLinkView } from '@shared/watch-link-types'+import { LiveLinkChip } from './LiveLinkChip'+import { useWatchLinks } from '../state/watchLinks'+import { useBoardLog } from '../state/boardLog'+import { useProjects } from '../state/projects'+import { popDialog, pushDialog, resetDialogStack } from './dialog-stack'+import { KICK_NOTE, STOP_FAILED_MESSAGE } from '../lib/liveLink'++const boardApi = { tag: 'local-api' }+vi.mock('../session/session', () => ({+ sessionForProject: (id: string) => ({ source: id === 'p-relay' ? 'relay' : 'local', api: boardApi })+}))++;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++const link = (over: Partial<WatchLinkView> = {}): WatchLinkView => ({+ linkId: 'L',+ nodeId: 'n1',+ role: 'viewer',+ label: 'Ada',+ title: 'build',+ createdAt: 0,+ expiresAt: Date.now() + 42 * 60_000 + 30_000,+ url: 'https://nodeterm.dev/s/L#1.secret',+ status: 'live',+ viewers: [],+ ...over+})+const msg = (id: string, over: Partial<WatchChatMessage> = {}): WatchChatMessage => ({+ id,+ name: 'Bob',+ text: 'hello',+ at: Number(id),+ from: 'viewer',+ ...over+})++const api = {+ revoke: vi.fn(async (_id: string) => {}),+ kick: vi.fn(async (_l: string, _v: string) => true),+ sendChat: vi.fn(async (_l: string, _t: string) => null),+ chatHistory: vi.fn(async (_l: string): Promise<WatchChatMessage[]> => [])+}+const writeText = vi.fn()++let host: HTMLDivElement+let root: Root+beforeEach(() => {+ resetDialogStack()+ useWatchLinks.setState({ links: [], byNode: {}, chats: {}, unread: {} })+ useProjects.setState({ projects: [] } as never)+ vi.stubGlobal('ResizeObserver', class { observe(): void {} unobserve(): void {} disconnect(): void {} })+ for (const f of Object.values(api)) f.mockClear()+ api.revoke.mockImplementation(async () => {})+ writeText.mockClear()+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = { watchLink: api, clipboard: { writeText } }+ host = document.createElement('div')+ document.body.append(host)+ root = createRoot(host)+})+afterEach(() => {+ act(() => root.unmount())+ document.body.innerHTML = ''+ resetDialogStack()+ vi.unstubAllGlobals()+})++const render = (ui: React.ReactElement): void => act(() => root.render(ui))+const chip = (): HTMLButtonElement | null => host.querySelector<HTMLButtonElement>('.live-chip')+const pop = (): HTMLElement | null => document.querySelector<HTMLElement>('.live-pop')+const click = (el: Element): void => act(() => void el.dispatchEvent(new MouseEvent('click', { bubbles: true })))+const setLinks = (links: WatchLinkView[]): void => act(() => useWatchLinks.getState().setLinks(links))+const button = (label: string): HTMLButtonElement =>+ [...document.querySelectorAll<HTMLButtonElement>('.live-pop button')].find((b) => b.textContent === label)!+const flush = (): Promise<void> => act(async () => {})++describe('LiveLinkChip', () => {+ it('renders nothing for a node with no link', () => {+ expect(renderToStaticMarkup(<LiveLinkChip nodeId="n1" />)).toBe('')+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ nodeId: 'other' })])+ expect(host.innerHTML).toBe('')+ })++ // Rendered in the DOM, not to a string: zustand answers a server render from the store's INITIAL+ // state (empty), so `renderToStaticMarkup` can never show a link.+ it('shows LIVE with the viewer count, as a no-drag button', () => {+ render(<LiveLinkChip nodeId="n1" className="extra" />)+ setLinks([link({ viewers: [{ viewerId: 'v', name: null, joinedAt: 0 }] })])+ const c = chip()!+ expect(c.tagName).toBe('BUTTON')+ expect(c.textContent).toBe('LIVE · 1')+ expect(c.className).toContain('nodrag')+ expect(c.className).toContain('live-chip--live')+ expect(c.className).toContain('extra')+ expect(c.title).toBe('This terminal is shared by a live link — 1 watching.')+ })++ it('follows the store: offline, refused, the unread dot, and gone again', () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ status: 'reconnecting' })])+ expect(chip()!.className).toContain('live-chip--offline')+ expect(chip()!.textContent).toBe('LIVE · offline')+ setLinks([link({ status: 'refused' })])+ expect(chip()!.className).toContain('live-chip--refused')+ expect(host.querySelector('.live-chip__unread')).toBeNull()+ act(() => useWatchLinks.getState().addChat('L', msg('1')))+ expect(host.querySelector('.live-chip__unread')).not.toBeNull()+ expect(chip()!.getAttribute('aria-label')).toBe('LIVE · refused, 1 unread chat message')+ setLinks([])+ expect(chip()).toBeNull()+ })+})++describe('LiveLinkPopover', () => {+ it('opens on click with role, time, the controls and the kick note', () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ viewers: [{ viewerId: 'v1', name: null, joinedAt: 0 }, { viewerId: 'v2', name: 'Cy', joinedAt: 0 }] })])+ click(chip()!)+ const p = pop()!+ expect(p.textContent).toContain('Can watch')+ expect(p.textContent).toContain('ends in 42 min')+ expect(p.textContent).toContain('Shown to viewers as Ada')+ expect([...p.querySelectorAll('.live-pop__who')].map((e) => e.textContent)).toEqual(['Viewer 1', 'Cy'])+ expect(p.textContent).toContain(KICK_NOTE)+ // A live link needs no status line; a viewer link has no chat.+ expect(p.querySelector('.live-pop__status')).toBeNull()+ expect(p.querySelector('.live-pop__chat')).toBeNull()+ click(button('Copy link'))+ expect(writeText).toHaveBeenCalledWith('https://nodeterm.dev/s/L#1.secret')+ click(p.querySelectorAll<HTMLButtonElement>('.live-pop__kick')[1])+ expect(api.kick).toHaveBeenCalledWith('L', 'v2')+ })++ it('takes the keyboard focus while open and gives it back to the chip', () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link()])+ act(() => chip()!.focus())+ click(chip()!)+ expect(document.activeElement).toBe(pop())+ act(() => void window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })))+ expect(document.activeElement).toBe(chip())+ })++ it('explains a link that is not live (H9)', () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ status: 'refused' })])+ click(chip()!)+ expect(pop()!.querySelector('.live-pop__status')!.textContent).toContain("won't host this link")+ })++ it('Stop sharing revokes; a stop that did not reach nodeterm says so (H23)', async () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link()])+ click(chip()!)+ api.revoke.mockImplementationOnce(async () => {+ throw new Error('socket down')+ })+ click(button('Stop sharing'))+ await flush()+ expect(api.revoke).toHaveBeenCalledWith('L')+ expect(pop()!.querySelector('[role="alert"]')!.textContent).toBe(STOP_FAILED_MESSAGE)+ // The state push that removes the link closes the popover, and it stays closed.+ setLinks([])+ expect(pop()).toBeNull()+ setLinks([link({ linkId: 'M' })])+ expect(chip()).not.toBeNull()+ expect(pop()).toBeNull()+ })++ it('Escape closes it, and only when it is the top dialog', () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link()])+ click(chip()!)+ // A dialog raised above it owns the key.+ pushDialog('above')+ act(() => void window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })))+ expect(pop()).not.toBeNull()+ popDialog('above')+ act(() => void window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })))+ expect(pop()).toBeNull()+ })++ it('takes the Escape before the canvas\'s own window listeners see it', () => {+ const globalKeys = vi.fn()+ window.addEventListener('keydown', globalKeys)+ try {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link()])+ click(chip()!)+ act(() => void document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true })))+ expect(pop()).toBeNull()+ expect(globalKeys).not.toHaveBeenCalled()+ } finally {+ window.removeEventListener('keydown', globalKeys)+ }+ })++ it('a click or middle press inside the popover never reaches the surface it sits in', () => {+ const onClick = vi.fn()+ const onMouseDown = vi.fn()+ render(+ <div onClick={onClick} onMouseDown={onMouseDown}>+ <LiveLinkChip nodeId="n1" />+ </div>+ )+ setLinks([link()])+ click(chip()!)+ act(() => void pop()!.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, button: 1 })))+ click(pop()!)+ click(document.querySelector('.live-pop__scrim')!)+ expect(onClick).not.toHaveBeenCalled()+ expect(onMouseDown).not.toHaveBeenCalled()+ expect(pop()).toBeNull()+ })+})++describe('LiveLinkPopover — Commenter chat', () => {+ it('renders every viewer string as text, never as markup', () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ role: 'commenter', label: '<b>Ada</b>', viewers: [{ viewerId: 'v', name: '<i>Eve</i>', joinedAt: 0 }] })])+ act(() => useWatchLinks.getState().addChat('L', msg('1', { name: '<u>Eve</u>', text: '<img src=x onerror=alert(1)>' })))+ click(chip()!)+ const p = pop()!+ expect(p.querySelector('img, b, i, u')).toBeNull()+ expect(p.querySelector('.live-pop__text')!.textContent).toBe('<img src=x onerror=alert(1)>')+ expect(p.querySelector('.live-pop__msg .live-pop__who')!.textContent).toBe('<u>Eve</u>')+ expect(p.querySelector('.live-pop__viewers .live-pop__who')!.textContent).toBe('<i>Eve</i>')+ expect(p.textContent).toContain('Shown to viewers as <b>Ada</b>')+ expect(p.textContent).toContain('(link viewer)')+ })++ it('strips bidi controls from what viewers wrote', () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ role: 'commenter' })])+ act(() => useWatchLinks.getState().addChat('L', msg('1', { name: 'Eve', text: 'ab' })))+ click(chip()!)+ expect(pop()!.querySelector('.live-pop__who')!.textContent).toBe('Eve')+ expect(pop()!.querySelector('.live-pop__text')!.textContent).toBe('ab')+ })++ it('opening marks the link read, and so does every message that lands while it is open (H21)', async () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ role: 'commenter' })])+ act(() => useWatchLinks.getState().addChat('L', msg('1')))+ expect(useWatchLinks.getState().unread.L).toBe(1)+ click(chip()!)+ await flush()+ expect(useWatchLinks.getState().unread.L).toBe(0)+ expect(api.chatHistory).toHaveBeenCalledWith('L')+ act(() => useWatchLinks.getState().addChat('L', msg('2')))+ expect(useWatchLinks.getState().unread.L).toBe(0)+ expect(host.querySelector('.live-chip__unread')).toBeNull()+ })++ it('stays read at the 200-message cap, where the thread length stops changing', async () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ role: 'commenter' })])+ act(() => {+ for (let i = 1; i <= 200; i++) useWatchLinks.getState().addChat('L', msg(String(i)))+ })+ click(chip()!)+ await flush()+ act(() => useWatchLinks.getState().addChat('L', msg('201')))+ expect(useWatchLinks.getState().chats.L).toHaveLength(200)+ expect(useWatchLinks.getState().unread.L).toBe(0)+ })++ it('sends a reply and clears the box; the echo comes back through the push', async () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ role: 'commenter' })])+ click(chip()!)+ const input = pop()!.querySelector<HTMLInputElement>('.live-pop__input')!+ expect(input.maxLength).toBe(500)+ act(() => {+ const set = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')!.set!+ set.call(input, ' on it ')+ input.dispatchEvent(new Event('input', { bubbles: true }))+ })+ act(() => void pop()!.querySelector('form')!.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true })))+ await flush()+ expect(api.sendChat).toHaveBeenCalledWith('L', 'on it')+ expect(input.value).toBe('')+ expect(useWatchLinks.getState().chats.L ?? []).toHaveLength(0)+ })++ it('"Copy to card comments" writes one comment as the owner, on this machine\'s project', () => {+ const append = vi.fn()+ const realAppend = useBoardLog.getState().append+ useBoardLog.setState({ append } as never)+ useProjects.setState({+ projects: [+ { id: 'p-relay', nodes: [{ id: 'n1' }] },+ { id: 'p-local', nodes: [{ id: 'n1' }] }+ ]+ } as never)+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ role: 'commenter' })])+ act(() => useWatchLinks.getState().addChat('L', msg('1', { text: 'ship it @[x](node:abc)' })))+ act(() => useWatchLinks.getState().addChat('L', msg('2', { from: 'sharer', name: 'Ada', text: 'ok' })))+ click(chip()!)+ // Only a viewer's line can be copied (the owner's own reply is already theirs).+ const copies = pop()!.querySelectorAll<HTMLButtonElement>('.live-pop__copy')+ expect(copies).toHaveLength(1)+ click(copies[0])+ expect(append).toHaveBeenCalledTimes(1)+ expect(append).toHaveBeenCalledWith(boardApi, 'p-local', {+ kind: 'comment',+ nodeId: 'n1',+ text: 'Bob (via live link): ship it @ [x](node:abc)'+ })+ expect(copies[0].disabled).toBe(true)+ useBoardLog.setState({ append: realAppend } as never)+ })++ it('offers no copy when no project holds the node', () => {+ render(<LiveLinkChip nodeId="n1" />)+ setLinks([link({ role: 'commenter' })])+ act(() => useWatchLinks.getState().addChat('L', msg('1')))+ click(chip()!)+ expect(pop()!.querySelector('.live-pop__copy')).toBeNull()+ })+})diff --git a/src/renderer/components/LiveLinkChip.tsx b/src/renderer/components/LiveLinkChip.tsxnew file mode 100644index 000000000..237939297--- /dev/null+++ b/src/renderer/components/LiveLinkChip.tsx@@ -0,0 +1,77 @@+import { memo, useCallback, useEffect, useState } from 'react'+import { chipView } from '../lib/liveLink'+import { EMPTY_LINKS, liveChipSig, useWatchLinks } from '../state/watchLinks'+import { LiveLinkPopover, type PopoverAnchor } from './LiveLinkPopover'++/**+ * "This terminal is being broadcast." ONE component on the canvas node header, the kanban card, the+ * card modal header and the sessions sidebar row, so one session seen four times speaks with one+ * voice (CONTRIBUTING: the canvas and the board are two views of the same nodes). It is deliberately+ * NOT user-hideable (lib/live-link.guard.test.ts): it is the owner's signal that someone may be+ * watching this terminal right now.+ *+ * It subscribes to a PRIMITIVE signature of its own node's links (`liveChipSig`), never to a map,+ * so a push about another node's link — or any hook event — re-renders nothing here.+ */+export const LiveLinkChip = memo(function LiveLinkChip({+ nodeId,+ className+}: {+ nodeId: string+ className?: string+}): React.JSX.Element | null {+ const sig = useWatchLinks((s) => liveChipSig(s, nodeId))+ const [anchor, setAnchor] = useState<PopoverAnchor | null>(null)+ const close = useCallback(() => setAnchor(null), [])+ // The last link went away while the popover was open: forget it was open, or the NEXT link on+ // this node would bring the popover back by itself.+ useEffect(() => {+ if (!sig) setAnchor(null)+ }, [sig])+ if (!sig) return null+ const s = useWatchLinks.getState()+ const links = s.byNode[nodeId] ?? EMPTY_LINKS+ const view = chipView(links)+ const unread = links.reduce((n, l) => n + (s.unread[l.linkId] ?? 0), 0)+ const stop = (e: React.SyntheticEvent): void => e.stopPropagation()+ return (+ // The chip sits INSIDE a clickable card, a draggable node header and a sessions row that+ // closes on a middle click, and the popover is a body portal whose React events still bubble+ // through this tree. Every event is stopped here, or a click in the popover would also open the+ // card, a middle click would end the session, and a text drag would start a card drag.+ <span+ className="live-chip-wrap"+ onClick={stop}+ onDoubleClick={stop}+ onMouseDown={stop}+ onMouseUp={stop}+ onPointerDown={stop}+ onPointerUp={stop}+ onContextMenu={stop}+ onKeyDown={stop}+ onKeyUp={stop}+ onDragStart={stop}+ onDragOver={stop}+ onDrop={stop}+ onWheel={stop}+ >+ <button+ type="button"+ className={`live-chip live-chip--${view.tone} nodrag${className ? ` ${className}` : ''}`}+ title={view.title}+ aria-label={unread > 0 ? `${view.label}, ${unread} unread chat ${unread === 1 ? 'message' : 'messages'}` : view.label}+ aria-haspopup="dialog"+ aria-expanded={!!anchor}+ onClick={(e) => {+ const r = e.currentTarget.getBoundingClientRect()+ setAnchor((cur) => (cur ? null : { top: r.top, bottom: r.bottom, left: r.left }))+ }}+ >+ <span className="live-chip__dot" aria-hidden="true" />+ {view.label}+ {unread > 0 && <span className="live-chip__unread" aria-hidden="true" />}+ </button>+ {anchor && <LiveLinkPopover nodeId={nodeId} anchor={anchor} onClose={close} />}+ </span>+ )+})diff --git a/src/renderer/components/LiveLinkPopover.tsx b/src/renderer/components/LiveLinkPopover.tsxnew file mode 100644index 000000000..3da70616e--- /dev/null+++ b/src/renderer/components/LiveLinkPopover.tsx@@ -0,0 +1,315 @@+import { memo, useEffect, useRef, useState } from 'react'+import { createPortal } from 'react-dom'+import type { NodeTerminalApi } from '@shared/types'+import type { WatchLinkView } from '@shared/watch-link-types'+import { stripBidiControls } from '@shared/watch-link-types'+import { CHAT_TEXT_MAX, type WatchChatMessage } from '@shared/watch-link/protocol'+import { useDialogStack } from './dialog-stack'+import { useMenuFlip } from '../ui/useMenuFlip'+import {+ commentFromChat,+ formatClock,+ formatRemaining,+ KICK_NOTE,+ ROLE_LABEL,+ statusLine,+ STOP_FAILED_MESSAGE,+ viewerName+} from '../lib/liveLink'+import { thisMachine } from '../lib/machineName'+import { EMPTY_LINKS, useWatchLinks } from '../state/watchLinks'+import { useBoardLog } from '../state/boardLog'+import { useProjects } from '../state/projects'+import { sessionForProject } from '../session/session'++/** Where the chip was when it was clicked (screen coordinates). */+export interface PopoverAnchor {+ top: number+ bottom: number+ left: number+}++const EMPTY_CHAT: WatchChatMessage[] = []++function useNow(ms: number): number {+ const [now, setNow] = useState(() => Date.now())+ useEffect(() => {+ const t = setInterval(() => setNow(Date.now()), ms)+ return () => clearInterval(t)+ }, [ms])+ return now+}++/**+ * The board a copied chat line goes to: the first project on THIS machine that holds the node. A+ * relay tab's project can carry the same node id (a git-shared canvas opened here and over the+ * relay), and its board belongs to the other machine, so it is skipped.+ */+function commentTarget(nodeId: string): { projectId: string; api: NodeTerminalApi } | null {+ for (const p of useProjects.getState().projects) {+ if (!p.nodes.some((n) => n.id === nodeId)) continue+ const session = sessionForProject(p.id)+ if (session.source === 'relay') continue+ return { projectId: p.id, api: session.api }+ }+ return null+}++/**+ * Per-link controls for one node: copy, stop, the viewer list with Kick, and — for a Commenter+ * link — the thread with a reply box and "Copy to card comments" (the owner's explicit act; nothing+ * a viewer writes is ever stored automatically, spec D2). Every string someone else wrote (label,+ * title, viewer names and chat) is rendered as React TEXT, bidi-stripped — never as HTML.+ *+ * It is a modal in the dialog stack, so Escape (and the board's keys) belong to it while it is+ * up — the card modal it can open over stands aside (`isTopDialog`).+ */+export function LiveLinkPopover({+ nodeId,+ anchor,+ onClose+}: {+ nodeId: string+ anchor: PopoverAnchor+ onClose: () => void+}): React.JSX.Element {+ const links = useWatchLinks((s) => s.byNode[nodeId] ?? EMPTY_LINKS)+ const isTop = useDialogStack()+ const now = useNow(30_000)+ // Below the chip; above it when there is no room below (the dropdown case of useMenuFlip).+ const flip = useMenuFlip(anchor.bottom + 6, anchor.left, anchor.top - 6)+ useEffect(() => {+ const onKey = (e: KeyboardEvent): void => {+ if (e.key !== 'Escape' || !isTop()) return+ e.preventDefault()+ e.stopPropagation()+ onClose()+ }+ // Capture phase: beat the canvas/global keydown listeners (and xterm) to the Escape.+ window.addEventListener('keydown', onKey, true)+ return () => window.removeEventListener('keydown', onKey, true)+ }, [isTop, onClose])+ useEffect(() => {+ if (links.length === 0) onClose()+ }, [links.length, onClose])+ // Keyboard users land IN the popover (a body portal, so Tab from the chip would never reach it),+ // and go back to the chip when it closes.+ const popRef = flip.ref+ useEffect(() => {+ const before = document.activeElement instanceof HTMLElement ? document.activeElement : null+ popRef.current?.focus({ preventScroll: true })+ return () => {+ if (before?.isConnected) before.focus({ preventScroll: true })+ }+ }, [popRef])+ return createPortal(+ <>+ <div+ className="live-pop__scrim"+ onClick={onClose}+ onContextMenu={(e) => {+ e.preventDefault()+ onClose()+ }}+ />+ <div+ ref={flip.ref}+ className="live-pop nodrag nowheel"+ style={{ top: flip.top, left: flip.left }}+ role="dialog"+ aria-label="Live links"+ tabIndex={-1}+ >+ {links.map((l) => (+ <LinkBlock key={l.linkId} link={l} now={now} nodeId={nodeId} />+ ))}+ </div>+ </>,+ document.body+ )+}++const LinkBlock = memo(function LinkBlock({+ link,+ now,+ nodeId+}: {+ link: WatchLinkView+ now: number+ nodeId: string+}): React.JSX.Element {+ const api = window.nodeTerminal.watchLink+ const [copied, setCopied] = useState(false)+ const [error, setError] = useState<string | null>(null)+ const status = statusLine(link.status)+ useEffect(() => {+ if (!copied) return+ const t = setTimeout(() => setCopied(false), 1500)+ return () => clearTimeout(t)+ }, [copied])+ return (+ <section className="live-pop__link" data-link-id={link.linkId}>+ <header className="live-pop__head">+ <span className="live-pop__role">{ROLE_LABEL[link.role]}</span>+ <span className="live-pop__time">{formatRemaining(link.expiresAt, now)}</span>+ </header>+ <p className="live-pop__muted live-pop__label">+ Shown to viewers as {stripBidiControls(link.label)}+ </p>+ {status && (+ <p className={`live-pop__status live-pop__status--${link.status}`} role="status">+ {status}+ </p>+ )}+ <div className="live-pop__actions">+ <button+ type="button"+ className="confirm__btn live-pop__btn"+ onClick={() => {+ window.nodeTerminal.clipboard.writeText(link.url)+ setCopied(true)+ }}+ >+ {copied ? 'Copied!' : 'Copy link'}+ </button>+ <button+ type="button"+ className="confirm__btn danger live-pop__btn"+ onClick={() => {+ setError(null)+ // Desktop: the local stop is immediate and the state push removes this block. The+ // Server Edition rejects when its socket is down — say so instead of looking stopped.+ api.revoke(link.linkId).catch(() => setError(STOP_FAILED_MESSAGE))+ }}+ >+ Stop sharing+ </button>+ </div>+ {error && (+ <p className="live-pop__error" role="alert">+ {error}+ </p>+ )}+ <div className="live-pop__viewers">+ {link.viewers.length === 0 ? (+ <p className="live-pop__muted">Nobody is watching right now.</p>+ ) : (+ <>+ <ul>+ {link.viewers.map((v, i) => (+ <li key={v.viewerId}>+ <span className="live-pop__who">{viewerName(v, i)}</span>+ <span className="live-pop__muted">since {formatClock(v.joinedAt)}</span>+ <button+ type="button"+ className="confirm__btn live-pop__btn live-pop__kick"+ title={KICK_NOTE}+ onClick={() => void api.kick(link.linkId, v.viewerId).catch(() => {})}+ >+ Kick+ </button>+ </li>+ ))}+ </ul>+ <p className="live-pop__muted live-pop__note">{KICK_NOTE}</p>+ </>+ )}+ </div>+ {link.role === 'commenter' && <ChatThread linkId={link.linkId} nodeId={nodeId} />}+ </section>+ )+})++function ChatThread({ linkId, nodeId }: { linkId: string; nodeId: string }): React.JSX.Element {+ const api = window.nodeTerminal.watchLink+ const chat = useWatchLinks((s) => s.chats[linkId] ?? EMPTY_CHAT)+ const onBoard = useProjects((s) => s.projects.some((p) => p.nodes.some((n) => n.id === nodeId)))+ const [draft, setDraft] = useState('')+ const [copiedIds, setCopiedIds] = useState<ReadonlySet<string>>(() => new Set())+ const [copyError, setCopyError] = useState(false)+ const threadRef = useRef<HTMLOListElement>(null)+ // Core keeps the thread in memory; ask for it once when the thread opens (a reload, or messages+ // that arrived before this renderer subscribed). The store merges it with what was pushed.+ useEffect(() => {+ void api.chatHistory(linkId).then(+ (m) => useWatchLinks.getState().setChat(linkId, m),+ () => {}+ )+ }, [api, linkId])+ // Open = read: on open, and again for every message that lands while it is open (H21). Keyed on+ // the LAST message's id, not the length — at the 200-message cap the length stops changing.+ const lastId = chat.length > 0 ? chat[chat.length - 1].id : ''+ useEffect(() => {+ useWatchLinks.getState().markRead(linkId)+ const el = threadRef.current+ if (el) el.scrollTop = el.scrollHeight+ }, [linkId, lastId])+ return (+ <div className="live-pop__chat">+ {chat.length === 0 ? (+ <p className="live-pop__muted">No messages yet. Viewers of this link can chat with you here.</p>+ ) : (+ <ol className="live-pop__thread" ref={threadRef}>+ {chat.map((m) => (+ <li key={m.id} className={`live-pop__msg${m.from === 'sharer' ? ' live-pop__mine' : ''}`}>+ <span className="live-pop__who">{stripBidiControls(m.name)}</span>{' '}+ <span className="live-pop__muted">({m.from === 'sharer' ? 'sharer' : 'link viewer'})</span>+ <span className="live-pop__text">{stripBidiControls(m.text)}</span>+ {onBoard && m.from === 'viewer' && (+ <button+ type="button"+ className="live-pop__copy"+ disabled={copiedIds.has(m.id)}+ onClick={() => {+ const target = commentTarget(nodeId)+ if (!target) {+ setCopyError(true)+ return+ }+ setCopyError(false)+ useBoardLog.getState().append(target.api, target.projectId, {+ kind: 'comment',+ nodeId,+ text: commentFromChat(m)+ })+ setCopiedIds((s) => new Set(s).add(m.id))+ }}+ >+ {copiedIds.has(m.id) ? 'Copied to card comments' : 'Copy to card comments'}+ </button>+ )}+ </li>+ ))}+ </ol>+ )}+ {copyError && (+ <p className="live-pop__error" role="alert">+ No project on {thisMachine()} holds this terminal, so there is no card to comment on.+ </p>+ )}+ <form+ className="live-pop__reply"+ onSubmit={(e) => {+ e.preventDefault()+ const text = draft.trim()+ if (!text) return+ setDraft('')+ // The reply comes back through the chat push (core echoes the owner's own message).+ api.sendChat(linkId, text).catch(() => setDraft((d) => d || text))+ }}+ >+ <input+ className="confirm__input live-pop__input"+ value={draft}+ maxLength={CHAT_TEXT_MAX}+ placeholder="Reply to viewers…"+ aria-label="Reply to viewers"+ onChange={(e) => setDraft(e.target.value)}+ />+ <button type="submit" className="confirm__btn live-pop__btn" disabled={!draft.trim()}>+ Send+ </button>+ </form>+ </div>+ )+}diff --git a/src/renderer/components/SessionRow.tsx b/src/renderer/components/SessionRow.tsxindex 1884aa7cb..84ddf9f28 100644--- a/src/renderer/components/SessionRow.tsx+++ b/src/renderer/components/SessionRow.tsx@@ -1,5 +1,6 @@import { useState } from 'react'import { AccountChip, useAccountChip } from './AccountChip'+import { LiveLinkChip } from './LiveLinkChip'import { IconBellFilled, IconCircleCheck, IconClose } from './icons'import { NodeIconView } from './NodeIcon'import { ProjectGlyph } from './ProjectGlyph'@@ -156,6 +157,7 @@ export function SessionRow({</span>)}<AccountChip chip={accountChip} className="ss-account" />+ <LiveLinkChip nodeId={row.id} className="ss-live" />{row.loop && (<span className="ss-loop">{row.loop.kind} · {row.loop.count}diff --git a/src/renderer/components/kanban/CardModal.tsx b/src/renderer/components/kanban/CardModal.tsxindex 517433c3e..13f9952c0 100644--- a/src/renderer/components/kanban/CardModal.tsx+++ b/src/renderer/components/kanban/CardModal.tsx@@ -19,6 +19,7 @@ import type { NodeIcon } from '@shared/node-icon'import { ContextMeter } from '../ContextMeter'import { isRemoteSessionNode } from '@shared/worktree'import { AccountChip, useAccountChip } from '../AccountChip'+import { LiveLinkChip } from '../LiveLinkChip'import { IssueRefChip } from '../IssueRefChip'import { TeamProgressChip } from '../TeamProgressChip'import type { TeamStation } from '../../lib/teamProgress'@@ -379,6 +380,7 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,</span>)}{isTerminal && <AccountChip chip={accountChip} />}+ {isTerminal && <LiveLinkChip nodeId={session.id} className="kanban-modal__live" />}{/* The driving chip, so a user watching a browser card THROUGH the modal is notdriving-blind. The lease is keyed by node id (not by webview object), so this showswhen the node is being driven even though the drive lands on the CANVAS webview, notdiff --git a/src/renderer/components/kanban/SessionCard.tsx b/src/renderer/components/kanban/SessionCard.tsxindex 4a4c92320..b853a1ca5 100644--- a/src/renderer/components/kanban/SessionCard.tsx+++ b/src/renderer/components/kanban/SessionCard.tsx@@ -2,6 +2,8 @@ import { memo, useState } from 'react'import type { KanbanCardMeta, KanbanColumnCategory, KanbanLabel, KanbanPriority } from '@shared/types'import { useAgentStatus } from '../../state/agentStatus'import { AccountChip, useAccountChip } from '../AccountChip'+import { LiveLinkChip } from '../LiveLinkChip'+import { useWatchLinks } from '../../state/watchLinks'import { ContextMeter } from '../ContextMeter'import { isRemoteSessionNode } from '@shared/worktree'import { NodeIconView } from '../NodeIcon'@@ -87,10 +89,13 @@ export const SessionCard = memo(function SessionCard({? status.session: undefinedconst priority = meta?.priority+ // A live link counts as detail: "this terminal is being broadcast" must show on the card whatever+ // else it has to say (a primitive selector — see LiveLinkChip).+ const hasLiveLink = useWatchLinks((s) => session.kind === 'terminal' && (s.byNode[session.id]?.length ?? 0) > 0)// The account chip counts as detail in its own right: a card whose only thing to say is "this// one is on the other Claude login" is exactly the card that must say it.const hasDetail =- !!status?.sessionId || !!sessionName || !!accountChip || stickyPreview.includes('\n')+ !!status?.sessionId || !!sessionName || !!accountChip || hasLiveLink || stickyPreview.includes('\n')return (<divclassName={`kanban-card kanban-card--session${dragging ? ' kanban-card--dragging' : ''}${@@ -219,6 +224,7 @@ export const SessionCard = memo(function SessionCard({<><ContextMeter sessionId={status?.sessionId ?? null} nodeId={session.id} remote={isRemoteSessionNode(session.spawn)} agentId={session.agentId ?? session.spawn.agentId ?? status?.agentId} /><AccountChip chip={accountChip} />+ <LiveLinkChip nodeId={session.id} className="kanban-card__live" />{sessionName && (<span className="kanban-card__session" title={sessionName}>{sessionName}diff --git a/src/renderer/lib/live-link.guard.test.ts b/src/renderer/lib/live-link.guard.test.tsnew file mode 100644index 000000000..04ea8c9ed--- /dev/null+++ b/src/renderer/lib/live-link.guard.test.ts@@ -0,0 +1,78 @@+// Live links: rules no single unit can see. Each is a way a live link turns into a leak, or into a+// broadcast the owner cannot see.+//+// Renderer-side on purpose: importing `ui-visibility` from here does not reach across the core+// boundary. Source-level where the rule is about WHERE something is written.+import { describe, it, expect } from 'vitest'+import { readFileSync } from 'node:fs'+import { join } from 'node:path'+import { HIDEABLE_HEADER_BUTTONS, HIDEABLE_MENU_ITEMS } from './ui-visibility'++const root = join(__dirname, '..', '..', '..')+const read = (p: string): string => readFileSync(join(root, p), 'utf8').replace(/\r\n/g, '\n')+/** From a top-level `export interface X {` to its closing `}` at column 0. */+function block(src: string, header: RegExp): string {+ const m = header.exec(src)+ if (!m) throw new Error(`not found: ${header}`)+ const end = src.indexOf('\n}\n', m.index)+ if (end === -1) throw new Error(`no end for: ${header}`)+ return src.slice(m.index, end)+}++const LINK_STATE = /watchLink|liveLink|live[ -]link|watch[-_]link/i++/** The four surfaces that show a node, and so the chip (CONTRIBUTING: one session, one voice). */+const SURFACES = [+ 'src/renderer/nodes/TerminalNode.tsx',+ 'src/renderer/components/kanban/SessionCard.tsx',+ 'src/renderer/components/kanban/CardModal.tsx',+ 'src/renderer/components/SessionRow.tsx'+]++describe('live-link guards', () => {+ it('no canvas content type carries link state (canvas sync and the canvas authority would publish it)', () => {+ const types = read('src/shared/types.ts')+ for (const h of [/export interface CanvasNodeState\b/, /export interface ProjectKanban\b/, /export interface Project\b/]) {+ expect(block(types, h)).not.toMatch(LINK_STATE)+ }+ for (const f of ['src/shared/canvas-mutations.ts', 'src/shared/canvas-content.ts']) {+ expect(read(f)).not.toMatch(LINK_STATE)+ }+ })++ it('the renderer serializers and the projects store never read the live-link store', () => {+ for (const f of ['src/renderer/state/workspace.ts', 'src/renderer/state/projects.ts']) {+ expect(read(f)).not.toMatch(LINK_STATE)+ }+ })++ it('the LIVE chip is not user-hideable', () => {+ // Neither inventory can carry the chip. (The menu ROW "Share live link…" may be hideable; the+ // chip that says a terminal IS being broadcast may not.)+ expect(HIDEABLE_HEADER_BUTTONS.map((r) => r.id).filter((id) => /live/i.test(id))).toEqual([])+ expect([...HIDEABLE_MENU_ITEMS, ...HIDEABLE_HEADER_BUTTONS].map((r) => r.id).filter((id) => /chip|indicator/i.test(id))).toEqual([])+ for (const f of SURFACES) {+ const src = read(f)+ expect(src, f).toMatch(/import \{ LiveLinkChip \} from '(\.\.\/|\.\/)(components\/)?LiveLinkChip'/)+ const lines = src.split('\n')+ const at = lines.findIndex((l) => l.includes('<LiveLinkChip'))+ expect(at, `${f} renders <LiveLinkChip`).toBeGreaterThanOrEqual(0)+ // Not behind a visibility check: nothing between the previous element that CLOSED (its `/>` or+ // `</`) and the chip — the span where a wrapping `{!isHidden(…) && (` would open — nor on the+ // three lines above it, however they are laid out…+ let from = at - 1+ while (from > 0 && !/\/>|<\//.test(lines[from])) from--+ expect(lines.slice(Math.max(0, Math.min(from, at - 3)), at + 1).join('\n'), f).not.toMatch(/isHidden|hidden/i)+ // …nor anywhere in the file under an id that names the chip.+ expect(src, f).not.toMatch(/isHidden\(\s*['"][^'"]*(chip|indicator)/i)+ }+ })++ it('no canvas-control verb can publish a terminal', () => {+ // The verbs moved: core/canvas-control-core.ts (handlers, agent-facing docs) and+ // shared/control-verbs.ts (the verb registry). Neither may name a live link.+ for (const f of ['src/core/canvas-control-core.ts', 'src/shared/control-verbs.ts']) {+ expect(read(f), f).not.toMatch(LINK_STATE)+ }+ })+})diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex 93b63a57f..a53ca5c57 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -244,6 +244,7 @@ import { pullBoardFor, useGitHubIssues } from '../state/githubIssues'import type { AgentState } from '@shared/agents/normalize'import type { ClientId } from '@shared/presence'import { PresenceChips } from '../components/PresenceChips'+import { LiveLinkChip } from '../components/LiveLinkChip'import { useAgentNodes } from '../state/agentNodes'import { useTerminalFocus } from '../state/terminalFocus'import { useProjects } from '../state/projects'@@ -5958,6 +5959,8 @@ export function TerminalNode({{showUsage && <ContextMeter sessionId={status?.sessionId ?? null} nodeId={id} remote={!!remoteSession} agentId={agentId} />}{/* Who else is in this node. Subscribes to presence itself — see PresenceChips. */}<PresenceChips nodeId={id} />+ {/* This terminal is broadcast by a live link — never hideable (live-link.guard.test.ts). */}+ <LiveLinkChip nodeId={id} />{status?.state === 'working' && (<span className="term-node__status term-node__status--busy" title={`${agentLabel} is working`}><AgentMascot agentId={agentId} />diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 3a38df8ad..2d1bfd1fd 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -11293,6 +11293,214 @@ button.pull-checks__name {background: var(--state-warning);border-color: transparent;}+/* Live link chip — "this terminal is being broadcast" (components/LiveLinkChip.tsx), one component on+ the node header, the kanban card, the card modal and the sessions sidebar row. The dot reads the+ ERROR role on purpose (task-14-17 H28): the spec asks for a red broadcast dot, and a role of its own+ would have to pass styles.palette.test's one-colour-per-meaning pins. The label stays ink (muted+ when refused, as the spec asks). Never animated: a chip that pulsed for as long as a link lives+ would hold the compositor's frame loop open (CLAUDE.md, Idle energy). */+.live-chip-wrap {+ display: inline-flex;+ flex: 0 0 auto;+}+.live-chip {+ --live-tone: var(--state-error);+ display: inline-flex;+ align-items: center;+ gap: 5px;+ height: 18px;+ margin-left: 6px;+ padding: 0 7px;+ border: 1px solid color-mix(in srgb, var(--live-tone) 45%, transparent);+ border-radius: 9px;+ background: color-mix(in srgb, var(--live-tone) 12%, transparent);+ color: var(--text);+ font: inherit;+ font-size: 10.5px;+ font-weight: 600;+ letter-spacing: 0.02em;+ line-height: 1;+ white-space: nowrap;+ cursor: pointer;+}+.live-chip:hover {+ background: color-mix(in srgb, var(--live-tone) 20%, transparent);+}+.live-chip__dot,+.live-chip__unread {+ flex: 0 0 auto;+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--live-tone);+}+/* Reconnecting: the relay leg is down; it comes back on its own. */+.live-chip--offline {+ --live-tone: var(--state-warning);+}+/* Refused: nodeterm's service will not host the link — muted, the owner opens it to see why. */+.live-chip--refused {+ --live-tone: var(--muted);+ color: var(--muted);+}+.live-chip__unread {+ background: var(--state-unread);+}+.kanban-card__live,+.kanban-modal__live {+ margin-left: 0;+}+.ss-live {+ flex: 0 0 auto;+ height: 16px;+ margin-left: 0;+ padding: 0 5px;+ font-size: 10px;+}+/* Its popover: a body portal above the card modal's scrim (55) and the dictation overlay (60). A+ solid --panel: under Liquid Glass it is not in either glass list, so it stays opaque. */+.live-pop__scrim {+ position: fixed;+ inset: 0;+ z-index: 61;+}+.live-pop {+ position: fixed;+ z-index: 62;+ box-sizing: border-box;+ width: 340px;+ max-width: calc(100vw - 12px);+ max-height: 70vh;+ overflow: auto;+ padding: 10px 12px;+ border: 1px solid var(--border);+ border-radius: 10px;+ background: var(--panel);+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);+ color: var(--text);+ font-size: 12px;+ line-height: 1.4;+ text-align: left;+ cursor: default;+}+.live-pop:focus {+ outline: none;+}+.live-pop p {+ margin: 0;+}+.live-pop__link + .live-pop__link {+ margin-top: 10px;+ padding-top: 10px;+ border-top: 1px solid var(--border);+}+.live-pop__head {+ display: flex;+ justify-content: space-between;+ align-items: baseline;+ gap: 8px;+}+.live-pop__role,+.live-pop__who {+ font-weight: 600;+ overflow-wrap: anywhere;+}+.live-pop__time,+.live-pop__muted {+ color: var(--muted);+}+.live-pop p.live-pop__label {+ margin-top: 2px;+ overflow-wrap: anywhere;+}+.live-pop p.live-pop__status {+ margin-top: 6px;+ padding: 6px 8px;+ border-radius: 6px;+ background: color-mix(in srgb, var(--state-warning) 12%, transparent);+}+.live-pop p.live-pop__status--refused {+ background: rgba(var(--tint-rgb), 0.06);+}+.live-pop__actions {+ display: flex;+ gap: 6px;+ margin: 8px 0;+}+.live-pop .confirm__btn.live-pop__btn {+ padding: 3px 10px;+ border-radius: 6px;+ font-size: 12px;+}+.live-pop p.live-pop__error {+ margin: 4px 0;+ color: var(--danger);+}+.live-pop__viewers ul,+.live-pop__thread {+ margin: 4px 0;+ padding: 0;+ list-style: none;+}+.live-pop__viewers li {+ display: flex;+ align-items: center;+ gap: 6px;+ padding: 2px 0;+}+.live-pop .live-pop__kick {+ margin-left: auto;+}+.live-pop p.live-pop__note {+ margin-top: 4px;+ font-size: 11px;+}+.live-pop__chat {+ margin-top: 8px;+ padding-top: 8px;+ border-top: 1px solid var(--border);+}+.live-pop__thread {+ max-height: 220px;+ overflow-y: auto;+}+.live-pop__msg {+ display: flex;+ flex-wrap: wrap;+ align-items: baseline;+ gap: 4px;+ margin: 4px 0;+}+.live-pop__text {+ flex-basis: 100%;+ white-space: pre-wrap;+ overflow-wrap: anywhere;+}+.live-pop__copy {+ padding: 0;+ border: 0;+ background: none;+ color: var(--accent);+ font: inherit;+ font-size: 11px;+ cursor: pointer;+}+.live-pop__copy:disabled {+ color: var(--muted);+ cursor: default;+}+.live-pop__reply {+ display: flex;+ gap: 6px;+ margin-top: 6px;+}+.live-pop .confirm__input.live-pop__input {+ flex: 1 1 auto;+ min-width: 0;+ margin: 0;+ padding: 4px 8px;+ font-size: 12px;+}/* The session name in the card modal header: sized to its text, not a flex-filling detail line. */.kanban-modal__session {flex: 0 1 auto;