@corti/dictation-web 0.1.23-rc.4 → 0.2.1

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/bundle.js CHANGED
@@ -3892,6 +3892,44 @@ function isFile(value) {
3892
3892
  return typeof File !== "undefined" && value instanceof File;
3893
3893
  }
3894
3894
 
3895
+ // node_modules/@corti/sdk/dist/esm/custom/utils/decodeToken.mjs
3896
+ function decodeToken2(token) {
3897
+ const parts = token ? token.split(".") : "";
3898
+ if (parts.length < 2) {
3899
+ return null;
3900
+ }
3901
+ const base64Url = parts[1];
3902
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
3903
+ let jsonPayload;
3904
+ try {
3905
+ jsonPayload = decodeURIComponent(atob(base64).split("").map((c4) => "%" + ("00" + c4.charCodeAt(0).toString(16)).slice(-2)).join(""));
3906
+ } catch (error) {
3907
+ return null;
3908
+ }
3909
+ let tokenDetails;
3910
+ try {
3911
+ tokenDetails = JSON.parse(jsonPayload);
3912
+ } catch (error) {
3913
+ return null;
3914
+ }
3915
+ const issuerUrl = tokenDetails.iss;
3916
+ if (!issuerUrl) {
3917
+ return null;
3918
+ }
3919
+ const regex = /^https:\/\/(keycloak|auth)\.([^.]+)\.corti\.app\/realms\/([^/]+)/;
3920
+ const match = issuerUrl.match(regex);
3921
+ if (match) {
3922
+ const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === "number" ? tokenDetails.exp : void 0;
3923
+ return {
3924
+ environment: match[2],
3925
+ tenantName: match[3],
3926
+ accessToken: token,
3927
+ expiresAt
3928
+ };
3929
+ }
3930
+ return null;
3931
+ }
3932
+
3895
3933
  // node_modules/@corti/sdk/dist/esm/custom/RefreshBearerProvider.mjs
3896
3934
  var __awaiter13 = function(thisArg, _arguments, P2, generator) {
3897
3935
  function adopt(value) {
@@ -3921,19 +3959,29 @@ var __awaiter13 = function(thisArg, _arguments, P2, generator) {
3921
3959
  });
3922
3960
  };
3923
3961
  var RefreshBearerProvider = class {
3924
- constructor({ accessToken, refreshAccessToken, refreshToken, refreshExpiresIn, expiresIn }) {
3962
+ constructor({ accessToken, refreshAccessToken, refreshToken, refreshExpiresIn, expiresIn, initialTokenResponse }) {
3925
3963
  this.BUFFER_IN_MINUTES = 2;
3926
- this._expiresAt = this.getExpiresAt(expiresIn, this.BUFFER_IN_MINUTES);
3927
- this._refreshExpiresAt = this.getExpiresAt(refreshExpiresIn, 0);
3928
3964
  this._accessToken = accessToken || "no_token";
3929
3965
  this._refreshToken = refreshToken;
3966
+ this._initialTokenResponse = initialTokenResponse;
3967
+ this._expiresAt = this.getExpiresAt(expiresIn, this._accessToken, this.BUFFER_IN_MINUTES);
3968
+ this._refreshExpiresAt = this.getExpiresAt(refreshExpiresIn, this._refreshToken, 0);
3930
3969
  this._refreshAccessToken = refreshAccessToken;
3931
3970
  }
3932
3971
  getToken() {
3933
3972
  return __awaiter13(this, void 0, void 0, function* () {
3934
- if (this._accessToken && this._expiresAt > /* @__PURE__ */ new Date()) {
3973
+ if (this._accessToken && this._accessToken !== "no_token" && this._expiresAt > /* @__PURE__ */ new Date()) {
3935
3974
  return Supplier.get(this._accessToken);
3936
3975
  }
3976
+ if (this._initialTokenResponse) {
3977
+ const tokenResponse = yield this._initialTokenResponse;
3978
+ this._initialTokenResponse = void 0;
3979
+ this._accessToken = tokenResponse.accessToken;
3980
+ this._expiresAt = this.getExpiresAt(tokenResponse.expiresIn, tokenResponse.accessToken, this.BUFFER_IN_MINUTES);
3981
+ this._refreshToken = tokenResponse.refreshToken;
3982
+ this._refreshExpiresAt = this.getExpiresAt(tokenResponse.refreshExpiresIn, this._refreshToken, 0);
3983
+ return this.getToken();
3984
+ }
3937
3985
  return this.refresh();
3938
3986
  });
3939
3987
  }
@@ -3944,15 +3992,31 @@ var RefreshBearerProvider = class {
3944
3992
  }
3945
3993
  const tokenResponse = yield this._refreshAccessToken(this._refreshToken);
3946
3994
  this._accessToken = tokenResponse.accessToken;
3947
- this._expiresAt = this.getExpiresAt(tokenResponse.expiresIn, this.BUFFER_IN_MINUTES);
3995
+ this._expiresAt = this.getExpiresAt(tokenResponse.expiresIn, tokenResponse.accessToken, this.BUFFER_IN_MINUTES);
3948
3996
  this._refreshToken = tokenResponse.refreshToken;
3949
- this._refreshExpiresAt = this.getExpiresAt(tokenResponse.refreshExpiresIn, 0);
3997
+ this._refreshExpiresAt = this.getExpiresAt(tokenResponse.refreshExpiresIn, this._refreshToken, 0);
3950
3998
  return this._accessToken;
3951
3999
  });
3952
4000
  }
3953
- getExpiresAt(expiresInSeconds = 0, bufferInMinutes = this.BUFFER_IN_MINUTES) {
3954
- const now = /* @__PURE__ */ new Date();
3955
- return new Date(now.getTime() + expiresInSeconds * 1e3 - bufferInMinutes * 60 * 1e3);
4001
+ getExpiresAt(expiresIn, token, bufferInMinutes = this.BUFFER_IN_MINUTES) {
4002
+ if (typeof expiresIn === "number") {
4003
+ const now = /* @__PURE__ */ new Date();
4004
+ return new Date(now.getTime() + expiresIn * 1e3 - bufferInMinutes * 60 * 1e3);
4005
+ }
4006
+ return this.parseTokenExpiry(token, bufferInMinutes) || this.getExpiresAt(0, token, bufferInMinutes);
4007
+ }
4008
+ parseTokenExpiry(token, bufferInMinutes) {
4009
+ if (!token || token === "no_token") {
4010
+ return;
4011
+ }
4012
+ try {
4013
+ const decoded = decodeToken2(token);
4014
+ if (decoded && typeof decoded.expiresAt === "number") {
4015
+ const ms = decoded.expiresAt * 1e3 - bufferInMinutes * 60 * 1e3;
4016
+ return new Date(ms);
4017
+ }
4018
+ } catch (_a) {
4019
+ }
3956
4020
  }
3957
4021
  };
3958
4022
 
@@ -4193,8 +4257,264 @@ var InteractionsUpdateRequest = schemas_exports.object({
4193
4257
  patient: InteractionsPatient.optional()
4194
4258
  });
4195
4259
 
4196
- // node_modules/@corti/sdk/dist/esm/serialization/resources/transcripts/types/TranscriptsCreateRequestModelName.mjs
4197
- var TranscriptsCreateRequestModelName = schemas_exports.enum_(["base", "enhanced", "premier"]);
4260
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/auth/types/GetTokenResponse.mjs
4261
+ var GetTokenResponse = schemas_exports.object({
4262
+ accessToken: schemas_exports.property("access_token", schemas_exports.string()),
4263
+ tokenType: schemas_exports.property("token_type", schemas_exports.string()),
4264
+ expiresIn: schemas_exports.property("expires_in", schemas_exports.number()),
4265
+ refreshToken: schemas_exports.property("refresh_token", schemas_exports.string().optional()),
4266
+ refreshExpiresIn: schemas_exports.property("refresh_expires_in", schemas_exports.number().optional())
4267
+ });
4268
+
4269
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/auth/client/requests/AuthGetTokenRequest.mjs
4270
+ var AuthGetTokenRequest = schemas_exports.object({
4271
+ clientId: schemas_exports.property("client_id", schemas_exports.string()),
4272
+ clientSecret: schemas_exports.property("client_secret", schemas_exports.string())
4273
+ });
4274
+
4275
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/agents/index.mjs
4276
+ var agents_exports = {};
4277
+ __export(agents_exports, {
4278
+ AgentsCreateAgent: () => AgentsCreateAgent,
4279
+ AgentsCreateAgentExpertsItem: () => AgentsCreateAgentExpertsItem,
4280
+ AgentsMessageSendParams: () => AgentsMessageSendParams,
4281
+ AgentsMessageSendResponse: () => AgentsMessageSendResponse,
4282
+ list: () => list_exports
4283
+ });
4284
+
4285
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsCreateMcpServerTransportType.mjs
4286
+ var AgentsCreateMcpServerTransportType = schemas_exports.enum_(["stdio", "streamable_http", "sse"]);
4287
+
4288
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsCreateMcpServerAuthorizationType.mjs
4289
+ var AgentsCreateMcpServerAuthorizationType = schemas_exports.enum_(["none", "bearer", "inherit", "oauth2.0"]);
4290
+
4291
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsCreateMcpServer.mjs
4292
+ var AgentsCreateMcpServer = schemas_exports.object({
4293
+ name: schemas_exports.string(),
4294
+ description: schemas_exports.string().optional(),
4295
+ transportType: AgentsCreateMcpServerTransportType,
4296
+ authorizationType: AgentsCreateMcpServerAuthorizationType,
4297
+ url: schemas_exports.string(),
4298
+ redirectUrl: schemas_exports.string().optional(),
4299
+ token: schemas_exports.string().optional()
4300
+ });
4301
+
4302
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsCreateExpert.mjs
4303
+ var AgentsCreateExpert = schemas_exports.object({
4304
+ type: schemas_exports.stringLiteral("new"),
4305
+ name: schemas_exports.string(),
4306
+ description: schemas_exports.string(),
4307
+ systemPrompt: schemas_exports.string().optional(),
4308
+ mcpServers: schemas_exports.list(AgentsCreateMcpServer).optional()
4309
+ });
4310
+
4311
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsExpertReference.mjs
4312
+ var AgentsExpertReference = schemas_exports.object({
4313
+ type: schemas_exports.stringLiteral("reference"),
4314
+ id: schemas_exports.string().optional(),
4315
+ name: schemas_exports.string().optional()
4316
+ });
4317
+
4318
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.mjs
4319
+ var AgentsCreateAgentExpertsItem = schemas_exports.undiscriminatedUnion([AgentsCreateExpert, AgentsExpertReference]);
4320
+
4321
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsMessageRole.mjs
4322
+ var AgentsMessageRole = schemas_exports.enum_(["user", "agent"]);
4323
+
4324
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsTextPart.mjs
4325
+ var AgentsTextPart = schemas_exports.object({
4326
+ kind: schemas_exports.stringLiteral("text"),
4327
+ text: schemas_exports.string(),
4328
+ metadata: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional()
4329
+ });
4330
+
4331
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsFileWithUri.mjs
4332
+ var AgentsFileWithUri = schemas_exports.object({
4333
+ uri: schemas_exports.string(),
4334
+ name: schemas_exports.string().optional(),
4335
+ mimeType: schemas_exports.string().optional()
4336
+ });
4337
+
4338
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsFileWithBytes.mjs
4339
+ var AgentsFileWithBytes = schemas_exports.object({
4340
+ bytes: schemas_exports.string(),
4341
+ name: schemas_exports.string().optional(),
4342
+ mimeType: schemas_exports.string().optional()
4343
+ });
4344
+
4345
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsFilePartFile.mjs
4346
+ var AgentsFilePartFile = schemas_exports.undiscriminatedUnion([AgentsFileWithUri, AgentsFileWithBytes]);
4347
+
4348
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsFilePart.mjs
4349
+ var AgentsFilePart = schemas_exports.object({
4350
+ kind: schemas_exports.stringLiteral("file"),
4351
+ file: AgentsFilePartFile.optional(),
4352
+ metadata: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional()
4353
+ });
4354
+
4355
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsDataPart.mjs
4356
+ var AgentsDataPart = schemas_exports.object({
4357
+ kind: schemas_exports.stringLiteral("data"),
4358
+ data: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()),
4359
+ metadata: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional()
4360
+ });
4361
+
4362
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsPart.mjs
4363
+ var AgentsPart = schemas_exports.undiscriminatedUnion([AgentsTextPart, AgentsFilePart, AgentsDataPart]);
4364
+
4365
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsMessage.mjs
4366
+ var AgentsMessage = schemas_exports.object({
4367
+ role: AgentsMessageRole,
4368
+ parts: schemas_exports.list(AgentsPart),
4369
+ metadata: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional(),
4370
+ extensions: schemas_exports.list(schemas_exports.string()).optional(),
4371
+ referenceTaskIds: schemas_exports.list(schemas_exports.string()).optional(),
4372
+ messageId: schemas_exports.string(),
4373
+ taskId: schemas_exports.string().optional(),
4374
+ contextId: schemas_exports.string().optional(),
4375
+ kind: schemas_exports.stringLiteral("message")
4376
+ });
4377
+
4378
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsTaskStatusState.mjs
4379
+ var AgentsTaskStatusState = schemas_exports.enum_([
4380
+ "submitted",
4381
+ "working",
4382
+ "input-required",
4383
+ "completed",
4384
+ "canceled",
4385
+ "failed",
4386
+ "rejected",
4387
+ "auth-required",
4388
+ "unknown"
4389
+ ]);
4390
+
4391
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsTaskStatus.mjs
4392
+ var AgentsTaskStatus = schemas_exports.object({
4393
+ state: AgentsTaskStatusState,
4394
+ message: AgentsMessage.optional(),
4395
+ timestamp: schemas_exports.date().optional()
4396
+ });
4397
+
4398
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsArtifact.mjs
4399
+ var AgentsArtifact = schemas_exports.object({
4400
+ artifactId: schemas_exports.string(),
4401
+ name: schemas_exports.string().optional(),
4402
+ description: schemas_exports.string().optional(),
4403
+ parts: schemas_exports.list(AgentsPart),
4404
+ metadata: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional(),
4405
+ extensions: schemas_exports.list(schemas_exports.string()).optional()
4406
+ });
4407
+
4408
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsTask.mjs
4409
+ var AgentsTask = schemas_exports.object({
4410
+ id: schemas_exports.string(),
4411
+ contextId: schemas_exports.string(),
4412
+ status: AgentsTaskStatus,
4413
+ history: schemas_exports.list(AgentsMessage).optional(),
4414
+ artifacts: schemas_exports.list(AgentsArtifact).optional(),
4415
+ metadata: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional(),
4416
+ kind: schemas_exports.stringLiteral("task")
4417
+ });
4418
+
4419
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/agents/types/AgentsMessageSendResponse.mjs
4420
+ var AgentsMessageSendResponse = schemas_exports.object({
4421
+ message: AgentsMessage.optional(),
4422
+ task: AgentsTask.optional()
4423
+ });
4424
+
4425
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/agents/client/list.mjs
4426
+ var list_exports = {};
4427
+ __export(list_exports, {
4428
+ Response: () => Response
4429
+ });
4430
+
4431
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsMcpServerTransportType.mjs
4432
+ var AgentsMcpServerTransportType = schemas_exports.enum_(["stdio", "streamable_http"]);
4433
+
4434
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsMcpServerAuthorizationType.mjs
4435
+ var AgentsMcpServerAuthorizationType = schemas_exports.enum_(["none", "oauth2.0", "oauth2.1"]);
4436
+
4437
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsMcpServer.mjs
4438
+ var AgentsMcpServer = schemas_exports.object({
4439
+ id: schemas_exports.string(),
4440
+ name: schemas_exports.string(),
4441
+ transportType: AgentsMcpServerTransportType,
4442
+ authorizationType: AgentsMcpServerAuthorizationType,
4443
+ url: schemas_exports.string(),
4444
+ redirectUrl: schemas_exports.string().optionalNullable()
4445
+ });
4446
+
4447
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsExpert.mjs
4448
+ var AgentsExpert = schemas_exports.object({
4449
+ type: schemas_exports.stringLiteral("expert"),
4450
+ id: schemas_exports.string(),
4451
+ name: schemas_exports.string(),
4452
+ description: schemas_exports.string(),
4453
+ systemPrompt: schemas_exports.string(),
4454
+ mcpServers: schemas_exports.list(AgentsMcpServer).optional()
4455
+ });
4456
+
4457
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentExpertsItem.mjs
4458
+ var AgentsAgentExpertsItem = schemas_exports.undiscriminatedUnion([AgentsExpert, AgentsExpertReference]);
4459
+
4460
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgent.mjs
4461
+ var AgentsAgent = schemas_exports.object({
4462
+ id: schemas_exports.string(),
4463
+ name: schemas_exports.string(),
4464
+ description: schemas_exports.string(),
4465
+ systemPrompt: schemas_exports.string(),
4466
+ experts: schemas_exports.list(AgentsAgentExpertsItem).optional()
4467
+ });
4468
+
4469
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentReference.mjs
4470
+ var AgentsAgentReference = schemas_exports.object({
4471
+ type: schemas_exports.stringLiteral("reference"),
4472
+ id: schemas_exports.string().optional(),
4473
+ name: schemas_exports.string().optional()
4474
+ });
4475
+
4476
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentResponse.mjs
4477
+ var AgentsAgentResponse = schemas_exports.undiscriminatedUnion([AgentsAgent, AgentsAgentReference]);
4478
+
4479
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/agents/client/list.mjs
4480
+ var Response = schemas_exports.list(AgentsAgentResponse);
4481
+
4482
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/agents/client/requests/AgentsCreateAgent.mjs
4483
+ var AgentsCreateAgent = schemas_exports.object({
4484
+ name: schemas_exports.string(),
4485
+ systemPrompt: schemas_exports.string().optional(),
4486
+ description: schemas_exports.string(),
4487
+ experts: schemas_exports.list(AgentsCreateAgentExpertsItem).optional()
4488
+ });
4489
+
4490
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsPushNotificationAuthenticationInfo.mjs
4491
+ var AgentsPushNotificationAuthenticationInfo = schemas_exports.object({
4492
+ schemes: schemas_exports.list(schemas_exports.string()),
4493
+ credentials: schemas_exports.string().optional()
4494
+ });
4495
+
4496
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsPushNotificationConfig.mjs
4497
+ var AgentsPushNotificationConfig = schemas_exports.object({
4498
+ id: schemas_exports.string().optional(),
4499
+ url: schemas_exports.string(),
4500
+ token: schemas_exports.string().optional(),
4501
+ authentication: AgentsPushNotificationAuthenticationInfo.optional()
4502
+ });
4503
+
4504
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsMessageSendConfiguration.mjs
4505
+ var AgentsMessageSendConfiguration = schemas_exports.object({
4506
+ acceptedOutputModes: schemas_exports.list(schemas_exports.string()).optional(),
4507
+ historyLength: schemas_exports.number().optional(),
4508
+ pushNotificationConfig: AgentsPushNotificationConfig.optional(),
4509
+ blocking: schemas_exports.boolean().optional()
4510
+ });
4511
+
4512
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/agents/client/requests/AgentsMessageSendParams.mjs
4513
+ var AgentsMessageSendParams = schemas_exports.object({
4514
+ message: AgentsMessage,
4515
+ configuration: AgentsMessageSendConfiguration.optional(),
4516
+ metadata: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional()
4517
+ });
4198
4518
 
