Repository navigation
Open the document research composer from /research in Chat - #369
Conversation
fc6090b to
ae4f725
Compare
|
Review: Changes needed Verified in a worktree build against a fake-GitHub server (AGENT on, research on) at 1440x900 and 390x844. Menu, Must fix
Should fix Overlap with #355 (research composer)
Checks / hygiene
|
|
Thanks. All review points are addressed in 5b19ca8:
Checks: |
Typing / at the start of the Chat composer opens a command menu in the document slash menu's recipe, offering Research. A /research draft is never sent; an inline hint points to the document, and Go to document puts the caret at the end of the document. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Choosing Research in Chat, or sending a /research brief, now switches to the document and opens the existing research composer after the last paragraph with the brief filled in. The editor exposes this through a host-owned ResearchLauncher that attaches the same ResearchDraftStore path the / menu uses. Chat reuses the / menu's exported surface and row classes. The notice remains only where research is unavailable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Briefs longer than the composer accepts are refused in Chat. The launcher returns a cause-specific result after the document has laid out, so the Chat draft clears only once the composer holds the brief: an open draft offers Go to it, read-only and reconnecting say so, and transient causes offer Retry. The caret lands after a prefilled brief, and @chopin /research is the same command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5b19ca8 to
117cb39
Compare
Why
Typing
/researchin the Chat composer posted it as a literal message (audit finding 9). Jev then analysed that stray message. The docs and the document editor both call it "/research", so people reasonably try it in Chat.What changed
/at the start of the Chat composer opens a command menu. It reuses the document/menu's surface and row classes, now exported from@chopin/editorasMENU_SURFACE,MENU_ROW,MENU_ROW_ONandMENU_ROW_OFF. Arrow keys move, Enter or Tab chooses, and Escape closes it while keeping the draft and focus. The only command is Research; no other command makes sense in Chat today. It shows only while the draft is just/query, so/usr/bindoesn't open it./research <brief>, switches to the document (on phone too). It uses the empty last paragraph, or appends one, and opens the existing research composer there with the brief filled in and focused. The Chat draft is cleared. From there, everything is the existing document flow: the sameResearchDraftStore, request creation, and placement.@chopin/editorexports a host-ownedResearchLauncher(available(),open(brief)), passed toPlanEditorasresearchLauncher. A newResearchLaunchRegistrationcomponent in the toolbar attaches it to the mounted editor's draft store and binding. It doesn't touchtoolbar/research.tsx, so it stays compatible with Keep the research composer visible as one surface #355.#references stay put. The draft is cleared only after the document composer holds the brief, which happens after the document has laid out. Each cause has its own message:#references: they carry into the brief as their visible titles (#Pricing). The composer is plain text, so they become text, not links.@chopin /research …: this, and/researchin Chopin mode, are the same command and are never sent to the Planner./researchdraft is held instead of sent, and the notice says "Research isn't available in this document".Screenshots
Before:
/research+ Enter posts a literal messageAfter:
/opens the command menuAfter: a typed brief…
…opens the document's research composer with the brief, after the last paragraph
After: a draft is already open, or the brief is too long
Phone: before / after
Testing
bun test --timeout 60000 packages/editor apps/web: 1007 pass, 0 fail. New tests:packages/editor/src/research-launcher.test.tscovers attach, detach, stale detach, unavailable, the editor's reason, and the 4,096-character limit.apps/web/src/chat/commands.test.tscovers@chopin /researchand brief extraction.bun run types: pass.bun run build: pass, initial JS 246661 B.bun run ci: pass on the rebased integration; the design-contract review below is complete.E2E
e2e/chat-commands.e2e.tscovers:/usr/bin/research <brief>: prefilled, reusing the empty last paragraph, caret at the end@chopin /researchwhile a draft is open: notice, draft kept, Go to it focuses the open draftchat:sendframe sentI ran the same flow with a standalone Playwright script against a fake-GitHub server at 1440×900 and 390×844: it passed, with 0 frames sent.
Keep the research composer visible as one surface #355 overlap: Keep the research composer visible as one surface #355 is still open. The launcher centres the target paragraph with
scrollIntoView({ block: "center" })so the current composer placement has room. Once Keep the research composer visible as one surface #355 lands, I'll rebase, check whether its reveal scroll makes this redundant, remove it if so, and re-check the geometry.Design-contract review (completed)
bun run cireports:packages/editor/src/plan-editor.tsx: pinned inscripts/design-contract/exceptions/dynamic-editor.json("reviewed dynamic owner changed"). NewsourceHash:83e854244e4f0b86d116002456f6eeb52520661d559c06142f1058bced06bb76. This is safe: the only change is passing theresearchLauncherprop through to the widget plugin, with no class logic.apps/web/src/chat/command-picker.tsx:MENU_SURFACE,MENU_ROW,MENU_ROW_ONandMENU_ROW_OFFare flagged as dynamic classes that need a reviewed exception. They are the exported/menu constants frompackages/editor/src/toolbar/surface.ts, all static string literals. Importing them instead of copying the strings is what makes the checker flag them.The integrated branch renews these exact exceptions after checking the current source. Final rebased head
117cb39apassed hosted validation, E2E, and container checks.🤖 Generated with Claude Code