@runtypelabs/persona 2.1.0 → 2.3.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.cts CHANGED
@@ -638,6 +638,14 @@ type AgentWidgetArtifactsFeature = {
638
638
  allowedTypes?: PersonaArtifactKind[];
639
639
  /** Split / drawer dimensions and launcher widen behavior */
640
640
  layout?: AgentWidgetArtifactsLayoutConfig;
641
+ /**
642
+ * Called when an artifact card action is triggered (open, download).
643
+ * Return `true` to prevent the default behavior.
644
+ */
645
+ onArtifactAction?: (action: {
646
+ type: 'open' | 'download';
647
+ artifactId: string;
648
+ }) => boolean | void;
641
649
  };
642
650
  type AgentWidgetFeatureFlags = {
643
651
  showReasoning?: boolean;
@@ -1480,6 +1488,12 @@ type AgentWidgetHeaderLayoutConfig = {
1480
1488
  trailingActions?: AgentWidgetHeaderTrailingAction[];
1481
1489
  /** Called when a `trailingActions` button is clicked. */
1482
1490
  onAction?: (actionId: string) => void;
1491
+ /**
1492
+ * Called when the header title row is clicked.
1493
+ * Useful for dropdown menus or navigation triggered from the header.
1494
+ * When set, the title row becomes visually interactive (cursor: pointer).
1495
+ */
1496
+ onTitleClick?: () => void;
1483
1497
  };
1484
1498
  /**
1485
1499
  * Avatar configuration for message bubbles
@@ -2557,6 +2571,19 @@ type AgentWidgetConfig = {
2557
2571
  * ```
2558
2572
  */
2559
2573
  markdown?: AgentWidgetMarkdownConfig;
2574
+ /**
2575
+ * HTML sanitization for rendered message content.
2576
+ *
2577
+ * The widget renders AI-generated markdown as HTML. By default, all HTML
2578
+ * output is sanitized using DOMPurify to prevent XSS attacks.
2579
+ *
2580
+ * - `true` (default): sanitize using built-in DOMPurify
2581
+ * - `false`: disable sanitization (only use with fully trusted content sources)
2582
+ * - `(html: string) => string`: custom sanitizer function
2583
+ *
2584
+ * @default true
2585
+ */
2586
+ sanitize?: boolean | ((html: string) => string);
2560
2587
  /**
2561
2588
  * Configuration for message action buttons (copy, upvote, downvote).
2562
2589
  * Shows action buttons on assistant messages for user feedback.
@@ -3632,6 +3659,24 @@ declare const createDirectivePostprocessor: (markdownConfig?: AgentWidgetMarkdow
3632
3659
  */
3633
3660
  declare const directivePostprocessor: (text: string) => string;
3634
3661
 
3662
+ /**
3663
+ * A function that sanitizes an HTML string, returning safe HTML.
3664
+ */
3665
+ type SanitizeFunction = (html: string) => string;
3666
+ /**
3667
+ * Creates the default DOMPurify-based sanitizer.
3668
+ * Uses the global window when available (browser).
3669
+ */
3670
+ declare const createDefaultSanitizer: () => SanitizeFunction;
3671
+ /**
3672
+ * Resolves a `sanitize` config value into a concrete function or null.
3673
+ *
3674
+ * - `undefined` / `true` → built-in DOMPurify sanitizer
3675
+ * - `false` → `null` (no sanitization)
3676
+ * - custom function → returned as-is
3677
+ */
3678
+ declare const resolveSanitizer: (option: boolean | SanitizeFunction | undefined) => SanitizeFunction | null;
3679
+
3635
3680
  /**
3636
3681
  * Plain text parser - passes through text as-is without any parsing.
3637
3682
  * This is the default parser.
@@ -4411,6 +4456,38 @@ interface ComposerChromeTokens {
4411
4456
  /** Box-shadow on the composer form (raw CSS, e.g. `none`). */
4412
4457
  shadow: string;
4413
4458
  }
