Fix #162: real-time bulk action streaming progress (#187)

* initial

* refactor: centralize SSE plumbing for client and server

* docs: add centralized SSE usage standards to agents guide

* use sse to stream actions to the client

* ui: align bulk progress toast with default sonner style

* ui: remove hide action from bulk progress toast

* full width progress bar

* fix(stream): track client disconnect and writability

* fix(stream): stop bulk loop when SSE client disconnects

* fix(stream): avoid writing error/end to closed SSE response

* fix(stream): gate started/progress frames on writable SSE socket

* types(api): narrow SSE stream payload input contract

* refactor(ui): share clamp helper for bulk progress

* fix(stream): add heartbeat to bulk action SSE route

* feat(stream): include completed count in bulk completion event

* fix(client-sse): separate parse vs handler errors and cancel reader
This commit is contained in:
Shaheer Sarfaraz
2026-02-18 15:54:39 +00:00
committed by GitHub
parent 4f8664cb9c
commit 032626bd7d
17 changed files with 854 additions and 197 deletions
+37
View File
@@ -621,6 +621,43 @@ export interface BulkJobActionResponse {
results: BulkJobActionResult[];
}
export type BulkJobActionStreamEvent =
| {
type: "started";
action: BulkJobAction;
requested: number;
completed: number;
succeeded: number;
failed: number;
requestId: string;
}
| {
type: "progress";
action: BulkJobAction;
requested: number;
completed: number;
succeeded: number;
failed: number;
result: BulkJobActionResult;
requestId: string;
}
| {
type: "completed";
action: BulkJobAction;
requested: number;
completed: number;
succeeded: number;
failed: number;
results: BulkJobActionResult[];
requestId: string;
}
| {
type: "error";
code: string;
message: string;
requestId: string;
};
export const JOB_CHAT_MESSAGE_ROLES = [
"system",
"user",