@xiaozhi-pro/openclaw-plugin 1.0.0 → 1.0.1

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/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # @xiaozhi-pro/openclaw-plugin
2
+
3
+ 小智Pro (XiaoZhi Pro) 通道插件,通过 WebSocket 将小智Pro平台接入 [OpenClaw](https://openclaw.ai)。
4
+
5
+ ## OpenClaw 端使用
6
+
7
+ ### 安装
8
+
9
+ ```bash
10
+ openclaw plugins install @xiaozhi-pro/openclaw-plugin
11
+ ```
12
+
13
+ > 如果使用国内 npm 镜像导致 404,先临时切到官方源,装完切回:
14
+ > ```bash
15
+ > npm config set registry https://registry.npmjs.org
16
+ > openclaw plugins install @xiaozhi-pro/openclaw-plugin
17
+ > npm config set registry https://registry.npmmirror.com
18
+ > ```
19
+ >
20
+ > 如果仍然失败,可以直接下载 tgz 包本地安装:
21
+ > ```bash
22
+ > wget https://registry.npmjs.org/@xiaozhi-pro/openclaw-plugin/-/openclaw-plugin-1.0.0.tgz
23
+ > openclaw plugins install ./openclaw-plugin-1.0.0.tgz
24
+ > ```
25
+
26
+ ### 配置
27
+
28
+ 编辑 `openclaw.json`:
29
+
30
+ ```json
31
+ {
32
+ "channels": {
33
+ "xiaozhi-pro": {
34
+ "token": "你的小智Pro平台API密钥"
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ 或通过环境变量 `XIAOZHI_PRO_TOKEN` 设置。
41
+
42
+ ### 启动
43
+
44
+ ```bash
45
+ openclaw gateway run
46
+ ```
47
+
48
+ 插件会自动连接小智Pro WS 服务端,完成认证后进入双向通信。
49
+
50
+ ## WS 协议
51
+
52
+ | 方向 | type | 关键字段 |
53
+ |------|------|----------|
54
+ | 插件 → 服务端 | `auth` | `token` |
55
+ | 服务端 → 插件 | `auth_ok` | `user_id` |
56
+ | 服务端 → 插件 | `auth_fail` | `error`, `message` |
57
+ | 服务端 → 插件 | `message` / `response` | `sender_id`, `text`, `chat_type`, `chat_id`, `message_id`, `timestamp` |
58
+ | 插件 → 服务端 | `response` | `text`, `to`, `message_id` |
59
+ | 服务端 → 插件 | `ping` | `timestamp` |
60
+ | 插件 → 服务端 | `pong` | — |
61
+
62
+ ## 开发
63
+
64
+ ```bash
65
+ pnpm install
66
+ pnpm run build
67
+ ```
68
+
69
+ ## 发布
70
+
71
+ ```bash
72
+ npm version patch # 1.0.0 → 1.0.1(修bug,最后一位+1)
73
+ npm version minor # 1.0.0 → 1.1.0(新功能,中间位+1)
74
+ npm version major # 1.0.0 → 2.0.0(破坏性变更,首位+1)
75
+ npm run build
76
+ npm publish --access public
77
+ npm view @xiaozhi-pro/openclaw-plugin # 验证发布成功
78
+ # 如果用户用的是国内 npm 镜像(npmmirror.com),刚发布的包还没同步过去,通常需要 10 分钟到几小时。
79
+ npm view @xiaozhi-pro/openclaw-plugin --registry https://registry.npmmirror.com
80
+ ```
81
+
82
+ ## 许可证
83
+
84
+ MIT
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export {};
1
+ declare const entry: import("openclaw/plugin-sdk/channel-entry-contract").BundledChannelEntryContract<import("openclaw/plugin-sdk/core").ChannelPlugin>;
2
+ export default entry;
package/dist/index.js CHANGED
@@ -1 +1,16 @@
1
- export {};
1
+ import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
2
+ const entry = defineBundledChannelEntry({
3
+ id: "xiaozhi-pro",
4
+ name: "小智Pro",
5
+ description: "小智Pro (XiaoZhi Pro) channel plugin for OpenClaw via WebSocket",
6
+ importMetaUrl: import.meta.url,
7
+ plugin: {
8
+ specifier: "./channel-plugin-api.js",
9
+ exportName: "xiaozhiProPlugin",
10
+ },
11
+ runtime: {
12
+ specifier: "./api.js",
13
+ exportName: "setXiaozhiProRuntime",
14
+ },
15
+ });
16
+ export default entry;
@@ -18,7 +18,7 @@ export function resolveAccount(cfg, accountId) {
18
18
  accountId: accountId ?? DEFAULT_ACCOUNT_ID,
19
19
  enabled: raw.enabled !== false,
20
20
  token: normalizeLowercaseStringOrEmpty(raw.token),
21
- dmPolicy: raw.dmPolicy ?? "allowlist",
21
+ dmPolicy: raw.dmPolicy ?? "open",
22
22
  allowedUserIds: normalizeStringEntriesLower(raw.allowedUserIds ?? raw.allowFrom),
23
23
  };
24
24
  }
@@ -7,5 +7,21 @@
7
7
  "channelEnvVars": {
8
8
  "xiaozhi-pro": ["XIAOZHI_PRO_TOKEN"]
9
9
  },
10
- "configSchema": { "type": "object", "additionalProperties": false, "properties": {} }
10
+ "channelConfigs": {
11
+ "xiaozhi-pro": {
12
+ "schema": {
13
+ "$schema": "http://json-schema.org/draft-07/schema#",
14
+ "type": "object",
15
+ "properties": {
16
+ "token": {
17
+ "type": "string",
18
+ "description": "小智Pro平台 API Token"
19
+ }
20
+ },
21
+ "additionalProperties": false
22
+ },
23
+ "label": "小智Pro",
24
+ "description": "小智Pro (XiaoZhi Pro) channel plugin for OpenClaw via WebSocket."
25
+ }
26
+ }
11
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaozhi-pro/openclaw-plugin",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "小智Pro (XiaoZhi Pro) channel plugin for OpenClaw via WebSocket",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -43,7 +43,9 @@
43
43
  "@types/ws": "^8.5.0"
44
44
  },
45
45
  "openclaw": {
46
- "extensions": ["./dist/index.js"],
46
+ "extensions": [
47
+ "./dist/index.js"
48
+ ],
47
49
  "channel": {
48
50
  "id": "xiaozhi-pro",
49
51
  "label": "小智Pro",