@reticlehq/core 3.6.0 → 3.8.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 (133) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/artifacts-entry.d.ts +2 -0
  4. package/dist/artifacts/artifacts-entry.js +2 -0
  5. package/dist/artifacts/drive-script.d.ts +222 -116
  6. package/dist/artifacts/drive-script.js +24 -1
  7. package/dist/artifacts/flow-constants.d.ts +33 -0
  8. package/dist/artifacts/flow-constants.js +35 -0
  9. package/dist/artifacts/flow-expect-flat.d.ts +8 -8
  10. package/dist/artifacts/flow-results.d.ts +461 -0
  11. package/dist/artifacts/flow-results.js +1 -0
  12. package/dist/artifacts/flow-types.d.ts +177 -543
  13. package/dist/artifacts/flow-types.js +17 -2
  14. package/dist/artifacts/harness-credits.d.ts +42 -0
  15. package/dist/artifacts/harness-credits.js +72 -0
  16. package/dist/artifacts/harness-map.d.ts +98 -0
  17. package/dist/artifacts/harness-map.js +36 -0
  18. package/dist/artifacts/impact.d.ts +355 -149
  19. package/dist/artifacts/impact.js +84 -49
  20. package/dist/artifacts/journal.d.ts +81 -11
  21. package/dist/artifacts/journal.js +39 -0
  22. package/dist/artifacts/prompt-context.d.ts +12 -0
  23. package/dist/artifacts/prompt-context.js +14 -3
  24. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  25. package/dist/artifacts/screenshot-upload.js +26 -0
  26. package/dist/graph/app-graph.d.ts +137 -0
  27. package/dist/graph/app-graph.js +498 -0
  28. package/dist/hooks/hook-events.d.ts +26 -26
  29. package/dist/hud-entry.d.ts +1 -0
  30. package/dist/hud-entry.js +2 -0
  31. package/dist/identity/checkout.d.ts +41 -0
  32. package/dist/identity/checkout.js +118 -0
  33. package/dist/identity/state-dir.d.ts +23 -0
  34. package/dist/identity/state-dir.js +43 -0
  35. package/dist/index.d.ts +15 -0
  36. package/dist/index.js +15 -0
  37. package/dist/onboarding.d.ts +30 -1
  38. package/dist/onboarding.js +25 -0
  39. package/dist/realm/registry.js +19 -1
  40. package/dist/registry/dev-server-registry.d.ts +2 -2
  41. package/dist/schema/command-message.json +30 -0
  42. package/dist/schema/command-name.json +3 -1
  43. package/dist/schema/event-message.json +3 -1
  44. package/dist/schema/event-payloads.json +156 -3
  45. package/dist/schema/event-type.json +3 -1
  46. package/dist/schema/hello-message.json +21 -0
  47. package/dist/schema/reticle-event.json +3 -1
  48. package/dist/schema/reticle-message.json +54 -1
  49. package/dist/telemetry-bug.d.ts +169 -0
  50. package/dist/telemetry-bug.js +123 -0
  51. package/dist/telemetry-entry.d.ts +2 -1
  52. package/dist/telemetry-entry.js +2 -1
  53. package/dist/telemetry-feedback.d.ts +16 -2
  54. package/dist/telemetry-feedback.js +19 -0
  55. package/dist/telemetry-session.d.ts +91 -2
  56. package/dist/telemetry-session.js +65 -0
  57. package/dist/telemetry-signals.d.ts +557 -0
  58. package/dist/telemetry-signals.js +225 -0
  59. package/dist/telemetry.d.ts +649 -296
  60. package/dist/telemetry.js +110 -119
  61. package/dist/verdict/check-sentence.d.ts +34 -0
  62. package/dist/verdict/check-sentence.js +228 -0
  63. package/dist/verdict/consequence.d.ts +15 -0
  64. package/dist/verdict/consequence.js +11 -0
  65. package/dist/verdict/disparity.d.ts +105 -0
  66. package/dist/verdict/disparity.js +40 -0
  67. package/dist/verdict/findings.d.ts +16 -0
  68. package/dist/verdict/findings.js +22 -0
  69. package/dist/verdict/instrumentation-coverage.d.ts +84 -0
  70. package/dist/verdict/instrumentation-coverage.js +182 -0
  71. package/dist/verdict/instrumentation-gap.d.ts +79 -0
  72. package/dist/verdict/instrumentation-gap.js +65 -1
  73. package/dist/verdict/intent.d.ts +19 -5
  74. package/dist/verdict/intent.js +13 -1
  75. package/dist/verdict/predicate-tree.d.ts +17 -0
  76. package/dist/verdict/predicate-tree.js +37 -0
  77. package/dist/verdict/predicate.d.ts +16 -1
  78. package/dist/verdict/predicate.js +188 -13
  79. package/dist/verdict/property-assertion.d.ts +2 -2
  80. package/dist/verdict/run-report.d.ts +166 -0
  81. package/dist/verdict/run-report.js +53 -0
  82. package/dist/verdict/security.d.ts +60 -1
  83. package/dist/verdict/security.js +174 -12
  84. package/dist/verdict/verification-run.d.ts +713 -68
  85. package/dist/verdict/verification-run.js +113 -0
  86. package/dist/verdict/verify-progress.d.ts +6 -6
  87. package/dist/wire/constants/constants.d.ts +69 -155
  88. package/dist/wire/constants/constants.js +78 -159
  89. package/dist/wire/constants/discovery.d.ts +4 -4
  90. package/dist/wire/constants/discovery.js +4 -4
  91. package/dist/wire/constants/event-types.d.ts +35 -1
  92. package/dist/wire/constants/event-types.js +33 -1
  93. package/dist/wire/constants/hud-controls.js +15 -5
  94. package/dist/wire/constants/hud-use.d.ts +33 -4
  95. package/dist/wire/constants/hud-use.js +30 -4
  96. package/dist/wire/constants/mcp-wire.d.ts +26 -0
  97. package/dist/wire/constants/mcp-wire.js +26 -0
  98. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  99. package/dist/wire/constants/response-body-reason.js +18 -0
  100. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  101. package/dist/wire/constants/reticle-chrome.js +19 -0
  102. package/dist/wire/constants/reticle-env.d.ts +138 -0
  103. package/dist/wire/constants/reticle-env.js +138 -0
  104. package/dist/wire/constants/session-constants.d.ts +26 -2
  105. package/dist/wire/constants/session-constants.js +26 -2
  106. package/dist/wire/desktop-contract.d.ts +8 -0
  107. package/dist/wire/desktop-contract.js +11 -0
  108. package/dist/wire/event-payloads.d.ts +202 -36
  109. package/dist/wire/event-payloads.js +100 -16
  110. package/dist/wire/messages.d.ts +193 -54
  111. package/dist/wire/messages.js +25 -1
  112. package/dist/wire/narrow.d.ts +6 -0
  113. package/dist/wire/narrow.js +26 -0
  114. package/dist/wire/next-step.d.ts +90 -0
  115. package/dist/wire/next-step.js +37 -0
  116. package/dist/wire/platform-link.d.ts +84 -0
  117. package/dist/wire/platform-link.js +57 -6
  118. package/dist/wire/production/activation-ticket.d.ts +64 -0
  119. package/dist/wire/production/activation-ticket.js +148 -0
  120. package/dist/wire/production/hello-mode.d.ts +35 -0
  121. package/dist/wire/production/hello-mode.js +32 -0
  122. package/dist/wire/production/production-policy.d.ts +138 -0
  123. package/dist/wire/production/production-policy.js +133 -0
  124. package/dist/wire/tool-names.d.ts +4 -0
  125. package/dist/wire/tool-names.js +4 -0
  126. package/dist/wire/types.d.ts +90 -52
  127. package/dist/wire/types.js +5 -0
  128. package/dist/words/notices.d.ts +1 -1
  129. package/dist/words/notices.js +1 -1
  130. package/dist/words/upgrade.js +1 -1
  131. package/dist/words/writing-rule.d.ts +14 -0
  132. package/dist/words/writing-rule.js +17 -0
  133. package/package.json +5 -1
