Skip to content

Add create image and web search to native input#8567

Merged
joshliebe merged 14 commits into
developfrom
feature/josh/add-create-image
May 15, 2026
Merged

Add create image and web search to native input#8567
joshliebe merged 14 commits into
developfrom
feature/josh/add-create-image

Conversation

@joshliebe
Copy link
Copy Markdown
Contributor

@joshliebe joshliebe commented May 14, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1214776295472425?focus=true

Description

  • Adds create image and web search tools to the native input

Steps to test this PR

With the native input enabled

  • Tap the options button
  • Select create image
  • Verify that the pickers are hidden
  • Toggle to Search and back to Duck.ai
  • Verify that the option stays selected
  • Type something and submit
  • Verify that the image generated
  • Do the same in Duck.ai
  • Go back
  • Tap the options button
  • Select web search
  • Type something and submit
  • Verify that a web search is completed in Duck.ai
  • Do the same in Duck.ai

Note

Medium Risk
Adds a new tool-selection path that alters AI chat prompt payloads and UI state across native input, which could affect prompt handling and model capability gating if mismatched with backend/JS expectations.

Overview
Adds native input tool selection for Duck.ai prompts (e.g. Create Image and Web Search) and threads it through submission and pending-prompt flows.

The selected tool is contributed via the options plugin/UI, persisted while navigating, cleared after submit/store, and sent to JS as a new toolChoice array in the submitAIChatNativePrompt/pending prompt payloads.

Model capabilities are extended with supportedTools (new Tool enum) and used to show/hide available options; selecting image generation also hides the model/reasoning pickers.

Reviewed by Cursor Bugbot for commit 4a6e867. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@aibrahim-
Copy link
Copy Markdown
Contributor

Should the "Ask anything privately" text change when in image generation mode / websearch modes? e.g. "Describe your image" or similar? This is what other AI apps do

if (!isAttachedToWindow) return
if (visibility == VISIBLE && !viewModel.shouldShowPickers) {
post {
host.showModelPicker(false)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post defers the hide calls to the next message queue cycle, so on the first frame after OptionsView becomes visible the model/reasoning pickers may briefly appear before being hidden. worth checking if this creates a visual flash during the toggle-to-Search-and-back flow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn’t flicker as far as I can see

android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/popupMenuItemHeight"
android:paddingTop="@dimen/keyline_2"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the old layout had android:minHeight="@dimen/popupMenuItemHeight" which enforced a minimum touch target height on each menu item. the new one relies on padding alone — worth checking if the resulting item height still meets the accessibility minimum, especially at small text sizes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the styling of the reasoning one now, I’ll look at them both separately

@joshliebe joshliebe force-pushed the feature/josh/add-create-image branch from 119ecee to 2525815 Compare May 15, 2026 21:33
Copy link
Copy Markdown
Contributor

@malmstein malmstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works as expected, nice job!

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 4a6e867. Configure here.

host.showReasoningPicker(false)
}
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale post in onVisibilityChanged can hide pickers incorrectly

Medium Severity

The post lambda in onVisibilityChanged unconditionally hides pickers without re-checking viewModel.shouldShowPickers when it actually executes. If the selected tool is cleared between the post being enqueued and running (e.g., updateCapabilitiesFrom clears an unsupported tool selection synchronously, then the deferred hide fires), the pickers get incorrectly hidden even though no tool is selected. Adding if (!viewModel.shouldShowPickers) inside the post block would prevent the stale hide from executing after the state has changed.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4a6e867. Configure here.

Copy link
Copy Markdown
Contributor Author

@joshliebe joshliebe May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be fixed with upcoming state changes

@joshliebe joshliebe merged commit 60266a8 into develop May 15, 2026
18 checks passed
@joshliebe joshliebe deleted the feature/josh/add-create-image branch May 15, 2026 22:09
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.

3 participants