/** * Action dispatcher — executes serialized actions at runtime. * * Client actions (setState, showToast, etc.) run locally. * MCP actions (toolCall, sendMessage) delegate to the transport layer. */ import type { Store } from './state.js'; import type { EvalScope } from './rx.js'; /** MCP transport interface — injected at mount time */ export interface McpTransport { callTool(name: string, args: Record): Promise; sendMessage(message: string): Promise; /** Subscribe to a resource URI for push updates. Returns an unsubscribe function. */ subscribe?(uri: string, onData: (data: unknown) => void): () => void; /** Transport capabilities discovered during handshake. */ readonly capabilities?: { subscriptions?: boolean; }; } /** Toast event — emitted for showToast actions */ export interface ToastEvent { message: string; description?: string; variant?: string; duration?: number; } /** Action dispatcher context */ export interface DispatchContext { store: Store; transport?: McpTransport; scope?: EvalScope; rerender: () => void; onToast?: (toast: ToastEvent) => void; /** Replace the current view with a new prefab wire payload (server-rendered pattern). */ remount?: (data: Record) => void; } export type ActionJSON = Record; /** * Dispatch one or more serialized actions. */ export declare function dispatchActions(actions: ActionJSON | ActionJSON[], ctx: DispatchContext): Promise; /** Clear all active intervals (called on destroy). */ export declare function clearAllIntervals(): void; /** Clear all active subscriptions (called on destroy). */ export declare function clearAllSubscriptions(): void; /** * Extract a prefab wire payload from a tool call result. * * Checks both the result itself and `structuredContent` for a `$prefab` marker. * Also inspects MCP content arrays for JSON text blocks containing `$prefab`. */ export declare function extractPrefabPayload(result: unknown): Record | null; /** * Extract a prefab state-update payload from a tool call result. * * Mirrors extractPrefabPayload but matches `{ $prefab, update: { state } }` * (the shape produced by `display_update()`). */ export declare function extractPrefabUpdate(result: unknown): Record | null; //# sourceMappingURL=actions.d.ts.map