summaryrefslogtreecommitdiff
path: root/tests/brainstorm-server/package.json
AgeCommit message (Collapse)Author
2026-06-18test(deps): bump ws to ^8.21.0 in brainstorm-server testsJesse Vincent
Clears two dependabot alerts on the test harness's ws dependency: GHSA-96hv-2xvq-fx4p (high, memory-exhaustion DoS, fixed 8.21.0) and GHSA-58qx-3vcg-4xpx (medium, uninitialized memory disclosure, fixed 8.20.1). Test-only — the shipped brainstorm server hand-rolls its WebSocket framing and does not depend on ws. Suite passes (57/57).
2026-06-16Add visual companion Prime Radiant brandingDrew Ritter
2026-06-16Harden Windows browser launcherDrew Ritter
2026-06-16Harden companion Windows lifecycle coverageDrew Ritter
2026-06-16feat(brainstorm-server): gate every endpoint behind a per-session keyJesse Vincent
The companion server is reachable by any local browser tab (default loopback bind) and by any host that can route to it (remote --host bind). It served screens, files, and accepted event-injecting WebSocket connections with no authentication, so a malicious browser tab or a direct remote client could read brainstorm content or inject events that the agent reads as the user's input (prompt injection into a live session). Generate a per-session secret token, carry it in the served URL as ?key=, and mirror it into an HttpOnly SameSite=Strict per-port cookie on first load so same-origin subresources and the WebSocket handshake authenticate automatically. Every HTTP request and WebSocket upgrade now requires a valid key (query or cookie, constant-time compared); unauthenticated requests get a friendly 403 explaining they need the full URL. A secret authenticates the client uniformly across loopback, tunnel, and remote binds and defeats DNS rebinding, which a Host/Origin allowlist cannot. Also guard handleMessage against a null JSON payload that crashed the process. Tests: new auth.test.js (13 cases) covering the key on /, /files/*, and WS plus cookie bootstrap and the null-payload guard; server.test.js threads the key; ws-protocol.test.js + auth.test.js wired into npm test. Closes #1014 Refs #1110, #1553, #1504
2026-06-16feat(brainstorm-companion): resilient reconnect, live status, paused overlayJesse Vincent
The injected client reconnected on a fixed 1s timer with no feedback: if the laptop slept or the server restarted, the page showed 'Connected' over a dead socket and silently queued events. And when the server stopped, the user got a bare connection-refused with no explanation. helper.js now: - reconnects with exponential backoff (500ms, doubling, capped at 30s; reset on open), with an onerror->close handler, nulls the socket on close, and clears a pending timer before scheduling another; - drives the frame status pill Connected/Reconnecting/Disconnected via a --status-color custom property (frame-template.html); - after ~15s disconnected, shows a self-styled 'Companion paused' overlay (tombstone) explaining the companion stopped and will reconnect automatically; - on recovery from a tombstoned outage (e.g. server restarted on the same port) reloads to pick up the restarted server's current screen. The reconnect-backoff is an exported pure function; helper.test.js unit-tests it (doubling + cap progression) and asserts the status/tombstone/reconnect wiring. DOM behaviour is verified live. Refs #856, #1237
2026-06-16feat(brainstorm-server): 4h configurable idle timeout; close WS on shutdownJesse Vincent
The companion shut down after only 30 minutes idle — too short for real brainstorming, where a single question can sit far longer. And shutdown() never closed upgraded WebSocket sockets, so an open browser connection could keep the Node process alive after it was supposed to exit. - Default idle timeout raised to 4 hours, configurable via BRAINSTORM_IDLE_TIMEOUT_MS and start-server.sh --idle-timeout-minutes (validated positive integer). - Reported as idle_timeout_ms in the server-started JSON / server-info. - shutdown() now destroys all client sockets so the process exits even with an open WebSocket. - Watchdog check interval is configurable (BRAINSTORM_LIFECYCLE_CHECK_MS, default 60s) so the lifecycle can be tested without minute-long waits. Adds lifecycle.test.js (configured timeout reported; idle shutdown exits despite an open WS — teeth-verified; the start-server flag). Wires ws-protocol, lifecycle, and stop-server suites into npm test. Closes #1237 Refs #1689
2026-03-06Add brainstorm server with WebSocket support, helpers, and testsJesse Vincent
WebSocket server for real-time browser communication during brainstorming sessions. Includes browser helper library for event capture, shell scripts for server lifecycle management with session isolation and persistent mockup storage, and integration tests. Co-Authored-By: Drew Ritter <drew@ritter.dev>