import type { AgentMessage } from "@gajae-code/agent-core"; export interface YieldDispatcher
{
/** Drop entries already delivered through another path. Called per-entry at flush time. */
isStale?(entry: P): boolean;
/**
* Optional ownership-origin key: when provided, the flush builds ONE
* message per distinct key instead of one message for the whole batch, so
* a later scope:"owned" drop of one origin never suppresses entries of
* another origin (review thread P2).
*/
groupKey?(entry: P): string;
/** Produce one batched AgentMessage from non-stale entries. Return null to skip. */
build(survivors: P[]): AgentMessage | null;
}
export interface YieldQueueOptions {
isStreaming: () => boolean;
injectStreaming(msg: AgentMessage): void;
injectIdle(messages: AgentMessage[]): Promise (kind: string, dispatcher: YieldDispatcher ): () => void;
enqueue (kind: string, entry: P): void;
has(kind?: string): boolean;
flush(mode: YieldFlushMode): Promise