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(dino): add dino node kind, factory, and highScore serialization

enes7d4b2b32f7fb
diff --git a/src/renderer/state/workspace.test.ts b/src/renderer/state/workspace.test.ts
index 3185a7146..78aeabdbe 100644
--- a/src/renderer/state/workspace.test.ts
+++ b/src/renderer/state/workspace.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
-import { flowToNodeStates, nodeStatesToFlow, reparentNode } from './workspace'
+import { createDinoNode, flowToNodeStates, nodeStatesToFlow, reparentNode } from './workspace'
import type { CanvasNode } from './workspace'
const term = (id: string, pos: { x: number; y: number }, parentId?: string): CanvasNode =>
@@ -97,3 +97,31 @@ describe('group worktree serialization', () => {
expect(flowToNodeStates([group])[0].worktree).toBeUndefined()
})
})
+
+describe('dino node serialization', () => {
+ it('round-trips a dino node and its highScore', () => {
+ const dino = {
+ id: 'dino-1',
+ type: 'dino',
+ position: { x: 10, y: 20 },
+ width: 600,
+ height: 200,
+ data: { title: 'Dino', color: '#a2a2a2', group: null, highScore: 1337 }
+ } as unknown as CanvasNode
+
+ const states = flowToNodeStates([dino])
+ expect(states[0].kind).toBe('dino')
+ expect(states[0].highScore).toBe(1337)
+
+ const back = nodeStatesToFlow(states)
+ expect(back[0].type).toBe('dino')
+ expect(back[0].data.highScore).toBe(1337)
+ })
+
+ it('createDinoNode produces a dino node with highScore 0', () => {
+ const node = createDinoNode(0)
+ expect(node.type).toBe('dino')
+ expect(node.data.highScore).toBe(0)
+ expect(node.width).toBe(600)
+ })
+})
diff --git a/src/renderer/state/workspace.ts b/src/renderer/state/workspace.ts
index 50e35e513..b604df1f3 100644
--- a/src/renderer/state/workspace.ts
+++ b/src/renderer/state/workspace.ts
@@ -20,6 +20,7 @@ const STICKY_SIZE = { width: 240, height: 200 }
const GROUP_SIZE = { width: 520, height: 360 }
const EDITOR_SIZE = { width: 660, height: 460 }
const DIFF_SIZE = { width: 860, height: 500 }
+const DINO_SIZE = { width: 600, height: 200 }
/** Height of a node when collapsed (header only). */
export const COLLAPSED_HEIGHT = 40
@@ -47,6 +48,8 @@ export interface NodeData {
filePath?: string
diffStaged?: boolean
commitOid?: string
+ /** dino-only: best score reached in the T-Rex Runner game. */
+ highScore?: number
/** Which agent runs in this terminal node (claude/codex/gemini/custom). */
agentId?: AgentId
/** group-only: the git worktree this group is bound to (single source of truth). */
@@ -312,6 +315,24 @@ export function createStickyNode(index: number, center?: { x: number; y: number
}
}
+/** Creates a new dino (T-Rex Runner) game node. */
+export function createDinoNode(index: number, center?: { x: number; y: number }): CanvasNode {
+ return {
+ id: nextId('dino'),
+ type: 'dino',
+ position: placeAt(center, index, DINO_SIZE.width, DINO_SIZE.height),
+ width: DINO_SIZE.width,
+ height: DINO_SIZE.height,
+ style: { width: DINO_SIZE.width, height: DINO_SIZE.height },
+ data: {
+ title: 'Dino',
+ color: '#a2a2a2',
+ group: null,
+ highScore: 0
+ }
+ }
+}
+
/** Creates a group frame node at a given position/size (children get parentId = its id). */
export function createGroupNode(
position: { x: number; y: number },
@@ -519,6 +540,7 @@ export function nodeStatesToFlow(states: CanvasNodeState[]): CanvasNode[] {
filePath: n.filePath,
diffStaged: n.diffStaged,
commitOid: n.commitOid,
+ highScore: n.highScore,
agentId,
ssh: n.ssh,
worktree: n.worktree
@@ -538,7 +560,9 @@ export function flowToNodeStates(nodes: CanvasNode[]): CanvasNodeState[] {
? EDITOR_SIZE
: kind === 'diff'
? DIFF_SIZE
- : TERMINAL_SIZE
+ : kind === 'dino'
+ ? DINO_SIZE
+ : TERMINAL_SIZE
return nodes
// Remote terminals are transient to a live relay connection — never persist them (their
// connectionId is dead after a restart, and they'd otherwise reattach to a stray local tmux).
@@ -569,6 +593,7 @@ export function flowToNodeStates(nodes: CanvasNode[]): CanvasNodeState[] {
filePath: n.data.filePath,
diffStaged: n.data.diffStaged,
commitOid: n.data.commitOid,
+ highScore: n.data.highScore,
agentId: n.data.agentId,
ssh: n.data.ssh,
worktree: n.data.worktree
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 8204f353f..cda2264f4 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -25,7 +25,7 @@ export interface PtyCreateOptions {
}
// 'subagent' and 'loop' are render-only (ephemeral hook-driven viz) and never persisted.
-export type NodeKind = 'terminal' | 'sticky' | 'group' | 'editor' | 'diff' | 'subagent' | 'loop'
+export type NodeKind = 'terminal' | 'sticky' | 'group' | 'editor' | 'diff' | 'subagent' | 'loop' | 'dino'
/** Persisted state of a single canvas node (terminal, sticky note, group frame, or editor). */
export interface CanvasNodeState {
@@ -51,6 +51,8 @@ export interface CanvasNodeState {
ssh?: import('./ssh').SshConnection
// sticky-only
text?: string
+ // dino-only: best score reached in the T-Rex Runner game.
+ highScore?: number
// editor / diff
filePath?: string
/** diff-only: true = staged diff (HEAD vs index), false = unstaged (index vs working). */