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.

fix(lib): write the NUL separators as escapes, not raw bytes

enes4c0e8c34dd78
diff --git a/src/renderer/lib/noteLink.test.ts b/src/renderer/lib/noteLink.test.ts
index 2fb7ab33b..f654eaeb5 100644
--- a/src/renderer/lib/noteLink.test.ts
+++ b/src/renderer/lib/noteLink.test.ts
@@ -7,6 +7,7 @@ import {
classifyLink,
hiddenLinkIds,
linkIdsCoveredByRopes,
+ pairKey,
planBridges
} from './noteLink'
import type { CanvasNodeState } from '@shared/types'
@@ -327,3 +328,14 @@ describe('buildNotePushMessage per-agent wording', () => {
expect(msg).not.toContain('skill]')
})
})
+
+describe('pairKey', () => {
+ it('joins the two ids with a NUL, ordered, so the key is direction-free', () => {
+ // Pinned deliberately: the separator is a real NUL because it cannot occur in a node id, so
+ // no pair of ids can collide by containing the separator themselves. This test exists so the
+ // separator can never be "tidied" into a printable character by accident.
+ expect(pairKey('b', 'a')).toBe('a\0b')
+ expect(pairKey('a', 'b')).toBe(pairKey('b', 'a'))
+ expect([...pairKey('a', 'b')].map((c) => c.charCodeAt(0))).toEqual([97, 0, 98])
+ })
+})
diff --git a/src/renderer/lib/noteLink.ts b/src/renderer/lib/noteLink.ts
index 32ed0cecc..aede50062 100644
Binary files a/src/renderer/lib/noteLink.ts and b/src/renderer/lib/noteLink.ts differ
diff --git a/src/shared/rpc.test.ts b/src/shared/rpc.test.ts
index 7dc575776..6c5b21082 100644
Binary files a/src/shared/rpc.test.ts and b/src/shared/rpc.test.ts differ