perf: refactor sse handleing

This commit is contained in:
d-kimsuon
2025-09-18 20:42:44 +09:00
parent a90ef520dd
commit eb5a8ddeeb
38 changed files with 727 additions and 597 deletions

31
src/types/sse.ts Normal file
View File

@@ -0,0 +1,31 @@
import type { AliveClaudeCodeTask } from "../server/service/claude-code/types";
export type SSEEventDeclaration = {
// biome-ignore lint/complexity/noBannedTypes: correct type
connect: {};
// biome-ignore lint/complexity/noBannedTypes: correct type
heartbeat: {};
sessionListChanged: {
projectId: string;
};
sessionChanged: {
projectId: string;
sessionId: string;
};
taskChanged: {
aliveTasks: AliveClaudeCodeTask[];
};
};
export type SSEEventMap = {
[K in keyof SSEEventDeclaration]: SSEEventDeclaration[K] & {
kind: K;
timestamp: string;
};
};
export type SSEEvent = SSEEventMap[keyof SSEEventDeclaration];