@getsupervisor/agents-studio-sdk 1.1.0 → 1.3.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.cjs CHANGED
@@ -22,13 +22,22 @@ __export(index_exports, {
22
22
  HttpError: () => HttpError,
23
23
  NetworkError: () => NetworkError,
24
24
  TimeoutError: () => TimeoutError,
25
+ bindAgentInstructions: () => bindAgentInstructions,
26
+ bindAgentKnowledge: () => bindAgentKnowledge,
27
+ bindAgentPhones: () => bindAgentPhones,
28
+ bindAgentSchedule: () => bindAgentSchedule,
29
+ bindAgentVersions: () => bindAgentVersions,
30
+ createAgentEntity: () => createAgentEntity,
25
31
  createAgentInstructionsApi: () => createAgentInstructionsApi,
26
32
  createAgentKnowledgeApi: () => createAgentKnowledgeApi,
27
33
  createAgentPhonesApi: () => createAgentPhonesApi,
34
+ createAgentScheduleApi: () => createAgentScheduleApi,
35
+ createAgentVersionsApi: () => createAgentVersionsApi,
28
36
  createAgentsApi: () => createAgentsApi,
29
37
  createClient: () => createClient,
30
38
  createHttp: () => createHttp,
31
39
  createToolsApi: () => createToolsApi,
40
+ createVoicesApi: () => createVoicesApi,
32
41
  createWorkspacesApi: () => createWorkspacesApi
33
42
  });
34
43
  module.exports = __toCommonJS(index_exports);
@@ -62,6 +71,36 @@ var NetworkError = class extends Error {
62
71
  };
63
72
 
64
73
  // src/http.ts
74
+ function toQueryString(query) {
75
+ if (!query) return void 0;
76
+ if (typeof query === "string") {
77
+ const normalized = query.trim().replace(/^\?/, "");
78
+ return normalized.length > 0 ? normalized : void 0;
79
+ }
80
+ if (query instanceof URLSearchParams) {
81
+ const result2 = query.toString();
82
+ return result2.length > 0 ? result2 : void 0;
83
+ }
84
+ const params = new URLSearchParams();
85
+ Object.entries(query).forEach(([key, value]) => {
86
+ if (value === null || value === void 0) return;
87
+ const values = Array.isArray(value) ? value : [value];
88
+ values.forEach((item) => {
89
+ params.append(key, String(item));
90
+ });
91
+ });
92
+ const result = params.toString();
93
+ return result.length > 0 ? result : void 0;
94
+ }
95
+ function appendQuery(url, query) {
96
+ const qs = toQueryString(query);
97
+ if (!qs) return url;
98
+ const [base, hash] = url.split("#");
99
+ const hasQuery = base.includes("?");
100
+ const needsSeparator = hasQuery ? base.endsWith("?") || base.endsWith("&") ? "" : "&" : "?";
101
+ const built = `${base}${needsSeparator}${qs}`;
102
+ return hash ? `${built}#${hash}` : built;
103
+ }
65
104
  function sleep(ms) {
66
105
  return new Promise((r) => setTimeout(r, ms));
67
106
  }
@@ -136,25 +175,31 @@ function createHttp(cfg) {
136
175
  };
137
176
  };
138
177
  async function doFetch(url, init = {}) {
178
+ const { query, ...requestInit } = init;
179
+ const targetUrl = appendQuery(url, query);
139
180
  const ab = new AbortController();
140
181
  const req = async () => {
141
182
  try {
142
- const finalHeaders = buildHeaders(init.headers);
183
+ const finalHeaders = buildHeaders(requestInit.headers);
143
184
  const res = await withTimeout(
144
- fx(url, { ...init, headers: finalHeaders, signal: ab.signal }),
185
+ fx(targetUrl, {
186
+ ...requestInit,
187
+ headers: finalHeaders,
188
+ signal: ab.signal
189
+ }),
145
190
  timeout,
146
191
  ab,
147
- url
192
+ targetUrl
148
193
  );
149
194
  if (!res.ok) {
150
195
  const body = await res.clone().json().catch(() => void 0);
151
- throw new HttpError(res.status, res.statusText, body, url);
196
+ throw new HttpError(res.status, res.statusText, body, targetUrl);
152
197
  }
153
198
  return res;
154
199
  } catch (e) {
155
- if (e.name === "AbortError") throw new TimeoutError(timeout, url);
200
+ if (e.name === "AbortError") throw new TimeoutError(timeout, targetUrl);
156
201
  if (e instanceof HttpError) throw e;
157
- throw new NetworkError(e, url);
202
+ throw new NetworkError(e, targetUrl);
158
203
  }
159
204
  };
160
205
  return withRetry(req, retry);
@@ -170,20 +215,157 @@ function createHttp(cfg) {
170
215
  };
171
216
  }
