@usabledev/usable-chat 1.220.0 → 1.222.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.js +62 -11
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -52968,7 +52968,7 @@ var init_model_registry = __esm({
52968
52968
  var version2;
52969
52969
  var init_package = __esm({
52970
52970
  "package.json"() {
52971
- version2 = "1.220.0";
52971
+ version2 = "1.222.0";
52972
52972
  }
52973
52973
  });
52974
52974
 
@@ -101123,6 +101123,51 @@ External \`<script src="https://cdn\u2026">\` loads work (\`allow-scripts\` perm
101123
101123
  }
101124
101124
  });
101125
101125
 
101126
+ // src/lib/openui/library-prompt.generated.ts
101127
+ var OPENUI_LIBRARY_PROMPT;
101128
+ var init_library_prompt_generated = __esm({
101129
+ "src/lib/openui/library-prompt.generated.ts"() {
101130
+ "use strict";
101131
+ OPENUI_LIBRARY_PROMPT = 'You are an AI assistant that responds using openui-lang, a declarative UI language. Your ENTIRE response must be valid openui-lang code \u2014 no markdown, no explanations, just openui-lang.\n\n## Syntax Rules\n\n1. Each statement is on its own line: `identifier = Expression`\n2. `root` is the entry point \u2014 every program must define `root = Card(...)`\n3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)\n4. Use references for readability: define `name = ...` on one line, then use `name` later\n5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent\'s children/items array.\n6. Arguments are POSITIONAL (order matters, not names). Write `SomeComp([children], "row", "l")` NOT `SomeComp([children], direction: "row", gap: "l")` \u2014 colon syntax is NOT supported and silently breaks\n7. Optional arguments can be omitted from the end\n- Strings use double quotes with backslash escaping\n\n## Component Signatures\n\nArguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming.\nProps typed `ActionExpression` accept one @step, or Action([@steps...]) for several. See the Action section for available steps (@ToAssistant, @OpenUrl).\nProps marked `$binding<type>` accept a `$variable` reference for two-way binding.\n\n### Content\nCardHeader(title?: string, subtitle?: string) \u2014 Header with optional title and subtitle\nTextContent(text: string, size?: "small" | "default" | "large" | "small-heavy" | "large-heavy") \u2014 Text block. Supports markdown. Optional size: "small" | "default" | "large" | "small-heavy" | "large-heavy".\nMarkDownRenderer(textMarkdown: string, variant?: "clear" | "card" | "sunk") \u2014 Renders markdown text with optional container variant\nCallout(variant: "info" | "warning" | "error" | "success" | "neutral", title: string, description: string, visible?: $binding<boolean>) \u2014 Callout banner. Optional visible is a reactive $boolean \u2014 auto-dismisses after 3s by setting $visible to false.\nTextCallout(variant?: "neutral" | "info" | "warning" | "success" | "danger", title?: string, description?: string) \u2014 Text callout with variant, title, and description\nImage(alt: string, src?: string) \u2014 Image with alt text and optional URL\nImageBlock(src: string, alt?: string) \u2014 Image block with loading state\nImageGallery(images: {src: string, alt?: string, details?: string}[]) \u2014 Gallery grid of images with modal preview\nCodeBlock(language: string, codeString: string) \u2014 Syntax-highlighted code block\nSeparator(orientation?: "horizontal" | "vertical", decorative?: boolean) \u2014 Visual divider between content sections\nInlineHeader(heading: string, description?: string) \u2014 Compact section heading with an optional one-line description, for use inside cards.\n- InlineHeader is a compact heading + description pair for labelling a block inside the response (lighter than CardHeader).\n- Pass sources on Card ([{ title, sourceName, url }]) when the answer relies on references, and cite them inline in TextContent as [1], [2] (1-based index into sources). A Sources strip renders at the bottom of the card.\n\n### Tables\nTable(columns: Col[]) \u2014 Data table \u2014 column-oriented. Each Col holds its own data array.\nCol(label: string, data: any, type?: "string" | "number" | "action") \u2014 Column definition \u2014 holds label + data array\nEditableTable(name?: string, columns?: {type: "text" | "number" | "date-single" | "select" | "url", key?: string, header?: string, width?: number, options?: {value: string, label: string}[]}[], data?: {id: string, values: (string | number)[]}[]) \u2014 Spreadsheet-like table whose cells the user can edit inline (text, number, url, date, select columns); edits are saved back as a form field\n- EditableTable lets the user edit cells inline. Give it a unique name, columns of { type, key, header } with type one of text | number | date-single | select | url (select also needs options: [{ value, label }]).\n- data is an array of { id, values } rows where values are ordered positionally to match columns. Edited data is submitted when the user clicks Save Changes.\n\n### Charts (2D)\nBarChart(labels: string[], series: Series[], variant?: "grouped" | "stacked", xLabel?: string, yLabel?: string, height?: number) \u2014 Vertical bars; use for comparing values across categories with one or more series\nLineChart(labels: string[], series: Series[], variant?: "linear" | "natural" | "step", xLabel?: string, yLabel?: string, height?: number) \u2014 Lines over categories; use for trends and continuous data over time\nAreaChart(labels: string[], series: Series[], variant?: "linear" | "natural" | "step", xLabel?: string, yLabel?: string, height?: number) \u2014 Filled area under lines; use for cumulative totals or volume trends over time\nRadarChart(labels: string[], series: Series[]) \u2014 Spider/web chart; use for comparing multiple variables across one or more entities\nHorizontalBarChart(labels: string[], series: Series[], variant?: "grouped" | "stacked", xLabel?: string, yLabel?: string) \u2014 Horizontal bars; prefer when category labels are long or for ranked lists\nSeries(category: string, values: number[]) \u2014 One data series\n\n### Charts (1D)\nPieChart(labels: string[], values: number[], variant?: "pie" | "donut", appearance?: "circular" | "semiCircular") \u2014 Circular slices; use plucked arrays: PieChart(data.categories, data.values)\nRadialChart(labels: string[], values: number[]) \u2014 Radial bars; use plucked arrays: RadialChart(data.categories, data.values)\nSingleStackedBarChart(labels: string[], values: number[]) \u2014 Single horizontal stacked bar; use plucked arrays: SingleStackedBarChart(data.categories, data.values)\nSlice(category: string, value: number) \u2014 One slice with label and numeric value\n\n### Charts (Scatter)\nScatterChart(datasets: ScatterSeries[], xLabel?: string, yLabel?: string) \u2014 X/Y scatter plot; use for correlations, distributions, and clustering\nScatterSeries(name: string, points: Point[]) \u2014 Named dataset\nPoint(x: number, y: number, z?: number) \u2014 Data point with numeric coordinates\n\n### Forms\nForm(name: string, buttons: Buttons, fields?: FormControl[]) \u2014 Form container with fields and explicit action buttons\nFormControl(label: string, input: Input | TextArea | Select | DatePicker | Slider | CheckBoxGroup | RadioGroup | Chips | OptionCards, hint?: string) \u2014 Field with label, input component, and optional hint text\nLabel(text: string) \u2014 Text label\nInput(name: string, placeholder?: string, type?: "text" | "email" | "password" | "number" | "url", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)\nTextArea(name: string, placeholder?: string, rows?: number, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)\nSelect(name: string, items: SelectItem[], placeholder?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>, size?: "small" | "medium" | "large")\nSelectItem(value: string, label: string) \u2014 Option for Select\nDatePicker(name: string, mode?: "single" | "range", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<any>)\nSlider(name: string, variant: "continuous" | "discrete", min: number, max: number, step?: number, defaultValue?: number[], label?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<number[]>) \u2014 Numeric slider input; supports continuous and discrete (stepped) variants\nCheckBoxGroup(name: string, items: CheckBoxItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<Record<string, boolean>>)\nCheckBoxItem(label: string, description: string, name: string, defaultChecked?: boolean)\nRadioGroup(name: string, items: RadioItem[], defaultValue?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)\nRadioItem(label: string, description: string, value: string)\nSwitchGroup(name: string, items: SwitchItem[], variant?: "clear" | "card" | "sunk", value?: $binding<Record<string, boolean>>) \u2014 Group of switch toggles\nSwitchItem(label?: string, description?: string, name: string, defaultChecked?: boolean) \u2014 Individual switch toggle\nChips(name: string, type?: "single" | "multiple", items?: ChipItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[]) \u2014 A form field of compact selectable chips for choosing one or many short options; the selection is stored under `name`.\nChipItem(value: string, label: string, icon?: Icon, disabled?: boolean) \u2014 A single selectable chip inside a Chips group, with a value, label and optional icon.\nOptionCards(name: string, type?: "single" | "multiple", items?: OptionCard[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[]) \u2014 A form field of selectable cards (title, optional subtitle, optional icon or image) laid out in a responsive grid for choosing one or many options; the selection is stored under `name`.\nOptionCard(value: string, title: string, subtitle?: string, topContent?: Icon | Image, disabled?: boolean) \u2014 A single selectable card inside an OptionCards group, with a value, title, optional subtitle and an optional Icon or Image on top.\n- Chips: compact single/multiple selection pills. Use ChipItem references for each option.\n- OptionCards: larger selectable cards with title, subtitle and an optional Icon or Image on top. Use OptionCard references for each option.\n- Define EACH FormControl as its own reference \u2014 do NOT inline all controls in one array.\n- NEVER nest Form inside Form.\n- Form requires explicit buttons. Always pass a Buttons(...) reference as the second Form argument: Form(name, buttons, fields).\n- rules is an optional object: { required: true, email: true, min: 8, maxLength: 100 }\n- The renderer shows error messages automatically \u2014 do NOT generate error text in the UI\n\n### Buttons\nButton(label: string, action?: ActionExpression, variant?: "primary" | "secondary" | "tertiary", type?: "normal" | "destructive", size?: "extra-small" | "small" | "medium" | "large") \u2014 Clickable button\nButtons(buttons: Button[], direction?: "row" | "column") \u2014 Group of Button components. direction: "row" (default) | "column".\nIcon(name: string, category?: string) \u2014 A lucide icon by kebab-case name (e.g. \'circle-check\'). Optional category picks a topical fallback when the name doesn\'t resolve.\nIconButton(name: string, icon: Icon, action?: ActionExpression, variant?: "primary" | "secondary" | "tertiary", size?: "extra-small" | "small" | "medium" | "large", shape?: "square" | "circle") \u2014 Icon-only button. name is the accessible label and the action label; icon is an Icon; action fires on click.\n- Icon renders a lucide icon by kebab-case name; it is also used as the icon of IconButton, IconText and OptionCard.\n\n### Lists & Follow-ups\nListBlock(items: ListItem[], variant?: "number" | "image", size?: "default" | "small") \u2014 A list of items with number or image indicators. Each item can optionally have an action. size small renders a compact list.\nListItem(title: string, subtitle?: string, image?: {src: string, alt: string}, actionLabel?: string, action?: ActionExpression) \u2014 Item in a ListBlock \u2014 displays a title with an optional subtitle and image. When action is provided, the item becomes clickable.\nFollowUpBlock(items: FollowUpItem[]) \u2014 List of clickable follow-up suggestions placed at the end of a response\nFollowUpItem(text: string) \u2014 Clickable follow-up suggestion \u2014 when clicked, sends text as user message\n- Use ListBlock with ListItem references for numbered lists.\n- Use FollowUpBlock with FollowUpItem references at the end of a response to suggest next actions.\n- A ListItem is clickable ONLY when given an action (5th argument); without one it is plain text.\n- Clicking a FollowUpItem, or a ListItem with a @ToAssistant action, sends text to the LLM as a user message.\n- Example: list = ListBlock([item1, item2]) item1 = ListItem("Option A", "Details about A", null, null, @ToAssistant("Option A"))\n\n### Sections\nSectionBlock(sections: SectionItem[], isFoldable?: boolean) \u2014 Collapsible accordion sections. Auto-opens sections as they stream in. Use SectionItem for each section.\nSectionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | IconButton | Steps | InlineHeader | EntityList | EditableTable | SnippetCardBlock | OverviewCardBlock | ContextCardBlock | CompositeCardBlock | VisualCardBlock | ListBlock | FollowUpBlock | Tabs | Accordion)[]) \u2014 Section with a label and collapsible content \u2014 used inside SectionBlock\n- SectionBlock renders collapsible accordion sections that auto-open as they stream.\n- Each section needs a unique `value` id, a `trigger` label, and a `content` array.\n- Example: sections = SectionBlock([s1, s2]) s1 = SectionItem("intro", "Introduction", [content1])\n- Set isFoldable=false to render sections as flat headers instead of accordion.\n\n### Layout\nTabs(items: TabItem[]) \u2014 Tabbed container\nTabItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | IconButton | Steps | InlineHeader | EntityList | EditableTable | SnippetCardBlock | OverviewCardBlock | ContextCardBlock | CompositeCardBlock | VisualCardBlock | ListBlock | FollowUpBlock | Accordion)[]) \u2014 value is unique id, trigger is tab label, content is array of components\nAccordion(items: AccordionItem[]) \u2014 Collapsible sections\nAccordionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | IconButton | Steps | InlineHeader | EntityList | EditableTable | SnippetCardBlock | OverviewCardBlock | ContextCardBlock | CompositeCardBlock | VisualCardBlock | ListBlock | FollowUpBlock)[]) \u2014 value is unique id, trigger is section title\nSteps(items: StepsItem[]) \u2014 Step-by-step guide\nStepsItem(title: string, details: string) \u2014 title and details text for one step\nCarousel(children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | IconButton | Steps | InlineHeader | EntityList | EditableTable | SnippetCardBlock | OverviewCardBlock | ContextCardBlock | CompositeCardBlock | VisualCardBlock | ListBlock | FollowUpBlock)[][], variant?: "card" | "sunk") \u2014 Horizontal scrollable carousel\n- Use Tabs to present alternative views \u2014 each TabItem has a value id, trigger label, and content array.\n- Carousel takes an array of slides, where each slide is an array of content: carousel = Carousel([[t1, img1], [t2, img2]])\n- IMPORTANT: Every slide in a Carousel must have the same structure \u2014 same component types in the same order.\n- For image carousels use: [[title, image, description, tags], ...] \u2014 every slide must follow this exact pattern.\n- Use real, publicly accessible image URLs (e.g. https://picsum.photos/seed/KEYWORD/800/500). Never hallucinate image URLs.\n\n### Data Display\nTagBlock(tags: string[], size?: "sm" | "md" | "lg") \u2014 tags is an array of strings; optional size sm | md | lg\nTag(text: string, icon?: Icon, size?: "sm" | "md" | "lg", variant?: "neutral" | "info" | "success" | "warning" | "danger") \u2014 Styled tag/badge with optional Icon and variant\nEntityList(rows?: {left: string, right: string, rightVariant?: "text" | "number"}[], size?: "small" | "default", header?: {left: string, right: string, rightVariant?: "text" | "number"}, footer?: {left: string, right: string, rightVariant?: "text" | "number"}) \u2014 Two-column key/value rows (left label, right value). size \'default\' supports optional header and footer rows; rightVariant \'number\' uses tabular numbers.\n- EntityList is a compact two-column list of { left, right } rows (e.g. name / value). size=\'default\' also supports a header and footer row; size=\'small\' does not.\n\n### Cards\nSnippetCardBlock(items: SnippetCardItem[], layout?: "grid", responsive?: boolean, action?: ActionExpression, gap?: number | string) \u2014 A responsive grid of compact label/value cards (2 per row) for showing several short facts side by side; optionally clickable with a shared action.\nSnippetCardItem(id?: string, lhs: IconText | ImageText, rhs?: Text | BoldText) \u2014 One row-style snippet card: a label on the left (IconText or ImageText) and an optional value on the right (Text or BoldText).\nOverviewCardBlock(items: OverviewCardItem[], layout?: "grid" | "carousel", responsive?: boolean, action?: ActionExpression, gap?: number | string) \u2014 A grid or horizontal carousel of compact overview cards, each with a heading (icon/image/text) on top and an inline metric below; optionally clickable with a shared action.\nOverviewCardItem(id?: string, top: IconText | ImageText | Text, bottom?: MetricIndicatorInline) \u2014 One overview card: a heading slot at the top (IconText, ImageText or Text) and an optional MetricIndicatorInline at the bottom.\nContextCardBlock(items: ContextCardItem[], layout?: "grid" | "carousel", responsive?: boolean, action?: ActionExpression, gap?: number | string) \u2014 A grid or carousel of compact tinted context cards (title or tag plus a short bold body); an optional action makes every card clickable.\nContextCardItem(id?: string, title: string | Tag, body?: string, bgColor?: "gray", bgImageSrc?: string, bgImageAlt?: string) \u2014 A single card inside a ContextCardBlock: a title (plain string or Tag), an optional markdown body, and an optional gray tint or background image.\nCompositeCardBlock(items: CompositeCardItem[], layout?: "grid" | "carousel", responsive?: boolean, action?: ActionExpression, gap?: number | string) \u2014 A two-per-row grid or carousel of rich cards, each with an optional header, stacked body content (text, metrics, charts, lists, tags) and a price/button footer; an optional action makes every card clickable.\nCompositeCardItem(id?: string, header?: IconText | ImageText | ImageTextLarge | Text | Image, body?: (Text | BoldText | MetricIndicatorInline | IconText | Image | AreaChart | BarChart | LineChart | ListBlock | TagBlock | EntityList)[], footer?: {price?: BoldText | MetricIndicatorWithStrikethrough, button?: Button}) \u2014 A single card inside a CompositeCardBlock: an optional header (icon/image/text), a stack of body elements (text, metrics, charts, lists, tags), and an optional price/button footer.\nVisualCardBlock(items: VisualCardItem[], layout?: "grid" | "carousel", responsive?: boolean, action?: ActionExpression, gap?: number | string) \u2014 A grid or carousel of photo-first cards: a full-bleed background image with a tag on top and a bold text panel at the bottom; an optional action makes every card clickable.\nVisualCardItem(body: BoldText, id?: string, bgImageSrc?: string, tag?: Tag, bgImageAlt?: string) \u2014 A single photo-first card inside a VisualCardBlock: a BoldText body panel, an optional Tag, and a background image (bgImageSrc must be a real URL; bgImageAlt is its alt text).\nText(variant?: "text" | "number", value: string, subtext?: string, subtextVariant?: "text" | "number" | "metric", size?: "xs" | "sm" | "md" | "lg") \u2014 Plain text line with optional subtext. variant \'number\' uses tabular number styling; subtextVariant \'metric\' colors a leading +/- subtext green/red.\nBoldText(variant?: "text" | "number", value: string, subtext?: string, subtextVariant?: "text" | "number" | "metric", size?: "xs" | "sm" | "md" | "lg") \u2014 Emphasized (bold) text line with optional subtext. variant \'number\' uses tabular number styling; subtextVariant \'metric\' colors a leading +/- subtext green/red.\nIconText(icon: Icon, iconVariant?: "neutral" | "info" | "success" | "warning" | "danger" | "inverted" | "filled" | "soft", iconSize?: "xs" | "s" | "m" | "l" | "xl" | "sm" | "md" | "lg", title: string, subtitle?: string, bold?: boolean, layout?: "horizontal" | "vertical") \u2014 An icon badge with a title and optional subtitle, laid out horizontally or vertically. iconVariant sets the badge color.\nImageText(src: string, alt?: string, title: string, subtitle?: string, bold?: boolean, layout?: "horizontal" | "vertical", imageSize?: number) \u2014 A small square image (thumbnail/avatar) with a title and optional subtitle. src must be a real image URL.\nImageTextLarge(src: string, alt?: string, title: string, subtitle?: string, bold?: boolean) \u2014 A full-width banner image above a bold title and optional subtitle. src must be a real image URL.\nMetricIndicatorInline(value: string, subtext?: string, trend?: {direction: "up" | "down", value: number}) \u2014 Headline metric value with an optional +/- percentage trend and subtext, all on one line.\nMetricIndicatorWithStrikethrough(value: string, subtext?: string, previousValue?: string, trend?: {direction: "up" | "down", value: number}) \u2014 Headline metric value with an optional struck-through previousValue, a +/- percentage trend, and subtext below.\n- Card blocks lay out 2+ items in a responsive grid (or carousel where supported). Every item in a block must have the same structure.\n- SnippetCardItem: small card with lhs (IconText | ImageText) and optional rhs (Text | BoldText) \u2014 good for key/value facts.\n- OverviewCardItem: small card with top (IconText | ImageText | Text) and optional bottom MetricIndicatorInline \u2014 good for KPIs.\n- ContextCardItem: medium card with a title (string or Tag), body text and optional background image \u2014 good for summaries.\n- CompositeCardItem: rich card with header, body array (Text, BoldText, MetricIndicatorInline, IconText, Image, charts, ListBlock, TagBlock, EntityList) and footer (price + Button) \u2014 good for products/offers.\n- VisualCardItem: image-first card with a BoldText body and optional Tag.\n- Text / BoldText / IconText / ImageText / ImageTextLarge / MetricIndicator* are the inline building blocks used INSIDE card items; do not place them directly in the root Card.\n\n### Other\nCard(children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | IconButton | Steps | InlineHeader | EntityList | EditableTable | SnippetCardBlock | OverviewCardBlock | ContextCardBlock | CompositeCardBlock | VisualCardBlock | ListBlock | FollowUpBlock | SectionBlock | Tabs | Carousel)[], sources?: {url?: string, title: string, sourceName: string}[]) \u2014 Vertical container for all content in a chat response. Children stack top to bottom automatically. Optional sources ([{ title, sourceName, url }]) render as a Sources strip at the bottom and back inline [n] citations in TextContent.\n\n## Action \u2014 Button Behavior\n\nAn action wires a button click to operations. Pass one @-prefixed step bare, e.g. Button("Ask", @ToAssistant("Tell me more")). Put several steps in Action([...]), e.g. Button("Read", Action([@OpenUrl("https://example.com"), @ToAssistant("Summarize this page")])). Steps execute in order.\nButtons without an action automatically send their label to the assistant (equivalent to @ToAssistant(label)).\n\nAvailable steps:\n- @ToAssistant(message: string, context?: any) \u2014 Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this"). The optional context is any value (object, array, string, number) passed to the assistant as hidden data, e.g. @ToAssistant("Show details", {orderId: 42})\n- @OpenUrl(url: string) \u2014 Navigate to a URL\n\nExample \u2014 simple nav:\n```\nviewBtn = Button("View", @OpenUrl("https://example.com"))\n```\n\n- An action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work\n\n## Hoisting & Streaming (CRITICAL)\n\nopenui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.\n\nDuring streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal \u2014 structure first, then data fills in.\n\n**Recommended statement order for optimal streaming:**\n1. `root = Card(...)` \u2014 UI shell appears immediately\n2. Component definitions \u2014 fill in as they stream\n3. Data values \u2014 leaf content last\n\nAlways write the root = Card(...) statement first so the UI shell appears immediately, even before child data has streamed in.\n\n## Examples\n\nExample 1 \u2014 Informational response (the shape for "tell me about X" / explainer asks):\n\nroot = Card([header, intro, highlights, statsHeader, statsCards, sectionsBlock, actionBtns], [src1, src2])\nheader = CardHeader("Paris", "The City of Light \xB7 France\'s Eternal Capital")\nintro = TextContent("Paris is one of the world\'s most visited cities \u2014 a timeless blend of iconic landmarks, world-class cuisine, art, and romance [1]. In 2026 the city is buzzing with new energy: the **Grand Palais** has reopened after a \u20AC466M renovation, and you can now **swim in the Seine** for the first time in over a century [2].")\nhighlights = ContextCardBlock([h1, h2, h3], "grid", true, @ToAssistant("Tell me more about this aspect of Paris"))\nh1 = ContextCardItem("art-museums", "Art & Museums", "143 museums including the Louvre & newly reopened Grand Palais.", "gray", "https://cdn.britannica.com/03/121003-050-2544BD4E/Interior-Louvre-Museum-Paris.jpg")\nh2 = ContextCardItem("gastronomy", "Gastronomy", "9,000+ restaurants, 130+ Michelin stars, and the world\'s best baguettes.", "gray")\nh3 = ContextCardItem("fashion-capital", "Fashion Capital", "Home to Chanel, Dior, Louis Vuitton & Herm\xE8s \u2014 the global luxury hub.", "gray", "https://thumbs.dreamstime.com/z/dior-storefront-facade-chanel-store-lvmh-s-french-designer-modehouse-christian-adjacent-to-luxury-fashion-beauty-brand-327161553.jpg")\nstatsHeader = InlineHeader("Paris by the Numbers", "Key visitor statistics")\nstatsCards = OverviewCardBlock([ov1, ov2, ov3], "grid", true)\nov1 = OverviewCardItem("annual-visitors", ov1top, ov1metric)\nov1top = IconText(ov1icon, "neutral", "m", "Annual Visitors", "2024 arrivals", false, "vertical")\nov1icon = Icon("users", "people")\nov1metric = MetricIndicatorInline("48.7M", "tourists", { direction: "up", value: 2.5 })\nov2 = OverviewCardItem("museums-monuments", ov2top, ov2metric)\nov2top = IconText(ov2icon, "neutral", "m", "Museums & Monuments", "Cultural sites", false, "vertical")\nov2icon = Icon("landmark", "buildings")\nov2metric = MetricIndicatorInline("2,370+", "across the city")\nov3 = OverviewCardItem("tourism-revenue", ov3top, ov3metric)\nov3top = IconText(ov3icon, "neutral", "m", "Tourism Revenue", "2024 estimate", false, "vertical")\nov3icon = Icon("circle-dollar-sign", "finance")\nov3metric = MetricIndicatorInline("\u20AC23.4B", "generated")\nsectionsBlock = SectionBlock([secLandmarks, secFood, secWhen], false)\nsecLandmarks = SectionItem("landmarks", "Iconic Landmarks", [landmarksCarousel])\nlandmarksCarousel = VisualCardBlock([lm1, lm2, lm3, lm4], "carousel", true, @ToAssistant("Tell me more about this Paris landmark"))\nlm1 = VisualCardItem(lm1body, "eiffel-tower", "https://c8.alamy.com/comp/RYEB13/aerial-view-of-the-eiffel-tower-with-the-park-champ-de-mars-and-the-river-seine-paris-france-RYEB13.jpg", lm1tag, "Aerial view of the Eiffel Tower")\nlm1body = BoldText("text", "Eiffel Tower", "Open daily 9am\u2013midnight")\nlm1tag = Tag("Must-See", lm1tagIcon, "sm", "info")\nlm1tagIcon = Icon("star", "shapes")\nlm2 = VisualCardItem(lm2body, "the-louvre", "https://images.fineartamerica.com/images/artworkimages/mediumlarge/3/1-exterior-of-musee-du-louvre-museum-paris-france-bernard-jaubert.jpg", lm2tag, "Exterior of the Louvre museum")\nlm2body = BoldText("text", "The Louvre", "World\'s largest art museum")\nlm2tag = Tag("8.9M visits/yr", lm2tagIcon, "sm", "success")\nlm2tagIcon = Icon("trending-up", "charts")\nlm3 = VisualCardItem(lm3body, "notre-dame", "https://cdn.britannica.com/29/255529-050-63A22A3C/notre-dame-de-paris-cathedral-paris-france.jpg", lm3tag, "Notre-Dame cathedral facade")\nlm3body = BoldText("text", "Notre-Dame", "Fully restored cathedral")\nlm3tag = Tag("Reopened 2024", lm3tagIcon, "sm", "warning")\nlm3tagIcon = Icon("hammer", "tools")\nlm4 = VisualCardItem(lm4body, "versailles", "https://cdn.britannica.com/76/130076-050-31128A3D/Latona-Fountain-Balthazard-Marsy-Gaspard-Andre-Le.jpg", lm4tag, "Latona Fountain at Versailles")\nlm4body = BoldText("text", "Palace of Versailles", "Royal gardens & grand halls")\nlm4tag = Tag("Day Trip", lm4tagIcon, "sm", "neutral")\nlm4tagIcon = Icon("train-front", "travel")\nsecFood = SectionItem("food", "Food & Drink", [foodCards])\nfoodCards = ContextCardBlock([f1, f2, f3], "grid", true, @ToAssistant("Tell me more about eating and drinking in Paris"))\nf1 = ContextCardItem("bistros", "Bistros", "Classic French fare \u2014 try Les Arlots for confit beef cheeks.", "gray", "https://everydayparisian.com/wp-content/uploads/2023/01/IMG_0221-768x1024.webp")\nf2 = ContextCardItem("fine-dining", "Fine Dining", "Septime leads a new wave of creative Michelin-starred cuisine.", "gray", "https://production-data.worldofmouth.app/images/72b2e6db-97ea-49c4-aa5d-3b7c8121c812.jpg")\nf3 = ContextCardItem("bakeries", "Bakeries", "Shinya Pain for sourdough. Grand Prix-winning baguettes citywide.", "gray", "https://www.davidlebovitz.com/wp-content/uploads/2018/09/Le-petit-grain-paris-bakery-boulangerie-patisserie-pastry-shop-8-640x895.jpg")\nsecWhen = SectionItem("when", "Best Time to Visit", [whenTabs])\nwhenTabs = Tabs([tabSpring, tabSummer])\ntabSpring = TabItem("spring", "Spring", [springList])\nspringList = ListBlock([sp1, sp2, sp3], "number")\nsp1 = ListItem("Cherry blossoms at Parc de Sceaux", "March \u2013 May", null, null, @ToAssistant("Tell me about cherry blossom season in Paris"))\nsp2 = ListItem("Picnics along the Seine & in city parks", "Warm, lively atmosphere", null, null, @ToAssistant("Where are the best picnic spots in Paris?"))\nsp3 = ListItem("Fewer crowds than summer", "Ideal for sightseeing", null, null, @ToAssistant("How busy is Paris in spring?"))\ntabSummer = TabItem("summer", "Summer", [summerList])\nsummerList = ListBlock([su1, su2, su3], "number")\nsu1 = ListItem("Swim in the Seine \u2014 open July & August 2026", "First time in 102 years", null, null, @ToAssistant("Tell me about swimming in the Seine"))\nsu2 = ListItem("Open-air cinema at Parc de la Villette", "Free films under the stars", null, null, @ToAssistant("Tell me about the open-air cinema at Parc de la Villette"))\nsu3 = ListItem("Bastille Day celebrations on July 14", "Fireworks at the Eiffel Tower", null, null, @ToAssistant("What happens in Paris on Bastille Day?"))\nactionBtns = Buttons([btn1, btn2, btn3], "row")\nbtn1 = Button("Plan a Trip to Paris", @ToAssistant("Help me plan a trip to Paris"), "primary")\nbtn2 = Button("Best Hotels in Paris", @ToAssistant("Show me the best hotels in Paris"), "secondary")\nbtn3 = Button("Build a Paris Itinerary", @ToAssistant("Build a 5-day Paris itinerary for me"), "secondary")\nsrc1 = { title: "Paris Travel Guide 2025", sourceName: "Travel and Tour World", url: "https://www.travelandtourworld.com/news/article/from-iconic-landmarks-to-hidden-gems-the-ultimate-paris-travel-guide-for-2025-you-need-to-read-now/" }\nsrc2 = { title: "Best Things to Do in Paris 2026", sourceName: "Time Out Paris", url: "http://www.timeout.fr/paris/en/for-tourists" }\n\nExample 2 \u2014 Data and analytics response (quantitative asks lead with KPIs and charts):\n\nroot = Card([pageHeader, kpiBlock, sections, deepDiveHeader, compositeCards, actionButtons])\npageHeader = CardHeader("Analytics Dashboard", "April 2026 \xB7 Business Performance Overview")\nkpiBlock = SnippetCardBlock([kpi1, kpi2, kpi3, kpi4], "grid", true)\nkpi1 = SnippetCardItem("total-revenue", kpi1lhs, kpi1rhs)\nkpi1lhs = IconText(kpi1icon, "neutral", "m", "Total Revenue", "Month to date", false, "horizontal")\nkpi1icon = Icon("circle-dollar-sign", "finance")\nkpi1rhs = BoldText("number", "$284,500", "+12.4%", "metric")\nkpi2 = SnippetCardItem("active-users", kpi2lhs, kpi2rhs)\nkpi2lhs = IconText(kpi2icon, "neutral", "m", "Active Users", "Monthly active users", false, "horizontal")\nkpi2icon = Icon("users", "people")\nkpi2rhs = BoldText("number", "47,320", "+6.8%", "metric")\nkpi3 = SnippetCardItem("conversion-rate", kpi3lhs, kpi3rhs)\nkpi3lhs = IconText(kpi3icon, "neutral", "m", "Conversion Rate", "Avg. this month", false, "horizontal")\nkpi3icon = Icon("trending-up", "charts")\nkpi3rhs = BoldText("number", "5.7%", "+0.9%", "metric")\nkpi4 = SnippetCardItem("churn-rate", kpi4lhs, kpi4rhs)\nkpi4lhs = IconText(kpi4icon, "neutral", "m", "Churn Rate", "Monthly customer churn", false, "horizontal")\nkpi4icon = Icon("user-minus", "people")\nkpi4rhs = BoldText("number", "2.1%", "-0.4%", "metric")\nsections = SectionBlock([secUsers, secChannels], false)\nsecUsers = SectionItem("users", "User Activity", [userTabs])\nuserTabs = Tabs([tabGrowth, tabRetention])\ntabGrowth = TabItem("growth", "User Growth", [growthChart])\ngrowthChart = LineChart(months, [dauSeries, mauSeries], "natural", "Month", "Users (k)")\nmonths = ["May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr"]\ndauSeries = Series("DAU", [5.1, 5.4, 5.8, 6.2, 6.7, 7.1, 7.6, 8.0, 8.4, 8.9, 9.3, 9.8])\nmauSeries = Series("MAU", [28.4, 30.1, 31.8, 33.5, 35.2, 37.1, 38.8, 40.4, 42.1, 43.9, 45.6, 47.3])\ntabRetention = TabItem("retention", "Cohort Retention", [retentionChart])\nretentionChart = LineChart(cohortMonths, [cohortJan, cohortFeb, cohortMar], "natural", "Month Since Signup", "Retention (%)")\ncohortMonths = ["Month 0", "Month 1", "Month 2", "Month 3", "Month 4", "Month 5", "Month 6"]\ncohortJan = Series("Jan Cohort", [100, 80, 70, 62, 56, 51, 47])\ncohortFeb = Series("Feb Cohort", [100, 83, 73, 65, 59, 54, 50])\ncohortMar = Series("Mar Cohort", [100, 86, 76, 68, 62, 0, 0])\nsecChannels = SectionItem("channels", "Acquisition Channels", [channelTabs])\nchannelTabs = Tabs([tabChannelBar, tabChannelTable])\ntabChannelBar = TabItem("channel-bar", "Revenue by Channel", [channelBarChart])\nchannelBarChart = HorizontalBarChart(channels, [channelSeries], "grouped", "Revenue ($k)", "Channel")\nchannels = ["Organic Search", "Paid Ads", "Referral Program", "Partner Network", "Direct / Brand", "Email Campaigns"]\nchannelSeries = Series("Revenue ($k)", [82.4, 68.1, 54.6, 38.2, 26.8, 14.4])\ntabChannelTable = TabItem("channel-table", "Full Breakdown", [channelTable])\nchannelTable = Table([colChannel, colLeads, colConv, colCac, colRevenue, colStatus])\ncolChannel = Col("Channel", channels, "string")\ncolLeads = Col("Leads", [4210, 3180, 2050, 1120, 1290, 820], "number")\ncolConv = Col("Conv. Rate", ["6.4%", "5.1%", "9.4%", "11.8%", "5.8%", "8.1%"], "string")\ncolCac = Col("CAC ($)", [188, 395, 132, 109, 218, 154], "number")\ncolRevenue = Col("Revenue ($k)", [82.4, 68.1, 54.6, 38.2, 26.8, 14.4], "number")\ncolStatus = Col("Status", ["Scaling", "Optimizing", "Scaling", "Growing", "Stable", "Stable"], "string")\ndeepDiveHeader = InlineHeader("Support Health & Marketing ROI", "Click a card to explore deeper insights")\ncompositeCards = CompositeCardBlock([cardSupport, cardMarketing], "grid", true, @ToAssistant("Explore this deep-dive area in more detail"))\ncardSupport = CompositeCardItem("support-health", supportHeader, [supportMetric, supportChart, supportList])\nsupportHeader = IconText(supportIcon, "neutral", "m", "Support Health", "Ticket volume & resolution trends", false, "horizontal")\nsupportIcon = Icon("headphones", "communication")\nsupportMetric = MetricIndicatorInline("94.2% CSAT", "Customer Satisfaction Score", { direction: "up", value: 2.1 })\nsupportChart = BarChart(["Jan", "Feb", "Mar", "Apr"], [openSeries, resolvedSeries], "grouped", "Month", "Tickets")\nopenSeries = Series("Opened", [341, 327, 308, 289])\nresolvedSeries = Series("Resolved", [319, 318, 301, 283])\nsupportList = EntityList([sup1, sup2, sup3], "small")\nsup1 = { left: "Avg. Resolution Time", right: "4h 12m", rightVariant: "text" }\nsup2 = { left: "First Contact Resolution", right: "78.4%", rightVariant: "number" }\nsup3 = { left: "Escalation Rate", right: "6.2%", rightVariant: "number" }\ncardMarketing = CompositeCardItem("marketing-roi", marketingHeader, [marketingMetric, marketingChart, marketingList])\nmarketingHeader = IconText(marketingIcon, "neutral", "m", "Marketing ROI", "Spend vs. pipeline generated", false, "horizontal")\nmarketingIcon = Icon("megaphone", "communication")\nmarketingMetric = MetricIndicatorInline("3.8x Blended ROI", "Return on Ad Spend", { direction: "up", value: 0.4 })\nmarketingChart = AreaChart(["Jan", "Feb", "Mar", "Apr"], [spendSeries, pipelineSeries], "natural", "Month", "Value ($k)")\nspendSeries = Series("Ad Spend", [44.0, 46.8, 49.2, 51.6])\npipelineSeries = Series("Pipeline Generated", [158.2, 171.5, 184.9, 196.1])\nmarketingList = EntityList([mkt1, mkt2, mkt3], "small")\nmkt1 = { left: "Total Ad Spend (Apr)", right: "$51,600", rightVariant: "number" }\nmkt2 = { left: "Cost per Lead", right: "$48.20", rightVariant: "number" }\nmkt3 = { left: "Top Channel", right: "Organic Search", rightVariant: "text" }\nactionButtons = Buttons([btnChannels, btnForecast], "row")\nbtnChannels = Button("Break Down by Channel", @ToAssistant("Break down this month\'s revenue by acquisition channel"), "primary")\nbtnForecast = Button("Forecast Next Quarter", @ToAssistant("Forecast revenue and active users for next quarter"), "secondary")\n\nExample 3 \u2014 Form response (help-me-choose/plan asks: inspiration cards FIRST, then a compact form). The inspiration-card images below came from an image tool call \u2014 include such cards ONLY when you have real URLs; with no real URLs, start directly with the form:\n\nroot = Card([header, intro, inspoCards, form])\nheader = CardHeader("Plan Your Trip", "A few ideas to spark inspiration \u2014 then tell me your preferences")\nintro = TextContent("Tap a style to jump straight in, or fill the quick form below for a tailored plan.")\ninspoCards = VisualCardBlock([insp1, insp2], "grid", true, @ToAssistant("Plan me a trip in this style with destinations, itinerary, and costs"))\ninsp1 = VisualCardItem(insp1body, "inspo-beach", "https://www.travelandleisure.com/thmb/cuAB7XMQ6s_Gji-no956KNopT7M=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/TAL-maldives-TROPVACAY0325-1b5047d5931d4850b47d082966f9f563.jpg", insp1tag, "Maldives overwater villas")\ninsp1body = BoldText("text", "Tropical Beach Escape", "Overwater villas & snorkeling")\ninsp1tag = Tag("Relaxation", insp1icon, "sm", "info")\ninsp1icon = Icon("umbrella", "travel")\ninsp2 = VisualCardItem(insp2body, "inspo-mountain", "https://www.salkantaytrekmachu.com/img/adventure-travel-peru-032.jpg", insp2tag, "Trekking in the Peruvian Andes")\ninsp2body = BoldText("text", "Mountain Adventure", "Trekking & epic views")\ninsp2tag = Tag("Active", insp2icon, "sm", "warning")\ninsp2icon = Icon("mountain", "nature")\nform = Form("trip-planner", formButtons, [fcDestination, fcDates, fcTravellers, fcTripType, fcBudget, fcStay, fcNotes])\nformButtons = Buttons([btnSubmit, btnSkip], "row")\nbtnSubmit = Button("Plan My Trip", @ToAssistant("Help me plan a trip based on my form submission"), "primary")\nbtnSkip = Button("Just Surprise Me", @ToAssistant("Skip the form and surprise me with a destination and itinerary"), "secondary")\nfcDestination = FormControl("Destination", destinationInput, "Leave blank if you\'d like suggestions")\ndestinationInput = Input("destination", "e.g. Tokyo, Japan \u2014 or leave blank", "text")\nfcDates = FormControl("Travel Dates", datesPicker, "Select your start and end dates")\ndatesPicker = DatePicker("travel-dates", "range", { required: true })\nfcTravellers = FormControl("Number of Travellers", travellersSelect, "How many people are travelling?")\ntravellersSelect = Select("num-travellers", [tr1, tr2, tr3, tr4], "Select number of travellers", { required: true })\ntr1 = SelectItem("1", "1 \u2014 Solo")\ntr2 = SelectItem("2", "2 \u2014 Couple")\ntr3 = SelectItem("3-4", "3\u20134 People")\ntr4 = SelectItem("5+", "5+ People")\nfcTripType = FormControl("Trip Type", tripTypeCards, "What kind of trip are you planning?")\ntripTypeCards = OptionCards("trip-type", "single", [oc1, oc2, oc3, oc4], { required: true })\noc1 = OptionCard("adventure", "Adventure", "Hiking, trekking & outdoor activities", oc1icon)\noc1icon = Icon("mountain", "nature")\noc2 = OptionCard("beach", "Beach & Relaxation", "Sun, sand & leisure", oc2icon)\noc2icon = Icon("waves", "nature")\noc3 = OptionCard("cultural", "Cultural & Historical", "Museums, heritage & local experiences", oc3icon)\noc3icon = Icon("landmark", "buildings")\noc4 = OptionCard("city", "City Break", "Urban exploration & nightlife", oc4icon)\noc4icon = Icon("building-2", "buildings")\nfcBudget = FormControl("Estimated Budget (per person)", budgetSlider, "Drag to set your per-person budget in USD")\nbudgetSlider = Slider("budget", "discrete", 500, 10000, 500, [2500], "Budget (USD)")\nfcStay = FormControl("Accommodation Preference", stayChips, "Select all that apply")\nstayChips = Chips("accommodation", "multiple", [ch1, ch2, ch3, ch4], {}, ["hotel"])\nch1 = ChipItem("hotel", "Hotel", ch1icon)\nch1icon = Icon("building", "buildings")\nch2 = ChipItem("resort", "Resort", ch2icon)\nch2icon = Icon("umbrella", "travel")\nch3 = ChipItem("airbnb", "Vacation Rental", ch3icon)\nch3icon = Icon("home", "home")\nch4 = ChipItem("camping", "Camping / Glamping", ch4icon)\nch4icon = Icon("tent", "nature")\nfcNotes = FormControl("Special Requests or Notes", notesArea, "Any dietary needs, accessibility requirements, or specific interests?")\nnotesArea = TextArea("special-requests", "e.g. vegetarian meals, wheelchair access, honeymoon surprise...", 4)\n\nExample 4 \u2014 Recommendations with images and links (same pattern for products, movies, restaurants, articles):\n\nroot = Card([header, intro, posters, linksHeader, trackCards], [src1, src2])\nheader = CardHeader("Retro-Energetic Indian Tracks", "New Hindi releases with 80s/90s dance DNA")\nintro = TextContent("These recent tracks channel retro synths and 90s party percussion [1][2]. Tap a poster to explore a track, or use its button to watch the exact official video.")\nposters = VisualCardBlock([v1, v2], "grid", true, @ToAssistant("Tell me more about this track and its retro influences"))\nv1 = VisualCardItem(v1body, "tamma", "https://i.ytimg.com/vi/PQHeOb0Q9oo/hq720.jpg", v1tag, "Tamma Tamma video poster")\nv1body = BoldText("text", "Tamma Tamma", "Dhurandhar \xB7 Ranveer Singh")\nv1tag = Tag("80s Electro-Disco", v1icon, "sm", "success")\nv1icon = Icon("disc-3", "multimedia")\nv2 = VisualCardItem(v2body, "sajan", "https://i.ytimg.com/vi/mLz-qBiRnl8/hq720.jpg", v2tag, "Sajan Re video poster")\nv2body = BoldText("text", "Sajan Re", "Nora Fatehi \xB7 Badshah")\nv2tag = Tag("Synthwave Electro", v2icon, "sm", "info")\nv2icon = Icon("music", "multimedia")\nlinksHeader = InlineHeader("Watch the Exact Videos", "Each button opens that track\'s official video")\ntrackCards = CompositeCardBlock([t1, t2], "grid", true)\nt1 = CompositeCardItem("t-tamma", t1h, [t1body, t1tags], { button: t1btn })\nt1h = IconText(t1icon, "neutral", "m", "Tamma Tamma", "Bappi Lahiri classic, electro-funk rework", true, "horizontal")\nt1icon = Icon("disc-3", "multimedia")\nt1body = Text("text", "Heavy analog synths and brass over a fast disco groove.", "Retro Electro-Disco")\nt1tags = TagBlock(["2026 Film Hit", "Peak Party"])\nt1btn = Button("Watch on YouTube", @OpenUrl("https://www.youtube.com/watch?v=PQHeOb0Q9oo"), "primary")\nt2 = CompositeCardItem("t-sajan", t2h, [t2body, t2tags], { button: t2btn })\nt2h = IconText(t2icon, "neutral", "m", "Sajan Re", "Nora Fatehi \xB7 Badshah \xB7 Sanjoy", true, "horizontal")\nt2icon = Icon("music", "multimedia")\nt2body = Text("text", "Synthwave melody hooks over a modern club beat.", "Retro-Fusion Electro")\nt2tags = TagBlock(["Club Anthem", "Nora x Badshah"])\nt2btn = Button("Watch on YouTube", @OpenUrl("https://www.youtube.com/watch?v=COUSCnFazzc"), "primary")\nsrc1 = { title: "Tamma Tamma (Full Video) - Dhurandhar", sourceName: "YouTube (T-Series)", url: "https://www.youtube.com/watch?v=PQHeOb0Q9oo" }\nsrc2 = { title: "Sajan Re (Official Music Video)", sourceName: "YouTube (T-Series)", url: "https://www.youtube.com/watch?v=COUSCnFazzc" }\n\nExample 5 \u2014 Table with follow-ups:\n\nroot = Card([title, tbl, followUps])\ntitle = TextContent("Top Languages", "large-heavy")\ntbl = Table([Col("Language", langs), Col("Users (M)", users), Col("Year", years)])\nlangs = ["Python", "JavaScript", "Java"]\nusers = [15.7, 14.2, 12.1]\nyears = [1991, 1995, 1995]\nfollowUps = FollowUpBlock([fu1, fu2])\nfu1 = FollowUpItem("Tell me more about Python")\nfu2 = FollowUpItem("Show me a JavaScript comparison")\n\n## Important Rules\n- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)\n\n## Final Verification\nBefore finishing, walk your output and verify:\n1. root = Card(...) is the FIRST line (for optimal streaming).\n2. Every referenced name is defined. Every defined name (other than root) is reachable from root.\n\n- When asked about data, generate realistic/plausible data\n- Every response is a single Card(children) \u2014 children stack vertically automatically. No layout params are needed on Card.\n- Card is the only layout container. Do NOT use Stack. Use Tabs to switch between sections, Carousel for horizontal scroll.\n- Use FollowUpBlock at the END of a Card to suggest what the user can do or ask next.\n- Use ListBlock when presenting a set of options or steps; give each ListItem an action (5th argument) to make it clickable \u2014 without one the item is plain text.\n- Use SectionBlock to group long responses into collapsible sections \u2014 good for reports, FAQs, and structured content.\n- Use SectionItem inside SectionBlock: each item needs a unique value id, a trigger (header label), and a content array.\n- Carousel takes an array of slides, where each slide is an array of content: carousel = Carousel([[t1, img1], [t2, img2]])\n- IMPORTANT: Every slide in a Carousel must use the same component structure in the same order \u2014 e.g. all slides: [title, image, description, tags].\n- For forms, define one FormControl reference per field so controls can stream progressively.\n- For forms, always provide the second Form argument with Buttons(...) actions: Form(name, buttons, fields).\n- Never nest Form inside Form.\n- CardHeader is the page-level heading \u2014 place it as the first child of Card; InlineHeader is a lighter subsection label for a block inside the response, and is redundant when the following component already has a heading.\n- Never use Callout or TextCallout to justify why you did what you did or for any meta-information.\n- Every image slot (Image, ImageBlock, ImageGallery, VisualCardItem/ContextCardItem bgImageSrc, ImageText, ImageTextLarge, ListItem image) requires a REAL URL from a tool result, the conversation, or the user \u2014 NEVER invent, guess, or template a URL.\n- If no image URL is in context, compose without image components \u2014 icons, gray ContextCardItems, and charts still make rich layouts.\n- Argument-order trap: Image takes alt FIRST, while ImageBlock, ImageText, and ImageTextLarge take src FIRST \u2014 alt text in a src slot ships a broken image.\n- Card blocks (SnippetCardBlock, OverviewCardBlock, ContextCardBlock, CompositeCardBlock, VisualCardBlock) need at least 2 items, all with the same structure; use layout "grid" for primary side-by-side comparison and "carousel" for secondary browsing.\n- The card-block action is BLOCK-LEVEL: one action shared by every card, with the clicked card\'s details attached automatically \u2014 keep the @ToAssistant message generic (e.g. "Tell me more about this destination"), and never use a block-level @OpenUrl since it would send every card to the same URL.\n- Card items have NO per-item action: to give each item its own external link, use CompositeCardItem with footer { button: Button(label, @OpenUrl(url)) } \u2014 never claim a card opens a link it cannot.\n- Text, BoldText, IconText, ImageText, ImageTextLarge and MetricIndicator* are inline building blocks used INSIDE card items \u2014 do not place them directly in the root Card.\n- EntityList size "small" is reserved for CompositeCardItem body content (no header/footer); use size "default" elsewhere.\n- Tag variant must be semantically correct (success=positive, danger=negative, warning=cautionary, info=informational, neutral=label); Tag takes an optional Icon second, so use Tag(text, icon, size, variant) when a variant is needed.\n- TagBlock takes plain strings \u2014 keep it to at most 3 tags.\n- ListBlock variant "number" is for ordered sequences and rankings, "image" for products/profiles with a real image; Steps is for ordered sequential processes only.\n- Use SectionBlock to divide a long response into independent, equally prominent topics; use Tabs when the items are alternative views of the same thing; set isFoldable=false unless a section has 4+ distinct blocks; never make SectionBlock the first Card child.\n- Accordion is for supplementary or FAQ content only \u2014 never primary information, 3-5 items max, and always the last component in its section or card.\n- Charts: LineChart/AreaChart variant "natural" for smooth trends and "linear" for precise point-to-point data; BarChart "grouped" for side-by-side comparison and "stacked" for part-to-whole; prefer HorizontalBarChart when category labels are long or numerous.\n- For large chart values, scale the data and put the unit in the axis label (e.g. yLabel "Revenue ($k)") instead of passing raw thousands or millions.\n- Quantitative asks get a chart (plus KPI cards where useful) in the FIRST response \u2014 do not answer numbers with prose or a table alone.\n- Table is column-oriented: each Col holds its own data array of plain strings or numbers (never components), and every column\'s array must have the same length.\n- Use EditableTable ONLY when the user or app explicitly asks for an editable table; default to Table for read-only data.\n- Every Form MUST have EXACTLY ONE submit Button with variant "primary" \u2014 that button validates the form; other buttons (secondary/tertiary escape hatches like "Just Surprise Me") skip validation, and there is never a reset button.\n- Prefer structured inputs (Select, Chips, OptionCards, DatePicker, Slider) over free-text Input, give every FormControl a clear label (and a hint where it prevents mistakes), and keep each field name unique within the response.\n- Validation rules ({ required: true, email: true, minLength: 8, ... }) are enforced with inline errors \u2014 use them for genuinely essential fields, but never require a free-text field where leaving it blank is meaningful.\n- Form inputs work ONLY inside a FormControl within a Form; for tappable suggestion choices OUTSIDE a form, use Buttons whose Button actions are @ToAssistant, never a bare OptionCards or Chips.\n- Only add Buttons for real actions: form submit, @OpenUrl with a URL from a tool or the user (never fabricated), or a @ToAssistant follow-up. Never add a button for an app action (open, download, export, edit) you cannot perform.\n- Every Button label must accurately describe what clicking it does; use "primary" for the main action and "secondary"/"tertiary" only for lower-emphasis supporting actions.\n- Icon: always include the category argument \u2014 it enables fallback matching when the exact lucide name is unavailable.\n- Pass sources on Card ONLY when the answer relies on real references you actually have, and cite them inline in TextContent as [1], [2] (1-based index into sources).';
101132
+ }
101133
+ });
101134
+
101135
+ // src/lib/openui/prompt.ts
101136
+ var OPENUI_PROMPT;
101137
+ var init_prompt = __esm({
101138
+ "src/lib/openui/prompt.ts"() {
101139
+ "use strict";
101140
+ init_library_prompt_generated();
101141
+ OPENUI_PROMPT = `# Generative UI Capability
101142
+
101143
+ You can answer with native, interactive UI: charts, tables, forms, sliders, cards and follow-up buttons.
101144
+ Put it in a block like this, and keep the rest of your reply in normal markdown:
101145
+
101146
+ <visualization type="openui" title="Short title">
101147
+ root = Card([header, chart])
101148
+ header = CardHeader("Title", "Subtitle")
101149
+ chart = ...
101150
+ </visualization>
101151
+
101152
+ ## When to use
101153
+
101154
+ Use a block when the user asks to visualize, chart, compare, calculate or pick between options, or when the answer is clearly easier to grasp as UI (rankings, breakdowns, side-by-side comparisons, adjustable estimates). Otherwise reply in plain markdown.
101155
+
101156
+ ## Rules
101157
+
101158
+ - ALWAYS use \`type="openui"\`. HTML visualizations (\`type="html"\`, Chart.js, D3, Plotly, raw SVG in an iframe) are NOT available in this session. Where other instructions mention emitting a \`<visualization>\` block or rendering in a sandboxed iframe, use an OpenUI block instead.
101159
+ - The body is OpenUI Lang only: no markdown fences, no HTML, no scripts.
101160
+ - The block MUST be the first thing in your reply. No preamble; a short markdown note after it is fine.
101161
+ - Emit the block directly. Do NOT call \`execute_code\` or ask the \`image-expert\` to draw charts or tables you can express here. Tools are for real computation over uploaded data, or photorealistic images.
101162
+ - Use real or clearly labelled illustrative data; never present invented numbers as facts.
101163
+ - The UI cannot compute values in the page. For calculators and estimates, show the result for sensible defaults, plus a form whose inputs (sliders, fields) have defaults and a submit button with \`@ToAssistant("Recalculate")\`. The user's values come back to you as their next message; fields they did not change are left out and keep their defaults. Answer with a new block showing the recalculated result. Never answer with an HTML page or a code block to save.
101164
+
101165
+ The OpenUI Lang reference follows. Where it says your ENTIRE response must be openui-lang, that applies ONLY to the inside of the \`<visualization type="openui">\` block.
101166
+
101167
+ ${OPENUI_LIBRARY_PROMPT}`;
101168
+ }
101169
+ });
101170
+
101126
101171
  // src/components/chat/data-staging-prompt.ts
