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

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,12 +43,15 @@ __export(index_exports, {
43
43
  createAgentVersionsApi: () => createAgentVersionsApi,
44
44
  createAgentsApi: () => createAgentsApi,
45
45
  createApiKeysApi: () => createApiKeysApi,
46
+ createBillingApi: () => createBillingApi,
47
+ createCallsApi: () => createCallsApi,
46
48
  createCampaignsApi: () => createCampaignsApi,
47
49
  createCatalogTemplatesApi: () => createCatalogTemplatesApi,
48
50
  createCatalogsApi: () => createCatalogsApi,
49
51
  createClient: () => createClient,
50
52
  createHttp: () => createHttp,
51
53
  createToolsApi: () => createToolsApi,
54
+ createUsageApi: () => createUsageApi,
52
55
  createVoicesApi: () => createVoicesApi,
53
56
  createWebhooksApi: () => createWebhooksApi,
54
57
  createWorkspacesApi: () => createWorkspacesApi,
@@ -259,6 +262,11 @@ function createHttp(cfg) {
259
262
  }
260
263
 
261
264
  // src/utils/query.ts
265
+ function buildSearchParams(entries) {
266
+ const searchParams = new URLSearchParams();
267
+ entries.forEach(([key, value]) => appendParam(searchParams, key, value));
268
+ return searchParams;
269
+ }
262
270
  function serializeListOptions(options = {}, extra = {}) {
263
271
  const params = new URLSearchParams();
264
272
  appendParam(params, "page", options.page);
@@ -1130,7 +1138,8 @@ var createAgentEntity = (dto, options) => {
1130
1138
  stageTriggersApi,
1131
1139
  reload,
1132
1140
  updateAgent,
1133
- deleteAgent
1141
+ deleteAgent,
1142
+ cloneAgent
1134
1143
  } = options;
1135
1144
  const schedulesHelper = bindAgentSchedules(
1136
1145
  scheduleApi,
@@ -1149,6 +1158,9 @@ var createAgentEntity = (dto, options) => {
1149
1158
  async save(patch) {
1150
1159
  return updateAgent(dto.agentId, patch);
1151
1160
  },
1161
+ async clone(payload) {
1162
+ return cloneAgent(dto.agentId, payload);
1163
+ },
1152
1164
  async delete() {
1153
1165
  await deleteAgent(dto.agentId);
1154
1166
  },
@@ -1174,6 +1186,22 @@ function createAgentsApi(cfg, relatedApis) {
1174
1186
  throw new WorkspaceNotSelectedError();
1175
1187
  };
1176
1188
  const jsonHeaders = { "content-type": "application/json" };
1189
+ const normalizeCloneSelection = (selection) => {
1190
+ if (!selection) {
1191
+ return [];
1192
+ }
1193
+ if (Array.isArray(selection)) {
1194
+ return selection;
1195
+ }
1196
+ return Object.entries(selection).filter(([, enabled]) => enabled).map(([component]) => component);
1197
+ };
1198
+ const buildCloneAgentRequest = (payload) => {
1199
+ const { clone, ...rest } = payload;
1200
+ return {
1201
+ ...rest,
1202
+ clone: normalizeCloneSelection(clone)
1203
+ };
1204
+ };
1177
1205
  const fetchAgentsPage = async (options = {}) => {
1178
1206
  requireWorkspace();
1179
1207
  const sanitizedOptions = {
@@ -1218,6 +1246,16 @@ function createAgentsApi(cfg, relatedApis) {
1218
1246
  });
1219
1247
  return res.json();
1220
1248
  };
1249
+ const cloneAgent = async (agentId, payload) => {
1250
+ requireWorkspace();
1251
+ const requestPayload = buildCloneAgentRequest(payload);
1252
+ const res = await doFetch(`${base}/agents/${agentId}/clone`, {
1253
+ method: "POST",
1254
+ body: JSON.stringify(requestPayload),
1255
+ headers: jsonHeaders
1256
+ });
1257
+ return res.json();
1258
+ };
1221
1259
  const updateAgent = async (agentId, payload) => {
1222
1260
  requireWorkspace();
1223
1261
  const res = await doFetch(`${base}/agents/${agentId}`, {
@@ -1241,6 +1279,7 @@ function createAgentsApi(cfg, relatedApis) {
1241
1279
  list: listAgents,
1242
1280
  get: getAgentDetail,
1243
1281
  create: createAgent,
1282
+ clone: cloneAgent,
1244
1283
  forkFromTemplate: forkAgentFromTemplate,
1245
1284
  update: updateAgent,
1246
1285
  delete: deleteAgent
@@ -1267,6 +1306,10 @@ function createAgentsApi(cfg, relatedApis) {
1267
1306
  },
1268
1307
  deleteAgent: async (agentId) => {
1269
1308
  await deleteAgent(agentId);
1309
+ },
1310
+ cloneAgent: async (agentId, payload) => {
1311
+ const cloned = await cloneAgent(agentId, payload);
1312
+ return wrapAgent(cloned);
1270
1313
  }
1271
1314
  });
1272
1315
  return {
@@ -1292,6 +1335,10 @@ function createAgentsApi(cfg, relatedApis) {
1292
1335
  const detail = await createAgent(payload);
1293
1336
  return wrapAgent(detail);
1294
1337
  },
1338
+ async clone(agentId, payload) {
1339
+ const detail = await cloneAgent(agentId, payload);
1340
+ return wrapAgent(detail);
1341
+ },
1295
1342
  async forkFromTemplate(payload) {
1296
1343
  const detail = await forkAgentFromTemplate(payload);
1297
1344
  return wrapAgent(detail);
@@ -1334,6 +1381,82 @@ function createApiKeysApi(cfg) {
1334
1381
  };
1335
1382
  }
1336
1383
 
1384
+ // src/api/billing.ts
1385
+ function createBillingApi(cfg) {
1386
+ const { base, doFetch } = createHttp(cfg);
1387
+ return {
1388
+ async getBalance() {
1389
+ const res = await doFetch(`${base}/billing/balance`, {
1390
+ method: "GET"
1391
+ });
1392
+ return res.json();
1393
+ }
1394
+ };
1395
+ }
1396
+
1397
+ // src/api/calls.ts
1398
+ function createCallsApi(cfg) {
1399
+ const { base, doFetch } = createHttp(cfg);
1400
+ const fetchCallsPage = async (options = {}) => {
1401
+ const {
1402
+ agentBatchId,
1403
+ agentId,
1404
+ executionId,
1405
+ recordedAfter,
1406
+ recordedBefore,
1407
+ durationBucket,
1408
+ goalStatus,
1409
+ query: searchQuery,
1410
+ ...listOptions
1411
+ } = options ?? {};
1412
+ const query = serializeListOptions(listOptions, {
1413
+ agentBatchId,
1414
+ agentId,
1415
+ executionId,
1416
+ recordedAfter,
1417
+ recordedBefore,
1418
+ durationBucket,
1419
+ goalStatus,
1420
+ query: searchQuery
1421
+ });
1422
+ const res = await doFetch(`${base}/calls`, {
1423
+ method: "GET",
1424
+ query
1425
+ });
1426
+ return res.json();
1427
+ };
1428
+ return {
1429
+ async list(options = {}) {
1430
+ const normalizedOptions = { ...options ?? {} };
1431
+ const response = await fetchCallsPage(normalizedOptions);
1432
+ return attachPaginator(response, fetchCallsPage, normalizedOptions);
1433
+ },
1434
+ async stream(options) {
1435
+ const query = buildSearchParams([
1436
+ ["after", options.after],
1437
+ ["limit", options.limit],
1438
+ ["agentBatchId", options.agentBatchId],
1439
+ ["agentId", options.agentId],
1440
+ ["executionId", options.executionId],
1441
+ ["durationBucket", options.durationBucket],
1442
+ ["goalStatus", options.goalStatus],
1443
+ ["query", options.query]
1444
+ ]);
1445
+ const res = await doFetch(`${base}/calls/stream`, {
1446
+ method: "GET",
1447
+ query
1448
+ });
1449
+ return res.json();
1450
+ },
1451
+ async get(callId) {
1452
+ const res = await doFetch(`${base}/calls/${callId}`, {
1453
+ method: "GET"
1454
+ });
1455
+ return res.json();
1456
+ }
1457
+ };
1458
+ }
1459
+
1337
1460
  // src/api/campaigns.ts
1338
1461
  function createCampaignsApi(cfg) {
1339
1462
  const { base, doFetch } = createHttp(cfg);
@@ -1675,6 +1798,33 @@ function createToolsApi(cfg) {
1675
1798
  };
1676
1799
  }
1677
1800
 
1801
+ // src/api/usage.ts
1802
+ function createUsageApi(cfg) {
1803
+ const { base, doFetch } = createHttp(cfg);
1804
+ const fetchUsageAgentsPage = async (options = {}) => {
1805
+ const { resource, from, to, ...listOptions } = options ?? {};
1806
+ const query = serializeListOptions(listOptions, {
1807
+ resource,
1808
+ from,
1809
+ to
1810
+ });
1811
+ const res = await doFetch(`${base}/usage/agents`, {
1812
+ method: "GET",
1813
+ query
1814
+ });
1815
+ return res.json();
1816
+ };
1817
+ return {
1818
+ async agents(options = {}) {
1819
+ const normalizedOptions = {
1820
+ ...options ?? {}
1821
+ };
1822
+ const response = await fetchUsageAgentsPage(normalizedOptions);
1823
+ return attachPaginator(response, fetchUsageAgentsPage, normalizedOptions);
1824
+ }
1825
+ };
1826
+ }
1827
+
1678
1828
  // src/utils/catalog-voices.ts
1679
1829
  var FALLBACK_LOCALE = "und";
1680
1830
  var FALLBACK_PROVIDER = "catalog";
@@ -1971,6 +2121,35 @@ function createWebhooksApi(cfg) {
1971
2121
  `${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
1972
2122
  { method: "DELETE" }
1973
2123
  );
2124
+ },
2125
+ // Deliveries
2126
+ async listDeliveries(webhookId, options = {}) {
2127
+ const fetchPage = async (opts) => {
2128
+ const query = serializeListOptions({
2129
+ page: opts.page,
2130
+ limit: opts.limit,
2131
+ sort: opts.sort,
2132
+ fields: opts.fields,
2133
+ include: opts.include,
2134
+ search: opts.search,
2135
+ filter: opts.filter
2136
+ });
2137
+ const res = await doFetch(`${base}/webhooks/${webhookId}/deliveries`, {
2138
+ method: "GET",
2139
+ query
2140
+ });
2141
+ return res.json();
2142
+ };
2143
+ const normalized = { ...options ?? {} };
2144
+ const response = await fetchPage(normalized);
2145
+ return attachPaginator(response, fetchPage, normalized);
2146
+ },
2147
+ async getDelivery(webhookId, deliveryId) {
2148
+ const res = await doFetch(
2149
+ `${base}/webhooks/${webhookId}/deliveries/${deliveryId}`,
2150
+ { method: "GET" }
2151
+ );
2152
+ return res.json();
1974
2153
  }
1975
2154
  };
1976
2155
  }
@@ -2034,8 +2213,8 @@ function createWorkspacesApi(cfg) {
2034
2213
  const fetchPage = (options) => fetchPhonesPage(workspaceId, options);
2035
2214
  return attachPaginator(response, fetchPage, normalizedOptions);
2036
2215
  },
2037
- async enable(workspaceId, payload) {
2038
- const res = await doFetch(`${base}/workspaces/${workspaceId}/enable`, {
2216
+ async enable(payload) {
2217
+ const res = await doFetch(`${base}/workspaces/enable`, {
2039
2218
  method: "POST",
2040
2219
  headers: jsonHeaders,
2041
2220
  body: JSON.stringify(payload)
@@ -2081,6 +2260,7 @@ function createClient(initialCfg) {
2081
2260
  const stagesApi = createAgentStagesApi(runtimeCfg);
2082
2261
  const voicesApi = createVoicesApi(runtimeCfg);
2083
2262
  const apiKeysApi = createApiKeysApi(runtimeCfg);
2263
+ const callsApi = createCallsApi(runtimeCfg);
2084
2264
  const catalogsApi = createCatalogsApi(runtimeCfg);
2085
2265
  const catalogTemplatesApi = createCatalogTemplatesApi(runtimeCfg);
2086
2266
  const webhooksApi = createWebhooksApi(runtimeCfg);
@@ -2152,6 +2332,9 @@ function createClient(initialCfg) {
2152
2332
  campaigns: createCampaignsApi(runtimeCfg),
2153
2333
  voices: voicesApi,
2154
2334
  apiKeys: apiKeysApi,
2335
+ billing: createBillingApi(runtimeCfg),
2336
+ calls: callsApi,
2337
+ usage: createUsageApi(runtimeCfg),
2155
2338
  webhooks: webhooksApi
2156
2339
  };
2157
2340
  return {
@@ -2235,12 +2418,15 @@ function createClient(initialCfg) {
2235
2418
  createAgentVersionsApi,
2236
2419
  createAgentsApi,
2237
2420
  createApiKeysApi,
2421
+ createBillingApi,
2422
+ createCallsApi,
2238
2423
  createCampaignsApi,
2239
2424
  createCatalogTemplatesApi,
2240
2425
  createCatalogsApi,
2241
2426
  createClient,
2242
2427
  createHttp,
2243
2428
  createToolsApi,
2429
+ createUsageApi,
2244
2430
  createVoicesApi,
2245
2431
  createWebhooksApi,
2246
2432
  createWorkspacesApi,