@cognigy/rest-api-client 2025.18.0 → 2025.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/authentication/AuthenticationAPI.js +1 -1
  3. package/build/authentication/OAuth2/OAuth2Authentication.js +12 -9
  4. package/build/connector/AxiosAdapter.js +6 -2
  5. package/build/shared/charts/descriptors/service/GPTPrompt.js +2 -2
  6. package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +2 -2
  7. package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +2 -2
  8. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +20 -6
  9. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +39 -3
  10. package/build/shared/generativeAI/utils/generativeAIPrompts.js +17 -446
  11. package/build/shared/generativeAI/utils/prompts/flowGeneration.js +168 -0
  12. package/build/shared/generativeAI/utils/prompts/generateNodeOutput.js +39 -0
  13. package/build/shared/generativeAI/utils/prompts/intentSentenceGeneration.js +15 -0
  14. package/build/shared/generativeAI/utils/prompts/lexiconGeneration.js +22 -0
  15. package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +4 -0
  16. package/build/shared/interfaces/handover.js +3 -1
  17. package/build/shared/interfaces/messageAPI/endpoints.js +5 -2
  18. package/build/shared/interfaces/resources/INodeDescriptorSet.js +87 -77
  19. package/dist/esm/authentication/AuthenticationAPI.js +1 -1
  20. package/dist/esm/authentication/OAuth2/OAuth2Authentication.js +12 -9
  21. package/dist/esm/connector/AxiosAdapter.js +6 -2
  22. package/dist/esm/shared/charts/descriptors/service/GPTPrompt.js +1 -1
  23. package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +1 -1
  24. package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +1 -1
  25. package/dist/esm/shared/charts/descriptors/voice/mappers/transfer.mapper.js +20 -6
  26. package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/transfer.js +39 -3
  27. package/dist/esm/shared/generativeAI/utils/generativeAIPrompts.js +16 -445
  28. package/dist/esm/shared/generativeAI/utils/prompts/flowGeneration.js +165 -0
  29. package/dist/esm/shared/generativeAI/utils/prompts/generateNodeOutput.js +36 -0
  30. package/dist/esm/shared/generativeAI/utils/prompts/intentSentenceGeneration.js +12 -0
  31. package/dist/esm/shared/generativeAI/utils/prompts/lexiconGeneration.js +19 -0
  32. package/dist/esm/shared/interfaces/generativeAI/IGenerativeAIModels.js +4 -0
  33. package/dist/esm/shared/interfaces/handover.js +3 -1
  34. package/dist/esm/shared/interfaces/messageAPI/endpoints.js +5 -2
  35. package/dist/esm/shared/interfaces/resources/INodeDescriptorSet.js +88 -78
  36. package/package.json +1 -1
  37. package/types/index.d.ts +1045 -1016
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateNodeOutputModifyAdaptiveCardPrompt = exports.generateNodeOutputCreateAdaptiveCardPrompt = exports.generateNodeOutputTextPrompt = void 0;
4
+ const generateNodeOutputTextPromptString = 'Create @@noOfSentencesToGenerate unique sentences based on the description: "@@description" in @@language and return them as a pipe-separated string.';
5
+ exports.generateNodeOutputTextPrompt = [
6
+ {
7
+ role: "system",
8
+ content: generateNodeOutputTextPromptString,
9
+ },
10
+ {
11
+ role: "user",
12
+ content: "Let's start."
13
+ }
14
+ ];
15
+ const generateNodeOutputCreateAdaptiveCardPromptString = 'Create an adaptiveCard based on the description: "@@description" in @@language. Return nothing but the Adaptive Card JSON object. Your Adaptive Card should accurately reflect the requirements described in the description, while still adhering to the Adaptive Card JSON specification.';
16
+ exports.generateNodeOutputCreateAdaptiveCardPrompt = [
17
+ {
18
+ role: "system",
19
+ content: generateNodeOutputCreateAdaptiveCardPromptString,
20
+ },
21
+ {
22
+ role: "user",
23
+ content: "Let's start."
24
+ }
25
+ ];
26
+ const generateNodeOutputModifyAdaptiveCardPromptString = 'Please modify the @@lastOutput Adaptive Card JSON based on the provided instruction "@@description". Return nothing but the Adaptive Card JSON object. The language of the Adaptive Card text should be @@language. Your modified Adaptive Card should accurately reflect the changes described in the description, while still adhering to the Adaptive Card JSON specification.';
27
+ exports.generateNodeOutputModifyAdaptiveCardPrompt = [
28
+ {
29
+ role: "system",
30
+ content: generateNodeOutputModifyAdaptiveCardPromptString,
31
+ },
32
+ // The user role is a workaround for Anthropic models which require a user message as per our implementation in llm-providers.
33
+ // However, the user role confuses gpt-3.5-turbo, which needs a more descriptive user message to generate the adaptive card.
34
+ {
35
+ role: "user",
36
+ content: "Let's start generating the adaptive card."
37
+ }
38
+ ];
39
+ //# sourceMappingURL=generateNodeOutput.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.intentSentenceGenerationPrompt = void 0;
4
+ const intentSentenceGenerationPromptString = `For NLU model intent '@@name'<description> with the description '@@description'</description>. Create @@noOfSentencesToGenerate varied sentences other than the given examples<language> in @@language</language>. Return nothing but a JSON array of strings.\n<default-reply>Also, consider framing the sentences like a user question that a human would answer: @@defaultReply.\n</default-reply><example-sentences>Examples: @@exampleSentences \n</example-sentences>`;
5
+ exports.intentSentenceGenerationPrompt = [
6
+ {
7
+ role: "system",
8
+ content: intentSentenceGenerationPromptString,
9
+ },
10
+ {
11
+ role: "user",
12
+ content: "Let's start."
13
+ }
14
+ ];
15
+ //# sourceMappingURL=intentSentenceGeneration.js.map
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LEXICON_GENERATION_RESPONSE_EXAMPLE_NO_SYNONYMS = exports.LEXICON_GENERATION_RESPONSE_EXAMPLE = exports.LEXICON_GENERATION_PROMPT_SYNONYM_INSTRUCTIONS = exports.lexiconGenerationPrompt = void 0;
4
+ const lexiconGenerationPromptString = 'For the NLU model lexicon with the title "@@name" and the description "@@description",' +
5
+ ' generate @@lexiconEntries varied words in "@@lng".@@synonymInstructions' +
6
+ '\n\nRespond with a valid JSON with the format following the example: `@@example`';
7
+ exports.lexiconGenerationPrompt = [
8
+ {
9
+ role: "system",
10
+ content: lexiconGenerationPromptString,
11
+ },
12
+ // The user role is a workaround for Anthropic models which require a user message as per our implementation in llm-providers.
13
+ // However, the user role confuses gpt-4.1, which needs a more descriptive user message to generate the lexicon entries.
14
+ {
15
+ role: "user",
16
+ content: "Let's start generating the lexicon entries."
17
+ }
18
+ ];
19
+ exports.LEXICON_GENERATION_PROMPT_SYNONYM_INSTRUCTIONS = " For each word, also list all known synonyms. The number of synonyms for each word does not have to be the same.";
20
+ exports.LEXICON_GENERATION_RESPONSE_EXAMPLE = '[{"word": "test","synonyms": ["trial","attempt"]},{"word": "demo","synonyms": ["proof of concept"]}]';
21
+ exports.LEXICON_GENERATION_RESPONSE_EXAMPLE_NO_SYNONYMS = '[{"word": "test"},{"word": "demo"}]';
22
+ //# sourceMappingURL=lexiconGeneration.js.map
@@ -22,6 +22,10 @@ exports.generativeAIModels = [
22
22
  "gpt-4.1",
23
23
  "gpt-4.1-mini",
24
24
  "gpt-4.1-nano",
25
+ "gpt-5",
26
+ "gpt-5-nano",
27
+ "gpt-5-mini",
28
+ "gpt-5-chat-latest",
25
29
  "luminous-extended-control",
26
30
  "claude-v1-100k",
27
31
  "claude-instant-v1",
@@ -122,6 +122,7 @@ exports.handoverSettingsSchema = {
122
122
  redactTranscriptTileMessages: { type: "boolean" },
123
123
  enableAgentCopilotAuthentication: { type: "boolean" },
124
124
  agentCopilotAuthentication: { type: "string" },
125
+ oAuth2Connection: { type: "string" },
125
126
  }
126
127
  }
