@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
@@ -0,0 +1,338 @@
1
+ import { __awaiter } from "tslib";
2
+ /* Custom modules */
3
+ import { createNodeDescriptor } from "../../../createNodeDescriptor";
4
+ import { TranscriptEntryType, TranscriptRole } from "../../../../interfaces/transcripts/transcripts";
5
+ export const KNOWLEDGE_TOOL = createNodeDescriptor({
6
+ type: "knowledgeTool",
7
+ defaultLabel: "Knowledge Tool",
8
+ parentType: ["aiAgentJob", "llmPromptV2"],
9
+ constraints: {
10
+ editable: true,
11
+ deletable: true,
12
+ collapsable: true,
13
+ creatable: true,
14
+ movable: true,
15
+ placement: {
16
+ predecessor: {
17
+ whitelist: []
18
+ }
19
+ },
20
+ childFlowCreatable: false
21
+ },
22
+ behavior: {
23
+ stopping: true
24
+ },
25
+ preview: {
26
+ type: "text",
27
+ key: "toolId"
28
+ },
29
+ fields: [
30
+ {
31
+ key: "knowledgeStoreId",
32
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__KNOWLEDGE_STORE__LABEL",
33
+ type: "knowledgeStoreSelect",
34
+ },
35
+ {
36
+ key: "toolId",
37
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__TOOL_ID__LABEL",
38
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__TOOL_ID__DESCRIPTION",
39
+ type: "cognigyLLMText",
40
+ defaultValue: "retrieve_knowledge_and_data",
41
+ params: {
42
+ required: true,
43
+ rows: 1,
44
+ multiline: false,
45
+ maxLength: 64,
46
+ }
47
+ },
48
+ {
49
+ key: "description",
50
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DESCRIPTION__LABEL",
51
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DESCRIPTION__DESCRIPTION",
52
+ type: "cognigyLLMText",
53
+ 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.",
54
+ params: {
55
+ required: true,
56
+ rows: 5,
57
+ multiline: true
58
+ }
59
+ },
60
+ {
61
+ key: "parameters",
62
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__PARAMETERS__LABEL",
63
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__PARAMETERS__DESCRIPTION",
64
+ type: "toolParameters",
65
+ defaultValue: `{
66
+ "type": "object",
67
+ "properties": {
68
+ "generated_prompt": {
69
+ "type": "string",
70
+ "description": "Generated question including the context of the conversation (I want to know...)."
71
+ },
72
+ "generated_buffer_phrase": {
73
+ "type": "string",
74
+ "description": "A generated delay or stalling phrase. Consider the context. Adapt to your speech style and language."
75
+ }
76
+ },
77
+ "required": ["generated_prompt", "generated_buffer_phrase"],
78
+ "additionalProperties": false
79
+ }`,
80
+ params: {
81
+ required: false,
82
+ },
83
+ },
84
+ {
85
+ key: "debugMessage",
86
+ type: "toggle",
87
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DEBUG_MESSAGE__LABEL",
88
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DEBUG_MESSAGE__DESCRIPTION",
89
+ defaultValue: true,
90
+ },
91
+ {
92
+ key: "condition",
93
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__CONDITION__LABEL",
94
+ description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__CONDITION__DESCRIPTION",
95
+ type: "cognigyText",
96
+ defaultValue: "",
97
+ },
98
+ {
99
+ key: "topK",
100
+ type: "slider",
101
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__TOP_K__LABEL",
102
+ description: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__TOP_K__DESCRIPTION",
103
+ defaultValue: 5,
104
+ params: {
105
+ min: 1,
106
+ max: 10
107
+ }
108
+ },
109
+ {
110
+ key: "storeLocation",
111
+ type: "select",
112
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__STORE_LOCATION__LABEL",
113
+ params: {
114
+ options: [
115
+ {
116
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__STORE_LOCATION__OPTIONS__NONE__LABEL",
117
+ value: "none"
118
+ },
119
+ {
120
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__STORE_LOCATION__OPTIONS__INPUT__LABEL",
121
+ value: "input"
122
+ },
123
+ {
124
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_KNOWLEDGE_TOOL__FIELDS__STORE_LOCATION__OPTIONS__CONTEXT__LABEL",
125
+ value: "context"
126
+ }
127
+ ],
128
+ },
129
+ defaultValue: "none"
130
+ },
131
+ {
132
+ key: "storeLocationInputKey",
133
+ type: "cognigyText",
134
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__INPUT_KEY__LABEL",
135
+ description: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__INPUT_KEY__DESCRIPTION",
136
+ defaultValue: "knowledgeSearch",
137
+ condition: {
138
+ key: "storeLocation",
139
+ value: "input"
140
+ }
141
+ },
142
+ {
143
+ key: "storeLocationContextKey",
144
+ type: "cognigyText",
145
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__CONTEXT_KEY__LABEL",
146
+ description: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__CONTEXT_KEY__DESCRIPTION",
147
+ defaultValue: "knowledgeSearch",
148
+ condition: {
149
+ key: "storeLocation",
150
+ value: "context"
151
+ }
152
+ },
153
+ {
154
+ key: "sourceTags",
155
+ type: "knowledgeSourceTags",
156
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__SOURCE_TAGS__LABEL",
157
+ description: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__SOURCE_TAGS__DESCRIPTION",
158
+ params: {
159
+ tagLimit: 5
160
+ }
161
+ },
162
+ {
163
+ key: "sourceTagsFilterOp",
164
+ type: "select",
165
+ label: "UI__NODE_EDITOR__KNOWLEDGE_SEARCH__SOURCE_TAGS_FILTER_OP__LABEL",
166
+ description: "UI__NODE_EDITOR__SEARCH_EXTRACT_OUTPUT__FIELDS__SOURCE_TAGS_FILTER_OP__DESCRIPTION",
167
+ defaultValue: "and",
168
+ params: {
169
+ options: [
170
+ {
171
+ label: "UI__NODE_EDITOR__SEARCH_EXTRACT_OUTPUT__FIELDS__SOURCE_TAGS_FILTER_OP__OPTIONS__AND__LABEL",
172
+ value: "and"
173
+ },
174
+ {
175
+ label: "UI__NODE_EDITOR__SEARCH_EXTRACT_OUTPUT__FIELDS__SOURCE_TAGS_FILTER_OP__OPTIONS__OR__LABEL",
176
+ value: "or"
177
+ },
178
+ ]
179
+ }
180
+ },
181
+ ],
182
+ sections: [
183
+ {
184
+ key: "debugging",
185
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__DEBUG_SETTINGS__LABEL",
186
+ defaultCollapsed: true,
187
+ fields: [
188
+ "debugMessage",
189
+ ],
190
+ },
191
+ {
192
+ key: "advanced",
193
+ label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__ADVANCED__LABEL",
194
+ defaultCollapsed: true,
195
+ fields: [
196
+ "topK",
197
+ "storeLocation",
198
+ "storeLocationInputKey",
199
+ "storeLocationContextKey",
200
+ "sourceTags",
201
+ "sourceTagsFilterOp",
202
+ "condition",
203
+ ],
204
+ },
205
+ ],
206
+ form: [
207
+ { type: "field", key: "knowledgeStoreId" },
208
+ { type: "field", key: "toolId" },
209
+ { type: "field", key: "description" },
210
+ { type: "section", key: "debugging" },
211
+ { type: "section", key: "advanced" },
212
+ ],
213
+ appearance: {
214
+ color: "white",
215
+ textColor: "#252525",
216
+ variant: "mini",
217
+ },
218
+ function: ({ cognigy, config, nodeId: thisNodeId }) => __awaiter(void 0, void 0, void 0, function* () {
219
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
220
+ const { api, context, input } = cognigy;
221
+ const { knowledgeStoreId, debugMessage, topK, storeLocation, storeLocationInputKey, storeLocationContextKey, sourceTags, sourceTagsFilterOp, } = config;
222
+ const sessionState = yield api.loadSessionState();
223
+ const toolCall = (_a = sessionState.lastToolCall) === null || _a === void 0 ? void 0 : _a.toolCall;
224
+ const aiAgentJobNode = (_b = sessionState.lastToolCall) === null || _b === void 0 ? void 0 : _b.aiAgentJobNode;
225
+ if (!(toolCall === null || toolCall === void 0 ? void 0 : toolCall.id)) {
226
+ (_c = api.logDebugError) === null || _c === void 0 ? void 0 : _c.call(api, "UI__DEBUG_MODE__AI_AGENT_ANSWER__ERROR__MESSAGE");
227
+ }
228
+ 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))) {
229
+ if (!((_f = api.checkThink) === null || _f === void 0 ? void 0 : _f.call(api, thisNodeId))) {
230
+ 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;
231
+ const data = {
232
+ language: input.language,
233
+ query,
234
+ topK,
235
+ traceId: input.traceId,
236
+ disableSensitiveLogging: false,
237
+ knowledgeStoreIds: [knowledgeStoreId],
238
+ };
239
+ 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;
240
+ if (generated_buffer_phrase) {
241
+ // output the generated buffer phrase. Don't add it to the transcript, else the LLM will repeat it next time.
242
+ yield ((_l = api.output) === null || _l === void 0 ? void 0 : _l.call(api, generated_buffer_phrase, {
243
+ _cognigy: {
244
+ _preventTranscript: true
245
+ }
246
+ }));
247
+ }
248
+ if (sourceTags && sourceTags.length > 0) {
249
+ // convert each knowledgeSourceTag to a string
250
+ sourceTags.forEach((tag, index) => {
251
+ sourceTags[index] = tag.toString();
252
+ });
253
+ data.tagsData = {
254
+ tags: sourceTags,
255
+ op: sourceTagsFilterOp
256
+ };
257
+ }
258
+ const knowledgeSearchResponse = yield api.knowledgeSearch(data);
259
+ // Handle possible response errors
260
+ if ((knowledgeSearchResponse === null || knowledgeSearchResponse === void 0 ? void 0 : knowledgeSearchResponse.status) !== "success") {
261
+ const errorMessage = (knowledgeSearchResponse === null || knowledgeSearchResponse === void 0 ? void 0 : knowledgeSearchResponse.error) || "empty";
262
+ throw new Error(`Error while performing knowledge search. Remote returned error: ${errorMessage}`);
263
+ }
264
+ // Store full response data in input or context
265
+ if (storeLocation === "input" && storeLocationInputKey) {
266
+ input[storeLocationInputKey] = knowledgeSearchResponse;
267
+ }
268
+ else if (storeLocation === "context" && storeLocationContextKey) {
269
+ context[storeLocationContextKey] = knowledgeSearchResponse;
270
+ }
271
+ const knowledgeSearchResponseData = knowledgeSearchResponse.data;
272
+ // Optional Debug Message of Knowledge Search Results
273
+ if (debugMessage) {
274
+ const messageLines = [];
275
+ if (query) {
276
+ messageLines.push(`\n<b>UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__SEARCH_PROMPT</b> ${query}`);
277
+ }
278
+ if ((_m = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _m === void 0 ? void 0 : _m.length) {
279
+ knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK.forEach((result, index) => {
280
+ var _a;
281
+ messageLines.push(`\nTop ${index + 1}:`);
282
+ messageLines.push(`Distance: ${result.distance}`);
283
+ messageLines.push(`Source Name: ${(_a = result.sourceMetaData) === null || _a === void 0 ? void 0 : _a.sourceName}`);
284
+ messageLines.push(`Text: ${result.text}`);
285
+ });
286
+ }
287
+ else {
288
+ messageLines.push("UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__NO_RESULTS");
289
+ }
290
+ (_o = api.logDebugMessage) === null || _o === void 0 ? void 0 : _o.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__HEADER");
291
+ }
292
+ const { flow, node } = aiAgentJobNode;
293
+ if (flow && node) {
294
+ // Add Tool Call Message to Transcript
295
+ const toolCallTranscriptStep = {
296
+ role: TranscriptRole.ASSISTANT,
297
+ type: TranscriptEntryType.TOOL_CALL,
298
+ source: "system",
299
+ payload: {
300
+ name: toolCall.function.name,
301
+ id: toolCall.id,
302
+ input: toolCall.function.arguments,
303
+ }
304
+ };
305
+ yield api.addTranscriptStep(toolCallTranscriptStep);
306
+ // Add Tool Answer Message to Transcript
307
+ const toolAnswer = {
308
+ role: TranscriptRole.TOOL,
309
+ type: TranscriptEntryType.TOOL_ANSWER,
310
+ source: "system",
311
+ payload: {
312
+ toolCallId: toolCall.id,
313
+ name: toolCall.function.name,
314
+ content: `We have this context as answer from the knowledge source:\n${JSON.stringify(knowledgeSearchResponseData)}`,
315
+ }
316
+ };
317
+ yield api.addTranscriptStep(toolAnswer);
318
+ api.resetNextNodes();
319
+ // remove the call from the session state, because the call has been answered
320
+ api.updateSessionStateValues({
321
+ lastToolCall: undefined
322
+ });
323
+ yield api.executeFlow({
324
+ flowNode: {
325
+ flow,
326
+ node,
327
+ },
328
+ absorbContext: true,
329
+ });
330
+ }
331
+ }
332
+ else {
333
+ throw new Error("Infinite Loop Detected");
334
+ }
335
+ }
336
+ })
337
+ });
338
+ //# sourceMappingURL=knowledgeTool.js.map
@@ -11,7 +11,7 @@ import { generateSearchPrompt } from "./helpers/generateSearchPrompt";
11
11
  import { getUserMemory } from "./helpers/getUserMemory";
