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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (local): Core avatar no longer throws on mount; Black ICE headings keep their glow
[._.]/ Adam Eivy899536c87b50
diff --git a/client/src/components/cos/CoreCoSAvatar.jsx b/client/src/components/cos/CoreCoSAvatar.jsxindex aaf37c8ee6..b85075c1e9 100644--- a/client/src/components/cos/CoreCoSAvatar.jsx+++ b/client/src/components/cos/CoreCoSAvatar.jsx@@ -29,9 +29,10 @@ const STATE_MOTION = {// Edge color per state, parsed once — the draw loop must not re-parse hex// every frame for one of seven values.+const FALLBACK_EDGE_RGB = [0, 240, 255];const STATE_EDGE_RGB = Object.fromEntries(Object.entries(AGENT_STATES).map(([state, { color }]) => {- const { r, g, b } = parseColor(color);- return [state, [r, g, b]];+ const parsed = parseColor(color);+ return [state, parsed ? [parsed.r, parsed.g, parsed.b] : FALLBACK_EDGE_RGB];}));const FALLBACK_NODE_RGB = [255, 43, 214];diff --git a/client/src/components/cos/CoreCoSAvatar.test.jsx b/client/src/components/cos/CoreCoSAvatar.test.jsxindex 0e06e9fc87..71f883fda2 100644--- a/client/src/components/cos/CoreCoSAvatar.test.jsx+++ b/client/src/components/cos/CoreCoSAvatar.test.jsx@@ -80,6 +80,21 @@ describe('CoreCoSAvatar', () => {expect(cancelAnimationFrame.mock.calls.length).toBe(cancelsBefore);});+ // The DPR hook resizes on mount BEFORE the avatar's own effect installs its+ // draw function. happy-dom's 0×0 layout skips that resize, so this stubs a+ // real box — the shipped layout gives the frame an 8rem × 5/6 tile.+ it('mounts in a sized layout, sizes the bitmap to the device pixel ratio, and paints', () => {+ vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(200);+ vi.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockReturnValue(240);+ vi.stubGlobal('devicePixelRatio', 2);+ expect(() => render(<CoreCoSAvatar state="planning" />)).not.toThrow();+ const canvas = screen.getByTestId('core-avatar-canvas');+ expect([canvas.width, canvas.height]).toEqual([400, 480]);+ tick(0);+ const frame = drawCalls.at(-1);+ expect([frame.width, frame.height]).toEqual([200, 240]);+ });+it('holds a single static frame when the user prefers reduced motion', () => {reduceMotion = true;render(<CoreCoSAvatar state="thinking" />);diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex 953ef15c1c..ad040c4404 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -223,7 +223,7 @@ grep -i "what you want to do" client/src/hooks/README.md| `useMusicVideoManualTempo` | The manual-tempo fallback for a project whose auto-detected BPM is null: BPM/offset drafts (reset on project switch), tap-tempo estimation, and the persisted `setMusicVideoManualTempo` call. Returns `{ bpm, setBpm, offset, setOffset, saving, tap, submit }`. | The Music Video "No tempo detected" row. || `useCanvasDprSize` | DevicePixelRatio-aware canvas sizing shared by the piano-roll renderers (`<PianoRoll>`, `<MidiPianoRoll>`): sizes the bitmap to container-width × height (or the container height when `height` is `undefined`) at the DPR, applies the transform, and redraws via a `drawRef` on mount + every `ResizeObserver` resize (observer created once per height, never churned by draw-closure changes). Returns a ref holding the current CSS width so draw code doesn't measure the DOM per frame. | Both piano-roll canvases. || `useCanvasRollPalette` | Resolves a canvas palette into a ref — `rollPalette` by default, or any resolver passed as the second argument (the Core Assembly avatar reads `--port-accent-2`), re-resolving on theme switch (`data-port-theme` MutationObserver) and repainting through a `drawRef`. Hands back a ref, not state, so a theme swap redraws the imperative canvas without a React re-render. | Both piano-roll canvases need theme-aware accent/bg colors that canvas `fillStyle` can't read from CSS vars. |-| `usePrefersReducedMotion` | The user's `prefers-reduced-motion` setting as a boolean, tracking live changes. CSS animations honor the media query themselves; this is for imperative loops (a rAF canvas loop, a three.js frameloop) that must stop scheduling frames on their own. Consumed by `cos/CoreCoSAvatar.jsx` and `brain/tabs/BrainGraph.jsx`. |+| `usePrefersReducedMotion` | The user's `prefers-reduced-motion` setting as a boolean, tracking live changes. Consumed by `cos/CoreCoSAvatar.jsx` and `brain/tabs/BrainGraph.jsx`. | An imperative animation (a rAF canvas loop, a three.js frameloop) that must stop scheduling frames itself — CSS animations honor the media query on their own. || `useMidiNotes` | Fetch + parse a transcribed `.mid` file into the piano-roll view-model (`parseMidiFile` in `lib/midiNotes.js`), with a module-level per-URL cache so remounts (collapse, tab switches) don't refetch/reparse. Returns `{ status: 'idle'\|'loading'\|'ready'\|'error', data, error, reload }`; a generation counter drops stale in-flight responses on URL change/unmount. Plain `fetch` of the static file URL — errors surface inline, never as toasts (#2477). | `<MidiVisualization>` (Rounds ReferenceAnalysis + Music Video). || `useChordPlayer` | Chord-sheet play-along transport for a SongBook `tab`/`chordpro` sheet (#4104) — the chord counterpart of `useDrumPlayer`: parses the (already-transposed) text, owns one `createChordPlayer`, the practice settings (tempo + beats-per-chord persisted per song, count-in, machine-global click) and the sounding-chord highlight read off the audio clock. Returns `{ chordCount, hasChords, writtenTempo, bpm, setBpm, setBpmPercent, beatsPerBar, setBeatsPerBar, countInBars, setCountInBars, clickEnabled, setClickEnabled, playing, pulse, sounding, getPlayhead, toggle, stop }`. Timing edits stop playback rather than re-time a running schedule. | `<ChordTransportBar>` + `<ChordPreview>` (SongBook viewer/editor/importer). || `useDrumPlayer` | Drum play-along transport for a SongBook `drum` chart (#3115): parses the chart (`lib/drumNotation.js`), owns one `createDrumPlayer` per chart plus the practice settings and the sheet playhead. Returns `{ chart, barCount, writtenTempo, bpm, setBpm, setBpmPercent, countInBars, setCountInBars, loopEnabled, setLoopEnabled, loopFrom, loopTo, setLoopRange, clickEnabled, setClickEnabled, clickVolume, setClickVolume, kitId, setKitId, playing, activeStep, currentBar, toggle, stop }`. The practice tempo persists per song in `safeStorage` (never into the record) while the selected kit (`songbook:drumKit`), the click toggle (`songbook:drumClick`) and the click level (`songbook:drumClickVolume`) persist per MACHINE; a timing-critical edit (tempo / count-in / loop) STOPS playback rather than re-timing already-scheduled audio, while the click toggle, the click level and the kit swap apply live (raising the level off silence also unmutes, so the slider is never a dead control); the player + its interval + scheduled hits tear down on stop, chart change and unmount. | The SongBook viewer and snapshot-based drum previews. Don't hand-wire `createDrumPlayer` + BPM persistence + playhead state again. |diff --git a/client/src/hooks/useCanvasDprSize.js b/client/src/hooks/useCanvasDprSize.jsindex 3abcdd24a4..bb48b4f9e0 100644--- a/client/src/hooks/useCanvasDprSize.js+++ b/client/src/hooks/useCanvasDprSize.js@@ -38,7 +38,10 @@ export default function useCanvasDprSize(wrapRef, canvasRef, height, drawRef) {}const ctx = canvas.getContext('2d');if (ctx) ctx.setTransform(dpr, 0, 0, dpr, 0, 0);- drawRef.current();+ // A caller that installs its draw in a LATER effect (the Core Assembly+ // avatar's rAF loop) has nothing to paint yet on the mount resize; its+ // own loop paints the first frame a tick later.+ drawRef.current?.();};resize();const ro = new ResizeObserver(resize);diff --git a/client/src/themes/portosThemes.js b/client/src/themes/portosThemes.jsindex adaec4d7c8..12a4ba5adb 100644--- a/client/src/themes/portosThemes.js+++ b/client/src/themes/portosThemes.js@@ -455,6 +455,9 @@ export const THEMES = {'--port-font-ui': "'GeistPixelSquare', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",'--port-font-display': "'GeistPixelGrid', 'SFMono-Regular', Consolas, monospace",'--port-font-mono': "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",+ // The shared heading rule sets text-shadow explicitly, so restate the+ // body glow here or headings would lose what they used to inherit.+ '--port-heading-glow': '0 0 12px rgb(var(--port-accent) / 0.08)','--port-shadow-card': '0 0 0 1px rgb(var(--port-border) / 0.18), 0 0 26px rgb(var(--port-accent) / 0.08)','--port-shadow-elevated': '0 0 0 1px rgb(var(--port-border) / 0.3), 0 0 48px rgb(var(--port-accent) / 0.16), 0 18px 60px rgb(0 0 0 / 0.62)','--port-shadow-interactive': '0 0 0 1px rgb(var(--port-accent) / 0.45), 0 0 20px rgb(var(--port-accent) / 0.22)',@@ -540,6 +543,7 @@ export const THEMES = {'--port-font-ui': "'GeistPixelSquare', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",'--port-font-display': "'GeistPixelGrid', 'SFMono-Regular', Consolas, monospace",'--port-font-mono': "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",+ '--port-heading-glow': '0 0 8px rgb(var(--port-accent) / 0.04)','--port-shadow-card': '0 0 0 1px rgb(var(--port-border) / 0.18), 0 4px 14px -6px rgb(40 60 30 / 0.18)','--port-shadow-elevated': '0 0 0 1px rgb(var(--port-border) / 0.28), 0 12px 36px -10px rgb(40 60 30 / 0.22)','--port-shadow-interactive': '0 0 0 1px rgb(var(--port-accent) / 0.5)',diff --git a/docs/themes/README.md b/docs/themes/README.mdindex 7f95f193db..48ec46b816 100644--- a/docs/themes/README.md+++ b/docs/themes/README.md@@ -73,7 +73,7 @@ Full-screen effects are shared primitives, not per-theme CSS. A theme lists the## Typography tokens-Headings read `--port-heading-tracking` and `--port-heading-glow` (h1–h3) plus `--port-title-tracking` and `--port-title-transform` (h1 only), all defaulted to neutral in `:root`, so a theme sets its title treatment in the manifest instead of a selector block — Kestrel's uppercase, tracked, glowing titles are four tokens. The `glitch` effect rests on `--port-heading-glow`, so listing it never changes a theme's resting title look.+Headings read `--port-heading-tracking` and `--port-heading-glow` (h1–h3) plus `--port-title-tracking` and `--port-title-transform` (h1 only), defaulted to `0` / `none` in `:root`, so a theme sets its title treatment in the manifest instead of a selector block. Because the shared rule now sets `text-shadow` explicitly, a theme whose `body` carries a glow must restate it in `--port-heading-glow` for headings to keep it (Black ICE does) — Kestrel's uppercase, tracked, glowing titles are four tokens. The `glitch` effect rests on `--port-heading-glow`, so listing it never changes a theme's resting title look.Black ICE Terminal (both modes) uses `scanlines`; Kestrel Neon uses all five, and Kestrel Dawn `scanlines` + `grid-floor`.