Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(console): console_run resolves only an exact palette id (ADR-450 T13)

ruv58ffe6aa678a
diff --git a/plugins/ruflo-console/.claude-plugin/plugin.json b/plugins/ruflo-console/.claude-plugin/plugin.json
index c5b06e10c4..793213fad7 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.13",
+ "version": "0.33.14",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
diff --git a/plugins/ruflo-console/hooks/model-tools.ts b/plugins/ruflo-console/hooks/model-tools.ts
index 061d679198..17e65904d1 100644
--- a/plugins/ruflo-console/hooks/model-tools.ts
+++ b/plugins/ruflo-console/hooks/model-tools.ts
@@ -351,7 +351,7 @@ export async function callTool(name: string, input: Record<string, unknown>, dep
const askedAt = state.outcome?.atMs ?? 0
- if (!control.runner.runById(id, text)) return refuse(`run ${id}`, `no palette entry "${plain(id, 40)}" right now. Call console_state for the entries.`)
+ if (!control.runner.runById(id, text, { exact: true })) return refuse(`run ${id}`, `no palette entry "${plain(id, 40)}" right now. Call console_state for the entries.`)
await control.runner.settled()
diff --git a/plugins/ruflo-console/hooks/runner.ts b/plugins/ruflo-console/hooks/runner.ts
index 7369bf672c..5ab374e822 100644
--- a/plugins/ruflo-console/hooks/runner.ts
+++ b/plugins/ruflo-console/hooks/runner.ts
@@ -28,7 +28,8 @@ export type Runner = {
confirm: () => Promise<void>
cancel: () => void
runEntry: (entry: PaletteEntry, text: string) => void
- runById: (id: string, text: string) => boolean
+ /** `exact` (the model path, ADR-450 T13) resolves the id as written and never falls back to fuzzy matching. */
+ runById: (id: string, text: string, options?: { exact?: boolean }) => boolean
/** Resolves when the read started last has finished: `/ruflo run` waits on it to answer with what it printed. */
settled: () => Promise<void>
/** Resolves when the last action that brought its own `run` (and is not awaited by `confirm`) has finished: the model tools wait on it, with a limit. */
@@ -201,9 +202,9 @@ export function createRunner(state: State, host: Host, deps: RunnerDeps): Runner
}
/** A palette entry by its id (`/ruflo run <id> [text]`, an approval's button): false when there is none now. */
- function runById(id: string, text: string): boolean {
+ function runById(id: string, text: string, options: { exact?: boolean } = {}): boolean {
const entries = paletteEntries(state, Date.now())
- const entry = entries.find(candidate => candidate.id === id) ?? (text === '' ? undefined : filterPalette(entries, `${id} ${text}`, 'all')[0])
+ const entry = entries.find(candidate => candidate.id === id) ?? (text === '' || options.exact === true ? undefined : filterPalette(entries, `${id} ${text}`, 'all')[0])
if (entry === undefined) return false
diff --git a/plugins/ruflo-console/hooks/version.ts b/plugins/ruflo-console/hooks/version.ts
index 4748920954..7739045d50 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.13'
+export const CONSOLE_VERSION = '0.33.14'
diff --git a/plugins/ruflo-console/scripts/smoke.sh b/plugins/ruflo-console/scripts/smoke.sh
index f5379e8158..ce757b07c7 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.13"
+step "1. plugin.json declares ruflo-console 0.33.14"
grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \
- && grep -q '"version": "0.33.13"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
+ && grep -q '"version": "0.33.14"' "$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/runbyid-exact.spec.ts b/plugins/ruflo-console/tests/runbyid-exact.spec.ts
new file mode 100644
index 0000000000..74b5483fc4
--- /dev/null
+++ b/plugins/ruflo-console/tests/runbyid-exact.spec.ts
@@ -0,0 +1,70 @@
+/** ADR-450 T13: a model-supplied id resolves only to the entry it names; the person's palette keeps its fuzzy convenience. */
+import { describe, expect, it } from 'vitest'
+
+import { callTool } from '../hooks/model-tools'
+import { paletteEntries } from '../hooks/palette'
+import { createRunner } from '../hooks/runner'
+import { newState } from '../hooks/state'
+import { settingsOf } from '../hooks/settings'
+import type { Host } from '../hooks/host'
+import type { ModelToolDeps } from '../hooks/model-tools'
+
+function real(level: 'read' | 'write' | 'manage' | 'full' = 'full') {
+ const runs: string[][] = []
+ const host = { fs: {}, run: async (argv: readonly string[]) => (runs.push([...argv]), { exitCode: 0, stdout: '{"success":true}', stderr: '', isStdoutTruncated: false, isStderrTruncated: false }), invalidate: () => undefined, after: () => ({ cancel: () => undefined, fire: () => undefined }) } as unknown as Host
+ const state = newState({})
+
+ Object.assign(settingsOf(state).ai, { modelControl: level, modelConfirm: 'ask' })
+
+ const runner = createRunner(state, host, { freshRead: async () => undefined, setView: () => undefined, drill: () => undefined, command: () => undefined })
+ const deps = { state, control: { host, setView: () => undefined, open: async () => undefined, actions: {}, runner } } as unknown as ModelToolDeps
+
+ return { state, runner, runs, deps }
+}
+
+const NEAR_MISSES = ['mem-pattern-stor', 'MEM-PATTERN-STORE', ' mem-pattern-store extra', 'mem-pattern', 'store a pattern in memory']
+
+describe('runById (ADR-450 T13)', () => {
+ it('a person-facing run keeps the fuzzy fallback when text is given', () => {
+ const { runner } = real()
+
+ expect(runner.runById('MEM-PATTERN-STORE', 'jwt refresh')).toBe(true)
+ })
+
+ it('an exact run resolves the id as written, and only that', () => {
+ const { runner, state } = real()
+ const id = paletteEntries(state, Date.now()).find(entry => entry.run.kind === 'spec')?.id ?? ''
+
+ expect(id).not.toBe('')
+ expect(runner.runById(id, '', { exact: true })).toBe(true)
+ expect(runner.runById(id.toUpperCase(), '', { exact: true })).toBe(id.toUpperCase() === id)
+ })
+
+ for (const id of NEAR_MISSES) {
+ it(`an exact run refuses the near miss "${id}" even with text`, () => {
+ const { runner, state } = real()
+
+ expect(runner.runById(id, 'jwt refresh', { exact: true })).toBe(false)
+ expect(state.pending).toBeNull()
+ })
+ }
+
+ it('console_run passes exact, so a near miss with text runs nothing and the refusal lists no entries', async () => {
+ const { deps, state, runs } = real()
+ const answer = await callTool('console_run', { id: 'mem-pattern-stor', text: 'jwt refresh' }, deps)
+
+ expect(answer).toMatch(/^Refused: .*no palette entry "mem-pattern-stor"/)
+ expect(state.pending).toBeNull()
+ expect(runs).toEqual([])
+ })
+
+ it('console_run of an exact text entry id still works and its confirm names that exact entry', async () => {
+ const { deps, state } = real()
+ const answer = await callTool('console_run', { id: 'mem-pattern-store', text: 'jwt refresh' }, deps)
+ const entry = paletteEntries(state, Date.now()).find(candidate => candidate.id === 'mem-pattern-store')
+
+ expect(entry).toBeDefined()
+ expect(answer).toMatch(/^Waiting for the person to confirm/)
+ expect(state.pending?.label).toBeTruthy()
+ })
+})
diff --git a/v3/docs/adr/ADR-450-mod-system-threat-model.md b/v3/docs/adr/ADR-450-mod-system-threat-model.md
index b1fb053820..ee3a8f0d32 100644
--- a/v3/docs/adr/ADR-450-mod-system-threat-model.md
+++ b/v3/docs/adr/ADR-450-mod-system-threat-model.md
@@ -253,7 +253,7 @@ Sections 1-8 are left as written; this section records what happened after. The
| T10 | Read the policy projection only from user scope or require a signature | Open | none |
| T11 | Per-session nonce in status files | Open | none |
| T12 | Environment override may only lower control | **Done.** `lowerOnly` in `ruflo-console/hooks/register.ts` | #3720 |
-| T13 | Exact id for model calls; fuzzy only for people | Open: `runById` still falls back to `filterPalette` (verified in `runner.ts`) | none |
+| T13 | Exact id for model calls; fuzzy only for people | **Fixed** in console 0.33.14: `console_run` passes `{ exact: true }` to `runById`, so only an id as written resolves; the person palette keeps fuzzy (only reachable with text) | tests/runbyid-exact.spec.ts |
| T14 | Confirmation prompt shows class and level before the quoted payload | Open (not verified) | none |
| T15 | Provenance tag on model-written memory; drop from recall unless promoted | Open (grep found no provenance marker in agentdb hooks) | none |
| T16 | Room as a command channel | Held at review time, no change needed | n/a |