12
12
  import { createToolDefinitions } from "./helpers/createToolDefinitions";
13
13
  import { TranscriptEntryType, TranscriptRole } from "../../../../interfaces/transcripts/transcripts";
14
- export const AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool"];
14
+ export const AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool", "knowledgeTool"];
15
15
  export const AI_AGENT_JOB = createNodeDescriptor({
16
16
  type: "aiAgentJob",
17
17
  defaultLabel: "AI Agent",
@@ -1195,6 +1195,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
1195
1195
  rolesWhiteList: [TranscriptRole.USER, TranscriptRole.ASSISTANT, TranscriptRole.TOOL],
1196
1196
  excludeDataOnlyMessagesFilter: [TranscriptRole.ASSISTANT],
1197
1197
  useTextAlternativeForLLM,
1198
+ excludeUserEventMessages: true,
1198
1199
  });
1199
1200
  // For knowledgeSearch "always", we enhance the user input with the knowledge search response data
1200
1201
  if (knowledgeSearchBehavior === "always" &&
@@ -1284,7 +1285,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
1284
1285
  // Find the child node with the toolId of the tool call
1285
1286
  let toolChild = undefined;
1286
1287
  for (const child of childConfigs) {
1287
- if (child.type === "aiAgentJobTool" && ((_5 = child.config) === null || _5 === void 0 ? void 0 : _5.toolId) && (yield api.parseCognigyScriptText((_6 = child.config) === null || _6 === void 0 ? void 0 : _6.toolId)) === mainToolCall.function.name) {
1288
+ if (!["aiAgentJobDefault", "aiAgentJobMCPTool"].includes(child.type) && ((_5 = child.config) === null || _5 === void 0 ? void 0 : _5.toolId) && (yield api.parseCognigyScriptText((_6 = child.config) === null || _6 === void 0 ? void 0 : _6.toolId)) === mainToolCall.function.name) {
1288
1289
  toolChild = child;
1289
1290
  break;
1290
1291
  }
@@ -33,35 +33,6 @@ export const createToolDefinitions = (childConfigs, api, useStrict) => __awaiter
33
33
  continue;
34
34
  }
35
35
  const toolId = child.config.toolId;
36
- if ((child.type === "aiAgentJobTool" || child.type === "llmPromptTool") &&
37
- (!child.config.condition || !!(yield api.parseCognigyScriptCondition(child.config.condition)))) {
38
- if (!toolId) {
39
- throw new Error(`Tool ID is missing in Tool Node configuration.`);
40
- }
41
- const parsedToolId = yield api.parseCognigyScriptText(toolId);
42
- if (!validateToolId(parsedToolId)) {
43
- throw new Error(`Tool ID ${parsedToolId} is not valid. Please use only alphanumeric characters, dashes and underscores.`);
44
- }
45
- if (toolIds.includes(parsedToolId)) {
46
- throw new Error(`Tool ID ${parsedToolId} is not unique. Please ensure each tool has a unique id.`);
47
- }
48
- toolIds.push(parsedToolId);
49
- toolNames.push(parsedToolId);
50
- const tool = {
51
- type: "function",
52
- function: {
53
- name: parsedToolId,
54
- description: yield api.parseCognigyScriptText(child.config.description),
55
- },
56
- };
57
- if (useStrict) {
58
- tool.function.strict = true;
59
- }
60
- if (child.config.useParameters) {
61
- tool.function.parameters = child.config.parameters;
62
- }
63
- tools.push(tool);
64
- }
65
36
  if ((child.type === "aiAgentJobMCPTool" || child.type === "llmPromptMCPTool") &&
66
37
  (!child.config.condition || !!(yield api.parseCognigyScriptCondition(child.config.condition)))) {
67
38
  if (!child.config.mcpServerUrl) {
@@ -166,6 +137,37 @@ export const createToolDefinitions = (childConfigs, api, useStrict) => __awaiter
166
137
  tools.push(...structuredMcpTools);
167
138
  }
168
139
  }
140
+ if (!["llmPromptMCPTool", "aiAgentJobMCPTool"].includes(child.type) && (!child.config.condition || !!(yield api.parseCognigyScriptCondition(child.config.condition)))) {
141
+ if (!toolId) {
142
+ throw new Error(`Tool ID is missing in Tool Node configuration.`);
143
+ }
144
+ const parsedToolId = yield api.parseCognigyScriptText(toolId);
145
+ if (!validateToolId(parsedToolId)) {
146
+ throw new Error(`Tool ID ${parsedToolId} is not valid. Please use only alphanumeric characters, dashes and underscores.`);
147
+ }
148
+ if (toolIds.includes(parsedToolId)) {
149
+ throw new Error(`Tool ID ${parsedToolId} is not unique. Please ensure each tool has a unique id.`);
150
+ }
151
+ toolIds.push(parsedToolId);
152
+ toolNames.push(parsedToolId);
153
+ const tool = {
154
+ type: "function",
155
+ function: {
156
+ name: parsedToolId,
157
+ description: yield api.parseCognigyScriptText(child.config.description),
158
+ },
159
+ };
160
+ if (useStrict) {
161
+ tool.function.strict = true;
162
+ }
163
+ if (child.config.parameters && child.config.useParameters !== false) {
164
+ const parameters = safeParseJson(child.config.parameters);
165
+ if (parameters !== null) {
166
+ tool.function.parameters = parameters;
167
+ }
168
+ }
169
+ tools.push(tool);
170
+ }
169
171
  }
170
172
  ;
171
173
  return {
@@ -175,4 +177,34 @@ export const createToolDefinitions = (childConfigs, api, useStrict) => __awaiter
175
177
  tools,
176
178
  };
177
179
  });
