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
// Load and validate pipeline — implemented in Phase 1
use crate::;
/// Load and validate an `agent-policy.yaml` from a string.
///
/// Parses YAML, validates against the bundled JSON Schema, and returns the
/// raw policy struct on success. The caller is responsible for normalization.
///
/// # Errors
///
/// Returns [`crate::Error::Yaml`] on YAML parse failure or [`crate::Error::Schema`] if the
/// document does not conform to the bundled JSON Schema.
///
/// # Panics
///
/// Panics if `RawPolicy` cannot be serialized to a JSON value, which is an
/// internal invariant that holds as long as all field types implement `Serialize`.
// RawPolicy derives Serialize; to_value is infallible for these types
/// Load and validate an `agent-policy.yaml` from a file path.
///
/// # Errors
///
/// Returns [`crate::Error::Io`] if the file cannot be read, [`crate::Error::Yaml`] on YAML
/// parse failure, or [`crate::Error::Schema`] if the document does not conform to
/// the bundled JSON Schema.