openclaw-openagent 1.0.13 → 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 (128) hide show
  1. package/dist/src/messaging/executor.d.ts +2 -3
  2. package/dist/src/messaging/executor.js +4 -31
  3. package/dist/src/plugin-ui/assets/openagent-override.js +4 -5
  4. package/dist/src/runtime/update-checker.d.ts +1 -1
  5. package/dist/src/runtime/update-checker.js +9 -46
  6. package/package.json +1 -3
  7. package/src/app/channel-tools.ts +0 -249
  8. package/src/app/discovery-tools.ts +0 -273
  9. package/src/app/download-file-tool.ts +0 -133
  10. package/src/app/hooks.ts +0 -144
  11. package/src/app/index.ts +0 -84
  12. package/src/app/messaging-tools.ts +0 -79
  13. package/src/app/ops-tools.ts +0 -155
  14. package/src/app/remote-agent-tool.ts +0 -762
  15. package/src/app/types.ts +0 -68
  16. package/src/app/upload-file-tool.ts +0 -411
  17. package/src/app/verbose-preflight.ts +0 -190
  18. package/src/auth/config.ts +0 -266
  19. package/src/auth/credential-manager.ts +0 -146
  20. package/src/auth/index.ts +0 -24
  21. package/src/auth/verify.ts +0 -99
  22. package/src/channel.ts +0 -566
  23. package/src/compat.ts +0 -94
  24. package/src/config/config-schema.ts +0 -45
  25. package/src/messaging/aggregator.ts +0 -120
  26. package/src/messaging/collector.ts +0 -89
  27. package/src/messaging/executor.ts +0 -72
  28. package/src/messaging/inbound.ts +0 -150
  29. package/src/messaging/index.ts +0 -11
  30. package/src/messaging/mention-protocol.ts +0 -94
  31. package/src/messaging/process-c2c-request.ts +0 -564
  32. package/src/messaging/process-message.ts +0 -373
  33. package/src/messaging/scheduler.ts +0 -55
  34. package/src/messaging/types.ts +0 -38
  35. package/src/plugin-ui/adapters/oc-2026-04.js +0 -103
  36. package/src/plugin-ui/adapters/oc-2026-05.js +0 -125
  37. package/src/plugin-ui/adapters/oc-2026-06.js +0 -125
  38. package/src/plugin-ui/adapters/oc-unknown.js +0 -48
  39. package/src/plugin-ui/assets/agentbook-icon.svg +0 -5
  40. package/src/plugin-ui/assets/bg.png +0 -0
  41. package/src/plugin-ui/assets/icon.png +0 -0
  42. package/src/plugin-ui/assets/magic.svg +0 -5
  43. package/src/plugin-ui/assets/openagent-override.js +0 -11263
  44. package/src/plugin-ui/build.cjs +0 -463
  45. package/src/plugin-ui/index.ts +0 -18
  46. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -570
  47. package/src/plugin-ui/modules/agent-book/panel/agent-card.js +0 -170
  48. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -643
  49. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +0 -665
  50. package/src/plugin-ui/modules/agent-book/panel/mention-state.js +0 -206
  51. package/src/plugin-ui/modules/agent-book/panel/styles.js +0 -832
  52. package/src/plugin-ui/modules/agent-book/panel/theme-adapter.js +0 -86
  53. package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +0 -295
  54. package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +0 -211
  55. package/src/plugin-ui/modules/agent-book/scanner.js +0 -131
  56. package/src/plugin-ui/modules/agent-book/travelcard/travel-cards.js +0 -500
  57. package/src/plugin-ui/modules/agent-book/travelcard/travel-engine.js +0 -652
  58. package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +0 -262
  59. package/src/plugin-ui/modules/loader/bootstrap.js +0 -133
  60. package/src/plugin-ui/modules/loader/shared-state.js +0 -838
  61. package/src/plugin-ui/modules/loader/ws-intercept.js +0 -199
  62. package/src/plugin-ui/modules/remote-agent/chunk-parser.js +0 -161
  63. package/src/plugin-ui/modules/remote-agent/execution-card.js +0 -530
  64. package/src/plugin-ui/modules/remote-agent/markdown-renderer.js +0 -256
  65. package/src/plugin-ui/modules/remote-agent/media-links.js +0 -151
  66. package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +0 -134
  67. package/src/plugin-ui/modules/remote-agent/output-card.js +0 -342
  68. package/src/plugin-ui/modules/remote-agent/progress-store.js +0 -363
  69. package/src/plugin-ui/modules/remote-agent/render-hooks.js +0 -1700
  70. package/src/plugin-ui/modules/remote-agent/styles.js +0 -903
  71. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +0 -130
  72. package/src/plugin-ui/postinstall-deploy.cjs +0 -52
  73. package/src/plugin-ui/ui-extension-loader/backup.ts +0 -92
  74. package/src/plugin-ui/ui-extension-loader/index.ts +0 -276
  75. package/src/plugin-ui/ui-extension-loader/locator.ts +0 -152
  76. package/src/plugin-ui/ui-extension-loader/manifest.ts +0 -57
  77. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +0 -944
  78. package/src/plugin-ui/ui-extension-loader/removed-extensions.ts +0 -70
  79. package/src/plugin-ui/ui-extension-loader/types.ts +0 -72
  80. package/src/proxy/auth-proxy.ts +0 -414
  81. package/src/runtime/account.ts +0 -549
  82. package/src/runtime/index.ts +0 -7
  83. package/src/runtime/plugin-runtime.ts +0 -94
  84. package/src/runtime/registry.ts +0 -71
  85. package/src/runtime/update-checker.ts +0 -286
  86. package/src/sdk/CLASS_MAP.md +0 -143
  87. package/src/sdk/index.d.ts +0 -126
  88. package/src/sdk/index.js +0 -23990
  89. package/src/sdk/modules/cloud-search-module.js +0 -1117
  90. package/src/sdk/modules/follow-module.js +0 -1069
  91. package/src/sdk/modules/group-module.js +0 -7397
  92. package/src/sdk/modules/relationship-module.js +0 -2269
  93. package/src/sdk/modules/signaling-module.js +0 -1468
  94. package/src/sdk/modules/tim-upload-plugin.js +0 -730
  95. package/src/sdk/node-env/http-request.js +0 -90
  96. package/src/sdk/node-env/index.js +0 -57
  97. package/src/sdk/node-env/storage.js +0 -114
  98. package/src/sdk/package.json +0 -10
  99. package/src/sdk/tsconfig.json +0 -16
  100. package/src/state/pending-invocation-store.ts +0 -43
  101. package/src/state/store.ts +0 -756
  102. package/src/tim/c2c.ts +0 -451
  103. package/src/tim/channels.ts +0 -364
  104. package/src/tim/client.ts +0 -330
  105. package/src/tim/index.ts +0 -18
  106. package/src/tim/messages.ts +0 -166
  107. package/src/tim/sdk-logger-init.ts +0 -50
  108. package/src/tools.ts +0 -10
  109. package/src/transport/factory.ts +0 -95
  110. package/src/transport/oasn/index.ts +0 -17
  111. package/src/transport/oasn/oasn-agent-card.ts +0 -111
  112. package/src/transport/oasn/oasn-discovery.ts +0 -108
  113. package/src/transport/oasn/oasn-files.ts +0 -210
  114. package/src/transport/oasn/oasn-http.ts +0 -529
  115. package/src/transport/oasn/oasn-invocation.ts +0 -604
  116. package/src/transport/oasn/oasn-normalize.ts +0 -133
  117. package/src/transport/oasn/oasn-register.ts +0 -33
  118. package/src/transport/oasn/oasn-transport.ts +0 -318
  119. package/src/transport/oasn/oasn-types.ts +0 -404
  120. package/src/transport/tim/index.ts +0 -8
  121. package/src/transport/tim/tim-transport.ts +0 -515
  122. package/src/transport/types.ts +0 -538
  123. package/src/types/openclaw-plugin-sdk-media-store.d.ts +0 -9
  124. package/src/types/openclaw.d.ts +0 -97
  125. package/src/types/tencentcloud-chat.d.ts +0 -15
  126. package/src/util/http.ts +0 -113
  127. package/src/util/logger.ts +0 -131
  128. package/src/util/url-resolver.ts +0 -77
