PRD-38.1: Widget-Ready Chatbot Workspace
Executive Summary
Before & After
CURRENT STATE TARGET STATE
───────────────────────────────── ─────────────────────────────────
┌─────────┐ ┌──────────────────┐ ┌────────┐ ┌────────────────────┐
│ Sidebar │ │ │ │ │ │ │
│ │ │ Chat Area │ │ Chat │ │ Canvas │
│ History │ │ │ │ Panel │ │ │
│ │ │ [Message] │ │ │ │ ┌────┐ ┌────┐ │
│ │ │ [Message] │ │ [Msgs] │ │ │Code│ │Data│ │
│ │ │ [Artifact │ │ │ │ └────┘ └────┘ │
│ │ │ MODAL] │ │ │ │ ┌─────────────┐ │
│ │ │ │ │ │ │ │ Document │ │
│ │ │ [Input] │ │[Input] │ │ └─────────────┘ │
└─────────┘ └──────────────────┘ └────────┘ └────────────────────┘
└─────────Widget Tray────────────┘
• Single artifact at a time • Multiple widgets visible
• Modal overlay • Persistent canvas
• Lost on close • Saved in workspace
• No arrangement • Drag, resize, arrange1) Goals & Success Metrics
Goals
ID
Goal
Description
Success Metrics
Metric
Target
Measurement
2) Current State Analysis
Existing Files to Modify
File
Lines
Current Purpose
Changes Needed
Existing Files to Reuse As-Is
File
Purpose
Reuse Strategy
Existing Patterns to Follow
3) Technical Architecture
3.1 Component Hierarchy
3.2 State Flow
3.3 Zustand Store Design
4) Implementation Plan
Week 1: Foundation
Task 1.1: Create Widget Types & Registry
Task 1.2: Create Zustand Store
Task 1.3: Create WidgetBase Component
Week 2: Migrate Existing Artifacts
Task 2.1: Create CodeWidget (from code-artifact.tsx)
Task 2.2: Create DataWidget (from sheet-artifact.tsx)
Task 2.3: Create DocumentWidget (from text-artifact.tsx)
Task 2.4: Create ImageWidget
Week 3: Canvas & Integration
Task 3.1: Create Canvas Component
Task 3.2: Create WidgetTray Component
Task 3.3: Modify Chat Component
Task 3.4: Modify Message Component
Task 3.5: Update useChat Hook
5) Files Summary
Files to CREATE
File
Purpose
Files to MODIFY
File
Changes
Files to DELETE (after migration)
File
Reason
6) Dependencies to Install
7) Testing Checklist
Unit Tests
Integration Tests
E2E Tests
Performance Tests
8) Rollout Plan
Week 1: Foundation (Dev Environment)
Week 2: Migration (Dev Environment)
Week 3: Integration (Staging)
Week 4: Rollout (Production)
9) Open Questions (Resolved)
9.1 Widget Persistence in Zustand Store
9.2 Widget Reference Syntax
9.3 Mobile Layout Strategy
9.4) Phase 1.5: Architecture Decisions Checklist
Decision
Status
Verified By
Date
10) References
Last updated

