Skip to content

Phase 4B: Chat Integration in Studio #14

@mikewolfd

Description

@mikewolfd

Motivation

Consolidate the separate chat entry point into an integrated studio panel. Chat becomes a thin conversation orchestrator that connects to studio's MCP server instead of owning its own Project and McpBridge.

Parent epic: #9 — Unified Authoring Architecture

Scope

Pass 4b-A: ChatSession Refactor

  • Remove McpBridge dependency from ChatSession
  • Accept extended ToolContext with getProjectSnapshot() for state inspection
  • ToolContext connected to host's MCP server via InMemoryTransport
  • Delete ChatSession.replaceBridge() method
  • Conversation state management retained (history, system prompts)

Pass 4b-B: Adapter Interface Update

  • Retain AIAdapter.generateScaffold() as optimized fast-path for initial creation
  • Add scaffold-to-changeset bridge in host (scaffold loaded via project.setDefinition(), recorded by middleware)
  • McpBridge class deleted entirely

Pass 4b-C: Studio Chat Panel + Canvas Layout

  • Consolidate main-chat.tsx, chat/, chat-v2/ into integrated panel within studio shell
  • Chat panel as persistent side panel (like Copilot in VS Code)
  • Visual emphasis transitions: chat-first (no form) vs canvas-first (form exists)
  • Delete separate chat entry points

Pass 4b-D: Inline Canvas AI Actions

  • Context menu integration for AI-powered actions
  • Right-click field: "Add validation...", "Make conditional...", "Add help text..."
  • Multi-select actions: "Group these", "Add shared validation"
  • Context composition from selected items (properties, surrounding structure)
  • Routed through same MCP/changeset path as chat

Pass 4b-E: Interview -> Scaffold Flow

  • ChatSession states: INTERVIEW -> SCAFFOLDING -> REFINING
  • Scaffold via generateScaffold() loaded as first changeset
  • Alternative: MCP tool-driven creation (formspec_create -> tools)
  • Lazy MCP server bootstrapping (tools return "no project" until create)

Acceptance Criteria

  • McpBridge class deleted, chat connects via ToolContext to studio's MCP server
  • Single workspace: canvas and chat panel share one Project instance
  • Scaffold delivered as a changeset with accept/reject review
  • Inline canvas AI actions route through MCP and produce changesets
  • All separate chat entry points consolidated
  • No regressions in chat conversation quality

Layer

SaaS Platform (Layers 5-6)

Dependencies

Spec Reference

thoughts/specs/2026-03-24-unified-authoring-architecture.md — Section 4 (Chat Integration)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions