Skip to content

feat: allow empty submit when selected context is attached - #366

Merged
quiet-node merged 3 commits into
mainfrom
feat/363-empty-submit-with-selection
Aug 11, 2026
Merged

feat: allow empty submit when selected context is attached#366
quiet-node merged 3 commits into
mainfrom
feat/363-empty-submit-with-selection

Conversation

@quiet-node

@quiet-node quiet-node commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Description

Pressing Enter on an empty ask bar now sends a turn whenever Thuki has captured selected text from the app you came from. The selection alone is the message, and the system prompt decides what happens to it, so a persona that already says "analyse and explain the content" no longer needs a typed instruction every time. Closes #363.

Key changes

  • handleSubmit resolves the sanitized selection up front and treats it as content, so an empty ask bar with a live selection is a valid submit. A genuinely empty submit, with no text, no images and no selection, stays blocked.
  • The "nothing to send" gate generalizes from a /think-only exception to any selection, stating the rule once instead of twice.
  • The ask bar's submit button enables on a live selection, so the button and the Enter key agree.
  • runChatTurn no longer bails on a blank message when quoted text is present.
  • build_user_content composes the user message content. With no typed request it emits the [Highlighted Text] block alone and omits the [Request] header, leaving the system prompt as the sole authority over the content. It sits outside ask_model so the branch is covered by tests rather than by the coverage-off command body.
  • The system prompt's Input Contract gains the matching fallback: highlighted text with no request means the selection is the subject, and the model engages it directly instead of asking what to do with it.
  • A selection-only submit clears sticky replace mode. Without that, a deferred /rewrite whose image failed could leave sticky armed alongside a live selection, and the next bare submit would auto-replace the user's selection in the source app with a free-form answer.
  • Built-in web search stays available on a selection-only turn, but the classifier decides it rather than the pre-filter's deterministic shortcut. That shortcut forces a search on a URL, a current-or-future year, or a word like "latest", which reads intent correctly only when the user wrote the words. On highlighted prose those tokens belong to the page's author, so has_user_request withholds the shortcut and hands the turn to the model. Turns carrying a typed request are unaffected, and /search still forces a search from its own path.

Testing

bun run test:all:coverage and bun run validate-build both green: 2652 frontend tests, 2319 backend tests, 100% coverage on both sides.

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
…bmit

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
@quiet-node
quiet-node force-pushed the feat/363-empty-submit-with-selection branch from 72e2372 to 6a06fb7 Compare August 11, 2026 00:45
@quiet-node
quiet-node merged commit ecf06bf into main Aug 11, 2026
6 checks passed
@quiet-node
quiet-node deleted the feat/363-empty-submit-with-selection branch August 11, 2026 01:01
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.

Can you please make available an option to send request even if its empty (just selected context)

1 participant