agent-swarm-kit 1.0.53 → 1.0.55

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
@@ -3253,6 +3253,7 @@ var AgentValidationService = /** @class */ (function () {
3253
3253
  }
3254
3254
  _this.storageValidationService.validate(storageName, source);
3255
3255
  });
3256
+ return {};
3256
3257
  });
3257
3258
  }
3258
3259
  return AgentValidationService;
@@ -3297,6 +3298,7 @@ var CompletionValidationService = /** @class */ (function () {
3297
3298
  if (!_this._completionSet.has(completionName)) {
3298
3299
  throw new Error("agent-swarm completion ".concat(completionName, " not found source=").concat(source));
3299
3300
  }
3301
+ return {};
3300
3302
  });
3301
3303
  }
3302
3304
  return CompletionValidationService;
@@ -3502,6 +3504,7 @@ var SessionValidationService = /** @class */ (function () {
3502
3504
  if (!_this._sessionSwarmMap.has(clientId)) {
3503
3505
  throw new Error("agent-swarm session clientId=".concat(clientId, " not exist source=").concat(source));
3504
3506
  }
3507
+ return {};
3505
3508
  };
3506
3509
  /**
3507
3510
  * Removes a session.
@@ -3583,6 +3586,7 @@ var SwarmValidationService = /** @class */ (function () {
3583
3586
  swarm.agentList.forEach(function (agentName) {
3584
3587
  return _this.agentValidationService.validate(agentName, source);
3585
3588
  });
3589
+ return {};
3586
3590
  });
3587
3591
  }
3588
3592
  return SwarmValidationService;
@@ -3629,6 +3633,7 @@ var ToolValidationService = /** @class */ (function () {
3629
3633
  if (!_this._toolMap.has(toolName)) {
3630
3634
  throw new Error("agent-swarm tool ".concat(toolName, " not found source=").concat(source));
3631
3635
  }
3636
+ return {};
3632
3637
  });
3633
3638
  }
3634
3639
  return ToolValidationService;
@@ -3746,57 +3751,64 @@ var ClientStorage = /** @class */ (function () {
3746
3751
  }
3747
3752
  });
3748
3753
  }); });
