@aidemd-mcp/telemetry-contract 0.0.0-stage → 1.0.0

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +193 -2
  3. package/chunk-WVGQ3VJI.js +404 -0
  4. package/guide.md +194 -0
  5. package/lib/openapi/buildPingPath/index.d.ts +10 -0
  6. package/lib/openapi/index.d.ts +8 -0
  7. package/lib/openapi/index.js +107 -0
  8. package/lib/openapi/toComponent/index.d.ts +11 -0
  9. package/lib/ping/classifyIssues/formatPath/index.d.ts +6 -0
  10. package/lib/ping/classifyIssues/index.d.ts +14 -0
  11. package/lib/ping/index.d.ts +15 -0
  12. package/lib/ping/index.js +94 -0
  13. package/lib/ping/readVersion/index.d.ts +17 -0
  14. package/openapi.json +1304 -0
  15. package/package.json +27 -5
  16. package/types/ping/answers/alreadyStored/index.d.ts +7 -0
  17. package/types/ping/answers/failed/index.d.ts +7 -0
  18. package/types/ping/answers/refused/index.d.ts +16 -0
  19. package/types/ping/answers/stored/index.d.ts +7 -0
  20. package/types/ping/buckets/phaseDuration/index.d.ts +24 -0
  21. package/types/ping/buckets/phasesPerSession/index.d.ts +24 -0
  22. package/types/ping/buckets/sessionLength/index.d.ts +24 -0
  23. package/types/ping/buckets/sessionsPerProject/index.d.ts +21 -0
  24. package/types/ping/buildCounts/index.d.ts +21 -0
  25. package/types/ping/count/index.d.ts +8 -0
  26. package/types/ping/examplePing/index.d.ts +8 -0
  27. package/types/ping/index.d.ts +43 -0
  28. package/types/ping/index.js +50 -0
  29. package/types/ping/knownVersions/index.d.ts +4 -0
  30. package/types/ping/listenerOrigin/index.d.ts +7 -0
  31. package/types/ping/lists/agents/index.d.ts +4 -0
  32. package/types/ping/lists/launches/index.d.ts +4 -0
  33. package/types/ping/lists/osNames/index.d.ts +4 -0
  34. package/types/ping/lists/phases/index.d.ts +4 -0
  35. package/types/ping/lists/qaVerdicts/index.d.ts +4 -0
  36. package/types/ping/lists/refusalReasons/index.d.ts +4 -0
  37. package/types/ping/lists/toolNames/index.d.ts +4 -0
  38. package/types/ping/maxPingBytes/index.d.ts +7 -0
  39. package/types/ping/openApiDocument/index.d.ts +16 -0
  40. package/types/ping/pingCheck/index.d.ts +23 -0
  41. package/types/ping/v2/envelope/index.d.ts +25 -0
  42. package/types/ping/v2/index.d.ts +169 -0
  43. package/types/ping/v2/projects/index.d.ts +16 -0
  44. package/types/ping/v2/usage/index.d.ts +144 -0
  45. package/types/ping/versions/index.d.ts +175 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lowmeadow LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,194 @@
