agentbase-web-sdk 2.6.0-fix1 → 2.7.0

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/iife/sdk.js CHANGED
@@ -4371,7 +4371,7 @@
4371
4371
  */
4372
4372
  class AgentbaseException extends Error {
4373
4373
  /**
4374
- * Initializes a AppBase Exception.
4374
+ * Initializes a Agentbase Exception.
4375
4375
  *
4376
4376
  * @param {string} message - The error message.
4377
4377
  * @param {number} code - The error code. Default is 0.
@@ -4387,13 +4387,6 @@
4387
4387
  this.response = response;
4388
4388
  }
4389
4389
  }
4390
- /**
4391
- * Client that handles requests to AppBase
4392
- */
4393
- function getResponseWarnings(headers) {
4394
- var _a;
4395
- return (_a = headers.get('x-appwrite-warning')) !== null && _a !== void 0 ? _a : headers.get('x-appbase-warning');
4396
- }
4397
4390
  class Client {
4398
4391
  constructor() {
4399
4392
  /**
@@ -4419,9 +4412,9 @@
4419
4412
  'x-sdk-name': 'Agentbase',
4420
4413
  'x-sdk-platform': 'client',
4421
4414
  'x-sdk-language': 'web',
4422
- 'x-sdk-version': '2.6.0',
4415
+ 'x-sdk-version': '2.7.0',
4423
4416
  'X-AppBase-SDK': 'true',
4424
- 'X-Appwrite-Response-Format': '2.6.0',
4417
+ 'X-Appwrite-Response-Format': '2.7.0',
4425
4418
  };
4426
4419
  this.realtime = {
4427
4420
  socket: undefined,
@@ -4774,7 +4767,7 @@
4774
4767
  return this;
4775
4768
  }
4776
4769
  /**
4777
- * Subscribes to AppBase events and passes you the payload in realtime.
4770
+ * Subscribes to Agentbase events and passes you the payload in realtime.
4778
4771
  *
4779
4772
  * @deprecated Use the Realtime service instead.
4780
4773
  * @see Realtime
@@ -4964,7 +4957,7 @@
4964
4957
  const uploadChunk = (chunk) => __awaiter(this, void 0, void 0, function* () {
4965
4958
  const chunkHeaders = Object.assign({}, headers);
4966
4959
  if (uploadId) {
4967
- chunkHeaders['x-appbase-id'] = uploadId;
4960
+ chunkHeaders['x-agentbase-id'] = uploadId;
4968
4961
  }
4969
4962
  chunkHeaders['content-range'] = `bytes ${chunk.start}-${chunk.end - 1}/${file.size}`;
4970
4963
  const chunkBlob = file.slice(chunk.start, chunk.end);
@@ -5040,7 +5033,7 @@
5040
5033
  if (response.type === 'opaque') {
5041
5034
  throw new AgentbaseException(`Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`, 403, "forbidden", "");
5042
5035
  }
5043
- const warnings = getResponseWarnings(response.headers);
5036
+ const warnings = response.headers.get('x-agentbase-warning');
5044
5037
  if (warnings) {
5045
5038
  warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
5046
5039
  }
@@ -5067,7 +5060,7 @@
5067
5060
  }
5068
5061
  const cookieFallback = response.headers.get('X-Fallback-Cookies');
5069
5062
  if (typeof window !== 'undefined' && window.localStorage && cookieFallback) {
5070
- window.console.warn('AppBase is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
5063
+ window.console.warn('Agentbase is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
5071
5064
  window.localStorage.setItem('cookieFallback', cookieFallback);
5072
5065
  }
5073
5066
  if (data && typeof data === 'object') {
@@ -6952,6 +6945,545 @@
6952
6945
  }
6953
6946
  }
6954
6947
 
6948
+ class AgentRuntime {
6949
+ constructor(client) {
6950
+ this.client = client;
6951
+ }
6952
+ evaluateAgent(paramsOrFirst) {
6953
+ let params;
6954
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
6955
+ params = (paramsOrFirst || {});
6956
+ }
6957
+ else {
6958
+ params = {
6959
+ agentId: paramsOrFirst
6960
+ };
6961
+ }
6962
+ const agentId = params.agentId;
6963
+ if (typeof agentId === 'undefined') {
6964
+ throw new AgentbaseException('Missing required parameter: "agentId"');
6965
+ }
6966
+ const apiPath = '/agent-runtime/agents/{agentId}/evaluations'.replace('{agentId}', agentId);
6967
+ const payload = {};
6968
+ const uri = new URL(this.client.config.endpoint + apiPath);
6969
+ const apiHeaders = {
6970
+ 'X-Appwrite-Project': this.client.config.project,
6971
+ 'content-type': 'application/json',
6972
+ };
6973
+ return this.client.call('post', uri, apiHeaders, payload);
6974
+ }
6975
+ createRun(paramsOrFirst, ...rest) {
6976
+ let params;
6977
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
6978
+ params = (paramsOrFirst || {});
6979
+ }
6980
+ else {
6981
+ params = {
6982
+ agentId: paramsOrFirst,
6983
+ agentVersionId: rest[0],
6984
+ threadId: rest[1],
6985
+ userMessage: rest[2]
6986
+ };
6987
+ }
6988
+ const agentId = params.agentId;
6989
+ const agentVersionId = params.agentVersionId;
6990
+ const threadId = params.threadId;
6991
+ const userMessage = params.userMessage;
6992
+ if (typeof agentId === 'undefined') {
6993
+ throw new AgentbaseException('Missing required parameter: "agentId"');
6994
+ }
6995
+ if (typeof agentVersionId === 'undefined') {
6996
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
6997
+ }
6998
+ if (typeof threadId === 'undefined') {
6999
+ throw new AgentbaseException('Missing required parameter: "threadId"');
7000
+ }
7001
+ if (typeof userMessage === 'undefined') {
7002
+ throw new AgentbaseException('Missing required parameter: "userMessage"');
7003
+ }
7004
+ const apiPath = '/agent-runtime/agents/{agentId}/runs'.replace('{agentId}', agentId);
7005
+ const payload = {};
7006
+ if (typeof agentVersionId !== 'undefined') {
7007
+ payload['agent_version_id'] = agentVersionId;
7008
+ }
7009
+ if (typeof threadId !== 'undefined') {
7010
+ payload['thread_id'] = threadId;
7011
+ }
7012
+ if (typeof userMessage !== 'undefined') {
7013
+ payload['user_message'] = userMessage;
7014
+ }
7015
+ const uri = new URL(this.client.config.endpoint + apiPath);
7016
+ const apiHeaders = {
7017
+ 'X-Appwrite-Project': this.client.config.project,
7018
+ 'content-type': 'application/json',
7019
+ };
7020
+ return this.client.call('post', uri, apiHeaders, payload);
7021
+ }
7022
+ listThreads(paramsOrFirst, ...rest) {
7023
+ let params;
7024
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7025
+ params = (paramsOrFirst || {});
7026
+ }
7027
+ else {
7028
+ params = {
7029
+ agentId: paramsOrFirst,
7030
+ agentVersionId: rest[0],
7031
+ limit: rest[1],
7032
+ after: rest[2]
7033
+ };
7034
+ }
7035
+ const agentId = params.agentId;
7036
+ const agentVersionId = params.agentVersionId;
7037
+ const limit = params.limit;
7038
+ const after = params.after;
7039
+ if (typeof agentId === 'undefined') {
7040
+ throw new AgentbaseException('Missing required parameter: "agentId"');
7041
+ }
7042
+ if (typeof agentVersionId === 'undefined') {
7043
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7044
+ }
7045
+ const apiPath = '/agent-runtime/agents/{agentId}/threads'.replace('{agentId}', agentId);
7046
+ const payload = {};
7047
+ if (typeof limit !== 'undefined') {
7048
+ payload['limit'] = limit;
7049
+ }
7050
+ if (typeof after !== 'undefined') {
7051
+ payload['after'] = after;
7052
+ }
7053
+ if (typeof agentVersionId !== 'undefined') {
7054
+ payload['agent_version_id'] = agentVersionId;
7055
+ }
7056
+ const uri = new URL(this.client.config.endpoint + apiPath);
7057
+ const apiHeaders = {
7058
+ 'X-Appwrite-Project': this.client.config.project,
7059
+ };
7060
+ return this.client.call('get', uri, apiHeaders, payload);
7061
+ }
7062
+ createThread(paramsOrFirst) {
7063
+ let params;
7064
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7065
+ params = (paramsOrFirst || {});
7066
+ }
7067
+ else {
7068
+ params = {
7069
+ agentId: paramsOrFirst
7070
+ };
7071
+ }
7072
+ const agentId = params.agentId;
7073
+ if (typeof agentId === 'undefined') {
7074
+ throw new AgentbaseException('Missing required parameter: "agentId"');
7075
+ }
7076
+ const apiPath = '/agent-runtime/agents/{agentId}/threads'.replace('{agentId}', agentId);
7077
+ const payload = {};
7078
+ const uri = new URL(this.client.config.endpoint + apiPath);
7079
+ const apiHeaders = {
7080
+ 'X-Appwrite-Project': this.client.config.project,
7081
+ 'content-type': 'application/json',
7082
+ };
7083
+ return this.client.call('post', uri, apiHeaders, payload);
7084
+ }
7085
+ getThread(paramsOrFirst, ...rest) {
7086
+ let params;
7087
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7088
+ params = (paramsOrFirst || {});
7089
+ }
7090
+ else {
7091
+ params = {
7092
+ agentId: paramsOrFirst,
7093
+ threadId: rest[0],
7094
+ agentVersionId: rest[1]
7095
+ };
7096
+ }
7097
+ const agentId = params.agentId;
7098
+ const threadId = params.threadId;
7099
+ const agentVersionId = params.agentVersionId;
7100
+ if (typeof agentId === 'undefined') {
7101
+ throw new AgentbaseException('Missing required parameter: "agentId"');
7102
+ }
7103
+ if (typeof threadId === 'undefined') {
7104
+ throw new AgentbaseException('Missing required parameter: "threadId"');
7105
+ }
7106
+ if (typeof agentVersionId === 'undefined') {
7107
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7108
+ }
7109
+ const apiPath = '/agent-runtime/agents/{agentId}/threads/{threadId}'.replace('{agentId}', agentId).replace('{threadId}', threadId);
7110
+ const payload = {};
7111
+ if (typeof agentVersionId !== 'undefined') {
7112
+ payload['agent_version_id'] = agentVersionId;
7113
+ }
7114
+ const uri = new URL(this.client.config.endpoint + apiPath);
7115
+ const apiHeaders = {
7116
+ 'X-Appwrite-Project': this.client.config.project,
7117
+ };
7118
+ return this.client.call('get', uri, apiHeaders, payload);
7119
+ }
7120
+ deleteThread(paramsOrFirst, ...rest) {
7121
+ let params;
7122
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7123
+ params = (paramsOrFirst || {});
7124
+ }
7125
+ else {
7126
+ params = {
7127
+ agentId: paramsOrFirst,
7128
+ threadId: rest[0],
7129
+ agentVersionId: rest[1]
7130
+ };
7131
+ }
7132
+ const agentId = params.agentId;
7133
+ const threadId = params.threadId;
7134
+ const agentVersionId = params.agentVersionId;
7135
+ if (typeof agentId === 'undefined') {
7136
+ throw new AgentbaseException('Missing required parameter: "agentId"');
7137
+ }
7138
+ if (typeof threadId === 'undefined') {
7139
+ throw new AgentbaseException('Missing required parameter: "threadId"');
7140
+ }
7141
+ if (typeof agentVersionId === 'undefined') {
7142
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7143
+ }
7144
+ const apiPath = '/agent-runtime/agents/{agentId}/threads/{threadId}'.replace('{agentId}', agentId).replace('{threadId}', threadId);
7145
+ const payload = {};
7146
+ if (typeof agentVersionId !== 'undefined') {
7147
+ payload['agent_version_id'] = agentVersionId;
7148
+ }
7149
+ const uri = new URL(this.client.config.endpoint + apiPath);
7150
+ const apiHeaders = {
7151
+ 'X-Appwrite-Project': this.client.config.project,
7152
+ 'content-type': 'application/json',
7153
+ };
7154
+ return this.client.call('delete', uri, apiHeaders, payload);
7155
+ }
7156
+ listContextCompactions(paramsOrFirst, ...rest) {
7157
+ let params;
7158
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7159
+ params = (paramsOrFirst || {});
7160
+ }
7161
+ else {
7162
+ params = {
7163
+ agentId: paramsOrFirst,
7164
+ threadId: rest[0],
7165
+ agentVersionId: rest[1],
7166
+ limit: rest[2],
7167
+ after: rest[3]
7168
+ };
7169
+ }
7170
+ const agentId = params.agentId;
7171
+ const threadId = params.threadId;
7172
+ const agentVersionId = params.agentVersionId;
7173
+ const limit = params.limit;
7174
+ const after = params.after;
7175
+ if (typeof agentId === 'undefined') {
7176
+ throw new AgentbaseException('Missing required parameter: "agentId"');
7177
+ }
7178
+ if (typeof threadId === 'undefined') {
7179
+ throw new AgentbaseException('Missing required parameter: "threadId"');
7180
+ }
7181
+ if (typeof agentVersionId === 'undefined') {
7182
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7183
+ }
7184
+ const apiPath = '/agent-runtime/agents/{agentId}/threads/{threadId}/context-compactions'.replace('{agentId}', agentId).replace('{threadId}', threadId);
7185
+ const payload = {};
7186
+ if (typeof limit !== 'undefined') {
7187
+ payload['limit'] = limit;
7188
+ }
7189
+ if (typeof after !== 'undefined') {
7190
+ payload['after'] = after;
7191
+ }
7192
+ if (typeof agentVersionId !== 'undefined') {
7193
+ payload['agent_version_id'] = agentVersionId;
7194
+ }
7195
+ const uri = new URL(this.client.config.endpoint + apiPath);
7196
+ const apiHeaders = {
7197
+ 'X-Appwrite-Project': this.client.config.project,
7198
+ };
7199
+ return this.client.call('get', uri, apiHeaders, payload);
7200
+ }
7201
+ listThreadMessages(paramsOrFirst, ...rest) {
7202
+ let params;
7203
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7204
+ params = (paramsOrFirst || {});
7205
+ }
7206
+ else {
7207
+ params = {
7208
+ agentId: paramsOrFirst,
7209
+ threadId: rest[0],
7210
+ agentVersionId: rest[1],
7211
+ limit: rest[2],
7212
+ after: rest[3]
7213
+ };
7214
+ }
7215
+ const agentId = params.agentId;
7216
+ const threadId = params.threadId;
7217
+ const agentVersionId = params.agentVersionId;
7218
+ const limit = params.limit;
7219
+ const after = params.after;
7220
+ if (typeof agentId === 'undefined') {
7221
+ throw new AgentbaseException('Missing required parameter: "agentId"');
7222
+ }
7223
+ if (typeof threadId === 'undefined') {
7224
+ throw new AgentbaseException('Missing required parameter: "threadId"');
7225
+ }
7226
+ if (typeof agentVersionId === 'undefined') {
7227
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7228
+ }
7229
+ const apiPath = '/agent-runtime/agents/{agentId}/threads/{threadId}/messages'.replace('{agentId}', agentId).replace('{threadId}', threadId);
7230
+ const payload = {};
7231
+ if (typeof limit !== 'undefined') {
7232
+ payload['limit'] = limit;
7233
+ }
7234
+ if (typeof after !== 'undefined') {
7235
+ payload['after'] = after;
7236
+ }
7237
+ if (typeof agentVersionId !== 'undefined') {
7238
+ payload['agent_version_id'] = agentVersionId;
7239
+ }
7240
+ const uri = new URL(this.client.config.endpoint + apiPath);
7241
+ const apiHeaders = {
7242
+ 'X-Appwrite-Project': this.client.config.project,
7243
+ };
7244
+ return this.client.call('get', uri, apiHeaders, payload);
7245
+ }
7246
+ getRun(paramsOrFirst, ...rest) {
7247
+ let params;
7248
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7249
+ params = (paramsOrFirst || {});
7250
+ }
7251
+ else {
7252
+ params = {
7253
+ runId: paramsOrFirst,
7254
+ agentVersionId: rest[0]
7255
+ };
7256
+ }
7257
+ const runId = params.runId;
7258
+ const agentVersionId = params.agentVersionId;
7259
+ if (typeof runId === 'undefined') {
7260
+ throw new AgentbaseException('Missing required parameter: "runId"');
7261
+ }
7262
+ if (typeof agentVersionId === 'undefined') {
7263
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7264
+ }
7265
+ const apiPath = '/agent-runtime/runs/{runId}'.replace('{runId}', runId);
7266
+ const payload = {};
7267
+ if (typeof agentVersionId !== 'undefined') {
7268
+ payload['agent_version_id'] = agentVersionId;
7269
+ }
7270
+ const uri = new URL(this.client.config.endpoint + apiPath);
7271
+ const apiHeaders = {
7272
+ 'X-Appwrite-Project': this.client.config.project,
7273
+ };
7274
+ return this.client.call('get', uri, apiHeaders, payload);
7275
+ }
7276
+ cancelRun(paramsOrFirst, ...rest) {
7277
+ let params;
7278
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7279
+ params = (paramsOrFirst || {});
7280
+ }
7281
+ else {
7282
+ params = {
7283
+ runId: paramsOrFirst,
7284
+ agentVersionId: rest[0]
7285
+ };
7286
+ }
7287
+ const runId = params.runId;
7288
+ const agentVersionId = params.agentVersionId;
7289
+ if (typeof runId === 'undefined') {
7290
+ throw new AgentbaseException('Missing required parameter: "runId"');
7291
+ }
7292
+ if (typeof agentVersionId === 'undefined') {
7293
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7294
+ }
7295
+ const apiPath = '/agent-runtime/runs/{runId}/cancel'.replace('{runId}', runId);
7296
+ const payload = {};
7297
+ if (typeof agentVersionId !== 'undefined') {
7298
+ payload['agent_version_id'] = agentVersionId;
7299
+ }
7300
+ const uri = new URL(this.client.config.endpoint + apiPath);
7301
+ const apiHeaders = {
7302
+ 'X-Appwrite-Project': this.client.config.project,
7303
+ 'content-type': 'application/json',
7304
+ };
7305
+ return this.client.call('post', uri, apiHeaders, payload);
7306
+ }
7307
+ streamRunEvents(paramsOrFirst, ...rest) {
7308
+ let params;
7309
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7310
+ params = (paramsOrFirst || {});
7311
+ }
7312
+ else {
7313
+ params = {
7314
+ runId: paramsOrFirst,
7315
+ agentVersionId: rest[0]
7316
+ };
7317
+ }
7318
+ const runId = params.runId;
7319
+ const agentVersionId = params.agentVersionId;
7320
+ if (typeof runId === 'undefined') {
7321
+ throw new AgentbaseException('Missing required parameter: "runId"');
7322
+ }
7323
+ if (typeof agentVersionId === 'undefined') {
7324
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7325
+ }
7326
+ const apiPath = '/agent-runtime/runs/{runId}/events'.replace('{runId}', runId);
7327
+ const payload = {};
7328
+ if (typeof agentVersionId !== 'undefined') {
7329
+ payload['agent_version_id'] = agentVersionId;
7330
+ }
7331
+ const uri = new URL(this.client.config.endpoint + apiPath);
7332
+ const apiHeaders = {
7333
+ 'X-Appwrite-Project': this.client.config.project,
7334
+ };
7335
+ return this.client.call('get', uri, apiHeaders, payload);
7336
+ }
7337
+ listRunMessages(paramsOrFirst, ...rest) {
7338
+ let params;
7339
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7340
+ params = (paramsOrFirst || {});
7341
+ }
7342
+ else {
7343
+ params = {
7344
+ runId: paramsOrFirst,
7345
+ agentVersionId: rest[0],
7346
+ limit: rest[1],
7347
+ after: rest[2]
7348
+ };
7349
+ }
7350
+ const runId = params.runId;
7351
+ const agentVersionId = params.agentVersionId;
7352
+ const limit = params.limit;
7353
+ const after = params.after;
7354
+ if (typeof runId === 'undefined') {
7355
+ throw new AgentbaseException('Missing required parameter: "runId"');
7356
+ }
7357
+ if (typeof agentVersionId === 'undefined') {
7358
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7359
+ }
7360
+ const apiPath = '/agent-runtime/runs/{runId}/messages'.replace('{runId}', runId);
7361
+ const payload = {};
7362
+ if (typeof limit !== 'undefined') {
7363
+ payload['limit'] = limit;
7364
+ }
7365
+ if (typeof after !== 'undefined') {
7366
+ payload['after'] = after;
7367
+ }
7368
+ if (typeof agentVersionId !== 'undefined') {
7369
+ payload['agent_version_id'] = agentVersionId;
7370
+ }
7371
+ const uri = new URL(this.client.config.endpoint + apiPath);
7372
+ const apiHeaders = {
7373
+ 'X-Appwrite-Project': this.client.config.project,
7374
+ };
7375
+ return this.client.call('get', uri, apiHeaders, payload);
7376
+ }
7377
+ listModelInvocations(paramsOrFirst, ...rest) {
7378
+ let params;
7379
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7380
+ params = (paramsOrFirst || {});
7381
+ }
7382
+ else {
7383
+ params = {
7384
+ runId: paramsOrFirst,
7385
+ agentVersionId: rest[0],
7386
+ limit: rest[1],
7387
+ after: rest[2]
7388
+ };
7389
+ }
7390
+ const runId = params.runId;
7391
+ const agentVersionId = params.agentVersionId;
7392
+ const limit = params.limit;
7393
+ const after = params.after;
7394
+ if (typeof runId === 'undefined') {
7395
+ throw new AgentbaseException('Missing required parameter: "runId"');
7396
+ }
7397
+ if (typeof agentVersionId === 'undefined') {
7398
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7399
+ }
7400
+ const apiPath = '/agent-runtime/runs/{runId}/model-invocations'.replace('{runId}', runId);
7401
+ const payload = {};
7402
+ if (typeof limit !== 'undefined') {
7403
+ payload['limit'] = limit;
7404
+ }
7405
+ if (typeof after !== 'undefined') {
7406
+ payload['after'] = after;
7407
+ }
7408
+ if (typeof agentVersionId !== 'undefined') {
7409
+ payload['agent_version_id'] = agentVersionId;
7410
+ }
7411
+ const uri = new URL(this.client.config.endpoint + apiPath);
7412
+ const apiHeaders = {
7413
+ 'X-Appwrite-Project': this.client.config.project,
7414
+ };
7415
+ return this.client.call('get', uri, apiHeaders, payload);
7416
+ }
7417
+ submitToolMessage(paramsOrFirst, ...rest) {
7418
+ let params;
7419
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7420
+ params = (paramsOrFirst || {});
7421
+ }
7422
+ else {
7423
+ params = {
7424
+ runId: paramsOrFirst,
7425
+ agentVersionId: rest[0],
7426
+ id: rest[1],
7427
+ role: rest[2],
7428
+ toolCallId: rest[3],
7429
+ content: rest[4],
7430
+ error: rest[5]
7431
+ };
7432
+ }
7433
+ const runId = params.runId;
7434
+ const agentVersionId = params.agentVersionId;
7435
+ const id = params.id;
7436
+ const role = params.role;
7437
+ const toolCallId = params.toolCallId;
7438
+ const content = params.content;
7439
+ const error = params.error;
7440
+ if (typeof runId === 'undefined') {
7441
+ throw new AgentbaseException('Missing required parameter: "runId"');
7442
+ }
7443
+ if (typeof agentVersionId === 'undefined') {
7444
+ throw new AgentbaseException('Missing required parameter: "agentVersionId"');
7445
+ }
7446
+ if (typeof id === 'undefined') {
7447
+ throw new AgentbaseException('Missing required parameter: "id"');
7448
+ }
7449
+ if (typeof role === 'undefined') {
7450
+ throw new AgentbaseException('Missing required parameter: "role"');
7451
+ }
7452
+ if (typeof toolCallId === 'undefined') {
7453
+ throw new AgentbaseException('Missing required parameter: "toolCallId"');
7454
+ }
7455
+ if (typeof content === 'undefined') {
7456
+ throw new AgentbaseException('Missing required parameter: "content"');
7457
+ }
7458
+ const apiPath = '/agent-runtime/runs/{runId}/tool-messages'.replace('{runId}', runId);
7459
+ const payload = {};
7460
+ if (typeof agentVersionId !== 'undefined') {
7461
+ payload['agent_version_id'] = agentVersionId;
7462
+ }
7463
+ if (typeof id !== 'undefined') {
7464
+ payload['id'] = id;
7465
+ }
7466
+ if (typeof role !== 'undefined') {
7467
+ payload['role'] = role;
7468
+ }
7469
+ if (typeof toolCallId !== 'undefined') {
7470
+ payload['toolCallId'] = toolCallId;
7471
+ }
7472
+ if (typeof content !== 'undefined') {
7473
+ payload['content'] = content;
7474
+ }
7475
+ if (typeof error !== 'undefined') {
7476
+ payload['error'] = error;
7477
+ }
7478
+ const uri = new URL(this.client.config.endpoint + apiPath);
7479
+ const apiHeaders = {
7480
+ 'X-Appwrite-Project': this.client.config.project,
7481
+ 'content-type': 'application/json',
7482
+ };
7483
+ return this.client.call('post', uri, apiHeaders, payload);
7484
+ }
7485
+ }
7486
+
6955
7487
  class AiGateway {
6956
7488
  constructor(client) {
6957
7489
  this.client = client;
@@ -7090,7 +7622,8 @@
7090
7622
  allowedTools: rest[3],
7091
7623
  allowedAgents: rest[4],
7092
7624
  defaultLogicalModel: rest[5],
7093
- principal: rest[6]
7625
+ principal: rest[6],
7626
+ limits: rest[7]
7094
7627
  };
7095
7628
  }
7096
7629
  const name = params.name;
@@ -7101,6 +7634,7 @@
7101
7634
  const allowedAgents = params.allowedAgents;
7102
7635
  const defaultLogicalModel = params.defaultLogicalModel;
7103
7636
  const principal = params.principal;
7637
+ const limits = params.limits;
7104
7638
  if (typeof name === 'undefined') {
7105
7639
  throw new AgentbaseException('Missing required parameter: "name"');
7106
7640
  }
@@ -7133,6 +7667,9 @@
7133
7667
  if (typeof principal !== 'undefined') {
7134
7668
  payload['principal'] = principal;
7135
7669
  }
7670
+ if (typeof limits !== 'undefined') {
7671
+ payload['limits'] = limits;
7672
+ }
7136
7673
  const uri = new URL(this.client.config.endpoint + apiPath);
7137
7674
  const apiHeaders = {
7138
7675
  'X-Appwrite-Project': this.client.config.project,
@@ -10390,12 +10927,13 @@
10390
10927
  messages: rest[4],
10391
10928
  agentId: rest[5],
10392
10929
  runId: rest[6],
10393
- sensitivity: rest[7],
10394
- handlingPolicy: rest[8],
10395
- metadata: rest[9],
10396
- infer: rest[10],
10397
- reRemember: rest[11],
10398
- async: rest[12]
10930
+ sessionId: rest[7],
10931
+ sensitivity: rest[8],
10932
+ handlingPolicy: rest[9],
10933
+ metadata: rest[10],
10934
+ infer: rest[11],
10935
+ reRemember: rest[12],
10936
+ async: rest[13]
10399
10937
  };
10400
10938
  }
10401
10939
  const userId = params.userId;
@@ -10406,6 +10944,7 @@
10406
10944
  const messages = params.messages;
10407
10945
  const agentId = params.agentId;
10408
10946
  const runId = params.runId;
10947
+ const sessionId = params.sessionId;
10409
10948
  const sensitivity = params.sensitivity;
10410
10949
  const handlingPolicy = params.handlingPolicy;
10411
10950
  const metadata = params.metadata;
@@ -10441,6 +10980,9 @@
10441
10980
  if (typeof runId !== 'undefined') {
10442
10981
  payload['runId'] = runId;
10443
10982
  }
10983
+ if (typeof sessionId !== 'undefined') {
10984
+ payload['sessionId'] = sessionId;
10985
+ }
10444
10986
  if (typeof scope !== 'undefined') {
10445
10987
  payload['scope'] = scope;
10446
10988
  }
@@ -17602,6 +18144,7 @@
17602
18144
  })(exports.KnowledgeBaseDataSourceDocumentImportResultStatus || (exports.KnowledgeBaseDataSourceDocumentImportResultStatus = {}));
17603
18145
 
17604
18146
  exports.Account = Account;
18147
+ exports.AgentRuntime = AgentRuntime;
17605
18148
  exports.AgentbaseException = AgentbaseException;
17606
18149
  exports.AiGateway = AiGateway;
17607
18150
  exports.Avatars = Avatars;