aicq-chat-plugin 3.0.1 → 3.2.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/index.js CHANGED
@@ -161,25 +161,24 @@ function register() {
161
161
  async function activate(config) {
162
162
  await ensureInitialized();
163
163
 
164
- // Auto-create default agent if none exists
164
+ // Channel mode: do NOT auto-create a default agent identity.
165
+ // Agent identities are created on-demand via channel.lifecycle.onAccountCreate
166
+ // which is triggered when OpenClaw assigns an agent to this channel.
167
+ // The resolveAccount method also handles auto-creation if needed.
165
168
  const agents = _identity.listAgents();
166
- let currentAgentId;
167
- if (agents.length === 0) {
168
- const defaultAgent = _identity.createAgent('agent-' + Date.now(), '默认Agent');
169
- currentAgentId = defaultAgent.agent_id;
170
- console.log('[AICQ Channel] Created default agent:', currentAgentId);
171
- } else {
172
- currentAgentId = agents[0].agent_id;
173
- }
169
+ let currentAgentId = agents.length > 0 ? agents[0].agent_id : null;
174
170
 
175
- // Connect to AICQ server
176
- try {
177
- await _serverClient.start(currentAgentId);
178
- // Sync friends and groups from server
179
- await syncFriendsFromServer(currentAgentId);
180
- await syncGroupsFromServer(currentAgentId);
181
- } catch (e) {
182
- console.error('[AICQ Channel] Initial server connection failed:', e.message);
171
+ // Only connect to AICQ server if we have an existing agent
172
+ if (currentAgentId) {
173
+ try {
174
+ await _serverClient.start(currentAgentId);
175
+ await syncFriendsFromServer(currentAgentId);
176
+ await syncGroupsFromServer(currentAgentId);
177
+ } catch (e) {
178
+ console.error('[AICQ Channel] Initial server connection failed:', e.message);
179
+ }
180
+ } else {
181
+ console.log('[AICQ Channel] No existing agent — will connect when an agent is assigned via channel.lifecycle.onAccountCreate');
183
182
  }
184
183
 
185
184
  return {
@@ -2,7 +2,7 @@
2
2
  "kind": "channel",
3
3
  "id": "aicq-chat",
4
4
  "name": "AICQ Encrypted Chat",
5
- "version": "3.0.1",
5
+ "version": "3.2.1",
6
6
  "description": "End-to-end encrypted chat channel via AICQ protocol — in-process Channel plugin",
7
7
  "entry": "index.js",
8
8
  "activation": {
@@ -14,8 +14,12 @@
14
14
  ],
15
15
  "channelConfigs": {
16
16
  "aicq-chat": {
17
- "accounts": {
17
+ "label": "AICQ Encrypted Chat",
18
+ "description": "End-to-end encrypted chat channel via AICQ protocol",
19
+ "schema": {
20
+ "$schema": "http://json-schema.org/draft-07/schema#",
18
21
  "type": "object",
22
+ "additionalProperties": false,
19
23
  "properties": {
20
24
  "accountId": {
21
25
  "type": "string",
@@ -26,11 +30,49 @@
26
30
  "type": "boolean",
27
31
  "default": true,
28
32
  "description": "是否自动接受好友请求"
33
+ },
34
+ "serverUrl": {
35
+ "type": "string",
36
+ "description": "AICQ 服务器地址",
37
+ "default": "https://aicq.online"
38
+ },
39
+ "enabled": {
40
+ "type": "boolean",
41
+ "default": true,
42
+ "description": "Enable this channel account"
43
+ },
44
+ "dmPolicy": {
45
+ "type": "string",
46
+ "default": "allowlist",
47
+ "description": "DM access policy: allowlist (friends only), open, or disabled",
48
+ "enum": [
49
+ "allowlist",
50
+ "open",
51
+ "disabled"
52
+ ]
29
53
  }
30
54
  },
31
55
  "required": [
32
56
  "accountId"
33
57
  ]
58
+ },
59
+ "uiHints": {
60
+ "accountId": {
61
+ "label": "Account ID",
62
+ "help": "The OpenClaw agent ID to bind as AICQ account"
63
+ },
64
+ "autoAcceptFriends": {
65
+ "label": "Auto Accept Friends",
66
+ "help": "Automatically accept incoming friend requests"
67
+ },
68
+ "serverUrl": {
69
+ "label": "AICQ Server URL",
70
+ "help": "The AICQ signaling server URL for WebSocket connections"
71
+ },
72
+ "dmPolicy": {
73
+ "label": "DM Policy",
74
+ "help": "Who can send direct messages: allowlist (friends only), open, or disabled"
75
+ }
34
76
  }
35
77
  }
36
78
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicq-chat-plugin",
3
- "version": "3.0.1",
3
+ "version": "3.2.1",
4
4
  "description": "AICQ End-to-end Encrypted Chat Channel Plugin for OpenClaw — In-process Channel architecture with friend management, group chat, file transfer, and AI agent communication",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -61,6 +61,9 @@
61
61
  "node": ">=18.0.0"
62
62
  },
63
63
  "openclaw": {
64
+ "extensions": [
65
+ "./index.js"
66
+ ],
64
67
  "channel": {
65
68
  "id": "aicq-chat",
66
69
  "label": "AICQ Encrypted Chat",
package/public/index.html CHANGED
@@ -178,6 +178,10 @@ body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans S
178
178
  </button>
179
179
  </div>
180
180
  <div class="list-section">
181
+ <div style="padding:8px 12px;font-size:11px;color:#8B6914;background:rgba(212,151,59,0.08);border-bottom:1px solid rgba(212,151,59,0.2);display:flex;align-items:flex-start;gap:6px">
182
+ <span style="flex-shrink:0">⚠️</span>
183
+ <span>若连续30天没有登录,好友关系和主人关系将被清理,到时候需重新绑定主人和添加好友。</span>
184
+ </div>
181
185
  <h4>好友</h4>
182
186
  <div id="friendsList"></div>
183
187
  <h4>群聊</h4>