127
128
  }
@@ -154,7 +155,8 @@ exports.foreignSessionDataSchema = {
154
155
  clientPollTimeout: { type: "number" },
155
156
  accessToken: { type: "string" },
156
157
  lastEventId: { type: "string" },
157
- apiKey: { type: "string" }
158
+ apiKey: { type: "string" },
159
+ endHandoverOnParticipantChange: { type: "boolean" }
158
160
  }
159
161
  };
160
162
  exports.rceSettingsSchema = {
@@ -41,6 +41,7 @@ exports.endpointTypes = [
41
41
  "zoomContactCenter",
42
42
  ];
43
43
  const transferTypes = ["dial", "sip:refer"];
44
+ const mediaPathTypes = ["fullMedia", "partialMedia", "noMedia"];
44
45
  exports.webchatPersistentMenuSchema = {
45
46
  title: "webchatPersistentMenuSchema",
46
47
  type: "object",
@@ -128,7 +129,7 @@ const callEvents = [
128
129
  const callFailoverSettingsSchema = {
129
130
  title: "callEventSettingsSchema",
130
131
  type: "object",
131
- additionalProperties: false,
132
+ additionalProperties: true,
132
133
  properties: {
133
134
  enabled: { type: "boolean" },
134
135
  enabledForSpeech: { type: "boolean" },
@@ -154,13 +155,14 @@ const callFailoverSettingsSchema = {
154
155
  deepgramEndpointing: { type: "boolean" },
155
156
  deepgramEndpointingValue: { type: "number" },
156
157
  dialTranscribeDeepgramTier: { type: "string" },
158
+ mediaPath: { type: "string", enum: [...mediaPathTypes] },
157
159
  anchorMedia: { type: "boolean" }
158
160
  }
159
161
  };
160
162
  exports.callEventSettingsSchema = {
161
163
  title: "callEventSettingsSchema",
162
164
  type: "object",
163
- additionalProperties: false,
165
+ additionalProperties: true,
164
166
  properties: {
165
167
  enabled: { type: "boolean" },
166
168
  action: { type: "string", enum: ["executeFlow", "inject", "transfer", "none"] },
@@ -715,6 +717,7 @@ exports.zoomContactCenterEndpointSettingsSchema = {
715
717
  exports.anyEndpointSettingsSchema = {
716
718
  title: "anyEndpointSettingsSchema",
717
719
  type: "object",
720
+ additionalProperties: true,
718
721
  properties: Object.assign({ action: { type: "string" }, accessScope: { type: "string" }, accessToken: { type: "string" }, appId: { type: "string" }, appSecret: { type: "string" }, backgroundImageUrl: { type: "string" }, basicAuthPassword: { type: "string" }, basicAuthUser: { type: "string" }, botUserId: { type: "string" }, colorScheme: { type: "string" }, connectionName: { type: "string" }, cpaasToken: { type: "string" }, customJSON: { type: "string" }, designTemplate: { type: "integer" }, disableHtmlContentSanitization: { type: "boolean" }, disableInputAutocomplete: { type: "boolean" }, disableUrlButtonSanitization: { type: "boolean" }, disableInputSanitization: { type: "boolean" }, disableSkipUriTags: { type: "boolean" }, enableAsyncCommunication: { type: "boolean" }, enableCollectMetadata: { type: "boolean" }, enableGenericHTMLStyling: { type: "boolean" }, enableDemoWebchat: { type: "boolean" }, enableFileUpload: { type: "boolean" }, enablePersistentMenu: { type: "boolean" }, enableRating: { type: "string", enum: ["always", "once", "onRequest"] }, enableSTT: { type: "boolean" }, enableTTS: { type: "boolean" }, enableTypingIndicator: { type: "boolean" }, enableFileAttachment: { type: "boolean" }, fileAttachmentMaxSize: { type: "number" }, facebookPageToken: { type: "string" }, finishOnKey: {
719
722
  type: "string",
720
723
  enum: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "#"]
@@ -12,8 +12,8 @@ const nodeAppearanceSchema = {
12
12
  textColor: { type: "string", format: "color" },
13
13
  contrastTextColor: { type: "string", format: "color" },
14
14
  showIcon: { type: "boolean" },
15
- variant: { type: "string", enum: ["regular", "mini", "hexagon"] },
16
- },
15
+ variant: { type: "string", enum: ["regular", "mini", "hexagon"] }
16
+ }
17
17
  };
18
18
  const nodeBehaviorSchema = {
19
19
  title: "nodeBehaviorSchema",
@@ -21,8 +21,8 @@ const nodeBehaviorSchema = {
21
21
  additionalProperties: false,
22
22
  properties: {
23
23
  stopping: { type: "boolean" },
24
- entrypoint: { type: "boolean" },
25
- },
24
+ entrypoint: { type: "boolean" }
25
+ }
26
26
  };
27
27
  exports.nodePreviewTypes = [
28
28
  "text",
@@ -38,8 +38,8 @@ const nodePreviewSchema = {
38
38
  additionalProperties: false,
39
39
  properties: {
40
40
  key: { type: "string", minLength: 1, maxLength: 200 },
41
- type: { type: "string", enum: [...exports.nodePreviewTypes] },
42
- },
41
+ type: { type: "string", enum: [...exports.nodePreviewTypes] }
42
+ }
43
43
  };
44
44
  const nodeConstraintSchema = {
45
45
  title: "nodeConstraintSchema",
@@ -48,13 +48,13 @@ const nodeConstraintSchema = {
48
48
  properties: {
49
49
  blacklist: {
50
50
  type: "array",
51
- items: { type: "string", minLength: 1, maxLength: 200 },
51
+ items: { type: "string", minLength: 1, maxLength: 200 }
52
52
  },
53
53
  whitelist: {
54
54
  type: "array",
55
- items: { type: "string", minLength: 1, maxLength: 200 },
56
- },
57
- },
55
+ items: { type: "string", minLength: 1, maxLength: 200 }
56
+ }
57
+ }
58
58
  };
59
59
  const nodeConstraintsSchema = {
60
60
  title: "nodeConstraintsSchema",
@@ -73,10 +73,10 @@ const nodeConstraintsSchema = {
73
73
  properties: {
74
74
  children: nodeConstraintSchema,
75
75
  predecessor: nodeConstraintSchema,
76
- successor: nodeConstraintSchema,
77
- },
78
- },
79
- },
76
+ successor: nodeConstraintSchema
77
+ }
78
+ }
79
+ }
80
80
  };
81
81
  const nodeDependenciesSchema = {
82
82
  title: "nodeDependenciesSchema",
@@ -85,9 +85,9 @@ const nodeDependenciesSchema = {
85
85
  properties: {
86
86
  children: {
87
87
  type: "array",
88
- items: { type: "string", minLength: 1, maxLength: 200 },
89
- },
90
- },
88
+ items: { type: "string", minLength: 1, maxLength: 200 }
89
+ }
90
+ }
91
91
  };
92
92
  exports.nodeFieldTypes = [
93
93
  "adaptivecard",
@@ -157,7 +157,7 @@ exports.searchableNodeFieldTypes = [
157
157
  "say",
158
158
  "code",
159
159
  "caseNode",
160
- "select",
160
+ "select"
161
161
  ];
162
162
  exports.nodeFieldSingleConditionSchema = {
163
163
  title: "nodeFieldSingleConditionSchema",
@@ -174,11 +174,11 @@ exports.nodeFieldSingleConditionSchema = {
174
174
  { type: "number" },
175
175
  { type: "array", items: { type: "number" } },
176
176
  { type: "boolean" },
177
- { type: "array", items: { type: "boolean" } },
178
- ],
177
+ { type: "array", items: { type: "boolean" } }
178
+ ]
179
179
  },
180
- negate: { type: "boolean" },
181
- },
180
+ negate: { type: "boolean" }
181
+ }
182
182
  };
