@cognigy/rest-api-client 2025.22.0 → 2025.24.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 (39) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/apigroups/SimulationAPIGroup_2_0.js +2 -1
  3. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderOauth2Connection.js +3 -1
  4. package/build/shared/charts/descriptors/index.js +2 -0
  5. package/build/shared/charts/descriptors/nlu/matchPattern.js +1 -0
  6. package/build/shared/charts/descriptors/service/agentTools/knowledgeTool.js +340 -0
  7. package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +3 -2
  8. package/build/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +63 -30
  9. package/build/shared/charts/descriptors/service/handoverConnections.js +9 -1
  10. package/build/shared/charts/descriptors/service/index.js +4 -1
  11. package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +3 -2
  12. package/build/shared/interfaces/IProfile.js +6 -1
  13. package/build/shared/interfaces/resources/INodeDescriptorSet.js +11 -1
  14. package/build/shared/interfaces/resources/TRestChannelType.js +2 -2
  15. package/build/shared/interfaces/resources/settings/IAgentSettings.js +12 -7
  16. package/build/shared/interfaces/resources/settings/IPiiDataRedactionSettings.js +142 -0
  17. package/build/shared/interfaces/resources/settings/index.js +4 -1
  18. package/build/shared/interfaces/restAPI/resources/project/v2.0/settings/IAgentSettings_2_0.js +104 -0
  19. package/build/shared/interfaces/restAPI/simulation/persona/IGeneratePersonaFromTranscriptRest_2_0.js +20 -0
  20. package/dist/esm/apigroups/SimulationAPIGroup_2_0.js +2 -1
  21. package/dist/esm/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderOauth2Connection.js +3 -1
  22. package/dist/esm/shared/charts/descriptors/index.js +3 -1
  23. package/dist/esm/shared/charts/descriptors/nlu/matchPattern.js +1 -0
  24. package/dist/esm/shared/charts/descriptors/service/agentTools/knowledgeTool.js +338 -0
  25. package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +3 -2
  26. package/dist/esm/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +61 -29
  27. package/dist/esm/shared/charts/descriptors/service/handoverConnections.js +8 -0
  28. package/dist/esm/shared/charts/descriptors/service/index.js +2 -1
  29. package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +3 -2
  30. package/dist/esm/shared/interfaces/IProfile.js +5 -0
  31. package/dist/esm/shared/interfaces/resources/INodeDescriptorSet.js +11 -1
  32. package/dist/esm/shared/interfaces/resources/TRestChannelType.js +2 -2
  33. package/dist/esm/shared/interfaces/resources/settings/IAgentSettings.js +16 -11
  34. package/dist/esm/shared/interfaces/resources/settings/IPiiDataRedactionSettings.js +139 -0
  35. package/dist/esm/shared/interfaces/resources/settings/index.js +5 -4
  36. package/dist/esm/shared/interfaces/restAPI/resources/project/v2.0/settings/IAgentSettings_2_0.js +103 -1
  37. package/dist/esm/shared/interfaces/restAPI/simulation/persona/IGeneratePersonaFromTranscriptRest_2_0.js +19 -0
  38. package/package.json +1 -1
  39. package/types/index.d.ts +245 -18
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 2025.24.0
2
+ Released: November 25th, 2025
3
+
4
+ Released state of package up to date with Cognigy.AI v2025.24.0
5
+
6
+ # 2025.23.0
7
+ Released: November 11th, 2025
8
+
9
+ Released state of package up to date with Cognigy.AI v2025.23.0
10
+
1
11
  # 2025.22.0
2
12
  Released: October 28th, 2025
3
13
 
@@ -63,7 +63,8 @@ function SimulationAPIGroup_2_0(instance) {
63
63
  getPersonaOptions: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/options", "POST", self)(args, options),
64
64
  generatePersona: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/generate", "POST", self)(args, options),
65
65
  regeneratePersonaField: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/regenerate-field", "POST", self)(args, options),
66
- generateBulkPersona: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/generate-bulk", "POST", self)(args, options)
66
+ generateBulkPersona: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/generate-bulk", "POST", self)(args, options),
67
+ generatePersonaFromTranscript: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/from-transcript", "POST", self)(args, options)
67
68
  };
68
69
  }
69
70
  exports.SimulationAPIGroup_2_0 = SimulationAPIGroup_2_0;
@@ -8,7 +8,9 @@ exports.AZURE_OPEN_AI_OAUTH2_PROVIDER_CONNECTION = {
8
8
  { fieldName: "clientId", label: "UI__CONNECTION_EDITOR__FIELD_CLIENT_ID" },
9
9
  { fieldName: "clientSecret", label: "UI__CONNECTION_EDITOR__FIELD_CLIENT_SECRET" },
10
10
  { fieldName: "oauthUrl", label: "UI__CONNECTION_EDITOR__FIELD_OAUTH2_URL" },
11
- { fieldName: "scope", label: "UI__CONNECTION_EDITOR__FIELD_SCOPE" }
11
+ { fieldName: "scope", label: "UI__CONNECTION_EDITOR__FIELD_SCOPE" },
12
+ { fieldName: "additionalHeaderName", label: "UI__CONNECTION_EDITOR__FIELD_OAUTH2_ADDITIONAL_HEADER_NAME", required: false },
13
+ { fieldName: "additionalHeaderValue", label: "UI__CONNECTION_EDITOR__FIELD_OAUTH2_ADDITIONAL_HEADER_VALUE", required: false }
12
14
  ]
