style: format runtime helpers
This commit is contained in:
@@ -5,7 +5,11 @@ import {
|
||||
} from './db.js';
|
||||
import { filterProcessableMessages } from './bot-message-filter.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;
|
||||
|
||||
@@ -77,10 +81,18 @@ export function hasAllowedTrigger(opts: {
|
||||
messages: NewMessage[];
|
||||
group: RegisteredGroup;
|
||||
triggerPattern: RegExp;
|
||||
hasImplicitContinuationWindow: (chatJid: string, messages: NewMessage[]) => boolean;
|
||||
hasImplicitContinuationWindow: (
|
||||
chatJid: string,
|
||||
messages: NewMessage[],
|
||||
) => boolean;
|
||||
}): boolean {
|
||||
const { chatJid, messages, group, triggerPattern, hasImplicitContinuationWindow } =
|
||||
opts;
|
||||
const {
|
||||
chatJid,
|
||||
messages,
|
||||
group,
|
||||
triggerPattern,
|
||||
hasImplicitContinuationWindow,
|
||||
} = opts;
|
||||
|
||||
if (group.isMain === true || group.requiresTrigger === false) {
|
||||
return true;
|
||||
|
||||
@@ -700,17 +700,12 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
|
||||
|
||||
await turnController.start();
|
||||
|
||||
const output = await runAgent(
|
||||
group,
|
||||
prompt,
|
||||
chatJid,
|
||||
runId,
|
||||
(result) => turnController.handleOutput(result),
|
||||
const output = await runAgent(group, prompt, chatJid, runId, (result) =>
|
||||
turnController.handleOutput(result),
|
||||
);
|
||||
|
||||
const { deliverySucceeded, visiblePhase } = await turnController.finish(
|
||||
output,
|
||||
);
|
||||
const { deliverySucceeded, visiblePhase } =
|
||||
await turnController.finish(output);
|
||||
|
||||
if (!deliverySucceeded) {
|
||||
logger.warn(
|
||||
|
||||
Reference in New Issue
Block a user