vtcode_desktop_protocol/webmcp.rs
1//! WebMCP bridge status and pairing DTOs.
2
3use serde::{Deserialize, Serialize};
4
5/// WebMCP bridge state exposed to the desktop client without pairing secrets.
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct WebmcpBridgeStatus {
9 /// Whether the listener is running in this desktop service process.
10 pub running: bool,
11 /// Loopback WebSocket endpoint when the listener is running.
12 pub endpoint: Option<String>,
13 /// Exact origins allowed to pair. Empty means the next explicit pair request binds one origin.
14 pub allowed_origins: Vec<String>,
15 /// Selected durable session, if any.
16 pub session_id: Option<String>,
17 /// Whether an active desktop runtime can accept a browser turn now.
18 pub turns_available: bool,
19 /// Canonical workspace used by the bridge.
20 pub workspace: String,
21}
22
23/// Request to issue a one-time WebMCP pairing code for one exact browser origin.
24#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
25#[serde(rename_all = "camelCase")]
26pub struct WebmcpPairParams {
27 /// Exact browser origin, including scheme and optional port, without a path.
28 pub origin: String,
29 /// Revoke existing browser sessions before issuing the replacement code.
30 #[serde(default)]
31 pub replace: bool,
32}
33
34/// One-time pairing material. The code is returned only by the pair operation and is never persisted.
35#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
36#[serde(rename_all = "camelCase")]
37pub struct WebmcpPairResult {
38 /// Loopback WebSocket endpoint for the paired browser.
39 pub endpoint: String,
40 /// Exact origin bound to the pairing code.
41 pub origin: String,
42 /// Short-lived, single-use pairing code.
43 pub pairing_code: String,
44 /// Remaining lifetime of the pairing code.
45 pub expires_in_secs: u64,
46}