Submatter/.convoys/ai-agent-studio/brief-1-ai-workspace-tabs.md

2.8 KiB

brief convoy role title status priority slice_dependencies recommended_model model_tier
1 ai-agent-studio role-implementer AI workspace Chat and Agents tabs in_progress P1
auto/coding standard

Brief 1 — Task-ai-workspace-tabs.md

Execution note — 2026-10-22

User approved kickoff. The code slice and /api/chat role-boundary hardening are implemented; standards/spec reviews are clean, web tests pass (34 tests), and web type-check/lint pass with pre-existing warnings only. Browser verification remains required for native back/forward behavior, Radix keyboard focus, streaming scroll restoration, responsive layout, and screen-reader announcements, so the brief remains in progress. No merge/release or DB transition is claimed. Agents remains an explicit placeholder/adapter stub: the shell must not claim working creation, installation, mention-to-add, saved-agent execution, or private-context access.

Goal

Refactor the existing workspace AI page into accessible, deep-linkable Chat and Agents modes that share one visual composer shell without regressing current streaming chat.

Files

  • apps/web/app/(app)/[workspaceSlug]/ai/page.tsx — preserve the canonical route; split orchestration from presentation.
  • apps/web/components/ai/ — add a workspace frame, URL-backed tab switcher, shared composer shell, Chat mode, and Agents placeholder/library frame.
  • Existing /api/chat integration — preserve for Chat mode only.
  • Adjacent component tests.

Required design

  • Keep the existing AI Sparkles item in apps/web/components/layout/icon-rail.tsx; do not add an Agents rail item.
  • Chat is the default for /<workspaceSlug>/ai; tab state is URL-backed and browser-navigation safe.
  • The composer keeps the same dimensions, shape, attachment/action affordances, and keyboard conventions in both modes.
  • Mode-specific behavior is explicit: Chat submits conversation messages; Agents emits typed builder requests through a separate adapter stub until Brief 3.
  • Tab changes preserve each mode's independent draft input and relevant scroll state.
  • Reuse existing UI primitives and responsive shell patterns.

Acceptance

  • Old AI links still open functional Chat mode.
  • Users can switch/deep-link/refresh/back-forward between Chat and Agents.
  • Chat streaming, error, stop, and focus behavior remains functional and workspace-scoped.
  • Agents shows the shared composer plus library loading/empty/error scaffolding without submitting to /api/chat.
  • Tabs and composer pass keyboard/screen-reader checks.
  • pnpm lint && pnpm type-check && pnpm test pass.

Prompt

Read the current AI page, /api/chat route, icon rail, tRPC provider, and UI primitives before editing. Separate shared presentation from mode-specific state; do not introduce the registry schema or persist generated agents in this brief.