vanilla-agent 1.9.0 → 1.11.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.
package/dist/index.d.ts CHANGED
@@ -194,6 +194,24 @@ type AgentWidgetTheme = {
194
194
  radiusLg?: string;
195
195
  launcherRadius?: string;
196
196
  buttonRadius?: string;
197
+ /**
198
+ * Border style for the chat panel container.
199
+ * @example "1px solid #e5e7eb" | "none"
200
+ * @default "1px solid var(--tvw-cw-border)"
201
+ */
202
+ panelBorder?: string;
203
+ /**
204
+ * Box shadow for the chat panel container.
205
+ * @example "0 25px 50px -12px rgba(0,0,0,0.25)" | "none"
206
+ * @default "0 25px 50px -12px rgba(0,0,0,0.25)"
207
+ */
208
+ panelShadow?: string;
209
+ /**
210
+ * Border radius for the chat panel container.
211
+ * @example "16px" | "0"
212
+ * @default "16px"
213
+ */
214
+ panelBorderRadius?: string;
197
215
  };
198
216
  type AgentWidgetLauncherConfig = {
199
217
  enabled?: boolean;
@@ -207,6 +225,35 @@ type AgentWidgetLauncherConfig = {
207
225
  position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
208
226
  autoExpand?: boolean;
209
227
  width?: string;
228
+ /**
229
+ * When true, the widget panel will fill the full height of its container.
230
+ * Useful for sidebar layouts where the chat should take up the entire viewport height.
231
+ * The widget will use flex layout to ensure header stays at top, messages scroll in middle,
232
+ * and composer stays fixed at bottom.
233
+ *
234
+ * @default false
235
+ */
236
+ fullHeight?: boolean;
237
+ /**
238
+ * When true, the widget panel will be positioned as a sidebar flush with the viewport edges.
239
+ * The panel will have:
240
+ * - No border-radius (square corners)
241
+ * - No margins (flush with top, left/right, and bottom edges)
242
+ * - Full viewport height
243
+ * - Subtle shadow on the edge facing the content
244
+ * - No border between footer and messages
245
+ *
246
+ * Use with `position` to control which side ('bottom-left' for left sidebar, 'bottom-right' for right sidebar).
247
+ * Automatically enables fullHeight when true.
248
+ *
249
+ * @default false
250
+ */
251
+ sidebarMode?: boolean;
252
+ /**
253
+ * Width of the sidebar panel when sidebarMode is true.
254
+ * @default "420px"
255
+ */
256
+ sidebarWidth?: string;
210
257
  callToActionIconText?: string;
211
258
  callToActionIconName?: string;
212
259
  callToActionIconColor?: string;
@@ -249,6 +296,7 @@ type AgentWidgetSendButtonConfig = {
249
296
  };
250
297
  type AgentWidgetClearChatConfig = {
251
298
  enabled?: boolean;
299
+ placement?: "inline" | "top-right";
252
300
  iconName?: string;
253
301
  iconColor?: string;
254
302
  backgroundColor?: string;
@@ -363,10 +411,203 @@ interface AgentWidgetStreamParser {
363
411
  */
364
412
  close?(): Promise<void> | void;
365
413
  }
414
+ /**
415
+ * Component renderer function signature for custom components
416
+ */
417
+ type AgentWidgetComponentRenderer = (props: Record<string, unknown>, context: {
418
+ message: AgentWidgetMessage;
419
+ config: AgentWidgetConfig;
420
+ updateProps: (newProps: Record<string, unknown>) => void;
421
+ }) => HTMLElement;
422
+ /**
423
+ * Result from custom SSE event parser
424
+ */
425
+ type AgentWidgetSSEEventResult = {
426
+ /** Text content to display */
427
+ text?: string;
428
+ /** Whether the stream is complete */
429
+ done?: boolean;
430
+ /** Error message if an error occurred */
431
+ error?: string;
432
+ } | null;
433
+ /**
434
+ * Custom SSE event parser function
435
+ * Allows transforming non-standard SSE event formats to vanilla-agent's expected format
436
+ */
437
+ type AgentWidgetSSEEventParser = (eventData: unknown) => AgentWidgetSSEEventResult | Promise<AgentWidgetSSEEventResult>;
438
+ /**
439
+ * Custom fetch function for full control over API requests
440
+ * Use this for custom authentication, request transformation, etc.
441
+ */
442
+ type AgentWidgetCustomFetch = (url: string, init: RequestInit, payload: AgentWidgetRequestPayload) => Promise<Response>;
443
+ /**
444
+ * Dynamic headers function - called before each request
445
+ */
446
+ type AgentWidgetHeadersFunction = () => Record<string, string> | Promise<Record<string, string>>;
447
+ /**
448
+ * Context provided to header render functions
449
+ */
450
+ type HeaderRenderContext = {
451
+ config: AgentWidgetConfig;
452
+ onClose?: () => void;
453
+ onClearChat?: () => void;
454
+ };
455
+ /**
456
+ * Context provided to message render functions
457
+ */
458
+ type MessageRenderContext = {
459
+ message: AgentWidgetMessage;
460
+ config: AgentWidgetConfig;
461
+ streaming: boolean;
462
+ };
463
+ /**
464
+ * Context provided to slot render functions
465
+ */
466
+ type SlotRenderContext = {
467
+ config: AgentWidgetConfig;
468
+ defaultContent: () => HTMLElement | null;
469
+ };
470
+ /**
471
+ * Header layout configuration
472
+ * Allows customization of the header section appearance and behavior
473
+ */
474
+ type AgentWidgetHeaderLayoutConfig = {
475
+ /**
476
+ * Layout preset: "default" | "minimal" | "expanded"
477
+ * - default: Standard layout with icon, title, subtitle, and buttons
478
+ * - minimal: Simplified layout with just title and close button
479
+ * - expanded: Full branding area with additional content space
480
+ */
481
+ layout?: "default" | "minimal" | "expanded";
482
+ /** Show/hide the header icon */
483
+ showIcon?: boolean;
484
+ /** Show/hide the title */
485
+ showTitle?: boolean;
486
+ /** Show/hide the subtitle */
487
+ showSubtitle?: boolean;
488
+ /** Show/hide the close button */
489
+ showCloseButton?: boolean;
490
+ /** Show/hide the clear chat button */
491
+ showClearChat?: boolean;
492
+ /**
493
+ * Custom renderer for complete header override
494
+ * When provided, replaces the entire header with custom content
495
+ */
496
+ render?: (context: HeaderRenderContext) => HTMLElement;
497
+ };
498
+ /**
499
+ * Avatar configuration for message bubbles
500
+ */
501
+ type AgentWidgetAvatarConfig = {
502
+ /** Whether to show avatars */
503
+ show?: boolean;
504
+ /** Position of avatar relative to message bubble */
505
+ position?: "left" | "right";
506
+ /** URL or emoji for user avatar */
507
+ userAvatar?: string;
508
+ /** URL or emoji for assistant avatar */
509
+ assistantAvatar?: string;
510
+ };
511
+ /**
512
+ * Timestamp configuration for message bubbles
513
+ */
514
+ type AgentWidgetTimestampConfig = {
515
+ /** Whether to show timestamps */
516
+ show?: boolean;
517
+ /** Position of timestamp relative to message */
518
+ position?: "inline" | "below";
519
+ /** Custom formatter for timestamp display */
520
+ format?: (date: Date) => string;
521
+ };
522
+ /**
523
+ * Message layout configuration
524
+ * Allows customization of how chat messages are displayed
525
+ */
526
+ type AgentWidgetMessageLayoutConfig = {
527
+ /**
528
+ * Layout preset: "bubble" | "flat" | "minimal"
529
+ * - bubble: Standard chat bubble appearance (default)
530
+ * - flat: Flat messages without bubble styling
531
+ * - minimal: Minimal styling with reduced padding/borders
532
+ */
533
+ layout?: "bubble" | "flat" | "minimal";
534
+ /** Avatar configuration */
535
+ avatar?: AgentWidgetAvatarConfig;
536
+ /** Timestamp configuration */
537
+ timestamp?: AgentWidgetTimestampConfig;
538
+ /** Group consecutive messages from the same role */
539
+ groupConsecutive?: boolean;
540
+ /**
541
+ * Custom renderer for user messages
542
+ * When provided, replaces the default user message rendering
543
+ */
544
+ renderUserMessage?: (context: MessageRenderContext) => HTMLElement;
545
+ /**
546
+ * Custom renderer for assistant messages
547
+ * When provided, replaces the default assistant message rendering
548
+ */
549
+ renderAssistantMessage?: (context: MessageRenderContext) => HTMLElement;
550
+ };
551
+ /**
552
+ * Available layout slots for content injection
553
+ */
554
+ type WidgetLayoutSlot = "header-left" | "header-center" | "header-right" | "body-top" | "messages" | "body-bottom" | "footer-top" | "composer" | "footer-bottom";
555
+ /**
556
+ * Slot renderer function signature
557
+ * Returns HTMLElement to render in the slot, or null to use default content
558
+ */
559
+ type SlotRenderer = (context: SlotRenderContext) => HTMLElement | null;
560
+ /**
561
+ * Main layout configuration
562
+ * Provides comprehensive control over widget layout and appearance
563
+ *
564
+ * @example
565
+ * ```typescript
566
+ * config: {
567
+ * layout: {
568
+ * header: { layout: "minimal" },
569
+ * messages: {
570
+ * avatar: { show: true, assistantAvatar: "/bot.png" },
571
+ * timestamp: { show: true, position: "below" }
572
+ * },
573
+ * slots: {
574
+ * "footer-top": () => {
575
+ * const el = document.createElement("div");
576
+ * el.textContent = "Powered by AI";
577
+ * return el;
578
+ * }
579
+ * }
580
+ * }
581
+ * }
582
+ * ```
583
+ */
584
+ type AgentWidgetLayoutConfig = {
585
+ /** Header layout configuration */
586
+ header?: AgentWidgetHeaderLayoutConfig;
587
+ /** Message layout configuration */
588
+ messages?: AgentWidgetMessageLayoutConfig;
589
+ /** Slot renderers for custom content injection */
590
+ slots?: Partial<Record<WidgetLayoutSlot, SlotRenderer>>;
591
+ };
366
592
  type AgentWidgetConfig = {
367
593
  apiUrl?: string;
368
594
  flowId?: string;
595
+ /**
596
+ * Static headers to include with each request.
597
+ * For dynamic headers (e.g., auth tokens), use `getHeaders` instead.
598
+ */
369
599
  headers?: Record<string, string>;
600
+ /**
601
+ * Dynamic headers function - called before each request.
602
+ * Useful for adding auth tokens that may change.
603
+ * @example
604
+ * ```typescript
605
+ * getHeaders: async () => ({
606
+ * 'Authorization': `Bearer ${await getAuthToken()}`
607
+ * })
608
+ * ```
609
+ */
610
+ getHeaders?: AgentWidgetHeadersFunction;
370
611
  copy?: {
371
612
  welcomeTitle?: string;
372
613
  welcomeSubtitle?: string;
@@ -398,6 +639,32 @@ type AgentWidgetConfig = {
398
639
  actionParsers?: AgentWidgetActionParser[];
399
640
  actionHandlers?: AgentWidgetActionHandler[];
400
641
  storageAdapter?: AgentWidgetStorageAdapter;
642
+ /**
643
+ * Registry of custom components that can be rendered from JSON directives.
644
+ * Components are registered by name and can be invoked via JSON responses
645
+ * with the format: `{"component": "ComponentName", "props": {...}}`
646
+ *
647
+ * @example
648
+ * ```typescript
649
+ * config: {
650
+ * components: {
651
+ * ProductCard: (props, context) => {
652
+ * const card = document.createElement("div");
653
+ * card.innerHTML = `<h3>${props.title}</h3><p>$${props.price}</p>`;
654
+ * return card;
655
+ * }
656
+ * }
657
+ * }
658
+ * ```
659
+ */
660
+ components?: Record<string, AgentWidgetComponentRenderer>;
661
+ /**
662
+ * Enable component streaming. When true, component props will be updated
663
+ * incrementally as they stream in from the JSON response.
664
+ *
665
+ * @default true
666
+ */
667
+ enableComponentStreaming?: boolean;
401
668
  /**
402
669
  * Custom stream parser for extracting text from streaming structured responses.
403
670
  * Handles incremental parsing of JSON, XML, or other formats.
@@ -454,6 +721,83 @@ type AgentWidgetConfig = {
454
721
  * ```
455
722
  */
456
723
  parserType?: "plain" | "json" | "regex-json" | "xml";
724
+ /**
725
+ * Custom fetch function for full control over API requests.
726
+ * Use this for custom authentication, request/response transformation, etc.
727
+ *
728
+ * When provided, this function is called instead of the default fetch.
729
+ * You receive the URL, RequestInit, and the payload that would be sent.
730
+ *
731
+ * @example
732
+ * ```typescript
733
+ * config: {
734
+ * customFetch: async (url, init, payload) => {
735
+ * // Transform request for your API format
736
+ * const myPayload = {
737
+ * flow: { id: 'my-flow-id' },
738
+ * messages: payload.messages,
739
+ * options: { stream_response: true }
740
+ * };
741
+ *
742
+ * // Add auth header
743
+ * const token = await getAuthToken();
744
+ *
745
+ * return fetch('/my-api/dispatch', {
746
+ * method: 'POST',
747
+ * headers: {
748
+ * 'Content-Type': 'application/json',
749
+ * 'Authorization': `Bearer ${token}`
750
+ * },
751
+ * body: JSON.stringify(myPayload),
752
+ * signal: init.signal
753
+ * });
754
+ * }
755
+ * }
756
+ * ```
757
+ */
758
+ customFetch?: AgentWidgetCustomFetch;
759
+ /**
760
+ * Custom SSE event parser for non-standard streaming response formats.
761
+ *
762
+ * Use this when your API returns SSE events in a different format than expected.
763
+ * Return `{ text }` for text chunks, `{ done: true }` for completion,
764
+ * `{ error }` for errors, or `null` to ignore the event.
765
+ *
766
+ * @example
767
+ * ```typescript
768
+ * // For Travrse API format
769
+ * config: {
770
+ * parseSSEEvent: (data) => {
771
+ * if (data.type === 'step_chunk' && data.chunk) {
772
+ * return { text: data.chunk };
773
+ * }
774
+ * if (data.type === 'flow_complete') {
775
+ * return { done: true };
776
+ * }
777
+ * if (data.type === 'step_error') {
778
+ * return { error: data.error };
779
+ * }
780
+ * return null; // Ignore other events
781
+ * }
782
+ * }
783
+ * ```
784
+ */
785
+ parseSSEEvent?: AgentWidgetSSEEventParser;
786
+ /**
787
+ * Layout configuration for customizing widget appearance and structure.
788
+ * Provides control over header, messages, and content slots.
789
+ *
790
+ * @example
791
+ * ```typescript
792
+ * config: {
793
+ * layout: {
794
+ * header: { layout: "minimal" },
795
+ * messages: { avatar: { show: true } }
796
+ * }
797
+ * }
798
+ * ```
799
+ */
800
+ layout?: AgentWidgetLayoutConfig;
457
801
  };
458
802
  type AgentWidgetMessageRole = "user" | "assistant" | "system";
459
803
  type AgentWidgetReasoning = {
@@ -613,9 +957,17 @@ declare class AgentWidgetClient {
613
957
  private readonly createStreamParser;
614
958
  private readonly contextProviders;
615
959
  private readonly requestMiddleware?;
960
+ private readonly customFetch?;
961
+ private readonly parseSSEEvent?;
962
+ private readonly getHeaders?;
616
963
  constructor(config?: AgentWidgetConfig);
617
964
  dispatch(options: DispatchOptions, onEvent: SSEHandler): Promise<void>;
618
965
  private buildPayload;
966
+ /**
967
+ * Handle custom SSE event parsing via parseSSEEvent callback
968
+ * Returns true if event was handled, false otherwise
969
+ */
970
+ private handleCustomSSEEvent;
619
971
  private streamResponse;
620
972
  }
621
973
 
@@ -724,6 +1076,149 @@ declare class PluginRegistry {
724
1076
  }
725
1077
  declare const pluginRegistry: PluginRegistry;
726
1078
 
1079
+ /**
1080
+ * Context provided to component renderers
1081
+ */
1082
+ interface ComponentContext {
1083
+ message: AgentWidgetMessage;
1084
+ config: AgentWidgetConfig;
1085
+ /**
1086
+ * Update component props during streaming
1087
+ */
1088
+ updateProps: (newProps: Record<string, unknown>) => void;
1089
+ }
1090
+ /**
1091
+ * Component renderer function signature
1092
+ */
1093
+ type ComponentRenderer = (props: Record<string, unknown>, context: ComponentContext) => HTMLElement;
1094
+ /**
1095
+ * Component registry for managing custom components
1096
+ */
1097
+ declare class ComponentRegistry {
1098
+ private components;
1099
+ /**
1100
+ * Register a custom component
1101
+ */
1102
+ register(name: string, renderer: ComponentRenderer): void;
1103
+ /**
1104
+ * Unregister a component
1105
+ */
1106
+ unregister(name: string): void;
1107
+ /**
1108
+ * Get a component renderer by name
1109
+ */
1110
+ get(name: string): ComponentRenderer | undefined;
1111
+ /**
1112
+ * Check if a component is registered
1113
+ */
1114
+ has(name: string): boolean;
1115
+ /**
1116
+ * Get all registered component names
1117
+ */
1118
+ getAllNames(): string[];
1119
+ /**
1120
+ * Clear all registered components
1121
+ */
1122
+ clear(): void;
1123
+ /**
1124
+ * Register multiple components at once
1125
+ */
1126
+ registerAll(components: Record<string, ComponentRenderer>): void;
1127
+ }
1128
+ /**
1129
+ * Global component registry instance
1130
+ */
1131
+ declare const componentRegistry: ComponentRegistry;
1132
+
1133
+ /**
1134
+ * Represents a component directive extracted from JSON
1135
+ */
1136
+ interface ComponentDirective {
1137
+ component: string;
1138
+ props: Record<string, unknown>;
1139
+ raw: string;
1140
+ }
1141
+ /**
1142
+ * Creates a parser that extracts component directives from JSON streams
1143
+ * This parser looks for objects with a "component" field and extracts
1144
+ * the component name and props incrementally as they stream in.
1145
+ */
1146
+ declare function createComponentStreamParser(): {
1147
+ /**
1148
+ * Get the currently extracted component directive
1149
+ */
1150
+ getExtractedDirective: () => ComponentDirective | null;
1151
+ /**
1152
+ * Process a chunk of JSON and extract component directive if present
1153
+ */
1154
+ processChunk: (accumulatedContent: string) => ComponentDirective | null;
1155
+ /**
1156
+ * Reset the parser state
1157
+ */
1158
+ reset: () => void;
1159
+ };
1160
+ /**
1161
+ * Type guard to check if an object is a component directive
1162
+ */
1163
+ declare function isComponentDirectiveType(obj: unknown): obj is ComponentDirective;
1164
+
1165
+ type MessageTransform = (context: {
1166
+ text: string;
1167
+ message: AgentWidgetMessage;
1168
+ streaming: boolean;
1169
+ raw?: string;
1170
+ }) => string;
1171
+ declare const createTypingIndicator: () => HTMLElement;
1172
+ /**
1173
+ * Create standard message bubble
1174
+ * Supports layout configuration for avatars, timestamps, and visual presets
1175
+ */
1176
+ declare const createStandardBubble: (message: AgentWidgetMessage, transform: MessageTransform, layoutConfig?: AgentWidgetMessageLayoutConfig) => HTMLElement;
1177
+ /**
1178
+ * Create bubble with custom renderer support
1179
+ * Uses custom renderer if provided in layout config, otherwise falls back to standard bubble
1180
+ */
1181
+ declare const createBubbleWithLayout: (message: AgentWidgetMessage, transform: MessageTransform, layoutConfig?: AgentWidgetMessageLayoutConfig) => HTMLElement;
1182
+
1183
+ /**
1184
+ * Options for component middleware
1185
+ */
1186
+ interface ComponentMiddlewareOptions {
1187
+ config: AgentWidgetConfig;
1188
+ message: AgentWidgetMessage;
1189
+ transform: MessageTransform;
1190
+ onPropsUpdate?: (props: Record<string, unknown>) => void;
1191
+ }
1192
+ /**
1193
+ * Renders a component directive into an HTMLElement
1194
+ */
1195
+ declare function renderComponentDirective(directive: ComponentDirective, options: ComponentMiddlewareOptions): HTMLElement | null;
1196
+ /**
1197
+ * Creates middleware that processes component directives from streamed JSON
1198
+ */
1199
+ declare function createComponentMiddleware(): {
1200
+ /**
1201
+ * Process accumulated content and extract component directive
1202
+ */
1203
+ processChunk: (accumulatedContent: string) => ComponentDirective | null;
1204
+ /**
1205
+ * Get the currently extracted directive
1206
+ */
1207
+ getDirective: () => ComponentDirective | null;
1208
+ /**
1209
+ * Reset the parser state
1210
+ */
1211
+ reset: () => void;
1212
+ };
1213
+ /**
1214
+ * Checks if a message contains a component directive in its raw content
1215
+ */
1216
+ declare function hasComponentDirective(message: AgentWidgetMessage): boolean;
1217
+ /**
1218
+ * Extracts component directive from a complete message
1219
+ */
1220
+ declare function extractComponentDirectiveFromMessage(message: AgentWidgetMessage): ComponentDirective | null;
1221
+
727
1222
  /**
728
1223
  * Default widget configuration
729
1224
  * Single source of truth for all default values
@@ -735,4 +1230,89 @@ declare const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig>;
735
1230
  */
736
1231
  declare function mergeWithDefaults(config?: Partial<AgentWidgetConfig>): Partial<AgentWidgetConfig>;
737
1232
 
738
- export { AgentWidgetClient, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetMessage, type AgentWidgetPlugin, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, DEFAULT_WIDGET_CONFIG, createActionManager, createAgentExperience, createFlexibleJsonStreamParser, createJsonStreamParser, createLocalStorageAdapter, createPlainTextParser, createRegexJsonParser, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, directivePostprocessor, escapeHtml, initAgentWidget, markdownPostprocessor, mergeWithDefaults, pluginRegistry };
1233
+ interface HeaderElements {
1234
+ header: HTMLElement;
1235
+ iconHolder: HTMLElement;
1236
+ headerTitle: HTMLElement;
1237
+ headerSubtitle: HTMLElement;
1238
+ closeButton: HTMLButtonElement;
1239
+ closeButtonWrapper: HTMLElement;
1240
+ clearChatButton: HTMLButtonElement | null;
1241
+ clearChatButtonWrapper: HTMLElement | null;
1242
+ }
1243
+ interface HeaderBuildContext {
1244
+ config?: AgentWidgetConfig;
1245
+ showClose?: boolean;
1246
+ onClose?: () => void;
1247
+ onClearChat?: () => void;
1248
+ }
1249
+ /**
1250
+ * Build the header section of the panel.
1251
+ * Extracted for reuse and plugin override support.
1252
+ */
1253
+ declare const buildHeader: (context: HeaderBuildContext) => HeaderElements;
1254
+ /**
1255
+ * Attach header elements to the container, handling placement modes.
1256
+ */
1257
+ declare const attachHeaderToContainer: (container: HTMLElement, headerElements: HeaderElements, config?: AgentWidgetConfig) => void;
1258
+
1259
+ interface ComposerElements {
1260
+ footer: HTMLElement;
1261
+ suggestions: HTMLElement;
1262
+ composerForm: HTMLFormElement;
1263
+ textarea: HTMLTextAreaElement;
1264
+ sendButton: HTMLButtonElement;
1265
+ sendButtonWrapper: HTMLElement;
1266
+ micButton: HTMLButtonElement | null;
1267
+ micButtonWrapper: HTMLElement | null;
1268
+ statusText: HTMLElement;
1269
+ }
1270
+ interface ComposerBuildContext {
1271
+ config?: AgentWidgetConfig;
1272
+ onSubmit?: (text: string) => void;
1273
+ disabled?: boolean;
1274
+ }
1275
+ /**
1276
+ * Build the composer/footer section of the panel.
1277
+ * Extracted for reuse and plugin override support.
1278
+ */
1279
+ declare const buildComposer: (context: ComposerBuildContext) => ComposerElements;
1280
+
1281
+ interface HeaderLayoutContext {
1282
+ config: AgentWidgetConfig;
1283
+ showClose?: boolean;
1284
+ onClose?: () => void;
1285
+ onClearChat?: () => void;
1286
+ }
1287
+ type HeaderLayoutRenderer = (context: HeaderLayoutContext) => HeaderElements;
1288
+ /**
1289
+ * Build default header layout
1290
+ * Full header with icon, title, subtitle, clear chat, and close button
1291
+ */
1292
+ declare const buildDefaultHeader: HeaderLayoutRenderer;
1293
+ /**
1294
+ * Build minimal header layout
1295
+ * Simplified layout with just title and close button
1296
+ */
1297
+ declare const buildMinimalHeader: HeaderLayoutRenderer;
1298
+ /**
1299
+ * Build expanded header layout
1300
+ * Full branding area with additional space for custom content
1301
+ */
1302
+ declare const buildExpandedHeader: HeaderLayoutRenderer;
1303
+ /**
1304
+ * Header layout registry
1305
+ * Maps layout names to their renderer functions
1306
+ */
1307
+ declare const headerLayouts: Record<string, HeaderLayoutRenderer>;
1308
+ /**
1309
+ * Get header layout renderer by name
1310
+ */
1311
+ declare const getHeaderLayout: (layoutName: string) => HeaderLayoutRenderer;
1312
+ /**
1313
+ * Build header based on layout configuration
1314
+ * Applies layout config settings to determine which layout to use
1315
+ */
1316
+ declare const buildHeaderWithLayout: (config: AgentWidgetConfig, layoutConfig?: AgentWidgetHeaderLayoutConfig, context?: Partial<HeaderLayoutContext>) => HeaderElements;
1317
+
1318
+ export { type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetCustomFetch, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetMessage, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComposerBuildContext, type ComposerElements, DEFAULT_WIDGET_CONFIG, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type MessageRenderContext, type MessageTransform, type SlotRenderContext, type SlotRenderer, type WidgetLayoutSlot, attachHeaderToContainer, buildComposer, buildDefaultHeader, buildExpandedHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, componentRegistry, createActionManager, createAgentExperience, createBubbleWithLayout, createComponentMiddleware, createComponentStreamParser, createFlexibleJsonStreamParser, createJsonStreamParser, createLocalStorageAdapter, createPlainTextParser, createRegexJsonParser, createStandardBubble, createTypingIndicator, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, getHeaderLayout, hasComponentDirective, headerLayouts, initAgentWidget, isComponentDirectiveType, markdownPostprocessor, mergeWithDefaults, pluginRegistry, renderComponentDirective };