@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
@@ -621,7 +621,11 @@ interface ColorPalette {
621
621
  warning: ColorShade;
622
622
  error: ColorShade;
623
623
  info: ColorShade;
624
- [key: string]: ColorShade;
624
+ /** Event-stream tool badge family. */
625
+ purple?: ColorShade;
626
+ /** Event-stream agent badge family. */
627
+ teal?: ColorShade;
628
+ [key: string]: ColorShade | undefined;
625
629
  }
626
630
  interface SpacingScale {
627
631
  0: string;
@@ -1193,6 +1197,38 @@ interface ToolBubbleTokens {
1193
1197
  interface ReasoningBubbleTokens {
1194
1198
  shadow: string;
1195
1199
  }
1200
+ /** One event-stream badge chip: fill + text pair. The chip border derives
1201
+ * from `foreground` at ~31% alpha. */
1202
+ interface EventStreamBadgePairTokens {
1203
+ background: TokenReference<'color'>;
1204
+ foreground: TokenReference<'color'>;
1205
+ }
1206
+ /**
1207
+ * Event-stream inspector badge chips (`features.eventStream`), one pair per
1208
+ * unified event family. Materialized into every theme and emitted as
1209
+ * `--persona-event-badge-<family>-{bg,fg}`, with scheme-appropriate defaults:
1210
+ * light themes pair a 100-tone fill with a 700-tone text, the built-in dark
1211
+ * layer flips to a 900-tone fill with a 300-tone text. `badge.default` colors
1212
+ * event types no family matches.
1213
+ */
1214
+ interface EventStreamTokens {
1215
+ badge: {
1216
+ /** `flow_*` events. */
1217
+ flow: EventStreamBadgePairTokens;
1218
+ /** `step_*` events. */
1219
+ step: EventStreamBadgePairTokens;
1220
+ /** `reasoning_*` events. */
1221
+ reasoning: EventStreamBadgePairTokens;
1222
+ /** `tool_*` events. */
1223
+ tool: EventStreamBadgePairTokens;
1224
+ /** `agent_*` events. */
1225
+ agent: EventStreamBadgePairTokens;
1226
+ /** `error` / `execution_error` events. */
1227
+ error: EventStreamBadgePairTokens;
1228
+ /** Any event type no other family matches. */
1229
+ default: EventStreamBadgePairTokens;
1230
+ };
1231
+ }
1196
1232
  /** Scrollbar appearance shared by every scroller in the widget. */
1197
1233
  interface ScrollbarTokens {
1198
1234
  /** Thumb color. @default semantic.colors.border */
@@ -1541,6 +1577,8 @@ interface ComponentTokens {
1541
1577
  attachment: AttachmentTokens;
1542
1578
  toolBubble: ToolBubbleTokens;
1543
1579
  reasoningBubble: ReasoningBubbleTokens;
1580
+ /** Event-stream inspector badge chips. */
1581
+ eventStream?: EventStreamTokens;
1544
1582
  composer: ComposerChromeTokens;
1545
1583
  /** Shared motion timing for composer chrome animation. */
1546
1584
  motion?: MotionTokens;
@@ -1658,6 +1696,11 @@ type RuntypeExecutionStreamEvent = ({
1658
1696
  iteration?: number;
1659
1697
  role: "user" | "assistant" | "system";
1660
1698
  seq: number;
1699
+ subagent?: {
1700
+ agentName?: string;
1701
+ parentToolCallId?: string;
1702
+ toolName: string;
1703
+ };
1661
1704
  turnIndex?: number;
1662
1705
  type: "turn_start";
1663
1706
  }) | ({
@@ -1692,12 +1735,61 @@ type RuntypeExecutionStreamEvent = ({
1692
1735
  role: "user" | "assistant" | "system";
1693
1736
  seq: number;
1694
1737
  stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
1738
+ subagent?: {
1739
+ agentName?: string;
1740
+ parentToolCallId?: string;
1741
+ toolName: string;
1742
+ };
1695
1743
  tokens?: {
1696
1744
  input: number;
1697
1745
  output: number;
1698
1746
  };
1699
1747
  type: "turn_complete";
1700
1748
  }) | {
1749
+ executionId: string;
1750
+ id: string;
1751
+ iteration?: number;
1752
+ model?: string;
1753
+ ordinal: number;
1754
+ provider?: string;
1755
+ seq: number;
1756
+ startedAt?: string;
1757
+ stepId?: string;
1758
+ subagent?: {
1759
+ agentName?: string;
1760
+ parentToolCallId?: string;
1761
+ toolName: string;
1762
+ };
1763
+ turnId?: string;
1764
+ type: "model_call_start";
1765
+ } | {
1766
+ completedAt?: string;
1767
+ cost?: number;
1768
+ durationMs?: number;
1769
+ executionId: string;
1770
+ finishReason?: string;
1771
+ id: string;
1772
+ iteration?: number;
1773
+ model?: string;
1774
+ ordinal: number;
1775
+ provider?: string;
1776
+ responseModel?: string;
1777
+ seq: number;
1778
+ subagent?: {
1779
+ agentName?: string;
1780
+ parentToolCallId?: string;
1781
+ toolName: string;
1782
+ };
1783
+ success?: boolean;
1784
+ tokens?: {
1785
+ cacheRead?: number;
1786
+ cacheWrite?: number;
1787
+ input: number;
1788
+ output: number;
1789
+ };
1790
+ turnId?: string;
1791
+ type: "model_call_complete";
1792
+ } | {
1701
1793
  executionId: string;
1702
1794
  id: string;
1703
1795
  index?: number;
@@ -1706,6 +1798,11 @@ type RuntypeExecutionStreamEvent = ({
1706
1798
  seq: number;
1707
1799
  startedAt?: string;
1708
1800
  stepType?: string;
1801
+ subagent?: {
1802
+ agentName?: string;
1803
+ parentToolCallId?: string;
1804
+ toolName: string;
1805
+ };
1709
1806
  totalSteps?: number;
1710
1807
  type: "step_start";
1711
1808
  } | ({
@@ -1733,6 +1830,11 @@ type RuntypeExecutionStreamEvent = ({
1733
1830
  seq: number;
1734
1831
  stepType?: string;
1735
1832
  stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
1833
+ subagent?: {
1834
+ agentName?: string;
1835
+ parentToolCallId?: string;
1836
+ toolName: string;
1837
+ };
1736
1838
  success?: boolean;
1737
1839
  tokensUsed?: number;
1738
1840
  type: "step_complete";
@@ -1755,6 +1857,11 @@ type RuntypeExecutionStreamEvent = ({
1755
1857
  role?: "user" | "assistant" | "system";
1756
1858
  seq: number;
1757
1859
  stepId?: string;
1860
+ subagent?: {
1861
+ agentName?: string;
1862
+ parentToolCallId?: string;
1863
+ toolName: string;
1864
+ };
1758
1865
  turnId?: string;
1759
1866
  type: "text_start";
1760
1867
  }) | {
@@ -1762,11 +1869,21 @@ type RuntypeExecutionStreamEvent = ({
1762
1869
  executionId: string;
1763
1870
  id: string;
1764
1871
  seq: number;
1872
+ subagent?: {
1873
+ agentName?: string;
1874
+ parentToolCallId?: string;
1875
+ toolName: string;
1876
+ };
1765
1877
  type: "text_delta";
1766
1878
  } | {
1767
1879
  executionId: string;
1768
1880
  id: string;
1769
1881
  seq: number;
1882
+ subagent?: {
1883
+ agentName?: string;
1884
+ parentToolCallId?: string;
1885
+ toolName: string;
1886
+ };
1770
1887
  text?: string;
1771
1888
  type: "text_complete";
1772
1889
  } | ({
@@ -1775,18 +1892,33 @@ type RuntypeExecutionStreamEvent = ({
1775
1892
  parentToolCallId?: string;
1776
1893
  scope?: "turn" | "loop";
1777
1894
  seq: number;
1895
+ subagent?: {
1896
+ agentName?: string;
1897
+ parentToolCallId?: string;
1898
+ toolName: string;
1899
+ };
1778
1900
  type: "reasoning_start";
1779
1901
  }) | {
1780
1902
  delta: string;
1781
1903
  executionId: string;
1782
1904
  id: string;
1783
1905
  seq: number;
1906
+ subagent?: {
1907
+ agentName?: string;
1908
+ parentToolCallId?: string;
1909
+ toolName: string;
1910
+ };
1784
1911
  type: "reasoning_delta";
1785
1912
  } | ({
1786
1913
  executionId: string;
1787
1914
  id: string;
1788
1915
  scope?: "turn" | "loop";
1789
1916
  seq: number;
1917
+ subagent?: {
1918
+ agentName?: string;
1919
+ parentToolCallId?: string;
1920
+ toolName: string;
1921
+ };
1790
1922
  text?: string;
1791
1923
  type: "reasoning_complete";
1792
1924
  }) | ({
@@ -1879,6 +2011,11 @@ type RuntypeExecutionStreamEvent = ({
1879
2011
  seq: number;
1880
2012
  startedAt?: string;
1881
2013
  stepId?: string;
2014
+ subagent?: {
2015
+ agentName?: string;
2016
+ parentToolCallId?: string;
2017
+ toolName: string;
2018
+ };
1882
2019
  toolCallId: string;
1883
2020
  toolName: string;
1884
2021
  toolType: string;
@@ -1887,6 +2024,11 @@ type RuntypeExecutionStreamEvent = ({
1887
2024
  delta: string;
1888
2025
  executionId: string;
1889
2026
  seq: number;
2027
+ subagent?: {
2028
+ agentName?: string;
2029
+ parentToolCallId?: string;
2030
+ toolName: string;
2031
+ };
1890
2032
  toolCallId: string;
1891
2033
  type: "tool_input_delta";
1892
2034
  } | {
@@ -1894,6 +2036,11 @@ type RuntypeExecutionStreamEvent = ({
1894
2036
  hiddenParameterNames?: Array<string>;
1895
2037
  parameters: Record<string, unknown>;
1896
2038
  seq: number;
2039
+ subagent?: {
2040
+ agentName?: string;
2041
+ parentToolCallId?: string;
2042
+ toolName: string;
2043
+ };
1897
2044
  toolCallId: string;
1898
2045
  toolName?: string;
1899
2046
  type: "tool_input_complete";
@@ -1911,6 +2058,11 @@ type RuntypeExecutionStreamEvent = ({
1911
2058
  result?: unknown;
1912
2059
  seq: number;
1913
2060
  stepId?: string;
2061
+ subagent?: {
2062
+ agentName?: string;
2063
+ parentToolCallId?: string;
2064
+ toolName: string;
2065
+ };
1914
2066
  success: boolean;
1915
2067
  toolCallId: string;
1916
2068
  toolCost?: number;
@@ -1990,6 +2142,19 @@ type RuntypeExecutionStreamEvent = ({
1990
2142
  recoverable?: boolean;
1991
2143
  seq: number;
1992
2144
  type: "error";
2145
+ }) | ({
2146
+ epoch: number;
2147
+ executionId: string;
2148
+ kind: "compaction";
2149
+ outcome?: "ok" | "failed" | "gap" | "skipped";
2150
+ phase: "start" | "complete";
2151
+ reason: "threshold" | "overflow" | "manual" | "surface_policy" | "provider_mismatch";
2152
+ seq: number;
2153
+ strategy: "provider_native" | "summary";
2154
+ tier: number;
2155
+ tokensAfter?: number;
2156
+ tokensBefore?: number;
2157
+ type: "context_notice";
1993
2158
  }) | {
1994
2159
  executionId: string;
1995
2160
  seq: number;
@@ -2921,6 +3086,14 @@ type ClientToolDefinition = {
2921
3086
  readOnlyHint?: boolean;
2922
3087
  untrustedContentHint?: boolean;
2923
3088
  };
3089
+ /**
3090
+ * Hoisted copy of `annotations.untrustedContentHint`. This is the field the
3091
+ * server actually acts on (`InlineClientToolSchema`): it spotlights the
3092
+ * tool's output before the model reads it, so instructions embedded in
3093
+ * page-provided content (reviews, comments, emails) are not treated as
3094
+ * instructions. `annotations` itself is trace/dashboard metadata only.
3095
+ */
3096
+ untrustedContentHint?: boolean;
2924
3097
  };
2925
3098
  /**
2926
3099
  * Information passed to the confirm-bubble handler before a `webmcp:*` tool
@@ -3041,15 +3214,15 @@ type AgentMessageMetadata = {
3041
3214
  */
3042
3215
  parentStepId?: string;
3043
3216
  /**
3044
- * Set to `true` on a tool-variant message produced from a `step_await`
3217
+ * Set to `true` on a tool-variant message produced from an `await`
3045
3218
  * event (`awaitReason: "local_tool_required"`). Signals to UI code that
3046
3219
  * the tool call is a LOCAL tool and the server is paused waiting for a
3047
3220
  * `POST /v1/dispatch/resume` with the user's answer keyed by tool name.
3048
3221
  */
3049
3222
  awaitingLocalTool?: boolean;
3050
3223
  /**
3051
- * The provider per-call id (`toolu_…`) carried on the `step_await` /
3052
- * `flow_await` events for a LOCAL tool (core#3878). Present only when the
3224
+ * The provider per-call id (`toolu_…`) carried on the `await`
3225
+ * event for a LOCAL tool (core#3878). Present only when the
3053
3226
  * server emits it. Two PARALLEL calls to the same tool in one turn share a
3054
3227
  * `toolName` (and a collapsed `toolId`) but get DISTINCT `webMcpToolCallId`s,
3055
3228
  * so this is the key the widget batches a single `/resume` on: preferred
@@ -4112,6 +4285,16 @@ type AgentWidgetToolCallDisplayFeature = {
4112
4285
  * @default "stack"
4113
4286
  */
4114
4287
  groupedMode?: "stack" | "summary";
4288
+ /**
4289
+ * What happens to a tool call row once it completes.
4290
+ *
4291
+ * - `"kept"` (default): the finished row stays in the transcript.
4292
+ * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4293
+ * it. The tool call stays on the message and in `getMessages()`.
4294
+ *
4295
+ * @default "kept"
4296
+ */
4297
+ completedVisibility?: AgentWidgetToolCallCompletedVisibility;
4115
4298
  /**
4116
4299
  * When false, tool call bubbles show only the collapsed summary with no
4117
4300
  * expand/collapse toggle. Users see tool awareness without full details.
@@ -4129,6 +4312,8 @@ type AgentWidgetToolCallDisplayFeature = {
4129
4312
  */
4130
4313
  loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
4131
4314
  };
4315
+ /** See `features.toolCallDisplay.completedVisibility`. */
4316
+ type AgentWidgetToolCallCompletedVisibility = "kept" | "removed";
4132
4317
  type AgentWidgetReasoningDisplayFeature = {
4133
4318
  /**
4134
4319
  * When true, active collapsed reasoning rows can render a lightweight preview block.
@@ -4174,13 +4359,26 @@ type AgentWidgetReasoningDisplayFeature = {
4174
4359
  * - `"kept"` (default): the finished row stays in the transcript.
4175
4360
  * - `"removed"`: no row is rendered at all, so the transcript gap closes with
4176
4361
  * it. The reasoning text stays on the message and in `getMessages()`.
4362
+ * - `"removed-when-short"`: behaves as `"removed"` when the completed trace
4363
+ * is short (see `shortThinkThreshold`), and as `"kept"` otherwise.
4177
4364
  *
4178
4365
  * @default "kept"
4179
4366
  */
4180
4367
  completedVisibility?: AgentWidgetReasoningCompletedVisibility;
4368
+ /**
4369
+ * Thresholds used by `completedVisibility: "removed-when-short"` to decide
4370
+ * whether a completed trace counts as short. Duration is checked first when
4371
+ * the reasoning reports one; the character count is a fallback for traces
4372
+ * with no reported duration.
4373
+ * @default { durationMs: 15000, chars: 1200 }
4374
+ */
4375
+ shortThinkThreshold?: {
4376
+ durationMs?: number;
4377
+ chars?: number;
4378
+ };
4181
4379
  };
4182
4380
  /** See `features.reasoningDisplay.completedVisibility`. */
4183
- type AgentWidgetReasoningCompletedVisibility = "kept" | "removed";
4381
+ type AgentWidgetReasoningCompletedVisibility = "kept" | "removed" | "removed-when-short";
4184
4382
  /**
4185
4383
  * Reveal animation applied to assistant message text while it is streaming.
4186
4384
  *
@@ -5174,7 +5372,7 @@ type EventStreamConfig = {
5174
5372
  /**
5175
5373
  * Custom badge color mappings by event type prefix or exact type.
5176
5374
  * Keys are matched as exact match first, then prefix match (keys ending with "_").
5177
- * @example { "flow_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
5375
+ * @example { "execution_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
5178
5376
  */
5179
5377
  badgeColors?: Record<string, EventStreamBadgeColor>;
5180
5378
  /**
@@ -6595,9 +6793,13 @@ interface VoiceProvider {
6595
6793
  * `isFinal=false` is a live interim update (user partials, or assistant deltas
6596
6794
  * on providers that stream them); `isFinal=true` finalizes that role's text.
6597
6795
  * On the realtime `runtype` path, interim updates fire for the `user` only and
6598
- * the `assistant` arrives as a single final.
6796
+ * the `assistant` arrives as a single final. Providers with overlapping turns
6797
+ * must include the same turnId on user and assistant finals; without IDs,
6798
+ * providers must discard cancelled output before emitting the next user final.
6599
6799
  */
6600
- onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean) => void): void;
6800
+ onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
6801
+ turnId?: string;
6802
+ }) => void): void;
6601
6803
  /** Register a callback for per-turn latency metrics (realtime path). */
6602
6804
  onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
6603
6805
  /**
@@ -8910,16 +9112,16 @@ type AgentWidgetConfig = {
8910
9112
  *
8911
9113
  * @example
8912
9114
  * ```typescript
8913
- * // For Runtype API format
9115
+ * // For a custom backend (Runtype unified events are handled natively)
8914
9116
  * config: {
8915
9117
  * parseSSEEvent: (data) => {
8916
- * if ((data.type === 'step_delta' || data.type === 'step_chunk') && (data.delta || data.chunk)) {
8917
- * return { text: data.delta ?? data.chunk };
9118
+ * if (data.type === 'token' && typeof data.value === 'string') {
9119
+ * return { text: data.value };
8918
9120
  * }
8919
- * if (data.type === 'flow_complete') {
9121
+ * if (data.type === 'done') {
8920
9122
  * return { done: true };
8921
9123
  * }
8922
- * if (data.type === 'step_error') {
9124
+ * if (data.type === 'failure') {
8923
9125
  * return { error: data.error };
8924
9126
  * }
8925
9127
  * return null; // Ignore other events
@@ -9110,7 +9312,7 @@ type AgentWidgetReasoning = {
9110
9312
  /**
9111
9313
  * Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
9112
9314
  * thinking; `"loop"` is a cross-iteration agent reflection (the fold that
9113
- * replaced the legacy `agent_reflection` event). Absent for legacy streams.
9315
+ * replaced the legacy `agent_reflection` event). Optional when the stream does not specify a scope.
9114
9316
  */
9115
9317
  scope?: "turn" | "loop";
9116
9318
  startedAt?: number;
@@ -9124,6 +9326,9 @@ type AgentWidgetToolCall = {
9124
9326
  args?: unknown;
9125
9327
  chunks?: string[];
9126
9328
  result?: unknown;
9329
+ /** Whether the tool succeeded; failure does not necessarily end the execution. */
9330
+ success?: boolean;
9331
+ error?: string;
9127
9332
  duration?: number;
9128
9333
  startedAt?: number;
9129
9334
  completedAt?: number;
@@ -9154,7 +9359,7 @@ type AgentWidgetApproval = {
9154
9359
  type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
9155
9360
  /**
9156
9361
  * Per-turn / per-step stop reason emitted by the runtime on
9157
- * `agent_turn_complete` and `step_complete` SSE events. The vocabulary is
9362
+ * `turn_complete` and `step_complete` SSE events. The vocabulary is
9158
9363
  * owned by the upstream Runtype API: do not extend without coordination.
9159
9364
  *
9160
9365
  * - `end_turn`: natural completion (no affordance needed)
@@ -9285,7 +9490,7 @@ type AgentWidgetMessage = {
9285
9490
  */
9286
9491
  agentMetadata?: AgentMessageMetadata;
9287
9492
  /**
9288
- * Per-turn stop reason reported by the runtime on `agent_turn_complete`
9493
+ * Per-turn stop reason reported by the runtime on `turn_complete`
9289
9494
  * (agent-loop path) or the last `step_complete` for a prompt step
9290
9495
  * (dispatch / flow path). Absent when the API did not report a value.
9291
9496
  *