Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ tokio-util = "0.7"
libc = "0.2"
gethostname = "1"
tokio-tungstenite = { version = "0.24", features = ["rustls-tls-webpki-roots"] }
# The Desktop surface: RFB client over the sandbox's noVNC websocket.
vnc-rs = "0.5"
futures = "0.3"
# JPEG decode for the browser screencast; the same crate gpui already builds.
image = { version = "0.25", default-features = false, features = ["jpeg"] }
Expand Down
34 changes: 34 additions & 0 deletions crates/keiki-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub enum ConversationAction {
Messages,
Steer,
Terminal,
Desktop,
Browser,
/// Ends an inter-agent (`agent:`) thread — not a contact block.
End,
Expand All @@ -92,6 +93,7 @@ impl ConversationAction {
Self::Messages => "messages",
Self::Steer => "steer",
Self::Terminal => "terminal",
Self::Desktop => "desktop",
Self::Browser => "browser",
Self::End => "end",
}
Expand All @@ -105,6 +107,15 @@ pub struct TerminalSize {
pub rows: u16,
}

/// A way into the sandbox's desktop: its noVNC websocket behind the
/// provider's preview proxy, plus the token that proxy wants
/// (`x-daytona-preview-token`). Short-lived; fetch one per connection.
#[derive(Debug, Clone, Deserialize)]
pub struct DesktopViewer {
pub url: String,
pub token: String,
}

/// A short-lived capability to watch and drive the browser the conversation's
/// agent handed off: `url` is the runner's screencast WebSocket, `token` the
/// first message's credential. The bearer secrets stay on the platform.
Expand Down Expand Up @@ -1068,6 +1079,29 @@ impl Client {
Ok(response.available)
}

/// A viewer for the conversation sandbox's desktop (Computer Use).
/// Offered exactly where [`Self::terminal_available`] is (same sandbox),
/// but that answer comes from the platform's records — `None` here is
/// the provider's word that the sandbox is gone.
pub async fn open_desktop(
&self,
access_token: &str,
locator: &ConversationLocator,
) -> Result<Option<DesktopViewer>, Error> {
let request = self
.http
.post(self.conversation_endpoint(locator, Some(ConversationAction::Desktop))?)
.bearer_auth(access_token);
match self.send_json(request).await {
Ok(viewer) => Ok(Some(viewer)),
Err(Error::Api {
status: StatusCode::NOT_FOUND,
..
}) => Ok(None),
Err(error) => Err(error),
}
}

/// Open a shell in the conversation's sandbox; returns the terminal id.
pub async fn open_terminal(
&self,
Expand Down
4 changes: 3 additions & 1 deletion crates/ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ gpui.workspace = true
gpui_platform.workspace = true
gpui_tokio.workspace = true
tokio.workspace = true
futures.workspace = true
tokio-tungstenite.workspace = true
url.workspace = true
vnc-rs.workspace = true
image.workspace = true
futures.workspace = true
reqwest.workspace = true
async-trait.workspace = true
serde.workspace = true
Expand Down
Loading
Loading