@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/index.js CHANGED
@@ -39,6 +39,7 @@ __export(index_exports, {
39
39
  AgentModule: () => AgentModule,
40
40
  ApiModule: () => ApiModule,
41
41
  AuthModule: () => AuthModule,
42
+ AuthenticationError: () => AuthenticationError,
42
43
  CONTRACT_ATTEMPT_PREFIX: () => CONTRACT_ATTEMPT_PREFIX,
43
44
  CONTRACT_EVENT_ID_HEADER: () => CONTRACT_EVENT_ID_HEADER,
44
45
  CONTRACT_SIGNATURE_ALGORITHM: () => CONTRACT_SIGNATURE_ALGORITHM,
@@ -53,12 +54,15 @@ __export(index_exports, {
53
54
  ContractRuntime: () => ContractRuntime,
54
55
  ContractValidationError: () => ContractValidationError,
55
56
  DatabaseModule: () => DatabaseModule,
57
+ DeveloperApiClient: () => DeveloperApiClient,
58
+ DeveloperApiError: () => DeveloperApiError,
56
59
  GeminiToolAdapter: () => GeminiToolAdapter,
57
60
  LLMModule: () => LLMModule,
58
61
  LLMPermissionError: () => LLMPermissionError,
59
62
  LLMProviderError: () => LLMProviderError,
60
63
  LOCAL_APP_CONTRACT_VERSION: () => LOCAL_APP_CONTRACT_VERSION,
61
64
  MCPModule: () => MCPModule,
65
+ NotFoundError: () => NotFoundError,
62
66
  PermissionDeniedError: () => PermissionDeniedError,
63
67
  PermissionRequiredError: () => PermissionRequiredError,
64
68
  PortModule: () => PortModule,
@@ -68,12 +72,15 @@ __export(index_exports, {
68
72
  STTModule: () => STTModule,
69
73
  ScopeDeniedError: () => ScopeDeniedError,
70
74
  ScopeGuard: () => ScopeGuard,
75
+ ServerError: () => ServerError,
71
76
  StaticAuthProvider: () => StaticAuthProvider,
72
77
  TTSModule: () => TTSModule,
73
78
  TaskModule: () => TaskModule,
74
79
  ToolNotFoundError: () => ToolNotFoundError,
75
80
  ToolProjector: () => ToolProjector,
76
81
  ToolValidationError: () => ToolValidationError,
82
+ V1ApiNamespace: () => V1ApiNamespace,
83
+ ValidationError: () => ValidationError,
77
84
  VectorStore: () => VectorStore,
78
85
  WebhookModule: () => WebhookModule,
79
86
  buildContractIdempotencyKey: () => buildContractIdempotencyKey,
@@ -3036,6 +3043,653 @@ var CredentialsModule = class {
3036
3043
  }
3037
3044
  };
3038
3045
 
3046
+ // src/v1/errors.ts
3047
+ var DeveloperApiError = class extends Error {
3048
+ constructor(status, code, message) {
3049
+ super(message);
3050
+ this.status = status;
3051
+ this.code = code;
3052
+ this.name = "DeveloperApiError";
3053
+ }
3054
+ };
3055
+ var AuthenticationError = class extends DeveloperApiError {
3056
+ constructor(message = "Invalid or missing API key") {
3057
+ super(403, "AUTHENTICATION_ERROR", message);
3058
+ this.name = "AuthenticationError";
3059
+ }
3060
+ };
3061
+ var NotFoundError = class extends DeveloperApiError {
3062
+ constructor(message = "Resource not found") {
3063
+ super(404, "NOT_FOUND", message);
3064
+ this.name = "NotFoundError";
3065
+ }
3066
+ };
3067
+ var ValidationError = class extends DeveloperApiError {
3068
+ constructor(message) {
3069
+ super(400, "VALIDATION_ERROR", message);
3070
+ this.name = "ValidationError";
3071
+ }
3072
+ };
3073
+ var ServerError = class extends DeveloperApiError {
3074
+ constructor(message = "Internal server error") {
3075
+ super(500, "SERVER_ERROR", message);
3076
+ this.name = "ServerError";
3077
+ }
3078
+ };
3079
+
3080
+ // src/v1/client.ts
3081
+ var DeveloperApiClient = class {
3082
+ constructor(baseUrl, apiKey, appId) {
3083
+ this.baseUrl = baseUrl.replace(/\/$/, "");
3084
+ this.apiKey = apiKey;
3085
+ this.appId = appId;
3086
+ }
3087
+ getHeaders(extra) {
3088
+ const headers = {
3089
+ "Content-Type": "application/json",
3090
+ "Authorization": `Bearer ${this.apiKey}`
3091
+ };
3092
+ if (this.appId) headers["x-app-id"] = this.appId;
3093
+ return { ...headers, ...extra };
3094
+ }
3095
+ async handleResponse(response) {
3096
+ let data;
3097
+ try {
3098
+ data = await response.json();
3099
+ } catch {
3100
+ data = {};
3101
+ }
3102
+ if (response.ok) return data;
3103
+ const message = data?.message || data?.error || response.statusText || "Request failed";
3104
+ switch (response.status) {
3105
+ case 400:
3106
+ throw new ValidationError(message);
3107
+ case 401:
3108
+ case 403:
3109
+ throw new AuthenticationError(message);
3110
+ case 404:
3111
+ throw new NotFoundError(message);
3112
+ case 500:
3113
+ case 502:
3114
+ case 503:
3115
+ throw new ServerError(message);
3116
+ default:
3117
+ throw new DeveloperApiError(response.status, "API_ERROR", message);
3118
+ }
3119
+ }
3120
+ /**
3121
+ * Make a JSON request to the v1 API.
3122
+ */
3123
+ async request(method, path, body) {
3124
+ const url = `${this.baseUrl}/api${path}`;
3125
+ const response = await fetch(url, {
3126
+ method,
3127
+ headers: this.getHeaders(),
3128
+ body: body !== void 0 ? JSON.stringify(body) : void 0
3129
+ });
3130
+ return this.handleResponse(response);
3131
+ }
3132
+ /**
3133
+ * Make a multipart/form-data request (e.g. file uploads).
3134
+ * Do NOT set Content-Type — browser/fetch will set it with the boundary.
3135
+ */
3136
+ async requestMultipart(method, path, form) {
3137
+ const url = `${this.baseUrl}/api${path}`;
3138
+ const authHeaders = { "Authorization": `Bearer ${this.apiKey}` };
3139
+ if (this.appId) authHeaders["x-app-id"] = this.appId;
3140
+ const response = await fetch(url, {
3141
+ method,
3142
+ headers: authHeaders,
3143
+ body: form
3144
+ });
3145
+ return this.handleResponse(response);
3146
+ }
3147
+ /**
3148
+ * Make a raw request and return the Response object directly.
3149
+ * Used for streaming (SSE) endpoints.
3150
+ */
3151
+ async requestRaw(method, path, body) {
3152
+ const url = `${this.baseUrl}/api${path}`;
3153
+ return fetch(url, {
3154
+ method,
3155
+ headers: this.getHeaders(),
3156
+ body: body !== void 0 ? JSON.stringify(body) : void 0
3157
+ });
3158
+ }
3159
+ };
3160
+
3161
+ // src/v1/modules/v1Auth.ts
3162
+ var V1AuthModule = class {
3163
+ constructor(client) {
3164
+ this.client = client;
3165
+ }
3166
+ /**
3167
+ * Verify the attached Authentication header contains a valid API token.
3168
+ * @see GET /v1/auth
3169
+ */
3170
+ async getAuth() {
3171
+ return this.client.request("GET", `/v1/auth`);
3172
+ }
3173
+ };
3174
+
3175
+ // src/v1/modules/v1Admin.ts
3176
+ var V1AdminModule = class {
3177
+ constructor(client) {
3178
+ this.client = client;
3179
+ }
3180
+ /**
3181
+ * Check to see if the instance is in multi-user-mode first. Methods are disabled until multi user mode is enabled via the UI.
3182
+ * @see GET /v1/admin/is-multi-user-mode
3183
+ */
3184
+ async getIsMultiUserMode() {
3185
+ return this.client.request("GET", `/v1/admin/is-multi-user-mode`);
3186
+ }
3187
+ /**
3188
+ * Check to see if the instance is in multi-user-mode first. Methods are disabled until multi user mode is enabled via the UI.
3189
+ * @see GET /v1/admin/users
3190
+ */
3191
+ async listUsers() {
3192
+ return this.client.request("GET", `/v1/admin/users`);
3193
+ }
3194
+ /**
3195
+ * Create a new user with username and password. Methods are disabled until multi user mode is enabled via the UI.
3196
+ * @see POST /v1/admin/users/new
3197
+ */
3198
+ async createUser(body) {
3199
+ return this.client.request("POST", `/v1/admin/users/new`, body);
3200
+ }
3201
+ /**
3202
+ * Update existing user settings. Methods are disabled until multi user mode is enabled via the UI.
3203
+ * @see POST /v1/admin/users/{id}
3204
+ */
3205
+ async updateUser(id, body) {
3206
+ return this.client.request("POST", `/v1/admin/users/${id}`, body);
3207
+ }
3208
+ /**
3209
+ * Delete existing user by id. Methods are disabled until multi user mode is enabled via the UI.
3210
+ * @see DELETE /v1/admin/users/{id}
3211
+ */
3212
+ async deleteUser(id) {
3213
+ return this.client.request("DELETE", `/v1/admin/users/${id}`);
3214
+ }
3215
+ /**
3216
+ * List all existing invitations to instance regardless of status. Methods are disabled until multi user mode is enabled via the UI.
3217
+ * @see GET /v1/admin/invites
3218
+ */
3219
+ async listInvites() {
3220
+ return this.client.request("GET", `/v1/admin/invites`);
3221
+ }
3222
+ /**
3223
+ * Create a new invite code for someone to use to register with instance. Methods are disabled until multi user mode is enabled via the UI.
3224
+ * @see POST /v1/admin/invite/new
3225
+ */
3226
+ async createInvite(body) {
3227
+ return this.client.request("POST", `/v1/admin/invite/new`, body);
3228
+ }
3229
+ /**
3230
+ * Deactivates (soft-delete) invite by id. Methods are disabled until multi user mode is enabled via the UI.
3231
+ * @see DELETE /v1/admin/invite/{id}
3232
+ */
3233
+ async deleteInvite(id) {
3234
+ return this.client.request("DELETE", `/v1/admin/invite/${id}`);
3235
+ }
3236
+ /**
3237
+ * Retrieve a list of users with permissions to access the specified workspace.
3238
+ * @see GET /v1/admin/workspaces/{workspaceId}/users
3239
+ */
3240
+ async listWorkspaceUsers(workspaceId) {
3241
+ return this.client.request("GET", `/v1/admin/workspaces/${workspaceId}/users`);
3242
+ }
3243
+ /**
3244
+ * Overwrite workspace permissions to only be accessible by the given user ids and admins. Methods are disabled until multi user mode is enabled via the UI.
3245
+ * @see POST /v1/admin/workspaces/{workspaceId}/update-users
3246
+ */
3247
+ async updateUsers(workspaceId, body) {
3248
+ return this.client.request("POST", `/v1/admin/workspaces/${workspaceId}/update-users`, body);
3249
+ }
3250
+ /**
3251
+ * Set workspace permissions to be accessible by the given user ids and admins. Methods are disabled until multi user mode is enabled via the UI.
3252
+ * @see POST /v1/admin/workspaces/{workspaceSlug}/manage-users
3253
+ */
3254
+ async workspacesManageUsers(workspaceSlug, body) {
3255
+ return this.client.request("POST", `/v1/admin/workspaces/${workspaceSlug}/manage-users`, body);
3256
+ }
3257
+ /**
3258
+ * All chats in the system ordered by most recent. Methods are disabled until multi user mode is enabled via the UI.
3259
+ * @see POST /v1/admin/workspace-chats
3260
+ */
3261
+ async workspaceChats(body) {
3262
+ return this.client.request("POST", `/v1/admin/workspace-chats`, body);
3263
+ }
3264
+ /**
3265
+ * Update multi-user preferences for instance. Methods are disabled until multi user mode is enabled via the UI.
3266
+ * @see POST /v1/admin/preferences
3267
+ */
3268
+ async createPreference(body) {
3269
+ return this.client.request("POST", `/v1/admin/preferences`, body);
3270
+ }
3271
+ };
3272
+
3273
+ // src/v1/modules/v1Document.ts
3274
+ var V1DocumentModule = class {
3275
+ constructor(client) {
3276
+ this.client = client;
3277
+ }
3278
+ /**
3279
+ * Upload a new file to RealTimeX to be parsed and prepared for embedding.
3280
+ * @see POST /v1/document/upload
3281
+ */
3282
+ // @upload-stub — multipart upload; wire form manually or use helper
3283
+ async upload(form) {
3284
+ return this.client.requestMultipart("POST", `/v1/document/upload`, form);
3285
+ }
3286
+ /**
3287
+ * Upload a new file to a specific folder in RealTimeX to be parsed and prepared for embedding. If the folder does not exist, it will be created.
3288
+ * @see POST /v1/document/upload/{folderName}
3289
+ */
3290
+ // @upload-stub — multipart upload; wire form manually or use helper
3291
+ async uploadFolder(folderName, form) {
3292
+ return this.client.requestMultipart("POST", `/v1/document/upload/${folderName}`, form);
3293
+ }
3294
+ /**
3295
+ * Upload a valid URL for RealTimeX to scrape and prepare for embedding. Optionally, specify a comma-separated list of workspace slugs to embed the document into post-upload.
3296
+ * @see POST /v1/document/upload-link
3297
+ */
3298
+ async uploadLink(body) {
3299
+ return this.client.request("POST", `/v1/document/upload-link`, body);
3300
+ }
3301
+ /**
3302
+ * Upload a file by specifying its raw text content and metadata values without having to upload a file.
3303
+ * @see POST /v1/document/raw-text
3304
+ */
3305
+ async rawText(body) {
3306
+ return this.client.request("POST", `/v1/document/raw-text`, body);
3307
+ }
3308
+ /**
3309
+ * List of all locally-stored documents in instance
3310
+ * @see GET /v1/documents
3311
+ */
3312
+ async listDocuments() {
3313
+ return this.client.request("GET", `/v1/documents`);
3314
+ }
3315
+ /**
3316
+ * Get all documents stored in a specific folder.
3317
+ * @see GET /v1/documents/folder/{folderName}
3318
+ */
3319
+ async getFolder(folderName) {
3320
+ return this.client.request("GET", `/v1/documents/folder/${folderName}`);
3321
+ }
3322
+ /**
3323
+ * Check available filetypes and MIMEs that can be uploaded.
3324
+ * @see GET /v1/document/accepted-file-types
3325
+ */
3326
+ async listAcceptedFileTypes() {
3327
+ return this.client.request("GET", `/v1/document/accepted-file-types`);
3328
+ }
3329
+ /**
3330
+ * Get the known available metadata schema for when doing a raw-text upload and the acceptable type of value for each key.
3331
+ * @see GET /v1/document/metadata-schema
3332
+ */
3333
+ async getMetadataSchema() {
3334
+ return this.client.request("GET", `/v1/document/metadata-schema`);
3335
+ }
3336
+ /**
3337
+ * Get a single document by its unique RealTimeX document name
3338
+ * @see GET /v1/document/{docName}
3339
+ */
3340
+ async getDocument(docName) {
3341
+ return this.client.request("GET", `/v1/document/${docName}`);
3342
+ }
3343
+ /**
3344
+ * Create a new folder inside the documents storage directory.
3345
+ * @see POST /v1/document/create-folder
3346
+ */
3347
+ async createFolder(body) {
3348
+ return this.client.request("POST", `/v1/document/create-folder`, body);
3349
+ }
3350
+ /**
3351
+ * Remove a folder and all its contents from the documents storage directory.
3352
+ * @see DELETE /v1/document/remove-folder
3353
+ */
3354
+ async deleteRemoveFolder() {
3355
+ return this.client.request("DELETE", `/v1/document/remove-folder`);
3356
+ }
3357
+ /**
3358
+ * Move files within the documents storage directory.
3359
+ * @see POST /v1/document/move-files
3360
+ */
3361
+ async moveFiles(body) {
3362
+ return this.client.request("POST", `/v1/document/move-files`, body);
3363
+ }
3364
+ };
3365
+
3366
+ // src/v1/modules/v1Workspace.ts
3367
+ var V1WorkspaceModule = class {
3368
+ constructor(client) {
3369
+ this.client = client;
3370
+ }
3371
+ /**
3372
+ * Create a new workspace
3373
+ * @see POST /v1/workspace/new
3374
+ */
3375
+ async createWorkspace(body) {
3376
+ return this.client.request("POST", `/v1/workspace/new`, body);
3377
+ }
3378
+ /**
3379
+ * List all current workspaces
3380
+ * @see GET /v1/workspaces
3381
+ */
3382
+ async listWorkspaces() {
3383
+ return this.client.request("GET", `/v1/workspaces`);
3384
+ }
3385
+ /**
3386
+ * Get a workspace by its unique slug.
3387
+ * @see GET /v1/workspace/{slug}
3388
+ */
3389
+ async getWorkspace(slug) {
3390
+ return this.client.request("GET", `/v1/workspace/${slug}`);
3391
+ }
3392
+ /**
3393
+ * Deletes a workspace by its slug.
3394
+ * @see DELETE /v1/workspace/{slug}
3395
+ */
3396
+ async deleteWorkspace(slug) {
3397
+ return this.client.request("DELETE", `/v1/workspace/${slug}`);
3398
+ }
3399
+ /**
3400
+ * Update workspace settings by its unique slug.
3401
+ * @see POST /v1/workspace/{slug}/update
3402
+ */
3403
+ async updateWorkspace(slug, body) {
3404
+ return this.client.request("POST", `/v1/workspace/${slug}/update`, body);
3405
+ }
3406
+ /**
3407
+ * Get a workspaces chats regardless of user by its unique slug.
3408
+ * @see GET /v1/workspace/{slug}/chats
3409
+ */
3410
+ async listChats(slug) {
3411
+ return this.client.request("GET", `/v1/workspace/${slug}/chats`);
3412
+ }
3413
+ /**
3414
+ * Add or remove documents from a workspace by its unique slug.
3415
+ * @see POST /v1/workspace/{slug}/update-embeddings
3416
+ */
3417
+ async updateEmbeddings(slug, body) {
3418
+ return this.client.request("POST", `/v1/workspace/${slug}/update-embeddings`, body);
3419
+ }
3420
+ /**
3421
+ * Add or remove pin from a document in a workspace by its unique slug.
3422
+ * @see POST /v1/workspace/{slug}/update-pin
3423
+ */
3424
+ async updatePin(slug, body) {
3425
+ return this.client.request("POST", `/v1/workspace/${slug}/update-pin`, body);
3426
+ }
3427
+ /**
3428
+ * Execute a chat with a workspace
3429
+ * @see POST /v1/workspace/{slug}/chat
3430
+ */
3431
+ async chat(slug, body) {
3432
+ return this.client.request("POST", `/v1/workspace/${slug}/chat`, body);
3433
+ }
3434
+ /**
3435
+ * Execute a streamable chat with a workspace
3436
+ * @see POST /v1/workspace/{slug}/stream-chat
3437
+ */
3438
+ // @streaming-stub — implement SSE parsing in overrides/v1WorkspaceStreaming.ts
3439
+ async streamChat(slug, body) {
3440
+ return this.client.requestRaw("POST", `/v1/workspace/${slug}/stream-chat`, body);
3441
+ }
3442
+ /**
3443
+ * Perform a vector similarity search in a workspace
3444
+ * @see POST /v1/workspace/{slug}/vector-search
3445
+ */
3446
+ async vectorSearch(slug, body) {
3447
+ return this.client.request("POST", `/v1/workspace/${slug}/vector-search`, body);
3448
+ }
3449
+ };
3450
+
3451
+ // src/v1/modules/v1System.ts
3452
+ var V1SystemModule = class {
3453
+ constructor(client) {
3454
+ this.client = client;
3455
+ }
3456
+ /**
3457
+ * Dump all settings to file storage
3458
+ * @see GET /v1/system/env-dump
3459
+ */
3460
+ async getEnvDump() {
3461
+ return this.client.request("GET", `/v1/system/env-dump`);
3462
+ }
3463
+ /**
3464
+ * Get all current system settings that are defined.
3465
+ * @see GET /v1/system
3466
+ */
3467
+ async getSystem() {
3468
+ return this.client.request("GET", `/v1/system`);
3469
+ }
3470
+ /**
3471
+ * Number of all vectors in connected vector database
3472
+ * @see GET /v1/system/vector-count
3473
+ */
3474
+ async getVectorCount() {
3475
+ return this.client.request("GET", `/v1/system/vector-count`);
3476
+ }
3477
+ /**
3478
+ * Update a system setting or preference.
3479
+ * @see POST /v1/system/update-env
3480
+ */
3481
+ async updateEnv(body) {
3482
+ return this.client.request("POST", `/v1/system/update-env`, body);
3483
+ }
3484
+ /**
3485
+ * Export all of the chats from the system in a known format. Output depends on the type sent. Will be send with the correct header for the output.
3486
+ * @see GET /v1/system/export-chats
3487
+ */
3488
+ async listExportChats() {
3489
+ return this.client.request("GET", `/v1/system/export-chats`);
3490
+ }
3491
+ /**
3492
+ * Permanently remove documents from the system.
3493
+ * @see DELETE /v1/system/remove-documents
3494
+ */
3495
+ async deleteRemoveDocument() {
3496
+ return this.client.request("DELETE", `/v1/system/remove-documents`);
3497
+ }
3498
+ /**
3499
+ * Returns a health check object with server uptime and version.
3500
+ * @see GET /v1/system/health
3501
+ */
3502
+ async getHealth() {
3503
+ return this.client.request("GET", `/v1/system/health`);
3504
+ }
3505
+ /**
3506
+ * Returns a health check object with server uptime and version.
3507
+ * @see GET /v1/system/health-version-2
3508
+ */
3509
+ async getHealthVersion2() {
3510
+ return this.client.request("GET", `/v1/system/health-version-2`);
3511
+ }
3512
+ /**
3513
+ * Returns a health check object with server uptime and version.
3514
+ * @see GET /v1/system/health-version-3
3515
+ */
3516
+ async getHealthVersion3() {
3517
+ return this.client.request("GET", `/v1/system/health-version-3`);
3518
+ }
3519
+ };
3520
+
3521
+ // src/v1/modules/v1Thread.ts
3522
+ var V1ThreadModule = class {
3523
+ constructor(client) {
3524
+ this.client = client;
3525
+ }
3526
+ /**
3527
+ * Create a new workspace thread
3528
+ * @see POST /v1/workspace/{slug}/thread/new
3529
+ */
3530
+ async createThread(slug, body) {
3531
+ return this.client.request("POST", `/v1/workspace/${slug}/thread/new`, body);
3532
+ }
3533
+ /**
3534
+ * Update thread settings by its unique slug.
3535
+ * @see POST /v1/workspace/{slug}/thread/{threadSlug}/update
3536
+ */
3537
+ async updateThread(slug, threadSlug, body) {
3538
+ return this.client.request("POST", `/v1/workspace/${slug}/thread/${threadSlug}/update`, body);
3539
+ }
3540
+ /**
3541
+ * Delete a workspace thread
3542
+ * @see DELETE /v1/workspace/{slug}/thread/{threadSlug}
3543
+ */
3544
+ async deleteThread(slug, threadSlug) {
3545
+ return this.client.request("DELETE", `/v1/workspace/${slug}/thread/${threadSlug}`);
3546
+ }
3547
+ /**
3548
+ * Get chats for a workspace thread
3549
+ * @see GET /v1/workspace/{slug}/thread/{threadSlug}/chats
3550
+ */
3551
+ async listChats(slug, threadSlug) {
3552
+ return this.client.request("GET", `/v1/workspace/${slug}/thread/${threadSlug}/chats`);
3553
+ }
3554
+ /**
3555
+ * Chat with a workspace thread
3556
+ * @see POST /v1/workspace/{slug}/thread/{threadSlug}/chat
3557
+ */
3558
+ async chat(slug, threadSlug, body) {
3559
+ return this.client.request("POST", `/v1/workspace/${slug}/thread/${threadSlug}/chat`, body);
3560
+ }
3561
+ /**
3562
+ * Stream chat with a workspace thread
3563
+ * @see POST /v1/workspace/{slug}/thread/{threadSlug}/stream-chat
3564
+ */
3565
+ // @streaming-stub — implement SSE parsing in overrides/v1ThreadStreaming.ts
3566
+ async streamChat(slug, threadSlug, body) {
3567
+ return this.client.requestRaw("POST", `/v1/workspace/${slug}/thread/${threadSlug}/stream-chat`, body);
3568
+ }
3569
+ };
3570
+
3571
+ // src/v1/modules/v1Users.ts
3572
+ var V1UsersModule = class {
3573
+ constructor(client) {
3574
+ this.client = client;
3575
+ }
3576
+ /**
3577
+ * List all users
3578
+ * @see GET /v1/users
3579
+ */
3580
+ async listUsers() {
3581
+ return this.client.request("GET", `/v1/users`);
3582
+ }
3583
+ /**
3584
+ * Issue a temporary auth token for a user
3585
+ * @see GET /v1/users/{id}/issue-auth-token
3586
+ */
3587
+ async getIssueAuthToken(id) {
3588
+ return this.client.request("GET", `/v1/users/${id}/issue-auth-token`);
3589
+ }
3590
+ };
3591
+
3592
+ // src/v1/modules/v1OpenAI.ts
3593
+ var V1OpenAIModule = class {
3594
+ constructor(client) {
3595
+ this.client = client;
3596
+ }
3597
+ /**
3598
+ * Get all available "models" which are workspaces you can use for chatting.
3599
+ * @see GET /v1/openai/models
3600
+ */
3601
+ async listModels() {
3602
+ return this.client.request("GET", `/v1/openai/models`);
3603
+ }
3604
+ /**
3605
+ * Execute a chat with a workspace with OpenAI compatibility. Supports streaming as well. Model must be a workspace slug from /models.
3606
+ * @see POST /v1/openai/chat/completions
3607
+ */
3608
+ async chatCompletions(body) {
3609
+ return this.client.request("POST", `/v1/openai/chat/completions`, body);
3610
+ }
3611
+ /**
3612
+ * Get the embeddings of any arbitrary text string. This will use the embedder provider set in the system. Please ensure the token length of each string fits within the context of your embedder model.
3613
+ * @see POST /v1/openai/embeddings
3614
+ */
3615
+ async createEmbedding(body) {
3616
+ return this.client.request("POST", `/v1/openai/embeddings`, body);
3617
+ }
3618
+ /**
3619
+ * List all the vector database collections connected to RealTimeX. These are essentially workspaces but return their unique vector db identifier - this is the same as the workspace slug.
3620
+ * @see GET /v1/openai/vector_stores
3621
+ */
3622
+ async listVectorStores() {
3623
+ return this.client.request("GET", `/v1/openai/vector_stores`);
3624
+ }
3625
+ };
3626
+
3627
+ // src/v1/modules/v1Embed.ts
3628
+ var V1EmbedModule = class {
3629
+ constructor(client) {
3630
+ this.client = client;
3631
+ }
3632
+ /**
3633
+ * List all active embeds
3634
+ * @see GET /v1/embed
3635
+ */
3636
+ async getEmbed() {
3637
+ return this.client.request("GET", `/v1/embed`);
3638
+ }
3639
+ /**
3640
+ * Get all chats for a specific embed
3641
+ * @see GET /v1/embed/{embedUuid}/chats
3642
+ */
3643
+ async listChats(embedUuid) {
3644
+ return this.client.request("GET", `/v1/embed/${embedUuid}/chats`);
3645
+ }
3646
+ /**
3647
+ * Get chats for a specific embed and session
3648
+ * @see GET /v1/embed/{embedUuid}/chats/{sessionUuid}
3649
+ */
3650
+ async getChat(embedUuid, sessionUuid) {
3651
+ return this.client.request("GET", `/v1/embed/${embedUuid}/chats/${sessionUuid}`);
3652
+ }
3653
+ /**
3654
+ * Create a new embed configuration
3655
+ * @see POST /v1/embed/new
3656
+ */
3657
+ async createEmbed(body) {
3658
+ return this.client.request("POST", `/v1/embed/new`, body);
3659
+ }
3660
+ /**
3661
+ * Update an existing embed configuration
3662
+ * @see POST /v1/embed/{embedUuid}
3663
+ */
3664
+ async updateEmbed(embedUuid, body) {
3665
+ return this.client.request("POST", `/v1/embed/${embedUuid}`, body);
3666
+ }
3667
+ /**
3668
+ * Delete an existing embed configuration
3669
+ * @see DELETE /v1/embed/{embedUuid}
3670
+ */
3671
+ async deleteEmbed(embedUuid) {
3672
+ return this.client.request("DELETE", `/v1/embed/${embedUuid}`);
3673
+ }
3674
+ };
3675
+
3676
+ // src/v1/namespace.ts
3677
+ var V1ApiNamespace = class {
3678
+ // [GENERATED-PROPS-END]
3679
+ constructor(baseUrl, apiKey, appId) {
3680
+ this._client = new DeveloperApiClient(baseUrl, apiKey, appId);
3681
+ this.auth = new V1AuthModule(this._client);
3682
+ this.admin = new V1AdminModule(this._client);
3683
+ this.document = new V1DocumentModule(this._client);
3684
+ this.workspace = new V1WorkspaceModule(this._client);
3685
+ this.system = new V1SystemModule(this._client);
3686
+ this.thread = new V1ThreadModule(this._client);
3687
+ this.users = new V1UsersModule(this._client);
3688
+ this.openai = new V1OpenAIModule(this._client);
3689
+ this.embed = new V1EmbedModule(this._client);
3690
+ }
3691
+ };
3692
+
3039
3693
  // src/core/auth/AuthProvider.ts
3040
3694
  var StaticAuthProvider = class {
3041
3695
  constructor(options = {}) {
@@ -3734,6 +4388,7 @@ var _RealtimeXSDK = class _RealtimeXSDK {
3734
4388
  this.database = new DatabaseModule(this.realtimexUrl, this.appId, this.apiKey);
3735
4389
  this.auth = new AuthModule(this.realtimexUrl, this.appId, this.apiKey);
3736
4390
  this.credentials = new CredentialsModule(this.httpClient);
4391
+ this.v1 = this.apiKey || this.appId ? new V1ApiNamespace(this.realtimexUrl, this.apiKey ?? "", this.appId || void 0) : void 0;
3737
4392
  if (this.permissions.length > 0 && this.appId && !this.apiKey) {
3738
4393
  this.register().catch((err) => {
3739
4394
  console.error("[RealtimeX SDK] Auto-registration failed:", err.message);
@@ -3844,6 +4499,7 @@ var RealtimeXSDK = _RealtimeXSDK;
3844
4499
  AgentModule,
3845
4500
  ApiModule,
3846
4501
  AuthModule,
4502
+ AuthenticationError,
3847
4503
  CONTRACT_ATTEMPT_PREFIX,
3848
4504
  CONTRACT_EVENT_ID_HEADER,
3849
4505
  CONTRACT_SIGNATURE_ALGORITHM,
@@ -3858,12 +4514,15 @@ var RealtimeXSDK = _RealtimeXSDK;
3858
4514
  ContractRuntime,
3859
4515
  ContractValidationError,
3860
4516
  DatabaseModule,
4517
+ DeveloperApiClient,
4518
+ DeveloperApiError,
3861
4519
  GeminiToolAdapter,
3862
4520
  LLMModule,
3863
4521
  LLMPermissionError,
3864
4522
  LLMProviderError,
3865
4523
  LOCAL_APP_CONTRACT_VERSION,
3866
4524
  MCPModule,
4525
+ NotFoundError,
3867
4526
  PermissionDeniedError,
3868
4527
  PermissionRequiredError,
3869
4528
  PortModule,
@@ -3873,12 +4532,15 @@ var RealtimeXSDK = _RealtimeXSDK;
3873
4532
  STTModule,
3874
4533
  ScopeDeniedError,
3875
4534
  ScopeGuard,
4535
+ ServerError,
3876
4536
  StaticAuthProvider,
3877
4537
  TTSModule,
3878
4538
  TaskModule,
3879
4539
  ToolNotFoundError,
3880
4540
  ToolProjector,
3881
4541
  ToolValidationError,
4542
+ V1ApiNamespace,
4543
+ ValidationError,
3882
4544
  VectorStore,
3883
4545
  WebhookModule,
3884
4546
  buildContractIdempotencyKey,