4199
4519
  // node_modules/@corti/sdk/dist/esm/serialization/types/TranscriptsParticipantRoleEnum.mjs
4200
4520
  var TranscriptsParticipantRoleEnum = schemas_exports.enum_(["doctor", "patient", "multiple"]);
@@ -4212,23 +4532,7 @@ var TranscriptsCreateRequest = schemas_exports.object({
4212
4532
  isDictation: schemas_exports.boolean().optional(),
4213
4533
  isMultichannel: schemas_exports.boolean().optional(),
4214
4534
  diarize: schemas_exports.boolean().optional(),
4215
- participants: schemas_exports.list(TranscriptsParticipant).optional(),
4216
- modelName: TranscriptsCreateRequestModelName
4217
- });
4218
-
4219
- // node_modules/@corti/sdk/dist/esm/serialization/resources/auth/types/GetTokenResponse.mjs
4220
- var GetTokenResponse = schemas_exports.object({
4221
- accessToken: schemas_exports.property("access_token", schemas_exports.string()),
4222
- tokenType: schemas_exports.property("token_type", schemas_exports.string()),
4223
- expiresIn: schemas_exports.property("expires_in", schemas_exports.number()),
4224
- refreshToken: schemas_exports.property("refresh_token", schemas_exports.string().optional()),
4225
- refreshExpiresIn: schemas_exports.property("refresh_expires_in", schemas_exports.number().optional())
4226
- });
4227
-
4228
- // node_modules/@corti/sdk/dist/esm/serialization/resources/auth/client/requests/AuthGetTokenRequest.mjs
4229
- var AuthGetTokenRequest = schemas_exports.object({
4230
- clientId: schemas_exports.property("client_id", schemas_exports.string()),
4231
- clientSecret: schemas_exports.property("client_secret", schemas_exports.string())
4535
+ participants: schemas_exports.list(TranscriptsParticipant).optional()
4232
4536
  });
4233
4537
 
4234
4538
  // node_modules/@corti/sdk/dist/esm/serialization/types/CommonSourceEnum.mjs
@@ -4267,6 +4571,18 @@ var FactsUpdateRequest = schemas_exports.object({
4267
4571
  isDiscarded: schemas_exports.boolean().optional()
4268
4572
  });
4269
4573
 
