@cognigy/rest-api-client 2026.1.0 → 2026.2.0-rc1
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/README.md +15 -0
- package/build/apigroups/InsightsAPIGroup_2_1.js +27 -0
- package/build/apigroups/ResourcesAPIGroup_2_0.js +134 -383
- package/build/apigroups/SimulationAPIGroup_2_0.js +24 -23
- package/build/apigroups/aiAgentsV2/agent.js +3 -0
- package/build/apigroups/aiAgentsV2/agentAPI.js +38 -0
- package/build/apigroups/aiAgentsV2/agentPersona.js +3 -0
- package/build/apigroups/aiAgentsV2/agentPersonaAPI.js +38 -0
- package/build/apigroups/aiAgentsV2/tool.js +3 -0
- package/build/apigroups/aiAgentsV2/toolAPI.js +35 -0
- package/build/apigroups/aiAgentsV2/toolDescriptor.js +3 -0
- package/build/apigroups/aiAgentsV2/toolDescriptorAPI.js +13 -0
- package/build/apigroups/index.js +3 -1
- package/build/shared/charts/descriptors/connectionNodes/smtp/index.js +5 -1
- package/build/shared/charts/descriptors/connectionNodes/smtp/oAuth2ClientCredentialsConnection.js +15 -0
- package/build/shared/charts/descriptors/connectionNodes/smtp/oAuth2JwtBearerConnection.js +13 -0
- package/build/shared/charts/descriptors/connectionNodes/smtp/sendEmail.js +54 -10
- package/build/shared/charts/descriptors/connectionNodes/speechProviders/elevenlabsSpeechProviderConnection.js +52 -0
- package/build/shared/charts/descriptors/connectionNodes/speechProviders/index.js +8 -7
- package/build/shared/charts/descriptors/index.js +4 -0
- package/build/shared/charts/descriptors/message/question/question.js +249 -59
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +17 -15
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJobCallMCPTool.js +6 -4
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJobMCPTool.js +57 -1
- package/build/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +7 -0
- package/build/shared/charts/descriptors/service/aiAgentV2.js +89 -0
- package/build/shared/charts/descriptors/service/index.js +5 -1
- package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +15 -13
- package/build/shared/charts/descriptors/service/llmPrompt/llmPromptMCPTool.js +57 -1
- package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +67 -13
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +25 -3
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +65 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +7 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +137 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +135 -2
- package/build/shared/errors/ErrorCode.js +2 -1
- package/build/shared/errors/ErrorCollection.js +1 -0
- package/build/shared/helper/BaseContext.js +1 -1
- package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +1 -0
- package/build/shared/interfaces/handover.js +1 -0
- package/build/shared/interfaces/handoverProviders.js +0 -1
- package/build/shared/interfaces/messageAPI/endpoints.js +3 -0
- package/build/shared/interfaces/resources/IAuditEvent.js +1 -0
- package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +1 -1
- package/build/shared/interfaces/resources/settings/IAudioPreviewSettings.js +7 -1
- package/build/shared/interfaces/restAPI/analytics/IDeleteConversationsBySessionRest_2_1.js +3 -0
- package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IRunKnowledgeConnectorRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/simulation/simulationOverview/IGetSimulationOverviewMetricsRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/simulation/simulationOverview/IGetSuccessRateTrendRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/simulation/simulationOverview/IGetUpcomingScheduledRunsRestData_2_0.js +3 -0
- package/build/shared/interfaces/security/ISessionScope.js +3 -0
- package/build/spec/aiAgentV2.spec.js +564 -0
- package/dist/esm/apigroups/InsightsAPIGroup_2_1.js +13 -0
- package/dist/esm/apigroups/ResourcesAPIGroup_2_0.js +134 -383
- package/dist/esm/apigroups/SimulationAPIGroup_2_0.js +24 -23
- package/dist/esm/apigroups/aiAgentsV2/agent.js +2 -0
- package/dist/esm/apigroups/aiAgentsV2/agentAPI.js +24 -0
- package/dist/esm/apigroups/aiAgentsV2/agentPersona.js +2 -0
- package/dist/esm/apigroups/aiAgentsV2/agentPersonaAPI.js +24 -0
- package/dist/esm/apigroups/aiAgentsV2/aiAgentV2API.js +2 -0
- package/dist/esm/apigroups/aiAgentsV2/tool.js +2 -0
- package/dist/esm/apigroups/aiAgentsV2/toolAPI.js +21 -0
- package/dist/esm/apigroups/aiAgentsV2/toolDescriptor.js +2 -0
- package/dist/esm/apigroups/aiAgentsV2/toolDescriptorAPI.js +9 -0
- package/dist/esm/apigroups/index.js +1 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/smtp/index.js +5 -1
- package/dist/esm/shared/charts/descriptors/connectionNodes/smtp/oAuth2ClientCredentialsConnection.js +12 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/smtp/oAuth2JwtBearerConnection.js +10 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/smtp/sendEmail.js +54 -10
- package/dist/esm/shared/charts/descriptors/connectionNodes/speechProviders/elevenlabsSpeechProviderConnection.js +49 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/speechProviders/index.js +3 -3
- package/dist/esm/shared/charts/descriptors/index.js +5 -1
- package/dist/esm/shared/charts/descriptors/message/question/question.js +249 -59
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +17 -15
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJobCallMCPTool.js +6 -4
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJobMCPTool.js +56 -0
- package/dist/esm/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +7 -0
- package/dist/esm/shared/charts/descriptors/service/aiAgentV2.js +87 -0
- package/dist/esm/shared/charts/descriptors/service/index.js +2 -0
- package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +22 -20
- package/dist/esm/shared/charts/descriptors/service/llmPrompt/llmPromptMCPTool.js +56 -0
- package/dist/esm/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +67 -13
- package/dist/esm/shared/charts/descriptors/voice/mappers/transfer.mapper.js +25 -3
- package/dist/esm/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +65 -0
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/play.js +7 -0
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +137 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/transfer.js +135 -2
- package/dist/esm/shared/errors/ErrorCode.js +2 -1
- package/dist/esm/shared/errors/ErrorCollection.js +1 -0
- package/dist/esm/shared/helper/BaseContext.js +1 -1
- package/dist/esm/shared/interfaces/generativeAI/IGenerativeAIModels.js +1 -0
- package/dist/esm/shared/interfaces/handover.js +1 -0
- package/dist/esm/shared/interfaces/handoverProviders.js +0 -1
- package/dist/esm/shared/interfaces/messageAPI/endpoints.js +3 -0
- package/dist/esm/shared/interfaces/resources/IAuditEvent.js +1 -0
- package/dist/esm/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +1 -1
- package/dist/esm/shared/interfaces/resources/settings/IAudioPreviewSettings.js +7 -1
- package/dist/esm/shared/interfaces/restAPI/analytics/IDeleteConversationsBySessionRest_2_1.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/connector/IRunKnowledgeConnectorRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/simulation/simulationOverview/IGetSimulationOverviewMetricsRestData_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/simulation/simulationOverview/IGetSuccessRateTrendRestData_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/simulation/simulationOverview/IGetUpcomingScheduledRunsRestData_2_0.js +2 -0
- package/dist/esm/shared/interfaces/security/ISessionScope.js +2 -0
- package/dist/esm/spec/aiAgentV2.spec.js +563 -0
- package/package.json +6 -3
- package/types/index.d.ts +667 -30
|
@@ -927,7 +927,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
927
927
|
],
|
|
928
928
|
tags: ["ai", "aiAgent"],
|
|
929
929
|
function: async ({ cognigy, config, childConfigs, nodeId }) => {
|
|
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
|
+
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, _26, _27;
|
|
931
931
|
const { api, context, input, profile, flowReferenceId } = cognigy;
|
|
932
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;
|
|
933
933
|
try {
|
|
@@ -977,7 +977,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
977
977
|
throw new Error(`[VG2] Error on AI Agent Job node. Error message: ${error.message}`);
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
|
-
const
|
|
980
|
+
const _28 = profile, { profileId, accepted_gdpr, prevent_data_collection, privacy_policy } = _28, cleanedProfile = __rest(_28, ["profileId", "accepted_gdpr", "prevent_data_collection", "privacy_policy"]);
|
|
981
981
|
const userMemory = (0, getUserMemory_1.getUserMemory)(memoryType, selectedProfileFields, aiAgent, cleanedProfile);
|
|
982
982
|
/**
|
|
983
983
|
* ----- Knowledge Search Section -----
|
|
@@ -1324,18 +1324,20 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1324
1324
|
mcpHeaders,
|
|
1325
1325
|
timeout: (_11 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _11 === void 0 ? void 0 : _11.timeout,
|
|
1326
1326
|
mcpToolNode: toolChild === null || toolChild === void 0 ? void 0 : toolChild.id,
|
|
1327
|
+
authType: (_12 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _12 === void 0 ? void 0 : _12.authType,
|
|
1328
|
+
oAuth2Connection: (_13 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _13 === void 0 ? void 0 : _13.oAuth2Connection,
|
|
1327
1329
|
})), { toolCall: mainToolCall }),
|
|
1328
1330
|
});
|
|
1329
1331
|
// if there are any parameters/arguments, add them to the input slots
|
|
1330
1332
|
if (mainToolCall.function.arguments) {
|
|
1331
|
-
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (
|
|
1333
|
+
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (_15 = (_14 = input.aiAgent) === null || _14 === void 0 ? void 0 : _14.toolArgs) !== null && _15 !== void 0 ? _15 : {}), mainToolCall.function.arguments) });
|
|
1332
1334
|
}
|
|
1333
1335
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
1334
|
-
if ((
|
|
1336
|
+
if ((_16 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _16 === void 0 ? void 0 : _16.debugMessage) {
|
|
1335
1337
|
const toolId = isMcpToolCall ? mainToolCall.function.name : await api.parseCognigyScriptText(toolChild.config.toolId);
|
|
1336
1338
|
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${toolId}`];
|
|
1337
1339
|
// Arguments / Parameters Slots
|
|
1338
|
-
const slots = ((
|
|
1340
|
+
const slots = ((_17 = mainToolCall === null || mainToolCall === void 0 ? void 0 : mainToolCall.function) === null || _17 === void 0 ? void 0 : _17.arguments) && Object.keys(mainToolCall.function.arguments);
|
|
1339
1341
|
const hasSlots = slots && slots.length > 0;
|
|
1340
1342
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
1341
1343
|
if (hasSlots) {
|
|
@@ -1350,7 +1352,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1350
1352
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
1351
1353
|
});
|
|
1352
1354
|
}
|
|
1353
|
-
(
|
|
1355
|
+
(_18 = api.logDebugMessage) === null || _18 === void 0 ? void 0 : _18.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER");
|
|
1354
1356
|
}
|
|
1355
1357
|
if (toolChild) {
|
|
1356
1358
|
api.setNextNode(toolChild.id);
|
|
@@ -1375,11 +1377,11 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1375
1377
|
}
|
|
1376
1378
|
// Optionally output the result immediately
|
|
1377
1379
|
if (llmResult.result && outputImmediately && !llmPromptOptions.stream) {
|
|
1378
|
-
await ((
|
|
1380
|
+
await ((_19 = api.output) === null || _19 === void 0 ? void 0 : _19.call(api, llmResult.result, {}));
|
|
1379
1381
|
}
|
|
1380
1382
|
else if (llmResult.finishReason && llmPromptOptions.stream) {
|
|
1381
1383
|
// send the finishReason as last output for a stream
|
|
1382
|
-
(
|
|
1384
|
+
(_20 = api.output) === null || _20 === void 0 ? void 0 : _20.call(api, "", {
|
|
1383
1385
|
_cognigy: {
|
|
1384
1386
|
_preventTranscript: true,
|
|
1385
1387
|
_messageId,
|
|
@@ -1402,7 +1404,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1402
1404
|
}
|
|
1403
1405
|
// Add response to Cognigy Input/Context for further usage
|
|
1404
1406
|
if (storeLocation === "context") {
|
|
1405
|
-
(
|
|
1407
|
+
(_21 = api.addToContext) === null || _21 === void 0 ? void 0 : _21.call(api, contextKey, llmResult, "simple");
|
|
1406
1408
|
}
|
|
1407
1409
|
else if (storeLocation === "input") {
|
|
1408
1410
|
api.addToInput(inputKey, llmResult);
|
|
@@ -1415,14 +1417,14 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1415
1417
|
const errorDetails = {
|
|
1416
1418
|
name: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
1417
1419
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
1418
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1420
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_22 = error.originalErrorDetails) === null || _22 === void 0 ? void 0 : _22.message),
|
|
1419
1421
|
};
|
|
1420
|
-
(
|
|
1422
|
+
(_23 = api.emitEvent) === null || _23 === void 0 ? void 0 : _23.call(api, "nodeError", { nodeId, flowId: flowReferenceId, errorMessage: error });
|
|
1421
1423
|
if (logErrorToSystem) {
|
|
1422
|
-
(
|
|
1424
|
+
(_24 = api.log) === null || _24 === void 0 ? void 0 : _24.call(api, "error", JSON.stringify(errorDetails));
|
|
1423
1425
|
}
|
|
1424
1426
|
if (errorHandling !== "stop") {
|
|
1425
|
-
(
|
|
1427
|
+
(_25 = api.logDebugError) === null || _25 === void 0 ? void 0 : _25.call(api, errorDetails.message + (errorDetails.code ? ` (error code: ${errorDetails.code})` : ""), errorDetails.name);
|
|
1426
1428
|
}
|
|
1427
1429
|
if (storeErrorInInput) {
|
|
1428
1430
|
input.aiAgent = input.aiAgent || {};
|
|
@@ -1431,7 +1433,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1431
1433
|
if (errorHandling === "continue") {
|
|
1432
1434
|
// output the timeout message
|
|
1433
1435
|
if (errorMessage) {
|
|
1434
|
-
await ((
|
|
1436
|
+
await ((_26 = api.output) === null || _26 === void 0 ? void 0 : _26.call(api, errorMessage, null));
|
|
1435
1437
|
}
|
|
1436
1438
|
// Set default node as next node
|
|
1437
1439
|
const defaultChild = childConfigs.find(child => child.type === "aiAgentJobDefault");
|
|
@@ -1443,7 +1445,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1443
1445
|
if (!errorHandlingGotoTarget) {
|
|
1444
1446
|
throw new Error("GoTo Target is required");
|
|
1445
1447
|
}
|
|
1446
|
-
if (!((
|
|
1448
|
+
if (!((_27 = api.checkThink) === null || _27 === void 0 ? void 0 : _27.call(api, nodeId))) {
|
|
1447
1449
|
api.resetNextNodes();
|
|
1448
1450
|
await api.executeFlow({
|
|
1449
1451
|
flowNode: {
|
|
@@ -95,7 +95,7 @@ exports.AI_AGENT_JOB_CALL_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescri
|
|
|
95
95
|
},
|
|
96
96
|
tags: ["ai", "aiAgent"],
|
|
97
97
|
function: async ({ cognigy, config }) => {
|
|
98
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
99
99
|
const { api } = cognigy;
|
|
100
100
|
const { storeLocation, contextKey, inputKey, resolveImmediately, debugToolResult } = config;
|
|
101
101
|
const sessionState = await api.loadSessionState();
|
|
@@ -118,10 +118,12 @@ exports.AI_AGENT_JOB_CALL_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescri
|
|
|
118
118
|
toolArgs: toolCall.function.arguments,
|
|
119
119
|
timeout,
|
|
120
120
|
mcpHeaders: mcpHeaders !== null && mcpHeaders !== void 0 ? mcpHeaders : {},
|
|
121
|
+
authType: (_h = (_g = sessionState.lastToolCall) === null || _g === void 0 ? void 0 : _g.authType) !== null && _h !== void 0 ? _h : "none",
|
|
122
|
+
oAuth2Connection: (_j = sessionState.lastToolCall) === null || _j === void 0 ? void 0 : _j.oAuth2Connection,
|
|
121
123
|
});
|
|
122
124
|
fullResult = JSON.stringify(toolResult, null, 2);
|
|
123
125
|
if (debugToolResult) {
|
|
124
|
-
(
|
|
126
|
+
(_k = api.logDebugMessage) === null || _k === void 0 ? void 0 : _k.call(api, `Tool <b>${(_l = toolCall === null || toolCall === void 0 ? void 0 : toolCall.function) === null || _l === void 0 ? void 0 : _l.name}</b> called successfully.<br><br><b>Result:</b><br>${fullResult}`);
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
catch (error) {
|
|
@@ -131,11 +133,11 @@ exports.AI_AGENT_JOB_CALL_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescri
|
|
|
131
133
|
message: error.message,
|
|
132
134
|
}
|
|
133
135
|
: error;
|
|
134
|
-
(
|
|
136
|
+
(_m = api.logDebugError) === null || _m === void 0 ? void 0 : _m.call(api, `Failed to execute MCP Tool ${(_o = toolCall === null || toolCall === void 0 ? void 0 : toolCall.function) === null || _o === void 0 ? void 0 : _o.name}:<br>${JSON.stringify(errorDetails, null, 2)}`);
|
|
135
137
|
}
|
|
136
138
|
// Add result to Cognigy Input/Context for further usage
|
|
137
139
|
if (storeLocation === "context") {
|
|
138
|
-
(
|
|
140
|
+
(_p = api.addToContext) === null || _p === void 0 ? void 0 : _p.call(api, contextKey, toolResult, "simple");
|
|
139
141
|
}
|
|
140
142
|
else if (storeLocation === "input") {
|
|
141
143
|
api.addToInput(inputKey, toolResult);
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AI_AGENT_JOB_MCP_TOOL = void 0;
|
|
3
|
+
exports.AI_AGENT_JOB_MCP_TOOL = exports.AI_AGENT_MCP_TOOL_CONNECTION_OAUTH2 = void 0;
|
|
4
4
|
/* Custom modules */
|
|
5
5
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
|
+
exports.AI_AGENT_MCP_TOOL_CONNECTION_OAUTH2 = {
|
|
7
|
+
type: "mcp_oauth2",
|
|
8
|
+
label: "UI__NODE_EDITOR__MCP_OAUTH2_CONNECTION__LABEL",
|
|
9
|
+
fields: [
|
|
10
|
+
{ fieldName: "oAuth2Url", label: "UI__CONNECTION_EDITOR__FIELD_OAUTH2_URL" },
|
|
11
|
+
{ fieldName: "oAuth2ClientId", label: "UI__CONNECTION_EDITOR__FIELD_CLIENT_ID" },
|
|
12
|
+
{ fieldName: "oAuth2ClientSecret", label: "UI__CONNECTION_EDITOR__FIELD_CLIENT_SECRET" },
|
|
13
|
+
{ fieldName: "oAuth2Scope", label: "UI__CONNECTION_EDITOR__FIELD_SCOPE" }
|
|
14
|
+
]
|
|
15
|
+
};
|
|
6
16
|
exports.AI_AGENT_JOB_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
7
17
|
type: "aiAgentJobMCPTool",
|
|
8
18
|
defaultLabel: "MCP Tool",
|
|
@@ -170,8 +180,53 @@ exports.AI_AGENT_JOB_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)
|
|
|
170
180
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__HEADERS__DESCRIPTION",
|
|
171
181
|
defaultValue: "{}",
|
|
172
182
|
},
|
|
183
|
+
{
|
|
184
|
+
key: "oAuth2Connection",
|
|
185
|
+
type: "connection",
|
|
186
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__OAUTH2_CONNECTION__LABEL",
|
|
187
|
+
params: {
|
|
188
|
+
connectionType: exports.AI_AGENT_MCP_TOOL_CONNECTION_OAUTH2.type
|
|
189
|
+
},
|
|
190
|
+
condition: {
|
|
191
|
+
key: "authType",
|
|
192
|
+
value: "oAuth2"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
key: "authType",
|
|
197
|
+
type: "select",
|
|
198
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__AUTH_TYPE__LABEL",
|
|
199
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__AUTH_TYPE__DESCRIPTION",
|
|
200
|
+
defaultValue: "none",
|
|
201
|
+
params: {
|
|
202
|
+
required: true,
|
|
203
|
+
options: [
|
|
204
|
+
{
|
|
205
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__AUTH_TYPE__OPTIONS__NONE__LABEL",
|
|
206
|
+
value: "none"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__AUTH_TYPE__OPTIONS__OAUTH2__LABEL",
|
|
210
|
+
value: "oAuth2"
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
resetOption: {
|
|
215
|
+
lookupValue: "none",
|
|
216
|
+
fieldsToReset: ["oAuth2Connection"]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
173
219
|
],
|
|
174
220
|
sections: [
|
|
221
|
+
{
|
|
222
|
+
key: "auth",
|
|
223
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__SECTIONS__AUTHENTICATION__LABEL",
|
|
224
|
+
defaultCollapsed: true,
|
|
225
|
+
fields: [
|
|
226
|
+
"authType",
|
|
227
|
+
"oAuth2Connection"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
175
230
|
{
|
|
176
231
|
key: "debugging",
|
|
177
232
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__DEBUG_SETTINGS__LABEL",
|
|
@@ -191,6 +246,7 @@ exports.AI_AGENT_JOB_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)
|
|
|
191
246
|
{ type: "field", key: "mcpWarning" },
|
|
192
247
|
{ type: "field", key: "mcpServerUrl" },
|
|
193
248
|
{ type: "field", key: "timeout" },
|
|
249
|
+
{ type: "section", key: "auth" },
|
|
194
250
|
{ type: "section", key: "debugging" },
|
|
195
251
|
{ type: "section", key: "advanced" },
|
|
196
252
|
],
|
|
@@ -56,6 +56,13 @@ const createToolDefinitions = async (childConfigs, api, useStrict) => {
|
|
|
56
56
|
timeout,
|
|
57
57
|
cacheTools,
|
|
58
58
|
mcpHeaders,
|
|
59
|
+
authType: child.config.authType,
|
|
60
|
+
oAuth2Connection: child.config.authType === "oAuth2" ? {
|
|
61
|
+
oAuth2Url: child.config.oAuth2Connection.oAuth2Url,
|
|
62
|
+
oAuth2ClientId: child.config.oAuth2Connection.oAuth2ClientId,
|
|
63
|
+
oAuth2ClientSecret: child.config.oAuth2Connection.oAuth2ClientSecret,
|
|
64
|
+
oAuth2Scope: child.config.oAuth2Connection.oAuth2Scope,
|
|
65
|
+
} : undefined,
|
|
59
66
|
});
|
|
60
67
|
mcpTools = fetched.tools;
|
|
61
68
|
fetchedFromCache = fetched.fromCache;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AI_AGENT_V2 = void 0;
|
|
4
|
+
/* Custom Modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
6
|
+
/**
|
|
7
|
+
* This is a prototype!
|
|
8
|
+
*/
|
|
9
|
+
exports.AI_AGENT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
10
|
+
type: "aiAgentV2",
|
|
11
|
+
defaultLabel: "AI Agent V2",
|
|
12
|
+
summary: "AI Agent V2",
|
|
13
|
+
fields: [
|
|
14
|
+
{
|
|
15
|
+
key: "agentId",
|
|
16
|
+
type: "cognigyText",
|
|
17
|
+
label: " ",
|
|
18
|
+
params: {
|
|
19
|
+
required: true,
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "apiKeyAuthKeyConnection",
|
|
24
|
+
type: "connection",
|
|
25
|
+
label: "apiKey",
|
|
26
|
+
params: {
|
|
27
|
+
connectionType: "http_apiKeyAuthKey"
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
tags: ["ai"],
|
|
32
|
+
function: async ({ cognigy, config }) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const { api, input } = cognigy;
|
|
35
|
+
const agentId = config.agentId;
|
|
36
|
+
const apiKey = (_a = config.apiKeyAuthKeyConnection) === null || _a === void 0 ? void 0 : _a.authApiKey;
|
|
37
|
+
const text = input.text || '';
|
|
38
|
+
if (!apiKey) {
|
|
39
|
+
throw new Error("Unable to execute request. No api key provided.");
|
|
40
|
+
}
|
|
41
|
+
if (!agentId) {
|
|
42
|
+
throw new Error("Unable to execute request. No agent ID provided.");
|
|
43
|
+
}
|
|
44
|
+
const transcript = await api.getTranscript({ limit: 50 });
|
|
45
|
+
// TODO: temp hack, convertTranscript() from ll-providers package
|
|
46
|
+
const formattedTranscript = transcript
|
|
47
|
+
// keep only entries that actually have text
|
|
48
|
+
.filter(entry => (entry === null || entry === void 0 ? void 0 : entry.payload) && typeof entry.payload.text === "string")
|
|
49
|
+
.map(entry => {
|
|
50
|
+
// map to OpenAI-style role strings
|
|
51
|
+
const role = entry.role === "user"
|
|
52
|
+
? "user"
|
|
53
|
+
: entry.role === "assistant"
|
|
54
|
+
? "assistant"
|
|
55
|
+
: "system";
|
|
56
|
+
const text = entry.payload.text;
|
|
57
|
+
return `${role}: ${text}`;
|
|
58
|
+
})
|
|
59
|
+
.join("\n");
|
|
60
|
+
const resp = await api.sendAiAgentV2Turn({
|
|
61
|
+
agentReferenceId: agentId,
|
|
62
|
+
userInput: text,
|
|
63
|
+
conversationHistory: formattedTranscript,
|
|
64
|
+
openaiApiKey: apiKey,
|
|
65
|
+
});
|
|
66
|
+
if (resp.response && typeof resp.response === 'string') {
|
|
67
|
+
api.output(resp.response, {
|
|
68
|
+
_cognigy: {
|
|
69
|
+
_preventTranscript: true
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const transcriptContent = {
|
|
73
|
+
role: "assistant",
|
|
74
|
+
type: "output",
|
|
75
|
+
source: "assistant",
|
|
76
|
+
payload: {
|
|
77
|
+
text: resp.response,
|
|
78
|
+
data: {},
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
await api.addTranscriptStep(transcriptContent);
|
|
82
|
+
}
|
|
83
|
+
if (resp.toolCalls && Array.isArray(resp.toolCalls)) {
|
|
84
|
+
input.toolCalls = resp.toolCalls;
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=aiAgentV2.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.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;
|
|
3
|
+
exports.AI_AGENT_V2 = 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.AI_AGENT_MCP_TOOL_CONNECTION_OAUTH2 = 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");
|
|
@@ -71,6 +71,8 @@ var executeWorkflowTool_1 = require("./agentTools/executeWorkflowTool");
|
|
|
71
71
|
Object.defineProperty(exports, "EXECUTE_WORKFLOW_TOOL", { enumerable: true, get: function () { return executeWorkflowTool_1.EXECUTE_WORKFLOW_TOOL; } });
|
|
72
72
|
var loadAiAgent_1 = require("./aiAgent/loadAiAgent");
|
|
73
73
|
Object.defineProperty(exports, "LOAD_AI_AGENT", { enumerable: true, get: function () { return loadAiAgent_1.LOAD_AI_AGENT; } });
|
|
74
|
+
var aiAgentJobMCPTool_2 = require("./aiAgent/aiAgentJobMCPTool");
|
|
75
|
+
Object.defineProperty(exports, "AI_AGENT_MCP_TOOL_CONNECTION_OAUTH2", { enumerable: true, get: function () { return aiAgentJobMCPTool_2.AI_AGENT_MCP_TOOL_CONNECTION_OAUTH2; } });
|
|
74
76
|
var handoverConnections_1 = require("./handoverConnections");
|
|
75
77
|
Object.defineProperty(exports, "LIVE_AGENT_CONNECTION", { enumerable: true, get: function () { return handoverConnections_1.LIVE_AGENT_CONNECTION; } });
|
|
76
78
|
Object.defineProperty(exports, "RINGCENTRAL_ENGAGE_CONNECTION", { enumerable: true, get: function () { return handoverConnections_1.RINGCENTRAL_ENGAGE_CONNECTION; } });
|
|
@@ -83,4 +85,6 @@ var niceCXOneAAHAuthenticationConnection_1 = require("./niceCXOneAAHAuthenticati
|
|
|
83
85
|
Object.defineProperty(exports, "NICECXONEAAH_AUTHENTICATION_CONNECTION", { enumerable: true, get: function () { return niceCXOneAAHAuthenticationConnection_1.NICECXONEAAH_AUTHENTICATION_CONNECTION; } });
|
|
84
86
|
var aiOpsCenterConnection_1 = require("./aiOpsCenterConnection");
|
|
85
87
|
Object.defineProperty(exports, "AIOPS_CENTER_WEBHOOKS_CONNECTION", { enumerable: true, get: function () { return aiOpsCenterConnection_1.AIOPS_CENTER_WEBHOOKS_CONNECTION; } });
|
|
88
|
+
var aiAgentV2_1 = require("./aiAgentV2");
|
|
89
|
+
Object.defineProperty(exports, "AI_AGENT_V2", { enumerable: true, get: function () { return aiAgentV2_1.AI_AGENT_V2; } });
|
|
86
90
|
//# sourceMappingURL=index.js.map
|
|
@@ -707,7 +707,7 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
707
707
|
defaultMockCode: `input.llmResponse = {response: "Mock response"};`
|
|
708
708
|
},
|
|
709
709
|
function: async ({ cognigy, config, childConfigs, nodeId }) => {
|
|
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;
|
|
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, _z, _0;
|
|
711
711
|
const { api, input, flowReferenceId } = cognigy;
|
|
712
712
|
const { temperature, maxTokens, topP, presencePenalty, frequencyPenalty, useStop, stop, storeLocation, contextKey, inputKey, timeout, streamStopTokens, streamStopTokenOverrides, debugLogTokenCount, debugLogRequestAndCompletion, debugLogLLMLatency, debugLogToolDefinitions, llmProviderReferenceId, usePromptMode, chatTranscriptSteps, responseFormat, streamStoreCopyInInput, seed, immediateOutput, customModelOptions, customRequestOptions, errorHandling = "continue", // default behavior for LLM Prompt node was, continue its execution even though an error occurred (deviating it from the SEO node) & do not output an error message on UI explicitly. However, error is always stored in the input or context object. We can use an extra "say" node to output it.
|
|
713
713
|
errorHandlingGotoTarget, errorMessage, useTextAlternativeForLLM, advancedLogging, loggingWebhookUrl, loggingCustomData, loggingHeaders, conditionForLogging, logErrorToSystem, processImages, transcriptImageHandling, toolChoice, useStrict } = config;
|
|
@@ -932,17 +932,19 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
932
932
|
mcpHeaders,
|
|
933
933
|
timeout: (_k = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _k === void 0 ? void 0 : _k.timeout,
|
|
934
934
|
mcpToolNode: toolChild === null || toolChild === void 0 ? void 0 : toolChild.id,
|
|
935
|
+
authType: (_l = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _l === void 0 ? void 0 : _l.authType,
|
|
936
|
+
oAuth2Connection: (_m = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _m === void 0 ? void 0 : _m.oAuth2Connection,
|
|
935
937
|
})), { toolCall: mainToolCall }),
|
|
936
938
|
});
|
|
937
939
|
// if there are any parameters/arguments, add them to the input slots
|
|
938
940
|
if (mainToolCall.function.arguments) {
|
|
939
|
-
input.llmPrompt = Object.assign(Object.assign({}, input.llmPrompt), { toolArgs: Object.assign(Object.assign({}, (
|
|
941
|
+
input.llmPrompt = Object.assign(Object.assign({}, input.llmPrompt), { toolArgs: Object.assign(Object.assign({}, (_p = (_o = input.llmPrompt) === null || _o === void 0 ? void 0 : _o.toolArgs) !== null && _p !== void 0 ? _p : {}), mainToolCall.function.arguments) });
|
|
940
942
|
}
|
|
941
943
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
942
|
-
if ((
|
|
944
|
+
if ((_q = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _q === void 0 ? void 0 : _q.debugMessage) {
|
|
943
945
|
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${await api.parseCognigyScriptText(toolChild.config.toolId)}`];
|
|
944
946
|
// Arguments / Parameters Slots
|
|
945
|
-
const slots = ((
|
|
947
|
+
const slots = ((_r = mainToolCall === null || mainToolCall === void 0 ? void 0 : mainToolCall.function) === null || _r === void 0 ? void 0 : _r.arguments) && Object.keys(mainToolCall.function.arguments);
|
|
946
948
|
const hasSlots = slots && slots.length > 0;
|
|
947
949
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
948
950
|
if (hasSlots) {
|
|
@@ -957,7 +959,7 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
957
959
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
958
960
|
});
|
|
959
961
|
}
|
|
960
|
-
(
|
|
962
|
+
(_s = api.logDebugMessage) === null || _s === void 0 ? void 0 : _s.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER");
|
|
961
963
|
}
|
|
962
964
|
if (toolChild) {
|
|
963
965
|
api.setNextNode(toolChild.id);
|
|
@@ -982,11 +984,11 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
982
984
|
// we stringify objects (e.g. results coming from JSON Mode)
|
|
983
985
|
// so that the transcript only contains text
|
|
984
986
|
const resultToOutput = typeof ((llmResult === null || llmResult === void 0 ? void 0 : llmResult.result) || llmResult) === "object" ? JSON.stringify((llmResult === null || llmResult === void 0 ? void 0 : llmResult.result) || llmResult, undefined, 2) : (llmResult === null || llmResult === void 0 ? void 0 : llmResult.result) || llmResult;
|
|
985
|
-
await ((
|
|
987
|
+
await ((_t = api.output) === null || _t === void 0 ? void 0 : _t.call(api, resultToOutput, {}));
|
|
986
988
|
}
|
|
987
989
|
else if (llmResult.finishReason && llmPromptOptions.stream) {
|
|
988
990
|
// send the finishReason as last output for a stream
|
|
989
|
-
(
|
|
991
|
+
(_u = api.output) === null || _u === void 0 ? void 0 : _u.call(api, "", {
|
|
990
992
|
_cognigy: {
|
|
991
993
|
_preventTranscript: true,
|
|
992
994
|
_messageId,
|
|
@@ -1009,7 +1011,7 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1009
1011
|
}
|
|
1010
1012
|
// Add response to Cognigy Input/Context for further usage
|
|
1011
1013
|
if (storeLocation === "context") {
|
|
1012
|
-
(
|
|
1014
|
+
(_v = api.addToContext) === null || _v === void 0 ? void 0 : _v.call(api, contextKey, llmResult, "simple");
|
|
1013
1015
|
}
|
|
1014
1016
|
else if (storeLocation === "input") {
|
|
1015
1017
|
api.addToInput(inputKey, llmResult);
|
|
@@ -1022,19 +1024,19 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1022
1024
|
const errorDetailsBase = {
|
|
1023
1025
|
name: error === null || error === void 0 ? void 0 : error.name,
|
|
1024
1026
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
1025
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1027
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_w = error.originalErrorDetails) === null || _w === void 0 ? void 0 : _w.message),
|
|
1026
1028
|
};
|
|
1027
1029
|
const errorDetails = Object.assign(Object.assign({}, errorDetailsBase), { originalErrorDetails: error === null || error === void 0 ? void 0 : error.originalErrorDetails });
|
|
1028
1030
|
// return the requestId if it exist in the error obj.
|
|
1029
|
-
if ((
|
|
1031
|
+
if ((_x = error.meta) === null || _x === void 0 ? void 0 : _x.requestId) {
|
|
1030
1032
|
errorDetails["meta"] = {
|
|
1031
|
-
requestId: (
|
|
1033
|
+
requestId: (_y = error.meta) === null || _y === void 0 ? void 0 : _y.requestId
|
|
1032
1034
|
};
|
|
1033
1035
|
}
|
|
1034
1036
|
if (logErrorToSystem) {
|
|
1035
|
-
(
|
|
1037
|
+
(_z = api.log) === null || _z === void 0 ? void 0 : _z.call(api, "error", JSON.stringify(errorDetailsBase));
|
|
1036
1038
|
}
|
|
1037
|
-
(
|
|
1039
|
+
(_0 = api.logDebugError) === null || _0 === void 0 ? void 0 : _0.call(api, errorDetailsBase, "UI__DEBUG_MODE__LLM_PROMPT__ERROR");
|
|
1038
1040
|
await handleServiceError(errorDetails);
|
|
1039
1041
|
return;
|
|
1040
1042
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LLM_PROMPT_MCP_TOOL = void 0;
|
|
3
|
+
exports.LLM_PROMPT_MCP_TOOL = exports.LLM_PROMPT_MCP_TOOL_CONNECTION_OAUTH2 = void 0;
|
|
4
4
|
/* Custom modules */
|
|
5
5
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
|
+
exports.LLM_PROMPT_MCP_TOOL_CONNECTION_OAUTH2 = {
|
|
7
|
+
type: "mcp_oauth2",
|
|
8
|
+
label: "UI__NODE_EDITOR__MCP_OAUTH2_CONNECTION__LABEL",
|
|
9
|
+
fields: [
|
|
10
|
+
{ fieldName: "oAuth2Url", label: "UI__CONNECTION_EDITOR__FIELD_OAUTH2_URL" },
|
|
11
|
+
{ fieldName: "oAuth2ClientId", label: "UI__CONNECTION_EDITOR__FIELD_CLIENT_ID" },
|
|
12
|
+
{ fieldName: "oAuth2ClientSecret", label: "UI__CONNECTION_EDITOR__FIELD_CLIENT_SECRET" },
|
|
13
|
+
{ fieldName: "oAuth2Scope", label: "UI__CONNECTION_EDITOR__FIELD_SCOPE" }
|
|
14
|
+
]
|
|
15
|
+
};
|
|
6
16
|
exports.LLM_PROMPT_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
7
17
|
type: "llmPromptMCPTool",
|
|
8
18
|
defaultLabel: "MCP Tool",
|
|
@@ -170,8 +180,53 @@ exports.LLM_PROMPT_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
170
180
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__HEADERS__DESCRIPTION",
|
|
171
181
|
defaultValue: "{}",
|
|
172
182
|
},
|
|
183
|
+
{
|
|
184
|
+
key: "oAuth2Connection",
|
|
185
|
+
type: "connection",
|
|
186
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__OAUTH2_CONNECTION__LABEL",
|
|
187
|
+
params: {
|
|
188
|
+
connectionType: exports.LLM_PROMPT_MCP_TOOL_CONNECTION_OAUTH2.type
|
|
189
|
+
},
|
|
190
|
+
condition: {
|
|
191
|
+
key: "authType",
|
|
192
|
+
value: "oAuth2"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
key: "authType",
|
|
197
|
+
type: "select",
|
|
198
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__AUTH_TYPE__LABEL",
|
|
199
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__AUTH_TYPE__DESCRIPTION",
|
|
200
|
+
defaultValue: "none",
|
|
201
|
+
params: {
|
|
202
|
+
required: true,
|
|
203
|
+
options: [
|
|
204
|
+
{
|
|
205
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__AUTH_TYPE__OPTIONS__NONE__LABEL",
|
|
206
|
+
value: "none"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__AUTH_TYPE__OPTIONS__OAUTH2__LABEL",
|
|
210
|
+
value: "oAuth2"
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
resetOption: {
|
|
215
|
+
lookupValue: "none",
|
|
216
|
+
fieldsToReset: ["oAuth2Connection"]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
173
219
|
],
|
|
174
220
|
sections: [
|
|
221
|
+
{
|
|
222
|
+
key: "auth",
|
|
223
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__SECTIONS__AUTHENTICATION__LABEL",
|
|
224
|
+
defaultCollapsed: true,
|
|
225
|
+
fields: [
|
|
226
|
+
"authType",
|
|
227
|
+
"oAuth2Connection"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
175
230
|
{
|
|
176
231
|
key: "debugging",
|
|
177
232
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__DEBUG_SETTINGS__LABEL",
|
|
@@ -191,6 +246,7 @@ exports.LLM_PROMPT_MCP_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
191
246
|
{ type: "field", key: "mcpWarning" },
|
|
192
247
|
{ type: "field", key: "mcpServerUrl" },
|
|
193
248
|
{ type: "field", key: "timeout" },
|
|
249
|
+
{ type: "section", key: "auth" },
|
|
194
250
|
{ type: "section", key: "debugging" },
|
|
195
251
|
{ type: "section", key: "advanced" },
|
|
196
252
|
],
|