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

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 (66) 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/tsconfig.build.tsbuildinfo +1 -1
  46. package/dist/workflow/services/workflow.service.d.ts +7 -7
  47. package/dist/workflow/services/workflow.service.js +40 -35
  48. package/dist/workflow/services/workflow.service.js.map +1 -1
  49. package/package.json +4 -4
  50. package/src/mcp/README.md +12 -2
  51. package/src/mcp/mcp-api.module.ts +2 -2
  52. package/src/mcp/tools/catalog-mcp.tools.ts +122 -0
  53. package/src/mcp/tools/cms-mcp.tools.ts +239 -0
  54. package/src/mcp/tools/credential-mcp.tools.ts +81 -0
  55. package/src/mcp/tools/hexabot-mcp-tool.base.ts +74 -0
  56. package/src/mcp/tools/hexabot-mcp.schemas.ts +55 -0
  57. package/src/mcp/tools/hexabot-mcp.tools.ts +1 -1194
  58. package/src/mcp/tools/hexabot-mcp.utils.ts +13 -0
  59. package/src/mcp/tools/index.ts +51 -0
  60. package/src/mcp/tools/mcp-server-mcp.tools.ts +135 -0
  61. package/src/mcp/tools/memory-definition-mcp.tools.ts +125 -0
  62. package/src/mcp/tools/workflow-mcp.helper.ts +166 -0
  63. package/src/mcp/tools/workflow-mcp.tools.ts +254 -0
  64. package/src/mcp/tools/workflow-run-mcp.tools.ts +274 -0
  65. package/src/mcp/tools/workflow-version-mcp.tools.ts +226 -0
  66. package/src/workflow/services/workflow.service.ts +49 -29