4574
+ // node_modules/@corti/sdk/dist/esm/serialization/types/CommonTextContext.mjs
4575
+ var CommonTextContext = schemas_exports.object({
4576
+ type: schemas_exports.stringLiteral("text"),
4577
+ text: schemas_exports.string()
4578
+ });
4579
+
4580
+ // node_modules/@corti/sdk/dist/esm/serialization/resources/facts/client/requests/FactsExtractRequest.mjs
4581
+ var FactsExtractRequest = schemas_exports.object({
4582
+ context: schemas_exports.list(CommonTextContext),
4583
+ outputLanguage: schemas_exports.string()
4584
+ });
4585
+
4270
4586
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsSectionInput.mjs
4271
4587
  var DocumentsSectionInput = schemas_exports.object({
4272
4588
  key: schemas_exports.string(),
@@ -4290,38 +4606,38 @@ var FactsContext = schemas_exports.object({
4290
4606
 
4291
4607
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsContextWithFacts.mjs
4292
4608
  var DocumentsContextWithFacts = schemas_exports.object({
4609
+ type: schemas_exports.stringLiteral("facts"),
4293
4610
  data: schemas_exports.list(FactsContext)
4294
4611
  });
4295
4612
 
4296
- // node_modules/@corti/sdk/dist/esm/serialization/types/CommonTranscript.mjs
4297
- var CommonTranscript = schemas_exports.object({
4298
- channel: schemas_exports.number(),
4299
- participant: schemas_exports.number(),
4300
- speakerId: schemas_exports.number(),
4613
+ // node_modules/@corti/sdk/dist/esm/serialization/types/CommonTranscriptRequest.mjs
4614
+ var CommonTranscriptRequest = schemas_exports.object({
4615
+ channel: schemas_exports.number().optional(),
4616
+ participant: schemas_exports.number().optional(),
4617
+ speakerId: schemas_exports.number().optional(),
4301
4618
  text: schemas_exports.string(),
4302
- start: schemas_exports.number(),
4303
- end: schemas_exports.number()
4619
+ start: schemas_exports.number().optional(),
4620
+ end: schemas_exports.number().optional()
4304
4621
  });
4305
4622
 
4306
4623
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsContextWithTranscript.mjs
4307
4624
  var DocumentsContextWithTranscript = schemas_exports.object({
4308
- data: CommonTranscript
4625
+ type: schemas_exports.stringLiteral("transcript"),
4626
+ data: CommonTranscriptRequest
4309
4627
  });
4310
4628
 
4311
4629
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsContextWithString.mjs
4312
4630
  var DocumentsContextWithString = schemas_exports.object({
4631
+ type: schemas_exports.stringLiteral("string"),
4313
4632
  data: schemas_exports.string()
4314
4633
  });
4315
4634
 
4316
4635
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsContext.mjs
4317
- var DocumentsContext = schemas_exports.union("type", {
4318
- facts: DocumentsContextWithFacts,
4319
- transcript: DocumentsContextWithTranscript,
4320
- string: DocumentsContextWithString
4321
- }).transform({
4322
- transform: (value) => value,
4323
- untransform: (value) => value
4324
- });
4636
+ var DocumentsContext = schemas_exports.undiscriminatedUnion([
4637
+ DocumentsContextWithFacts,
4638
+ DocumentsContextWithTranscript,
4639
+ DocumentsContextWithString
4640
+ ]);
4325
4641
 
4326
4642
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsSection.mjs
4327
4643
  var DocumentsSection = schemas_exports.object({
@@ -4340,15 +4656,8 @@ var DocumentsTemplateWithSectionKeys = schemas_exports.object({
4340
4656
  additionalInstructions: schemas_exports.string().optional()
4341
4657
  });
4342
4658
 
4343
- // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsTemplateWithSectionIds.mjs
4344
- var DocumentsTemplateWithSectionIds = schemas_exports.object({
4345
- sectionIds: schemas_exports.list(Uuid),
4346
- documentName: schemas_exports.string().optional(),
4347
- additionalInstructions: schemas_exports.string().optional()
4348
- });
4349
-
4350
4659
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsTemplate.mjs
4351
- var DocumentsTemplate = schemas_exports.undiscriminatedUnion([DocumentsTemplateWithSectionKeys, DocumentsTemplateWithSectionIds]);
4660
+ var DocumentsTemplate = DocumentsTemplateWithSectionKeys;
4352
4661
 
4353
4662
  // node_modules/@corti/sdk/dist/esm/serialization/types/InteractionsEncounterResponse.mjs
4354
4663
  var InteractionsEncounterResponse = schemas_exports.object({
@@ -4388,17 +4697,8 @@ var DocumentsCreateRequestWithTemplateKey = schemas_exports.object({
4388
4697
  context: schemas_exports.list(DocumentsContext),
4389
4698
  templateKey: schemas_exports.string(),
4390
4699
  name: schemas_exports.string().optional(),
4391
- modelName: schemas_exports.string().optional(),
4392
- outputLanguage: schemas_exports.string()
4393
- });
4394
-
4395
- // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsCreateRequestWithTemplateId.mjs
4396
- var DocumentsCreateRequestWithTemplateId = schemas_exports.object({
4397
- context: schemas_exports.list(DocumentsContext),
4398
- templateId: Uuid,
4399
- name: schemas_exports.string().optional(),
4400
- modelName: schemas_exports.string().optional(),
4401
- outputLanguage: schemas_exports.string()
4700
+ outputLanguage: schemas_exports.string(),
4701
+ disableGuardrails: schemas_exports.boolean().optional()
4402
4702
  });
4403
4703
 
4404
4704
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsCreateRequestWithTemplate.mjs
@@ -4406,14 +4706,13 @@ var DocumentsCreateRequestWithTemplate = schemas_exports.object({
4406
4706
  context: schemas_exports.list(DocumentsContext),
4407
4707
  template: DocumentsTemplate,
4408
4708
  name: schemas_exports.string().optional(),
4409
- modelName: schemas_exports.string().optional(),
4410
- outputLanguage: schemas_exports.string()
4709
+ outputLanguage: schemas_exports.string(),
4710
+ disableGuardrails: schemas_exports.boolean().optional()
4411
4711
  });
4412
4712
 
4413
4713
  // node_modules/@corti/sdk/dist/esm/serialization/types/DocumentsCreateRequest.mjs
4414
4714
  var DocumentsCreateRequest = schemas_exports.undiscriminatedUnion([
4415
4715
  DocumentsCreateRequestWithTemplateKey,
4416
- DocumentsCreateRequestWithTemplateId,
4417
4716
  DocumentsCreateRequestWithTemplate
4418
4717
  ]);
4419
4718
 
@@ -4573,6 +4872,19 @@ var FactsBatchUpdateResponse = schemas_exports.object({
4573
4872
  facts: schemas_exports.list(FactsBatchUpdateItem)
4574
4873
  });
4575
4874
 
4875
+ // node_modules/@corti/sdk/dist/esm/serialization/types/FactsExtractResponseFactsItem.mjs
4876
+ var FactsExtractResponseFactsItem = schemas_exports.object({
4877
+ group: schemas_exports.string(),
4878
+ value: schemas_exports.string()
4879
+ });
4880
+
4881
+ // node_modules/@corti/sdk/dist/esm/serialization/types/FactsExtractResponse.mjs
4882
+ var FactsExtractResponse = schemas_exports.object({
4883
+ facts: schemas_exports.list(FactsExtractResponseFactsItem),
4884
+ outputLanguage: schemas_exports.string(),
4885
+ usageInfo: CommonUsageInfo
4886
+ });
4887
+
4576
4888
  // node_modules/@corti/sdk/dist/esm/serialization/types/InteractionsGetResponse.mjs
4577
4889
  var InteractionsGetResponse = schemas_exports.object({
4578
4890
  id: Uuid,
@@ -4612,18 +4924,28 @@ var RecordingsListResponse = schemas_exports.object({
4612
4924
  recordings: schemas_exports.list(Uuid)
4613
4925
  });
4614
4926
 
4927
+ // node_modules/@corti/sdk/dist/esm/serialization/types/CommonTranscriptResponse.mjs
4928
+ var CommonTranscriptResponse = schemas_exports.object({
4929
+ channel: schemas_exports.number(),
4930
+ participant: schemas_exports.number(),
4931
+ speakerId: schemas_exports.number(),
4932
+ text: schemas_exports.string(),
4933
+ start: schemas_exports.number(),
4934
+ end: schemas_exports.number()
4935
+ });
4936
+
4615
4937
  // node_modules/@corti/sdk/dist/esm/serialization/types/TranscriptsResponse.mjs
4616
4938
  var TranscriptsResponse = schemas_exports.object({
4617
4939
  id: Uuid,
4618
4940
  metadata: TranscriptsMetadata,
4619
- transcripts: schemas_exports.list(CommonTranscript),
4941
+ transcripts: schemas_exports.list(CommonTranscriptResponse).optionalNullable(),
4620
4942
  usageInfo: CommonUsageInfo
4621
4943
  });
4622
4944
 
4623
4945
  // node_modules/@corti/sdk/dist/esm/serialization/types/TranscriptsData.mjs
4624
4946
  var TranscriptsData = schemas_exports.object({
4625
4947
  metadata: TranscriptsMetadata,
4626
- transcripts: schemas_exports.list(CommonTranscript)
4948
+ transcripts: schemas_exports.list(CommonTranscriptResponse)
4627
4949
  });
4628
4950
 
4629
4951
  // node_modules/@corti/sdk/dist/esm/serialization/types/TranscriptsListItem.mjs
@@ -4725,6 +5047,95 @@ var TranscribeEndMessage = schemas_exports.object({
4725
5047
  type: schemas_exports.stringLiteral("end")
4726
5048
  });
4727
5049
 
5050
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentInterface.mjs
5051
+ var AgentsAgentInterface = schemas_exports.object({
5052
+ url: schemas_exports.string(),
5053
+ transport: schemas_exports.string()
5054
+ });
5055
+
5056
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentProvider.mjs
5057
+ var AgentsAgentProvider = schemas_exports.object({
5058
+ organization: schemas_exports.string(),
5059
+ url: schemas_exports.string()
5060
+ });
5061
+
5062
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentExtension.mjs
5063
+ var AgentsAgentExtension = schemas_exports.object({
5064
+ uri: schemas_exports.string(),
5065
+ description: schemas_exports.string().optional(),
5066
+ required: schemas_exports.boolean().optional(),
5067
+ params: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional()
5068
+ });
5069
+
5070
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentCapabilities.mjs
5071
+ var AgentsAgentCapabilities = schemas_exports.object({
5072
+ streaming: schemas_exports.boolean().optional(),
5073
+ pushNotifications: schemas_exports.boolean().optional(),
5074
+ stateTransitionHistory: schemas_exports.boolean().optional(),
5075
+ extensions: schemas_exports.list(AgentsAgentExtension).optionalNullable()
5076
+ });
5077
+
5078
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentSkill.mjs
5079
+ var AgentsAgentSkill = schemas_exports.object({
5080
+ id: schemas_exports.string(),
5081
+ name: schemas_exports.string(),
5082
+ description: schemas_exports.string(),
5083
+ tags: schemas_exports.list(schemas_exports.string()),
5084
+ examples: schemas_exports.list(AgentsMessage).optionalNullable(),
5085
+ inputModes: schemas_exports.list(schemas_exports.string()).optionalNullable(),
5086
+ outputModes: schemas_exports.list(schemas_exports.string()).optionalNullable(),
5087
+ security: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optionalNullable()
5088
+ });
5089
+
5090
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentCardSignature.mjs
5091
+ var AgentsAgentCardSignature = schemas_exports.object({
5092
+ protected: schemas_exports.string(),
5093
+ signature: schemas_exports.string(),
5094
+ header: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optional()
5095
+ });
5096
+
5097
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsAgentCard.mjs
5098
+ var AgentsAgentCard = schemas_exports.object({
5099
+ protocolVersion: schemas_exports.string(),
5100
+ name: schemas_exports.string(),
5101
+ description: schemas_exports.string(),
5102
+ url: schemas_exports.string(),
5103
+ preferredTransport: schemas_exports.string().optionalNullable(),
5104
+ additionalInterfaces: schemas_exports.list(AgentsAgentInterface).optionalNullable(),
5105
+ iconUrl: schemas_exports.string().optionalNullable(),
5106
+ documentationUrl: schemas_exports.string().optionalNullable(),
5107
+ provider: AgentsAgentProvider.optional(),
5108
+ version: schemas_exports.string(),
5109
+ capabilities: AgentsAgentCapabilities,
5110
+ securitySchemes: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optionalNullable(),
5111
+ security: schemas_exports.record(schemas_exports.string(), schemas_exports.unknown()).optionalNullable(),
5112
+ defaultInputModes: schemas_exports.list(schemas_exports.string()),
5113
+ defaultOutputModes: schemas_exports.list(schemas_exports.string()),
5114
+ skills: schemas_exports.list(AgentsAgentSkill),
5115
+ supportsAuthenticatedExtendedCard: schemas_exports.boolean().optionalNullable(),
5116
+ signatures: schemas_exports.list(AgentsAgentCardSignature).optionalNullable()
5117
+ });
5118
+
5119
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsContextItemsItem.mjs
5120
+ var AgentsContextItemsItem = schemas_exports.undiscriminatedUnion([AgentsTask, AgentsMessage]);
5121
+
5122
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsContext.mjs
5123
+ var AgentsContext = schemas_exports.object({
5124
+ id: schemas_exports.string().optional(),
5125
+ items: schemas_exports.list(AgentsContextItemsItem).optional()
5126
+ });
5127
+
5128
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsRegistryExpert.mjs
5129
+ var AgentsRegistryExpert = schemas_exports.object({
5130
+ name: schemas_exports.string(),
5131
+ description: schemas_exports.string()
5132
+ });
5133
+
5134
+ // node_modules/@corti/sdk/dist/esm/serialization/types/AgentsRegistryExpertsResponse.mjs
5135
+ var AgentsRegistryExpertsResponse = schemas_exports.object({
5136
+ experts: schemas_exports.list(AgentsRegistryExpert).optional()
5137
+ });
5138
+
4728
5139
  // node_modules/@corti/sdk/dist/esm/core/headers.mjs
4729
5140
  function mergeHeaders(...headersArray) {
4730
5141
  const result = {};
@@ -4866,7 +5277,8 @@ function getEnvironment(environment) {
4866
5277
  return typeof environment === "string" ? {
4867
5278
  base: `https://api.${environment}.corti.app/v2`,
4868
5279
  wss: `wss://api.${environment}.corti.app`,
4869
- login: `https://auth.${environment}.corti.app/realms`
5280
+ login: `https://auth.${environment}.corti.app/realms`,
5281
+ agents: `https://api.${environment}.corti.app`
4870
5282
  } : environment;
4871
5283
  }
4872
5284
 
@@ -5063,7 +5475,7 @@ var Interactions = class {
5063
5475
  this._options = _options;
5064
5476
  }
5065
5477
  /**
5066
- * Lists all existing interactions. Results can be filtered by encounter status and patient identifier.
5478
+ * Lists all existing interactions. Results can be filtered by encounter status and patient identifier.
5067
5479
  *
5068
5480
  * @param {Corti.InteractionsListRequest} request
5069
5481
  * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration.
@@ -5198,7 +5610,7 @@ var Interactions = class {
5198
5610
  });
5199
5611
  }
5200
5612
  /**
5201
- * Creates a new interaction.
5613
+ * Creates a new interaction.
5202
5614
  *
5203
5615
  * @param {Corti.InteractionsCreateRequest} request
5204
5616
  * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration.
@@ -5300,7 +5712,7 @@ var Interactions = class {
5300
5712
  });
5301
5713
  }
5302
5714
  /**
5303
- * Retrieves a previously recorded interaction by its unique identifier (interaction ID).
5715
+ * Retrieves a previously recorded interaction by its unique identifier (interaction ID).
5304
5716
  *
5305
5717
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
5306
5718
  * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration.
@@ -5384,7 +5796,7 @@ var Interactions = class {
5384
5796
  });
5385
5797
  }
5386
5798
  /**
5387
- * Deletes an existing interaction.
5799
+ * Deletes an existing interaction.
5388
5800
  *
5389
5801
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
5390
5802
  * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration.
@@ -5459,7 +5871,7 @@ var Interactions = class {
5459
5871
  });
5460
5872
  }
5461
5873
  /**
5462
- * Modifies an existing interaction by updating specific fields without overwriting the entire record.
5874
+ * Modifies an existing interaction by updating specific fields without overwriting the entire record.
5463
5875
  *
5464
5876
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
5465
5877
  * @param {Corti.InteractionsUpdateRequest} request
@@ -5593,7 +6005,7 @@ var Recordings = class {
5593
6005
  this._options = _options;
5594
6006
  }
5595
6007
  /**
5596
- * Retrieve a list of recordings for a given interaction.
6008
+ * Retrieve a list of recordings for a given interaction.
5597
6009
  *
5598
6010
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
5599
6011
  * @param {Recordings.RequestOptions} requestOptions - Request-specific configuration.
@@ -5683,7 +6095,7 @@ var Recordings = class {
5683
6095
  });
5684
6096
  }
5685
6097
  /**
5686
- * Upload a recording for a given interaction. There is a maximum limit of 60 minutes in length and 150MB in size for recordings.
6098
+ * Upload a recording for a given interaction. There is a maximum limit of 60 minutes in length and 150MB in size for recordings.
5687
6099
  *
5688
6100
  * @param {core.file.Uploadable} uploadable
5689
6101
  * @param {Corti.Uuid} id
@@ -5776,7 +6188,7 @@ var Recordings = class {
5776
6188
  });
5777
6189
  }
5778
6190
  /**
5779
- * Retrieve a specific recording for a given interaction.
6191
+ * Retrieve a specific recording for a given interaction.
5780
6192
  * @throws {@link Corti.BadRequestError}
5781
6193
  * @throws {@link Corti.ForbiddenError}
5782
6194
  * @throws {@link Corti.NotFoundError}
@@ -5817,13 +6229,7 @@ var Recordings = class {
5817
6229
  breadcrumbsPrefix: ["response"]
5818
6230
  }), _response.rawResponse);
5819
6231
  case 404:
5820
- throw new NotFoundError(ErrorResponse.parseOrThrow(_response.error.body, {
5821
- unrecognizedObjectKeys: "passthrough",
5822
- allowUnrecognizedUnionMembers: true,
5823
- allowUnrecognizedEnumValues: true,
5824
- skipValidation: true,
5825
- breadcrumbsPrefix: ["response"]
5826
- }), _response.rawResponse);
6232
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
5827
6233
  case 500:
5828
6234
  throw new InternalServerError(_response.error.body, _response.rawResponse);
5829
6235
  case 504:
@@ -5860,7 +6266,7 @@ var Recordings = class {
5860
6266
  });
5861
6267
  }
5862
6268
  /**
5863
- * Delete a specific recording for a given interaction.
6269
+ * Delete a specific recording for a given interaction.
5864
6270
  *
5865
6271
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
5866
6272
  * @param {Corti.Uuid} recordingId - The unique identifier of the recording. Must be a valid UUID.
@@ -5905,13 +6311,7 @@ var Recordings = class {
5905
6311
  breadcrumbsPrefix: ["response"]
5906
6312
  }), _response.rawResponse);
5907
6313
  case 404:
5908
- throw new NotFoundError(ErrorResponse.parseOrThrow(_response.error.body, {
5909
- unrecognizedObjectKeys: "passthrough",
5910
- allowUnrecognizedUnionMembers: true,
5911
- allowUnrecognizedEnumValues: true,
5912
- skipValidation: true,
5913
- breadcrumbsPrefix: ["response"]
5914
- }), _response.rawResponse);
6314
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
5915
6315
  case 500:
5916
6316
  throw new InternalServerError(_response.error.body, _response.rawResponse);
5917
6317
  case 504:
@@ -5991,7 +6391,7 @@ var Transcripts = class {
5991
6391
  this._options = _options;
5992
6392
  }
5993
6393
  /**
5994
- * Retrieves a list of transcripts for a given interaction.
6394
+ * Retrieves a list of transcripts for a given interaction.
5995
6395
  *
5996
6396
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
5997
6397
  * @param {Corti.TranscriptsListRequest} request
@@ -6091,7 +6491,7 @@ var Transcripts = class {
6091
6491
  });
6092
6492
  }
6093
6493
  /**
6094
- * Creates a new transcript for an interaction.
6494
+ * Create a transcript from an audio file attached, via `/recordings` endpoint, to the interaction.<br/><Note>Each interaction may have more than one audio file and transcript associated with it. While audio files up to 60min in total duration, or 150MB in total size, may be attached to an interaction, synchronous processing is only supported for audio files less than ~2min in duration.<br/><br/>If an audio file takes longer to transcribe than the 25sec synchronous processing timeout, then it will continue to process asynchronously. In this scenario, an empty transcript will be returned with a location header that can be used to retrieve the final transcript.<br/><br/>The client can poll the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/status`) for transcript status changes:<br/>- `200 OK` with status `processing`, `completed`, or `failed`<br/>- `404 Not Found` if the `interactionId` or `transcriptId` are invalid<br/><br/>The completed transcript can be retrieved via the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/`).</Note>
6095
6495
  *
6096
6496
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6097
6497
  * @param {Corti.TranscriptsCreateRequest} request
@@ -6106,8 +6506,7 @@ var Transcripts = class {
6106
6506
  * @example
6107
6507
  * await client.transcripts.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", {
6108
6508
  * recordingId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
6109
- * primaryLanguage: "en",
6110
- * modelName: "base"
6509
+ * primaryLanguage: "en"
6111
6510
  * })
6112
6511
  */
6113
6512
  create(id, request, requestOptions) {
@@ -6195,7 +6594,7 @@ var Transcripts = class {
6195
6594
  });
6196
6595
  }
6197
6596
  /**
6198
- * Retrieves the transcript for a specific interaction.
6597
+ * Retrieve a transcript from a specific interaction.<br/><Note>Each interaction may have more than one transcript associated with it. Use the List Transcript request (`GET /interactions/{id}/transcripts/`) to see all transcriptIds available for the interaction.<br/><br/>The client can poll this Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/status`) for transcript status changes:<br/>- `200 OK` with status `processing`, `completed`, or `failed`<br/>- `404 Not Found` if the `interactionId` or `transcriptId` are invalid<br/><br/>Status of `completed` indicates the transcript is finalized. If the transcript is retrieved while status is `processing`, then it will be incomplete.</Note>
6199
6598
  *
6200
6599
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6201
6600
  * @param {Corti.Uuid} transcriptId - The unique identifier of the transcript. Must be a valid UUID.
@@ -6289,7 +6688,7 @@ var Transcripts = class {
6289
6688
  });
6290
6689
  }
6291
6690
  /**
6292
- * Deletes a specific transcript associated with an interaction.
6691
+ * Deletes a specific transcript associated with an interaction.
6293
6692
  *
6294
6693
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6295
6694
  * @param {Corti.Uuid} transcriptId - The unique identifier of the transcript. Must be a valid UUID.
@@ -6417,6 +6816,8 @@ var Facts = class {
6417
6816
  this._options = _options;
6418
6817
  }
6419
6818
  /**
6819
+ * Returns a list of available fact groups, used to categorize facts associated with an interaction.
6820
+ *
6420
6821
  * @param {Facts.RequestOptions} requestOptions - Request-specific configuration.
6421
6822
  *
6422
6823
  * @throws {@link Corti.InternalServerError}
@@ -6483,7 +6884,7 @@ var Facts = class {
6483
6884
  });
6484
6885
  }
6485
6886
  /**
6486
- * Retrieves a list of facts for a given interaction.
6887
+ * Retrieves a list of facts for a given interaction.
6487
6888
  *
6488
6889
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6489
6890
  * @param {Facts.RequestOptions} requestOptions - Request-specific configuration.
@@ -6558,7 +6959,7 @@ var Facts = class {
6558
6959
  });
6559
6960
  }
6560
6961
  /**
6561
- * Adds new facts to an interaction.
6962
+ * Adds new facts to an interaction.
6562
6963
  *
6563
6964
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6564
6965
  * @param {Corti.FactsCreateRequest} request
@@ -6645,7 +7046,7 @@ var Facts = class {
6645
7046
  });
6646
7047
  }
6647
7048
  /**
6648
- * Updates multiple facts associated with an interaction. If the interaction `status = "in progress"`, the updated facts will be sent to the client over WebSocket.
7049
+ * Updates multiple facts associated with an interaction.
6649
7050
  *
6650
7051
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6651
7052
  * @param {Corti.FactsBatchUpdateRequest} request
@@ -6731,7 +7132,7 @@ var Facts = class {
6731
7132
  });
6732
7133
  }
6733
7134
  /**
6734
- * Updates an existing fact within a specific interaction. If the interaction `status = "in progress"`, the updated fact will be sent to the client via WebSocket. To discard a fact, simply set `discarded = true`.
7135
+ * Updates an existing fact associated with a specific interaction.
6735
7136
  *
6736
7137
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6737
7138
  * @param {Corti.Uuid} factId - The unique identifier of the fact to update. Must be a valid UUID.
@@ -6813,18 +7214,105 @@ var Facts = class {
6813
7214
  }
6814
7215
  });
6815
7216
  }
6816
- _getAuthorizationHeader() {
6817
- return __awaiter19(this, void 0, void 0, function* () {
6818
- const bearer = yield Supplier.get(this._options.token);
6819
- if (bearer != null) {
6820
- return `Bearer ${bearer}`;
6821
- }
6822
- return void 0;
6823
- });
7217
+ /**
7218
+ * Extract facts from provided text, without storing them.
7219
+ *
7220
+ * @param {Corti.FactsExtractRequest} request
7221
+ * @param {Facts.RequestOptions} requestOptions - Request-specific configuration.
7222
+ *
7223
+ * @throws {@link Corti.GatewayTimeoutError}
7224
+ *
7225
+ * @example
7226
+ * await client.facts.extract({
7227
+ * context: [{
7228
+ * type: "text",
7229
+ * text: "text"
7230
+ * }],
7231
+ * outputLanguage: "outputLanguage"
7232
+ * })
7233
+ */
7234
+ extract(request, requestOptions) {
7235
+ return HttpResponsePromise.fromPromise(this.__extract(request, requestOptions));
6824
7236
  }
6825
- };
6826
-
6827
- // node_modules/@corti/sdk/dist/esm/api/resources/documents/client/Client.mjs
7237
+ __extract(request, requestOptions) {
7238
+ return __awaiter19(this, void 0, void 0, function* () {
7239
+ var _a, _b;
7240
+ const _response = yield fetcher({
7241
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).base, "tools/extract-facts"),
7242
+ method: "POST",
7243
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
7244
+ Authorization: yield this._getAuthorizationHeader(),
7245
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
7246
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
7247
+ contentType: "application/json",
7248
+ requestType: "json",
7249
+ body: FactsExtractRequest.jsonOrThrow(request, {
7250
+ unrecognizedObjectKeys: "strip",
7251
+ omitUndefined: true
7252
+ }),
7253
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
7254
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
7255
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
7256
+ });
7257
+ if (_response.ok) {
7258
+ return {
7259
+ data: FactsExtractResponse.parseOrThrow(_response.body, {
7260
+ unrecognizedObjectKeys: "passthrough",
7261
+ allowUnrecognizedUnionMembers: true,
7262
+ allowUnrecognizedEnumValues: true,
7263
+ skipValidation: true,
7264
+ breadcrumbsPrefix: ["response"]
7265
+ }),
7266
+ rawResponse: _response.rawResponse
7267
+ };
7268
+ }
7269
+ if (_response.error.reason === "status-code") {
7270
+ switch (_response.error.statusCode) {
7271
+ case 504:
7272
+ throw new GatewayTimeoutError(ErrorResponse.parseOrThrow(_response.error.body, {
7273
+ unrecognizedObjectKeys: "passthrough",
7274
+ allowUnrecognizedUnionMembers: true,
7275
+ allowUnrecognizedEnumValues: true,
7276
+ skipValidation: true,
7277
+ breadcrumbsPrefix: ["response"]
7278
+ }), _response.rawResponse);
7279
+ default:
7280
+ throw new CortiError({
7281
+ statusCode: _response.error.statusCode,
7282
+ body: _response.error.body,
7283
+ rawResponse: _response.rawResponse
7284
+ });
7285
+ }
7286
+ }
7287
+ switch (_response.error.reason) {
7288
+ case "non-json":
7289
+ throw new CortiError({
7290
+ statusCode: _response.error.statusCode,
7291
+ body: _response.error.rawBody,
7292
+ rawResponse: _response.rawResponse
7293
+ });
7294
+ case "timeout":
7295
+ throw new CortiTimeoutError("Timeout exceeded when calling POST /tools/extract-facts.");
7296
+ case "unknown":
7297
+ throw new CortiError({
7298
+ message: _response.error.errorMessage,
7299
+ rawResponse: _response.rawResponse
7300
+ });
7301
+ }
7302
+ });
7303
+ }
7304
+ _getAuthorizationHeader() {
7305
+ return __awaiter19(this, void 0, void 0, function* () {
7306
+ const bearer = yield Supplier.get(this._options.token);
7307
+ if (bearer != null) {
7308
+ return `Bearer ${bearer}`;
7309
+ }
7310
+ return void 0;
7311
+ });
7312
+ }
7313
+ };
7314
+
7315
+ // node_modules/@corti/sdk/dist/esm/api/resources/documents/client/Client.mjs
6828
7316
  var __awaiter20 = function(thisArg, _arguments, P2, generator) {
6829
7317
  function adopt(value) {
6830
7318
  return value instanceof P2 ? value : new P2(function(resolve) {
@@ -6857,7 +7345,7 @@ var Documents = class {
6857
7345
  this._options = _options;
6858
7346
  }
6859
7347
  /**
6860
- * List Documents
7348
+ * List Documents
6861
7349
  *
6862
7350
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6863
7351
  * @param {Documents.RequestOptions} requestOptions - Request-specific configuration.
@@ -6947,7 +7435,7 @@ var Documents = class {
6947
7435
  });
6948
7436
  }
6949
7437
  /**
6950
- * Generate Document.
7438
+ * Generate Document.
6951
7439
  *
6952
7440
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
6953
7441
  * @param {Corti.DocumentsCreateRequest} request
@@ -7054,7 +7542,7 @@ var Documents = class {
7054
7542
  });
7055
7543
  }
7056
7544
  /**
7057
- * Get Document.
7545
+ * Get Document.
7058
7546
  *
7059
7547
  * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
7060
7548
  * @param {Corti.Uuid} documentId - The document ID representing the context for the request. Must be a valid UUID.
@@ -7188,13 +7676,7 @@ var Documents = class {
7188
7676
  breadcrumbsPrefix: ["response"]
7189
7677
  }), _response.rawResponse);
7190
7678
  case 404:
7191
- throw new NotFoundError(ErrorResponse.parseOrThrow(_response.error.body, {
7192
- unrecognizedObjectKeys: "passthrough",
7193
- allowUnrecognizedUnionMembers: true,
7194
- allowUnrecognizedEnumValues: true,
7195
- skipValidation: true,
7196
- breadcrumbsPrefix: ["response"]
7197
- }), _response.rawResponse);
7679
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
7198
7680
  case 500:
7199
7681
  throw new InternalServerError(_response.error.body, _response.rawResponse);
7200
7682
  case 504:
@@ -7317,7 +7799,927 @@ var Documents = class {
7317
7799
  rawResponse: _response.rawResponse
7318
7800
  });
7319
7801
  case "timeout":
7320
- throw new CortiTimeoutError("Timeout exceeded when calling PATCH /interactions/{id}/documents/{documentId}.");
7802
+ throw new CortiTimeoutError("Timeout exceeded when calling PATCH /interactions/{id}/documents/{documentId}.");
7803
+ case "unknown":
7804
+ throw new CortiError({
7805
+ message: _response.error.errorMessage,
7806
+ rawResponse: _response.rawResponse
7807
+ });
7808
+ }
7809
+ });
7810
+ }
7811
+ _getAuthorizationHeader() {
7812
+ return __awaiter20(this, void 0, void 0, function* () {
7813
+ const bearer = yield Supplier.get(this._options.token);
7814
+ if (bearer != null) {
7815
+ return `Bearer ${bearer}`;
7816
+ }
7817
+ return void 0;
7818
+ });
7819
+ }
7820
+ };
7821
+
7822
+ // node_modules/@corti/sdk/dist/esm/api/resources/templates/client/Client.mjs
7823
+ var __awaiter21 = function(thisArg, _arguments, P2, generator) {
7824
+ function adopt(value) {
7825
+ return value instanceof P2 ? value : new P2(function(resolve) {
7826
+ resolve(value);
7827
+ });
7828
+ }
7829
+ return new (P2 || (P2 = Promise))(function(resolve, reject) {
7830
+ function fulfilled(value) {
7831
+ try {
7832
+ step(generator.next(value));
7833
+ } catch (e5) {
7834
+ reject(e5);
7835
+ }
7836
+ }
7837
+ function rejected(value) {
7838
+ try {
7839
+ step(generator["throw"](value));
7840
+ } catch (e5) {
7841
+ reject(e5);
7842
+ }
7843
+ }
7844
+ function step(result) {
7845
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7846
+ }
7847
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7848
+ });
7849
+ };
7850
+ var Templates = class {
7851
+ constructor(_options) {
7852
+ this._options = _options;
7853
+ }
7854
+ /**
7855
+ * Retrieves a list of template sections with optional filters for organization and language.
7856
+ *
7857
+ * @param {Corti.TemplatesSectionListRequest} request
7858
+ * @param {Templates.RequestOptions} requestOptions - Request-specific configuration.
7859
+ *
7860
+ * @throws {@link Corti.UnauthorizedError}
7861
+ * @throws {@link Corti.InternalServerError}
7862
+ *
7863
+ * @example
7864
+ * await client.templates.sectionList()
7865
+ */
7866
+ sectionList(request = {}, requestOptions) {
7867
+ return HttpResponsePromise.fromPromise(this.__sectionList(request, requestOptions));
7868
+ }
7869
+ __sectionList() {
7870
+ return __awaiter21(this, arguments, void 0, function* (request = {}, requestOptions) {
7871
+ var _a, _b;
7872
+ const { org, lang } = request;
7873
+ const _queryParams = {};
7874
+ if (org != null) {
7875
+ if (Array.isArray(org)) {
7876
+ _queryParams["org"] = org.map((item) => item);
7877
+ } else {
7878
+ _queryParams["org"] = org;
7879
+ }
7880
+ }
7881
+ if (lang != null) {
7882
+ if (Array.isArray(lang)) {
7883
+ _queryParams["lang"] = lang.map((item) => item);
7884
+ } else {
7885
+ _queryParams["lang"] = lang;
7886
+ }
7887
+ }
7888
+ const _response = yield fetcher({
7889
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).base, "templateSections/"),
7890
+ method: "GET",
7891
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
7892
+ Authorization: yield this._getAuthorizationHeader(),
7893
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
7894
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
7895
+ queryParameters: _queryParams,
7896
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
7897
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
7898
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
7899
+ });
7900
+ if (_response.ok) {
7901
+ return {
7902
+ data: TemplatesSectionListResponse.parseOrThrow(_response.body, {
7903
+ unrecognizedObjectKeys: "passthrough",
7904
+ allowUnrecognizedUnionMembers: true,
7905
+ allowUnrecognizedEnumValues: true,
7906
+ skipValidation: true,
7907
+ breadcrumbsPrefix: ["response"]
7908
+ }),
7909
+ rawResponse: _response.rawResponse
7910
+ };
7911
+ }
7912
+ if (_response.error.reason === "status-code") {
7913
+ switch (_response.error.statusCode) {
7914
+ case 401:
7915
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
7916
+ case 500:
7917
+ throw new InternalServerError(_response.error.body, _response.rawResponse);
7918
+ default:
7919
+ throw new CortiError({
7920
+ statusCode: _response.error.statusCode,
7921
+ body: _response.error.body,
7922
+ rawResponse: _response.rawResponse
7923
+ });
7924
+ }
7925
+ }
7926
+ switch (_response.error.reason) {
7927
+ case "non-json":
7928
+ throw new CortiError({
7929
+ statusCode: _response.error.statusCode,
7930
+ body: _response.error.rawBody,
7931
+ rawResponse: _response.rawResponse
7932
+ });
7933
+ case "timeout":
7934
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /templateSections/.");
7935
+ case "unknown":
7936
+ throw new CortiError({
7937
+ message: _response.error.errorMessage,
7938
+ rawResponse: _response.rawResponse
7939
+ });
7940
+ }
7941
+ });
7942
+ }
7943
+ /**
7944
+ * Retrieves a list of templates with optional filters for organization, language, and status.
7945
+ *
7946
+ * @param {Corti.TemplatesListRequest} request
7947
+ * @param {Templates.RequestOptions} requestOptions - Request-specific configuration.
7948
+ *
7949
+ * @throws {@link Corti.UnauthorizedError}
7950
+ * @throws {@link Corti.InternalServerError}
7951
+ *
7952
+ * @example
7953
+ * await client.templates.list()
7954
+ */
7955
+ list(request = {}, requestOptions) {
7956
+ return HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
7957
+ }
7958
+ __list() {
7959
+ return __awaiter21(this, arguments, void 0, function* (request = {}, requestOptions) {
7960
+ var _a, _b;
7961
+ const { org, lang, status } = request;
7962
+ const _queryParams = {};
7963
+ if (org != null) {
7964
+ if (Array.isArray(org)) {
7965
+ _queryParams["org"] = org.map((item) => item);
7966
+ } else {
7967
+ _queryParams["org"] = org;
7968
+ }
7969
+ }
7970
+ if (lang != null) {
7971
+ if (Array.isArray(lang)) {
7972
+ _queryParams["lang"] = lang.map((item) => item);
7973
+ } else {
7974
+ _queryParams["lang"] = lang;
7975
+ }
7976
+ }
7977
+ if (status != null) {
7978
+ if (Array.isArray(status)) {
7979
+ _queryParams["status"] = status.map((item) => item);
7980
+ } else {
7981
+ _queryParams["status"] = status;
7982
+ }
7983
+ }
7984
+ const _response = yield fetcher({
7985
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).base, "templates/"),
7986
+ method: "GET",
7987
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
7988
+ Authorization: yield this._getAuthorizationHeader(),
7989
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
7990
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
7991
+ queryParameters: _queryParams,
7992
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
7993
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
7994
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
7995
+ });
7996
+ if (_response.ok) {
7997
+ return {
7998
+ data: TemplatesListResponse.parseOrThrow(_response.body, {
7999
+ unrecognizedObjectKeys: "passthrough",
8000
+ allowUnrecognizedUnionMembers: true,
8001
+ allowUnrecognizedEnumValues: true,
8002
+ skipValidation: true,
8003
+ breadcrumbsPrefix: ["response"]
8004
+ }),
8005
+ rawResponse: _response.rawResponse
8006
+ };
8007
+ }
8008
+ if (_response.error.reason === "status-code") {
8009
+ switch (_response.error.statusCode) {
8010
+ case 401:
8011
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8012
+ case 500:
8013
+ throw new InternalServerError(_response.error.body, _response.rawResponse);
8014
+ default:
8015
+ throw new CortiError({
8016
+ statusCode: _response.error.statusCode,
8017
+ body: _response.error.body,
8018
+ rawResponse: _response.rawResponse
8019
+ });
8020
+ }
8021
+ }
8022
+ switch (_response.error.reason) {
8023
+ case "non-json":
8024
+ throw new CortiError({
8025
+ statusCode: _response.error.statusCode,
8026
+ body: _response.error.rawBody,
8027
+ rawResponse: _response.rawResponse
8028
+ });
8029
+ case "timeout":
8030
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /templates/.");
8031
+ case "unknown":
8032
+ throw new CortiError({
8033
+ message: _response.error.errorMessage,
8034
+ rawResponse: _response.rawResponse
8035
+ });
8036
+ }
8037
+ });
8038
+ }
8039
+ /**
8040
+ * Retrieves template by key.
8041
+ *
8042
+ * @param {string} key - The key of the template
8043
+ * @param {Templates.RequestOptions} requestOptions - Request-specific configuration.
8044
+ *
8045
+ * @throws {@link Corti.UnauthorizedError}
8046
+ * @throws {@link Corti.InternalServerError}
8047
+ *
8048
+ * @example
8049
+ * await client.templates.get("key")
8050
+ */
8051
+ get(key, requestOptions) {
8052
+ return HttpResponsePromise.fromPromise(this.__get(key, requestOptions));
8053
+ }
8054
+ __get(key, requestOptions) {
8055
+ return __awaiter21(this, void 0, void 0, function* () {
8056
+ var _a, _b;
8057
+ const _response = yield fetcher({
8058
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).base, `templates/${encodeURIComponent(key)}`),
8059
+ method: "GET",
8060
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8061
+ Authorization: yield this._getAuthorizationHeader(),
8062
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
8063
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8064
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
8065
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
8066
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
8067
+ });
8068
+ if (_response.ok) {
8069
+ return {
8070
+ data: TemplatesItem.parseOrThrow(_response.body, {
8071
+ unrecognizedObjectKeys: "passthrough",
8072
+ allowUnrecognizedUnionMembers: true,
8073
+ allowUnrecognizedEnumValues: true,
8074
+ skipValidation: true,
8075
+ breadcrumbsPrefix: ["response"]
8076
+ }),
8077
+ rawResponse: _response.rawResponse
8078
+ };
8079
+ }
8080
+ if (_response.error.reason === "status-code") {
8081
+ switch (_response.error.statusCode) {
8082
+ case 401:
8083
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8084
+ case 500:
8085
+ throw new InternalServerError(_response.error.body, _response.rawResponse);
8086
+ default:
8087
+ throw new CortiError({
8088
+ statusCode: _response.error.statusCode,
8089
+ body: _response.error.body,
8090
+ rawResponse: _response.rawResponse
8091
+ });
8092
+ }
8093
+ }
8094
+ switch (_response.error.reason) {
8095
+ case "non-json":
8096
+ throw new CortiError({
8097
+ statusCode: _response.error.statusCode,
8098
+ body: _response.error.rawBody,
8099
+ rawResponse: _response.rawResponse
8100
+ });
8101
+ case "timeout":
8102
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /templates/{key}.");
8103
+ case "unknown":
8104
+ throw new CortiError({
8105
+ message: _response.error.errorMessage,
8106
+ rawResponse: _response.rawResponse
8107
+ });
8108
+ }
8109
+ });
8110
+ }
8111
+ _getAuthorizationHeader() {
8112
+ return __awaiter21(this, void 0, void 0, function* () {
8113
+ const bearer = yield Supplier.get(this._options.token);
8114
+ if (bearer != null) {
8115
+ return `Bearer ${bearer}`;
8116
+ }
8117
+ return void 0;
8118
+ });
8119
+ }
8120
+ };
8121
+
8122
+ // node_modules/@corti/sdk/dist/esm/api/resources/agents/client/Client.mjs
8123
+ var __awaiter22 = function(thisArg, _arguments, P2, generator) {
8124
+ function adopt(value) {
8125
+ return value instanceof P2 ? value : new P2(function(resolve) {
8126
+ resolve(value);
8127
+ });
8128
+ }
8129
+ return new (P2 || (P2 = Promise))(function(resolve, reject) {
8130
+ function fulfilled(value) {
8131
+ try {
8132
+ step(generator.next(value));
8133
+ } catch (e5) {
8134
+ reject(e5);
8135
+ }
8136
+ }
8137
+ function rejected(value) {
8138
+ try {
8139
+ step(generator["throw"](value));
8140
+ } catch (e5) {
8141
+ reject(e5);
8142
+ }
8143
+ }
8144
+ function step(result) {
8145
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
8146
+ }
8147
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8148
+ });
8149
+ };
8150
+ var __rest2 = function(s4, e5) {
8151
+ var t4 = {};
8152
+ for (var p3 in s4) if (Object.prototype.hasOwnProperty.call(s4, p3) && e5.indexOf(p3) < 0)
8153
+ t4[p3] = s4[p3];
8154
+ if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
8155
+ for (var i5 = 0, p3 = Object.getOwnPropertySymbols(s4); i5 < p3.length; i5++) {
8156
+ if (e5.indexOf(p3[i5]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p3[i5]))
8157
+ t4[p3[i5]] = s4[p3[i5]];
8158
+ }
8159
+ return t4;
8160
+ };
8161
+ var Agents = class {
8162
+ constructor(_options) {
8163
+ this._options = _options;
8164
+ }
8165
+ /**
8166
+ * This endpoint retrieves a list of all agents that can be called by the Corti Agent Framework.
8167
+ *
8168
+ * @param {Corti.AgentsListRequest} request
8169
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
8170
+ *
8171
+ * @throws {@link Corti.BadRequestError}
8172
+ * @throws {@link Corti.UnauthorizedError}
8173
+ *
8174
+ * @example
8175
+ * await client.agents.list()
8176
+ */
8177
+ list(request = {}, requestOptions) {
8178
+ return HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
8179
+ }
8180
+ __list() {
8181
+ return __awaiter22(this, arguments, void 0, function* (request = {}, requestOptions) {
8182
+ var _a, _b, _c, _d, _e;
8183
+ const { limit, offset, ephemeral } = request;
8184
+ const _queryParams = {};
8185
+ if (limit !== void 0) {
8186
+ _queryParams["limit"] = (_a = limit === null || limit === void 0 ? void 0 : limit.toString()) !== null && _a !== void 0 ? _a : null;
8187
+ }
8188
+ if (offset !== void 0) {
8189
+ _queryParams["offset"] = (_b = offset === null || offset === void 0 ? void 0 : offset.toString()) !== null && _b !== void 0 ? _b : null;
8190
+ }
8191
+ if (ephemeral !== void 0) {
8192
+ _queryParams["ephemeral"] = (_c = ephemeral === null || ephemeral === void 0 ? void 0 : ephemeral.toString()) !== null && _c !== void 0 ? _c : null;
8193
+ }
8194
+ const _response = yield fetcher({
8195
+ url: url_exports.join((_d = yield Supplier.get(this._options.baseUrl)) !== null && _d !== void 0 ? _d : (yield Supplier.get(this._options.environment)).agents, "agents"),
8196
+ method: "GET",
8197
+ headers: mergeHeaders((_e = this._options) === null || _e === void 0 ? void 0 : _e.headers, mergeOnlyDefinedHeaders({
8198
+ Authorization: yield this._getAuthorizationHeader(),
8199
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
8200
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8201
+ queryParameters: _queryParams,
8202
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
8203
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
8204
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
8205
+ });
8206
+ if (_response.ok) {
8207
+ return {
8208
+ data: agents_exports.list.Response.parseOrThrow(_response.body, {
8209
+ unrecognizedObjectKeys: "passthrough",
8210
+ allowUnrecognizedUnionMembers: true,
8211
+ allowUnrecognizedEnumValues: true,
8212
+ skipValidation: true,
8213
+ breadcrumbsPrefix: ["response"]
8214
+ }),
8215
+ rawResponse: _response.rawResponse
8216
+ };
8217
+ }
8218
+ if (_response.error.reason === "status-code") {
8219
+ switch (_response.error.statusCode) {
8220
+ case 400:
8221
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8222
+ case 401:
8223
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8224
+ default:
8225
+ throw new CortiError({
8226
+ statusCode: _response.error.statusCode,
8227
+ body: _response.error.body,
8228
+ rawResponse: _response.rawResponse
8229
+ });
8230
+ }
8231
+ }
8232
+ switch (_response.error.reason) {
8233
+ case "non-json":
8234
+ throw new CortiError({
8235
+ statusCode: _response.error.statusCode,
8236
+ body: _response.error.rawBody,
8237
+ rawResponse: _response.rawResponse
8238
+ });
8239
+ case "timeout":
8240
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /agents.");
8241
+ case "unknown":
8242
+ throw new CortiError({
8243
+ message: _response.error.errorMessage,
8244
+ rawResponse: _response.rawResponse
8245
+ });
8246
+ }
8247
+ });
8248
+ }
8249
+ /**
8250
+ * This endpoint allows the creation of a new agent that can be utilized in the `POST /agents/{id}/v1/message:send` endpoint.
8251
+ *
8252
+ * @param {Corti.AgentsCreateAgent} request
8253
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
8254
+ *
8255
+ * @throws {@link Corti.BadRequestError}
8256
+ * @throws {@link Corti.UnauthorizedError}
8257
+ *
8258
+ * @example
8259
+ * await client.agents.create({
8260
+ * name: "name",
8261
+ * description: "description"
8262
+ * })
8263
+ */
8264
+ create(request, requestOptions) {
8265
+ return HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
8266
+ }
8267
+ __create(request, requestOptions) {
8268
+ return __awaiter22(this, void 0, void 0, function* () {
8269
+ var _a, _b, _c;
8270
+ const { ephemeral } = request, _body = __rest2(request, ["ephemeral"]);
8271
+ const _queryParams = {};
8272
+ if (ephemeral !== void 0) {
8273
+ _queryParams["ephemeral"] = (_a = ephemeral === null || ephemeral === void 0 ? void 0 : ephemeral.toString()) !== null && _a !== void 0 ? _a : null;
8274
+ }
8275
+ const _response = yield fetcher({
8276
+ url: url_exports.join((_b = yield Supplier.get(this._options.baseUrl)) !== null && _b !== void 0 ? _b : (yield Supplier.get(this._options.environment)).agents, "agents"),
8277
+ method: "POST",
8278
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({
8279
+ Authorization: yield this._getAuthorizationHeader(),
8280
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
8281
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8282
+ contentType: "application/json",
8283
+ queryParameters: _queryParams,
8284
+ requestType: "json",
8285
+ body: AgentsCreateAgent.jsonOrThrow(_body, {
8286
+ unrecognizedObjectKeys: "strip",
8287
+ omitUndefined: true
8288
+ }),
8289
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
8290
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
8291
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
8292
+ });
8293
+ if (_response.ok) {
8294
+ return {
8295
+ data: AgentsAgent.parseOrThrow(_response.body, {
8296
+ unrecognizedObjectKeys: "passthrough",
8297
+ allowUnrecognizedUnionMembers: true,
8298
+ allowUnrecognizedEnumValues: true,
8299
+ skipValidation: true,
8300
+ breadcrumbsPrefix: ["response"]
8301
+ }),
8302
+ rawResponse: _response.rawResponse
8303
+ };
8304
+ }
8305
+ if (_response.error.reason === "status-code") {
8306
+ switch (_response.error.statusCode) {
8307
+ case 400:
8308
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8309
+ case 401:
8310
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8311
+ default:
8312
+ throw new CortiError({
8313
+ statusCode: _response.error.statusCode,
8314
+ body: _response.error.body,
8315
+ rawResponse: _response.rawResponse
8316
+ });
8317
+ }
8318
+ }
8319
+ switch (_response.error.reason) {
8320
+ case "non-json":
8321
+ throw new CortiError({
8322
+ statusCode: _response.error.statusCode,
8323
+ body: _response.error.rawBody,
8324
+ rawResponse: _response.rawResponse
8325
+ });
8326
+ case "timeout":
8327
+ throw new CortiTimeoutError("Timeout exceeded when calling POST /agents.");
8328
+ case "unknown":
8329
+ throw new CortiError({
8330
+ message: _response.error.errorMessage,
8331
+ rawResponse: _response.rawResponse
8332
+ });
8333
+ }
8334
+ });
8335
+ }
8336
+ /**
8337
+ * This endpoint retrieves an agent by its identifier. The agent contains information about its capabilities and the experts it can call.
8338
+ *
8339
+ * @param {string} id - The identifier of the agent associated with the context.
8340
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
8341
+ *
8342
+ * @throws {@link Corti.BadRequestError}
8343
+ * @throws {@link Corti.UnauthorizedError}
8344
+ * @throws {@link Corti.NotFoundError}
8345
+ *
8346
+ * @example
8347
+ * await client.agents.get("12345678-90ab-cdef-gh12-34567890abc")
8348
+ */
8349
+ get(id, requestOptions) {
8350
+ return HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
8351
+ }
8352
+ __get(id, requestOptions) {
8353
+ return __awaiter22(this, void 0, void 0, function* () {
8354
+ var _a, _b;
8355
+ const _response = yield fetcher({
8356
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).agents, `agents/${encodeURIComponent(id)}`),
8357
+ method: "GET",
8358
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8359
+ Authorization: yield this._getAuthorizationHeader(),
8360
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
8361
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8362
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
8363
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
8364
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
8365
+ });
8366
+ if (_response.ok) {
8367
+ return {
8368
+ data: AgentsAgentResponse.parseOrThrow(_response.body, {
8369
+ unrecognizedObjectKeys: "passthrough",
8370
+ allowUnrecognizedUnionMembers: true,
8371
+ allowUnrecognizedEnumValues: true,
8372
+ skipValidation: true,
8373
+ breadcrumbsPrefix: ["response"]
8374
+ }),
8375
+ rawResponse: _response.rawResponse
8376
+ };
8377
+ }
8378
+ if (_response.error.reason === "status-code") {
8379
+ switch (_response.error.statusCode) {
8380
+ case 400:
8381
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8382
+ case 401:
8383
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8384
+ case 404:
8385
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
8386
+ default:
8387
+ throw new CortiError({
8388
+ statusCode: _response.error.statusCode,
8389
+ body: _response.error.body,
8390
+ rawResponse: _response.rawResponse
8391
+ });
8392
+ }
8393
+ }
8394
+ switch (_response.error.reason) {
8395
+ case "non-json":
8396
+ throw new CortiError({
8397
+ statusCode: _response.error.statusCode,
8398
+ body: _response.error.rawBody,
8399
+ rawResponse: _response.rawResponse
8400
+ });
8401
+ case "timeout":
8402
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}.");
8403
+ case "unknown":
8404
+ throw new CortiError({
8405
+ message: _response.error.errorMessage,
8406
+ rawResponse: _response.rawResponse
8407
+ });
8408
+ }
8409
+ });
8410
+ }
8411
+ /**
8412
+ * This endpoint deletes an agent by its identifier. Once deleted, the agent can no longer be used in threads.
8413
+ *
8414
+ * @param {string} id - The identifier of the agent associated with the context.
8415
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
8416
+ *
8417
+ * @throws {@link Corti.BadRequestError}
8418
+ * @throws {@link Corti.UnauthorizedError}
8419
+ * @throws {@link Corti.NotFoundError}
8420
+ *
8421
+ * @example
8422
+ * await client.agents.delete("12345678-90ab-cdef-gh12-34567890abc")
8423
+ */
8424
+ delete(id, requestOptions) {
8425
+ return HttpResponsePromise.fromPromise(this.__delete(id, requestOptions));
8426
+ }
8427
+ __delete(id, requestOptions) {
8428
+ return __awaiter22(this, void 0, void 0, function* () {
8429
+ var _a, _b;
8430
+ const _response = yield fetcher({
8431
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).agents, `agents/${encodeURIComponent(id)}`),
8432
+ method: "DELETE",
8433
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8434
+ Authorization: yield this._getAuthorizationHeader(),
8435
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
8436
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8437
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
8438
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
8439
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
8440
+ });
8441
+ if (_response.ok) {
8442
+ return { data: void 0, rawResponse: _response.rawResponse };
8443
+ }
8444
+ if (_response.error.reason === "status-code") {
8445
+ switch (_response.error.statusCode) {
8446
+ case 400:
8447
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8448
+ case 401:
8449
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8450
+ case 404:
8451
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
8452
+ default:
8453
+ throw new CortiError({
8454
+ statusCode: _response.error.statusCode,
8455
+ body: _response.error.body,
8456
+ rawResponse: _response.rawResponse
8457
+ });
8458
+ }
8459
+ }
8460
+ switch (_response.error.reason) {
8461
+ case "non-json":
8462
+ throw new CortiError({
8463
+ statusCode: _response.error.statusCode,
8464
+ body: _response.error.rawBody,
8465
+ rawResponse: _response.rawResponse
8466
+ });
8467
+ case "timeout":
8468
+ throw new CortiTimeoutError("Timeout exceeded when calling DELETE /agents/{id}.");
8469
+ case "unknown":
8470
+ throw new CortiError({
8471
+ message: _response.error.errorMessage,
8472
+ rawResponse: _response.rawResponse
8473
+ });
8474
+ }
8475
+ });
8476
+ }
8477
+ /**
8478
+ * This endpoint updates an existing agent. Only the fields provided in the request body will be updated; other fields will remain unchanged.
8479
+ *
8480
+ * @param {string} id - The identifier of the agent associated with the context.
8481
+ * @param {Corti.AgentsAgent} request
8482
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
8483
+ *
8484
+ * @throws {@link Corti.BadRequestError}
8485
+ * @throws {@link Corti.UnauthorizedError}
8486
+ * @throws {@link Corti.NotFoundError}
8487
+ *
8488
+ * @example
8489
+ * await client.agents.update("12345678-90ab-cdef-gh12-34567890abc", {
8490
+ * id: "id",
8491
+ * name: "name",
8492
+ * description: "description",
8493
+ * systemPrompt: "systemPrompt"
8494
+ * })
8495
+ */
8496
+ update(id, request, requestOptions) {
8497
+ return HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
8498
+ }
8499
+ __update(id, request, requestOptions) {
8500
+ return __awaiter22(this, void 0, void 0, function* () {
8501
+ var _a, _b;
8502
+ const _response = yield fetcher({
8503
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).agents, `agents/${encodeURIComponent(id)}`),
8504
+ method: "PATCH",
8505
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8506
+ Authorization: yield this._getAuthorizationHeader(),
8507
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
8508
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8509
+ contentType: "application/json",
8510
+ requestType: "json",
8511
+ body: AgentsAgent.jsonOrThrow(request, {
8512
+ unrecognizedObjectKeys: "strip",
8513
+ omitUndefined: true
8514
+ }),
8515
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
8516
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
8517
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
8518
+ });
8519
+ if (_response.ok) {
8520
+ return {
8521
+ data: AgentsAgent.parseOrThrow(_response.body, {
8522
+ unrecognizedObjectKeys: "passthrough",
8523
+ allowUnrecognizedUnionMembers: true,
8524
+ allowUnrecognizedEnumValues: true,
8525
+ skipValidation: true,
8526
+ breadcrumbsPrefix: ["response"]
8527
+ }),
8528
+ rawResponse: _response.rawResponse
8529
+ };
8530
+ }
8531
+ if (_response.error.reason === "status-code") {
8532
+ switch (_response.error.statusCode) {
8533
+ case 400:
8534
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8535
+ case 401:
8536
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8537
+ case 404:
8538
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
8539
+ default:
8540
+ throw new CortiError({
8541
+ statusCode: _response.error.statusCode,
8542
+ body: _response.error.body,
8543
+ rawResponse: _response.rawResponse
8544
+ });
8545
+ }
8546
+ }
8547
+ switch (_response.error.reason) {
8548
+ case "non-json":
8549
+ throw new CortiError({
8550
+ statusCode: _response.error.statusCode,
8551
+ body: _response.error.rawBody,
8552
+ rawResponse: _response.rawResponse
8553
+ });
8554
+ case "timeout":
8555
+ throw new CortiTimeoutError("Timeout exceeded when calling PATCH /agents/{id}.");
8556
+ case "unknown":
8557
+ throw new CortiError({
8558
+ message: _response.error.errorMessage,
8559
+ rawResponse: _response.rawResponse
8560
+ });
8561
+ }
8562
+ });
8563
+ }
8564
+ /**
8565
+ * This endpoint retrieves the agent card in JSON format, which provides metadata about the agent, including its name, description, and the experts it can call.
8566
+ *
8567
+ * @param {string} id - The identifier of the agent associated with the context.
8568
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
8569
+ *
8570
+ * @throws {@link Corti.BadRequestError}
8571
+ * @throws {@link Corti.UnauthorizedError}
8572
+ * @throws {@link Corti.NotFoundError}
8573
+ *
8574
+ * @example
8575
+ * await client.agents.getCard("12345678-90ab-cdef-gh12-34567890abc")
8576
+ */
8577
+ getCard(id, requestOptions) {
8578
+ return HttpResponsePromise.fromPromise(this.__getCard(id, requestOptions));
8579
+ }
8580
+ __getCard(id, requestOptions) {
8581
+ return __awaiter22(this, void 0, void 0, function* () {
8582
+ var _a, _b;
8583
+ const _response = yield fetcher({
8584
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).agents, `agents/${encodeURIComponent(id)}/agent-card.json`),
8585
+ method: "GET",
8586
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8587
+ Authorization: yield this._getAuthorizationHeader(),
8588
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
8589
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8590
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
8591
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
8592
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
8593
+ });
8594
+ if (_response.ok) {
8595
+ return {
8596
+ data: AgentsAgentCard.parseOrThrow(_response.body, {
8597
+ unrecognizedObjectKeys: "passthrough",
8598
+ allowUnrecognizedUnionMembers: true,
8599
+ allowUnrecognizedEnumValues: true,
8600
+ skipValidation: true,
8601
+ breadcrumbsPrefix: ["response"]
8602
+ }),
8603
+ rawResponse: _response.rawResponse
8604
+ };
8605
+ }
8606
+ if (_response.error.reason === "status-code") {
8607
+ switch (_response.error.statusCode) {
8608
+ case 400:
8609
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8610
+ case 401:
8611
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8612
+ case 404:
8613
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
8614
+ default:
8615
+ throw new CortiError({
8616
+ statusCode: _response.error.statusCode,
8617
+ body: _response.error.body,
8618
+ rawResponse: _response.rawResponse
8619
+ });
8620
+ }
8621
+ }
8622
+ switch (_response.error.reason) {
8623
+ case "non-json":
8624
+ throw new CortiError({
8625
+ statusCode: _response.error.statusCode,
8626
+ body: _response.error.rawBody,
8627
+ rawResponse: _response.rawResponse
8628
+ });
8629
+ case "timeout":
8630
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}/agent-card.json.");
8631
+ case "unknown":
8632
+ throw new CortiError({
8633
+ message: _response.error.errorMessage,
8634
+ rawResponse: _response.rawResponse
8635
+ });
8636
+ }
8637
+ });
8638
+ }
8639
+ /**
8640
+ * This endpoint sends a message to the specified agent to start or continue a task. The agent processes the message and returns a response. If the message contains a task ID that matches an ongoing task, the agent will continue that task; otherwise, it will start a new task.
8641
+ *
8642
+ * @param {string} id - The identifier of the agent associated with the context.
8643
+ * @param {Corti.AgentsMessageSendParams} request
8644
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
8645
+ *
8646
+ * @throws {@link Corti.BadRequestError}
8647
+ * @throws {@link Corti.UnauthorizedError}
8648
+ * @throws {@link Corti.NotFoundError}
8649
+ *
8650
+ * @example
8651
+ * await client.agents.messageSend("12345678-90ab-cdef-gh12-34567890abc", {
8652
+ * message: {
8653
+ * role: "user",
8654
+ * parts: [{
8655
+ * kind: "text",
8656
+ * text: "text"
8657
+ * }],
8658
+ * messageId: "messageId",
8659
+ * kind: "message"
8660
+ * }
8661
+ * })
8662
+ */
8663
+ messageSend(id, request, requestOptions) {
8664
+ return HttpResponsePromise.fromPromise(this.__messageSend(id, request, requestOptions));
8665
+ }
8666
+ __messageSend(id, request, requestOptions) {
8667
+ return __awaiter22(this, void 0, void 0, function* () {
8668
+ var _a, _b;
8669
+ const _response = yield fetcher({
8670
+ url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).agents, `agents/${encodeURIComponent(id)}/v1/message:send`),
8671
+ method: "POST",
8672
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8673
+ Authorization: yield this._getAuthorizationHeader(),
8674
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
8675
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8676
+ contentType: "application/json",
8677
+ requestType: "json",
8678
+ body: AgentsMessageSendParams.jsonOrThrow(request, {
8679
+ unrecognizedObjectKeys: "strip",
8680
+ omitUndefined: true
8681
+ }),
8682
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
8683
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
8684
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
8685
+ });
8686
+ if (_response.ok) {
8687
+ return {
8688
+ data: AgentsMessageSendResponse.parseOrThrow(_response.body, {
8689
+ unrecognizedObjectKeys: "passthrough",
8690
+ allowUnrecognizedUnionMembers: true,
8691
+ allowUnrecognizedEnumValues: true,
8692
+ skipValidation: true,
8693
+ breadcrumbsPrefix: ["response"]
8694
+ }),
8695
+ rawResponse: _response.rawResponse
8696
+ };
8697
+ }
8698
+ if (_response.error.reason === "status-code") {
8699
+ switch (_response.error.statusCode) {
8700
+ case 400:
8701
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8702
+ case 401:
8703
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
8704
+ case 404:
8705
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
8706
+ default:
8707
+ throw new CortiError({
8708
+ statusCode: _response.error.statusCode,
8709
+ body: _response.error.body,
8710
+ rawResponse: _response.rawResponse
8711
+ });
8712
+ }
8713
+ }
8714
+ switch (_response.error.reason) {
8715
+ case "non-json":
8716
+ throw new CortiError({
8717
+ statusCode: _response.error.statusCode,
8718
+ body: _response.error.rawBody,
8719
+ rawResponse: _response.rawResponse
8720
+ });
8721
+ case "timeout":
8722
+ throw new CortiTimeoutError("Timeout exceeded when calling POST /agents/{id}/v1/message:send.");
7321
8723
  case "unknown":
7322
8724
  throw new CortiError({
7323
8725
  message: _response.error.errorMessage,
@@ -7326,87 +8728,36 @@ var Documents = class {
7326
8728
  }
7327
8729
  });
7328
8730
  }
7329
- _getAuthorizationHeader() {
7330
- return __awaiter20(this, void 0, void 0, function* () {
7331
- const bearer = yield Supplier.get(this._options.token);
7332
- if (bearer != null) {
7333
- return `Bearer ${bearer}`;
7334
- }
7335
- return void 0;
7336
- });
7337
- }
7338
- };
7339
-
7340
- // node_modules/@corti/sdk/dist/esm/api/resources/templates/client/Client.mjs
7341
- var __awaiter21 = function(thisArg, _arguments, P2, generator) {
7342
- function adopt(value) {
7343
- return value instanceof P2 ? value : new P2(function(resolve) {
7344
- resolve(value);
7345
- });
7346
- }
7347
- return new (P2 || (P2 = Promise))(function(resolve, reject) {
7348
- function fulfilled(value) {
7349
- try {
7350
- step(generator.next(value));
7351
- } catch (e5) {
7352
- reject(e5);
7353
- }
7354
- }
7355
- function rejected(value) {
7356
- try {
7357
- step(generator["throw"](value));
7358
- } catch (e5) {
7359
- reject(e5);
7360
- }
7361
- }
7362
- function step(result) {
7363
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7364
- }
7365
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7366
- });
7367
- };
7368
- var Templates = class {
7369
- constructor(_options) {
7370
- this._options = _options;
7371
- }
7372
8731
  /**
7373
- * Retrieves a list of template sections with optional filters for organization and language.
8732
+ * This endpoint retrieves the status and details of a specific task associated with the given agent. It provides information about the task's current state, history, and any artifacts produced during its execution.
7374
8733
  *
7375
- * @param {Corti.TemplatesSectionListRequest} request
7376
- * @param {Templates.RequestOptions} requestOptions - Request-specific configuration.
8734
+ * @param {string} id - The identifier of the agent associated with the context.
8735
+ * @param {string} taskId - The identifier of the task to retrieve.
8736
+ * @param {Corti.AgentsGetTaskRequest} request
8737
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
7377
8738
  *
8739
+ * @throws {@link Corti.BadRequestError}
7378
8740
  * @throws {@link Corti.UnauthorizedError}
7379
- * @throws {@link Corti.InternalServerError}
8741
+ * @throws {@link Corti.NotFoundError}
7380
8742
  *
7381
8743
  * @example
7382
- * await client.templates.sectionList()
8744
+ * await client.agents.getTask("12345678-90ab-cdef-gh12-34567890abc", "taskId")
7383
8745
  */
7384
- sectionList(request = {}, requestOptions) {
7385
- return HttpResponsePromise.fromPromise(this.__sectionList(request, requestOptions));
8746
+ getTask(id, taskId, request = {}, requestOptions) {
8747
+ return HttpResponsePromise.fromPromise(this.__getTask(id, taskId, request, requestOptions));
7386
8748
  }
7387
- __sectionList() {
7388
- return __awaiter21(this, arguments, void 0, function* (request = {}, requestOptions) {
7389
- var _a, _b;
7390
- const { org, lang } = request;
8749
+ __getTask(id_1, taskId_1) {
8750
+ return __awaiter22(this, arguments, void 0, function* (id, taskId, request = {}, requestOptions) {
8751
+ var _a, _b, _c;
8752
+ const { historyLength } = request;
7391
8753
  const _queryParams = {};
7392
- if (org != null) {
7393
- if (Array.isArray(org)) {
7394
- _queryParams["org"] = org.map((item) => item);
7395
- } else {
7396
- _queryParams["org"] = org;
7397
- }
7398
- }
7399
- if (lang != null) {
7400
- if (Array.isArray(lang)) {
7401
- _queryParams["lang"] = lang.map((item) => item);
7402
- } else {
7403
- _queryParams["lang"] = lang;
7404
- }
8754
+ if (historyLength !== void 0) {
8755
+ _queryParams["historyLength"] = (_a = historyLength === null || historyLength === void 0 ? void 0 : historyLength.toString()) !== null && _a !== void 0 ? _a : null;
7405
8756
  }
7406
8757
  const _response = yield fetcher({
7407
- url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).base, "templateSections/"),
8758
+ url: url_exports.join((_b = yield Supplier.get(this._options.baseUrl)) !== null && _b !== void 0 ? _b : (yield Supplier.get(this._options.environment)).agents, `agents/${encodeURIComponent(id)}/v1/tasks/${encodeURIComponent(taskId)}`),
7408
8759
  method: "GET",
7409
- headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8760
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({
7410
8761
  Authorization: yield this._getAuthorizationHeader(),
7411
8762
  "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
7412
8763
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
@@ -7417,7 +8768,7 @@ var Templates = class {
7417
8768
  });
7418
8769
  if (_response.ok) {
7419
8770
  return {
7420
- data: TemplatesSectionListResponse.parseOrThrow(_response.body, {
8771
+ data: AgentsTask.parseOrThrow(_response.body, {
7421
8772
  unrecognizedObjectKeys: "passthrough",
7422
8773
  allowUnrecognizedUnionMembers: true,
7423
8774
  allowUnrecognizedEnumValues: true,
@@ -7429,10 +8780,12 @@ var Templates = class {
7429
8780
  }
7430
8781
  if (_response.error.reason === "status-code") {
7431
8782
  switch (_response.error.statusCode) {
8783
+ case 400:
8784
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7432
8785
  case 401:
7433
8786
  throw new UnauthorizedError(_response.error.body, _response.rawResponse);
7434
- case 500:
7435
- throw new InternalServerError(_response.error.body, _response.rawResponse);
8787
+ case 404:
8788
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
7436
8789
  default:
7437
8790
  throw new CortiError({
7438
8791
  statusCode: _response.error.statusCode,
@@ -7449,7 +8802,7 @@ var Templates = class {
7449
8802
  rawResponse: _response.rawResponse
7450
8803
  });
7451
8804
  case "timeout":
7452
- throw new CortiTimeoutError("Timeout exceeded when calling GET /templateSections/.");
8805
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}/v1/tasks/{taskId}.");
7453
8806
  case "unknown":
7454
8807
  throw new CortiError({
7455
8808
  message: _response.error.errorMessage,
@@ -7459,50 +8812,38 @@ var Templates = class {
7459
8812
  });
7460
8813
  }
7461
8814
  /**
7462
- * Retrieves a list of templates with optional filters for organization, language, and status.
8815
+ * This endpoint retrieves all tasks and top-level messages associated with a specific context for the given agent.
7463
8816
  *
7464
- * @param {Corti.TemplatesListRequest} request
7465
- * @param {Templates.RequestOptions} requestOptions - Request-specific configuration.
8817
+ * @param {string} id - The identifier of the agent associated with the context.
8818
+ * @param {string} contextId - The identifier of the context (thread) to retrieve tasks for.
8819
+ * @param {Corti.AgentsGetContextRequest} request
8820
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
7466
8821
  *
8822
+ * @throws {@link Corti.BadRequestError}
7467
8823
  * @throws {@link Corti.UnauthorizedError}
7468
- * @throws {@link Corti.InternalServerError}
8824
+ * @throws {@link Corti.NotFoundError}
7469
8825
  *
7470
8826
  * @example
7471
- * await client.templates.list()
8827
+ * await client.agents.getContext("12345678-90ab-cdef-gh12-34567890abc", "contextId")
7472
8828
  */
7473
- list(request = {}, requestOptions) {
7474
- return HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
8829
+ getContext(id, contextId, request = {}, requestOptions) {
8830
+ return HttpResponsePromise.fromPromise(this.__getContext(id, contextId, request, requestOptions));
7475
8831
  }
7476
- __list() {
7477
- return __awaiter21(this, arguments, void 0, function* (request = {}, requestOptions) {
7478
- var _a, _b;
7479
- const { org, lang, status } = request;
8832
+ __getContext(id_1, contextId_1) {
8833
+ return __awaiter22(this, arguments, void 0, function* (id, contextId, request = {}, requestOptions) {
8834
+ var _a, _b, _c, _d;
8835
+ const { limit, offset } = request;
7480
8836
  const _queryParams = {};
7481
- if (org != null) {
7482
- if (Array.isArray(org)) {
7483
- _queryParams["org"] = org.map((item) => item);
7484
- } else {
7485
- _queryParams["org"] = org;
7486
- }
7487
- }
7488
- if (lang != null) {
7489
- if (Array.isArray(lang)) {
7490
- _queryParams["lang"] = lang.map((item) => item);
7491
- } else {
7492
- _queryParams["lang"] = lang;
7493
- }
8837
+ if (limit !== void 0) {
8838
+ _queryParams["limit"] = (_a = limit === null || limit === void 0 ? void 0 : limit.toString()) !== null && _a !== void 0 ? _a : null;
7494
8839
  }
7495
- if (status != null) {
7496
- if (Array.isArray(status)) {
7497
- _queryParams["status"] = status.map((item) => item);
7498
- } else {
7499
- _queryParams["status"] = status;
7500
- }
8840
+ if (offset !== void 0) {
8841
+ _queryParams["offset"] = (_b = offset === null || offset === void 0 ? void 0 : offset.toString()) !== null && _b !== void 0 ? _b : null;
7501
8842
  }
7502
8843
  const _response = yield fetcher({
7503
- url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).base, "templates/"),
8844
+ url: url_exports.join((_c = yield Supplier.get(this._options.baseUrl)) !== null && _c !== void 0 ? _c : (yield Supplier.get(this._options.environment)).agents, `agents/${encodeURIComponent(id)}/v1/contexts/${encodeURIComponent(contextId)}`),
7504
8845
  method: "GET",
7505
- headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8846
+ headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({
7506
8847
  Authorization: yield this._getAuthorizationHeader(),
7507
8848
  "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
7508
8849
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
@@ -7513,7 +8854,7 @@ var Templates = class {
7513
8854
  });
7514
8855
  if (_response.ok) {
7515
8856
  return {
7516
- data: TemplatesListResponse.parseOrThrow(_response.body, {
8857
+ data: AgentsContext.parseOrThrow(_response.body, {
7517
8858
  unrecognizedObjectKeys: "passthrough",
7518
8859
  allowUnrecognizedUnionMembers: true,
7519
8860
  allowUnrecognizedEnumValues: true,
@@ -7525,10 +8866,12 @@ var Templates = class {
7525
8866
  }
7526
8867
  if (_response.error.reason === "status-code") {
7527
8868
  switch (_response.error.statusCode) {
8869
+ case 400:
8870
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7528
8871
  case 401:
7529
8872
  throw new UnauthorizedError(_response.error.body, _response.rawResponse);
7530
- case 500:
7531
- throw new InternalServerError(_response.error.body, _response.rawResponse);
8873
+ case 404:
8874
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
7532
8875
  default:
7533
8876
  throw new CortiError({
7534
8877
  statusCode: _response.error.statusCode,
@@ -7545,7 +8888,7 @@ var Templates = class {
7545
8888
  rawResponse: _response.rawResponse
7546
8889
  });
7547
8890
  case "timeout":
7548
- throw new CortiTimeoutError("Timeout exceeded when calling GET /templates/.");
8891
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}/v1/contexts/{contextId}.");
7549
8892
  case "unknown":
7550
8893
  throw new CortiError({
7551
8894
  message: _response.error.errorMessage,
@@ -7555,37 +8898,49 @@ var Templates = class {
7555
8898
  });
7556
8899
  }
7557
8900
  /**
7558
- * Retrieves template by key.
8901
+ * This endpoint retrieves the experts registry, which contains information about all available experts that can be referenced when creating agents through the AgentsExpertReference schema.
7559
8902
  *
7560
- * @param {string} key - The key of the template
7561
- * @param {Templates.RequestOptions} requestOptions - Request-specific configuration.
8903
+ * @param {Corti.AgentsGetRegistryExpertsRequest} request
8904
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
7562
8905
  *
8906
+ * @throws {@link Corti.BadRequestError}
7563
8907
  * @throws {@link Corti.UnauthorizedError}
7564
- * @throws {@link Corti.InternalServerError}
7565
8908
  *
7566
8909
  * @example
7567
- * await client.templates.get("key")
8910
+ * await client.agents.getRegistryExperts({
8911
+ * limit: 100,
8912
+ * offset: 0
8913
+ * })
7568
8914
  */
7569
- get(key, requestOptions) {
7570
- return HttpResponsePromise.fromPromise(this.__get(key, requestOptions));
8915
+ getRegistryExperts(request = {}, requestOptions) {
8916
+ return HttpResponsePromise.fromPromise(this.__getRegistryExperts(request, requestOptions));
7571
8917
  }
7572
- __get(key, requestOptions) {
7573
- return __awaiter21(this, void 0, void 0, function* () {
7574
- var _a, _b;
8918
+ __getRegistryExperts() {
8919
+ return __awaiter22(this, arguments, void 0, function* (request = {}, requestOptions) {
8920
+ var _a, _b, _c, _d;
8921
+ const { limit, offset } = request;
8922
+ const _queryParams = {};
8923
+ if (limit !== void 0) {
8924
+ _queryParams["limit"] = (_a = limit === null || limit === void 0 ? void 0 : limit.toString()) !== null && _a !== void 0 ? _a : null;
8925
+ }
8926
+ if (offset !== void 0) {
8927
+ _queryParams["offset"] = (_b = offset === null || offset === void 0 ? void 0 : offset.toString()) !== null && _b !== void 0 ? _b : null;
8928
+ }
7575
8929
  const _response = yield fetcher({
7576
- url: url_exports.join((_a = yield Supplier.get(this._options.baseUrl)) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options.environment)).base, `templates/${encodeURIComponent(key)}`),
8930
+ url: url_exports.join((_c = yield Supplier.get(this._options.baseUrl)) !== null && _c !== void 0 ? _c : (yield Supplier.get(this._options.environment)).agents, "agents/registry/experts"),
7577
8931
  method: "GET",
7578
- headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
8932
+ headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({
7579
8933
  Authorization: yield this._getAuthorizationHeader(),
7580
8934
  "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName
7581
8935
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
8936
+ queryParameters: _queryParams,
7582
8937
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
7583
8938
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
7584
8939
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal
7585
8940
  });
7586
8941
  if (_response.ok) {
7587
8942
  return {
7588
- data: TemplatesItem.parseOrThrow(_response.body, {
8943
+ data: AgentsRegistryExpertsResponse.parseOrThrow(_response.body, {
7589
8944
  unrecognizedObjectKeys: "passthrough",
7590
8945
  allowUnrecognizedUnionMembers: true,
7591
8946
  allowUnrecognizedEnumValues: true,
@@ -7597,10 +8952,10 @@ var Templates = class {
7597
8952
  }
7598
8953
  if (_response.error.reason === "status-code") {
7599
8954
  switch (_response.error.statusCode) {
8955
+ case 400:
8956
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7600
8957
  case 401:
7601
8958
  throw new UnauthorizedError(_response.error.body, _response.rawResponse);
7602
- case 500:
7603
- throw new InternalServerError(_response.error.body, _response.rawResponse);
7604
8959
  default:
7605
8960
  throw new CortiError({
7606
8961
  statusCode: _response.error.statusCode,
@@ -7617,7 +8972,7 @@ var Templates = class {
7617
8972
  rawResponse: _response.rawResponse
7618
8973
  });
7619
8974
  case "timeout":
7620
- throw new CortiTimeoutError("Timeout exceeded when calling GET /templates/{key}.");
8975
+ throw new CortiTimeoutError("Timeout exceeded when calling GET /agents/registry/experts.");
7621
8976
  case "unknown":
7622
8977
  throw new CortiError({
7623
8978
  message: _response.error.errorMessage,
@@ -7627,7 +8982,7 @@ var Templates = class {
7627
8982
  });
7628
8983
  }
7629
8984
  _getAuthorizationHeader() {
7630
- return __awaiter21(this, void 0, void 0, function* () {
8985
+ return __awaiter22(this, void 0, void 0, function* () {
7631
8986
  const bearer = yield Supplier.get(this._options.token);
7632
8987
  if (bearer != null) {
7633
8988
  return `Bearer ${bearer}`;
@@ -7638,7 +8993,7 @@ var Templates = class {
7638
8993
  };
7639
8994
 
7640
8995
  // node_modules/@corti/sdk/dist/esm/api/resources/stream/client/Socket.mjs
7641
- var __awaiter22 = function(thisArg, _arguments, P2, generator) {
8996
+ var __awaiter23 = function(thisArg, _arguments, P2, generator) {
7642
8997
  function adopt(value) {
7643
8998
  return value instanceof P2 ? value : new P2(function(resolve) {
7644
8999
  resolve(value);
@@ -7773,7 +9128,7 @@ var StreamSocket = class {
7773
9128
  }
7774
9129
  /** Returns a promise that resolves when the websocket is open. */
7775
9130
  waitForOpen() {
7776
- return __awaiter22(this, void 0, void 0, function* () {
9131
+ return __awaiter23(this, void 0, void 0, function* () {
7777
9132
  if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
7778
9133
  return this.socket;
7779
9134
  }
@@ -7803,7 +9158,7 @@ var StreamSocket = class {
7803
9158
  };
7804
9159
 
7805
9160
  // node_modules/@corti/sdk/dist/esm/api/resources/stream/client/Client.mjs
7806
- var __awaiter23 = function(thisArg, _arguments, P2, generator) {
9161
+ var __awaiter24 = function(thisArg, _arguments, P2, generator) {
7807
9162
  function adopt(value) {
7808
9163
  return value instanceof P2 ? value : new P2(function(resolve) {
7809
9164
  resolve(value);
@@ -7835,7 +9190,7 @@ var Stream = class {
7835
9190
  this._options = _options;
7836
9191
  }
7837
9192
  connect(args) {
7838
- return __awaiter23(this, void 0, void 0, function* () {
9193
+ return __awaiter24(this, void 0, void 0, function* () {
7839
9194
  var _a;
7840
9195
  const { id, tenantName, token, headers, debug, reconnectAttempts } = args;
7841
9196
  const _queryParams = {};
@@ -7853,7 +9208,7 @@ var Stream = class {
7853
9208
  });
7854
9209
  }
7855
9210
  _getAuthorizationHeader() {
7856
- return __awaiter23(this, void 0, void 0, function* () {
9211
+ return __awaiter24(this, void 0, void 0, function* () {
7857
9212
  const bearer = yield Supplier.get(this._options.token);
7858
9213
  if (bearer != null) {
7859
9214
  return `Bearer ${bearer}`;
@@ -7894,7 +9249,7 @@ var StreamSocket2 = class extends StreamSocket {
7894
9249
  };
7895
9250
 
7896
9251
  // node_modules/@corti/sdk/dist/esm/custom/CustomStream.mjs
7897
- var __awaiter24 = function(thisArg, _arguments, P2, generator) {
9252
+ var __awaiter25 = function(thisArg, _arguments, P2, generator) {
7898
9253
  function adopt(value) {
7899
9254
  return value instanceof P2 ? value : new P2(function(resolve) {
7900
9255
  resolve(value);
@@ -7921,7 +9276,7 @@ var __awaiter24 = function(thisArg, _arguments, P2, generator) {
7921
9276
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7922
9277
  });
7923
9278
  };
7924
- var __rest2 = function(s4, e5) {
9279
+ var __rest3 = function(s4, e5) {
7925
9280
  var t4 = {};
7926
9281
  for (var p3 in s4) if (Object.prototype.hasOwnProperty.call(s4, p3) && e5.indexOf(p3) < 0)
7927
9282
  t4[p3] = s4[p3];
@@ -7940,8 +9295,8 @@ var Stream2 = class extends Stream {
7940
9295
  const _super = Object.create(null, {
7941
9296
  connect: { get: () => super.connect }
7942
9297
  });
7943
- return __awaiter24(this, void 0, void 0, function* () {
7944
- var { configuration } = _a, args = __rest2(_a, ["configuration"]);
9298
+ return __awaiter25(this, void 0, void 0, function* () {
9299
+ var { configuration } = _a, args = __rest3(_a, ["configuration"]);
7945
9300
  const fernWs = yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || "", tenantName: yield Supplier.get(this._options.tenantName) }));
7946
9301
  const ws = new StreamSocket2({ socket: fernWs.socket });
7947
9302
  if (!configuration) {
@@ -7992,7 +9347,7 @@ var Stream2 = class extends Stream {
7992
9347
  };
7993
9348
 
7994
9349
  // node_modules/@corti/sdk/dist/esm/api/resources/transcribe/client/Socket.mjs
7995
- var __awaiter25 = function(thisArg, _arguments, P2, generator) {
9350
+ var __awaiter26 = function(thisArg, _arguments, P2, generator) {
7996
9351
  function adopt(value) {
7997
9352
  return value instanceof P2 ? value : new P2(function(resolve) {
7998
9353
  resolve(value);
@@ -8127,7 +9482,7 @@ var TranscribeSocket = class {
8127
9482
  }
8128
9483
  /** Returns a promise that resolves when the websocket is open. */
8129
9484
  waitForOpen() {
8130
- return __awaiter25(this, void 0, void 0, function* () {
9485
+ return __awaiter26(this, void 0, void 0, function* () {
8131
9486
  if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
8132
9487
  return this.socket;
8133
9488
  }
@@ -8157,7 +9512,7 @@ var TranscribeSocket = class {
8157
9512
  };
8158
9513
 
8159
9514
  // node_modules/@corti/sdk/dist/esm/api/resources/transcribe/client/Client.mjs
8160
- var __awaiter26 = function(thisArg, _arguments, P2, generator) {
9515
+ var __awaiter27 = function(thisArg, _arguments, P2, generator) {
8161
9516
  function adopt(value) {
8162
9517
  return value instanceof P2 ? value : new P2(function(resolve) {
8163
9518
  resolve(value);
@@ -8189,7 +9544,7 @@ var Transcribe = class {
8189
9544
  this._options = _options;
8190
9545
  }
8191
9546
  connect(args) {
8192
- return __awaiter26(this, void 0, void 0, function* () {
9547
+ return __awaiter27(this, void 0, void 0, function* () {
8193
9548
  var _a;
8194
9549
  const { tenantName, token, headers, debug, reconnectAttempts } = args;
8195
9550
  const _queryParams = {};
@@ -8207,7 +9562,7 @@ var Transcribe = class {
8207
9562
  });
8208
9563
  }
8209
9564
  _getAuthorizationHeader() {
8210
- return __awaiter26(this, void 0, void 0, function* () {
9565
+ return __awaiter27(this, void 0, void 0, function* () {
8211
9566
  const bearer = yield Supplier.get(this._options.token);
8212
9567
  if (bearer != null) {
8213
9568
  return `Bearer ${bearer}`;
@@ -8248,7 +9603,7 @@ var TranscribeSocket2 = class extends TranscribeSocket {
8248
9603
  };
8249
9604
 
8250
9605
  // node_modules/@corti/sdk/dist/esm/custom/CustomTranscribe.mjs
8251
- var __awaiter27 = function(thisArg, _arguments, P2, generator) {
9606
+ var __awaiter28 = function(thisArg, _arguments, P2, generator) {
8252
9607
  function adopt(value) {
8253
9608
  return value instanceof P2 ? value : new P2(function(resolve) {
8254
9609
  resolve(value);
@@ -8275,7 +9630,7 @@ var __awaiter27 = function(thisArg, _arguments, P2, generator) {
8275
9630
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8276
9631
  });
8277
9632
  };
8278
- var __rest3 = function(s4, e5) {
9633
+ var __rest4 = function(s4, e5) {
8279
9634
  var t4 = {};
8280
9635
  for (var p3 in s4) if (Object.prototype.hasOwnProperty.call(s4, p3) && e5.indexOf(p3) < 0)
8281
9636
  t4[p3] = s4[p3];
@@ -8294,8 +9649,8 @@ var Transcribe2 = class extends Transcribe {
8294
9649
  const _super = Object.create(null, {
8295
9650
  connect: { get: () => super.connect }
8296
9651
  });
8297
- return __awaiter27(this, arguments, void 0, function* (_a = {}) {
8298
- var { configuration } = _a, args = __rest3(_a, ["configuration"]);
9652
+ return __awaiter28(this, arguments, void 0, function* (_a = {}) {
9653
+ var { configuration } = _a, args = __rest4(_a, ["configuration"]);
8299
9654
  const fernWs = yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || "", tenantName: yield Supplier.get(this._options.tenantName) }));
8300
9655
  const ws = new TranscribeSocket2({ socket: fernWs.socket });
8301
9656
  if (!configuration) {
@@ -8346,10 +9701,93 @@ var Transcribe2 = class extends Transcribe {
8346
9701
  };
8347
9702
 
8348
9703
  // node_modules/@corti/sdk/dist/esm/version.mjs
8349
- var SDK_VERSION = "0.1.2";
9704
+ var SDK_VERSION = "0.5.0";
9705
+
9706
+ // node_modules/@corti/sdk/dist/esm/custom/utils/resolveClientOptions.mjs
9707
+ var __awaiter29 = function(thisArg, _arguments, P2, generator) {
9708
+ function adopt(value) {
9709
+ return value instanceof P2 ? value : new P2(function(resolve) {
9710
+ resolve(value);
9711
+ });
9712
+ }
9713
+ return new (P2 || (P2 = Promise))(function(resolve, reject) {
9714
+ function fulfilled(value) {
9715
+ try {
9716
+ step(generator.next(value));
9717
+ } catch (e5) {
9718
+ reject(e5);
9719
+ }
9720
+ }
9721
+ function rejected(value) {
9722
+ try {
9723
+ step(generator["throw"](value));
9724
+ } catch (e5) {
9725
+ reject(e5);
9726
+ }
9727
+ }
9728
+ function step(result) {
9729
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
9730
+ }
9731
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9732
+ });
9733
+ };
9734
+ function isClientCredentialsOptions(options) {
9735
+ return "clientId" in options.auth;
9736
+ }
9737
+ function resolveClientOptions(options) {
9738
+ if (isClientCredentialsOptions(options)) {
9739
+ return {
9740
+ tenantName: options.tenantName,
9741
+ environment: options.environment
9742
+ };
9743
+ }
9744
+ if ("accessToken" in options.auth && options.auth.accessToken) {
9745
+ const decoded = decodeToken2(options.auth.accessToken);
9746
+ if (!decoded) {
9747
+ throw new ParseError([
9748
+ {
9749
+ path: ["auth", "accessToken"],
9750
+ message: "Invalid access token format"
9751
+ }
9752
+ ]);
9753
+ }
9754
+ return {
9755
+ tenantName: options.tenantName || decoded.tenantName,
9756
+ environment: options.environment || decoded.environment
9757
+ };
9758
+ }
9759
+ if (options.tenantName && options.environment) {
9760
+ return {
9761
+ tenantName: options.tenantName,
9762
+ environment: options.environment
9763
+ };
9764
+ }
9765
+ const tokenResponsePromise = (() => __awaiter29(this, void 0, void 0, function* () {
9766
+ const tokenResponse = yield Supplier.get(options.auth.refreshAccessToken);
9767
+ const decoded = decodeToken2(tokenResponse.accessToken);
9768
+ if (!decoded) {
9769
+ throw new ParseError([
9770
+ {
9771
+ path: ["auth", "refreshAccessToken"],
9772
+ message: "Returned invalid access token format"
9773
+ }
9774
+ ]);
9775
+ }
9776
+ return {
9777
+ tokenResponse,
9778
+ tenantName: decoded.tenantName,
9779
+ environment: decoded.environment
9780
+ };
9781
+ }))();
9782
+ return {
9783
+ tenantName: options.tenantName || tokenResponsePromise.then(({ tenantName }) => tenantName),
9784
+ environment: options.environment || tokenResponsePromise.then(({ environment }) => Supplier.get(getEnvironment(environment))),
9785
+ initialTokenResponse: tokenResponsePromise.then((result) => result.tokenResponse)
9786
+ };
9787
+ }
8350
9788
 
8351
9789
  // node_modules/@corti/sdk/dist/esm/custom/CortiClient.mjs
8352
- var __awaiter28 = function(thisArg, _arguments, P2, generator) {
9790
+ var __awaiter30 = function(thisArg, _arguments, P2, generator) {
8353
9791
  function adopt(value) {
8354
9792
  return value instanceof P2 ? value : new P2(function(resolve) {
8355
9793
  resolve(value);
@@ -8378,8 +9816,9 @@ var __awaiter28 = function(thisArg, _arguments, P2, generator) {
8378
9816
  };
8379
9817
  var CortiClient = class {
8380
9818
  constructor(_options) {
9819
+ const { tenantName, environment, initialTokenResponse } = resolveClientOptions(_options);
8381
9820
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
8382
- "Tenant-Name": _options === null || _options === void 0 ? void 0 : _options.tenantName,
9821
+ "Tenant-Name": tenantName,
8383
9822
  "X-Fern-Language": "JavaScript",
8384
9823
  "X-Fern-SDK-Name": "@corti/sdk",
8385
9824
  /**
@@ -8389,7 +9828,7 @@ var CortiClient = class {
8389
9828
  "User-Agent": `@corti/sdk/${SDK_VERSION}`,
8390
9829
  "X-Fern-Runtime": RUNTIME.type,
8391
9830
  "X-Fern-Runtime-Version": RUNTIME.version
8392
- }, _options === null || _options === void 0 ? void 0 : _options.headers), clientId: "clientId" in _options.auth ? _options.auth.clientId : void 0, clientSecret: "clientSecret" in _options.auth ? _options.auth.clientSecret : void 0, token: "accessToken" in _options.auth ? _options.auth.accessToken : void 0, environment: getEnvironment(_options.environment) });
9831
+ }, _options === null || _options === void 0 ? void 0 : _options.headers), clientId: "clientId" in _options.auth ? _options.auth.clientId : void 0, clientSecret: "clientSecret" in _options.auth ? _options.auth.clientSecret : void 0, token: "accessToken" in _options.auth ? _options.auth.accessToken : void 0, tenantName, environment: getEnvironment(environment) });
8393
9832
  this._oauthTokenProvider = "clientId" in _options.auth ? new OAuthTokenProvider({
8394
9833
  clientId: _options.auth.clientId,
8395
9834
  clientSecret: _options.auth.clientSecret,
@@ -8397,53 +9836,59 @@ var CortiClient = class {
8397
9836
  * Patch: provide whole `options` object to the Auth client, since it depends on both tenantName and environment
8398
9837
  */
8399
9838
  authClient: new Auth2(this._options)
8400
- }) : new RefreshBearerProvider(_options.auth);
9839
+ }) : new RefreshBearerProvider(Object.assign(Object.assign({}, _options.auth), { initialTokenResponse }));
8401
9840
  }
8402
9841
  get interactions() {
8403
9842
  var _a;
8404
- return (_a = this._interactions) !== null && _a !== void 0 ? _a : this._interactions = new Interactions(Object.assign(Object.assign({}, this._options), { token: () => __awaiter28(this, void 0, void 0, function* () {
9843
+ return (_a = this._interactions) !== null && _a !== void 0 ? _a : this._interactions = new Interactions(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
8405
9844
  return yield this._oauthTokenProvider.getToken();
8406
9845
  }) }));
8407
9846
  }
8408
9847
  get recordings() {
8409
9848
  var _a;
8410
- return (_a = this._recordings) !== null && _a !== void 0 ? _a : this._recordings = new Recordings(Object.assign(Object.assign({}, this._options), { token: () => __awaiter28(this, void 0, void 0, function* () {
9849
+ return (_a = this._recordings) !== null && _a !== void 0 ? _a : this._recordings = new Recordings(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
8411
9850
  return yield this._oauthTokenProvider.getToken();
8412
9851
  }) }));
8413
9852
  }
8414
9853
  get transcripts() {
8415
9854
  var _a;
8416
- return (_a = this._transcripts) !== null && _a !== void 0 ? _a : this._transcripts = new Transcripts(Object.assign(Object.assign({}, this._options), { token: () => __awaiter28(this, void 0, void 0, function* () {
9855
+ return (_a = this._transcripts) !== null && _a !== void 0 ? _a : this._transcripts = new Transcripts(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
8417
9856
  return yield this._oauthTokenProvider.getToken();
8418
9857
  }) }));
8419
9858
  }
8420
9859
  get facts() {
8421
9860
  var _a;
8422
- return (_a = this._facts) !== null && _a !== void 0 ? _a : this._facts = new Facts(Object.assign(Object.assign({}, this._options), { token: () => __awaiter28(this, void 0, void 0, function* () {
9861
+ return (_a = this._facts) !== null && _a !== void 0 ? _a : this._facts = new Facts(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
8423
9862
  return yield this._oauthTokenProvider.getToken();
8424
9863
  }) }));
8425
9864
  }
8426
9865
  get documents() {
8427
9866
  var _a;
8428
- return (_a = this._documents) !== null && _a !== void 0 ? _a : this._documents = new Documents(Object.assign(Object.assign({}, this._options), { token: () => __awaiter28(this, void 0, void 0, function* () {
9867
+ return (_a = this._documents) !== null && _a !== void 0 ? _a : this._documents = new Documents(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
8429
9868
  return yield this._oauthTokenProvider.getToken();
8430
9869
  }) }));
8431
9870
  }
8432
9871
  get templates() {
8433
9872
  var _a;
8434
- return (_a = this._templates) !== null && _a !== void 0 ? _a : this._templates = new Templates(Object.assign(Object.assign({}, this._options), { token: () => __awaiter28(this, void 0, void 0, function* () {
9873
+ return (_a = this._templates) !== null && _a !== void 0 ? _a : this._templates = new Templates(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
9874
+ return yield this._oauthTokenProvider.getToken();
9875
+ }) }));
9876
+ }
9877
+ get agents() {
9878
+ var _a;
9879
+ return (_a = this._agents) !== null && _a !== void 0 ? _a : this._agents = new Agents(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
8435
9880
  return yield this._oauthTokenProvider.getToken();
8436
9881
  }) }));
8437
9882
  }
8438
9883
  get stream() {
8439
9884
  var _a;
8440
- return (_a = this._stream) !== null && _a !== void 0 ? _a : this._stream = new Stream2(Object.assign(Object.assign({}, this._options), { token: () => __awaiter28(this, void 0, void 0, function* () {
9885
+ return (_a = this._stream) !== null && _a !== void 0 ? _a : this._stream = new Stream2(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
8441
9886
  return yield this._oauthTokenProvider.getToken();
8442
9887
  }) }));
8443
9888
  }
8444
9889
  get transcribe() {
8445
9890
  var _a;
8446
- return (_a = this._transcribe) !== null && _a !== void 0 ? _a : this._transcribe = new Transcribe2(Object.assign(Object.assign({}, this._options), { token: () => __awaiter28(this, void 0, void 0, function* () {
9891
+ return (_a = this._transcribe) !== null && _a !== void 0 ? _a : this._transcribe = new Transcribe2(Object.assign(Object.assign({}, this._options), { token: () => __awaiter30(this, void 0, void 0, function* () {
8447
9892
  return yield this._oauthTokenProvider.getToken();
8448
9893
  }) }));
8449
9894
  }
@@ -8456,18 +9901,15 @@ var DictationService = class extends EventTarget {
8456
9901
  this.mediaRecorder = new MediaRecorder(mediaStream);
8457
9902
  this.serverConfig = serverConfig;
8458
9903
  this.dictationConfig = dictationConfig;
8459
- const { environment, tenant: tenantName, expiresAt, refreshExpiresAt, ...authConfig } = serverConfig;
8460
- const now = Math.floor(Date.now() / 1e3);
8461
- const expiresIn = expiresAt ? expiresAt - now : void 0;
8462
- const refreshExpiresIn = refreshExpiresAt ? refreshExpiresAt - now : void 0;
9904
+ const {
9905
+ expiresIn,
9906
+ // eslint-disable-line @typescript-eslint/no-unused-vars
9907
+ refreshExpiresIn,
9908
+ // eslint-disable-line @typescript-eslint/no-unused-vars
9909
+ ...authConfig
9910
+ } = serverConfig;
8463
9911
  this.cortiClient = new CortiClient({
8464
- environment,
8465
- tenantName,
8466
- auth: {
8467
- expiresIn,
8468
- refreshExpiresIn,
8469
- ...authConfig
8470
- }
9912
+ auth: authConfig
8471
9913
  });
8472
9914
  this.mediaRecorder.ondataavailable = (event) => {
8473
9915
  if (this.webSocket?.readyState === WebSocket.OPEN) {
@@ -9379,6 +10821,13 @@ var CortiDictation = class extends i4 {
9379
10821
  toggleRecording() {
9380
10822
  this._toggleRecording();
9381
10823
  }
10824
+ /**
10825
+ * Sets the access token and returns the server configuration.
10826
+ *
10827
+ * NOTE: We decode the token here only for backward compatibility in return values.
10828
+ * The SDK now handles token parsing internally, so this return value should be
10829
+ * reduced in the future to only include necessary fields.
10830
+ */
9382
10831
  setAccessToken(token) {
9383
10832
  try {
9384
10833
  const decoded = decodeToken(token);
@@ -9388,6 +10837,13 @@ var CortiDictation = class extends i4 {
9388
10837
  throw new Error("Invalid token");
9389
10838
  }
9390
10839
  }
10840
+ /**
10841
+ * Sets the authentication configuration and returns the server configuration.
10842
+ *
10843
+ * NOTE: We decode tokens here only for backward compatibility in return values.
10844
+ * The SDK now handles token parsing internally, so this return value should be
10845
+ * reduced in the future to only include necessary fields.
10846
+ */
9391
10847
  async setAuthConfig(config) {
9392
10848
  try {
9393
10849
  const initialToken = "accessToken" in config ? { accessToken: config.accessToken, refreshToken: config.refreshToken } : await config.refreshAccessToken();
@@ -9395,7 +10851,6 @@ var CortiDictation = class extends i4 {
9395
10851
  throw new Error("Access token is required and must be a string");
9396
10852
  }
9397
10853
  const decoded = decodeToken(initialToken.accessToken);
9398
- const refreshDecoded = initialToken.refreshToken ? decodeToken(initialToken.refreshToken) : void 0;
9399
10854
  if (!decoded) {
9400
10855
  throw new Error("Invalid token format");
9401
10856
  }
@@ -9403,9 +10858,7 @@ var CortiDictation = class extends i4 {
9403
10858
  environment: decoded.environment,
9404
10859
  tenant: decoded.tenant,
9405
10860
  accessToken: initialToken.accessToken,
9406
- expiresAt: decoded.expiresAt,
9407
10861
  refreshToken: config.refreshToken,
9408
- refreshExpiresAt: refreshDecoded?.expiresAt,
9409
10862
  refreshAccessToken: async (refreshToken) => {
9410
10863
  try {
9411
10864
  if (!config.refreshAccessToken) {
@@ -9416,12 +10869,8 @@ var CortiDictation = class extends i4 {
9416
10869
  };
9417
10870
  }
9418
10871
  const response = await config.refreshAccessToken(refreshToken);
9419
- const decoded2 = decodeToken(response.accessToken);
9420
- const refreshDecoded2 = response.refreshToken ? decodeToken(response.refreshToken) : void 0;
9421
10872
  if (this._serverConfig) {
9422
10873
  this._serverConfig.accessToken = response.accessToken;
9423
- this._serverConfig.expiresAt = decoded2?.expiresAt;
9424
- this._serverConfig.refreshExpiresAt = refreshDecoded2?.expiresAt;
9425
10874
  this._serverConfig.refreshToken = response.refreshToken;
9426
10875
  }
9427
10876
  return response;
@@ -9432,7 +10881,7 @@ var CortiDictation = class extends i4 {
9432
10881
  };
9433
10882
  return this._serverConfig;
9434
10883
  } catch (e5) {
9435
- throw new Error("Invalid token");
10884
+ throw new Error("Invalid config");
9436
10885
  }
9437
10886
  }
9438
10887
  get selectedDevice() {