180
+ /**
181
+ * Safely parses JSON with backwards compatibility for trailing commas.
182
+ *
183
+ * The trailing comma cleanup is required for backwards compatibility with the
184
+ * knowledge tool, which had invalid JSON (with trailing commas) in the initial
185
+ * release. Although the JSON wasn't actually used at that time due to parameters not being used,
186
+ * we need to handle it gracefully to support any stored configurations.
187
+ *
188
+ * @param raw - The value to parse. If already parsed (not a string), returns it as-is if truthy.
189
+ * @returns The parsed JSON object, the input value if already parsed, or null if parsing fails or input is falsy.
190
+ */
191
+ export function safeParseJson(raw) {
192
+ // If not a string, return as-is if truthy, otherwise null
193
+ if (typeof raw !== "string") {
194
+ return raw || null;
195
+ }
196
+ try {
197
+ return JSON.parse(raw);
198
+ }
199
+ catch (_a) {
200
+ // Fallback: remove trailing commas before } or ]
201
+ const cleaned = raw.replace(/,\s*([}\]])/g, "$1");
202
+ try {
203
+ return JSON.parse(cleaned);
204
+ }
205
+ catch (_b) {
206
+ return null; // safe fallback instead of throwing
207
+ }
208
+ }
209
+ }
178
210
  //# sourceMappingURL=createToolDefinitions.js.map
