@runtypelabs/persona 2.0.0 → 2.2.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;
@@ -814,6 +822,28 @@ type AgentWidgetTheme = {
814
822
  * @default "16px"
815
823
  */
816
824
  panelBorderRadius?: string;
825
+ /**
826
+ * Box-shadow for user message bubbles (bubble message layout).
827
+ * @example "none" | "0 1px 2px rgba(0,0,0,0.05)"
828
+ */
829
+ messageUserShadow?: string;
830
+ /**
831
+ * Box-shadow for assistant message bubbles (bubble message layout).
832
+ * Overrides the default subtle assistant shadow when set.
833
+ */
834
+ messageAssistantShadow?: string;
835
+ /**
836
+ * Box-shadow for tool-call / function-call rows.
837
+ */
838
+ toolBubbleShadow?: string;
839
+ /**
840
+ * Box-shadow for reasoning (“thinking”) rows.
841
+ */
842
+ reasoningBubbleShadow?: string;
843
+ /**
844
+ * Box-shadow on the composer (input) container.
845
+ */
846
+ composerShadow?: string;
817
847
  };
818
848
  type AgentWidgetDockConfig = {
819
849
  /**
@@ -1208,6 +1238,8 @@ type AgentWidgetApprovalConfig = {
1208
1238
  }, decision: 'approved' | 'denied') => Promise<Response | ReadableStream<Uint8Array> | void>;
1209
1239
  };
1210
1240
  type AgentWidgetToolCallConfig = {
1241
+ /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
1242
+ shadow?: string;
1211
1243
  backgroundColor?: string;
1212
1244
  borderColor?: string;
1213
1245
  borderWidth?: string;
@@ -1456,6 +1488,12 @@ type AgentWidgetHeaderLayoutConfig = {
1456
1488
  trailingActions?: AgentWidgetHeaderTrailingAction[];
1457
1489
  /** Called when a `trailingActions` button is clicked. */
1458
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;
1459
1497
  };
1460
1498
  /**
1461
1499
  * Avatar configuration for message bubbles
@@ -4303,6 +4341,8 @@ interface MessageTokens {
4303
4341
  background: TokenReference<'color'>;
4304
4342
  text: TokenReference<'color'>;
4305
4343
  borderRadius: TokenReference<'radius'>;
4344
+ /** User bubble box-shadow (token ref or raw CSS, e.g. `none`). */
4345
+ shadow?: string;
4306
4346
  };
4307
4347
  assistant: {
4308
4348
  background: TokenReference<'color'>;
@@ -4371,6 +4411,52 @@ interface AttachmentTokens {
4371
4411
  border: TokenReference<'color'>;
4372
4412
  };
4373
4413
  }
