@reticlehq/core 2.1.0 → 2.2.1
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/LICENSE +201 -112
- package/NOTICE +5 -0
- package/dist/brand.d.ts +32 -3
- package/dist/brand.d.ts.map +1 -1
- package/dist/brand.js +9 -4
- package/dist/brand.js.map +1 -1
- package/dist/constants.d.ts +140 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +136 -5
- package/dist/constants.js.map +1 -1
- package/dist/daemon-registry.d.ts +5 -5
- package/dist/daemon-registry.d.ts.map +1 -1
- package/dist/daemon-registry.js +5 -5
- package/dist/daemon-registry.js.map +1 -1
- package/dist/event-payloads.d.ts +502 -0
- package/dist/event-payloads.d.ts.map +1 -0
- package/dist/event-payloads.js +138 -0
- package/dist/event-payloads.js.map +1 -0
- package/dist/flow-constants.d.ts +2 -2
- package/dist/flow-constants.js +7 -7
- package/dist/flow-constants.js.map +1 -1
- package/dist/flow-types.d.ts +155 -32
- package/dist/flow-types.d.ts.map +1 -1
- package/dist/flow-types.js +23 -1
- package/dist/flow-types.js.map +1 -1
- package/dist/index.d.ts +20 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -12
- package/dist/index.js.map +1 -1
- package/dist/journal.d.ts +90 -0
- package/dist/journal.d.ts.map +1 -0
- package/dist/journal.js +38 -0
- package/dist/journal.js.map +1 -0
- package/dist/messages.d.ts +112 -16
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +15 -2
- package/dist/messages.js.map +1 -1
- package/dist/notices.d.ts +4 -4
- package/dist/notices.js +4 -4
- package/dist/redaction.d.ts +4 -0
- package/dist/redaction.d.ts.map +1 -0
- package/dist/redaction.js +33 -0
- package/dist/redaction.js.map +1 -0
- package/dist/schema/event-message.json +21 -1
- package/dist/schema/event-type.json +8 -1
- package/dist/schema/reticle-event.json +21 -1
- package/dist/schema/reticle-message.json +21 -1
- package/dist/session-constants.d.ts +2 -2
- package/dist/session-constants.js +2 -2
- package/dist/state-select.d.ts.map +1 -1
- package/dist/state-select.js +21 -5
- package/dist/state-select.js.map +1 -1
- package/dist/telemetry.d.ts +90 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +55 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/toon.d.ts +10 -10
- package/dist/toon.d.ts.map +1 -1
- package/dist/toon.js +34 -18
- package/dist/toon.js.map +1 -1
- package/dist/types.d.ts +70 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -1
- package/dist/upgrade.d.ts +19 -5
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +17 -4
- package/dist/upgrade.js.map +1 -1
- package/dist/verification-run.d.ts +23 -23
- package/dist/verification-run.js +1 -1
- package/package.json +6 -2
|
@@ -29,18 +29,25 @@
|
|
|
29
29
|
"console.log",
|
|
30
30
|
"console.warn",
|
|
31
31
|
"console.error",
|
|
32
|
+
"console.info",
|
|
33
|
+
"console.debug",
|
|
32
34
|
"error.uncaught",
|
|
33
35
|
"visible.shown",
|
|
34
|
-
"visible.hidden",
|
|
35
36
|
"anim.start",
|
|
36
37
|
"anim.end",
|
|
37
38
|
"scroll.position",
|
|
38
39
|
"reveal.shown",
|
|
39
40
|
"signal",
|
|
40
41
|
"state.change",
|
|
42
|
+
"storage.change",
|
|
41
43
|
"page.health",
|
|
44
|
+
"render.commit",
|
|
45
|
+
"focus.change",
|
|
42
46
|
"flow.recorded",
|
|
43
47
|
"transport.overflow",
|
|
48
|
+
"truncated",
|
|
49
|
+
"blind-spot",
|
|
50
|
+
"net.detail",
|
|
44
51
|
"human.control",
|
|
45
52
|
"human.mark"
|
|
46
53
|
]
|
|
@@ -54,6 +61,19 @@
|
|
|
54
61
|
"type": "string",
|
|
55
62
|
"maxLength": 128
|
|
56
63
|
},
|
|
64
|
+
"seq": {
|
|
65
|
+
"type": "integer",
|
|
66
|
+
"minimum": 0
|
|
67
|
+
},
|
|
68
|
+
"actionId": {
|
|
69
|
+
"$ref": "#/definitions/EventMessage/properties/event/properties/ref"
|
|
70
|
+
},
|
|
71
|
+
"attribution": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"enum": [
|
|
74
|
+
"window"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
57
77
|
"data": {
|
|
58
78
|
"type": "object",
|
|
59
79
|
"additionalProperties": {},
|
|
@@ -16,18 +16,25 @@
|
|
|
16
16
|
"console.log",
|
|
17
17
|
"console.warn",
|
|
18
18
|
"console.error",
|
|
19
|
+
"console.info",
|
|
20
|
+
"console.debug",
|
|
19
21
|
"error.uncaught",
|
|
20
22
|
"visible.shown",
|
|
21
|
-
"visible.hidden",
|
|
22
23
|
"anim.start",
|
|
23
24
|
"anim.end",
|
|
24
25
|
"scroll.position",
|
|
25
26
|
"reveal.shown",
|
|
26
27
|
"signal",
|
|
27
28
|
"state.change",
|
|
29
|
+
"storage.change",
|
|
28
30
|
"page.health",
|
|
31
|
+
"render.commit",
|
|
32
|
+
"focus.change",
|
|
29
33
|
"flow.recorded",
|
|
30
34
|
"transport.overflow",
|
|
35
|
+
"truncated",
|
|
36
|
+
"blind-spot",
|
|
37
|
+
"net.detail",
|
|
31
38
|
"human.control",
|
|
32
39
|
"human.mark"
|
|
33
40
|
]
|
|
@@ -22,18 +22,25 @@
|
|
|
22
22
|
"console.log",
|
|
23
23
|
"console.warn",
|
|
24
24
|
"console.error",
|
|
25
|
+
"console.info",
|
|
26
|
+
"console.debug",
|
|
25
27
|
"error.uncaught",
|
|
26
28
|
"visible.shown",
|
|
27
|
-
"visible.hidden",
|
|
28
29
|
"anim.start",
|
|
29
30
|
"anim.end",
|
|
30
31
|
"scroll.position",
|
|
31
32
|
"reveal.shown",
|
|
32
33
|
"signal",
|
|
33
34
|
"state.change",
|
|
35
|
+
"storage.change",
|
|
34
36
|
"page.health",
|
|
37
|
+
"render.commit",
|
|
38
|
+
"focus.change",
|
|
35
39
|
"flow.recorded",
|
|
36
40
|
"transport.overflow",
|
|
41
|
+
"truncated",
|
|
42
|
+
"blind-spot",
|
|
43
|
+
"net.detail",
|
|
37
44
|
"human.control",
|
|
38
45
|
"human.mark"
|
|
39
46
|
]
|
|
@@ -47,6 +54,19 @@
|
|
|
47
54
|
"type": "string",
|
|
48
55
|
"maxLength": 128
|
|
49
56
|
},
|
|
57
|
+
"seq": {
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"minimum": 0
|
|
60
|
+
},
|
|
61
|
+
"actionId": {
|
|
62
|
+
"$ref": "#/definitions/ReticleEvent/properties/ref"
|
|
63
|
+
},
|
|
64
|
+
"attribution": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"enum": [
|
|
67
|
+
"window"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
50
70
|
"data": {
|
|
51
71
|
"type": "object",
|
|
52
72
|
"additionalProperties": {},
|
|
@@ -145,18 +145,25 @@
|
|
|
145
145
|
"console.log",
|
|
146
146
|
"console.warn",
|
|
147
147
|
"console.error",
|
|
148
|
+
"console.info",
|
|
149
|
+
"console.debug",
|
|
148
150
|
"error.uncaught",
|
|
149
151
|
"visible.shown",
|
|
150
|
-
"visible.hidden",
|
|
151
152
|
"anim.start",
|
|
152
153
|
"anim.end",
|
|
153
154
|
"scroll.position",
|
|
154
155
|
"reveal.shown",
|
|
155
156
|
"signal",
|
|
156
157
|
"state.change",
|
|
158
|
+
"storage.change",
|
|
157
159
|
"page.health",
|
|
160
|
+
"render.commit",
|
|
161
|
+
"focus.change",
|
|
158
162
|
"flow.recorded",
|
|
159
163
|
"transport.overflow",
|
|
164
|
+
"truncated",
|
|
165
|
+
"blind-spot",
|
|
166
|
+
"net.detail",
|
|
160
167
|
"human.control",
|
|
161
168
|
"human.mark"
|
|
162
169
|
]
|
|
@@ -168,6 +175,19 @@
|
|
|
168
175
|
"type": "string",
|
|
169
176
|
"maxLength": 128
|
|
170
177
|
},
|
|
178
|
+
"seq": {
|
|
179
|
+
"type": "integer",
|
|
180
|
+
"minimum": 0
|
|
181
|
+
},
|
|
182
|
+
"actionId": {
|
|
183
|
+
"$ref": "#/definitions/ReticleMessage/anyOf/3/properties/event/properties/ref"
|
|
184
|
+
},
|
|
185
|
+
"attribution": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"enum": [
|
|
188
|
+
"window"
|
|
189
|
+
]
|
|
190
|
+
},
|
|
171
191
|
"data": {
|
|
172
192
|
"type": "object",
|
|
173
193
|
"additionalProperties": {},
|
|
@@ -72,7 +72,7 @@ export declare const SESSION_HEALTH: {
|
|
|
72
72
|
export declare const SESSION_LIFECYCLE: {
|
|
73
73
|
/**
|
|
74
74
|
* Default agent-idle window before the panel hands back to the human as WAITING. The agent signals
|
|
75
|
-
* this IMMEDIATELY via
|
|
75
|
+
* this IMMEDIATELY via reticle_session {action:"yield"}; this reaper is only the slow backstop for a forgotten yield, so
|
|
76
76
|
* it's deliberately long (a short window would auto-end a session mid slow-step). reticle_session-tunable.
|
|
77
77
|
*/
|
|
78
78
|
readonly IDLE_END_MS: 300000;
|
|
@@ -94,7 +94,7 @@ export declare const SESSION_LIFECYCLE: {
|
|
|
94
94
|
};
|
|
95
95
|
/**
|
|
96
96
|
* Coding-agent session hygiene thresholds. Coding agents (Claude Code, Codex, Cursor) often
|
|
97
|
-
* complete their task and close their context without calling
|
|
97
|
+
* complete their task and close their context without calling reticle_session {action:"end"}. These constants
|
|
98
98
|
* drive two passive reminder layers: a one-time session_lease on first call, and recurring
|
|
99
99
|
* session_age_warning fields after WARN_AFTER_MS.
|
|
100
100
|
*/
|
|
@@ -70,7 +70,7 @@ export const SESSION_HEALTH = {
|
|
|
70
70
|
export const SESSION_LIFECYCLE = {
|
|
71
71
|
/**
|
|
72
72
|
* Default agent-idle window before the panel hands back to the human as WAITING. The agent signals
|
|
73
|
-
* this IMMEDIATELY via
|
|
73
|
+
* this IMMEDIATELY via reticle_session {action:"yield"}; this reaper is only the slow backstop for a forgotten yield, so
|
|
74
74
|
* it's deliberately long (a short window would auto-end a session mid slow-step). reticle_session-tunable.
|
|
75
75
|
*/
|
|
76
76
|
IDLE_END_MS: 300_000,
|
|
@@ -92,7 +92,7 @@ export const SESSION_LIFECYCLE = {
|
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
94
94
|
* Coding-agent session hygiene thresholds. Coding agents (Claude Code, Codex, Cursor) often
|
|
95
|
-
* complete their task and close their context without calling
|
|
95
|
+
* complete their task and close their context without calling reticle_session {action:"end"}. These constants
|
|
96
96
|
* drive two passive reminder layers: a one-time session_lease on first call, and recurring
|
|
97
97
|
* session_age_warning fields after WARN_AFTER_MS.
|
|
98
98
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-select.d.ts","sourceRoot":"","sources":["../src/state-select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wGAAwG;AACxG,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,oGAAoG;IACpG,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"state-select.d.ts","sourceRoot":"","sources":["../src/state-select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wGAAwG;AACxG,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,oGAAoG;IACpG,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAaD,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CA+BrE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAkBlE"}
|
package/dist/state-select.js
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
* array indices) and, on a miss, returns the keys that WERE available at the last good level so a wrong
|
|
6
6
|
* path is diagnosable rather than a bare null. `capDepth` prunes deeply-nested values to a budget.
|
|
7
7
|
*/
|
|
8
|
+
/** Cap on how many near-miss keys travel in a failed selection — a 10k-key store must not return a
|
|
9
|
+
* 10k-entry array in the error payload (that was the token blowup the near-miss exists to avoid). */
|
|
10
|
+
const MAX_AVAILABLE_KEYS = 50;
|
|
8
11
|
function keysOf(value) {
|
|
9
12
|
if (Array.isArray(value))
|
|
10
|
-
return value.map((_, i) => String(i));
|
|
13
|
+
return value.slice(0, MAX_AVAILABLE_KEYS).map((_, i) => String(i));
|
|
11
14
|
if (typeof value === 'object' && value !== null)
|
|
12
|
-
return Object.keys(value);
|
|
15
|
+
return Object.keys(value).slice(0, MAX_AVAILABLE_KEYS);
|
|
13
16
|
return [];
|
|
14
17
|
}
|
|
15
18
|
/** Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged. */
|
|
@@ -18,14 +21,24 @@ export function selectPath(root, path) {
|
|
|
18
21
|
let current = root;
|
|
19
22
|
for (const segment of segments) {
|
|
20
23
|
if (Array.isArray(current)) {
|
|
24
|
+
// Require a CANONICAL index string. `Number('01')`/`Number('1e0')`/`Number(' 1')` all coerce to 1,
|
|
25
|
+
// so `items.01` silently read index 1 — an assertion on a path that doesn't exist quietly passed.
|
|
26
|
+
// `String(index) === segment` accepts only "0","1","2",… and rejects the coercion aliases.
|
|
21
27
|
const index = Number(segment);
|
|
22
|
-
if (!Number.isInteger(index) ||
|
|
28
|
+
if (!Number.isInteger(index) ||
|
|
29
|
+
index < 0 ||
|
|
30
|
+
String(index) !== segment ||
|
|
31
|
+
index >= current.length) {
|
|
23
32
|
return { found: false, value: null, availableKeys: keysOf(current) };
|
|
24
33
|
}
|
|
25
34
|
current = current[index];
|
|
26
35
|
continue;
|
|
27
36
|
}
|
|
28
|
-
|
|
37
|
+
// `Object.hasOwn`, not `in`: `in` walks the prototype, so a path segment of `constructor`,
|
|
38
|
+
// `__proto__`, or `toString` reported found:true and returned a function from Object.prototype —
|
|
39
|
+
// a state assertion on a typo'd path silently passed against a builtin instead of failing with
|
|
40
|
+
// availableKeys. Only an OWN key is a real state path.
|
|
41
|
+
if (typeof current === 'object' && current !== null && Object.hasOwn(current, segment)) {
|
|
29
42
|
current = current[segment];
|
|
30
43
|
continue;
|
|
31
44
|
}
|
|
@@ -50,7 +63,10 @@ export function capDepth(value, maxDepth) {
|
|
|
50
63
|
const keys = Object.keys(value);
|
|
51
64
|
if (maxDepth === 0)
|
|
52
65
|
return `{…${String(keys.length)} keys}`;
|
|
53
|
-
|
|
66
|
+
// Null-proto target: a wire object can carry an own `__proto__` key (via JSON.parse), and
|
|
67
|
+
// `out['__proto__'] = …` on a normal object writes the prototype slot instead of a key, losing
|
|
68
|
+
// that key from the projection. A prototype-less target makes every key an ordinary assignment.
|
|
69
|
+
const out = Object.create(null);
|
|
54
70
|
for (const key of keys)
|
|
55
71
|
out[key] = capDepth(value[key], maxDepth - 1);
|
|
56
72
|
return out;
|
package/dist/state-select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-select.js","sourceRoot":"","sources":["../src/state-select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"state-select.js","sourceRoot":"","sources":["../src/state-select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH;sGACsG;AACtG,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,kB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iC,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;QAC7E,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anonymous product telemetry — the contract for how the OSS `reticle` runtime reports ADOPTION
|
|
3
|
+
* (not verification results): is it installed, how often is it invoked, which tools get used, how many
|
|
4
|
+
* distinct machines/projects run it. This is what turns "npm downloads" (which an investor discounts)
|
|
5
|
+
* into DAU/WAU/MAU, active sessions, and retention. Uninstall/churn is deliberately NOT an event —
|
|
6
|
+
* npm 7+/pnpm run no uninstall lifecycle scripts, so churn is inferred server-side from inactivity.
|
|
7
|
+
*
|
|
8
|
+
* Privacy is structural, not a policy: the ONLY identifiers on the wire are a random per-machine UUID
|
|
9
|
+
* (`anonymousId`, minted locally, never derived from anything personal) and a one-way HASH of the
|
|
10
|
+
* project (`projectId`) — no repo name, no path, no email, no code. It is strictly opt-OUT (respects
|
|
11
|
+
* `RETICLE_TELEMETRY=0` and the `DO_NOT_TRACK` convention) and best-effort (a failed send never touches
|
|
12
|
+
* the tool's behaviour). Same conventions as the rest of core: enums are `as const` narrowed with
|
|
13
|
+
* `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
/** Bump when the event shape changes so the analytics side can segment old senders. */
|
|
17
|
+
export declare const TELEMETRY_EVENT_VERSION = 1;
|
|
18
|
+
/** The lifecycle moments that answer the adoption questions. One event = one moment. */
|
|
19
|
+
export declare const TelemetryEventKind: {
|
|
20
|
+
/** First-ever run on this machine (or a fresh `npm install`) — powers install count + new-user curve. */
|
|
21
|
+
readonly INSTALL: "install";
|
|
22
|
+
/** The CLI/MCP server was invoked — the raw "how many times it gets used" counter. */
|
|
23
|
+
readonly INVOKE: "invoke";
|
|
24
|
+
/** A daemon/MCP session came up — the numerator of "active sessions" + DAU/WAU/MAU. */
|
|
25
|
+
readonly SESSION_START: "session_start";
|
|
26
|
+
/** A session ended (carries its duration) — powers active-session-length + churn-within-session. */
|
|
27
|
+
readonly SESSION_END: "session_end";
|
|
28
|
+
/** One MCP tool call (carries the tool name) — powers "which tool is mostly used". */
|
|
29
|
+
readonly TOOL: "tool";
|
|
30
|
+
};
|
|
31
|
+
export type TelemetryEventKind = (typeof TelemetryEventKind)[keyof typeof TelemetryEventKind];
|
|
32
|
+
/**
|
|
33
|
+
* One anonymous telemetry event. `anonymousId` and the optional hashed `projectId` are the only
|
|
34
|
+
* identifiers; everything else is a low-cardinality dimension for slicing the adoption metrics.
|
|
35
|
+
*/
|
|
36
|
+
export declare const TelemetryEventSchema: z.ZodObject<{
|
|
37
|
+
v: z.ZodLiteral<1>;
|
|
38
|
+
/** Random UUID persisted at `~/.reticle/telemetry-id`. Distinct-count of this = users (DAU/WAU/MAU). */
|
|
39
|
+
anonymousId: z.ZodString;
|
|
40
|
+
/** One-way hash of the git remote (or cwd) — counts DISTINCT PROJECTS without revealing any of them. */
|
|
41
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
42
|
+
event: z.ZodNativeEnum<{
|
|
43
|
+
/** First-ever run on this machine (or a fresh `npm install`) — powers install count + new-user curve. */
|
|
44
|
+
readonly INSTALL: "install";
|
|
45
|
+
/** The CLI/MCP server was invoked — the raw "how many times it gets used" counter. */
|
|
46
|
+
readonly INVOKE: "invoke";
|
|
47
|
+
/** A daemon/MCP session came up — the numerator of "active sessions" + DAU/WAU/MAU. */
|
|
48
|
+
readonly SESSION_START: "session_start";
|
|
49
|
+
/** A session ended (carries its duration) — powers active-session-length + churn-within-session. */
|
|
50
|
+
readonly SESSION_END: "session_end";
|
|
51
|
+
/** One MCP tool call (carries the tool name) — powers "which tool is mostly used". */
|
|
52
|
+
readonly TOOL: "tool";
|
|
53
|
+
}>;
|
|
54
|
+
/** Client epoch-ms when the event happened (the server also stamps its own receive time). */
|
|
55
|
+
ts: z.ZodNumber;
|
|
56
|
+
/** Reticle version emitting the event — lets us see adoption of new releases + version spread. */
|
|
57
|
+
version: z.ZodString;
|
|
58
|
+
/** Runs inside CI? Separates real human DAU from pipeline traffic (both matter, differently). */
|
|
59
|
+
ci: z.ZodBoolean;
|
|
60
|
+
/** `process.platform` (darwin/linux/win32) — OS mix, low cardinality, non-identifying. */
|
|
61
|
+
os: z.ZodString;
|
|
62
|
+
/** Only on `session_end`: how long the session was active, in ms. */
|
|
63
|
+
sessionMs: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
/** Only on `tool`: the MCP tool name invoked (e.g. `reticle_act`). Low cardinality by construction. */
|
|
65
|
+
tool: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
event: "tool" | "install" | "invoke" | "session_start" | "session_end";
|
|
68
|
+
version: string;
|
|
69
|
+
ci: boolean;
|
|
70
|
+
v: 1;
|
|
71
|
+
anonymousId: string;
|
|
72
|
+
ts: number;
|
|
73
|
+
os: string;
|
|
74
|
+
projectId?: string | undefined;
|
|
75
|
+
tool?: string | undefined;
|
|
76
|
+
sessionMs?: number | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
event: "tool" | "install" | "invoke" | "session_start" | "session_end";
|
|
79
|
+
version: string;
|
|
80
|
+
ci: boolean;
|
|
81
|
+
v: 1;
|
|
82
|
+
anonymousId: string;
|
|
83
|
+
ts: number;
|
|
84
|
+
os: string;
|
|
85
|
+
projectId?: string | undefined;
|
|
86
|
+
tool?: string | undefined;
|
|
87
|
+
sessionMs?: number | undefined;
|
|
88
|
+
}>;
|
|
89
|
+
export type TelemetryEvent = z.infer<typeof TelemetryEventSchema>;
|
|
90
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,wFAAwF;AACxF,eAAO,MAAM,kBAAkB;IAC7B,yGAAyG;;IAEzG,sFAAsF;;IAEtF,uFAAuF;;IAEvF,oGAAoG;;IAEpG,sFAAsF;;CAE9E,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;IAE/B,wGAAwG;;IAExG,wGAAwG;;;QArBxG,yGAAyG;;QAEzG,sFAAsF;;QAEtF,uFAAuF;;QAEvF,oGAAoG;;QAEpG,sFAAsF;;;IAgBtF,6FAA6F;;IAE7F,kGAAkG;;IAElG,iGAAiG;;IAEjG,0FAA0F;;IAE1F,qEAAqE;;IAErE,uGAAuG;;;;;;;;;;;;;;;;;;;;;;;;EAEvG,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anonymous product telemetry — the contract for how the OSS `reticle` runtime reports ADOPTION
|
|
3
|
+
* (not verification results): is it installed, how often is it invoked, which tools get used, how many
|
|
4
|
+
* distinct machines/projects run it. This is what turns "npm downloads" (which an investor discounts)
|
|
5
|
+
* into DAU/WAU/MAU, active sessions, and retention. Uninstall/churn is deliberately NOT an event —
|
|
6
|
+
* npm 7+/pnpm run no uninstall lifecycle scripts, so churn is inferred server-side from inactivity.
|
|
7
|
+
*
|
|
8
|
+
* Privacy is structural, not a policy: the ONLY identifiers on the wire are a random per-machine UUID
|
|
9
|
+
* (`anonymousId`, minted locally, never derived from anything personal) and a one-way HASH of the
|
|
10
|
+
* project (`projectId`) — no repo name, no path, no email, no code. It is strictly opt-OUT (respects
|
|
11
|
+
* `RETICLE_TELEMETRY=0` and the `DO_NOT_TRACK` convention) and best-effort (a failed send never touches
|
|
12
|
+
* the tool's behaviour). Same conventions as the rest of core: enums are `as const` narrowed with
|
|
13
|
+
* `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
/** Bump when the event shape changes so the analytics side can segment old senders. */
|
|
17
|
+
export const TELEMETRY_EVENT_VERSION = 1;
|
|
18
|
+
/** The lifecycle moments that answer the adoption questions. One event = one moment. */
|
|
19
|
+
export const TelemetryEventKind = {
|
|
20
|
+
/** First-ever run on this machine (or a fresh `npm install`) — powers install count + new-user curve. */
|
|
21
|
+
INSTALL: 'install',
|
|
22
|
+
/** The CLI/MCP server was invoked — the raw "how many times it gets used" counter. */
|
|
23
|
+
INVOKE: 'invoke',
|
|
24
|
+
/** A daemon/MCP session came up — the numerator of "active sessions" + DAU/WAU/MAU. */
|
|
25
|
+
SESSION_START: 'session_start',
|
|
26
|
+
/** A session ended (carries its duration) — powers active-session-length + churn-within-session. */
|
|
27
|
+
SESSION_END: 'session_end',
|
|
28
|
+
/** One MCP tool call (carries the tool name) — powers "which tool is mostly used". */
|
|
29
|
+
TOOL: 'tool',
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* One anonymous telemetry event. `anonymousId` and the optional hashed `projectId` are the only
|
|
33
|
+
* identifiers; everything else is a low-cardinality dimension for slicing the adoption metrics.
|
|
34
|
+
*/
|
|
35
|
+
export const TelemetryEventSchema = z.object({
|
|
36
|
+
v: z.literal(TELEMETRY_EVENT_VERSION),
|
|
37
|
+
/** Random UUID persisted at `~/.reticle/telemetry-id`. Distinct-count of this = users (DAU/WAU/MAU). */
|
|
38
|
+
anonymousId: z.string().min(1).max(128),
|
|
39
|
+
/** One-way hash of the git remote (or cwd) — counts DISTINCT PROJECTS without revealing any of them. */
|
|
40
|
+
projectId: z.string().min(1).max(128).optional(),
|
|
41
|
+
event: z.nativeEnum(TelemetryEventKind),
|
|
42
|
+
/** Client epoch-ms when the event happened (the server also stamps its own receive time). */
|
|
43
|
+
ts: z.number().int().nonnegative(),
|
|
44
|
+
/** Reticle version emitting the event — lets us see adoption of new releases + version spread. */
|
|
45
|
+
version: z.string().min(1).max(64),
|
|
46
|
+
/** Runs inside CI? Separates real human DAU from pipeline traffic (both matter, differently). */
|
|
47
|
+
ci: z.boolean(),
|
|
48
|
+
/** `process.platform` (darwin/linux/win32) — OS mix, low cardinality, non-identifying. */
|
|
49
|
+
os: z.string().min(1).max(32),
|
|
50
|
+
/** Only on `session_end`: how long the session was active, in ms. */
|
|
51
|
+
sessionMs: z.number().int().nonnegative().optional(),
|
|
52
|
+
/** Only on `tool`: the MCP tool name invoked (e.g. `reticle_act`). Low cardinality by construction. */
|
|
53
|
+
tool: z.string().min(1).max(64).optional(),
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,wFAAwF;AACxF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,yGAAyG;IACzG,OAAO,EAAE,SAAS;IAClB,sFAAsF;IACtF,MAAM,EAAE,QAAQ;IAChB,uFAAuF;IACvF,aAAa,EAAE,eAAe;IAC9B,oGAAoG;IACpG,WAAW,EAAE,aAAa;IAC1B,sFAAsF;IACtF,IAAI,EAAE,MAAM;CACJ,CAAC;AAGX;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC;IACrC,wGAAwG;IACxG,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACvC,wGAAwG;IACxG,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAChD,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,kBAAkB,CAAC;IACvC,6FAA6F;IAC7F,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAClC,kGAAkG;IAClG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,iGAAiG;IACjG,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE;IACf,0FAA0F;IAC1F,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAC7B,qEAAqE;IACrE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACpD,uGAAuG;IACvG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC"}
|
package/dist/toon.d.ts
CHANGED
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
* able to generate and read it reliably from its training data alone.
|
|
8
8
|
*
|
|
9
9
|
* Grammar (one element per line):
|
|
10
|
-
*
|
|
10
|
+
* type ref "name" [states] key=value...
|
|
11
11
|
*
|
|
12
12
|
* Element types (abbreviated roles):
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* btn button inp textbox/input sel combobox/listbox chk checkbox
|
|
14
|
+
* rad radio lnk link img img dlg dialog/alertdialog
|
|
15
|
+
* nav navigation lst list/listbox tab tab/tabpanel hdr heading
|
|
16
|
+
* frm form mn menu/menubar fld group/fieldset el (any other role)
|
|
17
17
|
*
|
|
18
18
|
* State flags (inside []):
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* vis visible hid hidden en enabled dis disabled
|
|
20
|
+
* chk checked uch unchecked exp expanded col collapsed focus
|
|
21
21
|
*
|
|
22
22
|
* Attributes (key=value, space-separated):
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* val="..." current value of the element
|
|
24
|
+
* count=N child count (for containers, replaces expanding children)
|
|
25
|
+
* ph="..." placeholder text
|
|
26
26
|
*/
|
|
27
27
|
/** Encode an ElementDescriptor to a TOON line. */
|
|
28
28
|
export interface ToonElement {
|
package/dist/toon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA+HD,wEAAwE;AACxE,wBAAgB,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAGtD;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAIpE;AAED,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAOnD"}
|
package/dist/toon.js
CHANGED
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
* able to generate and read it reliably from its training data alone.
|
|
8
8
|
*
|
|
9
9
|
* Grammar (one element per line):
|
|
10
|
-
*
|
|
10
|
+
* type ref "name" [states] key=value...
|
|
11
11
|
*
|
|
12
12
|
* Element types (abbreviated roles):
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* btn button inp textbox/input sel combobox/listbox chk checkbox
|
|
14
|
+
* rad radio lnk link img img dlg dialog/alertdialog
|
|
15
|
+
* nav navigation lst list/listbox tab tab/tabpanel hdr heading
|
|
16
|
+
* frm form mn menu/menubar fld group/fieldset el (any other role)
|
|
17
17
|
*
|
|
18
18
|
* State flags (inside []):
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* vis visible hid hidden en enabled dis disabled
|
|
20
|
+
* chk checked uch unchecked exp expanded col collapsed focus
|
|
21
21
|
*
|
|
22
22
|
* Attributes (key=value, space-separated):
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* val="..." current value of the element
|
|
24
|
+
* count=N child count (for containers, replaces expanding children)
|
|
25
|
+
* ph="..." placeholder text
|
|
26
26
|
*/
|
|
27
27
|
const ROLE_MAP = {
|
|
28
28
|
button: 'btn',
|
|
@@ -104,18 +104,28 @@ function encodeStates(states, visible) {
|
|
|
104
104
|
}
|
|
105
105
|
return flags.length > 0 ? `[${flags.join(',')}]` : '';
|
|
106
106
|
}
|
|
107
|
+
/** Coerce a wire field to a string. resultToToon receives UNVALIDATED wire data cast to ToonElement,
|
|
108
|
+
* so a missing/numeric `name` must not make `.replace` throw and lose the whole encode. */
|
|
109
|
+
function toText(v) {
|
|
110
|
+
if (typeof v === 'string')
|
|
111
|
+
return v;
|
|
112
|
+
if (typeof v === 'number' || typeof v === 'boolean' || typeof v === 'bigint')
|
|
113
|
+
return String(v);
|
|
114
|
+
return ''; // undefined / null / object / symbol have no representable text on a wire field
|
|
115
|
+
}
|
|
107
116
|
function encodeName(name) {
|
|
108
|
-
return `"${name.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
117
|
+
return `"${toText(name).replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
109
118
|
}
|
|
110
119
|
function encodeValue(val) {
|
|
111
|
-
return `"${val.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
120
|
+
return `"${toText(val).replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
112
121
|
}
|
|
113
122
|
function encodeLine(el, depth) {
|
|
114
123
|
const indent = ' '.repeat(depth);
|
|
115
124
|
const type = abbreviateRole(el.role);
|
|
116
|
-
const states = encodeStates(el.states
|
|
117
|
-
const
|
|
118
|
-
|
|
125
|
+
const states = encodeStates(Array.isArray(el.states) ? el.states : [], el.visible);
|
|
126
|
+
const ref = toText(el.ref) || '?';
|
|
127
|
+
const parts = [indent + type, ref, encodeName(el.name), ...(states ? [states] : [])];
|
|
128
|
+
if (typeof el.value === 'string' && el.value.length > 0)
|
|
119
129
|
parts.push(`val=${encodeValue(el.value)}`);
|
|
120
130
|
if (el.childCount !== undefined)
|
|
121
131
|
parts.push(`count=${String(el.childCount)}`);
|
|
@@ -124,9 +134,15 @@ function encodeLine(el, depth) {
|
|
|
124
134
|
function encodeTree(elements, depth = 0) {
|
|
125
135
|
const lines = [];
|
|
126
136
|
for (const el of elements) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
lines.push(
|
|
137
|
+
// A single malformed element must not lose the rest of the tree — fall back to a placeholder line.
|
|
138
|
+
try {
|
|
139
|
+
lines.push(encodeLine(el, depth));
|
|
140
|
+
if (Array.isArray(el.children) && el.children.length > 0) {
|
|
141
|
+
lines.push(encodeTree(el.children, depth + 1));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
lines.push(`${' '.repeat(depth)}el ? "[unencodable]"`);
|
|
130
146
|
}
|
|
131
147
|
}
|
|
132
148
|
return lines.join('\n');
|
package/dist/toon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toon.js","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAeH,MAAM,QAAQ,GAA2B;IACvC,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;IACjB,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,KAAK;IACV,QAAQ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