agent-swarm-kit 1.0.52 → 1.0.53

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/build/index.cjs CHANGED
@@ -3756,7 +3756,7 @@ var ClientStorage = /** @class */ (function () {
3756
3756
  search: search,
3757
3757
  total: total,
3758
3758
  });
3759
- indexed = [];
3759
+ indexed = new functoolsKit.SortedArray();
3760
3760
  return [4 /*yield*/, this.params.createEmbedding(search)];
3761
3761
  case 1:
3762
3762
  searchEmbeddings = _a.sent();
@@ -3776,7 +3776,7 @@ var ClientStorage = /** @class */ (function () {
3776
3776
  if (this.params.onCompare) {
3777
3777
  this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
3778
3778
  }
3779
- indexed.push({ data: item, score: score });
3779
+ indexed.push({ id: item.id }, score);
3780
3780
  return [2 /*return*/];
3781
3781
  }
3782
3782
  });
@@ -3786,25 +3786,13 @@ var ClientStorage = /** @class */ (function () {
3786
3786
  })))];
3787
3787
  case 2:
3788
3788
  _a.sent();
3789
- filtered = indexed
3790
- .filter(function (_a) {
3791
- var score = _a.score;
3792
- return score > GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY;
3793
- })
3794
- .sort(function (_a, _b) {
3795
- var a = _a.score;
3796
- var b = _b.score;
3797
- return b - a;
3798
- });
3799
- this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take filtered"), {
3800
- filtered: filtered.map(function (_a) {
3801
- var data = _a.data, score = _a.score;
3802
- return ({ id: data.id, score: score });
3803
- }),
3789
+ this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
3790
+ indexed: indexed.getEntries(),
3804
3791
  });
3792
+ filtered = indexed.take(total, GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY);
3805
3793
  return [2 /*return*/, filtered.map(function (_a) {
3806
- var data = _a.data;
3807
- return data;
3794
+ var id = _a.id;
3795
+ return _this._itemMap.get(id);
3808
3796
  })];
3809
3797
  }
3810
3798
  });
package/build/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { scoped } from 'di-scoped';
2
- import { ToolRegistry, trycatch, sleep, PubsubArrayAdapter, Subject, queued, not, randomString, memoize, createAwaiter, cancelable, CANCELED_PROMISE_SYMBOL, singleshot, execpool, schedule, ttl, Source } from 'functools-kit';
2
+ import { ToolRegistry, trycatch, sleep, PubsubArrayAdapter, Subject, queued, not, randomString, memoize, createAwaiter, cancelable, CANCELED_PROMISE_SYMBOL, singleshot, execpool, SortedArray, schedule, ttl, Source } from 'functools-kit';
3
3
  import { createActivator } from 'di-kit';
4
4
  import { omit } from 'lodash-es';
5
5
  import xml2js from 'xml2js';
@@ -3754,7 +3754,7 @@ var ClientStorage = /** @class */ (function () {
3754
3754
  search: search,
3755
3755
  total: total,
3756
3756
  });
3757
- indexed = [];
3757
+ indexed = new SortedArray();
3758
3758
  return [4 /*yield*/, this.params.createEmbedding(search)];
3759
3759
  case 1:
3760
3760
  searchEmbeddings = _a.sent();
@@ -3774,7 +3774,7 @@ var ClientStorage = /** @class */ (function () {
3774
3774
  if (this.params.onCompare) {
3775
3775
  this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
3776
3776
  }
3777
- indexed.push({ data: item, score: score });
3777
+ indexed.push({ id: item.id }, score);
3778
3778
  return [2 /*return*/];
3779
3779
  }
3780
3780
  });
@@ -3784,25 +3784,13 @@ var ClientStorage = /** @class */ (function () {
3784
3784
  })))];
3785
3785
  case 2:
3786
3786
  _a.sent();
3787
- filtered = indexed
3788
- .filter(function (_a) {
3789
- var score = _a.score;
3790
- return score > GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY;
3791
- })
3792
- .sort(function (_a, _b) {
3793
- var a = _a.score;
3794
- var b = _b.score;
3795
- return b - a;
3796
- });
3797
- this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take filtered"), {
3798
- filtered: filtered.map(function (_a) {
3799
- var data = _a.data, score = _a.score;
3800
- return ({ id: data.id, score: score });
3801
- }),
3787
+ this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
3788
+ indexed: indexed.getEntries(),
3802
3789
  });
3790
+ filtered = indexed.take(total, GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY);
3803
3791
  return [2 /*return*/, filtered.map(function (_a) {
3804
- var data = _a.data;
3805
- return data;
3792
+ var id = _a.id;
3793
+ return _this._itemMap.get(id);
3806
3794
  })];
3807
3795
  }
3808
3796
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",