@realtimex/sdk 2.0.16 → 2.0.18
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/package.json +10 -43
- package/skills/realtimex-moderator-sdk/SKILL.md +34 -6
- package/README.md +0 -382
- package/dist/chunk-SFY6E7TY.mjs +0 -132
- package/dist/chunk-UPXEAZIT.mjs +0 -41
- package/dist/chunk-XKQRTTIC.mjs +0 -567
- package/dist/cli/index.d.mts +0 -54
- package/dist/cli/index.d.ts +0 -54
- package/dist/cli/index.js +0 -185
- package/dist/cli/index.mjs +0 -9
- package/dist/errors-DwEt8WYf.d.mts +0 -399
- package/dist/errors-DwEt8WYf.d.ts +0 -399
- package/dist/index.d.mts +0 -32
- package/dist/index.d.ts +0 -32
- package/dist/index.js +0 -785
- package/dist/index.mjs +0 -59
- package/dist/v1/index.d.mts +0 -64
- package/dist/v1/index.d.ts +0 -64
- package/dist/v1/index.js +0 -733
- package/dist/v1/index.mjs +0 -124
package/dist/v1/index.mjs
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DeveloperApiClient,
|
|
3
|
-
V1ApiNamespace,
|
|
4
|
-
V1ChatModule,
|
|
5
|
-
V1ThreadModule,
|
|
6
|
-
V1WorkspaceModule
|
|
7
|
-
} from "../chunk-XKQRTTIC.mjs";
|
|
8
|
-
import {
|
|
9
|
-
AuthenticationError,
|
|
10
|
-
DeveloperApiError,
|
|
11
|
-
NotFoundError,
|
|
12
|
-
ServerError,
|
|
13
|
-
ValidationError
|
|
14
|
-
} from "../chunk-UPXEAZIT.mjs";
|
|
15
|
-
|
|
16
|
-
// src/v1/overrides/v1WorkspaceStreaming.ts
|
|
17
|
-
async function* streamWorkspaceChat(client, slug, body) {
|
|
18
|
-
const response = await client.requestRaw("POST", `/v1/workspace/${slug}/stream-chat`, body);
|
|
19
|
-
if (!response.body) {
|
|
20
|
-
throw new Error("Response body is null \u2014 streaming is not supported in this environment");
|
|
21
|
-
}
|
|
22
|
-
const reader = response.body.getReader();
|
|
23
|
-
const decoder = new TextDecoder();
|
|
24
|
-
let buffer = "";
|
|
25
|
-
let isErrorEvent = false;
|
|
26
|
-
try {
|
|
27
|
-
while (true) {
|
|
28
|
-
const { done, value } = await reader.read();
|
|
29
|
-
if (done) break;
|
|
30
|
-
buffer += decoder.decode(value, { stream: true });
|
|
31
|
-
const lines = buffer.split("\n");
|
|
32
|
-
buffer = lines.pop() ?? "";
|
|
33
|
-
for (const line of lines) {
|
|
34
|
-
if (line.startsWith("event: error")) {
|
|
35
|
-
isErrorEvent = true;
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
if (line.startsWith("data: ")) {
|
|
39
|
-
const jsonStr = line.slice(6).trim();
|
|
40
|
-
if (jsonStr === "[DONE]") {
|
|
41
|
-
isErrorEvent = false;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
let data;
|
|
45
|
-
try {
|
|
46
|
-
data = JSON.parse(jsonStr);
|
|
47
|
-
} catch {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (isErrorEvent) {
|
|
51
|
-
throw new Error(data.error ?? "Unknown streaming error from server");
|
|
52
|
-
}
|
|
53
|
-
yield data;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
} finally {
|
|
58
|
-
reader.releaseLock();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// src/v1/overrides/v1ThreadStreaming.ts
|
|
63
|
-
async function* streamThreadChat(client, slug, threadSlug, body) {
|
|
64
|
-
const response = await client.requestRaw(
|
|
65
|
-
"POST",
|
|
66
|
-
`/v1/workspace/${slug}/thread/${threadSlug}/stream-chat`,
|
|
67
|
-
body
|
|
68
|
-
);
|
|
69
|
-
if (!response.body) {
|
|
70
|
-
throw new Error("Response body is null \u2014 streaming is not supported in this environment");
|
|
71
|
-
}
|
|
72
|
-
const reader = response.body.getReader();
|
|
73
|
-
const decoder = new TextDecoder();
|
|
74
|
-
let buffer = "";
|
|
75
|
-
let isErrorEvent = false;
|
|
76
|
-
try {
|
|
77
|
-
while (true) {
|
|
78
|
-
const { done, value } = await reader.read();
|
|
79
|
-
if (done) break;
|
|
80
|
-
buffer += decoder.decode(value, { stream: true });
|
|
81
|
-
const lines = buffer.split("\n");
|
|
82
|
-
buffer = lines.pop() ?? "";
|
|
83
|
-
for (const line of lines) {
|
|
84
|
-
if (line.startsWith("event: error")) {
|
|
85
|
-
isErrorEvent = true;
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (line.startsWith("data: ")) {
|
|
89
|
-
const jsonStr = line.slice(6).trim();
|
|
90
|
-
if (jsonStr === "[DONE]") {
|
|
91
|
-
isErrorEvent = false;
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
let data;
|
|
95
|
-
try {
|
|
96
|
-
data = JSON.parse(jsonStr);
|
|
97
|
-
} catch {
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
if (isErrorEvent) {
|
|
101
|
-
throw new Error(data.error ?? "Unknown streaming error from server");
|
|
102
|
-
}
|
|
103
|
-
yield data;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
} finally {
|
|
108
|
-
reader.releaseLock();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
export {
|
|
112
|
-
AuthenticationError,
|
|
113
|
-
DeveloperApiClient,
|
|
114
|
-
DeveloperApiError,
|
|
115
|
-
NotFoundError,
|
|
116
|
-
ServerError,
|
|
117
|
-
V1ApiNamespace,
|
|
118
|
-
V1ChatModule,
|
|
119
|
-
V1ThreadModule,
|
|
120
|
-
V1WorkspaceModule,
|
|
121
|
-
ValidationError,
|
|
122
|
-
streamThreadChat,
|
|
123
|
-
streamWorkspaceChat
|
|
124
|
-
};
|