1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! A generic, content-aware **tool policy hook** consulted before a tool runs.
//!
//! This is a Fae-driven deviation from a faithful Flue port (see the README):
//! upstream Flue has no per-tool governance gate. The trait here names **no
//! Fae types** — it is a generic seam any consumer can implement. The default
//! agent run has no policy (allow-all), so existing fluers consumers are
//! unaffected.
//!
//! The [`crate::runner::run_agent`] loop consults the policy *before*
//! [`crate::tool::Tool::execute`]. A [`PolicyVerdict::Deny`] short-circuits the
//! call: the tool does not run, and a model-visible error result carrying the
//! reason is appended so the loop can continue (the model can recover, exactly
//! as with an unknown-tool or tool-error result).
use async_trait;
use Value;
use crateInvokeContext;
/// The decision a [`ToolPolicy`] returns for a single tool call.
/// A governance gate consulted **before** each tool call executes.
///
/// Generic by construction: it carries the tool name, the model-supplied input,
/// and the per-invocation [`InvokeContext`], and returns a [`PolicyVerdict`].
/// Fae's implementation composes its control-plane scope check,
/// `DamageControlPolicy`/`PathPolicy`, and the PII/egress membrane behind this
/// one trait — but none of that leaks into fluers.