@ycodium-ai/plugin-telemetry 0.2.2106 → 0.2.2167
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 +14 -5
- package/dist/index.js +12 -33
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
# @ycodium-ai/plugin-telemetry
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Counts which Ycodium features get used. No code, no prompts, no file names.
|
|
4
|
+
|
|
5
|
+
> **No backend. Nothing is sent.** PostHog was retired on 2026-09-20 — its
|
|
6
|
+
> project key was hardcoded in the host, which the charter forbids for cloud
|
|
7
|
+
> identifiers. No service replaced it, and this package no longer ships in the
|
|
8
|
+
> factory plugin list.
|
|
9
|
+
>
|
|
10
|
+
> What is left is the part that is not vendor-specific: the thirteen event
|
|
11
|
+
> shapes, the identity hash, batching, backoff and the queue cap. To wire a new
|
|
12
|
+
> backend, pass a `deliver` to `TelemetrySender` — do not invent a wire format
|
|
13
|
+
> here without a backend to verify it against.
|
|
5
14
|
|
|
6
15
|
## What it does
|
|
7
16
|
|
|
8
17
|
The host forwards usage events into the `record` command. This plugin batches
|
|
9
|
-
them and
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
them and hands each batch to `deliver`. With no `deliver` the sender does not
|
|
19
|
+
even schedule a flush, so events fall off the queue cap and never leave the
|
|
20
|
+
machine.
|
|
12
21
|
|
|
13
22
|
Identity is a SHA-256 of a Codex account id, else a Claude user id, else a
|
|
14
23
|
one-time anonymous id stored in the plugin data directory. If none of those
|
package/dist/index.js
CHANGED
|
@@ -89,6 +89,10 @@ var TelemetrySender = class {
|
|
|
89
89
|
return this.#queue.length;
|
|
90
90
|
}
|
|
91
91
|
start() {
|
|
92
|
+
if (this.#options.deliver === void 0) {
|
|
93
|
+
this.#options.log.info("telemetry sender has no backend; not scheduling flushes");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
92
96
|
this.#schedule();
|
|
93
97
|
}
|
|
94
98
|
/** 队列满了丢最老的:新事件比旧事件有用,而无界队列是宿主的性能红线。 */
|
|
@@ -145,27 +149,12 @@ var TelemetrySender = class {
|
|
|
145
149
|
});
|
|
146
150
|
}
|
|
147
151
|
async #send(batch) {
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
batch: batch.map((entry) => ({
|
|
154
|
-
event: entry.event,
|
|
155
|
-
distinct_id: this.#options.distinctId,
|
|
156
|
-
properties: {
|
|
157
|
-
...entry.properties,
|
|
158
|
-
...this.#options.baseProperties,
|
|
159
|
-
// 不给这个 distinct_id 建 person profile:我们只数事件,不画像。
|
|
160
|
-
$process_person_profile: false
|
|
161
|
-
},
|
|
162
|
-
timestamp: entry.capturedAt
|
|
163
|
-
}))
|
|
164
|
-
})
|
|
152
|
+
const deliver = this.#options.deliver;
|
|
153
|
+
if (deliver === void 0) return;
|
|
154
|
+
await deliver(batch, {
|
|
155
|
+
distinctId: this.#options.distinctId,
|
|
156
|
+
baseProperties: this.#options.baseProperties
|
|
165
157
|
});
|
|
166
|
-
if (!response.ok) {
|
|
167
|
-
throw new Error(`telemetry endpoint returned ${response.status}`);
|
|
168
|
-
}
|
|
169
158
|
}
|
|
170
159
|
/** 每轮重算间隔:失败越久等得越长,恢复后立刻回到一秒一次。 */
|
|
171
160
|
#schedule() {
|
|
@@ -239,14 +228,6 @@ var TelemetryRuntime = class {
|
|
|
239
228
|
}
|
|
240
229
|
async #initialize() {
|
|
241
230
|
const config = this.#ctx.config;
|
|
242
|
-
const apiKey = config.posthogKey?.trim();
|
|
243
|
-
const endpoint = config.posthogHost?.trim();
|
|
244
|
-
if (apiKey === void 0 || apiKey.length === 0 || endpoint === void 0) {
|
|
245
|
-
this.#ctx.log.warn("telemetry has no endpoint configured; not sending anything");
|
|
246
|
-
this.#pending = [];
|
|
247
|
-
this.#ready = true;
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
231
|
const identity = await resolveTelemetryIdentity(
|
|
251
232
|
this.#ctx.fs,
|
|
252
233
|
identityPathsOf(config),
|
|
@@ -259,13 +240,11 @@ var TelemetryRuntime = class {
|
|
|
259
240
|
return;
|
|
260
241
|
}
|
|
261
242
|
const sender = new TelemetrySender({
|
|
262
|
-
endpoint,
|
|
263
|
-
apiKey,
|
|
264
243
|
distinctId: identity.distinctId,
|
|
265
244
|
baseProperties: baseProperties(config),
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
|
|
245
|
+
// `deliver` 故意缺席:没有后端。接上那天在这里传实现,并且**必须走
|
|
246
|
+
// `this.#ctx.http`**(已按本机全局代理解析过)——裸 fetch 在需要代理的机器上一条
|
|
247
|
+
// 都发不出去,搬迁前踩过。
|
|
269
248
|
log: this.#ctx.log
|
|
270
249
|
});
|
|
271
250
|
for (const event of this.#pending) sender.record(event);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/plugin-telemetry",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2167",
|
|
4
4
|
"description": "Sends anonymous counts of which features get used. No code, no prompts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telemetry",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@types/node": "24.12.4",
|
|
21
21
|
"esbuild": "0.28.1",
|
|
22
22
|
"vite-plus": "0.2.2",
|
|
23
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
23
|
+
"@ycodium-ai/plugin-api": "0.2.2167"
|
|
24
24
|
},
|
|
25
25
|
"ycodium": {
|
|
26
26
|
"plugin": "./dist/index.js",
|