import type { PlatformAdapter } from '../platform/index.js'; import type { EventBus } from '../events/index.js'; import type { ThreadRecord, RunThreadOptions } from '../core/types/thread-types.js'; import { type ResumeEntry } from '../domain/costs/resume-registry.js'; import { agentRunner } from './agent-runner.js'; /** Auto-resume feature gate. */ export declare function isAutoResumeEnabled(): boolean; import { buildResumeReminder } from '../core/resume-reminder.js'; export { buildResumeReminder }; export interface ResumeDeps { takeReady: (activeProviders: string[]) => ResumeEntry[]; activeProviders: () => string[]; route: (ctx: Parameters[0]) => Promise; resumeThread: (threadId: string, opts: RunThreadOptions) => Promise; /** Settle a resumed thread once its run returns: refresh the live status message to its * terminal/re-suspended/re-rate-limited summary and cascade completion to any parent. * Without this the status message freezes at the last running step (the resumed run keeps * updating it mid-flight, but nothing seals it at the end). Mirrors the DR-0014 * suspended-parent onSettled in thread-callback.defaultResume. */ settleResumedThread: (threadId: string) => Promise; requeue: (entry: ResumeEntry) => void; buildResumeOptions: (thread: ThreadRecord) => RunThreadOptions | null; getThread: (threadId: string) => ThreadRecord | null; channelBusy: (channel: string) => boolean; /** True if a DIRECT (interactive) session is live on the channel — i.e. an execution with no * threadId. Only direct sessions force a channel to serialize (a Slack conversation cannot * interleave two assistant turns). Threads are channel-parallel-safe, so a rate-limited thread * only needs to avoid a live direct session, not other threads. */ directSessionBusy: (channel: string) => boolean; /** Daemon busy-gate bracket (busyTracker.trackPendingTask). The fire-and-forget thread resume * must hold the gate for its ENTIRE run + settle — without it the resumed thread is invisible * to the busy/idle IPC, and a pending .restart fires mid-stream and SIGKILLs app.ts * (2026-07-09: three resumed threads killed). Direct resumes are NOT bracketed here: * agentRunner.route tracks internally and double-counting would be redundant. */ track: (delta: number) => void; delay: (ms: number) => Promise; } type ResumeDispatch = (adapter: PlatformAdapter) => Promise; export declare function registerResumeWakeOnAgentSettle(bus: EventBus, adapter: PlatformAdapter, dispatch?: ResumeDispatch): () => void; /** Drain entries whose provider is no longer active and re-enter each target. * Called after provider clears and during startup reconciliation. Never throws. */ export declare function dispatchPendingResumes(adapter: PlatformAdapter, overrides?: Partial): Promise;