n8n 2.8.3 → 2.9.1

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 (166) hide show
  1. package/dist/abstract-server.js +1 -1
  2. package/dist/abstract-server.js.map +1 -1
  3. package/dist/build.tsbuildinfo +1 -1
  4. package/dist/commands/export/workflow.d.ts +7 -0
  5. package/dist/commands/export/workflow.js +87 -14
  6. package/dist/commands/export/workflow.js.map +1 -1
  7. package/dist/commands/import/workflow.js +12 -2
  8. package/dist/commands/import/workflow.js.map +1 -1
  9. package/dist/controllers/ai.controller.js +5 -2
  10. package/dist/controllers/ai.controller.js.map +1 -1
  11. package/dist/controllers/e2e.controller.js +1 -0
  12. package/dist/controllers/e2e.controller.js.map +1 -1
  13. package/dist/controllers/security-settings.controller.js +2 -0
  14. package/dist/controllers/security-settings.controller.js.map +1 -1
  15. package/dist/credentials/credentials.controller.js +2 -2
  16. package/dist/credentials/credentials.controller.js.map +1 -1
  17. package/dist/credentials/credentials.service.d.ts +9 -2
  18. package/dist/credentials/credentials.service.js +44 -5
  19. package/dist/credentials/credentials.service.js.map +1 -1
  20. package/dist/credentials/validation.d.ts +5 -1
  21. package/dist/credentials/validation.js +78 -0
  22. package/dist/credentials/validation.js.map +1 -1
  23. package/dist/eventbus/event-message-classes/abstract-event-message.js +1 -1
  24. package/dist/eventbus/event-message-classes/abstract-event-message.js.map +1 -1
  25. package/dist/eventbus/event-message-classes/index.d.ts +2 -2
  26. package/dist/eventbus/event-message-classes/index.js +5 -0
  27. package/dist/eventbus/event-message-classes/index.js.map +1 -1
  28. package/dist/events/maps/relay.event-map.d.ts +36 -0
  29. package/dist/events/relays/log-streaming.event-relay.d.ts +5 -0
  30. package/dist/events/relays/log-streaming.event-relay.js +35 -0
  31. package/dist/events/relays/log-streaming.event-relay.js.map +1 -1
  32. package/dist/executions/pre-execution-checks/credentials-permission-checker.d.ts +4 -1
  33. package/dist/executions/pre-execution-checks/credentials-permission-checker.js +29 -4
  34. package/dist/executions/pre-execution-checks/credentials-permission-checker.js.map +1 -1
  35. package/dist/interfaces.d.ts +9 -2
  36. package/dist/load-nodes-and-credentials.d.ts +1 -0
  37. package/dist/load-nodes-and-credentials.js +14 -0
  38. package/dist/load-nodes-and-credentials.js.map +1 -1
  39. package/dist/modules/chat-hub/chat-hub-agent.entity.d.ts +3 -3
  40. package/dist/modules/chat-hub/chat-hub-agent.entity.js +7 -2
  41. package/dist/modules/chat-hub/chat-hub-agent.entity.js.map +1 -1
  42. package/dist/modules/chat-hub/chat-hub-agent.repository.d.ts +1 -0
  43. package/dist/modules/chat-hub/chat-hub-agent.repository.js +8 -0
  44. package/dist/modules/chat-hub/chat-hub-agent.repository.js.map +1 -1
  45. package/dist/modules/chat-hub/chat-hub-agent.service.d.ts +9 -4
  46. package/dist/modules/chat-hub/chat-hub-agent.service.js +39 -7
  47. package/dist/modules/chat-hub/chat-hub-agent.service.js.map +1 -1
  48. package/dist/modules/chat-hub/chat-hub-session.entity.d.ts +2 -3
  49. package/dist/modules/chat-hub/chat-hub-session.entity.js +7 -2
  50. package/dist/modules/chat-hub/chat-hub-session.entity.js.map +1 -1
  51. package/dist/modules/chat-hub/chat-hub-tool.entity.d.ts +23 -0
  52. package/dist/modules/chat-hub/chat-hub-tool.entity.js +54 -0
  53. package/dist/modules/chat-hub/chat-hub-tool.entity.js.map +1 -0
  54. package/dist/modules/chat-hub/chat-hub-tool.repository.d.ts +18 -0
  55. package/dist/modules/chat-hub/chat-hub-tool.repository.js +134 -0
  56. package/dist/modules/chat-hub/chat-hub-tool.repository.js.map +1 -0
  57. package/dist/modules/chat-hub/chat-hub-tool.service.d.ts +24 -0
  58. package/dist/modules/chat-hub/chat-hub-tool.service.js +119 -0
  59. package/dist/modules/chat-hub/chat-hub-tool.service.js.map +1 -0
  60. package/dist/modules/chat-hub/chat-hub-workflow.service.d.ts +3 -1
  61. package/dist/modules/chat-hub/chat-hub-workflow.service.js +6 -3
  62. package/dist/modules/chat-hub/chat-hub-workflow.service.js.map +1 -1
  63. package/dist/modules/chat-hub/chat-hub.controller.d.ts +13 -6
  64. package/dist/modules/chat-hub/chat-hub.controller.js +67 -3
  65. package/dist/modules/chat-hub/chat-hub.controller.js.map +1 -1
  66. package/dist/modules/chat-hub/chat-hub.module.d.ts +1 -1
  67. package/dist/modules/chat-hub/chat-hub.module.js +2 -1
  68. package/dist/modules/chat-hub/chat-hub.module.js.map +1 -1
  69. package/dist/modules/chat-hub/chat-hub.service.d.ts +3 -1
  70. package/dist/modules/chat-hub/chat-hub.service.js +30 -14
  71. package/dist/modules/chat-hub/chat-hub.service.js.map +1 -1
  72. package/dist/modules/chat-hub/chat-hub.settings.service.d.ts +3 -2
  73. package/dist/modules/chat-hub/chat-hub.settings.service.js +4 -4
  74. package/dist/modules/chat-hub/chat-hub.settings.service.js.map +1 -1
  75. package/dist/modules/chat-hub/chat-hub.types.d.ts +2 -3
  76. package/dist/modules/chat-hub/chat-hub.types.js.map +1 -1
  77. package/dist/modules/data-table/data-table.controller.d.ts +2 -2
  78. package/dist/modules/data-table/data-table.controller.js +4 -3
  79. package/dist/modules/data-table/data-table.controller.js.map +1 -1
  80. package/dist/modules/data-table/data-table.service.d.ts +1 -1
  81. package/dist/modules/data-table/data-table.service.js +13 -7
  82. package/dist/modules/data-table/data-table.service.js.map +1 -1
  83. package/dist/modules/external-secrets.ee/external-secrets-manager.ee.d.ts +2 -1
  84. package/dist/modules/external-secrets.ee/external-secrets-manager.ee.js +22 -7
  85. package/dist/modules/external-secrets.ee/external-secrets-manager.ee.js.map +1 -1
  86. package/dist/modules/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.js +13 -5
  87. package/dist/modules/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.js.map +1 -1
  88. package/dist/modules/external-secrets.ee/secret-provider-access-check.service.ee.d.ts +6 -0
  89. package/dist/modules/external-secrets.ee/secret-provider-access-check.service.ee.js +28 -0
  90. package/dist/modules/external-secrets.ee/secret-provider-access-check.service.ee.js.map +1 -0
  91. package/dist/modules/external-secrets.ee/secrets-cache.service.d.ts +2 -1
  92. package/dist/modules/external-secrets.ee/secrets-cache.service.js.map +1 -1
  93. package/dist/modules/external-secrets.ee/secrets-providers-connections.controller.ee.d.ts +5 -5
  94. package/dist/modules/external-secrets.ee/secrets-providers-connections.controller.ee.js +10 -10
  95. package/dist/modules/external-secrets.ee/secrets-providers-connections.controller.ee.js.map +1 -1
  96. package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.d.ts +14 -6
  97. package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.js +128 -14
  98. package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.js.map +1 -1
  99. package/dist/modules/external-secrets.ee/secrets-providers-project.controller.ee.d.ts +8 -1
  100. package/dist/modules/external-secrets.ee/secrets-providers-project.controller.ee.js +93 -1
  101. package/dist/modules/external-secrets.ee/secrets-providers-project.controller.ee.js.map +1 -1
  102. package/dist/modules/external-secrets.ee/secrets-providers.responses.ee.d.ts +2 -2
  103. package/dist/modules/mcp/mcp.event-relay.js +2 -0
  104. package/dist/modules/mcp/mcp.event-relay.js.map +1 -1
  105. package/dist/modules/quick-connect/handlers/firecrawl.handler.d.ts +8 -0
  106. package/dist/modules/quick-connect/handlers/firecrawl.handler.js +37 -0
  107. package/dist/modules/quick-connect/handlers/firecrawl.handler.js.map +1 -0
  108. package/dist/modules/quick-connect/handlers/quick-connect.handler.d.ts +3 -2
  109. package/dist/modules/quick-connect/handlers/quick-connect.handler.js.map +1 -1
  110. package/dist/modules/quick-connect/quick-connect.config.d.ts +36 -0
  111. package/dist/modules/quick-connect/quick-connect.config.js +3 -0
  112. package/dist/modules/quick-connect/quick-connect.config.js.map +1 -1
  113. package/dist/modules/quick-connect/quick-connect.module.js +2 -2
  114. package/dist/modules/quick-connect/quick-connect.module.js.map +1 -1
  115. package/dist/modules/quick-connect/quick-connect.service.d.ts +29 -0
  116. package/dist/modules/quick-connect/quick-connect.service.js +7 -3
  117. package/dist/modules/quick-connect/quick-connect.service.js.map +1 -1
  118. package/dist/modules/source-control.ee/source-control-export.service.ee.d.ts +1 -2
  119. package/dist/modules/source-control.ee/source-control-export.service.ee.js +4 -29
  120. package/dist/modules/source-control.ee/source-control-export.service.ee.js.map +1 -1
  121. package/dist/modules/source-control.ee/source-control-helper.ee.d.ts +9 -5
  122. package/dist/modules/source-control.ee/source-control-helper.ee.js +78 -3
  123. package/dist/modules/source-control.ee/source-control-helper.ee.js.map +1 -1
  124. package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +1 -1
  125. package/dist/modules/source-control.ee/source-control-import.service.ee.js +42 -28
  126. package/dist/modules/source-control.ee/source-control-import.service.ee.js.map +1 -1
  127. package/dist/modules/workflow-index/workflow-index.service.js +3 -0
  128. package/dist/modules/workflow-index/workflow-index.service.js.map +1 -1
  129. package/dist/public-api/types.d.ts +8 -0
  130. package/dist/public-api/v1/handlers/credentials/credentials.handler.js +1 -1
  131. package/dist/public-api/v1/handlers/credentials/credentials.handler.js.map +1 -1
  132. package/dist/public-api/v1/handlers/credentials/credentials.middleware.js +2 -2
  133. package/dist/public-api/v1/handlers/credentials/credentials.middleware.js.map +1 -1
  134. package/dist/public-api/v1/handlers/credentials/credentials.service.d.ts +1 -1
  135. package/dist/public-api/v1/handlers/credentials/credentials.service.js +17 -5
  136. package/dist/public-api/v1/handlers/credentials/credentials.service.js.map +1 -1
  137. package/dist/public-api/v1/handlers/executions/executions.handler.d.ts +2 -0
  138. package/dist/public-api/v1/handlers/executions/executions.handler.js +44 -0
  139. package/dist/public-api/v1/handlers/executions/executions.handler.js.map +1 -1
  140. package/dist/public-api/v1/handlers/executions/executions.service.d.ts +14 -0
  141. package/dist/public-api/v1/handlers/executions/executions.service.js +49 -0
  142. package/dist/public-api/v1/handlers/executions/executions.service.js.map +1 -0
  143. package/dist/public-api/v1/openapi.yml +65 -11
  144. package/dist/scaling/worker-server.js +1 -1
  145. package/dist/scaling/worker-server.js.map +1 -1
  146. package/dist/server.js +17 -10
  147. package/dist/server.js.map +1 -1
  148. package/dist/services/ai-workflow-builder.service.d.ts +4 -3
  149. package/dist/services/ai-workflow-builder.service.js +60 -10
  150. package/dist/services/ai-workflow-builder.service.js.map +1 -1
  151. package/dist/services/frontend.service.js +20 -13
  152. package/dist/services/frontend.service.js.map +1 -1
  153. package/dist/services/import.service.d.ts +2 -2
  154. package/dist/services/import.service.js +3 -0
  155. package/dist/services/import.service.js.map +1 -1
  156. package/dist/task-runners/task-broker/task-broker-server.js +1 -1
  157. package/dist/task-runners/task-broker/task-broker-server.js.map +1 -1
  158. package/dist/workflows/workflow-execution.service.js +3 -1
  159. package/dist/workflows/workflow-execution.service.js.map +1 -1
  160. package/dist/workflows/workflow.service.d.ts +3 -2
  161. package/dist/workflows/workflow.service.js +10 -3
  162. package/dist/workflows/workflow.service.js.map +1 -1
  163. package/package.json +25 -24
  164. package/dist/modules/quick-connect/handlers/sample.handler.d.ts +0 -7
  165. package/dist/modules/quick-connect/handlers/sample.handler.js +0 -27
  166. package/dist/modules/quick-connect/handlers/sample.handler.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { ChatHubProvider } from '@n8n/api-types';
