feat: implement multi-message mode and shuffle mode features

- Add multi-message mode with start/end/prompt markers
- Implement turn order shuffling with /turn-shuffling command
- Add channel mode state management
- Update hooks to handle multi-message mode behavior
- Update plugin config with new markers
- Update TASKLIST.md with completed tasks
This commit is contained in:
zhi
2026-04-02 04:36:36 +00:00
parent 684f8f9ee7
commit bfbe40b3c6
8 changed files with 251 additions and 98 deletions

View File

@@ -1,6 +1,7 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { advanceTurn, getTurnDebugInfo, resetTurn } from "../turn-manager.js";
import type { DirigentConfig } from "../rules.js";
import { setChannelShuffling, getChannelShuffling } from "../core/channel-modes.js";
type CommandDeps = {
api: OpenClawPluginApi;
@@ -30,6 +31,7 @@ export function registerDirigentCommand(deps: CommandDeps): void {
`/dirigent turn-status - Show turn-based speaking status\n` +
`/dirigent turn-advance - Manually advance turn\n` +
`/dirigent turn-reset - Reset turn order\n` +
`/dirigent turn-shuffling [on|off] - Enable/disable turn order shuffling\n` +
`/dirigent_policy get <discordChannelId>\n` +
`/dirigent_policy set <discordChannelId> <policy-json>\n` +
`/dirigent_policy delete <discordChannelId>`,
@@ -60,6 +62,25 @@ export function registerDirigentCommand(deps: CommandDeps): void {
return { text: JSON.stringify({ ok: true }) };
}
if (subCmd === "turn-shuffling") {
const channelId = cmdCtx.channelId;
if (!channelId) return { text: "Cannot get channel ID", isError: true };
const arg = parts[1]?.toLowerCase();
if (arg === "on") {
setChannelShuffling(channelId, true);
return { text: JSON.stringify({ ok: true, channelId, shuffling: true }) };
} else if (arg === "off") {
setChannelShuffling(channelId, false);
return { text: JSON.stringify({ ok: true, channelId, shuffling: false }) };
} else if (!arg) {
const isShuffling = getChannelShuffling(channelId);
return { text: JSON.stringify({ ok: true, channelId, shuffling: isShuffling }) };
} else {
return { text: "Invalid argument. Use: /dirigent turn-shuffling [on|off]", isError: true };
}
}
return { text: `Unknown subcommand: ${subCmd}`, isError: true };
},
});