fix(ruflo-console): the band fits a narrow pane (0.49.10) (#4701)

Rows are measured in terminal columns (emoji are two), a part that does not
fit is left out whole with a dim +N count instead of being cut mid-word, the
longest parts are shortened first so a wide band keeps the rest in full, and
the open button sizes to its label ('open' below 64 columns; the mark alone
below 40).

Co-authored-by: r <r@x>
This commit is contained in:
rUvandr authored and GitHub committed 2026-11-04 15:15:40 -06:00
1 parent 1c0d63c79a
commit 937a9a44c2
7 files changed
+169 -26

No files matched your search

@@ -1,7 +1,7 @@
{
"name": "ruflo-console",
"description": "ruflo's cockpit inside Claude Code and the one /ruflo command for every ruflo mod (function hooks, early access). Views: overview with health alerts, swarm topology graph, claims flow with TTL rings, federation map, plugin health matrix, learning curve and pipeline, MetaHarness radar and audit trend, memory, cost gauge, agent timeline, approvals queue, event stream, a main menu, an x.ruv.io federation board, an AI terminal (codex, claude or both in remembered sessions, streamed), Skills (npx skills), a Hive-Mind view, a MetaHarness lab, agent drill-down; a command palette for confirm-gated actions through the ruflo CLI; a band above the prompt. Reads ruflo's files and the CLI's local JSON; anything not measured reads n/a. The one network call it makes by itself is a daily read of the published plugin.json at github.com/ruvnet/ruflo to offer an update (Settings \u2192 Updates: ask, auto, or off); it installs only through Claude Code's own claude plugin update, and never a new major version without asking.",
"version": "0.49.9",
"version": "0.49.10",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
+6
View File
@@ -2,6 +2,12 @@
Newest first. One `## <version> — <date>` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; older versions: `git log -- plugins/ruflo-console`.
## 0.49.10 — 2026-11-04
- fix: the band above the prompt stays on its rows in a narrow pane. Widths were counted as string length, which under-counts emoji such as 🎯 and 💻, so a row that looked like it fit overflowed and the host wrapped it onto extra lines. Rows are now measured in terminal columns.
- fix: a band part that does not fit is left out whole, and a dim "+N" says how many were left out, instead of the last part being cut mid-word. Only a row's first part may be clipped.
- fix: when a row is too long, the parts that save the most are shortened one at a time (the working agent loses its task text, a terminal run loses "answering"), so a wide band keeps every other part's full words. Before, one long part switched the whole row to its short forms.
- fix: the "open console" button takes only its own width, and below 64 columns it reads "open". Below 40 columns the ◆ mark stands for ruflo without the word, so the most urgent part (approvals, alerts) is shown instead of cut.
## 0.49.9 — 2026-11-04
- fix: Mission Control now offers to create a mission for a new goal when the active mission has one cancelled task and every other task done. 0.49.6 counted a mission as over only when the whole mission was cancelled or every task was done, so a mission with 14 tasks completed and 1 cancelled (for example a research step dropped on purpose) was never over: the NEXT STEP box still showed "Create the mission and its tasks" as done, with the old mission's id and no create button. A mission is now over when every task is done or cancelled (a mission with no tasks still is not). A task that is pending, running or failed keeps it open, a finished mission's own goal is still not offered a second time, and nothing is created unasked.
- fix: a cancelled mission no longer puts "The mission is cancelled. Do not start new work." in Claude's prompt. The active mission stays active until another is created, so after a cancel every new goal's guidance reached Claude with that stop line, before the create step could make the new mission, and Claude refused to plan it. The mission context section is now left out for a cancelled mission, as it already was for a finished one.
+1 -1
View File
@@ -2,4 +2,4 @@
* The console's version, shown on the header so a person can tell which build is running. Kept equal to the plugin's manifest
* (`.claude-plugin/plugin.json`); tests/version.spec.ts fails if the two drift.
*/
export const CONSOLE_VERSION = '0.49.9'
export const CONSOLE_VERSION = '0.49.10'
+71 -19
View File
@@ -15,6 +15,7 @@ import { secMemo, securityBand } from '../secure'
import type { State, ViewId } from '../state'
import { sparkline } from '../memory-lines'
import { visibleNotice, type Notice } from '../notices'
import { cells, clipCells } from './cells'
import { ago, clip, type Kit } from './common'
export const BAR_KEY = 'mark'
@@ -65,10 +66,12 @@ function workingParts(state: State, nowMs: number): BarPart[] {
const what = task !== undefined ? ` on ${clip(task.description || task.type, 40)}` : ' working'
const span = state.statusLog.get(agent.id)?.at(-1)?.atMs
return { text: `▶ ${labels.get(agent.id) ?? agent.type}${what}${since(span, nowMs)}`, tone: 'live' as const, go: 'swarm' as const }
const who = labels.get(agent.id) ?? agent.type
return { text: `▶ ${who}${what}${since(span, nowMs)}`, tone: 'live' as const, go: 'swarm' as const, compact: `▶ ${who}${since(span, nowMs)}` }
})
if (busy.length > 2) parts.push({ text: `+${busy.length - 2} more working`, tone: 'live', go: 'swarm' })
if (busy.length > 2) parts.push({ text: `+${busy.length - 2} more working`, tone: 'live', go: 'swarm', compact: `+${busy.length - 2}▶` })
return parts
}
@@ -91,7 +94,7 @@ export function missionPart(state: State): BarPart | null {
if (total === 0 || done >= total) return null
return { text: `🎯 ${done}/${total}${mission.paused ? ' paused' : running !== undefined ? ` · ${running.id} ${clip(running.title, 28)}` : ''} (1)`, tone: running !== undefined ? 'live' : 'plain', go: 'missions' }
return { text: `🎯 ${done}/${total}${mission.paused ? ' paused' : running !== undefined ? ` · ${running.id} ${clip(running.title, 28)}` : ''} (1)`, tone: running !== undefined ? 'live' : 'plain', go: 'missions', compact: `🎯 ${done}/${total}${mission.paused ? ' paused' : ''}` }
}
/**
@@ -110,7 +113,7 @@ export function barParts(state: State, nowMs: number = Date.now()): BarPart[] {
const approvals = waitingApprovalsOf(state).length
const alerts = alertsOf(state, nowMs, state.loadedAtMs).filter(alert => alert.level !== 'info').length
if (approvals > 0) parts.push({ text: `${approvals} to approve (q)`, tone: 'attention', go: 'approvals' })
if (approvals > 0) parts.push({ text: `${approvals} to approve (q)`, tone: 'attention', go: 'approvals', compact: `${approvals} to approve` })
if (alerts > 0) parts.push({ text: `⚠ ${alerts} alert${alerts === 1 ? '' : 's'}`, tone: 'attention', go: 'overview' })
// The active mission: how far along, and the task Claude is on (or that it is paused); a click opens Mission Control.
@@ -127,16 +130,16 @@ export function barParts(state: State, nowMs: number = Date.now()): BarPart[] {
}
// What is happening now: how long Claude has been on this turn, agents at work, the AI terminal's runs, and the newest event while it is fresh.
if (state.turnActive && state.turnStartedMs !== null) parts.push({ text: `▶ Claude working${since(state.turnStartedMs, nowMs)}`, tone: 'live', go: 'events' })
if (state.turnActive && state.turnStartedMs !== null) parts.push({ text: `▶ Claude working${since(state.turnStartedMs, nowMs)}`, tone: 'live', go: 'events', compact: `▶ Claude${since(state.turnStartedMs, nowMs)}` })
parts.push(...workingParts(state, nowMs))
for (const [agent, run] of state.terminal.runs) parts.push({ text: `💻 ${agent} answering${since(run.startedAtMs, nowMs)}`, tone: 'live', go: 'terminal' })
for (const [agent, run] of state.terminal.runs) parts.push({ text: `💻 ${agent} answering${since(run.startedAtMs, nowMs)}`, tone: 'live', go: 'terminal', compact: `💻 ${agent}` })
const latest = state.events.at(-1)
const isFresh = latest !== undefined && nowMs - latest.atMs < FRESH_MS
if (isFresh) parts.push({ text: `${clip(latest.text, 44)} ·${since(latest.atMs, nowMs)} ago`, tone: 'plain', go: 'events' })
if (isFresh) parts.push({ text: `${clip(latest.text, 44)} ·${since(latest.atMs, nowMs)} ago`, tone: 'plain', go: 'events', compact: `${clip(latest.text, 18)} ·${since(latest.atMs, nowMs)} ago` })
// Nothing moving: say so, with how many agents stand ready. (When something did happen, the last event is a standing part below.)
if (!parts.some(part => part.tone === 'live') && !isFresh && snap?.swarm != null) {
@@ -221,6 +224,12 @@ const BORDER: Record<BandTone, string> = { bad: PANEL.bad, attention: PANEL.atte
const NOTICE_MARK = { ok: '✓', info: 'ℹ', warn: '⚠', bad: '✖' } as const
const NOTICE_COLOR = { ok: PANEL.live, info: PANEL.text, warn: PANEL.attention, bad: PANEL.bad } as const
/** Columns kept for a row's "+N" when parts may be left out; the narrowest a clipped first part may be; the width below which the band is narrow. */
const MORE_CELLS = 4
const MIN_PART_CELLS = 8
export const NARROW_CELLS = 64
export const TINY_CELLS = 40
const toneColor = (tone: BarPart['tone']): string => (tone === 'attention' ? PANEL.attention : tone === 'live' ? PANEL.live : PANEL.text)
/**
@@ -237,26 +246,64 @@ export function barView(kit: Kit, state: State, columns: number, mark: RenderEle
const sep = (): RenderElement => kit.Text({ color: PANEL.dim, children: ' · ' })
// One part: a button to its view where it has one, else words in its tone's colour.
const partElement = (part: BarPart, key: string, room: number): RenderElement => {
const partElement = (part: BarPart, key: string, label: string): RenderElement => {
const go = part.go
const label = clip(part.text, room - 3)
if (go !== undefined && onGo !== undefined) return kit.Button({ key, label, plain: true, ...(part.tone === 'plain' && { dimColor: true }), onPress: () => onGo(go) })
return kit.Text({ wrap: 'truncate-end', color: toneColor(part.tone), children: label })
}
// A row whose parts do not all fit in full uses their compact forms (a part with none keeps its words), so a part is shortened by
// its own choice of words, not cut in the middle of one.
// A row whose parts do not all fit in full shortens them to their compact forms (a part with none keeps its words), so a part is
// shortened by its own choice of words, not cut in the middle of one. Widths are terminal columns (`cells`), not string length: an emoji
// counted as one column overflowed the row, and the host then wrapped it onto a second line. A part that still does not fit is
// left out whole, never cut, and a dim "+N" says how many were (a click on the band opens the console, where they all are). Only
// the row's first part may be clipped, so a narrow band still says what matters most.
// `bare` is a row whose lead already ends in its own space (the standing row's "↳ "): its first part needs no separator before it.
const fill = (lead: RenderElement[], room: number, shown: BarPart[], from: number, bare = false): { children: RenderElement[]; room: number } => {
const children = [...lead]
const tight = shown.reduce((sum, part) => sum + part.text.length + 3, 0) > room
const forms = shown.map(part => (tight && part.compact !== undefined ? { ...part, text: part.compact } : part))
// Shorten the part that saves the most, one at a time, until the row fits: a wide band keeps every other part's full words.
const forms = [...shown]
const total = (): number => forms.reduce((sum, part) => sum + cells(part.text) + 3, 0)
while (total() > room) {
let best = -1
let saved = 0
for (const [i, part] of forms.entries()) {
const gain = part.compact === undefined ? 0 : cells(part.text) - cells(part.compact)
if (gain > saved) [best, saved] = [i, gain]
}
if (best < 0) break
forms[best] = { ...forms[best]!, text: forms[best]!.compact as string, compact: undefined }
}
let placed = 0
for (const [i, part] of forms.entries()) {
if (room <= 6) break
children.push(...(bare && i === 0 ? [] : [sep()]), partElement(part, `band-${from + i}`, room))
room -= part.text.length + (bare && i === 0 ? 0 : 3)
const gap = bare && i === 0 ? 0 : 3
// Keep room for the "+N" when more parts follow this one.
const reserve = i < forms.length - 1 ? MORE_CELLS : 0
const width = cells(part.text)
const fits = gap + width <= room - reserve
const first = placed === 0 && room - gap - reserve >= MIN_PART_CELLS
if (!fits && !first) break
const label = fits ? part.text : clipCells(part.text, room - gap - reserve)
children.push(...(gap === 0 ? [] : [sep()]), partElement(part, `band-${from + i}`, label))
room -= gap + cells(label)
placed += 1
}
const hidden = forms.length - placed
if (hidden > 0) {
const more = ` +${hidden}`
children.push(kit.Text({ color: PANEL.dim, children: more }))
room -= cells(more)
}
return { children, room }
@@ -264,9 +311,14 @@ export function barView(kit: Kit, state: State, columns: number, mark: RenderEle
const status = parts.filter(part => part.row !== 'standing')
const standing = parts.filter(part => part.row === 'standing')
const first = fill([mark !== null ? mark : kit.Text({ color: PANEL.attention, children: '◆ ' }), kit.Text({ bold: true, color: PANEL.text, children: 'ruflo' })], inner - 5 - (state.pane.isOpen ? 0 : 18), status, 0)
// The lead is the mark (two columns) and "ruflo". Closed, the row ends in an open button sized from its own label, which a narrow
// band shortens to "open" so the parts keep the room.
const openLabel = inner < NARROW_CELLS ? 'open' : 'open console'
// Below TINY_CELLS the mark alone stands for ruflo, so the most urgent part is not the one cut.
const named = inner >= TINY_CELLS
const first = fill([mark !== null ? mark : kit.Text({ color: PANEL.attention, children: '◆ ' }), ...(named ? [kit.Text({ bold: true, color: PANEL.text, children: 'ruflo' })] : [])], inner - (named ? 7 : 2) - (state.pane.isOpen ? 0 : openLabel.length + 2), status, 0, !named)
if (!state.pane.isOpen) first.children.push(kit.Text({ children: ' ' }), kit.Button({ key: 'open-console', label: 'open console', plain: true, onPress: onOpen }))
if (!state.pane.isOpen) first.children.push(kit.Text({ children: ' ' }), kit.Button({ key: 'open-console', label: openLabel, plain: true, onPress: onOpen }))
// The second row: the standing facts, then the links with what room is left (a link that does not fit is dropped, not cut).
const second = fill([kit.Text({ color: PANEL.dim, children: '↳ ' })], inner - 2, standing, status.length, true)
@@ -288,7 +340,7 @@ export function barView(kit: Kit, state: State, columns: number, mark: RenderEle
flexDirection: 'row',
children: [
kit.Text({ bold: true, color: NOTICE_COLOR[notice.level], children: `${NOTICE_MARK[notice.level]} ` }),
kit.Text({ color: NOTICE_COLOR[notice.level], wrap: 'truncate-end', children: clip(notice.text, Math.max(10, inner - 24)) }),
kit.Text({ color: NOTICE_COLOR[notice.level], wrap: 'truncate-end', children: clipCells(notice.text, Math.max(10, inner - 24)) }),
kit.Text({ children: ' ' }),
...(notice.go !== undefined && onGo !== undefined ? [kit.Button({ key: 'band-notice-go', label: 'view', plain: true, onPress: () => onGo(notice.go as ViewId) })] : []),
...(onDismiss !== undefined ? [kit.Text({ children: ' ' }), kit.Button({ key: 'band-notice-dismiss', label: '✕', plain: true, dimColor: true, onPress: onDismiss })] : []),
@@ -0,0 +1,33 @@
/**
* Terminal-column widths for the band and anything else that lays text out by columns. Leaf: no host, no engine.
*/
/** One character's terminal width: 2 for emoji drawn as emoji (🎯, 💻) and wide CJK, 0 for a variation selector or joiner, else 1. */
const charCells = (ch: string): number => (/[\u200d\ufe0e\ufe0f]/.test(ch) ? 0 : /\p{Emoji_Presentation}|[\u1100-\u115f\u2e80-\ua4cf\uac00-\ud7a3\uf900-\ufaff\uff00-\uff60\uffe0-\uffe6]/u.test(ch) ? 2 : 1)
/** How many terminal columns `text` takes. `.length` counts UTF-16 units, which is wrong both ways for emoji, so a row measured with it overflows and wraps. */
export const cells = (text: string): number => {
let n = 0
for (const ch of text) n += charCells(ch)
return n
}
/** `clip` measured in terminal columns: the result, ellipsis included, takes at most `width` columns. */
export function clipCells(text: string, width: number): string {
if (cells(text) <= width) return text
let out = ''
let used = 0
for (const ch of text) {
const w = charCells(ch)
if (used + w > width - 1) break
out += ch
used += w
}
return width <= 0 ? '' : `${out}…`
}
+2 -2
View File
@@ -11,9 +11,9 @@ step() { printf "→ %s ... " "$1"; }
ok() { printf "PASS\n"; PASS=$((PASS+1)); }
bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }
step "1. plugin.json declares ruflo-console 0.49.9"
step "1. plugin.json declares ruflo-console 0.49.10"
grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \
&& grep -q '"version": "0.49.9"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
&& grep -q '"version": "0.49.10"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
step "2. hooks.json names exactly one module and no classic hook commands"
grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \
+55 -3
View File
@@ -8,7 +8,8 @@ import type { ReadCache } from '../hooks/data/files'
import { readSnapshot } from '../hooks/data/snapshot'
import { newState } from '../hooks/state'
import { secMemo } from '../hooks/secure'
import { BAND_LINKS, barParts, barText, barView, money, PANEL } from '../hooks/views/bar'
import { BAND_LINKS, barParts, barText, barView, money, NARROW_CELLS, PANEL } from '../hooks/views/bar'
import { cells, clipCells } from '../hooks/views/cells'
import type { Kit } from '../hooks/views/common'
import { RUFLO_FILES } from './fixtures/ruflo-run'
@@ -139,8 +140,10 @@ describe('band: a panel of two rows, standing facts that stay, and links', () =>
const [top, bottom] = panel.props.children as El[]
const narrow = readable(bottom)
// The long task is clipped on the status row: that is what keeps the second row whole.
expect(readable(top)).toContain('…')
// The long task shortens to its compact form on the status row (who, not what), so neither row is cut mid-word.
expect(readable(top)).toContain('▶ coder')
expect(readable(top)).not.toContain('research prior art')
expect(readable(top)).not.toContain('…')
expect(narrow).toContain('claude: Bash')
expect(narrow).toContain('5m ago')
expect(narrow).toMatch(/\d+ claims?/)
@@ -202,6 +205,55 @@ describe('band: a panel of two rows, standing facts that stay, and links', () =>
})
})
describe('band: a narrow pane', () => {
async function busyState() {
const state = await capturedState(['ruflo-core', 'ruflo-swarm', 'ruflo-mods', 'ruflo-console'])
const snap = state.snapshot as NonNullable<typeof state.snapshot>
const agent = snap.agents[0] as (typeof snap.agents)[number]
agent.status = 'busy'
snap.tasks.push({ id: 'task-9', type: 'feature', description: 'research prior art, existing ADRs and the whole of the history of this repository', status: 'in_progress', assignedTo: [agent.id] })
state.terminal.runs.set('codex', { label: 'codex', startedAtMs: Date.now() - 90_000, stop: () => undefined })
state.usage = { costUsd: 19.81, contextPercent: 91 }
state.events.push({ atMs: Date.now() - 300_000, kind: 'claims', text: 'claude: Bash' })
return state
}
it('measures terminal columns, not string length', () => {
expect(cells('abc')).toBe(3)
expect(cells('🎯 3/5')).toBe(6)
expect(cells('💻 codex')).toBe(8)
expect(cells('⚠ 2 alerts')).toBe(10)
expect(cells('✔️')).toBe(1)
expect(clipCells('💻 codex answering', 6)).toBe('💻 co…')
expect(cells(clipCells('🎯🎯🎯🎯', 5))).toBeLessThanOrEqual(5)
})
for (const columns of [32, 40, 48, 60]) {
it(`at ${columns} columns every row fits on one line, nothing is cut mid-word past the first part, and what was left out is counted`, async () => {
const state = await busyState()
const panel = barView(kit, state, columns, null, () => undefined, () => undefined) as unknown as El
const rows = panel.props.children as El[]
// Border (2) and padding (2) take four columns: the rows get the rest.
const inner = columns - 4
for (const row of rows) expect(cells(readable(row)), readable(row)).toBeLessThanOrEqual(inner)
const top = readable(rows[0])
// The ellipsis may only end the first part of a row: later parts are whole or left out.
expect(top.split('…').length - 1).toBeLessThanOrEqual(1)
// At the narrowest widths something is left out, and the row says how much.
if (columns <= 40) expect(top).toMatch(/\+\d+/)
// Narrow, the open button is just "open".
expect(buttons(rows[0]).map(button => button.props.label)).toContain(inner < NARROW_CELLS ? 'open' : 'open console')
// The most urgent thing still shows.
expect(top).toMatch(/2 to approve|⚠/)
})
}
})
describe('band: findings and an available update', () => {
it('names high and critical findings from the last scan, loud only when one is critical, and says nothing for none', () => {
const state = newState({})