@getsupervisor/agents-studio-sdk 1.41.2-patch.1 → 1.41.2-patch.10

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 CHANGED
@@ -93,7 +93,7 @@
93
93
 
94
94
  ### Features
95
95
 
96
- - add default language constant and update RetellBlueprintMapper to use it ([85d2d8c](https://github.com/julio-supervisor/agents-studio-be/commit/85d2d8ccc908254d351855158ecc09f14dbf6c6f))
96
+ - add default language constant and update blueprint mapper to use it ([85d2d8c](https://github.com/julio-supervisor/agents-studio-be/commit/85d2d8ccc908254d351855158ecc09f14dbf6c6f))
97
97
  - implement delete instruction functionality with command handler and controller ([af983f5](https://github.com/julio-supervisor/agents-studio-be/commit/af983f5254055d35d3972d0bcbdb12a52b48c785))
98
98
 
99
99
  ## v1.34.0
@@ -102,8 +102,8 @@
102
102
 
103
103
  ### Features
104
104
 
105
- - enhance instruction management by adding active and non-deleted filtering, and integrate instructions into the Retell blueprint mapping ([baadb5f](https://github.com/julio-supervisor/agents-studio-be/commit/baadb5f561749d441c4757435fb920bb48556d7d))
106
- - implement VoiceBlueprintSyncService for Retell synchronization ([6b8f03f](https://github.com/julio-supervisor/agents-studio-be/commit/6b8f03f77ca1d2b91a9628db055e2799aa039f53))
105
+ - enhance instruction management by adding active and non-deleted filtering, and integrate instructions into the agent blueprint mapping ([baadb5f](https://github.com/julio-supervisor/agents-studio-be/commit/baadb5f561749d441c4757435fb920bb48556d7d))
106
+ - implement VoiceBlueprintSyncService for blueprint synchronization ([6b8f03f](https://github.com/julio-supervisor/agents-studio-be/commit/6b8f03f77ca1d2b91a9628db055e2799aa039f53))
107
107
  - introduce buildClientMock helper for consistent workspaceId handling in tests ([ae6eb30](https://github.com/julio-supervisor/agents-studio-be/commit/ae6eb305b16f677dea03a21bdfc8559c13cc641a))
108
108
 
109
109
  ## v1.33.0
@@ -277,7 +277,7 @@
277
277
 
278
278
  ### Features
279
279
 
280
- - Agrega `RetellToolGuidelinesService` y lineamientos de uso para voice calls dentro del SDK, permitiendo mostrar requisitos y recomendaciones antes de ejecutar herramientas de voz ([db0e013](https://github.com/julio-supervisor/agents-studio-be/commit/db0e013d8f09d2a0a794efccb7700729ad752fd4)).
280
+ - Agrega `ToolGuidelinesService` y lineamientos de uso para voice calls dentro del SDK, permitiendo mostrar requisitos y recomendaciones antes de ejecutar herramientas de voz ([db0e013](https://github.com/julio-supervisor/agents-studio-be/commit/db0e013d8f09d2a0a794efccb7700729ad752fd4)).
281
281
 
282
282
  ## [1.19.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.18.0...v1.19.0) (2025-10-29)
283
283
 
package/README.md CHANGED
@@ -524,26 +524,36 @@ const { key, ...metadata } = await http
524
524
 
525
525
  ### Scopes disponibles (octubre 2025)
526
526
 
527
- | Scope | Permiso principal |
528
- | -------------------------- | ---------------------------------------------------------------------------------------- |
529
- | `agents:read` | Consultar agentes, versiones, instrucciones, teléfonos y blueprints asociados. |
530
- | `agents:write` | Crear, actualizar o eliminar agentes, versiones, teléfonos y su configuración operativa. |
531
- | `agent-instructions:read` | Leer instrucciones tanto a nivel agente como por versión publicada. |
532
- | `agent-instructions:write` | Crear, actualizar o borrar instrucciones personalizadas. |
533
- | `agent-blueprints:read` | Consultar blueprint y resúmenes sincronizados con proveedores externos. |
534
- | `agent-blueprints:write` | Editar blueprint, personalidad y reglas de cada versión. |
535
- | `agent-schedules:read` | Consultar horario semanal y excepciones vigentes. |
536
- | `agent-schedules:write` | Crear o modificar horarios y excepciones. |
537
- | `catalogs:read` | Navegar catálogos globales y por workspace (idiomas, estilos, voces, etc.). |
538
- | `catalogs:write` | Registrar o ajustar ítems de catálogo. |
539
- | `tools:read` | Descubrir tools disponibles, recursos y capacidades declaradas. |
540
- | `tools:connections:write` | Crear conexiones entre agentes y tools (p. ej. `voice.calls`). |
541
- | `tools:execute` | Ejecutar acciones de una tool (`startCall`, `reload`, etc.). |
542
- | `webhooks:read` | Listar webhooks y sus suscripciones activas. |
543
- | `webhooks:write` | Crear, actualizar o eliminar webhooks y suscripciones. |
544
- | `api-keys:read` | Listar credenciales existentes y revelar su valor. |
545
- | `api-keys:write` | Emitir o revocar API Keys. |
546
- | `workspaces:read` | Consultar metadatos y estado de habilitación de un workspace. |
527
+ | Scope | Permiso principal |
528
+ | -------------------------- | ------------------------------------------------------------------------- |
529
+ | `agents:read` | Listar y consultar agentes del workspace. |
530
+ | `agents:write` | Crear/actualizar/eliminar agentes y gestionar su configuración operativa. |
531
+ | `agent-versions:read` | Listar y consultar versiones de un agente. |
532
+ | `agent-versions:write` | Crear, clonar, restaurar y publicar versiones de un agente. |
533
+ | `agent-instructions:read` | Leer instrucciones (a nivel agente y por versión). |
534
+ | `agent-instructions:write` | Crear, actualizar o borrar instrucciones personalizadas. |
535
+ | `agent-blueprints:read` | Consultar el blueprint (personalidad) de una versión de agente. |
536
+ | `agent-blueprints:write` | Editar blueprint: personalidad, reglas, audiencia, objetivos, etc. |
537
+ | `blueprint-stages:read` | Listar y consultar stages del blueprint. |
538
+ | `blueprint-stages:write` | Crear, actualizar o reordenar stages del blueprint. |
539
+ | `stage-triggers:read` | Consultar triggers que conectan stages y sus condiciones. |
540
+ | `stage-triggers:write` | Crear, actualizar o eliminar triggers entre stages. |
541
+ | `agent-schedules:read` | Consultar horario semanal y excepciones vigentes. |
542
+ | `agent-schedules:write` | Crear o modificar horarios y excepciones. |
543
+ | `campaigns:read` | Consultar campañas y sus ejecuciones. |
544
+ | `campaigns:write` | Crear y disparar campañas batch. |
545
+ | `calls:read` | Consultar llamadas (Speech Analytics) del workspace. |
546
+ | `catalogs:read` | Navegar catálogos globales y por workspace (idiomas, tonos, voces, etc.). |
547
+ | `catalogs:write` | Registrar o ajustar ítems de catálogo. |
548
+ | `tools:read` | Descubrir tools disponibles, recursos y capacidades declaradas. |
549
+ | `tools:connections:read` | Listar conexiones configuradas entre agentes y tools. |
550
+ | `tools:connections:write` | Crear o actualizar conexiones entre agentes y tools. |
551
+ | `tools:execute` | Ejecutar acciones de una tool. |
552
+ | `webhooks:read` | Listar webhooks y sus suscripciones activas. |
553
+ | `webhooks:write` | Crear, actualizar o eliminar webhooks y suscripciones. |
554
+ | `api-keys:read` | Listar credenciales existentes y revelar su valor. |
555
+ | `api-keys:write` | Emitir o revocar API Keys. |
556
+ | `workspaces:read` | Consultar workspaces disponibles y sus metadatos. |
547
557
 
548
558
  Consulta el OpenAPI (`docs/api-spec/openapi.yaml`) para validar scopes adicionales (por ejemplo, específicos de conocimientos o teléfonos) y su mapeo exacto por operación.
549
559
 
package/dist/index.cjs CHANGED
@@ -43,6 +43,7 @@ __export(index_exports, {
43
43
  createAgentVersionsApi: () => createAgentVersionsApi,
44
44
  createAgentsApi: () => createAgentsApi,
45
45
  createApiKeysApi: () => createApiKeysApi,
46
+ createCallsApi: () => createCallsApi,
46
47
  createCampaignsApi: () => createCampaignsApi,
47
48
  createCatalogTemplatesApi: () => createCatalogTemplatesApi,
48
49
  createCatalogsApi: () => createCatalogsApi,
@@ -259,6 +260,11 @@ function createHttp(cfg) {
259
260
  }
260
261
 
261
262
  // src/utils/query.ts
263
+ function buildSearchParams(entries) {
264
+ const searchParams = new URLSearchParams();
265
+ entries.forEach(([key, value]) => appendParam(searchParams, key, value));
266
+ return searchParams;
267
+ }
262
268
  function serializeListOptions(options = {}, extra = {}) {
263
269
  const params = new URLSearchParams();
264
270
  appendParam(params, "page", options.page);
@@ -1130,7 +1136,8 @@ var createAgentEntity = (dto, options) => {
1130
1136
  stageTriggersApi,
1131
1137
  reload,
1132
1138
  updateAgent,
1133
- deleteAgent
1139
+ deleteAgent,
1140
+ cloneAgent
1134
1141
  } = options;
1135
1142
  const schedulesHelper = bindAgentSchedules(
1136
1143
  scheduleApi,
@@ -1149,6 +1156,9 @@ var createAgentEntity = (dto, options) => {
1149
1156
  async save(patch) {
1150
1157
  return updateAgent(dto.agentId, patch);
1151
1158
  },
1159
+ async clone(payload) {
1160
+ return cloneAgent(dto.agentId, payload);
1161
+ },
1152
1162
  async delete() {
1153
1163
  await deleteAgent(dto.agentId);
1154
1164
  },
@@ -1174,6 +1184,22 @@ function createAgentsApi(cfg, relatedApis) {
1174
1184
  throw new WorkspaceNotSelectedError();
1175
1185
  };
1176
1186
  const jsonHeaders = { "content-type": "application/json" };
1187
+ const normalizeCloneSelection = (selection) => {
1188
+ if (!selection) {
1189
+ return [];
1190
+ }
1191
+ if (Array.isArray(selection)) {
1192
+ return selection;
1193
+ }
1194
+ return Object.entries(selection).filter(([, enabled]) => enabled).map(([component]) => component);
1195
+ };
1196
+ const buildCloneAgentRequest = (payload) => {
1197
+ const { clone, ...rest } = payload;
1198
+ return {
1199
+ ...rest,
1200
+ clone: normalizeCloneSelection(clone)
1201
+ };
1202
+ };
1177
1203
  const fetchAgentsPage = async (options = {}) => {
1178
1204
  requireWorkspace();
1179
1205
  const sanitizedOptions = {
@@ -1218,6 +1244,16 @@ function createAgentsApi(cfg, relatedApis) {
1218
1244
  });
1219
1245
  return res.json();
1220
1246
  };
1247
+ const cloneAgent = async (agentId, payload) => {
1248
+ requireWorkspace();
1249
+ const requestPayload = buildCloneAgentRequest(payload);
1250
+ const res = await doFetch(`${base}/agents/${agentId}/clone`, {
1251
+ method: "POST",
1252
+ body: JSON.stringify(requestPayload),
1253
+ headers: jsonHeaders
1254
+ });
1255
+ return res.json();
1256
+ };
1221
1257
  const updateAgent = async (agentId, payload) => {
1222
1258
  requireWorkspace();
1223
1259
  const res = await doFetch(`${base}/agents/${agentId}`, {
@@ -1241,6 +1277,7 @@ function createAgentsApi(cfg, relatedApis) {
1241
1277
  list: listAgents,
1242
1278
  get: getAgentDetail,
1243
1279
  create: createAgent,
1280
+ clone: cloneAgent,
1244
1281
  forkFromTemplate: forkAgentFromTemplate,
1245
1282
  update: updateAgent,
1246
1283
  delete: deleteAgent
@@ -1267,6 +1304,10 @@ function createAgentsApi(cfg, relatedApis) {
1267
1304
  },
1268
1305
  deleteAgent: async (agentId) => {
1269
1306
  await deleteAgent(agentId);
1307
+ },
1308
+ cloneAgent: async (agentId, payload) => {
1309
+ const cloned = await cloneAgent(agentId, payload);
1310
+ return wrapAgent(cloned);
1270
1311
  }
1271
1312
  });
1272
1313
  return {
@@ -1292,6 +1333,10 @@ function createAgentsApi(cfg, relatedApis) {
1292
1333
  const detail = await createAgent(payload);
1293
1334
  return wrapAgent(detail);
1294
1335
  },
1336
+ async clone(agentId, payload) {
1337
+ const detail = await cloneAgent(agentId, payload);
1338
+ return wrapAgent(detail);
1339
+ },
1295
1340
  async forkFromTemplate(payload) {
1296
1341
  const detail = await forkAgentFromTemplate(payload);
1297
1342
  return wrapAgent(detail);
@@ -1334,6 +1379,69 @@ function createApiKeysApi(cfg) {
1334
1379
  };
1335
1380
  }
1336
1381
 
1382
+ // src/api/calls.ts
1383
+ function createCallsApi(cfg) {
1384
+ const { base, doFetch } = createHttp(cfg);
1385
+ const fetchCallsPage = async (options = {}) => {
1386
+ const {
1387
+ agentBatchId,
1388
+ agentId,
1389
+ executionId,
1390
+ recordedAfter,
1391
+ recordedBefore,
1392
+ durationBucket,
1393
+ goalStatus,
1394
+ query: searchQuery,
1395
+ ...listOptions
1396
+ } = options ?? {};
1397
+ const query = serializeListOptions(listOptions, {
1398
+ agentBatchId,
1399
+ agentId,
1400
+ executionId,
1401
+ recordedAfter,
1402
+ recordedBefore,
1403
+ durationBucket,
1404
+ goalStatus,
1405
+ query: searchQuery
1406
+ });
1407
+ const res = await doFetch(`${base}/calls`, {
1408
+ method: "GET",
1409
+ query
1410
+ });
1411
+ return res.json();
1412
+ };
1413
+ return {
1414
+ async list(options = {}) {
1415
+ const normalizedOptions = { ...options ?? {} };
1416
+ const response = await fetchCallsPage(normalizedOptions);
1417
+ return attachPaginator(response, fetchCallsPage, normalizedOptions);
1418
+ },
1419
+ async stream(options) {
1420
+ const query = buildSearchParams([
1421
+ ["after", options.after],
1422
+ ["limit", options.limit],
1423
+ ["agentBatchId", options.agentBatchId],
1424
+ ["agentId", options.agentId],
1425
+ ["executionId", options.executionId],
1426
+ ["durationBucket", options.durationBucket],
1427
+ ["goalStatus", options.goalStatus],
1428
+ ["query", options.query]
1429
+ ]);
1430
+ const res = await doFetch(`${base}/calls/stream`, {
1431
+ method: "GET",
1432
+ query
1433
+ });
1434
+ return res.json();
1435
+ },
1436
+ async get(callId) {
1437
+ const res = await doFetch(`${base}/calls/${callId}`, {
1438
+ method: "GET"
1439
+ });
1440
+ return res.json();
1441
+ }
1442
+ };
1443
+ }
1444
+
1337
1445
  // src/api/campaigns.ts
1338
1446
  function createCampaignsApi(cfg) {
1339
1447
  const { base, doFetch } = createHttp(cfg);
@@ -1971,6 +2079,35 @@ function createWebhooksApi(cfg) {
1971
2079
  `${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
1972
2080
  { method: "DELETE" }
1973
2081
  );
2082
+ },
2083
+ // Deliveries
2084
+ async listDeliveries(webhookId, options = {}) {
2085
+ const fetchPage = async (opts) => {
2086
+ const query = serializeListOptions({
2087
+ page: opts.page,
2088
+ limit: opts.limit,
2089
+ sort: opts.sort,
2090
+ fields: opts.fields,
2091
+ include: opts.include,
2092
+ search: opts.search,
2093
+ filter: opts.filter
2094
+ });
2095
+ const res = await doFetch(`${base}/webhooks/${webhookId}/deliveries`, {
2096
+ method: "GET",
2097
+ query
2098
+ });
2099
+ return res.json();
2100
+ };
2101
+ const normalized = { ...options ?? {} };
2102
+ const response = await fetchPage(normalized);
2103
+ return attachPaginator(response, fetchPage, normalized);
2104
+ },
2105
+ async getDelivery(webhookId, deliveryId) {
2106
+ const res = await doFetch(
2107
+ `${base}/webhooks/${webhookId}/deliveries/${deliveryId}`,
2108
+ { method: "GET" }
2109
+ );
2110
+ return res.json();
1974
2111
  }
1975
2112
  };
1976
2113
  }
@@ -2034,8 +2171,8 @@ function createWorkspacesApi(cfg) {
2034
2171
  const fetchPage = (options) => fetchPhonesPage(workspaceId, options);
2035
2172
  return attachPaginator(response, fetchPage, normalizedOptions);
2036
2173
  },
2037
- async enable(workspaceId, payload) {
2038
- const res = await doFetch(`${base}/workspaces/${workspaceId}/enable`, {
2174
+ async enable(payload) {
2175
+ const res = await doFetch(`${base}/workspaces/enable`, {
2039
2176
  method: "POST",
2040
2177
  headers: jsonHeaders,
2041
2178
  body: JSON.stringify(payload)
@@ -2081,6 +2218,7 @@ function createClient(initialCfg) {
2081
2218
  const stagesApi = createAgentStagesApi(runtimeCfg);
2082
2219
  const voicesApi = createVoicesApi(runtimeCfg);
2083
2220
  const apiKeysApi = createApiKeysApi(runtimeCfg);
2221
+ const callsApi = createCallsApi(runtimeCfg);
2084
2222
  const catalogsApi = createCatalogsApi(runtimeCfg);
2085
2223
  const catalogTemplatesApi = createCatalogTemplatesApi(runtimeCfg);
2086
2224
  const webhooksApi = createWebhooksApi(runtimeCfg);
@@ -2152,6 +2290,7 @@ function createClient(initialCfg) {
2152
2290
  campaigns: createCampaignsApi(runtimeCfg),
2153
2291
  voices: voicesApi,
2154
2292
  apiKeys: apiKeysApi,
2293
+ calls: callsApi,
2155
2294
  webhooks: webhooksApi
2156
2295
  };
2157
2296
  return {
@@ -2235,6 +2374,7 @@ function createClient(initialCfg) {
2235
2374
  createAgentVersionsApi,
2236
2375
  createAgentsApi,
2237
2376
  createApiKeysApi,
2377
+ createCallsApi,
2238
2378
  createCampaignsApi,
2239
2379
  createCatalogTemplatesApi,
2240
2380
  createCatalogsApi,