agent-swarm-kit 1.0.166 → 1.0.168

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/README.md CHANGED
@@ -82,7 +82,7 @@ const MOCK_COMPLETION = addCompletion({
82
82
  *
83
83
  * @see https://github.com/tripolskypetr/agent-swarm-kit/tree/master/test
84
84
  */
85
- getCompletion: Adapter.fromOllama(ollama, "tripolskypetr/gemma3-tools:4b"), // "nemotron-mini:4b"
85
+ getCompletion: Adapter.fromOllama(ollama, "nemotron-mini:4b"), // "tripolskypetr/gemma3-tools:4b"
86
86
  });
87
87
 
88
88
  const TRIAGE_AGENT = addAgent({
package/build/index.cjs CHANGED
@@ -1045,7 +1045,10 @@ class PersistSwarmUtils {
1045
1045
  * @returns {IPersistBase<IPersistActiveAgentData>} A persistence instance for active agents.
1046
1046
  * @private
1047
1047
  */
1048
- this.getActiveAgentStorage = functoolsKit.memoize(([swarmName]) => `${swarmName}`, (swarmName) => new this.PersistActiveAgentFactory(swarmName, `./logs/data/_swarm_active_agent/`));
1048
+ this.getActiveAgentStorage = functoolsKit.memoize(([swarmName]) => `${swarmName}`, (swarmName) => Reflect.construct(this.PersistActiveAgentFactory, [
1049
+ swarmName,
1050
+ `./logs/data/_swarm_active_agent/`,
1051
+ ]));
1049
1052
  /**
1050
1053
  * Memoized function to create or retrieve storage for navigation stacks.
1051
1054
  * Ensures a single instance per swarm name.
@@ -1053,7 +1056,10 @@ class PersistSwarmUtils {
1053
1056
  * @returns {IPersistBase<IPersistNavigationStackData>} A persistence instance for navigation stacks.
1054
1057
  * @private
1055
1058
  */
1056
- this.getNavigationStackStorage = functoolsKit.memoize(([swarmName]) => `${swarmName}`, (swarmName) => new this.PersistNavigationStackFactory(swarmName, `./logs/data/_swarm_navigation_stack/`));
1059
+ this.getNavigationStackStorage = functoolsKit.memoize(([swarmName]) => `${swarmName}`, (swarmName) => Reflect.construct(this.PersistNavigationStackFactory, [
1060
+ swarmName,
1061
+ `./logs/data/_swarm_navigation_stack/`,
1062
+ ]));
1057
1063
  /**
1058
1064
  * Retrieves the active agent for a client within a swarm, falling back to a default if not set.
1059
1065
  * @param {string} clientId - The identifier of the client.
@@ -1204,7 +1210,10 @@ class PersistStateUtils {
1204
1210
  * @returns {IPersistBase<IPersistStateData>} A persistence instance for the state.
1205
1211
  * @private
1206
1212
  */
1207
- this.getStateStorage = functoolsKit.memoize(([stateName]) => `${stateName}`, (stateName) => new this.PersistStateFactory(stateName, `./logs/data/state/`));
1213
+ this.getStateStorage = functoolsKit.memoize(([stateName]) => `${stateName}`, (stateName) => Reflect.construct(this.PersistStateFactory, [
1214
+ stateName,
1215
+ `./logs/data/state/`,
1216
+ ]));
1208
1217
  /**
1209
1218
  * Sets the state for a client under a specific state name.
1210
1219
  * Persists the state data wrapped in an IPersistStateData structure.
@@ -1297,7 +1306,10 @@ class PersistStorageUtils {
1297
1306
  * @returns {IPersistBase<IPersistStorageData>} A persistence instance for the storage.
1298
1307
  * @private
1299
1308
  */
1300
- this.getPersistStorage = functoolsKit.memoize(([storageName]) => `${storageName}`, (storageName) => new this.PersistStorageFactory(storageName, `./logs/data/storage/`));
1309
+ this.getPersistStorage = functoolsKit.memoize(([storageName]) => `${storageName}`, (storageName) => Reflect.construct(this.PersistStorageFactory, [
1310
+ storageName,
1311
+ `./logs/data/storage/`,
1312
+ ]));
1301
1313
  /**
1302
1314
  * Retrieves the data for a client from a specific storage, falling back to a default if not set.
1303
1315
  * @template T - The specific type of the storage data, defaults to IStorageData.
@@ -1390,7 +1402,10 @@ class PersistMemoryUtils {
1390
1402
  * @returns {IPersistBase<IPersistMemoryData>} A persistence instance for the memory.
1391
1403
  * @private
1392
1404
  */
1393
- this.getMemoryStorage = functoolsKit.memoize(([clientId]) => `${clientId}`, (clientId) => new this.PersistMemoryFactory(clientId, `./logs/data/memory/`));
1405
+ this.getMemoryStorage = functoolsKit.memoize(([clientId]) => `${clientId}`, (clientId) => Reflect.construct(this.PersistMemoryFactory, [
1406
+ clientId,
1407
+ `./logs/data/memory/`,
1408
+ ]));
1394
1409
  /**
1395
1410
  * Sets the memory data for a client.
1396
1411
  * Persists the data wrapped in an IPersistMemoryData structure.
@@ -1960,11 +1975,20 @@ class HistoryUtils {
1960
1975
  */
1961
1976
  this.getHistory = functoolsKit.memoize(([clientId]) => clientId, (clientId) => {
1962
1977
  if (this.HistoryFactory) {
1963
- return new this.HistoryFactory(clientId, this.HistoryCallbacks);
1978
+ return Reflect.construct(this.HistoryFactory, [
1979
+ clientId,
1980
+ this.HistoryCallbacks,
1981
+ ]);
1964
1982
  }
1965
1983
  return GLOBAL_CONFIG.CC_PERSIST_ENABLED_BY_DEFAULT
1966
- ? new HistoryPersistInstance(clientId, this.HistoryCallbacks)
1967
- : new HistoryMemoryInstance(clientId, this.HistoryCallbacks);
1984
+ ? Reflect.construct(HistoryPersistInstance, [
1985
+ clientId,
1986
+ this.HistoryCallbacks,
1987
+ ])
1988
+ : Reflect.construct(HistoryMemoryInstance, [
1989
+ clientId,
1990
+ this.HistoryCallbacks,
1991
+ ]);
1968
1992
  });
1969
1993
  /**
1970
1994
  * Sets a custom history instance constructor for the adapter.
@@ -2286,7 +2310,7 @@ class LoggerUtils {
2286
2310
  * @returns {ILoggerInstance} The logger instance for the specified client.
2287
2311
  * @private
2288
2312
  */
2289
- this.getLogger = functoolsKit.memoize(([clientId]) => clientId, (clientId) => new this.LoggerFactory(clientId, this.LoggerCallbacks));
2313
+ this.getLogger = functoolsKit.memoize(([clientId]) => clientId, (clientId) => Reflect.construct(this.LoggerFactory, [clientId, this.LoggerCallbacks]));
2290
2314
  /**
2291
2315
  * Sets a common logger adapter for all logging operations via swarm.loggerService.
2292
2316
  * Configures the base LoggerService for centralized logging across the swarm system.
@@ -9066,8 +9090,8 @@ class StateSchemaService {
9066
9090
  if (typeof stateSchema.stateName !== "string") {
9067
9091
  throw new Error(`agent-swarm state schema validation failed: missing stateName`);
9068
9092
  }
9069
- if (typeof stateSchema.getState !== "function") {
9070
- throw new Error(`agent-swarm state schema validation failed: missing getState for stateName=${stateSchema.stateName}`);
9093
+ if (typeof stateSchema.getDefaultState !== "function") {
9094
+ throw new Error(`agent-swarm state schema validation failed: missing getDefaultState for stateName=${stateSchema.stateName}`);
9071
9095
  }
9072
9096
  if (stateSchema.middlewares && !Array.isArray(stateSchema.middlewares)) {
9073
9097
  throw new Error(`agent-swarm state schema validation failed: invalid middlewares for stateName=${stateSchema.stateName} middlewares=${stateSchema.middlewares}`);
package/build/index.mjs CHANGED
@@ -1043,7 +1043,10 @@ class PersistSwarmUtils {
1043
1043
  * @returns {IPersistBase<IPersistActiveAgentData>} A persistence instance for active agents.
1044
1044
  * @private
1045
1045
  */
1046
- this.getActiveAgentStorage = memoize(([swarmName]) => `${swarmName}`, (swarmName) => new this.PersistActiveAgentFactory(swarmName, `./logs/data/_swarm_active_agent/`));
1046
+ this.getActiveAgentStorage = memoize(([swarmName]) => `${swarmName}`, (swarmName) => Reflect.construct(this.PersistActiveAgentFactory, [
1047
+ swarmName,
1048
+ `./logs/data/_swarm_active_agent/`,
1049
+ ]));
1047
1050
  /**
1048
1051
  * Memoized function to create or retrieve storage for navigation stacks.
1049
1052
  * Ensures a single instance per swarm name.
@@ -1051,7 +1054,10 @@ class PersistSwarmUtils {
1051
1054
  * @returns {IPersistBase<IPersistNavigationStackData>} A persistence instance for navigation stacks.
1052
1055
  * @private
1053
1056
  */
1054
- this.getNavigationStackStorage = memoize(([swarmName]) => `${swarmName}`, (swarmName) => new this.PersistNavigationStackFactory(swarmName, `./logs/data/_swarm_navigation_stack/`));
1057
+ this.getNavigationStackStorage = memoize(([swarmName]) => `${swarmName}`, (swarmName) => Reflect.construct(this.PersistNavigationStackFactory, [
1058
+ swarmName,
1059
+ `./logs/data/_swarm_navigation_stack/`,
1060
+ ]));
1055
1061
  /**
1056
1062
  * Retrieves the active agent for a client within a swarm, falling back to a default if not set.
1057
1063
  * @param {string} clientId - The identifier of the client.
@@ -1202,7 +1208,10 @@ class PersistStateUtils {
1202
1208
  * @returns {IPersistBase<IPersistStateData>} A persistence instance for the state.
1203
1209
  * @private
1204
1210
  */
1205
- this.getStateStorage = memoize(([stateName]) => `${stateName}`, (stateName) => new this.PersistStateFactory(stateName, `./logs/data/state/`));
1211
+ this.getStateStorage = memoize(([stateName]) => `${stateName}`, (stateName) => Reflect.construct(this.PersistStateFactory, [
1212
+ stateName,
1213
+ `./logs/data/state/`,
1214
+ ]));
1206
1215
  /**
1207
1216
  * Sets the state for a client under a specific state name.
1208
1217
  * Persists the state data wrapped in an IPersistStateData structure.
@@ -1295,7 +1304,10 @@ class PersistStorageUtils {
1295
1304
  * @returns {IPersistBase<IPersistStorageData>} A persistence instance for the storage.
1296
1305
  * @private
1297
1306
  */
1298
- this.getPersistStorage = memoize(([storageName]) => `${storageName}`, (storageName) => new this.PersistStorageFactory(storageName, `./logs/data/storage/`));
1307
+ this.getPersistStorage = memoize(([storageName]) => `${storageName}`, (storageName) => Reflect.construct(this.PersistStorageFactory, [
1308
+ storageName,
1309
+ `./logs/data/storage/`,
1310
+ ]));
1299
1311
  /**
1300
1312
  * Retrieves the data for a client from a specific storage, falling back to a default if not set.
1301
1313
  * @template T - The specific type of the storage data, defaults to IStorageData.
@@ -1388,7 +1400,10 @@ class PersistMemoryUtils {
1388
1400
  * @returns {IPersistBase<IPersistMemoryData>} A persistence instance for the memory.
1389
1401
  * @private
1390
1402
  */
1391
- this.getMemoryStorage = memoize(([clientId]) => `${clientId}`, (clientId) => new this.PersistMemoryFactory(clientId, `./logs/data/memory/`));
1403
+ this.getMemoryStorage = memoize(([clientId]) => `${clientId}`, (clientId) => Reflect.construct(this.PersistMemoryFactory, [
1404
+ clientId,
1405
+ `./logs/data/memory/`,
1406
+ ]));
1392
1407
  /**
1393
1408
  * Sets the memory data for a client.
1394
1409
  * Persists the data wrapped in an IPersistMemoryData structure.
@@ -1958,11 +1973,20 @@ class HistoryUtils {
1958
1973
  */
1959
1974
  this.getHistory = memoize(([clientId]) => clientId, (clientId) => {
1960
1975
  if (this.HistoryFactory) {
1961
- return new this.HistoryFactory(clientId, this.HistoryCallbacks);
1976
+ return Reflect.construct(this.HistoryFactory, [
1977
+ clientId,
1978
+ this.HistoryCallbacks,
1979
+ ]);
1962
1980
  }
1963
1981
  return GLOBAL_CONFIG.CC_PERSIST_ENABLED_BY_DEFAULT
1964
- ? new HistoryPersistInstance(clientId, this.HistoryCallbacks)
1965
- : new HistoryMemoryInstance(clientId, this.HistoryCallbacks);
1982
+ ? Reflect.construct(HistoryPersistInstance, [
1983
+ clientId,
1984
+ this.HistoryCallbacks,
1985
+ ])
1986
+ : Reflect.construct(HistoryMemoryInstance, [
1987
+ clientId,
1988
+ this.HistoryCallbacks,
1989
+ ]);
1966
1990
  });
1967
1991
  /**
1968
1992
  * Sets a custom history instance constructor for the adapter.
@@ -2284,7 +2308,7 @@ class LoggerUtils {
2284
2308
  * @returns {ILoggerInstance} The logger instance for the specified client.
2285
2309
  * @private
2286
2310
  */
2287
- this.getLogger = memoize(([clientId]) => clientId, (clientId) => new this.LoggerFactory(clientId, this.LoggerCallbacks));
2311
+ this.getLogger = memoize(([clientId]) => clientId, (clientId) => Reflect.construct(this.LoggerFactory, [clientId, this.LoggerCallbacks]));
2288
2312
  /**
2289
2313
  * Sets a common logger adapter for all logging operations via swarm.loggerService.
2290
2314
  * Configures the base LoggerService for centralized logging across the swarm system.
@@ -9064,8 +9088,8 @@ class StateSchemaService {
9064
9088
  if (typeof stateSchema.stateName !== "string") {
9065
9089
  throw new Error(`agent-swarm state schema validation failed: missing stateName`);
9066
9090
  }
9067
- if (typeof stateSchema.getState !== "function") {
9068
- throw new Error(`agent-swarm state schema validation failed: missing getState for stateName=${stateSchema.stateName}`);
9091
+ if (typeof stateSchema.getDefaultState !== "function") {
9092
+ throw new Error(`agent-swarm state schema validation failed: missing getDefaultState for stateName=${stateSchema.stateName}`);
9069
9093
  }
9070
9094
  if (stateSchema.middlewares && !Array.isArray(stateSchema.middlewares)) {
9071
9095
  throw new Error(`agent-swarm state schema validation failed: invalid middlewares for stateName=${stateSchema.stateName} middlewares=${stateSchema.middlewares}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.166",
3
+ "version": "1.0.168",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",