botium-core 1.13.16 → 1.13.18

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 (29) hide show
  1. package/README.md +0 -1
  2. package/dist/botium-cjs.js +283 -172
  3. package/dist/botium-cjs.js.map +1 -1
  4. package/dist/botium-es.js +282 -171
  5. package/dist/botium-es.js.map +1 -1
  6. package/package.json +23 -23
  7. package/src/BotDriver.js +2 -4
  8. package/src/Capabilities.js +7 -3
  9. package/src/Events.js +1 -0
  10. package/src/containers/BaseContainer.js +5 -3
  11. package/src/containers/PluginConnectorContainer.js +0 -4
  12. package/src/containers/plugins/SimpleRestContainer.js +49 -0
  13. package/src/scripting/Convo.js +10 -27
  14. package/src/scripting/ScriptingProvider.js +121 -53
  15. package/src/scripting/helper.js +9 -2
  16. package/src/scripting/logichook/asserter/ButtonsAsserter.js +21 -8
  17. package/src/scripting/logichook/asserter/WerAsserter.js +53 -6
  18. package/src/scripting/logichook/logichooks/ClearQueueLogicHook.js +0 -1
  19. package/test/connectors/logicHook.js +0 -1
  20. package/test/connectors/simplerest.spec.js +79 -4
  21. package/test/scripting/asserters/buttonsAsserter.spec.js +84 -50
  22. package/test/scripting/logichooks/convos/custom_embedded_skip.convo.txt +11 -0
  23. package/test/scripting/logichooks/convos/custom_embedded_skip_followed_by_me.convo.txt +11 -0
  24. package/test/scripting/logichooks/convos/custom_embedded_skip_followed_by_nothing.convo.txt +8 -0
  25. package/test/scripting/logichooks/customEmbeddedSkip.json +14 -0
  26. package/test/scripting/logichooks/customEmbeddedSkip.spec.js +58 -0
  27. package/test/security/allowUnsafe.spec.js +20 -10
  28. package/test/security/convos/withscriptingmemoryfunction.convo.txt +1 -0
  29. package/test/convo/retryconvo.spec.js +0 -134
package/dist/botium-es.js CHANGED
@@ -2,7 +2,7 @@ import util from 'util';
2
2
  import fs from 'fs';
3
3
  import path from 'path';
4
4
  import async from 'async';
5
- import rimraf from 'rimraf';
5
+ import rimraf$1 from 'rimraf';
6
6
  import mkdirp from 'mkdirp';
7
7
  import sanitizeFilename from 'sanitize-filename';
8
8
  import moment from 'moment';
@@ -37,7 +37,7 @@ import express from 'express';
37
37
  import bodyParser from 'body-parser';
38
38
 
39
39
  var name = "botium-core";
40
- var version$1 = "1.13.16";
40
+ var version$1 = "1.13.18";
41
41
  var description = "The Selenium for Chatbots";
42
42
  var main = "index.js";
43
43
  var module = "dist/botium-es.js";
@@ -69,66 +69,66 @@ var bugs = {
69
69
  };
70
70
  var homepage = "https://www.botium.ai";
71
71
  var dependencies = {
72
- "@babel/runtime": "^7.20.6",
72
+ "@babel/runtime": "^7.21.5",
73
73
  async: "^3.2.4",
74
- "body-parser": "^1.20.1",
74
+ "body-parser": "^1.20.2",
75
75
  boolean: "^3.2.0",
76
76
  bottleneck: "^2.19.5",
77
- "csv-parse": "^5.3.3",
77
+ "csv-parse": "^5.3.10",
78
78
  debug: "^4.3.4",
79
79
  esprima: "^4.0.1",
80
80
  express: "^4.18.2",
81
81
  globby: "11.0.4",
82
- ioredis: "^5.2.4",
82
+ ioredis: "^5.3.2",
83
83
  "is-class": "^0.0.9",
84
84
  "is-json": "^2.0.1",
85
85
  jsonpath: "^1.1.1",
86
86
  lodash: "^4.17.21",
87
87
  "markdown-it": "^13.0.1",
88
88
  "mime-types": "^2.1.35",
89
- mkdirp: "^1.0.4",
89
+ mkdirp: "^3.0.1",
90
90
  moment: "^2.29.4",
91
91
  mustache: "^4.2.0",
92
92
  "promise-retry": "^2.0.1",
93
93
  "promise.allsettled": "^1.0.6",
94
94
  randomatic: "^3.1.1",
95
95
  request: "^2.88.2",
96
- rimraf: "^3.0.2",
96
+ rimraf: "^5.0.0",
97
97
  "sanitize-filename": "^1.6.3",
98
- slugify: "^1.6.5",
99
- "socket.io": "^4.5.4",
100
- "socket.io-client": "^4.5.4",
98
+ slugify: "^1.6.6",
99
+ "socket.io": "^4.6.1",
100
+ "socket.io-client": "^4.6.1",
101
101
  "socketio-auth": "^0.1.1",
102
- "swagger-jsdoc": "^6.2.5",
103
- "swagger-ui-express": "^4.6.0",
102
+ "swagger-jsdoc": "^6.2.8",
103
+ "swagger-ui-express": "^4.6.3",
104
104
  uuid: "^9.0.0",
105
- vm2: "^3.9.13",
105
+ vm2: "^3.9.17",
106
106
  "word-error-rate": "0.0.7",
107
107
  "write-yaml": "^1.0.0",
108
108
  xlsx: "^0.18.5",
109
109
  xregexp: "^5.1.1",
110
- yaml: "^2.1.3"
110
+ yaml: "^2.2.2"
111
111
  };
