Skip to content

add interactive chats to the Home canvas - #178

Merged
morgmart merged 4 commits into
mainfrom
chat-on-canvas
Aug 24, 2026
Merged

add interactive chats to the Home canvas#178
morgmart merged 4 commits into
mainfrom
chat-on-canvas

Conversation

@morgmart

Copy link
Copy Markdown
Collaborator

Category: new-feature
User Impact: Users can expand pinned chats into live, interactive conversation cards on Home without leaving the canvas.

Problem: Opening a pinned chat currently replaces the Home canvas, breaking spatial context and making it harder to keep several active conversations in view. Solution: This opt-in experiment lets pinned chats expand in place with a bounded recent-history window and the shared composer, while full chat remains available for complete history and deeper work.

Refs #143

Product behavior

  • Manually enable Chat on canvas in Settings → Experiments; it remains off by default and is excluded from development auto-enable.
  • Click a pinned chat to expand it in place. Expansion, size, and position persist.
  • Each card shows the latest 10 complete user-led exchanges; older history has an explicit Open full chat boundary.
  • Read, scroll, select text, send, queue, steer, stop, and attach files without changing the route-selected chat.
  • Every expanded card keeps its composer visible. Focus remains ephemeral and only deliberate interaction marks a session read.
  • Drag expanded cards from the header only; transcript and composer gestures remain owned by chat.
  • Collapse the card or maximize into the complete chat workspace from the header.

Architecture

  • Extracts shared chat-owned transcript and composer capabilities used by both full chat and Home.
  • Keeps dispatch, queueing, admission, security confirmation, read-only, and separate-window rules in the existing session controller.
  • Uses a Home-only bounded projection and classic renderer for reliable compact cards; full chat keeps complete virtualized history.
  • Adds reference-counted transcript retention so mounted cards are not evicted from the session cache.
  • Persists expanded/collapsed presentation through the existing Home layout schema and experiment registry.

Verification

  • just check
  • Full Vitest suite: 6,880 passed, 1 skipped (last full run before final metadata/icon-only changes)
  • Focused experiment tests: 49 passed
  • Focused canvas/header tests: 81 passed
  • Manual dogfood: multiple expanded chats, recent-history boundary, send/queue/stop, selection and scrolling, header-only drag, resize, pan/zoom, collapse/open full chat, and reload persistence
File changes

src/app/AppShell.tsx / src/app/ui/AppShellContent.tsx
Keep session dispatch route-neutral and pass the shared composer/session callbacks into Home.

src/features/chat/capabilities/ConversationComposerCapability.tsx
Extract the shared conversation composer authority and presentation policy used by full chat, Home, and canvas cards.

src/features/chat/hooks/useChat.ts
Keep session-addressed sends and compaction from changing route selection.

src/features/chat/hooks/useChatTranscriptReadModel.ts
Provide a read-only, session-addressed transcript model for non-route chat surfaces.

src/features/chat/hooks/useSessionAddressedComposerAdmission.ts
Centralize session failure, read-only, security, and separate-window admission across chat surfaces.

src/features/chat/lib/boundedConversationProjection.ts
Project the ten most recent complete user-led exchanges for the in-the-moment canvas window.

src/features/chat/stores/chatStore.ts
Retain independently mounted transcripts safely through cache trimming and session-ID promotion.

src/features/chat/ui/ChatInput.tsx
Support the shared composer’s bare embedded presentation.

src/features/chat/ui/ChatTranscriptSurface.tsx
Extract the reusable transcript/loading/artifact surface from the route workspace.

src/features/chat/ui/ChatView.tsx
Compose the full workspace from the shared transcript and composer owners.

src/features/chat/ui/MessageTimeline.tsx / VirtualMessageTimelineGate.tsx
Support bounded start content and owning-surface renderer selection.

src/features/experiments/experimentDefinitions.ts
Register Chat on Canvas as manual-only and off by default.

src/features/home/lib/homeLayoutMapper.ts
Persist expanded/collapsed chat presentation and per-profile size memory.

src/features/home/ui/HomeComposer.tsx
Adopt the shared composer capability without changing Home’s pending-chat behavior.

src/features/home/ui/HomeView.tsx
Hydrate and compose pinned chat sessions for Home.

src/features/home/ui/WidgetCanvas.tsx / WidgetFrame.tsx
Own ephemeral canvas-chat focus, contained wheel gestures, lifecycle, and header-only drag behavior.

src/features/home/ui/useWidgetDragSuppression.ts
Suppress activation after cancelled pointer gestures.

src/features/home/widgets/ChatCanvasCard.tsx
Add the interactive expanded card: project identity, bounded transcript, composer, history boundary, and card controls.

src/features/home/widgets/ChatPinWidget.tsx
Expand chat pins in place under the experiment while preserving stable default behavior.

src/features/home/widgets/catalog.ts / types.ts
Define expanded chat sizing profiles and widget integration contracts.

src/shared/i18n/locales/en/*.json / es/*.json
Add experiment, card action, history-boundary, loading, and unavailable copy.

Changed test files
Cover composer parity and admission, bounded exchange projection, transcript retention, route neutrality, renderer ownership, experiment registration, layout persistence, multi-card lifecycle, drag/scroll/focus behavior, and bounded-history performance.

@morgmart
morgmart requested a review from a team August 24, 2026 04:36
@morgmart
morgmart merged commit c86e2be into main Aug 24, 2026
9 checks passed
@morgmart
morgmart deleted the chat-on-canvas branch August 24, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant