@runtypelabs/persona 4.22.0 → 4.23.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.
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-B_JdVK9o.d.cts → types-9Vxm-PPz.d.cts} +136 -6
- package/dist/animations/{types-B_JdVK9o.d.ts → types-9Vxm-PPz.d.ts} +136 -6
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/animations-extra.d.cts +136 -6
- package/dist/animations-extra.d.ts +136 -6
- package/dist/approval-ui.d.cts +148 -14
- package/dist/approval-ui.d.ts +148 -14
- package/dist/artifacts-ui.d.cts +148 -14
- package/dist/artifacts-ui.d.ts +148 -14
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/context-mentions.d.cts +148 -14
- package/dist/context-mentions.d.ts +148 -14
- package/dist/event-stream-view-GL3ADRY2.js +1 -0
- package/dist/event-stream-view.cjs +1 -1
- package/dist/event-stream-view.d.cts +148 -14
- package/dist/event-stream-view.d.ts +148 -14
- package/dist/event-stream-view.js +1 -1
- package/dist/forms-ui.d.cts +161 -23
- package/dist/forms-ui.d.ts +161 -23
- package/dist/history-view.d.cts +136 -6
- package/dist/history-view.d.ts +136 -6
- package/dist/index.cjs +67 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +172 -27
- package/dist/index.d.ts +172 -27
- package/dist/index.global.js +51 -51
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +67 -67
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js.map +1 -1
- package/dist/session-reconnect.d.cts +148 -14
- package/dist/session-reconnect.d.ts +148 -14
- package/dist/smart-dom-reader.d.cts +148 -14
- package/dist/smart-dom-reader.d.ts +148 -14
- package/dist/testing.cjs +3 -3
- package/dist/testing.d.cts +3 -4
- package/dist/testing.d.ts +3 -4
- package/dist/testing.js +3 -3
- package/dist/theme-editor-preview.cjs +71 -71
- package/dist/theme-editor-preview.d.cts +154 -14
- package/dist/theme-editor-preview.d.ts +154 -14
- package/dist/theme-editor-preview.js +48 -48
- package/dist/theme-editor.d.cts +148 -14
- package/dist/theme-editor.d.ts +148 -14
- package/dist/voice-runtime.d.cts +6 -2
- package/dist/voice-runtime.d.ts +6 -2
- package/package.json +1 -1
- package/src/ask-user-question-tool.ts +1 -1
- package/src/client-history-rest.test.ts +2 -1
- package/src/client-visitor-history.test.ts +106 -4
- package/src/client.composer-options.test.ts +1 -1
- package/src/client.interrupt.test.ts +2 -2
- package/src/client.test.ts +477 -915
- package/src/client.ts +134 -494
- package/src/client.unified-tools.test.ts +76 -0
- package/src/components/event-stream-badge-theming.test.ts +3 -0
- package/src/components/event-stream-view.test.ts +76 -76
- package/src/components/event-stream-view.ts +5 -0
- package/src/components/tool-bubble.test.ts +12 -0
- package/src/components/tool-bubble.ts +13 -2
- package/src/event-stream-view-bundle.test.ts +2 -2
- package/src/generated/runtype-openapi-contract.ts +129 -1
- package/src/internal/runtype-history-provider.test.ts +2 -2
- package/src/launcher-global.ts +1 -1
- package/src/session-history.test.ts +1 -1
- package/src/session.quote.test.ts +1 -1
- package/src/session.resubmit-from.test.ts +1 -1
- package/src/session.test.ts +5 -5
- package/src/session.ts +95 -36
- package/src/suggest-replies-tool.ts +1 -1
- package/src/testing/mock-stream.test.ts +37 -16
- package/src/testing/mock-stream.ts +14 -9
- package/src/types.ts +19 -14
- package/src/ui.ask-user-question-plugin.test.ts +7 -7
- package/src/ui.composer-defer-one.test.ts +6 -34
- package/src/ui.composer-draft-persistence.test.ts +1 -1
- package/src/ui.composer-quote.test.ts +1 -1
- package/src/ui.message-history-actions.test.ts +1 -1
- package/src/ui.streaming-coalescing.test.ts +10 -13
- package/src/ui.ts +80 -32
- package/src/ui.typing-indicator.test.ts +216 -0
- package/src/ui.voice-custom-provider.test.ts +211 -0
- package/src/utils/event-stream-buffer.test.ts +13 -13
- package/src/utils/event-stream-capture.test.ts +20 -20
- package/src/utils/throughput-tracker.test.ts +100 -142
- package/src/utils/throughput-tracker.ts +18 -132
- package/src/utils/voice-support.ts +18 -1
- package/src/voice/voice-turn-tracker.ts +18 -0
- package/src/webmcp-bridge.ts +1 -1
- package/dist/event-stream-view-FKWDY3UB.js +0 -1
- package/src/utils/__fixtures__/unified-translator.oracle.ts +0 -717
package/dist/theme-editor.d.cts
CHANGED
|
@@ -1694,6 +1694,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1694
1694
|
iteration?: number;
|
|
1695
1695
|
role: "user" | "assistant" | "system";
|
|
1696
1696
|
seq: number;
|
|
1697
|
+
subagent?: {
|
|
1698
|
+
agentName?: string;
|
|
1699
|
+
parentToolCallId?: string;
|
|
1700
|
+
toolName: string;
|
|
1701
|
+
};
|
|
1697
1702
|
turnIndex?: number;
|
|
1698
1703
|
type: "turn_start";
|
|
1699
1704
|
}) | ({
|
|
@@ -1728,12 +1733,61 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1728
1733
|
role: "user" | "assistant" | "system";
|
|
1729
1734
|
seq: number;
|
|
1730
1735
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
1736
|
+
subagent?: {
|
|
1737
|
+
agentName?: string;
|
|
1738
|
+
parentToolCallId?: string;
|
|
1739
|
+
toolName: string;
|
|
1740
|
+
};
|
|
1731
1741
|
tokens?: {
|
|
1732
1742
|
input: number;
|
|
1733
1743
|
output: number;
|
|
1734
1744
|
};
|
|
1735
1745
|
type: "turn_complete";
|
|
1736
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
|
+
} | {
|
|
1737
1791
|
executionId: string;
|
|
1738
1792
|
id: string;
|
|
1739
1793
|
index?: number;
|
|
@@ -1742,6 +1796,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1742
1796
|
seq: number;
|
|
1743
1797
|
startedAt?: string;
|
|
1744
1798
|
stepType?: string;
|
|
1799
|
+
subagent?: {
|
|
1800
|
+
agentName?: string;
|
|
1801
|
+
parentToolCallId?: string;
|
|
1802
|
+
toolName: string;
|
|
1803
|
+
};
|
|
1745
1804
|
totalSteps?: number;
|
|
1746
1805
|
type: "step_start";
|
|
1747
1806
|
} | ({
|
|
@@ -1769,6 +1828,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1769
1828
|
seq: number;
|
|
1770
1829
|
stepType?: string;
|
|
1771
1830
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
1831
|
+
subagent?: {
|
|
1832
|
+
agentName?: string;
|
|
1833
|
+
parentToolCallId?: string;
|
|
1834
|
+
toolName: string;
|
|
1835
|
+
};
|
|
1772
1836
|
success?: boolean;
|
|
1773
1837
|
tokensUsed?: number;
|
|
1774
1838
|
type: "step_complete";
|
|
@@ -1791,6 +1855,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1791
1855
|
role?: "user" | "assistant" | "system";
|
|
1792
1856
|
seq: number;
|
|
1793
1857
|
stepId?: string;
|
|
1858
|
+
subagent?: {
|
|
1859
|
+
agentName?: string;
|
|
1860
|
+
parentToolCallId?: string;
|
|
1861
|
+
toolName: string;
|
|
1862
|
+
};
|
|
1794
1863
|
turnId?: string;
|
|
1795
1864
|
type: "text_start";
|
|
1796
1865
|
}) | {
|
|
@@ -1798,11 +1867,21 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1798
1867
|
executionId: string;
|
|
1799
1868
|
id: string;
|
|
1800
1869
|
seq: number;
|
|
1870
|
+
subagent?: {
|
|
1871
|
+
agentName?: string;
|
|
1872
|
+
parentToolCallId?: string;
|
|
1873
|
+
toolName: string;
|
|
1874
|
+
};
|
|
1801
1875
|
type: "text_delta";
|
|
1802
1876
|
} | {
|
|
1803
1877
|
executionId: string;
|
|
1804
1878
|
id: string;
|
|
1805
1879
|
seq: number;
|
|
1880
|
+
subagent?: {
|
|
1881
|
+
agentName?: string;
|
|
1882
|
+
parentToolCallId?: string;
|
|
1883
|
+
toolName: string;
|
|
1884
|
+
};
|
|
1806
1885
|
text?: string;
|
|
1807
1886
|
type: "text_complete";
|
|
1808
1887
|
} | ({
|
|
@@ -1811,18 +1890,33 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1811
1890
|
parentToolCallId?: string;
|
|
1812
1891
|
scope?: "turn" | "loop";
|
|
1813
1892
|
seq: number;
|
|
1893
|
+
subagent?: {
|
|
1894
|
+
agentName?: string;
|
|
1895
|
+
parentToolCallId?: string;
|
|
1896
|
+
toolName: string;
|
|
1897
|
+
};
|
|
1814
1898
|
type: "reasoning_start";
|
|
1815
1899
|
}) | {
|
|
1816
1900
|
delta: string;
|
|
1817
1901
|
executionId: string;
|
|
1818
1902
|
id: string;
|
|
1819
1903
|
seq: number;
|
|
1904
|
+
subagent?: {
|
|
1905
|
+
agentName?: string;
|
|
1906
|
+
parentToolCallId?: string;
|
|
1907
|
+
toolName: string;
|
|
1908
|
+
};
|
|
1820
1909
|
type: "reasoning_delta";
|
|
1821
1910
|
} | ({
|
|
1822
1911
|
executionId: string;
|
|
1823
1912
|
id: string;
|
|
1824
1913
|
scope?: "turn" | "loop";
|
|
1825
1914
|
seq: number;
|
|
1915
|
+
subagent?: {
|
|
1916
|
+
agentName?: string;
|
|
1917
|
+
parentToolCallId?: string;
|
|
1918
|
+
toolName: string;
|
|
1919
|
+
};
|
|
1826
1920
|
text?: string;
|
|
1827
1921
|
type: "reasoning_complete";
|
|
1828
1922
|
}) | ({
|
|
@@ -1915,6 +2009,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1915
2009
|
seq: number;
|
|
1916
2010
|
startedAt?: string;
|
|
1917
2011
|
stepId?: string;
|
|
2012
|
+
subagent?: {
|
|
2013
|
+
agentName?: string;
|
|
2014
|
+
parentToolCallId?: string;
|
|
2015
|
+
toolName: string;
|
|
2016
|
+
};
|
|
1918
2017
|
toolCallId: string;
|
|
1919
2018
|
toolName: string;
|
|
1920
2019
|
toolType: string;
|
|
@@ -1923,6 +2022,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1923
2022
|
delta: string;
|
|
1924
2023
|
executionId: string;
|
|
1925
2024
|
seq: number;
|
|
2025
|
+
subagent?: {
|
|
2026
|
+
agentName?: string;
|
|
2027
|
+
parentToolCallId?: string;
|
|
2028
|
+
toolName: string;
|
|
2029
|
+
};
|
|
1926
2030
|
toolCallId: string;
|
|
1927
2031
|
type: "tool_input_delta";
|
|
1928
2032
|
} | {
|
|
@@ -1930,6 +2034,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1930
2034
|
hiddenParameterNames?: Array<string>;
|
|
1931
2035
|
parameters: Record<string, unknown>;
|
|
1932
2036
|
seq: number;
|
|
2037
|
+
subagent?: {
|
|
2038
|
+
agentName?: string;
|
|
2039
|
+
parentToolCallId?: string;
|
|
2040
|
+
toolName: string;
|
|
2041
|
+
};
|
|
1933
2042
|
toolCallId: string;
|
|
1934
2043
|
toolName?: string;
|
|
1935
2044
|
type: "tool_input_complete";
|
|
@@ -1947,6 +2056,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1947
2056
|
result?: unknown;
|
|
1948
2057
|
seq: number;
|
|
1949
2058
|
stepId?: string;
|
|
2059
|
+
subagent?: {
|
|
2060
|
+
agentName?: string;
|
|
2061
|
+
parentToolCallId?: string;
|
|
2062
|
+
toolName: string;
|
|
2063
|
+
};
|
|
1950
2064
|
success: boolean;
|
|
1951
2065
|
toolCallId: string;
|
|
1952
2066
|
toolCost?: number;
|
|
@@ -2026,6 +2140,19 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2026
2140
|
recoverable?: boolean;
|
|
2027
2141
|
seq: number;
|
|
2028
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";
|
|
2029
2156
|
}) | {
|
|
2030
2157
|
executionId: string;
|
|
2031
2158
|
seq: number;
|
|
@@ -3085,15 +3212,15 @@ type AgentMessageMetadata = {
|
|
|
3085
3212
|
*/
|
|
3086
3213
|
parentStepId?: string;
|
|
3087
3214
|
/**
|
|
3088
|
-
* Set to `true` on a tool-variant message produced from
|
|
3215
|
+
* Set to `true` on a tool-variant message produced from an `await`
|
|
3089
3216
|
* event (`awaitReason: "local_tool_required"`). Signals to UI code that
|
|
3090
3217
|
* the tool call is a LOCAL tool and the server is paused waiting for a
|
|
3091
3218
|
* `POST /v1/dispatch/resume` with the user's answer keyed by tool name.
|
|
3092
3219
|
*/
|
|
3093
3220
|
awaitingLocalTool?: boolean;
|
|
3094
3221
|
/**
|
|
3095
|
-
* The provider per-call id (`toolu_…`) carried on the `
|
|
3096
|
-
*
|
|
3222
|
+
* The provider per-call id (`toolu_…`) carried on the `await`
|
|
3223
|
+
* event for a LOCAL tool (core#3878). Present only when the
|
|
3097
3224
|
* server emits it. Two PARALLEL calls to the same tool in one turn share a
|
|
3098
3225
|
* `toolName` (and a collapsed `toolId`) but get DISTINCT `webMcpToolCallId`s,
|
|
3099
3226
|
* so this is the key the widget batches a single `/resume` on: preferred
|
|
@@ -5248,7 +5375,7 @@ type EventStreamConfig = {
|
|
|
5248
5375
|
/**
|
|
5249
5376
|
* Custom badge color mappings by event type prefix or exact type.
|
|
5250
5377
|
* Keys are matched as exact match first, then prefix match (keys ending with "_").
|
|
5251
|
-
* @example { "
|
|
5378
|
+
* @example { "execution_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
|
|
5252
5379
|
*/
|
|
5253
5380
|
badgeColors?: Record<string, EventStreamBadgeColor>;
|
|
5254
5381
|
/**
|
|
@@ -6669,9 +6796,13 @@ interface VoiceProvider {
|
|
|
6669
6796
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
6670
6797
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
6671
6798
|
* On the realtime `runtype` path, interim updates fire for the `user` only and
|
|
6672
|
-
* the `assistant` arrives as a single final.
|
|
6799
|
+
* the `assistant` arrives as a single final. Providers with overlapping turns
|
|
6800
|
+
* must include the same turnId on user and assistant finals; without IDs,
|
|
6801
|
+
* providers must discard cancelled output before emitting the next user final.
|
|
6673
6802
|
*/
|
|
6674
|
-
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean
|
|
6803
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
|
|
6804
|
+
turnId?: string;
|
|
6805
|
+
}) => void): void;
|
|
6675
6806
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
6676
6807
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
6677
6808
|
/**
|
|
@@ -8984,16 +9115,16 @@ type AgentWidgetConfig = {
|
|
|
8984
9115
|
*
|
|
8985
9116
|
* @example
|
|
8986
9117
|
* ```typescript
|
|
8987
|
-
* // For Runtype
|
|
9118
|
+
* // For a custom backend (Runtype unified events are handled natively)
|
|
8988
9119
|
* config: {
|
|
8989
9120
|
* parseSSEEvent: (data) => {
|
|
8990
|
-
* if (
|
|
8991
|
-
* return { text: data.
|
|
9121
|
+
* if (data.type === 'token' && typeof data.value === 'string') {
|
|
9122
|
+
* return { text: data.value };
|
|
8992
9123
|
* }
|
|
8993
|
-
* if (data.type === '
|
|
9124
|
+
* if (data.type === 'done') {
|
|
8994
9125
|
* return { done: true };
|
|
8995
9126
|
* }
|
|
8996
|
-
* if (data.type === '
|
|
9127
|
+
* if (data.type === 'failure') {
|
|
8997
9128
|
* return { error: data.error };
|
|
8998
9129
|
* }
|
|
8999
9130
|
* return null; // Ignore other events
|
|
@@ -9184,7 +9315,7 @@ type AgentWidgetReasoning = {
|
|
|
9184
9315
|
/**
|
|
9185
9316
|
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
9186
9317
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
9187
|
-
* replaced the legacy `agent_reflection` event).
|
|
9318
|
+
* replaced the legacy `agent_reflection` event). Optional when the stream does not specify a scope.
|
|
9188
9319
|
*/
|
|
9189
9320
|
scope?: "turn" | "loop";
|
|
9190
9321
|
startedAt?: number;
|
|
@@ -9198,6 +9329,9 @@ type AgentWidgetToolCall = {
|
|
|
9198
9329
|
args?: unknown;
|
|
9199
9330
|
chunks?: string[];
|
|
9200
9331
|
result?: unknown;
|
|
9332
|
+
/** Whether the tool succeeded; failure does not necessarily end the execution. */
|
|
9333
|
+
success?: boolean;
|
|
9334
|
+
error?: string;
|
|
9201
9335
|
duration?: number;
|
|
9202
9336
|
startedAt?: number;
|
|
9203
9337
|
completedAt?: number;
|
|
@@ -9228,7 +9362,7 @@ type AgentWidgetApproval = {
|
|
|
9228
9362
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
9229
9363
|
/**
|
|
9230
9364
|
* Per-turn / per-step stop reason emitted by the runtime on
|
|
9231
|
-
* `
|
|
9365
|
+
* `turn_complete` and `step_complete` SSE events. The vocabulary is
|
|
9232
9366
|
* owned by the upstream Runtype API: do not extend without coordination.
|
|
9233
9367
|
*
|
|
9234
9368
|
* - `end_turn`: natural completion (no affordance needed)
|
|
@@ -9359,7 +9493,7 @@ type AgentWidgetMessage = {
|
|
|
9359
9493
|
*/
|
|
9360
9494
|
agentMetadata?: AgentMessageMetadata;
|
|
9361
9495
|
/**
|
|
9362
|
-
* Per-turn stop reason reported by the runtime on `
|
|
9496
|
+
* Per-turn stop reason reported by the runtime on `turn_complete`
|
|
9363
9497
|
* (agent-loop path) or the last `step_complete` for a prompt step
|
|
9364
9498
|
* (dispatch / flow path). Absent when the API did not report a value.
|
|
9365
9499
|
*
|
package/dist/theme-editor.d.ts
CHANGED
|
@@ -1694,6 +1694,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1694
1694
|
iteration?: number;
|
|
1695
1695
|
role: "user" | "assistant" | "system";
|
|
1696
1696
|
seq: number;
|
|
1697
|
+
subagent?: {
|
|
1698
|
+
agentName?: string;
|
|
1699
|
+
parentToolCallId?: string;
|
|
1700
|
+
toolName: string;
|
|
1701
|
+
};
|
|
1697
1702
|
turnIndex?: number;
|
|
1698
1703
|
type: "turn_start";
|
|
1699
1704
|
}) | ({
|
|
@@ -1728,12 +1733,61 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1728
1733
|
role: "user" | "assistant" | "system";
|
|
1729
1734
|
seq: number;
|
|
1730
1735
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
1736
|
+
subagent?: {
|
|
1737
|
+
agentName?: string;
|
|
1738
|
+
parentToolCallId?: string;
|
|
1739
|
+
toolName: string;
|
|
1740
|
+
};
|
|
1731
1741
|
tokens?: {
|
|
1732
1742
|
input: number;
|
|
1733
1743
|
output: number;
|
|
1734
1744
|
};
|
|
1735
1745
|
type: "turn_complete";
|
|
1736
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
|
+
} | {
|
|
1737
1791
|
executionId: string;
|
|
1738
1792
|
id: string;
|
|
1739
1793
|
index?: number;
|
|
@@ -1742,6 +1796,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1742
1796
|
seq: number;
|
|
1743
1797
|
startedAt?: string;
|
|
1744
1798
|
stepType?: string;
|
|
1799
|
+
subagent?: {
|
|
1800
|
+
agentName?: string;
|
|
1801
|
+
parentToolCallId?: string;
|
|
1802
|
+
toolName: string;
|
|
1803
|
+
};
|
|
1745
1804
|
totalSteps?: number;
|
|
1746
1805
|
type: "step_start";
|
|
1747
1806
|
} | ({
|
|
@@ -1769,6 +1828,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1769
1828
|
seq: number;
|
|
1770
1829
|
stepType?: string;
|
|
1771
1830
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
1831
|
+
subagent?: {
|
|
1832
|
+
agentName?: string;
|
|
1833
|
+
parentToolCallId?: string;
|
|
1834
|
+
toolName: string;
|
|
1835
|
+
};
|
|
1772
1836
|
success?: boolean;
|
|
1773
1837
|
tokensUsed?: number;
|
|
1774
1838
|
type: "step_complete";
|
|
@@ -1791,6 +1855,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1791
1855
|
role?: "user" | "assistant" | "system";
|
|
1792
1856
|
seq: number;
|
|
1793
1857
|
stepId?: string;
|
|
1858
|
+
subagent?: {
|
|
1859
|
+
agentName?: string;
|
|
1860
|
+
parentToolCallId?: string;
|
|
1861
|
+
toolName: string;
|
|
1862
|
+
};
|
|
1794
1863
|
turnId?: string;
|
|
1795
1864
|
type: "text_start";
|
|
1796
1865
|
}) | {
|
|
@@ -1798,11 +1867,21 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1798
1867
|
executionId: string;
|
|
1799
1868
|
id: string;
|
|
1800
1869
|
seq: number;
|
|
1870
|
+
subagent?: {
|
|
1871
|
+
agentName?: string;
|
|
1872
|
+
parentToolCallId?: string;
|
|
1873
|
+
toolName: string;
|
|
1874
|
+
};
|
|
1801
1875
|
type: "text_delta";
|
|
1802
1876
|
} | {
|
|
1803
1877
|
executionId: string;
|
|
1804
1878
|
id: string;
|
|
1805
1879
|
seq: number;
|
|
1880
|
+
subagent?: {
|
|
1881
|
+
agentName?: string;
|
|
1882
|
+
parentToolCallId?: string;
|
|
1883
|
+
toolName: string;
|
|
1884
|
+
};
|
|
1806
1885
|
text?: string;
|
|
1807
1886
|
type: "text_complete";
|
|
1808
1887
|
} | ({
|
|
@@ -1811,18 +1890,33 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1811
1890
|
parentToolCallId?: string;
|
|
1812
1891
|
scope?: "turn" | "loop";
|
|
1813
1892
|
seq: number;
|
|
1893
|
+
subagent?: {
|
|
1894
|
+
agentName?: string;
|
|
1895
|
+
parentToolCallId?: string;
|
|
1896
|
+
toolName: string;
|
|
1897
|
+
};
|
|
1814
1898
|
type: "reasoning_start";
|
|
1815
1899
|
}) | {
|
|
1816
1900
|
delta: string;
|
|
1817
1901
|
executionId: string;
|
|
1818
1902
|
id: string;
|
|
1819
1903
|
seq: number;
|
|
1904
|
+
subagent?: {
|
|
1905
|
+
agentName?: string;
|
|
1906
|
+
parentToolCallId?: string;
|
|
1907
|
+
toolName: string;
|
|
1908
|
+
};
|
|
1820
1909
|
type: "reasoning_delta";
|
|
1821
1910
|
} | ({
|
|
1822
1911
|
executionId: string;
|
|
1823
1912
|
id: string;
|
|
1824
1913
|
scope?: "turn" | "loop";
|
|
1825
1914
|
seq: number;
|
|
1915
|
+
subagent?: {
|
|
1916
|
+
agentName?: string;
|
|
1917
|
+
parentToolCallId?: string;
|
|
1918
|
+
toolName: string;
|
|
1919
|
+
};
|
|
1826
1920
|
text?: string;
|
|
1827
1921
|
type: "reasoning_complete";
|
|
1828
1922
|
}) | ({
|
|
@@ -1915,6 +2009,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1915
2009
|
seq: number;
|
|
1916
2010
|
startedAt?: string;
|
|
1917
2011
|
stepId?: string;
|
|
2012
|
+
subagent?: {
|
|
2013
|
+
agentName?: string;
|
|
2014
|
+
parentToolCallId?: string;
|
|
2015
|
+
toolName: string;
|
|
2016
|
+
};
|
|
1918
2017
|
toolCallId: string;
|
|
1919
2018
|
toolName: string;
|
|
1920
2019
|
toolType: string;
|
|
@@ -1923,6 +2022,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1923
2022
|
delta: string;
|
|
1924
2023
|
executionId: string;
|
|
1925
2024
|
seq: number;
|
|
2025
|
+
subagent?: {
|
|
2026
|
+
agentName?: string;
|
|
2027
|
+
parentToolCallId?: string;
|
|
2028
|
+
toolName: string;
|
|
2029
|
+
};
|
|
1926
2030
|
toolCallId: string;
|
|
1927
2031
|
type: "tool_input_delta";
|
|
1928
2032
|
} | {
|
|
@@ -1930,6 +2034,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1930
2034
|
hiddenParameterNames?: Array<string>;
|
|
1931
2035
|
parameters: Record<string, unknown>;
|
|
1932
2036
|
seq: number;
|
|
2037
|
+
subagent?: {
|
|
2038
|
+
agentName?: string;
|
|
2039
|
+
parentToolCallId?: string;
|
|
2040
|
+
toolName: string;
|
|
2041
|
+
};
|
|
1933
2042
|
toolCallId: string;
|
|
1934
2043
|
toolName?: string;
|
|
1935
2044
|
type: "tool_input_complete";
|
|
@@ -1947,6 +2056,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1947
2056
|
result?: unknown;
|
|
1948
2057
|
seq: number;
|
|
1949
2058
|
stepId?: string;
|
|
2059
|
+
subagent?: {
|
|
2060
|
+
agentName?: string;
|
|
2061
|
+
parentToolCallId?: string;
|
|
2062
|
+
toolName: string;
|
|
2063
|
+
};
|
|
1950
2064
|
success: boolean;
|
|
1951
2065
|
toolCallId: string;
|
|
1952
2066
|
toolCost?: number;
|
|
@@ -2026,6 +2140,19 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2026
2140
|
recoverable?: boolean;
|
|
2027
2141
|
seq: number;
|
|
2028
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";
|
|
2029
2156
|
}) | {
|
|
2030
2157
|
executionId: string;
|
|
2031
2158
|
seq: number;
|
|
@@ -3085,15 +3212,15 @@ type AgentMessageMetadata = {
|
|
|
3085
3212
|
*/
|
|
3086
3213
|
parentStepId?: string;
|
|
3087
3214
|
/**
|
|
3088
|
-
* Set to `true` on a tool-variant message produced from
|
|
3215
|
+
* Set to `true` on a tool-variant message produced from an `await`
|
|
3089
3216
|
* event (`awaitReason: "local_tool_required"`). Signals to UI code that
|
|
3090
3217
|
* the tool call is a LOCAL tool and the server is paused waiting for a
|
|
3091
3218
|
* `POST /v1/dispatch/resume` with the user's answer keyed by tool name.
|
|
3092
3219
|
*/
|
|
3093
3220
|
awaitingLocalTool?: boolean;
|
|
3094
3221
|
/**
|
|
3095
|
-
* The provider per-call id (`toolu_…`) carried on the `
|
|
3096
|
-
*
|
|
3222
|
+
* The provider per-call id (`toolu_…`) carried on the `await`
|
|
3223
|
+
* event for a LOCAL tool (core#3878). Present only when the
|
|
3097
3224
|
* server emits it. Two PARALLEL calls to the same tool in one turn share a
|
|
3098
3225
|
* `toolName` (and a collapsed `toolId`) but get DISTINCT `webMcpToolCallId`s,
|
|
3099
3226
|
* so this is the key the widget batches a single `/resume` on: preferred
|
|
@@ -5248,7 +5375,7 @@ type EventStreamConfig = {
|
|
|
5248
5375
|
/**
|
|
5249
5376
|
* Custom badge color mappings by event type prefix or exact type.
|
|
5250
5377
|
* Keys are matched as exact match first, then prefix match (keys ending with "_").
|
|
5251
|
-
* @example { "
|
|
5378
|
+
* @example { "execution_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
|
|
5252
5379
|
*/
|
|
5253
5380
|
badgeColors?: Record<string, EventStreamBadgeColor>;
|
|
5254
5381
|
/**
|
|
@@ -6669,9 +6796,13 @@ interface VoiceProvider {
|
|
|
6669
6796
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
6670
6797
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
6671
6798
|
* On the realtime `runtype` path, interim updates fire for the `user` only and
|
|
6672
|
-
* the `assistant` arrives as a single final.
|
|
6799
|
+
* the `assistant` arrives as a single final. Providers with overlapping turns
|
|
6800
|
+
* must include the same turnId on user and assistant finals; without IDs,
|
|
6801
|
+
* providers must discard cancelled output before emitting the next user final.
|
|
6673
6802
|
*/
|
|
6674
|
-
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean
|
|
6803
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
|
|
6804
|
+
turnId?: string;
|
|
6805
|
+
}) => void): void;
|
|
6675
6806
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
6676
6807
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
6677
6808
|
/**
|
|
@@ -8984,16 +9115,16 @@ type AgentWidgetConfig = {
|
|
|
8984
9115
|
*
|
|
8985
9116
|
* @example
|
|
8986
9117
|
* ```typescript
|
|
8987
|
-
* // For Runtype
|
|
9118
|
+
* // For a custom backend (Runtype unified events are handled natively)
|
|
8988
9119
|
* config: {
|
|
8989
9120
|
* parseSSEEvent: (data) => {
|
|
8990
|
-
* if (
|
|
8991
|
-
* return { text: data.
|
|
9121
|
+
* if (data.type === 'token' && typeof data.value === 'string') {
|
|
9122
|
+
* return { text: data.value };
|
|
8992
9123
|
* }
|
|
8993
|
-
* if (data.type === '
|
|
9124
|
+
* if (data.type === 'done') {
|
|
8994
9125
|
* return { done: true };
|
|
8995
9126
|
* }
|
|
8996
|
-
* if (data.type === '
|
|
9127
|
+
* if (data.type === 'failure') {
|
|
8997
9128
|
* return { error: data.error };
|
|
8998
9129
|
* }
|
|
8999
9130
|
* return null; // Ignore other events
|
|
@@ -9184,7 +9315,7 @@ type AgentWidgetReasoning = {
|
|
|
9184
9315
|
/**
|
|
9185
9316
|
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
9186
9317
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
9187
|
-
* replaced the legacy `agent_reflection` event).
|
|
9318
|
+
* replaced the legacy `agent_reflection` event). Optional when the stream does not specify a scope.
|
|
9188
9319
|
*/
|
|
9189
9320
|
scope?: "turn" | "loop";
|
|
9190
9321
|
startedAt?: number;
|
|
@@ -9198,6 +9329,9 @@ type AgentWidgetToolCall = {
|
|
|
9198
9329
|
args?: unknown;
|
|
9199
9330
|
chunks?: string[];
|
|
9200
9331
|
result?: unknown;
|
|
9332
|
+
/** Whether the tool succeeded; failure does not necessarily end the execution. */
|
|
9333
|
+
success?: boolean;
|
|
9334
|
+
error?: string;
|
|
9201
9335
|
duration?: number;
|
|
9202
9336
|
startedAt?: number;
|
|
9203
9337
|
completedAt?: number;
|
|
@@ -9228,7 +9362,7 @@ type AgentWidgetApproval = {
|
|
|
9228
9362
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
9229
9363
|
/**
|
|
9230
9364
|
* Per-turn / per-step stop reason emitted by the runtime on
|
|
9231
|
-
* `
|
|
9365
|
+
* `turn_complete` and `step_complete` SSE events. The vocabulary is
|
|
9232
9366
|
* owned by the upstream Runtype API: do not extend without coordination.
|
|
9233
9367
|
*
|
|
9234
9368
|
* - `end_turn`: natural completion (no affordance needed)
|
|
@@ -9359,7 +9493,7 @@ type AgentWidgetMessage = {
|
|
|
9359
9493
|
*/
|
|
9360
9494
|
agentMetadata?: AgentMessageMetadata;
|
|
9361
9495
|
/**
|
|
9362
|
-
* Per-turn stop reason reported by the runtime on `
|
|
9496
|
+
* Per-turn stop reason reported by the runtime on `turn_complete`
|
|
9363
9497
|
* (agent-loop path) or the last `step_complete` for a prompt step
|
|
9364
9498
|
* (dispatch / flow path). Absent when the API did not report a value.
|
|
9365
9499
|
*
|
package/dist/voice-runtime.d.cts
CHANGED
|
@@ -110,9 +110,13 @@ interface VoiceProvider {
|
|
|
110
110
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
111
111
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
112
112
|
* On the realtime `runtype` path, interim updates fire for the `user` only and
|
|
113
|
-
* the `assistant` arrives as a single final.
|
|
113
|
+
* the `assistant` arrives as a single final. Providers with overlapping turns
|
|
114
|
+
* must include the same turnId on user and assistant finals; without IDs,
|
|
115
|
+
* providers must discard cancelled output before emitting the next user final.
|
|
114
116
|
*/
|
|
115
|
-
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean
|
|
117
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
|
|
118
|
+
turnId?: string;
|
|
119
|
+
}) => void): void;
|
|
116
120
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
117
121
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
118
122
|
/**
|
package/dist/voice-runtime.d.ts
CHANGED
|
@@ -110,9 +110,13 @@ interface VoiceProvider {
|
|
|
110
110
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
111
111
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
112
112
|
* On the realtime `runtype` path, interim updates fire for the `user` only and
|
|
113
|
-
* the `assistant` arrives as a single final.
|
|
113
|
+
* the `assistant` arrives as a single final. Providers with overlapping turns
|
|
114
|
+
* must include the same turnId on user and assistant finals; without IDs,
|
|
115
|
+
* providers must discard cancelled output before emitting the next user final.
|
|
114
116
|
*/
|
|
115
|
-
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean
|
|
117
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
|
|
118
|
+
turnId?: string;
|
|
119
|
+
}) => void): void;
|
|
116
120
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
117
121
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
118
122
|
/**
|