13
15
  };
14
16
  //# sourceMappingURL=azureOpenAIProviderOauth2Connection.js.map
@@ -149,6 +149,7 @@ if (process.env.DISABLE_FEATURE_TRANSCRIPT_MANAGER !== "true") {
149
149
  nodes.push(service_1.AI_AGENT_JOB_MCP_TOOL);
150
150
  nodes.push(service_1.AI_AGENT_JOB_CALL_MCP_TOOL);
151
151
  nodes.push(service_1.AI_AGENT_TOOL_ANSWER);
152
+ nodes.push(service_1.KNOWLEDGE_TOOL);
152
153
  nodes.push(service_1.AI_AGENT_HANDOVER);
153
154
  nodes.push(service_1.LOAD_AI_AGENT);
154
155
  }
@@ -174,6 +175,7 @@ exports.cognigyBasicModule = (0, createNodeDescriptor_1.createExtension)({
174
175
  service_1.GENESYS_CLOUD_CONNECTION_OM,
175
176
  service_1.NICECXONEAAH_AUTHENTICATION_CONNECTION,
176
177
  service_1.AIOPS_CENTER_WEBHOOKS_CONNECTION,
178
+ service_1.STORM_CONNECTION,
177
179
  ],
178
180
  });
179
181
  var mongoDB_1 = require("./connectionNodes/mongoDB");
@@ -63,6 +63,7 @@ exports.MATCH_PATTERN = (0, createNodeDescriptor_1.createNodeDescriptor)({
63
63
  description: "UI__NODE_EDITOR__NLU__MATCH_PATTERN__FIELDS__USE_FULL_SYSTEM_SLOT_TEXT_DESCRIPTION",
64
64
  type: "toggle",
65
65
  defaultValue: true,
66
+ fallbackValue: false
66
67
  }
67
68
  ],
