aicq-chat-plugin 2.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.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # AICQ Chat Plugin
2
+
3
+ AICQ 端到端加密聊天插件 — 适用于 OpenClaw 的完整聊天 UI。
4
+
5
+ ## 一键安装
6
+
7
+ ```bash
8
+ # 使用 npx 直接运行(无需安装)
9
+ npx aicq-chat-plugin
10
+
11
+ # 或全局安装
12
+ npm install -g aicq-chat-plugin
13
+ aicq-plugin
14
+ ```
15
+
16
+ ## 功能
17
+
18
+ - **端到端加密** — 基于 NaCl (libsodium) 的加密体系
19
+ - **Agent 管理** — 支持多 Agent 切换、创建
20
+ - **好友管理** — 好友码添加、QR 码扫描、好友列表同步
21
+ - **群组聊天** — 创建群组、邀请成员、静默模式
22
+ - **消息功能** — Markdown/LaTeX 渲染、图片/文件上传、@提及
23
+ - **密钥管理** — 公钥/私钥显示、密钥轮换、指纹验证
24
+ - **P2P 通信** — 握手、文本传输、文件传输
25
+
26
+ ## 使用方法
27
+
28
+ ### 启动插件
29
+
30
+ ```bash
31
+ # 默认启动(端口 6109)
32
+ aicq-plugin
33
+
34
+ # 自定义端口
35
+ aicq-plugin --port 8080
36
+
37
+ # 自定义服务器
38
+ aicq-plugin --server http://your-server:61018
39
+
40
+ # 查看状态
41
+ aicq-plugin status
42
+ ```
43
+
44
+ ### 环境变量
45
+
46
+ | 变量 | 默认值 | 说明 |
47
+ |------|--------|------|
48
+ | `AICQ_PORT` | 6109 | 插件服务端口 |
49
+ | `AICQ_SERVER_URL` | http://aicq.online:61018 | AICQ 服务器地址 |
50
+ | `AICQ_DATA_DIR` | ~/.aicq-plugin | 数据存储目录 |
51
+
52
+ ## OpenClaw 集成
53
+
54
+ 插件会自动注册为 OpenClaw sidecar,提供以下工具和网关:
55
+
56
+ ### 工具
57
+ - `chat-friend` — 好友管理
58
+ - `chat-send` — 发送消息
59
+ - `chat-export-key` — 导出密钥
60
+
61
+ ### 网关方法
62
+ - `aicq.status` — 插件状态
63
+ - `aicq.friends.list/add/remove` — 好友操作
64
+ - `aicq.chat.send/history/delete` — 聊天操作
65
+ - `aicq.groups.list/create/join` — 群组操作
66
+ - `aicq.identity.info` — 身份信息
67
+
68
+ ## Chat UI
69
+
70
+ 启动后访问 http://localhost:6109 即可使用完整的聊天界面。
71
+
72
+ ## 许可证
73
+
74
+ MIT License
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AICQ Chat Plugin — CLI Entry Point
4
+ *
5
+ * Usage:
6
+ * aicq-plugin Start the plugin server (default port 6109)
7
+ * aicq-plugin start Start the plugin server
8
+ * aicq-plugin status Check plugin status
9
+ * aicq-plugin --port Specify port (default 6109)
10
+ * aicq-plugin --help Show help
11
+ */
12
+ const { spawn } = require('child_process');
13
+ const path = require('path');
14
+
15
+ const args = process.argv.slice(2);
16
+ const command = args[0] || 'start';
17
+
18
+ // Parse options
19
+ let port = process.env.AICQ_PORT || '6109';
20
+ let serverUrl = process.env.AICQ_SERVER_URL || 'http://aicq.online:61018';
21
+
22
+ for (let i = 0; i < args.length; i++) {
23
+ if ((args[i] === '--port' || args[i] === '-p') && args[i + 1]) {
24
+ port = args[i + 1];
25
+ i++;
26
+ }
27
+ if ((args[i] === '--server' || args[i] === '-s') && args[i + 1]) {
28
+ serverUrl = args[i + 1];
29
+ i++;
30
+ }
31
+ }
32
+
33
+ if (command === '--help' || command === '-h') {
34
+ console.log(`
35
+ AICQ Chat Plugin — End-to-End Encrypted Chat for OpenClaw
36
+
37
+ Usage:
38
+ aicq-plugin [command] [options]
39
+
40
+ Commands:
41
+ start Start the plugin server (default)
42
+ status Check if the plugin is running
43
+
44
+ Options:
45
+ --port, -p <port> Plugin server port (default: 6109)
46
+ --server, -s <url> AICQ server URL (default: http://aicq.online:61018)
47
+ --help, -h Show this help message
48
+
49
+ Environment Variables:
50
+ AICQ_PORT Plugin server port
51
+ AICQ_SERVER_URL AICQ server URL
52
+ AICQ_DATA_DIR Data directory (default: ~/.aicq-plugin)
53
+
54
+ Examples:
55
+ aicq-plugin # Start on default port
56
+ aicq-plugin --port 8080 # Start on port 8080
57
+ aicq-plugin -s http://localhost # Connect to local server
58
+ `);
59
+ process.exit(0);
60
+ }
61
+
62
+ if (command === 'status') {
63
+ const http = require('http');
64
+ const req = http.get(`http://localhost:${port}/api/status`, (res) => {
65
+ let data = '';
66
+ res.on('data', chunk => data += chunk);
67
+ res.on('end', () => {
68
+ try {
69
+ const status = JSON.parse(data);
70
+ console.log('AICQ Plugin Status:');
71
+ console.log(` Version: ${status.version}`);
72
+ console.log(` Status: ${status.status}`);
73
+ console.log(` Connected: ${status.connected ? 'Yes' : 'No'}`);
74
+ console.log(` Agent: ${status.currentAgent || 'None'}`);
75
+ console.log(` Server: ${status.serverUrl}`);
76
+ } catch (e) {
77
+ console.log('Plugin is running but returned invalid status.');
78
+ }
79
+ });
80
+ });
81
+ req.on('error', () => {
82
+ console.log(`AICQ Plugin is not running on port ${port}.`);
83
+ console.log(`Start it with: aicq-plugin --port ${port}`);
84
+ });
85
+ req.setTimeout(3000, () => {
86
+ req.destroy();
87
+ console.log(`AICQ Plugin is not responding on port ${port}.`);
88
+ });
89
+ process.exit(0);
90
+ }
91
+
92
+ // Start the plugin server
93
+ console.log(`[AICQ] Starting plugin on port ${port}`);
94
+ console.log(`[AICQ] Server: ${serverUrl}`);
95
+
96
+ const env = { ...process.env, AICQ_PORT: port, AICQ_SERVER_URL: serverUrl };
97
+ const child = spawn('node', [path.join(__dirname, '..', 'index.js')], {
98
+ env,
99
+ stdio: 'inherit',
100
+ detached: false
101
+ });
102
+
103
+ child.on('error', (err) => {
104
+ console.error('[AICQ] Failed to start:', err.message);
105
+ process.exit(1);
106
+ });
107
+
108
+ child.on('exit', (code) => {
109
+ process.exit(code || 0);
110
+ });
111
+
112
+ process.on('SIGINT', () => {
113
+ child.kill('SIGINT');
114
+ });
115
+
116
+ process.on('SIGTERM', () => {
117
+ child.kill('SIGTERM');
118
+ });
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AICQ Chat Plugin — Post-install script
4
+ *
5
+ * Displays setup information after npm install.
6
+ */
7
+
8
+ console.log('');
9
+ console.log(' ╔══════════════════════════════════════════════╗');
10
+ console.log(' ║ AICQ Chat Plugin Installed! ║');
11
+ console.log(' ╠══════════════════════════════════════════════╣');
12
+ console.log(' ║ ║');
13
+ console.log(' ║ Start the plugin: ║');
14
+ console.log(' ║ npx aicq-plugin ║');
15
+ console.log(' ║ ║');
16
+ console.log(' ║ Or install globally: ║');
17
+ console.log(' ║ npm install -g aicq-chat-plugin ║');
18
+ console.log(' ║ aicq-plugin ║');
19
+ console.log(' ║ ║');
20
+ console.log(' ║ Options: ║');
21
+ console.log(' ║ --port <port> Server port (6109) ║');
22
+ console.log(' ║ --server <url> AICQ server URL ║');
23
+ console.log(' ║ ║');
24
+ console.log(' ║ Chat UI: http://localhost:6109 ║');
25
+ console.log(' ║ Docs: https://aicq.online ║');
26
+ console.log(' ╚══════════════════════════════════════════════╝');
27
+ console.log('');