agent-swarm-kit 1.0.52 → 1.0.54
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 +66 -68
- package/build/index.mjs +67 -69
- package/package.json +1 -1
- package/types.d.ts +6 -6
package/build/index.cjs
CHANGED
|
@@ -3746,69 +3746,64 @@ var ClientStorage = /** @class */ (function () {
|
|
|
3746
3746
|
}
|
|
3747
3747
|
});
|
|
3748
3748
|
}); });
|
|
3749
|
-
this.take = function (
|
|
3750
|
-
var
|
|
3751
|
-
var
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
.
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
return [2 /*return*/, filtered.map(function (_a) {
|
|
3806
|
-
var data = _a.data;
|
|
3807
|
-
return data;
|
|
3808
|
-
})];
|
|
3809
|
-
}
|
|
3749
|
+
this.take = function (search_1, total_1) {
|
|
3750
|
+
var args_1 = [];
|
|
3751
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
3752
|
+
args_1[_i - 2] = arguments[_i];
|
|
3753
|
+
}
|
|
3754
|
+
return __awaiter(_this, __spreadArray([search_1, total_1], __read(args_1), false), void 0, function (search, total, score) {
|
|
3755
|
+
var indexed, searchEmbeddings, filtered;
|
|
3756
|
+
var _this = this;
|
|
3757
|
+
if (score === void 0) { score = GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY; }
|
|
3758
|
+
return __generator(this, function (_a) {
|
|
3759
|
+
switch (_a.label) {
|
|
3760
|
+
case 0:
|
|
3761
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take"), {
|
|
3762
|
+
search: search,
|
|
3763
|
+
total: total,
|
|
3764
|
+
});
|
|
3765
|
+
indexed = new functoolsKit.SortedArray();
|
|
3766
|
+
return [4 /*yield*/, this.params.createEmbedding(search)];
|
|
3767
|
+
case 1:
|
|
3768
|
+
searchEmbeddings = _a.sent();
|
|
3769
|
+
if (this.params.onCreate) {
|
|
3770
|
+
this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
|
|
3771
|
+
}
|
|
3772
|
+
return [4 /*yield*/, Promise.all(Array.from(this._itemMap.values()).map(functoolsKit.execpool(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
3773
|
+
var _a, targetEmbeddings, index, score;
|
|
3774
|
+
return __generator(this, function (_b) {
|
|
3775
|
+
switch (_b.label) {
|
|
3776
|
+
case 0: return [4 /*yield*/, this._createEmbedding(item)];
|
|
3777
|
+
case 1:
|
|
3778
|
+
_a = __read.apply(void 0, [_b.sent(), 2]), targetEmbeddings = _a[0], index = _a[1];
|
|
3779
|
+
return [4 /*yield*/, this.params.calculateSimilarity(searchEmbeddings, targetEmbeddings)];
|
|
3780
|
+
case 2:
|
|
3781
|
+
score = _b.sent();
|
|
3782
|
+
if (this.params.onCompare) {
|
|
3783
|
+
this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
|
|
3784
|
+
}
|
|
3785
|
+
indexed.push({ id: item.id }, score);
|
|
3786
|
+
return [2 /*return*/];
|
|
3787
|
+
}
|
|
3788
|
+
});
|
|
3789
|
+
}); }, {
|
|
3790
|
+
delay: 10,
|
|
3791
|
+
maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
|
|
3792
|
+
})))];
|
|
3793
|
+
case 2:
|
|
3794
|
+
_a.sent();
|
|
3795
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
|
|
3796
|
+
indexed: indexed.getEntries(),
|
|
3797
|
+
});
|
|
3798
|
+
filtered = indexed.take(total, score);
|
|
3799
|
+
return [2 /*return*/, filtered.map(function (_a) {
|
|
3800
|
+
var id = _a.id;
|
|
3801
|
+
return _this._itemMap.get(id);
|
|
3802
|
+
})];
|
|
3803
|
+
}
|
|
3804
|
+
});
|
|
3810
3805
|
});
|
|
3811
|
-
}
|
|
3806
|
+
};
|
|
3812
3807
|
this.upsert = function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
3813
3808
|
var _a, _b;
|
|
3814
3809
|
return __generator(this, function (_c) {
|
|
@@ -3925,7 +3920,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
3925
3920
|
* @param {number} total - The total number of items to retrieve.
|
|
3926
3921
|
* @returns {Promise<IStorageData[]>} The list of storage data.
|
|
3927
3922
|
*/
|
|
3928
|
-
this.take = function (search, total) { return __awaiter(_this, void 0, void 0, function () {
|
|
3923
|
+
this.take = function (search, total, score) { return __awaiter(_this, void 0, void 0, function () {
|
|
3929
3924
|
var storage;
|
|
3930
3925
|
return __generator(this, function (_a) {
|
|
3931
3926
|
switch (_a.label) {
|
|
@@ -3934,12 +3929,13 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
3934
3929
|
context: this.contextService.context,
|
|
3935
3930
|
search: search,
|
|
3936
3931
|
total: total,
|
|
3932
|
+
score: score,
|
|
3937
3933
|
});
|
|
3938
3934
|
storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
|
|
3939
3935
|
return [4 /*yield*/, storage.waitForInit()];
|
|
3940
3936
|
case 1:
|
|
3941
3937
|
_a.sent();
|
|
3942
|
-
return [4 /*yield*/, storage.take(search, total)];
|
|
3938
|
+
return [4 /*yield*/, storage.take(search, total, score)];
|
|
3943
3939
|
case 2: return [2 /*return*/, _a.sent()];
|
|
3944
3940
|
}
|
|
3945
3941
|
});
|
|
@@ -4092,7 +4088,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
4092
4088
|
* @param {number} total - The total number of items to retrieve.
|
|
4093
4089
|
* @returns {Promise<IStorageData[]>} The list of storage data.
|
|
4094
4090
|
*/
|
|
4095
|
-
this.take = function (search, total, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
4091
|
+
this.take = function (search, total, clientId, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
|
|
4096
4092
|
var _this = this;
|
|
4097
4093
|
return __generator(this, function (_a) {
|
|
4098
4094
|
switch (_a.label) {
|
|
@@ -4102,11 +4098,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
4102
4098
|
total: total,
|
|
4103
4099
|
clientId: clientId,
|
|
4104
4100
|
storageName: storageName,
|
|
4101
|
+
score: score,
|
|
4105
4102
|
});
|
|
4106
4103
|
return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4107
4104
|
return __generator(this, function (_a) {
|
|
4108
4105
|
switch (_a.label) {
|
|
4109
|
-
case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total)];
|
|
4106
|
+
case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total, score)];
|
|
4110
4107
|
case 1: return [2 /*return*/, _a.sent()];
|
|
4111
4108
|
}
|
|
4112
4109
|
});
|
|
@@ -5768,7 +5765,7 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5768
5765
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
5769
5766
|
* @template T
|
|
5770
5767
|
*/
|
|
5771
|
-
this.take = function (search, total, clientId, agentName, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5768
|
+
this.take = function (search, total, clientId, agentName, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
|
|
5772
5769
|
return __generator(this, function (_a) {
|
|
5773
5770
|
switch (_a.label) {
|
|
5774
5771
|
case 0:
|
|
@@ -5777,12 +5774,13 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5777
5774
|
total: total,
|
|
5778
5775
|
clientId: clientId,
|
|
5779
5776
|
storageName: storageName,
|
|
5777
|
+
score: score,
|
|
5780
5778
|
});
|
|
5781
5779
|
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
5782
5780
|
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
5783
5781
|
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (take)"));
|
|
5784
5782
|
}
|
|
5785
|
-
return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName)];
|
|
5783
|
+
return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName, score)];
|
|
5786
5784
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
5787
5785
|
}
|
|
5788
5786
|
});
|
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';
|
|
@@ -3744,69 +3744,64 @@ var ClientStorage = /** @class */ (function () {
|
|
|
3744
3744
|
}
|
|
3745
3745
|
});
|
|
3746
3746
|
}); });
|
|
3747
|
-
this.take = function (
|
|
3748
|
-
var
|
|
3749
|
-
var
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
.
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
return [2 /*return*/, filtered.map(function (_a) {
|
|
3804
|
-
var data = _a.data;
|
|
3805
|
-
return data;
|
|
3806
|
-
})];
|
|
3807
|
-
}
|
|
3747
|
+
this.take = function (search_1, total_1) {
|
|
3748
|
+
var args_1 = [];
|
|
3749
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
3750
|
+
args_1[_i - 2] = arguments[_i];
|
|
3751
|
+
}
|
|
3752
|
+
return __awaiter(_this, __spreadArray([search_1, total_1], __read(args_1), false), void 0, function (search, total, score) {
|
|
3753
|
+
var indexed, searchEmbeddings, filtered;
|
|
3754
|
+
var _this = this;
|
|
3755
|
+
if (score === void 0) { score = GLOBAL_CONFIG.CC_STORAGE_SEARCH_SIMILARITY; }
|
|
3756
|
+
return __generator(this, function (_a) {
|
|
3757
|
+
switch (_a.label) {
|
|
3758
|
+
case 0:
|
|
3759
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take"), {
|
|
3760
|
+
search: search,
|
|
3761
|
+
total: total,
|
|
3762
|
+
});
|
|
3763
|
+
indexed = new SortedArray();
|
|
3764
|
+
return [4 /*yield*/, this.params.createEmbedding(search)];
|
|
3765
|
+
case 1:
|
|
3766
|
+
searchEmbeddings = _a.sent();
|
|
3767
|
+
if (this.params.onCreate) {
|
|
3768
|
+
this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
|
|
3769
|
+
}
|
|
3770
|
+
return [4 /*yield*/, Promise.all(Array.from(this._itemMap.values()).map(execpool(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
3771
|
+
var _a, targetEmbeddings, index, score;
|
|
3772
|
+
return __generator(this, function (_b) {
|
|
3773
|
+
switch (_b.label) {
|
|
3774
|
+
case 0: return [4 /*yield*/, this._createEmbedding(item)];
|
|
3775
|
+
case 1:
|
|
3776
|
+
_a = __read.apply(void 0, [_b.sent(), 2]), targetEmbeddings = _a[0], index = _a[1];
|
|
3777
|
+
return [4 /*yield*/, this.params.calculateSimilarity(searchEmbeddings, targetEmbeddings)];
|
|
3778
|
+
case 2:
|
|
3779
|
+
score = _b.sent();
|
|
3780
|
+
if (this.params.onCompare) {
|
|
3781
|
+
this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
|
|
3782
|
+
}
|
|
3783
|
+
indexed.push({ id: item.id }, score);
|
|
3784
|
+
return [2 /*return*/];
|
|
3785
|
+
}
|
|
3786
|
+
});
|
|
3787
|
+
}); }, {
|
|
3788
|
+
delay: 10,
|
|
3789
|
+
maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
|
|
3790
|
+
})))];
|
|
3791
|
+
case 2:
|
|
3792
|
+
_a.sent();
|
|
3793
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " take indexed"), {
|
|
3794
|
+
indexed: indexed.getEntries(),
|
|
3795
|
+
});
|
|
3796
|
+
filtered = indexed.take(total, score);
|
|
3797
|
+
return [2 /*return*/, filtered.map(function (_a) {
|
|
3798
|
+
var id = _a.id;
|
|
3799
|
+
return _this._itemMap.get(id);
|
|
3800
|
+
})];
|
|
3801
|
+
}
|
|
3802
|
+
});
|
|
3808
3803
|
});
|
|
3809
|
-
}
|
|
3804
|
+
};
|
|
3810
3805
|
this.upsert = function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
3811
3806
|
var _a, _b;
|
|
3812
3807
|
return __generator(this, function (_c) {
|
|
@@ -3923,7 +3918,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
3923
3918
|
* @param {number} total - The total number of items to retrieve.
|
|
3924
3919
|
* @returns {Promise<IStorageData[]>} The list of storage data.
|
|
3925
3920
|
*/
|
|
3926
|
-
this.take = function (search, total) { return __awaiter(_this, void 0, void 0, function () {
|
|
3921
|
+
this.take = function (search, total, score) { return __awaiter(_this, void 0, void 0, function () {
|
|
3927
3922
|
var storage;
|
|
3928
3923
|
return __generator(this, function (_a) {
|
|
3929
3924
|
switch (_a.label) {
|
|
@@ -3932,12 +3927,13 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
3932
3927
|
context: this.contextService.context,
|
|
3933
3928
|
search: search,
|
|
3934
3929
|
total: total,
|
|
3930
|
+
score: score,
|
|
3935
3931
|
});
|
|
3936
3932
|
storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
|
|
3937
3933
|
return [4 /*yield*/, storage.waitForInit()];
|
|
3938
3934
|
case 1:
|
|
3939
3935
|
_a.sent();
|
|
3940
|
-
return [4 /*yield*/, storage.take(search, total)];
|
|
3936
|
+
return [4 /*yield*/, storage.take(search, total, score)];
|
|
3941
3937
|
case 2: return [2 /*return*/, _a.sent()];
|
|
3942
3938
|
}
|
|
3943
3939
|
});
|
|
@@ -4090,7 +4086,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
4090
4086
|
* @param {number} total - The total number of items to retrieve.
|
|
4091
4087
|
* @returns {Promise<IStorageData[]>} The list of storage data.
|
|
4092
4088
|
*/
|
|
4093
|
-
this.take = function (search, total, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
4089
|
+
this.take = function (search, total, clientId, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
|
|
4094
4090
|
var _this = this;
|
|
4095
4091
|
return __generator(this, function (_a) {
|
|
4096
4092
|
switch (_a.label) {
|
|
@@ -4100,11 +4096,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
4100
4096
|
total: total,
|
|
4101
4097
|
clientId: clientId,
|
|
4102
4098
|
storageName: storageName,
|
|
4099
|
+
score: score,
|
|
4103
4100
|
});
|
|
4104
4101
|
return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4105
4102
|
return __generator(this, function (_a) {
|
|
4106
4103
|
switch (_a.label) {
|
|
4107
|
-
case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total)];
|
|
4104
|
+
case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total, score)];
|
|
4108
4105
|
case 1: return [2 /*return*/, _a.sent()];
|
|
4109
4106
|
}
|
|
4110
4107
|
});
|
|
@@ -5766,7 +5763,7 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5766
5763
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
5767
5764
|
* @template T
|
|
5768
5765
|
*/
|
|
5769
|
-
this.take = function (search, total, clientId, agentName, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5766
|
+
this.take = function (search, total, clientId, agentName, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
|
|
5770
5767
|
return __generator(this, function (_a) {
|
|
5771
5768
|
switch (_a.label) {
|
|
5772
5769
|
case 0:
|
|
@@ -5775,12 +5772,13 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5775
5772
|
total: total,
|
|
5776
5773
|
clientId: clientId,
|
|
5777
5774
|
storageName: storageName,
|
|
5775
|
+
score: score,
|
|
5778
5776
|
});
|
|
5779
5777
|
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
5780
5778
|
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
5781
5779
|
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (take)"));
|
|
5782
5780
|
}
|
|
5783
|
-
return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName)];
|
|
5781
|
+
return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName, score)];
|
|
5784
5782
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
5785
5783
|
}
|
|
5786
5784
|
});
|
package/package.json
CHANGED
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.
|