Skip to content

Commit e44f8ad

Browse files
committed
fix: allow async handlers in forward to support deferred events
1 parent a492d77 commit e44f8ad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/node/services/agentSession.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,10 @@ export class AgentSession {
396396
}
397397

398398
private attachAiListeners(): void {
399-
const forward = (event: string, handler: (payload: WorkspaceChatMessage) => void) => {
399+
const forward = (
400+
event: string,
401+
handler: (payload: WorkspaceChatMessage) => void | Promise<void>
402+
) => {
400403
const wrapped = (...args: unknown[]) => {
401404
const [payload] = args;
402405
if (
@@ -407,7 +410,7 @@ export class AgentSession {
407410
) {
408411
return;
409412
}
410-
handler(payload as WorkspaceChatMessage);
413+
void handler(payload as WorkspaceChatMessage);
411414
};
412415
this.aiListeners.push({ event, handler: wrapped });
413416
this.aiService.on(event, wrapped as never);

0 commit comments

Comments
 (0)