@getsupervisor/agents-studio-sdk 1.15.0 → 1.17.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 +18 -0
- package/README.md +161 -0
- package/dist/index.cjs +50 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
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
|
+
|
|
1
19
|
## v1.14.0
|
|
2
20
|
|
|
3
21
|
## [1.14.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.13.0...v1.14.0) (2025-10-21)
|
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
|
@@ -39,6 +39,7 @@ __export(index_exports, {
|
|
|
39
39
|
createAgentVersionsApi: () => createAgentVersionsApi,
|
|
40
40
|
createAgentsApi: () => createAgentsApi,
|
|
41
41
|
createApiKeysApi: () => createApiKeysApi,
|
|
42
|
+
createCatalogsApi: () => createCatalogsApi,
|
|
42
43
|
createClient: () => createClient,
|
|
43
44
|
createHttp: () => createHttp,
|
|
44
45
|
createToolsApi: () => createToolsApi,
|
|
@@ -1095,6 +1096,52 @@ function createApiKeysApi(cfg) {
|
|
|
1095
1096
|
};
|
|
1096
1097
|
}
|
|
1097
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
|
+
|
|
1098
1145
|
// src/api/tools.ts
|
|
1099
1146
|
var isFormData = (value) => {
|
|
1100
1147
|
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
@@ -1315,6 +1362,7 @@ function createClient(initialCfg) {
|
|
|
1315
1362
|
const blueprintsApi = createAgentBlueprintsApi(runtimeCfg);
|
|
1316
1363
|
const voicesApi = createVoicesApi(runtimeCfg);
|
|
1317
1364
|
const apiKeysApi = createApiKeysApi(runtimeCfg);
|
|
1365
|
+
const catalogsApi = createCatalogsApi(runtimeCfg);
|
|
1318
1366
|
const agentsApi = createAgentsApi(runtimeCfg, {
|
|
1319
1367
|
instructionsApi,
|
|
1320
1368
|
tagsApi,
|
|
@@ -1367,6 +1415,7 @@ function createClient(initialCfg) {
|
|
|
1367
1415
|
},
|
|
1368
1416
|
workspaces: createWorkspacesApi(runtimeCfg),
|
|
1369
1417
|
tools: createToolsApi(runtimeCfg),
|
|
1418
|
+
catalogs: catalogsApi,
|
|
1370
1419
|
voices: voicesApi,
|
|
1371
1420
|
apiKeys: apiKeysApi
|
|
1372
1421
|
};
|
|
@@ -1447,6 +1496,7 @@ function createClient(initialCfg) {
|
|
|
1447
1496
|
createAgentVersionsApi,
|
|
1448
1497
|
createAgentsApi,
|
|
1449
1498
|
createApiKeysApi,
|
|
1499
|
+
createCatalogsApi,
|
|
1450
1500
|
createClient,
|
|
1451
1501
|
createHttp,
|
|
1452
1502
|
createToolsApi,
|