@runtypelabs/persona 3.14.0 → 3.15.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/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.global.js +20 -20
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/theme-editor.cjs +5 -1
- package/dist/theme-editor.d.cts +9 -0
- package/dist/theme-editor.d.ts +9 -0
- package/dist/theme-editor.js +5 -1
- package/package.json +1 -1
- package/src/types.ts +9 -0
- package/src/ui.ts +5 -3
package/dist/theme-editor.cjs
CHANGED
|
@@ -15996,8 +15996,10 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15996
15996
|
}
|
|
15997
15997
|
});
|
|
15998
15998
|
}
|
|
15999
|
-
if (eventStreamBuffer) {
|
|
15999
|
+
if (eventStreamBuffer || config.onSSEEvent) {
|
|
16000
16000
|
session.setSSEEventCallback((type, payload) => {
|
|
16001
|
+
var _a2;
|
|
16002
|
+
(_a2 = config.onSSEEvent) == null ? void 0 : _a2.call(config, type, payload);
|
|
16001
16003
|
eventStreamBuffer == null ? void 0 : eventStreamBuffer.push({
|
|
16002
16004
|
id: `evt-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
16003
16005
|
type,
|
|
@@ -16838,6 +16840,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16838
16840
|
eventStreamStore.open().then(() => eventStreamBuffer == null ? void 0 : eventStreamBuffer.restore()).catch(() => {
|
|
16839
16841
|
});
|
|
16840
16842
|
session.setSSEEventCallback((type, payload) => {
|
|
16843
|
+
var _a3;
|
|
16844
|
+
(_a3 = config.onSSEEvent) == null ? void 0 : _a3.call(config, type, payload);
|
|
16841
16845
|
eventStreamBuffer.push({
|
|
16842
16846
|
id: `evt-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
16843
16847
|
type,
|
package/dist/theme-editor.d.cts
CHANGED
|
@@ -3217,6 +3217,15 @@ type AgentWidgetConfig = {
|
|
|
3217
3217
|
* ```
|
|
3218
3218
|
*/
|
|
3219
3219
|
parseSSEEvent?: AgentWidgetSSEEventParser;
|
|
3220
|
+
/**
|
|
3221
|
+
* Called for every parsed SSE frame (after JSON parse), before native handling.
|
|
3222
|
+
* Use for lightweight side effects (e.g. telemetry). Does not replace native
|
|
3223
|
+
* streaming; pair with {@link parseSSEEvent} only when you need to override text mapping.
|
|
3224
|
+
*
|
|
3225
|
+
* When the event stream inspector is enabled, this runs in the same order as
|
|
3226
|
+
* events are appended to the inspector buffer.
|
|
3227
|
+
*/
|
|
3228
|
+
onSSEEvent?: (eventType: string, payload: unknown) => void;
|
|
3220
3229
|
/**
|
|
3221
3230
|
* Layout configuration for customizing widget appearance and structure.
|
|
3222
3231
|
* Provides control over header, messages, and content slots.
|
package/dist/theme-editor.d.ts
CHANGED
|
@@ -3217,6 +3217,15 @@ type AgentWidgetConfig = {
|
|
|
3217
3217
|
* ```
|
|
3218
3218
|
*/
|
|
3219
3219
|
parseSSEEvent?: AgentWidgetSSEEventParser;
|
|
3220
|
+
/**
|
|
3221
|
+
* Called for every parsed SSE frame (after JSON parse), before native handling.
|
|
3222
|
+
* Use for lightweight side effects (e.g. telemetry). Does not replace native
|
|
3223
|
+
* streaming; pair with {@link parseSSEEvent} only when you need to override text mapping.
|
|
3224
|
+
*
|
|
3225
|
+
* When the event stream inspector is enabled, this runs in the same order as
|
|
3226
|
+
* events are appended to the inspector buffer.
|
|
3227
|
+
*/
|
|
3228
|
+
onSSEEvent?: (eventType: string, payload: unknown) => void;
|
|
3220
3229
|
/**
|
|
3221
3230
|
* Layout configuration for customizing widget appearance and structure.
|
|
3222
3231
|
* Provides control over header, messages, and content slots.
|
package/dist/theme-editor.js
CHANGED
|
@@ -15887,8 +15887,10 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15887
15887
|
}
|
|
15888
15888
|
});
|
|
15889
15889
|
}
|
|
15890
|
-
if (eventStreamBuffer) {
|
|
15890
|
+
if (eventStreamBuffer || config.onSSEEvent) {
|
|
15891
15891
|
session.setSSEEventCallback((type, payload) => {
|
|
15892
|
+
var _a2;
|
|
15893
|
+
(_a2 = config.onSSEEvent) == null ? void 0 : _a2.call(config, type, payload);
|
|
15892
15894
|
eventStreamBuffer == null ? void 0 : eventStreamBuffer.push({
|
|
15893
15895
|
id: `evt-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
15894
15896
|
type,
|
|
@@ -16729,6 +16731,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
16729
16731
|
eventStreamStore.open().then(() => eventStreamBuffer == null ? void 0 : eventStreamBuffer.restore()).catch(() => {
|
|
16730
16732
|
});
|
|
16731
16733
|
session.setSSEEventCallback((type, payload) => {
|
|
16734
|
+
var _a3;
|
|
16735
|
+
(_a3 = config.onSSEEvent) == null ? void 0 : _a3.call(config, type, payload);
|
|
16732
16736
|
eventStreamBuffer.push({
|
|
16733
16737
|
id: `evt-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
16734
16738
|
type,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/persona",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"description": "Themeable, pluggable streaming agent widget for websites, in plain JS with support for voice input and reasoning / tool output.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
package/src/types.ts
CHANGED
|
@@ -2901,6 +2901,15 @@ export type AgentWidgetConfig = {
|
|
|
2901
2901
|
* ```
|
|
2902
2902
|
*/
|
|
2903
2903
|
parseSSEEvent?: AgentWidgetSSEEventParser;
|
|
2904
|
+
/**
|
|
2905
|
+
* Called for every parsed SSE frame (after JSON parse), before native handling.
|
|
2906
|
+
* Use for lightweight side effects (e.g. telemetry). Does not replace native
|
|
2907
|
+
* streaming; pair with {@link parseSSEEvent} only when you need to override text mapping.
|
|
2908
|
+
*
|
|
2909
|
+
* When the event stream inspector is enabled, this runs in the same order as
|
|
2910
|
+
* events are appended to the inspector buffer.
|
|
2911
|
+
*/
|
|
2912
|
+
onSSEEvent?: (eventType: string, payload: unknown) => void;
|
|
2904
2913
|
/**
|
|
2905
2914
|
* Layout configuration for customizing widget appearance and structure.
|
|
2906
2915
|
* Provides control over header, messages, and content slots.
|
package/src/ui.ts
CHANGED
|
@@ -3118,9 +3118,10 @@ export const createAgentExperience = (
|
|
|
3118
3118
|
});
|
|
3119
3119
|
}
|
|
3120
3120
|
|
|
3121
|
-
// Wire up event stream buffer to capture SSE events
|
|
3122
|
-
if (eventStreamBuffer) {
|
|
3121
|
+
// Wire up optional SSE tap (host) + event stream buffer to capture SSE events
|
|
3122
|
+
if (eventStreamBuffer || config.onSSEEvent) {
|
|
3123
3123
|
session.setSSEEventCallback((type: string, payload: unknown) => {
|
|
3124
|
+
config.onSSEEvent?.(type, payload);
|
|
3124
3125
|
eventStreamBuffer?.push({
|
|
3125
3126
|
id: `evt-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
3126
3127
|
type,
|
|
@@ -4187,8 +4188,9 @@ export const createAgentExperience = (
|
|
|
4187
4188
|
eventStreamStore = new EventStreamStore(eventStreamDbName);
|
|
4188
4189
|
eventStreamBuffer = new EventStreamBuffer(eventStreamMaxEvents, eventStreamStore);
|
|
4189
4190
|
eventStreamStore.open().then(() => eventStreamBuffer?.restore()).catch(() => {});
|
|
4190
|
-
// Register the SSE event callback
|
|
4191
|
+
// Register the SSE event callback (host tap + buffer)
|
|
4191
4192
|
session.setSSEEventCallback((type: string, payload: unknown) => {
|
|
4193
|
+
config.onSSEEvent?.(type, payload);
|
|
4192
4194
|
eventStreamBuffer!.push({
|
|
4193
4195
|
id: `evt-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
4194
4196
|
type,
|