Skip to content

AI Chat: rewrite to modern composer + tool architecture #1047

@datlechin

Description

@datlechin

The current chat panel has 5 providers but a flat text-in/text-out model. Rewrite the chat layer so it can do what Zed, VSCode Copilot Chat, and Cursor do.

What it should do

  • Model picker inline in the composer. No Settings detour.
  • @-mentions for tables, schemas, current query, query results, saved queries.
  • Slash commands: /explain, /fix, /optimize, plus user-defined.
  • Tool calling that re-uses the existing MCP tools in TablePro/Core/MCP/Protocol/Tools/. Chat consumes its own MCP layer instead of duplicating schema fetch and query exec.
  • Per-turn provider attribution. Switching mid-conversation is tracked.
  • Opt-in context. No auto-shoveling schema into every prompt.

Architecture target

Replace AIProvider (text only) with three abstractions:

  1. ChatTransport. Sends [ChatTurn] with content blocks (.text, .toolUse, .toolResult, .attachment). Yields ChatStreamEvent.
  2. ContextItem. Discriminated union for @-mention attachments. Rendered as chips in the message bubble.
  3. ChatTool. Wraps the existing MCP tools so chat and external MCP clients share one implementation.

Apple Intelligence (Foundation Models on macOS 26+) becomes another ChatTransport once this lands.

Out of scope

Apple Intelligence integration. Tracked separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions