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.

Merge remote-tracking branch 'origin/main' into feat/board-comment-to-agent

reviewb6285664f1c4
diff --cc src/core/agents/agent-messaging.ts
index 1b90867ff,d7a816c4b..b1f02b6f5
--- a/src/core/agents/agent-messaging.ts
+++ b/src/core/agents/agent-messaging.ts
@@@ -67,40 -61,6 +73,40 @@@ import type
ProjectCapability
} from '../../shared/project-capabilities'
+/**
+ * A board comment's delivery to ONE mentioned session (`deliverBoardCommentFromUi`). It rides every
+ * gate a `send` does; what differs is only who it is from — a person, not a node — so the scope is
+ * "is the target on this board", the flow budget belongs to the board, and the envelope names the
+ * author. `text` is the whole comment as typed (mention tokens included); the body the agent reads
+ * is derived from it in THIS process.
+ */
+export interface BoardCommentMessage extends BoardCommentDeliverRequest {
+ verb: 'board-comment'
+}
+
- /** Everything `runDelivery` can carry: an agent's verb, or a board comment. */
- export type MessagingRequest = AgentMessageDeliverRequest | BoardCommentMessage
++/** Everything `runDelivery` can carry: an agent's verb, the app's station notice, or a board comment. */
++export type MessagingRequest = AgentMessageDeliveryInput | BoardCommentMessage
+
+/** The flow-control identity of a board: one person's budget per project. `board:` can never be a
+ * node id (no ':' in `isSafeNodeId`'s alphabet), and a project id with a control character never
+ * gets this far (`isBoardCommentDeliverRequest`), so the pair key stays injective. */
+function boardFlowSource(projectId: string): string {
+ return `board:${projectId}`
+}
+
+/** The source id / title / body a queued or traced request carries, whichever origin it has. */
+function requestIdentity(
+ req: MessagingRequest
+): { sourceNodeId: string; sourceTitle: string; body: string } {
+ if (req.verb === 'board-comment')
+ return {
+ sourceNodeId: boardCommentSourceId(req.commentId),
+ sourceTitle: boardCommentFrom(req.author),
+ body: req.text
+ }
+ return { sourceNodeId: req.sourceNodeId, sourceTitle: req.sourceNodeId, body: req.body }
+}
+
/** The little the service needs to know about a stored node. */
export interface MessagingStoredNode {
id: string
@@@ -278,39 -242,26 +291,41 @@@ export function createDeliveryQueue
}
void deps.appendBoardLog(projectId, entry)
}
- return new DeliveryQueue(
+ const queue: DeliveryQueue = new DeliveryQueue(
{
now,
- deliver: (qreq) =>
- runDelivery(
- {
- // A queued station notice flushes as a station notice: the verb rides the queue, so
- // its app-authored body and its reversed ownership check survive the wait.
- verb: qreq.verb as AgentMessageDeliveryInput['verb'],
- sourceNodeId: qreq.sourceNodeId,
- targetNodeId: qreq.targetNodeId,
- body: qreq.body
- },
+ deliver: async (qreq) => {
+ const outcome = await runDelivery(
+ qreq.verb === 'board-comment'
+ ? (qreq as unknown as BoardCommentMessage)
+ : {
- verb: qreq.verb as AgentMessageDeliverRequest['verb'],
++ // A queued station notice flushes as a station notice: the verb rides the queue, so
++ // its app-authored body and its reversed ownership check survive the wait.
++ verb: qreq.verb as AgentMessageDeliveryInput['verb'],
+ sourceNodeId: qreq.sourceNodeId,
+ targetNodeId: qreq.targetNodeId,
+ body: qreq.body
+ },
deps
- ),
- // The trace leg: ring always, board log when the TARGET's owning project is resolvable.
- trace: (input) =>
+ )
+ // A board comment re-queued by the pair window waits on a CLOCK, not on the target's turn:
+ // re-offer it when the window ends (see `DeliveryQueue.retryAfter`).
+ if (qreq.verb === 'board-comment' && outcome.kind === 'rateLimited')
+ queue.retryAfter(qreq.targetNodeId, outcome.retryAfterMs + BOARD_RETRY_SLACK_MS)
+ return outcome
+ },
+ // The trace leg: ring always, board log when the TARGET's owning project is resolvable. A board
+ // comment's lines go to ITS board instead — where its row reads them — whoever owns the pane
+ // by then: a trace is not an authorization, and the expiry is exactly the moment runtime
+ // ownership may be gone or moved (the target restarted), so an expired comment must neither
+ // vanish from its row nor land on another project's board.
+ trace: (input, qreq) =>
recordDelivery(input, {
appendBoardLog: (entry) => {
- const projectId = deps.paneOwnerProject(input.targetNodeId)
+ const projectId =
+ qreq?.verb === 'board-comment' && typeof qreq.projectId === 'string'
+ ? qreq.projectId
+ : deps.paneOwnerProject(input.targetNodeId)
return projectId ? deps.appendBoardLog(projectId, entry) : Promise.resolve(false)
},
now
@@@ -565,26 -525,27 +590,39 @@@ export async function runDelivery
deps: AgentMessagingDeps
): Promise<AgentMessageOutcome> {
const now = deps.now ?? ((): number => Date.now())
+ const board = req.verb === 'board-comment' ? req : null
+ const ident = requestIdentity(req)
+ // The app's own station-failure notice (station-notice.ts): the SOURCE is the station the notice
+ // is about and the TARGET is the agent that opened it. It runs every gate below — scope, the
+ // per-project switch, runtime pane ownership, flow limits, the pane probes, the receipt — with
+ // two differences, both because the app, not the station, is the author: the body was composed
+ // in core from a closed table, and the creator check runs the OTHER way round (the recipient must
+ // have opened the station, which is how the recipient was chosen; re-asked here so a queued
+ // notice is re-validated at flush time like every other delivery).
+ const stationNotice = req.verb === STATION_NOTICE_VERB
const projects = deps.projects()
// WHO MAY BE ADDRESSED — the serialized store, never a live canvas (there is nothing to travel
// toward, by construction: see agent-message-scope.ts). This is also where `isSafeNodeId` runs,
- // which the pair limiter's key and the tmux session namespace both depend on.
- const scope = resolveDeliveryScope(projects, req.sourceNodeId, req.targetNodeId)
+ // which the pair limiter's key and the tmux session namespace both depend on. A board comment has
+ // no sender node, so its scope is the comment's own board.
+ const scope = board
+ ? resolveBoardCommentScope(projects, board.projectId, req.targetNodeId)
+ : resolveDeliveryScope(projects, ident.sourceNodeId, req.targetNodeId)
let notPermitted = scopeRefusal(scope)
const projectId = scope.kind === 'same-project' ? scope.projectId : undefined
- if (!notPermitted && deps.callerOwnsTarget &&
+ // A shell with a creator ledger (the Server Edition) authorizes control by which AGENT spawned
+ // the target. A person's board comment is no agent's, and that shell serves no board-comment
+ // delivery at all — refused by edition rather than squeezed through a ledger it was not built for.
++ // A station notice asks the ledger the other way round (see `stationNotice` above).
+ if (!notPermitted && deps.callerOwnsTarget) {
+ if (board) notPermitted = 'unsupported-edition'
- else if (!deps.callerOwnsTarget(ident.sourceNodeId, req.targetNodeId))
++ else if (
+ !(stationNotice
- ? deps.callerOwnsTarget(req.targetNodeId, req.sourceNodeId)
- : deps.callerOwnsTarget(req.sourceNodeId, req.targetNodeId))) {
- notPermitted = 'caller-not-owner'
++ ? deps.callerOwnsTarget(req.targetNodeId, ident.sourceNodeId)
++ : deps.callerOwnsTarget(ident.sourceNodeId, req.targetNodeId))
++ )
+ notPermitted = 'caller-not-owner'
}
if (!notPermitted) {
// OWNERSHIP IS PROVEN AT RUNTIME, NOT READ FROM THE STORE (PR #237 fix round 2). The scope
@@@ -677,12 -616,14 +715,16 @@@
const outcome = await deliverAgentMessage(
{
targetNodeId: req.targetNodeId,
- sourceNodeId: req.sourceNodeId,
+ sourceNodeId: ident.sourceNodeId,
// The from-line is composed HERE from the store's title (oneLine'd inside buildEnvelope);
- // the renderer never supplies a string that ends up inside the frame.
- sourceTitle: stationNotice ? STATION_NOTICE_FROM : sourceNode?.title || req.sourceNodeId,
- // notify's body is APP-OWNED (#98): substituted here, in main, whatever the request
- // carried — the renderer's `--text` refusal is UX, this line is the boundary. The test
- // sends a hostile body over the IPC shape and asserts it never reaches the envelope.
- body: req.verb === 'notify' ? NOTIFY_BODY : req.body,
+ // the renderer never supplies a string that ends up inside the frame — except a board
+ // comment's author name, which is the local user's own presence name.
- sourceTitle: board ? ident.sourceTitle : sourceNode?.title || ident.sourceNodeId,
++ sourceTitle: board
++ ? ident.sourceTitle
++ : stationNotice
++ ? STATION_NOTICE_FROM
++ : sourceNode?.title || ident.sourceNodeId,
+ body,
targetAgentId,
targetBinaries: binariesFor(targetAgentId, deps.customAgents()),
targetIsRemote: deps.isRemoteNode(req.targetNodeId),
@@@ -734,18 -665,8 +776,18 @@@ const QUEUE_ON_BUSY: ReadonlySet<AgentM
* once the flush delivers them.
*/
export async function deliverFromControl(
- req: AgentMessageDeliverRequest,
+ req: AgentMessageDeliveryInput,
deps: AgentMessagingDeps
+): Promise<{ outcome: AgentMessageOutcome; reply: AgentMessageReply }> {
+ return deliverWithQueue(req, deps)
+}
+
+/** `deliverFromControl`'s body, for either origin: attempt, then queue a permitted-but-not-ready
+ * target when a queue is wired. The queued request carries everything a flush needs to re-run the
+ * SAME origin's gate chain — a queued board comment flushes as a board comment. */
+async function deliverWithQueue(
+ req: MessagingRequest,
+ deps: AgentMessagingDeps
): Promise<{ outcome: AgentMessageOutcome; reply: AgentMessageReply }> {
const answer = (
outcome: AgentMessageOutcome
@@@ -786,38 -699,32 +828,63 @@@
return answer(outcome)
}
+/**
+ * Deliver ONE mentioned session's copy of a board comment the local user just posted.
+ *
+ * The ONE caller is the comment composer's send handler (via the desktop's main-window-only IPC
+ * channel). There is deliberately no path from anything that READS the board log to here: a comment
+ * that arrives by git pull, by another instance writing the file, from a relay peer or a
+ * team-presence guest is display-only. Its tokens render as names and never type into a pane.
+ *
+ * Everything is re-derived in this process from the request's text: the addressed session must be
+ * one the text mentions, the body is built from the text, and every gate `send` takes runs here.
+ */
+export async function deliverBoardCommentFromUi(
+ raw: unknown,
+ deps: AgentMessagingDeps
+): Promise<AgentMessageReply> {
+ if (!isBoardCommentDeliverRequest(raw))
+ return { ok: false, error: 'malformed board-comment delivery request. Do not retry.' }
+ const { reply } = await deliverWithQueue(
+ {
+ verb: 'board-comment',
+ projectId: raw.projectId,
+ commentId: raw.commentId,
+ author: raw.author,
+ text: raw.text,
+ targetNodeId: raw.targetNodeId
+ },
+ deps
+ )
+ return reply
+}
+
- /** Guard for the IPC boundary: the request came over a channel, so its shape is asserted here. */
+ /**
+ * Deliver a station-failure notice into the pane of the agent that opened the station — the pane
+ * leg of `station-notice.ts`. The same gate chain and the same deliver-on-idle queue as `send`
+ * (a busy orchestrator is not interrupted; the notice waits for its next idle moment), with the
+ * app as the author. `body` must come from `stationNoticeBody`; nothing outside core can reach
+ * this function with a body of its own, because `STATION_NOTICE_VERB` is not an IPC verb.
+ */
+ export async function deliverStationNotice(
+ notice: { stationNodeId: string; recipientNodeId: string; body: string },
+ deps: AgentMessagingDeps
+ ): Promise<AgentMessageOutcome> {
+ const { outcome } = await deliverFromControl(
+ {
+ verb: STATION_NOTICE_VERB,
+ sourceNodeId: notice.stationNodeId,
+ targetNodeId: notice.recipientNodeId,
+ body: notice.body
+ },
+ deps
+ )
+ return outcome
+ }
+
+ /** Guard for the IPC boundary: the request came over a channel, so its shape is asserted here.
+ * `AGENT_MESSAGE_VERBS` does not contain `STATION_NOTICE_VERB`, so a notice with a body of the
+ * caller's choosing is refused here — the one door a renderer has into this service. */
export function isDeliverRequest(x: unknown): x is AgentMessageDeliverRequest {
const r = x as AgentMessageDeliverRequest | null
return (
diff --cc src/core/canvas-control-core.ts
index cfe356816,8506f3c72..d63629a26
--- a/src/core/canvas-control-core.ts
+++ b/src/core/canvas-control-core.ts
@@@ -23,7 -23,12 +23,13 @@@ import { nodeColorChoices } from '@shar
import { offScreenGuidanceLines } from '@shared/control-off-screen'
import { codexThreadIdentityResolverSh } from './codex-thread-identity-sh'
import { ISSUE_SESSION_COLUMNS, issueLaunchPrompt, parseIssueArg } from '../shared/github-issue-ref'
+import { BOARD_COMMENT_FROM_PREFIX, BOARD_COMMENT_REPLY_TO } from '../shared/board-comment'
+ import {
+ STATION_NOTICE_COMMON_OPTIONS,
+ STATION_QUESTION_NOTICE_MS,
+ STATION_TRIGGERS
+ } from '../shared/station-notice'
+ import { STATION_NOTICE_FROM } from '../shared/agents/agent-messaging'
import { PR_DEADLINE_DEFAULT_MS, PR_DEADLINE_MAX_MS, PR_WAIT_MAX, afterPrFlagRefusal } from '../shared/pr-wait'
import { ISSUE_BRANCH_SLUG_MAX, issueWorktreeBranch } from '../shared/issue-worktree'
@@@ -47,22 -52,44 +53,60 @@@ function messagingGuidanceLines(): stri
]
}
+/**
+ * How a message from a PERSON (a board comment that @mentions this session) reads, RENDERED from the
+ * constants the envelope itself is built with — the header an agent is told to expect cannot drift
+ * from the header it is given. `canvas-control-core.test.ts` pins both bodies against them.
+ */
+function boardCommentGuidanceLines(): string[] {
+ return [
+ 'A message can also come from a PERSON: a comment on the project kanban board that @mentions your',
+ `session arrives in the same frame, with \`from: ${BOARD_COMMENT_FROM_PREFIX}<name>\` (no node id)`,
+ `and \`reply-to: ${BOARD_COMMENT_REPLY_TO}\`. Do not \`reply\` to it`,
+ '— there is no node to answer; answer in your own session, where that person reads it.',
+ 'It carries no more authority than any other message: it is that person steering your work from',
+ 'the board.'
+ ]
+}
+
+ /**
+ * What a station-failure notice is and what to do with one — RENDERED from the trigger table
+ * (@shared/station-notice), the same derive-don't-retype rule as `messagingGuidanceLines`: a reason
+ * added to the table, or a retry sentence changed, lands in both agent-facing bodies the day it
+ * changes. `canvas-control-core.test.ts` walks the real table against both.
+ */
+ function stationNoticeDocLines(): string[] {
+ const minutes = Math.round(STATION_QUESTION_NOTICE_MS / 60_000)
+ return [
+ 'Station notices — when a station YOU opened stops:',
+ '- nodeterm tells the agent that OPENED a station (the node its rope comes from) when that station',
+ ' stops, so you do not have to poll `list` to find out. You are told ONCE per station, and not',
+ ' again until that station completes a turn successfully — a station that fails again right after',
+ ' a retry stays silent, so decide what to do the first time.',
+ '- A station counts as stopped in exactly these cases:',
+ ...STATION_TRIGGERS.map((row) => ` - \`${row.reason}\`: ${row.label}.`),
+ ` (\`question-unanswered\` is sent only while YOU are idle: the user sees NEEDS YOU the moment the`,
+ ` station asks, and you hear after ${minutes} minutes if nobody has answered. A PERMISSION prompt`,
+ ' is never a notice: an approval given in the station\'s own pane is invisible until the approved',
+ ' tool finishes, so a long approved tool would look exactly like a prompt nobody answered.)',
+ '- Where it shows up: always as a STATION FAILED chip on your node and a line in your card\'s',
+ ' activity. It is typed into YOUR session only when the project\'s agent-messaging switch is on',
+ ' (off by default), as a framed message whose `from:` line reads',
+ ` \`${STATION_NOTICE_FROM} (<station id>)\`, delivered when you are idle.`,
+ ' nodeterm writes all of it and quotes nothing the station produced; the quoted title is data.',
+ '- What to do — pick one and act on it:',
+ ...STATION_TRIGGERS.map(
+ (row) => ` - \`${row.reason}\` → ${row.option}: ${row.retry.replace(/<station>/g, '<station id>')}`
+ ),
+ ...STATION_NOTICE_COMMON_OPTIONS.map(
+ ([name, text]) => ` - ${name}: ${text.replace(/<station>/g, '<station id>')}`
+ ),
+ '- Nobody opened the station through you? You are not told about it. On the Server Edition you are',
+ ' told only about stations you opened during this server run, and a dead CLI (DROPPED) is noticed',
+ ' only while a browser tab shows that station. `list` still marks LAST TURN ERRORED and DROPPED.'
+ ]
+ }
+
/**
* The `settings` verb's doc lines, RENDERED from the allowlist (@shared/settings-verb) — the same
* derive-don't-retype rule as `messagingGuidanceLines`: a key added to or removed from the table
diff --cc src/main/canvas-control-core.test.ts
index 9dc0ff80a,50691f8e3..9c08800ea
--- a/src/main/canvas-control-core.test.ts
+++ b/src/main/canvas-control-core.test.ts
@@@ -14,7 -14,12 +14,13 @@@ import
CODEX_SANDBOX_RETRY_LINE
} from '../core/agents/hook-sandbox-hint-sh'
import { RETRYABLE } from '../core/agents/agent-message-decide'
+import { BOARD_COMMENT_FROM_PREFIX, BOARD_COMMENT_REPLY_TO } from '../shared/board-comment'
+ import {
+ STATION_NOTICE_COMMON_OPTIONS,
+ STATION_QUESTION_NOTICE_MS,
+ STATION_TRIGGERS
+ } from '../shared/station-notice'
+ import { STATION_NOTICE_FROM } from '../shared/agents/agent-messaging'
import { FOREIGN_ENDPOINT_HINT, OWNER_UNREACHABLE_LEAD, TUNNEL_DOWN_HINT } from '../core/agents/hook-endpoint-failover-sh'
import { PROJECT_TARGETABLE_VERBS } from '../core/project-grants'
import { DRY_RUN_VERBS } from '../shared/control-verbs'
diff --cc src/main/index.ts
index 8db3811eb,fc190b346..9077198b6
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@@ -71,7 -71,7 +71,8 @@@ import { appendBoardLogVia, registerBoa
import {
createDeliveryQueue,
deliverFromControl,
+ deliverBoardCommentFromUi,
+ deliverStationNotice,
isDeliverRequest,
messagingEnabledVia,
onMessagingAgentEvent,
@@@ -1904,17 -1906,32 +1907,42 @@@ app.whenReady().then(async () =>
const { reply } = await deliverFromControl(raw, messagingDeps)
return reply
})
+ // A board comment that @mentions a session (the comment composer's send). Raw ipcMain on purpose —
+ // invisible to relay peers (platform-electron.ts, invariant 4c) — and guarded to the live main
+ // window, because a <webview> guest is a webContents in this process too and this handler types
+ // into a pane. Everything else (the mention↔target check, scope, ownership, switch, flow, the
+ // envelope, the queue) is `deliverBoardCommentFromUi`, over the SAME deps the agent verbs use.
+ ipcMain.handle(IPC.agentBoardCommentDeliver, async (event, raw: unknown) => {
+ if (getMainWindow()?.webContents.id !== event.sender.id)
+ return { ok: false, error: 'board comments are delivered only from the main window.' }
+ return deliverBoardCommentFromUi(raw, messagingDeps)
+ })
+ // Station-failure notices (src/core/agents/station-notice.ts): when a station an agent opened
+ // stops — its turn errored, its CLI died, or it sat on an unanswered prompt while the agent that
+ // opened it idled — that agent is told ONCE. The recipient comes from MAIN's persisted canvases
+ // (the station's `openedBy` plus that agent's rope to it), never from the renderer; the canvas
+ // leg (board-log line + chip) needs no switch, the pane leg is the messaging service above with
+ // every one of its gates, the per-project `agentMessaging` switch included.
+ const stationNotices = new StationNoticeMonitor({
+ now: () => Date.now(),
+ recipientFor: (id) => stationRecipient(workspaceStore.persistedCanvases(), id),
+ // The mirror's correlated, unanswered question — the one fact that says a station is really
+ // waiting on a human (station-notice.ts: permission prompts are not a trigger).
+ pendingQuestionOf: (id) => mirrorEntry(id)?.pendingQuestion?.toolUseId,
+ appendBoardLog: (projectId, entry) => appendBoardLogVia(boardLogRouter, projectId, entry),
+ deliver: (notice) => deliverStationNotice(notice, messagingDeps),
+ publish: (views) => sendToMain(IPC.stationNoticeChanged, views),
+ // The memoized index scan, not `getNode` (which re-parses a project file per call): the sweep
+ // asks this for every node it tracks.
+ exists: (id) => workspaceStore.projectIdsForNode(id).length > 0
+ })
+ stationNotices.start()
+ // A queued notice's final outcome (flushed or expired) comes back here, so its chip never says
+ // "queued" about a message that has since landed or lapsed.
+ messagingDeps.onQueuedResult = (req, outcome) => stationNotices.onQueuedResult(req, outcome)
+ registerStationNoticeIpc(corePlatform, () => stationNotices)
+
ipcMain.handle(IPC.dialogSelectFolder, async () => {
const result = await dialog.showOpenDialog({ properties: ['openDirectory', 'createDirectory'] })
return result.canceled || result.filePaths.length === 0 ? null : result.filePaths[0]
diff --cc src/preload/index.ts
index 3e4ed949a,02ba9dc95..18b08757e
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@@ -855,8 -855,18 +855,19 @@@ const api: NodeTerminalApi =
},
sendHostChatReply: (reply) => ipcRenderer.send(IPC.hostChatReply, reply),
agentMessage: {
- deliver: (req) => ipcRenderer.invoke(IPC.agentMessageDeliver, req)
+ deliver: (req) => ipcRenderer.invoke(IPC.agentMessageDeliver, req),
+ deliverBoardComment: (req) => ipcRenderer.invoke(IPC.agentBoardCommentDeliver, req)
+ },
+ stationNotice: {
+ list: () => ipcRenderer.invoke(IPC.stationNoticeList),
+ onChanged: (cb) => {
+ const handler = (_e: unknown, views: Parameters<typeof cb>[0]) => cb(views)
+ ipcRenderer.on(IPC.stationNoticeChanged, handler)
+ return () => ipcRenderer.removeListener(IPC.stationNoticeChanged, handler)
+ },
+ reportDropped: (nodeId, dropped) => {
+ void ipcRenderer.invoke(IPC.stationNoticeDropped, nodeId, dropped).catch(() => undefined)
+ }
}
}
diff --cc src/renderer/bridge/stubs.ts
index 1bb11dff0,7482c9dd8..99cf54b66
--- a/src/renderer/bridge/stubs.ts
+++ b/src/renderer/bridge/stubs.ts
@@@ -573,15 -573,14 +573,22 @@@ export function buildStubApi(): Omit
deliver: async () => ({
ok: false as const,
error: 'Agent messaging is only available in the desktop app. Do not retry.'
+ }),
+ // A board comment typed here — in a browser tab, or in a relay tab onto another machine — is
+ // display-only on purpose: it never types into a pane. The typed outcome lets the comment row
+ // say so instead of showing nothing.
+ deliverBoardComment: async () => ({
+ ok: false as const,
+ error: 'Board comments reach agents only in the desktop app.',
+ result: { kind: 'notPermitted', reason: 'unsupported-edition' }
})
+ },
+ // Inert by default: the Server Edition overrides it with the real bridge
+ // (`buildStationNoticeApi`), and a relay tab keeps this — its stations belong to the host's core.
+ stationNotice: {
+ list: async () => [],
+ onChanged: noopUnsub,
+ reportDropped: noop
}
} satisfies Omit<
NodeTerminalApi,
diff --cc src/renderer/components/kanban/BoardLogPanel.tsx
index ff675844f,abc6d57c4..46c7d7cbe
--- a/src/renderer/components/kanban/BoardLogPanel.tsx
+++ b/src/renderer/components/kanban/BoardLogPanel.tsx
@@@ -11,22 -4,8 +11,23 @@@ import { formatTimeAgo } from '../../li
import { useSession } from '../../session/session'
import { useProjects } from '../../state/projects'
import { useBoardLog } from '../../state/boardLog'
+import { useBoardCommentDelivery } from '../../state/boardCommentDelivery'
import { collapseFeed } from '../../lib/boardLogCollapse'
+import {
+ boardCommentTraces,
+ isBoardCommentTrace,
+ mentionStatuses,
+ type MentionStatus
+} from '../../lib/boardCommentStatus'
+import { canDeliverBoardComments, deliverCommentMentions } from '../../lib/boardCommentDelivery'
+import {
+ insertMention,
+ mentionOptions,
+ mentionQueryAt,
+ type MentionCandidate
+} from '../../lib/boardMentions'
+import { isBrowserRuntime } from '../../bridge/runtime'
+ import { stationTrigger } from '@shared/station-notice'
import type { KanbanSession } from './KanbanView'
interface BoardLogPanelProps {
diff --cc src/shared/host-control.test.ts
index 67237632f,e1b7770a4..e7b57696e
--- a/src/shared/host-control.test.ts
+++ b/src/shared/host-control.test.ts
@@@ -34,13 -34,13 +34,20 @@@ describe('isHostOnlyChannel', () =>
expect(isHostOnlyChannel(IPC.ptyLaunchHeadless)).toBe(true)
})
+ it('covers the board-comment delivery — a peer must never type a comment into a host pane', () => {
+ // A board comment typed by a relay guest or a team-presence peer is cross-user prompt
+ // injection. The channel is registered with a raw `ipcMain.handle` (invisible to peers), and
+ // listed here as the belt: moving it onto the platform table later must not open it.
+ expect(isHostOnlyChannel(IPC.agentBoardCommentDeliver)).toBe(true)
+ })
+
+ it('covers both station-notice request channels', () => {
+ // A guest may not report a pane verdict about the host's nodes…
+ expect(isHostOnlyChannel(IPC.stationNoticeDropped)).toBe(true)
+ // …nor list every project's failed stations: a guest scoped to one project must not read the rest.
+ expect(isHostOnlyChannel(IPC.stationNoticeList)).toBe(true)
+ })
+
it('leaves the read-only/lifecycle channels alone — the gate is on ACTION, not on the namespace', () => {
// Subscribing and receiving events costs a guest nothing the canvas does not already show;
// running host code, and answering the host's own trust prompt, are the two acts being gated.
diff --cc src/shared/host-control.ts
index 819fd49ca,d82b95811..9c65d8fde
--- a/src/shared/host-control.ts
+++ b/src/shared/host-control.ts
@@@ -42,11 -48,8 +48,13 @@@ export const HOST_ONLY_CHANNELS: Readon
IPC.projectSetupConsentSubmit,
IPC.projectSetupRequestTrust,
IPC.ptyLaunchHeadless,
+ // A board comment that @mentions a session types into that session's pane. Only the host's own
+ // user may do that: a relay peer's comment is display-only. Registered with a raw ipcMain handler
+ // (so no peer can reach it at all); listed here too, so moving it onto the platform table later
+ // cannot quietly open it.
- IPC.agentBoardCommentDeliver
++ IPC.agentBoardCommentDeliver,
+ IPC.stationNoticeDropped,
+ IPC.stationNoticeList
])
/** What a refused peer is told. One wording, so the two shells answer identically. */
diff --cc src/shared/ipc.ts
index 5ea93bb2a,476ae1164..f39ed526b
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@@ -228,10 -228,14 +228,18 @@@ export const IPC =
agentControl: 'agent:control',
agentControlResult: 'agent:control-result',
agentMessageDeliver: 'agent:message-deliver',
+ /** Renderer → main: deliver ONE mentioned session's copy of a board comment the local user just
+ * posted (`deliverBoardCommentFromUi`). Desktop-only, main-window-only, never peer-dispatchable —
+ * see src/main/board-comment-wiring.test.ts. Arg: `BoardCommentDeliverRequest`. */
+ agentBoardCommentDeliver: 'agent:board-comment-deliver',
+ /** Station-failure notices (src/core/agents/station-notice.ts). invoke: the current list
+ * (StationNoticeView[]) for a renderer that booted after the last push. */
+ stationNoticeList: 'station-notice:list',
+ /** renderer → core: the renderer's DROPPED verdict for one node (`nodeId, dropped`) — the one
+ * trigger fact core cannot measure itself (it needs the renderer's hibernated/paused flags). */
+ stationNoticeDropped: 'station-notice:dropped',
+ /** core → every renderer: the FULL current notice list on each change, never a delta. */
+ stationNoticeChanged: 'station-notice:changed',
/** Canvas sync: a client casts its local node mutations here; the core reflector
* (src/core/canvas-sync.ts) stamps each with the total order (`seq`) and sends it back out on the
* SAME channel to EVERY attached client — the sender included, whose copy is its ack (see
diff --cc src/shared/types.ts
index 2419115c9,72273ed0e..7bd03105f
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@@ -4075,9 -4087,14 +4091,18 @@@ export interface NodeTerminalApi
* already rendered as a control reply — Canvas forwards it verbatim. */
agentMessage: {
deliver(req: AgentMessageDeliverRequest): Promise<AgentMessageReply>
+ /** Deliver one mentioned session's copy of a board comment the local user just posted, through
+ * the same gates. `result` carries the typed outcome the comment row renders. Desktop only: the
+ * browser and relay bridges answer `notPermitted: unsupported-edition`. */
+ deliverBoardComment(req: BoardCommentDeliverRequest): Promise<AgentMessageReply>
}
+ /** Station-failure notices (@shared/station-notice, src/core/agents/station-notice.ts): the
+ * chips on an orchestrator whose stations stopped, and the renderer's DROPPED verdicts, which
+ * are the one trigger fact core cannot measure. Desktop and Server Edition are real; a relay
+ * tab's stations belong to the host's core, so there it is inert. */
+ stationNotice: {
+ list(): Promise<import('./station-notice').StationNoticeView[]>
+ onChanged(cb: (views: import('./station-notice').StationNoticeView[]) => void): () => void
+ reportDropped(nodeId: string, dropped: boolean): void
+ }
}