import type { SessionManager } from "./session-manager.js";
import type { StaffManager } from "./staff-manager.js";
import type { InboxStore } from "./inbox-store.js";
/**
 * Periodic check that wakes idle staff agents whose inbox has pending
 * entries. Mirrors the structure of `TeamManager.startIdleNudgeTimer`
 * (`team-manager.ts:148, 384, 419, 543-560`) but with the inverse
 * invariant: inbox nudges only fire against **idle** sessions, never
 * productive ones — so there is no exponential backoff. A staff that
 * idles with `pending > 0` gets nudged on the next tick or sooner.
 *
 * Latency:
 *  - **trigger → nudge edge**: `InboxManager.enqueue` calls `poke(staffId)`
 *    which schedules a one-shot `tickOne` on the next microtask, so an
 *    already-idle staff is woken with effectively zero latency.
 *  - **idle → nudge edge**: the periodic 15 s `setInterval` is the
 *    fallback for the case where the staff becomes idle some time
 *    *after* the enqueue (so `poke` ran while still streaming and was
 *    gated out by `tickOne`'s status check).
 *
 * State transitions (per staff):
 *  - `nudgePending` is set inside `applyPolicyThenNudge` before the
 *    digest prompt is delivered, and cleared either by a successful
 *    `onAgentStart` hook (the agent has begun its turn) or by an
 *    exception caught inside `applyPolicyThenNudge` (so a transient
 *    failure doesn't permanently silence the staff).
 */
export interface InboxNudgerDeps {
    sessionManager: SessionManager;
    staffManager: StaffManager;
    inboxStore: InboxStore;
}
export declare class InboxNudger {
    static readonly TICK_INTERVAL_MS = 15000;
    private intervalHandle;
    private readonly nudgePending;
    private readonly sessionManager;
    private readonly staffManager;
    private readonly inboxStore;
    constructor(deps: InboxNudgerDeps);
    start(): void;
    stop(): void;
    /**
     * Hint from `InboxManager.enqueue` that an entry was just appended for
     * `staffId`. Schedules a one-shot `tickOne` on the next microtask so
     * an idle staff can be woken without waiting up to 15 s for the next
     * periodic tick. Idempotent across multiple pokes — the eventual
     * `tickOne` consults `nudgePending` exactly like the periodic tick.
     */
    poke(staffId: string): void;
    /**
     * Called from the session-manager `agent_start` event hook for any
     * session whose `staffId` is set. Clears `nudgePending` so a fresh
     * batch can be delivered next time the staff goes idle.
     */
    onAgentStart(sessionId: string): void;
    private tick;
    private tickOne;
    private applyPolicyThenNudge;
    /**
     * Invoke the bridge-side compaction so the upcoming digest prompt
     * lands in a fresh context. Matches the call surface used by the
     * manual `/compact` skill (`ws/handler.ts:598`).
     *
     * Tolerant of test doubles that don't expose `compact` — we treat the
     * absence as a no-op rather than throwing, since the test seam's only
     * job is to verify the call shape.
     */
    private runCompact;
}
//# sourceMappingURL=inbox-nudger.d.ts.map