feat(turn-init): persist channel bot membership cache to local file

This commit is contained in:
2026-03-08 06:13:38 +00:00
parent 307235e207
commit 12b0f4c6cc
2 changed files with 47 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ type MessageReceivedDeps = {
debugCtxSummary: (ctx: Record<string, unknown>, event: Record<string, unknown>) => Record<string, unknown>;
ensureTurnOrder: (api: OpenClawPluginApi, channelId: string) => Promise<void> | void;
getModeratorUserId: (cfg: DirigentConfig) => string | undefined;
recordChannelAccount: (channelId: string, accountId: string) => boolean;
recordChannelAccount: (api: OpenClawPluginApi, channelId: string, accountId: string) => boolean;
extractMentionedUserIds: (content: string) => string[];
buildUserIdToAccountIdMap: (api: OpenClawPluginApi) => Map<string, string>;
};
@@ -63,7 +63,7 @@ export function registerMessageReceivedHook(deps: MessageReceivedDeps): void {
const senderAccountId = typeof c.accountId === "string" ? c.accountId : undefined;
if (senderAccountId && senderAccountId !== "default") {
const isNew = recordChannelAccount(preChannelId, senderAccountId);
const isNew = recordChannelAccount(api, preChannelId, senderAccountId);
if (isNew) {
await ensureTurnOrder(api, preChannelId);
api.logger.info(`dirigent: new account ${senderAccountId} seen in channel=${preChannelId}, turn order updated`);