agent-swarm-kit 1.1.76 → 1.1.78

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
@@ -13052,31 +13052,6 @@ class SwarmMetaService {
13052
13052
  }
13053
13053
  }
13054
13054
 
13055
- const sanitizeMarkdown = (input) => {
13056
- if (typeof input !== "string") {
13057
- return input;
13058
- }
13059
- return (input
13060
- // Remove Markdown italic (_text_) and bold (**text** or __text__)
13061
- .replace(/(?:__|\*\*)(.*?)(?:__|\*\*)/g, "$1")
13062
- .replace(/(?:_|\*)(.*?)(?:_|\*)/g, "$1")
13063
- // Remove inline code blocks (`code` or ```code```)
13064
- .replace(/`{1,3}(.*?)`{1,3}/g, "$1")
13065
- // Remove links ([text](url))
13066
- .replace(/\[([^\]]*)\]\([^\)]*\)/g, "$1")
13067
- // Remove images (![text](url))
13068
- .replace(/!\[([^\]]*)\]\([^\)]*\)/g, "$1")
13069
- // Remove headers (# Header)
13070
- .replace(/^(#+)\s*(.*)/gm, "$2")
13071
- // Remove blockquotes (> text)
13072
- .replace(/^>+\s*(.*)/gm, "$1")
13073
- // Remove horizontal rules (---, ***, ___)
13074
- .replace(/^-{3,}$|^[*]{3,}$|^_{3,}$/gm, "")
13075
- // Remove HTML tags
13076
- .replace(/<\/?[^>]+(>|$)/g, "")
13077
- .trim());
13078
- };
13079
-
13080
13055
  /**
13081
13056
  * Maximum number of concurrent threads for documentation generation tasks.
13082
13057
  * Used by execpool in writeSwarmDoc and writeAgentDoc to limit parallel execution, balancing performance and resource usage.
@@ -13229,7 +13204,7 @@ class DocService {
13229
13204
  * @returns {Promise<void>} A promise resolving when the swarm documentation file is written.
13230
13205
  * @private
13231
13206
  */