@@ -0,0 +1,169 @@
1
+ /**
2
+ * The `bug_found` event: how Reticle found a defect, and who caused it. Split out of `telemetry.ts`
3
+ * as its own subject, and re-exported from there, so every `@reticlehq/core/telemetry` import still
4
+ * reaches it.
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * How Reticle came to find a defect. Four routes, in descending order of "a human would have missed
9
+ * this": a contradiction is invisible to someone watching the screen, a crawl finding required no
10
+ * script at all, a replay failure is a regression on something that used to work, and a failed
11
+ * assertion is the agent's own check not holding.
12
+ */
13
+ export declare const BugSource: {
14
+ /** Channels disagreed — the false green. A passing screen sitting on a failed write. */
15
+ readonly CONTRADICTION: "contradiction";
16
+ /** `reticle_crawl` found it autonomously, with nobody writing a test. */
17
+ readonly CRAWL: "crawl";
18
+ /** A saved flow that used to pass stopped passing — a regression. */
19
+ readonly REPLAY: "replay";
20
+ /** An assertion the agent declared did not hold. */
21
+ readonly ASSERTION: "assertion";
22
+ };
23
+ export type BugSource = (typeof BugSource)[keyof typeof BugSource];
24
+ /**
25
+ * WHOSE fault the defect was.
26
+ *
27
+ * `bugsFound` is not publishable without this, and a count confidently wrong about whose fault
28
+ * something is, is worse than no count: it points at the customer. Two rules keep it honest:
29
+ *
30
+ * 1. **Always present.** `UNCLASSIFIED` is a value, not a gap. Absence would mean an old sender or a
31
+ * path that forgot; a value means the classifier ran and declined.
32
+ * 2. **`APP` requires POSITIVE evidence** — something the app itself did: a request that came back
33
+ * failed, a signal the app fired carrying data that disagrees with its own screen, a written
34
+ * field echoed back changed. Never "nothing else explained it". Core already draws exactly this
35
+ * line for the verdict, in `ABSENCE_DERIVED_CONTRADICTIONS`, and that is the line reused rather
36
+ * than a second judgement invented beside it.
37
+ */
38
+ export declare const BugAttribution: {
39
+ /** A defect in the app under test — the only bucket that belongs in a published defect count. */
40
+ readonly APP: "app";
41
+ /** The agent's own call was wrong: a path, store or target that never existed. Teach the agent. */
42
+ readonly REQUEST: "request";
43
+ /** Reticle could not see or could not drive. Our bug, or our configuration. Ship a fix. */
44
+ readonly RETICLE: "reticle";
45
+ /**
46
+ * The classifier looked and the evidence could not say.
47
+ *
48
+ * The honest majority, and it must stay a value rather than becoming a gap: a failed
49
+ * `element.present` covers "the button is missing", "the API is down" and "the agent mistyped a
50
+ * testid" identically, and an owner invented for it would put a guess into a published number.
51
+ * Exclude it from a defect count; never fold it into `app`.
52
+ */
53
+ readonly UNCLASSIFIED: "unclassified";
54
+ };
55
+ export type BugAttribution = (typeof BugAttribution)[keyof typeof BugAttribution];
56
+ /**
57
+ * One defect Reticle found in the app under test.
58
+ *
59
+ * `kind` is the taxonomy value from `findings.ts` — `signal-contradicted`, `console-error`,
60
+ * `duplicate-request` and so on. Never a selector, a URL, an element, or any description of the
61
+ * user's app — THAT a class of defect was found, never WHAT it was in.
62
+ */
63
+ export declare const BugFoundSchema: z.ZodObject<{
64
+ source: z.ZodNativeEnum<{
65
+ /** Channels disagreed — the false green. A passing screen sitting on a failed write. */
66
+ readonly CONTRADICTION: "contradiction";
67
+ /** `reticle_crawl` found it autonomously, with nobody writing a test. */
68
+ readonly CRAWL: "crawl";
69
+ /** A saved flow that used to pass stopped passing — a regression. */
70
+ readonly REPLAY: "replay";
71
+ /** An assertion the agent declared did not hold. */
72
+ readonly ASSERTION: "assertion";
73
+ }>;
74
+ /** The classified kind from Reticle's own findings vocabulary. */
75
+ kind: z.ZodString;
76
+ /**
77
+ * True when the defect PRESENTED AS SUCCESS — the screen advanced, the assertion passed, the click
78
+ * looked fine — while another channel showed it had not.
79
+ *
80
+ * Defined by the presentation rather than by "an assertion passed", because the same defect arrives
81
+ * both ways: through `reticle_assert` there IS a passing assertion to contradict, and through
82
+ * `reticle_crawl` there is no assertion at all and the UI simply moved on over a failed write. Both
83
+ * are the thing a human watching the screen cannot see, and that is what the flag has to mean if
84
+ * the number is going to be published.
85
+ *
86
+ * The subset worth naming separately, because it is the only category Reticle can claim as uniquely
87
+ * its own: every other kind of bug is findable by a careful human or an ordinary test.
88
+ */
89
+ falseGreen: z.ZodBoolean;
90
+ /** Which tool surfaced it. */
91
+ tool: z.ZodOptional<z.ZodString>;
92
+ /**
93
+ * TRUE when this KIND was already reported in this session — i.e. this is another INSTANCE of a
94
+ * defect already counted, not another defect.
95
+ *
96
+ * Both numbers are claims, and they are different ones. "Reticle found N defects" is the headline;
97
+ * "users hit them M times" is the frequency that says which ones actually cost anybody anything.
98
+ * Without this flag the event stream answers only the second while looking like it answers the
99
+ * first, so any distinct-defect count read off it is silently inflated — the exact way a published
100
+ * number goes wrong. Count `repeat: false` for distinct, count everything for instances.
101
+ *
102
+ * Scoped to the SESSION, because that is the only identity available: the payload deliberately
103
+ * carries no selector, URL or app detail, so the same defect in two sessions cannot be recognised
104
+ * as one — and must not be, since that would need data this event refuses to collect.
105
+ */
106
+ repeat: z.ZodBoolean;
107
+ /**
108
+ * Whose fault it was, ALWAYS present — `unclassified` when the evidence cannot say, never absent.
109
+ *
110
+ * Absence and "the evidence could not say" are different facts, and only one of them is a
111
+ * measurement. Count `attribution: 'app'` for defects found in anybody's product; see
112
+ * `BugAttribution` for why `app` needs positive evidence.
113
+ */
114
+ attribution: z.ZodNativeEnum<{
115
+ /** A defect in the app under test — the only bucket that belongs in a published defect count. */
116
+ readonly APP: "app";
117
+ /** The agent's own call was wrong: a path, store or target that never existed. Teach the agent. */
118
+ readonly REQUEST: "request";
119
+ /** Reticle could not see or could not drive. Our bug, or our configuration. Ship a fix. */
120
+ readonly RETICLE: "reticle";
121
+ /**
122
+ * The classifier looked and the evidence could not say.
123
+ *
124
+ * The honest majority, and it must stay a value rather than becoming a gap: a failed
125
+ * `element.present` covers "the button is missing", "the API is down" and "the agent mistyped a
126
+ * testid" identically, and an owner invented for it would put a guess into a published number.
127
+ * Exclude it from a defect count; never fold it into `app`.
128
+ */
129
+ readonly UNCLASSIFIED: "unclassified";
130
+ }>;
131
+ /**
132
+ * A stable hash identifying THIS defect across sessions — same kind at the same route = same
133
+ * fingerprint, regardless of when or where it was found.
134
+ *
135
+ * The inputs (route, selector) never travel raw — only the 8-char hex hash does, following the
136
+ * same privacy pattern as `projectId`. The analytics side groups on it to answer "was this bug
137
+ * fixed?" (the fingerprint stops appearing) and to deduplicate the same defect found by parallel
138
+ * agents in one run.
139
+ *
140
+ * OPTIONAL because old senders and the `reticle verify` CLI path do not yet compute it. Absent
141
+ * means "not fingerprinted", never "a different defect from one that has a fingerprint".
142
+ */
143
+ fingerprint: z.ZodOptional<z.ZodString>;
144
+ /**
145
+ * Which hit of this `fingerprint` in the session, from 1. Two hits of one defect used to be
146
+ * byte-identical rows, so a duplicated delivery and a real second hit could not be told apart.
147
+ * `occurrence: 1` is the distinct defect within a session. Absent on older senders.
148
+ */
149
+ occurrence: z.ZodOptional<z.ZodNumber>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ repeat: boolean;
152
+ kind: string;
153
+ source: "replay" | "assertion" | "contradiction" | "crawl";
154
+ attribution: "app" | "reticle" | "request" | "unclassified";
155
+ falseGreen: boolean;
156
+ tool?: string | undefined;
157
+ fingerprint?: string | undefined;
158
+ occurrence?: number | undefined;
159
+ }, {
160
+ repeat: boolean;
161
+ kind: string;
162
+ source: "replay" | "assertion" | "contradiction" | "crawl";
163
+ attribution: "app" | "reticle" | "request" | "unclassified";
164
+ falseGreen: boolean;
165
+ tool?: string | undefined;
166
+ fingerprint?: string | undefined;
167
+ occurrence?: number | undefined;
168
+ }>;
169
+ export type BugFound = z.infer<typeof BugFoundSchema>;
@@ -0,0 +1,123 @@
1
+ /**
2
+ * The `bug_found` event: how Reticle found a defect, and who caused it. Split out of `telemetry.ts`
3
+ * as its own subject, and re-exported from there, so every `@reticlehq/core/telemetry` import still
4
+ * reaches it.
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * How Reticle came to find a defect. Four routes, in descending order of "a human would have missed
9
+ * this": a contradiction is invisible to someone watching the screen, a crawl finding required no
10
+ * script at all, a replay failure is a regression on something that used to work, and a failed
11
+ * assertion is the agent's own check not holding.
12
+ */
13
+ export const BugSource = {
14
+ /** Channels disagreed — the false green. A passing screen sitting on a failed write. */
15
+ CONTRADICTION: 'contradiction',
16
+ /** `reticle_crawl` found it autonomously, with nobody writing a test. */
17
+ CRAWL: 'crawl',
18
+ /** A saved flow that used to pass stopped passing — a regression. */
19
+ REPLAY: 'replay',
20
+ /** An assertion the agent declared did not hold. */
21
+ ASSERTION: 'assertion',
22
+ };
23
+ /**
24
+ * WHOSE fault the defect was.
25
+ *
26
+ * `bugsFound` is not publishable without this, and a count confidently wrong about whose fault
27
+ * something is, is worse than no count: it points at the customer. Two rules keep it honest:
28
+ *
29
+ * 1. **Always present.** `UNCLASSIFIED` is a value, not a gap. Absence would mean an old sender or a
30
+ * path that forgot; a value means the classifier ran and declined.
31
+ * 2. **`APP` requires POSITIVE evidence** — something the app itself did: a request that came back
32
+ * failed, a signal the app fired carrying data that disagrees with its own screen, a written
33
+ * field echoed back changed. Never "nothing else explained it". Core already draws exactly this
34
+ * line for the verdict, in `ABSENCE_DERIVED_CONTRADICTIONS`, and that is the line reused rather
35
+ * than a second judgement invented beside it.
36
+ */
37
+ export const BugAttribution = {
38
+ /** A defect in the app under test — the only bucket that belongs in a published defect count. */
39
+ APP: 'app',
40
+ /** The agent's own call was wrong: a path, store or target that never existed. Teach the agent. */
41
+ REQUEST: 'request',
42
+ /** Reticle could not see or could not drive. Our bug, or our configuration. Ship a fix. */
43
+ RETICLE: 'reticle',
44
+ /**
45
+ * The classifier looked and the evidence could not say.
46
+ *
47
+ * The honest majority, and it must stay a value rather than becoming a gap: a failed
48
+ * `element.present` covers "the button is missing", "the API is down" and "the agent mistyped a
49
+ * testid" identically, and an owner invented for it would put a guess into a published number.
50
+ * Exclude it from a defect count; never fold it into `app`.
51
+ */
52
+ UNCLASSIFIED: 'unclassified',
53
+ };
54
+ /**
55
+ * One defect Reticle found in the app under test.
56
+ *
57
+ * `kind` is the taxonomy value from `findings.ts` — `signal-contradicted`, `console-error`,
58
+ * `duplicate-request` and so on. Never a selector, a URL, an element, or any description of the
59
+ * user's app — THAT a class of defect was found, never WHAT it was in.
60
+ */
61
+ export const BugFoundSchema = z.object({
62
+ source: z.nativeEnum(BugSource),
63
+ /** The classified kind from Reticle's own findings vocabulary. */
64
+ kind: z.string().min(1).max(64),
65
+ /**
66
+ * True when the defect PRESENTED AS SUCCESS — the screen advanced, the assertion passed, the click
67
+ * looked fine — while another channel showed it had not.
68
+ *
69
+ * Defined by the presentation rather than by "an assertion passed", because the same defect arrives
70
+ * both ways: through `reticle_assert` there IS a passing assertion to contradict, and through
71
+ * `reticle_crawl` there is no assertion at all and the UI simply moved on over a failed write. Both
72
+ * are the thing a human watching the screen cannot see, and that is what the flag has to mean if
73
+ * the number is going to be published.
74
+ *
75
+ * The subset worth naming separately, because it is the only category Reticle can claim as uniquely
76
+ * its own: every other kind of bug is findable by a careful human or an ordinary test.
77
+ */
78
+ falseGreen: z.boolean(),
79
+ /** Which tool surfaced it. */
80
+ tool: z.string().min(1).max(64).optional(),
81
+ /**
82
+ * TRUE when this KIND was already reported in this session — i.e. this is another INSTANCE of a
83
+ * defect already counted, not another defect.
84
+ *
85
+ * Both numbers are claims, and they are different ones. "Reticle found N defects" is the headline;
86
+ * "users hit them M times" is the frequency that says which ones actually cost anybody anything.
87
+ * Without this flag the event stream answers only the second while looking like it answers the
88
+ * first, so any distinct-defect count read off it is silently inflated — the exact way a published
89
+ * number goes wrong. Count `repeat: false` for distinct, count everything for instances.
90
+ *
91
+ * Scoped to the SESSION, because that is the only identity available: the payload deliberately
92
+ * carries no selector, URL or app detail, so the same defect in two sessions cannot be recognised
93
+ * as one — and must not be, since that would need data this event refuses to collect.
94
+ */
95
+ repeat: z.boolean(),
96
+ /**
97
+ * Whose fault it was, ALWAYS present — `unclassified` when the evidence cannot say, never absent.
98
+ *
99
+ * Absence and "the evidence could not say" are different facts, and only one of them is a
100
+ * measurement. Count `attribution: 'app'` for defects found in anybody's product; see
101
+ * `BugAttribution` for why `app` needs positive evidence.
102
+ */
103
+ attribution: z.nativeEnum(BugAttribution),
104
+ /**
105
+ * A stable hash identifying THIS defect across sessions — same kind at the same route = same
106
+ * fingerprint, regardless of when or where it was found.
107
+ *
108
+ * The inputs (route, selector) never travel raw — only the 8-char hex hash does, following the
109
+ * same privacy pattern as `projectId`. The analytics side groups on it to answer "was this bug
110
+ * fixed?" (the fingerprint stops appearing) and to deduplicate the same defect found by parallel
111
+ * agents in one run.
112
+ *
113
+ * OPTIONAL because old senders and the `reticle verify` CLI path do not yet compute it. Absent
114
+ * means "not fingerprinted", never "a different defect from one that has a fingerprint".
115
+ */
116
+ fingerprint: z.string().max(16).optional(),
117
+ /**
118
+ * Which hit of this `fingerprint` in the session, from 1. Two hits of one defect used to be
119
+ * byte-identical rows, so a duplicated delivery and a real second hit could not be told apart.
120
+ * `occurrence: 1` is the distinct defect within a session. Absent on older senders.
121
+ */
122
+ occurrence: z.number().int().positive().optional(),
123
+ });
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * The event kinds, their zod schemas, and the two payloads a PERSON writes (feedback + identity).
5
5
  * Separate from the root entry point because this is a different wire from the browser↔bridge one:
