@cognigy/rest-api-client 2025.18.1 → 2025.20.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 +10 -0
- package/build/apigroups/InsightsAPIGroup_2_0.js +10 -10
- package/build/apigroups/MetricsAPIGroup_2_0.js +4 -0
- package/build/authentication/OAuth2/OAuth2Authentication.js +2 -0
- package/build/connector/AxiosAdapter.js +4 -1
- package/build/shared/charts/descriptors/nlu/fuzzySearch.js +6 -6
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +81 -21
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJobCallMCPTool.js +7 -5
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJobMCPTool.js +8 -1
- package/build/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +2 -0
- package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +78 -18
- package/build/shared/charts/descriptors/service/llmPrompt/llmPromptMCPTool.js +8 -1
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +20 -6
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +39 -3
- package/build/shared/interfaces/IOrganisation.js +1 -0
- package/build/shared/interfaces/handover.js +3 -1
- package/build/shared/interfaces/messageAPI/endpoints.js +2 -0
- package/build/shared/interfaces/resources/IAuditEvent.js +2 -1
- package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +1 -1
- package/build/shared/interfaces/restAPI/metrics/logs/v2.0/ITailLogEntriesRest_2_0.js +3 -0
- package/dist/esm/apigroups/InsightsAPIGroup_2_0.js +10 -10
- package/dist/esm/apigroups/MetricsAPIGroup_2_0.js +4 -0
- package/dist/esm/authentication/OAuth2/OAuth2Authentication.js +2 -0
- package/dist/esm/connector/AxiosAdapter.js +4 -1
- package/dist/esm/shared/charts/descriptors/nlu/fuzzySearch.js +6 -6
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +81 -21
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJobCallMCPTool.js +7 -5
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJobMCPTool.js +8 -1
- package/dist/esm/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +2 -0
- package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +85 -25
- package/dist/esm/shared/charts/descriptors/service/llmPrompt/llmPromptMCPTool.js +8 -1
- package/dist/esm/shared/charts/descriptors/voice/mappers/transfer.mapper.js +20 -6
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/transfer.js +39 -3
- package/dist/esm/shared/interfaces/IOrganisation.js +1 -0
- package/dist/esm/shared/interfaces/handover.js +3 -1
- package/dist/esm/shared/interfaces/messageAPI/endpoints.js +2 -0
- package/dist/esm/shared/interfaces/resources/IAuditEvent.js +2 -1
- package/dist/esm/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +1 -1
- package/dist/esm/shared/interfaces/restAPI/metrics/logs/v2.0/ITailLogEntriesRest_2_0.js +2 -0
- package/package.json +1 -1
- package/types/index.d.ts +873 -816
- package/build/test.js +0 -39
- package/dist/esm/shared/interfaces/restAPI/management/authentication/ICreateJWTToken.js +0 -1
- package/dist/esm/test.js +0 -39
|
@@ -415,6 +415,57 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
415
415
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__INCLUDE_ALL_OUTPUT_TYPES__DESCRIPTION",
|
|
416
416
|
defaultValue: true,
|
|
417
417
|
},
|
|
418
|
+
{
|
|
419
|
+
key: "advancedLogging",
|
|
420
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__ADVANCED_LOGGING__LABEL",
|
|
421
|
+
type: "toggle",
|
|
422
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__ADVANCED_LOGGING__DESCRIPTION",
|
|
423
|
+
defaultValue: false,
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
key: "loggingWebhookUrl",
|
|
427
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOGGING_WEBHOOK_URL__LABEL",
|
|
428
|
+
type: "cognigyText",
|
|
429
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOGGING_WEBHOOK_URL__DESCRIPTION",
|
|
430
|
+
defaultValue: "",
|
|
431
|
+
condition: {
|
|
432
|
+
key: "advancedLogging",
|
|
433
|
+
value: true
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
key: "loggingCustomData",
|
|
438
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CUSTOM_LOGGING_DATA__LABEL",
|
|
439
|
+
type: "cognigyText",
|
|
440
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CUSTOM_LOGGING_DATA__DESCRIPTION",
|
|
441
|
+
defaultValue: "",
|
|
442
|
+
condition: {
|
|
443
|
+
key: "advancedLogging",
|
|
444
|
+
value: true
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
key: "loggingHeaders",
|
|
449
|
+
type: "keyValuePairs",
|
|
450
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOGGING_HEADERS__LABEL",
|
|
451
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOGGING_HEADERS__DESCRIPTION",
|
|
452
|
+
defaultValue: "{}",
|
|
453
|
+
condition: {
|
|
454
|
+
key: "advancedLogging",
|
|
455
|
+
value: true
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
key: "conditionForLogging",
|
|
460
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CONDITION_FOR_LOGGING__LABEL",
|
|
461
|
+
type: "cognigyText",
|
|
462
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CONDITION_FOR_LOGGING__DESCRIPTION",
|
|
463
|
+
defaultValue: "",
|
|
464
|
+
condition: {
|
|
465
|
+
key: "advancedLogging",
|
|
466
|
+
value: true
|
|
467
|
+
}
|
|
468
|
+
},
|
|
418
469
|
{
|
|
419
470
|
key: "logErrorToSystem",
|
|
420
471
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOG_TO_SYSTEM__LABEL",
|
|
@@ -810,7 +861,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
810
861
|
"timeoutInMs",
|
|
811
862
|
"maxTokens",
|
|
812
863
|
"temperature",
|
|
813
|
-
"useTextAlternativeForLLM"
|
|
864
|
+
"useTextAlternativeForLLM"
|
|
814
865
|
],
|
|
815
866
|
},
|
|
816
867
|
{
|
|
@@ -835,7 +886,12 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
835
886
|
"debugLogTokenCount",
|
|
836
887
|
"debugLogSystemPrompt",
|
|
837
888
|
"debugLogToolDefinitions",
|
|
838
|
-
"debugLogLLMLatency"
|
|
889
|
+
"debugLogLLMLatency",
|
|
890
|
+
"advancedLogging",
|
|
891
|
+
"loggingWebhookUrl",
|
|
892
|
+
"loggingCustomData",
|
|
893
|
+
"conditionForLogging",
|
|
894
|
+
"loggingHeaders",
|
|
839
895
|
],
|
|
840
896
|
}
|
|
841
897
|
],
|
|
@@ -856,9 +912,9 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
856
912
|
],
|
|
857
913
|
tags: ["ai", "aiAgent"],
|
|
858
914
|
function: ({ cognigy, config, childConfigs, nodeId }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
859
|
-
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;
|
|
915
|
+
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;
|
|
860
916
|
const { api, context, input, profile, flowReferenceId } = cognigy;
|
|
861
|
-
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, logErrorToSystem, storeErrorInInput, errorHandling, errorHandlingGotoTarget, errorMessage, debugConfig, debugLogTokenCount, debugLogSystemPrompt, debugLogToolDefinitions, debugResult, debugLogLLMLatency, storeLocation, contextKey, inputKey, streamStoreCopyInInput, streamStopTokens, processImages, transcriptImageHandling, sessionParams } = config;
|
|
917
|
+
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;
|
|
862
918
|
try {
|
|
863
919
|
if (!aiAgent) {
|
|
864
920
|
throw new Error("Could not resolve AI Agent reference in AI Agent Node");
|
|
@@ -906,7 +962,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
906
962
|
throw new Error(`[VG2] Error on AI Agent Job node. Error message: ${error.message}`);
|
|
907
963
|
}
|
|
908
964
|
}
|
|
909
|
-
const
|
|
965
|
+
const _25 = profile, { profileId, accepted_gdpr, prevent_data_collection, privacy_policy } = _25, cleanedProfile = __rest(_25, ["profileId", "accepted_gdpr", "prevent_data_collection", "privacy_policy"]);
|
|
910
966
|
const userMemory = getUserMemory(memoryType, selectedProfileFields, aiAgent, cleanedProfile);
|
|
911
967
|
/**
|
|
912
968
|
* ----- Knowledge Search Section -----
|
|
@@ -1151,7 +1207,8 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1151
1207
|
}
|
|
1152
1208
|
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
1153
1209
|
const _messageId = randomUUID();
|
|
1154
|
-
const
|
|
1210
|
+
const enableAdvancedLogging = advancedLogging && loggingWebhookUrl && (conditionForLogging === "" || !!conditionForLogging);
|
|
1211
|
+
const llmPromptOptions = Object.assign(Object.assign(Object.assign({ prompt: "", chat: systemMessage,
|
|
1155
1212
|
// Temp fix to override the transcript if needed
|
|
1156
1213
|
transcript: ((_0 = context === null || context === void 0 ? void 0 : context._cognigy) === null || _0 === void 0 ? void 0 : _0.transcript) ? [...context._cognigy.transcript] : transcript, detailedResults: true, timeoutInMs: timeoutInMs !== null && timeoutInMs !== void 0 ? timeoutInMs : 8000, maxTokens: maxTokens !== null && maxTokens !== void 0 ? maxTokens : 4000, temperature: temperature !== null && temperature !== void 0 ? temperature : 0.7, topP: 1, frequencyPenalty: 0, presencePenalty: 0, responseFormat: "text", stream: storeLocation === "stream", streamOnDataHandler: (text) => {
|
|
1157
1214
|
var _a;
|
|
@@ -1169,7 +1226,9 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1169
1226
|
}
|
|
1170
1227
|
});
|
|
1171
1228
|
}
|
|
1172
|
-
}, streamStopTokens: streamStopTokens || [".", "!", "?", "\\n"], preventNewLineRemoval: isStreamingChannel ? true : false }, (tools.length > 0 && { tools })), (tools.length > 0 && { toolChoice: toolChoice }))
|
|
1229
|
+
}, streamStopTokens: streamStopTokens || [".", "!", "?", "\\n"], preventNewLineRemoval: isStreamingChannel ? true : false }, (tools.length > 0 && { tools })), (tools.length > 0 && { toolChoice: toolChoice })), (enableAdvancedLogging && {
|
|
1230
|
+
logging: Object.assign(Object.assign({ webhookUrl: loggingWebhookUrl }, (loggingCustomData && { customData: loggingCustomData })), (loggingHeaders && { headers: loggingHeaders }))
|
|
1231
|
+
}));
|
|
1173
1232
|
// llmProviderReferenceId `default` value is not a responseFormat, rather it is LLM Model default selection.
|
|
1174
1233
|
if (llmProviderReferenceId && llmProviderReferenceId !== "default") {
|
|
1175
1234
|
llmPromptOptions["llmProviderReferenceId"] = llmProviderReferenceId;
|
|
@@ -1244,20 +1303,21 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1244
1303
|
node: nodeId,
|
|
1245
1304
|
} }, (isMcpToolCall && {
|
|
1246
1305
|
mcpServerUrl: (_8 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _8 === void 0 ? void 0 : _8.mcpServerUrl,
|
|
1247
|
-
|
|
1306
|
+
mcpHeaders: (_9 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _9 === void 0 ? void 0 : _9.mcpHeaders,
|
|
1307
|
+
timeout: (_10 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _10 === void 0 ? void 0 : _10.timeout,
|
|
1248
1308
|
mcpToolNode: toolChild === null || toolChild === void 0 ? void 0 : toolChild.id,
|
|
1249
1309
|
})), { toolCall: mainToolCall }),
|
|
1250
1310
|
});
|
|
1251
1311
|
// if there are any parameters/arguments, add them to the input slots
|
|
1252
1312
|
if (mainToolCall.function.arguments) {
|
|
1253
|
-
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (
|
|
1313
|
+
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (_12 = (_11 = input.aiAgent) === null || _11 === void 0 ? void 0 : _11.toolArgs) !== null && _12 !== void 0 ? _12 : {}), mainToolCall.function.arguments) });
|
|
1254
1314
|
}
|
|
1255
1315
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
1256
|
-
if ((
|
|
1316
|
+
if ((_13 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _13 === void 0 ? void 0 : _13.debugMessage) {
|
|
1257
1317
|
const toolId = isMcpToolCall ? mainToolCall.function.name : yield api.parseCognigyScriptText(toolChild.config.toolId);
|
|
1258
1318
|
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${toolId}`];
|
|
1259
1319
|
// Arguments / Parameters Slots
|
|
1260
|
-
const slots = ((
|
|
1320
|
+
const slots = ((_14 = mainToolCall === null || mainToolCall === void 0 ? void 0 : mainToolCall.function) === null || _14 === void 0 ? void 0 : _14.arguments) && Object.keys(mainToolCall.function.arguments);
|
|
1261
1321
|
const hasSlots = slots && slots.length > 0;
|
|
1262
1322
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
1263
1323
|
if (hasSlots) {
|
|
@@ -1272,7 +1332,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1272
1332
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
1273
1333
|
});
|
|
1274
1334
|
}
|
|
1275
|
-
(
|
|
1335
|
+
(_15 = api.logDebugMessage) === null || _15 === void 0 ? void 0 : _15.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER");
|
|
1276
1336
|
}
|
|
1277
1337
|
if (toolChild) {
|
|
1278
1338
|
api.setNextNode(toolChild.id);
|
|
@@ -1297,11 +1357,11 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1297
1357
|
}
|
|
1298
1358
|
// Optionally output the result immediately
|
|
1299
1359
|
if (llmResult.result && outputImmediately && !llmPromptOptions.stream) {
|
|
1300
|
-
yield ((
|
|
1360
|
+
yield ((_16 = api.output) === null || _16 === void 0 ? void 0 : _16.call(api, llmResult.result, {}));
|
|
1301
1361
|
}
|
|
1302
1362
|
else if (llmResult.finishReason && llmPromptOptions.stream) {
|
|
1303
1363
|
// send the finishReason as last output for a stream
|
|
1304
|
-
(
|
|
1364
|
+
(_17 = api.output) === null || _17 === void 0 ? void 0 : _17.call(api, "", {
|
|
1305
1365
|
_cognigy: {
|
|
1306
1366
|
_preventTranscript: true,
|
|
1307
1367
|
_messageId,
|
|
@@ -1324,7 +1384,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1324
1384
|
}
|
|
1325
1385
|
// Add response to Cognigy Input/Context for further usage
|
|
1326
1386
|
if (storeLocation === "context") {
|
|
1327
|
-
(
|
|
1387
|
+
(_18 = api.addToContext) === null || _18 === void 0 ? void 0 : _18.call(api, contextKey, llmResult, "simple");
|
|
1328
1388
|
}
|
|
1329
1389
|
else if (storeLocation === "input") {
|
|
1330
1390
|
api.addToInput(inputKey, llmResult);
|
|
@@ -1337,14 +1397,14 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1337
1397
|
const errorDetails = {
|
|
1338
1398
|
name: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
1339
1399
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
1340
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1400
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_19 = error.originalErrorDetails) === null || _19 === void 0 ? void 0 : _19.message),
|
|
1341
1401
|
};
|
|
1342
|
-
(
|
|
1402
|
+
(_20 = api.emitEvent) === null || _20 === void 0 ? void 0 : _20.call(api, "nodeError", { nodeId, flowId: flowReferenceId, errorMessage: error });
|
|
1343
1403
|
if (logErrorToSystem) {
|
|
1344
|
-
(
|
|
1404
|
+
(_21 = api.log) === null || _21 === void 0 ? void 0 : _21.call(api, "error", JSON.stringify(errorDetails));
|
|
1345
1405
|
}
|
|
1346
1406
|
if (errorHandling !== "stop") {
|
|
1347
|
-
(
|
|
1407
|
+
(_22 = api.logDebugError) === null || _22 === void 0 ? void 0 : _22.call(api, errorDetails.message + (errorDetails.code ? ` (error code: ${errorDetails.code})` : ""), errorDetails.name);
|
|
1348
1408
|
}
|
|
1349
1409
|
if (storeErrorInInput) {
|
|
1350
1410
|
input.aiAgent = input.aiAgent || {};
|
|
@@ -1353,7 +1413,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1353
1413
|
if (errorHandling === "continue") {
|
|
1354
1414
|
// output the timeout message
|
|
1355
1415
|
if (errorMessage) {
|
|
1356
|
-
yield ((
|
|
1416
|
+
yield ((_23 = api.output) === null || _23 === void 0 ? void 0 : _23.call(api, errorMessage, null));
|
|
1357
1417
|
}
|
|
1358
1418
|
// Set default node as next node
|
|
1359
1419
|
const defaultChild = childConfigs.find(child => child.type === "aiAgentJobDefault");
|
|
@@ -1365,7 +1425,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1365
1425
|
if (!errorHandlingGotoTarget) {
|
|
1366
1426
|
throw new Error("GoTo Target is required");
|
|
1367
1427
|
}
|
|
1368
|
-
if (!((
|
|
1428
|
+
if (!((_24 = api.checkThink) === null || _24 === void 0 ? void 0 : _24.call(api, nodeId))) {
|
|
1369
1429
|
api.resetNextNodes();
|
|
1370
1430
|
yield api.executeFlow({
|
|
1371
1431
|
flowNode: {
|
|
@@ -92,7 +92,7 @@ export const AI_AGENT_JOB_CALL_MCP_TOOL = createNodeDescriptor({
|
|
|
92
92
|
},
|
|
93
93
|
tags: ["ai", "aiAgent"],
|
|
94
94
|
function: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
95
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
96
96
|
const { api } = cognigy;
|
|
97
97
|
const { storeLocation, contextKey, inputKey, resolveImmediately, debugToolResult } = config;
|
|
98
98
|
const sessionState = yield api.loadSessionState();
|
|
@@ -100,8 +100,9 @@ export const AI_AGENT_JOB_CALL_MCP_TOOL = createNodeDescriptor({
|
|
|
100
100
|
const aiAgentJobNode = (_b = sessionState.lastToolCall) === null || _b === void 0 ? void 0 : _b.aiAgentJobNode;
|
|
101
101
|
const mcpServerUrl = (_c = sessionState.lastToolCall) === null || _c === void 0 ? void 0 : _c.mcpServerUrl;
|
|
102
102
|
const timeout = (_d = sessionState.lastToolCall) === null || _d === void 0 ? void 0 : _d.timeout;
|
|
103
|
+
const mcpHeaders = (_e = sessionState.lastToolCall) === null || _e === void 0 ? void 0 : _e.mcpHeaders;
|
|
103
104
|
if (!(toolCall === null || toolCall === void 0 ? void 0 : toolCall.id)) {
|
|
104
|
-
(
|
|
105
|
+
(_f = api.logDebugError) === null || _f === void 0 ? void 0 : _f.call(api, "UI__DEBUG_MODE__AI_AGENT_ANSWER__ERROR__MESSAGE");
|
|
105
106
|
}
|
|
106
107
|
if (toolCall && aiAgentJobNode && mcpServerUrl && timeout) {
|
|
107
108
|
let toolResult = null;
|
|
@@ -112,10 +113,11 @@ export const AI_AGENT_JOB_CALL_MCP_TOOL = createNodeDescriptor({
|
|
|
112
113
|
toolName: toolCall.function.name,
|
|
113
114
|
toolArgs: toolCall.function.arguments,
|
|
114
115
|
timeout,
|
|
116
|
+
mcpHeaders: mcpHeaders !== null && mcpHeaders !== void 0 ? mcpHeaders : {},
|
|
115
117
|
});
|
|
116
118
|
fullResult = JSON.stringify(toolResult, null, 2);
|
|
117
119
|
if (debugToolResult) {
|
|
118
|
-
(
|
|
120
|
+
(_g = api.logDebugMessage) === null || _g === void 0 ? void 0 : _g.call(api, `Tool <b>${(_h = toolCall === null || toolCall === void 0 ? void 0 : toolCall.function) === null || _h === void 0 ? void 0 : _h.name}</b> called successfully.<br><br><b>Result:</b><br>${fullResult}`);
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
catch (error) {
|
|
@@ -125,11 +127,11 @@ export const AI_AGENT_JOB_CALL_MCP_TOOL = createNodeDescriptor({
|
|
|
125
127
|
message: error.message,
|
|
126
128
|
}
|
|
127
129
|
: error;
|
|
128
|
-
(
|
|
130
|
+
(_j = api.logDebugError) === null || _j === void 0 ? void 0 : _j.call(api, `Failed to execute MCP Tool ${(_k = toolCall === null || toolCall === void 0 ? void 0 : toolCall.function) === null || _k === void 0 ? void 0 : _k.name}:<br>${JSON.stringify(errorDetails, null, 2)}`);
|
|
129
131
|
}
|
|
130
132
|
// Add result to Cognigy Input/Context for further usage
|
|
131
133
|
if (storeLocation === "context") {
|
|
132
|
-
(
|
|
134
|
+
(_l = api.addToContext) === null || _l === void 0 ? void 0 : _l.call(api, contextKey, toolResult, "simple");
|
|
133
135
|
}
|
|
134
136
|
else if (storeLocation === "input") {
|
|
135
137
|
api.addToInput(inputKey, toolResult);
|
|
@@ -160,6 +160,13 @@ export const AI_AGENT_JOB_MCP_TOOL = createNodeDescriptor({
|
|
|
160
160
|
value: "blacklist",
|
|
161
161
|
},
|
|
162
162
|
},
|
|
163
|
+
{
|
|
164
|
+
key: "mcpHeaders",
|
|
165
|
+
type: "keyValuePairs",
|
|
166
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__HEADERS__LABEL",
|
|
167
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__HEADERS__DESCRIPTION",
|
|
168
|
+
defaultValue: "{}",
|
|
169
|
+
},
|
|
163
170
|
],
|
|
164
171
|
sections: [
|
|
165
172
|
{
|
|
@@ -172,7 +179,7 @@ export const AI_AGENT_JOB_MCP_TOOL = createNodeDescriptor({
|
|
|
172
179
|
key: "advanced",
|
|
173
180
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__ADVANCED__LABEL",
|
|
174
181
|
defaultCollapsed: true,
|
|
175
|
-
fields: ["cacheTools", "condition", "toolFilter", "whitelist", "blacklist"],
|
|
182
|
+
fields: ["cacheTools", "condition", "toolFilter", "whitelist", "blacklist", "mcpHeaders"],
|
|
176
183
|
},
|
|
177
184
|
],
|
|
178
185
|
form: [
|
|
@@ -72,12 +72,14 @@ export const createToolDefinitions = (childConfigs, api, useStrict) => __awaiter
|
|
|
72
72
|
const cacheTools = child.config.cacheTools;
|
|
73
73
|
const sendDebug = child.config.debugMessageFetchedTools;
|
|
74
74
|
const toolFilter = child.config.toolFilter;
|
|
75
|
+
const mcpHeaders = child.config.mcpHeaders;
|
|
75
76
|
let mcpTools = null;
|
|
76
77
|
try {
|
|
77
78
|
mcpTools = yield api.fetchMcpTools({
|
|
78
79
|
mcpServerUrl,
|
|
79
80
|
timeout,
|
|
80
81
|
cacheTools,
|
|
82
|
+
mcpHeaders,
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
85
|
catch (error) {
|
|
@@ -395,6 +395,57 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
395
395
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__INCLUDE_ALL_OUTPUT_TYPES__DESCRIPTION",
|
|
396
396
|
defaultValue: true,
|
|
397
397
|
},
|
|
398
|
+
{
|
|
399
|
+
key: "advancedLogging",
|
|
400
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__ADVANCED_LOGGING__LABEL",
|
|
401
|
+
type: "toggle",
|
|
402
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__ADVANCED_LOGGING__DESCRIPTION",
|
|
403
|
+
defaultValue: false,
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
key: "loggingWebhookUrl",
|
|
407
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOGGING_WEBHOOK_URL__LABEL",
|
|
408
|
+
type: "cognigyText",
|
|
409
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOGGING_WEBHOOK_URL__DESCRIPTION",
|
|
410
|
+
defaultValue: "",
|
|
411
|
+
condition: {
|
|
412
|
+
key: "advancedLogging",
|
|
413
|
+
value: true
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
key: "loggingCustomData",
|
|
418
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CUSTOM_LOGGING_DATA__LABEL",
|
|
419
|
+
type: "cognigyText",
|
|
420
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CUSTOM_LOGGING_DATA__DESCRIPTION",
|
|
421
|
+
defaultValue: "",
|
|
422
|
+
condition: {
|
|
423
|
+
key: "advancedLogging",
|
|
424
|
+
value: true
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
key: "loggingHeaders",
|
|
429
|
+
type: "keyValuePairs",
|
|
430
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOGGING_HEADERS__LABEL",
|
|
431
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__LOGGING_HEADERS__DESCRIPTION",
|
|
432
|
+
defaultValue: "{}",
|
|
433
|
+
condition: {
|
|
434
|
+
key: "advancedLogging",
|
|
435
|
+
value: true
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
key: "conditionForLogging",
|
|
440
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CONDITION_FOR_LOGGING__LABEL",
|
|
441
|
+
type: "cognigyText",
|
|
442
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CONDITION_FOR_LOGGING__DESCRIPTION",
|
|
443
|
+
defaultValue: "",
|
|
444
|
+
condition: {
|
|
445
|
+
key: "advancedLogging",
|
|
446
|
+
value: true
|
|
447
|
+
}
|
|
448
|
+
},
|
|
398
449
|
{
|
|
399
450
|
key: "customModelOptions",
|
|
400
451
|
label: "UI__NODE_EDITOR__SERVICE__GPT_PROMPT__FIELDS__CUSTOM_MODEL_OPTIONS__LABEL",
|
|
@@ -595,7 +646,12 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
595
646
|
"debugLogTokenCount",
|
|
596
647
|
"debugLogRequestAndCompletion",
|
|
597
648
|
"debugLogLLMLatency",
|
|
598
|
-
"debugLogToolDefinitions"
|
|
649
|
+
"debugLogToolDefinitions",
|
|
650
|
+
"advancedLogging",
|
|
651
|
+
"loggingWebhookUrl",
|
|
652
|
+
"loggingCustomData",
|
|
653
|
+
"conditionForLogging",
|
|
654
|
+
"loggingHeaders",
|
|
599
655
|
]
|
|
600
656
|
},
|
|
601
657
|
{
|
|
@@ -633,10 +689,10 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
633
689
|
},
|
|
634
690
|
tags: ["ai", "llm", "gpt", "generative ai", "openai", "azure", "prompt"],
|
|
635
691
|
function: ({ cognigy, config, childConfigs, nodeId }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
636
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
692
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
637
693
|
const { api, input, flowReferenceId } = cognigy;
|
|
638
694
|
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.
|
|
639
|
-
errorHandlingGotoTarget, errorMessage, useTextAlternativeForLLM, logErrorToSystem, processImages, transcriptImageHandling, toolChoice, useStrict } = config;
|
|
695
|
+
errorHandlingGotoTarget, errorMessage, useTextAlternativeForLLM, advancedLogging, loggingWebhookUrl, loggingCustomData, loggingHeaders, conditionForLogging, logErrorToSystem, processImages, transcriptImageHandling, toolChoice, useStrict } = config;
|
|
640
696
|
let prompt = config.prompt || "";
|
|
641
697
|
const { traceId } = input;
|
|
642
698
|
// check if custom variables are used and if they have a length modifier
|
|
@@ -661,17 +717,17 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
661
717
|
}
|
|
662
718
|
// handle errors from external services, depending on the settings
|
|
663
719
|
const handleServiceError = (error) => __awaiter(void 0, void 0, void 0, function* () {
|
|
664
|
-
var
|
|
720
|
+
var _z, _0, _1, _2, _3, _4;
|
|
665
721
|
const compactError = {
|
|
666
722
|
name: error === null || error === void 0 ? void 0 : error.name,
|
|
667
723
|
code: error === null || error === void 0 ? void 0 : error.code,
|
|
668
724
|
message: (error === null || error === void 0 ? void 0 : error.message) || error
|
|
669
725
|
};
|
|
670
726
|
// return the requestId if it exist in the error obj.
|
|
671
|
-
if ((
|
|
672
|
-
compactError["requestId"] = (
|
|
727
|
+
if ((_z = error === null || error === void 0 ? void 0 : error.meta) === null || _z === void 0 ? void 0 : _z.requestId) {
|
|
728
|
+
compactError["requestId"] = (_0 = error === null || error === void 0 ? void 0 : error.meta) === null || _0 === void 0 ? void 0 : _0.requestId;
|
|
673
729
|
}
|
|
674
|
-
if ((
|
|
730
|
+
if ((_1 = error === null || error === void 0 ? void 0 : error.originalErrorDetails) === null || _1 === void 0 ? void 0 : _1.code) {
|
|
675
731
|
compactError.code = error.originalErrorDetails.code;
|
|
676
732
|
}
|
|
677
733
|
const errorResponse = {
|
|
@@ -680,7 +736,7 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
680
736
|
// add error to context or input
|
|
681
737
|
switch (storeLocation) {
|
|
682
738
|
case "context":
|
|
683
|
-
(
|
|
739
|
+
(_2 = api.addToContext) === null || _2 === void 0 ? void 0 : _2.call(api, contextKey, errorResponse, "simple");
|
|
684
740
|
break;
|
|
685
741
|
default:
|
|
686
742
|
api.addToInput(inputKey, errorResponse);
|
|
@@ -688,7 +744,7 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
688
744
|
if (errorHandling === "continue") {
|
|
689
745
|
// output the timeout message
|
|
690
746
|
if (errorMessage) {
|
|
691
|
-
yield ((
|
|
747
|
+
yield ((_3 = api.output) === null || _3 === void 0 ? void 0 : _3.call(api, errorMessage, null));
|
|
692
748
|
}
|
|
693
749
|
// Continue with default node as next node
|
|
694
750
|
const defaultChild = childConfigs === null || childConfigs === void 0 ? void 0 : childConfigs.find(child => child.type === "llmPromptDefault");
|
|
@@ -715,7 +771,7 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
715
771
|
absorbContext: false
|
|
716
772
|
}
|
|
717
773
|
};
|
|
718
|
-
yield ((
|
|
774
|
+
yield ((_4 = GO_TO.function) === null || _4 === void 0 ? void 0 : _4.call(GO_TO, gotoParams));
|
|
719
775
|
}
|
|
720
776
|
else {
|
|
721
777
|
throw new InternalServerError(error === null || error === void 0 ? void 0 : error.message, { traceId });
|
|
@@ -730,10 +786,11 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
730
786
|
* Retrieve the tool definitions from the child nodes
|
|
731
787
|
*/
|
|
732
788
|
const { toolIds, toolNames, toolMap, tools } = yield createToolDefinitions(childConfigs, api, useStrict);
|
|
789
|
+
const enableAdvancedLogging = advancedLogging && loggingWebhookUrl && (conditionForLogging === "" || !!conditionForLogging);
|
|
733
790
|
/**
|
|
734
791
|
* Generate Prompt Options
|
|
735
792
|
*/
|
|
736
|
-
const llmPromptOptions = Object.assign(Object.assign(Object.assign({ prompt,
|
|
793
|
+
const llmPromptOptions = Object.assign(Object.assign(Object.assign(Object.assign({ prompt,
|
|
737
794
|
temperature,
|
|
738
795
|
maxTokens,
|
|
739
796
|
topP,
|
|
@@ -756,7 +813,9 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
756
813
|
}
|
|
757
814
|
}, streamStopTokens: streamStopTokens || [".", "!", "?", "\\n"], streamStopTokenOverrides, preventNewLineRemoval: isStreamingChannel ? true : false,
|
|
758
815
|
// set to true in order to get token usage
|
|
759
|
-
detailedResults: true, seed: Number(seed) ? Number(seed) : undefined }, (tools.length > 0 && { tools })), (tools.length > 0 && { toolChoice: toolChoice })), {
|
|
816
|
+
detailedResults: true, seed: Number(seed) ? Number(seed) : undefined }, (tools.length > 0 && { tools })), (tools.length > 0 && { toolChoice: toolChoice })), (enableAdvancedLogging && {
|
|
817
|
+
logging: Object.assign(Object.assign({ webhookUrl: loggingWebhookUrl }, (loggingCustomData && { customData: loggingCustomData })), (loggingHeaders && { headers: loggingHeaders }))
|
|
818
|
+
})), { customModelOptions,
|
|
760
819
|
customRequestOptions });
|
|
761
820
|
if (useStop) {
|
|
762
821
|
llmPromptOptions["stop"] = stop;
|
|
@@ -848,19 +907,20 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
848
907
|
node: nodeId,
|
|
849
908
|
} }, (isMcpToolCall && {
|
|
850
909
|
mcpServerUrl: (_h = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _h === void 0 ? void 0 : _h.mcpServerUrl,
|
|
851
|
-
|
|
910
|
+
mcpHeaders: (_j = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _j === void 0 ? void 0 : _j.mcpHeaders,
|
|
911
|
+
timeout: (_k = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _k === void 0 ? void 0 : _k.timeout,
|
|
852
912
|
mcpToolNode: toolChild === null || toolChild === void 0 ? void 0 : toolChild.id,
|
|
853
913
|
})), { toolCall: mainToolCall }),
|
|
854
914
|
});
|
|
855
915
|
// if there are any parameters/arguments, add them to the input slots
|
|
856
916
|
if (mainToolCall.function.arguments) {
|
|
857
|
-
input.llmPrompt = Object.assign(Object.assign({}, input.llmPrompt), { toolArgs: Object.assign(Object.assign({}, (
|
|
917
|
+
input.llmPrompt = Object.assign(Object.assign({}, input.llmPrompt), { toolArgs: Object.assign(Object.assign({}, (_m = (_l = input.llmPrompt) === null || _l === void 0 ? void 0 : _l.toolArgs) !== null && _m !== void 0 ? _m : {}), mainToolCall.function.arguments) });
|
|
858
918
|
}
|
|
859
919
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
860
|
-
if ((
|
|
920
|
+
if ((_o = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _o === void 0 ? void 0 : _o.debugMessage) {
|
|
861
921
|
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${yield api.parseCognigyScriptText(toolChild.config.toolId)}`];
|
|
862
922
|
// Arguments / Parameters Slots
|
|
863
|
-
const slots = ((
|
|
923
|
+
const slots = ((_p = mainToolCall === null || mainToolCall === void 0 ? void 0 : mainToolCall.function) === null || _p === void 0 ? void 0 : _p.arguments) && Object.keys(mainToolCall.function.arguments);
|
|
864
924
|
const hasSlots = slots && slots.length > 0;
|
|
865
925
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
866
926
|
if (hasSlots) {
|
|
@@ -875,7 +935,7 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
875
935
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
876
936
|
});
|
|
877
937
|
}
|
|
878
|
-
(
|
|
938
|
+
(_q = api.logDebugMessage) === null || _q === void 0 ? void 0 : _q.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER");
|
|
879
939
|
}
|
|
880
940
|
if (toolChild) {
|
|
881
941
|
api.setNextNode(toolChild.id);
|
|
@@ -900,11 +960,11 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
900
960
|
// we stringify objects (e.g. results coming from JSON Mode)
|
|
901
961
|
// so that the transcript only contains text
|
|
902
962
|
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;
|
|
903
|
-
yield ((
|
|
963
|
+
yield ((_r = api.output) === null || _r === void 0 ? void 0 : _r.call(api, resultToOutput, {}));
|
|
904
964
|
}
|
|
905
965
|
else if (llmResult.finishReason && llmPromptOptions.stream) {
|
|
906
966
|
// send the finishReason as last output for a stream
|
|
907
|
-
(
|
|
967
|
+
(_s = api.output) === null || _s === void 0 ? void 0 : _s.call(api, "", {
|
|
908
968
|
_cognigy: {
|
|
909
969
|
_preventTranscript: true,
|
|
910
970
|
_messageId,
|
|
@@ -927,7 +987,7 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
927
987
|
}
|
|
928
988
|
// Add response to Cognigy Input/Context for further usage
|
|
929
989
|
if (storeLocation === "context") {
|
|
930
|
-
(
|
|
990
|
+
(_t = api.addToContext) === null || _t === void 0 ? void 0 : _t.call(api, contextKey, llmResult, "simple");
|
|
931
991
|
}
|
|
932
992
|
else if (storeLocation === "input") {
|
|
933
993
|
api.addToInput(inputKey, llmResult);
|
|
@@ -940,19 +1000,19 @@ export const LLM_PROMPT_V2 = createNodeDescriptor({
|
|
|
940
1000
|
const errorDetailsBase = {
|
|
941
1001
|
name: error === null || error === void 0 ? void 0 : error.name,
|
|
942
1002
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
943
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1003
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_u = error.originalErrorDetails) === null || _u === void 0 ? void 0 : _u.message),
|
|
944
1004
|
};
|
|
945
1005
|
const errorDetails = Object.assign(Object.assign({}, errorDetailsBase), { originalErrorDetails: error === null || error === void 0 ? void 0 : error.originalErrorDetails });
|
|
946
1006
|
// return the requestId if it exist in the error obj.
|
|
947
|
-
if ((
|
|
1007
|
+
if ((_v = error.meta) === null || _v === void 0 ? void 0 : _v.requestId) {
|
|
948
1008
|
errorDetails["meta"] = {
|
|
949
|
-
requestId: (
|
|
1009
|
+
requestId: (_w = error.meta) === null || _w === void 0 ? void 0 : _w.requestId
|
|
950
1010
|
};
|
|
951
1011
|
}
|
|
952
1012
|
if (logErrorToSystem) {
|
|
953
|
-
(
|
|
1013
|
+
(_x = api.log) === null || _x === void 0 ? void 0 : _x.call(api, "error", JSON.stringify(errorDetailsBase));
|
|
954
1014
|
}
|
|
955
|
-
(
|
|
1015
|
+
(_y = api.logDebugError) === null || _y === void 0 ? void 0 : _y.call(api, errorDetailsBase, "UI__DEBUG_MODE__LLM_PROMPT__ERROR");
|
|
956
1016
|
yield handleServiceError(errorDetails);
|
|
957
1017
|
return;
|
|
958
1018
|
}
|
|
@@ -160,6 +160,13 @@ export const LLM_PROMPT_MCP_TOOL = createNodeDescriptor({
|
|
|
160
160
|
value: "blacklist",
|
|
161
161
|
},
|
|
162
162
|
},
|
|
163
|
+
{
|
|
164
|
+
key: "mcpHeaders",
|
|
165
|
+
type: "keyValuePairs",
|
|
166
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__HEADERS__LABEL",
|
|
167
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_MCP_TOOL__FIELDS__HEADERS__DESCRIPTION",
|
|
168
|
+
defaultValue: "{}",
|
|
169
|
+
},
|
|
163
170
|
],
|
|
164
171
|
sections: [
|
|
165
172
|
{
|
|
@@ -172,7 +179,7 @@ export const LLM_PROMPT_MCP_TOOL = createNodeDescriptor({
|
|
|
172
179
|
key: "advanced",
|
|
173
180
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__ADVANCED__LABEL",
|
|
174
181
|
defaultCollapsed: true,
|
|
175
|
-
fields: ["cacheTools", "condition", "toolFilter", "whitelist", "blacklist"],
|
|
182
|
+
fields: ["cacheTools", "condition", "toolFilter", "whitelist", "blacklist", "mcpHeaders"],
|
|
176
183
|
},
|
|
177
184
|
],
|
|
178
185
|
form: [
|