Open source CapCut alternative.
TypeScript
docs: add permission pre-gate guide; trim permission grants from overlay guide
David Lec79d4b7ad7f2
diff --git a/docs/guides/permission-gate.md b/docs/guides/permission-gate.mdnew file mode 100644index 00000000..d071d9c6--- /dev/null+++ b/docs/guides/permission-gate.md@@ -0,0 +1,71 @@+# Permission Pre-Gate++Every macOS permission Donkey needs while a task is running is asked for in the notch first. The system's own permission dialog never appears on its own mid-task.++**The one rule:** Donkey never asks macOS for a permission it doesn't already hold until the user has approved it in the notch. A task that needs one stops and shows an Approve / Deny banner; only on Approve does the system dialog appear. The microphone is the lone exception — clicking the mic button is itself the approval, and macOS's dialog follows from there.++## How It Works++Two decisions stack. First the user decides whether Donkey may ask macOS at all; only then does macOS decide the actual grant.++### User grant flow (the notch)++```+a running task needs a system permission+ │+ ▼+ already granted? ── yes ──► the tool just runs (this check never prompts)+ │ no+ ▼+ the task stops and the notch shows a banner:+ "Needs your approval to control <app>" [ Approve ] [ Deny ]+ │ │+ Approve Deny+ │ │+ ▼ ▼+ ask macOS now (system grant flow) the task pauses, still resumable+ │ resuming asks again+ granted? ── yes ──► the task continues and the tool runs+ │ no+ ▼+ the task needs attention+```++The split: Donkey decides *whether to ask*, the user decides *whether to allow*, and macOS decides the actual grant.++### System grant flow (only after Approve)++```+the user approved+ │+ ▼+ Donkey asks macOS for the permission+ │+ ▼+ macOS shows its own dialog → user grants or denies+ │+ granted → the task continues denied → the task waits / needs attention+```++## Permission Inventory++Each permission Donkey can need while working, and how it is kept behind the gate.++| Permission | When it's needed mid-task | How it's handled |+| --- | --- | --- |+| Controlling another app | running an app-automation step | Stops at the notch gate; the system is asked only after Approve |+| Window housekeeping | un-minimizing a window before a screenshot | Done only if already granted, otherwise skipped — never asked (the app is already in front) |+| Screen recording | capturing the screen to see it | Checked but never asked mid-task; granted during first-run setup |+| Accessibility | reading or driving an app's controls | Checked but never asked mid-task; granted during first-run setup |+| Microphone | turning on voice from the notch | The mic button is the approval; macOS's dialog follows |++## Invariants++1. **Checking never prompts.** Asking "do we have this?" never shows a dialog. The only prompts are the one after Approve and the first-run setup screen.+2. **Deny is resumable.** Denying stops the task into a paused state; resuming runs it again and brings the banner back.+3. **Failure is graceful.** A wrong check at worst costs one extra Approve, and never blocks the agent from working.+4. **Housekeeping never prompts.** Background niceties skip themselves when their permission isn't held; they never raise a dialog.++## Where It Lives++One service owns checking and requesting permissions. The gate is raised where the harness runs a tool, and Approve triggers the request from the task lifecycle. The Approve / Deny banner is the permission row in the expanded notch.diff --git a/docs/guides/user-query-overlay.md b/docs/guides/user-query-overlay.mdindex af07121d..68da1717 100644--- a/docs/guides/user-query-overlay.md+++ b/docs/guides/user-query-overlay.md@@ -13,16 +13,11 @@ guarded runtime (`docs/guides/agent-harness.md`).## Startup Gate-First launch shows a native welcome screen, then a Google-only Mac sign-in,-then a permission setup screen for Accessibility, Screenshots, and Microphone-with user-visible reasons. Until the browser returns through-`donkey://auth/callback`, the app exchanges the code for a Better Auth cookie,-and core permission setup completes, the notch is not shown and double-Command-activation is not registered. `DonkeyAuthCoordinator` and-`DonkeyLoginWindowController` own the sign-in gate;-`MacPermissionSetupWindowController` owns the permission gate. Protected-folders (Desktop, Documents, Downloads) stay lazy and are requested only when-a user-requested local-item lookup needs them.+First launch shows a native welcome screen, then a Google-only Mac sign-in.+Until the browser returns through `donkey://auth/callback` and the app+exchanges the code for a Better Auth cookie, the notch is not shown and+double-Command activation is not registered. `DonkeyAuthCoordinator` and+`DonkeyLoginWindowController` own the sign-in gate.## Activation and the Prompt@@ -161,9 +156,8 @@ and selection.Manually verify after overlay changes:-- Startup: welcome → sign-in → permission setup; Continue enables only when- all three permissions are ready; no Desktop/Documents/Downloads prompts- during startup.+- Startup: welcome → sign-in; the notch and double-Command activation appear+ only after sign-in completes.- Activation: release opens focused text input without microphone capture;hold opens voice mode; the microphone affordance starts capture; unrelatedCommand use does not activate the overlay.