Skip to main content

agent_sdk_core/domain/
privacy.rs

1//! Domain primitives for stable SDK vocabulary. Use these items for IDs, refs,
2//! policy, privacy, trust, and errors that cross crate or host boundaries. They are
3//! data-only and must not perform provider, filesystem, network, or UI side effects.
4//! This file contains the privacy portion of that contract.
5//!
6use serde::{Deserialize, Serialize};
7
8#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
9#[serde(rename_all = "snake_case")]
10/// Enumerates the finite privacy class cases.
11/// Serialized names are part of the SDK contract; update fixtures when variants change.
12pub enum PrivacyClass {
13    /// Use this variant when the contract needs to represent public; selecting it has no side effect by itself.
14    Public,
15    /// Use this variant when the contract needs to represent internal; selecting it has no side effect by itself.
16    Internal,
17    /// Use this variant when the contract needs to represent content refs only; selecting it has no side effect by itself.
18    ContentRefsOnly,
19    /// Use this variant when the contract needs to represent sensitive; selecting it has no side effect by itself.
20    Sensitive,
21    /// Use this variant when the contract needs to represent secret; selecting it has no side effect by itself.
22    Secret,
23}
24
25impl PrivacyClass {
26    /// Returns whether allows raw content by default applies for this contract.
27    /// This is data-only and does not perform I/O, call host ports, append journals, publish
28    /// events, or start processes.
29    pub fn allows_raw_content_by_default(self) -> bool {
30        matches!(self, Self::Public)
31    }
32}
33
34#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
35#[serde(rename_all = "snake_case")]
36/// Enumerates the finite retention class cases.
37/// Serialized names are part of the SDK contract; update fixtures when variants change.
38pub enum RetentionClass {
39    /// Use this variant when the contract needs to represent ephemeral; selecting it has no side effect by itself.
40    Ephemeral,
41    /// Use this variant when the contract needs to represent run scoped; selecting it has no side effect by itself.
42    RunScoped,
43    /// Use this variant when the contract needs to represent session scoped; selecting it has no side effect by itself.
44    SessionScoped,
45    /// Use this variant when the contract needs to represent durable; selecting it has no side effect by itself.
46    Durable,
47    /// Use this variant when the contract needs to represent persistent; selecting it has no side effect by itself.
48    Persistent,
49    /// Use this variant when the contract needs to represent host policy; selecting it has no side effect by itself.
50    HostPolicy,
51}
52
53#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
54#[serde(rename_all = "snake_case")]
55/// Enumerates the finite trust class cases.
56/// Serialized names are part of the SDK contract; update fixtures when variants change.
57pub enum TrustClass {
58    /// Use this variant when the contract needs to represent trusted; selecting it has no side effect by itself.
59    Trusted,
60    /// Use this variant when the contract needs to represent sdk generated; selecting it has no side effect by itself.
61    SdkGenerated,
62    /// Use this variant when the contract needs to represent host provided; selecting it has no side effect by itself.
63    HostProvided,
64    /// Use this variant when the contract needs to represent user provided; selecting it has no side effect by itself.
65    UserProvided,
66    /// Use this variant when the contract needs to represent external; selecting it has no side effect by itself.
67    External,
68    /// Use this variant when the contract needs to represent untrusted; selecting it has no side effect by itself.
69    Untrusted,
70}