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(context-meter): show the session's model name on the header pill
enes43492955ec6c
diff --git a/src/renderer/components/ContextMeter.tsx b/src/renderer/components/ContextMeter.tsxindex 4c67b048f..ab1c0cb21 100644--- a/src/renderer/components/ContextMeter.tsx+++ b/src/renderer/components/ContextMeter.tsx@@ -1,6 +1,6 @@import { useEffect, useRef, useState } from 'react'import { useContextWindow } from '../state/contextWindow'-import { formatTimeAgo } from '../lib/usageFormat'+import { formatModelLabel, formatTimeAgo } from '../lib/usageFormat'/** Fullness scale (inverse of the usage indicator): green low, yellow mid, red near-full. */function meterColor(usedPercent: number): string {@@ -37,6 +37,7 @@ export function ContextMeter({ sessionId }: { sessionId: string | null }): JSX.Eif (!usage) return nullconst pct = Math.round(usage.usedPercent)const color = meterColor(usage.usedPercent)+ const modelLabel = formatModelLabel(usage.model)return (<div className="ctx-meter nodrag" ref={ref}>@@ -62,6 +63,7 @@ export function ContextMeter({ sessionId }: { sessionId: string | null }): JSX.EsetOpen((v) => !v)}}>+ {modelLabel && <span className="ctx-pill__model">{modelLabel}</span>}<span className="ctx-pill__bar"><span className="ctx-pill__fill" style={{ width: `${usage.usedPercent}%`, background: color }} /></span>diff --git a/src/renderer/lib/usageFormat.test.ts b/src/renderer/lib/usageFormat.test.tsnew file mode 100644index 000000000..b010a2e8a--- /dev/null+++ b/src/renderer/lib/usageFormat.test.ts@@ -0,0 +1,32 @@+import { describe, expect, it } from 'vitest'+import { formatModelLabel } from './usageFormat'++describe('formatModelLabel', () => {+ it('formats family + version ids', () => {+ expect(formatModelLabel('claude-opus-4-8')).toBe('Opus 4.8')+ expect(formatModelLabel('claude-sonnet-5')).toBe('Sonnet 5')+ expect(formatModelLabel('claude-fable-5')).toBe('Fable 5')+ })++ it('drops date suffixes', () => {+ expect(formatModelLabel('claude-haiku-4-5-20251001')).toBe('Haiku 4.5')+ expect(formatModelLabel('claude-opus-4-1-20250805')).toBe('Opus 4.1')+ })++ it('handles legacy version-first ids', () => {+ expect(formatModelLabel('claude-3-5-sonnet-20241022')).toBe('Sonnet 3.5')+ })++ it('ignores non-numeric segments like a [1m] marker', () => {+ expect(formatModelLabel('claude-sonnet-4-5[1m]')).toBe('Sonnet 4.5')+ })++ it('returns a family with no version bare', () => {+ expect(formatModelLabel('sonnet')).toBe('Sonnet')+ })++ it('passes through unknown ids and keeps null', () => {+ expect(formatModelLabel('some-custom-model')).toBe('some-custom-model')+ expect(formatModelLabel(null)).toBeNull()+ })+})diff --git a/src/renderer/lib/usageFormat.ts b/src/renderer/lib/usageFormat.tsindex 375f9612f..67442a58c 100644--- a/src/renderer/lib/usageFormat.ts+++ b/src/renderer/lib/usageFormat.ts@@ -27,6 +27,23 @@ export function formatResetCountdown(resetsAt: number | null): string {return mins > 0 ? `Resets in ${hours}h ${mins}m` : `Resets in ${hours}h`}+/**+ * Short display label for a Claude model id: "claude-opus-4-8" → "Opus 4.8",+ * "claude-haiku-4-5-20251001" → "Haiku 4.5" (date segments dropped), "claude-3-5-sonnet-…"+ * → "Sonnet 3.5". An id with no known family is returned as-is; null stays null.+ */+export function formatModelLabel(model: string | null): string | null {+ if (!model) return null+ const fam = /(opus|sonnet|haiku|fable|mythos)/i.exec(model)+ if (!fam) return model+ const family = fam[1][0].toUpperCase() + fam[1].slice(1).toLowerCase()+ const version = model+ .split(/[^a-zA-Z0-9]+/)+ .filter((p) => /^\d{1,3}$/.test(p))+ .join('.')+ return version ? `${family} ${version}` : family+}+/** Bar color by remaining quota: green > 40%, yellow 20–40%, red < 20%. */export function barColor(leftPercent: number): string {if (leftPercent > 40) return '#30d158'diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 248470d6f..793310db4 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -4453,6 +4453,13 @@ body,cursor: pointer;}.ctx-pill:hover { background: rgba(255, 255, 255, 0.12); }+.ctx-pill__model {+ max-width: 72px;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ color: var(--label-secondary, rgba(255, 255, 255, 0.7));+}.ctx-pill__bar {display: inline-block;width: 28px;