@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;
@@ -2919,6 +2957,14 @@ type ClientToolDefinition = {
2919
2957
  readOnlyHint?: boolean;
2920
2958
  untrustedContentHint?: boolean;
2921
2959
  };
2960
+ /**
2961
+ * Hoisted copy of `annotations.untrustedContentHint`. This is the field the
2962
+ * server actually acts on (`InlineClientToolSchema`): it spotlights the
2963
+ * tool's output before the model reads it, so instructions embedded in
2964
+ * page-provided content (reviews, comments, emails) are not treated as
2965
+ * instructions. `annotations` itself is trace/dashboard metadata only.
2966
+ */
2967
+ untrustedContentHint?: boolean;
2922
2968
  };
2923
2969
  /**
2924
2970
  * Information passed to the confirm-bubble handler before a `webmcp:*` tool
@@ -4253,6 +4299,16 @@ type AgentWidgetToolCallDisplayFeature = {
4253
4299
  * @default "stack"
4254
4300
  */
4255
4301
  groupedMode?: "stack" | "summary";
4302
+ /**
4303
+ * What happens to a tool call row once it completes.
4304
+ *
4305
+ * - `"kept"` (default): the finished row stays in the transcript.
4306
+ * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4307
+ * it. The tool call stays on the message and in `getMessages()`.
4308
+ *
4309
+ * @default "kept"
4310
+ */
4311
+ completedVisibility?: AgentWidgetToolCallCompletedVisibility;
4256
4312
  /**
4257
4313
  * When false, tool call bubbles show only the collapsed summary with no
4258
4314
  * expand/collapse toggle. Users see tool awareness without full details.
@@ -4270,6 +4326,8 @@ type AgentWidgetToolCallDisplayFeature = {
4270
4326
  */
4271
4327
  loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
4272
4328
  };
4329
+ /** See `features.toolCallDisplay.completedVisibility`. */
4330
+ type AgentWidgetToolCallCompletedVisibility = "kept" | "removed";
4273
4331
  type AgentWidgetReasoningDisplayFeature = {
4274
4332
  /**
4275
4333
  * When true, active collapsed reasoning rows can render a lightweight preview block.
@@ -4315,13 +4373,26 @@ type AgentWidgetReasoningDisplayFeature = {
4315
4373
  * - `"kept"` (default): the finished row stays in the transcript.
4316
4374
  * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4317
4375
  * it. The reasoning text stays on the message and in `getMessages()`.
4376
+ * - `"removed-when-short"`: behaves as `"removed"` when the completed trace
4377
+ * is short (see `shortThinkThreshold`), and as `"kept"` otherwise.
4318
4378
  *
4319
4379
  * @default "kept"
4320
4380
  */
4321
4381
  completedVisibility?: AgentWidgetReasoningCompletedVisibility;
4382
+ /**
4383
+ * Thresholds used by `completedVisibility: "removed-when-short"` to decide
4384
+ * whether a completed trace counts as short. Duration is checked first when
4385
+ * the reasoning reports one; the character count is a fallback for traces
4386
+ * with no reported duration.
4387
+ * @default { durationMs: 15000, chars: 1200 }
4388
+ */
4389
+ shortThinkThreshold?: {
4390
+ durationMs?: number;
4391
+ chars?: number;
4392
+ };
4322
4393
  };
4323
4394
  /** See `features.reasoningDisplay.completedVisibility`. */
4324
- type AgentWidgetReasoningCompletedVisibility = "kept" | "removed";
4395
+ type AgentWidgetReasoningCompletedVisibility = "kept" | "removed" | "removed-when-short";
4325
4396
  /**
4326
4397
  * Reveal animation applied to assistant message text while it is streaming.
4327
4398
  *
@@ -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;
@@ -2919,6 +2957,14 @@ type ClientToolDefinition = {
2919
2957
  readOnlyHint?: boolean;
2920
2958
  untrustedContentHint?: boolean;
2921
2959
  };
2960
+ /**
2961
+ * Hoisted copy of `annotations.untrustedContentHint`. This is the field the
2962
+ * server actually acts on (`InlineClientToolSchema`): it spotlights the
2963
+ * tool's output before the model reads it, so instructions embedded in
2964
+ * page-provided content (reviews, comments, emails) are not treated as
2965
+ * instructions. `annotations` itself is trace/dashboard metadata only.
2966
+ */
2967
+ untrustedContentHint?: boolean;
2922
2968
  };
2923
2969
  /**
2924
2970
  * Information passed to the confirm-bubble handler before a `webmcp:*` tool
@@ -4253,6 +4299,16 @@ type AgentWidgetToolCallDisplayFeature = {
4253
4299
  * @default "stack"
4254
4300
  */
4255
4301
  groupedMode?: "stack" | "summary";
4302
+ /**
4303
+ * What happens to a tool call row once it completes.
4304
+ *
4305
+ * - `"kept"` (default): the finished row stays in the transcript.
4306
+ * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4307
+ * it. The tool call stays on the message and in `getMessages()`.
4308
+ *
4309
+ * @default "kept"
4310
+ */
4311
+ completedVisibility?: AgentWidgetToolCallCompletedVisibility;
4256
4312
  /**
4257
4313
  * When false, tool call bubbles show only the collapsed summary with no
4258
4314
  * expand/collapse toggle. Users see tool awareness without full details.
@@ -4270,6 +4326,8 @@ type AgentWidgetToolCallDisplayFeature = {
4270
4326
  */
4271
4327
  loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
4272
4328
  };
4329
+ /** See `features.toolCallDisplay.completedVisibility`. */
4330
+ type AgentWidgetToolCallCompletedVisibility = "kept" | "removed";
4273
4331
  type AgentWidgetReasoningDisplayFeature = {
4274
4332
  /**
4275
4333
  * When true, active collapsed reasoning rows can render a lightweight preview block.
@@ -4315,13 +4373,26 @@ type AgentWidgetReasoningDisplayFeature = {
4315
4373
  * - `"kept"` (default): the finished row stays in the transcript.
4316
4374
  * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4317
4375
  * it. The reasoning text stays on the message and in `getMessages()`.
4376
+ * - `"removed-when-short"`: behaves as `"removed"` when the completed trace
4377
+ * is short (see `shortThinkThreshold`), and as `"kept"` otherwise.
4318
4378
  *
4319
4379
  * @default "kept"
4320
4380
  */
4321
4381
  completedVisibility?: AgentWidgetReasoningCompletedVisibility;
4382
+ /**
4383
+ * Thresholds used by `completedVisibility: "removed-when-short"` to decide
4384
+ * whether a completed trace counts as short. Duration is checked first when
4385
+ * the reasoning reports one; the character count is a fallback for traces
4386
+ * with no reported duration.
4387
+ * @default { durationMs: 15000, chars: 1200 }
4388
+ */
4389
+ shortThinkThreshold?: {
4390
+ durationMs?: number;
4391
+ chars?: number;
4392
+ };
4322
4393
  };
4323
4394
  /** See `features.reasoningDisplay.completedVisibility`. */
4324
- type AgentWidgetReasoningCompletedVisibility = "kept" | "removed";
4395
+ type AgentWidgetReasoningCompletedVisibility = "kept" | "removed" | "removed-when-short";
4325
4396
  /**
4326
4397
  * Reveal animation applied to assistant message text while it is streaming.
4327
4398
  *