n8n-nodes-simple 2.1.0 → 2.2.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 (135) hide show
  1. package/dist/nodes/CoreAgent/CoreAgent.node.d.ts +3 -2
  2. package/dist/nodes/CoreAgent/CoreAgent.node.js +3 -3
  3. package/dist/nodes/CoreAgent/CoreAgent.node.js.map +1 -1
  4. package/dist/nodes/CoreAgent/description.js +1 -1
  5. package/dist/nodes/CoreAgent/description.js.map +1 -1
  6. package/dist/nodes/Subagent/Subagent.node.d.ts +3 -2
  7. package/dist/nodes/Subagent/Subagent.node.js +5 -5
  8. package/dist/nodes/Subagent/Subagent.node.js.map +1 -1
  9. package/dist/nodes/Subagent/description.js +1 -1
  10. package/dist/nodes/Subagent/description.js.map +1 -1
  11. package/dist/nodes/shared/assets/gradientRobot.svg +11 -0
  12. package/dist/nodes/shared/assets/gradientRobotRed.svg +11 -0
  13. package/dist/nodes/shared/config/descriptionGenerator.d.ts +2 -0
  14. package/dist/nodes/shared/config/descriptionGenerator.js +36 -0
  15. package/dist/nodes/shared/config/descriptionGenerator.js.map +1 -0
  16. package/dist/nodes/shared/config/parameters.d.ts +26 -0
  17. package/dist/nodes/shared/config/parameters.js +35 -0
  18. package/dist/nodes/shared/config/parameters.js.map +1 -0
  19. package/dist/nodes/shared/config/properties/index.d.ts +2 -0
  20. package/dist/nodes/shared/config/properties/index.js +16 -0
  21. package/dist/nodes/shared/config/properties/index.js.map +1 -0
  22. package/dist/nodes/shared/config/properties/memory.d.ts +2 -0
  23. package/dist/nodes/shared/config/properties/memory.js +5 -0
  24. package/dist/nodes/shared/config/properties/memory.js.map +1 -0
  25. package/dist/nodes/shared/config/properties/messages.d.ts +2 -0
  26. package/dist/nodes/shared/config/properties/messages.js +109 -0
  27. package/dist/nodes/shared/config/properties/messages.js.map +1 -0
  28. package/dist/nodes/shared/config/properties/model.d.ts +2 -0
  29. package/dist/nodes/shared/config/properties/model.js +30 -0
  30. package/dist/nodes/shared/config/properties/model.js.map +1 -0
  31. package/dist/nodes/shared/config/properties/options.d.ts +2 -0
  32. package/dist/nodes/shared/config/properties/options.js +105 -0
  33. package/dist/nodes/shared/config/properties/options.js.map +1 -0
  34. package/dist/nodes/shared/config/properties/output.d.ts +2 -0
  35. package/dist/nodes/shared/config/properties/output.js +310 -0
  36. package/dist/nodes/shared/config/properties/output.js.map +1 -0
  37. package/dist/nodes/shared/config/properties/tools.d.ts +2 -0
  38. package/dist/nodes/shared/config/properties/tools.js +5 -0
  39. package/dist/nodes/shared/config/properties/tools.js.map +1 -0
  40. package/dist/nodes/shared/config/responseConfig.d.ts +3 -0
  41. package/dist/nodes/shared/config/responseConfig.js +26 -0
  42. package/dist/nodes/shared/config/responseConfig.js.map +1 -0
  43. package/dist/nodes/shared/core/execution/executor.d.ts +7 -0
  44. package/dist/nodes/shared/core/execution/executor.js +61 -0
  45. package/dist/nodes/shared/core/execution/executor.js.map +1 -0
  46. package/dist/nodes/shared/core/execution/messageOperation.d.ts +2 -0
  47. package/dist/nodes/shared/core/execution/messageOperation.js +14 -0
  48. package/dist/nodes/shared/core/execution/messageOperation.js.map +1 -0
  49. package/dist/nodes/shared/core/execution/router.d.ts +2 -0
  50. package/dist/nodes/shared/core/execution/router.js +117 -0
  51. package/dist/nodes/shared/core/execution/router.js.map +1 -0
  52. package/dist/nodes/shared/core/memory/index.d.ts +2 -0
  53. package/dist/nodes/shared/core/memory/index.js +19 -0
  54. package/dist/nodes/shared/core/memory/index.js.map +1 -0
  55. package/dist/nodes/shared/core/memory/io.d.ts +5 -0
  56. package/dist/nodes/shared/core/memory/io.js +93 -0
  57. package/dist/nodes/shared/core/memory/io.js.map +1 -0
  58. package/dist/nodes/shared/core/memory/optimizer.d.ts +3 -0
  59. package/dist/nodes/shared/core/memory/optimizer.js +30 -0
  60. package/dist/nodes/shared/core/memory/optimizer.js.map +1 -0
  61. package/dist/nodes/shared/core/memory/properties.d.ts +2 -0
  62. package/dist/nodes/shared/core/memory/properties.js +5 -0
  63. package/dist/nodes/shared/core/memory/properties.js.map +1 -0
  64. package/dist/nodes/shared/core/messages/chatHistory.d.ts +2 -0
  65. package/dist/nodes/shared/core/messages/chatHistory.js +63 -0
  66. package/dist/nodes/shared/core/messages/chatHistory.js.map +1 -0
  67. package/dist/nodes/shared/core/messages/converter.d.ts +4 -0
  68. package/dist/nodes/shared/core/messages/converter.js +76 -0
  69. package/dist/nodes/shared/core/messages/converter.js.map +1 -0
  70. package/dist/nodes/shared/core/messages/memoryOptimizer.d.ts +3 -0
  71. package/dist/nodes/shared/core/messages/memoryOptimizer.js +30 -0
  72. package/dist/nodes/shared/core/messages/memoryOptimizer.js.map +1 -0
  73. package/dist/nodes/shared/core/messages/processor.d.ts +4 -0
  74. package/dist/nodes/shared/core/messages/processor.js +23 -0
  75. package/dist/nodes/shared/core/messages/processor.js.map +1 -0
  76. package/dist/nodes/shared/core/messages/toolExtractor.d.ts +6 -0
  77. package/dist/nodes/shared/core/messages/toolExtractor.js +28 -0
  78. package/dist/nodes/shared/core/messages/toolExtractor.js.map +1 -0
  79. package/dist/nodes/shared/core/messages/types.d.ts +48 -0
  80. package/dist/nodes/shared/core/messages/types.js +12 -0
  81. package/dist/nodes/shared/core/messages/types.js.map +1 -0
  82. package/dist/nodes/shared/core/tools/connector.d.ts +3 -0
  83. package/dist/nodes/shared/core/tools/connector.js +37 -0
  84. package/dist/nodes/shared/core/tools/connector.js.map +1 -0
  85. package/dist/nodes/shared/core/tools/executor.d.ts +6 -0
  86. package/dist/nodes/shared/core/tools/executor.js +124 -0
  87. package/dist/nodes/shared/core/tools/executor.js.map +1 -0
  88. package/dist/nodes/shared/core/tools/manager.d.ts +2 -0
  89. package/dist/nodes/shared/core/tools/manager.js +51 -0
  90. package/dist/nodes/shared/core/tools/manager.js.map +1 -0
  91. package/dist/nodes/shared/core/tools/messageExtractor.d.ts +6 -0
  92. package/dist/nodes/shared/core/tools/messageExtractor.js +28 -0
  93. package/dist/nodes/shared/core/tools/messageExtractor.js.map +1 -0
  94. package/dist/nodes/shared/core/tools/n8nTool.d.ts +9 -0
  95. package/dist/nodes/shared/core/tools/n8nTool.js +91 -0
  96. package/dist/nodes/shared/core/tools/n8nTool.js.map +1 -0
  97. package/dist/nodes/shared/core/tools/schemaGenerator.d.ts +6 -0
  98. package/dist/nodes/shared/core/tools/schemaGenerator.js +23 -0
  99. package/dist/nodes/shared/core/tools/schemaGenerator.js.map +1 -0
  100. package/dist/nodes/shared/core/tools/setup.d.ts +8 -0
  101. package/dist/nodes/shared/core/tools/setup.js +59 -0
  102. package/dist/nodes/shared/core/tools/setup.js.map +1 -0
  103. package/dist/nodes/shared/core/tools/subagentTool.d.ts +11 -0
  104. package/dist/nodes/shared/core/tools/subagentTool.js +60 -0
  105. package/dist/nodes/shared/core/tools/subagentTool.js.map +1 -0
  106. package/dist/nodes/shared/methods/index.d.ts +1 -1
  107. package/dist/nodes/shared/methods/index.js +1 -1
  108. package/dist/nodes/shared/methods/index.js.map +1 -1
  109. package/dist/nodes/shared/methods/listSearch.d.ts +3 -0
  110. package/dist/nodes/shared/methods/listSearch.js +4 -0
  111. package/dist/nodes/shared/methods/listSearch.js.map +1 -1
  112. package/dist/nodes/shared/processing/memory.d.ts +5 -0
  113. package/dist/nodes/shared/processing/memory.js +93 -0
  114. package/dist/nodes/shared/processing/memory.js.map +1 -0
  115. package/dist/nodes/shared/processing/outputProcessor.d.ts +5 -0
  116. package/dist/nodes/shared/processing/outputProcessor.js +108 -0
  117. package/dist/nodes/shared/processing/outputProcessor.js.map +1 -0
  118. package/dist/nodes/shared/processing/requestBuilder.d.ts +2 -0
  119. package/dist/nodes/shared/processing/requestBuilder.js +43 -0
  120. package/dist/nodes/shared/processing/requestBuilder.js.map +1 -0
  121. package/dist/nodes/shared/processing/visualEditor.d.ts +32 -0
  122. package/dist/nodes/shared/processing/visualEditor.js +70 -0
  123. package/dist/nodes/shared/processing/visualEditor.js.map +1 -0
  124. package/dist/nodes/shared/utils/descriptionGenerator.d.ts +2 -0
  125. package/dist/nodes/shared/utils/descriptionGenerator.js +36 -0
  126. package/dist/nodes/shared/utils/descriptionGenerator.js.map +1 -0
  127. package/dist/nodes/shared/utils/index.d.ts +1 -0
  128. package/dist/nodes/shared/utils/index.js +18 -0
  129. package/dist/nodes/shared/utils/index.js.map +1 -0
  130. package/dist/nodes/shared/utils/listSearch.d.ts +2 -0
  131. package/dist/nodes/shared/utils/listSearch.js +34 -0
  132. package/dist/nodes/shared/utils/listSearch.js.map +1 -0
  133. package/dist/package.json +1 -1
  134. package/dist/tsconfig.tsbuildinfo +1 -1
  135. package/package.json +1 -1