183
183
  exports.nodeFieldANDConditionSchema = {
184
184
  title: "nodeFieldANDConditionSchema",
@@ -186,8 +186,8 @@ exports.nodeFieldANDConditionSchema = {
186
186
  additionalProperties: false,
187
187
  required: ["and"],
188
188
  properties: {
189
- and: { type: "array", items: { $ref: "nodeFieldConditionSchema" } },
190
- },
189
+ and: { type: "array", items: { $ref: "nodeFieldConditionSchema" } }
190
+ }
191
191
  };
192
192
  exports.nodeFieldORConditionSchema = {
193
193
  title: "nodeFieldORConditionSchema",
@@ -195,8 +195,8 @@ exports.nodeFieldORConditionSchema = {
195
195
  additionalProperties: false,
196
196
  required: ["or"],
197
197
  properties: {
198
- or: { type: "array", items: { $ref: "nodeFieldConditionSchema" } },
199
- },
198
+ or: { type: "array", items: { $ref: "nodeFieldConditionSchema" } }
199
+ }
200
200
  };
201
201
  // @ts-ignore
202
202
  exports.nodeFieldConditionSchema = {
@@ -209,8 +209,8 @@ exports.nodeFieldConditionSchema = {
209
209
  // @ts-ignore
210
210
  exports.nodeFieldANDConditionSchema,
211
211
  // @ts-ignore
212
- exports.nodeFieldORConditionSchema,
213
- ],
212
+ exports.nodeFieldORConditionSchema
213
+ ]
214
214
  };