172
217
 
173
- // src/api/agents.ts
174
- function createAgentsApi(cfg) {
218
+ // src/utils/query.ts
219
+ function serializeListOptions(options = {}, extra = {}) {
220
+ const params = new URLSearchParams();
221
+ appendParam(params, "page", options.page);
222
+ appendParam(params, "limit", options.limit);
223
+ appendParam(params, "sort", options.sort);
224
+ appendParam(params, "fields", options.fields);
225
+ appendParam(params, "include", options.include);
226
+ appendParam(params, "q", options.search);
227
+ appendParam(params, "filter", mapQueryValue(options.filter));
228
+ appendParam(params, "or", mapQueryValue(options.or));
229
+ Object.entries(extra).forEach(([key, value]) => {
230
+ appendParam(params, key, value);
231
+ });
232
+ return params.toString();
233
+ }
234
+ function mapQueryValue(value) {
235
+ if (value === void 0 || value === null) {
236
+ return void 0;
237
+ }
238
+ if (isQueryBuilderSerializable(value)) {
239
+ return getQueryBuilderString(value);
240
+ }
241
+ return value;
242
+ }
243
+ function appendParam(params, key, value) {
244
+ if (value === void 0 || value === null) {
245
+ return;
246
+ }
247
+ if (value instanceof Date) {
248
+ params.set(key, value.toISOString());
249
+ return;
250
+ }
251
+ if (isQueryBuilderSerializable(value)) {
252
+ params.set(key, getQueryBuilderString(value));
253
+ return;
254
+ }
255
+ if (typeof value === "string") {
256
+ params.set(key, value);
257
+ return;
258
+ }
259
+ if (typeof value === "number" || typeof value === "boolean") {
260
+ params.set(key, String(value));
261
+ return;
262
+ }
263
+ if (typeof value === "bigint") {
264
+ params.set(key, value.toString());
265
+ return;
266
+ }
267
+ if (Array.isArray(value)) {
268
+ if (value.length === 0) {
269
+ return;
270
+ }
271
+ if (value.every(isPrimitive)) {
272
+ params.set(key, value.map((item) => String(item)).join(","));
273
+ return;
274
+ }
275
+ value.forEach((item, idx) => {
276
+ appendParam(params, `${key}[${idx}]`, item);
277
+ });
278
+ return;
279
+ }
280
+ if (isPlainObject(value)) {
281
+ Object.entries(value).forEach(([childKey, childValue]) => {
282
+ appendParam(params, `${key}[${childKey}]`, childValue);
283
+ });
284
+ return;
285
+ }
286
+ params.set(key, String(value));
287
+ }
288
+ function isPrimitive(value) {
289
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint";
290
+ }
291
+ function isPlainObject(value) {
292
+ if (value === null || typeof value !== "object") {
293
+ return false;
294
+ }
295
+ const proto = Object.getPrototypeOf(value);
296
+ return proto === Object.prototype || proto === null;
297
+ }
298
+ function isQueryBuilderSerializable(value) {
299
+ return !!value && typeof value === "object" && typeof value.build === "function";
300
+ }
301
+ function getQueryBuilderString(value) {
302
+ const build = value.build;
303
+ if (typeof build !== "function") {
304
+ throw new TypeError(
305
+ "Query builder values must expose a build() method returning a string."
306
+ );
307
+ }
308
+ if (build.length > 0) {
309
+ const stringValue = value.toString?.();
310
+ if (stringValue && stringValue !== "[object Object]") {
311
+ return stringValue;
312
+ }
313
+ throw new TypeError(
314
+ "Query builder instances passed to the SDK must expose a zero-argument build() method. Did you pass QueryBuilder instead of Query?"
315
+ );
316
+ }
317
+ const result = build.call(value);
318
+ if (typeof result === "string") {
319
+ return result;
320
+ }
321
+ if (result === void 0 || result === null) {
322
+ throw new TypeError(
323
+ "Query builder build() must return a string representation of the query."
324
+ );
325
+ }
326
+ return String(result);
327
+ }
328
+
329
+ // src/api/agent-instructions.ts
330
+ function createAgentInstructionsApi(cfg) {
175
331
  const { base, doFetch } = createHttp(cfg);
332
+ const jsonHeaders = { "content-type": "application/json" };
176
333
  return {
177
- async get(agentId) {
178
- const res = await doFetch(`${base}/v1/agents/${agentId}`, {
179
- method: "GET"
334
+ async list(agentId, opts = {}) {
335
+ const { versionId, ...queryOptions } = opts;
336
+ const query = serializeListOptions(queryOptions, { versionId });
337
+ const res = await doFetch(`${base}/v1/agents/${agentId}/instructions`, {
338
+ method: "GET",
339
+ query
180
340
  });
181
341
  return res.json();
182
342
  },
183
- async delete(agentId) {
184
- await doFetch(`${base}/v1/agents/${agentId}`, {
185
- method: "DELETE"
343
+ async create(agentId, payload) {
344
+ const res = await doFetch(`${base}/v1/agents/${agentId}/instructions`, {
345
+ method: "POST",
346
+ headers: jsonHeaders,
347
+ body: JSON.stringify(payload)
186
348
  });
349
+ return res.json();
350
+ },
351
+ async update(agentId, instructionId, payload) {
352
+ const res = await doFetch(
353
+ `${base}/v1/agents/${agentId}/instructions/${instructionId}`,
354
+ {
355
+ method: "PATCH",
356
+ headers: jsonHeaders,
357
+ body: JSON.stringify(payload)
358
+ }
359
+ );
360
+ return res.json();
361
+ },
362
+ async delete(agentId, instructionId) {
363
+ await doFetch(
364
+ `${base}/v1/agents/${agentId}/instructions/${instructionId}`,
365
+ {
366
+ method: "DELETE"
367
+ }
368
+ );
187
369
  }
188
370
  };
189
371
  }
@@ -204,20 +386,24 @@ function createAgentKnowledgeApi(cfg) {
204
386
  );
205
387
  return res.json();
206
388
  },
207
- async listBases(agentId) {
389
+ async listBases(agentId, opts = {}) {
390
+ const query = serializeListOptions(opts);
208
391
  const res = await doFetch(
209
392
  `${base}/v1/agents/${agentId}/knowledge/bases`,
210
393
  {
211
- method: "GET"
394
+ method: "GET",
395
+ query
212
396
  }
213
397
  );
214
398
  return res.json();
215
399
  },
216
- async listUploads(agentId) {
400
+ async listUploads(agentId, opts = {}) {
401
+ const query = serializeListOptions(opts);
217
402
  const res = await doFetch(
218
403
  `${base}/v1/agents/${agentId}/knowledge/uploads`,
219
404
  {
220
- method: "GET"
405
+ method: "GET",
406
+ query
221
407
  }
222
408
  );
223
409
  return res.json();
@@ -225,75 +411,254 @@ function createAgentKnowledgeApi(cfg) {
225
411
  };
226
412
  }
227
413
 
228
- // src/api/agent-instructions.ts
229
- function createAgentInstructionsApi(cfg) {
414
+ // src/api/agent-phones.ts
415
+ function createAgentPhonesApi(cfg) {
230
416
  const { base, doFetch } = createHttp(cfg);
231
417
  const jsonHeaders = { "content-type": "application/json" };
232
418
  return {
233
- async list(agentId, opts) {
234
- const search = opts?.versionId ? `?versionId=${encodeURIComponent(opts.versionId)}` : "";
235
- const res = await doFetch(
236
- `${base}/v1/agents/${agentId}/instructions${search}`,
237
- {
238
- method: "GET"
239
- }
240
- );
241
- return res.json();
242
- },
243
- async create(agentId, payload) {
244
- const res = await doFetch(`${base}/v1/agents/${agentId}/instructions`, {
419
+ async connect(agentId, payload) {
420
+ const res = await doFetch(`${base}/v1/agents/${agentId}/phones`, {
245
421
  method: "POST",
246
422
  headers: jsonHeaders,
247
423
  body: JSON.stringify(payload)
248
424
  });
249
425
  return res.json();
426
+ },
427
+ async disconnect(agentId, phoneId) {
428
+ await doFetch(`${base}/v1/agents/${agentId}/phones/${phoneId}`, {
429
+ method: "DELETE"
430
+ });
250
431
  }
251
432
  };
252
433
  }
253
434
 
254
- // src/api/agent-phones.ts
255
- function createAgentPhonesApi(cfg) {
435
+ // src/api/agent-schedule.ts
436
+ function createAgentScheduleApi(cfg) {
256
437
  const { base, doFetch } = createHttp(cfg);
257
438
  const jsonHeaders = { "content-type": "application/json" };
258
439
  return {
259
- async connect(agentId, payload) {
260
- const res = await doFetch(`${base}/v1/agents/${agentId}/phones`, {
261
- method: "POST",
262
- headers: jsonHeaders,
263
- body: JSON.stringify(payload)
440
+ async get(agentId) {
441
+ const res = await doFetch(`${base}/v1/agents/${agentId}/schedule`, {
442
+ method: "GET"
264
443
  });
265
444
  return res.json();
266
445
  },
267
- async disconnect(agentId, phoneId) {
268
- await doFetch(`${base}/v1/agents/${agentId}/phones/${phoneId}`, {
269
- method: "DELETE"
446
+ async update(agentId, payload) {
447
+ const res = await doFetch(`${base}/v1/agents/${agentId}/schedule`, {
448
+ method: "PUT",
449
+ headers: jsonHeaders,
450
+ body: JSON.stringify(payload)
270
451
  });
452
+ return res.json();
271
453
  }
272
454
  };
273
455
  }
274
456
 
275
- // src/api/workspaces.ts
276
- function createWorkspacesApi(cfg) {
457
+ // src/api/agent-versions.ts
458
+ function createAgentVersionsApi(cfg) {
277
459
  const { base, doFetch } = createHttp(cfg);
278
460
  const jsonHeaders = { "content-type": "application/json" };
279
461
  return {
280
- async listPhones(workspaceId, opts) {
281
- const search = opts?.channel ? `?channel=${opts.channel}` : "";
462
+ async list(agentId, opts = {}) {
463
+ const { status, ...queryOptions } = opts;
464
+ const query = serializeListOptions(queryOptions, { status });
465
+ const res = await doFetch(`${base}/v1/agents/${agentId}/versions`, {
466
+ method: "GET",
467
+ query
468
+ });
469
+ return res.json();
470
+ },
471
+ async get(agentId, versionId) {
282
472
  const res = await doFetch(
283
- `${base}/v1/workspaces/${workspaceId}/phones${search}`,
473
+ `${base}/v1/agents/${agentId}/versions/${versionId}`,
284
474
  {
285
475
  method: "GET"
286
476
  }
287
477
  );
288
478
  return res.json();
289
479
  },
290
- async enable(workspaceId, payload) {
291
- const res = await doFetch(`${base}/v1/workspaces/${workspaceId}/enable`, {
480
+ async create(agentId, payload) {
481
+ const res = await doFetch(`${base}/v1/agents/${agentId}/versions`, {
292
482
  method: "POST",
293
483
  headers: jsonHeaders,
294
484
  body: JSON.stringify(payload)
295
485
  });
296
486
  return res.json();
487
+ },
488
+ async update(agentId, versionId, payload) {
489
+ const res = await doFetch(
490
+ `${base}/v1/agents/${agentId}/versions/${versionId}`,
491
+ {
492
+ method: "PATCH",
493
+ headers: jsonHeaders,
494
+ body: JSON.stringify(payload)
495
+ }
496
+ );
497
+ return res.json();
498
+ }
499
+ };
500
+ }
501
+
502
+ // src/entities/agent.ts
503
+ var bindAgentInstructions = (api, agentId) => ({
504
+ list(opts) {
505
+ return api.list(agentId, opts);
506
+ },
507
+ create(payload) {
508
+ return api.create(agentId, payload);
509
+ },
510
+ update(instructionId, payload) {
511
+ return api.update(agentId, instructionId, payload);
512
+ },
513
+ delete(instructionId) {
514
+ return api.delete(agentId, instructionId);
515
+ }
516
+ });
517
+ var bindAgentKnowledge = (api, agentId) => ({
518
+ upload(payload) {
519
+ return api.upload(agentId, payload);
520
+ },
521
+ listBases(opts) {
522
+ return api.listBases(agentId, opts);
523
+ },
524
+ listUploads(opts) {
525
+ return api.listUploads(agentId, opts);
526
+ }
527
+ });
528
+ var bindAgentPhones = (api, agentId) => ({
529
+ connect(payload) {
530
+ return api.connect(agentId, payload);
531
+ },
532
+ disconnect(phoneId) {
533
+ return api.disconnect(agentId, phoneId);
534
+ }
535
+ });
536
+ var bindAgentSchedule = (api, agentId) => ({
537
+ get() {
538
+ return api.get(agentId);
539
+ },
540
+ update(payload) {
541
+ return api.update(agentId, payload);
542
+ }
543
+ });
544
+ var bindAgentVersions = (api, agentId) => ({
545
+ list(opts) {
546
+ return api.list(agentId, opts);
547
+ },
548
+ get(versionId) {
549
+ return api.get(agentId, versionId);
550
+ },
551
+ create(payload) {
552
+ return api.create(agentId, payload);
553
+ },
554
+ update(versionId, payload) {
555
+ return api.update(agentId, versionId, payload);
556
+ }
557
+ });
558
+ var createAgentEntity = (dto, options) => {
559
+ const {
560
+ instructionsApi,
561
+ knowledgeApi,
562
+ phonesApi,
563
+ scheduleApi,
564
+ versionsApi,
565
+ reload
566
+ } = options;
567
+ const entity = {
568
+ ...dto,
569
+ instructions: bindAgentInstructions(instructionsApi, dto.agentId),
570
+ knowledge: bindAgentKnowledge(knowledgeApi, dto.agentId),
571
+ phones: bindAgentPhones(phonesApi, dto.agentId),
572
+ schedule: bindAgentSchedule(scheduleApi, dto.agentId),
573
+ versions: bindAgentVersions(versionsApi, dto.agentId),
574
+ async refresh() {
575
+ return reload(dto.agentId);
576
+ }
577
+ };
578
+ return Object.freeze(entity);
579
+ };
580
+
581
+ // src/api/agents.ts
582
+ function createAgentsApi(cfg, relatedApis) {
583
+ const { base, doFetch } = createHttp(cfg);
584
+ const jsonHeaders = { "content-type": "application/json" };
585
+ const listAgents = async (options = {}) => {
586
+ const query = serializeListOptions(options);
587
+ const res = await doFetch(`${base}/v1/agents`, {
588
+ method: "GET",
589
+ query
590
+ });
591
+ return res.json();
592
+ };
593
+ const getAgentDetail = async (agentId) => {
594
+ const res = await doFetch(`${base}/v1/agents/${agentId}`, {
595
+ method: "GET"
596
+ });
597
+ return res.json();
598
+ };
599
+ const createAgent = async (payload) => {
600
+ const res = await doFetch(`${base}/v1/agents`, {
601
+ method: "POST",
602
+ body: JSON.stringify(payload),
603
+ headers: jsonHeaders
604
+ });
605
+ return res.json();
606
+ };
607
+ const updateAgent = async (agentId, payload) => {
608
+ const res = await doFetch(`${base}/v1/agents/${agentId}`, {
609
+ method: "PATCH",
610
+ body: JSON.stringify(payload),
611
+ headers: jsonHeaders
612
+ });
613
+ return res.json();
614
+ };
615
+ const deleteAgent = async (agentId) => {
616
+ await doFetch(`${base}/v1/agents/${agentId}`, {
617
+ method: "DELETE"
618
+ });
619
+ };
620
+ const baseApi = {
621
+ list: listAgents,
622
+ get: getAgentDetail,
623
+ create: createAgent,
624
+ update: updateAgent,
625
+ delete: deleteAgent
626
+ };
627
+ if (!relatedApis) {
628
+ return baseApi;
629
+ }
630
+ const wrapAgent = (detail) => createAgentEntity(detail, {
631
+ instructionsApi: relatedApis.instructionsApi,
632
+ knowledgeApi: relatedApis.knowledgeApi,
633
+ phonesApi: relatedApis.phonesApi,
634
+ scheduleApi: relatedApis.scheduleApi,
635
+ versionsApi: relatedApis.versionsApi,
636
+ reload: async (agentId) => {
637
+ const latest = await getAgentDetail(agentId);
638
+ return wrapAgent(latest);
639
+ }
640
+ });
641
+ return {
642
+ ...baseApi,
643
+ async list(options = {}) {
644
+ const response = await listAgents(options);
645
+ const items = Array.isArray(response.data) ? response.data : [];
646
+ return {
647
+ ...response,
648
+ data: items.map((summary) => wrapAgent(summary))
649
+ };
650
+ },
651
+ async get(agentId) {
652
+ const detail = await getAgentDetail(agentId);
653
+ return wrapAgent(detail);
654
+ },
655
+ async create(payload) {
656
+ const detail = await createAgent(payload);
657
+ return wrapAgent(detail);
658
+ },
659
+ async update(agentId, payload) {
660
+ const detail = await updateAgent(agentId, payload);
661
+ return wrapAgent(detail);
297
662
  }
298
663
  };
299
664
  }
@@ -303,9 +668,11 @@ function createToolsApi(cfg) {
303
668
  const { base, doFetch } = createHttp(cfg);
304
669
  const jsonHeaders = { "content-type": "application/json" };
305
670
  return {
306
- async list() {
671
+ async list(options = {}) {
672
+ const query = serializeListOptions(options);
307
673
  const res = await doFetch(`${base}/v1/tools`, {
308
- method: "GET"
674
+ method: "GET",
675
+ query
309
676
  });
310
677
  return res.json();
311
678
  },
@@ -320,6 +687,76 @@ function createToolsApi(cfg) {
320
687
  };
321
688
  }
322
689
 
690
+ // src/api/voices.ts
691
+ function createVoicesApi(cfg) {
692
+ const { base, doFetch } = createHttp(cfg);
693
+ return {
694
+ async list(options = {}) {
695
+ const { agentId, agentVersionId, gender, locale } = options;
696
+ const query = serializeListOptions(
697
+ {
698
+ page: options.page,
699
+ limit: options.limit ?? options.pageSize,
700
+ sort: options.sort,
701
+ fields: options.fields,
702
+ include: options.include,
703
+ search: options.search,
704
+ filter: options.filter,
705
+ or: options.or
706
+ },
707
+ {
708
+ agentId,
709
+ agentVersionId,
710
+ gender,
711
+ locale
712
+ }
713
+ );
714
+ const res = await doFetch(`${base}/v1/voices`, {
715
+ method: "GET",
716
+ query
717
+ });
718
+ return res.json();
719
+ }
720
+ };
721
+ }
722
+
723
+ // src/api/workspaces.ts
724
+ function createWorkspacesApi(cfg) {
725
+ const { base, doFetch } = createHttp(cfg);
726
+ const jsonHeaders = { "content-type": "application/json" };
727
+ return {
728
+ async listPhones(workspaceId, opts = {}) {
729
+ const { channel } = opts;
730
+ const query = serializeListOptions(
731
+ {
732
+ page: opts.page,
733
+ limit: opts.limit,
734
+ sort: opts.sort,
735
+ fields: opts.fields,
736
+ include: opts.include,
737
+ search: opts.search,
738
+ filter: opts.filter,
739
+ or: opts.or
740
+ },
741
+ { channel }
742
+ );
743
+ const res = await doFetch(`${base}/v1/workspaces/${workspaceId}/phones`, {
744
+ method: "GET",
745
+ query
746
+ });
747
+ return res.json();
748
+ },
749
+ async enable(workspaceId, payload) {
750
+ const res = await doFetch(`${base}/v1/workspaces/${workspaceId}/enable`, {
751
+ method: "POST",
752
+ headers: jsonHeaders,
753
+ body: JSON.stringify(payload)
754
+ });
755
+ return res.json();
756
+ }
757
+ };
758
+ }
759
+
323
760
  // src/client.ts
324
761
  function createClient(initialCfg) {
325
762
  const runtimeCfg = {
@@ -332,15 +769,31 @@ function createClient(initialCfg) {
332
769
  const setWorkspaceGetter = (getter) => {
333
770
  runtimeCfg.getWorkspaceId = getter;
334
771
  };
772
+ const instructionsApi = createAgentInstructionsApi(runtimeCfg);
773
+ const knowledgeApi = createAgentKnowledgeApi(runtimeCfg);
774
+ const phonesApi = createAgentPhonesApi(runtimeCfg);
775
+ const scheduleApi = createAgentScheduleApi(runtimeCfg);
776
+ const versionsApi = createAgentVersionsApi(runtimeCfg);
777
+ const voicesApi = createVoicesApi(runtimeCfg);
778
+ const agentsApi = createAgentsApi(runtimeCfg, {
779
+ instructionsApi,
780
+ knowledgeApi,
781
+ phonesApi,
782
+ scheduleApi,
783
+ versionsApi
784
+ });
335
785
  const apis = {
336
786
  agents: {
337
- ...createAgentsApi(runtimeCfg),
338
- knowledge: createAgentKnowledgeApi(runtimeCfg),
339
- instructions: createAgentInstructionsApi(runtimeCfg),
340
- phones: createAgentPhonesApi(runtimeCfg)
787
+ ...agentsApi,
788
+ knowledge: knowledgeApi,
789
+ instructions: instructionsApi,
790
+ phones: phonesApi,
791
+ schedule: scheduleApi,
792
+ versions: versionsApi
341
793
  },
342
794
  workspaces: createWorkspacesApi(runtimeCfg),
343
- tools: createToolsApi(runtimeCfg)
795
+ tools: createToolsApi(runtimeCfg),
796
+ voices: voicesApi
344
797
  };
345
798
  return {
346
799
  ...apis,
@@ -372,13 +825,22 @@ function createClient(initialCfg) {
372
825
  HttpError,
373
826
  NetworkError,
374
827
  TimeoutError,
828
+ bindAgentInstructions,
829
+ bindAgentKnowledge,
830
+ bindAgentPhones,
831
+ bindAgentSchedule,
832
+ bindAgentVersions,
833
+ createAgentEntity,
375
834
  createAgentInstructionsApi,
376
835
  createAgentKnowledgeApi,
377
836
  createAgentPhonesApi,
837
+ createAgentScheduleApi,
838
+ createAgentVersionsApi,
378
839
  createAgentsApi,
379
840
  createClient,
380
841
  createHttp,
381
842
  createToolsApi,
843
+ createVoicesApi,
382
844
  createWorkspacesApi
383
845
  });
384
846
  //# sourceMappingURL=index.cjs.map