@aigne/core 1.18.2 → 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 +7 -0
- package/lib/cjs/aigne/context.js +3 -2
- package/lib/cjs/utils/promise.d.ts +6 -0
- package/lib/cjs/utils/promise.js +12 -0
- package/lib/dts/utils/promise.d.ts +6 -0
- package/lib/esm/aigne/context.js +3 -2
- package/lib/esm/utils/promise.d.ts +6 -0
- package/lib/esm/utils/promise.js +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
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
|
+
|
|
8
15
|
## [1.18.2](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.18.1...core-v1.18.2) (2025-05-30)
|
|
9
16
|
|
|
10
17
|
|
package/lib/cjs/aigne/context.js
CHANGED
|
@@ -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 =
|
|
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 =
|
|
231
|
+
const timeoutPromise = (0, promise_js_1.promiseWithResolvers)();
|
|
231
232
|
const listener = () => {
|
|
232
233
|
timeoutPromise.reject(error);
|
|
233
234
|
};
|
|
@@ -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
|
+
}
|
package/lib/esm/aigne/context.js
CHANGED
|
@@ -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 =
|
|
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 =
|
|
227
|
+
const timeoutPromise = promiseWithResolvers();
|
|
227
228
|
const listener = () => {
|
|
228
229
|
timeoutPromise.reject(error);
|
|
229
230
|
};
|