Fix agent history catch-up + avoid mobile background stream deltas (#18)

* Update files

* Fix agent history sync + mobile stream gating
This commit is contained in:
Mohamed Boudra
2026-02-06 13:18:15 +07:00
committed by GitHub
parent 4633a7e8fe
commit d724988542
8 changed files with 169 additions and 117 deletions
+18
View File
@@ -578,6 +578,24 @@ export class Session {
return;
}
// Reduce bandwidth/CPU on mobile: only forward high-frequency agent stream events
// while the app is visible and the user is focused on that agent.
//
// History catch-up is handled via explicit `initialize_agent_request` which emits a
// batched `agent_stream_snapshot`.
const activity = this.clientActivity;
if (activity?.deviceType === "mobile") {
if (!activity.appVisible) {
return;
}
if (!activity.focusedAgentId) {
return;
}
if (activity.focusedAgentId !== event.agentId) {
return;
}
}
const payload = {
agentId: event.agentId,
event: serializeAgentStreamEvent(event.event),