🌊 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): the guidance section shows that claude -p is running, and what it is doing
ruv144e40bd5f8d
diff --git a/plugins/ruflo-console/hooks/mission-guidance.ts b/plugins/ruflo-console/hooks/mission-guidance.tsindex dd042cfe13..9f35811962 100644--- a/plugins/ruflo-console/hooks/mission-guidance.ts+++ b/plugins/ruflo-console/hooks/mission-guidance.ts@@ -17,7 +17,26 @@ import { settingsOf } from './settings'import type { State } from './state'import { claudeParser, eventOf, type Sink } from './stream'-export type Guidance = { goal: string; status: 'running' | 'done' | 'failed'; lines: string[]; note: string; stop: (() => void) | null }+export type Guidance = { goal: string; status: 'running' | 'done' | 'failed'; lines: string[]; note: string; stop: (() => void) | null; startedAtMs: number }++const SPIN = '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'++/**+ * What the run is doing now, for its section: a spinner that turns while it runs, how long it has run, and whether the answer has+ * started (thinking until the first words arrive, then writing with a word count). Once it has finished, its note.+ */+export function guidanceStatus(guidance: Guidance, nowMs: number): string {+ if (guidance.status !== 'running') return guidance.note++ const spin = SPIN[Math.floor(nowMs / 100) % SPIN.length]+ const secs = Math.max(0, Math.floor((nowMs - guidance.startedAtMs) / 1000))++ if (guidance.lines.length === 0) return `${spin} thinking · ${secs}s · the answer starts when the first words arrive`++ const words = guidance.lines.reduce((sum, line) => sum + (line.trim() === '' ? 0 : line.trim().split(/\s+/).length), 0)++ return `${spin} writing · ${secs}s · ${words} words so far`+}/** The most guidance text kept, and the longest wait: a runaway turn ends at five minutes. */const MAX_LINES = 400@@ -84,7 +103,7 @@ export function startGuidance(state: State, host: Host, mc: McState): void {if (plan === null || mc.guidance?.status === 'running') return- const guidance: Guidance = { goal: mc.goal, status: 'running', lines: [], note: 'asking claude…', stop: null }+ const guidance: Guidance = { goal: mc.goal, status: 'running', lines: [], note: 'asking claude…', stop: null, startedAtMs: Date.now() }const startedAtMs = Date.now()let open = falseconst parse = claudeParser()@@ -120,6 +139,16 @@ export function startGuidance(state: State, host: Host, mc: McState): void {mc.guidance = guidance+ // The section redraws while the run is going, so its spinner and clock move even before the first words arrive.+ const tick = (): void => {+ if (guidance.status !== 'running') return++ host.invalidate()+ host.after(250, tick)+ }++ host.after(250, tick)+let stream: ReturnType<Host['spawn']>try {diff --git a/plugins/ruflo-console/hooks/views/mission-control.ts b/plugins/ruflo-console/hooks/views/mission-control.tsindex f418fcded0..268cf5bb37 100644--- a/plugins/ruflo-console/hooks/views/mission-control.ts+++ b/plugins/ruflo-console/hooks/views/mission-control.ts@@ -1,6 +1,7 @@import type { RenderElement } from 'claude-code'import { lifecycleOf, PHASE_NAME, PROFILES, RIGORS, stageOf } from '../goap'+import { guidanceStatus } from '../mission-guidance'import { activeMission, derive, mcOf, nextTask, progressOf, rufloTaskOf, type Derived, type LedgerTask, type McTab, type MissionRecord } from '../mission-control'import { ago, button, clip, col, confirmHere, row, rule, section, text, THEME, type Ctx } from './common'import { GOALS_PLUGIN, isAvailable, MISSION_SKILLS, slashOf } from '../mission-skills'@@ -99,7 +100,8 @@ function guidanceRows(ctx: Ctx): RenderElement[] {const control = guidance.stop === null ? button(ctx, 'mc-guidance-again', '↻ ask again', () => m.askGuidance()) : button(ctx, 'mc-guidance-stop', '■stop', () => guidance.stop?.())const body = guidance.lines.length === 0 ? [text(ctx, ' waiting for the first words…', { dimColor: true })] : guidance.lines.map(line => text(ctx, ` ${line}`))- return section(ctx, 'guidance', '✦ Claude guidance', guidance.status === 'running' ? 'writing…' : guidance.note, [...body, row(ctx, [control], 'mc-guidance-ctl')], true)+ // The header says what the run is doing: its spinner, the seconds it has run, and thinking or writing with a word count.+ return section(ctx, 'guidance', '✦ Claude guidance', guidanceStatus(guidance, ctx.nowMs), [...body, row(ctx, [control], 'mc-guidance-ctl')], true)}function taskRow(ctx: Ctx, mission: MissionRecord, task: LedgerTask, status: Derived, isNext: boolean): RenderElement {diff --git a/plugins/ruflo-console/tests/mission-guidance.spec.ts b/plugins/ruflo-console/tests/mission-guidance.spec.tsindex 14cb67ac6c..b8bd9ec559 100644--- a/plugins/ruflo-console/tests/mission-guidance.spec.ts+++ b/plugins/ruflo-console/tests/mission-guidance.spec.ts@@ -7,7 +7,7 @@ import { describe, expect, it } from 'vitest'import type { ActionSpec } from '../hooks/actions'import type { Host } from '../hooks/host'-import { guidanceArgv, guidancePrompt, guidanceSpec, offerGuidance, pluginsOf, startGuidance } from '../hooks/mission-guidance'+import { guidanceArgv, guidancePrompt, guidanceSpec, guidanceStatus, offerGuidance, pluginsOf, startGuidance, type Guidance } from '../hooks/mission-guidance'import { mcOf, setGoal } from '../hooks/mission-control'import type { Runner } from '../hooks/runner'import { saveAiPrefs, settingsOf } from '../hooks/settings'@@ -168,6 +168,19 @@ describe('mission guidance', () => {expect(mcOf(busy).guidance?.note).toContain('press Enter to send')})+ it('the section says what the run is doing: thinking until the first words, then writing with a word count, then its note', () => {+ const run: Guidance = { goal: 'g', status: 'running', lines: [], note: 'asking claude…', stop: null, startedAtMs: 1_000 }++ expect(guidanceStatus(run, 4_000)).toMatch(/^\S thinking · 3s · the answer starts when the first words arrive$/)++ run.lines.push('## Research', 'Search memory first for prior art.')+ expect(guidanceStatus(run, 9_000)).toMatch(/^\S writing · 8s · 8 words so far$/)++ run.status = 'done'+ run.note = '✓ 8 s · $0.042'+ expect(guidanceStatus(run, 9_000)).toBe('✓ 8 s · $0.042')+ })+it('an answer with nothing in it is a failure that says what to check, and an error result is one too', async () => {const empty = ready()