Skip to main content

vtcode_desktop_protocol/
storage.rs

1//! Storage accounting and cleanup DTOs for the desktop Storage settings.
2
3use serde::{Deserialize, Serialize};
4
5/// On-disk usage broken down by owning store.
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct StorageSummary {
9    /// State directory holding session archives and sibling stores.
10    pub state_dir: String,
11    /// Workspace whose `.vtcode` stores were measured.
12    pub workspace: String,
13    /// Bytes used by session archives.
14    pub sessions_bytes: u64,
15    /// Number of session archives counted.
16    pub sessions_count: u64,
17    /// Bytes used by managed loop-isolation worktrees.
18    pub worktrees_bytes: u64,
19    /// Number of managed worktrees counted.
20    pub worktrees_count: u64,
21    /// Bytes used by per-workspace `.vtcode/sessions` memory stores.
22    pub memory_bytes: u64,
23    /// Bytes used by the rest of the state directory.
24    pub other_bytes: u64,
25    /// Sum of every category above.
26    pub total_bytes: u64,
27}
28
29/// One managed worktree available for review or removal.
30#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
31#[serde(rename_all = "camelCase")]
32pub struct WorktreeEntry {
33    /// Directory name under `.vtcode/worktrees/`.
34    pub name: String,
35    /// HEAD commit hash when known.
36    pub head: Option<String>,
37    /// Whether the worktree has uncommitted changes.
38    pub is_dirty: bool,
39}
40
41/// Parameters for removing one managed worktree by name.
42#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "camelCase")]
44pub struct WorktreeRemoveParams {
45    /// Directory name under `.vtcode/worktrees/`.
46    pub name: String,
47}
48
49/// Outcome of deleting one session archive.
50#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
51#[serde(rename_all = "camelCase")]
52pub struct SessionDeleteResult {
53    /// Deleted archive identifier, echoed from the request.
54    pub session_id: String,
55    /// Whether an archive file was removed.
56    pub deleted: bool,
57}
58
59/// Outcome of removing one managed worktree.
60#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
61#[serde(rename_all = "camelCase")]
62pub struct WorktreeRemoveResult {
63    /// Removed worktree name, echoed from the request.
64    pub name: String,
65    /// Whether a worktree was removed.
66    pub removed: bool,
67}