openclaw-xiaoyou 1.3.5 → 1.3.6

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/docs/SKILL.md CHANGED
@@ -28,13 +28,13 @@ description: Use when users want to install, upgrade, uninstall, configure, or t
28
28
  ### 第一步:卸载旧版本(幂等操作,未安装时不会报错)
29
29
 
30
30
  ```bash
31
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- uninstall
31
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- uninstall
32
32
  ```
33
33
 
34
34
  ### 第二步:安装
35
35
 
36
36
  ```bash
37
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw --token <AccessToken>
37
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw --token <AccessToken>
38
38
  ```
39
39
 
40
40
  将 `<AccessToken>` 替换为用户提供的实际 Token 值。
@@ -58,7 +58,7 @@ openclaw gateway status
58
58
  |------|------|------|
59
59
  | `--ws-url <url>` | 是(首次安装) | 企业 WebSocket 服务地址,默认 `ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw` |
60
60
  | `--token <token>` | 是(首次安装) | 企业服务认证 Token(用户必须提供) |
61
- | `--version <ver>` | 否 | 指定 openclaw-xiaoyou 版本,默认 1.3.4 |
61
+ | `--version <ver>` | 否 | 指定 openclaw-xiaoyou 版本,默认 latest |
62
62
  | `--check-only` | 否 | 只输出计划,不执行真实改动 |
63
63
  | `uninstall` | 否 | 卸载小优 channel |
64
64
 
@@ -67,14 +67,14 @@ openclaw gateway status
67
67
  升级同样先卸载再安装:
68
68
 
69
69
  ```bash
70
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- uninstall
71
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw --token <AccessToken>
70
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- uninstall
71
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw --token <AccessToken>
72
72
  ```
73
73
 
74
74
  ## 卸载
75
75
 
76
76
  ```bash
77
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- uninstall
77
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- uninstall
78
78
  ```
79
79
 
80
80
  ## 交互约束(最少用户操作)
@@ -89,16 +89,17 @@ curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12d
89
89
  ## 脚本做了什么
90
90
 
91
91
  1. 检测 OpenClaw 是否已安装并运行
92
- 2. 安装/升级 `openclaw-xiaoyou` 插件(`openclaw plugins install openclaw-xiaoyou@1.3.4`)
92
+ 2. 安装/升级 `openclaw-xiaoyou` 插件(`openclaw plugins install openclaw-xiaoyou@latest`)
93
93
  3. 写入 channel 配置到 `~/.openclaw/openclaw.json`:
94
94
  - `channels.xiaoyou.enabled = true`
95
95
  - `channels.xiaoyou.wsUrl = <用户提供的地址>`
96
96
  - `channels.xiaoyou.authToken = <用户提供的 token>`
97
97
  - `channels.xiaoyou.dmSecurity = open`
98
98
  - `channels.xiaoyou.blockStreaming = true`
99
- - `channels.xiaoyou.blockStreamingChunk = {"minChars": 1, "maxChars": 20}`
100
- - `channels.xiaoyou.blockStreamingCoalesce = {"minChars": 1, "maxChars": 20, "idleMs": 30}`
101
- 4. 重启 gateway 并检查插件状态
99
+ - `channels.xiaoyou.blockStreamingChunk = {"minChars": 1, "maxChars": 200}`
100
+ - `channels.xiaoyou.blockStreamingCoalesce = {"minChars": 1, "maxChars": 200, "idleMs": 100}`
101
+ 4. 写入 agents.defaults 全局 fallback(不覆盖已有配置)
102
+ 5. 重启 gateway 并检查插件状态
102
103
 
103
104
  ## 完成定义
104
105
 
@@ -131,7 +132,7 @@ Gateway 已经重启成功,运行正常。
131
132
 
132
133
  ```
133
134
  小优 channel 配置结果:
134
- ✅ 插件 openclaw-xiaoyou@1.3.4 已安装
135
+ ✅ 插件 openclaw-xiaoyou@1.3.5 已安装
135
136
  ✅ AccessToken 已写入配置
136
137
  ✅ xiaoyou channel 已启用
137
138
  ✅ dmSecurity 设为 open
@@ -177,7 +178,7 @@ openclaw plugins list
177
178
 
178
179
  ```bash
179
180
  npm config set registry https://registry.npmmirror.com
180
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw --token <AccessToken>
181
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw --token <AccessToken>
181
182
  ```
182
183
 
183
184
  ### WebSocket 连接不上
@@ -208,7 +209,7 @@ openclaw gateway restart
208
209
  ### 更换 Token
209
210
 
210
211
  ```bash
211
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw --token <新Token>
212
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw --token <新Token>
212
213
  ```
213
214
 
214
215
  ### 常用命令清单
@@ -217,7 +218,7 @@ curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12d
217
218
  openclaw --version
218
219
  openclaw plugins list
219
220
  openclaw gateway status
220
- cat ~/.openclaw/openclaw.json | python3 -m json.tool
221
+ cat ~/.openclaw/openclaw.json | node -e "process.stdin.resume();let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>console.log(JSON.stringify(JSON.parse(d),null,2)))"
221
222
  tail -n 100 ~/.openclaw/logs/xiaoyou.log
222
223
  tail -f ~/.openclaw/logs/xiaoyou.log
223
224
  openclaw gateway restart
@@ -362,8 +362,8 @@ if (!xiaoyou.heartbeatIntervalMs) xiaoyou.heartbeatIntervalMs = 30000;
362
362
  if (!xiaoyou.heartbeatTimeoutMs) xiaoyou.heartbeatTimeoutMs = 10000;
363
363
  // 开启 block streaming(仅 xiaoyou channel)
364
364
  xiaoyou.blockStreaming = true;
365
- xiaoyou.blockStreamingChunk = { minChars: 1, maxChars: 20 };
366
- xiaoyou.blockStreamingCoalesce = { minChars: 1, maxChars: 20, idleMs: 30 };
365
+ xiaoyou.blockStreamingChunk = { minChars: 1, maxChars: 200 };
366
+ xiaoyou.blockStreamingCoalesce = { minChars: 1, maxChars: 200, idleMs: 100 };
367
367
  cfg.channels.xiaoyou = xiaoyou;
368
368
 
369
369
  // 同时写入 agents.defaults 作为全局 fallback(确保流式生效)
@@ -372,8 +372,8 @@ if (!cfg.agents.defaults) cfg.agents.defaults = {};
372
372
  const defaults = cfg.agents.defaults;
373
373
  if (!defaults.blockStreamingDefault) defaults.blockStreamingDefault = 'on';
374
374
  if (!defaults.blockStreamingBreak) defaults.blockStreamingBreak = 'text_end';
375
- if (!defaults.blockStreamingChunk) defaults.blockStreamingChunk = { minChars: 1, maxChars: 20 };
376
- if (!defaults.blockStreamingCoalesce) defaults.blockStreamingCoalesce = { minChars: 1, maxChars: 20, idleMs: 30 };
375
+ if (!defaults.blockStreamingChunk) defaults.blockStreamingChunk = { minChars: 1, maxChars: 200 };
376
+ if (!defaults.blockStreamingCoalesce) defaults.blockStreamingCoalesce = { minChars: 1, maxChars: 200, idleMs: 100 };
377
377
 
378
378
  try {
379
379
  fs.writeFileSync(configFile, JSON.stringify(cfg, null, 2));
@@ -422,24 +422,23 @@ xiayou_uninstall_plugin_only() {
422
422
  local config_file
423
423
  config_file="$(openclaw_config_file)"
424
424
 
425
- if [[ -f "$config_file" ]] && command_exists python3; then
426
- python3 -c "
427
- import json
428
- config_file = '$config_file'
429
- with open(config_file, 'r') as f:
430
- cfg = json.load(f)
431
- changed = False
432
- for key in ['xiaoyou', 'openclaw-xiaoyou']:
433
- if cfg.get('plugins', {}).get('entries', {}).pop(key, None): changed = True
434
- if cfg.get('plugins', {}).get('installs', {}).pop(key, None): changed = True
435
- allow = cfg.get('plugins', {}).get('allow', [])
436
- if key in allow:
437
- allow.remove(key)
438
- changed = True
439
- if changed:
440
- with open(config_file, 'w') as f:
441
- json.dump(cfg, f, indent=2, ensure_ascii=False)
442
- print('[xiaoyou-install] 已清理插件注册记录')
425
+ if [[ -f "$config_file" ]]; then
426
+ node -e "
427
+ const fs = require('fs');
428
+ const configFile = '$config_file';
429
+ let cfg;
430
+ try { cfg = JSON.parse(fs.readFileSync(configFile, 'utf8')); } catch(e) { process.exit(0); }
431
+ let changed = false;
432
+ const keys = ['xiaoyou', 'openclaw-xiaoyou'];
433
+ for (const key of keys) {
434
+ if (cfg.plugins && cfg.plugins.entries && cfg.plugins.entries[key]) { delete cfg.plugins.entries[key]; changed = true; }
435
+ if (cfg.plugins && cfg.plugins.installs && cfg.plugins.installs[key]) { delete cfg.plugins.installs[key]; changed = true; }
436
+ if (cfg.plugins && cfg.plugins.allow && cfg.plugins.allow.includes(key)) { cfg.plugins.allow = cfg.plugins.allow.filter(k => k !== key); changed = true; }
437
+ }
438
+ if (changed) {
439
+ fs.writeFileSync(configFile, JSON.stringify(cfg, null, 2));
440
+ console.log('[xiaoyou-install] 已清理插件注册记录');
441
+ }
443
442
  " || true
444
443
  fi
445
444
 
@@ -460,21 +459,23 @@ xiayou_uninstall() {
460
459
  local config_file
461
460
  config_file="$(openclaw_config_file)"
462
461
 
463
- if [[ -f "$config_file" ]] && command_exists python3; then
464
- run_or_dry_run python3 -c "
465
- import json
466
- config_file = '$config_file'
467
- with open(config_file, 'r') as f:
468
- cfg = json.load(f)
469
- cfg.get('channels', {}).pop('xiaoyou', None)
470
- for key in ['xiaoyou', 'openclaw-xiaoyou']:
471
- cfg.get('plugins', {}).get('entries', {}).pop(key, None)
472
- cfg.get('plugins', {}).get('installs', {}).pop(key, None)
473
- allow = cfg.get('plugins', {}).get('allow', [])
474
- if key in allow: allow.remove(key)
475
- with open(config_file, 'w') as f:
476
- json.dump(cfg, f, indent=2, ensure_ascii=False)
477
- print('[xiaoyou-install] 已清理所有 xiaoyou 配置')
462
+ if [[ -f "$config_file" ]]; then
463
+ run_or_dry_run node -e "
464
+ const fs = require('fs');
465
+ const configFile = '$config_file';
466
+ let cfg;
467
+ try { cfg = JSON.parse(fs.readFileSync(configFile, 'utf8')); } catch(e) { process.exit(0); }
468
+ if (cfg.channels) delete cfg.channels.xiaoyou;
469
+ const keys = ['xiaoyou', 'openclaw-xiaoyou'];
470
+ for (const key of keys) {
471
+ if (cfg.plugins && cfg.plugins.entries) delete cfg.plugins.entries[key];
472
+ if (cfg.plugins && cfg.plugins.installs) delete cfg.plugins.installs[key];
473
+ if (cfg.plugins && cfg.plugins.allow && cfg.plugins.allow.includes(key)) {
474
+ cfg.plugins.allow = cfg.plugins.allow.filter(k => k !== key);
475
+ }
476
+ }
477
+ fs.writeFileSync(configFile, JSON.stringify(cfg, null, 2));
478
+ console.log('[xiaoyou-install] 已清理所有 xiaoyou 配置');
478
479
  " || warn "清理配置失败"
479
480
  fi
480
481
 
@@ -1,25 +1,24 @@
1
1
 
2
- # 小优 Channel 安装话术与部署路�?
2
+ # 小优 Channel 安装话术与部署路径
3
3
 
4
4
  ## 安装话术
5
5
 
6
- 按照 https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh 文档完成小优channel配置,AccessToken为xiaoyou-025b07e43ae84cd6
6
+ 按照 https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh 文档完成小优channel配置,AccessToken为xiaoyou-025b07e43ae84cd6
7
7
 
8
8
  ## 脚本位置
9
9
 
10
- https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh
10
+ https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh
11
11
 
12
12
  ## 卸载+重装命令
13
13
 
14
14
  ```bash
