Repository navigation
feat(app): pick Auto or Manual permission mode per session - #319
Conversation
Adds a permission-mode select to the prompt bar, immediately right of the model select. Code sessions default to Manual, Work sessions to Auto — which is what each side already did; the change is that the choice is now visible and per-session. It drives the same client-side auto-accept state as the `permissions.autoaccept` command and the Settings switch, so all three agree. A session takes an explicit override; a draft steers the directory default, matching what that command already does there. Work needed the mode to become real. Its sandbox guest config shipped `permission: "allow"`, and a server told to allow everything never emits `permission.asked`, so Manual would have had nothing to gate. The guest now asks like any other server and the walk-away default moved host-side, where `enableConfiguredDirectory` seeds Work directories to auto-accept. Existing sandboxes pick this up on their next start; until then their select renders a non-interactive Auto explaining why it is fixed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Matches the TUI's consent gate. The first Code-side enable in an app run raises a confirm dialog — "permission requests that are not explicitly denied will be approved automatically", and that this is dangerous — focused on Cancel so a stray Enter declines, followed by a warning toast. Later enables in the same run are silent, and turning it off never asks. All three doors go through one gate: the prompt's mode select, the `permissions.autoaccept` command, and the Settings switch. A warning one of them skips is theatre. Work never asks. Auto is the default there, which nobody chose, and the sandbox confines the agent to the VM and one mounted folder — so a dialog would greet every new Work session with a question about a decision it did not make. The dialog claims focus twice, on mount and on the next frame: the prompt input restores focus to its editor a frame after its menu closes, and without the second claim Enter would send the prompt out from under an open dialog. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Added: consent gate for Code-side auto-approve (541ea30)Matches the TUI's All three doors go through one gate — the prompt's mode select, the Work never asks. Auto is the default there, which nobody chose, and the sandbox confines the agent to the VM and one mounted folder — a dialog would greet every new Work session with a question about a decision it did not make. The rule lives in One thing worth a reviewer's eye: the dialog claims focus twice, on mount and on the next animation frame. The prompt input restores focus to its editor a frame after its menu closes ( Verified in the running app
Still unverified against a real sandbox — no sandboxes and no built
|
Adds a permission-mode select to the prompt bar, immediately right of the model select.
It drives the same client-side auto-accept state as the
permissions.autoacceptcommand (Cmd/Ctrl+Shift+A) and the Settings → General switch, so all three stay in step instead of becoming a third source of truth. In a session it writes a session-level override, so that session stops following its directory default. On a draft it steers the directory default — what that command already does there, and what the new session inherits when it is sent.Work needed the mode to become real
The sandbox guest config shipped
permission: "allow". A server told to allow everything resolves every action toallowand never emitspermission.asked(packages/core/src/permission.ts:160), so Manual would have had nothing to gate — the control would have been decorative on the Work side.That line is gone. The guest asks like any other server now, and the walk-away default moved host-side:
enableConfiguredDirectorygained anautoByDefaultparameter, passed assideForServerKey(activeServer()) === "work". Net default behaviour on Work is unchanged; the difference is that Manual is enforceable.Two consequences:
permission: "allow"gets.Files
packages/app/src/components/prompt-input-v2.tsxPromptInputV2PermissionControl, passed through the existingmodelControlslot as a fragment — no new slot insession-ui, one fewer upstream file touchedpackages/app/src/components/prompt-input/permission-mode.ts(+ test)packages/app/src/context/permission.tsxautoByDefaultfor the Work defaultpackages/desktop/src/main/sandbox/egress.tspackages/app/src/i18n/{en,es,vi}.tsprompt.permission.*DIVERGENCES.md,CHANGELOG.mdThe TUI's own
shift+tabmanual/auto cycle is untouched.Testing
bun typecheckand the suites are clean in both packages — app 703 unit + 130 browser, desktop 136.Driven in the running dev app over CDP: on a Code session the select renders right of the model select showing Manual, opening it lists
Auto=false | Manual=true, picking Auto flips the trigger and the menu state, and picking Manual returns it.Not verified against a real sandbox. The dev machine has no sandboxes and no built
codev-vmmhelper, so the Work auto default, the guest-config change, and the locked fallback are covered by reasoning and unit tests only. Worth a manual pass on a machine with a sandbox before release.🤖 Generated with Claude Code