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
//! # adk-surface
//!
//! Agent surfaces for ADK-Rust (spec 3.3): one engine under every window a person opens onto
//! their agents — the web home, the terminal, chat, the phone, the desktop tray, voice.
//! Nothing lives in a surface: a decision is made once, from anywhere, and every other window
//! shows who made it.
//!
//! ## The engine
//!
//! [`SurfaceEngine`] is always compiled. It reads a [`Source`] — an in-process kernel,
//! harness or runner ([`LocalSource`]), or a kernel's control plane ([`ControlSource`]) — and
//! gives every surface the same three things (spec 3.3 §6):
//!
//! | Part | What | Where |
//! |---|---|---|
//! | Feed | A session's events numbered by their position in the session store, as a snapshot then a live tail, resumable after the last `seq` seen | [`SurfaceEngine::feed`], [`SurfaceEngine::thread`] |
//! | Projection | Decision cards (§7.1), thread items, agent rows, the status line and the "While you were away" briefing, in the words of §8 | [`model`], [`words`] |
//! | Commands | Decide at the version seen, send, queue, stop all, resume all, change the mode — each with its caller's subject and [`Origin`], audited | [`SurfaceEngine::execute`], [`Command`] |
//!
//! What each surface may decide (§7.2) and the rules on every surface (§7.4) are enforced by
//! the engine in [`rules`], not left to renderers.
//!
//! The live camera surface (spec 3.7 §8.2) is [`camera`]: a camera source's facts, the hub that
//! drops every frame of a camera switched off or paused by Stop all, and the view model; its
//! routes are served with `web` once the engine is built with [`SurfaceEngineBuilder::cameras`],
//! and with `vision-camera` its cameras run on adk-vision's frame pipeline.
//!
//! ## Surfaces
//!
//! | Feature | Surface | Stability |
//! |---|---|---|
//! | `web` | The web home: its HTTP API under `/api/surface`, mounted with `ServerBuilder::add_api_routes`, with its OpenAPI document, and its page at `/ui/`, mounted with `ServerBuilder::add_root_routes` | Beta |
//! | `tui` | The terminal (spec 3.3 §5.2): full screen, inline and JSON lines on the engine, decisions answered by key, light and dark; the `adk-rust` binary's `tui` feature | Beta |
//! | `channels` | Chat: the Telegram adapter over the kernel's channel contract, `channels::TelegramAdapter` (spec 3.3 §5.3) | Beta |
//! | `whatsapp`, `slack`, `discord`, `matrix`, `teams` | Chat on WhatsApp, Slack, Discord, Matrix and Microsoft Teams over the same contract, `channels::WhatsAppAdapter`, `SlackAdapter`, `DiscordAdapter`, `MatrixAdapter`, `TeamsAdapter` (spec 3.5 §10 X12); each implies `channels` | Experimental |
//! | `mobile` | The phone: the web home installed on a phone, Web Push from the person's own kernel, pairing QR codes and "Confirm it's you", `mobile::router` (spec 3.3 §5.4); implies `web` | Beta |
//! | `voice` | Voice and video: spoken "allow once" and "deny" through the engine with a cancel window, the camera and the screen as input while their switches are on; with `web`, the voice view's socket (`voice::router`, `voice::socket_routes`) (spec 3.3 §5.6) | Beta |
//! | `voice-live` | `voice` with Gemini Live and the OpenAI Realtime API compiled in, for the live voice test and the `voice_home` example; a host passes its own provider models | Beta |
//! | `computer-use` | Screen plans on decision cards (spec 3.7 Q8): a previewed plan of desktop actions parks as one card, decided with one answer through the harness's computer-use pack (`Harness::decide_held_screen_plan`), with the plan's binding on every step | Experimental |
//! | `vision-camera` | The live camera surface on adk-vision's frame pipeline (spec 3.7 §7.13, §8.2): `camera::PipelineCameras` runs each camera through `StreamPipeline` and reports what it measured; the voice screen's camera through `SurfaceCameraSource` | Experimental |
//! | `website` | The website's views on the web home (spec 3.5 §8.2): the web editor, onboarding, the charter cards, the site view and the weekly review over `adk-website`'s desk, `web::website::router`; implies `web` | Experimental |
//! | `verb-ui` | Screen actions people and agents share (spec 3.3 §2 item 7, §6.1): snoozing something in Coming up from the home, the terminal, voice and an agent, always through the governed path, `verbs::VerbRegistry`; with `web`, `web::verbs::router` | Experimental |
//! | `workflow` | The workflow observer (spec 3.3 §12 developer track): a graph agent's runs, steps and forks, card hints for its governed nodes, `workflow::Workflows`; with `web`, the Runs tab's routes, `web::workflow::router` | Beta |
//! | `genui` | Agent-drawn UI (spec 3.3 §6.1, §7.4 rule 5): the A2UI v0.9.1 model, the `forms` 1.0 catalog, the validator that keeps approval controls and secrets out of drawings, the render tools agents draw with (`genui::DrawToolset`), drawings in the thread and a drawn form's Send, which asks the person first (`Command::SubmitDrawn`), and with `web` the capabilities route (`web::genui::router`) | Beta |
//! | `genui-apps` | Apps from MCP servers in a thread (spec 3.3 §6.1): framed sandboxed on their own origin, their tool calls held for the person, never able to approve anything, `genui::McpAppsHost`; implies `genui` and `web` | Beta |
//!
//! ## Example
//!
//! ```rust
//! use std::sync::Arc;
//! use adk_core::{InMemoryApprovalStore, StoreApprovalService};
//! use adk_session::InMemorySessionService;
//! use adk_surface::{Caller, LocalSource, Origin, SurfaceEngine, SurfaceKind};
//!
//! # #[tokio::main(flavor = "current_thread")]
//! # async fn main() -> adk_surface::Result<()> {
//! let source = LocalSource::builder("adk-rust")
//! .sessions(Arc::new(InMemorySessionService::new()))
//! .approvals(Arc::new(StoreApprovalService::new(Arc::new(InMemoryApprovalStore::new()))))
//! .build()?;
//! let engine = SurfaceEngine::builder(Arc::new(source)).build();
//!
//! let me = Caller::human("ana", SurfaceKind::Phone, Origin::Touch);
//! let status = engine.status(&me, None).await?;
//! assert_eq!(status.decisions, 0);
//! # Ok(())
//! # }
//! ```
//!
//! ## Stability
//!
//! Beta — new in 3.0.0; `verb-ui` and the WhatsApp, Slack, Discord, Matrix and Teams adapters are
//! Experimental. See [STABILITY.md](https://github.com/zavora-ai/adk-rust/blob/main/STABILITY.md).
pub use GrantedUse;
pub use ;
pub use ;
pub use ControlSource;
pub use SURFACE_AUDIT_ANSWER;
pub use SURFACE_AUDIT_IMAGE_CHANGE;
pub use SURFACE_AUDIT_VISION_EXAMPLE;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use CardDetail;
pub use ;
pub use ;
pub use ;
pub use RUN_LINES;
pub use ;
pub use ;
pub use ;