1use std::collections::BTreeMap;
5
6use adk_core::principal::{SubjectKind, SubjectRef};
7use adk_core::{ArgPredicate, STATIC_TOOL_ORIGIN, ToolConfirmationRequest, ToolOrigin};
8use chrono::{DateTime, Utc};
9use serde::{Deserialize, Serialize};
10use serde_json::Value;
11
12use super::matcher::{is_protected_path, plain_shell_words};
13
14#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
34#[serde(tag = "kind", rename_all = "camelCase", deny_unknown_fields)]
35pub enum RuleScope {
36 #[serde(rename_all = "camelCase")]
38 User {
39 app_name: String,
41 user_id: String,
43 subject_kind: SubjectKind,
45 },
46 #[serde(rename_all = "camelCase")]
48 Session {
49 app_name: String,
51 user_id: String,
53 subject_kind: SubjectKind,
55 session_id: String,
57 },
58}
59
60impl RuleScope {
61 pub fn app_name(&self) -> &str {
63 match self {
64 Self::User { app_name, .. } | Self::Session { app_name, .. } => app_name,
65 }
66 }
67
68 pub fn user_id(&self) -> &str {
70 match self {
71 Self::User { user_id, .. } | Self::Session { user_id, .. } => user_id,
72 }
73 }
74
75 pub fn subject_kind(&self) -> SubjectKind {
77 match self {
78 Self::User { subject_kind, .. } | Self::Session { subject_kind, .. } => *subject_kind,
79 }
80 }
81
82 pub fn session_id(&self) -> Option<&str> {
84 match self {
85 Self::User { .. } => None,
86 Self::Session { session_id, .. } => Some(session_id),
87 }
88 }
89}
90
91#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
106#[serde(tag = "kind", rename_all = "camelCase", deny_unknown_fields)]
107pub enum OriginPin {
108 #[serde(rename_all = "camelCase")]
110 Exact {
111 source: String,
113 declaration_digest: String,
115 },
116 #[serde(rename_all = "camelCase")]
118 AnyDeclaration {
119 source: String,
121 },
122 #[serde(rename_all = "camelCase")]
127 ExactEach {
128 source: String,
130 declarations: BTreeMap<String, String>,
132 },
133}
134
135impl OriginPin {
136 pub fn exact(origin: &ToolOrigin) -> Self {
138 Self::Exact {
139 source: origin.source.clone(),
140 declaration_digest: origin.declaration_digest.clone(),
141 }
142 }
143
144 pub fn admits(&self, origin: &ToolOrigin) -> bool {
146 match self {
147 Self::Exact { source, declaration_digest } => {
148 *source == origin.source && *declaration_digest == origin.declaration_digest
149 }
150 Self::AnyDeclaration { source } => *source == origin.source,
151 Self::ExactEach { source, declarations } => {
153 *source == origin.source
154 && declarations.values().any(|digest| *digest == origin.declaration_digest)
155 }
156 }
157 }
158
159 pub fn source(&self) -> &str {
161 match self {
162 Self::Exact { source, .. }
163 | Self::AnyDeclaration { source }
164 | Self::ExactEach { source, .. } => source,
165 }
166 }
167}
168
169#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
182#[serde(rename_all = "camelCase", deny_unknown_fields)]
183pub enum ArgSpec {
184 #[serde(rename_all = "camelCase")]
186 Equals {
187 pointer: String,
189 value: Value,
191 },
192 #[serde(rename_all = "camelCase")]
194 InSet {
195 pointer: String,
197 values: Vec<Value>,
199 },
200 #[serde(rename_all = "camelCase")]
202 AtMost {
203 pointer: String,
205 max: f64,
207 },
208 #[serde(rename_all = "camelCase")]
210 StartsWith {
211 pointer: String,
213 prefix: String,
215 },
216 #[serde(rename_all = "camelCase")]
218 DomainIn {
219 pointer: String,
221 domains: Vec<String>,
223 },
224}
225
226impl ArgSpec {
227 pub fn to_predicate(&self) -> ArgPredicate {
229 match self {
230 Self::Equals { pointer, value } => ArgPredicate::equals(pointer.clone(), value.clone()),
231 Self::InSet { pointer, values } => {
232 ArgPredicate::in_set(pointer.clone(), values.iter().cloned())
233 }
234 Self::AtMost { pointer, max } => ArgPredicate::at_most(pointer.clone(), *max),
235 Self::StartsWith { pointer, prefix } => {
236 ArgPredicate::starts_with(pointer.clone(), prefix.clone())
237 }
238 Self::DomainIn { pointer, domains } => {
239 ArgPredicate::domain_in(pointer.clone(), domains.iter().cloned())
240 }
241 }
242 }
243
244 pub fn holds(&self, args: &Value) -> bool {
246 self.to_predicate().holds(args)
247 }
248}
249
250impl From<ArgSpec> for ArgPredicate {
251 fn from(spec: ArgSpec) -> Self {
252 spec.to_predicate()
253 }
254}
255
256#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
271#[serde(rename_all = "camelCase", deny_unknown_fields)]
272pub enum RulePredicate {
273 Arg(ArgSpec),
275 #[serde(rename_all = "camelCase")]
277 ShellPrefix {
278 pointer: String,
280 tokens: Vec<String>,
282 },
283 #[serde(rename_all = "camelCase")]
286 PathWithin {
287 pointer: String,
289 dir: String,
291 },
292 #[serde(rename_all = "camelCase")]
297 WritesWithin {
298 dir: String,
300 },
301}
302
303#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
313#[serde(tag = "kind", rename_all = "camelCase", try_from = "RawDecision")]
314pub enum StandingDecision {
315 Allow,
317 Deny {
319 reason: String,
321 },
322}
323
324#[derive(Deserialize)]
328#[serde(deny_unknown_fields)]
329struct RawDecision {
330 kind: String,
331 #[serde(default)]
332 reason: Option<String>,
333}
334
335impl TryFrom<RawDecision> for StandingDecision {
336 type Error = String;
337
338 fn try_from(raw: RawDecision) -> std::result::Result<Self, Self::Error> {
339 match (raw.kind.as_str(), raw.reason) {
340 ("allow", None) => Ok(Self::Allow),
341 ("deny", Some(reason)) => Ok(Self::Deny { reason }),
342 (kind, _) => Err(format!("unknown standing decision '{kind}'")),
343 }
344 }
345}
346
347#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
385#[serde(rename_all = "camelCase", deny_unknown_fields)]
386pub struct StandingRule {
387 pub id: String,
389 pub scope: RuleScope,
391 pub tool: String,
393 pub origin: OriginPin,
395 #[serde(default)]
397 pub agent: Option<String>,
398 #[serde(default)]
400 pub predicates: Vec<RulePredicate>,
401 pub decision: StandingDecision,
403 pub created_by: SubjectRef,
405 pub created_at: DateTime<Utc>,
407 #[serde(default)]
409 pub expires_at: Option<DateTime<Utc>>,
410 pub label: String,
412 #[serde(default)]
414 pub source_fingerprint: Option<String>,
415}
416
417pub const SHELL_PREFIX_SUGGESTION_DENYLIST: &[&str] =
426 &["sh", "bash", "env", "xargs", "eval", "exec", "sudo", "nohup"];
427
428#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
436#[serde(rename_all = "camelCase")]
437pub enum SuggestedScope {
438 User,
440 Session,
442}
443
444#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
460#[serde(rename_all = "camelCase")]
461pub struct RuleSuggestion {
462 pub label: String,
465 pub scope: SuggestedScope,
467 pub tool: String,
469 pub origin: OriginPin,
472 pub predicates: Vec<RulePredicate>,
474 pub runs_scripts: bool,
477}
478
479#[derive(Clone, Debug, PartialEq, Eq)]
497pub struct RuleOwner {
498 pub app_name: String,
500 pub user_id: String,
502 pub subject_kind: SubjectKind,
504 pub session_id: String,
506 pub created_by: SubjectRef,
508}
509
510impl RuleSuggestion {
511 pub fn into_rule(
535 self,
536 owner: &RuleOwner,
537 decision: StandingDecision,
538 source_fingerprint: Option<String>,
539 ) -> StandingRule {
540 let scope = match self.scope {
541 SuggestedScope::User => RuleScope::User {
542 app_name: owner.app_name.clone(),
543 user_id: owner.user_id.clone(),
544 subject_kind: owner.subject_kind,
545 },
546 SuggestedScope::Session => RuleScope::Session {
547 app_name: owner.app_name.clone(),
548 user_id: owner.user_id.clone(),
549 subject_kind: owner.subject_kind,
550 session_id: owner.session_id.clone(),
551 },
552 };
553 StandingRule {
554 id: uuid::Uuid::new_v4().to_string(),
555 scope,
556 tool: self.tool,
557 origin: self.origin,
558 agent: None,
559 predicates: self.predicates,
560 decision,
561 created_by: owner.created_by.clone(),
562 created_at: Utc::now(),
563 expires_at: None,
564 label: self.label,
565 source_fingerprint,
566 }
567 }
568}
569
570pub(crate) const EDIT_TOOLS: &[&str] = &["write_file", "edit_file", "apply_patch"];
572
573pub(crate) const NEVER_ELIGIBLE_TOOLS: &[&str] =
575 &["exit_plan_mode", "memory_write", "memory_delete"];
576
577fn runs_scripts(tokens: &[&str]) -> bool {
579 let first = tokens.first().copied().unwrap_or_default();
580 let second = tokens.get(1).copied().unwrap_or_default();
581 match first {
582 "make" | "just" | "gradle" | "./gradlew" | "mvn" | "rake" | "tox" | "nox" => true,
583 "cargo" => !matches!(second, "fmt" | "metadata" | "tree" | "--version" | "search"),
584 "npm" | "pnpm" | "yarn" | "bun" => {
585 matches!(second, "test" | "run" | "start" | "install" | "ci" | "exec" | "build")
586 }
587 "npx" | "bunx" | "node" | "deno" | "python" | "python3" | "ruby" | "perl" | "go" => true,
588 other => other.contains('/'),
589 }
590}
591
592impl StandingRule {
593 pub fn suggestions(request: &ToolConfirmationRequest) -> Vec<RuleSuggestion> {
619 let Some(origin) = request.origin.as_ref() else {
620 return Vec::new();
621 };
622 let name = request.tool_name.as_str();
623 if NEVER_ELIGIBLE_TOOLS.contains(&name) {
624 return Vec::new();
625 }
626 let pin = OriginPin::exact(origin);
627 let static_tool = origin.source == STATIC_TOOL_ORIGIN;
628 if name == "bash" && static_tool {
629 if request.args.get("unsandboxed").and_then(Value::as_bool) == Some(true) {
630 return Vec::new();
631 }
632 let Some(command) = request.args.get("command").and_then(Value::as_str) else {
633 return Vec::new();
634 };
635 let Some(words) = plain_shell_words(command) else {
636 return Vec::new();
637 };
638 let Some(first) = words.first() else {
639 return Vec::new();
640 };
641 if SHELL_PREFIX_SUGGESTION_DENYLIST.contains(first) {
642 return Vec::new();
643 }
644 let scripts = runs_scripts(&words);
645 let mut out = Vec::new();
646 for width in [2usize, 1] {
647 if words.len() < width {
648 continue;
649 }
650 let tokens: Vec<String> = words[..width].iter().map(|w| (*w).to_string()).collect();
651 out.push(RuleSuggestion {
652 label: format!("bash: {} …", tokens.join(" ")),
653 scope: SuggestedScope::User,
654 tool: "bash".into(),
655 origin: pin.clone(),
656 predicates: vec![RulePredicate::ShellPrefix {
657 pointer: "/command".into(),
658 tokens,
659 }],
660 runs_scripts: scripts,
661 });
662 }
663 return out;
664 }
665 if matches!(
668 name,
669 "web_fetch" | "browser_navigate" | "browser_new_tab" | "browser_new_window"
670 ) && static_tool
671 {
672 let Some(host) =
673 request.args.get("url").and_then(Value::as_str).and_then(crate::web::url_host)
674 else {
675 return Vec::new();
676 };
677 if crate::web::is_private_host(&host) {
678 return Vec::new();
679 }
680 return vec![RuleSuggestion {
681 label: format!("{name}: any page on {host}"),
682 scope: SuggestedScope::User,
683 tool: name.into(),
684 origin: pin,
685 predicates: vec![RulePredicate::Arg(ArgSpec::DomainIn {
686 pointer: "/url".into(),
687 domains: vec![host],
688 })],
689 runs_scripts: false,
690 }];
691 }
692 if name == "web_search" && static_tool {
693 let Some(site) = request.args.get("site").and_then(Value::as_str) else {
694 return Vec::new();
695 };
696 let Some(host) = crate::web::url_host(&format!("https://{site}/")) else {
697 return Vec::new();
698 };
699 return vec![RuleSuggestion {
700 label: format!("web_search: searches restricted to {host}"),
701 scope: SuggestedScope::User,
702 tool: "web_search".into(),
703 origin: pin,
704 predicates: vec![RulePredicate::Arg(ArgSpec::Equals {
705 pointer: "/site".into(),
706 value: Value::String(host),
707 })],
708 runs_scripts: false,
709 }];
710 }
711 if EDIT_TOOLS.contains(&name) && static_tool {
712 let Some(paths) = crate::edits::edit_paths(name, &request.args) else {
713 return Vec::new();
714 };
715 if paths.is_empty()
716 || paths.iter().any(|path| {
717 is_protected_path(path) || path.split(['/', '\\']).any(|part| part == "..")
718 })
719 {
720 return Vec::new();
721 }
722 let pointer = if name == crate::edits::APPLY_PATCH { "/patch" } else { "/path" };
724 let mut out = vec![RuleSuggestion {
725 label: format!("{name}: anywhere in the workspace"),
726 scope: SuggestedScope::Session,
727 tool: name.to_string(),
728 origin: pin.clone(),
729 predicates: vec![RulePredicate::PathWithin {
730 pointer: pointer.into(),
731 dir: ".".into(),
732 }],
733 runs_scripts: false,
734 }];
735 if let Some(dir) = shared_dir(&paths) {
736 out.push(RuleSuggestion {
737 label: format!("{name}: within {dir}/"),
738 scope: SuggestedScope::Session,
739 tool: name.to_string(),
740 origin: pin,
741 predicates: vec![RulePredicate::PathWithin { pointer: pointer.into(), dir }],
742 runs_scripts: false,
743 });
744 }
745 return out;
746 }
747 if static_tool && crate::policy::HARNESS_TOOL_NAMES.contains(&name) {
748 return Vec::new();
750 }
751 vec![RuleSuggestion {
752 label: format!("{name}: any arguments from {}", origin.source),
753 scope: SuggestedScope::User,
754 tool: name.to_string(),
755 origin: pin,
756 predicates: Vec::new(),
757 runs_scripts: false,
758 }]
759 }
760
761 pub(crate) fn folder_suggestion(
770 request: &ToolConfirmationRequest,
771 origin_of: impl Fn(&str) -> Option<ToolOrigin>,
772 ) -> Option<RuleSuggestion> {
773 let origin = request.origin.as_ref()?;
774 let name = request.tool_name.as_str();
775 if origin.source != STATIC_TOOL_ORIGIN
776 || !EDIT_TOOLS.contains(&name)
777 || origin_of(name).as_ref() != Some(origin)
778 {
779 return None;
780 }
781 let paths = crate::edits::written_paths(name, &request.args)?;
782 if paths.is_empty()
783 || paths.iter().any(|path| {
784 is_protected_path(path) || path.split(['/', '\\']).any(|part| part == "..")
785 })
786 {
787 return None;
788 }
789 let declarations = EDIT_TOOLS
790 .iter()
791 .filter_map(|tool| Some((tool.to_string(), origin_of(tool)?)))
792 .filter(|(_, origin)| origin.source == STATIC_TOOL_ORIGIN)
793 .map(|(tool, origin)| (tool, origin.declaration_digest))
794 .collect();
795 let (dir, label) = match shared_dir(&paths) {
796 Some(dir) => (dir.clone(), format!("file writes: within {dir}/")),
797 None => (".".to_string(), "file writes: anywhere in the workspace".to_string()),
798 };
799 Some(RuleSuggestion {
800 label,
801 scope: SuggestedScope::Session,
802 tool: "*".into(),
803 origin: OriginPin::ExactEach { source: STATIC_TOOL_ORIGIN.into(), declarations },
804 predicates: vec![RulePredicate::WritesWithin { dir }],
805 runs_scripts: false,
806 })
807 }
808
809 pub fn is_expired(&self, now: DateTime<Utc>) -> bool {
817 self.expires_at.is_some_and(|at| now >= at)
818 }
819}
820
821fn shared_dir(paths: &[String]) -> Option<String> {
824 paths
825 .iter()
826 .map(|path| {
827 std::path::Path::new(path.trim_start_matches("./"))
828 .parent()
829 .map(|parent| parent.to_string_lossy().into_owned())
830 .unwrap_or_default()
831 })
832 .reduce(|shared, next| common_dir(&shared, &next))
833 .filter(|parent| !parent.is_empty() && !parent.starts_with('/'))
834}
835
836fn common_dir(a: &str, b: &str) -> String {
838 a.split('/')
839 .zip(b.split('/'))
840 .take_while(|(left, right)| left == right)
841 .map(|(part, _)| part)
842 .collect::<Vec<_>>()
843 .join("/")
844}
845
846#[cfg(test)]
847mod tests {
848 use super::*;
849 use serde_json::json;
850
851 #[test]
852 fn unknown_fields_make_a_rule_unparseable() {
853 let mut value = json!({
854 "id": "r", "scope": { "kind": "user", "appName": "a", "userId": "u", "subjectKind": "human" },
855 "tool": "bash", "origin": { "kind": "exact", "source": "static", "declarationDigest": "sha256:x" },
856 "predicates": [], "decision": { "kind": "allow" },
857 "createdBy": { "kind": "human", "id": "u" }, "createdAt": "2026-10-20T00:00:00Z", "label": "l"
858 });
859 assert!(serde_json::from_value::<StandingRule>(value.clone()).is_ok());
860 value["everything"] = json!(true);
861 assert!(serde_json::from_value::<StandingRule>(value.clone()).is_err());
862 value.as_object_mut().unwrap().remove("everything");
863 value["scope"]["extra"] = json!(1);
864 assert!(serde_json::from_value::<StandingRule>(value.clone()).is_err());
865 value["scope"].as_object_mut().unwrap().remove("extra");
866 value["decision"] = json!({ "kind": "allow", "always": true });
867 assert!(serde_json::from_value::<StandingRule>(value.clone()).is_err());
868 value["decision"] = json!({ "kind": "allow" });
869 value["predicates"] =
870 json!([{ "shellPrefix": { "pointer": "/command", "tokens": [], "x": 1 } }]);
871 assert!(serde_json::from_value::<StandingRule>(value).is_err());
872 }
873
874 #[test]
875 fn edit_suggestions_are_session_scoped_and_skip_protected_paths() {
876 let origin = ToolOrigin::new("static", &json!({ "name": "write_file" }), None);
877 let request = ToolConfirmationRequest::new("write_file", json!({ "path": "src/lib.rs" }))
878 .with_origin(origin.clone());
879 let suggestions = StandingRule::suggestions(&request);
880 assert_eq!(suggestions.len(), 2);
881 assert!(suggestions.iter().all(|s| s.scope == SuggestedScope::Session));
882 let protected = ToolConfirmationRequest::new("write_file", json!({ "path": "AGENTS.md" }))
883 .with_origin(origin);
884 assert!(StandingRule::suggestions(&protected).is_empty());
885 }
886
887 fn writer(name: &str) -> Option<ToolOrigin> {
889 EDIT_TOOLS
890 .contains(&name)
891 .then(|| ToolOrigin::new("static", &json!({ "name": name }), None))
892 }
893
894 #[test]
895 fn the_folder_rule_pins_every_file_writing_tool_and_names_the_folder() {
896 let request = ToolConfirmationRequest::new("write_file", json!({ "path": "notes/a.md" }))
897 .with_origin(writer("write_file").unwrap());
898 let folder = StandingRule::folder_suggestion(&request, writer).unwrap();
899 let declarations: BTreeMap<String, String> = EDIT_TOOLS
900 .iter()
901 .map(|tool| (tool.to_string(), writer(tool).unwrap().declaration_digest))
902 .collect();
903 assert_eq!(
904 folder,
905 RuleSuggestion {
906 label: "file writes: within notes/".into(),
907 scope: SuggestedScope::Session,
908 tool: "*".into(),
909 origin: OriginPin::ExactEach { source: "static".into(), declarations },
910 predicates: vec![RulePredicate::WritesWithin { dir: "notes".into() }],
911 runs_scripts: false,
912 }
913 );
914 for tool in EDIT_TOOLS {
916 assert!(folder.origin.admits(&writer(tool).unwrap()), "{tool}");
917 }
918 let changed = ToolOrigin::new("static", &json!({ "name": "edit_file", "v": 2 }), None);
919 assert!(!folder.origin.admits(&changed));
920 let other = ToolOrigin::new("static", &json!({ "name": "read_file" }), None);
921 assert!(!folder.origin.admits(&other));
922 let mcp = ToolOrigin { source: "mcp:fs".into(), ..writer("write_file").unwrap() };
923 assert!(!folder.origin.admits(&mcp));
924
925 let root = ToolConfirmationRequest::new("edit_file", json!({ "path": "a.md" }))
927 .with_origin(writer("edit_file").unwrap());
928 let workspace = StandingRule::folder_suggestion(&root, writer).unwrap();
929 assert_eq!(workspace.label, "file writes: anywhere in the workspace");
930 assert_eq!(workspace.predicates, [RulePredicate::WritesWithin { dir: ".".into() }]);
931 }
932
933 #[test]
934 fn no_folder_rule_for_a_delete_a_move_an_escape_or_another_declaration() {
935 let patch = |text: &str| {
936 ToolConfirmationRequest::new("apply_patch", json!({ "patch": text }))
937 .with_origin(writer("apply_patch").unwrap())
938 };
939 let add = patch("*** Begin Patch\n*** Add File: notes/a.md\n+x\n*** End Patch");
940 assert!(StandingRule::folder_suggestion(&add, writer).is_some());
941 for refused in [
942 patch("*** Begin Patch\n*** Delete File: notes/a.md\n*** End Patch"),
943 patch(
944 "*** Begin Patch\n*** Update File: notes/a.md\n*** Move to: notes/b.md\n@@\n-x\n+y\n*** End Patch",
945 ),
946 ToolConfirmationRequest::new("write_file", json!({ "path": "notes/../a.md" }))
947 .with_origin(writer("write_file").unwrap()),
948 ToolConfirmationRequest::new("write_file", json!({ "path": "notes/AGENTS.md" }))
949 .with_origin(writer("write_file").unwrap()),
950 ToolConfirmationRequest::new("write_file", json!({ "path": "notes/a.md" }))
951 .with_origin(ToolOrigin::new(
952 "static",
953 &json!({ "name": "write_file", "v": 2 }),
954 None,
955 )),
956 ToolConfirmationRequest::new("write_file", json!({ "path": "notes/a.md" })),
957 ToolConfirmationRequest::new("bash", json!({ "command": "touch notes/a.md" }))
958 .with_origin(ToolOrigin::new("static", &json!({ "name": "bash" }), None)),
959 ] {
960 assert_eq!(StandingRule::folder_suggestion(&refused, writer), None, "{refused:?}");
961 }
962 }
963
964 #[test]
965 fn non_waivable_tools_get_no_suggestions() {
966 let origin = ToolOrigin::new("static", &json!({ "name": "exit_plan_mode" }), None);
967 let request = ToolConfirmationRequest::new("exit_plan_mode", json!({ "plan": "x" }))
968 .with_origin(origin);
969 assert!(StandingRule::suggestions(&request).is_empty());
970 let bash = ToolOrigin::new("static", &json!({ "name": "bash" }), None);
971 let retry = ToolConfirmationRequest::new(
972 "bash",
973 json!({ "command": "cargo test", "unsandboxed": true }),
974 )
975 .with_origin(bash);
976 assert!(StandingRule::suggestions(&retry).is_empty());
977 }
978
979 #[test]
980 fn script_runners_are_flagged() {
981 let origin = ToolOrigin::new("static", &json!({ "name": "bash" }), None);
982 for (command, scripts) in [("cargo test", true), ("ls -la", false), ("make", true)] {
983 let request = ToolConfirmationRequest::new("bash", json!({ "command": command }))
984 .with_origin(origin.clone());
985 assert!(StandingRule::suggestions(&request).iter().all(|s| s.runs_scripts == scripts));
986 }
987 }
988}