fix(ralph-loop): settle idle before continuation

This commit is contained in:
YeonGyu-Kim
2026-05-10 12:46:00 +09:00
parent 1e4a51e21b
commit 806842981f
5 changed files with 78 additions and 43 deletions
+3
View File
@@ -22,6 +22,7 @@ export interface RalphLoopHook {
}
const DEFAULT_API_TIMEOUT = 5000 as const
const DEFAULT_IDLE_SETTLE_MS = 150 as const
function getMessageCountFromResponse(messagesResponse: unknown): number {
if (Array.isArray(messagesResponse)) {
@@ -44,6 +45,7 @@ export function createRalphLoopHook(
const stateDir = config?.state_dir
const getTranscriptPath = options?.getTranscriptPath ?? getDefaultTranscriptPath
const apiTimeout = options?.apiTimeout ?? DEFAULT_API_TIMEOUT
const idleSettleMs = options?.idleSettleMs ?? DEFAULT_IDLE_SETTLE_MS
const checkSessionExists = options?.checkSessionExists
const backgroundManager = options?.backgroundManager
@@ -56,6 +58,7 @@ export function createRalphLoopHook(
const event = createRalphLoopEventHandler(ctx, {
directory: ctx.directory,
apiTimeoutMs: apiTimeout,
idleSettleMs,
getTranscriptPath,
checkSessionExists,
backgroundManager,