feat: async SunbeamClient factory with unified auth resolution

SunbeamClient accessors are now async and resolve auth per-client:
- SSO bearer (get_token) for admin APIs, Matrix, La Suite, OpenSearch
- Gitea PAT (get_gitea_token) for VCS
- None for Prometheus, Loki, S3, LiveKit

Fixes client URLs to match deployed routes: hydra→hydra.{domain},
matrix→messages.{domain}, grafana→metrics.{domain},
prometheus→systemmetrics.{domain}, loki→systemlogs.{domain}.

Removes all ad-hoc token helpers from CLI modules (matrix_with_token,
os_client, people_client, etc). Every dispatch just calls
client.service().await?.
This commit is contained in:
2026-03-22 18:57:22 +00:00
parent 34647e6bcb
commit faf525522c
17 changed files with 224 additions and 237 deletions

View File

@@ -927,12 +927,14 @@ pub async fn dispatch() -> Result<()> {
let sc = sunbeam_sdk::client::SunbeamClient::from_context(
&sunbeam_sdk::config::active_context(),
);
sunbeam_sdk::gitea::cli::dispatch(action, sc.gitea(), cli.output_format).await
sunbeam_sdk::gitea::cli::dispatch(action, &sc, cli.output_format).await
}
Some(Verb::Chat { action }) => {
let domain = sunbeam_sdk::config::active_context().domain.clone();
sunbeam_sdk::matrix::cli::dispatch(&domain, cli.output_format, action).await
let sc = sunbeam_sdk::client::SunbeamClient::from_context(
&sunbeam_sdk::config::active_context(),
);
sunbeam_sdk::matrix::cli::dispatch(&sc, cli.output_format, action).await
}
Some(Verb::Search { action }) => {
@@ -964,8 +966,10 @@ pub async fn dispatch() -> Result<()> {
}
Some(Verb::Vault { action }) => {
let bao = sunbeam_sdk::openbao::BaoClient::new("http://127.0.0.1:8200");
sunbeam_sdk::openbao::cli::dispatch(action, &bao, cli.output_format).await
let sc = sunbeam_sdk::client::SunbeamClient::from_context(
&sunbeam_sdk::config::active_context(),
);
sunbeam_sdk::openbao::cli::dispatch(action, &sc, cli.output_format).await
}
Some(Verb::People { action }) => {