agent-swarm-kit 1.0.99 → 1.0.102

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) {
@@ -7494,7 +7504,7 @@ var DocService = /** @class */ (function () {
7494
7504
  docDescription = this.agentSchemaService.get(swarmSchema.defaultAgent).docDescription;
7495
7505
  if (docDescription) {
7496
7506
  result.push("");
7497
- result.push(docDescription);
7507
+ result.push("\t".concat(docDescription));
7498
7508
  }
7499
7509
  result.push("");
7500
7510
  }
@@ -7509,7 +7519,7 @@ var DocService = /** @class */ (function () {
7509
7519
  docDescription = this.agentSchemaService.get(swarmSchema.agentList[i]).docDescription;
7510
7520
  if (docDescription) {
7511
7521
  result.push("");
7512
- result.push(docDescription);
7522
+ result.push("\t".concat(docDescription));
7513
7523
  }
7514
7524
  result.push("");
7515
7525
  }
@@ -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;
@@ -7625,7 +7641,7 @@ var DocService = /** @class */ (function () {
7625
7641
  Object.entries(fn.parameters.properties).forEach(function (_a, idx) {
7626
7642
  var _b = __read(_a, 2), key = _b[0], _c = _b[1], type = _c.type, description = _c.description, e = _c.enum;
7627
7643
  result.push("");
7628
- result.push("> ".concat(idx + 1, ". ").concat(key));
7644
+ result.push("> **".concat(idx + 1, ". ").concat(key, "**"));
7629
7645
  {
7630
7646
  result.push("");
7631
7647
  result.push("*Type:* `".concat(type, "`"));
@@ -7748,6 +7764,11 @@ var DocService = /** @class */ (function () {
7748
7764
  }); }, {
7749
7765
  maxExec: THREAD_POOL_SIZE,
7750
7766
  });
7767
+ /**
7768
+ * Dumps the documentation for all swarms and agents.
7769
+ * @param {string} [dirName=join(process.cwd(), "docs/chat")] - The directory to write the documentation to.
7770
+ * @returns {Promise<void>}
7771
+ */
7751
7772
  this.dumpDocs = function () {
7752
7773
  var args_1 = [];
7753
7774
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -7930,12 +7951,40 @@ init();
7930
7951
  var swarm$1 = swarm;
7931
7952
 
7932
7953
  var METHOD_NAME$F = "cli.dumpDocs";
7933
- var dumpDocs = function (dirName) {
7954
+ /**
7955
+ * Dumps the documentation for the agents and swarms.
7956
+ *
7957
+ * @param {string} [dirName="./docs/chat"] - The directory where the documentation will be dumped.
7958
+ * @param {function} [PlantUML] - An optional function to process PlantUML diagrams.
7959
+ * @returns {Promise<void>} - A promise that resolves when the documentation has been dumped.
7960
+ */
7961
+ var dumpDocs = function (dirName, PlantUML) {
7934
7962
  if (dirName === void 0) { dirName = "./docs/chat"; }
7935
7963
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7936
7964
  swarm$1.loggerService.log(METHOD_NAME$F, {
7937
7965
  dirName: dirName,
7938
7966
  });
7967
+ if (PlantUML) {
7968
+ setConfig({
7969
+ CC_FN_PLANTUML: PlantUML,
7970
+ });
7971
+ }
7972
+ swarm$1.agentValidationService
7973
+ .getAgentList()
7974
+ .forEach(function (agentName) {
7975
+ return swarm$1.agentValidationService.validate(agentName, METHOD_NAME$F);
7976
+ });
7977
+ swarm$1.swarmValidationService
7978
+ .getSwarmList()
7979
+ .forEach(function (swarmName) {
7980
+ return swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$F);
7981
+ });
7982
+ swarm$1.agentValidationService.getAgentList().forEach(function (agentName) {
7983
+ var dependsOn = swarm$1.agentSchemaService.get(agentName).dependsOn;
7984
+ if (!dependsOn) {
7985
+ console.error("agent-swarm missing dependsOn for agentName=".concat(agentName));
7986
+ }
7987
+ });
7939
7988
  return swarm$1.docService.dumpDocs(dirName);
7940
7989
  };
7941
7990
 
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) {
@@ -7492,7 +7502,7 @@ var DocService = /** @class */ (function () {
7492
7502
  docDescription = this.agentSchemaService.get(swarmSchema.defaultAgent).docDescription;
7493
7503
  if (docDescription) {
7494
7504
  result.push("");
7495
- result.push(docDescription);
7505
+ result.push("\t".concat(docDescription));
7496
7506
  }
7497
7507
  result.push("");
7498
7508
  }
@@ -7507,7 +7517,7 @@ var DocService = /** @class */ (function () {
7507
7517
  docDescription = this.agentSchemaService.get(swarmSchema.agentList[i]).docDescription;
7508
7518
  if (docDescription) {
7509
7519
  result.push("");
7510
- result.push(docDescription);
7520
+ result.push("\t".concat(docDescription));
7511
7521
  }
7512
7522
  result.push("");
7513
7523
  }
@@ -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;
@@ -7623,7 +7639,7 @@ var DocService = /** @class */ (function () {
7623
7639
  Object.entries(fn.parameters.properties).forEach(function (_a, idx) {
7624
7640
  var _b = __read(_a, 2), key = _b[0], _c = _b[1], type = _c.type, description = _c.description, e = _c.enum;
7625
7641
  result.push("");
7626
- result.push("> ".concat(idx + 1, ". ").concat(key));
7642
+ result.push("> **".concat(idx + 1, ". ").concat(key, "**"));
7627
7643
  {
7628
7644
  result.push("");
7629
7645
  result.push("*Type:* `".concat(type, "`"));
@@ -7746,6 +7762,11 @@ var DocService = /** @class */ (function () {
7746
7762
  }); }, {
7747
7763
  maxExec: THREAD_POOL_SIZE,
7748
7764
  });
7765
+ /**
7766
+ * Dumps the documentation for all swarms and agents.
7767
+ * @param {string} [dirName=join(process.cwd(), "docs/chat")] - The directory to write the documentation to.
7768
+ * @returns {Promise<void>}
7769
+ */
7749
7770
  this.dumpDocs = function () {
7750
7771
  var args_1 = [];
7751
7772
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -7928,12 +7949,40 @@ init();
7928
7949
  var swarm$1 = swarm;
7929
7950
 
7930
7951
  var METHOD_NAME$F = "cli.dumpDocs";
7931
- var dumpDocs = function (dirName) {
7952
+ /**
7953
+ * Dumps the documentation for the agents and swarms.
7954
+ *
7955
+ * @param {string} [dirName="./docs/chat"] - The directory where the documentation will be dumped.
7956
+ * @param {function} [PlantUML] - An optional function to process PlantUML diagrams.
7957
+ * @returns {Promise<void>} - A promise that resolves when the documentation has been dumped.
7958
+ */
7959
+ var dumpDocs = function (dirName, PlantUML) {
7932
7960
  if (dirName === void 0) { dirName = "./docs/chat"; }
7933
7961
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7934
7962
  swarm$1.loggerService.log(METHOD_NAME$F, {
7935
7963
  dirName: dirName,
7936
7964
  });
7965
+ if (PlantUML) {
7966
+ setConfig({
7967
+ CC_FN_PLANTUML: PlantUML,
7968
+ });
7969
+ }
7970
+ swarm$1.agentValidationService
7971
+ .getAgentList()
7972
+ .forEach(function (agentName) {
7973
+ return swarm$1.agentValidationService.validate(agentName, METHOD_NAME$F);
7974
+ });
7975
+ swarm$1.swarmValidationService
7976
+ .getSwarmList()
7977
+ .forEach(function (swarmName) {
7978
+ return swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$F);
7979
+ });
7980
+ swarm$1.agentValidationService.getAgentList().forEach(function (agentName) {
7981
+ var dependsOn = swarm$1.agentSchemaService.get(agentName).dependsOn;
7982
+ if (!dependsOn) {
7983
+ console.error("agent-swarm missing dependsOn for agentName=".concat(agentName));
7984
+ }
7985
+ });
7937
7986
  return swarm$1.docService.dumpDocs(dirName);
7938
7987
  };
7939
7988
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.99",
3
+ "version": "1.0.102",
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