@@ -45,4 +45,12 @@ export const GENESYS_CLOUD_CONNECTION_OM = {
45
45
  { fieldName: "webhookSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__WEBHOOK_SECRET__LABEL" }
46
46
  ]
47
47
  };
48
+ export const STORM_CONNECTION = {
49
+ type: "storm",
50
+ label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__STORM_CONNECTION_AUTHENTICATION__LABEL",
51
+ fields: [
52
+ { fieldName: "apiSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__STORM__API_SECRET__LABEL" },
53
+ { fieldName: "apiKey", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__STORM__API_KEY__LABEL" }
54
+ ]
55
+ };
48
56
  //# sourceMappingURL=handoverConnections.js.map
@@ -28,8 +28,9 @@ export { AI_AGENT_JOB_MCP_TOOL } from "./aiAgent/aiAgentJobMCPTool";
28
28
  export { AI_AGENT_TOOL_ANSWER } from "./aiAgent/aiAgentToolAnswer";
29
29
  export { AI_AGENT_HANDOVER } from "./aiAgent/aiAgentHandover";
30
30
  export { AI_AGENT_JOB_CALL_MCP_TOOL } from "./aiAgent/aiAgentJobCallMCPTool";
31
+ export { KNOWLEDGE_TOOL } from "./agentTools/knowledgeTool";
31
32
  export { LOAD_AI_AGENT } from "./aiAgent/loadAiAgent";
32
- export { LIVE_AGENT_CONNECTION, RINGCENTRAL_ENGAGE_CONNECTION, CHATWOOT_CONNECTION, EIGHT_BY_EIGHT_CONNECTION, GENESYS_CLOUD_CONNECTION, GENESYS_CLOUD_CONNECTION_OM } from "./handoverConnections";
33
+ export { LIVE_AGENT_CONNECTION, RINGCENTRAL_ENGAGE_CONNECTION, CHATWOOT_CONNECTION, EIGHT_BY_EIGHT_CONNECTION, GENESYS_CLOUD_CONNECTION, GENESYS_CLOUD_CONNECTION_OM, STORM_CONNECTION } from "./handoverConnections";
33
34
  export { NICECXONEAAH_AUTHENTICATION_CONNECTION } from "./niceCXOneAAHAuthenticationConnection";
34
35
  export { AIOPS_CENTER_WEBHOOKS_CONNECTION } from "./aiOpsCenterConnection";
35
36
  //# sourceMappingURL=index.js.map
@@ -16,7 +16,7 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
16
16
  collapsable: true,
17
17
  placement: {
18
18
  children: {
19
- whitelist: ["llmPromptDefault", "llmPromptTool", "llmPromptMCPTool"],
19
+ whitelist: ["llmPromptDefault", "llmPromptTool", "llmPromptMCPTool", "knowledgeTool"],
20
20
  },
21
21
  },
22
22
  },
