Skip to content

A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.

TypeScript

Merge pull request #183 from MarsSall/fix/windows-pointer-held-modifiers

Quiqued13b17fdb714
diff --cc apps/desktop/src-tauri/src/computer/win.rs
index 2d630c8,5c2602c..05332ed
--- a/apps/desktop/src-tauri/src/computer/win.rs
+++ b/apps/desktop/src-tauri/src/computer/win.rs
@@@ -29,10 -29,13 +29,13 @@@ use super::risk::{AxElement, Focus}
use super::glow::Frame;
use super::winaccess::{element, is_default, known_chain, unreadable, UIA_BUTTON, UIA_WINDOW};
use super::winapps::{
- answers_to, app_pids, executable_target, fronts_same_app, hosted_page, request, shortcut_named, strip_ci, Request,
- TopWindow,
+ active_entries, answers_to, distinct_names, executable_target, fronts_same_app, hosted_page, listed_name,
+ listed_windows, request, shortcut_named, strip_ci, Request, TopWindow,
};
- use super::winput::{checks_typing_target, releases, send_batches, settles, steps, without_held_modifiers, Step, VirtualScreen};
+ use super::winput::{
+ checks_held_modifiers, checks_typing_target, releases, send_batches, settles, steps, without_held_modifiers, Step,
+ VirtualScreen,
+ };
use super::{
runs_as_administrator, AppInfo, Capture, InputEvent, KeyboardRecipient, MouseButton, TypedError,
KEYS_CHANGED_WHILE_TYPING,
diff --cc docs/design.md
index 3a16144,5b77dc6..e5c2256
--- a/docs/design.md
+++ b/docs/design.md
@@@ -170,10 -170,10 +170,10 @@@ The UI shows one endless chat: no conve
The assistant can see the screen and operate apps through a built-in MCP server that the desktop app serves. macOS (L59) and Windows (S24.11); Linux, the web page and a VPS never offer it.
- S24.1 Helper: native Rust inside the Tauri app (`apps/desktop/src-tauri`), never in the daemon or the engine. It serves MCP (JSON-RPC 2.0 over streamable HTTP) on `http://127.0.0.1:<random port>/mcp` and requires `Authorization: Bearer <key>`, a fresh random key per app launch.
-- S24.2 Tools: `screenshot`, `click`, `move`, `drag`, `scroll`, `type`, `key`, `open_app`, `list_apps`, `wait`, each with an optional `intent`. Screenshots of the display under the pointer are downscaled to a long edge of 1280 px; coordinates are pixels of the latest screenshot; actions return a fresh one; Gentle Dot's own windows are left out.
+- S24.2 Tools: `screenshot`, `click`, `move`, `drag`, `scroll`, `type`, `key`, `open_app`, `list_apps`, `wait`, each with an optional `intent`. Screenshots of the display under the pointer are downscaled to a long edge of 1280 px; coordinates are pixels of the latest screenshot; actions return a fresh one; Gentle Dot's own windows are left out. On Windows, a detached Store app frame is listed by its shell display name (or its window title, or the frame host when neither is available), separately from other detached frames; two of them with the same name get their window titles appended (`Fotos — img.jpg`), and one is marked active only when it is the foreground window itself. This name is for listing only: the minimized app cannot be acted on until it is restored and identified; the action blocklist is unchanged.
- S24.3 Session grant: the first call without a session shows a native dialog ("Allow Gentle Dot to see and control this Mac for 30 minutes?"). A session ends on timeout, Stop, the tray item, or the panic shortcut ⌥⇧Esc, and queued actions are dropped.
- S24.4 Guards: a fixed blocklist (Gentle Dot itself, System Settings, SecurityAgent, loginwindow, Keychain Access, password managers), 10 actions per second, and a native per-action confirmation for risky actions (send, pay, buy, delete, submit, confirm, transfer, and their Spanish equivalents, by Accessibility role and title, by `return` on a default button, or by the declared `intent`). Keyboard actions go only to the app that was steadily in front during the latest screenshot; their recipient is fixed when they are checked and confirmed and rechecked before each chunk of text, each Return, and the key, and a change stops the input with the count of characters already sent. After a confirmation, the app in front before the dialog must be back in front within 500 ms, or nothing is done.
- - Windows held-modifier guard: before each keyboard post (text chunk, Return, or key), read both sides of Ctrl, Alt, Shift and Win with `GetAsyncKeyState`. Refuse before pressing the event's own modifiers, so an injected `ctrl+t` does not refuse itself. A pressed modifier may be the user's or one a failed post could not release, so the message names both ways out. One key reports exactly "Ctrl is pressed, so nothing was sent. Release Ctrl, or press and release it once if no one is holding it, and try again." Several keys are named once in Ctrl/Alt/Shift/Win order, joined with ", " and a final " and ", e.g. "Ctrl, Alt and Shift are pressed, so nothing was sent. Release them, or press and release each once if no one is holding them, and try again." After earlier text landed, "nothing was sent" becomes "the rest was not sent" and the character count is appended, e.g. "Shift is pressed, so the rest was not sent. Release Shift, or press and release it once if no one is holding it, and try again. Typing stopped after 5 of 11 characters." Before any text lands, the suffix is "Typing stopped after 0 of M characters." This is a pre-post snapshot, not a fence against keys pressed during the post. Pointer actions do not check held modifiers yet; macOS/Linux behavior is unchanged.
+ - Windows held-modifier guard: before each keyboard post (text chunk, Return, or key), read both sides of Ctrl, Alt, Shift and Win with `GetAsyncKeyState`. Refuse before pressing the event's own modifiers, so an injected `ctrl+t` does not refuse itself. A pressed modifier may be the user's or one a failed post could not release, so the message names both ways out. One key reports exactly "Ctrl is pressed, so nothing was sent. Release Ctrl, or press and release it once if no one is holding it, and try again." Several keys are named once in Ctrl/Alt/Shift/Win order, joined with ", " and a final " and ", e.g. "Ctrl, Alt and Shift are pressed, so nothing was sent. Release them, or press and release each once if no one is holding them, and try again." After earlier text landed, "nothing was sent" becomes "the rest was not sent" and the character count is appended, e.g. "Shift is pressed, so the rest was not sent. Release Shift, or press and release it once if no one is holding it, and try again. Typing stopped after 5 of 11 characters." Before any text lands, the suffix is "Typing stopped after 0 of M characters." Pointer actions that press a button or turn the wheel (`click`, `drag`, `scroll`) take the same snapshot before posting anything, since a held modifier would make them a Ctrl+click, a Shift+click that extends the selection, an Alt+click, or a Ctrl+wheel zoom. A refusal sends nothing, not even a drag's button press, and uses the "nothing was sent" wording with no character count, e.g. "Ctrl is pressed, so nothing was sent. Release Ctrl, or press and release it once if no one is holding it, and try again." Pointer posts press no modifiers of their own. A plain `move` presses nothing, so it is not checked. This is a pre-post snapshot, not a fence against keys pressed during the post. macOS/Linux behavior is unchanged.
- The guard also refuses when the agent's own combo needs the modifier the user is resting on (a finger on Shift while it sends `shift+tab`); this is conservative and intended.
- S24.5 Permissions: the app reports and requests Accessibility and Screen Recording (`computer_permissions`, `computer_request_permission {kind}`). The Connectors screen shows a built-in "Computer" entry with both statuses, Grant buttons, Check again, the note that debug builds lose the grants on every rebuild (macOS ties them to the code signature), and a note when the current model does not accept images (`ConnectorInfo.noImages`, from the model's `input` in the engine's `get_state` and `set_model` answers).
- S24.6 Visible state: the app emits `computer://state {active, endsAt?, reason?}` (`computer_status` gives the current one). Between calls, the rose shows the "in control" state (`dot-in_control`, mood `control`: accent rim, steady traveling light) and the panel shows "Controlling your Mac · mm:ss left" with Stop (`computer_stop`). During a screenshot or action call (including an entire batch and its final screenshot), the Dot and panel are temporarily hidden and the top edge of the controlled display glows in the rose's neon with a light traveling along it, without text or logo. The click-through glow must be ready and hiding confirmed before capture or input; failed preparation sends no input. Completion and normal error/Stop paths restore prior visibility without changing saved preferences or taking focus. The tray's "Stop computer control" and the panic shortcut remain independent of the hidden panel; shortcut registration and full-screen tray availability must be verified on the target Mac.