1
- # Temporary Holding Version
1
+ # Telemetry ping: guide for the agent that builds pings
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This guide is for the agent that writes the code which counts, builds and posts AIDEMD usage pings. Follow it exactly. Every counting rule below is the rule the published schema states in its field descriptions; if this guide and a description ever differ, the description in the schema wins and this guide is wrong.
4
+
5
+ ## 1. What this package is
6
+
7
+ This package holds the one definition of the usage ping: the schema of every ping version, a plain-language description of every field and exactly how it is counted, the closed lists and bucket edges, the answers the listener gives, an example ping, and this guide. Build pings from it and check every ping with the package's `check` before posting. Install it as a runtime dependency (never a devDependency): your code imports it when it runs. It holds no server code and reads no clock, disk or network.
8
+
9
+ ## 2. Checklist
10
+
11
+ Tick each item, in order, for every send attempt.
12
+
13
+ 1. Decide consent (section 3). If the result is off, stop: nothing is counted for sending, nothing is posted.
14
+ 2. Pick the finished UTC days still due (section 4): at most the last 7 finished days, none on or before the day the notice was seen, none already claimed.
15
+ 3. For each due day, count every field as section 5 says.
16
+ 4. Build the ping: every field present, every count zero-filled, `schema` set to the version your release was tested against (section 9).
17
+ 5. Check the ping with the package's `check`. If it returns an error, do not post it; log only the error's `code` and drop the day.
18
+ 6. Claim the day, before posting, so it can never be posted twice.
19
+ 7. Post once (section 7).
20
+ 8. Handle the answer (section 7): `201` and `200` mean delivered; anything else, retry once after 1 second, then drop the day.
21
+
22
+ ## 3. Consent
23
+
24
+ Checked in this order; the first rule that applies wins.
25
+
26
+ 1. `DO_NOT_TRACK=1` is set: off.
27
+ 2. `AIDEMD_TELEMETRY_DISABLED=1` is set: off.
28
+ 3. CI is detected (`CI`, `GITHUB_ACTIONS` and similar): off, and no notice is shown.
29
+ 4. Not an interactive session: off.
30
+ 5. The notice has not been seen: off.
31
+ 6. The notice was seen today: off until that day is over.
32
+ 7. The user's setting says off: off.
33
+ 8. The user's setting says on: a ping may be sent.
34
+
35
+ Persistence: a process that sees rule 1 or rule 2 saves "off" in the user's setting, so telemetry stays off, even in tools started without that variable, until the user turns it back on themselves. `on` is refused while any of rules 1 to 4 applies.
36
+
37
+ ## 4. When a day may be sent
38
+
39
+ - Only finished UTC days: the `day` is earlier than the current UTC date at the moment the ping is built.
40
+ - At most one ping per install per day.
41
+ - The day the notice was seen (or telemetry was turned on) and every earlier day are never sent.
42
+ - Catch-up covers at most the last 7 finished days; older days are dropped.
43
+ - A day is claimed before it is posted, so it is never posted twice, even if the process dies mid-post.
44
+ - A day with zero sessions and zero tool calls is claimed and not sent.
45
+
46
+ ## 5. What to count
47
+
48
+ Every field of version 2 is required and every count is a whole number from 0 to 9007199254740991. Every key of every map is always present, zero-filled; a missing key is refused, never defaulted. Bucket bounds: the lower bound is inclusive, the upper bound is the next bucket's lower bound and exclusive, and the last bucket has no upper bound. The fields follow in schema order.
49
+
50
+ ### `schema`
51
+
52
+ The format version this ping follows. Always `2` for this version. Reveals only which format the sender built.
53
+
54
+ ### `installId`
55
+
56
+ A random version-4 UUID the install made once on its own machine when the user first saw the telemetry notice. Never derived from the machine, the user or anything else; replaced with a new random one when the user resets it. Reveals only that pings with the same id came from the same install.
57
+
58
+ ### `day`
59
+
60
+ The UTC calendar date (`YYYY-MM-DD`) the counts cover. Always a finished day: earlier than the sender's current UTC date when the ping was built.
61
+
62
+ ### `aidemdVersion`
63
+
64
+ The version of the AIDEMD package that built the ping, as its package.json states it: MAJOR.MINOR.PATCH with optional -prerelease and +build (the semver.org recommended pattern), at most 64 characters.
65
+
66
+ ### `launch`
67
+
68
+ How AIDEMD was started. One of `global`, `npx`, `other`.
69
+
70
+ - `npx` when any folder in the running entry script's path, as launched or resolved, is named `_npx`.
71
+ - Otherwise `global` when the entry script's real path is inside a `node_modules` folder whose containing folder has no package.json (an npm global install).
72
+ - Otherwise `other` (a project-local install or a source checkout).
73
+
74
+ ### `os`
75
+
76
+ The operating system family: Node's `process.platform` when it is `win32`, `darwin` or `linux`, otherwise `other`.
77
+
78
+ ### `node`
79
+
80
+ The major version of the Node.js runtime that ran AIDEMD: the number before the first dot of `process.versions.node`. A whole number from 1 to 999.
81
+
82
+ ### `sessions`
83
+
84
+ Sessions counted for this day. A session is one AIDE session: a conversation that ran `/aide`, identified by its session id, whose log holds the `orchestration_began` record written by `aide_orchestration_begin`. A conversation the hooks log without that record is not a session and is never counted. A session's records may span several logs and it is counted once. A session is counted on the UTC day of its first recorded event, and only on that day, even if it runs past midnight. Only counted sessions feed `sessions`, `phases`, `qa`, `sessionLength`, `phasesPerSession`, `phaseDurations`, `projects` and `sessionsPerProject`.
85
+
86
+ ### `phases`
87
+
88
+ Pipeline phases started in the counted sessions, by phase name. Each phase start recorded in a counted session adds one to its phase. A start of a phase name not in the list is not counted. Keys, in order: `spec`, `research`, `synthesize`, `structure`, `plan`, `build`, `qa`, `fix`, `align`, `refactor`, `cleanup`.
89
+
90
+ ### `qa`
91
+
92
+ QA verdicts recorded in the counted sessions, by result. Keys: `passed` (QA runs whose verdict was passed) and `issues` (QA runs whose verdict was that issues were found).
93
+
94
+ ### `toolCalls`
95
+
96
+ Calls to AIDE tools made on this UTC day, counted on the day of each call (not the session's start day), by tool name. A call to any name not in the list is added to `unknown`, so no other name is ever sent. Keys, in order: `aide_discover`, `aide_read`, `aide_scaffold`, `aide_cleanup`, `aide_move`, `aide_discard`, `aide_frontmatter`, `aide_validate`, `aide_upgrade`, `aide_info`, `aide_brain`, `aide_init`, `aide_inspect`, `aide_orchestration_begin`, `aide_session_event`, `aide_session_end`, and `unknown` (calls on this day to any tool name not in the list).
97
+
98
+ ### `agents`
99
+
100
+ AIDEMD server processes started on this UTC day, by the agent that connected to them; each server process counts once (it counts server starts, not sessions). The agent is read from the connecting client's own name, lower-cased: containing `claude-code` is `claude-code`, containing `cursor` is `cursor`, anything else or no name is `other`. The client's name itself is never sent. Keys: `claude-code`, `cursor`, `other`.
101
+
102
+ ### `sessionLength`
103
+
104
+ Counted sessions by length: the time from the session's first recorded event to its last, in minutes. Each counted session adds one to exactly one bucket, so the buckets add up to `sessions`. A bucket holds lengths at or above its lower bound and below the next bucket's; a negative length from clock skew falls in the first.
105
+
106
+ | Key | From (minutes, inclusive) | Up to (exclusive) |
107
+ | --- | --- | --- |
108
+ | `<5m` | 0 | 5 |
109
+ | `5-15m` | 5 | 15 |
110
+ | `15-60m` | 15 | 60 |
111
+ | `1-3h` | 60 | 180 |
112
+ | `3h+` | 180 | no upper bound |
113
+
114
+ ### `phasesPerSession`
115
+
116
+ Counted sessions by how many phase starts each recorded, whatever the phase name. Each counted session adds one to exactly one bucket, so the buckets add up to `sessions`.
117
+
118
+ | Key | From (phase starts, inclusive) | Up to (exclusive) |
119
+ | --- | --- | --- |
120
+ | `0` | 0 | 1 |
121
+ | `1-2` | 1 | 3 |
122
+ | `3-5` | 3 | 6 |
123
+ | `6-10` | 6 | 11 |
124
+ | `11+` | 11 | no upper bound |
125
+
126
+ ### `phaseDurations`
127
+
128
+ Finished phase runs in the counted sessions, by phase and duration. One key per phase (the same eleven as `phases`), each holding one count per duration bucket. A run is a phase start paired with the earliest still-open start that has the same pipeline, phase and module when a matching phase finish arrives; its duration is from start to finish, in minutes. A start never finished and a finish with no open start are not counted. The module is used only to pair starts with finishes and is never sent.
129
+
130
+ | Key | From (minutes, inclusive) | Up to (exclusive) |
131
+ | --- | --- | --- |
132
+ | `<1m` | 0 | 1 |
133
+ | `1-5m` | 1 | 5 |
134
+ | `5-15m` | 5 | 15 |
135
+ | `15-60m` | 15 | 60 |
136
+ | `60m+` | 60 | no upper bound |
137
+
138
+ ### `projects`
139
+
140
+ Distinct projects with at least one counted session. A session belongs to the one project whose session log holds its first event. Only the number is sent: never a project's name, path, key or anything else about it.
141
+
142
+ ### `sessionsPerProject`
143
+
144
+ The projects counted in `projects`, by how many counted sessions each had. Each counted project adds one to exactly one bucket, so the buckets add up to `projects`.
145
+
146
+ | Key | From (sessions, inclusive) | Up to (exclusive) |
147
+ | --- | --- | --- |
148
+ | `1` | 1 | 2 |
149
+ | `2-3` | 2 | 4 |
150
+ | `4-10` | 4 | 11 |
151
+ | `11+` | 11 | no upper bound |
152
+
153
+ The sums stated above (`sessionLength` and `phasesPerSession` add up to `sessions`; `sessionsPerProject` adds up to `projects`) are the counting rules. The check does not enforce them; your code must.
154
+
155
+ ## 6. What never goes in a ping
156
+
157
+ Never: paths, project keys, project, task, module or file names, prompts, code, commit hashes, tool arguments, refusal reasons, error text, hostnames, the agent's client name. No field can carry free text, and the schema refuses any key it does not list.
158
+
159
+ ## 7. How to post
160
+
161
+ - `POST https://telemetry.aidemd.dev/ping` (`listenerOrigin` plus the path `/ping`).
162
+ - `Content-Type: application/json`; the body is the ping as JSON, at most 64 KiB (`65536` bytes).
163
+ - No credentials, no cookies. A redirect is a failure; do not follow it.
164
+ - A limit of 4 seconds per attempt.
165
+ - On a timeout or any non-2xx answer, retry once 1 second later, then drop the day for good.
166
+ - Check the ping with the package's `check` before posting and never post one it refuses.
167
+
168
+ The listener answers with one of these JSON bodies:
169
+
170
+ | Status | Body | Means | What the client does |
171
+ | --- | --- | --- | --- |
172
+ | 201 | `{ "status": "stored" }` | The ping's install-day was stored by this request. | Delivered. Done. |
173
+ | 200 | `{ "status": "already_stored" }` | The install-day was already stored; nothing stored again. | Delivered. A repeat is not an error. Done. |
174
+ | 400 | `{ "status": "refused", "reason": ..., "message": ... }` | The ping was refused whole; resending the same ping gets the same answer. | Not delivered. Non-2xx: retry once after 1 second, then drop the day. Log only the `reason`, never the `message`. |
175
+ | 500 or 503 | `{ "status": "failed" }` | The listener could not store the ping this time. | Not delivered. Retry once after 1 second, then drop the day. |
176
+ | 404 or 405 | listener-only bodies | The address or method was wrong. | Not delivered. Non-2xx: retry once, then drop the day. |
177
+
178
+ The `reason` in a refusal is one of: `unknown_version` (the ping's schema is not a version the listener knows), `missing_field`, `extra_field`, `bad_value` (a value outside the allowed set, or a body that is not a JSON object), `unreadable` (the body could not be read, is not valid UTF-8 or is not valid JSON), `too_large` (the body is over 64 KiB). The `message` states the same reason in plain words, naming the fields concerned, and never repeats a value that was sent.
179
+
180
+ ## 8. What your notice must say
181
+
182
+ Before anything is sent, the user must have seen a notice, and it must:
183
+
184
+ - name every field the ping holds: the counts of sessions, pipeline phases and how long they took, QA results, AIDE tool calls, agents, session lengths, phases per session, and projects (the number of projects and how many sessions each had, never their names), plus the AIDEMD, Node and OS versions, how AIDEMD was launched, the day, and the random install id;
185
+ - say that the install id is random and cannot be traced back to the user;
186
+ - say that the listener derives the country from the sender's address on arrival, and never stores or logs the address;
187
+ - say what is never sent (section 6), how to turn telemetry off (`DO_NOT_TRACK=1`, `AIDEMD_TELEMETRY_DISABLED=1`, and a command or switch the user can reach), and how to see exactly what would be sent;
188
+ - say nothing has been sent yet.
189
+
190
+ When a field is added or its meaning changes, the notice and the README change in the same release.
191
+
192
+ ## 9. Versions
193
+
194
+ Known versions: `2` (read them from the package's `knownVersions`). Send exactly the version your release was tested against; never guess a newer one, never send one the package does not list. A new version reaches clients only after the listener accepting it is deployed: publish the new contract package, deploy the listener, and only then release a client that sends the new version (release order in the repository's `docs/contracts.md`). No client may send a version before the deployed listener accepts it. New tool or phase names need a new format version: until one adds a name, fold an unknown tool into `unknown` and do not count an unknown phase.
@@ -0,0 +1,404 @@
1
+ // src/types/ping/answers/alreadyStored/index.ts
2
+ import { z } from "zod";
3
+ var alreadyStored = z.strictObject({
4
+ status: z.literal("already_stored").describe("Always already_stored for this answer: an earlier ping already holds this install and day.")
5
+ }).describe(
6
+ "The ping's install-day was already stored, so nothing was stored again. Delivered: a repeat is not an error."
7
+ );
8
+ var alreadyStored_default = alreadyStored;
9
+
10
+ // src/types/ping/answers/failed/index.ts
11
+ import { z as z2 } from "zod";
12
+ var failed = z2.strictObject({
13
+ status: z2.literal("failed").describe("Always failed for this answer: the ping was not stored.")
14
+ }).describe("The listener could not store the ping this time. Not delivered; retrying later may work.");
15
+ var failed_default = failed;
16
+
17
+ // src/types/ping/answers/refused/index.ts
18
+ import { z as z3 } from "zod";
19
+
20
+ // src/types/ping/lists/refusalReasons/index.ts
21
+ var refusalReasons = [
22
+ "unknown_version",
23
+ "missing_field",
24
+ "extra_field",
25
+ "bad_value",
26
+ "unreadable",
27
+ "too_large"
28
+ ];
29
+ var refusalReasons_default = refusalReasons;
30
+
31
+ // src/types/ping/answers/refused/index.ts
32
+ var refused = z3.strictObject({
33
+ status: z3.literal("refused").describe("Always refused for this answer: the ping was not stored."),
34
+ reason: z3.enum(refusalReasons_default).describe(
35
+ "Why: unknown_version (its schema is not a version the listener knows), missing_field, extra_field, bad_value (a value outside the allowed set, or a body that is not a JSON object), unreadable (the body could not be read, is not valid UTF-8 or is not valid JSON), too_large (the body is over 64 KiB)."
36
+ ),
37
+ message: z3.string().max(2e3).describe(
38
+ "The same reason in plain words, naming the fields concerned. Never repeats a value that was sent."
39
+ )
40
+ }).describe(
41
+ "The ping was refused whole and nothing from it was stored. Resending the same ping gets the same answer."
42
+ );
43
+ var refused_default = refused;
44
+
45
+ // src/types/ping/answers/stored/index.ts
46
+ import { z as z4 } from "zod";
47
+ var stored = z4.strictObject({
48
+ status: z4.literal("stored").describe("Always stored for this answer: the ping was stored.")
49
+ }).describe("The ping's install-day was stored by this request. Delivered.");
50
+ var stored_default = stored;
51
+
52
+ // src/types/ping/buckets/phaseDuration/index.ts
53
+ var phaseDuration = [
54
+ { key: "<1m", from: 0 },
55
+ { key: "1-5m", from: 1 },
56
+ { key: "5-15m", from: 5 },
57
+ { key: "15-60m", from: 15 },
58
+ { key: "60m+", from: 60 }
59
+ ];
60
+ var phaseDuration_default = phaseDuration;
61
+
62
+ // src/types/ping/buckets/phasesPerSession/index.ts
63
+ var phasesPerSession = [
64
+ { key: "0", from: 0 },
65
+ { key: "1-2", from: 1 },
66
+ { key: "3-5", from: 3 },
67
+ { key: "6-10", from: 6 },
68
+ { key: "11+", from: 11 }
69
+ ];
70
+ var phasesPerSession_default = phasesPerSession;
71
+
72
+ // src/types/ping/buckets/sessionLength/index.ts
73
+ var sessionLength = [
74
+ { key: "<5m", from: 0 },
75
+ { key: "5-15m", from: 5 },
76
+ { key: "15-60m", from: 15 },
77
+ { key: "1-3h", from: 60 },
78
+ { key: "3h+", from: 180 }
79
+ ];
80
+ var sessionLength_default = sessionLength;
81
+
82
+ // src/types/ping/buckets/sessionsPerProject/index.ts
83
+ var sessionsPerProject = [
84
+ { key: "1", from: 1 },
85
+ { key: "2-3", from: 2 },
86
+ { key: "4-10", from: 4 },
87
+ { key: "11+", from: 11 }
88
+ ];
89
+ var sessionsPerProject_default = sessionsPerProject;
90
+
91
+ // src/types/ping/buildCounts/index.ts
92
+ import { z as z6 } from "zod";
93
+
94
+ // src/types/ping/count/index.ts
95
+ import { z as z5 } from "zod";
96
+ var count = z5.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
97
+ var count_default = count;
98
+
99
+ // src/types/ping/buildCounts/index.ts
100
+ function buildCounts({
101
+ keys,
102
+ description,
103
+ describeKey
104
+ }) {
105
+ const shape = Object.fromEntries(keys.map((key) => [key, count_default.describe(describeKey(key))]));
106
+ return z6.strictObject(shape).describe(description);
107
+ }
108
+
109
+ // src/types/ping/examplePing/index.ts
110
+ var examplePing = {
111
+ schema: 2,
112
+ installId: "3f2b8c1e-7a4d-4e9b-9c2f-5d6e7f8a9b0c",
113
+ day: "2026-12-03",
114
+ aidemdVersion: "1.0.0",
115
+ launch: "global",
116
+ os: "linux",
117
+ node: 22,
118
+ sessions: 3,
119
+ phases: {
120
+ spec: 0,
121
+ research: 0,
122
+ synthesize: 0,
123
+ structure: 0,
124
+ plan: 2,
125
+ build: 3,
126
+ qa: 2,
127
+ fix: 1,
128
+ align: 0,
129
+ refactor: 0,
130
+ cleanup: 0
131
+ },
132
+ qa: { passed: 1, issues: 1 },
133
+ toolCalls: {
134
+ aide_discover: 4,
135
+ aide_read: 9,
136
+ aide_scaffold: 2,
137
+ aide_cleanup: 0,
138
+ aide_move: 0,
139
+ aide_discard: 0,
140
+ aide_frontmatter: 3,
141
+ aide_validate: 0,
142
+ aide_upgrade: 0,
143
+ aide_info: 0,
144
+ aide_brain: 0,
145
+ aide_init: 0,
146
+ aide_inspect: 0,
147
+ aide_orchestration_begin: 0,
148
+ aide_session_event: 0,
149
+ aide_session_end: 0,
150
+ unknown: 0
151
+ },
152
+ agents: { "claude-code": 2, cursor: 0, other: 0 },
153
+ sessionLength: { "<5m": 1, "5-15m": 0, "15-60m": 1, "1-3h": 1, "3h+": 0 },
154
+ phasesPerSession: { "0": 1, "1-2": 0, "3-5": 2, "6-10": 0, "11+": 0 },
155
+ phaseDurations: {
156
+ spec: { "<1m": 0, "1-5m": 0, "5-15m": 0, "15-60m": 0, "60m+": 0 },
157
+ research: { "<1m": 0, "1-5m": 0, "5-15m": 0, "15-60m": 0, "60m+": 0 },
158
+ synthesize: { "<1m": 0, "1-5m": 0, "5-15m": 0, "15-60m": 0, "60m+": 0 },
159
+ structure: { "<1m": 0, "1-5m": 0, "5-15m": 0, "15-60m": 0, "60m+": 0 },
160
+ plan: { "<1m": 0, "1-5m": 0, "5-15m": 2, "15-60m": 0, "60m+": 0 },
161
+ build: { "<1m": 0, "1-5m": 0, "5-15m": 1, "15-60m": 2, "60m+": 0 },
162
+ qa: { "<1m": 0, "1-5m": 2, "5-15m": 0, "15-60m": 0, "60m+": 0 },
163
+ fix: { "<1m": 1, "1-5m": 0, "5-15m": 0, "15-60m": 0, "60m+": 0 },
164
+ align: { "<1m": 0, "1-5m": 0, "5-15m": 0, "15-60m": 0, "60m+": 0 },
165
+ refactor: { "<1m": 0, "1-5m": 0, "5-15m": 0, "15-60m": 0, "60m+": 0 },
166
+ cleanup: { "<1m": 0, "1-5m": 0, "5-15m": 0, "15-60m": 0, "60m+": 0 }
167
+ },
168
+ projects: 2,
169
+ sessionsPerProject: { "1": 1, "2-3": 1, "4-10": 0, "11+": 0 }
170
+ };
171
+ var examplePing_default = examplePing;
172
+
173
+ // src/types/ping/v2/index.ts
174
+ import { z as z9 } from "zod";
175
+
176
+ // src/types/ping/v2/envelope/index.ts
177
+ import { z as z7 } from "zod";
178
+
179
+ // src/types/ping/lists/launches/index.ts
180
+ var launches = ["global", "npx", "other"];
181
+ var launches_default = launches;
182
+
183
+ // src/types/ping/lists/osNames/index.ts
184
+ var osNames = ["win32", "darwin", "linux", "other"];
185
+ var osNames_default = osNames;
186
+
187
+ // src/types/ping/v2/envelope/index.ts
188
+ var semverPattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
189
+ var envelope = {
190
+ schema: z7.literal(2).describe(
191
+ "The format version this ping follows. Always 2 for this version. Reveals only which format the sender built."
192
+ ),
193
+ installId: z7.uuidv4().describe(
194
+ "A random version-4 UUID the install made once on its own machine when the user first saw the telemetry notice. Never derived from the machine, the user or anything else; replaced with a new random one when the user resets it. Reveals only that pings with the same id came from the same install."
195
+ ),
196
+ day: z7.iso.date().describe(
197
+ "The UTC calendar date (YYYY-MM-DD) the counts cover. Always a finished day: earlier than the sender's current UTC date when the ping was built."
198
+ ),
199
+ aidemdVersion: z7.string().max(64).regex(semverPattern).describe("The version of the AIDEMD package that built the ping, as its package.json states it."),
200
+ launch: z7.enum(launches_default).describe(
201
+ "How AIDEMD was started. npx when any folder in the running entry script's path, as launched or resolved, is named _npx; otherwise global when the entry script's real path is inside a node_modules folder whose containing folder has no package.json (an npm global install); otherwise other (a project-local install or a source checkout)."
202
+ ),
203
+ os: z7.enum(osNames_default).describe(
204
+ "The operating system family: Node's process.platform when it is win32, darwin or linux, otherwise other."
205
+ ),
206
+ node: z7.number().int().min(1).max(999).describe(
207
+ "The major version of the Node.js runtime that ran AIDEMD: the number before the first dot of process.versions.node."
208
+ )
209
+ };
210
+ var envelope_default = envelope;
211
+
212
+ // src/types/ping/v2/projects/index.ts
213
+ var keyDescriptions = {
214
+ "1": "Projects with 1 session.",
215
+ "2-3": "Projects with 2 or 3 sessions.",
216
+ "4-10": "Projects with 4 to 10 sessions.",
217
+ "11+": "Projects with 11 or more sessions."
218
+ };
219
+ var projects = {
220
+ projects: count_default.describe(
221
+ "Distinct projects with at least one counted session. A session belongs to the one project whose session log holds its first event. Only the number is sent: never a project's name, path, key or anything else about it."
222
+ ),
223
+ sessionsPerProject: buildCounts({
224
+ keys: sessionsPerProject_default.map(({ key }) => key),
225
+ description: "The projects counted in projects, by how many counted sessions each had. Each counted project adds one to exactly one bucket, so the buckets add up to projects.",
226
+ describeKey: (key) => keyDescriptions[key]
227
+ })
228
+ };
229
+ var projects_default = projects;
230
+
231
+ // src/types/ping/v2/usage/index.ts
232
+ import { z as z8 } from "zod";
233
+
234
+ // src/types/ping/lists/agents/index.ts
235
+ var agents = ["claude-code", "cursor", "other"];
236
+ var agents_default = agents;
237
+
238
+ // src/types/ping/lists/phases/index.ts
239
+ var phases = [
240
+ "spec",
241
+ "research",
242
+ "synthesize",
243
+ "structure",
244
+ "plan",
245
+ "build",
246
+ "qa",
247
+ "fix",
248
+ "align",
249
+ "refactor",
250
+ "cleanup"
251
+ ];
252
+ var phases_default = phases;
253
+
254
+ // src/types/ping/lists/qaVerdicts/index.ts
255
+ var qaVerdicts = ["passed", "issues"];
256
+ var qaVerdicts_default = qaVerdicts;
257
+
258
+ // src/types/ping/lists/toolNames/index.ts
259
+ var toolNames = [
260
+ "aide_discover",
261
+ "aide_read",
262
+ "aide_scaffold",
263
+ "aide_cleanup",
264
+ "aide_move",
265
+ "aide_discard",
266
+ "aide_frontmatter",
267
+ "aide_validate",
268
+ "aide_upgrade",
269
+ "aide_info",
270
+ "aide_brain",
271
+ "aide_init",
272
+ "aide_inspect",
273
+ "aide_orchestration_begin",
274
+ "aide_session_event",
275
+ "aide_session_end"
276
+ ];
277
+ var toolNames_default = toolNames;
278
+
279
+ // src/types/ping/v2/usage/index.ts
280
+ var qaKeyDescriptions = {
281
+ passed: "QA runs whose verdict was passed.",
282
+ issues: "QA runs whose verdict was that issues were found."
283
+ };
284
+ var agentKeyDescriptions = {
285
+ "claude-code": "Server processes started for Claude Code.",
286
+ cursor: "Server processes started for Cursor.",
287
+ other: "Server processes started for any other client, or one that gave no name."
288
+ };
289
+ var sessionLengthKeyDescriptions = {
290
+ "<5m": "Sessions under 5 minutes.",
291
+ "5-15m": "Sessions of at least 5 and under 15 minutes.",
292
+ "15-60m": "Sessions of at least 15 and under 60 minutes.",
293
+ "1-3h": "Sessions of at least 1 and under 3 hours.",
294
+ "3h+": "Sessions of 3 hours or more."
295
+ };
296
+ var phasesPerSessionKeyDescriptions = {
297
+ "0": "Sessions with no phase start.",
298
+ "1-2": "Sessions with 1 or 2 phase starts.",
299
+ "3-5": "Sessions with 3 to 5 phase starts.",
300
+ "6-10": "Sessions with 6 to 10 phase starts.",
301
+ "11+": "Sessions with 11 or more phase starts."
302
+ };
303
+ var phaseDurationKeyDescriptions = {
304
+ "<1m": "Runs under 1 minute.",
305
+ "1-5m": "Runs of at least 1 and under 5 minutes.",
306
+ "5-15m": "Runs of at least 5 and under 15 minutes.",
307
+ "15-60m": "Runs of at least 15 and under 60 minutes.",
308
+ "60m+": "Runs of 60 minutes or more."
309
+ };
310
+ function buildPhaseDurations(phase) {
311
+ return buildCounts({
312
+ keys: phaseDuration_default.map(({ key }) => key),
313
+ description: `Finished runs of ${phase} by duration.`,
314
+ describeKey: (key) => phaseDurationKeyDescriptions[key]
315
+ });
316
+ }
317
+ var phaseDurationShape = Object.fromEntries(phases_default.map((phase) => [phase, buildPhaseDurations(phase)]));
318
+ var usage = {
319
+ sessions: count_default.describe(
320
+ "Sessions counted for this day. A session is one AIDE session: a conversation that ran /aide, identified by its session id, whose log holds the orchestration_began record written by aide_orchestration_begin. A conversation the hooks log without that record is not a session and is never counted. A session's records may span several logs and it is counted once. A session is counted on the UTC day of its first recorded event, and only on that day, even if it runs past midnight. Only counted sessions feed sessions, phases, qa, sessionLength, phasesPerSession, phaseDurations, projects and sessionsPerProject."
321
+ ),
322
+ phases: buildCounts({
323
+ keys: phases_default,
324
+ description: "Pipeline phases started in the counted sessions, by phase name. Each phase start recorded in a counted session adds one to its phase. A start of a phase name not in this list is not counted.",
325
+ describeKey: (phase) => `Phase starts of ${phase} in the counted sessions.`
326
+ }),
327
+ qa: buildCounts({
328
+ keys: qaVerdicts_default,
329
+ description: "QA verdicts recorded in the counted sessions, by result.",
330
+ describeKey: (verdict) => qaKeyDescriptions[verdict]
331
+ }),
332
+ toolCalls: buildCounts({
333
+ keys: [...toolNames_default, "unknown"],
334
+ description: "Calls to AIDE tools made on this UTC day, counted on the day of each call (not the session's start day), by tool name. A call to any name not in this list is added to unknown, so no other name is ever sent.",
335
+ describeKey: (tool) => tool === "unknown" ? "Calls on this day to any tool name not in this list." : `Calls to ${tool} on this day.`
336
+ }),
337
+ agents: buildCounts({
338
+ keys: agents_default,
339
+ description: "AIDEMD server processes started on this UTC day, by the agent that connected to them; each server process counts once. The agent is read from the connecting client's own name, lower-cased: containing claude-code is claude-code, containing cursor is cursor, anything else or no name is other. The client's name itself is never sent.",
340
+ describeKey: (agent) => agentKeyDescriptions[agent]
341
+ }),
342
+ sessionLength: buildCounts({
343
+ keys: sessionLength_default.map(({ key }) => key),
344
+ description: "Counted sessions by length: the time from the session's first recorded event to its last, in minutes. Each counted session adds one to exactly one bucket, so the buckets add up to sessions. A bucket holds lengths at or above its lower bound and below the next bucket's; a negative length from clock skew falls in the first.",
345
+ describeKey: (key) => sessionLengthKeyDescriptions[key]
346
+ }),
347
+ phasesPerSession: buildCounts({
348
+ keys: phasesPerSession_default.map(({ key }) => key),
349
+ description: "Counted sessions by how many phase starts each recorded, whatever the phase name. Each counted session adds one to exactly one bucket, so the buckets add up to sessions.",
350
+ describeKey: (key) => phasesPerSessionKeyDescriptions[key]
351
+ }),
352
+ phaseDurations: z8.strictObject(phaseDurationShape).describe(
353
+ "Finished phase runs in the counted sessions, by phase and duration. A run is a phase start paired with the earliest still-open start that has the same pipeline, phase and module when a matching phase finish arrives; its duration is from start to finish, in minutes. A start never finished and a finish with no open start are not counted. The module is used only to pair starts with finishes and is never sent."
354
+ )
355
+ };
356
+ var usage_default = usage;
357
+
358
+ // src/types/ping/v2/index.ts
359
+ var v2 = z9.strictObject({ ...envelope_default, ...usage_default, ...projects_default }).describe("Usage ping, format version 2: one opted-in AIDEMD install's counts for one finished UTC day.");
360
+ var v2_default = v2;
361
+
362
+ // src/types/ping/versions/index.ts
363
+ var versions = { 2: v2_default };
364
+ var versions_default = versions;
365
+
366
+ // src/types/ping/knownVersions/index.ts
367
+ var knownVersions = Object.keys(versions_default).map(Number).sort(
368
+ (a, b) => a - b
369
+ );
370
+ var knownVersions_default = knownVersions;
371
+
372
+ // src/types/ping/listenerOrigin/index.ts
373
+ var listenerOrigin = "https://telemetry.aidemd.dev";
374
+ var listenerOrigin_default = listenerOrigin;
375
+
376
+ // src/types/ping/maxPingBytes/index.ts
377
+ var maxPingBytes = 65536;
378
+ var maxPingBytes_default = maxPingBytes;
379
+
380
+ export {
381
+ alreadyStored_default,
382
+ failed_default,
383
+ refusalReasons_default,
384
+ refused_default,
385
+ stored_default,
386
+ phaseDuration_default,
387
+ phasesPerSession_default,
388
+ sessionLength_default,
389
+ sessionsPerProject_default,
390
+ count_default,
391
+ buildCounts,
392
+ examplePing_default,
393
+ launches_default,
394
+ osNames_default,
395
+ agents_default,
396
+ phases_default,
397
+ qaVerdicts_default,
398
+ toolNames_default,
399
+ v2_default,
400
+ versions_default,
401
+ knownVersions_default,
402
+ listenerOrigin_default,
403
+ maxPingBytes_default
404
+ };