openclaw-openagent 1.0.12 → 1.0.14

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 (132) hide show
  1. package/dist/index.js +2 -0
  2. package/dist/src/config/config-schema.d.ts +9 -0
  3. package/dist/src/config/config-schema.js +6 -0
  4. package/dist/src/messaging/executor.d.ts +2 -3
  5. package/dist/src/messaging/executor.js +4 -31
  6. package/dist/src/plugin-ui/assets/openagent-override.js +124 -18
  7. package/dist/src/proxy/auth-proxy.js +5 -0
  8. package/dist/src/runtime/update-checker.d.ts +18 -0
  9. package/dist/src/runtime/update-checker.js +216 -0
  10. package/index.ts +3 -0
  11. package/package.json +1 -3
  12. package/src/app/channel-tools.ts +0 -249
  13. package/src/app/discovery-tools.ts +0 -273
  14. package/src/app/download-file-tool.ts +0 -133
  15. package/src/app/hooks.ts +0 -144
  16. package/src/app/index.ts +0 -84
  17. package/src/app/messaging-tools.ts +0 -79
  18. package/src/app/ops-tools.ts +0 -155
  19. package/src/app/remote-agent-tool.ts +0 -762
  20. package/src/app/types.ts +0 -68
  21. package/src/app/upload-file-tool.ts +0 -411
  22. package/src/app/verbose-preflight.ts +0 -190
  23. package/src/auth/config.ts +0 -266
  24. package/src/auth/credential-manager.ts +0 -146
  25. package/src/auth/index.ts +0 -24
  26. package/src/auth/verify.ts +0 -99
  27. package/src/channel.ts +0 -566
  28. package/src/compat.ts +0 -94
  29. package/src/config/config-schema.ts +0 -39
  30. package/src/messaging/aggregator.ts +0 -120
  31. package/src/messaging/collector.ts +0 -89
  32. package/src/messaging/executor.ts +0 -72
  33. package/src/messaging/inbound.ts +0 -150
  34. package/src/messaging/index.ts +0 -11
  35. package/src/messaging/mention-protocol.ts +0 -94
  36. package/src/messaging/process-c2c-request.ts +0 -564
  37. package/src/messaging/process-message.ts +0 -373
  38. package/src/messaging/scheduler.ts +0 -55
  39. package/src/messaging/types.ts +0 -38
  40. package/src/plugin-ui/adapters/oc-2026-04.js +0 -103
  41. package/src/plugin-ui/adapters/oc-2026-05.js +0 -125
  42. package/src/plugin-ui/adapters/oc-2026-06.js +0 -125
  43. package/src/plugin-ui/adapters/oc-unknown.js +0 -48
  44. package/src/plugin-ui/assets/agentbook-icon.svg +0 -5
  45. package/src/plugin-ui/assets/bg.png +0 -0
  46. package/src/plugin-ui/assets/icon.png +0 -0
  47. package/src/plugin-ui/assets/magic.svg +0 -5
  48. package/src/plugin-ui/assets/openagent-override.js +0 -11156
  49. package/src/plugin-ui/build.cjs +0 -463
  50. package/src/plugin-ui/index.ts +0 -18
  51. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -570
  52. package/src/plugin-ui/modules/agent-book/panel/agent-card.js +0 -170
  53. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -643
  54. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +0 -665
  55. package/src/plugin-ui/modules/agent-book/panel/mention-state.js +0 -206
  56. package/src/plugin-ui/modules/agent-book/panel/styles.js +0 -833
  57. package/src/plugin-ui/modules/agent-book/panel/theme-adapter.js +0 -86
  58. package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +0 -295
  59. package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +0 -211
  60. package/src/plugin-ui/modules/agent-book/scanner.js +0 -131
  61. package/src/plugin-ui/modules/agent-book/travelcard/travel-cards.js +0 -500
  62. package/src/plugin-ui/modules/agent-book/travelcard/travel-engine.js +0 -652
  63. package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +0 -256
  64. package/src/plugin-ui/modules/loader/bootstrap.js +0 -38
  65. package/src/plugin-ui/modules/loader/shared-state.js +0 -838
  66. package/src/plugin-ui/modules/loader/ws-intercept.js +0 -199
  67. package/src/plugin-ui/modules/remote-agent/chunk-parser.js +0 -161
  68. package/src/plugin-ui/modules/remote-agent/execution-card.js +0 -530
  69. package/src/plugin-ui/modules/remote-agent/markdown-renderer.js +0 -256
  70. package/src/plugin-ui/modules/remote-agent/media-links.js +0 -151
  71. package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +0 -134
  72. package/src/plugin-ui/modules/remote-agent/output-card.js +0 -342
  73. package/src/plugin-ui/modules/remote-agent/progress-store.js +0 -363
  74. package/src/plugin-ui/modules/remote-agent/render-hooks.js +0 -1700
  75. package/src/plugin-ui/modules/remote-agent/styles.js +0 -896
  76. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +0 -130
  77. package/src/plugin-ui/postinstall-deploy.cjs +0 -52
  78. package/src/plugin-ui/ui-extension-loader/backup.ts +0 -92
  79. package/src/plugin-ui/ui-extension-loader/index.ts +0 -276
  80. package/src/plugin-ui/ui-extension-loader/locator.ts +0 -152
  81. package/src/plugin-ui/ui-extension-loader/manifest.ts +0 -57
  82. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +0 -944
  83. package/src/plugin-ui/ui-extension-loader/removed-extensions.ts +0 -70
  84. package/src/plugin-ui/ui-extension-loader/types.ts +0 -72
  85. package/src/proxy/auth-proxy.ts +0 -409
  86. package/src/runtime/account.ts +0 -549
  87. package/src/runtime/index.ts +0 -7
  88. package/src/runtime/plugin-runtime.ts +0 -94
  89. package/src/runtime/registry.ts +0 -71
  90. package/src/sdk/CLASS_MAP.md +0 -143
  91. package/src/sdk/index.d.ts +0 -126
  92. package/src/sdk/index.js +0 -23990
  93. package/src/sdk/modules/cloud-search-module.js +0 -1117
  94. package/src/sdk/modules/follow-module.js +0 -1069
  95. package/src/sdk/modules/group-module.js +0 -7397
  96. package/src/sdk/modules/relationship-module.js +0 -2269
  97. package/src/sdk/modules/signaling-module.js +0 -1468
  98. package/src/sdk/modules/tim-upload-plugin.js +0 -730
  99. package/src/sdk/node-env/http-request.js +0 -90
  100. package/src/sdk/node-env/index.js +0 -57
  101. package/src/sdk/node-env/storage.js +0 -114
  102. package/src/sdk/package.json +0 -10
  103. package/src/sdk/tsconfig.json +0 -16
  104. package/src/state/pending-invocation-store.ts +0 -43
  105. package/src/state/store.ts +0 -756
  106. package/src/tim/c2c.ts +0 -451
  107. package/src/tim/channels.ts +0 -364
  108. package/src/tim/client.ts +0 -330
  109. package/src/tim/index.ts +0 -18
  110. package/src/tim/messages.ts +0 -166
  111. package/src/tim/sdk-logger-init.ts +0 -50
  112. package/src/tools.ts +0 -10
  113. package/src/transport/factory.ts +0 -95
  114. package/src/transport/oasn/index.ts +0 -17
  115. package/src/transport/oasn/oasn-agent-card.ts +0 -111
  116. package/src/transport/oasn/oasn-discovery.ts +0 -108
  117. package/src/transport/oasn/oasn-files.ts +0 -210
  118. package/src/transport/oasn/oasn-http.ts +0 -529
  119. package/src/transport/oasn/oasn-invocation.ts +0 -604
  120. package/src/transport/oasn/oasn-normalize.ts +0 -133
  121. package/src/transport/oasn/oasn-register.ts +0 -33
  122. package/src/transport/oasn/oasn-transport.ts +0 -318
  123. package/src/transport/oasn/oasn-types.ts +0 -404
  124. package/src/transport/tim/index.ts +0 -8
  125. package/src/transport/tim/tim-transport.ts +0 -515
  126. package/src/transport/types.ts +0 -538
  127. package/src/types/openclaw-plugin-sdk-media-store.d.ts +0 -9
  128. package/src/types/openclaw.d.ts +0 -97
  129. package/src/types/tencentcloud-chat.d.ts +0 -15
  130. package/src/util/http.ts +0 -113
  131. package/src/util/logger.ts +0 -131
  132. package/src/util/url-resolver.ts +0 -77
