@hexabot-ai/api 3.2.2-alpha.14 → 3.2.2-alpha.16

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.
Files changed (89) hide show
  1. package/dist/mcp/mcp-api.module.js +2 -2
  2. package/dist/mcp/mcp-api.module.js.map +1 -1
  3. package/dist/mcp/tools/catalog-mcp.tools.d.ts +63 -0
  4. package/dist/mcp/tools/catalog-mcp.tools.js +135 -0
  5. package/dist/mcp/tools/catalog-mcp.tools.js.map +1 -0
  6. package/dist/mcp/tools/cms-mcp.tools.d.ts +128 -0
  7. package/dist/mcp/tools/cms-mcp.tools.js +242 -0
  8. package/dist/mcp/tools/cms-mcp.tools.js.map +1 -0
  9. package/dist/mcp/tools/credential-mcp.tools.d.ts +19 -0
  10. package/dist/mcp/tools/credential-mcp.tools.js +82 -0
  11. package/dist/mcp/tools/credential-mcp.tools.js.map +1 -0
  12. package/dist/mcp/tools/hexabot-mcp-tool.base.d.ts +22 -0
  13. package/dist/mcp/tools/hexabot-mcp-tool.base.js +48 -0
  14. package/dist/mcp/tools/hexabot-mcp-tool.base.js.map +1 -0
  15. package/dist/mcp/tools/hexabot-mcp.schemas.d.ts +41 -0
  16. package/dist/mcp/tools/hexabot-mcp.schemas.js +36 -0
  17. package/dist/mcp/tools/hexabot-mcp.schemas.js.map +1 -0
  18. package/dist/mcp/tools/hexabot-mcp.tools.d.ts +1 -1329
  19. package/dist/mcp/tools/hexabot-mcp.tools.js +14 -1097
  20. package/dist/mcp/tools/hexabot-mcp.tools.js.map +1 -1
  21. package/dist/mcp/tools/hexabot-mcp.utils.d.ts +1 -0
  22. package/dist/mcp/tools/hexabot-mcp.utils.js +9 -0
  23. package/dist/mcp/tools/hexabot-mcp.utils.js.map +1 -0
  24. package/dist/mcp/tools/index.d.ts +22 -0
  25. package/dist/mcp/tools/index.js +50 -0
  26. package/dist/mcp/tools/index.js.map +1 -0
  27. package/dist/mcp/tools/mcp-server-mcp.tools.d.ts +77 -0
  28. package/dist/mcp/tools/mcp-server-mcp.tools.js +130 -0
  29. package/dist/mcp/tools/mcp-server-mcp.tools.js.map +1 -0
  30. package/dist/mcp/tools/memory-definition-mcp.tools.d.ts +57 -0
  31. package/dist/mcp/tools/memory-definition-mcp.tools.js +128 -0
  32. package/dist/mcp/tools/memory-definition-mcp.tools.js.map +1 -0
  33. package/dist/mcp/tools/workflow-mcp.helper.d.ts +141 -0
  34. package/dist/mcp/tools/workflow-mcp.helper.js +108 -0
  35. package/dist/mcp/tools/workflow-mcp.helper.js.map +1 -0
  36. package/dist/mcp/tools/workflow-mcp.tools.d.ts +468 -0
  37. package/dist/mcp/tools/workflow-mcp.tools.js +222 -0
  38. package/dist/mcp/tools/workflow-mcp.tools.js.map +1 -0
  39. package/dist/mcp/tools/workflow-run-mcp.tools.d.ts +347 -0
  40. package/dist/mcp/tools/workflow-run-mcp.tools.js +229 -0
  41. package/dist/mcp/tools/workflow-run-mcp.tools.js.map +1 -0
  42. package/dist/mcp/tools/workflow-version-mcp.tools.d.ts +230 -0
  43. package/dist/mcp/tools/workflow-version-mcp.tools.js +211 -0
  44. package/dist/mcp/tools/workflow-version-mcp.tools.js.map +1 -0
  45. package/dist/static/assets/{browser-ponyfill-D3QB7SUD.js → browser-ponyfill-CBXq65SP.js} +1 -1
  46. package/dist/static/assets/{cssMode-Bk0-m_Ij.js → cssMode-CN8f6H-j.js} +1 -1
  47. package/dist/static/assets/{freemarker2-D1tTqqt8.js → freemarker2-Dfrb95Lt.js} +1 -1
  48. package/dist/static/assets/{handlebars-D3VQYLDj.js → handlebars-B2cershf.js} +1 -1
  49. package/dist/static/assets/{html-Cmhr3-6_.js → html-CfjuUmTR.js} +1 -1
  50. package/dist/static/assets/{htmlMode-Bb5Kynv_.js → htmlMode-pl8CUTaA.js} +1 -1
  51. package/dist/static/assets/{index-JPQj6OiL.js → index-Cq8K5Poc.js} +2131 -2131
  52. package/dist/static/assets/{index-BI1BtkYv.css → index-D-b9KTZd.css} +1 -1
  53. package/dist/static/assets/{javascript-BkQdNyFT.js → javascript-Be45wN2i.js} +1 -1
  54. package/dist/static/assets/{jsonMode-CS1296LF.js → jsonMode-yPU1rg8t.js} +1 -1
  55. package/dist/static/assets/{liquid-C9ufUE-r.js → liquid-BMJibvBr.js} +1 -1
  56. package/dist/static/assets/{lspLanguageFeatures-Dxd2SsrE.js → lspLanguageFeatures-Cxz6b29K.js} +1 -1
  57. package/dist/static/assets/{mdx-Dm4bC48D.js → mdx-DpvXygi3.js} +1 -1
  58. package/dist/static/assets/{python-ZvBWpr_q.js → python-BHEnNcMm.js} +1 -1
  59. package/dist/static/assets/{razor-DBj-LyWR.js → razor-B6-tNhh_.js} +1 -1
  60. package/dist/static/assets/{tsMode-DzMlJB2i.js → tsMode-J4SJIY5C.js} +1 -1
  61. package/dist/static/assets/{typescript-Cfo3bzpy.js → typescript-Df82IAgp.js} +1 -1
  62. package/dist/static/assets/{xml-ZyceR0L3.js → xml-C8jr31yy.js} +1 -1
  63. package/dist/static/assets/{yaml-oyu_gOar.js → yaml-BEd1RzBW.js} +1 -1
  64. package/dist/static/index.html +2 -2
  65. package/dist/tsconfig.build.tsbuildinfo +1 -1
  66. package/dist/websocket/websocket.gateway.d.ts +2 -1
  67. package/dist/websocket/websocket.gateway.js.map +1 -1
  68. package/dist/workflow/services/workflow.service.d.ts +9 -8
  69. package/dist/workflow/services/workflow.service.js +50 -35
  70. package/dist/workflow/services/workflow.service.js.map +1 -1
  71. package/package.json +4 -4
  72. package/src/mcp/README.md +12 -2
  73. package/src/mcp/mcp-api.module.ts +2 -2
  74. package/src/mcp/tools/catalog-mcp.tools.ts +122 -0
  75. package/src/mcp/tools/cms-mcp.tools.ts +239 -0
  76. package/src/mcp/tools/credential-mcp.tools.ts +81 -0
  77. package/src/mcp/tools/hexabot-mcp-tool.base.ts +74 -0
  78. package/src/mcp/tools/hexabot-mcp.schemas.ts +55 -0
  79. package/src/mcp/tools/hexabot-mcp.tools.ts +1 -1194
  80. package/src/mcp/tools/hexabot-mcp.utils.ts +13 -0
  81. package/src/mcp/tools/index.ts +51 -0
  82. package/src/mcp/tools/mcp-server-mcp.tools.ts +135 -0
  83. package/src/mcp/tools/memory-definition-mcp.tools.ts +125 -0
  84. package/src/mcp/tools/workflow-mcp.helper.ts +166 -0
  85. package/src/mcp/tools/workflow-mcp.tools.ts +254 -0
  86. package/src/mcp/tools/workflow-run-mcp.tools.ts +274 -0
  87. package/src/mcp/tools/workflow-version-mcp.tools.ts +226 -0
  88. package/src/websocket/websocket.gateway.ts +2 -1
  89. package/src/workflow/services/workflow.service.ts +58 -30
