@n8n/n8n-nodes-langchain 1.116.2 → 1.118.0

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 (93) hide show
  1. package/dist/credentials/McpOAuth2Api.credentials.js +45 -0
  2. package/dist/credentials/McpOAuth2Api.credentials.js.map +1 -0
  3. package/dist/known/credentials.json +10 -0
  4. package/dist/known/nodes.json +4 -0
  5. package/dist/nodes/Guardrails/Guardrails.node.js +73 -0
  6. package/dist/nodes/Guardrails/Guardrails.node.js.map +1 -0
  7. package/dist/nodes/Guardrails/actions/checks/jailbreak.js +50 -0
  8. package/dist/nodes/Guardrails/actions/checks/jailbreak.js.map +1 -0
  9. package/dist/nodes/Guardrails/actions/checks/keywords.js +66 -0
  10. package/dist/nodes/Guardrails/actions/checks/keywords.js.map +1 -0
  11. package/dist/nodes/Guardrails/actions/checks/nsfw.js +53 -0
  12. package/dist/nodes/Guardrails/actions/checks/nsfw.js.map +1 -0
  13. package/dist/nodes/Guardrails/actions/checks/pii.js +232 -0
  14. package/dist/nodes/Guardrails/actions/checks/pii.js.map +1 -0
  15. package/dist/nodes/Guardrails/actions/checks/secretKeys.js +201 -0
  16. package/dist/nodes/Guardrails/actions/checks/secretKeys.js.map +1 -0
  17. package/dist/nodes/Guardrails/actions/checks/topicalAlignment.js +38 -0
  18. package/dist/nodes/Guardrails/actions/checks/topicalAlignment.js.map +1 -0
  19. package/dist/nodes/Guardrails/actions/checks/urls.js +245 -0
  20. package/dist/nodes/Guardrails/actions/checks/urls.js.map +1 -0
  21. package/dist/nodes/Guardrails/actions/process.js +220 -0
  22. package/dist/nodes/Guardrails/actions/process.js.map +1 -0
  23. package/dist/nodes/Guardrails/actions/types.js +35 -0
  24. package/dist/nodes/Guardrails/actions/types.js.map +1 -0
  25. package/dist/nodes/Guardrails/description.js +454 -0
  26. package/dist/nodes/Guardrails/description.js.map +1 -0
  27. package/dist/nodes/Guardrails/guardrails.svg +11 -0
  28. package/dist/nodes/Guardrails/helpers/base.js +67 -0
  29. package/dist/nodes/Guardrails/helpers/base.js.map +1 -0
  30. package/dist/nodes/Guardrails/helpers/common.js +45 -0
  31. package/dist/nodes/Guardrails/helpers/common.js.map +1 -0
  32. package/dist/nodes/Guardrails/helpers/configureNodeInputs.js +50 -0
  33. package/dist/nodes/Guardrails/helpers/configureNodeInputs.js.map +1 -0
  34. package/dist/nodes/Guardrails/helpers/mappers.js +100 -0
  35. package/dist/nodes/Guardrails/helpers/mappers.js.map +1 -0
  36. package/dist/nodes/Guardrails/helpers/model.js +144 -0
  37. package/dist/nodes/Guardrails/helpers/model.js.map +1 -0
  38. package/dist/nodes/Guardrails/helpers/preflight.js +61 -0
  39. package/dist/nodes/Guardrails/helpers/preflight.js.map +1 -0
  40. package/dist/nodes/agents/Agent/V1/AgentV1.node.js +6 -0
  41. package/dist/nodes/agents/Agent/V1/AgentV1.node.js.map +1 -1
  42. package/dist/nodes/agents/Agent/V2/AgentV2.node.js +8 -0
  43. package/dist/nodes/agents/Agent/V2/AgentV2.node.js.map +1 -1
  44. package/dist/nodes/agents/Agent/V3/AgentV3.node.js +8 -0
  45. package/dist/nodes/agents/Agent/V3/AgentV3.node.js.map +1 -1
  46. package/dist/nodes/agents/Agent/agents/SqlAgent/description.js +10 -0
  47. package/dist/nodes/agents/Agent/agents/SqlAgent/description.js.map +1 -1
  48. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js +22 -0
  49. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js.map +1 -1
  50. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js +24 -5
  51. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js.map +1 -1
  52. package/dist/nodes/chains/ChainLLM/methods/config.js +4 -0
  53. package/dist/nodes/chains/ChainLLM/methods/config.js.map +1 -1
  54. package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js +6 -0
  55. package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js.map +1 -1
  56. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +2 -2
  57. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
  58. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js +448 -24
  59. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js.map +1 -1
  60. package/dist/nodes/llms/LMChatOpenAi/common.js +155 -0
  61. package/dist/nodes/llms/LMChatOpenAi/common.js.map +1 -0
  62. package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js +1 -1
  63. package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js.map +1 -1
  64. package/dist/nodes/llms/LMChatOpenAi/types.js +17 -0
  65. package/dist/nodes/llms/LMChatOpenAi/types.js.map +1 -0
  66. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +48 -3
  67. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
  68. package/dist/nodes/mcp/McpClientTool/loadOptions.js +2 -1
  69. package/dist/nodes/mcp/McpClientTool/loadOptions.js.map +1 -1
  70. package/dist/nodes/mcp/McpClientTool/types.js.map +1 -1
  71. package/dist/nodes/mcp/McpClientTool/utils.js +66 -4
  72. package/dist/nodes/mcp/McpClientTool/utils.js.map +1 -1
  73. package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js +8 -1
  74. package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js.map +1 -1
  75. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +45 -2
  76. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -1
  77. package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.js +3 -1
  78. package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.js.map +1 -1
  79. package/dist/nodes/vendors/Anthropic/actions/descriptions.js +1 -1
  80. package/dist/nodes/vendors/Anthropic/actions/descriptions.js.map +1 -1
  81. package/dist/nodes/vendors/OpenAi/helpers/utils.js +5 -0
  82. package/dist/nodes/vendors/OpenAi/helpers/utils.js.map +1 -1
  83. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js +6 -12
  84. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js.map +1 -1
  85. package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js +31 -6
  86. package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js.map +1 -1
  87. package/dist/types/credentials.json +1 -0
  88. package/dist/types/nodes.json +14 -13
  89. package/dist/utils/descriptions.js +18 -0
  90. package/dist/utils/descriptions.js.map +1 -1
  91. package/dist/utils/helpers.js +4 -1
  92. package/dist/utils/helpers.js.map +1 -1
  93. package/package.json +11 -9
