🌊 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): drive.sh — console-drive as a repo script with --expect assertions (0.33.1)
ruv3fd850042f6f
diff --git a/plugins/ruflo-console/.claude-plugin/plugin.json b/plugins/ruflo-console/.claude-plugin/plugin.jsonindex 93f7fcaaf8..4fae1545e6 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. The one network call it makes by itself is a daily read of the published plugin.json at github.com/ruvnet/ruflo to offer an update (Settings → Updates: ask, auto, or off); it installs only through Claude Code's own claude plugin update, and never a new major version without asking.",- "version": "0.33.0",+ "version": "0.33.1","author": {"name": "ruvnet","url": "https://github.com/ruvnet"diff --git a/plugins/ruflo-console/README.md b/plugins/ruflo-console/README.mdnew file mode 100644index 0000000000..849dd241ce--- /dev/null+++ b/plugins/ruflo-console/README.md@@ -0,0 +1,28 @@+# ruflo-console++ruflo's cockpit inside Claude Code and the one `/ruflo` command for every ruflo mod. See `.claude-plugin/plugin.json` for the full description.++## Drive the console from the command line++`scripts/drive.sh` runs the console through its own model tools (`console_open`, `console_state`, `console_set`, `console_run`) from a real headless Claude, prints what each tool answered, and can assert on it, so a dev loop or CI job can check that a UI shows something.++```bash+RUFLO_E2E_LIVE=1 bash plugins/ruflo-console/scripts/drive.sh \+ --expect 'Waiting for a yes' \+ "$PWD/plugins/ruflo-console" read "Open the Room and quote back what is waiting for a yes."+```++Output is one `CALL <tool> <input>` and one `RESULT <tool> <text>` line per console call (each result cut at 4000 characters), then `COST <usd> CALLS <n>`, then one `EXPECT ok|FAIL /regex/` line per `--expect`.++| Exit | Meaning |+|------|---------|+| 0 | a console call ran and every `--expect` matched (or the run was skipped, see below) |+| 1 | no console tool call ran |+| 2 | usage error: bad level or an invalid `--expect` regex |+| 3 | at least one `--expect` regex (case-insensitive, repeatable) matched no `RESULT` |++- **What it spends:** about $0.10 per run with haiku, hard-capped at $0.40 (`--max-budget-usd`). Use one to three runs, not a sweep.+- **Why the level is capped:** the level is `read`, `write` or `manage`; `full` is rejected (exit 2). The run happens in a scratch project (`mktemp -d`), with Bash, Write and Edit disallowed, so a drive can never spend money or delete anything.+- **Seeding:** `CONSOLE_DRIVE_SEED=<dir>` copies that directory into the scratch `.claude-flow/` first, for example a `claims/claims.json` to assert the claims view shows it.+- **Skips cleanly:** without `RUFLO_E2E_LIVE=1` or a `claude` binary (on `PATH` or `$CLAUDE_BIN`) it prints `SKIP` and exits 0, so it is safe to call from CI.+- **Extra plugins:** any further arguments are added as `--plugin-dir`.diff --git a/plugins/ruflo-console/hooks/version.ts b/plugins/ruflo-console/hooks/version.tsindex a976c8418d..c282fe8640 100644--- a/plugins/ruflo-console/hooks/version.ts+++ b/plugins/ruflo-console/hooks/version.ts@@ -2,4 +2,4 @@* The console's version, shown on the header so a person can tell which build is running. Kept equal to the plugin's manifest* (`.claude-plugin/plugin.json`); tests/version.spec.ts fails if the two drift.*/-export const CONSOLE_VERSION = '0.33.0'+export const CONSOLE_VERSION = '0.33.1'diff --git a/plugins/ruflo-console/scripts/drive.sh b/plugins/ruflo-console/scripts/drive.shnew file mode 100755index 0000000000..5bbb6d9d5b--- /dev/null+++ b/plugins/ruflo-console/scripts/drive.sh@@ -0,0 +1,60 @@+#!/usr/bin/env bash+# Drive the console UI the way a person would, through its own model tools (ADR-444), from a headless Claude, and optionally assert+# what the UI answered.+#+# RUFLO_E2E_LIVE=1 bash drive.sh [--expect REGEX]... <console-plugin-dir> <read|write|manage> "<what to do>" [extra plugin dirs...]+#+# Prints one CALL / RESULT line per console tool call (results cut at 4000 chars) and a final COST line.+# Exit: 0 ok · 1 no console tool call ran · 2 usage error (bad level, bad regex) · 3 an --expect matched no RESULT.+# Without RUFLO_E2E_LIVE=1 or a claude binary it prints SKIP and exits 0, so CI can call it everywhere. ~$0.10 per run (haiku, capped $0.40).+# The level is capped at manage and the run happens in a scratch project, so a drive can never spend money or delete anything.+# CONSOLE_DRIVE_SEED=<dir> copies that directory into the scratch .claude-flow before the run (seed claims, mods, ...).+set -u+EXPECT=(); POS=()+while [[ $# -gt 0 ]]; do+ case "$1" in+ --expect) [[ $# -ge 2 ]] || { echo "--expect needs a regex"; exit 2; }; EXPECT+=("$2"); shift 2 ;;+ --expect=*) EXPECT+=("${1#--expect=}"); shift ;;+ *) POS+=("$1"); shift ;;+ esac+done+[[ ${#POS[@]} -ge 3 ]] || { echo "usage: drive.sh [--expect REGEX]... <console-plugin-dir> <read|write|manage> \"<what to do>\" [extra plugin dirs...]"; exit 2; }+PLUG="${POS[0]}"; LEVEL="${POS[1]}"; ASK="${POS[2]}"; EXTRA_DIRS=("${POS[@]:3}")+case "$LEVEL" in read|write|manage) ;; *) echo "level must be read|write|manage (full is never allowed here)"; exit 2 ;; esac+for re in "${EXPECT[@]+"${EXPECT[@]}"}"; do+ node -e 'new RegExp(process.argv[1], "i")' "$re" 2>/dev/null || { echo "bad --expect regex: $re"; exit 2; }+done+CLAUDE="${CLAUDE_BIN:-$(command -v claude || echo "$HOME/.local/bin/claude")}"+if [[ "${RUFLO_E2E_LIVE:-0}" != 1 || ! -x "$CLAUDE" ]]; then+ echo "SKIP drive: set RUFLO_E2E_LIVE=1 with a claude binary on PATH or at \$CLAUDE_BIN"+ exit 0+fi++SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/console-drive.XXXXXX")"; mkdir -p "$SCRATCH/.claude-flow"+[[ -n "${CONSOLE_DRIVE_SEED:-}" ]] && cp -r "$CONSOLE_DRIVE_SEED"/. "$SCRATCH/.claude-flow/" 2>/dev/null+TOOLS="mcp__ruflo-console__console_state,mcp__ruflo-console__console_open,mcp__ruflo-console__console_set,mcp__ruflo-console__console_run"+EXTRA=(); for d in "${EXTRA_DIRS[@]+"${EXTRA_DIRS[@]}"}"; do EXTRA+=(--plugin-dir "$d"); done+OUT="$SCRATCH/out.jsonl"+(cd "$SCRATCH" && RUFLO_CONSOLE_CONTROL="$LEVEL:auto" timeout 240 "$CLAUDE" -p "Use only the ruflo console tools (console_state, console_open, console_set, console_run). $ASK Report exactly what each tool answered." \+ --plugin-dir "$PLUG" "${EXTRA[@]+"${EXTRA[@]}"}" --allowedTools "$TOOLS" --disallowedTools Bash,Write,Edit,NotebookEdit --model haiku --max-budget-usd 0.40 \+ --output-format stream-json --verbose </dev/null >"$OUT" 2>"$SCRATCH/err.txt")+node - "$OUT" "${EXPECT[@]+"${EXPECT[@]}"}" <<'NODE'+const [file, ...expects] = process.argv.slice(2)+const lines = require('node:fs').readFileSync(file, 'utf8').split('\n').filter(Boolean).flatMap(l => { try { return [JSON.parse(l)] } catch { return [] } })+const names = new Map(); const results = []; let calls = 0+for (const m of lines) for (const b of (m.message && Array.isArray(m.message.content) ? m.message.content : [])) {+ if (b.type === 'tool_use' && b.name.startsWith('mcp__ruflo-console__')) { calls++; names.set(b.id, b.name.slice(20)); console.log(`CALL ${names.get(b.id)} ${JSON.stringify(b.input)}`) }+ if (b.type === 'tool_result' && names.has(b.tool_use_id)) {+ const text = (typeof b.content === 'string' ? b.content : JSON.stringify(b.content)).replace(/\n/g, ' ').slice(0, 4000)+ results.push(text); console.log(`RESULT ${names.get(b.tool_use_id)} ${text}`)+ }+}+const r = lines.find(m => m.type === 'result'); console.log(`COST ${r ? r.total_cost_usd : '?'} CALLS ${calls}`)+if (calls === 0) process.exit(1)+let missed = 0+for (const e of expects) {+ const hit = results.some(t => new RegExp(e, 'i').test(t)); console.log(`${hit ? 'EXPECT ok' : 'EXPECT FAIL'} /${e}/`); if (!hit) missed+++}+process.exit(missed ? 3 : 0)+NODE+rc=$?; echo "scratch: $SCRATCH"; exit $rcdiff --git a/plugins/ruflo-console/scripts/smoke.sh b/plugins/ruflo-console/scripts/smoke.shindex 3aba708173..7785935490 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.33.0"+step "1. plugin.json declares ruflo-console 0.33.1"grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \- && grep -q '"version": "0.33.0"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"+ && grep -q '"version": "0.33.1"' "$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" \@@ -89,5 +89,11 @@ if [[ -x "$ROOT/scripts/e2e-smoke.sh" ]] && bash "$ROOT/scripts/e2e-smoke.sh" 2>step "16. every view has a matrix entry and an ask entry"if [[ "$(grep -c "{ id: '[a-z]*', key: '[0-9a-z]*'" "$ROOT/hooks/state.ts")" -eq "$(grep -cE "^ [a-z]+: \{ default:" "$ROOT/hooks/ask-claude.ts" | awk '{print $1 - 1}')" ]]; then ok; else bad "VIEW_ASK does not cover VIEWS"; fi+step "17. drive.sh exists, is executable, parses, rejects level full and skips cleanly without RUFLO_E2E_LIVE"+D="$ROOT/scripts/drive.sh"+if [[ -x "$D" ]] && bash -n "$D" \+ && ! bash "$D" "$ROOT" full "x" >/dev/null 2>&1 \+ && [[ "$(env -u RUFLO_E2E_LIVE bash "$D" --expect x "$ROOT" read "x" 2>&1; echo "rc=$?")" == SKIP*rc=0 ]]; then ok; else bad "drive.sh"; fi+printf "\n%d passed, %d failed\n" "$PASS" "$FAIL"[[ $FAIL -eq 0 ]]