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
docs(canvas-sync): the seen clamp is hygiene, and name where the relay mirror lives
review78df8c190a46
diff --git a/src/core/canvas-sync.test.ts b/src/core/canvas-sync.test.tsindex c7a099120..3dc311819 100644--- a/src/core/canvas-sync.test.ts+++ b/src/core/canvas-sync.test.ts@@ -110,9 +110,10 @@ describe('stampMutation', () => {).toBeUndefined()})- // `seen` (canvas-order rule 4) is the one client-supplied field that DECIDES something: an upsert- // claiming to have seen a node's delete is applied over it. A forged one resurrects a node a- // teammate deleted — on every canvas. It can never legitimately reach the order it is being given.+ // `seen` (canvas-order rule 4): an upsert claiming to have seen a node's delete is applied over it.+ // It can never legitimately reach the order it is being given, so it is clamped below it. The+ // clamp is hygiene, not protection: it changes no verdict (every earlier remove is at most+ // `seq - 1`), so a forged `seen` still resurrects a deleted node, clamp or no clamp.it('passes an honest `seen` through untouched', () => {expect(stampMutation({ op: 'upsert', node: node('n1'), seen: 6 }, 9).seen).toBe(6)expect(stampMutation({ op: 'upsert', node: node('n1'), seen: 0 }, 1).seen).toBe(0)diff --git a/src/core/canvas-sync.ts b/src/core/canvas-sync.tsindex 8cc72ceee..b48984642 100644--- a/src/core/canvas-sync.ts+++ b/src/core/canvas-sync.ts@@ -75,13 +75,15 @@ export function reflectTargets(all: ClientId[], _sender: ClientId): ClientId[] {* another client's tag, which would only ever make that client ignore an edit meant for it, but is* still not something to reflect unchecked.*- * `seen` is the sender's causal position (canvas-order rule 4), and it is the one client-supplied- * value that DECIDES something: an upsert claiming to have seen a node's delete is applied over it.- * A forged one is therefore a way to resurrect a node a teammate deleted. It cannot legitimately- * reach the order this mutation is being GIVEN (the sender can only have seen `seq`s already- * assigned), so clamp it there — an honest client is never touched, and a liar buys itself nothing- * beyond the moment it actually cast. A non-integer / negative value is dropped, which degrades to- * "unstamped" (judged exactly as before rule 4 existed), never to a value that outranks a delete.+ * `seen` is the sender's causal position (canvas-order rule 4): an upsert claiming to have seen a+ * node's delete is applied over it. It cannot legitimately reach the order this mutation is being+ * GIVEN (the sender can only have seen `seq`s already assigned), so it is clamped to `seq - 1`, and+ * a non-integer / negative value is dropped ("unstamped": judged exactly as before rule 4 existed).+ * That is HYGIENE, NOT PROTECTION: the clamp changes no verdict. Every remove ordered before this+ * mutation has a `seq` at most `seq - 1`, so a clamped forgery still counts as having seen it, and a+ * remove ordered after it supersedes it by `seq` alone. A forged `seen` resurrects a node a teammate+ * deleted either way; what bounds that is who may cast at all (`canvas:mut` is Editor-only on a+ * hosted team, src/core/relay/access-policy.ts).*/export function stampMutation<M extends CanvasMutation>(m: M, seq: number): M & MutationStamp {const stamped: M & MutationStamp = { ...m, seq }diff --git a/src/shared/types.ts b/src/shared/types.tsindex a34299267..b70ffb207 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -654,10 +654,13 @@ export interface CanvasState {* - `seen` is the sender's CAUSAL stamp: the highest `seq` it had applied at the moment it cast.* It answers the one question `seq` alone cannot — "did this client already know about the* delete?" — which is what lets a delete beat a concurrent drag frame instead of being- * resurrected by it (canvas-order's rule 4). Client-supplied, so the reflector BOUNDS it- * (it can never legitimately reach the order it is being given); a mutation without it is- * judged exactly as before, so an unstamped peer degrades rather than breaks.- * The relay's host↔client mirror (src/main/remote) uses the same vocabulary and simply omits them.+ * resurrected by it (canvas-order's rule 4). Client-supplied; the reflector clamps it below the+ * order it is being given, which is hygiene and changes no verdict (see `stampMutation`). A+ * mutation without it is judged exactly as before, so an unstamped peer degrades rather than+ * breaks.+ * The legacy relay host's canvas mirror (`canvas:state` / `canvas:mutate`: src/main/remote/+ * host-service.ts and canvas-sync.ts, which stayed there when the relay transport moved to+ * src/core/relay) uses the same vocabulary and simply omits them.*/export type CanvasMutation =| { op: 'upsert'; node: CanvasNodeState; src?: string; seq?: number; seen?: number }