@@ -0,0 +1,468 @@
1
+ import { WorkflowService } from "../../workflow/services/workflow.service";
2
+ import { DirectionType, WorkflowType, WorkflowVersionAction } from "../../workflow/types";
3
+ import { HexabotMcpRequest } from '../types';
4
+ import { HexabotMcpToolBase } from './hexabot-mcp-tool.base';
5
+ import { PaginationArgs } from './hexabot-mcp.schemas';
6
+ import { HexabotWorkflowMcpHelper } from './workflow-mcp.helper';
7
+ export declare class HexabotWorkflowMcpTools extends HexabotMcpToolBase {
8
+ private readonly workflowService;
9
+ private readonly workflowHelper;
10
+ constructor(workflowService: WorkflowService, workflowHelper: HexabotWorkflowMcpHelper);
11
+ searchWorkflows(args: {
12
+ query?: string;
13
+ type?: WorkflowType;
14
+ createdById?: string;
15
+ } & PaginationArgs): Promise<{
16
+ items: unknown[];
17
+ total: number;
18
+ limit: number | undefined;
19
+ skip: number | undefined;
20
+ }>;
21
+ getWorkflow(args: {
22
+ id: string;
23
+ }): Promise<{
24
+ id: string;
25
+ createdAt: Date;
26
+ updatedAt: Date;
27
+ name: string;
28
+ description: string | null;
29
+ type: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowType;
30
+ schedule: string | null;
31
+ inputSchema: any;
32
+ builtin: boolean;
33
+ x: number;
34
+ y: number;
35
+ zoom: number;
36
+ direction: import("@hexabot-ai/types/dist/types/workflow/domain").DirectionType;
37
+ currentVersion: {
38
+ id: string;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ version: number;
42
+ definitionYml: string;
43
+ checksum: string;
44
+ message: string | null;
45
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
46
+ parentVersion: string | null;
47
+ workflow: string;
48
+ createdBy: string | null;
49
+ } | null;
50
+ publishedVersion: {
51
+ id: string;
52
+ createdAt: Date;
53
+ updatedAt: Date;
54
+ version: number;
55
+ definitionYml: string;
56
+ checksum: string;
57
+ message: string | null;
58
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
59
+ parentVersion: string | null;
60
+ workflow: string;
61
+ createdBy: string | null;
62
+ } | null;
63
+ createdBy: {
64
+ id: string;
65
+ createdAt: Date;
66
+ updatedAt: Date;
67
+ firstName: string;
68
+ lastName: string;
69
+ language: string | null;
70
+ timezone: number;
71
+ locale: string | null;
72
+ gender: string | null;
73
+ country: string | null;
74
+ foreignId: string | null;
75
+ assignedAt: Date | null;
76
+ lastvisit: Date | null;
77
+ retainedFrom: Date | null;
78
+ channel: {
79
+ name: string | null;
80
+ data?: Record<string, any> | null | undefined;
81
+ };
82
+ username: string;
83
+ email: string;
84
+ sendEmail: boolean;
85
+ state: boolean;
86
+ resetCount: number;
87
+ resetToken: string | null;
88
+ labels: string[];
89
+ assignedTo: string | null;
90
+ roles: string[];
91
+ avatar: string | null;
92
+ provider?: {
93
+ strategy: "local";
94
+ sub?: string | undefined;
95
+ } | undefined;
96
+ } | null;
97
+ definitionYml?: string | undefined;
98
+ definition?: any;
99
+ }>;
100
+ getWorkflowVersionStatus(args: {
101
+ id: string;
102
+ }): Promise<{
103
+ workflow: {
104
+ id: string;
105
+ name: string;
106
+ type: WorkflowType;
107
+ };
108
+ currentVersion: {
109
+ id: string;
110
+ createdAt: Date;
111
+ updatedAt: Date;
112
+ message: string | null;
113
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
114
+ createdBy: string | null;
115
+ workflow: string;
116
+ version: number;
117
+ parentVersion: string | null;
118
+ checksum: string;
119
+ } | null;
120
+ publishedVersion: {
121
+ id: string;
122
+ createdAt: Date;
123
+ updatedAt: Date;
124
+ message: string | null;
125
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
126
+ createdBy: string | null;
127
+ workflow: string;
128
+ version: number;
129
+ parentVersion: string | null;
130
+ checksum: string;
131
+ } | null;
132
+ currentVersionId: string | null;
133
+ publishedVersionId: string | null;
134
+ isPublished: boolean;
135
+ isCurrentVersionPublished: boolean;
136
+ hasUnpublishedChanges: boolean;
137
+ }>;
138
+ createWorkflow(args: {
139
+ name: string;
140
+ description?: string;
141
+ type?: WorkflowType;
142
+ schedule?: string | null;
143
+ inputSchema?: Record<string, unknown>;
144
+ builtin?: boolean;
145
+ x?: number;
146
+ y?: number;
147
+ zoom?: number;
148
+ direction?: DirectionType;
149
+ definitionYml?: string;
150
+ versionMessage?: string;
151
+ }, _context: unknown, request?: HexabotMcpRequest): Promise<{
152
+ id: string;
153
+ createdAt: Date;
154
+ updatedAt: Date;
155
+ name: string;
156
+ description: string | null;
157
+ type: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowType;
158
+ schedule: string | null;
159
+ inputSchema: any;
160
+ builtin: boolean;
161
+ x: number;
162
+ y: number;
163
+ zoom: number;
164
+ direction: import("@hexabot-ai/types/dist/types/workflow/domain").DirectionType;
165
+ currentVersion: {
166
+ id: string;
167
+ createdAt: Date;
168
+ updatedAt: Date;
169
+ version: number;
170
+ definitionYml: string;
171
+ checksum: string;
172
+ message: string | null;
173
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
174
+ parentVersion: string | null;
175
+ workflow: string;
176
+ createdBy: string | null;
177
+ } | null;
178
+ publishedVersion: {
179
+ id: string;
180
+ createdAt: Date;
181
+ updatedAt: Date;
182
+ version: number;
183
+ definitionYml: string;
184
+ checksum: string;
185
+ message: string | null;
186
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
187
+ parentVersion: string | null;
188
+ workflow: string;
189
+ createdBy: string | null;
190
+ } | null;
191
+ createdBy: {
192
+ id: string;
193
+ createdAt: Date;
194
+ updatedAt: Date;
195
+ firstName: string;
196
+ lastName: string;
197
+ language: string | null;
198
+ timezone: number;
199
+ locale: string | null;
200
+ gender: string | null;
201
+ country: string | null;
202
+ foreignId: string | null;
203
+ assignedAt: Date | null;
204
+ lastvisit: Date | null;
205
+ retainedFrom: Date | null;
206
+ channel: {
207
+ name: string | null;
208
+ data?: Record<string, any> | null | undefined;
209
+ };
210
+ username: string;
211
+ email: string;
212
+ sendEmail: boolean;
213
+ state: boolean;
214
+ resetCount: number;
215
+ resetToken: string | null;
216
+ labels: string[];
217
+ assignedTo: string | null;
218
+ roles: string[];
219
+ avatar: string | null;
220
+ provider?: {
221
+ strategy: "local";
222
+ sub?: string | undefined;
223
+ } | undefined;
224
+ } | null;
225
+ definitionYml?: string | undefined;
226
+ definition?: any;
227
+ }>;
228
+ updateWorkflow(args: {
229
+ id: string;
230
+ definitionYml?: string;
231
+ versionMessage?: string;
232
+ } & Record<string, unknown>, _context: unknown, request?: HexabotMcpRequest): Promise<{
233
+ id: string;
234
+ createdAt: Date;
235
+ updatedAt: Date;
236
+ name: string;
237
+ description: string | null;
238
+ type: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowType;
239
+ schedule: string | null;
240
+ inputSchema: any;
241
+ builtin: boolean;
242
+ x: number;
243
+ y: number;
244
+ zoom: number;
245
+ direction: import("@hexabot-ai/types/dist/types/workflow/domain").DirectionType;
246
+ currentVersion: {
247
+ id: string;
248
+ createdAt: Date;
249
+ updatedAt: Date;
250
+ version: number;
251
+ definitionYml: string;
252
+ checksum: string;
253
+ message: string | null;
254
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
255
+ parentVersion: string | null;
256
+ workflow: string;
257
+ createdBy: string | null;
258
+ } | null;
259
+ publishedVersion: {
260
+ id: string;
261
+ createdAt: Date;
262
+ updatedAt: Date;
263
+ version: number;
264
+ definitionYml: string;
265
+ checksum: string;
266
+ message: string | null;
267
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
268
+ parentVersion: string | null;
269
+ workflow: string;
270
+ createdBy: string | null;
271
+ } | null;
272
+ createdBy: {
273
+ id: string;
274
+ createdAt: Date;
275
+ updatedAt: Date;
276
+ firstName: string;
277
+ lastName: string;
278
+ language: string | null;
279
+ timezone: number;
280
+ locale: string | null;
281
+ gender: string | null;
282
+ country: string | null;
283
+ foreignId: string | null;
284
+ assignedAt: Date | null;
285
+ lastvisit: Date | null;
286
+ retainedFrom: Date | null;
287
+ channel: {
288
+ name: string | null;
289
+ data?: Record<string, any> | null | undefined;
290
+ };
291
+ username: string;
292
+ email: string;
293
+ sendEmail: boolean;
294
+ state: boolean;
295
+ resetCount: number;
296
+ resetToken: string | null;
297
+ labels: string[];
298
+ assignedTo: string | null;
299
+ roles: string[];
300
+ avatar: string | null;
301
+ provider?: {
302
+ strategy: "local";
303
+ sub?: string | undefined;
304
+ } | undefined;
305
+ } | null;
306
+ definitionYml?: string | undefined;
307
+ definition?: any;
308
+ }>;
309
+ publishWorkflow(args: {
310
+ id: string;
311
+ }): Promise<{
312
+ id: string;
313
+ createdAt: Date;
314
+ updatedAt: Date;
315
+ name: string;
316
+ description: string | null;
317
+ type: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowType;
318
+ schedule: string | null;
319
+ inputSchema: any;
320
+ builtin: boolean;
321
+ x: number;
322
+ y: number;
323
+ zoom: number;
324
+ direction: import("@hexabot-ai/types/dist/types/workflow/domain").DirectionType;
325
+ currentVersion: {
326
+ id: string;
327
+ createdAt: Date;
328
+ updatedAt: Date;
329
+ version: number;
330
+ definitionYml: string;
331
+ checksum: string;
332
+ message: string | null;
333
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
334
+ parentVersion: string | null;
335
+ workflow: string;
336
+ createdBy: string | null;
337
+ } | null;
338
+ publishedVersion: {
339
+ id: string;
340
+ createdAt: Date;
341
+ updatedAt: Date;
342
+ version: number;
343
+ definitionYml: string;
344
+ checksum: string;
345
+ message: string | null;
346
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
347
+ parentVersion: string | null;
348
+ workflow: string;
349
+ createdBy: string | null;
350
+ } | null;
351
+ createdBy: {
352
+ id: string;
353
+ createdAt: Date;
354
+ updatedAt: Date;
355
+ firstName: string;
356
+ lastName: string;
357
+ language: string | null;
358
+ timezone: number;
359
+ locale: string | null;
360
+ gender: string | null;
361
+ country: string | null;
362
+ foreignId: string | null;
363
+ assignedAt: Date | null;
364
+ lastvisit: Date | null;
365
+ retainedFrom: Date | null;
366
+ channel: {
367
+ name: string | null;
368
+ data?: Record<string, any> | null | undefined;
369
+ };
370
+ username: string;
371
+ email: string;
372
+ sendEmail: boolean;
373
+ state: boolean;
374
+ resetCount: number;
375
+ resetToken: string | null;
376
+ labels: string[];
377
+ assignedTo: string | null;
378
+ roles: string[];
379
+ avatar: string | null;
380
+ provider?: {
381
+ strategy: "local";
382
+ sub?: string | undefined;
383
+ } | undefined;
384
+ } | null;
385
+ definitionYml?: string | undefined;
386
+ definition?: any;
387
+ }>;
388
+ unpublishWorkflow(args: {
389
+ id: string;
390
+ }): Promise<{
391
+ id: string;
392
+ createdAt: Date;
393
+ updatedAt: Date;
394
+ name: string;
395
+ description: string | null;
396
+ type: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowType;
397
+ schedule: string | null;
398
+ inputSchema: any;
399
+ builtin: boolean;
400
+ x: number;
401
+ y: number;
402
+ zoom: number;
403
+ direction: import("@hexabot-ai/types/dist/types/workflow/domain").DirectionType;
404
+ currentVersion: {
405
+ id: string;
406
+ createdAt: Date;
407
+ updatedAt: Date;
408
+ version: number;
409
+ definitionYml: string;
410
+ checksum: string;
411
+ message: string | null;
412
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
413
+ parentVersion: string | null;
414
+ workflow: string;
415
+ createdBy: string | null;
416
+ } | null;
417
+ publishedVersion: {
418
+ id: string;
419
+ createdAt: Date;
420
+ updatedAt: Date;
421
+ version: number;
422
+ definitionYml: string;
423
+ checksum: string;
424
+ message: string | null;
425
+ action: import("@hexabot-ai/types/dist/types/workflow/domain").WorkflowVersionAction | null;
426
+ parentVersion: string | null;
427
+ workflow: string;
428
+ createdBy: string | null;
429
+ } | null;
430
+ createdBy: {
431
+ id: string;
432
+ createdAt: Date;
433
+ updatedAt: Date;
434
+ firstName: string;
435
+ lastName: string;
436
+ language: string | null;
437
+ timezone: number;
438
+ locale: string | null;
439
+ gender: string | null;
440
+ country: string | null;
441
+ foreignId: string | null;
442
+ assignedAt: Date | null;
443
+ lastvisit: Date | null;
444
+ retainedFrom: Date | null;
445
+ channel: {
446
+ name: string | null;
447
+ data?: Record<string, any> | null | undefined;
448
+ };
449
+ username: string;
450
+ email: string;
451
+ sendEmail: boolean;
452
+ state: boolean;
453
+ resetCount: number;
454
+ resetToken: string | null;
455
+ labels: string[];
456
+ assignedTo: string | null;
457
+ roles: string[];
458
+ avatar: string | null;
459
+ provider?: {
460
+ strategy: "local";
461
+ sub?: string | undefined;
462
+ } | undefined;
463
+ } | null;
464
+ definitionYml?: string | undefined;
465
+ definition?: any;
466
+ }>;
467
+ private buildWorkflowWhere;
468
+ }
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HexabotWorkflowMcpTools = void 0;
13
+ const types_1 = require("@hexabot-ai/types");
14
+ const common_1 = require("@nestjs/common");
15
+ const mcp_nest_1 = require("@rekog/mcp-nest");
16
+ const zod_1 = require("zod");
17
+ const workflow_service_1 = require("../../workflow/services/workflow.service");
18
+ const types_2 = require("../../workflow/types");
19
+ const mcp_permission_decorator_1 = require("../decorators/mcp-permission.decorator");
20
+ const mcp_permission_guard_1 = require("../guards/mcp-permission.guard");
21
+ const hexabot_mcp_tool_base_1 = require("./hexabot-mcp-tool.base");
22
+ const hexabot_mcp_schemas_1 = require("./hexabot-mcp.schemas");
23
+ const workflow_mcp_helper_1 = require("./workflow-mcp.helper");
24
+ let HexabotWorkflowMcpTools = class HexabotWorkflowMcpTools extends hexabot_mcp_tool_base_1.HexabotMcpToolBase {
25
+ constructor(workflowService, workflowHelper) {
26
+ super();
27
+ this.workflowService = workflowService;
28
+ this.workflowHelper = workflowHelper;
29
+ }
30
+ async searchWorkflows(args) {
31
+ const where = this.buildWorkflowWhere(args);
32
+ const options = this.findOptions(args, where);
33
+ return await this.listWithCount(this.workflowService, options);
34
+ }
35
+ async getWorkflow(args) {
36
+ return await this.workflowHelper.requireWorkflow(args.id);
37
+ }
38
+ async getWorkflowVersionStatus(args) {
39
+ const workflow = await this.workflowHelper.requireWorkflow(args.id);
40
+ return this.workflowHelper.buildWorkflowVersionStatus(workflow);
41
+ }
42
+ async createWorkflow(args, _context, request) {
43
+ const actorId = this.getActorId(request);
44
+ const { definitionYml, versionMessage, ...workflowPayload } = args;
45
+ const workflow = await this.workflowService.create({
46
+ ...workflowPayload,
47
+ createdBy: actorId,
48
+ });
49
+ if (definitionYml) {
50
+ await this.workflowHelper.commitWorkflowDefinition({
51
+ workflowId: workflow.id,
52
+ definitionYml,
53
+ message: versionMessage,
54
+ action: types_2.WorkflowVersionAction.update,
55
+ createdBy: actorId,
56
+ });
57
+ }
58
+ return await this.workflowHelper.requireWorkflow(workflow.id);
59
+ }
60
+ async updateWorkflow(args, _context, request) {
61
+ const actorId = this.getActorId(request);
62
+ const { id, definitionYml, versionMessage, ...updates } = args;
63
+ await this.workflowHelper.requireWorkflow(id);
64
+ if (Object.keys(updates).length > 0) {
65
+ await this.workflowService.updateOne(id, updates);
66
+ }
67
+ if (definitionYml) {
68
+ await this.workflowHelper.commitWorkflowDefinition({
69
+ workflowId: id,
70
+ definitionYml,
71
+ message: versionMessage,
72
+ action: types_2.WorkflowVersionAction.update,
73
+ createdBy: actorId,
74
+ });
75
+ }
76
+ return await this.workflowHelper.requireWorkflow(id);
77
+ }
78
+ async publishWorkflow(args) {
79
+ const workflow = await this.workflowService.findOne(args.id);
80
+ if (!workflow) {
81
+ throw new common_1.NotFoundException(`Workflow ${args.id} not found`);
82
+ }
83
+ if (!workflow.currentVersion) {
84
+ throw new common_1.BadRequestException('Workflow must have a current version to be published');
85
+ }
86
+ await this.workflowService.updateOne(args.id, {
87
+ publishedVersion: workflow.currentVersion,
88
+ });
89
+ return await this.workflowHelper.requireWorkflow(args.id);
90
+ }
91
+ async unpublishWorkflow(args) {
92
+ await this.workflowHelper.requireWorkflow(args.id);
93
+ await this.workflowService.updateOne(args.id, { publishedVersion: null });
94
+ return await this.workflowHelper.requireWorkflow(args.id);
95
+ }
96
+ buildWorkflowWhere(args) {
97
+ const base = {
98
+ ...(args.type ? { type: args.type } : {}),
99
+ ...(args.createdById ? { createdBy: { id: args.createdById } } : {}),
100
+ };
101
+ return args.query
102
+ ? [
103
+ { ...base, name: this.contains(args.query) },
104
+ { ...base, description: this.contains(args.query) },
105
+ ]
106
+ : base;
107
+ }
108
+ };
109
+ exports.HexabotWorkflowMcpTools = HexabotWorkflowMcpTools;
110
+ __decorate([
111
+ (0, mcp_permission_decorator_1.McpPermission)('workflow', types_1.Action.READ),
112
+ (0, mcp_nest_1.ToolGuards)([mcp_permission_guard_1.McpPermissionGuard]),
113
+ (0, mcp_nest_1.Tool)({
114
+ name: 'hexabot_workflow_search',
115
+ description: 'Search Hexabot workflows by metadata.',
116
+ parameters: zod_1.z.object({
117
+ query: zod_1.z.string().optional(),
118
+ type: zod_1.z.enum(types_2.WorkflowType).optional(),
119
+ createdById: hexabot_mcp_schemas_1.uuidSchema.optional(),
120
+ ...hexabot_mcp_schemas_1.paginationSchema,
121
+ }),
122
+ }),
123
+ __metadata("design:type", Function),
124
+ __metadata("design:paramtypes", [Object]),
125
+ __metadata("design:returntype", Promise)
126
+ ], HexabotWorkflowMcpTools.prototype, "searchWorkflows", null);
127
+ __decorate([
128
+ (0, mcp_permission_decorator_1.McpPermission)('workflow', types_1.Action.READ),
129
+ (0, mcp_nest_1.ToolGuards)([mcp_permission_guard_1.McpPermissionGuard]),
130
+ (0, mcp_nest_1.Tool)({
131
+ name: 'hexabot_workflow_get',
132
+ description: 'Read a Hexabot workflow with populated version metadata.',
133
+ parameters: zod_1.z.object({
134
+ id: hexabot_mcp_schemas_1.uuidSchema,
135
+ }),
136
+ }),
137
+ __metadata("design:type", Function),
138
+ __metadata("design:paramtypes", [Object]),
139
+ __metadata("design:returntype", Promise)
140
+ ], HexabotWorkflowMcpTools.prototype, "getWorkflow", null);
141
+ __decorate([
142
+ (0, mcp_permission_decorator_1.McpPermission)('workflow', types_1.Action.READ),
143
+ (0, mcp_nest_1.ToolGuards)([mcp_permission_guard_1.McpPermissionGuard]),
144
+ (0, mcp_nest_1.Tool)({
145
+ name: 'hexabot_workflow_version_status',
146
+ description: 'Check the current and published version pointers for one workflow.',
147
+ parameters: zod_1.z.object({
148
+ id: hexabot_mcp_schemas_1.uuidSchema,
149
+ }),
150
+ }),
151
+ __metadata("design:type", Function),
152
+ __metadata("design:paramtypes", [Object]),
153
+ __metadata("design:returntype", Promise)
154
+ ], HexabotWorkflowMcpTools.prototype, "getWorkflowVersionStatus", null);
155
+ __decorate([
156
+ (0, mcp_permission_decorator_1.McpPermission)('workflow', types_1.Action.CREATE),
157
+ (0, mcp_nest_1.ToolGuards)([mcp_permission_guard_1.McpPermissionGuard]),
158
+ (0, mcp_nest_1.Tool)({
159
+ name: 'hexabot_workflow_create',
160
+ description: 'Create a Hexabot workflow. Optionally commit an initial workflow definition YAML.',
161
+ parameters: zod_1.z.object({
162
+ ...hexabot_mcp_schemas_1.workflowPayloadSchema,
163
+ name: zod_1.z.string().min(1),
164
+ definitionYml: zod_1.z.string().optional(),
165
+ versionMessage: zod_1.z.string().optional(),
166
+ }),
167
+ }),
168
+ __metadata("design:type", Function),
169
+ __metadata("design:paramtypes", [Object, Object, Object]),
170
+ __metadata("design:returntype", Promise)
171
+ ], HexabotWorkflowMcpTools.prototype, "createWorkflow", null);
172
+ __decorate([
173
+ (0, mcp_permission_decorator_1.McpPermission)('workflow', types_1.Action.UPDATE),
174
+ (0, mcp_nest_1.ToolGuards)([mcp_permission_guard_1.McpPermissionGuard]),
175
+ (0, mcp_nest_1.Tool)({
176
+ name: 'hexabot_workflow_update',
177
+ description: 'Update workflow metadata. Optionally commit a new workflow definition YAML version.',
178
+ parameters: zod_1.z.object({
179
+ id: hexabot_mcp_schemas_1.uuidSchema,
180
+ ...hexabot_mcp_schemas_1.workflowPayloadSchema,
181
+ definitionYml: zod_1.z.string().optional(),
182
+ versionMessage: zod_1.z.string().optional(),
183
+ }),
184
+ }),
185
+ __metadata("design:type", Function),
186
+ __metadata("design:paramtypes", [Object, Object, Object]),
187
+ __metadata("design:returntype", Promise)
188
+ ], HexabotWorkflowMcpTools.prototype, "updateWorkflow", null);
189
+ __decorate([
190
+ (0, mcp_permission_decorator_1.McpPermission)('workflow', types_1.Action.UPDATE),
191
+ (0, mcp_nest_1.ToolGuards)([mcp_permission_guard_1.McpPermissionGuard]),
192
+ (0, mcp_nest_1.Tool)({
193
+ name: 'hexabot_workflow_publish',
194
+ description: 'Publish the current workflow version.',
195
+ parameters: zod_1.z.object({
196
+ id: hexabot_mcp_schemas_1.uuidSchema,
197
+ }),
198
+ }),
199
+ __metadata("design:type", Function),
200
+ __metadata("design:paramtypes", [Object]),
201
+ __metadata("design:returntype", Promise)
202
+ ], HexabotWorkflowMcpTools.prototype, "publishWorkflow", null);
203
+ __decorate([
204
+ (0, mcp_permission_decorator_1.McpPermission)('workflow', types_1.Action.UPDATE),
205
+ (0, mcp_nest_1.ToolGuards)([mcp_permission_guard_1.McpPermissionGuard]),
206
+ (0, mcp_nest_1.Tool)({
207
+ name: 'hexabot_workflow_unpublish',
208
+ description: 'Clear the published workflow version.',
209
+ parameters: zod_1.z.object({
210
+ id: hexabot_mcp_schemas_1.uuidSchema,
211
+ }),
212
+ }),
213
+ __metadata("design:type", Function),
214
+ __metadata("design:paramtypes", [Object]),
215
+ __metadata("design:returntype", Promise)
216
+ ], HexabotWorkflowMcpTools.prototype, "unpublishWorkflow", null);
217
+ exports.HexabotWorkflowMcpTools = HexabotWorkflowMcpTools = __decorate([
218
+ (0, common_1.Injectable)(),
219
+ __metadata("design:paramtypes", [workflow_service_1.WorkflowService,
220
+ workflow_mcp_helper_1.HexabotWorkflowMcpHelper])
221
+ ], HexabotWorkflowMcpTools);
222
+ //# sourceMappingURL=workflow-mcp.tools.js.map