@runtypelabs/persona 4.21.0 → 4.22.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 (78) hide show
  1. package/dist/{approval-ui-RNNBR5R3.js → approval-ui-K7R5Q5OC.js} +1 -1
  2. package/dist/approval-ui.cjs +2 -2
  3. package/dist/approval-ui.d.cts +73 -2
  4. package/dist/approval-ui.d.ts +73 -2
  5. package/dist/approval-ui.js +2 -2
  6. package/dist/artifacts-ui-F4N6VMKF.js +7 -0
  7. package/dist/artifacts-ui.cjs +1 -1
  8. package/dist/artifacts-ui.d.cts +73 -2
  9. package/dist/artifacts-ui.d.ts +73 -2
  10. package/dist/artifacts-ui.js +1 -1
  11. package/dist/chunk-NQLDCJAP.js +4 -0
  12. package/dist/codegen.cjs +1 -1
  13. package/dist/codegen.js +1 -1
  14. package/dist/context-mentions.d.cts +73 -2
  15. package/dist/context-mentions.d.ts +73 -2
  16. package/dist/event-stream-view-FKWDY3UB.js +1 -0
  17. package/dist/event-stream-view.cjs +1 -1
  18. package/dist/event-stream-view.d.cts +73 -2
  19. package/dist/event-stream-view.d.ts +73 -2
  20. package/dist/event-stream-view.js +1 -1
  21. package/dist/forms-ui.d.cts +73 -2
  22. package/dist/forms-ui.d.ts +73 -2
  23. package/dist/index.cjs +66 -66
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +136 -5
  26. package/dist/index.d.ts +136 -5
  27. package/dist/index.global.js +50 -50
  28. package/dist/index.global.js.map +1 -1
  29. package/dist/index.js +67 -67
  30. package/dist/index.js.map +1 -1
  31. package/dist/launcher.global.js +2 -2
  32. package/dist/launcher.global.js.map +1 -1
  33. package/dist/session-reconnect.d.cts +73 -2
  34. package/dist/session-reconnect.d.ts +73 -2
  35. package/dist/smart-dom-reader.d.cts +73 -2
  36. package/dist/smart-dom-reader.d.ts +73 -2
  37. package/dist/theme-editor-preview.cjs +65 -65
  38. package/dist/theme-editor-preview.d.cts +73 -2
  39. package/dist/theme-editor-preview.d.ts +73 -2
  40. package/dist/theme-editor-preview.js +49 -49
  41. package/dist/theme-editor.cjs +4 -4
  42. package/dist/theme-editor.d.cts +73 -2
  43. package/dist/theme-editor.d.ts +73 -2
  44. package/dist/theme-editor.js +2 -2
  45. package/dist/theme-reference.cjs +1 -1
  46. package/dist/theme-reference.d.cts +65 -1
  47. package/dist/theme-reference.d.ts +65 -1
  48. package/dist/theme-reference.js +1 -1
  49. package/dist/webmcp-polyfill.js +1 -4
  50. package/dist/webmcp-runtime-JI7T4QYF.js +6 -0
  51. package/dist/webmcp-runtime.cjs +2 -2
  52. package/dist/webmcp-runtime.d.cts +34 -2
  53. package/dist/webmcp-runtime.d.ts +34 -2
  54. package/dist/webmcp-runtime.js +2 -2
  55. package/package.json +2 -2
  56. package/src/client-visitor-history.test.ts +131 -0
  57. package/src/components/artifact-preview.ts +5 -0
  58. package/src/components/event-stream-badge-theming.test.ts +159 -0
  59. package/src/components/event-stream-view.ts +50 -20
  60. package/src/generated/runtype-openapi-contract.ts +8 -0
  61. package/src/index-core.ts +2 -0
  62. package/src/runtime/init.registry.test.ts +56 -0
  63. package/src/runtime/init.ts +17 -0
  64. package/src/types/theme.ts +41 -1
  65. package/src/types.ts +38 -1
  66. package/src/ui.reasoning-display.test.ts +136 -2
  67. package/src/ui.ts +69 -21
  68. package/src/utils/__snapshots__/tokens-parity.test.ts.snap +1740 -0
  69. package/src/utils/formatting.ts +22 -0
  70. package/src/utils/theme.ts +16 -0
  71. package/src/utils/tokens.ts +59 -0
  72. package/src/webmcp-bridge.test.ts +132 -23
  73. package/src/webmcp-bridge.ts +26 -2
  74. package/src/webmcp-runtime-entry.ts +71 -11
  75. package/dist/artifacts-ui-J6AKUGTS.js +0 -7
  76. package/dist/chunk-HBE7LFNT.js +0 -4
  77. package/dist/event-stream-view-73NWKWVQ.js +0 -1
  78. package/dist/webmcp-runtime-P3CHZRHF.js +0 -6
