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

fix(tui): the AI page highlights 6 AI in the page bar, not the page before it

re6dbed3bf6d2
diff --git a/plugins/ruflo-console/tests/tui-nav.spec.ts b/plugins/ruflo-console/tests/tui-nav.spec.ts
index a9e0245999..3fe9174101 100644
--- a/plugins/ruflo-console/tests/tui-nav.spec.ts
+++ b/plugins/ruflo-console/tests/tui-nav.spec.ts
@@ -179,6 +179,34 @@ describe('the terminal loop', () => {
expect(t.out.join('')).toContain(`${ESC}[7m 5 Missions ${ESC}[0m`)
})
+ it('highlights 6 AI in the page bar on the AI page, started there or reached by key (not the page before it)', async () => {
+ const started = terminal()
+ const first = runTui({ cwd: project, home: join(root, 'home'), view: 'ai', aiPage: { codexBin: '/nonexistent/codex' } }, started.io)
+
+ await settle()
+ started.press('\u0003')
+ await first
+
+ const reached = terminal()
+ const second = runTui({ cwd: project, home: join(root, 'home'), aiPage: { codexBin: '/nonexistent/codex' } }, reached.io)
+
+ await settle()
+ reached.press('5')
+ reached.press('6')
+ await settle(50)
+ reached.press('\u0003')
+ await second
+
+ // The bar is checked in the raw output (the reverse-video mark is an escape): the AI page is marked, the page before it is not.
+ const startedOut = started.out.join('')
+ const reachedOut = reached.out.join('')
+
+ expect(startedOut, 'started on ai').toContain(`${ESC}[7m 6 AI ${ESC}[0m`)
+ expect(startedOut, 'started on ai').not.toContain(`${ESC}[7m 1 Overview`)
+ expect(reachedOut, 'reached with 6').toContain(`${ESC}[7m 5 Missions ${ESC}[0m`)
+ expect(reachedOut.slice(reachedOut.lastIndexOf(`${ESC}[7m `)), 'reached with 6').toContain(`${ESC}[7m 6 AI ${ESC}[0m`)
+ })
+
it('fills the terminal exactly: the page bar on the first row, the key line on the last', async () => {
for (const rows of [24, 40]) {
const t = terminal(100, rows)
diff --git a/plugins/ruflo-console/tui/run.ts b/plugins/ruflo-console/tui/run.ts
index 7afa45cea0..e6f3e76097 100644
--- a/plugins/ruflo-console/tui/run.ts
+++ b/plugins/ruflo-console/tui/run.ts
@@ -145,7 +145,7 @@ function paint(session: Session, io: TuiIO, depth: Depth, scroll: number, clear
const place = lines.length > room ? ` · ${top + 1}-${Math.min(lines.length, top + room)}/${lines.length}` : ''
const footer = `${depth === 'none' ? '' : `${ESC}[2m`}${clean(keyLine(columns, place, session.page === 'ai' && session.ai !== null ? aiKeyTiers(session.ai.mode, session.ai.card !== null) : undefined))}${depth === 'none' ? '' : `${ESC}[0m`}`
- io.stdout.write(`${reset}${ESC}[H${navLine(session.state.view as TuiView, columns, depth)}${ESC}[K\r\n${[...lines.slice(top, top + room), ...Array.from({ length: Math.max(0, room - (lines.length - top)) }, () => '')].map(line => `${line}${ESC}[K`).join('\r\n')}${ESC}[J\r\n${footer}`)
+ io.stdout.write(`${reset}${ESC}[H${navLine(session.page, columns, depth)}${ESC}[K\r\n${[...lines.slice(top, top + room), ...Array.from({ length: Math.max(0, room - (lines.length - top)) }, () => '')].map(line => `${line}${ESC}[K`).join('\r\n')}${ESC}[J\r\n${footer}`)
// The question card is on screen now: from here a `y` may answer it, and not before (#3983).
if (session.cardFits) ai?.drawn()
diff --git a/v3/@claude-flow/cli/src/commands/tui.ts b/v3/@claude-flow/cli/src/commands/tui.ts
index 8550237bbe..09575a98c4 100644
--- a/v3/@claude-flow/cli/src/commands/tui.ts
+++ b/v3/@claude-flow/cli/src/commands/tui.ts
@@ -9,7 +9,7 @@
* a one-line hint and exit 2, unless --plain asks for one frame as plain text and exit 0 (ADR-489 decision E).
*
* npx ruflo tui # interactive, in a terminal
- * npx ruflo tui --view swarm # start on the Swarm page (keys 1-5 or o c s e m switch pages)
+ * npx ruflo tui --view swarm # start on the Swarm page (keys 1-6 or o c s e m a switch pages)
* npx ruflo tui --plain | head # one plain frame, exit 0 (scripts, CI)
* npx ruflo tui | cat # not a terminal and no --plain: a hint on stderr, exit 2
*/
@@ -65,7 +65,7 @@ export const tuiCommand: Command = {
],
examples: [
{ command: 'npx ruflo tui', description: 'Open the console in this terminal' },
- { command: 'npx ruflo tui --view swarm', description: 'Start on the Swarm page (keys 1-5 switch pages, tab cycles, q quits)' },
+ { command: 'npx ruflo tui --view swarm', description: 'Start on the Swarm page (keys 1-6 switch pages, tab cycles, q quits)' },
{ command: 'npx ruflo tui --view ai --model openai/gpt-4o-mini --max-spend-usd 0.1', description: 'The AI page on a cheap OpenRouter model, stopping at $0.10 reported (key in $OPENROUTER_API_KEY, never shown)' },
{ command: 'npx ruflo tui --plain | head -40', description: 'One plain frame, exit 0: for scripts and CI (no terminal needed)' },
],