@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
|
@@ -24,11 +24,11 @@ export declare class WorkflowService extends BaseOrmService<WorkflowOrmEntity> {
|
|
|
24
24
|
subscribe: `Workflow_${string}`;
|
|
25
25
|
}>;
|
|
26
26
|
private sendWorkflowEvent;
|
|
27
|
-
sendWorkflowStart(payload: WorkflowEventMap[keyof WorkflowEventMap]): void
|
|
28
|
-
sendWorkflowFinish(payload: WorkflowEventMap[keyof WorkflowEventMap]): void
|
|
29
|
-
sendWorkflowFailure(payload: WorkflowEventMap[keyof WorkflowEventMap]): void
|
|
30
|
-
sendWorkflowStepStart(payload: WorkflowEventMap[keyof WorkflowEventMap]): void
|
|
31
|
-
sendWorkflowStepSuspended(payload: WorkflowEventMap[keyof WorkflowEventMap]): void
|
|
32
|
-
sendWorkflowStepSuccess(payload: WorkflowEventMap[keyof WorkflowEventMap]): void
|
|
33
|
-
sendWorkflowStepError(payload: WorkflowEventMap[keyof WorkflowEventMap]): void
|
|
27
|
+
sendWorkflowStart(payload: WorkflowEventMap[keyof WorkflowEventMap]): Promise<void>;
|
|
28
|
+
sendWorkflowFinish(payload: WorkflowEventMap[keyof WorkflowEventMap]): Promise<void>;
|
|
29
|
+
sendWorkflowFailure(payload: WorkflowEventMap[keyof WorkflowEventMap]): Promise<void>;
|
|
30
|
+
sendWorkflowStepStart(payload: WorkflowEventMap[keyof WorkflowEventMap]): Promise<void>;
|
|
31
|
+
sendWorkflowStepSuspended(payload: WorkflowEventMap[keyof WorkflowEventMap]): Promise<void>;
|
|
32
|
+
sendWorkflowStepSuccess(payload: WorkflowEventMap[keyof WorkflowEventMap]): Promise<void>;
|
|
33
|
+
sendWorkflowStepError(payload: WorkflowEventMap[keyof WorkflowEventMap]): Promise<void>;
|
|
34
34
|
}
|
|
@@ -20,7 +20,6 @@ const base_orm_service_1 = require("../../utils/generics/base-orm.service");
|
|
|
20
20
|
const websocket_1 = require("../../websocket");
|
|
21
21
|
const workflow_entity_1 = require("../entities/workflow.entity");
|
|
22
22
|
const workflow_repository_1 = require("../repositories/workflow.repository");
|
|
23
|
-
const types_1 = require("../types");
|
|
24
23
|
const workflow_run_service_1 = require("./workflow-run.service");
|
|
25
24
|
let WorkflowService = class WorkflowService extends base_orm_service_1.BaseOrmService {
|
|
26
25
|
constructor(repository, gateway, workflowRunService) {
|
|
@@ -110,42 +109,48 @@ let WorkflowService = class WorkflowService extends base_orm_service_1.BaseOrmSe
|
|
|
110
109
|
this.logger.error('workflowRun context is required');
|
|
111
110
|
return;
|
|
112
111
|
}
|
|
113
|
-
const { initiatorId, workflowId, threadId } = workflowRun
|
|
112
|
+
const { initiatorId, workflowId, threadId } = workflowRun.context;
|
|
113
|
+
if (typeof initiatorId !== 'string' ||
|
|
114
|
+
!initiatorId ||
|
|
115
|
+
typeof workflowId !== 'string' ||
|
|
116
|
+
!workflowId) {
|
|
117
|
+
this.logger.error('workflowRun context requires initiatorId and workflowId');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
114
120
|
const workflow = await this.findOne(workflowId);
|
|
115
|
-
|
|
116
|
-
workflow
|
|
117
|
-
|
|
118
|
-
if (canBroadcastEvents) {
|
|
119
|
-
this.gateway.broadcastWorkflowEvent({
|
|
120
|
-
...payload,
|
|
121
|
-
t,
|
|
122
|
-
workflowId,
|
|
123
|
-
initiatorId,
|
|
124
|
-
threadId: typeof threadId === 'string' ? threadId : undefined,
|
|
125
|
-
workflowEvent: workflowEvent.replace('hook:', ''),
|
|
126
|
-
});
|
|
121
|
+
if (!workflow?.type) {
|
|
122
|
+
this.logger.error('workflow is required');
|
|
123
|
+
return;
|
|
127
124
|
}
|
|
125
|
+
this.gateway.broadcastWorkflowEvent({
|
|
126
|
+
...payload,
|
|
127
|
+
t,
|
|
128
|
+
workflowId,
|
|
129
|
+
initiatorId,
|
|
130
|
+
threadId: typeof threadId === 'string' ? threadId : undefined,
|
|
131
|
+
workflowEvent: workflowEvent.replace('hook:', ''),
|
|
132
|
+
});
|
|
128
133
|
}
|
|
129
|
-
sendWorkflowStart(payload) {
|
|
130
|
-
this.sendWorkflowEvent('hook:workflow:start', payload);
|
|
134
|
+
async sendWorkflowStart(payload) {
|
|
135
|
+
await this.sendWorkflowEvent('hook:workflow:start', payload);
|
|
131
136
|
}
|
|
132
|
-
sendWorkflowFinish(payload) {
|
|
133
|
-
this.sendWorkflowEvent('hook:workflow:finish', payload);
|
|
137
|
+
async sendWorkflowFinish(payload) {
|
|
138
|
+
await this.sendWorkflowEvent('hook:workflow:finish', payload);
|
|
134
139
|
}
|
|
135
|
-
sendWorkflowFailure(payload) {
|
|
136
|
-
this.sendWorkflowEvent('hook:workflow:failure', payload);
|
|
140
|
+
async sendWorkflowFailure(payload) {
|
|
141
|
+
await this.sendWorkflowEvent('hook:workflow:failure', payload);
|
|
137
142
|
}
|
|
138
|
-
sendWorkflowStepStart(payload) {
|
|
139
|
-
this.sendWorkflowEvent('hook:step:start', payload);
|
|
143
|
+
async sendWorkflowStepStart(payload) {
|
|
144
|
+
await this.sendWorkflowEvent('hook:step:start', payload);
|
|
140
145
|
}
|
|
141
|
-
sendWorkflowStepSuspended(payload) {
|
|
142
|
-
this.sendWorkflowEvent('hook:step:suspended', payload);
|
|
146
|
+
async sendWorkflowStepSuspended(payload) {
|
|
147
|
+
await this.sendWorkflowEvent('hook:step:suspended', payload);
|
|
143
148
|
}
|
|
144
|
-
sendWorkflowStepSuccess(payload) {
|
|
145
|
-
this.sendWorkflowEvent('hook:step:success', payload);
|
|
149
|
+
async sendWorkflowStepSuccess(payload) {
|
|
150
|
+
await this.sendWorkflowEvent('hook:step:success', payload);
|
|
146
151
|
}
|
|
147
|
-
sendWorkflowStepError(payload) {
|
|
148
|
-
this.sendWorkflowEvent('hook:step:error', payload);
|
|
152
|
+
async sendWorkflowStepError(payload) {
|
|
153
|
+
await this.sendWorkflowEvent('hook:step:error', payload);
|
|
149
154
|
}
|
|
150
155
|
};
|
|
151
156
|
exports.WorkflowService = WorkflowService;
|
|
@@ -163,43 +168,43 @@ __decorate([
|
|
|
163
168
|
(0, event_emitter_1.OnEvent)('hook:workflow:start'),
|
|
164
169
|
__metadata("design:type", Function),
|
|
165
170
|
__metadata("design:paramtypes", [Object]),
|
|
166
|
-
__metadata("design:returntype",
|
|
171
|
+
__metadata("design:returntype", Promise)
|
|
167
172
|
], WorkflowService.prototype, "sendWorkflowStart", null);
|
|
168
173
|
__decorate([
|
|
169
174
|
(0, event_emitter_1.OnEvent)('hook:workflow:finish'),
|
|
170
175
|
__metadata("design:type", Function),
|
|
171
176
|
__metadata("design:paramtypes", [Object]),
|
|
172
|
-
__metadata("design:returntype",
|
|
177
|
+
__metadata("design:returntype", Promise)
|
|
173
178
|
], WorkflowService.prototype, "sendWorkflowFinish", null);
|
|
174
179
|
__decorate([
|
|
175
180
|
(0, event_emitter_1.OnEvent)('hook:workflow:failure'),
|
|
176
181
|
__metadata("design:type", Function),
|
|
177
182
|
__metadata("design:paramtypes", [Object]),
|
|
178
|
-
__metadata("design:returntype",
|
|
183
|
+
__metadata("design:returntype", Promise)
|
|
179
184
|
], WorkflowService.prototype, "sendWorkflowFailure", null);
|
|
180
185
|
__decorate([
|
|
181
186
|
(0, event_emitter_1.OnEvent)('hook:step:start'),
|
|
182
187
|
__metadata("design:type", Function),
|
|
183
188
|
__metadata("design:paramtypes", [Object]),
|
|
184
|
-
__metadata("design:returntype",
|
|
189
|
+
__metadata("design:returntype", Promise)
|
|
185
190
|
], WorkflowService.prototype, "sendWorkflowStepStart", null);
|
|
186
191
|
__decorate([
|
|
187
192
|
(0, event_emitter_1.OnEvent)('hook:step:suspended'),
|
|
188
193
|
__metadata("design:type", Function),
|
|
189
194
|
__metadata("design:paramtypes", [Object]),
|
|
190
|
-
__metadata("design:returntype",
|
|
195
|
+
__metadata("design:returntype", Promise)
|
|
191
196
|
], WorkflowService.prototype, "sendWorkflowStepSuspended", null);
|
|
192
197
|
__decorate([
|
|
193
198
|
(0, event_emitter_1.OnEvent)('hook:step:success'),
|
|
194
199
|
__metadata("design:type", Function),
|
|
195
200
|
__metadata("design:paramtypes", [Object]),
|
|
196
|
-
__metadata("design:returntype",
|
|
201
|
+
__metadata("design:returntype", Promise)
|
|
197
202
|
], WorkflowService.prototype, "sendWorkflowStepSuccess", null);
|
|
198
203
|
__decorate([
|
|
199
204
|
(0, event_emitter_1.OnEvent)('hook:step:error'),
|
|
200
205
|
__metadata("design:type", Function),
|
|
201
206
|
__metadata("design:paramtypes", [Object]),
|
|
202
|
-
__metadata("design:returntype",
|
|
207
|
+
__metadata("design:returntype", Promise)
|
|
203
208
|
], WorkflowService.prototype, "sendWorkflowStepError", null);
|
|
204
209
|
exports.WorkflowService = WorkflowService = __decorate([
|
|
205
210
|
(0, common_1.Injectable)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.service.js","sourceRoot":"","sources":["../../../src/workflow/services/workflow.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAQA,2CAIwB;AACxB,yDAA8D;AAE9D,6BAAiC;AAGjC,4EAAmE;AAEnE,+CASqB;AAGrB,iEAAgE;AAChE,6EAAyE;
|
|
1
|
+
{"version":3,"file":"workflow.service.js","sourceRoot":"","sources":["../../../src/workflow/services/workflow.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAQA,2CAIwB;AACxB,yDAA8D;AAE9D,6BAAiC;AAGjC,4EAAmE;AAEnE,+CASqB;AAGrB,iEAAgE;AAChE,6EAAyE;AAGzE,iEAA4D;AAGrD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,iCAAiC;IAYpE,YACW,UAA8B,EACtB,OAAyB,EACzB,kBAAsC;QAEvD,KAAK,CAAC,UAAU,CAAC,CAAC;QAJT,eAAU,GAAV,UAAU,CAAoB;QACtB,YAAO,GAAP,OAAO,CAAkB;QACzB,uBAA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BAAU,EAAC,sBAAsB,CAAC;IAEhC,WAAA,IAAA,qBAAS,GAAE,CAAA;IACX,WAAA,IAAA,qBAAS,GAAE,CAAA;;qCADM,yBAAa;QACb,0BAAc;;gDAiBjC;AAmDK;IADL,IAAA,uBAAO,EAAC,qBAAqB,CAAC;;;;wDAG9B;AAGK;IADL,IAAA,uBAAO,EAAC,sBAAsB,CAAC;;;;yDAG/B;AAGK;IADL,IAAA,uBAAO,EAAC,uBAAuB,CAAC;;;;0DAGhC;AAGK;IADL,IAAA,uBAAO,EAAC,iBAAiB,CAAC;;;;4DAK1B;AAGK;IADL,IAAA,uBAAO,EAAC,qBAAqB,CAAC;;;;gEAK9B;AAGK;IADL,IAAA,uBAAO,EAAC,mBAAmB,CAAC;;;;8DAK5B;AAGK;IADL,IAAA,uBAAO,EAAC,iBAAiB,CAAC;;;;4DAK1B;0BAnPU,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAcY,wCAAkB;QACb,4BAAgB;QACL,yCAAkB;GAf9C,eAAe,CAoP3B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hexabot-ai/api",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.2.2-alpha.
|
|
4
|
+
"version": "3.2.2-alpha.15",
|
|
5
5
|
"description": "Hexabot is a solution for creating and managing chatbots across multiple channels, leveraging AI for advanced conversational capabilities. It provides a user-friendly interface for building, training, and deploying chatbots with integrated support for various messaging platforms.",
|
|
6
6
|
"author": "Hexastack",
|
|
7
7
|
"license": "FCL-1.0-ALv2",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"typeorm": "^0.3.28",
|
|
93
93
|
"yaml": "^2.8.3",
|
|
94
94
|
"zod": "^4.3.6",
|
|
95
|
-
"@hexabot-ai/agentic": "3.1.2-alpha.
|
|
96
|
-
"@hexabot-ai/types": "3.0.2-alpha.
|
|
95
|
+
"@hexabot-ai/agentic": "3.1.2-alpha.15",
|
|
96
|
+
"@hexabot-ai/types": "3.0.2-alpha.15"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@compodoc/compodoc": "^1.1.31",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"tsconfig-paths": "^4.2.0",
|
|
145
145
|
"tsconfig-paths-jest": "^0.0.1",
|
|
146
146
|
"typescript": "^5.1.3",
|
|
147
|
-
"@hexabot-ai/frontend": "3.2.2-alpha.
|
|
147
|
+
"@hexabot-ai/frontend": "3.2.2-alpha.15"
|
|
148
148
|
},
|
|
149
149
|
"optionalDependencies": {
|
|
150
150
|
"@css-inline/css-inline-linux-arm64-musl": "^0.14.1",
|
package/src/mcp/README.md
CHANGED
|
@@ -145,17 +145,24 @@ client, but the effective configuration should be equivalent to:
|
|
|
145
145
|
| --- | --- | --- |
|
|
146
146
|
| `hexabot_workflow_search` | `workflow:read` | Search workflows by metadata. |
|
|
147
147
|
| `hexabot_workflow_get` | `workflow:read` | Read one workflow with populated version metadata. |
|
|
148
|
+
| `hexabot_workflow_version_status` | `workflow:read` | Check current and published version pointers for one workflow. |
|
|
148
149
|
| `hexabot_workflow_create` | `workflow:create` | Create a workflow and optionally commit initial YAML. |
|
|
149
150
|
| `hexabot_workflow_update` | `workflow:update` | Update workflow metadata and optionally commit YAML. |
|
|
150
151
|
| `hexabot_workflow_yaml_validate` | `workflow:read` | Validate workflow definition YAML without creating a version. |
|
|
151
152
|
| `hexabot_workflow_yaml_commit` | `workflowversion:create` | Validate and commit workflow definition YAML. |
|
|
153
|
+
| `hexabot_workflow_rollback` | `workflowversion:create` | Roll back to a previous version by creating a new restore snapshot. |
|
|
152
154
|
| `hexabot_workflow_publish` | `workflow:update` | Publish the current workflow version. |
|
|
153
155
|
| `hexabot_workflow_unpublish` | `workflow:update` | Clear the published workflow version. |
|
|
154
156
|
| `hexabot_workflow_run` | `workflowrun:create` | Run a manual or scheduled workflow and return the run summary. |
|
|
155
157
|
|
|
156
158
|
Workflow YAML is validated with `parseWorkflowDefinition()` before a version is
|
|
157
159
|
created. Coding agents can call `hexabot_workflow_yaml_validate` first to get
|
|
158
|
-
structured validation errors without mutating workflow state.
|
|
160
|
+
structured validation errors without mutating workflow state. Commits inherit
|
|
161
|
+
the workflow's current version as their parent unless `parentVersion` is
|
|
162
|
+
explicitly supplied. `hexabot_workflow_rollback` and
|
|
163
|
+
`hexabot_workflow_version_restore` both create a new current restore snapshot;
|
|
164
|
+
publish that snapshot with `hexabot_workflow_publish` when it should become the
|
|
165
|
+
published version.
|
|
159
166
|
|
|
160
167
|
### Workflow versions and runs
|
|
161
168
|
|
|
@@ -167,6 +174,7 @@ structured validation errors without mutating workflow state.
|
|
|
167
174
|
| `hexabot_workflow_version_restore` | `workflowversion:create` | Restore a previous version by creating a new snapshot. |
|
|
168
175
|
| `hexabot_workflow_run_search` | `workflowrun:read` | Search workflow runs by workflow and status. |
|
|
169
176
|
| `hexabot_workflow_run_get` | `workflowrun:read` | Read one workflow run with populated workflow metadata. |
|
|
177
|
+
| `hexabot_workflow_run_debug` | `workflowrun:read` | Inspect one workflow run with execution state, workflow YAML, and parent/child run context for troubleshooting. |
|
|
170
178
|
|
|
171
179
|
### Memory definitions
|
|
172
180
|
|
|
@@ -222,7 +230,9 @@ value.
|
|
|
222
230
|
|
|
223
231
|
## Extending the MCP module
|
|
224
232
|
|
|
225
|
-
Add new tools in `tools
|
|
233
|
+
Add new tools in the focused provider file under `tools/` that matches the
|
|
234
|
+
domain, or create a new `*-mcp.tools.ts` provider when the domain is new. Export
|
|
235
|
+
and register new providers through `tools/index.ts`.
|
|
226
236
|
|
|
227
237
|
Each tool should:
|
|
228
238
|
|
|
@@ -23,7 +23,7 @@ import { HexabotMcpTokenGuard } from './guards/hexabot-mcp-token.guard';
|
|
|
23
23
|
import { McpPermissionGuard } from './guards/mcp-permission.guard';
|
|
24
24
|
import { McpTokenRepository } from './repositories/mcp-token.repository';
|
|
25
25
|
import { McpTokenService } from './services/mcp-token.service';
|
|
26
|
-
import {
|
|
26
|
+
import { HEXABOT_MCP_TOOL_PROVIDERS } from './tools';
|
|
27
27
|
|
|
28
28
|
@Module({
|
|
29
29
|
imports: [
|
|
@@ -54,7 +54,7 @@ import { HexabotMcpTools } from './tools/hexabot-mcp.tools';
|
|
|
54
54
|
McpPermissionGuard,
|
|
55
55
|
McpTokenRepository,
|
|
56
56
|
McpTokenService,
|
|
57
|
-
|
|
57
|
+
...HEXABOT_MCP_TOOL_PROVIDERS,
|
|
58
58
|
],
|
|
59
59
|
controllers: [McpTokenController],
|
|
60
60
|
})
|
|
@@ -0,0 +1,122 @@
|
|
|
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 { Action } from '@hexabot-ai/types';
|
|
8
|
+
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
9
|
+
import { Tool, ToolGuards } from '@rekog/mcp-nest';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
|
|
12
|
+
import { ActionService } from '@/actions/actions.service';
|
|
13
|
+
import { RuntimeBindingsService } from '@/bindings/runtime-bindings.service';
|
|
14
|
+
import { WorkflowType } from '@/workflow/types';
|
|
15
|
+
|
|
16
|
+
import { McpPermission } from '../decorators/mcp-permission.decorator';
|
|
17
|
+
import { McpPermissionGuard } from '../guards/mcp-permission.guard';
|
|
18
|
+
|
|
19
|
+
@Injectable()
|
|
20
|
+
export class HexabotCatalogMcpTools {
|
|
21
|
+
constructor(
|
|
22
|
+
private readonly actionService: ActionService,
|
|
23
|
+
private readonly runtimeBindingsService: RuntimeBindingsService,
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
@McpPermission('workflow', Action.READ)
|
|
27
|
+
@ToolGuards([McpPermissionGuard])
|
|
28
|
+
@Tool({
|
|
29
|
+
name: 'hexabot_action_search',
|
|
30
|
+
description: 'Search available workflow actions and their schemas.',
|
|
31
|
+
parameters: z.object({
|
|
32
|
+
query: z.string().optional(),
|
|
33
|
+
workflowType: z.enum(WorkflowType).optional(),
|
|
34
|
+
}),
|
|
35
|
+
})
|
|
36
|
+
async searchActions(args: { query?: string; workflowType?: WorkflowType }) {
|
|
37
|
+
const query = args.query?.toLowerCase();
|
|
38
|
+
const actions = this.actionService.getAllSchemaDefinitions(
|
|
39
|
+
args.workflowType,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
items: query
|
|
44
|
+
? actions.filter((action) =>
|
|
45
|
+
[
|
|
46
|
+
action.name,
|
|
47
|
+
action.description,
|
|
48
|
+
action.group,
|
|
49
|
+
...(action.workflowTypes ?? []),
|
|
50
|
+
]
|
|
51
|
+
.filter(Boolean)
|
|
52
|
+
.some((value) => `${value}`.toLowerCase().includes(query)),
|
|
53
|
+
)
|
|
54
|
+
: actions,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@McpPermission('workflow', Action.READ)
|
|
59
|
+
@ToolGuards([McpPermissionGuard])
|
|
60
|
+
@Tool({
|
|
61
|
+
name: 'hexabot_action_get',
|
|
62
|
+
description: 'Read schema metadata for one workflow action.',
|
|
63
|
+
parameters: z.object({
|
|
64
|
+
name: z.string().min(1),
|
|
65
|
+
}),
|
|
66
|
+
})
|
|
67
|
+
async getAction(args: { name: string }) {
|
|
68
|
+
const action = this.actionService
|
|
69
|
+
.getAllSchemaDefinitions()
|
|
70
|
+
.find((entry) => entry.name === args.name);
|
|
71
|
+
if (!action) {
|
|
72
|
+
throw new NotFoundException(`Action ${args.name} not found`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return action;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@McpPermission('workflow', Action.READ)
|
|
79
|
+
@ToolGuards([McpPermissionGuard])
|
|
80
|
+
@Tool({
|
|
81
|
+
name: 'hexabot_binding_search',
|
|
82
|
+
description: 'Search workflow runtime binding kind schemas.',
|
|
83
|
+
parameters: z.object({
|
|
84
|
+
query: z.string().optional(),
|
|
85
|
+
}),
|
|
86
|
+
})
|
|
87
|
+
async searchBindings(args: { query?: string }) {
|
|
88
|
+
const query = args.query?.toLowerCase();
|
|
89
|
+
const entries = Object.entries(
|
|
90
|
+
this.runtimeBindingsService.getAllSchemaDefinitions(),
|
|
91
|
+
).map(([kind, definition]) => ({ kind, ...definition }));
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
items: query
|
|
95
|
+
? entries.filter((entry) =>
|
|
96
|
+
[entry.kind, entry.icon, entry.color]
|
|
97
|
+
.filter(Boolean)
|
|
98
|
+
.some((value) => `${value}`.toLowerCase().includes(query)),
|
|
99
|
+
)
|
|
100
|
+
: entries,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@McpPermission('workflow', Action.READ)
|
|
105
|
+
@ToolGuards([McpPermissionGuard])
|
|
106
|
+
@Tool({
|
|
107
|
+
name: 'hexabot_binding_get',
|
|
108
|
+
description: 'Read schema metadata for one workflow runtime binding kind.',
|
|
109
|
+
parameters: z.object({
|
|
110
|
+
kind: z.string().min(1),
|
|
111
|
+
}),
|
|
112
|
+
})
|
|
113
|
+
async getBinding(args: { kind: string }) {
|
|
114
|
+
const bindings = this.runtimeBindingsService.getAllSchemaDefinitions();
|
|
115
|
+
const binding = bindings[args.kind];
|
|
116
|
+
if (!binding) {
|
|
117
|
+
throw new NotFoundException(`Binding kind ${args.kind} not found`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return { kind: args.kind, ...binding };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
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 { Action } from '@hexabot-ai/types';
|
|
8
|
+
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
9
|
+
import { Tool, ToolGuards } from '@rekog/mcp-nest';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
|
|
12
|
+
import { ContentTypeOrmEntity } from '@/cms/entities/content-type.entity';
|
|
13
|
+
import { ContentOrmEntity } from '@/cms/entities/content.entity';
|
|
14
|
+
import { ContentTypeService } from '@/cms/services/content-type.service';
|
|
15
|
+
import { ContentService } from '@/cms/services/content.service';
|
|
16
|
+
|
|
17
|
+
import { McpPermission } from '../decorators/mcp-permission.decorator';
|
|
18
|
+
import { McpPermissionGuard } from '../guards/mcp-permission.guard';
|
|
19
|
+
|
|
20
|
+
import { HexabotMcpToolBase } from './hexabot-mcp-tool.base';
|
|
21
|
+
import {
|
|
22
|
+
jsonObjectSchema,
|
|
23
|
+
PaginationArgs,
|
|
24
|
+
paginationSchema,
|
|
25
|
+
uuidSchema,
|
|
26
|
+
} from './hexabot-mcp.schemas';
|
|
27
|
+
|
|
28
|
+
@Injectable()
|
|
29
|
+
export class HexabotCmsMcpTools extends HexabotMcpToolBase {
|
|
30
|
+
constructor(
|
|
31
|
+
private readonly contentTypeService: ContentTypeService,
|
|
32
|
+
private readonly contentService: ContentService,
|
|
33
|
+
) {
|
|
34
|
+
super();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@McpPermission('contenttype', Action.READ)
|
|
38
|
+
@ToolGuards([McpPermissionGuard])
|
|
39
|
+
@Tool({
|
|
40
|
+
name: 'hexabot_content_type_search',
|
|
41
|
+
description: 'Search CMS content types.',
|
|
42
|
+
parameters: z.object({
|
|
43
|
+
query: z.string().optional(),
|
|
44
|
+
...paginationSchema,
|
|
45
|
+
}),
|
|
46
|
+
})
|
|
47
|
+
async searchContentTypes(args: { query?: string } & PaginationArgs) {
|
|
48
|
+
const where = args.query ? { name: this.contains(args.query) } : {};
|
|
49
|
+
|
|
50
|
+
return await this.listWithCount(
|
|
51
|
+
this.contentTypeService,
|
|
52
|
+
this.findOptions<ContentTypeOrmEntity>(args, where),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@McpPermission('contenttype', Action.READ)
|
|
57
|
+
@ToolGuards([McpPermissionGuard])
|
|
58
|
+
@Tool({
|
|
59
|
+
name: 'hexabot_content_type_get',
|
|
60
|
+
description: 'Read one CMS content type.',
|
|
61
|
+
parameters: z.object({
|
|
62
|
+
id: uuidSchema,
|
|
63
|
+
}),
|
|
64
|
+
})
|
|
65
|
+
async getContentType(args: { id: string }) {
|
|
66
|
+
const contentType = await this.contentTypeService.findOne(args.id);
|
|
67
|
+
if (!contentType) {
|
|
68
|
+
throw new NotFoundException(`Content type ${args.id} not found`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return contentType;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@McpPermission('contenttype', Action.CREATE)
|
|
75
|
+
@ToolGuards([McpPermissionGuard])
|
|
76
|
+
@Tool({
|
|
77
|
+
name: 'hexabot_content_type_create',
|
|
78
|
+
description: 'Create a CMS content type.',
|
|
79
|
+
parameters: z.object({
|
|
80
|
+
name: z.string().min(1),
|
|
81
|
+
schema: jsonObjectSchema,
|
|
82
|
+
}),
|
|
83
|
+
})
|
|
84
|
+
async createContentType(args: {
|
|
85
|
+
name: string;
|
|
86
|
+
schema: Record<string, unknown>;
|
|
87
|
+
}) {
|
|
88
|
+
return await this.contentTypeService.create(args as any);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@McpPermission('contenttype', Action.UPDATE)
|
|
92
|
+
@ToolGuards([McpPermissionGuard])
|
|
93
|
+
@Tool({
|
|
94
|
+
name: 'hexabot_content_type_update',
|
|
95
|
+
description: 'Update a CMS content type.',
|
|
96
|
+
parameters: z.object({
|
|
97
|
+
id: uuidSchema,
|
|
98
|
+
name: z.string().min(1).optional(),
|
|
99
|
+
schema: jsonObjectSchema.optional(),
|
|
100
|
+
}),
|
|
101
|
+
})
|
|
102
|
+
async updateContentType(args: { id: string } & Record<string, unknown>) {
|
|
103
|
+
const { id, ...updates } = args;
|
|
104
|
+
|
|
105
|
+
return await this.contentTypeService.updateOne(id, updates as any);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@McpPermission('content', Action.READ)
|
|
109
|
+
@ToolGuards([McpPermissionGuard])
|
|
110
|
+
@Tool({
|
|
111
|
+
name: 'hexabot_content_search',
|
|
112
|
+
description: 'Search CMS content records.',
|
|
113
|
+
parameters: z.object({
|
|
114
|
+
query: z.string().optional(),
|
|
115
|
+
contentTypeId: uuidSchema.optional(),
|
|
116
|
+
status: z.boolean().optional(),
|
|
117
|
+
...paginationSchema,
|
|
118
|
+
}),
|
|
119
|
+
})
|
|
120
|
+
async searchContent(
|
|
121
|
+
args: {
|
|
122
|
+
query?: string;
|
|
123
|
+
contentTypeId?: string;
|
|
124
|
+
status?: boolean;
|
|
125
|
+
} & PaginationArgs,
|
|
126
|
+
) {
|
|
127
|
+
if (args.query) {
|
|
128
|
+
return {
|
|
129
|
+
items: await this.contentService.textSearch(args.query, {
|
|
130
|
+
status: args.status,
|
|
131
|
+
contentTypeId: args.contentTypeId,
|
|
132
|
+
limit: args.limit,
|
|
133
|
+
}),
|
|
134
|
+
limit: args.limit,
|
|
135
|
+
skip: 0,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const where = {
|
|
140
|
+
...(args.contentTypeId
|
|
141
|
+
? { contentType: { id: args.contentTypeId } }
|
|
142
|
+
: {}),
|
|
143
|
+
...(args.status !== undefined ? { status: args.status } : {}),
|
|
144
|
+
} as any;
|
|
145
|
+
|
|
146
|
+
return await this.listWithCount(
|
|
147
|
+
this.contentService,
|
|
148
|
+
this.findOptions<ContentOrmEntity>(args, where),
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@McpPermission('content', Action.READ)
|
|
153
|
+
@ToolGuards([McpPermissionGuard])
|
|
154
|
+
@Tool({
|
|
155
|
+
name: 'hexabot_content_get',
|
|
156
|
+
description: 'Read one CMS content record.',
|
|
157
|
+
parameters: z.object({
|
|
158
|
+
id: uuidSchema,
|
|
159
|
+
}),
|
|
160
|
+
})
|
|
161
|
+
async getContent(args: { id: string }) {
|
|
162
|
+
const content = await this.contentService.findOneAndPopulate(args.id);
|
|
163
|
+
if (!content) {
|
|
164
|
+
throw new NotFoundException(`Content ${args.id} not found`);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return content;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@McpPermission('content', Action.CREATE)
|
|
171
|
+
@ToolGuards([McpPermissionGuard])
|
|
172
|
+
@Tool({
|
|
173
|
+
name: 'hexabot_content_create',
|
|
174
|
+
description: 'Create a CMS content record.',
|
|
175
|
+
parameters: z.object({
|
|
176
|
+
contentType: uuidSchema,
|
|
177
|
+
title: z.string().min(1),
|
|
178
|
+
status: z.boolean().optional(),
|
|
179
|
+
properties: jsonObjectSchema.optional(),
|
|
180
|
+
}),
|
|
181
|
+
})
|
|
182
|
+
async createContent(args: {
|
|
183
|
+
contentType: string;
|
|
184
|
+
title: string;
|
|
185
|
+
status?: boolean;
|
|
186
|
+
properties?: Record<string, unknown>;
|
|
187
|
+
}) {
|
|
188
|
+
return await this.contentService.create(args as any);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@McpPermission('content', Action.UPDATE)
|
|
192
|
+
@ToolGuards([McpPermissionGuard])
|
|
193
|
+
@Tool({
|
|
194
|
+
name: 'hexabot_content_update',
|
|
195
|
+
description: 'Update a CMS content record.',
|
|
196
|
+
parameters: z.object({
|
|
197
|
+
id: uuidSchema,
|
|
198
|
+
contentType: uuidSchema.optional(),
|
|
199
|
+
title: z.string().min(1).optional(),
|
|
200
|
+
status: z.boolean().optional(),
|
|
201
|
+
properties: jsonObjectSchema.optional(),
|
|
202
|
+
}),
|
|
203
|
+
})
|
|
204
|
+
async updateContent(args: { id: string } & Record<string, unknown>) {
|
|
205
|
+
const { id, ...updates } = args;
|
|
206
|
+
|
|
207
|
+
return await this.contentService.updateOne(id, updates as any);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@McpPermission('content', Action.READ)
|
|
211
|
+
@ToolGuards([McpPermissionGuard])
|
|
212
|
+
@Tool({
|
|
213
|
+
name: 'hexabot_rag_content_search',
|
|
214
|
+
description: 'Search indexed CMS content through Hexabot RAG retrieval.',
|
|
215
|
+
parameters: z.object({
|
|
216
|
+
query: z.string().min(1),
|
|
217
|
+
mode: z.enum(['embedding', 'lexical']).optional(),
|
|
218
|
+
limit: z.number().int().min(1).max(50).default(10),
|
|
219
|
+
contentTypeId: uuidSchema.optional(),
|
|
220
|
+
includeInactive: z.boolean().optional(),
|
|
221
|
+
}),
|
|
222
|
+
})
|
|
223
|
+
async searchRagContent(args: {
|
|
224
|
+
query: string;
|
|
225
|
+
mode?: 'embedding' | 'lexical';
|
|
226
|
+
limit: number;
|
|
227
|
+
contentTypeId?: string;
|
|
228
|
+
includeInactive?: boolean;
|
|
229
|
+
}) {
|
|
230
|
+
return {
|
|
231
|
+
items: await this.contentService.retrieve(args.query, {
|
|
232
|
+
mode: args.mode,
|
|
233
|
+
limit: args.limit,
|
|
234
|
+
contentTypeId: args.contentTypeId,
|
|
235
|
+
includeInactive: args.includeInactive,
|
|
236
|
+
}),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|