claw_messenger 0.0.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/README.md +111 -0
- package/bin/auto-init.js +98 -0
- package/bin/dm-bridge.js +12 -0
- package/bin/install.js +217 -0
- package/bin/setup.js +160 -0
- package/bridge-runner.ts +324 -0
- package/dist/bridge-runner.d.ts +2 -0
- package/dist/bridge-runner.d.ts.map +1 -0
- package/dist/bridge-runner.js +268 -0
- package/dist/bridge-runner.js.map +1 -0
- package/dist/src/auto-register.d.ts +2 -0
- package/dist/src/auto-register.d.ts.map +1 -0
- package/dist/src/auto-register.js +82 -0
- package/dist/src/auto-register.js.map +1 -0
- package/dist/src/env-polyfill.d.ts +8 -0
- package/dist/src/env-polyfill.d.ts.map +1 -0
- package/dist/src/env-polyfill.js +101 -0
- package/dist/src/env-polyfill.js.map +1 -0
- package/dist/src/index.d.ts +36 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +75 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/plugin-entry.d.ts +9 -0
- package/dist/src/plugin-entry.d.ts.map +1 -0
- package/dist/src/plugin-entry.js +174 -0
- package/dist/src/plugin-entry.js.map +1 -0
- package/dist/src/rongcloud-client.d.ts +21 -0
- package/dist/src/rongcloud-client.d.ts.map +1 -0
- package/dist/src/rongcloud-client.js +87 -0
- package/dist/src/rongcloud-client.js.map +1 -0
- package/dist/test-bridge.js +81 -0
- package/dist/test-connection.js +65 -0
- package/dist/test-mock.js +72 -0
- package/openclaw.plugin.json +24 -0
- package/package.json +88 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 自动注册模块
|
|
3
|
+
* 从服务端获取融云 Token
|
|
4
|
+
*/
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
import * as crypto from 'crypto';
|
|
7
|
+
import * as os from 'os';
|
|
8
|
+
import * as path from 'path';
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
const SERVER_URL = process.env.DM_SERVER_URL || 'https://newsradar.dreamdt.cn/im';
|
|
11
|
+
const CONFIG_DIR = path.join(os.homedir(), '.claw-bridge');
|
|
12
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
13
|
+
function generateNodeId() {
|
|
14
|
+
const random = crypto.randomBytes(3).toString('hex');
|
|
15
|
+
return `claw_${random}`;
|
|
16
|
+
}
|
|
17
|
+
async function loadConfig() {
|
|
18
|
+
try {
|
|
19
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
20
|
+
const content = fs.readFileSync(CONFIG_FILE, 'utf-8');
|
|
21
|
+
return JSON.parse(content);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch { }
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
async function saveConfig(config) {
|
|
28
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
29
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), 'utf-8');
|
|
32
|
+
}
|
|
33
|
+
async function registerNode(nodeName) {
|
|
34
|
+
const nodeId = generateNodeId();
|
|
35
|
+
console.log(`[AutoRegister] 正在注册节点:${nodeId}...`);
|
|
36
|
+
try {
|
|
37
|
+
const resp = await axios.post(`${SERVER_URL}/api/claw/register`, {
|
|
38
|
+
node_id: nodeId,
|
|
39
|
+
name: nodeName,
|
|
40
|
+
}, { timeout: 10000 });
|
|
41
|
+
if (resp.data?.code === 200 || resp.data?.code === 409) {
|
|
42
|
+
const tokenResp = await axios.get(`${SERVER_URL}/api/claw/token/${nodeId}`, { timeout: 10000 });
|
|
43
|
+
if (tokenResp.data?.code === 200) {
|
|
44
|
+
return {
|
|
45
|
+
nodeId,
|
|
46
|
+
token: tokenResp.data.data.token,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
console.error('[AutoRegister] 注册失败:', resp.data?.message || '未知错误');
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
console.error('[AutoRegister] 注册异常:', err.message);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export async function getOrRegisterToken(nodeName) {
|
|
59
|
+
// 1. 尝试加载已有配置
|
|
60
|
+
let config = await loadConfig();
|
|
61
|
+
if (config) {
|
|
62
|
+
console.log(`[AutoRegister] 使用已有节点:${config.nodeName} (${config.nodeId})`);
|
|
63
|
+
return config.token;
|
|
64
|
+
}
|
|
65
|
+
// 2. 如果没有配置,使用提供的昵称或默认值
|
|
66
|
+
const name = nodeName || `OpenClaw-${crypto.randomBytes(2).toString('hex')}`;
|
|
67
|
+
console.log(`[AutoRegister] 首次使用,正在注册节点:${name}...`);
|
|
68
|
+
const result = await registerNode(name);
|
|
69
|
+
if (!result) {
|
|
70
|
+
throw new Error('自动注册失败,请检查网络连接或服务端状态');
|
|
71
|
+
}
|
|
72
|
+
config = {
|
|
73
|
+
nodeId: result.nodeId,
|
|
74
|
+
nodeName: name,
|
|
75
|
+
token: result.token,
|
|
76
|
+
createdAt: new Date().toISOString(),
|
|
77
|
+
};
|
|
78
|
+
await saveConfig(config);
|
|
79
|
+
console.log(`[AutoRegister] 注册成功!节点 ID: ${result.nodeId}`);
|
|
80
|
+
return result.token;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=auto-register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-register.js","sourceRoot":"","sources":["../../src/auto-register.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC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,GAAG,QAAQ,IAAI,YAAY,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,KAAK,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAExC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,GAAG;QACP,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;IAEF,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,8BAA8B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-polyfill.d.ts","sourceRoot":"","sources":["../../src/env-polyfill.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,qBAAqB,CAAC;AAe7B,QAAA,MAAQ,MAAM,2BAAQ,CAAC;AAoFvB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 环境模拟 (Polyfill)
|
|
3
|
+
* 让融云 Web SDK (@rongcloud/imlib-next) 能在 Node.js 环境中运行
|
|
4
|
+
*/
|
|
5
|
+
// 1. 必须最先引入,注入 indexedDB
|
|
6
|
+
import 'fake-indexeddb/auto';
|
|
7
|
+
import { JSDOM } from 'jsdom';
|
|
8
|
+
import WebSocket from 'ws';
|
|
9
|
+
import { Blob, File } from 'node:buffer';
|
|
10
|
+
import crypto from 'crypto';
|
|
11
|
+
// 2. 初始化 JSDOM
|
|
12
|
+
const dom = new JSDOM('<!DOCTYPE html><html><body></body></html>', {
|
|
13
|
+
url: 'http://localhost',
|
|
14
|
+
pretendToBeVisual: true,
|
|
15
|
+
resources: 'usable',
|
|
16
|
+
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
|
17
|
+
});
|
|
18
|
+
const { window } = dom;
|
|
19
|
+
const g = global;
|
|
20
|
+
const win = window;
|
|
21
|
+
// 3. 辅助函数:安全定义属性
|
|
22
|
+
const defineWinProp = (key, value) => {
|
|
23
|
+
try {
|
|
24
|
+
Object.defineProperty(win, key, {
|
|
25
|
+
value: value,
|
|
26
|
+
writable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
enumerable: true
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (e) { /* ignore */ }
|
|
32
|
+
};
|
|
33
|
+
const defineGlobalProp = (key, value) => {
|
|
34
|
+
try {
|
|
35
|
+
Object.defineProperty(g, key, {
|
|
36
|
+
value: value,
|
|
37
|
+
writable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
enumerable: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (e) { /* ignore */ }
|
|
43
|
+
};
|
|
44
|
+
// 4. 注入 IndexedDB 到 window (关键)
|
|
45
|
+
if (g.indexedDB) {
|
|
46
|
+
defineWinProp('indexedDB', g.indexedDB);
|
|
47
|
+
defineWinProp('IDBKeyRange', g.IDBKeyRange);
|
|
48
|
+
defineWinProp('IDBRequest', g.IDBRequest);
|
|
49
|
+
defineWinProp('IDBDatabase', g.IDBDatabase);
|
|
50
|
+
defineWinProp('IDBTransaction', g.IDBTransaction);
|
|
51
|
+
defineWinProp('IDBCursor', g.IDBCursor);
|
|
52
|
+
defineWinProp('IDBIndex', g.IDBIndex);
|
|
53
|
+
defineWinProp('IDBFactory', g.IDBFactory);
|
|
54
|
+
console.log('[Polyfill] indexedDB 已注入 window');
|
|
55
|
+
}
|
|
56
|
+
// 5. 注入 Storage (SDK 可能检查 window.localStorage)
|
|
57
|
+
const storageMock = {
|
|
58
|
+
getItem: (k) => null,
|
|
59
|
+
setItem: (k, v) => { },
|
|
60
|
+
removeItem: (k) => { },
|
|
61
|
+
clear: () => { },
|
|
62
|
+
length: 0,
|
|
63
|
+
key: (i) => null
|
|
64
|
+
};
|
|
65
|
+
defineWinProp('localStorage', storageMock);
|
|
66
|
+
defineWinProp('sessionStorage', storageMock);
|
|
67
|
+
defineGlobalProp('localStorage', storageMock);
|
|
68
|
+
defineGlobalProp('sessionStorage', storageMock);
|
|
69
|
+
// 6. 注入 Crypto (关键:Web Crypto API)
|
|
70
|
+
if (!win.crypto) {
|
|
71
|
+
defineWinProp('crypto', crypto.webcrypto);
|
|
72
|
+
}
|
|
73
|
+
if (!g.crypto) {
|
|
74
|
+
defineGlobalProp('crypto', crypto.webcrypto);
|
|
75
|
+
}
|
|
76
|
+
// 7. 注入 Navigator 属性
|
|
77
|
+
defineWinProp('onLine', true);
|
|
78
|
+
defineWinProp('language', 'zh-CN');
|
|
79
|
+
defineGlobalProp('navigator', win.navigator);
|
|
80
|
+
// 8. 注入网络相关
|
|
81
|
+
defineGlobalProp('WebSocket', WebSocket);
|
|
82
|
+
defineGlobalProp('XMLHttpRequest', win.XMLHttpRequest);
|
|
83
|
+
defineGlobalProp('window', win);
|
|
84
|
+
defineGlobalProp('document', win.document);
|
|
85
|
+
defineGlobalProp('location', win.location);
|
|
86
|
+
// 9. 注入文件相关 (SDK 发送图片/文件时需要)
|
|
87
|
+
if (!win.Blob)
|
|
88
|
+
defineWinProp('Blob', Blob);
|
|
89
|
+
if (!win.File)
|
|
90
|
+
defineWinProp('File', File);
|
|
91
|
+
if (!win.URL)
|
|
92
|
+
defineWinProp('URL', { createObjectURL: () => '', revokeObjectURL: () => { } });
|
|
93
|
+
// 10. 其他常用 API
|
|
94
|
+
if (!win.requestAnimationFrame)
|
|
95
|
+
defineWinProp('requestAnimationFrame', (cb) => setTimeout(cb, 16));
|
|
96
|
+
if (!win.cancelAnimationFrame)
|
|
97
|
+
defineWinProp('cancelAnimationFrame', (id) => clearTimeout(id));
|
|
98
|
+
if (!win.performance)
|
|
99
|
+
defineWinProp('performance', { now: () => Date.now() });
|
|
100
|
+
export { window };
|
|
101
|
+
//# sourceMappingURL=env-polyfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-polyfill.js","sourceRoot":"","sources":["../../src/env-polyfill.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yBAAyB;AACzB,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,eAAe;AACf,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,2CAA2C,EAAE;IACjE,GAAG,EAAE,kBAAkB;IACvB,iBAAiB,EAAE,IAAI;IACvB,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,iHAAiH;CAC7H,CAAC,CAAC;AAEH,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;AACvB,MAAM,CAAC,GAAG,MAAa,CAAC;AACxB,MAAM,GAAG,GAAG,MAAa,CAAC;AAE1B,iBAAiB;AACjB,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;IAC9C,IAAI,CAAC;QACD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;YAC5B,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;IAAC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EAAE,IAAI,CAAC,CAAC;AAC3C,IAAI,CAAC,GAAG,CAAC,GAAG;IAAE,aAAa,CAAC,KAAK,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;AAE7F,eAAe;AACf,IAAI,CAAC,GAAG,CAAC,qBAAqB;IAAE,aAAa,CAAC,uBAAuB,EAAE,CAAC,EAAO,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACxG,IAAI,CAAC,GAAG,CAAC,oBAAoB;IAAE,aAAa,CAAC,sBAAsB,EAAE,CAAC,EAAO,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;AACpG,IAAI,CAAC,GAAG,CAAC,WAAW;IAAE,aAAa,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface OpenClawChannel {
|
|
2
|
+
name: string;
|
|
3
|
+
initialize(config: any): Promise<void>;
|
|
4
|
+
onMessage(handler: (msg: any) => void): void;
|
|
5
|
+
sendMessage(to: string, content: string, metadata: any): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class RongCloudChannel implements OpenClawChannel {
|
|
8
|
+
name: string;
|
|
9
|
+
private client;
|
|
10
|
+
private messageHandler;
|
|
11
|
+
private config;
|
|
12
|
+
/**
|
|
13
|
+
* 初始化插件
|
|
14
|
+
* @param config 配置项,包含 appKey, token 等
|
|
15
|
+
*/
|
|
16
|
+
initialize(config: any): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* 注册消息监听器
|
|
19
|
+
* @param handler 消息处理函数
|
|
20
|
+
*/
|
|
21
|
+
onMessage(handler: (msg: any) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* 发送消息
|
|
24
|
+
* @param to 目标 ID
|
|
25
|
+
* @param content 内容
|
|
26
|
+
* @param metadata 元数据 (包含 conversationType 等)
|
|
27
|
+
*/
|
|
28
|
+
sendMessage(to: string, content: string, metadata: any): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* 格式化融云消息为 OpenClaw 标准格式
|
|
31
|
+
*/
|
|
32
|
+
private formatMessage;
|
|
33
|
+
}
|
|
34
|
+
declare const _default: RongCloudChannel;
|
|
35
|
+
export default _default;
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IAC7C,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,qBAAa,gBAAiB,YAAW,eAAe;IACtD,IAAI,SAAe;IACnB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,MAAM,CAAM;IAEpB;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB5C;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAI5C;;;;;OAKG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5E;;OAEG;IACH,OAAO,CAAC,aAAa;CActB;;AAGD,wBAAsC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw 插件入口
|
|
3
|
+
* 实现 OpenClaw 的 Channel 接口
|
|
4
|
+
*/
|
|
5
|
+
import { RongCloudClient } from './rongcloud-client';
|
|
6
|
+
export class RongCloudChannel {
|
|
7
|
+
name = 'rongcloud';
|
|
8
|
+
client;
|
|
9
|
+
messageHandler = null;
|
|
10
|
+
config;
|
|
11
|
+
/**
|
|
12
|
+
* 初始化插件
|
|
13
|
+
* @param config 配置项,包含 appKey, token 等
|
|
14
|
+
*/
|
|
15
|
+
async initialize(config) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
console.log(`[RongCloudChannel] 初始化插件, AppKey: ${config.appKey}`);
|
|
18
|
+
this.client = new RongCloudClient({
|
|
19
|
+
appKey: config.appKey,
|
|
20
|
+
token: config.token,
|
|
21
|
+
onMessage: (msg) => {
|
|
22
|
+
// 收到融云消息,转换为 OpenClaw 格式并转发
|
|
23
|
+
if (this.messageHandler) {
|
|
24
|
+
this.messageHandler(this.formatMessage(msg));
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
onConnectSuccess: (userId) => {
|
|
28
|
+
console.log(`[RongCloudChannel] 融云连接成功, userId: ${userId}`);
|
|
29
|
+
},
|
|
30
|
+
onError: (code) => {
|
|
31
|
+
console.error(`[RongCloudChannel] 融云连接失败, code: ${code}`);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
// 连接融云
|
|
35
|
+
await this.client.connect();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 注册消息监听器
|
|
39
|
+
* @param handler 消息处理函数
|
|
40
|
+
*/
|
|
41
|
+
onMessage(handler) {
|
|
42
|
+
this.messageHandler = handler;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 发送消息
|
|
46
|
+
* @param to 目标 ID
|
|
47
|
+
* @param content 内容
|
|
48
|
+
* @param metadata 元数据 (包含 conversationType 等)
|
|
49
|
+
*/
|
|
50
|
+
async sendMessage(to, content, metadata) {
|
|
51
|
+
const conversationType = metadata?.conversationType || 1;
|
|
52
|
+
console.log(`[RongCloudChannel] 准备发送消息 -> ${to}, Type: ${conversationType}`);
|
|
53
|
+
await this.client.sendMessage(to, content, conversationType);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 格式化融云消息为 OpenClaw 标准格式
|
|
57
|
+
*/
|
|
58
|
+
formatMessage(msg) {
|
|
59
|
+
return {
|
|
60
|
+
id: msg.messageUId,
|
|
61
|
+
from: msg.senderUserId,
|
|
62
|
+
content: msg.content?.content || '',
|
|
63
|
+
metadata: {
|
|
64
|
+
conversationType: msg.conversationType,
|
|
65
|
+
targetId: msg.targetId,
|
|
66
|
+
timestamp: msg.sentTime,
|
|
67
|
+
// 保留原始消息对象供高级使用
|
|
68
|
+
raw: msg
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// 导出插件实例
|
|
74
|
+
export default new RongCloudChannel();
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAUrD,MAAM,OAAO,gBAAgB;IAC3B,IAAI,GAAG,WAAW,CAAC;IACX,MAAM,CAAmB;IACzB,cAAc,GAAgC,IAAI,CAAC;IACnD,MAAM,CAAM;IAEpB;;;OAGG;IACH,KAAK,CAAC,UAAU,CAAC,MAAW;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,qCAAqC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAElE,IAAI,C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O,IAAI,EAAE;YACnC,QAAQ,EAAE;gBACR,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;gBACtC,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,gBAAgB;gBAChB,GAAG,EAAE,GAAG;aACT;SACF,CAAC;IACJ,CAAC;CACF;AAED,SAAS;AACT,eAAe,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-entry.d.ts","sourceRoot":"","sources":["../../src/plugin-entry.ts"],"names":[],"mappings":"AAgIA,eAAO,MAAM,eAAe,EAAE,GAwC7B,CAAC;;;;;kBAQoB,GAAG;;AALzB,wBAoBE"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw Plugin Entry Point
|
|
3
|
+
* RongCloud IM Channel Plugin
|
|
4
|
+
*/
|
|
5
|
+
import { RongCloudClient } from './rongcloud-client';
|
|
6
|
+
import { getOrRegisterToken } from './auto-register';
|
|
7
|
+
import { exec } from 'child_process';
|
|
8
|
+
import { promisify } from 'util';
|
|
9
|
+
const execAsync = promisify(exec);
|
|
10
|
+
const DEFAULT_APP_KEY = process.env.DM_APP_KEY || 'bmdehs6pbyyks';
|
|
11
|
+
// 融云通道实现
|
|
12
|
+
class RongCloudChannelImpl {
|
|
13
|
+
client = null;
|
|
14
|
+
config = null;
|
|
15
|
+
initialized = false;
|
|
16
|
+
accountId = null;
|
|
17
|
+
messageHandler = null;
|
|
18
|
+
async initialize(config) {
|
|
19
|
+
if (this.initialized) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this.config = config;
|
|
23
|
+
const nodeName = config?.nodeName;
|
|
24
|
+
const token = await getOrRegisterToken(nodeName);
|
|
25
|
+
const appKey = DEFAULT_APP_KEY;
|
|
26
|
+
console.log(`[RongCloud] 初始化,AppKey: ${appKey}`);
|
|
27
|
+
this.client = new RongCloudClient({
|
|
28
|
+
appKey,
|
|
29
|
+
token,
|
|
30
|
+
onMessage: async (msg) => {
|
|
31
|
+
console.log('[RongCloud] 收到消息:', msg);
|
|
32
|
+
await this.handleMessage(msg);
|
|
33
|
+
},
|
|
34
|
+
onConnectSuccess: (userId) => {
|
|
35
|
+
console.log(`[RongCloud] 连接成功,userId: ${userId}`);
|
|
36
|
+
this.accountId = userId;
|
|
37
|
+
},
|
|
38
|
+
onError: (code) => {
|
|
39
|
+
console.error(`[RongCloud] 连接失败,code: ${code}`);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
await this.client.connect();
|
|
43
|
+
this.initialized = true;
|
|
44
|
+
}
|
|
45
|
+
async handleMessage(msg) {
|
|
46
|
+
if (msg.isOffLineMessage || msg.messageType !== 'RC:TxtMsg') {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!this.accountId || msg.senderUserId === this.accountId) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const content = msg.content?.content || '';
|
|
53
|
+
const fromUser = msg.senderUserId;
|
|
54
|
+
const targetId = msg.targetId;
|
|
55
|
+
const convType = msg.conversationType;
|
|
56
|
+
console.log(`[RongCloud] 处理消息 from=${fromUser}`);
|
|
57
|
+
try {
|
|
58
|
+
const reply = await this.callOpenClaw(content, fromUser);
|
|
59
|
+
console.log(`[RongCloud] AI 回复:${reply}`);
|
|
60
|
+
await this.client?.sendMessage(convType === 3 ? targetId : fromUser, reply, convType);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
console.error('[RongCloud] 处理失败:', err.message);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async callOpenClaw(message, fromUser) {
|
|
67
|
+
const sessionId = `rongcloud-${fromUser}-${Date.now()}`;
|
|
68
|
+
try {
|
|
69
|
+
// 不使用 --deliver,直接获取 AI 响应
|
|
70
|
+
const isWindows = process.platform === 'win32';
|
|
71
|
+
const cmd = isWindows
|
|
72
|
+
? `cmd /c openclaw agent -m "${message.replace(/"/g, '\\"')}" --session-id ${sessionId}`
|
|
73
|
+
: `openclaw agent -m "${message.replace(/"/g, '\\"')}" --session-id ${sessionId}`;
|
|
74
|
+
const { stdout, stderr } = await execAsync(cmd, {
|
|
75
|
+
timeout: 120000,
|
|
76
|
+
maxBuffer: 1024 * 1024,
|
|
77
|
+
});
|
|
78
|
+
const output = stdout || stderr || '';
|
|
79
|
+
const cleanOutput = output
|
|
80
|
+
.split('\n')
|
|
81
|
+
.filter(line => !line.includes('[plugins]'))
|
|
82
|
+
.map(line => line.replace(/\x1B\[[0-9;]*m/g, '').trim())
|
|
83
|
+
.filter(line => line.length > 0)
|
|
84
|
+
.join('\n');
|
|
85
|
+
return cleanOutput || 'OpenClaw 未返回有效响应';
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
if (err.killed)
|
|
89
|
+
return 'OpenClaw 响应超时';
|
|
90
|
+
if (err.code === 'ENOENT')
|
|
91
|
+
return '找不到 openclaw 命令';
|
|
92
|
+
console.error('[RongCloud] OpenClaw 调用失败:', err.message);
|
|
93
|
+
return 'OpenClaw 处理失败';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async sendMessage(to, content, metadata) {
|
|
97
|
+
if (!this.client && !this.initialized) {
|
|
98
|
+
await this.initialize(this.config || {});
|
|
99
|
+
}
|
|
100
|
+
if (!this.client) {
|
|
101
|
+
throw new Error('RongCloud client not initialized');
|
|
102
|
+
}
|
|
103
|
+
const conversationType = metadata?.conversationType || 1;
|
|
104
|
+
await this.client.sendMessage(to, content, conversationType);
|
|
105
|
+
}
|
|
106
|
+
setOnMessageHandler(handler) {
|
|
107
|
+
this.messageHandler = handler;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const channelImpl = new RongCloudChannelImpl();
|
|
111
|
+
// OpenClaw Channel Plugin
|
|
112
|
+
export const rongCloudPlugin = {
|
|
113
|
+
id: 'claw_messenger',
|
|
114
|
+
meta: {
|
|
115
|
+
id: 'claw_messenger',
|
|
116
|
+
label: 'RongCloud',
|
|
117
|
+
selectionLabel: '融云 IM',
|
|
118
|
+
docsPath: '/channels/rongcloud',
|
|
119
|
+
docsLabel: 'RongCloud',
|
|
120
|
+
blurb: '融云 IM 直连通道插件',
|
|
121
|
+
order: 80,
|
|
122
|
+
},
|
|
123
|
+
configSchema: {
|
|
124
|
+
schema: {
|
|
125
|
+
type: 'object',
|
|
126
|
+
additionalProperties: false,
|
|
127
|
+
properties: {
|
|
128
|
+
nodeName: { type: 'string', label: '节点昵称' },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
config: {
|
|
133
|
+
listAccountIds: () => [],
|
|
134
|
+
resolveAccount: () => null,
|
|
135
|
+
isConfigured: () => false,
|
|
136
|
+
describeAccount: () => ({}),
|
|
137
|
+
},
|
|
138
|
+
messaging: {
|
|
139
|
+
targetResolver: {
|
|
140
|
+
looksLikeId: () => true,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
initialize: async (config) => {
|
|
144
|
+
await channelImpl.initialize(config);
|
|
145
|
+
},
|
|
146
|
+
sendMessage: async (to, content, metadata) => {
|
|
147
|
+
await channelImpl.sendMessage(to, content, metadata);
|
|
148
|
+
},
|
|
149
|
+
onMessage: (handler) => {
|
|
150
|
+
channelImpl.setOnMessageHandler(handler);
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
// OpenClaw Plugin Entry
|
|
154
|
+
export default {
|
|
155
|
+
id: 'claw_messenger',
|
|
156
|
+
name: 'claw_messenger',
|
|
157
|
+
description: '融云 IM 直连通道',
|
|
158
|
+
async register(api) {
|
|
159
|
+
console.log('[RongCloudPlugin] 插件已注册');
|
|
160
|
+
api.registerChannel({ plugin: rongCloudPlugin });
|
|
161
|
+
// 自动激活连接
|
|
162
|
+
setTimeout(async () => {
|
|
163
|
+
console.log('[RongCloudPlugin] 自动激活融云通道...');
|
|
164
|
+
try {
|
|
165
|
+
await channelImpl.initialize({});
|
|
166
|
+
console.log('[RongCloudPlugin] 融云通道已激活,等待消息...');
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
console.error('[RongCloudPlugin] 激活失败:', e);
|
|
170
|
+
}
|
|
171
|
+
}, 3000);
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=plugin-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-entry.js","sourceRoot":"","sources":["../../src/plugin-entry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAClC,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,eAAe,CAAC;AAElE,SAAS;AACT,MAAM,oBAAoB;IAChB,MAAM,GAA2B,IAAI,CAAC;IACtC,MAAM,GAAQ,IAAI,CAAC;IACnB,WAAW,GAAY,KAAK,CAAC;IAC7B,SAAS,GAAkB,IAAI,CAAC;IAChC,cAAc,GAAgC,IAAI,CAAC;IAE3D,KAAK,CAAC,UAAU,CAAC,MAAW;QAC1B,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,QAAQ,GAAG,MAAM,EAAE,QAAQ,CAAC;QAElC,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,eAAe,CAAC;QAE/B,OAAO,CAAC,GAAG,CAAC,2BAA2B,MAAM,EAAE,CAAC,CA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pB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,YAAY;IAEzB,KAAK,CAAC,QAAQ,CAAC,GAAQ;QACrB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QACvC,GAAG,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;QAEjD,SAAS;QACT,UAAU,CAAC,KAAK,IAAI,EAAE;YACpB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;YAC7C,IAAI,CAAC;gBACH,MAAM,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;YACnD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 融云客户端封装 (V5 SDK API)
|
|
3
|
+
*/
|
|
4
|
+
import './env-polyfill';
|
|
5
|
+
export interface RongCloudConfig {
|
|
6
|
+
appKey: string;
|
|
7
|
+
token: string;
|
|
8
|
+
onMessage: (msg: any) => void;
|
|
9
|
+
onConnectSuccess?: (userId: string) => void;
|
|
10
|
+
onError?: (code: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class RongCloudClient {
|
|
13
|
+
private config;
|
|
14
|
+
private isConnected;
|
|
15
|
+
private messageHandler;
|
|
16
|
+
constructor(config: RongCloudConfig);
|
|
17
|
+
setOnMessageHandler(handler: (msg: any) => void): void;
|
|
18
|
+
connect(): Promise<void>;
|
|
19
|
+
sendMessage(targetId: string, content: string, conversationType?: number): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=rongcloud-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rongcloud-client.d.ts","sourceRoot":"","sources":["../../src/rongcloud-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,gBAAgB,CAAC;AAaxB,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,cAAc,CAAqC;gBAE/C,MAAM,EAAE,eAAe;IAInC,mBAAmB,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAIhD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAsDxB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAsBlG"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 融云客户端封装 (V5 SDK API)
|
|
3
|
+
*/
|
|
4
|
+
import './env-polyfill';
|
|
5
|
+
import * as RongIMLibModule from '@rongcloud/imlib-next';
|
|
6
|
+
const RongIMLib = RongIMLibModule.default || RongIMLibModule;
|
|
7
|
+
console.log('[RongCloud] SDK 导入检查:', {
|
|
8
|
+
hasRongIMLib: !!RongIMLib,
|
|
9
|
+
hasInit: typeof RongIMLib?.init,
|
|
10
|
+
hasConnect: typeof RongIMLib?.connect,
|
|
11
|
+
hasAddEventListener: typeof RongIMLib?.addEventListener,
|
|
12
|
+
Events: RongIMLib?.Events,
|
|
13
|
+
});
|
|
14
|
+
export class RongCloudClient {
|
|
15
|
+
config;
|
|
16
|
+
isConnected = false;
|
|
17
|
+
messageHandler = null;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.config = config;
|
|
20
|
+
}
|
|
21
|
+
setOnMessageHandler(handler) {
|
|
22
|
+
this.messageHandler = handler;
|
|
23
|
+
}
|
|
24
|
+
async connect() {
|
|
25
|
+
return new Promise(async (resolve, reject) => {
|
|
26
|
+
try {
|
|
27
|
+
if (!RongIMLib || typeof RongIMLib.init !== 'function') {
|
|
28
|
+
throw new Error('融云 SDK 未正确加载');
|
|
29
|
+
}
|
|
30
|
+
console.log('[RongCloud] 初始化 SDK...');
|
|
31
|
+
RongIMLib.init({ appkey: this.config.appKey });
|
|
32
|
+
RongIMLib.addEventListener(RongIMLib.Events.MESSAGES, (event) => {
|
|
33
|
+
console.log('[RongCloud] 收到消息事件:', event);
|
|
34
|
+
event.messages?.forEach((msg) => {
|
|
35
|
+
console.log(`[RongCloud] 消息:${msg.senderUserId} -> ${msg.content?.content}`);
|
|
36
|
+
this.config.onMessage(msg);
|
|
37
|
+
if (this.messageHandler) {
|
|
38
|
+
this.messageHandler(msg);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
RongIMLib.addEventListener(RongIMLib.Events.CONNECTED, () => {
|
|
43
|
+
console.log('[RongCloud] 连接成功事件');
|
|
44
|
+
this.isConnected = true;
|
|
45
|
+
});
|
|
46
|
+
RongIMLib.addEventListener(RongIMLib.Events.DISCONNECT, (code) => {
|
|
47
|
+
console.warn(`[RongCloud] 断开连接, code: ${code}`);
|
|
48
|
+
this.isConnected = false;
|
|
49
|
+
});
|
|
50
|
+
console.log('[RongCloud] 正在连接...');
|
|
51
|
+
const result = await RongIMLib.connect(this.config.token);
|
|
52
|
+
console.log('[RongCloud] connect 结果:', result);
|
|
53
|
+
if (result.code === 0 || result.code === 200) {
|
|
54
|
+
const userId = result.data?.userId || 'unknown';
|
|
55
|
+
console.log(`[RongCloud] 登录成功, userId: ${userId}`);
|
|
56
|
+
this.isConnected = true;
|
|
57
|
+
this.config.onConnectSuccess?.(userId);
|
|
58
|
+
resolve();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.error(`[RongCloud] 登录失败, code: ${result.code}`);
|
|
62
|
+
this.config.onError?.(result.code);
|
|
63
|
+
reject(new Error(`Connect failed: ${result.code}`));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error('[RongCloud] 初始化异常:', error);
|
|
68
|
+
reject(error);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
async sendMessage(targetId, content, conversationType = 1) {
|
|
73
|
+
if (!this.isConnected) {
|
|
74
|
+
throw new Error('RongCloud client not connected');
|
|
75
|
+
}
|
|
76
|
+
const convType = conversationType === 3
|
|
77
|
+
? RongIMLib.ConversationType?.GROUP || 3
|
|
78
|
+
: RongIMLib.ConversationType?.PRIVATE || 1;
|
|
79
|
+
console.log(`[RongCloud] 发送消息 -> ${targetId} (Type: ${convType}): ${content}`);
|
|
80
|
+
const result = await RongIMLib.sendTextMessage({ conversationType: convType, targetId }, { content });
|
|
81
|
+
console.log('[RongCloud] 发送结果:', result);
|
|
82
|
+
if (result.code !== 0 && result.code !== 200) {
|
|
83
|
+
throw new Error(`Send failed: ${result.code}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=rongcloud-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rongcloud-client.js","sourceRoot":"","sources":["../../src/rongcloud-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,gBAAgB,CAAC;AACxB,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AAEzD,MAAM,SAAS,GAAS,eAAuB,CAAC,OAAO,IAAI,eAAe,CAAC;AAE3E,OAAO,CAAC,GAAG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