@realtimex/sdk 2.0.17 → 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/dist/index.mjs DELETED
@@ -1,59 +0,0 @@
1
- import {
2
- CliApiClient,
3
- CliApiNamespace
4
- } from "./chunk-SFY6E7TY.mjs";
5
- import {
6
- DeveloperApiClient,
7
- V1ApiNamespace
8
- } from "./chunk-XKQRTTIC.mjs";
9
- import {
10
- AuthenticationError,
11
- DeveloperApiError,
12
- NotFoundError,
13
- ServerError,
14
- ValidationError
15
- } from "./chunk-UPXEAZIT.mjs";
16
-
17
- // src/index.ts
18
- var _RealtimeXSDK = class _RealtimeXSDK {
19
- constructor(config = {}) {
20
- const envAppId = this.getEnvVar("RTX_APP_ID");
21
- const envApiKey = this.getEnvVar("RTX_API_KEY");
22
- this.appId = config.realtimex?.appId || envAppId || "";
23
- this.apiKey = config.realtimex?.apiKey || envApiKey;
24
- this.realtimexUrl = config.realtimex?.url || _RealtimeXSDK.DEFAULT_REALTIMEX_URL;
25
- this.v1 = new V1ApiNamespace(
26
- this.realtimexUrl,
27
- this.apiKey ?? "",
28
- this.appId || void 0
29
- );
30
- this.cli = new CliApiNamespace(
31
- this.realtimexUrl,
32
- this.apiKey ?? "",
33
- this.appId || void 0
34
- );
35
- }
36
- getEnvVar(name) {
37
- if (typeof process !== "undefined" && process.env) {
38
- return process.env[name];
39
- }
40
- if (typeof window !== "undefined") {
41
- return window[name];
42
- }
43
- return void 0;
44
- }
45
- };
46
- _RealtimeXSDK.DEFAULT_REALTIMEX_URL = "http://localhost:3001";
47
- var RealtimeXSDK = _RealtimeXSDK;
48
- export {
49
- AuthenticationError,
50
- CliApiClient,
51
- CliApiNamespace,
52
- DeveloperApiClient,
53
- DeveloperApiError,
54
- NotFoundError,
55
- RealtimeXSDK,
56
- ServerError,
57
- V1ApiNamespace,
58
- ValidationError
59
- };
@@ -1,64 +0,0 @@
1
- import { D as DeveloperApiClient } from '../errors-DwEt8WYf.mjs';
2
- export { A as AuthenticationError, a as DeveloperApiError, N as NotFoundError, S as ServerError, V as V1ApiNamespace, c as V1ChatModule, e as V1ThreadModule, d as V1WorkspaceModule, b as ValidationError } from '../errors-DwEt8WYf.mjs';
3
-
4
- interface WorkspaceStreamChunk {
5
- /** The text fragment emitted by this SSE event */
6
- textResponse: string;
7
- /** Unique identifier for this chat session */
8
- id: string;
9
- /** Human-readable source references used for this response, if any */
10
- sources: Array<{
11
- id: string;
12
- url?: string;
13
- title?: string;
14
- score?: number;
15
- }>;
16
- /** Whether this is the final chunk in the stream */
17
- close: boolean;
18
- /** Error message, present only when the server emits an error event */
19
- error: string | null;
20
- }
21
- /**
22
- * Execute a streamable chat with a workspace and yield typed SSE chunks.
23
- *
24
- * @example
25
- * ```ts
26
- * const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
27
- * for await (const chunk of streamWorkspaceChat(sdk.v1!._client, 'my-workspace', { message: 'Hello' })) {
28
- * process.stdout.write(chunk.textResponse);
29
- * }
30
- * ```
31
- */
32
- declare function streamWorkspaceChat(client: DeveloperApiClient, slug: string, body?: Record<string, unknown>): AsyncGenerator<WorkspaceStreamChunk, void, unknown>;
33
-
34
- interface ThreadStreamChunk {
35
- /** The text fragment emitted by this SSE event */
36
- textResponse: string;
37
- /** Unique identifier for this chat session */
38
- id: string;
39
- /** Human-readable source references used for this response, if any */
40
- sources: Array<{
41
- id: string;
42
- url?: string;
43
- title?: string;
44
- score?: number;
45
- }>;
46
- /** Whether this is the final chunk in the stream */
47
- close: boolean;
48
- /** Error message, present only when the server emits an error event */
49
- error: string | null;
50
- }
51
- /**
52
- * Execute a streamable chat with a workspace thread and yield typed SSE chunks.
53
- *
54
- * @example
55
- * ```ts
56
- * const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
57
- * for await (const chunk of streamThreadChat(sdk.v1!._client, 'my-workspace', 'my-thread', { message: 'Hello' })) {
58
- * process.stdout.write(chunk.textResponse);
59
- * }
60
- * ```
61
- */
62
- declare function streamThreadChat(client: DeveloperApiClient, slug: string, threadSlug: string, body?: Record<string, unknown>): AsyncGenerator<ThreadStreamChunk, void, unknown>;
63
-
64
- export { DeveloperApiClient, type ThreadStreamChunk, type WorkspaceStreamChunk, streamThreadChat, streamWorkspaceChat };
@@ -1,64 +0,0 @@
1
- import { D as DeveloperApiClient } from '../errors-DwEt8WYf.js';
2
- export { A as AuthenticationError, a as DeveloperApiError, N as NotFoundError, S as ServerError, V as V1ApiNamespace, c as V1ChatModule, e as V1ThreadModule, d as V1WorkspaceModule, b as ValidationError } from '../errors-DwEt8WYf.js';
3
-
4
- interface WorkspaceStreamChunk {
5
- /** The text fragment emitted by this SSE event */
6
- textResponse: string;
7
- /** Unique identifier for this chat session */
8
- id: string;
9
- /** Human-readable source references used for this response, if any */
10
- sources: Array<{
11
- id: string;
12
- url?: string;
13
- title?: string;
14
- score?: number;
15
- }>;
16
- /** Whether this is the final chunk in the stream */
17
- close: boolean;
18
- /** Error message, present only when the server emits an error event */
19
- error: string | null;
20
- }
21
- /**
22
- * Execute a streamable chat with a workspace and yield typed SSE chunks.
23
- *
24
- * @example
25
- * ```ts
26
- * const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
27
- * for await (const chunk of streamWorkspaceChat(sdk.v1!._client, 'my-workspace', { message: 'Hello' })) {
28
- * process.stdout.write(chunk.textResponse);
29
- * }
30
- * ```
31
- */
32
- declare function streamWorkspaceChat(client: DeveloperApiClient, slug: string, body?: Record<string, unknown>): AsyncGenerator<WorkspaceStreamChunk, void, unknown>;
33
-
34
- interface ThreadStreamChunk {
35
- /** The text fragment emitted by this SSE event */
36
- textResponse: string;
37
- /** Unique identifier for this chat session */
38
- id: string;
39
- /** Human-readable source references used for this response, if any */
40
- sources: Array<{
41
- id: string;
42
- url?: string;
43
- title?: string;
44
- score?: number;
45
- }>;
46
- /** Whether this is the final chunk in the stream */
47
- close: boolean;
48
- /** Error message, present only when the server emits an error event */
49
- error: string | null;
50
- }
51
- /**
52
- * Execute a streamable chat with a workspace thread and yield typed SSE chunks.
53
- *
54
- * @example
55
- * ```ts
56
- * const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
57
- * for await (const chunk of streamThreadChat(sdk.v1!._client, 'my-workspace', 'my-thread', { message: 'Hello' })) {
58
- * process.stdout.write(chunk.textResponse);
59
- * }
60
- * ```
61
- */
62
- declare function streamThreadChat(client: DeveloperApiClient, slug: string, threadSlug: string, body?: Record<string, unknown>): AsyncGenerator<ThreadStreamChunk, void, unknown>;
63
-
64
- export { DeveloperApiClient, type ThreadStreamChunk, type WorkspaceStreamChunk, streamThreadChat, streamWorkspaceChat };