@@ -0,0 +1,454 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var description_exports = {};
20
+ __export(description_exports, {
21
+ versionDescription: () => versionDescription
22
+ });
23
+ module.exports = __toCommonJS(description_exports);
24
+ var import_n8n_workflow = require("n8n-workflow");
25
+ var import_jailbreak = require("./actions/checks/jailbreak");
26
+ var import_nsfw = require("./actions/checks/nsfw");
27
+ var import_pii = require("./actions/checks/pii");
28
+ var import_topicalAlignment = require("./actions/checks/topicalAlignment");
29
+ var import_configureNodeInputs = require("./helpers/configureNodeInputs");
30
+ var import_model = require("./helpers/model");
31
+ const THRESHOLD_OPTION = {
32
+ displayName: "Threshold",
33
+ name: "threshold",
34
+ type: "number",
35
+ default: "",
36
+ description: "Minimum confidence threshold to trigger the guardrail (0.0 to 1.0)",
37
+ hint: "Inputs scoring less than this will be treated as violations"
38
+ };
39
+ const getPromptOption = (defaultPrompt, collapsible = true, hint) => {
40
+ const promptParameters = {
41
+ displayName: "Prompt",
42
+ name: "prompt",
43
+ type: "string",
44
+ default: defaultPrompt,
45
+ description: "The system prompt used by the guardrail. Thresholds and JSON output are enforced by the node automatically.",
46
+ hint,
47
+ typeOptions: {
48
+ rows: 6
49
+ }
50
+ };
51
+ if (collapsible) {
52
+ return [
53
+ { displayName: "Customize Prompt", name: "customizePrompt", type: "boolean", default: false },
54
+ { ...promptParameters, displayOptions: { show: { customizePrompt: [true] } } }
55
+ ];
56
+ }
57
+ return [promptParameters];
58
+ };
59
+ const wrapValue = (properties) => ({
60
+ displayName: "Value",
61
+ name: "value",
62
+ values: properties
63
+ });
64
+ const versionDescription = {
65
+ displayName: "Guardrails",
66
+ name: "guardrails",
67
+ icon: "file:guardrails.svg",
68
+ group: ["transform"],
69
+ version: 1,
70
+ description: "Safeguard AI models from malicious input or prevent them from generating undesirable responses",
71
+ defaults: {
72
+ name: "Guardrails"
73
+ },
74
+ codex: {
75
+ alias: ["LangChain", "Guardrails", "PII", "Secret", "Injection", "Sanitize"],
76
+ categories: ["AI"],
77
+ subcategories: {
78
+ AI: ["Agents", "Miscellaneous", "Root Nodes"]
79
+ },
80
+ resources: {
81
+ primaryDocumentation: [
82
+ {
83
+ url: "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.guardrails/"
84
+ }
85
+ ]
86
+ }
87
+ },
88
+ inputs: `={{(${import_configureNodeInputs.configureNodeInputs})($parameter.operation)}}`,
89
+ outputs: `={{
90
+ ((parameters) => {
91
+ const operation = parameters.operation ?? 'classify';
92
+
93
+ if (operation === 'classify') {
94
+ return [{displayName: "Pass", type: "${import_n8n_workflow.NodeConnectionTypes.Main}"}, {displayName: "Fail", type: "${import_n8n_workflow.NodeConnectionTypes.Main}"}]
95
+ }
96
+
97
+ return [{ displayName: "", type: "${import_n8n_workflow.NodeConnectionTypes.Main}"}]
98
+ })($parameter)
99
+ }}`,
100
+ properties: [
101
+ {
102
+ displayName: "Use guardrails to validate text against a set of policies (e.g. NSFW, prompt injection) or to sanitize it (e.g. personal data, secret keys)",
103
+ name: "guardrailsUsage",
104
+ type: "notice",
105
+ default: ""
106
+ },
107
+ {
108
+ displayName: "Operation",
109
+ name: "operation",
110
+ type: "options",
111
+ noDataExpression: true,
112
+ options: [
113
+ {
114
+ name: "Check Text for Violations",
115
+ value: "classify",
116
+ action: "Check text for violations",
117
+ description: "Validate text against a set of policies (e.g. NSFW, prompt injection)"
118
+ },
119
+ {
120
+ name: "Sanitize Text",
121
+ value: "sanitize",
122
+ action: "Sanitize text",
123
+ // eslint-disable-next-line n8n-nodes-base/node-param-description-excess-final-period
124
+ description: "Redact text to mask personal data, secret keys, URLs, etc."
125
+ }
126
+ ],
127
+ default: "classify"
128
+ },
129
+ {
130
+ displayName: "Text To Check",
131
+ name: "text",
132
+ type: "string",
133
+ required: true,
134
+ default: "",
135
+ typeOptions: {
136
+ rows: 1
137
+ }
138
+ },
139
+ {
140
+ displayName: "Guardrails",
141
+ name: "guardrails",
142
+ placeholder: "Add Guardrail",
143
+ type: "collection",
144
+ default: {},
145
+ options: [
146
+ {
147
+ displayName: "Keywords",
148
+ name: "keywords",
149
+ type: "string",
150
+ default: "",
151
+ description: "This guardrail checks if specified keywords appear in the input text and can be configured to trigger tripwires based on keyword matches. Multiple keywords can be added separated by comma.",
152
+ displayOptions: {
153
+ show: {
154
+ "/operation": ["classify"]
155
+ }
156
+ }
157
+ },
158
+ {
159
+ displayName: "Jailbreak",
160
+ name: "jailbreak",
161
+ type: "fixedCollection",
162
+ default: { value: { threshold: 0.7 } },
163
+ description: "Detects attempts to jailbreak or bypass AI safety measures",
164
+ options: [wrapValue([THRESHOLD_OPTION, ...getPromptOption(import_jailbreak.JAILBREAK_PROMPT)])],
165
+ displayOptions: {
166
+ show: {
167
+ "/operation": ["classify"]
168
+ }
169
+ }
170
+ },
171
+ {
172
+ displayName: "NSFW",
173
+ name: "nsfw",
174
+ type: "fixedCollection",
175
+ default: { value: { threshold: 0.7 } },
176
+ description: "Detects attempts to generate NSFW content",
177
+ options: [wrapValue([THRESHOLD_OPTION, ...getPromptOption(import_nsfw.NSFW_SYSTEM_PROMPT)])],
178
+ displayOptions: {
179
+ show: {
180
+ "/operation": ["classify"]
181
+ }
182
+ }
183
+ },
184
+ {
185
+ displayName: "Personal Data (PII)",
186
+ name: "pii",
187
+ type: "fixedCollection",
188
+ default: { value: { type: "all" } },
189
+ description: "Detects attempts to use personal data content",
190
+ options: [
191
+ wrapValue([
192
+ {
193
+ displayName: "Type",
194
+ name: "type",
195
+ type: "options",
196
+ default: "",
197
+ options: [
198
+ { name: "All", value: "all" },
199
+ { name: "Selected", value: "selected" }
200
+ ]
201
+ },
202
+ {
203
+ displayName: "Entities",
204
+ name: "entities",
205
+ type: "multiOptions",
206
+ default: [],
207
+ displayOptions: {
208
+ show: {
209
+ type: ["selected"]
210
+ }
211
+ },
212
+ options: Object.values(import_pii.PIIEntity).map((entity) => ({
213
+ name: import_pii.PII_NAME_MAP[entity],
214
+ value: entity
215
+ }))
216
+ }
217
+ ])
218
+ ]
219
+ },
220
+ {
221
+ displayName: "Secret Keys",
222
+ name: "secretKeys",
223
+ type: "fixedCollection",
224
+ default: { value: { permissiveness: "balanced" } },
225
+ description: "Detects attempts to use secret keys in the input text. Scans text for common patterns, applies entropy analysis to detect random-looking strings.",
226
+ options: [
227
+ wrapValue([
228
+ {
229
+ displayName: "Permissiveness",
230
+ name: "permissiveness",
231
+ type: "options",
232
+ default: "",
233
+ options: [
234
+ {
235
+ name: "Strict",
236
+ value: "strict",
237
+ description: "Most sensitive, may have more false positives (commonly flag high entropy filenames or code)"
238
+ },
239
+ {
240
+ name: "Balanced",
241
+ value: "balanced",
242
+ description: "Balanced between sensitivity and specificity"
243
+ },
244
+ {
245
+ name: "Permissive",
246
+ value: "permissive",
247
+ description: "Least sensitive, may miss some secret keys (but also reduces false positives)"
248
+ }
249
+ ]
250
+ }
251
+ ])
252
+ ]
253
+ },
254
+ {
255
+ displayName: "Topical Alignment",
256
+ name: "topicalAlignment",
257
+ type: "fixedCollection",
258
+ default: { value: { threshold: 0.7 } },
259
+ description: "Detects attempts to stray from the business scope",
260
+ options: [
261
+ wrapValue([
262
+ THRESHOLD_OPTION,
263
+ ...getPromptOption(
264
+ import_topicalAlignment.TOPICAL_ALIGNMENT_SYSTEM_PROMPT,
265
+ false,
266
+ "Make sure you replace the placeholder."
267
+ )
268
+ ])
269
+ ],
270
+ displayOptions: {
271
+ show: {
272
+ "/operation": ["classify"]
273
+ }
274
+ }
275
+ },
276
+ {
277
+ displayName: "URLs",
278
+ name: "urls",
279
+ type: "fixedCollection",
280
+ default: { value: { allowedSchemes: ["https"], allowedUrls: "" } },
281
+ description: "Blocks URLs that are not in the allowed list",
282
+ options: [
283
+ wrapValue([
284
+ {
285
+ displayName: "Block All URLs Except",
286
+ name: "allowedUrls",
287
+ type: "string",
288
+ // keep placeholder to avoid limitation that removes collections with unchanged default values
289
+ default: "PLACEHOLDER",
290
+ description: "Multiple URLs can be added separated by comma. Leave empty to block all URLs."
291
+ },
292
+ {
293
+ displayName: "Allowed Schemes",
294
+ name: "allowedSchemes",
295
+ type: "multiOptions",
296
+ default: ["https"],
297
+ // eslint-disable-next-line n8n-nodes-base/node-param-multi-options-type-unsorted-items
298
+ options: [
299
+ // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
300
+ { name: "https", value: "https" },
301
+ // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
302
+ { name: "http", value: "http" },
303
+ // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
304
+ { name: "ftp", value: "ftp" },
305
+ // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
306
+ { name: "data", value: "data" },
307
+ // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
308
+ { name: "javascript", value: "javascript" },
309
+ // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
310
+ { name: "vbscript", value: "vbscript" },
311
+ // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
312
+ { name: "mailto", value: "mailto" }
313
+ ]
314
+ },
315
+ {
316
+ displayName: "Block Userinfo",
317
+ name: "blockUserinfo",
318
+ type: "boolean",
319
+ default: true,
320
+ description: "Whether to block URLs with userinfo (user:pass@domain) to prevent credential injection",
321
+ displayOptions: {
322
+ show: {
323
+ "/operation": ["classify"]
324
+ }
325
+ }
326
+ },
327
+ {
328
+ displayName: "Sanitize Userinfo",
329
+ name: "blockUserinfo",
330
+ type: "boolean",
331
+ default: true,
332
+ description: "Whether to sanitize URLs with userinfo (user:pass@domain) to prevent credential injection",
333
+ displayOptions: {
334
+ show: {
335
+ "/operation": ["sanitize"]
336
+ }
337
+ }
338
+ },
339
+ {
340
+ displayName: "Allow Subdomains",
341
+ name: "allowSubdomains",
342
+ type: "boolean",
343
+ default: true,
344
+ description: "Whether to allow subdomains (e.g. sub.domain.com if domain.com is allowed)"
345
+ }
346
+ ])
347
+ ]
348
+ },
349
+ {
350
+ displayName: "Custom",
351
+ name: "custom",
352
+ type: "fixedCollection",
353
+ typeOptions: {
354
+ sortable: true,
355
+ multipleValues: true
356
+ },
357
+ placeholder: "Add Custom Guardrail",
358
+ default: {
359
+ guardrail: [{ name: "Custom Guardrail" }]
360
+ },
361
+ options: [
362
+ {
363
+ displayName: "Guardrail",
364
+ name: "guardrail",
365
+ values: [
366
+ {
367
+ displayName: "Name",
368
+ name: "name",
369
+ type: "string",
370
+ default: "",
371
+ description: "Name of the custom guardrail"
372
+ },
373
+ THRESHOLD_OPTION,
374
+ ...getPromptOption("", false)
375
+ ]
376
+ }
377
+ ],
378
+ displayOptions: {
379
+ show: {
380
+ "/operation": ["classify"]
381
+ }
382
+ }
383
+ },
384
+ {
385
+ displayName: "Custom Regex",
386
+ name: "customRegex",
387
+ type: "fixedCollection",
388
+ typeOptions: {
389
+ sortable: true,
390
+ multipleValues: true
391
+ },
392
+ placeholder: "Add Custom Regex",
393
+ default: {},
394
+ options: [
395
+ {
396
+ displayName: "Regex",
397
+ name: "regex",
398
+ values: [
399
+ {
400
+ displayName: "Name",
401
+ name: "name",
402
+ type: "string",
403
+ default: "",
404
+ description: "Name of the custom regex. Will be used for replacement when sanitizing."
405
+ },
406
+ {
407
+ displayName: "Regex",
408
+ name: "value",
409
+ type: "string",
410
+ default: "",
411
+ description: "Regex to match the input text",
412
+ placeholder: "/text/gi"
413
+ }
414
+ ]
415
+ }
416
+ ]
417
+ }
418
+ ]
419
+ },
420
+ {
421
+ displayName: "Customize System Message",
422
+ name: "customizeSystemMessage",
423
+ description: "Whether to customize the system message used by the guardrail to specify the output format",
424
+ type: "boolean",
425
+ default: false,
426
+ displayOptions: {
427
+ show: {
428
+ "/operation": ["classify"]
429
+ }
430
+ }
431
+ },
432
+ {
433
+ displayName: "System Message",
434
+ name: "systemMessage",
435
+ type: "string",
436
+ description: "The system message used by the guardrail to enforce thresholds and JSON output according to schema",
437
+ hint: "This message is appended after prompts defined by guardrails",
438
+ default: import_model.LLM_SYSTEM_RULES,
439
+ typeOptions: {
440
+ rows: 6
441
+ },
442
+ displayOptions: {
443
+ show: {
444
+ "/customizeSystemMessage": [true]
445
+ }
446
+ }
447
+ }
448
+ ]
449
+ };
450
+ // Annotate the CommonJS export names for ESM import in node:
451
+ 0 && (module.exports = {
452
+ versionDescription
453
+ });
454
+ //# sourceMappingURL=description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../nodes/Guardrails/description.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport { NodeConnectionTypes, type INodeProperties, type INodeTypeDescription } from 'n8n-workflow';\n\nimport { JAILBREAK_PROMPT } from './actions/checks/jailbreak';\nimport { NSFW_SYSTEM_PROMPT } from './actions/checks/nsfw';\nimport { PII_NAME_MAP, PIIEntity } from './actions/checks/pii';\nimport { TOPICAL_ALIGNMENT_SYSTEM_PROMPT } from './actions/checks/topicalAlignment';\nimport { configureNodeInputs } from './helpers/configureNodeInputs';\nimport { LLM_SYSTEM_RULES } from './helpers/model';\n\nconst THRESHOLD_OPTION: INodeProperties = {\n\tdisplayName: 'Threshold',\n\tname: 'threshold',\n\ttype: 'number',\n\tdefault: '',\n\tdescription: 'Minimum confidence threshold to trigger the guardrail (0.0 to 1.0)',\n\thint: 'Inputs scoring less than this will be treated as violations',\n};\n\nconst getPromptOption: (\n\tdefaultPrompt: string,\n\tcollapsible?: boolean,\n\thint?: string,\n) => INodeProperties[] = (defaultPrompt, collapsible = true, hint) => {\n\tconst promptParameters: INodeProperties = {\n\t\tdisplayName: 'Prompt',\n\t\tname: 'prompt',\n\t\ttype: 'string',\n\t\tdefault: defaultPrompt,\n\t\tdescription:\n\t\t\t'The system prompt used by the guardrail. Thresholds and JSON output are enforced by the node automatically.',\n\t\thint,\n\t\ttypeOptions: {\n\t\t\trows: 6,\n\t\t},\n\t};\n\tif (collapsible) {\n\t\treturn [\n\t\t\t{ displayName: 'Customize Prompt', name: 'customizePrompt', type: 'boolean', default: false },\n\t\t\t{ ...promptParameters, displayOptions: { show: { customizePrompt: [true] } } },\n\t\t];\n\t}\n\treturn [promptParameters];\n};\n\nconst wrapValue = (properties: INodeProperties[]) => ({\n\tdisplayName: 'Value',\n\tname: 'value',\n\tvalues: properties,\n});\n\nexport const versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Guardrails',\n\tname: 'guardrails',\n\ticon: 'file:guardrails.svg',\n\tgroup: ['transform'],\n\tversion: 1,\n\tdescription:\n\t\t'Safeguard AI models from malicious input or prevent them from generating undesirable responses',\n\tdefaults: {\n\t\tname: 'Guardrails',\n\t},\n\tcodex: {\n\t\talias: ['LangChain', 'Guardrails', 'PII', 'Secret', 'Injection', 'Sanitize'],\n\t\tcategories: ['AI'],\n\t\tsubcategories: {\n\t\t\tAI: ['Agents', 'Miscellaneous', 'Root Nodes'],\n\t\t},\n\t\tresources: {\n\t\t\tprimaryDocumentation: [\n\t\t\t\t{\n\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.guardrails/',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tinputs: `={{(${configureNodeInputs})($parameter.operation)}}`,\n\toutputs: `={{\n\t\t((parameters) => {\n\t\t\tconst operation = parameters.operation ?? 'classify';\n\n\t\t\tif (operation === 'classify') {\n\t\t\t\treturn [{displayName: \"Pass\", type: \"${NodeConnectionTypes.Main}\"}, {displayName: \"Fail\", type: \"${NodeConnectionTypes.Main}\"}]\n\t\t\t}\n\n\t\t\treturn [{ displayName: \"\", type: \"${NodeConnectionTypes.Main}\"}]\n\t\t})($parameter)\n\t}}`,\n\tproperties: [\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'Use guardrails to validate text against a set of policies (e.g. NSFW, prompt injection) or to sanitize it (e.g. personal data, secret keys)',\n\t\t\tname: 'guardrailsUsage',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Operation',\n\t\t\tname: 'operation',\n\t\t\ttype: 'options',\n\t\t\tnoDataExpression: true,\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Check Text for Violations',\n\t\t\t\t\tvalue: 'classify',\n\t\t\t\t\taction: 'Check text for violations',\n\t\t\t\t\tdescription: 'Validate text against a set of policies (e.g. NSFW, prompt injection)',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Sanitize Text',\n\t\t\t\t\tvalue: 'sanitize',\n\t\t\t\t\taction: 'Sanitize text',\n\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-excess-final-period\n\t\t\t\t\tdescription: 'Redact text to mask personal data, secret keys, URLs, etc.',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'classify',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Text To Check',\n\t\t\tname: 'text',\n\t\t\ttype: 'string',\n\t\t\trequired: true,\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Guardrails',\n\t\t\tname: 'guardrails',\n\t\t\tplaceholder: 'Add Guardrail',\n\t\t\ttype: 'collection',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Keywords',\n\t\t\t\t\tname: 'keywords',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'This guardrail checks if specified keywords appear in the input text and can be configured to trigger tripwires based on keyword matches. Multiple keywords can be added separated by comma.',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t'/operation': ['classify'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Jailbreak',\n\t\t\t\t\tname: 'jailbreak',\n\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\tdefault: { value: { threshold: 0.7 } },\n\t\t\t\t\tdescription: 'Detects attempts to jailbreak or bypass AI safety measures',\n\t\t\t\t\toptions: [wrapValue([THRESHOLD_OPTION, ...getPromptOption(JAILBREAK_PROMPT)])],\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t'/operation': ['classify'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'NSFW',\n\t\t\t\t\tname: 'nsfw',\n\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\tdefault: { value: { threshold: 0.7 } },\n\t\t\t\t\tdescription: 'Detects attempts to generate NSFW content',\n\t\t\t\t\toptions: [wrapValue([THRESHOLD_OPTION, ...getPromptOption(NSFW_SYSTEM_PROMPT)])],\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t'/operation': ['classify'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Personal Data (PII)',\n\t\t\t\t\tname: 'pii',\n\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\tdefault: { value: { type: 'all' } },\n\t\t\t\t\tdescription: 'Detects attempts to use personal data content',\n\t\t\t\t\toptions: [\n\t\t\t\t\t\twrapValue([\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Type',\n\t\t\t\t\t\t\t\tname: 'type',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{ name: 'All', value: 'all' },\n\t\t\t\t\t\t\t\t\t{ name: 'Selected', value: 'selected' },\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Entities',\n\t\t\t\t\t\t\t\tname: 'entities',\n\t\t\t\t\t\t\t\ttype: 'multiOptions',\n\t\t\t\t\t\t\t\tdefault: [],\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\ttype: ['selected'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\toptions: Object.values(PIIEntity).map((entity) => ({\n\t\t\t\t\t\t\t\t\tname: PII_NAME_MAP[entity],\n\t\t\t\t\t\t\t\t\tvalue: entity,\n\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Secret Keys',\n\t\t\t\t\tname: 'secretKeys',\n\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\tdefault: { value: { permissiveness: 'balanced' } },\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Detects attempts to use secret keys in the input text. Scans text for common patterns, applies entropy analysis to detect random-looking strings.',\n\t\t\t\t\toptions: [\n\t\t\t\t\t\twrapValue([\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Permissiveness',\n\t\t\t\t\t\t\t\tname: 'permissiveness',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Strict',\n\t\t\t\t\t\t\t\t\t\tvalue: 'strict',\n\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t'Most sensitive, may have more false positives (commonly flag high entropy filenames or code)',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Balanced',\n\t\t\t\t\t\t\t\t\t\tvalue: 'balanced',\n\t\t\t\t\t\t\t\t\t\tdescription: 'Balanced between sensitivity and specificity',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Permissive',\n\t\t\t\t\t\t\t\t\t\tvalue: 'permissive',\n\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t'Least sensitive, may miss some secret keys (but also reduces false positives)',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Topical Alignment',\n\t\t\t\t\tname: 'topicalAlignment',\n\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\tdefault: { value: { threshold: 0.7 } },\n\t\t\t\t\tdescription: 'Detects attempts to stray from the business scope',\n\t\t\t\t\toptions: [\n\t\t\t\t\t\twrapValue([\n\t\t\t\t\t\t\tTHRESHOLD_OPTION,\n\t\t\t\t\t\t\t...getPromptOption(\n\t\t\t\t\t\t\t\tTOPICAL_ALIGNMENT_SYSTEM_PROMPT,\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t'Make sure you replace the placeholder.',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t'/operation': ['classify'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'URLs',\n\t\t\t\t\tname: 'urls',\n\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\tdefault: { value: { allowedSchemes: ['https'], allowedUrls: '' } },\n\t\t\t\t\tdescription: 'Blocks URLs that are not in the allowed list',\n\t\t\t\t\toptions: [\n\t\t\t\t\t\twrapValue([\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Block All URLs Except',\n\t\t\t\t\t\t\t\tname: 'allowedUrls',\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t// keep placeholder to avoid limitation that removes collections with unchanged default values\n\t\t\t\t\t\t\t\tdefault: 'PLACEHOLDER',\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'Multiple URLs can be added separated by comma. Leave empty to block all URLs.',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Allowed Schemes',\n\t\t\t\t\t\t\t\tname: 'allowedSchemes',\n\t\t\t\t\t\t\t\ttype: 'multiOptions',\n\t\t\t\t\t\t\t\tdefault: ['https'],\n\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-multi-options-type-unsorted-items\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\t\t\t{ name: 'https', value: 'https' },\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\t\t\t{ name: 'http', value: 'http' },\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\t\t\t{ name: 'ftp', value: 'ftp' },\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\t\t\t{ name: 'data', value: 'data' },\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\t\t\t{ name: 'javascript', value: 'javascript' },\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\t\t\t{ name: 'vbscript', value: 'vbscript' },\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\t\t\t{ name: 'mailto', value: 'mailto' },\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Block Userinfo',\n\t\t\t\t\t\t\t\tname: 'blockUserinfo',\n\t\t\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'Whether to block URLs with userinfo (user:pass@domain) to prevent credential injection',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\t'/operation': ['classify'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Sanitize Userinfo',\n\t\t\t\t\t\t\t\tname: 'blockUserinfo',\n\t\t\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'Whether to sanitize URLs with userinfo (user:pass@domain) to prevent credential injection',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\t'/operation': ['sanitize'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Allow Subdomains',\n\t\t\t\t\t\t\t\tname: 'allowSubdomains',\n\t\t\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'Whether to allow subdomains (e.g. sub.domain.com if domain.com is allowed)',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom',\n\t\t\t\t\tname: 'custom',\n\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\tsortable: true,\n\t\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\t},\n\t\t\t\t\tplaceholder: 'Add Custom Guardrail',\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tguardrail: [{ name: 'Custom Guardrail' }],\n\t\t\t\t\t},\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Guardrail',\n\t\t\t\t\t\t\tname: 'guardrail',\n\t\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\tdescription: 'Name of the custom guardrail',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tTHRESHOLD_OPTION,\n\t\t\t\t\t\t\t\t...getPromptOption('', false),\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t'/operation': ['classify'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Regex',\n\t\t\t\t\tname: 'customRegex',\n\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\tsortable: true,\n\t\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\t},\n\t\t\t\t\tplaceholder: 'Add Custom Regex',\n\t\t\t\t\tdefault: {},\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Regex',\n\t\t\t\t\t\t\tname: 'regex',\n\t\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t'Name of the custom regex. Will be used for replacement when sanitizing.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdisplayName: 'Regex',\n\t\t\t\t\t\t\t\t\tname: 'value',\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\tdescription: 'Regex to match the input text',\n\t\t\t\t\t\t\t\t\tplaceholder: '/text/gi',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Customize System Message',\n\t\t\tname: 'customizeSystemMessage',\n\t\t\tdescription:\n\t\t\t\t'Whether to customize the system message used by the guardrail to specify the output format',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\t'/operation': ['classify'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'System Message',\n\t\t\tname: 'systemMessage',\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'The system message used by the guardrail to enforce thresholds and JSON output according to schema',\n\t\t\thint: 'This message is appended after prompts defined by guardrails',\n\t\t\tdefault: LLM_SYSTEM_RULES,\n\t\t\ttypeOptions: {\n\t\t\t\trows: 6,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\t'/customizeSystemMessage': [true],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqF;AAErF,uBAAiC;AACjC,kBAAmC;AACnC,iBAAwC;AACxC,8BAAgD;AAChD,iCAAoC;AACpC,mBAAiC;AAEjC,MAAM,mBAAoC;AAAA,EACzC,aAAa;AAAA,E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AgB;AAAA,QACf,MAAM;AAAA,UACL,2BAA2B,CAAC,IAAI;AAAA,QACjC;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,11 @@
1
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_762_16880)">
3
+ <path d="M35 21.8994C35 31.3978 28.4375 36.147 20.6375 38.9016C20.2291 39.0418 19.7854 39.0351 19.3813 38.8826C11.5625 36.147 5 31.3978 5 21.8994V8.60163C5 8.0978 5.19754 7.61461 5.54918 7.25835C5.90081 6.90209 6.37772 6.70194 6.875 6.70194C10.625 6.70194 15.3125 4.42233 18.575 1.53481C18.9722 1.19096 19.4775 1.00204 20 1.00204C20.5225 1.00204 21.0278 1.19096 21.425 1.53481C24.7063 4.44132 29.375 6.70194 33.125 6.70194C33.6223 6.70194 34.0992 6.90209 34.4508 7.25835C34.8025 7.61461 35 8.0978 35 8.60163V21.8994Z" stroke="#5699FF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M20 39.002V1.00204" stroke="#5699FF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
5
+ </g>
6
+ <defs>
7
+ <clipPath id="clip0_762_16880">
8
+ <rect width="40" height="40" fill="white"/>
9
+ </clipPath>
10
+ </defs>
11
+ </svg>
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var base_exports = {};
20
+ __export(base_exports, {
21
+ runStageGuardrails: () => runStageGuardrails
22
+ });
23
+ module.exports = __toCommonJS(base_exports);
24
+ var import_types = require("../actions/types");
25
+ const wrapInGuardrailError = (guardrailName, promise) => {
26
+ return promise.catch((error) => {
27
+ throw new import_types.GuardrailError(
28
+ guardrailName,
29
+ error?.description || error?.message || "Unknown error",
30
+ error?.description
31
+ );
32
+ });
33
+ };
34
+ async function runStageGuardrails({
35
+ stageGuardrails,
36
+ stage,
37
+ inputText,
38
+ failOnlyOnErrors
39
+ }) {
40
+ const guardrailPromises = [];
41
+ for (const guardrail of stageGuardrails[stage]) {
42
+ guardrailPromises.push(
43
+ wrapInGuardrailError(
44
+ guardrail.name,
45
+ // ensure the check is async
46
+ Promise.resolve().then(async () => await guardrail.check(inputText))
47
+ )
48
+ );
49
+ }
50
+ const results = await Promise.allSettled(guardrailPromises);
51
+ const passed = [];
52
+ const failed = [];
53
+ for (const result of results) {
54
+ const checkFailed = failOnlyOnErrors ? result.status === "rejected" || !!result.value.executionFailed : result.status === "rejected" || !!result.value.tripwireTriggered;
55
+ if (result.status === "fulfilled" && !checkFailed) {
56
+ passed.push(result);
57
+ } else {
58
+ failed.push(result);
59
+ }
60
+ }
61
+ return { passed, failed };
62
+ }
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ runStageGuardrails
66
+ });
67
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/Guardrails/helpers/base.ts"],"sourcesContent":["import {\n\ttype GuardrailResult,\n\tGuardrailError,\n\ttype GroupedGuardrailResults,\n\ttype StageGuardRails,\n} from '../actions/types';\n\ntype RunStageGuardrailsOptions = {\n\tstageGuardrails: StageGuardRails;\n\tstage: keyof StageGuardRails;\n\tinputText: string;\n\tfailOnlyOnErrors?: boolean;\n};\n\n// eslint-disable-next-line @typescript-eslint/promise-function-async\nconst wrapInGuardrailError = (guardrailName: string, promise: Promise<GuardrailResult>) => {\n\treturn promise.catch((error) => {\n\t\tthrow new GuardrailError(\n\t\t\tguardrailName,\n\t\t\terror?.description || error?.message || 'Unknown error',\n\t\t\terror?.description,\n\t\t);\n\t});\n};\n\nexport async function runStageGuardrails({\n\tstageGuardrails,\n\tstage,\n\tinputText,\n\tfailOnlyOnErrors,\n}: RunStageGuardrailsOptions): Promise<GroupedGuardrailResults> {\n\tconst guardrailPromises: Array<Promise<GuardrailResult>> = [];\n\tfor (const guardrail of stageGuardrails[stage]) {\n\t\tguardrailPromises.push(\n\t\t\twrapInGuardrailError(\n\t\t\t\tguardrail.name,\n\t\t\t\t// ensure the check is async\n\t\t\t\tPromise.resolve().then(async () => await guardrail.check(inputText)),\n\t\t\t),\n\t\t);\n\t}\n\tconst results = await Promise.allSettled(guardrailPromises);\n\tconst passed: Array<PromiseFulfilledResult<GuardrailResult>> = [];\n\tconst failed: Array<PromiseRejectedResult | PromiseFulfilledResult<GuardrailResult>> = [];\n\tfor (const result of results) {\n\t\tconst checkFailed = failOnlyOnErrors\n\t\t\t? result.status === 'rejected' || !!result.value.executionFailed\n\t\t\t: result.status === 'rejected' || !!result.value.tripwireTriggered;\n\t\tif (result.status === 'fulfilled' && !checkFailed) {\n\t\t\tpassed.push(result);\n\t\t} else {\n\t\t\tfailed.push(result);\n\t\t}\n\t}\n\treturn { passed, failed };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKO;AAUP,MAAM,uBAAuB,CAAC,eAAuB,YAAsC;AAC1F,SAAO,QAAQ,MAAM,CAAC,UAAU;AAC/B,UAAM,IAAI;AAAA,MACT;AAAA,MACA,OAAO,eAAe,OAAO,WAAW;AAAA,MACxC,OAAO;AAAA,IACR;AAAA,EACD,CAAC;AACF;AAEA,eAAsB,mBAAmB;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAgE;AAC/D,QAAM,oBAAqD,CAAC;AAC5D,aAAW,aAAa,gBAAgB,KAAK,GAAG;AAC/C,sBAAkB;AAAA,MACjB;AAAA,QACC,UAAU;AAAA;AAAA,QAEV,QAAQ,QAAQ,EAAE,KAAK,YAAY,MAAM,UAAU,MAAM,SAAS,CAAC;AAAA,MACpE;AAAA,IACD;AAAA,EACD;AACA,QAAM,UAAU,MAAM,QAAQ,WAAW,iBAAiB;AAC1D,QAAM,SAAyD,CAAC;AAChE,QAAM,SAAiF,CAAC;AACxF,aAAW,UAAU,SAAS;AAC7B,UAAM,cAAc,mBACjB,OAAO,WAAW,cAAc,CAAC,CAAC,OAAO,MAAM,kBAC/C,OAAO,WAAW,cAAc,CAAC,CAAC,OAAO,MAAM;AAClD,QAAI,OAAO,WAAW,eAAe,CAAC,aAAa;AAClD,aAAO,KAAK,MAAM;AAAA,IACnB,OAAO;AACN,aAAO,KAAK,MAAM;AAAA,IACnB;AAAA,EACD;AACA,SAAO,EAAE,QAAQ,OAAO;AACzB;","names":[]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var common_exports = {};
20
+ __export(common_exports, {
21
+ parseRegex: () => parseRegex,
22
+ splitByComma: () => splitByComma
23
+ });
24
+ module.exports = __toCommonJS(common_exports);
25
+ const splitByComma = (str) => {
26
+ return str.split(",").map((s) => s.trim()).filter((s) => s);
27
+ };
28
+ const parseRegex = (input) => {
29
+ const regexMatch = (input || "").toString().match(new RegExp("^/(.*?)/([gimusy]*)$"));
30
+ let regex;
31
+ if (!regexMatch) {
32
+ regex = new RegExp((input || "").toString());
33
+ } else if (regexMatch.length === 1) {
34
+ regex = new RegExp(regexMatch[1]);
35
+ } else {
36
+ regex = new RegExp(regexMatch[1], regexMatch[2]);
37
+ }
38
+ return regex;
39
+ };
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ parseRegex,
43
+ splitByComma
44
+ });
45
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/Guardrails/helpers/common.ts"],"sourcesContent":["export const splitByComma = (str: string) => {\n\treturn str\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter((s) => s);\n};\n\nexport const parseRegex = (input: string) => {\n\tconst regexMatch = (input || '').toString().match(new RegExp('^/(.*?)/([gimusy]*)$'));\n\n\tlet regex: RegExp;\n\tif (!regexMatch) {\n\t\tregex = new RegExp((input || '').toString());\n\t} else if (regexMatch.length === 1) {\n\t\tregex = new RegExp(regexMatch[1]);\n\t} else {\n\t\tregex = new RegExp(regexMatch[1], regexMatch[2]);\n\t}\n\n\treturn regex;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,eAAe,CAAC,QAAgB;AAC5C,SAAO,IACL,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,CAAC,MAAM,CAAC;AAClB;AAEO,MAAM,aAAa,CAAC,UAAkB;AAC5C,QAAM,cAAc,SAAS,IAAI,SAAS,EAAE,MAAM,IAAI,OAAO,sBAAsB,CAAC;AAEpF,MAAI;AACJ,MAAI,CAAC,YAAY;AAChB,YAAQ,IAAI,QAAQ,SAAS,IAAI,SAAS,CAAC;AAAA,EAC5C,WAAW,WAAW,WAAW,GAAG;AACnC,YAAQ,IAAI,OAAO,WAAW,CAAC,CAAC;AAAA,EACjC,OAAO;AACN,YAAQ,IAAI,OAAO,WAAW,CAAC,GAAG,WAAW,CAAC,CAAC;AAAA,EAChD;AAEA,SAAO;AACR;","names":[]}