/** * Canonical view-interact protocol contract shared by the agent server and the * UI. The agent's views route (`packages/agent/src/api/views-routes.ts`) and the * UI's DynamicViewLoader both dispatch against the same capability ids, so the * ids live here — in the shared workspace contract — rather than inside UI * internals, keeping the agent buildable without an `@elizaos/ui` dependency. * * The flow: * 1. Agent POSTs to /api/views/:id/interact with a ViewInteractRequest body. * 2. Server broadcasts a WS message {type:"view:interact",...} to all clients. * 3. DynamicViewLoader receives the WS message, calls the view module's * interact(capability, params) export (or a standard capability handler). * 4. Frontend sends {type:"view:interact:result",...} back over WS. * 5. Server resolves the pending request and returns the result to the agent. */ export interface ViewInteractRequest { viewId: string; capability: string; params?: Record; /** UUID generated server-side for correlating the async result. */ requestId: string; /** Timeout in ms before the server gives up waiting. Default 5000. */ timeoutMs?: number; } export interface ViewInteractResult { requestId: string; success: boolean; result?: unknown; error?: string; } /** Renderer-owned delivery identity stamped on a runtime message, not model arguments. */ export declare function readViewInteractionClientId(message: { content: unknown; }): string | undefined; /** Routing identifier only; never an authentication or permission credential. */ export declare function parseViewInteractionClientId(value: unknown): string | undefined; /** Standard capabilities that every view is expected to support. */ export declare const STANDARD_CAPABILITIES: { /** Returns the current view state as JSON. */ readonly GET_STATE: "get-state"; /** Forces a data refresh / re-render. */ readonly REFRESH: "refresh"; /** Focuses an input or button by CSS selector or name attribute. */ readonly FOCUS_ELEMENT: "focus-element"; /** Returns the visible text content of the view container. */ readonly GET_TEXT: "get-text"; /** Clicks an element by CSS selector or name attribute. Dispatched generically * by DynamicViewLoader / ShellViewAgentSurface for every loaded view. */ readonly CLICK_ELEMENT: "click-element"; /** Sets the value of an input by selector/name. Dispatched generically by * DynamicViewLoader / ShellViewAgentSurface for every loaded view. */ readonly FILL_INPUT: "fill-input"; }; export type StandardCapability = (typeof STANDARD_CAPABILITIES)[keyof typeof STANDARD_CAPABILITIES]; /** Protocol observations only; refresh, focus, fill and click are excluded. * Shared by broker admission and owner effect restrictions. Membership here * does not replace the caller's existing role, installation or scope gates. */ export declare const READ_ONLY_VIEW_CAPABILITY_IDS: ReadonlySet; /** * Capability ids handled generically by the agent-surface registry (addressable * elements, focus, programmatic fill/click). DynamicViewLoader routes any of * these to the agent-surface capability handler before falling back to selector * handling. */ export declare const AGENT_SURFACE_CAPABILITY_IDS: ReadonlySet;