Add Ask about tab/page items to the Duck.ai attach menu#9003
Add Ask about tab/page items to the Duck.ai attach menu#9003malmstein wants to merge 10 commits into
Conversation
83c21fb to
d7b980c
Compare
d007b89 to
bc2c50d
Compare
d7b980c to
b894f70
Compare
1a89d31 to
6beb0ad
Compare
b894f70 to
7718c96
Compare
6beb0ad to
7f91fbe
Compare
082f655 to
99b4ce3
Compare
2b44bd7 to
f0ea17f
Compare
16710e8 to
7c2b6ce
Compare
f0ea17f to
568124a
Compare
568124a to
1817c0a
Compare
172be5e to
80b3243
Compare
1817c0a to
7155012
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d4e3d38. Configure here.
|
|
||
| override fun setPageContext(title: String, url: String, faviconUrl: String?) { | ||
| attachmentView?.setPageContext(PageContextAttachment(title = title, url = url, faviconUrl = faviconUrl)) | ||
| } |
There was a problem hiding this comment.
Page context lost before attach
Medium Severity
setPageContext only forwards to attachmentView when that plugin view already exists, unlike setContextualAttachmentActions, which keeps pending callbacks and applies them in wirePluginView. If renderViewState pushes page context before the attachment plugin is wired, the call is dropped with no retry, so the chip and attach-menu state can stay out of sync with showContext even though prompts still include page context.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit d4e3d38. Configure here.
Replace generic 'Remove file' with 'Remove page context' for accessibility clarity. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The contextual sheet's unified input dropped an attached page context when a prompt was sent while a chat was already in progress: WEBVIEW-mode submits built their own JS event in the manager, bypassing the ViewModel's generateContextPrompt, which is the only place that injects pageContext. Route every widget submit (INPUT and WEBVIEW) through the ViewModel so the prompt is built in one place, and delete the manager's duplicate send path. Also in this batch: - Drop the page-context chip from the input once a prompt is sent, mirroring how image attachments are cleared on submit. - Focus the input when "Ask about page" is tapped, via a new ViewModel FocusInput command, so the keyboard and tools row come up in one tap. Follow-ups in a running chat now also fire the contextualPromptSubmittedWith/WithoutContext pixels. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When a prompt is sent from the contextual sheet's initial (INPUT) state, the sheet moves to the chat but the soft keyboard stayed up, covering the streaming reply. Hide it as part of that transition. The flag rides on the existing ChangeSheetState command rather than a separate one: commandChannel is capacity-1 DROP_OLDEST, so two commands emitted in the same burst would lose the older. Follow-ups sent from within a running chat are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d4e3d38 to
8da2dee
Compare
80b3243 to
6e28196
Compare
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |



Task/Issue URL:
Tech Design URL (if applicable):
Description
Adds a contextual-mode-only item to the Duck.ai unified input's attach (paper-clip) menu, chosen by whether page context is attached:
onPromptSent/generateContextPromptpath.DuckChatContextualViewModelis the single source of truth (showContext); the fragment bridges it to the unified input's chip (observeshowContext→setPageContext/clearPageContext; chip-remove →removePageContext).isContextualdefaults false so omnibar / new-tab attach menus are unchanged.Note: this PR only adds the attach-menu items. Making the unified input the contextual sheet's initial-state composer was explored and intentionally not included here (the bottom-sheet sizing needs a different approach) — to be revisited separately.
Steps to test this PR
Ask about tab / page (internal build, contextual mode)
UI changes
🤖 Generated with Claude Code
Note
Medium Risk
Changes how in-chat native prompts reach the web layer and when page context is attached or cleared; regressions could affect contextual chat submits, keyboard UX, or omnibar attach menus if
isContextualwiring is wrong.Overview
Contextual Duck.ai gets page-context actions on the unified input’s attach menu and a visible chip, with submission behavior tightened so context isn’t dropped mid-chat.
In contextual mode only, the attach menu shows Ask about tab (attaches page context, no prompt) or Ask about page (sends the fixed “Ask about page” prompt with
pageContextJSON) depending on whether a chip is present; removing the chip resets the menu. The fragment mirrorsshowContextfromDuckChatContextualViewModelintosetPageContext/clearPageContexton the native widget.All native submits from the contextual sheet—initial INPUT and WEBVIEW follow-ups—now go through
onPromptSubmitted→onPromptSent/generateContextPromptinstead of the manager’s directsubmitAIChatNativePromptJS path for in-chat messages, so page context attached from the menu is included on follow-ups. After send, the page-context chip is cleared like other attachments; leaving INPUT for chat can hide the keyboard viaChangeSheetState.hideKeyboard, and Ask about page quick-action flow can emitFocusInput.Reviewed by Cursor Bugbot for commit 8da2dee. Bugbot is set up for automated code reviews on this repo. Configure here.