@@ -1,71 +0,0 @@
1
- /**
2
- * RuntimeRegistry — Strict single-active-account enforcement
3
- *
4
- * Prevents concurrent accounts from running.
5
- * Registry.register() throws if another account is already active.
6
- * This replaces the old shared.js singleton pattern.
7
- *
8
- * See §1.1 of refactoring-plan.md.
9
- */
10
-
11
- import { logger } from '../util/logger.js';
12
- import type { AccountRuntime } from './account.js';
13
-
14
- export class RuntimeRegistry {
15
- private _active: AccountRuntime | null = null;
16
-
17
- /**
18
- * Register an AccountRuntime as the active instance.
19
- * @throws Error if another account is already active
20
- */
21
- register(runtime: AccountRuntime): void {
22
- if (this._active && this._active !== runtime) {
23
- throw new Error(
24
- `Cannot start account '${runtime.accountId}': ` +
25
- `account '${this._active.accountId}' is already running. ` +
26
- `Stop it first.`
27
- );
28
- }
29
- this._active = runtime;
30
- logger.info(`[registry] Registered account '${runtime.accountId}'`);
31
- }
32
-
33
- /**
34
- * Unregister the active runtime.
35
- */
36
- unregister(runtime: AccountRuntime): void {
37
- if (this._active === runtime) {
38
- logger.info(`[registry] Unregistered account '${runtime.accountId}'`);
39
- this._active = null;
40
- }
41
- }
42
-
43
- /**
44
- * Get the currently active runtime.
45
- * Returns null if no account is running.
46
- */
47
- getActive(): AccountRuntime | null {
48
- return this._active;
49
- }
50
-
51
- /**
52
- * Get the default (only) runtime.
53
- * In single-active-account mode, this is the same as getActive().
54
- */
55
- getDefault(): AccountRuntime | null {
56
- return this._active;
57
- }
58
-
59
- /**
60
- * Check if any account is currently running.
61
- */
62
- hasActive(): boolean {
63
- return this._active !== null;
64
- }
65
- }
66
-
67
- /**
68
- * Global registry instance.
69
- * Shared by channel adapter, tools, and hooks.
70
- */
71
- export const registry = new RuntimeRegistry();
@@ -1,286 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import fs from 'node:fs';
3
- import os from 'node:os';
4
- import path from 'node:path';
5
- import { fileURLToPath } from 'node:url';
6
-
7
- import { logger } from '../util/logger.js';
8
-
9
- const PLUGIN_PACKAGE = 'openclaw-openagent';
10
- const CLI_PACKAGE = 'openclaw-openagent-cli';
11
- const DEFAULT_DIST_TAG = 'latest';
12
- const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
13
- const CHECK_DELAY_MS = 3_000;
14
-
15
- export type OpenagentUpdatePolicy = 'notify' | 'auto' | 'off';
16
-
17
- export type OpenagentUpdateStatus = {
18
- checked: boolean;
19
- checking: boolean;
20
- currentVersion: string;
21
- latestVersion: string;
22
- distTag: string;
23
- updateAvailable: boolean;
24
- policy: OpenagentUpdatePolicy;
25
- installCommand: string;
26
- autoUpdateStarted: boolean;
27
- lastCheckedAt?: string;
28
- error?: string;
29
- };
30
-
31
- type UpdateConfig = {
32
- policy: OpenagentUpdatePolicy;
33
- distTag: string;
34
- channel: string;
35
- };
36
-
37
- let checkerStarted = false;
38
-
39
- const updateStatus: OpenagentUpdateStatus = {
40
- checked: false,
41
- checking: false,
42
- currentVersion: '',
43
- latestVersion: '',
44
- distTag: DEFAULT_DIST_TAG,
45
- updateAvailable: false,
46
- policy: 'notify',
47
- installCommand: `npx -y ${CLI_PACKAGE}`,
48
- autoUpdateStarted: false,
49
- };
50
-
51
- export function getOpenagentUpdateStatus(): OpenagentUpdateStatus {
52
- return { ...updateStatus };
53
- }
54
-
55
- export function startOpenagentUpdateChecker(): void {
56
- if (checkerStarted) return;
57
- checkerStarted = true;
58
- setTimeout(() => {
59
- void runOpenagentUpdateCheck().catch((err) => {
60
- updateStatus.checked = true;
61
- updateStatus.checking = false;
62
- updateStatus.error = (err as Error).message;
63
- updateStatus.lastCheckedAt = new Date().toISOString();
64
- logger.warn(`[update-check] failed: ${(err as Error).message}`);
65
- });
66
- }, CHECK_DELAY_MS).unref?.();
67
- }
68
-
69
- export async function runOpenagentUpdateCheck(): Promise<OpenagentUpdateStatus> {
70
- const config = resolveUpdateConfig();
71
- updateStatus.policy = config.policy;
72
- updateStatus.distTag = config.distTag;
73
- updateStatus.installCommand = buildInstallCommand(config);
74
- updateStatus.currentVersion = resolveCurrentVersion();
75
-
76
- if (config.policy === 'off') {
77
- updateStatus.checked = true;
78
- updateStatus.checking = false;
79
- updateStatus.updateAvailable = false;
80
- updateStatus.lastCheckedAt = new Date().toISOString();
81
- logger.info('[update-check] disabled by policy');
82
- return getOpenagentUpdateStatus();
83
- }
84
-
85
- updateStatus.checking = true;
86
- updateStatus.error = undefined;
87
- try {
88
- const latestVersion = await fetchDistTagVersion(config.distTag);
89
- updateStatus.latestVersion = latestVersion;
90
- updateStatus.updateAvailable = compareVersions(latestVersion, updateStatus.currentVersion) > 0;
91
- updateStatus.checked = true;
92
- updateStatus.checking = false;
93
- updateStatus.lastCheckedAt = new Date().toISOString();
94
-
95
- if (!updateStatus.updateAvailable) {
96
- logger.info(`[update-check] up to date: ${PLUGIN_PACKAGE}@${updateStatus.currentVersion}`);
97
- return getOpenagentUpdateStatus();
98
- }
99
-
100
- logger.warn(
101
- `[update-check] new ${PLUGIN_PACKAGE} version available: `
102
- + `${updateStatus.currentVersion} -> ${latestVersion}. Run: ${updateStatus.installCommand}`,
103
- );
104
-
105
- if (config.policy === 'auto') {
106
- startAutoUpdate(config);
107
- }
108
- return getOpenagentUpdateStatus();
109
- } catch (err) {
110
- updateStatus.checked = true;
111
- updateStatus.checking = false;
112
- updateStatus.error = (err as Error).message;
113
- updateStatus.lastCheckedAt = new Date().toISOString();
114
- throw err;
115
- }
116
- }
117
-
118
- function resolveUpdateConfig(): UpdateConfig {
119
- const fileConfig = readOpenagentConfig();
120
- const envPolicy = normalizePolicy(process.env.OPENAGENT_UPDATE_POLICY);
121
- const autoUpdateEnv = readBool(process.env.OPENAGENT_AUTO_UPDATE ?? process.env.OPENAGENT_PLUGIN_AUTO_UPDATE);
122
- const checkEnabledEnv = readBool(process.env.OPENAGENT_UPDATE_CHECK);
123
- const configPolicy = normalizePolicy(readString(fileConfig, 'update_policy', 'updatePolicy'));
124
- const configAutoUpdate = readBool(readString(fileConfig, 'auto_update', 'autoUpdate'));
125
- const configUpdateCheck = readBool(readString(fileConfig, 'update_check', 'updateCheck'));
126
-
127
- let policy: OpenagentUpdatePolicy = configPolicy || 'notify';
128
- if (configAutoUpdate === true) policy = 'auto';
129
- if (configUpdateCheck === false) policy = 'off';
130
- if (envPolicy) policy = envPolicy;
131
- if (autoUpdateEnv === true) policy = 'auto';
132
- if (checkEnabledEnv === false) policy = 'off';
133
-
134
- const distTag = normalizeDistTag(
135
- process.env.OPENAGENT_UPDATE_DIST_TAG
136
- || readString(fileConfig, 'update_dist_tag', 'updateDistTag')
137
- || process.env.OPENAGENT_PLUGIN_DIST_TAG
138
- || DEFAULT_DIST_TAG,
139
- );
140
- const channel = normalizeDistTag(
141
- process.env.OPENAGENT_UPDATE_CHANNEL
142
- || readString(fileConfig, 'update_channel', 'updateChannel')
143
- || process.env.OPENAGENT_PLUGIN_CHANNEL
144
- || '',
145
- );
146
-
147
- return {
148
- policy,
149
- distTag: channel || distTag,
150
- channel,
151
- };
152
- }
153
-
154
- function startAutoUpdate(config: UpdateConfig): void {
155
- if (updateStatus.autoUpdateStarted) return;
156
- updateStatus.autoUpdateStarted = true;
157
-
158
- const npxBin = process.platform === 'win32' ? 'npx.cmd' : 'npx';
159
- const args = ['-y', CLI_PACKAGE, 'update'];
160
- if (config.channel) {
161
- args.push('--channel', config.channel);
162
- } else if (config.distTag && config.distTag !== DEFAULT_DIST_TAG) {
163
- args.push('--dist-tag', config.distTag);
164
- }
165
-
166
- logger.warn(`[update-check] auto update started: ${npxBin} ${args.join(' ')}`);
167
- const child = spawn(npxBin, args, {
168
- detached: true,
169
- stdio: 'ignore',
170
- env: process.env,
171
- });
172
- child.unref();
173
- }
174
-
175
- function buildInstallCommand(config: UpdateConfig): string {
176
- const parts = ['npx', '-y', CLI_PACKAGE, 'update'];
177
- if (config.channel) {
178
- parts.push('--channel', config.channel);
179
- } else if (config.distTag && config.distTag !== DEFAULT_DIST_TAG) {
180
- parts.push('--dist-tag', config.distTag);
181
- }
182
- return parts.join(' ');
183
- }
184
-
185
- async function fetchDistTagVersion(distTag: string): Promise<string> {
186
- if (process.env.OPENAGENT_UPDATE_TEST_VERSION) {
187
- return process.env.OPENAGENT_UPDATE_TEST_VERSION;
188
- }
189
- const registry = (process.env.OPENAGENT_UPDATE_REGISTRY || DEFAULT_REGISTRY).replace(/\/+$/, '');
190
- const url = `${registry}/${encodeURIComponent(PLUGIN_PACKAGE)}/${encodeURIComponent(distTag)}`;
191
- const res = await fetch(url, {
192
- headers: { Accept: 'application/json' },
193
- signal: AbortSignal.timeout(5_000),
194
- });
195
- if (!res.ok) {
196
- throw new Error(`npm registry ${res.status} for ${PLUGIN_PACKAGE}@${distTag}`);
197
- }
198
- const data = await res.json() as { version?: unknown };
199
- const version = typeof data.version === 'string' ? data.version : '';
200
- if (!version) throw new Error(`npm registry response missing version for ${PLUGIN_PACKAGE}@${distTag}`);
201
- return version;
202
- }
203
-
204
- function resolveCurrentVersion(): string {
205
- const packageJson = findPackageJson();
206
- if (!packageJson) return '0.0.0';
207
- try {
208
- const data = JSON.parse(fs.readFileSync(packageJson, 'utf8')) as { version?: unknown };
209
- return typeof data.version === 'string' ? data.version : '0.0.0';
210
- } catch {
211
- return '0.0.0';
212
- }
213
- }
214
-
215
- function findPackageJson(): string | null {
216
- let dir = path.dirname(fileURLToPath(import.meta.url));
217
- for (let i = 0; i < 8; i += 1) {
218
- const candidate = path.join(dir, 'package.json');
219
- try {
220
- const data = JSON.parse(fs.readFileSync(candidate, 'utf8')) as { name?: unknown };
221
- if (data.name === PLUGIN_PACKAGE) return candidate;
222
- } catch {}
223
- const parent = path.dirname(dir);
224
- if (parent === dir) break;
225
- dir = parent;
226
- }
227
- return null;
228
- }
229
-
230
- function readOpenagentConfig(): Record<string, unknown> {
231
- const stateDir = process.env.OPENCLAW_STATE_DIR || path.join(os.homedir(), '.openclaw');
232
- const configPath = path.join(stateDir, 'openclaw.json');
233
- try {
234
- const root = JSON.parse(fs.readFileSync(configPath, 'utf8')) as {
235
- channels?: { openagent?: Record<string, unknown> };
236
- };
237
- return root.channels?.openagent || {};
238
- } catch {
239
- return {};
240
- }
241
- }
242
-
243
- function readString(obj: Record<string, unknown>, ...keys: string[]): string {
244
- for (const key of keys) {
245
- const value = obj[key];
246
- if (typeof value === 'string' && value.trim()) return value.trim();
247
- if (typeof value === 'boolean') return value ? 'true' : 'false';
248
- }
249
- return '';
250
- }
251
-
252
- function readBool(value: unknown): boolean | null {
253
- if (typeof value === 'boolean') return value;
254
- const text = typeof value === 'string' ? value.trim().toLowerCase() : '';
255
- if (!text) return null;
256
- if (['1', 'true', 'yes', 'on', 'auto'].includes(text)) return true;
257
- if (['0', 'false', 'no', 'off', 'notify'].includes(text)) return false;
258
- return null;
259
- }
260
-
261
- function normalizePolicy(value: unknown): OpenagentUpdatePolicy | '' {
262
- const text = typeof value === 'string' ? value.trim().toLowerCase() : '';
263
- if (text === 'auto' || text === 'notify' || text === 'off') return text;
264
- return '';
265
- }
266
-
267
- function normalizeDistTag(value: unknown): string {
268
- const text = typeof value === 'string' ? value.trim() : '';
269
- if (!text) return '';
270
- return /^[A-Za-z0-9._-]+$/.test(text) ? text : '';
271
- }
272
-
273
- export function compareVersions(a: string, b: string): number {
274
- const pa = parseVersion(a);
275
- const pb = parseVersion(b);
276
- for (let i = 0; i < 3; i += 1) {
277
- if (pa[i] !== pb[i]) return pa[i] - pb[i];
278
- }
279
- return 0;
280
- }
281
-
282
- function parseVersion(version: string): [number, number, number] {
283
- const match = String(version || '').match(/(\d+)\.(\d+)\.(\d+)/);
284
- if (!match) return [0, 0, 0];
285
- return [Number(match[1]), Number(match[2]), Number(match[3])];
286
- }
@@ -1,143 +0,0 @@
1
- # @tencentcloud/chat SDK v3.6.6 — Code Structure Map
2
-
3
- > Annotated and formatted for readability. Logic 100% preserved from ESM distribution.
4
-
5
- ## Quick Navigation
6
-
7
- ### Core Infrastructure
8
-
9
- | Class | Module Name | Lines | Size | Purpose |
10
- |-------|-------------|-------|------|---------|
11
- | `s` | — | L157-181 | 25 | Middleware chain |
12
- | `i` | — | L182-202 | 21 | Uint64 implementation |
13
- | `ni` | — (extends Error) | L3227-3243 | 17 | SDK custom error |
14
- | `ui` | — | L3381-3460 | 80 | **Module base class** (all `extends ui` inherit this) |
15
- | `Mo` | **SocketHandler** | L18135-18685 | **551** | WebSocket connection, reconnection, heartbeat |
16
- | `To` | **PHandler** | L18964-22460 | **3497** | Protocol handler — frame serialize/deserialize |
17
- | `vo` | **MsgDispatcher** | L22462-22797 | 336 | Routes incoming WS messages to modules |
18
- | `Pr` | **ModuleManager** | L27279-27690 | 412 | Central registry — instantiates all modules |
19
- | `Gr` | — | L27770-28854 | 1085 | **Main SDK class** (TencentCloudChat instance) |
20
-
21
- ### Messaging
22
-
23
- | Class | Module Name | Lines | Size | Purpose |
24
- |-------|-------------|-------|------|---------|
25
- | `Qi` | **C2CModule** | L5031-5896 | 866 | One-to-one private chat |
26
- | `tn` | **MsgListHandler** | L5904-6342 | 439 | Message list storage & pagination |
27
- | `Xn` | **MessageModule** | L15343-16350 | **1008** | Core message create/send/receive |
28
- | `Yn` | MergerMessageHandler | L15076-15312 | 237 | Combined message handling |
29
- | `Zn` | MsgExtModule | L16351-16752 | 402 | Message extensions |
30
- | `Qn` | MsgReactionModule | L16753-17172 | 420 | Message reactions (emoji) |
31
- | `eo` | ComboMsgModule | L17173-17370 | 198 | Combo message handling |
32
- | `so` | SyncUnreadMsgModule | L17392-17499 | 108 | Unread message sync |
33
-
34
- ### Conversations
35
-
36
- | Class | Module Name | Lines | Size | Purpose |
37
- |-------|-------------|-------|------|---------|
38
- | `fn` | MsgRemindHandler | L6873-7134 | 262 | Message notification settings |
39
- | `Mn` | **ConvGroupHandler** | L7135-8124 | 990 | Conversation group (folder) management |
40
- | `In` | **ConvModule** | L8125-10961 | **2837** | Conversation list, unread counts |
41
-
42
- ### Groups & Topics
43
-
44
- | Class | Module Name | Lines | Size | Purpose |
45
- |-------|-------------|-------|------|---------|
46
- | `vn` | TopicModule | L11067-11768 | 702 | Community topic (sub-channel) |
47
- | `Co` | ChannelModule | L18745-18963 | 219 | Channel/Room messaging |
48
-
49
- ### User & Profile
50
-
51
- | Class | Module Name | Lines | Size | Purpose |
52
- |-------|-------------|-------|------|---------|
53
- | `Sn` | ProfileHandler | L11769-12222 | 454 | User profile management |
54
- | `Dn` | BlacklistHandler | L12231-12384 | 154 | Blocklist |
55
- | `Ln` | UserStatusHandler | L12400-12669 | 270 | Online/offline status |
56
- | `An` | UserModule | L12670-12798 | 129 | User operations |
57
-
58
- ### Auth & Session
59
-
60
- | Class | Module Name | Lines | Size | Purpose |
61
- |-------|-------------|-------|------|---------|
62
- | `Pn` | SignModule | L13042-13354 | 313 | Authentication signing |
63
- | `Lo` | **SessionModule** | L22904-23260 | 357 | Login/logout lifecycle |
64
-
65
- ### Upload & Media
66
-
67
- | Class | Module Name | Lines | Size | Purpose |
68
- |-------|-------------|-------|------|---------|
69
- | `Wn` | **UploadModule** | L14043-15075 | 1033 | File/image/video upload to COS |
70
-
71
- ### Quality & Monitoring
72
-
73
- | Class | Module Name | Lines | Size | Purpose |
74
- |-------|-------------|-------|------|---------|
75
- | `Di` | SSOLogData | L3666-3812 | 147 | SSO log entry |
76
- | `bn` | EventStatModule | L13576-13703 | 128 | Event statistics |
77
- | `qn` | NetMonitorModule | L13706-13823 | 118 | Network monitoring |
78
- | `No` | AvgE2EDelay | L23620-23707 | 88 | End-to-end delay metric |
79
- | `Po` | AvgRTT | L23708-23774 | 67 | Round-trip time metric |
80
- | `ko` | QualityStatModule | L24015-24226 | 212 | Quality statistics |
81
- | `wo` | WorkerTimerModule | L24227-24298 | 72 | Web Worker timer |
82
-
83
- ### Plugins & Extensions
84
-
85
- | Class | Module Name | Lines | Size | Purpose |
86
- |-------|-------------|-------|------|---------|
87
- | `to` | PluginModule | L17371-17391 | 21 | Plugin registration |
88
- | `bo` | PurchasedFeatureHandler | L24299-24401 | 103 | Feature gating |
89
- | `Fo` | CommercialConfigModule | L24402-24500 | 99 | Commercial config |
90
- | `qo` | TIMPushModule | L24767-25114 | 348 | Push notifications |
91
- | `xo` | ProfanityFilterModule | L25115-25321 | 207 | Content moderation |
92
- | `Ao` | CloudControlModule | L23261-23383 | 123 | Cloud config |
93
- | `Gn` | StorageModule | L13358-13531 | 174 | Local storage |
94
-
95
- ### Other
96
-
97
- | Class | Module Name | Lines | Size | Purpose |
98
- |-------|-------------|-------|------|---------|
99
- | `Oo` | RecoverMsgModule | L23384-23619 | 236 | Message recovery |
100
- | `Vo` | TransCmdModule | L25322-25398 | 77 | Translation commands |
101
- | `Bo` | ErrMsgModule | L25399-25568 | 170 | Error message mapping |
102
- | `Nr` | InflateModule | L27240-27278 | 39 | Data decompression |
103
- | `Ur` | SafetyCallback | L27691-27769 | 79 | Safe callback wrapper |
104
-
105
- ---
106
-
107
- ## Key Top-Level Variables
108
-
109
- | Variable | Lines | Size | Purpose |
110
- |----------|-------|------|---------|
111
- | `e` | L1-39 | 39 | **EVENT** enum — all SDK event names |
112
- | `t` | L40-156 | 117 | **TYPES** enum — message/group/conversation types |
113
- | `n` | L203-317 | 115 | WebSocket server addresses by region |
114
- | `o` | L318-333 | 16 | Platform IDs |
115
- | `r` | L334 | 1 | SDK version: `"1.7.3"` |
116
- | `a` | L335 | 1 | Build number: `537048168` |
117
- | `f` | L345-392 | 48 | Server host config (current host, service names) |
118
- | `M` | L393-412 | 20 | Feature capability bitfields |
119
- | `Ee` | L563-643 | 81 | **Logger** (d/l/i/w/e methods, level control) |
120
- | `Ts` | L1453-3035 | **1583** | **API command definitions** (wslogin, sendmsg, etc.) |
121
- | `ys` | L3036-3186 | 151 | **Error codes** (NO_SDKAPPID, NETWORK_TIMEOUT, etc.) |
122
- | `dr` | L26129-26948 | 820 | **SDK factory** — creates TencentCloudChat instances |
123
-
124
- ## Key Patch Points
125
-
126
- | Line | Content | Clawlink Usage |
127
- |------|---------|----------------|
128
- | L514 | `globalThis.__CLAWLINK_SDK_LOGGER` | Logger injection — redirects SDK logs to file |
129
- | L18135 | `class Mo` (SocketHandler) | WebSocket timeout/reconnect behavior |
130
- | L18148 | `MAX_RECONNECT_COUNT = 3` | Max reconnection attempts |
131
- | L5031 | `class Qi` (C2CModule) | Private messaging logic |
132
-
133
- ---
134
-
135
- ## External Modules (in `modules/` directory)
136
-
137
- | File | Formatted Lines | Classes | Purpose |
138
- |------|-----------------|---------|---------|
139
- | `group-module.js` | 6,078 | 28 | Group create/join/quit/update + member mgmt |
140
- | `relationship-module.js` | 1,981 | 11 | Friend add/delete/check + friend groups |
141
- | `signaling-module.js` | 1,272 | 7 | Invite/accept/reject signaling |
142
- | `cloud-search-module.js` | 999 | 5 | Cloud message/group/user search |
143
- | `follow-module.js` | 935 | 4 | Follow/unfollow user relationships |
@@ -1,126 +0,0 @@
1
- /**
2
- * Type declarations for the bundled TIM SDK (src/sdk/index.js)
3
- *
4
- * The SDK is a modified copy of @tencentcloud/chat without TS declarations.
5
- * This file provides the minimal type surface used by openagent.
6
- */
7
-
8
- interface ChatInstance {
9
- setLogLevel(level: number): void;
10
- login(options: { userID: string; userSig: string }): Promise<void>;
11
- logout(): Promise<void>;
12
- on(event: string, handler: (...args: unknown[]) => void): void;
13
- off(event: string, handler: (...args: unknown[]) => void): void;
14
-
15
- // Messaging
16
- createTextMessage(options: {
17
- to: string;
18
- conversationType: string;
19
- payload: { text: string };
20
- }): unknown;
21
- createTextAtMessage(options: {
22
- to: string;
23
- conversationType: string;
24
- payload: { text: string; atUserList: string[] };
25
- }): unknown;
26
- createCustomMessage(options: {
27
- to: string;
28
- conversationType: string;
29
- payload: { data: string; description: string; extension: string };
30
- }): unknown;
31
- // T4: File message for C2C file transfer
32
- createFileMessage(options: {
33
- to: string;
34
- conversationType: string;
35
- payload: { file: File };
36
- onProgress?: (event: { percent: number }) => void;
37
- }): unknown;
38
- sendMessage(message: unknown): Promise<{ data?: { message?: { ID?: string } } }>;
39
- getMessageList(options: {
40
- conversationID: string;
41
- count: number;
42
- }): Promise<{
43
- data?: {
44
- messageList?: Array<{
45
- ID?: string;
46
- from?: string;
47
- type?: string;
48
- payload?: { text?: string };
49
- time?: number;
50
- sequence?: number;
51
- }>;
52
- };
53
- }>;
54
-
55
- // Groups
56
- getGroupList(): Promise<{
57
- data?: {
58
- groupList?: Array<{
59
- groupID: string;
60
- name: string;
61
- introduction?: string;
62
- }>;
63
- };
64
- }>;
65
- joinGroup(options: { groupID: string }): Promise<void>;
66
- quitGroup(groupID: string): Promise<void>;
67
- getGroupMemberList(options: {
68
- groupID: string;
69
- count: number;
70
- offset: number;
71
- }): Promise<{
72
- data?: {
73
- memberList?: Array<{
74
- userID: string;
75
- nick?: string;
76
- role?: string;
77
- avatar?: string;
78
- }>;
79
- };
80
- }>;
81
- createGroup(options: {
82
- type: string;
83
- name: string;
84
- groupID?: string;
85
- introduction?: string;
86
- notification?: string;
87
- joinOption?: string;
88
- isSupportTopic?: boolean;
89
- }): Promise<{ data?: { group?: { groupID?: string } } }>;
90
- getGroupProfile(options: {
91
- groupID: string;
92
- groupCustomFieldFilter?: string[];
93
- }): Promise<{
94
- data?: { group?: { notification?: string } };
95
- }>;
96
- updateGroupProfile(options: {
97
- groupID: string;
98
- notification?: string;
99
- }): Promise<void>;
100
- getConversationProfile(conversationID: string): Promise<unknown>;
101
- // T4: Plugin registration for tim-upload-plugin
102
- registerPlugin(plugins: Record<string, unknown>): void;
103
- }
104
-
105
- interface TencentCloudChatStatic {
106
- create(options: { SDKAppID: number; modules?: Record<string, unknown> }): ChatInstance;
107
- EVENT: {
108
- SDK_READY: string;
109
- SDK_NOT_READY: string;
110
- KICKED_OUT: string;
111
- MESSAGE_RECEIVED: string;
112
- };
113
- TYPES: {
114
- CONV_GROUP: string;
115
- CONV_C2C: string;
116
- MSG_TEXT: string;
117
- MSG_AT_ALL: string;
118
- MSG_FILE: string;
119
- GRP_PUBLIC: string;
120
- GRP_COMMUNITY: string;
121
- JOIN_OPTIONS_FREE_ACCESS: string;
122
- };
123
- }
124
-
125
- declare const TencentCloudChat: TencentCloudChatStatic;
126
- export default TencentCloudChat;