From 000e672ca8b26374e76e68ea07c464cf473f3689 Mon Sep 17 00:00:00 2001 From: ejclaw Date: Thu, 9 Apr 2026 13:55:59 +0900 Subject: [PATCH] style: apply prettier formatting --- src/db/paired-state.ts | 8 +-- src/message-agent-executor.test.ts | 7 +-- src/message-runtime-follow-up.ts | 32 ++++++------ src/message-runtime-rules.ts | 5 +- src/message-runtime.test.ts | 69 ++++++++++++-------------- src/paired-follow-up-scheduler.test.ts | 14 ++---- 6 files changed, 58 insertions(+), 77 deletions(-) diff --git a/src/db/paired-state.ts b/src/db/paired-state.ts index 5344b59..f26579f 100644 --- a/src/db/paired-state.ts +++ b/src/db/paired-state.ts @@ -619,13 +619,7 @@ export function refreshPairedTaskExecutionLeaseInDatabase( AND expires_at >= ? `, ) - .run( - now, - computeExecutionLeaseExpiry(now), - args.taskId, - args.runId, - now, - ); + .run(now, computeExecutionLeaseExpiry(now), args.taskId, args.runId, now); return result.changes > 0; } diff --git a/src/message-agent-executor.test.ts b/src/message-agent-executor.test.ts index d2d3e22..db10721 100644 --- a/src/message-agent-executor.test.ts +++ b/src/message-agent-executor.test.ts @@ -57,12 +57,7 @@ vi.mock('./db.js', () => { taskUpdatedAt: string; intentKind: string; }) => - [ - args.chatJid, - args.taskId, - args.taskUpdatedAt, - args.intentKind, - ].join(':'); + [args.chatJid, args.taskId, args.taskUpdatedAt, args.intentKind].join(':'); return { createServiceHandoff: vi.fn(), diff --git a/src/message-runtime-follow-up.ts b/src/message-runtime-follow-up.ts index 37f4c89..e774021 100644 --- a/src/message-runtime-follow-up.ts +++ b/src/message-runtime-follow-up.ts @@ -84,10 +84,10 @@ export function resolvePairedFollowUpDecision(args: { export function schedulePairedFollowUpIntent(args: { chatJid: string; runId: string; - task: Pick< - PairedTask, - 'id' | 'status' | 'round_trip_count' | 'updated_at' - > | null | undefined; + task: + | Pick + | null + | undefined; intentKind: ScheduledPairedFollowUpIntentKind; enqueue: () => void; fallbackLastTurnOutputRole?: PairedRoomRole | null; @@ -126,10 +126,10 @@ export function schedulePairedFollowUpIntent(args: { export function schedulePairedFollowUpWithMessageCheck(args: { chatJid: string; runId: string; - task: Pick< - PairedTask, - 'id' | 'status' | 'round_trip_count' | 'updated_at' - > | null | undefined; + task: + | Pick + | null + | undefined; intentKind: ScheduledPairedFollowUpIntentKind; enqueueMessageCheck: () => void; fallbackLastTurnOutputRole?: PairedRoomRole | null; @@ -149,10 +149,10 @@ export function schedulePairedFollowUpWithMessageCheck(args: { export function dispatchPairedFollowUpForEvent(args: { chatJid: string; runId: string; - task: Pick< - PairedTask, - 'id' | 'status' | 'round_trip_count' | 'updated_at' - > | null | undefined; + task: + | Pick + | null + | undefined; source: PairedFollowUpSource; completedRole?: PairedRoomRole; executionStatus?: 'succeeded' | 'failed'; @@ -212,10 +212,10 @@ export function dispatchPairedFollowUpForEvent(args: { export function enqueuePairedFollowUpAfterEvent(args: { chatJid: string; runId: string; - task: Pick< - PairedTask, - 'id' | 'status' | 'round_trip_count' | 'updated_at' - > | null | undefined; + task: + | Pick + | null + | undefined; source: PairedFollowUpSource; completedRole?: PairedRoomRole; executionStatus?: 'succeeded' | 'failed'; diff --git a/src/message-runtime-rules.ts b/src/message-runtime-rules.ts index 3be886b..a60ada6 100644 --- a/src/message-runtime-rules.ts +++ b/src/message-runtime-rules.ts @@ -82,7 +82,10 @@ export type NextTurnAction = | { kind: 'owner-follow-up' } | { kind: 'finalize-owner-turn' }; -export type ScheduledNextTurnActionKind = Exclude; +export type ScheduledNextTurnActionKind = Exclude< + NextTurnAction['kind'], + 'none' +>; export type FollowUpDispatch = | { kind: 'none' } diff --git a/src/message-runtime.test.ts b/src/message-runtime.test.ts index 0d13cee..5436745 100644 --- a/src/message-runtime.test.ts +++ b/src/message-runtime.test.ts @@ -73,12 +73,7 @@ vi.mock('./db.js', () => { taskUpdatedAt: string; intentKind: string; }) => - [ - args.chatJid, - args.taskId, - args.taskUpdatedAt, - args.intentKind, - ].join(':'); + [args.chatJid, args.taskId, args.taskUpdatedAt, args.intentKind].join(':'); return { claimServiceHandoff: vi.fn(() => true), @@ -2012,21 +2007,22 @@ If your first line is DONE_WITH_CONCERNS, the system will reopen review instead vi.mocked(db.getLatestOpenPairedTaskForChat).mockImplementation( () => pairedTask, ); - vi.mocked(db.getMessagesSince).mockImplementation((_chatJid, sinceCursor) => - sinceCursor && sinceCursor !== '0' - ? [] - : ([ - { - id: 'human-dedup-1', - chat_jid: chatJid, - sender: 'user@test', - sender_name: 'User', - content: '이 구현 진행해줘', - timestamp: '2026-03-30T00:00:00.000Z', - seq: 1, - is_bot_message: false, - }, - ] as any), + vi.mocked(db.getMessagesSince).mockImplementation( + (_chatJid, sinceCursor) => + sinceCursor && sinceCursor !== '0' + ? [] + : ([ + { + id: 'human-dedup-1', + chat_jid: chatJid, + sender: 'user@test', + sender_name: 'User', + content: '이 구현 진행해줘', + timestamp: '2026-03-30T00:00:00.000Z', + seq: 1, + is_bot_message: false, + }, + ] as any), ); vi.mocked(agentRunner.runAgentProcess).mockImplementation( async (_group, _input, _onProcess, onOutput) => { @@ -2513,21 +2509,22 @@ If your first line is DONE_WITH_CONCERNS, the system will reopen review instead vi.mocked(db.getLatestOpenPairedTaskForChat).mockImplementation( () => pairedTask, ); - vi.mocked(db.getMessagesSince).mockImplementation((_chatJid, sinceCursor) => - sinceCursor && sinceCursor !== '0' - ? [] - : ([ - { - id: 'human-dedup-across-runs-1', - chat_jid: chatJid, - sender: 'user@test', - sender_name: 'User', - content: '이 구현 진행해줘', - timestamp: '2026-03-30T00:00:00.000Z', - seq: 1, - is_bot_message: false, - }, - ] as any), + vi.mocked(db.getMessagesSince).mockImplementation( + (_chatJid, sinceCursor) => + sinceCursor && sinceCursor !== '0' + ? [] + : ([ + { + id: 'human-dedup-across-runs-1', + chat_jid: chatJid, + sender: 'user@test', + sender_name: 'User', + content: '이 구현 진행해줘', + timestamp: '2026-03-30T00:00:00.000Z', + seq: 1, + is_bot_message: false, + }, + ] as any), ); vi.mocked(agentRunner.runAgentProcess).mockImplementation( async (_group, _input, _onProcess, onOutput) => { diff --git a/src/paired-follow-up-scheduler.test.ts b/src/paired-follow-up-scheduler.test.ts index 7b87cd9..e762b51 100644 --- a/src/paired-follow-up-scheduler.test.ts +++ b/src/paired-follow-up-scheduler.test.ts @@ -195,9 +195,7 @@ describe('paired follow-up scheduler', () => { intentKind: 'reviewer-turn', }); - expect(first).toMatch( - /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/, - ); + expect(first).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/); expect(second).toBeNull(); expect(getPairedTaskById(task.id)?.updated_at).toBe(first); }); @@ -238,9 +236,7 @@ describe('paired follow-up scheduler', () => { task, intentKind: 'reviewer-turn', }); - expect(first).toMatch( - /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/, - ); + expect(first).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/); _initTestDatabaseFromFile(dbPath); const freshTask = getPairedTaskById(task.id); @@ -272,11 +268,7 @@ describe('paired follow-up scheduler', () => { WHERE task_id = ? `, ) - .run( - '2020-01-01T00:00:00.000Z', - '2020-01-01T00:00:00.000Z', - task.id, - ); + .run('2020-01-01T00:00:00.000Z', '2020-01-01T00:00:00.000Z', task.id); rawDatabase.close(); _initTestDatabaseFromFile(dbPath);