68
69
  sections: [
@@ -0,0 +1,340 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KNOWLEDGE_TOOL = void 0;
4
+ /* Custom modules */
5
+ const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
6
+ const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
7
+ exports.KNOWLEDGE_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
8
+ type: "knowledgeTool",
9
+ defaultLabel: "Knowledge Tool",
10
+ parentType: ["aiAgentJob", "llmPromptV2"],
11
+ constraints: {
12
+ editable: true,
13
+ deletable: true,
14
+ collapsable: true,
15
+ creatable: true,
16
+ movable: true,
17
+ placement: {
18
+ predecessor: {
19
+ whitelist: []
20
+ }
21
+ },
22
+ childFlowCreatable: false
23
+ },
24
+ behavior: {
25
+ stopping: true
26
+ },
27
+ preview: {
28
+ type: "text",
29
+ key: "toolId"
30
+ },
31
+ fields: [
32
+ {
33
+ key: "knowledgeStoreId",
34
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__KNOWLEDGE_STORE__LABEL",
35
+ type: "knowledgeStoreSelect",
36
+ },
37
+ {
38
+ key: "toolId",
39
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__TOOL_ID__LABEL",
40
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__TOOL_ID__DESCRIPTION",
41
+ type: "cognigyLLMText",
42
+ defaultValue: "retrieve_knowledge_and_data",
43
+ params: {
44
+ required: true,
45
+ rows: 1,
46
+ multiline: false,
47
+ maxLength: 64,
48
+ }
49
+ },
50
+ {
51
+ key: "description",
52
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DESCRIPTION__LABEL",
53
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DESCRIPTION__DESCRIPTION",
54
+ type: "cognigyLLMText",
55
+ defaultValue: "Find the answer to general prompts or questions searching the attached data sources. It focuses exclusively on a knowledge search and does not execute tasks like small talk, calculations, or script running.",
56
+ params: {
57
+ required: true,
58
+ rows: 5,
59
+ multiline: true
60
+ }
61
+ },
62
+ {
63
+ key: "parameters",
64
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__PARAMETERS__LABEL",
65
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__PARAMETERS__DESCRIPTION",
66
+ type: "toolParameters",
67
+ defaultValue: `{
68
+ "type": "object",
69
+ "properties": {
70
+ "generated_prompt": {
71
+ "type": "string",
72
+ "description": "Generated question including the context of the conversation (I want to know...)."
73
+ },
74
+ "generated_buffer_phrase": {
75
+ "type": "string",
76
+ "description": "A generated delay or stalling phrase. Consider the context. Adapt to your speech style and language."
77
+ }
78
+ },
79
+ "required": ["generated_prompt", "generated_buffer_phrase"],
80
+ "additionalProperties": false
81
+ }`,
82
+ params: {
83
+ required: false,
84
+ },
85
+ },
86
+ {
87
+ key: "debugMessage",
88
+ type: "toggle",
89
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DEBUG_MESSAGE__LABEL",
90
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DEBUG_MESSAGE__DESCRIPTION",
91
+ defaultValue: true,
92
+ },
93
+ {
94
+ key: "condition",
95
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__CONDITION__LABEL",
96
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__CONDITION__DESCRIPTION",
97
+ type: "cognigyText",
98
+ defaultValue: "",
99
+ },
100
+ {
101
+ key: "topK",
102
+ type: "slider",
103
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__TOP_K__LABEL",
104
+ description: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__TOP_K__DESCRIPTION",
105
+ defaultValue: 5,
106
+ params: {
107
+ min: 1,
108
+ max: 10
109
+ }
110
+ },
111
+ {
112
+ key: "storeLocation",
113
+ type: "select",
114
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__STORE_LOCATION__LABEL",
115
+ params: {
116
+ options: [
117
+ {
118
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__STORE_LOCATION__OPTIONS__NONE__LABEL",
119
+ value: "none"
120
+ },
121
+ {
122
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__STORE_LOCATION__OPTIONS__INPUT__LABEL",
123
+ value: "input"
124
+ },
125
+ {
126
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__STORE_LOCATION__OPTIONS__CONTEXT__LABEL",
127
+ value: "context"
128
+ }
129
+ ],
130
+ },
131
+ defaultValue: "none"
132
+ },
133
+ {
134
+ key: "storeLocationInputKey",
135
+ type: "cognigyText",
136
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__INPUT_KEY__LABEL",
137
+ description: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__INPUT_KEY__DESCRIPTION",
138
+ defaultValue: "knowledgeSearch",
139
+ condition: {
140
+ key: "storeLocation",
141
+ value: "input"
142
+ }
143
+ },
144
+ {
145
+ key: "storeLocationContextKey",
146
+ type: "cognigyText",
147
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__CONTEXT_KEY__LABEL",
148
+ description: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__CONTEXT_KEY__DESCRIPTION",
149
+ defaultValue: "knowledgeSearch",
150
+ condition: {
151
+ key: "storeLocation",
152
+ value: "context"
153
+ }
154
+ },
155
+ {
156
+ key: "sourceTags",
157
+ type: "knowledgeSourceTags",
158
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__SOURCE_TAGS__LABEL",
159
+ description: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__SOURCE_TAGS__DESCRIPTION",
160
+ params: {
161
+ tagLimit: 5
162
+ }
163
+ },
164
+ {
165
+ key: "sourceTagsFilterOp",
166
+ type: "select",
167
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__SOURCE_TAGS_FILTER_OP__LABEL",
168
+ description: "UI__NODE_EDITOR__SEARCH_EXTRACT_OUTPUT__FIELDS__SOURCE_TAGS_FILTER_OP__DESCRIPTION",
169
+ defaultValue: "and",
170
+ params: {
171
+ options: [
172
+ {
173
+ label: "UI__NODE_EDITOR__SEARCH_EXTRACT_OUTPUT__FIELDS__SOURCE_TAGS_FILTER_OP__OPTIONS__AND__LABEL",
174
+ value: "and"
175
+ },
176
+ {
177
+ label: "UI__NODE_EDITOR__SEARCH_EXTRACT_OUTPUT__FIELDS__SOURCE_TAGS_FILTER_OP__OPTIONS__OR__LABEL",
178
+ value: "or"
179
+ },
180
+ ]
181
+ }
182
+ },
183
+ ],
184
+ sections: [
185
+ {
186
+ key: "debugging",
187
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__DEBUG_SETTINGS__LABEL",
188
+ defaultCollapsed: true,
189
+ fields: [
190
+ "debugMessage",
191
+ ],
192
+ },
193
+ {
194
+ key: "advanced",
195
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__ADVANCED__LABEL",
196
+ defaultCollapsed: true,
197
+ fields: [
198
+ "topK",
199
+ "storeLocation",
200
+ "storeLocationInputKey",
201
+ "storeLocationContextKey",
202
+ "sourceTags",
203
+ "sourceTagsFilterOp",
204
+ "condition",
205
+ ],
206
+ },
207
+ ],
208
+ form: [
209
+ { type: "field", key: "knowledgeStoreId" },
210
+ { type: "field", key: "toolId" },
211
+ { type: "field", key: "description" },
212
+ { type: "section", key: "debugging" },
213
+ { type: "section", key: "advanced" },
214
+ ],
215
+ appearance: {
216
+ color: "white",
217
+ textColor: "#252525",
218
+ variant: "mini",
219
+ },
220
+ function: async ({ cognigy, config, nodeId: thisNodeId }) => {
221
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
222
+ const { api, context, input } = cognigy;
223
+ const { knowledgeStoreId, debugMessage, topK, storeLocation, storeLocationInputKey, storeLocationContextKey, sourceTags, sourceTagsFilterOp, } = config;
224
+ const sessionState = await api.loadSessionState();
225
+ const toolCall = (_a = sessionState.lastToolCall) === null || _a === void 0 ? void 0 : _a.toolCall;
226
+ const aiAgentJobNode = (_b = sessionState.lastToolCall) === null || _b === void 0 ? void 0 : _b.aiAgentJobNode;
227
+ if (!(toolCall === null || toolCall === void 0 ? void 0 : toolCall.id)) {
228
+ (_c = api.logDebugError) === null || _c === void 0 ? void 0 : _c.call(api, "UI__DEBUG_MODE__AI_AGENT_ANSWER__ERROR__MESSAGE");
229
+ }
230
+ if (toolCall && aiAgentJobNode && knowledgeStoreId && (input.text || ((_e = (_d = toolCall === null || toolCall === void 0 ? void 0 : toolCall.function) === null || _d === void 0 ? void 0 : _d.arguments) === null || _e === void 0 ? void 0 : _e.generated_prompt))) {
231
+ if (!((_f = api.checkThink) === null || _f === void 0 ? void 0 : _f.call(api, thisNodeId))) {
232
+ let query = ((_h = (_g = toolCall === null || toolCall === void 0 ? void 0 : toolCall.function) === null || _g === void 0 ? void 0 : _g.arguments) === null || _h === void 0 ? void 0 : _h.generated_prompt) || input.text;
233
+ const data = {
234
+ language: input.language,
235
+ query,
236
+ topK,
237
+ traceId: input.traceId,
238
+ disableSensitiveLogging: false,
239
+ knowledgeStoreIds: [knowledgeStoreId],
240
+ };
241
+ const generated_buffer_phrase = (_k = (_j = toolCall === null || toolCall === void 0 ? void 0 : toolCall.function) === null || _j === void 0 ? void 0 : _j.arguments) === null || _k === void 0 ? void 0 : _k.generated_buffer_phrase;
242
+ if (generated_buffer_phrase) {
243
+ // output the generated buffer phrase. Don't add it to the transcript, else the LLM will repeat it next time.
244
+ await ((_l = api.output) === null || _l === void 0 ? void 0 : _l.call(api, generated_buffer_phrase, {
245
+ _cognigy: {
246
+ _preventTranscript: true
247
+ }
248
+ }));
249
+ }
250
+ if (sourceTags && sourceTags.length > 0) {
251
+ // convert each knowledgeSourceTag to a string
252
+ sourceTags.forEach((tag, index) => {
253
+ sourceTags[index] = tag.toString();
254
+ });
255
+ data.tagsData = {
256
+ tags: sourceTags,
257
+ op: sourceTagsFilterOp
258
+ };
259
+ }
260
+ const knowledgeSearchResponse = await api.knowledgeSearch(data);
261
+ // Handle possible response errors
262
+ if ((knowledgeSearchResponse === null || knowledgeSearchResponse === void 0 ? void 0 : knowledgeSearchResponse.status) !== "success") {
263
+ const errorMessage = (knowledgeSearchResponse === null || knowledgeSearchResponse === void 0 ? void 0 : knowledgeSearchResponse.error) || "empty";
264
+ throw new Error(`Error while performing knowledge search. Remote returned error: ${errorMessage}`);
265
+ }
266
+ // Store full response data in input or context
267
+ if (storeLocation === "input" && storeLocationInputKey) {
268
+ input[storeLocationInputKey] = knowledgeSearchResponse;
269
+ }
270
+ else if (storeLocation === "context" && storeLocationContextKey) {
271
+ context[storeLocationContextKey] = knowledgeSearchResponse;
272
+ }
273
+ const knowledgeSearchResponseData = knowledgeSearchResponse.data;
274
+ // Optional Debug Message of Knowledge Search Results
275
+ if (debugMessage) {
276
+ const messageLines = [];
277
+ if (query) {
278
+ messageLines.push(`\n<b>UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__SEARCH_PROMPT</b> ${query}`);
279
+ }
280
+ if ((_m = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _m === void 0 ? void 0 : _m.length) {
281
+ knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK.forEach((result, index) => {
282
+ var _a;
283
+ messageLines.push(`\nTop ${index + 1}:`);
284
+ messageLines.push(`Distance: ${result.distance}`);
285
+ messageLines.push(`Source Name: ${(_a = result.sourceMetaData) === null || _a === void 0 ? void 0 : _a.sourceName}`);
286
+ messageLines.push(`Text: ${result.text}`);
287
+ });
288
+ }
289
+ else {
290
+ messageLines.push("UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__NO_RESULTS");
291
+ }
292
+ (_o = api.logDebugMessage) === null || _o === void 0 ? void 0 : _o.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__HEADER");
293
+ }
294
+ const { flow, node } = aiAgentJobNode;
295
+ if (flow && node) {
296
+ // Add Tool Call Message to Transcript
297
+ const toolCallTranscriptStep = {
298
+ role: transcripts_1.TranscriptRole.ASSISTANT,
299
+ type: transcripts_1.TranscriptEntryType.TOOL_CALL,
300
+ source: "system",
301
+ payload: {
302
+ name: toolCall.function.name,
303
+ id: toolCall.id,
304
+ input: toolCall.function.arguments,
305
+ }
306
+ };
307
+ await api.addTranscriptStep(toolCallTranscriptStep);
308
+ // Add Tool Answer Message to Transcript
309
+ const toolAnswer = {
310
+ role: transcripts_1.TranscriptRole.TOOL,
311
+ type: transcripts_1.TranscriptEntryType.TOOL_ANSWER,
312
+ source: "system",
313
+ payload: {
314
+ toolCallId: toolCall.id,
315
+ name: toolCall.function.name,
316
+ content: `We have this context as answer from the knowledge source:\n${JSON.stringify(knowledgeSearchResponseData)}`,
317
+ }
318
+ };
319
+ await api.addTranscriptStep(toolAnswer);
320
+ api.resetNextNodes();
321
+ // remove the call from the session state, because the call has been answered
322
+ api.updateSessionStateValues({
323
+ lastToolCall: undefined
324
+ });
325
+ await api.executeFlow({
326
+ flowNode: {
327
+ flow,
328
+ node,
329
+ },
330
+ absorbContext: true,
331
+ });
332
+ }
333
+ }
334
+ else {
335
+ throw new Error("Infinite Loop Detected");
336
+ }
337
+ }
338
+ }
339
+ });
340
+ //# sourceMappingURL=knowledgeTool.js.map
@@ -24,7 +24,7 @@ const generateSearchPrompt_1 = require("./helpers/generateSearchPrompt");
24
24
  const getUserMemory_1 = require("./helpers/getUserMemory");
