difftreelog
feat remote editor
in: trunk
2 files changed
crates/remowt-link-shared/Cargo.tomldiffbeforeafterboth--- a/crates/remowt-link-shared/Cargo.toml
+++ b/crates/remowt-link-shared/Cargo.toml
@@ -5,7 +5,13 @@
[dependencies]
bifrostlink.workspace = true
-serde = { version = "1.0.208", features = ["derive"] }
-serde_json = "1.0.125"
+bytes.workspace = true
+serde = { workspace = true, features = ["derive"] }
+serde_json.workspace = true
thiserror = "1.0.63"
-tokio = "1.39.3"
+tokio = { workspace = true, features = ["fs"] }
+remowt-fs.workspace = true
+remowt-systemd.workspace = true
+ui-prompt.workspace = true
+camino = { workspace = true, features = ["serde1"] }
+remowt-pty.workspace = true
crates/remowt-link-shared/src/editor.rsdiffbeforeafterboth1use std::future::Future;23use bifrostlink::declarative::endpoints;4use bifrostlink::{Config, Rpc};5use serde::{Deserialize, Serialize};67#[derive(Serialize, Deserialize, Debug, thiserror::Error)]8pub enum Error {9 #[error("editor failed: {0}")]10 Failed(String),11}1213pub trait EditorBackend: Send + Sync {14 fn open_editor(&self, socket_path: String) -> impl Future<Output = Result<(), Error>> + Send;15}1617pub struct EditorEndpoints<E>(pub E);1819#[endpoints(ns = 8)]20impl<E: EditorBackend + 'static> EditorEndpoints<E> {21 #[endpoints(id = 1)]22 async fn open_editor(&self, socket_path: String) -> Result<(), Error> {23 self.0.open_editor(socket_path).await24 }25}2627pub fn serve_editor<E, C>(rpc: &mut Rpc<C>, editor: E)28where29 E: EditorBackend + Send + Sync + 'static,30 C: Config,31{32 EditorEndpoints(editor).register_endpoints(rpc);33}