4414
+ /** Tool-call row chrome (collapsible tool bubbles). */
4415
+ interface ToolBubbleTokens {
4416
+ /** Box-shadow for tool bubbles (token ref or raw CSS, e.g. `none`). */
4417
+ shadow: string;
4418
+ }
4419
+ /** Reasoning / “thinking” row chrome. */
4420
+ interface ReasoningBubbleTokens {
4421
+ shadow: string;
4422
+ }
4423
+ /** Composer (message input) chrome. */
4424
+ interface ComposerChromeTokens {
4425
+ /** Box-shadow on the composer form (raw CSS, e.g. `none`). */
4426
+ shadow: string;
4427
+ }
4428
+ /** Artifact toolbar chrome. */
4429
+ interface ArtifactToolbarTokens {
4430
+ iconHoverColor?: string;
4431
+ iconHoverBackground?: string;
4432
+ iconPadding?: string;
4433
+ iconBorderRadius?: string;
4434
+ iconBorder?: string;
4435
+ toggleGroupGap?: string;
4436
+ toggleBorderRadius?: string;
4437
+ copyBackground?: string;
4438
+ copyBorder?: string;
4439
+ copyColor?: string;
4440
+ copyBorderRadius?: string;
4441
+ copyPadding?: string;
4442
+ copyMenuBackground?: string;
4443
+ copyMenuBorder?: string;
4444
+ copyMenuShadow?: string;
4445
+ copyMenuBorderRadius?: string;
4446
+ copyMenuItemHoverBackground?: string;
4447
+ }
4448
+ /** Artifact tab strip chrome. */
4449
+ interface ArtifactTabTokens {
4450
+ background?: string;
4451
+ activeBackground?: string;
4452
+ activeBorder?: string;
4453
+ borderRadius?: string;
4454
+ textColor?: string;
4455
+ }
4456
+ /** Artifact pane chrome. */
4457
+ interface ArtifactPaneTokens {
4458
+ toolbarBackground?: string;
4459
+ }
4374
4460
  interface ComponentTokens {
4375
4461
  button: ButtonTokens;
4376
4462
  input: InputTokens;
@@ -4383,6 +4469,15 @@ interface ComponentTokens {
4383
4469
  voice: VoiceTokens;
4384
4470
  approval: ApprovalTokens;
4385
4471
  attachment: AttachmentTokens;
4472
+ toolBubble: ToolBubbleTokens;
4473
+ reasoningBubble: ReasoningBubbleTokens;
4474
+ composer: ComposerChromeTokens;
4475
+ /** Artifact toolbar, tab strip, and pane chrome. */
4476
+ artifact?: {
4477
+ toolbar?: ArtifactToolbarTokens;
4478
+ tab?: ArtifactTabTokens;
4479
+ pane?: ArtifactPaneTokens;
4480
+ };
4386
4481
  }
4387
4482
  interface PaletteExtras {
4388
4483
  transitions?: Record<string, string>;
@@ -4602,6 +4697,22 @@ declare function resolveTokens(theme: PersonaTheme): Record<string, ResolvedToke
4602
4697
  declare function validateTheme(theme: Partial<PersonaTheme>): ThemeValidationResult;
4603
4698
  declare function createTheme(userConfig?: Partial<PersonaTheme>, options?: CreateThemeOptions): PersonaTheme;
4604
4699
  declare function themeToCssVariables(theme: PersonaTheme): Record<string, string>;
4700
+ /**
4701
+ * Stable `data-persona-theme-zone` values applied to key widget regions.
4702
+ * Visual editors should use `[data-persona-theme-zone="header"]` selectors
4703
+ * rather than internal class names.
4704
+ */
4705
+ declare const THEME_ZONES: {
4706
+ readonly header: "Widget header bar";
4707
+ readonly messages: "Message list area";
4708
+ readonly 'user-message': "User message bubble";
4709
+ readonly 'assistant-message': "Assistant message bubble";
4710
+ readonly composer: "Footer / composer area";
4711
+ readonly container: "Main widget container";
4712
+ readonly 'artifact-pane': "Artifact sidebar";
4713
+ readonly 'artifact-toolbar': "Artifact toolbar";
4714
+ };
4715
+ type ThemeZone = keyof typeof THEME_ZONES;
4605
4716
 
4606
4717
  type ColorScheme = 'light' | 'dark' | 'auto';
4607
4718
  interface PersonaWidgetConfig {
@@ -4842,6 +4953,36 @@ declare const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig>;
4842
4953
  */
4843
4954
  declare function mergeWithDefaults(config?: Partial<AgentWidgetConfig>): Partial<AgentWidgetConfig>;
4844
4955
 
4956
+ /**
4957
+ * A named preset containing partial widget configuration.
4958
+ * Apply with: `createAgentExperience(el, { ...PRESET_SHOP.config, apiUrl: '...' })`
4959
+ * or via IIFE: `{ ...AgentWidget.PRESETS.shop.config, apiUrl: '...' }`
4960
+ */
4961
+ interface WidgetPreset {
4962
+ id: string;
4963
+ label: string;
4964
+ config: Partial<AgentWidgetConfig>;
4965
+ }
4966
+ /**
4967
+ * Shopping / e-commerce preset.
4968
+ * Dark header, rounded launchers, shopping-oriented copy.
4969
+ */
4970
+ declare const PRESET_SHOP: WidgetPreset;
4971
+ /**
4972
+ * Minimal preset.
4973
+ * Stripped-down header, no launcher button, suitable for inline embeds.
4974
+ */
4975
+ declare const PRESET_MINIMAL: WidgetPreset;
4976
+ /**
4977
+ * Fullscreen assistant preset.
4978
+ * No launcher, content-max-width constrained, minimal header.
4979
+ */
4980
+ declare const PRESET_FULLSCREEN: WidgetPreset;
4981
+ /** All named presets keyed by ID. */
4982
+ declare const PRESETS: Record<string, WidgetPreset>;
4983
+ /** Look up a preset by ID. */
4984
+ declare function getPreset(id: string): WidgetPreset | undefined;
4985
+
4845
4986
  interface HeaderElements {
4846
4987
  header: HTMLElement;
4847
4988
  iconHolder: HTMLElement;
@@ -4932,4 +5073,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
4932
5073
  declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
4933
5074
  declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
4934
5075
 
4935
- 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 };
5076
+ 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 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, 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, 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;
@@ -814,6 +822,28 @@ type AgentWidgetTheme = {
814
822
  * @default "16px"
815
823
  */
816
824
  panelBorderRadius?: string;
825
+ /**
826
+ * Box-shadow for user message bubbles (bubble message layout).
827
+ * @example "none" | "0 1px 2px rgba(0,0,0,0.05)"
828
+ */
829
+ messageUserShadow?: string;
830
+ /**
831
+ * Box-shadow for assistant message bubbles (bubble message layout).
832
+ * Overrides the default subtle assistant shadow when set.
833
+ */
834
+ messageAssistantShadow?: string;
835
+ /**
836
+ * Box-shadow for tool-call / function-call rows.
837
+ */
838
+ toolBubbleShadow?: string;
839
+ /**
840
+ * Box-shadow for reasoning (“thinking”) rows.
841
+ */
842
+ reasoningBubbleShadow?: string;
843
+ /**
844
+ * Box-shadow on the composer (input) container.
845
+ */
846
+ composerShadow?: string;
817
847
  };
818
848
  type AgentWidgetDockConfig = {
819
849
  /**
@@ -1208,6 +1238,8 @@ type AgentWidgetApprovalConfig = {
1208
1238
  }, decision: 'approved' | 'denied') => Promise<Response | ReadableStream<Uint8Array> | void>;
1209
1239
  };
1210
1240
  type AgentWidgetToolCallConfig = {
1241
+ /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
1242
+ shadow?: string;
1211
1243
  backgroundColor?: string;
1212
1244
  borderColor?: string;
1213
1245
  borderWidth?: string;
@@ -1456,6 +1488,12 @@ type AgentWidgetHeaderLayoutConfig = {
1456
1488
  trailingActions?: AgentWidgetHeaderTrailingAction[];
1457
1489
  /** Called when a `trailingActions` button is clicked. */
1458
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;
1459
1497
  };
1460
1498
  /**
1461
1499
  * Avatar configuration for message bubbles
@@ -4303,6 +4341,8 @@ interface MessageTokens {
4303
4341
  background: TokenReference<'color'>;
4304
4342
  text: TokenReference<'color'>;
4305
4343
  borderRadius: TokenReference<'radius'>;
4344
+ /** User bubble box-shadow (token ref or raw CSS, e.g. `none`). */
4345
+ shadow?: string;
4306
4346
  };
4307
4347
  assistant: {
4308
4348
  background: TokenReference<'color'>;
@@ -4371,6 +4411,52 @@ interface AttachmentTokens {
4371
4411
  border: TokenReference<'color'>;
4372
4412
  };
4373
4413
  }
4414
+ /** Tool-call row chrome (collapsible tool bubbles). */
4415
+ interface ToolBubbleTokens {
4416
+ /** Box-shadow for tool bubbles (token ref or raw CSS, e.g. `none`). */
4417
+ shadow: string;
4418
+ }
4419
+ /** Reasoning / “thinking” row chrome. */
4420
+ interface ReasoningBubbleTokens {
4421
+ shadow: string;
4422
+ }
4423
+ /** Composer (message input) chrome. */
4424
+ interface ComposerChromeTokens {
4425
+ /** Box-shadow on the composer form (raw CSS, e.g. `none`). */
4426
+ shadow: string;
4427
+ }
4428
+ /** Artifact toolbar chrome. */
4429
+ interface ArtifactToolbarTokens {
4430
+ iconHoverColor?: string;
4431
+ iconHoverBackground?: string;
4432
+ iconPadding?: string;
4433
+ iconBorderRadius?: string;
4434
+ iconBorder?: string;
4435
+ toggleGroupGap?: string;
4436
+ toggleBorderRadius?: string;
4437
+ copyBackground?: string;
4438
+ copyBorder?: string;
4439
+ copyColor?: string;
4440
+ copyBorderRadius?: string;
4441
+ copyPadding?: string;
4442
+ copyMenuBackground?: string;
4443
+ copyMenuBorder?: string;
4444
+ copyMenuShadow?: string;
4445
+ copyMenuBorderRadius?: string;
4446
+ copyMenuItemHoverBackground?: string;
4447
+ }
4448
+ /** Artifact tab strip chrome. */
4449
+ interface ArtifactTabTokens {
4450
+ background?: string;
4451
+ activeBackground?: string;
4452
+ activeBorder?: string;
4453
+ borderRadius?: string;
4454
+ textColor?: string;
4455
+ }
4456
+ /** Artifact pane chrome. */
4457
+ interface ArtifactPaneTokens {
4458
+ toolbarBackground?: string;
4459
+ }
4374
4460
  interface ComponentTokens {
4375
4461
  button: ButtonTokens;
4376
4462
  input: InputTokens;
@@ -4383,6 +4469,15 @@ interface ComponentTokens {
4383
4469
  voice: VoiceTokens;
4384
4470
  approval: ApprovalTokens;
4385
4471
  attachment: AttachmentTokens;
4472
+ toolBubble: ToolBubbleTokens;
4473
+ reasoningBubble: ReasoningBubbleTokens;
4474
+ composer: ComposerChromeTokens;
4475
+ /** Artifact toolbar, tab strip, and pane chrome. */
4476
+ artifact?: {
4477
+ toolbar?: ArtifactToolbarTokens;
4478
+ tab?: ArtifactTabTokens;
4479
+ pane?: ArtifactPaneTokens;
4480
+ };
4386
4481
  }
4387
4482
  interface PaletteExtras {
4388
4483
  transitions?: Record<string, string>;
@@ -4602,6 +4697,22 @@ declare function resolveTokens(theme: PersonaTheme): Record<string, ResolvedToke
4602
4697
  declare function validateTheme(theme: Partial<PersonaTheme>): ThemeValidationResult;
4603
4698
  declare function createTheme(userConfig?: Partial<PersonaTheme>, options?: CreateThemeOptions): PersonaTheme;
4604
4699
  declare function themeToCssVariables(theme: PersonaTheme): Record<string, string>;
4700
+ /**
4701
+ * Stable `data-persona-theme-zone` values applied to key widget regions.
4702
+ * Visual editors should use `[data-persona-theme-zone="header"]` selectors
4703
+ * rather than internal class names.
4704
+ */
4705
+ declare const THEME_ZONES: {
4706
+ readonly header: "Widget header bar";
4707
+ readonly messages: "Message list area";
4708
+ readonly 'user-message': "User message bubble";
4709
+ readonly 'assistant-message': "Assistant message bubble";
4710
+ readonly composer: "Footer / composer area";
4711
+ readonly container: "Main widget container";
4712
+ readonly 'artifact-pane': "Artifact sidebar";
4713
+ readonly 'artifact-toolbar': "Artifact toolbar";
4714
+ };
4715
+ type ThemeZone = keyof typeof THEME_ZONES;
4605
4716
 
4606
4717
  type ColorScheme = 'light' | 'dark' | 'auto';
4607
4718
  interface PersonaWidgetConfig {
@@ -4842,6 +4953,36 @@ declare const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig>;
4842
4953
  */
4843
4954
  declare function mergeWithDefaults(config?: Partial<AgentWidgetConfig>): Partial<AgentWidgetConfig>;
4844
4955
 
4956
+ /**
4957
+ * A named preset containing partial widget configuration.
4958
+ * Apply with: `createAgentExperience(el, { ...PRESET_SHOP.config, apiUrl: '...' })`
4959
+ * or via IIFE: `{ ...AgentWidget.PRESETS.shop.config, apiUrl: '...' }`
4960
+ */
4961
+ interface WidgetPreset {
4962
+ id: string;
4963
+ label: string;
4964
+ config: Partial<AgentWidgetConfig>;
4965
+ }
4966
+ /**
4967
+ * Shopping / e-commerce preset.
4968
+ * Dark header, rounded launchers, shopping-oriented copy.
4969
+ */
4970
+ declare const PRESET_SHOP: WidgetPreset;
4971
+ /**
4972
+ * Minimal preset.
4973
+ * Stripped-down header, no launcher button, suitable for inline embeds.
4974
+ */
4975
+ declare const PRESET_MINIMAL: WidgetPreset;
4976
+ /**
4977
+ * Fullscreen assistant preset.
4978
+ * No launcher, content-max-width constrained, minimal header.
4979
+ */
4980
+ declare const PRESET_FULLSCREEN: WidgetPreset;
4981
+ /** All named presets keyed by ID. */
4982
+ declare const PRESETS: Record<string, WidgetPreset>;
4983
+ /** Look up a preset by ID. */
4984
+ declare function getPreset(id: string): WidgetPreset | undefined;
4985
+
4845
4986
  interface HeaderElements {
4846
4987
  header: HTMLElement;
4847
4988
  iconHolder: HTMLElement;
@@ -4932,4 +5073,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
4932
5073
  declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
4933
5074
  declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
4934
5075
 
4935
- 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 };
5076
+ 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 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, 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, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };