/** * UI Command Queue — bidirectional Agent↔Viewer communication * * Ported from SmartStore's NavigationContext + Layout command polling pattern. * - Viewer → Agent: POST /api/ui/page-context (current page state) * - Agent → Viewer: GET /api/ui/commands (1s polling, drain on read) * - Agent push: POST /api/ui/commands (queue a command) */ import type { ServerResponse } from 'node:http'; export interface UICommand { id?: string; type: 'navigate' | 'notify' | 'suggest_change' | 'refresh'; payload: Record; } export interface UICommandAck { command_ids: string[]; } export interface PageContext { currentRoute: string; channelId?: string; selectedItem?: { type: string; id: string; }; pageData?: Record; } export declare class UICommandQueue { private commands; private pageContext; private pageContexts; private nextCommandSeq; push(cmd: UICommand): UICommand; drain(): UICommand[]; ack(commandIds: string[]): void; setPageContext(ctx: PageContext): void; getPageContext(channelId?: string): PageContext | null; } /** GET /api/ui/commands — viewer drains pending commands */ export declare function handleGetUICommands(res: ServerResponse, queue: UICommandQueue): void; /** GET /api/ui/page-context — agent reads current viewer state */ export declare function handleGetPageContext(res: ServerResponse, queue: UICommandQueue): void; /** POST /api/ui/page-context — viewer reports current page state */ export declare function handlePostPageContext(res: ServerResponse, body: PageContext, queue: UICommandQueue): void; /** POST /api/ui/commands — agent pushes a UI command */ export declare function handlePostUICommand(res: ServerResponse, body: UICommand, queue: UICommandQueue): void; /** POST /api/ui/commands/ack — viewer acknowledges applied commands */ export declare function handlePostUICommandAck(res: ServerResponse, body: UICommandAck, queue: UICommandQueue): void; //# sourceMappingURL=ui-command-handler.d.ts.map