@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.
- 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-RNNBR5R3.js → approval-ui-K7R5Q5OC.js} +1 -1
- package/dist/approval-ui.cjs +2 -2
- package/dist/approval-ui.d.cts +221 -16
- package/dist/approval-ui.d.ts +221 -16
- package/dist/approval-ui.js +2 -2
- package/dist/artifacts-ui-F4N6VMKF.js +7 -0
- package/dist/artifacts-ui.cjs +1 -1
- package/dist/artifacts-ui.d.cts +221 -16
- package/dist/artifacts-ui.d.ts +221 -16
- package/dist/artifacts-ui.js +1 -1
- package/dist/chunk-NQLDCJAP.js +4 -0
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/context-mentions.d.cts +221 -16
- package/dist/context-mentions.d.ts +221 -16
- package/dist/event-stream-view-GL3ADRY2.js +1 -0
- package/dist/event-stream-view.cjs +1 -1
- package/dist/event-stream-view.d.cts +221 -16
- package/dist/event-stream-view.d.ts +221 -16
- package/dist/event-stream-view.js +1 -1
- package/dist/forms-ui.d.cts +234 -25
- package/dist/forms-ui.d.ts +234 -25
- package/dist/history-view.d.cts +136 -6
- package/dist/history-view.d.ts +136 -6
- package/dist/index.cjs +70 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +302 -32
- package/dist/index.d.ts +302 -32
- package/dist/index.global.js +54 -54
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +69 -69
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js +2 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/session-reconnect.d.cts +221 -16
- package/dist/session-reconnect.d.ts +221 -16
- package/dist/smart-dom-reader.d.cts +221 -16
- package/dist/smart-dom-reader.d.ts +221 -16
- 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 +73 -73
- package/dist/theme-editor-preview.d.cts +221 -16
- package/dist/theme-editor-preview.d.ts +221 -16
- package/dist/theme-editor-preview.js +51 -51
- package/dist/theme-editor.cjs +4 -4
- package/dist/theme-editor.d.cts +221 -16
- package/dist/theme-editor.d.ts +221 -16
- package/dist/theme-editor.js +2 -2
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +65 -1
- package/dist/theme-reference.d.ts +65 -1
- package/dist/theme-reference.js +1 -1
- package/dist/voice-runtime.d.cts +6 -2
- package/dist/voice-runtime.d.ts +6 -2
- package/dist/webmcp-polyfill.js +1 -4
- package/dist/webmcp-runtime-JI7T4QYF.js +6 -0
- package/dist/webmcp-runtime.cjs +2 -2
- package/dist/webmcp-runtime.d.cts +34 -2
- package/dist/webmcp-runtime.d.ts +34 -2
- package/dist/webmcp-runtime.js +2 -2
- package/package.json +2 -2
- 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 +20 -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/artifact-preview.ts +5 -0
- package/src/components/event-stream-badge-theming.test.ts +162 -0
- package/src/components/event-stream-view.test.ts +76 -76
- package/src/components/event-stream-view.ts +55 -20
- 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 +137 -1
- package/src/index-core.ts +2 -0
- package/src/internal/runtype-history-provider.test.ts +2 -2
- package/src/runtime/init.registry.test.ts +56 -0
- package/src/runtime/init.ts +17 -0
- 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/theme.ts +41 -1
- package/src/types.ts +57 -15
- 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.reasoning-display.test.ts +136 -2
- package/src/ui.streaming-coalescing.test.ts +10 -13
- package/src/ui.ts +101 -35
- package/src/ui.typing-indicator.test.ts +216 -0
- package/src/ui.voice-custom-provider.test.ts +211 -0
- package/src/utils/__snapshots__/tokens-parity.test.ts.snap +1740 -0
- package/src/utils/event-stream-buffer.test.ts +13 -13
- package/src/utils/event-stream-capture.test.ts +20 -20
- package/src/utils/formatting.ts +22 -0
- package/src/utils/theme.ts +16 -0
- package/src/utils/throughput-tracker.test.ts +100 -142
- package/src/utils/throughput-tracker.ts +18 -132
- package/src/utils/tokens.ts +59 -0
- package/src/utils/voice-support.ts +18 -1
- package/src/voice/voice-turn-tracker.ts +18 -0
- package/src/webmcp-bridge.test.ts +132 -23
- package/src/webmcp-bridge.ts +27 -3
- package/src/webmcp-runtime-entry.ts +71 -11
- package/dist/artifacts-ui-J6AKUGTS.js +0 -7
- package/dist/chunk-HBE7LFNT.js +0 -4
- package/dist/event-stream-view-73NWKWVQ.js +0 -1
- package/dist/webmcp-runtime-P3CHZRHF.js +0 -6
- package/src/utils/__fixtures__/unified-translator.oracle.ts +0 -717
|
@@ -888,7 +888,11 @@ interface ColorPalette {
|
|
|
888
888
|
warning: ColorShade;
|
|
889
889
|
error: ColorShade;
|
|
890
890
|
info: ColorShade;
|
|
891
|
-
|
|
891
|
+
/** Event-stream tool badge family. */
|
|
892
|
+
purple?: ColorShade;
|
|
893
|
+
/** Event-stream agent badge family. */
|
|
894
|
+
teal?: ColorShade;
|
|
895
|
+
[key: string]: ColorShade | undefined;
|
|
892
896
|
}
|
|
893
897
|
interface SpacingScale {
|
|
894
898
|
0: string;
|
|
@@ -1460,6 +1464,38 @@ interface ToolBubbleTokens {
|
|
|
1460
1464
|
interface ReasoningBubbleTokens {
|
|
1461
1465
|
shadow: string;
|
|
1462
1466
|
}
|
|
1467
|
+
/** One event-stream badge chip: fill + text pair. The chip border derives
|
|
1468
|
+
* from `foreground` at ~31% alpha. */
|
|
1469
|
+
interface EventStreamBadgePairTokens {
|
|
1470
|
+
background: TokenReference<'color'>;
|
|
1471
|
+
foreground: TokenReference<'color'>;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Event-stream inspector badge chips (`features.eventStream`), one pair per
|
|
1475
|
+
* unified event family. Materialized into every theme and emitted as
|
|
1476
|
+
* `--persona-event-badge-<family>-{bg,fg}`, with scheme-appropriate defaults:
|
|
1477
|
+
* light themes pair a 100-tone fill with a 700-tone text, the built-in dark
|
|
1478
|
+
* layer flips to a 900-tone fill with a 300-tone text. `badge.default` colors
|
|
1479
|
+
* event types no family matches.
|
|
1480
|
+
*/
|
|
1481
|
+
interface EventStreamTokens {
|
|
1482
|
+
badge: {
|
|
1483
|
+
/** `flow_*` events. */
|
|
1484
|
+
flow: EventStreamBadgePairTokens;
|
|
1485
|
+
/** `step_*` events. */
|
|
1486
|
+
step: EventStreamBadgePairTokens;
|
|
1487
|
+
/** `reasoning_*` events. */
|
|
1488
|
+
reasoning: EventStreamBadgePairTokens;
|
|
1489
|
+
/** `tool_*` events. */
|
|
1490
|
+
tool: EventStreamBadgePairTokens;
|
|
1491
|
+
/** `agent_*` events. */
|
|
1492
|
+
agent: EventStreamBadgePairTokens;
|
|
1493
|
+
/** `error` / `execution_error` events. */
|
|
1494
|
+
error: EventStreamBadgePairTokens;
|
|
1495
|
+
/** Any event type no other family matches. */
|
|
1496
|
+
default: EventStreamBadgePairTokens;
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1463
1499
|
/** Scrollbar appearance shared by every scroller in the widget. */
|
|
1464
1500
|
interface ScrollbarTokens {
|
|
1465
1501
|
/** Thumb color. @default semantic.colors.border */
|
|
@@ -1808,6 +1844,8 @@ interface ComponentTokens {
|
|
|
1808
1844
|
attachment: AttachmentTokens;
|
|
1809
1845
|
toolBubble: ToolBubbleTokens;
|
|
1810
1846
|
reasoningBubble: ReasoningBubbleTokens;
|
|
1847
|
+
/** Event-stream inspector badge chips. */
|
|
1848
|
+
eventStream?: EventStreamTokens;
|
|
1811
1849
|
composer: ComposerChromeTokens;
|
|
1812
1850
|
/** Shared motion timing for composer chrome animation. */
|
|
1813
1851
|
motion?: MotionTokens;
|
|
@@ -1925,6 +1963,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1925
1963
|
iteration?: number;
|
|
1926
1964
|
role: "user" | "assistant" | "system";
|
|
1927
1965
|
seq: number;
|
|
1966
|
+
subagent?: {
|
|
1967
|
+
agentName?: string;
|
|
1968
|
+
parentToolCallId?: string;
|
|
1969
|
+
toolName: string;
|
|
1970
|
+
};
|
|
1928
1971
|
turnIndex?: number;
|
|
1929
1972
|
type: "turn_start";
|
|
1930
1973
|
}) | ({
|
|
@@ -1959,12 +2002,61 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1959
2002
|
role: "user" | "assistant" | "system";
|
|
1960
2003
|
seq: number;
|
|
1961
2004
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
2005
|
+
subagent?: {
|
|
2006
|
+
agentName?: string;
|
|
2007
|
+
parentToolCallId?: string;
|
|
2008
|
+
toolName: string;
|
|
2009
|
+
};
|
|
1962
2010
|
tokens?: {
|
|
1963
2011
|
input: number;
|
|
1964
2012
|
output: number;
|
|
1965
2013
|
};
|
|
1966
2014
|
type: "turn_complete";
|
|
1967
2015
|
}) | {
|
|
2016
|
+
executionId: string;
|
|
2017
|
+
id: string;
|
|
2018
|
+
iteration?: number;
|
|
2019
|
+
model?: string;
|
|
2020
|
+
ordinal: number;
|
|
2021
|
+
provider?: string;
|
|
2022
|
+
seq: number;
|
|
2023
|
+
startedAt?: string;
|
|
2024
|
+
stepId?: string;
|
|
2025
|
+
subagent?: {
|
|
2026
|
+
agentName?: string;
|
|
2027
|
+
parentToolCallId?: string;
|
|
2028
|
+
toolName: string;
|
|
2029
|
+
};
|
|
2030
|
+
turnId?: string;
|
|
2031
|
+
type: "model_call_start";
|
|
2032
|
+
} | {
|
|
2033
|
+
completedAt?: string;
|
|
2034
|
+
cost?: number;
|
|
2035
|
+
durationMs?: number;
|
|
2036
|
+
executionId: string;
|
|
2037
|
+
finishReason?: string;
|
|
2038
|
+
id: string;
|
|
2039
|
+
iteration?: number;
|
|
2040
|
+
model?: string;
|
|
2041
|
+
ordinal: number;
|
|
2042
|
+
provider?: string;
|
|
2043
|
+
responseModel?: string;
|
|
2044
|
+
seq: number;
|
|
2045
|
+
subagent?: {
|
|
2046
|
+
agentName?: string;
|
|
2047
|
+
parentToolCallId?: string;
|
|
2048
|
+
toolName: string;
|
|
2049
|
+
};
|
|
2050
|
+
success?: boolean;
|
|
2051
|
+
tokens?: {
|
|
2052
|
+
cacheRead?: number;
|
|
2053
|
+
cacheWrite?: number;
|
|
2054
|
+
input: number;
|
|
2055
|
+
output: number;
|
|
2056
|
+
};
|
|
2057
|
+
turnId?: string;
|
|
2058
|
+
type: "model_call_complete";
|
|
2059
|
+
} | {
|
|
1968
2060
|
executionId: string;
|
|
1969
2061
|
id: string;
|
|
1970
2062
|
index?: number;
|
|
@@ -1973,6 +2065,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
1973
2065
|
seq: number;
|
|
1974
2066
|
startedAt?: string;
|
|
1975
2067
|
stepType?: string;
|
|
2068
|
+
subagent?: {
|
|
2069
|
+
agentName?: string;
|
|
2070
|
+
parentToolCallId?: string;
|
|
2071
|
+
toolName: string;
|
|
2072
|
+
};
|
|
1976
2073
|
totalSteps?: number;
|
|
1977
2074
|
type: "step_start";
|
|
1978
2075
|
} | ({
|
|
@@ -2000,6 +2097,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2000
2097
|
seq: number;
|
|
2001
2098
|
stepType?: string;
|
|
2002
2099
|
stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
|
|
2100
|
+
subagent?: {
|
|
2101
|
+
agentName?: string;
|
|
2102
|
+
parentToolCallId?: string;
|
|
2103
|
+
toolName: string;
|
|
2104
|
+
};
|
|
2003
2105
|
success?: boolean;
|
|
2004
2106
|
tokensUsed?: number;
|
|
2005
2107
|
type: "step_complete";
|
|
@@ -2022,6 +2124,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2022
2124
|
role?: "user" | "assistant" | "system";
|
|
2023
2125
|
seq: number;
|
|
2024
2126
|
stepId?: string;
|
|
2127
|
+
subagent?: {
|
|
2128
|
+
agentName?: string;
|
|
2129
|
+
parentToolCallId?: string;
|
|
2130
|
+
toolName: string;
|
|
2131
|
+
};
|
|
2025
2132
|
turnId?: string;
|
|
2026
2133
|
type: "text_start";
|
|
2027
2134
|
}) | {
|
|
@@ -2029,11 +2136,21 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2029
2136
|
executionId: string;
|
|
2030
2137
|
id: string;
|
|
2031
2138
|
seq: number;
|
|
2139
|
+
subagent?: {
|
|
2140
|
+
agentName?: string;
|
|
2141
|
+
parentToolCallId?: string;
|
|
2142
|
+
toolName: string;
|
|
2143
|
+
};
|
|
2032
2144
|
type: "text_delta";
|
|
2033
2145
|
} | {
|
|
2034
2146
|
executionId: string;
|
|
2035
2147
|
id: string;
|
|
2036
2148
|
seq: number;
|
|
2149
|
+
subagent?: {
|
|
2150
|
+
agentName?: string;
|
|
2151
|
+
parentToolCallId?: string;
|
|
2152
|
+
toolName: string;
|
|
2153
|
+
};
|
|
2037
2154
|
text?: string;
|
|
2038
2155
|
type: "text_complete";
|
|
2039
2156
|
} | ({
|
|
@@ -2042,18 +2159,33 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2042
2159
|
parentToolCallId?: string;
|
|
2043
2160
|
scope?: "turn" | "loop";
|
|
2044
2161
|
seq: number;
|
|
2162
|
+
subagent?: {
|
|
2163
|
+
agentName?: string;
|
|
2164
|
+
parentToolCallId?: string;
|
|
2165
|
+
toolName: string;
|
|
2166
|
+
};
|
|
2045
2167
|
type: "reasoning_start";
|
|
2046
2168
|
}) | {
|
|
2047
2169
|
delta: string;
|
|
2048
2170
|
executionId: string;
|
|
2049
2171
|
id: string;
|
|
2050
2172
|
seq: number;
|
|
2173
|
+
subagent?: {
|
|
2174
|
+
agentName?: string;
|
|
2175
|
+
parentToolCallId?: string;
|
|
2176
|
+
toolName: string;
|
|
2177
|
+
};
|
|
2051
2178
|
type: "reasoning_delta";
|
|
2052
2179
|
} | ({
|
|
2053
2180
|
executionId: string;
|
|
2054
2181
|
id: string;
|
|
2055
2182
|
scope?: "turn" | "loop";
|
|
2056
2183
|
seq: number;
|
|
2184
|
+
subagent?: {
|
|
2185
|
+
agentName?: string;
|
|
2186
|
+
parentToolCallId?: string;
|
|
2187
|
+
toolName: string;
|
|
2188
|
+
};
|
|
2057
2189
|
text?: string;
|
|
2058
2190
|
type: "reasoning_complete";
|
|
2059
2191
|
}) | ({
|
|
@@ -2146,6 +2278,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2146
2278
|
seq: number;
|
|
2147
2279
|
startedAt?: string;
|
|
2148
2280
|
stepId?: string;
|
|
2281
|
+
subagent?: {
|
|
2282
|
+
agentName?: string;
|
|
2283
|
+
parentToolCallId?: string;
|
|
2284
|
+
toolName: string;
|
|
2285
|
+
};
|
|
2149
2286
|
toolCallId: string;
|
|
2150
2287
|
toolName: string;
|
|
2151
2288
|
toolType: string;
|
|
@@ -2154,6 +2291,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2154
2291
|
delta: string;
|
|
2155
2292
|
executionId: string;
|
|
2156
2293
|
seq: number;
|
|
2294
|
+
subagent?: {
|
|
2295
|
+
agentName?: string;
|
|
2296
|
+
parentToolCallId?: string;
|
|
2297
|
+
toolName: string;
|
|
2298
|
+
};
|
|
2157
2299
|
toolCallId: string;
|
|
2158
2300
|
type: "tool_input_delta";
|
|
2159
2301
|
} | {
|
|
@@ -2161,6 +2303,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2161
2303
|
hiddenParameterNames?: Array<string>;
|
|
2162
2304
|
parameters: Record<string, unknown>;
|
|
2163
2305
|
seq: number;
|
|
2306
|
+
subagent?: {
|
|
2307
|
+
agentName?: string;
|
|
2308
|
+
parentToolCallId?: string;
|
|
2309
|
+
toolName: string;
|
|
2310
|
+
};
|
|
2164
2311
|
toolCallId: string;
|
|
2165
2312
|
toolName?: string;
|
|
2166
2313
|
type: "tool_input_complete";
|
|
@@ -2178,6 +2325,11 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2178
2325
|
result?: unknown;
|
|
2179
2326
|
seq: number;
|
|
2180
2327
|
stepId?: string;
|
|
2328
|
+
subagent?: {
|
|
2329
|
+
agentName?: string;
|
|
2330
|
+
parentToolCallId?: string;
|
|
2331
|
+
toolName: string;
|
|
2332
|
+
};
|
|
2181
2333
|
success: boolean;
|
|
2182
2334
|
toolCallId: string;
|
|
2183
2335
|
toolCost?: number;
|
|
@@ -2257,6 +2409,19 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2257
2409
|
recoverable?: boolean;
|
|
2258
2410
|
seq: number;
|
|
2259
2411
|
type: "error";
|
|
2412
|
+
}) | ({
|
|
2413
|
+
epoch: number;
|
|
2414
|
+
executionId: string;
|
|
2415
|
+
kind: "compaction";
|
|
2416
|
+
outcome?: "ok" | "failed" | "gap" | "skipped";
|
|
2417
|
+
phase: "start" | "complete";
|
|
2418
|
+
reason: "threshold" | "overflow" | "manual" | "surface_policy" | "provider_mismatch";
|
|
2419
|
+
seq: number;
|
|
2420
|
+
strategy: "provider_native" | "summary";
|
|
2421
|
+
tier: number;
|
|
2422
|
+
tokensAfter?: number;
|
|
2423
|
+
tokensBefore?: number;
|
|
2424
|
+
type: "context_notice";
|
|
2260
2425
|
}) | {
|
|
2261
2426
|
executionId: string;
|
|
2262
2427
|
seq: number;
|
|
@@ -3188,6 +3353,14 @@ type ClientToolDefinition = {
|
|
|
3188
3353
|
readOnlyHint?: boolean;
|
|
3189
3354
|
untrustedContentHint?: boolean;
|
|
3190
3355
|
};
|
|
3356
|
+
/**
|
|
3357
|
+
* Hoisted copy of `annotations.untrustedContentHint`. This is the field the
|
|
3358
|
+
* server actually acts on (`InlineClientToolSchema`): it spotlights the
|
|
3359
|
+
* tool's output before the model reads it, so instructions embedded in
|
|
3360
|
+
* page-provided content (reviews, comments, emails) are not treated as
|
|
3361
|
+
* instructions. `annotations` itself is trace/dashboard metadata only.
|
|
3362
|
+
*/
|
|
3363
|
+
untrustedContentHint?: boolean;
|
|
3191
3364
|
};
|
|
3192
3365
|
/**
|
|
3193
3366
|
* Information passed to the confirm-bubble handler before a `webmcp:*` tool
|
|
@@ -3308,15 +3481,15 @@ type AgentMessageMetadata = {
|
|
|
3308
3481
|
*/
|
|
3309
3482
|
parentStepId?: string;
|
|
3310
3483
|
/**
|
|
3311
|
-
* Set to `true` on a tool-variant message produced from
|
|
3484
|
+
* Set to `true` on a tool-variant message produced from an `await`
|
|
3312
3485
|
* event (`awaitReason: "local_tool_required"`). Signals to UI code that
|
|
3313
3486
|
* the tool call is a LOCAL tool and the server is paused waiting for a
|
|
3314
3487
|
* `POST /v1/dispatch/resume` with the user's answer keyed by tool name.
|
|
3315
3488
|
*/
|
|
3316
3489
|
awaitingLocalTool?: boolean;
|
|
3317
3490
|
/**
|
|
3318
|
-
* The provider per-call id (`toolu_…`) carried on the `
|
|
3319
|
-
*
|
|
3491
|
+
* The provider per-call id (`toolu_…`) carried on the `await`
|
|
3492
|
+
* event for a LOCAL tool (core#3878). Present only when the
|
|
3320
3493
|
* server emits it. Two PARALLEL calls to the same tool in one turn share a
|
|
3321
3494
|
* `toolName` (and a collapsed `toolId`) but get DISTINCT `webMcpToolCallId`s,
|
|
3322
3495
|
* so this is the key the widget batches a single `/resume` on: preferred
|
|
@@ -4379,6 +4552,16 @@ type AgentWidgetToolCallDisplayFeature = {
|
|
|
4379
4552
|
* @default "stack"
|
|
4380
4553
|
*/
|
|
4381
4554
|
groupedMode?: "stack" | "summary";
|
|
4555
|
+
/**
|
|
4556
|
+
* What happens to a tool call row once it completes.
|
|
4557
|
+
*
|
|
4558
|
+
* - `"kept"` (default): the finished row stays in the transcript.
|
|
4559
|
+
* - `"removed"`: no row is rendered at all, so the transcript gap closes with
|
|
4560
|
+
* it. The tool call stays on the message and in `getMessages()`.
|
|
4561
|
+
*
|
|
4562
|
+
* @default "kept"
|
|
4563
|
+
*/
|
|
4564
|
+
completedVisibility?: AgentWidgetToolCallCompletedVisibility;
|
|
4382
4565
|
/**
|
|
4383
4566
|
* When false, tool call bubbles show only the collapsed summary with no
|
|
4384
4567
|
* expand/collapse toggle. Users see tool awareness without full details.
|
|
@@ -4396,6 +4579,8 @@ type AgentWidgetToolCallDisplayFeature = {
|
|
|
4396
4579
|
*/
|
|
4397
4580
|
loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
|
|
4398
4581
|
};
|
|
4582
|
+
/** See `features.toolCallDisplay.completedVisibility`. */
|
|
4583
|
+
type AgentWidgetToolCallCompletedVisibility = "kept" | "removed";
|
|
4399
4584
|
type AgentWidgetReasoningDisplayFeature = {
|
|
4400
4585
|
/**
|
|
4401
4586
|
* When true, active collapsed reasoning rows can render a lightweight preview block.
|
|
@@ -4441,13 +4626,26 @@ type AgentWidgetReasoningDisplayFeature = {
|
|
|
4441
4626
|
* - `"kept"` (default): the finished row stays in the transcript.
|
|
4442
4627
|
* - `"removed"`: no row is rendered at all, so the transcript gap closes with
|
|
4443
4628
|
* it. The reasoning text stays on the message and in `getMessages()`.
|
|
4629
|
+
* - `"removed-when-short"`: behaves as `"removed"` when the completed trace
|
|
4630
|
+
* is short (see `shortThinkThreshold`), and as `"kept"` otherwise.
|
|
4444
4631
|
*
|
|
4445
4632
|
* @default "kept"
|
|
4446
4633
|
*/
|
|
4447
4634
|
completedVisibility?: AgentWidgetReasoningCompletedVisibility;
|
|
4635
|
+
/**
|
|
4636
|
+
* Thresholds used by `completedVisibility: "removed-when-short"` to decide
|
|
4637
|
+
* whether a completed trace counts as short. Duration is checked first when
|
|
4638
|
+
* the reasoning reports one; the character count is a fallback for traces
|
|
4639
|
+
* with no reported duration.
|
|
4640
|
+
* @default { durationMs: 15000, chars: 1200 }
|
|
4641
|
+
*/
|
|
4642
|
+
shortThinkThreshold?: {
|
|
4643
|
+
durationMs?: number;
|
|
4644
|
+
chars?: number;
|
|
4645
|
+
};
|
|
4448
4646
|
};
|
|
4449
4647
|
/** See `features.reasoningDisplay.completedVisibility`. */
|
|
4450
|
-
type AgentWidgetReasoningCompletedVisibility = "kept" | "removed";
|
|
4648
|
+
type AgentWidgetReasoningCompletedVisibility = "kept" | "removed" | "removed-when-short";
|
|
4451
4649
|
/**
|
|
4452
4650
|
* Reveal animation applied to assistant message text while it is streaming.
|
|
4453
4651
|
*
|
|
@@ -5441,7 +5639,7 @@ type EventStreamConfig = {
|
|
|
5441
5639
|
/**
|
|
5442
5640
|
* Custom badge color mappings by event type prefix or exact type.
|
|
5443
5641
|
* Keys are matched as exact match first, then prefix match (keys ending with "_").
|
|
5444
|
-
* @example { "
|
|
5642
|
+
* @example { "execution_": { bg: "#dcfce7", text: "#166534" }, "error": { bg: "#fecaca", text: "#991b1b" } }
|
|
5445
5643
|
*/
|
|
5446
5644
|
badgeColors?: Record<string, EventStreamBadgeColor>;
|
|
5447
5645
|
/**
|
|
@@ -6862,9 +7060,13 @@ interface VoiceProvider {
|
|
|
6862
7060
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
6863
7061
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
6864
7062
|
* On the realtime `runtype` path, interim updates fire for the `user` only and
|
|
6865
|
-
* the `assistant` arrives as a single final.
|
|
7063
|
+
* the `assistant` arrives as a single final. Providers with overlapping turns
|
|
7064
|
+
* must include the same turnId on user and assistant finals; without IDs,
|
|
7065
|
+
* providers must discard cancelled output before emitting the next user final.
|
|
6866
7066
|
*/
|
|
6867
|
-
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean
|
|
7067
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: {
|
|
7068
|
+
turnId?: string;
|
|
7069
|
+
}) => void): void;
|
|
6868
7070
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
6869
7071
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
6870
7072
|
/**
|
|
@@ -9177,16 +9379,16 @@ type AgentWidgetConfig = {
|
|
|
9177
9379
|
*
|
|
9178
9380
|
* @example
|
|
9179
9381
|
* ```typescript
|
|
9180
|
-
* // For Runtype
|
|
9382
|
+
* // For a custom backend (Runtype unified events are handled natively)
|
|
9181
9383
|
* config: {
|
|
9182
9384
|
* parseSSEEvent: (data) => {
|
|
9183
|
-
* if (
|
|
9184
|
-
* return { text: data.
|
|
9385
|
+
* if (data.type === 'token' && typeof data.value === 'string') {
|
|
9386
|
+
* return { text: data.value };
|
|
9185
9387
|
* }
|
|
9186
|
-
* if (data.type === '
|
|
9388
|
+
* if (data.type === 'done') {
|
|
9187
9389
|
* return { done: true };
|
|
9188
9390
|
* }
|
|
9189
|
-
* if (data.type === '
|
|
9391
|
+
* if (data.type === 'failure') {
|
|
9190
9392
|
* return { error: data.error };
|
|
9191
9393
|
* }
|
|
9192
9394
|
* return null; // Ignore other events
|
|
@@ -9377,7 +9579,7 @@ type AgentWidgetReasoning = {
|
|
|
9377
9579
|
/**
|
|
9378
9580
|
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
9379
9581
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
9380
|
-
* replaced the legacy `agent_reflection` event).
|
|
9582
|
+
* replaced the legacy `agent_reflection` event). Optional when the stream does not specify a scope.
|
|
9381
9583
|
*/
|
|
9382
9584
|
scope?: "turn" | "loop";
|
|
9383
9585
|
startedAt?: number;
|
|
@@ -9391,6 +9593,9 @@ type AgentWidgetToolCall = {
|
|
|
9391
9593
|
args?: unknown;
|
|
9392
9594
|
chunks?: string[];
|
|
9393
9595
|
result?: unknown;
|
|
9596
|
+
/** Whether the tool succeeded; failure does not necessarily end the execution. */
|
|
9597
|
+
success?: boolean;
|
|
9598
|
+
error?: string;
|
|
9394
9599
|
duration?: number;
|
|
9395
9600
|
startedAt?: number;
|
|
9396
9601
|
completedAt?: number;
|
|
@@ -9421,7 +9626,7 @@ type AgentWidgetApproval = {
|
|
|
9421
9626
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
9422
9627
|
/**
|
|
9423
9628
|
* Per-turn / per-step stop reason emitted by the runtime on
|
|
9424
|
-
* `
|
|
9629
|
+
* `turn_complete` and `step_complete` SSE events. The vocabulary is
|
|
9425
9630
|
* owned by the upstream Runtype API: do not extend without coordination.
|
|
9426
9631
|
*
|
|
9427
9632
|
* - `end_turn`: natural completion (no affordance needed)
|
|
@@ -9552,7 +9757,7 @@ type AgentWidgetMessage = {
|
|
|
9552
9757
|
*/
|
|
9553
9758
|
agentMetadata?: AgentMessageMetadata;
|
|
9554
9759
|
/**
|
|
9555
|
-
* Per-turn stop reason reported by the runtime on `
|
|
9760
|
+
* Per-turn stop reason reported by the runtime on `turn_complete`
|
|
9556
9761
|
* (agent-loop path) or the last `step_complete` for a prompt step
|
|
9557
9762
|
* (dispatch / flow path). Absent when the API did not report a value.
|
|
9558
9763
|
*
|
package/dist/testing.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`:"",n=e?.signal??null,o=0;return new ReadableStream({async pull(a){if(o>=t.length){a.close();return}if(n?.aborted){a.error(
|
|
1
|
+
"use strict";var c=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var k=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},M=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!y.call(t,n)&&n!==r&&c(t,n,{get:()=>e[n],enumerable:!(s=l(e,n))||s.enumerable});return t};var E=t=>M(c({},"__esModule",{value:!0}),t);var g={};k(g,{buildAssistantTurnFrames:()=>p,createMockSSEResponse:()=>d,createMockSSEStream:()=>S});module.exports=E(g);var f=new TextEncoder,u=()=>new DOMException("The operation was aborted.","AbortError");function S(t,e){let r=e?.delayMs??100,s=e?.eventName?`event: ${e.eventName}
|
|
2
|
+
`:"",n=e?.signal??null,o=0;return new ReadableStream({async pull(a){if(o>=t.length){a.close();return}if(n?.aborted){a.error(u());return}if(await new Promise(m=>setTimeout(m,r)),n?.aborted){a.error(u());return}let i=JSON.stringify(t[o]);a.enqueue(f.encode(`${s}data: ${i}
|
|
3
3
|
|
|
4
|
-
`)),o+=1}})}function
|
|
4
|
+
`)),o+=1}})}function p(t){let{executionId:e,text:r}=t,s=t.turnId??"turn-1",n=`${s}-text`,o=Math.max(1,t.chunkSize??32),a=[{type:"turn_start",executionId:e,id:s,role:"assistant"},{type:"text_start",executionId:e,id:n,turnId:s,role:"assistant"}];for(let i=0;i<r.length;i+=o)a.push({type:"text_delta",executionId:e,id:n,delta:r.slice(i,i+o)});return a.push({type:"text_complete",executionId:e,id:n,text:r},{type:"turn_complete",executionId:e,id:s,role:"assistant",content:r}),a}function d(t,e){let r=S(t,e);return new Response(r,{status:e?.status??200,headers:{"Content-Type":"text/event-stream",...e?.headers}})}0&&(module.exports={buildAssistantTurnFrames,createMockSSEResponse,createMockSSEStream});
|
package/dist/testing.d.cts
CHANGED
|
@@ -27,13 +27,12 @@ interface AssistantTurnFramesOptions {
|
|
|
27
27
|
turnId?: string;
|
|
28
28
|
/** Assistant text content to stream. */
|
|
29
29
|
text: string;
|
|
30
|
-
/** Approximate characters per `
|
|
30
|
+
/** Approximate characters per `text_delta` frame. Default: 32. */
|
|
31
31
|
chunkSize?: number;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Builds
|
|
35
|
-
*
|
|
36
|
-
* client pipeline as real SSE, so stream animations (typewriter, word-fade, etc.) engage.
|
|
34
|
+
* Builds a unified assistant turn with a text block. Execution lifecycle frames
|
|
35
|
+
* can be supplied by the caller when composing a multi-turn execution.
|
|
37
36
|
*/
|
|
38
37
|
declare function buildAssistantTurnFrames(options: AssistantTurnFramesOptions): MockSSEFrame[];
|
|
39
38
|
interface MockSSEResponseOptions extends CreateMockSSEStreamOptions {
|
package/dist/testing.d.ts
CHANGED
|
@@ -27,13 +27,12 @@ interface AssistantTurnFramesOptions {
|
|
|
27
27
|
turnId?: string;
|
|
28
28
|
/** Assistant text content to stream. */
|
|
29
29
|
text: string;
|
|
30
|
-
/** Approximate characters per `
|
|
30
|
+
/** Approximate characters per `text_delta` frame. Default: 32. */
|
|
31
31
|
chunkSize?: number;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Builds
|
|
35
|
-
*
|
|
36
|
-
* client pipeline as real SSE, so stream animations (typewriter, word-fade, etc.) engage.
|
|
34
|
+
* Builds a unified assistant turn with a text block. Execution lifecycle frames
|
|
35
|
+
* can be supplied by the caller when composing a multi-turn execution.
|
|
37
36
|
*/
|
|
38
37
|
declare function buildAssistantTurnFrames(options: AssistantTurnFramesOptions): MockSSEFrame[];
|
|
39
38
|
interface MockSSEResponseOptions extends CreateMockSSEStreamOptions {
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var p=new TextEncoder,
|
|
2
|
-
`:"",
|
|
1
|
+
var p=new TextEncoder,c=()=>new DOMException("The operation was aborted.","AbortError");function S(t,e){let r=e?.delayMs??100,s=e?.eventName?`event: ${e.eventName}
|
|
2
|
+
`:"",a=e?.signal??null,o=0;return new ReadableStream({async pull(n){if(o>=t.length){n.close();return}if(a?.aborted){n.error(c());return}if(await new Promise(u=>setTimeout(u,r)),a?.aborted){n.error(c());return}let i=JSON.stringify(t[o]);n.enqueue(p.encode(`${s}data: ${i}
|
|
3
3
|
|
|
4
|
-
`)),
|
|
4
|
+
`)),o+=1}})}function d(t){let{executionId:e,text:r}=t,s=t.turnId??"turn-1",a=`${s}-text`,o=Math.max(1,t.chunkSize??32),n=[{type:"turn_start",executionId:e,id:s,role:"assistant"},{type:"text_start",executionId:e,id:a,turnId:s,role:"assistant"}];for(let i=0;i<r.length;i+=o)n.push({type:"text_delta",executionId:e,id:a,delta:r.slice(i,i+o)});return n.push({type:"text_complete",executionId:e,id:a,text:r},{type:"turn_complete",executionId:e,id:s,role:"assistant",content:r}),n}function m(t,e){let r=S(t,e);return new Response(r,{status:e?.status??200,headers:{"Content-Type":"text/event-stream",...e?.headers}})}export{d as buildAssistantTurnFrames,m as createMockSSEResponse,S as createMockSSEStream};
|