import type { ChatModel, ChatReasoningEffort } from '../types/schemas/chat/models.js'; import type { Component, DeepReadonly } from 'vue'; import type { ConversationEvent } from '../types/schemas/chat/conversations.js'; import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../types/schemas/chat/workspace-settings.js'; import type { TelaAgentExecutionInput } from '../types/schemas/integrations/tela-agent-api.js'; import type { ConversationCreatorFilter } from '../types/schemas/chat/primitives.js'; import type { ChatLoadingMessageMode } from './loading-messages.js'; import type { ChatFeatureConfig } from './feature-config.js'; import type { ChatCitationsConfig } from '../citations/types.js'; import type { MessageFeedbackConfig, MessageFeedbackRating } from '../messages/composables/chat-feedback.js'; import type { AvailableChatModels } from '../messages/model-availability.js'; export type { AvailableChatModels } from '../messages/model-availability.js'; export type ChatEmbedVariant = 'page' | 'floating' | 'sidepanel'; export type ChatLabels = { /** Search placeholder in the sidebar, mobile drawer and widget history. Defaults to `Buscar conversas`. */ conversationSearchPlaceholder: string; /** Clear-button tooltip in the sidebar and mobile drawer search. Defaults to `Limpar`. */ conversationSearchClear: string; }; export type ChatSuggestion = { /** Short label rendered on the suggestion pill. */ title: string; /** Full prompt written into the message input when the pill is clicked. */ prompt: string; }; export type ChatActor = { name?: string | null; email?: string | null; image?: string | null; }; export type ChatSidebarConfig = { /** Which edge of the chat surface renders the conversation sidebar. Defaults to left. */ position?: 'left' | 'right'; /** Sidebar width in pixels. Defaults to 240. */ width?: number; /** * Height of the `sidebar-bottom` slot pane as a percentage (0–100) of the * sidebar's conversation area. Only applies when the slot is provided. * Defaults to 50. */ bottomHeight?: number; /** * Render a native collapse handle and animate the sidebar open/closed, so * the host doesn't have to build its own toggle. Defaults to false. */ collapsible?: boolean; /** Start collapsed on first render when `collapsible` is set. Defaults to false. */ defaultCollapsed?: boolean; }; export type ChatEmbedSharedProps = { /** Optional repository branch for new agent sessions. Omit to use the published version. */ telaAgentBranch?: string | null; /** Controlled conversation id. Use with `v-model:conversation-id` when the host owns active conversation state. */ conversationId?: string | null; /** Controlled audit events rendered chronologically between conversation messages. */ conversationEvents?: readonly ConversationEvent[] | null; /** Disables the message composer while the host completes an external state transition. */ composerDisabled?: boolean; /** Conversation id to open once on mount when `conversationId` is uncontrolled. */ initialConversationId?: string | null; /** * Technical scope that isolates conversation history within the current workspace and runtime. * Scoped embeds only see conversations created with the same scope, and unscoped embeds only * see unscoped ones, so adding a scope never mixes with existing workspace-level history. * Values are trimmed, blank strings become `null`, and the server accepts 1-200 characters * from `A-Z`, `a-z`, `0-9`, `.`, `_`, `:`, `/`, and `-`. */ conversationScope?: string | null; /** * Initial creator filter for the sidebar conversation list: `'all'` (default) shows every * conversation in scope, `'mine'` shows only those created by the current user. */ defaultConversationCreatorFilter?: ConversationCreatorFilter; /** * Non-empty ordered list of models this embed may display and execute. * When omitted, the full chat catalog remains available. The first model is * used when a new or restored selection is not allowed by this list. */ availableModels?: AvailableChatModels; /** * Initial model for untouched drafts. Existing conversations and explicit selections take precedence. * When excluded by availableModels, the first allowed model is used. */ defaultModel?: ChatModel; /** * Initial effort for untouched drafts. Omission preserves automatic reasoning; * an explicit user selection (including null) takes precedence. */ defaultReasoningEffort?: ChatReasoningEffort; /** Controlled creator filter. Use with `v-model:conversation-creator-filter` when the host changes it at runtime. */ conversationCreatorFilter?: ConversationCreatorFilter; /** Hide the conversation creator filter while preserving its active value. */ hideConversationCreatorFilter?: boolean; /** Hide the conversation list and render only the active chat surface. Defaults to `false`; widget variants default to `true`. */ hideSidebar?: boolean; /** Layout options for the conversation sidebar (edge and `sidebar-bottom` split). */ sidebar?: ChatSidebarConfig; /** Hide workspace settings actions while keeping the chat header and content unchanged. */ hideSettings?: boolean; /** * Tighter spacing tuned for widget shells (floating/sidepanel). Hides the * conversation topbar, since the widget header replaces it. Applied * automatically by the `floating` and `sidepanel` variants. */ compact?: boolean; /** * Suggestion pills rendered in the conversation empty state. Each pill shows * its `title` and clicking it writes `prompt` into the message input. When * omitted or empty no pills are rendered — the lib ships no defaults. */ suggestions?: readonly ChatSuggestion[] | null; /** Custom pending-response messages shown while the assistant is working. */ loadingMessages?: readonly string[] | null; /** * How custom loading messages rotate: `'ordered'` (default) cycles them in order, * `'random'` picks at random. Only applies when `loadingMessages` has at least one * non-empty message. */ loadingMessagesMode?: ChatLoadingMessageMode | null; /** Override supported UI text. Omitted labels keep their Portuguese defaults; no i18n plugin is required. */ labels?: Partial; /** Custom markdown component renderers keyed by markdown node or tag name. */ customComponents?: Record; /** Extra HTML tags allowed by the markdown renderer. */ customHtmlTags?: readonly string[]; /** * Enables `cite://` citations in assistant messages. The host resolves each * citation against its own backend (carrying the viewing user's authorization); * the lib renders chips, the metadata popover and the document panel. */ citations?: ChatCitationsConfig | null; /** * Enables 👍/👎 feedback on assistant messages and configures the reason * popovers. Providing the prop (even `{}`) shows the controls. Prefer the * async `submit` callback when persistence can fail; without it, votes reach * the host through the legacy `message-feedback` event. */ feedbackConfig?: MessageFeedbackConfig | null; /** * Ratings the host persisted, keyed by message id. When provided, this map is * the single source of truth for the selected thumbs — update it only after * persistence succeeds. * When omitted, votes are kept in component-local state only. */ messageFeedback?: Readonly> | null; }; export type DefaultChatEmbedProps = ChatEmbedSharedProps & { /** Omitted in default chat mode. Set this to switch to Tela agent mode. */ telaAgentId?: undefined; /** Tela agent inputs are only accepted in Tela agent mode. */ telaAgentInputs?: undefined; /** Optional host-provided workspace settings. When omitted, chat-nuxt loads workspace settings itself. */ workspaceSettings?: DeepReadonly | WorkspaceSettings | null; /** Optional display identity for messages created by the current user. */ user?: ChatActor | null; /** Optional UI feature toggles for the default chat runtime. */ features?: Partial; }; export type TelaAgentChatEmbedProps = ChatEmbedSharedProps & { /** Tela agent id that switches the embed into Tela agent runtime mode. */ telaAgentId: string; /** Inputs sent with each Tela agent run. Non-null values hide the variables panel. */ telaAgentInputs?: DeepReadonly | null; /** Not accepted in Tela agent mode because the Tela agent owns runtime settings. */ workspaceSettings?: never; /** Not accepted in Tela agent mode because execution identity comes from the Tela agent runtime. */ user?: never; /** Optional UI feature toggles that are still supported in Tela agent mode. */ features?: Partial; }; export type ChatEmbedVariantProps = { /** * Presentation shell: `'page'` (default) renders the full-page embed, * `'floating'` renders a launcher pill with an anchored popover window, and * `'sidepanel'` renders an always-open docked column. Widget variants render * client-only and default to `hideSidebar`. */ variant?: ChatEmbedVariant; /** Floating variant only: start with the widget window open. */ defaultOpen?: boolean; /** Floating variant only: label of the launcher pill. Defaults to `'Ask Tela'`. */ launcherLabel?: string; }; export type MeistrariChatEmbedProps = (DefaultChatEmbedProps | TelaAgentChatEmbedProps) & ChatEmbedVariantProps;