@runtypelabs/persona 4.21.1 → 4.22.1

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 (129) hide show
  1. package/dist/animations/glyph-cycle.d.cts +1 -1
  2. package/dist/animations/glyph-cycle.d.ts +1 -1
  3. package/dist/animations/{types-B_JdVK9o.d.cts → types-9Vxm-PPz.d.cts} +136 -6
  4. package/dist/animations/{types-B_JdVK9o.d.ts → types-9Vxm-PPz.d.ts} +136 -6
  5. package/dist/animations/wipe.d.cts +1 -1
  6. package/dist/animations/wipe.d.ts +1 -1
  7. package/dist/animations-extra.d.cts +136 -6
  8. package/dist/animations-extra.d.ts +136 -6
  9. package/dist/{approval-ui-RNNBR5R3.js → approval-ui-K7R5Q5OC.js} +1 -1
  10. package/dist/approval-ui.cjs +2 -2
  11. package/dist/approval-ui.d.cts +221 -16
  12. package/dist/approval-ui.d.ts +221 -16
  13. package/dist/approval-ui.js +2 -2
  14. package/dist/artifacts-ui-F4N6VMKF.js +7 -0
  15. package/dist/artifacts-ui.cjs +1 -1
  16. package/dist/artifacts-ui.d.cts +221 -16
  17. package/dist/artifacts-ui.d.ts +221 -16
  18. package/dist/artifacts-ui.js +1 -1
  19. package/dist/chunk-NQLDCJAP.js +4 -0
  20. package/dist/codegen.cjs +1 -1
  21. package/dist/codegen.js +1 -1
  22. package/dist/context-mentions.d.cts +221 -16
  23. package/dist/context-mentions.d.ts +221 -16
  24. package/dist/event-stream-view-GL3ADRY2.js +1 -0
  25. package/dist/event-stream-view.cjs +1 -1
  26. package/dist/event-stream-view.d.cts +221 -16
  27. package/dist/event-stream-view.d.ts +221 -16
  28. package/dist/event-stream-view.js +1 -1
  29. package/dist/forms-ui.d.cts +234 -25
  30. package/dist/forms-ui.d.ts +234 -25
  31. package/dist/history-view.d.cts +136 -6
  32. package/dist/history-view.d.ts +136 -6
  33. package/dist/index.cjs +70 -70
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +302 -32
  36. package/dist/index.d.ts +302 -32
  37. package/dist/index.global.js +54 -54
  38. package/dist/index.global.js.map +1 -1
  39. package/dist/index.js +69 -69
  40. package/dist/index.js.map +1 -1
  41. package/dist/launcher.global.js +2 -2
  42. package/dist/launcher.global.js.map +1 -1
  43. package/dist/session-reconnect.d.cts +221 -16
  44. package/dist/session-reconnect.d.ts +221 -16
  45. package/dist/smart-dom-reader.d.cts +221 -16
  46. package/dist/smart-dom-reader.d.ts +221 -16
  47. package/dist/testing.cjs +3 -3
  48. package/dist/testing.d.cts +3 -4
  49. package/dist/testing.d.ts +3 -4
  50. package/dist/testing.js +3 -3
  51. package/dist/theme-editor-preview.cjs +73 -73
  52. package/dist/theme-editor-preview.d.cts +221 -16
  53. package/dist/theme-editor-preview.d.ts +221 -16
  54. package/dist/theme-editor-preview.js +51 -51
  55. package/dist/theme-editor.cjs +4 -4
  56. package/dist/theme-editor.d.cts +221 -16
  57. package/dist/theme-editor.d.ts +221 -16
  58. package/dist/theme-editor.js +2 -2
  59. package/dist/theme-reference.cjs +1 -1
  60. package/dist/theme-reference.d.cts +65 -1
  61. package/dist/theme-reference.d.ts +65 -1
  62. package/dist/theme-reference.js +1 -1
  63. package/dist/voice-runtime.d.cts +6 -2
  64. package/dist/voice-runtime.d.ts +6 -2
  65. package/dist/webmcp-polyfill.js +1 -4
  66. package/dist/webmcp-runtime-JI7T4QYF.js +6 -0
  67. package/dist/webmcp-runtime.cjs +2 -2
  68. package/dist/webmcp-runtime.d.cts +34 -2
  69. package/dist/webmcp-runtime.d.ts +34 -2
  70. package/dist/webmcp-runtime.js +2 -2
  71. package/package.json +2 -2
  72. package/src/ask-user-question-tool.ts +1 -1
  73. package/src/client-history-rest.test.ts +2 -1
  74. package/src/client-visitor-history.test.ts +20 -4
  75. package/src/client.composer-options.test.ts +1 -1
  76. package/src/client.interrupt.test.ts +2 -2
  77. package/src/client.test.ts +477 -915
  78. package/src/client.ts +134 -494
  79. package/src/client.unified-tools.test.ts +76 -0
  80. package/src/components/artifact-preview.ts +5 -0
  81. package/src/components/event-stream-badge-theming.test.ts +162 -0
  82. package/src/components/event-stream-view.test.ts +76 -76
  83. package/src/components/event-stream-view.ts +55 -20
  84. package/src/components/tool-bubble.test.ts +12 -0
  85. package/src/components/tool-bubble.ts +13 -2
  86. package/src/event-stream-view-bundle.test.ts +2 -2
  87. package/src/generated/runtype-openapi-contract.ts +137 -1
  88. package/src/index-core.ts +2 -0
  89. package/src/internal/runtype-history-provider.test.ts +2 -2
  90. package/src/runtime/init.registry.test.ts +56 -0
  91. package/src/runtime/init.ts +17 -0
  92. package/src/session-history.test.ts +1 -1
  93. package/src/session.quote.test.ts +1 -1
  94. package/src/session.resubmit-from.test.ts +1 -1
  95. package/src/session.test.ts +5 -5
  96. package/src/session.ts +95 -36
  97. package/src/suggest-replies-tool.ts +1 -1
  98. package/src/testing/mock-stream.test.ts +37 -16
  99. package/src/testing/mock-stream.ts +14 -9
  100. package/src/types/theme.ts +41 -1
  101. package/src/types.ts +57 -15
  102. package/src/ui.ask-user-question-plugin.test.ts +7 -7
  103. package/src/ui.composer-defer-one.test.ts +6 -34
  104. package/src/ui.composer-draft-persistence.test.ts +1 -1
  105. package/src/ui.composer-quote.test.ts +1 -1
  106. package/src/ui.message-history-actions.test.ts +1 -1
  107. package/src/ui.reasoning-display.test.ts +136 -2
  108. package/src/ui.streaming-coalescing.test.ts +10 -13
  109. package/src/ui.ts +101 -35
  110. package/src/ui.typing-indicator.test.ts +216 -0
  111. package/src/ui.voice-custom-provider.test.ts +211 -0
  112. package/src/utils/__snapshots__/tokens-parity.test.ts.snap +1740 -0
  113. package/src/utils/event-stream-buffer.test.ts +13 -13
  114. package/src/utils/event-stream-capture.test.ts +20 -20
  115. package/src/utils/formatting.ts +22 -0
  116. package/src/utils/theme.ts +16 -0
  117. package/src/utils/throughput-tracker.test.ts +100 -142
  118. package/src/utils/throughput-tracker.ts +18 -132
  119. package/src/utils/tokens.ts +59 -0
  120. package/src/utils/voice-support.ts +18 -1
  121. package/src/voice/voice-turn-tracker.ts +18 -0
  122. package/src/webmcp-bridge.test.ts +132 -23
  123. package/src/webmcp-bridge.ts +27 -3
  124. package/src/webmcp-runtime-entry.ts +71 -11
  125. package/dist/artifacts-ui-J6AKUGTS.js +0 -7
  126. package/dist/chunk-HBE7LFNT.js +0 -4
  127. package/dist/event-stream-view-73NWKWVQ.js +0 -1
  128. package/dist/webmcp-runtime-P3CHZRHF.js +0 -6
  129. package/src/utils/__fixtures__/unified-translator.oracle.ts +0 -717