13232
- this.writeSwarmDoc = functoolsKit.execpool(async (swarmSchema, prefix, dirName) => {
13207
+ this.writeSwarmDoc = functoolsKit.execpool(async (swarmSchema, prefix, dirName, sanitizeMarkdown = (t) => t) => {
13233
13208
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13234
13209
  this.loggerService.info("docService writeSwarmDoc", {
13235
13210
  swarmSchema,
@@ -13252,7 +13227,7 @@ class DocService {
13252
13227
  }
13253
13228
  {
13254
13229
  const umlSchema = this.swarmMetaService.toUML(swarmSchema.swarmName);
13255
- const umlName = `swarm_schema_${sanitizeMarkdown(swarmSchema.swarmName)}.svg`;
13230
+ const umlName = `swarm_schema_${swarmSchema.swarmName}.svg`;
13256
13231
  const umlSvg = await GLOBAL_CONFIG.CC_FN_PLANTUML(umlSchema);
13257
13232
  if (umlSvg) {
13258
13233
  await writeFileAtomic(path.join(dirName, "image", umlName), umlSvg);
@@ -13263,7 +13238,7 @@ class DocService {
13263
13238
  if (swarmSchema.defaultAgent) {
13264
13239
  result.push("## Default agent");
13265
13240
  result.push("");
13266
- result.push(` - [${sanitizeMarkdown(swarmSchema.defaultAgent)}](./agent/${sanitizeMarkdown(swarmSchema.defaultAgent)}.md)`);
13241
+ result.push(` - [${sanitizeMarkdown(swarmSchema.defaultAgent)}](./agent/${swarmSchema.defaultAgent}.md)`);
13267
13242
  const { docDescription } = this.agentSchemaService.get(swarmSchema.defaultAgent);
13268
13243
  if (docDescription) {
13269
13244
  result.push("");
@@ -13278,7 +13253,7 @@ class DocService {
13278
13253
  if (!swarmSchema.agentList[i]) {
13279
13254
  continue;
13280
13255
  }
13281
- result.push(`${i + 1}. [${sanitizeMarkdown(swarmSchema.agentList[i])}](./agent/${sanitizeMarkdown(swarmSchema.agentList[i])}.md)`);
13256
+ result.push(`${i + 1}. [${sanitizeMarkdown(swarmSchema.agentList[i])}](./agent/${swarmSchema.agentList[i]}.md)`);
13282
13257
  const { docDescription } = this.agentSchemaService.get(swarmSchema.agentList[i]);
13283
13258
  if (docDescription) {
13284
13259
  result.push("");
@@ -13316,7 +13291,7 @@ class DocService {
13316
13291
  }
13317
13292
  result.push("");
13318
13293
  }
13319
- await writeFileAtomic(path.join(dirName, `./${sanitizeMarkdown(swarmSchema.swarmName)}.md`), result.join("\n"));
13294
+ await writeFileAtomic(path.join(dirName, `./${swarmSchema.swarmName}.md`), result.join("\n"));
13320
13295
  }, {
13321
13296
  maxExec: THREAD_POOL_SIZE,
13322
13297
  delay: THREAD_POOL_DELAY,
@@ -13330,7 +13305,7 @@ class DocService {
13330
13305
  * @returns {Promise<void>} A promise resolving when the agent documentation file is written.
13331
13306
  * @private
13332
13307
  */
13333
- this.writeAgentDoc = functoolsKit.execpool(async (agentSchema, prefix, dirName) => {
13308
+ this.writeAgentDoc = functoolsKit.execpool(async (agentSchema, prefix, dirName, sanitizeMarkdown = (t) => t) => {
13334
13309
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13335
13310
  this.loggerService.info("docService writeAgentDoc", {
13336
13311
  agentSchema,
@@ -13361,7 +13336,7 @@ class DocService {
13361
13336
  }
13362
13337
  {
13363
13338
  const umlSchema = this.agentMetaService.toUML(agentSchema.agentName, true);
13364
- const umlName = `agent_schema_${sanitizeMarkdown(agentSchema.agentName)}.svg`;
13339
+ const umlName = `agent_schema_${agentSchema.agentName}.svg`;
13365
13340
  const umlSvg = await GLOBAL_CONFIG.CC_FN_PLANTUML(umlSchema);
13366
13341
  if (umlSvg) {
13367
13342
  await writeFileAtomic(path.join(dirName, "image", umlName), umlSvg);
@@ -13428,7 +13403,7 @@ class DocService {
13428
13403
  if (!agentSchema.dependsOn[i]) {
13429
13404
  continue;
13430
13405
  }
13431
- result.push(`${i + 1}. [${sanitizeMarkdown(agentSchema.dependsOn[i])}](./${sanitizeMarkdown(agentSchema.dependsOn[i])}.md)`);
13406
+ result.push(`${i + 1}. [${sanitizeMarkdown(agentSchema.dependsOn[i])}](./${agentSchema.dependsOn[i]}.md)`);
13432
13407
  const { docDescription } = this.agentSchemaService.get(agentSchema.dependsOn[i]);
13433
13408
  if (docDescription) {
13434
13409
  result.push("");
@@ -13677,7 +13652,7 @@ class DocService {
13677
13652
  }
13678
13653
  result.push("");
13679
13654
  }
13680
- await writeFileAtomic(path.join(dirName, `./agent/${sanitizeMarkdown(agentSchema.agentName)}.md`), result.join("\n"));
13655
+ await writeFileAtomic(path.join(dirName, `./agent/${agentSchema.agentName}.md`), result.join("\n"));
13681
13656
  }, {
13682
13657
  maxExec: THREAD_POOL_SIZE,
13683
13658
  delay: THREAD_POOL_DELAY,
@@ -13689,7 +13664,7 @@ class DocService {
13689
13664
  * @param {string} [dirName=join(process.cwd(), "docs/chat")] - The base directory for documentation output, defaults to "docs/chat" in the current working directory.
13690
13665
  * @returns {Promise<void>} A promise resolving when all documentation files are written.
13691
13666
  */
13692
- this.dumpDocs = async (prefix = "swarm", dirName = path.join(process.cwd(), "docs/chat")) => {
13667
+ this.dumpDocs = async (prefix = "swarm", dirName = path.join(process.cwd(), "docs/chat"), sanitizeMarkdown = (text) => text) => {
13693
13668
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13694
13669
  this.loggerService.info("docService dumpDocs", {
13695
13670
  dirName,
@@ -13704,13 +13679,13 @@ class DocService {
13704
13679
  this.loggerService.info("docService dumpDocs building swarm docs");
13705
13680
  await Promise.all(this.swarmValidationService.getSwarmList().map(async (swarmName) => {
13706
13681
  const swarmSchema = this.swarmSchemaService.get(swarmName);
13707
- await this.writeSwarmDoc(swarmSchema, prefix, dirName);
13682
+ await this.writeSwarmDoc(swarmSchema, prefix, dirName, sanitizeMarkdown);
13708
13683
  }));
13709
13684
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13710
13685
  this.loggerService.info("docService dumpDocs building agent docs");
13711
13686
  await Promise.all(this.agentValidationService.getAgentList().map(async (agentName) => {
13712
13687
  const agentSchema = this.agentSchemaService.get(agentName);
13713
- await this.writeAgentDoc(agentSchema, prefix, dirName);
13688
+ await this.writeAgentDoc(agentSchema, prefix, dirName, sanitizeMarkdown);
13714
13689
  }));
13715
13690
  };
13716
13691
  /**
@@ -18049,7 +18024,7 @@ const METHOD_NAME$1g = "cli.dumpDocs";
18049
18024
  * @param {function} [PlantUML] - An optional function to process PlantUML diagrams.
18050
18025
  * @returns {Promise<void>} - A promise that resolves when the documentation has been dumped.
18051
18026
  */
18052
- const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
18027
+ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML, sanitizeMarkdown = (t) => t) => {
18053
18028
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18054
18029
  swarm$1.loggerService.log(METHOD_NAME$1g, {
18055
18030
  dirName,
@@ -18071,7 +18046,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
18071
18046
  console.error(`agent-swarm missing dependsOn for agentName=${agentName}`);
18072
18047
  }
18073
18048
  });
18074
- return swarm$1.docService.dumpDocs(prefix, dirName);
18049
+ return swarm$1.docService.dumpDocs(prefix, dirName, sanitizeMarkdown);
18075
18050
  });
18076
18051
 
18077
18052
  const METHOD_NAME$1f = "cli.dumpAgent";
package/build/index.mjs CHANGED
@@ -13050,31 +13050,6 @@ class SwarmMetaService {
13050
13050
  }
13051
13051
  }
13052
13052
 
13053
- const sanitizeMarkdown = (input) => {
13054
- if (typeof input !== "string") {
13055
- return input;
13056
- }
13057
- return (input
13058
- // Remove Markdown italic (_text_) and bold (**text** or __text__)
13059
- .replace(/(?:__|\*\*)(.*?)(?:__|\*\*)/g, "$1")
13060
- .replace(/(?:_|\*)(.*?)(?:_|\*)/g, "$1")
13061
- // Remove inline code blocks (`code` or ```code```)
13062
- .replace(/`{1,3}(.*?)`{1,3}/g, "$1")
13063
- // Remove links ([text](url))
13064
- .replace(/\[([^\]]*)\]\([^\)]*\)/g, "$1")
13065
- // Remove images (![text](url))
13066
- .replace(/!\[([^\]]*)\]\([^\)]*\)/g, "$1")
13067
- // Remove headers (# Header)
13068
- .replace(/^(#+)\s*(.*)/gm, "$2")
13069
- // Remove blockquotes (> text)
13070
- .replace(/^>+\s*(.*)/gm, "$1")
13071
- // Remove horizontal rules (---, ***, ___)
13072
- .replace(/^-{3,}$|^[*]{3,}$|^_{3,}$/gm, "")
13073
- // Remove HTML tags
13074
- .replace(/<\/?[^>]+(>|$)/g, "")
13075
- .trim());
13076
- };
13077
-
13078
13053
  /**
13079
13054
  * Maximum number of concurrent threads for documentation generation tasks.
13080
13055
  * Used by execpool in writeSwarmDoc and writeAgentDoc to limit parallel execution, balancing performance and resource usage.
@@ -13227,7 +13202,7 @@ class DocService {
13227
13202
  * @returns {Promise<void>} A promise resolving when the swarm documentation file is written.
13228
13203
  * @private
13229
13204
  */
13230
- this.writeSwarmDoc = execpool(async (swarmSchema, prefix, dirName) => {
13205
+ this.writeSwarmDoc = execpool(async (swarmSchema, prefix, dirName, sanitizeMarkdown = (t) => t) => {
13231
13206
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13232
13207
  this.loggerService.info("docService writeSwarmDoc", {
13233
13208
  swarmSchema,
@@ -13250,7 +13225,7 @@ class DocService {
13250
13225
  }
13251
13226
  {
13252
13227
  const umlSchema = this.swarmMetaService.toUML(swarmSchema.swarmName);
13253
- const umlName = `swarm_schema_${sanitizeMarkdown(swarmSchema.swarmName)}.svg`;
13228
+ const umlName = `swarm_schema_${swarmSchema.swarmName}.svg`;
13254
13229
  const umlSvg = await GLOBAL_CONFIG.CC_FN_PLANTUML(umlSchema);
13255
13230
  if (umlSvg) {
13256
13231
  await writeFileAtomic(join(dirName, "image", umlName), umlSvg);
@@ -13261,7 +13236,7 @@ class DocService {
13261
13236
  if (swarmSchema.defaultAgent) {
13262
13237
  result.push("## Default agent");
13263
13238
  result.push("");
13264
- result.push(` - [${sanitizeMarkdown(swarmSchema.defaultAgent)}](./agent/${sanitizeMarkdown(swarmSchema.defaultAgent)}.md)`);
13239
+ result.push(` - [${sanitizeMarkdown(swarmSchema.defaultAgent)}](./agent/${swarmSchema.defaultAgent}.md)`);
13265
13240
  const { docDescription } = this.agentSchemaService.get(swarmSchema.defaultAgent);
13266
13241
  if (docDescription) {
13267
13242
  result.push("");
@@ -13276,7 +13251,7 @@ class DocService {
13276
13251
  if (!swarmSchema.agentList[i]) {
13277
13252
  continue;
13278
13253
  }
13279
- result.push(`${i + 1}. [${sanitizeMarkdown(swarmSchema.agentList[i])}](./agent/${sanitizeMarkdown(swarmSchema.agentList[i])}.md)`);
13254
+ result.push(`${i + 1}. [${sanitizeMarkdown(swarmSchema.agentList[i])}](./agent/${swarmSchema.agentList[i]}.md)`);
13280
13255
  const { docDescription } = this.agentSchemaService.get(swarmSchema.agentList[i]);
13281
13256
  if (docDescription) {
13282
13257
  result.push("");
@@ -13314,7 +13289,7 @@ class DocService {
13314
13289
  }
13315
13290
  result.push("");
13316
13291
  }
13317
- await writeFileAtomic(join(dirName, `./${sanitizeMarkdown(swarmSchema.swarmName)}.md`), result.join("\n"));
13292
+ await writeFileAtomic(join(dirName, `./${swarmSchema.swarmName}.md`), result.join("\n"));
13318
13293
  }, {
13319
13294
  maxExec: THREAD_POOL_SIZE,
13320
13295
  delay: THREAD_POOL_DELAY,
@@ -13328,7 +13303,7 @@ class DocService {
13328
13303
  * @returns {Promise<void>} A promise resolving when the agent documentation file is written.
13329
13304
  * @private
13330
13305
  */
13331
- this.writeAgentDoc = execpool(async (agentSchema, prefix, dirName) => {
13306
+ this.writeAgentDoc = execpool(async (agentSchema, prefix, dirName, sanitizeMarkdown = (t) => t) => {
13332
13307
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13333
13308
  this.loggerService.info("docService writeAgentDoc", {
13334
13309
  agentSchema,
@@ -13359,7 +13334,7 @@ class DocService {
13359
13334
  }
13360
13335
  {
13361
13336
  const umlSchema = this.agentMetaService.toUML(agentSchema.agentName, true);
13362
- const umlName = `agent_schema_${sanitizeMarkdown(agentSchema.agentName)}.svg`;
13337
+ const umlName = `agent_schema_${agentSchema.agentName}.svg`;
13363
13338
  const umlSvg = await GLOBAL_CONFIG.CC_FN_PLANTUML(umlSchema);
13364
13339
  if (umlSvg) {
13365
13340
  await writeFileAtomic(join(dirName, "image", umlName), umlSvg);
@@ -13426,7 +13401,7 @@ class DocService {
13426
13401
  if (!agentSchema.dependsOn[i]) {
13427
13402
  continue;
13428
13403
  }
13429
- result.push(`${i + 1}. [${sanitizeMarkdown(agentSchema.dependsOn[i])}](./${sanitizeMarkdown(agentSchema.dependsOn[i])}.md)`);
13404
+ result.push(`${i + 1}. [${sanitizeMarkdown(agentSchema.dependsOn[i])}](./${agentSchema.dependsOn[i]}.md)`);
13430
13405
  const { docDescription } = this.agentSchemaService.get(agentSchema.dependsOn[i]);
13431
13406
  if (docDescription) {
13432
13407
  result.push("");
@@ -13675,7 +13650,7 @@ class DocService {
13675
13650
  }
13676
13651
  result.push("");
13677
13652
  }
13678
- await writeFileAtomic(join(dirName, `./agent/${sanitizeMarkdown(agentSchema.agentName)}.md`), result.join("\n"));
13653
+ await writeFileAtomic(join(dirName, `./agent/${agentSchema.agentName}.md`), result.join("\n"));
13679
13654
  }, {
13680
13655
  maxExec: THREAD_POOL_SIZE,
13681
13656
  delay: THREAD_POOL_DELAY,
@@ -13687,7 +13662,7 @@ class DocService {
13687
13662
  * @param {string} [dirName=join(process.cwd(), "docs/chat")] - The base directory for documentation output, defaults to "docs/chat" in the current working directory.
13688
13663
  * @returns {Promise<void>} A promise resolving when all documentation files are written.
13689
13664
  */
13690
- this.dumpDocs = async (prefix = "swarm", dirName = join(process.cwd(), "docs/chat")) => {
13665
+ this.dumpDocs = async (prefix = "swarm", dirName = join(process.cwd(), "docs/chat"), sanitizeMarkdown = (text) => text) => {
13691
13666
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13692
13667
  this.loggerService.info("docService dumpDocs", {
13693
13668
  dirName,
@@ -13702,13 +13677,13 @@ class DocService {
13702
13677
  this.loggerService.info("docService dumpDocs building swarm docs");
13703
13678
  await Promise.all(this.swarmValidationService.getSwarmList().map(async (swarmName) => {
13704
13679
  const swarmSchema = this.swarmSchemaService.get(swarmName);
13705
- await this.writeSwarmDoc(swarmSchema, prefix, dirName);
13680
+ await this.writeSwarmDoc(swarmSchema, prefix, dirName, sanitizeMarkdown);
13706
13681
  }));
13707
13682
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13708
13683
  this.loggerService.info("docService dumpDocs building agent docs");
13709
13684
  await Promise.all(this.agentValidationService.getAgentList().map(async (agentName) => {
13710
13685
  const agentSchema = this.agentSchemaService.get(agentName);
13711
- await this.writeAgentDoc(agentSchema, prefix, dirName);
13686
+ await this.writeAgentDoc(agentSchema, prefix, dirName, sanitizeMarkdown);
13712
13687
  }));
13713
13688
  };
13714
13689
  /**
@@ -18047,7 +18022,7 @@ const METHOD_NAME$1g = "cli.dumpDocs";
18047
18022
  * @param {function} [PlantUML] - An optional function to process PlantUML diagrams.
18048
18023
  * @returns {Promise<void>} - A promise that resolves when the documentation has been dumped.
18049
18024
  */
18050
- const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
18025
+ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML, sanitizeMarkdown = (t) => t) => {
18051
18026
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18052
18027
  swarm$1.loggerService.log(METHOD_NAME$1g, {
18053
18028
  dirName,
@@ -18069,7 +18044,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
18069
18044
  console.error(`agent-swarm missing dependsOn for agentName=${agentName}`);
18070
18045
  }
18071
18046
  });
18072
- return swarm$1.docService.dumpDocs(prefix, dirName);
18047
+ return swarm$1.docService.dumpDocs(prefix, dirName, sanitizeMarkdown);
18073
18048
  });
18074
18049
 
18075
18050
  const METHOD_NAME$1f = "cli.dumpAgent";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.1.76",
3
+ "version": "1.1.78",
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
@@ -8237,7 +8237,7 @@ declare class DocService {
8237
8237
  * @param {string} [dirName=join(process.cwd(), "docs/chat")] - The base directory for documentation output, defaults to "docs/chat" in the current working directory.
8238
8238
  * @returns {Promise<void>} A promise resolving when all documentation files are written.
8239
8239
  */
8240
- dumpDocs: (prefix?: string, dirName?: string) => Promise<void>;
8240
+ dumpDocs: (prefix?: string, dirName?: string, sanitizeMarkdown?: (text: string) => string) => Promise<void>;
8241
8241
  /**
8242
8242
  * Dumps system-wide performance data to a JSON file using PerfService.toRecord.
8243
8243
  * Ensures the output directory exists, then writes a timestamped file, logging the process if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is enabled.
@@ -10990,7 +10990,7 @@ declare const swarm: ISwarmDI;
10990
10990
  * @param {function} [PlantUML] - An optional function to process PlantUML diagrams.
10991
10991
  * @returns {Promise<void>} - A promise that resolves when the documentation has been dumped.
10992
10992
  */
10993
- declare const dumpDocs: (prefix?: any, dirName?: any, PlantUML?: (uml: string) => Promise<string>) => Promise<void>;
10993
+ declare const dumpDocs: (prefix?: any, dirName?: any, PlantUML?: (uml: string) => Promise<string>, sanitizeMarkdown?: (text: string) => string) => Promise<void>;
10994
10994
 
10995
10995
  /**
10996
10996
  * The config for UML generation