@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/CHANGELOG.md +31 -0
- package/README.md +161 -0
- package/dist/index.cjs +171 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -4
- package/dist/index.d.ts +112 -4
- package/dist/index.js +168 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
## v1.15.0
|
|
2
|
+
|
|
3
|
+
## [1.15.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.14.0...v1.15.0) (2025-10-21)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* agregar manejador y comando para la creación de horarios de agentes, incluyendo pruebas unitarias y mapeo de comandos ([682411b](https://github.com/julio-supervisor/agents-studio-be/commit/682411bc016f09adc8928f5b284af111c82764e5))
|
|
8
|
+
* agregar manejo de excepciones en horarios de agentes, incluyendo operaciones para obtener, actualizar, eliminar y listar excepciones ([1beacf6](https://github.com/julio-supervisor/agents-studio-be/commit/1beacf69ff17246e43d9ba7e8cfba73e4cb1f872))
|
|
9
|
+
* agregar pruebas para el manejo de excepciones en horarios de agentes ([3d6f8b4](https://github.com/julio-supervisor/agents-studio-be/commit/3d6f8b45a663cfd64725be4f6671d844b55b3cb2))
|
|
10
|
+
* agregar pruebas unitarias para el mapeo y la gestión de excepciones de horarios de agentes ([6bfc2f9](https://github.com/julio-supervisor/agents-studio-be/commit/6bfc2f96721166cb8b7bf14501a0bd48e5e4b25d))
|
|
11
|
+
* agregar pruebas unitarias para la fábrica de especificaciones de versiones de agentes, incluyendo filtros y manejo de excepciones ([8868f78](https://github.com/julio-supervisor/agents-studio-be/commit/8868f78aa2307a39750dd08d932c8c3bf69b4112))
|
|
12
|
+
* agregar pruebas unitarias para la gestión de excepciones y horarios de agentes, incluyendo especificaciones de tipo ORM ([592c016](https://github.com/julio-supervisor/agents-studio-be/commit/592c01673be38d7e1188a89f8103e226b05a4e47))
|
|
13
|
+
* agregar pruebas unitarias para la gestión de versiones de agentes y especificaciones de tipo ORM ([898350f](https://github.com/julio-supervisor/agents-studio-be/commit/898350f17ce4d9390d47adb66d8f00066ee25f82))
|
|
14
|
+
* Enhance ListAgentScheduleExceptionsHandler to support combined filter and or conditions ([bf6e881](https://github.com/julio-supervisor/agents-studio-be/commit/bf6e881d61895ffac98c3cfd9e2b2c35d7745274))
|
|
15
|
+
* implement agent schedule and exception management ([3502cf6](https://github.com/julio-supervisor/agents-studio-be/commit/3502cf623a4fd4440ae8a9cd2b3acbcf982fe15e))
|
|
16
|
+
* implementar API para excepciones de horarios de agentes, incluyendo métodos para listar, obtener, crear, actualizar y eliminar excepciones ([154ddee](https://github.com/julio-supervisor/agents-studio-be/commit/154ddeed944c7905a40ed71e697773ee28ffa5ce))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## v1.14.0
|
|
20
|
+
|
|
21
|
+
## [1.14.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.13.0...v1.14.0) (2025-10-21)
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* add Agent Versions controller and related DTOs, enhance publish functionality with notes ([9227708](https://github.com/julio-supervisor/agents-studio-be/commit/92277085c8441fefba4fb52d6859441269132de1))
|
|
26
|
+
* agregar funcionalidades para clonar, publicar y actualizar notas de versiones de agentes, y ajustar esquemas y rutas en la API ([7a01fa0](https://github.com/julio-supervisor/agents-studio-be/commit/7a01fa03ff30e9fd6a9b4358a2df2f709a61c189))
|
|
27
|
+
* agregar mapeo de módulos para la ruta de versiones de agentes en jest.config.js ([11c4e34](https://github.com/julio-supervisor/agents-studio-be/commit/11c4e340608de1b91f2461912b23e3c484e92f59))
|
|
28
|
+
* agregar mapeo de módulos para la ruta de versiones de agentes en package.json ([a63586e](https://github.com/julio-supervisor/agents-studio-be/commit/a63586eb845c21c276776e0d023719a37f4896e5))
|
|
29
|
+
* implement Agent Version Management with TypeORM ([736ed04](https://github.com/julio-supervisor/agents-studio-be/commit/736ed045a4e395674a4ee1c623d44d265421b386))
|
|
30
|
+
|
|
31
|
+
|
|
1
32
|
## v1.13.0
|
|
2
33
|
|
|
3
34
|
## [1.13.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.12.0...v1.13.0) (2025-10-20)
|
package/README.md
CHANGED
|
@@ -63,6 +63,164 @@ await client.tools.uploadResource(tools.data[0].identifier, formData);
|
|
|
63
63
|
await client.agents.delete(agent.agentId);
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
## Catálogos (Catalogs)
|
|
67
|
+
|
|
68
|
+
Los catálogos exponen valores normalizados reutilizables (idiomas, estilos de mensaje, estilos de tono, etiquetas y voces).
|
|
69
|
+
|
|
70
|
+
Namespace: `client.catalogs`
|
|
71
|
+
|
|
72
|
+
Operaciones disponibles:
|
|
73
|
+
|
|
74
|
+
- `catalogs.list(options?)` — lista items paginados con filtros y búsqueda.
|
|
75
|
+
- `catalogs.get(itemId)` — obtiene el detalle de un item.
|
|
76
|
+
- `catalogs.create(payload)` — crea un nuevo item de catálogo.
|
|
77
|
+
- `catalogs.remove(itemId)` — elimina (soft-delete) un item.
|
|
78
|
+
|
|
79
|
+
Ejemplos:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
// listar idiomas globales con búsqueda y paginación
|
|
83
|
+
const page1 = await client.catalogs.list({
|
|
84
|
+
search: 'spanish',
|
|
85
|
+
filter: { type: 'language', scope: 'global' },
|
|
86
|
+
limit: 20,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const page2 = await page1.next();
|
|
90
|
+
|
|
91
|
+
// crear un idioma global
|
|
92
|
+
const language = await client.catalogs.create({
|
|
93
|
+
type: 'language',
|
|
94
|
+
scope: 'global',
|
|
95
|
+
name: 'Español (México)',
|
|
96
|
+
description: 'Variante de español latino con modismos mexicanos',
|
|
97
|
+
metadata: { code: 'es', locale: 'es-MX' },
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// crear una voz por workspace (requiere workspaceId)
|
|
101
|
+
const voice = await client.catalogs.create({
|
|
102
|
+
type: 'voice',
|
|
103
|
+
scope: 'workspace',
|
|
104
|
+
workspaceId: client.workspace.get(),
|
|
105
|
+
name: 'Brand Voice A',
|
|
106
|
+
description: 'Voz femenina, cálida',
|
|
107
|
+
metadata: {
|
|
108
|
+
language: 'es',
|
|
109
|
+
gender: 'female',
|
|
110
|
+
tone: 'warm',
|
|
111
|
+
provider: 'elevenlabs',
|
|
112
|
+
previewUrl: 'https://cdn.example.com/voices/brand-a.mp3',
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// eliminar por id
|
|
117
|
+
await client.catalogs.remove(language.data.id);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Notas:
|
|
121
|
+
|
|
122
|
+
- Campos `type` válidos: `language`, `message_style`, `tone_style`, `tag`, `voice`.
|
|
123
|
+
- `scope` puede ser `global` o `workspace`. Si es `workspace`, envía `workspaceId`.
|
|
124
|
+
- El shape de `metadata` depende de `type` (ver ejemplos arriba).
|
|
125
|
+
|
|
126
|
+
## Versiones de agente (Agent Versions)
|
|
127
|
+
|
|
128
|
+
Namespace: `client.agentVersions`
|
|
129
|
+
|
|
130
|
+
Operaciones clave:
|
|
131
|
+
|
|
132
|
+
- `agentVersions.list(agentId, { page, limit, filter })`
|
|
133
|
+
- `agentVersions.get(agentId, versionId)`
|
|
134
|
+
- `agentVersions.create(agentId, payload?)` — crea versión en `draft`.
|
|
135
|
+
- `agentVersions.clone(agentId, versionId)` — clona una versión.
|
|
136
|
+
- `agentVersions.publish(agentId, versionId, payload?)` — publica y marca como `active`.
|
|
137
|
+
- `agentVersions.updateNotes(agentId, versionId, { notes })`
|
|
138
|
+
- Instrucciones por versión:
|
|
139
|
+
- `agentVersions.listInstructions(agentId, versionId, opts?)`
|
|
140
|
+
- `agentVersions.createInstruction(agentId, versionId, dto)`
|
|
141
|
+
- `agentVersions.updateInstruction(agentId, versionId, instructionId, dto)`
|
|
142
|
+
- `agentVersions.deleteInstruction(agentId, versionId, instructionId)`
|
|
143
|
+
|
|
144
|
+
Ejemplo:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
// crear una nueva versión draft
|
|
148
|
+
const v1 = await client.agentVersions.create(agent.agentId);
|
|
149
|
+
|
|
150
|
+
// agregar instrucciones a la versión
|
|
151
|
+
await client.agentVersions.createInstruction(agent.agentId, v1.id, {
|
|
152
|
+
order: 0,
|
|
153
|
+
content: 'Saluda con empatía y brevedad',
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// publicar la versión
|
|
157
|
+
const active = await client.agentVersions.publish(agent.agentId, v1.id, {
|
|
158
|
+
notes: 'Primera publicación estable',
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// clonar una versión activa (crea un nuevo draft)
|
|
162
|
+
const v2 = await client.agentVersions.clone(agent.agentId, active.id);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Estados soportados: `draft`, `active`, `archived`.
|
|
166
|
+
|
|
167
|
+
## Horarios del agente (Agent Schedules)
|
|
168
|
+
|
|
169
|
+
Namespaces: `client.agentSchedule` y `client.agentScheduleExceptions`
|
|
170
|
+
|
|
171
|
+
Operaciones de horario semanal (`agentSchedule`):
|
|
172
|
+
|
|
173
|
+
- `get(agentId)` — obtiene el horario semanal.
|
|
174
|
+
- `create(agentId, dto)` — crea/establece horario.
|
|
175
|
+
- `update(agentId, dto)` — actualiza horario.
|
|
176
|
+
|
|
177
|
+
Ejemplo de horario:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
// activar horario de lunes a viernes con timezone America/Mexico_City
|
|
181
|
+
await client.agentSchedule.create(agent.agentId, {
|
|
182
|
+
timezone: 'America/Mexico_City',
|
|
183
|
+
isEnabled: true,
|
|
184
|
+
monday: { enabled: true, start: '09:00', end: '18:00' },
|
|
185
|
+
tuesday: { enabled: true, start: '09:00', end: '18:00' },
|
|
186
|
+
wednesday: { enabled: true, start: '09:00', end: '18:00' },
|
|
187
|
+
thursday: { enabled: true, start: '09:00', end: '18:00' },
|
|
188
|
+
friday: { enabled: true, start: '09:00', end: '18:00' },
|
|
189
|
+
saturday: { enabled: false },
|
|
190
|
+
sunday: { enabled: false },
|
|
191
|
+
outOfHoursBehavior: 'offline',
|
|
192
|
+
outOfHoursMessage: 'Nuestro equipo está fuera de horario. Vuelve más tarde.',
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Operaciones de excepciones por fecha (`agentScheduleExceptions`):
|
|
197
|
+
|
|
198
|
+
- `list(agentId, opts?)` — paginado con filtros (por rango de fechas, etc.).
|
|
199
|
+
- `get(agentId, exceptionId)`
|
|
200
|
+
- `create(agentId, dto)` — soporte para `isClosed` o ventana `startTime`/`endTime`.
|
|
201
|
+
- `update(agentId, exceptionId, dto)`
|
|
202
|
+
- `delete(agentId, exceptionId)`
|
|
203
|
+
|
|
204
|
+
Ejemplo de excepciones:
|
|
205
|
+
|
|
206
|
+
```ts
|
|
207
|
+
// feriado: cerrado todo el día
|
|
208
|
+
await client.agentScheduleExceptions.create(agent.agentId, {
|
|
209
|
+
exceptionDate: '2025-11-20',
|
|
210
|
+
isClosed: true,
|
|
211
|
+
reason: 'Día de la Revolución',
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// media jornada en una fecha específica
|
|
215
|
+
await client.agentScheduleExceptions.create(agent.agentId, {
|
|
216
|
+
exceptionDate: '2025-12-24',
|
|
217
|
+
isClosed: false,
|
|
218
|
+
startTime: '09:00',
|
|
219
|
+
endTime: '13:00',
|
|
220
|
+
reason: 'Nochebuena',
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
66
224
|
### Ejemplo de CRUD completo
|
|
67
225
|
|
|
68
226
|
Consulta el archivo `examples/agents-crud.ts` para ver un flujo end-to-end que:
|
|
@@ -218,6 +376,9 @@ Consulta el OpenAPI (`docs/api-spec/openapi.yaml`) para revisar nuevos scopes co
|
|
|
218
376
|
- **Gestión de API Keys desde el SDK**: `client.apiKeys` expone helpers tipados para listar, crear y revocar credenciales con el mismo manejo de cabeceras, timeouts y reintentos del resto del cliente.
|
|
219
377
|
- **Scopes documentados**: tabla de scopes disponibles y recomendaciones para definir permisos mínimos por workspace.
|
|
220
378
|
- **Mejoras de gobernanza**: se incorporaron pautas de rotación, almacenamiento seguro y segmentación por entorno directamente en la guía del SDK.
|
|
379
|
+
- **Catálogos**: nuevo namespace `client.catalogs` con CRUD y paginación para `language`, `message_style`, `tone_style`, `tag` y `voice`.
|
|
380
|
+
- **Versiones de agente**: namespace `client.agentVersions` con operaciones para crear, clonar, publicar y gestionar instrucciones por versión.
|
|
381
|
+
- **Horarios del agente**: namespaces `client.agentSchedule` y `client.agentScheduleExceptions` para configurar disponibilidad semanal y excepciones por fecha.
|
|
221
382
|
|
|
222
383
|
## Errores tipados y reintentos
|
|
223
384
|
|
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
bindAgentInstructions: () => bindAgentInstructions,
|
|
27
27
|
bindAgentPhones: () => bindAgentPhones,
|
|
28
28
|
bindAgentSchedule: () => bindAgentSchedule,
|
|
29
|
+
bindAgentScheduleExceptions: () => bindAgentScheduleExceptions,
|
|
29
30
|
bindAgentTags: () => bindAgentTags,
|
|
30
31
|
bindAgentVersions: () => bindAgentVersions,
|
|
31
32
|
createAgentBlueprintsApi: () => createAgentBlueprintsApi,
|
|
@@ -33,10 +34,12 @@ __export(index_exports, {
|
|
|
33
34
|
createAgentInstructionsApi: () => createAgentInstructionsApi,
|
|
34
35
|
createAgentPhonesApi: () => createAgentPhonesApi,
|
|
35
36
|
createAgentScheduleApi: () => createAgentScheduleApi,
|
|
37
|
+
createAgentScheduleExceptionsApi: () => createAgentScheduleExceptionsApi,
|
|
36
38
|
createAgentTagsApi: () => createAgentTagsApi,
|
|
37
39
|
createAgentVersionsApi: () => createAgentVersionsApi,
|
|
38
40
|
createAgentsApi: () => createAgentsApi,
|
|
39
41
|
createApiKeysApi: () => createApiKeysApi,
|
|
42
|
+
createCatalogsApi: () => createCatalogsApi,
|
|
40
43
|
createClient: () => createClient,
|
|
41
44
|
createHttp: () => createHttp,
|
|
42
45
|
createToolsApi: () => createToolsApi,
|
|
@@ -570,6 +573,14 @@ function createAgentScheduleApi(cfg) {
|
|
|
570
573
|
});
|
|
571
574
|
return res.json();
|
|
572
575
|
},
|
|
576
|
+
async create(agentId, payload) {
|
|
577
|
+
const res = await doFetch(`${base}/v1/agents/${agentId}/schedule`, {
|
|
578
|
+
method: "POST",
|
|
579
|
+
headers: jsonHeaders,
|
|
580
|
+
body: JSON.stringify(payload)
|
|
581
|
+
});
|
|
582
|
+
return res.json();
|
|
583
|
+
},
|
|
573
584
|
async update(agentId, payload) {
|
|
574
585
|
const res = await doFetch(`${base}/v1/agents/${agentId}/schedule`, {
|
|
575
586
|
method: "PUT",
|
|
@@ -581,6 +592,72 @@ function createAgentScheduleApi(cfg) {
|
|
|
581
592
|
};
|
|
582
593
|
}
|
|
583
594
|
|
|
595
|
+
// src/api/agent-schedule-exceptions.ts
|
|
596
|
+
function createAgentScheduleExceptionsApi(cfg) {
|
|
597
|
+
const { base, doFetch } = createHttp(cfg);
|
|
598
|
+
const jsonHeaders = { "content-type": "application/json" };
|
|
599
|
+
const fetchExceptionsPage = async (agentId, options = {}) => {
|
|
600
|
+
const query = serializeListOptions(options ?? {});
|
|
601
|
+
const res = await doFetch(
|
|
602
|
+
`${base}/v1/agents/${agentId}/schedule/exceptions`,
|
|
603
|
+
{
|
|
604
|
+
method: "GET",
|
|
605
|
+
query
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
return res.json();
|
|
609
|
+
};
|
|
610
|
+
return {
|
|
611
|
+
async list(agentId, options = {}) {
|
|
612
|
+
const normalizedOptions = {
|
|
613
|
+
...options ?? {}
|
|
614
|
+
};
|
|
615
|
+
const fetchPage = (pageOptions) => fetchExceptionsPage(agentId, pageOptions);
|
|
616
|
+
const response = await fetchPage(normalizedOptions);
|
|
617
|
+
return attachPaginator(response, fetchPage, normalizedOptions);
|
|
618
|
+
},
|
|
619
|
+
async get(agentId, exceptionId) {
|
|
620
|
+
const res = await doFetch(
|
|
621
|
+
`${base}/v1/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
622
|
+
{
|
|
623
|
+
method: "GET"
|
|
624
|
+
}
|
|
625
|
+
);
|
|
626
|
+
return res.json();
|
|
627
|
+
},
|
|
628
|
+
async create(agentId, payload) {
|
|
629
|
+
const res = await doFetch(
|
|
630
|
+
`${base}/v1/agents/${agentId}/schedule/exceptions`,
|
|
631
|
+
{
|
|
632
|
+
method: "POST",
|
|
633
|
+
headers: jsonHeaders,
|
|
634
|
+
body: JSON.stringify(payload)
|
|
635
|
+
}
|
|
636
|
+
);
|
|
637
|
+
return res.json();
|
|
638
|
+
},
|
|
639
|
+
async update(agentId, exceptionId, payload) {
|
|
640
|
+
const res = await doFetch(
|
|
641
|
+
`${base}/v1/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
642
|
+
{
|
|
643
|
+
method: "PATCH",
|
|
644
|
+
headers: jsonHeaders,
|
|
645
|
+
body: JSON.stringify(payload)
|
|
646
|
+
}
|
|
647
|
+
);
|
|
648
|
+
return res.json();
|
|
649
|
+
},
|
|
650
|
+
async delete(agentId, exceptionId) {
|
|
651
|
+
await doFetch(
|
|
652
|
+
`${base}/v1/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
653
|
+
{
|
|
654
|
+
method: "DELETE"
|
|
655
|
+
}
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
|
|
584
661
|
// src/api/agent-tags.ts
|
|
585
662
|
function createAgentTagsApi(cfg) {
|
|
586
663
|
const { base, doFetch } = createHttp(cfg);
|
|
@@ -749,13 +826,34 @@ var bindAgentPhones = (api, agentId) => ({
|
|
|
749
826
|
return api.disconnect(agentId, phoneId);
|
|
750
827
|
}
|
|
751
828
|
});
|
|
752
|
-
var
|
|
829
|
+
var bindAgentScheduleExceptions = (api, agentId) => ({
|
|
830
|
+
list(opts) {
|
|
831
|
+
return api.list(agentId, opts);
|
|
832
|
+
},
|
|
833
|
+
get(exceptionId) {
|
|
834
|
+
return api.get(agentId, exceptionId);
|
|
835
|
+
},
|
|
836
|
+
create(payload) {
|
|
837
|
+
return api.create(agentId, payload);
|
|
838
|
+
},
|
|
839
|
+
update(exceptionId, payload) {
|
|
840
|
+
return api.update(agentId, exceptionId, payload);
|
|
841
|
+
},
|
|
842
|
+
delete(exceptionId) {
|
|
843
|
+
return api.delete(agentId, exceptionId);
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
var bindAgentSchedule = (scheduleApi, exceptionsApi, agentId) => ({
|
|
753
847
|
get() {
|
|
754
|
-
return
|
|
848
|
+
return scheduleApi.get(agentId);
|
|
849
|
+
},
|
|
850
|
+
create(payload) {
|
|
851
|
+
return scheduleApi.create(agentId, payload);
|
|
755
852
|
},
|
|
756
853
|
update(payload) {
|
|
757
|
-
return
|
|
758
|
-
}
|
|
854
|
+
return scheduleApi.update(agentId, payload);
|
|
855
|
+
},
|
|
856
|
+
exceptions: bindAgentScheduleExceptions(exceptionsApi, agentId)
|
|
759
857
|
});
|
|
760
858
|
var bindAgentVersions = (api, agentId) => ({
|
|
761
859
|
list(opts) {
|
|
@@ -822,6 +920,7 @@ var createAgentEntity = (dto, options) => {
|
|
|
822
920
|
tagsApi,
|
|
823
921
|
phonesApi,
|
|
824
922
|
scheduleApi,
|
|
923
|
+
scheduleExceptionsApi,
|
|
825
924
|
versionsApi,
|
|
826
925
|
blueprintsApi,
|
|
827
926
|
reload,
|
|
@@ -833,7 +932,11 @@ var createAgentEntity = (dto, options) => {
|
|
|
833
932
|
instructions: bindAgentInstructions(instructionsApi, dto.agentId),
|
|
834
933
|
tagAssignments: bindAgentTags(tagsApi, dto.agentId),
|
|
835
934
|
phones: bindAgentPhones(phonesApi, dto.agentId),
|
|
836
|
-
schedule: bindAgentSchedule(
|
|
935
|
+
schedule: bindAgentSchedule(
|
|
936
|
+
scheduleApi,
|
|
937
|
+
scheduleExceptionsApi,
|
|
938
|
+
dto.agentId
|
|
939
|
+
),
|
|
837
940
|
versions: bindAgentVersions(versionsApi, dto.agentId),
|
|
838
941
|
blueprints: bindAgentBlueprints(blueprintsApi, dto.agentId),
|
|
839
942
|
async save(patch) {
|
|
@@ -917,6 +1020,7 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
917
1020
|
tagsApi: relatedApis.tagsApi,
|
|
918
1021
|
phonesApi: relatedApis.phonesApi,
|
|
919
1022
|
scheduleApi: relatedApis.scheduleApi,
|
|
1023
|
+
scheduleExceptionsApi: relatedApis.scheduleExceptionsApi,
|
|
920
1024
|
versionsApi: relatedApis.versionsApi,
|
|
921
1025
|
blueprintsApi: relatedApis.blueprintsApi,
|
|
922
1026
|
reload: async (agentId) => {
|
|
@@ -992,6 +1096,52 @@ function createApiKeysApi(cfg) {
|
|
|
992
1096
|
};
|
|
993
1097
|
}
|
|
994
1098
|
|
|
1099
|
+
// src/api/catalogs.ts
|
|
1100
|
+
function createCatalogsApi(cfg) {
|
|
1101
|
+
const { base, doFetch } = createHttp(cfg);
|
|
1102
|
+
const jsonHeaders = { "content-type": "application/json" };
|
|
1103
|
+
const fetchCatalogItemsPage = async (options = {}) => {
|
|
1104
|
+
const query = serializeListOptions(options ?? {});
|
|
1105
|
+
const res = await doFetch(`${base}/v1/catalogs/items`, {
|
|
1106
|
+
method: "GET",
|
|
1107
|
+
query
|
|
1108
|
+
});
|
|
1109
|
+
return res.json();
|
|
1110
|
+
};
|
|
1111
|
+
return {
|
|
1112
|
+
async list(options = {}) {
|
|
1113
|
+
const normalizedOptions = {
|
|
1114
|
+
...options ?? {}
|
|
1115
|
+
};
|
|
1116
|
+
const response = await fetchCatalogItemsPage(normalizedOptions);
|
|
1117
|
+
return attachPaginator(
|
|
1118
|
+
response,
|
|
1119
|
+
fetchCatalogItemsPage,
|
|
1120
|
+
normalizedOptions
|
|
1121
|
+
);
|
|
1122
|
+
},
|
|
1123
|
+
async get(itemId) {
|
|
1124
|
+
const res = await doFetch(`${base}/v1/catalogs/items/${itemId}`, {
|
|
1125
|
+
method: "GET"
|
|
1126
|
+
});
|
|
1127
|
+
return res.json();
|
|
1128
|
+
},
|
|
1129
|
+
async create(payload) {
|
|
1130
|
+
const res = await doFetch(`${base}/v1/catalogs/items`, {
|
|
1131
|
+
method: "POST",
|
|
1132
|
+
headers: jsonHeaders,
|
|
1133
|
+
body: JSON.stringify(payload)
|
|
1134
|
+
});
|
|
1135
|
+
return res.json();
|
|
1136
|
+
},
|
|
1137
|
+
async remove(itemId) {
|
|
1138
|
+
await doFetch(`${base}/v1/catalogs/items/${itemId}`, {
|
|
1139
|
+
method: "DELETE"
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
|
|
995
1145
|
// src/api/tools.ts
|
|
996
1146
|
var isFormData = (value) => {
|
|
997
1147
|
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
@@ -1207,15 +1357,18 @@ function createClient(initialCfg) {
|
|
|
1207
1357
|
const tagsApi = createAgentTagsApi(runtimeCfg);
|
|
1208
1358
|
const phonesApi = createAgentPhonesApi(runtimeCfg);
|
|
1209
1359
|
const scheduleApi = createAgentScheduleApi(runtimeCfg);
|
|
1360
|
+
const scheduleExceptionsApi = createAgentScheduleExceptionsApi(runtimeCfg);
|
|
1210
1361
|
const versionsApi = createAgentVersionsApi(runtimeCfg);
|
|
1211
1362
|
const blueprintsApi = createAgentBlueprintsApi(runtimeCfg);
|
|
1212
1363
|
const voicesApi = createVoicesApi(runtimeCfg);
|
|
1213
1364
|
const apiKeysApi = createApiKeysApi(runtimeCfg);
|
|
1365
|
+
const catalogsApi = createCatalogsApi(runtimeCfg);
|
|
1214
1366
|
const agentsApi = createAgentsApi(runtimeCfg, {
|
|
1215
1367
|
instructionsApi,
|
|
1216
1368
|
tagsApi,
|
|
1217
1369
|
phonesApi,
|
|
1218
1370
|
scheduleApi,
|
|
1371
|
+
scheduleExceptionsApi,
|
|
1219
1372
|
versionsApi,
|
|
1220
1373
|
blueprintsApi
|
|
1221
1374
|
});
|
|
@@ -1231,9 +1384,16 @@ function createClient(initialCfg) {
|
|
|
1231
1384
|
(agentId) => bindAgentPhones(phonesApi, agentId),
|
|
1232
1385
|
phonesApi
|
|
1233
1386
|
);
|
|
1387
|
+
const scheduleExceptionsNamespace = Object.assign(
|
|
1388
|
+
(agentId) => bindAgentScheduleExceptions(scheduleExceptionsApi, agentId),
|
|
1389
|
+
scheduleExceptionsApi
|
|
1390
|
+
);
|
|
1234
1391
|
const scheduleNamespace = Object.assign(
|
|
1235
|
-
(agentId) => bindAgentSchedule(scheduleApi, agentId),
|
|
1236
|
-
|
|
1392
|
+
(agentId) => bindAgentSchedule(scheduleApi, scheduleExceptionsApi, agentId),
|
|
1393
|
+
{
|
|
1394
|
+
...scheduleApi,
|
|
1395
|
+
exceptions: scheduleExceptionsNamespace
|
|
1396
|
+
}
|
|
1237
1397
|
);
|
|
1238
1398
|
const versionsNamespace = Object.assign(
|
|
1239
1399
|
(agentId) => bindAgentVersions(versionsApi, agentId),
|
|
@@ -1255,6 +1415,7 @@ function createClient(initialCfg) {
|
|
|
1255
1415
|
},
|
|
1256
1416
|
workspaces: createWorkspacesApi(runtimeCfg),
|
|
1257
1417
|
tools: createToolsApi(runtimeCfg),
|
|
1418
|
+
catalogs: catalogsApi,
|
|
1258
1419
|
voices: voicesApi,
|
|
1259
1420
|
apiKeys: apiKeysApi
|
|
1260
1421
|
};
|
|
@@ -1322,6 +1483,7 @@ function createClient(initialCfg) {
|
|
|
1322
1483
|
bindAgentInstructions,
|
|
1323
1484
|
bindAgentPhones,
|
|
1324
1485
|
bindAgentSchedule,
|
|
1486
|
+
bindAgentScheduleExceptions,
|
|
1325
1487
|
bindAgentTags,
|
|
1326
1488
|
bindAgentVersions,
|
|
1327
1489
|
createAgentBlueprintsApi,
|
|
@@ -1329,10 +1491,12 @@ function createClient(initialCfg) {
|
|
|
1329
1491
|
createAgentInstructionsApi,
|
|
1330
1492
|
createAgentPhonesApi,
|
|
1331
1493
|
createAgentScheduleApi,
|
|
1494
|
+
createAgentScheduleExceptionsApi,
|
|
1332
1495
|
createAgentTagsApi,
|
|
1333
1496
|
createAgentVersionsApi,
|
|
1334
1497
|
createAgentsApi,
|
|
1335
1498
|
createApiKeysApi,
|
|
1499
|
+
createCatalogsApi,
|
|
1336
1500
|
createClient,
|
|
1337
1501
|
createHttp,
|
|
1338
1502
|
createToolsApi,
|