@realtimex/sdk 1.6.0 → 1.7.4
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-PDAMNSF2.mjs +665 -0
- package/dist/errors-DoCX7LOD.d.mts +445 -0
- package/dist/errors-DoCX7LOD.d.ts +445 -0
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +662 -0
- package/dist/index.mjs +18 -0
- package/dist/v1/index.d.mts +117 -0
- package/dist/v1/index.d.ts +117 -0
- package/dist/v1/index.js +828 -0
- package/dist/v1/index.mjs +154 -0
- package/package.json +11 -3
- package/skills/realtimex-moderator-sdk/SKILL.md +3 -3
- package/skills/realtimex-moderator-sdk/references/api-reference.md +374 -2
- package/skills/realtimex-moderator-sdk/references/known-issues.md +1 -1
- package/skills/realtimex-moderator-sdk/scripts/lib/sdk-init.js +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthenticationError,
|
|
3
|
+
DeveloperApiClient,
|
|
4
|
+
DeveloperApiError,
|
|
5
|
+
NotFoundError,
|
|
6
|
+
ServerError,
|
|
7
|
+
V1ApiNamespace,
|
|
8
|
+
ValidationError
|
|
9
|
+
} from "./chunk-PDAMNSF2.mjs";
|
|
10
|
+
|
|
1
11
|
// src/modules/api.ts
|
|
2
12
|
var PermissionDeniedError = class extends Error {
|
|
3
13
|
constructor(permission, message, code = "PERMISSION_DENIED") {
|
|
@@ -3641,6 +3651,7 @@ var _RealtimeXSDK = class _RealtimeXSDK {
|
|
|
3641
3651
|
this.database = new DatabaseModule(this.realtimexUrl, this.appId, this.apiKey);
|
|
3642
3652
|
this.auth = new AuthModule(this.realtimexUrl, this.appId, this.apiKey);
|
|
3643
3653
|
this.credentials = new CredentialsModule(this.httpClient);
|
|
3654
|
+
this.v1 = this.apiKey || this.appId ? new V1ApiNamespace(this.realtimexUrl, this.apiKey ?? "", this.appId || void 0) : void 0;
|
|
3644
3655
|
if (this.permissions.length > 0 && this.appId && !this.apiKey) {
|
|
3645
3656
|
this.register().catch((err) => {
|
|
3646
3657
|
console.error("[RealtimeX SDK] Auto-registration failed:", err.message);
|
|
@@ -3750,6 +3761,7 @@ export {
|
|
|
3750
3761
|
AgentModule,
|
|
3751
3762
|
ApiModule,
|
|
3752
3763
|
AuthModule,
|
|
3764
|
+
AuthenticationError,
|
|
3753
3765
|
CONTRACT_ATTEMPT_PREFIX,
|
|
3754
3766
|
CONTRACT_EVENT_ID_HEADER,
|
|
3755
3767
|
CONTRACT_SIGNATURE_ALGORITHM,
|
|
@@ -3764,12 +3776,15 @@ export {
|
|
|
3764
3776
|
ContractRuntime,
|
|
3765
3777
|
ContractValidationError,
|
|
3766
3778
|
DatabaseModule,
|
|
3779
|
+
DeveloperApiClient,
|
|
3780
|
+
DeveloperApiError,
|
|
3767
3781
|
GeminiToolAdapter,
|
|
3768
3782
|
LLMModule,
|
|
3769
3783
|
LLMPermissionError,
|
|
3770
3784
|
LLMProviderError,
|
|
3771
3785
|
LOCAL_APP_CONTRACT_VERSION,
|
|
3772
3786
|
MCPModule,
|
|
3787
|
+
NotFoundError,
|
|
3773
3788
|
PermissionDeniedError,
|
|
3774
3789
|
PermissionRequiredError,
|
|
3775
3790
|
PortModule,
|
|
@@ -3779,12 +3794,15 @@ export {
|
|
|
3779
3794
|
STTModule,
|
|
3780
3795
|
ScopeDeniedError,
|
|
3781
3796
|
ScopeGuard,
|
|
3797
|
+
ServerError,
|
|
3782
3798
|
StaticAuthProvider,
|
|
3783
3799
|
TTSModule,
|
|
3784
3800
|
TaskModule,
|
|
3785
3801
|
ToolNotFoundError,
|
|
3786
3802
|
ToolProjector,
|
|
3787
3803
|
ToolValidationError,
|
|
3804
|
+
V1ApiNamespace,
|
|
3805
|
+
ValidationError,
|
|
3788
3806
|
VectorStore,
|
|
3789
3807
|
WebhookModule,
|
|
3790
3808
|
buildContractIdempotencyKey,
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { D as DeveloperApiClient } from '../errors-DoCX7LOD.mjs';
|
|
2
|
+
export { A as AuthenticationError, a as DeveloperApiError, N as NotFoundError, S as ServerError, d as V1AdminModule, V as V1ApiNamespace, c as V1AuthModule, e as V1DocumentModule, k as V1EmbedModule, j as V1OpenAIModule, g as V1SystemModule, h as V1ThreadModule, i as V1UsersModule, f as V1WorkspaceModule, b as ValidationError } from '../errors-DoCX7LOD.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
|
+
interface UploadedDocument {
|
|
65
|
+
/** Whether the upload succeeded */
|
|
66
|
+
success: boolean;
|
|
67
|
+
/** Parsed document metadata returned by the server */
|
|
68
|
+
document?: {
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
location: string;
|
|
72
|
+
url: string | null;
|
|
73
|
+
title: string | null;
|
|
74
|
+
docAuthor: string | null;
|
|
75
|
+
description: string | null;
|
|
76
|
+
docSource: string | null;
|
|
77
|
+
chunkSource: string | null;
|
|
78
|
+
published: string | null;
|
|
79
|
+
wordCount: number;
|
|
80
|
+
token_count_estimate: number;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
pinnedWorkspaces: string[];
|
|
83
|
+
canWatch: boolean;
|
|
84
|
+
};
|
|
85
|
+
/** Server-level error message when success is false */
|
|
86
|
+
error?: string | null;
|
|
87
|
+
}
|
|
88
|
+
interface UploadFileOptions {
|
|
89
|
+
/**
|
|
90
|
+
* Override the filename sent in the multipart form.
|
|
91
|
+
* Defaults to the `name` property of the `File` / `Blob`.
|
|
92
|
+
*/
|
|
93
|
+
filename?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Upload a `File` or `Blob` to the root documents directory.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
|
|
101
|
+
* const result = await uploadFile(sdk.v1!._client, myFile);
|
|
102
|
+
* console.log(result.document?.location);
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare function uploadFile(client: DeveloperApiClient, file: File | Blob, options?: UploadFileOptions): Promise<UploadedDocument>;
|
|
106
|
+
/**
|
|
107
|
+
* Upload a `File` or `Blob` to a specific folder (created automatically if absent).
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
|
|
112
|
+
* const result = await uploadFileToFolder(sdk.v1!._client, myFile, 'contracts');
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
declare function uploadFileToFolder(client: DeveloperApiClient, file: File | Blob, folderName: string, options?: UploadFileOptions): Promise<UploadedDocument>;
|
|
116
|
+
|
|
117
|
+
export { DeveloperApiClient, type ThreadStreamChunk, type UploadFileOptions, type UploadedDocument, type WorkspaceStreamChunk, streamThreadChat, streamWorkspaceChat, uploadFile, uploadFileToFolder };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { D as DeveloperApiClient } from '../errors-DoCX7LOD.js';
|
|
2
|
+
export { A as AuthenticationError, a as DeveloperApiError, N as NotFoundError, S as ServerError, d as V1AdminModule, V as V1ApiNamespace, c as V1AuthModule, e as V1DocumentModule, k as V1EmbedModule, j as V1OpenAIModule, g as V1SystemModule, h as V1ThreadModule, i as V1UsersModule, f as V1WorkspaceModule, b as ValidationError } from '../errors-DoCX7LOD.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
|
+
interface UploadedDocument {
|
|
65
|
+
/** Whether the upload succeeded */
|
|
66
|
+
success: boolean;
|
|
67
|
+
/** Parsed document metadata returned by the server */
|
|
68
|
+
document?: {
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
location: string;
|
|
72
|
+
url: string | null;
|
|
73
|
+
title: string | null;
|
|
74
|
+
docAuthor: string | null;
|
|
75
|
+
description: string | null;
|
|
76
|
+
docSource: string | null;
|
|
77
|
+
chunkSource: string | null;
|
|
78
|
+
published: string | null;
|
|
79
|
+
wordCount: number;
|
|
80
|
+
token_count_estimate: number;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
pinnedWorkspaces: string[];
|
|
83
|
+
canWatch: boolean;
|
|
84
|
+
};
|
|
85
|
+
/** Server-level error message when success is false */
|
|
86
|
+
error?: string | null;
|
|
87
|
+
}
|
|
88
|
+
interface UploadFileOptions {
|
|
89
|
+
/**
|
|
90
|
+
* Override the filename sent in the multipart form.
|
|
91
|
+
* Defaults to the `name` property of the `File` / `Blob`.
|
|
92
|
+
*/
|
|
93
|
+
filename?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Upload a `File` or `Blob` to the root documents directory.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
|
|
101
|
+
* const result = await uploadFile(sdk.v1!._client, myFile);
|
|
102
|
+
* console.log(result.document?.location);
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare function uploadFile(client: DeveloperApiClient, file: File | Blob, options?: UploadFileOptions): Promise<UploadedDocument>;
|
|
106
|
+
/**
|
|
107
|
+
* Upload a `File` or `Blob` to a specific folder (created automatically if absent).
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const sdk = new RealtimeXSDK({ realtimex: { apiKey: 'sk-...' } });
|
|
112
|
+
* const result = await uploadFileToFolder(sdk.v1!._client, myFile, 'contracts');
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
declare function uploadFileToFolder(client: DeveloperApiClient, file: File | Blob, folderName: string, options?: UploadFileOptions): Promise<UploadedDocument>;
|
|
116
|
+
|
|
117
|
+
export { DeveloperApiClient, type ThreadStreamChunk, type UploadFileOptions, type UploadedDocument, type WorkspaceStreamChunk, streamThreadChat, streamWorkspaceChat, uploadFile, uploadFileToFolder };
|