3749
- this.take = function (search, total) { return __awaiter(_this, void 0, void 0, function () {
3750
- var indexed, searchEmbeddings, filtered;
3751
- var _this = this;
3752
- return __generator(this, function (_a) {
3753
- switch (_a.label) {
3754
- case 0:
3755
- this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take"), {
3756
- search: search,
3757
- total: total,
3758
- });
3759
- indexed = new functoolsKit.SortedArray();
3760
- return [4 /*yield*/, this.params.createEmbedding(search)];
3761
- case 1:
3762
- searchEmbeddings = _a.sent();
3763
- if (this.params.onCreate) {
3764
- this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
3765
- }
3766
- return [4 /*yield*/, Promise.all(Array.from(this._itemMap.values()).map(functoolsKit.execpool(function (item) { return __awaiter(_this, void 0, void 0, function () {
3767
- var _a, targetEmbeddings, index, score;
3768
- return __generator(this, function (_b) {
3769
- switch (_b.label) {
3770
- case 0: return [4 /*yield*/, this._createEmbedding(item)];
3771
- case 1:
3772
- _a = __read.apply(void 0, [_b.sent(), 2]), targetEmbeddings = _a[0], index = _a[1];
3773
- return [4 /*yield*/, this.params.calculateSimilarity(searchEmbeddings, targetEmbeddings)];
3774
- case 2:
3775
- score = _b.sent();
3776
- if (this.params.onCompare) {
3777
- this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
3778
- }
3779
- indexed.push({ id: item.id }, score);
3780
- return [2 /*return*/];
3781
- }
3782
- });
3783
- }); }, {
3784
- delay: 10,
3785
- maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
3786
- })))];
3787
- case 2:
3788
- _a.sent();
3789
- this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
3790
- indexed: indexed.getEntries(),
3791
- });
3792
- filtered = indexed.take(total, GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY);
3793
- return [2 /*return*/, filtered.map(function (_a) {
3794
- var id = _a.id;
3795
- return _this._itemMap.get(id);
3796
- })];
3797
- }
3754
+ this.take = function (search_1, total_1) {
3755
+ var args_1 = [];
3756
+ for (var _i = 2; _i < arguments.length; _i++) {
3757
+ args_1[_i - 2] = arguments[_i];
3758
+ }
3759
+ return __awaiter(_this, __spreadArray([search_1, total_1], __read(args_1), false), void 0, function (search, total, score) {
3760
+ var indexed, searchEmbeddings, filtered;
3761
+ var _this = this;
3762
+ if (score === void 0) { score = GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY; }
3763
+ return __generator(this, function (_a) {
3764
+ switch (_a.label) {
3765
+ case 0:
3766
+ this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take"), {
3767
+ search: search,
3768
+ total: total,
3769
+ });
3770
+ indexed = new functoolsKit.SortedArray();
3771
+ return [4 /*yield*/, this.params.createEmbedding(search)];
3772
+ case 1:
3773
+ searchEmbeddings = _a.sent();
3774
+ if (this.params.onCreate) {
3775
+ this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
3776
+ }
3777
+ return [4 /*yield*/, Promise.all(Array.from(this._itemMap.values()).map(functoolsKit.execpool(function (item) { return __awaiter(_this, void 0, void 0, function () {
3778
+ var _a, targetEmbeddings, index, score;
3779
+ return __generator(this, function (_b) {
3780
+ switch (_b.label) {
3781
+ case 0: return [4 /*yield*/, this._createEmbedding(item)];
3782
+ case 1:
3783
+ _a = __read.apply(void 0, [_b.sent(), 2]), targetEmbeddings = _a[0], index = _a[1];
3784
+ return [4 /*yield*/, this.params.calculateSimilarity(searchEmbeddings, targetEmbeddings)];
3785
+ case 2:
3786
+ score = _b.sent();
3787
+ if (this.params.onCompare) {
3788
+ this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
3789
+ }
3790
+ indexed.push({ id: item.id }, score);
3791
+ return [2 /*return*/];
3792
+ }
3793
+ });
3794
+ }); }, {
3795
+ delay: 10,
3796
+ maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
3797
+ })))];
3798
+ case 2:
3799
+ _a.sent();
3800
+ this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
3801
+ indexed: indexed.getEntries(),
3802
+ });
3803
+ filtered = indexed.take(total, score);
3804
+ return [2 /*return*/, filtered.map(function (_a) {
3805
+ var id = _a.id;
3806
+ return _this._itemMap.get(id);
3807
+ })];
3808
+ }
3809
+ });
3798
3810
  });