@@ -843,6 +843,7 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
843
843
  rolesWhiteList: [TranscriptRole.USER, TranscriptRole.ASSISTANT, TranscriptRole.TOOL],
844
844
  excludeDataOnlyMessagesFilter: [TranscriptRole.ASSISTANT],
845
845
  useTextAlternativeForLLM,
846
+ excludeUserEventMessages: true,
846
847
  });
847
848
  llmPromptOptions["transcript"] = transcript;
848
849
  llmPromptOptions["chat"] = [{
@@ -888,7 +889,7 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
888
889
  // Find the child node with the toolId of the tool call
889
890
  let toolChild = undefined;
890
891
  for (const child of childConfigs) {
891
- if (child.type === "llmPromptTool" && ((_e = child.config) === null || _e === void 0 ? void 0 : _e.toolId) && (yield api.parseCognigyScriptText((_f = child.config) === null || _f === void 0 ? void 0 : _f.toolId)) === mainToolCall.function.name) {
892
+ if (!["llmPromptDefault", "llmPromptMCPTool"].includes(child.type) && ((_e = child.config) === null || _e === void 0 ? void 0 : _e.toolId) && (yield api.parseCognigyScriptText((_f = child.config) === null || _f === void 0 ? void 0 : _f.toolId)) === mainToolCall.function.name) {
892
893
  toolChild = child;
893
894
  break;
894
895
  }
@@ -3,12 +3,17 @@ import { createQuerySchema } from "../helper/createQuerySchema";
3
3
  import { entityMetaSchema } from "./resources/IEntityMeta";
4
4
  ;
5
5
  ;
6
+ export const profileTypes = [
7
+ "simulator",
8
+ "regular" // profiles that are not simulator. In db they will not have a type field for backward compatibility reasons.
9
+ ];
6
10
  export const profileDataSchema = {
7
11
  title: "profileDataSchema",
8
12
  type: "object",
9
13
  additionalProperties: false,
10
14
  properties: {
11
15
  active: { type: "boolean" },
16
+ type: { type: "string", enum: [...profileTypes] },
12
17
  contactIds: { type: "array", items: { type: "string" }, additionalItems: false, minItems: 1 },
13
18
  contactIdsHash: { type: "string" },
14
19
  expiresAt: { type: "object" },
@@ -369,7 +369,17 @@ export const nodeDescriptorSchema = {
369
369
  properties: {
370
370
  _id: { type: "string", format: "mongo-id" },
371
371
  type: { type: "string", minLength: 1, maxLength: 200 },
372
- parentType: { type: ["string", "null"], minLength: 1, maxLength: 200 },
372
+ parentType: {
373
+ oneOf: [
374
+ { type: "null" },
375
+ { type: "string", minLength: 1, maxLength: 200 },
376
+ {
377
+ type: "array",
378
+ items: { type: "string", minLength: 1, maxLength: 200 },
379
+ minItems: 1
380
+ }
381
+ ]
382
+ },
373
383
  defaultLabel: {
374
384
  oneOf: [
375
385
  { type: "string", minLength: 1, maxLength: 200 },
@@ -76,11 +76,11 @@ export const restChannelDisplayNames = [
76
76
  },
77
77
  {
78
78
  channel: "niceCXOne",
79
- displayName: "NICE CXone"
79
+ displayName: "NiCE CXone"
80
80
  },
81
81
  {
82
82
  channel: "niceCXOneAAH",
83
- displayName: "NICE CXone AAH"
83
+ displayName: "NiCE CXone AAH"
84
84
  },
85
85
  {
86
86
  channel: "zoomContactCenter",
@@ -1,9 +1,10 @@
1
1
  import { entityMetaSchema } from "../IEntityMeta";
2
2
  import { sharedSettingsSchema } from "./ISharedSettings";
3
- import { generativeAISettingsDataSchema } from "./IGenerativeAISettings";
4
- import { audioPreviewSettingsDataSchema } from "./IAudioPreviewSettings";
5
- import { translationSettingsDataSchema } from "./ITranslationSettings";
6
- import { knowledgeAISettingsDataSchema } from "./IKnowledgeAISettings";
3
+ import { generativeAISettingsDataSchema, } from "./IGenerativeAISettings";
4
+ import { audioPreviewSettingsDataSchema, } from "./IAudioPreviewSettings";
5
+ import { translationSettingsDataSchema, } from "./ITranslationSettings";
6
+ import { knowledgeAISettingsDataSchema, } from "./IKnowledgeAISettings";
7
+ import { piiDataRedactionSettingsSchema, } from "./IPiiDataRedactionSettings";
7
8
  export const agentSettingsDataSchema = {
8
9
  title: "agentSettingsDataSchema",
9
10
  type: "object",
@@ -11,31 +12,35 @@ export const agentSettingsDataSchema = {
11
12
  properties: Object.assign(Object.assign({}, sharedSettingsSchema.properties), { trackDataOnlyInputs: { type: "boolean" }, collectAnalytics: { type: "boolean" }, timezone: { type: "string", format: "timezone" }, useCaseSensitiveIntentMapping: { type: "boolean" }, translationSettings: {
12
13
  type: ["object", "null"],
13
14
  additionalProperties: false,
14
- properties: Object.assign({}, translationSettingsDataSchema.properties)
15
+ properties: Object.assign({}, translationSettingsDataSchema.properties),
15
16
  }, audioPreviewSettings: {
16
17
  type: ["object", "null"],
17
18
  additionalProperties: false,
18
- properties: Object.assign({}, audioPreviewSettingsDataSchema.properties)
19
+ properties: Object.assign({}, audioPreviewSettingsDataSchema.properties),
19
20
  }, generativeAISettings: {
20
21
  type: ["object", "null"],
21
22
  additionalProperties: false,
22
- properties: Object.assign({}, generativeAISettingsDataSchema.properties)
23
+ properties: Object.assign({}, generativeAISettingsDataSchema.properties),
23
24
  }, currencySettings: {
24
25
  type: ["object", "null"],
25
26
  additionalProperties: false,
26
27
  properties: {
27
28
  currency: { type: "string", format: "currency-code" },
28
- }
29
+ },
29
30
  }, knowledgeAISettings: {
30
31
  type: ["object", "null"],
31
32
  additionalProperties: false,
32
- properties: Object.assign({}, knowledgeAISettingsDataSchema.properties)
33
- } })
33
+ properties: Object.assign({}, knowledgeAISettingsDataSchema.properties),
34
+ }, piiDataRedactionSettings: {
35
+ type: ["object", "null"],
36
+ additionalProperties: false,
37
+ properties: Object.assign({}, piiDataRedactionSettingsSchema.properties),
38
+ } }),
34
39
  };
35
40
  export const agentSettingsSchema = {
36
41
  title: "agentSettingsSchema",
37
42
  type: "object",
38
43
  additionalProperties: false,
39
- properties: Object.assign(Object.assign(Object.assign({}, entityMetaSchema.properties), agentSettingsDataSchema.properties), { projectReference: { type: "string", format: "mongo-id" }, organisationReference: { type: "string", format: "mongo-id" } })
44
+ properties: Object.assign(Object.assign(Object.assign({}, entityMetaSchema.properties), agentSettingsDataSchema.properties), { projectReference: { type: "string", format: "mongo-id" }, organisationReference: { type: "string", format: "mongo-id" } }),
40
45
  };
41
46
  //# sourceMappingURL=IAgentSettings.js.map