agent-swarm-kit 1.0.194 → 1.0.195
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 +10 -1
- package/build/index.mjs +10 -1
- package/package.json +1 -1
- package/types.d.ts +10 -1
package/build/index.cjs
CHANGED
|
@@ -16637,7 +16637,17 @@ const METHOD_NAME_CREATE = "RoundRobin.create";
|
|
|
16637
16637
|
*/
|
|
16638
16638
|
class RoundRobin {
|
|
16639
16639
|
constructor(tokens, factory) {
|
|
16640
|
+
this.tokens = tokens;
|
|
16640
16641
|
this.currentIndex = 0;
|
|
16642
|
+
/**
|
|
16643
|
+
* Cycles through the tokens and invokes the corresponding instance creator with the provided arguments.
|
|
16644
|
+
* Logs the current index and token count if logging is enabled.
|
|
16645
|
+
*
|
|
16646
|
+
* @private
|
|
16647
|
+
* @param {...A} args - The arguments to pass to the instance creator.
|
|
16648
|
+
* @returns {T} The result of invoking the instance creator for the current token.
|
|
16649
|
+
* @throws {Error} If the tokens array is empty.
|
|
16650
|
+
*/
|
|
16641
16651
|
this.call = (...args) => {
|
|
16642
16652
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
16643
16653
|
swarm$1.loggerService.log(METHOD_NAME_CALL, {
|
|
@@ -16653,7 +16663,6 @@ class RoundRobin {
|
|
|
16653
16663
|
this.currentIndex = (this.currentIndex + 1) % this.tokens.length;
|
|
16654
16664
|
return value;
|
|
16655
16665
|
};
|
|
16656
|
-
this.tokens = tokens;
|
|
16657
16666
|
this.instances = new Map(tokens.map((token) => [token, factory(token)]));
|
|
16658
16667
|
}
|
|
16659
16668
|
/**
|
package/build/index.mjs
CHANGED
|
@@ -16635,7 +16635,17 @@ const METHOD_NAME_CREATE = "RoundRobin.create";
|
|
|
16635
16635
|
*/
|
|
16636
16636
|
class RoundRobin {
|
|
16637
16637
|
constructor(tokens, factory) {
|
|
16638
|
+
this.tokens = tokens;
|
|
16638
16639
|
this.currentIndex = 0;
|
|
16640
|
+
/**
|
|
16641
|
+
* Cycles through the tokens and invokes the corresponding instance creator with the provided arguments.
|
|
16642
|
+
* Logs the current index and token count if logging is enabled.
|
|
16643
|
+
*
|
|
16644
|
+
* @private
|
|
16645
|
+
* @param {...A} args - The arguments to pass to the instance creator.
|
|
16646
|
+
* @returns {T} The result of invoking the instance creator for the current token.
|
|
16647
|
+
* @throws {Error} If the tokens array is empty.
|
|
16648
|
+
*/
|
|
16639
16649
|
this.call = (...args) => {
|
|
16640
16650
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
16641
16651
|
swarm$1.loggerService.log(METHOD_NAME_CALL, {
|
|
@@ -16651,7 +16661,6 @@ class RoundRobin {
|
|
|
16651
16661
|
this.currentIndex = (this.currentIndex + 1) % this.tokens.length;
|
|
16652
16662
|
return value;
|
|
16653
16663
|
};
|
|
16654
|
-
this.tokens = tokens;
|
|
16655
16664
|
this.instances = new Map(tokens.map((token) => [token, factory(token)]));
|
|
16656
16665
|
}
|
|
16657
16666
|
/**
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -10265,7 +10265,7 @@ declare const setConfig: (config: Partial<IGlobalConfig>) => void;
|
|
|
10265
10265
|
declare class RoundRobin<T, Token = string | symbol | {
|
|
10266
10266
|
[key: string]: any;
|
|
10267
10267
|
}, A extends any[] = any[]> {
|
|
10268
|
-
|
|
10268
|
+
readonly tokens: Token[];
|
|
10269
10269
|
private instances;
|
|
10270
10270
|
private currentIndex;
|
|
10271
10271
|
private constructor();
|
|
@@ -10277,6 +10277,15 @@ declare class RoundRobin<T, Token = string | symbol | {
|
|
|
10277
10277
|
static create<T, Token = string | symbol | {
|
|
10278
10278
|
[key: string]: any;
|
|
10279
10279
|
}, A extends any[] = any[]>(tokens: Token[], factory: (token: Token) => (...args: A) => T): (...args: A) => T;
|
|
10280
|
+
/**
|
|
10281
|
+
* Cycles through the tokens and invokes the corresponding instance creator with the provided arguments.
|
|
10282
|
+
* Logs the current index and token count if logging is enabled.
|
|
10283
|
+
*
|
|
10284
|
+
* @private
|
|
10285
|
+
* @param {...A} args - The arguments to pass to the instance creator.
|
|
10286
|
+
* @returns {T} The result of invoking the instance creator for the current token.
|
|
10287
|
+
* @throws {Error} If the tokens array is empty.
|
|
10288
|
+
*/
|
|
10280
10289
|
private call;
|
|
10281
10290
|
}
|
|
10282
10291
|
|