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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
//! # adk-kernel
//!
//! The Agent Kernel of ADK-Rust, the always-on form of the harness (spec 3.2,
//! `docs/design/spec-3.2-agent-kernel.md`): a resident supervisor with a process model,
//! wake semantics, an event bus and a control plane, composed from the durable-run
//! machinery `adk-core` and `adk-server` already hold.
//!
//! Three rules shape it (§1):
//!
//! - **Always resumable, not always running.** A process is a durable run; asleep is
//! `Waiting` with a recorded [`WakeSet`] and no lease, so a sleeping agent makes no model
//! call (K-I2).
//! - **Every wake is a governed run.** A wake produces a `NewRun` or wakes a parked run;
//! nothing calls a tool outside a run (K-I1), so policy, guardrails, confirmation, the
//! action ledger and audit apply as for an interactive turn.
//! - **The kernel owns state, surfaces attach.** CLI, web and phone are terminals on one
//! running system over the [`control`] plane (K-I17).
//!
//! `adk-kernel` hosts any `Arc<Runner>` and depends on no harness type (§6 D-1); the
//! `kernel` feature of `adk-harness` carries the glue (§10 HK1), and `adk-rust up` starts
//! it.
//!
//! | Item | Spec |
//! |---|---|
//! | [`Kernel`], [`KernelBuilder`], [`KernelConfig`], [`KernelHealth`], [`KernelState`] | §7.2 |
//! | [`Process`], [`ProcessMeta`], [`ProcessView`], [`GoalProgress`], [`ProcessKind`], [`Suspension`], [`ProcessTable`], [`ProcessSpec`], [`ProgressSource`] | §7.3 |
//! | [`inventory`]: [`KernelInventory`](inventory::KernelInventory), [`InventoryWarning`](inventory::InventoryWarning), [`Kernel::inventory`], `GET /api/kernel/inventory`; `KernelBuilder::signals` and `Kernel::signal_sink` (feature `charter`) | §7.1, §7.4 |
//! | [`stores::KernelStores`], [`stores::StoreUse`], [`stores::StoreOrigin`]: every stateful store on one backend, [`KernelBuilder::stores`], [`KernelBuilder::require_durable`], [`Kernel::store_uses`] | §7.1, §13 Q8 |
//! | [`ProcessStore`], [`ProcessFilter`], [`SpendScope`], [`InMemoryProcessStore`], `SqliteProcessStore`, `PostgresProcessStore`, `RedisProcessStore`, `MongoProcessStore`, `FirestoreProcessStore`, `Neo4jProcessStore` | §7.3, §13 Q8 |
//! | [`Wake`], [`WakeSet`], [`ExpiryAction`], [`WakeSource`], [`WakeEvent`], [`keys`], [`Trigger`], [`WakeOverlap`], [`WakeRouter`], [`WakeOutcome`], [`KernelWakeExecutor`], the wake source adapters | §7.4 |
//! | [`vision`]: [`VisionWakeSource`], [`VisualWake`], [`VisualFrame`], [`VisualRegion`], [`vision_payload`]; with feature `vision`, the source as an `adk-vision` `WatchSink` | spec 3.7 §7.10 |
//! | [`CronWatermarkStore`], [`SourceWatermark`], [`InMemoryCronWatermarkStore`], `SqliteCronWatermarkStore`, `PostgresCronWatermarkStore`, `RedisCronWatermarkStore`, `MongoCronWatermarkStore`, `FirestoreCronWatermarkStore`, `Neo4jCronWatermarkStore` | §7.4, §7.13, §13 Q8 |
//! | [`KernelEvent`], [`EventKind`], [`EventFilter`], [`EventRecord`], [`EventBus`], [`EventSubscriber`], [`EventSink`], [`AuditSink`], [`SpendDelta`]; `WebhookSink` (feature `webhooks`) | §7.6 |
//! | [`Agenda`], [`AgendaHandle`], [`ProposalOutcome`], [`AgendaItem`], [`AgendaState`], [`AgendaStateKind`], [`AgendaOrigin`], [`AgendaAnswer`], [`ObservationAudience`], [`PlanRef`], [`AgendaStore`], [`AgendaFilter`], [`InMemoryAgendaStore`], [`ProactivityPolicy`], [`ProactiveApproval`] | §7.5 |
//! | [`agents`]: [`AgentRecord`](agents::AgentRecord), [`AgentStore`](agents::AgentStore) on every backend, [`AgentFactory`](agents::AgentFactory), [`AgentCaller`](agents::AgentCaller), [`AgentPreview`](agents::AgentPreview) | spec 3.3 §5.7, §10 K7 |
//! | [`ConsolidationTick`], [`Consolidator`], [`admit_tick`], [`TickInputs`], [`TickAdmission`], [`TickMaterial`], [`TickRun`], [`TickOutcome`], [`TickProposal`], [`TickSpend`], [`CONSOLIDATION_TARGET`], [`CONSOLIDATION_LABEL`] | §7.5, §13 Q1, Q12 |
//! | [`ReviewReport`], [`StandingRuleSource`], [`RuleAge`], [`StaleRule`], [`AgedProcess`] | §7.4, §9.1 |
//! | [`QueueClass`], [`QuietHours`], [`Quotas`] | §7.9 |
//! | [`drivers`]: `DriverManifest`, [`EffectClass`](drivers::EffectClass), `DriverStore`, `DriverSupervisor`, `DriverPolicy` (feature `drivers`) | §7.7 |
//! | `proc` (feature `proc`): `Ledger`, `LedgerEntry`, `LedgerStore` on every backend, `LedgerSink`, `LedgerAuditTap`; `proc::baselines` (feature `proc-baselines`): `BaselinePass`, `BaselinePolicy`, `ObservationPhraser`, `Observation` | §7.10 |
//! | [`PartitionId`], [`PartitionMode`], [`Partition`], [`CrossPartition`], [`PartitionStore`], [`InMemoryPartitionStore`], `SqlitePartitionStore`, `PostgresPartitionStore`, `RedisPartitionStore`, `MongoPartitionStore`, `FirestorePartitionStore`, `Neo4jPartitionStore`; [`Partitions`] | §7.8 |
//! | [`Crossing`], [`CrossingResource`], [`CrossingAccess`], [`CrossingRun`], [`CrossingRecord`], [`CrossingOutcome`], [`CrossingFilter`], [`CrossingRoute`], [`PartitionPolicy`], [`CrossingTool`] | §7.8, §13 Q3, K-I15 |
//! | [`control`]: [`ControlPlaneConfig`](control::ControlPlaneConfig), [`router`](control::router), [`ControlPlane`](control::ControlPlane), [`ControlClient`](control::ControlClient), [`api`](control::api) | §7.11 |
//! | [`audit`] action names | §9.3 |
//! | [`subagents`]: background sub-agents as processes of kind [`ProcessKind::Subagent`], [`KernelBuilder::subagents`], [`Kernel::subagents`], [`SubagentHandle`], [`KernelEvent::Subagent`] | `adk_core::subagent` |
//! | `service` (feature `service`): `ServiceDefinition`, `install`, `uninstall`, `run_as_service` (Windows) | §7.12, §10 W3 |
//! | `conformance` (feature `conformance`) | §11 |
//! | `managed` (feature `managed`): `KernelDef`, `TenantKernel`, `KernelResolver`, `ManagedKernels` | §7.13, §10 M1 |
//! | [`pairing`]: `Pairing`, `DeviceScope`, `DeviceStore` on every backend, `DeviceTokenExtractor` | spec 3.3 §10 K2 |
//! | `channels` (feature `channels`): `ChannelSink`, `ChannelGateway`, `ChannelBindingStore` on every backend, `InMemoryChannel` | spec 3.3 §10 K1 |
//!
//! Agenda and proactivity (§7.5) and attention and resources (§7.9) are phase 2; drivers
//! (§7.7) and partitions (§7.8) phase 3; channel wakes phase 5. Each adds to these types
//! without changing them.
//!
//! # Features
//!
//! | Feature | Default | Pulls in |
//! |---|---|---|
//! | `sqlite` | on | `SqliteProcessStore`, on the pool of `harness.db` |
//! | `postgres`, `redis` | off | `PostgresProcessStore`, `RedisProcessStore`, opened from the URL of `adk-rust serve --store` |
//! | `mongodb`, `firestore`, `neo4j` | off | The process, agenda, driver, ledger, partition and cron watermark stores on MongoDB, Firestore or Neo4j (`MongoProcessStore`, `FirestoreProcessStore`, `Neo4jProcessStore` and the stores beside them), with the same backend of `adk-session`'s run, schedule and governance stores |
//! | `webhooks` | on | `webhook_wake_hook` over `adk-server`'s `WebhookIngress`; `WebhookSink`, the outbound webhook sink over `adk-core`'s signed delivery |
//! | `drivers` | on | [`drivers`]: manifests, the driver store, the supervisor over `adk-tool`'s MCP manager, the stdio launcher on `adk-sandbox` |
//! | `service` | on | The `service` module: `adk-rust up` as a launchd agent, a systemd user unit or a Windows service (`windows-service` on Windows) |
//! | `proc` | on | The content-free activity ledger (`proc`), its stores and `GET /api/kernel/proc/*`; the OTel GenAI histograms of the live aggregates |
//! | `proc-baselines` | off | The daily baseline pass and observations over `adk-eval`'s ledger statistics (implies `proc`; the only `adk-eval` edge) |
//! | `channels` | off | The chat channel contract (spec 3.3 §10 K1): the `channels` module, its binding store on every backend, and the adapter contract suite with `conformance` |
//! | `managed` | off | The managed form: `KernelDef` in a managed definition, one kernel per tenant (`adk-managed`) |
//! | `charter` | off | `charter` (spec 3.5 §7.10, §7.11): the charter store, the KPI tracker, autonomy records, signals and the site process kinds, on every backend of the process store |
//! | `vision` | off | The bridge from `adk-vision` (spec 3.7 §7.10): `VisionWakeSource` as a `WatchSink` and `VisualWake` from a `WatchEvent`; the source itself needs no feature |
//! | `conformance` | off | The `conformance` module |
//!
//! # Example
//!
//! ```rust,no_run
//! use std::sync::Arc;
//! use adk_core::InMemoryRunStore;
//! use adk_kernel::{Kernel, KernelConfig, ProcessFilter};
//!
//! # async fn example(runner: Arc<adk_runner::Runner>) -> adk_kernel::Result<()> {
//! let kernel = Kernel::builder()
//! .config(KernelConfig::default())
//! .run_store(Arc::new(InMemoryRunStore::new()))
//! .agent("adk-rust", runner)
//! .build()?;
//! kernel.start().await?;
//! for process in kernel.processes().ps(ProcessFilter::default()).await? {
//! println!("{} {:?} {}", process.meta.pid, process.run.state, process.meta.kind);
//! }
//! kernel.shutdown_on_signal().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Stability
//!
//! Beta — new in 3.0.0, and its process model, wake sources and control plane are still taking
//! shape in use. See [STABILITY.md](https://github.com/zavora-ai/adk-rust/blob/main/STABILITY.md).
pub use ;
pub use WebhookSink;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use FirestoreAgendaStore;
pub use FirestoreCronWatermarkStore;
pub use FirestorePartitionStore;
pub use FirestoreProcessStore;
pub use MongoAgendaStore;
pub use MongoCronWatermarkStore;
pub use MongoPartitionStore;
pub use MongoProcessStore;
pub use Neo4jAgendaStore;
pub use Neo4jCronWatermarkStore;
pub use Neo4jPartitionStore;
pub use Neo4jProcessStore;
pub use PostgresAgendaStore;
pub use PostgresCronWatermarkStore;
pub use PostgresPartitionStore;
pub use PostgresProcessStore;
pub use RedisAgendaStore;
pub use RedisCronWatermarkStore;
pub use RedisPartitionStore;
pub use RedisProcessStore;
pub use SqliteAgendaStore;
pub use SqliteCronWatermarkStore;
pub use SqlitePartitionStore;
pub use SqliteProcessStore;
pub use ;
pub use ;
pub use ;
pub use webhook_wake_hook;
pub use ;
pub use ;
/// A short, stable tag of `path`: sixteen hex digits of the SHA-256 of its absolute form,
/// lowercased on Windows, whose paths ignore case. It names a kernel home's pipe and service
/// (spec 3.2 §10 W2, §7.12), and the directory of a socket too long for its home (spec 3.3
/// G18), so a client and the kernel derive the same name from one home.
pub