@@ -1,1069 +0,0 @@
1
- let t = 12,
2
- e = 20,
3
- s = 23,
4
- o = 27;
5
- class n {
6
- constructor(t = 0, e = 0) {
7
- ((this.high = t), (this.low = e));
8
- }
9
- equal(t) {
10
- return null !== t && this.low === t.low && this.high === t.high;
11
- }
12
- toString() {
13
- var t = Number(this.high).toString(16);
14
- let e = Number(this.low).toString(16);
15
- if (e.length < 8) {
16
- let t = 8 - e.length;
17
- for (; t; ) ((e = "0" + e), t--);
18
- }
19
- return t + e;
20
- }
21
- }
22
- let i = {
23
- TEST: {
24
- CHINA: { DEFAULT: "wss://wss-dev.tim.qq.com" },
25
- OVERSEA: { DEFAULT: "wss://wss-dev.tim.qq.com" },
26
- SINGAPORE: { DEFAULT: "wss://wsssgp-dev.im.qcloud.com" },
27
- KOREA: { DEFAULT: "wss://wsskr-dev.im.qcloud.com" },
28
- GERMANY: { DEFAULT: "wss://wssger-dev.im.qcloud.com" },
29
- IND: { DEFAULT: "wss://wssind-dev.im.qcloud.com" },
30
- JPN: { DEFAULT: "wss://wssjpn-dev.im.qcloud.com" },
31
- USA: { DEFAULT: "wss://wssusa-dev.im.qcloud.com" },
32
- INDONESIA: { DEFAULT: "wss://wssidn-dev.im.qcloud.com" },
33
- },
34
- PRODUCTION: {
35
- CHINA: {
36
- DEFAULT0: "wss://*w4c.my-imcloud.com",
37
- DEFAULT: "wss://wss.im.qcloud.com",
38
- IPV6: "wss://wssv6.im.qcloud.com",
39
- BACKUP: "wss://wss.tim.qq.com",
40
- BACKUP_WEB: "wss://*w4c.my-cpaas.com",
41
- BACKUP_CN: "wss://wss.im.tencent.cn",
42
- STAT: "https://events.im.qcloud.com",
43
- ANYCAST: "wss://162.14.13.203",
44
- },
45
- OVERSEA: {
46
- DEFAULT0: "wss://*w4c.my-imcloud.com",
47
- DEFAULT: "wss://wss.im.qcloud.com",
48
- IPV6: "wss://wssv6.im.qcloud.com",
49
- BACKUP: "wss://wss.my-imcloud.com",
50
- BACKUP_WEB: "wss://*w4c.my-cpaas.com",
51
- BACKUP_CN: "wss://wss.im.tencent.cn",
52
- STAT: "https://api.my-imcloud.com",
53
- },
54
- SINGAPORE: {
55
- DEFAULT0: "wss://*w4s.my-imcloud.com",
56
- DEFAULT: "wss://wsssgp.im.qcloud.com",
57
- IPV6: "wss://wsssgpv6.im.qcloud.com",
58
- BACKUP: "wss://wsssgp.my-imcloud.com",
59
- BACKUP_WEB: "wss://*w4s.my-cpaas.com",
60
- STAT: "https://apisgp.my-imcloud.com",
61
- ANYCAST: "wss://162.14.19.159",
62
- },
63
- KOREA: {
64
- DEFAULT0: "wss://*w4k.my-imcloud.com",
65
- DEFAULT: "wss://wsskr.im.qcloud.com",
66
- IPV6: "wss://wsskrv6.im.qcloud.com",
67
- BACKUP: "wss://wsskr.my-imcloud.com",
68
- BACKUP_WEB: "wss://*w4k.my-cpaas.com",
69
- STAT: "https://apikr.my-imcloud.com",
70
- ANYCAST: "wss://162.14.13.104",
71
- },
72
- GERMANY: {
73
- DEFAULT0: "wss://*w4g.my-imcloud.com",
74
- DEFAULT: "wss://wssger.im.qcloud.com",
75
- IPV6: "wss://wssgerv6.im.qcloud.com",
76
- BACKUP: "wss://wssger.my-imcloud.com",
77
- BACKUP_WEB: "wss://*w4g.my-cpaas.com",
78
- STAT: "https://apiger.my-imcloud.com",
79
- ANYCAST: "wss://162.14.3.17",
80
- },
81
- IND: {
82
- DEFAULT0: "wss://*w4i.my-imcloud.com",
83
- DEFAULT: "wss://wssind.my-imcloud.com",
84
- IPV6: "wss://wssindv6.im.qcloud.com",
85
- BACKUP: "wss://wssind.im.qcloud.com",
86
- BACKUP_WEB: "wss://*w4i.my-cpaas.com",
87
- STAT: "https://apiind.my-imcloud.com",
88
- ANYCAST: "wss://162.14.19.46",
89
- },
90
- JPN: {
91
- DEFAULT0: "wss://*w4j.my-imcloud.com",
92
- DEFAULT: "wss://wssjpn.im.qcloud.com",
93
- IPV6: "wss://wssjpnv6.im.qcloud.com",
94
- BACKUP: "wss://wssjpn.my-imcloud.com",
95
- BACKUP_WEB: "wss://*w4j.my-cpaas.com",
96
- STAT: "https://apijpn.my-imcloud.com",
97
- ANYCAST: "wss://162.14.13.254",
98
- },
99
- USA: {
100
- DEFAULT0: "wss://*w4u.my-imcloud.com",
101
- DEFAULT: "wss://wssusa.im.qcloud.com",
102
- IPV6: "wss://wssusav6.im.qcloud.com",
103
- BACKUP: "wss://wssusa.my-imcloud.com",
104
- BACKUP_WEB: "wss://*w4u.my-cpaas.com",
105
- STAT: "https://apiusa.my-imcloud.com",
106
- ANYCAST: "wss://162.14.10.42",
107
- },
108
- INDONESIA: {
109
- DEFAULT0: "wss://*w4y.my-imcloud.com",
110
- DEFAULT: "wss://wssidn.im.qcloud.com",
111
- IPV6: "wss://wssidnv6.im.qcloud.com",
112
- BACKUP: "wss://wssidn.my-imcloud.com",
113
- BACKUP_WEB: "wss://*w4y.my-cpaas.com",
114
- STAT: "https://apiidn.my-imcloud.com",
115
- ANYCAST: "wss://43.129.34.169",
116
- },
117
- },
118
- },
119
- r = {
120
- ANDROID: 2,
121
- IOS: 3,
122
- MAC: 4,
123
- WEB: 7,
124
- WX_MP: 8,
125
- QQ_MP: 9,
126
- TT_MP: 10,
127
- BAIDU_MP: 11,
128
- ALI_MP: 12,
129
- IPAD: 13,
130
- UNI_NATIVE_APP: 15,
131
- DONUT_NATIVE_APP: 19,
132
- NS_NATIVE_APP: 20,
133
- RN_NATIVE_APP: 21,
134
- },
135
- l = "CHINA",
136
- c = {
137
- HOST: {
138
- CURRENT: {
139
- DEFAULT: "wss://wss.im.qcloud.com",
140
- STAT: "https://events.im.qcloud.com",
141
- },
142
- setCurrent(t = l) {
143
- this.CURRENT = i.PRODUCTION[t];
144
- },
145
- },
146
- NAME: {
147
- OPEN_IM: "openim",
148
- OPEN_IM_MSG_EXT: "openim_msg_ext_http_svc",
149
- GRP: "group_open_http_svc",
150
- GRP_AV: "group_open_avchatroom_http_svc",
151
- GRP_COMMUNITY: "million_group_open_http_svc",
152
- GRP_ATTR: "group_open_attr_http_svc",
153
- FD: "sns",
154
- PROFILE: "profile",
155
- RECENT_CONTACT: "recentcontact",
156
- PIC: "openpic",
157
- BIG_GRP_NO_AUTH: "group_open_http_noauth_svc",
158
- BIG_GRP_POLLING: "group_open_long_polling_http_svc",
159
- BIG_GRP_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc",
160
- IM_OPEN_STAT: "imopenstat",
161
- WEB_IM: "webim",
162
- IM_COS_SIGN: "im_cos_sign_svr",
163
- CUSTOM_UPLOAD: "im_cos_msg",
164
- HEARTBEAT: "heartbeat",
165
- IM_OPEN_PUSH: "im_open_push",
166
- IM_OPEN_STATUS: "im_open_status",
167
- IM_LONG_MSG: "im_long_msg",
168
- IM_CONFIG_MANAGER: "im_sdk_config_mgr",
169
- STAT_SERVICE: "StatSvc",
170
- OVERLOAD_PUSH: "OverLoadPush",
171
- IM_MSG_AUDIT_MGR: "im_msg_audit_mgr",
172
- TUIROOM_SVR: "tui_room_svr",
173
- IM_OPEN_TRANSLATE: "im_open_translate",
174
- IM_OPEN_SPEECH: "im_open_speech",
175
- MSG_SEARCH: "message_search",
176
- GRP_SEARCH: "group_search",
177
- GRP_MEMBER_SEARCH: "group_member_search",
178
- USER_SEARCH: "user_search",
179
- FOLLOW: "follow",
180
- OFFLINE_PUSH_REPORT: "offline_push_report",
181
- IM_MSG_LOGIC: "im_msg_db_logic",
182
- },
183
- },
184
- u = {
185
- SEARCH_GRP_SNS: new n(0, Math.pow(2, 1)).toString(),
186
- AV_HISTORY_MSG: new n(0, Math.pow(2, 2)).toString(),
187
- GRP_COMMUNITY: new n(0, Math.pow(2, 3)).toString(),
188
- MSG_TO_SPECIFIED_GRP_MBR: new n(0, Math.pow(2, 4)).toString(),
189
- AV_MBR_LIST: new n(0, Math.pow(2, 6)).toString(),
190
- USER_STATUS: new n(0, Math.pow(2, 7)).toString(),
191
- CONV_MARK: new n(0, Math.pow(2, 9)).toString(),
192
- CONV_GROUP: new n(0, Math.pow(2, 10)).toString(),
193
- AV_BAN_MBR: new n(0, Math.pow(2, 11)).toString(),
194
- MSG_EXT: new n(0, Math.pow(2, 13)).toString(),
195
- GRP_COUNTER: new n(0, Math.pow(2, 15)).toString(),
196
- PLUGIN_TRANSLATE: new n(Math.pow(2, 6)).toString(),
197
- PLUGIN_VOICE_TO_TEXT: new n(Math.pow(2, 7)).toString(),
198
- PLUGIN_CS: new n(Math.pow(2, 8)).toString(),
199
- PLUGIN_PUSH: new n(Math.pow(2, 9)).toString(),
200
- PLUGIN_BOT: new n(Math.pow(2, 10)).toString(),
201
- MSG_REACTION: new n(Math.pow(2, 16)).toString(),
202
- FOLLOW: new n(Math.pow(2, 20)).toString(),
203
- },
204
- a =
205
- (c.HOST.setCurrent(l),
206
- "undefined" != typeof wx &&
207
- "function" == typeof wx.getSystemInfoSync &&
208
- ("mac" === wx.getSystemInfoSync().platform ||
209
- "windows" === wx.getSystemInfoSync().platform) &&
210
- void 0 === wx.getSystemInfoSync().uniPlatform),
211
- _ =
212
- ("undefined" != typeof wx &&
213
- "function" == typeof wx.getSystemInfoSync &&
214
- Boolean(wx.getSystemInfoSync().fontSizeSetting)) ||
215
- a,
216
- m =
217
- (_ && wx.createGamePortal,
218
- "undefined" != typeof qq &&
219
- "function" == typeof qq.getSystemInfoSync &&
220
- Boolean(qq.getSystemInfoSync().fontSizeSetting)),
221
- g =
222
- "undefined" != typeof tt &&
223
- "function" == typeof tt.getSystemInfoSync &&
224
- Boolean(tt.getSystemInfoSync().fontSizeSetting),
225
- h =
226
- "undefined" != typeof swan &&
227
- "function" == typeof swan.getSystemInfoSync &&
228
- Boolean(swan.getSystemInfoSync().fontSizeSetting),
229
- w =
230
- "undefined" != typeof my &&
231
- "function" == typeof my.getSystemInfoSync &&
232
- Boolean(my.getSystemInfoSync().fontSizeSetting),
233
- f = "undefined" != typeof jd && "function" == typeof jd.getSystemInfoSync,
234
- d =
235
- "undefined" != typeof uni &&
236
- "undefined" == typeof window &&
237
- "function" == typeof uni.requireNativePlugin,
238
- p = _ && "object" == typeof wx.miniapp,
239
- I = (g && tt.enterChat, _ || m || g || h || w || d || f),
240
- T =
241
- "undefined" == typeof window &&
242
- !I &&
243
- "undefined" != typeof global &&
244
- void 0 !== global.NativeScriptGlobals,
245
- A =
246
- "undefined" != typeof global &&
247
- (void 0 !== global.nativeModuleProxy || void 0 !== global.ReactNative),
248
- y = "undefined" != typeof uni ? !I : "undefined" != typeof window && !I && !A,
249
- S =
250
- (m ? qq : g ? tt : h ? swan : w ? my : _ ? wx : d ? uni : f && jd,
251
- (y && window && window.navigator && window.navigator.userAgent) || ""),
252
- E = /(micromessenger|webbrowser)/i.test(S),
253
- M = (function () {
254
- let t = "WEB";
255
- return (
256
- E
257
- ? (t = "WEB")
258
- : m
259
- ? (t = "QQ_MP")
260
- : g
261
- ? (t = "TT_MP")
262
- : h
263
- ? (t = "BAIDU_MP")
264
- : w
265
- ? (t = "ALI_MP")
266
- : _
267
- ? (t = p ? "DONUT_NATIVE_APP" : "WX_MP")
268
- : d
269
- ? (t = "UNI_NATIVE_APP")
270
- : T
271
- ? (t = "NS_NATIVE_APP")
272
- : A && (t = "RN_NATIVE_APP"),
273
- r[t]
274
- );
275
- })(),
276
- L =
277
- (!(function () {
278
- var t = S.match(/OS (\d+)_/i);
279
- t && t[1] && t[1];
280
- })(),
281
- (function () {
282
- var t,
283
- e,
284
- s = S.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
285
- s &&
286
- ((t = s[1] && parseFloat(s[1])), (e = s[2] && parseFloat(s[2])), t) &&
287
- e &&
288
- parseFloat(s[1] + "." + s[2]);
289
- })(),
290
- /MSIE/.test(S) || (-1 < S.indexOf("Trident") && -1 < S.indexOf("rv:11.0"))),
291
- U,
292
- P,
293
- O =
294
- (!(function () {
295
- var t = /MSIE\s(\d+)\.\d/.exec(S),
296
- t = t && parseFloat(t[1]);
297
- !t && /Trident\/7.0/i.test(S) && /rv:11.0/.test(S);
298
- })(),
299
- (U =
300
- "undefined" != typeof console
301
- ? console
302
- : "undefined" != typeof global && global.console
303
- ? global.console
304
- : "undefined" != typeof window && window.console
305
- ? window.console
306
- : {}),
307
- function () {}),
308
- N = [
309
- "assert",
310
- "clear",
311
- "count",
312
- "debug",
313
- "dir",
314
- "dirxml",
315
- "error",
316
- "group",
317
- "groupCollapsed",
318
- "groupEnd",
319
- "info",
320
- "log",
321
- "profile",
322
- "profileEnd",
323
- "table",
324
- "time",
325
- "timeEnd",
326
- "timeStamp",
327
- "trace",
328
- "warn",
329
- ],
330
- C = N.length;
331
- for (; C--; ) ((P = N[C]), console[P] || (U[P] = O));
332
- var F = U;
333
- let D = function () {
334
- return new Date().getTime() + 0;
335
- },
336
- v = "Tag_Profile_IM_Nick",
337
- R = "Tag_Profile_IM_Gender",
338
- b = "Tag_Profile_IM_BirthDay",
339
- k = "Tag_Profile_IM_Location",
340
- q = "Tag_Profile_IM_SelfSignature",
341
- B = "Tag_Profile_IM_AllowType",
342
- G = "Tag_Profile_IM_Language",
343
- x = "Tag_Profile_IM_Image",
344
- W = "Tag_Profile_IM_MsgSettings",
345
- $ = "Tag_Profile_IM_AdminForbidType",
346
- V = "Tag_Profile_IM_Level",
347
- K = "Tag_Profile_IM_Role",
348
- j = Object.prototype.hasOwnProperty,
349
- H = function (t) {
350
- return "map" === et(t);
351
- },
352
- Y = function (t) {
353
- return "set" === et(t);
354
- },
355
- X = function (t) {
356
- return "file" === et(t);
357
- },
358
- z = function (t) {
359
- return (
360
- null !== t &&
361
- (("number" == typeof t && !isNaN(+t)) ||
362
- ("object" == typeof t && t.constructor === Number))
363
- );
364
- },
365
- J = function (t) {
366
- if ("object" != typeof t || null === t) return !1;
367
- t = Object.getPrototypeOf(t);
368
- if (null === t) return !0;
369
- let e = t;
370
- for (; null !== Object.getPrototypeOf(e); ) e = Object.getPrototypeOf(e);
371
- return t === e;
372
- },
373
- Q = function (t) {
374
- return void 0 === t;
375
- },
376
- Z = function (t) {
377
- return (
378
- (e = t),
379
- ("function" == typeof Array.isArray
380
- ? Array.isArray(e)
381
- : "array" === et(e)) ||
382
- (null !== t && "object" == typeof t)
383
- );
384
- var e;
385
- },
386
- et = function (t) {
387
- return Object.prototype.toString
388
- .call(t)
389
- .match(/^\[object (.*)\]$/)[1]
390
- .toLowerCase();
391
- };
392
- function st() {
393
- return !L && !I;
394
- }
395
- Date.now ||
396
- (Date.now = function () {
397
- return new Date().getTime();
398
- });
399
- let ot = 0;
400
- function nt() {
401
- return st() ? "%c Chat %c" : "Chat";
402
- }
403
- function it() {
404
- (t = new Date()).setTime(D());
405
- var t;
406
- return (
407
- t.toLocaleTimeString("en-US", { hour12: !1 }) +
408
- "." +
409
- (function (t) {
410
- let e;
411
- switch (t.toString().length) {
412
- case 1:
413
- e = "00" + t;
414
- break;
415
- case 2:
416
- e = "0" + t;
417
- break;
418
- default:
419
- e = t;
420
- }
421
- return e;
422
- })(t.getMilliseconds())
423
- );
424
- }
425
- let rt = {
426
- arguments2String(s) {
427
- let o = "";
428
- if (1 === s.length) o = s[0];
429
- else
430
- for (let t = 0, e = s.length; t < e; t++) {
431
- if (Z(s[t]))
432
- try {
433
- o +=
434
- s[t] instanceof Error
435
- ? JSON.stringify(s[t], ["message", "code"])
436
- : JSON.stringify(s[t]);
437
- } catch (t) {
438
- o += t ? t.message : "";
439
- break;
440
- }
441
- else o += s[t];
442
- o += " ";
443
- }
444
- return o;
445
- },
446
- _exec(t, e) {
447
- st()
448
- ? F[t](
449
- nt(),
450
- "background:#0abf5b; padding:1px; border-radius:3px; color: #fff",
451
- "background:transparent",
452
- it(),
453
- e,
454
- )
455
- : F[t](`${nt()} ${it()} ` + e);
456
- },
457
- d: function () {
458
- var t;
459
- ot <= -1 &&
460
- ((t = this.arguments2String(arguments)), this._exec("debug", t));
461
- },
462
- l: function () {
463
- var t;
464
- ot <= 0 && ((t = this.arguments2String(arguments)), this._exec("log", t));
465
- },
466
- log: function () {
467
- var t;
468
- ot <= 0 && ((t = this.arguments2String(arguments)), this._exec("log", t));
469
- },
470
- i: function () {
471
- var t;
472
- ot <= 1 &&
473
- ((t = this.arguments2String(arguments)), this._exec("info", t));
474
- },
475
- w: function () {
476
- var t;
477
- ot <= 2 &&
478
- ((t = this.arguments2String(arguments)), this._exec("warn", t));
479
- },
480
- e: function () {
481
- var t;
482
- ot <= 3 &&
483
- ((t = this.arguments2String(arguments)), this._exec("error", t));
484
- },
485
- setLevel: function (t) {
486
- (t < 4 && this._exec("log", "set level from " + ot + " to " + t),
487
- (ot = t));
488
- },
489
- getLevel: function () {
490
- return ot;
491
- },
492
- },
493
- lt = function (t) {
494
- return { code: 0, data: t || {} };
495
- };
496
- class ct extends Error {
497
- constructor(t) {
498
- super();
499
- var { code: t, message: e, data: s } = t;
500
- ((this.code = t),
501
- e
502
- ? (this.message = e)
503
- : this._getErrMsg && (this.message = this._getErrMsg(this.code)),
504
- (this.data = s || {}));
505
- }
506
- }
507
- let ut = 2805,
508
- at = 2903,
509
- _t = 3122,
510
- mt = "onMyFollowersListUpdated",
511
- gt = "onMyFollowingListUpdated",
512
- ht = "onMutualFollowersListUpdated",
513
- wt = "error",
514
- ft = null,
515
- dt = function (t, e = !1) {
516
- if (t instanceof ct)
517
- return (e && null !== ft && ft.emit(wt, t), Promise.reject(t));
518
- if (t instanceof Error) {
519
- let t = new ct({ code: at });
520
- return (e && null !== ft && ft.emit(wt, t), Promise.reject(t));
521
- }
522
- return Q(t) || Q(t.code)
523
- ? Promise.reject(new ct({ code: at }))
524
- : ((t = new ct(t)),
525
- e && null !== ft && ft.emit(wt, t),
526
- Promise.reject(t));
527
- },
528
- pt = "follow_add",
529
- It = "follow_delete",
530
- Tt = "follow_get",
531
- At = "follow_get_info",
532
- yt = "follow_check",
533
- St = { info: 4, warning: 5, error: 6 },
534
- Et = {
535
- wifi: 1,
536
- "2g": 2,
537
- "3g": 3,
538
- "4g": 4,
539
- "5g": 5,
540
- unknown: 6,
541
- none: 7,
542
- online: 8,
543
- },
544
- Mt = {
545
- login: 4,
546
- plugin_search: 16,
547
- plugin_translate: 16,
548
- plugin_voice_to_text: 16,
549
- plugin_cs: 16,
550
- plugin_push: 16,
551
- plugin_bot: 16,
552
- plugin_emoji_reaction: 16,
553
- tui_key_features: 16,
554
- };
555
- class Lt {
556
- constructor(t) {
557
- ((this._n = "SSOLogData"),
558
- (this.eventType = Mt[t] || 0),
559
- (this.timestamp = 0),
560
- (this.networkType = 8),
561
- (this.code = 0),
562
- (this.message = ""),
563
- (this.moreMessage = ""),
564
- (this.extension = t),
565
- (this.costTime = 0),
566
- (this.duplicate = !1),
567
- (this.level = 4),
568
- (this.uiPlatform = void 0),
569
- (this._sentFlag = !1),
570
- (this._startts = D()));
571
- }
572
- static bindEventStatModule(t) {
573
- Lt.prototype._eventStatModule = t;
574
- }
575
- static bindNetMonitorModule(t) {
576
- Lt.prototype._netMonitorModule = t;
577
- }
578
- updateTimeStamp() {
579
- this.timestamp = D();
580
- }
581
- start(t) {
582
- return ((this._startts = t), this);
583
- }
584
- end(t = !1) {
585
- if (!this._sentFlag) {
586
- if (this._netMonitorModule) {
587
- let t = this._netMonitorModule.getNetworkType();
588
- this.setNetworkType(t);
589
- }
590
- var e = D();
591
- (0 === this.costTime && (this.costTime = e - this._startts),
592
- this.setMoreMessage(`startts:${this._startts} endts:` + e),
593
- t
594
- ? ((this._sentFlag = !0),
595
- this._eventStatModule && this._eventStatModule.pushIn(this))
596
- : setTimeout(() => {
597
- ((this._sentFlag = !0),
598
- this._eventStatModule && this._eventStatModule.pushIn(this));
599
- }, 0));
600
- }
601
- }
602
- setError(e) {
603
- if (e instanceof Error) {
604
- if (!this._sentFlag) {
605
- let t = !0;
606
- if (
607
- (t = this._netMonitorModule ? this._netMonitorModule.isOnline() : t)
608
- )
609
- (e.code && this.setCode(e.code),
610
- e.message && this.setMoreMessage(e.message));
611
- else {
612
- let t = ut;
613
- this.setCode(t);
614
- }
615
- this.setLevel("error");
616
- }
617
- } else
618
- rt.w(this._n + ".setError value not instanceof Error, please check!");
619
- return this;
620
- }
621
- setCode(t) {
622
- return (
623
- Q(t) ||
624
- this._sentFlag ||
625
- ("ECONNABORTED" === t && (this.code = 103),
626
- z(t)
627
- ? (this.code = t)
628
- : rt.w(
629
- this._n + ".setCode value not a number, please check!",
630
- t,
631
- typeof t,
632
- )),
633
- this
634
- );
635
- }
636
- setMessage(t) {
637
- return (
638
- Q(t) ||
639
- this._sentFlag ||
640
- (z(t) && (this.message = t.toString()),
641
- "string" == typeof t && (this.message = t)),
642
- this
643
- );
644
- }
645
- setCostTime(t) {
646
- return ((this.costTime = t), this);
647
- }
648
- setLevel(t) {
649
- return (Q(t) || this._sentFlag || (this.level = St[t]), this);
650
- }
651
- setMoreMessage(t) {
652
- return (
653
- (function (t) {
654
- if (null == t) return 1;
655
- if ("boolean" != typeof t) {
656
- if ("number" == typeof t) return 0 === t;
657
- if ("string" == typeof t) return 0 === t.length;
658
- if ("function" == typeof t) return 0 === t.length;
659
- if (Array.isArray(t)) return 0 === t.length;
660
- if (t instanceof Error) return "" === t.message;
661
- if (J(t)) {
662
- for (var e in t) if (j.call(t, e)) return;
663
- return 1;
664
- }
665
- return (H(t) || Y(t) || X(t)) && 0 === t.size;
666
- }
667
- })(this.moreMessage)
668
- ? (this.moreMessage = "" + t)
669
- : (this.moreMessage += " " + t),
670
- this
671
- );
672
- }
673
- setNetworkType(t) {
674
- return (
675
- Q(t)
676
- ? rt.w(this._n + ".setNetworkType value is undefined, please check!")
677
- : ((t = Et[t.toLowerCase()]), Q(t) || (this.networkType = t)),
678
- this
679
- );
680
- }
681
- getStartTs() {
682
- return this._startts;
683
- }
684
- setUIPlatform(t) {
685
- return ((this.uiPlatform = t), this);
686
- }
687
- setExtension(t) {
688
- return ((this.extension = t), this);
689
- }
690
- setEventType(t) {
691
- return ((this.eventType = t), this);
692
- }
693
- }
694
- let Ut = {
695
- A2KEY_AND_TINYID_UPDATED: "_inner1",
696
- CLOUD_CONFIG: "_inner2",
697
- PROFILE_UPDATED: "_inner3",
698
- CONV_SYNC_COMPLETED: "_inner4",
699
- C2C_UNREAD_HANDLE_COMPLETED: "_inner5",
700
- },
701
- Pt = { NONE: 0, FOLLOWERS: 1, FOLLOWING: 2, MUTUAL: 3 };
702
- class Ot extends class {
703
- constructor(t) {
704
- ((this._m = t), (this._n = ""));
705
- }
706
- isLoggedIn() {
707
- return this._m.get(t).isLoggedIn();
708
- }
709
- isOversea() {
710
- return this._m.get(t).isOversea();
711
- }
712
- isPrivateNetWork() {
713
- var e = this._m.get(t);
714
- return e.isPrivateNetWork() && !e.getFileDownloadProxy();
715
- }
716
- getFileDownloadProxy() {
717
- return this._m.get(t).getFileDownloadProxy();
718
- }
719
- getDownloadFileAuthKey() {
720
- return this._m.get(t).getDownloadFileAuthKey();
721
- }
722
- getMyUserID() {
723
- return this._m.get(t).getUserID();
724
- }
725
- getMyTinyID() {
726
- return this._m.get(t).getTinyID();
727
- }
728
- getSDKAppID() {
729
- return this._m.get(t).getSDKAppID();
730
- }
731
- isIntl() {
732
- return this._m.get(t).isIntl();
733
- }
734
- isUsingChatCore() {
735
- return this._m.get(t).isUsingChatCore();
736
- }
737
- isDevMode() {
738
- return this._m.get(t).isDevMode();
739
- }
740
- get(t) {
741
- return this._m.get(t);
742
- }
743
- getPlatform() {
744
- return M;
745
- }
746
- getCloudConfig(t) {
747
- return this._m.get(s).getCloudConfig(t);
748
- }
749
- emitOEvt(t, e) {
750
- this._m.getOEmitInst().emit(t, e);
751
- }
752
- emitIEvt(t, e) {
753
- this._m.getIEmitInst().emit(t, e);
754
- }
755
- getIEmitInst() {
756
- return this._m.getIEmitInst();
757
- }
758
- req(t) {
759
- return this._m.get(e).req(t);
760
- }
761
- canIUse(t) {
762
- return this._m.get(o).canIUse(t);
763
- }
764
- getErrMsg(t, e, s) {
765
- return this._m.getErrMsg(t, e, s);
766
- }
767
- warn(t, e, s) {
768
- t = this.getErrMsg(t, e, s);
769
- t && rt.w(t);
770
- }
771
- noUse(t) {
772
- var e = _t;
773
- return dt({ code: e, message: this.getErrMsg(e, t) });
774
- }
775
- } {
776
- constructor(t) {
777
- (super(t),
778
- (this._n = "FollowModule"),
779
- (this.DEFAULT_COUNT = 500),
780
- (this.MAX_COUNT = 1e3),
781
- this.getIEmitInst().on(Ut.CLOUD_CONFIG, this._onCloudConfig, this));
782
- }
783
- _onCloudConfig() {
784
- var t = this.getCloudConfig("follow_req_count");
785
- Q(t) ||
786
- ((t = Number(t)),
787
- (this.DEFAULT_COUNT = t > this.MAX_COUNT ? this.MAX_COUNT : t));
788
- }
789
- onFollowNotify(t) {
790
- t = t.dataList || [];
791
- (rt.l(this._n + ".onFollowNotify followChangeList:" + t.length),
792
- t.forEach((t) => {
793
- let { followDiffList: e = [], ...s } = t,
794
- { from: o, ...n } = s;
795
- e.forEach((t) => {
796
- var { isAdd: t, followType: e = 0 } = t,
797
- s = this._initFollowInfo();
798
- (1 === t
799
- ? ((n.userID = o), s[e].userInfoList.push(n), (s[e].isAdd = !0))
800
- : (s[e].userInfoList.push(o), (s[e].isAdd = !1)),
801
- this._emitEvent(s));
802
- });
803
- }));
804
- }
805
- _initFollowInfo() {
806
- let e = {};
807
- return (
808
- Object.values(Pt).forEach((t) => {
809
- t !== Pt.NONE && (e[t] = { userInfoList: [], isAdd: !1 });
810
- }),
811
- e
812
- );
813
- }
814
- _emitEvent(s) {
815
- Object.keys(s).forEach((t) => {
816
- var t = Number(t),
817
- e = s[t];
818
- 0 < e.userInfoList.length &&
819
- (t === Pt.FOLLOWERS && this.emitOEvt(mt, e),
820
- t === Pt.FOLLOWING && this.emitOEvt(gt, e),
821
- t === Pt.MUTUAL) &&
822
- this.emitOEvt(ht, e);
823
- });
824
- }
825
- followUser(t) {
826
- if (!this.canIUse(u.FOLLOW)) return this.noUse("followUser");
827
- let e = this._n + ".followUser",
828
- s = "userIDList:" + t.length,
829
- o = new Lt("followUser");
830
- return (
831
- o.setMessage(s),
832
- rt.l(e + " " + s),
833
- this.req({
834
- P: pt,
835
- data: {
836
- fromAccount: this.getMyUserID(),
837
- userIDList: t.map((t) => ({ userID: t })),
838
- },
839
- })
840
- .then((t) => (o.end(), rt.l(e + " ok."), lt(t.data.resultList)))
841
- .catch(
842
- (t) => (o.setError(t).end(), rt.e(e + " failed. error:", t), dt(t)),
843
- )
844
- );
845
- }
846
- unfollowUser(t) {
847
- if (!this.canIUse(u.FOLLOW)) return this.noUse("unfollowUser");
848
- let e = this._n + ".unfollowUser",
849
- s = "userIDList:" + t.length,
850
- o = new Lt("unfollowUser");
851
- return (
852
- o.setMessage(s),
853
- rt.l(e + " " + s),
854
- this.req({
855
- P: It,
856
- data: { fromAccount: this.getMyUserID(), userIDList: t },
857
- })
858
- .then((t) => (o.end(), rt.l(e + " ok."), lt(t.data.resultList)))
859
- .catch(
860
- (t) => (o.setError(t).end(), rt.e(e + " failed. error:", t), dt(t)),
861
- )
862
- );
863
- }
864
- getMyFollowersList(t = "") {
865
- return this.canIUse(u.FOLLOW)
866
- ? this._getFollowList(t, Pt.FOLLOWERS).then((t) => {
867
- var { nextCursor: e, resultList: s = [] } = t;
868
- return (
869
- rt.l(
870
- `${this._n}.getMyFollowersList ok, count:${s.length} nextCursor:` +
871
- e,
872
- ),
873
- lt(t)
874
- );
875
- })
876
- : this.noUse("getMyFollowersList");
877
- }
878
- getMyFollowingList(t = "") {
879
- return this.canIUse(u.FOLLOW)
880
- ? this._getFollowList(t, Pt.FOLLOWING).then((t) => {
881
- var { nextCursor: e, resultList: s = [] } = t;
882
- return (
883
- rt.l(
884
- `${this._n}.getMyFollowingList ok, count:${s.length} nextCursor:` +
885
- e,
886
- ),
887
- lt(t)
888
- );
889
- })
890
- : this.noUse("getMyFollowingList");
891
- }
892
- getMutualFollowersList(t = "") {
893
- return this.canIUse(u.FOLLOW)
894
- ? this._getFollowList(t, Pt.MUTUAL).then((t) => {
895
- var { nextCursor: e, resultList: s = [] } = t;
896
- return (
897
- rt.l(
898
- `${this._n}.getMutualFollowersList ok, count:${s.length} nextCursor:` +
899
- e,
900
- ),
901
- lt(t)
902
- );
903
- })
904
- : this.noUse("getMutualFollowersList");
905
- }
906
- _getFollowList(t, e) {
907
- let n = new Lt("_getFollowList");
908
- return (
909
- n.setMessage(`nextCursor:${t} type:` + e),
910
- this.req({
911
- P: Tt,
912
- data: {
913
- fromAccount: this.getMyUserID(),
914
- count: this.DEFAULT_COUNT,
915
- nextCursor: t,
916
- type: e,
917
- },
918
- })
919
- .then((t) => {
920
- n.end();
921
- let { resultList: e = [], nextCursor: s = "" } = t.data,
922
- o = [];
923
- return (
924
- e.forEach((t) => {
925
- var { userID: t, followTime: e, profileList: s = [] } = t;
926
- o.push({
927
- userID: t,
928
- followTime: e,
929
- ...this._handleProfileItem(s),
930
- });
931
- }),
932
- { resultList: o, nextCursor: s }
933
- );
934
- })
935
- .catch(
936
- (t) => (
937
- n.setError(t).end(),
938
- rt.e(this._n + "._getFollowList failed. error:", t),
939
- dt(t)
940
- ),
941
- )
942
- );
943
- }
944
- _handleProfileItem(t) {
945
- let e = {};
946
- return (
947
- t.forEach((t) => {
948
- switch (t.tag) {
949
- case v:
950
- e.nick = t.value;
951
- break;
952
- case R:
953
- e.gender = t.value;
954
- break;
955
- case b:
956
- e.birthday = t.value;
957
- break;
958
- case k:
959
- e.location = t.value;
960
- break;
961
- case q:
962
- e.selfSignature = t.value;
963
- break;
964
- case B:
965
- e.allowType = t.value;
966
- break;
967
- case G:
968
- e.language = t.value;
969
- break;
970
- case x:
971
- e.avatar = t.value;
972
- break;
973
- case W:
974
- e.messageSettings = t.value;
975
- break;
976
- case $:
977
- e.adminForbidType = t.value;
978
- break;
979
- case V:
980
- e.level = t.value;
981
- break;
982
- case K:
983
- e.role = t.value;
984
- break;
985
- default:
986
- e[t.tag] = t.value;
987
- }
988
- }),
989
- e
990
- );
991
- }
992
- getUserFollowInfo(t) {
993
- if (!this.canIUse(u.FOLLOW)) return this.noUse("getUserFollowInfo");
994
- let e = t,
995
- s = !1,
996
- n =
997
- (Q(t) && ((e = [this.getMyUserID()]), (s = !0)),
998
- this._n + ".getUserFollowInfo"),
999
- o = `userIDList:${e.length} isGetMyFollowInfo:` + s,
1000
- r = new Lt("getUserFollowInfo");
1001
- return (
1002
- r.setMessage(o),
1003
- rt.l(n + " " + o),
1004
- this.req({
1005
- P: At,
1006
- data: { fromAccount: this.getMyUserID(), userIDList: e },
1007
- })
1008
- .then((t) => {
1009
- (r.end(), rt.l(n + " ok."));
1010
- let { followInfoList: e = [] } = t.data,
1011
- o = [];
1012
- return (
1013
- e.forEach((t) => {
1014
- var {
1015
- followersCount: t,
1016
- followingCount: e,
1017
- mutualFollowersCount: s,
1018
- } = t;
1019
- o.push({
1020
- followersCount: t,
1021
- followingCount: e,
1022
- mutualFollowersCount: s,
1023
- });
1024
- }),
1025
- lt(o)
1026
- );
1027
- })
1028
- .catch(
1029
- (t) => (r.setError(t).end(), rt.e(n + " failed. error:", t), dt(t)),
1030
- )
1031
- );
1032
- }
1033
- checkFollowType(t) {
1034
- if (!this.canIUse(u.FOLLOW)) return this.noUse("checkFollowType");
1035
- 100 < t.length &&
1036
- ((t = t.slice(0, 100)),
1037
- rt.w(o + " " + "the length of userIDList cannot exceed 100"));
1038
- let o = this._n + ".checkFollowType",
1039
- e = `userIDList length:${t.length} `,
1040
- n = new Lt("checkFollowType");
1041
- return (
1042
- n.setMessage(e),
1043
- rt.l(o + " " + e),
1044
- this.req({
1045
- P: yt,
1046
- data: { fromAccount: this.getMyUserID(), userIDList: t },
1047
- })
1048
- .then((t) => {
1049
- (n.end(), rt.l(o + " ok."));
1050
- let { resultList: e = [] } = t.data,
1051
- s = [];
1052
- return (
1053
- e.forEach((t) => {
1054
- var { userID: t, followType: e } = t;
1055
- s.push({ userID: t, followType: e });
1056
- }),
1057
- lt(s)
1058
- );
1059
- })
1060
- .catch(
1061
- (t) => (n.setError(t).end(), rt.e(o + " failed. error:", t), dt(t)),
1062
- )
1063
- );
1064
- }
1065
- reset() {
1066
- rt.l(this._n + ".reset");
1067
- }
1068
- }
1069
- export { Ot as default };