Expand description
Execution Policy Module
Provides types and managers for controlling command execution authorization, inspired by OpenAI Codex’s execution policy patterns.
§Architecture
approval: Approval requirement types (ExecApprovalRequirement, AskForApproval)policy: Policy definitions and rule matching (Policy, PrefixRule, Decision)parser: Policy file parsing (TOML, JSON, simple formats)manager: The central ExecPolicyManager coordinating all components
§Example
ⓘ
use vtcode_core::exec_policy::{ExecPolicyManager, Decision};
let manager = ExecPolicyManager::with_defaults(workspace_root);
manager.add_prefix_rule(&["cargo".to_string()], Decision::Allow).await?;
let result = manager.check_approval(&["cargo", "build"]).await;Modules§
Structs§
- Exec
Policy Amendment - A proposed amendment to the execution policy.
- Exec
Policy Config - Configuration for the execution policy manager.
- Exec
Policy Manager - Manages execution policies and authorization decisions.
- Policy
- Execution policy containing rules for command authorization.
- Policy
Evaluation - Result of evaluating multiple commands against a policy.
- Policy
File - A serializable policy file format.
- Policy
Parser - Parser for policy files.
- Policy
Rule - A single rule in the policy file.
- Prefix
Rule - A prefix-based rule for matching commands.
- Reject
Config - Fine-grained rejection controls for approval prompts.
Enums§
- AskFor
Approval - Policy for when to ask for approval before executing commands.
- Decision
- Decision made by a policy rule.
- Exec
Approval Requirement - Requirement for approval before executing a command.
- Rule
Match - Result of matching a command against a rule.
Functions§
- default_
exec_ approval_ requirement - Compute the default approval requirement for a tool invocation.
Type Aliases§
- Shared
Exec Policy Manager - Shared reference to an ExecPolicyManager.