voelinctl, it-smoke: chat history, gateway features and the stream directory through the engine
`voelinctl gateway --engine` runs one engine session against a gateway, optionally with voice, and prints every history batch, gateway update and stream event as a line: --chat opens chats (with --db, stored history), --older pages back, --request sends any gateway request as JSON (admin config, permission rules, events, ...), --roundtrip posts, pins, reacts, starts a topic from the post, posts into it and reads it back, --stream-seconds streams synthetic frames (registering in the directory) and --watch-streamer watches a stream once found. it-smoke adds three steps with the gateway running: messages sent while a user is offline reach its stored history on the next connect (the admin sets relay.pinned_channels at runtime for it); the pin/react/topic round trip as a normal user with a permission rule the admin sets; and on TeamSpeak 6 a stream registered in the directory found and watched by a viewer that connects later. The gateway's port can be moved (TSGW_PORT_TS3/TS6), and default builds go to $CARGO_TARGET_DIR. A chat's first stored page is no longer marked complete while its gateway is still connecting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
6 files changed
+701
-13
No files matched your search
@@ -564,13 +564,19 @@ pub(crate) fn gateway_history(client: &GatewayClient, target: &ChatTarget) -> bo
|
||||
|
||||
/// A chat opened (or its session reconnected): the stored page, then what
|
||||
/// the gateway has that we do not.
|
||||
pub(crate) async fn open_chat(ctx: ChatCtx, target: ChatTarget, gateway: Option<GatewayClient>) {
|
||||
pub(crate) async fn open_chat(
|
||||
ctx: ChatCtx,
|
||||
target: ChatTarget,
|
||||
gateway: Option<GatewayClient>,
|
||||
gateway_pending: bool,
|
||||
) {
|
||||
let gateway = gateway.filter(|g| gateway_history(g, &target));
|
||||
let limit = ctx.page_limit();
|
||||
let query = PageQuery { limit: limit.map(|l| l as usize), ..Default::default() };
|
||||
match ctx.history.page(&ctx.server_uid, &target, query, ctx.memory()).await {
|
||||
Ok(local) => {
|
||||
let complete = gateway.is_none() && limit.is_none_or(|l| local.len() < l as usize);
|
||||
let short = limit.is_none_or(|l| local.len() < l as usize);
|
||||
let complete = short && gateway.is_none() && !gateway_pending;
|
||||
ctx.emit_batch(&target, local, HistorySource::Local, complete);
|
||||
}
|
||||
Err(e) => warn!("cannot read chat history: {e}"),
|
||||
|
||||
@@ -521,7 +521,10 @@ impl Session {
|
||||
/// Show a chat's stored messages, then sync it with the gateway.
|
||||
fn open_history(&self, target: &ChatTarget) {
|
||||
if let Some(ctx) = self.chat_ctx() {
|
||||
tokio::spawn(history::open_chat(ctx, target.clone(), self.gateway_client.clone()));
|
||||
// A gateway that is still connecting may have more.
|
||||
let pending = self.gateway.is_some() && self.gateway_client.is_none();
|
||||
let gateway = self.gateway_client.clone();
|
||||
tokio::spawn(history::open_chat(ctx, target.clone(), gateway, pending));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user