@runtypelabs/persona 4.17.1 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/chunk-3I2S3I5P.js +1 -0
  2. package/dist/chunk-76IELU7F.js +1 -0
  3. package/dist/chunk-EFJBUH5F.js +1 -0
  4. package/dist/chunk-PDPVORUF.js +1 -0
  5. package/dist/chunk-Q735PSZL.js +1 -0
  6. package/dist/chunk-VK6JOIYJ.js +1 -0
  7. package/dist/codegen.cjs +4 -4
  8. package/dist/codegen.js +4 -4
  9. package/dist/{context-mentions-BTSTIBFC.js → context-mentions-MJL6S6P2.js} +1 -1
  10. package/dist/context-mentions.cjs +9 -8
  11. package/dist/context-mentions.d.cts +1212 -14
  12. package/dist/context-mentions.d.ts +1212 -14
  13. package/dist/context-mentions.js +9 -8
  14. package/dist/event-stream-view-4EZ7BGFK.js +1 -0
  15. package/dist/event-stream-view.cjs +129 -0
  16. package/dist/event-stream-view.d.cts +8384 -0
  17. package/dist/event-stream-view.d.ts +8384 -0
  18. package/dist/event-stream-view.js +129 -0
  19. package/dist/history-view-BD6OXLNA.js +898 -0
  20. package/dist/history-view.cjs +898 -0
  21. package/dist/history-view.d.cts +1461 -0
  22. package/dist/history-view.d.ts +1461 -0
  23. package/dist/history-view.js +898 -0
  24. package/dist/index.cjs +77 -77
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +1987 -17
  27. package/dist/index.d.ts +1987 -17
  28. package/dist/index.global.js +67 -66
  29. package/dist/index.global.js.map +1 -1
  30. package/dist/index.js +77 -77
  31. package/dist/index.js.map +1 -1
  32. package/dist/launcher.global.js +5 -4
  33. package/dist/launcher.global.js.map +1 -1
  34. package/dist/plugin-kit.cjs +1 -1
  35. package/dist/plugin-kit.d.cts +0 -8
  36. package/dist/plugin-kit.d.ts +0 -8
  37. package/dist/plugin-kit.js +1 -1
  38. package/dist/smart-dom-reader.d.cts +1212 -14
  39. package/dist/smart-dom-reader.d.ts +1212 -14
  40. package/dist/theme-editor-preview.cjs +970 -73
  41. package/dist/theme-editor-preview.d.cts +1331 -15
  42. package/dist/theme-editor-preview.d.ts +1331 -15
  43. package/dist/theme-editor-preview.js +81 -81
  44. package/dist/theme-editor.cjs +7 -7
  45. package/dist/theme-editor.d.cts +1215 -15
  46. package/dist/theme-editor.d.ts +1215 -15
  47. package/dist/theme-editor.js +9 -9
  48. package/dist/theme-reference.cjs +1 -1
  49. package/dist/theme-reference.d.cts +226 -7
  50. package/dist/theme-reference.d.ts +226 -7
  51. package/dist/theme-reference.js +1 -1
  52. package/dist/widget.css +1 -1
  53. package/package.json +16 -4
  54. package/src/client-history-rest.test.ts +1034 -0
  55. package/src/client-visitor-history.test.ts +596 -0
  56. package/src/client.ts +1040 -24
  57. package/src/components/artifact-inline.ts +8 -1
  58. package/src/components/artifact-pane.test.ts +278 -1
  59. package/src/components/artifact-pane.ts +135 -67
  60. package/src/components/artifact-preview.test.ts +14 -1
  61. package/src/components/artifact-preview.ts +9 -0
  62. package/src/components/header-builder.ts +3 -0
  63. package/src/components/header-layouts.test.ts +171 -7
  64. package/src/components/header-layouts.ts +83 -53
  65. package/src/components/header-parts.test.ts +154 -1
  66. package/src/components/header-parts.ts +266 -138
  67. package/src/components/history-confirm-dialog.ts +177 -0
  68. package/src/components/history-shell-copy.ts +99 -0
  69. package/src/components/history-view/announcer.ts +40 -0
  70. package/src/components/history-view/copy.ts +105 -0
  71. package/src/components/history-view/css.ts +1078 -0
  72. package/src/components/history-view/grouping.test.ts +142 -0
  73. package/src/components/history-view/grouping.ts +142 -0
  74. package/src/components/history-view/icons.ts +73 -0
  75. package/src/components/history-view/rows.ts +341 -0
  76. package/src/components/history-view/state.ts +309 -0
  77. package/src/components/history-view.test.ts +2660 -0
  78. package/src/components/history-view.ts +1891 -0
  79. package/src/components/launcher-surface.test.ts +133 -0
  80. package/src/components/launcher.test.ts +18 -0
  81. package/src/components/launcher.ts +7 -7
  82. package/src/components/panel.ts +17 -7
  83. package/src/components/welcome.ts +72 -2
  84. package/src/defaults.ts +36 -3
  85. package/src/event-stream-view-bundle.test.ts +69 -0
  86. package/src/event-stream-view-entry.ts +19 -0
  87. package/src/event-stream-view-loader.ts +31 -0
  88. package/src/event-stream-view.ts +19 -0
  89. package/src/generated/runtype-openapi-contract.ts +1 -0
  90. package/src/history-render.ts +325 -0
  91. package/src/history-view-bundle.test.ts +78 -0
  92. package/src/history-view-entry.ts +41 -0
  93. package/src/history-view-loader.test.ts +30 -0
  94. package/src/history-view-loader.ts +32 -0
  95. package/src/history-view.ts +28 -0
  96. package/src/index-core.ts +50 -2
  97. package/src/index-global.ts +55 -0
  98. package/src/internal/demo-history-provider.test.ts +402 -0
  99. package/src/internal/demo-history-provider.ts +689 -0
  100. package/src/internal/history-provider-registry.ts +25 -0
  101. package/src/internal/history-provider.ts +150 -0
  102. package/src/internal/runtype-history-provider.test.ts +313 -0
  103. package/src/internal/runtype-history-provider.ts +240 -0
  104. package/src/plugin-kit.test.ts +16 -0
  105. package/src/plugin-kit.ts +13 -5
  106. package/src/plugins/types.ts +177 -1
  107. package/src/session-history.test.ts +1397 -0
  108. package/src/session.ts +1200 -26
  109. package/src/styles/widget-styles.test.ts +133 -0
  110. package/src/styles/widget.css +227 -8
  111. package/src/theme-editor/preview-utils.test.ts +19 -0
  112. package/src/theme-editor/preview-utils.ts +15 -1
  113. package/src/theme-editor/preview.ts +7 -1
  114. package/src/theme-editor/role-mappings.ts +4 -1
  115. package/src/theme-editor/sections.test.ts +168 -1
  116. package/src/theme-editor/sections.ts +136 -7
  117. package/src/theme-editor/webmcp/summary.ts +16 -2
  118. package/src/theme-reference.ts +20 -6
  119. package/src/types/theme.ts +213 -7
  120. package/src/types.ts +927 -7
  121. package/src/ui.artifact-rail-resize.test.ts +235 -0
  122. package/src/ui.attachments-drop.test.ts +1 -0
  123. package/src/ui.header-update-stability.test.ts +2 -2
  124. package/src/ui.history-chunk.test.ts +72 -0
  125. package/src/ui.history-config-provider.test.ts +318 -0
  126. package/src/ui.history-controller.test.ts +711 -0
  127. package/src/ui.history-lifecycle.test.ts +456 -0
  128. package/src/ui.history-render-hooks.test.ts +904 -0
  129. package/src/ui.history-shell.test.ts +1887 -0
  130. package/src/ui.rail-overlay.test.ts +573 -0
  131. package/src/ui.rail-resize.test.ts +284 -0
  132. package/src/ui.rebuild-composer.test.ts +21 -0
  133. package/src/ui.render-welcome.test.ts +42 -0
  134. package/src/ui.shortcuts.test.ts +166 -0
  135. package/src/ui.ts +3071 -240
  136. package/src/utils/__fixtures__/client-conversation-history-wire.json +108 -0
  137. package/src/utils/artifact-file.ts +15 -0
  138. package/src/utils/artifact-gate.test.ts +4 -0
  139. package/src/utils/artifact-gate.ts +13 -17
  140. package/src/utils/artifact-resize.test.ts +28 -0
  141. package/src/utils/artifact-resize.ts +9 -2
  142. package/src/utils/buttons.ts +188 -1
  143. package/src/utils/config-merge.test.ts +91 -0
  144. package/src/utils/dropdown.ts +10 -1
  145. package/src/utils/history-messages.test.ts +284 -0
  146. package/src/utils/history-messages.ts +284 -0
  147. package/src/utils/icons.ts +3 -0
  148. package/src/utils/shortcuts.test.ts +288 -0
  149. package/src/utils/shortcuts.ts +221 -0
  150. package/src/utils/theme.test.ts +501 -4
  151. package/src/utils/theme.ts +42 -3
  152. package/src/utils/tokens.ts +153 -15
  153. package/src/utils/tooltip-timing.ts +4 -0
  154. package/src/utils/tooltip.test.ts +249 -7
  155. package/src/utils/tooltip.ts +146 -4
  156. package/src/utils/visitor-store.test.ts +425 -0
  157. package/src/utils/visitor-store.ts +337 -0
  158. package/dist/chunk-QJ4LV2KW.js +0 -1
