@tencent-rtc/mcp 1.7.6 → 1.7.7
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/CHANGELOG.md +5 -0
- package/README.md +5 -0
- package/index.js +23 -1
- package/package.json +1 -1
- package/resource/index/manifest.json +1 -1
- package/server-config.js +20 -6
- package/server.js +1 -1
- package/utils/normalize-error.js +13 -0
- package/utils/report-cls-client.js +2 -2
- package/utils/report-es-client.js +1 -1
package/server-config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reportESClient } from './utils/report-es-client.js';
|
|
2
|
+
import { reportCLSClient } from './utils/report-cls-client.js';
|
|
2
3
|
import { isValidSDKAppID } from './utils/is-valid-sdkappid.js';
|
|
3
4
|
import { getDeviceIdentifier } from './utils/get-device-identifier.js';
|
|
4
5
|
class ServerConfig {
|
|
@@ -16,17 +17,30 @@ class ServerConfig {
|
|
|
16
17
|
parseEnvConfig() {
|
|
17
18
|
const config = {};
|
|
18
19
|
const { SDKAPPID, SECRETKEY } = process.env || {};
|
|
19
|
-
if (SDKAPPID) {
|
|
20
|
+
if (SDKAPPID && isValidSDKAppID(SDKAPPID)) {
|
|
20
21
|
config.SDKAppID = SDKAPPID;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
method: 'mcp_config'
|
|
26
|
-
});
|
|
23
|
+
else {
|
|
24
|
+
config.SDKAppID = `${getDeviceIdentifier()}:en`;
|
|
25
|
+
}
|
|
27
26
|
if (SECRETKEY) {
|
|
28
27
|
config.secretKey = SECRETKEY;
|
|
29
28
|
}
|
|
29
|
+
try {
|
|
30
|
+
reportESClient({
|
|
31
|
+
SDKAppID: config.SDKAppID,
|
|
32
|
+
method: 'mcp_config'
|
|
33
|
+
});
|
|
34
|
+
reportCLSClient({
|
|
35
|
+
SDKAppID: config.SDKAppID,
|
|
36
|
+
method: 'mcp_server_config',
|
|
37
|
+
from: 'stdio',
|
|
38
|
+
info: JSON.stringify({
|
|
39
|
+
status: 'success',
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch { }
|
|
30
44
|
return config;
|
|
31
45
|
}
|
|
32
46
|
getConfig() {
|
package/server.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function normalizeError(error) {
|
|
2
|
+
if (error instanceof Error) {
|
|
3
|
+
return {
|
|
4
|
+
error_code: error.name || 'Error',
|
|
5
|
+
error_msg: error.message?.slice(0, 256) || 'Unknown error',
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
error_code: 'UnknownError',
|
|
10
|
+
error_msg: String(error).slice(0, 256),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export { normalizeError, };
|
|
@@ -22,13 +22,13 @@ function reportCLSClient(reportData) {
|
|
|
22
22
|
sendCLSReport(reportData);
|
|
23
23
|
}
|
|
24
24
|
function sendCLSReport(reportData) {
|
|
25
|
-
const
|
|
25
|
+
const _SDKAppID = reportData.SDKAppID ? reportData.SDKAppID : ServerConfig.getInstance().getConfig()?.SDKAppID;
|
|
26
26
|
const { SDKAppID = _SDKAppID, method = '', userID = '', framework = '', product = '', prompt = '', queryID = '', answer = '', feedback = '', info = '', ide = '', from = '', } = reportData;
|
|
27
27
|
const identifier = getDeviceIdentifier();
|
|
28
28
|
const time = Date.now();
|
|
29
29
|
const data = {
|
|
30
30
|
platform: 'mcp',
|
|
31
|
-
verison: '1.7.
|
|
31
|
+
verison: '1.7.7',
|
|
32
32
|
sdkappid: `${SDKAppID}`,
|
|
33
33
|
method: method,
|
|
34
34
|
userid: queryID || userID,
|