/** * Adaptive Chatbot - Types */ export interface ChatbotFallback { /** Header shown on the fallback card. */ title?: string; /** Body copy explaining the situation. */ message?: string; /** Label for the CTA link. */ ctaLabel?: string; /** Target — typically the customer's existing support path. */ ctaHref?: string; } export interface ChatbotConfig { backendUrl: string; mlflowRunId?: string; greeting?: string; maxHistory?: number; suggestions?: string[]; /** Show a dictation mic on the composer (Web Speech API, where supported). */ voiceInput?: boolean; /** * Per-customer fallback card rendered when chat can't open. Endpoint of * last resort for users whose browser/network fails the bot check; they * see a polite "chat unavailable, contact support at …" instead of a * raw Cloudflare challenge. */ fallback?: ChatbotFallback; } export interface ActionHandle { id: string; revert: () => Promise; isApplied: () => boolean; } export interface BatchActionHandle { id: string; handles: ActionHandle[]; revertAll: () => Promise; isApplied: () => boolean; } /** * Loose ActionStep shape used by the element handlers (Phase 6c). The * handlers build action objects (`{kind: 'core:mountWidget', slot, …}`) * and pass them to `actions.applyBatch` — the runtime SDK does the * structural validation. We don't want to take a runtime-sdk type * dependency here, so duck-type the shape as `Record`. */ export type ActionStep = Record; export interface ActionEngine { apply: (action: ActionStep) => Promise; applyBatch: (actions: ActionStep[]) => Promise; } export interface ChatbotWidgetRuntime { /** * The workspace's syn_* SDK token from `Syntro.init({ token })`, surfaced * on the runtime handle (same single-source contract as the runtime's * `backendUrl`). ALL chat auth reads THIS — never a window global; the * legacy `window.__SYNTRO_CONFIG__` channel is not set on customer * storefronts, which made every real-world chat connect 401 * (BUG-1785360157). Absent = unauthenticated; the backend rejects loudly. */ token?: string; /** * The runtime's context, read-only. The host agent controller reads the * surface from here to tell an MCP App card from a storefront, and to see * which display modes the host is offering it. Optional: a storefront mount * or a bare unit harness simply has no context to read. */ context?: { get: () => { surface?: { type?: string; displayMode?: string; availableDisplayModes?: string[]; }; }; /** Called on every context change; returns its own unsubscribe. */ subscribe?: (callback: () => void) => () => void; }; actions: ActionEngine; events: { publish: (name: string, props?: Record) => void; /** Optional — runtime's full event bus exposes subscribe; the * chatbot uses it to broadcast `element.compositional_append` * to container widgets (chips strip, FAQ accordion, nav tips) * that opt into LLM-authored item appends. Overloaded to match * the runtime SDK's `EventBus.subscribe`: pass `{names:[...]}` to * filter (preferred — drops fan-out to a name compare), or a * callback to receive every event in the bus. */ subscribe?: { (filter: { names?: string[]; }, handler: (event: { name: string; props?: Record; }) => void): () => void; (handler: (event: { name: string; props?: Record; }) => void): () => void; }; }; /** * Runtime widget registry — the subset the chatbot uses to mount an inline * tile widget by its runtime widget-id (e.g. `adaptive-product:card`), * resolving the id to its real custom element exactly like the deck * `SyntroTileCard` path. Optional: hosts that mount the chat-bar without a * widget registry (bare unit tests) simply skip inline registry mounts and * fall back to direct-tag creation for self-defining widgets (reco carousel). */ widgets?: { has: (id: string) => boolean; mount: (id: string, container: HTMLElement, config?: Record) => { unmount?: () => void; }; }; } export type { EditorPanelProps } from '@syntrologie/sdk-contracts'; //# sourceMappingURL=types.d.ts.map