6
- * it goes to the capture endpoint, not to the agent. See docs/telemetry-contract.md.
6
+ * it goes to the capture endpoint, not to the agent. See contributing/telemetry/contract.md.
7
7
  *
8
8
  * Every name below is ALSO exported from the root entry point, which stays as it was.
9
9
  */
@@ -13,3 +13,4 @@ export * from './telemetry-refusal.js';
13
13
  export * from './telemetry-session.js';
14
14
  export * from './telemetry-license.js';
15
15
  export * from './telemetry-feedback.js';
16
+ export * from './telemetry-signals.js';
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * The event kinds, their zod schemas, and the two payloads a PERSON writes (feedback + identity).
5
5
  * Separate from the root entry point because this is a different wire from the browser↔bridge one:
6
- * it goes to the capture endpoint, not to the agent. See docs/telemetry-contract.md.
6
+ * it goes to the capture endpoint, not to the agent. See contributing/telemetry/contract.md.
7
7
  *
8
8
  * Every name below is ALSO exported from the root entry point, which stays as it was.
9
9
  */
@@ -13,3 +13,4 @@ export * from './telemetry-refusal.js';
13
13
  export * from './telemetry-session.js';
14
14
  export * from './telemetry-license.js';
15
15
  export * from './telemetry-feedback.js';