@@ -0,0 +1,226 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { validateWorkflow } from '@hexabot-ai/agentic';
8
+ import { Action } from '@hexabot-ai/types';
9
+ import { Injectable, NotFoundException } from '@nestjs/common';
10
+ import { Tool, ToolGuards } from '@rekog/mcp-nest';
11
+ import { z } from 'zod';
12
+
13
+ import { ActionService } from '@/actions/actions.service';
14
+ import { RuntimeBindingsService } from '@/bindings/runtime-bindings.service';
15
+ import { WorkflowVersionOrmEntity } from '@/workflow/entities/workflow-version.entity';
16
+ import { WorkflowVersionService } from '@/workflow/services/workflow-version.service';
17
+ import { WorkflowVersionAction } from '@/workflow/types';
18
+
19
+ import { McpPermission } from '../decorators/mcp-permission.decorator';
20
+ import { McpPermissionGuard } from '../guards/mcp-permission.guard';
21
+ import { HexabotMcpRequest } from '../types';
22
+
23
+ import { HexabotMcpToolBase } from './hexabot-mcp-tool.base';
24
+ import {
25
+ PaginationArgs,
26
+ paginationSchema,
27
+ uuidSchema,
28
+ } from './hexabot-mcp.schemas';
29
+ import { HexabotWorkflowMcpHelper } from './workflow-mcp.helper';
30
+
31
+ @Injectable()
32
+ export class HexabotWorkflowVersionMcpTools extends HexabotMcpToolBase {
33
+ constructor(
34
+ private readonly workflowVersionService: WorkflowVersionService,
35
+ private readonly actionService: ActionService,
36
+ private readonly runtimeBindingsService: RuntimeBindingsService,
37
+ private readonly workflowHelper: HexabotWorkflowMcpHelper,
38
+ ) {
39
+ super();
40
+ }
41
+
42
+ @McpPermission('workflowversion', Action.CREATE)
43
+ @ToolGuards([McpPermissionGuard])
44
+ @Tool({
45
+ name: 'hexabot_workflow_yaml_commit',
46
+ description:
47
+ 'Validate and commit workflow definition YAML as a new version.',
48
+ parameters: z.object({
49
+ workflowId: uuidSchema,
50
+ definitionYml: z.string().min(1),
51
+ message: z.string().optional(),
52
+ parentVersion: uuidSchema.nullable().optional(),
53
+ action: z
54
+ .enum(WorkflowVersionAction)
55
+ .default(WorkflowVersionAction.update),
56
+ }),
57
+ })
58
+ async commitWorkflowYaml(
59
+ args: {
60
+ workflowId: string;
61
+ definitionYml: string;
62
+ message?: string;
63
+ parentVersion?: string | null;
64
+ action: WorkflowVersionAction;
65
+ },
66
+ _context: unknown,
67
+ request?: HexabotMcpRequest,
68
+ ) {
69
+ const actorId = this.getActorId(request);
70
+
71
+ return await this.workflowHelper.commitWorkflowDefinition({
72
+ ...args,
73
+ createdBy: actorId,
74
+ });
75
+ }
76
+
77
+ @McpPermission('workflow', Action.READ)
78
+ @ToolGuards([McpPermissionGuard])
79
+ @Tool({
80
+ name: 'hexabot_workflow_yaml_validate',
81
+ description:
82
+ 'Validate workflow definition YAML without creating a workflow version.',
83
+ parameters: z.object({
84
+ definitionYml: z.string().min(1),
85
+ validateActions: z.boolean().default(true),
86
+ }),
87
+ })
88
+ async validateWorkflowYaml(args: {
89
+ definitionYml: string;
90
+ validateActions?: boolean;
91
+ }) {
92
+ const validateActions = args.validateActions ?? true;
93
+ const validation = validateWorkflow(args.definitionYml, {
94
+ bindingKinds: this.runtimeBindingsService.getRegistry(),
95
+ ...(validateActions
96
+ ? { actions: this.getWorkflowValidationActions() }
97
+ : {}),
98
+ });
99
+
100
+ if (!validation.success) {
101
+ return { valid: false, errors: validation.errors };
102
+ }
103
+
104
+ return { valid: true, errors: [], definition: validation.data };
105
+ }
106
+
107
+ @McpPermission('workflowversion', Action.READ)
108
+ @ToolGuards([McpPermissionGuard])
109
+ @Tool({
110
+ name: 'hexabot_workflow_version_search',
111
+ description: 'List workflow definition YAML versions for a workflow.',
112
+ parameters: z.object({
113
+ workflowId: uuidSchema,
114
+ ...paginationSchema,
115
+ sortBy: z.string().default('version'),
116
+ sortDirection: z.enum(['ASC', 'DESC']).default('DESC'),
117
+ }),
118
+ })
119
+ async searchWorkflowVersions(args: { workflowId: string } & PaginationArgs) {
120
+ const where = { workflow: { id: args.workflowId } } as any;
121
+
122
+ return await this.listWithCount(
123
+ this.workflowVersionService,
124
+ this.findOptions<WorkflowVersionOrmEntity>(args, where),
125
+ );
126
+ }
127
+
128
+ @McpPermission('workflowversion', Action.READ)
129
+ @ToolGuards([McpPermissionGuard])
130
+ @Tool({
131
+ name: 'hexabot_workflow_version_get',
132
+ description: 'Read one workflow definition YAML version.',
133
+ parameters: z.object({
134
+ id: uuidSchema,
135
+ workflowId: uuidSchema.optional(),
136
+ }),
137
+ })
138
+ async getWorkflowVersion(args: { id: string; workflowId?: string }) {
139
+ const version = await this.workflowVersionService.findOneAndPopulate({
140
+ where: {
141
+ id: args.id,
142
+ ...(args.workflowId ? { workflow: { id: args.workflowId } } : {}),
143
+ } as any,
144
+ });
145
+
146
+ if (!version) {
147
+ throw new NotFoundException(`Workflow version ${args.id} not found`);
148
+ }
149
+
150
+ return version;
151
+ }
152
+
153
+ @McpPermission('workflowversion', Action.UPDATE)
154
+ @ToolGuards([McpPermissionGuard])
155
+ @Tool({
156
+ name: 'hexabot_workflow_version_update',
157
+ description:
158
+ 'Update workflow version metadata such as the version message.',
159
+ parameters: z.object({
160
+ id: uuidSchema,
161
+ message: z.string().nullable().optional(),
162
+ }),
163
+ })
164
+ async updateWorkflowVersion(args: { id: string; message?: string | null }) {
165
+ return await this.workflowVersionService.updateOne(args.id, {
166
+ message: args.message ?? undefined,
167
+ });
168
+ }
169
+
170
+ @McpPermission('workflowversion', Action.CREATE)
171
+ @ToolGuards([McpPermissionGuard])
172
+ @Tool({
173
+ name: 'hexabot_workflow_version_restore',
174
+ description:
175
+ 'Restore a workflow to a previous YAML version by creating a new restore snapshot.',
176
+ parameters: z.object({
177
+ workflowId: uuidSchema,
178
+ versionId: uuidSchema,
179
+ message: z.string().optional(),
180
+ }),
181
+ })
182
+ async restoreWorkflowVersion(
183
+ args: { workflowId: string; versionId: string; message?: string },
184
+ _context: unknown,
185
+ request?: HexabotMcpRequest,
186
+ ) {
187
+ return await this.workflowHelper.restoreWorkflowVersionSnapshot(
188
+ args,
189
+ this.getActorId(request),
190
+ );
191
+ }
192
+
193
+ @McpPermission('workflowversion', Action.CREATE)
194
+ @ToolGuards([McpPermissionGuard])
195
+ @Tool({
196
+ name: 'hexabot_workflow_rollback',
197
+ description:
198
+ 'Rollback a workflow to a previous YAML version by creating a new current restore snapshot.',
199
+ parameters: z.object({
200
+ workflowId: uuidSchema,
201
+ versionId: uuidSchema,
202
+ message: z.string().optional(),
203
+ }),
204
+ })
205
+ async rollbackWorkflowVersion(
206
+ args: { workflowId: string; versionId: string; message?: string },
207
+ _context: unknown,
208
+ request?: HexabotMcpRequest,
209
+ ) {
210
+ return await this.workflowHelper.restoreWorkflowVersionSnapshot(
211
+ args,
212
+ this.getActorId(request),
213
+ );
214
+ }
215
+
216
+ private getWorkflowValidationActions() {
217
+ return Object.fromEntries(
218
+ Object.entries(this.actionService.getRegistry()).map(
219
+ ([actionName, action]) => [
220
+ actionName,
221
+ { supportedBindings: action.supportedBindings ?? [] },
222
+ ],
223
+ ),
224
+ );
225
+ }
226
+ }
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import { type WorkflowEventMap } from '@hexabot-ai/agentic';
8
- import { StdEventType, Subscriber } from '@hexabot-ai/types';
8
+ import { StdEventType, Subscriber, type WorkflowRun } from '@hexabot-ai/types';
9
9
  import { ForbiddenException, Optional } from '@nestjs/common';
