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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//! Audit actions of the kernel (spec 3.2 §9.3).
//!
//! The kernel writes these through the signed audit log (spec 3.1 §9.3) as kind
//! `Other(`[`KERNEL_AUDIT_KIND`]`)`, with the actor taken from the control-plane subject or
//! the process's acting context.
//! `governance.freeze` and `governance.unfreeze` are written by
//! `GovernanceControl::freeze_recorded` and `unfreeze_recorded`; a freeze adds one
//! [`PROCESS_SUSPENDED`] record per process it parks, with `suspendedBy: freeze`.
//! `harness.goal.stalled` is the harness's own record (§10 HK3).
//!
//! | Action | Fields |
//! |---|---|
//! | [`KERNEL_STARTED`], [`KERNEL_PAUSED`], [`KERNEL_RESUMED`], [`KERNEL_DRAINED`], [`KERNEL_STOPPED`] | `kernelId`, `home`, `replicas`, `reason` |
//! | [`PROCESS_SPAWNED`], [`PROCESS_WOKEN`], [`PROCESS_SUSPENDED`], [`PROCESS_RESUMED`], [`PROCESS_KILLED`], [`PROCESS_REQUEUED`] | `pid`, `parent`, `partition`, `queue`, `kind`, `wake`, `reason`, `by` |
//! | [`WAKE`] | `source`, `key`, `matchedPid` or `newPid`, `deduplicated` |
//! | [`CONTROL`] | `subject`, `transport`, `action`, `target` |
//! | [`AGENDA_PROPOSED`], [`AGENDA_APPROVED`], [`AGENDA_REJECTED`], [`AGENDA_SCHEDULED`], [`AGENDA_EXPIRED`] | `item`, `partition`, `origin`, `by`, `budget`, `reason` |
//! | [`REVIEW`] | `partition`, `reviewPeriodMs`, `rules`, `sleepers`, `frozen` (ids and ages), `ask`, `crossings` (`from`, `to`, `resource`, `name`, `count`), `remedies` |
//! | [`DRIVER_MOUNTED`], [`DRIVER_UNMOUNTED`], [`DRIVER_STARTED`], [`DRIVER_CRASHED`], [`DRIVER_RESTARTED`], [`DRIVER_STALE`], [`DRIVER_REAPPROVED`] | `driverId`, `commandDigest`, `partitions`, `effectClasses`, `digests`, `attempt` |
//! | [`OBSERVATION`] | `id`, `partition`, `dimensions`, `windows` — no value that identifies content |
//! | [`CHANNEL`] | `surface`, `origin`, `channel`, `account`, `action`, `target` (spec 3.3 §11) |
//! | [`PARTITION_CREATED`], [`PARTITION_CHANGED`] | `partition`, `fields`, `from`, `to` |
//! | [`AGENT_PROPOSED`] | `id`, `digest`, `risk`, `area`, `suggestingAgent`, `session`, `run` (spec 3.3 §5.7) |
//! | [`AGENT_CREATED`] | `id`, `version`, `digest`, `risk`, `origin`, `approvalId`, `by`, `surface`, `how`, `device`, `presence`, `transport`, `peerPid` |
//! | [`AGENT_CHANGED`] | `id`, `fields`, `from`, `to`, `risk`, `by`, `surface`, `how`, `transport` |
//! | [`AGENT_PAUSED`], [`AGENT_RESUMED`] | `id`, `by`, `surface`, `transport` |
//! | [`AGENT_REMOVING`], [`AGENT_REMOVED`] | `id`, `by`, `surface`, `transport`, `ended` (`work`, `routines`, `decisions`, `followUps`, `rules`) |
//! | [`AGENT_REFUSED`] | `id` or `name`, `reason` |
//! | [`PARTITION_CROSSING`] | `partition`, `to`, `resource`, `name`, `access`, `outcome`, `run`, `tool`, `fingerprintDigest`, `reason`, `by` |
//!
//! # Example
//!
//! ```rust
//! assert_eq!(adk_kernel::audit::PROCESS_SUSPENDED, "kernel.process.suspended");
//! ```
/// The kind of every kernel audit record, as `AuditRecordKind::Other(KERNEL_AUDIT_KIND.into())`
/// (spec 3.2 §9.3).
pub const KERNEL_AUDIT_KIND: &str = "kernel";
/// The kernel started its workers, scheduler, wake sources and control plane.
pub const KERNEL_STARTED: &str = "kernel.started";
/// The kernel stopped claiming new work.
pub const KERNEL_PAUSED: &str = "kernel.paused";
/// The kernel resumed claiming after a pause.
pub const KERNEL_RESUMED: &str = "kernel.resumed";
/// The kernel suspended its running processes at their next checkpoint and stopped claiming.
pub const KERNEL_DRAINED: &str = "kernel.drained";
/// The kernel stopped and closed its control plane.
pub const KERNEL_STOPPED: &str = "kernel.stopped";
/// A process was created.
pub const PROCESS_SPAWNED: &str = "kernel.process.spawned";
/// A sleeping process was woken.
pub const PROCESS_WOKEN: &str = "kernel.process.woken";
/// A process was parked `Waiting`; `suspendedBy` says why.
pub const PROCESS_SUSPENDED: &str = "kernel.process.suspended";
/// A suspended process was resumed.
pub const PROCESS_RESUMED: &str = "kernel.process.resumed";
/// A process was killed.
pub const PROCESS_KILLED: &str = "kernel.process.killed";
/// A process moved to another queue.
pub const PROCESS_REQUEUED: &str = "kernel.process.requeued";
/// A wake event arrived and woke, spawned or deduplicated a process.
pub const WAKE: &str = "kernel.wake";
/// A control-plane action.
pub const CONTROL: &str = "kernel.control";
/// A cron sleeper or standing cron trigger was run now, outside its schedule.
pub const RUN_NOW: &str = "kernel.run_now";
/// An agenda item was proposed (spec 3.2 §7.5).
pub const AGENDA_PROPOSED: &str = "kernel.agenda.proposed";
/// An agenda item was approved, by a person or an Auto partition's policy.
pub const AGENDA_APPROVED: &str = "kernel.agenda.approved";
/// An agenda item, or a proposal the policy refused, was rejected.
pub const AGENDA_REJECTED: &str = "kernel.agenda.rejected";
/// An agenda item's process was created.
pub const AGENDA_SCHEDULED: &str = "kernel.agenda.scheduled";
/// An agenda item expired before it ran.
pub const AGENDA_EXPIRED: &str = "kernel.agenda.expired";
/// The daily review of standing rules, sleepers and freezes older than the review period,
/// and of recurring crossings (spec 3.2 §7.4, §7.8, §9.1).
pub const REVIEW: &str = "kernel.review";
/// A driver's manifest was approved and mounted (spec 3.2 §7.7).
pub const DRIVER_MOUNTED: &str = "kernel.driver.mounted";
/// A driver was unmounted.
pub const DRIVER_UNMOUNTED: &str = "kernel.driver.unmounted";
/// A driver's server started.
pub const DRIVER_STARTED: &str = "kernel.driver.started";
/// A driver's server crashed.
pub const DRIVER_CRASHED: &str = "kernel.driver.crashed";
/// A driver's server started again after a crash or a restart.
pub const DRIVER_RESTARTED: &str = "kernel.driver.restarted";
/// A driver's tool declares something other than what was approved (K-I14).
pub const DRIVER_STALE: &str = "kernel.driver.stale";
/// A driver's changed declarations were approved and pinned.
pub const DRIVER_REAPPROVED: &str = "kernel.driver.reapproved";
/// A baseline pass recorded an observation (spec 3.2 §7.10, feature `proc-baselines`).
pub const OBSERVATION: &str = "kernel.observation";
/// Something a chat thread did or was sent (spec 3.3 §10 K1, §11): a pairing request, a
/// message, a decision card, an answer, a stop or a refused resume, with `surface: chat`,
/// `origin`, `channel`, `account`, `action` and `target` (feature `channels`).
pub const CHANNEL: &str = "kernel.channel";
/// A partition was created (spec 3.2 §7.8).
pub const PARTITION_CREATED: &str = "kernel.partition.created";
/// A partition's record changed: its mode, memory scope, drivers, crossings or blocks.
pub const PARTITION_CHANGED: &str = "kernel.partition.changed";
/// A request reached, or tried to reach, another partition (K-I15).
pub const PARTITION_CROSSING: &str = "kernel.partition.crossing";
/// Another agent suggested an agent; it waits for a person (spec 3.3 §5.7, S-I18).
pub const AGENT_PROPOSED: &str = "kernel.agent.proposed";
/// A person added an agent, by hand or by approving a suggestion.
pub const AGENT_CREATED: &str = "kernel.agent.created";
/// A person changed an agent's definition.
pub const AGENT_CHANGED: &str = "kernel.agent.changed";
/// A person paused an agent.
pub const AGENT_PAUSED: &str = "kernel.agent.paused";
/// A person resumed an agent they paused.
pub const AGENT_RESUMED: &str = "kernel.agent.resumed";
/// A person started removing an agent; written before anything ends (S-I16).
pub const AGENT_REMOVING: &str = "kernel.agent.removing";
/// An agent's removal finished, with what ended.
pub const AGENT_REMOVED: &str = "kernel.agent.removed";
/// A suggestion or change was refused: over a ceiling, a reserved or taken name, an
/// approver who is not a person, a digest that changed.
pub const AGENT_REFUSED: &str = "kernel.agent.refused";