@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/artifacts-ui.d.cts
CHANGED
|
@@ -1696,6 +1696,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1696
1696
|
iteration?: number;
|
|
1697
1697
|
role: "user" | "assistant" | "system";
|
|
1698
1698
|
seq: number;
|
|
1699
|
+
subagent?: {
|
|
1700
|
+
agentName?: string;
|
|
1701
|
+
parentToolCallId?: string;
|
|
1702
|
+
toolName: string;
|
|
1703
|
+
};
|
|
1699
1704
|
turnIndex?: number;
|
|
1700
1705
|
type: "turn_start";
|
|
1701
1706
|
}) | ({
|
|
@@ -1730,12 +1735,61 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1730
1735
|
role: "user" | "assistant" | "system";
|
|
1731
1736
|
seq: number;
|
|
1732
1737
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
1738
|
+
subagent?: {
|
|
1739
|
+
agentName?: string;
|
|
1740
|
+
parentToolCallId?: string;
|
|
1741
|
+
toolName: string;
|
|
1742
|
+
};
|
|
1733
1743
|
tokens?: {
|
|
1734
1744
|
input: number;
|
|
1735
1745
|
output: number;
|
|
1736
1746
|
};
|
|
1737
1747
|
type: "turn_complete";
|
|
1738
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
|
+
} | {
|
|
1739
1793
|
executionId: string;
|
|
1740
1794
|
id: string;
|
|
1741
1795
|
index?: number;
|
|
@@ -1744,6 +1798,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1744
1798
|
seq: number;
|
|
1745
1799
|
startedAt?: string;
|
|
1746
1800
|
stepType?: string;
|
|
1801
|
+
subagent?: {
|
|
1802
|
+
agentName?: string;
|
|
1803
|
+
parentToolCallId?: string;
|
|
1804
|
+
toolName: string;
|
|
1805
|
+
};
|
|
1747
1806
|
totalSteps?: number;
|
|
1748
1807
|
type: "step_start";
|
|
1749
1808
|
} | ({
|
|
@@ -1771,6 +1830,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1771
1830
|
seq: number;
|
|
1772
1831
|
stepType?: string;
|
|
1773
1832
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
1833
|
+
subagent?: {
|
|
1834
|
+
agentName?: string;
|
|
1835
|
+
parentToolCallId?: string;
|
|
1836
|
+
toolName: string;
|
|
1837
|
+
};
|
|
1774
1838
|
success?: boolean;
|
|
1775
1839
|
tokensUsed?: number;
|
|
1776
1840
|
type: "step_complete";
|
|
@@ -1793,6 +1857,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1793
1857
|
role?: "user" | "assistant" | "system";
|
|
1794
1858
|
seq: number;
|
|
1795
1859
|
stepId?: string;
|
|
1860
|
+
subagent?: {
|
|
1861
|
+
agentName?: string;
|
|
1862
|
+
parentToolCallId?: string;
|
|
1863
|
+
toolName: string;
|
|
1864
|
+
};
|
|
1796
1865
|
turnId?: string;
|
|
1797
1866
|
type: "text_start";
|
|
1798
1867
|
}) | {
|
|
@@ -1800,11 +1869,21 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1800
1869
|
executionId: string;
|
|
1801
1870
|
id: string;
|
|
1802
1871
|
seq: number;
|
|
1872
|
+
subagent?: {
|
|
1873
|
+
agentName?: string;
|
|
1874
|
+
parentToolCallId?: string;
|
|
1875
|
+
toolName: string;
|
|
1876
|
+
};
|
|
1803
1877
|
type: "text_delta";
|
|
1804
1878
|
} | {
|
|
1805
1879
|
executionId: string;
|
|
1806
1880
|
id: string;
|
|
1807
1881
|
seq: number;
|
|
1882
|
+
subagent?: {
|
|
1883
|
+
agentName?: string;
|
|
1884
|
+
parentToolCallId?: string;
|
|
1885
|
+
toolName: string;
|
|
1886
|
+
};
|
|
1808
1887
|
text?: string;
|
|
1809
1888
|
type: "text_complete";
|
|
1810
1889
|
} | ({
|
|
@@ -1813,18 +1892,33 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1813
1892
|
parentToolCallId?: string;
|
|
1814
1893
|
scope?: "turn" | "loop";
|
|
1815
1894
|
seq: number;
|
|
1895
|
+
subagent?: {
|
|
1896
|
+
agentName?: string;
|
|
1897
|
+
parentToolCallId?: string;
|
|
1898
|
+
toolName: string;
|
|
1899
|
+
};
|
|
1816
1900
|
type: "reasoning_start";
|
|
1817
1901
|
}) | {
|
|
1818
1902
|
delta: string;
|
|
1819
1903
|
executionId: string;
|
|
1820
1904
|
id: string;
|
|
1821
1905
|
seq: number;
|
|
1906
|
+
subagent?: {
|
|
1907
|
+
agentName?: string;
|
|
1908
|
+
parentToolCallId?: string;
|
|
1909
|
+
toolName: string;
|
|
1910
|
+
};
|
|
1822
1911
|
type: "reasoning_delta";
|
|
1823
1912
|
} | ({
|
|
1824
1913
|
executionId: string;
|
|
1825
1914
|
id: string;
|
|
1826
1915
|
scope?: "turn" | "loop";
|
|
1827
1916
|
seq: number;
|
|
1917
|
+
subagent?: {
|
|
1918
|
+
agentName?: string;
|
|
1919
|
+
parentToolCallId?: string;
|
|
1920
|
+
toolName: string;
|
|
1921
|
+
};
|
|
1828
1922
|
text?: string;
|
|
1829
1923
|
type: "reasoning_complete";
|
|
1830
1924
|
}) | ({
|
|
@@ -1917,6 +2011,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1917
2011
|
seq: number;
|
|
1918
2012
|
startedAt?: string;
|
|
1919
2013
|
stepId?: string;
|
|
2014
|
+
subagent?: {
|
|
2015
|
+
agentName?: string;
|
|
2016
|
+
parentToolCallId?: string;
|
|
2017
|
+
toolName: string;
|
|
2018
|
+
};
|
|
1920
2019
|
toolCallId: string;
|
|
1921
2020
|
toolName: string;
|
|
1922
2021
|
toolType: string;
|
|
@@ -1925,6 +2024,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1925
2024
|
delta: string;
|
|
1926
2025
|
executionId: string;
|
|
1927
2026
|
seq: number;
|
|
2027
|
+
subagent?: {
|
|
2028
|
+
agentName?: string;
|
|
2029
|
+
parentToolCallId?: string;
|
|
2030
|
+
toolName: string;
|
|
2031
|
+
};
|
|
1928
2032
|
toolCallId: string;
|
|
1929
2033
|
type: "tool_input_delta";
|
|
1930
2034
|
} | {
|
|
@@ -1932,6 +2036,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1932
2036
|
hiddenParameterNames?: Array<string>;
|
|
1933
2037
|
parameters: Record<string, unknown>;
|
|
1934
2038
|
seq: number;
|
|
2039
|
+
subagent?: {
|
|
2040
|
+
agentName?: string;
|
|
2041
|
+
parentToolCallId?: string;
|
|
2042
|
+
toolName: string;
|
|
2043
|
+
};
|
|
1935
2044
|
toolCallId: string;
|
|
1936
2045
|
toolName?: string;
|
|
1937
2046
|
type: "tool_input_complete";
|
|
@@ -1949,6 +2058,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1949
2058
|
result?: unknown;
|
|
1950
2059
|
seq: number;
|
|
1951
2060
|
stepId?: string;
|
|
2061
|
+
subagent?: {
|
|
2062
|
+
agentName?: string;
|
|
2063
|
+
parentToolCallId?: string;
|
|
2064
|
+
toolName: string;
|
|
2065
|
+
};
|
|
1952
2066
|
success: boolean;
|
|
1953
2067
|
toolCallId: string;
|
|
1954
2068
|
toolCost?: number;
|
|
@@ -2028,6 +2142,19 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2028
2142
|
recoverable?: boolean;
|
|
2029
2143
|
seq: number;
|
|
2030
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";
|
|
2031
2158
|
}) | {
|
|
2032
2159
|
executionId: string;
|
|
2033
2160
|
seq: number;
|
|
@@ -3087,15 +3214,15 @@ type AgentMessageMetadata = {
|
|
|
3087
3214
|
*/
|
|
3088
3215
|
parentStepId?: string;
|
|
3089
3216
|
/**
|
|
3090
|
-
* Set to `true` on a tool-variant message produced from
|
|
3217
|
+
* Set to `true` on a tool-variant message produced from an `await`
|
|
3091
3218
|
* event (`awaitReason: "local_tool_required"`). Signals to UI code that
|
|
3092
3219
|
* the tool call is a LOCAL tool and the server is paused waiting for a
|
|
3093
3220
|
* `POST /v1/dispatch/resume` with the user's answer keyed by tool name.
|
|
3094
3221
|
*/
|
|
3095
3222
|
awaitingLocalTool?: boolean;
|
|
3096
3223
|
/**
|
|
3097
|
-
* The provider per-call id (`toolu_…`) carried on the `
|
|
3098
|
-
*
|
|
3224
|
+
* The provider per-call id (`toolu_…`) carried on the `await`
|
|
3225
|
+
* event for a LOCAL tool (core#3878). Present only when the
|
|
3099
3226
|
* server emits it. Two PARALLEL calls to the same tool in one turn share a
|
|
3100
3227
|
* `toolName` (and a collapsed `toolId`) but get DISTINCT `webMcpToolCallId`s,
|
|
3101
3228
|
* so this is the key the widget batches a single `/resume` on: preferred
|
|
@@ -5245,7 +5372,7 @@ type EventStreamConfig = {
|
|
|
5245
5372
|
/**
|
|
5246
5373
|
* Custom badge color mappings by event type prefix or exact type.
|
|
5247
5374
|
* Keys are matched as exact match first, then prefix match (keys ending with "_").
|
|
5248
|
-
* @example { "
|
|
5375
|
+
* @example { "execution_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
|
|
5249
5376
|
*/
|
|
5250
5377
|
badgeColors?: Record<string, EventStreamBadgeColor>;
|
|
5251
5378
|
/**
|
|
@@ -6666,9 +6793,13 @@ interface VoiceProvider {
|
|
|
6666
6793
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
6667
6794
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
6668
6795
|
* On the realtime `runtype` path, interim updates fire for the `user` only and
|
|
6669
|
-
* 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.
|
|
6670
6799
|
*/
|
|
6671
|
-
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean
|
|
6800
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
|
|
6801
|
+
turnId?: string;
|
|
6802
|
+
}) => void): void;
|
|
6672
6803
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
6673
6804
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
6674
6805
|
/**
|
|
@@ -8981,16 +9112,16 @@ type AgentWidgetConfig = {
|
|
|
8981
9112
|
*
|
|
8982
9113
|
* @example
|
|
8983
9114
|
* ```typescript
|
|
8984
|
-
* // For Runtype
|
|
9115
|
+
* // For a custom backend (Runtype unified events are handled natively)
|
|
8985
9116
|
* config: {
|
|
8986
9117
|
* parseSSEEvent: (data) => {
|
|
8987
|
-
* if (
|
|
8988
|
-
* return { text: data.
|
|
9118
|
+
* if (data.type === 'token' && typeof data.value === 'string') {
|
|
9119
|
+
* return { text: data.value };
|
|
8989
9120
|
* }
|
|
8990
|
-
* if (data.type === '
|
|
9121
|
+
* if (data.type === 'done') {
|
|
8991
9122
|
* return { done: true };
|
|
8992
9123
|
* }
|
|
8993
|
-
* if (data.type === '
|
|
9124
|
+
* if (data.type === 'failure') {
|
|
8994
9125
|
* return { error: data.error };
|
|
8995
9126
|
* }
|
|
8996
9127
|
* return null; // Ignore other events
|
|
@@ -9181,7 +9312,7 @@ type AgentWidgetReasoning = {
|
|
|
9181
9312
|
/**
|
|
9182
9313
|
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
9183
9314
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
9184
|
-
* replaced the legacy `agent_reflection` event).
|
|
9315
|
+
* replaced the legacy `agent_reflection` event). Optional when the stream does not specify a scope.
|
|
9185
9316
|
*/
|
|
9186
9317
|
scope?: "turn" | "loop";
|
|
9187
9318
|
startedAt?: number;
|
|
@@ -9195,6 +9326,9 @@ type AgentWidgetToolCall = {
|
|
|
9195
9326
|
args?: unknown;
|
|
9196
9327
|
chunks?: string[];
|
|
9197
9328
|
result?: unknown;
|
|
9329
|
+
/** Whether the tool succeeded; failure does not necessarily end the execution. */
|
|
9330
|
+
success?: boolean;
|
|
9331
|
+
error?: string;
|
|
9198
9332
|
duration?: number;
|
|
9199
9333
|
startedAt?: number;
|
|
9200
9334
|
completedAt?: number;
|
|
@@ -9225,7 +9359,7 @@ type AgentWidgetApproval = {
|
|
|
9225
9359
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
9226
9360
|
/**
|
|
9227
9361
|
* Per-turn / per-step stop reason emitted by the runtime on
|
|
9228
|
-
* `
|
|
9362
|
+
* `turn_complete` and `step_complete` SSE events. The vocabulary is
|
|
9229
9363
|
* owned by the upstream Runtype API: do not extend without coordination.
|
|
9230
9364
|
*
|
|
9231
9365
|
* - `end_turn`: natural completion (no affordance needed)
|
|
@@ -9356,7 +9490,7 @@ type AgentWidgetMessage = {
|
|
|
9356
9490
|
*/
|
|
9357
9491
|
agentMetadata?: AgentMessageMetadata;
|
|
9358
9492
|
/**
|
|
9359
|
-
* Per-turn stop reason reported by the runtime on `
|
|
9493
|
+
* Per-turn stop reason reported by the runtime on `turn_complete`
|
|
9360
9494
|
* (agent-loop path) or the last `step_complete` for a prompt step
|
|
9361
9495
|
* (dispatch / flow path). Absent when the API did not report a value.
|
|
9362
9496
|
*
|
package/dist/artifacts-ui.d.ts
CHANGED
|
@@ -1696,6 +1696,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1696
1696
|
iteration?: number;
|
|
1697
1697
|
role: "user" | "assistant" | "system";
|
|
1698
1698
|
seq: number;
|
|
1699
|
+
subagent?: {
|
|
1700
|
+
agentName?: string;
|
|
1701
|
+
parentToolCallId?: string;
|
|
1702
|
+
toolName: string;
|
|
1703
|
+
};
|
|
1699
1704
|
turnIndex?: number;
|
|
1700
1705
|
type: "turn_start";
|
|
1701
1706
|
}) | ({
|
|
@@ -1730,12 +1735,61 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1730
1735
|
role: "user" | "assistant" | "system";
|
|
1731
1736
|
seq: number;
|
|
1732
1737
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
1738
|
+
subagent?: {
|
|
1739
|
+
agentName?: string;
|
|
1740
|
+
parentToolCallId?: string;
|
|
1741
|
+
toolName: string;
|
|
1742
|
+
};
|
|
1733
1743
|
tokens?: {
|
|
1734
1744
|
input: number;
|
|
1735
1745
|
output: number;
|
|
1736
1746
|
};
|
|
1737
1747
|
type: "turn_complete";
|
|
1738
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
|
+
} | {
|
|
1739
1793
|
executionId: string;
|
|
1740
1794
|
id: string;
|
|
1741
1795
|
index?: number;
|
|
@@ -1744,6 +1798,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1744
1798
|
seq: number;
|
|
1745
1799
|
startedAt?: string;
|
|
1746
1800
|
stepType?: string;
|
|
1801
|
+
subagent?: {
|
|
1802
|
+
agentName?: string;
|
|
1803
|
+
parentToolCallId?: string;
|
|
1804
|
+
toolName: string;
|
|
1805
|
+
};
|
|
1747
1806
|
totalSteps?: number;
|
|
1748
1807
|
type: "step_start";
|
|
1749
1808
|
} | ({
|
|
@@ -1771,6 +1830,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1771
1830
|
seq: number;
|
|
1772
1831
|
stepType?: string;
|
|
1773
1832
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
1833
|
+
subagent?: {
|
|
1834
|
+
agentName?: string;
|
|
1835
|
+
parentToolCallId?: string;
|
|
1836
|
+
toolName: string;
|
|
1837
|
+
};
|
|
1774
1838
|
success?: boolean;
|
|
1775
1839
|
tokensUsed?: number;
|
|
1776
1840
|
type: "step_complete";
|
|
@@ -1793,6 +1857,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1793
1857
|
role?: "user" | "assistant" | "system";
|
|
1794
1858
|
seq: number;
|
|
1795
1859
|
stepId?: string;
|
|
1860
|
+
subagent?: {
|
|
1861
|
+
agentName?: string;
|
|
1862
|
+
parentToolCallId?: string;
|
|
1863
|
+
toolName: string;
|
|
1864
|
+
};
|
|
1796
1865
|
turnId?: string;
|
|
1797
1866
|
type: "text_start";
|
|
1798
1867
|
}) | {
|
|
@@ -1800,11 +1869,21 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1800
1869
|
executionId: string;
|
|
1801
1870
|
id: string;
|
|
1802
1871
|
seq: number;
|
|
1872
|
+
subagent?: {
|
|
1873
|
+
agentName?: string;
|
|
1874
|
+
parentToolCallId?: string;
|
|
1875
|
+
toolName: string;
|
|
1876
|
+
};
|
|
1803
1877
|
type: "text_delta";
|
|
1804
1878
|
} | {
|
|
1805
1879
|
executionId: string;
|
|
1806
1880
|
id: string;
|
|
1807
1881
|
seq: number;
|
|
1882
|
+
subagent?: {
|
|
1883
|
+
agentName?: string;
|
|
1884
|
+
parentToolCallId?: string;
|
|
1885
|
+
toolName: string;
|
|
1886
|
+
};
|
|
1808
1887
|
text?: string;
|
|
1809
1888
|
type: "text_complete";
|
|
1810
1889
|
} | ({
|
|
@@ -1813,18 +1892,33 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1813
1892
|
parentToolCallId?: string;
|
|
1814
1893
|
scope?: "turn" | "loop";
|
|
1815
1894
|
seq: number;
|
|
1895
|
+
subagent?: {
|
|
1896
|
+
agentName?: string;
|
|
1897
|
+
parentToolCallId?: string;
|
|
1898
|
+
toolName: string;
|
|
1899
|
+
};
|
|
1816
1900
|
type: "reasoning_start";
|
|
1817
1901
|
}) | {
|
|
1818
1902
|
delta: string;
|
|
1819
1903
|
executionId: string;
|
|
1820
1904
|
id: string;
|
|
1821
1905
|
seq: number;
|
|
1906
|
+
subagent?: {
|
|
1907
|
+
agentName?: string;
|
|
1908
|
+
parentToolCallId?: string;
|
|
1909
|
+
toolName: string;
|
|
1910
|
+
};
|
|
1822
1911
|
type: "reasoning_delta";
|
|
1823
1912
|
} | ({
|
|
1824
1913
|
executionId: string;
|
|
1825
1914
|
id: string;
|
|
1826
1915
|
scope?: "turn" | "loop";
|
|
1827
1916
|
seq: number;
|
|
1917
|
+
subagent?: {
|
|
1918
|
+
agentName?: string;
|
|
1919
|
+
parentToolCallId?: string;
|
|
1920
|
+
toolName: string;
|
|
1921
|
+
};
|
|
1828
1922
|
text?: string;
|
|
1829
1923
|
type: "reasoning_complete";
|
|
1830
1924
|
}) | ({
|
|
@@ -1917,6 +2011,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1917
2011
|
seq: number;
|
|
1918
2012
|
startedAt?: string;
|
|
1919
2013
|
stepId?: string;
|
|
2014
|
+
subagent?: {
|
|
2015
|
+
agentName?: string;
|
|
2016
|
+
parentToolCallId?: string;
|
|
2017
|
+
toolName: string;
|
|
2018
|
+
};
|
|
1920
2019
|
toolCallId: string;
|
|
1921
2020
|
toolName: string;
|
|
1922
2021
|
toolType: string;
|
|
@@ -1925,6 +2024,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1925
2024
|
delta: string;
|
|
1926
2025
|
executionId: string;
|
|
1927
2026
|
seq: number;
|
|
2027
|
+
subagent?: {
|
|
2028
|
+
agentName?: string;
|
|
2029
|
+
parentToolCallId?: string;
|
|
2030
|
+
toolName: string;
|
|
2031
|
+
};
|
|
1928
2032
|
toolCallId: string;
|
|
1929
2033
|
type: "tool_input_delta";
|
|
1930
2034
|
} | {
|
|
@@ -1932,6 +2036,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1932
2036
|
hiddenParameterNames?: Array<string>;
|
|
1933
2037
|
parameters: Record<string, unknown>;
|
|
1934
2038
|
seq: number;
|
|
2039
|
+
subagent?: {
|
|
2040
|
+
agentName?: string;
|
|
2041
|
+
parentToolCallId?: string;
|
|
2042
|
+
toolName: string;
|
|
2043
|
+
};
|
|
1935
2044
|
toolCallId: string;
|
|
1936
2045
|
toolName?: string;
|
|
1937
2046
|
type: "tool_input_complete";
|
|
@@ -1949,6 +2058,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1949
2058
|
result?: unknown;
|
|
1950
2059
|
seq: number;
|
|
1951
2060
|
stepId?: string;
|
|
2061
|
+
subagent?: {
|
|
2062
|
+
agentName?: string;
|
|
2063
|
+
parentToolCallId?: string;
|
|
2064
|
+
toolName: string;
|
|
2065
|
+
};
|
|
1952
2066
|
success: boolean;
|
|
1953
2067
|
toolCallId: string;
|
|
1954
2068
|
toolCost?: number;
|
|
@@ -2028,6 +2142,19 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2028
2142
|
recoverable?: boolean;
|
|
2029
2143
|
seq: number;
|
|
2030
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";
|
|
2031
2158
|
}) | {
|
|
2032
2159
|
executionId: string;
|
|
2033
2160
|
seq: number;
|
|
@@ -3087,15 +3214,15 @@ type AgentMessageMetadata = {
|
|
|
3087
3214
|
*/
|
|
3088
3215
|
parentStepId?: string;
|
|
3089
3216
|
/**
|
|
3090
|
-
* Set to `true` on a tool-variant message produced from
|
|
3217
|
+
* Set to `true` on a tool-variant message produced from an `await`
|
|
3091
3218
|
* event (`awaitReason: "local_tool_required"`). Signals to UI code that
|
|
3092
3219
|
* the tool call is a LOCAL tool and the server is paused waiting for a
|
|
3093
3220
|
* `POST /v1/dispatch/resume` with the user's answer keyed by tool name.
|
|
3094
3221
|
*/
|
|
3095
3222
|
awaitingLocalTool?: boolean;
|
|
3096
3223
|
/**
|
|
3097
|
-
* The provider per-call id (`toolu_…`) carried on the `
|
|
3098
|
-
*
|
|
3224
|
+
* The provider per-call id (`toolu_…`) carried on the `await`
|
|
3225
|
+
* event for a LOCAL tool (core#3878). Present only when the
|
|
3099
3226
|
* server emits it. Two PARALLEL calls to the same tool in one turn share a
|
|
3100
3227
|
* `toolName` (and a collapsed `toolId`) but get DISTINCT `webMcpToolCallId`s,
|
|
3101
3228
|
* so this is the key the widget batches a single `/resume` on: preferred
|
|
@@ -5245,7 +5372,7 @@ type EventStreamConfig = {
|
|
|
5245
5372
|
/**
|
|
5246
5373
|
* Custom badge color mappings by event type prefix or exact type.
|
|
5247
5374
|
* Keys are matched as exact match first, then prefix match (keys ending with "_").
|
|
5248
|
-
* @example { "
|
|
5375
|
+
* @example { "execution_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
|
|
5249
5376
|
*/
|
|
5250
5377
|
badgeColors?: Record<string, EventStreamBadgeColor>;
|
|
5251
5378
|
/**
|
|
@@ -6666,9 +6793,13 @@ interface VoiceProvider {
|
|
|
6666
6793
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
6667
6794
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
6668
6795
|
* On the realtime `runtype` path, interim updates fire for the `user` only and
|
|
6669
|
-
* 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.
|
|
6670
6799
|
*/
|
|
6671
|
-
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean
|
|
6800
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
|
|
6801
|
+
turnId?: string;
|
|
6802
|
+
}) => void): void;
|
|
6672
6803
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
6673
6804
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
6674
6805
|
/**
|
|
@@ -8981,16 +9112,16 @@ type AgentWidgetConfig = {
|
|
|
8981
9112
|
*
|
|
8982
9113
|
* @example
|
|
8983
9114
|
* ```typescript
|
|
8984
|
-
* // For Runtype
|
|
9115
|
+
* // For a custom backend (Runtype unified events are handled natively)
|
|
8985
9116
|
* config: {
|
|
8986
9117
|
* parseSSEEvent: (data) => {
|
|
8987
|
-
* if (
|
|
8988
|
-
* return { text: data.
|
|
9118
|
+
* if (data.type === 'token' && typeof data.value === 'string') {
|
|
9119
|
+
* return { text: data.value };
|
|
8989
9120
|
* }
|
|
8990
|
-
* if (data.type === '
|
|
9121
|
+
* if (data.type === 'done') {
|
|
8991
9122
|
* return { done: true };
|
|
8992
9123
|
* }
|
|
8993
|
-
* if (data.type === '
|
|
9124
|
+
* if (data.type === 'failure') {
|
|
8994
9125
|
* return { error: data.error };
|
|
8995
9126
|
* }
|
|
8996
9127
|
* return null; // Ignore other events
|
|
@@ -9181,7 +9312,7 @@ type AgentWidgetReasoning = {
|
|
|
9181
9312
|
/**
|
|
9182
9313
|
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
9183
9314
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
9184
|
-
* replaced the legacy `agent_reflection` event).
|
|
9315
|
+
* replaced the legacy `agent_reflection` event). Optional when the stream does not specify a scope.
|
|
9185
9316
|
*/
|
|
9186
9317
|
scope?: "turn" | "loop";
|
|
9187
9318
|
startedAt?: number;
|
|
@@ -9195,6 +9326,9 @@ type AgentWidgetToolCall = {
|
|
|
9195
9326
|
args?: unknown;
|
|
9196
9327
|
chunks?: string[];
|
|
9197
9328
|
result?: unknown;
|
|
9329
|
+
/** Whether the tool succeeded; failure does not necessarily end the execution. */
|
|
9330
|
+
success?: boolean;
|
|
9331
|
+
error?: string;
|
|
9198
9332
|
duration?: number;
|
|
9199
9333
|
startedAt?: number;
|
|
9200
9334
|
completedAt?: number;
|
|
@@ -9225,7 +9359,7 @@ type AgentWidgetApproval = {
|
|
|
9225
9359
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
9226
9360
|
/**
|
|
9227
9361
|
* Per-turn / per-step stop reason emitted by the runtime on
|
|
9228
|
-
* `
|
|
9362
|
+
* `turn_complete` and `step_complete` SSE events. The vocabulary is
|
|
9229
9363
|
* owned by the upstream Runtype API: do not extend without coordination.
|
|
9230
9364
|
*
|
|
9231
9365
|
* - `end_turn`: natural completion (no affordance needed)
|
|
@@ -9356,7 +9490,7 @@ type AgentWidgetMessage = {
|
|
|
9356
9490
|
*/
|
|
9357
9491
|
agentMetadata?: AgentMessageMetadata;
|
|
9358
9492
|
/**
|
|
9359
|
-
* Per-turn stop reason reported by the runtime on `
|
|
9493
|
+
* Per-turn stop reason reported by the runtime on `turn_complete`
|
|
9360
9494
|
* (agent-loop path) or the last `step_complete` for a prompt step
|
|
9361
9495
|
* (dispatch / flow path). Absent when the API did not report a value.
|
|
9362
9496
|
*
|
package/dist/codegen.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var R=(e,i)=>{for(var r in i)w(e,r,{get:i[r],enumerable:!0})},W=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of T(i))!M.call(e,a)&&a!==r&&w(e,a,{get:()=>i[a],enumerable:!(s=_(i,a))||s.enumerable});return e};var H=e=>W(w({},"__esModule",{value:!0}),e);var z={};R(z,{generateCodeSnippet:()=>P});module.exports=H(z);var S="4.
|
|
1
|
+
"use strict";var w=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var R=(e,i)=>{for(var r in i)w(e,r,{get:i[r],enumerable:!0})},W=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of T(i))!M.call(e,a)&&a!==r&&w(e,a,{get:()=>i[a],enumerable:!(s=_(i,a))||s.enumerable});return e};var H=e=>W(w({},"__esModule",{value:!0}),e);var z={};R(z,{generateCodeSnippet:()=>P});module.exports=H(z);var S="4.23.0";var j=S;function $(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${j}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function q(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var A=`({ text, message }: any) => {
|
|
2
2
|
const jsonSource = (message as any).rawContent || text || message.content;
|
|
3
3
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
4
4
|
let cleanJson = jsonSource
|
package/dist/codegen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var x="4.
|
|
1
|
+
var x="4.23.0";var S=x;function w(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function I(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var j=`({ text, message }: any) => {
|
|
2
2
|
const jsonSource = (message as any).rawContent || text || message.content;
|
|
3
3
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
4
4
|
let cleanJson = jsonSource
|