Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(brain): add Rapid Reader (Spritz-style RSVP speed reading)

Adam Eivy69e182ab7d12
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index cbfef6dc08..2ccb90023c 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -14,6 +14,8 @@
## Added
+- **Rapid Reader — Spritz-style RSVP speed reading.** New `/rapid-reader` page (Brain section) takes pasted prose and plays it back word-by-word at a configurable WPM (100–1000), with the focal letter ("Optimal Recognition Point") highlighted in red so the eye stays anchored to the center guide. Supports 1-word and 2-word chunks, color picker for the focal letter, paste-from-clipboard, and keyboard controls (space play/pause, ← → step, R restart, +/− WPM, Esc close). Per-token delay scales with sentence/clause boundaries and long-word penalty so reading stays comfortable at high speeds. Implemented as a reusable `<RapidReader>` component plus `<RapidReaderModal>` and `<RapidReaderTrigger>` wrappers — drop a `RapidReaderTrigger` next to any text-bearing surface to open the reader as a modal without leaving the page. First integration: a "Rapid Read" button in the Daily Briefing tab header that strips markdown markers and feeds the briefing prose into the reader. Voice nav resolves "rapid reader", "speed reader", and "rsvp" to the page. Files: `client/src/components/RapidReader.jsx`, `client/src/pages/RapidReader.jsx`, `client/src/App.jsx`, `client/src/components/Layout.jsx`, `client/src/components/cos/tabs/BriefingTab.jsx`, `server/lib/navManifest.js`.
+
- **Image Gen + Video Gen — hide/unhide media cards.** Each generated image/video now has an Eye/EyeOff toggle in its action row that moves the card into a per-page "hidden" section. Cards in the hidden section show as "Unhide" instead of "Hide". A collapsible "Show hidden (N) ▸" / "Hide hidden (N) ▾" toggle below the recent-renders grid reveals the hidden cards on demand. Server: `POST /api/image-gen/:filename/visibility` mutates the per-image sidecar JSON; `POST /api/video-gen/history/:id/visibility` mutates the matching record in `data/video-history.json`. Client: optimistic state update with rollback on server failure. The `hidden` flag flows through the existing normalizers so any future MediaCard consumer (e.g. Media History, gallery search) can opt into the same UI just by passing `onToggleHidden`. Files: `server/routes/imageGen.js`, `server/routes/videoGen.js`, `server/services/imageGen/local.js`, `server/services/videoGen/local.js`, `client/src/services/apiImageVideo.js`, `client/src/components/media/{MediaCard.jsx,normalize.js}`, `client/src/pages/{ImageGen.jsx,VideoGen.jsx}`.
- **Flux image-to-image (i2i) on the Image Gen page.** When Local mode is selected, a new "Init image" section under the model/seed grid lets the user upload a source image (PNG/JPG/WebP, ≤20MB) or pre-fill from a gallery basename via `?initImageFile=foo.png`. A strength slider (0.0 closer-to-source ... 1.0 freer-remix, default 0.4) controls how much of the source survives the diffusion. Server: `mflux-generate` is now invoked with `--image-path <path>` and `--image-strength <0..1>` when an init image is set; the path is realpath-validated against `PATHS.images` (defense-in-depth in both the route and the service). The route gained an `optionalUpload('initImage', ...)` middleware (also exported from `server/lib/multipart.js` for reuse) that no-ops on JSON bodies, so the existing JSON callers (SDAPI bridge, avatar route, the Imagine page's old payload) keep working unchanged. The dispatcher silently drops the i2i fields for External/Codex modes (which don't support i2i) so a misrouted payload still produces a useful txt2img result. The init image filename + strength are persisted to the metadata sidecar so a remix or audit can recover them. Client now exports a shared `buildFormData(fields)` helper used by both `generateVideo` and the new i2i upload branch in `ImageGen.jsx`. Files: `server/lib/multipart.js`, `server/routes/imageGen.js`, `server/services/imageGen/{index.js,local.js}`, `client/src/services/apiImageVideo.js`, `client/src/pages/ImageGen.jsx`.
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 7527db4fa2..33efddef03 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -72,6 +72,7 @@ const Review = lazyWithReload(() => import('./pages/Review'));
const Loops = lazyWithReload(() => import('./pages/Loops'));
const CharacterSheet = lazyWithReload(() => import('./pages/CharacterSheet'));
const Wiki = lazyWithReload(() => import('./pages/Wiki'));
+const RapidReaderPage = lazyWithReload(() => import('./pages/RapidReader'));
// Loading fallback for lazy-loaded pages
const PageLoader = () => (
@@ -190,6 +191,7 @@ export default function App() {
<Route path="media-models" element={<RedirectWithSearch to="/media/models" />} />
<Route path="wiki" element={<Navigate to="/wiki/overview" replace />} />
<Route path="wiki/:tab" element={<Wiki />} />
+ <Route path="rapid-reader" element={<RapidReaderPage />} />
<Route path="agents" element={<Agents />} />
<Route path="agents/:agentId" element={<Agents />} />
<Route path="agents/:agentId/:tab" element={<Agents />} />
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index 3cd3ff6435..480cb6c4b1 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -123,6 +123,7 @@ const navItems = [
{ to: '/brain/links', label: 'Links', icon: Link2 },
{ to: '/brain/memory', label: 'Memory', icon: Database },
{ to: '/brain/notes', label: 'Notes', icon: FileText },
+ { to: '/rapid-reader', label: 'Rapid Reader', icon: Zap },
{ to: '/brain/trust', label: 'Trust', icon: Shield }
]
},
diff --git a/client/src/components/RapidReader.jsx b/client/src/components/RapidReader.jsx
new file mode 100644
index 0000000000..77c754e54d
--- /dev/null
+++ b/client/src/components/RapidReader.jsx
@@ -0,0 +1,363 @@
+import { useEffect, useMemo, useRef, useState, useCallback } from 'react';
+import { Play, Pause, RotateCcw, Rewind, FastForward, X, Zap } from 'lucide-react';
+
+// Optimal Recognition Point — the focal letter the eye lands on. Spritz-style:
+// shorter words use a left-shifted ORP, longer words shift right. Returns the
+// index into the trimmed word that should be highlighted.
+const orpIndex = (word) => {
+ const w = word || '';
+ const len = w.length;
+ if (len <= 1) return 0;
+ if (len <= 5) return 1;
+ if (len <= 9) return 2;
+ if (len <= 13) return 3;
+ return 4;
+};
+
+// Tokenize while preserving punctuation attached to words. Strips empty tokens.
+// Each token may be one or two words depending on `chunkSize`. Short connector
+// words (≤3 chars) merge into the next token when chunkSize=2 — feels natural
+// at speed and keeps WPM honest.
+const tokenize = (text, chunkSize) => {
+ if (!text) return [];
+ const raw = text.replace(/\s+/g, ' ').trim().split(' ').filter(Boolean);
+ if (chunkSize === 1) return raw;
+ const out = [];
+ let i = 0;
+ while (i < raw.length) {
+ const a = raw[i];
+ const b = raw[i + 1];
+ if (b && (a.length <= 3 || b.length <= 3) && (a.length + b.length) <= 12) {
+ out.push(`${a} ${b}`);
+ i += 2;
+ } else {
+ out.push(a);
+ i += 1;
+ }
+ }
+ return out;
+};
+
+// Sentence-end detection: word ends with terminal punctuation. Used to add a
+// brief extra pause so the reader can register the boundary.
+const endsSentence = (word) => /[.!?…]"?$/.test(word || '');
+const endsClause = (word) => /[,;:)]"?$/.test(word || '');
+
+// Core reader display — drop into any container. Self-paced; emits onComplete
+// when the last token is shown.
+export default function RapidReader({
+ text = '',
+ wpm: initialWpm = 350,
+ chunkSize: initialChunk = 1,
+ focalColor = '#ef4444',
+ autoPlay = false,
+ compact = false,
+ onClose,
+ onComplete
+}) {
+ const [wpm, setWpm] = useState(initialWpm);
+ const [chunkSize, setChunkSize] = useState(initialChunk);
+ const [idx, setIdx] = useState(0);
+ const [playing, setPlaying] = useState(autoPlay);
+ const timeoutRef = useRef(null);
+
+ const tokens = useMemo(() => tokenize(text, chunkSize), [text, chunkSize]);
+ const total = tokens.length;
+ const current = tokens[idx] || '';
+
+ // Keep idx in range when text/chunkSize changes
+ useEffect(() => {
+ if (idx >= tokens.length && tokens.length > 0) setIdx(tokens.length - 1);
+ }, [tokens.length, idx]);
+
+ // Per-token delay: base = 60000/wpm ms. Long chunks and sentence boundaries
+ // get extra time; ultra-short tokens get a small bonus too.
+ const delayFor = useCallback((token) => {
+ const base = 60000 / Math.max(60, wpm);
+ let mult = 1;
+ if (endsSentence(token)) mult = 1.8;
+ else if (endsClause(token)) mult = 1.3;
+ if (token && token.length > 8) mult *= 1.15;
+ return base * mult;
+ }, [wpm]);
+
+ useEffect(() => {
+ if (!playing) {
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
+ return;
+ }
+ if (idx >= total) {
+ setPlaying(false);
+ onComplete?.();
+ return;
+ }
+ timeoutRef.current = setTimeout(() => {
+ setIdx((i) => i + 1);
+ }, delayFor(current));
+ return () => clearTimeout(timeoutRef.current);
+ }, [playing, idx, total, current, delayFor, onComplete]);
+
+ // Keyboard controls — only active when this component is mounted.
+ useEffect(() => {
+ const onKey = (e) => {
+ if (e.target?.tagName === 'INPUT' || e.target?.tagName === 'TEXTAREA') return;
+ if (e.key === ' ') { e.preventDefault(); setPlaying((p) => !p); }
+ else if (e.key === 'ArrowLeft') setIdx((i) => Math.max(0, i - 1));
+ else if (e.key === 'ArrowRight') setIdx((i) => Math.min(total - 1, i + 1));
+ else if (e.key === 'r' || e.key === 'R') { setIdx(0); setPlaying(true); }
+ else if (e.key === '+' || e.key === '=') setWpm((w) => Math.min(1200, w + 25));
+ else if (e.key === '-' || e.key === '_') setWpm((w) => Math.max(100, w - 25));
+ else if (e.key === 'Escape' && onClose) onClose();
+ };
+ window.addEventListener('keydown', onKey);
+ return () => window.removeEventListener('keydown', onKey);
+ }, [total, onClose]);
+
+ const restart = () => { setIdx(0); setPlaying(true); };
+ const togglePlay = () => {
+ if (idx >= total - 1) { restart(); return; }
+ setPlaying((p) => !p);
+ };
+ const back = () => { setPlaying(false); setIdx((i) => Math.max(0, i - 5)); };
+ const fwd = () => { setPlaying(false); setIdx((i) => Math.min(total - 1, i + 5)); };
+
+ const progress = total ? ((idx + 1) / total) * 100 : 0;
+ const elapsedSec = Math.round(((idx + 1) * 60) / Math.max(60, wpm));
+ const totalSec = Math.round((total * 60) / Math.max(60, wpm));
+
+ if (!total) {
+ return (
+ <div className={`bg-port-card border border-port-border rounded-lg p-6 text-center text-gray-500 ${compact ? '' : 'min-h-64'}`}>
+ Paste or pass some text to start reading.
+ </div>
+ );
+ }
+
+ return (
+ <div className="bg-port-card border border-port-border rounded-lg overflow-hidden">
+ {/* Reader display */}
+ <div className={`relative bg-port-bg flex items-center justify-center ${compact ? 'py-10' : 'py-16 sm:py-24'}`}>
+ {/* Center alignment guide — vertical line at the focal point */}
+ <div
+ className="absolute top-0 bottom-0 left-1/2 -translate-x-1/2 w-px bg-port-border/50 pointer-events-none"
+ aria-hidden="true"
+ />
+ <div
+ className="relative font-mono text-3xl sm:text-5xl tracking-wide text-white whitespace-pre"
+ style={{ minWidth: '12ch' }}
+ >
+ {/* Position chunk so its focal letter sits on the center guide */}
+ <FocalSlot chunk={current} focalColor={focalColor} />
+ </div>
+ </div>
+
+ {/* Progress bar */}
+ <div className="h-1 bg-port-border/40">
+ <div
+ className="h-full bg-port-accent transition-[width] duration-150"
+ style={{ width: `${progress}%` }}
+ />
+ </div>
+
+ {/* Controls */}
+ <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-3 bg-port-card">
+ <div className="flex items-center gap-2">
+ <button
+ type="button"
+ onClick={back}
+ className="min-h-10 min-w-10 flex items-center justify-center rounded-lg border border-port-border text-gray-400 hover:text-white hover:bg-port-bg/60"
+ title="Back 5 (←)"
+ aria-label="Back 5 words"
+ >
+ <Rewind size={16} />
+ </button>
+ <button
+ type="button"
+ onClick={togglePlay}
+ className="min-h-10 min-w-10 flex items-center justify-center rounded-lg bg-port-accent/15 border border-port-accent/40 text-port-accent hover:bg-port-accent/25"
+ title={playing ? 'Pause (space)' : 'Play (space)'}
+ aria-label={playing ? 'Pause' : 'Play'}
+ >
+ {playing ? <Pause size={16} /> : <Play size={16} />}
+ </button>
+ <button
+ type="button"
+ onClick={fwd}
+ className="min-h-10 min-w-10 flex items-center justify-center rounded-lg border border-port-border text-gray-400 hover:text-white hover:bg-port-bg/60"
+ title="Forward 5 (→)"
+ aria-label="Forward 5 words"
+ >
+ <FastForward size={16} />
+ </button>
+ <button
+ type="button"
+ onClick={restart}
+ className="min-h-10 min-w-10 flex items-center justify-center rounded-lg border border-port-border text-gray-400 hover:text-white hover:bg-port-bg/60"
+ title="Restart (R)"
+ aria-label="Restart"
+ >
+ <RotateCcw size={16} />
+ </button>
+ {onClose && (
+ <button
+ type="button"
+ onClick={onClose}
+ className="min-h-10 min-w-10 flex items-center justify-center rounded-lg border border-port-border text-gray-400 hover:text-white hover:bg-port-bg/60 ml-1"
+ title="Close (Esc)"
+ aria-label="Close"
+ >
+ <X size={16} />
+ </button>
+ )}
+ </div>
+
+ <div className="flex flex-wrap items-center gap-3 text-xs text-gray-400">
+ <label className="flex items-center gap-2">
+ <span className="text-gray-500">WPM</span>
+ <input
+ type="range"
+ min={100}
+ max={1000}
+ step={25}
+ value={wpm}
+ onChange={(e) => setWpm(Number(e.target.value))}
+ className="w-28 sm:w-32 accent-port-accent"
+ />
+ <span className="font-mono text-gray-300 w-10 text-right">{wpm}</span>
+ </label>
+ <div className="flex items-center gap-1 border border-port-border rounded-md overflow-hidden">
+ <button
+ type="button"
+ onClick={() => setChunkSize(1)}
+ className={`px-2 py-1 text-xs ${chunkSize === 1 ? 'bg-port-accent/20 text-port-accent' : 'text-gray-400 hover:text-white'}`}
+ aria-pressed={chunkSize === 1}
+ >
+ 1w
+ </button>
+ <button
+ type="button"
+ onClick={() => setChunkSize(2)}
+ className={`px-2 py-1 text-xs ${chunkSize === 2 ? 'bg-port-accent/20 text-port-accent' : 'text-gray-400 hover:text-white'}`}
+ aria-pressed={chunkSize === 2}
+ >
+ 2w
+ </button>
+ </div>
+ <span className="font-mono text-gray-500">
+ {idx + 1}/{total} · {elapsedSec}s/{totalSec}s
+ </span>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+// Layout helper that anchors the focal letter on the vertical center guide.
+// Splits the chunk so the focal char's left edge sits at the container midpoint.
+function FocalSlot({ chunk, focalColor }) {
+ const parts = chunk.split(' ');
+ const target = parts.length === 2
+ ? (parts[0].length >= parts[1].length ? 0 : 1)
+ : 0;
+ const word = parts[target] || '';
+ const idx = orpIndex(word);
+ const left = word.slice(0, idx);
+ const focal = word.charAt(idx);
+ const right = word.slice(idx + 1);
+
+ // Build the left/right halves around the focal char.
+ const leftHalf = parts.length === 2 && target === 1
+ ? `${parts[0]} ${left}`
+ : left;
+ const rightHalf = parts.length === 2 && target === 0
+ ? `${right} ${parts[1]}`
+ : right;
+
+ return (
+ <div className="flex items-baseline justify-center">
+ <span className="text-right" style={{ flex: '1 1 0', whiteSpace: 'pre' }}>
+ {leftHalf}
+ </span>
+ <span style={{ color: focalColor }}>{focal}</span>
+ <span className="text-left" style={{ flex: '1 1 0', whiteSpace: 'pre' }}>
+ {rightHalf}
+ </span>
+ </div>
+ );
+}
+
+// Modal wrapper — full-screen overlay so any page can pop the reader without
+// leaving its context. Closes on Esc or backdrop click.
+export function RapidReaderModal({ open, text, title, onClose, ...readerProps }) {
+ if (!open) return null;
+ return (
+ <div
+ className="fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4"
+ role="dialog"
+ aria-modal="true"
+ aria-label={title || 'Rapid Reader'}
+ onClick={(e) => { if (e.target === e.currentTarget) onClose?.(); }}
+ >
+ <div className="w-full max-w-3xl bg-port-card border border-port-border rounded-xl shadow-2xl">
+ <div className="flex items-center justify-between gap-2 px-4 py-2 border-b border-port-border">
+ <div className="flex items-center gap-2 text-sm text-gray-300 truncate">
+ <Zap size={14} className="text-port-accent shrink-0" />
+ <span className="truncate">{title || 'Rapid Reader'}</span>
+ </div>
+ <button
+ type="button"
+ onClick={onClose}
+ className="min-h-10 min-w-10 flex items-center justify-center text-gray-400 hover:text-white"
+ aria-label="Close rapid reader"
+ >
+ <X size={18} />
+ </button>
+ </div>
+ <RapidReader text={text} onClose={onClose} autoPlay {...readerProps} />
+ </div>
+ </div>
+ );
+}
+
+// One-line trigger button — drop next to any text-bearing surface to launch
+// the modal. Keeps the open/close state local so callers don't have to.
+export function RapidReaderTrigger({
+ getText,
+ text,
+ title,
+ label = 'Rapid Read',
+ className = '',
+ iconOnly = false,
+ ...readerProps
+}) {
+ const [open, setOpen] = useState(false);
+ const [resolvedText, setResolvedText] = useState('');
+
+ const launch = () => {
+ const t = typeof getText === 'function' ? getText() : (text || '');
+ setResolvedText(t || '');
+ setOpen(true);
+ };
+
+ return (
+ <>
+ <button
+ type="button"
+ onClick={launch}
+ className={`inline-flex items-center gap-1.5 min-h-10 px-3 py-1.5 rounded-lg border border-port-border text-sm text-gray-300 hover:text-white hover:border-port-accent/50 hover:bg-port-bg/40 transition-colors ${className}`}
+ title={label}
+ aria-label={label}
+ >
+ <Zap size={14} className="text-port-accent" />
+ {!iconOnly && <span>{label}</span>}
+ </button>
+ <RapidReaderModal
+ open={open}
+ text={resolvedText}
+ title={title}
+ onClose={() => setOpen(false)}
+ {...readerProps}
+ />
+ </>
+ );
+}
diff --git a/client/src/components/cos/tabs/BriefingTab.jsx b/client/src/components/cos/tabs/BriefingTab.jsx
index 33f07d681b..f6eef1e1f8 100644
--- a/client/src/components/cos/tabs/BriefingTab.jsx
+++ b/client/src/components/cos/tabs/BriefingTab.jsx
@@ -13,6 +13,7 @@ import {
GitBranch
} from 'lucide-react';
import * as api from '../../../services/api';
+import { RapidReaderTrigger } from '../../RapidReader';
const SECTION_ICONS = {
'Task Queue': CheckCircle,
@@ -31,6 +32,23 @@ const getSectionIcon = (title) => {
return ChevronRight;
};
+// Flatten markdown into plain prose suitable for word-by-word reading.
+// Drop heading/bullet/code markers but keep the surrounding text intact.
+const stripMarkdown = (md) => {
+ if (!md) return '';
+ return md
+ .split('\n')
+ .map((line) => line
+ .replace(/^#{1,6}\s+/, '')
+ .replace(/^\s*[-*]\s+/, '')
+ .replace(/^\s*\d+\.\s+/, '')
+ .replace(/\*\*([^*]+)\*\*/g, '$1')
+ .replace(/`([^`]+)`/g, '$1'))
+ .filter((line) => line.trim())
+ .join('. ')
+ .replace(/\.{2,}/g, '.');
+};
+
const parseBriefingMarkdown = (content) => {
if (!content) return { title: '', sections: [] };
@@ -216,13 +234,22 @@ export default function BriefingTab() {
</select>
)}
</div>
- <button
- onClick={loadData}
- className="flex items-center gap-2 px-3 py-1.5 text-sm bg-port-card border border-port-border hover:border-port-accent/50 text-gray-300 rounded-lg transition-colors"
- >
- <RefreshCw size={14} />
- Refresh
- </button>
+ <div className="flex items-center gap-2">
+ {currentBriefing?.content && (
+ <RapidReaderTrigger
+ text={stripMarkdown(currentBriefing.content)}
+ title={`Briefing — ${currentBriefing.date}`}
+ label="Rapid Read"
+ />
+ )}
+ <button
+ onClick={loadData}
+ className="flex items-center gap-2 px-3 py-1.5 text-sm bg-port-card border border-port-border hover:border-port-accent/50 text-gray-300 rounded-lg transition-colors"
+ >
+ <RefreshCw size={14} />
+ Refresh
+ </button>
+ </div>
</div>
{!parsed ? (
diff --git a/client/src/pages/RapidReader.jsx b/client/src/pages/RapidReader.jsx
new file mode 100644
index 0000000000..8e21077e61
--- /dev/null
+++ b/client/src/pages/RapidReader.jsx
@@ -0,0 +1,192 @@
+import { useState } from 'react';
+import { Zap, ClipboardPaste, Eraser } from 'lucide-react';
+import RapidReader from '../components/RapidReader';
+
+const SAMPLE = `Speed reading is a collection of techniques used to scan text quickly while still understanding what you've read. Most people read in chunks of three or four words at a time, which slows them down. Rapid serial visual presentation flashes one word at a time at a fixed location, removing the need to move your eyes. With practice, comprehension stays intact at three to five hundred words per minute, and many readers can push past six hundred for familiar material.`;
+
+const focalPalette = [
+ { value: '#ef4444', label: 'Red' },
+ { value: '#f59e0b', label: 'Amber' },
+ { value: '#22c55e', label: 'Green' },
+ { value: '#3b82f6', label: 'Blue' },
+ { value: '#a855f7', label: 'Purple' }
+];
+
+export default function RapidReaderPage() {
+ const [text, setText] = useState('');
+ const [active, setActive] = useState('');
+ const [wpm, setWpm] = useState(350);
+ const [chunkSize, setChunkSize] = useState(1);
+ const [focalColor, setFocalColor] = useState('#ef4444');
+
+ const start = () => {
+ const trimmed = text.trim();
+ if (!trimmed) return;
+ setActive(trimmed);
+ };
+
+ const reset = () => {
+ setActive('');
+ };
+
+ const pasteFromClipboard = async () => {
+ if (!navigator.clipboard?.readText) return;
+ const t = await navigator.clipboard.readText().catch(() => '');
+ if (t) setText(t);
+ };
+
+ const wordCount = text.trim() ? text.trim().split(/\s+/).length : 0;
+ const estSec = Math.round((wordCount * 60) / Math.max(60, wpm));
+
+ return (
+ <div className="space-y-6">
+ <div className="flex items-center gap-3">
+ <Zap className="w-5 h-5 text-port-accent" />
+ <div>
+ <h1 className="text-xl font-semibold text-white">Rapid Reader</h1>
+ <p className="text-sm text-gray-400">
+ Paste text and read it word-by-word with a highlighted focal letter (Spritz-style RSVP).
+ </p>
+ </div>
+ </div>
+
+ {active ? (
+ <div className="space-y-4">
+ <RapidReader
+ text={active}
+ wpm={wpm}
+ chunkSize={chunkSize}
+ focalColor={focalColor}
+ autoPlay
+ onClose={reset}
+ />
+ <div className="flex flex-wrap items-center gap-3 text-xs text-gray-500">
+ <span>Space = play/pause · ← → step · R restart · +/− WPM · Esc close</span>
+ </div>
+ </div>
+ ) : (
+ <div className="space-y-4">
+ <div className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
+ <div className="flex items-center justify-between gap-2">
+ <label htmlFor="rr-text" className="text-sm font-medium text-gray-300">
+ Text to read
+ </label>
+ <div className="flex items-center gap-2">
+ <button
+ type="button"
+ onClick={pasteFromClipboard}
+ className="inline-flex items-center gap-1.5 min-h-10 px-2.5 py-1.5 text-xs rounded-md border border-port-border text-gray-400 hover:text-white hover:border-port-accent/50"
+ title="Paste from clipboard"
+ >
+ <ClipboardPaste size={12} /> Paste
+ </button>
+ <button
+ type="button"
+ onClick={() => setText(SAMPLE)}
+ className="inline-flex items-center gap-1.5 min-h-10 px-2.5 py-1.5 text-xs rounded-md border border-port-border text-gray-400 hover:text-white hover:border-port-accent/50"
+ >
+ Sample
+ </button>
+ {text && (
+ <button
+ type="button"
+ onClick={() => setText('')}
+ className="inline-flex items-center gap-1.5 min-h-10 px-2.5 py-1.5 text-xs rounded-md border border-port-border text-gray-400 hover:text-white hover:border-port-accent/50"
+ title="Clear"
+ >
+ <Eraser size={12} /> Clear
+ </button>
+ )}
+ </div>
+ </div>
+ <textarea
+ id="rr-text"
+ value={text}
+ onChange={(e) => setText(e.target.value)}
+ rows={10}
+ placeholder="Paste an article, email, briefing, or any prose…"
+ className="w-full bg-port-bg border border-port-border rounded-md px-3 py-2 text-sm text-gray-200 placeholder-gray-600 font-mono focus:outline-none focus:border-port-accent/60"
+ />
+ <div className="flex flex-wrap items-center justify-between gap-3 text-xs text-gray-500">
+ <span>
+ {wordCount} word{wordCount === 1 ? '' : 's'} · approx {estSec}s at {wpm} WPM
+ </span>
+ </div>
+ </div>
+
+ <div className="bg-port-card border border-port-border rounded-lg p-4 space-y-4">
+ <div className="text-sm font-medium text-gray-300">Settings</div>
+ <div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
+ <label className="flex flex-col gap-1.5 text-xs text-gray-400">
+ <span>Words per minute</span>
+ <div className="flex items-center gap-3">
+ <input
+ type="range"
+ min={100}
+ max={1000}
+ step={25}
+ value={wpm}
+ onChange={(e) => setWpm(Number(e.target.value))}
+ className="flex-1 accent-port-accent"
+ />
+ <span className="font-mono text-sm text-gray-200 w-12 text-right">{wpm}</span>
+ </div>
+ </label>
+
+ <div className="flex flex-col gap-1.5 text-xs text-gray-400">
+ <span>Chunk size</span>
+ <div className="flex border border-port-border rounded-md overflow-hidden">
+ <button
+ type="button"
+ onClick={() => setChunkSize(1)}
+ className={`flex-1 min-h-10 px-3 text-sm ${chunkSize === 1 ? 'bg-port-accent/20 text-port-accent' : 'text-gray-400 hover:text-white'}`}
+ >
+ 1 word
+ </button>
+ <button
+ type="button"
+ onClick={() => setChunkSize(2)}
+ className={`flex-1 min-h-10 px-3 text-sm border-l border-port-border ${chunkSize === 2 ? 'bg-port-accent/20 text-port-accent' : 'text-gray-400 hover:text-white'}`}
+ >
+ 2 words
+ </button>
+ </div>
+ </div>
+
+ <div className="flex flex-col gap-1.5 text-xs text-gray-400">
+ <span>Focal color</span>
+ <div className="flex gap-2 flex-wrap">
+ {focalPalette.map((c) => (
+ <button
+ key={c.value}
+ type="button"
+ onClick={() => setFocalColor(c.value)}
+ title={c.label}
+ aria-label={`Focal ${c.label}`}
+ className={`w-9 h-9 rounded-md border-2 transition-colors ${focalColor === c.value ? 'border-white' : 'border-port-border hover:border-gray-400'}`}
+ style={{ backgroundColor: c.value }}
+ />
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div className="flex items-center gap-3">
+ <button
+ type="button"
+ onClick={start}
+ disabled={!text.trim()}
+ className="inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-lg bg-port-accent text-white font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-port-accent/90"
+ >
+ <Zap size={16} /> Start reading
+ </button>
+ <span className="text-xs text-gray-500">
+ Tip: many surfaces in PortOS expose a Rapid Read button — Briefing, Wiki notes, and more.
+ </span>
+ </div>
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index f4af08eb99..87efaece77 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -29,6 +29,7 @@ export const NAV_COMMANDS = [
{ id: 'nav.brain.links', path: '/brain/links', label: 'Links', section: 'Brain', aliases: ['brain-links'] },
{ id: 'nav.brain.memory', path: '/brain/memory', label: 'Memory', section: 'Brain', aliases: ['brain-memory', 'memory'] },
{ id: 'nav.brain.notes', path: '/brain/notes', label: 'Notes', section: 'Brain', aliases: ['brain-notes', 'notes'] },
+ { id: 'nav.rapid-reader', path: '/rapid-reader', label: 'Rapid Reader', section: 'Brain', aliases: ['rapid-reader', 'speed-reader', 'rsvp', 'spritz'], keywords: ['speed reading', 'rapid reading', 'rsvp', 'spritz', 'word per minute', 'wpm', 'focal'] },
{ id: 'nav.brain.trust', path: '/brain/trust', label: 'Trust', section: 'Brain', aliases: ['brain-trust'] },
{ id: 'nav.calendar.agenda', path: '/calendar/agenda', label: 'Agenda', section: 'Calendar', aliases: ['calendar', 'agenda'] },