style: format runtime helpers

This commit is contained in:
Eyejoker
2026-03-23 06:17:41 +09:00
parent d4b19ab950
commit c733217074
2 changed files with 20 additions and 13 deletions

View File

@@ -5,7 +5,11 @@ import {
} from './db.js'; } from './db.js';
import { filterProcessableMessages } from './bot-message-filter.js'; import { filterProcessableMessages } from './bot-message-filter.js';
import { isTriggerAllowed, loadSenderAllowlist } from './sender-allowlist.js'; import { isTriggerAllowed, loadSenderAllowlist } from './sender-allowlist.js';
import { type Channel, type NewMessage, type RegisteredGroup } from './types.js'; import {
type Channel,
type NewMessage,
type RegisteredGroup,
} from './types.js';
const BOT_COLLABORATION_WINDOW_MS = 12 * 60 * 60 * 1000; const BOT_COLLABORATION_WINDOW_MS = 12 * 60 * 60 * 1000;
@@ -77,10 +81,18 @@ export function hasAllowedTrigger(opts: {
messages: NewMessage[]; messages: NewMessage[];
group: RegisteredGroup; group: RegisteredGroup;
triggerPattern: RegExp; triggerPattern: RegExp;
hasImplicitContinuationWindow: (chatJid: string, messages: NewMessage[]) => boolean; hasImplicitContinuationWindow: (
chatJid: string,
messages: NewMessage[],
) => boolean;
}): boolean { }): boolean {
const { chatJid, messages, group, triggerPattern, hasImplicitContinuationWindow } = const {
opts; chatJid,
messages,
group,
triggerPattern,
hasImplicitContinuationWindow,
} = opts;
if (group.isMain === true || group.requiresTrigger === false) { if (group.isMain === true || group.requiresTrigger === false) {
return true; return true;

View File

@@ -700,17 +700,12 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
await turnController.start(); await turnController.start();
const output = await runAgent( const output = await runAgent(group, prompt, chatJid, runId, (result) =>
group, turnController.handleOutput(result),
prompt,
chatJid,
runId,
(result) => turnController.handleOutput(result),
); );
const { deliverySucceeded, visiblePhase } = await turnController.finish( const { deliverySucceeded, visiblePhase } =
output, await turnController.finish(output);
);
if (!deliverySucceeded) { if (!deliverySucceeded) {
logger.warn( logger.warn(