agent-swarm-kit 1.0.22 → 1.0.24
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 +13 -13
- package/build/index.mjs +13 -13
- package/package.json +1 -1
- package/types.d.ts +6 -2
package/build/index.cjs
CHANGED
|
@@ -4199,18 +4199,15 @@ var DEFAULT_TIMEOUT = 15 * 60;
|
|
|
4199
4199
|
* @returns {Object} An object with tick and stop methods to control the auto-dispose.
|
|
4200
4200
|
*/
|
|
4201
4201
|
var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
4202
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c;
|
|
4203
|
-
var
|
|
4204
|
-
var unSource = functoolsKit.Source.
|
|
4205
|
-
|
|
4206
|
-
functoolsKit.Source.fromInterval(1000),
|
|
4207
|
-
])
|
|
4208
|
-
.reduce(function (acm, _a) {
|
|
4209
|
-
var _b = __read(_a, 1), isOk = _b[0];
|
|
4202
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c, onDestroy = _b.onDestroy;
|
|
4203
|
+
var isOk = true;
|
|
4204
|
+
var unSource = functoolsKit.Source.fromInterval(1000)
|
|
4205
|
+
.reduce(function (acm) {
|
|
4210
4206
|
if (isOk) {
|
|
4211
|
-
|
|
4207
|
+
isOk = false;
|
|
4208
|
+
return 0;
|
|
4212
4209
|
}
|
|
4213
|
-
return
|
|
4210
|
+
return acm + 1;
|
|
4214
4211
|
}, 0)
|
|
4215
4212
|
.filter(function (ticker) { return ticker >= timeoutSeconds; })
|
|
4216
4213
|
.once(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4223,7 +4220,9 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
|
4223
4220
|
case 1:
|
|
4224
4221
|
_a.sent();
|
|
4225
4222
|
_a.label = 2;
|
|
4226
|
-
case 2:
|
|
4223
|
+
case 2:
|
|
4224
|
+
onDestroy && onDestroy(clientId, swarmName);
|
|
4225
|
+
return [2 /*return*/];
|
|
4227
4226
|
}
|
|
4228
4227
|
});
|
|
4229
4228
|
}); });
|
|
@@ -4232,13 +4231,14 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
|
4232
4231
|
* Signals that the client is active, resetting the auto-dispose timer.
|
|
4233
4232
|
*/
|
|
4234
4233
|
tick: function () {
|
|
4235
|
-
|
|
4234
|
+
isOk = true;
|
|
4236
4235
|
},
|
|
4237
4236
|
/**
|
|
4238
4237
|
* Stops the auto-dispose mechanism.
|
|
4239
4238
|
*/
|
|
4240
|
-
|
|
4239
|
+
destroy: function () {
|
|
4241
4240
|
unSource();
|
|
4241
|
+
onDestroy && onDestroy(clientId, swarmName);
|
|
4242
4242
|
},
|
|
4243
4243
|
};
|
|
4244
4244
|
};
|
package/build/index.mjs
CHANGED
|
@@ -4197,18 +4197,15 @@ var DEFAULT_TIMEOUT = 15 * 60;
|
|
|
4197
4197
|
* @returns {Object} An object with tick and stop methods to control the auto-dispose.
|
|
4198
4198
|
*/
|
|
4199
4199
|
var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
4200
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c;
|
|
4201
|
-
var
|
|
4202
|
-
var unSource = Source.
|
|
4203
|
-
|
|
4204
|
-
Source.fromInterval(1000),
|
|
4205
|
-
])
|
|
4206
|
-
.reduce(function (acm, _a) {
|
|
4207
|
-
var _b = __read(_a, 1), isOk = _b[0];
|
|
4200
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c, onDestroy = _b.onDestroy;
|
|
4201
|
+
var isOk = true;
|
|
4202
|
+
var unSource = Source.fromInterval(1000)
|
|
4203
|
+
.reduce(function (acm) {
|
|
4208
4204
|
if (isOk) {
|
|
4209
|
-
|
|
4205
|
+
isOk = false;
|
|
4206
|
+
return 0;
|
|
4210
4207
|
}
|
|
4211
|
-
return
|
|
4208
|
+
return acm + 1;
|
|
4212
4209
|
}, 0)
|
|
4213
4210
|
.filter(function (ticker) { return ticker >= timeoutSeconds; })
|
|
4214
4211
|
.once(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4221,7 +4218,9 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
|
4221
4218
|
case 1:
|
|
4222
4219
|
_a.sent();
|
|
4223
4220
|
_a.label = 2;
|
|
4224
|
-
case 2:
|
|
4221
|
+
case 2:
|
|
4222
|
+
onDestroy && onDestroy(clientId, swarmName);
|
|
4223
|
+
return [2 /*return*/];
|
|
4225
4224
|
}
|
|
4226
4225
|
});
|
|
4227
4226
|
}); });
|
|
@@ -4230,13 +4229,14 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
|
4230
4229
|
* Signals that the client is active, resetting the auto-dispose timer.
|
|
4231
4230
|
*/
|
|
4232
4231
|
tick: function () {
|
|
4233
|
-
|
|
4232
|
+
isOk = true;
|
|
4234
4233
|
},
|
|
4235
4234
|
/**
|
|
4236
4235
|
* Stops the auto-dispose mechanism.
|
|
4237
4236
|
*/
|
|
4238
|
-
|
|
4237
|
+
destroy: function () {
|
|
4239
4238
|
unSource();
|
|
4239
|
+
onDestroy && onDestroy(clientId, swarmName);
|
|
4240
4240
|
},
|
|
4241
4241
|
};
|
|
4242
4242
|
};
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1774,6 +1774,10 @@ interface IMakeDisposeParams {
|
|
|
1774
1774
|
* Timeout in seconds before auto-dispose is triggered.
|
|
1775
1775
|
*/
|
|
1776
1776
|
timeoutSeconds: number;
|
|
1777
|
+
/**
|
|
1778
|
+
* Callback when session is closed
|
|
1779
|
+
*/
|
|
1780
|
+
onDestroy?: (clientId: string, swarmName: SwarmName) => void;
|
|
1777
1781
|
}
|
|
1778
1782
|
/**
|
|
1779
1783
|
* Creates an auto-dispose mechanism for a client in a swarm.
|
|
@@ -1783,7 +1787,7 @@ interface IMakeDisposeParams {
|
|
|
1783
1787
|
* @param {Partial<IMakeDisposeParams>} [params={}] - Optional parameters for auto-dispose.
|
|
1784
1788
|
* @returns {Object} An object with tick and stop methods to control the auto-dispose.
|
|
1785
1789
|
*/
|
|
1786
|
-
declare const makeAutoDispose: (clientId: string, swarmName: SwarmName, { timeoutSeconds }?: Partial<IMakeDisposeParams>) => {
|
|
1790
|
+
declare const makeAutoDispose: (clientId: string, swarmName: SwarmName, { timeoutSeconds, onDestroy }?: Partial<IMakeDisposeParams>) => {
|
|
1787
1791
|
/**
|
|
1788
1792
|
* Signals that the client is active, resetting the auto-dispose timer.
|
|
1789
1793
|
*/
|
|
@@ -1791,7 +1795,7 @@ declare const makeAutoDispose: (clientId: string, swarmName: SwarmName, { timeou
|
|
|
1791
1795
|
/**
|
|
1792
1796
|
* Stops the auto-dispose mechanism.
|
|
1793
1797
|
*/
|
|
1794
|
-
|
|
1798
|
+
destroy(): void;
|
|
1795
1799
|
};
|
|
1796
1800
|
|
|
1797
1801
|
declare const GLOBAL_CONFIG: {
|