/** * Bounded push queue for out-of-band events the agent should learn about * without spending a turn asking — a spawned child finishing, a background * build making progress or exiting. * * The queue is deliberately lossy. Only the LATEST entry per `(kind, id)` * survives, because a stale "build is 40% through" line is worthless next to * "build exited 1", and a parent that spawned five children needs five facts, * not fifty. Terminal entries supersede pending non-terminal ones for the same * id and cannot themselves be superseded by a later non-terminal update, so a * completion can never be overwritten by a straggling progress tick. * * Every bound here protects the same thing: injected bytes per drain. These * notifications ride the steering path into live context, so an unbounded * queue would silently eat the context window it is meant to save. */ /** Notification source. Extended as new push producers are added. */ export type NotificationKind = "subagent" | "process"; export interface AgentNotification { kind: NotificationKind; /** Producer-scoped identity (agent id, process id). Dedupe key with `kind`. */ id: string; /** Bounded, human-readable one-liner. Never raw output. */ text: string; /** True once the producer reached a final state (child done, process exited). */ terminal: boolean; /** Unix epoch ms of the most recent update for this `(kind, id)`. */ updatedAt: number; } /** Max characters retained for a single notification's text. */ export declare const NOTIFICATION_MAX_CHARS = 512; /** Max characters returned by one `drain()`, across all notifications. */ export declare const NOTIFICATION_DRAIN_MAX_CHARS = 1024; /** * FIFO with latest-only dedupe by `(kind, id)`. Insertion order is preserved * across updates: an entry that is updated keeps its original queue position, * so a chatty producer cannot starve an older, quieter one out of a drain. */ export declare class AgentNotificationQueue { private entries; private static key; /** * Record the latest state for one producer. Returns false when the update * was dropped because a terminal entry for the same id already exists. */ enqueue(kind: NotificationKind, id: string, text: string, options?: { terminal?: boolean; }): boolean; /** Number of notifications currently waiting. */ get size(): number; /** Discard any pending notification for one producer (e.g. on reap). */ clear(kind: NotificationKind, id: string): void; /** Discard everything (e.g. between runs). */ clearAll(): void; /** * Take pending notifications, oldest first, up to the per-drain char budget. * Taken entries are removed; entries that did not fit stay queued for the * next drain rather than being dropped. */ drain(): AgentNotification[]; } //# sourceMappingURL=agent-notifications.d.ts.map