import type { ReadonlyPartialJSONValue } from '@lumino/coreutils'; import { ISignal } from '@lumino/signaling'; import type { AskAgentTarget, IAskAgentContext } from './tokens'; /** * One queued prompt: a code selection, the user's instruction about it, and * where it should go. Every prompt is independent — a queue can mix targets * (different agents, new terminals, different running sessions) freely. */ export interface IQueuedPrompt { /** * Handle for edits and removal, unique within the page session. */ id: string; /** * The code selection the instruction is about. */ context: IAskAgentContext; /** * The user's typed comment. */ instruction: string; /** * The destination picked for this prompt (captured from the popup when it * was queued, editable in the panel). `null` when a persisted target no * longer parses — the panel then asks for a new pick before sending. */ target: AskAgentTarget | null; } /** * The accumulated ask-agent prompts awaiting a batch send. * * Queueing decouples writing review comments from deciding where they go: * the popup appends entries here instead of sending, the side panel lists * and edits them, and one batch send flushes the lot, delivering each * destination's prompts as one numbered message. The queue itself is a * plain in-memory model; the plugin mirrors it into the JupyterLab state * database (via {@link serializeQueuedPrompts}) so a page reload does not * silently drop typed comments. */ export declare class PromptQueue { constructor(items?: IQueuedPrompt[]); /** * The queued prompts, oldest first. */ get items(): readonly IQueuedPrompt[]; /** * Emitted whenever the queue contents change. */ get changed(): ISignal; /** * Append a prompt to the queue. */ add(context: IAskAgentContext, instruction: string, target: AskAgentTarget): void; /** * Replace the instruction of the queued prompt `id`, if still present. */ updateInstruction(id: string, instruction: string): void; /** * Repoint the queued prompt `id` at `target`, if still present. */ updateTarget(id: string, target: AskAgentTarget): void; /** * Remove the queued prompt `id`, if still present. */ remove(id: string): void; /** * Remove several queued prompts at once (one signal emission) — used when * a batch send succeeds for one target while other targets' prompts stay. */ removeMany(ids: readonly string[]): void; /** * Drop every queued prompt. */ clear(): void; /** * Replace the whole queue (used to restore and to undo a clear). */ reset(items: readonly IQueuedPrompt[]): void; private _items; private _changed; } /** * Rebuild queued prompts from a value read back from the state database. * Entries that no longer parse are dropped silently — the queue is a * convenience buffer, not a document. */ export declare function deserializeQueuedPrompts(value: unknown): IQueuedPrompt[]; /** * The queue as a JSON value for the state database. Ids are session-scoped * handles, so they are not persisted; {@link deserializeQueuedPrompts} * assigns fresh ones on load. */ export declare function serializeQueuedPrompts(items: readonly IQueuedPrompt[]): ReadonlyPartialJSONValue;