@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
package/CHANGELOG.md
CHANGED
|
@@ -630,6 +630,20 @@ const ResourcesAPIGroup_2_0 = (instance) => {
|
|
|
630
630
|
var { knowledgeStoreId, sourceId, chunkId } = _a, args = __rest(_a, ["knowledgeStoreId", "sourceId", "chunkId"]);
|
|
631
631
|
return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/knowledgestores/${knowledgeStoreId}/sources/${sourceId}/chunks/${chunkId}`, "PATCH", self)(args, options);
|
|
632
632
|
},
|
|
633
|
+
indexKnowledgeConnectors: (_a, options) => {
|
|
634
|
+
var { knowledgeStoreId } = _a, args = __rest(_a, ["knowledgeStoreId"]);
|
|
635
|
+
return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/knowledgestores/${knowledgeStoreId}/connectors?${(0, query_1.stringifyQuery)(args)}`, "GET", self)(undefined, options);
|
|
636
|
+
},
|
|
637
|
+
createKnowledgeConnector: (_a, options) => {
|
|
638
|
+
var { knowledgeStoreId } = _a, args = __rest(_a, ["knowledgeStoreId"]);
|
|
639
|
+
return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/knowledgestores/${knowledgeStoreId}/connectors`, "POST", self)(args, options);
|
|
640
|
+
},
|
|
641
|
+
readKnowledgeConnector: ({ knowledgeStoreId, connectorId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/knowledgestores/${knowledgeStoreId}/connectors/${connectorId}`, "GET", self)(undefined, options),
|
|
642
|
+
updateKnowledgeConnector: (_a, options) => {
|
|
643
|
+
var { knowledgeStoreId, connectorId } = _a, args = __rest(_a, ["knowledgeStoreId", "connectorId"]);
|
|
644
|
+
return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/knowledgestores/${knowledgeStoreId}/connectors/${connectorId}`, "PATCH", self)(args, options);
|
|
645
|
+
},
|
|
646
|
+
deleteKnowledgeConnector: ({ knowledgeStoreId, connectorId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/knowledgestores/${knowledgeStoreId}/connectors/${connectorId}`, "DELETE", self)(undefined, options),
|
|
633
647
|
uploadResumable: (args) => (0, GenericTusFn_1.GenericTusFn)("/new/v2.0/uploads", self)(args),
|
|
634
648
|
generateNluScores: (_a) => {
|
|
635
649
|
var { projectId } = _a, args = __rest(_a, ["projectId"]);
|
|
@@ -64,7 +64,21 @@ function SimulationAPIGroup_2_0(instance) {
|
|
|
64
64
|
generatePersona: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/generate", "POST", self)(args, options),
|
|
65
65
|
regeneratePersonaField: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/regenerate-field", "POST", self)(args, options),
|
|
66
66
|
generateBulkPersona: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/generate-bulk", "POST", self)(args, options),
|
|
67
|
-
generatePersonaFromTranscript: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/from-transcript", "POST", self)(args, options)
|
|
67
|
+
generatePersonaFromTranscript: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/testing/beta/personas/from-transcript", "POST", self)(args, options),
|
|
68
|
+
getScheduler: (_a, options) => {
|
|
69
|
+
var { simulationReference } = _a, args = __rest(_a, ["simulationReference"]);
|
|
70
|
+
return (0, GenericAPIFn_1.GenericAPIFn)(`/testing/beta/simulations/${simulationReference}/schedules?${(0, query_1.stringifyQuery)(args)}`, "GET", self)(undefined, options);
|
|
71
|
+
},
|
|
72
|
+
createScheduler: (_a, options) => {
|
|
73
|
+
var { simulationReference } = _a, args = __rest(_a, ["simulationReference"]);
|
|
74
|
+
return (0, GenericAPIFn_1.GenericAPIFn)(`/testing/beta/simulations/${simulationReference}/schedules`, "POST", self)(args, options);
|
|
75
|
+
},
|
|
76
|
+
updateScheduler: (_a, options) => {
|
|
77
|
+
var { simulationReference, schedulerId, projectId } = _a, args = __rest(_a, ["simulationReference", "schedulerId", "projectId"]);
|
|
78
|
+
return (0, GenericAPIFn_1.GenericAPIFn)(`/testing/beta/simulations/${simulationReference}/schedules/${schedulerId}?${(0, query_1.stringifyQuery)({
|
|
79
|
+
projectId
|
|
80
|
+
})}`, "PATCH", self)(args, options);
|
|
81
|
+
}
|
|
68
82
|
};
|
|
69
83
|
}
|
|
70
84
|
exports.SimulationAPIGroup_2_0 = SimulationAPIGroup_2_0;
|
|
@@ -68,6 +68,7 @@ function AuthenticationAPI(instance) {
|
|
|
68
68
|
var { loginToken } = _a, args = __rest(_a, ["loginToken"]);
|
|
69
69
|
return (0, GenericAPIFn_1.GenericAPIFn)(`/auth/exchangetoken?${(0, rest_1.stringifyQuery)({ loginToken })}`, "GET", self)(args, Object.assign({ withAuthentication: false, withCredentials: true }, options));
|
|
70
70
|
},
|
|
71
|
+
exchangeCXoneToken: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/auth/exchangetoken/cxone", "POST", self)(args, Object.assign({ withAuthentication: false, withCredentials: true }, options)),
|
|
71
72
|
generateManagementUIAuthToken: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/management/auth/token", "POST", self)(args, options)
|
|
72
73
|
};
|
|
73
74
|
}
|
|
@@ -194,6 +194,20 @@ exports.OVERWRITE_ANALYTICS = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
194
194
|
{ type: "section", key: "defaultFields" }
|
|
195
195
|
],
|
|
196
196
|
tags: ["analytics", "customize"],
|
|
197
|
+
mocking: {
|
|
198
|
+
defaultMockCode: `
|
|
199
|
+
analyticsdata.intent = 'intent override';
|
|
200
|
+
analyticsdata.inputText = 'inputText override';
|
|
201
|
+
analyticsdata.inputData = {data: 'inputData override'};
|
|
202
|
+
analyticsdata.intentScore = 0.8;
|
|
203
|
+
analyticsdata.slots = {
|
|
204
|
+
NUMBER: [
|
|
205
|
+
1100
|
|
206
|
+
]
|
|
207
|
+
};
|
|
208
|
+
analyticsdata.understood = true;
|
|
209
|
+
`
|
|
210
|
+
},
|
|
197
211
|
function: async ({ cognigy, config }) => {
|
|
198
212
|
const { api } = cognigy;
|
|
199
213
|
let stringUpdateValue = "";
|
|
@@ -36,6 +36,11 @@ exports.UPDATE_PROFILE = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
36
36
|
type: "text"
|
|
37
37
|
},
|
|
38
38
|
tags: ["analytics", "profile"],
|
|
39
|
+
mocking: {
|
|
40
|
+
defaultMockCode: `
|
|
41
|
+
profile.name = "John Doe"
|
|
42
|
+
`
|
|
43
|
+
},
|
|
39
44
|
function: async ({ cognigy, config }) => {
|
|
40
45
|
const { key, value } = config;
|
|
41
46
|
const { api } = cognigy;
|
|
@@ -10,6 +10,12 @@ exports.EMAIL_NOTIFICATION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
10
10
|
defaultLabel: "Email Notification",
|
|
11
11
|
summary: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__SUMMARY",
|
|
12
12
|
fields: [
|
|
13
|
+
{
|
|
14
|
+
key: "senderName",
|
|
15
|
+
type: "cognigyText",
|
|
16
|
+
label: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__SENDER_NAME__LABEL",
|
|
17
|
+
description: "UI__NODE_EDITOR__SMTP__EMAIL_NOTIFICATION__SENDER_NAME__DESCRIPTION"
|
|
18
|
+
},
|
|
13
19
|
{
|
|
14
20
|
key: "recipient",
|
|
15
21
|
type: "cognigyText",
|
|
@@ -162,6 +168,7 @@ exports.EMAIL_NOTIFICATION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
162
168
|
},
|
|
163
169
|
],
|
|
164
170
|
form: [
|
|
171
|
+
{ key: "senderName", type: "field" },
|
|
165
172
|
{ key: "recipient", type: "field" },
|
|
166
173
|
{ key: "subject", type: "field" },
|
|
167
174
|
{ key: "message", type: "field" },
|
|
@@ -173,6 +173,15 @@ exports.SEND_EMAIL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
173
173
|
label: "UI__NODE_EDITOR__SMTP__SEND_EMAIL__FROM__LABEL",
|
|
174
174
|
description: "UI__NODE_EDITOR__SMTP__SEND_EMAIL__FROM__DESCRIPTION"
|
|
175
175
|
},
|
|
176
|
+
{
|
|
177
|
+
key: "senderName",
|
|
178
|
+
type: "cognigyText",
|
|
179
|
+
label: "UI__NODE_EDITOR__SMTP__SEND_EMAIL__SENDER_NAME__LABEL",
|
|
180
|
+
description: "UI__NODE_EDITOR__SMTP__SEND_EMAIL__SENDER_NAME__DESCRIPTION",
|
|
181
|
+
params: {
|
|
182
|
+
required: true
|
|
183
|
+
}
|
|
184
|
+
},
|
|
176
185
|
{
|
|
177
186
|
key: "subject",
|
|
178
187
|
type: "cognigyText",
|
|
@@ -151,7 +151,9 @@ if (process.env.DISABLE_FEATURE_TRANSCRIPT_MANAGER !== "true") {
|
|
|
151
151
|
nodes.push(service_1.AI_AGENT_TOOL_ANSWER);
|
|
152
152
|
nodes.push(service_1.KNOWLEDGE_TOOL);
|
|
153
153
|
nodes.push(service_1.HANDOVER_TO_AI_AGENT_TOOL);
|
|
154
|
+
nodes.push(service_1.HANDOVER_TO_HUMAN_AGENT_TOOL);
|
|
154
155
|
nodes.push(service_1.SEND_EMAIL_TOOL);
|
|
156
|
+
nodes.push(service_1.EXECUTE_WORKFLOW_TOOL);
|
|
155
157
|
nodes.push(service_1.AI_AGENT_HANDOVER);
|
|
156
158
|
nodes.push(service_1.LOAD_AI_AGENT);
|
|
157
159
|
}
|
|
@@ -1826,6 +1826,11 @@ DO NOT talk about other topics. Do not offer general assistance.`,
|
|
|
1826
1826
|
type: "sayNode",
|
|
1827
1827
|
},
|
|
1828
1828
|
tags: ["basic", "message", "nlu"],
|
|
1829
|
+
mocking: {
|
|
1830
|
+
defaultMockCode: `
|
|
1831
|
+
context.result = "Mocked result";
|
|
1832
|
+
`
|
|
1833
|
+
},
|
|
1829
1834
|
//#endregion DescriptorFields
|
|
1830
1835
|
function: async ({ cognigy, nodeId, organisationId, config, inputOptions }) => {
|
|
1831
1836
|
var _a, _b, _c;
|
|
@@ -88,6 +88,9 @@ exports.SAY = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
88
88
|
type: "sayNode",
|
|
89
89
|
},
|
|
90
90
|
tags: ["basic", "message"],
|
|
91
|
+
mocking: {
|
|
92
|
+
defaultMockCode: `api.say("Hello from Mock Code!");`
|
|
93
|
+
},
|
|
91
94
|
function: async ({ cognigy, config, nodeId, organisationId, nodeType }) => {
|
|
92
95
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
93
96
|
const { api } = cognigy;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXECUTE_WORKFLOW_TOOL = void 0;
|
|
4
|
+
/* Custom modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
|
+
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
7
|
+
exports.EXECUTE_WORKFLOW_TOOL = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
8
|
+
type: "executeWorkflowTool",
|
|
9
|
+
defaultLabel: "Execute Workflow Tool",
|
|
10
|
+
parentType: ["aiAgentJob", "llmPromptV2"],
|
|
11
|
+
constraints: {
|
|
12
|
+
editable: true,
|
|
13
|
+
deletable: true,
|
|
14
|
+
collapsable: true,
|
|
15
|
+
creatable: true,
|
|
16
|
+
movable: true,
|
|
17
|
+
placement: {
|
|
18
|
+
predecessor: {
|
|
19
|
+
whitelist: []
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
childFlowCreatable: false
|
|
23
|
+
},
|
|
24
|
+
behavior: {
|
|
25
|
+
stopping: true
|
|
26
|
+
},
|
|
27
|
+
preview: {
|
|
28
|
+
type: "text",
|
|
29
|
+
key: "toolId"
|
|
30
|
+
},
|
|
31
|
+
fields: [
|
|
32
|
+
{
|
|
33
|
+
key: "toolId",
|
|
34
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__TOOL_ID__LABEL",
|
|
35
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__TOOL_ID__DESCRIPTION",
|
|
36
|
+
type: "cognigyLLMText",
|
|
37
|
+
defaultValue: "execute_workflow",
|
|
38
|
+
params: {
|
|
39
|
+
required: true,
|
|
40
|
+
rows: 1,
|
|
41
|
+
multiline: false,
|
|
42
|
+
maxLength: 64,
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "description",
|
|
47
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DESCRIPTION__LABEL",
|
|
48
|
+
description: "UI__NODE_EDITOR__SERVICE__EXECUTE_WORKFLOW_TOOL__FIELDS__DESCRIPTION__DESCRIPTION",
|
|
49
|
+
type: "cognigyLLMText",
|
|
50
|
+
params: {
|
|
51
|
+
required: true,
|
|
52
|
+
rows: 5,
|
|
53
|
+
multiline: true,
|
|
54
|
+
placeholder: `Describe the action or functionality that the target Flow handles.\nFor example: "Update a booking", "Check order status", or "Start onboarding workflow". Be specific so the AI Agent knows exactly when to execute this Flow.`
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "parameters",
|
|
59
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__PARAMETERS__LABEL",
|
|
60
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__PARAMETERS__DESCRIPTION",
|
|
61
|
+
type: "toolParameters",
|
|
62
|
+
defaultValue: `{
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"execution_reason": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "The reason for executing this workflow, including context from the conversation."
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"required": ["execution_reason"],
|
|
71
|
+
"additionalProperties": false
|
|
72
|
+
}`,
|
|
73
|
+
params: {
|
|
74
|
+
required: false,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: "flowNode",
|
|
79
|
+
type: "flowNode",
|
|
80
|
+
label: "UI__NODE_EDITOR__SERVICE__EXECUTE_WORKFLOW_TOOL__FIELDS__FLOW_NODE__LABEL",
|
|
81
|
+
params: {
|
|
82
|
+
required: true,
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: "parseIntents",
|
|
87
|
+
type: "toggle",
|
|
88
|
+
label: "UI__NODE_EDITOR__EXECUTE_FLOW__PARSE_INTENTS__LABEL",
|
|
89
|
+
description: "UI__NODE_EDITOR__EXECUTE_FLOW__PARSE_INTENTS__DESCRIPTION",
|
|
90
|
+
defaultValue: false
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: "parseKeyphrases",
|
|
94
|
+
type: "toggle",
|
|
95
|
+
label: "UI__NODE_EDITOR__EXECUTE_FLOW__PARSE_KEYPHRASES__LABEL",
|
|
96
|
+
description: "UI__NODE_EDITOR__EXECUTE_FLOW__PARSE_KEYPHRASES__DESCRIPTION",
|
|
97
|
+
defaultValue: false
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
key: "absorbContext",
|
|
101
|
+
type: "toggle",
|
|
102
|
+
label: "UI__NODE_EDITOR__EXECUTE_FLOW__ABSORB_CONTEXT__LABEL",
|
|
103
|
+
description: "UI__NODE_EDITOR__EXECUTE_FLOW__ABSORB_CONTEXT__DESCRIPTION",
|
|
104
|
+
defaultValue: false
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: "debugMessage",
|
|
108
|
+
type: "toggle",
|
|
109
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DEBUG_MESSAGE__LABEL",
|
|
110
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__DEBUG_MESSAGE__DESCRIPTION",
|
|
111
|
+
defaultValue: true,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: "condition",
|
|
115
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__CONDITION__LABEL",
|
|
116
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_TOOL__FIELDS__CONDITION__DESCRIPTION",
|
|
117
|
+
type: "cognigyText",
|
|
118
|
+
defaultValue: "",
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
sections: [
|
|
122
|
+
{
|
|
123
|
+
key: "debugging",
|
|
124
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__DEBUG_SETTINGS__LABEL",
|
|
125
|
+
defaultCollapsed: true,
|
|
126
|
+
fields: [
|
|
127
|
+
"debugMessage",
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: "advanced",
|
|
132
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__ADVANCED__LABEL",
|
|
133
|
+
defaultCollapsed: true,
|
|
134
|
+
fields: [
|
|
135
|
+
"condition",
|
|
136
|
+
"parseIntents",
|
|
137
|
+
"parseKeyphrases",
|
|
138
|
+
"absorbContext",
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
form: [
|
|
143
|
+
{ type: "field", key: "toolId" },
|
|
144
|
+
{ type: "field", key: "description" },
|
|
145
|
+
{ type: "field", key: "flowNode" },
|
|
146
|
+
{ type: "section", key: "debugging" },
|
|
147
|
+
{ type: "section", key: "advanced" },
|
|
148
|
+
],
|
|
149
|
+
appearance: {
|
|
150
|
+
color: "white",
|
|
151
|
+
textColor: "#252525",
|
|
152
|
+
variant: "mini",
|
|
153
|
+
},
|
|
154
|
+
function: async ({ cognigy, config, nodeId: thisNodeId }) => {
|
|
155
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
156
|
+
const { api } = cognigy;
|
|
157
|
+
const { debugMessage, flowNode: targetFlowNode, parseIntents, parseKeyphrases, absorbContext, } = config;
|
|
158
|
+
const sessionState = await api.loadSessionState();
|
|
159
|
+
const toolCall = (_a = sessionState.lastToolCall) === null || _a === void 0 ? void 0 : _a.toolCall;
|
|
160
|
+
const aiAgentJobNode = (_b = sessionState.lastToolCall) === null || _b === void 0 ? void 0 : _b.aiAgentJobNode;
|
|
161
|
+
if (!(toolCall === null || toolCall === void 0 ? void 0 : toolCall.id)) {
|
|
162
|
+
(_c = api.logDebugError) === null || _c === void 0 ? void 0 : _c.call(api, "UI__DEBUG_MODE__AI_AGENT_ANSWER__ERROR__MESSAGE");
|
|
163
|
+
}
|
|
164
|
+
if (!(targetFlowNode === null || targetFlowNode === void 0 ? void 0 : targetFlowNode.flow)) {
|
|
165
|
+
throw new Error("Flow is required for Execute Workflow Tool");
|
|
166
|
+
}
|
|
167
|
+
if (toolCall && aiAgentJobNode) {
|
|
168
|
+
if (!((_d = api.checkThink) === null || _d === void 0 ? void 0 : _d.call(api, thisNodeId))) {
|
|
169
|
+
const executionReason = ((_f = (_e = toolCall === null || toolCall === void 0 ? void 0 : toolCall.function) === null || _e === void 0 ? void 0 : _e.arguments) === null || _f === void 0 ? void 0 : _f.execution_reason) || "No reason provided";
|
|
170
|
+
// Optional Debug Message
|
|
171
|
+
if (debugMessage) {
|
|
172
|
+
(_g = api.logDebugMessage) === null || _g === void 0 ? void 0 : _g.call(api, JSON.stringify({
|
|
173
|
+
execution_reason: executionReason,
|
|
174
|
+
target_flow: targetFlowNode.flow,
|
|
175
|
+
target_node: targetFlowNode.node,
|
|
176
|
+
}, null, 2));
|
|
177
|
+
}
|
|
178
|
+
api.resetNextNodes();
|
|
179
|
+
// We add the return to the AI Agent Job node before the executeFlow of the target flow,
|
|
180
|
+
// because we want to return to the AI Agent Job node after the target flow has been executed
|
|
181
|
+
const { flow: thisFlow, node: thisNode } = aiAgentJobNode;
|
|
182
|
+
if (thisFlow && thisNode) {
|
|
183
|
+
await api.executeFlow({
|
|
184
|
+
flowNode: {
|
|
185
|
+
flow: thisFlow,
|
|
186
|
+
node: thisNode,
|
|
187
|
+
},
|
|
188
|
+
absorbContext: true,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
throw new Error("AI Agent Job Node is required for Execute Workflow Tool");
|
|
193
|
+
}
|
|
194
|
+
// Execute the target flow (mirrors executeFlow functionality)
|
|
195
|
+
await api.executeFlow({
|
|
196
|
+
flowNode: {
|
|
197
|
+
flow: targetFlowNode.flow,
|
|
198
|
+
node: targetFlowNode.node
|
|
199
|
+
},
|
|
200
|
+
absorbContext,
|
|
201
|
+
parseIntents,
|
|
202
|
+
parseKeyphrases
|
|
203
|
+
});
|
|
204
|
+
// Add Tool Call Message to Transcript
|
|
205
|
+
const toolCallTranscriptStep = {
|
|
206
|
+
role: transcripts_1.TranscriptRole.ASSISTANT,
|
|
207
|
+
type: transcripts_1.TranscriptEntryType.TOOL_CALL,
|
|
208
|
+
source: "system",
|
|
209
|
+
payload: {
|
|
210
|
+
name: toolCall.function.name,
|
|
211
|
+
id: toolCall.id,
|
|
212
|
+
input: toolCall.function.arguments,
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
await api.addTranscriptStep(toolCallTranscriptStep);
|
|
216
|
+
// Add Tool Answer Message to Transcript
|
|
217
|
+
const toolAnswer = {
|
|
218
|
+
role: transcripts_1.TranscriptRole.TOOL,
|
|
219
|
+
type: transcripts_1.TranscriptEntryType.TOOL_ANSWER,
|
|
220
|
+
source: "system",
|
|
221
|
+
payload: {
|
|
222
|
+
toolCallId: toolCall.id,
|
|
223
|
+
name: toolCall.function.name,
|
|
224
|
+
content: "Workflow executed",
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
await api.addTranscriptStep(toolAnswer);
|
|
228
|
+
// Clear the last tool call from session state
|
|
229
|
+
api.updateSessionStateValues({
|
|
230
|
+
lastToolCall: undefined
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
throw new Error("Infinite Loop Detected");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
//# sourceMappingURL=executeWorkflowTool.js.map
|