zed/crates/agent_settings
Richard Feldman 274b1f3ac9
Add tool permission evaluation logic (#46155)
This builds on https://github.com/zed-industries/zed/pull/46112 (which
should be merged first) and adds the permission evaluation logic and
integrates it with the terminal tool as part of the tool permissions
feature. This is a separate PR for [stacked
diffs](https://newsletter.pragmaticengineer.com/p/stacked-diffs) to make
review easier.

## Changes

- **Add `tool_permissions.rs`** with `decide_permission()` function that
implements:
  - `deny > confirm > allow` precedence hierarchy (security-critical)
  - Case-sensitive and case-insensitive regex matching
  - Integration with existing `always_allow_tool_actions` setting
  - Comprehensive unit tests (15 tests)

- **Integrate with terminal tool**:
  - Commands matching deny rules are blocked immediately with an error
  - Commands matching allow rules proceed without confirmation dialog
  - Commands requiring confirmation show the dialog as before
  - Added integration tests for deny and allow rule scenarios

Co-Authored-By: Claude Opus 4.5

Release Notes:

- N/A

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-01-08 22:49:15 -05:00
..
src Add tool permission evaluation logic (#46155) 2026-01-08 22:49:15 -05:00
Cargo.toml Add granular tool permissions settings (#46112) 2026-01-08 14:32:18 -08:00
LICENSE-GPL Rename assistant_settings to agent_settings (#31513) 2025-05-27 15:16:55 +00:00