15
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- uninstall && \
16
- curl -fsSL https://d10.tfdl.net/public/2026-05-08/7c0c5f98-9ee5-47ee-8dd9-54b12dbe8f4d/install-xiaoyou.sh | bash -s -- \
17
- --version 1.2.5 \
15
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- uninstall && \
16
+ curl -fsSL https://d10.tfdl.net/public/2026-05-08/bb45d361-a7b6-4c13-a251-a76eca5f89e5/install-xiaoyou.sh | bash -s -- \
18
17
  --ws-url ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw \
19
18
  --token xiaoyou-025b07e43ae84cd6
20
19
  ```
21
20
 
22
- ## 验证发消�?
21
+ ## 验证发消息
23
22
 
24
23
  ```bash
25
24
  curl -X POST http://172.16.4.35:11480/ai-connection/xiaoyou/message/send \
@@ -46,11 +45,11 @@ journalctl --user -u openclaw-gateway.service --since "2 min ago" --no-pager | g
46
45
 
47
46
  ## 部署路径
48
47
 
49
- 验收环境位置�?
48
+ 验收环境位置:
50
49
  /aiysnfs/nginx/share/skills/upload/claw
51
50
 
52
- 仿真环境位置�?
51
+ 仿真环境位置:
53
52
  /ai-sim/export/nginx/share/skills/upload/claw
