AI Chat & Artifact Split-Canvas Workspace

profile: web-app archetype: ai-chat-canvas scroll: split-pane tokens: DESIGN.md modal <= 4 fields skeleton >= 150ms touch >= 44px
Linter: PASS (0 errors, 0 warnings)

1. Interactive App Shell & Viewport Budget Simulator

Desktop Budget (1280px): Left Nav 260px + Right Panel 520px + Outer Padding 32px + Min Content 420px = 1232px
<PageHeader> (sticky z-10) [Primary CTA]
<PageSection> + <DataStateBoundary> scroll_owner: split-pane | CLS = 0 reservation 4 mandatory states: Loading (Skeleton) | Empty (CTA) | Error (In-place Retry) | Populated

2. Core Page Archetypes (3)

Archetype: PromptStreamCanvas

Dual-pane conversational workspace (`max-w: 768px` centered message column when artifact closed; `flex-1` split when artifact open).

Primary CTA: Sticky bottom prompt composer `Send / Stop Generation` button (`Enter` to send, `Shift+Enter` for newline, `Esc` to abort active stream).

+----------------------------------------+------------------------------------+
| Model: Claude 3.7  [Share]             | Artifact: schema.sql [Code|Preview]|
+----------------------------------------+------------------------------------+
| User: Generate normalized billing SQL  | 1 | CREATE TABLE invoices (        |
| Assistant: Here is the schema...       | 2 |   id UUID PRIMARY KEY,         |
| [Artifact Card: schema.sql v2 ->]      | 3 |   amount_cents INTEGER         |
| [Prompt Composer...           [Send]]  | [v1 | v2 (latest)]     [Copy Code] |
+----------------------------------------+------------------------------------+

Archetype: HistoryLibrary

Searchable archive of past threads and generated artifacts (`max-w: 1024px`).

Primary CTA: Top-right slot of `<PageHeader>` (`+ New Thread`).

+--------------------------------------------------------------------+
| Thread & Artifact Library                          [+ New Thread]  |
+--------------------------------------------------------------------+
| [Search q=...] [Type: All | Threads | Artifacts]                   |
+--------------------------------------------------------------------+
| Title                           | Last Artifact   | Updated        |
| Billing SQL & Stripe Webhooks   | schema.sql (v2) | 18m ago        |
+--------------------------------------------------------------------+

Archetype: FocusedSettings

Single-column custom instructions, API keys, and memory controls (`max-w: 640px`).

Primary CTA: Sticky bottom-right action bar (`Save Preferences`).

+--------------------------------------------------+
| Workspace Settings / Custom Instructions         |
+--------------------------------------------------+
| [Textarea: System instructions & coding rules  ] |
| [Toggle: Persist conversation memory           ] |
+--------------------------------------------------+
|                         [Discard] [Save Changes] |
+--------------------------------------------------+

3. Route Reachability Graph (4 Routes)

Route Archetype Entry Trigger Primary Action Exit / Cancel Fallback
/c/:threadId PromptStreamCanvas Thread Rail click, + New Thread, or /library row Submit prompt or inspect artifact (?artifact=) Collapse artifact (Esc) or switch thread in rail
/library HistoryLibrary Thread Rail Library link or Cmd+Shift+L Filter and open thread or artifact Return to active /c/:threadId
/settings FocusedSettings User menu Settings or Cmd+, Save custom instructions / keys Discard unsaved changes and return to /c/:threadId
/share/:snapshotId PromptStreamCanvas External public deep link Fork thread into own workspace ([Fork Thread]) Navigate to /library

4. Mandatory 4-State View Matrix

View / Component Loading (Skeleton) Empty (Copy + CTA) Error (In-Place Retry) Populated (Density & Overflow)
/c/:threadId (PromptStreamCanvas) **Initial load:** 3 alternating message skeletons (72px and 140px). **Streaming state:** Live token append, pulsing cursor, and [Stop Generating] button Centered starter stage (max-w: 640px): greeting, 3 clickable starter prompt cards, and focused composer Inline assistant error bubble preserving partial streamed output + [Regenerate Response] button (user prompt is retained) 768px max message measure (65ch), sticky code block headers, 64px artifact trigger cards
/library (HistoryLibrary) 8 row skeletons (56px height) matching title, artifact badge, and timestamp columns (CLS = 0) Centered 420px container: *"No threads or artifacts found."* + [+ Start New Thread] CTA Inline error card with [Retry Load] button Cursor-paginated list (25 rows/page), title truncate at 52 chars
/settings (FocusedSettings) 3 form card skeletons (120px height each) inside 640px column Custom instructions textarea shows concrete placeholder example Persistent inline banner above form + field-level error message Auto-expanding textarea (min-h: 140px, max-h: 420px) with character counter

5. Monotonic Z-Index Elevation Contract

base 0
sticky 10
navigation 20
drawer 30
modal 40
popover 50
toast 60
tooltip 70