agent-swarm-kit 1.0.101 → 1.0.103

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
@@ -7446,6 +7446,10 @@ var SwarmMetaService = /** @class */ (function () {
7446
7446
 
7447
7447
  var THREAD_POOL_SIZE = 5;
7448
7448
  var SUBDIR_LIST = ["agent", "image"];
7449
+ /**
7450
+ * Service for generating documentation for swarms and agents.
7451
+ * @class
7452
+ */
7449
7453
  var DocService = /** @class */ (function () {
7450
7454
  function DocService() {
7451
7455
  var _this = this;
@@ -7459,6 +7463,12 @@ var DocService = /** @class */ (function () {
7459
7463
  this.stateSchemaService = inject(TYPES.stateSchemaService);
7460
7464
  this.agentMetaService = inject(TYPES.agentMetaService);
7461
7465
  this.swarmMetaService = inject(TYPES.swarmMetaService);
7466
+ /**
7467
+ * Writes documentation for a swarm schema.
7468
+ * @param {ISwarmSchema} swarmSchema - The swarm schema to document.
7469
+ * @param {string} dirName - The directory to write the documentation to.
7470
+ * @returns {Promise<void>}
7471
+ */
7462
7472
  this.writeSwarmDoc = functoolsKit.execpool(function (swarmSchema, dirName) { return __awaiter(_this, void 0, void 0, function () {
7463
7473
  var result, umlSchema, umlName, umlSvg, docDescription, i, docDescription, callbackList, i;
7464
7474
  return __generator(this, function (_a) {
@@ -7530,6 +7540,12 @@ var DocService = /** @class */ (function () {
7530
7540
  }); }, {
7531
7541
  maxExec: THREAD_POOL_SIZE,
7532
7542
  });
7543
+ /**
7544
+ * Writes documentation for an agent schema.
7545
+ * @param {IAgentSchema} agentSchema - The agent schema to document.
7546
+ * @param {string} dirName - The directory to write the documentation to.
7547
+ * @returns {Promise<void>}
7548
+ */
7533
7549
  this.writeAgentDoc = functoolsKit.execpool(function (agentSchema, dirName) { return __awaiter(_this, void 0, void 0, function () {
7534
7550
  var result, umlSchema, umlName, umlSvg, i, i, docDescription, _loop_1, this_1, i, i, _a, docDescription, embedding, shared, callbacks, callbackList, i_1, i, _b, docDescription, shared, callbacks, callbackList, i_2, callbackList, i;
7535
7551
  var _c;
@@ -7622,7 +7638,8 @@ var DocService = /** @class */ (function () {
7622
7638
  if ((_c = fn.parameters) === null || _c === void 0 ? void 0 : _c.properties) {
7623
7639
  result.push("");
7624
7640
  result.push("#### Parameters for model");
7625
- Object.entries(fn.parameters.properties).forEach(function (_a, idx) {
7641
+ var entries = Object.entries(fn.parameters.properties);
7642
+ entries.forEach(function (_a, idx) {
7626
7643
  var _b = __read(_a, 2), key = _b[0], _c = _b[1], type = _c.type, description = _c.description, e = _c.enum;
7627
7644
  result.push("");
7628
7645
  result.push("> **".concat(idx + 1, ". ").concat(key, "**"));
@@ -7643,6 +7660,11 @@ var DocService = /** @class */ (function () {
7643
7660
  result.push("*Required:* [".concat(fn.parameters.required.includes(key) ? "x" : " ", "]"));
7644
7661
  }
7645
7662
  });
7663
+ if (!entries.length) {
7664
+ result.push("");
7665
+ result.push("*Empty parameters*");
7666
+ result.push("");
7667
+ }
7646
7668
  }
7647
7669
  if (callbacks) {
7648
7670
  result.push("");
@@ -7748,6 +7770,11 @@ var DocService = /** @class */ (function () {
7748
7770
  }); }, {
7749
7771
  maxExec: THREAD_POOL_SIZE,
7750
7772
  });
7773
+ /**
7774
+ * Dumps the documentation for all swarms and agents.
7775
+ * @param {string} [dirName=join(process.cwd(), "docs/chat")] - The directory to write the documentation to.
7776
+ * @returns {Promise<void>}
7777
+ */
7751
7778
  this.dumpDocs = function () {
7752
7779
  var args_1 = [];
7753
7780
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -7930,12 +7957,40 @@ init();
7930
7957
  var swarm$1 = swarm;
7931
7958
 
7932
7959
  var METHOD_NAME$F = "cli.dumpDocs";
7933
- var dumpDocs = function (dirName) {
7960
+ /**
7961
+ * Dumps the documentation for the agents and swarms.
7962
+ *
7963
+ * @param {string} [dirName="./docs/chat"] - The directory where the documentation will be dumped.
7964
+ * @param {function} [PlantUML] - An optional function to process PlantUML diagrams.
7965
+ * @returns {Promise<void>} - A promise that resolves when the documentation has been dumped.
7966
+ */
7967
+ var dumpDocs = function (dirName, PlantUML) {
7934
7968
  if (dirName === void 0) { dirName = "./docs/chat"; }
7935
7969
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7936
7970
  swarm$1.loggerService.log(METHOD_NAME$F, {
7937
7971
  dirName: dirName,
7938
7972
  });
7973
+ if (PlantUML) {
7974
+ setConfig({
7975
+ CC_FN_PLANTUML: PlantUML,
7976
+ });
7977
+ }
7978
+ swarm$1.agentValidationService
7979
+ .getAgentList()
7980
+ .forEach(function (agentName) {
7981
+ return swarm$1.agentValidationService.validate(agentName, METHOD_NAME$F);
7982
+ });
7983
+ swarm$1.swarmValidationService
7984
+ .getSwarmList()
7985
+ .forEach(function (swarmName) {
7986
+ return swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$F);
7987
+ });
7988
+ swarm$1.agentValidationService.getAgentList().forEach(function (agentName) {
7989
+ var dependsOn = swarm$1.agentSchemaService.get(agentName).dependsOn;
7990
+ if (!dependsOn) {
7991
+ console.error("agent-swarm missing dependsOn for agentName=".concat(agentName));
7992
+ }
7993
+ });
7939
7994
  return swarm$1.docService.dumpDocs(dirName);
7940
7995
  };
7941
7996
 
package/build/index.mjs CHANGED
@@ -7444,6 +7444,10 @@ var SwarmMetaService = /** @class */ (function () {
7444
7444
 
7445
7445
  var THREAD_POOL_SIZE = 5;
7446
7446
  var SUBDIR_LIST = ["agent", "image"];
7447
+ /**
7448
+ * Service for generating documentation for swarms and agents.
7449
+ * @class
7450
+ */
7447
7451
  var DocService = /** @class */ (function () {
7448
7452
  function DocService() {
7449
7453
  var _this = this;
@@ -7457,6 +7461,12 @@ var DocService = /** @class */ (function () {
7457
7461
  this.stateSchemaService = inject(TYPES.stateSchemaService);
7458
7462
  this.agentMetaService = inject(TYPES.agentMetaService);
7459
7463
  this.swarmMetaService = inject(TYPES.swarmMetaService);
7464
+ /**
7465
+ * Writes documentation for a swarm schema.
7466
+ * @param {ISwarmSchema} swarmSchema - The swarm schema to document.
7467
+ * @param {string} dirName - The directory to write the documentation to.
7468
+ * @returns {Promise<void>}
7469
+ */
7460
7470
  this.writeSwarmDoc = execpool(function (swarmSchema, dirName) { return __awaiter(_this, void 0, void 0, function () {
7461
7471
  var result, umlSchema, umlName, umlSvg, docDescription, i, docDescription, callbackList, i;
7462
7472
  return __generator(this, function (_a) {
@@ -7528,6 +7538,12 @@ var DocService = /** @class */ (function () {
7528
7538
  }); }, {
7529
7539
  maxExec: THREAD_POOL_SIZE,
7530
7540
  });
7541
+ /**
7542
+ * Writes documentation for an agent schema.
7543
+ * @param {IAgentSchema} agentSchema - The agent schema to document.
7544
+ * @param {string} dirName - The directory to write the documentation to.
7545
+ * @returns {Promise<void>}
7546
+ */
7531
7547
  this.writeAgentDoc = execpool(function (agentSchema, dirName) { return __awaiter(_this, void 0, void 0, function () {
7532
7548
  var result, umlSchema, umlName, umlSvg, i, i, docDescription, _loop_1, this_1, i, i, _a, docDescription, embedding, shared, callbacks, callbackList, i_1, i, _b, docDescription, shared, callbacks, callbackList, i_2, callbackList, i;
7533
7549
  var _c;
@@ -7620,7 +7636,8 @@ var DocService = /** @class */ (function () {
7620
7636
  if ((_c = fn.parameters) === null || _c === void 0 ? void 0 : _c.properties) {
7621
7637
  result.push("");
7622
7638
  result.push("#### Parameters for model");
7623
- Object.entries(fn.parameters.properties).forEach(function (_a, idx) {
7639
+ var entries = Object.entries(fn.parameters.properties);
7640
+ entries.forEach(function (_a, idx) {
7624
7641
  var _b = __read(_a, 2), key = _b[0], _c = _b[1], type = _c.type, description = _c.description, e = _c.enum;
7625
7642
  result.push("");
7626
7643
  result.push("> **".concat(idx + 1, ". ").concat(key, "**"));
@@ -7641,6 +7658,11 @@ var DocService = /** @class */ (function () {
7641
7658
  result.push("*Required:* [".concat(fn.parameters.required.includes(key) ? "x" : " ", "]"));
7642
7659
  }
7643
7660
  });
7661
+ if (!entries.length) {
7662
+ result.push("");
7663
+ result.push("*Empty parameters*");
7664
+ result.push("");
7665
+ }
7644
7666
  }
7645
7667
  if (callbacks) {
7646
7668
  result.push("");
@@ -7746,6 +7768,11 @@ var DocService = /** @class */ (function () {
7746
7768
  }); }, {
7747
7769
  maxExec: THREAD_POOL_SIZE,
7748
7770
  });
7771
+ /**
7772
+ * Dumps the documentation for all swarms and agents.
7773
+ * @param {string} [dirName=join(process.cwd(), "docs/chat")] - The directory to write the documentation to.
7774
+ * @returns {Promise<void>}
7775
+ */
7749
7776
  this.dumpDocs = function () {
7750
7777
  var args_1 = [];
7751
7778
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -7928,12 +7955,40 @@ init();
7928
7955
  var swarm$1 = swarm;
7929
7956
 
7930
7957
  var METHOD_NAME$F = "cli.dumpDocs";
7931
- var dumpDocs = function (dirName) {
7958
+ /**
7959
+ * Dumps the documentation for the agents and swarms.
7960
+ *
7961
+ * @param {string} [dirName="./docs/chat"] - The directory where the documentation will be dumped.
7962
+ * @param {function} [PlantUML] - An optional function to process PlantUML diagrams.
7963
+ * @returns {Promise<void>} - A promise that resolves when the documentation has been dumped.
7964
+ */
7965
+ var dumpDocs = function (dirName, PlantUML) {
7932
7966
  if (dirName === void 0) { dirName = "./docs/chat"; }
7933
7967
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7934
7968
  swarm$1.loggerService.log(METHOD_NAME$F, {
7935
7969
  dirName: dirName,
7936
7970
  });
7971
+ if (PlantUML) {
7972
+ setConfig({
7973
+ CC_FN_PLANTUML: PlantUML,
7974
+ });
7975
+ }
7976
+ swarm$1.agentValidationService
7977
+ .getAgentList()
7978
+ .forEach(function (agentName) {
7979
+ return swarm$1.agentValidationService.validate(agentName, METHOD_NAME$F);
7980
+ });
7981
+ swarm$1.swarmValidationService
7982
+ .getSwarmList()
7983
+ .forEach(function (swarmName) {
7984
+ return swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$F);
7985
+ });
7986
+ swarm$1.agentValidationService.getAgentList().forEach(function (agentName) {
7987
+ var dependsOn = swarm$1.agentSchemaService.get(agentName).dependsOn;
7988
+ if (!dependsOn) {
7989
+ console.error("agent-swarm missing dependsOn for agentName=".concat(agentName));
7990
+ }
7991
+ });
7937
7992
  return swarm$1.docService.dumpDocs(dirName);
7938
7993
  };
7939
7994
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.101",
3
+ "version": "1.0.103",
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
@@ -3107,6 +3107,10 @@ declare class SwarmMetaService {
3107
3107
  toUML: (swarmName: SwarmName) => string;
3108
3108
  }
3109
3109
 
3110
+ /**
3111
+ * Service for generating documentation for swarms and agents.
3112
+ * @class
3113
+ */
3110
3114
  declare class DocService {
3111
3115
  private readonly loggerService;
3112
3116
  private readonly swarmValidationService;
@@ -3118,8 +3122,25 @@ declare class DocService {
3118
3122
  private readonly stateSchemaService;
3119
3123
  private readonly agentMetaService;
3120
3124
  private readonly swarmMetaService;
3125
+ /**
3126
+ * Writes documentation for a swarm schema.
3127
+ * @param {ISwarmSchema} swarmSchema - The swarm schema to document.
3128
+ * @param {string} dirName - The directory to write the documentation to.
3129
+ * @returns {Promise<void>}
3130
+ */
3121
3131
  private writeSwarmDoc;
3132
+ /**
3133
+ * Writes documentation for an agent schema.
3134
+ * @param {IAgentSchema} agentSchema - The agent schema to document.
3135
+ * @param {string} dirName - The directory to write the documentation to.
3136
+ * @returns {Promise<void>}
3137
+ */
3122
3138
  private writeAgentDoc;
3139
+ /**
3140
+ * Dumps the documentation for all swarms and agents.
3141
+ * @param {string} [dirName=join(process.cwd(), "docs/chat")] - The directory to write the documentation to.
3142
+ * @returns {Promise<void>}
3143
+ */
3123
3144
  dumpDocs: (dirName?: string) => Promise<void>;
3124
3145
  }
3125
3146
 
@@ -3163,7 +3184,14 @@ declare const swarm: {
3163
3184
  loggerService: LoggerService;
3164
3185
  };
3165
3186
 
3166
- declare const dumpDocs: (dirName?: string) => Promise<void>;
3187
+ /**
3188
+ * Dumps the documentation for the agents and swarms.
3189
+ *
3190
+ * @param {string} [dirName="./docs/chat"] - The directory where the documentation will be dumped.
3191
+ * @param {function} [PlantUML] - An optional function to process PlantUML diagrams.
3192
+ * @returns {Promise<void>} - A promise that resolves when the documentation has been dumped.
3193
+ */
3194
+ declare const dumpDocs: (dirName?: string, PlantUML?: (uml: string) => Promise<string>) => Promise<void>;
3167
3195
 
3168
3196
  /**
3169
3197
  * The config for UML generation