mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-06 15:31:54 +09:00
- ruflo-mods guard (tool.check): read-only fast path on e.isReadOnly (2.1.304) that skips the policy-projection stat while a full check found none in the last 2 s (web tools excluded so the research ask still fires); a chain deny returns without file reads; decider "person" on every ask ruflo raises; agentId names the subagent on ruflo's reason; the chain's ceiling survives a tightening; .catch documented for 2.1.301 semantics, still fails closed. - ruflo-console: console_state and console_run registered with isDeferred: false (2.1.293); console_open/console_set stay deferred. - console + swarm: Text bold -> weight (2.1.299 deprecation), codemodded; bold: true -> weight: "semibold" (what the host already maps bold to). Engines before 2.1.299 refuse a tree with an unknown Text prop, so the kit maps weight back to bold there (text-weight.ts, via $.session.version()). - tests for 2.1.318's kit: $.tool.call now raises tool.check first (guidance test); stub answers are validated (swarm prompt.fill stub); stale expectations fixed (probe session.compact, learning-loop handshake). - console kit tests: timeoutMs 30_000 (the 5 s default timed out 19-58 end-to-end tests under load, on 2.1.289 and 2.1.318 alike), and the mock clock advanced past runner.ts's VERIFY_RETRY_MS in actions/settings tests. Co-authored-by: r <r@x>
44 lines
2.6 KiB
TypeScript
44 lines
2.6 KiB
TypeScript
import type { RenderElement } from 'claude-code'
|
|
|
|
import { confirmOf, levelOf, MAX_CALLS_PER_TURN } from '../model-tools'
|
|
import { settingsOf } from '../settings'
|
|
import { ago, button, kv, row, rule, text, THEME, type Ctx } from './common'
|
|
|
|
const MARK = { ok: '✓', waiting: '…', denied: '✕', error: '!' } as const
|
|
const COLOR = { ok: THEME.ok, waiting: THEME.warn, denied: THEME.bad, error: THEME.bad } as const
|
|
|
|
/** True while control is on or Claude has acted this session: then the dashboard leads the page, so it is never below the fold. */
|
|
export const isControlActive = (ctx: Ctx): boolean => !ctx.state.isStandalone && levelOf(settingsOf(ctx.state).ai.modelControl) !== 'off' || ctx.state.control.log.length > 0
|
|
|
|
/**
|
|
* The "Claude control" dashboard (ADR-444): whether Claude may drive the console and how far, what it has done this session, and the
|
|
* button that takes control back. Shown on Overview; the log is the audit trail, newest last.
|
|
*/
|
|
export function controlRows(ctx: Ctx): RenderElement[] {
|
|
const { state } = ctx
|
|
|
|
// The standalone terminal has no Claude session to control the console: the card would describe a thing that cannot happen here.
|
|
if (state.isStandalone) return []
|
|
const ai = settingsOf(state).ai
|
|
const level = levelOf(ai.modelControl)
|
|
const control = state.control
|
|
|
|
if (level === 'off' && control.log.length === 0) {
|
|
return [rule(ctx, 'Claude control', 'off'), text(ctx, ' Claude cannot drive the console. Turn it on in', { dimColor: true }), text(ctx, ' Settings → Claude control (read, write, manage, full).', { dimColor: true })]
|
|
}
|
|
|
|
const rows = [rule(ctx, 'Claude control', control.paused ? 'taken back' : level === 'off' ? 'off' : 'on')]
|
|
|
|
rows.push(kv(ctx, 'level', `${level} · ${confirmOf(ai.modelConfirm) === 'auto' ? 'confirms itself' : 'waits for your Yes'}`, control.paused ? THEME.warn : undefined))
|
|
rows.push(kv(ctx, 'this session', `${control.calls} action${control.calls === 1 ? '' : 's'} · ${control.turnCalls}/${MAX_CALLS_PER_TURN} this turn`))
|
|
rows.push(row(ctx, [button(ctx, 'control-pause', control.paused ? 'Give control back' : 'Take back control', () => ctx.act.control.pause(!control.paused))], 'control-buttons'))
|
|
|
|
for (const entry of control.log.slice(-6)) {
|
|
rows.push(row(ctx, [ctx.kit.Text({ weight: 'semibold', color: COLOR[entry.outcome], children: ` ${MARK[entry.outcome]} ` }), ctx.kit.Text({ children: `${entry.summary} ` }), ctx.kit.Text({ dimColor: true, children: ago(entry.atMs, ctx.nowMs) })], `control-log-${entry.atMs}`))
|
|
}
|
|
|
|
if (control.log.length === 0) rows.push(text(ctx, ' Nothing yet: Claude has not used the console.', { dimColor: true }))
|
|
|
|
return rows
|
|
}
|