Skip to content

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.

feat(browser): the on-node "…is driving" chip and its lease store

Claude Code64c4928e0d50
diff --git a/src/main/browser-lease.ts b/src/main/browser-lease.ts
index 06aee7763..fb688453e 100644
--- a/src/main/browser-lease.ts
+++ b/src/main/browser-lease.ts
@@ -24,12 +24,14 @@
*/
import type { CdpContext } from './browser-cdp-allowlist'
import { type DebuggerLike, sendCdp } from './browser-cdp-send'
+// The indicator's linger now lives in `src/shared` (PR 6 consumes it from the renderer too, and a
+// renderer→main import is forbidden — global constraint 4). Re-exported here so the debugger-lease
+// timings still read together at this one call site and every existing importer is unaffected.
+import { INDICATOR_LINGER_MS } from '@shared/browser-indicator'
/** The lease outlives the last verb by this long; a verb within the window does not re-attach. */
export const LEASE_IDLE_MS = 60_000
-/** How long the indicator (PR 6) lingers after a lease ends, so a burst of verbs does not flicker
- * the chip off between them. Consumed by PR 6, exported here so the two constants live together. */
-export const INDICATOR_LINGER_MS = 5_000
+export { INDICATOR_LINGER_MS }
/** Pure, so the ledger, the indicator and the discard-suppression sweep all agree on "still live". */
export function leaseIsActive(now: number, leaseActiveUntil: number): boolean {
diff --git a/src/preload/index.ts b/src/preload/index.ts
index d98e580dc..13b73d70c 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -322,7 +322,15 @@ const api: NodeTerminalApi = {
const handler = (_e: unknown, ev: { url: string; sourceNodeId: string }) => listener(ev)
ipcRenderer.on(IPC.browserNewWindow, handler)
return () => ipcRenderer.removeListener(IPC.browserNewWindow, handler)
- }
+ },
+ onLeaseChanged: (listener) => {
+ const handler = (_e: unknown, push: Parameters<typeof listener>[0]) => listener(push)
+ ipcRenderer.on(IPC.browserLeaseChanged, handler)
+ return () => ipcRenderer.removeListener(IPC.browserLeaseChanged, handler)
+ },
+ stop: (nodeId: string) => ipcRenderer.send(IPC.browserStop, nodeId),
+ stopAll: () => ipcRenderer.send(IPC.browserStopAll),
+ stopProject: (projectId: string) => ipcRenderer.send(IPC.browserStopProject, projectId)
},
files: {
quickOpen: (cwd: string) => ipcRenderer.invoke(IPC.filesQuickOpen, cwd),
diff --git a/src/renderer/bridge/stubs.ts b/src/renderer/bridge/stubs.ts
index 896002ef0..244ea190b 100644
--- a/src/renderer/bridge/stubs.ts
+++ b/src/renderer/bridge/stubs.ts
@@ -194,7 +194,13 @@ export function buildStubApi(): Omit<
browser: {
register: noop,
unregister: noop,
- onBrowserNewWindow: noopUnsub
+ onBrowserNewWindow: noopUnsub,
+ // Browser control does not exist off the desktop shell (no <webview>, no CDP), so there is no
+ // lease to push and nothing to stop — the chip simply never appears.
+ onLeaseChanged: noopUnsub,
+ stop: noop,
+ stopAll: noop,
+ stopProject: noop
},
updates: {
onAvailable: noopUnsub,
diff --git a/src/renderer/nodes/BrowserDrivingChip.tsx b/src/renderer/nodes/BrowserDrivingChip.tsx
new file mode 100644
index 000000000..ddbb3bc83
--- /dev/null
+++ b/src/renderer/nodes/BrowserDrivingChip.tsx
@@ -0,0 +1,62 @@
+import { useProjects } from '../state/projects'
+import { useDrivingLease } from '../state/browserLease'
+
+/**
+ * The "…is driving" chip (S8 PR 6 of #112, @Corvin): shown on a browser node header (and in the
+ * kanban card modal) the whole time an agent holds a control lease on it — plus a short linger so a
+ * burst of fast verbs reads as one continuous state. It carries the one obvious Stop.
+ *
+ * Decision 4: this is ALWAYS ON. There is deliberately no setting that hides it and none to add — a
+ * user cannot be driving-blind by preference. It is not gated on `agentBrowserControl` either: that
+ * switch decides whether an agent MAY drive; once one IS driving, the badge is unconditional.
+ */
+
+/** Presentational only — no store, so it renders in isolation under test. `ownerTitle` is the
+ * VERIFIED owner node's title (resolved from the ledger's `ownerNodeId`, never a caller label). */
+export function BrowserDrivingChip({
+ ownerTitle,
+ onStop
+}: {
+ ownerTitle: string
+ onStop: () => void
+}): React.JSX.Element {
+ return (
+ <span className="term-node__status term-node__status--driven nodrag" role="status">
+ <span className="term-node__status-dot" />
+ <span className="browser-driving__label">{ownerTitle} is driving</span>
+ <button
+ className="browser-driving__stop"
+ title="Stop agent control of this browser node"
+ onClick={(e) => {
+ e.stopPropagation()
+ onStop()
+ }}
+ >
+ Stop
+ </button>
+ </span>
+ )
+}
+
+/**
+ * The node/modal container: reads the live lease for `nodeId`, resolves the owner's title, and wires
+ * Stop to main (which detaches the debugger + drops the ledger entry — a real revocation, never a
+ * hide). Renders nothing when the node is not being driven.
+ */
+export function BrowserDrivingIndicator({ nodeId }: { nodeId: string }): React.JSX.Element | null {
+ const lease = useDrivingLease(nodeId)
+ const ownerTitle = useProjects((s) => {
+ if (!lease) return ''
+ for (const p of s.projects) {
+ const owner = p.nodes.find((n) => n.id === lease.ownerNodeId)
+ if (owner) return owner.title || lease.ownerNodeId
+ }
+ // The owner is gone from every canvas (closed/restarted) but the lease has not yet been
+ // revoked: name it by id rather than blanking the chip.
+ return lease.ownerNodeId
+ })
+ if (!lease) return null
+ return (
+ <BrowserDrivingChip ownerTitle={ownerTitle} onStop={() => window.nodeTerminal.browser.stop(nodeId)} />
+ )
+}
diff --git a/src/renderer/nodes/BrowserNode.tsx b/src/renderer/nodes/BrowserNode.tsx
index 73fe93327..0201d9515 100644
--- a/src/renderer/nodes/BrowserNode.tsx
+++ b/src/renderer/nodes/BrowserNode.tsx
@@ -2,6 +2,7 @@ import { Handle, NodeResizer, Position, useReactFlow, type NodeProps } from '@xy
import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import type { CanvasNode } from '../state/workspace'
import { BrowserSurface } from './BrowserSurface'
+import { BrowserDrivingIndicator } from './BrowserDrivingChip'
/**
* A navigable Chromium browser node: node chrome (frame/header/resize/close) wrapping the shared
@@ -35,6 +36,10 @@ export default function BrowserNode({ id, data, selected }: NodeProps<CanvasNode
<span className="term-node__title-text" title={(data.url as string) || ''}>
{(data.title as string) || 'Browser'}
</span>
+ {/* The driving chip — present the whole time an agent holds a control lease on this node,
+ with the one obvious Stop. Renders nothing otherwise (and, until PR 7 ships the verb that
+ drives a lease, in every case today). */}
+ <BrowserDrivingIndicator nodeId={id} />
<span className="term-node__spacer" />
<button className="term-node__close" title="Close" onClick={() => deleteElements({ nodes: [{ id }] })}>
×
diff --git a/src/renderer/nodes/browser-indicator.test.tsx b/src/renderer/nodes/browser-indicator.test.tsx
new file mode 100644
index 000000000..f00bf8489
--- /dev/null
+++ b/src/renderer/nodes/browser-indicator.test.tsx
@@ -0,0 +1,108 @@
+// @vitest-environment jsdom
+//
+// The driving chip (S8 PR 6 of #112, @Corvin): it appears while an agent holds a lease, names the
+// VERIFIED owner, carries a Stop, LINGERS past a lease's end so a burst of fast verbs reads as one
+// continuous state, and drops AT ONCE on an explicit Stop. And no setting hides it (decision 4).
+import { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { describe, expect, it, vi } from 'vitest'
+import { readFileSync } from 'node:fs'
+import path from 'node:path'
+import { chipVisibleAt, INDICATOR_LINGER_MS } from '@shared/browser-indicator'
+import { applyLeasePush, drivingNodeIds, type LeaseEntries } from '../state/browserLease'
+import { BrowserDrivingChip } from './BrowserDrivingChip'
+
+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
+
+const T0 = 1_000_000
+const active = (leaseActiveUntil: number, id = 'browser-3', ownerNodeId = 'claude-2') => ({
+ active: [{ browserNodeId: id, ownerNodeId, leaseActiveUntil }],
+ stopped: [] as string[]
+})
+
+describe('the chip lingers, because a 50ms flicker has informed nobody', () => {
+ it('a lease that was live for ~50ms keeps the chip up for INDICATOR_LINGER_MS after it ends', () => {
+ // A --read completes in ~50ms: the lease is barely in the future when we learn of it.
+ const entries: LeaseEntries = applyLeasePush({}, active(T0 + 50), T0)
+ const e = entries['browser-3']
+ expect(e.ownerNodeId).toBe('claude-2')
+
+ // Still driving well after the 50ms lease ended — this is the whole point of the linger.
+ expect(chipVisibleAt(e, T0 + 50)).toBe(true)
+ expect(chipVisibleAt(e, T0 + 2_000)).toBe(true)
+ // …and gone once the linger itself lapses.
+ expect(chipVisibleAt(e, T0 + 50 + INDICATOR_LINGER_MS + 1)).toBe(false)
+ // A burst reads as continuous: the SAME entry is visible across the gap between two 50ms verbs.
+ expect(chipVisibleAt(e, T0 + 4_000)).toBe(true)
+ })
+
+ it('a natural expiry is swept only once the linger is truly past', () => {
+ const entries = applyLeasePush({}, active(T0 + 50), T0)
+ // A later push at a time still inside the linger keeps the entry (an unrelated change).
+ const still = applyLeasePush(entries, { active: [], stopped: [] }, T0 + 2_000)
+ expect(still['browser-3']).toBeTruthy()
+ // A push after the linger sweeps it.
+ const gone = applyLeasePush(entries, { active: [], stopped: [] }, T0 + 50 + INDICATOR_LINGER_MS + 1)
+ expect(gone['browser-3']).toBeUndefined()
+ })
+})
+
+describe('an explicit Stop drops the chip immediately, skipping the linger', () => {
+ it('a stopped id is removed at once, even mid-linger', () => {
+ const entries = applyLeasePush({}, active(T0 + 60_000), T0) // a normal 60s lease
+ expect(entries['browser-3']).toBeTruthy()
+ // Stop arrives: the node is in `stopped`. It must be gone NOW, not in 5s.
+ const afterStop = applyLeasePush(entries, { active: [], stopped: ['browser-3'] }, T0 + 10)
+ expect(afterStop['browser-3']).toBeUndefined()
+ })
+
+ it('the rope-highlight set is exactly the visible-lease set (a rope with no entry is never in it)', () => {
+ const entries = applyLeasePush({}, active(T0 + 60_000, 'browser-9'), T0)
+ const driven = drivingNodeIds(entries, T0 + 5)
+ expect(driven.has('browser-9')).toBe(true)
+ // A browser node with no ledger-backed entry (e.g. a hostile pre-declared rope's target).
+ expect(driven.has('browser-unclaimed')).toBe(false)
+ })
+})
+
+describe('the chip names the owner and carries a Stop', () => {
+ it('renders "<owner> is driving" and Stop calls back', () => {
+ const host = document.createElement('div')
+ document.body.append(host)
+ const root = createRoot(host)
+ const onStop = vi.fn()
+ act(() => root.render(<BrowserDrivingChip ownerTitle="Claude 2" onStop={onStop} />))
+
+ expect(host.textContent).toContain('Claude 2 is driving')
+ const stop = host.querySelector('button.browser-driving__stop') as HTMLButtonElement
+ expect(stop).toBeTruthy()
+ act(() => stop.click())
+ expect(onStop).toHaveBeenCalledTimes(1)
+
+ act(() => root.unmount())
+ host.remove()
+ })
+})
+
+describe('no setting hides it (decision 4 — there is no toggle to look for and none to add)', () => {
+ it('visibility is a pure function of lease state — the chip renders whenever a lease is present', () => {
+ // There is no `enabled`/`setting` input to chipVisibleAt: give it any live entry and it shows.
+ expect(chipVisibleAt({ ownerNodeId: 'x', leaseActiveUntil: T0 + 1 }, T0)).toBe(true)
+ })
+
+ it('neither the chip nor the lease store consults settings / the capability switch', () => {
+ // A structural guard: the moment someone adds a `useSettings`/`agentBrowserControl` gate to the
+ // indicator, this fails. The chip is gated ONLY on the presence of a verified lease.
+ const root = path.resolve(process.cwd(), 'src', 'renderer')
+ const chip = readFileSync(path.join(root, 'nodes', 'BrowserDrivingChip.tsx'), 'utf8')
+ const store = readFileSync(path.join(root, 'state', 'browserLease.ts'), 'utf8')
+ // Strip comments — the chip's doc comment explains that it is NOT gated on the capability
+ // switch, and that explanation is a comment, correctly ignored here (same style as
+ // browser-ownership-source.test.ts).
+ const stripComments = (s: string): string =>
+ s.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/[^\n]*/g, '')
+ for (const src of [chip, store]) {
+ expect(stripComments(src)).not.toMatch(/useSettings|agentBrowserControl|hiddenNodeMenuItems/)
+ }
+ })
+})
diff --git a/src/renderer/state/browserLease.ts b/src/renderer/state/browserLease.ts
new file mode 100644
index 000000000..1418772ea
--- /dev/null
+++ b/src/renderer/state/browserLease.ts
@@ -0,0 +1,84 @@
+import { create } from 'zustand'
+import { useEffect, useReducer } from 'react'
+import {
+ chipVisibleAt,
+ INDICATOR_LINGER_MS,
+ type BrowserLeaseEntry,
+ type BrowserLeasePush
+} from '@shared/browser-indicator'
+
+/**
+ * The renderer's view of which browser nodes an agent is DRIVING (S8 PR 6 of #112, @Corvin). Fed by
+ * a `browser:lease-changed` push from main, which owns the debugger lease + the ownership ledger;
+ * this store never decides ownership, it only paints what main verified. The chip, the rope
+ * highlight and the Settings kill row all read it, so they can never disagree.
+ *
+ * The `browser` verb that MAKES a lease active lands in PR 7 — until then main pushes nothing with a
+ * live `leaseActiveUntil`, so `entries` stays empty in practice while every path below is real and
+ * tested. Stop, however, is live now: main pushes the stopped node in `stopped` and it drops here at
+ * once.
+ */
+export type LeaseEntries = Record<string, BrowserLeaseEntry>
+
+/**
+ * Fold one push into the entry map. Two rules that must never merge:
+ * - `stopped` ids drop IMMEDIATELY, skipping the linger — the user (or a lifecycle event) ended
+ * control, so the chip must vanish now, not fade.
+ * - `active` ids upsert with their fresh window; a node that merely goes idle is NOT in `stopped`
+ * and keeps lingering {@link INDICATOR_LINGER_MS} past its `leaseActiveUntil` (the anti-flicker
+ * rule), then gets swept here once it is truly done.
+ * Pure, so the flicker and the stop-is-immediate behaviours are unit-tested without the IPC.
+ */
+export function applyLeasePush(prev: LeaseEntries, push: BrowserLeasePush, now: number): LeaseEntries {
+ const next: LeaseEntries = { ...prev }
+ for (const id of push.stopped) delete next[id]
+ for (const a of push.active) {
+ next[a.browserNodeId] = { ownerNodeId: a.ownerNodeId, leaseActiveUntil: a.leaseActiveUntil }
+ }
+ // Sweep entries whose lease AND linger have both elapsed (a natural expiry, not a stop).
+ for (const [id, e] of Object.entries(next)) if (!chipVisibleAt(e, now)) delete next[id]
+ return next
+}
+
+interface BrowserLeaseState {
+ entries: LeaseEntries
+ /** Apply a push (also the test seam — components never call it). */
+ apply: (push: BrowserLeasePush) => void
+}
+
+export const useBrowserLease = create<BrowserLeaseState>((set) => {
+ const apply = (push: BrowserLeasePush): void =>
+ set((s) => ({ entries: applyLeasePush(s.entries, push, Date.now()) }))
+ // One subscription for the app's lifetime. Guarded so the store imports cleanly under jsdom /
+ // Server Edition, where the bridge is absent.
+ window.nodeTerminal?.browser?.onLeaseChanged?.(apply)
+ return { entries: {}, apply }
+})
+
+/**
+ * Is this node being driven RIGHT NOW (including the linger), and by whom? Returns the entry while
+ * the chip should show, else null. Schedules a single re-render at the exact moment the linger
+ * lapses, so the chip disappears on its own without a per-second poll.
+ */
+export function useDrivingLease(nodeId: string): BrowserLeaseEntry | null {
+ const entry = useBrowserLease((s) => s.entries[nodeId])
+ const [, bump] = useReducer((n: number) => n + 1, 0)
+ useEffect(() => {
+ if (!entry) return
+ const remaining = entry.leaseActiveUntil + INDICATOR_LINGER_MS - Date.now()
+ if (remaining <= 0) return
+ const t = setTimeout(bump, remaining + 20)
+ return () => clearTimeout(t)
+ }, [entry])
+ if (!entry) return null
+ return chipVisibleAt(entry, Date.now()) ? entry : null
+}
+
+/** The set of browser node ids currently being driven — the rope highlight (Task 6.2) and the
+ * Settings kill row read this. A node with no ledger-backed entry is never in it, so a hostile
+ * pre-declared rope is never highlighted. */
+export function drivingNodeIds(entries: LeaseEntries, now: number): Set<string> {
+ const ids = new Set<string>()
+ for (const [id, e] of Object.entries(entries)) if (chipVisibleAt(e, now)) ids.add(id)
+ return ids
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index ee2c3dfbc..febb27922 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -1364,6 +1364,55 @@ body,
animation: nt-pulse 1.1s ease-in-out infinite;
}
+/* DRIVING: an agent holds a control lease on this browser node (S8 PR 6). Same clay as RUNNING so
+ it reads as agent activity, but it carries a label + a Stop button, so it is wider than the plain
+ status badges. Always on — no setting hides it (decision 4). */
+.term-node__status--driven {
+ color: #d97757;
+ max-width: 100%;
+ min-width: 0;
+}
+
+.term-node__status--driven .term-node__status-dot {
+ animation: nt-pulse 1.1s ease-in-out infinite;
+}
+
+.browser-driving__label {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ min-width: 0;
+}
+
+/* The one obvious Stop. Quiet by default, clay on hover — it is a deliberate act, so it should read
+ as available without shouting. */
+.browser-driving__stop {
+ flex-shrink: 0;
+ margin-left: 2px;
+ padding: 0 6px;
+ font-size: 9.5px;
+ font-weight: 700;
+ letter-spacing: 0.04em;
+ color: var(--muted);
+ background: rgba(var(--tint-rgb), 0.08);
+ border: 1px solid transparent;
+ border-radius: 5px;
+ cursor: pointer;
+}
+
+.browser-driving__stop:hover {
+ color: #d97757;
+ border-color: rgba(217, 119, 87, 0.5);
+}
+
+/* The dot's pulse is decoration; the state still reads frozen at the lit end (matches the mascot
+ pulse contract above). */
+@media (prefers-reduced-motion: reduce) {
+ .term-node__status--driven .term-node__status-dot {
+ animation: none;
+ }
+}
+
/* Walking mascot (docs/mascot-sprites.md): sits where the pulsing dot would, INSIDE the RUNNING
badge, pure CSS spritesheet stepping — no per-node JS timers. Sizes come from lib/mascot.ts via
the inline CSS vars so the animation and the rendered sheet can never desync. Fixed heights ≤
diff --git a/src/shared/browser-indicator.ts b/src/shared/browser-indicator.ts
new file mode 100644
index 000000000..a035fdba3
--- /dev/null
+++ b/src/shared/browser-indicator.ts
@@ -0,0 +1,49 @@
+/**
+ * The DRIVING indicator's shared vocabulary — the one fact both main (which owns the lease) and the
+ * renderer (which paints the chip and highlights the rope) must agree on. Lives in `src/shared`
+ * because both shells import it (global constraint 4: anything both sides need lives here, never a
+ * renderer→main import). Pure — no electron, no DOM — so the visibility rule is unit-tested on its
+ * own.
+ *
+ * S8 PR 6 of external PR #112 (@Corvin / proteus-dev): the on-node "…is driving" chip + Stop. The
+ * lease that FEEDS this (the `browser` verb) lands in PR 7; until then nothing sets a live
+ * `leaseActiveUntil`, so the chip stays hidden in practice while every mechanism below is real.
+ */
+
+
+/**
+ * How long the chip lingers AFTER a lease's `leaseActiveUntil` has passed. A single verb (a
+ * `--read` that completes in ~50 ms) would otherwise flicker the chip for 50 ms and inform nobody; a
+ * burst of verbs must read as one continuous "is driving", which is also the truth (the debugger is
+ * still attached for the whole idle window). The debugger's own idle window (`LEASE_IDLE_MS`, 60 s)
+ * is a separate, invisible perf concern; this is purely how long the badge outlives it so the
+ * transition to "gone" is a fade, not a blink. An EXPLICIT Stop bypasses this entirely (see the
+ * store): the user stopped it, so the chip must vanish at once, not linger.
+ */
+export const INDICATOR_LINGER_MS = 5_000
+
+/** One driven browser node, as main pushes it and the renderer store keeps it. `ownerNodeId` is the
+ * VERIFIED owner from the in-memory ledger (never a rope, never a caller label); the renderer
+ * resolves its title for the chip. `leaseActiveUntil` is the ledger's live window. */
+export interface BrowserLeaseEntry {
+ ownerNodeId: string
+ leaseActiveUntil: number
+}
+
+/** The main→renderer push payload. `active` is the CURRENT live-lease set (upserted); `stopped` are
+ * nodes whose control was just revoked and must drop from the chip immediately, skipping the
+ * linger — that is the difference between "a verb finished" (fade) and "the user pressed Stop"
+ * (gone). */
+export interface BrowserLeasePush {
+ active: { browserNodeId: string; ownerNodeId: string; leaseActiveUntil: number }[]
+ stopped: string[]
+}
+
+/**
+ * Is the chip visible for this entry at `now`? True while the lease is live OR within
+ * {@link INDICATOR_LINGER_MS} of it ending. The single rule the chip, the rope highlight and the
+ * kill-row list all read, so they can never disagree about whether a node "is driving".
+ */
+export function chipVisibleAt(entry: BrowserLeaseEntry, now: number): boolean {
+ return now < entry.leaseActiveUntil + INDICATOR_LINGER_MS
+}
diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts
index e0827ec10..d3e05deb9 100644
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@ -357,6 +357,13 @@ export const IPC = {
browserRegister: 'browser:register',
browserUnregister: 'browser:unregister',
browserNewWindow: 'browser:new-window',
+ // Browser control indicator + Stop (S8 PR 6). Main pushes the current driven-lease set to the
+ // renderer (the chip / rope / kill row); the renderer asks main to revoke — per node, all, or a
+ // whole project's — and main detaches the debugger + drops the ledger entry for real.
+ browserLeaseChanged: 'browser:lease-changed',
+ browserStop: 'browser:stop-control',
+ browserStopAll: 'browser:stop-control-all',
+ browserStopProject: 'browser:stop-control-project',
remoteHostStart: 'remote:host:start',
remoteHostStop: 'remote:host:stop',
// Connection approval gate: main → renderer when a client finishes the handshake (carries the
diff --git a/src/shared/types.ts b/src/shared/types.ts
index d46655d47..f906cad00 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -5,6 +5,7 @@ import type { CloneProgress } from './clone-url'
import type { NormalizedAgentEvent } from './agents/normalize'
import type { AgentId, AgentPermissionMode, BuiltinAgentId, PromptInjectionMode } from './agents/config'
import type { AgentMessageDeliverRequest, AgentMessageReply } from './agents/agent-messaging'
+import type { BrowserLeasePush } from './browser-indicator'
import type { GroupWorktree } from './worktree'
import type { ClientId, DinoSnapshot, PeerDiff, PeerIdentity, PeerState } from './presence'
import type { WhisperModelInfo } from './speech'
@@ -840,6 +841,16 @@ export interface BrowserApi {
unregister(webContentsId: number): void
/** Fires when a browser guest requested a new window; the renderer opens another browser node. */
onBrowserNewWindow(listener: (e: { url: string; sourceNodeId: string }) => void): () => void
+ /** Push: the current set of browser nodes an agent is driving (chip / rope / kill row). `stopped`
+ * ids drop from the chip immediately, skipping the anti-flicker linger. */
+ onLeaseChanged(listener: (push: BrowserLeasePush) => void): () => void
+ /** Stop agent control of ONE browser node — the chip button and the node context menu. Detaches
+ * the debugger + drops the lease in main; a later drive from that owner is refused by name. */
+ stop(nodeId: string): void
+ /** Stop agent control of EVERY driven node — the Settings kill row's Stop-all. */
+ stopAll(): void
+ /** Stop agent control of every node in a project — the project's browser-control switch going off. */
+ stopProject(projectId: string): void
}
/** A user-defined agent (BYO CLI). With no `baseAgent` it is in no capability list, so it gets