@ynhcj/xiaoyi 2.4.0 → 2.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/dist/channel.js +7 -2
- package/dist/types.d.ts +4 -2
- package/dist/types.js +1 -1
- package/dist/websocket.d.ts +1 -1
- package/dist/websocket.js +6 -6
- package/package.json +1 -1
package/dist/channel.js
CHANGED
|
@@ -214,8 +214,13 @@ exports.xiaoyiPlugin = {
|
|
|
214
214
|
const { getXiaoYiRuntime } = require("./runtime");
|
|
215
215
|
const runtime = getXiaoYiRuntime();
|
|
216
216
|
console.log(`XiaoYi: [Message Handler] Using runtime instance: ${runtime.getInstanceId()}`);
|
|
217
|
-
// For message/stream, prioritize params.sessionId, fallback to top-level
|
|
218
|
-
const sessionId = message.params
|
|
217
|
+
// For message/stream, prioritize params.sessionId, fallback to top-level sessionId
|
|
218
|
+
const sessionId = message.params?.sessionId || message.sessionId;
|
|
219
|
+
// Validate sessionId exists
|
|
220
|
+
if (!sessionId) {
|
|
221
|
+
console.error("XiaoYi: Missing sessionId in message, cannot process");
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
219
224
|
// Store sessionId -> taskId mapping in runtime (use params.id as taskId)
|
|
220
225
|
runtime.setTaskIdForSession(sessionId, message.params.id);
|
|
221
226
|
// Get PluginRuntime from our runtime wrapper
|
package/dist/types.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ export interface A2ARequestMessage {
|
|
|
4
4
|
id: string;
|
|
5
5
|
method: "message/stream";
|
|
6
6
|
deviceId?: string;
|
|
7
|
+
conversationId?: string;
|
|
8
|
+
sessionId?: string;
|
|
7
9
|
params: {
|
|
8
10
|
id: string;
|
|
9
|
-
sessionId
|
|
11
|
+
sessionId?: string;
|
|
10
12
|
agentLoginSessionId?: string;
|
|
11
13
|
message: {
|
|
12
14
|
kind?: string;
|
|
@@ -166,7 +168,7 @@ export interface WebSocketConnectionState {
|
|
|
166
168
|
maxReconnectAttempts: number;
|
|
167
169
|
}
|
|
168
170
|
export declare const DEFAULT_WS_URL_1 = "wss://hag.cloud.huawei.com/openclaw/v1/ws/link";
|
|
169
|
-
export declare const DEFAULT_WS_URL_2 = "wss://116.63.174.231";
|
|
171
|
+
export declare const DEFAULT_WS_URL_2 = "wss://116.63.174.231/openclaw/v1/ws/link";
|
|
170
172
|
export interface InternalWebSocketConfig {
|
|
171
173
|
wsUrl1: string;
|
|
172
174
|
wsUrl2: string;
|
package/dist/types.js
CHANGED
|
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.DEFAULT_WS_URL_2 = exports.DEFAULT_WS_URL_1 = void 0;
|
|
6
6
|
// Dual server configuration
|
|
7
7
|
exports.DEFAULT_WS_URL_1 = "wss://hag.cloud.huawei.com/openclaw/v1/ws/link";
|
|
8
|
-
exports.DEFAULT_WS_URL_2 = "wss://116.63.174.231";
|
|
8
|
+
exports.DEFAULT_WS_URL_2 = "wss://116.63.174.231/openclaw/v1/ws/link";
|
package/dist/websocket.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare class XiaoYiWebSocketManager extends EventEmitter {
|
|
|
53
53
|
/**
|
|
54
54
|
* Extract sessionId from message based on method type
|
|
55
55
|
* Different methods have sessionId in different locations:
|
|
56
|
-
* - message/stream: sessionId
|
|
56
|
+
* - message/stream: sessionId in params, fallback to top-level sessionId
|
|
57
57
|
* - tasks/cancel: sessionId at top level
|
|
58
58
|
* - clearContext: sessionId at top level
|
|
59
59
|
*/
|
package/dist/websocket.js
CHANGED
|
@@ -306,14 +306,14 @@ class XiaoYiWebSocketManager extends events_1.EventEmitter {
|
|
|
306
306
|
/**
|
|
307
307
|
* Extract sessionId from message based on method type
|
|
308
308
|
* Different methods have sessionId in different locations:
|
|
309
|
-
* - message/stream: sessionId
|
|
309
|
+
* - message/stream: sessionId in params, fallback to top-level sessionId
|
|
310
310
|
* - tasks/cancel: sessionId at top level
|
|
311
311
|
* - clearContext: sessionId at top level
|
|
312
312
|
*/
|
|
313
313
|
extractSessionId(message) {
|
|
314
|
-
// For message/stream, sessionId
|
|
314
|
+
// For message/stream, prioritize params.sessionId, fallback to top-level sessionId
|
|
315
315
|
if (message.method === "message/stream") {
|
|
316
|
-
return message.params?.sessionId;
|
|
316
|
+
return message.params?.sessionId || message.sessionId;
|
|
317
317
|
}
|
|
318
318
|
// For tasks/cancel and clearContext, sessionId is at top level
|
|
319
319
|
if (message.method === "tasks/cancel" ||
|
|
@@ -361,8 +361,8 @@ class XiaoYiWebSocketManager extends events_1.EventEmitter {
|
|
|
361
361
|
}
|
|
362
362
|
// Handle regular A2A request
|
|
363
363
|
if (this.isA2ARequestMessage(message)) {
|
|
364
|
-
// Store task for potential cancellation (support
|
|
365
|
-
const sessionId = message.params
|
|
364
|
+
// Store task for potential cancellation (support params.sessionId or top-level sessionId)
|
|
365
|
+
const sessionId = message.params?.sessionId || message.sessionId;
|
|
366
366
|
this.activeTasks.set(message.id, {
|
|
367
367
|
sessionId: sessionId,
|
|
368
368
|
timestamp: Date.now(),
|
|
@@ -810,7 +810,7 @@ class XiaoYiWebSocketManager extends events_1.EventEmitter {
|
|
|
810
810
|
data.params &&
|
|
811
811
|
typeof data.params.id === "string" &&
|
|
812
812
|
// sessionId can be in params OR at top level
|
|
813
|
-
(typeof data.params.sessionId === "string" || typeof data.
|
|
813
|
+
(typeof data.params.sessionId === "string" || typeof data.sessionId === "string") &&
|
|
814
814
|
data.params.message &&
|
|
815
815
|
typeof data.params.message.role === "string" &&
|
|
816
816
|
Array.isArray(data.params.message.parts);
|