Skip to main content

Module exec_policy

Module exec_policy 

Source
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§

command_validation

Structs§

ExecPolicyAmendment
A proposed amendment to the execution policy.
ExecPolicyConfig
Configuration for the execution policy manager.
ExecPolicyManager
Manages execution policies and authorization decisions.
Policy
Execution policy containing rules for command authorization.
PolicyEvaluation
Result of evaluating multiple commands against a policy.
PolicyFile
A serializable policy file format.
PolicyParser
Parser for policy files.
PolicyRule
A single rule in the policy file.
PrefixRule
A prefix-based rule for matching commands.
RejectConfig
Fine-grained rejection controls for approval prompts.

Enums§

AskForApproval
Policy for when to ask for approval before executing commands.
Decision
Decision made by a policy rule.
ExecApprovalRequirement
Requirement for approval before executing a command.
RuleMatch
Result of matching a command against a rule.

Functions§

default_exec_approval_requirement
Compute the default approval requirement for a tool invocation.

Type Aliases§

SharedExecPolicyManager
Shared reference to an ExecPolicyManager.