feat(csm): bootstrap discussion callback flow
This commit is contained in:
@@ -25,6 +25,10 @@ type BeforeMessageWriteDeps = {
|
||||
content: string,
|
||||
logger: { info: (m: string) => void; warn: (m: string) => void },
|
||||
) => Promise<void>;
|
||||
discussionService?: {
|
||||
maybeSendIdleReminder: (channelId: string) => Promise<void>;
|
||||
getDiscussion: (channelId: string) => { status: string } | undefined;
|
||||
};
|
||||
};
|
||||
|
||||
export function registerBeforeMessageWriteHook(deps: BeforeMessageWriteDeps): void {
|
||||
@@ -41,6 +45,7 @@ export function registerBeforeMessageWriteHook(deps: BeforeMessageWriteDeps): vo
|
||||
ensureTurnOrder,
|
||||
resolveDiscordUserId,
|
||||
sendModeratorMessage,
|
||||
discussionService,
|
||||
} = deps;
|
||||
|
||||
api.on("before_message_write", (event, ctx) => {
|
||||
@@ -164,6 +169,11 @@ export function registerBeforeMessageWriteHook(deps: BeforeMessageWriteDeps): vo
|
||||
);
|
||||
|
||||
if (!nextSpeaker) {
|
||||
if (discussionService?.getDiscussion(channelId)?.status === "active") {
|
||||
void discussionService.maybeSendIdleReminder(channelId).catch((err) => {
|
||||
api.logger.warn(`dirigent: idle reminder failed: ${String(err)}`);
|
||||
});
|
||||
}
|
||||
if (shouldDebugLog(live, channelId)) {
|
||||
api.logger.info(`dirigent: before_message_write all agents no-reply, going dormant - no handoff`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user