4459
+ /** Artifact toolbar chrome. */
4460
+ interface ArtifactToolbarTokens {
4461
+ iconHoverColor?: string;
4462
+ iconHoverBackground?: string;
4463
+ iconPadding?: string;
4464
+ iconBorderRadius?: string;
4465
+ iconBorder?: string;
4466
+ toggleGroupGap?: string;
4467
+ toggleBorderRadius?: string;
4468
+ copyBackground?: string;
4469
+ copyBorder?: string;
4470
+ copyColor?: string;
4471
+ copyBorderRadius?: string;
4472
+ copyPadding?: string;
4473
+ copyMenuBackground?: string;
4474
+ copyMenuBorder?: string;
4475
+ copyMenuShadow?: string;
4476
+ copyMenuBorderRadius?: string;
4477
+ copyMenuItemHoverBackground?: string;
4478
+ }
4479
+ /** Artifact tab strip chrome. */
4480
+ interface ArtifactTabTokens {
4481
+ background?: string;
4482
+ activeBackground?: string;
4483
+ activeBorder?: string;
4484
+ borderRadius?: string;
4485
+ textColor?: string;
4486
+ }
4487
+ /** Artifact pane chrome. */
4488
+ interface ArtifactPaneTokens {
4489
+ toolbarBackground?: string;
4490
+ }
4414
4491
  interface ComponentTokens {
4415
4492
  button: ButtonTokens;
4416
4493
  input: InputTokens;
@@ -4426,6 +4503,12 @@ interface ComponentTokens {
4426
4503
  toolBubble: ToolBubbleTokens;
4427
4504
  reasoningBubble: ReasoningBubbleTokens;
4428
4505
  composer: ComposerChromeTokens;
4506
+ /** Artifact toolbar, tab strip, and pane chrome. */
4507
+ artifact?: {
4508
+ toolbar?: ArtifactToolbarTokens;
4509
+ tab?: ArtifactTabTokens;
4510
+ pane?: ArtifactPaneTokens;
4511
+ };
4429
4512
  }
4430
4513
  interface PaletteExtras {
4431
4514
  transitions?: Record<string, string>;
@@ -4645,6 +4728,22 @@ declare function resolveTokens(theme: PersonaTheme): Record<string, ResolvedToke
4645
4728
  declare function validateTheme(theme: Partial<PersonaTheme>): ThemeValidationResult;
4646
4729
  declare function createTheme(userConfig?: Partial<PersonaTheme>, options?: CreateThemeOptions): PersonaTheme;
4647
4730
  declare function themeToCssVariables(theme: PersonaTheme): Record<string, string>;
4731
+ /**
4732
+ * Stable `data-persona-theme-zone` values applied to key widget regions.
4733
+ * Visual editors should use `[data-persona-theme-zone="header"]` selectors
4734
+ * rather than internal class names.
4735
+ */
4736
+ declare const THEME_ZONES: {
4737
+ readonly header: "Widget header bar";
4738
+ readonly messages: "Message list area";
4739
+ readonly 'user-message': "User message bubble";
4740
+ readonly 'assistant-message': "Assistant message bubble";
4741
+ readonly composer: "Footer / composer area";
4742
+ readonly container: "Main widget container";
4743
+ readonly 'artifact-pane': "Artifact sidebar";
4744
+ readonly 'artifact-toolbar': "Artifact toolbar";
4745
+ };
4746
+ type ThemeZone = keyof typeof THEME_ZONES;
4648
4747
 
4649
4748
  type ColorScheme = 'light' | 'dark' | 'auto';
4650
4749
  interface PersonaWidgetConfig {
@@ -4885,6 +4984,36 @@ declare const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig>;
4885
4984
  */
4886
4985
  declare function mergeWithDefaults(config?: Partial<AgentWidgetConfig>): Partial<AgentWidgetConfig>;
4887
4986
 
4987
+ /**
4988
+ * A named preset containing partial widget configuration.
4989
+ * Apply with: `createAgentExperience(el, { ...PRESET_SHOP.config, apiUrl: '...' })`
4990
+ * or via IIFE: `{ ...AgentWidget.PRESETS.shop.config, apiUrl: '...' }`
4991
+ */
4992
+ interface WidgetPreset {
4993
+ id: string;
4994
+ label: string;
4995
+ config: Partial<AgentWidgetConfig>;
4996
+ }
4997
+ /**
4998
+ * Shopping / e-commerce preset.
4999
+ * Dark header, rounded launchers, shopping-oriented copy.
5000
+ */
5001
+ declare const PRESET_SHOP: WidgetPreset;
5002
+ /**
5003
+ * Minimal preset.
5004
+ * Stripped-down header, no launcher button, suitable for inline embeds.
5005
+ */
5006
+ declare const PRESET_MINIMAL: WidgetPreset;
5007
+ /**
5008
+ * Fullscreen assistant preset.
5009
+ * No launcher, content-max-width constrained, minimal header.
5010
+ */
5011
+ declare const PRESET_FULLSCREEN: WidgetPreset;
5012
+ /** All named presets keyed by ID. */
5013
+ declare const PRESETS: Record<string, WidgetPreset>;
5014
+ /** Look up a preset by ID. */
5015
+ declare function getPreset(id: string): WidgetPreset | undefined;
5016
+
4888
5017
  interface HeaderElements {
4889
5018
  header: HTMLElement;
4890
5019
  iconHolder: HTMLElement;
@@ -4975,4 +5104,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
4975
5104
  declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
4976
5105
  declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
4977
5106
 
4978
- export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateStandardBubbleOptions, type CreateThemeOptions, DEFAULT_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DomContextMode, type DomContextOptions, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComponentMiddleware, createComponentStreamParser, createDirectivePostprocessor, createFlexibleJsonStreamParser, createImagePart, createJsonStreamParser, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, migrateV1Theme, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };
5107
+ export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateStandardBubbleOptions, type CreateThemeOptions, DEFAULT_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DomContextMode, type DomContextOptions, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDirectivePostprocessor, createFlexibleJsonStreamParser, createImagePart, createJsonStreamParser, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, migrateV1Theme, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };
package/dist/index.d.ts CHANGED
@@ -638,6 +638,14 @@ type AgentWidgetArtifactsFeature = {
638
638
  allowedTypes?: PersonaArtifactKind[];
639
639
  /** Split / drawer dimensions and launcher widen behavior */
640
640
  layout?: AgentWidgetArtifactsLayoutConfig;
641
+ /**
642
+ * Called when an artifact card action is triggered (open, download).
643
+ * Return `true` to prevent the default behavior.
644
+ */
645
+ onArtifactAction?: (action: {
646
+ type: 'open' | 'download';
647
+ artifactId: string;
648
+ }) => boolean | void;
641
649
  };
642
650
  type AgentWidgetFeatureFlags = {
643
651
  showReasoning?: boolean;
@@ -1480,6 +1488,12 @@ type AgentWidgetHeaderLayoutConfig = {
1480
1488
  trailingActions?: AgentWidgetHeaderTrailingAction[];
1481
1489
  /** Called when a `trailingActions` button is clicked. */
1482
1490
  onAction?: (actionId: string) => void;
1491
+ /**
1492
+ * Called when the header title row is clicked.
1493
+ * Useful for dropdown menus or navigation triggered from the header.
1494
+ * When set, the title row becomes visually interactive (cursor: pointer).
1495
+ */
1496
+ onTitleClick?: () => void;
1483
1497
  };
1484
1498
  /**
1485
1499
  * Avatar configuration for message bubbles
@@ -2557,6 +2571,19 @@ type AgentWidgetConfig = {
2557
2571
  * ```
2558
2572
  */
2559
2573
  markdown?: AgentWidgetMarkdownConfig;
2574
+ /**
2575
+ * HTML sanitization for rendered message content.
2576
+ *
2577
+ * The widget renders AI-generated markdown as HTML. By default, all HTML
2578
+ * output is sanitized using DOMPurify to prevent XSS attacks.
2579
+ *
2580
+ * - `true` (default): sanitize using built-in DOMPurify
2581
+ * - `false`: disable sanitization (only use with fully trusted content sources)
2582
+ * - `(html: string) => string`: custom sanitizer function
2583
+ *
2584
+ * @default true
2585
+ */
2586
+ sanitize?: boolean | ((html: string) => string);
2560
2587
  /**
2561
2588
  * Configuration for message action buttons (copy, upvote, downvote).
2562
2589
  * Shows action buttons on assistant messages for user feedback.
@@ -3632,6 +3659,24 @@ declare const createDirectivePostprocessor: (markdownConfig?: AgentWidgetMarkdow
3632
3659
  */
3633
3660
  declare const directivePostprocessor: (text: string) => string;
3634
3661
 
3662
+ /**
3663
+ * A function that sanitizes an HTML string, returning safe HTML.
3664
+ */
3665
+ type SanitizeFunction = (html: string) => string;
3666
+ /**
3667
+ * Creates the default DOMPurify-based sanitizer.
3668
+ * Uses the global window when available (browser).
3669
+ */
3670
+ declare const createDefaultSanitizer: () => SanitizeFunction;
3671
+ /**
3672
+ * Resolves a `sanitize` config value into a concrete function or null.
3673
+ *
3674
+ * - `undefined` / `true` → built-in DOMPurify sanitizer
3675
+ * - `false` → `null` (no sanitization)
3676
+ * - custom function → returned as-is
3677
+ */
3678
+ declare const resolveSanitizer: (option: boolean | SanitizeFunction | undefined) => SanitizeFunction | null;
3679
+
3635
3680
  /**
3636
3681
  * Plain text parser - passes through text as-is without any parsing.
3637
3682
  * This is the default parser.
@@ -4411,6 +4456,38 @@ interface ComposerChromeTokens {
4411
4456
  /** Box-shadow on the composer form (raw CSS, e.g. `none`). */
4412
4457
  shadow: string;
4413
4458
  }
4459
+ /** Artifact toolbar chrome. */
4460
+ interface ArtifactToolbarTokens {
4461
+ iconHoverColor?: string;
4462
+ iconHoverBackground?: string;
4463
+ iconPadding?: string;
4464
+ iconBorderRadius?: string;
4465
+ iconBorder?: string;
4466
+ toggleGroupGap?: string;
4467
+ toggleBorderRadius?: string;
4468
+ copyBackground?: string;
4469
+ copyBorder?: string;
4470
+ copyColor?: string;
4471
+ copyBorderRadius?: string;
4472
+ copyPadding?: string;
4473
+ copyMenuBackground?: string;
4474
+ copyMenuBorder?: string;
4475
+ copyMenuShadow?: string;
4476
+ copyMenuBorderRadius?: string;
4477
+ copyMenuItemHoverBackground?: string;
4478
+ }
4479
+ /** Artifact tab strip chrome. */
4480
+ interface ArtifactTabTokens {
4481
+ background?: string;
4482
+ activeBackground?: string;
4483
+ activeBorder?: string;
4484
+ borderRadius?: string;
4485
+ textColor?: string;
4486
+ }
4487
+ /** Artifact pane chrome. */
4488
+ interface ArtifactPaneTokens {
4489
+ toolbarBackground?: string;
4490
+ }
4414
4491
  interface ComponentTokens {
4415
4492
  button: ButtonTokens;
4416
4493
  input: InputTokens;
@@ -4426,6 +4503,12 @@ interface ComponentTokens {
4426
4503
  toolBubble: ToolBubbleTokens;
4427
4504
  reasoningBubble: ReasoningBubbleTokens;
4428
4505
  composer: ComposerChromeTokens;
4506
+ /** Artifact toolbar, tab strip, and pane chrome. */
4507
+ artifact?: {
4508
+ toolbar?: ArtifactToolbarTokens;
4509
+ tab?: ArtifactTabTokens;
4510
+ pane?: ArtifactPaneTokens;
4511
+ };
4429
4512
  }
4430
4513
  interface PaletteExtras {
4431
4514
  transitions?: Record<string, string>;
@@ -4645,6 +4728,22 @@ declare function resolveTokens(theme: PersonaTheme): Record<string, ResolvedToke
4645
4728
  declare function validateTheme(theme: Partial<PersonaTheme>): ThemeValidationResult;
4646
4729
  declare function createTheme(userConfig?: Partial<PersonaTheme>, options?: CreateThemeOptions): PersonaTheme;
4647
4730
  declare function themeToCssVariables(theme: PersonaTheme): Record<string, string>;
4731
+ /**
4732
+ * Stable `data-persona-theme-zone` values applied to key widget regions.
4733
+ * Visual editors should use `[data-persona-theme-zone="header"]` selectors
4734
+ * rather than internal class names.
4735
+ */
4736
+ declare const THEME_ZONES: {
4737
+ readonly header: "Widget header bar";
4738
+ readonly messages: "Message list area";
4739
+ readonly 'user-message': "User message bubble";
4740
+ readonly 'assistant-message': "Assistant message bubble";
4741
+ readonly composer: "Footer / composer area";
4742
+ readonly container: "Main widget container";
4743
+ readonly 'artifact-pane': "Artifact sidebar";
4744
+ readonly 'artifact-toolbar': "Artifact toolbar";
4745
+ };
4746
+ type ThemeZone = keyof typeof THEME_ZONES;
4648
4747
 
4649
4748
  type ColorScheme = 'light' | 'dark' | 'auto';
4650
4749
  interface PersonaWidgetConfig {
@@ -4885,6 +4984,36 @@ declare const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig>;
4885
4984
  */
4886
4985
  declare function mergeWithDefaults(config?: Partial<AgentWidgetConfig>): Partial<AgentWidgetConfig>;
4887
4986
 
4987
+ /**
4988
+ * A named preset containing partial widget configuration.
4989
+ * Apply with: `createAgentExperience(el, { ...PRESET_SHOP.config, apiUrl: '...' })`
4990
+ * or via IIFE: `{ ...AgentWidget.PRESETS.shop.config, apiUrl: '...' }`
4991
+ */
4992
+ interface WidgetPreset {
4993
+ id: string;
4994
+ label: string;
4995
+ config: Partial<AgentWidgetConfig>;
4996
+ }
4997
+ /**
4998
+ * Shopping / e-commerce preset.
4999
+ * Dark header, rounded launchers, shopping-oriented copy.
5000
+ */
5001
+ declare const PRESET_SHOP: WidgetPreset;
5002
+ /**
5003
+ * Minimal preset.
5004
+ * Stripped-down header, no launcher button, suitable for inline embeds.
5005
+ */
5006
+ declare const PRESET_MINIMAL: WidgetPreset;
5007
+ /**
5008
+ * Fullscreen assistant preset.
5009
+ * No launcher, content-max-width constrained, minimal header.
5010
+ */
5011
+ declare const PRESET_FULLSCREEN: WidgetPreset;
5012
+ /** All named presets keyed by ID. */
5013
+ declare const PRESETS: Record<string, WidgetPreset>;
5014
+ /** Look up a preset by ID. */
5015
+ declare function getPreset(id: string): WidgetPreset | undefined;
5016
+
4888
5017
  interface HeaderElements {
4889
5018
  header: HTMLElement;
4890
5019
  iconHolder: HTMLElement;
@@ -4975,4 +5104,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
4975
5104
  declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
4976
5105
  declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
4977
5106
 
4978
- export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateStandardBubbleOptions, type CreateThemeOptions, DEFAULT_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DomContextMode, type DomContextOptions, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComponentMiddleware, createComponentStreamParser, createDirectivePostprocessor, createFlexibleJsonStreamParser, createImagePart, createJsonStreamParser, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, migrateV1Theme, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };
5107
+ export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateStandardBubbleOptions, type CreateThemeOptions, DEFAULT_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DomContextMode, type DomContextOptions, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDirectivePostprocessor, createFlexibleJsonStreamParser, createImagePart, createJsonStreamParser, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, migrateV1Theme, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };