@ynhcj/xiaoyi 2.3.2 → 2.3.4

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 CHANGED
@@ -80,14 +80,11 @@ exports.xiaoyiPlugin = {
80
80
  }
81
81
  const config = account.config;
82
82
  // Check each field is a string and has content after trimming
83
- // Support both old wsUrl and new wsUrl1/wsUrl2
84
- const hasWsUrl = ((typeof config.wsUrl === 'string' && config.wsUrl.trim().length > 0) ||
85
- (typeof config.wsUrl1 === 'string' && config.wsUrl1.trim().length > 0) ||
86
- (typeof config.wsUrl2 === 'string' && config.wsUrl2.trim().length > 0));
83
+ // Note: wsUrl1/wsUrl2 are optional (defaults will be used if not provided)
87
84
  const hasAk = typeof config.ak === 'string' && config.ak.trim().length > 0;
88
85
  const hasSk = typeof config.sk === 'string' && config.sk.trim().length > 0;
89
86
  const hasAgentId = typeof config.agentId === 'string' && config.agentId.trim().length > 0;
90
- return hasWsUrl && hasAk && hasSk && hasAgentId;
87
+ return hasAk && hasSk && hasAgentId;
91
88
  },
92
89
  isEnabled: (account, cfg) => {
93
90
  return account?.enabled !== false;
@@ -96,14 +93,13 @@ exports.xiaoyiPlugin = {
96
93
  return "Channel is disabled in configuration";
97
94
  },
98
95
  unconfiguredReason: (account, cfg) => {
99
- return "Missing required configuration: wsUrl/wsUrl1/wsUrl2, ak, sk, or agentId";
96
+ return "Missing required configuration: ak, sk, or agentId (wsUrl1/wsUrl2 are optional, defaults will be used)";
100
97
  },
101
98
  describeAccount: (account, cfg) => ({
102
99
  accountId: account.accountId,
103
100
  name: 'XiaoYi',
104
101
  enabled: account.enabled,
105
- configured: Boolean((account.config?.wsUrl || account.config?.wsUrl1 || account.config?.wsUrl2) &&
106
- account.config?.ak && account.config?.sk && account.config?.agentId),
102
+ configured: Boolean(account.config?.ak && account.config?.sk && account.config?.agentId),
107
103
  }),
108
104
  },
109
105
  /**
package/dist/runtime.js CHANGED
@@ -65,8 +65,21 @@ class XiaoYiRuntime {
65
65
  manager.on("authenticated", () => {
66
66
  console.log("XiaoYi channel authenticated");
67
67
  });
68
- manager.on("maxReconnectAttemptsReached", () => {
69
- console.error("XiaoYi channel max reconnect attempts reached");
68
+ manager.on("maxReconnectAttemptsReached", (serverId) => {
69
+ console.error(`XiaoYi channel ${serverId} max reconnect attempts reached`);
70
+ // Check if the other server is still connected and ready
71
+ const otherServerId = serverId === 'server1' ? 'server2' : 'server1';
72
+ const serverStates = manager.getServerStates();
73
+ const otherServerState = otherServerId === 'server1' ? serverStates.server1 : serverStates.server2;
74
+ if (otherServerState?.connected && otherServerState?.ready) {
75
+ console.warn(`[${otherServerId}] is still connected and ready, continuing in single-server mode`);
76
+ console.warn(`System will continue running with ${otherServerId} only`);
77
+ // Don't stop, continue with the other server
78
+ return;
79
+ }
80
+ // Only stop when both servers have failed
81
+ console.error("Both servers have reached max reconnect attempts, stopping connection");
82
+ console.error(`Server1: ${serverStates.server1.connected ? 'connected' : 'disconnected'}, Server2: ${serverStates.server2.connected ? 'connected' : 'disconnected'}`);
70
83
  this.stop();
71
84
  });
72
85
  // Connect
package/dist/types.d.ts CHANGED
@@ -163,7 +163,7 @@ export interface WebSocketConnectionState {
163
163
  reconnectAttempts: number;
164
164
  maxReconnectAttempts: number;
165
165
  }
166
- export declare const DEFAULT_WS_URL_1 = "wss://hag-drcn.op.hicloud.com/openclaw/v1/ws/link";
166
+ export declare const DEFAULT_WS_URL_1 = "wss://hag.cloud.huawei.com/openclaw/v1/ws/link";
167
167
  export declare const DEFAULT_WS_URL_2 = "wss://116.63.174.231";
168
168
  export interface InternalWebSocketConfig {
169
169
  wsUrl1: string;
package/dist/types.js CHANGED
@@ -4,5 +4,5 @@
4
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
- exports.DEFAULT_WS_URL_1 = "wss://hag-drcn.op.hicloud.com/openclaw/v1/ws/link";
7
+ exports.DEFAULT_WS_URL_1 = "wss://hag.cloud.huawei.com/openclaw/v1/ws/link";
8
8
  exports.DEFAULT_WS_URL_2 = "wss://116.63.174.231";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "description": "XiaoYi channel plugin for OpenClaw",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",