feat(web/draft-assist): assist thread, status machine, not-ready banner - #194
Merged
Merged
Conversation
Wires Plan 3 of the task-draft-ai stack: the compose page opens a live draft-assist thread in its reserved right column on the first Space or `/ai` trigger and stays open for the life of the compose session. - DraftAssistProvider owns lazy session (POST /sessions on first open), SSE consumption via useDraftAssistStream, run start/cancel via useDraftAssistSession + startRun/cancelRun, and the message list. - draftAssistStatus reducer implements the SPA status machine documented in docs/design/task-draft-ai.md Status machine (idle->starting-> thinking->streaming|tool->applying->idle plus cancelling, error, disconnected) with sentence-case copy strings. - useDraftAssistWatchdog fires the 8s / 30s / 90s design thresholds (Still working / offer Cancel / offer Retry) using a stubbed clock for deterministic tests. - Patches from `patch` frames apply to the TipTap prompt through a controlled onApplyPromptPatch callback (set / find_replace / append); invalid patches surface as a thread row instead of silently dropping. - Send becomes Stop while a run is active; Stop is keyboard-reachable. Status region is aria-live=polite; errors are aria-live=assertive. - TaskComposeForm mounts the provider and passes the thread into TaskComposeLayout.assist when active; TaskComposePromptField falls back to the nearest DraftAssistContext when no onAiTrigger is passed from the parent, so the modal wrapper keeps its no-op behavior. - CSS in app-task-compose-page.css fills the assist column with a sticky panel, message list, status region, and composer footer that honors prefers-reduced-motion for the streaming caret. Tests: draftAssistStatus.test.ts (reducer transitions + copy); useDraftAssistWatchdog.test.ts (phase math and hook lifecycle); DraftAssistThread.test.tsx (MSW-driven happy path, cancel, patch apply, a11y region + Stop keyboard focus). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep compose v2 handoff rail and wire draft-assist beside it when Space-for-AI opens. Co-authored-by: Cursor <cursoragent@cursor.com>
Split context/controller, extract compose shell/rail, move assist CSS, and use design tokens so WebOnly check passes. Co-authored-by: Cursor <cursoragent@cursor.com>
AlexsanderHamir
marked this pull request as ready for review
August 14, 2026 20:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
.\scripts\check.ps1 -WebOnly(14/14)gh stack merge(stack #198)