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(renderer): the create dialog reads session protection from the local session

review472ebd7de048
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 58f5cf8ca..970d36662 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -3618,6 +3618,10 @@ export function Canvas() {
[persist]
)
+ /** R63: the create dialog's "only while open" note reads the LOCAL core's session protection — the
+ * core that hosts the link (never a relay tab's peer). Stable, so the dialog reads it once. */
+ const readLocalPersistence = useCallback(() => localSession.api.pty.tmuxStatus(), [])
+
/** R48: "Stop all" revokes every link of the LICENSE — other machines' included — and cannot be
* undone, so the palette asks first, with the same sentence and danger button as Settings. R62:
* what it reached is ALWAYS said — a success too, since with no link listed here nothing else on
@@ -18569,6 +18573,7 @@ export function Canvas() {
// R63: an SSH project's node runs in the HOST's tmux, which gives a viewer a client of its
// own — the "only while open" note is about this machine's local terminals.
remoteNode={!!useProjects.getState().getProject(liveLinkDialog.projectId)?.ssh}
+ readPersistence={readLocalPersistence}
prepare={liveLinkPrepareFor(liveLinkDialog)}
// No license layer in the Server Edition (R43): never an Upgrade button there.
onUpgrade={isBrowserRuntime() ? undefined : () => void useEntitlement.getState().upgrade('pro')}
diff --git a/src/renderer/canvas/live-link-wiring.test.ts b/src/renderer/canvas/live-link-wiring.test.ts
index 2bdf42c03..97e41766d 100644
--- a/src/renderer/canvas/live-link-wiring.test.ts
+++ b/src/renderer/canvas/live-link-wiring.test.ts
@@ -53,6 +53,9 @@ describe('Canvas live-link wiring', () => {
it("R63: the dialog knows an SSH project's node from its project (the host's tmux serves its viewers)", () => {
expect(src).toContain('remoteNode={!!useProjects.getState().getProject(liveLinkDialog.projectId)?.ssh}')
+ // …and reads THIS machine's session protection from the local core, never a relay peer's.
+ expect(src).toContain('readPersistence={readLocalPersistence}')
+ expect(callback('readLocalPersistence')).toContain('localSession.api.pty.tmuxStatus()')
})
it('R43: no Upgrade button from the dialog on the Server Edition', () => {
diff --git a/src/renderer/components/LiveLinkDialog.test.tsx b/src/renderer/components/LiveLinkDialog.test.tsx
index 881e80e50..a28e0cf49 100644
--- a/src/renderer/components/LiveLinkDialog.test.tsx
+++ b/src/renderer/components/LiveLinkDialog.test.tsx
@@ -97,6 +97,10 @@ let api: {
}
/** What the local core's `tmuxStatus` reports (R63); `undefined` = the read rejects. */
let persistence: { enabled: boolean; backend: string | null } | undefined
+const readPersistence = async () => {
+ if (!persistence) throw new Error('no core')
+ return { persistence }
+}
let host: HTMLDivElement
let root: Root
beforeEach(() => {
@@ -105,13 +109,7 @@ beforeEach(() => {
persistence = { enabled: true, backend: 'tmux' }
;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {
watchLink: api,
- clipboard: { writeText: vi.fn() },
- pty: {
- tmuxStatus: vi.fn(async () => {
- if (!persistence) throw new Error('no core')
- return { available: true, installCommand: null, installLabel: null, platform: 'linux', persistence }
- })
- }
+ clipboard: { writeText: vi.fn() }
}
localStorage.clear()
host = document.createElement('div')
@@ -153,6 +151,7 @@ function mount(o: {
title="build"
surface={o.surface ?? 'desktop'}
remoteNode={o.remoteNode}
+ readPersistence={readPersistence}
prepare={o.prepare ?? (async () => null)}
onUpgrade={o.onUpgrade}
onClose={onClose}
diff --git a/src/renderer/components/LiveLinkDialog.tsx b/src/renderer/components/LiveLinkDialog.tsx
index 00820c33f..67be706ec 100644
--- a/src/renderer/components/LiveLinkDialog.tsx
+++ b/src/renderer/components/LiveLinkDialog.tsx
@@ -167,6 +167,7 @@ export function LiveLinkDialog({
title,
surface,
remoteNode = false,
+ readPersistence,
prepare,
onUpgrade,
onClose
@@ -177,6 +178,10 @@ export function LiveLinkDialog({
surface: LiveLinkSurface
/** The node runs on an SSH project's host, whose own tmux gives a viewer a client of its own (R63). */
remoteNode?: boolean
+ /** R63: the LOCAL core's session-protection status (`localSession.api.pty.tmuxStatus` — the core that
+ * creates the link, never a relay peer's). Absent, rejected or unreadable: no note (unknown claims
+ * nothing). */
+ readPersistence?: () => Promise<{ persistence?: { enabled: boolean; backend: string | null } | null } | null>
/** R47: publish pending canvas edits before core looks the node up. A sentence = do NOT create. */
prepare: () => Promise<string | null>
/** Absent on the Server Edition (R43): no Upgrade button there. */
@@ -201,9 +206,10 @@ export function LiveLinkDialog({
// core that creates the link). Unknown — not read yet, or unreadable — says nothing.
const [whileOpenOnly, setWhileOpenOnly] = useState(false)
useEffect(() => {
+ if (!readPersistence) return
let live = true
Promise.resolve()
- .then(() => window.nodeTerminal.pty.tmuxStatus())
+ .then(() => readPersistence())
.then(
(st) => {
if (live) setWhileOpenOnly(watchableOnlyWhileOpen({ persistence: st?.persistence, remoteNode }))
@@ -213,7 +219,7 @@ export function LiveLinkDialog({
return () => {
live = false
}
- }, [remoteNode])
+ }, [remoteNode, readPersistence])
// D2/M3: focus lands in the dialog — the label on open, Copy once created — so keys stay inside
// it (a bare-key canvas command could otherwise fire behind the overlay).
const panelRef = useRef<HTMLDivElement>(null)