@aigne/test-utils 0.3.8 → 0.4.2

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,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.2](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.4.1...test-utils-v0.4.2) (2025-06-19)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @aigne/core bumped to 1.20.1
11
+
12
+ ## [0.4.1](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.4.0...test-utils-v0.4.1) (2025-06-17)
13
+
14
+
15
+ ### Dependencies
16
+
17
+ * The following workspace dependencies were updated
18
+ * dependencies
19
+ * @aigne/core bumped to 1.20.0
20
+
21
+ ## [0.4.0](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.3.8...test-utils-v0.4.0) (2025-06-16)
22
+
23
+
24
+ ### Features
25
+
26
+ * support respond progressing chunks by enable `returnProgressChunks` option for aigne.invoke ([cf4c313](https://github.com/AIGNE-io/aigne-framework/commit/cf4c313ee69f255be799ac196da675b79f69bf76))
27
+
28
+
29
+ ### Dependencies
30
+
31
+ * The following workspace dependencies were updated
32
+ * dependencies
33
+ * @aigne/core bumped to 1.19.0
34
+
3
35
  ## [0.3.8](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.3.7...test-utils-v0.3.8) (2025-06-11)
4
36
 
5
37
 
@@ -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.8",
3
+ "version": "0.4.2",
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.18.6"
27
+ "@aigne/core": "^1.20.1"
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"}