@realtimex/sdk 1.7.21 → 2.0.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/chunk-ORAAYW4C.mjs +271 -0
- package/dist/errors-C98IGxYU.d.mts +168 -0
- package/dist/errors-C98IGxYU.d.ts +168 -0
- package/dist/index.d.mts +8 -2048
- package/dist/index.d.ts +8 -2048
- package/dist/index.js +168 -4723
- package/dist/index.mjs +7 -3783
- package/dist/v1/index.d.mts +3 -56
- package/dist/v1/index.d.ts +3 -56
- package/dist/v1/index.js +2 -756
- package/dist/v1/index.mjs +2 -42
- package/package.json +6 -7
- package/dist/chunk-Z5GAUBIM.mjs +0 -993
- package/dist/errors-NufsyIZ-.d.mts +0 -678
- package/dist/errors-NufsyIZ-.d.ts +0 -678
- package/skills/realtimex-moderator-sdk/SKILL.md +0 -102
- package/skills/realtimex-moderator-sdk/references/activities.md +0 -14
- package/skills/realtimex-moderator-sdk/references/agents.md +0 -13
- package/skills/realtimex-moderator-sdk/references/api-reference/acpagent.md +0 -105
- package/skills/realtimex-moderator-sdk/references/api-reference/activities.md +0 -24
- package/skills/realtimex-moderator-sdk/references/api-reference/agent.md +0 -27
- package/skills/realtimex-moderator-sdk/references/api-reference/api.md +0 -17
- package/skills/realtimex-moderator-sdk/references/api-reference/auth.md +0 -36
- package/skills/realtimex-moderator-sdk/references/api-reference/contract.md +0 -27
- package/skills/realtimex-moderator-sdk/references/api-reference/core.md +0 -40
- package/skills/realtimex-moderator-sdk/references/api-reference/database.md +0 -24
- package/skills/realtimex-moderator-sdk/references/api-reference/index.md +0 -43
- package/skills/realtimex-moderator-sdk/references/api-reference/llm.md +0 -176
- package/skills/realtimex-moderator-sdk/references/api-reference/mcp.md +0 -50
- package/skills/realtimex-moderator-sdk/references/api-reference/port.md +0 -21
- package/skills/realtimex-moderator-sdk/references/api-reference/stt.md +0 -15
- package/skills/realtimex-moderator-sdk/references/api-reference/task.md +0 -62
- package/skills/realtimex-moderator-sdk/references/api-reference/tts.md +0 -18
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-acpauth.md +0 -21
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-acpcommands.md +0 -15
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-admin.md +0 -48
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-auth.md +0 -18
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-channels.md +0 -78
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-credentials.md +0 -27
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-customthemes.md +0 -24
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopbrowser.md +0 -39
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopembed.md +0 -24
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopruntimesessions.md +0 -33
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-document.md +0 -39
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-embed.md +0 -27
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-openai.md +0 -21
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-sttapi.md +0 -12
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-system.md +0 -36
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-thread.md +0 -26
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-users.md +0 -15
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-workspace.md +0 -39
- package/skills/realtimex-moderator-sdk/references/api-reference/webhook.md +0 -13
- package/skills/realtimex-moderator-sdk/references/api-reference.md +0 -1330
- package/skills/realtimex-moderator-sdk/references/app-concepts.md +0 -1111
- package/skills/realtimex-moderator-sdk/references/browser.md +0 -27
- package/skills/realtimex-moderator-sdk/references/channels.md +0 -189
- package/skills/realtimex-moderator-sdk/references/credentials.md +0 -111
- package/skills/realtimex-moderator-sdk/references/known-issues.md +0 -237
- package/skills/realtimex-moderator-sdk/references/llm.md +0 -13
- package/skills/realtimex-moderator-sdk/references/mcp.md +0 -13
- package/skills/realtimex-moderator-sdk/references/permissions.md +0 -30
- package/skills/realtimex-moderator-sdk/references/quickstart.md +0 -16
- package/skills/realtimex-moderator-sdk/references/terminal-sessions.md +0 -34
- package/skills/realtimex-moderator-sdk/references/workspaces.md +0 -20
- package/skills/realtimex-moderator-sdk/scripts/lib/sdk-init.js +0 -140
- package/skills/realtimex-moderator-sdk/scripts/rtx.js +0 -1359
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
// src/v1/errors.ts
|
|
2
|
+
var DeveloperApiError = class extends Error {
|
|
3
|
+
constructor(status, code, message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.status = status;
|
|
6
|
+
this.code = code;
|
|
7
|
+
this.name = "DeveloperApiError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var AuthenticationError = class extends DeveloperApiError {
|
|
11
|
+
constructor(message = "Invalid or missing API key") {
|
|
12
|
+
super(403, "AUTHENTICATION_ERROR", message);
|
|
13
|
+
this.name = "AuthenticationError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var NotFoundError = class extends DeveloperApiError {
|
|
17
|
+
constructor(message = "Resource not found") {
|
|
18
|
+
super(404, "NOT_FOUND", message);
|
|
19
|
+
this.name = "NotFoundError";
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var ValidationError = class extends DeveloperApiError {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(400, "VALIDATION_ERROR", message);
|
|
25
|
+
this.name = "ValidationError";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var ServerError = class extends DeveloperApiError {
|
|
29
|
+
constructor(message = "Internal server error") {
|
|
30
|
+
super(500, "SERVER_ERROR", message);
|
|
31
|
+
this.name = "ServerError";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/v1/client.ts
|
|
36
|
+
var DeveloperApiClient = class {
|
|
37
|
+
constructor(baseUrl, apiKey, appId) {
|
|
38
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
39
|
+
this.apiKey = apiKey;
|
|
40
|
+
this.appId = appId;
|
|
41
|
+
}
|
|
42
|
+
getHeaders(extra) {
|
|
43
|
+
const headers = {
|
|
44
|
+
"Content-Type": "application/json",
|
|
45
|
+
"Authorization": `Bearer ${this.apiKey}`
|
|
46
|
+
};
|
|
47
|
+
if (this.appId) headers["x-app-id"] = this.appId;
|
|
48
|
+
return { ...headers, ...extra };
|
|
49
|
+
}
|
|
50
|
+
async handleResponse(response) {
|
|
51
|
+
let data;
|
|
52
|
+
try {
|
|
53
|
+
data = await response.json();
|
|
54
|
+
} catch {
|
|
55
|
+
data = {};
|
|
56
|
+
}
|
|
57
|
+
if (response.ok) return data;
|
|
58
|
+
const message = data?.message || data?.error || response.statusText || "Request failed";
|
|
59
|
+
switch (response.status) {
|
|
60
|
+
case 400:
|
|
61
|
+
throw new ValidationError(message);
|
|
62
|
+
case 401:
|
|
63
|
+
case 403:
|
|
64
|
+
throw new AuthenticationError(message);
|
|
65
|
+
case 404:
|
|
66
|
+
throw new NotFoundError(message);
|
|
67
|
+
case 500:
|
|
68
|
+
case 502:
|
|
69
|
+
case 503:
|
|
70
|
+
throw new ServerError(message);
|
|
71
|
+
default:
|
|
72
|
+
throw new DeveloperApiError(response.status, "API_ERROR", message);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Make a JSON request to the v1 API.
|
|
77
|
+
*/
|
|
78
|
+
async request(method, path, body) {
|
|
79
|
+
const url = `${this.baseUrl}/api${path}`;
|
|
80
|
+
const response = await fetch(url, {
|
|
81
|
+
method,
|
|
82
|
+
headers: this.getHeaders(),
|
|
83
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
84
|
+
});
|
|
85
|
+
return this.handleResponse(response);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Make a multipart/form-data request (e.g. file uploads).
|
|
89
|
+
* Do NOT set Content-Type — browser/fetch will set it with the boundary.
|
|
90
|
+
*/
|
|
91
|
+
async requestMultipart(method, path, form) {
|
|
92
|
+
const url = `${this.baseUrl}/api${path}`;
|
|
93
|
+
const authHeaders = { "Authorization": `Bearer ${this.apiKey}` };
|
|
94
|
+
if (this.appId) authHeaders["x-app-id"] = this.appId;
|
|
95
|
+
const response = await fetch(url, {
|
|
96
|
+
method,
|
|
97
|
+
headers: authHeaders,
|
|
98
|
+
body: form
|
|
99
|
+
});
|
|
100
|
+
return this.handleResponse(response);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Make a raw request and return the Response object directly.
|
|
104
|
+
* Used for streaming (SSE) endpoints.
|
|
105
|
+
*/
|
|
106
|
+
async requestRaw(method, path, body) {
|
|
107
|
+
const url = `${this.baseUrl}/api${path}`;
|
|
108
|
+
return fetch(url, {
|
|
109
|
+
method,
|
|
110
|
+
headers: this.getHeaders(),
|
|
111
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/v1/modules/v1Workspace.ts
|
|
117
|
+
var V1WorkspaceModule = class {
|
|
118
|
+
constructor(client) {
|
|
119
|
+
this.client = client;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create a new workspace
|
|
123
|
+
* @see POST /v1/workspace/new
|
|
124
|
+
*/
|
|
125
|
+
async createWorkspace(body) {
|
|
126
|
+
return this.client.request("POST", `/v1/workspace/new`, body);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* List all current workspaces
|
|
130
|
+
* @see GET /v1/workspaces
|
|
131
|
+
*/
|
|
132
|
+
async listWorkspaces() {
|
|
133
|
+
return this.client.request("GET", `/v1/workspaces`);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get a workspace by its unique slug.
|
|
137
|
+
* @see GET /v1/workspace/{slug}
|
|
138
|
+
*/
|
|
139
|
+
async getWorkspace(slug) {
|
|
140
|
+
return this.client.request("GET", `/v1/workspace/${slug}`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Deletes a workspace by its slug.
|
|
144
|
+
* @see DELETE /v1/workspace/{slug}
|
|
145
|
+
*/
|
|
146
|
+
async deleteWorkspace(slug) {
|
|
147
|
+
return this.client.request("DELETE", `/v1/workspace/${slug}`);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Update workspace settings by its unique slug.
|
|
151
|
+
* @see POST /v1/workspace/{slug}/update
|
|
152
|
+
*/
|
|
153
|
+
async updateWorkspace(slug, body) {
|
|
154
|
+
return this.client.request("POST", `/v1/workspace/${slug}/update`, body);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get a workspaces chats regardless of user by its unique slug.
|
|
158
|
+
* @see GET /v1/workspace/{slug}/chats
|
|
159
|
+
*/
|
|
160
|
+
async listChats(slug) {
|
|
161
|
+
return this.client.request("GET", `/v1/workspace/${slug}/chats`);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Add or remove documents from a workspace by its unique slug.
|
|
165
|
+
* @see POST /v1/workspace/{slug}/update-embeddings
|
|
166
|
+
*/
|
|
167
|
+
async updateEmbeddings(slug, body) {
|
|
168
|
+
return this.client.request("POST", `/v1/workspace/${slug}/update-embeddings`, body);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Add or remove pin from a document in a workspace by its unique slug.
|
|
172
|
+
* @see POST /v1/workspace/{slug}/update-pin
|
|
173
|
+
*/
|
|
174
|
+
async updatePin(slug, body) {
|
|
175
|
+
return this.client.request("POST", `/v1/workspace/${slug}/update-pin`, body);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Execute a chat with a workspace
|
|
179
|
+
* @see POST /v1/workspace/{slug}/chat
|
|
180
|
+
*/
|
|
181
|
+
async chat(slug, body) {
|
|
182
|
+
return this.client.request("POST", `/v1/workspace/${slug}/chat`, body);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Execute a streamable chat with a workspace
|
|
186
|
+
* @see POST /v1/workspace/{slug}/stream-chat
|
|
187
|
+
*/
|
|
188
|
+
// @streaming-stub — implement SSE parsing in overrides/v1WorkspaceStreaming.ts
|
|
189
|
+
async streamChat(slug, body) {
|
|
190
|
+
return this.client.requestRaw("POST", `/v1/workspace/${slug}/stream-chat`, body);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Perform a vector similarity search in a workspace
|
|
194
|
+
* @see POST /v1/workspace/{slug}/vector-search
|
|
195
|
+
*/
|
|
196
|
+
async vectorSearch(slug, body) {
|
|
197
|
+
return this.client.request("POST", `/v1/workspace/${slug}/vector-search`, body);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// src/v1/modules/v1Thread.ts
|
|
202
|
+
var V1ThreadModule = class {
|
|
203
|
+
constructor(client) {
|
|
204
|
+
this.client = client;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Create a new workspace thread
|
|
208
|
+
* @see POST /v1/workspace/{slug}/thread/new
|
|
209
|
+
*/
|
|
210
|
+
async createThread(slug, body) {
|
|
211
|
+
return this.client.request("POST", `/v1/workspace/${slug}/thread/new`, body);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Update thread settings by its unique slug.
|
|
215
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/update
|
|
216
|
+
*/
|
|
217
|
+
async updateThread(slug, threadSlug, body) {
|
|
218
|
+
return this.client.request("POST", `/v1/workspace/${slug}/thread/${threadSlug}/update`, body);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Delete a workspace thread
|
|
222
|
+
* @see DELETE /v1/workspace/{slug}/thread/{threadSlug}
|
|
223
|
+
*/
|
|
224
|
+
async deleteThread(slug, threadSlug) {
|
|
225
|
+
return this.client.request("DELETE", `/v1/workspace/${slug}/thread/${threadSlug}`);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Get chats for a workspace thread
|
|
229
|
+
* @see GET /v1/workspace/{slug}/thread/{threadSlug}/chats
|
|
230
|
+
*/
|
|
231
|
+
async listChats(slug, threadSlug) {
|
|
232
|
+
return this.client.request("GET", `/v1/workspace/${slug}/thread/${threadSlug}/chats`);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Chat with a workspace thread
|
|
236
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/chat
|
|
237
|
+
*/
|
|
238
|
+
async chat(slug, threadSlug, body) {
|
|
239
|
+
return this.client.request("POST", `/v1/workspace/${slug}/thread/${threadSlug}/chat`, body);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Stream chat with a workspace thread
|
|
243
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/stream-chat
|
|
244
|
+
*/
|
|
245
|
+
// @streaming-stub — implement SSE parsing in overrides/v1ThreadStreaming.ts
|
|
246
|
+
async streamChat(slug, threadSlug, body) {
|
|
247
|
+
return this.client.requestRaw("POST", `/v1/workspace/${slug}/thread/${threadSlug}/stream-chat`, body);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// src/v1/namespace.ts
|
|
252
|
+
var V1ApiNamespace = class {
|
|
253
|
+
// [GENERATED-PROPS-END]
|
|
254
|
+
constructor(baseUrl, apiKey, appId) {
|
|
255
|
+
this._client = new DeveloperApiClient(baseUrl, apiKey, appId);
|
|
256
|
+
this.workspace = new V1WorkspaceModule(this._client);
|
|
257
|
+
this.thread = new V1ThreadModule(this._client);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export {
|
|
262
|
+
DeveloperApiError,
|
|
263
|
+
AuthenticationError,
|
|
264
|
+
NotFoundError,
|
|
265
|
+
ValidationError,
|
|
266
|
+
ServerError,
|
|
267
|
+
DeveloperApiClient,
|
|
268
|
+
V1WorkspaceModule,
|
|
269
|
+
V1ThreadModule,
|
|
270
|
+
V1ApiNamespace
|
|
271
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeveloperApiClient - HTTP client for the RealtimeX v1 Developer API.
|
|
3
|
+
*
|
|
4
|
+
* Supports two authentication modes:
|
|
5
|
+
* - API Key: Authorization: Bearer <apiKey>
|
|
6
|
+
* - App ID: x-app-id header (for LocalApp / SDK agent authentication)
|
|
7
|
+
*
|
|
8
|
+
* When both are provided, x-app-id takes priority on the server side.
|
|
9
|
+
*/
|
|
10
|
+
declare class DeveloperApiClient {
|
|
11
|
+
private readonly baseUrl;
|
|
12
|
+
private readonly apiKey;
|
|
13
|
+
private readonly appId?;
|
|
14
|
+
constructor(baseUrl: string, apiKey: string, appId?: string);
|
|
15
|
+
private getHeaders;
|
|
16
|
+
private handleResponse;
|
|
17
|
+
/**
|
|
18
|
+
* Make a JSON request to the v1 API.
|
|
19
|
+
*/
|
|
20
|
+
request<T = unknown>(method: string, path: string, body?: unknown): Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Make a multipart/form-data request (e.g. file uploads).
|
|
23
|
+
* Do NOT set Content-Type — browser/fetch will set it with the boundary.
|
|
24
|
+
*/
|
|
25
|
+
requestMultipart<T = unknown>(method: string, path: string, form: FormData): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Make a raw request and return the Response object directly.
|
|
28
|
+
* Used for streaming (SSE) endpoints.
|
|
29
|
+
*/
|
|
30
|
+
requestRaw(method: string, path: string, body?: unknown): Promise<Response>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare class V1WorkspaceModule {
|
|
34
|
+
private readonly client;
|
|
35
|
+
constructor(client: DeveloperApiClient);
|
|
36
|
+
/**
|
|
37
|
+
* Create a new workspace
|
|
38
|
+
* @see POST /v1/workspace/new
|
|
39
|
+
*/
|
|
40
|
+
createWorkspace(body?: Record<string, unknown>): Promise<unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* List all current workspaces
|
|
43
|
+
* @see GET /v1/workspaces
|
|
44
|
+
*/
|
|
45
|
+
listWorkspaces(): Promise<unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Get a workspace by its unique slug.
|
|
48
|
+
* @see GET /v1/workspace/{slug}
|
|
49
|
+
*/
|
|
50
|
+
getWorkspace(slug: string): Promise<unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Deletes a workspace by its slug.
|
|
53
|
+
* @see DELETE /v1/workspace/{slug}
|
|
54
|
+
*/
|
|
55
|
+
deleteWorkspace(slug: string): Promise<unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Update workspace settings by its unique slug.
|
|
58
|
+
* @see POST /v1/workspace/{slug}/update
|
|
59
|
+
*/
|
|
60
|
+
updateWorkspace(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Get a workspaces chats regardless of user by its unique slug.
|
|
63
|
+
* @see GET /v1/workspace/{slug}/chats
|
|
64
|
+
*/
|
|
65
|
+
listChats(slug: string): Promise<unknown>;
|
|
66
|
+
/**
|
|
67
|
+
* Add or remove documents from a workspace by its unique slug.
|
|
68
|
+
* @see POST /v1/workspace/{slug}/update-embeddings
|
|
69
|
+
*/
|
|
70
|
+
updateEmbeddings(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* Add or remove pin from a document in a workspace by its unique slug.
|
|
73
|
+
* @see POST /v1/workspace/{slug}/update-pin
|
|
74
|
+
*/
|
|
75
|
+
updatePin(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
76
|
+
/**
|
|
77
|
+
* Execute a chat with a workspace
|
|
78
|
+
* @see POST /v1/workspace/{slug}/chat
|
|
79
|
+
*/
|
|
80
|
+
chat(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
81
|
+
/**
|
|
82
|
+
* Execute a streamable chat with a workspace
|
|
83
|
+
* @see POST /v1/workspace/{slug}/stream-chat
|
|
84
|
+
*/
|
|
85
|
+
streamChat(slug: string, body?: Record<string, unknown>): Promise<Response>;
|
|
86
|
+
/**
|
|
87
|
+
* Perform a vector similarity search in a workspace
|
|
88
|
+
* @see POST /v1/workspace/{slug}/vector-search
|
|
89
|
+
*/
|
|
90
|
+
vectorSearch(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare class V1ThreadModule {
|
|
94
|
+
private readonly client;
|
|
95
|
+
constructor(client: DeveloperApiClient);
|
|
96
|
+
/**
|
|
97
|
+
* Create a new workspace thread
|
|
98
|
+
* @see POST /v1/workspace/{slug}/thread/new
|
|
99
|
+
*/
|
|
100
|
+
createThread(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
101
|
+
/**
|
|
102
|
+
* Update thread settings by its unique slug.
|
|
103
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/update
|
|
104
|
+
*/
|
|
105
|
+
updateThread(slug: string, threadSlug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
106
|
+
/**
|
|
107
|
+
* Delete a workspace thread
|
|
108
|
+
* @see DELETE /v1/workspace/{slug}/thread/{threadSlug}
|
|
109
|
+
*/
|
|
110
|
+
deleteThread(slug: string, threadSlug: string): Promise<unknown>;
|
|
111
|
+
/**
|
|
112
|
+
* Get chats for a workspace thread
|
|
113
|
+
* @see GET /v1/workspace/{slug}/thread/{threadSlug}/chats
|
|
114
|
+
*/
|
|
115
|
+
listChats(slug: string, threadSlug: string): Promise<unknown>;
|
|
116
|
+
/**
|
|
117
|
+
* Chat with a workspace thread
|
|
118
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/chat
|
|
119
|
+
*/
|
|
120
|
+
chat(slug: string, threadSlug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* Stream chat with a workspace thread
|
|
123
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/stream-chat
|
|
124
|
+
*/
|
|
125
|
+
streamChat(slug: string, threadSlug: string, body?: Record<string, unknown>): Promise<Response>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* V1ApiNamespace - Container for all RealtimeX Developer API (v1) modules.
|
|
130
|
+
*
|
|
131
|
+
* Usage:
|
|
132
|
+
* const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
|
|
133
|
+
* await sdk.v1?.workspace.listWorkspaces();
|
|
134
|
+
* await sdk.v1?.thread.createThread('workspace-slug');
|
|
135
|
+
*
|
|
136
|
+
* Regenerate modules: node scripts/generate-v1-sdk.mjs --force
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
declare class V1ApiNamespace {
|
|
140
|
+
/** @internal Shared HTTP client used by all v1 modules */
|
|
141
|
+
readonly _client: DeveloperApiClient;
|
|
142
|
+
workspace: V1WorkspaceModule;
|
|
143
|
+
thread: V1ThreadModule;
|
|
144
|
+
constructor(baseUrl: string, apiKey: string, appId?: string);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* RealtimeX SDK - Developer API (v1) Error Classes
|
|
149
|
+
*/
|
|
150
|
+
declare class DeveloperApiError extends Error {
|
|
151
|
+
readonly status: number;
|
|
152
|
+
readonly code: string;
|
|
153
|
+
constructor(status: number, code: string, message: string);
|
|
154
|
+
}
|
|
155
|
+
declare class AuthenticationError extends DeveloperApiError {
|
|
156
|
+
constructor(message?: string);
|
|
157
|
+
}
|
|
158
|
+
declare class NotFoundError extends DeveloperApiError {
|
|
159
|
+
constructor(message?: string);
|
|
160
|
+
}
|
|
161
|
+
declare class ValidationError extends DeveloperApiError {
|
|
162
|
+
constructor(message: string);
|
|
163
|
+
}
|
|
164
|
+
declare class ServerError extends DeveloperApiError {
|
|
165
|
+
constructor(message?: string);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { AuthenticationError as A, DeveloperApiClient as D, NotFoundError as N, ServerError as S, V1ApiNamespace as V, DeveloperApiError as a, ValidationError as b, V1WorkspaceModule as c, V1ThreadModule as d };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeveloperApiClient - HTTP client for the RealtimeX v1 Developer API.
|
|
3
|
+
*
|
|
4
|
+
* Supports two authentication modes:
|
|
5
|
+
* - API Key: Authorization: Bearer <apiKey>
|
|
6
|
+
* - App ID: x-app-id header (for LocalApp / SDK agent authentication)
|
|
7
|
+
*
|
|
8
|
+
* When both are provided, x-app-id takes priority on the server side.
|
|
9
|
+
*/
|
|
10
|
+
declare class DeveloperApiClient {
|
|
11
|
+
private readonly baseUrl;
|
|
12
|
+
private readonly apiKey;
|
|
13
|
+
private readonly appId?;
|
|
14
|
+
constructor(baseUrl: string, apiKey: string, appId?: string);
|
|
15
|
+
private getHeaders;
|
|
16
|
+
private handleResponse;
|
|
17
|
+
/**
|
|
18
|
+
* Make a JSON request to the v1 API.
|
|
19
|
+
*/
|
|
20
|
+
request<T = unknown>(method: string, path: string, body?: unknown): Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Make a multipart/form-data request (e.g. file uploads).
|
|
23
|
+
* Do NOT set Content-Type — browser/fetch will set it with the boundary.
|
|
24
|
+
*/
|
|
25
|
+
requestMultipart<T = unknown>(method: string, path: string, form: FormData): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Make a raw request and return the Response object directly.
|
|
28
|
+
* Used for streaming (SSE) endpoints.
|
|
29
|
+
*/
|
|
30
|
+
requestRaw(method: string, path: string, body?: unknown): Promise<Response>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare class V1WorkspaceModule {
|
|
34
|
+
private readonly client;
|
|
35
|
+
constructor(client: DeveloperApiClient);
|
|
36
|
+
/**
|
|
37
|
+
* Create a new workspace
|
|
38
|
+
* @see POST /v1/workspace/new
|
|
39
|
+
*/
|
|
40
|
+
createWorkspace(body?: Record<string, unknown>): Promise<unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* List all current workspaces
|
|
43
|
+
* @see GET /v1/workspaces
|
|
44
|
+
*/
|
|
45
|
+
listWorkspaces(): Promise<unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Get a workspace by its unique slug.
|
|
48
|
+
* @see GET /v1/workspace/{slug}
|
|
49
|
+
*/
|
|
50
|
+
getWorkspace(slug: string): Promise<unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Deletes a workspace by its slug.
|
|
53
|
+
* @see DELETE /v1/workspace/{slug}
|
|
54
|
+
*/
|
|
55
|
+
deleteWorkspace(slug: string): Promise<unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Update workspace settings by its unique slug.
|
|
58
|
+
* @see POST /v1/workspace/{slug}/update
|
|
59
|
+
*/
|
|
60
|
+
updateWorkspace(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Get a workspaces chats regardless of user by its unique slug.
|
|
63
|
+
* @see GET /v1/workspace/{slug}/chats
|
|
64
|
+
*/
|
|
65
|
+
listChats(slug: string): Promise<unknown>;
|
|
66
|
+
/**
|
|
67
|
+
* Add or remove documents from a workspace by its unique slug.
|
|
68
|
+
* @see POST /v1/workspace/{slug}/update-embeddings
|
|
69
|
+
*/
|
|
70
|
+
updateEmbeddings(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* Add or remove pin from a document in a workspace by its unique slug.
|
|
73
|
+
* @see POST /v1/workspace/{slug}/update-pin
|
|
74
|
+
*/
|
|
75
|
+
updatePin(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
76
|
+
/**
|
|
77
|
+
* Execute a chat with a workspace
|
|
78
|
+
* @see POST /v1/workspace/{slug}/chat
|
|
79
|
+
*/
|
|
80
|
+
chat(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
81
|
+
/**
|
|
82
|
+
* Execute a streamable chat with a workspace
|
|
83
|
+
* @see POST /v1/workspace/{slug}/stream-chat
|
|
84
|
+
*/
|
|
85
|
+
streamChat(slug: string, body?: Record<string, unknown>): Promise<Response>;
|
|
86
|
+
/**
|
|
87
|
+
* Perform a vector similarity search in a workspace
|
|
88
|
+
* @see POST /v1/workspace/{slug}/vector-search
|
|
89
|
+
*/
|
|
90
|
+
vectorSearch(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare class V1ThreadModule {
|
|
94
|
+
private readonly client;
|
|
95
|
+
constructor(client: DeveloperApiClient);
|
|
96
|
+
/**
|
|
97
|
+
* Create a new workspace thread
|
|
98
|
+
* @see POST /v1/workspace/{slug}/thread/new
|
|
99
|
+
*/
|
|
100
|
+
createThread(slug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
101
|
+
/**
|
|
102
|
+
* Update thread settings by its unique slug.
|
|
103
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/update
|
|
104
|
+
*/
|
|
105
|
+
updateThread(slug: string, threadSlug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
106
|
+
/**
|
|
107
|
+
* Delete a workspace thread
|
|
108
|
+
* @see DELETE /v1/workspace/{slug}/thread/{threadSlug}
|
|
109
|
+
*/
|
|
110
|
+
deleteThread(slug: string, threadSlug: string): Promise<unknown>;
|
|
111
|
+
/**
|
|
112
|
+
* Get chats for a workspace thread
|
|
113
|
+
* @see GET /v1/workspace/{slug}/thread/{threadSlug}/chats
|
|
114
|
+
*/
|
|
115
|
+
listChats(slug: string, threadSlug: string): Promise<unknown>;
|
|
116
|
+
/**
|
|
117
|
+
* Chat with a workspace thread
|
|
118
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/chat
|
|
119
|
+
*/
|
|
120
|
+
chat(slug: string, threadSlug: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* Stream chat with a workspace thread
|
|
123
|
+
* @see POST /v1/workspace/{slug}/thread/{threadSlug}/stream-chat
|
|
124
|
+
*/
|
|
125
|
+
streamChat(slug: string, threadSlug: string, body?: Record<string, unknown>): Promise<Response>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* V1ApiNamespace - Container for all RealtimeX Developer API (v1) modules.
|
|
130
|
+
*
|
|
131
|
+
* Usage:
|
|
132
|
+
* const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
|
|
133
|
+
* await sdk.v1?.workspace.listWorkspaces();
|
|
134
|
+
* await sdk.v1?.thread.createThread('workspace-slug');
|
|
135
|
+
*
|
|
136
|
+
* Regenerate modules: node scripts/generate-v1-sdk.mjs --force
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
declare class V1ApiNamespace {
|
|
140
|
+
/** @internal Shared HTTP client used by all v1 modules */
|
|
141
|
+
readonly _client: DeveloperApiClient;
|
|
142
|
+
workspace: V1WorkspaceModule;
|
|
143
|
+
thread: V1ThreadModule;
|
|
144
|
+
constructor(baseUrl: string, apiKey: string, appId?: string);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* RealtimeX SDK - Developer API (v1) Error Classes
|
|
149
|
+
*/
|
|
150
|
+
declare class DeveloperApiError extends Error {
|
|
151
|
+
readonly status: number;
|
|
152
|
+
readonly code: string;
|
|
153
|
+
constructor(status: number, code: string, message: string);
|
|
154
|
+
}
|
|
155
|
+
declare class AuthenticationError extends DeveloperApiError {
|
|
156
|
+
constructor(message?: string);
|
|
157
|
+
}
|
|
158
|
+
declare class NotFoundError extends DeveloperApiError {
|
|
159
|
+
constructor(message?: string);
|
|
160
|
+
}
|
|
161
|
+
declare class ValidationError extends DeveloperApiError {
|
|
162
|
+
constructor(message: string);
|
|
163
|
+
}
|
|
164
|
+
declare class ServerError extends DeveloperApiError {
|
|
165
|
+
constructor(message?: string);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { AuthenticationError as A, DeveloperApiClient as D, NotFoundError as N, ServerError as S, V1ApiNamespace as V, DeveloperApiError as a, ValidationError as b, V1WorkspaceModule as c, V1ThreadModule as d };
|