import { type SchedulerLane } from "../lib/scheduler.js"; import { Store } from "../lib/store.js"; import type { ExecutorResult, Loop, LoopRun } from "../types.js"; export interface RunDaemonOptions { intervalMs?: number; leaseTtlMs?: number; /** Legacy single-pool knob; back-compat alias for the agent/workflow lane budget. */ concurrency?: number; /** Claim budget for command-target loops (fast loops). Default 4. */ commandConcurrency?: number; /** Claim budget for agent/workflow-target loops (long workers). Default 8; `concurrency`/LOOPS_DAEMON_CONCURRENCY still set it. */ agentConcurrency?: number; store?: Store; pidPath?: string; execute?: (loop: Loop, run: LoopRun) => Promise; shouldStop?: () => boolean; sleep?: (ms: number) => Promise; log?: (message: string) => void; signal?: AbortSignal; reapGraceMs?: number; } export declare const DEFAULT_COMMAND_CONCURRENCY = 4; export declare const DEFAULT_AGENT_CONCURRENCY = 8; /** * Resolve the two separated concurrency lanes. Command loops (fast) and * agent/workflow loops (long workers) get independent budgets so a saturated * agent lane cannot starve command loops. Precedence per lane is explicit opt > * lane env > legacy knob > default. The legacy `concurrency` opt and * `LOOPS_DAEMON_CONCURRENCY` env stay wired to the agent lane (the dominant * consumer / historical "total" knob), so existing deployments keep their * heavy-lane capacity and simply gain a reserved command lane on top. */ export declare function resolveLaneConcurrency(opts?: Pick): Record; export declare const DAEMON_LOG_MAX_BYTES: number; export declare const DAEMON_LOG_KEEP = 2; export declare function daemonLogLine(message: string): string; export declare function stripAnsi(text: string): string; export declare function rotateDaemonLog(path?: string, maxBytes?: number, keep?: number): boolean; export declare function runDaemon(opts?: RunDaemonOptions): Promise; export interface StartDaemonResult { started: boolean; alreadyRunning: boolean; pid?: number; } export declare function startDaemon(opts: { cliEntry: string; execPath?: string; args?: string[]; waitMs?: number; sleep?: (ms: number) => Promise; }): Promise;