feat: wire channel mode runtime config and docs

This commit is contained in:
zhi
2026-04-02 04:48:20 +00:00
parent 8073c33f2c
commit d44204fabf
9 changed files with 60 additions and 20 deletions

View File

@@ -1,7 +1,6 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { resolvePolicy, type DirigentConfig } from "../rules.js";
import { getTurnDebugInfo, onSpeakerDone, setWaitingForHuman } from "../turn-manager.js";
import { isMultiMessageMode } from "../core/channel-modes.js";
type DebugConfig = {
enableDebugLogs?: boolean;
@@ -20,6 +19,7 @@ type BeforeMessageWriteDeps = {
shouldDebugLog: (config: DirigentConfig & DebugConfig, channelId?: string) => boolean;
ensureTurnOrder: (api: OpenClawPluginApi, channelId: string) => Promise<void> | void;
resolveDiscordUserId: (api: OpenClawPluginApi, accountId: string) => string | undefined;
isMultiMessageMode: (channelId: string) => boolean;
sendModeratorMessage: (
botToken: string,
channelId: string,
@@ -45,6 +45,7 @@ export function registerBeforeMessageWriteHook(deps: BeforeMessageWriteDeps): vo
shouldDebugLog,
ensureTurnOrder,
resolveDiscordUserId,
isMultiMessageMode,
sendModeratorMessage,
discussionService,
} = deps;

View File

@@ -2,7 +2,6 @@ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { evaluateDecision, type Decision, type DirigentConfig } from "../rules.js";
import { checkTurn } from "../turn-manager.js";
import { deriveDecisionInputFromPrompt } from "../decision-input.js";
import { isMultiMessageMode } from "../core/channel-modes.js";
type DebugConfig = {
enableDebugLogs?: boolean;
@@ -30,6 +29,7 @@ type BeforeModelResolveDeps = {
pruneDecisionMap: () => void;
shouldDebugLog: (config: DirigentConfig & DebugConfig, channelId?: string) => boolean;
ensureTurnOrder: (api: OpenClawPluginApi, channelId: string) => Promise<void> | void;
isMultiMessageMode: (channelId: string) => boolean;
discussionService?: {
isClosedDiscussion: (channelId: string) => boolean;
};
@@ -51,6 +51,7 @@ export function registerBeforeModelResolveHook(deps: BeforeModelResolveDeps): vo
pruneDecisionMap,
shouldDebugLog,
ensureTurnOrder,
isMultiMessageMode,
discussionService,
} = deps;

View File

@@ -2,7 +2,6 @@ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { onNewMessage, setMentionOverride, getTurnDebugInfo } from "../turn-manager.js";
import { extractDiscordChannelId } from "../channel-resolver.js";
import type { DirigentConfig } from "../rules.js";
import { enterMultiMessageMode, exitMultiMessageMode, isMultiMessageMode } from "../core/channel-modes.js";
type DebugConfig = {
enableDebugLogs?: boolean;
@@ -19,6 +18,8 @@ type MessageReceivedDeps = {
recordChannelAccount: (api: OpenClawPluginApi, channelId: string, accountId: string) => boolean;
extractMentionedUserIds: (content: string) => string[];
buildUserIdToAccountIdMap: (api: OpenClawPluginApi) => Map<string, string>;
enterMultiMessageMode: (channelId: string) => void;
exitMultiMessageMode: (channelId: string) => void;
discussionService?: {
maybeReplyClosedChannel: (channelId: string, senderId?: string) => Promise<boolean>;
};
@@ -35,6 +36,8 @@ export function registerMessageReceivedHook(deps: MessageReceivedDeps): void {
recordChannelAccount,
extractMentionedUserIds,
buildUserIdToAccountIdMap,
enterMultiMessageMode,
exitMultiMessageMode,
discussionService,
} = deps;