Commit Graph

24 Commits

Author SHA1 Message Date
e58972d594 Enable Gemini thinking stream 2026-06-15 11:37:29 -07:00
c649cb06c9 fix(preview): align background color and padding with new dashboard theme 2026-06-14 13:35:06 -07:00
514f11e80d fix(preview): self-healing dev server so the preview always loads cleanly
The dominant production failure was a dead dev-server process behind a
'running' DB flag (idle-stop / OOM / crash / host restart), which the UI
trusted and embedded -> permanent 502 until a manual restart.

- dev-container.ts: add isDevServerListening() fast liveness probe; stop the
  container entrypoint from auto-running 'npx next dev --webpack' (it competed
  with the managed server, forced the wrong bundler/cwd, and doubled memory);
  drop the fake state='running' seed row; bump dev container memory 1g -> 2g.
- ensure route: verify a 'running' row is ACTUALLY listening and resurrect it
  if dead, instead of trusting the flag; never bounce a healthy server.
- preview page: call ensure on every mount and on refresh (verify + heal),
  force an immediate anatomy refetch on (re)start so a dead frame swaps to
  'warming up' without the 5s lag.

Backstopped by the partial unique index + startDevServer idempotency, so heals
can never duplicate or thrash a server.
2026-06-12 17:30:27 -07:00
0f90ef6f5c Fix preview pipeline: dedup duplicate previews, race-safe dev server start, honest readiness
- Add partial unique index on (project_id, port) for active dev servers so the
  SELECT-then-INSERT race can no longer create duplicate 'Port 3000' rows.
- Make startDevServer race-safe: on unique violation, adopt the winning row
  instead of duplicating.
- ensure route no longer marks a server 'running' before it binds the port;
  the readiness probe flips starting->running only after the port answers.
  Kills the '502 -> broken CSS -> works' refresh loop.
- Deduplicate previews per-port in sortDevPreviewsFrontendFirst as a defensive
  backstop for the dropdown.
- Revert iframe _refresh query-param hack (was forcing cold recompiles).
2026-06-12 16:57:06 -07:00
87acebfab3 fix(preview): resolve ReferenceError on refreshKey initialization order 2026-06-12 16:50:34 -07:00
aa780492fd fix(preview): add 60-second grace period before marking freshly booted servers as zombies to prevent aggressive 502 teardowns 2026-06-12 16:49:31 -07:00
de950b1fb0 Make dev_server_start idempotent to prevent HMR breakage and 502s 2026-06-12 16:42:26 -07:00
76c0241bd1 Save frontend state (layout, sidebar, chat panel, preview refresh fix) before rollback 2026-06-12 16:35:45 -07:00
69e8086018 fix(preview): resolve ReferenceError by hoisting isForceStarting state declaration 2026-06-12 12:28:22 -07:00
cd26dd807f feat(preview): add server/port dropdown to address bar 2026-06-12 12:20:48 -07:00
5ed10c4077 feat(preview): make address bar interactive for routing inside iframe 2026-06-12 11:57:36 -07:00
c1a43d18a6 feat(preview): add tablet device mode with scaled frame styling 2026-06-12 11:54:47 -07:00
180c55ee89 copy(preview): change button text from Start Dev Server to Start Preview 2026-06-11 17:10:10 -07:00
08fbe8405b feat(preview): add 1-click start dev server button to empty state 2026-06-11 17:07:17 -07:00
7337e2c5b0 fix(preview): re-trigger dev server ensure check when user clicks refresh button 2026-06-11 12:07:39 -07:00
371ae37cc2 feat(preview): support multiple preview ports with styled picker 2026-06-11 11:27:44 -07:00
ca0ae32a21 fix(preview): ignore stale ghost dev servers in auto-restarter; cap elapsed timer 2026-06-11 11:20:19 -07:00
d165ab9de1 feat(preview): auto-restart dev server on session open; WarmingUpState with elapsed timer
- New POST /api/projects/[id]/dev-server/ensure: checks if dev server is running,
  queries last known config from fs_dev_servers, fires startDevServer +
  probeDevServerReadiness in background, returns immediately
- Preview pane calls ensure on mount when anatomy is loaded but no server is running
- Distinguishes state='running' (show iframe) from state='starting' (show warming-up UI)
- WarmingUpState: indigo spinner, elapsed timer, 'View last deployed version' link if available
- ensureCalledRef prevents duplicate calls per mount
- The 5s anatomy poll handles the starting→running transition automatically
2026-06-11 11:05:58 -07:00
82a41f7e95 fix(stop+stability): stop button interrupts live generation; classifier, prompt + preview pane improvements
Stop button fix:
- Plumb AbortSignal end-to-end: callVibnChat → Gemini SDK (config.abortSignal) / OpenAI fetch → executeMcpTool (/api/mcp fetch)
- Treat abort as clean user stop (not fatal error); partial reply persisted with '(stopped by user)'

Classifier fix:
- Add timeout/gateway/5xx/connection-error vocabulary to diagnose intent
- Prevents 'I get a gateway timeout' from falling through to feature_build (40 rounds) and looping

Prompt / agent behaviour:
- Render verification is now scope-aware: small edits stop at green healthCheck; no browser_console/curl audit on healthy server
- Sanitize stale '### Phase Checkpoint' walls from loaded history so old threads stop biasing new turns
- Next.js dev command updated to --no-turbopack for container stability (per-route lazy compile caused cold-start 503s)
- New public page prompt: agent checks middleware allowlist in the same turn
- Scope discipline and QA-tool gating carried forward from prior session

Code cleanup:
- Remove duplicate AgentPhase declaration (TS2440)
- Remove dead checkpoint emit branch and orphan 'checkpoint' phase value
- Remove unused MAX_TOOL_ROUNDS constant

Preview pane (build status):
- 4-state machine: initial-load / building (with elapsed timer) / build-failed / not-running
- pollMs 0 → 5 000ms so dev-server recovery and build completion auto-update without refresh
- anatomy route + use-anatomy type: inFlightBuild gains createdAt for elapsed timer
2026-06-10 21:40:48 -07:00
8cb7a9450b feat(ui): add manual reload button to preview device toggles 2026-05-15 16:31:31 -07:00
d464ccd19d feat(ui): hardcode visual preview tab to primary frontend port 3000 2026-05-15 16:03:06 -07:00
dc82ccc47a feat(ui): move preview device toggles into the global nav rail 2026-05-15 15:42:49 -07:00
8a7897a891 feat(ui): add mobile preview device framing and design QA tools 2026-05-15 11:01:49 -07:00
abf9bf89c2 chore: convert submodules to standard directories for true monorepo structure 2026-05-13 14:54:23 -07:00