@getsupervisor/agents-studio-sdk 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -523,6 +523,14 @@ function createAgentScheduleApi(cfg) {
523
523
  });
524
524
  return res.json();
525
525
  },
526
+ async create(agentId, payload) {
527
+ const res = await doFetch(`${base}/v1/agents/${agentId}/schedule`, {
528
+ method: "POST",
529
+ headers: jsonHeaders,
530
+ body: JSON.stringify(payload)
531
+ });
532
+ return res.json();
533
+ },
526
534
  async update(agentId, payload) {
527
535
  const res = await doFetch(`${base}/v1/agents/${agentId}/schedule`, {
528
536
  method: "PUT",
@@ -534,6 +542,72 @@ function createAgentScheduleApi(cfg) {
534
542
  };
535
543
  }
536
544
 
545
+ // src/api/agent-schedule-exceptions.ts
546
+ function createAgentScheduleExceptionsApi(cfg) {
547
+ const { base, doFetch } = createHttp(cfg);
548
+ const jsonHeaders = { "content-type": "application/json" };
549
+ const fetchExceptionsPage = async (agentId, options = {}) => {
550
+ const query = serializeListOptions(options ?? {});
551
+ const res = await doFetch(
552
+ `${base}/v1/agents/${agentId}/schedule/exceptions`,
553
+ {
554
+ method: "GET",
555
+ query
556
+ }
557
+ );
558
+ return res.json();
559
+ };
560
+ return {
561
+ async list(agentId, options = {}) {
562
+ const normalizedOptions = {
563
+ ...options ?? {}
564
+ };
565
+ const fetchPage = (pageOptions) => fetchExceptionsPage(agentId, pageOptions);
566
+ const response = await fetchPage(normalizedOptions);
567
+ return attachPaginator(response, fetchPage, normalizedOptions);
568
+ },
569
+ async get(agentId, exceptionId) {
570
+ const res = await doFetch(
571
+ `${base}/v1/agents/${agentId}/schedule/exceptions/${exceptionId}`,
572
+ {
573
+ method: "GET"
574
+ }
575
+ );
576
+ return res.json();
577
+ },
578
+ async create(agentId, payload) {
579
+ const res = await doFetch(
580
+ `${base}/v1/agents/${agentId}/schedule/exceptions`,
581
+ {
582
+ method: "POST",
583
+ headers: jsonHeaders,
584
+ body: JSON.stringify(payload)
585
+ }
586
+ );
587
+ return res.json();
588
+ },
589
+ async update(agentId, exceptionId, payload) {
590
+ const res = await doFetch(
591
+ `${base}/v1/agents/${agentId}/schedule/exceptions/${exceptionId}`,
592
+ {
593
+ method: "PATCH",
594
+ headers: jsonHeaders,
595
+ body: JSON.stringify(payload)
596
+ }
597
+ );
598
+ return res.json();
599
+ },
600
+ async delete(agentId, exceptionId) {
601
+ await doFetch(
602
+ `${base}/v1/agents/${agentId}/schedule/exceptions/${exceptionId}`,
603
+ {
604
+ method: "DELETE"
605
+ }
606
+ );
607
+ }
608
+ };
609
+ }
610
+
537
611
  // src/api/agent-tags.ts
538
612
  function createAgentTagsApi(cfg) {
539
613
  const { base, doFetch } = createHttp(cfg);
@@ -702,13 +776,34 @@ var bindAgentPhones = (api, agentId) => ({
702
776
  return api.disconnect(agentId, phoneId);
703
777
  }
704
778
  });
705
- var bindAgentSchedule = (api, agentId) => ({
779
+ var bindAgentScheduleExceptions = (api, agentId) => ({
780
+ list(opts) {
781
+ return api.list(agentId, opts);
782
+ },
783
+ get(exceptionId) {
784
+ return api.get(agentId, exceptionId);
785
+ },
786
+ create(payload) {
787
+ return api.create(agentId, payload);
788
+ },
789
+ update(exceptionId, payload) {
790
+ return api.update(agentId, exceptionId, payload);
791
+ },
792
+ delete(exceptionId) {
793
+ return api.delete(agentId, exceptionId);
794
+ }
795
+ });
796
+ var bindAgentSchedule = (scheduleApi, exceptionsApi, agentId) => ({
706
797
  get() {
707
- return api.get(agentId);
798
+ return scheduleApi.get(agentId);
799
+ },
800
+ create(payload) {
801
+ return scheduleApi.create(agentId, payload);
708
802
  },
709
803
  update(payload) {
710
- return api.update(agentId, payload);
711
- }
804
+ return scheduleApi.update(agentId, payload);
805
+ },
806
+ exceptions: bindAgentScheduleExceptions(exceptionsApi, agentId)
712
807
  });
713
808
  var bindAgentVersions = (api, agentId) => ({
714
809
  list(opts) {
@@ -775,6 +870,7 @@ var createAgentEntity = (dto, options) => {
775
870
  tagsApi,
776
871
  phonesApi,
777
872
  scheduleApi,
873
+ scheduleExceptionsApi,
778
874
  versionsApi,
779
875
  blueprintsApi,
780
876
  reload,
@@ -786,7 +882,11 @@ var createAgentEntity = (dto, options) => {
786
882
  instructions: bindAgentInstructions(instructionsApi, dto.agentId),
787
883
  tagAssignments: bindAgentTags(tagsApi, dto.agentId),
788
884
  phones: bindAgentPhones(phonesApi, dto.agentId),
789
- schedule: bindAgentSchedule(scheduleApi, dto.agentId),
885
+ schedule: bindAgentSchedule(
886
+ scheduleApi,
887
+ scheduleExceptionsApi,
888
+ dto.agentId
889
+ ),
790
890
  versions: bindAgentVersions(versionsApi, dto.agentId),
791
891
  blueprints: bindAgentBlueprints(blueprintsApi, dto.agentId),
792
892
  async save(patch) {
@@ -870,6 +970,7 @@ function createAgentsApi(cfg, relatedApis) {
870
970
  tagsApi: relatedApis.tagsApi,
871
971
  phonesApi: relatedApis.phonesApi,
872
972
  scheduleApi: relatedApis.scheduleApi,
973
+ scheduleExceptionsApi: relatedApis.scheduleExceptionsApi,
873
974
  versionsApi: relatedApis.versionsApi,
874
975
  blueprintsApi: relatedApis.blueprintsApi,
875
976
  reload: async (agentId) => {
@@ -945,6 +1046,52 @@ function createApiKeysApi(cfg) {
945
1046
  };
946
1047
  }
947
1048
 
1049
+ // src/api/catalogs.ts
1050
+ function createCatalogsApi(cfg) {
1051
+ const { base, doFetch } = createHttp(cfg);
1052
+ const jsonHeaders = { "content-type": "application/json" };
1053
+ const fetchCatalogItemsPage = async (options = {}) => {
1054
+ const query = serializeListOptions(options ?? {});
1055
+ const res = await doFetch(`${base}/v1/catalogs/items`, {
1056
+ method: "GET",
1057
+ query
1058
+ });
1059
+ return res.json();
1060
+ };
1061
+ return {
1062
+ async list(options = {}) {
1063
+ const normalizedOptions = {
1064
+ ...options ?? {}
1065
+ };
1066
+ const response = await fetchCatalogItemsPage(normalizedOptions);
1067
+ return attachPaginator(
1068
+ response,
1069
+ fetchCatalogItemsPage,
1070
+ normalizedOptions
1071
+ );
1072
+ },
1073
+ async get(itemId) {
1074
+ const res = await doFetch(`${base}/v1/catalogs/items/${itemId}`, {
1075
+ method: "GET"
1076
+ });
1077
+ return res.json();
1078
+ },
1079
+ async create(payload) {
1080
+ const res = await doFetch(`${base}/v1/catalogs/items`, {
1081
+ method: "POST",
1082
+ headers: jsonHeaders,
1083
+ body: JSON.stringify(payload)
1084
+ });
1085
+ return res.json();
1086
+ },
1087
+ async remove(itemId) {
1088
+ await doFetch(`${base}/v1/catalogs/items/${itemId}`, {
1089
+ method: "DELETE"
1090
+ });
1091
+ }
1092
+ };
1093
+ }
1094
+
948
1095
  // src/api/tools.ts
949
1096
  var isFormData = (value) => {
950
1097
  return typeof FormData !== "undefined" && value instanceof FormData;
@@ -1160,15 +1307,18 @@ function createClient(initialCfg) {
1160
1307
  const tagsApi = createAgentTagsApi(runtimeCfg);
1161
1308
  const phonesApi = createAgentPhonesApi(runtimeCfg);
1162
1309
  const scheduleApi = createAgentScheduleApi(runtimeCfg);
1310
+ const scheduleExceptionsApi = createAgentScheduleExceptionsApi(runtimeCfg);
1163
1311
  const versionsApi = createAgentVersionsApi(runtimeCfg);
1164
1312
  const blueprintsApi = createAgentBlueprintsApi(runtimeCfg);
1165
1313
  const voicesApi = createVoicesApi(runtimeCfg);
1166
1314
  const apiKeysApi = createApiKeysApi(runtimeCfg);
1315
+ const catalogsApi = createCatalogsApi(runtimeCfg);
1167
1316
  const agentsApi = createAgentsApi(runtimeCfg, {
1168
1317
  instructionsApi,
1169
1318
  tagsApi,
1170
1319
  phonesApi,
1171
1320
  scheduleApi,
1321
+ scheduleExceptionsApi,
1172
1322
  versionsApi,
1173
1323
  blueprintsApi
1174
1324
  });
@@ -1184,9 +1334,16 @@ function createClient(initialCfg) {
1184
1334
  (agentId) => bindAgentPhones(phonesApi, agentId),
1185
1335
  phonesApi
1186
1336
  );
1337
+ const scheduleExceptionsNamespace = Object.assign(
1338
+ (agentId) => bindAgentScheduleExceptions(scheduleExceptionsApi, agentId),
1339
+ scheduleExceptionsApi
1340
+ );
1187
1341
  const scheduleNamespace = Object.assign(
1188
- (agentId) => bindAgentSchedule(scheduleApi, agentId),
1189
- scheduleApi
1342
+ (agentId) => bindAgentSchedule(scheduleApi, scheduleExceptionsApi, agentId),
1343
+ {
1344
+ ...scheduleApi,
1345
+ exceptions: scheduleExceptionsNamespace
1346
+ }
1190
1347
  );
1191
1348
  const versionsNamespace = Object.assign(
1192
1349
  (agentId) => bindAgentVersions(versionsApi, agentId),
@@ -1208,6 +1365,7 @@ function createClient(initialCfg) {
1208
1365
  },
1209
1366
  workspaces: createWorkspacesApi(runtimeCfg),
1210
1367
  tools: createToolsApi(runtimeCfg),
1368
+ catalogs: catalogsApi,
1211
1369
  voices: voicesApi,
1212
1370
  apiKeys: apiKeysApi
1213
1371
  };
@@ -1274,6 +1432,7 @@ export {
1274
1432
  bindAgentInstructions,
1275
1433
  bindAgentPhones,
1276
1434
  bindAgentSchedule,
1435
+ bindAgentScheduleExceptions,
1277
1436
  bindAgentTags,
1278
1437
  bindAgentVersions,
1279
1438
  createAgentBlueprintsApi,
@@ -1281,10 +1440,12 @@ export {
1281
1440
  createAgentInstructionsApi,
1282
1441
  createAgentPhonesApi,
1283
1442
  createAgentScheduleApi,
1443
+ createAgentScheduleExceptionsApi,
1284
1444
  createAgentTagsApi,
1285
1445
  createAgentVersionsApi,
1286
1446
  createAgentsApi,
1287
1447
  createApiKeysApi,
1448
+ createCatalogsApi,
1288
1449
  createClient,
1289
1450
  createHttp,
1290
1451
  createToolsApi,