@oh-my-pi/pi-agent-core 6.8.0 → 6.8.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/package.json +4 -4
- package/src/proxy.ts +6 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-agent-core",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.2",
|
|
4
4
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"test": "vitest --run"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@oh-my-pi/pi-ai": "6.8.
|
|
17
|
-
"@oh-my-pi/pi-tui": "6.8.
|
|
18
|
-
"@oh-my-pi/pi-utils": "6.8.
|
|
16
|
+
"@oh-my-pi/pi-ai": "6.8.2",
|
|
17
|
+
"@oh-my-pi/pi-tui": "6.8.2",
|
|
18
|
+
"@oh-my-pi/pi-utils": "6.8.2"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"ai",
|
package/src/proxy.ts
CHANGED
|
@@ -105,20 +105,19 @@ export function streamProxy(model: Model<any>, context: Context, options: ProxyS
|
|
|
105
105
|
timestamp: Date.now(),
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
let
|
|
109
|
-
|
|
108
|
+
let response: Response | null = null;
|
|
110
109
|
const abortHandler = () => {
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
const body = response?.body;
|
|
111
|
+
if (body) {
|
|
112
|
+
body.cancel("Request aborted by user").catch(() => {});
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
|
|
116
115
|
if (options.signal) {
|
|
117
|
-
options.signal.addEventListener("abort", abortHandler);
|
|
116
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
try {
|
|
121
|
-
|
|
120
|
+
response = await fetch(`${options.proxyUrl}/api/stream`, {
|
|
122
121
|
method: "POST",
|
|
123
122
|
headers: {
|
|
124
123
|
Authorization: `Bearer ${options.authToken}`,
|