@@ -159,6 +159,10 @@ export interface SemanticTokens {
159
159
 
160
160
  export interface ComponentTokenSet {
161
161
  background?: TokenReference<'color'>;
162
+ /**
163
+ * Text and glyph color on `background`. `HeaderTokens` also derives its
164
+ * unset text, icon, and border colors from this pair.
165
+ */
162
166
  foreground?: TokenReference<'color'>;
163
167
  border?: TokenReference<'color'>;
164
168
  borderRadius?: TokenReference<'radius'>;
@@ -189,6 +193,15 @@ export interface LauncherTokens extends ComponentTokenSet {
189
193
  size: string;
190
194
  iconSize: string;
191
195
  shadow: TokenReference<'shadow'>;
196
+ /**
197
+ * Stroke weight of the launcher glyphs, the agent icon and the
198
+ * call-to-action arrow alike. Unitless, and must be a STRING (`"1.75"`,
199
+ * never `1.75`: the token resolver silently skips numbers). Applied as CSS,
200
+ * so it beats the attribute the icons render with. Inert for emoji / image
201
+ * launchers, which have no svg.
202
+ * @default "1.5", matching the header's controlStrokeWidth
203
+ */
204
+ iconStrokeWidth?: string;
192
205
  }
193
206
 
194
207
  export interface PanelTokens extends ComponentTokenSet {
@@ -212,28 +225,215 @@ export interface TextStyleTokens {
212
225
  color?: TokenReference<'color'>;
213
226
  }
214
227
 
228
+ /**
229
+ * Header band tokens. `background` plus `foreground` (inherited from
230
+ * `ComponentTokenSet`) is the pair that colors the band: `foreground` anchors
231
+ * the header text, and every text, action-icon, and border color the theme
232
+ * leaves unset derives from the pair. Derivation only fills unset keys, so an
233
+ * explicit key always wins, and `iconBackground` / `iconForeground` (the avatar
234
+ * tile) keep their own defaults rather than deriving.
235
+ */
215
236
  export interface HeaderTokens extends ComponentTokenSet {
216
237
  background: TokenReference<'color'>;
217
- border: TokenReference<'color'>;
238
+ /**
239
+ * Hairline under the header. Unset, it derives as
240
+ * `color-mix(in srgb, foreground 14%, background)`, then the divider color.
241
+ */
242
+ border?: TokenReference<'color'>;
218
243
  borderRadius: TokenReference<'radius'>;
219
244
  /** Background of the rounded avatar tile next to the title (Lucide / emoji / image). */
220
245
  iconBackground: TokenReference<'color'>;
221
246
  /** Foreground (glyph stroke or emoji text) on the header avatar tile. */
222
247
  iconForeground: TokenReference<'color'>;
223
- /** Legacy alias of `title.color`; `title.color` wins when both are set. */
224
- titleForeground: TokenReference<'color'>;
225
- /** Legacy alias of `subtitle.color`; `subtitle.color` wins when both are set. */
226
- subtitleForeground: TokenReference<'color'>;
248
+ /**
249
+ * Legacy alias of `title.color`; `title.color` wins when both are set.
250
+ * Unset, the title takes `foreground`, then the primary color.
251
+ */
252
+ titleForeground?: TokenReference<'color'>;
253
+ /**
254
+ * Legacy alias of `subtitle.color`; `subtitle.color` wins when both are set.
255
+ * Unset, the subtitle takes `color-mix(in srgb, foreground 72%, background)`,
256
+ * then the muted text color.
257
+ */
258
+ subtitleForeground?: TokenReference<'color'>;
227
259
  /** Header title typography (next to the icon, or minimal layout title). */
228
260
  title?: TextStyleTokens;
229
261
  /** Header subtitle typography, for the line under the title. */
230
262
  subtitle?: TextStyleTokens;
231
- /** Default color for clear / close icon buttons when launcher overrides are unset. */
232
- actionIconForeground: TokenReference<'color'>;
263
+ /**
264
+ * Default color for clear / close icon buttons when launcher overrides are
265
+ * unset. Itself unset, it takes the same
266
+ * `color-mix(in srgb, foreground 72%, background)` as the subtitle, then the
267
+ * muted text color.
268
+ */
269
+ actionIconForeground?: TokenReference<'color'>;
270
+ /**
271
+ * Edge of every header icon button: close, clear chat, `trailingActions`, and
272
+ * the Messages toggle. Per-control config keys (`launcher.closeButtonSize`,
273
+ * `launcher.clearChat.size`) still win. Coarse pointers floor the hit area at
274
+ * 40px regardless. @default "32px"
275
+ */
276
+ controlSize?: string;
277
+ /** Glyph box inside a header control. @default "20px" */
278
+ controlIconSize?: string;
279
+ /**
280
+ * Stroke weight of the glyph inside a header control. Unitless, as an SVG
281
+ * stroke-width (e.g. `"1.75"`). Sparse-viewBox glyphs (the close X) render
282
+ * at 0.7 of it so their heavier visible weight still matches a dense
283
+ * sibling. @default "1.5"
284
+ */
285
+ controlStrokeWidth?: string;
233
286
  /** Box-shadow on the header (e.g., a fade shadow to replace the default border). */
234
287
  shadow?: string;
235
288
  /** Override the header bottom border (e.g., `none`). */
236
289
  borderBottom?: string;
290
+ /**
291
+ * Floor for the header strip's height (e.g. `"56px"`). Pin it together with
292
+ * `components.history.railHeader.minHeight` so the Messages rail header and
293
+ * the conversation header read as one continuous band.
294
+ */
295
+ minHeight?: string;
296
+ }
297
+
298
+ /** Messages (conversation history) surfaces. */
299
+ export interface HistoryTokens {
300
+ /**
301
+ * The Messages rail's own top strip, which runs beside the widget header
302
+ * when `features.history.presentation` resolves to `rail`.
303
+ */
304
+ railHeader?: {
305
+ /** Strip background. Defaults to the rail's surface color. */
306
+ background?: TokenReference<'color'>;
307
+ /** Full border-bottom shorthand (raw CSS, e.g. `"1px solid #e5e7eb"`). @default "0" */
308
+ border?: string;
309
+ /** Strip height floor. Defaults to `components.header.minHeight`, then 56px. */
310
+ minHeight?: string;
311
+ /**
312
+ * The strip's view title ("Messages"). 14px/600 in the text color by
313
+ * default; set the type keys to restyle it.
314
+ */
315
+ title?: TextStyleTokens;
316
+ };
317
+ /**
318
+ * The "Conversations" heading over the list block. Visible in rail
319
+ * presentation only (the panel keeps it screen-reader-only). 14px/600 in
320
+ * the text color by default. Every key is pinned in the widget CSS, so
321
+ * host-page heading rules never restyle it.
322
+ */
323
+ listHeading?: TextStyleTokens;
324
+ /**
325
+ * The muted sub-headers inside the Messages surface: date groups ("Today",
326
+ * "Yesterday") and rail nav section titles (`features.history.rail.sections`
327
+ * `title`, e.g. "Workspace"). 13px/500 in the muted text color in the rail
328
+ * (the panel keeps date groups screen-reader-only). Every key is pinned in
329
+ * the widget CSS, so host-page heading rules never restyle them.
330
+ */
331
+ groupHeading?: TextStyleTokens;
332
+ /**
333
+ * The floating rail that a collapsed
334
+ * `features.history.rail.collapsedBehavior: "overlay"` opens on hover. It
335
+ * hangs below the trigger in the conversation header; its width and edge
336
+ * stay `features.history.rail` geometry, not tokens.
337
+ */
338
+ overlay?: {
339
+ /** Gap from the trigger, the docked edge, and the bottom. @default "8px" */
340
+ margin?: string;
341
+ /** Corner radius, on all four corners. @default "16px" */
342
+ borderRadius?: string;
343
+ /** Elevation over the conversation. @default "0 12px 40px rgba(0, 0, 0, 0.25)" */
344
+ shadow?: string;
345
+ /** Surface behind the rail. Defaults to the rail's own surface color. */
346
+ background?: TokenReference<'color'>;
347
+ };
348
+ /**
349
+ * Destructive action text (row Delete, "Delete all conversations").
350
+ * Defaults to `palette.colors.error.600` in light schemes and a lighter
351
+ * red in the built-in dark theme so the 14px labels keep AA contrast.
352
+ */
353
+ dangerForeground?: TokenReference<'color'>;
354
+ /**
355
+ * The delete/forget confirmation dialog the shell shows for destructive
356
+ * history actions. The danger pair is always emitted (`--persona-danger`
357
+ * / `--persona-danger-fg`); scrim and shadow keep the built-in look when
358
+ * unset.
359
+ */
360
+ confirm?: {
361
+ /**
362
+ * Destructive button fill. Defaults to `palette.colors.error.700` in
363
+ * light schemes and `error.600` in the built-in dark theme.
364
+ */
365
+ dangerBackground?: TokenReference<'color'>;
366
+ /** Destructive button label. @default "#ffffff" */
367
+ dangerForeground?: TokenReference<'color'>;
368
+ /** Overlay behind the dialog. @default "rgba(15, 23, 42, 0.45)" */
369
+ scrim?: TokenReference<'color'>;
370
+ /** Card elevation (raw CSS shadow). */
371
+ shadow?: string;
372
+ };
373
+ /** The per-row overflow menu in the Messages list (rail and panel). */
374
+ menu?: {
375
+ /**
376
+ * Menu surface. Defaults to the list surface lifted 8% toward white so
377
+ * the menu reads as elevated in dark schemes.
378
+ */
379
+ background?: TokenReference<'color'>;
380
+ /** Corner radius. @default "12px" */
381
+ borderRadius?: string;
382
+ };
383
+ /**
384
+ * Enter/exit motion of the Messages surface. Only the body slides; the bar
385
+ * is persistent chrome and never animates. Durations are milliseconds and 0
386
+ * disables that leg; `prefers-reduced-motion` always wins over these.
387
+ */
388
+ motion?: {
389
+ /** Entrance slide-and-fade duration: bare ms number, or a CSS time string. @default 180 */
390
+ enterDurationMs?: number | string;
391
+ /** Entrance easing. @default "cubic-bezier(0, 0, 0.2, 1)" */
392
+ enterEasing?: string;
393
+ /** Exit slide-and-fade duration: bare ms number, or a CSS time string. @default 160 */
394
+ exitDurationMs?: number | string;
395
+ /** Exit easing. @default "cubic-bezier(0.4, 0, 1, 1)" */
396
+ exitEasing?: string;
397
+ };
398
+ }
399
+
400
+ /**
401
+ * The portaled icon-control tooltip (header controls, composer buttons) and
402
+ * its trailing shortcut hint chip. Unset keys keep the built-in dark look.
403
+ */
404
+ export interface TooltipTokens {
405
+ /** Bubble and arrow fill. @default "#111827" */
406
+ background?: TokenReference<'color'>;
407
+ /** Label color. @default "#ffffff" */
408
+ foreground?: TokenReference<'color'>;
409
+ /** Trailing shortcut hint color. @default "rgba(255, 255, 255, 0.55)" */
410
+ hintForeground?: TokenReference<'color'>;
411
+ /** Bubble corner radius. Defaults to `palette.radius.sm`. */
412
+ borderRadius?: TokenReference<'radius'>;
413
+ /** Label type size. @default "12px" */
414
+ fontSize?: string;
415
+ /** Bubble inset, full CSS shorthand. @default "6px 12px" */
416
+ padding?: TokenReference<'spacing'>;
417
+ /** Bubble box-shadow (token ref or raw CSS, e.g. `none`). */
418
+ shadow?: string;
419
+ /** Render the caret pointing at the control. @default true */
420
+ arrow?: boolean;
421
+ /** Wrap width. @default "min(320px, calc(100vw - 16px))" */
422
+ maxWidth?: string;
423
+ }
424
+
425
+ /**
426
+ * The hover-revealed action row under a message (copy, vote, read aloud).
427
+ * Unset keys inherit the shared ghost icon-button wash, which is already
428
+ * scheme-aware, so most themes never need this group.
429
+ */
430
+ export interface MessageActionsTokens {
431
+ /** Hover fill. Defaults to `components.button.ghost.hoverBackground`. */
432
+ hoverBackground?: TokenReference<'color'>;
433
+ /** Hover icon color. Defaults to `semantic.colors.text`. */
434
+ hoverForeground?: TokenReference<'color'>;
435
+ /** Button corner radius. Defaults to `palette.radius.md`. */
436
+ borderRadius?: TokenReference<'radius'>;
237
437
  }
238
438
 
239
439
  export interface MessageTokens {
@@ -603,7 +803,13 @@ export interface ComponentTokens {
603
803
  launcher: LauncherTokens;
604
804
  panel: PanelTokens;
605
805
  header: HeaderTokens;
806
+ /** Messages rail chrome. */
807
+ history?: HistoryTokens;
808
+ /** Portaled icon-control tooltip and its shortcut hint chip. */
809
+ tooltip?: TooltipTokens;
606
810
  message: MessageTokens;
811
+ /** Hover-revealed per-message action row (copy, vote, read aloud). */
812
+ messageActions?: MessageActionsTokens;
607
813
  /** Welcome / intro card shown above the message list. */
608
814
  introCard?: IntroCardTokens;
609
815
  /** Markdown surfaces (chat + artifact pane). */