agent-swarm-kit 1.0.87 → 1.0.89

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
@@ -7217,6 +7217,7 @@ var BusService = /** @class */ (function () {
7217
7217
  var MAX_NESTING = 10;
7218
7218
  var UML_STEP = "\t";
7219
7219
  var UML_BULLET = "•";
7220
+ var UML_TRIANGLE = "►";
7220
7221
  /**
7221
7222
  * Creates a function to serialize meta nodes to UML format.
7222
7223
  * @returns {Function} A function that takes an array of IMetaNode and returns a string in UML format.
@@ -7267,7 +7268,8 @@ var AgentMetaService = /** @class */ (function () {
7267
7268
  * @param {AgentName} agentName - The name of the agent.
7268
7269
  * @returns {IMetaNode} The created meta node.
7269
7270
  */
7270
- this.makeAgentNode = function (agentName) {
7271
+ this.makeAgentNode = function (agentName, seen) {
7272
+ if (seen === void 0) { seen = new Set(); }
7271
7273
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
7272
7274
  _this.loggerService.info("agentMetaService makeAgentNode", {
7273
7275
  agentName: agentName,
@@ -7276,45 +7278,78 @@ var AgentMetaService = /** @class */ (function () {
7276
7278
  var agentTree = [];
7277
7279
  if (dependsOn) {
7278
7280
  agentTree.push({
7279
- name: "Agents",
7281
+ name: "".concat(UML_TRIANGLE, " Agents"),
7280
7282
  });
7281
- dependsOn
7283
+ var childSeen_1 = new Set(seen).add(agentName);
7284
+ var subtree = dependsOn
7282
7285
  .filter(function (name) { return !!name; })
7283
- .map(_this.makeAgentNode)
7284
- .forEach(function (node) { return agentTree.push(node); });
7286
+ .map(!seen.has(agentName)
7287
+ ? function (name) { return _this.makeAgentNodeCommon(name, childSeen_1); }
7288
+ : function (name) { return ({ name: name }); });
7289
+ !subtree.length && subtree.push({ name: "Nothing found" });
7290
+ subtree.forEach(function (node) { return agentTree.push(node); });
7285
7291
  }
7286
7292
  if (states) {
7287
7293
  agentTree.push({
7288
- name: "States",
7294
+ name: "".concat(UML_TRIANGLE, " States"),
7289
7295
  });
7290
- states
7291
- .filter(function (name) { return !!name; })
7292
- .map(function (name) { return ({ name: name }); })
7293
- .forEach(function (node) { return agentTree.push(node); });
7296
+ var subtree = states.filter(function (name) { return !!name; }).map(function (name) { return ({ name: name }); });
7297
+ !subtree.length && subtree.push({ name: "Nothing found" });
7298
+ subtree.forEach(function (node) { return agentTree.push(node); });
7294
7299
  }
7295
7300
  if (storages) {
7296
7301
  agentTree.push({
7297
- name: "Storages",
7302
+ name: "".concat(UML_TRIANGLE, " Storages"),
7298
7303
  });
7299
- storages
7304
+ var subtree = storages
7300
7305
  .filter(function (name) { return !!name; })
7301
- .map(function (name) { return ({ name: name }); })
7302
- .forEach(function (node) { return agentTree.push(node); });
7306
+ .map(function (name) { return ({ name: name }); });
7307
+ !subtree.length && subtree.push({ name: "Nothing found" });
7308
+ subtree.forEach(function (node) { return agentTree.push(node); });
7303
7309
  }
7304
7310
  if (tools) {
7305
7311
  agentTree.push({
7306
- name: "Tools",
7312
+ name: "".concat(UML_TRIANGLE, " Tools"),
7307
7313
  });
7308
- tools
7309
- .filter(function (name) { return !!name; })
7310
- .map(function (name) { return ({ name: name }); })
7311
- .forEach(function (node) { return agentTree.push(node); });
7314
+ var subtree = tools.filter(function (name) { return !!name; }).map(function (name) { return ({ name: name }); });
7315
+ !subtree.length && subtree.push({ name: "Nothing found" });
7316
+ subtree.forEach(function (node) { return agentTree.push(node); });
7312
7317
  }
7313
7318
  return {
7314
7319
  name: agentName,
7315
7320
  child: agentTree,
7316
7321
  };
7317
7322
  };
7323
+ /**
7324
+ * Creates a meta node for the given agent.
7325
+ * @param {AgentName} agentName - The name of the agent.
7326
+ * @returns {IMetaNode} The created meta node.
7327
+ */
7328
+ this.makeAgentNodeCommon = function (agentName, seen) {
7329
+ if (seen === void 0) { seen = new Set(); }
7330
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
7331
+ _this.loggerService.info("agentMetaService makeAgentNodeCommon", {
7332
+ agentName: agentName,
7333
+ });
7334
+ var dependsOn = _this.agentSchemaService.get(agentName).dependsOn;
7335
+ if (seen.has(agentName)) {
7336
+ return {
7337
+ name: agentName,
7338
+ };
7339
+ }
7340
+ else if (dependsOn) {
7341
+ var childSeen_2 = new Set(seen).add(agentName);
7342
+ return {
7343
+ name: agentName,
7344
+ child: dependsOn.map(function (name) { return _this.makeAgentNodeCommon(name, childSeen_2); }),
7345
+ };
7346
+ }
7347
+ else {
7348
+ return {
7349
+ name: agentName,
7350
+ };
7351
+ }
7352
+ };
7318
7353
  /**
7319
7354
  * Converts the meta nodes of the given agent to UML format.
7320
7355
  * @param {AgentName} agentName - The name of the agent.
@@ -7355,7 +7390,7 @@ var SwarmMetaService = /** @class */ (function () {
7355
7390
  var agentList = _this.swarmSchemaService.get(swarmName).agentList;
7356
7391
  return {
7357
7392
  name: swarmName,
7358
- child: agentList.map(function (dep) { return _this.agentMetaService.makeAgentNode(dep); }),
7393
+ child: agentList.map(function (dep) { return _this.agentMetaService.makeAgentNodeCommon(dep); }),
7359
7394
  };
7360
7395
  };
7361
7396
  /**
package/build/index.mjs CHANGED
@@ -7215,6 +7215,7 @@ var BusService = /** @class */ (function () {
7215
7215
  var MAX_NESTING = 10;
7216
7216
  var UML_STEP = "\t";
7217
7217
  var UML_BULLET = "•";
7218
+ var UML_TRIANGLE = "►";
7218
7219
  /**
7219
7220
  * Creates a function to serialize meta nodes to UML format.
7220
7221
  * @returns {Function} A function that takes an array of IMetaNode and returns a string in UML format.
@@ -7265,7 +7266,8 @@ var AgentMetaService = /** @class */ (function () {
7265
7266
  * @param {AgentName} agentName - The name of the agent.
7266
7267
  * @returns {IMetaNode} The created meta node.
7267
7268
  */
7268
- this.makeAgentNode = function (agentName) {
7269
+ this.makeAgentNode = function (agentName, seen) {
7270
+ if (seen === void 0) { seen = new Set(); }
7269
7271
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
7270
7272
  _this.loggerService.info("agentMetaService makeAgentNode", {
7271
7273
  agentName: agentName,
@@ -7274,45 +7276,78 @@ var AgentMetaService = /** @class */ (function () {
7274
7276
  var agentTree = [];
7275
7277
  if (dependsOn) {
7276
7278
  agentTree.push({
7277
- name: "Agents",
7279
+ name: "".concat(UML_TRIANGLE, " Agents"),
7278
7280
  });
7279
- dependsOn
7281
+ var childSeen_1 = new Set(seen).add(agentName);
7282
+ var subtree = dependsOn
7280
7283
  .filter(function (name) { return !!name; })
7281
- .map(_this.makeAgentNode)
7282
- .forEach(function (node) { return agentTree.push(node); });
7284
+ .map(!seen.has(agentName)
7285
+ ? function (name) { return _this.makeAgentNodeCommon(name, childSeen_1); }
7286
+ : function (name) { return ({ name: name }); });
7287
+ !subtree.length && subtree.push({ name: "Nothing found" });
7288
+ subtree.forEach(function (node) { return agentTree.push(node); });
7283
7289
  }
7284
7290
  if (states) {
7285
7291
  agentTree.push({
7286
- name: "States",
7292
+ name: "".concat(UML_TRIANGLE, " States"),
7287
7293
  });
7288
- states
7289
- .filter(function (name) { return !!name; })
7290
- .map(function (name) { return ({ name: name }); })
7291
- .forEach(function (node) { return agentTree.push(node); });
7294
+ var subtree = states.filter(function (name) { return !!name; }).map(function (name) { return ({ name: name }); });
7295
+ !subtree.length && subtree.push({ name: "Nothing found" });
7296
+ subtree.forEach(function (node) { return agentTree.push(node); });
7292
7297
  }
7293
7298
  if (storages) {
7294
7299
  agentTree.push({
7295
- name: "Storages",
7300
+ name: "".concat(UML_TRIANGLE, " Storages"),
7296
7301
  });
7297
- storages
7302
+ var subtree = storages
7298
7303
  .filter(function (name) { return !!name; })
7299
- .map(function (name) { return ({ name: name }); })
7300
- .forEach(function (node) { return agentTree.push(node); });
7304
+ .map(function (name) { return ({ name: name }); });
7305
+ !subtree.length && subtree.push({ name: "Nothing found" });
7306
+ subtree.forEach(function (node) { return agentTree.push(node); });
7301
7307
  }
7302
7308
  if (tools) {
7303
7309
  agentTree.push({
7304
- name: "Tools",
7310
+ name: "".concat(UML_TRIANGLE, " Tools"),
7305
7311
  });
7306
- tools
7307
- .filter(function (name) { return !!name; })
7308
- .map(function (name) { return ({ name: name }); })
7309
- .forEach(function (node) { return agentTree.push(node); });
7312
+ var subtree = tools.filter(function (name) { return !!name; }).map(function (name) { return ({ name: name }); });
7313
+ !subtree.length && subtree.push({ name: "Nothing found" });
7314
+ subtree.forEach(function (node) { return agentTree.push(node); });
7310
7315
  }
7311
7316
  return {
7312
7317
  name: agentName,
7313
7318
  child: agentTree,
7314
7319
  };
7315
7320
  };
7321
+ /**
7322
+ * Creates a meta node for the given agent.
7323
+ * @param {AgentName} agentName - The name of the agent.
7324
+ * @returns {IMetaNode} The created meta node.
7325
+ */
7326
+ this.makeAgentNodeCommon = function (agentName, seen) {
7327
+ if (seen === void 0) { seen = new Set(); }
7328
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
7329
+ _this.loggerService.info("agentMetaService makeAgentNodeCommon", {
7330
+ agentName: agentName,
7331
+ });
7332
+ var dependsOn = _this.agentSchemaService.get(agentName).dependsOn;
7333
+ if (seen.has(agentName)) {
7334
+ return {
7335
+ name: agentName,
7336
+ };
7337
+ }
7338
+ else if (dependsOn) {
7339
+ var childSeen_2 = new Set(seen).add(agentName);
7340
+ return {
7341
+ name: agentName,
7342
+ child: dependsOn.map(function (name) { return _this.makeAgentNodeCommon(name, childSeen_2); }),
7343
+ };
7344
+ }
7345
+ else {
7346
+ return {
7347
+ name: agentName,
7348
+ };
7349
+ }
7350
+ };
7316
7351
  /**
7317
7352
  * Converts the meta nodes of the given agent to UML format.
7318
7353
  * @param {AgentName} agentName - The name of the agent.
@@ -7353,7 +7388,7 @@ var SwarmMetaService = /** @class */ (function () {
7353
7388
  var agentList = _this.swarmSchemaService.get(swarmName).agentList;
7354
7389
  return {
7355
7390
  name: swarmName,
7356
- child: agentList.map(function (dep) { return _this.agentMetaService.makeAgentNode(dep); }),
7391
+ child: agentList.map(function (dep) { return _this.agentMetaService.makeAgentNodeCommon(dep); }),
7357
7392
  };
7358
7393
  };
7359
7394
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.87",
3
+ "version": "1.0.89",
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
@@ -3054,7 +3054,13 @@ declare class AgentMetaService {
3054
3054
  * @param {AgentName} agentName - The name of the agent.
3055
3055
  * @returns {IMetaNode} The created meta node.
3056
3056
  */
3057
- makeAgentNode: (agentName: AgentName) => IMetaNode;
3057
+ makeAgentNode: (agentName: AgentName, seen?: Set<string>) => IMetaNode;
3058
+ /**
3059
+ * Creates a meta node for the given agent.
3060
+ * @param {AgentName} agentName - The name of the agent.
3061
+ * @returns {IMetaNode} The created meta node.
3062
+ */
3063
+ makeAgentNodeCommon: (agentName: AgentName, seen?: Set<string>) => IMetaNode;
3058
3064
  /**
3059
3065
  * Converts the meta nodes of the given agent to UML format.
3060
3066
  * @param {AgentName} agentName - The name of the agent.