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
feat(canvas): the RUNNING badge walks — agent mascots on working nodes
enes14d9c71dcfc4
diff --git a/docs/mascot-sprites.md b/docs/mascot-sprites.mdnew file mode 100644index 000000000..479e0c384--- /dev/null+++ b/docs/mascot-sprites.md@@ -0,0 +1,56 @@+# Walking agent mascots — shared sprite spec (v1)++Adopted from **agent-notch** (MIT, © 2026 realfishsam — animation technique and the pixel+Claude mascot rendition) with the owner's call: use these sprites now, swap in nodeterm's own+mascot before any branding/App-Store push (the Codex pet spritesheet is © OpenAI from their+public pets CDN; the pixel Claude critter renders Anthropic's banner mascot).++Surfaces (owner-picked): iOS in-app (full walk animation), Live Activity / Lock Screen+(STATIC frame only — WidgetKit renders static views), desktop canvas RUNNING badge (full walk).++## Claude mascot (drawn at runtime from a pixel map — no image asset)++Two frames of terminal quadrant-block art, 9 cols × 3 rows of half-block characters+→ an 18×6 sub-pixel grid. Feet alternate between frames:++```+frame 0: " ▐▛███▜▌ " / "▝▜█████▛▘" / " ▘▘ ▝▝ "+frame 1: " ▐▛███▜▌ " / "▝▜█████▛▘" / " ▝▝ ▘▘ "+```++Quadrant char → (UL, UR, LL, LR) sub-pixel bits:+`█`=1111 `▐`=0101 `▌`=1010 `▛`=1110 `▜`=1101 `▙`=1011 `▟`=0111 `▘`=1000 `▝`=0100 `▖`=0010 `▗`=0001 space=0000+(bit order: upper-left, upper-right, lower-left, lower-right)++- Color: Anthropic coral `rgb(217, 120, 87)` (= 0.85, 0.47, 0.34).+- **Aspect**: terminal cells are ~2× taller than wide — sub-pixel cell ratio 1:2+ (reference: subW 1.6, subH 3.2). Don't square it or "he squishes".+- **Walk**: frame index = `floor(t × 2.5) % 2` (≈ 2.5 steps/s).+- **Bob**: vertical offset alternates with the frame (±0.5–1.5 px scaled to render size).++## Codex pet (spritesheet asset)++`pet-codex.webp` (checked into `resources/mascot/` here, `NodeTerm/Resources/Mascot/` on iOS):+8 columns × 9 rows of 192×208 frames. Walk cycle = the first row's frames at ~8 fps+(agent-notch uses a 0.12 s timer). Render small (~16–20 px tall), pixelated scaling+(`image-rendering: pixelated` / `.interpolation(.none)`).++## Done state — green blob++When a session finishes and hasn't been looked at, the mascot's slot turns into a shimmering+green blob: 7×7 grid, cell filled when `hash-noise(i,j,step) > 0.1 + dist-from-center/3.5 × 0.8`,+green with alpha `0.5 + 0.5×noise`, `step = floor(t × 2)`. Static surfaces (Live Activity)+render one blob frame. In-app/desktop may simplify to a green pixel checkmark where the+shimmer is noisy at small sizes — match agent-notch's panel behavior.++## Per-surface rules++- **iOS in-app** (Inbox Working-now cards, session header): SwiftUI `Canvas` renders the+ pixel map; `TimelineView(.periodic(…, 0.2s))` drives walk+bob. Codex → spritesheet crop.+ Other agents (gemini/opencode/custom): keep the existing glyphs (no sprite exists).+- **Live Activity / Island**: STATIC — working = mascot frame 0, done = one green-blob frame.+ No timers, no TimelineView animation loops (WidgetKit won't run them).+- **Desktop canvas** (TerminalNode header, working state): prefer CSS `steps()` animation over+ JS timers (a canvas can hold dozens of terminals — zero per-node intervals). Render the two+ pixel-map frames once into a data-URI spritesheet at module load; the badge is a `<span>`+ with `background-position` stepping. Codex: `steps(8)` over the webp's first row.diff --git a/resources/mascot/pet-codex.webp b/resources/mascot/pet-codex.webpnew file mode 100644index 000000000..8979a9eabBinary files /dev/null and b/resources/mascot/pet-codex.webp differdiff --git a/src/renderer/assets/pet-codex.webp b/src/renderer/assets/pet-codex.webpnew file mode 100644index 000000000..8979a9eabBinary files /dev/null and b/src/renderer/assets/pet-codex.webp differdiff --git a/src/renderer/lib/mascot.test.ts b/src/renderer/lib/mascot.test.tsnew file mode 100644index 000000000..e9fa1a0a6--- /dev/null+++ b/src/renderer/lib/mascot.test.ts@@ -0,0 +1,88 @@+import { describe, it, expect } from 'vitest'+import {+ CLAUDE_FRAMES,+ CLAUDE_FRAME_ART,+ SUB_COLS,+ SUB_ROWS,+ decodeQuadrant,+ decodeFrame,+ QUADRANT_BITS,+ type MascotBitmap+} from './mascot'++const countOn = (b: MascotBitmap): number => b.pixels.filter(Boolean).length++// The last quadrant row (art row index 2) → sub-pixel rows 4 and 5: the feet.+const footRegion = (b: MascotBitmap): boolean[] =>+ b.pixels.slice(4 * b.width, 6 * b.width)++describe('decodeQuadrant', () => {+ it('maps full block to all four sub-pixels', () => {+ expect(decodeQuadrant('█')).toEqual([1, 1, 1, 1])+ })++ it('maps half/quarter blocks by UL,UR,LL,LR bit order', () => {+ expect(decodeQuadrant('▐')).toEqual([0, 1, 0, 1]) // right half+ expect(decodeQuadrant('▌')).toEqual([1, 0, 1, 0]) // left half+ expect(decodeQuadrant('▘')).toEqual([1, 0, 0, 0]) // upper-left dot+ expect(decodeQuadrant('▝')).toEqual([0, 1, 0, 0]) // upper-right dot+ })++ it('treats space and unknown chars as empty', () => {+ expect(decodeQuadrant(' ')).toEqual([0, 0, 0, 0])+ expect(decodeQuadrant('x')).toEqual([0, 0, 0, 0])+ })+})++describe('decodeFrame', () => {+ it('produces an 18×6 sub-pixel bitmap', () => {+ for (const frame of CLAUDE_FRAMES) {+ expect(frame.width).toBe(SUB_COLS)+ expect(frame.height).toBe(SUB_ROWS)+ expect(frame.pixels).toHaveLength(SUB_COLS * SUB_ROWS)+ }+ })++ it('places quadrant bits at the right sub-pixel coordinates', () => {+ // A single "▐" (right half) at char (0,0) lights UR (0,1) and LR (1,1) only.+ const b = decodeFrame(['▐'])+ expect(b.pixels[0 * b.width + 1]).toBe(true) // UR+ expect(b.pixels[1 * b.width + 1]).toBe(true) // LR+ expect(b.pixels[0 * b.width + 0]).toBe(false) // UL+ expect(b.pixels[1 * b.width + 0]).toBe(false) // LL+ expect(countOn(b)).toBe(2)+ })++ it('sums to the total lit sub-pixels across the whole art', () => {+ const expected = CLAUDE_FRAME_ART[0]+ .flatMap((row) => Array.from(row))+ .reduce((acc, ch) => acc + QUADRANT_BITS[ch].filter(Boolean).length, 0)+ expect(countOn(CLAUDE_FRAMES[0])).toBe(expected)+ })+})++describe('walk frames', () => {+ it('has exactly two frames', () => {+ expect(CLAUDE_FRAMES).toHaveLength(2)+ })++ it('shares the same body (identical bit count between frames)', () => {+ // The two frames differ only in the feet, so the total lit count is unchanged.+ expect(countOn(CLAUDE_FRAMES[0])).toBe(countOn(CLAUDE_FRAMES[1]))+ })++ it('differs in the feet region between frame 0 and frame 1', () => {+ const f0 = footRegion(CLAUDE_FRAMES[0])+ const f1 = footRegion(CLAUDE_FRAMES[1])+ expect(f0).not.toEqual(f1)+ // Feet are present in both frames (the walk moves them, it does not remove them).+ expect(f0.some(Boolean)).toBe(true)+ expect(f1.some(Boolean)).toBe(true)+ })++ it('keeps the non-foot rows identical between frames', () => {+ const body0 = CLAUDE_FRAMES[0].pixels.slice(0, 4 * SUB_COLS)+ const body1 = CLAUDE_FRAMES[1].pixels.slice(0, 4 * SUB_COLS)+ expect(body0).toEqual(body1)+ })+})diff --git a/src/renderer/lib/mascot.ts b/src/renderer/lib/mascot.tsnew file mode 100644index 000000000..85d641b45--- /dev/null+++ b/src/renderer/lib/mascot.ts@@ -0,0 +1,136 @@+// Walking agent mascots — desktop canvas RUNNING badge (docs/mascot-sprites.md).+//+// The Claude critter is drawn at runtime from a terminal quadrant-block pixel map (no image+// asset): two frames of 9×3 half-block characters → an 18×6 sub-pixel grid, feet alternating+// between frames. We decode the map (pure, unit-tested) and paint BOTH frames once at module+// load onto an offscreen canvas → a data-URI spritesheet the RUNNING badge steps through with a+// pure CSS `steps()` animation (a canvas can hold dozens of terminals — zero per-node JS timers).+//+// Codex uses a real spritesheet asset (pet-codex.webp) imported by the component; here we only+// export its frame geometry so the CSS animation and the component agree on the numbers.++/** Anthropic coral / clay — rgb(217, 120, 87) (= 0.85, 0.47, 0.34). */+export const CORAL = 'rgb(217, 120, 87)'++/** Sub-pixel grid of one Claude frame: 9 quadrant cols × 2 = 18, 3 rows × 2 = 6. */+export const SUB_COLS = 18+export const SUB_ROWS = 6++/**+ * Quadrant char → (upper-left, upper-right, lower-left, lower-right) sub-pixel bits.+ * Bit order per docs/mascot-sprites.md: UL, UR, LL, LR.+ */+export const QUADRANT_BITS: Record<string, readonly [number, number, number, number]> = {+ '█': [1, 1, 1, 1],+ '▐': [0, 1, 0, 1],+ '▌': [1, 0, 1, 0],+ '▛': [1, 1, 1, 0],+ '▜': [1, 1, 0, 1],+ '▙': [1, 0, 1, 1],+ '▟': [0, 1, 1, 1],+ '▘': [1, 0, 0, 0],+ '▝': [0, 1, 0, 0],+ '▖': [0, 0, 1, 0],+ '▗': [0, 0, 0, 1],+ ' ': [0, 0, 0, 0]+}++/** The two walk frames as quadrant-block art (9 chars × 3 rows). Feet alternate. */+export const CLAUDE_FRAME_ART: readonly string[][] = [+ [' ▐▛███▜▌ ', '▝▜█████▛▘', ' ▘▘ ▝▝ '],+ [' ▐▛███▜▌ ', '▝▜█████▛▘', ' ▝▝ ▘▘ ']+]++/** A decoded frame: row-major `pixels[y*width + x]` booleans on an `width×height` grid. */+export interface MascotBitmap {+ width: number+ height: number+ pixels: boolean[]+}++/** Decode a single quadrant character to its four sub-pixel bits (unknown → all off). */+export function decodeQuadrant(ch: string): readonly [number, number, number, number] {+ return QUADRANT_BITS[ch] ?? [0, 0, 0, 0]+}++/** Decode one frame's 9×3 quadrant art into an 18×6 sub-pixel bitmap. */+export function decodeFrame(rows: readonly string[]): MascotBitmap {+ const width = SUB_COLS+ const height = SUB_ROWS+ const pixels = new Array<boolean>(width * height).fill(false)+ rows.forEach((row, charRow) => {+ for (let charCol = 0; charCol < row.length; charCol++) {+ const [ul, ur, ll, lr] = decodeQuadrant(row[charCol])+ const x = charCol * 2+ const y = charRow * 2+ if (ul) pixels[y * width + x] = true+ if (ur) pixels[y * width + x + 1] = true+ if (ll) pixels[(y + 1) * width + x] = true+ if (lr) pixels[(y + 1) * width + x + 1] = true+ }+ })+ return { width, height, pixels }+}++/** The two decoded walk frames. */+export const CLAUDE_FRAMES: MascotBitmap[] = CLAUDE_FRAME_ART.map(decodeFrame)++// --- Rendering -----------------------------------------------------------------------------+//+// Aspect: terminal cells are ~2× taller than wide, so a sub-pixel is 1 wide : 2 tall — do NOT+// square it or "he squishes". We render at an integer 3× of the 24×16 display size (so the+// browser downscales by a clean /3 with imageSmoothing off = crisp), each sub-pixel a 4×8 block.++/** Display size of one Claude frame (px) — 18×6 sub-pixels at 1.333×2.667, i.e. 1:2 aspect. */+export const CLAUDE_FRAME_WIDTH = 24+export const CLAUDE_FRAME_HEIGHT = 16+const RENDER_SUB_W = 4 // 4:8 = 1:2, and 3× the 1.333×2.667 display sub-pixel+const RENDER_SUB_H = 8++function buildClaudeSprite(): string {+ // Guarded: the pure decode above is unit-tested under vitest's `node` environment, where+ // there is no DOM. The badge never renders there, so an empty src is harmless.+ if (typeof document === 'undefined') return ''+ const frameW = SUB_COLS * RENDER_SUB_W+ const frameH = SUB_ROWS * RENDER_SUB_H+ const canvas = document.createElement('canvas')+ canvas.width = frameW * CLAUDE_FRAMES.length+ canvas.height = frameH+ const ctx = canvas.getContext('2d')+ if (!ctx) return ''+ ctx.imageSmoothingEnabled = false+ ctx.fillStyle = CORAL+ CLAUDE_FRAMES.forEach((frame, f) => {+ const ox = f * frameW+ for (let y = 0; y < frame.height; y++) {+ for (let x = 0; x < frame.width; x++) {+ if (frame.pixels[y * frame.width + x]) {+ ctx.fillRect(ox + x * RENDER_SUB_W, y * RENDER_SUB_H, RENDER_SUB_W, RENDER_SUB_H)+ }+ }+ }+ })+ return canvas.toDataURL('image/png')+}++/** Claude walk spritesheet (2 frames side by side) + one-frame display dimensions. */+export const CLAUDE_MASCOT = {+ /** data: URI PNG, or '' outside a DOM (tests). */+ src: buildClaudeSprite(),+ frameWidth: CLAUDE_FRAME_WIDTH,+ frameHeight: CLAUDE_FRAME_HEIGHT,+ frameCount: CLAUDE_FRAMES.length+}++// --- Codex pet spritesheet geometry (asset imported by the component) ----------------------++/** pet-codex.webp layout: 8 cols × 9 rows of 192×208 frames; walk = the first row. */+export const CODEX_MASCOT = {+ cols: 8,+ rows: 9,+ nativeFrameWidth: 192,+ nativeFrameHeight: 208,+ /** Display size — ~16px tall, keeping the native aspect. */+ frameHeight: 16,+ frameWidth: Math.round((16 * 192) / 208)+}diff --git a/src/renderer/nodes/AgentMascot.tsx b/src/renderer/nodes/AgentMascot.tsxnew file mode 100644index 000000000..f201bbf83--- /dev/null+++ b/src/renderer/nodes/AgentMascot.tsx@@ -0,0 +1,39 @@+import type { CSSProperties } from 'react'+import type { AgentId } from '@shared/agents/config'+import { CLAUDE_MASCOT, CODEX_MASCOT } from '../lib/mascot'+import codexPet from '../assets/pet-codex.webp'++/**+ * The walking mascot shown inside the RUNNING badge (docs/mascot-sprites.md):+ * - claude → the runtime-drawn coral pixel critter (data-URI spritesheet, CSS `steps(2)` walk).+ * - codex → pet-codex.webp, first-row walk cycle (CSS `steps(8)`).+ * - anything else (gemini/opencode/custom/plain) → the plain pulsing dot, unchanged.+ *+ * Animation is pure CSS (see .term-node__mascot* in styles.css) — no JS timers, so a canvas+ * full of RUNNING terminals costs nothing per node. Dimensions come from lib/mascot.ts so the+ * CSS scaling and the geometry can never desync.+ */+export function AgentMascot({ agentId }: { agentId?: AgentId }): React.JSX.Element {+ if (agentId === 'claude' && CLAUDE_MASCOT.src) {+ const style = {+ '--mascot-w': `${CLAUDE_MASCOT.frameWidth}px`,+ '--mascot-h': `${CLAUDE_MASCOT.frameHeight}px`,+ backgroundImage: `url(${CLAUDE_MASCOT.src})`+ } as CSSProperties+ return <span className="term-node__mascot term-node__mascot--claude" style={style} aria-hidden />+ }++ if (agentId === 'codex') {+ const style = {+ '--cmascot-w': `${CODEX_MASCOT.frameWidth}px`,+ '--cmascot-h': `${CODEX_MASCOT.frameHeight}px`,+ '--cmascot-sheet-w': `${CODEX_MASCOT.frameWidth * CODEX_MASCOT.cols}px`,+ '--cmascot-sheet-h': `${CODEX_MASCOT.frameHeight * CODEX_MASCOT.rows}px`,+ backgroundImage: `url(${codexPet})`+ } as CSSProperties+ return <span className="term-node__mascot term-node__mascot--codex" style={style} aria-hidden />+ }++ // Every other agent keeps the original pulsing dot.+ return <span className="term-node__status-dot" />+}diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex 943be16be..5806456f2 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -74,6 +74,7 @@ import { buildSshArgs, type SshConnection } from '@shared/ssh'import { hintLabel } from '@shared/platform-utils'import { ColumnPill } from '../components/kanban/ColumnPill'import { BoardLogPanel } from '../components/kanban/BoardLogPanel'+import { AgentMascot } from './AgentMascot'/** Backslash-escape shell-special characters, like a native terminal does on file drop. */function escapeDroppedPath(p: string): string {@@ -1682,7 +1683,7 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasN<PresenceChips nodeId={id} />{status?.state === 'working' && (<span className="term-node__status term-node__status--busy" title={`${agentLabel} is working`}>- <span className="term-node__status-dot" />+ <AgentMascot agentId={agentId} />RUNNING</span>)}diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 953cca671..cbb46196c 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -1136,6 +1136,58 @@ body,animation: nt-pulse 1.1s ease-in-out infinite;}+/* Walking mascot (docs/mascot-sprites.md): sits where the pulsing dot would, INSIDE the RUNNING+ badge, pure CSS spritesheet stepping — no per-node JS timers. Sizes come from lib/mascot.ts via+ the inline CSS vars so the animation and the rendered sheet can never desync. Fixed heights ≤+ the other header controls (≈18px), so the mascot never changes header height. */+.term-node__mascot {+ display: inline-block;+ flex-shrink: 0;+ background-repeat: no-repeat;+ image-rendering: pixelated;+ will-change: background-position, transform;+}++/* Claude: coral pixel critter, 2-frame walk (~2.5 steps/s ⇒ 0.8s/cycle) + an alternating bob.+ steps(1) holds each keyframe's value across its segment, giving two discrete frame+bob states. */+.term-node__mascot--claude {+ width: var(--mascot-w);+ height: var(--mascot-h);+ background-size: calc(var(--mascot-w) * 2) var(--mascot-h);+ animation: mascot-walk-claude 0.8s steps(1) infinite;+}++@keyframes mascot-walk-claude {+ 0% {+ background-position-x: 0;+ transform: translateY(0);+ }+ 50% {+ background-position-x: calc(var(--mascot-w) * -1);+ transform: translateY(-1.5px);+ }+ 100% {+ background-position-x: calc(var(--mascot-w) * -2);+ transform: translateY(0);+ }+}++/* Codex: pet-codex.webp first row, 8-frame walk at ~8fps ⇒ 0.96s/cycle. Only the first row is+ shown (background-position-y stays 0); steps(8) walks left one frame at a time. */+.term-node__mascot--codex {+ width: var(--cmascot-w);+ height: var(--cmascot-h);+ background-position: 0 0;+ background-size: var(--cmascot-sheet-w) var(--cmascot-sheet-h);+ animation: mascot-walk-codex 0.96s steps(8) infinite;+}++@keyframes mascot-walk-codex {+ to {+ background-position-x: calc(var(--cmascot-w) * -8);+ }+}+/* NEEDS YOU is red everywhere (same as the sidebar attention dot). */.term-node__status--attention {color: #ff453a;