2
2
  import { WithTimestamps, User, CredentialsEntity, WorkflowEntity } from '@n8n/db';
3
3
  import { type Relation } from '@n8n/typeorm';
4
- import type { INode } from 'n8n-workflow';
5
4
  import type { ChatHubMessage } from './chat-hub-message.entity';
6
5
  import type { ChatHubAgent } from './chat-hub-agent.entity';
6
+ import type { ChatHubTool } from './chat-hub-tool.entity';
7
7
  export interface IChatHubSession {
8
8
  id: string;
9
9
  createdAt: Date;
@@ -17,7 +17,6 @@ export interface IChatHubSession {
17
17
  workflowId: string | null;
18
18
  agentId: string | null;
19
19
  agentName: string | null;
20
- tools: INode[];
21
20
  }
22
21
  export declare class ChatHubSession extends WithTimestamps {
23
22
  id: string;
@@ -35,5 +34,5 @@ export declare class ChatHubSession extends WithTimestamps {
35
34
  agent?: Relation<ChatHubAgent> | null;
36
35
  agentName: string | null;
37
36
  messages?: Array<Relation<ChatHubMessage>>;
38
- tools: INode[];
37
+ tools?: Relation<ChatHubTool[]>;
39
38
  }
@@ -80,8 +80,13 @@ __decorate([
80
80
  __metadata("design:type", Array)
81
81
  ], ChatHubSession.prototype, "messages", void 0);
82
82
  __decorate([
83
- (0, db_1.JsonColumn)({ default: '[]' }),
84
- __metadata("design:type", Array)
83
+ (0, typeorm_1.ManyToMany)('ChatHubTool'),
84
+ (0, typeorm_1.JoinTable)({
85
+ name: 'chat_hub_session_tools',
86
+ joinColumn: { name: 'sessionId', referencedColumnName: 'id' },
87
+ inverseJoinColumn: { name: 'toolId', referencedColumnName: 'id' },
88
+ }),
89
+ __metadata("design:type", Object)
85
90
  ], ChatHubSession.prototype, "tools", void 0);
86
91
  exports.ChatHubSession = ChatHubSession = __decorate([
87
92
  (0, typeorm_1.Entity)({ name: 'chat_hub_sessions' })
@@ -1 +1 @@
1
- {"version":3,"file":"chat-hub-session.entity.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-session.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gCAOiB;AACjB,0CAQsB;AAuBf,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,mBAAc;CAqGjD,CAAA;AArGY,wCAAc;AAE1B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;0CACpB;AAOX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;6CAC3B;AAMd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACT;AAOhB;IAFC,IAAA,mBAAS,EAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC1C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;6CACT;AAOvB;IADC,IAAA,mBAAc,GAAE;8BACF,IAAI;q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,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE;KACjE,CAAC;;6CAC8B;yBAzGpB,cAAc;IAD1B,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;GACzB,cAAc,CA0G1B"}
@@ -0,0 +1,23 @@
1
+ import { User, WithTimestamps } from '@n8n/db';
2
+ import type { INode } from 'n8n-workflow';
3
+ export interface IChatHubTool {
4
+ id: string;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ name: string;
8
+ type: string;
9
+ typeVersion: number;
10
+ ownerId: string;
11
+ definition: INode;
12
+ enabled: boolean;
13
+ }
14
+ export declare class ChatHubTool extends WithTimestamps {
15
+ id: string;
16
+ name: string;
17
+ type: string;
18
+ typeVersion: number;
19
+ ownerId: string;
20
+ owner?: User;
21
+ definition: INode;
22
+ enabled: boolean;
23
+ }
@@ -0,0 +1,54 @@
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.ChatHubTool = void 0;
13
+ const db_1 = require("@n8n/db");
14
+ const typeorm_1 = require("@n8n/typeorm");
15
+ let ChatHubTool = class ChatHubTool extends db_1.WithTimestamps {
16
+ };
17
+ exports.ChatHubTool = ChatHubTool;
18
+ __decorate([
19
+ (0, typeorm_1.PrimaryColumn)('uuid'),
20
+ __metadata("design:type", String)
21
+ ], ChatHubTool.prototype, "id", void 0);
22
+ __decorate([
23
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
24
+ __metadata("design:type", String)
25
+ ], ChatHubTool.prototype, "name", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
28
+ __metadata("design:type", String)
29
+ ], ChatHubTool.prototype, "type", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ type: 'double precision' }),
32
+ __metadata("design:type", Number)
33
+ ], ChatHubTool.prototype, "typeVersion", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ type: String }),
36
+ __metadata("design:type", String)
37
+ ], ChatHubTool.prototype, "ownerId", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.ManyToOne)('User', { onDelete: 'CASCADE' }),
40
+ (0, typeorm_1.JoinColumn)({ name: 'ownerId' }),
41
+ __metadata("design:type", db_1.User)
42
+ ], ChatHubTool.prototype, "owner", void 0);
43
+ __decorate([
44
+ (0, db_1.JsonColumn)(),
45
+ __metadata("design:type", Object)
46
+ ], ChatHubTool.prototype, "definition", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ type: 'boolean', default: true }),
49
+ __metadata("design:type", Boolean)
50
+ ], ChatHubTool.prototype, "enabled", void 0);
51
+ exports.ChatHubTool = ChatHubTool = __decorate([
52
+ (0, typeorm_1.Entity)({ name: 'chat_hub_tools' })
53
+ ], ChatHubTool);
54
+ //# sourceMappingURL=chat-hub-tool.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-hub-tool.entity.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-tool.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAA2D;AAC3D,0CAAoF;AAgB7E,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,mBAAc;CA8C9C,CAAA;AA9CY,kCAAW;AAEvB;IADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;uCACX;AAMX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;yCAC5B;AAMb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;yCAC5B;AAMb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;;gDACjB;AAMpB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACT;AAOhB;IAFC,IAAA,mBAAS,EAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC1C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8BACxB,SAAI;0CAAC;AAMb;IADC,IAAA,eAAU,GAAE;;+CACK;AAMlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;4CAC1B;sBA7CL,WAAW;IADvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;GACtB,WAAW,CA8CvB"}
@@ -0,0 +1,18 @@
1
+ import { DataSource, EntityManager, Repository } from '@n8n/typeorm';
2
+ import { ChatHubTool, type IChatHubTool } from './chat-hub-tool.entity';
3
+ export declare class ChatHubToolRepository extends Repository<ChatHubTool> {
4
+ constructor(dataSource: DataSource);
5
+ createTool(tool: Partial<IChatHubTool> & Pick<IChatHubTool, 'id'>, trx?: EntityManager): Promise<ChatHubTool>;
6
+ updateTool(id: string, updates: Partial<IChatHubTool>, trx?: EntityManager): Promise<ChatHubTool>;
7
+ deleteTool(id: string, trx?: EntityManager): Promise<import("@n8n/typeorm").DeleteResult>;
8
+ getManyByUserId(userId: string): Promise<ChatHubTool[]>;
9
+ getEnabledByUserId(userId: string, trx?: EntityManager): Promise<ChatHubTool[]>;
10
+ getOneById(id: string, userId: string, trx?: EntityManager): Promise<ChatHubTool | null>;
11
+ getByIds(ids: string[], userId: string, trx?: EntityManager): Promise<ChatHubTool[]>;
12
+ getToolsForSession(sessionId: string, trx?: EntityManager): Promise<ChatHubTool[]>;
13
+ getToolsForAgent(agentId: string, trx?: EntityManager): Promise<ChatHubTool[]>;
14
+ getToolIdsForSession(sessionId: string, trx?: EntityManager): Promise<string[]>;
15
+ getToolIdsForAgent(agentId: string, trx?: EntityManager): Promise<string[]>;
16
+ setSessionTools(sessionId: string, toolIds: string[], trx?: EntityManager): Promise<void>;
17
+ setAgentTools(agentId: string, toolIds: string[], trx?: EntityManager): Promise<void>;
18
+ }
@@ -0,0 +1,134 @@
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.ChatHubToolRepository = void 0;
13
+ const di_1 = require("@n8n/di");
14
+ const typeorm_1 = require("@n8n/typeorm");
15
+ const chat_hub_agent_entity_1 = require("./chat-hub-agent.entity");
16
+ const chat_hub_session_entity_1 = require("./chat-hub-session.entity");
17
+ const chat_hub_tool_entity_1 = require("./chat-hub-tool.entity");
18
+ let ChatHubToolRepository = class ChatHubToolRepository extends typeorm_1.Repository {
19
+ constructor(dataSource) {
20
+ super(chat_hub_tool_entity_1.ChatHubTool, dataSource.manager);
21
+ }
22
+ async createTool(tool, trx) {
23
+ const em = trx ?? this.manager;
24
+ await em.insert(chat_hub_tool_entity_1.ChatHubTool, tool);
25
+ return await em.findOneOrFail(chat_hub_tool_entity_1.ChatHubTool, {
26
+ where: { id: tool.id },
27
+ });
28
+ }
29
+ async updateTool(id, updates, trx) {
30
+ const em = trx ?? this.manager;
31
+ await em.update(chat_hub_tool_entity_1.ChatHubTool, { id }, updates);
32
+ return await em.findOneOrFail(chat_hub_tool_entity_1.ChatHubTool, {
33
+ where: { id },
34
+ });
35
+ }
36
+ async deleteTool(id, trx) {
37
+ const em = trx ?? this.manager;
38
+ return await em.delete(chat_hub_tool_entity_1.ChatHubTool, { id });
39
+ }
40
+ async getManyByUserId(userId) {
41
+ return await this.find({
42
+ where: { ownerId: userId },
43
+ order: { createdAt: 'ASC' },
44
+ });
45
+ }
46
+ async getEnabledByUserId(userId, trx) {
47
+ const em = trx ?? this.manager;
48
+ return await em.find(chat_hub_tool_entity_1.ChatHubTool, {
49
+ where: { ownerId: userId, enabled: true },
50
+ order: { createdAt: 'ASC' },
51
+ });
52
+ }
53
+ async getOneById(id, userId, trx) {
54
+ const em = trx ?? this.manager;
55
+ return await em.findOne(chat_hub_tool_entity_1.ChatHubTool, {
56
+ where: { id, ownerId: userId },
57
+ });
58
+ }
59
+ async getByIds(ids, userId, trx) {
60
+ const em = trx ?? this.manager;
61
+ if (ids.length === 0)
62
+ return [];
63
+ return await em
64
+ .createQueryBuilder(chat_hub_tool_entity_1.ChatHubTool, 'tool')
65
+ .where('tool.id IN (:...ids)', { ids })
66
+ .andWhere('tool.ownerId = :userId', { userId })
67
+ .orderBy('tool.createdAt', 'ASC')
68
+ .getMany();
69
+ }
70
+ async getToolsForSession(sessionId, trx) {
71
+ const em = trx ?? this.manager;
72
+ const session = await em
73
+ .createQueryBuilder(chat_hub_session_entity_1.ChatHubSession, 'session')
74
+ .innerJoinAndSelect('session.tools', 'tool')
75
+ .where('session.id = :sessionId', { sessionId })
76
+ .orderBy('tool.createdAt', 'ASC')
77
+ .getOne();
78
+ return session?.tools ?? [];
79
+ }
80
+ async getToolsForAgent(agentId, trx) {
81
+ const em = trx ?? this.manager;
82
+ const agent = await em
83
+ .createQueryBuilder(chat_hub_agent_entity_1.ChatHubAgent, 'agent')
84
+ .innerJoinAndSelect('agent.tools', 'tool')
85
+ .where('agent.id = :agentId', { agentId })
86
+ .orderBy('tool.createdAt', 'ASC')
87
+ .getOne();
88
+ return agent?.tools ?? [];
89
+ }
90
+ async getToolIdsForSession(sessionId, trx) {
91
+ const em = trx ?? this.manager;
92
+ const rows = await em
93
+ .createQueryBuilder(chat_hub_session_entity_1.ChatHubSession, 'session')
94
+ .innerJoin('session.tools', 'tool')
95
+ .select('tool.id', 'toolId')
96
+ .where('session.id = :sessionId', { sessionId })
97
+ .getRawMany();
98
+ return rows.map((r) => r.toolId);
99
+ }
100
+ async getToolIdsForAgent(agentId, trx) {
101
+ const em = trx ?? this.manager;
102
+ const rows = await em
103
+ .createQueryBuilder(chat_hub_agent_entity_1.ChatHubAgent, 'agent')
104
+ .innerJoin('agent.tools', 'tool')
105
+ .select('tool.id', 'toolId')
106
+ .where('agent.id = :agentId', { agentId })
107
+ .getRawMany();
108
+ return rows.map((r) => r.toolId);
109
+ }
110
+ async setSessionTools(sessionId, toolIds, trx) {
111
+ const em = trx ?? this.manager;
112
+ const currentToolIds = await this.getToolIdsForSession(sessionId, em);
113
+ await em
114
+ .createQueryBuilder()
115
+ .relation(chat_hub_session_entity_1.ChatHubSession, 'tools')
116
+ .of(sessionId)
117
+ .addAndRemove(toolIds, currentToolIds);
118
+ }
119
+ async setAgentTools(agentId, toolIds, trx) {
120
+ const em = trx ?? this.manager;
121
+ const currentToolIds = await this.getToolIdsForAgent(agentId, em);
122
+ await em
123
+ .createQueryBuilder()
124
+ .relation(chat_hub_agent_entity_1.ChatHubAgent, 'tools')
125
+ .of(agentId)
126
+ .addAndRemove(toolIds, currentToolIds);
127
+ }
128
+ };
129
+ exports.ChatHubToolRepository = ChatHubToolRepository;
130
+ exports.ChatHubToolRepository = ChatHubToolRepository = __decorate([
131
+ (0, di_1.Service)(),
132
+ __metadata("design:paramtypes", [typeorm_1.DataSource])
133
+ ], ChatHubToolRepository);
134
+ //# sourceMappingURL=chat-hub-tool.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-hub-tool.repository.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-tool.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAAkC;AAClC,0CAAqE;AAErE,mEAAuD;AACvD,uEAA2D;AAC3D,iEAAwE;AAGjE,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,oBAAuB;IACjE,YAAY,UAAsB;QACjC,KAAK,CAAC,kCAAW,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAsD,EAAE,GAAmB;QAC3F,MAAM,EAAE,GAAG,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC;QAC/B,MAAM,EAAE,CAAC,MAAM,CAAC,kCAAW,EAAE,IAAI,CAAC,CAAC;QACnC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,kCAAW,EAAE;YAC1C,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE;SACtB,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,EAAE,OAA8B,EAAE,GAAmB;QAC/E,MAAM,EAAE,GAAG,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC;QAC/B,MAAM,EAAE,CAAC,MAAM,CAAC,kCAAW,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,kCAAW,EAAE;YAC1C,KAAK,EAAE,EAAE,EAAE,EAAE;SACb,CAAC,CAAC;IACJ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AAE,GAAmB;QAC1E,MAAM,EAAE,GAAG,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC;QAC/B,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAClE,MAAM,EAAE;aACN,kBAAkB,EAAE;aACpB,QAAQ,CAAC,oCAAY,EAAE,OAAO,CAAC;aAC/B,EAAE,CAAC,OAAO,CAAC;aACX,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACzC,CAAC;CACD,CAAA;AA1HY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,YAAO,GAAE;qCAEe,oBAAU;GADtB,qBAAqB,CA0HjC"}
@@ -0,0 +1,24 @@
1
+ import type { ChatHubCreateToolRequest, ChatHubUpdateToolRequest, ChatHubToolDto } from '@n8n/api-types';
2
+ import { Logger } from '@n8n/backend-common';
3
+ import { EntityManager, type User } from '@n8n/db';
4
+ import type { INode } from 'n8n-workflow';
5
+ import type { ChatHubTool } from './chat-hub-tool.entity';
6
+ import { ChatHubToolRepository } from './chat-hub-tool.repository';
7
+ export declare class ChatHubToolService {
8
+ private readonly logger;
9
+ private readonly chatToolRepository;
10
+ constructor(logger: Logger, chatToolRepository: ChatHubToolRepository);
11
+ getToolsByUserId(userId: string): Promise<ChatHubTool[]>;
12
+ getEnabledTools(userId: string, trx?: EntityManager): Promise<ChatHubTool[]>;
13
+ getToolDefinitionsForSession(sessionId: string, trx?: EntityManager): Promise<INode[]>;
14
+ getToolDefinitionsForAgent(agentId: string, trx?: EntityManager): Promise<INode[]>;
15
+ getToolIdsForSession(sessionId: string, trx?: EntityManager): Promise<string[]>;
16
+ getToolIdsForAgent(agentId: string, trx?: EntityManager): Promise<string[]>;
17
+ setSessionTools(sessionId: string, toolIds: string[], trx?: EntityManager): Promise<void>;
18
+ setAgentTools(agentId: string, toolIds: string[], trx?: EntityManager): Promise<void>;
19
+ private validateToolExpressions;
20
+ createTool(user: User, data: ChatHubCreateToolRequest): Promise<ChatHubTool>;
21
+ updateTool(id: string, user: User, updates: ChatHubUpdateToolRequest, trx?: EntityManager): Promise<ChatHubTool>;
22
+ deleteTool(id: string, userId: string, trx?: EntityManager): Promise<void>;
23
+ static toDto(tool: ChatHubTool): ChatHubToolDto;
24
+ }
@@ -0,0 +1,119 @@
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.ChatHubToolService = void 0;
13
+ const backend_common_1 = require("@n8n/backend-common");
14
+ const db_1 = require("@n8n/db");
15
+ const di_1 = require("@n8n/di");
16
+ const n8n_workflow_1 = require("n8n-workflow");
17
+ const bad_request_error_1 = require("../../errors/response-errors/bad-request.error");
18
+ const not_found_error_1 = require("../../errors/response-errors/not-found.error");
19
+ const chat_hub_tool_repository_1 = require("./chat-hub-tool.repository");
20
+ let ChatHubToolService = class ChatHubToolService {
21
+ constructor(logger, chatToolRepository) {
22
+ this.logger = logger;
23
+ this.chatToolRepository = chatToolRepository;
24
+ this.logger = this.logger.scoped('chat-hub');
25
+ }
26
+ async getToolsByUserId(userId) {
27
+ return await this.chatToolRepository.getManyByUserId(userId);
28
+ }
29
+ async getEnabledTools(userId, trx) {
30
+ return await this.chatToolRepository.getEnabledByUserId(userId, trx);
31
+ }
32
+ async getToolDefinitionsForSession(sessionId, trx) {
33
+ const tools = await this.chatToolRepository.getToolsForSession(sessionId, trx);
34
+ return tools.map((t) => t.definition);
35
+ }
36
+ async getToolDefinitionsForAgent(agentId, trx) {
37
+ const tools = await this.chatToolRepository.getToolsForAgent(agentId, trx);
38
+ return tools.map((t) => t.definition);
39
+ }
40
+ async getToolIdsForSession(sessionId, trx) {
41
+ return await this.chatToolRepository.getToolIdsForSession(sessionId, trx);
42
+ }
43
+ async getToolIdsForAgent(agentId, trx) {
44
+ return await this.chatToolRepository.getToolIdsForAgent(agentId, trx);
45
+ }
46
+ async setSessionTools(sessionId, toolIds, trx) {
47
+ await this.chatToolRepository.setSessionTools(sessionId, toolIds, trx);
48
+ }
49
+ async setAgentTools(agentId, toolIds, trx) {
50
+ await this.chatToolRepository.setAgentTools(agentId, toolIds, trx);
51
+ }
52
+ validateToolExpressions(definition) {
53
+ const violations = (0, n8n_workflow_1.findDisallowedChatToolExpressions)(definition.parameters);
54
+ if (violations.length > 0) {
55
+ const paths = violations.map((v) => v.path).join(', ');
56
+ throw new bad_request_error_1.BadRequestError(`Expressions are not supported in tool parameters (found at: ${paths}). Only $fromAI() expressions are supported.`);
57
+ }
58
+ }
59
+ async createTool(user, data) {
60
+ const definition = data.definition;
61
+ this.validateToolExpressions(definition);
62
+ const tool = await this.chatToolRepository.createTool({
63
+ id: definition.id,
64
+ name: definition.name,
65
+ type: definition.type,
66
+ typeVersion: definition.typeVersion ?? 1,
67
+ ownerId: user.id,
68
+ definition,
69
+ enabled: true,
70
+ });
71
+ this.logger.debug(`Chat hub tool created: ${tool.id} by user ${user.id}`);
72
+ return tool;
73
+ }
74
+ async updateTool(id, user, updates, trx) {
75
+ const tool = await (0, db_1.withTransaction)(this.chatToolRepository.manager, trx, async (em) => {
76
+ const existingTool = await this.chatToolRepository.getOneById(id, user.id, em);
77
+ if (!existingTool) {
78
+ throw new not_found_error_1.NotFoundError('Chat hub tool not found');
79
+ }
80
+ const updateData = {};
81
+ if (updates.definition !== undefined) {
82
+ this.validateToolExpressions(updates.definition);
83
+ updateData.definition = updates.definition;
84
+ updateData.name = updates.definition.name;
85
+ updateData.type = updates.definition.type;
86
+ updateData.typeVersion = updates.definition.typeVersion ?? 1;
87
+ }
88
+ if (updates.enabled !== undefined) {
89
+ updateData.enabled = updates.enabled;
90
+ }
91
+ return await this.chatToolRepository.updateTool(id, updateData, em);
92
+ });
93
+ this.logger.debug(`Chat hub tool updated: ${id} by user ${user.id}`);
94
+ return tool;
95
+ }
96
+ async deleteTool(id, userId, trx) {
97
+ await (0, db_1.withTransaction)(this.chatToolRepository.manager, trx, async (em) => {
98
+ const existingTool = await this.chatToolRepository.getOneById(id, userId, em);
99
+ if (!existingTool) {
100
+ throw new not_found_error_1.NotFoundError('Chat hub tool not found');
101
+ }
102
+ await this.chatToolRepository.deleteTool(id, em);
103
+ });
104
+ this.logger.debug(`Chat hub tool deleted: ${id} by user ${userId}`);
105
+ }
106
+ static toDto(tool) {
107
+ return {
108
+ definition: tool.definition,
109
+ enabled: tool.enabled,
110
+ };
111
+ }
112
+ };
113
+ exports.ChatHubToolService = ChatHubToolService;
114
+ exports.ChatHubToolService = ChatHubToolService = __decorate([
115
+ (0, di_1.Service)(),
116
+ __metadata("design:paramtypes", [backend_common_1.Logger,
117
+ chat_hub_tool_repository_1.ChatHubToolRepository])
118
+ ], ChatHubToolService);
119
+ //# sourceMappingURL=chat-hub-tool.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-hub-tool.service.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-tool.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,wDAA6C;AAC7C,gCAAoE;AACpE,gCAAkC;AAElC,+CAAiE;AAEjE,kFAA6E;AAC7E,8EAAyE;AAGzE,yEAAmE;AAG5D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC9B,YACkB,MAAc,EACd,kBAAyC;QADzC,WAAM,GAAN,MAAM,CAAQ;QACd,uBAAkB,GAA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,CAAC,0BAA0B,EAAE,YAAY,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC;IACb,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,EAAE,MAAc,EAAE,GAAmB;QAC/D,MAAM,IAAA,oBAAe,EAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YACxE,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;YAC9E,IAAI,CAAC,YAAY,EAAE,CAAC;gBACnB,MAAM,IAAI,+BAAa,CAAC,yBAAyB,CAAC,CAAC;YACpD,CAAC;YAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,EAAE,YAAY,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAiB;QAC7B,OAAO;YACN,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD,CAAA;AAzHY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,YAAO,GAAE;qCAGiB,uBAAM;QACM,gDAAqB;GAH/C,kBAAkB,CAyH9B"}
@@ -7,6 +7,7 @@ import { IExecuteData, INode, INodeCredentials, IRunExecutionData, IWorkflowBase
7
7
  import { WorkflowFinderService } from '../../workflows/workflow-finder.service';
8
8
  import { ChatHubAgentService } from './chat-hub-agent.service';
9
9
  import { ChatHubCredentialsService } from './chat-hub-credentials.service';
10
+ import { ChatHubToolService } from './chat-hub-tool.service';
10
11
  import { ChatHubAuthenticationMetadata } from './chat-hub-extractor';
11
12
  import { ChatHubMessage } from './chat-hub-message.entity';
12
13
  import { ChatHubAttachmentService } from './chat-hub.attachment.service';
@@ -20,9 +21,10 @@ export declare class ChatHubWorkflowService {
20
21
  private readonly chatHubAgentService;
21
22
  private readonly chatHubSettingsService;
22
23
  private readonly chatHubCredentialsService;
24
+ private readonly chatHubToolService;
23
25
  private readonly workflowFinderService;
24
26
  private readonly cipher;
25
- constructor(logger: Logger, workflowRepository: WorkflowRepository, sharedWorkflowRepository: SharedWorkflowRepository, chatHubAttachmentService: ChatHubAttachmentService, chatHubAgentService: ChatHubAgentService, chatHubSettingsService: ChatHubSettingsService, chatHubCredentialsService: ChatHubCredentialsService, workflowFinderService: WorkflowFinderService, cipher: Cipher);
27
+ constructor(logger: Logger, workflowRepository: WorkflowRepository, sharedWorkflowRepository: SharedWorkflowRepository, chatHubAttachmentService: ChatHubAttachmentService, chatHubAgentService: ChatHubAgentService, chatHubSettingsService: ChatHubSettingsService, chatHubCredentialsService: ChatHubCredentialsService, chatHubToolService: ChatHubToolService, workflowFinderService: WorkflowFinderService, cipher: Cipher);
26
28
  deleteChatWorkflow(workflowId: string): Promise<void>;
27
29
  createChatWorkflow(userId: string, sessionId: ChatSessionId, projectId: string, history: ChatHubMessage[], humanMessage: string, attachments: IBinaryData[], credentials: INodeCredentials, model: ChatHubBaseLLMModel, systemMessage: string | undefined, tools: INode[], timeZone: string, executionMetadata: ChatHubAuthenticationMetadata, trx?: EntityManager): Promise<{
28
30
  workflowData: IWorkflowBase;
@@ -22,6 +22,7 @@ const bad_request_error_1 = require("../../errors/response-errors/bad-request.er
22
22
  const workflow_finder_service_1 = require("../../workflows/workflow-finder.service");
23
23
  const chat_hub_agent_service_1 = require("./chat-hub-agent.service");
24
24
  const chat_hub_credentials_service_1 = require("./chat-hub-credentials.service");
25
+ const chat_hub_tool_service_1 = require("./chat-hub-tool.service");
25
26
  const chat_hub_extractor_1 = require("./chat-hub-extractor");
26
27
  const chat_hub_attachment_service_1 = require("./chat-hub.attachment.service");
27
28
  const chat_hub_constants_1 = require("./chat-hub.constants");
@@ -31,7 +32,7 @@ const context_limits_1 = require("./context-limits");
31
32
  const constants_1 = require("../../constants");
32
33
  const chat_hub_1 = require("@n8n/chat-hub");
33
34
  let ChatHubWorkflowService = class ChatHubWorkflowService {
34
- constructor(logger, workflowRepository, sharedWorkflowRepository, chatHubAttachmentService, chatHubAgentService, chatHubSettingsService, chatHubCredentialsService, workflowFinderService, cipher) {
35
+ constructor(logger, workflowRepository, sharedWorkflowRepository, chatHubAttachmentService, chatHubAgentService, chatHubSettingsService, chatHubCredentialsService, chatHubToolService, workflowFinderService, cipher) {
35
36
  this.logger = logger;
36
37
  this.workflowRepository = workflowRepository;
37
38
  this.sharedWorkflowRepository = sharedWorkflowRepository;
@@ -39,6 +40,7 @@ let ChatHubWorkflowService = class ChatHubWorkflowService {
39
40
  this.chatHubAgentService = chatHubAgentService;
40
41
  this.chatHubSettingsService = chatHubSettingsService;
41
42
  this.chatHubCredentialsService = chatHubCredentialsService;
43
+ this.chatHubToolService = chatHubToolService;
42
44
  this.workflowFinderService = workflowFinderService;
43
45
  this.cipher = cipher;
44
46
  this.logger = this.logger.scoped('chat-hub');
@@ -791,7 +793,7 @@ Respond the title only:`,
791
793
  return await this.prepareBaseChatWorkflow(user, sessionId, credentials, model, history, message, undefined, tools, attachments, timeZone, trx, executionMetadata);
792
794
  }
793
795
  async prepareBaseChatWorkflow(user, sessionId, credentials, model, history, message, systemMessage, tools, attachments, timeZone, trx, executionMetadata) {
794
- await this.chatHubSettingsService.ensureModelIsAllowed(model);
796
+ await this.chatHubSettingsService.ensureModelIsAllowed(model, trx);
795
797
  this.chatHubCredentialsService.findProviderCredential(model.provider, credentials);
796
798
  const { id: projectId } = await this.chatHubCredentialsService.findPersonalProject(user, trx);
797
799
  return await this.createChatWorkflow(user.id, sessionId, projectId, history, message, attachments, credentials, model, systemMessage, tools, timeZone, executionMetadata, trx);
@@ -820,7 +822,7 @@ Respond the title only:`,
820
822
  name: '',
821
823
  },
822
824
  };
823
- const { tools } = agent;
825
+ const tools = await this.chatHubToolService.getToolDefinitionsForAgent(agentId, trx);
824
826
  return await this.prepareBaseChatWorkflow(user, sessionId, credentials, model, history, message, systemMessage, tools, attachments, timeZone, trx, executionMetadata);
825
827
  }
826
828
  async prepareWorkflowAgentWorkflow(user, sessionId, workflowId, message, attachments, trx, executionMetadata) {
@@ -911,6 +913,7 @@ exports.ChatHubWorkflowService = ChatHubWorkflowService = __decorate([
911
913
  chat_hub_agent_service_1.ChatHubAgentService,
912
914
  chat_hub_settings_service_1.ChatHubSettingsService,
913
915
  chat_hub_credentials_service_1.ChatHubCredentialsService,
916
+ chat_hub_tool_service_1.ChatHubToolService,
914
917
  workflow_finder_service_1.WorkflowFinderService,
915
918
  n8n_core_1.Cipher])
916
919
  ], ChatHubWorkflowService);