215
215
  exports.nodeOptionsResolverSchema = {
216
216
  title: "nodeOptionsResolverSchema",
@@ -219,10 +219,10 @@ exports.nodeOptionsResolverSchema = {
219
219
  properties: {
220
220
  dependencies: {
221
221
  type: "array",
222
- items: { type: "string", minLength: 1, maxLength: 200 },
222
+ items: { type: "string", minLength: 1, maxLength: 200 }
223
223
  },
224
- resolverFunction: {},
225
- },
224
+ resolverFunction: {}
225
+ }
226
226
  };
227
227
  exports.nodeFieldSchema = {
228
228
  title: "nodeFieldSchema",
@@ -243,10 +243,10 @@ exports.nodeFieldSchema = {
243
243
  deDE: { type: "string", maxLength: 200 },
244
244
  jaJP: { type: "string", maxLength: 200 },
245
245
  esES: { type: "string", maxLength: 200 },
246
- koKR: { type: "string", maxLength: 200 },
247
- },
248
- },
249
- ],
246
+ koKR: { type: "string", maxLength: 200 }
247
+ }
248
+ }
249
+ ]
250
250
  },
251
251
  condition: exports.nodeFieldConditionSchema,
252
252
  defaultValue: {
@@ -256,8 +256,18 @@ exports.nodeFieldSchema = {
256
256
  { type: "number" },
257
257
  { type: "null" },
258
258
  { type: "object" },
259
- { type: "string" },
260
- ],
259
+ { type: "string" }
260
+ ]
261
+ },
262
+ fallbackValue: {
263
+ oneOf: [
264
+ { type: "array" },
265
+ { type: "boolean" },
266
+ { type: "number" },
267
+ { type: "null" },
268
+ { type: "object" },
269
+ { type: "string" }
270
+ ]
261
271
  },
