@aigne/test-utils 0.3.7 → 0.4.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
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.0](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.3.8...test-utils-v0.4.0) (2025-06-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* support respond progressing chunks by enable `returnProgressChunks` option for aigne.invoke ([cf4c313](https://github.com/AIGNE-io/aigne-framework/commit/cf4c313ee69f255be799ac196da675b79f69bf76))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/core bumped to 1.19.0
|
|
16
|
+
|
|
17
|
+
## [0.3.8](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.3.7...test-utils-v0.3.8) (2025-06-11)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
* The following workspace dependencies were updated
|
|
23
|
+
* dependencies
|
|
24
|
+
* @aigne/core bumped to 1.18.6
|
|
25
|
+
|
|
3
26
|
## [0.3.7](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.3.6...test-utils-v0.3.7) (2025-06-06)
|
|
4
27
|
|
|
5
28
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type AgentResponseChunk, type AgentResponseStream, type Message } from "@aigne/core";
|
|
2
|
+
export declare function agentResponseStreamToArraySnapshot<T extends Message>(stream: AgentResponseStream<T>, options?: {
|
|
3
|
+
catchError?: false;
|
|
4
|
+
}): Promise<AgentResponseChunk<T>[]>;
|
|
5
|
+
export declare function agentResponseStreamToArraySnapshot<T extends Message>(stream: AgentResponseStream<T>, options?: {
|
|
6
|
+
catchError?: boolean;
|
|
7
|
+
}): Promise<(AgentResponseChunk<T> | Error)[]>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isAgentResponseProgress, } from "@aigne/core";
|
|
2
|
+
import { readableStreamToArray } from "@aigne/core/utils/stream-utils.js";
|
|
3
|
+
export async function agentResponseStreamToArraySnapshot(stream, options) {
|
|
4
|
+
return (await readableStreamToArray(stream, options)).map((i) => !(i instanceof Error) && isAgentResponseProgress(i)
|
|
5
|
+
? {
|
|
6
|
+
progress: {
|
|
7
|
+
...i.progress,
|
|
8
|
+
contextId: "TEST_CONTEXT_ID",
|
|
9
|
+
parentContextId: "TEST_PARENT_CONTEXT_ID",
|
|
10
|
+
timestamp: 123456,
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
: i);
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/test-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Test utils for AIGNE framework",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aigne/core": "^1.
|
|
27
|
+
"@aigne/core": "^1.19.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/bun": "^1.2.12",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AgentResponseChunk,
|
|
3
|
+
type AgentResponseStream,
|
|
4
|
+
type Message,
|
|
5
|
+
isAgentResponseProgress,
|
|
6
|
+
} from "@aigne/core";
|
|
7
|
+
import { readableStreamToArray } from "@aigne/core/utils/stream-utils.js";
|
|
8
|
+
|
|
9
|
+
export async function agentResponseStreamToArraySnapshot<T extends Message>(
|
|
10
|
+
stream: AgentResponseStream<T>,
|
|
11
|
+
options?: { catchError?: false },
|
|
12
|
+
): Promise<AgentResponseChunk<T>[]>;
|
|
13
|
+
export async function agentResponseStreamToArraySnapshot<T extends Message>(
|
|
14
|
+
stream: AgentResponseStream<T>,
|
|
15
|
+
options?: { catchError?: boolean },
|
|
16
|
+
): Promise<(AgentResponseChunk<T> | Error)[]>;
|
|
17
|
+
export async function agentResponseStreamToArraySnapshot<T extends Message>(
|
|
18
|
+
stream: AgentResponseStream<T>,
|
|
19
|
+
options?: { catchError?: boolean },
|
|
20
|
+
): Promise<(AgentResponseChunk<T> | Error)[]> {
|
|
21
|
+
return (await readableStreamToArray(stream, options)).map((i) =>
|
|
22
|
+
!(i instanceof Error) && isAgentResponseProgress(i)
|
|
23
|
+
? {
|
|
24
|
+
progress: {
|
|
25
|
+
...i.progress,
|
|
26
|
+
contextId: "TEST_CONTEXT_ID",
|
|
27
|
+
parentContextId: "TEST_PARENT_CONTEXT_ID",
|
|
28
|
+
timestamp: 123456,
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
: i,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/run-example-test.ts","./src/utils/event-stream.ts","./src/utils/openai-like-utils.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["./src/run-example-test.ts","./src/utils/agent-response.ts","./src/utils/event-stream.ts","./src/utils/openai-like-utils.ts"],"version":"5.8.3"}
|