@reticlehq/core 2.2.1 → 2.4.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.
- package/dist/brand.d.ts +0 -1
- package/dist/brand.js +0 -1
- package/dist/consequence.d.ts +0 -1
- package/dist/consequence.js +0 -1
- package/dist/constants.d.ts +30 -33
- package/dist/constants.js +33 -31
- package/dist/daemon-registry.d.ts +0 -1
- package/dist/daemon-registry.js +0 -1
- package/dist/desktop-contract.cjs +11 -0
- package/dist/desktop-contract.d.cts +6 -0
- package/dist/desktop-contract.d.ts +58 -0
- package/dist/desktop-contract.js +59 -0
- package/dist/event-payloads.d.ts +62 -5
- package/dist/event-payloads.js +35 -4
- package/dist/event-priority.d.ts +25 -0
- package/dist/event-priority.js +45 -0
- package/dist/findings.d.ts +124 -0
- package/dist/findings.js +122 -0
- package/dist/flow-constants.d.ts +0 -1
- package/dist/flow-constants.js +0 -1
- package/dist/flow-types.d.ts +26 -2
- package/dist/flow-types.js +0 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +9 -2
- package/dist/journal.d.ts +0 -1
- package/dist/journal.js +0 -1
- package/dist/messages.d.ts +40 -11
- package/dist/messages.js +14 -1
- package/dist/net.d.ts +41 -0
- package/dist/net.js +40 -0
- package/dist/notices.d.ts +0 -1
- package/dist/notices.js +0 -1
- package/dist/redaction.d.ts +64 -1
- package/dist/redaction.js +119 -3
- package/dist/schema/event-message.json +3 -1
- package/dist/schema/event-type.json +3 -1
- package/dist/schema/hello-message.json +9 -0
- package/dist/schema/reticle-event.json +3 -1
- package/dist/schema/reticle-message.json +12 -1
- package/dist/security.d.ts +20 -1
- package/dist/security.js +45 -1
- package/dist/session-constants.d.ts +0 -1
- package/dist/session-constants.js +0 -1
- package/dist/source-constants.d.ts +26 -0
- package/dist/source-constants.js +26 -0
- package/dist/state-select.d.ts +10 -1
- package/dist/state-select.js +56 -8
- package/dist/telemetry-feedback.d.ts +265 -0
- package/dist/telemetry-feedback.js +163 -0
- package/dist/telemetry-session.d.ts +524 -0
- package/dist/telemetry-session.js +245 -0
- package/dist/telemetry.d.ts +1410 -37
- package/dist/telemetry.js +338 -18
- package/dist/toon.d.ts +0 -1
- package/dist/toon.js +0 -1
- package/dist/types.d.ts +15 -8
- package/dist/types.js +0 -1
- package/dist/upgrade.d.ts +0 -1
- package/dist/upgrade.js +0 -1
- package/dist/verification-run.d.ts +14 -15
- package/dist/verification-run.js +0 -1
- package/dist/verified-constants.d.ts +104 -0
- package/dist/verified-constants.js +102 -0
- package/package.json +7 -3
- package/dist/brand.d.ts.map +0 -1
- package/dist/brand.js.map +0 -1
- package/dist/consequence.d.ts.map +0 -1
- package/dist/consequence.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/daemon-registry.d.ts.map +0 -1
- package/dist/daemon-registry.js.map +0 -1
- package/dist/event-payloads.d.ts.map +0 -1
- package/dist/event-payloads.js.map +0 -1
- package/dist/flow-constants.d.ts.map +0 -1
- package/dist/flow-constants.js.map +0 -1
- package/dist/flow-types.d.ts.map +0 -1
- package/dist/flow-types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/journal.d.ts.map +0 -1
- package/dist/journal.js.map +0 -1
- package/dist/messages.d.ts.map +0 -1
- package/dist/messages.js.map +0 -1
- package/dist/notices.d.ts.map +0 -1
- package/dist/notices.js.map +0 -1
- package/dist/redaction.d.ts.map +0 -1
- package/dist/redaction.js.map +0 -1
- package/dist/security.d.ts.map +0 -1
- package/dist/security.js.map +0 -1
- package/dist/session-constants.d.ts.map +0 -1
- package/dist/session-constants.js.map +0 -1
- package/dist/state-select.d.ts.map +0 -1
- package/dist/state-select.js.map +0 -1
- package/dist/telemetry.d.ts.map +0 -1
- package/dist/telemetry.js.map +0 -1
- package/dist/toon.d.ts.map +0 -1
- package/dist/toon.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/upgrade.d.ts.map +0 -1
- package/dist/upgrade.js.map +0 -1
- package/dist/verification-run.d.ts.map +0 -1
- package/dist/verification-run.js.map +0 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a SESSION and a PROJECT measured — the two big rollup payloads and the types they are built from.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `telemetry.ts` because they are a different kind of thing from the event contract next
|
|
5
|
+
* door: that file answers "what happened", these answer "how much, how long, and on what". They are
|
|
6
|
+
* also where nearly all the growth is — every new thing worth measuring lands in one of these two
|
|
7
|
+
* shapes — so keeping them here is what stops the event contract itself from drifting past its cap
|
|
8
|
+
* every time a counter is added.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
/**
|
|
12
|
+
* One distinct error shape seen during a session, with the detail needed to fix it.
|
|
13
|
+
*
|
|
14
|
+
* Replaces a bare `{fingerprint: count}` map, which had the same no-dictionary problem as the crash
|
|
15
|
+
* payload: you could rank the top error and never learn what it was, or which tool produced it.
|
|
16
|
+
*/
|
|
17
|
+
export const ErrorShapeSchema = z.object({
|
|
18
|
+
/** Stable group key — the same defect from any machine shares it. */
|
|
19
|
+
fingerprint: z.string().min(1).max(64),
|
|
20
|
+
/** How many times it happened this session. */
|
|
21
|
+
count: z.number().int().nonnegative(),
|
|
22
|
+
/** The message with every variable part stripped. The dictionary entry for the fingerprint. */
|
|
23
|
+
message: z.string().max(300),
|
|
24
|
+
/** Which tool produced it — the same message from two tools is usually two different bugs. */
|
|
25
|
+
tool: z.string().max(64).optional(),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Whether the project has git, and whether anyone has pushed it.
|
|
29
|
+
*
|
|
30
|
+
* The distinction matters for more than curiosity: `projectId` can only identify the SAME project
|
|
31
|
+
* across two machines when it is derived from a shared git origin. A repo nobody has pushed has
|
|
32
|
+
* nothing shared to hash, so its fingerprint falls back to the local directory path.
|
|
33
|
+
*/
|
|
34
|
+
export const GitState = {
|
|
35
|
+
/** No `.git` anywhere above the project — Reticle is running in a plain directory. */
|
|
36
|
+
NONE: 'none',
|
|
37
|
+
/** `git init` was run, but there is no origin remote. Nobody else can be working on this copy. */
|
|
38
|
+
LOCAL_ONLY: 'local_only',
|
|
39
|
+
/** There is an origin remote — the project is pushed and can be shared. */
|
|
40
|
+
REMOTE: 'remote',
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Which forge hosts the repo. Public forges are named; everything else is `self_hosted` WITHOUT its
|
|
44
|
+
* hostname, because an internal git host is usually `git.<company>.com` and reporting it would
|
|
45
|
+
* identify the company outright. The bucket carries the signal that actually matters — self-hosted
|
|
46
|
+
* git is a strong enterprise tell.
|
|
47
|
+
*/
|
|
48
|
+
export const RepoForge = {
|
|
49
|
+
GITHUB: 'github',
|
|
50
|
+
GITLAB: 'gitlab',
|
|
51
|
+
BITBUCKET: 'bitbucket',
|
|
52
|
+
AZURE: 'azure',
|
|
53
|
+
SOURCEHUT: 'sourcehut',
|
|
54
|
+
CODEBERG: 'codeberg',
|
|
55
|
+
SELF_HOSTED: 'self_hosted',
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* What the machine looked like at a moment worth remembering — a crash, or the end of a session.
|
|
59
|
+
*
|
|
60
|
+
* Sampled at MOMENTS, never per tool call: `os.loadavg()` and `process.memoryUsage()` are cheap but
|
|
61
|
+
* not free, and taking them 200 times a session to answer "was the machine struggling" would be
|
|
62
|
+
* paying a continuous cost for a question only asked about the bad moments. Absolute numbers in MB
|
|
63
|
+
* rather than percentages, because "2 GB free of 8" and "2 GB free of 64" are different worlds.
|
|
64
|
+
*/
|
|
65
|
+
export const MachineSnapshotSchema = z.object({
|
|
66
|
+
/** Resident set size of the daemon itself — our footprint, the one we can actually fix. */
|
|
67
|
+
rssMb: z.number().int().nonnegative(),
|
|
68
|
+
heapUsedMb: z.number().int().nonnegative(),
|
|
69
|
+
/** Free and total system memory. A machine at 200 MB free explains a lot of otherwise-weird bugs. */
|
|
70
|
+
freeMemMb: z.number().int().nonnegative(),
|
|
71
|
+
totalMemMb: z.number().int().nonnegative(),
|
|
72
|
+
/** 1-minute load average, ×100 so it stays an integer. Zero on Windows, which does not report it. */
|
|
73
|
+
load1x100: z.number().int().nonnegative(),
|
|
74
|
+
cpuCount: z.number().int().nonnegative(),
|
|
75
|
+
});
|
|
76
|
+
/** Per-tool wall-clock. `count` lives in `toolCounts`; these are the two numbers it does not carry. */
|
|
77
|
+
export const ToolTimingSchema = z.object({
|
|
78
|
+
/** Total ms spent inside this tool. Divided by its count, the average; summed, the time in Reticle. */
|
|
79
|
+
totalMs: z.number().int().nonnegative(),
|
|
80
|
+
/** The single worst call. An average hides the 30-second outlier that made someone give up. */
|
|
81
|
+
maxMs: z.number().int().nonnegative(),
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Attempts, successes and failure reasons for one kind of connection.
|
|
85
|
+
*
|
|
86
|
+
* The first version of this counted only successes — and counted them inconsistently, incrementing
|
|
87
|
+
* before the await on one path and after it on another, so the CDP number was attempts and the others
|
|
88
|
+
* were successes and nobody could have told from the data. A connection metric that cannot express
|
|
89
|
+
* FAILURE is close to useless: the whole question is how often people cannot get a browser.
|
|
90
|
+
*/
|
|
91
|
+
export const ConnectionStatsSchema = z.object({
|
|
92
|
+
attempts: z.number().int().nonnegative(),
|
|
93
|
+
successes: z.number().int().nonnegative(),
|
|
94
|
+
/** Failure reasons with counts — our own classified vocabulary, never a raw error string. */
|
|
95
|
+
failures: z.record(z.string(), z.number().int().nonnegative()).optional(),
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Why a browser/lease connection failed, classified into causes we can act on.
|
|
99
|
+
*
|
|
100
|
+
* A raw message would be both high-cardinality and unsafe (it can carry a URL or a path). These are
|
|
101
|
+
* the distinct THINGS THAT GO WRONG, each with a different fix: a missing Chromium is a docs problem,
|
|
102
|
+
* a refused CDP url is a configuration problem, a pool timeout is a capacity problem.
|
|
103
|
+
*/
|
|
104
|
+
export const ConnectFailure = {
|
|
105
|
+
/** Playwright's browser binary was never downloaded — `npx playwright install`. */
|
|
106
|
+
CHROMIUM_MISSING: 'chromium_missing',
|
|
107
|
+
/** `playwright` itself is not installed; the optional dependency was skipped. */
|
|
108
|
+
PLAYWRIGHT_MISSING: 'playwright_missing',
|
|
109
|
+
/** Nothing listening on the CDP endpoint, or it refused us. */
|
|
110
|
+
CDP_UNREACHABLE: 'cdp_unreachable',
|
|
111
|
+
/** The browser launched but died, or was closed underneath us. */
|
|
112
|
+
BROWSER_CRASHED: 'browser_crashed',
|
|
113
|
+
/** Waited for a pool slot and never got one. A capacity signal, not an error. */
|
|
114
|
+
POOL_TIMEOUT: 'pool_timeout',
|
|
115
|
+
/** Classified as nothing we recognize — the bucket to watch, since a big one means a blind spot. */
|
|
116
|
+
OTHER: 'other',
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* One session, rolled up. This replaces the per-tool-call event entirely — see the volume note on
|
|
120
|
+
* `TelemetryEventKind`. The histogram is the point: `{reticle_act: 40, reticle_assert: 12}` says the
|
|
121
|
+
* session was a real verification loop, where 52 separate rows would have said only that 52 things
|
|
122
|
+
* happened. Counts, never payloads: no arguments, no results, no selectors.
|
|
123
|
+
*/
|
|
124
|
+
export const SessionSummarySchema = z.object({
|
|
125
|
+
/** How long the daemon was up, ms. */
|
|
126
|
+
durationMs: z.number().int().nonnegative(),
|
|
127
|
+
/** Total MCP tool calls served. */
|
|
128
|
+
toolCalls: z.number().int().nonnegative(),
|
|
129
|
+
/**
|
|
130
|
+
* Calls per tool name — `{ "reticle_act": 40 }`. Tool names are a fixed, low-cardinality set we
|
|
131
|
+
* define ourselves, so this is safe to send whole and is queryable in HogQL with JSONExtract.
|
|
132
|
+
*/
|
|
133
|
+
toolCounts: z.record(z.string(), z.number().int().nonnegative()),
|
|
134
|
+
/** Tool calls that ended in an error, and the distinct error shapes behind them. */
|
|
135
|
+
toolErrors: z.number().int().nonnegative(),
|
|
136
|
+
/**
|
|
137
|
+
* The distinct error shapes seen, with counts, messages-with-variables-stripped, and the tool that
|
|
138
|
+
* produced each. Bounded, so a pathological loop cannot grow it without limit.
|
|
139
|
+
*/
|
|
140
|
+
errors: z.array(ErrorShapeSchema).max(40).optional(),
|
|
141
|
+
/**
|
|
142
|
+
* Failures reported by the IN-PAGE half of Reticle. Half the product runs in the browser and had no
|
|
143
|
+
* error reporting at all — every SDK catch block swallowed silently, so a broken observer just made
|
|
144
|
+
* the product quieter and nobody found out.
|
|
145
|
+
*/
|
|
146
|
+
sdkFailures: z.number().int().nonnegative().optional(),
|
|
147
|
+
/** The distinct SDK failure shapes, with the module that reported each. */
|
|
148
|
+
sdkErrors: z.array(ErrorShapeSchema).max(40).optional(),
|
|
149
|
+
/** Verifications that produced a verdict during the session. */
|
|
150
|
+
verifications: z.number().int().nonnegative(),
|
|
151
|
+
/** Defects found in the app under test — the outcome number, not an activity number. */
|
|
152
|
+
bugsFound: z.number().int().nonnegative().optional(),
|
|
153
|
+
/** Those bugs by kind, so the headline number can always be broken down rather than asserted. */
|
|
154
|
+
bugKinds: z.record(z.string(), z.number().int().nonnegative()).optional(),
|
|
155
|
+
/**
|
|
156
|
+
* Which PARAMETERS agents actually passed, per tool: `{"reticle_act": {"ref": 40, "action:click": 31}}`.
|
|
157
|
+
*
|
|
158
|
+
* Names only, with one narrow exception for parameters whose values are enums we define ourselves
|
|
159
|
+
* (`action:click`). Never a raw value: `reticle_act`'s `args` carries the text being typed into the
|
|
160
|
+
* app, which on a login form is a password. See argument-shape.ts for the allowlist.
|
|
161
|
+
*/
|
|
162
|
+
toolParams: z.record(z.string(), z.record(z.string(), z.number().int().nonnegative())).optional(),
|
|
163
|
+
/**
|
|
164
|
+
* Browser/lease connections by kind, with attempts AND failures. Replaces a bare success counter
|
|
165
|
+
* that could not express the only interesting outcome.
|
|
166
|
+
*/
|
|
167
|
+
connections: z.record(z.string(), ConnectionStatsSchema).optional(),
|
|
168
|
+
/** Wall-clock per tool. With `toolCounts` this gives average, worst, and total time in Reticle. */
|
|
169
|
+
toolTiming: z.record(z.string(), ToolTimingSchema).optional(),
|
|
170
|
+
/**
|
|
171
|
+
* Total ms spent inside tool calls. The headline answer to "how much time does verification cost",
|
|
172
|
+
* and comparable against `durationMs` to see what fraction of a session Reticle was actually busy.
|
|
173
|
+
*/
|
|
174
|
+
busyMs: z.number().int().nonnegative().optional(),
|
|
175
|
+
/**
|
|
176
|
+
* Time spent waiting on the BROWSER, and how many commands that was. Subtracted from `busyMs` this
|
|
177
|
+
* separates Reticle's own overhead from the app's — opposite fixes, previously indistinguishable.
|
|
178
|
+
*/
|
|
179
|
+
browserMs: z.number().int().nonnegative().optional(),
|
|
180
|
+
browserCommands: z.number().int().nonnegative().optional(),
|
|
181
|
+
/** The most tool calls in flight at once — parallel agents, or one agent fanning out. */
|
|
182
|
+
peakConcurrentTools: z.number().int().nonnegative().optional(),
|
|
183
|
+
/** Calls for a tool name that does not exist. A non-zero value means our surface is confusing. */
|
|
184
|
+
unknownToolCalls: z.number().int().nonnegative().optional(),
|
|
185
|
+
/** The machine at shutdown — was it starved while all this was happening? */
|
|
186
|
+
machine: MachineSnapshotSchema.optional(),
|
|
187
|
+
/** Distinct MCP clients seen (`claude-code`, `cursor`), so multi-agent use is visible. */
|
|
188
|
+
clients: z.array(z.string().max(64)).max(8).optional(),
|
|
189
|
+
/** Was this a clean shutdown, or a periodic flush of a still-running session? */
|
|
190
|
+
final: z.boolean(),
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Coarse size buckets. A bucket answers "is this a toy or a real codebase" — which is the actual
|
|
194
|
+
* question — while an exact file count starts to be a fingerprint, especially combined with the
|
|
195
|
+
* stack and the framework version.
|
|
196
|
+
*/
|
|
197
|
+
export const ProjectSize = {
|
|
198
|
+
TINY: 'tiny', // < 50 source files — a demo or a spike
|
|
199
|
+
SMALL: 'small', // < 250
|
|
200
|
+
MEDIUM: 'medium', // < 1000
|
|
201
|
+
LARGE: 'large', // < 5000
|
|
202
|
+
HUGE: 'huge', // 5000+ — a monorepo or a mature product
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* The shape of the project and how much of Reticle it actually uses.
|
|
206
|
+
*
|
|
207
|
+
* `featureDepth` is the one to watch: someone running 40 saved flows with visual baselines and a
|
|
208
|
+
* checked-in contract is a different company from someone who called `reticle_snapshot` twice. Both
|
|
209
|
+
* look identical in a DAU chart, and only one of them is retained.
|
|
210
|
+
*/
|
|
211
|
+
export const ProjectProfileSchema = z.object({
|
|
212
|
+
/** Framework detected from package.json (`next`, `vite`, `vue`, `astro`, …). */
|
|
213
|
+
stack: z.string().min(1).max(64).optional(),
|
|
214
|
+
/** Its MAJOR version only — "breaks on React 19" is a work item, a full semver is a fingerprint. */
|
|
215
|
+
stackMajor: z.number().int().nonnegative().optional(),
|
|
216
|
+
size: z.nativeEnum(ProjectSize).optional(),
|
|
217
|
+
/** True when the repo has workspaces — monorepos exercise very different code paths. */
|
|
218
|
+
monorepo: z.boolean().optional(),
|
|
219
|
+
/** No git / git init but unpushed / pushed to a remote. */
|
|
220
|
+
git: z.nativeEnum(GitState),
|
|
221
|
+
/** Which forge, bucketed. Absent unless `git` is `remote`. Never the hostname of a private host. */
|
|
222
|
+
forge: z.nativeEnum(RepoForge).optional(),
|
|
223
|
+
/**
|
|
224
|
+
* How long this project has existed, in whole WEEKS, from its first commit. Answers "are people
|
|
225
|
+
* adopting Reticle on greenfield spikes or on mature codebases" — the single most useful thing to
|
|
226
|
+
* know about who this is for. Weeks, not a date: a date plus a stack narrows to a specific repo.
|
|
227
|
+
*/
|
|
228
|
+
ageWeeks: z.number().int().nonnegative().optional(),
|
|
229
|
+
/** Saved flows on disk — the deterministic-replay suite. 0 means replay was never adopted. */
|
|
230
|
+
flowCount: z.number().int().nonnegative(),
|
|
231
|
+
/** Saved text baselines. */
|
|
232
|
+
baselineCount: z.number().int().nonnegative(),
|
|
233
|
+
/** Saved pixel baselines — visual regression adoption. */
|
|
234
|
+
visualBaselineCount: z.number().int().nonnegative(),
|
|
235
|
+
/** Recorded verification-run artifacts — CI/OEM consumption. */
|
|
236
|
+
runCount: z.number().int().nonnegative(),
|
|
237
|
+
/** A git-checked `.reticle/contract.json` — the team declared a testable surface on purpose. */
|
|
238
|
+
hasContract: z.boolean(),
|
|
239
|
+
/** Fail-to-pass bug capsules — the deepest feature in the product. */
|
|
240
|
+
capsuleCount: z.number().int().nonnegative(),
|
|
241
|
+
/** Which of Reticle's feature FAMILIES this project has ever touched. The activation metric. */
|
|
242
|
+
featuresUsed: z.array(z.string().max(32)).max(24),
|
|
243
|
+
/** 0–1: the fraction of shipped feature families in use. One number for "are they getting value". */
|
|
244
|
+
featureDepth: z.number().min(0).max(1),
|
|
245
|
+
});
|