mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
feat(ruflo-console): the Learning pulse folds into its section; the marker quickens and spins while learning runs; settings show their state in the header
The pulse is a section that stays open. While a learning action runs the marker moves four times as fast, the active stage shows the shared spinner, and the header says learning is running. The settings section names the state of each switch in its header, so it reads without opening. Co-Authored-By: RuFlo <ruv@ruv.net>
This commit is contained in:
1 parent
a6c70b974e
commit
98df4d220f
2 files changed
+17
-9
No files matched your search
@@ -1,28 +1,31 @@
|
||||
import type { RenderElement } from 'claude-code'
|
||||
|
||||
import { gauge, sparkline } from '../memory-lines'
|
||||
import { count, rule, row, text, THEME, type Ctx } from './common'
|
||||
import { section, count, row, text, THEME, type Ctx } from './common'
|
||||
import { stagesOf } from './frames'
|
||||
import { spinAt } from '../spinner'
|
||||
|
||||
/** One step of the animation every 160 ms; nothing moves while the pane is hidden (the frame loop stops). */
|
||||
const beat = (ctx: Ctx, ms: number): number => Math.floor(ctx.nowMs / ms)
|
||||
|
||||
/**
|
||||
* The learning pulse: text charts that move while the pane is open. A marker travels the pipeline (RETRIEVE → JUDGE → DISTILL →
|
||||
* CONSOLIDATE), the router's model mix is a bar chart with a highlight that sweeps along each bar, and the success rate is a sparkline
|
||||
* with a scanning cursor. They draw what was measured and nothing else: no data, no chart.
|
||||
* The learning pulse, folded in its own section: text charts that move while the pane is open. A marker travels the pipeline
|
||||
* (RETRIEVE → JUDGE → DISTILL → CONSOLIDATE), the router's model mix is a bar chart with a highlight that sweeps along each bar, and
|
||||
* the success rate is a sparkline with a scanning cursor. While a learning action runs the marker quickens and the active stage
|
||||
* shows the spinner, so activity reads at a glance. They draw what was measured and nothing else: no data, no chart.
|
||||
*/
|
||||
export function pulseRows(ctx: Ctx): RenderElement[] {
|
||||
const { state } = ctx
|
||||
const rows: RenderElement[] = [rule(ctx, 'Learning pulse', 'live: the marker moves, the data is what ruflo measured')]
|
||||
const rows: RenderElement[] = []
|
||||
const running = state.lab.running?.id.startsWith('nn-') === true
|
||||
const stages = stagesOf(state)
|
||||
const at = beat(ctx, 700) % Math.max(1, stages.length)
|
||||
const at = beat(ctx, running ? 250 : 700) % Math.max(1, stages.length)
|
||||
|
||||
rows.push(
|
||||
row(
|
||||
ctx,
|
||||
stages.flatMap((stage, i) => [
|
||||
ctx.kit.Text({ bold: i === at, color: i === at ? THEME.warn : THEME.info, children: ` ${i === at ? '●' : '○'} ${stage.name} ${stage.count ?? 'n/a'}` }),
|
||||
ctx.kit.Text({ bold: i === at, color: i === at ? THEME.warn : THEME.info, children: ` ${i === at ? (running ? spinAt(ctx.nowMs) : '●') : '○'} ${stage.name} ${stage.count ?? 'n/a'}` }),
|
||||
...(i < stages.length - 1 ? [ctx.kit.Text({ dimColor: true, children: ' ━━' })] : []),
|
||||
]),
|
||||
'pulse-pipeline',
|
||||
@@ -67,5 +70,7 @@ export function pulseRows(ctx: Ctx): RenderElement[] {
|
||||
for (const [name, value] of Object.entries(sizes)) rows.push(text(ctx, ` ${name.padEnd(14)} ${gauge(value, top, 24)} ${count(value)}`, { color: THEME.info }))
|
||||
}
|
||||
|
||||
return rows
|
||||
const live = state.lab.running?.id.startsWith('nn-') === true
|
||||
|
||||
return section(ctx, 'learn-pulse', 'Learning pulse', live ? `${spinAt(ctx.nowMs)} learning now · the marker quickens` : 'live: the marker moves, the data is what ruflo measured', rows, true)
|
||||
}
|
||||
@@ -16,11 +16,14 @@ function configRows(ctx: Ctx): RenderElement[] {
|
||||
{ key: 'hooks.enabled', title: 'Hooks', help: 'hooks that learn from your edits and routes' },
|
||||
]
|
||||
|
||||
// The header says where each switch stands, so the state reads without opening the section; each change still asks first.
|
||||
const summary = keys.map(item => `${item.title.toLowerCase()} ${core?.get(item.key) === 'true' ? 'on' : core?.get(item.key) === 'false' ? 'off' : 'n/a'}`).join(' · ')
|
||||
|
||||
return section(
|
||||
ctx,
|
||||
'learn-config',
|
||||
'Settings & configuration',
|
||||
'what lets ruflo learn · each change asks first',
|
||||
`${summary} · each change asks first`,
|
||||
[
|
||||
...keys.map(item => {
|
||||
const value = core?.get(item.key)
|
||||
|
||||
Reference in new issue
Block a user