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 (claude): surface truncated-stream EOF, tighten iframe sandbox, test in-stream error frame
Adam Eivyfad6b20a1859
diff --git a/PLAN.md b/PLAN.mdindex 20883332d6..ea1e132787 100644--- a/PLAN.md+++ b/PLAN.md@@ -21,6 +21,8 @@ the tracker until one is promoted to a real, claimable issue.- **Workspace Contexts** — project context syncing across shell, git, tasks.- **Inline Code Review Annotations** — one-click fix from self-improvement findings.- **AI-assisted panel/scene prompt generation** — reserve `pipeline-comic-panel-image-prompt.md` and `pipeline-storyboard-image-prompt.md` for a future "turn script fragment into N image-gen prompts" button.+- **Local LLM stream backpressure** — `POST /api/local-llm/test/stream` (`server/routes/localLlm.js`) ignores `res.write()`'s return value, so it never awaits `drain`. Fine under single-user/local trust + modest local-LLM token rates, but a fast model + slow client buffers NDJSON unbounded. Mirror `ask.js`'s drain-await if ever hardened. (Deferred from PR #872 review — NIT.)+- **Reasoning-only models stream in one chunk** — in `server/services/localLlmPlayground.js`, reasoning deltas aren't forwarded to `onChunk` during the stream (only content is), so a reasoning-only model's playground panel shows "Waiting for the first token…" the whole run, then the full text lands at once via the terminal result frame. To stream live, forward `delta.reasoning` during the loop AND drop the end-of-stream `onChunk(resolved)` re-emit so it doesn't double — but that touches the shared non-streaming TTFT-timing contract, so it was left as-is. (Deferred from PR #872 review — NIT.)- **Major Dependency Upgrades** — React 19, Zod 4, PM2 6, Vite 8.- **Workflow tab Phase 2** — drag-and-drop ordering of stages, custom user-defined stages, per-app workflow overrides.- **Inspiration & Mood Board Canvas** — dedicated mood-board surface for collecting visual + textual references that feed into Universe Builder, Writers Room, and Creative Director (distinct from raw Media History). Items can be pinned from any media surface; canvas surfaces ref images when starting a new universe / scene / treatment. Documented as a Secondary Goal in GOALS.md but had no tracking.diff --git a/client/src/components/localLlm/PlaygroundOutput.jsx b/client/src/components/localLlm/PlaygroundOutput.jsxindex bba853761b..9e67229f76 100644--- a/client/src/components/localLlm/PlaygroundOutput.jsx+++ b/client/src/components/localLlm/PlaygroundOutput.jsx@@ -101,11 +101,15 @@ function CodeBlock({ lang, code, closed }) {</div></div>{showPreview ? (- // Sandbox WITHOUT allow-same-origin so the model's markup/scripts can run- // (allow-scripts) but can't reach this page's DOM, cookies, or storage.+ // Minimal sandbox: allow-scripts so the markup's JS runs, allow-forms so+ // demo forms submit within the frame. Deliberately omit allow-same-origin+ // (can't reach this page's DOM/cookies/storage), allow-popups (no+ // window.open spam), and allow-modals (no blocking alert/prompt loops the+ // user can only escape by closing the tab) — none are needed to render a+ // page, and all widen the nuisance surface of untrusted model output.<iframetitle="HTML preview"- sandbox="allow-scripts allow-forms allow-modals allow-popups"+ sandbox="allow-scripts allow-forms"srcDoc={code}className="w-full h-72 md:h-96 bg-white"/>diff --git a/client/src/services/apiLocalLlm.js b/client/src/services/apiLocalLlm.jsindex ac239a6a99..c1abd48a43 100644--- a/client/src/services/apiLocalLlm.js+++ b/client/src/services/apiLocalLlm.js@@ -115,5 +115,11 @@ export async function streamLocalLlmTest(payload, { signal, onToken } = {}) {} finally {await reader.cancel().catch(() => {});}+ // A clean EOF that never delivered a `result` frame (server killed mid-stream,+ // truncated body, proxy cut the connection — all surface as read() done:true,+ // NOT an AbortError) would otherwise resolve null and be silently swallowed by+ // the caller's `if (!result) return`. Throw so the caller's .catch toasts it;+ // an intentional cancel sets signal.aborted and the caller suppresses that.+ if (!result && !signal?.aborted) throw new Error('Stream ended before a result was received');return result;}diff --git a/server/routes/localLlm.test.js b/server/routes/localLlm.test.jsindex 20c50ee704..11410d0359 100644--- a/server/routes/localLlm.test.js+++ b/server/routes/localLlm.test.js@@ -96,6 +96,24 @@ describe('local LLM playground routes', () => {]);});+ it('emits exactly one terminal result frame (no extra 500) when the run resolves an in-stream error', async () => {+ // A timed-out/aborted run resolves an { error, text } result rather than+ // throwing — the route must surface it as the single terminal frame.+ runLocalLlmTest.mockResolvedValue({+ backend: 'ollama', modelId: 'llama3.2', error: 'Timed out after 5000ms', text: 'partial',+ });++ const res = await request(makeApp())+ .post('/api/local-llm/test/stream')+ .send({ backend: 'ollama', modelId: 'llama3.2', prompt: 'Say hello' });++ expect(res.status).toBe(200);+ const frames = res.text.trim().split('\n').map((l) => JSON.parse(l));+ expect(frames).toEqual([+ { type: 'result', result: { backend: 'ollama', modelId: 'llama3.2', error: 'Timed out after 5000ms', text: 'partial' } },+ ]);+ });+it('converts a pre-stream provider throw into a terminal error result frame (no 500 after headers)', async () => {runLocalLlmTest.mockRejectedValue(new Error('Local provider "ollama" is not configured'));