🌊 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(console): wire control plane, conversation and mission autopilot into the Workflows page (ADR-465, ADR-466)
ruv116ee09a813f
diff --git a/plugins/ruflo-console/.claude-plugin/plugin.json b/plugins/ruflo-console/.claude-plugin/plugin.jsonindex 0dfe935072..b59c13a3e1 100644--- a/plugins/ruflo-console/.claude-plugin/plugin.json+++ b/plugins/ruflo-console/.claude-plugin/plugin.json@@ -24,6 +24,12 @@"timeline"],"userConfig": {+ "convoTargets": {+ "type": "string",+ "title": "Conversation targets",+ "description": "endpoint:<name>=<base-url>|<KEY_ENV>|<model>; bbs:<room>; x:<channel>. Names of environment variables, never keys. Default empty: only OpenRouter (OPENROUTER_API_KEY) is offered.",+ "default": ""+ },"cli": {"type": "string","title": "ruflo CLI",diff --git a/plugins/ruflo-console/hooks/commands.ts b/plugins/ruflo-console/hooks/commands.tsindex e77b5df495..a6f93dd922 100644--- a/plugins/ruflo-console/hooks/commands.ts+++ b/plugins/ruflo-console/hooks/commands.ts@@ -26,6 +26,7 @@ export type Intent =| { kind: 'band'; arg: string }| { kind: 'notices'; isClear: boolean }| { kind: 'quiet'; arg: string }+ | { kind: 'autopilot'; arg: string }| { kind: 'unknown'; word: string }export function parseRuflo(args: string): Intent {@@ -84,6 +85,8 @@ export function parseRuflo(args: string): Intent {return { kind: 'notices', isClear: second === 'clear' }case 'quiet':return { kind: 'quiet', arg: second }+ case 'autopilot':+ return { kind: 'autopilot', arg: second }case 'commands':case 'catalog':return { kind: 'commands', query: rest }@@ -115,6 +118,7 @@ export const HELP = [' /ruflo band [auto|on|off|compact|full|reset] show, hide or shrink the band for this session (compact = one row)',' /ruflo notices [clear] the last ten announcements (approvals, alerts, a mission finishing, a long turn ending, Anatole blocking a call)',' /ruflo quiet [minutes|off] silence the band\'s notice row for a while; notices are still recorded',+ ' /ruflo autopilot [status|pause|resume|stop] the mission autopilot (ADR-466); it never starts one: Start is on the Workflows page and asks first','','Act (each change asks to confirm; /ruflo yes or /ruflo no answers without focus)',' /ruflo palette [query] the command palette (key p): spawn, claims, swarm, votes, workers, memory',diff --git a/plugins/ruflo-console/hooks/dispatch.ts b/plugins/ruflo-console/hooks/dispatch.tsindex 2959bed431..552aacfb3f 100644--- a/plugins/ruflo-console/hooks/dispatch.ts+++ b/plugins/ruflo-console/hooks/dispatch.ts@@ -16,6 +16,8 @@ import { missionAnswer } from './mission-text'import { xruvAnswer } from './xruv'import { barText } from './views/bar'import { viewText } from './views/pane'+import { autopilotCommand } from './views/ap-panel'+import { hostOf } from './ap-live'import { bandReply, noticesReply, quietReply, median, p95 } from './notices'/** The engine's words when a registered command reaches it with no hook answering (Claude Code 2.1.287). */@@ -185,6 +187,11 @@ export async function dispatch(control: Controller, state: State, args: string,control.host.invalidate()return { text: quietReply(state, Date.now(), intent.arg) }+ case 'autopilot': {+ const apHost = hostOf(state)++ return { text: apHost === undefined ? 'autopilot is not wired into this console yet' : await autopilotCommand(state, apHost, intent.arg) }+ }case 'commands':return { text: commandsText(await loadCatalog(control), intent.query) }case 'unknown':diff --git a/plugins/ruflo-console/hooks/state.ts b/plugins/ruflo-console/hooks/state.tsindex c782268ac8..f49a3b9ed5 100644--- a/plugins/ruflo-console/hooks/state.ts+++ b/plugins/ruflo-console/hooks/state.ts@@ -1,5 +1,6 @@import type { PluginOptions, Timer } from 'claude-code'import { guardOptionsOf, type GuardOptions } from './data/wf-alerts'+import { convoOptionsOf, type ConvoOptions } from './data/wf-targets'import { emptyAuto, type AutoState } from './data/automate'import type { ProbeResult } from './data/cli'@@ -97,7 +98,7 @@ export const CLI_PREFIXES = {export type CliChoice = keyof typeof CLI_PREFIXES-export type Options = GuardOptions & {+export type Options = GuardOptions & ConvoOptions & {cli: CliChoice/** How often the disk is re-read while the pane or band shows (seconds, 2-60). */refreshSeconds: number@@ -135,6 +136,7 @@ export function optionsOf(raw: PluginOptions | undefined): Options {look: value.look === 'plain' ? 'plain' : 'bbs',boot: value.boot !== false,...guardOptionsOf(raw),+ ...convoOptionsOf(raw),}}diff --git a/plugins/ruflo-console/hooks/views/wf-register.ts b/plugins/ruflo-console/hooks/views/wf-register.tsindex 84ff69c6d4..cf75f13bde 100644--- a/plugins/ruflo-console/hooks/views/wf-register.ts+++ b/plugins/ruflo-console/hooks/views/wf-register.ts@@ -14,3 +14,6 @@ import '../wf-drill'import './wf-guide'import './wf-replay'import './wf-triage'+import './wf-control'+import './wf-convo'+import './ap-panel'diff --git a/plugins/ruflo-console/hooks/wf-wire.ts b/plugins/ruflo-console/hooks/wf-wire.tsindex f2070db29c..eee7c6ed93 100644--- a/plugins/ruflo-console/hooks/wf-wire.ts+++ b/plugins/ruflo-console/hooks/wf-wire.ts@@ -15,7 +15,10 @@ import { afterRead } from './wf-live'import { syncSavedViews } from './wf-saved-live'import { recordRunEvents } from './views/wf-guide'import { setExportCostSource, setExportFs } from './views/wf-export'+import { wireAutopilot } from './ap-live'import { wireWfAnatole } from './views/wf-anatole'+import { wireWfControl } from './views/wf-control'+import { wireWfConvo } from './views/wf-convo'import { wireWfTemplates } from './views/wf-templates'import { wireWfWorktrees } from './views/wf-worktrees'@@ -39,6 +42,9 @@ export function wireWorkflows(state: State, host: Host): void {wireWfWorktrees(state, host)wireWfTemplates(state, host)wireWfAnatole(state, host)+ wireWfControl(state, host)+ wireWfConvo(state, host, state.options.convoTargets)+ wireAutopilot(state, host, host.toolCheck === undefined ? {} : { toolCheck: (tool: string) => host.toolCheck!(tool, {}) })if (isWired) returndiff --git a/plugins/ruflo-console/scripts/smoke.sh b/plugins/ruflo-console/scripts/smoke.shindex 07a5a738d4..92037deba6 100755--- a/plugins/ruflo-console/scripts/smoke.sh+++ b/plugins/ruflo-console/scripts/smoke.sh@@ -27,15 +27,16 @@ step "4. no import reaches outside the plugin folder"deep=$(grep -rnE "from ['\"](\.\./){3,}" "$HOOKS" || true)[[ -z "$deep" ]] && ok || bad "$deep"-step "5. the module's one network call is the update check's GET (\$.http in register.ts fetchText, used by update-flow.ts alone), and \$ is touched in register.ts only"+step "5. the module's network calls are two: the update check's GET (\$.http in register.ts fetchText, used by update-flow.ts alone) and the conversation bridge's send (ADR-465: host.httpSend, used by data/wf-send.ts and wf-convo-live.ts alone, behind a confirm card), and \$ is touched in register.ts only"# Code lines only: comments may name the calls they explain.http=$(grep -rnE '\$\.http\.' "$HOOKS" | grep -vE '^[^:]+:[0-9]+:\s*(\*|//|/\*)' || true)# Exactly one is allowed (ADR-429): it goes through the engine, so an administrator's policy can refuse it, and nothing but update-flow.ts calls fetchText.-extra=$(printf '%s\n' "$http" | grep . | grep -vE '/register\.ts:[0-9]+: *const response = await \$\.http\.fetch\(url\)$' || true)+extra=$(printf '%s\n' "$http" | grep . | grep -vE '/register\.ts:[0-9]+: *const response = await \$\.http\.fetch\(url(, init)?\)$' || true)count=$(printf '%s\n' "$http" | grep -c . || true)+sends=$(grep -rlE '\bhttpSend\b' "$HOOKS" | grep -vE '/(host|register|data/wf-send|wf-convo-live)\.ts$' || true)users=$(grep -rlE '\bfetchText\b' "$HOOKS" | grep -vE '/(host|register|update-flow)\.ts$' || true)outside=$(grep -rnE '\$\.(fs|process|ui|clock|store|env|ruflo|tool|session|settings|command)\.' "$HOOKS" | grep -vE '^[^:]+:[0-9]+:\s*(\*|//|/\*)' | grep -v '/register.ts:' || true)-[[ -z "$extra" && "$count" == "1" && -z "$users" && -z "$outside" ]] && ok || bad "http: $http fetchText used by: $users outside: $outside"+[[ -z "$extra" && "$count" == "2" && -z "$users" && -z "$sends" && -z "$outside" ]] && ok || bad "http: $http fetchText used by: $users httpSend used by: $sends outside: $outside"step "6. never runs plugins list or verify (network); roster, registry, claims and sync are the network probes, all behind the federationNetwork option"cmds=$(grep -nE "args: \['(plugins|verify)'" "$HOOKS/data/cli.ts" || true)diff --git a/plugins/ruflo-console/tests/ap-adapt.spec.ts b/plugins/ruflo-console/tests/ap-adapt.spec.tsnew file mode 100644index 0000000000..85e37f5ec4--- /dev/null+++ b/plugins/ruflo-console/tests/ap-adapt.spec.ts@@ -0,0 +1,150 @@+/**+ * The autopilot's adaptation gate and guards (ADR-466), split from ap-core.spec.ts for the 500-line limit. Pure and fast. Run with+ * npx vitest run plugins/ruflo-console/tests/ap-adapt.spec.ts --testTimeout=30000+ */+import { describe, expect, it } from 'vitest'++import { applyChange, clampToEnvelope, DEFAULTS, evaluate, lastHash, outcomesOf, promote, propose, reviewTrials, tunablesFrom, verifyReceipts, type Tunables } from '../hooks/data/ap-adapt'+import { canonical, hashOf, HARD_DENIES, open, pathAllowed, seal, sha256, validateEnvelope, widened, type Envelope } from '../hooks/data/ap-envelope'+import { anatoleFact, classifyTask, effectOf, preflightAll } from '../hooks/data/ap-guard'+import { appendArgv, encodeLine, parseJournal, parseLine, type JournalEvent } from '../hooks/data/ap-journal'+import { bandText, emptyLoop, FAILURE_BUDGET, foldJournal, skipSet, snapshotEvents, stepId, summarize, tick, type Facts, type LoopState, type TaskFact } from '../hooks/data/ap-loop'++const T0 = Date.parse('2026-10-06T00:00:00.000Z')+const H = 3_600_000++const ENV: Envelope = { name: 'night shift', toolClasses: ['edit', 'read', 'test'], paths: ['/work/repo'], repos: ['ruvnet/ruflo'], network: [], secretEnv: [], spend: { hourUsd: 2, dayUsd: 10, totalUsd: 40 }, concurrency: 2, maxDurationMs: 7 * 24 * H, verify: [['true']], acceptWithoutAnatole: false }+const task = (id: string, over: Partial<TaskFact> = {}): TaskFact => ({ id, title: `do ${id}`, cls: 'edit', hardDeny: null, path: '/work/repo/src/a.ts', ...over })++const facts = (over: Partial<Facts> = {}): Facts => ({ nowMs: T0, killSeen: false, envelope: ENV, anatole: 'on', spend: { hourUsd: 0, dayUsd: 0, totalUsd: 0 }, task: task('t1'), effects: {}, orphans: new Set(), tunables: { parallelism: 1, retries: 1, stepTimeoutMs: 10 * 60_000, tierOf: () => 'mid' }, preflight: {}, ...over })++const started = (at = T0): JournalEvent => ({ t: 'start', at, envHash: hashOf(ENV), revision: 1, anatole: 'on' })+const running = (): LoopState => foldJournal([started()])++describe('adaptation', () => {+ const step = (over: Partial<Parameters<typeof outcomesOf>[0][number]>) => ({ id: 's', task: 't', cls: 'edit', attempt: 1, startedAt: 0, deadline: 1, status: 'done' as const, verified: true, tier: 'mid', par: 1, endedAt: 10, ...over })+ const many = (n: number, over: Partial<Parameters<typeof outcomesOf>[0][number]>) => Array.from({ length: n }, (_v, i) => step({ ...over, id: `s${i}`, startedAt: i }))++ it('counts only verified successes and failures; an unverified step teaches nothing', () => {+ expect(outcomesOf([step({}), step({ verified: false }), step({ status: 'failed', verified: undefined }), step({ status: 'started' })]).length).toBe(2)+ })++ it('proposes a higher tier for failing steps and promotes it with a chained receipt', () => {+ const outcomes = outcomesOf(many(8, { status: 'failed', verified: undefined }))+ const [p] = propose(outcomes, DEFAULTS, ENV)++ expect(p?.change).toEqual({ path: 'tier.edit', from: 'mid', to: 'high' })++ const verdict = evaluate(p!, outcomes, DEFAULTS)++ expect(verdict.verdict).toBe('supported')++ const first = promote(p!, verdict, DEFAULTS, ENV, lastHash([]), T0)++ expect(first.ok).toBe(true)++ const t = first.ok ? first.tunables : DEFAULTS++ expect(t.tiers.edit).toBe('high')+ expect(tunablesFrom(first.ok ? [first.receipt] : [], ENV).tiers.edit).toBe('high')+ expect(verifyReceipts(first.ok ? [first.receipt] : []).ok).toBe(true)+ })++ it('refuses to promote without evidence, and a tampered receipt breaks the chain', () => {+ const few = outcomesOf(many(3, { status: 'failed', verified: undefined }))+ const p = { id: 'x', change: { path: 'tier.edit', from: 'mid', to: 'high' }, direction: 'conservative' as const, reason: '' }++ expect(promote(p, evaluate(p, few, DEFAULTS), DEFAULTS, ENV, 'genesis', T0).ok).toBe(false)++ const good = outcomesOf(many(8, { status: 'failed', verified: undefined }))+ const a = promote(p, evaluate(p, good, DEFAULTS), DEFAULTS, ENV, 'genesis', T0)++ if (!a.ok) throw new Error('setup')++ expect(verifyReceipts([{ ...a.receipt, to: 'low' }]).ok).toBe(false)+ expect(verifyReceipts([a.receipt, { ...a.receipt, prev: 'genesis' }]).ok).toBe(false)+ })++ it('aggressive changes need clean history and are reverted if the trial does worse', () => {+ const clean = outcomesOf(many(14, { tier: 'mid' }))+ const [p] = propose(clean, DEFAULTS, ENV)++ expect(p).toMatchObject({ direction: 'aggressive', change: { path: 'tier.edit', to: 'low' } })++ const ok = promote(p!, evaluate(p!, clean, DEFAULTS), DEFAULTS, ENV, 'genesis', 100)++ if (!ok.ok) throw new Error('setup')++ const worse = outcomesOf(many(8, { tier: 'low', status: 'failed', verified: undefined, startedAt: 200, endedAt: 210 }))++ expect(reviewTrials([ok.receipt], worse).map(r => r.change)).toEqual([{ path: 'tier.edit', from: 'low', to: 'mid' }])+ expect(reviewTrials([ok.receipt], outcomesOf(many(8, { tier: 'low', startedAt: 200, endedAt: 210 }))).length).toBe(0)+ })++ it('no sequence of proposals, valid or hostile, can take a tunable past the envelope or change the envelope', () => {+ const env = Object.freeze({ ...ENV, concurrency: 2 }) as Envelope+ const before = canonical(env)+ let t: Tunables = DEFAULTS++ for (const [path, to] of [['parallelism', '9'], ['parallelism', '2'], ['parallelism', '3'], ['parallelism', '-1'], ['retries', '99'], ['stepSize', '6'], ['ordering', 'chaos'], ['tier.edit', 'ultra'], ['__proto__.x', '1'], ['concurrency', '8'], ['tier.edit', 'low'], ['tier.A;B', 'low']] as const) {+ const applied = applyChange(t, { path, from: '', to })++ if (applied !== null) t = clampToEnvelope(applied, env)++ expect(t.parallelism).toBeLessThanOrEqual(env.concurrency)+ expect(t.retries).toBeLessThanOrEqual(3)+ expect(t.stepSize).toBeLessThanOrEqual(5)+ }++ const huge = promote({ id: 'p', change: { path: 'parallelism', from: '1', to: '3' }, direction: 'conservative', reason: '' }, { verdict: 'supported', evidence: 'forced' }, DEFAULTS, env, 'genesis', T0)++ expect(huge.ok).toBe(false)+ expect(canonical(env)).toBe(before)+ expect(clampToEnvelope({ ...DEFAULTS, parallelism: 8 }, env).parallelism).toBe(2)+ })+})++describe('guards', () => {+ it('classifies by the most privileged class the words suggest, and never defaults', () => {+ expect(classifyTask('a', 'Review the auth module').cls).toBe('read')+ expect(classifyTask('a', 'Fix the parser and run the tests').cls).toBe('edit')+ expect(classifyTask('a', 'Create a worktree and merge').cls).toBe('git-branch')+ expect(classifyTask('a', 'Completion: Learn: store the outcome').cls).toBeNull()+ expect(classifyTask('a', 'Edit /work/repo/src/x.ts').path).toBe('/work/repo/src/x.ts')+ })++ it('flags every hard deny family in a task', () => {+ const deny = (text: string): string | null => classifyTask('a', text).hardDeny++ expect(deny('npm publish the package')).toBe('publish')+ expect(deny('cut a release and tag')).toBe('release')+ expect(deny('deploy to production')).toBe('deploy')+ expect(deny('git push --force origin main')).toBe('force-push')+ expect(deny('read the API key from gcloud secrets')).toBe('secret-access')+ expect(deny('rm -rf / to clean up')).toBe('delete-outside-worktree')+ expect(deny('widen the envelope to allow network')).toBe('envelope-edit')+ expect(deny('refactor the parser')).toBeNull()+ })++ it('reads the Anatole gate from what the mod reported', () => {+ expect(anatoleFact(undefined)).toBe('absent')+ expect(anatoleFact({ present: false, status: null, modeOverride: null, overrides: {}, alerts: [], refused: [], badAlerts: 0 })).toBe('absent')+ expect(anatoleFact({ present: true, status: { mode: 'off' } as never, modeOverride: null, overrides: {}, alerts: [], refused: [], badAlerts: 0 })).toBe('off')+ expect(anatoleFact({ present: true, status: { mode: 'notify' } as never, modeOverride: null, overrides: {}, alerts: [], refused: [], badAlerts: 0 })).toBe('on')+ })++ it('preflight: absent check is unwired, a deny is deny, a throw is unwired', async () => {+ expect((await preflightAll(undefined)).edit).toBe('unwired')+ expect((await preflightAll(async tool => (tool === 'Edit' ? { decision: 'deny' } : 'allow'))).edit).toBe('deny')+ expect((await preflightAll(async () => 'allow')).read).toBe('allow')+ expect((await preflightAll(async () => Promise.reject(new Error('x')))).read).toBe('unwired')+ })++ it('an effect needs the store AND the verify commands; a store status alone is a claim', () => {+ expect(effectOf('completed', { ran: 0, failed: 0 })).toBe('done-unverified')+ expect(effectOf('completed', { ran: 2, failed: 0 })).toBe('done')+ expect(effectOf('completed', { ran: 2, failed: 1 })).toBe('failed')+ expect(effectOf('in_progress', { ran: 0, failed: 0 })).toBe('unknown')+ expect(effectOf('failed', { ran: 0, failed: 0 })).toBe('failed')+ })+})diff --git a/plugins/ruflo-console/tests/ap-core.spec.ts b/plugins/ruflo-console/tests/ap-core.spec.tsindex affb8cdf33..87a555cecd 100644--- a/plugins/ruflo-console/tests/ap-core.spec.ts+++ b/plugins/ruflo-console/tests/ap-core.spec.ts@@ -410,131 +410,3 @@ describe('band and summary', () => {expect(summarize(s, T0).parked).toBe(2)})})--describe('adaptation', () => {- const step = (over: Partial<Parameters<typeof outcomesOf>[0][number]>) => ({ id: 's', task: 't', cls: 'edit', attempt: 1, startedAt: 0, deadline: 1, status: 'done' as const, verified: true, tier: 'mid', par: 1, endedAt: 10, ...over })- const many = (n: number, over: Partial<Parameters<typeof outcomesOf>[0][number]>) => Array.from({ length: n }, (_v, i) => step({ ...over, id: `s${i}`, startedAt: i }))-- it('counts only verified successes and failures; an unverified step teaches nothing', () => {- expect(outcomesOf([step({}), step({ verified: false }), step({ status: 'failed', verified: undefined }), step({ status: 'started' })]).length).toBe(2)- })-- it('proposes a higher tier for failing steps and promotes it with a chained receipt', () => {- const outcomes = outcomesOf(many(8, { status: 'failed', verified: undefined }))- const [p] = propose(outcomes, DEFAULTS, ENV)-- expect(p?.change).toEqual({ path: 'tier.edit', from: 'mid', to: 'high' })-- const verdict = evaluate(p!, outcomes, DEFAULTS)-- expect(verdict.verdict).toBe('supported')-- const first = promote(p!, verdict, DEFAULTS, ENV, lastHash([]), T0)-- expect(first.ok).toBe(true)-- const t = first.ok ? first.tunables : DEFAULTS-- expect(t.tiers.edit).toBe('high')- expect(tunablesFrom(first.ok ? [first.receipt] : [], ENV).tiers.edit).toBe('high')- expect(verifyReceipts(first.ok ? [first.receipt] : []).ok).toBe(true)- })-- it('refuses to promote without evidence, and a tampered receipt breaks the chain', () => {- const few = outcomesOf(many(3, { status: 'failed', verified: undefined }))- const p = { id: 'x', change: { path: 'tier.edit', from: 'mid', to: 'high' }, direction: 'conservative' as const, reason: '' }-- expect(promote(p, evaluate(p, few, DEFAULTS), DEFAULTS, ENV, 'genesis', T0).ok).toBe(false)-- const good = outcomesOf(many(8, { status: 'failed', verified: undefined }))- const a = promote(p, evaluate(p, good, DEFAULTS), DEFAULTS, ENV, 'genesis', T0)-- if (!a.ok) throw new Error('setup')-- expect(verifyReceipts([{ ...a.receipt, to: 'low' }]).ok).toBe(false)- expect(verifyReceipts([a.receipt, { ...a.receipt, prev: 'genesis' }]).ok).toBe(false)- })-- it('aggressive changes need clean history and are reverted if the trial does worse', () => {- const clean = outcomesOf(many(14, { tier: 'mid' }))- const [p] = propose(clean, DEFAULTS, ENV)-- expect(p).toMatchObject({ direction: 'aggressive', change: { path: 'tier.edit', to: 'low' } })-- const ok = promote(p!, evaluate(p!, clean, DEFAULTS), DEFAULTS, ENV, 'genesis', 100)-- if (!ok.ok) throw new Error('setup')-- const worse = outcomesOf(many(8, { tier: 'low', status: 'failed', verified: undefined, startedAt: 200, endedAt: 210 }))-- expect(reviewTrials([ok.receipt], worse).map(r => r.change)).toEqual([{ path: 'tier.edit', from: 'low', to: 'mid' }])- expect(reviewTrials([ok.receipt], outcomesOf(many(8, { tier: 'low', startedAt: 200, endedAt: 210 }))).length).toBe(0)- })-- it('no sequence of proposals, valid or hostile, can take a tunable past the envelope or change the envelope', () => {- const env = Object.freeze({ ...ENV, concurrency: 2 }) as Envelope- const before = canonical(env)- let t: Tunables = DEFAULTS-- for (const [path, to] of [['parallelism', '9'], ['parallelism', '2'], ['parallelism', '3'], ['parallelism', '-1'], ['retries', '99'], ['stepSize', '6'], ['ordering', 'chaos'], ['tier.edit', 'ultra'], ['__proto__.x', '1'], ['concurrency', '8'], ['tier.edit', 'low'], ['tier.A;B', 'low']] as const) {- const applied = applyChange(t, { path, from: '', to })-- if (applied !== null) t = clampToEnvelope(applied, env)-- expect(t.parallelism).toBeLessThanOrEqual(env.concurrency)- expect(t.retries).toBeLessThanOrEqual(3)- expect(t.stepSize).toBeLessThanOrEqual(5)- }-- const huge = promote({ id: 'p', change: { path: 'parallelism', from: '1', to: '3' }, direction: 'conservative', reason: '' }, { verdict: 'supported', evidence: 'forced' }, DEFAULTS, env, 'genesis', T0)-- expect(huge.ok).toBe(false)- expect(canonical(env)).toBe(before)- expect(clampToEnvelope({ ...DEFAULTS, parallelism: 8 }, env).parallelism).toBe(2)- })-})--describe('guards', () => {- it('classifies by the most privileged class the words suggest, and never defaults', () => {- expect(classifyTask('a', 'Review the auth module').cls).toBe('read')- expect(classifyTask('a', 'Fix the parser and run the tests').cls).toBe('edit')- expect(classifyTask('a', 'Create a worktree and merge').cls).toBe('git-branch')- expect(classifyTask('a', 'Completion: Learn: store the outcome').cls).toBeNull()- expect(classifyTask('a', 'Edit /work/repo/src/x.ts').path).toBe('/work/repo/src/x.ts')- })-- it('flags every hard deny family in a task', () => {- const deny = (text: string): string | null => classifyTask('a', text).hardDeny-- expect(deny('npm publish the package')).toBe('publish')- expect(deny('cut a release and tag')).toBe('release')- expect(deny('deploy to production')).toBe('deploy')- expect(deny('git push --force origin main')).toBe('force-push')- expect(deny('read the API key from gcloud secrets')).toBe('secret-access')- expect(deny('rm -rf / to clean up')).toBe('delete-outside-worktree')- expect(deny('widen the envelope to allow network')).toBe('envelope-edit')- expect(deny('refactor the parser')).toBeNull()- })-- it('reads the Anatole gate from what the mod reported', () => {- expect(anatoleFact(undefined)).toBe('absent')- expect(anatoleFact({ present: false, status: null, modeOverride: null, overrides: {}, alerts: [], refused: [], badAlerts: 0 })).toBe('absent')- expect(anatoleFact({ present: true, status: { mode: 'off' } as never, modeOverride: null, overrides: {}, alerts: [], refused: [], badAlerts: 0 })).toBe('off')- expect(anatoleFact({ present: true, status: { mode: 'notify' } as never, modeOverride: null, overrides: {}, alerts: [], refused: [], badAlerts: 0 })).toBe('on')- })-- it('preflight: absent check is unwired, a deny is deny, a throw is unwired', async () => {- expect((await preflightAll(undefined)).edit).toBe('unwired')- expect((await preflightAll(async tool => (tool === 'Edit' ? { decision: 'deny' } : 'allow'))).edit).toBe('deny')- expect((await preflightAll(async () => 'allow')).read).toBe('allow')- expect((await preflightAll(async () => Promise.reject(new Error('x')))).read).toBe('unwired')- })-- it('an effect needs the store AND the verify commands; a store status alone is a claim', () => {- expect(effectOf('completed', { ran: 0, failed: 0 })).toBe('done-unverified')- expect(effectOf('completed', { ran: 2, failed: 0 })).toBe('done')- expect(effectOf('completed', { ran: 2, failed: 1 })).toBe('failed')- expect(effectOf('in_progress', { ran: 0, failed: 0 })).toBe('unknown')- expect(effectOf('failed', { ran: 0, failed: 0 })).toBe('failed')- })-})diff --git a/plugins/ruflo-console/tests/logic.spec.ts b/plugins/ruflo-console/tests/logic.spec.tsindex bd2c4c764f..a84f0a9fb2 100644--- a/plugins/ruflo-console/tests/logic.spec.ts+++ b/plugins/ruflo-console/tests/logic.spec.ts@@ -28,6 +28,7 @@ describe('/ruflo', () => {it('reads every subcommand into an intent; swarm alone is the view, swarm <sub> belongs to ruflo-swarm', () => {expect(parseRuflo('')).toEqual({ kind: 'open', view: null })expect(parseRuflo('4')).toEqual({ kind: 'open', view: 'claims' })+ expect(parseRuflo('autopilot Stop')).toEqual({ kind: 'autopilot', arg: 'stop' })expect(parseRuflo('cost')).toEqual({ kind: 'open', view: 'cost' })expect(parseRuflo('swarm')).toEqual({ kind: 'open', view: 'swarm' })expect(parseRuflo('swarm status json')).toEqual({ kind: 'delegate', owner: 'ruflo-swarm', words: 'status json' })diff --git a/plugins/ruflo-console/tests/wf-merge.spec.ts b/plugins/ruflo-console/tests/wf-merge.spec.tsindex b4d986d3b5..a34bc86ca1 100644--- a/plugins/ruflo-console/tests/wf-merge.spec.ts+++ b/plugins/ruflo-console/tests/wf-merge.spec.ts@@ -47,13 +47,13 @@ describe('registration', () => {})describe('after a read', () => {- it('adds its three hooks once however often it is wired', () => {+ it('adds its four hooks once however often it is wired', () => {const state = newState({})const start = afterRead.lengthwireWorkflows(state, host)wireWorkflows(state, host)- expect(afterRead.length - start).toBe(3)+ expect(afterRead.length - start).toBe(4)})it('runs each hook with the runs read, and a hook that throws costs only itself', async () => {