@cognigy/rest-api-client 2025.25.0 → 2026.1.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.
- package/CHANGELOG.md +5 -0
- package/build/apigroups/ResourcesAPIGroup_2_0.js +14 -0
- package/build/apigroups/SimulationAPIGroup_2_0.js +15 -1
- package/build/authentication/AuthenticationAPI.js +1 -0
- package/build/shared/charts/createNodeDescriptor.js +1 -0
- package/build/shared/charts/descriptors/analytics/overwriteAnalytics.js +14 -0
- package/build/shared/charts/descriptors/analytics/updateProfile.js +5 -0
- package/build/shared/charts/descriptors/connectionNodes/smtp/emailNotification.js +7 -0
- package/build/shared/charts/descriptors/connectionNodes/smtp/sendEmail.js +9 -0
- package/build/shared/charts/descriptors/index.js +2 -0
- package/build/shared/charts/descriptors/message/question/question.js +5 -0
- package/build/shared/charts/descriptors/message/say.js +3 -0
- package/build/shared/charts/descriptors/service/agentTools/executeWorkflowTool.js +239 -0
- package/build/shared/charts/descriptors/service/agentTools/handoverToHumanAgentTool.js +783 -0
- package/build/shared/charts/descriptors/service/agentTools/sendEmailTool.js +33 -4
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +23 -20
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJobCallMCPTool.js +4 -2
- package/build/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +3 -1
- package/build/shared/charts/descriptors/service/aiAgent/helpers/parseMcpHeaders.js +26 -0
- package/build/shared/charts/descriptors/service/handoverV2.js +1 -1
- package/build/shared/charts/descriptors/service/httpRequest.js +3 -0
- package/build/shared/charts/descriptors/service/index.js +5 -1
- package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +11 -4
- package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +17 -11
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +5 -5
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +2 -2
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +13 -4
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +4 -4
- package/build/shared/interfaces/amqpInterface.js +1 -0
- package/build/shared/interfaces/messageAPI/endpoints.js +1 -1
- package/build/shared/interfaces/resources/IChart.js +10 -1
- package/build/shared/interfaces/resources/IChartNode.js +32 -4
- package/build/shared/interfaces/resources/IEndpoint.js +1 -0
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +8 -0
- package/build/shared/interfaces/resources/TResourceType.js +1 -0
- package/build/shared/interfaces/resources/chart/IChartExecutableNode.js +10 -1
- package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeConnector.js +49 -0
- package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +1 -1
- package/build/shared/interfaces/restAPI/administration/user/v2.0/IExchangeCXoneTokenRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/ICreateKnowledgeConnectorRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IDeleteKnowledgeConnectorRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IIndexKnowledgeConnectorsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IKnowledgeConnector_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IReadKnowledgeConnectorRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IUpdateKnowledgeConnectorRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/simulation/scheduler/ICreateSchedulerRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/simulation/scheduler/IGetSchedulerRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/simulation/scheduler/ISchedulerRest_2_0.js +12 -0
- package/build/shared/interfaces/restAPI/simulation/scheduler/IUpdateSchedulerRest_2_0.js +3 -0
- package/dist/esm/apigroups/ResourcesAPIGroup_2_0.js +14 -0
- package/dist/esm/apigroups/SimulationAPIGroup_2_0.js +15 -1
- package/dist/esm/authentication/AuthenticationAPI.js +1 -0
- package/dist/esm/shared/charts/createNodeDescriptor.js +1 -0
- package/dist/esm/shared/charts/descriptors/analytics/overwriteAnalytics.js +14 -0
- package/dist/esm/shared/charts/descriptors/analytics/updateProfile.js +5 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/smtp/emailNotification.js +7 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/smtp/sendEmail.js +9 -0
- package/dist/esm/shared/charts/descriptors/index.js +3 -1
- package/dist/esm/shared/charts/descriptors/message/question/question.js +5 -0
- package/dist/esm/shared/charts/descriptors/message/say.js +3 -0
- package/dist/esm/shared/charts/descriptors/service/agentTools/executeWorkflowTool.js +237 -0
- package/dist/esm/shared/charts/descriptors/service/agentTools/handoverToHumanAgentTool.js +770 -0
- package/dist/esm/shared/charts/descriptors/service/agentTools/sendEmailTool.js +33 -4
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +23 -20
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJobCallMCPTool.js +4 -2
- package/dist/esm/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +3 -1
- package/dist/esm/shared/charts/descriptors/service/aiAgent/helpers/parseMcpHeaders.js +25 -0
- package/dist/esm/shared/charts/descriptors/service/handoverV2.js +1 -1
- package/dist/esm/shared/charts/descriptors/service/httpRequest.js +3 -0
- package/dist/esm/shared/charts/descriptors/service/index.js +2 -0
- package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +11 -4
- package/dist/esm/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +17 -11
- package/dist/esm/shared/charts/descriptors/voice/mappers/transfer.mapper.js +5 -5
- package/dist/esm/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +2 -2
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +13 -4
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/transfer.js +4 -4
- package/dist/esm/shared/interfaces/amqpInterface.js +1 -0
- package/dist/esm/shared/interfaces/messageAPI/endpoints.js +1 -1
- package/dist/esm/shared/interfaces/resources/IChart.js +10 -1
- package/dist/esm/shared/interfaces/resources/IChartNode.js +32 -4
- package/dist/esm/shared/interfaces/resources/IEndpoint.js +1 -0
- package/dist/esm/shared/interfaces/resources/INodeDescriptorSet.js +8 -0
- package/dist/esm/shared/interfaces/resources/TResourceType.js +1 -0
- package/dist/esm/shared/interfaces/resources/chart/IChartExecutableNode.js +10 -1
- package/dist/esm/shared/interfaces/resources/knowledgeStore/IKnowledgeConnector.js +46 -0
- package/dist/esm/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +1 -1
- package/dist/esm/shared/interfaces/restAPI/administration/user/v2.0/IExchangeCXoneTokenRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/ICreateKnowledgeConnectorRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IDeleteKnowledgeConnectorRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IIndexKnowledgeConnectorsRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IKnowledgeConnector_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IReadKnowledgeConnectorRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IUpdateKnowledgeConnectorRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/simulation/scheduler/ICreateSchedulerRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/simulation/scheduler/IGetSchedulerRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/simulation/scheduler/ISchedulerRest_2_0.js +9 -0
- package/dist/esm/shared/interfaces/restAPI/simulation/scheduler/IUpdateSchedulerRest_2_0.js +2 -0
- package/package.json +1 -1
- package/types/index.d.ts +528 -11
|
@@ -66,6 +66,31 @@ exports.SEND_EMAIL_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
66
66
|
maxLength: 255,
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
|
+
{
|
|
70
|
+
key: "cc",
|
|
71
|
+
type: "cognigyText",
|
|
72
|
+
label: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__CC__LABEL",
|
|
73
|
+
description: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__CC__DESCRIPTION",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "bcc",
|
|
77
|
+
type: "cognigyText",
|
|
78
|
+
label: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__BCC__LABEL",
|
|
79
|
+
description: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__BCC__DESCRIPTION",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: "priority",
|
|
83
|
+
type: "select",
|
|
84
|
+
label: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__PRIORITY__LABEL",
|
|
85
|
+
defaultValue: "normal",
|
|
86
|
+
params: {
|
|
87
|
+
options: [
|
|
88
|
+
{ label: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__PRIORITY__HIGH__LABEL", value: "high" },
|
|
89
|
+
{ label: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__PRIORITY__NORMAL__LABEL", value: "normal" },
|
|
90
|
+
{ label: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__PRIORITY__LOW__LABEL", value: "low" }
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
69
94
|
{
|
|
70
95
|
key: "parameters",
|
|
71
96
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__PARAMETERS__LABEL",
|
|
@@ -115,6 +140,9 @@ exports.SEND_EMAIL_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
115
140
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__ADVANCED__LABEL",
|
|
116
141
|
defaultCollapsed: true,
|
|
117
142
|
fields: [
|
|
143
|
+
"cc",
|
|
144
|
+
"bcc",
|
|
145
|
+
"priority",
|
|
118
146
|
"condition"
|
|
119
147
|
]
|
|
120
148
|
},
|
|
@@ -134,7 +162,7 @@ exports.SEND_EMAIL_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
134
162
|
function: async ({ cognigy, config, nodeId, nodeType, organisationId, projectId, childConfigs }) => {
|
|
135
163
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
136
164
|
const { api, context, input } = cognigy;
|
|
137
|
-
const { debugMessage, recipient, } = config;
|
|
165
|
+
const { debugMessage, recipient, cc, bcc, priority, } = config;
|
|
138
166
|
const sessionState = await api.loadSessionState();
|
|
139
167
|
const toolCall = (_a = sessionState.lastToolCall) === null || _a === void 0 ? void 0 : _a.toolCall;
|
|
140
168
|
const aiAgentJobNode = (_b = sessionState.lastToolCall) === null || _b === void 0 ? void 0 : _b.aiAgentJobNode;
|
|
@@ -152,14 +180,15 @@ exports.SEND_EMAIL_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
152
180
|
recipient,
|
|
153
181
|
subject,
|
|
154
182
|
message,
|
|
155
|
-
cc: "",
|
|
156
|
-
bcc: "",
|
|
157
|
-
priority: "normal",
|
|
183
|
+
cc: cc || "",
|
|
184
|
+
bcc: bcc || "",
|
|
185
|
+
priority: priority || "normal",
|
|
158
186
|
async: false,
|
|
159
187
|
storeLocation: "none",
|
|
160
188
|
inputKey: "",
|
|
161
189
|
contextKey: "",
|
|
162
190
|
stopOnError: false,
|
|
191
|
+
senderName: "",
|
|
163
192
|
},
|
|
164
193
|
nodeId,
|
|
165
194
|
nodeType,
|
|
@@ -23,8 +23,9 @@ const createSystemMessage_1 = require("./helpers/createSystemMessage");
|
|
|
23
23
|
const generateSearchPrompt_1 = require("./helpers/generateSearchPrompt");
|
|
24
24
|
const getUserMemory_1 = require("./helpers/getUserMemory");
|
|
25
25
|
const createToolDefinitions_1 = require("./helpers/createToolDefinitions");
|
|
26
|
+
const parseMcpHeaders_1 = require("./helpers/parseMcpHeaders");
|
|
26
27
|
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
27
|
-
exports.AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool", "knowledgeTool", "handoverToAiAgentTool", "sendEmailTool"];
|
|
28
|
+
exports.AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool", "knowledgeTool", "handoverToAiAgentTool", "handoverToHumanAgentTool", "sendEmailTool", "executeWorkflowTool"];
|
|
28
29
|
exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
29
30
|
type: "aiAgentJob",
|
|
30
31
|
defaultLabel: "AI Agent",
|
|
@@ -926,7 +927,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
926
927
|
],
|
|
927
928
|
tags: ["ai", "aiAgent"],
|
|
928
929
|
function: async ({ cognigy, config, childConfigs, nodeId }) => {
|
|
929
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
|
|
930
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
|
|
930
931
|
const { api, context, input, profile, flowReferenceId } = cognigy;
|
|
931
932
|
const { aiAgent, llmProviderReferenceId, name: jobName, description: jobDescription, instructions: jobInstructions, outputImmediately, toolChoice, useStrict, memoryType, selectedProfileFields, memoryContextInjection, knowledgeSearchBehavior, knowledgeSearchTags, knowledgeSearchTagsFilterOp, knowledgeSearchAiAgentKnowledge, knowledgeSearchJobKnowledge, knowledgeSearchJobStore, knowledgeSearchGenerateSearchPrompt, knowledgeSearchTopK, timeoutInMs, maxTokens, temperature, useTextAlternativeForLLM, advancedLogging, loggingWebhookUrl, loggingCustomData, conditionForLogging, logErrorToSystem, storeErrorInInput, errorHandling, errorHandlingGotoTarget, errorMessage, debugConfig, debugLogTokenCount, debugLogSystemPrompt, debugLogToolDefinitions, debugResult, debugLogLLMLatency, storeLocation, contextKey, inputKey, streamStoreCopyInInput, streamStopTokens, processImages, transcriptImageHandling, loggingHeaders, sessionParams } = config;
|
|
932
933
|
try {
|
|
@@ -976,7 +977,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
976
977
|
throw new Error(`[VG2] Error on AI Agent Job node. Error message: ${error.message}`);
|
|
977
978
|
}
|
|
978
979
|
}
|
|
979
|
-
const
|
|
980
|
+
const _26 = profile, { profileId, accepted_gdpr, prevent_data_collection, privacy_policy } = _26, cleanedProfile = __rest(_26, ["profileId", "accepted_gdpr", "prevent_data_collection", "privacy_policy"]);
|
|
980
981
|
const userMemory = (0, getUserMemory_1.getUserMemory)(memoryType, selectedProfileFields, aiAgent, cleanedProfile);
|
|
981
982
|
/**
|
|
982
983
|
* ----- Knowledge Search Section -----
|
|
@@ -1303,13 +1304,15 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1303
1304
|
break;
|
|
1304
1305
|
}
|
|
1305
1306
|
}
|
|
1307
|
+
let mcpHeaders = (_7 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _7 === void 0 ? void 0 : _7.mcpHeaders;
|
|
1306
1308
|
if (!toolChild && toolMap.has(mainToolCall.function.name)) {
|
|
1307
1309
|
// If the tool call is from an MCP tool, set the next node to the corresponding child node
|
|
1308
1310
|
toolChild = childConfigs.find(child => child.id === toolMap.get(mainToolCall.function.name));
|
|
1309
1311
|
isMcpToolCall = true;
|
|
1312
|
+
mcpHeaders = await (0, parseMcpHeaders_1.parseMcpHeaders)((_8 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _8 === void 0 ? void 0 : _8.mcpHeaders, api);
|
|
1310
1313
|
}
|
|
1311
1314
|
if (mainToolCall.function.name !== "retrieve_knowledge" && toolChild === undefined) {
|
|
1312
|
-
(
|
|
1315
|
+
(_9 = api.logDebugError) === null || _9 === void 0 ? void 0 : _9.call(api, `UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__ERROR__BODY <b>${mainToolCall.function.name}</b>`, "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__ERROR__HEADER");
|
|
1313
1316
|
}
|
|
1314
1317
|
// Add last tool call to session state for loading it from Tool Answer Node
|
|
1315
1318
|
api.updateSessionStateValues({
|
|
@@ -1317,22 +1320,22 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1317
1320
|
flow: flowReferenceId,
|
|
1318
1321
|
node: nodeId,
|
|
1319
1322
|
} }, (isMcpToolCall && {
|
|
1320
|
-
mcpServerUrl: (
|
|
1321
|
-
mcpHeaders
|
|
1322
|
-
timeout: (
|
|
1323
|
+
mcpServerUrl: (_10 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _10 === void 0 ? void 0 : _10.mcpServerUrl,
|
|
1324
|
+
mcpHeaders,
|
|
1325
|
+
timeout: (_11 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _11 === void 0 ? void 0 : _11.timeout,
|
|
1323
1326
|
mcpToolNode: toolChild === null || toolChild === void 0 ? void 0 : toolChild.id,
|
|
1324
1327
|
})), { toolCall: mainToolCall }),
|
|
1325
1328
|
});
|
|
1326
1329
|
// if there are any parameters/arguments, add them to the input slots
|
|
1327
1330
|
if (mainToolCall.function.arguments) {
|
|
1328
|
-
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (
|
|
1331
|
+
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (_13 = (_12 = input.aiAgent) === null || _12 === void 0 ? void 0 : _12.toolArgs) !== null && _13 !== void 0 ? _13 : {}), mainToolCall.function.arguments) });
|
|
1329
1332
|
}
|
|
1330
1333
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
1331
|
-
if ((
|
|
1334
|
+
if ((_14 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _14 === void 0 ? void 0 : _14.debugMessage) {
|
|
1332
1335
|
const toolId = isMcpToolCall ? mainToolCall.function.name : await api.parseCognigyScriptText(toolChild.config.toolId);
|
|
1333
1336
|
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${toolId}`];
|
|
1334
1337
|
// Arguments / Parameters Slots
|
|
1335
|
-
const slots = ((
|
|
1338
|
+
const slots = ((_15 = mainToolCall === null || mainToolCall === void 0 ? void 0 : mainToolCall.function) === null || _15 === void 0 ? void 0 : _15.arguments) && Object.keys(mainToolCall.function.arguments);
|
|
1336
1339
|
const hasSlots = slots && slots.length > 0;
|
|
1337
1340
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
1338
1341
|
if (hasSlots) {
|
|
@@ -1347,7 +1350,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1347
1350
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
1348
1351
|
});
|
|
1349
1352
|
}
|
|
1350
|
-
(
|
|
1353
|
+
(_16 = api.logDebugMessage) === null || _16 === void 0 ? void 0 : _16.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER");
|
|
1351
1354
|
}
|
|
1352
1355
|
if (toolChild) {
|
|
1353
1356
|
api.setNextNode(toolChild.id);
|
|
@@ -1372,11 +1375,11 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1372
1375
|
}
|
|
1373
1376
|
// Optionally output the result immediately
|
|
1374
1377
|
if (llmResult.result && outputImmediately && !llmPromptOptions.stream) {
|
|
1375
|
-
await ((
|
|
1378
|
+
await ((_17 = api.output) === null || _17 === void 0 ? void 0 : _17.call(api, llmResult.result, {}));
|
|
1376
1379
|
}
|
|
1377
1380
|
else if (llmResult.finishReason && llmPromptOptions.stream) {
|
|
1378
1381
|
// send the finishReason as last output for a stream
|
|
1379
|
-
(
|
|
1382
|
+
(_18 = api.output) === null || _18 === void 0 ? void 0 : _18.call(api, "", {
|
|
1380
1383
|
_cognigy: {
|
|
1381
1384
|
_preventTranscript: true,
|
|
1382
1385
|
_messageId,
|
|
@@ -1399,7 +1402,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1399
1402
|
}
|
|
1400
1403
|
// Add response to Cognigy Input/Context for further usage
|
|
1401
1404
|
if (storeLocation === "context") {
|
|
1402
|
-
(
|
|
1405
|
+
(_19 = api.addToContext) === null || _19 === void 0 ? void 0 : _19.call(api, contextKey, llmResult, "simple");
|
|
1403
1406
|
}
|
|
1404
1407
|
else if (storeLocation === "input") {
|
|
1405
1408
|
api.addToInput(inputKey, llmResult);
|
|
@@ -1412,14 +1415,14 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1412
1415
|
const errorDetails = {
|
|
1413
1416
|
name: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
1414
1417
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
1415
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1418
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_20 = error.originalErrorDetails) === null || _20 === void 0 ? void 0 : _20.message),
|
|
1416
1419
|
};
|
|
1417
|
-
(
|
|
1420
|
+
(_21 = api.emitEvent) === null || _21 === void 0 ? void 0 : _21.call(api, "nodeError", { nodeId, flowId: flowReferenceId, errorMessage: error });
|
|
1418
1421
|
if (logErrorToSystem) {
|
|
1419
|
-
(
|
|
1422
|
+
(_22 = api.log) === null || _22 === void 0 ? void 0 : _22.call(api, "error", JSON.stringify(errorDetails));
|
|
1420
1423
|
}
|
|
1421
1424
|
if (errorHandling !== "stop") {
|
|
1422
|
-
(
|
|
1425
|
+
(_23 = api.logDebugError) === null || _23 === void 0 ? void 0 : _23.call(api, errorDetails.message + (errorDetails.code ? ` (error code: ${errorDetails.code})` : ""), errorDetails.name);
|
|
1423
1426
|
}
|
|
1424
1427
|
if (storeErrorInInput) {
|
|
1425
1428
|
input.aiAgent = input.aiAgent || {};
|
|
@@ -1428,7 +1431,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1428
1431
|
if (errorHandling === "continue") {
|
|
1429
1432
|
// output the timeout message
|
|
1430
1433
|
if (errorMessage) {
|
|
1431
|
-
await ((
|
|
1434
|
+
await ((_24 = api.output) === null || _24 === void 0 ? void 0 : _24.call(api, errorMessage, null));
|
|
1432
1435
|
}
|
|
1433
1436
|
// Set default node as next node
|
|
1434
1437
|
const defaultChild = childConfigs.find(child => child.type === "aiAgentJobDefault");
|
|
@@ -1440,7 +1443,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1440
1443
|
if (!errorHandlingGotoTarget) {
|
|
1441
1444
|
throw new Error("GoTo Target is required");
|
|
1442
1445
|
}
|
|
1443
|
-
if (!((
|
|
1446
|
+
if (!((_25 = api.checkThink) === null || _25 === void 0 ? void 0 : _25.call(api, nodeId))) {
|
|
1444
1447
|
api.resetNextNodes();
|
|
1445
1448
|
await api.executeFlow({
|
|
1446
1449
|
flowNode: {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AI_AGENT_JOB_CALL_MCP_TOOL = void 0;
|
|
4
4
|
/* Custom modules */
|
|
5
5
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
|
+
const parseMcpHeaders_1 = require("./helpers/parseMcpHeaders");
|
|
6
7
|
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
7
8
|
exports.AI_AGENT_JOB_CALL_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
8
9
|
type: "aiAgentJobCallMCPTool",
|
|
@@ -60,7 +61,7 @@ exports.AI_AGENT_JOB_CALL_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescri
|
|
|
60
61
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_CALL_MCP_TOOL__FIELDS__RESOLVE_IMMEDIATELY__LABEL",
|
|
61
62
|
type: "toggle",
|
|
62
63
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_CALL_MCP_TOOL__FIELDS__RESOLVE_IMMEDIATELY__DESCRIPTION",
|
|
63
|
-
defaultValue:
|
|
64
|
+
defaultValue: true,
|
|
64
65
|
},
|
|
65
66
|
{
|
|
66
67
|
key: "debugToolResult",
|
|
@@ -102,7 +103,8 @@ exports.AI_AGENT_JOB_CALL_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescri
|
|
|
102
103
|
const aiAgentJobNode = (_b = sessionState.lastToolCall) === null || _b === void 0 ? void 0 : _b.aiAgentJobNode;
|
|
103
104
|
const mcpServerUrl = (_c = sessionState.lastToolCall) === null || _c === void 0 ? void 0 : _c.mcpServerUrl;
|
|
104
105
|
const timeout = (_d = sessionState.lastToolCall) === null || _d === void 0 ? void 0 : _d.timeout;
|
|
105
|
-
|
|
106
|
+
// Use the helper function to parse MCP headers
|
|
107
|
+
const mcpHeaders = await (0, parseMcpHeaders_1.parseMcpHeaders)((_e = sessionState.lastToolCall) === null || _e === void 0 ? void 0 : _e.mcpHeaders, api);
|
|
106
108
|
if (!(toolCall === null || toolCall === void 0 ? void 0 : toolCall.id)) {
|
|
107
109
|
(_f = api.logDebugError) === null || _f === void 0 ? void 0 : _f.call(api, "UI__DEBUG_MODE__AI_AGENT_ANSWER__ERROR__MESSAGE");
|
|
108
110
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.safeParseJson = exports.createToolDefinitions = void 0;
|
|
4
4
|
const createSystemMessage_1 = require("./createSystemMessage");
|
|
5
|
+
const parseMcpHeaders_1 = require("./parseMcpHeaders");
|
|
5
6
|
/**
|
|
6
7
|
* Creates the tool definitions for the AI Agent Job and LLM Prompt v2 Nodes
|
|
7
8
|
* @param childConfigs Child node configurations
|
|
@@ -45,7 +46,8 @@ const createToolDefinitions = async (childConfigs, api, useStrict) => {
|
|
|
45
46
|
const cacheTools = child.config.cacheTools;
|
|
46
47
|
const sendDebug = child.config.debugMessageFetchedTools;
|
|
47
48
|
const toolFilter = child.config.toolFilter;
|
|
48
|
-
|
|
49
|
+
// Parse mcpHeaders values if present and resolve any Cognigy script expressions
|
|
50
|
+
const mcpHeaders = await (0, parseMcpHeaders_1.parseMcpHeaders)(child.config.mcpHeaders, api);
|
|
49
51
|
let mcpTools = null;
|
|
50
52
|
let fetchedFromCache = null;
|
|
51
53
|
try {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMcpHeaders = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Parses MCP headers by resolving any Cognigy script expressions in string values
|
|
6
|
+
* @param mcpHeaders - The headers object to parse
|
|
7
|
+
* @param api - The Cognigy API instance for parsing script text
|
|
8
|
+
* @returns The parsed headers object
|
|
9
|
+
*/
|
|
10
|
+
async function parseMcpHeaders(mcpHeaders, api) {
|
|
11
|
+
if (!mcpHeaders || typeof mcpHeaders !== "object") {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const parsedMcpHeaders = {};
|
|
15
|
+
for (const [key, value] of Object.entries(mcpHeaders)) {
|
|
16
|
+
if (typeof value === "string") {
|
|
17
|
+
parsedMcpHeaders[key] = await api.parseCognigyScriptText(value);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
parsedMcpHeaders[key] = value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return parsedMcpHeaders;
|
|
24
|
+
}
|
|
25
|
+
exports.parseMcpHeaders = parseMcpHeaders;
|
|
26
|
+
//# sourceMappingURL=parseMcpHeaders.js.map
|
|
@@ -6,7 +6,7 @@ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
|
6
6
|
const constants_1 = require("../../../constants");
|
|
7
7
|
exports.HANDOVER_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
8
8
|
type: "handoverToAgent",
|
|
9
|
-
defaultLabel: "Handover to Agent",
|
|
9
|
+
defaultLabel: "Handover to Human Agent",
|
|
10
10
|
summary: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__SUMMARY",
|
|
11
11
|
appearance: {
|
|
12
12
|
showIcon: false
|
|
@@ -524,6 +524,9 @@ exports.HTTP_REQUEST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
524
524
|
type: "text",
|
|
525
525
|
},
|
|
526
526
|
tags: ["service", "get", "post", "put", "patch"],
|
|
527
|
+
mocking: {
|
|
528
|
+
defaultMockCode: `input.httprequest = {response: "Mock response"};`
|
|
529
|
+
},
|
|
527
530
|
function: async (httpRequestParams) => {
|
|
528
531
|
const { cognigy, config } = httpRequestParams;
|
|
529
532
|
const { api } = cognigy;
|
|
@@ -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.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.SEND_EMAIL_TOOL = exports.HANDOVER_TO_AI_AGENT_TOOL = 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;
|
|
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.EXECUTE_WORKFLOW_TOOL = exports.SEND_EMAIL_TOOL = exports.HANDOVER_TO_HUMAN_AGENT_TOOL = exports.HANDOVER_TO_AI_AGENT_TOOL = 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");
|
|
@@ -63,8 +63,12 @@ var knowledgeTool_1 = require("./agentTools/knowledgeTool");
|
|
|
63
63
|
Object.defineProperty(exports, "KNOWLEDGE_TOOL", { enumerable: true, get: function () { return knowledgeTool_1.KNOWLEDGE_TOOL; } });
|
|
64
64
|
var handoverToAiAgentTool_1 = require("./agentTools/handoverToAiAgentTool");
|
|
65
65
|
Object.defineProperty(exports, "HANDOVER_TO_AI_AGENT_TOOL", { enumerable: true, get: function () { return handoverToAiAgentTool_1.HANDOVER_TO_AI_AGENT_TOOL; } });
|
|
66
|
+
var handoverToHumanAgentTool_1 = require("./agentTools/handoverToHumanAgentTool");
|
|
67
|
+
Object.defineProperty(exports, "HANDOVER_TO_HUMAN_AGENT_TOOL", { enumerable: true, get: function () { return handoverToHumanAgentTool_1.HANDOVER_TO_HUMAN_AGENT_TOOL; } });
|
|
66
68
|
var sendEmailTool_1 = require("./agentTools/sendEmailTool");
|
|
67
69
|
Object.defineProperty(exports, "SEND_EMAIL_TOOL", { enumerable: true, get: function () { return sendEmailTool_1.SEND_EMAIL_TOOL; } });
|
|
70
|
+
var executeWorkflowTool_1 = require("./agentTools/executeWorkflowTool");
|
|
71
|
+
Object.defineProperty(exports, "EXECUTE_WORKFLOW_TOOL", { enumerable: true, get: function () { return executeWorkflowTool_1.EXECUTE_WORKFLOW_TOOL; } });
|
|
68
72
|
var loadAiAgent_1 = require("./aiAgent/loadAiAgent");
|
|
69
73
|
Object.defineProperty(exports, "LOAD_AI_AGENT", { enumerable: true, get: function () { return loadAiAgent_1.LOAD_AI_AGENT; } });
|
|
70
74
|
var handoverConnections_1 = require("./handoverConnections");
|
|
@@ -18,6 +18,7 @@ const crypto = require("crypto");
|
|
|
18
18
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
19
19
|
const logic_1 = require("../../logic");
|
|
20
20
|
const createToolDefinitions_1 = require("../aiAgent/helpers/createToolDefinitions");
|
|
21
|
+
const parseMcpHeaders_1 = require("../aiAgent/helpers/parseMcpHeaders");
|
|
21
22
|
const prompt_1 = require("../../nlu/generativeSlotFiller/prompt");
|
|
22
23
|
const errors_1 = require("../../../../errors");
|
|
23
24
|
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
@@ -29,7 +30,7 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
29
30
|
collapsable: true,
|
|
30
31
|
placement: {
|
|
31
32
|
children: {
|
|
32
|
-
whitelist: ["llmPromptDefault", "llmPromptTool", "llmPromptMCPTool", "knowledgeTool", "handoverToAiAgentTool", "sendEmailTool"],
|
|
33
|
+
whitelist: ["llmPromptDefault", "llmPromptTool", "llmPromptMCPTool", "knowledgeTool", "handoverToAiAgentTool", "handoverToHumanAgentTool", "sendEmailTool", "executeWorkflowTool"],
|
|
33
34
|
},
|
|
34
35
|
},
|
|
35
36
|
},
|
|
@@ -702,6 +703,9 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
702
703
|
color: "#252525",
|
|
703
704
|
},
|
|
704
705
|
tags: ["ai", "llm", "gpt", "generative ai", "openai", "azure", "prompt"],
|
|
706
|
+
mocking: {
|
|
707
|
+
defaultMockCode: `input.llmResponse = {response: "Mock response"};`
|
|
708
|
+
},
|
|
705
709
|
function: async ({ cognigy, config, childConfigs, nodeId }) => {
|
|
706
710
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
707
711
|
const { api, input, flowReferenceId } = cognigy;
|
|
@@ -907,13 +911,16 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
907
911
|
break;
|
|
908
912
|
}
|
|
909
913
|
}
|
|
914
|
+
let mcpHeaders = (_g = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _g === void 0 ? void 0 : _g.mcpHeaders;
|
|
910
915
|
if (!toolChild && toolMap.has(mainToolCall.function.name)) {
|
|
911
916
|
// If the tool call is from an MCP tool, set the next node to the corresponding child node
|
|
912
917
|
toolChild = childConfigs.find(child => child.id === toolMap.get(mainToolCall.function.name));
|
|
913
918
|
isMcpToolCall = true;
|
|
919
|
+
// Parse mcpHeaders values if present and resolve any Cognigy script expressions
|
|
920
|
+
mcpHeaders = await (0, parseMcpHeaders_1.parseMcpHeaders)(toolChild === null || toolChild === void 0 ? void 0 : toolChild.config.mcpHeaders, api);
|
|
914
921
|
}
|
|
915
922
|
if (mainToolCall.function.name !== "retrieve_knowledge" && toolChild === undefined) {
|
|
916
|
-
(
|
|
923
|
+
(_h = api.logDebugError) === null || _h === void 0 ? void 0 : _h.call(api, `UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__ERROR__BODY <b>${mainToolCall.function.name}</b>`, "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__ERROR__HEADER");
|
|
917
924
|
}
|
|
918
925
|
// Add last tool call to session state for loading it from Tool Answer Node
|
|
919
926
|
api.updateSessionStateValues({
|
|
@@ -921,8 +928,8 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
921
928
|
flow: flowReferenceId,
|
|
922
929
|
node: nodeId,
|
|
923
930
|
} }, (isMcpToolCall && {
|
|
924
|
-
mcpServerUrl: (
|
|
925
|
-
mcpHeaders
|
|
931
|
+
mcpServerUrl: (_j = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _j === void 0 ? void 0 : _j.mcpServerUrl,
|
|
932
|
+
mcpHeaders,
|
|
926
933
|
timeout: (_k = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _k === void 0 ? void 0 : _k.timeout,
|
|
927
934
|
mcpToolNode: toolChild === null || toolChild === void 0 ? void 0 : toolChild.id,
|
|
928
935
|
})), { toolCall: mainToolCall }),
|
|
@@ -178,10 +178,10 @@ class SessionConfigMapper extends base_mapper_1.BaseMapper {
|
|
|
178
178
|
return synthesizer;
|
|
179
179
|
}
|
|
180
180
|
buildRecognizer(sessionParams, stt, vad, azureConfig) {
|
|
181
|
-
var _a, _b, _c;
|
|
181
|
+
var _a, _b, _c, _d;
|
|
182
182
|
const { recognizer: sessionParamsRecognizer } = sessionParams || {};
|
|
183
183
|
const { vendor: spVendor, language: spLanguage, hints: spHints, label: spLabel, model: spModel, azureSttEndpointId: spAzureSttEndpointId, audioLogging: spAudioLogging, hintsBoost: spHintsBoost, punctuation: spPunctuation, altLanguages: spAltLanguages = [], deepgramOptions: spDeepgramOptions, vad: spVad, profanityOption: spProfanityOption } = sessionParamsRecognizer || {};
|
|
184
|
-
const { sttVendor, sttLanguage, sttHints, sttLabel, sttHintsBoost, sttDisablePunctuation, googleModel, deepgramEndpointing, deepgramEndpointingValue,
|
|
184
|
+
const { sttVendor, sttLanguage, sttHints, sttLabel, sttHintsBoost, sttDisablePunctuation, googleModel, deepgramEndpointing, deepgramEndpointingValue, sttModel, deepgramSmartFormatting, deepgramShortUtterance, altLanguages = [] } = stt || {};
|
|
185
185
|
const recognizer = {};
|
|
186
186
|
recognizer.language = spLanguage || sttLanguage || undefined;
|
|
187
187
|
recognizer.hints = spHints || sttHints || undefined;
|
|
@@ -216,7 +216,7 @@ class SessionConfigMapper extends base_mapper_1.BaseMapper {
|
|
|
216
216
|
* ssc node: 'deepgramEndpointing' => boolean, 'deepgramEndpointingValue' => number
|
|
217
217
|
*/
|
|
218
218
|
const isDeepgramEndpointingEnabled = (_a = (typeof spEndpointing === "number" || deepgramEndpointing)) !== null && _a !== void 0 ? _a : false;
|
|
219
|
-
recognizer.model = spModel ||
|
|
219
|
+
recognizer.model = spModel || sttModel;
|
|
220
220
|
const deepgramOptions = {
|
|
221
221
|
endpointing: false,
|
|
222
222
|
punctuate: recognizer.punctuation,
|
|
@@ -229,6 +229,12 @@ class SessionConfigMapper extends base_mapper_1.BaseMapper {
|
|
|
229
229
|
}
|
|
230
230
|
recognizer.deepgramOptions = deepgramOptions;
|
|
231
231
|
}
|
|
232
|
+
if (recognizer.vendor === 'openai') {
|
|
233
|
+
const openaiModel = spModel || sttModel;
|
|
234
|
+
if (openaiModel) {
|
|
235
|
+
recognizer.openaiOptions = Object.assign(Object.assign({}, ((_d = recognizer.openaiOptions) !== null && _d !== void 0 ? _d : {})), { model: openaiModel });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
232
238
|
}
|
|
233
239
|
if (this.has(spVad) || this.has(vad)) {
|
|
234
240
|
const { enable: spEnable, mode: spMode, voiceMs: spVoiceMs } = spVad || {};
|
|
@@ -295,7 +301,7 @@ class SessionConfigMapper extends base_mapper_1.BaseMapper {
|
|
|
295
301
|
}
|
|
296
302
|
const mapper = new SessionConfigMapper("voiceGateway2");
|
|
297
303
|
function voiceConfigParamsToVoiceSettings(config, api) {
|
|
298
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
304
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
299
305
|
let voiceSettings = {};
|
|
300
306
|
if (config.sttVendor === 'none') {
|
|
301
307
|
delete config.sttVendor;
|
|
@@ -347,10 +353,10 @@ function voiceConfigParamsToVoiceSettings(config, api) {
|
|
|
347
353
|
/* by default we enable endpointing - it is only undefined via SAP */
|
|
348
354
|
deepgramEndpointing,
|
|
349
355
|
deepgramEndpointingValue: (_g = config.deepgramEndpointingValue) !== null && _g !== void 0 ? _g : 250,
|
|
350
|
-
|
|
351
|
-
deepgramSmartFormatting: (
|
|
356
|
+
sttModel: config.sttModel || "",
|
|
357
|
+
deepgramSmartFormatting: (_h = config.deepgramSmartFormatting) !== null && _h !== void 0 ? _h : undefined,
|
|
352
358
|
deepgramShortUtterance,
|
|
353
|
-
listenDuringPrompt: (
|
|
359
|
+
listenDuringPrompt: (_j = config.sttListenDuringPrompt) !== null && _j !== void 0 ? _j : undefined,
|
|
354
360
|
};
|
|
355
361
|
// tts (synthesizer)
|
|
356
362
|
voiceSettings.tts = {
|
|
@@ -395,7 +401,7 @@ function voiceConfigParamsToVoiceSettings(config, api) {
|
|
|
395
401
|
voiceSettings.stt.altLanguages = [];
|
|
396
402
|
}
|
|
397
403
|
}
|
|
398
|
-
if (config.ttsVendor === "elevenlabs") {
|
|
404
|
+
if (config.ttsVendor === "elevenlabs" || config.ttsVendor === "openai") {
|
|
399
405
|
voiceSettings.tts.ttsModel = config.ttsModel;
|
|
400
406
|
}
|
|
401
407
|
// userNoInput
|
|
@@ -417,7 +423,7 @@ function voiceConfigParamsToVoiceSettings(config, api) {
|
|
|
417
423
|
flowNoInputFail: config.flowNoInputFail
|
|
418
424
|
};
|
|
419
425
|
// Check if userNoInputTimeout has a value and userNoInputTimeoutEnable is null or undefined to cover generic nodes
|
|
420
|
-
if (((
|
|
426
|
+
if (((_k = voiceSettings === null || voiceSettings === void 0 ? void 0 : voiceSettings.userNoInput) === null || _k === void 0 ? void 0 : _k.userNoInputTimeout) && (voiceSettings.userNoInput.userNoInputTimeoutEnable === null || voiceSettings.userNoInput.userNoInputTimeoutEnable === undefined)) {
|
|
421
427
|
voiceSettings.userNoInput.userNoInputTimeoutEnable = true;
|
|
422
428
|
}
|
|
423
429
|
voiceSettings.dtmf = {
|
|
@@ -425,7 +431,7 @@ function voiceConfigParamsToVoiceSettings(config, api) {
|
|
|
425
431
|
dtmfInterDigitTimeout: config.dtmfInterDigitTimeout,
|
|
426
432
|
dtmfMaxDigits: config.dtmfMaxDigits,
|
|
427
433
|
dtmfMinDigits: config.dtmfMinDigits,
|
|
428
|
-
dtmfSubmitDigit: (
|
|
434
|
+
dtmfSubmitDigit: (_l = config.dtmfSubmitDigit) === null || _l === void 0 ? void 0 : _l.trim(),
|
|
429
435
|
};
|
|
430
436
|
if (config === null || config === void 0 ? void 0 : config.dtmfEnable) {
|
|
431
437
|
if (voiceSettings.dtmf.dtmfSubmitDigit &&
|
|
@@ -462,7 +468,7 @@ function voiceConfigParamsToVoiceSettings(config, api) {
|
|
|
462
468
|
}
|
|
463
469
|
// atmosphere sounds
|
|
464
470
|
if (config.atmosphereAction) {
|
|
465
|
-
if ((
|
|
471
|
+
if ((_m = config.atmosphereUrl) === null || _m === void 0 ? void 0 : _m.length) {
|
|
466
472
|
if (!(0, helper_1.isValidUrl)(config.atmosphereUrl)) {
|
|
467
473
|
throw new Error(`Audio file URL is invalid ${config.atmosphereUrl}`);
|
|
468
474
|
}
|
|
@@ -5,7 +5,7 @@ exports.prepareTransferParams = exports.transfer = void 0;
|
|
|
5
5
|
const helper_1 = require("../../../descriptors/voicegateway2/utils/helper");
|
|
6
6
|
const helper_2 = require("../utils/helper");
|
|
7
7
|
exports.transfer = {
|
|
8
|
-
handleInput(endpointType, params, isGenericNode = false, recognitionChannel, sttVendor, sttLanguage, googleModel,
|
|
8
|
+
handleInput(endpointType, params, isGenericNode = false, recognitionChannel, sttVendor, sttLanguage, googleModel, sttModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting, mediaPath, anchorMedia) {
|
|
9
9
|
try {
|
|
10
10
|
switch (endpointType) {
|
|
11
11
|
case "bandwidth":
|
|
@@ -24,14 +24,14 @@ exports.transfer = {
|
|
|
24
24
|
return this.handleAudioCodesInput((0, exports.prepareTransferParams)(params), endpointType);
|
|
25
25
|
case "voiceGateway2":
|
|
26
26
|
default:
|
|
27
|
-
return this.handleVGInput((0, exports.prepareTransferParams)(params), recognitionChannel, sttVendor, sttLanguage, googleModel,
|
|
27
|
+
return this.handleVGInput((0, exports.prepareTransferParams)(params), recognitionChannel, sttVendor, sttLanguage, googleModel, sttModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting, mediaPath, anchorMedia);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
catch (error) {
|
|
31
31
|
throw Error(error.message);
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
handleVGInput(transferParam, recognitionChannel, sttVendor, sttLanguage, googleModel,
|
|
34
|
+
handleVGInput(transferParam, recognitionChannel, sttVendor, sttLanguage, googleModel, sttModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting, mediaPath, anchorMedia) {
|
|
35
35
|
const { transferType, transferTarget, transferReason, referredBy, useTransferSipHeaders, transferSipHeaders, dialMusic, dialTranscriptionWebhook, dialCallerId, amdEnabled, amdRedirectOnMachineDetected, amdRedirectText, dialTimeout, timeLimit, sttLabel } = transferParam;
|
|
36
36
|
const payload = {
|
|
37
37
|
_voiceGateway2: {
|
|
@@ -122,9 +122,9 @@ exports.transfer = {
|
|
|
122
122
|
recognizer.model = googleModel;
|
|
123
123
|
}
|
|
124
124
|
if (recognizer.vendor === 'deepgram') {
|
|
125
|
-
recognizer.model =
|
|
125
|
+
recognizer.model = sttModel;
|
|
126
126
|
recognizer.deepgramOptions = {
|
|
127
|
-
model:
|
|
127
|
+
model: sttModel,
|
|
128
128
|
punctuate: !sttDisablePunctuation,
|
|
129
129
|
endpointing: deepgramEndpointing ? deepgramEndpointingValue : false,
|
|
130
130
|
smartFormatting: deepgramSmartFormatting !== null && deepgramSmartFormatting !== void 0 ? deepgramSmartFormatting : false
|
|
@@ -264,7 +264,7 @@ exports.voiceConfigFields = [
|
|
|
264
264
|
defaultValue: "",
|
|
265
265
|
params: {
|
|
266
266
|
languageKey: "config.sttLanguage",
|
|
267
|
-
modelKey: "config.
|
|
267
|
+
modelKey: "config.sttModel",
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
270
|
{
|
|
@@ -275,7 +275,7 @@ exports.voiceConfigFields = [
|
|
|
275
275
|
defaultValue: "",
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
|
-
key: "
|
|
278
|
+
key: "sttModel",
|
|
279
279
|
type: "sttSelect",
|
|
280
280
|
label: "_unused_",
|
|
281
281
|
description: "_unused_",
|
|
@@ -248,7 +248,7 @@ exports.voiceConfigFields = [
|
|
|
248
248
|
defaultValue: "",
|
|
249
249
|
params: {
|
|
250
250
|
languageKey: "config.sttLanguage",
|
|
251
|
-
modelKey: "config.
|
|
251
|
+
modelKey: "config.sttModel",
|
|
252
252
|
}
|
|
253
253
|
},
|
|
254
254
|
{
|
|
@@ -259,14 +259,22 @@ exports.voiceConfigFields = [
|
|
|
259
259
|
defaultValue: "",
|
|
260
260
|
},
|
|
261
261
|
{
|
|
262
|
-
key: "
|
|
262
|
+
key: "sttModel",
|
|
263
263
|
type: "sttSelect",
|
|
264
264
|
label: "_unused_",
|
|
265
265
|
description: "_unused_",
|
|
266
266
|
defaultValue: "",
|
|
267
267
|
condition: {
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
and: [
|
|
269
|
+
{
|
|
270
|
+
key: "sttVendor",
|
|
271
|
+
value: "deepgram"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
key: "sttVendor",
|
|
275
|
+
value: "openai"
|
|
276
|
+
}
|
|
277
|
+
]
|
|
270
278
|
}
|
|
271
279
|
},
|
|
272
280
|
{
|
|
@@ -1096,6 +1104,7 @@ exports.setSessionConfigNode = (0, createNodeDescriptor_1.createNodeDescriptor)(
|
|
|
1096
1104
|
try {
|
|
1097
1105
|
const voiceSettings = (0, setSessionConfig_mapper_2.voiceConfigParamsToVoiceSettings)(config, api);
|
|
1098
1106
|
const payload = setSessionConfig_mapper_1.setSessionConfig.handleVGInput(voiceSettings, sessionParams, api);
|
|
1107
|
+
api.log("error", JSON.stringify(payload));
|
|
1099
1108
|
await api.say(null, {
|
|
1100
1109
|
_cognigy: payload,
|
|
1101
1110
|
});
|
|
@@ -315,7 +315,7 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
315
315
|
defaultValue: "",
|
|
316
316
|
params: {
|
|
317
317
|
languageKey: "config.sttLanguage",
|
|
318
|
-
modelKey: "config.
|
|
318
|
+
modelKey: "config.sttModel"
|
|
319
319
|
},
|
|
320
320
|
condition: {
|
|
321
321
|
key: "transferType",
|
|
@@ -323,7 +323,7 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
323
323
|
}
|
|
324
324
|
},
|
|
325
325
|
{
|
|
326
|
-
key: "
|
|
326
|
+
key: "sttModel",
|
|
327
327
|
type: "sttSelect",
|
|
328
328
|
label: "_unused_",
|
|
329
329
|
description: "_unused_",
|
|
@@ -553,7 +553,7 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
553
553
|
summary: "UI__NODE_EDITOR__VOICEGATEWAY2__TRANSFER__SUMMARY",
|
|
554
554
|
function: async ({ cognigy, config, }) => {
|
|
555
555
|
const { api, input } = cognigy;
|
|
556
|
-
const { transferType, transferTarget, referredBy, mediaPath, useTransferSipHeaders, transferSipHeaders = {}, transferReason, dialMusic, dialTranscriptionWebhook, dialCallerId, recognitionChannel, sttVendor, sttLanguage, sttDisablePunctuation, dialTimeout, enableTimeLimit, timeLimit, amdEnabled, amdRedirectOnMachineDetected, amdRedirectText, sttLabel, googleModel,
|
|
556
|
+
const { transferType, transferTarget, referredBy, mediaPath, useTransferSipHeaders, transferSipHeaders = {}, transferReason, dialMusic, dialTranscriptionWebhook, dialCallerId, recognitionChannel, sttVendor, sttLanguage, sttDisablePunctuation, dialTimeout, enableTimeLimit, timeLimit, amdEnabled, amdRedirectOnMachineDetected, amdRedirectText, sttLabel, googleModel, sttModel, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting, agentAssistEnabled, agentAssistHeadersKey = customHeaderDefaultValue, anchorMedia } = config;
|
|
557
557
|
const transferParams = {
|
|
558
558
|
transferType,
|
|
559
559
|
transferReason,
|
|
@@ -627,7 +627,7 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
627
627
|
transferParams.useTransferSipHeaders = false;
|
|
628
628
|
api.log("error", "Invalid JSON in Transfer SIP Headers");
|
|
629
629
|
}
|
|
630
|
-
const payload = transfer_mapper_1.transfer.handleInput("voiceGateway2", transferParams, false, recognitionChannel, sttVendor, sttLanguage, googleModel,
|
|
630
|
+
const payload = transfer_mapper_1.transfer.handleInput("voiceGateway2", transferParams, false, recognitionChannel, sttVendor, sttLanguage, googleModel, sttModel, sttDisablePunctuation, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting, media, anchorMedia);
|
|
631
631
|
await api.say(null, {
|
|
632
632
|
_cognigy: payload,
|
|
633
633
|
});
|