🌊 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
Merge branch 'feat/console-cost' into feat/console-starts
ruv33ce665cda61
diff --cc plugins/ruflo-console/hooks/controller.tsindex e1c7282cf1,34d035dea3..a0d58d5efe--- a/plugins/ruflo-console/hooks/controller.ts+++ b/plugins/ruflo-console/hooks/controller.ts@@@ -5,8 -5,7 +5,8 @@@*/import { actionsOf } from './bindings'import type { Catalog } from './data/catalog'- import { PROBES, type ProbeResult } from './data/cli'+ import { PROBES, probeArgv, type ProbeResult } from './data/cli'+import { X_PROBES } from './data/xruv'import { diffEvents, record } from './data/events'import { plain } from './data/parse'import { readSnapshot } from './data/snapshot'diff --cc plugins/ruflo-console/hooks/dispatch.tsindex 3e95c54d1b,ab82a4c5b8..589d2d1786--- a/plugins/ruflo-console/hooks/dispatch.ts+++ b/plugins/ruflo-console/hooks/dispatch.ts@@@ -115,7 -116,13 +117,13 @@@ export async function dispatch(control// A lab read answers with what it printed, so `/ruflo run mh-genome` works headless.if (state.pending === null) await control.runner.settled()- return { text: state.pending !== null ? `Asked: ${state.pending.label}. Confirm with /ruflo yes (or y in the pane), cancel with /ruflo no.` : (xruvAnswer(state, intent.paletteId, askedAtMs) ?? labAnswer(state, intent.paletteId, askedAtMs) ?? (state.outcome !== null && !state.outcome.ok ? `${state.outcome.label}: ${state.outcome.detail}` : (state.outcome?.label ?? 'done'))) }+ if (state.pending !== null) {+ const pending = state.pending++ return { text: [`Asked: ${pending.label}. Confirm with /ruflo yes (or y in the pane), cancel with /ruflo no.`, ...(pending.shows === undefined ? [] : [`runs: ${pending.shows}`, pending.note ?? ''])].filter(Boolean).join('\n') }+ }+- return { text: labAnswer(state, intent.paletteId, askedAtMs) ?? (state.outcome !== null && !state.outcome.ok ? `${state.outcome.label}: ${state.outcome.detail}` : (state.outcome?.label ?? 'done')) }++ return { text: (xruvAnswer(state, intent.paletteId, askedAtMs) ?? labAnswer(state, intent.paletteId, askedAtMs)) ?? (state.outcome !== null && !state.outcome.ok ? `${state.outcome.label}: ${state.outcome.detail}` : (state.outcome?.label ?? 'done')) }}case 'confirm':if (state.pending === null) return { text: 'Nothing is waiting for a confirm.' }diff --cc plugins/ruflo-console/hooks/palette.tsindex 9c9ad971f6,2fe127c0e4..73614b2b29--- a/plugins/ruflo-console/hooks/palette.ts+++ b/plugins/ruflo-console/hooks/palette.ts@@@ -4,7 -4,7 +4,8 @@@* argument from the query after their keyword: `route fix the login bug`.*/import { HIVE_ROLES, pickedProposal } from './data/hive'+import { START_IDS, START_LABEL, startSpec } from './starts'+ import { BUDGET_PRESETS, budgetWhy, inspectModels, setBudget } from './cost'import { hiveBroadcast, hivePropose, hiveSpawn, hiveVote } from './hive'import { claimTask, handoffClaim, releaseClaim, stealClaim, type ActionSpec } from './actions'import { LAB, labSpec, labWhy } from './mh-lab'@@@ -51,7 -50,7 +52,7 @@@ export function fuzzy(query: string, lareturn whole < 0 ? score : score + 5 + (whole === 0 || text[whole - 1] === ' ' ? 3 : 0)}- const TEXT_KEYWORDS = ['route', 'store', 'search', 'propose', 'broadcast', 'task', 'mission', 'x-join', 'x-read', 'x-publish', 'x-create', 'x-grant', 'x-hub', 'x-admit'] as const-const TEXT_KEYWORDS = ['route', 'store', 'search', 'propose', 'broadcast', 'cost-budget'] as const++const TEXT_KEYWORDS = ['route', 'store', 'search', 'propose', 'broadcast', 'task', 'mission', 'cost-budget', 'x-join', 'x-read', 'x-publish', 'x-create', 'x-grant', 'x-hub', 'x-admit'] as const/** Every entry for the state as it is, before filtering. */export function paletteEntries(state: State, nowMs: number): PaletteEntry[] {diff --cc plugins/ruflo-console/hooks/state.tsindex 27e50715af,5763ac0e09..f1904d6b3b--- a/plugins/ruflo-console/hooks/state.ts+++ b/plugins/ruflo-console/hooks/state.ts@@@ -262,10 -262,9 +267,10 @@@ export function newState(raw: PluginOptoutcome: null,isActing: false,lab: { result: null, running: null },+ xruv: { result: null, running: null, pubkey: null, hasAdminToken: null },isRefreshing: false,barDrawnAtMs: 0,- terminal: { harness: 'codex', draft: '', lines: [], runs: new Map(), sessions: {}, isLive: { codex: false, claude: false }, turns: { codex: 0, claude: 0 }, costUsd: 0, scroll: 0, unseen: 0, asked: null },+ terminal: { harness: 'codex', draft: '', lines: [], runs: new Map(), sessions: {}, isLive: { codex: false, claude: false }, turns: { codex: 0, claude: 0 }, costUsd: 0, costReports: 0, scroll: 0, unseen: 0, asked: null },skills: emptySkills(),timers: new Map(),stats: { renders: [], refreshes: [], frames: [] },diff --cc plugins/ruflo-console/tests/fixtures/world.tsindex 67aa410f37,193ce81975..9e06b85305--- a/plugins/ruflo-console/tests/fixtures/world.ts+++ b/plugins/ruflo-console/tests/fixtures/world.ts@@@ -32,8 -33,7 +33,9 @@@ export type Answer = { exitCode: numberexport type World = {files: Map<string, string>runs: string[][]+ /** Every path the mod asked fs.read for, refused or not. */+ reads: string[]+ inputs: string[]blits: string[]opened: string[]commands: string[]@@@ -79,7 -82,7 +84,8 @@@ export function worldOf(on: On, files:const world: World = {files: all,runs: [],+ reads: [],+ inputs: [],blits: [],opened: [],commands: [],diff --cc plugins/ruflo-console/tests/xruv.test.tsindex 3895ac8aca,0000000000..818c4c9f27mode 100644,000000..100644--- a/plugins/ruflo-console/tests/xruv.test.ts+++ b/plugins/ruflo-console/tests/xruv.test.ts@@@ -1,196 -1,0 +1,198 @@@+import { describe, expect, mock, test } from 'claude-code/testing'++import { RUFLO_FILES } from './fixtures/ruflo-run'+import { cliAnswer, command, elementsOf, keyOf, paneAt, PLUGIN, SESSION, textOf, worldOf, type Answer } from './fixtures/world'++const PUBKEY = 'ab'.repeat(32)+const TOKEN = 'xr-admin-token-do-not-print-0123456789'+const INVITE = 'v2.SECRETinviteTOKEN123'+const NETWORK = /x_federation_(registry|roster|claims|sync|channel_read|join|channel_publish|channel_grant|channel_accept|admit|publish|invite)/+const ok = (body: unknown): Answer => ({ exitCode: 0, stdout: `[INFO] Executing tool\nResult:\n${JSON.stringify(body)}`, stderr: '' })+const fenced = (data: unknown) => ({ untrusted: true, provenance: 'third-party relay text', relay: 'wss://relay.ruv.io', retrievedAt: '2026-10-02T12:00:00Z', data })++/** The federation reads and writes answered as the CLI answers them; everything else from the captured run. */+function respond(argv: readonly string[]): Answer {+ const line = argv.join(' ')++ if (line.includes('x_federation_roster')) return ok(fenced({ [`${PUBKEY.slice(0, 20)}`]: { about: 'coder node in Toronto' } }))+ if (line.includes('x_federation_claims')) return ok(fenced({ 'repo:ruflo#42': { owner: PUBKEY, from: 'ruvultra', ttlSeconds: 600, expiresAt: '2026-10-02T13:00:00Z' } }))+ if (line.includes('x_federation_sync')) return ok(fenced({ count: 1, messages: [{ type: 'Status', text: 'online and idle', id: 'e1', pubkey: PUBKEY, created_at: 1_790_000_000 }] }))+ if (line.includes('x_federation_registry')) return ok({ relay: 'wss://relay.ruv.io', swarmTag: 'ruflo-swarm', registration: { enabled: true, authentication: 'NIP-98' }, join: ['1. generate a key'], defaultChannels: [{ channel: 'general', purpose: 'everything' }] })+ if (line.includes('x_federation_channel_publish')) return ok({ ok: true, channel: 'pub:general', visibility: 'public', encrypted: false, eventId: 'ev1', pubkey: PUBKEY })+ if (line.includes('x_federation_join')) return ok({ ok: true, pubkey: PUBKEY, keyCreated: false, membershipVerified: true, next: `share ${INVITE} with nobody` })++ return cliAnswer(argv)+}++const fedRuns = (runs: readonly string[][]) => runs.filter(argv => NETWORK.test(argv.join(' ')))+const argsOf = (runs: readonly string[][], tool: string) => runs.find(argv => argv.includes(tool))?.slice(4)++describe('x.ruv.io board', () => {+ test('every capability is a row with a button or a field; nothing on the network is asked and the key is never read', { options: { boot: false } }, async ($, on) => {+ const world = worldOf(on, RUFLO_FILES, { home: { '.ruflo/nostr.key': 'never-read' } })+ 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 tree = await pane.drawn()+ const text = textOf(tree)++ expect(elementsOf(tree, 'Button').map(keyOf)).toEqual(expect.arrayContaining(['xr-x-join', 'xr-x-bbs-identity', 'xr-x-registry', 'xr-x-roster', 'xr-x-claims', 'xr-x-sync', 'xr-x-channels', 'xr-x-accept']))+ expect(elementsOf(tree, 'Input').map(keyOf)).toEqual(expect.arrayContaining(['xr-in-x-join', 'xr-in-x-read', 'xr-in-x-publish', 'xr-in-x-create', 'xr-in-x-grant']))+ expect(text).toContain(' JOIN ....')+ expect(text).toContain('present: ~/.ruflo/nostr.key (never read here)')+ expect(text).toContain('unregister: not offered by the x.ruv.io gateway yet')+ expect(text).toContain('admin token: set it in the environment to enable')+ expect(text).toContain('Turn on federationNetwork in /config')+ expect(fedRuns(world.runs)).toEqual([])+ expect(world.reads.some(path => path.endsWith('nostr.key') || path.endsWith('channels.json'))).toBe(false)+ await pane.unmount()+ })++ test('a fetch runs one fixed read on the click, fills its section and the result panel', { 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 })++ await pane.press({ key: 'xr-x-claims' })++ const text = textOf(await pane.drawn())++ expect(fedRuns(world.runs).map(argv => argv.slice(4))).toEqual([['mcp', 'exec', '-t', 'x_federation_claims', '-p', '{}']])+ expect(text).toContain('repo:ruflo#42 · abababababab… (ruvultra)')+ expect(text).toContain('1 claimed resources')+ await pane.unmount()+ })++ test('with federationNetwork on, the board keeps the registry, roster, claims and swarm live', { options: { boot: false, federationNetwork: true } }, async ($, on) => {+ const world = worldOf(on, RUFLO_FILES)++ world.respond = respond+ mock.clock(on)+ await $.session.start(SESSION)++ await $.command.run(command('xruv'))+ await $.command.run(command('status'))++ const text = textOf(await $.ui.render(paneAt(120)))++ expect(argsOf(world.runs, 'x_federation_sync')).toEqual(['mcp', 'exec', '-t', 'x_federation_sync', '-p', '{"limit":20}'])+ expect(world.runs.some(argv => argv.includes('x_federation_claims'))).toBe(true)+ expect(text).toContain('[Status] abababababab… — online and idle')+ expect(text).toContain('◉ abababababababababab — coder node in Toronto')+ // Writes never run on their own, even with the network on.+ expect(world.runs.some(argv => /x_federation_(join|channel_publish|channel_grant|channel_accept|admit|publish|invite_mint)/.test(argv.join(' ')))).toBe(false)+ })++ test('writes ask first and run one fixed argv on yes; a bad value runs nothing', { options: { boot: false } }, async ($, on) => {+ const world = worldOf(on, RUFLO_FILES, { home: { '.ruflo/nostr.key': 'never-read' } })++ 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 })++ await pane.input({ key: 'xr-in-x-publish', text: 'pub:general Status: online', kind: 'submit' })+ expect(textOf(await pane.drawn())).toContain('Confirm: publish Status to pub:general as yourself?')+ expect(fedRuns(world.runs)).toEqual([])+ await pane.press({ key: 'confirm' })+ expect(argsOf(world.runs, 'x_federation_channel_publish')).toEqual(['mcp', 'exec', '-t', 'x_federation_channel_publish', '-p', JSON.stringify({ channel: 'pub:general', msgType: 'Status', payload: { text: 'online' } })])++ // The pubkey the publish named now stands for this node.+ expect(textOf(await pane.drawn())).toContain(`${PUBKEY.slice(0, 16)}…${PUBKEY.slice(-6)}`)++ await pane.input({ key: 'xr-in-x-grant', text: 'prv:0123456789abcdef not-a-key', kind: 'submit' })+ await pane.input({ key: 'xr-in-x-create', text: 'Bad Name!', kind: 'submit' })+ expect(textOf(await pane.drawn())).not.toContain('Confirm:')+ expect(world.runs.some(argv => /x_federation_channel_(grant|create)/.test(argv.join(' ')))).toBe(false)++ await pane.press({ key: 'xr-x-accept' })+ await pane.press({ key: 'cancel' })+ expect(world.runs.some(argv => argv.includes('x_federation_channel_accept'))).toBe(false)+ await pane.unmount()+ })++ test('join with an invite: the code is masked on the confirm row and in the answer, and sent once as its own argv', { options: { boot: false } }, async ($, on) => {+ const world = worldOf(on, RUFLO_FILES)++ world.respond = respond+ mock.clock(on)+ await $.session.start(SESSION)++ const asked = await $.command.run(command(`run x-join ${INVITE}`))+ const shown = textOf(await $.ui.render(paneAt(120)))+- expect(asked.text).toBe('Asked: join x.ruv.io with your own key and an invite. Confirm with /ruflo yes (or y in the pane), cancel with /ruflo no.')++ // The first line asks; the next say exactly what runs (the code masked) and that it reaches the network.++ expect((asked.text ?? '').split('\n')[0]).toBe('Asked: join x.ruv.io with your own key and an invite. Confirm with /ruflo yes (or y in the pane), cancel with /ruflo no.')++ expect(asked.text).toContain('with your invite code, masked here')+ expect(shown).toContain('your invite code, masked here')+ expect(shown).not.toContain(INVITE)++ const answer = await $.command.run(command('yes'))++ expect(argsOf(world.runs, 'x_federation_join')).toEqual(['mcp', 'exec', '-t', 'x_federation_join', '-p', JSON.stringify({ code: INVITE })])+ expect(answer.text).toContain('joined · pubkey abababababab… · key reused · membership verified (NIP-42)')+ expect(answer.text).not.toContain(INVITE)+ expect(textOf(await $.ui.render(paneAt(120)))).not.toContain(INVITE)+ })++ test('unregister is never run; headless reads answer with what they fetched', { options: { boot: false } }, async ($, on) => {+ const world = worldOf(on, RUFLO_FILES)++ world.respond = respond+ mock.clock(on)+ await $.session.start(SESSION)++ expect((await $.command.run(command('run x-unregister'))).text).toContain('not offered by the x.ruv.io gateway yet')+ expect((await $.command.run(command('yes'))).text).toBe('Nothing is waiting for a confirm.')+ expect(fedRuns(world.runs)).toEqual([])++ const roster = await $.command.run(command('run x-roster'))++ expect(roster.text).toMatch(/^✓ fetch the x\.ruv\.io roster/)+ expect(roster.text).toContain('◉ abababababababababab — coder node in Toronto')+ })++ test('admin rows: refused without the token; with it, they ask first and the token never reaches argv or the screen', { options: { boot: false } }, async ($, on) => {+ const world = worldOf(on, RUFLO_FILES)++ world.respond = respond+ mock.clock(on)+ await $.session.start(SESSION)+ expect((await $.command.run(command(`run x-admit ${PUBKEY}`))).text).toContain('RUFLO_X_ADMIN_TOKEN is not set')+ expect(fedRuns(world.runs)).toEqual([])+ })++ test('with the admin token set, admit asks first and runs without the token in its argv', { options: { boot: false } }, async ($, on) => {+ const world = worldOf(on, RUFLO_FILES, { env: { RUFLO_X_ADMIN_TOKEN: TOKEN } })++ world.respond = respond+ mock.clock(on)+ await $.session.start(SESSION)++ const asked = await $.command.run(command(`run x-admit ${PUBKEY}`))+ await $.command.run(command('xruv'))++ const shown = textOf(await $.ui.render(paneAt(120)))++ expect(asked.text).toContain(`Asked: admit ${PUBKEY.slice(0, 12)}… as member`)+ expect(shown).toContain('RUFLO_X_ADMIN_TOKEN is set')+ expect(fedRuns(world.runs)).toEqual([])+ await $.command.run(command('yes'))+ expect(argsOf(world.runs, 'x_federation_admit')).toEqual(['mcp', 'exec', '-t', 'x_federation_admit', '-p', JSON.stringify({ pubkey: PUBKEY, role: 'member' })])+ expect(world.runs.some(argv => argv.join(' ').includes(TOKEN))).toBe(false)+ expect(textOf(await $.ui.render(paneAt(120)))).not.toContain(TOKEN)+ // Invites are minted in the terminal, never by the 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)+ })+})