@olane/o-node 0.7.12-alpha.61 → 0.7.12-alpha.63
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.
|
@@ -30,7 +30,7 @@ export declare class StreamHandler {
|
|
|
30
30
|
/**
|
|
31
31
|
* Decodes a stream message event into a JSON object
|
|
32
32
|
*/
|
|
33
|
-
decodeMessage(event: any): Promise<any
|
|
33
|
+
decodeMessage(event: any): Promise<any>;
|
|
34
34
|
/**
|
|
35
35
|
* Gets an existing open stream or creates a new one based on reuse policy
|
|
36
36
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-handler.d.ts","sourceRoot":"","sources":["../../../src/connection/stream-handler.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,QAAQ,EACR,SAAS,EAIT,MAAM,EAEP,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"stream-handler.d.ts","sourceRoot":"","sources":["../../../src/connection/stream-handler.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,QAAQ,EACR,SAAS,EAIT,MAAM,EAEP,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,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AAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,GACzE,OAAO,CAAC,SAAS,CAAC;IAsGrB;;;;;;;OAOG;IACG,cAAc,CAClB,OAAO,EAAE,cAAc,EACvB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,GAChD,OAAO,CAAC,IAAI,CAAC;CAyBjB"}
|
|
@@ -131,18 +131,19 @@ export class StreamHandler {
|
|
|
131
131
|
if (!event.data) {
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
134
|
+
const message = await this.decodeMessage(event);
|
|
135
|
+
if (typeof message === 'string') {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (this.isRequest(message)) {
|
|
139
|
+
await this.handleRequestMessage(message, stream, toolExecutor);
|
|
140
|
+
}
|
|
141
|
+
else if (this.isResponse(message)) {
|
|
142
|
+
this.logger.warn('Received response message on server-side stream, ignoring', message);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.logger.warn('Received unknown message type', message);
|
|
146
|
+
}
|
|
146
147
|
}
|
|
147
148
|
catch (error) {
|
|
148
149
|
this.logger.error('Error handling stream message:', error);
|
|
@@ -200,32 +201,38 @@ export class StreamHandler {
|
|
|
200
201
|
return;
|
|
201
202
|
}
|
|
202
203
|
try {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
204
|
+
const message = await this.decodeMessage(event);
|
|
205
|
+
if (typeof message === 'string') {
|
|
206
|
+
// this.logger.warn(
|
|
207
|
+
// 'Received string message on server-side stream, ignoring',
|
|
208
|
+
// message,
|
|
209
|
+
// );
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (this.isResponse(message)) {
|
|
213
|
+
const response = await CoreUtils.processStreamResponse(event);
|
|
214
|
+
// Emit chunk for streaming responses
|
|
215
|
+
emitter.emit('chunk', response);
|
|
216
|
+
// Check if this is the last chunk
|
|
217
|
+
if (response.result._last || !response.result._isStreaming) {
|
|
218
|
+
lastResponse = response;
|
|
219
|
+
cleanup();
|
|
220
|
+
resolve(response);
|
|
214
221
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
else {
|
|
222
|
-
this.logger.warn('Received request message on client-side stream, ignoring (no handler)', message);
|
|
223
|
-
}
|
|
222
|
+
}
|
|
223
|
+
else if (this.isRequest(message)) {
|
|
224
|
+
// Process incoming router requests if handler is provided
|
|
225
|
+
if (requestHandler) {
|
|
226
|
+
this.logger.debug('Received router request on client-side stream, processing...', message);
|
|
227
|
+
await this.handleRequestMessage(message, stream, requestHandler);
|
|
224
228
|
}
|
|
225
229
|
else {
|
|
226
|
-
this.logger.warn('Received
|
|
230
|
+
this.logger.warn('Received request message on client-side stream, ignoring (no handler)', message);
|
|
227
231
|
}
|
|
228
|
-
}
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
this.logger.warn('Received unknown message type', message);
|
|
235
|
+
}
|
|
229
236
|
}
|
|
230
237
|
catch (error) {
|
|
231
238
|
this.logger.error('Error handling response message:', error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-node",
|
|
3
|
-
"version": "0.7.12-alpha.
|
|
3
|
+
"version": "0.7.12-alpha.63",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"typescript": "5.4.5"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@olane/o-config": "0.7.12-alpha.
|
|
58
|
-
"@olane/o-core": "0.7.12-alpha.
|
|
59
|
-
"@olane/o-protocol": "0.7.12-alpha.
|
|
60
|
-
"@olane/o-tool": "0.7.12-alpha.
|
|
57
|
+
"@olane/o-config": "0.7.12-alpha.63",
|
|
58
|
+
"@olane/o-core": "0.7.12-alpha.63",
|
|
59
|
+
"@olane/o-protocol": "0.7.12-alpha.63",
|
|
60
|
+
"@olane/o-tool": "0.7.12-alpha.63",
|
|
61
61
|
"debug": "^4.4.1",
|
|
62
62
|
"dotenv": "^16.5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "15b71d4db9a85dc2362569621fcc12235b2a241b"
|
|
65
65
|
}
|