Allowlist: readonly entry, on_deny = continue, tokens of stopped runs (#20)

This commit was merged in pull request #20.
This commit is contained in:
hermes committed 2026-11-14 12:54:15 +00:00
1 parent 9ce4756fad
commit 39a2e74742
11 files changed
+487 -89

No files matched your search

+23
View File
@@ -15,6 +15,14 @@ pub struct Budget {
pub max_tokens: Option<u64>,
}
#[derive(Deserialize, Debug, Clone, Copy, Default, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum OnDeny {
#[default]
Stop,
Continue,
}
#[derive(Deserialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct Profile {
@@ -38,6 +46,11 @@ pub struct Profile {
/// Present = enforced by `orch guard` inside hx and re-checked on the event stream; a denied call ends
/// the run as needs-human.
pub allow: Option<Vec<String>>,
/// What a denied tool call does: `stop` (default) ends the run as needs-human; `continue` answers the agent with
/// the reason so it can pick another way. Credentials, paths outside the worktree, `git push` and `.git`/`.hx`
/// always stop. Every deny is audited and counted (`denies` in the run and in telemetry).
#[serde(default)]
pub on_deny: OnDeny,
/// Extra directories the agent may read besides the worktree.
#[serde(default)]
pub read_roots: Vec<PathBuf>,
@@ -135,6 +148,16 @@ mod tests {
);
}
#[test]
fn on_deny_parses() {
assert_eq!(Profile::parse("").unwrap().on_deny, OnDeny::Stop);
assert_eq!(
Profile::parse("on_deny = \"continue\"").unwrap().on_deny,
OnDeny::Continue
);
assert!(Profile::parse("on_deny = \"ignore\"").is_err());
}
#[test]
fn allowlist_validated() {
assert!(Profile::parse("allow = [\"read\", \"bash:cargo *\"]").is_ok());