16
+ export * from './telemetry-signals.js';
@@ -64,6 +64,8 @@ export declare const FeedbackKind: {
64
64
  readonly EXPERIENCE: "experience";
65
65
  };
66
66
  export type FeedbackKind = (typeof FeedbackKind)[keyof typeof FeedbackKind];
67
+ /** Every feedback kind as one `<a|b>` choice for help text. Derived, so no kind is left out. */
68
+ export declare const FEEDBACK_KIND_CHOICES: string;
67
69
  /** Which shell the verified app runs in. Mirrors the SDK's own `PAGE_HEALTH` runtime report. */
68
70
  export declare const AppRuntime: {
69
71
  readonly WEB: "web";
@@ -118,6 +120,10 @@ export declare const FEEDBACK_RATING_MIN = 1;
118
120
  export declare const FEEDBACK_RATING_MAX = 5;
119
121
  /** Cap for the structured why/impact/workaround fields — prose, but bounded prose. */
120
122
  export declare const FEEDBACK_FIELD_MAX = 1000;
123
+ /** The longest reply address a feedback report takes: the longest address mail can carry. */
124
+ export declare const FEEDBACK_CONTACT_MAX = 254;
125
+ /** True for one plain reply address that a feedback report may carry. */
126
+ export declare function isFeedbackContact(value: string): boolean;
121
127
  /**
122
128
  * The feedback body. Everything here is either author-written (`text`, `trace`, `rating`) or
123
129
  * environment context detected locally (`stack`, `runtime`, `engine`, …) — the context is what turns
@@ -238,10 +244,16 @@ export declare const FeedbackSchema: z.ZodObject<{
238
244
  readonly USER: "user";
239
245
  readonly PROJECT: "project";
240
246
  }>>;
247
+ /**
248
+ * A reply address, so the maintainers can answer. Present ONLY when the person gave it for this
249
+ * purpose (`reticle feedback --contact`, or the agent relayed one the user typed). The one
250
+ * personal value this channel carries, and never taken from anywhere else.
251
+ */
252
+ contact: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
241
253
  }, "strip", z.ZodTypeAny, {
242
254
  text: string;
243
255
  kind: "bug" | "gap" | "ambiguity" | "feature_request" | "improvement" | "experience";
244
- source: "human" | "agent";
256
+ source: "agent" | "human";
245
257
  impact?: string | undefined;
246
258
  model?: string | undefined;
247
259
  trace?: string | undefined;
@@ -256,10 +268,11 @@ export declare const FeedbackSchema: z.ZodObject<{
256
268
  driver?: "cdp" | "sdk" | undefined;
257
269
  client?: string | undefined;
258
270
  mcpScope?: "project" | "user" | undefined;
271
+ contact?: string | undefined;
259
272
  }, {
260
273
  text: string;
261
274
  kind: "bug" | "gap" | "ambiguity" | "feature_request" | "improvement" | "experience";
262
- source: "human" | "agent";
275
+ source: "agent" | "human";
263
276
  impact?: string | undefined;
264
277
  model?: string | undefined;
265
278
  trace?: string | undefined;
@@ -274,6 +287,7 @@ export declare const FeedbackSchema: z.ZodObject<{
274
287
  driver?: "cdp" | "sdk" | undefined;
275
288
  client?: string | undefined;
276
289
  mcpScope?: "project" | "user" | undefined;
290
+ contact?: string | undefined;
277
291
  }>;
278
292
  export type Feedback = z.infer<typeof FeedbackSchema>;
279
293
  /** What Reticle is being used for. Self-declared; never inferred. */
@@ -62,6 +62,8 @@ export const FeedbackKind = {
62
62
  */
63
63
  EXPERIENCE: 'experience',
64
64
  };
65
+ /** Every feedback kind as one `<a|b>` choice for help text. Derived, so no kind is left out. */
66
+ export const FEEDBACK_KIND_CHOICES = `<${Object.values(FeedbackKind).join('|')}>`;
65
67
  /** Which shell the verified app runs in. Mirrors the SDK's own `PAGE_HEALTH` runtime report. */
66
68
  export const AppRuntime = {
67
69
  WEB: 'web',
@@ -111,6 +113,17 @@ export const FEEDBACK_RATING_MIN = 1;
111
113
  export const FEEDBACK_RATING_MAX = 5;
112
114
  /** Cap for the structured why/impact/workaround fields — prose, but bounded prose. */
113
115
  export const FEEDBACK_FIELD_MAX = 1000;
116
+ /** The longest reply address a feedback report takes: the longest address mail can carry. */
117
+ export const FEEDBACK_CONTACT_MAX = 254;
118
+ /**
119
+ * One plain address: no spaces, one `@`, and a dot in the domain. A simple shape, not full RFC 5322:
120
+ * it refuses a list, a name with an address, and text that is not an address at all.
121
+ */
122
+ const FEEDBACK_CONTACT_SHAPE = /^[^\s@,;<>]+@[^\s@,;<>]+\.[^\s@,;<>]+$/;
123
+ /** True for one plain reply address that a feedback report may carry. */
124
+ export function isFeedbackContact(value) {
125
+ return value.length <= FEEDBACK_CONTACT_MAX && FEEDBACK_CONTACT_SHAPE.test(value);
126
+ }
114
127
  /**
115
128
  * The feedback body. Everything here is either author-written (`text`, `trace`, `rating`) or
116
129
  * environment context detected locally (`stack`, `runtime`, `engine`, …) — the context is what turns
@@ -175,6 +188,12 @@ export const FeedbackSchema = z.object({
175
188
  /** The MCP client on the other end (`claude-code`, `cursor`, …) — self-reported at initialize. */
176
189
  client: z.string().min(1).max(64).optional(),
177
190
  mcpScope: z.nativeEnum(McpScope).optional(),
191
+ /**
192
+ * A reply address, so the maintainers can answer. Present ONLY when the person gave it for this
193
+ * purpose (`reticle feedback --contact`, or the agent relayed one the user typed). The one
194
+ * personal value this channel carries, and never taken from anywhere else.
195
+ */
196
+ contact: z.string().max(FEEDBACK_CONTACT_MAX).refine(isFeedbackContact).optional(),
178
197
  });
179
198
  /** What Reticle is being used for. Self-declared; never inferred. */
180
199
  export const UsageContextKind = {
@@ -6,6 +6,35 @@
6
6
  * every new thing worth measuring lands in one of these two shapes.
7
7
  */
8
8
  import { z } from 'zod';
9
+ /**
10
+ * The one-time advisories that point an agent at the platform and the Harness, by kind. Closed: a
11
+ * nudge whose kind is not listed here never reaches the wire.
12
+ */
13
+ export declare const AgentNudgeKind: {
14
+ /** Unlinked, after the first verdict: `reticle connect` keeps it and lets the Harness test the app. */
15
+ readonly CONNECT: "connect";
16
+ /** An older build's "close the gaps" advisory. No longer sent: the Harness has no coverage gate. */
17
+ readonly CLOSE_GAPS: "close_gaps";
18
+ /** Linked, with the Harness off: the user can switch it on. */
19
+ readonly SWITCH_ON: "switch_on";
20
+ /** Harness on, and the agent is driving a long journey by hand: hand it to explore. */
21
+ readonly EXPLORE: "explore";
22
+ };
23
+ export type AgentNudgeKind = (typeof AgentNudgeKind)[keyof typeof AgentNudgeKind];
24
+ /**
25
+ * A coverage percent, in fifths. A bucket answers "how far from the gate" without an exact number
26
+ * that, beside the stack and the size, starts to describe one app.
27
+ */
28
+ export declare const CoverageBucket: {
29
+ readonly B0: "0-19";
30
+ readonly B20: "20-39";
31
+ readonly B40: "40-59";
32
+ readonly B60: "60-79";
33
+ readonly B80: "80-100";
34
+ };
35
+ export type CoverageBucket = (typeof CoverageBucket)[keyof typeof CoverageBucket];
36
+ /** The bucket a 0..100 percent falls in. */
37
+ export declare function coverageBucketOf(percent: number): CoverageBucket;
9
38
  /**
10
39
  * One distinct error shape seen during a session, with the detail needed to fix it.
11
40
  *
@@ -399,6 +428,17 @@ export declare const SessionSummarySchema: z.ZodObject<{
399
428
  * difference between a smooth install and one that needed a second step nobody documented.
400
429
  */
401
430
  msToFirstApp: z.ZodOptional<z.ZodNumber>;
431
+ /**
432
+ * The SDK version of the last page that connected to this daemon, from its HELLO. Our own
433
+ * release number, or `other`. Absent when no page announced one.
434
+ */
435
+ sdkVersion: z.ZodOptional<z.ZodString>;
436
+ /**
437
+ * Tool calls made before the first app connected. Session lifetime, like `appConnects`: read the
438
+ * last row, never sum. Absent when there were none. With `appConnects: 0`, it is an agent that
439
+ * worked against a daemon with no app, which sends no verdict and often no refusal.
440
+ */
441
+ toolCallsBeforeApp: z.ZodOptional<z.ZodNumber>;
402
442
  /**
403
443
  * What state the AGENT's work was in when the session ended. Absent on a periodic flush.
404
444
  *
@@ -453,6 +493,15 @@ export declare const SessionSummarySchema: z.ZodObject<{
453
493
  * asked whether it worked is the finding, so absence and `false` must not look alike.
454
494
  */
455
495
  endedWithVerdict: z.ZodOptional<z.ZodBoolean>;
496
+ /**
497
+ * Session totals, on the FINAL summary only. Every scalar counter above (`toolCalls`,
498
+ * `verifications`, `bugsFound`, ...) is windowed on EVERY event, the final one included, so the
499
+ * counts summed across a session's `session_progress` + `daemon_stopped` rows are the session's
500
+ * total. These are the same totals read off one row, under names a sum cannot pick up by mistake.
501
+ */
502
+ lifetimeToolCalls: z.ZodOptional<z.ZodNumber>;
503
+ lifetimeVerifications: z.ZodOptional<z.ZodNumber>;
504
+ lifetimeBugsFound: z.ZodOptional<z.ZodNumber>;
456
505
  /**
457
506
  * Was the update nudge actually delivered to an agent during this daemon run.
458
507
  *
@@ -495,6 +544,32 @@ export declare const SessionSummarySchema: z.ZodObject<{
495
544
  hudSlides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
496
545
  hudJourney: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
497
546
  hudJourneyCut: z.ZodOptional<z.ZodLiteral<true>>;
547
+ /**
548
+ * The one-time platform and Harness advisories an agent was shown, by kind (`AgentNudgeKind`).
549
+ * Whether a connect or an explore followed is read beside it: `cli_command_run` for `connect`, and
550
+ * `toolCounts` / `toolParams` for `reticle_verify`'s explore. Windowed; absent when none was shown.
551
+ */
552
+ nudgesShown: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<{
553
+ /** Unlinked, after the first verdict: `reticle connect` keeps it and lets the Harness test the app. */
554
+ readonly CONNECT: "connect";
555
+ /** An older build's "close the gaps" advisory. No longer sent: the Harness has no coverage gate. */
556
+ readonly CLOSE_GAPS: "close_gaps";
557
+ /** Linked, with the Harness off: the user can switch it on. */
558
+ readonly SWITCH_ON: "switch_on";
559
+ /** Harness on, and the agent is driving a long journey by hand: hand it to explore. */
560
+ readonly EXPLORE: "explore";
561
+ }>, z.ZodNumber>>;
562
+ /**
563
+ * Harness drives an older build refused for low coverage, by coverage bucket (`CoverageBucket`).
564
+ * No longer sent: the Harness has no coverage gate. Kept so an older daemon's events still parse.
565
+ */
566
+ harnessRefusedCoverage: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<{
567
+ readonly B0: "0-19";
568
+ readonly B20: "20-39";
569
+ readonly B40: "40-59";
570
+ readonly B60: "60-79";
571
+ readonly B80: "80-100";
572
+ }>, z.ZodNumber>>;
498
573
  /** Was this a clean shutdown, or a periodic flush of a still-running session? */
499
574
  final: z.ZodBoolean;
500
575
  /**
@@ -518,6 +593,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
518
593
  verifications: number;
519
594
  final: boolean;
520
595
  surface?: string | undefined;
596
+ sdkVersion?: string | undefined;
521
597
  errors?: {
522
598
  message: string;
523
599
  count: number;
@@ -566,12 +642,16 @@ export declare const SessionSummarySchema: z.ZodObject<{
566
642
  clientVersions?: Record<string, string> | undefined;
567
643
  appConnects?: number | undefined;
568
644
  msToFirstApp?: number | undefined;
645
+ toolCallsBeforeApp?: number | undefined;
569
646
  endReason?: "verified" | "abandoned" | "never_used" | "explored" | "client_left" | undefined;
570
647
  feedbackPrompted?: number | undefined;
571
648
  errorClasses?: Record<string, number> | undefined;
572
649
  errorsRecovered?: number | undefined;
573
650
  errorsRepeated?: number | undefined;
574
651
  endedWithVerdict?: boolean | undefined;
652
+ lifetimeToolCalls?: number | undefined;
653
+ lifetimeVerifications?: number | undefined;
654
+ lifetimeBugsFound?: number | undefined;
575
655
  updateNudged?: boolean | undefined;
576
656
  updateOffered?: string | undefined;
577
657
  hudControls?: Record<string, number> | undefined;
@@ -580,6 +660,8 @@ export declare const SessionSummarySchema: z.ZodObject<{
580
660
  hudSlides?: Record<string, number> | undefined;
581
661
  hudJourney?: string[] | undefined;
582
662
  hudJourneyCut?: true | undefined;
663
+ nudgesShown?: Partial<Record<"connect" | "close_gaps" | "switch_on" | "explore", number>> | undefined;
664
+ harnessRefusedCoverage?: Partial<Record<"0-19" | "20-39" | "40-59" | "60-79" | "80-100", number>> | undefined;
583
665
  exit?: "signal" | "idle" | "unknown" | undefined;
584
666
  }, {
585
667
  durationMs: number;
@@ -589,6 +671,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
589
671
  verifications: number;
590
672
  final: boolean;
591
673
  surface?: string | undefined;
674
+ sdkVersion?: string | undefined;
592
675
  errors?: {
593
676
  message: string;
594
677
  count: number;
@@ -637,12 +720,16 @@ export declare const SessionSummarySchema: z.ZodObject<{
637
720
  clientVersions?: Record<string, string> | undefined;
638
721
  appConnects?: number | undefined;
639
722
  msToFirstApp?: number | undefined;
723
+ toolCallsBeforeApp?: number | undefined;
640
724
  endReason?: "verified" | "abandoned" | "never_used" | "explored" | "client_left" | undefined;
641
725
  feedbackPrompted?: number | undefined;
642
726
  errorClasses?: Record<string, number> | undefined;
643
727
  errorsRecovered?: number | undefined;
644
728
  errorsRepeated?: number | undefined;
645
729
  endedWithVerdict?: boolean | undefined;
730
+ lifetimeToolCalls?: number | undefined;
731
+ lifetimeVerifications?: number | undefined;
732
+ lifetimeBugsFound?: number | undefined;
646
733
  updateNudged?: boolean | undefined;
647
734
  updateOffered?: string | undefined;
648
735
  hudControls?: Record<string, number> | undefined;
@@ -651,6 +738,8 @@ export declare const SessionSummarySchema: z.ZodObject<{
651
738
  hudSlides?: Record<string, number> | undefined;
652
739
  hudJourney?: string[] | undefined;
653
740
  hudJourneyCut?: true | undefined;
741
+ nudgesShown?: Partial<Record<"connect" | "close_gaps" | "switch_on" | "explore", number>> | undefined;
742
+ harnessRefusedCoverage?: Partial<Record<"0-19" | "20-39" | "40-59" | "60-79" | "80-100", number>> | undefined;
654
743
  exit?: "signal" | "idle" | "unknown" | undefined;
655
744
  }>;
656
745
  export type SessionSummary = z.infer<typeof SessionSummarySchema>;
@@ -845,7 +934,7 @@ export declare const ProjectProfileSchema: z.ZodObject<{
845
934
  featureDepth: number;
846
935
  stack?: string | undefined;
847
936
  stackMajor?: number | undefined;
848
- size?: "medium" | "tiny" | "small" | "large" | "huge" | undefined;
937
+ size?: "small" | "medium" | "tiny" | "large" | "huge" | undefined;
849
938
  stackSource?: "cwd" | "workspace" | undefined;
850
939
  stackUnknownReason?: "no_app_found" | "manifest_unrecognised" | "workspace_apps_unrecognised" | "workspace_root_no_apps" | "discovery_failed" | undefined;
851
940
  monorepo?: boolean | undefined;
@@ -865,7 +954,7 @@ export declare const ProjectProfileSchema: z.ZodObject<{
865
954
  featureDepth: number;
866
955
  stack?: string | undefined;
867
956
  stackMajor?: number | undefined;
868
- size?: "medium" | "tiny" | "small" | "large" | "huge" | undefined;
957
+ size?: "small" | "medium" | "tiny" | "large" | "huge" | undefined;
869
958
  stackSource?: "cwd" | "workspace" | undefined;
870
959
  stackUnknownReason?: "no_app_found" | "manifest_unrecognised" | "workspace_apps_unrecognised" | "workspace_root_no_apps" | "discovery_failed" | undefined;
871
960
  monorepo?: boolean | undefined;