@getsupervisor/agents-studio-sdk 1.24.0 → 1.26.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 +37 -0
- package/README.md +87 -37
- package/dist/index.cjs +118 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -57
- package/dist/index.d.ts +55 -57
- package/dist/index.js +118 -75
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## v1.25.0
|
|
2
|
+
|
|
3
|
+
## [1.25.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.24.0...v1.25.0) (2025-11-06)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* enhance blueprint stage functionality with goalPrompt and promptInstructions attributes ([9d13681](https://github.com/julio-supervisor/agents-studio-be/commit/9d13681346f9ea48f5dd6b9c16ab90c95a81356d))
|
|
8
|
+
* implement blueprint stages and triggers ([b94e0d9](https://github.com/julio-supervisor/agents-studio-be/commit/b94e0d9723bf6406a9163d3d9dc998ada06be10a))
|
|
9
|
+
* refactor agent creation and blueprint building for improved test clarity and functionality ([136d5b1](https://github.com/julio-supervisor/agents-studio-be/commit/136d5b12a725d65e6d2fd77e224cc6615e3707d1))
|
|
10
|
+
* update blueprint stage to use goalPrompt and promptInstructions ([0e7bf89](https://github.com/julio-supervisor/agents-studio-be/commit/0e7bf89ed94853ad856c155e0f71e1ba1dafea84))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## v1.24.0
|
|
14
|
+
|
|
15
|
+
## [1.24.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.23.0...v1.24.0) (2025-11-05)
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add optional avatarUrl and debounceDelayMs to agent schema ([b909f45](https://github.com/julio-supervisor/agents-studio-be/commit/b909f457ef82df455e77ae8ec772a4ff1de3b763))
|
|
20
|
+
*
|
|
21
|
+
## v1.23.0
|
|
22
|
+
|
|
23
|
+
## [1.23.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.22.2...v1.23.0) (2025-11-05)
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* implement Agent Stages and Triggers API ([c0b997f](https://github.com/julio-supervisor/agents-studio-be/commit/c0b997fd233f8cb1fb4fc2f43b36344e46675191))
|
|
28
|
+
|
|
29
|
+
## v1.22.2
|
|
30
|
+
|
|
31
|
+
## [1.22.2](https://github.com/julio-supervisor/agents-studio-be/compare/v1.22.1...v1.22.2) (2025-11-03)
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* update API base URL to production endpoint across multiple files ([7491ce7](https://github.com/julio-supervisor/agents-studio-be/commit/7491ce700f348682d6559a5f3e9cf93f4aa9bc70))
|
|
36
|
+
|
|
37
|
+
|
|
1
38
|
## v1.22.1
|
|
2
39
|
|
|
3
40
|
## [1.22.1](https://github.com/julio-supervisor/agents-studio-be/compare/v1.22.0...v1.22.1) (2025-11-03)
|
package/README.md
CHANGED
|
@@ -34,22 +34,20 @@ await client.agents
|
|
|
34
34
|
|
|
35
35
|
// administrar blueprints por versión
|
|
36
36
|
const blueprints = client.agents.blueprints(agent.agentId);
|
|
37
|
-
await blueprints
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
topicsForbidden: ['facturación'],
|
|
52
|
-
});
|
|
37
|
+
await blueprints.version('version-1').create({
|
|
38
|
+
languageId: 'es-MX',
|
|
39
|
+
personalityName: 'Embajador de marca',
|
|
40
|
+
personalityRole: 'Consultor de adopción',
|
|
41
|
+
targetAudience: 'Usuarios nuevos',
|
|
42
|
+
mainGoal: 'Incrementar la activación',
|
|
43
|
+
personalityInitialGreeting: '¡Hola! Soy tu asistente de onboarding.',
|
|
44
|
+
personalityMessageStyleId: 'style-uuid',
|
|
45
|
+
personalityToneStyleId: 'tone-uuid',
|
|
46
|
+
requiredData: [{ key: 'industry', label: 'Industria' }],
|
|
47
|
+
criticalRules: ['Nunca compartas precios internos'],
|
|
48
|
+
topicsAllowed: ['onboarding', 'soporte'],
|
|
49
|
+
topicsForbidden: ['facturación'],
|
|
50
|
+
});
|
|
53
51
|
|
|
54
52
|
// los helpers del entity también exponen blueprints
|
|
55
53
|
const agentBlueprint = await agent.blueprints.version('version-1').get();
|
|
@@ -164,6 +162,55 @@ const v2 = await client.agentVersions.clone(agent.agentId, active.id);
|
|
|
164
162
|
|
|
165
163
|
Estados soportados: `draft`, `active`, `archived`.
|
|
166
164
|
|
|
165
|
+
## Stages del blueprint
|
|
166
|
+
|
|
167
|
+
Modela el flujo conversacional de cada agente con los helpers `client.agents.stages(agentId)`, indicando siempre qué blueprint deseas administrar.
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
const stages = client.agents.stages(agent.agentId);
|
|
171
|
+
const activeBlueprint = await client.agents.blueprints(agent.agentId).list();
|
|
172
|
+
const blueprintId = activeBlueprint.data[0].blueprint.id;
|
|
173
|
+
|
|
174
|
+
// Paginar stages existentes
|
|
175
|
+
const page = await stages.list(blueprintId, { limit: 10, search: 'greeting' });
|
|
176
|
+
console.log(page.meta.total);
|
|
177
|
+
|
|
178
|
+
// También puedes obtener un helper con el blueprint preseleccionado
|
|
179
|
+
const blueprintStages = stages(blueprintId);
|
|
180
|
+
|
|
181
|
+
// Crear un stage
|
|
182
|
+
const created = await blueprintStages.create({
|
|
183
|
+
name: 'proposal',
|
|
184
|
+
title: 'Propuesta y cierre',
|
|
185
|
+
goalPrompt:
|
|
186
|
+
'Explica la solución recomendada y ofrece una llamada con humano.',
|
|
187
|
+
order: 2,
|
|
188
|
+
metadata: { requiresSupervisor: false },
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Actualizar y reordenar
|
|
192
|
+
await blueprintStages.update(created.id, {
|
|
193
|
+
goalPrompt: 'Resume beneficios en < 3 bullets y ofrece agendar demo.',
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
await stages.reorder(blueprintId, {
|
|
197
|
+
stageIds: [page.data[0].id, created.id],
|
|
198
|
+
startingStageName: 'greeting',
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Triggers por stage
|
|
202
|
+
const triggers = stages.triggers(blueprintId, created.id);
|
|
203
|
+
await triggers.create({
|
|
204
|
+
condition: { type: 'intent', value: 'schedule_call' },
|
|
205
|
+
nextStageName: 'handoff',
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const listing = await triggers.list();
|
|
209
|
+
console.log(listing.data[0].condition);
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Los métodos de triggers permiten `list`, `get`, `create`, `update` y `delete`. Recuerda habilitar los scopes `blueprint-stages:*` y `stage-triggers:*` en la credencial utilizada.
|
|
213
|
+
|
|
167
214
|
## Horarios del agente (Agent Schedules)
|
|
168
215
|
|
|
169
216
|
Namespaces: `client.agentSchedule` y `client.agentScheduleExceptions`
|
|
@@ -309,7 +356,9 @@ client.workspace.get(); // 'ws-123'
|
|
|
309
356
|
client.workspace.set('ws-456');
|
|
310
357
|
|
|
311
358
|
// o delegar en un getter dinámico (por ejemplo, almacenamiento local)
|
|
312
|
-
client.workspace.useGetter(
|
|
359
|
+
client.workspace.useGetter(
|
|
360
|
+
() => sessionStorage.getItem('workspace') ?? undefined,
|
|
361
|
+
);
|
|
313
362
|
|
|
314
363
|
// crear un cliente aislado para otro workspace
|
|
315
364
|
const scoped = client.workspace.scoped('ws-789');
|
|
@@ -399,26 +448,26 @@ const { key, ...metadata } = await http
|
|
|
399
448
|
|
|
400
449
|
### Scopes disponibles (octubre 2025)
|
|
401
450
|
|
|
402
|
-
| Scope
|
|
403
|
-
|
|
404
|
-
| `agents:read`
|
|
405
|
-
| `agents:write`
|
|
406
|
-
| `agent-instructions:read`
|
|
407
|
-
| `agent-instructions:write` | Crear, actualizar o borrar instrucciones personalizadas.
|
|
408
|
-
| `agent-blueprints:read`
|
|
409
|
-
| `agent-blueprints:write`
|
|
410
|
-
| `agent-schedules:read`
|
|
411
|
-
| `agent-schedules:write`
|
|
412
|
-
| `catalogs:read`
|
|
413
|
-
| `catalogs:write`
|
|
414
|
-
| `tools:read`
|
|
415
|
-
| `tools:connections:write`
|
|
416
|
-
| `tools:execute`
|
|
417
|
-
| `webhooks:read`
|
|
418
|
-
| `webhooks:write`
|
|
419
|
-
| `api-keys:read`
|
|
420
|
-
| `api-keys:write`
|
|
421
|
-
| `workspaces:read`
|
|
451
|
+
| Scope | Permiso principal |
|
|
452
|
+
| -------------------------- | ---------------------------------------------------------------------------------------- |
|
|
453
|
+
| `agents:read` | Consultar agentes, versiones, instrucciones, teléfonos y blueprints asociados. |
|
|
454
|
+
| `agents:write` | Crear, actualizar o eliminar agentes, versiones, teléfonos y su configuración operativa. |
|
|
455
|
+
| `agent-instructions:read` | Leer instrucciones tanto a nivel agente como por versión publicada. |
|
|
456
|
+
| `agent-instructions:write` | Crear, actualizar o borrar instrucciones personalizadas. |
|
|
457
|
+
| `agent-blueprints:read` | Consultar blueprint y resúmenes sincronizados con proveedores externos. |
|
|
458
|
+
| `agent-blueprints:write` | Editar blueprint, personalidad y reglas de cada versión. |
|
|
459
|
+
| `agent-schedules:read` | Consultar horario semanal y excepciones vigentes. |
|
|
460
|
+
| `agent-schedules:write` | Crear o modificar horarios y excepciones. |
|
|
461
|
+
| `catalogs:read` | Navegar catálogos globales y por workspace (idiomas, estilos, voces, etc.). |
|
|
462
|
+
| `catalogs:write` | Registrar o ajustar ítems de catálogo. |
|
|
463
|
+
| `tools:read` | Descubrir tools disponibles, recursos y capacidades declaradas. |
|
|
464
|
+
| `tools:connections:write` | Crear conexiones entre agentes y tools (p. ej. `voice.calls`). |
|
|
465
|
+
| `tools:execute` | Ejecutar acciones de una tool (`startCall`, `reload`, etc.). |
|
|
466
|
+
| `webhooks:read` | Listar webhooks y sus suscripciones activas. |
|
|
467
|
+
| `webhooks:write` | Crear, actualizar o eliminar webhooks y suscripciones. |
|
|
468
|
+
| `api-keys:read` | Listar credenciales existentes y revelar su valor. |
|
|
469
|
+
| `api-keys:write` | Emitir o revocar API Keys. |
|
|
470
|
+
| `workspaces:read` | Consultar metadatos y estado de habilitación de un workspace. |
|
|
422
471
|
|
|
423
472
|
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.
|
|
424
473
|
|
|
@@ -427,6 +476,7 @@ Consulta el OpenAPI (`docs/api-spec/openapi.yaml`) para validar scopes adicional
|
|
|
427
476
|
- **Guías de uso para voice.calls**: las conexiones creadas con `client.tools.connect('voice.calls', ...)` ahora devuelven valores predeterminados en `descriptionUsage` y `usageExample` (ver `docs/mcp/tools_execution.md`).
|
|
428
477
|
- **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.
|
|
429
478
|
- **Scopes documentados**: tabla de scopes disponibles y recomendaciones para definir permisos mínimos por workspace.
|
|
479
|
+
- **Blueprint stages y triggers**: nuevos helpers `client.agents.stages(agentId)` y `stages.triggers(stageId)` para CRUD completo y reordenamiento del flujo conversacional.
|
|
430
480
|
- **Mejoras de gobernanza**: se incorporaron pautas de rotación, almacenamiento seguro y segmentación por entorno directamente en la guía del SDK.
|
|
431
481
|
- **Catálogos**: nuevo namespace `client.catalogs` con CRUD y paginación para `language`, `message_style`, `tone_style`, `tag` y `voice`.
|
|
432
482
|
- **Versiones de agente**: namespace `client.agentVersions` con operaciones para crear, clonar, publicar y gestionar instrucciones por versión.
|
package/dist/index.cjs
CHANGED
|
@@ -661,7 +661,7 @@ function createAgentScheduleApi(cfg) {
|
|
|
661
661
|
function createAgentStageTriggersApi(cfg) {
|
|
662
662
|
const { base, doFetch } = createHttp(cfg);
|
|
663
663
|
const jsonHeaders = { "content-type": "application/json" };
|
|
664
|
-
const fetchTriggerPage = async (agentId, stageId, options = {}) => {
|
|
664
|
+
const fetchTriggerPage = async (agentId, blueprintId, stageId, options = {}) => {
|
|
665
665
|
const normalizedOptions = {
|
|
666
666
|
page: options.page,
|
|
667
667
|
limit: options.limit,
|
|
@@ -674,7 +674,7 @@ function createAgentStageTriggersApi(cfg) {
|
|
|
674
674
|
};
|
|
675
675
|
const query = serializeListOptions(normalizedOptions);
|
|
676
676
|
const res = await doFetch(
|
|
677
|
-
`${base}/agents/${agentId}/stages/${stageId}/triggers`,
|
|
677
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages/${stageId}/triggers`,
|
|
678
678
|
{
|
|
679
679
|
method: "GET",
|
|
680
680
|
query
|
|
@@ -683,26 +683,26 @@ function createAgentStageTriggersApi(cfg) {
|
|
|
683
683
|
return res.json();
|
|
684
684
|
};
|
|
685
685
|
return {
|
|
686
|
-
async list(agentId, stageId, options = {}) {
|
|
686
|
+
async list(agentId, blueprintId, stageId, options = {}) {
|
|
687
687
|
const normalized = {
|
|
688
688
|
...options ?? {}
|
|
689
689
|
};
|
|
690
|
-
const fetchPage = (opts) => fetchTriggerPage(agentId, stageId, opts);
|
|
690
|
+
const fetchPage = (opts) => fetchTriggerPage(agentId, blueprintId, stageId, opts);
|
|
691
691
|
const response = await fetchPage(normalized);
|
|
692
692
|
return attachPaginator(response, fetchPage, normalized);
|
|
693
693
|
},
|
|
694
|
-
async get(agentId, stageId, triggerId) {
|
|
694
|
+
async get(agentId, blueprintId, stageId, triggerId) {
|
|
695
695
|
const res = await doFetch(
|
|
696
|
-
`${base}/agents/${agentId}/stages/${stageId}/triggers/${triggerId}`,
|
|
696
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages/${stageId}/triggers/${triggerId}`,
|
|
697
697
|
{
|
|
698
698
|
method: "GET"
|
|
699
699
|
}
|
|
700
700
|
);
|
|
701
701
|
return res.json();
|
|
702
702
|
},
|
|
703
|
-
async create(agentId, stageId, payload) {
|
|
703
|
+
async create(agentId, blueprintId, stageId, payload) {
|
|
704
704
|
const res = await doFetch(
|
|
705
|
-
`${base}/agents/${agentId}/stages/${stageId}/triggers`,
|
|
705
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages/${stageId}/triggers`,
|
|
706
706
|
{
|
|
707
707
|
method: "POST",
|
|
708
708
|
headers: jsonHeaders,
|
|
@@ -711,9 +711,9 @@ function createAgentStageTriggersApi(cfg) {
|
|
|
711
711
|
);
|
|
712
712
|
return res.json();
|
|
713
713
|
},
|
|
714
|
-
async update(agentId, stageId, triggerId, payload) {
|
|
714
|
+
async update(agentId, blueprintId, stageId, triggerId, payload) {
|
|
715
715
|
const res = await doFetch(
|
|
716
|
-
`${base}/agents/${agentId}/stages/${stageId}/triggers/${triggerId}`,
|
|
716
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages/${stageId}/triggers/${triggerId}`,
|
|
717
717
|
{
|
|
718
718
|
method: "PATCH",
|
|
719
719
|
headers: jsonHeaders,
|
|
@@ -722,9 +722,9 @@ function createAgentStageTriggersApi(cfg) {
|
|
|
722
722
|
);
|
|
723
723
|
return res.json();
|
|
724
724
|
},
|
|
725
|
-
async delete(agentId, stageId, triggerId) {
|
|
725
|
+
async delete(agentId, blueprintId, stageId, triggerId) {
|
|
726
726
|
await doFetch(
|
|
727
|
-
`${base}/agents/${agentId}/stages/${stageId}/triggers/${triggerId}`,
|
|
727
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages/${stageId}/triggers/${triggerId}`,
|
|
728
728
|
{
|
|
729
729
|
method: "DELETE"
|
|
730
730
|
}
|
|
@@ -737,7 +737,7 @@ function createAgentStageTriggersApi(cfg) {
|
|
|
737
737
|
function createAgentStagesApi(cfg) {
|
|
738
738
|
const { base, doFetch } = createHttp(cfg);
|
|
739
739
|
const jsonHeaders = { "content-type": "application/json" };
|
|
740
|
-
const fetchStagePage = async (agentId, options = {}) => {
|
|
740
|
+
const fetchStagePage = async (agentId, blueprintId, options = {}) => {
|
|
741
741
|
const normalizedOptions = {
|
|
742
742
|
page: options.page,
|
|
743
743
|
limit: options.limit,
|
|
@@ -746,52 +746,70 @@ function createAgentStagesApi(cfg) {
|
|
|
746
746
|
search: options.search
|
|
747
747
|
};
|
|
748
748
|
const query = serializeListOptions(normalizedOptions);
|
|
749
|
-
const res = await doFetch(
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
749
|
+
const res = await doFetch(
|
|
750
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages`,
|
|
751
|
+
{
|
|
752
|
+
method: "GET",
|
|
753
|
+
query
|
|
754
|
+
}
|
|
755
|
+
);
|
|
753
756
|
return res.json();
|
|
754
757
|
};
|
|
755
758
|
return {
|
|
756
|
-
async list(agentId, options = {}) {
|
|
759
|
+
async list(agentId, blueprintId, options = {}) {
|
|
757
760
|
const normalized = { ...options ?? {} };
|
|
758
|
-
const fetchPage = (opts) => fetchStagePage(agentId, opts);
|
|
761
|
+
const fetchPage = (opts) => fetchStagePage(agentId, blueprintId, opts);
|
|
759
762
|
const response = await fetchPage(normalized);
|
|
760
763
|
return attachPaginator(response, fetchPage, normalized);
|
|
761
764
|
},
|
|
762
|
-
async get(agentId, stageId) {
|
|
763
|
-
const res = await doFetch(
|
|
764
|
-
|
|
765
|
-
|
|
765
|
+
async get(agentId, blueprintId, stageId) {
|
|
766
|
+
const res = await doFetch(
|
|
767
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages/${stageId}`,
|
|
768
|
+
{
|
|
769
|
+
method: "GET"
|
|
770
|
+
}
|
|
771
|
+
);
|
|
766
772
|
return res.json();
|
|
767
773
|
},
|
|
768
|
-
async create(agentId, payload) {
|
|
769
|
-
const res = await doFetch(
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
+
async create(agentId, blueprintId, payload) {
|
|
775
|
+
const res = await doFetch(
|
|
776
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages`,
|
|
777
|
+
{
|
|
778
|
+
method: "POST",
|
|
779
|
+
headers: jsonHeaders,
|
|
780
|
+
body: JSON.stringify(payload)
|
|
781
|
+
}
|
|
782
|
+
);
|
|
774
783
|
return res.json();
|
|
775
784
|
},
|
|
776
|
-
async update(agentId, stageId, payload) {
|
|
777
|
-
const res = await doFetch(
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
785
|
+
async update(agentId, blueprintId, stageId, payload) {
|
|
786
|
+
const res = await doFetch(
|
|
787
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages/${stageId}`,
|
|
788
|
+
{
|
|
789
|
+
method: "PATCH",
|
|
790
|
+
headers: jsonHeaders,
|
|
791
|
+
body: JSON.stringify(payload)
|
|
792
|
+
}
|
|
793
|
+
);
|
|
782
794
|
return res.json();
|
|
783
795
|
},
|
|
784
|
-
async delete(agentId, stageId) {
|
|
785
|
-
await doFetch(
|
|
786
|
-
|
|
787
|
-
|
|
796
|
+
async delete(agentId, blueprintId, stageId) {
|
|
797
|
+
await doFetch(
|
|
798
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages/${stageId}`,
|
|
799
|
+
{
|
|
800
|
+
method: "DELETE"
|
|
801
|
+
}
|
|
802
|
+
);
|
|
788
803
|
},
|
|
789
|
-
async reorder(agentId, payload) {
|
|
790
|
-
const res = await doFetch(
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
804
|
+
async reorder(agentId, blueprintId, payload) {
|
|
805
|
+
const res = await doFetch(
|
|
806
|
+
`${base}/agents/${agentId}/blueprints/${blueprintId}/stages:reorder`,
|
|
807
|
+
{
|
|
808
|
+
method: "POST",
|
|
809
|
+
headers: jsonHeaders,
|
|
810
|
+
body: JSON.stringify(payload)
|
|
811
|
+
}
|
|
812
|
+
);
|
|
795
813
|
return res.json();
|
|
796
814
|
}
|
|
797
815
|
};
|
|
@@ -949,46 +967,71 @@ var bindAgentInstructions = (api, agentId) => ({
|
|
|
949
967
|
return api.delete(agentId, instructionId);
|
|
950
968
|
}
|
|
951
969
|
});
|
|
952
|
-
var bindAgentStageTriggers = (api, agentId, stageId) => ({
|
|
970
|
+
var bindAgentStageTriggers = (api, agentId, blueprintId, stageId) => ({
|
|
953
971
|
list(opts) {
|
|
954
|
-
return api.list(agentId, stageId, opts);
|
|
972
|
+
return api.list(agentId, blueprintId, stageId, opts);
|
|
955
973
|
},
|
|
956
974
|
get(triggerId) {
|
|
957
|
-
return api.get(agentId, stageId, triggerId);
|
|
975
|
+
return api.get(agentId, blueprintId, stageId, triggerId);
|
|
958
976
|
},
|
|
959
977
|
create(payload) {
|
|
960
|
-
return api.create(agentId, stageId, payload);
|
|
978
|
+
return api.create(agentId, blueprintId, stageId, payload);
|
|
961
979
|
},
|
|
962
980
|
update(triggerId, payload) {
|
|
963
|
-
return api.update(agentId, stageId, triggerId, payload);
|
|
981
|
+
return api.update(agentId, blueprintId, stageId, triggerId, payload);
|
|
964
982
|
},
|
|
965
983
|
delete(triggerId) {
|
|
966
|
-
return api.delete(agentId, stageId, triggerId);
|
|
967
|
-
}
|
|
968
|
-
});
|
|
969
|
-
var bindAgentStages = (stagesApi, triggersApi, agentId) => ({
|
|
970
|
-
list(opts) {
|
|
971
|
-
return stagesApi.list(agentId, opts);
|
|
972
|
-
},
|
|
973
|
-
get(stageId) {
|
|
974
|
-
return stagesApi.get(agentId, stageId);
|
|
975
|
-
},
|
|
976
|
-
create(payload) {
|
|
977
|
-
return stagesApi.create(agentId, payload);
|
|
978
|
-
},
|
|
979
|
-
update(stageId, payload) {
|
|
980
|
-
return stagesApi.update(agentId, stageId, payload);
|
|
981
|
-
},
|
|
982
|
-
delete(stageId) {
|
|
983
|
-
return stagesApi.delete(agentId, stageId);
|
|
984
|
-
},
|
|
985
|
-
reorder(payload) {
|
|
986
|
-
return stagesApi.reorder(agentId, payload);
|
|
987
|
-
},
|
|
988
|
-
triggers(stageId) {
|
|
989
|
-
return bindAgentStageTriggers(triggersApi, agentId, stageId);
|
|
984
|
+
return api.delete(agentId, blueprintId, stageId, triggerId);
|
|
990
985
|
}
|
|
991
986
|
});
|
|
987
|
+
var bindAgentStages = (stagesApi, triggersApi, agentId) => {
|
|
988
|
+
const forBlueprint = (blueprintId) => ({
|
|
989
|
+
list(opts) {
|
|
990
|
+
return stagesApi.list(agentId, blueprintId, opts);
|
|
991
|
+
},
|
|
992
|
+
get(stageId) {
|
|
993
|
+
return stagesApi.get(agentId, blueprintId, stageId);
|
|
994
|
+
},
|
|
995
|
+
create(payload) {
|
|
996
|
+
return stagesApi.create(agentId, blueprintId, payload);
|
|
997
|
+
},
|
|
998
|
+
update(stageId, payload) {
|
|
999
|
+
return stagesApi.update(agentId, blueprintId, stageId, payload);
|
|
1000
|
+
},
|
|
1001
|
+
delete(stageId) {
|
|
1002
|
+
return stagesApi.delete(agentId, blueprintId, stageId);
|
|
1003
|
+
},
|
|
1004
|
+
reorder(payload) {
|
|
1005
|
+
return stagesApi.reorder(agentId, blueprintId, payload);
|
|
1006
|
+
},
|
|
1007
|
+
triggers(stageId) {
|
|
1008
|
+
return bindAgentStageTriggers(triggersApi, agentId, blueprintId, stageId);
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
return Object.assign(forBlueprint, {
|
|
1012
|
+
list(blueprintId, opts) {
|
|
1013
|
+
return stagesApi.list(agentId, blueprintId, opts);
|
|
1014
|
+
},
|
|
1015
|
+
get(blueprintId, stageId) {
|
|
1016
|
+
return stagesApi.get(agentId, blueprintId, stageId);
|
|
1017
|
+
},
|
|
1018
|
+
create(blueprintId, payload) {
|
|
1019
|
+
return stagesApi.create(agentId, blueprintId, payload);
|
|
1020
|
+
},
|
|
1021
|
+
update(blueprintId, stageId, payload) {
|
|
1022
|
+
return stagesApi.update(agentId, blueprintId, stageId, payload);
|
|
1023
|
+
},
|
|
1024
|
+
delete(blueprintId, stageId) {
|
|
1025
|
+
return stagesApi.delete(agentId, blueprintId, stageId);
|
|
1026
|
+
},
|
|
1027
|
+
reorder(blueprintId, payload) {
|
|
1028
|
+
return stagesApi.reorder(agentId, blueprintId, payload);
|
|
1029
|
+
},
|
|
1030
|
+
triggers(blueprintId, stageId) {
|
|
1031
|
+
return bindAgentStageTriggers(triggersApi, agentId, blueprintId, stageId);
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
};
|
|
992
1035
|
var bindAgentTags = (api, agentId) => ({
|
|
993
1036
|
add(tagId) {
|
|
994
1037
|
return api.add(agentId, { tagId });
|
|
@@ -1884,7 +1927,7 @@ function createClient(initialCfg) {
|
|
|
1884
1927
|
blueprintsApi
|
|
1885
1928
|
);
|
|
1886
1929
|
const stageTriggersNamespace = Object.assign(
|
|
1887
|
-
(agentId, stageId) => bindAgentStageTriggers(stageTriggersApi, agentId, stageId),
|
|
1930
|
+
(agentId, blueprintId, stageId) => bindAgentStageTriggers(stageTriggersApi, agentId, blueprintId, stageId),
|
|
1888
1931
|
stageTriggersApi
|
|
1889
1932
|
);
|
|
1890
1933
|
const stagesNamespace = Object.assign(
|