@aigne/agent-library 1.24.0 → 1.74.0-beta

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.
Files changed (163) hide show
  1. package/README.md +12 -12
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/agent-skill-manager/index.cjs +30 -0
  4. package/dist/agent-skill-manager/index.d.cts +14 -0
  5. package/dist/agent-skill-manager/index.d.cts.map +1 -0
  6. package/dist/agent-skill-manager/index.d.mts +14 -0
  7. package/dist/agent-skill-manager/index.d.mts.map +1 -0
  8. package/dist/agent-skill-manager/index.mjs +30 -0
  9. package/dist/agent-skill-manager/index.mjs.map +1 -0
  10. package/{lib/esm/agent-skill-manager/prompt.js → dist/agent-skill-manager/prompt.cjs} +8 -3
  11. package/{lib/cjs/agent-skill-manager/prompt.js → dist/agent-skill-manager/prompt.mjs} +8 -6
  12. package/dist/agent-skill-manager/prompt.mjs.map +1 -0
  13. package/dist/ask-user-question/index.cjs +88 -0
  14. package/dist/ask-user-question/index.d.cts +33 -0
  15. package/dist/ask-user-question/index.d.cts.map +1 -0
  16. package/dist/ask-user-question/index.d.mts +33 -0
  17. package/dist/ask-user-question/index.d.mts.map +1 -0
  18. package/dist/ask-user-question/index.mjs +88 -0
  19. package/dist/ask-user-question/index.mjs.map +1 -0
  20. package/dist/bash/index.cjs +274 -0
  21. package/dist/bash/index.d.cts +184 -0
  22. package/dist/bash/index.d.cts.map +1 -0
  23. package/dist/bash/index.d.mts +184 -0
  24. package/dist/bash/index.d.mts.map +1 -0
  25. package/dist/bash/index.mjs +271 -0
  26. package/dist/bash/index.mjs.map +1 -0
  27. package/{lib/esm/bash/prompt.js → dist/bash/prompt.cjs} +6 -1
  28. package/{lib/cjs/bash/prompt.js → dist/bash/prompt.mjs} +6 -4
  29. package/dist/bash/prompt.mjs.map +1 -0
  30. package/dist/data-mapper/agents/mapper.cjs +62 -0
  31. package/dist/data-mapper/agents/mapper.mjs +62 -0
  32. package/dist/data-mapper/agents/mapper.mjs.map +1 -0
  33. package/dist/data-mapper/agents/reviewer.cjs +46 -0
  34. package/dist/data-mapper/agents/reviewer.mjs +46 -0
  35. package/dist/data-mapper/agents/reviewer.mjs.map +1 -0
  36. package/dist/data-mapper/index.cjs +25 -0
  37. package/dist/data-mapper/index.d.cts +26 -0
  38. package/dist/data-mapper/index.d.cts.map +1 -0
  39. package/dist/data-mapper/index.d.mts +26 -0
  40. package/dist/data-mapper/index.d.mts.map +1 -0
  41. package/dist/data-mapper/index.mjs +24 -0
  42. package/dist/data-mapper/index.mjs.map +1 -0
  43. package/{lib/esm/data-mapper/prompts.js → dist/data-mapper/prompts.cjs} +6 -1
  44. package/{lib/cjs/data-mapper/prompts.js → dist/data-mapper/prompts.mjs} +6 -4
  45. package/dist/data-mapper/prompts.mjs.map +1 -0
  46. package/dist/data-mapper/tools.cjs +119 -0
  47. package/dist/data-mapper/tools.d.cts +5 -0
  48. package/dist/data-mapper/tools.d.cts.map +1 -0
  49. package/dist/data-mapper/tools.d.mts +8 -0
  50. package/dist/data-mapper/tools.d.mts.map +1 -0
  51. package/dist/data-mapper/tools.mjs +117 -0
  52. package/dist/data-mapper/tools.mjs.map +1 -0
  53. package/dist/index.cjs +0 -0
  54. package/dist/index.d.cts +1 -0
  55. package/dist/index.d.mts +1 -0
  56. package/dist/index.mjs +1 -0
  57. package/dist/orchestrator/index.cjs +233 -0
  58. package/dist/orchestrator/index.d.cts +89 -0
  59. package/dist/orchestrator/index.d.cts.map +1 -0
  60. package/dist/orchestrator/index.d.mts +89 -0
  61. package/dist/orchestrator/index.d.mts.map +1 -0
  62. package/dist/orchestrator/index.mjs +230 -0
  63. package/dist/orchestrator/index.mjs.map +1 -0
  64. package/{lib/cjs/orchestrator/prompt.js → dist/orchestrator/prompt.cjs} +32 -28
  65. package/{lib/esm/orchestrator/prompt.js → dist/orchestrator/prompt.mjs} +30 -25
  66. package/dist/orchestrator/prompt.mjs.map +1 -0
  67. package/dist/orchestrator/type.cjs +74 -0
  68. package/dist/orchestrator/type.d.cts +27 -0
  69. package/dist/orchestrator/type.d.cts.map +1 -0
  70. package/dist/orchestrator/type.d.mts +27 -0
  71. package/dist/orchestrator/type.d.mts.map +1 -0
  72. package/dist/orchestrator/type.mjs +67 -0
  73. package/dist/orchestrator/type.mjs.map +1 -0
  74. package/dist/utils/fs.cjs +23 -0
  75. package/dist/utils/fs.d.cts +6 -0
  76. package/dist/utils/fs.d.cts.map +1 -0
  77. package/dist/utils/fs.d.mts +6 -0
  78. package/dist/utils/fs.d.mts.map +1 -0
  79. package/dist/utils/fs.mjs +22 -0
  80. package/dist/utils/fs.mjs.map +1 -0
  81. package/dist/utils/mutex.cjs +28 -0
  82. package/dist/utils/mutex.d.cts +10 -0
  83. package/dist/utils/mutex.d.cts.map +1 -0
  84. package/dist/utils/mutex.d.mts +10 -0
  85. package/dist/utils/mutex.d.mts.map +1 -0
  86. package/dist/utils/mutex.mjs +28 -0
  87. package/dist/utils/mutex.mjs.map +1 -0
  88. package/package.json +51 -35
  89. package/CHANGELOG.md +0 -2392
  90. package/lib/cjs/agent-skill-manager/index.d.ts +0 -10
  91. package/lib/cjs/agent-skill-manager/index.js +0 -26
  92. package/lib/cjs/agent-skill-manager/prompt.d.ts +0 -1
  93. package/lib/cjs/ask-user-question/index.d.ts +0 -28
  94. package/lib/cjs/ask-user-question/index.js +0 -108
  95. package/lib/cjs/bash/index.d.ts +0 -180
  96. package/lib/cjs/bash/index.js +0 -365
  97. package/lib/cjs/bash/prompt.d.ts +0 -1
  98. package/lib/cjs/data-mapper/agents/mapper.d.ts +0 -14
  99. package/lib/cjs/data-mapper/agents/mapper.js +0 -63
  100. package/lib/cjs/data-mapper/agents/reviewer.d.ts +0 -19
  101. package/lib/cjs/data-mapper/agents/reviewer.js +0 -47
  102. package/lib/cjs/data-mapper/index.d.ts +0 -18
  103. package/lib/cjs/data-mapper/index.js +0 -24
  104. package/lib/cjs/data-mapper/prompts.d.ts +0 -1
  105. package/lib/cjs/data-mapper/tools.d.ts +0 -11
  106. package/lib/cjs/data-mapper/tools.js +0 -164
  107. package/lib/cjs/index.d.ts +0 -1
  108. package/lib/cjs/index.js +0 -2
  109. package/lib/cjs/orchestrator/index.d.ts +0 -78
  110. package/lib/cjs/orchestrator/index.js +0 -277
  111. package/lib/cjs/orchestrator/prompt.d.ts +0 -3
  112. package/lib/cjs/orchestrator/type.d.ts +0 -388
  113. package/lib/cjs/orchestrator/type.js +0 -95
  114. package/lib/cjs/package.json +0 -3
  115. package/lib/cjs/utils/fs.d.ts +0 -2
  116. package/lib/cjs/utils/fs.js +0 -25
  117. package/lib/cjs/utils/mutex.d.ts +0 -6
  118. package/lib/cjs/utils/mutex.js +0 -28
  119. package/lib/dts/agent-skill-manager/index.d.ts +0 -10
  120. package/lib/dts/agent-skill-manager/prompt.d.ts +0 -1
  121. package/lib/dts/ask-user-question/index.d.ts +0 -28
  122. package/lib/dts/bash/index.d.ts +0 -180
  123. package/lib/dts/bash/prompt.d.ts +0 -1
  124. package/lib/dts/data-mapper/agents/mapper.d.ts +0 -14
  125. package/lib/dts/data-mapper/agents/reviewer.d.ts +0 -19
  126. package/lib/dts/data-mapper/index.d.ts +0 -18
  127. package/lib/dts/data-mapper/prompts.d.ts +0 -1
  128. package/lib/dts/data-mapper/tools.d.ts +0 -11
  129. package/lib/dts/index.d.ts +0 -1
  130. package/lib/dts/orchestrator/index.d.ts +0 -78
  131. package/lib/dts/orchestrator/prompt.d.ts +0 -3
  132. package/lib/dts/orchestrator/type.d.ts +0 -388
  133. package/lib/dts/utils/fs.d.ts +0 -2
  134. package/lib/dts/utils/mutex.d.ts +0 -6
  135. package/lib/esm/agent-skill-manager/index.d.ts +0 -10
  136. package/lib/esm/agent-skill-manager/index.js +0 -23
  137. package/lib/esm/agent-skill-manager/prompt.d.ts +0 -1
  138. package/lib/esm/ask-user-question/index.d.ts +0 -28
  139. package/lib/esm/ask-user-question/index.js +0 -105
  140. package/lib/esm/bash/index.d.ts +0 -180
  141. package/lib/esm/bash/index.js +0 -328
  142. package/lib/esm/bash/prompt.d.ts +0 -1
  143. package/lib/esm/data-mapper/agents/mapper.d.ts +0 -14
  144. package/lib/esm/data-mapper/agents/mapper.js +0 -61
  145. package/lib/esm/data-mapper/agents/reviewer.d.ts +0 -19
  146. package/lib/esm/data-mapper/agents/reviewer.js +0 -45
  147. package/lib/esm/data-mapper/index.d.ts +0 -18
  148. package/lib/esm/data-mapper/index.js +0 -16
  149. package/lib/esm/data-mapper/prompts.d.ts +0 -1
  150. package/lib/esm/data-mapper/tools.d.ts +0 -11
  151. package/lib/esm/data-mapper/tools.js +0 -155
  152. package/lib/esm/index.d.ts +0 -1
  153. package/lib/esm/index.js +0 -1
  154. package/lib/esm/orchestrator/index.d.ts +0 -78
  155. package/lib/esm/orchestrator/index.js +0 -240
  156. package/lib/esm/orchestrator/prompt.d.ts +0 -3
  157. package/lib/esm/orchestrator/type.d.ts +0 -388
  158. package/lib/esm/orchestrator/type.js +0 -89
  159. package/lib/esm/package.json +0 -3
  160. package/lib/esm/utils/fs.d.ts +0 -2
  161. package/lib/esm/utils/fs.js +0 -21
  162. package/lib/esm/utils/mutex.d.ts +0 -6
  163. package/lib/esm/utils/mutex.js +0 -24
