export class ControlPlaneChatSessionEventsController {
    static emitSessionActivities(args) {
        if (args.activities.length === 0) {
            return;
        }
        args.eventBus.emit(ControlPlaneChatSessionEventsController.sessionAddressKey(args), {
            sessionId: args.sessionId,
            timestamp: new Date().toISOString(),
            activities: args.activities,
        });
    }
    static createSessionEventPublisher(args) {
        const publishActivities = (activities) => {
            ControlPlaneChatSessionEventsController.emitSessionActivities({
                eventBus: args.eventBus,
                workspaceId: args.workspaceId,
                sessionId: args.sessionId,
                activities,
            });
        };
        const publisher = {
            publishActivity(activity) {
                publishActivities([activity]);
            },
            publishActivities,
            publishApprovalUpdated() {
                args.eventBus.emit(ControlPlaneChatSessionEventsController.sessionAddressKey(args), {
                    type: 'session.approval.updated',
                    sessionId: args.sessionId,
                    timestamp: new Date().toISOString(),
                });
            },
            publishQueueUpdated(queuedPromptCount) {
                args.eventBus.emit(ControlPlaneChatSessionEventsController.sessionAddressKey(args), {
                    type: 'session.queue.updated',
                    sessionId: args.sessionId,
                    timestamp: new Date().toISOString(),
                    queuedPromptCount,
                });
            },
        };
        return publisher;
    }
    static sessionAddressKey(address) {
        return `${address.workspaceId}:${address.sessionId}`;
    }
}
//# sourceMappingURL=chat-session-events.js.map