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
fix(ui): the resource pill is an icon at rest, and sits left of usage
enesbe69a8a0b5ff
diff --git a/docs/session-memory.md b/docs/session-memory.mdindex ab4df56af..bfbdcec9d 100644--- a/docs/session-memory.md+++ b/docs/session-memory.md@@ -191,6 +191,15 @@ previous machine's facts on a real change.**The full sweep never runs on a timer and never from the pill.** The panel is *unmounted* whileclosed and its mount is what triggers the sweep.+**The pill is icon-only at rest.** It sits on every canvas, always, so a permanent+`RAM 15.6 GB / 62.5 GB` is a row of numbers nobody asked for — the pill's job is to be findable, not+to report continuously. Hover (or keyboard focus, or an open panel) reveals used/total; the icon+itself carries the pressure reading through the same thresholds the old mini-bar used, tinting as+memory is CONSUMED. The reveal is **CSS, not a conditional mount**: the numbers stay in the DOM at+rest so they remain the button's accessible name, and a hover-mounted figure would be unreachable to+anything that reads the control without pointing at it. The pill sits to the LEFT of the usage pill+— this machine's resources before this account's quota.+**Ownership contract:** the store's poll timer and its active-scope stamp are **module singletons**,and the **pill is their single owner**. The panel must never call `startHostPoll` / `stopHostPoll` —a `stopHostPoll` on unmount would clear the pill's interval with nothing left to restart it, and the@@ -380,7 +389,7 @@ Layout and theming (argued from CSS only)15. Sessions sidebar open: the collapsed pill passes UNDER the sidebar exactly as the usage pilldoes.16. Usage popover open beside the RAM pill: no overlap, pill still clickable.-17. Both themes: hover (light is why the ink overlay exists) and the bar's colour steps at ~75% and+17. Both themes: hover (light is why the ink overlay exists) and the icon's colour steps at ~75% and~90% used.18. fitView / goToNode must no longer tuck nodes under the pill.diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex ec118d819..35efe10be 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -7966,7 +7966,6 @@ export function Canvas() {obstacle rect (instead of one per pill, overlapping after inflation), so fitView neverparks a node underneath either pill. */}<div className="canvas-pills" data-canvas-chrome>- <UsageIndicator overBoard={kanbanOpen} />{/* `travelToNode`, not `focusNodeById`: the panel resolves sessions in CLOSED projectstoo (their tmux sessions keep running), and reaching one means reopening its tabfirst — the same path a notification click and a peer jump take. */}@@ -7975,7 +7974,9 @@ export function Canvas() {onGoToNode={travelToNode}onKillSession={killSessionById}/>- </div>++ <UsageIndicator overBoard={kanbanOpen} />+</div><PresenceNamePrompt />diff --git a/src/renderer/components/SystemResourcePill.test.tsx b/src/renderer/components/SystemResourcePill.test.tsxindex 04226571d..4e48e759b 100644--- a/src/renderer/components/SystemResourcePill.test.tsx+++ b/src/renderer/components/SystemResourcePill.test.tsx@@ -75,10 +75,26 @@ describe('SystemResourcePill', () => {expect(pill?.textContent).not.toContain('46.9 GB')})- it('fills the bar by memory USED, not by what is free', () => {+ it('keeps the numbers in the DOM at rest — the reveal is CSS, not a mount', () => {+ // The collapsed pill is icon-only, but the detail must still exist: it carries the button's+ // accessible name, and a hover-mounted number would be unreachable to a screen reader and to+ // anything that reads the control without pointing at it.mount(MEM)- const fill = host.querySelector<HTMLElement>('.sysres-pill__minibar-fill')- expect(fill?.style.width).toBe('25%')+ const detail = host.querySelector('.sysres-pill__detail')+ expect(detail).not.toBeNull()+ expect(detail?.textContent).toContain('15.6 GB')+ })++ it('tints the icon by memory USED, not by what is free', () => {+ // The icon carries the pressure reading now that the bar is gone. 25% used is calm; the same+ // machine read as 75% FREE would be the danger tint, which is the mistake this pins.+ mount(MEM)+ expect(host.querySelector<HTMLElement>('.sysres-pill__icon')?.style.color).toBe('')+ act(() => root.unmount())+ // 63 of 64 GB used — the same machine read as "98% free" would stay calm, which is the+ // direction this pins.+ mount({ totalMb: 64000, availableMb: 1000 })+ expect(host.querySelector<HTMLElement>('.sysres-pill__icon')?.style.color).toBe('var(--danger)')})it('pulses instead of claiming a number when the reading is null', () => {@@ -90,7 +106,6 @@ describe('SystemResourcePill', () => {// is any digit at all — there is no number we are entitled to print without a reading.expect(pill?.textContent).not.toMatch(/\d/)expect(pill?.textContent).not.toContain('GB')- expect(host.querySelector('.sysres-pill__minibar')).toBeNull()})it('treats a zero total as unreadable rather than dividing by it', () => {diff --git a/src/renderer/components/SystemResourcePill.tsx b/src/renderer/components/SystemResourcePill.tsxindex f71354e09..e9a9591ff 100644--- a/src/renderer/components/SystemResourcePill.tsx+++ b/src/renderer/components/SystemResourcePill.tsx@@ -5,6 +5,7 @@ import { useSshConn } from '../state/sshConn'import { useSessionMemory } from '../state/sessionMemory'import { usageScopeKey } from '../lib/usageScope'import { SessionMemoryPanel } from './SessionMemoryPanel'+import { IconResource } from './icons'/** `formatBytes` speaks bytes; every number in this feature is MB. */const MB = 1024 * 1024@@ -92,39 +93,33 @@ export function SystemResourcePill({if (!activeProjectId) return nulllet body: JSX.Element+ let iconColor: string | undefined// `null` = could not read — the normal answer on a non-Linux SSH host, and on any host whose// first read has not landed yet. Pulse, NEVER "0 GB": a confident zero is the one thing this pill// must never say, since the number is the whole reason anyone looks at it. A `totalMb` of zero is// the same fact wearing a plausible shape (and would render the bar as NaN%).if (mem === null || mem.totalMb <= 0) {- body = <span className="sysres-pill__dim sysres-pill__pulse">···</span>+ body = <span className="sysres-pill__detail sysres-pill__dim sysres-pill__pulse">···</span>} else {const usedMb = Math.max(0, mem.totalMb - mem.availableMb)const usedPercent = Math.min(100, (usedMb / mem.totalMb) * 100)- // The bar fills as memory is CONSUMED — the opposite direction to the usage pill's bar beside- // it, which drains as quota is spent. Deliberate: every system monitor draws RAM this way, and- // "the bar is nearly full" is the reading a user already has for memory pressure.+ // The ICON carries the pressure reading now that the bar is gone: it tints as memory is+ // consumed, so a glance still says "this machine is tight" without the pill claiming a row of+ // the canvas. Same thresholds the bar used.const color =usedPercent >= DANGER_PERCENT? 'var(--danger)': usedPercent >= WARN_PERCENT? 'var(--warn)'- : 'var(--success)'+ : undefinedbody = (- <>- <span className="sysres-pill__minibar" aria-hidden>- <span- className="sysres-pill__minibar-fill"- style={{ width: `${usedPercent}%`, background: color }}- />- </span>- <span className="sysres-pill__num">- {formatBytes(usedMb * MB)}- <span className="sysres-pill__sep"> / </span>- {formatBytes(mem.totalMb * MB)}- </span>- </>+ <span className="sysres-pill__detail sysres-pill__num" style={color ? { color } : undefined}>+ {formatBytes(usedMb * MB)}+ <span className="sysres-pill__sep"> / </span>+ {formatBytes(mem.totalMb * MB)}+ </span>)+ iconColor = color}return (@@ -147,7 +142,9 @@ export function SystemResourcePill({// "whose memory is this?" without opening the panel.title={scopeKey ? `Memory on ${scopeKey}` : 'Memory on this machine'}>- <span className="sysres-pill__icon">RAM</span>+ <span className="sysres-pill__icon" style={iconColor ? { color: iconColor } : undefined}>+ <IconResource />+ </span>{body}</button></div>diff --git a/src/renderer/components/icons.tsx b/src/renderer/components/icons.tsxindex 57abbd12e..2b5dd6a62 100644--- a/src/renderer/components/icons.tsx+++ b/src/renderer/components/icons.tsx@@ -210,6 +210,15 @@ export const IconSearch = () => (</svg>)+/** Memory/resource glyph: a chip with pins. Used by the system-resource pill, whose collapsed+ * state is icon-only — the numbers appear on hover. */+export const IconResource = () => (+ <svg {...S}>+ <rect x="7" y="7" width="10" height="10" rx="1.5" />+ <path d="M10 3v4M14 3v4M10 17v4M14 17v4M3 10h4M3 14h4M17 10h4M17 14h4" />+ </svg>+)+export const IconWeb = () => (<svg {...S}><circle cx="12" cy="12" r="9" />diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 90b32d374..5a87b2a4e 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -5500,13 +5500,22 @@ body,/* The two pills share one shell so they read as a single control rather than as two widgets thathappen to be adjacent. Grouped rather than duplicated, so tuning one can never drift the other. */.usage-pill,+/* Icon-only at rest: the pill is ambient chrome, and a permanent "RAM 15.6 / 62.5 GB" is a row of+ numbers nobody asked for on every canvas. The detail is revealed on hover (and while the panel is+ open, so the control does not shrink out from under the cursor that opened it). */.sysres-pill {display: inline-flex;align-items: center;- gap: 6px;+ gap: 0;height: 26px;- padding: 0 9px;+ width: 26px;+ padding: 0;+ justify-content: center;border-radius: 13px;+ transition:+ width 140ms ease,+ padding 140ms ease,+ gap 140ms ease;background: rgba(var(--card-rgb), 0.92);border: 1px solid rgba(var(--tint-rgb), 0.08);color: var(--text-strong);@@ -5516,8 +5525,7 @@ body,}.usage-pill:hover { background: rgba(44, 44, 46, 0.95); }.usage-pill__icon { color: #d97757; font-size: 13px; }-.usage-pill__minibar,-.sysres-pill__minibar {+.usage-pill__minibar {display: inline-block;width: 42px;height: 6px;@@ -5525,8 +5533,7 @@ body,background: rgba(var(--tint-rgb), 0.14);overflow: hidden;}-.usage-pill__minibar-fill,-.sysres-pill__minibar-fill { display: block; height: 100%; border-radius: 3px; }+.usage-pill__minibar-fill { display: block; height: 100%; border-radius: 3px; }.usage-pill__num,.sysres-pill__num { color: var(--text-strong); }.usage-pill__sep,@@ -5540,6 +5547,40 @@ body,.sysres-pill__pulse { animation: usage-pulse 1.2s ease-in-out infinite; }@keyframes usage-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }+/* Expanded: hover, keyboard focus, or an open panel. `width: auto` cannot be transitioned, so the+ pill animates padding/gap only and the detail carries the width — enough to read as a reveal+ rather than a jump, without a magic max-width that clips a wider number (a 1 TB host prints+ more characters than a 16 GB one). */+.sysres-pill:hover,+.sysres-pill:focus-visible,+.sysres-indicator:has(.sessmem-panel) .sysres-pill {+ width: auto;+ gap: 6px;+ padding: 0 9px;+}+/* Present in the DOM at rest (so the accessible name and any assertion still see the number) but+ taking no space until the pill expands. */+.sysres-pill__detail {+ display: inline-block;+ max-width: 0;+ overflow: hidden;+ white-space: nowrap;+ opacity: 0;+ transition:+ max-width 140ms ease,+ opacity 140ms ease;+}+.sysres-pill:hover .sysres-pill__detail,+.sysres-pill:focus-visible .sysres-pill__detail,+.sysres-indicator:has(.sessmem-panel) .sysres-pill__detail {+ max-width: 200px;+ opacity: 1;+}+.sysres-pill__icon {+ display: inline-flex;+ color: rgba(var(--tint-rgb), 0.75);+}+/* ---- System-resource pill (RAM of the machine the active project runs on) ----Shares the usage pill's shell above; only the bits that differ live here. */.sysres-indicator {@@ -5572,16 +5613,6 @@ body,linear-gradient(rgba(var(--tint-rgb), 0.08), rgba(var(--tint-rgb), 0.08)),rgba(var(--card-rgb), 0.92);}-/* A word, not a glyph: "12.4 GB / 62.5 GB" beside a quota pill is ambiguous about what is being- measured, and every symbol for memory is either an emoji or a guess. Set quiet — it is a unit- label, not a value. */-.sysres-pill__icon {- color: rgba(var(--tint-rgb), 0.5);- font-size: 10px;- font-weight: 600;- letter-spacing: 0.04em;-}-.usage-refresh {display: inline-flex;align-items: center;