openclaw-xiaoyou 1.0.3 → 1.0.5
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/openclaw.plugin.json +8 -54
- package/package.json +3 -1
- package/src/channel.ts +9 -3
package/openclaw.plugin.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "xiaoyou",
|
|
2
|
+
"id": "openclaw-xiaoyou",
|
|
3
3
|
"name": "Xiaoyou",
|
|
4
4
|
"description": "Bridge OpenClaw to enterprise services via persistent WebSocket connection",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.5",
|
|
6
6
|
"configSchema": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
@@ -57,57 +57,11 @@
|
|
|
57
57
|
},
|
|
58
58
|
"channel": {
|
|
59
59
|
"id": "xiaoyou",
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"description": "启用/禁用此 channel"
|
|
67
|
-
},
|
|
68
|
-
"wsUrl": {
|
|
69
|
-
"type": "string",
|
|
70
|
-
"description": "企业 WebSocket 服务地址",
|
|
71
|
-
"examples": ["wss://im.corp.example.com/ws", "ws://192.168.1.100:9090"]
|
|
72
|
-
},
|
|
73
|
-
"authToken": {
|
|
74
|
-
"type": "string",
|
|
75
|
-
"sensitive": true,
|
|
76
|
-
"description": "连接企业服务的认证 Token"
|
|
77
|
-
},
|
|
78
|
-
"dmSecurity": {
|
|
79
|
-
"type": "string",
|
|
80
|
-
"enum": ["open", "allowlist"],
|
|
81
|
-
"default": "open",
|
|
82
|
-
"description": "DM 安全策略。open=允许所有用户,allowlist=仅白名单用户"
|
|
83
|
-
},
|
|
84
|
-
"allowFrom": {
|
|
85
|
-
"type": "array",
|
|
86
|
-
"items": { "type": "string" },
|
|
87
|
-
"default": [],
|
|
88
|
-
"description": "白名单用户 ID 列表(dmSecurity=allowlist 时生效)"
|
|
89
|
-
},
|
|
90
|
-
"reconnectIntervalMs": {
|
|
91
|
-
"type": "number",
|
|
92
|
-
"default": 3000,
|
|
93
|
-
"description": "重连基础间隔(毫秒),实际按指数退避递增"
|
|
94
|
-
},
|
|
95
|
-
"maxReconnectAttempts": {
|
|
96
|
-
"type": "number",
|
|
97
|
-
"default": 0,
|
|
98
|
-
"description": "最大重连次数,0=无限重试"
|
|
99
|
-
},
|
|
100
|
-
"heartbeatIntervalMs": {
|
|
101
|
-
"type": "number",
|
|
102
|
-
"default": 30000,
|
|
103
|
-
"description": "心跳发送间隔(毫秒)"
|
|
104
|
-
},
|
|
105
|
-
"heartbeatTimeoutMs": {
|
|
106
|
-
"type": "number",
|
|
107
|
-
"default": 10000,
|
|
108
|
-
"description": "心跳超时时间(毫秒),超时则断开重连"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
60
|
+
"label": "Xiaoyou",
|
|
61
|
+
"selectionLabel": "Xiaoyou (enterprise WebSocket)",
|
|
62
|
+
"blurb": "Bridge OpenClaw to enterprise services via persistent WebSocket.",
|
|
63
|
+
"docsPath": "/channels/xiaoyou",
|
|
64
|
+
"aliases": ["xiaoyou"],
|
|
65
|
+
"order": 50
|
|
112
66
|
}
|
|
113
67
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-xiaoyou",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Xiaoyou channel plugin for OpenClaw — connects enterprise services via persistent outbound WebSocket",
|
|
6
6
|
"openclaw": {
|
|
7
7
|
"extensions": ["./index.ts"],
|
|
8
|
+
"channels": ["xiaoyou"],
|
|
9
|
+
"installDependencies": true,
|
|
8
10
|
"setupEntry": "./setup-entry.ts",
|
|
9
11
|
"configSchema": {
|
|
10
12
|
"type": "object",
|
package/src/channel.ts
CHANGED
|
@@ -22,8 +22,7 @@ export function getRuntime() { return _runtime; }
|
|
|
22
22
|
// ─── Config Adapter ──────────────────────────────────
|
|
23
23
|
|
|
24
24
|
function resolveAccount(cfg: any): ResolvedAccount {
|
|
25
|
-
const section = cfg.channels?.["xiaoyou"];
|
|
26
|
-
if (!section) throw new Error("xiaoyou: channel config section not found");
|
|
25
|
+
const section = cfg.channels?.["xiaoyou"] ?? cfg;
|
|
27
26
|
if (!section.wsUrl) throw new Error("xiaoyou: wsUrl is required");
|
|
28
27
|
|
|
29
28
|
return {
|
|
@@ -39,7 +38,7 @@ function resolveAccount(cfg: any): ResolvedAccount {
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
function inspectAccount(cfg: any) {
|
|
42
|
-
const section = cfg.channels?.["xiaoyou"];
|
|
41
|
+
const section = cfg.channels?.["xiaoyou"] ?? cfg;
|
|
43
42
|
return {
|
|
44
43
|
enabled: Boolean(section?.wsUrl),
|
|
45
44
|
configured: Boolean(section?.wsUrl),
|
|
@@ -47,6 +46,12 @@ function inspectAccount(cfg: any) {
|
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
48
|
|
|
49
|
+
function listAccountIds(cfg: any): string[] {
|
|
50
|
+
const section = cfg.channels?.["xiaoyou"] ?? cfg;
|
|
51
|
+
if (section?.wsUrl) return ["default"];
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
// ─── Channel Plugin ──────────────────────────────────
|
|
51
56
|
|
|
52
57
|
export const xiayouPlugin = {
|
|
@@ -79,6 +84,7 @@ export const xiayouPlugin = {
|
|
|
79
84
|
config: {
|
|
80
85
|
resolveAccount,
|
|
81
86
|
inspectAccount,
|
|
87
|
+
listAccountIds,
|
|
82
88
|
},
|
|
83
89
|
|
|
84
90
|
// ── DM 安全策略 ────────────────────────────────────
|