262
272
  description: {
263
273
  oneOf: [
@@ -271,10 +281,10 @@ exports.nodeFieldSchema = {
271
281
  deDE: { type: "string", maxLength: 200 },
272
282
  jaJP: { type: "string", maxLength: 200 },
273
283
  esES: { type: "string", maxLength: 200 },
274
- koKR: { type: "string", maxLength: 200 },
275
- },
276
- },
277
- ],
284
+ koKR: { type: "string", maxLength: 200 }
285
+ }
286
+ }
287
+ ]
278
288
  },
279
289
  params: { type: "object" },
280
290
  optionsResolver: exports.nodeOptionsResolverSchema,
@@ -285,11 +295,11 @@ exports.nodeFieldSchema = {
285
295
  lookupValue: { type: "string" },
286
296
  fieldsToReset: {
287
297
  type: "array",
288
- items: { type: "string" },
289
- },
290
- },
291
- },
292
- },
298
+ items: { type: "string" }
299
+ }
300
+ }
301
+ }
302
+ }
293
303
  };
294
304
  exports.nodeSectionSchema = {
295
305
  title: "nodeSectionSchema",
@@ -309,10 +319,10 @@ exports.nodeSectionSchema = {
309
319
  deDE: { type: "string", maxLength: 200 },
310
320
  jaJP: { type: "string", maxLength: 200 },
311
321
  esES: { type: "string", maxLength: 200 },
312
- koKR: { type: "string", maxLength: 200 },
313
- },
314
- },
315
- ],
322
+ koKR: { type: "string", maxLength: 200 }
323
+ }
324
+ }
325
+ ]
316
326
  },
317
327
  description: {
318
328
  oneOf: [
@@ -326,10 +336,10 @@ exports.nodeSectionSchema = {
326
336
  deDE: { type: "string", maxLength: 200 },
327
337
  jaJP: { type: "string", maxLength: 200 },
328
338
  esES: { type: "string", maxLength: 200 },
329
- koKR: { type: "string", maxLength: 200 },
330
- },
331
- },
332
- ],
339
+ koKR: { type: "string", maxLength: 200 }
340
+ }
341
+ }
342
+ ]
333
343
  },
334
344
  condition: exports.nodeFieldConditionSchema,
