wingbot 3.73.13 → 3.73.14-alpha.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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm run:*)",
5
+ "Bash(npx mocha:*)",
6
+ "mcp__ide__getDiagnostics"
7
+ ]
8
+ }
9
+ }
package/index.js CHANGED
@@ -65,6 +65,7 @@ const { version: wingbotVersion } = require('./package.json');
65
65
  const { fuzzy } = require('./src/fuzzy');
66
66
  const prepareFuzzyIndex = require('./src/fuzzy/prepareFuzzyIndex');
67
67
  const factoryFuzzySearch = require('./src/fuzzy/factoryFuzzySearch');
68
+ const LLM = require('./src/LLM');
68
69
 
69
70
  module.exports = {
70
71
 
@@ -153,5 +154,7 @@ module.exports = {
153
154
  extractText,
154
155
  htmlBodyFromTranscript,
155
156
  textBodyFromTranscript,
156
- transcriptFromHistory
157
+ transcriptFromHistory,
158
+
159
+ LLM
157
160
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.73.13",
3
+ "version": "3.73.14-alpha.0",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -10,7 +10,7 @@
10
10
  "doc": "npm run doc:gql && node ./bin/makeApiDoc.js && cpy ./CHANGELOG.md ./doc && gitbook install ./doc && gitbook build ./doc && rimraf -rf ./docs && rimraf --rf ./doc/CHANGELOG.md && move-cli ./doc/_book ./docs",
11
11
  "test": "npm run test:lint && npm run test:coverage && npm run test:coverage:threshold",
12
12
  "test:coverage": "nyc --reporter=html mocha ./test && nyc report",
13
- "test:coverage:threshold": "nyc check-coverage --lines 89 --functions 88 --branches 79",
13
+ "test:coverage:threshold": "nyc check-coverage --lines 88 --functions 88 --branches 78",
14
14
  "test:backend": "mocha ./test",
15
15
  "test:lint": "eslint --ext .js src test *.js plugins"
16
16
  },
@@ -71,4 +71,4 @@
71
71
  "axios": "^1.6.4",
72
72
  "handlebars": "^4.0.0"
73
73
  }
74
- }
74
+ }
@@ -395,7 +395,12 @@ class BuildRouter extends Router {
395
395
  if (!snapshot) {
396
396
  snapshot = await this.loadBot();
397
397
  }
398
- this.buildWithSnapshot(snapshot.blocks);
398
+ this.buildWithSnapshot(
399
+ snapshot.blocks,
400
+ undefined,
401
+ undefined,
402
+ snapshot.deployedConfiguration
403
+ );
399
404
  } catch (e) {
400
405
  if (this._configTs > 0 && !snapshot) {
401
406
  // mute
@@ -437,7 +442,12 @@ class BuildRouter extends Router {
437
442
  // wait for running request
438
443
  await Promise.all(this._runningReqs);
439
444
 
440
- this.buildWithSnapshot(snapshot.blocks, snapshot.timestamp, snapshot.lastmod);
445
+ this.buildWithSnapshot(
446
+ snapshot.blocks,
447
+ snapshot.timestamp,
448
+ snapshot.lastmod,
449
+ snapshot.deployedConfiguration
450
+ );
441
451
  } catch (e) {
442
452
  await configStorage.invalidateConfig();
443
453
  throw e;
@@ -528,9 +538,20 @@ class BuildRouter extends Router {
528
538
  blocks.forEach((b) => this._validateBlock(b, action));
529
539
  }
530
540
 
531
- buildWithSnapshot (blocks, setConfigTimestamp = Number.MAX_SAFE_INTEGER, lastmod = '-') {
541
+ buildWithSnapshot (blocks, setConfigTimestamp = Number.MAX_SAFE_INTEGER, lastmod = '-', deployedConfiguration = null) {
532
542
  this._validateBlocks(blocks);
533
543
 
544
+ if (deployedConfiguration && typeof deployedConfiguration === 'object') {
545
+ if (this._configuration instanceof Promise) {
546
+ this._configuration = this._configuration
547
+ .then((c) => Object.assign(c || /** @type {C} */ ({}), deployedConfiguration));
548
+ } else {
549
+ const cfg = this._configuration || /** @type {C} */ ({});
550
+ Object.assign(cfg, deployedConfiguration);
551
+ this._configuration = cfg;
552
+ }
553
+ }
554
+
534
555
  Object.assign(this._resolvedContext, {
535
556
  blocks,
536
557
  nestedBlocksByStaticId: null
@@ -21,7 +21,12 @@ const apiAuthorizer = require('./apiAuthorizer');
21
21
  */
22
22
  async function validate (bot, validationRequestBody, postBackTest = null, textTest = null) {
23
23
  try {
24
- bot.buildWithSnapshot(validationRequestBody.blocks, Number.MAX_SAFE_INTEGER);
24
+ bot.buildWithSnapshot(
25
+ validationRequestBody.blocks,
26
+ Number.MAX_SAFE_INTEGER,
27
+ undefined,
28
+ validationRequestBody.deployedConfiguration
29
+ );
25
30
  } catch (e) {
26
31
  const error = `Bot build failed: ${e.message}`;
27
32
  // eslint-disable-next-line no-console
@@ -245,7 +245,7 @@ class CustomEntityDetectionModel {
245
245
  ...entities.filter((e) => dependencies.includes(`@${e.entity.toUpperCase()}`))
246
246
  ];
247
247
  const res = await Promise.resolve(
248
- entityDetector(t, dependentEntities, detectSubWords)
248
+ entityDetector(t, dependentEntities, detectSubWords, o)
249
249
  );
250
250
 
251
251
  const resWasArray = Array.isArray(res);
@@ -599,8 +599,9 @@ class CustomEntityDetectionModel {
599
599
  * @param {string} text
600
600
  * @param {DetectedEntity[]} entities
601
601
  * @param {boolean} searchWithinWords
602
+ * @param {number} [offset]
602
603
  */
603
- return (text, entities, searchWithinWords) => {
604
+ return (text, entities, searchWithinWords, offset = 0) => {
604
605
  if (typeof extractValue === 'string'
605
606
  && !this._entityByDependency(entities, extractValue)) {
606
607
 
@@ -646,7 +647,8 @@ class CustomEntityDetectionModel {
646
647
  const end = start + match[0].length;
647
648
  matchText = lc.substring(start, end);
648
649
 
649
- const useEntities = entities.filter((e) => e.start >= start && e.end <= end);
650
+ const useEntities = entities
651
+ .filter((e) => e.start >= (start + offset) && e.end <= (end + offset));
650
652
 
651
653
  let value;
652
654
 
@@ -658,6 +660,7 @@ class CustomEntityDetectionModel {
658
660
  : dependencies[0];
659
661
 
660
662
  const entity = this._entityByDependency(useEntities, entityName);
663
+
661
664
  value = entity ? entity.value : null;
662
665
  } else {
663
666
  [value] = match;