Skip to content

Stream writing results and add result copy with ⇧⌘C - #4

Open
wanming wants to merge 5 commits into
mainfrom
claude/project-thread-alfpzt
Open

wanming wants to merge 5 commits into
mainfrom
claude/project-thread-alfpzt

Conversation

@wanming

@wanming wanming commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Requested by Tom · project thread

Before: after pressing Enter, the popover shows "Transforming..." beside three static dots until the whole answer arrives. A result can only be inserted, so when there is no app to insert into, the user is stuck with the "Could not find the target app" error.

After: the result area appears as soon as the first words arrive and grows as text streams in, scrolling to keep the newest line visible. The toolbar shows an esc Stop hint, and stopping discards the partial text. The finished result replaces the streamed text and is editable as before. The result also has an icon-only copy button with a tooltip and VoiceOver label. Shift+Command+C copies the whole result from either editor. Copying shows a checkmark briefly and leaves the popover open. Plain Command+C still copies only the selection.

How: LLMProvider gains streamTransform(_:onPartialOutput:). Its default implementation calls transform, so Anthropic, Gemini and chat-completion providers behave as they do today. OpenAIProvider implements it with "stream": true and a small ResponseStreamParser for Responses API server-sent events. That parser handles text deltas, a fallback to response.completed, and error/response.failed events. TransformationService forwards trimmed partials and keeps the existing timeout and connection-lost retry. The view model publishes streamingResultText on the main queue and uses a generation counter so late partials from a cancelled run are dropped. The view shows that text read-only while transforming. WritingPopoverKeyboardPolicy maps Shift+Command+C by character (not key code), so it follows non-QWERTY layouts, and ignores it while composing input. New strings popover.hint.stop, popover.action.copyResult and popover.action.copyResultHelp are added and popover.hint.accessibility is updated in all 10 languages. Both READMEs and the manual checklist are updated.

Notes for review:

  • The total request timeout is unchanged (20 s default). A very long answer can still time out mid-stream, and the partial text is then discarded, as it would have been before. Treating the timeout as time to first token could be a follow-up.
  • Shift+Command+C is not shown in the bottom hint bar because the bar is already full. It appears in the copy button tooltip and the VoiceOver hint.
  • swift test and the localization checks pass in CI on macOS 15. An equivalent build of the shortcut was run locally as Inklet Local.

Manual QA (not run): see the new "Streaming result", "Streaming cancellation" and "Copy result" items in docs/manual-test-checklist.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BXH1caQ6B1mSdP4axrmkow

claude added 2 commits October 4, 2026 23:28
OpenAI Responses requests now stream, and the popover shows the text as
it arrives instead of waiting for the full answer behind static dots.
The final result still replaces the streamed text and stays editable.
Escape (or the new Stop hint) stops generation and discards the partial
text. Providers without streaming keep returning the complete result.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXH1caQ6B1mSdP4axrmkow
The result area gets an icon-only copy control with a tooltip and
accessibility label. It shows a checkmark briefly after copying, keeps
the popover open, and gives a way out when there is no app to insert
into. The result text keeps clear of the icon on long first lines.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXH1caQ6B1mSdP4axrmkow
@wanming wanming self-assigned this Oct 4, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXH1caQ6B1mSdP4axrmkow
@wanming
wanming marked this pull request as ready for review October 4, 2026 23:36
claude added 2 commits October 4, 2026 23:50
The shortcut works from either editor, matches the C key by character
so other keyboard layouts work, and leaves plain Command-C for copying
selected text. The copy button's tooltip names the shortcut.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXH1caQ6B1mSdP4axrmkow
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXH1caQ6B1mSdP4axrmkow
@wanming wanming changed the title Stream writing results and add a result copy button Stream writing results and add result copy with ⇧⌘C Oct 5, 2026
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.

2 participants