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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/channel.ts +26 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-xiaoyou",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Xiaoyou channel plugin for OpenClaw — connects enterprise services via persistent outbound WebSocket",
6
6
  "openclaw": {
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
- start: async ({ account, config, logger }: any) => {
115
- const resolved: ResolvedAccount =
116
- typeof account?.wsUrl === "string"
117
- ? account
118
- : {
119
- wsUrl: account?.config?.wsUrl ?? "",
120
- authToken: account?.config?.authToken ?? "",
121
- allowFrom: account?.config?.allowFrom ?? [],
122
- dmPolicy: account?.config?.dmSecurity,
123
- reconnectIntervalMs: account?.config?.reconnectIntervalMs ?? 3000,
124
- maxReconnectAttempts: account?.config?.maxReconnectAttempts ?? 0,
125
- heartbeatIntervalMs: account?.config?.heartbeatIntervalMs ?? 30000,
126
- heartbeatTimeoutMs: account?.config?.heartbeatTimeoutMs ?? 10000,
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
- stop: async (client: EnterpriseClient) => {
165
- client.disconnect();
166
- if (_client === client) _client = null;
174
+ stopAccount: async () => {
175
+ if (_client) { _client.disconnect(); _client = null; }
167
176
  },
168
177
  },
169
178