Quick chat window with global hotkey #6

Merged
hegdeatri merged 13 commits from feature/quick-chat-popup into master 2026-05-19 12:17:46 +01:00
Owner
No description provided.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pure reducer over (user_submit, delta, complete, error, reset) drives a
small in-memory transcript. send() snapshots completed turns, cancels
any in-flight stream via AbortController, then calls streamChat in
fast agent mode (max_tool_rounds: 1). reset wipes state on demand.

Tests skipped: repo has no frontend test harness; setting one up for
this single hook is out of scope. Reducer is small and verified via
the end-to-end smoke test in Task 9.
QuickChat + QuickMessage components render the popup. Esc clears
input or hides window when empty. Enter sends; Shift+Enter newlines.
The component listens for 'quick-chat://reset' and wipes transcript
on every (re)open.

Also fix the WebviewUrl: Next 16 static export emits out/quick.html
as a sibling, not out/quick/index.html, so the Tauri builder URL was
updated to match.
Tauri's WebviewUrl::App resolves against devUrl in dev (Next dev
server on :3000) and frontendDist in prod (out/). Next 16's default
static export emits routes as sibling .html files (out/quick.html),
which Next dev does not serve — so the popup window hit a 404 under
'bunx tauri dev'.

Enable trailingSlash so the static export emits out/quick/index.html
and switch the WebviewUrl to 'quick/'. Next dev serves /quick/ via
the App Router; prod serves the static index.html. Main window URL
'/' is unaffected.
Add core🪟allow-set-size capability and use a ResizeObserver
on the popup content to call setSize() whenever the natural content
height changes. Transcript max-height: 480px so the OS window grows
up to ~560 then the transcript scrolls internally. On reset, snap
the window back to the 80px input-only size.
Centering: monitor.position()/size() return physical pixels but the
window's logical size is 640×80 (set via JS setSize). On scaled
displays the physical-vs-logical mismatch nudged the window right of
center. Convert monitor rect to logical via scale_factor before
computing position.

Flash: the transcript wrapper used to mount on first submit, which
caused a single-frame layout reflow and ResizeObserver-lag while
the OS window caught up. Always mount the wrapper (collapsed via
data-empty when no turns) and run the resize call in useLayoutEffect
so the window grows in the same frame as the DOM update.
hegdeatri merged commit 9fa4f4c57a into master 2026-05-19 12:17:46 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hegdeatri/pkma-rs!6
No description provided.