agentbase-web-sdk 2.6.0-fix1 → 2.7.0-fix1

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/esm/sdk.js CHANGED
@@ -571,7 +571,7 @@ const JSONbig = {
571
571
  */
572
572
  class AgentbaseException extends Error {
573
573
  /**
574
- * Initializes a AppBase Exception.
574
+ * Initializes a Agentbase Exception.
575
575
  *
576
576
  * @param {string} message - The error message.
577
577
  * @param {number} code - The error code. Default is 0.
@@ -587,13 +587,6 @@ class AgentbaseException extends Error {
587
587
  this.response = response;
588
588
  }
589
589
  }
590
- /**
591
- * Client that handles requests to AppBase
592
- */
593
- function getResponseWarnings(headers) {
594
- var _a;
595
- return (_a = headers.get('x-appwrite-warning')) !== null && _a !== void 0 ? _a : headers.get('x-appbase-warning');
596
- }
597
590
  class Client {
598
591
  constructor() {
599
592
  /**
@@ -619,9 +612,9 @@ class Client {
619
612
  'x-sdk-name': 'Agentbase',
620
613
  'x-sdk-platform': 'client',
621
614
  'x-sdk-language': 'web',
622
- 'x-sdk-version': '2.6.0',
615
+ 'x-sdk-version': '2.7.0',
623
616
  'X-AppBase-SDK': 'true',
624
- 'X-Appwrite-Response-Format': '2.6.0',
617
+ 'X-Appwrite-Response-Format': '2.7.0',
625
618
  };
626
619
  this.realtime = {
627
620
  socket: undefined,
@@ -974,7 +967,7 @@ class Client {
974
967
  return this;
975
968
  }
976
969
  /**
977
- * Subscribes to AppBase events and passes you the payload in realtime.
970
+ * Subscribes to Agentbase events and passes you the payload in realtime.
978
971
  *
979
972
  * @deprecated Use the Realtime service instead.
980
973
  * @see Realtime
@@ -1164,7 +1157,7 @@ class Client {
1164
1157
  const uploadChunk = (chunk) => __awaiter(this, void 0, void 0, function* () {
1165
1158
  const chunkHeaders = Object.assign({}, headers);
1166
1159
  if (uploadId) {
1167
- chunkHeaders['x-appbase-id'] = uploadId;
1160
+ chunkHeaders['x-agentbase-id'] = uploadId;
1168
1161
  }
1169
1162
  chunkHeaders['content-range'] = `bytes ${chunk.start}-${chunk.end - 1}/${file.size}`;
1170
1163
  const chunkBlob = file.slice(chunk.start, chunk.end);
@@ -1240,7 +1233,7 @@ class Client {
1240
1233
  if (response.type === 'opaque') {
1241
1234
  throw new AgentbaseException(`Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`, 403, "forbidden", "");
1242
1235
  }
1243
- const warnings = getResponseWarnings(response.headers);
1236
+ const warnings = response.headers.get('x-agentbase-warning');
1244
1237
  if (warnings) {
1245
1238
  warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
1246
1239
  }
@@ -1267,7 +1260,7 @@ class Client {
1267
1260
  }
1268
1261
  const cookieFallback = response.headers.get('X-Fallback-Cookies');
1269
1262
  if (typeof window !== 'undefined' && window.localStorage && cookieFallback) {
1270
- window.console.warn('AppBase is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
1263
+ window.console.warn('Agentbase is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
1271
1264
  window.localStorage.setItem('cookieFallback', cookieFallback);
1272
1265
  }
1273
1266
  if (data && typeof data === 'object') {
@@ -3152,6 +3145,545 @@ class Account {
3152
3145
  }
3153
3146
  }
3154
3147
 
3148
+ class AgentRuntime {
3149
+ constructor(client) {
3150
+ this.client = client;
3151
+ }
3152
+ evaluateAgent(paramsOrFirst) {
3153
+ let params;
3154
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3155
+ params = (paramsOrFirst || {});
3156
+ }
3157
+ else {
3158
+ params = {
3159
+ agentId: paramsOrFirst
3160
+ };
3161
+ }
3162
+ const agentId = params.agentId;
3163
+ if (typeof agentId === 'undefined') {
3164
+ throw new AgentbaseException('Missing required parameter: "agentId"');
3165
+ }
3166
+ const apiPath = '/agent-runtime/agents/{agentId}/evaluations'.replace('{agentId}', agentId);
3167
+ const payload = {};
3168
+ const uri = new URL(this.client.config.endpoint + apiPath);
3169
+ const apiHeaders = {
3170
+ 'X-Appwrite-Project': this.client.config.project,
3171
+ 'content-type': 'application/json',
3172
+ };
3173
+ return this.client.call('post', uri, apiHeaders, payload);
3174
+ }
3175
+ createRun(paramsOrFirst, ...rest) {
3176
+ let params;
3177
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3178
+ params = (paramsOrFirst || {});
3179
+ }
3180
+ else {
3181
+ params = {
3182
+ agentId: paramsOrFirst,
3183
+ agentVersionId: rest[0],
3184
+ threadId: rest[1],
3185
+ userMessage: rest[2]
3186
+ };
3187
+ }
3188
+ const agentId = params.agentId;
3189
+ const agentVersionId = params.agentVersionId;
3190
+ const threadId = params.threadId;
3191
+ const userMessage = params.userMessage;
3192
+ if (typeof agentId === 'undefined') {
3193
+ throw new AgentbaseException('Missing required parameter: "agentId"');
3194
+ }
3195
+ if (typeof agentVersionId === 'undefined') {
3196
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3197
+ }
3198
+ if (typeof threadId === 'undefined') {
3199
+ throw new AgentbaseException('Missing required parameter: "threadId"');
3200
+ }
3201
+ if (typeof userMessage === 'undefined') {
3202
+ throw new AgentbaseException('Missing required parameter: "userMessage"');
3203
+ }
3204
+ const apiPath = '/agent-runtime/agents/{agentId}/runs'.replace('{agentId}', agentId);
3205
+ const payload = {};
3206
+ if (typeof agentVersionId !== 'undefined') {
3207
+ payload['agent_version_id'] = agentVersionId;
3208
+ }
3209
+ if (typeof threadId !== 'undefined') {
3210
+ payload['thread_id'] = threadId;
3211
+ }
3212
+ if (typeof userMessage !== 'undefined') {
3213
+ payload['user_message'] = userMessage;
3214
+ }
3215
+ const uri = new URL(this.client.config.endpoint + apiPath);
3216
+ const apiHeaders = {
3217
+ 'X-Appwrite-Project': this.client.config.project,
3218
+ 'content-type': 'application/json',
3219
+ };
3220
+ return this.client.call('post', uri, apiHeaders, payload);
3221
+ }
3222
+ listThreads(paramsOrFirst, ...rest) {
3223
+ let params;
3224
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3225
+ params = (paramsOrFirst || {});
3226
+ }
3227
+ else {
3228
+ params = {
3229
+ agentId: paramsOrFirst,
3230
+ agentVersionId: rest[0],
3231
+ limit: rest[1],
3232
+ after: rest[2]
3233
+ };
3234
+ }
3235
+ const agentId = params.agentId;
3236
+ const agentVersionId = params.agentVersionId;
3237
+ const limit = params.limit;
3238
+ const after = params.after;
3239
+ if (typeof agentId === 'undefined') {
3240
+ throw new AgentbaseException('Missing required parameter: "agentId"');
3241
+ }
3242
+ if (typeof agentVersionId === 'undefined') {
3243
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3244
+ }
3245
+ const apiPath = '/agent-runtime/agents/{agentId}/threads'.replace('{agentId}', agentId);
3246
+ const payload = {};
3247
+ if (typeof limit !== 'undefined') {
3248
+ payload['limit'] = limit;
3249
+ }
3250
+ if (typeof after !== 'undefined') {
3251
+ payload['after'] = after;
3252
+ }
3253
+ if (typeof agentVersionId !== 'undefined') {
3254
+ payload['agent_version_id'] = agentVersionId;
3255
+ }
3256
+ const uri = new URL(this.client.config.endpoint + apiPath);
3257
+ const apiHeaders = {
3258
+ 'X-Appwrite-Project': this.client.config.project,
3259
+ };
3260
+ return this.client.call('get', uri, apiHeaders, payload);
3261
+ }
3262
+ createThread(paramsOrFirst) {
3263
+ let params;
3264
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3265
+ params = (paramsOrFirst || {});
3266
+ }
3267
+ else {
3268
+ params = {
3269
+ agentId: paramsOrFirst
3270
+ };
3271
+ }
3272
+ const agentId = params.agentId;
3273
+ if (typeof agentId === 'undefined') {
3274
+ throw new AgentbaseException('Missing required parameter: "agentId"');
3275
+ }
3276
+ const apiPath = '/agent-runtime/agents/{agentId}/threads'.replace('{agentId}', agentId);
3277
+ const payload = {};
3278
+ const uri = new URL(this.client.config.endpoint + apiPath);
3279
+ const apiHeaders = {
3280
+ 'X-Appwrite-Project': this.client.config.project,
3281
+ 'content-type': 'application/json',
3282
+ };
3283
+ return this.client.call('post', uri, apiHeaders, payload);
3284
+ }
3285
+ getThread(paramsOrFirst, ...rest) {
3286
+ let params;
3287
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3288
+ params = (paramsOrFirst || {});
3289
+ }
3290
+ else {
3291
+ params = {
3292
+ agentId: paramsOrFirst,
3293
+ threadId: rest[0],
3294
+ agentVersionId: rest[1]
3295
+ };
3296
+ }
3297
+ const agentId = params.agentId;
3298
+ const threadId = params.threadId;
3299
+ const agentVersionId = params.agentVersionId;
3300
+ if (typeof agentId === 'undefined') {
3301
+ throw new AgentbaseException('Missing required parameter: "agentId"');
3302
+ }
3303
+ if (typeof threadId === 'undefined') {
3304
+ throw new AgentbaseException('Missing required parameter: "threadId"');
3305
+ }
3306
+ if (typeof agentVersionId === 'undefined') {
3307
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3308
+ }
3309
+ const apiPath = '/agent-runtime/agents/{agentId}/threads/{threadId}'.replace('{agentId}', agentId).replace('{threadId}', threadId);
3310
+ const payload = {};
3311
+ if (typeof agentVersionId !== 'undefined') {
3312
+ payload['agent_version_id'] = agentVersionId;
3313
+ }
3314
+ const uri = new URL(this.client.config.endpoint + apiPath);
3315
+ const apiHeaders = {
3316
+ 'X-Appwrite-Project': this.client.config.project,
3317
+ };
3318
+ return this.client.call('get', uri, apiHeaders, payload);
3319
+ }
3320
+ deleteThread(paramsOrFirst, ...rest) {
3321
+ let params;
3322
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3323
+ params = (paramsOrFirst || {});
3324
+ }
3325
+ else {
3326
+ params = {
3327
+ agentId: paramsOrFirst,
3328
+ threadId: rest[0],
3329
+ agentVersionId: rest[1]
3330
+ };
3331
+ }
3332
+ const agentId = params.agentId;
3333
+ const threadId = params.threadId;
3334
+ const agentVersionId = params.agentVersionId;
3335
+ if (typeof agentId === 'undefined') {
3336
+ throw new AgentbaseException('Missing required parameter: "agentId"');
3337
+ }
3338
+ if (typeof threadId === 'undefined') {
3339
+ throw new AgentbaseException('Missing required parameter: "threadId"');
3340
+ }
3341
+ if (typeof agentVersionId === 'undefined') {
3342
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3343
+ }
3344
+ const apiPath = '/agent-runtime/agents/{agentId}/threads/{threadId}'.replace('{agentId}', agentId).replace('{threadId}', threadId);
3345
+ const payload = {};
3346
+ if (typeof agentVersionId !== 'undefined') {
3347
+ payload['agent_version_id'] = agentVersionId;
3348
+ }
3349
+ const uri = new URL(this.client.config.endpoint + apiPath);
3350
+ const apiHeaders = {
3351
+ 'X-Appwrite-Project': this.client.config.project,
3352
+ 'content-type': 'application/json',
3353
+ };
3354
+ return this.client.call('delete', uri, apiHeaders, payload);
3355
+ }
3356
+ listContextCompactions(paramsOrFirst, ...rest) {
3357
+ let params;
3358
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3359
+ params = (paramsOrFirst || {});
3360
+ }
3361
+ else {
3362
+ params = {
3363
+ agentId: paramsOrFirst,
3364
+ threadId: rest[0],
3365
+ agentVersionId: rest[1],
3366
+ limit: rest[2],
3367
+ after: rest[3]
3368
+ };
3369
+ }
3370
+ const agentId = params.agentId;
3371
+ const threadId = params.threadId;
3372
+ const agentVersionId = params.agentVersionId;
3373
+ const limit = params.limit;
3374
+ const after = params.after;
3375
+ if (typeof agentId === 'undefined') {
3376
+ throw new AgentbaseException('Missing required parameter: "agentId"');
3377
+ }
3378
+ if (typeof threadId === 'undefined') {
3379
+ throw new AgentbaseException('Missing required parameter: "threadId"');
3380
+ }
3381
+ if (typeof agentVersionId === 'undefined') {
3382
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3383
+ }
3384
+ const apiPath = '/agent-runtime/agents/{agentId}/threads/{threadId}/context-compactions'.replace('{agentId}', agentId).replace('{threadId}', threadId);
3385
+ const payload = {};
3386
+ if (typeof limit !== 'undefined') {
3387
+ payload['limit'] = limit;
3388
+ }
3389
+ if (typeof after !== 'undefined') {
3390
+ payload['after'] = after;
3391
+ }
3392
+ if (typeof agentVersionId !== 'undefined') {
3393
+ payload['agent_version_id'] = agentVersionId;
3394
+ }
3395
+ const uri = new URL(this.client.config.endpoint + apiPath);
3396
+ const apiHeaders = {
3397
+ 'X-Appwrite-Project': this.client.config.project,
3398
+ };
3399
+ return this.client.call('get', uri, apiHeaders, payload);
3400
+ }
3401
+ listThreadMessages(paramsOrFirst, ...rest) {
3402
+ let params;
3403
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3404
+ params = (paramsOrFirst || {});
3405
+ }
3406
+ else {
3407
+ params = {
3408
+ agentId: paramsOrFirst,
3409
+ threadId: rest[0],
3410
+ agentVersionId: rest[1],
3411
+ limit: rest[2],
3412
+ after: rest[3]
3413
+ };
3414
+ }
3415
+ const agentId = params.agentId;
3416
+ const threadId = params.threadId;
3417
+ const agentVersionId = params.agentVersionId;
3418
+ const limit = params.limit;
3419
+ const after = params.after;
3420
+ if (typeof agentId === 'undefined') {
3421
+ throw new AgentbaseException('Missing required parameter: "agentId"');
3422
+ }
3423
+ if (typeof threadId === 'undefined') {
3424
+ throw new AgentbaseException('Missing required parameter: "threadId"');
3425
+ }
3426
+ if (typeof agentVersionId === 'undefined') {
3427
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3428
+ }
3429
+ const apiPath = '/agent-runtime/agents/{agentId}/threads/{threadId}/messages'.replace('{agentId}', agentId).replace('{threadId}', threadId);
3430
+ const payload = {};
3431
+ if (typeof limit !== 'undefined') {
3432
+ payload['limit'] = limit;
3433
+ }
3434
+ if (typeof after !== 'undefined') {
3435
+ payload['after'] = after;
3436
+ }
3437
+ if (typeof agentVersionId !== 'undefined') {
3438
+ payload['agent_version_id'] = agentVersionId;
3439
+ }
3440
+ const uri = new URL(this.client.config.endpoint + apiPath);
3441
+ const apiHeaders = {
3442
+ 'X-Appwrite-Project': this.client.config.project,
3443
+ };
3444
+ return this.client.call('get', uri, apiHeaders, payload);
3445
+ }
3446
+ getRun(paramsOrFirst, ...rest) {
3447
+ let params;
3448
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3449
+ params = (paramsOrFirst || {});
3450
+ }
3451
+ else {
3452
+ params = {
3453
+ runId: paramsOrFirst,
3454
+ agentVersionId: rest[0]
3455
+ };
3456
+ }
3457
+ const runId = params.runId;
3458
+ const agentVersionId = params.agentVersionId;
3459
+ if (typeof runId === 'undefined') {
3460
+ throw new AgentbaseException('Missing required parameter: "runId"');
3461
+ }
3462
+ if (typeof agentVersionId === 'undefined') {
3463
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3464
+ }
3465
+ const apiPath = '/agent-runtime/runs/{runId}'.replace('{runId}', runId);
3466
+ const payload = {};
3467
+ if (typeof agentVersionId !== 'undefined') {
3468
+ payload['agent_version_id'] = agentVersionId;
3469
+ }
3470
+ const uri = new URL(this.client.config.endpoint + apiPath);
3471
+ const apiHeaders = {
3472
+ 'X-Appwrite-Project': this.client.config.project,
3473
+ };
3474
+ return this.client.call('get', uri, apiHeaders, payload);
3475
+ }
3476
+ cancelRun(paramsOrFirst, ...rest) {
3477
+ let params;
3478
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3479
+ params = (paramsOrFirst || {});
3480
+ }
3481
+ else {
3482
+ params = {
3483
+ runId: paramsOrFirst,
3484
+ agentVersionId: rest[0]
3485
+ };
3486
+ }
3487
+ const runId = params.runId;
3488
+ const agentVersionId = params.agentVersionId;
3489
+ if (typeof runId === 'undefined') {
3490
+ throw new AgentbaseException('Missing required parameter: "runId"');
3491
+ }
3492
+ if (typeof agentVersionId === 'undefined') {
3493
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3494
+ }
3495
+ const apiPath = '/agent-runtime/runs/{runId}/cancel'.replace('{runId}', runId);
3496
+ const payload = {};
3497
+ if (typeof agentVersionId !== 'undefined') {
3498
+ payload['agent_version_id'] = agentVersionId;
3499
+ }
3500
+ const uri = new URL(this.client.config.endpoint + apiPath);
3501
+ const apiHeaders = {
3502
+ 'X-Appwrite-Project': this.client.config.project,
3503
+ 'content-type': 'application/json',
3504
+ };
3505
+ return this.client.call('post', uri, apiHeaders, payload);
3506
+ }
3507
+ streamRunEvents(paramsOrFirst, ...rest) {
3508
+ let params;
3509
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3510
+ params = (paramsOrFirst || {});
3511
+ }
3512
+ else {
3513
+ params = {
3514
+ runId: paramsOrFirst,
3515
+ agentVersionId: rest[0]
3516
+ };
3517
+ }
3518
+ const runId = params.runId;
3519
+ const agentVersionId = params.agentVersionId;
3520
+ if (typeof runId === 'undefined') {
3521
+ throw new AgentbaseException('Missing required parameter: "runId"');
3522
+ }
3523
+ if (typeof agentVersionId === 'undefined') {
3524
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3525
+ }
3526
+ const apiPath = '/agent-runtime/runs/{runId}/events'.replace('{runId}', runId);
3527
+ const payload = {};
3528
+ if (typeof agentVersionId !== 'undefined') {
3529
+ payload['agent_version_id'] = agentVersionId;
3530
+ }
3531
+ const uri = new URL(this.client.config.endpoint + apiPath);
3532
+ const apiHeaders = {
3533
+ 'X-Appwrite-Project': this.client.config.project,
3534
+ };
3535
+ return this.client.call('get', uri, apiHeaders, payload);
3536
+ }
3537
+ listRunMessages(paramsOrFirst, ...rest) {
3538
+ let params;
3539
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3540
+ params = (paramsOrFirst || {});
3541
+ }
3542
+ else {
3543
+ params = {
3544
+ runId: paramsOrFirst,
3545
+ agentVersionId: rest[0],
3546
+ limit: rest[1],
3547
+ after: rest[2]
3548
+ };
3549
+ }
3550
+ const runId = params.runId;
3551
+ const agentVersionId = params.agentVersionId;
3552
+ const limit = params.limit;
3553
+ const after = params.after;
3554
+ if (typeof runId === 'undefined') {
3555
+ throw new AgentbaseException('Missing required parameter: "runId"');
3556
+ }
3557
+ if (typeof agentVersionId === 'undefined') {
3558
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3559
+ }
3560
+ const apiPath = '/agent-runtime/runs/{runId}/messages'.replace('{runId}', runId);
3561
+ const payload = {};
3562
+ if (typeof limit !== 'undefined') {
3563
+ payload['limit'] = limit;
3564
+ }
3565
+ if (typeof after !== 'undefined') {
3566
+ payload['after'] = after;
3567
+ }
3568
+ if (typeof agentVersionId !== 'undefined') {
3569
+ payload['agent_version_id'] = agentVersionId;
3570
+ }
3571
+ const uri = new URL(this.client.config.endpoint + apiPath);
3572
+ const apiHeaders = {
3573
+ 'X-Appwrite-Project': this.client.config.project,
3574
+ };
3575
+ return this.client.call('get', uri, apiHeaders, payload);
3576
+ }
3577
+ listModelInvocations(paramsOrFirst, ...rest) {
3578
+ let params;
3579
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3580
+ params = (paramsOrFirst || {});
3581
+ }
3582
+ else {
3583
+ params = {
3584
+ runId: paramsOrFirst,
3585
+ agentVersionId: rest[0],
3586
+ limit: rest[1],
3587
+ after: rest[2]
3588
+ };
3589
+ }
3590
+ const runId = params.runId;
3591
+ const agentVersionId = params.agentVersionId;
3592
+ const limit = params.limit;
3593
+ const after = params.after;
3594
+ if (typeof runId === 'undefined') {
3595
+ throw new AgentbaseException('Missing required parameter: "runId"');
3596
+ }
3597
+ if (typeof agentVersionId === 'undefined') {
3598
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3599
+ }
3600
+ const apiPath = '/agent-runtime/runs/{runId}/model-invocations'.replace('{runId}', runId);
3601
+ const payload = {};
3602
+ if (typeof limit !== 'undefined') {
3603
+ payload['limit'] = limit;
3604
+ }
3605
+ if (typeof after !== 'undefined') {
3606
+ payload['after'] = after;
3607
+ }
3608
+ if (typeof agentVersionId !== 'undefined') {
3609
+ payload['agent_version_id'] = agentVersionId;
3610
+ }
3611
+ const uri = new URL(this.client.config.endpoint + apiPath);
3612
+ const apiHeaders = {
3613
+ 'X-Appwrite-Project': this.client.config.project,
3614
+ };
3615
+ return this.client.call('get', uri, apiHeaders, payload);
3616
+ }
3617
+ submitToolMessage(paramsOrFirst, ...rest) {
3618
+ let params;
3619
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3620
+ params = (paramsOrFirst || {});
3621
+ }
3622
+ else {
3623
+ params = {
3624
+ runId: paramsOrFirst,
3625
+ agentVersionId: rest[0],
3626
+ id: rest[1],
3627
+ role: rest[2],
3628
+ toolCallId: rest[3],
3629
+ content: rest[4],
3630
+ error: rest[5]
3631
+ };
3632
+ }
3633
+ const runId = params.runId;
3634
+ const agentVersionId = params.agentVersionId;
3635
+ const id = params.id;
3636
+ const role = params.role;
3637
+ const toolCallId = params.toolCallId;
3638
+ const content = params.content;
3639
+ const error = params.error;
3640
+ if (typeof runId === 'undefined') {
3641
+ throw new AgentbaseException('Missing required parameter: "runId"');
3642
+ }
3643
+ if (typeof agentVersionId === 'undefined') {
3644
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
3645
+ }
3646
+ if (typeof id === 'undefined') {
3647
+ throw new AgentbaseException('Missing required parameter: "id"');
3648
+ }
3649
+ if (typeof role === 'undefined') {
3650
+ throw new AgentbaseException('Missing required parameter: "role"');
3651
+ }
3652
+ if (typeof toolCallId === 'undefined') {
3653
+ throw new AgentbaseException('Missing required parameter: "toolCallId"');
3654
+ }
3655
+ if (typeof content === 'undefined') {
3656
+ throw new AgentbaseException('Missing required parameter: "content"');
3657
+ }
3658
+ const apiPath = '/agent-runtime/runs/{runId}/tool-messages'.replace('{runId}', runId);
3659
+ const payload = {};
3660
+ if (typeof agentVersionId !== 'undefined') {
3661
+ payload['agent_version_id'] = agentVersionId;
3662
+ }
3663
+ if (typeof id !== 'undefined') {
3664
+ payload['id'] = id;
3665
+ }
3666
+ if (typeof role !== 'undefined') {
3667
+ payload['role'] = role;
3668
+ }
3669
+ if (typeof toolCallId !== 'undefined') {
3670
+ payload['toolCallId'] = toolCallId;
3671
+ }
3672
+ if (typeof content !== 'undefined') {
3673
+ payload['content'] = content;
3674
+ }
3675
+ if (typeof error !== 'undefined') {
3676
+ payload['error'] = error;
3677
+ }
3678
+ const uri = new URL(this.client.config.endpoint + apiPath);
3679
+ const apiHeaders = {
3680
+ 'X-Appwrite-Project': this.client.config.project,
3681
+ 'content-type': 'application/json',
3682
+ };
3683
+ return this.client.call('post', uri, apiHeaders, payload);
3684
+ }
3685
+ }
3686
+
3155
3687
  class AiGateway {
3156
3688
  constructor(client) {
3157
3689
  this.client = client;
@@ -3290,7 +3822,8 @@ class AiGateway {
3290
3822
  allowedTools: rest[3],
3291
3823
  allowedAgents: rest[4],
3292
3824
  defaultLogicalModel: rest[5],
3293
- principal: rest[6]
3825
+ principal: rest[6],
3826
+ limits: rest[7]
3294
3827
  };
3295
3828
  }
3296
3829
  const name = params.name;
@@ -3301,6 +3834,7 @@ class AiGateway {
3301
3834
  const allowedAgents = params.allowedAgents;
3302
3835
  const defaultLogicalModel = params.defaultLogicalModel;
3303
3836
  const principal = params.principal;
3837
+ const limits = params.limits;
3304
3838
  if (typeof name === 'undefined') {
3305
3839
  throw new AgentbaseException('Missing required parameter: "name"');
3306
3840
  }
@@ -3333,6 +3867,9 @@ class AiGateway {
3333
3867
  if (typeof principal !== 'undefined') {
3334
3868
  payload['principal'] = principal;
3335
3869
  }
3870
+ if (typeof limits !== 'undefined') {
3871
+ payload['limits'] = limits;
3872
+ }
3336
3873
  const uri = new URL(this.client.config.endpoint + apiPath);
3337
3874
  const apiHeaders = {
3338
3875
  'X-Appwrite-Project': this.client.config.project,
@@ -6590,12 +7127,13 @@ class Memory {
6590
7127
  messages: rest[4],
6591
7128
  agentId: rest[5],
6592
7129
  runId: rest[6],
6593
- sensitivity: rest[7],
6594
- handlingPolicy: rest[8],
6595
- metadata: rest[9],
6596
- infer: rest[10],
6597
- reRemember: rest[11],
6598
- async: rest[12]
7130
+ sessionId: rest[7],
7131
+ sensitivity: rest[8],
7132
+ handlingPolicy: rest[9],
7133
+ metadata: rest[10],
7134
+ infer: rest[11],
7135
+ reRemember: rest[12],
7136
+ async: rest[13]
6599
7137
  };
6600
7138
  }
6601
7139
  const userId = params.userId;
@@ -6606,6 +7144,7 @@ class Memory {
6606
7144
  const messages = params.messages;
6607
7145
  const agentId = params.agentId;
6608
7146
  const runId = params.runId;
7147
+ const sessionId = params.sessionId;
6609
7148
  const sensitivity = params.sensitivity;
6610
7149
  const handlingPolicy = params.handlingPolicy;
6611
7150
  const metadata = params.metadata;
@@ -6641,6 +7180,9 @@ class Memory {
6641
7180
  if (typeof runId !== 'undefined') {
6642
7181
  payload['runId'] = runId;
6643
7182
  }
7183
+ if (typeof sessionId !== 'undefined') {
7184
+ payload['sessionId'] = sessionId;
7185
+ }
6644
7186
  if (typeof scope !== 'undefined') {
6645
7187
  payload['scope'] = scope;
6646
7188
  }
@@ -13263,7 +13805,6 @@ var Timezone;
13263
13805
  Timezone["AsiaBaku"] = "asia/baku";
13264
13806
  Timezone["AsiaBangkok"] = "asia/bangkok";
13265
13807
  Timezone["AsiaBarnaul"] = "asia/barnaul";
13266
- Timezone["AsiaBeijing"] = "asia/beijing";
13267
13808
  Timezone["AsiaBeirut"] = "asia/beirut";
13268
13809
  Timezone["AsiaBishkek"] = "asia/bishkek";
13269
13810
  Timezone["AsiaBrunei"] = "asia/brunei";
@@ -13801,5 +14342,5 @@ var KnowledgeBaseDataSourceDocumentImportResultStatus;
13801
14342
  KnowledgeBaseDataSourceDocumentImportResultStatus["Failed"] = "failed";
13802
14343
  })(KnowledgeBaseDataSourceDocumentImportResultStatus || (KnowledgeBaseDataSourceDocumentImportResultStatus = {}));
13803
14344
 
13804
- export { Account, AgentbaseException, AiGateway, AuthenticationFactor, AuthenticatorType, Avatars, Browser, BrowserPermission, Channel, Client, Condition, CreditCard, Databases, DistillationMessageRole, DistillationMode, DistillationToolStatus, DocumentsDB, ExecutionMethod, ExecutionStatus, ExecutionTrigger, ExportJobMode, ExportMode, FeedbackType, Flag, Format, Functions, Graphql, ID, ImageFormat, ImageGravity, Kind, Kinds, KnowledgeBaseDataSourceDocumentImportResultStatus, KnowledgeBases, LlmGateway, Locale, Memory, MemoryAccessMode, MemoryBatchOperation, MemoryBulkDeleteItemStatus, MemoryBulkDeleteResponseStatus, MemoryHandlingPolicy, MemoryMessageRole, MemoryRecordKind, MemoryRecordSensitivity, MemoryScope, MemorySensitivity, MemoryShareSubjectType, Messaging, OAuthProvider, Operator, OrganizationProjectDeletionDeletionStatus, OrganizationRole, OrganizationUsageRange, Outcome, Permission, ProfileExtractionMode, ProfileType, ProjectDeletionRestoreStatus, ProjectDeletionResultDeletionStatus, ProjectDeletionResultStatus, Projects, Query, Realtime, RecordKind, RetentionPolicy, Role, Scope, SelfHostedOrganizations, SourceType, Status, Storage, TablesDB, Teams, Theme, Timezone, TransactionAction, ValidationStatus, VectorsDB, VerificationSource };
14345
+ export { Account, AgentRuntime, AgentbaseException, AiGateway, AuthenticationFactor, AuthenticatorType, Avatars, Browser, BrowserPermission, Channel, Client, Condition, CreditCard, Databases, DistillationMessageRole, DistillationMode, DistillationToolStatus, DocumentsDB, ExecutionMethod, ExecutionStatus, ExecutionTrigger, ExportJobMode, ExportMode, FeedbackType, Flag, Format, Functions, Graphql, ID, ImageFormat, ImageGravity, Kind, Kinds, KnowledgeBaseDataSourceDocumentImportResultStatus, KnowledgeBases, LlmGateway, Locale, Memory, MemoryAccessMode, MemoryBatchOperation, MemoryBulkDeleteItemStatus, MemoryBulkDeleteResponseStatus, MemoryHandlingPolicy, MemoryMessageRole, MemoryRecordKind, MemoryRecordSensitivity, MemoryScope, MemorySensitivity, MemoryShareSubjectType, Messaging, OAuthProvider, Operator, OrganizationProjectDeletionDeletionStatus, OrganizationRole, OrganizationUsageRange, Outcome, Permission, ProfileExtractionMode, ProfileType, ProjectDeletionRestoreStatus, ProjectDeletionResultDeletionStatus, ProjectDeletionResultStatus, Projects, Query, Realtime, RecordKind, RetentionPolicy, Role, Scope, SelfHostedOrganizations, SourceType, Status, Storage, TablesDB, Teams, Theme, Timezone, TransactionAction, ValidationStatus, VectorsDB, VerificationSource };
13805
14346
  //# sourceMappingURL=sdk.js.map