25
25
  const createToolDefinitions_1 = require("./helpers/createToolDefinitions");
26
26
  const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
27
- exports.AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool"];
27
+ exports.AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool", "knowledgeTool"];
28
28
  exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
29
29
  type: "aiAgentJob",
30
30
  defaultLabel: "AI Agent",
@@ -1208,6 +1208,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
1208
1208
  rolesWhiteList: [transcripts_1.TranscriptRole.USER, transcripts_1.TranscriptRole.ASSISTANT, transcripts_1.TranscriptRole.TOOL],
1209
1209
  excludeDataOnlyMessagesFilter: [transcripts_1.TranscriptRole.ASSISTANT],
1210
1210
  useTextAlternativeForLLM,
1211
+ excludeUserEventMessages: true,
1211
1212
  });
1212
1213
  // For knowledgeSearch "always", we enhance the user input with the knowledge search response data
1213
1214
  if (knowledgeSearchBehavior === "always" &&
@@ -1297,7 +1298,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
1297
1298
  // Find the child node with the toolId of the tool call
1298
1299
  let toolChild = undefined;
1299
1300
  for (const child of childConfigs) {
1300
- if (child.type === "aiAgentJobTool" && ((_5 = child.config) === null || _5 === void 0 ? void 0 : _5.toolId) && await api.parseCognigyScriptText((_6 = child.config) === null || _6 === void 0 ? void 0 : _6.toolId) === mainToolCall.function.name) {
1301
+ if (!["aiAgentJobDefault", "aiAgentJobMCPTool"].includes(child.type) && ((_5 = child.config) === null || _5 === void 0 ? void 0 : _5.toolId) && await api.parseCognigyScriptText((_6 = child.config) === null || _6 === void 0 ? void 0 : _6.toolId) === mainToolCall.function.name) {
1301
1302
  toolChild = child;
1302
1303
  break;
1303
1304
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createToolDefinitions = void 0;
3
+ exports.safeParseJson = exports.createToolDefinitions = void 0;
4
4
  const createSystemMessage_1 = require("./createSystemMessage");
5
5
  /**
6
6
  * Creates the tool definitions for the AI Agent Job and LLM Prompt v2 Nodes
@@ -35,35 +35,6 @@ const createToolDefinitions = async (childConfigs, api, useStrict) => {
35
35
  continue;
36
36
  }
37
37
  const toolId = child.config.toolId;
38
- if ((child.type === "aiAgentJobTool" || child.type === "llmPromptTool") &&
39
- (!child.config.condition || !!await api.parseCognigyScriptCondition(child.config.condition))) {
40
- if (!toolId) {
41
- throw new Error(`Tool ID is missing in Tool Node configuration.`);
42
- }
43
- const parsedToolId = await api.parseCognigyScriptText(toolId);
44
- if (!(0, createSystemMessage_1.validateToolId)(parsedToolId)) {
45
- throw new Error(`Tool ID ${parsedToolId} is not valid. Please use only alphanumeric characters, dashes and underscores.`);
46
- }
47
- if (toolIds.includes(parsedToolId)) {
48
- throw new Error(`Tool ID ${parsedToolId} is not unique. Please ensure each tool has a unique id.`);
49
- }
50
- toolIds.push(parsedToolId);
51
- toolNames.push(parsedToolId);
52
- const tool = {
53
- type: "function",
54
- function: {
55
- name: parsedToolId,
56
- description: await api.parseCognigyScriptText(child.config.description),
57
- },
58
- };
59
- if (useStrict) {
60
- tool.function.strict = true;
61
- }
62
- if (child.config.useParameters) {
63
- tool.function.parameters = child.config.parameters;
64
- }
65
- tools.push(tool);
66
- }
67
38
  if ((child.type === "aiAgentJobMCPTool" || child.type === "llmPromptMCPTool") &&
68
39
  (!child.config.condition || !!await api.parseCognigyScriptCondition(child.config.condition))) {
69
40
  if (!child.config.mcpServerUrl) {
@@ -168,6 +139,37 @@ const createToolDefinitions = async (childConfigs, api, useStrict) => {
168
139
  tools.push(...structuredMcpTools);
169
140
  }
170
141
  }
142
+ if (!["llmPromptMCPTool", "aiAgentJobMCPTool"].includes(child.type) && (!child.config.condition || !!await api.parseCognigyScriptCondition(child.config.condition))) {
143
+ if (!toolId) {
144
+ throw new Error(`Tool ID is missing in Tool Node configuration.`);
145
+ }
146
+ const parsedToolId = await api.parseCognigyScriptText(toolId);
147
+ if (!(0, createSystemMessage_1.validateToolId)(parsedToolId)) {
148
+ throw new Error(`Tool ID ${parsedToolId} is not valid. Please use only alphanumeric characters, dashes and underscores.`);
149
+ }
150
+ if (toolIds.includes(parsedToolId)) {
151
+ throw new Error(`Tool ID ${parsedToolId} is not unique. Please ensure each tool has a unique id.`);
152
+ }
153
+ toolIds.push(parsedToolId);
154
+ toolNames.push(parsedToolId);
155
+ const tool = {
156
+ type: "function",
157
+ function: {
158
+ name: parsedToolId,
159
+ description: await api.parseCognigyScriptText(child.config.description),
160
+ },
161
+ };
162
+ if (useStrict) {
163
+ tool.function.strict = true;
164
+ }
165
+ if (child.config.parameters && child.config.useParameters !== false) {
166
+ const parameters = safeParseJson(child.config.parameters);
167
+ if (parameters !== null) {
168
+ tool.function.parameters = parameters;
169
+ }
170
+ }
171
+ tools.push(tool);
172
+ }
171
173
  }
172
174
  ;
173
175
  return {
@@ -178,4 +180,35 @@ const createToolDefinitions = async (childConfigs, api, useStrict) => {
178
180
  };
179
181
  };
180
182
  exports.createToolDefinitions = createToolDefinitions;
183
+ /**
184
+ * Safely parses JSON with backwards compatibility for trailing commas.
185
+ *
186
+ * The trailing comma cleanup is required for backwards compatibility with the
187
+ * knowledge tool, which had invalid JSON (with trailing commas) in the initial
188
+ * release. Although the JSON wasn't actually used at that time due to parameters not being used,
189
+ * we need to handle it gracefully to support any stored configurations.
190
+ *
191
+ * @param raw - The value to parse. If already parsed (not a string), returns it as-is if truthy.
192
+ * @returns The parsed JSON object, the input value if already parsed, or null if parsing fails or input is falsy.
193
+ */
194
+ function safeParseJson(raw) {
195
+ // If not a string, return as-is if truthy, otherwise null
196
+ if (typeof raw !== "string") {
197
+ return raw || null;
198
+ }
199
+ try {
200
+ return JSON.parse(raw);
201
+ }
202
+ catch (_a) {
203
+ // Fallback: remove trailing commas before } or ]
204
+ const cleaned = raw.replace(/,\s*([}\]])/g, "$1");
205
+ try {
206
+ return JSON.parse(cleaned);
207
+ }
208
+ catch (_b) {
209
+ return null; // safe fallback instead of throwing
210
+ }
211
+ }
212
+ }
213
+ exports.safeParseJson = safeParseJson;
181
214
  //# sourceMappingURL=createToolDefinitions.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GENESYS_CLOUD_CONNECTION_OM = exports.GENESYS_CLOUD_CONNECTION = exports.EIGHT_BY_EIGHT_CONNECTION = exports.CHATWOOT_CONNECTION = exports.RINGCENTRAL_ENGAGE_CONNECTION = exports.LIVE_AGENT_CONNECTION = void 0;
3
+ exports.STORM_CONNECTION = exports.GENESYS_CLOUD_CONNECTION_OM = exports.GENESYS_CLOUD_CONNECTION = exports.EIGHT_BY_EIGHT_CONNECTION = exports.CHATWOOT_CONNECTION = exports.RINGCENTRAL_ENGAGE_CONNECTION = exports.LIVE_AGENT_CONNECTION = void 0;
4
4
  exports.LIVE_AGENT_CONNECTION = {
5
5
  type: "live_agent",
6
6
  label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__LIVE_AGENT_CONNECTION_AUTHENTICATION__LABEL",
@@ -48,4 +48,12 @@ exports.GENESYS_CLOUD_CONNECTION_OM = {
48
48
  { fieldName: "webhookSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__WEBHOOK_SECRET__LABEL" }
49
49
  ]
50
50
  };
51
+ exports.STORM_CONNECTION = {
52
+ type: "storm",
53
+ label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__STORM_CONNECTION_AUTHENTICATION__LABEL",
54
+ fields: [
55
+ { fieldName: "apiSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__STORM__API_SECRET__LABEL" },
56
+ { fieldName: "apiKey", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__STORM__API_KEY__LABEL" }
57
+ ]
58
+ };
51
59
  //# sourceMappingURL=handoverConnections.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AIOPS_CENTER_WEBHOOKS_CONNECTION = exports.NICECXONEAAH_AUTHENTICATION_CONNECTION = exports.GENESYS_CLOUD_CONNECTION_OM = exports.GENESYS_CLOUD_CONNECTION = exports.EIGHT_BY_EIGHT_CONNECTION = exports.CHATWOOT_CONNECTION = exports.RINGCENTRAL_ENGAGE_CONNECTION = exports.LIVE_AGENT_CONNECTION = exports.LOAD_AI_AGENT = exports.AI_AGENT_JOB_CALL_MCP_TOOL = exports.AI_AGENT_HANDOVER = exports.AI_AGENT_TOOL_ANSWER = exports.AI_AGENT_JOB_MCP_TOOL = exports.AI_AGENT_JOB_TOOL = exports.AI_AGENT_JOB_DEFAULT = exports.AI_AGENT_JOB = exports.LLM_MODERATE = exports.LLM_ENTITY_EXTRACT = exports.GPT_CONVERSATION_SUMMARY = exports.GPT_CONVERSATION = exports.HANDOVER_INACTIVITY_TIMER = exports.CLOSE_HANDOVER = exports.LLM_PROMPT_TOOL = exports.LLM_PROMPT_MCP_TOOL = exports.LLM_PROMPT_DEFAULT = exports.LLM_PROMPT_V2 = exports.GPT_PROMPT = exports.ON_SCHEDULING_ERROR = exports.ON_SCHEDULED = exports.TRIGGER_FUNCTION = exports.JWT_SECRET_CONNECTION = exports.HTTP_CONNECTION_OAUTH2 = exports.HTTP_CONNECTION_APIKEYXKEY = exports.HTTP_CONNECTION_APIKEYAUTHKEY = exports.HTTP_CONNECTION_BASIC = exports.HTTP_REQUEST = exports.CHECK_AGENT_AVAILABILITY = exports.HANDOVER_V2 = exports.HANDOVER = void 0;
3
+ exports.AIOPS_CENTER_WEBHOOKS_CONNECTION = exports.NICECXONEAAH_AUTHENTICATION_CONNECTION = exports.STORM_CONNECTION = exports.GENESYS_CLOUD_CONNECTION_OM = exports.GENESYS_CLOUD_CONNECTION = exports.EIGHT_BY_EIGHT_CONNECTION = exports.CHATWOOT_CONNECTION = exports.RINGCENTRAL_ENGAGE_CONNECTION = exports.LIVE_AGENT_CONNECTION = exports.LOAD_AI_AGENT = exports.KNOWLEDGE_TOOL = exports.AI_AGENT_JOB_CALL_MCP_TOOL = exports.AI_AGENT_HANDOVER = exports.AI_AGENT_TOOL_ANSWER = exports.AI_AGENT_JOB_MCP_TOOL = exports.AI_AGENT_JOB_TOOL = exports.AI_AGENT_JOB_DEFAULT = exports.AI_AGENT_JOB = exports.LLM_MODERATE = exports.LLM_ENTITY_EXTRACT = exports.GPT_CONVERSATION_SUMMARY = exports.GPT_CONVERSATION = exports.HANDOVER_INACTIVITY_TIMER = exports.CLOSE_HANDOVER = exports.LLM_PROMPT_TOOL = exports.LLM_PROMPT_MCP_TOOL = exports.LLM_PROMPT_DEFAULT = exports.LLM_PROMPT_V2 = exports.GPT_PROMPT = exports.ON_SCHEDULING_ERROR = exports.ON_SCHEDULED = exports.TRIGGER_FUNCTION = exports.JWT_SECRET_CONNECTION = exports.HTTP_CONNECTION_OAUTH2 = exports.HTTP_CONNECTION_APIKEYXKEY = exports.HTTP_CONNECTION_APIKEYAUTHKEY = exports.HTTP_CONNECTION_BASIC = exports.HTTP_REQUEST = exports.CHECK_AGENT_AVAILABILITY = exports.HANDOVER_V2 = exports.HANDOVER = void 0;
4
4
  var handover_1 = require("./handover");
5
5
  Object.defineProperty(exports, "HANDOVER", { enumerable: true, get: function () { return handover_1.HANDOVER; } });
6
6
  var handoverV2_1 = require("./handoverV2");
@@ -59,6 +59,8 @@ var aiAgentHandover_1 = require("./aiAgent/aiAgentHandover");
59
59
  Object.defineProperty(exports, "AI_AGENT_HANDOVER", { enumerable: true, get: function () { return aiAgentHandover_1.AI_AGENT_HANDOVER; } });
60
60
  var aiAgentJobCallMCPTool_1 = require("./aiAgent/aiAgentJobCallMCPTool");
61
61
  Object.defineProperty(exports, "AI_AGENT_JOB_CALL_MCP_TOOL", { enumerable: true, get: function () { return aiAgentJobCallMCPTool_1.AI_AGENT_JOB_CALL_MCP_TOOL; } });
62
+ var knowledgeTool_1 = require("./agentTools/knowledgeTool");
63
+ Object.defineProperty(exports, "KNOWLEDGE_TOOL", { enumerable: true, get: function () { return knowledgeTool_1.KNOWLEDGE_TOOL; } });
62
64
  var loadAiAgent_1 = require("./aiAgent/loadAiAgent");
63
65
  Object.defineProperty(exports, "LOAD_AI_AGENT", { enumerable: true, get: function () { return loadAiAgent_1.LOAD_AI_AGENT; } });
64
66
  var handoverConnections_1 = require("./handoverConnections");
@@ -68,6 +70,7 @@ Object.defineProperty(exports, "CHATWOOT_CONNECTION", { enumerable: true, get: f
68
70
  Object.defineProperty(exports, "EIGHT_BY_EIGHT_CONNECTION", { enumerable: true, get: function () { return handoverConnections_1.EIGHT_BY_EIGHT_CONNECTION; } });
69
71
  Object.defineProperty(exports, "GENESYS_CLOUD_CONNECTION", { enumerable: true, get: function () { return handoverConnections_1.GENESYS_CLOUD_CONNECTION; } });
70
72
  Object.defineProperty(exports, "GENESYS_CLOUD_CONNECTION_OM", { enumerable: true, get: function () { return handoverConnections_1.GENESYS_CLOUD_CONNECTION_OM; } });
73
+ Object.defineProperty(exports, "STORM_CONNECTION", { enumerable: true, get: function () { return handoverConnections_1.STORM_CONNECTION; } });
71
74
  var niceCXOneAAHAuthenticationConnection_1 = require("./niceCXOneAAHAuthenticationConnection");
72
75
  Object.defineProperty(exports, "NICECXONEAAH_AUTHENTICATION_CONNECTION", { enumerable: true, get: function () { return niceCXOneAAHAuthenticationConnection_1.NICECXONEAAH_AUTHENTICATION_CONNECTION; } });
73
76
  var aiOpsCenterConnection_1 = require("./aiOpsCenterConnection");
@@ -29,7 +29,7 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
29
29
  collapsable: true,
30
30
  placement: {
31
31
  children: {
32
- whitelist: ["llmPromptDefault", "llmPromptTool", "llmPromptMCPTool"],
32
+ whitelist: ["llmPromptDefault", "llmPromptTool", "llmPromptMCPTool", "knowledgeTool"],
33
33
  },
34
34
  },
35
35
  },
@@ -856,6 +856,7 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
856
856
  rolesWhiteList: [transcripts_1.TranscriptRole.USER, transcripts_1.TranscriptRole.ASSISTANT, transcripts_1.TranscriptRole.TOOL],
857
857
  excludeDataOnlyMessagesFilter: [transcripts_1.TranscriptRole.ASSISTANT],
858
858
  useTextAlternativeForLLM,
859
+ excludeUserEventMessages: true,
859
860
  });
860
861
  llmPromptOptions["transcript"] = transcript;
861
862
  llmPromptOptions["chat"] = [{
@@ -901,7 +902,7 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
901
902
  // Find the child node with the toolId of the tool call
902
903
  let toolChild = undefined;
903
904
  for (const child of childConfigs) {
904
- if (child.type === "llmPromptTool" && ((_e = child.config) === null || _e === void 0 ? void 0 : _e.toolId) && await api.parseCognigyScriptText((_f = child.config) === null || _f === void 0 ? void 0 : _f.toolId) === mainToolCall.function.name) {
905
+ if (!["llmPromptDefault", "llmPromptMCPTool"].includes(child.type) && ((_e = child.config) === null || _e === void 0 ? void 0 : _e.toolId) && await api.parseCognigyScriptText((_f = child.config) === null || _f === void 0 ? void 0 : _f.toolId) === mainToolCall.function.name) {
905
906
  toolChild = child;
906
907
  break;
907
908
  }
@@ -1,17 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.profileQuerySchema = exports.profileSchema = exports.profileDataSchema = void 0;
3
+ exports.profileQuerySchema = exports.profileSchema = exports.profileDataSchema = exports.profileTypes = void 0;
4
4
  /* Custom Modules */
5
5
  const createQuerySchema_1 = require("../helper/createQuerySchema");
6
6
  const IEntityMeta_1 = require("./resources/IEntityMeta");
7
7
  ;
8
8
  ;
9
+ exports.profileTypes = [
10
+ "simulator",
11
+ "regular" // profiles that are not simulator. In db they will not have a type field for backward compatibility reasons.
12
+ ];
9
13
  exports.profileDataSchema = {
10
14
  title: "profileDataSchema",
11
15
  type: "object",
12
16
  additionalProperties: false,
13
17
  properties: {
14
18
  active: { type: "boolean" },
19
+ type: { type: "string", enum: [...exports.profileTypes] },
15
20
  contactIds: { type: "array", items: { type: "string" }, additionalItems: false, minItems: 1 },
16
21
  contactIdsHash: { type: "string" },
17
22
  expiresAt: { type: "object" },