@@ -0,0 +1,310 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.outputProperties = void 0;
4
+ exports.outputProperties = [
5
+ {
6
+ displayName: 'Response Format',
7
+ name: 'responseFormat',
8
+ description: 'The format that the model must output. Verify which models are compatible with <a href="https://openrouter.ai/models?fmt=cards&supported_parameters=response_format" target="_blank">JSON Mode</a> and <a href="https://openrouter.ai/models?fmt=cards&supported_parameters=structured_outputs" target="_blank">Structured Output</a>. Read the <a href="https://platform.openai.com/docs/guides/structured-outputs" target="_blank">Structured Output docs</a>.',
9
+ type: 'options',
10
+ noDataExpression: true,
11
+ options: [
12
+ {
13
+ name: 'Plain Text',
14
+ value: 'plainText',
15
+ },
16
+ {
17
+ name: 'JSON Mode',
18
+ value: 'jsonMode',
19
+ description: 'Ensures the message the model generates is valid JSON',
20
+ },
21
+ {
22
+ name: 'Structured Output (via JSON Schema)',
23
+ value: 'structuredOutputSchema',
24
+ description: 'Ensures the model will match your supplied JSON schema',
25
+ },
26
+ {
27
+ name: 'Structured Output (via Visual Editor)',
28
+ value: 'structuredOutputVisual',
29
+ description: 'Ensures the model will match your visual editor schema',
30
+ },
31
+ ],
32
+ default: 'plainText',
33
+ },
34
+ {
35
+ displayName: 'Tools Mode',
36
+ name: 'structuredOutputToolsMode',
37
+ type: 'boolean',
38
+ default: false,
39
+ description: "Whether structured output is enforced through a tool. This enables structured output in models that do not support it. The structured output description should be something like: 'Generate and return the final response to the user. Call this tool only once, after all necessary tool calls are complete and you're ready to deliver the final output to the user.'",
40
+ displayOptions: {
41
+ show: {
42
+ responseFormat: ['structuredOutputVisual', 'structuredOutputSchema'],
43
+ },
44
+ },
45
+ },
46
+ {
47
+ displayName: 'JSON Schema',
48
+ name: 'outputJsonSchemaDefinition',
49
+ type: 'json',
50
+ typeOptions: {
51
+ rows: 5,
52
+ },
53
+ default: '',
54
+ validateType: 'object',
55
+ ignoreValidationDuringExecution: true,
56
+ description: 'Generate a schema <a href="https://platform.openai.com/docs/guides/structured-outputs" target="_blank">here</a>',
57
+ displayOptions: {
58
+ show: {
59
+ responseFormat: ['structuredOutputSchema'],
60
+ },
61
+ },
62
+ },
63
+ {
64
+ displayName: 'Structured Output Name',
65
+ name: 'structuredOutputName',
66
+ type: 'string',
67
+ validateType: 'string-alphanumeric',
68
+ default: 'final_response',
69
+ description: 'The name of the structured output. Examples: final_response, math_reasoning, blog_post.',
70
+ typeOptions: {
71
+ rows: 1,
72
+ },
73
+ displayOptions: {
74
+ show: {
75
+ responseFormat: ['structuredOutputVisual'],
76
+ },
77
+ },
78
+ },
79
+ {
80
+ displayName: 'Description',
81
+ name: 'structuredOutputDescription',
82
+ type: 'string',
83
+ default: '',
84
+ typeOptions: {
85
+ rows: 1,
86
+ },
87
+ displayOptions: {
88
+ show: {
89
+ responseFormat: ['structuredOutputVisual'],
90
+ },
91
+ },
92
+ },
93
+ {
94
+ displayName: 'Array',
95
+ name: 'structuredOutputIsArray',
96
+ type: 'boolean',
97
+ default: false,
98
+ description: 'Whether the structured output is an array of objects rather than a single object. Each object will contain the properties defined in the schema below.',
99
+ displayOptions: {
100
+ show: {
101
+ responseFormat: ['structuredOutputVisual'],
102
+ },
103
+ },
104
+ },
105
+ {
106
+ displayName: 'Array Name',
107
+ name: 'structuredOutputArrayName',
108
+ type: 'string',
109
+ validateType: 'string-alphanumeric',
110
+ description: 'The name of the array, in plural. Examples: topics, contacts, products.',
111
+ default: 'items',
112
+ typeOptions: {
113
+ rows: 1,
114
+ },
115
+ displayOptions: {
116
+ show: {
117
+ responseFormat: ['structuredOutputVisual'],
118
+ structuredOutputIsArray: [true],
119
+ },
120
+ },
121
+ },
122
+ {
123
+ displayName: 'Array Description',
124
+ name: 'structuredOutputArrayDescription',
125
+ type: 'string',
126
+ description: 'The description of the array (e.g. "A list of products")',
127
+ default: '',
128
+ typeOptions: {
129
+ rows: 1,
130
+ },
131
+ displayOptions: {
132
+ show: {
133
+ responseFormat: ['structuredOutputVisual'],
134
+ structuredOutputIsArray: [true],
135
+ },
136
+ },
137
+ },
138
+ {
139
+ displayName: 'Properties',
140
+ name: 'structuredOutputProperties',
141
+ type: 'fixedCollection',
142
+ typeOptions: {
143
+ multipleValues: true,
144
+ },
145
+ placeholder: 'Add Definition',
146
+ default: { values: [{ description: '' }] },
147
+ options: [
148
+ {
149
+ name: 'values',
150
+ displayName: 'Values',
151
+ values: [
152
+ {
153
+ displayName: 'Name',
154
+ name: 'name',
155
+ type: 'string',
156
+ validateType: 'string-alphanumeric',
157
+ description: 'The name of the property. If the property is a String Array, this should be in plural (e.g. "products" instead of "product").',
158
+ default: '',
159
+ },
160
+ {
161
+ displayName: 'Type',
162
+ name: 'type',
163
+ type: 'options',
164
+ options: [
165
+ {
166
+ name: 'String',
167
+ value: 'string',
168
+ },
169
+ {
170
+ name: 'String Array',
171
+ value: 'stringArray',
172
+ },
173
+ {
174
+ name: 'Boolean',
175
+ value: 'boolean',
176
+ },
177
+ {
178
+ name: 'Integer',
179
+ value: 'integer',
180
+ },
181
+ {
182
+ name: 'Number',
183
+ value: 'number',
184
+ },
185
+ ],
186
+ default: 'string',
187
+ },
188
+ {
189
+ displayName: 'Description',
190
+ name: 'description',
191
+ type: 'string',
192
+ description: 'The description of the property. If the property is a String Array, this is the description of the <i>array</i> itself (e.g. "A list of products"), not the description of each element.',
193
+ default: '',
194
+ },
195
+ {
196
+ displayName: 'Element Description',
197
+ name: 'elementDescription',
198
+ type: 'string',
199
+ description: 'The description of each element in a String Array (e.g. "A product")',
200
+ default: '',
201
+ displayOptions: {
202
+ show: {
203
+ type: ['stringArray'],
204
+ },
205
+ },
206
+ },
207
+ {
208
+ displayName: 'Enum',
209
+ name: 'isEnum',
210
+ type: 'boolean',
211
+ default: false,
212
+ description: 'Whether to restrict a value to a fixed set of values',
213
+ displayOptions: {
214
+ show: {
215
+ type: ['string', 'stringArray'],
216
+ },
217
+ },
218
+ },
219
+ {
220
+ displayName: 'Enumerated Values',
221
+ name: 'enumValues',
222
+ type: 'json',
223
+ default: '',
224
+ description: 'A JSON array with at least one element, where each element is unique. Example: ["positive", "negative", "neutral"]',
225
+ typeOptions: {
226
+ rows: 2,
227
+ },
228
+ displayOptions: {
229
+ show: {
230
+ type: ['string', 'stringArray'],
231
+ isEnum: [true],
232
+ },
233
+ },
234
+ },
235
+ {
236
+ displayName: 'Optional',
237
+ name: 'isOptional',
238
+ type: 'boolean',
239
+ default: false,
240
+ description: 'Whether to allow the value to be null',
241
+ },
242
+ ],
243
+ },
244
+ ],
245
+ displayOptions: {
246
+ show: {
247
+ responseFormat: ['structuredOutputVisual'],
248
+ },
249
+ },
250
+ },
251
+ {
252
+ displayName: 'Extra Outputs',
253
+ name: 'addToOutput',
254
+ type: 'multiOptions',
255
+ description: 'Extra fields to add to the output',
256
+ options: [
257
+ {
258
+ name: 'Chat History',
259
+ value: 'chatHistory',
260
+ description: 'All messages, including the final assistant message',
261
+ },
262
+ {
263
+ name: 'Model Overview',
264
+ value: 'modelOverview',
265
+ description: 'Pricing, max tokens, supported parameters (by OpenRouter)',
266
+ },
267
+ {
268
+ name: 'Request',
269
+ value: 'request',
270
+ description: 'The final HTTP request sent to the model',
271
+ },
272
+ {
273
+ name: 'Response',
274
+ value: 'fullResponse',
275
+ description: 'The final HTTP response from the model',
276
+ },
277
+ {
278
+ name: 'Tool Calls',
279
+ value: 'tool_calls',
280
+ description: "The model's intermediate steps (tools inputs and outputs)",
281
+ },
282
+ ],
283
+ default: [],
284
+ },
285
+ {
286
+ displayName: 'Include System Messages in Chat History',
287
+ name: 'includeSystemMessagesInChatHistory',
288
+ type: 'boolean',
289
+ default: true,
290
+ description: 'Whether to include system messages in the Chat History',
291
+ displayOptions: {
292
+ show: {
293
+ addToOutput: ['chatHistory'],
294
+ },
295
+ },
296
+ },
297
+ {
298
+ displayName: 'Include Tool Calls in Chat History',
299
+ name: 'includeToolCallsInChatHistory',
300
+ type: 'boolean',
301
+ default: true,
302
+ description: 'Whether to include tool calls (function-calling assistant messages and tool messages) in the Chat History',
303
+ displayOptions: {
304
+ show: {
305
+ addToOutput: ['chatHistory'],
306
+ },
307
+ },
308
+ }
309
+ ];
310
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../../../../nodes/shared/config/properties/output.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAsB;IAClD;QACC,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACV,kcAAkc;QACnc,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,WAAW;aAElB;YACD;gBACC,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,uDAAuD;aACpE;YACD;gBACC,IAAI,EAAE,qCAAqC;gBAC3C,KAAK,EAAE,wBAAwB;gBAC/B,WAAW,EAAE,wDAAwD;aACrE;YACD;gBACC,IAAI,EAAE,uCAAuC;gBAC7C,KAAK,EAAE,wBAAwB;gBAC/B,WAAW,EAAE,wDAAwD;aACrE;SACD;QACD,OAAO,EAAE,WAAW;KAQpB;IACD;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,2BAA2B;QACjC,IAAI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AAI;QACb,WAAW,EACV,2GAA2G;QAC5G,cAAc,EAAE;YACf,IAAI,EAAE;gBAEL,WAAW,EAAE,CAAC,aAAa,CAAC;aAC5B;SACD;KACD;CACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const toolsProperties: INodeProperties[];
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toolsProperties = void 0;
4
+ exports.toolsProperties = [];
5
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../../nodes/shared/config/properties/tools.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAsB,EAGjD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { IDataObject } from 'n8n-workflow';
2
+ import { VisualEditorProperties } from '../processing/visualEditor';
3
+ export declare function configureResponseFormat(responseFormat: string, outputJsonSchemaDefinition: string, structuredOutputName: string, structuredOutputDescription: string, structuredOutputProperties: VisualEditorProperties[], structuredOutputIsArray: boolean, structuredOutputArrayName: string, structuredOutputArrayDescription: string): IDataObject | undefined;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureResponseFormat = configureResponseFormat;
4
+ const visualEditor_1 = require("../processing/visualEditor");
5
+ function configureResponseFormat(responseFormat, outputJsonSchemaDefinition, structuredOutputName, structuredOutputDescription, structuredOutputProperties, structuredOutputIsArray, structuredOutputArrayName, structuredOutputArrayDescription) {
6
+ let response_format;
7
+ if (responseFormat === 'structuredOutputSchema') {
8
+ response_format = { type: 'json_schema', json_schema: JSON.parse(outputJsonSchemaDefinition) };
9
+ }
10
+ else if (responseFormat === 'structuredOutputVisual') {
11
+ response_format = {
12
+ type: 'json_schema',
13
+ json_schema: {
14
+ name: structuredOutputName,
15
+ ...(structuredOutputDescription.trim() && { description: structuredOutputDescription }),
16
+ schema: (0, visualEditor_1.convertVisualEditorToSchema)(structuredOutputProperties, structuredOutputIsArray, structuredOutputArrayName, structuredOutputArrayDescription),
17
+ strict: true,
18
+ },
19
+ };
20
+ }
21
+ else if (responseFormat === 'jsonMode') {
22
+ response_format = { type: 'json_object' };
23
+ }
24
+ return response_format;
25
+ }
26
+ //# sourceMappingURL=responseConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responseConfig.js","sourceRoot":"","sources":["../../../../nodes/shared/config/responseConfig.ts"],"names":[],"mappings":";;AAMA,0DAiCC;AAtCD,6DAAiG;AAKjG,SAAgB,uBAAuB,CACtC,cAAsB,EACtB,0BAAkC,EAClC,oBAA4B,EAC5B,2BAAmC,EACnC,0BAAoD,EACpD,uBAAgC,EAChC,yBAAiC,EACjC,gCAAwC;IAExC,IAAI,eAAe,CAAC;IACpB,IAAI,cAAc,KAAK,wBAAwB,EAAE,CAAC;QACjD,eAAe,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE,CAAC;IAChG,CAAC;SAAM,IAAI,cAAc,KAAK,wBAAwB,EAAE,CAAC;QACxD,eAAe,GAAG;YACjB,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE;gBACZ,IAAI,EAAE,oBAAoB;gBAC1B,GAAG,CAAC,2BAA2B,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;gBACvF,MAAM,EAAE,IAAA,0CAA2B,EAClC,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,gCAAgC,CAChC;gBACD,MAAM,EAAE,IAAI;aACZ;SACD,CAAC;IACH,CAAC;SAAM,IAAI,cAAc,KAAK,UAAU,EAAE,CAAC;QAC1C,eAAe,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAC3C,CAAC;IAED,OAAO,eAAe,CAAC;AACxB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, IDataObject } from 'n8n-workflow';
2
+ import type { BaseChatMemory } from 'langchain/memory';
3
+ import type { ChatCompletion } from '../../api/types';
4
+ import { ExtractedParameters } from '../../config/parameters';
5
+ export declare function hasEmptyContent(response: ChatCompletion): boolean;
6
+ export declare function executeWithFallback(executeFunctions: IExecuteFunctions, params: ExtractedParameters, memory: BaseChatMemory | undefined, messages: IDataObject[], index: number, parentMessageContentStr: string, parentMessageContentObj: object): Promise<INodeExecutionData[]>;
7
+ export declare function executeSingleModel(executeFunctions: IExecuteFunctions, params: ExtractedParameters, memory: BaseChatMemory | undefined, messages: IDataObject[], index: number, parentMessageContentStr: string, parentMessageContentObj: object, modelToUse: string): Promise<INodeExecutionData[]>;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasEmptyContent = hasEmptyContent;
4
+ exports.executeWithFallback = executeWithFallback;
5
+ exports.executeSingleModel = executeSingleModel;
6
+ const responseConfig_1 = require("../../config/responseConfig");
7
+ const setup_1 = require("../tools/setup");
8
+ const requestBuilder_1 = require("../../processing/requestBuilder");
9
+ const executor_1 = require("../tools/executor");
10
+ const outputProcessor_1 = require("../../processing/outputProcessor");
11
+ const io_1 = require("../memory/io");
12
+ function hasEmptyContent(response) {
13
+ var _a, _b, _c;
14
+ const content = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.choices) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.content;
15
+ return !content || content.trim() === '' || content === 'null' || content === 'undefined';
16
+ }
17
+ async function executeWithFallback(executeFunctions, params, memory, messages, index, parentMessageContentStr, parentMessageContentObj) {
18
+ const shouldUseFallback = params.fallbackModel &&
19
+ params.fallbackModel.trim() !== '' &&
20
+ params.fallbackModel !== params.model;
21
+ try {
22
+ const result = await executeSingleModel(executeFunctions, params, memory, messages, index, parentMessageContentStr, parentMessageContentObj, params.model);
23
+ if (shouldUseFallback && result.length > 0 && result[0].json.response) {
24
+ const response = result[0].json.response;
25
+ if (hasEmptyContent(response)) {
26
+ console.log(`Primary model ${params.model} returned empty content, trying fallback model ${params.fallbackModel}`);
27
+ return await executeSingleModel(executeFunctions, params, memory, messages, index, parentMessageContentStr, parentMessageContentObj, params.fallbackModel);
28
+ }
29
+ }
30
+ return result;
31
+ }
32
+ catch (error) {
33
+ if (shouldUseFallback) {
34
+ console.log(`Primary model ${params.model} failed with error, trying fallback model ${params.fallbackModel}:`, error);
35
+ try {
36
+ return await executeSingleModel(executeFunctions, params, memory, messages, index, parentMessageContentStr, parentMessageContentObj, params.fallbackModel);
37
+ }
38
+ catch (fallbackError) {
39
+ console.error(`Fallback model ${params.fallbackModel} also failed:`, fallbackError);
40
+ throw fallbackError;
41
+ }
42
+ }
43
+ throw error;
44
+ }
45
+ }
46
+ async function executeSingleModel(executeFunctions, params, memory, messages, index, parentMessageContentStr, parentMessageContentObj, modelToUse) {
47
+ var _a, _b;
48
+ let response_format = (0, responseConfig_1.configureResponseFormat)(params.responseFormat, params.outputJsonSchemaDefinition, params.structuredOutputName, params.structuredOutputDescription, params.structuredOutputProperties, params.structuredOutputIsArray, params.structuredOutputArrayName, params.structuredOutputArrayDescription);
49
+ const { tools, invokableTools, tool_choice, structuredOutputTool, updatedResponseFormat } = await (0, setup_1.setupTools)(executeFunctions, params.structuredOutputToolsMode, response_format);
50
+ response_format = updatedResponseFormat;
51
+ const body = (0, requestBuilder_1.prepareRequestBody)(modelToUse, messages, tools, tool_choice, response_format, params.options, params.customParameters);
52
+ const originalMessagesLength = messages.length;
53
+ const { response, output } = await (0, executor_1.processToolCalls)(executeFunctions, body, messages, invokableTools, structuredOutputTool, params.maxToolsIterations, params.abortSignal);
54
+ const outputData = await (0, outputProcessor_1.prepareOutputData)(response, output, messages, originalMessagesLength, params.addToOutput, params.agentType, executeFunctions, index, body, modelToUse, parentMessageContentStr);
55
+ if (memory && ((_b = (_a = response === null || response === void 0 ? void 0 : response.choices) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message)) {
56
+ const outputStringified = typeof output === 'string' ? output : JSON.stringify(output);
57
+ await (0, io_1.saveToMemory)(memory, messages, response, outputStringified, params.saveToolCallsInChatMemory, originalMessagesLength);
58
+ }
59
+ return outputData;
60
+ }
61
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../nodes/shared/core/execution/executor.ts"],"names":[],"mappings":";;AAcA,0CAGC;AAKD,kDA6EC;AAKD,gDAmFC;AAvLD,gEAAsE;AACtE,0CAA4C;AAC5C,oEAAqE;AACrE,gDAAqD;AACrD,sEAAqE;AACrE,qCAA4C;AAK5C,SAAgB,eAAe,CAAC,QAAwB;;IACvD,MAAM,OAAO,GAAG,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,0CAAG,CAAC,CAAC,0CAAE,OAAO,0CAAE,OAAO,CAAC;IACzD,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,WAAW,CAAC;AAC3F,CAAC;AAKM,KAAK,UAAU,mBAAmB,CACxC,gBAAmC,EACnC,MAA2B,EAC3B,MAAkC,EAClC,QAAuB,EACvB,KAAa,EACb,uBAA+B,EAC/B,uBAA+B;IAG/B,MAAM,iBAAiB,GACtB,MAAM,CAAC,aAAa;QACpB,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE;QAClC,MAAM,CAAC,aAAa,KAAK,MAAM,CAAC,KAAK,CAAC;IAEvC,IAAI,CAAC;QAEJ,MAAM,MAAM,GAAG,MAAM,kBAAkB,CACtC,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,QAAQ,EACR,KAAK,EACL,uBAAuB,EACvB,uBAAuB,EACvB,MAAM,CAAC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AO,0CAAG,CAAC,CAAC,0CAAE,OAAO,CAAA,EAAE,CAAC;QAC/C,MAAM,iBAAiB,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACvF,MAAM,IAAA,iBAAY,EACjB,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,MAAM,CAAC,yBAAyB,EAChC,sBAAsB,CACtB,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function execute(this: IExecuteFunctions, i: number, parentMessageContentStr?: string, parentMessageContentObj?: object): Promise<INodeExecutionData[]>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.execute = execute;
4
+ const parameters_1 = require("../../config/parameters");
5
+ const io_1 = require("../memory/io");
6
+ const processor_1 = require("../messages/processor");
7
+ const executor_1 = require("./executor");
8
+ async function execute(i, parentMessageContentStr = '', parentMessageContentObj = {}) {
9
+ const params = (0, parameters_1.extractParameters)(this, i);
10
+ const memory = await (0, io_1.getMemoryFromInput)(this);
11
+ const messages = await (0, processor_1.processMessages)(params.rawMessagesToSend, memory, parentMessageContentStr, parentMessageContentObj, params.loadToolCallsFromChatMemory);
12
+ return await (0, executor_1.executeWithFallback)(this, params, memory, messages, i, parentMessageContentStr, parentMessageContentObj);
13
+ }
14
+ //# sourceMappingURL=messageOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageOperation.js","sourceRoot":"","sources":["../../../../../nodes/shared/core/execution/messageOperation.ts"],"names":[],"mappings":";;AAUA,0BA+BC;AAvCD,wDAA4D;AAC5D,qCAAkD;AAClD,qDAAwD;AACxD,yCAAiD;AAK1C,KAAK,UAAU,OAAO,CAE5B,CAAS,EACT,0BAAkC,EAAE,EACpC,0BAAkC,EAAE;IAGpC,MAAM,MAAM,GAAG,IAAA,8BAAiB,EAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAG1C,MAAM,MAAM,GAAG,MAAM,IAAA,uBAAkB,EAAC,IAAI,CAAC,CAAC;IAG9C,MAAM,QAAQ,GAAG,MAAM,IAAA,2BAAe,EACrC,MAAM,CAAC,iBAAiB,EACxB,MAAM,EACN,uBAAuB,EACvB,uBAAuB,EACvB,MAAM,CAAC,2BAA2B,CAClC,CAAC;IAGF,OAAO,MAAM,IAAA,8BAAmB,EAC/B,IAAI,EACJ,MAAM,EACN,MAAM,EACN,QAAQ,EACR,CAAC,EACD,uBAAuB,EACvB,uBAAuB,CACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type IExecuteFunctions, type INodeExecutionData } from 'n8n-workflow';
2
+ export declare function router(this: IExecuteFunctions, parentMessageContentStr?: string, parentMessageContentObj?: Record<string, any>): Promise<INodeExecutionData[][]>;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.router = router;
37
+ const n8n_workflow_1 = require("n8n-workflow");
38
+ const messageOperation = __importStar(require("./messageOperation"));
39
+ const errorHandling_1 = require("../../api/errorHandling");
40
+ function isNodeApiError(error) {
41
+ return error instanceof n8n_workflow_1.NodeApiError || error.name === 'NodeApiError';
42
+ }
43
+ function normalizeError(error) {
44
+ if (error instanceof Error) {
45
+ return error;
46
+ }
47
+ return new Error(String(error));
48
+ }
49
+ function initializeRouter(executeFunctions) {
50
+ return {
51
+ returnData: [],
52
+ items: executeFunctions.getInputData(),
53
+ execute: messageOperation.execute,
54
+ };
55
+ }
56
+ async function executeItem(execute, executeFunctions, itemIndex, parentMessageContentStr = '', parentMessageContentObj = {}) {
57
+ return await execute.call(executeFunctions, itemIndex, parentMessageContentStr, parentMessageContentObj);
58
+ }
59
+ function handleNodeApiError(error, itemIndex) {
60
+ var _a, _b, _c;
61
+ const errorCode = (_c = (_b = (_a = error.cause) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code;
62
+ if (errorCode) {
63
+ const customErrorMessage = (0, errorHandling_1.getCustomErrorMessage)(errorCode);
64
+ if (customErrorMessage) {
65
+ error.message = customErrorMessage;
66
+ }
67
+ }
68
+ error.context = {
69
+ itemIndex,
70
+ };
71
+ console.error(`NodeApiError at item ${itemIndex}: ${error.message}`);
72
+ throw error;
73
+ }
74
+ function handleGenericError(error, executeFunctions, itemIndex) {
75
+ console.error(`Generic error at item ${itemIndex}: ${error.message}`);
76
+ throw new n8n_workflow_1.NodeOperationError(executeFunctions.getNode(), error, {
77
+ itemIndex,
78
+ description: error.description,
79
+ });
80
+ }
81
+ function handleError(error, executeFunctions, itemIndex, continueOnFail, returnData) {
82
+ const normalizedError = normalizeError(error);
83
+ if (continueOnFail) {
84
+ returnData.push({
85
+ json: { error: normalizedError.message },
86
+ pairedItem: { item: itemIndex },
87
+ });
88
+ return returnData;
89
+ }
90
+ if (isNodeApiError(normalizedError)) {
91
+ return handleNodeApiError(normalizedError, itemIndex);
92
+ }
93
+ return handleGenericError(normalizedError, executeFunctions, itemIndex);
94
+ }
95
+ async function processItems(config, executeFunctions, parentMessageContentStr = '', parentMessageContentObj = {}) {
96
+ const { returnData, items, execute } = config;
97
+ for (let i = 0; i < items.length; i++) {
98
+ try {
99
+ const responseData = await executeItem(execute, executeFunctions, i, parentMessageContentStr, parentMessageContentObj);
100
+ returnData.push(...responseData);
101
+ }
102
+ catch (error) {
103
+ const result = handleError(error, executeFunctions, i, executeFunctions.continueOnFail(), returnData);
104
+ if (result) {
105
+ console.log(`Continuing after error in item ${i} (0-indexed, out of ${items.length} items)`);
106
+ continue;
107
+ }
108
+ }
109
+ }
110
+ return returnData;
111
+ }
112
+ async function router(parentMessageContentStr = '', parentMessageContentObj = {}) {
113
+ const config = initializeRouter(this);
114
+ const processedData = await processItems(config, this, parentMessageContentStr, parentMessageContentObj);
115
+ return [processedData];
116
+ }
117
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../../nodes/shared/core/execution/router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKA,wBAaC;AApLD,+CAKsB;AAEtB,qEAAuD;AACvD,2DAAgE;AAMhE,SAAS,cAAc,CAAC,KAAU;IACjC,OAAO,KAAK,YAAY,2BAAY,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC;AACvE,CAAC;AAKD,SAAS,cA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M,MAAM,GAAG,WAAW,CACzB,KAAK,EACL,gBAAgB,EAChB,CAAC,EACD,gBAAgB,CAAC,cAAc,EAAE,EACjC,UAAU,CACV,CAAC;YAEF,IAAI,MAAM,EAAE,CAAC;gBAEZ,OAAO,CAAC,GAAG,CACV,kCAAkC,CAAC,uBAAuB,KAAK,CAAC,MAAM,SAAS,CAC/E,CAAC;gBACF,SAAS;YACV,CAAC;QAEF,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC;AAKM,KAAK,UAAU,MAAM,CAE3B,0BAAkC,EAAE,EACpC,0BAA+C,EAAE;IAEjD,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,MAAM,YAAY,CACvC,MAAM,EACN,IAAI,EACJ,uBAAuB,EACvB,uBAAuB,CACvB,CAAC;IACF,OAAO,CAAC,aAAa,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './io';
2
+ export * from './optimizer';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./io"), exports);
18
+ __exportStar(require("./optimizer"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/shared/core/memory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,uCAAqB;AACrB,8CAA4B"}
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, IDataObject } from 'n8n-workflow';
2
+ import type { BaseChatMemory } from 'langchain/memory';
3
+ import type { ChatCompletion } from '../../api/types';
4
+ export declare function getMemoryFromInput(executeFunctions: IExecuteFunctions): Promise<BaseChatMemory | undefined>;
5
+ export declare function saveToMemory(memory: BaseChatMemory | undefined, messages: IDataObject[], response: ChatCompletion, outputStringified: string, saveToolCallsInChatMemory: boolean, originalMessagesLength?: number): Promise<void>;