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