feat(tui): persist permission rules from approval prompts#2062
Open
greyfreedom wants to merge 19 commits into
Open
feat(tui): persist permission rules from approval prompts#2062greyfreedom wants to merge 19 commits into
greyfreedom wants to merge 19 commits into
Conversation
3 tasks
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive typed permission system for tool execution, enabling granular control over shell commands and file operations through a new [[permissions.rules]] configuration. It adds the codewhale-execpolicy crate to manage these rules, supports specificity-based resolution, and allows users to persist new rules directly from the TUI during the approval process. Feedback suggests implementing atomic writes when updating the configuration file to prevent potential corruption, deduplicating path normalization logic between the TUI and execution policy crates, and refining the unified diff parsing logic to be more robust against false positives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add TUI support for persisting typed permission rules directly from tool approval prompts.
This builds on the typed execpolicy/config work by letting users save a scoped allow rule while approving a tool call, with a preview of the rule that will be written to user config.
Changes
ApprovalRequest.s: save this rule and approvep: view the full generated rule preview[[permissions.rules]].ExecPolicyEngineso the current session benefits immediately.apply_patchvia extracted patch/file pathsedit_fileandfile_edit.Safety Notes
Tests
cargo fmt --allcargo test -p deepseek-execpolicy --all-featurescargo test -p deepseek-tui persistent_permission --all-featurescargo test -p deepseek-tui typed_permission --all-featurescargo test -p deepseek-tui approval --all-featurescargo test -p deepseek-tui persist_permission --all-featurescargo clippy -p deepseek-tui --all-targets --all-features -- -D warningsgit diff --checkDepends On
This PR is stacked on top of PR2: feat/execpolicy-typed-rules
Closes #1186
Depends on #2053