@@ -619,7 +619,11 @@ interface ColorPalette {
619
619
  warning: ColorShade;
620
620
  error: ColorShade;
621
621
  info: ColorShade;
622
- [key: string]: ColorShade;
622
+ /** Event-stream tool badge family. */
623
+ purple?: ColorShade;
624
+ /** Event-stream agent badge family. */
625
+ teal?: ColorShade;
626
+ [key: string]: ColorShade | undefined;
623
627
  }
624
628
  interface SpacingScale {
625
629
  0: string;
@@ -1191,6 +1195,38 @@ interface ToolBubbleTokens {
1191
1195
  interface ReasoningBubbleTokens {
1192
1196
  shadow: string;
1193
1197
  }
1198
+ /** One event-stream badge chip: fill + text pair. The chip border derives
1199
+ * from `foreground` at ~31% alpha. */
1200
+ interface EventStreamBadgePairTokens {
1201
+ background: TokenReference<'color'>;
1202
+ foreground: TokenReference<'color'>;
1203
+ }
1204
+ /**
1205
+ * Event-stream inspector badge chips (`features.eventStream`), one pair per
1206
+ * unified event family. Materialized into every theme and emitted as
1207
+ * `--persona-event-badge-<family>-{bg,fg}`, with scheme-appropriate defaults:
1208
+ * light themes pair a 100-tone fill with a 700-tone text, the built-in dark
1209
+ * layer flips to a 900-tone fill with a 300-tone text. `badge.default` colors
1210
+ * event types no family matches.
1211
+ */
1212
+ interface EventStreamTokens {
1213
+ badge: {
1214
+ /** `flow_*` events. */
1215
+ flow: EventStreamBadgePairTokens;
1216
+ /** `step_*` events. */
1217
+ step: EventStreamBadgePairTokens;
1218
+ /** `reasoning_*` events. */
1219
+ reasoning: EventStreamBadgePairTokens;
1220
+ /** `tool_*` events. */
1221
+ tool: EventStreamBadgePairTokens;
1222
+ /** `agent_*` events. */
1223
+ agent: EventStreamBadgePairTokens;
1224
+ /** `error` / `execution_error` events. */
1225
+ error: EventStreamBadgePairTokens;
1226
+ /** Any event type no other family matches. */
1227
+ default: EventStreamBadgePairTokens;
1228
+ };
1229
+ }
1194
1230
  /** Scrollbar appearance shared by every scroller in the widget. */
1195
1231
  interface ScrollbarTokens {
1196
1232
  /** Thumb color. @default semantic.colors.border */
@@ -1539,6 +1575,8 @@ interface ComponentTokens {
1539
1575
  attachment: AttachmentTokens;
1540
1576
  toolBubble: ToolBubbleTokens;
1541
1577
  reasoningBubble: ReasoningBubbleTokens;
1578
+ /** Event-stream inspector badge chips. */
1579
+ eventStream?: EventStreamTokens;
1542
1580
  composer: ComposerChromeTokens;
1543
1581
  /** Shared motion timing for composer chrome animation. */
1544
1582
  motion?: MotionTokens;
@@ -2986,6 +3024,14 @@ type ClientToolDefinition = {
2986
3024
  readOnlyHint?: boolean;
2987
3025
  untrustedContentHint?: boolean;
2988
3026
  };
3027
+ /**
3028
+ * Hoisted copy of `annotations.untrustedContentHint`. This is the field the
3029
+ * server actually acts on (`InlineClientToolSchema`): it spotlights the
3030
+ * tool's output before the model reads it, so instructions embedded in
3031
+ * page-provided content (reviews, comments, emails) are not treated as
3032
+ * instructions. `annotations` itself is trace/dashboard metadata only.
3033
+ */
3034
+ untrustedContentHint?: boolean;
2989
3035
  };
2990
3036
  /**
2991
3037
  * Information passed to the confirm-bubble handler before a `webmcp:*` tool
@@ -4210,6 +4256,16 @@ type AgentWidgetToolCallDisplayFeature = {
4210
4256
  * @default "stack"
4211
4257
  */
4212
4258
  groupedMode?: "stack" | "summary";
4259
+ /**
4260
+ * What happens to a tool call row once it completes.
4261
+ *
4262
+ * - `"kept"` (default): the finished row stays in the transcript.
4263
+ * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4264
+ * it. The tool call stays on the message and in `getMessages()`.
4265
+ *
4266
+ * @default "kept"
4267
+ */
4268
+ completedVisibility?: AgentWidgetToolCallCompletedVisibility;
4213
4269
  /**
4214
4270
  * When false, tool call bubbles show only the collapsed summary with no
4215
4271
  * expand/collapse toggle. Users see tool awareness without full details.
@@ -4227,6 +4283,8 @@ type AgentWidgetToolCallDisplayFeature = {
4227
4283
  */
4228
4284
  loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
4229
4285
  };
4286
+ /** See `features.toolCallDisplay.completedVisibility`. */
4287
+ type AgentWidgetToolCallCompletedVisibility = "kept" | "removed";
4230
4288
  type AgentWidgetReasoningDisplayFeature = {
4231
4289
  /**
4232
4290
  * When true, active collapsed reasoning rows can render a lightweight preview block.
@@ -4272,13 +4330,26 @@ type AgentWidgetReasoningDisplayFeature = {
4272
4330
  * - `"kept"` (default): the finished row stays in the transcript.
4273
4331
  * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4274
4332
  * it. The reasoning text stays on the message and in `getMessages()`.
4333
+ * - `"removed-when-short"`: behaves as `"removed"` when the completed trace
4334
+ * is short (see `shortThinkThreshold`), and as `"kept"` otherwise.
4275
4335
  *
4276
4336
  * @default "kept"
4277
4337
  */
4278
4338
  completedVisibility?: AgentWidgetReasoningCompletedVisibility;
4339
+ /**
4340
+ * Thresholds used by `completedVisibility: "removed-when-short"` to decide
4341
+ * whether a completed trace counts as short. Duration is checked first when
4342
+ * the reasoning reports one; the character count is a fallback for traces
4343
+ * with no reported duration.
4344
+ * @default { durationMs: 15000, chars: 1200 }
4345
+ */
4346
+ shortThinkThreshold?: {
4347
+ durationMs?: number;
4348
+ chars?: number;
4349
+ };
4279
4350
  };
4280
4351
  /** See `features.reasoningDisplay.completedVisibility`. */
4281
- type AgentWidgetReasoningCompletedVisibility = "kept" | "removed";
4352
+ type AgentWidgetReasoningCompletedVisibility = "kept" | "removed" | "removed-when-short";
4282
4353
  /**
4283
4354
  * Reveal animation applied to assistant message text while it is streaming.
4284
4355
  *
@@ -619,7 +619,11 @@ interface ColorPalette {
619
619
  warning: ColorShade;
620
620
  error: ColorShade;
621
621
  info: ColorShade;
622
- [key: string]: ColorShade;
622
+ /** Event-stream tool badge family. */
623
+ purple?: ColorShade;
624
+ /** Event-stream agent badge family. */
625
+ teal?: ColorShade;
626
+ [key: string]: ColorShade | undefined;
623
627
  }
624
628
  interface SpacingScale {
625
629
  0: string;
@@ -1191,6 +1195,38 @@ interface ToolBubbleTokens {
1191
1195
  interface ReasoningBubbleTokens {
1192
1196
  shadow: string;
1193
1197
  }
1198
+ /** One event-stream badge chip: fill + text pair. The chip border derives
1199
+ * from `foreground` at ~31% alpha. */
1200
+ interface EventStreamBadgePairTokens {
1201
+ background: TokenReference<'color'>;
1202
+ foreground: TokenReference<'color'>;
1203
+ }
1204
+ /**
1205
+ * Event-stream inspector badge chips (`features.eventStream`), one pair per
1206
+ * unified event family. Materialized into every theme and emitted as
1207
+ * `--persona-event-badge-<family>-{bg,fg}`, with scheme-appropriate defaults:
1208
+ * light themes pair a 100-tone fill with a 700-tone text, the built-in dark
1209
+ * layer flips to a 900-tone fill with a 300-tone text. `badge.default` colors
1210
+ * event types no family matches.
1211
+ */
1212
+ interface EventStreamTokens {
1213
+ badge: {
1214
+ /** `flow_*` events. */
1215
+ flow: EventStreamBadgePairTokens;
1216
+ /** `step_*` events. */
1217
+ step: EventStreamBadgePairTokens;
1218
+ /** `reasoning_*` events. */
1219
+ reasoning: EventStreamBadgePairTokens;
1220
+ /** `tool_*` events. */
1221
+ tool: EventStreamBadgePairTokens;
1222
+ /** `agent_*` events. */
1223
+ agent: EventStreamBadgePairTokens;
1224
+ /** `error` / `execution_error` events. */
1225
+ error: EventStreamBadgePairTokens;
1226
+ /** Any event type no other family matches. */
1227
+ default: EventStreamBadgePairTokens;
1228
+ };
1229
+ }
1194
1230
  /** Scrollbar appearance shared by every scroller in the widget. */
1195
1231
  interface ScrollbarTokens {
1196
1232
  /** Thumb color. @default semantic.colors.border */
@@ -1539,6 +1575,8 @@ interface ComponentTokens {
1539
1575
  attachment: AttachmentTokens;
1540
1576
  toolBubble: ToolBubbleTokens;
1541
1577
  reasoningBubble: ReasoningBubbleTokens;
1578
+ /** Event-stream inspector badge chips. */
1579
+ eventStream?: EventStreamTokens;
1542
1580
  composer: ComposerChromeTokens;
1543
1581
  /** Shared motion timing for composer chrome animation. */
1544
1582
  motion?: MotionTokens;
@@ -2986,6 +3024,14 @@ type ClientToolDefinition = {
2986
3024
  readOnlyHint?: boolean;
2987
3025
  untrustedContentHint?: boolean;
2988
3026
  };
3027
+ /**
3028
+ * Hoisted copy of `annotations.untrustedContentHint`. This is the field the
3029
+ * server actually acts on (`InlineClientToolSchema`): it spotlights the
3030
+ * tool's output before the model reads it, so instructions embedded in
3031
+ * page-provided content (reviews, comments, emails) are not treated as
3032
+ * instructions. `annotations` itself is trace/dashboard metadata only.
3033
+ */
3034
+ untrustedContentHint?: boolean;
2989
3035
  };
2990
3036
  /**
2991
3037
  * Information passed to the confirm-bubble handler before a `webmcp:*` tool
@@ -4210,6 +4256,16 @@ type AgentWidgetToolCallDisplayFeature = {
4210
4256
  * @default "stack"
4211
4257
  */
4212
4258
  groupedMode?: "stack" | "summary";
4259
+ /**
4260
+ * What happens to a tool call row once it completes.
4261
+ *
4262
+ * - `"kept"` (default): the finished row stays in the transcript.
4263
+ * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4264
+ * it. The tool call stays on the message and in `getMessages()`.
4265
+ *
4266
+ * @default "kept"
4267
+ */
4268
+ completedVisibility?: AgentWidgetToolCallCompletedVisibility;
4213
4269
  /**
4214
4270
  * When false, tool call bubbles show only the collapsed summary with no
4215
4271
  * expand/collapse toggle. Users see tool awareness without full details.
@@ -4227,6 +4283,8 @@ type AgentWidgetToolCallDisplayFeature = {
4227
4283
  */
4228
4284
  loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
4229
4285
  };
4286
+ /** See `features.toolCallDisplay.completedVisibility`. */
4287
+ type AgentWidgetToolCallCompletedVisibility = "kept" | "removed";
4230
4288
  type AgentWidgetReasoningDisplayFeature = {
4231
4289
  /**
4232
4290
  * When true, active collapsed reasoning rows can render a lightweight preview block.
@@ -4272,13 +4330,26 @@ type AgentWidgetReasoningDisplayFeature = {
4272
4330
  * - `"kept"` (default): the finished row stays in the transcript.
4273
4331
  * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4274
4332
  * it. The reasoning text stays on the message and in `getMessages()`.
4333
+ * - `"removed-when-short"`: behaves as `"removed"` when the completed trace
4334
+ * is short (see `shortThinkThreshold`), and as `"kept"` otherwise.
4275
4335
  *
4276
4336
  * @default "kept"
4277
4337
  */
4278
4338
  completedVisibility?: AgentWidgetReasoningCompletedVisibility;
4339
+ /**
4340
+ * Thresholds used by `completedVisibility: "removed-when-short"` to decide
4341
+ * whether a completed trace counts as short. Duration is checked first when
4342
+ * the reasoning reports one; the character count is a fallback for traces
4343
+ * with no reported duration.
4344
+ * @default { durationMs: 15000, chars: 1200 }
4345
+ */
4346
+ shortThinkThreshold?: {
4347
+ durationMs?: number;
4348
+ chars?: number;
4349
+ };
4279
4350
  };
4280
4351
  /** See `features.reasoningDisplay.completedVisibility`. */
4281
- type AgentWidgetReasoningCompletedVisibility = "kept" | "removed";
4352
+ type AgentWidgetReasoningCompletedVisibility = "kept" | "removed" | "removed-when-short";
4282
4353
  /**
4283
4354
  * Reveal animation applied to assistant message text while it is streaming.
4284
4355
  *