@qihoo/tuitui-openclaw-channel 1.0.35 → 1.0.36

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.
Files changed (89) hide show
  1. package/README.md +23 -1
  2. package/dist/index.d.ts +9 -0
  3. package/{index.ts → dist/index.js} +10 -11
  4. package/dist/index.js.map +1 -0
  5. package/dist/openclaw.plugin.json +204 -0
  6. package/dist/package.json +50 -0
  7. package/dist/src/accounts.d.ts +31 -0
  8. package/dist/src/accounts.js +54 -0
  9. package/dist/src/accounts.js.map +1 -0
  10. package/dist/src/channel.d.ts +2 -0
  11. package/dist/src/channel.js +265 -0
  12. package/dist/src/channel.js.map +1 -0
  13. package/dist/src/chat_base.d.ts +15 -0
  14. package/dist/src/chat_base.js +55 -0
  15. package/dist/src/chat_base.js.map +1 -0
  16. package/dist/src/chat_record.d.ts +47 -0
  17. package/dist/src/chat_record.js +373 -0
  18. package/dist/src/chat_record.js.map +1 -0
  19. package/dist/src/const.d.ts +2 -0
  20. package/{src/const.ts → dist/src/const.js} +1 -0
  21. package/dist/src/const.js.map +1 -0
  22. package/dist/src/deduplicator.d.ts +30 -0
  23. package/dist/src/deduplicator.js +111 -0
  24. package/dist/src/deduplicator.js.map +1 -0
  25. package/dist/src/env.d.ts +7 -0
  26. package/dist/src/env.js +12 -0
  27. package/dist/src/env.js.map +1 -0
  28. package/dist/src/filespace.d.ts +19 -0
  29. package/dist/src/filespace.js +173 -0
  30. package/dist/src/filespace.js.map +1 -0
  31. package/dist/src/histories.d.ts +17 -0
  32. package/dist/src/histories.js +100 -0
  33. package/dist/src/histories.js.map +1 -0
  34. package/dist/src/inbound.d.ts +23 -0
  35. package/dist/src/inbound.js +475 -0
  36. package/dist/src/inbound.js.map +1 -0
  37. package/dist/src/inbound_body_parse.d.ts +5 -0
  38. package/dist/src/inbound_body_parse.js +95 -0
  39. package/dist/src/inbound_body_parse.js.map +1 -0
  40. package/dist/src/monitor.d.ts +24 -0
  41. package/dist/src/monitor.js +268 -0
  42. package/dist/src/monitor.js.map +1 -0
  43. package/dist/src/outbound.d.ts +7 -0
  44. package/dist/src/outbound.js +174 -0
  45. package/dist/src/outbound.js.map +1 -0
  46. package/dist/src/robot_api.d.ts +39 -0
  47. package/dist/src/robot_api.js +220 -0
  48. package/dist/src/robot_api.js.map +1 -0
  49. package/dist/src/robot_helper.d.ts +1 -0
  50. package/dist/src/robot_helper.js +7 -0
  51. package/dist/src/robot_helper.js.map +1 -0
  52. package/dist/src/teams_api.d.ts +3 -0
  53. package/dist/src/teams_api.js +31 -0
  54. package/dist/src/teams_api.js.map +1 -0
  55. package/dist/src/tools.d.ts +2 -0
  56. package/dist/src/tools.js +163 -0
  57. package/dist/src/tools.js.map +1 -0
  58. package/dist/src/types.d.ts +164 -0
  59. package/dist/src/types.js +5 -0
  60. package/dist/src/types.js.map +1 -0
  61. package/dist/src/utils.d.ts +2 -0
  62. package/dist/src/utils.js +11 -0
  63. package/dist/src/utils.js.map +1 -0
  64. package/dist/src/websocket.d.ts +1 -0
  65. package/dist/src/websocket.js +107 -0
  66. package/dist/src/websocket.js.map +1 -0
  67. package/openclaw.plugin.json +9 -0
  68. package/package.json +17 -4
  69. package/skills/tuitui-im-read/SKILL.md +0 -135
  70. package/src/accounts.ts +0 -56
  71. package/src/channel.ts +0 -297
  72. package/src/chat_base.ts +0 -72
  73. package/src/chat_record.ts +0 -487
  74. package/src/deduplicator.ts +0 -121
  75. package/src/env.ts +0 -15
  76. package/src/filespace.ts +0 -232
  77. package/src/histories.ts +0 -131
  78. package/src/inbound.ts +0 -564
  79. package/src/inbound_body_parse.ts +0 -100
  80. package/src/monitor.ts +0 -368
  81. package/src/outbound.ts +0 -216
  82. package/src/robot_api.ts +0 -264
  83. package/src/robot_helper.ts +0 -7
  84. package/src/teams_api.ts +0 -38
  85. package/src/tools.ts +0 -181
  86. package/src/types.ts +0 -159
  87. package/src/utils.ts +0 -11
  88. package/src/websocket.ts +0 -114
  89. package/tsconfig.json +0 -34
