agent-swarm-kit 1.0.60 → 1.0.61

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
@@ -3869,11 +3869,12 @@ var ClientStorage = /** @class */ (function () {
3869
3869
  args_1[_i - 2] = arguments[_i];
3870
3870
  }
3871
3871
  return __awaiter(_this, __spreadArray([search_1, total_1], __read(args_1), false), void 0, function (search, total, score) {
3872
- var indexed, searchEmbeddings, filtered;
3872
+ var indexed, searchEmbeddings;
3873
3873
  var _this = this;
3874
+ var _a, _b;
3874
3875
  if (score === void 0) { score = GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY; }
3875
- return __generator(this, function (_a) {
3876
- switch (_a.label) {
3876
+ return __generator(this, function (_c) {
3877
+ switch (_c.label) {
3877
3878
  case 0:
3878
3879
  this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take"), {
3879
3880
  search: search,
@@ -3882,7 +3883,7 @@ var ClientStorage = /** @class */ (function () {
3882
3883
  indexed = new functoolsKit.SortedArray();
3883
3884
  return [4 /*yield*/, this.params.createEmbedding(search)];
3884
3885
  case 1:
3885
- searchEmbeddings = _a.sent();
3886
+ searchEmbeddings = _c.sent();
3886
3887
  if (this.params.onCreate) {
3887
3888
  this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
3888
3889
  }
@@ -3899,7 +3900,7 @@ var ClientStorage = /** @class */ (function () {
3899
3900
  if (this.params.onCompare) {
3900
3901
  this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
3901
3902
  }
3902
- indexed.push({ id: item.id }, score);
3903
+ indexed.push(item, score);
3903
3904
  return [2 /*return*/];
3904
3905
  }
3905
3906
  });
@@ -3908,15 +3909,14 @@ var ClientStorage = /** @class */ (function () {
3908
3909
  maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
3909
3910
  })))];
3910
3911
  case 2:
3911
- _a.sent();
3912
+ _c.sent();
3912
3913
  this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
3913
3914
  indexed: indexed.getEntries(),
3914
3915
  });
3915
- filtered = indexed.take(total, score);
3916
- return [2 /*return*/, filtered.map(function (_a) {
3917
- var id = _a.id;
3918
- return _this._itemMap.get(id);
3919
- })];
3916
+ if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onSearch) {
3917
+ (_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onSearch(search, indexed, this.params.clientId, this.params.storageName);
3918
+ }
3919
+ return [2 /*return*/, indexed.take(total, score)];
3920
3920
  }
3921
3921
  });
3922
3922
  });
package/build/index.mjs CHANGED
@@ -3867,11 +3867,12 @@ var ClientStorage = /** @class */ (function () {
3867
3867
  args_1[_i - 2] = arguments[_i];
3868
3868
  }
3869
3869
  return __awaiter(_this, __spreadArray([search_1, total_1], __read(args_1), false), void 0, function (search, total, score) {
3870
- var indexed, searchEmbeddings, filtered;
3870
+ var indexed, searchEmbeddings;
3871
3871
  var _this = this;
3872
+ var _a, _b;
3872
3873
  if (score === void 0) { score = GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY; }
3873
- return __generator(this, function (_a) {
3874
- switch (_a.label) {
3874
+ return __generator(this, function (_c) {
3875
+ switch (_c.label) {
3875
3876
  case 0:
3876
3877
  this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take"), {
3877
3878
  search: search,
@@ -3880,7 +3881,7 @@ var ClientStorage = /** @class */ (function () {
3880
3881
  indexed = new SortedArray();
3881
3882
  return [4 /*yield*/, this.params.createEmbedding(search)];
3882
3883
  case 1:
3883
- searchEmbeddings = _a.sent();
3884
+ searchEmbeddings = _c.sent();
3884
3885
  if (this.params.onCreate) {
3885
3886
  this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
3886
3887
  }
@@ -3897,7 +3898,7 @@ var ClientStorage = /** @class */ (function () {
3897
3898
  if (this.params.onCompare) {
3898
3899
  this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
3899
3900
  }
3900
- indexed.push({ id: item.id }, score);
3901
+ indexed.push(item, score);
3901
3902
  return [2 /*return*/];
3902
3903
  }
3903
3904
  });
@@ -3906,15 +3907,14 @@ var ClientStorage = /** @class */ (function () {
3906
3907
  maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
3907
3908
  })))];
3908
3909
  case 2:
3909
- _a.sent();
3910
+ _c.sent();
3910
3911
  this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
3911
3912
  indexed: indexed.getEntries(),
3912
3913
  });
3913
- filtered = indexed.take(total, score);
3914
- return [2 /*return*/, filtered.map(function (_a) {
3915
- var id = _a.id;
3916
- return _this._itemMap.get(id);
3917
- })];
3914
+ if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onSearch) {
3915
+ (_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onSearch(search, indexed, this.params.clientId, this.params.storageName);
3916
+ }
3917
+ return [2 /*return*/, indexed.take(total, score)];
3918
3918
  }
3919
3919
  });
3920
3920
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.60",
3
+ "version": "1.0.61",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as di_scoped from 'di-scoped';
2
2
  import * as functools_kit from 'functools-kit';
3
- import { IPubsubArray, Subject } from 'functools-kit';
3
+ import { IPubsubArray, SortedArray, Subject } from 'functools-kit';
4
4
 
5
5
  /**
6
6
  * Interface representing an incoming message.
@@ -517,6 +517,7 @@ interface IStorageSchema<T extends IStorageData = IStorageData> {
517
517
  }
518
518
  interface IStorageCallbacks<T extends IStorageData = IStorageData> {
519
519
  onUpdate: (items: T[], clientId: string, storageName: StorageName) => void;
520
+ onSearch: (search: string, index: SortedArray<T>, clientId: string, storageName: StorageName) => void;
520
521
  }
521
522
  interface IStorageParams<T extends IStorageData = IStorageData> extends IStorageSchema<T>, Partial<IEmbeddingCallbacks> {
522
523
  clientId: string;