@getsupervisor/agents-studio-sdk 1.13.0 → 1.15.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);
@@ -560,8 +634,12 @@ function createAgentVersionsApi(cfg) {
560
634
  const { base, doFetch } = createHttp(cfg);
561
635
  const jsonHeaders = { "content-type": "application/json" };
562
636
  const fetchVersionsPage = async (agentId, opts = {}) => {
563
- const { status, ...queryOptions } = opts ?? {};
564
- const query = serializeListOptions(queryOptions, { status });
637
+ const queryOptions = {
638
+ page: opts.page,
639
+ limit: opts.limit,
640
+ filter: opts.filter
641
+ };
642
+ const query = serializeListOptions(queryOptions);
565
643
  const res = await doFetch(`${base}/v1/agents/${agentId}/versions`, {
566
644
  method: "GET",
567
645
  query
@@ -588,13 +666,33 @@ function createAgentVersionsApi(cfg) {
588
666
  const res = await doFetch(`${base}/v1/agents/${agentId}/versions`, {
589
667
  method: "POST",
590
668
  headers: jsonHeaders,
591
- body: JSON.stringify(payload)
669
+ body: JSON.stringify(payload ?? {})
592
670
  });
593
671
  return res.json();
594
672
  },
595
- async update(agentId, versionId, payload) {
673
+ async clone(agentId, versionId) {
596
674
  const res = await doFetch(
597
- `${base}/v1/agents/${agentId}/versions/${versionId}`,
675
+ `${base}/v1/agents/${agentId}/versions/${versionId}/clone`,
676
+ {
677
+ method: "POST"
678
+ }
679
+ );
680
+ return res.json();
681
+ },
682
+ async publish(agentId, versionId, payload) {
683
+ const res = await doFetch(
684
+ `${base}/v1/agents/${agentId}/versions/${versionId}/publish`,
685
+ {
686
+ method: "POST",
687
+ headers: jsonHeaders,
688
+ body: JSON.stringify(payload ?? {})
689
+ }
690
+ );
691
+ return res.json();
692
+ },
693
+ async updateNotes(agentId, versionId, payload) {
694
+ const res = await doFetch(
695
+ `${base}/v1/agents/${agentId}/versions/${versionId}/notes`,
598
696
  {
599
697
  method: "PATCH",
600
698
  headers: jsonHeaders,
@@ -603,11 +701,6 @@ function createAgentVersionsApi(cfg) {
603
701
  );
604
702
  return res.json();
605
703
  },
606
- async delete(agentId, versionId) {
607
- await doFetch(`${base}/v1/agents/${agentId}/versions/${versionId}`, {
608
- method: "DELETE"
609
- });
610
- },
611
704
  async listInstructions(agentId, versionId, opts = {}) {
612
705
  const query = serializeListOptions(opts);
613
706
  const res = await doFetch(
@@ -683,13 +776,34 @@ var bindAgentPhones = (api, agentId) => ({
683
776
  return api.disconnect(agentId, phoneId);
684
777
  }
685
778
  });
686
- 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) => ({
687
797
  get() {
688
- return api.get(agentId);
798
+ return scheduleApi.get(agentId);
799
+ },
800
+ create(payload) {
801
+ return scheduleApi.create(agentId, payload);
689
802
  },
690
803
  update(payload) {
691
- return api.update(agentId, payload);
692
- }
804
+ return scheduleApi.update(agentId, payload);
805
+ },
806
+ exceptions: bindAgentScheduleExceptions(exceptionsApi, agentId)
693
807
  });
694
808
  var bindAgentVersions = (api, agentId) => ({
695
809
  list(opts) {
@@ -701,11 +815,14 @@ var bindAgentVersions = (api, agentId) => ({
701
815
  create(payload) {
702
816
  return api.create(agentId, payload);
703
817
  },
704
- update(versionId, payload) {
705
- return api.update(agentId, versionId, payload);
818
+ clone(versionId) {
819
+ return api.clone(agentId, versionId);
706
820
  },
707
- delete(versionId) {
708
- return api.delete(agentId, versionId);
821
+ publish(versionId, payload) {
822
+ return api.publish(agentId, versionId, payload);
823
+ },
824
+ updateNotes(versionId, payload) {
825
+ return api.updateNotes(agentId, versionId, payload);
709
826
  },
710
827
  instructions(versionId) {
711
828
  return {
@@ -753,6 +870,7 @@ var createAgentEntity = (dto, options) => {
753
870
  tagsApi,
754
871
  phonesApi,
755
872
  scheduleApi,
873
+ scheduleExceptionsApi,
756
874
  versionsApi,
757
875
  blueprintsApi,
758
876
  reload,
@@ -764,7 +882,11 @@ var createAgentEntity = (dto, options) => {
764
882
  instructions: bindAgentInstructions(instructionsApi, dto.agentId),
765
883
  tagAssignments: bindAgentTags(tagsApi, dto.agentId),
766
884
  phones: bindAgentPhones(phonesApi, dto.agentId),
767
- schedule: bindAgentSchedule(scheduleApi, dto.agentId),
885
+ schedule: bindAgentSchedule(
886
+ scheduleApi,
887
+ scheduleExceptionsApi,
888
+ dto.agentId
889
+ ),
768
890
  versions: bindAgentVersions(versionsApi, dto.agentId),
769
891
  blueprints: bindAgentBlueprints(blueprintsApi, dto.agentId),
770
892
  async save(patch) {
@@ -848,6 +970,7 @@ function createAgentsApi(cfg, relatedApis) {
848
970
  tagsApi: relatedApis.tagsApi,
849
971
  phonesApi: relatedApis.phonesApi,
850
972
  scheduleApi: relatedApis.scheduleApi,
973
+ scheduleExceptionsApi: relatedApis.scheduleExceptionsApi,
851
974
  versionsApi: relatedApis.versionsApi,
852
975
  blueprintsApi: relatedApis.blueprintsApi,
853
976
  reload: async (agentId) => {
@@ -1138,6 +1261,7 @@ function createClient(initialCfg) {
1138
1261
  const tagsApi = createAgentTagsApi(runtimeCfg);
1139
1262
  const phonesApi = createAgentPhonesApi(runtimeCfg);
1140
1263
  const scheduleApi = createAgentScheduleApi(runtimeCfg);
1264
+ const scheduleExceptionsApi = createAgentScheduleExceptionsApi(runtimeCfg);
1141
1265
  const versionsApi = createAgentVersionsApi(runtimeCfg);
1142
1266
  const blueprintsApi = createAgentBlueprintsApi(runtimeCfg);
1143
1267
  const voicesApi = createVoicesApi(runtimeCfg);
@@ -1147,6 +1271,7 @@ function createClient(initialCfg) {
1147
1271
  tagsApi,
1148
1272
  phonesApi,
1149
1273
  scheduleApi,
1274
+ scheduleExceptionsApi,
1150
1275
  versionsApi,
1151
1276
  blueprintsApi
1152
1277
  });
@@ -1162,9 +1287,16 @@ function createClient(initialCfg) {
1162
1287
  (agentId) => bindAgentPhones(phonesApi, agentId),
1163
1288
  phonesApi
1164
1289
  );
1290
+ const scheduleExceptionsNamespace = Object.assign(
1291
+ (agentId) => bindAgentScheduleExceptions(scheduleExceptionsApi, agentId),
1292
+ scheduleExceptionsApi
1293
+ );
1165
1294
  const scheduleNamespace = Object.assign(
1166
- (agentId) => bindAgentSchedule(scheduleApi, agentId),
1167
- scheduleApi
1295
+ (agentId) => bindAgentSchedule(scheduleApi, scheduleExceptionsApi, agentId),
1296
+ {
1297
+ ...scheduleApi,
1298
+ exceptions: scheduleExceptionsNamespace
1299
+ }
1168
1300
  );
1169
1301
  const versionsNamespace = Object.assign(
1170
1302
  (agentId) => bindAgentVersions(versionsApi, agentId),
@@ -1252,6 +1384,7 @@ export {
1252
1384
  bindAgentInstructions,
1253
1385
  bindAgentPhones,
1254
1386
  bindAgentSchedule,
1387
+ bindAgentScheduleExceptions,
1255
1388
  bindAgentTags,
1256
1389
  bindAgentVersions,
1257
1390
  createAgentBlueprintsApi,
@@ -1259,6 +1392,7 @@ export {
1259
1392
  createAgentInstructionsApi,
1260
1393
  createAgentPhonesApi,
1261
1394
  createAgentScheduleApi,
1395
+ createAgentScheduleExceptionsApi,
1262
1396
  createAgentTagsApi,
1263
1397
  createAgentVersionsApi,
1264
1398
  createAgentsApi,