Files
ruflo/plugins/ruflo-workflows/hooks/command.ts
T
rUvandr db141ba70e feat: managed workflows, unified console runs and verified advisory learning (#4471)
* feat(agent): add bounded managed dynamic workflows and verified lifecycle observation

* feat(plugins): integrate managed workflows with mod policy and capability discovery

* feat(managed): unify console runs and verified advisory learning

* fix(managed): hydrate native recall receipts validated on ruOS

* docs(managed): record authenticated console host blocker

* docs(managed): qualify installed console and compatible native host

* feat(managed): integrate verified cycles and isolate native memory

* fix(managed): enforce offline native models and qualify feedback E2E

* fix(managed): independent security and correctness review findings

- gate managed_agent_interrupt through the managed_agent_control policy; terminate obeys the allowlist and deletes only its own environment when RUFLO_MANAGED_CONTROL=1
- track only events from the acknowledged message so a later poll cannot report the previous turn as finished
- require the canonical base64 verifier signature so one receipt cannot fill the ledger
- register RUFLO_MANAGED_AGENTS_BASE_URL as a trust-boundary env var (env-precedence audit) and key the credential scope marker with a per-process HMAC (CodeQL)
- best-effort local snapshot writes; report messageId when a prompt fails after it was sent
- console: rescheduling is running, budget/action-blocked sessions are active, not finished
- document the remaining known limits in ADR 0004

Co-Authored-By: RuFlo <ruv@ruv.net>

* docs: user guide section for managed cloud agents; correct ruflo-agent README counts

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(managed): scope marker is a generation number, never a hash of the API key (CodeQL)

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: r <r@x>
2026-10-24 22:42:09 -04:00

39 lines
2.2 KiB
TypeScript

import { secretsIn } from './screen'
import type { ModOptions } from './options'
import type { Stats } from './status'
/** `/wf-mod` is answered locally and takes no model turn. */
export type CommandDeps = { readonly opts: ModOptions; readonly stats: Stats; readonly tools: () => Promise<readonly string[]> }
const HELP = ['/wf-mod status', '/wf-mod scan <text>', '/wf-mod lifecycle', '/wf-mod managed'].join('\n')
export async function answer(args: string, deps: CommandDeps): Promise<string> {
const [verb = '', ...rest] = args.trim().split(/\s+/)
const arg = rest.join(' ')
const { opts, stats } = deps
if (verb === '' || verb === 'help') return HELP
if (verb === 'status') {
const seen = Object.entries(stats.seen).map(([k, n]) => `${k} ${n}`).join(' · ')
return [`guard ${opts.guard ? 'on' : 'off'} · checked ${stats.checked} · blocked ${stats.blocked}`, seen === '' ? 'no workflow calls this session' : seen].join('\n')
}
if (verb === 'managed') {
try {
const names = (await deps.tools()).filter(t => t === 'managed_agent_capabilities' || t.endsWith('__managed_agent_capabilities'))
return names.length ? `Managed adapter registered: ${names.map(n => n.replace(/[^A-Za-z0-9_-]/g, '').slice(0, 160)).slice(0, 8).join(', ')}. Inspect that tool and /agent-mod capabilities before creation. Use persisted workflow_* for approval gates; managed workflows are remote execution with independently verified outputs. Registration does not establish authorization or beta access.` : 'Managed adapter not registered. Install or update ruflo-core and ruflo-agent. Use local workflow_* or native Workflow for current work.'
} catch { return 'Managed tool discovery unavailable; registration and readiness are unknown.' }
}
if (verb === 'scan') {
if (arg === '') return 'usage: /wf-mod scan <text>'
const found = secretsIn(arg)
return found.length ? `The guard would refuse that (looks like: ${found.join(', ')}).` : 'Nothing found: the guard would let that through.'
}
if (verb === 'lifecycle') return 'created -> running <-> paused -> completed | cancelled. Delete refuses a running workflow, and this mod refuses a delete that names no single id.'
return `Unknown: ${verb}\n${HELP}`
}