Skip to main content

kaizen/core/
identity.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
2//! Optional cleartext identity fields for session/event payloads (redaction by default; allowlisted in config).
3
4use serde::{Deserialize, Serialize};
5
6/// Labels that may appear on outbound / canonical events when the corresponding
7/// `IdentityAllowlist` bit is set in `TelemetryQueryConfig` (or future policy).
8#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9pub struct ActorIdentity {
10    pub team: Option<String>,
11    pub workspace_label: Option<String>,
12    pub runner_label: Option<String>,
13    pub actor_kind: Option<String>,
14    pub actor_label: Option<String>,
15    pub agent: Option<String>,
16    pub model: Option<String>,
17    pub env: Option<String>,
18    pub job: Option<String>,
19    pub branch: Option<String>,
20}
21
22impl ActorIdentity {
23    /// All fields empty.
24    pub fn is_empty(&self) -> bool {
25        self.team.is_none()
26            && self.workspace_label.is_none()
27            && self.runner_label.is_none()
28            && self.actor_kind.is_none()
29            && self.actor_label.is_none()
30            && self.agent.is_none()
31            && self.model.is_none()
32            && self.env.is_none()
33            && self.job.is_none()
34            && self.branch.is_none()
35    }
36}