Skip to main content

vtcode_desktop_protocol/
review.rs

1//! Workspace review snapshots and MCP app-resource preview DTOs.
2
3use serde::{Deserialize, Serialize};
4
5/// Request one bounded MCP app-resource body for static preview.
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct McpAppReadParams {
9    /// `ui://` URI to read.
10    pub uri: String,
11    /// Opaque client identity used to reject superseded reads.
12    pub request_id: String,
13}
14
15/// One bounded MCP app-resource body.
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
17#[serde(rename_all = "camelCase")]
18pub struct McpAppReadResult {
19    /// URI that was read.
20    pub uri: String,
21    /// Echoed request identity.
22    pub request_id: String,
23    /// MIME type of the first text block, when the server provides one.
24    pub mime_type: Option<String>,
25    /// Bounded body bytes; empty when the resource has no text block.
26    pub body: String,
27    /// Total body bytes available across text blocks.
28    pub total_bytes: u64,
29    /// Whether the body was truncated to [`MAX_MCP_APP_BODY_BYTES`].
30    pub truncated: bool,
31}
32
33/// Request identity for one bounded read-only Git snapshot.
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
35#[serde(rename_all = "camelCase")]
36pub struct WorkspaceReviewParams {
37    /// Include bounded previews of non-ignored untracked regular text files.
38    #[serde(default)]
39    pub include_untracked: bool,
40    /// Opaque client identity used to reject superseded captures.
41    pub request_id: String,
42    /// Optional directory within the selected workspace; empty means the root.
43    #[serde(default)]
44    pub scope: Option<String>,
45}
46
47/// Current Git preview; separate from historical agent-attributed changes.
48#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
49#[serde(rename_all = "camelCase")]
50pub struct WorkspaceReviewResult {
51    /// Whether untracked previews were requested for this capture.
52    #[serde(default)]
53    pub include_untracked: bool,
54    /// Canonical workspace-relative directory captured by this snapshot.
55    #[serde(default)]
56    pub scope: String,
57    /// Echoed request identity.
58    pub request_id: String,
59    /// Canonical service workspace.
60    pub workspace: String,
61    /// Capture timestamp.
62    pub captured_at: String,
63    /// Redacted diff against HEAD or the empty tree before the first commit.
64    pub patch: Option<String>,
65    /// Whether the preview omits content.
66    pub truncated: bool,
67    /// Scope or availability explanation.
68    pub note: String,
69}
70
71/// Maximum MCP app-resource body returned by one `mcp/app/read` call.
72pub const MAX_MCP_APP_BODY_BYTES: usize = 64 * 1024;