@aigne/core 1.18.1 → 1.18.3

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
@@ -5,6 +5,20 @@
5
5
 
6
6
  * add user context support ([#131](https://github.com/AIGNE-io/aigne-framework/issues/131)) ([4dd9d20](https://github.com/AIGNE-io/aigne-framework/commit/4dd9d20953f6ac33933723db56efd9b44bafeb02))
7
7
 
8
+ ## [1.18.3](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.18.2...core-v1.18.3) (2025-06-05)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * compatible nodejs version >=20 ([#149](https://github.com/AIGNE-io/aigne-framework/issues/149)) ([d5ae9f2](https://github.com/AIGNE-io/aigne-framework/commit/d5ae9f245972e87e70fd87cdd960ade9940f288c))
14
+
15
+ ## [1.18.2](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.18.1...core-v1.18.2) (2025-05-30)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * provide available memories for AIGNE ([#145](https://github.com/AIGNE-io/aigne-framework/issues/145)) ([c5dc960](https://github.com/AIGNE-io/aigne-framework/commit/c5dc9605e0fb7ca60e1f5fa2f0da67ffec00c601))
21
+
8
22
  ## [1.18.1](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.18.0...core-v1.18.1) (2025-05-30)
9
23
 
10
24
 
@@ -55,7 +55,7 @@ export declare class AIGNE<U extends UserContext = UserContext> {
55
55
  * @param options - Options to override the loaded configuration.
56
56
  * @returns A fully initialized AIGNE instance with configured agents and skills.
57
57
  */
58
- static load(path: string, options: AIGNEOptions & Pick<LoadOptions, "models">): Promise<AIGNE>;
58
+ static load(path: string, options: AIGNEOptions & Omit<LoadOptions, "path">): Promise<AIGNE>;
59
59
  /**
60
60
  * Creates a new AIGNE instance with the specified options.
61
61
  *
@@ -30,7 +30,7 @@ class AIGNE {
30
30
  * @returns A fully initialized AIGNE instance with configured agents and skills.
31
31
  */
32
32
  static async load(path, options) {
33
- const { model, agents, skills, ...aigne } = await (0, index_js_1.load)({ models: options.models, path });
33
+ const { model, agents, skills, ...aigne } = await (0, index_js_1.load)({ ...options, path });
34
34
  return new AIGNE({
35
35
  ...options,
36
36
  model: options?.model || model,
@@ -8,6 +8,7 @@ const agent_js_1 = require("../agents/agent.js");
8
8
  const types_js_1 = require("../agents/types.js");
9
9
  const user_agent_js_1 = require("../agents/user-agent.js");
10
10
  const prompt_builder_js_1 = require("../prompt/prompt-builder.js");
11
+ const promise_js_1 = require("../utils/promise.js");
11
12
  const stream_utils_js_1 = require("../utils/stream-utils.js");
12
13
  const type_utils_js_1 = require("../utils/type-utils.js");
13
14
  const message_queue_js_1 = require("./message-queue.js");
@@ -78,7 +79,7 @@ class AIGNEContext {
78
79
  }
79
80
  return output;
80
81
  }
81
- const activeAgentPromise = Promise.withResolvers();
82
+ const activeAgentPromise = (0, promise_js_1.promiseWithResolvers)();
82
83
  const stream = (0, stream_utils_js_1.onAgentResponseStreamEnd)((0, stream_utils_js_1.asyncGeneratorToReadableStream)(response), async ({ __activeAgent__: activeAgent }) => {
83
84
  activeAgentPromise.resolve(activeAgent);
84
85
  }, {
@@ -227,7 +228,7 @@ class AIGNEContextShared {
227
228
  }
228
229
  async function* withAbortSignal(signal, error, fn) {
229
230
  const iterator = fn();
230
- const timeoutPromise = Promise.withResolvers();
231
+ const timeoutPromise = (0, promise_js_1.promiseWithResolvers)();
231
232
  const listener = () => {
232
233
  timeoutPromise.reject(error);
233
234
  };
@@ -18,8 +18,8 @@ async function load(options) {
18
18
  const aigneFilePath = await getAIGNEFilePath(options.path);
19
19
  const rootDir = index_js_1.nodejs.path.dirname(aigneFilePath);
20
20
  const aigne = await loadAIGNEFile(aigneFilePath);
21
- const agents = await Promise.all((aigne.agents ?? []).map((filename) => loadAgent(index_js_1.nodejs.path.join(rootDir, filename))));
22
- const skills = await Promise.all((aigne.skills ?? []).map((filename) => loadAgent(index_js_1.nodejs.path.join(rootDir, filename))));
21
+ const agents = await Promise.all((aigne.agents ?? []).map((filename) => loadAgent(index_js_1.nodejs.path.join(rootDir, filename), options)));
22
+ const skills = await Promise.all((aigne.skills ?? []).map((filename) => loadAgent(index_js_1.nodejs.path.join(rootDir, filename), options)));
23
23
  return {
24
24
  ...aigne,
25
25
  model: await loadModel(options.models, aigne.chat_model),
@@ -41,7 +41,7 @@ async function loadAgent(path, options) {
41
41
  ? undefined
42
42
  : await loadMemory(options.memories, typeof agent.memory === "object" ? agent.memory.provider : undefined, typeof agent.memory === "object" ? agent.memory : {}),
43
43
  skills: agent.skills &&
44
- (await Promise.all(agent.skills.map((filename) => loadAgent(index_js_1.nodejs.path.join(index_js_1.nodejs.path.dirname(path), filename))))),
44
+ (await Promise.all(agent.skills.map((filename) => loadAgent(index_js_1.nodejs.path.join(index_js_1.nodejs.path.dirname(path), filename), options)))),
45
45
  });
46
46
  }
47
47
  if (agent.type === "mcp") {
@@ -0,0 +1,6 @@
1
+ export interface PromiseWithResolvers<T> {
2
+ promise: Promise<T>;
3
+ resolve: (value: T | PromiseLike<T>) => void;
4
+ reject: (reason?: unknown) => void;
5
+ }
6
+ export declare function promiseWithResolvers<T = void>(): PromiseWithResolvers<T>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promiseWithResolvers = promiseWithResolvers;
4
+ function promiseWithResolvers() {
5
+ let resolve;
6
+ let reject;
7
+ const promise = new Promise((res, rej) => {
8
+ resolve = res;
9
+ reject = rej;
10
+ });
11
+ return { promise, resolve, reject };
12
+ }
@@ -55,7 +55,7 @@ export declare class AIGNE<U extends UserContext = UserContext> {
55
55
  * @param options - Options to override the loaded configuration.
56
56
  * @returns A fully initialized AIGNE instance with configured agents and skills.
57
57
  */
58
- static load(path: string, options: AIGNEOptions & Pick<LoadOptions, "models">): Promise<AIGNE>;
58
+ static load(path: string, options: AIGNEOptions & Omit<LoadOptions, "path">): Promise<AIGNE>;
59
59
  /**
60
60
  * Creates a new AIGNE instance with the specified options.
61
61
  *
@@ -0,0 +1,6 @@
1
+ export interface PromiseWithResolvers<T> {
2
+ promise: Promise<T>;
3
+ resolve: (value: T | PromiseLike<T>) => void;
4
+ reject: (reason?: unknown) => void;
5
+ }
6
+ export declare function promiseWithResolvers<T = void>(): PromiseWithResolvers<T>;
@@ -55,7 +55,7 @@ export declare class AIGNE<U extends UserContext = UserContext> {
55
55
  * @param options - Options to override the loaded configuration.
56
56
  * @returns A fully initialized AIGNE instance with configured agents and skills.
57
57
  */
58
- static load(path: string, options: AIGNEOptions & Pick<LoadOptions, "models">): Promise<AIGNE>;
58
+ static load(path: string, options: AIGNEOptions & Omit<LoadOptions, "path">): Promise<AIGNE>;
59
59
  /**
60
60
  * Creates a new AIGNE instance with the specified options.
61
61
  *
@@ -27,7 +27,7 @@ export class AIGNE {
27
27
  * @returns A fully initialized AIGNE instance with configured agents and skills.
28
28
  */
29
29
  static async load(path, options) {
30
- const { model, agents, skills, ...aigne } = await load({ models: options.models, path });
30
+ const { model, agents, skills, ...aigne } = await load({ ...options, path });
31
31
  return new AIGNE({
32
32
  ...options,
33
33
  model: options?.model || model,
@@ -5,6 +5,7 @@ import { Agent, } from "../agents/agent.js";
5
5
  import { isTransferAgentOutput, transferAgentOutputKey, } from "../agents/types.js";
6
6
  import { UserAgent } from "../agents/user-agent.js";
7
7
  import { createMessage } from "../prompt/prompt-builder.js";
8
+ import { promiseWithResolvers } from "../utils/promise.js";
8
9
  import { agentResponseStreamToObject, asyncGeneratorToReadableStream, onAgentResponseStreamEnd, } from "../utils/stream-utils.js";
9
10
  import { checkArguments, isNil, omitBy, } from "../utils/type-utils.js";
10
11
  import { MessageQueue, toMessagePayload, } from "./message-queue.js";
@@ -75,7 +76,7 @@ export class AIGNEContext {
75
76
  }
76
77
  return output;
77
78
  }
78
- const activeAgentPromise = Promise.withResolvers();
79
+ const activeAgentPromise = promiseWithResolvers();
79
80
  const stream = onAgentResponseStreamEnd(asyncGeneratorToReadableStream(response), async ({ __activeAgent__: activeAgent }) => {
80
81
  activeAgentPromise.resolve(activeAgent);
81
82
  }, {
@@ -223,7 +224,7 @@ class AIGNEContextShared {
223
224
  }
224
225
  async function* withAbortSignal(signal, error, fn) {
225
226
  const iterator = fn();
226
- const timeoutPromise = Promise.withResolvers();
227
+ const timeoutPromise = promiseWithResolvers();
227
228
  const listener = () => {
228
229
  timeoutPromise.reject(error);
229
230
  };
@@ -12,8 +12,8 @@ export async function load(options) {
12
12
  const aigneFilePath = await getAIGNEFilePath(options.path);
13
13
  const rootDir = nodejs.path.dirname(aigneFilePath);
14
14
  const aigne = await loadAIGNEFile(aigneFilePath);
15
- const agents = await Promise.all((aigne.agents ?? []).map((filename) => loadAgent(nodejs.path.join(rootDir, filename))));
16
- const skills = await Promise.all((aigne.skills ?? []).map((filename) => loadAgent(nodejs.path.join(rootDir, filename))));
15
+ const agents = await Promise.all((aigne.agents ?? []).map((filename) => loadAgent(nodejs.path.join(rootDir, filename), options)));
16
+ const skills = await Promise.all((aigne.skills ?? []).map((filename) => loadAgent(nodejs.path.join(rootDir, filename), options)));
17
17
  return {
18
18
  ...aigne,
19
19
  model: await loadModel(options.models, aigne.chat_model),
@@ -35,7 +35,7 @@ export async function loadAgent(path, options) {
35
35
  ? undefined
36
36
  : await loadMemory(options.memories, typeof agent.memory === "object" ? agent.memory.provider : undefined, typeof agent.memory === "object" ? agent.memory : {}),
37
37
  skills: agent.skills &&
38
- (await Promise.all(agent.skills.map((filename) => loadAgent(nodejs.path.join(nodejs.path.dirname(path), filename))))),
38
+ (await Promise.all(agent.skills.map((filename) => loadAgent(nodejs.path.join(nodejs.path.dirname(path), filename), options)))),
39
39
  });
40
40
  }
41
41
  if (agent.type === "mcp") {
@@ -0,0 +1,6 @@
1
+ export interface PromiseWithResolvers<T> {
2
+ promise: Promise<T>;
3
+ resolve: (value: T | PromiseLike<T>) => void;
4
+ reject: (reason?: unknown) => void;
5
+ }
6
+ export declare function promiseWithResolvers<T = void>(): PromiseWithResolvers<T>;
@@ -0,0 +1,9 @@
1
+ export function promiseWithResolvers() {
2
+ let resolve;
3
+ let reject;
4
+ const promise = new Promise((res, rej) => {
5
+ resolve = res;
6
+ reject = rej;
7
+ });
8
+ return { promise, resolve, reject };
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/core",
3
- "version": "1.18.1",
3
+ "version": "1.18.3",
4
4
  "description": "AIGNE core library for building AI-powered applications",
5
5
  "publishConfig": {
6
6
  "access": "public"