3799
- }); };
3811
+ };
3800
3812
  this.upsert = function (item) { return __awaiter(_this, void 0, void 0, function () {
3801
3813
  var _a, _b;
3802
3814
  return __generator(this, function (_c) {
@@ -3913,7 +3925,7 @@ var StorageConnectionService = /** @class */ (function () {
3913
3925
  * @param {number} total - The total number of items to retrieve.
3914
3926
  * @returns {Promise<IStorageData[]>} The list of storage data.
3915
3927
  */
3916
- this.take = function (search, total) { return __awaiter(_this, void 0, void 0, function () {
3928
+ this.take = function (search, total, score) { return __awaiter(_this, void 0, void 0, function () {
3917
3929
  var storage;
3918
3930
  return __generator(this, function (_a) {
3919
3931
  switch (_a.label) {
@@ -3922,12 +3934,13 @@ var StorageConnectionService = /** @class */ (function () {
3922
3934
  context: this.contextService.context,
3923
3935
  search: search,
3924
3936
  total: total,
3937
+ score: score,
3925
3938
  });
3926
3939
  storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
3927
3940
  return [4 /*yield*/, storage.waitForInit()];
3928
3941
  case 1:
3929
3942
  _a.sent();
3930
- return [4 /*yield*/, storage.take(search, total)];
3943
+ return [4 /*yield*/, storage.take(search, total, score)];
3931
3944
  case 2: return [2 /*return*/, _a.sent()];
3932
3945
  }
3933
3946
  });
@@ -4080,7 +4093,7 @@ var StoragePublicService = /** @class */ (function () {
4080
4093
  * @param {number} total - The total number of items to retrieve.
4081
4094
  * @returns {Promise<IStorageData[]>} The list of storage data.
4082
4095
  */
4083
- this.take = function (search, total, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
4096
+ this.take = function (search, total, clientId, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
4084
4097
  var _this = this;
4085
4098
  return __generator(this, function (_a) {
4086
4099
  switch (_a.label) {
@@ -4090,11 +4103,12 @@ var StoragePublicService = /** @class */ (function () {
4090
4103
  total: total,
4091
4104
  clientId: clientId,
4092
4105
  storageName: storageName,
4106
+ score: score,
4093
4107
  });
4094
4108
  return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4095
4109
  return __generator(this, function (_a) {
4096
4110
  switch (_a.label) {
4097
- case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total)];
4111
+ case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total, score)];
4098
4112
  case 1: return [2 /*return*/, _a.sent()];
4099
4113
  }
4100
4114
  });
@@ -4345,6 +4359,7 @@ var StorageValidationService = /** @class */ (function () {
4345
4359
  throw new Error("storage-swarm storage ".concat(storageName, " not found source=").concat(source));
4346
4360
  }
4347
4361
  _this.embeddingValidationService.validate(storage.embedding, source);
4362
+ return {};
4348
4363
  });
4349
4364
  }
4350
4365
  return StorageValidationService;
@@ -4391,6 +4406,7 @@ var EmbeddingValidationService = /** @class */ (function () {
4391
4406
  if (!_this._embeddingMap.has(embeddingName)) {
4392
4407
  throw new Error("agent-swarm embedding ".concat(embeddingName, " not found source=").concat(source));
4393
4408
  }
4409
+ return {};
4394
4410
  });
4395
4411
  }
4396
4412
  return EmbeddingValidationService;
@@ -5756,7 +5772,7 @@ var StorageUtils = /** @class */ (function () {
5756
5772
  * @returns {Promise<T[]>} - A promise that resolves to an array of items.
5757
5773
  * @template T
5758
5774
  */
5759
- this.take = function (search, total, clientId, agentName, storageName) { return __awaiter(_this, void 0, void 0, function () {
5775
+ this.take = function (search, total, clientId, agentName, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
5760
5776
  return __generator(this, function (_a) {
5761
5777
  switch (_a.label) {
5762
5778
  case 0:
@@ -5765,12 +5781,13 @@ var StorageUtils = /** @class */ (function () {
5765
5781
  total: total,
5766
5782
  clientId: clientId,
5767
5783
  storageName: storageName,
5784
+ score: score,
5768
5785
  });
5769
5786
  swarm.storageValidationService.validate(storageName, "StorageStatic");
5770
5787
  if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
5771
5788
  throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (take)"));
5772
5789
  }
5773
- return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName)];
5790
+ return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName, score)];
5774
5791
  case 1: return [2 /*return*/, (_a.sent())];
5775
5792
  }
5776
5793
  });
package/build/index.mjs CHANGED
@@ -3251,6 +3251,7 @@ var AgentValidationService = /** @class */ (function () {
3251
3251
  }
3252
3252
  _this.storageValidationService.validate(storageName, source);
3253
3253
  });
3254
+ return {};
3254
3255
  });
3255
3256
  }
3256
3257
  return AgentValidationService;
@@ -3295,6 +3296,7 @@ var CompletionValidationService = /** @class */ (function () {
3295
3296
  if (!_this._completionSet.has(completionName)) {
3296
3297
  throw new Error("agent-swarm completion ".concat(completionName, " not found source=").concat(source));
3297
3298
  }
3299
+ return {};
3298
3300
  });
3299
3301
  }
3300
3302
  return CompletionValidationService;
@@ -3500,6 +3502,7 @@ var SessionValidationService = /** @class */ (function () {
3500
3502
  if (!_this._sessionSwarmMap.has(clientId)) {
3501
3503
  throw new Error("agent-swarm session clientId=".concat(clientId, " not exist source=").concat(source));
3502
3504
  }
3505
+ return {};
3503
3506
  };
3504
3507
  /**
3505
3508
  * Removes a session.
@@ -3581,6 +3584,7 @@ var SwarmValidationService = /** @class */ (function () {
3581
3584
  swarm.agentList.forEach(function (agentName) {
3582
3585
  return _this.agentValidationService.validate(agentName, source);
3583
3586
  });
3587
+ return {};
3584
3588
  });
3585
3589
  }
3586
3590
  return SwarmValidationService;
@@ -3627,6 +3631,7 @@ var ToolValidationService = /** @class */ (function () {
3627
3631
  if (!_this._toolMap.has(toolName)) {
3628
3632
  throw new Error("agent-swarm tool ".concat(toolName, " not found source=").concat(source));
3629
3633
  }
3634
+ return {};
3630
3635
  });
3631
3636
  }
3632
3637
  return ToolValidationService;
@@ -3744,57 +3749,64 @@ var ClientStorage = /** @class */ (function () {
3744
3749
  }
3745
3750
  });
3746
3751
  }); });
3747
- this.take = function (search, total) { return __awaiter(_this, void 0, void 0, function () {
3748
- var indexed, searchEmbeddings, filtered;
3749
- var _this = this;
3750
- return __generator(this, function (_a) {
3751
- switch (_a.label) {
3752
- case 0:
3753
- this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take"), {
3754
- search: search,
3755
- total: total,
3756
- });
3757
- indexed = new SortedArray();
3758
- return [4 /*yield*/, this.params.createEmbedding(search)];
3759
- case 1:
3760
- searchEmbeddings = _a.sent();
3761
- if (this.params.onCreate) {
3762
- this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
3763
- }
3764
- return [4 /*yield*/, Promise.all(Array.from(this._itemMap.values()).map(execpool(function (item) { return __awaiter(_this, void 0, void 0, function () {
3765
- var _a, targetEmbeddings, index, score;
3766
- return __generator(this, function (_b) {
3767
- switch (_b.label) {
3768
- case 0: return [4 /*yield*/, this._createEmbedding(item)];
3769
- case 1:
3770
- _a = __read.apply(void 0, [_b.sent(), 2]), targetEmbeddings = _a[0], index = _a[1];
3771
- return [4 /*yield*/, this.params.calculateSimilarity(searchEmbeddings, targetEmbeddings)];
3772
- case 2:
3773
- score = _b.sent();
3774
- if (this.params.onCompare) {
3775
- this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
3776
- }
3777
- indexed.push({ id: item.id }, score);
3778
- return [2 /*return*/];
3779
- }
3780
- });
3781
- }); }, {
3782
- delay: 10,
3783
- maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
3784
- })))];
3785
- case 2:
3786
- _a.sent();
3787
- this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
3788
- indexed: indexed.getEntries(),
3789
- });
3790
- filtered = indexed.take(total, GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY);
3791
- return [2 /*return*/, filtered.map(function (_a) {
3792
- var id = _a.id;
3793
- return _this._itemMap.get(id);
3794
- })];
3795
- }
3752
+ this.take = function (search_1, total_1) {
3753
+ var args_1 = [];
3754
+ for (var _i = 2; _i < arguments.length; _i++) {
3755
+ args_1[_i - 2] = arguments[_i];
3756
+ }
3757
+ return __awaiter(_this, __spreadArray([search_1, total_1], __read(args_1), false), void 0, function (search, total, score) {
3758
+ var indexed, searchEmbeddings, filtered;
3759
+ var _this = this;
3760
+ if (score === void 0) { score = GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY; }
3761
+ return __generator(this, function (_a) {
3762
+ switch (_a.label) {
3763
+ case 0:
3764
+ this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take"), {
3765
+ search: search,
3766
+ total: total,
3767
+ });
3768
+ indexed = new SortedArray();
3769
+ return [4 /*yield*/, this.params.createEmbedding(search)];
3770
+ case 1:
3771
+ searchEmbeddings = _a.sent();
3772
+ if (this.params.onCreate) {
3773
+ this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
3774
+ }
3775
+ return [4 /*yield*/, Promise.all(Array.from(this._itemMap.values()).map(execpool(function (item) { return __awaiter(_this, void 0, void 0, function () {
3776
+ var _a, targetEmbeddings, index, score;
3777
+ return __generator(this, function (_b) {
3778
+ switch (_b.label) {
3779
+ case 0: return [4 /*yield*/, this._createEmbedding(item)];
3780
+ case 1:
3781
+ _a = __read.apply(void 0, [_b.sent(), 2]), targetEmbeddings = _a[0], index = _a[1];
3782
+ return [4 /*yield*/, this.params.calculateSimilarity(searchEmbeddings, targetEmbeddings)];
3783
+ case 2:
3784
+ score = _b.sent();
3785
+ if (this.params.onCompare) {
3786
+ this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
3787
+ }
3788
+ indexed.push({ id: item.id }, score);
3789
+ return [2 /*return*/];
3790
+ }
3791
+ });
3792
+ }); }, {
3793
+ delay: 10,
3794
+ maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
3795
+ })))];
3796
+ case 2:
3797
+ _a.sent();
3798
+ this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
3799
+ indexed: indexed.getEntries(),
3800
+ });
3801
+ filtered = indexed.take(total, score);
3802
+ return [2 /*return*/, filtered.map(function (_a) {
3803
+ var id = _a.id;
3804
+ return _this._itemMap.get(id);
3805
+ })];
3806
+ }
3807
+ });
3796
3808
  });
3797
- }); };
3809
+ };
3798
3810
  this.upsert = function (item) { return __awaiter(_this, void 0, void 0, function () {
3799
3811
  var _a, _b;
3800
3812
  return __generator(this, function (_c) {
@@ -3911,7 +3923,7 @@ var StorageConnectionService = /** @class */ (function () {
3911
3923
  * @param {number} total - The total number of items to retrieve.
3912
3924
  * @returns {Promise<IStorageData[]>} The list of storage data.
3913
3925
  */
3914
- this.take = function (search, total) { return __awaiter(_this, void 0, void 0, function () {
3926
+ this.take = function (search, total, score) { return __awaiter(_this, void 0, void 0, function () {
3915
3927
  var storage;
3916
3928
  return __generator(this, function (_a) {
3917
3929
  switch (_a.label) {
@@ -3920,12 +3932,13 @@ var StorageConnectionService = /** @class */ (function () {
3920
3932
  context: this.contextService.context,
3921
3933
  search: search,
3922
3934
  total: total,
3935
+ score: score,
3923
3936
  });
3924
3937
  storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
3925
3938
  return [4 /*yield*/, storage.waitForInit()];
3926
3939
  case 1:
3927
3940
  _a.sent();
3928
- return [4 /*yield*/, storage.take(search, total)];
3941
+ return [4 /*yield*/, storage.take(search, total, score)];
3929
3942
  case 2: return [2 /*return*/, _a.sent()];
3930
3943
  }
3931
3944
  });
@@ -4078,7 +4091,7 @@ var StoragePublicService = /** @class */ (function () {
4078
4091
  * @param {number} total - The total number of items to retrieve.
4079
4092
  * @returns {Promise<IStorageData[]>} The list of storage data.
4080
4093
  */
4081
- this.take = function (search, total, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
4094
+ this.take = function (search, total, clientId, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
4082
4095
  var _this = this;
4083
4096
  return __generator(this, function (_a) {
4084
4097
  switch (_a.label) {
@@ -4088,11 +4101,12 @@ var StoragePublicService = /** @class */ (function () {
4088
4101
  total: total,
4089
4102
  clientId: clientId,
4090
4103
  storageName: storageName,
4104
+ score: score,
4091
4105
  });
4092
4106
  return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4093
4107
  return __generator(this, function (_a) {
4094
4108
  switch (_a.label) {
4095
- case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total)];
4109
+ case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total, score)];
4096
4110
  case 1: return [2 /*return*/, _a.sent()];
4097
4111
  }
4098
4112
  });
@@ -4343,6 +4357,7 @@ var StorageValidationService = /** @class */ (function () {
4343
4357
  throw new Error("storage-swarm storage ".concat(storageName, " not found source=").concat(source));
4344
4358
  }
4345
4359
  _this.embeddingValidationService.validate(storage.embedding, source);
4360
+ return {};
4346
4361
  });
4347
4362
  }
4348
4363
  return StorageValidationService;
@@ -4389,6 +4404,7 @@ var EmbeddingValidationService = /** @class */ (function () {
4389
4404
  if (!_this._embeddingMap.has(embeddingName)) {
4390
4405
  throw new Error("agent-swarm embedding ".concat(embeddingName, " not found source=").concat(source));
4391
4406
  }
4407
+ return {};
4392
4408
  });
4393
4409
  }
4394
4410
  return EmbeddingValidationService;
@@ -5754,7 +5770,7 @@ var StorageUtils = /** @class */ (function () {
5754
5770
  * @returns {Promise<T[]>} - A promise that resolves to an array of items.
5755
5771
  * @template T
5756
5772
  */
5757
- this.take = function (search, total, clientId, agentName, storageName) { return __awaiter(_this, void 0, void 0, function () {
5773
+ this.take = function (search, total, clientId, agentName, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
5758
5774
  return __generator(this, function (_a) {
5759
5775
  switch (_a.label) {
5760
5776
  case 0:
@@ -5763,12 +5779,13 @@ var StorageUtils = /** @class */ (function () {
5763
5779
  total: total,
5764
5780
  clientId: clientId,
5765
5781
  storageName: storageName,
5782
+ score: score,
5766
5783
  });
5767
5784
  swarm.storageValidationService.validate(storageName, "StorageStatic");
5768
5785
  if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
5769
5786
  throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (take)"));
5770
5787
  }
5771
- return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName)];
5788
+ return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName, score)];
5772
5789
  case 1: return [2 /*return*/, (_a.sent())];
5773
5790
  }
5774
5791
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
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
@@ -510,7 +510,7 @@ interface IStorageData {
510
510
  }
511
511
  interface IStorageSchema<T extends IStorageData = IStorageData> {
512
512
  getData?: (clientId: string, storageName: StorageName) => Promise<T[]> | T[];
513
- createIndex(item: T): Promise<string>;
513
+ createIndex(item: T): Promise<string> | string;
514
514
  embedding: EmbeddingName;
515
515
  storageName: StorageName;
516
516
  callbacks?: Partial<IStorageCallbacks<T>>;
@@ -526,7 +526,7 @@ interface IStorageParams<T extends IStorageData = IStorageData> extends IStorage
526
526
  logger: ILogger;
527
527
  }
528
528
  interface IStorage<T extends IStorageData = IStorageData> {
529
- take(search: string, total: number): Promise<T[]>;
529
+ take(search: string, total: number, score?: number): Promise<T[]>;
530
530
  upsert(item: T): Promise<void>;
531
531
  remove(itemId: IStorageData["id"]): Promise<void>;
532
532
  get(itemId: IStorageData["id"]): Promise<T | null>;
@@ -1861,7 +1861,7 @@ declare class ClientStorage<T extends IStorageData = IStorageData> implements IS
1861
1861
  constructor(params: IStorageParams<T>);
1862
1862
  _createEmbedding: ((item: T) => Promise<readonly [Embeddings, string]>) & functools_kit.IClearableMemoize<string | number> & functools_kit.IControlMemoize<string | number, Promise<readonly [Embeddings, string]>>;
1863
1863
  waitForInit: (() => Promise<void>) & functools_kit.ISingleshotClearable;
1864
- take: (search: string, total: number) => Promise<T[]>;
1864
+ take: (search: string, total: number, score?: number) => Promise<T[]>;
1865
1865
  upsert: (item: T) => Promise<void>;
1866
1866
  remove: (itemId: IStorageData["id"]) => Promise<void>;
1867
1867
  clear: () => Promise<void>;
@@ -1891,7 +1891,7 @@ declare class StorageConnectionService implements IStorage {
1891
1891
  * @param {number} total - The total number of items to retrieve.
1892
1892
  * @returns {Promise<IStorageData[]>} The list of storage data.
1893
1893
  */
1894
- take: (search: string, total: number) => Promise<IStorageData[]>;
1894
+ take: (search: string, total: number, score?: number) => Promise<IStorageData[]>;
1895
1895
  /**
1896
1896
  * Upserts an item in the storage.
1897
1897
  * @param {IStorageData} item - The item to upsert.
@@ -1948,7 +1948,7 @@ declare class StoragePublicService implements TStorageConnectionService {
1948
1948
  * @param {number} total - The total number of items to retrieve.
1949
1949
  * @returns {Promise<IStorageData[]>} The list of storage data.
1950
1950
  */
1951
- take: (search: string, total: number, clientId: string, storageName: StorageName) => Promise<IStorageData[]>;
1951
+ take: (search: string, total: number, clientId: string, storageName: StorageName, score?: number) => Promise<IStorageData[]>;
1952
1952
  /**
1953
1953
  * Upserts an item in the storage.
1954
1954
  * @param {IStorageData} item - The item to upsert.
@@ -2497,7 +2497,7 @@ declare class StorageUtils implements TStorage {
2497
2497
  * @returns {Promise<T[]>} - A promise that resolves to an array of items.
2498
2498
  * @template T
2499
2499
  */
2500
- take: <T extends IStorageData = IStorageData>(search: string, total: number, clientId: string, agentName: AgentName, storageName: StorageName) => Promise<T[]>;
2500
+ take: <T extends IStorageData = IStorageData>(search: string, total: number, clientId: string, agentName: AgentName, storageName: StorageName, score?: number) => Promise<T[]>;
2501
2501
  /**
2502
2502
  * Upserts an item in the storage.
2503
2503
  * @param {T} item - The item to upsert.