agent-swarm-kit 1.1.113 → 1.1.114

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
@@ -13211,6 +13211,13 @@ class DocService {
13211
13211
  * @private
13212
13212
  */
13213
13213
  this.agentValidationService = inject(TYPES.agentValidationService);
13214
+ /**
13215
+ * Outline validation service instance, injected via DI.
13216
+ * Used for validating and managing agent outline schemas, ensuring agent outlines conform to expected structure and constraints.
13217
+ * @type {OutlineValidationService}
13218
+ * @private
13219
+ */
13220
+ this.outlineValidationService = inject(TYPES.outlineValidationService);
13214
13221
  /**
13215
13222
  * Swarm schema service instance, injected via DI.
13216
13223
  * Retrieves ISwarmSchema objects for writeSwarmDoc, supplying swarm details like agents and policies.
@@ -13225,6 +13232,13 @@ class DocService {
13225
13232
  * @private
13226
13233
  */
13227
13234
  this.agentSchemaService = inject(TYPES.agentSchemaService);
13235
+ /**
13236
+ * Outline schema service instance, injected via DI.
13237
+ * Retrieves and manages outline schema objects for agents, supporting documentation and validation of agent outlines.
13238
+ * @type {OutlineSchemaService}
13239
+ * @private
13240
+ */
13241
+ this.outlineSchemaService = inject(TYPES.outlineSchemaService);
13228
13242
  /**
13229
13243
  * Model context protocol service instance, injected via DI.
13230
13244
  * Retrieves IMCPSchema objects for writeAgentDoc and agent descriptions in writeSwarmDoc, providing details like tools and prompts.
@@ -13396,6 +13410,121 @@ class DocService {
13396
13410
  maxExec: THREAD_POOL_SIZE,
13397
13411
  delay: THREAD_POOL_DELAY,
13398
13412
  });
13413
+ /**
13414
+ * Writes Markdown documentation for an outline schema, detailing its name, description, main prompt, output format, and callbacks.
13415
+ * Executes in a thread pool (THREAD_POOL_SIZE) to manage concurrency, logging via loggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is enabled.
13416
+ * Outputs to dirName/[outlineName].md, sourced from outlineSchemaService.
13417
+ *
13418
+ * - The Markdown includes YAML frontmatter, outline name, description, prompt(s), output format (with types, descriptions, enums, and required fields), and callbacks.
13419
+ * - Handles both string and function-based prompts, and supports array or string prompt types.
13420
+ * - Output format section documents each property, its type, description, enum values, and required status.
13421
+ * - Callback section lists all callback names used by the outline.
13422
+ *
13423
+ * @param {IOutlineSchema} outlineSchema - The outline schema to document, including properties like prompt, format, and callbacks.
13424
+ * @param {string} prefix - The documentation group or prefix for organizing output.
13425
+ * @param {string} dirName - The base directory for documentation output.
13426
+ * @param {(text: string) => string} [sanitizeMarkdown=(t) => t] - Optional function to sanitize Markdown text.
13427
+ * @returns {Promise<void>} A promise resolving when the outline documentation file is written.
13428
+ * @private
13429
+ */
13430
+ this.writeOutlineDoc = functoolsKit.execpool(async (outlineSchema, prefix, dirName, sanitizeMarkdown = (t) => t) => {
13431
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13432
+ this.loggerService.info("docService writeOutlineDoc", {
13433
+ outlineSchema,
13434
+ });
13435
+ const result = [];
13436
+ {
13437
+ result.push("---");
13438
+ result.push(`title: ${prefix}/${sanitizeMarkdown(outlineSchema.outlineName)}`);
13439
+ result.push(`group: ${prefix}`);
13440
+ result.push("---");
13441
+ result.push("");
13442
+ }
13443
+ {
13444
+ result.push(`# ${sanitizeMarkdown(outlineSchema.outlineName)}`);
13445
+ if (outlineSchema.docDescription) {
13446
+ result.push("");
13447
+ result.push(`> ${sanitizeMarkdown(outlineSchema.docDescription)}`);
13448
+ }
13449
+ result.push("");
13450
+ }
13451
+ const getPrompt = async () => {
13452
+ try {
13453
+ if (typeof outlineSchema.prompt === "string") {
13454
+ return outlineSchema.prompt;
13455
+ }
13456
+ if (typeof outlineSchema.prompt === "function") {
13457
+ return await outlineSchema.prompt(outlineSchema.outlineName);
13458
+ }
13459
+ return null;
13460
+ }
13461
+ catch {
13462
+ return null;
13463
+ }
13464
+ };
13465
+ const prompt = await getPrompt();
13466
+ if (Array.isArray(prompt)) {
13467
+ result.push(`## Main prompt`);
13468
+ result.push("");
13469
+ for (let i = 0; i !== prompt.length; i++) {
13470
+ if (!prompt[i]) {
13471
+ continue;
13472
+ }
13473
+ result.push(`${i + 1}. \`${sanitizeMarkdown(prompt[i])}\``);
13474
+ result.push("");
13475
+ }
13476
+ }
13477
+ if (typeof prompt === "string") {
13478
+ result.push(`## Main prompt`);
13479
+ result.push("");
13480
+ result.push("```");
13481
+ result.push(sanitizeMarkdown(prompt));
13482
+ result.push("```");
13483
+ result.push("");
13484
+ }
13485
+ if (outlineSchema.format) {
13486
+ result.push("");
13487
+ result.push("## Output format");
13488
+ const entries = Object.entries(outlineSchema.format.properties);
13489
+ entries.forEach(([key, { type, description, enum: e }], idx) => {
13490
+ result.push("");
13491
+ result.push(`> **${idx + 1}. ${sanitizeMarkdown(key)}**`);
13492
+ {
13493
+ result.push("");
13494
+ result.push(`*Type:* \`${sanitizeMarkdown(type)}\``);
13495
+ }
13496
+ {
13497
+ result.push("");
13498
+ result.push(`*Description:* \`${sanitizeMarkdown(description)}\``);
13499
+ }
13500
+ if (e) {
13501
+ result.push("");
13502
+ result.push(`*Enum:* \`${e.map(sanitizeMarkdown).join(", ")}\``);
13503
+ }
13504
+ {
13505
+ result.push("");
13506
+ result.push(`*Required:* [${outlineSchema.format.required.includes(key) ? "x" : " "}]`);
13507
+ }
13508
+ });
13509
+ if (!entries.length) {
13510
+ result.push("");
13511
+ result.push(`*Empty parameters*`);
13512
+ }
13513
+ }
13514
+ if (outlineSchema.callbacks) {
13515
+ result.push(`## Used callbacks`);
13516
+ result.push("");
13517
+ const callbackList = Object.keys(outlineSchema.callbacks);
13518
+ for (let i = 0; i !== callbackList.length; i++) {
13519
+ result.push(`${i + 1}. \`${sanitizeMarkdown(callbackList[i])}\``);
13520
+ }
13521
+ result.push("");
13522
+ }
13523
+ await writeFileAtomic(path.join(dirName, `./${outlineSchema.outlineName}.md`), result.join("\n"));
13524
+ }, {
13525
+ maxExec: THREAD_POOL_SIZE,
13526
+ delay: THREAD_POOL_DELAY,
13527
+ });
13399
13528
  /**
13400
13529
  * Writes Markdown documentation for an agent schema, detailing its name, description, UML diagram, prompts, tools, storages, states, and callbacks.
13401
13530
  * Executes in a thread pool (THREAD_POOL_SIZE) to manage concurrency, logging via loggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is enabled.
@@ -13787,6 +13916,14 @@ class DocService {
13787
13916
  const agentSchema = this.agentSchemaService.get(agentName);
13788
13917
  await this.writeAgentDoc(agentSchema, prefix, dirName, sanitizeMarkdown);
13789
13918
  }));
13919
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13920
+ this.loggerService.info("docService dumpDocs building outline docs");
13921
+ await Promise.all(this.outlineValidationService
13922
+ .getOutlineList()
13923
+ .map(async (outlineName) => {
13924
+ const outlineSchema = this.outlineSchemaService.get(outlineName);
13925
+ await this.writeOutlineDoc(outlineSchema, prefix, dirName, sanitizeMarkdown);
13926
+ }));
13790
13927
  };
13791
13928
  /**
13792
13929
  * Dumps system-wide performance data to a JSON file using PerfService.toRecord.
@@ -18197,6 +18334,16 @@ class OutlineValidationService {
18197
18334
  }
18198
18335
  this._outlineMap.set(outlineName, outlineSchema);
18199
18336
  };
18337
+ /**
18338
+ * Retrieves a list of all registered outline names.
18339
+ * Logs the retrieval operation if info logging is enabled.
18340
+ * @returns {OutlineName[]} An array of registered outline names.
18341
+ */
18342
+ this.getOutlineList = () => {
18343
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
18344
+ this.loggerService.info("outlineValidationService getOutlineList");
18345
+ return [...this._outlineMap.keys()];
18346
+ };
18200
18347
  /**
18201
18348
  * Validates the existence of an outline schema for the given outline name.
18202
18349
  * Memoized to cache results based on the outline name for performance.
@@ -18424,6 +18571,9 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
18424
18571
  console.error(`agent-swarm missing dependsOn for agentName=${agentName}`);
18425
18572
  }
18426
18573
  });
18574
+ swarm$1.outlineValidationService
18575
+ .getOutlineList()
18576
+ .forEach((swarmName) => swarm$1.outlineValidationService.validate(swarmName, METHOD_NAME$1x));
18427
18577
  return swarm$1.docService.dumpDocs(prefix, dirName, sanitizeMarkdown);
18428
18578
  });
18429
18579
 
@@ -20954,9 +21104,18 @@ const MAX_ATTEMPTS = 5;
20954
21104
  * @implements {IOutlineHistory }
20955
21105
  */
20956
21106
  class OutlineHistory {
20957
- constructor() {
21107
+ /**
21108
+ * Constructs an OutlineHistory instance, optionally initializing with a system prompt.
21109
+ * @param {string} [prompt] - An optional system prompt to initialize the history with.
21110
+ * @constructor
21111
+ */
21112
+ constructor(prompt) {
20958
21113
  /** @private */
20959
21114
  this.messages = [];
21115
+ prompt && this.messages.push({
21116
+ role: "system",
21117
+ content: prompt
21118
+ });
20960
21119
  }
20961
21120
  /**
20962
21121
  * Appends one or more messages to the history.
@@ -20997,14 +21156,17 @@ class OutlineHistory {
20997
21156
  const jsonInternal = beginContext(async (outlineName, param) => {
20998
21157
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20999
21158
  swarm$1.loggerService.log(METHOD_NAME$D, {});
21159
+ swarm$1.outlineValidationService.validate(outlineName, METHOD_NAME$D);
21000
21160
  const resultId = functoolsKit.randomString();
21001
- const { getStructuredOutput, validations = [], maxAttempts = MAX_ATTEMPTS, callbacks, } = swarm$1.outlineSchemaService.get(outlineName);
21161
+ const { getStructuredOutput, validations = [], maxAttempts = MAX_ATTEMPTS, format, prompt, callbacks, } = swarm$1.outlineSchemaService.get(outlineName);
21002
21162
  let errorMessage = "";
21003
21163
  let history;
21164
+ const systemPrompt = functoolsKit.str.newline(typeof prompt === "function" ? await prompt(outlineName) : prompt);
21004
21165
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
21005
- history = new OutlineHistory();
21166
+ history = new OutlineHistory(systemPrompt);
21006
21167
  const inputArgs = {
21007
21168
  attempt,
21169
+ format,
21008
21170
  param,
21009
21171
  history,
21010
21172
  };
package/build/index.mjs CHANGED
@@ -13209,6 +13209,13 @@ class DocService {
13209
13209
  * @private
13210
13210
  */
13211
13211
  this.agentValidationService = inject(TYPES.agentValidationService);
13212
+ /**
13213
+ * Outline validation service instance, injected via DI.
13214
+ * Used for validating and managing agent outline schemas, ensuring agent outlines conform to expected structure and constraints.
13215
+ * @type {OutlineValidationService}
13216
+ * @private
13217
+ */
13218
+ this.outlineValidationService = inject(TYPES.outlineValidationService);
13212
13219
  /**
13213
13220
  * Swarm schema service instance, injected via DI.
13214
13221
  * Retrieves ISwarmSchema objects for writeSwarmDoc, supplying swarm details like agents and policies.
@@ -13223,6 +13230,13 @@ class DocService {
13223
13230
  * @private
13224
13231
  */
13225
13232
  this.agentSchemaService = inject(TYPES.agentSchemaService);
13233
+ /**
13234
+ * Outline schema service instance, injected via DI.
13235
+ * Retrieves and manages outline schema objects for agents, supporting documentation and validation of agent outlines.
13236
+ * @type {OutlineSchemaService}
13237
+ * @private
13238
+ */
13239
+ this.outlineSchemaService = inject(TYPES.outlineSchemaService);
13226
13240
  /**
13227
13241
  * Model context protocol service instance, injected via DI.
13228
13242
  * Retrieves IMCPSchema objects for writeAgentDoc and agent descriptions in writeSwarmDoc, providing details like tools and prompts.
@@ -13394,6 +13408,121 @@ class DocService {
13394
13408
  maxExec: THREAD_POOL_SIZE,
13395
13409
  delay: THREAD_POOL_DELAY,
13396
13410
  });
13411
+ /**
13412
+ * Writes Markdown documentation for an outline schema, detailing its name, description, main prompt, output format, and callbacks.
13413
+ * Executes in a thread pool (THREAD_POOL_SIZE) to manage concurrency, logging via loggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is enabled.
13414
+ * Outputs to dirName/[outlineName].md, sourced from outlineSchemaService.
13415
+ *
13416
+ * - The Markdown includes YAML frontmatter, outline name, description, prompt(s), output format (with types, descriptions, enums, and required fields), and callbacks.
13417
+ * - Handles both string and function-based prompts, and supports array or string prompt types.
13418
+ * - Output format section documents each property, its type, description, enum values, and required status.
13419
+ * - Callback section lists all callback names used by the outline.
13420
+ *
13421
+ * @param {IOutlineSchema} outlineSchema - The outline schema to document, including properties like prompt, format, and callbacks.
13422
+ * @param {string} prefix - The documentation group or prefix for organizing output.
13423
+ * @param {string} dirName - The base directory for documentation output.
13424
+ * @param {(text: string) => string} [sanitizeMarkdown=(t) => t] - Optional function to sanitize Markdown text.
13425
+ * @returns {Promise<void>} A promise resolving when the outline documentation file is written.
13426
+ * @private
13427
+ */
13428
+ this.writeOutlineDoc = execpool(async (outlineSchema, prefix, dirName, sanitizeMarkdown = (t) => t) => {
13429
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13430
+ this.loggerService.info("docService writeOutlineDoc", {
13431
+ outlineSchema,
13432
+ });
13433
+ const result = [];
13434
+ {
13435
+ result.push("---");
13436
+ result.push(`title: ${prefix}/${sanitizeMarkdown(outlineSchema.outlineName)}`);
13437
+ result.push(`group: ${prefix}`);
13438
+ result.push("---");
13439
+ result.push("");
13440
+ }
13441
+ {
13442
+ result.push(`# ${sanitizeMarkdown(outlineSchema.outlineName)}`);
13443
+ if (outlineSchema.docDescription) {
13444
+ result.push("");
13445
+ result.push(`> ${sanitizeMarkdown(outlineSchema.docDescription)}`);
13446
+ }
13447
+ result.push("");
13448
+ }
13449
+ const getPrompt = async () => {
13450
+ try {
13451
+ if (typeof outlineSchema.prompt === "string") {
13452
+ return outlineSchema.prompt;
13453
+ }
13454
+ if (typeof outlineSchema.prompt === "function") {
13455
+ return await outlineSchema.prompt(outlineSchema.outlineName);
13456
+ }
13457
+ return null;
13458
+ }
13459
+ catch {
13460
+ return null;
13461
+ }
13462
+ };
13463
+ const prompt = await getPrompt();
13464
+ if (Array.isArray(prompt)) {
13465
+ result.push(`## Main prompt`);
13466
+ result.push("");
13467
+ for (let i = 0; i !== prompt.length; i++) {
13468
+ if (!prompt[i]) {
13469
+ continue;
13470
+ }
13471
+ result.push(`${i + 1}. \`${sanitizeMarkdown(prompt[i])}\``);
13472
+ result.push("");
13473
+ }
13474
+ }
13475
+ if (typeof prompt === "string") {
13476
+ result.push(`## Main prompt`);
13477
+ result.push("");
13478
+ result.push("```");
13479
+ result.push(sanitizeMarkdown(prompt));
13480
+ result.push("```");
13481
+ result.push("");
13482
+ }
13483
+ if (outlineSchema.format) {
13484
+ result.push("");
13485
+ result.push("## Output format");
13486
+ const entries = Object.entries(outlineSchema.format.properties);
13487
+ entries.forEach(([key, { type, description, enum: e }], idx) => {
13488
+ result.push("");
13489
+ result.push(`> **${idx + 1}. ${sanitizeMarkdown(key)}**`);
13490
+ {
13491
+ result.push("");
13492
+ result.push(`*Type:* \`${sanitizeMarkdown(type)}\``);
13493
+ }
13494
+ {
13495
+ result.push("");
13496
+ result.push(`*Description:* \`${sanitizeMarkdown(description)}\``);
13497
+ }
13498
+ if (e) {
13499
+ result.push("");
13500
+ result.push(`*Enum:* \`${e.map(sanitizeMarkdown).join(", ")}\``);
13501
+ }
13502
+ {
13503
+ result.push("");
13504
+ result.push(`*Required:* [${outlineSchema.format.required.includes(key) ? "x" : " "}]`);
13505
+ }
13506
+ });
13507
+ if (!entries.length) {
13508
+ result.push("");
13509
+ result.push(`*Empty parameters*`);
13510
+ }
13511
+ }
13512
+ if (outlineSchema.callbacks) {
13513
+ result.push(`## Used callbacks`);
13514
+ result.push("");
13515
+ const callbackList = Object.keys(outlineSchema.callbacks);
13516
+ for (let i = 0; i !== callbackList.length; i++) {
13517
+ result.push(`${i + 1}. \`${sanitizeMarkdown(callbackList[i])}\``);
13518
+ }
13519
+ result.push("");
13520
+ }
13521
+ await writeFileAtomic(join(dirName, `./${outlineSchema.outlineName}.md`), result.join("\n"));
13522
+ }, {
13523
+ maxExec: THREAD_POOL_SIZE,
13524
+ delay: THREAD_POOL_DELAY,
13525
+ });
13397
13526
  /**
13398
13527
  * Writes Markdown documentation for an agent schema, detailing its name, description, UML diagram, prompts, tools, storages, states, and callbacks.
13399
13528
  * Executes in a thread pool (THREAD_POOL_SIZE) to manage concurrency, logging via loggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is enabled.
@@ -13785,6 +13914,14 @@ class DocService {
13785
13914
  const agentSchema = this.agentSchemaService.get(agentName);
13786
13915
  await this.writeAgentDoc(agentSchema, prefix, dirName, sanitizeMarkdown);
13787
13916
  }));
13917
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13918
+ this.loggerService.info("docService dumpDocs building outline docs");
13919
+ await Promise.all(this.outlineValidationService
13920
+ .getOutlineList()
13921
+ .map(async (outlineName) => {
13922
+ const outlineSchema = this.outlineSchemaService.get(outlineName);
13923
+ await this.writeOutlineDoc(outlineSchema, prefix, dirName, sanitizeMarkdown);
13924
+ }));
13788
13925
  };
13789
13926
  /**
13790
13927
  * Dumps system-wide performance data to a JSON file using PerfService.toRecord.
@@ -18195,6 +18332,16 @@ class OutlineValidationService {
18195
18332
  }
18196
18333
  this._outlineMap.set(outlineName, outlineSchema);
18197
18334
  };
18335
+ /**
18336
+ * Retrieves a list of all registered outline names.
18337
+ * Logs the retrieval operation if info logging is enabled.
18338
+ * @returns {OutlineName[]} An array of registered outline names.
18339
+ */
18340
+ this.getOutlineList = () => {
18341
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
18342
+ this.loggerService.info("outlineValidationService getOutlineList");
18343
+ return [...this._outlineMap.keys()];
18344
+ };
18198
18345
  /**
18199
18346
  * Validates the existence of an outline schema for the given outline name.
18200
18347
  * Memoized to cache results based on the outline name for performance.
@@ -18422,6 +18569,9 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
18422
18569
  console.error(`agent-swarm missing dependsOn for agentName=${agentName}`);
18423
18570
  }
18424
18571
  });
18572
+ swarm$1.outlineValidationService
18573
+ .getOutlineList()
18574
+ .forEach((swarmName) => swarm$1.outlineValidationService.validate(swarmName, METHOD_NAME$1x));
18425
18575
  return swarm$1.docService.dumpDocs(prefix, dirName, sanitizeMarkdown);
18426
18576
  });
18427
18577
 
@@ -20952,9 +21102,18 @@ const MAX_ATTEMPTS = 5;
20952
21102
  * @implements {IOutlineHistory }
20953
21103
  */
20954
21104
  class OutlineHistory {
20955
- constructor() {
21105
+ /**
21106
+ * Constructs an OutlineHistory instance, optionally initializing with a system prompt.
21107
+ * @param {string} [prompt] - An optional system prompt to initialize the history with.
21108
+ * @constructor
21109
+ */
21110
+ constructor(prompt) {
20956
21111
  /** @private */
20957
21112
  this.messages = [];
21113
+ prompt && this.messages.push({
21114
+ role: "system",
21115
+ content: prompt
21116
+ });
20958
21117
  }
20959
21118
  /**
20960
21119
  * Appends one or more messages to the history.
@@ -20995,14 +21154,17 @@ class OutlineHistory {
20995
21154
  const jsonInternal = beginContext(async (outlineName, param) => {
20996
21155
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20997
21156
  swarm$1.loggerService.log(METHOD_NAME$D, {});
21157
+ swarm$1.outlineValidationService.validate(outlineName, METHOD_NAME$D);
20998
21158
  const resultId = randomString();
20999
- const { getStructuredOutput, validations = [], maxAttempts = MAX_ATTEMPTS, callbacks, } = swarm$1.outlineSchemaService.get(outlineName);
21159
+ const { getStructuredOutput, validations = [], maxAttempts = MAX_ATTEMPTS, format, prompt, callbacks, } = swarm$1.outlineSchemaService.get(outlineName);
21000
21160
  let errorMessage = "";
21001
21161
  let history;
21162
+ const systemPrompt = str.newline(typeof prompt === "function" ? await prompt(outlineName) : prompt);
21002
21163
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
21003
- history = new OutlineHistory();
21164
+ history = new OutlineHistory(systemPrompt);
21004
21165
  const inputArgs = {
21005
21166
  attempt,
21167
+ format,
21006
21168
  param,
21007
21169
  history,
21008
21170
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.1.113",
3
+ "version": "1.1.114",
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
@@ -4736,6 +4736,41 @@ type IOutlineParam = any;
4736
4736
  * @typedef {any} IOutlineData
4737
4737
  */
4738
4738
  type IOutlineData = any;
4739
+ /**
4740
+ * Interface representing the format/schema definition for outline data.
4741
+ * Specifies the structure, required fields, and property metadata for outline operations.
4742
+ * Used to enforce and document the expected shape of outline data.
4743
+ */
4744
+ interface IOutlineFormat {
4745
+ /**
4746
+ * The root type of the outline format (e.g., "object").
4747
+ */
4748
+ type: string;
4749
+ /**
4750
+ * Array of property names that are required in the outline data.
4751
+ */
4752
+ required: string[];
4753
+ /**
4754
+ * An object mapping property names to their type, description, and optional enum values.
4755
+ * Each property describes a field in the outline data.
4756
+ */
4757
+ properties: {
4758
+ [key: string]: {
4759
+ /**
4760
+ * The type of the property (e.g., "string", "number", "boolean", etc.).
4761
+ */
4762
+ type: string;
4763
+ /**
4764
+ * A human-readable description of the property.
4765
+ */
4766
+ description: string;
4767
+ /**
4768
+ * Optional array of allowed values for the property.
4769
+ */
4770
+ enum?: string[];
4771
+ };
4772
+ };
4773
+ }
4739
4774
  /**
4740
4775
  * Interface defining callbacks for outline lifecycle events.
4741
4776
  * Provides hooks for handling attempt initiation, document generation, and validation outcomes.
@@ -4832,6 +4867,10 @@ interface IOutlineArgs<Param extends IOutlineParam = IOutlineParam> {
4832
4867
  * @type {number}
4833
4868
  */
4834
4869
  attempt: number;
4870
+ /**
4871
+ * Format of output taken from outline schema
4872
+ */
4873
+ format: IOutlineFormat;
4835
4874
  /**
4836
4875
  * The history management API for the outline operation.
4837
4876
  * Provides access to message history for context or logging.
@@ -4947,6 +4986,14 @@ interface IOutlineResult<Data extends IOutlineData = IOutlineData, Param extends
4947
4986
  * @interface IOutlineSchema
4948
4987
  */
4949
4988
  interface IOutlineSchema<Data extends IOutlineData = IOutlineData, Param extends IOutlineParam = IOutlineParam> {
4989
+ /**
4990
+ * The prompt or prompt generator for the outline operation.
4991
+ * Can be a string, an array of strings, or a function that returns a string, array of strings, or a promise resolving to either.
4992
+ * If a function is provided, it receives the outline name and can return a prompt dynamically.
4993
+ * Used as the initial instruction or context for the outline process.
4994
+ * @type {string | string[] | ((outlineName: OutlineName) => (string | string[] | Promise<string | string[]>))}
4995
+ */
4996
+ prompt: string | string[] | ((outlineName: OutlineName) => (string | string[] | Promise<string | string[]>));
4950
4997
  /**
4951
4998
  * Optional description for documentation purposes.
4952
4999
  * Aids in understanding the purpose or behavior of the outline.
@@ -4972,6 +5019,12 @@ interface IOutlineSchema<Data extends IOutlineData = IOutlineData, Param extends
4972
5019
  * @type {(IOutlineValidation<Data, Param> | IOutlineValidationFn<Data, Param>)[]}
4973
5020
  */
4974
5021
  validations?: (IOutlineValidation<Data, Param> | IOutlineValidationFn<Data, Param>)[];
5022
+ /**
5023
+ * The format/schema definition for the outline data.
5024
+ * Specifies the expected structure, required fields, and property metadata for validation and documentation.
5025
+ * @type {IOutlineFormat}
5026
+ */
5027
+ format: IOutlineFormat;
4975
5028
  /**
4976
5029
  * Optional maximum number of attempts for the outline operation.
4977
5030
  * Limits the number of retries if validations fail.
@@ -8457,6 +8510,13 @@ declare class DocService {
8457
8510
  * @private
8458
8511
  */
8459
8512
  private readonly agentValidationService;
8513
+ /**
8514
+ * Outline validation service instance, injected via DI.
8515
+ * Used for validating and managing agent outline schemas, ensuring agent outlines conform to expected structure and constraints.
8516
+ * @type {OutlineValidationService}
8517
+ * @private
8518
+ */
8519
+ private readonly outlineValidationService;
8460
8520
  /**
8461
8521
  * Swarm schema service instance, injected via DI.
8462
8522
  * Retrieves ISwarmSchema objects for writeSwarmDoc, supplying swarm details like agents and policies.
@@ -8471,6 +8531,13 @@ declare class DocService {
8471
8531
  * @private
8472
8532
  */
8473
8533
  private readonly agentSchemaService;
8534
+ /**
8535
+ * Outline schema service instance, injected via DI.
8536
+ * Retrieves and manages outline schema objects for agents, supporting documentation and validation of agent outlines.
8537
+ * @type {OutlineSchemaService}
8538
+ * @private
8539
+ */
8540
+ private readonly outlineSchemaService;
8474
8541
  /**
8475
8542
  * Model context protocol service instance, injected via DI.
8476
8543
  * Retrieves IMCPSchema objects for writeAgentDoc and agent descriptions in writeSwarmDoc, providing details like tools and prompts.
@@ -8551,6 +8618,24 @@ declare class DocService {
8551
8618
  * @private
8552
8619
  */
8553
8620
  private writeSwarmDoc;
8621
+ /**
8622
+ * Writes Markdown documentation for an outline schema, detailing its name, description, main prompt, output format, and callbacks.
8623
+ * Executes in a thread pool (THREAD_POOL_SIZE) to manage concurrency, logging via loggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is enabled.
8624
+ * Outputs to dirName/[outlineName].md, sourced from outlineSchemaService.
8625
+ *
8626
+ * - The Markdown includes YAML frontmatter, outline name, description, prompt(s), output format (with types, descriptions, enums, and required fields), and callbacks.
8627
+ * - Handles both string and function-based prompts, and supports array or string prompt types.
8628
+ * - Output format section documents each property, its type, description, enum values, and required status.
8629
+ * - Callback section lists all callback names used by the outline.
8630
+ *
8631
+ * @param {IOutlineSchema} outlineSchema - The outline schema to document, including properties like prompt, format, and callbacks.
8632
+ * @param {string} prefix - The documentation group or prefix for organizing output.
8633
+ * @param {string} dirName - The base directory for documentation output.
8634
+ * @param {(text: string) => string} [sanitizeMarkdown=(t) => t] - Optional function to sanitize Markdown text.
8635
+ * @returns {Promise<void>} A promise resolving when the outline documentation file is written.
8636
+ * @private
8637
+ */
8638
+ private writeOutlineDoc;
8554
8639
  /**
8555
8640
  * Writes Markdown documentation for an agent schema, detailing its name, description, UML diagram, prompts, tools, storages, states, and callbacks.
8556
8641
  * Executes in a thread pool (THREAD_POOL_SIZE) to manage concurrency, logging via loggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is enabled.
@@ -11151,6 +11236,12 @@ declare class OutlineValidationService {
11151
11236
  * @throws {Error} If an outline with the given name already exists in the map.
11152
11237
  */
11153
11238
  addOutline: (outlineName: OutlineName, outlineSchema: IOutlineSchema) => void;
11239
+ /**
11240
+ * Retrieves a list of all registered outline names.
11241
+ * Logs the retrieval operation if info logging is enabled.
11242
+ * @returns {OutlineName[]} An array of registered outline names.
11243
+ */
11244
+ getOutlineList: () => OutlineName[];
11154
11245
  /**
11155
11246
  * Validates the existence of an outline schema for the given outline name.
11156
11247
  * Memoized to cache results based on the outline name for performance.
@@ -15557,4 +15648,4 @@ declare const Utils: {
15557
15648
  PersistEmbeddingUtils: typeof PersistEmbeddingUtils;
15558
15649
  };
15559
15650
 
15560
- export { Adapter, Chat, ChatInstance, Compute, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAgentSchemaInternal, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type IChatArgs, type IChatInstance, type IChatInstanceCallbacks, type ICompletionArgs, type ICompletionSchema, type IComputeSchema, type ICustomEvent, type IEmbeddingSchema, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMCPSchema, type IMCPTool, type IMCPToolCallDto, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type INavigateToAgentParams, type INavigateToTriageParams, type IOutgoingMessage, type IOutlineHistory, type IOutlineMessage, type IOutlineResult, type IOutlineSchema, type IOutlineValidationFn, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPipelineSchema, type IPolicySchema, type ISessionConfig, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, type IWikiSchema, Logger, LoggerInstance, MCP, type MCPToolProperties, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, SchemaContextService, type SendMessageFn, SharedCompute, SharedState, SharedStorage, State, Storage, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addOutline, addPipeline, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitToolRequest, commitToolRequestForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, fork, getAgent, getAgentHistory, getAgentName, getAssistantHistory, getCheckBusy, getCompletion, getCompute, getEmbeding, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getMCP, getNavigationRoute, getPayload, getPipeline, getPolicy, getRawHistory, getSessionContext, getSessionMode, getState, getStorage, getSwarm, getTool, getToolNameForModel, getUserHistory, getWiki, hasNavigation, hasSession, json, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overrideOutline, overridePipeline, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, scope, session, setConfig, startPipeline, swarm };
15651
+ export { Adapter, Chat, ChatInstance, Compute, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAgentSchemaInternal, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type IChatArgs, type IChatInstance, type IChatInstanceCallbacks, type ICompletionArgs, type ICompletionSchema, type IComputeSchema, type ICustomEvent, type IEmbeddingSchema, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMCPSchema, type IMCPTool, type IMCPToolCallDto, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type INavigateToAgentParams, type INavigateToTriageParams, type IOutgoingMessage, type IOutlineFormat, type IOutlineHistory, type IOutlineMessage, type IOutlineResult, type IOutlineSchema, type IOutlineValidationFn, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPipelineSchema, type IPolicySchema, type ISessionConfig, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, type IWikiSchema, Logger, LoggerInstance, MCP, type MCPToolProperties, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, SchemaContextService, type SendMessageFn, SharedCompute, SharedState, SharedStorage, State, Storage, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addOutline, addPipeline, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitToolRequest, commitToolRequestForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, fork, getAgent, getAgentHistory, getAgentName, getAssistantHistory, getCheckBusy, getCompletion, getCompute, getEmbeding, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getMCP, getNavigationRoute, getPayload, getPipeline, getPolicy, getRawHistory, getSessionContext, getSessionMode, getState, getStorage, getSwarm, getTool, getToolNameForModel, getUserHistory, getWiki, hasNavigation, hasSession, json, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overrideOutline, overridePipeline, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, scope, session, setConfig, startPipeline, swarm };