@aigne/agent-library 1.9.0 → 1.10.0

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
@@ -2,6 +2,20 @@
2
2
 
3
3
  - chore: release 1.2.0
4
4
 
5
+ ## [1.10.0](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.9.0...agent-library-v1.10.0) (2025-05-25)
6
+
7
+
8
+ ### Features
9
+
10
+ * add user context support ([#131](https://github.com/AIGNE-io/aigne-framework/issues/131)) ([4dd9d20](https://github.com/AIGNE-io/aigne-framework/commit/4dd9d20953f6ac33933723db56efd9b44bafeb02))
11
+
12
+
13
+ ### Dependencies
14
+
15
+ * The following workspace dependencies were updated
16
+ * dependencies
17
+ * @aigne/core bumped to 1.17.0
18
+
5
19
  ## [1.9.0](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.8.1...agent-library-v1.9.0) (2025-05-23)
6
20
 
7
21
 
@@ -64,11 +64,11 @@ class FSMemoryRetriever extends index_js_1.MemoryRetriever {
64
64
  });
65
65
  }
66
66
  agent;
67
- async process(input, context) {
67
+ async process(input, options) {
68
68
  if (!(await (0, fs_js_1.exists)(this.options.memoryFileName)))
69
69
  return { memories: [] };
70
70
  const allMemory = await (0, promises_1.readFile)(this.options.memoryFileName, "utf-8");
71
- const { memories } = await context.invoke(this.agent, { ...input, allMemory });
71
+ const { memories } = await options.context.invoke(this.agent, { ...input, allMemory });
72
72
  const result = memories.map((memory) => ({
73
73
  id: (0, index_js_1.newMemoryId)(),
74
74
  content: memory.content,
@@ -97,11 +97,11 @@ class FSMemoryRecorder extends index_js_1.MemoryRecorder {
97
97
  });
98
98
  }
99
99
  agent;
100
- async process(input, context) {
100
+ async process(input, options) {
101
101
  const allMemory = (await (0, fs_js_1.exists)(this.options.memoryFileName))
102
102
  ? await (0, promises_1.readFile)(this.options.memoryFileName, "utf-8")
103
103
  : "";
104
- const { memories } = await context.invoke(this.agent, { ...input, allMemory });
104
+ const { memories } = await options.context.invoke(this.agent, { ...input, allMemory });
105
105
  const raw = (0, yaml_1.stringify)(memories.map((i) => ({
106
106
  content: i.content,
107
107
  })));
@@ -1,4 +1,4 @@
1
- import { Agent, type AgentOptions, type Context, type Message } from "@aigne/core";
1
+ import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "@aigne/core";
2
2
  import { type FullPlanOutput, type StepWithResult } from "./orchestrator-prompts.js";
3
3
  /**
4
4
  * Re-export orchestrator prompt templates and related types
@@ -95,10 +95,10 @@ export declare class OrchestratorAgent<I extends Message = Message, O extends Me
95
95
  * c. Otherwise, execute steps in the plan
96
96
  *
97
97
  * @param input - Input message containing the objective
98
- * @param context - Execution context with model and other necessary info
98
+ * @param options - Agent invocation options
99
99
  * @returns Processing result
100
100
  */
101
- process(input: I, context: Context): Promise<O>;
101
+ process(input: I, options: AgentInvokeOptions): Promise<O>;
102
102
  private getFullPlanInput;
103
103
  private getFullPlan;
104
104
  private synthesizePlanResult;
@@ -102,11 +102,11 @@ class OrchestratorAgent extends core_1.Agent {
102
102
  * c. Otherwise, execute steps in the plan
103
103
  *
104
104
  * @param input - Input message containing the objective
105
- * @param context - Execution context with model and other necessary info
105
+ * @param options - Agent invocation options
106
106
  * @returns Processing result
107
107
  */
108
- async process(input, context) {
109
- const { model } = context;
108
+ async process(input, options) {
109
+ const { model } = options.context;
110
110
  if (!model)
111
111
  throw new Error("model is required to run OrchestratorAgent");
112
112
  const objective = (0, core_1.getMessage)(input);
@@ -119,13 +119,13 @@ class OrchestratorAgent extends core_1.Agent {
119
119
  let iterations = 0;
120
120
  const maxIterations = this.maxIterations ?? DEFAULT_MAX_ITERATIONS;
121
121
  while (iterations++ < maxIterations) {
122
- const plan = await this.getFullPlan(result, context);
122
+ const plan = await this.getFullPlan(result, options.context);
123
123
  result.plan = plan;
124
124
  if (plan.isComplete) {
125
- return this.synthesizePlanResult(result, context);
125
+ return this.synthesizePlanResult(result, options.context);
126
126
  }
127
127
  for (const step of plan.steps) {
128
- const stepResult = await this.executeStep(result, step, context);
128
+ const stepResult = await this.executeStep(result, step, options.context);
129
129
  result.steps.push(stepResult);
130
130
  }
131
131
  }
@@ -1,4 +1,4 @@
1
- import { Agent, type AgentOptions, type Context, type Message } from "@aigne/core";
1
+ import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "@aigne/core";
2
2
  import { type FullPlanOutput, type StepWithResult } from "./orchestrator-prompts.js";
3
3
  /**
4
4
  * Re-export orchestrator prompt templates and related types
@@ -95,10 +95,10 @@ export declare class OrchestratorAgent<I extends Message = Message, O extends Me
95
95
  * c. Otherwise, execute steps in the plan
96
96
  *
97
97
  * @param input - Input message containing the objective
98
- * @param context - Execution context with model and other necessary info
98
+ * @param options - Agent invocation options
99
99
  * @returns Processing result
100
100
  */
101
- process(input: I, context: Context): Promise<O>;
101
+ process(input: I, options: AgentInvokeOptions): Promise<O>;
102
102
  private getFullPlanInput;
103
103
  private getFullPlan;
104
104
  private synthesizePlanResult;
@@ -60,11 +60,11 @@ class FSMemoryRetriever extends MemoryRetriever {
60
60
  });
61
61
  }
62
62
  agent;
63
- async process(input, context) {
63
+ async process(input, options) {
64
64
  if (!(await exists(this.options.memoryFileName)))
65
65
  return { memories: [] };
66
66
  const allMemory = await readFile(this.options.memoryFileName, "utf-8");
67
- const { memories } = await context.invoke(this.agent, { ...input, allMemory });
67
+ const { memories } = await options.context.invoke(this.agent, { ...input, allMemory });
68
68
  const result = memories.map((memory) => ({
69
69
  id: newMemoryId(),
70
70
  content: memory.content,
@@ -93,11 +93,11 @@ class FSMemoryRecorder extends MemoryRecorder {
93
93
  });
94
94
  }
95
95
  agent;
96
- async process(input, context) {
96
+ async process(input, options) {
97
97
  const allMemory = (await exists(this.options.memoryFileName))
98
98
  ? await readFile(this.options.memoryFileName, "utf-8")
99
99
  : "";
100
- const { memories } = await context.invoke(this.agent, { ...input, allMemory });
100
+ const { memories } = await options.context.invoke(this.agent, { ...input, allMemory });
101
101
  const raw = stringify(memories.map((i) => ({
102
102
  content: i.content,
103
103
  })));
@@ -1,4 +1,4 @@
1
- import { Agent, type AgentOptions, type Context, type Message } from "@aigne/core";
1
+ import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "@aigne/core";
2
2
  import { type FullPlanOutput, type StepWithResult } from "./orchestrator-prompts.js";
3
3
  /**
4
4
  * Re-export orchestrator prompt templates and related types
@@ -95,10 +95,10 @@ export declare class OrchestratorAgent<I extends Message = Message, O extends Me
95
95
  * c. Otherwise, execute steps in the plan
96
96
  *
97
97
  * @param input - Input message containing the objective
98
- * @param context - Execution context with model and other necessary info
98
+ * @param options - Agent invocation options
99
99
  * @returns Processing result
100
100
  */
101
- process(input: I, context: Context): Promise<O>;
101
+ process(input: I, options: AgentInvokeOptions): Promise<O>;
102
102
  private getFullPlanInput;
103
103
  private getFullPlan;
104
104
  private synthesizePlanResult;
@@ -82,11 +82,11 @@ export class OrchestratorAgent extends Agent {
82
82
  * c. Otherwise, execute steps in the plan
83
83
  *
84
84
  * @param input - Input message containing the objective
85
- * @param context - Execution context with model and other necessary info
85
+ * @param options - Agent invocation options
86
86
  * @returns Processing result
87
87
  */
88
- async process(input, context) {
89
- const { model } = context;
88
+ async process(input, options) {
89
+ const { model } = options.context;
90
90
  if (!model)
91
91
  throw new Error("model is required to run OrchestratorAgent");
92
92
  const objective = getMessage(input);
@@ -99,13 +99,13 @@ export class OrchestratorAgent extends Agent {
99
99
  let iterations = 0;
100
100
  const maxIterations = this.maxIterations ?? DEFAULT_MAX_ITERATIONS;
101
101
  while (iterations++ < maxIterations) {
102
- const plan = await this.getFullPlan(result, context);
102
+ const plan = await this.getFullPlan(result, options.context);
103
103
  result.plan = plan;
104
104
  if (plan.isComplete) {
105
- return this.synthesizePlanResult(result, context);
105
+ return this.synthesizePlanResult(result, options.context);
106
106
  }
107
107
  for (const step of plan.steps) {
108
- const stepResult = await this.executeStep(result, step, context);
108
+ const stepResult = await this.executeStep(result, step, options.context);
109
109
  result.steps.push(stepResult);
110
110
  }
111
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/agent-library",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "Collection of agent libraries for AIGNE framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -42,7 +42,7 @@
42
42
  "fastq": "^1.19.1",
43
43
  "yaml": "^2.7.1",
44
44
  "zod": "^3.24.4",
45
- "@aigne/core": "^1.16.0"
45
+ "@aigne/core": "^1.17.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/bun": "^1.2.12",