@aigne/transport 0.15.14-beta → 0.15.14-beta.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,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.15.14-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/transport-v0.15.14-beta.1...transport-v0.15.14-beta.2) (2025-11-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* The following workspace dependencies were updated
|
|
9
|
+
* dependencies
|
|
10
|
+
* @aigne/openai bumped to 0.16.5-beta.2
|
|
11
|
+
* devDependencies
|
|
12
|
+
* @aigne/agent-library bumped to 1.21.51-beta.2
|
|
13
|
+
* @aigne/core bumped to 1.65.1-beta.2
|
|
14
|
+
* @aigne/default-memory bumped to 1.2.14-beta.2
|
|
15
|
+
* @aigne/test-utils bumped to 0.5.58-beta.2
|
|
16
|
+
|
|
17
|
+
## [0.15.14-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/transport-v0.15.14-beta...transport-v0.15.14-beta.1) (2025-11-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add fetch utility with timeout and enhanced error handling ([#694](https://github.com/AIGNE-io/aigne-framework/issues/694)) ([c2d4076](https://github.com/AIGNE-io/aigne-framework/commit/c2d4076ec590150d2751591a4f723721f78381e9))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @aigne/openai bumped to 0.16.5-beta.1
|
|
30
|
+
* devDependencies
|
|
31
|
+
* @aigne/agent-library bumped to 1.21.51-beta.1
|
|
32
|
+
* @aigne/core bumped to 1.65.1-beta.1
|
|
33
|
+
* @aigne/default-memory bumped to 1.2.14-beta.1
|
|
34
|
+
* @aigne/test-utils bumped to 0.5.58-beta.1
|
|
35
|
+
|
|
3
36
|
## [0.15.14-beta](https://github.com/AIGNE-io/aigne-framework/compare/transport-v0.15.13...transport-v0.15.14-beta) (2025-11-03)
|
|
4
37
|
|
|
5
38
|
|
|
@@ -35,10 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.BaseClient = void 0;
|
|
37
37
|
const event_stream_js_1 = require("@aigne/core/utils/event-stream.js");
|
|
38
|
+
const fetch_js_1 = require("@aigne/core/utils/fetch.js");
|
|
38
39
|
const logger_js_1 = require("@aigne/core/utils/logger.js");
|
|
39
40
|
const type_utils_js_1 = require("@aigne/core/utils/type-utils.js");
|
|
40
41
|
const constants_js_1 = require("../constants.js");
|
|
41
42
|
const DEFAULT_MAX_RECONNECTS = 3;
|
|
43
|
+
const TIMEOUT = (process.env.TIMEOUT && parseInt(process.env.TIMEOUT, 10)) || 60e3; // default timeout 60 seconds
|
|
42
44
|
/**
|
|
43
45
|
* Http client for interacting with a remote AIGNE server.
|
|
44
46
|
* BaseClient provides a client-side interface that matches the AIGNE API,
|
|
@@ -115,11 +117,14 @@ class BaseClient {
|
|
|
115
117
|
*/
|
|
116
118
|
async fetch(url, init) {
|
|
117
119
|
const { default: retry } = await Promise.resolve().then(() => __importStar(require("p-retry")));
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
const retries = init?.maxRetries ?? DEFAULT_MAX_RECONNECTS;
|
|
121
|
+
const result = await retry(() => (0, fetch_js_1.fetch)(url, { ...init, timeout: TIMEOUT, skipResponseCheck: true }), {
|
|
122
|
+
retries,
|
|
123
|
+
onFailedAttempt: (ctx) => {
|
|
124
|
+
logger_js_1.logger.warn(`Retrying fetch ${url} due to error:`, ctx);
|
|
122
125
|
},
|
|
126
|
+
}).catch((error) => {
|
|
127
|
+
throw new Error(`Failed to fetch ${url} after ${retries} retries: ${error.message}`);
|
|
123
128
|
});
|
|
124
129
|
if (!result.ok) {
|
|
125
130
|
let message;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AgentResponseStreamParser, EventStreamParser } from "@aigne/core/utils/event-stream.js";
|
|
2
|
+
import { fetch } from "@aigne/core/utils/fetch.js";
|
|
2
3
|
import { logger } from "@aigne/core/utils/logger.js";
|
|
3
4
|
import { pick, tryOrThrow } from "@aigne/core/utils/type-utils.js";
|
|
4
5
|
import { ChatModelName } from "../constants.js";
|
|
5
6
|
const DEFAULT_MAX_RECONNECTS = 3;
|
|
7
|
+
const TIMEOUT = (process.env.TIMEOUT && parseInt(process.env.TIMEOUT, 10)) || 60e3; // default timeout 60 seconds
|
|
6
8
|
/**
|
|
7
9
|
* Http client for interacting with a remote AIGNE server.
|
|
8
10
|
* BaseClient provides a client-side interface that matches the AIGNE API,
|
|
@@ -79,11 +81,14 @@ export class BaseClient {
|
|
|
79
81
|
*/
|
|
80
82
|
async fetch(url, init) {
|
|
81
83
|
const { default: retry } = await import("p-retry");
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
const retries = init?.maxRetries ?? DEFAULT_MAX_RECONNECTS;
|
|
85
|
+
const result = await retry(() => fetch(url, { ...init, timeout: TIMEOUT, skipResponseCheck: true }), {
|
|
86
|
+
retries,
|
|
87
|
+
onFailedAttempt: (ctx) => {
|
|
88
|
+
logger.warn(`Retrying fetch ${url} due to error:`, ctx);
|
|
86
89
|
},
|
|
90
|
+
}).catch((error) => {
|
|
91
|
+
throw new Error(`Failed to fetch ${url} after ${retries} retries: ${error.message}`);
|
|
87
92
|
});
|
|
88
93
|
if (!result.ok) {
|
|
89
94
|
let message;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/transport",
|
|
3
|
-
"version": "0.15.14-beta",
|
|
3
|
+
"version": "0.15.14-beta.2",
|
|
4
4
|
"description": "AIGNE Transport SDK providing HTTP client and server implementations for communication between AIGNE components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"p-retry": "^7.0.0",
|
|
47
47
|
"raw-body": "^3.0.1",
|
|
48
48
|
"zod": "^3.25.67",
|
|
49
|
-
"@aigne/openai": "^0.16.5-beta"
|
|
49
|
+
"@aigne/openai": "^0.16.5-beta.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@aigne/uuid": "^13.0.1",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"npm-run-all": "^4.1.5",
|
|
62
62
|
"rimraf": "^6.0.1",
|
|
63
63
|
"typescript": "^5.9.2",
|
|
64
|
-
"@aigne/
|
|
65
|
-
"@aigne/
|
|
66
|
-
"@aigne/default-memory": "^1.2.14-beta",
|
|
67
|
-
"@aigne/
|
|
64
|
+
"@aigne/agent-library": "^1.21.51-beta.2",
|
|
65
|
+
"@aigne/core": "^1.65.1-beta.2",
|
|
66
|
+
"@aigne/default-memory": "^1.2.14-beta.2",
|
|
67
|
+
"@aigne/test-utils": "^0.5.58-beta.2"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"lint": "tsc --noEmit",
|