mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2025-12-26 01:34:21 +01:00
refactor sse
This commit is contained in:
@@ -444,6 +444,7 @@ export const routes = (app: HonoAppType) => {
|
||||
) => {
|
||||
stream.writeSSE("taskChanged", {
|
||||
aliveTasks: event.aliveTasks,
|
||||
changed: event.changed,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -451,6 +452,7 @@ export const routes = (app: HonoAppType) => {
|
||||
eventBus.on("sessionChanged", onSessionChanged);
|
||||
eventBus.on("taskChanged", onTaskChanged);
|
||||
const { connectionPromise } = adaptInternalEventToSSE(rawStream, {
|
||||
timeout: 5 /* min */ * 60 /* sec */ * 1000,
|
||||
cleanUp: () => {
|
||||
eventBus.off("sessionListChanged", onSessionListChanged);
|
||||
eventBus.off("sessionChanged", onSessionChanged);
|
||||
|
||||
@@ -368,8 +368,11 @@ export class ClaudeCodeTaskController {
|
||||
|
||||
Object.assign(target, task);
|
||||
|
||||
this.eventBus.emit("taskChanged", {
|
||||
aliveTasks: this.aliveTasks,
|
||||
});
|
||||
if (task.status === "paused" || task.status === "running") {
|
||||
this.eventBus.emit("taskChanged", {
|
||||
aliveTasks: this.aliveTasks,
|
||||
changed: task,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export type InternalEventDeclaration = {
|
||||
|
||||
taskChanged: {
|
||||
aliveTasks: AliveClaudeCodeTask[];
|
||||
changed: AliveClaudeCodeTask;
|
||||
};
|
||||
|
||||
permissionRequested: {
|
||||
|
||||
Reference in New Issue
Block a user