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

@@ -0,0 +1,51 @@
export type ChannelMode = "normal" | "multi-message";
export type ChannelModesState = {
mode: ChannelMode;
shuffling: boolean;
lastShuffledAt?: number;
};
const channelStates = new Map<string, ChannelModesState>();
export function getChannelState(channelId: string): ChannelModesState {
if (!channelStates.has(channelId)) {
channelStates.set(channelId, {
mode: "normal",
shuffling: false,
});
}
return channelStates.get(channelId)!;
}
export function enterMultiMessageMode(channelId: string): void {
const state = getChannelState(channelId);
state.mode = "multi-message";
channelStates.set(channelId, state);
}
export function exitMultiMessageMode(channelId: string): void {
const state = getChannelState(channelId);
state.mode = "normal";
channelStates.set(channelId, state);
}
export function isMultiMessageMode(channelId: string): boolean {
return getChannelState(channelId).mode === "multi-message";
}
export function setChannelShuffling(channelId: string, enabled: boolean): void {
const state = getChannelState(channelId);
state.shuffling = enabled;
channelStates.set(channelId, state);
}
export function getChannelShuffling(channelId: string): boolean {
return getChannelState(channelId).shuffling;
}
export function markLastShuffled(channelId: string): void {
const state = getChannelState(channelId);
state.lastShuffledAt = Date.now();
channelStates.set(channelId, state);
}