π 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
chore(console): port the SVG demo exporter from Python to Node
RuFlodc38c094aeb2
diff --git a/plugins/ruflo-console/README.md b/plugins/ruflo-console/README.mdindex 18ac88c57b..38bcdcd13c 100644--- a/plugins/ruflo-console/README.md+++ b/plugins/ruflo-console/README.md@@ -129,13 +129,13 @@ npx tsx plugins/ruflo-console/scripts/theme-demo.mts /tmp/ruflo-demo-newUse a fresh output directory. The capture refuses to overwrite an existing `demo-session.json`; omitting the directory creates a unique temporary directory and prints its path. Outputs are `frames.json` (the captured terminal cells for every step, with a caption, palette and column count) and `receipt.json` (what was and was not exercised: no native host, no AI provider). Turning the frames into a GIF or video is left to your own renderer; the repository ships none, so no Python or image library is needed.-For a genuine animated vector export of those same captured frames, install Python fontTools and run:+For a genuine animated vector export of those same captured frames, run (Node only):```sh-python3 plugins/ruflo-console/scripts/render-theme-svg.py /tmp/ruflo-demo-new+node plugins/ruflo-console/scripts/render-theme-svg.mjs /tmp/ruflo-demo-new```-`ruflo-console-demo.svg` contains outlined glyphs, block paths and reusable row symbols, replayed with native SVG discrete animation over the same 38 seconds. It has no embedded images, video, scripts, external fonts or other external assets. The complete 456-frame replay is approximately 20 MB. It scales through its viewBox; open the file in an SVG animation capable browser when a document preview shows only a still frame.+`ruflo-console-demo.svg` contains text runs, block rectangles and reusable row symbols (the font is your system monospace), replayed with native SVG discrete animation over the same 38 seconds. It has no embedded images, video, scripts or other external assets. The complete 456-frame replay is approximately 20 MB. It scales through its viewBox; open the file in an SVG animation capable browser when a document preview shows only a still frame.The terminal color picker provides swatches and exact `#RRGGBB` entry for headings, success, failure, warning, information and background. Preview the globe and swarm motion, adjust speed and decorative layers, then **Save preview and apply**. Up to twelve named custom presets are stored locally through the host; reusing a name replaces that preset. Failed saves leave the active theme unchanged. Settings `fps: 0` still disables animation. Layouts retain the compact/narrow fallbacks.diff --git a/plugins/ruflo-console/scripts/render-theme-svg.mjs b/plugins/ruflo-console/scripts/render-theme-svg.mjsnew file mode 100644index 0000000000..943c1f261a--- /dev/null+++ b/plugins/ruflo-console/scripts/render-theme-svg.mjs@@ -0,0 +1,58 @@+/** Animated vector replay of theme-demo.mts cell frames: native SVG discrete animation, no scripts, images, video or external assets. Node only. */+import { readFileSync, writeFileSync } from 'node:fs'+import { createHash } from 'node:crypto'+import { resolve } from 'node:path'++const root = resolve(process.argv[2] ?? '/tmp/ruflo-console-demo')+const frames = JSON.parse(readFileSync(resolve(root, 'frames.json'), 'utf8'))+const width = 1208+let height = 120 + Math.max(...frames.map(f => f.rows.length)) * 19+height += height % 2+const fps = 12, duration = frames.length / fps+const esc = s => s.replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[c])+const FONT = 'font-family="DejaVu Sans Mono, Menlo, Consolas, monospace"'+const rows = new Map()+const rowId = cells => {+ const key = JSON.stringify(cells.map(c => [c.ch, c.fg, c.bg ?? null]))+ if (rows.has(key)) return rows.get(key).id+ const id = `r${rows.size}`, out = []+ for (let start = 0, end; start < cells.length; start = end) {+ const color = cells[start].bg+ for (end = start + 1; end < cells.length && cells[end].bg === color; end++);+ if (color) out.push(`<rect fill="${color}" x="${start * 10}" y="0" width="${(end - start) * 10}" height="19"/>`)+ }+ // Block glyphs are drawn as rectangles so they stay crisp; other characters share one text run per foreground colour.+ let run = null+ const flush = () => { if (run) out.push(`<text ${FONT} font-size="16" fill="${run.fg}" x="${run.x}" y="15" xml:space="preserve">${esc(run.text)}</text>`); run = null }+ cells.forEach((c, x) => {+ if (c.ch === 'β' || c.ch === 'β' || c.ch === 'β') {+ flush()+ const y = c.ch === 'β' ? 9 : 0, h = c.ch === 'β' ? 9 : c.ch === 'β' ? 10 : 19+ out.push(`<rect fill="${c.fg}" x="${x * 10}" y="${y}" width="10" height="${h}"/>`)+ } else if (c.ch === ' ') flush()+ else if (run && run.fg === c.fg && run.next === x) { run.text += c.ch; run.next = x + 1 }+ else { flush(); run = { fg: c.fg, x: x * 10, text: c.ch, next: x + 1 } }+ })+ flush()+ rows.set(key, { id, svg: `<g id="${id}">${out.join('')}</g>` })+ return id+}+const label = (s, x, y, fg, size = 16) => `<text ${FONT} font-size="${size}" fill="${fg}" x="${x}" y="${y + size - 1}" xml:space="preserve">${esc(s)}</text>`+const parts = frames.map((f, n) => {+ const start = n / frames.length, end = (n + 1) / frames.length+ const [times, values] = n === 0 ? [`0;${end.toFixed(12)};1`, 'visible;hidden;hidden']+ : n === frames.length - 1 ? [`0;${start.toFixed(12)};1`, 'hidden;visible;visible']+ : [`0;${start.toFixed(12)};${end.toFixed(12)};1`, 'hidden;visible;hidden;hidden']+ const left = 24 + (116 - f.columns) * 5+ return `<g id="frame${n}" visibility="${n === 0 ? 'visible' : 'hidden'}"><animate attributeName="visibility" calcMode="discrete" values="${values}" keyTimes="${times}" dur="${duration}s" repeatCount="indefinite"/>`+ + `<rect fill="${f.bg}" width="${width}" height="${height}"/>`+ + label('RUFLO / COMPLETE THEME WORKFLOW', 24, 16, f.accent) + label(f.caption, 24, 45, '#a8b2bd', 12)+ + `<path stroke="${f.accent}" d="M24 68H${width - 24}"/>`+ + f.rows.map((row, y) => `<use href="#${rowId(row)}" x="${left}" y="${78 + y * 19}"/>`).join('')+ + `<path stroke="${f.accent}" stroke-width="2" d="M24 ${height - 35}H${(24 + (width - 48) * (n + 1) / frames.length).toFixed(4)}"/>`+ + label('RENDERER DEMO / real UI actions + disk persistence / native host and AI generation unverified', 24, height - 23, '#a8b2bd', 12) + '</g>'+})+const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" role="img" aria-labelledby="title desc"><title id="title">Ruflo console theme workflow</title><desc id="desc">${Math.round(duration)} second replay of actual renderer frames. Boot, six presets, customization, persistence, JSON import and resize. Native host and AI provider execution are unverified.</desc><defs>${[...rows.values()].map(r => r.svg).join('')}</defs>${parts.join('')}</svg>`+const file = resolve(root, 'ruflo-console-demo.svg')+writeFileSync(file, svg)+console.log(JSON.stringify({ file, bytes: Buffer.byteLength(svg), frames: frames.length, seconds: duration, rowSymbols: rows.size, sha256: createHash('sha256').update(svg).digest('hex') }))diff --git a/plugins/ruflo-console/scripts/render-theme-svg.py b/plugins/ruflo-console/scripts/render-theme-svg.pydeleted file mode 100644index acbfc158be..0000000000--- a/plugins/ruflo-console/scripts/render-theme-svg.py+++ /dev/null@@ -1,60 +0,0 @@-"""Vector replay of theme-demo.mts cell frames, with no scripts or external assets."""-import sys, json, hashlib-from pathlib import Path-from fontTools.ttLib import TTFont-from fontTools.pens.svgPathPen import SVGPathPen--root=Path(sys.argv[1] if len(sys.argv)>1 else '/tmp/ruflo-console-demo')-frames=json.loads((root/'frames.json').read_text())-width=1208-height=120+max(len(f['rows']) for f in frames)*19-height+=height%2-fps=12;duration=len(frames)/fps-font=TTFont('/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf')-glyphset=font.getGlyphSet();cmap=font.getBestCmap();upm=font['head'].unitsPerEm-glyphs={};rows={};parts=[]-def glyph(ch,size=16):- key=(ch,size)- if key not in glyphs:- pen=SVGPathPen(glyphset);glyphset[cmap.get(ord(ch),'.notdef')].draw(pen)- ident=f'g{ord(ch):x}_{size}'- glyphs[key]=(ident,f'<g id="{ident}" transform="translate(0,{15 if size==16 else 12}) scale({size/upm}, {-size/upm})"><path d="{pen.getCommands()}"/></g>')- return glyphs[key][0]-def lettering(s,x,y,color,size=16):- advance=9.6328125 if size==16 else 7.224609375- return f'<g fill="{color}" transform="translate({x},{y})">'+''.join(f'<use href="#{glyph(ch,size)}" x="{i*advance:g}"/>' for i,ch in enumerate(s) if ch!=' ')+'</g>'-def row_id(cells):- key=tuple((c['ch'],c['fg'],c.get('bg')) for c in cells)- if key in rows:return rows[key][0]- ident=f'r{len(rows)}';out=[]- start=0- while start<len(cells):- color=cells[start].get('bg');end=start+1- while end<len(cells) and cells[end].get('bg')==color:end+=1- if color:out.append(f'<path fill="{color}" d="M{start*10} 0h{(end-start)*10}v19H{start*10}z"/>')- start=end- for x,c in enumerate(cells):- ch=c['ch'];fg=c['fg']- if ch in ['β','β','β']:- y=9 if ch=='β' else 0;h=9 if ch=='β' else 10 if ch=='β' else 19- out.append(f'<path fill="{fg}" d="M{x*10} {y}h10v{h}h-10z"/>')- elif ch!=' ':out.append(f'<use href="#{glyph(ch)}" x="{x*10}" fill="{fg}"/>')- rows[key]=(ident,f'<g id="{ident}">'+''.join(out)+'</g>')- return ident-for n,f in enumerate(frames):- start=n/len(frames);end=(n+1)/len(frames)- if n==0:times=f'0;{end:.12f};1';values='visible;hidden;hidden'- elif n==len(frames)-1:times=f'0;{start:.12f};1';values='hidden;visible;visible'- else:times=f'0;{start:.12f};{end:.12f};1';values='hidden;visible;hidden;hidden'- out=[f'<g id="frame{n}" visibility="{ "visible" if n==0 else "hidden"}"><animate attributeName="visibility" calcMode="discrete" values="{values}" keyTimes="{times}" dur="{duration:g}s" repeatCount="indefinite"/>',f'<path fill="{f["bg"]}" d="M0 0h{width}v{height}H0z"/>']- out.append(lettering('RUFLO / COMPLETE THEME WORKFLOW',24,16,f['accent']))- out.append(lettering(f['caption'],24,45,'#a8b2bd',12))- out.append(f'<path stroke="{f["accent"]}" d="M24 68H{width-24}"/>')- left=24+(116-f['columns'])*5- for y,row in enumerate(f['rows']):out.append(f'<use href="#{row_id(row)}" x="{left}" y="{78+y*19}"/>')- out.append(f'<path stroke="{f["accent"]}" stroke-width="2" d="M24 {height-35}H{24+(width-48)*(n+1)/len(frames):.4f}"/>')- out.append(lettering('RENDERER DEMO / real UI actions + disk persistence / native host and AI generation unverified',24,height-23,'#a8b2bd',12))- out.append('</g>');parts.append(''.join(out))-svg=f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" viewBox="0 0 {width} {height}" role="img" aria-labelledby="title desc"><title id="title">Ruflo console theme workflow</title><desc id="desc">38 second replay of actual renderer frames. Boot, six presets, customization, persistence, JSON import and resize. Native host and AI provider execution are unverified.</desc><defs>'+''.join(v[1] for v in glyphs.values())+''.join(v[1] for v in rows.values())+'</defs>'+''.join(parts)+'</svg>'-path=root/'ruflo-console-demo.svg';path.write_text(svg)-print(json.dumps({'file':str(path),'bytes':path.stat().st_size,'frames':len(frames),'seconds':duration,'rowSymbols':len(rows),'glyphSymbols':len(glyphs),'sha256':hashlib.sha256(path.read_bytes()).hexdigest()}))