@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.
- package/dist/mcp/mcp-api.module.js +2 -2
- package/dist/mcp/mcp-api.module.js.map +1 -1
- package/dist/mcp/tools/catalog-mcp.tools.d.ts +63 -0
- package/dist/mcp/tools/catalog-mcp.tools.js +135 -0
- package/dist/mcp/tools/catalog-mcp.tools.js.map +1 -0
- package/dist/mcp/tools/cms-mcp.tools.d.ts +128 -0
- package/dist/mcp/tools/cms-mcp.tools.js +242 -0
- package/dist/mcp/tools/cms-mcp.tools.js.map +1 -0
- package/dist/mcp/tools/credential-mcp.tools.d.ts +19 -0
- package/dist/mcp/tools/credential-mcp.tools.js +82 -0
- package/dist/mcp/tools/credential-mcp.tools.js.map +1 -0
- package/dist/mcp/tools/hexabot-mcp-tool.base.d.ts +22 -0
- package/dist/mcp/tools/hexabot-mcp-tool.base.js +48 -0
- package/dist/mcp/tools/hexabot-mcp-tool.base.js.map +1 -0
- package/dist/mcp/tools/hexabot-mcp.schemas.d.ts +41 -0
- package/dist/mcp/tools/hexabot-mcp.schemas.js +36 -0
- package/dist/mcp/tools/hexabot-mcp.schemas.js.map +1 -0
- package/dist/mcp/tools/hexabot-mcp.tools.d.ts +1 -1329
- package/dist/mcp/tools/hexabot-mcp.tools.js +14 -1097
- package/dist/mcp/tools/hexabot-mcp.tools.js.map +1 -1
- package/dist/mcp/tools/hexabot-mcp.utils.d.ts +1 -0
- package/dist/mcp/tools/hexabot-mcp.utils.js +9 -0
- package/dist/mcp/tools/hexabot-mcp.utils.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +22 -0
- package/dist/mcp/tools/index.js +50 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/mcp-server-mcp.tools.d.ts +77 -0
- package/dist/mcp/tools/mcp-server-mcp.tools.js +130 -0
- package/dist/mcp/tools/mcp-server-mcp.tools.js.map +1 -0
- package/dist/mcp/tools/memory-definition-mcp.tools.d.ts +57 -0
- package/dist/mcp/tools/memory-definition-mcp.tools.js +128 -0
- package/dist/mcp/tools/memory-definition-mcp.tools.js.map +1 -0
- package/dist/mcp/tools/workflow-mcp.helper.d.ts +141 -0
- package/dist/mcp/tools/workflow-mcp.helper.js +108 -0
- package/dist/mcp/tools/workflow-mcp.helper.js.map +1 -0
- package/dist/mcp/tools/workflow-mcp.tools.d.ts +468 -0
- package/dist/mcp/tools/workflow-mcp.tools.js +222 -0
- package/dist/mcp/tools/workflow-mcp.tools.js.map +1 -0
- package/dist/mcp/tools/workflow-run-mcp.tools.d.ts +347 -0
- package/dist/mcp/tools/workflow-run-mcp.tools.js +229 -0
- package/dist/mcp/tools/workflow-run-mcp.tools.js.map +1 -0
- package/dist/mcp/tools/workflow-version-mcp.tools.d.ts +230 -0
- package/dist/mcp/tools/workflow-version-mcp.tools.js +211 -0
- package/dist/mcp/tools/workflow-version-mcp.tools.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/workflow/services/workflow.service.d.ts +7 -7
- package/dist/workflow/services/workflow.service.js +40 -35
- package/dist/workflow/services/workflow.service.js.map +1 -1
- package/package.json +4 -4
- package/src/mcp/README.md +12 -2
- package/src/mcp/mcp-api.module.ts +2 -2
- package/src/mcp/tools/catalog-mcp.tools.ts +122 -0
- package/src/mcp/tools/cms-mcp.tools.ts +239 -0
- package/src/mcp/tools/credential-mcp.tools.ts +81 -0
- package/src/mcp/tools/hexabot-mcp-tool.base.ts +74 -0
- package/src/mcp/tools/hexabot-mcp.schemas.ts +55 -0
- package/src/mcp/tools/hexabot-mcp.tools.ts +1 -1194
- package/src/mcp/tools/hexabot-mcp.utils.ts +13 -0
- package/src/mcp/tools/index.ts +51 -0
- package/src/mcp/tools/mcp-server-mcp.tools.ts +135 -0
- package/src/mcp/tools/memory-definition-mcp.tools.ts +125 -0
- package/src/mcp/tools/workflow-mcp.helper.ts +166 -0
- package/src/mcp/tools/workflow-mcp.tools.ts +254 -0
- package/src/mcp/tools/workflow-run-mcp.tools.ts +274 -0
- package/src/mcp/tools/workflow-version-mcp.tools.ts +226 -0
- package/src/workflow/services/workflow.service.ts +49 -29
|
@@ -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
|
+
}
|
|
@@ -208,57 +208,77 @@ export class WorkflowService extends BaseOrmService<WorkflowOrmEntity> {
|
|
|
208
208
|
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
|
-
const { initiatorId, workflowId, threadId } = workflowRun
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
+
workflowId,
|
|
236
|
+
initiatorId,
|
|
237
|
+
threadId: typeof threadId === 'string' ? threadId : undefined,
|
|
238
|
+
workflowEvent: workflowEvent.replace('hook:', ''),
|
|
239
|
+
});
|
|
228
240
|
}
|
|
229
241
|
|
|
230
242
|
@OnEvent('hook:workflow:start')
|
|
231
|
-
sendWorkflowStart(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
|
|
232
|
-
this.sendWorkflowEvent('hook:workflow:start', payload);
|
|
243
|
+
async sendWorkflowStart(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
|
|
244
|
+
await this.sendWorkflowEvent('hook:workflow:start', payload);
|
|
233
245
|
}
|
|
234
246
|
|
|
235
247
|
@OnEvent('hook:workflow:finish')
|
|
236
|
-
sendWorkflowFinish(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
|
|
237
|
-
this.sendWorkflowEvent('hook:workflow:finish', payload);
|
|
248
|
+
async sendWorkflowFinish(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
|
|
249
|
+
await this.sendWorkflowEvent('hook:workflow:finish', payload);
|
|
238
250
|
}
|
|
239
251
|
|
|
240
252
|
@OnEvent('hook:workflow:failure')
|
|
241
|
-
sendWorkflowFailure(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
|
|
242
|
-
this.sendWorkflowEvent('hook:workflow:failure', payload);
|
|
253
|
+
async sendWorkflowFailure(payload: WorkflowEventMap[keyof WorkflowEventMap]) {
|
|
254
|
+
await this.sendWorkflowEvent('hook:workflow:failure', payload);
|
|
243
255
|
}
|
|
244
256
|
|
|
245
257
|
@OnEvent('hook:step:start')
|
|
246
|
-
sendWorkflowStepStart(
|
|
247
|
-
|
|
258
|
+
async sendWorkflowStepStart(
|
|
259
|
+
payload: WorkflowEventMap[keyof WorkflowEventMap],
|
|
260
|
+
) {
|
|
261
|
+
await this.sendWorkflowEvent('hook:step:start', payload);
|
|
248
262
|
}
|
|
249
263
|
|
|
250
264
|
@OnEvent('hook:step:suspended')
|
|
251
|
-
sendWorkflowStepSuspended(
|
|
252
|
-
|
|
265
|
+
async sendWorkflowStepSuspended(
|
|
266
|
+
payload: WorkflowEventMap[keyof WorkflowEventMap],
|
|
267
|
+
) {
|
|
268
|
+
await this.sendWorkflowEvent('hook:step:suspended', payload);
|
|
253
269
|
}
|
|
254
270
|
|
|
255
271
|
@OnEvent('hook:step:success')
|
|
256
|
-
sendWorkflowStepSuccess(
|
|
257
|
-
|
|
272
|
+
async sendWorkflowStepSuccess(
|
|
273
|
+
payload: WorkflowEventMap[keyof WorkflowEventMap],
|
|
274
|
+
) {
|
|
275
|
+
await this.sendWorkflowEvent('hook:step:success', payload);
|
|
258
276
|
}
|
|
259
277
|
|
|
260
278
|
@OnEvent('hook:step:error')
|
|
261
|
-
sendWorkflowStepError(
|
|
262
|
-
|
|
279
|
+
async sendWorkflowStepError(
|
|
280
|
+
payload: WorkflowEventMap[keyof WorkflowEventMap],
|
|
281
|
+
) {
|
|
282
|
+
await this.sendWorkflowEvent('hook:step:error', payload);
|
|
263
283
|
}
|
|
264
284
|
}
|