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(control): fold in #98's notify — app-owned text, through the one delivery path

enese5fd27b5cb83
diff --git a/src/core/agents/hook-server.ts b/src/core/agents/hook-server.ts
index 713b6e5a0..d07ed9403 100644
--- a/src/core/agents/hook-server.ts
+++ b/src/core/agents/hook-server.ts
@@ -172,7 +172,7 @@ export interface HookEventMeta {
* the policy table can widen it; `messaging-verified-only.test.ts` drives the route on both sides
* of every hatch and is the test that fails if either half of this comment stops being true.
*/
-export const requiresVerified: ReadonlySet<string> = new Set(['send', 'reply'])
+export const requiresVerified: ReadonlySet<string> = new Set(['send', 'reply', 'notify'])
/**
* The refusal for a messaging verb: one sentence, no diagnosis, no hint about tokens or restarts —
diff --git a/src/core/agents/messaging-verified-only.test.ts b/src/core/agents/messaging-verified-only.test.ts
index 22b7d0ce0..9ca58d4e9 100644
--- a/src/core/agents/messaging-verified-only.test.ts
+++ b/src/core/agents/messaging-verified-only.test.ts
@@ -138,6 +138,8 @@ describe('where the verbs sit in the routing tables', () => {
it('the verified-only set is exactly the messaging verbs', () => {
// Pins that nothing ELSE ever drifts in: adding a SHIPPED verb here would strand its legacy
// population with no hatch, which is the one thing this set must never be casually grown by.
- expect([...requiresVerified].sort()).toEqual(['reply', 'send'])
+ // `notify` (folded in from #98, Task 5.2) is a messaging verb like the other two — it writes
+ // into another agent's pane — so it takes the same gate.
+ expect([...requiresVerified].sort()).toEqual(['notify', 'reply', 'send'])
})
})
diff --git a/src/main/agent-messaging.test.ts b/src/main/agent-messaging.test.ts
index d4f779eb4..3ae772a93 100644
Binary files a/src/main/agent-messaging.test.ts and b/src/main/agent-messaging.test.ts differ
diff --git a/src/main/agent-messaging.ts b/src/main/agent-messaging.ts
index 6212bcef8..dcf393654 100644
--- a/src/main/agent-messaging.ts
+++ b/src/main/agent-messaging.ts
@@ -25,7 +25,7 @@ import type {
AgentMessageDeliverRequest,
AgentMessageReply
} from '../shared/agents/agent-messaging'
-import { AGENT_MESSAGE_VERBS } from '../shared/agents/agent-messaging'
+import { AGENT_MESSAGE_VERBS, NOTIFY_BODY } from '../shared/agents/agent-messaging'
import {
deliverAgentMessage,
type DeliveryDeps,
@@ -345,7 +345,10 @@ export async function deliverFromControl(
// 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: sourceNode?.title || req.sourceNodeId,
- body: req.body,
+ // 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,
targetAgentId,
targetBinaries: binariesFor(targetAgentId, deps.customAgents()),
targetIsRemote: deps.isRemoteNode(req.targetNodeId),
diff --git a/src/main/canvas-control-core.test.ts b/src/main/canvas-control-core.test.ts
index c91b48ca8..c0e45c387 100644
--- a/src/main/canvas-control-core.test.ts
+++ b/src/main/canvas-control-core.test.ts
@@ -259,4 +259,17 @@ describe('the messaging verbs parse', () => {
error: 'reply requires --node <id>'
})
})
+
+ // #98's validation, kept verbatim: notify carries NO caller text — its body is app-owned.
+ it('requires a target for notify and does not accept message text', () => {
+ expect(parseControlRequest('notify', {})).toEqual({ error: 'notify requires --node <id>' })
+ expect(parseControlRequest('notify', { node: 'n1' })).toEqual({
+ verb: 'notify',
+ args: { node: 'n1' }
+ })
+ expect(parseControlRequest('notify', { node: 'n1', text: 'custom prompt' })).toEqual({
+ error: 'notify does not accept --text'
+ })
+ expect(isDestructiveVerb('notify')).toBe(false)
+ })
})
diff --git a/src/main/canvas-control-core.ts b/src/main/canvas-control-core.ts
index ff5669b8e..c2f290114 100644
--- a/src/main/canvas-control-core.ts
+++ b/src/main/canvas-control-core.ts
@@ -30,6 +30,7 @@ export type ControlVerb =
| 'assign'
| 'send'
| 'reply'
+ | 'notify'
export interface ControlCommand {
verb: ControlVerb
@@ -62,7 +63,8 @@ const VERBS: ControlVerb[] = [
'board',
'assign',
'send',
- 'reply'
+ 'reply',
+ 'notify'
]
/**
@@ -116,6 +118,8 @@ export function parseControlRequest(
if (v === 'rename' && !args.node) return { error: 'rename requires --node <id>' }
if (v === 'rename' && !args.title) return { error: 'rename requires --title' }
if ((v === 'send' || v === 'reply') && !args.node) return { error: `${v} requires --node <id>` }
+ if (v === 'notify' && !args.node) return { error: 'notify requires --node <id>' }
+ if (v === 'notify' && args.text) return { error: 'notify does not accept --text' }
return { verb: v, args }
}
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 40456646d..1745e97a0 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -6008,13 +6008,20 @@ export function Canvas() {
// control-capable agent, and forward to main — where the scope check, the per-project
// switch, flow control and the pane probes all run against main's own stores
// (src/main/agent-messaging.ts).
- if (verb === 'send' || verb === 'reply') {
+ if (verb === 'send' || verb === 'reply' || verb === 'notify') {
const targetId = (args.node ?? '').trim()
if (!targetId) {
reply({ ok: false, error: `${verb} requires --node` })
return
}
- if (!args.text) {
+ // notify is APP-OWNED TEXT ONLY (#98's rule, kept verbatim): the caller cannot smuggle a
+ // prompt through its arguments. The body itself is substituted in MAIN (NOTIFY_BODY) —
+ // this refusal is the polite half, that substitution is the boundary.
+ if (verb === 'notify' && args.text) {
+ reply({ ok: false, error: 'notify does not accept --text' })
+ return
+ }
+ if (verb !== 'notify' && !args.text) {
reply({ ok: false, error: `${verb} requires --text` })
return
}
diff --git a/src/shared/agents/agent-messaging.ts b/src/shared/agents/agent-messaging.ts
index 55d4c8d9d..407c01940 100644
--- a/src/shared/agents/agent-messaging.ts
+++ b/src/shared/agents/agent-messaging.ts
@@ -5,11 +5,12 @@
* is deliberately types + one constant.
*/
-export type AgentMessageVerb = 'send' | 'reply'
+export type AgentMessageVerb = 'send' | 'reply' | 'notify'
export const AGENT_MESSAGE_VERBS: ReadonlySet<string> = new Set([
'send',
- 'reply'
+ 'reply',
+ 'notify'
] satisfies AgentMessageVerb[])
/** What the renderer forwards to main for one delivery. Deliberately minimal: the source TITLE,
@@ -20,10 +21,22 @@ export interface AgentMessageDeliverRequest {
verb: AgentMessageVerb
sourceNodeId: string
targetNodeId: string
- /** The sender's text. */
+ /** The sender's text for send/reply. IGNORED for notify — its body is app-owned and composed
+ * in main (`NOTIFY_BODY`), which is the whole point of that verb. */
body: string
}
+/**
+ * `notify`'s entire body — fixed, app-owned, and substituted in MAIN whatever the request
+ * carries. Folded in from PR #98, whose design line survives verbatim: "The app owns the entire
+ * prompt so the source cannot inject instructions through command arguments." #98's "check your
+ * configured inbox" wording is dropped — the product has no inbox concept; the linked context is
+ * the thing a notified agent can actually read.
+ */
+export const NOTIFY_BODY =
+ 'A linked agent updated shared coordination context. Read the latest linked context ' +
+ '(get-linked-context) before continuing.'
+
/** The rendered control reply for one delivery — the exact shape every other control verb answers
* with, so the hook server and the shim need no messaging-specific branch. */
export interface AgentMessageReply {