package/README.md CHANGED
@@ -72,7 +72,8 @@ cd ./tuitui
72
72
  npm install
73
73
  openclaw plugins install -l .
74
74
  ```
75
- ## 小建议
75
+
76
+ ## 4月份版本注意
76
77
 
77
78
  安装后建议显式配置 `plugins.allow`:
78
79
 
@@ -85,6 +86,27 @@ openclaw plugins install -l .
85
86
  }
86
87
  ```
87
88
 
89
+ ## 从3、4月份龙虾升级到5月份之后版本注意
90
+
91
+ plugins 字段参考配置如下,需要删除 plugins.installs,以及修改原来的 plugins.allow 以及 plugins.entries
92
+
93
+ ```json5
94
+ "plugins": {
95
+ "allow": [
96
+ "tuitui-openclaw-channel"
97
+ ],
98
+ "entries": {
99
+ "tuitui-openclaw-channel": {
100
+ "enabled": true,
101
+ "config": {},
102
+ "hooks": {
103
+ "allowConversationAccess": true
104
+ }
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
88
110
 
89
111
  ## 参考文档
90
112
 
@@ -0,0 +1,9 @@
1
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
2
+ declare const plugin: {
3
+ id: string;
4
+ name: string;
5
+ description: string;
6
+ configSchema: import("openclaw/plugin-sdk").OpenClawPluginConfigSchema;
7
+ register(api: OpenClawPluginApi): void;
8
+ };
9
+ export default plugin;
@@ -1,21 +1,20 @@
1
- import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
2
1
  import { emptyPluginConfigSchema } from 'openclaw/plugin-sdk/core';
3
2
  import { registerTuiTuiChannel } from './src/channel';
4
3
  import { registerTuituiTools } from './src/tools';
5
4
  import { registerMonitorHooks } from './src/monitor';
6
5
  import { CHANNEL_ID, CHANNEL_NAME } from './src/const';
7
6
  import { id } from './openclaw.plugin.json';
8
-
9
7
  const plugin = {
10
- id, // plugin id not is CHANNEL_ID
11
- name: CHANNEL_NAME,
12
- description: `${CHANNEL_NAME} chat integration for OpenClaw via WebSocket`,
13
- configSchema: emptyPluginConfigSchema(),
14
- register(api: OpenClawPluginApi) {
15
- registerTuiTuiChannel(api);
16
- registerTuituiTools(api);
17
- registerMonitorHooks(api);
18
- },
8
+ id, // plugin id not is CHANNEL_ID
9
+ name: CHANNEL_NAME,
10
+ description: `${CHANNEL_NAME} chat integration for OpenClaw via WebSocket`,
11
+ configSchema: emptyPluginConfigSchema(),
12
+ register(api) {
13
+ registerTuiTuiChannel(api);
14
+ registerTuituiTools(api);
15
+ registerMonitorHooks(api);
16
+ },
19
17
  };
20
18
  console.log(`[${CHANNEL_ID}] Tuitui Extension Loaded!`);
21
19
  export default plugin;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAE5C,MAAM,MAAM,GAAG;IACb,EAAE,EAAE,8BAA8B;IAClC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,GAAG,YAAY,8CAA8C;IAC1E,YAAY,EAAE,uBAAuB,EAAE;IACvC,QAAQ,CAAC,GAAsB;QAC7B,qBAAqB,CAAC,GAAG,CAAC,CAAC;QAC3B,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACzB,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;CACF,CAAC;AACF,OAAO,CAAC,GAAG,CAAC,IAAI,UAAU,4BAA4B,CAAC,CAAC;AACxD,eAAe,MAAM,CAAC","sourcesContent":["import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';\nimport { emptyPluginConfigSchema } from 'openclaw/plugin-sdk/core';\nimport { registerTuiTuiChannel } from './src/channel';\nimport { registerTuituiTools } from './src/tools';\nimport { registerMonitorHooks } from './src/monitor';\nimport { CHANNEL_ID, CHANNEL_NAME } from './src/const';\nimport { id } from './openclaw.plugin.json';\n\nconst plugin = {\n id, // plugin id not is CHANNEL_ID\n name: CHANNEL_NAME,\n description: `${CHANNEL_NAME} chat integration for OpenClaw via WebSocket`,\n configSchema: emptyPluginConfigSchema(),\n register(api: OpenClawPluginApi) {\n registerTuiTuiChannel(api);\n registerTuituiTools(api);\n registerMonitorHooks(api);\n },\n};\nconsole.log(`[${CHANNEL_ID}] Tuitui Extension Loaded!`);\nexport default plugin;\n"]}
@@ -0,0 +1,204 @@
1
+ {
2
+ "id": "tuitui-openclaw-channel",
3
+ "contracts": {
4
+ "tools": [
5
+ "tuitui_im_get_messages",
6
+ "tuitui_send_channel_post",
7
+ "tuitui_get_announcement",
8
+ "tuitui_file_space_list",
9
+ "tuitui_file_space_add"
10
+ ]
11
+ },
12
+ "channels": ["tuitui"],
13
+ "skills": ["./skills"],
14
+ "configSchema": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "properties": {}
18
+ },
19
+ "channelConfigs": {
20
+ "tuitui": {
21
+ "schema": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "properties": {
25
+ "enabled": { "type": "boolean", "default": true },
26
+ "appId": { "type": "string", "default": "" },
27
+ "appSecret": { "type": "string" },
28
+ "dmPolicy": {
29
+ "type": "string",
30
+ "default": "pairing",
31
+ "enum": ["pairing", "allowlist", "open", "disabled"]
32
+ },
33
+ "allowFrom": {
34
+ "type": "array",
35
+ "default": [],
36
+ "items": { "type": "string" }
37
+ },
38
+ "groupPolicy": {
39
+ "type": "string",
40
+ "default": "allowlist",
41
+ "enum": ["allowlist", "disabled"]
42
+ },
43
+ "requireMention": { "type": "boolean", "default": true },
44
+ "groupAllowFrom": {
45
+ "type": "array",
46
+ "default": [],
47
+ "items": { "type": "string" }
48
+ },
49
+ "channelContext": {
50
+ "type": "string",
51
+ "default": "thread",
52
+ "enum": ["channel", "thread"]
53
+ },
54
+ "emojiReaction": { "type": "boolean", "default": true },
55
+ "monitorEnabled": { "type": "boolean", "default": true },
56
+ "accounts": {
57
+ "type": "object",
58
+ "additionalProperties": {
59
+ "type": "object",
60
+ "additionalProperties": false,
61
+ "properties": {
62
+ "enabled": { "type": "boolean", "default": true },
63
+ "appId": { "type": "string", "default": "" },
64
+ "appSecret": { "type": "string" },
65
+ "dmPolicy": {
66
+ "type": "string",
67
+ "default": "pairing",
68
+ "enum": ["pairing", "allowlist", "open", "disabled"]
69
+ },
70
+ "allowFrom": {
71
+ "type": "array",
72
+ "default": [],
73
+ "items": { "type": "string" }
74
+ },
75
+ "groupPolicy": {
76
+ "type": "string",
77
+ "default": "allowlist",
78
+ "enum": ["allowlist", "disabled"]
79
+ },
80
+ "requireMention": { "type": "boolean", "default": true },
81
+ "groupAllowFrom": {
82
+ "type": "array",
83
+ "items": { "type": "string" }
84
+ },
85
+ "channelContext": {
86
+ "type": "string",
87
+ "default": "thread",
88
+ "enum": ["channel", "thread"]
89
+ },
90
+ "emojiReaction": { "type": "boolean", "default": true },
91
+ "monitorEnabled": { "type": "boolean", "default": true }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ },
97
+ "uiHints": {
98
+ "enabled": { "order": 1, "help": "开启或关闭" },
99
+ "appId": {
100
+ "help": "推推机器人身份 AppId(你可以推推搜索【推推机器人助手】,和它聊天自助申请推推机器人)",
101
+ "order": 2
102
+ },
103
+ "appSecret": {
104
+ "help": "推推机器人密钥 Secret(推推机器人的 App Secret)",
105
+ "order": 3
106
+ },
107
+ "dmPolicy": {
108
+ "help": "私聊策略(pairing=配对(默认);allowlist=白名单;open=允许所有(不安全);disabled=禁用私聊)",
109
+ "order": 10,
110
+ "advanced": true
111
+ },
112
+ "allowFrom": {
113
+ "help": "私聊白名单-域账号(dmPolicy=allowlist 时生效;pairing 下可用于显式放行用户)。对群聊/团队也能生效",
114
+ "order": 11,
115
+ "advanced": true
116
+ },
117
+ "groupPolicy": {
118
+ "help": "群聊/团队策略(allowlist=白名单;disabled=禁用)",
119
+ "order": 12,
120
+ "advanced": true
121
+ },
122
+ "requireMention": {
123
+ "help": "群组/团队是否需要 @ 机器人才触发 Agent(默认 true)。注意:如果你关闭了这个开关,且有多个龙虾机器人在同一个群里,他们会聊的停不下来",
124
+ "order": 13,
125
+ "advanced": true
126
+ },
127
+ "groupAllowFrom": {
128
+ "help": "群组/团队白名单-包含群ID、团队ID或频道ID(仅在 groupPolicy=allowlist 生效)",
129
+ "order": 14,
130
+ "advanced": true
131
+ },
132
+ "channelContext": {
133
+ "help": "团队-频道上下文(选项已废弃)",
134
+ "order": 15,
135
+ "advanced": true
136
+ },
137
+ "emojiReaction": {
138
+ "help": "在收到消息后,大模型给出反应结果前,先对原消息发送一个\"收到\"的表情回复。",
139
+ "order": 16,
140
+ "advanced": true
141
+ },
142
+ "monitorEnabled": {
143
+ "help": "是否开启频道agent事件上报,用于频道展示agent执行中间步骤(默认 true)",
144
+ "order": 17,
145
+ "advanced": true
146
+ },
147
+ "accounts": {
148
+ "help": "Accounts(多账户配置)",
149
+ "order": 30,
150
+ "advanced": true
151
+ },
152
+ "accounts.*.enabled": { "order": 301, "help": "开启或关闭" },
153
+ "accounts.*.appId": {
154
+ "help": "推推机器人身份 AppId(你可以推推搜索【推推机器人助手】,和它聊天自助申请推推机器人)",
155
+ "order": 302
156
+ },
157
+ "accounts.*.appSecret": {
158
+ "help": "推推机器人密钥 Secret(推推机器人的 App Secret)",
159
+ "order": 303
160
+ },
161
+ "accounts.*.dmPolicy": {
162
+ "help": "私聊策略(pairing=配对(默认);allowlist=白名单;open=允许所有(不安全);disabled=禁用私聊)",
163
+ "order": 304,
164
+ "advanced": true
165
+ },
166
+ "accounts.*.allowFrom": {
167
+ "help": "私聊白名单-推推域账号(dmPolicy=allowlist 时生效;pairing 下可用于显式放行用户);对群、团队也生效",
168
+ "order": 305,
169
+ "advanced": true
170
+ },
171
+ "accounts.*.groupPolicy": {
172
+ "help": "群聊/团队策略(allowlist=白名单;disabled=禁用)",
173
+ "order": 306,
174
+ "advanced": true
175
+ },
176
+ "accounts.*.requireMention": {
177
+ "help": "群组/团队是否需要 @ 机器人才触发 Agent(默认 true)",
178
+ "order": 307,
179
+ "advanced": true
180
+ },
181
+ "accounts.*.groupAllowFrom": {
182
+ "help": "群组/团队白名单-包含群ID、团队ID或频道ID(仅在 groupPolicy=allowlist 生效)。如果不想所有人使用,可以配置私聊白名单,私聊白名单对群/团队仍然有效",
183
+ "order": 308,
184
+ "advanced": true
185
+ },
186
+ "accounts.*.channelContext": {
187
+ "help": "团队-频道上下文(选项已废弃)",
188
+ "order": 309,
189
+ "advanced": true
190
+ },
191
+ "accounts.*.emojiReaction": {
192
+ "help": "在收到消息后,大模型给出反应结果前,先对原消息发送一个\"收到\"的表情回复。",
193
+ "order": 310,
194
+ "advanced": true
195
+ },
196
+ "accounts.*.monitorEnabled": {
197
+ "help": "是否开启频道agent事件上报,用于频道展示agent执行中间步骤(默认 true)。",
198
+ "order": 311,
199
+ "advanced": true
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@qihoo/tuitui-openclaw-channel",
3
+ "version": "1.0.36",
4
+ "maintainers": [
5
+ {
6
+ "name": "huzunjie",
7
+ "email": "huzunjie@pyzy.net"
8
+ },
9
+ {
10
+ "name": "zhaohuaqiang",
11
+ "email": "zhaohuaqiang@360.cn"
12
+ },
13
+ {
14
+ "name": "xiaoshasha",
15
+ "email": "xiaoshasha@360.cn"
16
+ }
17
+ ],
18
+ "description": "TuiTui channel plugin for OpenClaw",
19
+ "type": "module",
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "openclaw.plugin.json",
27
+ "README.md"
28
+ ],
29
+ "peerDependencies": {
30
+ "openclaw": ">=2026.3.13"
31
+ },
32
+ "dependencies": {
33
+ "@sinclair/typebox": "^0.34.48",
34
+ "ws": "^8.13.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^25.9.1",
38
+ "@types/ws": "^8.13.0",
39
+ "typescript": "^5.7.0"
40
+ },
41
+ "openclaw": {
42
+ "extensions": ["./index.ts"],
43
+ "runtimeExtensions": ["./dist/index.js"],
44
+ "install": {
45
+ "npmSpec": "@qihoo/tuitui-openclaw-channel",
46
+ "localPath": "extensions/tuitui",
47
+ "defaultChoice": "npm"
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,31 @@
1
+ export declare const enabledDefault = true;
2
+ export declare const dmPolicyDefault = "pairing";
3
+ export declare const groupPolicyDefault = "allowlist";
4
+ export declare const requireMentionDefault = true;
5
+ export declare const emojiReactionDefault = true;
6
+ export declare const monitorEnabledDefault = true;
7
+ export declare const getAccountInfo: (acct?: any) => {
8
+ enabled: boolean;
9
+ appId: any;
10
+ appSecret: any;
11
+ dmPolicy: any;
12
+ allowFrom: string[];
13
+ groupPolicy: any;
14
+ groupAllowFrom: string[];
15
+ requireMention: boolean;
16
+ emojiReaction: boolean;
17
+ monitorEnabled: any;
18
+ };
19
+ export declare const resolveAccount: (cfg: any, accountId?: string | null) => {
20
+ enabled: boolean;
21
+ appId: any;
22
+ appSecret: any;
23
+ dmPolicy: any;
24
+ allowFrom: string[];
25
+ groupPolicy: any;
26
+ groupAllowFrom: string[];
27
+ requireMention: boolean;
28
+ emojiReaction: boolean;
29
+ monitorEnabled: any;
30
+ accountId: string;
31
+ };
@@ -0,0 +1,54 @@
1
+ import { parseAllowFroms, isEnabled } from './utils';
2
+ import { CHANNEL_ID } from './const';
3
+ import { DEFAULT_ACCOUNT_ID } from 'openclaw/plugin-sdk/account-id';
4
+ export const enabledDefault = true;
5
+ export const dmPolicyDefault = 'pairing';
6
+ export const groupPolicyDefault = 'allowlist';
7
+ export const requireMentionDefault = true;
8
+ export const emojiReactionDefault = true;
9
+ export const monitorEnabledDefault = true;
10
+ const mergeArrs = (arr1, arr2) => {
11
+ return [...new Set([...(arr1 || []), ...arr2 || []])];
12
+ };
13
+ export const getAccountInfo = (acct) => ({
14
+ enabled: isEnabled(acct?.enabled),
15
+ appId: acct?.appId || '',
16
+ appSecret: acct?.appSecret || undefined, // 避免默认值覆盖用户输入的空字符串 Secret 空字串系统也会认为是已填写
17
+ dmPolicy: acct?.dmPolicy || dmPolicyDefault,
18
+ allowFrom: parseAllowFroms(acct?.allowFrom || []),
19
+ // 群组策略与白名单、群组级覆盖
20
+ groupPolicy: acct?.groupPolicy || groupPolicyDefault,
21
+ groupAllowFrom: parseAllowFroms(acct?.groupAllowFrom || []),
22
+ requireMention: isEnabled(acct?.requireMention ?? requireMentionDefault),
23
+ emojiReaction: isEnabled(acct?.emojiReaction ?? emojiReactionDefault),
24
+ monitorEnabled: acct?.monitorEnabled ?? monitorEnabledDefault,
25
+ });
26
+ export const resolveAccount = (cfg, accountId) => {
27
+ const accId = accountId || DEFAULT_ACCOUNT_ID;
28
+ const defAccount = cfg?.channels?.[CHANNEL_ID] || {};
29
+ let currAccount = defAccount;
30
+ if (accId === DEFAULT_ACCOUNT_ID) {
31
+ // 如果在 channels.tuitui.accounts 中也配置了默认账号信息,则覆盖 channels.tuitui 中的默认账号信息,保持兼容性(openclaw 有个"自动合并默认账号信息到 accounts" 的 cli 选项)
32
+ const subDefInfo = defAccount.accounts?.[DEFAULT_ACCOUNT_ID];
33
+ if (subDefInfo) {
34
+ const { enabled, dmPolicy, groupPolicy, requireMention, emojiReaction, monitorEnabled } = subDefInfo;
35
+ currAccount = {
36
+ enabled: enabled === undefined || enabled === enabledDefault ? defAccount.enabled : enabled,
37
+ appId: subDefInfo.appId || defAccount.appId,
38
+ appSecret: subDefInfo.appSecret || defAccount.appSecret,
39
+ dmPolicy: !dmPolicy || dmPolicy === dmPolicyDefault ? defAccount.dmPolicy : dmPolicy,
40
+ allowFrom: mergeArrs(subDefInfo.allowFrom, defAccount.allowFrom),
41
+ groupPolicy: !groupPolicy || groupPolicy === groupPolicyDefault ? defAccount.groupPolicy : groupPolicy,
42
+ groupAllowFrom: mergeArrs(subDefInfo.groupAllowFrom, defAccount.groupAllowFrom),
43
+ requireMention: requireMention === undefined || requireMention === requireMentionDefault ? defAccount.requireMention : requireMention,
44
+ emojiReaction: emojiReaction === undefined || emojiReaction === emojiReactionDefault ? defAccount.emojiReaction : emojiReaction,
45
+ monitorEnabled: monitorEnabled === undefined || monitorEnabled === monitorEnabledDefault ? defAccount.monitorEnabled : monitorEnabled,
46
+ };
47
+ }
48
+ }
49
+ else {
50
+ currAccount = currAccount.accounts?.[accId];
51
+ }
52
+ return { accountId: accId, ...getAccountInfo(currAccount) };
53
+ };
54
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AACzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C,MAAM,SAAS,GAAG,CAAC,IAAS,EAAE,IAAS,EAAE,EAAE;IACzC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC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AC;AAC9D,CAAC,CAAC","sourcesContent":["import { parseAllowFroms, isEnabled } from './utils';\nimport { CHANNEL_ID } from './const';\nimport { DEFAULT_ACCOUNT_ID } from 'openclaw/plugin-sdk/account-id';\n\nexport const enabledDefault = true;\nexport const dmPolicyDefault = 'pairing';\nexport const groupPolicyDefault = 'allowlist';\nexport const requireMentionDefault = true;\nexport const emojiReactionDefault = true;\nexport const monitorEnabledDefault = true;\n\nconst mergeArrs = (arr1: any, arr2: any) => {\n return [...new Set([...(arr1 || []), ...arr2 || []])];\n};\n\nexport const getAccountInfo = (acct?: any) => ({\n enabled: isEnabled(acct?.enabled),\n appId: acct?.appId || '',\n appSecret: acct?.appSecret || undefined, // 避免默认值覆盖用户输入的空字符串 Secret 空字串系统也会认为是已填写\n dmPolicy: acct?.dmPolicy || dmPolicyDefault,\n allowFrom: parseAllowFroms(acct?.allowFrom || []),\n // 群组策略与白名单、群组级覆盖\n groupPolicy: acct?.groupPolicy || groupPolicyDefault,\n groupAllowFrom: parseAllowFroms(acct?.groupAllowFrom || []),\n requireMention: isEnabled(acct?.requireMention ?? requireMentionDefault),\n emojiReaction: isEnabled(acct?.emojiReaction ?? emojiReactionDefault),\n monitorEnabled: acct?.monitorEnabled ?? monitorEnabledDefault,\n});\n\nexport const resolveAccount = (cfg: any, accountId?: string | null) => {\n const accId = accountId || DEFAULT_ACCOUNT_ID;\n const defAccount = cfg?.channels?.[CHANNEL_ID] || {};\n let currAccount = defAccount;\n if (accId === DEFAULT_ACCOUNT_ID) {\n // 如果在 channels.tuitui.accounts 中也配置了默认账号信息,则覆盖 channels.tuitui 中的默认账号信息,保持兼容性(openclaw 有个\"自动合并默认账号信息到 accounts\" 的 cli 选项)\n const subDefInfo = defAccount.accounts?.[DEFAULT_ACCOUNT_ID];\n if (subDefInfo) {\n const { enabled, dmPolicy, groupPolicy, requireMention, emojiReaction, monitorEnabled } = subDefInfo;\n currAccount = {\n enabled: enabled === undefined || enabled === enabledDefault ? defAccount.enabled : enabled,\n appId: subDefInfo.appId || defAccount.appId,\n appSecret: subDefInfo.appSecret || defAccount.appSecret,\n dmPolicy: !dmPolicy || dmPolicy === dmPolicyDefault ? defAccount.dmPolicy : dmPolicy,\n allowFrom: mergeArrs(subDefInfo.allowFrom, defAccount.allowFrom),\n groupPolicy: !groupPolicy || groupPolicy === groupPolicyDefault ? defAccount.groupPolicy : groupPolicy,\n groupAllowFrom: mergeArrs(subDefInfo.groupAllowFrom, defAccount.groupAllowFrom),\n requireMention: requireMention === undefined || requireMention === requireMentionDefault ? defAccount.requireMention : requireMention,\n emojiReaction: emojiReaction === undefined || emojiReaction === emojiReactionDefault ? defAccount.emojiReaction : emojiReaction,\n monitorEnabled: monitorEnabled === undefined || monitorEnabled === monitorEnabledDefault ? defAccount.monitorEnabled : monitorEnabled,\n };\n }\n } else {\n currAccount = currAccount.accounts?.[accId];\n }\n return { accountId: accId, ...getAccountInfo(currAccount) };\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import { OpenClawPluginApi } from 'openclaw/plugin-sdk/core';
2
+ export declare function registerTuiTuiChannel(api: OpenClawPluginApi): void;