@@ -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;
@@ -1656,6 +1694,11 @@ type RuntypeExecutionStreamEvent = ({
1656
1694
  iteration?: number;
1657
1695
  role: "user" | "assistant" | "system";
1658
1696
  seq: number;
1697
+ subagent?: {
1698
+ agentName?: string;
1699
+ parentToolCallId?: string;
1700
+ toolName: string;
1701
+ };
1659
1702
  turnIndex?: number;
1660
1703
  type: "turn_start";
1661
1704
  }) | ({
@@ -1690,12 +1733,61 @@ type RuntypeExecutionStreamEvent = ({
1690
1733
  role: "user" | "assistant" | "system";
1691
1734
  seq: number;
1692
1735
  stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
1736
+ subagent?: {
1737
+ agentName?: string;
1738
+ parentToolCallId?: string;
1739
+ toolName: string;
1740
+ };
1693
1741
  tokens?: {
1694
1742
  input: number;
1695
1743
  output: number;
1696
1744
  };
1697
1745
  type: "turn_complete";
1698
1746
  }) | {
1747
+ executionId: string;
1748
+ id: string;
1749
+ iteration?: number;
1750
+ model?: string;
1751
+ ordinal: number;
1752
+ provider?: string;
1753
+ seq: number;
1754
+ startedAt?: string;
1755
+ stepId?: string;
1756
+ subagent?: {
1757
+ agentName?: string;
1758
+ parentToolCallId?: string;
1759
+ toolName: string;
1760
+ };
1761
+ turnId?: string;
1762
+ type: "model_call_start";
1763
+ } | {
1764
+ completedAt?: string;
1765
+ cost?: number;
1766
+ durationMs?: number;
1767
+ executionId: string;
1768
+ finishReason?: string;
1769
+ id: string;
1770
+ iteration?: number;
1771
+ model?: string;
1772
+ ordinal: number;
1773
+ provider?: string;
1774
+ responseModel?: string;
1775
+ seq: number;
1776
+ subagent?: {
1777
+ agentName?: string;
1778
+ parentToolCallId?: string;
1779
+ toolName: string;
1780
+ };
1781
+ success?: boolean;
1782
+ tokens?: {
1783
+ cacheRead?: number;
1784
+ cacheWrite?: number;
1785
+ input: number;
1786
+ output: number;
1787
+ };
1788
+ turnId?: string;
1789
+ type: "model_call_complete";
1790
+ } | {
1699
1791
  executionId: string;
1700
1792
  id: string;
1701
1793
  index?: number;
@@ -1704,6 +1796,11 @@ type RuntypeExecutionStreamEvent = ({
1704
1796
  seq: number;
1705
1797
  startedAt?: string;
1706
1798
  stepType?: string;
1799
+ subagent?: {
1800
+ agentName?: string;
1801
+ parentToolCallId?: string;
1802
+ toolName: string;
1803
+ };
1707
1804
  totalSteps?: number;
1708
1805
  type: "step_start";
1709
1806
  } | ({
@@ -1731,6 +1828,11 @@ type RuntypeExecutionStreamEvent = ({
1731
1828
  seq: number;
1732
1829
  stepType?: string;
1733
1830
  stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
1831
+ subagent?: {
1832
+ agentName?: string;
1833
+ parentToolCallId?: string;
1834
+ toolName: string;
1835
+ };
1734
1836
  success?: boolean;
1735
1837
  tokensUsed?: number;
1736
1838
  type: "step_complete";
@@ -1753,6 +1855,11 @@ type RuntypeExecutionStreamEvent = ({
1753
1855
  role?: "user" | "assistant" | "system";
1754
1856
  seq: number;
1755
1857
  stepId?: string;
1858
+ subagent?: {
1859
+ agentName?: string;
1860
+ parentToolCallId?: string;
1861
+ toolName: string;
1862
+ };
1756
1863
  turnId?: string;
1757
1864
  type: "text_start";
1758
1865
  }) | {
@@ -1760,11 +1867,21 @@ type RuntypeExecutionStreamEvent = ({
1760
1867
  executionId: string;
1761
1868
  id: string;
1762
1869
  seq: number;
1870
+ subagent?: {
1871
+ agentName?: string;
1872
+ parentToolCallId?: string;
1873
+ toolName: string;
1874
+ };
1763
1875
  type: "text_delta";
1764
1876
  } | {
1765
1877
  executionId: string;
1766
1878
  id: string;
1767
1879
  seq: number;
1880
+ subagent?: {
1881
+ agentName?: string;
1882
+ parentToolCallId?: string;
1883
+ toolName: string;
1884
+ };
1768
1885
  text?: string;
1769
1886
  type: "text_complete";
1770
1887
  } | ({
@@ -1773,18 +1890,33 @@ type RuntypeExecutionStreamEvent = ({
1773
1890
  parentToolCallId?: string;
1774
1891
  scope?: "turn" | "loop";
1775
1892
  seq: number;
1893
+ subagent?: {
1894
+ agentName?: string;
1895
+ parentToolCallId?: string;
1896
+ toolName: string;
1897
+ };
1776
1898
  type: "reasoning_start";
1777
1899
  }) | {
1778
1900
  delta: string;
1779
1901
  executionId: string;
1780
1902
  id: string;
1781
1903
  seq: number;
1904
+ subagent?: {
1905
+ agentName?: string;
1906
+ parentToolCallId?: string;
1907
+ toolName: string;
1908
+ };
1782
1909
  type: "reasoning_delta";
1783
1910
  } | ({
1784
1911
  executionId: string;
1785
1912
  id: string;
1786
1913
  scope?: "turn" | "loop";
1787
1914
  seq: number;
1915
+ subagent?: {
1916
+ agentName?: string;
1917
+ parentToolCallId?: string;
1918
+ toolName: string;
1919
+ };
1788
1920
  text?: string;
1789
1921
  type: "reasoning_complete";
1790
1922
  }) | ({
@@ -1877,6 +2009,11 @@ type RuntypeExecutionStreamEvent = ({
1877
2009
  seq: number;
1878
2010
  startedAt?: string;
1879
2011
  stepId?: string;
2012
+ subagent?: {
2013
+ agentName?: string;
2014
+ parentToolCallId?: string;
2015
+ toolName: string;
2016
+ };
1880
2017
  toolCallId: string;
1881
2018
  toolName: string;
1882
2019
  toolType: string;
@@ -1885,6 +2022,11 @@ type RuntypeExecutionStreamEvent = ({
1885
2022
  delta: string;
1886
2023
  executionId: string;
1887
2024
  seq: number;
2025
+ subagent?: {
2026
+ agentName?: string;
2027
+ parentToolCallId?: string;
2028
+ toolName: string;
2029
+ };
1888
2030
  toolCallId: string;
1889
2031
  type: "tool_input_delta";
1890
2032
  } | {
@@ -1892,6 +2034,11 @@ type RuntypeExecutionStreamEvent = ({
1892
2034
  hiddenParameterNames?: Array<string>;
1893
2035
  parameters: Record<string, unknown>;
1894
2036
  seq: number;
2037
+ subagent?: {
2038
+ agentName?: string;
2039
+ parentToolCallId?: string;
2040
+ toolName: string;
2041
+ };
1895
2042
  toolCallId: string;
1896
2043
  toolName?: string;
1897
2044
  type: "tool_input_complete";
@@ -1909,6 +2056,11 @@ type RuntypeExecutionStreamEvent = ({
1909
2056
  result?: unknown;
1910
2057
  seq: number;
1911
2058
  stepId?: string;
2059
+ subagent?: {
2060
+ agentName?: string;
2061
+ parentToolCallId?: string;
2062
+ toolName: string;
2063
+ };
1912
2064
  success: boolean;
1913
2065
  toolCallId: string;
1914
2066
  toolCost?: number;
@@ -1988,6 +2140,19 @@ type RuntypeExecutionStreamEvent = ({
1988
2140
  recoverable?: boolean;
1989
2141
  seq: number;
1990
2142
  type: "error";
2143
+ }) | ({
2144
+ epoch: number;
2145
+ executionId: string;
2146
+ kind: "compaction";
2147
+ outcome?: "ok" | "failed" | "gap" | "skipped";
2148
+ phase: "start" | "complete";
2149
+ reason: "threshold" | "overflow" | "manual" | "surface_policy" | "provider_mismatch";
2150
+ seq: number;
2151
+ strategy: "provider_native" | "summary";
2152
+ tier: number;
2153
+ tokensAfter?: number;
2154
+ tokensBefore?: number;
2155
+ type: "context_notice";
1991
2156
  }) | {
1992
2157
  executionId: string;
1993
2158
  seq: number;
@@ -2919,6 +3084,14 @@ type ClientToolDefinition = {
2919
3084
  readOnlyHint?: boolean;
2920
3085
  untrustedContentHint?: boolean;
2921
3086
  };
3087
+ /**
3088
+ * Hoisted copy of `annotations.untrustedContentHint`. This is the field the
3089
+ * server actually acts on (`InlineClientToolSchema`): it spotlights the
3090
+ * tool's output before the model reads it, so instructions embedded in
3091
+ * page-provided content (reviews, comments, emails) are not treated as
3092
+ * instructions. `annotations` itself is trace/dashboard metadata only.
3093
+ */
3094
+ untrustedContentHint?: boolean;
2922
3095
  };
2923
3096
  /**
2924
3097
  * Information passed to the confirm-bubble handler before a `webmcp:*` tool
@@ -3039,15 +3212,15 @@ type AgentMessageMetadata = {
3039
3212
  */
3040
3213
  parentStepId?: string;
3041
3214
  /**
3042
- * Set to `true` on a tool-variant message produced from a `step_await`
3215
+ * Set to `true` on a tool-variant message produced from an `await`
3043
3216
  * event (`awaitReason: "local_tool_required"`). Signals to UI code that
3044
3217
  * the tool call is a LOCAL tool and the server is paused waiting for a
3045
3218
  * `POST /v1/dispatch/resume` with the user's answer keyed by tool name.
3046
3219
  */
3047
3220
  awaitingLocalTool?: boolean;
3048
3221
  /**
3049
- * The provider per-call id (`toolu_…`) carried on the `step_await` /
3050
- * `flow_await` events for a LOCAL tool (core#3878). Present only when the
3222
+ * The provider per-call id (`toolu_…`) carried on the `await`
3223
+ * event for a LOCAL tool (core#3878). Present only when the
3051
3224
  * server emits it. Two PARALLEL calls to the same tool in one turn share a
3052
3225
  * `toolName` (and a collapsed `toolId`) but get DISTINCT `webMcpToolCallId`s,
3053
3226
  * so this is the key the widget batches a single `/resume` on: preferred
@@ -4110,6 +4283,16 @@ type AgentWidgetToolCallDisplayFeature = {
4110
4283
  * @default "stack"
4111
4284
  */
4112
4285
  groupedMode?: "stack" | "summary";
4286
+ /**
4287
+ * What happens to a tool call row once it completes.
4288
+ *
4289
+ * - `"kept"` (default): the finished row stays in the transcript.
4290
+ * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4291
+ * it. The tool call stays on the message and in `getMessages()`.
4292
+ *
4293
+ * @default "kept"
4294
+ */
4295
+ completedVisibility?: AgentWidgetToolCallCompletedVisibility;
4113
4296
  /**
4114
4297
  * When false, tool call bubbles show only the collapsed summary with no
4115
4298
  * expand/collapse toggle. Users see tool awareness without full details.
@@ -4127,6 +4310,8 @@ type AgentWidgetToolCallDisplayFeature = {
4127
4310
  */
4128
4311
  loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
4129
4312
  };
4313
+ /** See `features.toolCallDisplay.completedVisibility`. */
4314
+ type AgentWidgetToolCallCompletedVisibility = "kept" | "removed";
4130
4315
  type AgentWidgetReasoningDisplayFeature = {
4131
4316
  /**
4132
4317
  * When true, active collapsed reasoning rows can render a lightweight preview block.
@@ -4172,13 +4357,26 @@ type AgentWidgetReasoningDisplayFeature = {
4172
4357
  * - `"kept"` (default): the finished row stays in the transcript.
4173
4358
  * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4174
4359
  * it. The reasoning text stays on the message and in `getMessages()`.
4360
+ * - `"removed-when-short"`: behaves as `"removed"` when the completed trace
4361
+ * is short (see `shortThinkThreshold`), and as `"kept"` otherwise.
4175
4362
  *
4176
4363
  * @default "kept"
4177
4364
  */
4178
4365
  completedVisibility?: AgentWidgetReasoningCompletedVisibility;
4366
+ /**
4367
+ * Thresholds used by `completedVisibility: "removed-when-short"` to decide
4368
+ * whether a completed trace counts as short. Duration is checked first when
4369
+ * the reasoning reports one; the character count is a fallback for traces
4370
+ * with no reported duration.
4371
+ * @default { durationMs: 15000, chars: 1200 }
4372
+ */
4373
+ shortThinkThreshold?: {
4374
+ durationMs?: number;
4375
+ chars?: number;
4376
+ };
4179
4377
  };
4180
4378
  /** See `features.reasoningDisplay.completedVisibility`. */
4181
- type AgentWidgetReasoningCompletedVisibility = "kept" | "removed";
4379
+ type AgentWidgetReasoningCompletedVisibility = "kept" | "removed" | "removed-when-short";
4182
4380
  /**
4183
4381
  * Reveal animation applied to assistant message text while it is streaming.
4184
4382
  *
@@ -5172,7 +5370,7 @@ type EventStreamConfig = {
5172
5370
  /**
5173
5371
  * Custom badge color mappings by event type prefix or exact type.
5174
5372
  * Keys are matched as exact match first, then prefix match (keys ending with "_").
5175
- * @example { "flow_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
5373
+ * @example { "execution_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
5176
5374
  */
5177
5375
  badgeColors?: Record<string, EventStreamBadgeColor>;
5178
5376
  /**
@@ -6593,9 +6791,13 @@ interface VoiceProvider {
6593
6791
  * `isFinal=false` is a live interim update (user partials, or assistant deltas
6594
6792
  * on providers that stream them); `isFinal=true` finalizes that role's text.
6595
6793
  * On the realtime `runtype` path, interim updates fire for the `user` only and
6596
- * the `assistant` arrives as a single final.
6794
+ * the `assistant` arrives as a single final. Providers with overlapping turns
6795
+ * must include the same turnId on user and assistant finals; without IDs,
6796
+ * providers must discard cancelled output before emitting the next user final.
6597
6797
  */
6598
- onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean) => void): void;
6798
+ onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
6799
+ turnId?: string;
6800
+ }) => void): void;
6599
6801
  /** Register a callback for per-turn latency metrics (realtime path). */
6600
6802
  onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
6601
6803
  /**
@@ -8908,16 +9110,16 @@ type AgentWidgetConfig = {
8908
9110
  *
8909
9111
  * @example
8910
9112
  * ```typescript
8911
- * // For Runtype API format
9113
+ * // For a custom backend (Runtype unified events are handled natively)
8912
9114
  * config: {
8913
9115
  * parseSSEEvent: (data) => {
8914
- * if ((data.type === 'step_delta' || data.type === 'step_chunk') && (data.delta || data.chunk)) {
8915
- * return { text: data.delta ?? data.chunk };
9116
+ * if (data.type === 'token' && typeof data.value === 'string') {
9117
+ * return { text: data.value };
8916
9118
  * }
8917
- * if (data.type === 'flow_complete') {
9119
+ * if (data.type === 'done') {
8918
9120
  * return { done: true };
8919
9121
  * }
8920
- * if (data.type === 'step_error') {
9122
+ * if (data.type === 'failure') {
8921
9123
  * return { error: data.error };
8922
9124
  * }
8923
9125
  * return null; // Ignore other events
@@ -9108,7 +9310,7 @@ type AgentWidgetReasoning = {
9108
9310
  /**
9109
9311
  * Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
9110
9312
  * thinking; `"loop"` is a cross-iteration agent reflection (the fold that
9111
- * replaced the legacy `agent_reflection` event). Absent for legacy streams.
9313
+ * replaced the legacy `agent_reflection` event). Optional when the stream does not specify a scope.
9112
9314
  */
9113
9315
  scope?: "turn" | "loop";
9114
9316
  startedAt?: number;
@@ -9122,6 +9324,9 @@ type AgentWidgetToolCall = {
9122
9324
  args?: unknown;
9123
9325
  chunks?: string[];
9124
9326
  result?: unknown;
9327
+ /** Whether the tool succeeded; failure does not necessarily end the execution. */
9328
+ success?: boolean;
9329
+ error?: string;
9125
9330
  duration?: number;
9126
9331
  startedAt?: number;
9127
9332
  completedAt?: number;
@@ -9152,7 +9357,7 @@ type AgentWidgetApproval = {
9152
9357
  type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
9153
9358
  /**
9154
9359
  * Per-turn / per-step stop reason emitted by the runtime on
9155
- * `agent_turn_complete` and `step_complete` SSE events. The vocabulary is
9360
+ * `turn_complete` and `step_complete` SSE events. The vocabulary is
9156
9361
  * owned by the upstream Runtype API: do not extend without coordination.
9157
9362
  *
9158
9363
  * - `end_turn`: natural completion (no affordance needed)
@@ -9283,7 +9488,7 @@ type AgentWidgetMessage = {
9283
9488
  */
9284
9489
  agentMetadata?: AgentMessageMetadata;
9285
9490
  /**
9286
- * Per-turn stop reason reported by the runtime on `agent_turn_complete`
9491
+ * Per-turn stop reason reported by the runtime on `turn_complete`
9287
9492
  * (agent-loop path) or the last `step_complete` for a prompt step
9288
9493
  * (dispatch / flow path). Absent when the API did not report a value.
9289
9494
  *