54
53
 
55
- 生产环境位置�?
54
+ 生产环境位置:
56
55
  /ai-prod/export/nginx/share/skills/upload/claw
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-xiaoyou",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
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
@@ -16,24 +16,6 @@ let _runtime: any = null;
16
16
  export function setRuntime(rt: any) { _runtime = rt; }
17
17
  export function getRuntime() { return _runtime; }
18
18
 
19
- // ─── 按标点/换行拆分文本 ─────────────────────────────
20
-
21
- /**
22
- * 将文本按中英文标点符号和换行符拆分为多个片段。
23
- * 每个片段以标点或换行结尾(保留标点在片段内)。
24
- */
25
- function splitBySentence(text: string): string[] {
26
- // 匹配:中文标点(。!?;,:)、英文标点(.!?;,:)后跟空格或结尾、换行符
27
- const parts = text.split(/(?<=[。!?;,:\n])|(?<=[.!?;,:]\s)/);
28
- const result: string[] = [];
29
- for (const part of parts) {
30
- if (part.length > 0) {
31
- result.push(part);
32
- }
33
- }
34
- return result.length > 0 ? result : [text];
35
- }
36
-
37
19
  // ─── Config Adapter ──────────────────────────────────
38
20
 
39
21
  function getChannelConfig(cfg: any): any {
@@ -217,25 +199,21 @@ export const xiayouPlugin = {
217
199
  const textToSend = payload.markdown || payload.text;
218
200
  if (!textToSend) return;
219
201
 
220
- // 按标点/换行拆分为更细的片段
221
- const sentences = splitBySentence(textToSend);
222
-
223
- for (const sentence of sentences) {
224
- fullText += sentence;
225
- if (_client && _client.isConnected()) {
226
- _client.sendReply({
227
- type: "reply",
228
- conversationId,
229
- messageId: replyMessageId,
230
- replyToMessageId: inboundMessageId,
231
- text: sentence,
232
- streamStatus: "chunk",
233
- seq: chunkSeq++,
234
- timestamp: Date.now(),
235
- });
236
- }
202
+ fullText += textToSend;
203
+
204
+ if (_client && _client.isConnected()) {
205
+ _client.sendReply({
206
+ type: "reply",
207
+ conversationId,
208
+ messageId: replyMessageId,
209
+ replyToMessageId: inboundMessageId,
210
+ text: textToSend,
211
+ streamStatus: "chunk",
212
+ seq: chunkSeq++,
213
+ timestamp: Date.now(),
214
+ });
215
+ logger.info(`[xiaoyou] chunk #${chunkSeq} sent to ${conversationId}`);
237
216
  }
238
- logger.info(`[xiaoyou] ${sentences.length} chunks sent to ${conversationId} (total seq=${chunkSeq})`);
239
217
  },
240
218
  onComplete: async () => {
241
219
  replyEndSent = true;