@aigne/agent-library 1.24.0-beta.5 → 1.24.0-beta.6

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/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@
7
7
  * @aigne/core bumped to 1.22.0
8
8
  * @aigne/openai bumped to 0.3.4
9
9
 
10
+ ## [1.24.0-beta.6](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.5...agent-library-v1.24.0-beta.6) (2025-12-25)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **agent-library:** add header field and use object-based answers in AskUserQuestion ([#851](https://github.com/AIGNE-io/aigne-framework/issues/851)) ([095db95](https://github.com/AIGNE-io/aigne-framework/commit/095db95e43b5d39b35c638d90d6f0b99565e0dc4))
16
+
10
17
  ## [1.24.0-beta.5](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.4...agent-library-v1.24.0-beta.5) (2025-12-25)
11
18
 
12
19
 
@@ -6,6 +6,7 @@ export interface AskUserQuestionAgentOption {
6
6
  }
7
7
  export interface AskUserQuestionAgentInput extends Message {
8
8
  questions: {
9
+ header: string;
9
10
  question: string;
10
11
  options?: AskUserQuestionAgentOption[];
11
12
  multipleSelect?: boolean;
@@ -13,10 +14,7 @@ export interface AskUserQuestionAgentInput extends Message {
13
14
  allowCustomAnswer?: boolean;
14
15
  }
15
16
  export interface AskUserQuestionAgentOutput extends Message {
16
- answers: {
17
- question: string;
18
- answer: string | string[];
19
- }[];
17
+ answers: Record<string, string>;
20
18
  }
21
19
  export default class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInput, AskUserQuestionAgentOutput> {
22
20
  tag: string;
@@ -10,6 +10,9 @@ const askUserQuestionAgentOptionSchema = zod_1.z.object({
10
10
  const askUserQuestionAgentInputSchema = zod_1.z.object({
11
11
  questions: zod_1.z
12
12
  .array(zod_1.z.object({
13
+ header: zod_1.z
14
+ .string()
15
+ .describe("Very short label (max 12 chars) used as key in answers. Examples: 'Auth method', 'Library', 'Approach'"),
13
16
  question: zod_1.z.string().describe("The question to ask the user"),
14
17
  options: (0, schema_js_1.optionalize)(zod_1.z.array(askUserQuestionAgentOptionSchema)).describe("List of options to present to the user"),
15
18
  multipleSelect: (0, schema_js_1.optionalize)(zod_1.z.boolean()).describe("Whether to allow multiple selections"),
@@ -35,7 +38,7 @@ class AskUserQuestionAgent extends core_1.Agent {
35
38
  if (!prompts)
36
39
  throw new Error("Prompts is not available in AskUserQuestionAgent");
37
40
  const { questions, allowCustomAnswer } = input;
38
- const answers = [];
41
+ const answers = {};
39
42
  for (const q of questions) {
40
43
  let answer;
41
44
  if (q.options?.length) {
@@ -74,10 +77,7 @@ class AskUserQuestionAgent extends core_1.Agent {
74
77
  message: q.question,
75
78
  });
76
79
  }
77
- answers.push({
78
- question: q.question,
79
- answer,
80
- });
80
+ answers[q.header] = Array.isArray(answer) ? answer.join(", ") : answer;
81
81
  }
82
82
  return {
83
83
  answers,
@@ -6,6 +6,7 @@ export interface AskUserQuestionAgentOption {
6
6
  }
7
7
  export interface AskUserQuestionAgentInput extends Message {
8
8
  questions: {
9
+ header: string;
9
10
  question: string;
10
11
  options?: AskUserQuestionAgentOption[];
11
12
  multipleSelect?: boolean;
@@ -13,10 +14,7 @@ export interface AskUserQuestionAgentInput extends Message {
13
14
  allowCustomAnswer?: boolean;
14
15
  }
15
16
  export interface AskUserQuestionAgentOutput extends Message {
16
- answers: {
17
- question: string;
18
- answer: string | string[];
19
- }[];
17
+ answers: Record<string, string>;
20
18
  }
21
19
  export default class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInput, AskUserQuestionAgentOutput> {
22
20
  tag: string;
@@ -6,6 +6,7 @@ export interface AskUserQuestionAgentOption {
6
6
  }
7
7
  export interface AskUserQuestionAgentInput extends Message {
8
8
  questions: {
9
+ header: string;
9
10
  question: string;
10
11
  options?: AskUserQuestionAgentOption[];
11
12
  multipleSelect?: boolean;
@@ -13,10 +14,7 @@ export interface AskUserQuestionAgentInput extends Message {
13
14
  allowCustomAnswer?: boolean;
14
15
  }
15
16
  export interface AskUserQuestionAgentOutput extends Message {
16
- answers: {
17
- question: string;
18
- answer: string | string[];
19
- }[];
17
+ answers: Record<string, string>;
20
18
  }
21
19
  export default class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInput, AskUserQuestionAgentOutput> {
22
20
  tag: string;
@@ -8,6 +8,9 @@ const askUserQuestionAgentOptionSchema = z.object({
8
8
  const askUserQuestionAgentInputSchema = z.object({
9
9
  questions: z
10
10
  .array(z.object({
11
+ header: z
12
+ .string()
13
+ .describe("Very short label (max 12 chars) used as key in answers. Examples: 'Auth method', 'Library', 'Approach'"),
11
14
  question: z.string().describe("The question to ask the user"),
12
15
  options: optionalize(z.array(askUserQuestionAgentOptionSchema)).describe("List of options to present to the user"),
13
16
  multipleSelect: optionalize(z.boolean()).describe("Whether to allow multiple selections"),
@@ -33,7 +36,7 @@ export default class AskUserQuestionAgent extends Agent {
33
36
  if (!prompts)
34
37
  throw new Error("Prompts is not available in AskUserQuestionAgent");
35
38
  const { questions, allowCustomAnswer } = input;
36
- const answers = [];
39
+ const answers = {};
37
40
  for (const q of questions) {
38
41
  let answer;
39
42
  if (q.options?.length) {
@@ -72,10 +75,7 @@ export default class AskUserQuestionAgent extends Agent {
72
75
  message: q.question,
73
76
  });
74
77
  }
75
- answers.push({
76
- question: q.question,
77
- answer,
78
- });
78
+ answers[q.header] = Array.isArray(answer) ? answer.join(", ") : answer;
79
79
  }
80
80
  return {
81
81
  answers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/agent-library",
3
- "version": "1.24.0-beta.5",
3
+ "version": "1.24.0-beta.6",
4
4
  "description": "Collection of agent libraries for AIGNE framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -57,8 +57,8 @@
57
57
  "yaml": "^2.8.1",
58
58
  "zod": "^3.25.67",
59
59
  "zod-to-json-schema": "^3.24.6",
60
- "@aigne/core": "^1.72.0-beta.5",
61
60
  "@aigne/openai": "^0.16.16-beta.5",
61
+ "@aigne/core": "^1.72.0-beta.5",
62
62
  "@aigne/sqlite": "^0.4.9-beta"
63
63
  },
64
64
  "devDependencies": {