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): animated-ASCII boot and a Cave-BBS main menu as the landing screen

ruv89e3f6e7379a
diff --git a/plugins/ruflo-console/hooks/bindings.ts b/plugins/ruflo-console/hooks/bindings.ts
index d49d6427d2..b9de52d1bb 100644
--- a/plugins/ruflo-console/hooks/bindings.ts
+++ b/plugins/ruflo-console/hooks/bindings.ts
@@ -9,7 +9,7 @@ import { plain } from './data/parse'
import type { Host } from './host'
import { filterPalette, paletteEntries } from './palette'
import type { Runner } from './runner'
-import type { State } from './state'
+import { viewOf, type State } from './state'
import type { Actions } from './views/common'
import { openTasks, selection } from './views/select'
@@ -46,7 +46,7 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Steps
host.invalidate()
},
close: () => void close(),
- back: () => setView(state.view === 'agent' ? state.back : 'overview'),
+ back: () => setView(state.view === 'agent' ? state.back : state.options.look === 'bbs' ? 'menu' : 'overview'),
confirm: () => void runner.confirm(),
cancel: runner.cancel,
select,
@@ -111,6 +111,19 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Steps
state.eventFilter = order[(at + 1) % order.length] ?? 'all'
host.invalidate()
},
+ // The main menu's prompt, as a board's: a key (2, w, i), a name (swarm, x.ruv.io), ? for help, O to log off.
+ menu: text => {
+ const word = text.trim().toLowerCase()
+ const view = viewOf(word)
+
+ if (word === '') return
+ if (word === '?' || word === 'h' || word === 'help') actions.help()
+ else if (word === 'p') actions.palette('all')
+ else if (word === 'r') actions.refresh()
+ else if (word === 'o' || word === 'bye' || word === 'logoff') actions.close()
+ else if (view !== null) setView(view)
+ else runner.ask(null, `no area "${plain(word, 24)}": type a key from the menu, or ? for help`)
+ },
term: {
harness: id => {
state.terminal.harness = id
diff --git a/plugins/ruflo-console/hooks/commands.ts b/plugins/ruflo-console/hooks/commands.ts
index 3d5f0c1c57..924befa780 100644
--- a/plugins/ruflo-console/hooks/commands.ts
+++ b/plugins/ruflo-console/hooks/commands.ts
@@ -105,7 +105,7 @@ export const HELP = [
' /ruflo swarm pane|status|topology|claims|consensus ruflo-swarm (was /ruflo-swarm-*)',
'',
'Pane keys (while it holds the keyboard: /ruflo opens it with the keys, or click it; ctrl+x tab reaches the band, not the pane)',
- ' 1-9 views · g timeline · q approvals · e events · m missions · w x.ruv.io · i terminal · p palette · x actions for the selection',
+ ' 0 main menu · 1-9 views · g timeline · q approvals · e events · m missions · w x.ruv.io · i terminal · p palette · x actions for the selection',
' terminal: c codex · l claude · u ruflo · in the field Enter shows the command, Enter again runs it · s stop · z clear',
' j/k select · d drill in · b back · r refresh · h help · f event filter · y/n confirm',
' Esc: a pane /ruflo opened closes; one that opened by itself (panel=auto) only hands the keys back. ✕ or /ruflo close closes either',
diff --git a/plugins/ruflo-console/hooks/controller.ts b/plugins/ruflo-console/hooks/controller.ts
index c60989a3b6..a89b3d4d60 100644
--- a/plugins/ruflo-console/hooks/controller.ts
+++ b/plugins/ruflo-console/hooks/controller.ts
@@ -353,6 +353,10 @@ export function createController(state: State, host: Host): Controller {
'auto-open',
host.after(50, () => {
state.timers.delete('auto-open')
+ // /ruflo <view> may have opened it in the meantime: that choice stands.
+ if (state.pane.isOpen) return
+ // The BBS look opens on its main menu, as a board does after login.
+ if (state.options.look === 'bbs') state.view = 'menu'
void open(false).then(result => {
state.pane.autoReason = result.isPlaced ? '' : result.reason || 'not placed'
host.invalidate()
diff --git a/plugins/ruflo-console/hooks/dispatch.ts b/plugins/ruflo-console/hooks/dispatch.ts
index 4d5913fcca..07b5e8aaa6 100644
--- a/plugins/ruflo-console/hooks/dispatch.ts
+++ b/plugins/ruflo-console/hooks/dispatch.ts
@@ -72,7 +72,9 @@ export async function dispatch(control: Controller, state: State, args: string,
case 'open':
// Without a pane to show (claude -p, an SDK host), the view is answered as text in the command's row instead.
if (!state.isInteractive) return { text: await dumpOf(control, state, intent.view ?? state.view) }
+ // The BBS look lands on its main menu when the cockpit opens with no view named, like a board after login.
if (intent.view !== null) control.setView(intent.view)
+ else if (!state.pane.isOpen && state.options.look === 'bbs') control.setView('menu')
return open(control, state, VIEWS.find(view => view.id === state.view)?.label ?? 'Agent')
case 'help':
diff --git a/plugins/ruflo-console/hooks/gfx/boot.ts b/plugins/ruflo-console/hooks/gfx/boot.ts
new file mode 100644
index 0000000000..f28b36f659
--- /dev/null
+++ b/plugins/ruflo-console/hooks/gfx/boot.ts
@@ -0,0 +1,130 @@
+/**
+ * The BBS boot screen, played for the first seconds after the pane opens: a modem dials and connects, then RUFLO
+ * materialises as big ANSI block art out of an animated ASCII field (the image-to-ASCII effect, done here in cells:
+ * an ordered dither decides when each cell resolves, noise characters flicker in the cells still resolving, and a
+ * plasma of dim characters moves behind). Then a handshake line and a bar that fills with the first ruflo reads.
+ * The boot is the one animation in the console that is decoration; it ends by itself.
+ */
+import { bigText } from './font'
+import { Grid, mix } from './raster'
+
+export const BOOT_ROWS = 14
+
+const MAGENTA = 0xff2a6d
+const CORAL = 0xff7a59
+const CYAN = 0x05d9e8
+const GREEN = 0x39ff14
+const DIM = 0x6b7280
+const SHADOW = 0x4a1030
+const PLASMA = [0x2a1038, 0x3d1450, 0x5a1a66] as const
+const NOISE = '.:-=+*#%@'
+const FIELD = ' ·:░'
+/** 4x4 ordered-dither thresholds: the order in which the logo's cells resolve. */
+const BAYER = [0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5] as const
+
+/** The logo as a pixel mask: the two-row half-block font, each cell two pixels tall. */
+function logoMask(word: string): boolean[][] {
+ const [top, bottom] = bigText(word)
+ const rows: boolean[][] = [[], [], [], []]
+
+ for (const [i, line] of [top, bottom].entries()) {
+ for (const ch of line) {
+ rows[i * 2]?.push(ch === '█' || ch === '▀')
+ rows[i * 2 + 1]?.push(ch === '█' || ch === '▄')
+ }
+ }
+
+ return rows
+}
+
+const MASK = logoMask('RUFLO')
+const MASK_W = MASK[0]?.length ?? 0
+/** Each mask pixel is drawn as a 2x2 block of cells. */
+const SCALE = 2
+export const LOGO_COLUMNS = MASK_W * SCALE
+const LOGO_TOP = 3
+const LOGO_ROWS = MASK.length * SCALE
+
+const hash = (x: number, y: number, k: number): number => (Math.imul(x, 73_856_093) ^ Math.imul(y, 19_349_663) ^ Math.imul(k, 83_492_791)) >>> 0
+const isOn = (cx: number, cy: number): boolean => MASK[Math.floor(cy / SCALE)]?.[Math.floor(cx / SCALE)] === true
+
+/**
+ * `age` is ms since the pane opened; the bar mixes elapsed time with the reads that have answered (`done` of
+ * `total`), so it moves before any read returns and reads 100% before the boot ends at BOOT_MIN_MS.
+ */
+export function bootPicture(project: string, columns: number, age: number, done: number, total: number): Grid {
+ const grid = new Grid(columns, BOOT_ROWS)
+ const type = (y: number, from: number, text: string, color: number, msPerChar = 22) => {
+ if (age < from) return
+
+ grid.text(0, y, text.slice(0, Math.min(text.length, Math.floor((age - from) / msPerChar), columns)), color)
+ }
+
+ type(0, 0, `ATDT ruflo.local${age >= 450 ? ' RING… RING…' : ''}`, DIM, 18)
+ type(1, 700, 'CONNECT 115200 / ARQ / V.42bis', GREEN, 12)
+
+ const left = Math.max(0, Math.floor((Math.min(columns, LOGO_COLUMNS + 26) - LOGO_COLUMNS - 26) / 2))
+ const frame = Math.floor(age / 70)
+ // Resolve runs 0..1 from 0.9 s to 2.4 s; the plasma fades out from 2.6 s so the finished logo stands clean.
+ const resolve = Math.max(0, Math.min(1, (age - 900) / 1500))
+ const fieldFade = age < 900 ? Math.max(0, (age - 300) / 600) : age < 2600 ? 1 : Math.max(0, 1 - (age - 2600) / 600)
+ const glint = ((age / 24) % (LOGO_COLUMNS + 30)) - 10
+
+ if (age >= 300) {
+ for (let cy = 0; cy < LOGO_ROWS; cy++) {
+ for (let cx = 0; cx < Math.min(LOGO_COLUMNS + 2, columns - left); cx++) {
+ const x = left + cx
+ const y = LOGO_TOP + cy
+
+ if (isOn(cx, cy)) {
+ // Each cell resolves when the sweep plus its dither threshold passes it; just before, it flickers as noise.
+ const at = (BAYER[(cy % 4) * 4 + (cx % 4)] as number) / 16 * 0.55 + (cx / LOGO_COLUMNS) * 0.45
+ const gap = resolve - at
+
+ if (gap >= 0) {
+ const base = mix(mix(MAGENTA, CORAL, cy / (LOGO_ROWS - 1)), CYAN, cx / LOGO_COLUMNS * 0.55)
+ const shine = Math.max(0, 1 - Math.abs(cx - glint) / 3)
+
+ grid.set(x, y, gap < 0.06 ? '▓' : '█', mix(base, 0xffffff, shine * 0.65))
+ } else if (gap > -0.25) {
+ grid.set(x, y, NOISE[hash(cx, cy, frame) % NOISE.length] as string, mix(CYAN, MAGENTA, (hash(cy, cx, frame) % 100) / 100))
+ } else if (fieldFade > 0) {
+ grid.set(x, y, '·', mix(0x000000, PLASMA[0], fieldFade))
+ }
+ } else if (isOn(cx - 1, cy - 1) && resolve - ((cx - 1) / LOGO_COLUMNS) * 0.45 > 0.35) {
+ // A drop shadow down and right of the resolved letters, the way ANSI title screens set their logos off.
+ grid.set(x, y, '░', SHADOW)
+ } else if (fieldFade > 0) {
+ const v = Math.sin(cx * 0.33 + age / 300) + Math.sin(cy * 0.9 - age / 230) + Math.sin((cx + cy) * 0.18 + age / 410)
+ const k = Math.max(0, Math.min(FIELD.length - 1, Math.floor(((v + 3) / 6) * FIELD.length)))
+
+ if (k > 0) grid.set(x, y, FIELD[k] as string, mix(0x000000, PLASMA[k - 1] as number, fieldFade))
+ }
+ }
+ }
+ }
+
+ const tagX = left + LOGO_COLUMNS + 3
+
+ if (age >= 1700 && columns >= tagX + 12) {
+ grid.text(tagX, LOGO_TOP + 1, '░▒▓ AGENT SWARM'.slice(0, columns - tagX), MAGENTA)
+ grid.text(tagX, LOGO_TOP + 2, ' CONSOLE'.slice(0, columns - tagX), CORAL)
+ grid.text(tagX, LOGO_TOP + 4, 'x.ruv.io'.slice(0, columns - tagX), CYAN)
+ grid.text(tagX, LOGO_TOP + 5, 'AGENTS WELCOME.'.slice(0, columns - tagX), GREEN)
+ }
+
+ type(BOOT_ROWS - 3, 2200, `> handshake ok · node ${project}`, CYAN, 14)
+
+ // LOADING [▓▓▓▓░░░░] 58% reads 6/10, with a blinking cursor while it runs.
+ if (age >= 2200) {
+ const pct = Math.min(1, 0.55 * Math.min(1, (age - 2200) / 800) + 0.45 * (total > 0 ? done / total : 1))
+ const barWidth = Math.max(6, Math.min(24, columns - 30))
+ const filled = Math.round(pct * barWidth)
+ const line = `LOADING [${'▓'.repeat(filled)}${'░'.repeat(barWidth - filled)}] ${String(Math.round(pct * 100)).padStart(3)}% reads ${done}/${total}`
+
+ grid.text(0, BOOT_ROWS - 2, line.slice(0, columns), pct >= 1 ? GREEN : CYAN)
+ if (Math.floor(age / 400) % 2 === 0 && line.length + 1 < columns) grid.set(line.length + 1, BOOT_ROWS - 2, '█', CYAN)
+ }
+
+ return grid
+}
diff --git a/plugins/ruflo-console/hooks/gfx/pictures.ts b/plugins/ruflo-console/hooks/gfx/pictures.ts
index 3d0d9ee7b4..7d48066d70 100644
--- a/plugins/ruflo-console/hooks/gfx/pictures.ts
+++ b/plugins/ruflo-console/hooks/gfx/pictures.ts
@@ -7,6 +7,8 @@
import { Braille, COLOR, Grid, mix, ramp, sparkline } from './raster'
import { bigText } from './font'
+export { bootPicture, BOOT_ROWS } from './boot'
+
export type TopoNode = { id: string; label: string; status: string; isLeader: boolean; /** When the console last saw an event about it. */ pulseAtMs?: number }
export type TopoModel = { topology: string; nodes: TopoNode[] }
@@ -303,62 +305,6 @@ export function titlePicture(name: string, columns: number, t: number): Grid {
return grid
}
-/** The boot screen's height. */
-export const BOOT_ROWS = 10
-
-/**
- * The BBS boot screen, played for the first seconds after the pane opens: a modem dials, connects, the logo draws in
- * line by line, and a bar fills with the first round of ruflo reads. `age` is ms since the pane opened; the bar mixes
- * elapsed time with the reads that have answered (`done` of `total`), so it moves even before any read returns.
- */
-export function bootPicture(project: string, columns: number, age: number, done: number, total: number): Grid {
- const grid = new Grid(columns, BOOT_ROWS)
- const GREEN = 0x39ff14
- const type = (y: number, from: number, text: string, color: number, msPerChar = 22): boolean => {
- if (age < from) return false
-
- const shown = text.slice(0, Math.min(text.length, Math.floor((age - from) / msPerChar)))
-
- grid.text(0, y, shown.slice(0, columns), color)
-
- return shown.length === text.length
- }
-
- type(0, 0, 'ATDT ruflo.local', COLOR.dim)
- if (age >= 450) grid.text(0, 1, 'RING… RING…'.slice(0, columns), COLOR.dim)
- type(2, 800, 'CONNECT 115200 / ARQ / V.42bis', GREEN, 12)
-
- // The logo draws in a row at a time, magenta to cyan, with the banner's sweep.
- const sweep = ((age / 28) % (LOGO[0].length + 40)) - 20
-
- LOGO.forEach((line, y) => {
- if (age < 1200 + y * 220) return
- ;[...line].forEach((ch, x) => {
- if (ch === ' ' || x >= columns) return
-
- const glow = Math.max(0, 1 - Math.abs(x - sweep) / 4)
-
- grid.set(x, 4 + y, ch, mix(mix(NEON_MAGENTA, NEON_CYAN, x / (LOGO[0].length - 1)), 0xffffff, glow * 0.7))
- })
- })
- if (age >= 1700 && columns > LOGO[0].length + 6) grid.text(LOGO[0].length + 2, 4, '░▒▓ AGENT SWARM CONSOLE'.slice(0, columns - LOGO[0].length - 2), NEON_MAGENTA)
- type(7, 1900, `> handshake ok · node ${project}`, NEON_CYAN, 14)
-
- // LOADING [▓▓▓▓░░░░] 58% reads 6/10, with a blinking cursor while it runs.
- if (age >= 1900) {
- // Full by ~2.9 s once the reads have answered, so 100% shows before the boot ends at BOOT_MIN_MS (3.2 s).
- const pct = Math.min(1, 0.55 * Math.min(1, (age - 1900) / 1000) + 0.45 * (total > 0 ? done / total : 1))
- const barWidth = Math.max(6, Math.min(24, columns - 30))
- const filled = Math.round(pct * barWidth)
- const line = `LOADING [${'▓'.repeat(filled)}${'░'.repeat(barWidth - filled)}] ${String(Math.round(pct * 100)).padStart(3)}% reads ${done}/${total}`
-
- grid.text(0, 9, line.slice(0, columns), pct >= 1 ? GREEN : NEON_CYAN)
- if (Math.floor(age / 400) % 2 === 0 && line.length + 1 < columns) grid.set(line.length + 1, 9, '█', NEON_CYAN)
- }
-
- 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/state.ts b/plugins/ruflo-console/hooks/state.ts
index aa319e43d2..ad68bc1e42 100644
--- a/plugins/ruflo-console/hooks/state.ts
+++ b/plugins/ruflo-console/hooks/state.ts
@@ -9,7 +9,7 @@ import type { RufloRoute, RufloSnapshot } from '../types'
export const PLUGIN_NAME = 'ruflo-console'
export const PANE_ID = 'ruflo-console'
-export type ViewId = 'overview' | 'swarm' | 'claims' | 'federation' | 'plugins' | 'learning' | 'metaharness' | 'memory' | 'cost' | 'timeline' | 'approvals' | 'events' | 'missions' | 'xruv' | 'terminal' | 'agent'
+export type ViewId = 'menu' | 'overview' | 'swarm' | 'claims' | 'federation' | 'plugins' | 'learning' | 'metaharness' | 'memory' | 'cost' | 'timeline' | 'approvals' | 'events' | 'missions' | 'xruv' | 'terminal' | 'agent'
/**
* The views in tab order, each with its hotkey and the inline height it asks for. Digits are the first nine; the three
@@ -21,6 +21,7 @@ export type ViewId = 'overview' | 'swarm' | 'claims' | 'federation' | 'plugins'
* current tab adds its label, and `blurb` is the one line under the bar that says what the view is for.
*/
export const VIEWS: readonly { id: ViewId; key: string; label: string; short: string; icon: string; blurb: string; rows: number }[] = [
+ { id: 'menu', key: '0', label: 'Main Menu', short: 'Mnu', icon: '📟', blurb: 'the board: every area by its key, the line status, and a prompt that takes a key or a name', rows: 32 },
{ id: 'overview', key: '1', label: 'Overview', short: 'Ovr', icon: '🏠', blurb: 'what ruflo is doing here: subsystems, mods, health alerts and live activity', rows: 26 },
{ id: 'swarm', key: '2', label: 'Swarm', short: 'Swm', icon: '🐝', blurb: 'the swarm as ruflo wrote it: topology, agents at work, and the hive-mind votes', rows: 30 },
{ id: 'claims', key: '3', label: 'Claims', short: 'Clm', icon: '📌', blurb: 'who holds which task: claim, release, hand off or steal, each after a y/n confirm', rows: 30 },
diff --git a/plugins/ruflo-console/hooks/views/common.ts b/plugins/ruflo-console/hooks/views/common.ts
index 1c30c11c5e..95fa05a064 100644
--- a/plugins/ruflo-console/hooks/views/common.ts
+++ b/plugins/ruflo-console/hooks/views/common.ts
@@ -38,6 +38,8 @@ export type Actions = {
/** Cycles the events view's filter. */
filter: () => void
/** The terminal view: pick a harness, follow the field, ask to run its text, stop the run, clear the scrollback. */
+ /** The main menu's prompt: a key or a name takes the person to that area. */
+ menu: (text: string) => void
term: { harness: (id: HarnessId) => void; draft: (text: string) => void; submit: (text: string) => void; stop: () => void; clear: () => void; load: (id: HarnessId, text: string) => void }
}
diff --git a/plugins/ruflo-console/hooks/views/frames.ts b/plugins/ruflo-console/hooks/views/frames.ts
index 67c7e33f41..93aac414a8 100644
--- a/plugins/ruflo-console/hooks/views/frames.ts
+++ b/plugins/ruflo-console/hooks/views/frames.ts
@@ -131,7 +131,7 @@ export function picturesOf(state: State, columns: number, nowMs: number, t: numb
pictures.set('header', state.options.look === 'bbs' ? bannerPicture(project, Math.min(width, 72), t) : headerPicture(`◆ ruflo · ${project}`, Math.min(width, 40), t))
// BBS: each view's name as ANSI-style block art under the tabs.
if (state.options.look === 'bbs') {
- const name = state.isHelp ? 'help' : state.palette.isOpen ? 'palette' : state.view === 'agent' ? 'agent' : (VIEWS.find(view => view.id === state.view)?.label ?? state.view)
+ const name = state.isHelp ? 'help' : state.palette.isOpen ? 'palette' : state.view === 'agent' ? 'agent' : state.view === 'menu' ? 'ruflo bbs' : (VIEWS.find(view => view.id === state.view)?.label ?? state.view)
pictures.set('title', titlePicture(name, Math.min(width, 80), t))
}
diff --git a/plugins/ruflo-console/hooks/views/menu.ts b/plugins/ruflo-console/hooks/views/menu.ts
new file mode 100644
index 0000000000..a277468150
--- /dev/null
+++ b/plugins/ruflo-console/hooks/views/menu.ts
@@ -0,0 +1,147 @@
+import type { RenderElement } from 'claude-code'
+
+import type { ViewId } from '../state'
+import { barParts } from './bar'
+import { clip, col, isBbs, row, text, THEME, type Ctx } from './common'
+
+type Item = { key: string; label: string; go: ViewId | 'palette' | 'help' | 'close' }
+
+/** The board's three menus, as the old BBS main menus grouped their commands. Keys are the pane's own hotkeys. */
+const MENUS: readonly { title: string; items: readonly Item[] }[] = [
+ {
+ title: 'Swarm Commands',
+ items: [
+ { key: '1', label: 'Overview', go: 'overview' },
+ { key: '2', label: 'Swarm Topology', go: 'swarm' },
+ { key: '3', label: 'Claims Board', go: 'claims' },
+ { key: 'q', label: 'Approvals', go: 'approvals' },
+ { key: 'm', label: 'Missions', go: 'missions' },
+ { key: 'g', label: 'Agent Timeline', go: 'timeline' },
+ { key: 'e', label: 'Event Stream', go: 'events' },
+ ],
+ },
+ {
+ title: 'System Features',
+ items: [
+ { key: '4', label: 'Federation', go: 'federation' },
+ { key: '5', label: 'Plugins & Mods', go: 'plugins' },
+ { key: '6', label: 'Learning', go: 'learning' },
+ { key: '7', label: 'MetaHarness', go: 'metaharness' },
+ { key: '8', label: 'Memory Base', go: 'memory' },
+ { key: '9', label: 'Cost & Budget', go: 'cost' },
+ ],
+ },
+ {
+ title: 'Other Commands',
+ items: [
+ { key: 'w', label: 'x.ruv.io Board', go: 'xruv' },
+ { key: 'i', label: 'Terminal', go: 'terminal' },
+ { key: 'p', label: 'Command Palette', go: 'palette' },
+ { key: 'h', label: 'Help', go: 'help' },
+ { key: 'O', label: 'Log Off', go: 'close' },
+ ],
+ },
+]
+
+const mmss = (ms: number): string => {
+ const s = Math.max(0, Math.floor(ms / 1000))
+
+ return `${String(Math.floor(s / 60)).padStart(2, '0')}:${String(s % 60).padStart(2, '0')}`
+}
+
+/**
+ * The main menu, the board's front door: where the cockpit lands when it opens in the BBS look. The name in block
+ * art comes from the frame; under it the host line, three boxed menus whose entries go where their keys go, a status
+ * bar in the old modem style with this project's live facts, and a prompt that takes a key or a name and Enter.
+ */
+export function menuView(ctx: Ctx): RenderElement {
+ const { state, nowMs } = ctx
+ const project = state.cwd.split('/').filter(Boolean).at(-1) ?? 'ruflo'
+ const go = (item: Item) => () => (item.go === 'palette' ? ctx.act.palette('all') : item.go === 'help' ? ctx.act.help() : item.go === 'close' ? ctx.act.close() : ctx.act.view(item.go))
+ const width = Math.max(18, Math.floor((ctx.columns - 4) / (ctx.columns >= 66 ? 3 : 1)))
+ const rows: RenderElement[] = []
+
+ rows.push(
+ ctx.kit.Box({
+ flexDirection: 'row',
+ justifyContent: 'center',
+ key: 'menu-host',
+ children: [
+ ctx.kit.Text({ color: THEME.info, children: 'x.ruv.io' }),
+ ctx.kit.Text({ color: THEME.head, children: ' ■ ' }),
+ ctx.kit.Text({ bold: true, children: 'Main Menu' }),
+ ctx.kit.Text({ color: THEME.head, children: ' ■ ' }),
+ ctx.kit.Text({ color: THEME.info, children: clip('github.com/ruvnet/ruflo', Math.max(4, ctx.columns - 32)) }),
+ ],
+ }),
+ )
+ rows.push(text(ctx, ' '))
+
+ rows.push(
+ ctx.kit.Box({
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ borderStyle: 'single',
+ borderColor: isBbs() ? '#d0d0d0' : 'inactive',
+ paddingX: 1,
+ key: 'menu-box',
+ children: MENUS.map(menu =>
+ ctx.kit.Box({
+ flexDirection: 'column',
+ width,
+ key: `menu-${menu.title}`,
+ children: [
+ ctx.kit.Text({ bold: true, color: THEME.head, wrap: 'truncate-end', children: clip(`■${menu.title}■`, width) }),
+ ...menu.items.map(item =>
+ ctx.kit.Box({
+ flexDirection: 'row',
+ key: `mi-${item.key}`,
+ children: [
+ ctx.kit.Text({ bold: true, children: `(${item.key})` }),
+ ctx.kit.Button({ key: `menu-go-${item.key}`, label: clip(item.label, width - 4), plain: true, onPress: go(item) }),
+ ],
+ }),
+ ),
+ ],
+ }),
+ ),
+ }),
+ )
+
+ // The status bar under the box: the line, then what is live in this project, then how long the board has been open.
+ const online = mmss(nowMs - (state.pane.bootAtMs > 0 ? state.pane.bootAtMs : state.loadedAtMs))
+ const facts = barParts(state, nowMs).map(part => part.text)
+ const status = [state.snapshot?.isRufloProject === true ? 'Registered' : 'Unregistered', 'ANSI-BBS', '115200·N81 FDX', ...facts.slice(0, 3)].join(' │ ')
+ const right = ` Online ${online} `
+
+ rows.push(text(ctx, ' '))
+ rows.push(
+ ctx.kit.Box({
+ flexDirection: 'row',
+ backgroundColor: isBbs() ? '#8b1a1a' : undefined,
+ key: 'menu-status',
+ children: [
+ ctx.kit.Text({ bold: true, color: '#ffd319', wrap: 'truncate-end', children: clip(` ${status}`, Math.max(4, ctx.columns - right.length)).padEnd(Math.max(0, ctx.columns - right.length)) }),
+ ctx.kit.Text({ bold: true, color: '#ffd319', children: right }),
+ ],
+ }),
+ )
+ rows.push(text(ctx, ' '))
+ rows.push(text(ctx, `T - ${online}`, { bold: true }))
+
+ if (ctx.kit.Input !== undefined) {
+ rows.push(
+ ctx.kit.Input({
+ key: 'menu-prompt',
+ label: `(1:1) (ruflo: ${clip(project, 24)})`,
+ placeholder: 'a key or a name, then Enter (? for help)',
+ submitLabel: 'go',
+ onSubmit: value => ctx.act.menu(value),
+ }),
+ )
+ } else {
+ rows.push(row(ctx, [text(ctx, `(1:1) (ruflo: ${clip(project, 24)}) : press a key from the menu`, { color: THEME.warn })]))
+ }
+
+ return col(ctx, rows, 'menu')
+}
diff --git a/plugins/ruflo-console/hooks/views/pane.ts b/plugins/ruflo-console/hooks/views/pane.ts
index a4fcbb2d38..39e07142e6 100644
--- a/plugins/ruflo-console/hooks/views/pane.ts
+++ b/plugins/ruflo-console/hooks/views/pane.ts
@@ -15,6 +15,7 @@ import { federationView } from './federation'
import { learningView } from './learning'
import { approvalsView, eventsView, timelineView } from './manage'
import { memoryView } from './memory'
+import { menuView } from './menu'
import { metaharnessView } from './metaharness'
import { missionsView } from './missions'
import { overviewView } from './overview'
@@ -29,6 +30,7 @@ export const NARROW = 44
const WIDE_TABS = 140
const BODIES: Record<ViewId, (ctx: Ctx) => RenderElement> = {
+ menu: menuView,
overview: overviewView,
swarm: swarmView,
claims: claimsView,
diff --git a/plugins/ruflo-console/hooks/views/terminal.ts b/plugins/ruflo-console/hooks/views/terminal.ts
index 904bfda7f0..956417dd35 100644
--- a/plugins/ruflo-console/hooks/views/terminal.ts
+++ b/plugins/ruflo-console/hooks/views/terminal.ts
@@ -55,7 +55,7 @@ export function terminalView(ctx: Ctx): RenderElement {
rows.push(
ctx.kit.Input({
key: 'term-input',
- label: `${harness.label}> `,
+ label: harness.label,
placeholder: harness.id === 'ruflo' ? 'a ruflo command: swarm status, memory search -q auth …' : `ask ${harness.label} about this project…`,
value: term.draft,
submitLabel: 'ask',
diff --git a/plugins/ruflo-console/tests/behaviour.test.ts b/plugins/ruflo-console/tests/behaviour.test.ts
index 2dcf74a3ac..cce9a53203 100644
--- a/plugins/ruflo-console/tests/behaviour.test.ts
+++ b/plugins/ruflo-console/tests/behaviour.test.ts
@@ -28,7 +28,7 @@ describe('behaviour', () => {
const pane = await $.ui.mount({ ...paneAt(110), plugin: PLUGIN })
- expect(textOf(await pane.drawn())).toContain('🏠 OVERVIEW')
+ expect(textOf(await pane.drawn())).toContain('📟 MAIN MENU')
await pane.press({ key: 'tab-claims' })
expect(textOf(await pane.drawn())).toContain('📌 CLAIMS')
expect(world.stored.get('ruflo-console/ui:/work')).toEqual({ view: 'claims', isClosedByPerson: false })
@@ -149,7 +149,7 @@ describe('behaviour', () => {
expect(elementsOf(tree, 'Raster').length === 0).toBe(isNarrow)
expect(elementsOf(tree, 'Button').map(keyOf).includes('claim')).toBe(!isNarrow)
- if (isNarrow) expect(textOf(tree)).toContain('3/15 Claims')
+ if (isNarrow) expect(textOf(tree)).toContain('4/16 Claims')
await pane.unmount()
}
})
diff --git a/plugins/ruflo-console/tests/diagrams.spec.ts b/plugins/ruflo-console/tests/diagrams.spec.ts
index 7ad93d31ea..97f74ff692 100644
--- a/plugins/ruflo-console/tests/diagrams.spec.ts
+++ b/plugins/ruflo-console/tests/diagrams.spec.ts
@@ -155,7 +155,9 @@ describe('BBS boot screen', () => {
const done = text(bootPicture('demo', 60, 3_800, 10, 10), 60)
expect(done).toContain('CONNECT 115200 / ARQ / V.42bis')
- expect(done).toContain('█▀█ █ █ █▀▀ █ █▀█')
+ expect(done).toContain('██████ ██ ██ ██████')
+ expect(text(bootPicture('demo', 60, 1_400, 3, 10), 60)).toMatch(/[.:=+*#%@]/)
+ expect(done).toContain('AGENTS WELCOME.')
expect(done).toContain('> handshake ok · node demo')
expect(done).toContain('100% reads 10/10')
})
diff --git a/plugins/ruflo-console/tests/views.test.ts b/plugins/ruflo-console/tests/views.test.ts
index 32883582d0..88a08b324b 100644
--- a/plugins/ruflo-console/tests/views.test.ts
+++ b/plugins/ruflo-console/tests/views.test.ts
@@ -230,4 +230,28 @@ describe('views', () => {
expect(elementsOf(tree, 'Input').map(keyOf)).toEqual(['term-input'])
expect(world.runs.some(argv => argv[0] === 'codex' || argv[0] === 'claude')).toBe(false)
})
+
+ test('main menu: bare /ruflo lands on it in the BBS look; its prompt takes a key or a name', { options: { boot: false } }, async ($, on) => {
+ worldOf(on, RUFLO_FILES)
+ mock.clock(on)
+ await $.session.start(SESSION)
+ await $.command.run(command())
+
+ const pane = await $.ui.mount({ ...paneAt(110), surface: 'terminal' as const, plugin: PLUGIN })
+ const menu = await pane.drawn()
+
+ expect(elementsOf(menu, 'Raster').map(keyOf)).toEqual(['header', 'title'])
+ expect(textOf(menu)).toContain('■Swarm Commands■')
+ expect(textOf(menu)).toContain('Swarm Topology')
+ expect(textOf(menu)).toContain('ANSI-BBS')
+ expect(elementsOf(menu, 'Input').map(keyOf)).toEqual(['menu-prompt'])
+
+ await pane.input({ key: 'menu-prompt', text: 'w', kind: 'submit' })
+ expect(textOf(await pane.drawn())).toContain('MAIN MENU')
+
+ await pane.press({ key: 'tab-menu' })
+ await pane.input({ key: 'menu-prompt', text: 'nope', kind: 'submit' })
+ expect(textOf(await pane.drawn())).toContain('no area "nope"')
+ await pane.unmount()
+ })
})