Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

feat(ruflo-console): Federation map says why it is empty; legend fits a narrow pane

ruv56e5436a31d5
diff --git a/plugins/ruflo-console/hooks/views/federation.ts b/plugins/ruflo-console/hooks/views/federation.ts
index 416e5f722f..2be3d9ee18 100644
--- a/plugins/ruflo-console/hooks/views/federation.ts
+++ b/plugins/ruflo-console/hooks/views/federation.ts
@@ -2,6 +2,7 @@ import type { RenderElement } from 'claude-code'
import type { Channels, Peers, Roster } from '../data/cli'
import { ago, col, kv, live, picture, rule, sourceLine, starts, text, THEME, type Ctx } from './common'
+import { fedNodesOf } from './frames'
/**
* This node's federation standing from local state and local CLI answers only. The roster lives on the public relay,
@@ -17,7 +18,9 @@ export function federationView(ctx: Ctx): RenderElement {
const rows: RenderElement[] = [rule(ctx, 'Map', 'this node · peers · keys · channels · roster')]
rows.push(picture(ctx, 'fedmap', 'map needs a terminal'))
- rows.push(text(ctx, '● pinned peer (solid) · own key (solid) · channel (dashed) · ○ roster member (sparse, unvetted) · a dot runs an edge for 2 s after a sync', { dimColor: true }))
+ if (fedNodesOf(state).length === 0) rows.push(text(ctx, ' Nothing to draw yet: a key, a pinned peer or a channel adds a node.', { dimColor: true }))
+ rows.push(text(ctx, '● pinned peer or own key: solid · channel: dashed', { dimColor: true }))
+ rows.push(text(ctx, '○ roster member: sparse, unvetted · a dot runs an edge for 2 s after a sync', { dimColor: true }))
rows.push(rule(ctx, 'This node', 'local only'))
rows.push(
diff --git a/plugins/ruflo-console/tests/federation-page.spec.ts b/plugins/ruflo-console/tests/federation-page.spec.ts
new file mode 100644
index 0000000000..110966b1ba
--- /dev/null
+++ b/plugins/ruflo-console/tests/federation-page.spec.ts
@@ -0,0 +1,26 @@
+import { describe, expect, it } from 'vitest'
+
+import { newState, type State } from '../hooks/state'
+import type { Actions } from '../hooks/views/common'
+import { viewText } from '../hooks/views/pane'
+
+const shown = (state: State, columns = 60) => viewText({ state, nowMs: 5, columns, act: {} as Actions }, 'federation')
+
+describe('the Federation page map', () => {
+ it('says why the map is empty, and keeps its legend on lines short enough for a narrow pane', () => {
+ const text = shown(newState({}))
+
+ expect(text).toContain('Nothing to draw yet')
+ expect(text).toContain('solid')
+ expect(text).toContain('dashed')
+ expect(text).toContain('roster member: sparse, unvetted')
+ for (const line of text.split('\n')) if (/solid|sparse/.test(line)) expect(line.length, line).toBeLessThanOrEqual(60)
+ })
+
+ it('does not say the map is empty once there is a key to draw', () => {
+ const state = newState({})
+
+ state.snapshot = { federationNodes: ['hub-1', 'worker-a'], hasNostrKey: true, plugins: { installed: [] } } as unknown as State['snapshot']
+ expect(shown(state)).not.toContain('Nothing to draw yet')
+ })
+})