feat(daemon): expose watching over the RPC surface and the CLI

The watch subscription was reachable only from the library. It is most
useful against a daemon -- that is the session that stays connected long
enough to receive the server's status pushes -- so it needs the wire.

- proto: user.watch / user.unwatch / user.watched, with a Watched response
- SessionApi gains watch_user / unwatch_user / watched_users, so a local and
  a remote session are still interchangeable above the seam
- CLI: `watch add`, `watch remove`, `watch list`, documented in SKILL.md
  including the caveat that a one-shot run's watch ends with the run
- docs/openrpc.json regenerated from the wire types
This commit is contained in:
Michel de Graaf
2026-08-28 13:22:50 +00:00
parent b505718db9
commit a91d35b672
13 changed files with 322 additions and 11 deletions
+18
View File
@@ -140,6 +140,12 @@ pub trait SessionApi: Send + Sync {
fn request_user_info(&self, username: &str) -> Result<()>;
fn user_info(&self, username: &str) -> Option<UserInfo>;
/// Ask the server to keep pushing `username`'s status until unwatched.
fn watch_user(&self, username: &str) -> Result<()>;
fn unwatch_user(&self, username: &str) -> Result<()>;
/// Everyone this session is watching, sorted by name.
fn watched_users(&self) -> Vec<String>;
/// The conversation this session already knows about.
///
/// Empty locally, where the TUI's own snapshot on disk is the record. A
@@ -364,6 +370,18 @@ impl SessionApi for Client {
Self::user_info(self, username)
}
fn watch_user(&self, username: &str) -> Result<()> {
Self::watch_user(self, username)
}
fn unwatch_user(&self, username: &str) -> Result<()> {
Self::unwatch_user(self, username)
}
fn watched_users(&self) -> Vec<String> {
Self::watched_users(self)
}
fn shared_counts(&self) -> (u32, u32) {
Self::shared_counts(self)
}