From a1324726b1861be39d10b770ca551b6a338f6701 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Mon, 23 Mar 2026 00:44:04 +0900 Subject: [PATCH] style: format after runtime unification Co-Authored-By: Claude Opus 4.6 --- src/index.ts | 4 +- src/message-runtime.test.ts | 136 ++++++++++++++++++------------------ src/message-runtime.ts | 2 +- 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/index.ts b/src/index.ts index 85be091..da8d0ae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,9 +22,7 @@ import { getChannelFactory, getRegisteredChannelNames, } from './channels/registry.js'; -import { - writeGroupsSnapshot, -} from './agent-runner.js'; +import { writeGroupsSnapshot } from './agent-runner.js'; import { getAllChats, getAllRegisteredGroups, diff --git a/src/message-runtime.test.ts b/src/message-runtime.test.ts index 49a3f9f..4ee99f5 100644 --- a/src/message-runtime.test.ts +++ b/src/message-runtime.test.ts @@ -31,76 +31,78 @@ vi.mock('./db.js', () => { const withSeqs = (messages: Array>) => messages.map((message, index) => ({ ...message, - seq: - typeof message.seq === 'number' - ? message.seq - : index + 1, + seq: typeof message.seq === 'number' ? message.seq : index + 1, })); return { - getAllChats: vi.fn(() => []), - getAllTasks: vi.fn(() => []), - getLastHumanMessageTimestamp: vi.fn(() => null), - getMessagesSince, - getNewMessages, - getLatestMessageSeqAtOrBefore: vi.fn(() => 0), - getMessagesSinceSeq: vi.fn( - ( - chatJid: string, - sinceSeqCursor: string, - botPrefix: string, - limit?: number, - ) => withSeqs(getMessagesSince(chatJid, sinceSeqCursor, botPrefix, limit)), - ), - getNewMessagesBySeq: vi.fn( - ( - jids: string[], - lastSeqCursor: string, - botPrefix: string, - limit?: number, - ) => { - const result: - | { - messages?: Array>; - newSeqCursor?: string; - newTimestamp?: string; - } - | undefined = - getNewMessages(jids, lastSeqCursor, botPrefix, limit) || { - messages: [], - newSeqCursor: '0', - }; - const messages = withSeqs(result.messages || []); - const lastSeq = - messages.length > 0 - ? String(messages[messages.length - 1].seq) - : String(lastSeqCursor || '0'); - return { - messages, - newSeqCursor: result.newSeqCursor || result.newTimestamp || lastSeq, - }; - }, - ), - getOpenWorkItem: vi.fn(() => undefined), - createProducedWorkItem: vi.fn((input) => ({ - id: 1, - group_folder: input.group_folder, - chat_jid: input.chat_jid, - agent_type: input.agent_type || 'claude-code', - status: 'produced', - start_seq: input.start_seq, - end_seq: input.end_seq, - result_payload: input.result_payload, - delivery_attempts: 0, - created_at: new Date().toISOString(), - updated_at: new Date().toISOString(), - delivered_at: null, - delivery_message_id: null, - last_error: null, - })), - markWorkItemDelivered: vi.fn(), - markWorkItemDeliveryRetry: vi.fn(), - isPairedRoomJid: vi.fn(() => false), + getAllChats: vi.fn(() => []), + getAllTasks: vi.fn(() => []), + getLastHumanMessageTimestamp: vi.fn(() => null), + getMessagesSince, + getNewMessages, + getLatestMessageSeqAtOrBefore: vi.fn(() => 0), + getMessagesSinceSeq: vi.fn( + ( + chatJid: string, + sinceSeqCursor: string, + botPrefix: string, + limit?: number, + ) => + withSeqs(getMessagesSince(chatJid, sinceSeqCursor, botPrefix, limit)), + ), + getNewMessagesBySeq: vi.fn( + ( + jids: string[], + lastSeqCursor: string, + botPrefix: string, + limit?: number, + ) => { + const result: + | { + messages?: Array>; + newSeqCursor?: string; + newTimestamp?: string; + } + | undefined = getNewMessages( + jids, + lastSeqCursor, + botPrefix, + limit, + ) || { + messages: [], + newSeqCursor: '0', + }; + const messages = withSeqs(result.messages || []); + const lastSeq = + messages.length > 0 + ? String(messages[messages.length - 1].seq) + : String(lastSeqCursor || '0'); + return { + messages, + newSeqCursor: result.newSeqCursor || result.newTimestamp || lastSeq, + }; + }, + ), + getOpenWorkItem: vi.fn(() => undefined), + createProducedWorkItem: vi.fn((input) => ({ + id: 1, + group_folder: input.group_folder, + chat_jid: input.chat_jid, + agent_type: input.agent_type || 'claude-code', + status: 'produced', + start_seq: input.start_seq, + end_seq: input.end_seq, + result_payload: input.result_payload, + delivery_attempts: 0, + created_at: new Date().toISOString(), + updated_at: new Date().toISOString(), + delivered_at: null, + delivery_message_id: null, + last_error: null, + })), + markWorkItemDelivered: vi.fn(), + markWorkItemDeliveryRetry: vi.fn(), + isPairedRoomJid: vi.fn(() => false), }; }); diff --git a/src/message-runtime.ts b/src/message-runtime.ts index cf23d56..825c7df 100644 --- a/src/message-runtime.ts +++ b/src/message-runtime.ts @@ -1096,7 +1096,7 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): { if (idleTimer) clearTimeout(idleTimer); clearPendingFollowUpDiagnostics(); - deps.queue.setActivityTouch?.(chatJid, null); + deps.queue.setActivityTouch?.(chatJid, null); if (hadError) { if (