Complete A6 and A7 tasks: Implement closed discussion channel protections and update tasklist
- Complete tasks A6.1, A6.2, A6.3: Turn manager discussion mode handling - Complete tasks A7.1, A7.2, A7.3, A7.5: Hook-level discussion channel protections - Add closed discussion channel check to message-sent hook to prevent handoffs - Update TASKLIST.md to mark completed tasks with [x]
This commit is contained in:
@@ -23,6 +23,9 @@ type MessageSentDeps = {
|
||||
content: string,
|
||||
logger: { info: (m: string) => void; warn: (m: string) => void },
|
||||
) => Promise<unknown>;
|
||||
discussionService?: {
|
||||
isClosedDiscussion: (channelId: string) => boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export function registerMessageSentHook(deps: MessageSentDeps): void {
|
||||
@@ -36,6 +39,7 @@ export function registerMessageSentHook(deps: MessageSentDeps): void {
|
||||
ensurePolicyStateLoaded,
|
||||
resolveDiscordUserId,
|
||||
sendModeratorMessage,
|
||||
discussionService,
|
||||
} = deps;
|
||||
|
||||
api.on("message_sent", async (event, ctx) => {
|
||||
@@ -97,6 +101,14 @@ export function registerMessageSentHook(deps: MessageSentDeps): void {
|
||||
}
|
||||
|
||||
if (wasNoReply || hasEndSymbol) {
|
||||
// Check if this is a closed discussion channel
|
||||
if (discussionService?.isClosedDiscussion(channelId)) {
|
||||
api.logger.info(
|
||||
`dirigent: message_sent skipping turn advance for closed discussion channel=${channelId} from=${accountId}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const nextSpeaker = onSpeakerDone(channelId, accountId, wasNoReply);
|
||||
const trigger = wasNoReply ? "no_reply_keyword" : "end_symbol";
|
||||
const noReplyKeyword = wasNoReply ? (/^NO$/i.test(trimmed) ? "NO" : "NO_REPLY") : "";
|
||||
|
||||
Reference in New Issue
Block a user