10
10
  import { EventEmitter2, OnEvent } from '@nestjs/event-emitter';
11
11
  import {
@@ -69,6 +69,7 @@ export class WebsocketGateway
69
69
  Partial<Pick<WorkflowContextState, 'initiatorId'>> & {
70
70
  workflowId: string;
71
71
  threadId?: string;
72
+ workflowRun?: WorkflowRun;
72
73
  workflowEvent: string;
73
74
  t: number;
74
75
  }): void {
@@ -4,7 +4,7 @@
4
4
  * Full terms: see LICENSE.md.
5
5
  */
6
6
 
7
- import { WorkflowEventMap } from '@hexabot-ai/agentic';
7
+ import type { WorkflowEventMap } from '@hexabot-ai/agentic';
8
8
  import { WorkflowFull, Workflow } from '@hexabot-ai/types';
9
9
  import {
10
10
  BadRequestException,
@@ -208,57 +208,85 @@ export class WorkflowService extends BaseOrmService<WorkflowOrmEntity> {
208
208
 
209
209
  return;
210
210
  }
211
- const { initiatorId, workflowId, threadId } = workflowRun?.context;
211
+ const { initiatorId, workflowId, threadId } = workflowRun.context;
212
+ if (
213
+ typeof initiatorId !== 'string' ||
214
+ !initiatorId ||
215
+ typeof workflowId !== 'string' ||
216
+ !workflowId
217
+ ) {
218
+ this.logger.error(
219
+ 'workflowRun context requires initiatorId and workflowId',
220
+ );
221
+
222
+ return;
223
+ }
224
+
212
225
  const workflow = await this.findOne(workflowId);
213
- const canBroadcastEvents =
214
- initiatorId &&
215
- workflow?.type &&
216
- [WorkflowType.conversational].includes(workflow.type);
217
-
218
- if (canBroadcastEvents) {
219
- this.gateway.broadcastWorkflowEvent({
220
- ...payload,
221
- t,
222
- workflowId,
223
- initiatorId,
224
- threadId: typeof threadId === 'string' ? threadId : undefined,
225
- workflowEvent: workflowEvent.replace('hook:', ''),
226
- });
226
+ if (!workflow?.type) {
227
+ this.logger.error('workflow is required');
228
+
229
+ return;
227
230
  }
231
+
232
+ this.gateway.broadcastWorkflowEvent({
233
+ ...payload,
234
+ t,
235
+ workflowRun,
236
+ workflowId,
237
+ initiatorId,
238
+ threadId: typeof threadId === 'string' ? threadId : undefined,
239
+ workflowEvent: workflowEvent.replace('hook:', ''),
240
+ });
228
241
  }
229
242
 
230
243
  @OnEvent('hook:workflow:start')
231
- sendWorkflowStart(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
232
- this.sendWorkflowEvent('hook:workflow:start', payload);
244
+ async sendWorkflowStart(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
245
+ await this.sendWorkflowEvent('hook:workflow:start', payload);
233
246
  }
234
247
 
235
248
  @OnEvent('hook:workflow:finish')
236
- sendWorkflowFinish(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
237
- this.sendWorkflowEvent('hook:workflow:finish', payload);
249
+ async sendWorkflowFinish(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
250
+ await this.sendWorkflowEvent('hook:workflow:finish', payload);
251
+ }
252
+
253
+ @OnEvent('hook:workflow:suspended')
254
+ async sendWorkflowSuspended(
255
+ payload: WorkflowEventMap[keyof WorkflowEventMap],
256
+ ) {
257
+ await this.sendWorkflowEvent('hook:workflow:suspended', payload);
238
258
  }
239
259
 
240
260
  @OnEvent('hook:workflow:failure')
241
- sendWorkflowFailure(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
242
- this.sendWorkflowEvent('hook:workflow:failure', payload);
261
+ async sendWorkflowFailure(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
262
+ await this.sendWorkflowEvent('hook:workflow:failure', payload);
243
263
  }
244
264
 
245
265
  @OnEvent('hook:step:start')
246
- sendWorkflowStepStart(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
247
- this.sendWorkflowEvent('hook:step:start', payload);
266
+ async sendWorkflowStepStart(
267
+ payload: WorkflowEventMap[keyof WorkflowEventMap],
268
+ ) {
269
+ await this.sendWorkflowEvent('hook:step:start', payload);
248
270
  }
249
271
 
250
272
  @OnEvent('hook:step:suspended')
251
- sendWorkflowStepSuspended(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
252
- this.sendWorkflowEvent('hook:step:suspended', payload);
273
+ async sendWorkflowStepSuspended(
274
+ payload: WorkflowEventMap[keyof WorkflowEventMap],
275
+ ) {
276
+ await this.sendWorkflowEvent('hook:step:suspended', payload);
253
277
  }
254
278
 
255
279
  @OnEvent('hook:step:success')
256
- sendWorkflowStepSuccess(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
257
- this.sendWorkflowEvent('hook:step:success', payload);
280
+ async sendWorkflowStepSuccess(
281
+ payload: WorkflowEventMap[keyof WorkflowEventMap],
282
+ ) {
283
+ await this.sendWorkflowEvent('hook:step:success', payload);
258
284
  }
259
285
 
260
286
  @OnEvent('hook:step:error')
261
- sendWorkflowStepError(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
262
- this.sendWorkflowEvent('hook:step:error', payload);
287
+ async sendWorkflowStepError(
288
+ payload: WorkflowEventMap[keyof WorkflowEventMap],
289
+ ) {
290
+ await this.sendWorkflowEvent('hook:step:error', payload);
263
291
  }
264
292
  }