🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
feat(ruflo-console): narrow panes keep cards, nav card and accents; the menu's groups fold (ADR-430)
ruvbb0cb2b94a9c
diff --git a/plugins/ruflo-console/hooks/views/card.ts b/plugins/ruflo-console/hooks/views/card.tsindex ab67664171..735f42f616 100644--- a/plugins/ruflo-console/hooks/views/card.ts+++ b/plugins/ruflo-console/hooks/views/card.ts@@ -22,8 +22,11 @@ function holdsHead(children: unknown): boolean {return typeof children === 'object' && children !== null && HEADS.has(children)}-/** Whether a page of this width and pane is drawn in cards: not in the narrow layout, and not in a compact inline pane (its rows are few). */-export const hasCards = (columns: number, isCompact: boolean): boolean => columns >= 60 && !isCompact+/** The narrowest pane still drawn in cards: the nav card, the section cards and their accents keep their styling down to here, in a short pane too. */+export const MIN_CARD_COLUMNS = 44++/** Whether a page of this width is drawn in cards. A short (compact) inline pane has them too: it scrolls, and it should not lose its styling. */+export const hasCards = (columns: number, _isCompact = false): boolean => columns >= MIN_CARD_COLUMNS/** `accent` is the border's colour in the BBS look (the page's group colour); without it, the theme's. */export function withCards(kit: Ctx['kit'], accent?: string): Ctx['kit'] {diff --git a/plugins/ruflo-console/hooks/views/frames.ts b/plugins/ruflo-console/hooks/views/frames.tsindex f91c285386..602d2d816a 100644--- a/plugins/ruflo-console/hooks/views/frames.ts+++ b/plugins/ruflo-console/hooks/views/frames.ts@@ -139,7 +139,7 @@ export function picturesOf(state: State, columns: number, nowMs: number, t: numbconst sinceSwitch = state.pane.viewAtMs > 0 ? nowMs - state.pane.viewAtMs : Infinityconst headerAge = state.options.fps > 0 ? Math.min(sinceSwitch, entryAge({ look: state.options.look, boot: state.options.boot, ...state.pane }, nowMs, BOOT_MIN_MS) ?? Infinity) : Infinity- if (!isCompactPane(state) && state.view === 'menu') {+ if (state.view === 'menu') {const project = state.cwd.split('/').filter(Boolean).at(-1) ?? ''pictures.set('header', state.options.look === 'bbs' ? bannerPicture(project, Math.min(width, 72), t, headerAge) : headerPicture(`◆ ruflo v${CONSOLE_VERSION}${getBuild() === '' ? '' : ` · ${getBuild()}`} · ${project}`, Math.min(width, 64), t))diff --git a/plugins/ruflo-console/hooks/views/menu.ts b/plugins/ruflo-console/hooks/views/menu.tsindex c8874b9388..de610a603f 100644--- a/plugins/ruflo-console/hooks/views/menu.ts+++ b/plugins/ruflo-console/hooks/views/menu.ts@@ -6,7 +6,7 @@ import type { RenderElement } from 'claude-code'import { ACCENT, badgesOf, chip, LOUD, MUTED, PALETTE } from '../menu-style'import { VIEWS, type ViewId } from '../state'import { barParts } from './bar'-import { clip, col, isBbs, picture, row, text, THEME, type Ctx } from './common'+import { button, clip, col, isBbs, picture, row, text, THEME, type Ctx } from './common'import { missionStrip } from './mission-control'type Item = { label: string; go: string }@@ -94,12 +94,21 @@ export function menuView(ctx: Ctx): RenderElement {const bbs = isBbs()const badges = badgesOf(state, nowMs)+ // Each group folds: its bar has a ▾ / ▸ that hides or shows its entries (like every other section). In a narrow pane (one column of four tall+ // boxes) only the first group starts open; the rest are one bar each until opened, and the row above the boxes opens or closes them all.+ const startsOpen = (gi: number): boolean => ctx.columns >= 60 || gi === 0+ const foldKey = (group: (typeof GROUPS)[number]): string => `menu/${group.title}`+ const isGroupOpen = (group: (typeof GROUPS)[number], gi: number): boolean => startsOpen(gi) !== state.sections.has(foldKey(group))+ const setAll = (open: boolean): void => GROUPS.forEach((group, gi) => isGroupOpen(group, gi) !== open && ctx.act.toggle(foldKey(group)))+// Each group a bordered box: ▓▒░ TITLE ░▒▓ on top, then its sub-sections, each a dim ── name ── rule and its items.const box = (group: (typeof GROUPS)[number], gi: number) => {const started = entry === null || entry >= groupStart(gi)let seen = 0const accent = ACCENT[group.title] ?? '#d0d0d0'- const title = clip(`▓▒░ ${group.title} ░▒▓`, width - 4)+ const title = clip(`▓▒░ ${group.title} ░▒▓`, width - 8)+ const isOpen = isGroupOpen(group, gi)+ const count = group.sections.reduce((n, section) => n + section.items.filter(isShown).length, 0)return ctx.kit.Box({flexDirection: 'column',@@ -109,10 +118,19 @@ export function menuView(ctx: Ctx): RenderElement {paddingX: 1,key: `menu-${group.title}`,children: [- bbs- ? ctx.kit.Box({ key: `menu-bar-${group.title}`, children: [ctx.kit.Text({ ...chip(accent), wrap: 'truncate-end', children: (entry === null ? ` ${title}` : scramble(` ${title}`, entry, groupStart(gi), ENTRY.titleMs).padEnd(width - 2)).padEnd(width - 2).slice(0, width - 2) })] })- : ctx.kit.Text({ bold: true, color: THEME.head, wrap: 'truncate-end', children: title }),- ...group.sections.flatMap(section => {+ ctx.kit.Box({+ flexDirection: 'row',+ key: `menu-head-${group.title}`,+ children: [+ ctx.kit.Button({ key: `menu-fold-${group.title}`, label: isOpen ? '▾' : '▸', plain: true, onPress: () => ctx.act.toggle(foldKey(group)) }),+ bbs+ ? ctx.kit.Box({ key: `menu-bar-${group.title}`, children: [ctx.kit.Text({ ...chip(accent), wrap: 'truncate-end', children: (entry === null ? ` ${title}` : scramble(` ${title}`, entry, groupStart(gi), ENTRY.titleMs).padEnd(width - 7)).padEnd(width - 2).slice(0, width - 7) })] })+ : ctx.kit.Text({ bold: true, color: THEME.head, wrap: 'truncate-end', children: title }),+ ],+ }),+ ...(!isOpen+ ? [ctx.kit.Text({ color: THEME.info, dimColor: true, wrap: 'truncate-end', children: clip(` ${count} entr${count === 1 ? 'y' : 'ies'} · ▸ opens ${group.title.toLowerCase()}`, width - 4) })]+ : group.sections.flatMap(section => {const items = section.items.filter(isShown)if (entry !== null && !started) return items.length === 0 ? [] : [ctx.kit.Text({ children: ' ' }), ...items.map(item => ctx.kit.Box({ key: `mi-${item.go}`, children: [ctx.kit.Text({ children: ' ' })] }))]@@ -142,7 +160,7 @@ export function menuView(ctx: Ctx): RenderElement {})}),]- }),+ })),],})}@@ -157,6 +175,11 @@ export function menuView(ctx: Ctx): RenderElement {)}+ // The labels shorten as the pane narrows, so the row never runs past the edge.+ const tight = ctx.columns < 34++ rows.push(row(ctx, [...(ctx.columns >= 46 ? [text(ctx, ' groups ', { dimColor: true })] : []), button(ctx, 'menu-expand-all', tight ? '▾ all' : '▾ expand all', () => setAll(true)), button(ctx, 'menu-collapse-all', tight ? '▸ none' : '▸ collapse all', () => setAll(false))], 'menu-fold-all'))+for (let i = 0; i < GROUPS.length; i += perRow) {rows.push(ctx.kit.Box({ flexDirection: 'row', gap: 1, key: `menu-row-${i}`, children: GROUPS.slice(i, i + perRow).map((group, j) => box(group, i + j)) }))}diff --git a/plugins/ruflo-console/hooks/views/pane.ts b/plugins/ruflo-console/hooks/views/pane.tsindex cede7d5a5a..92bf2e78a9 100644--- a/plugins/ruflo-console/hooks/views/pane.ts+++ b/plugins/ruflo-console/hooks/views/pane.ts@@ -14,6 +14,7 @@ import { groupedTabs } from './nav'import { stepsRows } from './steps'import { optimizerResult } from './optimizer'import { fitFooter, type FooterItem } from '../footer-layout'+import { chip } from '../menu-colors'import { accentOfView } from '../nav-state'import { isBooting, isCompactPane, NAV_STYLES, VIEWS, type ViewId } from '../state'import { agentView } from './agent'@@ -93,7 +94,12 @@ function tabs(ctx: Ctx): RenderElement {const index = VIEWS.findIndex(view => view.id === ctx.state.view)const label = index < 0 ? 'Agent' : (VIEWS[index]?.label ?? '')- return text(ctx, `${index < 0 ? '·' : `${index + 1}/${VIEWS.length}`} ${label} · /ruflo help`, { bold: true, color: THEME.head })+ const where = `${index < 0 ? '·' : `${index + 1}/${VIEWS.length}`} ${label}`++ // Even this narrow, the BBS look keeps its colours: the page is a solid chip in its group's accent, with the way to help beside it.+ return isBbs()+ ? row(ctx, [ctx.kit.Text({ ...chip(accentOfView(ctx.state.view === 'agent' ? ctx.state.back : ctx.state.view) ?? '#05d9e8'), bold: true, children: ` ${where} ` }), ctx.kit.Text({ dimColor: true, children: ' /ruflo help' })])+ : text(ctx, `${where} · /ruflo help`, { bold: true, color: THEME.head })}// Two rows: the nine data views (1-9), then the management views and the two boards (g q e m, w x.ruv.io, i terminal). Each tab is its emoji; thediff --git a/plugins/ruflo-console/tests/card.spec.ts b/plugins/ruflo-console/tests/card.spec.tsindex 7001ac65b7..395a6c5d39 100644--- a/plugins/ruflo-console/tests/card.spec.ts+++ b/plugins/ruflo-console/tests/card.spec.ts@@ -47,10 +47,11 @@ describe('cards', () => {expect(made(cards.Box(row as never)).props).toEqual(row)})- it('draws cards only in a page wide enough, and not in a compact pane', () => {+ it('draws cards in a page of 44 columns or more, in a compact (short) pane too', () => {expect(hasCards(100, false)).toBe(true)- expect(hasCards(59, false)).toBe(false)- expect(hasCards(100, true)).toBe(false)+ expect(hasCards(43, false)).toBe(false)+ expect(hasCards(44, false)).toBe(true)+ expect(hasCards(100, true)).toBe(true)expect(CARD_COLUMNS).toBe(4)})})diff --git a/plugins/ruflo-console/tests/design.spec.ts b/plugins/ruflo-console/tests/design.spec.tsindex 352df011f3..c7efaf05cb 100644--- a/plugins/ruflo-console/tests/design.spec.ts+++ b/plugins/ruflo-console/tests/design.spec.ts@@ -112,7 +112,7 @@ describe('the nav card', () => {it('never lets a badge push a row of pages past the width, at any width the nav draws', () => {// Every width, not a few: the auto form is chosen by whether the widest row fits, so an uncounted badge only overruns in the narrow// window of widths where that choice is on the edge.- for (let columns = 50; columns <= 200; columns++) {+ for (let columns = 44; columns <= 200; columns++) {const { card } = open('learning', columns, state => {state.usage = { costUsd: 1234.5 }state.updateAvailable = '10.20.30'diff --git a/plugins/ruflo-console/tests/menu-wrap.spec.ts b/plugins/ruflo-console/tests/menu-wrap.spec.tsindex 504438102a..43e55fc5e1 100644--- a/plugins/ruflo-console/tests/menu-wrap.spec.ts+++ b/plugins/ruflo-console/tests/menu-wrap.spec.ts@@ -7,7 +7,7 @@ import { afterEach, describe, expect, it } from 'vitest'import { newState } from '../hooks/state'import { setLook, type Ctx } from '../hooks/views/common'-import { menuView } from '../hooks/views/menu'+import { GROUPS, menuView } from '../hooks/views/menu'import { wrap } from '../hooks/views/common'type El = { props: Record<string, unknown>; kind: string }@@ -118,3 +118,103 @@ describe('the main menu at small widths', () => {expect(wrap('research → create (ADRs, SOP) → build → test → validate → secure → benchmark → learn', 30).join(' ')).toContain('benchmark → learn')})})++const GROUP_COUNT = GROUPS.length++describe('the menu folds, and narrow panes keep their styling', () => {+ const calls: string[] = []+ const recorder = (path: string): unknown =>+ new Proxy(() => undefined, {+ get: (_t, key) => (key === 'then' ? undefined : recorder(`${path}.${String(key)}`)),+ apply: (_t, _this, args) => void calls.push(`${path.slice(1)}(${args.join(',')})`),+ })+ const draw = (columns: number, folded: string[] = []): { tree: El; text: string } => {+ const state = newState({})++ state.options.look = 'bbs'+ state.view = 'menu'+ for (const key of folded) state.sections.add(key)+ setLook('bbs')++ const tree = menuView({ kit, state, nowMs: 5_000, columns, pictures: new Map(), act: recorder('') as never, cards: false } as unknown as Ctx) as unknown as El+ const strings: string[] = []+ const walk = (el: unknown): void => {+ const node = el as El++ if (typeof node !== 'object' || node === null) return++ const kids = node.props.children++ if (typeof kids === 'string') strings.push(kids)+ else if (Array.isArray(kids)) kids.forEach(walk)+ else if (typeof kids === 'object') walk(kids)+ }++ walk(tree)++ return { tree, text: strings.join('\n') }+ }+ const flat = (el: unknown): El[] => {+ const node = el as El++ if (typeof node !== 'object' || node === null) return []++ const kids = node.props.children++ return [node, ...(Array.isArray(kids) ? kids.flatMap(flat) : typeof kids === 'object' ? flat(kids) : [])]+ }+ const entries = (tree: El): number => flat(tree).filter(node => String(node.props.key).startsWith('menu-go-')).length++ it('opens every group on a wide pane, and only the first on a narrow one', () => {+ const wide = draw(100)+ const narrow = draw(50)++ expect(entries(narrow.tree)).toBeGreaterThan(0)+ expect(entries(wide.tree)).toBeGreaterThan(entries(narrow.tree))+ expect(narrow.text).toContain('entries · ▸ opens')+ expect(wide.text).not.toContain('entries · ▸ opens')+ })++ it('folds an open group and opens a closed one when its ▾ / ▸ is pressed (the section state is the toggle)', () => {+ calls.length = 0++ const { tree } = draw(100)+ const fold = flat(tree).find(node => String(node.props.key).startsWith('menu-fold-') && !String(node.props.key).includes('all'))++ ;(fold?.props.onPress as () => void)()+ expect(calls[0]).toMatch(/^toggle\(menu\//)++ // The toggled group is folded on a wide pane, and opened on a narrow one.+ const title = String(fold?.props.key).replace('menu-fold-', '')++ expect(entries(draw(100, [`menu/${title}`]).tree)).toBeLessThan(entries(draw(100).tree))+ expect(entries(draw(50, GROUPS.map(group => `menu/${group.title}`)).tree)).toBeGreaterThan(entries(draw(50).tree))+ })++ it('expand all and collapse all toggle only the groups that need it', () => {+ calls.length = 0++ const wide = draw(100)++ ;(flat(wide.tree).find(node => node.props.key === 'menu-expand-all')?.props.onPress as () => void)()+ expect(calls).toEqual([])+ ;(flat(wide.tree).find(node => node.props.key === 'menu-collapse-all')?.props.onPress as () => void)()+ expect(calls.length).toBe(GROUP_COUNT)+ })++ it('keeps its colours when very narrow: the page is a solid chip in its group accent', async () => {+ const { paneView } = await import('../hooks/views/pane')+ const state = newState({})++ state.options.look = 'bbs'+ state.options.boot = false+ state.view = 'swarm'+ state.snapshot = null++ const tree = paneView({ kit, state, nowMs: 5_000, columns: 40, pictures: new Map(), act: recorder('') as never, cards: false } as unknown as Ctx) as unknown as El+ const chip = flat(tree).find(node => node.props.inverse === true && String(node.props.children).includes('Swarm'))++ expect(chip).toBeDefined()+ expect(chip?.props.color).toMatch(/^#/)+ })+})diff --git a/plugins/ruflo-console/tests/render-smoke.spec.ts b/plugins/ruflo-console/tests/render-smoke.spec.tsindex ef33860022..e9d2ce3c2a 100644--- a/plugins/ruflo-console/tests/render-smoke.spec.ts+++ b/plugins/ruflo-console/tests/render-smoke.spec.ts@@ -55,7 +55,7 @@ afterAll(() => setLook('plain'))describe('every page draws', () => {for (const look of ['bbs', 'plain'] as const) {- for (const columns of [60, 100, 160]) {+ for (const columns of [44, 60, 100, 160]) {it(`in the ${look} look at ${columns} columns, empty and busy`, async () => {setLook(look)diff --git a/v3/docs/adr/ADR-430-console-menu-design.md b/v3/docs/adr/ADR-430-console-menu-design.mdnew file mode 100644index 0000000000..65b6551b0a--- /dev/null+++ b/v3/docs/adr/ADR-430-console-menu-design.md@@ -0,0 +1,6 @@++## Amendment (2026 10 03): narrow panes keep their styling, and the groups fold++- **Cards and the nav card down to 44 columns, in a short pane too.** They were drawn only from 60 columns and never in a compact (short inline) pane, so a smaller pane fell back to the flat tab rows with the style buttons and lost the accents. They now draw from 44 columns (`MIN_CARD_COLUMNS`), compact or not. Under 44 the one-line nav is a solid chip in the page's group accent. The palette strip stays in a short pane.+- **Compact lays out like wide.** The title leads and the tabs follow (they were first). The menu wraps its mission-stage line into lines instead of cutting it at `SOP…`, and its status bar drops the modem text, then clips, before it would pass the edge.+- **The menu's groups fold.** Each group's bar has a ▾ / ▸ that hides or shows its entries (a folded group is its bar and an "N entries · ▸ opens" line); a row above the groups opens or closes them all. On a wide pane every group starts open; on a narrow one (a single tall column) only the first does. Specs: no text or row wider than the pane at any width from 30 to 120; every stage readable at every width; the fold defaults and toggles; the nav fits at every width from 44.