package/README.md CHANGED
@@ -2,28 +2,28 @@
2
2
 
3
3
  <p align="center">
4
4
  <picture>
5
- <source srcset="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/logo-dark.svg" media="(prefers-color-scheme: dark)">
6
- <source srcset="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/logo.svg" media="(prefers-color-scheme: light)">
7
- <img src="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/logo.svg" alt="AIGNE Logo" width="400" />
5
+ <source srcset="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/logo-dark.svg" media="(prefers-color-scheme: dark)">
6
+ <source srcset="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/logo.svg" media="(prefers-color-scheme: light)">
7
+ <img src="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/logo.svg" alt="AIGNE Logo" width="400" />
8
8
  </picture>
9
9
  </p>
10
10
 
11
- [![GitHub star chart](https://img.shields.io/github/stars/AIGNE-io/aigne-framework?style=flat-square)](https://star-history.com/#AIGNE-io/aigne-framework)
12
- [![Open Issues](https://img.shields.io/github/issues-raw/AIGNE-io/aigne-framework?style=flat-square)](https://github.com/AIGNE-io/aigne-framework/issues)
13
- [![codecov](https://codecov.io/gh/AIGNE-io/aigne-framework/graph/badge.svg?token=DO07834RQL)](https://codecov.io/gh/AIGNE-io/aigne-framework)
11
+ [![GitHub star chart](https://img.shields.io/github/stars/ArcBlock/aigne-framework?style=flat-square)](https://star-history.com/#ArcBlock/aigne-framework)
12
+ [![Open Issues](https://img.shields.io/github/issues-raw/ArcBlock/aigne-framework?style=flat-square)](https://github.com/ArcBlock/aigne-framework/issues)
13
+ [![codecov](https://codecov.io/gh/ArcBlock/aigne-framework/graph/badge.svg?token=DO07834RQL)](https://codecov.io/gh/ArcBlock/aigne-framework)
14
14
  [![NPM Version](https://img.shields.io/npm/v/@aigne/agent-library)](https://www.npmjs.com/package/@aigne/agent-library)
15
- [![Elastic-2.0 licensed](https://img.shields.io/npm/l/@aigne/agent-library)](https://github.com/AIGNE-io/aigne-framework/blob/main/LICENSE)
15
+ [![Elastic-2.0 licensed](https://img.shields.io/npm/l/@aigne/agent-library)](https://github.com/ArcBlock/aigne-framework/blob/main/LICENSE)
16
16
 
17
- Collection of agent libraries for [AIGNE Framework](https://github.com/AIGNE-io/aigne-framework), providing pre-built agent implementations.
17
+ Collection of agent libraries for [AIGNE Framework](https://github.com/ArcBlock/aigne-framework), providing pre-built agent implementations.
18
18
 
19
19
  ## Introduction
20
20
 
21
- `@aigne/agent-library` is a collection of agent libraries for [AIGNE Framework](https://github.com/AIGNE-io/aigne-framework), providing pre-built agent implementations for developers. The library is built on top of [@aigne/core](https://github.com/AIGNE-io/aigne-framework/tree/main/packages/core), extending the core functionality to simplify complex workflow orchestration.
21
+ `@aigne/agent-library` is a collection of agent libraries for [AIGNE Framework](https://github.com/ArcBlock/aigne-framework), providing pre-built agent implementations for developers. The library is built on top of [@aigne/core](https://github.com/ArcBlock/aigne-framework/tree/main/packages/core), extending the core functionality to simplify complex workflow orchestration.
22
22
 
23
23
  <picture>
24
- <source srcset="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/assets/aigne-libs-dark.png" media="(prefers-color-scheme: dark)">
25
- <source srcset="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/assets/aigne-libs.png" media="(prefers-color-scheme: light)">
26
- <img src="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/aigne-libs.png" alt="AIGNE Arch" />
24
+ <source srcset="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/assets/aigne-libs-dark.png" media="(prefers-color-scheme: dark)">
25
+ <source srcset="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/assets/aigne-libs.png" media="(prefers-color-scheme: light)">
26
+ <img src="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/aigne-libs.png" alt="AIGNE Arch" />
27
27
  </picture>
28
28
 
29
29
  ## Features
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
@@ -0,0 +1,30 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_prompt = require('./prompt.cjs');
3
+ let _aigne_core = require("@aigne/core");
4
+
5
+ //#region src/agent-skill-manager/index.ts
6
+ var AgentSkillManagerAgent = class extends _aigne_core.AIAgent {
7
+ static async load(options) {
8
+ const valid = await _aigne_core.AIAgent.schema(options).parseAsync(options.parsed);
9
+ return _aigne_core.AIAgent.load({
10
+ ...options,
11
+ parsed: {
12
+ ...options.parsed,
13
+ instructions: valid.instructions || [{
14
+ role: "system",
15
+ content: require_prompt.AgentSkillManagerSystemPrompt,
16
+ path: options.filepath
17
+ }]
18
+ }
19
+ });
20
+ }
21
+ constructor(options) {
22
+ super({
23
+ ...options,
24
+ instructions: options.instructions || require_prompt.AgentSkillManagerSystemPrompt
25
+ });
26
+ }
27
+ };
28
+
29
+ //#endregion
30
+ module.exports = AgentSkillManagerAgent;
@@ -0,0 +1,14 @@
1
+ import { AIAgent, AIAgentOptions, Agent, Message } from "@aigne/core";
2
+
3
+ //#region src/agent-skill-manager/index.d.ts
4
+ interface AgentSkillManagerOptions<I extends Message = Message, O extends Message = Message> extends AIAgentOptions<I, O> {}
5
+ declare class AgentSkillManagerAgent<I extends Message = Message, O extends Message = Message> extends AIAgent<I, O> {
6
+ static load<I extends Message = any, O extends Message = any>(options: {
7
+ filepath: string;
8
+ parsed: object;
9
+ }): Promise<Agent<I, O>>;
10
+ constructor(options: AgentSkillManagerOptions<I, O>);
11
+ }
12
+ //#endregion
13
+ export { AgentSkillManagerOptions, AgentSkillManagerAgent as default };
14
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/agent-skill-manager/index.ts"],"mappings":";;;UASiB,wBAAA,WAAmC,OAAA,GAAU,OAAA,YAAmB,OAAA,GAAU,OAAA,UACjF,cAAA,CAAe,CAAA,EAAG,CAAA;AAAA,cAEP,sBAAA,WACT,OAAA,GAAU,OAAA,YACV,OAAA,GAAU,OAAA,UACZ,OAAA,CAAQ,CAAA,EAAG,CAAA;EAAA,OAAA,IAAA,WACkB,OAAA,kBAAyB,OAAA,OAAA,CAAA,OAAA;IAAA,QAAA;IAAA,MAAA;EAAA,IAG1D,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,CAAA;EAAA,YAAA,OAAA,EAcA,wBAAA,CAAyB,CAAA,EAAG,CAAA;AAAA"}
@@ -0,0 +1,14 @@
1
+ import { AIAgent, AIAgentOptions, Agent, Message } from "@aigne/core";
2
+
3
+ //#region src/agent-skill-manager/index.d.ts
4
+ interface AgentSkillManagerOptions<I extends Message = Message, O extends Message = Message> extends AIAgentOptions<I, O> {}
5
+ declare class AgentSkillManagerAgent<I extends Message = Message, O extends Message = Message> extends AIAgent<I, O> {
6
+ static load<I extends Message = any, O extends Message = any>(options: {
7
+ filepath: string;
8
+ parsed: object;
9
+ }): Promise<Agent<I, O>>;
10
+ constructor(options: AgentSkillManagerOptions<I, O>);
11
+ }
12
+ //#endregion
13
+ export { AgentSkillManagerOptions, AgentSkillManagerAgent as default };
14
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/agent-skill-manager/index.ts"],"mappings":";;;UASiB,wBAAA,WAAmC,OAAA,GAAU,OAAA,YAAmB,OAAA,GAAU,OAAA,UACjF,cAAA,CAAe,CAAA,EAAG,CAAA;AAAA,cAEP,sBAAA,WACT,OAAA,GAAU,OAAA,YACV,OAAA,GAAU,OAAA,UACZ,OAAA,CAAQ,CAAA,EAAG,CAAA;EAAA,OAAA,IAAA,WACkB,OAAA,kBAAyB,OAAA,OAAA,CAAA,OAAA;IAAA,QAAA;IAAA,MAAA;EAAA,IAG1D,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,CAAA;EAAA,YAAA,OAAA,EAcA,wBAAA,CAAyB,CAAA,EAAG,CAAA;AAAA"}
@@ -0,0 +1,30 @@
1
+ import { AgentSkillManagerSystemPrompt } from "./prompt.mjs";
2
+ import { AIAgent } from "@aigne/core";
3
+
4
+ //#region src/agent-skill-manager/index.ts
5
+ var AgentSkillManagerAgent = class extends AIAgent {
6
+ static async load(options) {
7
+ const valid = await AIAgent.schema(options).parseAsync(options.parsed);
8
+ return AIAgent.load({
9
+ ...options,
10
+ parsed: {
11
+ ...options.parsed,
12
+ instructions: valid.instructions || [{
13
+ role: "system",
14
+ content: AgentSkillManagerSystemPrompt,
15
+ path: options.filepath
16
+ }]
17
+ }
18
+ });
19
+ }
20
+ constructor(options) {
21
+ super({
22
+ ...options,
23
+ instructions: options.instructions || AgentSkillManagerSystemPrompt
24
+ });
25
+ }
26
+ };
27
+
28
+ //#endregion
29
+ export { AgentSkillManagerAgent as default };
30
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/agent-skill-manager/index.ts"],"sourcesContent":["import {\n type Agent,\n AIAgent,\n type AIAgentLoadSchema,\n type AIAgentOptions,\n type Message,\n} from \"@aigne/core\";\nimport { AgentSkillManagerSystemPrompt } from \"./prompt.js\";\n\nexport interface AgentSkillManagerOptions<I extends Message = Message, O extends Message = Message>\n extends AIAgentOptions<I, O> {}\n\nexport default class AgentSkillManagerAgent<\n I extends Message = Message,\n O extends Message = Message,\n> extends AIAgent<I, O> {\n static override async load<I extends Message = any, O extends Message = any>(options: {\n filepath: string;\n parsed: object;\n }): Promise<Agent<I, O>> {\n const schema = AIAgent.schema<AIAgentLoadSchema>(options);\n const valid = await schema.parseAsync(options.parsed);\n return AIAgent.load({\n ...options,\n parsed: {\n ...options.parsed,\n instructions: valid.instructions || [\n { role: \"system\", content: AgentSkillManagerSystemPrompt, path: options.filepath },\n ],\n },\n });\n }\n\n constructor(options: AgentSkillManagerOptions<I, O>) {\n super({\n ...options,\n instructions: options.instructions || AgentSkillManagerSystemPrompt,\n });\n }\n}\n"],"mappings":";;;;AAYA,IAAqB,yBAArB,cAGU,QAAc;CACtB,aAAsB,KAAuD,SAGpD;EAEvB,MAAM,QAAQ,MADC,QAAQ,OAA0B,QAAQ,CAC9B,WAAW,QAAQ,OAAO;AACrD,SAAO,QAAQ,KAAK;GAClB,GAAG;GACH,QAAQ;IACN,GAAG,QAAQ;IACX,cAAc,MAAM,gBAAgB,CAClC;KAAE,MAAM;KAAU,SAAS;KAA+B,MAAM,QAAQ;KAAU,CACnF;IACF;GACF,CAAC;;CAGJ,YAAY,SAAyC;AACnD,QAAM;GACJ,GAAG;GACH,cAAc,QAAQ,gBAAgB;GACvC,CAAC"}
@@ -1,4 +1,6 @@
1
- export const AgentSkillManagerSystemPrompt = `\
1
+
2
+ //#region src/agent-skill-manager/prompt.ts
3
+ const AgentSkillManagerSystemPrompt = `\
2
4
  You are an interactive CLI tool that helps users according to your "Output Style" below, which describes how you should respond to user queries. Use the instructions below and the tools available to you to assist the user.
3
5
 
4
6
  IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
@@ -15,9 +17,9 @@ IMPORTANT: You must NEVER generate or guess URLs for the user unless you are con
15
17
 
16
18
  {{ $afs.description }}
17
19
 
18
- ${"```"}yaml alt="AFS Modules"
20
+ \`\`\`yaml alt="AFS Modules"
19
21
  {{ $afs.modules | yaml.stringify }}
20
- ${"```"}
22
+ \`\`\`
21
23
  {% endif %}
22
24
 
23
25
  # Asking questions as you work
@@ -49,3 +51,6 @@ The user will primarily request you perform software engineering tasks. This inc
49
51
 
50
52
  IMPORTANT: Complete tasks fully. Do not stop mid-task or leave work incomplete. Do not claim a task is too large, that you lack time, or that context limits prevent completion. You have unlimited context through summarization. Continue working until the task is done or the user stops you.
51
53
  `;
54
+
55
+ //#endregion
56
+ exports.AgentSkillManagerSystemPrompt = AgentSkillManagerSystemPrompt;
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgentSkillManagerSystemPrompt = void 0;
4
- exports.AgentSkillManagerSystemPrompt = `\
1
+ //#region src/agent-skill-manager/prompt.ts
2
+ const AgentSkillManagerSystemPrompt = `\
5
3
  You are an interactive CLI tool that helps users according to your "Output Style" below, which describes how you should respond to user queries. Use the instructions below and the tools available to you to assist the user.
6
4
 
7
5
  IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
@@ -18,9 +16,9 @@ IMPORTANT: You must NEVER generate or guess URLs for the user unless you are con
18
16
 
19
17
  {{ $afs.description }}
20
18
 
21
- ${"```"}yaml alt="AFS Modules"
19
+ \`\`\`yaml alt="AFS Modules"
22
20
  {{ $afs.modules | yaml.stringify }}
23
- ${"```"}
21
+ \`\`\`
24
22
  {% endif %}
25
23
 
26
24
  # Asking questions as you work
@@ -52,3 +50,7 @@ The user will primarily request you perform software engineering tasks. This inc
52
50
 
53
51
  IMPORTANT: Complete tasks fully. Do not stop mid-task or leave work incomplete. Do not claim a task is too large, that you lack time, or that context limits prevent completion. You have unlimited context through summarization. Continue working until the task is done or the user stops you.
54
52
  `;
53
+
54
+ //#endregion
55
+ export { AgentSkillManagerSystemPrompt };
56
+ //# sourceMappingURL=prompt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.mjs","names":[],"sources":["../../src/agent-skill-manager/prompt.ts"],"sourcesContent":["export const AgentSkillManagerSystemPrompt = `\\\nYou are an interactive CLI tool that helps users according to your \"Output Style\" below, which describes how you should respond to user queries. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\n\n# Tone and style\n- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\n- Your output will be displayed on a command line interface. Your responses should be short and concise. You can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\n- Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\n- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one. This includes markdown files.\n- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like \"Let me read the file:\" followed by a read tool call should just be \"Let me read the file.\" with a period.\n\n{% if $afs.enabled %}\n# AFS Context\n\n{{ $afs.description }}\n\n${\"```\"}yaml alt=\"AFS Modules\"\n{{ $afs.modules | yaml.stringify }}\n${\"```\"}\n{% endif %}\n\n# Asking questions as you work\n\nYou have access to the askUserQuestion tool to ask the user questions when you need clarification, want to validate assumptions, or need to make a decision you're unsure about. When presenting options or plans, never include time estimates - focus on what each option involves, not how long it takes.\n\n# Skill usage\n\nWhen the user requests you to perform tasks, check if any of the available skills can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.\n\n## Loading skill resources on demand\n\nSkills may include reference documents (guides, schemas, examples) in a \\`references/\\` directory. To optimize performance and context usage:\n\n1. **Start with the main skill file** (e.g., \\`SKILL.md\\`) - it contains the workflow overview and references to detailed guides\n2. **Load reference documents only when needed** - read specific guides only when you reach the step that requires them\n3. **Don't preload all resources** - avoid reading all reference files at the start of a task\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.\n- Use the askUserQuestion tool to ask questions, clarify and gather information as needed.\n- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.\n- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.\n - Don't add features, refactor code, or make \"improvements\" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.\n - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.\n - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task—three similar lines of code is better than a premature abstraction.\n- Avoid backwards-compatibility hacks like renaming unused \\`_vars\\`, re-exporting types, adding \\`// removed\\` comments for removed code, etc. If something is unused, delete it completely.\n\nIMPORTANT: Complete tasks fully. Do not stop mid-task or leave work incomplete. Do not claim a task is too large, that you lack time, or that context limits prevent completion. You have unlimited context through summarization. Continue working until the task is done or the user stops you.\n`;\n"],"mappings":";AAAA,MAAa,gCAAgC"}
@@ -0,0 +1,88 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let _aigne_core = require("@aigne/core");
3
+ let _aigne_core_loader_schema = require("@aigne/core/loader/schema");
4
+ let zod = require("zod");
5
+
6
+ //#region src/ask-user-question/index.ts
7
+ const askUserQuestionAgentOptionSchema = zod.z.object({
8
+ label: zod.z.string().describe("The display text for this option (1-5 words)"),
9
+ description: (0, _aigne_core_loader_schema.optionalize)(zod.z.string()).describe("Explanation of what this option means")
10
+ });
11
+ const askUserQuestionAgentInputSchema = zod.z.object({
12
+ questions: zod.z.array(zod.z.object({
13
+ header: zod.z.string().describe("Very short label (max 12 chars) used as key in answers. Examples: 'Auth method', 'Library', 'Approach'"),
14
+ question: zod.z.string().describe("The question to ask the user"),
15
+ options: (0, _aigne_core_loader_schema.optionalize)(zod.z.array(askUserQuestionAgentOptionSchema)).describe("List of options to present to the user"),
16
+ multipleSelect: (0, _aigne_core_loader_schema.optionalize)(zod.z.boolean()).describe("Whether to allow multiple selections")
17
+ })).describe("List of questions to ask the user"),
18
+ allowCustomAnswer: (0, _aigne_core_loader_schema.optionalize)(zod.z.boolean()).describe("Whether to allow the user to provide custom answers")
19
+ });
20
+ var AskUserQuestionAgent = class AskUserQuestionAgent extends _aigne_core.Agent {
21
+ tag = "AskUserQuestion";
22
+ static schema() {
23
+ return zod.z.object({});
24
+ }
25
+ static async load(options) {
26
+ return new AskUserQuestionAgent({
27
+ name: defaultName,
28
+ description: defaultDescription,
29
+ ...options.parsed,
30
+ inputSchema: askUserQuestionAgentInputSchema
31
+ });
32
+ }
33
+ constructor(options) {
34
+ super({
35
+ ...options,
36
+ name: options?.name || defaultName,
37
+ description: options?.description || defaultDescription,
38
+ inputSchema: options?.inputSchema || askUserQuestionAgentInputSchema
39
+ });
40
+ }
41
+ async process(input, options) {
42
+ const { prompts } = options;
43
+ if (!prompts) throw new Error("Prompts is not available in AskUserQuestionAgent");
44
+ const { questions, allowCustomAnswer } = input;
45
+ const answers = {};
46
+ for (const q of questions) {
47
+ let answer;
48
+ if (q.options?.length) {
49
+ const choices = q.options.map((opt) => ({
50
+ value: opt.label,
51
+ name: opt.label,
52
+ description: opt.description ?? opt.label
53
+ }));
54
+ if (allowCustomAnswer) choices.push({
55
+ name: "None of the above / Enter my own response",
56
+ value: "OTHER_OPTION"
57
+ });
58
+ if (!q.multipleSelect) answer = await prompts.select({
59
+ message: q.question,
60
+ choices
61
+ });
62
+ else answer = await prompts.checkbox({
63
+ message: q.question,
64
+ choices
65
+ });
66
+ if (answer === "OTHER_OPTION" || Array.isArray(answer) && answer.includes("OTHER_OPTION")) answer = await prompts.input({ message: `Please provide your response for: ${q.question}` });
67
+ } else answer = await prompts.input({ message: q.question });
68
+ answers[q.header] = Array.isArray(answer) ? answer.join(", ") : answer;
69
+ }
70
+ return { answers };
71
+ }
72
+ };
73
+ const defaultName = "askUserQuestion";
74
+ const defaultDescription = `\
75
+ Use this tool when you need to ask the user questions during execution. This allows you to:
76
+ 1. Gather user preferences or requirements
77
+ 2. Clarify ambiguous instructions
78
+ 3. Get decisions on implementation choices as you work
79
+ 4. Offer choices to the user about what direction to take.
80
+
81
+ Usage notes:
82
+ - Users will always be able to select "Other" to provide custom text input
83
+ - Use multiSelect: true to allow multiple answers to be selected for a question
84
+ - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
85
+ `;
86
+
87
+ //#endregion
88
+ module.exports = AskUserQuestionAgent;
@@ -0,0 +1,33 @@
1
+ import { Agent, AgentInvokeOptions, AgentOptions, AgentProcessResult, Message } from "@aigne/core";
2
+ import { z as z$1 } from "zod";
3
+
4
+ //#region src/ask-user-question/index.d.ts
5
+ interface AskUserQuestionAgentOption {
6
+ label: string;
7
+ description?: string;
8
+ }
9
+ interface AskUserQuestionAgentInput extends Message {
10
+ questions: {
11
+ header: string;
12
+ question: string;
13
+ options?: AskUserQuestionAgentOption[];
14
+ multipleSelect?: boolean;
15
+ }[];
16
+ allowCustomAnswer?: boolean;
17
+ }
18
+ interface AskUserQuestionAgentOutput extends Message {
19
+ answers: Record<string, string>;
20
+ }
21
+ declare class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInput, AskUserQuestionAgentOutput> {
22
+ tag: string;
23
+ static schema(): z$1.ZodObject<{}, "strip", z$1.ZodTypeAny, {}, {}>;
24
+ static load<I extends Message = any, O extends Message = any>(options: {
25
+ filepath: string;
26
+ parsed: object;
27
+ }): Promise<Agent<I, O>>;
28
+ constructor(options?: AgentOptions<AskUserQuestionAgentInput, AskUserQuestionAgentOutput>);
29
+ process(input: AskUserQuestionAgentInput, options: AgentInvokeOptions): Promise<AgentProcessResult<AskUserQuestionAgentOutput>>;
30
+ }
31
+ //#endregion
32
+ export { AskUserQuestionAgentInput, AskUserQuestionAgentOption, AskUserQuestionAgentOutput, AskUserQuestionAgent as default };
33
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/ask-user-question/index.ts"],"mappings":";;;;UAUiB,0BAAA;EAAA,KAAA;EAAA,WAAA;AAAA;AAAA,UAKA,yBAAA,SAAkC,OAAA;EAAA,SAAA;IAAA,MAAA;IAAA,QAAA;IAAA,OAAA,GAIrC,0BAAA;IAAA,cAAA;EAAA;EAAA,iBAAA;AAAA;AAAA,UAiCG,0BAAA,SAAmC,OAAA;EAAA,OAAA,EACzC,MAAA;AAAA;AAAA,cAGU,oBAAA,SAA6B,KAAA,CAChD,yBAAA,EACA,0BAAA;EAAA,GAAA;EAAA,OAAA,OAAA,GAIa,GAAA,CAAA,SAAA,cAAA,GAAA,CAAA,UAAA;EAAA,OAAA,IAAA,WAIwB,OAAA,kBAAyB,OAAA,OAAA,CAAA,OAAA;IAAA,QAAA;IAAA,MAAA;EAAA,IAG1D,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,CAAA;EAAA,YAAA,OAAA,GASC,YAAA,CAAa,yBAAA,EAA2B,0BAAA;EAAA,QAAA,KAAA,EAUrD,yBAAA,EAAA,OAAA,EACE,kBAAA,GACR,OAAA,CAAQ,kBAAA,CAAmB,0BAAA;AAAA"}
@@ -0,0 +1,33 @@
1
+ import { Agent, AgentInvokeOptions, AgentOptions, AgentProcessResult, Message } from "@aigne/core";
2
+ import { z as z$1 } from "zod";
3
+
4
+ //#region src/ask-user-question/index.d.ts
5
+ interface AskUserQuestionAgentOption {
6
+ label: string;
7
+ description?: string;
8
+ }
9
+ interface AskUserQuestionAgentInput extends Message {
10
+ questions: {
11
+ header: string;
12
+ question: string;
13
+ options?: AskUserQuestionAgentOption[];
14
+ multipleSelect?: boolean;
15
+ }[];
16
+ allowCustomAnswer?: boolean;
17
+ }
18
+ interface AskUserQuestionAgentOutput extends Message {
19
+ answers: Record<string, string>;
20
+ }
21
+ declare class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInput, AskUserQuestionAgentOutput> {
22
+ tag: string;
23
+ static schema(): z$1.ZodObject<{}, "strip", z$1.ZodTypeAny, {}, {}>;
24
+ static load<I extends Message = any, O extends Message = any>(options: {
25
+ filepath: string;
26
+ parsed: object;
27
+ }): Promise<Agent<I, O>>;
28
+ constructor(options?: AgentOptions<AskUserQuestionAgentInput, AskUserQuestionAgentOutput>);
29
+ process(input: AskUserQuestionAgentInput, options: AgentInvokeOptions): Promise<AgentProcessResult<AskUserQuestionAgentOutput>>;
30
+ }
31
+ //#endregion
32
+ export { AskUserQuestionAgentInput, AskUserQuestionAgentOption, AskUserQuestionAgentOutput, AskUserQuestionAgent as default };
33
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/ask-user-question/index.ts"],"mappings":";;;;UAUiB,0BAAA;EAAA,KAAA;EAAA,WAAA;AAAA;AAAA,UAKA,yBAAA,SAAkC,OAAA;EAAA,SAAA;IAAA,MAAA;IAAA,QAAA;IAAA,OAAA,GAIrC,0BAAA;IAAA,cAAA;EAAA;EAAA,iBAAA;AAAA;AAAA,UAiCG,0BAAA,SAAmC,OAAA;EAAA,OAAA,EACzC,MAAA;AAAA;AAAA,cAGU,oBAAA,SAA6B,KAAA,CAChD,yBAAA,EACA,0BAAA;EAAA,GAAA;EAAA,OAAA,OAAA,GAIa,GAAA,CAAA,SAAA,cAAA,GAAA,CAAA,UAAA;EAAA,OAAA,IAAA,WAIwB,OAAA,kBAAyB,OAAA,OAAA,CAAA,OAAA;IAAA,QAAA;IAAA,MAAA;EAAA,IAG1D,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,CAAA;EAAA,YAAA,OAAA,GASC,YAAA,CAAa,yBAAA,EAA2B,0BAAA;EAAA,QAAA,KAAA,EAUrD,yBAAA,EAAA,OAAA,EACE,kBAAA,GACR,OAAA,CAAQ,kBAAA,CAAmB,0BAAA;AAAA"}
@@ -0,0 +1,88 @@
1
+ import { Agent } from "@aigne/core";
2
+ import { optionalize } from "@aigne/core/loader/schema";
3
+ import { z as z$1 } from "zod";
4
+
5
+ //#region src/ask-user-question/index.ts
6
+ const askUserQuestionAgentOptionSchema = z$1.object({
7
+ label: z$1.string().describe("The display text for this option (1-5 words)"),
8
+ description: optionalize(z$1.string()).describe("Explanation of what this option means")
9
+ });
10
+ const askUserQuestionAgentInputSchema = z$1.object({
11
+ questions: z$1.array(z$1.object({
12
+ header: z$1.string().describe("Very short label (max 12 chars) used as key in answers. Examples: 'Auth method', 'Library', 'Approach'"),
13
+ question: z$1.string().describe("The question to ask the user"),
14
+ options: optionalize(z$1.array(askUserQuestionAgentOptionSchema)).describe("List of options to present to the user"),
15
+ multipleSelect: optionalize(z$1.boolean()).describe("Whether to allow multiple selections")
16
+ })).describe("List of questions to ask the user"),
17
+ allowCustomAnswer: optionalize(z$1.boolean()).describe("Whether to allow the user to provide custom answers")
18
+ });
19
+ var AskUserQuestionAgent = class AskUserQuestionAgent extends Agent {
20
+ tag = "AskUserQuestion";
21
+ static schema() {
22
+ return z$1.object({});
23
+ }
24
+ static async load(options) {
25
+ return new AskUserQuestionAgent({
26
+ name: defaultName,
27
+ description: defaultDescription,
28
+ ...options.parsed,
29
+ inputSchema: askUserQuestionAgentInputSchema
30
+ });
31
+ }
32
+ constructor(options) {
33
+ super({
34
+ ...options,
35
+ name: options?.name || defaultName,
36
+ description: options?.description || defaultDescription,
37
+ inputSchema: options?.inputSchema || askUserQuestionAgentInputSchema
38
+ });
39
+ }
40
+ async process(input, options) {
41
+ const { prompts } = options;
42
+ if (!prompts) throw new Error("Prompts is not available in AskUserQuestionAgent");
43
+ const { questions, allowCustomAnswer } = input;
44
+ const answers = {};
45
+ for (const q of questions) {
46
+ let answer;
47
+ if (q.options?.length) {
48
+ const choices = q.options.map((opt) => ({
49
+ value: opt.label,
50
+ name: opt.label,
51
+ description: opt.description ?? opt.label
52
+ }));
53
+ if (allowCustomAnswer) choices.push({
54
+ name: "None of the above / Enter my own response",
55
+ value: "OTHER_OPTION"
56
+ });
57
+ if (!q.multipleSelect) answer = await prompts.select({
58
+ message: q.question,
59
+ choices
60
+ });
61
+ else answer = await prompts.checkbox({
62
+ message: q.question,
63
+ choices
64
+ });
65
+ if (answer === "OTHER_OPTION" || Array.isArray(answer) && answer.includes("OTHER_OPTION")) answer = await prompts.input({ message: `Please provide your response for: ${q.question}` });
66
+ } else answer = await prompts.input({ message: q.question });
67
+ answers[q.header] = Array.isArray(answer) ? answer.join(", ") : answer;
68
+ }
69
+ return { answers };
70
+ }
71
+ };
72
+ const defaultName = "askUserQuestion";
73
+ const defaultDescription = `\
74
+ Use this tool when you need to ask the user questions during execution. This allows you to:
75
+ 1. Gather user preferences or requirements
76
+ 2. Clarify ambiguous instructions
77
+ 3. Get decisions on implementation choices as you work
78
+ 4. Offer choices to the user about what direction to take.
79
+
80
+ Usage notes:
81
+ - Users will always be able to select "Other" to provide custom text input
82
+ - Use multiSelect: true to allow multiple answers to be selected for a question
83
+ - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
84
+ `;
85
+
86
+ //#endregion
87
+ export { AskUserQuestionAgent as default };
88
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["z"],"sources":["../../src/ask-user-question/index.ts"],"sourcesContent":["import {\n Agent,\n type AgentInvokeOptions,\n type AgentOptions,\n type AgentProcessResult,\n type Message,\n} from \"@aigne/core\";\nimport { optionalize } from \"@aigne/core/loader/schema\";\nimport { z } from \"zod\";\n\nexport interface AskUserQuestionAgentOption {\n label: string;\n description?: string;\n}\n\nexport interface AskUserQuestionAgentInput extends Message {\n questions: {\n header: string;\n question: string;\n options?: AskUserQuestionAgentOption[];\n multipleSelect?: boolean;\n }[];\n allowCustomAnswer?: boolean;\n}\n\nconst askUserQuestionAgentOptionSchema = z.object({\n label: z.string().describe(\"The display text for this option (1-5 words)\"),\n description: optionalize(z.string()).describe(\"Explanation of what this option means\"),\n});\n\nconst askUserQuestionAgentInputSchema = z.object({\n questions: z\n .array(\n z.object({\n header: z\n .string()\n .describe(\n \"Very short label (max 12 chars) used as key in answers. Examples: 'Auth method', 'Library', 'Approach'\",\n ),\n question: z.string().describe(\"The question to ask the user\"),\n options: optionalize(z.array(askUserQuestionAgentOptionSchema)).describe(\n \"List of options to present to the user\",\n ),\n multipleSelect: optionalize(z.boolean()).describe(\"Whether to allow multiple selections\"),\n }),\n )\n .describe(\"List of questions to ask the user\"),\n allowCustomAnswer: optionalize(z.boolean()).describe(\n \"Whether to allow the user to provide custom answers\",\n ),\n});\n\nexport interface AskUserQuestionAgentOutput extends Message {\n answers: Record<string, string>;\n}\n\nexport default class AskUserQuestionAgent extends Agent<\n AskUserQuestionAgentInput,\n AskUserQuestionAgentOutput\n> {\n override tag = \"AskUserQuestion\";\n\n static schema() {\n return z.object({});\n }\n\n static override async load<I extends Message = any, O extends Message = any>(options: {\n filepath: string;\n parsed: object;\n }): Promise<Agent<I, O>> {\n return new AskUserQuestionAgent({\n name: defaultName,\n description: defaultDescription,\n ...options.parsed,\n inputSchema: askUserQuestionAgentInputSchema,\n }) as unknown as Agent<I, O>;\n }\n\n constructor(options?: AgentOptions<AskUserQuestionAgentInput, AskUserQuestionAgentOutput>) {\n super({\n ...options,\n name: options?.name || defaultName,\n description: options?.description || defaultDescription,\n inputSchema: options?.inputSchema || askUserQuestionAgentInputSchema,\n });\n }\n\n override async process(\n input: AskUserQuestionAgentInput,\n options: AgentInvokeOptions,\n ): Promise<AgentProcessResult<AskUserQuestionAgentOutput>> {\n const { prompts } = options;\n if (!prompts) throw new Error(\"Prompts is not available in AskUserQuestionAgent\");\n\n const { questions, allowCustomAnswer } = input;\n\n const answers: AskUserQuestionAgentOutput[\"answers\"] = {};\n\n for (const q of questions) {\n let answer: string | string[];\n\n if (q.options?.length) {\n const choices: { value: string; name?: string; description?: string }[] = q.options.map(\n (opt) => ({\n value: opt.label,\n name: opt.label,\n description: opt.description ?? opt.label,\n }),\n );\n\n if (allowCustomAnswer) {\n choices.push({\n name: \"None of the above / Enter my own response\",\n value: \"OTHER_OPTION\",\n });\n }\n\n if (!q.multipleSelect) {\n answer = await prompts.select({\n message: q.question,\n choices,\n });\n } else {\n answer = await prompts.checkbox({\n message: q.question,\n choices,\n });\n }\n\n if (\n answer === \"OTHER_OPTION\" ||\n (Array.isArray(answer) && answer.includes(\"OTHER_OPTION\"))\n ) {\n answer = await prompts.input({\n message: `Please provide your response for: ${q.question}`,\n });\n }\n } else {\n answer = await prompts.input({\n message: q.question,\n });\n }\n\n answers[q.header] = Array.isArray(answer) ? answer.join(\", \") : answer;\n }\n\n return {\n answers,\n };\n }\n}\n\nconst defaultName = \"askUserQuestion\";\nconst defaultDescription = `\\\nUse this tool when you need to ask the user questions during execution. This allows you to:\n1. Gather user preferences or requirements\n2. Clarify ambiguous instructions\n3. Get decisions on implementation choices as you work\n4. Offer choices to the user about what direction to take.\n\nUsage notes:\n- Users will always be able to select \"Other\" to provide custom text input\n- Use multiSelect: true to allow multiple answers to be selected for a question\n- If you recommend a specific option, make that the first option in the list and add \"(Recommended)\" at the end of the label\n`;\n"],"mappings":";;;;;AAyBA,MAAM,mCAAmCA,IAAE,OAAO;CAChD,OAAOA,IAAE,QAAQ,CAAC,SAAS,+CAA+C;CAC1E,aAAa,YAAYA,IAAE,QAAQ,CAAC,CAAC,SAAS,wCAAwC;CACvF,CAAC;AAEF,MAAM,kCAAkCA,IAAE,OAAO;CAC/C,WAAWA,IACR,MACCA,IAAE,OAAO;EACP,QAAQA,IACL,QAAQ,CACR,SACC,yGACD;EACH,UAAUA,IAAE,QAAQ,CAAC,SAAS,+BAA+B;EAC7D,SAAS,YAAYA,IAAE,MAAM,iCAAiC,CAAC,CAAC,SAC9D,yCACD;EACD,gBAAgB,YAAYA,IAAE,SAAS,CAAC,CAAC,SAAS,uCAAuC;EAC1F,CAAC,CACH,CACA,SAAS,oCAAoC;CAChD,mBAAmB,YAAYA,IAAE,SAAS,CAAC,CAAC,SAC1C,sDACD;CACF,CAAC;AAMF,IAAqB,uBAArB,MAAqB,6BAA6B,MAGhD;CACA,AAAS,MAAM;CAEf,OAAO,SAAS;AACd,SAAOA,IAAE,OAAO,EAAE,CAAC;;CAGrB,aAAsB,KAAuD,SAGpD;AACvB,SAAO,IAAI,qBAAqB;GAC9B,MAAM;GACN,aAAa;GACb,GAAG,QAAQ;GACX,aAAa;GACd,CAAC;;CAGJ,YAAY,SAA+E;AACzF,QAAM;GACJ,GAAG;GACH,MAAM,SAAS,QAAQ;GACvB,aAAa,SAAS,eAAe;GACrC,aAAa,SAAS,eAAe;GACtC,CAAC;;CAGJ,MAAe,QACb,OACA,SACyD;EACzD,MAAM,EAAE,YAAY;AACpB,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,mDAAmD;EAEjF,MAAM,EAAE,WAAW,sBAAsB;EAEzC,MAAM,UAAiD,EAAE;AAEzD,OAAK,MAAM,KAAK,WAAW;GACzB,IAAI;AAEJ,OAAI,EAAE,SAAS,QAAQ;IACrB,MAAM,UAAoE,EAAE,QAAQ,KACjF,SAAS;KACR,OAAO,IAAI;KACX,MAAM,IAAI;KACV,aAAa,IAAI,eAAe,IAAI;KACrC,EACF;AAED,QAAI,kBACF,SAAQ,KAAK;KACX,MAAM;KACN,OAAO;KACR,CAAC;AAGJ,QAAI,CAAC,EAAE,eACL,UAAS,MAAM,QAAQ,OAAO;KAC5B,SAAS,EAAE;KACX;KACD,CAAC;QAEF,UAAS,MAAM,QAAQ,SAAS;KAC9B,SAAS,EAAE;KACX;KACD,CAAC;AAGJ,QACE,WAAW,kBACV,MAAM,QAAQ,OAAO,IAAI,OAAO,SAAS,eAAe,CAEzD,UAAS,MAAM,QAAQ,MAAM,EAC3B,SAAS,qCAAqC,EAAE,YACjD,CAAC;SAGJ,UAAS,MAAM,QAAQ,MAAM,EAC3B,SAAS,EAAE,UACZ,CAAC;AAGJ,WAAQ,EAAE,UAAU,MAAM,QAAQ,OAAO,GAAG,OAAO,KAAK,KAAK,GAAG;;AAGlE,SAAO,EACL,SACD;;;AAIL,MAAM,cAAc;AACpB,MAAM,qBAAqB"}