@runtypelabs/persona 3.22.0 → 3.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.cjs +2 -262
- package/dist/animations/glyph-cycle.js +2 -235
- package/dist/animations/wipe.cjs +2 -72
- package/dist/animations/wipe.js +2 -45
- package/dist/index.cjs +50 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +83 -83
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +49 -49
- package/dist/index.js.map +1 -1
- package/dist/smart-dom-reader.cjs +22 -1874
- package/dist/smart-dom-reader.js +22 -1847
- package/dist/testing.cjs +3 -84
- package/dist/testing.js +3 -55
- package/dist/theme-editor.cjs +54 -24695
- package/dist/theme-editor.js +54 -24682
- package/package.json +9 -6
- package/src/components/event-stream-view.ts +122 -1
- package/src/ui.ts +24 -3
- package/src/utils/throughput-tracker.test.ts +366 -0
- package/src/utils/throughput-tracker.ts +427 -0
package/dist/testing.cjs
CHANGED
|
@@ -1,85 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";var m=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var n in e)m(t,n,{get:e[n],enumerable:!0})},p=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!M.call(t,r)&&r!==n&&m(t,r,{get:()=>e[r],enumerable:!(a=k(e,r))||a.enumerable});return t};var x=t=>p(m({},"__esModule",{value:!0}),t);var g={};l(g,{buildAssistantTurnFrames:()=>i,createMockSSEResponse:()=>o,createMockSSEStream:()=>d});module.exports=x(g);var E=new TextEncoder;function d(t,e){var s;let n=(s=e==null?void 0:e.delayMs)!=null?s:100,a=e!=null&&e.eventName?`event: ${e.eventName}
|
|
2
|
+
`:"",r=0;return new ReadableStream({async pull(S){if(r>=t.length){S.close();return}await new Promise(c=>setTimeout(c,n));let u=JSON.stringify(t[r]);S.enqueue(E.encode(`${a}data: ${u}
|
|
19
3
|
|
|
20
|
-
|
|
21
|
-
var testing_exports = {};
|
|
22
|
-
__export(testing_exports, {
|
|
23
|
-
buildAssistantTurnFrames: () => buildAssistantTurnFrames,
|
|
24
|
-
createMockSSEResponse: () => createMockSSEResponse,
|
|
25
|
-
createMockSSEStream: () => createMockSSEStream
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(testing_exports);
|
|
28
|
-
|
|
29
|
-
// src/testing/mock-stream.ts
|
|
30
|
-
var encoder = new TextEncoder();
|
|
31
|
-
function createMockSSEStream(frames, options) {
|
|
32
|
-
var _a;
|
|
33
|
-
const delayMs = (_a = options == null ? void 0 : options.delayMs) != null ? _a : 100;
|
|
34
|
-
const prefix = (options == null ? void 0 : options.eventName) ? `event: ${options.eventName}
|
|
35
|
-
` : "";
|
|
36
|
-
let index = 0;
|
|
37
|
-
return new ReadableStream({
|
|
38
|
-
async pull(controller) {
|
|
39
|
-
if (index >= frames.length) {
|
|
40
|
-
controller.close();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
44
|
-
const payload = JSON.stringify(frames[index]);
|
|
45
|
-
controller.enqueue(encoder.encode(`${prefix}data: ${payload}
|
|
46
|
-
|
|
47
|
-
`));
|
|
48
|
-
index += 1;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function buildAssistantTurnFrames(options) {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
const { executionId, text } = options;
|
|
55
|
-
const turnId = (_a = options.turnId) != null ? _a : "turn-1";
|
|
56
|
-
const chunkSize = Math.max(1, (_b = options.chunkSize) != null ? _b : 32);
|
|
57
|
-
const frames = [{ type: "agent_turn_start", executionId, turnId }];
|
|
58
|
-
for (let i = 0; i < text.length; i += chunkSize) {
|
|
59
|
-
frames.push({
|
|
60
|
-
type: "agent_turn_delta",
|
|
61
|
-
executionId,
|
|
62
|
-
turnId,
|
|
63
|
-
delta: text.slice(i, i + chunkSize)
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
frames.push({ type: "agent_turn_complete", executionId, turnId });
|
|
67
|
-
return frames;
|
|
68
|
-
}
|
|
69
|
-
function createMockSSEResponse(frames, options) {
|
|
70
|
-
var _a;
|
|
71
|
-
const stream = createMockSSEStream(frames, options);
|
|
72
|
-
return new Response(stream, {
|
|
73
|
-
status: (_a = options == null ? void 0 : options.status) != null ? _a : 200,
|
|
74
|
-
headers: {
|
|
75
|
-
"Content-Type": "text/event-stream",
|
|
76
|
-
...options == null ? void 0 : options.headers
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
-
0 && (module.exports = {
|
|
82
|
-
buildAssistantTurnFrames,
|
|
83
|
-
createMockSSEResponse,
|
|
84
|
-
createMockSSEStream
|
|
85
|
-
});
|
|
4
|
+
`)),r+=1}})}function i(t){var S,u;let{executionId:e,text:n}=t,a=(S=t.turnId)!=null?S:"turn-1",r=Math.max(1,(u=t.chunkSize)!=null?u:32),s=[{type:"agent_turn_start",executionId:e,turnId:a}];for(let c=0;c<n.length;c+=r)s.push({type:"agent_turn_delta",executionId:e,turnId:a,delta:n.slice(c,c+r)});return s.push({type:"agent_turn_complete",executionId:e,turnId:a}),s}function o(t,e){var a;let n=d(t,e);return new Response(n,{status:(a=e==null?void 0:e.status)!=null?a:200,headers:{"Content-Type":"text/event-stream",...e==null?void 0:e.headers}})}0&&(module.exports={buildAssistantTurnFrames,createMockSSEResponse,createMockSSEStream});
|
package/dist/testing.js
CHANGED
|
@@ -1,56 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function createMockSSEStream(frames, options) {
|
|
4
|
-
var _a;
|
|
5
|
-
const delayMs = (_a = options == null ? void 0 : options.delayMs) != null ? _a : 100;
|
|
6
|
-
const prefix = (options == null ? void 0 : options.eventName) ? `event: ${options.eventName}
|
|
7
|
-
` : "";
|
|
8
|
-
let index = 0;
|
|
9
|
-
return new ReadableStream({
|
|
10
|
-
async pull(controller) {
|
|
11
|
-
if (index >= frames.length) {
|
|
12
|
-
controller.close();
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
16
|
-
const payload = JSON.stringify(frames[index]);
|
|
17
|
-
controller.enqueue(encoder.encode(`${prefix}data: ${payload}
|
|
1
|
+
var d=new TextEncoder;function m(t,e){var s;let n=(s=e==null?void 0:e.delayMs)!=null?s:100,r=e!=null&&e.eventName?`event: ${e.eventName}
|
|
2
|
+
`:"",a=0;return new ReadableStream({async pull(S){if(a>=t.length){S.close();return}await new Promise(c=>setTimeout(c,n));let u=JSON.stringify(t[a]);S.enqueue(d.encode(`${r}data: ${u}
|
|
18
3
|
|
|
19
|
-
`));
|
|
20
|
-
index += 1;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function buildAssistantTurnFrames(options) {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
const { executionId, text } = options;
|
|
27
|
-
const turnId = (_a = options.turnId) != null ? _a : "turn-1";
|
|
28
|
-
const chunkSize = Math.max(1, (_b = options.chunkSize) != null ? _b : 32);
|
|
29
|
-
const frames = [{ type: "agent_turn_start", executionId, turnId }];
|
|
30
|
-
for (let i = 0; i < text.length; i += chunkSize) {
|
|
31
|
-
frames.push({
|
|
32
|
-
type: "agent_turn_delta",
|
|
33
|
-
executionId,
|
|
34
|
-
turnId,
|
|
35
|
-
delta: text.slice(i, i + chunkSize)
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
frames.push({ type: "agent_turn_complete", executionId, turnId });
|
|
39
|
-
return frames;
|
|
40
|
-
}
|
|
41
|
-
function createMockSSEResponse(frames, options) {
|
|
42
|
-
var _a;
|
|
43
|
-
const stream = createMockSSEStream(frames, options);
|
|
44
|
-
return new Response(stream, {
|
|
45
|
-
status: (_a = options == null ? void 0 : options.status) != null ? _a : 200,
|
|
46
|
-
headers: {
|
|
47
|
-
"Content-Type": "text/event-stream",
|
|
48
|
-
...options == null ? void 0 : options.headers
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
buildAssistantTurnFrames,
|
|
54
|
-
createMockSSEResponse,
|
|
55
|
-
createMockSSEStream
|
|
56
|
-
};
|
|
4
|
+
`)),a+=1}})}function i(t){var S,u;let{executionId:e,text:n}=t,r=(S=t.turnId)!=null?S:"turn-1",a=Math.max(1,(u=t.chunkSize)!=null?u:32),s=[{type:"agent_turn_start",executionId:e,turnId:r}];for(let c=0;c<n.length;c+=a)s.push({type:"agent_turn_delta",executionId:e,turnId:r,delta:n.slice(c,c+a)});return s.push({type:"agent_turn_complete",executionId:e,turnId:r}),s}function o(t,e){var r;let n=m(t,e);return new Response(n,{status:(r=e==null?void 0:e.status)!=null?r:200,headers:{"Content-Type":"text/event-stream",...e==null?void 0:e.headers}})}export{i as buildAssistantTurnFrames,o as createMockSSEResponse,m as createMockSSEStream};
|