112
112
  var devDependencies = {
113
- "@babel/core": "^7.20.5",
114
- "@babel/node": "^7.20.5",
115
- "@babel/plugin-transform-runtime": "^7.19.6",
116
- "@babel/preset-env": "^7.20.2",
113
+ "@babel/core": "^7.21.8",
114
+ "@babel/node": "^7.20.7",
115
+ "@babel/plugin-transform-runtime": "^7.21.4",
116
+ "@babel/preset-env": "^7.21.5",
117
117
  chai: "^4.3.7",
118
118
  "chai-as-promised": "^7.1.1",
119
119
  "cross-env": "^7.0.3",
120
- eslint: "^8.29.0",
120
+ eslint: "^8.40.0",
121
121
  "eslint-config-standard": "^17.0.0",
122
- "eslint-plugin-import": "^2.26.0",
122
+ "eslint-plugin-import": "^2.27.5",
123
123
  "eslint-plugin-mocha": "^10.1.0",
124
- "eslint-plugin-n": "^15.6.0",
124
+ "eslint-plugin-n": "^15.7.0",
125
125
  "eslint-plugin-promise": "^6.1.1",
126
126
  "eslint-plugin-standard": "^4.1.0",
127
127
  "license-checker": "^25.0.1",
128
128
  "license-compatibility-checker": "^0.3.5",
129
129
  mocha: "^10.2.0",
130
- nock: "^13.2.9",
131
- "npm-check-updates": "^16.5.6",
130
+ nock: "^13.3.1",
131
+ "npm-check-updates": "^16.10.12",
132
132
  nyc: "^15.1.0",
133
133
  rollup: "2.79.1",
134
134
  "rollup-plugin-babel": "^4.4.0",
@@ -242,6 +242,12 @@ var Capabilities = {
242
242
  SIMPLEREST_POLL_INTERVAL: 'SIMPLEREST_POLL_INTERVAL',
243
243
  SIMPLEREST_POLL_TIMEOUT: 'SIMPLEREST_PING_TIMEOUT',
244
244
  SIMPLEREST_POLL_UPDATE_CONTEXT: 'SIMPLEREST_POLL_UPDATE_CONTEXT',
245
+ SIMPLEREST_CONTEXT_IGNORE_JSONPATH: 'SIMPLEREST_CONTEXT_IGNORE_JSONPATH',
246
+ SIMPLEREST_CONTEXT_IGNORE_MATCH: 'SIMPLEREST_CONTEXT_IGNORE_MATCH',
247
+ SIMPLEREST_CONTEXT_SKIP_JSONPATH: 'SIMPLEREST_CONTEXT_SKIP_JSONPATH',
248
+ SIMPLEREST_CONTEXT_SKIP_MATCH: 'SIMPLEREST_CONTEXT_SKIP_MATCH',
249
+ SIMPLEREST_CONTEXT_CONTINUE_JSONPATH: 'SIMPLEREST_CONTEXT_CONTINUE_JSONPATH',
250
+ SIMPLEREST_CONTEXT_CONTINUE_MATCH: 'SIMPLEREST_CONTEXT_CONTINUE_MATCH',
245
251
  SIMPLEREST_BODY_JSONPATH: 'SIMPLEREST_BODY_JSONPATH',
246
252
  SIMPLEREST_RESPONSE_JSONPATH: 'SIMPLEREST_RESPONSE_JSONPATH',
247
253
  SIMPLEREST_RESPONSE_HOOK: 'SIMPLEREST_RESPONSE_HOOK',
@@ -339,9 +345,7 @@ var Capabilities = {
339
345
  RATELIMIT_USERSAYS_MINTIME: 'RATELIMIT_USERSAYS_MINTIME',
340
346
  RATELIMIT_BOTTLENECK_FN: 'RATELIMIT_BOTTLENECK_FN',
341
347
  SECURITY_ALLOW_UNSAFE: 'SECURITY_ALLOW_UNSAFE',
342
- PRECOMPILERS: 'PRECOMPILERS',
343
- // RETRY
344
- RETRY_CONVO_ASYNC: 'RETRY_CONVO_ASYNC'
348
+ PRECOMPILERS: 'PRECOMPILERS'
345
349
  };
346
350
  Capabilities.PROJECTNAME;
347
351
  Capabilities.TESTSESSIONNAME;
@@ -410,6 +414,12 @@ Capabilities.SIMPLEREST_POLL_REQUEST_HOOK;
410
414
  Capabilities.SIMPLEREST_POLL_INTERVAL;
411
415
  Capabilities.SIMPLEREST_POLL_TIMEOUT;
412
416
  Capabilities.SIMPLEREST_POLL_UPDATE_CONTEXT;
417
+ Capabilities.SIMPLEREST_CONTEXT_IGNORE_JSONPATH;
418
+ Capabilities.SIMPLEREST_CONTEXT_IGNORE_MATCH;
419
+ Capabilities.SIMPLEREST_CONTEXT_SKIP_JSONPATH;
420
+ Capabilities.SIMPLEREST_CONTEXT_SKIP_MATCH;
421
+ Capabilities.SIMPLEREST_CONTEXT_CONTINUE_JSONPATH;
422
+ Capabilities.SIMPLEREST_CONTEXT_CONTINUE_MATCH;
413
423
  Capabilities.SIMPLEREST_BODY_JSONPATH;
414
424
  Capabilities.SIMPLEREST_RESPONSE_JSONPATH;
415
425
  Capabilities.SIMPLEREST_RESPONSE_HOOK;
@@ -494,7 +504,6 @@ Capabilities.RATELIMIT_USERSAYS_MINTIME;
494
504
  Capabilities.RATELIMIT_BOTTLENECK_FN;
495
505
  Capabilities.SECURITY_ALLOW_UNSAFE;
496
506
  Capabilities.PRECOMPILERS;
497
- Capabilities.RETRY_CONVO_ASYNC;
498
507
 
499
508
  var Source = {
500
509
  LOCALPATH: 'LOCALPATH',
@@ -815,6 +824,7 @@ var Events = {
815
824
  CONTAINER_CLEANED: 'CONTAINER_CLEANED',
816
825
  CONTAINER_CLEAN_ERROR: 'CONTAINER_CLEAN_ERROR',
817
826
  BOT_CONNECTED: 'BOT_CONNECTED',
827
+ CONVO_STEP_NEXT: 'CONVO_STEP_NEXT',
818
828
  // Chatbot Events
819
829
  MESSAGE_SENTTOBOT: 'MESSAGE_SENTTOBOT',
820
830
  MESSAGE_SENDTOBOT_ERROR: 'MESSAGE_SENDTOBOT_ERROR',
@@ -838,6 +848,7 @@ Events.CONTAINER_CLEANING;
838
848
  Events.CONTAINER_CLEANED;
839
849
  Events.CONTAINER_CLEAN_ERROR;
840
850
  Events.BOT_CONNECTED;
851
+ Events.CONVO_STEP_NEXT;
841
852
  Events.MESSAGE_SENTTOBOT;
842
853
  Events.MESSAGE_SENDTOBOT_ERROR;
843
854
  Events.MESSAGE_RECEIVEDFROMBOT;
@@ -2181,7 +2192,7 @@ const linesToScriptingMemories$2 = (lines, columnMode = null) => {
2181
2192
  }
2182
2193
  return scriptingMemories;
2183
2194
  };
2184
- const calculateWer$1 = (str, pattern) => {
2195
+ const calculateWer$2 = (str, pattern) => {
2185
2196
  const _prepareString = (str, remWildcard = false) => {
2186
2197
  if (remWildcard) return str.replace(/[.,/#!$%^&;:*{}=\-_`~()]/g, '').toLowerCase();
2187
2198
  return str.replace(/[.,/#!$%^&;:{}=\-_`~()]/g, '').toLowerCase();
@@ -2204,6 +2215,11 @@ const calculateWer$1 = (str, pattern) => {
2204
2215
  const botMessage = _prepareString(str);
2205
2216
  const botMessageWords = botMessage.split(' ').map(bm => bm.trim());
2206
2217
  const utt = _prepareString(utterance);
2218
+
2219
+ // if no wildcards, just calculate WER
2220
+ if (utt.indexOf('*') === -1) return wordErrorRate.wordErrorRate(botMessage, utt).toFixed(2);
2221
+
2222
+ // if there are wildcards, calculate WER for each wildcard part
2207
2223
  const errors = [];
2208
2224
  for (let wildcardPart of utt.split('*')) {
2209
2225
  let wer = 1;
@@ -2223,7 +2239,7 @@ const calculateWer$1 = (str, pattern) => {
2223
2239
  }
2224
2240
  }
2225
2241
  if (lodash.isNil(subsetPhraseFound)) {
2226
- throw new Error('Word Error Asserter: Something went wrong here, please try to modify your assertion!');
2242
+ throw new Error('Word Error Asserter: When using wild cards, please make sure that the length of the asserter text is smaller than the bot message!');
2227
2243
  }
2228
2244
  errors.push(_getErrors(_getWords(wildcardPart), _getWords(subsetPhraseFound)));
2229
2245
  }
@@ -2236,6 +2252,7 @@ const calculateWer$1 = (str, pattern) => {
2236
2252
  debug$l(`Word Error Rate Asserter - Compared Bot Message '${botMessage}' / '${utt}': ${(errCount / allCount).toFixed(2)}`);
2237
2253
  return (errCount / allCount).toFixed(2);
2238
2254
  };
2255
+ const toPercent$1 = s => `${(s * 100).toFixed(0)}%`;
2239
2256
  var helper = {
2240
2257
  normalizeText: normalizeText$1,
2241
2258
  splitStringInNonEmptyLines: splitStringInNonEmptyLines$1,
@@ -2250,7 +2267,8 @@ var helper = {
2250
2267
  validateSender: validateSender$1,
2251
2268
  validateConvo: validateConvo$2,
2252
2269
  linesToScriptingMemories: linesToScriptingMemories$2,
2253
- calculateWer: calculateWer$1
2270
+ calculateWer: calculateWer$2,
2271
+ toPercent: toPercent$1
2254
2272
  };
2255
2273
 
2256
2274
  const debug$k = debug$n('botium-core-ScriptingMemory');
@@ -2590,45 +2608,7 @@ ScriptingMemory.extractVarNames;
2590
2608
  ScriptingMemory.RESERVED_WORDS;
2591
2609
  ScriptingMemory.SCRIPTING_FUNCTIONS;
2592
2610
 
2593
- const debug$j = debug$n('botium-core-RetryHelper');
2594
- var RetryHelper_1 = class RetryHelper {
2595
- constructor(caps, section, options = {}) {
2596
- this.retryErrorPatterns = [];
2597
- const onErrorRegexp = caps[`RETRY_${section.toUpperCase()}_ONERROR_REGEXP`] || [];
2598
- if (onErrorRegexp) {
2599
- if (lodash.isArray(onErrorRegexp)) {
2600
- onErrorRegexp.forEach(r => {
2601
- if (lodash.isString(r)) this.retryErrorPatterns.push(new RegExp(r, 'i'));else this.retryErrorPatterns.push(r);
2602
- });
2603
- } else if (lodash.isString(onErrorRegexp)) {
2604
- this.retryErrorPatterns.push(new RegExp(onErrorRegexp, 'i'));
2605
- } else {
2606
- this.retryErrorPatterns.push(onErrorRegexp);
2607
- }
2608
- }
2609
-
2610
- // to turn on retries, NUMRETRIES or ONERROR_REGEXP has to be set
2611
- this.retrySettings = {
2612
- retries: caps[`RETRY_${section.toUpperCase()}_NUMRETRIES`] || (!lodash.isNil(options.numRetries) ? options.numRetries : this.retryErrorPatterns.length === 0 ? 0 : 1),
2613
- factor: caps[`RETRY_${section.toUpperCase()}_FACTOR`] || (lodash.isNil(options.factor) ? 1 : options.factor),
2614
- minTimeout: caps[`RETRY_${section.toUpperCase()}_MINTIMEOUT`] || (lodash.isNil(options.minTimeout) ? 1000 : options.minTimeout)
2615
- };
2616
- if (this.retrySettings.retries > 0) {
2617
- debug$j(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
2618
- }
2619
- }
2620
- shouldRetry(err) {
2621
- if (!err) return false;
2622
- if (this.retryErrorPatterns.length === 0) return true;
2623
- const errString = util.inspect(err);
2624
- for (const re of this.retryErrorPatterns) {
2625
- if (errString.match(re)) return true;
2626
- }
2627
- return false;
2628
- }
2629
- };
2630
-
2631
- const debug$i = debug$n('botium-core-Convo');
2611
+ const debug$j = debug$n('botium-core-Convo');
2632
2612
  const {
2633
2613
  BotiumError: BotiumError$4,
2634
2614
  botiumErrorFromErr: botiumErrorFromErr$1,
@@ -2782,10 +2762,10 @@ class TranscriptError extends Error {
2782
2762
  class Convo$6 {
2783
2763
  constructor(context, fromJson = {}) {
2784
2764
  if (fromJson instanceof Convo$6) {
2785
- debug$i('Illegal state!!! Parameter should be a JSON, but it is a Convo');
2765
+ debug$j('Illegal state!!! Parameter should be a JSON, but it is a Convo');
2786
2766
  } else if (fromJson.beginAsserter) {
2787
2767
  // beginAsserter is one of the fields which are lost
2788
- debug$i('Illegal state!!! Parameter should be a native JSON, but looks as a Convo converted to JSON');
2768
+ debug$j('Illegal state!!! Parameter should be a native JSON, but looks as a Convo converted to JSON');
2789
2769
  }
2790
2770
  this.scriptingEvents = context.scriptingEvents;
2791
2771
  this.context = context;
@@ -2830,30 +2810,6 @@ class Convo$6 {
2830
2810
  return this.header.toString() + (this.sourceTag ? ` (${util.inspect(this.sourceTag)})` : '') + ': ' + this.conversation.map(c => c.toString()).join(' | ');
2831
2811
  }
2832
2812
  async Run(container) {
2833
- if (container.caps.RETRY_CONVO_ASYNC) {
2834
- return this.RunImpl(container).catch(err => {
2835
- debug$i(`Convo failed with error "${err.message || JSON.stringify(err)}".`);
2836
- throw err;
2837
- });
2838
- } else {
2839
- const retryHelper = new RetryHelper_1(container.caps, 'CONVO');
2840
- return promiseRetry(async (retry, number) => {
2841
- const retryRemaining = retryHelper.retrySettings.retries - number + 1;
2842
- return this.RunImpl(container).catch(err => {
2843
- if (retryHelper.shouldRetry(err)) {
2844
- debug$i(`Convo failed with error "${err.message || JSON.stringify(err)}". Retry ${retryRemaining > 0 ? 'enabled' : 'disabled'} (remaining #${retryRemaining}/${retryHelper.retrySettings.retries}, criterion matches)`);
2845
- retry(err);
2846
- } else {
2847
- if (retryHelper.retryErrorPatterns.length > 0) {
2848
- debug$i(`Convo failed with error "${err.message || JSON.stringify(err)}". Retry 'disabled' (remaining (#${retryRemaining}/${retryHelper.retrySettings.retries}), criterion does not match)`);
2849
- }
2850
- throw err;
2851
- }
2852
- });
2853
- }, retryHelper.retrySettings);
2854
- }
2855
- }
2856
- async RunImpl(container) {
2857
2813
  const transcript = new Transcript({
2858
2814
  steps: [],
2859
2815
  attachments: [],
@@ -2959,6 +2915,7 @@ class Convo$6 {
2959
2915
  for (let i = 0; i < this.conversation.length; i++) {
2960
2916
  const convoStep = this.conversation[i];
2961
2917
  const currentStepIndex = i;
2918
+ container.eventEmitter.emit(Events.CONVO_STEP_NEXT, container, convoStep, i);
2962
2919
  skipTranscriptStep = false;
2963
2920
  const transcriptStep = new TranscriptStep({
2964
2921
  expected: new BotiumMockMessage_1(convoStep),
@@ -3018,7 +2975,7 @@ class Convo$6 {
3018
2975
  });
3019
2976
  await this._checkBotRepliesConsumed(container);
3020
2977
  const coreMsg = lodash.omit(removeBuffers(meMsg), ['sourceData']);
3021
- debug$i(`${this.header.name}/${convoStep.stepTag}: user says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
2978
+ debug$j(`${this.header.name}/${convoStep.stepTag}: user says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3022
2979
  await new Promise(resolve => {
3023
2980
  if (container.caps.SIMULATE_WRITING_SPEED && meMsg.messageText && meMsg.messageText.length) {
3024
2981
  setTimeout(() => resolve(), container.caps.SIMULATE_WRITING_SPEED * meMsg.messageText.length);
@@ -3054,7 +3011,7 @@ class Convo$6 {
3054
3011
  });
3055
3012
  continue;
3056
3013
  } else {
3057
- debug$i(`${this.header.name}/${convoStep.stepTag}: message not found in #me section, message not sent to container ${util.inspect(convoStep)}`);
3014
+ debug$j(`${this.header.name}/${convoStep.stepTag}: message not found in #me section, message not sent to container ${util.inspect(convoStep)}`);
3058
3015
  transcriptStep.botEnd = new Date();
3059
3016
  await this.scriptingEvents.onMeEnd({
3060
3017
  convo: this,
@@ -3070,7 +3027,7 @@ class Convo$6 {
3070
3027
  } catch (err) {
3071
3028
  transcriptStep.botEnd = new Date();
3072
3029
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: error sending to bot - ${err.message || err}`, err);
3073
- debug$i(failErr);
3030
+ debug$j(failErr);
3074
3031
  try {
3075
3032
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr);
3076
3033
  } catch (failErr) {}
@@ -3083,7 +3040,7 @@ class Convo$6 {
3083
3040
  waitForBotSays = true;
3084
3041
  }
3085
3042
  try {
3086
- debug$i(`${this.header.name} wait for bot ${convoStep.channel || ''}`);
3043
+ debug$j(`${this.header.name} wait for bot ${convoStep.channel || ''}`);
3087
3044
  await this.scriptingEvents.onBotStart({
3088
3045
  convo: this,
3089
3046
  convoStep,
@@ -3099,11 +3056,11 @@ class Convo$6 {
3099
3056
  transcriptStep.botEnd = new Date();
3100
3057
  transcriptStep.actual = new BotiumMockMessage_1(botMsg);
3101
3058
  const coreMsg = lodash.omit(removeBuffers(botMsg), ['sourceData']);
3102
- debug$i(`${this.header.name}: bot says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3059
+ debug$j(`${this.header.name}: bot says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3103
3060
  } catch (err) {
3104
3061
  transcriptStep.botEnd = new Date();
3105
3062
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: error waiting for bot - ${err.message}`, err);
3106
- debug$i(failErr);
3063
+ debug$j(failErr);
3107
3064
  try {
3108
3065
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3109
3066
  } catch (failErr) {}
@@ -3122,19 +3079,27 @@ class Convo$6 {
3122
3079
  if (prepared) {
3123
3080
  transcriptStep.actual = new BotiumMockMessage_1(botMsg);
3124
3081
  const coreMsg = lodash.omit(removeBuffers(botMsg), ['sourceData']);
3125
- debug$i(`${this.header.name}: onBotPrepare (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3082
+ debug$j(`${this.header.name}: onBotPrepare (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3126
3083
  }
3127
3084
  } catch (err) {
3128
3085
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: onBotPrepare error - ${err.message || err}`, err);
3129
- debug$i(failErr);
3086
+ debug$j(failErr);
3130
3087
  try {
3131
3088
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3132
3089
  } catch (failErr) {}
3133
3090
  throw failErr;
3134
3091
  }
3092
+ if (convoStep.skip === true) {
3093
+ skipTranscriptStep = true;
3094
+ const nextConvoStep = this.conversation[i + 1];
3095
+ if (nextConvoStep && nextConvoStep.sender === 'bot') {
3096
+ waitForBotSays = false;
3097
+ }
3098
+ continue;
3099
+ }
3135
3100
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
3136
3101
  const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
3137
- debug$i(failErr);
3102
+ debug$j(failErr);
3138
3103
  try {
3139
3104
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3140
3105
  } catch (failErr) {}
@@ -3215,7 +3180,7 @@ class Convo$6 {
3215
3180
  continue;
3216
3181
  }
3217
3182
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: assertion error - ${err.message || err}`, err);
3218
- debug$i(failErr);
3183
+ debug$j(failErr);
3219
3184
  try {
3220
3185
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3221
3186
  } catch (failErr) {}
@@ -3236,7 +3201,7 @@ class Convo$6 {
3236
3201
  }
3237
3202
  } else {
3238
3203
  const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util.inspect(convoStep.sender)}`);
3239
- debug$i(failErr);
3204
+ debug$j(failErr);
3240
3205
  try {
3241
3206
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr);
3242
3207
  } catch (failErr) {}
@@ -3442,7 +3407,7 @@ class Convo$6 {
3442
3407
  throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
3443
3408
  }
3444
3409
  _getEffectiveConversationRecursive(partialConvo.conversation, [...parentPConvos, includeLogicHook], result, true);
3445
- debug$i(`Partial convo ${includeLogicHook} included`);
3410
+ debug$j(`Partial convo ${includeLogicHook} included`);
3446
3411
  });
3447
3412
  });
3448
3413
  return result;
@@ -3463,10 +3428,48 @@ var Convo_1 = {
3463
3428
  TranscriptError
3464
3429
  };
3465
3430
 
3431
+ const debug$i = debug$n('botium-core-RetryHelper');
3432
+ var RetryHelper_1 = class RetryHelper {
3433
+ constructor(caps, section, options = {}) {
3434
+ this.retryErrorPatterns = [];
3435
+ const onErrorRegexp = caps[`RETRY_${section.toUpperCase()}_ONERROR_REGEXP`] || [];
3436
+ if (onErrorRegexp) {
3437
+ if (lodash.isArray(onErrorRegexp)) {
3438
+ onErrorRegexp.forEach(r => {
3439
+ if (lodash.isString(r)) this.retryErrorPatterns.push(new RegExp(r, 'i'));else this.retryErrorPatterns.push(r);
3440
+ });
3441
+ } else if (lodash.isString(onErrorRegexp)) {
3442
+ this.retryErrorPatterns.push(new RegExp(onErrorRegexp, 'i'));
3443
+ } else {
3444
+ this.retryErrorPatterns.push(onErrorRegexp);
3445
+ }
3446
+ }
3447
+
3448
+ // to turn on retries, NUMRETRIES or ONERROR_REGEXP has to be set
3449
+ this.retrySettings = {
3450
+ retries: caps[`RETRY_${section.toUpperCase()}_NUMRETRIES`] || (!lodash.isNil(options.numRetries) ? options.numRetries : this.retryErrorPatterns.length === 0 ? 0 : 1),
3451
+ factor: caps[`RETRY_${section.toUpperCase()}_FACTOR`] || (lodash.isNil(options.factor) ? 1 : options.factor),
3452
+ minTimeout: caps[`RETRY_${section.toUpperCase()}_MINTIMEOUT`] || (lodash.isNil(options.minTimeout) ? 1000 : options.minTimeout)
3453
+ };
3454
+ if (this.retrySettings.retries > 0) {
3455
+ debug$i(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
3456
+ }
3457
+ }
3458
+ shouldRetry(err) {
3459
+ if (!err) return false;
3460
+ if (this.retryErrorPatterns.length === 0) return true;
3461
+ const errString = util.inspect(err);
3462
+ for (const re of this.retryErrorPatterns) {
3463
+ if (errString.match(re)) return true;
3464
+ }
3465
+ return false;
3466
+ }
3467
+ };
3468
+
3466
3469
  const {
3467
3470
  toString,
3468
3471
  quoteRegexpString,
3469
- calculateWer
3472
+ calculateWer: calculateWer$1
3470
3473
  } = helper;
3471
3474
  const _normalize = botresponse => {
3472
3475
  if (lodash.isUndefined(botresponse) || lodash.isNil(botresponse)) return '';
@@ -3534,7 +3537,7 @@ const wer = () => (botresponse, utterance, args) => {
3534
3537
  botresponse = _normalize(botresponse || '');
3535
3538
  utterance = toString(utterance || '');
3536
3539
  const threshold = [',', '.'].find(p => `${args[0]}`.includes(p)) ? parseFloat(args[0]) : parseInt(args[0]) / 100;
3537
- return calculateWer(botresponse, utterance) <= threshold;
3540
+ return calculateWer$1(botresponse, utterance) <= threshold;
3538
3541
  };
3539
3542
  const getMatchFunction$1 = matchingMode => {
3540
3543
  if (matchingMode === 'regexp' || matchingMode === 'regexpIgnoreCase') {
@@ -5328,6 +5331,10 @@ const {
5328
5331
  const {
5329
5332
  getMatchFunction
5330
5333
  } = MatchFunctions;
5334
+ const {
5335
+ calculateWer,
5336
+ toPercent
5337
+ } = helper;
5331
5338
  const globPattern = '**/+(*.convo.txt|*.utterances.txt|*.pconvo.txt|*.scriptingmemory.txt|*.xlsx|*.xlsm|*.convo.csv|*.pconvo.csv|*.utterances.csv|*.yaml|*.yml|*.json|*.md|*.markdown)';
5332
5339
  const skipPattern = /^skip[.\-_]/i;
5333
5340
  const p = (retryHelper, fn) => {
@@ -5588,29 +5595,51 @@ var ScriptingProvider_1 = class ScriptingProvider {
5588
5595
  const found = lodash.find(tomatch, utt => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
5589
5596
  const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
5590
5597
  if (lodash.isNil(found)) {
5591
- let message = `${stepTag}: Bot response `;
5592
- message += meMsg ? `(on ${meMsg}) ` : '';
5593
- message += botresponse ? '"' + botresponse + '"' : '<no response>';
5594
- message += ' expected to match ';
5595
- message += tomatch && tomatch.length > 1 ? 'one of ' : '';
5596
- message += `${tomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5597
- throw new BotiumError$2(message, {
5598
- type: 'asserter',
5599
- source: asserterType,
5600
- params: {
5601
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5602
- args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5603
- },
5604
- context: {
5605
- stepTag
5606
- },
5607
- cause: {
5608
- expected: tomatch,
5609
- actual: botresponse,
5610
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5611
- args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5612
- }
5613
- });
5598
+ if (this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer') {
5599
+ const wer = calculateWer(botresponse, tomatch[0]);
5600
+ const werArgs = this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS];
5601
+ const threshold = [',', '.'].find(p => `${werArgs[0]}`.includes(p)) ? parseFloat(werArgs[0]) : parseInt(werArgs[0]) / 100;
5602
+ const message = `${stepTag}: Word Error Rate (${toPercent(wer)}) higher than accepted (${toPercent(threshold)})`;
5603
+ throw new BotiumError$2(message, {
5604
+ type: 'asserter',
5605
+ source: asserterType,
5606
+ params: {
5607
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5608
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5609
+ },
5610
+ context: {
5611
+ stepTag
5612
+ },
5613
+ cause: {
5614
+ expected: `<=${toPercent(threshold)} (${tomatch})`,
5615
+ actual: `${toPercent(wer)} (${botresponse})`
5616
+ }
5617
+ });
5618
+ } else {
5619
+ let message = `${stepTag}: Bot response `;
5620
+ message += meMsg ? `(on ${meMsg}) ` : '';
5621
+ message += botresponse ? '"' + botresponse + '"' : '<no response>';
5622
+ message += ' expected to match ';
5623
+ message += tomatch && tomatch.length > 1 ? 'one of ' : '';
5624
+ message += `${tomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5625
+ throw new BotiumError$2(message, {
5626
+ type: 'asserter',
5627
+ source: asserterType,
5628
+ params: {
5629
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5630
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5631
+ },
5632
+ context: {
5633
+ stepTag
5634
+ },
5635
+ cause: {
5636
+ expected: tomatch,
5637
+ actual: botresponse,
5638
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5639
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5640
+ }
5641
+ });
5642
+ }
5614
5643
  }
5615
5644
  },
5616
5645
  assertBotNotResponse: (botresponse, nottomatch, stepTag, meMsg) => {
@@ -5621,30 +5650,52 @@ var ScriptingProvider_1 = class ScriptingProvider {
5621
5650
  const found = lodash.find(nottomatch, utt => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
5622
5651
  const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
5623
5652
  if (!lodash.isNil(found)) {
5624
- let message = `${stepTag}: Bot response `;
5625
- message += meMsg ? `(on ${meMsg}) ` : '';
5626
- message += botresponse ? '"' + botresponse + '"' : '<no response>';
5627
- message += ' expected NOT to match ';
5628
- message += nottomatch && nottomatch.length > 1 ? 'one of ' : '';
5629
- message += `${nottomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5630
- throw new BotiumError$2(message, {
5631
- type: 'asserter',
5632
- source: asserterType,
5633
- params: {
5634
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5635
- args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5636
- },
5637
- context: {
5638
- stepTag
5639
- },
5640
- cause: {
5641
- not: true,
5642
- expected: nottomatch,
5643
- actual: botresponse,
5644
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5645
- args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5646
- }
5647
- });
5653
+ if (this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer') {
5654
+ const wer = calculateWer(botresponse, nottomatch[0]);
5655
+ const werArgs = this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS];
5656
+ const threshold = [',', '.'].find(p => `${werArgs[0]}`.includes(p)) ? parseFloat(werArgs[0]) : parseInt(werArgs[0]) / 100;
5657
+ const message = `${stepTag}: Word Error Rate (${toPercent(wer)}) lower than accepted (${toPercent(threshold)})`;
5658
+ throw new BotiumError$2(message, {
5659
+ type: 'asserter',
5660
+ source: asserterType,
5661
+ params: {
5662
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5663
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5664
+ },
5665
+ context: {
5666
+ stepTag
5667
+ },
5668
+ cause: {
5669
+ expected: `>=${toPercent(threshold)} (${nottomatch})`,
5670
+ actual: `${toPercent(wer)} (${botresponse})`
5671
+ }
5672
+ });
5673
+ } else {
5674
+ let message = `${stepTag}: Bot response `;
5675
+ message += meMsg ? `(on ${meMsg}) ` : '';
5676
+ message += botresponse ? '"' + botresponse + '"' : '<no response>';
5677
+ message += ' expected NOT to match ';
5678
+ message += nottomatch && nottomatch.length > 1 ? 'one of ' : '';
5679
+ message += `${nottomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5680
+ throw new BotiumError$2(message, {
5681
+ type: 'asserter',
5682
+ source: asserterType,
5683
+ params: {
5684
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5685
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5686
+ },
5687
+ context: {
5688
+ stepTag
5689
+ },
5690
+ cause: {
5691
+ not: true,
5692
+ expected: nottomatch,
5693
+ actual: botresponse,
5694
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5695
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5696
+ }
5697
+ });
5698
+ }
5648
5699
  }
5649
5700
  },
5650
5701
  fail: null
@@ -6340,10 +6391,16 @@ var ScriptingProvider_1 = class ScriptingProvider {
6340
6391
  convoFilter: null
6341
6392
  }, options);
6342
6393
  const expandedConvos = [];
6394
+ // The globalContext is going to keep the data even if the Object.assign which happening to create the myContext in _expandConvo function
6395
+ const context = {
6396
+ globalContext: {
6397
+ totalConvoCount: 0
6398
+ }
6399
+ };
6343
6400
  debug$9(`ExpandConvos - Using utterances expansion mode: ${this.caps[Capabilities.SCRIPTING_UTTEXPANSION_MODE]}`);
6344
6401
  this.convos.forEach(convo => {
6345
6402
  convo.expandPartialConvos();
6346
- for (const expanded of this._expandConvo(convo, options, {})) {
6403
+ for (const expanded of this._expandConvo(convo, options, context)) {
6347
6404
  expanded.header.assertionCount = this.GetAssertionCount(expanded);
6348
6405
  if (options.justHeader) {
6349
6406
  const ConvoWithOnlyHeader = {
@@ -6359,6 +6416,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6359
6416
  }
6360
6417
  });
6361
6418
  this.convos = expandedConvos;
6419
+ this.totalConvoCount = context.globalContext.totalConvoCount;
6362
6420
  if (!options.justHeader) {
6363
6421
  this._sortConvos();
6364
6422
  } else {
@@ -6370,16 +6428,23 @@ var ScriptingProvider_1 = class ScriptingProvider {
6370
6428
  // drop unwanted convos
6371
6429
  convoFilter: null
6372
6430
  }, options);
6431
+ // The globalContext is going to keep the data even if the Object.assign which happening to create the myContext in _expandConvo function
6432
+ const context = {
6433
+ globalContext: {
6434
+ totalConvoCount: 0
6435
+ }
6436
+ };
6373
6437
  debug$9(`ExpandConvos - Using utterances expansion mode: ${this.caps[Capabilities.SCRIPTING_UTTEXPANSION_MODE]}`);
6374
6438
  // creating a nested generator, calling the other.
6375
6439
  // We hope this.convos does not changes while this iterator is used
6376
6440
  const _convosIterable = function* (options) {
6377
6441
  for (const convo of this.convos) {
6378
6442
  convo.expandPartialConvos();
6379
- yield* this._expandConvo(convo, options, {});
6443
+ yield* this._expandConvo(convo, options, context);
6380
6444
  }
6381
6445
  }.bind(this);
6382
6446
  this.convosIterable = _convosIterable(options);
6447
+ this.totalConvoCount = context.globalContext.totalConvoCount;
6383
6448
  }
6384
6449
 
6385
6450
  /**
@@ -6597,6 +6662,9 @@ var ScriptingProvider_1 = class ScriptingProvider {
6597
6662
  const expanded = Object.assign(lodash.cloneDeep(currentConvo), {
6598
6663
  conversation: lodash.cloneDeep(convoStepsStack)
6599
6664
  });
6665
+ if (!lodash.isNil(lodash.get(context, 'globalContext.totalConvoCount'))) {
6666
+ context.globalContext.totalConvoCount++;
6667
+ }
6600
6668
  if (!options.convoFilter || options.convoFilter(expanded)) {
6601
6669
  yield expanded;
6602
6670
  }
@@ -7247,10 +7315,12 @@ var BaseContainer_1 = class BaseContainer {
7247
7315
  }, rimraffed => {
7248
7316
  if (this.caps[Capabilities.CLEANUPTEMPDIR]) {
7249
7317
  debug$7(`Cleanup rimrafing temp dir ${this.tempDirectory}`);
7250
- rimraf(this.tempDirectory, err => {
7251
- if (err) debug$7(`Cleanup temp dir ${this.tempDirectory} failed: ${util.inspect(err)}`);
7318
+ try {
7319
+ rimraf$1.sync(this.tempDirectory);
7252
7320
  rimraffed();
7253
- });
7321
+ } catch (err) {
7322
+ rimraffed(new Error(`Cleanup temp directory ${this.tempDirectory} failed: ${util.inspect(err)}`));
7323
+ }
7254
7324
  } else {
7255
7325
  rimraffed();
7256
7326
  }
@@ -7869,6 +7939,43 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
7869
7939
  }
7870
7940
  debug$4(`current session context: ${util.inspect(this.view.context)}`);
7871
7941
  }
7942
+ const _isAnyContextJsonPathMatch = (capName, capNameMatch) => {
7943
+ const jsonPaths = getAllCapValues(capName, this.caps);
7944
+ if (jsonPaths.length > 0) {
7945
+ const jsonPathsMatch = getAllCapValues(capNameMatch, this.caps);
7946
+ for (const [index, jsonPath] of jsonPaths.entries()) {
7947
+ const contextNodes = jsonpath.query(this.view.context, jsonPath);
7948
+ if (lodash.isArray(contextNodes) && contextNodes.length > 0) {
7949
+ if (jsonPathsMatch[index]) {
7950
+ if (contextNodes[0] === jsonPathsMatch[index]) {
7951
+ return {
7952
+ jsonPath,
7953
+ match: contextNodes[0]
7954
+ };
7955
+ }
7956
+ } else {
7957
+ return {
7958
+ jsonPath
7959
+ };
7960
+ }
7961
+ }
7962
+ }
7963
+ }
7964
+ return null;
7965
+ };
7966
+ const ignoreMatch = _isAnyContextJsonPathMatch(Capabilities.SIMPLEREST_CONTEXT_IGNORE_JSONPATH, Capabilities.SIMPLEREST_CONTEXT_IGNORE_MATCH);
7967
+ if (ignoreMatch) {
7968
+ if (ignoreMatch.match) debug$4(`ignoring response for context match: ${ignoreMatch.jsonPath} = ${ignoreMatch.match}`);else debug$4(`ignoring response for context: ${ignoreMatch.jsonPath}`);
7969
+ return;
7970
+ }
7971
+ const skipMatch = _isAnyContextJsonPathMatch(Capabilities.SIMPLEREST_CONTEXT_SKIP_JSONPATH, Capabilities.SIMPLEREST_CONTEXT_SKIP_MATCH);
7972
+ if (skipMatch) {
7973
+ if (skipMatch.match) debug$4(`skipping response for context match: ${skipMatch.jsonPath} = ${skipMatch.match}`);else debug$4(`skipping response for context: ${skipMatch.jsonPath}`);
7974
+ setTimeout(() => this._doRequest({
7975
+ messageText: ''
7976
+ }, true, true), 0);
7977
+ return;
7978
+ }
7872
7979
  const result = [];
7873
7980
  if (isFromUser) {
7874
7981
  const _extractFrom = (root, jsonPaths) => {
@@ -8017,6 +8124,13 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8017
8124
  }
8018
8125
  }
8019
8126
  }
8127
+ const continueMatch = _isAnyContextJsonPathMatch(Capabilities.SIMPLEREST_CONTEXT_CONTINUE_JSONPATH, Capabilities.SIMPLEREST_CONTEXT_CONTINUE_MATCH);
8128
+ if (continueMatch) {
8129
+ if (continueMatch.match) debug$4(`continue with next response for context match: ${continueMatch.jsonPath} = ${continueMatch.match}`);else debug$4(`continue with next response for context: ${continueMatch.jsonPath}`);
8130
+ setTimeout(() => this._doRequest({
8131
+ messageText: ''
8132
+ }, true, true), 0);
8133
+ }
8020
8134
  return result;
8021
8135
  }
8022
8136
  _doRequest(msg, isFromUser, updateContext) {
@@ -8641,13 +8755,9 @@ const {
8641
8755
  var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseContainer_1 {
8642
8756
  async Validate() {
8643
8757
  await super.Validate();
8644
- const setAsync = isAsync => {
8645
- this.caps.RETRY_CONVO_ASYNC = isAsync;
8646
- };
8647
8758
  this.pluginInstance = tryLoadPlugin(this.caps[Capabilities.CONTAINERMODE], this.caps[Capabilities.PLUGINMODULEPATH], {
8648
8759
  container: this,
8649
8760
  queueBotSays: msg => this._QueueBotSays(msg),
8650
- setAsync: isAsync => setAsync(isAsync),
8651
8761
  bottleneck: this.bottleneck,
8652
8762
  eventEmitter: this.eventEmitter,
8653
8763
  caps: this.caps,
@@ -8778,15 +8888,18 @@ var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseCont
8778
8888
  }
8779
8889
  };
8780
8890
 
8781
- var require$$2 = getCjsExportFromNamespace(_package$1);
8891
+ var require$$3 = getCjsExportFromNamespace(_package$1);
8782
8892
 
8893
+ const {
8894
+ rimraf
8895
+ } = rimraf$1;
8783
8896
  const {
8784
8897
  boolean
8785
8898
  } = boolean$1;
8786
8899
  const debug$1 = debug$n('botium-core-BotDriver');
8787
8900
  const {
8788
8901
  version
8789
- } = require$$2;
8902
+ } = require$$3;
8790
8903
  var BotDriver_1 = class BotDriver {
8791
8904
  constructor(caps = {}, sources = {}, envs = {}) {
8792
8905
  this.eventEmitter = new events();
@@ -8904,9 +9017,7 @@ var BotDriver_1 = class BotDriver {
8904
9017
  debug$1(`BotDriver Build error: ${err}`);
8905
9018
  this.eventEmitter.emit(Events.CONTAINER_BUILD_ERROR, err);
8906
9019
  if (tempDirectory) {
8907
- rimraf(tempDirectory, err => {
8908
- if (err) debug$1(`Cleanup temp dir ${tempDirectory} failed: ${util.inspect(err)}`);
8909
- });
9020
+ rimraf(tempDirectory).catch(err => debug$1(`Cleanup temp dir ${tempDirectory} failed: ${util.inspect(err)}`));
8910
9021
  }
8911
9022
  return reject(err);
8912
9023
  }