335
345
  defaultCollapsed: { type: "boolean" },
@@ -341,10 +351,10 @@ exports.nodeSectionSchema = {
341
351
  items: {
342
352
  type: "string",
343
353
  minLength: 1,
344
- maxLength: 200,
345
- },
346
- },
347
- },
354
+ maxLength: 200
355
+ }
356
+ }
357
+ }
348
358
  };
349
359
  exports.nodeFieldAndSectionFormElementSchema = {
350
360
  title: "nodeFieldAndSectionFormElementSchema",
@@ -352,8 +362,8 @@ exports.nodeFieldAndSectionFormElementSchema = {
352
362
  required: ["key", "type"],
353
363
  properties: {
354
364
  key: { type: "string", minLength: 1, maxLength: 200 },
355
- type: { type: "string", enum: ["field", "section"] },
356
- },
365
+ type: { type: "string", enum: ["field", "section"] }
366
+ }
357
367
  };
358
368
  exports.nodeDescriptorSchema = {
359
369
  title: "nodeDescriptorSchema",
@@ -375,10 +385,10 @@ exports.nodeDescriptorSchema = {
375
385
  deDE: { type: "string", maxLength: 200 },
376
386
  jaJP: { type: "string", maxLength: 200 },
377
387
  esES: { type: "string", maxLength: 200 },
378
- koKR: { type: "string", maxLength: 200 },
379
- },
380
- },
381
- ],
388
+ koKR: { type: "string", maxLength: 200 }
389
+ }
390
+ }
391
+ ]
382
392
  },
383
393
  summary: {
384
394
  oneOf: [
@@ -392,10 +402,10 @@ exports.nodeDescriptorSchema = {
392
402
  deDE: { type: "string", maxLength: 200 },
393
403
  jaJP: { type: "string", maxLength: 200 },
394
404
  esES: { type: "string", maxLength: 200 },
395
- koKR: { type: "string", maxLength: 200 },
396
- },
397
- },
398
- ],
405
+ koKR: { type: "string", maxLength: 200 }
406
+ }
407
+ }
408
+ ]
399
409
  },
400
410
  appearance: nodeAppearanceSchema,
401
411
  behavior: nodeBehaviorSchema,
@@ -408,25 +418,25 @@ exports.nodeDescriptorSchema = {
408
418
  type: "array",
409
419
  items: { type: "string" },
410
420
  uniqueItems: true,
411
- minItems: 0,
421
+ minItems: 0
412
422
  },
413
423
  tokens: {
414
424
  type: "array",
415
425
  items: ISnippet_1.snippetDataSchema,
416
- uniqueItems: true,
426
+ uniqueItems: true
417
427
  },
418
428
  sections: {
419
429
  type: "array",
420
430
  additionalItems: false,
421
- items: exports.nodeSectionSchema,
431
+ items: exports.nodeSectionSchema
422
432
  },
423
433
  form: {
424
434
  type: "array",
425
435
  additionalItems: false,
426
436
  maxLength: 25,
427
- items: exports.nodeFieldAndSectionFormElementSchema,
428
- },
429
- },
437
+ items: exports.nodeFieldAndSectionFormElementSchema
438
+ }
439
+ }
430
440
  };
431
441
  exports.nodeDescriptorSetSchema = {
432
442
  title: "nodeDescriptorSetSchema",
@@ -442,10 +452,10 @@ exports.nodeDescriptorSetSchema = {
442
452
  descriptors: {
443
453
  type: "array",
444
454
  additionalItems: false,
445
- items: exports.nodeDescriptorSchema,
455
+ items: exports.nodeDescriptorSchema
446
456
  },
447
457
  resourceType: { type: "string", enum: TResourceType_1.chartableResourceTypes },
448
- trustedCode: { type: "boolean" },
449
- },
458
+ trustedCode: { type: "boolean" }
459
+ }
450
460
  };
451
461
  //# sourceMappingURL=INodeDescriptorSet.js.map
@@ -53,7 +53,7 @@ export function AuthenticationAPI(instance) {
53
53
  }),
54
54
  exchangeOneTimeTokenForRefreshToken: (_a, options) => {
55
55
  var { loginToken } = _a, args = __rest(_a, ["loginToken"]);
56
- return GenericAPIFn(`/auth/exchangetoken?${stringifyQuery({ loginToken })}`, "GET", self)(args, Object.assign({ withAuthentication: false }, options));
56
+ return GenericAPIFn(`/auth/exchangetoken?${stringifyQuery({ loginToken })}`, "GET", self)(args, Object.assign({ withAuthentication: false, withCredentials: true }, options));
57
57
  },
