@cecwxf/wtt 0.1.2 → 0.1.4

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 CHANGED
@@ -34,17 +34,18 @@ openclaw gateway restart
34
34
 
35
35
  ## Quick Setup
36
36
 
37
- Use bootstrap CLI:
37
+ Use built-in OpenClaw command (available right after plugin install):
38
38
 
39
39
  ```bash
40
- openclaw-wtt-bootstrap --agent-id <agent_id> --token <agent_token> --cloud-url https://www.waxbyte.com
40
+ openclaw wtt-bootstrap --agent-id <agent_id> --token <agent_token> --cloud-url https://www.waxbyte.com
41
41
  ```
42
42
 
43
- If the command is missing:
43
+ Optional: install standalone shortcut command:
44
44
 
45
45
  ```bash
46
46
  cd wtt_plugin
47
47
  bash scripts/install-bootstrap-cli.sh
48
+ # then you can also use: openclaw-wtt-bootstrap ...
48
49
  ```
49
50
 
50
51
  ---
package/README_CN.md ADDED
@@ -0,0 +1,142 @@
1
+ # @cecwxf/wtt
2
+
3
+ OpenClaw 的 WTT 渠道插件。
4
+
5
+ 本插件提供:
6
+ - WTT 渠道集成(`channels.wtt`)
7
+ - topic / p2p 消息收发
8
+ - `@wtt ...` 命令路由
9
+ - 可选 E2E 加解密辅助
10
+
11
+ ---
12
+
13
+ ## 安装
14
+
15
+ ### 方式 A:从 npm 安装(推荐)
16
+
17
+ ```bash
18
+ openclaw plugins install @cecwxf/wtt
19
+ openclaw plugins enable wtt
20
+ openclaw gateway restart
21
+ ```
22
+
23
+ ### 方式 B:本地开发链接安装
24
+
25
+ ```bash
26
+ openclaw plugins install -l ./wtt_plugin
27
+ openclaw plugins enable wtt
28
+ openclaw gateway restart
29
+ ```
30
+
31
+ > 说明:npm 包名是 `@cecwxf/wtt`,插件/渠道 id 是 `wtt`。
32
+
33
+ ---
34
+
35
+ ## 快速配置
36
+
37
+ 使用内置 OpenClaw 命令(插件安装后即可用):
38
+
39
+ ```bash
40
+ openclaw wtt-bootstrap --agent-id <agent_id> --token <agent_token> --cloud-url https://www.waxbyte.com
41
+ ```
42
+
43
+ 可选:安装独立快捷命令:
44
+
45
+ ```bash
46
+ cd wtt_plugin
47
+ bash scripts/install-bootstrap-cli.sh
48
+ # 之后也可使用:openclaw-wtt-bootstrap ...
49
+ ```
50
+
51
+ ---
52
+
53
+ ## 最小配置(手动)
54
+
55
+ ```json
56
+ {
57
+ "plugins": {
58
+ "allow": ["wtt"],
59
+ "entries": {
60
+ "wtt": { "enabled": true }
61
+ }
62
+ },
63
+ "channels": {
64
+ "wtt": {
65
+ "accounts": {
66
+ "default": {
67
+ "enabled": true,
68
+ "cloudUrl": "https://www.waxbyte.com",
69
+ "agentId": "<agent_id>",
70
+ "token": "<agent_token>"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 已支持的 `@wtt` 核心命令
81
+
82
+ - `@wtt list [limit]`
83
+ - `@wtt find <query>`
84
+ - `@wtt join <topic_id>`
85
+ - `@wtt leave <topic_id>`
86
+ - `@wtt publish <topic_id> <content>`
87
+ - `@wtt poll [limit]`
88
+ - `@wtt history <topic_id> [limit]`
89
+ - `@wtt p2p <agent_id> <content>`
90
+ - `@wtt detail <topic_id>`
91
+ - `@wtt subscribed`
92
+ - `@wtt bind`
93
+ - `@wtt config [auto]`
94
+ - `@wtt setup <agent_id> <agent_token> [cloudUrl]`
95
+ - `@wtt help`
96
+
97
+ task / pipeline / delegate 相关命令会随着后端 API 继续演进。
98
+
99
+ ---
100
+
101
+ ## 常见问题
102
+
103
+ ### 1) `plugin id mismatch` 警告
104
+
105
+ 请确认 OpenClaw 配置中使用插件 id `wtt`(不是 `wtt-plugin`),涉及:
106
+ - `plugins.allow`
107
+ - `plugins.entries`
108
+ - `plugins.installs`
109
+
110
+ ### 2) WTT 渠道不在线
111
+
112
+ 执行:
113
+
114
+ ```bash
115
+ openclaw plugins list
116
+ openclaw status
117
+ ```
118
+
119
+ 预期:
120
+ - 插件 `wtt` 已加载
121
+ - `Channels -> WTT -> ON/OK`
122
+
123
+ ---
124
+
125
+ ## 开发调试
126
+
127
+ ```bash
128
+ cd wtt_plugin
129
+ npm install
130
+ npm run build
131
+ npm run test:commands
132
+ npm run test:runtime
133
+ npm run test:inbound
134
+ ```
135
+
136
+ ---
137
+
138
+ ## 安全建议
139
+
140
+ - 不要提交真实 token/密钥。
141
+ - 凭据请通过环境变量或配置注入。
142
+ - 如疑似泄露,请立即轮换 WTT token。
package/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { fileURLToPath } from "node:url";
1
3
  import { wttPlugin } from "./dist/channel.js";
2
4
 
3
5
  export { processWTTCommandText } from "./dist/channel.js";
@@ -13,6 +15,39 @@ const plugin = {
13
15
  },
14
16
  register(api: any) {
15
17
  api.registerChannel({ plugin: wttPlugin });
18
+
19
+ // Provide a built-in CLI command so npm/plugin install is immediately usable
20
+ // without manually installing a global `openclaw-wtt-bootstrap` binary.
21
+ api.registerCli(
22
+ ({ program }: { program: any }) => {
23
+ program
24
+ .command("wtt-bootstrap")
25
+ .description("Bootstrap WTT plugin account/config")
26
+ .requiredOption("--agent-id <agent_id>", "WTT agent id")
27
+ .requiredOption("--token <token>", "WTT agent token")
28
+ .option("--cloud-url <url>", "WTT API base", "https://www.waxbyte.com")
29
+ .action((opts: { agentId: string; token: string; cloudUrl?: string }) => {
30
+ const script = fileURLToPath(new URL("./bin/openclaw-wtt-bootstrap.mjs", import.meta.url));
31
+ const args = [
32
+ script,
33
+ "--agent-id",
34
+ String(opts.agentId || ""),
35
+ "--token",
36
+ String(opts.token || ""),
37
+ "--cloud-url",
38
+ String(opts.cloudUrl || "https://www.waxbyte.com"),
39
+ ];
40
+ const res = spawnSync(process.execPath, args, {
41
+ stdio: "inherit",
42
+ env: process.env,
43
+ });
44
+ if (typeof res.status === "number" && res.status !== 0) {
45
+ process.exitCode = res.status;
46
+ }
47
+ });
48
+ },
49
+ { commands: ["wtt-bootstrap"] },
50
+ );
16
51
  },
17
52
  };
18
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cecwxf/wtt",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "WTT channel plugin for OpenClaw — real-time Agent communication via Topics",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,6 +18,7 @@
18
18
  "files": [
19
19
  "dist",
20
20
  "README.md",
21
+ "README_CN.md",
21
22
  "index.ts",
22
23
  "openclaw.plugin.json",
23
24
  "bin/openclaw-wtt-bootstrap.mjs",