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): board-log 'agent-read-cookies' + main-side append (S8 PR9 Task 9.2)

Claude Code85eff0acb2e6
diff --git a/src/core/board-log-handlers.test.ts b/src/core/board-log-handlers.test.ts
index e8dd0c847..4a3643468 100644
--- a/src/core/board-log-handlers.test.ts
+++ b/src/core/board-log-handlers.test.ts
@@ -53,6 +53,21 @@ describe('registerBoardLogHandlers — routing', () => {
expect(await read(f, 'p1')).toEqual({ entries: [], unsupported: true })
})
+ it('returns an in-process append that writes THROUGH the same router (no IPC round-trip) — Task 9.2', async () => {
+ const f = fakePlatform()
+ const handlers = registerBoardLogHandlers(f, routerFor({ kind: 'local', cwd: dir }))
+ // The main-side caller (the cookie trace) appends without going through the renderer.
+ expect(await handlers.append('p1', entry({ id: 'trace', kind: 'event', text: undefined }))).toBe(true)
+ const res = await read(f, 'p1')
+ expect(res.entries.map((e) => e.id)).toContain('trace')
+ })
+
+ it('the in-process append reports false on an unsupported project (fail-closed feeds the cookie gate)', async () => {
+ const f = fakePlatform()
+ const handlers = registerBoardLogHandlers(f, routerFor({ kind: 'unsupported' }))
+ expect(await handlers.append('p1', entry())).toBe(false)
+ })
+
it('remote: routes through the injected exec (append + tail)', async () => {
const store: string[] = []
const exec: RemoteLogExec = {
diff --git a/src/core/board-log-handlers.ts b/src/core/board-log-handlers.ts
index 213d7a47c..f6fb8a2a6 100644
--- a/src/core/board-log-handlers.ts
+++ b/src/core/board-log-handlers.ts
@@ -48,7 +48,15 @@ export function appendBoardLogVia(
return Promise.resolve(false)
}
-export function registerBoardLogHandlers(platform: CorePlatform, router: BoardLogRouter): void {
+/** What `registerBoardLogHandlers` hands back: an in-process `append` that a MAIN-side caller (the
+ * `browser --cookies` trace, PR 9 Task 9.2) uses to write a board-log line WITHOUT an IPC round-trip
+ * through the renderer — the same local/remote/unsupported routing the `boardLogAppend` handler
+ * performs, sharing the one `localStore`. */
+export interface BoardLogHandlers {
+ append(projectId: string, entry: BoardLogEntry): Promise<boolean>
+}
+
+export function registerBoardLogHandlers(platform: CorePlatform, router: BoardLogRouter): BoardLogHandlers {
const localStore = new BoardLogStore({})
platform.handle(IPC.boardLogAppend, async (projectId: string, entry: BoardLogEntry): Promise<boolean> => {
@@ -119,4 +127,11 @@ export function registerBoardLogHandlers(platform: CorePlatform, router: BoardLo
subs.delete(projectId)
}
})
+
+ // The in-process append: shares this registration's router + localStore, so a main-side writer and
+ // the IPC handler can never route a project's log differently.
+ return {
+ append: (projectId: string, entry: BoardLogEntry): Promise<boolean> =>
+ appendBoardLogVia(router, projectId, entry, localStore)
+ }
}
diff --git a/src/renderer/components/kanban/BoardLogPanel.tsx b/src/renderer/components/kanban/BoardLogPanel.tsx
index 4bc9c3ce6..c178bd890 100644
--- a/src/renderer/components/kanban/BoardLogPanel.tsx
+++ b/src/renderer/components/kanban/BoardLogPanel.tsx
@@ -16,7 +16,7 @@ interface BoardLogPanelProps {
/** The activity sentence WITHOUT the leading author name — the name is rendered separately in
* the author's color, so the feed reads like Trello (colored actor + muted action). column-*
* events carry no nodeId and so never reach a card-scoped feed; kept for completeness. */
-function eventBody(e: BoardLogEvent): string {
+export function eventBody(e: BoardLogEvent): string {
switch (e.type) {
case 'card-created':
return `created this card in ${e.to ?? 'Ungrouped'}`
@@ -42,6 +42,10 @@ function eventBody(e: BoardLogEvent): string {
return `removed the priority`
case 'agent-message':
return `sent a message to ${e.to ?? 'another node'} (${e.title ?? 'unknown outcome'})`
+ case 'agent-read-cookies':
+ // A loud, human-visible line for a cookie read (the whole point of the trace). `from` names the
+ // agent, `to` the domain it read; `title` names the browser node it drove.
+ return `read cookies for ${e.to ?? 'a site'}${e.title ? ` via ${e.title}` : ''}`
default:
// A newer peer may write event types this build doesn't know — show them neutrally.
return `updated this card`
diff --git a/src/renderer/components/kanban/board-log-panel.test.tsx b/src/renderer/components/kanban/board-log-panel.test.tsx
new file mode 100644
index 000000000..7e1e0b0b3
--- /dev/null
+++ b/src/renderer/components/kanban/board-log-panel.test.tsx
@@ -0,0 +1,27 @@
+import { describe, it, expect } from 'vitest'
+import { eventBody } from './BoardLogPanel'
+import type { BoardLogEvent } from '@shared/types'
+
+describe('eventBody — the activity sentence', () => {
+ it('renders the new agent-read-cookies type as a loud, domain-naming line (Task 9.2)', () => {
+ const e: BoardLogEvent = { type: 'agent-read-cookies', from: 'claude-1', to: 'github.com', title: 'browser-3' }
+ expect(eventBody(e)).toBe('read cookies for github.com via browser-3')
+ })
+
+ it('names the domain even without a browser title', () => {
+ expect(eventBody({ type: 'agent-read-cookies', from: 'claude-1', to: 'github.com' })).toBe(
+ 'read cookies for github.com'
+ )
+ })
+
+ it('a known peer type still renders its own sentence (not the neutral fallback)', () => {
+ // Guards against the new case accidentally swallowing a sibling type.
+ expect(eventBody({ type: 'agent-message', to: 'claude-2', title: 'delivered' })).toBe(
+ 'sent a message to claude-2 (delivered)'
+ )
+ })
+
+ it('an unknown future type falls back neutrally', () => {
+ expect(eventBody({ type: 'something-new' as BoardLogEvent['type'] })).toBe('updated this card')
+ })
+})
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 9d3b551c5..b3ca27dee 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -435,6 +435,12 @@ export interface BoardLogEvent {
* is the delivery's outcome kind — a trace that cannot answer "did it land?" answers the only
* question anyone asks it with silence. Written by `agent-message-trace.recordDelivery`. */
| 'agent-message'
+ /** An agent read a site's cookies through `browser --cookies` — a data-exfiltration surface the
+ * owner allowed but that MUST be loudly traced (PR 9 Task 9.2/9.3). `from` = the owner agent
+ * node's title, `to` = the domain read, `title` = the browser node's title; `nodeId` = the owner
+ * agent node so it files under that agent's card. Written BEFORE the read (fail-closed): a cookie
+ * read that happened but was not recorded is the one outcome this trace exists to prevent. */
+ | 'agent-read-cookies'
from?: string
to?: string
/** Column title for column-added/deleted; card title for card-created; outcome for agent-message. */
@@ -2592,9 +2598,12 @@ export interface NodeTerminalApi {
/** The `browser` verb resolve round-trip (S8 PR 7): main asks the renderer to resolve a source
* node's owning project, control-capability and the LIVE per-project capability value. The
* renderer answers over `sendBrowserControlResolveResult` and NEVER runs a CDP command. */
- onBrowserControlResolve(listener: (req: { requestId: string; sourceNodeId: string }) => void): () => void
+ onBrowserControlResolve(
+ listener: (req: { requestId: string; sourceNodeId: string; browserNodeId?: string }) => void
+ ): () => void
/** Answer a browser-control resolve. `ok:false` carries a named refusal; `ok:true` carries the
- * facts main turns into its own (owner + capability + CDP-gate) decision. */
+ * facts main turns into its own (owner + capability + CDP-gate) decision. `sourceTitle`/
+ * `browserTitle` are for the cookie-read trace only (PR 9) — never a security input. */
sendBrowserControlResolveResult(payload: {
requestId: string
ok: boolean
@@ -2603,6 +2612,8 @@ export interface NodeTerminalApi {
projectCwd?: string
sourceControlCapable?: boolean
capabilityOn?: boolean
+ sourceTitle?: string
+ browserTitle?: string
}): void
/** Agent messaging (the `send`/`reply` control verbs): run one delivery in main, where the
* scope check, the per-project switch, flow control and the pane probes all live. The reply is