openclaw-xiaoyou 1.0.7 → 1.1.0
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 +1 -1
- package/src/channel.ts +26 -17
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -94,6 +94,13 @@ export const xiayouPlugin = {
|
|
|
94
94
|
resolveAccount,
|
|
95
95
|
inspectAccount,
|
|
96
96
|
listAccountIds,
|
|
97
|
+
isConfigured: (account: any): boolean => Boolean(account?.config?.wsUrl),
|
|
98
|
+
describeAccount: (account: any) => ({
|
|
99
|
+
accountId: account?.accountId || "default",
|
|
100
|
+
name: "Xiaoyou",
|
|
101
|
+
enabled: account?.enabled !== false,
|
|
102
|
+
}),
|
|
103
|
+
defaultAccountId: (): string => "default",
|
|
97
104
|
},
|
|
98
105
|
|
|
99
106
|
// ── DM 安全策略 ────────────────────────────────────
|
|
@@ -110,21 +117,24 @@ export const xiayouPlugin = {
|
|
|
110
117
|
threading: { topLevelReplyToMode: "reply" as const },
|
|
111
118
|
|
|
112
119
|
// ── Gateway 生命周期 ───────────────────────────────
|
|
120
|
+
reload: { configPrefixes: ["channels.xiaoyou"] },
|
|
121
|
+
|
|
113
122
|
gateway: {
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
startAccount: async (ctx: any) => {
|
|
124
|
+
const { account, cfg, log } = ctx;
|
|
125
|
+
const section = account?.config || getChannelConfig(cfg);
|
|
126
|
+
const logger = log || console;
|
|
127
|
+
|
|
128
|
+
const resolved: ResolvedAccount = {
|
|
129
|
+
wsUrl: section?.wsUrl ?? "",
|
|
130
|
+
authToken: section?.authToken ?? "",
|
|
131
|
+
allowFrom: section?.allowFrom ?? [],
|
|
132
|
+
dmPolicy: section?.dmSecurity,
|
|
133
|
+
reconnectIntervalMs: section?.reconnectIntervalMs ?? 3000,
|
|
134
|
+
maxReconnectAttempts: section?.maxReconnectAttempts ?? 0,
|
|
135
|
+
heartbeatIntervalMs: section?.heartbeatIntervalMs ?? 30000,
|
|
136
|
+
heartbeatTimeoutMs: section?.heartbeatTimeoutMs ?? 10000,
|
|
137
|
+
};
|
|
128
138
|
|
|
129
139
|
// 断开已有连接
|
|
130
140
|
if (_client) _client.disconnect();
|
|
@@ -161,9 +171,8 @@ export const xiayouPlugin = {
|
|
|
161
171
|
return client;
|
|
162
172
|
},
|
|
163
173
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (_client === client) _client = null;
|
|
174
|
+
stopAccount: async () => {
|
|
175
|
+
if (_client) { _client.disconnect(); _client = null; }
|
|
167
176
|
},
|
|
168
177
|
},
|
|
169
178
|
|