Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

feat(ruflo-console): the menu's palette strip is animated; the search finds sentries, updates, loops and AIDefence (ADR 430)

ruv5c34d186037f
diff --git a/plugins/ruflo-console/hooks/gfx/pictures.ts b/plugins/ruflo-console/hooks/gfx/pictures.ts
index 6aeb3b77b4..d60d7c2689 100644
--- a/plugins/ruflo-console/hooks/gfx/pictures.ts
+++ b/plugins/ruflo-console/hooks/gfx/pictures.ts
@@ -320,6 +320,26 @@ export function titlePicture(name: string, columns: number, t: number): Grid {
return grid
}
+/**
+ * The menu's palette strip: one block of each colour across the width, and a band of light that sweeps along it and starts again,
+ * brightening the cells it passes (about 28 cells a second: three cells a frame at the default 8 fps, so it reads as motion, not a
+ * jump). At `t` = 0 the light is off the strip and the cells are exactly the colours, so a still frame (fps 0) is the plain strip.
+ * Decoration, like the boot's sign: it carries no data. A pure function of its size and the clock, as every picture here.
+ */
+export function palettePicture(columns: number, t: number, colors: readonly number[]): Grid {
+ const grid = new Grid(columns, 1)
+ const at = ((t / 36) % (columns + 24)) - 12
+
+ for (let x = 0; x < columns; x++) {
+ const base = colors[Math.min(colors.length - 1, Math.floor((x * colors.length) / columns))] ?? 0xffffff
+ const glow = Math.max(0, 1 - Math.abs(x - at) / 7)
+
+ grid.set(x, 0, '▀', mix(base, 0xffffff, glow * 0.8))
+ }
+
+ return grid
+}
+
export function headerPicture(title: string, columns: number, t: number): Grid {
const grid = new Grid(columns, 1)
const at = ((t / 22) % (columns + 60)) - 20
diff --git a/plugins/ruflo-console/hooks/menu-colors.ts b/plugins/ruflo-console/hooks/menu-colors.ts
new file mode 100644
index 0000000000..66f35cead1
--- /dev/null
+++ b/plugins/ruflo-console/hooks/menu-colors.ts
@@ -0,0 +1,24 @@
+/**
+ * The main menu's colours, a leaf with no imports: the drawing code (the animated palette strip in gfx and frames) reads them, and
+ * menu-style.ts, which reaches the pages, re-exports them. Each is a step of the xterm 256-colour cube or its grey ramp
+ * (tests/menu-style.spec.ts holds that, and the contrast of the ink on each accent).
+ */
+/** The ink on an accent's solid bar, and the muted ink for a badge that is only information. */
+export const INK = '#1c1c1c'
+export const MUTED = '#8a8a8a'
+export const LOUD = '#ffaf00'
+
+/** One accent per menu group, by the group's title. */
+export const ACCENT: Readonly<Record<string, string>> = {
+ SWARM: '#ffaf00',
+ INTELLIGENCE: '#5fd7ff',
+ 'SAFETY & OPS': '#ff5f5f',
+ 'NETWORK & EXTEND': '#5fd75f',
+ TOOLS: '#d787ff',
+}
+
+/** The palette strip above the groups: the accents in menu order. */
+export const PALETTE: readonly string[] = ['#ffaf00', '#5fd7ff', '#ff5f5f', '#5fd75f', '#d787ff']
+
+/** `#rrggbb` as the 0xRRGGBB number a Grid takes. */
+export const rgb = (hex: string): number => Number.parseInt(hex.slice(1), 16)
diff --git a/plugins/ruflo-console/hooks/menu-style.ts b/plugins/ruflo-console/hooks/menu-style.ts
index 6adebf9df6..878591c4ad 100644
--- a/plugins/ruflo-console/hooks/menu-style.ts
+++ b/plugins/ruflo-console/hooks/menu-style.ts
@@ -12,22 +12,7 @@ import { secMemo } from './secure'
import type { State, ViewId } from './state'
import { money } from './views/bar'
-/** The ink on an accent's solid bar, and the muted ink for a badge that is only information. */
-export const INK = '#1c1c1c'
-export const MUTED = '#8a8a8a'
-export const LOUD = '#ffaf00'
-
-/** One accent per menu group, by the group's title. */
-export const ACCENT: Readonly<Record<string, string>> = {
- SWARM: '#ffaf00',
- INTELLIGENCE: '#5fd7ff',
- 'SAFETY & OPS': '#ff5f5f',
- 'NETWORK & EXTEND': '#5fd75f',
- TOOLS: '#d787ff',
-}
-
-/** The palette strip above the groups: the accents in menu order. */
-export const PALETTE: readonly string[] = ['#ffaf00', '#5fd7ff', '#ff5f5f', '#5fd75f', '#d787ff']
+export { ACCENT, INK, LOUD, MUTED, PALETTE } from './menu-colors'
export type Badge = { text: string; tone: 'attention' | 'plain' }
diff --git a/plugins/ruflo-console/hooks/state.ts b/plugins/ruflo-console/hooks/state.ts
index 595fb77610..88be0caa5f 100644
--- a/plugins/ruflo-console/hooks/state.ts
+++ b/plugins/ruflo-console/hooks/state.ts
@@ -53,15 +53,15 @@ export const VIEWS: readonly { id: ViewId; key: string; label: string; short: st
{ id: 'xruv', key: 'w', label: 'x.ruv.io', short: 'XRV', icon: '🛸', blurb: 'the open agent federation: what it offers, how to join, its channels and who is on', rows: 50 },
{ id: 'terminal', key: 'i', label: 'Terminal', short: 'Trm', icon: '💻', blurb: 'an AI terminal: claude -p, codex or both, each a session that remembers the conversation, streamed live', rows: 120 },
{ id: 'skills', key: 'z', label: 'Skills', short: 'Skl', icon: '🧰', blurb: 'agent skills (npx skills, skills.sh): installed, search, use without installing, preview, add to chosen agents, update, create', rows: 60 },
- { id: 'secure', key: 'u', label: 'Security & Doctor', short: 'Sec', icon: '🔒',blurb: 'security scans, a paste field that checks text for injection and PII, policy, and every doctor check', rows: 40 },
+ { id: 'secure', key: 'u', label: 'Security & Doctor', short: 'Sec', icon: '🔒',blurb: 'security scans, a paste field where AIDefence checks text for injection and PII, policy, sentries that scan on a schedule or on change, and every doctor check', rows: 40 },
{ id: 'perf', key: 'f', label: 'Performance', short: 'Prf', icon: '📈', blurb: 'metrics, profile, benchmarks, bottlenecks and a latency sparkline from each run', rows: 30 },
- { id: 'automate', key: 'a', label: 'Automation', short: 'Aut', icon: '🤖', blurb: 'workflows, the twelve background workers and their daemon, autopilot, sessions, config and a task kanban', rows: 44 },
+ { id: 'automate', key: 'a', label: 'Automation', short: 'Aut', icon: '🤖', blurb: 'workflows, the twelve background workers and their daemon, loops, autopilot, sessions, config and a task kanban', rows: 44 },
{ id: 'neural', key: 'l', label: 'Learning Lab', short: 'Lab', icon: '🧪', blurb: 'train neural patterns and watch the loss, ask the router which agent fits a task, and why', rows: 36 },
{ id: 'vector', key: 'v', label: 'Vector Lab', short: 'Vec', icon: '🧲', blurb: 'ruvector: the shared brain, RVF stores, rvlite queries, decompile, workers, edge, hooks intel and your pi identity', rows: 44 },
{ id: 'evolve', key: 't', label: 'Self-Evolution', short: 'Evo', icon: '🧬', blurb: 'the governed loop: flywheel receipts, ledger, lineage, the policy gate, the witness; Autogenous and rGi', rows: 44 },
{ id: 'devtools', key: 'd', label: 'Dev Tools', short: 'Dev', icon: '🔧', blurb: 'the integration surface: GitHub, diff analysis, agenticow, WASM, browser, terminal, providers, maintenance', rows: 40 },
{ id: 'market', key: 'm', label: 'Plugin Catalog', short: 'Cat', icon: '📦', blurb: 'every ruflo plugin, mod and skill: what it ships, install, enable, disable, update, view and use', rows: 50 },
- { id: 'settings', key: 's', label: 'Settings', short: 'Set', icon: '⚙️', blurb: 'simple to advanced settings: plugin options, ruflo config, and the AI terminal’s model and budget, each edited in place', rows: 50 },
+ { id: 'settings', key: 's', label: 'Settings', short: 'Set', icon: '⚙️', blurb: 'simple to advanced settings: plugin options, ruflo config, updates, and the AI terminal’s model and budget, each edited in place', rows: 50 },
]
export const AGENT_VIEW = { id: 'agent' as const, rows: 28 }
diff --git a/plugins/ruflo-console/hooks/views/frames.ts b/plugins/ruflo-console/hooks/views/frames.ts
index 54a5d90be2..838a244a24 100644
--- a/plugins/ruflo-console/hooks/views/frames.ts
+++ b/plugins/ruflo-console/hooks/views/frames.ts
@@ -8,6 +8,7 @@ import { recentByAgent } from '../data/events'
import { agentLabels } from '../data/parse'
import { getBootChecks } from '../boot-checks'
import { getBuild } from '../build'
+import { PALETTE, rgb } from '../menu-colors'
import { CONSOLE_VERSION } from '../version'
import type { Snapshot } from '../data/snapshot'
import type { Channels, Peers, Roster } from '../data/cli'
@@ -15,7 +16,7 @@ import { pipelinePicture, radarPicture, samplesPicture, trendPicture, gaugePictu
import { loopPicture, loopStagesOf } from '../gfx/evolve'
import { flowModelOf, flowPicture, flowRows } from '../gfx/flow'
import { federationPicture, ganttPicture, heatmapPicture, type FedNode, type HealthRow, type Lane } from '../gfx/maps'
-import { activityPicture, bannerPicture, bootPicture, titlePicture, curvePicture, headerPicture, PULSE_MS, topologyPicture, type TopoModel } from '../gfx/pictures'
+import { activityPicture, bannerPicture, bootPicture, titlePicture, curvePicture, headerPicture, palettePicture, PULSE_MS, topologyPicture, type TopoModel } from '../gfx/pictures'
import type { Grid } from '../gfx/raster'
import { PROBES, severityOf } from '../data/cli'
import { EXPECTED_IN_MARKET, RUFLO_MARKET } from '../data/snapshot'
@@ -136,6 +137,8 @@ export function picturesOf(state: State, columns: number, nowMs: number, t: numb
const project = state.cwd.split('/').filter(Boolean).at(-1) ?? ''
pictures.set('header', state.options.look === 'bbs' ? bannerPicture(project, Math.min(width, 72), t) : headerPicture(`◆ ruflo v${CONSOLE_VERSION}${getBuild() === '' ? '' : ` · ${getBuild()}`} · ${project}`, Math.min(width, 64), t))
+ // The palette strip above the menu's groups moves while the frame loop runs; with fps 0 it is the still strip (the light is off it).
+ if (state.options.look === 'bbs') pictures.set('palette', palettePicture(Math.max(8, width - 2), state.options.fps > 0 ? t : 0, PALETTE.map(rgb)))
}
// BBS: every view's name as ANSI-style block art under the tabs, compact or not (the neon sign is the boot's alone).
diff --git a/plugins/ruflo-console/hooks/views/menu.ts b/plugins/ruflo-console/hooks/views/menu.ts
index bb426a943c..0b8e935950 100644
--- a/plugins/ruflo-console/hooks/views/menu.ts
+++ b/plugins/ruflo-console/hooks/views/menu.ts
@@ -3,7 +3,7 @@ import type { RenderElement } from 'claude-code'
import { ACCENT, badgesOf, INK, LOUD, MUTED, PALETTE } from '../menu-style'
import { VIEWS, type ViewId } from '../state'
import { barParts } from './bar'
-import { clip, col, isBbs, row, text, THEME, type Ctx } from './common'
+import { clip, col, isBbs, picture, row, text, THEME, type Ctx } from './common'
import { missionStrip } from './mission-control'
type Item = { label: string; go: string }
@@ -133,8 +133,15 @@ export function menuView(ctx: Ctx): RenderElement {
})
}
- // A strip of the accents across the top, as a BBS drew its palette: one block of each, the width of the pane shared between them.
- if (bbs) rows.push(ctx.kit.Box({ flexDirection: 'row', key: 'menu-palette', children: PALETTE.map((color, i) => ctx.kit.Text({ color, children: '▀'.repeat(Math.max(1, Math.floor((ctx.columns - 2) / PALETTE.length))), key: `menu-palette-${i}` })) }))
+ // A strip of the accents across the top, as a BBS drew its palette, with a band of light sweeping along it (a picture, so it moves with
+ // the frame loop and costs one element). A surface that cannot draw pictures gets the still strip.
+ if (bbs) {
+ rows.push(
+ ctx.pictures.has('palette') && ctx.kit.Raster !== undefined
+ ? picture(ctx, 'palette', '')
+ : ctx.kit.Box({ flexDirection: 'row', key: 'menu-palette', children: PALETTE.map((color, i) => ctx.kit.Text({ color, children: '▀'.repeat(Math.max(1, Math.floor((ctx.columns - 2) / PALETTE.length))), key: `menu-palette-${i}` })) }),
+ )
+ }
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(box) }))
diff --git a/plugins/ruflo-console/tests/diagrams.spec.ts b/plugins/ruflo-console/tests/diagrams.spec.ts
index 2295a13ce1..ce79c18ef8 100644
--- a/plugins/ruflo-console/tests/diagrams.spec.ts
+++ b/plugins/ruflo-console/tests/diagrams.spec.ts
@@ -8,7 +8,7 @@ import { gaugePicture, pipelinePicture, radarPicture, samplesPicture, trendPictu
import { flowModelOf, flowPicture, flowRows, ringOf } from '../hooks/gfx/flow'
import { federationPicture, ganttPicture, heatmapPicture } from '../hooks/gfx/maps'
import { BOOT_MODULES, BOOT_ROWS } from '../hooks/gfx/boot'
-import { activityPicture, bannerPicture, bootPicture, curvePicture, edges, headerPicture, layout, markPicture, topologyPicture, type TopoModel } from '../hooks/gfx/pictures'
+import { activityPicture, bannerPicture, bootPicture, curvePicture, edges, headerPicture, layout, markPicture, palettePicture, topologyPicture, type TopoModel } from '../hooks/gfx/pictures'
import { isBooting, newState, optionsOf } from '../hooks/state'
import type { Grid } from '../hooks/gfx/raster'
import { parseClaims, type ClaimRecord } from '../hooks/data/parse'
@@ -230,3 +230,50 @@ describe('BBS boot screen', () => {
expect(isBooting({ ...state, options: { ...state.options, look: 'plain' } }, 1_100)).toBe(false)
})
})
+
+describe('the menu palette strip', () => {
+ const colors = [0xff0000, 0x00ff00, 0x0000ff]
+ const fg = (grid: ReturnType<typeof palettePicture>, x: number): number => grid.cells[x * 3 + 1] as number
+ const base = (x: number, columns: number): number => colors[Math.min(colors.length - 1, Math.floor((x * colors.length) / columns))] as number
+ /** The cell the light is on: the one furthest from its own colour. */
+ const litAt = (grid: ReturnType<typeof palettePicture>): number => {
+ const far = (x: number): number => [0, 8, 16].reduce((sum, shift) => sum + Math.abs(((fg(grid, x) >> shift) & 255) - ((base(x, grid.columns) >> shift) & 255)), 0)
+
+ return Array.from({ length: grid.columns }, (_, x) => x).sort((a, b) => far(b) - far(a))[0] as number
+ }
+
+ it('is one row of blocks, and at rest is exactly the colours, a segment each', () => {
+ const grid = palettePicture(60, 0, colors)
+
+ expect([grid.columns, grid.rows]).toEqual([60, 1])
+ for (let x = 0; x < 60; x++) {
+ expect(grid.cells[x * 3], `char ${x}`).toBe(0x2580)
+ expect(fg(grid, x), `colour ${x}`).toBe(base(x, 60))
+ }
+ expect(fg(grid, 0)).toBe(0xff0000)
+ expect(fg(grid, 30)).toBe(0x00ff00)
+ expect(fg(grid, 59)).toBe(0x0000ff)
+ })
+
+ it('has a band of light that brightens the cells it is on and leaves the rest alone', () => {
+ const grid = palettePicture(60, 1_512, colors)
+
+ expect(litAt(grid)).toBe(30)
+ expect(fg(grid, 30)).not.toBe(base(30, 60))
+ expect((fg(grid, 30) >> 16) & 255).toBeGreaterThan(150)
+ expect(fg(grid, 0)).toBe(base(0, 60))
+ expect(fg(grid, 59)).toBe(base(59, 60))
+ })
+
+ it('moves along the strip as the clock runs, about three cells a frame at 8 fps, and starts again after it leaves', () => {
+ expect(litAt(palettePicture(60, 1_512, colors))).toBe(30)
+ expect(litAt(palettePicture(60, 1_512 + 360, colors))).toBe(40)
+ expect(Array.from(palettePicture(60, 36 * 84, colors).cells)).toEqual(Array.from(palettePicture(60, 0, colors).cells))
+ expect(Array.from(palettePicture(60, 0, colors).cells)).not.toEqual(Array.from(palettePicture(60, 1_512, colors).cells))
+ })
+
+ it('holds for a tiny width and an empty list of colours without throwing', () => {
+ expect(palettePicture(1, 500, colors).columns).toBe(1)
+ expect(palettePicture(8, 500, []).rows).toBe(1)
+ })
+})
diff --git a/plugins/ruflo-console/tests/nav-state.spec.ts b/plugins/ruflo-console/tests/nav-state.spec.ts
index 4ba71a451d..1470b97747 100644
--- a/plugins/ruflo-console/tests/nav-state.spec.ts
+++ b/plugins/ruflo-console/tests/nav-state.spec.ts
@@ -91,3 +91,20 @@ describe('the nav actions', () => {
expect(state.navQuery).toBe('')
})
})
+
+describe('finding what is on a page, not only the page', () => {
+ it('searching for a capability by its own name finds the page it is on', () => {
+ // Each of these is a section or a feature, not a page: the page's description has to name it for the search to find it.
+ const where: Record<string, ViewId> = {
+ sentries: 'secure',
+ doctor: 'secure',
+ aidefence: 'secure',
+ updates: 'settings',
+ loops: 'automate',
+ autopilot: 'automate',
+ kanban: 'automate',
+ }
+
+ for (const [word, view] of Object.entries(where)) expect(findPages(word), word).toContain(view)
+ })
+})
diff --git a/plugins/ruflo-console/tests/pure.spec.ts b/plugins/ruflo-console/tests/pure.spec.ts
index 77d640f55f..efed0a4964 100644
--- a/plugins/ruflo-console/tests/pure.spec.ts
+++ b/plugins/ruflo-console/tests/pure.spec.ts
@@ -12,6 +12,7 @@ import { idOf, parseAgents, parseClaims, parseHive, parseSwarmStore, plain } fro
import { readSnapshot } from '../hooks/data/snapshot'
import { toBase64 } from '../hooks/gfx/raster'
import { newState } from '../hooks/state'
+import { CARD_COLUMNS } from '../hooks/views/card'
import { picturesOf } from '../hooks/views/frames'
import { ladder } from '../hooks/views/cost'
import { CLI_OUT, HIVE_TOKEN, RUFLO_FILES } from './fixtures/ruflo-run'
@@ -151,7 +152,30 @@ describe('graphics', () => {
expect([...picturesOf(state, 90, 0, 5).keys()]).toEqual(['title'])
// The RUFLO banner is the main menu's alone; every other page leads with `RUFLO | PAGE`.
state.view = 'menu'
- expect([...picturesOf(state, 90, 0, 5).keys()]).toEqual(['header', 'title'])
+ expect([...picturesOf(state, 90, 0, 5).keys()]).toEqual(['header', 'palette', 'title'])
+ })
+
+ it('the menu\'s palette strip moves with the clock, is still at fps 0, and is the BBS look\'s alone', () => {
+ const cells = (state: ReturnType<typeof newState>, t: number) => Array.from((picturesOf(state, 90, 0, t).get('palette') as { cells: Uint32Array }).cells)
+ const bbs = newState({})
+
+ bbs.view = 'menu'
+ expect(cells(bbs, 0)).not.toEqual(cells(bbs, 1_512))
+ // As wide as the menu's own rows: the pane less the card's border and padding, less the two columns of margin.
+ expect(cells(bbs, 0).length / 3).toBe(90 - CARD_COLUMNS - 2)
+
+ bbs.options.fps = 0
+ expect(cells(bbs, 987_654)).toEqual(cells(bbs, 0))
+
+ const plain = newState({ look: 'plain' } as never)
+
+ plain.view = 'menu'
+ expect([...picturesOf(plain, 90, 0, 5).keys()]).toEqual(['header'])
+
+ const other = newState({})
+
+ other.view = 'swarm'
+ expect(picturesOf(other, 90, 0, 5).has('palette')).toBe(false)
})
it('the budget ladder marks 50/75/90/100% and fills to the spend', () => {
diff --git a/v3/docs/adr/ADR-430-console-main-menu-accents-chips-and-badges.md b/v3/docs/adr/ADR-430-console-main-menu-accents-chips-and-badges.md
index af0e3229ea..533df065c4 100644
--- a/v3/docs/adr/ADR-430-console-main-menu-accents-chips-and-badges.md
+++ b/v3/docs/adr/ADR-430-console-main-menu-accents-chips-and-badges.md
@@ -45,3 +45,9 @@ It has not been seen. The spec holds the colours, the contrast and what a badge
## 6. Tests
`tests/menu-style.spec.ts` (9): every group has an accent and no accent is without a group; the palette is the accents in menu order; every colour is on the 256 palette; the ink on each accent has contrast 4.5 or more and no two groups share a colour; the spec's own checks fail on a colour off the palette and on ink that cannot be read; an empty state has no badges; approvals and alerts are loud and claims are information on the pages they open; spend shows only from a cent, findings only when high or critical (loud only for critical), a running terminal, and an update not yet taken; and only pages that exist are badged.
+
+## 7. Amendment: the strip moves, and the search finds what is on a page
+
+- **The palette strip is animated.** It is now a picture (`palettePicture`, registered by `picturesOf` for the menu in the BBS look), not a row of Texts: one block of each accent across the width and a band of light that sweeps along it and starts again, about 28 cells a second, three cells a frame at the default 8 fps. Being a picture, it moves with the frame loop that already runs for the menu's other pictures, and costs one element, not one per cell. At `t` = 0 the light is off the strip and the cells are exactly the accents, so with `fps: 0` it draws that still strip; a surface that cannot draw pictures gets the Text strip as before. It is decoration and carries no data.
+- **The menu lists every page, but the search finds only pages.** Checked: all 26 pages and the three commands (palette, help, log off) are on the menu, none missing and none unknown. The menu prompt and the nav search match a page's name, key, group and one-line description, so a feature that is a section of a page (sentries, the loop manager, Updates in Settings, AIDefence) was not found by its own name. The descriptions of Security, Settings and Automation now name them, and `tests/nav-state.spec.ts` holds that searching for `sentries`, `doctor`, `aidefence`, `updates`, `loops`, `autopilot` and `kanban` finds the page each is on (which found one more gap, `aidefence`, when first run).
+- **Tests:** `tests/diagrams.spec.ts` (4): one row of blocks, exactly the colours at rest, a band that brightens only the cells it is on, moves about three cells a frame and starts again, and survives a tiny width and no colours; `tests/pure.spec.ts`: the strip is on the BBS menu only, as wide as the menu's rows, and still at fps 0.