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

Merge branch 'feat/console-automate' into feat/console-starts

ruv054af1aba040
diff --cc plugins/ruflo-console/hooks/actions.ts
index 30b825fef3,3b5e13f368..c1857d71d7
--- a/plugins/ruflo-console/hooks/actions.ts
+++ b/plugins/ruflo-console/hooks/actions.ts
@@@ -26,12 -23,8 +26,14 @@@ export type ActionSpec =
note?: string
/** How long the CLI may take; 90 s when unset. */
timeoutMs?: number
+ /** The x.ruv.io board's result panel instead of the MetaHarness lab's, for a spec with a `lab` id. */
+ board?: 'xruv'
+ /** What the result panel shows of the output, when not the lab's reading of it. */
+ lines?: (stdout: string, stderr: string) => string[]
+ /** Called with what the CLI printed when the run succeeded: a board read fills its section from it. */
+ onOutput?: (stdout: string) => void
+ /** A lab entry that reads its own output: it may keep what it parsed, and answers the result panel's lines (masked where it must be). */
+ read?: (stdout: string, stderr: string, ok: boolean) => string[]
}
export const exec = (tool: string, params: Record<string, string>) => ['mcp', 'exec', '-t', tool, '-p', JSON.stringify(params)] as const
diff --cc plugins/ruflo-console/hooks/palette.ts
index 35caac9925,675e68498f..05e4d94b15
--- a/plugins/ruflo-console/hooks/palette.ts
+++ b/plugins/ruflo-console/hooks/palette.ts
@@@ -4,18 -4,13 +4,20 @@@
* 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 { automateEntries } from './automate'
+import { MEM_KEYWORDS, MEM_LAB, memSpecOf, memWhy } from './memory-lab'
import { LAB, labSpec, labWhy } from './mh-lab'
+import { PERF } from './perf'
+import { SECURE, SECURE_KEYWORDS, SECURE_TEXT, secSpec, secTextSpec } from './secure'
+import { skillPaletteEntries } from './skills-lab'
++import { automateEntries } from './automate'
+ import { neuralEntries } from './neural'
import { AGENT_TYPES, agentLogs, dispatchWorker, memorySearch, memoryStore, reroute, setClaimStatus, spawnAgent, stopAgent, swarmInit, swarmStop, vote, WORKERS } from './ops'
import { VIEWS, type State, type ViewId } from './state'
+import { XRUV } from './xruv'
import { selection } from './views/select'
export type PaletteRun =
@@@ -56,7 -51,8 +58,7 @@@ export function fuzzy(query: string, la
return whole < 0 ? score : score + 5 + (whole === 0 || text[whole - 1] === ' ' ? 3 : 0)
}
- const TEXT_KEYWORDS: readonly string[] = ['route', 'store', 'search', 'propose', 'broadcast', 'task', 'mission', 'cost-budget', 'x-join', 'x-read', 'x-publish', 'x-create', 'x-grant', 'x-hub', 'x-admit', ...MEM_KEYWORDS, ...SECURE_KEYWORDS, 'skills-find']
-/** A text entry's id is its keyword: the Automation and Learning Lab ones are prefixed, so none shadows another. */
-const TEXT_KEYWORDS = ['route', 'store', 'search', 'propose', 'broadcast', 'auto-wf-new', 'auto-wf-validate', 'auto-ap-history', 'auto-ses-save', 'auto-cfg-get', 'auto-cfg-set', 'auto-task-new', 'nn-train', 'nn-route', 'nn-explain', 'nn-predict'] as const
++const TEXT_KEYWORDS: readonly string[] = ['route', 'store', 'search', 'propose', 'broadcast', 'task', 'mission', 'cost-budget', 'x-join', 'x-read', 'x-publish', 'x-create', 'x-grant', 'x-hub', 'x-admit', ...MEM_KEYWORDS, ...SECURE_KEYWORDS, 'skills-find', 'auto-wf-new', 'auto-wf-validate', 'auto-ap-history', 'auto-ses-save', 'auto-cfg-get', 'auto-cfg-set', 'auto-task-new', 'nn-train', 'nn-route', 'nn-explain', 'nn-predict']
/** Every entry for the state as it is, before filtering. */
export function paletteEntries(state: State, nowMs: number): PaletteEntry[] {
@@@ -132,24 -119,11 +134,30 @@@
// The MetaHarness lab: reads run at once, the rest ask first; promotion is never an entry (see mh-lab.ts).
for (const entry of LAB) add(entry.id, 'metaharness', entry.label, { kind: 'spec', spec: labSpec(entry, state), why: labWhy(entry) })
+ // The x.ruv.io board: reads run at once (the ask is the consent), writes ask first, admin rows need the token.
+ for (const entry of XRUV) {
+ // An admin row without the token is a spec with its reason, so `/ruflo run x-admit …` says why instead of "type …".
+ if (entry.takes !== undefined && (entry.kind !== 'admin' || state.xruv.hasAdminToken === true)) add(entry.id, 'x.ruv.io', `${entry.id.slice(2)} <${entry.takes}>: ${entry.label}`, { kind: 'text', keyword: entry.id, make: text => entry.spec(state, text) })
+ else add(entry.id, 'x.ruv.io', entry.label, { kind: 'spec', spec: entry.spec(state, ''), why: entry.why(state, '') })
+ }
+
+ // The Memory Lab: an entry that takes text reads it after its id (`mem-search jwt refresh`), the rest run as they are.
+ for (const entry of MEM_LAB) {
+ add(entry.id, 'memory', entry.label, entry.takes === undefined ? { kind: 'spec', spec: memSpecOf(entry, '', state), why: memWhy(entry) } : { kind: 'text', keyword: entry.id, make: text => memSpecOf(entry, text, state) })
+ }
+
+ // Security & Doctor and Performance: reads run at once, the rest ask with their cost on the confirm row (secure.ts, perf.ts).
+ for (const entry of [...SECURE, ...PERF]) add(entry.id, entry.id.startsWith('perf') ? 'performance' : 'security', entry.label, { kind: 'spec', spec: secSpec(entry, entry.args, state), why: '' })
+ for (const entry of SECURE_TEXT) add(entry.id, 'security', entry.label, { kind: 'text', keyword: entry.id, make: text => secTextSpec(entry, text, state) })
+ // The skills view's search, update-all, restore and sync, so /ruflo run skills-update works headless.
+ out.push(...skillPaletteEntries(state))
+
++
+ // Automation and the Learning Lab: reads run at once, the rest ask first; per-row verbs come from the lists last read.
+ for (const entry of [...automateEntries(state), ...neuralEntries(state)]) {
+ add(entry.id, entry.group, entry.label, entry.make !== undefined ? { kind: 'text', keyword: entry.id, make: entry.make } : { kind: 'spec', spec: entry.spec ?? null, why: entry.why ?? '' })
+ }
+
for (const worker of WORKERS) add(`worker-${worker}`, 'workers', `dispatch the ${worker} background worker`, { kind: 'spec', spec: dispatchWorker(worker), why: 'unknown worker' })
add('route', 'learning', 'route <task words>: ask the router for a pick', { kind: 'text', keyword: 'route', make: reroute })
diff --cc plugins/ruflo-console/hooks/runner.ts
index 2cfdb66b2e,20894c9361..da19353373
--- a/plugins/ruflo-console/hooks/runner.ts
+++ b/plugins/ruflo-console/hooks/runner.ts
@@@ -66,11 -60,9 +66,11 @@@ export function createRunner(state: Sta
// A lab run's output goes to the lab's result panel, scrolled from its top; the footer keeps the one-line outcome.
if (spec.lab !== undefined) {
- panel.result = { id: spec.lab, label: spec.label, ok, exitCode: result.exitCode, ...(spec.note !== undefined && { note: spec.note }), lines: (spec.lines ?? ((out, err) => labLines(spec.lab ?? '', out, err)))(result.stdout, result.stderr), atMs: Date.now() }
- state.lab.result = { id: spec.lab, label: spec.label, ok, exitCode: result.exitCode, ...(spec.note !== undefined && { note: spec.note }), lines: spec.read?.(result.stdout, result.stderr, ok) ?? labLines(spec.lab, result.stdout, result.stderr), atMs: Date.now() }
++ panel.result = { id: spec.lab, label: spec.label, ok, exitCode: result.exitCode, ...(spec.note !== undefined && { note: spec.note }), lines: spec.read?.(result.stdout, result.stderr, ok) ?? (spec.lines ?? ((out, err) => labLines(spec.lab ?? '', out, err)))(result.stdout, result.stderr), atMs: Date.now() }
state.select.item = 0
}
+ // Keyed on the exit, not on `ok`: relay text in a read may carry an "error" key of its own.
+ if (result.exitCode === 0) spec.onOutput?.(result.stdout)
if (spec.isReadOnly === true) {
say(spec.label, ok, ok ? 'the ruflo CLI answered:' : plain(error ?? result.stderr, 160) || `exit ${result.exitCode}`, spec.lab === undefined ? outputLines(result.stdout) : undefined)
diff --cc plugins/ruflo-console/hooks/state.ts
index c24715c7ef,8469f19591..d2b9603ed1
--- a/plugins/ruflo-console/hooks/state.ts
+++ b/plugins/ruflo-console/hooks/state.ts
@@@ -11,7 -11,7 +12,7 @@@ import type { RufloRoute, RufloSnapsho
export const PLUGIN_NAME = 'ruflo-console'
export const PANE_ID = 'ruflo-console'
- export type ViewId = 'menu' | 'overview' | 'swarm' | 'hive' | 'claims' | 'federation' | 'plugins' | 'learning' | 'metaharness' | 'memory' | 'cost' | 'timeline' | 'approvals' | 'events' | 'missions' | 'xruv' | 'terminal' | 'skills' | 'agent' | 'secure' | 'perf'
-export type ViewId = 'menu' | 'overview' | 'swarm' | 'hive' | 'claims' | 'federation' | 'plugins' | 'learning' | 'metaharness' | 'memory' | 'cost' | 'timeline' | 'approvals' | 'events' | 'missions' | 'xruv' | 'terminal' | 'skills' | 'automate' | 'neural' | 'agent'
++export type ViewId = 'menu' | 'overview' | 'swarm' | 'hive' | 'claims' | 'federation' | 'plugins' | 'learning' | 'metaharness' | 'memory' | 'cost' | 'timeline' | 'approvals' | 'events' | 'missions' | 'xruv' | 'terminal' | 'skills' | 'agent' | 'secure' | 'perf' | 'automate' | 'neural'
/**
* The views in tab order, each with its hotkey and the inline height it asks for. Digits are the first nine; the three
@@@ -39,13 -39,13 +40,15 @@@ export const VIEWS: readonly { id: View
{ id: 'approvals', key: 'q', label: 'Approvals', short: 'Apv', icon: 'βœ…', blurb: 'decisions waiting for a person: votes, stealable claims, refused mods, budget', rows: 24 },
{ id: 'events', key: 'e', label: 'Events', short: 'Evt', icon: 'πŸ“‘', blurb: 'every swarm, claim, memory and mod event as it happens (f filters them)', rows: 26 },
{ id: 'missions', key: 'm', label: 'Missions', short: 'Msn', icon: '🎯', blurb: 'ADR-406 missions: the plan, task dependencies, acceptance and budget (observe only)', rows: 26 },
- { 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: 34 },
+ { 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: codex, claude or both, each a session that remembers the conversation, streamed live', rows: 32 },
// No hotkey: every digit and letter is taken. The tab, the menu prompt and /ruflo skills reach it by name.
- { id: 'skills', key: '', label: 'Skills', short: 'Skl', icon: '🧰', blurb: 'agent skills (npx skills, skills.sh): what is installed here and globally, search, add, update, remove, create', rows: 34 },
- // No hotkeys either: the menu prompt, the tab and /ruflo automate or /ruflo neural reach them by name.
+{ id: 'skills', key: '', 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 },
+ // No hotkeys either: reached by the tab, the menu prompt (secure, perf) or /ruflo secure.
+ { id: 'secure', key: '', 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: 'perf', key: '', label: 'Performance', short: 'Prf', icon: 'πŸ“ˆ', blurb: 'metrics, profile, benchmarks, bottlenecks and a latency sparkline from each run', rows: 30 },
+ { id: 'automate', key: '', label: 'Automation', short: 'Aut', icon: 'πŸ€–', blurb: 'workflows, the twelve background workers and their daemon, autopilot, sessions, config and a task kanban', rows: 44 },
+ { id: 'neural', key: '', 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 },
]
export const AGENT_VIEW = { id: 'agent' as const, rows: 28 }
@@@ -230,8 -221,8 +233,10 @@@ export type State =
}
/** The skills view: installed skills, the last search, and the change running now. */
skills: SkillsState
+ /** The Memory Lab's fields and picks (its last run is `lab.result`, under a mem- id). */
+ memoryLab: MemoryLabState
+ /** The Automation and Learning Lab views: the lists a click asked for, and this session's training runs. */
+ auto: AutoState
timers: Map<string, Timer>
stats: { renders: number[]; refreshes: number[]; frames: number[] }
}
@@@ -273,12 -263,11 +278,13 @@@ export function newState(raw: PluginOpt
outcome: 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(),
+ memoryLab: emptyMemoryLab(),
+ auto: emptyAuto(),
timers: new Map(),
stats: { renders: [], refreshes: [], frames: [] },
}
diff --cc plugins/ruflo-console/hooks/views/pane.ts
index 4a71040d8e,99a6f17c07..37fe6bc3d5
--- a/plugins/ruflo-console/hooks/views/pane.ts
+++ b/plugins/ruflo-console/hooks/views/pane.ts
@@@ -58,8 -55,8 +60,10 @@@ const BODIES: Record<ViewId, (ctx: Ctx
xruv: xruvView,
terminal: terminalView,
skills: skillsView,
+ secure: secureView,
+ perf: perfView,
+ automate: automateView,
+ neural: neuralView,
agent: agentView,
}
diff --cc plugins/ruflo-console/tests/views.test.ts
index b1483f8b28,ea315b4ee9..0d282c43d9
--- a/plugins/ruflo-console/tests/views.test.ts
+++ b/plugins/ruflo-console/tests/views.test.ts
@@@ -1,11 -1,11 +1,12 @@@
import type { TestBody } from 'claude-code/testing'
import { describe, expect, mock, test } from 'claude-code/testing'
+ import { autoAnswer, FAKE_SECRET, WF_ID } from './fixtures/automate'
import { HIVE_FILES, RAFT_ID, WORKERS } from './fixtures/hive'
+import { MEM_OUT } from './fixtures/memory'
import { MISSION_OBSERVATION } from './fixtures/missions'
import { HIVE_TOKEN, RUFLO_FILES } from './fixtures/ruflo-run'
-import { FIND_OUT, LS_GLOBAL } from './fixtures/skills'
+import { FIND_OUT, LIST_OUT, LS_GLOBAL, USE_OUT } from './fixtures/skills'
import { cliAnswer, command, elementsOf, fakeRuflo, keyOf, paneAt, PLUGIN, SESSION, textOf, worldOf } from './fixtures/world'
const HOME_FILES = {