fix: wake origin workflow after discussion callback
This commit is contained in:
@@ -51,9 +51,11 @@ export function buildDiscussionClosedMessage(): string {
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
const DISCUSSION_RESULT_READY_HEADER = "[Discussion Result Ready]";
|
||||
|
||||
export function buildDiscussionOriginCallbackMessage(summaryPath: string, discussionChannelId: string): string {
|
||||
return [
|
||||
"[Discussion Result Ready]",
|
||||
DISCUSSION_RESULT_READY_HEADER,
|
||||
"",
|
||||
"A temporary discussion has completed.",
|
||||
"",
|
||||
@@ -69,3 +71,7 @@ export function buildDiscussionOriginCallbackMessage(summaryPath: string, discus
|
||||
"Continue the original task using the summary file above.",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
export function isDiscussionOriginCallbackMessage(content: string): boolean {
|
||||
return content.includes(DISCUSSION_RESULT_READY_HEADER);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
||||
import { onNewMessage, setMentionOverride, getTurnDebugInfo } from "../turn-manager.js";
|
||||
import { extractDiscordChannelId } from "../channel-resolver.js";
|
||||
import { isDiscussionOriginCallbackMessage } from "../core/discussion-messages.js";
|
||||
import type { DirigentConfig } from "../rules.js";
|
||||
|
||||
type DebugConfig = {
|
||||
@@ -64,7 +65,10 @@ export function registerMessageReceivedHook(deps: MessageReceivedDeps): void {
|
||||
if (closedHandled) return;
|
||||
}
|
||||
|
||||
if (moderatorUserId && from === moderatorUserId) {
|
||||
const messageContent = ((e as Record<string, unknown>).content as string) || ((e as Record<string, unknown>).text as string) || "";
|
||||
const isModeratorOriginCallback = !!(moderatorUserId && from === moderatorUserId && isDiscussionOriginCallbackMessage(messageContent));
|
||||
|
||||
if (moderatorUserId && from === moderatorUserId && !isModeratorOriginCallback) {
|
||||
if (shouldDebugLog(livePre, preChannelId)) {
|
||||
api.logger.info(`dirigent: ignoring moderator message in channel=${preChannelId}`);
|
||||
}
|
||||
@@ -82,19 +86,15 @@ export function registerMessageReceivedHook(deps: MessageReceivedDeps): void {
|
||||
}
|
||||
|
||||
if (isHuman) {
|
||||
const messageContent = ((e as Record<string, unknown>).content as string) || ((e as Record<string, unknown>).text as string) || "";
|
||||
|
||||
// Handle multi-message mode markers
|
||||
const startMarker = livePre.multiMessageStartMarker || "↗️";
|
||||
const endMarker = livePre.multiMessageEndMarker || "↙️";
|
||||
|
||||
|
||||
if (messageContent.includes(startMarker)) {
|
||||
enterMultiMessageMode(preChannelId);
|
||||
api.logger.info(`dirigent: entered multi-message mode channel=${preChannelId}`);
|
||||
} else if (messageContent.includes(endMarker)) {
|
||||
exitMultiMessageMode(preChannelId);
|
||||
api.logger.info(`dirigent: exited multi-message mode channel=${preChannelId}`);
|
||||
// After exiting multi-message mode, activate the turn system
|
||||
onNewMessage(preChannelId, senderAccountId, isHuman);
|
||||
} else {
|
||||
const mentionedUserIds = extractMentionedUserIds(messageContent);
|
||||
@@ -124,7 +124,7 @@ export function registerMessageReceivedHook(deps: MessageReceivedDeps): void {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
onNewMessage(preChannelId, senderAccountId, isHuman);
|
||||
onNewMessage(preChannelId, senderAccountId, false);
|
||||
}
|
||||
|
||||
if (shouldDebugLog(livePre, preChannelId)) {
|
||||
|
||||
Reference in New Issue
Block a user