@getsupervisor/agents-studio-sdk 1.0.0 → 1.2.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.d.cts CHANGED
@@ -1,38 +1,43 @@
1
1
  type paths = {
2
- '/v1/agents/{agentId}': {
3
- get: operations['getAgentDetail'];
4
- delete: operations['deleteAgent'];
2
+ "/v1/agents": {
3
+ get: operations["listAgents"];
4
+ post: operations["createAgent"];
5
5
  };
6
- '/v1/agents/{agentId}/knowledge/upload': {
7
- post: operations['uploadAgentKnowledge'];
6
+ "/v1/agents/{agentId}": {
7
+ get: operations["getAgentDetail"];
8
+ delete: operations["deleteAgent"];
9
+ patch: operations["updateAgent"];
8
10
  };
9
- '/v1/agents/{agentId}/knowledge/bases': {
10
- get: operations['listAgentKnowledgeBases'];
11
+ "/v1/agents/{agentId}/knowledge/upload": {
12
+ post: operations["uploadAgentKnowledge"];
11
13
  };
12
- '/v1/agents/{agentId}/knowledge/uploads': {
13
- get: operations['listAgentKnowledgeUploads'];
14
+ "/v1/agents/{agentId}/knowledge/bases": {
15
+ get: operations["listAgentKnowledgeBases"];
14
16
  };
15
- '/v1/agents/{agentId}/instructions': {
16
- get: operations['listAgentInstructions'];
17
- post: operations['createAgentInstruction'];
17
+ "/v1/agents/{agentId}/knowledge/uploads": {
18
+ get: operations["listAgentKnowledgeUploads"];
18
19
  };
19
- '/v1/agents/{agentId}/phones': {
20
- post: operations['connectAgentPhone'];
20
+ "/v1/agents/{agentId}/instructions": {
21
+ get: operations["listAgentInstructions"];
22
+ post: operations["createAgentInstruction"];
21
23
  };
22
- '/v1/agents/{agentId}/phones/{phoneId}': {
23
- delete: operations['disconnectAgentPhone'];
24
+ "/v1/agents/{agentId}/phones": {
25
+ post: operations["connectAgentPhone"];
24
26
  };
25
- '/v1/workspaces/{workspaceId}/phones': {
26
- get: operations['listWorkspacePhones'];
27
+ "/v1/agents/{agentId}/phones/{phoneId}": {
28
+ delete: operations["disconnectAgentPhone"];
27
29
  };
28
- '/v1/workspaces/{workspaceId}/enable': {
29
- post: operations['enableWorkspace'];
30
+ "/v1/workspaces/{workspaceId}/phones": {
31
+ get: operations["listWorkspacePhones"];
30
32
  };
31
- '/v1/tools': {
32
- get: operations['listTools'];
33
+ "/v1/workspaces/{workspaceId}/enable": {
34
+ post: operations["enableWorkspace"];
33
35
  };
34
- '/v1/tools/{toolId}/execute': {
35
- post: operations['executeTool'];
36
+ "/v1/tools": {
37
+ get: operations["listTools"];
38
+ };
39
+ "/v1/tools/{toolId}/execute": {
40
+ post: operations["executeTool"];
36
41
  };
37
42
  };
38
43
  type components = {
@@ -43,7 +48,7 @@ type components = {
43
48
  workspaceId: string;
44
49
  provider: string;
45
50
  versionId?: string;
46
- status: 'inactive' | 'training' | 'active' | 'archived';
51
+ status: "inactive" | "training" | "active" | "archived";
47
52
  voiceProfile?: {
48
53
  voiceId?: string;
49
54
  llmId?: string;
@@ -54,6 +59,40 @@ type components = {
54
59
  createdAt?: string;
55
60
  updatedAt?: string;
56
61
  };
62
+ PaginationMeta: {
63
+ total: number;
64
+ page: number;
65
+ limit: number;
66
+ hasNext: boolean;
67
+ };
68
+ AgentSummary: {
69
+ agentId: string;
70
+ name: string;
71
+ status: "inactive" | "training" | "active" | "archived";
72
+ workspaceId: string;
73
+ createdAt: string;
74
+ };
75
+ AgentListResponse: {
76
+ data: components["schemas"]["AgentSummary"][];
77
+ meta: components["schemas"]["PaginationMeta"];
78
+ };
79
+ CreateAgentRequest: {
80
+ name: string;
81
+ provider: string;
82
+ languageCode: string;
83
+ templateId?: string | null;
84
+ metadata?: {
85
+ [key: string]: unknown;
86
+ };
87
+ };
88
+ UpdateAgentRequest: {
89
+ name?: string;
90
+ status?: "inactive" | "training" | "active" | "archived";
91
+ metadata?: {
92
+ [key: string]: unknown;
93
+ };
94
+ provider?: string;
95
+ };
57
96
  KnowledgeBaseSummary: {
58
97
  id: string;
59
98
  providerId?: string;
@@ -76,18 +115,18 @@ type components = {
76
115
  source: string;
77
116
  drive_file_id?: string | null;
78
117
  user_id: string;
79
- status: 'queued' | 'processing' | 'completed' | 'failed';
118
+ status: "queued" | "processing" | "completed" | "failed";
80
119
  };
81
120
  KnowledgeUploadListResponse: {
82
- data: {
121
+ data: ({
83
122
  document_id: string;
84
123
  file_path: string;
85
124
  file_name: string;
86
125
  source: string;
87
126
  drive_file_id?: string | null;
88
127
  user_id: string;
89
- status: 'queued' | 'processing' | 'completed' | 'failed';
90
- }[];
128
+ status: "queued" | "processing" | "completed" | "failed";
129
+ })[];
91
130
  };
92
131
  Instruction: {
93
132
  id: string;
@@ -127,14 +166,14 @@ type components = {
127
166
  WorkspacePhone: {
128
167
  id: string;
129
168
  external_id: string;
130
- channel?: 'voice' | null;
169
+ channel?: "voice" | null;
131
170
  supports_outbound?: boolean | null;
132
171
  assigned_to?: string | null;
133
172
  last_used_at?: string | null;
134
173
  requires_qr_reauth?: boolean | null;
135
174
  };
136
175
  WorkspacePhonesResponse: {
137
- data: components['schemas']['WorkspacePhone'][];
176
+ data: components["schemas"]["WorkspacePhone"][];
138
177
  };
139
178
  ToolSummary: {
140
179
  id: string;
@@ -161,14 +200,14 @@ type components = {
161
200
  toolId: string;
162
201
  };
163
202
  WorkspaceEnableRequest: {
164
- provider: 'retell';
203
+ provider: "retell";
165
204
  apiKey: string;
166
205
  metadata?: {
167
206
  [key: string]: unknown;
168
207
  };
169
208
  };
170
209
  WorkspaceEnableResponse: {
171
- status: 'enabled';
210
+ status: "enabled";
172
211
  provider: string;
173
212
  workspaceId: string;
174
213
  };
@@ -182,6 +221,7 @@ type components = {
182
221
  };
183
222
  responses: never;
184
223
  parameters: {
224
+ XWorkspaceId: string;
185
225
  AgentId: string;
186
226
  PhoneId: string;
187
227
  WorkspaceId: string;
@@ -192,29 +232,83 @@ type components = {
192
232
  pathItems: never;
193
233
  };
194
234
  type operations = {
235
+ listAgents: {
236
+ parameters: {
237
+ header: {
238
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
239
+ };
240
+ };
241
+ responses: {
242
+ 200: {
243
+ content: {
244
+ "application/json": components["schemas"]["AgentListResponse"];
245
+ };
246
+ };
247
+ };
248
+ };
249
+ createAgent: {
250
+ parameters: {
251
+ header: {
252
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
253
+ };
254
+ };
255
+ requestBody: {
256
+ content: {
257
+ "application/json": components["schemas"]["CreateAgentRequest"];
258
+ };
259
+ };
260
+ responses: {
261
+ 201: {
262
+ content: {
263
+ "application/json": components["schemas"]["AgentDetail"];
264
+ };
265
+ };
266
+ 400: {
267
+ content: {
268
+ "application/json": components["schemas"]["ErrorResponse"];
269
+ };
270
+ };
271
+ 404: {
272
+ content: {
273
+ "application/json": components["schemas"]["ErrorResponse"];
274
+ };
275
+ };
276
+ 409: {
277
+ content: {
278
+ "application/json": components["schemas"]["ErrorResponse"];
279
+ };
280
+ };
281
+ };
282
+ };
195
283
  getAgentDetail: {
196
284
  parameters: {
285
+ header: {
286
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
287
+ };
197
288
  path: {
198
- agentId: components['parameters']['AgentId'];
289
+ agentId: components["parameters"]["AgentId"];
199
290
  };
200
291
  };
201
292
  responses: {
202
293
  200: {
203
294
  content: {
204
- 'application/json': components['schemas']['AgentDetail'];
295
+ "application/json": components["schemas"]["AgentDetail"];
205
296
  };
206
297
  };
207
298
  404: {
208
299
  content: {
209
- 'application/json': components['schemas']['ErrorResponse'];
300
+ "application/json": components["schemas"]["ErrorResponse"];
210
301
  };
211
302
  };
212
303
  };
213
304
  };
214
305
  deleteAgent: {
215
306
  parameters: {
307
+ header: {
308
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
309
+ };
216
310
  path: {
217
- agentId: components['parameters']['AgentId'];
311
+ agentId: components["parameters"]["AgentId"];
218
312
  };
219
313
  };
220
314
  responses: {
@@ -223,72 +317,118 @@ type operations = {
223
317
  };
224
318
  409: {
225
319
  content: {
226
- 'application/json': components['schemas']['ErrorResponse'];
320
+ "application/json": components["schemas"]["ErrorResponse"];
321
+ };
322
+ };
323
+ };
324
+ };
325
+ updateAgent: {
326
+ parameters: {
327
+ header: {
328
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
329
+ };
330
+ path: {
331
+ agentId: components["parameters"]["AgentId"];
332
+ };
333
+ };
334
+ requestBody: {
335
+ content: {
336
+ "application/json": components["schemas"]["UpdateAgentRequest"];
337
+ };
338
+ };
339
+ responses: {
340
+ 200: {
341
+ content: {
342
+ "application/json": components["schemas"]["AgentDetail"];
343
+ };
344
+ };
345
+ 400: {
346
+ content: {
347
+ "application/json": components["schemas"]["ErrorResponse"];
348
+ };
349
+ };
350
+ 404: {
351
+ content: {
352
+ "application/json": components["schemas"]["ErrorResponse"];
353
+ };
354
+ };
355
+ 409: {
356
+ content: {
357
+ "application/json": components["schemas"]["ErrorResponse"];
227
358
  };
228
359
  };
229
360
  };
230
361
  };
231
362
  uploadAgentKnowledge: {
232
363
  parameters: {
364
+ header: {
365
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
366
+ };
233
367
  path: {
234
- agentId: components['parameters']['AgentId'];
368
+ agentId: components["parameters"]["AgentId"];
235
369
  };
236
370
  };
237
371
  requestBody: {
238
372
  content: {
239
- 'application/json': components['schemas']['KnowledgeUploadRequest'];
373
+ "application/json": components["schemas"]["KnowledgeUploadRequest"];
240
374
  };
241
375
  };
242
376
  responses: {
243
377
  202: {
244
378
  content: {
245
- 'application/json': components['schemas']['KnowledgeUploadResponse'];
379
+ "application/json": components["schemas"]["KnowledgeUploadResponse"];
246
380
  };
247
381
  };
248
382
  400: {
249
383
  content: {
250
- 'application/json': components['schemas']['ErrorResponse'];
384
+ "application/json": components["schemas"]["ErrorResponse"];
251
385
  };
252
386
  };
253
387
  409: {
254
388
  content: {
255
- 'application/json': components['schemas']['ErrorResponse'];
389
+ "application/json": components["schemas"]["ErrorResponse"];
256
390
  };
257
391
  };
258
392
  };
259
393
  };
260
394
  listAgentKnowledgeBases: {
261
395
  parameters: {
396
+ header: {
397
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
398
+ };
262
399
  path: {
263
- agentId: components['parameters']['AgentId'];
400
+ agentId: components["parameters"]["AgentId"];
264
401
  };
265
402
  };
266
403
  responses: {
267
404
  200: {
268
405
  content: {
269
- 'application/json': {
270
- data?: components['schemas']['KnowledgeBaseSummary'][];
406
+ "application/json": {
407
+ data?: components["schemas"]["KnowledgeBaseSummary"][];
271
408
  agent_id?: string;
272
409
  };
273
410
  };
274
411
  };
275
412
  404: {
276
413
  content: {
277
- 'application/json': components['schemas']['ErrorResponse'];
414
+ "application/json": components["schemas"]["ErrorResponse"];
278
415
  };
279
416
  };
280
417
  };
281
418
  };
282
419
  listAgentKnowledgeUploads: {
283
420
  parameters: {
421
+ header: {
422
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
423
+ };
284
424
  path: {
285
- agentId: components['parameters']['AgentId'];
425
+ agentId: components["parameters"]["AgentId"];
286
426
  };
287
427
  };
288
428
  responses: {
289
429
  200: {
290
430
  content: {
291
- 'application/json': components['schemas']['KnowledgeUploadListResponse'];
431
+ "application/json": components["schemas"]["KnowledgeUploadListResponse"];
292
432
  };
293
433
  };
294
434
  };
@@ -298,94 +438,106 @@ type operations = {
298
438
  query?: {
299
439
  versionId?: string;
300
440
  };
441
+ header: {
442
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
443
+ };
301
444
  path: {
302
- agentId: components['parameters']['AgentId'];
445
+ agentId: components["parameters"]["AgentId"];
303
446
  };
304
447
  };
305
448
  responses: {
306
449
  200: {
307
450
  content: {
308
- 'application/json': {
309
- data?: components['schemas']['Instruction'][];
451
+ "application/json": {
452
+ data: components["schemas"]["Instruction"][];
310
453
  versionId?: string;
311
454
  };
312
455
  };
313
456
  };
314
457
  404: {
315
458
  content: {
316
- 'application/json': components['schemas']['ErrorResponse'];
459
+ "application/json": components["schemas"]["ErrorResponse"];
317
460
  };
318
461
  };
319
462
  };
320
463
  };
321
464
  createAgentInstruction: {
322
465
  parameters: {
466
+ header: {
467
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
468
+ };
323
469
  path: {
324
- agentId: components['parameters']['AgentId'];
470
+ agentId: components["parameters"]["AgentId"];
325
471
  };
326
472
  };
327
473
  requestBody: {
328
474
  content: {
329
- 'application/json': components['schemas']['CreateInstructionRequest'];
475
+ "application/json": components["schemas"]["CreateInstructionRequest"];
330
476
  };
331
477
  };
332
478
  responses: {
333
479
  201: {
334
480
  content: {
335
- 'application/json': components['schemas']['InstructionCreatedResponse'];
481
+ "application/json": components["schemas"]["InstructionCreatedResponse"];
336
482
  };
337
483
  };
338
484
  400: {
339
485
  content: {
340
- 'application/json': components['schemas']['ErrorResponse'];
486
+ "application/json": components["schemas"]["ErrorResponse"];
341
487
  };
342
488
  };
343
489
  409: {
344
490
  content: {
345
- 'application/json': components['schemas']['ErrorResponse'];
491
+ "application/json": components["schemas"]["ErrorResponse"];
346
492
  };
347
493
  };
348
494
  };
349
495
  };
350
496
  connectAgentPhone: {
351
497
  parameters: {
498
+ header: {
499
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
500
+ };
352
501
  path: {
353
- agentId: components['parameters']['AgentId'];
502
+ agentId: components["parameters"]["AgentId"];
354
503
  };
355
504
  };
356
505
  requestBody: {
357
506
  content: {
358
- 'application/json': components['schemas']['ConnectPhoneRequest'];
507
+ "application/json": components["schemas"]["ConnectPhoneRequest"];
359
508
  };
360
509
  };
361
510
  responses: {
362
511
  200: {
363
512
  content: {
364
- 'application/json': components['schemas']['PhoneAssignmentResponse'];
513
+ "application/json": components["schemas"]["PhoneAssignmentResponse"];
365
514
  };
366
515
  };
367
516
  400: {
368
517
  content: {
369
- 'application/json': components['schemas']['ErrorResponse'];
518
+ "application/json": components["schemas"]["ErrorResponse"];
370
519
  };
371
520
  };
372
521
  404: {
373
522
  content: {
374
- 'application/json': components['schemas']['ErrorResponse'];
523
+ "application/json": components["schemas"]["ErrorResponse"];
375
524
  };
376
525
  };
377
526
  409: {
378
527
  content: {
379
- 'application/json': components['schemas']['ErrorResponse'];
528
+ "application/json": components["schemas"]["ErrorResponse"];
380
529
  };
381
530
  };
382
531
  };
383
532
  };
384
533
  disconnectAgentPhone: {
385
534
  parameters: {
535
+ header: {
536
+ "x-workspace-id": components["parameters"]["XWorkspaceId"];
537
+ };
386
538
  path: {
387
- agentId: components['parameters']['AgentId'];
388
- phoneId: components['parameters']['PhoneId'];
539
+ agentId: components["parameters"]["AgentId"];
540
+ phoneId: components["parameters"]["PhoneId"];
389
541
  };
390
542
  };
391
543
  responses: {
@@ -394,12 +546,12 @@ type operations = {
394
546
  };
395
547
  404: {
396
548
  content: {
397
- 'application/json': components['schemas']['ErrorResponse'];
549
+ "application/json": components["schemas"]["ErrorResponse"];
398
550
  };
399
551
  };
400
552
  409: {
401
553
  content: {
402
- 'application/json': components['schemas']['ErrorResponse'];
554
+ "application/json": components["schemas"]["ErrorResponse"];
403
555
  };
404
556
  };
405
557
  };
@@ -407,16 +559,16 @@ type operations = {
407
559
  listWorkspacePhones: {
408
560
  parameters: {
409
561
  query?: {
410
- channel?: 'voice';
562
+ channel?: "voice";
411
563
  };
412
564
  path: {
413
- workspaceId: components['parameters']['WorkspaceId'];
565
+ workspaceId: components["parameters"]["WorkspaceId"];
414
566
  };
415
567
  };
416
568
  responses: {
417
569
  200: {
418
570
  content: {
419
- 'application/json': components['schemas']['WorkspacePhonesResponse'];
571
+ "application/json": components["schemas"]["WorkspacePhonesResponse"];
420
572
  };
421
573
  };
422
574
  };
@@ -424,28 +576,28 @@ type operations = {
424
576
  enableWorkspace: {
425
577
  parameters: {
426
578
  path: {
427
- workspaceId: components['parameters']['WorkspaceId'];
579
+ workspaceId: components["parameters"]["WorkspaceId"];
428
580
  };
429
581
  };
430
582
  requestBody: {
431
583
  content: {
432
- 'application/json': components['schemas']['WorkspaceEnableRequest'];
584
+ "application/json": components["schemas"]["WorkspaceEnableRequest"];
433
585
  };
434
586
  };
435
587
  responses: {
436
588
  200: {
437
589
  content: {
438
- 'application/json': components['schemas']['WorkspaceEnableResponse'];
590
+ "application/json": components["schemas"]["WorkspaceEnableResponse"];
439
591
  };
440
592
  };
441
593
  400: {
442
594
  content: {
443
- 'application/json': components['schemas']['ErrorResponse'];
595
+ "application/json": components["schemas"]["ErrorResponse"];
444
596
  };
445
597
  };
446
598
  502: {
447
599
  content: {
448
- 'application/json': components['schemas']['ErrorResponse'];
600
+ "application/json": components["schemas"]["ErrorResponse"];
449
601
  };
450
602
  };
451
603
  };
@@ -454,8 +606,8 @@ type operations = {
454
606
  responses: {
455
607
  200: {
456
608
  content: {
457
- 'application/json': {
458
- data?: components['schemas']['ToolSummary'][];
609
+ "application/json": {
610
+ data?: components["schemas"]["ToolSummary"][];
459
611
  };
460
612
  };
461
613
  };
@@ -464,33 +616,33 @@ type operations = {
464
616
  executeTool: {
465
617
  parameters: {
466
618
  path: {
467
- toolId: components['parameters']['ToolId'];
619
+ toolId: components["parameters"]["ToolId"];
468
620
  };
469
621
  };
470
622
  requestBody: {
471
623
  content: {
472
- 'application/json': components['schemas']['ExecuteToolRequest'];
624
+ "application/json": components["schemas"]["ExecuteToolRequest"];
473
625
  };
474
626
  };
475
627
  responses: {
476
628
  200: {
477
629
  content: {
478
- 'application/json': components['schemas']['ExecuteToolResponse'];
630
+ "application/json": components["schemas"]["ExecuteToolResponse"];
479
631
  };
480
632
  };
481
633
  400: {
482
634
  content: {
483
- 'application/json': components['schemas']['ErrorResponse'];
635
+ "application/json": components["schemas"]["ErrorResponse"];
484
636
  };
485
637
  };
486
638
  404: {
487
639
  content: {
488
- 'application/json': components['schemas']['ErrorResponse'];
640
+ "application/json": components["schemas"]["ErrorResponse"];
489
641
  };
490
642
  };
491
643
  409: {
492
644
  content: {
493
- 'application/json': components['schemas']['ErrorResponse'];
645
+ "application/json": components["schemas"]["ErrorResponse"];
494
646
  };
495
647
  };
496
648
  };
@@ -506,8 +658,14 @@ type ClientConfig = {
506
658
  debug?: (...a: any[]) => void;
507
659
  error?: (...a: any[]) => void;
508
660
  };
661
+ workspaceId?: string;
662
+ getWorkspaceId?: () => string | undefined;
509
663
  };
510
664
  type AgentDetail = components['schemas']['AgentDetail'];
665
+ type AgentSummary = components['schemas']['AgentSummary'];
666
+ type AgentListResponse = components['schemas']['AgentListResponse'];
667
+ type CreateAgentRequest = components['schemas']['CreateAgentRequest'];
668
+ type UpdateAgentRequest = components['schemas']['UpdateAgentRequest'];
511
669
  type KnowledgeUploadRequest = components['schemas']['KnowledgeUploadRequest'];
512
670
  type KnowledgeUploadResponse = components['schemas']['KnowledgeUploadResponse'];
513
671
  type KnowledgeUploadListResponse = components['schemas']['KnowledgeUploadListResponse'];
@@ -554,11 +712,13 @@ type RetryPolicy = {
554
712
  retryOn?: (err: unknown, attempt: number) => boolean;
555
713
  };
556
714
 
557
- declare function createAgentsApi(cfg: ClientConfig & {
715
+ declare function createAgentInstructionsApi(cfg: ClientConfig & {
558
716
  retry?: RetryPolicy;
559
717
  }): {
560
- get(agentId: string): Promise<AgentDetail>;
561
- delete(agentId: string): Promise<void>;
718
+ list(agentId: string, opts?: {
719
+ versionId?: string;
720
+ }): Promise<AgentInstructionsResponse>;
721
+ create(agentId: string, payload: CreateInstructionRequest): Promise<InstructionCreatedResponse>;
562
722
  };
563
723
 
564
724
  declare function createAgentKnowledgeApi(cfg: ClientConfig & {
@@ -569,15 +729,6 @@ declare function createAgentKnowledgeApi(cfg: ClientConfig & {
569
729
  listUploads(agentId: string): Promise<AgentKnowledgeUploadsResponse>;
570
730
  };
571
731
 
572
- declare function createAgentInstructionsApi(cfg: ClientConfig & {
573
- retry?: RetryPolicy;
574
- }): {
575
- list(agentId: string, opts?: {
576
- versionId?: string;
577
- }): Promise<AgentInstructionsResponse>;
578
- create(agentId: string, payload: CreateInstructionRequest): Promise<InstructionCreatedResponse>;
579
- };
580
-
581
732
  declare function createAgentPhonesApi(cfg: ClientConfig & {
582
733
  retry?: RetryPolicy;
583
734
  }): {
@@ -585,6 +736,98 @@ declare function createAgentPhonesApi(cfg: ClientConfig & {
585
736
  disconnect(agentId: string, phoneId: string): Promise<void>;
586
737
  };
587
738
 
739
+ type AgentInstructionsApi = ReturnType<typeof createAgentInstructionsApi>;
740
+ type AgentKnowledgeApi = ReturnType<typeof createAgentKnowledgeApi>;
741
+ type AgentPhonesApi = ReturnType<typeof createAgentPhonesApi>;
742
+ type AgentInstructionsHelper = ReturnType<typeof bindAgentInstructions>;
743
+ type AgentKnowledgeHelper = ReturnType<typeof bindAgentKnowledge>;
744
+ type AgentPhonesHelper = ReturnType<typeof bindAgentPhones>;
745
+ interface AgentEntity extends AgentDetail {
746
+ instructions: AgentInstructionsHelper;
747
+ knowledge: AgentKnowledgeHelper;
748
+ phones: AgentPhonesHelper;
749
+ refresh(): Promise<AgentEntity>;
750
+ }
751
+ type AgentEntityFactoryOptions = {
752
+ instructionsApi: AgentInstructionsApi;
753
+ knowledgeApi: AgentKnowledgeApi;
754
+ phonesApi: AgentPhonesApi;
755
+ reload(agentId: string): Promise<AgentEntity>;
756
+ };
757
+ declare const bindAgentInstructions: (api: AgentInstructionsApi, agentId: string) => {
758
+ list(opts?: {
759
+ versionId?: string;
760
+ }): Promise<{
761
+ data: components["schemas"]["Instruction"][];
762
+ versionId?: string;
763
+ }>;
764
+ create(payload: CreateInstructionRequest): Promise<{
765
+ id: string;
766
+ versionId: string;
767
+ order: number;
768
+ createdAt: string;
769
+ }>;
770
+ };
771
+ declare const bindAgentKnowledge: (api: AgentKnowledgeApi, agentId: string) => {
772
+ upload(payload: KnowledgeUploadRequest): Promise<{
773
+ document_id: string;
774
+ file_path: string;
775
+ file_name: string;
776
+ source: string;
777
+ drive_file_id?: string | null;
778
+ user_id: string;
779
+ status: "queued" | "processing" | "completed" | "failed";
780
+ }>;
781
+ listBases(): Promise<{
782
+ data?: components["schemas"]["KnowledgeBaseSummary"][];
783
+ agent_id?: string;
784
+ }>;
785
+ listUploads(): Promise<{
786
+ data: ({
787
+ document_id: string;
788
+ file_path: string;
789
+ file_name: string;
790
+ source: string;
791
+ drive_file_id?: string | null;
792
+ user_id: string;
793
+ status: "queued" | "processing" | "completed" | "failed";
794
+ })[];
795
+ }>;
796
+ };
797
+ declare const bindAgentPhones: (api: AgentPhonesApi, agentId: string) => {
798
+ connect(payload: ConnectPhoneRequest): Promise<{
799
+ agent_id: string;
800
+ phone_id: string;
801
+ allow_all: boolean;
802
+ test_phones?: string[];
803
+ channel?: string | null;
804
+ assigned_at?: string | null;
805
+ }>;
806
+ disconnect(phoneId: string): Promise<void>;
807
+ };
808
+ declare const createAgentEntity: (dto: AgentDetail, options: AgentEntityFactoryOptions) => AgentEntity;
809
+
810
+ type AgentEntityDependencies = {
811
+ instructionsApi: ReturnType<typeof createAgentInstructionsApi>;
812
+ knowledgeApi: ReturnType<typeof createAgentKnowledgeApi>;
813
+ phonesApi: ReturnType<typeof createAgentPhonesApi>;
814
+ };
815
+ type AgentsApi = {
816
+ list(): Promise<AgentListResponse>;
817
+ get(agentId: string): Promise<AgentDetail>;
818
+ create(payload: CreateAgentRequest): Promise<AgentDetail>;
819
+ update(agentId: string, payload: UpdateAgentRequest): Promise<AgentDetail>;
820
+ delete(agentId: string): Promise<void>;
821
+ };
822
+ type AgentsApiWithEntities = Omit<AgentsApi, 'get' | 'create' | 'update'> & {
823
+ get(agentId: string): Promise<AgentEntity>;
824
+ create(payload: CreateAgentRequest): Promise<AgentEntity>;
825
+ update(agentId: string, payload: UpdateAgentRequest): Promise<AgentEntity>;
826
+ };
827
+ declare function createAgentsApi(cfg: ClientConfig & {
828
+ retry?: RetryPolicy;
829
+ }, relatedApis?: AgentEntityDependencies): AgentsApi | AgentsApiWithEntities;
830
+
588
831
  declare function createWorkspacesApi(cfg: ClientConfig & {
589
832
  retry?: RetryPolicy;
590
833
  }): {
@@ -601,9 +844,56 @@ declare function createToolsApi(cfg: ClientConfig & {
601
844
  execute(toolId: string, payload: ExecuteToolRequest): Promise<ExecuteToolResponse>;
602
845
  };
603
846
 
604
- declare function createClient(cfg: ClientConfig & {
847
+ declare function createClient(initialCfg: ClientConfig & {
605
848
  retry?: RetryPolicy;
606
849
  }): {
850
+ workspace: {
851
+ get: () => string;
852
+ set(id?: string): void;
853
+ useGetter(getter?: () => string | undefined): void;
854
+ clear(): void;
855
+ scoped(id: string): {
856
+ workspace: {
857
+ get: () => string;
858
+ set(id?: string): void;
859
+ useGetter(getter?: () => string | undefined): void;
860
+ clear(): void;
861
+ scoped(id: string): any;
862
+ };
863
+ agents: {
864
+ knowledge: {
865
+ upload(agentId: string, payload: KnowledgeUploadRequest): Promise<KnowledgeUploadResponse>;
866
+ listBases(agentId: string): Promise<AgentKnowledgeBasesResponse>;
867
+ listUploads(agentId: string): Promise<AgentKnowledgeUploadsResponse>;
868
+ };
869
+ instructions: {
870
+ list(agentId: string, opts?: {
871
+ versionId?: string;
872
+ }): Promise<AgentInstructionsResponse>;
873
+ create(agentId: string, payload: CreateInstructionRequest): Promise<InstructionCreatedResponse>;
874
+ };
875
+ phones: {
876
+ connect(agentId: string, payload: ConnectPhoneRequest): Promise<PhoneAssignmentResponse>;
877
+ disconnect(agentId: string, phoneId: string): Promise<void>;
878
+ };
879
+ list: () => Promise<AgentListResponse>;
880
+ delete: (agentId: string) => Promise<void>;
881
+ get(agentId: string): Promise<AgentEntity>;
882
+ create(payload: CreateAgentRequest): Promise<AgentEntity>;
883
+ update(agentId: string, payload: UpdateAgentRequest): Promise<AgentEntity>;
884
+ };
885
+ workspaces: {
886
+ listPhones(workspaceId: string, opts?: {
887
+ channel?: WorkspacePhoneChannel;
888
+ }): Promise<WorkspacePhonesResponse>;
889
+ enable(workspaceId: string, payload: WorkspaceEnableRequest): Promise<WorkspaceEnableResponse>;
890
+ };
891
+ tools: {
892
+ list(): Promise<ToolsCatalogResponse>;
893
+ execute(toolId: string, payload: ExecuteToolRequest): Promise<ExecuteToolResponse>;
894
+ };
895
+ };
896
+ };
607
897
  agents: {
608
898
  knowledge: {
609
899
  upload(agentId: string, payload: KnowledgeUploadRequest): Promise<KnowledgeUploadResponse>;
@@ -620,8 +910,11 @@ declare function createClient(cfg: ClientConfig & {
620
910
  connect(agentId: string, payload: ConnectPhoneRequest): Promise<PhoneAssignmentResponse>;
621
911
  disconnect(agentId: string, phoneId: string): Promise<void>;
622
912
  };
623
- get(agentId: string): Promise<AgentDetail>;
624
- delete(agentId: string): Promise<void>;
913
+ list: () => Promise<AgentListResponse>;
914
+ delete: (agentId: string) => Promise<void>;
915
+ get(agentId: string): Promise<AgentEntity>;
916
+ create(payload: CreateAgentRequest): Promise<AgentEntity>;
917
+ update(agentId: string, payload: UpdateAgentRequest): Promise<AgentEntity>;
625
918
  };
626
919
  workspaces: {
627
920
  listPhones(workspaceId: string, opts?: {
@@ -639,14 +932,15 @@ declare function createHttp(cfg: ClientConfig & {
639
932
  retry?: RetryPolicy;
640
933
  }): {
641
934
  base: string;
642
- headers: Record<string, string>;
643
935
  timeout: number;
644
936
  log: {
645
937
  debug?: (...a: any[]) => void;
646
938
  error?: (...a: any[]) => void;
647
939
  };
648
940
  retry: RetryPolicy;
649
- doFetch: (url: string, init: RequestInit) => Promise<Response>;
941
+ doFetch: (url: string, init?: RequestInit) => Promise<Response>;
942
+ buildHeaders: (extra?: HeadersInit) => Record<string, string>;
943
+ resolveWorkspaceId: () => string;
650
944
  };
651
945
 
652
- export { type AgentDetail, type AgentInstructionsResponse, type AgentKnowledgeBasesResponse, type AgentKnowledgeUploadsResponse, type ClientConfig, type ConnectPhoneRequest, type CreateInstructionRequest, type ErrorResponse, type ExecuteToolRequest, type ExecuteToolResponse, HttpError, type Instruction, type InstructionCreatedResponse, type KnowledgeUploadListResponse, type KnowledgeUploadRequest, type KnowledgeUploadResponse, NetworkError, type PhoneAssignmentResponse, type RetryPolicy, TimeoutError, type ToolSummary, type ToolsCatalogResponse, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, createAgentInstructionsApi, createAgentKnowledgeApi, createAgentPhonesApi, createAgentsApi, createClient, createHttp, createToolsApi, createWorkspacesApi };
946
+ export { type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentInstructionsResponse, type AgentKnowledgeBasesResponse, type AgentKnowledgeUploadsResponse, type AgentListResponse, type AgentSummary, type AgentsApi, type AgentsApiWithEntities, type ClientConfig, type ConnectPhoneRequest, type CreateAgentRequest, type CreateInstructionRequest, type ErrorResponse, type ExecuteToolRequest, type ExecuteToolResponse, HttpError, type Instruction, type InstructionCreatedResponse, type KnowledgeUploadListResponse, type KnowledgeUploadRequest, type KnowledgeUploadResponse, NetworkError, type PhoneAssignmentResponse, type RetryPolicy, TimeoutError, type ToolSummary, type ToolsCatalogResponse, type UpdateAgentRequest, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, bindAgentInstructions, bindAgentKnowledge, bindAgentPhones, createAgentEntity, createAgentInstructionsApi, createAgentKnowledgeApi, createAgentPhonesApi, createAgentsApi, createClient, createHttp, createToolsApi, createWorkspacesApi };