🌊 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
feat(ruflo-console): 0.10.0 — Settings with search, AI terminal (claude default, auto-ask, always accept, scrollbar), remembered actions, NAV styles, Hive ACT menu, collapsible sections
ruvbf1b5550ed67
diff --git a/plugins/ruflo-console/.claude-plugin/plugin.json b/plugins/ruflo-console/.claude-plugin/plugin.jsonindex 082ed2faf2..4699a4bf42 100644--- a/plugins/ruflo-console/.claude-plugin/plugin.json+++ b/plugins/ruflo-console/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "ruflo-console","description": "ruflo's cockpit inside Claude Code and the one /ruflo command for every ruflo mod (function hooks, early access). Views: overview with health alerts, swarm topology graph, claims flow with TTL rings, federation map, plugin health matrix, learning curve and pipeline, MetaHarness radar and audit trend, memory, cost gauge, agent timeline, approvals queue, event stream, a main menu, an x.ruv.io federation board, an AI terminal (codex, claude or both in remembered sessions, streamed), Skills (npx skills), a Hive-Mind view, a MetaHarness lab, agent drill-down; a command palette for confirm-gated actions through the ruflo CLI; a band above the prompt. Reads ruflo's files and the CLI's local JSON; anything not measured reads n/a; no network by default.",- "version": "0.9.1",+ "version": "0.10.0","author": {"name": "ruvnet","url": "https://github.com/ruvnet"diff --git a/plugins/ruflo-console/hooks/bindings.ts b/plugins/ruflo-console/hooks/bindings.tsindex cf69c77955..b58a7337b6 100644--- a/plugins/ruflo-console/hooks/bindings.ts+++ b/plugins/ruflo-console/hooks/bindings.ts@@ -6,8 +6,11 @@ import { claimTask, handoffClaim, releaseClaim, stealClaim, whyNot } from './actimport { EVENT_KINDS } from './data/events'import { evolveActions } from './evolve'import { catalogActions } from './plugin-catalog'+import { saveAllowed } from './remember'+import { pluginNames, settingsActions } from './settings'+import { catalogOf } from './plugin-catalog'import { devtoolsActions } from './devtools'-import { HARNESSES, harnessSpec, isLive, newSession, send, whyNotRun } from './harness'+import { HARNESSES, harnessSpec, isAutoAccept, isLive, newSession, send, whyNotRun } from './harness'import { startSpec } from './starts'import { plain } from './data/parse'import type { Host } from './host'@@ -16,7 +19,7 @@ import { filterPalette, paletteEntries } from './palette'import type { Runner } from './runner'import { skillActions } from './skills'import { moreSkillActions } from './skills-lab'-import { PANE_ID, viewOf, type State } from './state'+import { CLI_PREFIXES, NAV_KEY, PANE_ID, viewOf, type State } from './state'import { vectorActions } from './vector'import type { Actions } from './views/common'import { openTasks, selection } from './views/select'@@ -57,6 +60,36 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Stepsconst actions: Actions = {view: setView,+ remember: () => {+ const key = state.pending?.rememberKey++ if (key !== undefined && state.pending !== null) {+ state.allowed.set(key, state.pending.label)+ saveAllowed(state, host)+ }++ void runner.confirm()+ },+ forget: key => {+ if (key === '') state.allowed.clear()+ else state.allowed.delete(key)+ saveAllowed(state, host)+ host.invalidate()+ },+ nav: style => {+ state.nav = style+ void host.storeSet(NAV_KEY, style).catch(() => undefined)+ host.invalidate()+ },+ clearField: key => {+ state.fieldText.set(key, '')+ host.invalidate()+ },+ toggle: key => {+ if (state.sections.has(key)) state.sections.delete(key)+ else state.sections.add(key)+ host.invalidate()+ },refresh: () => {void freshRead().then(() => probe(true))// The skills lists come from `npx skills`, not the disk read: r asks for them again on that view.@@ -202,7 +235,7 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Stepsreturn}- if (isLive(state)) {+ if (isLive(state) || isAutoAccept(state)) {const why = whyNotRun(state, text)if (why !== null) {@@ -226,10 +259,10 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Stepsreturn}- state.terminal.draft = text-const spec = harnessSpec(state, host, text)+ // The text is in the pending ask (an empty Enter or Yes runs it): the field clears, unless it cannot be sent and stays to be fixed.+ state.terminal.draft = spec !== null ? '' : textrunner.ask(spec, whyNotRun(state, text) ?? 'nothing to run')state.terminal.asked = spec !== null ? { key, label: spec.label } : null},@@ -260,13 +293,30 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Stepsstate.terminal.draft = textsetView('terminal')},+ // An ask link is the person's ask: it goes to the agent now, no Enter to confirm it. Busy or empty, it waits in the field instead.+ ask: (id, text) => {+ state.terminal.harness = id+ setView('terminal')++ if (whyNotRun(state, text) !== null) {+ state.terminal.draft = text+ host.invalidate()++ return+ }++ state.terminal.draft = ''+ send(state, host, text)+ host.invalidate()+ },},// ▸ edit hands the skill to the AI terminal, as x.ruv.io's ▸ open does: typed, not run.skills: { ...skillActions(state, host, runner, text => actions.term.load('claude', text)), ...moreSkillActions(state, host, runner, text => actions.term.load('claude', text)) },memory: memoryActions(state, runner, host.invalidate),// An rvlite query is MCP-only: it goes to the AI terminal typed, as ▸ edit does, and runs only when sent.vector: vectorActions(state, runner, text => actions.term.load('claude', text)),- evolve: evolveActions(state, host, text => actions.term.load('claude', text)),+ evolve: evolveActions(state, host, text => actions.term.ask('claude', text)),+ settings: settingsActions(state, host, runner, (agent, text) => actions.term.ask(agent, text), () => CLI_PREFIXES[state.options.cli], () => pluginNames(state, (catalogOf(state).plugins ?? []).filter(plugin => plugin.options.length > 0).map(plugin => plugin.name))),catalog: catalogActions(state, host, runner, text => actions.term.load('claude', text)),devtools: devtoolsActions(state, host, runner.runById, why => runner.ask(null, why)),}diff --git a/plugins/ruflo-console/hooks/controller.ts b/plugins/ruflo-console/hooks/controller.tsindex 65d95c2f97..a55cc916cd 100644--- a/plugins/ruflo-console/hooks/controller.ts+++ b/plugins/ruflo-console/hooks/controller.ts@@ -14,10 +14,11 @@ import { markPicture } from './gfx/pictures'import type { Host } from './host'import { agentLogs } from './ops'import { createRunner, type Runner } from './runner'-import { loadCatalog } from './plugin-catalog'-import { loadEvolve } from './evolve'+import { loadAllowed } from './remember'+import { loadAiPrefs } from './settings'+import { openLoaders } from './view-open'import { listSkills } from './skills'-import { CLI_PREFIXES, isBooting, PANE_ID, push, rowsOf, storeKeyOf, type State } from './state'+import { CLI_PREFIXES, isBooting, NAV_KEY, NAV_STYLES, PANE_ID, push, rowsOf, storeKeyOf, type State } from './state'import type { Actions } from './views/common'import { picturesOf } from './views/frames'@@ -307,6 +308,15 @@ export function createController(state: State, host: Host): Controller {function start(): void {let lastIdleMs = 0+ // The AI terminal's saved model and budget apply from the first turn, not only once Settings was opened.+ void loadAiPrefs(state, host)+ void loadAllowed(state, host)+ void host.storeGet(NAV_KEY).then(saved => {+ const style = NAV_STYLES.find(candidate => candidate === saved)++ if (style !== undefined) state.nav = style+ }, () => undefined)+every('refresh', state.options.refreshSeconds * 1000, () => {const now = Date.now()const isSeen = state.pane.isOpen || now - state.barDrawnAtMs < BAR_FRESH_MS@@ -405,10 +415,7 @@ export function createController(state: State, host: Host): Controller {void listSkills(state, host)focusField('skills-search')}- // Opening Self-Evolution reads ruflo's own flywheel files (local, no CLI run); its checks wait for a click.- if (view === 'evolve') void loadEvolve(state, host)- // The catalog is read from the marketplace clone on disk: local, so opening it is enough.- if (view === 'market') loadCatalog(state, host)+ openLoaders(state, host, view)}/**diff --git a/plugins/ruflo-console/hooks/data/plugin-catalog.ts b/plugins/ruflo-console/hooks/data/plugin-catalog.tsindex 1894fa68d9..d96c6be138 100644--- a/plugins/ruflo-console/hooks/data/plugin-catalog.ts+++ b/plugins/ruflo-console/hooks/data/plugin-catalog.ts@@ -16,6 +16,8 @@ export type CatalogPlugin = {agents: string[]commands: string[]hasMcp: boolean+ /** The plugin.json userConfig keys: the options Settings can edit. */+ options: string[]/** A `hooks/register.ts` makes it a mod: function hooks run in the engine. */isMod: boolean}@@ -62,7 +64,9 @@ async function pluginOf(fs: ReaderFs, location: string, entry: Record<string, unconst [skills, agents, commands, hasMcp, isMod] = await Promise.all([namesIn(fs, `${dir}/skills`, 'dir'), namesIn(fs, `${dir}/agents`, 'md'), namesIn(fs, `${dir}/commands`, 'md'), exists(fs, `${dir}/.mcp.json`), exists(fs, `${dir}/hooks/register.ts`)])const version = typeof manifest?.version === 'string' ? plain(manifest.version, 30) : typeof entry.version === 'string' ? plain(entry.version, 30) : null- return { name, description: plain(typeof entry.description === 'string' ? entry.description : typeof manifest?.description === 'string' ? manifest.description : '', 400), version, dir, skills, agents, commands, hasMcp, isMod }+ const options = Object.keys(recordOf(manifest?.userConfig) ?? {}).filter(key => NAME.test(key)).slice(0, 60)++ return { name, options, description: plain(typeof entry.description === 'string' ? entry.description : typeof manifest?.description === 'string' ? manifest.description : '', 400), version, dir, skills, agents, commands, hasMcp, isMod }}/** Every plugin the marketplace clone at `location` lists, or null when its manifest cannot be read. */diff --git a/plugins/ruflo-console/hooks/harness.ts b/plugins/ruflo-console/hooks/harness.tsindex ae2da2cd6a..13fc54e133 100644--- a/plugins/ruflo-console/hooks/harness.ts+++ b/plugins/ruflo-console/hooks/harness.ts@@ -21,8 +21,8 @@ const MAX_PROMPT = 8_000export type Harness = { id: HarnessId; key: string; label: string; about: string; agents: readonly AgentId[] }export const HARNESSES: readonly Harness[] = [+ { id: 'claude', key: 'l', label: 'claude', about: 'claude -p in plan mode, a per-turn budget cap (Settings), one session per project · billed to your Claude plan', agents: ['claude'] },{ id: 'codex', key: 'c', label: 'codex', about: 'codex exec, read-only sandbox, one thread per project · billed to your OpenAI plan', agents: ['codex'] },- { id: 'claude', key: 'l', label: 'claude', about: 'claude -p in plan mode, at most $1 a turn, one session per project · billed to your Claude plan', agents: ['claude'] },{ id: 'swarm', key: 'v', label: 'swarm', about: 'codex and claude together: one question to both, answering side by side in their own sessions', agents: ['codex', 'claude'] },{ id: 'ruflo', key: 'u', label: 'ruflo', about: 'one ruflo CLI command, split on spaces with no shell (swarm status, memory search -q auth) · asked each time', agents: ['ruflo'] },]@@ -40,6 +40,8 @@ function uuid(): string {}/** The argv for one agent's next turn: a new session, or the saved one resumed. */+import { settingsOf } from './settings'+export function argvOf(state: State, agent: AgentId, text: string): readonly string[] | null {const session = agent === 'ruflo' ? undefined : state.terminal.sessions[agent]@@ -49,7 +51,7 @@ export function argvOf(state: State, agent: AgentId, text: string): readonly str? ['codex', 'exec', '--json', '--sandbox', 'read-only', '--skip-git-repo-check', '-']: ['codex', 'exec', 'resume', '--json', '--skip-git-repo-check', '-c', 'sandbox_mode="read-only"', session, '-']case 'claude':- return ['claude', '-p', '--output-format', 'stream-json', '--verbose', '--include-partial-messages', '--permission-mode', 'plan', '--max-budget-usd', '1', ...(session === undefined ? [] : ['--resume', session])]+ return ['claude', '-p', '--output-format', 'stream-json', '--verbose', '--include-partial-messages', '--permission-mode', 'plan', '--max-budget-usd', String(settingsOf(state).ai.budgetUsd), ...(settingsOf(state).ai.claudeModel === 'default' ? [] : ['--model', settingsOf(state).ai.claudeModel]), ...(session === undefined ? [] : ['--resume', session])]case 'ruflo': {const words = text.split(/\s+/).filter(word => word !== '')@@ -108,6 +110,9 @@ export function whyNotRun(state: State, text: string): string | null {return null}+/** True when the person said "always accept" in Settings and the harness is an AI one (a ruflo command always asks). */+export const isAutoAccept = (state: State): boolean => settingsOf(state).ai.autoAccept && harnessOf(state.terminal.harness).id !== 'ruflo'+/** True when the text can go straight to the agents: every one of them has a session the person said yes to. */export const isLive = (state: State): boolean => {const agents = harnessOf(state.terminal.harness).agentsdiff --git a/plugins/ruflo-console/hooks/palette.ts b/plugins/ruflo-console/hooks/palette.tsindex ec5b250e5c..051b977fe6 100644--- a/plugins/ruflo-console/hooks/palette.ts+++ b/plugins/ruflo-console/hooks/palette.ts@@ -11,6 +11,7 @@ import { claimTask, handoffClaim, releaseClaim, stealClaim, type ActionSpec } frimport { MEM_KEYWORDS, MEM_LAB, memSpecOf, memWhy } from './memory-lab'import { EVOLVE, evolveSpec, evolveWhy } from './evolve'import { catalogPalette } from './plugin-catalog'+import { settingsPalette } from './settings-palette'import { devPalette } from './devtools'import { LAB, labSpec, labWhy } from './mh-lab'import { PERF } from './perf'@@ -62,7 +63,7 @@ export function fuzzy(query: string, label: string): number | null {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', 'catalog-install', 'catalog-uninstall', 'catalog-enable', 'catalog-disable', 'catalog-update', ...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']+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', 'catalog-install', 'catalog-uninstall', 'catalog-enable', 'catalog-disable', 'catalog-update', 'settings-set', 'settings-core', ...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[] {@@ -173,6 +174,7 @@ export function paletteEntries(state: State, nowMs: number): PaletteEntry[] {// Dev Tools: local reads run at once, the rest ask first; an entry with a field takes its text (see devtools.ts).out.push(...devPalette(state))out.push(...catalogPalette(state))+ out.push(...settingsPalette(state))for (const worker of WORKERS) add(`worker-${worker}`, 'workers', `dispatch the ${worker} background worker`, { kind: 'spec', spec: dispatchWorker(worker), why: 'unknown worker' })diff --git a/plugins/ruflo-console/hooks/register.ts b/plugins/ruflo-console/hooks/register.tsindex 4ff4ec8c32..16d3dd769e 100644--- a/plugins/ruflo-console/hooks/register.ts+++ b/plugins/ruflo-console/hooks/register.ts@@ -10,6 +10,7 @@ import { newState, PANE_ID, restore, restoreSessions, storeKeyOf, termStoreKeyOfimport { BAR_KEY, barView } from './views/bar'import type { Kit } from './views/common'import { picturesOf } from './views/frames'+import { withClearing } from './views/clearing'import { NARROW, paneView } from './views/pane'const RUFLO_TOOL = /^mcp__(claude-flow|ruflo|plugin_ruflo[\w-]*)__/@@ -167,7 +168,7 @@ export const register: Register = (on, raw: PluginOptions) => {state.pane.rows = Math.max(0, Math.floor(Number(e.props.scroll?.bodyRows) || 0))- const tree = paneView({ kit, state, nowMs: Date.now(), columns, pictures, act: control.actions })+ const tree = paneView({ kit: withClearing(kit, state, control.actions.clearField), state, nowMs: Date.now(), columns, pictures, act: control.actions })state.stats.renders.push(Date.now() - started)if (state.stats.renders.length > 200) state.stats.renders.shift()@@ -175,6 +176,19 @@ export const register: Register = (on, raw: PluginOptions) => {return tree})+ // The AI terminal's conversation is its own window: the wheel and the page keys over the pane move it, so the header,+ // tabs and the field below stay where they are (the engine would scroll the whole pane).+ on('ui.scroll', { component: 'Pane', requestId: PANE_ID }, ($, e, next) => {+ if (control === null || state.view !== 'terminal' || e.by === 0) return next(e)++ const lines = Math.abs(e.by) >= e.bodyRows ? Math.max(1, Math.round(e.bodyRows / 2)) : Math.abs(e.by) * 3++ control.actions.term.scroll(e.by < 0 ? lines : -lines)++ // The pane itself stays put: ask the engine for the offset it already has.+ return next({ ...e, offset: e.offset - e.by })+ })+on('ui.render', { component: 'AbovePrompt' }, ($, e, next) => {const show = state.options.bar === 'on' || (state.options.bar === 'auto' && state.snapshot?.isRufloProject === true)diff --git a/plugins/ruflo-console/hooks/remember.ts b/plugins/ruflo-console/hooks/remember.tsnew file mode 100644index 0000000000..d945e8ca97--- /dev/null+++ b/plugins/ruflo-console/hooks/remember.ts@@ -0,0 +1,48 @@+/**+ * "Always allow this kind of action": a person may tell the console not to ask again for one kind of low-risk ruflo+ * command (spawning a hive scout, say), and Settings lists and forgets each one. Only a plain ruflo CLI command can be+ * remembered: never one that reaches the network, spends money, deletes, publishes, registers, grants, restarts, changes+ * configuration or secrets, runs another program, or takes input on stdin. A kind is the ruflo command (for `mcp exec`,+ * its tool), so "spawn a scout" and "spawn a coder" are the same kind (`mcp hive-mind_spawn`).+ */+import type { ActionSpec } from './actions'+import { plain } from './data/parse'+import type { Host } from './host'+import type { State } from './state'++export const ALLOWED_KEY = 'allowed-actions'++/** A note naming any of these says the action leaves the machine, costs, or destroys: it always asks. */+const RISKY_NOTE = /network|clone|fetch|reaches|spend|money|budget|billed|cost|delete|remove|erase|purge|publish|register|secret|token|credential|overwrite|restart|writes? (your|the) (settings|config)/i++/** A command (or MCP tool) word that is destructive, public, or authority-changing. */+const RISKY_WORD = /(^|[_\s-])(delete|rm|remove|purge|reset|shutdown|terminate|stop|uninstall|destroy|revoke|publish|register|join|grant|admit|import|export|restore|rollback|deploy|promote|clear|wipe|kill|cancel|steal|handoff|invite|sign|config|federation|install|update|migrate|cleanup|mission_request_action)([_\s-]|$)/i++/** The kind of action a spec is, when it may be remembered; null when it must always ask. */+export function rememberKey(spec: ActionSpec): string | null {+ if (spec.argv !== undefined || spec.run !== undefined || spec.isReadOnly === true || spec.stdin !== undefined) return null++ const words = spec.args.join(' ')++ if (spec.args.length === 0 || RISKY_WORD.test(words) || (spec.note !== undefined && RISKY_NOTE.test(spec.note))) return null++ const tool = spec.args[0] === 'mcp' && spec.args[1] === 'exec' ? spec.args[spec.args.indexOf('-t') + 1] : undefined+ const key = tool !== undefined ? `mcp ${tool}` : spec.args.slice(0, 2).join(' ')++ return /^[A-Za-z0-9_. :-]{1,80}$/.test(key) ? key : null+}++/** Loads what was remembered: bad entries are dropped. */+export async function loadAllowed(state: State, host: Host): Promise<void> {+ const saved = await host.storeGet(ALLOWED_KEY).catch(() => undefined)++ if (!Array.isArray(saved)) return++ for (const entry of saved.slice(0, 200)) {+ if (Array.isArray(entry) && typeof entry[0] === 'string' && typeof entry[1] === 'string' && /^[A-Za-z0-9_. :-]{1,80}$/.test(entry[0])) state.allowed.set(entry[0], plain(entry[1], 120))+ }+}++export function saveAllowed(state: State, host: Host): void {+ void host.storeSet(ALLOWED_KEY, [...state.allowed.entries()]).catch(() => undefined)+}diff --git a/plugins/ruflo-console/hooks/runner.ts b/plugins/ruflo-console/hooks/runner.tsindex 64f3018475..c005cd1caf 100644--- a/plugins/ruflo-console/hooks/runner.ts+++ b/plugins/ruflo-console/hooks/runner.ts@@ -4,6 +4,7 @@* took; a read runs at once and shows what it printed. Nothing reaches `$` but through the Host.*/import type { ActionSpec } from './actions'+import { rememberKey } from './remember'import { plain } from './data/parse'import type { Host } from './host'import { labLines } from './mh-lab'@@ -119,8 +120,17 @@ export function createRunner(state: State, host: Host, deps: RunnerDeps): Runnerreturn}+ // A kind of action the person said never to ask about again runs now, its label saying so.+ const kind = rememberKey(spec)++ if (kind !== null && state.allowed.has(kind)) {+ inflight = execute({ ...spec, label: `${spec.label} (remembered: not asked)` })++ return+ }+pendingSpec = spec- state.pending = { label: spec.label, args: spec.args, expect: spec.expect, askedAtMs: Date.now(), ...(spec.shows !== undefined && { shows: spec.shows }), ...(spec.note !== undefined && { note: spec.note }) }+ state.pending = { ...(kind !== null && { rememberKey: kind }), label: spec.label, args: spec.args, expect: spec.expect, askedAtMs: Date.now(), ...(spec.shows !== undefined && { shows: spec.shows }), ...(spec.note !== undefined && { note: spec.note }) }host.invalidate()}diff --git a/plugins/ruflo-console/hooks/settings-palette.ts b/plugins/ruflo-console/hooks/settings-palette.tsnew file mode 100644index 0000000000..445ece6f8e--- /dev/null+++ b/plugins/ruflo-console/hooks/settings-palette.ts@@ -0,0 +1,43 @@+/** Palette entries for Settings, so `/ruflo run settings-set ruflo-console look plain` works headless (it still asks first). */+import { plain } from './data/parse'+import type { PaletteEntry } from './palette'+import { setCore, setOption } from './settings'+import type { State } from './state'++export function settingsPalette(state: State): PaletteEntry[] {+ const entries: PaletteEntry[] = [+ {+ id: 'settings-set',+ group: 'settings',+ label: 'settings-set <plugin> <option> <value>: set a plugin option (asks first)',+ run: {+ kind: 'text',+ keyword: 'settings-set',+ make: text => {+ const [plugin, key, ...rest] = text.trim().split(/\s+/)++ return plugin === undefined || key === undefined ? null : setOption(state, plugin, key, rest.join(' '), () => undefined)+ },+ why: text => `open Settings first so ${plain(text.split(/\s+/)[0] ?? 'the plugin', 40)}’s options are read, then name a plugin, an option and a value it accepts`,+ },+ },+ {+ id: 'settings-core',+ group: 'settings',+ label: 'settings-core <key> <value>: set a ruflo config key from the curated list (asks first)',+ run: {+ kind: 'text',+ keyword: 'settings-core',+ make: text => {+ const [key, ...rest] = text.trim().split(/\s+/)++ return key === undefined ? null : setCore(state, key, rest.join(' '), () => undefined)+ },+ why: () => 'a ruflo config key from Settings (swarm.topology, swarm.maxAgents, memory.backend, …) and a value it accepts',+ },+ },+ { id: 'settings-open', group: 'settings', label: 'open Settings', run: { kind: 'view', view: 'settings' } },+ ]++ return entries+}diff --git a/plugins/ruflo-console/hooks/settings.ts b/plugins/ruflo-console/hooks/settings.tsnew file mode 100644index 0000000000..dd48472d77--- /dev/null+++ b/plugins/ruflo-console/hooks/settings.ts@@ -0,0 +1,345 @@+/**+ * Settings, simple to advanced. Two kinds of setting, both edited in place:+ * - a plugin's options, driven by the schema `claude plugin configure <plugin> --json` prints (its type, choices, current+ * value and whether it is set), so the console, ruflo-mods and every other ruflo plugin with options share one editor;+ * a change is `claude plugin configure <plugin> --values-stdin` with the one key (values are single-line strings);+ * - ruflo's own config (`ruflo config get|set`), a curated list of keys.+ * Every change is one fixed argv on the confirm row. An option that looks like a secret is never shown or edited here.+ * ▸ ask claude / ▸ ask codex send an explaining prompt about a setting to the AI terminal at once (claude -p in plan mode, codex+ * exec read-only, the saved per-turn budget) and the reply streams in; nothing is changed by it.+ */+import type { ActionSpec } from './actions'+import { plain } from './data/parse'+import { RUFLO_MARKET } from './data/snapshot'+import type { Host } from './host'+import type { Runner } from './runner'+import type { State } from './state'++export type Level = 'simple' | 'advanced'++export type SchemaEntry = { type: string; title: string; description: string; default?: string; options?: string[]; isSecret: boolean }+export type PluginConfig = { pluginId: string; name: string; schema: Record<string, SchemaEntry>; inputs: Record<string, string>; choices: Record<string, string[]>; configured: string[] }++/** Which options a first-time person sees. Anything not listed is advanced; a plugin not listed shows its first four. */+export const SIMPLE: Record<string, readonly string[]> = {+ 'ruflo-console': ['look', 'boot', 'panel', 'fps'],+ 'ruflo-mods': ['costBudgetUsd', 'costHardStop', 'statusLine'],+}++/** ruflo's own configuration: key, how it is edited, and who sees it. */+export type CoreKey = { key: string; title: string; level: Level; kind: 'choice' | 'toggle' | 'number' | 'text'; choices?: readonly string[]; min?: number; max?: number; help: string }+export const CORE: readonly CoreKey[] = [+ { key: 'swarm.topology', title: 'Swarm topology', level: 'simple', kind: 'choice', choices: ['hierarchical', 'mesh', 'hierarchical-mesh', 'ring', 'star', 'adaptive'], help: 'how agents are wired: hierarchical keeps a queen in charge, mesh lets peers talk' },+ { key: 'swarm.maxAgents', title: 'Max agents', level: 'simple', kind: 'number', min: 1, max: 50, help: 'the most agents a swarm may hold at once' },+ { key: 'swarm.autoScale', title: 'Auto-scale', level: 'advanced', kind: 'toggle', help: 'let the swarm add and retire agents with load' },+ { key: 'swarm.coordinationStrategy', title: 'Coordination', level: 'advanced', kind: 'text', help: 'how a swarm agrees (consensus by default)' },+ { key: 'memory.backend', title: 'Memory backend', level: 'simple', kind: 'choice', choices: ['hybrid', 'sqlite', 'agentdb', 'memory'], help: 'where memory entries are stored' },+ { key: 'memory.enableHNSW', title: 'HNSW index', level: 'advanced', kind: 'toggle', help: 'approximate nearest-neighbour search for memory' },+ { key: 'memory.cacheSize', title: 'Memory cache', level: 'advanced', kind: 'number', min: 1, max: 100000, help: 'entries kept hot in memory' },+ { key: 'neural.enabled', title: 'Neural learning', level: 'advanced', kind: 'toggle', help: 'SONA/MoE pattern learning' },+ { key: 'hooks.enabled', title: 'Hooks', level: 'advanced', kind: 'toggle', help: 'ruflo hooks that learn from your edits and routes' },+ { key: 'mcp.port', title: 'MCP port', level: 'advanced', kind: 'number', min: 1, max: 65535, help: 'the port ruflo’s MCP server listens on' },+]++export const CLAUDE_MODELS = ['default', 'haiku', 'sonnet', 'opus'] as const+export const AI_BUDGETS = [0.25, 0.5, 1, 2] as const+/** `autoAccept`: claude, codex and swarm turns go straight out with no confirm (they stay read-only, in plan mode, under the budget); ruflo commands still ask. */+export type AiPrefs = { claudeModel: (typeof CLAUDE_MODELS)[number]; budgetUsd: (typeof AI_BUDGETS)[number]; autoAccept: boolean }+export const DEFAULT_AI: AiPrefs = { claudeModel: 'default', budgetUsd: 1, autoAccept: false }+export const AI_KEY = 'ai-prefs'++export type SettingsState = {+ level: Level+ /** The plugin whose options are shown (bare name). */+ plugin: string+ configs: Map<string, PluginConfig | 'error'>+ loading: Set<string>+ /** ruflo config values as `ruflo config get` last answered, by key. */+ core: Map<string, string>+ coreLoading: boolean+ ai: AiPrefs+ /** The active search (applied with Enter, shown as a chip, cleared with ✕). */+ query: string+ /** Only settings that differ from their default. */+ onlyChanged: boolean+ /** The last change or failure, with the lines to show. */+ last: { label: string; ok: boolean; detail: string } | null+}++const states = new WeakMap<State, SettingsState>()++export function settingsOf(state: State): SettingsState {+ let found = states.get(state)++ if (found === undefined) {+ found = { level: 'simple', plugin: 'ruflo-console', configs: new Map(), loading: new Set(), core: new Map(), coreLoading: false, ai: { ...DEFAULT_AI }, query: '', onlyChanged: false, last: null }+ states.set(state, found)+ }++ return found+}++const NAME = /^[A-Za-z0-9._-]{1,80}$/+const SECRET = /token|secret|password|passwd|credential|api[-_]?key|private/i++const recordOf = (value: unknown): Record<string, unknown> | null => (typeof value === 'object' && value !== null && !Array.isArray(value) ? (value as Record<string, unknown>) : null)+const flat = (value: unknown, max: number): string => (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' ? plain(String(value), max) : '')++/** `claude plugin configure <plugin> --json`, parsed: unknown shapes are dropped, never trusted. */+export function parseConfig(name: string, text: string): PluginConfig | null {+ let root: Record<string, unknown> | null = null++ try {+ root = recordOf(JSON.parse(text))+ } catch {+ return null+ }++ const schemaIn = recordOf(root?.schema)++ if (root === null || schemaIn === null) return null++ const schema: Record<string, SchemaEntry> = {}++ for (const [key, raw] of Object.entries(schemaIn).slice(0, 60)) {+ const entry = recordOf(raw)++ if (entry === null || !NAME.test(key)) continue++ const options = Array.isArray(entry.options) ? entry.options.map(option => flat(option, 60)).filter(Boolean) : undefined++ schema[key] = { type: flat(entry.type, 12) || 'string', title: flat(entry.title, 80) || key, description: flat(entry.description, 400), ...(entry.default !== undefined && { default: flat(entry.default, 80) }), ...(options !== undefined && options.length > 0 && { options }), isSecret: entry.sensitive === true || SECRET.test(key) }+ }++ const strings = (value: unknown): Record<string, string> =>+ Object.fromEntries(Object.entries(recordOf(value) ?? {}).filter(([key]) => NAME.test(key)).map(([key, v]) => [key, flat(v, 200)]))+ const choicesIn = recordOf(root.choices) ?? {}++ return {+ pluginId: flat(root.pluginId, 100) || `${name}@${RUFLO_MARKET}`,+ name,+ schema,+ inputs: strings(root.inputs),+ choices: Object.fromEntries(Object.entries(choicesIn).filter(([key]) => NAME.test(key)).map(([key, v]) => [key, Array.isArray(v) ? v.map(item => flat(item, 60)).filter(Boolean) : []])),+ configured: Array.isArray(root.configured) ? root.configured.map(item => flat(item, 60)).filter(Boolean) : [],+ }+}++/** The options this level shows for a plugin, in schema order. */+export function shownKeys(config: PluginConfig, level: Level): string[] {+ const keys = Object.keys(config.schema)++ if (level === 'advanced') return keys++ const simple = SIMPLE[config.name]++ return simple === undefined ? keys.slice(0, 4) : keys.filter(key => simple.includes(key))+}++const configureArgv = (name: string): readonly string[] => ['claude', 'plugin', 'configure', `${name}@${RUFLO_MARKET}`, '--json']++/** Reads one plugin's options (local, read-only, nothing is written). */+export async function loadPlugin(state: State, host: Host, name: string): Promise<void> {+ const settings = settingsOf(state)++ if (!NAME.test(name) || settings.loading.has(name)) return++ settings.loading.add(name)+ host.invalidate()++ try {+ const result = await host.run(configureArgv(name), 30_000)+ const parsed = result.exitCode === 0 ? parseConfig(name, result.stdout) : null++ settings.configs.set(name, parsed ?? 'error')+ } catch {+ settings.configs.set(name, 'error')+ } finally {+ settings.loading.delete(name)+ host.invalidate()+ }+}++const coreArgv = (key: string): readonly string[] => ['npx', '--offline', '-y', '@claude-flow/cli@latest', 'config', 'get', '-k', key]++/** ruflo config values, a few CLI reads at a time (each is a small local command). */+export async function loadCore(state: State, host: Host, argvPrefix: readonly string[]): Promise<void> {+ const settings = settingsOf(state)++ if (settings.coreLoading) return++ settings.coreLoading = true+ host.invalidate()++ try {+ for (let at = 0; at < CORE.length; at += 4) {+ await Promise.all(+ CORE.slice(at, at + 4).map(async entry => {+ const result = await host.run([...argvPrefix, 'config', 'get', '-k', entry.key], 30_000).catch(() => null)+ const value = result === null || result.exitCode !== 0 ? '' : (result.stdout.split('\n').map(line => line.replace(/\x1b\[[0-9;]*m/g, '').trim()).find(line => line.startsWith(`${entry.key} =`))?.slice(entry.key.length + 3) ?? '')++ settings.core.set(entry.key, plain(value, 80))+ }),+ )+ }+ } finally {+ settings.coreLoading = false+ host.invalidate()+ }+}++/** A value fit for a plugin option: single-line, bounded, and for a choice one of the choices. */+export function valueOf(config: PluginConfig, key: string, raw: string): string | null {+ const entry = config.schema[key]+ const value = raw.trim()++ if (entry === undefined || entry.isSecret || value.includes('\n') || value.length > 200) return null+ if (entry.type === 'number') return /^-?\d+(\.\d+)?$/.test(value) ? value : null++ const choices = config.choices[key]++ return choices !== undefined && choices.length > 0 ? (choices.includes(value) ? value : null) : value+}++/** One plugin option change: `claude plugin configure <plugin>@ruflo --values-stdin` with only that key. */+export function setOption(state: State, name: string, key: string, raw: string, reload: () => void): ActionSpec | null {+ const config = settingsOf(state).configs.get(name)++ if (config === undefined || config === 'error') return null++ const value = valueOf(config, key, raw)++ if (value === null) return null++ const argv = ['claude', 'plugin', 'configure', `${name}@${RUFLO_MARKET}`, '--values-stdin'] as const+ const stdin = JSON.stringify({ [key]: value })++ return {+ label: `set ${name} ${key} to ${value}`,+ args: [],+ argv,+ stdin,+ shows: `${argv.join(' ')} · stdin ${stdin}`,+ expect: `${name} ${key} = ${value}`,+ note: 'Changes this plugin’s user option only (options left out keep their values); reload plugins (/reload-plugins) or restart for it to apply.',+ onOutput: reload,+ }+}++const CORE_VALUE = /^[A-Za-z0-9._:/-]{1,60}$/++/** One ruflo config change: `ruflo config set -k <key> -v <value>`, for a key in the curated list only. */+export function setCore(state: State, key: string, raw: string, reload: () => void): ActionSpec | null {+ const entry = CORE.find(candidate => candidate.key === key)+ const value = raw.trim()++ if (entry === undefined || !CORE_VALUE.test(value)) return null+ if (entry.kind === 'toggle' && value !== 'true' && value !== 'false') return null+ if (entry.kind === 'choice' && !entry.choices?.includes(value)) return null+ if (entry.kind === 'number' && !(/^\d+$/.test(value) && Number(value) >= (entry.min ?? 0) && Number(value) <= (entry.max ?? Number.MAX_SAFE_INTEGER))) return null++ return {+ label: `set ruflo config ${key} to ${value}`,+ args: ['config', 'set', '-k', key, '-v', value],+ expect: `${key} = ${value}`,+ note: 'Writes ruflo’s configuration for this project; a running daemon or swarm may need a restart to pick it up.',+ onOutput: reload,+ }+}++/** The AI prompt about one setting, for the terminal draft: what it is, what it is now, and what to weigh. */+export function askPrompt(title: string, description: string, current: string, where: string): string {+ return `Explain the ruflo setting "${title}" (${where}): ${description} It is currently ${current === '' ? 'unset' : `"${current}"`}. What does each choice change, and what would you recommend for a developer working in this repository? Do not change anything.`+}++/** Persists and loads the AI terminal's preferences (claude model, per-turn budget); a bad stored value is the default. */+export async function loadAiPrefs(state: State, host: Host): Promise<void> {+ const stored = recordOf(await host.storeGet(AI_KEY).catch(() => undefined))+ const model = CLAUDE_MODELS.find(candidate => candidate === stored?.claudeModel)+ const budget = AI_BUDGETS.find(candidate => candidate === stored?.budgetUsd)++ settingsOf(state).ai = { claudeModel: model ?? DEFAULT_AI.claudeModel, budgetUsd: budget ?? DEFAULT_AI.budgetUsd, autoAccept: stored?.autoAccept === true }+}++export function saveAiPrefs(state: State, host: Host, patch: Partial<AiPrefs>): void {+ const settings = settingsOf(state)++ settings.ai = { ...settings.ai, ...patch }+ void host.storeSet(AI_KEY, settings.ai).catch(() => undefined)+ host.invalidate()+}++/** The ruflo plugins whose options Settings can edit: the console and ruflo-mods always, others as the catalog names them and they are installed. */+export function pluginNames(state: State, catalogNames: readonly string[]): string[] {+ const installed = new Set((state.snapshot?.plugins.installed ?? []).filter(plugin => plugin.marketplace === RUFLO_MARKET).map(plugin => plugin.name))++ return [...new Set(['ruflo-console', 'ruflo-mods', ...catalogNames.filter(name => installed.has(name))])]+}++/** Reads every named plugin's options (a few at a time), so a search can look through all of them. */+export async function loadAll(state: State, host: Host, names: readonly string[]): Promise<void> {+ const settings = settingsOf(state)+ const todo = names.filter(name => !settings.configs.has(name) && !settings.loading.has(name))++ for (let at = 0; at < todo.length; at += 4) await Promise.all(todo.slice(at, at + 4).map(name => loadPlugin(state, host, name)))+}++export type SettingsActions = {+ /** Applies a search across every plugin's options, ruflo config and the AI terminal's preferences; '' clears it. */+ search: (query: string) => void+ /** Show only settings that differ from their default. */+ changedOnly: (on: boolean) => void+ level: (level: Level) => void+ plugin: (name: string) => void+ reload: () => void+ /** Set a plugin option (a choice press, a toggle or Enter in its field): asks first. */+ option: (name: string, key: string, value: string) => void+ core: (key: string, value: string) => void+ ai: (patch: Partial<AiPrefs>) => void+ /** The confirm row's "always accept": saves the preference and runs the ask that is pending. */+ alwaysAccept: () => void+ /** Sends an explaining prompt to the AI terminal (claude or codex) now: the reply streams in, no second click. */+ ask: (agent: 'claude' | 'codex', title: string, description: string, current: string, where: string) => void+}++export function settingsActions(state: State, host: Host, runner: Runner, load: (agent: 'claude' | 'codex', text: string) => void, corePrefix: () => readonly string[], names: () => readonly string[]): SettingsActions {+ const settings = settingsOf(state)+ const reloadPlugin = () => void loadPlugin(state, host, settings.plugin)+ const reloadCore = () => void loadCore(state, host, corePrefix())++ return {+ search: query => {+ settings.query = plain(query, 80).trim()+ host.invalidate()+ if (settings.query !== '') void loadAll(state, host, names())+ },+ changedOnly: on => {+ settings.onlyChanged = on+ host.invalidate()+ },+ level: level => {+ settings.level = level+ host.invalidate()+ },+ plugin: name => {+ settings.plugin = name+ if (!settings.configs.has(name)) void loadPlugin(state, host, name)+ host.invalidate()+ },+ reload: () => {+ settings.configs.clear()+ reloadPlugin()+ reloadCore()+ },+ option: (name, key, value) => runner.ask(setOption(state, name, key, value, reloadPlugin), `“${plain(value, 40)}” is not a value ${key} accepts`),+ core: (key, value) => runner.ask(setCore(state, key, value, reloadCore), `“${plain(value, 40)}” is not a value ${key} accepts`),+ ai: patch => saveAiPrefs(state, host, patch),+ alwaysAccept: () => {+ saveAiPrefs(state, host, { autoAccept: true })+ state.terminal.asked = null+ state.terminal.draft = ''+ void runner.confirm()+ },+ ask: (agent, title, description, current, where) => load(agent, askPrompt(title, description, current, where)),+ }+}diff --git a/plugins/ruflo-console/hooks/state.ts b/plugins/ruflo-console/hooks/state.tsindex a249666879..f1a514fb81 100644--- a/plugins/ruflo-console/hooks/state.ts+++ b/plugins/ruflo-console/hooks/state.ts@@ -15,7 +15,12 @@ import type { RufloRoute, RufloSnapshot } from '../types'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' | 'automate' | 'neural' | 'vector' | 'evolve' | 'devtools' | 'market'+/** How the main nav spells its tabs: auto (names when the pane is wide), icons only, icon and a brief title, icon and the full title. */+export type NavStyle = 'auto' | 'icons' | 'brief' | 'full'+export const NAV_STYLES: readonly NavStyle[] = ['auto', 'icons', 'brief', 'full']+export const NAV_KEY = 'nav-style'++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' | 'vector' | 'evolve' | 'devtools' | 'market' | 'settings'/*** The views in tab order, each with its hotkey and the inline height it asks for. Digits are the first nine; the three@@ -44,7 +49,7 @@ export const VIEWS: readonly { id: ViewId; key: string; label: string; short: st{ 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: 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 },+ { id: 'terminal', key: 'i', label: 'Terminal', short: 'Trm', icon: '💻', blurb: 'an AI terminal: claude -p, codex or both, each a session that remembers the conversation, streamed live', rows: 120 },// 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): 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.@@ -60,6 +65,8 @@ export const VIEWS: readonly { id: ViewId; key: string; label: string; short: st{ id: 'devtools', key: '', label: 'Dev Tools', short: 'Dev', icon: '🔧', blurb: 'the integration surface: GitHub, diff analysis, agenticow, WASM, browser, terminal, providers, maintenance', rows: 40 },// Keyless too: the menu prompt, the tab, the Plugins view's ▸ catalog and /ruflo market reach it by name.{ id: 'market', key: '', label: 'Plugin Catalog', short: 'Cat', icon: '📦', blurb: 'every ruflo plugin, mod and skill: what it ships, install, enable, disable, update, view and use', rows: 50 },+ // Keyless too: the main menu, the tab and /ruflo settings reach it by name.+ { id: 'settings', key: '', label: 'Settings', short: 'Set', icon: '⚙️', blurb: 'simple to advanced settings: plugin options, ruflo config, and the AI terminal’s model and budget, each edited in place', rows: 50 },]export const AGENT_VIEW = { id: 'agent' as const, rows: 28 }@@ -130,7 +137,7 @@ export function optionsOf(raw: PluginOptions | undefined): Options {}/** A mutating action waiting for the person's second press; `shows` is the command line when it is not a ruflo one. */-export type Pending = { label: string; args: readonly string[]; expect: string; askedAtMs: number; shows?: string; note?: string }+export type Pending = { label: string; args: readonly string[]; expect: string; askedAtMs: number; shows?: string; note?: string; /** The kind of action, when it may be remembered (see remember.ts). */ rememberKey?: string }/** The MetaHarness lab's last run: what it was, how it exited, its cost note, and its output as lines to scroll. */export type LabResult = { id: string; label: string; ok: boolean; exitCode: number | null; note?: string; lines: string[]; atMs: number }@@ -201,6 +208,14 @@ export type State = {eventFilter: 'all' | ConsoleEvent['kind']/** When the newest learning point arrived: the curve draws it in from there. */curveGrewAtMs: number+ /** Kinds of action the person said never to ask about again, with a sample label (saved; Settings forgets them). */+ allowed: Map<string, string>+ /** The main nav's style, saved across sessions. */+ nav: NavStyle+ /** Collapsible sections the person flipped from their default (`<view>/<id>`): open ones closed, closed ones open. */+ sections: Set<string>+ /** What one-shot entry fields hold while typed (cleared on Enter), by field key. */+ fieldText: Map<string, string>/** The dock width asked for (RUFLO_CONSOLE_COLUMNS, 40 to 400); 0 leaves the engine's share. A request: a dragged width wins. */dockColumns: numberpane: { isOpen: boolean; isShown: boolean; isFocused: boolean; columns: number; rows: number; placement: 'dock' | 'inline'; isClosedByPerson: boolean; autoTried: boolean; autoReason: string; /** When the pane last opened: the BBS boot screen plays from here. */ bootAtMs: number }@@ -289,6 +304,10 @@ export function newState(raw: PluginOptions | undefined): State {eventFilter: 'all',curveGrewAtMs: 0,dockColumns: 0,+ nav: 'auto',+ allowed: new Map(),+ sections: new Set(),+ fieldText: new Map(),pane: { isOpen: false, isShown: false, isFocused: false, columns: 0, rows: 0, placement: 'inline', isClosedByPerson: false, autoTried: false, autoReason: '', bootAtMs: 0 },mounted: new Map(),select: { claim: 0, agent: 0, task: 0, item: 0 },@@ -301,7 +320,7 @@ export function newState(raw: PluginOptions | undefined): State {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, costReports: 0, scroll: 0, unseen: 0, asked: null },+ terminal: { harness: 'claude', 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(),diff --git a/plugins/ruflo-console/hooks/view-open.ts b/plugins/ruflo-console/hooks/view-open.tsnew file mode 100644index 0000000000..04edc73f2c--- /dev/null+++ b/plugins/ruflo-console/hooks/view-open.ts@@ -0,0 +1,25 @@+/**+ * What opening a view reads. Each view's own local, read-only loaders run when it is opened (never on a timer), so a+ * closed or hidden console reads nothing; anything that reaches the network or writes waits for a click.+ */+import { loadEvolve } from './evolve'+import type { Host } from './host'+import { loadCatalog } from './plugin-catalog'+import { loadAiPrefs, loadCore, loadPlugin, settingsOf } from './settings'+import { CLI_PREFIXES, type State } from './state'++export function openLoaders(state: State, host: Host, view: State['view']): void {+ // Self-Evolution reads ruflo's own flywheel files (local, no CLI run); its checks wait for a click.+ if (view === 'evolve') void loadEvolve(state, host)++ // The catalog is read from the marketplace clone on disk: local, so opening it is enough.+ if (view === 'market') loadCatalog(state, host)++ // Settings reads are local and read-only: the plugin's option schema, ruflo's config values, the saved AI preferences.+ if (view === 'settings') {+ void loadAiPrefs(state, host)+ loadCatalog(state, host)+ void loadPlugin(state, host, settingsOf(state).plugin)+ void loadCore(state, host, CLI_PREFIXES[state.options.cli])+ }+}diff --git a/plugins/ruflo-console/hooks/views/clearing.ts b/plugins/ruflo-console/hooks/views/clearing.tsnew file mode 100644index 0000000000..946ca869ec--- /dev/null+++ b/plugins/ruflo-console/hooks/views/clearing.ts@@ -0,0 +1,33 @@+import type { Kit } from './common'+import type { State } from '../state'++/**+ * Makes every one-shot entry field clear when Enter is pressed. A field that passes its own `value` is a form field its+ * caller owns (a memory key, a search the buttons beside it use) and is left alone; every other field is drawn from+ * `state.fieldText`, filled as the person types and emptied after its submit, so what was entered never lingers.+ */+export function withClearing(kit: Kit, state: State, clear: (key: string) => void): Kit {+ const Input = kit.Input++ if (Input === undefined) return kit++ return {+ ...kit,+ Input: props => {+ if (props.value !== undefined) return Input(props)++ return Input({+ ...props,+ value: state.fieldText.get(props.key) ?? '',+ onInput: (value, e) => {+ state.fieldText.set(props.key, value)+ props.onInput?.(value, e)+ },+ onSubmit: (value, e) => {+ props.onSubmit?.(value, e)+ clear(props.key)+ },+ })+ },+ }+}diff --git a/plugins/ruflo-console/hooks/views/common.ts b/plugins/ruflo-console/hooks/views/common.tsindex 9ad5ee2b40..d063f7691b 100644--- a/plugins/ruflo-console/hooks/views/common.ts+++ b/plugins/ruflo-console/hooks/views/common.ts@@ -8,13 +8,14 @@ import type { Elements, RenderChildren, RenderElement } from 'claude-code'import type { ProbeResult } from '../data/cli'import type { EvolveActions } from '../evolve'import type { CatalogActions } from '../plugin-catalog'+import type { SettingsActions } from '../settings'import type { DevtoolsActions } from '../devtools'import type { Grid } from '../gfx/raster'import type { MemoryActions } from '../memory-lab'import type { SkillActions } from '../skills'import { START_LABEL, type StartId } from '../starts'import type { MoreSkillActions } from '../skills-lab'-import type { HarnessId, State, ViewId } from '../state'+import type { HarnessId, NavStyle, State, ViewId } from '../state'import type { VectorActions } from '../vector'export type Kit = Pick<Elements['terminal'], 'Box' | 'Text' | 'Button'> & { Raster?: Elements['terminal']['Raster']; Input?: Elements['terminal']['Input'] }@@ -53,7 +54,7 @@ export type Actions = {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- term: { harness: (id: HarnessId) => void; draft: (text: string) => void; submit: (text: string) => void; stop: () => void; fresh: () => void; clear: () => void; load: (id: HarnessId, text: string) => void; /** Moves the window up (positive) or down by screen rows. */ scroll: (by: number) => void; /** Puts an earlier question back in the field. */ reuse: (text: string) => void }+ term: { harness: (id: HarnessId) => void; draft: (text: string) => void; submit: (text: string) => void; stop: () => void; fresh: () => void; clear: () => void; load: (id: HarnessId, text: string) => void; /** A click on an ask link: opens the terminal, picks the agent and sends the text at once (read-only, plan mode, the saved per-turn budget): the reply streams in with no second click. */ ask: (id: HarnessId, text: string) => void; /** Moves the window up (positive) or down by screen rows. */ scroll: (by: number) => void; /** Puts an earlier question back in the field. */ reuse: (text: string) => void }/** The skills view: list, search, and the confirm-gated add, remove, update and create; edit loads the terminal. */skills: SkillActions & MoreSkillActions/** The Memory Lab: its fields, search, browse filter, and an entry's open or delete (each through the runner). */@@ -66,6 +67,18 @@ export type Actions = {devtools: DevtoolsActions/** The Plugin Catalog: read the clone, filter, select a plugin, view or use an item, change a plugin (each asks first). */catalog: CatalogActions+ /** Empties an entry field after its Enter. */+ clearField: (key: string) => void+ /** The confirm row's "always allow this kind of action": remembers the kind (Settings forgets it) and runs the pending ask. */+ remember: () => void+ /** Forgets one remembered kind of action, or all of them (an empty key). */+ forget: (key: string) => void+ /** Sets how the main nav spells its tabs (saved). */+ nav: (style: NavStyle) => void+ /** Opens or closes a collapsible section (`<view>/<id>`). */+ toggle: (key: string) => void+ /** Settings: the level, a plugin, an option or ruflo config change (each asks first), AI preferences, and ▸ ask claude/codex. */+ settings: SettingsActions}export type Ctx = {@@ -135,6 +148,32 @@ export function col(ctx: Ctx, parts: readonly RenderChildren[], key?: string): Rreturn ctx.kit.Box({ flexDirection: 'column', ...(key !== undefined && { key }), children: [...parts] })}+/**+ * A collapsible section: its header is a button (▾ open, ▸ closed) and the rows follow only while it is open. `open` is the+ * section's default; pressing the header flips it for this session. The header reads as `rule` does.+ */+export function section(ctx: Ctx, id: string, title: string, right: string, children: readonly RenderElement[], isOpenByDefault = true): RenderElement[] {+ const key = `${ctx.state.view}/${id}`+ const isOpen = isOpenByDefault !== ctx.state.sections.has(key)+ const mark = isOpen ? '▾' : '▸'+ const head = look === 'bbs' ? `▓▒░ ${mark} ${title.toUpperCase()} ░▒▓` : `${mark} ${title}`+ const fill = Math.max(1, ctx.columns - head.length - right.length - 2)++ return [+ ...(look === 'bbs' ? [ctx.kit.Text({ children: ' ' })] : []),+ row(+ ctx,+ [+ ctx.kit.Button({ key: `sec-${id}`, label: head, plain: true, onPress: () => ctx.act.toggle(key) }),+ ctx.kit.Text({ color: THEME.info, dimColor: true, children: `${(look === 'bbs' ? '═' : '─').repeat(fill)} ` }),+ ctx.kit.Text({ color: THEME.info, children: right }),+ ],+ `sec-row-${id}`,+ ),+ ...(isOpen ? children : []),+ ]+}+/** A section title with a rule to the right edge. */export function rule(ctx: Ctx, title: string, right = ''): RenderElement {if (look === 'bbs') {diff --git a/plugins/ruflo-console/hooks/views/hive.ts b/plugins/ruflo-console/hooks/views/hive.tsindex 860b27bdcc..17c7977f62 100644--- a/plugins/ruflo-console/hooks/views/hive.ts+++ b/plugins/ruflo-console/hooks/views/hive.ts@@ -294,25 +294,39 @@ function broadcastSection(ctx: Ctx, hive: HiveInfo): RenderElement[] {return rows}+/**+ * The Hive-Mind's action menu, at the top of the page in its own frame: spawn a worker, a specialist or a scout, and the+ * propose and broadcast fields. Every one asks y/n first and then runs one ruflo command; voting sits with the proposals it+ * applies to. Boxed and labelled so it reads as the page's menu.+ */function actSection(ctx: Ctx, hive: HiveInfo): RenderElement[] {const block = proposeBlock(hive)- const rows: RenderElement[] = [rule(ctx, 'Act', 'each asks y/n, then runs one ruflo command')]const Input = ctx.kit.Input+ const run = (id: string) => () => void ctx.act.run(id)+ const inner: RenderElement[] = [+ row(ctx, [ctx.kit.Text({ bold: true, color: THEME.ok, children: ' ACT ' }), ctx.kit.Text({ dimColor: true, children: ' each asks y/n, then runs one ruflo command' })], 'hive-act-title'),+ row(+ ctx,+ [+ ctx.kit.Button({ key: 'hive-spawn-worker', label: ' ✚ Spawn worker (s) ', hotkey: 's', onPress: run('hive-spawn-worker'), variant: 'primary' }),+ ctx.kit.Button({ key: 'hive-spawn-specialist', label: ' ◆ Specialist ', onPress: run('hive-spawn-specialist') }),+ ctx.kit.Button({ key: 'hive-spawn-scout', label: ' ▲ Scout ', onPress: run('hive-spawn-scout') }),+ ctx.kit.Text({ dimColor: true, children: hive.pending.length > 0 ? ' vote on the proposals below ↓' : ' no proposal to vote on yet' }),+ ],+ 'hive-act-menu',+ ),+ ]if (Input === undefined) {- rows.push(text(ctx, 'propose and broadcast from the palette: p → "propose design: use raft", "broadcast hello"', { dimColor: true }))+ inner.push(text(ctx, ' propose and broadcast from the palette: p → "propose design: use raft", "broadcast hello"', { dimColor: true }))} else {- rows.push(Input({ key: 'hive-propose', label: 'propose', placeholder: block ?? 'type: the decision (design: use raft for the console)', submitLabel: 'ask', onSubmit: value => void ctx.act.run('propose', value) }))- rows.push(Input({ key: 'hive-broadcast', label: 'broadcast', placeholder: 'a message for every worker', submitLabel: 'ask', onSubmit: value => void ctx.act.run('broadcast', value) }))+ inner.push(Input({ key: 'hive-propose', label: ' ✎ propose', placeholder: block ?? 'the decision to put to the vote (design: use raft for the console)', submitLabel: 'ask', onSubmit: value => void ctx.act.run('propose', value) }))+ inner.push(Input({ key: 'hive-broadcast', label: ' ✎ broadcast', placeholder: 'a message for every worker', submitLabel: 'ask', onSubmit: value => void ctx.act.run('broadcast', value) }))}- if (block !== null) rows.push(text(ctx, `propose: n/a — ${block}`, { color: THEME.warn }))+ if (block !== null) inner.push(text(ctx, ` propose: n/a — ${block}`, { color: THEME.warn }))- if (ctx.columns >= 44) {- rows.push(row(ctx, [button(ctx, 'hive-spawn-worker', 'Spawn worker', () => void ctx.act.run('hive-spawn-worker'), { hotkey: 's' }), button(ctx, 'hive-spawn-specialist', 'specialist', () => void ctx.act.run('hive-spawn-specialist')), button(ctx, 'hive-spawn-scout', 'scout', () => void ctx.act.run('hive-spawn-scout'))]))- }-- return rows+ return [ctx.kit.Box({ key: 'hive-act', flexDirection: 'column', borderStyle: 'round', borderColor: THEME.ok, paddingX: 1, children: inner })]}/**@@ -343,6 +357,7 @@ export function hiveView(ctx: Ctx): RenderElement {ctx,[rule(ctx, 'Hive-Mind', `${hive.topology} · ${hive.strategy ?? 'consensus n/a'} · ${members.length} in the comb${byzantine > 0 ? ` · ${byzantine} byzantine` : ''}`),+ ...actSection(ctx, hive),picture(ctx, 'hive', `honeycomb needs a terminal: the queen and ${members.length} workers`),text(ctx, '♛ queen · ● worker ◆ specialist ▲ scout ○ in no store · brighter = busier · ballot dot: green for, pink against, · not yet · red walls ✖ byzantine · ✔ ✘ scars: decided · a wave runs to the queen for 2 s when a vote lands', { dimColor: true }),...(hive.pending.length > 0 ? [rule(ctx, 'Voting chambers', `${hive.pending.length} open · for fills from the left, against from the right, ┃ the quorum lines`), picture(ctx, 'hive-chambers', `${hive.pending.length} open proposal${hive.pending.length === 1 ? '' : 's'}`)] : []),@@ -353,7 +368,6 @@ export function hiveView(ctx: Ctx): RenderElement {...workersSection(ctx, hive, members),...historySection(ctx, hive),...broadcastSection(ctx, hive),- ...actSection(ctx, hive),],'hive',)diff --git a/plugins/ruflo-console/hooks/views/menu.ts b/plugins/ruflo-console/hooks/views/menu.tsindex 0a334fcc06..648cbd1b2d 100644--- a/plugins/ruflo-console/hooks/views/menu.ts+++ b/plugins/ruflo-console/hooks/views/menu.ts@@ -45,7 +45,7 @@ const GROUPS: readonly { title: string; sections: readonly { name: string; items{title: 'TOOLS',sections: [- { name: 'run', items: [{ key: 'i', label: 'AI Terminal', go: 'terminal' }, { key: 'p', label: 'Command Palette', go: 'palette' }] },+ { name: 'run', items: [{ key: 'i', label: 'AI Terminal', go: 'terminal' }, { key: '·', label: 'Settings', go: 'settings' }, { key: 'p', label: 'Command Palette', go: 'palette' }] },{ name: 'session', items: [{ key: 'h', label: 'Help', go: 'help' }, { key: 'O', label: 'Log Off', go: 'close' }] },],},diff --git a/plugins/ruflo-console/hooks/views/pane.ts b/plugins/ruflo-console/hooks/views/pane.tsindex 0673070f6e..5651f7f5b2 100644--- a/plugins/ruflo-console/hooks/views/pane.ts+++ b/plugins/ruflo-console/hooks/views/pane.ts@@ -6,7 +6,7 @@import type { RenderElement } from 'claude-code'import { HELP } from '../commands'-import { isBooting, isCompactPane, VIEWS, type ViewId } from '../state'+import { isBooting, isCompactPane, NAV_STYLES, VIEWS, type ViewId } from '../state'import { agentView } from './agent'import { automateView } from './automate'import { claimsView } from './claims'@@ -14,6 +14,7 @@ import { ago, button, clip, col, isBbs, row, setLook, text, THEME, type Ctx } frimport { costView } from './cost'import { evolveView } from './evolve'import { catalogView } from './plugin-catalog'+import { settingsView } from './settings'import { devtoolsView } from './devtools'import { federationView } from './federation'import { hiveView } from './hive'@@ -72,6 +73,7 @@ const BODIES: Record<ViewId, (ctx: Ctx) => RenderElement> = {evolve: evolveView,devtools: devtoolsView,market: catalogView,+ settings: settingsView,agent: agentView,}@@ -87,10 +89,11 @@ function tabs(ctx: Ctx): RenderElement {// current one is highlighted, and from WIDE_TABS columns every tab also spells its name. The line under the bar// always names the current view and says what it is for. The dock width is the engine's (it keeps where the// divider was left), so the narrow form must fit about 60 columns.- const withNames = ctx.columns >= WIDE_TABS+ const style = ctx.state.nav+ const withNames = style === 'auto' && ctx.columns >= WIDE_TABSconst tab = (view: (typeof VIEWS)[number]): RenderElement => {const isCurrent = view.id === ctx.state.view || (ctx.state.view === 'agent' && view.id === ctx.state.back)- const words = withNames ? `${view.icon} ${view.label}` : view.icon+ const words = style === 'icons' ? view.icon : style === 'brief' ? `${view.icon} ${view.short}` : style === 'full' || withNames ? `${view.icon} ${view.label}` : view.icon// A Button cannot be styled, so the current tab is Text: its key is not needed, the view is already open// (from a drill-down, b goes back).@@ -111,10 +114,23 @@ function tabs(ctx: Ctx): RenderElement {// The first row runs to the last digit-keyed view, so a keyless view sits where VIEWS puts it (Hive-Mind after Swarm).const split = VIEWS.reduce((last, view, i) => (/^[0-9]$/.test(view.key) ? i + 1 : last), 0)+ // A title row names the bar and offers its styles: auto, icons only, icon and brief title, icon and full title.+ const titleRow = row(+ ctx,+ [+ ctx.kit.Text({ bold: true, color: THEME.head, children: isBbs() ? '░▒▓ NAV ░▒▓ ' : 'NAV ' }),+ ctx.kit.Text({ dimColor: true, children: ' style ' }),+ ...NAV_STYLES.map(option =>+ ctx.kit.Button({ key: `nav-style-${option}`, label: ` ${option === style ? '●' : '○'} ${option} `, plain: true, ...(option === style ? { variant: 'primary' as const } : { dimColor: true }), onPress: () => ctx.act.nav(option) }),+ ),+ ],+ 'tabs-title',+ )+return ctx.kit.Box({flexDirection: 'column',key: 'tabs',- children: [line(VIEWS.slice(0, split), 'tabs-views'), line(VIEWS.slice(split), 'tabs-manage')],+ children: [titleRow, line(VIEWS.slice(0, split), 'tabs-views'), line(VIEWS.slice(split), 'tabs-manage')],})}@@ -160,7 +176,14 @@ function confirmRow(ctx: Ctx): RenderElement | null {// Wrapped, not clipped: the person says yes to the whole argv, so all of it shows (a JSON argument runs long).ctx.kit.Text({ dimColor: true, wrap: 'wrap', children: `runs: ${pending.shows ?? `ruflo ${pending.args.join(' ')}`}` }),...(pending.note !== undefined ? [text(ctx, pending.note, { bold: /money|models/i.test(pending.note), color: /money|models/i.test(pending.note) ? THEME.bad : THEME.warn })] : []),- row(ctx, [button(ctx, 'confirm', 'Yes, run it (y)', ctx.act.confirm, { hotkey: 'y', primary: true }), button(ctx, 'cancel', 'Cancel (n)', ctx.act.cancel, { hotkey: 'n' })]),+ row(ctx, [+ button(ctx, 'confirm', 'Yes, run it (y)', ctx.act.confirm, { hotkey: 'y', primary: true }),+ button(ctx, 'cancel', 'Cancel (n)', ctx.act.cancel, { hotkey: 'n' }),+ // A low-risk ruflo action may be remembered: it is not asked again (Settings lists and forgets it).+ ...(pending.rememberKey !== undefined ? [button(ctx, 'remember', `Always allow “${pending.rememberKey}”`, () => ctx.act.remember())] : []),+ // An AI terminal turn (claude -p in plan mode, codex read-only, the budget cap) may be always accepted: Settings resets it.+ ...(ctx.state.terminal.asked !== null && pending.label === ctx.state.terminal.asked.label && ctx.state.terminal.harness !== 'ruflo' ? [button(ctx, 'always', 'Always accept AI turns', () => ctx.act.settings.alwaysAccept())] : []),+ ]),],'confirm',)diff --git a/plugins/ruflo-console/hooks/views/plugin-catalog.ts b/plugins/ruflo-console/hooks/views/plugin-catalog.tsindex 3d9e1eb58d..7c6c9922ca 100644--- a/plugins/ruflo-console/hooks/views/plugin-catalog.ts+++ b/plugins/ruflo-console/hooks/views/plugin-catalog.ts@@ -2,7 +2,7 @@ import type { RenderElement } from 'claude-code'import { catalogOf, installedOf, listOf, MODES, PAGE, type Verb } from '../plugin-catalog'import type { CatalogPlugin } from '../data/plugin-catalog'-import { button, clip, col, kv, row, rule, text, THEME, type Ctx } from './common'+import { button, clip, col, kv, row, rule, section, text, THEME, type Ctx } from './common'/** The ▸ verb a row ends with: install when absent, else enable or disable. */function verbOf(ctx: Ctx, plugin: CatalogPlugin): { verb: Verb; label: string } {@@ -64,16 +64,15 @@ function detailRows(ctx: Ctx, plugin: CatalogPlugin): RenderElement[] {if (plugin.isMod) rows.push(text(ctx, ' MOD: function hooks run in the engine once this plugin is loaded (trust it like code you run)', { color: THEME.warn }))if (plugin.hasMcp) rows.push(text(ctx, ' MCP: ships an .mcp.json: its servers start with the plugin', { dimColor: true }))- const section = (title: string, kind: 'skill' | 'agent' | 'command', items: string[]) => {+ const group = (title: string, kind: 'skill' | 'agent' | 'command', items: string[]) => {if (items.length === 0) return- rows.push(rule(ctx, title, `${items.length}${items.length > 12 ? ' · first 12 shown' : ''}`))- for (const item of items.slice(0, 12)) rows.push(itemRow(ctx, kind, plugin, item))+ rows.push(...section(ctx, `${kind}s`, title, `${items.length}${items.length > 12 ? ' · first 12 shown' : ''}`, items.slice(0, 12).map(item => itemRow(ctx, kind, plugin, item))))}- section('Skills', 'skill', plugin.skills)- section('Agents', 'agent', plugin.agents)- section('Commands', 'command', plugin.commands)+ group('Skills', 'skill', plugin.skills)+ group('Agents', 'agent', plugin.agents)+ group('Commands', 'command', plugin.commands)return rows}diff --git a/plugins/ruflo-console/hooks/views/settings.ts b/plugins/ruflo-console/hooks/views/settings.tsnew file mode 100644index 0000000000..cffa796d77--- /dev/null+++ b/plugins/ruflo-console/hooks/views/settings.ts@@ -0,0 +1,318 @@+import type { RenderElement } from 'claude-code'++import { catalogOf } from '../plugin-catalog'+import { AI_BUDGETS, CLAUDE_MODELS, CORE, DEFAULT_AI, pluginNames, SIMPLE, settingsOf, type CoreKey, type Level, type PluginConfig } from '../settings'+import { NAV_STYLES } from '../state'+import { button, clip, col, row, rule, section, text, THEME, type Ctx } from './common'++/** One setting, whatever it belongs to, so a search, a level and "changed only" filter one list. */+type Item = { id: string; source: string; title: string; haystack: string; level: Level; changed: boolean; rows: () => RenderElement[] }++/** The choices of one setting as chips on the title's own row: the current one filled, every other a press that asks to set it. */+function chips(ctx: Ctx, keyPrefix: string, options: readonly string[], current: string, onPick: (value: string) => void): RenderElement[] {+ return options.map(option => ctx.kit.Button({ key: `${keyPrefix}-${option}`, label: ` ${option === current ? '●' : '○'} ${option} `, plain: true, ...(option === current && { variant: 'primary' as const }), onPress: () => onPick(option) }))+}++/** A free-text or number field: Enter asks to set it, and the field empties. */+function field(ctx: Ctx, key: string, label: string, placeholder: string, onSubmit: (value: string) => void): RenderElement {+ const Input = ctx.kit.Input++ return Input === undefined ? text(ctx, ` ${label}: set it from the palette (p): settings-set`, { dimColor: true }) : Input({ key, label: ` ✎ ${label}`, placeholder, submitLabel: 'set', onSubmit })+}++/** The two ask links: one click sends a prompt about this setting to claude -p or codex exec; the reply streams into the AI terminal. */+function asks(ctx: Ctx, key: string, title: string, description: string, current: string, where: string): RenderElement[] {+ return (['claude', 'codex'] as const).map(agent => ctx.kit.Button({ key: `st-ask-${agent}-${key}`, label: ` ✦ ${agent}`, plain: true, dimColor: true, onPress: () => ctx.act.settings.ask(agent, title, description, current, where) }))+}++type RowSpec = {+ key: string+ title: string+ description: string+ current: string+ isChanged: boolean+ isSecret?: boolean+ choices: readonly string[]+ defaultText: string+ onChoice: (value: string) => void+ fieldKey: string+ fieldLabel: string+ fieldHint: string+ where: string+}++/** A setting's two lines: its title with a changed marker and its choices inline, then what it is, dim; a field below when it takes text. */+function settingRows(ctx: Ctx, o: RowSpec): RenderElement[] {+ const rows: RenderElement[] = [+ row(+ ctx,+ [+ ctx.kit.Text({ color: o.isChanged ? THEME.ok : THEME.info, children: o.isChanged ? ' ● ' : ' · ' }),+ ctx.kit.Button({+ key: `st-name-${o.key}`,+ label: `${o.title} `.padEnd(26, '.'),+ plain: true,+ onPress: () => {+ if (o.choices.length === 0 && o.isSecret !== true) ctx.act.focus(o.fieldKey)+ },+ }),+ o.isSecret === true+ ? ctx.kit.Text({ color: THEME.warn, children: ' hidden: set it in /plugin configure' })+ : o.choices.length > 0+ ? row(ctx, chips(ctx, `st-opt-${o.key}`, o.choices, o.current, o.onChoice), `st-chips-${o.key}`)+ : ctx.kit.Text({ bold: true, color: THEME.info, children: ` ${o.current === '' ? 'n/a' : o.current}` }),+ ...(o.isSecret === true ? [] : asks(ctx, o.key, o.title, o.description, o.current, o.where)),+ ],+ `st-row-${o.key}`,+ ),+ text(ctx, ` ${clip(o.description, Math.max(20, ctx.columns - 8))}${o.defaultText === '' ? '' : ` · ${o.defaultText}`}`, { dimColor: true }),+ ]++ if (o.isSecret !== true && o.choices.length === 0) rows.push(field(ctx, o.fieldKey, o.fieldLabel, o.fieldHint, value => o.onChoice(value)))++ return rows+}++const simpleKeys = (config: PluginConfig): readonly string[] => SIMPLE[config.name] ?? Object.keys(config.schema).slice(0, 4)++function pluginItems(ctx: Ctx, config: PluginConfig): Item[] {+ return Object.entries(config.schema).map(([key, entry]) => {+ const current = config.inputs[key] ?? ''+ const choices = config.choices[key] ?? entry.options ?? []+ const isChanged = config.configured.includes(key)+ const id = `${config.name}-${key}`++ return {+ id,+ source: config.name.replace(/^ruflo-/, ''),+ title: entry.title,+ haystack: `${entry.title} ${entry.description} ${key} ${config.name} ${entry.isSecret ? '' : current}`.toLowerCase(),+ level: simpleKeys(config).includes(key) ? ('simple' as const) : ('advanced' as const),+ changed: isChanged,+ rows: () =>+ settingRows(ctx, {+ key: id,+ title: entry.title,+ description: entry.description,+ current,+ isChanged,+ isSecret: entry.isSecret,+ choices,+ defaultText: entry.default !== undefined ? `default ${entry.default}` : '',+ onChoice: value => ctx.act.settings.option(config.name, key, value),+ fieldKey: `st-in-${id}`,+ fieldLabel: key,+ fieldHint: `${entry.type === 'number' ? 'a number' : 'a value'}: Enter asks to set it`,+ where: `${config.name} option ${key}`,+ }),+ }+ })+}++function coreItems(ctx: Ctx): Item[] {+ const settings = settingsOf(ctx.state)++ return CORE.map((entry: CoreKey) => {+ const current = settings.core.get(entry.key) ?? ''+ const options = entry.kind === 'toggle' ? ['true', 'false'] : (entry.choices ?? [])++ return {+ id: `core-${entry.key}`,+ source: 'ruflo',+ title: entry.title,+ haystack: `${entry.title} ${entry.help} ${entry.key} ruflo config ${current}`.toLowerCase(),+ level: entry.level,+ changed: false,+ rows: () =>+ settingRows(ctx, {+ key: `core-${entry.key}`,+ title: entry.title,+ description: `${entry.help} (${entry.key})`,+ current,+ isChanged: false,+ choices: options,+ defaultText: '',+ onChoice: value => ctx.act.settings.core(entry.key, value),+ fieldKey: `st-core-in-${entry.key}`,+ fieldLabel: entry.key,+ fieldHint: entry.kind === 'number' ? `a number${entry.min !== undefined ? ` ${entry.min} to ${entry.max}` : ''}: Enter asks` : 'a value: Enter asks',+ where: `ruflo config ${entry.key}`,+ }),+ }+ })+}++function aiItems(ctx: Ctx): Item[] {+ const { ai } = settingsOf(ctx.state)+ const one = (id: string, title: string, description: string, current: string, options: readonly string[], isChanged: boolean, onPick: (value: string) => void, extra: string): Item => ({+ id: `ai-${id}`,+ source: 'AI',+ title,+ haystack: `${title} ${description} ai terminal claude codex ${extra} ${current}`.toLowerCase(),+ level: 'simple',+ changed: isChanged,+ rows: () => settingRows(ctx, { key: `ai-${id}`, title, description, current, isChanged, choices: options, defaultText: '', onChoice: onPick, fieldKey: `st-ai-in-${id}`, fieldLabel: id, fieldHint: '', where: `the AI terminal's ${title}` }),+ })++ return [+ one('model', 'Claude model', 'the model claude -p uses for AI terminal turns (the CLI’s default when unset)', ai.claudeModel, CLAUDE_MODELS, ai.claudeModel !== DEFAULT_AI.claudeModel, value => ctx.act.settings.ai({ claudeModel: value as (typeof CLAUDE_MODELS)[number] }), 'model haiku sonnet opus'),+ one('budget', 'Turn budget (USD)', 'claude -p --max-budget-usd: the most one turn may spend; the sandbox stays read-only', String(ai.budgetUsd), AI_BUDGETS.map(String), ai.budgetUsd !== DEFAULT_AI.budgetUsd, value => ctx.act.settings.ai({ budgetUsd: Number(value) as (typeof AI_BUDGETS)[number] }), 'cost spend cap'),+ one('accept', 'Ask before each AI turn', 'always accept sends claude, codex and swarm turns straight out (read-only, plan mode, under the budget); ruflo commands still ask', ai.autoAccept ? 'always accept' : 'ask each time', ['ask each time', 'always accept'], ai.autoAccept, value => ctx.act.settings.ai({ autoAccept: value === 'always accept' }), 'confirm accept approve'),+ ]+}++/** Interface preferences: how the main nav spells its tabs. */+function uiItems(ctx: Ctx): Item[] {+ const style = ctx.state.nav++ return [+ {+ id: 'ui-nav',+ source: 'UI',+ title: 'Navigation style',+ haystack: `navigation style nav tabs icons titles brief full auto ${style}`,+ level: 'simple',+ changed: style !== 'auto',+ rows: () =>+ settingRows(ctx, {+ key: 'ui-nav',+ title: 'Navigation style',+ description: 'how the main nav spells its tabs: auto (names when wide), icons only, icon and a brief title, icon and the full title',+ current: style,+ isChanged: style !== 'auto',+ choices: NAV_STYLES,+ defaultText: 'default auto',+ onChoice: value => ctx.act.nav(value as (typeof NAV_STYLES)[number]),+ fieldKey: 'st-ui-in-nav',+ fieldLabel: 'nav',+ fieldHint: '',+ where: 'the console’s main nav',+ }),+ },+ ]+}++/** The kinds of action remembered with "Always allow": each can be forgotten, or all at once. */+function rememberedRows(ctx: Ctx): RenderElement[] {+ const entries = [...ctx.state.allowed.entries()]++ if (entries.length === 0) return [text(ctx, ' nothing remembered: a low-risk ruflo action offers “Always allow” on its confirm row; one that reaches the network, spends, deletes or publishes never does', { dimColor: true })]++ return [+ ...entries.map(([key, label]) =>+ row(ctx, [ctx.kit.Text({ color: THEME.ok, children: ' ✓ ' }), ctx.kit.Text({ bold: true, children: `${key} ` }), ctx.kit.Text({ dimColor: true, children: clip(`e.g. ${label}`, Math.max(10, ctx.columns - key.length - 24)) }), button(ctx, `st-forget-${key}`, '✕ forget', () => ctx.act.forget(key))], `st-allowed-${key}`),+ ),+ row(ctx, [button(ctx, 'st-forget-all', 'forget all (ask every time again)', () => ctx.act.forget(''))], 'st-allowed-all'),+ ]+}++/** Where the last change landed: the confirm row asks above; this says what came of it. */+function resultRows(ctx: Ctx): RenderElement[] {+ const { outcome } = ctx.state++ if (outcome === null || ctx.nowMs - outcome.atMs > 120_000 || !/^set /.test(outcome.label)) return []++ return [text(ctx, ` ${outcome.ok ? '✓' : '✗'} ${outcome.label}`, { bold: true, color: outcome.ok ? THEME.ok : THEME.bad }), ...(outcome.detail === '' ? [] : [text(ctx, ` ${clip(outcome.detail, 200)}`, { dimColor: true })])]+}++/** The search box: a framed field that applies the search on Enter and empties itself; the active search shows as a chip you can clear. */+function searchRows(ctx: Ctx, query: string, found: number): RenderElement[] {+ const Input = ctx.kit.Input+ const rows: RenderElement[] = []++ if (Input !== undefined) {+ rows.push(+ ctx.kit.Box({+ key: 'st-search-box',+ borderStyle: 'round',+ borderColor: THEME.info,+ paddingX: 1,+ children: [Input({ key: 'st-search', label: '✎ search', placeholder: 'every setting, in every plugin: a name, an option, a word (Enter applies)', submitLabel: 'search', onSubmit: value => ctx.act.settings.search(value) })],+ }),+ )+ }++ if (query !== '') rows.push(row(ctx, [text(ctx, ` search “${clip(query, 40)}” · ${found} found `, { bold: true, color: THEME.ok }), button(ctx, 'st-search-clear', '✕ clear', () => ctx.act.settings.search(''))], 'st-search-chip'))++ return rows+}++/**+ * Settings, simple to advanced, with search. A search box finds any setting across every ruflo plugin with options, ruflo's+ * config and the AI terminal's preferences (in either level); without one, the level picks the few that matter or all.+ * Each setting is two lines (its choices inline, then what it is) with a ● when it differs from its default; ✦ claude and+ * ✦ codex send an explaining prompt to that AI at once. Every change asks first with its exact command.+ */+export function settingsView(ctx: Ctx): RenderElement {+ const { state } = ctx+ const settings = settingsOf(state)+ const names = pluginNames(state, (catalogOf(state).plugins ?? []).filter(plugin => plugin.options.length > 0).map(plugin => plugin.name))+ const words = settings.query.toLowerCase().split(/\s+/).filter(Boolean)++ const loaded = names.flatMap(name => {+ const config = settings.configs.get(name)++ return config === undefined || config === 'error' ? [] : [config]+ })+ const everything: Item[] = [...loaded.flatMap(config => pluginItems(ctx, config)), ...coreItems(ctx), ...aiItems(ctx), ...uiItems(ctx)]+ const isSearching = words.length > 0+ const pass = (item: Item) => (!settings.onlyChanged || item.changed) && (isSearching ? words.every(word => item.haystack.includes(word)) : settings.level === 'advanced' || item.level === 'simple')+ const shown = everything.filter(pass)+ const changed = everything.filter(item => item.changed).length++ const rows: RenderElement[] = [rule(ctx, 'Settings', `${shown.length} shown of ${everything.length} · ${changed} changed`)]++ rows.push(+ row(+ ctx,+ [+ ...(['simple', 'advanced'] as const).map(level => ctx.kit.Button({ key: `st-level-${level}`, label: ` ${settings.level === level ? '●' : '○'} ${level} `, plain: true, ...(settings.level === level && { variant: 'primary' as const }), onPress: () => ctx.act.settings.level(level) })),+ ctx.kit.Button({ key: 'st-changed', label: ` ${settings.onlyChanged ? '●' : '○'} changed only `, plain: true, ...(settings.onlyChanged && { variant: 'primary' as const }), onPress: () => ctx.act.settings.changedOnly(!settings.onlyChanged) }),+ button(ctx, 'st-reload', '↻ read again', () => ctx.act.settings.reload()),+ ],+ 'st-levels',+ ),+ )+ rows.push(text(ctx, settings.level === 'simple' ? ' simple shows the few that matter · search finds any setting in either level' : ' advanced shows every option of the plugin you pick', { dimColor: true }))+ rows.push(...searchRows(ctx, settings.query, shown.length))+ rows.push(...resultRows(ctx))++ if (isSearching) {+ const waiting = names.filter(name => !settings.configs.has(name)).length++ if (waiting > 0) rows.push(text(ctx, ` reading ${waiting} more plugin${waiting === 1 ? '' : 's'}…`, { dimColor: true }))+ if (shown.length === 0 && waiting === 0) rows.push(text(ctx, ' nothing matches: try one word, or clear the search', { dimColor: true }))++ let last = ''++ for (const item of shown) {+ if (item.source !== last) {+ rows.push(text(ctx, ` ── ${item.source} `, { bold: true, color: THEME.head }))+ last = item.source+ }++ rows.push(...item.rows())+ }++ return col(ctx, rows, 'settings')+ }++ // No search: the plugin you pick, ruflo's config, and the AI terminal, each a section that folds.+ const config = settings.configs.get(settings.plugin)+ const pluginRows: RenderElement[] = [+ row(ctx, names.map(name => ctx.kit.Button({ key: `st-plugin-${name}`, label: ` ${settings.plugin === name ? '●' : '○'} ${name.replace(/^ruflo-/, '')} `, plain: true, ...(settings.plugin === name && { variant: 'primary' as const }), onPress: () => ctx.act.settings.plugin(name) })), 'st-plugins'),+ ]++ if (config === undefined) pluginRows.push(text(ctx, settings.loading.has(settings.plugin) ? ' reading its options…' : ' not read yet', { dimColor: true }))+ else if (config === 'error') pluginRows.push(text(ctx, ` ${settings.plugin} has no readable options (is it installed? claude plugin configure ${settings.plugin}@ruflo --json)`, { color: THEME.warn }))+ else for (const item of shown.filter(candidate => candidate.id.startsWith(`${settings.plugin}-`))) pluginRows.push(...item.rows())++ rows.push(...section(ctx, 'options', 'Plugin options', `${names.length} ruflo plugins with options`, pluginRows))+ rows.push(...section(ctx, 'config', 'ruflo config', settings.coreLoading ? 'reading…' : 'ruflo config get / set', shown.filter(item => item.id.startsWith('core-')).flatMap(item => item.rows())))+ rows.push(...section(ctx, 'ai', 'AI terminal', 'claude -p and codex exec: saved here, applied to the next turn', [...shown.filter(item => item.id.startsWith('ai-')).flatMap(item => item.rows()), text(ctx, ' claude runs read-only in plan mode and codex in a read-only sandbox: this view never widens either.', { dimColor: true })]))++ rows.push(...section(ctx, 'ui', 'Interface', 'the main nav', shown.filter(item => item.id.startsWith('ui-')).flatMap(item => item.rows())))+ rows.push(...section(ctx, 'allowed', 'Remembered actions', `${ctx.state.allowed.size} kind${ctx.state.allowed.size === 1 ? '' : 's'} not asked again`, rememberedRows(ctx), ctx.state.allowed.size > 0))++ return col(ctx, rows, 'settings')+}diff --git a/plugins/ruflo-console/hooks/views/terminal.ts b/plugins/ruflo-console/hooks/views/terminal.tsindex 6bb803e192..03c2937714 100644--- a/plugins/ruflo-console/hooks/views/terminal.ts+++ b/plugins/ruflo-console/hooks/views/terminal.ts@@ -1,8 +1,8 @@import type { RenderElement } from 'claude-code'-import { HARNESSES, harnessOf, isLive } from '../harness'+import { HARNESSES, harnessOf, isAutoAccept, isLive } from '../harness'import type { AgentId, TermLine } from '../state'-import { button, clip, col, row, rule, text, THEME, type Ctx } from './common'+import { button, section, clip, col, row, rule, text, THEME, type Ctx } from './common'/** Screen rows of conversation when the pane's height is unknown; a known height gives the window what is left. */export const TERM_ROWS = 18@@ -101,39 +101,15 @@ export function terminalView(ctx: Ctx): RenderElement {const { state, nowMs } = ctxconst term = state.terminalconst harness = harnessOf(term.harness)- const rows: RenderElement[] = [rule(ctx, 'Harness', term.costUsd > 0 ? `$${term.costUsd.toFixed(2)} this session` : 'pick one, or /codex /claude /swarm /ruflo')]-- rows.push(- ctx.kit.Box({- flexDirection: 'row',- gap: 1,- key: 'term-pick',- children: HARNESSES.map(entry =>- entry.id === term.harness- ? ctx.kit.Box({ key: `term-${entry.id}`, children: [ctx.kit.Text({ bold: true, color: THEME.head, children: `[${entry.key}: ${entry.label.toUpperCase()}]` })] })- : ctx.kit.Button({ key: `term-${entry.id}`, label: entry.label, hotkey: entry.key, onPress: () => ctx.act.term.harness(entry.id) }),- ),- }),- )- rows.push(text(ctx, ` ${harness.about}`, { color: THEME.info }))-- const sessions = harness.agents- .filter((agent): agent is 'codex' | 'claude' => agent !== 'ruflo')- .map(agent => {- const id = term.sessions[agent]-- return `${agent}: ${id === undefined ? 'new session' : `session ${id.slice(0, 8)}… · ${term.turns[agent]} turn${term.turns[agent] === 1 ? '' : 's'} here`}${term.isLive[agent] ? ' · live' : ''}`- })-- if (sessions.length > 0) rows.push(text(ctx, ` ${sessions.join(' ')}`, { dimColor: true }))+ const rows: RenderElement[] = []// The window: the newest screen rows, or `scroll` rows up from them.- const width = Math.max(10, ctx.columns - 6)+ const width = Math.max(10, ctx.columns - 8)const screen = screenOf(term.lines, width)- // The frame around the window (banner, strips, tabs, title, picker, rules, buttons, field, hint, footer, a confirm row)- // takes about 34 rows: the window gets the rest, so the field is never pushed below the fold (the pane drops the keys- // when the focused field scrolls out of sight).- const height = state.pane.rows > 0 ? Math.max(6, Math.min(48, state.pane.rows - 34 - term.runs.size)) : TERM_ROWS+ // The frame around the window (title, strips, tabs, picker, rules, buttons, field, hint, footer, a confirm row) takes+ // about 30 rows: the conversation gets every row that is left, tall like Claude Code's own main area, so the field is+ // never pushed below the fold (the pane drops the keys when the focused field scrolls out of sight).+ const height = state.pane.rows > 0 ? Math.max(6, Math.min(400, state.pane.rows - 30 - term.runs.size)) : TERM_ROWSconst maxScroll = Math.max(0, screen.length - height)const scroll = Math.min(term.scroll, maxScroll)const start = Math.max(0, screen.length - height - scroll)@@ -143,12 +119,21 @@ export function terminalView(ctx: Ctx): RenderElement {if (shown.length === 0) rows.push(text(ctx, ' nothing yet: type below and press Enter. The first message of a session shows its command; Enter again runs it.', { dimColor: true }))+ // The scrollbar: a track down the right edge with a thumb for the window; a press on the track jumps there.+ const hasBar = screen.length > height+ const thumb = Math.max(1, Math.round((height * height) / Math.max(1, screen.length)))+ const thumbTop = maxScroll === 0 ? 0 : Math.round(((maxScroll - scroll) / maxScroll) * (height - thumb))+ const bar = (i: number): RenderElement[] =>+ hasBar+ ? [ctx.kit.Button({ key: `term-bar-${i}`, label: i >= thumbTop && i < thumbTop + thumb ? '█' : '░', plain: true, ...(i < thumbTop || i >= thumbTop + thumb ? { dimColor: true } : {}), onPress: () => ctx.act.term.scroll(Math.round((1 - (i + 0.5) / height) * maxScroll) - scroll) })]+ : []+for (const [i, entry] of shown.entries()) {const body = entry.reuse !== undefined- ? ctx.kit.Button({ key: `term-reuse-${start + i}`, label: clip(entry.text, width), plain: true, onPress: () => ctx.act.term.reuse(entry.reuse as string) })- : ctx.kit.Text({ wrap: 'truncate-end', ...entry.style, children: clip(entry.text, width) })+ ? ctx.kit.Button({ key: `term-reuse-${start + i}`, label: clip(entry.text, width).padEnd(width), plain: true, onPress: () => ctx.act.term.reuse(entry.reuse as string) })+ : ctx.kit.Text({ wrap: 'truncate-end', ...entry.style, children: clip(entry.text, width).padEnd(width) })- rows.push(row(ctx, [ctx.kit.Text({ color: entry.gutterColor, children: entry.gutter }), body], `term-row-${start + i}`))+ rows.push(row(ctx, [ctx.kit.Text({ color: entry.gutterColor, children: entry.gutter }), body, ...bar(i)], `term-row-${start + i}`))}// Live: each agent still answering, with a spinner that turns only while it writes back.@@ -168,25 +153,65 @@ export function terminalView(ctx: Ctx): RenderElement {button(ctx, 'term-clear', '⌫ Clear', ctx.act.term.clear),]),)- rows.push(rule(ctx, `Ask ${harness.label}`, isLive(state) ? 'live: Enter sends' : 'Enter shows the command, Enter again runs it'))+ rows.push(rule(ctx, `Ask ${harness.label}`, isLive(state) || isAutoAccept(state) ? (isAutoAccept(state) ? 'always accept: Enter sends (reset in Settings)' : 'live: Enter sends') : 'Enter shows the command, Enter again runs it'))if (ctx.kit.Input !== undefined) {rows.push(+ ctx.kit.Box({+ key: 'term-box',+ borderStyle: 'round',+ borderColor: THEME.info,+ paddingX: 1,+ children: [ctx.kit.Input({key: 'term-input',- label: '›',+ label: '✎',placeholder: harness.id === 'ruflo' ? 'a ruflo command: swarm status, memory search -q auth …' : isLive(state) ? `follow up with ${harness.label}…` : `ask ${harness.label} about this project…`,value: term.draft,submitLabel: isLive(state) ? 'send' : 'ask',onInput: value => ctx.act.term.draft(value),onSubmit: value => ctx.act.term.submit(value),}),+ ],+ }),)} else {rows.push(text(ctx, 'this surface has no text field: the terminal needs Claude Code in a terminal', { dimColor: true }))}- rows.push(text(ctx, ' /codex /claude /swarm /ruflo switch · /new starts over · /up /down /end scroll · click a question to ask it again', { dimColor: true }))+ rows.push(text(ctx, ' scroll the conversation with the wheel, PgUp/PgDn, the bar or ▲▼ · /claude /codex /swarm /ruflo switch · /new starts over · /up /down /end · click a question to ask it again', { dimColor: true }))++ // The harness picker is the last section: the conversation and the field come first. It folds away (▾/▸) once chosen.+ const sessions = harness.agents+ .filter((agent): agent is 'codex' | 'claude' => agent !== 'ruflo')+ .map(agent => {+ const id = term.sessions[agent]++ return `${agent}: ${id === undefined ? 'new session' : `session ${id.slice(0, 8)}… · ${term.turns[agent]} turn${term.turns[agent] === 1 ? '' : 's'} here`}${term.isLive[agent] ? ' · live' : ''}`+ })++ rows.push(+ ...section(+ ctx,+ 'harness',+ 'Harness',+ term.costUsd > 0 ? `${harness.label} · $${term.costUsd.toFixed(2)} this session` : `${harness.label} · pick one, or /codex /claude /swarm /ruflo`,+ [+ ctx.kit.Box({+ flexDirection: 'row',+ gap: 1,+ key: 'term-pick',+ children: HARNESSES.map(entry =>+ entry.id === term.harness+ ? ctx.kit.Box({ key: `term-${entry.id}`, children: [ctx.kit.Text({ bold: true, color: THEME.head, children: `[${entry.key}: ${entry.label.toUpperCase()}]` })] })+ : ctx.kit.Button({ key: `term-${entry.id}`, label: entry.label, hotkey: entry.key, onPress: () => ctx.act.term.harness(entry.id) }),+ ),+ }),+ text(ctx, ` ${harness.about}`, { color: THEME.info }),+ ...(sessions.length > 0 ? [text(ctx, ` ${sessions.join(' ')}`, { dimColor: true })] : []),+ ],+ ),+ )return col(ctx, rows, 'terminal')}diff --git a/plugins/ruflo-console/scripts/smoke.sh b/plugins/ruflo-console/scripts/smoke.shindex f5498194e2..54e9ac80c4 100755--- a/plugins/ruflo-console/scripts/smoke.sh+++ b/plugins/ruflo-console/scripts/smoke.sh@@ -11,9 +11,9 @@ step() { printf "→ %s ... " "$1"; }ok() { printf "PASS\n"; PASS=$((PASS+1)); }bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }-step "1. plugin.json declares ruflo-console 0.9.1"+step "1. plugin.json declares ruflo-console 0.10.0"grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \- && grep -q '"version": "0.9.1"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"+ && grep -q '"version": "0.10.0"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"step "2. hooks.json names exactly one module and no classic hook commands"grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \diff --git a/plugins/ruflo-console/tests/fixtures/settings.ts b/plugins/ruflo-console/tests/fixtures/settings.tsnew file mode 100644index 0000000000..c4995ed7c7--- /dev/null+++ b/plugins/ruflo-console/tests/fixtures/settings.ts@@ -0,0 +1,53 @@+import { cliAnswer, type Answer } from './world'++/** `claude plugin configure <plugin> --json` as the CLI prints it (shape captured from 2.1.287), trimmed. */+export const CONSOLE_CONFIG = JSON.stringify({+ pluginId: 'ruflo-console@ruflo',+ displayName: 'ruflo-console',+ schema: {+ cli: { type: 'string', title: 'ruflo CLI', description: 'How the console reaches ruflo.', default: 'npx-offline', options: ['npx-offline', 'npx', 'ruflo', 'claude-flow'] },+ refreshSeconds: { type: 'number', title: 'Disk refresh (seconds)', description: 'How often ruflo’s files are re-read (2 to 60).', default: 3 },+ fps: { type: 'number', title: 'Animation frames per second', description: 'Frame cap while the pane is shown (0 to 12).', default: 8 },+ panel: { type: 'string', title: 'Cockpit pane', description: 'auto opens the cockpit at session start.', default: 'auto', options: ['auto', 'command', 'off'] },+ look: { type: 'string', title: 'Look', description: 'bbs draws ANSI-BBS art; plain is text only.', default: 'bbs', options: ['bbs', 'plain'] },+ boot: { type: 'boolean', title: 'Boot screen', description: 'Play the dial-up boot screen when the cockpit opens.', default: true },+ },+ inputs: { cli: 'npx-offline', refreshSeconds: '', fps: '', panel: 'auto', look: 'bbs', boot: 'true' },+ choices: { cli: ['npx-offline', 'npx', 'ruflo', 'claude-flow'], panel: ['auto', 'command', 'off'], look: ['bbs', 'plain'], boot: ['true', 'false'] },+ configured: [],+ unconfigured: ['cli', 'refreshSeconds', 'fps', 'panel', 'look', 'boot'],+})++export const MODS_CONFIG = JSON.stringify({+ pluginId: 'ruflo-mods@ruflo',+ schema: {+ costBudgetUsd: { type: 'number', title: 'Session budget (USD)', description: 'Apply the budget ladder. 0 turns it off.', default: 0 },+ modTrustAllow: { type: 'string', title: 'Trusted mods', description: 'Plugin ids to trust.', default: '' },+ relayApiToken: { type: 'string', title: 'Relay token', description: 'A bearer token.', sensitive: true },+ },+ inputs: { costBudgetUsd: '', modTrustAllow: '', relayApiToken: 'sk-must-never-show' },+ choices: {},+ configured: ['relayApiToken'],+ unconfigured: ['costBudgetUsd', 'modTrustAllow'],+})++const CORE_VALUES: Record<string, string> = { 'swarm.topology': 'hierarchical', 'swarm.maxAgents': '15', 'memory.backend': 'hybrid' }++/** The fake CLI for Settings: plugin option schemas, ruflo config reads, and a quiet ok for the writes. */+export function settingsAnswer(argv: readonly string[]): Answer {+ const line = argv.join(' ')++ if (argv[0] === 'claude' && argv[1] === 'plugin' && argv[2] === 'configure') {+ if (argv.includes('--values-stdin')) return { exitCode: 0, stdout: 'saved', stderr: '' }++ return { exitCode: 0, stdout: argv[3]?.startsWith('ruflo-mods') ? MODS_CONFIG : argv[3]?.startsWith('ruflo-console') ? CONSOLE_CONFIG : '{}', stderr: '' }+ }++ const get = line.match(/config get -k ([a-z.]+)/)++ if (get !== null) return { exitCode: 0, stdout: `${get[1]} = ${CORE_VALUES[get[1] as string] ?? ''}\n`, stderr: '' }++ if (line.includes('config set')) return { exitCode: 0, stdout: 'ok', stderr: '' }++ return cliAnswer(argv)+}diff --git a/plugins/ruflo-console/tests/settings.test.ts b/plugins/ruflo-console/tests/settings.test.tsnew file mode 100644index 0000000000..9d3c4111ff--- /dev/null+++ b/plugins/ruflo-console/tests/settings.test.ts@@ -0,0 +1,283 @@+import type { TestBody } from 'claude-code/testing'+import { describe, expect, mock, test } from 'claude-code/testing'++import { settingsAnswer } from './fixtures/settings'+import { RUFLO_FILES } from './fixtures/ruflo-run'+import { command, elementsOf, keyOf, paneAt, PLUGIN, SESSION, textOf, worldOf } from './fixtures/world'++type Body = Parameters<TestBody>++async function opened($: Body[0], on: Body[1], view = 'settings') {+ const world = worldOf(on, RUFLO_FILES)++ world.respond = settingsAnswer+ mock.clock(on)+ await $.session.start(SESSION)+ await $.command.run(command(view))++ const pane = await $.ui.mount({ ...paneAt(150), surface: 'terminal' as const, plugin: PLUGIN })++ await pane.drawn()+ await pane.drawn()++ return { world, pane }+}++const claudeRuns = (runs: readonly string[][]) => runs.filter(argv => argv[0] === 'claude')++describe('settings', () => {+ test('opening reads the plugin’s options and ruflo config, runs no write, and simple shows only the few that matter', { options: { boot: false } }, async ($, on) => {+ const { world, pane } = await opened($, on)+ const tree = await pane.drawn()+ const text = textOf(tree)++ expect(claudeRuns(world.runs).every(argv => argv.includes('--json'))).toBe(true)+ expect(world.runs.some(argv => argv.includes('config') && argv.includes('get'))).toBe(true)+ expect(world.runs.some(argv => argv.includes('--values-stdin') || argv.includes('set'))).toBe(false)+ expect(text).toContain('simple shows the few that matter')+ expect(text).toContain('Look')+ expect(text).toContain('Boot screen')+ expect(text).not.toContain('ruflo CLI')+ expect(text).toContain('Swarm topology')+ expect(text).not.toContain('Auto-scale')+ expect(elementsOf(tree, 'Button').map(keyOf)).toEqual(expect.arrayContaining(['st-level-simple', 'st-level-advanced', 'st-plugin-ruflo-console', 'st-opt-ruflo-console-look-plain', 'st-ask-claude-ruflo-console-look', 'st-ask-codex-ruflo-console-look', 'st-changed']))+ await pane.unmount()+ })++ test('advanced adds every option and the rest of ruflo config', { options: { boot: false } }, async ($, on) => {+ const { pane } = await opened($, on)++ await pane.press({ key: 'st-level-advanced' })++ const text = textOf(await pane.drawn())++ expect(text).toContain('ruflo CLI')+ expect(text).toContain('Disk refresh')+ expect(text).toContain('Auto-scale')+ expect(text).toContain('MCP port')+ await pane.unmount()+ })++ test('a choice asks first with the exact argv and stdin, then runs once on yes', { options: { boot: false } }, async ($, on) => {+ const { world, pane } = await opened($, on)+ const writes = () => claudeRuns(world.runs).filter(argv => argv.includes('--values-stdin'))++ await pane.press({ key: 'st-opt-ruflo-console-look-plain' })++ const asked = textOf(await pane.drawn())++ expect(asked).toContain('Confirm: set ruflo-console look to plain')+ expect(asked).toContain('claude plugin configure ruflo-console@ruflo --values-stdin')+ expect(asked).toContain('{"look":"plain"}')+ expect(writes()).toEqual([])+ await $.command.run(command('yes'))+ expect(writes()).toEqual([['claude', 'plugin', 'configure', 'ruflo-console@ruflo', '--values-stdin']])+ expect(world.inputs).toContain('{"look":"plain"}')+ await pane.unmount()+ })++ test('a number field takes digits only; ruflo config keys outside the list or out of range are refused', { options: { boot: false } }, async ($, on) => {+ const { world, pane } = await opened($, on)++ await pane.press({ key: 'st-level-advanced' })+ await pane.input({ key: 'st-in-ruflo-console-fps', text: 'fast', kind: 'submit' })+ expect(textOf(await pane.drawn())).not.toContain('Confirm: set ruflo-console fps')+ await pane.input({ key: 'st-in-ruflo-console-fps', text: '12', kind: 'submit' })+ expect(textOf(await pane.drawn())).toContain('Confirm: set ruflo-console fps to 12')+ await $.command.run(command('no'))++ await pane.input({ key: 'st-core-in-swarm.maxAgents', text: '9999', kind: 'submit' })+ expect(textOf(await pane.drawn())).not.toContain('Confirm: set ruflo config swarm.maxAgents')+ await pane.input({ key: 'st-core-in-swarm.maxAgents', text: '20', kind: 'submit' })++ const asked = textOf(await pane.drawn())++ expect(asked).toContain('Confirm: set ruflo config swarm.maxAgents to 20')+ expect(asked).toContain('config set -k swarm.maxAgents -v 20')+ await $.command.run(command('yes'))+ expect(world.runs.some(argv => argv.join(' ').includes('config set -k swarm.maxAgents -v 20'))).toBe(true)+ expect((await $.command.run(command('run settings-core mcp.evil 1'))).text).toMatch(/nothing to do/)+ await pane.unmount()+ })++ test('a secret option is never shown or editable; its value does not reach the screen', { options: { boot: false } }, async ($, on) => {+ const { pane } = await opened($, on)++ await pane.press({ key: 'st-plugin-ruflo-mods' })+ await pane.press({ key: 'st-level-advanced' })++ const tree = await pane.drawn()+ const text = textOf(tree)++ expect(text).toContain('Relay token')+ expect(text).toContain('hidden: set it in /plugin configure')+ expect(text).not.toContain('sk-must-never-show')+ expect(elementsOf(tree, 'Input').map(keyOf)).not.toContain('st-in-ruflo-mods-relayApiToken')+ expect(elementsOf(tree, 'Button').map(keyOf).some(key => key.startsWith('st-ask-claude-ruflo-mods-relayApiToken'))).toBe(false)+ await pane.unmount()+ })++ test('▸ ask codex sends the explaining prompt at once: the terminal opens on it with no confirm and nothing is changed', { options: { boot: false } }, async ($, on) => {+ const { world, pane } = await opened($, on)++ await pane.press({ key: 'st-ask-codex-ruflo-console-look' })++ const text = textOf(await pane.drawn())+ const field = elementsOf(await pane.drawn(), 'Input').find(input => keyOf(input) === 'term-input') as { props?: { value?: string } } | undefined++ expect(text).toContain('Explain the ruflo setting "Look"')+ expect(text).not.toContain('Confirm:')+ expect(field?.props?.value ?? '').toBe('')+ // The ask explains; it never writes a setting.+ expect(world.runs.some(argv => argv.includes('--values-stdin') || argv.join(' ').includes('config set'))).toBe(false)+ await pane.unmount()+ })++ test('the AI terminal’s model and budget are chips; a saved model reaches the next claude command', { options: { boot: false } }, async ($, on) => {+ const { pane } = await opened($, on)++ await pane.press({ key: 'st-opt-ai-model-haiku' })+ await pane.press({ key: 'st-opt-ai-budget-0.5' })++ const text = textOf(await pane.drawn())++ expect(text).toContain('Claude model')+ expect(text).toContain('● haiku')+ expect(text).toContain('● 0.5')+ await pane.unmount()+ })++ test('"Always accept AI turns" on a claude confirm saves the choice and runs it; later turns go out with no confirm; Settings resets it; ruflo commands still ask', { options: { boot: false } }, async ($, on) => {+ const { pane } = await opened($, on, 'terminal')++ await pane.input({ key: 'term-input', text: 'what can this system do?', kind: 'submit' })++ const asked = await pane.drawn()++ expect(textOf(asked)).toContain('Confirm:')+ expect(elementsOf(asked, 'Button').map(keyOf)).toContain('always')+ await pane.press({ key: 'always' })+ expect(textOf(await pane.drawn())).not.toContain('Confirm:')++ await pane.input({ key: 'term-input', text: 'and the next one?', kind: 'submit' })++ const next = textOf(await pane.drawn())++ expect(next).not.toContain('Confirm:')+ expect(next).toContain('always accept: Enter sends')++ // ruflo commands are never auto-accepted.+ await pane.input({ key: 'term-input', text: '/ruflo', kind: 'submit' })+ await pane.input({ key: 'term-input', text: 'swarm status', kind: 'submit' })++ const ruflo = await pane.drawn()++ expect(textOf(ruflo)).toContain('Confirm:')+ expect(elementsOf(ruflo, 'Button').map(keyOf)).not.toContain('always')+ await $.command.run(command('no'))++ // Settings shows it and resets it.+ await $.command.run(command('settings'))++ const settings = await pane.drawn()++ expect(textOf(settings)).toContain('● always accept')+ await pane.press({ key: 'st-opt-ai-accept-ask each time' })+ expect(textOf(await pane.drawn())).toContain('● ask each time')+ await pane.unmount()+ })+++ test('search finds a setting across plugins and ruflo config in either level, applies on Enter, empties the box, and clears with the chip', { options: { boot: false } }, async ($, on) => {+ const { pane } = await opened($, on)++ // Simple level: the budget is an advanced option of ruflo-mods, yet a search still finds it.+ await pane.input({ key: 'st-search', text: 'budget', kind: 'submit' })+ await pane.drawn()+ await pane.drawn()++ const found = textOf(await pane.drawn())++ expect(found).toContain('search “budget”')+ expect(found).toContain('Session budget (USD)')+ expect(found).toContain('Turn budget (USD)')+ expect(found).not.toContain('Boot screen')++ const field = elementsOf(await pane.drawn(), 'Input').find(input => keyOf(input) === 'st-search') as { props?: { value?: string } } | undefined++ expect(field?.props?.value ?? '').toBe('')+ await pane.press({ key: 'st-search-clear' })+ expect(textOf(await pane.drawn())).not.toContain('search “budget”')++ await pane.input({ key: 'st-search', text: 'topology', kind: 'submit' })+ expect(textOf(await pane.drawn())).toContain('Swarm topology')+ await pane.unmount()+ })++ test('changed only keeps what differs from its default; the header counts shown, total and changed', { options: { boot: false } }, async ($, on) => {+ const { pane } = await opened($, on)++ expect(textOf(await pane.drawn())).toMatch(/\d+ shown of \d+ · \d+ changed/)+ await pane.press({ key: 'st-changed' })++ const text = textOf(await pane.drawn())++ expect(text).toContain('● changed only')+ expect(text).not.toContain('Swarm topology')+ await pane.unmount()+ })+++ test('the main nav has a title and three styles: icons only, icon and brief title, icon and full title', { options: { boot: false } }, async ($, on) => {+ const { pane } = await opened($, on, 'swarm')+ const text = async () => textOf(await pane.drawn())++ expect(await text()).toContain('NAV')+ expect(elementsOf(await pane.drawn(), 'Button').map(keyOf)).toEqual(expect.arrayContaining(['nav-style-auto', 'nav-style-icons', 'nav-style-brief', 'nav-style-full']))++ await pane.press({ key: 'nav-style-icons' })+ expect(await text()).not.toContain('Hive')++ await pane.press({ key: 'nav-style-brief' })+ expect(await text()).toContain('Hiv')+ expect(await text()).not.toContain('Hive-Mind')++ await pane.press({ key: 'nav-style-full' })+ expect(await text()).toContain('Hive-Mind')+ await pane.unmount()+ })++ test('a low-risk ruflo action offers "Always allow"; after it, that kind runs with no confirm; Settings forgets it; risky kinds never offer it', { options: { boot: false } }, async ($, on) => {+ const { world, pane } = await opened($, on, 'hive')+ const spawns = () => world.runs.filter(argv => argv.join(' ').includes('hive-mind_spawn'))++ await $.command.run(command('run hive-spawn-scout'))++ const asked = await pane.drawn()++ expect(textOf(asked)).toContain('Confirm:')+ expect(elementsOf(asked, 'Button').map(keyOf)).toContain('remember')+ expect(spawns()).toEqual([])+ await pane.press({ key: 'remember' })+ expect(spawns()).toHaveLength(1)++ // The next spawn (a different role) is the same kind: it runs without asking.+ await $.command.run(command('run hive-spawn-specialist'))+ expect(textOf(await pane.drawn())).not.toContain('Confirm:')+ expect(spawns()).toHaveLength(2)++ // Settings lists it and forgets it; the next one asks again.+ await $.command.run(command('settings'))+ expect(textOf(await pane.drawn())).toContain('mcp hive-mind_spawn')+ await pane.press({ key: 'st-forget-mcp hive-mind_spawn' })+ await $.command.run(command('run hive-spawn-scout'))+ expect(textOf(await pane.drawn())).toContain('Confirm:')+ await $.command.run(command('no'))++ // A destructive or network action is never offered it.+ await $.command.run(command('run catalog-install ruflo-core'))+ expect(elementsOf(await pane.drawn(), 'Button').map(keyOf)).not.toContain('remember')+ await pane.unmount()+ })++})diff --git a/plugins/ruflo-console/tests/sweep.test.ts b/plugins/ruflo-console/tests/sweep.test.tsindex bde9c7890b..c7672d8f7b 100644--- a/plugins/ruflo-console/tests/sweep.test.ts+++ b/plugins/ruflo-console/tests/sweep.test.ts@@ -4,10 +4,10 @@ import { RUFLO_FILES } from './fixtures/ruflo-run'import { cliAnswer, command, elementsOf, keyOf, paneAt, PLUGIN, SESSION, textOf, worldOf } from './fixtures/world'/** Every area, by the name `/ruflo <name>` takes. */-const VIEWS = ['overview', 'swarm', 'hive', 'claims', 'federation', 'plugins', 'learning', 'metaharness', 'memory', 'cost', 'timeline', 'approvals', 'events', 'missions', 'xruv', 'skills', 'secure', 'perf', 'automate', 'neural', 'vector', 'evolve', 'devtools', 'market']+const VIEWS = ['overview', 'swarm', 'hive', 'claims', 'federation', 'plugins', 'learning', 'metaharness', 'memory', 'cost', 'timeline', 'approvals', 'events', 'missions', 'xruv', 'skills', 'secure', 'perf', 'automate', 'neural', 'vector', 'evolve', 'devtools', 'market', 'settings']/** Buttons that only move the cursor inside a list that has nothing to move over in the fixture world. */-const SCROLL = /^(prev|next|up|down|older|newer|page|older-|newer-|refresh|close|task-next|approve-1|net-|sk-scope-project|evolve-reread|xr-(name|about)-|cat-load|cat-reload)/i+const SCROLL = /^(prev|next|up|down|older|newer|page|older-|newer-|refresh|close|task-next|approve-1|net-|sk-scope-project|evolve-reread|xr-(name|about)-|cat-load|cat-reload|st-name-|st-reload|st-level-|nav-style-|sec-)/idescribe('every button does something', () => {for (const view of VIEWS) {@@ -32,8 +32,9 @@ describe('every button does something', () => {try {await pane.press({ key })- } catch {- dead.push(`${key} (press threw)`)+ } catch (error) {+ // A button an earlier press removed (a reload that empties the list) is gone, not dead.+ if (!/no Button/.test(String(error))) dead.push(`${key} (press threw)`)continue}diff --git a/plugins/ruflo-console/tests/terminal.spec.ts b/plugins/ruflo-console/tests/terminal.spec.tsindex 2933dd693a..e6bb5cccdf 100644--- a/plugins/ruflo-console/tests/terminal.spec.ts+++ b/plugins/ruflo-console/tests/terminal.spec.ts@@ -78,6 +78,8 @@ describe('terminal sessions', () => {it('a new codex session reads the text from stdin; a known thread is resumed, still read-only', () => {const state = newState({})+ state.terminal.harness = 'codex'+expect(argvOf(state, 'codex', '--yolo')).toEqual(['codex', 'exec', '--json', '--sandbox', 'read-only', '--skip-git-repo-check', '-'])state.terminal.sessions.codex = '01a0fe1f-b077-7793-9612-f134bd61bc85'expect(argvOf(state, 'codex', 'next')).toEqual(['codex', 'exec', 'resume', '--json', '--skip-git-repo-check', '-c', 'sandbox_mode="read-only"', '01a0fe1f-b077-7793-9612-f134bd61bc85', '-'])@@ -88,6 +90,8 @@ describe('terminal sessions', () => {it('the first message of a session is asked; the swarm shows both commands; once live, Enter sends', async () => {const state = newState({})++ state.terminal.harness = 'codex'const { spawn, calls } = fakeSpawn({ codex: CODEX, claude: CLAUDE })const { host } = hostWith(spawn)@@ -111,6 +115,8 @@ describe('terminal sessions', () => {it('codex: the thread id is kept, commands and the answer show, and the turn closes with its tokens', async () => {const state = newState({})++ state.terminal.harness = 'codex'const { spawn } = fakeSpawn({ codex: CODEX })const { host, stored } = hostWith(spawn)@@ -127,6 +133,8 @@ describe('terminal sessions', () => {it('claude: the answer types out from deltas (not twice), tool calls show, the cost is counted', async () => {const state = newState({})++ state.terminal.harness = 'codex'const { spawn } = fakeSpawn({ claude: CLAUDE })const { host } = hostWith(spawn)@@ -142,6 +150,8 @@ describe('terminal sessions', () => {it('a busy agent refuses a second question; s stops it; /new forgets the session', async () => {const state = newState({})++ state.terminal.harness = 'codex'const { spawn } = fakeSpawn({ codex: [] }, true)const { host, stored } = hostWith(spawn)@@ -163,12 +173,16 @@ describe('terminal sessions', () => {it('saved sessions come back only as id-shaped strings', () => {const state = newState({})+ state.terminal.harness = 'codex'+restoreSessions(state, { codex: '01a0fe1f-b077-7793-9612-f134bd61bc85', claude: '--resume; rm -rf' })expect(state.terminal.sessions).toEqual({ codex: '01a0fe1f-b077-7793-9612-f134bd61bc85' })})it('the ruflo harness splits words onto the CLI prefix with no shell and is asked every time', () => {const state = newState({})++ state.terminal.harness = 'codex'const { host } = hostWith(fakeSpawn({}).spawn)state.terminal.harness = 'ruflo'diff --git a/plugins/ruflo-console/tests/views.test.ts b/plugins/ruflo-console/tests/views.test.tsindex 2f3b178492..ae7f8ca250 100644--- a/plugins/ruflo-console/tests/views.test.ts+++ b/plugins/ruflo-console/tests/views.test.ts@@ -322,9 +322,9 @@ describe('views', () => {const { text, tree } = await drawn($, 'terminal')- expect(text).toContain('[c: CODEX]')- expect(text).toContain('codex exec, read-only sandbox, one thread per project')- expect(text).toContain('codex: new session')+ expect(text).toContain('[l: CLAUDE]')+ expect(text).toContain('claude -p in plan mode, a per-turn budget cap (Settings), one session per project')+ expect(text).toContain('claude: new session')expect(elementsOf(tree, 'Input').map(keyOf)).toEqual(['term-input'])expect(world.runs.some(argv => argv[0] === 'codex' || argv[0] === 'claude')).toBe(false)})diff --git a/scripts/ci-test-baseline.txt b/scripts/ci-test-baseline.txtindex c34b77ceae..56e8337684 100644--- a/scripts/ci-test-baseline.txt+++ b/scripts/ci-test-baseline.txt@@ -164,6 +164,7 @@ plugins/ruflo-console/tests/behaviour.test.tsplugins/ruflo-console/tests/palette.test.tsplugins/ruflo-console/tests/views.test.tsplugins/ruflo-console/tests/labs.test.ts+plugins/ruflo-console/tests/settings.test.tsplugins/ruflo-console/tests/plugin-catalog.test.tsplugins/ruflo-console/tests/sweep.test.tsplugins/ruflo-console/tests/devtools.test.tsdiff --git a/v3/docs/adr/ADR-407-ruflo-console-cockpit.md b/v3/docs/adr/ADR-407-ruflo-console-cockpit.mdindex d766faa501..f3be5b8275 100644--- a/v3/docs/adr/ADR-407-ruflo-console-cockpit.md+++ b/v3/docs/adr/ADR-407-ruflo-console-cockpit.md@@ -209,6 +209,16 @@ Two layout rules came from live clicks that seemed dead: the Result panel sits aA change is one fixed `claude plugin <install|uninstall|enable|disable|update> <name>@ruflo --scope user` argv on the confirm row, with its cost in words (install and update reach GitHub). Only a name found in the catalog is ever put in an argv; `/ruflo run catalog-install <name>` (and the other four verbs) works headless and refuses anything else. Conformance checks that each verb exists and takes `--scope`. A button sweep (`tests/sweep.test.ts`) presses every button of every view and fails on one that changes nothing, except a short allowlist of cursor-only and self-link buttons.+## 11c. Settings, the AI terminal and the page chrome (0.10.0)++- **Page titles.** Every page but the main menu leads with `RUFLO ░▒▓▒░ PAGE ░▒▓` (the RUFLO letters sweep like the menu banner) and its purpose line, then the welcome and network lines with a blank row either side, then a titled **NAV** bar. The menu keeps the RUFLO banner. The nav spells its tabs as auto, icons only, icon and brief title, or icon and full title (saved; Settings > Interface).+- **Settings** (`/ruflo settings`) is driven by `claude plugin configure <plugin> --json`, so the console, ruflo-mods and every ruflo plugin with options share one editor; `ruflo config get|set` covers a curated list of ruflo keys; the AI terminal's model and per-turn budget are saved preferences. Simple shows the few that matter, advanced shows all; a search box finds any setting in either level; a ● marks a value that differs from its default. A change is `claude plugin configure <plugin>@ruflo --values-stdin` with one key (values are single-line strings) behind a confirm; an option that looks like a secret is never shown or edited.+- **AI terminal.** `claude -p` is the default. An **ask** link (Settings, Self-Evolution) sends its explaining prompt at once, so the reply streams in with no second click. **Always accept AI turns** (confirm row, reset in Settings) skips the confirm for claude, codex and swarm turns, which stay read-only, in plan mode and under the saved budget; ruflo commands still ask. The conversation is a window with a clickable scrollbar; the wheel and PgUp/PgDn move it (the `ui.scroll` hook) so the header and the field stay put.+- **Remembered actions.** A low-risk ruflo command (spawn a hive scout) offers **Always allow “<kind>”**; that kind then runs without asking. A kind is the command (for `mcp exec`, the tool). Never offered for anything that reaches the network, spends, deletes, publishes, registers, grants, restarts, changes configuration, runs another program or takes stdin (`hooks/remember.ts`). Settings lists each kind and forgets it.+- **Entry fields** clear after Enter (the field is drawn from `state.fieldText`, emptied on submit); a field that passes its own `value` is a form field its caller owns.+- **Collapsible sections** (`section()`): the header is a button (▾/▸); the AI terminal's harness picker is the last section of its page.+- Hive-Mind's ACT menu leads the page, in its own frame.+## 12. Release gatesA console change ships only when all of these hold: