🌊 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
fix(console): register the memmap probe, cap the namespace key and embedding length, tests for each
ruve36986d86103
diff --git a/plugins/ruflo-console/hooks/controller.ts b/plugins/ruflo-console/hooks/controller.tsindex 03ede2e5e6..34b76957fd 100644--- a/plugins/ruflo-console/hooks/controller.ts+++ b/plugins/ruflo-console/hooks/controller.ts@@ -7,6 +7,7 @@ import { actionsOf } from './bindings'import type { Catalog } from './data/catalog'import { PROBES, probeArgv, probeError, probeReady, type ProbeResult } from './data/cli'import { ALL_COST_PROBES as COST_PROBES } from './data/cost-probes'+import { memmapProbe } from './data/memmap'import { X_PROBES } from './data/xruv'import { diffEvents, record } from './data/events'import { agentName, announceChanges, factsOf } from './notices'@@ -32,8 +33,7 @@ import { pulseDue } from './pulse'const ACTIVITY_BUCKET_MS = 5_000const PANE_WATCH_MS = 1_000const MAX_PARALLEL_PROBES = 2-/** The CLI probes and the x.ruv.io board's two network reads, one cadence and one option gate for all. */-const ALL_PROBES = [...PROBES, ...X_PROBES, ...COST_PROBES]+const ALL_PROBES = [...PROBES, ...X_PROBES, ...COST_PROBES, memmapProbe] // CLI probes, the x.ruv.io board's network reads, cost, the memory map's list: one cadence and option gateconst BAR_FRESH_MS = 10_000const IDLE_REFRESH_MS = 30_000const TOOLS_RECOUNT_MS = 30_000diff --git a/plugins/ruflo-console/hooks/data/memmap.ts b/plugins/ruflo-console/hooks/data/memmap.tsindex aac9b15feb..0783b4c171 100644--- a/plugins/ruflo-console/hooks/data/memmap.ts+++ b/plugins/ruflo-console/hooks/data/memmap.ts@@ -10,6 +10,9 @@ import type { MapEntry } from '../gfx/memmap'/** Entries the map draws at most: `memory list` is asked for the newest 500, as the Namespaces sample is. */export const MAP_LIMIT = 500+/** A stored embedding longer than this is ignored (the map then says hash): bounds the work per frame on a corrupt list. */+const MAX_DIMS = 4096+/*** `memory list` JSON as map entries. `vector` is set only if a row carries an `embedding` array (the CLI's list does not* today, so the map says 'hash layout'); never invented.@@ -27,7 +30,7 @@ export function mapEntriesOf(stdout: string): MapEntry[] | null {const accessCount = numberOf(record?.accessCount)const raw = Array.isArray(record?.embedding) ? record.embedding : null- const vector = raw !== null && raw.length > 1 && raw.every(item => typeof item === 'number' && Number.isFinite(item)) ? (raw as number[]) : undefined+ const vector = raw !== null && raw.length > 1 && raw.length <= MAX_DIMS && raw.every(item => typeof item === 'number' && Number.isFinite(item)) ? (raw as number[]) : undefinedreturn [{ key, namespace: stringOf(record?.namespace, 40) ?? '(none)', hasVector: record?.hasEmbedding === true, ...(accessCount !== undefined && { accessCount }), ...(vector !== undefined && { vector }) }]})diff --git a/plugins/ruflo-console/hooks/views/memmap.ts b/plugins/ruflo-console/hooks/views/memmap.tsindex 6bda968d0a..763ead1c49 100644--- a/plugins/ruflo-console/hooks/views/memmap.ts+++ b/plugins/ruflo-console/hooks/views/memmap.ts@@ -8,6 +8,9 @@ import type { State } from '../state'import { clip, count, live, row, rule, text, type Ctx } from './common'import { note } from './subhead'+/** Namespaces named in the key at most: a store with hundreds would otherwise grow the page without bound. */+const LEGEND_MAX = 12+const hex = (color: number): string => `#${color.toString(16).padStart(6, '0')}`/** The entries the map draws: the map's own probe (has read counts), else the Namespaces sample (no counts, so every dot is a speck). */@@ -79,7 +82,7 @@ export function memmapRows(ctx: Ctx): RenderElement[] {let used = 0let index = 0- for (const space of spaces) {+ for (const space of spaces.slice(0, LEGEND_MAX)) {const label = ` ● ${clip(space, 20)} ${count(perSpace.get(space))} `if (used + label.length > ctx.columns - 4 && line.length > 0) {@@ -95,6 +98,9 @@ export function memmapRows(ctx: Ctx): RenderElement[] {if (line.length > 0) rows.push(row(ctx, line, `memmap-key-${index}`))+ if (spaces.length > LEGEND_MAX) rows.push(note(ctx, `+ ${spaces.length - LEGEND_MAX} more namespaces not in the key; colours repeat after ${SPACE_COLORS.length}, so a colour is not a unique namespace`))+ else if (spaces.length > SPACE_COLORS.length) rows.push(note(ctx, `colours repeat after ${SPACE_COLORS.length} namespaces, so a colour is not a unique namespace`))+rows.push(note(ctx, hasCounts ? 'dot size is how often the entry was read: · never • 1-2 ● 3-9 ◉ 10 or more' : 'read counts n/a (the map’s own list is not loaded yet): every dot is drawn as a speck'))rows.push(diff --git a/plugins/ruflo-console/tests/memmap.spec.ts b/plugins/ruflo-console/tests/memmap.spec.tsindex 20af4d921b..0226ec30f5 100644--- a/plugins/ruflo-console/tests/memmap.spec.ts+++ b/plugins/ruflo-console/tests/memmap.spec.ts@@ -199,3 +199,31 @@ describe('the optimised projection and layout cache', () => {expect(layout([...list])).toEqual(layout(list))})})++describe('bounds', () => {+ it('names at most 12 namespaces in the key and says colours repeat', () => {+ const state = newState({ boot: false })++ state.probes.set('memmap', { value: Array.from({ length: 60 }, (_, i) => ({ key: `k${i}`, namespace: `ns-${String(i).padStart(2, '0')}`, hasVector: false })), error: null, okAtMs: 4_000 } as never)++ const shown = texts(memmapRows(ctxOf(state))).join('\n')++ expect(shown).toContain('ns-11')+ expect(shown).not.toContain('ns-12 ')+ expect(shown).toContain('+ 48 more namespaces')+ })++ it('ignores an embedding longer than 4096 numbers rather than projecting it', () => {+ const long = JSON.stringify([{ key: 'k', namespace: 'n', embedding: Array.from({ length: 5000 }, () => 0.1) }])++ expect(mapEntriesOf(long)?.[0]?.vector).toBeUndefined()+ })+})++describe('registration', () => {+ it('runs the memmap probe from the controller, so the read counts are not permanently n/a', async () => {+ const { readFileSync } = await import('node:fs')++ expect(readFileSync(new URL('../hooks/controller.ts', import.meta.url), 'utf8')).toMatch(/ALL_PROBES = \[[^\]]*memmapProbe/)+ })+})