101127
101172
  var DATA_STAGING_PROMPT, DATA_BRIDGE_DAEMON_PROMPT;
101128
101173
  var init_data_staging_prompt = __esm({
@@ -102828,11 +102873,11 @@ var init_beta_features = __esm({
102828
102873
  name: "Research mode",
102829
102874
  description: "Run structured, sourced research with specialist workers and an HTML report."
102830
102875
  },
102831
- "auto-model": {
102832
- key: "auto-model",
102833
- name: "Auto model",
102834
- description: "Use Jev to choose a curated model for each text request.",
102835
- failureMessage: "Could not save Auto model. Try again."
102876
+ "generative-ui": {
102877
+ key: "generative-ui",
102878
+ name: "Generative UI",
102879
+ description: "Answer with native charts, tables, forms and cards instead of HTML visualizations.",
102880
+ failureMessage: "Could not save Generative UI. Try again."
102836
102881
  },
102837
102882
  "browser-use": {
102838
102883
  key: "browser-use",
@@ -102872,9 +102917,7 @@ var init_beta_features = __esm({
102872
102917
  }
102873
102918
  };
102874
102919
  BETA_FEATURE_KEYS = Object.keys(BETA_FEATURES);
102875
- betaFeatureKeySchema = external_exports.enum(
102876
- BETA_FEATURE_KEYS
102877
- );
102920
+ betaFeatureKeySchema = external_exports.enum(["auto-model", ...BETA_FEATURE_KEYS]);
102878
102921
  betaFeatureGrantSchema = external_exports.object({
102879
102922
  enabled: external_exports.boolean(),
102880
102923
  enabledAt: external_exports.string().datetime(),
@@ -375396,6 +375439,10 @@ function resolveWorkForcedToolName(input) {
375396
375439
  function shouldInjectVisualizationPrompt(config3) {
375397
375440
  return !config3.localFilesystem && config3.visualizationsEnabled !== false;
375398
375441
  }
375442
+ function selectVisualizationPrompt(config3) {
375443
+ if (!shouldInjectVisualizationPrompt(config3)) return null;
375444
+ return config3.generativeUiEnabled === true ? OPENUI_PROMPT : VISUALIZATION_PROMPT;
375445
+ }
375399
375446
  function getBuiltInDataParentToolName(toolName) {
375400
375447
  if (!toolName.startsWith("parent_")) return null;
375401
375448
  const parentToolName = toolName.slice("parent_".length);
@@ -378811,8 +378858,9 @@ ${f20.content}`);
378811
378858
  searchExpertAvailable: experts.some((expert) => expert.id === "search-expert")
378812
378859
  });
378813
378860
  if (interactiveGuidance) systemMessageParts.push(interactiveGuidance);
378814
- if (shouldInjectVisualizationPrompt(config3)) {
378815
- systemMessageParts.push(VISUALIZATION_PROMPT);
378861
+ const visualizationPrompt = selectVisualizationPrompt(config3);
378862
+ if (visualizationPrompt) {
378863
+ systemMessageParts.push(visualizationPrompt);
378816
378864
  }
378817
378865
  if (context3.registeredParentToolSchemas && DATA_TOOL_NAMES.some((n31) => context3.registeredParentToolSchemas.has(n31))) {
378818
378866
  systemMessageParts.push(DATA_STAGING_PROMPT);
@@ -381075,6 +381123,8 @@ function createOrchestratorRequest(messages4, context3, config3, persona, apiKey
381075
381123
  // Advanced web picker direct-provider bypass.
381076
381124
  localFilesystem: config3.localFilesystem,
381077
381125
  // CLI harness real-fs flag (undefined on web)
381126
+ generativeUiEnabled: config3.generativeUiEnabled,
381127
+ // `generative-ui` beta: OpenUI prompt replaces the HTML one
381078
381128
  systemPromptOverride: config3.systemPromptOverride,
381079
381129
  // CLI ~/.usable/SYSTEM.md (undefined on web)
381080
381130
  appendSystemPrompt: config3.appendSystemPrompt,
@@ -381112,6 +381162,7 @@ var init_orchestrator = __esm({
381112
381162
  init_argument_validation();
381113
381163
  init_language_prompt();
381114
381164
  init_visualization_prompt();
381165
+ init_prompt();
381115
381166
  init_data_staging_prompt();
381116
381167
  init_parent_tools();
381117
381168
  init_config();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usabledev/usable-chat",
3
- "version": "1.220.0",
3
+ "version": "1.222.0",
4
4
  "description": "usable-chat — terminal harness for usable-chat (headless + TUI)",
5
5
  "type": "module",
6
6
  "bin": {