58
58
  generateManagementUIAuthToken: (args, options) => GenericAPIFn("/new/management/auth/token", "POST", self)(args, options)
59
59
  };
@@ -2,7 +2,6 @@ import { __awaiter } from "tslib";
2
2
  /* Custom Modules */
3
3
  import { OAuth2Error } from "./OAuth2Error";
4
4
  import { HttpStatusCode } from "../../shared/helper/HttpStatusCode";
5
- import { UnauthorizedError } from "../../shared/errors";
6
5
  import { OAuth2Errors } from "./IOAuth2ErrorResponse";
7
6
  const expiryBuffer = 8;
8
7
  export const OAuth2Authentication = function (credentials, self) {
@@ -27,7 +26,8 @@ export const OAuth2Authentication = function (credentials, self) {
27
26
  };
28
27
  return yield request(formFields, {
29
28
  maxRetries: Infinity,
30
- retryDelay: () => 3000
29
+ retryDelay: () => 3000,
30
+ withCredentials: true
31
31
  });
32
32
  });
33
33
  const request = (formFields, options) => __awaiter(this, void 0, void 0, function* () {
@@ -82,6 +82,8 @@ export const OAuth2Authentication = function (credentials, self) {
82
82
  OAuth2Authentication.prototype.login = (parameters) => __awaiter(this, void 0, void 0, function* () {
83
83
  const { clientId, clientSecret } = self.credentials;
84
84
  switch (parameters.type) {
85
+ // Password Grant is deprecated in OAuth2, but still supported
86
+ // for api and e2e tests
85
87
  case "password":
86
88
  {
87
89
  const { username, password, rememberMe, organisationId } = parameters;
@@ -101,6 +103,8 @@ export const OAuth2Authentication = function (credentials, self) {
101
103
  break;
102
104
  case "refreshToken":
103
105
  {
106
+ // The refresh token from the parameters is to support older token granted via Password Grant flow
107
+ // TODO - remove this in future once PKCE fully takes over
104
108
  const { refreshToken } = parameters;
105
109
  const credentials = self.credentials;
106
110
  const result = yield refreshTokenGrant({
@@ -113,17 +117,19 @@ export const OAuth2Authentication = function (credentials, self) {
113
117
  break;
114
118
  case "authorizationCode":
115
119
  {
116
- const { code, redirectUri, codeVerifier } = parameters;
120
+ const { code, redirectUri, codeVerifier, rememberMe } = parameters;
117
121
  const formFields = {
118
122
  grant_type: "authorization_code",
119
123
  client_id: clientId,
120
124
  client_secret: clientSecret,
121
125
  code,
122
126
  redirect_uri: redirectUri,
127
+ rememberMe,
123
128
  code_verifier: codeVerifier
124
129
  };
125
130
  self.tokenData = yield request(formFields, {
126
- maxRetries: 0
131
+ maxRetries: 0,
132
+ withCredentials: true
127
133
  });
128
134
  }
129
135
  break;
@@ -175,9 +181,6 @@ export const OAuth2Authentication = function (credentials, self) {
175
181
  */
176
182
  if (isAccessTokenExpired(self.tokenData)) {
177
183
  const credentials = self.credentials;
178
- if (!self.tokenData.refresh_token) {
179
- throw new UnauthorizedError("No RefreshToken provided.");
180
- }
181
184
  if (self.refreshTokenSingleton === null) {
182
185
  self.refreshTokenSingleton = new Promise((resolve, reject) => {
183
186
  refreshTokenGrant({
@@ -217,8 +220,7 @@ export const OAuth2Authentication = function (credentials, self) {
217
220
  });
218
221
  OAuth2Authentication.prototype.logout = () => __awaiter(this, void 0, void 0, function* () {
219
222
  if ((self === null || self === void 0 ? void 0 : self.credentials.type) ===
220
- "OAuth2" &&
221
- self.tokenData.refresh_token) {
223
+ "OAuth2") {
222
224
  const httpAdapter = self.getHttpAdapter();
223
225
  const requestData = {
224
226
  method: "POST",
@@ -227,6 +229,7 @@ export const OAuth2Authentication = function (credentials, self) {
227
229
  token: self.tokenData.refresh_token
228
230
  },
229
231
  maxRetries: 3,
232
+ withCredentials: true,
230
233
  retryDelay: () => 0
231
234
  };
232
235
  // reset tokenData to avoid multiple revoke calls
@@ -86,7 +86,7 @@ export class AxiosAdapter {
86
86
  });
87
87
  }
88
88
  convertRequest(request, client) {
89
- var _a;
89
+ var _a, _b;
90
90
  return __awaiter(this, void 0, void 0, function* () {
91
91
  const baseUrl = (_a = request.baseUrl) !== null && _a !== void 0 ? _a : this.config.baseUrl;
92
92
  const axiosRequest = {
@@ -94,6 +94,7 @@ export class AxiosAdapter {
94
94
  headers: request.headers,
95
95
  method: request.method || "GET",
96
96
  url: `${baseUrl}${request.url}`,
97
+ withCredentials: (_b = request.withCredentials) !== null && _b !== void 0 ? _b : false,
97
98
  validateStatus: (status) => !isRetryableStatus(status)
98
99
  };
99
100
  if (typeof request.onProgress === "function") {
@@ -128,7 +129,7 @@ export class AxiosAdapter {
128
129
  }
129
130
  }
130
131
  if (isAxiosResponse(axiosResponse)) {
131
- const errorClass = ErrorCollection[(_b = axiosResponse.data) === null || _b === void 0 ? void 0 : _b.code] ||
132
+ let errorClass = ErrorCollection[(_b = axiosResponse.data) === null || _b === void 0 ? void 0 : _b.code] ||
132
133
  ErrorCollection[axiosResponse.status] ||
133
134
  ErrorCollection[ErrorCode.INTERNAL_SERVER_ERROR];
134
135
  if ((axiosResponse.status === HttpStatusCode.UNAUTHORIZED ||
@@ -137,6 +138,9 @@ export class AxiosAdapter {
137
138
  typeof this.config.onUnauthorized === "function") {
138
139
  this.config.onUnauthorized();
139
140
  }
141
+ if (axiosResponse.status === HttpStatusCode.CONFLICT) {
142
+ errorClass = ErrorCollection[ErrorCode.CONFLICT_ERROR];
143
+ }
140
144
  if (OAuth2Errors.includes((_d = axiosResponse.data) === null || _d === void 0 ? void 0 : _d.error)) {
141
145
  throw new errorClass(axiosResponse.data.detail, { traceId: axiosResponse.data.traceId }, undefined, axiosResponse.data);
142
146
  }
@@ -2,7 +2,7 @@ import { __awaiter } from "tslib";
2
2
  /* Custom modules */
3
3
  import { createNodeDescriptor } from "../../createNodeDescriptor";
4
4
  import { GO_TO } from "../logic";
5
- import { randomUUID } from 'crypto';
5
+ import { v4 as randomUUID } from "uuid";
6
6
  import { createLastConverationString, createLastConversationChatObject, createLastUserInputString, writeLLMDebugLogs } from "../nlu/generativeSlotFiller/prompt";
7
7
  import { InternalServerError } from "../../../errors";
8
8
  import { TranscriptEntryType, TranscriptRole } from "../../../interfaces/transcripts/transcripts";
@@ -1,7 +1,6 @@
1
1
  import { __awaiter, __rest } from "tslib";
2
2
  /* Custom modules */
3
3
  import { createNodeDescriptor } from "../../../createNodeDescriptor";
4
- import { randomUUID } from 'crypto';
5
4
  import { setSessionConfig } from "../../voice/mappers/setSessionConfig.mapper";
6
5
  import { voiceConfigParamsToVoiceSettings } from "../../voice/mappers/setSessionConfig.mapper";
7
6
  import { logFullConfigToDebugMode } from "../../../../helper/logFullConfigToDebugMode";
@@ -9,6 +8,7 @@ import { createSystemMessage, getCognigyBrandMessage } from "./helpers/createSys
9
8
  import { generateSearchPrompt } from "./helpers/generateSearchPrompt";
10
9
  import { getUserMemory } from "./helpers/getUserMemory";
11
10
  import { createToolDefinitions } from "./helpers/createToolDefinitions";
11
+ import { v4 as randomUUID } from "uuid";
12
12
  import { TranscriptEntryType, TranscriptRole } from "../../../../interfaces/transcripts/transcripts";
13
13
  export const AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool"];
14
14
  export const AI_AGENT_JOB = createNodeDescriptor({