@lark-codem/codem-cli 0.1.274-test.202611170849.0.gc5a50ef → 0.1.274

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.
@@ -1,42 +1,42 @@
1
- import https from "node:https";
2
- import { gzip } from "node:zlib";
3
- import { promisify } from "node:util";
4
-
5
- // PC Custom Log / Custom Event wire format, verified against Parfait 1.7.0.0's
6
- // public IUploader callback. This is not the Slardar Web/BID protocol. Keep the
7
- // SDK capture fixture and the platform readback procedure with this adapter.
8
- export const SLARDAR_PC_AID = "1880";
9
- // Use the native envelope's four-part version convention in this legacy field.
10
- // This is our JS adapter version; reporter=codem_js distinguishes it
11
- // from the native Parfait SDK. Do not advertise a native SDK we do not run.
12
- export const SLARDAR_PC_REPORTER_VERSION = "1.0.0.0";
13
- const ENDPOINT = `https://pc-mon.zijieapi.com/monitor_pc/collect/api/pc_log?aid=${SLARDAR_PC_AID}`;
14
- const compress = promisify(gzip);
15
-
16
- export async function sendSlardarPcBatch(payload, { signal, request = https.request } = {}) {
17
- signal?.throwIfAborted();
18
- const body = await compress(Buffer.from(JSON.stringify(payload)));
19
- signal?.throwIfAborted();
20
- return new Promise((resolve, reject) => {
21
- const req = request(ENDPOINT, {
22
- method: "POST",
23
- signal,
24
- headers: {
25
- "content-type": "application/json",
26
- "content-encoding": "gzip",
27
- "content-length": body.length
28
- }
29
- }, (res) => {
30
- // The collector returns an empty 204. Never buffer arbitrary responses.
31
- res.resume();
32
- res.once("error", reject);
33
- res.once("end", () => {
34
- if (res.statusCode >= 200 && res.statusCode < 300) resolve();
35
- else reject(new Error(`Slardar PC HTTP ${res.statusCode}`));
36
- });
37
- });
38
- req.on("socket", (socket) => socket.unref?.());
39
- req.once("error", reject);
40
- req.end(body);
41
- });
42
- }
1
+ import https from "node:https";
2
+ import { gzip } from "node:zlib";
3
+ import { promisify } from "node:util";
4
+
5
+ // PC Custom Log / Custom Event wire format, verified against Parfait 1.7.0.0's
6
+ // public IUploader callback. This is not the Slardar Web/BID protocol. Keep the
7
+ // SDK capture fixture and the platform readback procedure with this adapter.
8
+ export const SLARDAR_PC_AID = "1880";
9
+ // Use the native envelope's four-part version convention in this legacy field.
10
+ // This is our JS adapter version; reporter=codem_js distinguishes it
11
+ // from the native Parfait SDK. Do not advertise a native SDK we do not run.
12
+ export const SLARDAR_PC_REPORTER_VERSION = "1.0.0.0";
13
+ const ENDPOINT = `https://pc-mon.zijieapi.com/monitor_pc/collect/api/pc_log?aid=${SLARDAR_PC_AID}`;
14
+ const compress = promisify(gzip);
15
+
16
+ export async function sendSlardarPcBatch(payload, { signal, request = https.request } = {}) {
17
+ signal?.throwIfAborted();
18
+ const body = await compress(Buffer.from(JSON.stringify(payload)));
19
+ signal?.throwIfAborted();
20
+ return new Promise((resolve, reject) => {
21
+ const req = request(ENDPOINT, {
22
+ method: "POST",
23
+ signal,
24
+ headers: {
25
+ "content-type": "application/json",
26
+ "content-encoding": "gzip",
27
+ "content-length": body.length
28
+ }
29
+ }, (res) => {
30
+ // The collector returns an empty 204. Never buffer arbitrary responses.
31
+ res.resume();
32
+ res.once("error", reject);
33
+ res.once("end", () => {
34
+ if (res.statusCode >= 200 && res.statusCode < 300) resolve();
35
+ else reject(new Error(`Slardar PC HTTP ${res.statusCode}`));
36
+ });
37
+ });
38
+ req.on("socket", (socket) => socket.unref?.());
39
+ req.once("error", reject);
40
+ req.end(body);
41
+ });
42
+ }
@@ -1,10 +1,10 @@
1
- const exactVersion = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
2
-
3
- // Low-cardinality process context shared by existing logs, metric categories,
4
- // and tracing. Ordinary personal-Bot processes have no worker attribution.
5
- export function workerRuntimeAttributes(env = process.env) {
6
- if (env.CODEM_WORKER_RUNTIME_READY !== '1' || !['stable', 'current'].includes(env.CODEM_WORKER_RUNTIME_ACTUAL)) return {};
7
- return { worker_runtime_family: env.CODEM_WORKER_RUNTIME_ACTUAL,
8
- ...(exactVersion.test(env.CODEM_WORKER_CLI_VERSION || '') ? { worker_cli_version: env.CODEM_WORKER_CLI_VERSION } : {}),
9
- ...(exactVersion.test(env.CODEM_WORKER_CORE_VERSION || '') ? { worker_core_version: env.CODEM_WORKER_CORE_VERSION } : {}) };
10
- }
1
+ const exactVersion = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
2
+
3
+ // Low-cardinality process context shared by existing logs, metric categories,
4
+ // and tracing. Ordinary personal-Bot processes have no worker attribution.
5
+ export function workerRuntimeAttributes(env = process.env) {
6
+ if (env.CODEM_WORKER_RUNTIME_READY !== '1' || !['stable', 'current'].includes(env.CODEM_WORKER_RUNTIME_ACTUAL)) return {};
7
+ return { worker_runtime_family: env.CODEM_WORKER_RUNTIME_ACTUAL,
8
+ ...(exactVersion.test(env.CODEM_WORKER_CLI_VERSION || '') ? { worker_cli_version: env.CODEM_WORKER_CLI_VERSION } : {}),
9
+ ...(exactVersion.test(env.CODEM_WORKER_CORE_VERSION || '') ? { worker_core_version: env.CODEM_WORKER_CORE_VERSION } : {}) };
10
+ }