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(ruflo-console): every x.ruv.io row is clickable; results and confirms show above the fold

ruv5c8745f3c5ec
diff --git a/plugins/ruflo-console/hooks/bindings.ts b/plugins/ruflo-console/hooks/bindings.ts
index 49700d2f6a..c1a039847c 100644
--- a/plugins/ruflo-console/hooks/bindings.ts
+++ b/plugins/ruflo-console/hooks/bindings.ts
@@ -134,6 +134,7 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Steps
state.eventFilter = order[(at + 1) % order.length] ?? 'all'
host.invalidate()
},
+ focus: key => void host.focus(PANE_ID, key).catch(() => undefined),
start: (id, text = '') => runner.ask(startSpec(id, Date.now(), text), id === 'mission' || id === 'task' ? 'type it first (it may not start with -)' : 'that start cannot run here'),
// 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 => {
diff --git a/plugins/ruflo-console/hooks/views/common.ts b/plugins/ruflo-console/hooks/views/common.ts
index ee3d44ab10..3a3b09d8b3 100644
--- a/plugins/ruflo-console/hooks/views/common.ts
+++ b/plugins/ruflo-console/hooks/views/common.ts
@@ -46,6 +46,8 @@ export type Actions = {
filter: () => void
/** The terminal view: pick a harness, follow the field, ask to run its text, stop the run, clear the scrollback. */
/** A one-click start for an empty section (init, swarm, hive, workers…): asks, runs, and re-reads the disk. */
+ /** Puts the keys in one of the pane's fields by its key (a row that takes text focuses its field). */
+ focus: (key: string) => void
start: (id: StartId, text?: string) => void
/** The main menu's prompt: a key or a name takes the person to that area. */
menu: (text: string) => void
diff --git a/plugins/ruflo-console/hooks/views/pane.ts b/plugins/ruflo-console/hooks/views/pane.ts
index bc59083955..a2dd7b84c7 100644
--- a/plugins/ruflo-console/hooks/views/pane.ts
+++ b/plugins/ruflo-console/hooks/views/pane.ts
@@ -250,10 +250,11 @@ export function paneView(ctx: Ctx): RenderElement {
const about = blurb(ctx)
const bbs = isBbs() ? wildcat(ctx) : { strip: [], art: [] }
const gap = isBbs() && !isCompact ? [text(ctx, ' ')] : []
+ // The confirm row sits above the body in both layouts: below it, a tall view would push the question off the screen.
// Compact keeps every page's title and its line of purpose; only the banner and the spacing go.
const parts = isCompact
? [tabs(ctx), ...bbs.art, ...(about !== null ? [about] : []), ...(confirm !== null ? [confirm] : []), footer(ctx), body]
- : [...title, ...bbs.strip, ...gap, tabs(ctx), ...gap, ...bbs.art, ...(about !== null ? [about] : []), ...gap, body, ...(confirm !== null ? [confirm] : []), ...gap, footer(ctx)]
+ : [...title, ...bbs.strip, ...gap, tabs(ctx), ...gap, ...bbs.art, ...(about !== null ? [about] : []), ...gap, ...(confirm !== null ? [confirm] : []), body, ...gap, footer(ctx)]
return ctx.kit.Box({ flexDirection: 'column', children: parts })
}
diff --git a/plugins/ruflo-console/hooks/views/xruv.ts b/plugins/ruflo-console/hooks/views/xruv.ts
index 9e008dfb2f..43ef2fe333 100644
--- a/plugins/ruflo-console/hooks/views/xruv.ts
+++ b/plugins/ruflo-console/hooks/views/xruv.ts
@@ -6,7 +6,7 @@ import { INVITE_COMMAND, UNREGISTER_WHY, XRUV, type XEntry, type XGroup } from '
import { ago, button, clip, col, kv, live, row, rule, sourceLine, text, THEME, type Ctx } from './common'
/** Result lines in view at once; j/k scroll the rest. */
-export const XRUV_ROWS = 12
+export const XRUV_ROWS = 8
/** Each kind as a four-cell tag: reads, writes that ask first, and the gateway-identity rows that need the token. */
const TAG = { read: { text: ' rd ', color: () => THEME.ok }, write: { text: ' wr ', color: () => THEME.info }, admin: { text: ' ad ', color: () => THEME.warn } } as const
@@ -25,18 +25,31 @@ function rowButton(ctx: Ctx, entry: XEntry): RenderElement | null {
return ctx.kit.Button({ key: `xr-${entry.id}`, label: entry.kind === 'read' ? ' â–¸ fetch' : ' â–¸ ask', plain: true, dimColor: true, onPress: () => void ctx.act.run(entry.id) })
}
-/** One menu row, dotted to its purpose: the tag, the name, what it does, and its button. */
+/**
+ * What pressing a row's name does: a text-taking row focuses its field (the next keys type into it), the invite row
+ * types its command into the terminal, and every other row runs its action (a read fetches, a write asks, and
+ * unregister or an admin row without the token says why in the Result panel).
+ */
+function pressOf(ctx: Ctx, entry: XEntry): () => void {
+ if (entry.id === 'x-invite') return () => ctx.act.term.load('ruflo', INVITE_COMMAND)
+ if (entry.takes !== undefined && entry.id !== 'x-join') return () => ctx.act.focus(`xr-in-${entry.id}`)
+
+ return () => void ctx.act.run(entry.id)
+}
+
+/** One menu row, dotted to its purpose: the tag, the name and what it does (both buttons: the whole row is clickable), and its own button. */
function entryRow(ctx: Ctx, entry: XEntry, lead: number): RenderElement {
const tag = TAG[entry.kind]
const isOff = entry.id === 'x-unregister' || (entry.kind === 'admin' && ctx.state.xruv.hasAdminToken !== true)
const action = rowButton(ctx, entry)
+ const press = pressOf(ctx, entry)
return row(
ctx,
[
ctx.kit.Text({ bold: true, color: tag.color(), children: ` ${tag.text}` }),
- ctx.kit.Text({ bold: true, color: entry.kind === 'admin' ? THEME.warn : THEME.head, children: ` ${entry.name} `.padEnd(lead, '.') }),
- ctx.kit.Text({ color: THEME.info, dimColor: isOff, wrap: 'truncate-end', children: clip(` ${entry.about}`, Math.max(4, ctx.columns - lead - 18)) }),
+ ctx.kit.Button({ key: `xr-name-${entry.id}`, label: ` ${entry.name} `.padEnd(lead, '.'), plain: true, onPress: press }),
+ ctx.kit.Button({ key: `xr-about-${entry.id}`, label: clip(` ${entry.about}`, Math.max(4, ctx.columns - lead - 18)), plain: true, dimColor: true, onPress: press }),
...(action === null ? [] : [action]),
],
`xr-row-${entry.id}`,
@@ -49,7 +62,7 @@ function field(ctx: Ctx, entry: XEntry, placeholder: string): RenderElement {
if (Input === undefined) return text(ctx, ` from the palette (p): ${entry.id} <${entry.takes ?? ''}>`, { dimColor: true })
- return Input({ key: `xr-in-${entry.id}`, label: ` ${entry.name.toLowerCase()}`, placeholder, submitLabel: entry.kind === 'read' ? 'fetch' : 'ask', onSubmit: value => void ctx.act.run(entry.id, value) })
+ return Input({ key: `xr-in-${entry.id}`, label: ` â–¸ ${entry.name.toLowerCase()}`, placeholder, submitLabel: entry.kind === 'read' ? 'fetch' : 'ask', onSubmit: value => void ctx.act.run(entry.id, value) })
}
/** This node: its Nostr key (only whether the file exists), the pubkey a result named, and the join and leave rows. */
@@ -142,14 +155,14 @@ function channelRows(ctx: Ctx, lead: number): RenderElement[] {
if (held !== null && held.channels.length > 0) {
for (const channel of held.channels.slice(0, 6)) {
- rows.push(row(ctx, [text(ctx, ` # ${clip(channel.name ?? channel.id, 18).padEnd(18)} ${channel.id.padEnd(22)} ${channel.id.startsWith('prv:') ? 'private' : 'public '} · ${ago(channel.atMs, nowMs)} `), readBtn(channel.id)], `xr-ch-${channel.id}`))
+ rows.push(row(ctx, [ctx.kit.Button({ key: `xr-chname-${channel.id}`, label: ` # ${clip(channel.name ?? channel.id, 18).padEnd(18)} ${channel.id.padEnd(22)} ${channel.id.startsWith('prv:') ? 'private' : 'public '} · ${ago(channel.atMs, nowMs)} `, plain: true, onPress: () => void ctx.act.run('x-read', channel.id) }), readBtn(channel.id)], `xr-ch-${channel.id}`))
}
} else {
rows.push(text(ctx, ` ${held === null ? sourceLine(state.probes.get('channels'), nowMs, 'channels').text : 'no channel keys held here yet'}`, { dimColor: true }))
}
for (const room of rooms.slice(0, 4)) {
- rows.push(row(ctx, [ctx.kit.Text({ bold: true, color: THEME.head, children: ` #${room.name.padEnd(14)} ` }), ctx.kit.Text({ color: THEME.info, wrap: 'truncate-end', children: clip(room.purpose ?? '', Math.max(4, ctx.columns - 28)) }), readBtn(`pub:${room.name}`)], `xr-room-${room.name}`))
+ rows.push(row(ctx, [ctx.kit.Button({ key: `xr-roomname-${room.name}`, label: ` #${room.name.padEnd(14)} ${clip(room.purpose ?? '', Math.max(4, ctx.columns - 32))}`, plain: true, onPress: () => void ctx.act.run('x-read', `pub:${room.name}`) }), readBtn(`pub:${room.name}`)], `xr-room-${room.name}`))
}
const first = held?.channels[0]?.id ?? (rooms[0] !== undefined ? `pub:${rooms[0].name}` : 'pub:general')
@@ -192,6 +205,14 @@ function resultRows(ctx: Ctx): RenderElement[] {
if (running !== null) rows.push(text(ctx, ` ▸ ${running.label} … ${Math.floor(nowMs / 500) % 2 === 0 ? '█' : ' '}`, { color: THEME.warn }))
+ // A row that cannot run (unregister, an admin row without its token) answers here with why, never silently.
+ const { outcome } = state
+
+ if (outcome !== null && !outcome.ok && (result === null || outcome.atMs > result.atMs)) {
+ rows.push(text(ctx, ` ✗ ${outcome.label}`, { bold: true, color: THEME.warn }))
+ rows.push(text(ctx, ` ${outcome.detail}`))
+ }
+
if (result === null) {
if (running === null) rows.push(text(ctx, ' â–¸ fetch shows its answer here at once; a write shows here after you confirm (y)', { dimColor: true }))
@@ -231,11 +252,12 @@ export function xruvView(ctx: Ctx): RenderElement {
const rows: RenderElement[] = [
rule(ctx, 'Main menu', 'ruflo federation · x_federation_* tools'),
text(ctx, ' rd reads at once · wr asks first (y) and says what it sends · ad signs as the gateway (admin token)', { dimColor: true }),
+ // The result sits at the top: a click far down the board answers where it can be seen, not below the fold.
+ ...resultRows(ctx),
...identityRows(ctx, lead),
...networkRows(ctx, lead),
...channelRows(ctx, lead),
...adminRows(ctx, lead),
- ...resultRows(ctx),
]
return col(ctx, rows, 'xruv')
diff --git a/plugins/ruflo-console/tests/xruv.test.ts b/plugins/ruflo-console/tests/xruv.test.ts
index 818c4c9f27..ba4b246e38 100644
--- a/plugins/ruflo-console/tests/xruv.test.ts
+++ b/plugins/ruflo-console/tests/xruv.test.ts
@@ -195,4 +195,45 @@ describe('x.ruv.io board', () => {
expect((await $.command.run(command('run x-invite'))).text).toContain('the console never shows one')
expect(world.runs.some(argv => argv.includes('x_federation_invite_mint'))).toBe(false)
})
+
+ test('the whole row is clickable: pressing a row name reads, asks, or focuses its field; nothing is a dead label', { options: { boot: false } }, async ($, on) => {
+ const world = worldOf(on, RUFLO_FILES)
+
+ world.respond = respond
+ mock.clock(on)
+ await $.session.start(SESSION)
+ await $.command.run(command('xruv'))
+
+ const pane = await $.ui.mount({ ...paneAt(120), surface: 'terminal' as const, plugin: PLUGIN })
+ const keys = elementsOf(await pane.drawn(), 'Button').map(keyOf)
+ const names = keys.filter(key => key.startsWith('xr-name-') || key.startsWith('xr-about-'))
+
+ // Every row has both its name and its about line as buttons, so a click anywhere on the row lands on one.
+ for (const id of ['x-join', 'x-bbs-identity', 'x-registry', 'x-roster', 'x-claims', 'x-sync', 'x-channels', 'x-read', 'x-publish', 'x-create', 'x-grant', 'x-unregister']) {
+ expect(names).toContain(`xr-name-${id}`)
+ expect(names).toContain(`xr-about-${id}`)
+ }
+
+ // A read row: the name fetches at once, one fixed argv, and the result panel answers.
+ await pane.press({ key: 'xr-name-x-claims' })
+ expect(fedRuns(world.runs).map(argv => argv.slice(4))).toEqual([['mcp', 'exec', '-t', 'x_federation_claims', '-p', '{}']])
+ expect(textOf(await pane.drawn())).toContain('repo:ruflo#42')
+
+ // The about line does the same as the name.
+ await pane.press({ key: 'xr-about-x-roster' })
+ expect(fedRuns(world.runs).some(argv => argv.includes('x_federation_roster'))).toBe(true)
+
+ // A write row asks first and sends nothing until confirmed.
+ const before = fedRuns(world.runs).length
+
+ await pane.press({ key: 'xr-name-x-join' })
+ expect(textOf(await pane.drawn())).toMatch(/join x\.ruv\.io/i)
+ expect(fedRuns(world.runs)).toHaveLength(before)
+
+ // Unregister has no gateway endpoint: pressing it says so in the board, and runs nothing.
+ await pane.press({ key: 'xr-name-x-unregister' })
+ expect(fedRuns(world.runs)).toHaveLength(before)
+ expect(textOf(await pane.drawn())).toContain('✗ nothing to do')
+ await pane.unmount()
+ })
})