adk_surface/genui/capabilities_wire.rs
1//! What a home claims of the UI protocols agents draw in (spec 3.3 ยง6.1 `genui`), in
2//! adk-ui's claim vocabulary: each claim has a status and a scope, so a host never mistakes a
3//! typed wire format for an end-to-end feature. Wire types of every `web` build.
4
5use schemars::JsonSchema;
6use serde::{Deserialize, Serialize};
7
8/// What `GET /api/surface/genui/capabilities` answers: a table of claims per protocol, and
9/// the catalogs this home renders.
10#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
11#[serde(rename_all = "camelCase")]
12pub struct GenuiCapabilities {
13 /// A2UI, AG-UI and MCP Apps, in that order.
14 pub protocols: Vec<ProtocolClaims>,
15 /// The catalogs this home renders.
16 pub catalogs: Vec<CatalogView>,
17}
18
19/// One protocol's claims.
20#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
21#[serde(rename_all = "camelCase")]
22pub struct ProtocolClaims {
23 /// Its key: `a2ui`, `ag_ui`, `mcp_apps`.
24 pub id: String,
25 /// Its name: `A2UI`, `AG-UI`, `MCP Apps`.
26 pub name: String,
27 /// What this home claims, in order.
28 pub claims: Vec<Claim>,
29}
30
31/// One claim of a protocol.
32#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
33#[serde(rename_all = "camelCase")]
34pub struct Claim {
35 /// Its key, such as `version_0_9_1`.
36 pub id: String,
37 /// What it says: "Version 0.9.1", "No approval controls in drawn UI".
38 pub label: String,
39 /// How far the home supports it.
40 pub status: ClaimStatus,
41 /// Where it holds.
42 pub scope: ClaimScope,
43 /// A line on what it covers.
44 #[serde(default, skip_serializing_if = "Option::is_none")]
45 pub note: Option<String>,
46}
47
48/// How far a home supports a claim (adk-ui's vocabulary).
49#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
50#[serde(rename_all = "snake_case")]
51pub enum ClaimStatus {
52 /// End to end.
53 Supported,
54 /// In part; the note says which part.
55 Partial,
56 /// The host provides it.
57 HostOwned,
58 /// A release candidate of the protocol, not yet relied on.
59 Candidate,
60 /// Not yet.
61 Planned,
62 /// Kept for compatibility only.
63 Legacy,
64}
65
66/// Where a claim holds (adk-ui's vocabulary).
67#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
68#[serde(rename_all = "snake_case")]
69pub enum ClaimScope {
70 /// The agent runtime.
71 Runtime,
72 /// The renderer.
73 Client,
74 /// The wire between them.
75 Transport,
76 /// The page hosting the renderer.
77 Host,
78 /// A guarantee to the person.
79 Security,
80}
81
82/// A catalog this home renders.
83#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
84#[serde(rename_all = "camelCase")]
85pub struct CatalogView {
86 /// Its id.
87 pub id: String,
88 /// Its name and version: `forms 1.0`.
89 pub label: String,
90 /// The components it renders.
91 pub components: Vec<String>,
92 /// The upstream components it leaves out, because they could fake a decision or cover
93 /// the home.
94 pub left_out: Vec<String>,
95}